logics for weighted automata and...

Post on 12-Jul-2020

12 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Logics for Weighted Automata

and TransducersBenjamin Monmege

LIF, Aix-Marseille Université, France

Based on joint works with Paul Gastin, Benedikt Bollig and Marc Zeitoun

Software Verification

Software Verification

Critical Software• communication systems• e-commerce• health databases• energy production

Software Verification

Critical Software• communication systems• e-commerce• health databases• energy productionTO�BE��VERIFIED

Software Verification

Critical Software• communication systems• e-commerce• health databases• energy productionTO�BE��VERIFIED

Property to be verified

Software Verification

Critical Software• communication systems• e-commerce• health databases• energy productionTO�BE��VERIFIED

Is the property verified or not by the software?

Property to be verified

Software Verification

Critical Software• communication systems• e-commerce• health databases• energy productionTO�BE��VERIFIED

Is the property verified or not by the software?

Property to be verified

• May an error state be reached?• Is there a book written by X, rented by Y?• Does this leader election protocol permit to elect the leader?

Software Verification

Critical Software• communication systems• e-commerce• health databases• energy productionTO�BE��VERIFIED

Is the property verified or not by the software?

Property to be verified

• May an error state be reached?• Is there a book written by X, rented by Y?• Does this leader election protocol permit to elect the leader?

• What is the probability for an error state to be reached?• How many books, written by X, have been rented by Y?• What is the maximal delay ensuring that this leader election protocol permits the election?

From Boolean to Quantitative Verification

Formal Verification

Critical Software• communication systems• e-commerce• health databases• energy productionTO�

BE��VERIFIED

Is the property verified or not by the software?

Property to be verified

Formal Verification

Critical Software• communication systems• e-commerce• health databases• energy productionTO�

BE��VERIFIED

Formal Model

Property to be verified

ababcaabb

ababcaabb

a

b

c

a

c c

Is the property verified or not by the model?

Formal Verification

Critical Software• communication systems• e-commerce• health databases• energy productionTO�

BE��VERIFIED

Formal Model

Property to be verified

(a+ b)?c(ac)+

FG (pU q)

ababcaabb

ababcaabb

a

b

c

a

c c

Formal Specification

Is the property verified or not by the model?

Qualitative/QuantitativeQualitative, Boolean: [Büchi’60], [Elgot’61], [Trakhtenbrot’61]

Automata MSO logic

Qualitative/QuantitativeQualitative, Boolean: [Büchi’60], [Elgot’61], [Trakhtenbrot’61]

Quantitative, weights

Automata MSO logic

Weighted Automata

Qualitative/QuantitativeQualitative, Boolean: [Büchi’60], [Elgot’61], [Trakhtenbrot’61]

Quantitative, weights

Automata MSO logic

Weighted Automata

???

Qualitative/QuantitativeQualitative, Boolean: [Büchi’60], [Elgot’61], [Trakhtenbrot’61]

Quantitative, weights

Automata MSO logic

Weighted Automata

???

Find suitable weighted MSO logic

Qualitative/QuantitativeQualitative, Boolean: [Büchi’60], [Elgot’61], [Trakhtenbrot’61]

Quantitative, weights

Automata MSO logic

Weighted Automata

???

Find suitable weighted MSO logic

Focus on definability / qualitative

Qualitative/QuantitativeQualitative, Boolean: [Büchi’60], [Elgot’61], [Trakhtenbrot’61]

Quantitative, weights

Automata MSO logic

Weighted Automata

???

Find suitable weighted MSO logic

Focus on definability / qualitative

Focus on computation / quantitative

Weighted Automata

0 1 2

a, 0

b, 0

a, 1

b, 0 b, 0

a, 0

b, 0

0 1

Σ, 1

a, 1

b,−1

Σ, 1

Weighted Automata

0 1 2

a, 0

b, 0

a, 1

b, 0 b, 0

a, 0

b, 0

0 1

Σ, 1

a, 1

b,−1

Σ, 1

(Z,+,×,0,1)

Weighted Automata

0 1 2

a, 0

b, 0

a, 1

b, 0 b, 0

a, 0

b, 0

0 1

Σ, 1

a, 1

b,−1

Σ, 1

(Z,+,×,0,1)

0 a,1⎯ →⎯⎯ 1 b,1⎯ →⎯⎯ 1 a,1⎯ →⎯⎯ 1 1

Weighted Automata

0 1 2

a, 0

b, 0

a, 1

b, 0 b, 0

a, 0

b, 0

0 1

Σ, 1

a, 1

b,−1

Σ, 1

(Z,+,×,0,1)

0 a,1⎯ →⎯⎯ 1 b,1⎯ →⎯⎯ 1 a,1⎯ →⎯⎯ 1

0 a,1⎯ →⎯⎯ 0 b,−1⎯ →⎯⎯ 1 a,1⎯ →⎯⎯ 1

1

-1

Weighted Automata

0 1 2

a, 0

b, 0

a, 1

b, 0 b, 0

a, 0

b, 0

0 1

Σ, 1

a, 1

b,−1

Σ, 1

(Z,+,×,0,1)

0 a,1⎯ →⎯⎯ 1 b,1⎯ →⎯⎯ 1 a,1⎯ →⎯⎯ 1

0 a,1⎯ →⎯⎯ 0 b,−1⎯ →⎯⎯ 1 a,1⎯ →⎯⎯ 1

0 a,1⎯ →⎯⎯ 0 b,1⎯ →⎯⎯ 0 a,1⎯ →⎯⎯ 1

1

-1

1

Weighted Automata

0 1 2

a, 0

b, 0

a, 1

b, 0 b, 0

a, 0

b, 0

0 1

Σ, 1

a, 1

b,−1

Σ, 1

(Z,+,×,0,1)

0 a,1⎯ →⎯⎯ 1 b,1⎯ →⎯⎯ 1 a,1⎯ →⎯⎯ 1

0 a,1⎯ →⎯⎯ 0 b,−1⎯ →⎯⎯ 1 a,1⎯ →⎯⎯ 1

0 a,1⎯ →⎯⎯ 0 b,1⎯ →⎯⎯ 0 a,1⎯ →⎯⎯ 1

1

-1

1

Semantics of aba: 1+(-1)+1 = 1

Weighted Automata

0 1 2

a, 0

b, 0

a, 1

b, 0 b, 0

a, 0

b, 0

0 1

Σ, 1

a, 1

b,−1

Σ, 1

(Z,+,×,0,1)

0 a,1⎯ →⎯⎯ 1 b,1⎯ →⎯⎯ 1 a,1⎯ →⎯⎯ 1

0 a,1⎯ →⎯⎯ 0 b,−1⎯ →⎯⎯ 1 a,1⎯ →⎯⎯ 1

0 a,1⎯ →⎯⎯ 0 b,1⎯ →⎯⎯ 0 a,1⎯ →⎯⎯ 1

1

-1

1

Semantics of aba: 1+(-1)+1 = 1

#a(w) - #b(w)

Weighted Automata

0 1 2

a, 0

b, 0

a, 1

b, 0 b, 0

a, 0

b, 0

0 1

Σ, 1

a, 1

b,−1

Σ, 1

(Z,+,×,0,1) (Z∪{−∞},max,+,−∞,0)

0 a,1⎯ →⎯⎯ 1 b,1⎯ →⎯⎯ 1 a,1⎯ →⎯⎯ 1

0 a,1⎯ →⎯⎯ 0 b,−1⎯ →⎯⎯ 1 a,1⎯ →⎯⎯ 1

0 a,1⎯ →⎯⎯ 0 b,1⎯ →⎯⎯ 0 a,1⎯ →⎯⎯ 1

1

-1

1

Semantics of aba: 1+(-1)+1 = 1

#a(w) - #b(w)

Weighted Automata

0 1 2

a, 0

b, 0

a, 1

b, 0 b, 0

a, 0

b, 0

0 1

Σ, 1

a, 1

b,−1

Σ, 1

(Z,+,×,0,1) (Z∪{−∞},max,+,−∞,0)

0 a,1⎯ →⎯⎯ 1 b,1⎯ →⎯⎯ 1 a,1⎯ →⎯⎯ 1

0 a,1⎯ →⎯⎯ 0 b,−1⎯ →⎯⎯ 1 a,1⎯ →⎯⎯ 1

0 a,1⎯ →⎯⎯ 0 b,1⎯ →⎯⎯ 0 a,1⎯ →⎯⎯ 1

1

-1

1

Semantics of aba: 1+(-1)+1 = 1

#a(w) - #b(w)

1 a,1⎯ →⎯⎯ 1 a,1⎯ →⎯⎯ 1 b,0⎯ →⎯⎯ 2 a,0⎯ →⎯⎯ 2 2

Weighted Automata

0 1 2

a, 0

b, 0

a, 1

b, 0 b, 0

a, 0

b, 0

0 1

Σ, 1

a, 1

b,−1

Σ, 1

(Z,+,×,0,1) (Z∪{−∞},max,+,−∞,0)

0 a,1⎯ →⎯⎯ 1 b,1⎯ →⎯⎯ 1 a,1⎯ →⎯⎯ 1

0 a,1⎯ →⎯⎯ 0 b,−1⎯ →⎯⎯ 1 a,1⎯ →⎯⎯ 1

0 a,1⎯ →⎯⎯ 0 b,1⎯ →⎯⎯ 0 a,1⎯ →⎯⎯ 1

1

-1

1

Semantics of aba: 1+(-1)+1 = 1

#a(w) - #b(w)

1 a,1⎯ →⎯⎯ 1 a,1⎯ →⎯⎯ 1 b,0⎯ →⎯⎯ 2 a,0⎯ →⎯⎯ 2

0 a,0⎯ →⎯⎯ 0 a,0⎯ →⎯⎯ 0 b,0⎯ →⎯⎯ 1 a,1⎯ →⎯⎯ 1

2

1

Weighted Automata

0 1 2

a, 0

b, 0

a, 1

b, 0 b, 0

a, 0

b, 0

0 1

Σ, 1

a, 1

b,−1

Σ, 1

(Z,+,×,0,1) (Z∪{−∞},max,+,−∞,0)

0 a,1⎯ →⎯⎯ 1 b,1⎯ →⎯⎯ 1 a,1⎯ →⎯⎯ 1

0 a,1⎯ →⎯⎯ 0 b,−1⎯ →⎯⎯ 1 a,1⎯ →⎯⎯ 1

0 a,1⎯ →⎯⎯ 0 b,1⎯ →⎯⎯ 0 a,1⎯ →⎯⎯ 1

1

-1

1

Semantics of aba: 1+(-1)+1 = 1

#a(w) - #b(w)

1 a,1⎯ →⎯⎯ 1 a,1⎯ →⎯⎯ 1 b,0⎯ →⎯⎯ 2 a,0⎯ →⎯⎯ 2

0 a,0⎯ →⎯⎯ 0 a,0⎯ →⎯⎯ 0 b,0⎯ →⎯⎯ 1 a,1⎯ →⎯⎯ 1

2

1

Semantics of aaba: max(2,1) = 2

Weighted Automata

0 1 2

a, 0

b, 0

a, 1

b, 0 b, 0

a, 0

b, 0

0 1

Σ, 1

a, 1

b,−1

Σ, 1

(Z,+,×,0,1) (Z∪{−∞},max,+,−∞,0)

0 a,1⎯ →⎯⎯ 1 b,1⎯ →⎯⎯ 1 a,1⎯ →⎯⎯ 1

0 a,1⎯ →⎯⎯ 0 b,−1⎯ →⎯⎯ 1 a,1⎯ →⎯⎯ 1

0 a,1⎯ →⎯⎯ 0 b,1⎯ →⎯⎯ 0 a,1⎯ →⎯⎯ 1

1

-1

1

Semantics of aba: 1+(-1)+1 = 1

#a(w) - #b(w) max size of a’s blocks

1 a,1⎯ →⎯⎯ 1 a,1⎯ →⎯⎯ 1 b,0⎯ →⎯⎯ 2 a,0⎯ →⎯⎯ 2

0 a,0⎯ →⎯⎯ 0 a,0⎯ →⎯⎯ 0 b,0⎯ →⎯⎯ 1 a,1⎯ →⎯⎯ 1

2

1

Semantics of aaba: max(2,1) = 2

How to Specify Quantitative Properties?

How to Specify Quantitative Properties?Weighted Monadic Second Order Logic [Droste&Gastin 05]generalized to trees [Droste&Vogler 06], infinite words [Droste&Rahonis 07], nested words [Mathissen 10] or pictures [Fichtner 11]

How to Specify Quantitative Properties?Weighted Monadic Second Order Logic [Droste&Gastin 05]generalized to trees [Droste&Vogler 06], infinite words [Droste&Rahonis 07], nested words [Mathissen 10] or pictures [Fichtner 11]

Weighted Regular Expressions over finite words [Kleene 56, Schützenberger 61]

How to Specify Quantitative Properties?Weighted Monadic Second Order Logic [Droste&Gastin 05]generalized to trees [Droste&Vogler 06], infinite words [Droste&Rahonis 07], nested words [Mathissen 10] or pictures [Fichtner 11]

Weighted Regular Expressions over finite words [Kleene 56, Schützenberger 61]

Weighted Temporal Logics: PCTL [Hansson&Jonsson 94], WLTL [Mandrali 12]

How to Specify Quantitative Properties?Weighted Monadic Second Order Logic [Droste&Gastin 05]generalized to trees [Droste&Vogler 06], infinite words [Droste&Rahonis 07], nested words [Mathissen 10] or pictures [Fichtner 11]

Weighted Regular Expressions over finite words [Kleene 56, Schützenberger 61]

Weighted Temporal Logics: PCTL [Hansson&Jonsson 94], WLTL [Mandrali 12]

• Core weighted logic for weighted automata

• Enhancing the logic to handle more properties: FO vs pebbles

• A special case: the transducers

Weighted MSOϕ ::= s | Pa(x) | x ! y | x ∈ X | ¬Pa(x) | ¬(x ! y) | ¬(x ∈ X)

| ϕ ∨ ϕ | ϕ ∧ ϕ | ∃xϕ | ∀xϕ | ∃X ϕ | ∀X ϕ

[Droste-Gastin, 05]

Weighted MSOϕ ::= s | Pa(x) | x ! y | x ∈ X | ¬Pa(x) | ¬(x ! y) | ¬(x ∈ X)

| ϕ ∨ ϕ | ϕ ∧ ϕ | ∃xϕ | ∀xϕ | ∃X ϕ | ∀X ϕ

[Droste-Gastin, 05]

Negation restricted to atomic formulae

Weighted MSOϕ ::= s | Pa(x) | x ! y | x ∈ X | ¬Pa(x) | ¬(x ! y) | ¬(x ∈ X)

| ϕ ∨ ϕ | ϕ ∧ ϕ | ∃xϕ | ∀xϕ | ∃X ϕ | ∀X ϕ

[Droste-Gastin, 05]

Negation restricted to atomic formulae

Arbitrary constants from a semiring

Inspired from the boolean semiring

ϕ ::= s | Pa(x) | x ! y | x ∈ X | ¬Pa(x) | ¬(x ! y) | ¬(x ∈ X)

| ϕ ∨ ϕ | ϕ ∧ ϕ | ∃xϕ | ∀xϕ | ∃X ϕ | ∀X ϕ

Semantics in a semiring S = (S,+,×, 0, 1)

Atomic formulae: 0,1

disjunction, existential quantifications: sum

conjunction, universal quantifications: product

B = ({0, 1},∨,∧, 0, 1)

[Droste-Gastin, 05]

Weighted MSO

ϕ ::= s | Pa(x) | x ! y | x ∈ X | ¬Pa(x) | ¬(x ! y) | ¬(x ∈ X)

| ϕ ∨ ϕ | ϕ ∧ ϕ | ∃xϕ | ∀xϕ | ∃X ϕ | ∀X ϕ

Examples

ϕ1 = ∃xPa(x)

[[ϕ1]](w) = |w|a

[Droste-Gastin, 05]

Weighted MSO

ϕ ::= s | Pa(x) | x ! y | x ∈ X | ¬Pa(x) | ¬(x ! y) | ¬(x ∈ X)

| ϕ ∨ ϕ | ϕ ∧ ϕ | ∃xϕ | ∀xϕ | ∃X ϕ | ∀X ϕ

Examples

ϕ1 = ∃xPa(x)

[[ϕ1]](w) = |w|a

ϕ2 = ∀x ∃y (y ! x ∧ Pa(y))

[[ϕ2]](abaab) = 1× 1× 2× 3× 3

[[ϕ2]](an) = n!

[Droste-Gastin, 05]

Weighted MSO

ϕ ::= s | Pa(x) | x ! y | x ∈ X | ¬Pa(x) | ¬(x ! y) | ¬(x ∈ X)

| ϕ ∨ ϕ | ϕ ∧ ϕ | ∃xϕ | ∀xϕ | ∃X ϕ | ∀X ϕ

Examples

ϕ1 = ∃xPa(x)

[[ϕ1]](w) = |w|a

ϕ2 = ∀x ∃y (y ! x ∧ Pa(y))

[[ϕ2]](abaab) = 1× 1× 2× 3× 3

[[ϕ2]](an) = n!

Too big to be computed by a

weighted automaton[Droste-Gastin, 05]

Weighted MSO

ϕ ::= s | Pa(x) | x ! y | x ∈ X | ¬Pa(x) | ¬(x ! y) | ¬(x ∈ X)

| ϕ ∨ ϕ | ϕ ∧ ϕ | ∃xϕ | ∀xϕ | ∃X ϕ | ∀X ϕ

Examples

ϕ1 = ∃xPa(x)

[[ϕ1]](w) = |w|a

ϕ2 = ∀x ∃y (y ! x ∧ Pa(y))

[[ϕ2]](abaab) = 1× 1× 2× 3× 3

[[ϕ2]](an) = n!

Too big to be computed by a

weighted automaton

We need to restrict weighted MSO

[Droste-Gastin, 05]

Weighted MSO

ϕ ::= s | Pa(x) | x ! y | x ∈ X | ¬Pa(x) | ¬(x ! y) | ¬(x ∈ X)

| ϕ ∨ ϕ | ϕ ∧ ϕ | ∃xϕ | ∀xϕ | ∃X ϕ | ∀X ϕ

Theorem: weighted automata = restricted wMSO

[Droste-Gastin, 05]

Weighted MSO

ϕ ::= s | Pa(x) | x ! y | x ∈ X | ¬Pa(x) | ¬(x ! y) | ¬(x ∈ X)

| ϕ ∨ ϕ | ϕ ∧ ϕ | ∃xϕ | ∀xϕ | ∃X ϕ | ∀X ϕ

Theorem: weighted automata = restricted wMSO

[Droste-Gastin, 05]

Weighted MSO

ϕ ::= s | Pa(x) | x ! y | x ∈ X | ¬Pa(x) | ¬(x ! y) | ¬(x ∈ X)

| ϕ ∨ ϕ | ϕ ∧ ϕ | ∃xϕ | ∀xϕ | ∃X ϕ | ∀X ϕ

Theorem: weighted automata = restricted wMSO

φ almost boolean

[Droste-Gastin, 05]

Weighted MSO

ϕ ::= s | Pa(x) | x ! y | x ∈ X | ¬Pa(x) | ¬(x ! y) | ¬(x ∈ X)

| ϕ ∨ ϕ | ϕ ∧ ϕ | ∃xϕ | ∀xϕ | ∃X ϕ | ∀X ϕ

Theorem: weighted automata = restricted wMSO

φ almost booleancommutativity

[Droste-Gastin, 05]

Weighted MSO

Core weighted MSO logic

[Gastin-Monmege, 15]

Boolean fragment

ϕ ::= ⊤ | Pa(x) | x ! y | x ∈ X | ¬ϕ | ϕ ∧ ϕ | ∀xϕ | ∀X ϕ

Core weighted MSO logic

[Gastin-Monmege, 15]

Boolean fragment

ϕ ::= ⊤ | Pa(x) | x ! y | x ∈ X | ¬ϕ | ϕ ∧ ϕ | ∀xϕ | ∀X ϕ

Step formulae Ψ ::= s | ϕ ?Ψ : Ψ

Core weighted MSO logic

[Gastin-Monmege, 15]

Boolean fragment

ϕ ::= ⊤ | Pa(x) | x ! y | x ∈ X | ¬ϕ | ϕ ∧ ϕ | ∀xϕ | ∀X ϕ

Step formulae Ψ ::= s | ϕ ?Ψ : Ψ

if … then … else …

Core weighted MSO logic

[Gastin-Monmege, 15]

Boolean fragment

ϕ ::= ⊤ | Pa(x) | x ! y | x ∈ X | ¬ϕ | ϕ ∧ ϕ | ∀xϕ | ∀X ϕ

Step formulae Ψ ::= s | ϕ ?Ψ : Ψ

if … then … else …Pa(x) ? 1 : 0

Core weighted MSO logic

[Gastin-Monmege, 15]

Boolean fragment

ϕ ::= ⊤ | Pa(x) | x ! y | x ∈ X | ¬ϕ | ϕ ∧ ϕ | ∀xϕ | ∀X ϕ

Step formulae Ψ ::= s | ϕ ?Ψ : Ψ

if … then … else …Pa(x) ? 1 : 0

Pa(x) ? 1 : (Pb(x) ?−1 : 0)

Core weighted MSO logic

[Gastin-Monmege, 15]

Boolean fragment

ϕ ::= ⊤ | Pa(x) | x ! y | x ∈ X | ¬ϕ | ϕ ∧ ϕ | ∀xϕ | ∀X ϕ

Step formulae Ψ ::= s | ϕ ?Ψ : Ψ

if … then … else …Pa(x) ? 1 : 0

x ∈ X1 ? s1 : (x ∈ X2 ? s2 : · · ·(x ∈ Xn−1 ? sn−1 : sn) · · · )

Pa(x) ? 1 : (Pb(x) ?−1 : 0)

Core weighted MSO logic

[Gastin-Monmege, 15]

Boolean fragment

ϕ ::= ⊤ | Pa(x) | x ! y | x ∈ X | ¬ϕ | ϕ ∧ ϕ | ∀xϕ | ∀X ϕ

Step formulae Ψ ::= s | ϕ ?Ψ : Ψ

if … then … else …Pa(x) ? 1 : 0

x ∈ X1 ? s1 : (x ∈ X2 ? s2 : · · ·(x ∈ Xn−1 ? sn−1 : sn) · · · )

[[Ψ ]](w,σ) = s some value occurring in Ψ

Pa(x) ? 1 : (Pb(x) ?−1 : 0)

Pa(x) ? 1 : (Pb(x) ?−1 : 0)

Boolean fragment

ϕ ::= ⊤ | Pa(x) | x ! y | x ∈ X | ¬ϕ | ϕ ∧ ϕ | ∀xϕ | ∀X ϕ

Step formulae Ψ ::= s | ϕ ?Ψ : Ψ

if … then … else …Pa(x) ? 1 : 0

x ∈ X1 ? s1 : (x ∈ X2 ? s2 : · · ·(x ∈ Xn−1 ? sn−1 : sn) · · · )

[[Ψ ]](w,σ) = s some value occurring in Ψ

A step formula takes finitely many values

For each value, the pre-image is MSO-definable

[Gastin-Monmege, 15]

Core weighted MSO logic

Boolean fragment

ϕ ::= ⊤ | Pa(x) | x ! y | x ∈ X | ¬ϕ | ϕ ∧ ϕ | ∀xϕ | ∀X ϕ

Step formulae Ψ ::= s | ϕ ?Ψ : Ψ

core wMSO Φ ::= 0 | ϕ ?Φ : Φ | Φ+ Φ |!

x Φ |!

X Φ |"

x Ψ

[Gastin-Monmege, 15]

Core weighted MSO logic

Boolean fragment

ϕ ::= ⊤ | Pa(x) | x ! y | x ∈ X | ¬ϕ | ϕ ∧ ϕ | ∀xϕ | ∀X ϕ

Step formulae Ψ ::= s | ϕ ?Ψ : Ψ

core wMSO Φ ::= 0 | ϕ ?Φ : Φ | Φ+ Φ |!

x Φ |!

X Φ |"

x Ψ

no constants

[Gastin-Monmege, 15]

Core weighted MSO logic

Boolean fragment

ϕ ::= ⊤ | Pa(x) | x ! y | x ∈ X | ¬ϕ | ϕ ∧ ϕ | ∀xϕ | ∀X ϕ

Step formulae Ψ ::= s | ϕ ?Ψ : Ψ

core wMSO Φ ::= 0 | ϕ ?Φ : Φ | Φ+ Φ |!

x Φ |!

X Φ |"

x Ψ

if … then … else …

no constants

[Gastin-Monmege, 15]

Core weighted MSO logic

Boolean fragment

ϕ ::= ⊤ | Pa(x) | x ! y | x ∈ X | ¬ϕ | ϕ ∧ ϕ | ∀xϕ | ∀X ϕ

Step formulae Ψ ::= s | ϕ ?Ψ : Ψ

core wMSO Φ ::= 0 | ϕ ?Φ : Φ | Φ+ Φ |!

x Φ |!

X Φ |"

x Ψ

if … then … else …Assigns a value from Ψ

to each position

no constants

[Gastin-Monmege, 15]

Core weighted MSO logic

Boolean fragment

ϕ ::= ⊤ | Pa(x) | x ! y | x ∈ X | ¬ϕ | ϕ ∧ ϕ | ∀xϕ | ∀X ϕ

Step formulae Ψ ::= s | ϕ ?Ψ : Ψ

core wMSO Φ ::= 0 | ϕ ?Φ : Φ | Φ+ Φ |!

x Φ |!

X Φ |"

x Ψ

if … then … else …Assigns a value from Ψ

to each position

{|!

x Ψ |}(w,σ) = {{([[Ψ ]](w,σ[x !→ i]))i}} ∈ N⟨R⋆⟩

no constants

[Gastin-Monmege, 15] singleton multiset

Core weighted MSO logic

Boolean fragment

ϕ ::= ⊤ | Pa(x) | x ! y | x ∈ X | ¬ϕ | ϕ ∧ ϕ | ∀xϕ | ∀X ϕ

Step formulae Ψ ::= s | ϕ ?Ψ : Ψ

core wMSO Φ ::= 0 | ϕ ?Φ : Φ | Φ+ Φ |!

x Φ |!

X Φ |"

x Ψ

{|!

x Ψ |}(w,σ) = {{([[Ψ ]](w,σ[x !→ i]))i}} ∈ N⟨R⋆⟩

Semantics

sums over multisets

[Gastin-Monmege, 15]

Core weighted MSO logic

{| 0 |}(w,σ)=∅

Multisets of weight structures

[Gastin-Monmege, 15][Droste-Perevoshchikov, 14]

Abstract semantics

wgt(ρ) = s1s2 · · · sn

{|A|}(w) = {{wgt(ρ) | ρ run on w}}

multiset

A run generates a sequence of weights

Multisets of weight structures

[Gastin-Monmege, 15][Droste-Perevoshchikov, 14]

Abstract semantics

wgt(ρ) = s1s2 · · · sn

{|A|}(w) = {{wgt(ρ) | ρ run on w}}

{|A|} : Σ⋆ → N⟨R⋆⟩

weights of A

multiset

A run generates a sequence of weights

Multisets of weight structures

[Gastin-Monmege, 15][Droste-Perevoshchikov, 14]

Abstract semantics

wgt(ρ) = s1s2 · · · sn

{|A|}(w) = {{wgt(ρ) | ρ run on w}}

{|A|} : Σ⋆ → N⟨R⋆⟩

weights of A

Aggregation aggr : N⟨R⋆⟩ → S

multiset

A run generates a sequence of weights

A run generates a sequence of weights

multiset

Abstract semantics

wgt(ρ) = s1s2 · · · sn

{|A|}(w) = {{wgt(ρ) | ρ run on w}}

{|A|} : Σ⋆ → N⟨R⋆⟩

weights of A

Aggregation aggr : N⟨R⋆⟩ → S

Semiring: sum-product aggrsp(A) =

!"

A =!

r1···rn∈A r1 × · · ·× rn

Multisets of weight structures

[Gastin-Monmege, 15][Droste-Perevoshchikov, 14]

A run generates a sequence of weights

multiset

Abstract semantics

wgt(ρ) = s1s2 · · · sn

{|A|}(w) = {{wgt(ρ) | ρ run on w}}

{|A|} : Σ⋆ → N⟨R⋆⟩

weights of A

Aggregation aggr : N⟨R⋆⟩ → S

Semiring: sum-product aggrsp(A) =

!"

A =!

r1···rn∈A r1 × · · ·× rn

Valuation monoid: sum-valuation aggrsv(A) =

!

Val(A) =!

r1···rn∈A Val(r1 · · · rn)

Multisets of weight structures

[Gastin-Monmege, 15][Droste-Perevoshchikov, 14]

A run generates a sequence of weights

multiset

Abstract semantics

wgt(ρ) = s1s2 · · · sn

{|A|}(w) = {{wgt(ρ) | ρ run on w}}

{|A|} : Σ⋆ → N⟨R⋆⟩

weights of A

Aggregation aggr : N⟨R⋆⟩ → S

Semiring: sum-product aggrsp(A) =

!"

A =!

r1···rn∈A r1 × · · ·× rn

Valuation monoid: sum-valuation aggrsv(A) =

!

Val(A) =!

r1···rn∈A Val(r1 · · · rn)

Multisets of weight structures

[Gastin-Monmege, 15][Droste-Perevoshchikov, 14]

Average value Discounted value…

Abstract semantics

wgt(ρ) = s1s2 · · · sn

{|A|}(w) = {{wgt(ρ) | ρ run on w}}

{|A|} : Σ⋆ → N⟨R⋆⟩

weights of A

Aggregation aggr : N⟨R⋆⟩ → S

Concrete semantics [[A]] = aggr ◦ {|A|} : Σ⋆ → S

multiset

Multisets of weight structures

[Gastin-Monmege, 15][Droste-Perevoshchikov, 14]

A run generates a sequence of weights

ϕ ::= ⊤ | Pa(x) | x ! y | x ∈ X | ¬ϕ | ϕ ∧ ϕ | ∀xϕ | ∀X ϕ

Ψ ::= s | ϕ ?Ψ : Ψ

Φ ::= 0 | ϕ ?Φ : Φ | Φ+ Φ |!

x Φ |!

X Φ |"

x Ψ

Theorem: weighted automata = core wMSO

[Gastin-Monmege, 15]

Core weighted MSO logic

ϕ ::= ⊤ | Pa(x) | x ! y | x ∈ X | ¬ϕ | ϕ ∧ ϕ | ∀xϕ | ∀X ϕ

Ψ ::= s | ϕ ?Ψ : Ψ

Φ ::= 0 | ϕ ?Φ : Φ | Φ+ Φ |!

x Φ |!

X Φ |"

x Ψ

Theorem: weighted automata = core wMSO

{|− |} : Σ⋆ → N⟨R⋆⟩Abstract semantics

[Gastin-Monmege, 15]

Core weighted MSO logic

ϕ ::= ⊤ | Pa(x) | x ! y | x ∈ X | ¬ϕ | ϕ ∧ ϕ | ∀xϕ | ∀X ϕ

Ψ ::= s | ϕ ?Ψ : Ψ

Φ ::= 0 | ϕ ?Φ : Φ | Φ+ Φ |!

x Φ |!

X Φ |"

x Ψ

Theorem: weighted automata = core wMSO

{|− |} : Σ⋆ → N⟨R⋆⟩Abstract semantics

Concrete semantics [[−]] = aggr ◦ {|− |} : Σ⋆ → S

[Gastin-Monmege, 15]

Core weighted MSO logic

ϕ ::= ⊤ | Pa(x) | x ! y | x ∈ X | ¬ϕ | ϕ ∧ ϕ | ∀xϕ | ∀X ϕ

Ψ ::= s | ϕ ?Ψ : Ψ

Φ ::= 0 | ϕ ?Φ : Φ | Φ+ Φ |!

x Φ |!

X Φ |"

x Ψ

Theorem: weighted automata = core wMSO

{|− |} : Σ⋆ → N⟨R⋆⟩Abstract semantics

Concrete semantics [[−]] = aggr ◦ {|− |} : Σ⋆ → SEasy constructive proofs

preservation of the constants

no restriction on core wMSO

no hypotheses on weights

[Gastin-Monmege, 15]

Core weighted MSO logic

Extensions

More general models than words:

trees, nested words…

More powerful logics: deciding if a wMSO formula

is expressible in core wMSO?

More powerful automata: finding equivalent fragments of wMSO

Weighted FO logic

ϕ ::= ⊤ | Pa(x) | x ! y | x ∈ X | ¬ϕ | ϕ ∧ ϕ | ∀xϕ | ∀X ϕΨ ::= s | ϕ ?Ψ : ΨΦ ::= 0 | ϕ ?Φ : Φ | Φ+ Φ |

!

x Φ |!

X Φ |"

x Ψ

Weighted FO logic

ϕ ::= ⊤ | Pa(x) | x ! y | x ∈ X | ¬ϕ | ϕ ∧ ϕ | ∀xϕ | ∀X ϕ

Φ ::= s ϕ?Φ :Φ Φ+Φ Φ×Φ Φx∑ Φ

x∏

Reintroduction of the product Unconditional product

quantification

We can keep Boolean MSO or restrict to FO…

Weighted FO logic

ϕ ::= ⊤ | Pa(x) | x ! y | x ∈ X | ¬ϕ | ϕ ∧ ϕ | ∀xϕ | ∀X ϕ

Φ ::= s ϕ?Φ :Φ Φ+Φ Φ×Φ Φx∑ Φ

x∏

Reintroduction of the product Unconditional product

quantification

We can keep Boolean MSO or restrict to FO…

ϕ2 = ∀x ∃y (y ! x ∧ Pa(y)) [[ϕ2]](an) = n!

Weighted FO logic

ϕ ::= ⊤ | Pa(x) | x ! y | x ∈ X | ¬ϕ | ϕ ∧ ϕ | ∀xϕ | ∀X ϕ

Φ ::= s ϕ?Φ :Φ Φ+Φ Φ×Φ Φx∑ Φ

x∏

Reintroduction of the product Unconditional product

quantification

We can keep Boolean MSO or restrict to FO…

2y∏x∏!"# $%&(w)= 2

|w|2

A = (Q,A, I, δ, T )

I ∈ SQ T ∈ SQ

δ : Q× Test×Move×Q→ S

Run as a finite sequence of configurations (W,σ, q, i,π)

σ : Peb→ pos(W )

π ∈ (Peb× pos(W ))∗with free pebbles

and a stack of currently dropped pebbles

Move = {→,←,↑}∪{↓xx ∈ Peb}

Pebble weighted automata

Weighted automata with pebbles

I Move = { ,!, "} [ {#x

| x 2 Peb}I Transition: q

weight test move������������! q0

I Run ⇢ over word u 2 A+: sequence of transitions.

I weight(⇢): product of weights of transitions

I Non determinism: [[Ap,q

]](u) =X

⇢ run over u

weight(⇢)

1▹?5

3 4

2

a?→ 7b?→

c? ↓x

2¬x?→

x?←

3¬◃?←

I =�5 0 0 0

M =

0

BB@

(a? + 7b?)! 0 c? #x

0! 0 0 00 0 2¬x?! x? 0 " 0 3¬.?

1

CCA

T =

0

BB@

/?000

1

CCA

▶ a b b c a c b a ◀x

[Globerman and Harel, 96][Engelfriet and Hoogeboom,99]

Pebble weighted automata

Weighted automata with pebbles

I Move = { ,!, "} [ {#x

| x 2 Peb}I Transition: q

weight test move������������! q0

I Run ⇢ over word u 2 A+: sequence of transitions.

I weight(⇢): product of weights of transitions

I Non determinism: [[Ap,q

]](u) =X

⇢ run over u

weight(⇢)

1▹?5

3 4

2

a?→ 7b?→

c? ↓x

2¬x?→

x?←

3¬◃?←

I =�5 0 0 0

M =

0

BB@

(a? + 7b?)! 0 c? #x

0! 0 0 00 0 2¬x?! x? 0 " 0 3¬.?

1

CCA

T =

0

BB@

/?000

1

CCA

▶ a b b c a c b a ◀

5 x1x7x7

x

[Globerman and Harel, 96][Engelfriet and Hoogeboom,99]

Pebble weighted automata

Weighted automata with pebbles

I Move = { ,!, "} [ {#x

| x 2 Peb}I Transition: q

weight test move������������! q0

I Run ⇢ over word u 2 A+: sequence of transitions.

I weight(⇢): product of weights of transitions

I Non determinism: [[Ap,q

]](u) =X

⇢ run over u

weight(⇢)

1▹?5

3 4

2

a?→ 7b?→

c? ↓x

2¬x?→

x?←

3¬◃?←

I =�5 0 0 0

M =

0

BB@

(a? + 7b?)! 0 c? #x

0! 0 0 00 0 2¬x?! x? 0 " 0 3¬.?

1

CCA

T =

0

BB@

/?000

1

CCA

▶ a b b c a c b a ◀

5 x1x7x7x1

x

[Globerman and Harel, 96][Engelfriet and Hoogeboom,99]

Pebble weighted automata

Weighted automata with pebbles

I Move = { ,!, "} [ {#x

| x 2 Peb}I Transition: q

weight test move������������! q0

I Run ⇢ over word u 2 A+: sequence of transitions.

I weight(⇢): product of weights of transitions

I Non determinism: [[Ap,q

]](u) =X

⇢ run over u

weight(⇢)

1▹?5

3 4

2

a?→ 7b?→

c? ↓x

2¬x?→

x?←

3¬◃?←

I =�5 0 0 0

M =

0

BB@

(a? + 7b?)! 0 c? #x

0! 0 0 00 0 2¬x?! x? 0 " 0 3¬.?

1

CCA

T =

0

BB@

/?000

1

CCA

▶ a b b c a c b a ◀

5 x1x7x7x1

x

x2x2x2

[Globerman and Harel, 96][Engelfriet and Hoogeboom,99]

Pebble weighted automata

Weighted automata with pebbles

I Move = { ,!, "} [ {#x

| x 2 Peb}I Transition: q

weight test move������������! q0

I Run ⇢ over word u 2 A+: sequence of transitions.

I weight(⇢): product of weights of transitions

I Non determinism: [[Ap,q

]](u) =X

⇢ run over u

weight(⇢)

1▹?5

3 4

2

a?→ 7b?→

c? ↓x

2¬x?→

x?←

3¬◃?←

I =�5 0 0 0

M =

0

BB@

(a? + 7b?)! 0 c? #x

0! 0 0 00 0 2¬x?! x? 0 " 0 3¬.?

1

CCA

T =

0

BB@

/?000

1

CCA

▶ a b b c a c b a ◀

5 x1x7x7x1

x

x2x2x2x1

[Globerman and Harel, 96][Engelfriet and Hoogeboom,99]

Pebble weighted automata

Weighted automata with pebbles

I Move = { ,!, "} [ {#x

| x 2 Peb}I Transition: q

weight test move������������! q0

I Run ⇢ over word u 2 A+: sequence of transitions.

I weight(⇢): product of weights of transitions

I Non determinism: [[Ap,q

]](u) =X

⇢ run over u

weight(⇢)

1▹?5

3 4

2

a?→ 7b?→

c? ↓x

2¬x?→

x?←

3¬◃?←

I =�5 0 0 0

M =

0

BB@

(a? + 7b?)! 0 c? #x

0! 0 0 00 0 2¬x?! x? 0 " 0 3¬.?

1

CCA

T =

0

BB@

/?000

1

CCA

▶ a b b c a c b a ◀

5 x1x7x7x1

x

x2x2x2x1x3

[Globerman and Harel, 96][Engelfriet and Hoogeboom,99]

Pebble weighted automata

Weighted automata with pebbles

I Move = { ,!, "} [ {#x

| x 2 Peb}I Transition: q

weight test move������������! q0

I Run ⇢ over word u 2 A+: sequence of transitions.

I weight(⇢): product of weights of transitions

I Non determinism: [[Ap,q

]](u) =X

⇢ run over u

weight(⇢)

1▹?5

3 4

2

a?→ 7b?→

c? ↓x

2¬x?→

x?←

3¬◃?←

I =�5 0 0 0

M =

0

BB@

(a? + 7b?)! 0 c? #x

0! 0 0 00 0 2¬x?! x? 0 " 0 3¬.?

1

CCA

T =

0

BB@

/?000

1

CCA

▶ a b b c a c b a ◀

5 x1x7x7x1

x

x2x2x2x1x3x1

[Globerman and Harel, 96][Engelfriet and Hoogeboom,99]

Pebble weighted automata

Weighted automata with pebbles

I Move = { ,!, "} [ {#x

| x 2 Peb}I Transition: q

weight test move������������! q0

I Run ⇢ over word u 2 A+: sequence of transitions.

I weight(⇢): product of weights of transitions

I Non determinism: [[Ap,q

]](u) =X

⇢ run over u

weight(⇢)

1▹?5

3 4

2

a?→ 7b?→

c? ↓x

2¬x?→

x?←

3¬◃?←

I =�5 0 0 0

M =

0

BB@

(a? + 7b?)! 0 c? #x

0! 0 0 00 0 2¬x?! x? 0 " 0 3¬.?

1

CCA

T =

0

BB@

/?000

1

CCA

▶ a b b c a c b a ◀

5 x1x7x7x1

x

x2x2x2x1x3x1x1

[Globerman and Harel, 96][Engelfriet and Hoogeboom,99]

Pebble weighted automata

Weighted automata with pebbles

I Move = { ,!, "} [ {#x

| x 2 Peb}I Transition: q

weight test move������������! q0

I Run ⇢ over word u 2 A+: sequence of transitions.

I weight(⇢): product of weights of transitions

I Non determinism: [[Ap,q

]](u) =X

⇢ run over u

weight(⇢)

1▹?5

3 4

2

a?→ 7b?→

c? ↓x

2¬x?→

x?←

3¬◃?←

I =�5 0 0 0

M =

0

BB@

(a? + 7b?)! 0 c? #x

0! 0 0 00 0 2¬x?! x? 0 " 0 3¬.?

1

CCA

T =

0

BB@

/?000

1

CCA

▶ a b b c a c b a ◀

5 x1x7x7x1

x

x2x2x2x1x3x1x1x1

[Globerman and Harel, 96][Engelfriet and Hoogeboom,99]

Pebble weighted automata

Weighted automata with pebbles

I Move = { ,!, "} [ {#x

| x 2 Peb}I Transition: q

weight test move������������! q0

I Run ⇢ over word u 2 A+: sequence of transitions.

I weight(⇢): product of weights of transitions

I Non determinism: [[Ap,q

]](u) =X

⇢ run over u

weight(⇢)

1▹?5

3 4

2

a?→ 7b?→

c? ↓x

2¬x?→

x?←

3¬◃?←

I =�5 0 0 0

M =

0

BB@

(a? + 7b?)! 0 c? #x

0! 0 0 00 0 2¬x?! x? 0 " 0 3¬.?

1

CCA

T =

0

BB@

/?000

1

CCA

▶ a b b c a c b a ◀

5 x1x7x7x1

x

x2x2x2x1x3x1x1x1x1

[Globerman and Harel, 96][Engelfriet and Hoogeboom,99]

Pebble weighted automata

Weighted automata with pebbles

I Move = { ,!, "} [ {#x

| x 2 Peb}I Transition: q

weight test move������������! q0

I Run ⇢ over word u 2 A+: sequence of transitions.

I weight(⇢): product of weights of transitions

I Non determinism: [[Ap,q

]](u) =X

⇢ run over u

weight(⇢)

1▹?5

3 4

2

a?→ 7b?→

c? ↓x

2¬x?→

x?←

3¬◃?←

I =�5 0 0 0

M =

0

BB@

(a? + 7b?)! 0 c? #x

0! 0 0 00 0 2¬x?! x? 0 " 0 3¬.?

1

CCA

T =

0

BB@

/?000

1

CCA

▶ a b b c a c b a ◀

5 x1x7x7x1

x

x2x2x2x1x3x1x1

x2x2x2x2x2x1x1

[Globerman and Harel, 96][Engelfriet and Hoogeboom,99]

Pebble weighted automata

Weighted automata with pebbles

I Move = { ,!, "} [ {#x

| x 2 Peb}I Transition: q

weight test move������������! q0

I Run ⇢ over word u 2 A+: sequence of transitions.

I weight(⇢): product of weights of transitions

I Non determinism: [[Ap,q

]](u) =X

⇢ run over u

weight(⇢)

1▹?5

3 4

2

a?→ 7b?→

c? ↓x

2¬x?→

x?←

3¬◃?←

I =�5 0 0 0

M =

0

BB@

(a? + 7b?)! 0 c? #x

0! 0 0 00 0 2¬x?! x? 0 " 0 3¬.?

1

CCA

T =

0

BB@

/?000

1

CCA

▶ a b b c a c b a ◀

5 x1x7x7x1

x

x2x2x2x1x3x1x1

x2x2x2x2x2x1x3x3x3x1x1

[Globerman and Harel, 96][Engelfriet and Hoogeboom,99]

Pebble weighted automata

Weighted automata with pebbles

I Move = { ,!, "} [ {#x

| x 2 Peb}I Transition: q

weight test move������������! q0

I Run ⇢ over word u 2 A+: sequence of transitions.

I weight(⇢): product of weights of transitions

I Non determinism: [[Ap,q

]](u) =X

⇢ run over u

weight(⇢)

1▹?5

3 4

2

a?→ 7b?→

c? ↓x

2¬x?→

x?←

3¬◃?←

I =�5 0 0 0

M =

0

BB@

(a? + 7b?)! 0 c? #x

0! 0 0 00 0 2¬x?! x? 0 " 0 3¬.?

1

CCA

T =

0

BB@

/?000

1

CCA

▶ a b b c a c b a ◀

5 x1x7x7x1

x

x2x2x2x1x3x1x1

x2x2x2x2x2x1x3x3x3x1

x1x7

x1

x1 x1

[Globerman and Harel, 96][Engelfriet and Hoogeboom,99]

Pebble weighted automata

Weighted automata with pebbles

I Move = { ,!, "} [ {#x

| x 2 Peb}I Transition: q

weight test move������������! q0

I Run ⇢ over word u 2 A+: sequence of transitions.

I weight(⇢): product of weights of transitions

I Non determinism: [[Ap,q

]](u) =X

⇢ run over u

weight(⇢)

1▹?5

3 4

2

a?→ 7b?→

c? ↓x

2¬x?→

x?←

3¬◃?←

I =�5 0 0 0

M =

0

BB@

(a? + 7b?)! 0 c? #x

0! 0 0 00 0 2¬x?! x? 0 " 0 3¬.?

1

CCA

T =

0

BB@

/?000

1

CCA

▶ a b b c a c b a ◀

5 x1x7x7x1

x

x2x2x2x1x3x1x1

x2x2x2x2x2x1x3x3x3x1

x1x7

x1

x1 x1

Weight of

the run:

35 562 240

[Globerman and Harel, 96][Engelfriet and Hoogeboom,99]

Pebble weighted automata

Weighted automata with pebbles

I Move = { ,!, "} [ {#x

| x 2 Peb}I Transition: q

weight test move������������! q0

I Run ⇢ over word u 2 A+: sequence of transitions.

I weight(⇢): product of weights of transitions

I Non determinism: [[Ap,q

]](u) =X

⇢ run over u

weight(⇢)

1▹?5

3 4

2

a?→ 7b?→

c? ↓x

2¬x?→

x?←

3¬◃?←

I =�5 0 0 0

M =

0

BB@

(a? + 7b?)! 0 c? #x

0! 0 0 00 0 2¬x?! x? 0 " 0 3¬.?

1

CCA

T =

0

BB@

/?000

1

CCA

▶ a b b c a c b a ◀

5 x1x7x7x1

x

x2x2x2x1x3x1x1

x2x2x2x2x2x1x3x3x3x1

x1x7

x1

x1 x1

Weight of

the run:

35 562 240Non

determinism

Non determinism resolved by sum

[Globerman and Harel, 96][Engelfriet and Hoogeboom,99]

Pebble weighted automata

Weighted automata with pebbles

I Move = { ,!, "} [ {#x

| x 2 Peb}I Transition: q

weight test move������������! q0

I Run ⇢ over word u 2 A+: sequence of transitions.

I weight(⇢): product of weights of transitions

I Non determinism: [[Ap,q

]](u) =X

⇢ run over u

weight(⇢)

1▹?5

3 4

2

a?→ 7b?→

c? ↓x

2¬x?→

x?←

3¬◃?←

I =�5 0 0 0

M =

0

BB@

(a? + 7b?)! 0 c? #x

0! 0 0 00 0 2¬x?! x? 0 " 0 3¬.?

1

CCA

T =

0

BB@

/?000

1

CCA

▶ a b b c a c b a ◀

5 x1x7x7x1

x

x2x2x2x1x3x1x1

x2x2x2x2x2x1x3x3x3x1

x1x7

x1

x1 x1

Weight of

the run:

35 562 240Non

determinism

Non determinism resolved by sum

Sum of the weights

of the runs:

5.7|w|b.∏wi=c2i-2(3i-1)

[Globerman and Harel, 96][Engelfriet and Hoogeboom,99]

Pebble weighted automata

Translating a formula into an automaton

AΦ AΨlast?

first?

Sum by disjoint union of automata

Product:

Sum quantification:

Product quantification:

→ →

↓x last?, ↑

↓x last?, ↑

Challenging for the Boolean part: need unambiguous automata

Translating a formula into an automaton

Challenging for the Boolean part: need unambiguous automata

Use deterministic automataof size non-elementary...

Translating a formula into an automaton

Challenging for the Boolean part: need unambiguous automata

Take advantage of the pebblesto build a linear size automaton

Use deterministic automataof size non-elementary...

Translating a formula into an automaton

Challenging for the Boolean part: need unambiguous automata

Take advantage of the pebblesto build a linear size automaton

Use deterministic automataof size non-elementary...

Bϕokϕ

koϕBψ

okψ

koψlast?

←first?

okξ

koξ

last?

last?

last?

Disjunction/conjunctionξ = φ∨ψ

Translating a formula into an automaton

Challenging for the Boolean part: need unambiguous automata

Take advantage of the pebblesto build a linear size automaton

Use deterministic automataof size non-elementary...

Bϕokϕ

koϕBψ

okψ

koψlast?

←first?

okξ

koξ

last?

last?

last?

Disjunction/conjunctionξ = φ∨ψ

Bϕokϕ

koϕ↓xlast?↑

okξ

koξ

last?↑

last?

Existential/Universal quantificationsξ = ∃x φ

Translating a formula into an automaton

Logic equivalent to PWA?• Weighted FO misses a counting capability…

• Solution: weighted transitive closure operation

Logic equivalent to PWA?• Weighted FO misses a counting capability…

• Solution: weighted transitive closure operation

PebbleWA-ICALP.tex 1230 2010-07-07 13:59:03Z bm

Transitive closure logics! For ϕ with at least two first order free variables, define

ϕ1(x , y) = ϕ(x , y)

ϕn(x , y) = ∃z0 · · · ∃zn

!x = z0 ∧ zn = y ∧ diff(z0, . . . , zn) ∧

"#1≤ℓ≤n ϕ(zℓ−1, zℓ)

$%.

x yz2 z3 z1

ϕ

ϕ

ϕ ϕ

! The transitive closure operator is defined by TCxyϕ =&

n≥1ϕ

n.

! Bounded transitive closure : N-TCxyϕ = TCxy (x − N ≤ y ≤ x + N ∧ ϕ)

x yz1 z3 z2

≤ N

≤ N

≤ N

13/17

Logic equivalent to PWA?• Weighted FO misses a counting capability…

• Solution: weighted transitive closure operation

PebbleWA-ICALP.tex 1230 2010-07-07 13:59:03Z bm

Transitive closure logics! For ϕ with at least two first order free variables, define

ϕ1(x , y) = ϕ(x , y)

ϕn(x , y) = ∃z0 · · · ∃zn

!x = z0 ∧ zn = y ∧ diff(z0, . . . , zn) ∧

"#1≤ℓ≤n ϕ(zℓ−1, zℓ)

$%.

x yz2 z3 z1

ϕ

ϕ

ϕ ϕ

! The transitive closure operator is defined by TCxyϕ =&

n≥1ϕ

n.

! Bounded transitive closure : N-TCxyϕ = TCxy (x − N ≤ y ≤ x + N ∧ ϕ)

x yz1 z3 z2

≤ N

≤ N

≤ N

13/17

PebbleWA-ICALP.tex 1230 2010-07-07 13:59:03Z bm

Transitive closure logics! For ϕ with at least two first order free variables, define

ϕ1(x , y) = ϕ(x , y)

ϕn(x , y) = ∃z0 · · · ∃zn

!x = z0 ∧ zn = y ∧ diff(z0, . . . , zn) ∧

"#1≤ℓ≤n ϕ(zℓ−1, zℓ)

$%.

x yz2 z3 z1

ϕ

ϕ

ϕ ϕ

! The transitive closure operator is defined by TCxyϕ =&

n≥1ϕ

n.

! Bounded transitive closure : N-TCxyϕ = TCxy (x − N ≤ y ≤ x + N ∧ ϕ)

x yz1 z3 z2

≤ N

≤ N

≤ N

13/17

Logic equivalent to PWA?• Weighted FO misses a counting capability…

• Solution: weighted transitive closure operation

PebbleWA-ICALP.tex 1230 2010-07-07 13:59:03Z bm

Transitive closure logics! For ϕ with at least two first order free variables, define

ϕ1(x , y) = ϕ(x , y)

ϕn(x , y) = ∃z0 · · · ∃zn

!x = z0 ∧ zn = y ∧ diff(z0, . . . , zn) ∧

"#1≤ℓ≤n ϕ(zℓ−1, zℓ)

$%.

x yz2 z3 z1

ϕ

ϕ

ϕ ϕ

! The transitive closure operator is defined by TCxyϕ =&

n≥1ϕ

n.

! Bounded transitive closure : N-TCxyϕ = TCxy (x − N ≤ y ≤ x + N ∧ ϕ)

x yz1 z3 z2

≤ N

≤ N

≤ N

13/17 PebbleWA-ICALP.tex 1230 2010-07-07 13:59:03Z bm

Transitive closure logics! For ϕ with at least two first order free variables, define

ϕ1(x , y) = ϕ(x , y)

ϕn(x , y) = ∃z0 · · · ∃zn

!x = z0 ∧ zn = y ∧ diff(z0, . . . , zn) ∧

"#1≤ℓ≤n ϕ(zℓ−1, zℓ)

$%.

x yz2 z3 z1

ϕ

ϕ

ϕ ϕ

! The transitive closure operator is defined by TCxyϕ =&

n≥1ϕ

n.

! Bounded transitive closure : N-TCxyϕ = TCxy (x − N ≤ y ≤ x + N ∧ ϕ)

x yz1 z3 z2

≤ N

≤ N

≤ N

13/17

PebbleWA-ICALP.tex 1230 2010-07-07 13:59:03Z bm

Transitive closure logics! For ϕ with at least two first order free variables, define

ϕ1(x , y) = ϕ(x , y)

ϕn(x , y) = ∃z0 · · · ∃zn

!x = z0 ∧ zn = y ∧ diff(z0, . . . , zn) ∧

"#1≤ℓ≤n ϕ(zℓ−1, zℓ)

$%.

x yz2 z3 z1

ϕ

ϕ

ϕ ϕ

! The transitive closure operator is defined by TCxyϕ =&

n≥1ϕ

n.

! Bounded transitive closure : N-TCxyϕ = TCxy (x − N ≤ y ≤ x + N ∧ ϕ)

x yz1 z3 z2

≤ N

≤ N

≤ N

13/17

Logic equivalent to PWA?• Weighted FO misses a counting capability…

• Solution: weighted transitive closure operation

PebbleWA-ICALP.tex 1230 2010-07-07 13:59:03Z bm

Transitive closure logics! For ϕ with at least two first order free variables, define

ϕ1(x , y) = ϕ(x , y)

ϕn(x , y) = ∃z0 · · · ∃zn

!x = z0 ∧ zn = y ∧ diff(z0, . . . , zn) ∧

"#1≤ℓ≤n ϕ(zℓ−1, zℓ)

$%.

x yz2 z3 z1

ϕ

ϕ

ϕ ϕ

! The transitive closure operator is defined by TCxyϕ =&

n≥1ϕ

n.

! Bounded transitive closure : N-TCxyϕ = TCxy (x − N ≤ y ≤ x + N ∧ ϕ)

x yz1 z3 z2

≤ N

≤ N

≤ N

13/17 PebbleWA-ICALP.tex 1230 2010-07-07 13:59:03Z bm

Transitive closure logics! For ϕ with at least two first order free variables, define

ϕ1(x , y) = ϕ(x , y)

ϕn(x , y) = ∃z0 · · · ∃zn

!x = z0 ∧ zn = y ∧ diff(z0, . . . , zn) ∧

"#1≤ℓ≤n ϕ(zℓ−1, zℓ)

$%.

x yz2 z3 z1

ϕ

ϕ

ϕ ϕ

! The transitive closure operator is defined by TCxyϕ =&

n≥1ϕ

n.

! Bounded transitive closure : N-TCxyϕ = TCxy (x − N ≤ y ≤ x + N ∧ ϕ)

x yz1 z3 z2

≤ N

≤ N

≤ N

13/17

PebbleWA-ICALP.tex 1230 2010-07-07 13:59:03Z bm

Transitive closure logics! For ϕ with at least two first order free variables, define

ϕ1(x , y) = ϕ(x , y)

ϕn(x , y) = ∃z0 · · · ∃zn

!x = z0 ∧ zn = y ∧ diff(z0, . . . , zn) ∧

"#1≤ℓ≤n ϕ(zℓ−1, zℓ)

$%.

x yz2 z3 z1

ϕ

ϕ

ϕ ϕ

! The transitive closure operator is defined by TCxyϕ =&

n≥1ϕ

n.

! Bounded transitive closure : N-TCxyϕ = TCxy (x − N ≤ y ≤ x + N ∧ ϕ)

x yz1 z3 z2

≤ N

≤ N

≤ N

13/17

Theorem: PWA = wFO + bounded-TC

Application to transductions

Tinput word output word

Application to transductions

Tinput word output word

Pattern matching/replacement

Application to transductions

Tinput word output word

Pattern matching/replacement Tree/Graph rewriting

Application to transductions

Tinput word output word

Pattern matching/replacement

Update of XML databases

Tree/Graph rewriting

Existing models over words• Two-way Deterministic Finite-State Transducers • Functional One-way Finite-State Transducers • MSOT (à la Courcelle)

• Copyless Streaming String Transducers (Alur et al)

{Functions

Existing models over words• Two-way Deterministic Finite-State Transducers • Functional One-way Finite-State Transducers • MSOT (à la Courcelle)

• Copyless Streaming String Transducers (Alur et al)

{Functions

{Relations

• Two-way Non-Deterministic Finite-State Transducers • Non-Deterministic Finite-State Transducers • Non-deterministic Copyless Streaming String Transducers

(Alur et Deshmukh) • NMSOT (with free second-order variables)

Existing models over words• Two-way Deterministic Finite-State Transducers • Functional One-way Finite-State Transducers • MSOT (à la Courcelle)

• Copyless Streaming String Transducers (Alur et al)

{Functions

{Relations

• Two-way Non-Deterministic Finite-State Transducers • Non-Deterministic Finite-State Transducers • Non-deterministic Copyless Streaming String Transducers

(Alur et Deshmukh) • NMSOT (with free second-order variables)

only finite valued relations…

Transduction as weights• Desire: weight transitions with words… Difficult to

equip A* with a semiring structure: how to combine several accepting runs?

• Works for deterministic or unambiguous automata: functional transducers

• For relations: semiring of languages

(2A*,∪,⋅,∅,{ε})

Examples(Px(a)?{aa} : (P

x(b)?{bb} :∅))

x∏

Examples(Px(a)?{aa} : (P

x(b)?{bb} :∅))

x∏ aba -> aabbaa

Examples(Px(a)?{aa} : (P

x(b)?{bb} :∅))

x∏ aba -> aabbaa

(Px(!)?{insert} :(P

x(a)?{a} :(P

x(b) : {b})))

x∏

Examples(Px(a)?{aa} : (P

x(b)?{bb} :∅))

x∏ aba -> aabbaa

(Px(!)?{insert} :(P

x(a)?{a} :(P

x(b) : {b})))

x∏ a*b -> ainsertb

Examples(Px(a)?{aa} : (P

x(b)?{bb} :∅))

x∏ aba -> aabbaa

(Px(!)?{insert} :(P

x(a)?{a} :(P

x(b) : {b})))

x∏ a*b -> ainsertb

Py(!)?

y∑ (x = y)?{insert} : (Px(!)?{ε} : (P

x(a)?{a} : (P

x(b)?{b})))

x∏⎡⎣⎢ ⎤⎦⎥

Examples(Px(a)?{aa} : (P

x(b)?{bb} :∅))

x∏ aba -> aabbaa

(Px(!)?{insert} :(P

x(a)?{a} :(P

x(b) : {b})))

x∏ a*b -> ainsertb

Py(!)?

y∑ (x = y)?{insert} : (Px(!)?{ε} : (P

x(a)?{a} : (P

x(b)?{b})))

x∏⎡⎣⎢ ⎤⎦⎥

a*b*a -> {ainsertba,abinserta}

Relation

ExamplesPx(a)?{a} : (P

x(b)?{ε})

x∏ × Px(a)?{ε} : (P

x(b) : {c})

x∏

ExamplesPx(a)?{a} : (P

x(b)?{ε})

x∏ × Px(a)?{ε} : (P

x(b) : {c})

x∏ababbaabb -> aaaaccccc

ExamplesPx(a)?{a} : (P

x(b)?{ε})

x∏ × Px(a)?{ε} : (P

x(b) : {c})

x∏ababbaabb -> aaaaccccc

Not comp. by 1-way Func Transducer

ExamplesPx(a)?{a} : (P

x(b)?{ε})

x∏ × Px(a)?{ε} : (P

x(b) : {c})

x∏ababbaabb -> aaaaccccc

Not comp. by 1-way Func Transducer

Px(a)?{a} : (P

x(b)?{ε})

x∏ + Px(a)?{ε} : (P

x(b)×{c})

x∏

ExamplesPx(a)?{a} : (P

x(b)?{ε})

x∏ × Px(a)?{ε} : (P

x(b) : {c})

x∏ababbaabb -> aaaaccccc

Not comp. by 1-way Func Transducer

Px(a)?{a} : (P

x(b)?{ε})

x∏ + Px(a)?{ε} : (P

x(b)×{c})

x∏ababbaabb -> {aaaa,ccccc}

ExamplesPx(a)?{a} : (P

x(b)?{ε})

x∏ × Px(a)?{ε} : (P

x(b) : {c})

x∏ababbaabb -> aaaaccccc

Not comp. by 1-way Func Transducer

Px(a)?{a} : (P

x(b)?{ε})

x∏ + Px(a)?{ε} : (P

x(b)×{c})

x∏ababbaabb -> {aaaa,ccccc}

Px(a)?{a,ε} : (P

x(b)?{b,ε})

x∏

ExamplesPx(a)?{a} : (P

x(b)?{ε})

x∏ × Px(a)?{ε} : (P

x(b) : {c})

x∏ababbaabb -> aaaaccccc

Not comp. by 1-way Func Transducer

Px(a)?{a} : (P

x(b)?{ε})

x∏ + Px(a)?{ε} : (P

x(b)×{c})

x∏ababbaabb -> {aaaa,ccccc}

Px(a)?{a,ε} : (P

x(b)?{b,ε})

x∏ aba -> {ε,a,b,ab,ba,aa,aba}

ExamplesPx(a)?{a} : (P

x(b)?{ε})

x∏ × Px(a)?{ε} : (P

x(b) : {c})

x∏ababbaabb -> aaaaccccc

Not comp. by 1-way Func Transducer

Px(a)?{a} : (P

x(b)?{ε})

x∏ + Px(a)?{ε} : (P

x(b)×{c})

x∏ababbaabb -> {aaaa,ccccc}

Px(a)?{a,ε} : (P

x(b)?{b,ε})

x∏ aba -> {ε,a,b,ab,ba,aa,aba}

Px(a)?A*aA* : (P

x(b)?A*bA*)

x∏

ExamplesPx(a)?{a} : (P

x(b)?{ε})

x∏ × Px(a)?{ε} : (P

x(b) : {c})

x∏ababbaabb -> aaaaccccc

Not comp. by 1-way Func Transducer

Px(a)?{a} : (P

x(b)?{ε})

x∏ + Px(a)?{ε} : (P

x(b)×{c})

x∏ababbaabb -> {aaaa,ccccc}

Px(a)?{a,ε} : (P

x(b)?{b,ε})

x∏ aba -> {ε,a,b,ab,ba,aa,aba}

Px(a)?A*aA* : (P

x(b)?A*bA*)

x∏ aba -> A*aA*bA*aA*

Infinitely-valued relation

TransducersPx(a)?A*aA* : (P

x(b)?A*bA*)

x∏

a|A*aA* b|A*bA*

Infinite-valued, but deterministic

Reverse?

a|a, ←

last?

A|ε, →

b|b, ←

first?

Reverse?

a|a, ←

last?

A|ε, →

b|b, ←

first?

Impossible in FO… … because of order of

interpretation of product

Reverse?

a|a, ←

last?

A|ε, →

b|b, ←

first?

Impossible in FO… … because of order of

interpretation of product

Solution: in this non-commutative setting, add right-to-left products

Reverse?

a|a, ←

last?

A|ε, →

b|b, ←

first?

Impossible in FO… … because of order of

interpretation of product

Solution: in this non-commutative setting, add right-to-left products

Px(a)?{a} : (P

x(b)?{b})

x⨿

Transitive closureϕ ::= ⊤ | Pa(x) | x ! y | x ∈ X | ¬ϕ | ϕ ∧ ϕ | ∀xϕ | ∀X ϕ

Φ ::= L ϕ?Φ :Φ Φ+Φ Φ×Φ Φx∑ Φ

x∏ N -TCx ,yΦ

Transitive closureϕ ::= ⊤ | Pa(x) | x ! y | x ∈ X | ¬ϕ | ϕ ∧ ϕ | ∀xϕ | ∀X ϕ

Φ ::= L ϕ?Φ :Φ Φ+Φ Φ×Φ Φx∑ Φ

x∏ N -TCx ,yΦ

Regular language

Transitive closureϕ ::= ⊤ | Pa(x) | x ! y | x ∈ X | ¬ϕ | ϕ ∧ ϕ | ∀xϕ | ∀X ϕ

Φ ::= L ϕ?Φ :Φ Φ+Φ Φ×Φ Φx∑ Φ

x∏ N -TCx ,yΦ

Regular languageAble to define right-

to-left product

Φ(x) := [1-TCx ,yx⨿ (y = x −1?Φ(x))](last, first)×Φ(first)

Transitive closureϕ ::= ⊤ | Pa(x) | x ! y | x ∈ X | ¬ϕ | ϕ ∧ ϕ | ∀xϕ | ∀X ϕ

Φ ::= L ϕ?Φ :Φ Φ+Φ Φ×Φ Φx∑ Φ

x∏ N -TCx ,yΦ

Regular languageAble to define right-

to-left product

Φ(x) := [1-TCx ,yx⨿ (y = x −1?Φ(x))](last, first)×Φ(first)

Theorem: Pebble Transducers = FO + bounded-TC

with regular language productions linear transformation from logic to transducers

Algorithmic questions

Algorithmic questionsTheorem: Evaluation of FO + bounded-TC with

complexity O(|formula|x|input|#variables)

Algorithmic questionsTheorem: Evaluation of FO + bounded-TC with

complexity O(|formula|x|input|#variables)

• In functional setting: it is decidable if a 2-way transducer is recognisable by a 1-way transducer [Filiot,Gauwin,Reynier, Servais, 13]

Algorithmic questionsTheorem: Evaluation of FO + bounded-TC with

complexity O(|formula|x|input|#variables)

• In functional setting: it is decidable if a 2-way transducer is recognisable by a 1-way transducer [Filiot,Gauwin,Reynier, Servais, 13]

• What about the general setting, with pebbles?

Algorithmic questionsTheorem: Evaluation of FO + bounded-TC with

complexity O(|formula|x|input|#variables)

• In functional setting: it is decidable if a 2-way transducer is recognisable by a 1-way transducer [Filiot,Gauwin,Reynier, Servais, 13]

• What about the general setting, with pebbles?

• Determinisability of functional non-det transducers is decidable in PTIME [Schützenberger, 75]

Algorithmic questionsTheorem: Evaluation of FO + bounded-TC with

complexity O(|formula|x|input|#variables)

• In functional setting: it is decidable if a 2-way transducer is recognisable by a 1-way transducer [Filiot,Gauwin,Reynier, Servais, 13]

• What about the general setting, with pebbles?

• Determinisability of functional non-det transducers is decidable in PTIME [Schützenberger, 75]

• Extension to the general setting?

Algorithmic questionsTheorem: Evaluation of FO + bounded-TC with

complexity O(|formula|x|input|#variables)

• In functional setting: it is decidable if a 2-way transducer is recognisable by a 1-way transducer [Filiot,Gauwin,Reynier, Servais, 13]

• What about the general setting, with pebbles?

• Determinisability of functional non-det transducers is decidable in PTIME [Schützenberger, 75]

• Extension to the general setting?

Thank you!

top related