+ All Categories
Home > Documents > From Monadic Second-Order Definable String Transformations to Transducers

From Monadic Second-Order Definable String Transformations to Transducers

Date post: 11-Sep-2021
Category:
Upload: others
View: 2 times
Download: 0 times
Share this document with a friend
81
From Monadic Second-Order Definable String Transformations to Transducers Rajeev Alur 1 Antoine Durand-Gasselin 2 Ashutosh Trivedi 3 1 University of Pennsylvania 2 LIAFA, Universit´ e Paris Diderot 3 Indian Institute of Technology Bombay June 21, 2013 Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 1 / 31
Transcript
Page 1: From Monadic Second-Order Definable String Transformations to Transducers

From Monadic Second-Order Definable StringTransformations to Transducers

Rajeev Alur1 Antoine Durand-Gasselin2 Ashutosh Trivedi3

1University of Pennsylvania

2LIAFA, Universite Paris Diderot

3Indian Institute of Technology Bombay

June 21, 2013

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 1 / 31

Page 2: From Monadic Second-Order Definable String Transformations to Transducers

Regular Word Analysis

Qualitative properties over wordsϕ : Σ∞ → {0, 1}

MSO formulas Finite state automata

Logically Computational model

Regular Word Transformation

Transformations of wordsϕ : Σ∞ → Σ∞

Definition using MSO Streaming Transducers

Logically Computational model

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 2 / 31

Page 3: From Monadic Second-Order Definable String Transformations to Transducers

Regular Word Analysis

Qualitative properties over wordsϕ : Σ∞ → {0, 1}

MSO formulas Finite state automata

Logically Computational model

Equivalence [Buchi, 1960]

Regular Word Transformation

Transformations of wordsϕ : Σ∞ → Σ∞

Definition using MSO Streaming Transducers

Logically Computational model

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 2 / 31

Page 4: From Monadic Second-Order Definable String Transformations to Transducers

Regular Word Analysis

Qualitative properties over wordsϕ : Σ∞ → {0, 1}

MSO formulas Finite state automata

Logically Computational model

Equivalence [Buchi, 1960]

Regular Word Transformation

Transformations of wordsϕ : Σ∞ → Σ∞

Definition using MSO Streaming Transducers

Logically Computational model

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 2 / 31

Page 5: From Monadic Second-Order Definable String Transformations to Transducers

Regular Word Analysis

Qualitative properties over wordsϕ : Σ∞ → {0, 1}

MSO formulas Finite state automata

Logically Computational model

Equivalence [Buchi, 1960]

Regular Word Transformation

Transformations of wordsϕ : Σ∞ → Σ∞

Definition using MSO Streaming Transducers

Logically Computational model

Equi-expressiveness

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 2 / 31

Page 6: From Monadic Second-Order Definable String Transformations to Transducers

Monadic Second Order Logic (MSO)We deal about MSO over the linear order:

The structure is( N , > , P1, . . . ,Pk )

The domain: N or [1, n] The order relation Some unary predicates

Words are interpreted structures: e.g. ([1, 10], >,Pa,Pb,Pc)

w = a b b a b c a b c c

Pa = { 1, 4, 7}Pb = { 2, 3, 5, 8}Pc = { 6, 9, 10}

Formulas are defined inductively:I Atomic: x1 < x2, P(x1), X (x), ...I Boolean connectives: ϕ1 ∧ ϕ2, ¬ϕ3, ...I First-order quantification: ∃x .ϕI Second-order quantification: ∃X .ϕ

An MSO formula with no free variables defines a language

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 3 / 31

Page 7: From Monadic Second-Order Definable String Transformations to Transducers

Monadic Second Order Logic (MSO)We deal about MSO over the linear order:

The structure is( N , > , P1, . . . ,Pk )

The domain: N or [1, n] The order relation Some unary predicates

Words are interpreted structures: e.g. ([1, 10], >,Pa,Pb,Pc)

w = a b b a b c a b c c

Pa = { 1, 4, 7}Pb = { 2, 3, 5, 8}Pc = { 6, 9, 10}

Formulas are defined inductively:I Atomic: x1 < x2, P(x1), X (x), ...I Boolean connectives: ϕ1 ∧ ϕ2, ¬ϕ3, ...I First-order quantification: ∃x .ϕI Second-order quantification: ∃X .ϕ

An MSO formula with no free variables defines a language

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 3 / 31

Page 8: From Monadic Second-Order Definable String Transformations to Transducers

Monadic Second Order Logic (MSO)We deal about MSO over the linear order:

The structure is( N , > , P1, . . . ,Pk )

The domain: N or [1, n] The order relation Some unary predicates

Words are interpreted structures: e.g. ([1, 10], >,Pa,Pb,Pc)

w = a b b a b c a b c c

Pa = { 1, 4, 7}Pb = { 2, 3, 5, 8}Pc = { 6, 9, 10}

Formulas are defined inductively:I Atomic: x1 < x2, P(x1), X (x), ...I Boolean connectives: ϕ1 ∧ ϕ2, ¬ϕ3, ...I First-order quantification: ∃x .ϕI Second-order quantification: ∃X .ϕ

An MSO formula with no free variables defines a language

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 3 / 31

Page 9: From Monadic Second-Order Definable String Transformations to Transducers

Monadic Second Order Logic (MSO)We deal about MSO over the linear order:

The structure is( N , > , P1, . . . ,Pk )

The domain: N or [1, n] The order relation Some unary predicates

Words are interpreted structures: e.g. ([1, 10], >,Pa,Pb,Pc)

w = a b b a b c a b c c

Pa = { 1, 4, 7}Pb = { 2, 3, 5, 8}Pc = { 6, 9, 10}

Formulas are defined inductively:I Atomic: x1 < x2, P(x1), X (x), ...I Boolean connectives: ϕ1 ∧ ϕ2, ¬ϕ3, ...I First-order quantification: ∃x .ϕI Second-order quantification: ∃X .ϕ

An MSO formula with no free variables defines a language

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 3 / 31

Page 10: From Monadic Second-Order Definable String Transformations to Transducers

Appealing computational model: Finite State Automata

Theorem [Buchi, 1960]

A language is MSO definable iff it is accepted by a finite-state automaton.

Deterministic automata are a computational model to analyse words:process sequentially a word input by jumping from state to state

Can be efficiently manipulatedI Automata can be determinizedI LSPACE algorithm to check if a word is accepted by an automatonI Minimization (equivalence in time O(n log log n))I Product of automata (language union, intersection,...)

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 4 / 31

Page 11: From Monadic Second-Order Definable String Transformations to Transducers

Regular Word Analysis

Qualitative properties over wordsϕ : Σ∞ → {0, 1}

MSO formulas Finite state automata

Logically Computational model

Equivalence [Buchi, 1960]

Regular Word Transformation

Transformations of wordsϕ : Σ∞ → Σ∞

Definition using MSO Streaming Transducers

Logically Computational model

Equi-expressiveness

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 5 / 31

Page 12: From Monadic Second-Order Definable String Transformations to Transducers

Contents

1 Regular TransformationsLogical definitionStreaming Transducers

2 Contribution: Equivalence with a direct logic-based reductionSome logical considerationsProof Walkthrough

3 Decision proceduresFunctional equivalenceTypechecking Problem

4 Conclusion

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 6 / 31

Page 13: From Monadic Second-Order Definable String Transformations to Transducers

Contents

1 Regular TransformationsLogical definitionStreaming Transducers

2 Contribution: Equivalence with a direct logic-based reductionSome logical considerationsProof Walkthrough

3 Decision proceduresFunctional equivalenceTypechecking Problem

4 Conclusion

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 7 / 31

Page 14: From Monadic Second-Order Definable String Transformations to Transducers

MSO-definable Transformations

[Courcelle, 1994] Defining Graph Transformations using MSO

A labeled graph transformation using MSO is specified by:

input and output alphabets;

an MSO formula specifying the domain of the transformation;

output is specified using a finite number of copies of nodes of inputgraph;

the node labels are specified using MSO formulas; and

the existence of edges between nodes of various copies is specifiedusing MSO formulas

Example

Let Σ = {a, b,#}. Consider a transformation f1 : Σ∞ → Σ∞

u1#u2# . . . un−1#un#v 7→ u1u1# . . .#unun#v .

where u is reverse of u.

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 8 / 31

Page 15: From Monadic Second-Order Definable String Transformations to Transducers

MSO-definable Transformations

[Courcelle, 1994] Defining Graph Transformations using MSO

A labeled graph transformation using MSO is specified by:

input and output alphabets;

an MSO formula specifying the domain of the transformation;

output is specified using a finite number of copies of nodes of inputgraph;

the node labels are specified using MSO formulas; and

the existence of edges between nodes of various copies is specifiedusing MSO formulas

Example

Let Σ = {a, b,#}. Consider a transformation f1 : Σ∞ → Σ∞

u1#u2# . . . un−1#un#v 7→ u1u1# . . .#unun#v .

where u is reverse of u.Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 8 / 31

Page 16: From Monadic Second-Order Definable String Transformations to Transducers

MSO-definable Transformations

input: a b c b b # a a b # c c a a # b

copy 1: a b c b b a a b c c a a

copy 2: a b c b b # a a b # c c a a # b

Σ = Γ = {a, b, c ,#}, C = {1, 2}, and

Node Label Formulas (|Γ|.|C | formulas)

I Labelc1α (x) = Labelinpα (x) ∧ ¬Labelinp# (x) ∧ reach#(x)

I Labelc2α (x) = Labelinpα (x)

Edge Label Formulas (|C |2 formulas)

I Edgec1,c1(x , y) = Edgeinp(y , x) ∧ ¬Labelinp# (x) ∧ ¬Labelinp# (y).I Edgec2,c2(x , y) =

Edgeinp(x , y) ∧ (¬Labelinp# (x)∨(Labelinp# (x)∧¬reach#(x)))

I Edge1,2(x , y)=(x=y)∧(first(x)∨∃z(Labelinp# (z)∧Edgeinp(z , x)))

I Edge2,1(x , y)=Labelinp# (x) ∧ reach#(x) ∧ (∃z(Edgeinp(y , z) ∧Labelinp# (z))) ∧ (∀z((path(x , z) ∧ path(z , y))→ ¬Labelinp# (z)))

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 9 / 31

Page 17: From Monadic Second-Order Definable String Transformations to Transducers

MSO-definable Transformations

input: a b c b b # a a b # c c a a # b

copy 1: a b c b b a a b c c a a

copy 2: a b c b b # a a b # c c a a # b

Σ = Γ = {a, b, c ,#}, C = {1, 2}, and

Node Label Formulas (|Γ|.|C | formulas)

I Labelc1α (x) = Labelinpα (x) ∧ ¬Labelinp# (x) ∧ reach#(x)

I Labelc2α (x) = Labelinpα (x)

Edge Label Formulas (|C |2 formulas)

I Edgec1,c1(x , y) = Edgeinp(y , x) ∧ ¬Labelinp# (x) ∧ ¬Labelinp# (y).I Edgec2,c2(x , y) =

Edgeinp(x , y) ∧ (¬Labelinp# (x)∨(Labelinp# (x)∧¬reach#(x)))

I Edge1,2(x , y)=(x=y)∧(first(x)∨∃z(Labelinp# (z)∧Edgeinp(z , x)))

I Edge2,1(x , y)=Labelinp# (x) ∧ reach#(x) ∧ (∃z(Edgeinp(y , z) ∧Labelinp# (z))) ∧ (∀z((path(x , z) ∧ path(z , y))→ ¬Labelinp# (z)))

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 9 / 31

Page 18: From Monadic Second-Order Definable String Transformations to Transducers

MSO-definable Transformations

input: a b c b b # a a b # c c a a # b

copy 1: a b c b b a a b c c a a

copy 2: a b c b b # a a b # c c a a # b

Σ = Γ = {a, b, c ,#}, C = {1, 2}, and

Node Label Formulas (|Γ|.|C | formulas)

I Labelc1α (x) = Labelinpα (x) ∧ ¬Labelinp# (x) ∧ reach#(x)

I Labelc2α (x) = Labelinpα (x)

Edge Label Formulas (|C |2 formulas)

I Edgec1,c1(x , y) = Edgeinp(y , x) ∧ ¬Labelinp# (x) ∧ ¬Labelinp# (y).I Edgec2,c2(x , y) =

Edgeinp(x , y) ∧ (¬Labelinp# (x)∨(Labelinp# (x)∧¬reach#(x)))

I Edge1,2(x , y)=(x=y)∧(first(x)∨∃z(Labelinp# (z)∧Edgeinp(z , x)))

I Edge2,1(x , y)=Labelinp# (x) ∧ reach#(x) ∧ (∃z(Edgeinp(y , z) ∧Labelinp# (z))) ∧ (∀z((path(x , z) ∧ path(z , y))→ ¬Labelinp# (z)))

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 9 / 31

Page 19: From Monadic Second-Order Definable String Transformations to Transducers

Streaming Transducers [Alur and Cerny, 2011]

A streaming transducer is an automaton:

( Σ,Q, δ, q0 , F , X , (D, f1, . . . , fk) , ρ )

extended with a finite set of registers X

which will store values from domain D

with an update function ρ : Q × Σ→ X → T (X , f1, . . . , fk)

T (X , f1, . . . , fk) denotes terms obtained with functions f1, . . . , fk andregisters.

Its configurations will be a state together with a valuation of eachregister Q × [X → D]

An output function F :I Finite word input this is a function from Q to T (X , f1, . . . , fk).

The image of w is the value of the term F(δ(w))I in the case of infinite word input, this is a function from 2Q to X .

The image of w is the limit of the value of register F(δ(w))

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 10 / 31

Page 20: From Monadic Second-Order Definable String Transformations to Transducers

Streaming Transducers [Alur and Cerny, 2011]

A streaming transducer is an automaton:

( Σ,Q, δ, q0 , F , X , (D, f1, . . . , fk) , ρ )

extended with a finite set of registers X

which will store values from domain D

with an update function ρ : Q × Σ→ X → T (X , f1, . . . , fk)

T (X , f1, . . . , fk) denotes terms obtained with functions f1, . . . , fk andregisters.

Its configurations will be a state together with a valuation of eachregister Q × [X → D]

An output function F :I Finite word input this is a function from Q to T (X , f1, . . . , fk).

The image of w is the value of the term F(δ(w))I in the case of infinite word input, this is a function from 2Q to X .

The image of w is the limit of the value of register F(δ(w))

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 10 / 31

Page 21: From Monadic Second-Order Definable String Transformations to Transducers

Streaming Transducers [Alur and Cerny, 2011]

A streaming transducer is an automaton:

( Σ,Q, δ, q0 , F , X , (D, f1, . . . , fk) , ρ )

extended with a finite set of registers X

which will store values from domain D

with an update function ρ : Q × Σ→ X → T (X , f1, . . . , fk)

T (X , f1, . . . , fk) denotes terms obtained with functions f1, . . . , fk andregisters.

Its configurations will be a state together with a valuation of eachregister Q × [X → D]

An output function F :I Finite word input this is a function from Q to T (X , f1, . . . , fk).

The image of w is the value of the term F(δ(w))I in the case of infinite word input, this is a function from 2Q to X .

The image of w is the limit of the value of register F(δ(w))

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 10 / 31

Page 22: From Monadic Second-Order Definable String Transformations to Transducers

Streaming Transducers [Alur and Cerny, 2011]

A streaming transducer is an automaton:

( Σ,Q, δ, q0 , F , X , (D, f1, . . . , fk) , ρ )

extended with a finite set of registers X

which will store values from domain D

with an update function ρ : Q × Σ→ X → T (X , f1, . . . , fk)

T (X , f1, . . . , fk) denotes terms obtained with functions f1, . . . , fk andregisters.

Its configurations will be a state together with a valuation of eachregister Q × [X → D]

An output function F :I Finite word input this is a function from Q to T (X , f1, . . . , fk).

The image of w is the value of the term F(δ(w))I in the case of infinite word input, this is a function from 2Q to X .

The image of w is the limit of the value of register F(δ(w))

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 10 / 31

Page 23: From Monadic Second-Order Definable String Transformations to Transducers

Streaming Transducers [Alur and Cerny, 2011]

A streaming transducer is an automaton:

( Σ,Q, δ, q0 , F , X , (D, f1, . . . , fk) , ρ )

extended with a finite set of registers X

which will store values from domain D

with an update function ρ : Q × Σ→ X → T (X , f1, . . . , fk)

T (X , f1, . . . , fk) denotes terms obtained with functions f1, . . . , fk andregisters.

Its configurations will be a state together with a valuation of eachregister Q × [X → D]

An output function F :I Finite word input this is a function from Q to T (X , f1, . . . , fk).

The image of w is the value of the term F(δ(w))I in the case of infinite word input, this is a function from 2Q to X .

The image of w is the limit of the value of register F(δ(w))

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 10 / 31

Page 24: From Monadic Second-Order Definable String Transformations to Transducers

Streaming Transducers [Alur and Cerny, 2011]

A streaming transducer is an automaton:

( Σ,Q, δ, q0 , F , X , (D, f1, . . . , fk) , ρ )

extended with a finite set of registers X

which will store values from domain D

with an update function ρ : Q × Σ→ X → T (X , f1, . . . , fk)

T (X , f1, . . . , fk) denotes terms obtained with functions f1, . . . , fk andregisters.

Its configurations will be a state together with a valuation of eachregister Q × [X → D]

An output function F :I Finite word input this is a function from Q to T (X , f1, . . . , fk).

The image of w is the value of the term F(δ(w))I in the case of infinite word input, this is a function from 2Q to X .

The image of w is the limit of the value of register F(δ(w))

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 10 / 31

Page 25: From Monadic Second-Order Definable String Transformations to Transducers

An example

A = ( Σ,Q, δ, q0 , F , X , (D, f1, . . . , fk) , ρ )

Here D = Σ∗ , and we have binary function · (concatenation) and

constants ε, a, b, c,#

qstart

#

∣∣∣∣∣∣X := X · Z ·#Y := εZ := ε

α

∣∣∣∣∣∣X := XY := Y · αZ := α · Z · α

F(q) = X · Y

a b # a # a b

X ε ε baab# baab# baab#aa# baab#aa# baab#aa#

Y a ab ε a ε a ab

Z aa baab ε aa ε aa baab

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 11 / 31

Page 26: From Monadic Second-Order Definable String Transformations to Transducers

An example

A = ( Σ,Q, δ, q0 , F , X , (D, f1, . . . , fk) , ρ )

Here D = Σ∗ , and we have binary function · (concatenation) and

constants ε, a, b, c,#

qstart

#

∣∣∣∣∣∣X := X · Z ·#Y := εZ := ε

α

∣∣∣∣∣∣X := XY := Y · αZ := α · Z · α

F(q) = X · Y

a b # a # a b

X ε ε baab# baab# baab#aa# baab#aa# baab#aa#

Y a ab ε a ε a ab

Z aa baab ε aa ε aa baab

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 11 / 31

Page 27: From Monadic Second-Order Definable String Transformations to Transducers

An example

A = ( Σ,Q, δ, q0 , F , X , (D, f1, . . . , fk) , ρ )

Here D = Σ∗ , and we have binary function · (concatenation) and

constants ε, a, b, c,#

qstart

#

∣∣∣∣∣∣X := X · Z ·#Y := εZ := ε

α

∣∣∣∣∣∣X := XY := Y · αZ := α · Z · α

F(q) = X · Y

a b # a # a b

X ε ε baab# baab# baab#aa# baab#aa# baab#aa#

Y a ab ε a ε a ab

Z aa baab ε aa ε aa baab

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 11 / 31

Page 28: From Monadic Second-Order Definable String Transformations to Transducers

An example

A = ( Σ,Q, δ, q0 , F , X , (D, f1, . . . , fk) , ρ )

Here D = Σ∗ , and we have binary function · (concatenation) and

constants ε, a, b, c,#

qstart

#

∣∣∣∣∣∣X := X · Z ·#Y := εZ := ε

α

∣∣∣∣∣∣X := XY := Y · αZ := α · Z · α

F(q) = X · Y

a b # a # a b

X ε ε baab# baab# baab#aa# baab#aa# baab#aa#

Y a ab ε a ε a ab

Z aa baab ε aa ε aa baab

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 11 / 31

Page 29: From Monadic Second-Order Definable String Transformations to Transducers

An example

A = ( Σ,Q, δ, q0 , F , X , (D, f1, . . . , fk) , ρ )

Here D = Σ∗ , and we have binary function · (concatenation) and

constants ε, a, b, c,#

qstart

#

∣∣∣∣∣∣X := X · Z ·#Y := εZ := ε

α

∣∣∣∣∣∣X := XY := Y · αZ := α · Z · α

F(q) = X · Y

a b # a # a b

X ε ε baab# baab# baab#aa# baab#aa# baab#aa#

Y a ab ε a ε a ab

Z aa baab ε aa ε aa baab

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 11 / 31

Page 30: From Monadic Second-Order Definable String Transformations to Transducers

An example

A = ( Σ,Q, δ, q0 , F , X , (D, f1, . . . , fk) , ρ )

Here D = Σ∗ , and we have binary function · (concatenation) and

constants ε, a, b, c,#

qstart

#

∣∣∣∣∣∣X := X · Z ·#Y := εZ := ε

α

∣∣∣∣∣∣X := XY := Y · αZ := α · Z · α

F(q) = X · Y

a b # a # a b

X ε ε baab# baab# baab#aa# baab#aa# baab#aa#

Y a ab ε a ε a ab

Z aa baab ε aa ε aa baab

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 11 / 31

Page 31: From Monadic Second-Order Definable String Transformations to Transducers

An example

A = ( Σ,Q, δ, q0 , F , X , (D, f1, . . . , fk) , ρ )

Here D = Σ∗ , and we have binary function · (concatenation) and

constants ε, a, b, c,#

qstart

#

∣∣∣∣∣∣X := X · Z ·#Y := εZ := ε

α

∣∣∣∣∣∣X := XY := Y · αZ := α · Z · α

F(q) = X · Y

a b # a # a b

X ε ε baab# baab# baab#aa# baab#aa# baab#aa#

Y a ab ε a ε a ab

Z aa baab ε aa ε aa baab

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 11 / 31

Page 32: From Monadic Second-Order Definable String Transformations to Transducers

An example

A = ( Σ,Q, δ, q0 , F , X , (D, f1, . . . , fk) , ρ )

Here D = Σ∗ , and we have binary function · (concatenation) and

constants ε, a, b, c,#

qstart

#

∣∣∣∣∣∣X := X · Z ·#Y := εZ := ε

α

∣∣∣∣∣∣X := XY := Y · αZ := α · Z · α

F(q) = X · Y

a b # a # a b

X ε ε baab# baab# baab#aa# baab#aa# baab#aa#

Y a ab ε a ε a ab

Z aa baab ε aa ε aa baab

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 11 / 31

Page 33: From Monadic Second-Order Definable String Transformations to Transducers

An example

A = ( Σ,Q, δ, q0 , F , X , (D, f1, . . . , fk) , ρ )

Here D = Σ∗ , and we have binary function · (concatenation) and

constants ε, a, b, c,#

qstart

#

∣∣∣∣∣∣X := X · Z ·#Y := εZ := ε

α

∣∣∣∣∣∣X := XY := Y · αZ := α · Z · α

F(q) = X · Y

a b # a # a b

X ε ε baab# baab# baab#aa# baab#aa# baab#aa#

Y a ab ε a ε a ab

Z aa baab ε aa ε aa baab

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 11 / 31

Page 34: From Monadic Second-Order Definable String Transformations to Transducers

A restriction on the update function

qstart α|X = X · α · X F = X

This leads to an exponential output

We want to forbid this behaviour:I Copylessness: each register appear at most once on the r.h.s.I Restricted copy: copies allowed but recombining is not possibleI Bounded copy: in the end the content of any register is never copies

more than a bounded number of times

Streaming transducers have to satisfy this syntactic restriction

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 12 / 31

Page 35: From Monadic Second-Order Definable String Transformations to Transducers

A restriction on the update function

qstart α|X = X · α · X F = X

This leads to an exponential output

We want to forbid this behaviour:I Copylessness: each register appear at most once on the r.h.s.I Restricted copy: copies allowed but recombining is not possibleI Bounded copy: in the end the content of any register is never copies

more than a bounded number of times

Streaming transducers have to satisfy this syntactic restriction

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 12 / 31

Page 36: From Monadic Second-Order Definable String Transformations to Transducers

A restriction on the update function

qstart α|X = X · α · X F = X

This leads to an exponential output

We want to forbid this behaviour:I Copylessness: each register appear at most once on the r.h.s.I Restricted copy: copies allowed but recombining is not possibleI Bounded copy: in the end the content of any register is never copies

more than a bounded number of times

Streaming transducers have to satisfy this syntactic restriction

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 12 / 31

Page 37: From Monadic Second-Order Definable String Transformations to Transducers

Contents

1 Regular TransformationsLogical definitionStreaming Transducers

2 Contribution: Equivalence with a direct logic-based reductionSome logical considerationsProof Walkthrough

3 Decision proceduresFunctional equivalenceTypechecking Problem

4 Conclusion

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 13 / 31

Page 38: From Monadic Second-Order Definable String Transformations to Transducers

A computational modelfor some restricted Courcelle transformations

to {0, 1} Σ∗ Σω T ∗ T ω graphsfrom

finite words

infinite words

finite trees

infinite trees

graphs

[Alur and Cerny, 2011] (POPL) Streaming transducers for algorithmic verification of single-pass list-processing programs

[Alur et al., 2012] (LICS) Regular Transformations of Infinite Strings

[Alur and D’Antoni, 2012] (ICALP) Streaming Tree Transducers

[Alur et al., 2013] (LICS) From Monadic Second-Order Definable String Transformations to Transducers

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 14 / 31

Page 39: From Monadic Second-Order Definable String Transformations to Transducers

A computational modelfor some restricted Courcelle transformations

to {0, 1} Σ∗ Σω T ∗ T ω graphsfrom

finite words

infinite words

finite trees

infinite trees

graphs

Buchi

Rabin

[Alur and Cerny, 2011] (POPL) Streaming transducers for algorithmic verification of single-pass list-processing programs

[Alur et al., 2012] (LICS) Regular Transformations of Infinite Strings

[Alur and D’Antoni, 2012] (ICALP) Streaming Tree Transducers

[Alur et al., 2013] (LICS) From Monadic Second-Order Definable String Transformations to Transducers

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 14 / 31

Page 40: From Monadic Second-Order Definable String Transformations to Transducers

A computational modelfor some restricted Courcelle transformations

to {0, 1} Σ∗ Σω T ∗ T ω graphsfrom

finite words

infinite words

finite trees

infinite trees

graphs

Buchi

Rabin

[AC11]

[Alur and Cerny, 2011] (POPL) Streaming transducers for algorithmic verification of single-pass list-processing programs

[Alur et al., 2012] (LICS) Regular Transformations of Infinite Strings

[Alur and D’Antoni, 2012] (ICALP) Streaming Tree Transducers

[Alur et al., 2013] (LICS) From Monadic Second-Order Definable String Transformations to Transducers

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 14 / 31

Page 41: From Monadic Second-Order Definable String Transformations to Transducers

Existing proof, through a two way transducerCase of transformations from finite strings to finite strings [Alur and Cerny, 2011]

MSOTransformation

Two-Way transducerw/ look-ahead

Two-Way TransducerStreamingTransducer

[Engelfriet and Hoogeboom, 2001]

[Chytil and Jakl, 1977]

[Alur and Cerny, 2011]

[Alur and Cerny, 2011]

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 15 / 31

Page 42: From Monadic Second-Order Definable String Transformations to Transducers

A computational modelfor some restricted Courcelle transformations

to {0, 1} Σ∗ Σω T ∗ T ω graphsfrom

finite words

infinite words

finite trees

infinite trees

graphs

Buchi

Rabin

[AC11]

[AFT12]

[Alur and Cerny, 2011] (POPL) Streaming transducers for algorithmic verification of single-pass list-processing programs

[Alur et al., 2012] (LICS) Regular Transformations of Infinite Strings

[Alur and D’Antoni, 2012] (ICALP) Streaming Tree Transducers

[Alur et al., 2013] (LICS) From Monadic Second-Order Definable String Transformations to Transducers

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 16 / 31

Page 43: From Monadic Second-Order Definable String Transformations to Transducers

Existing proof, of a through way transducerCase of transformations from infinite strings to infinite strings[Alur et al., 2012]

MSOTransformation

Two-Way transducerw/ look-ahead

Functional NSSTw/ look-ahead

Functional NSSTStreaming Transducerw/ bounded copy

StreamingTransducer

[Engelfriet and Hoogeboom, 2001][Alur et al., 2012]

[Miyano and Hayashi, 1984]

[Alur et al., 2012][Alur et al., 2012]

[Alur and Cerny, 2011]

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 17 / 31

Page 44: From Monadic Second-Order Definable String Transformations to Transducers

A computational modelfor some restricted Courcelle transformations

to {0, 1} Σ∗ Σω T ∗ T ω graphsfrom

finite words

infinite words

finite trees

infinite trees

graphs

Buchi

Rabin

[AC11]

[AFT12]

[Ad’A12] [Ad’A12]

[Ad’A12]

[Alur and Cerny, 2011] (POPL) Streaming transducers for algorithmic verification of single-pass list-processing programs

[Alur et al., 2012] (LICS) Regular Transformations of Infinite Strings

[Alur and D’Antoni, 2012] (ICALP) Streaming Tree Transducers

[Alur et al., 2013] (LICS) From Monadic Second-Order Definable String Transformations to Transducers

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 18 / 31

Page 45: From Monadic Second-Order Definable String Transformations to Transducers

A computational modelfor some restricted Courcelle transformations

to {0, 1} Σ∗ Σω T ∗ T ω graphsfrom

finite words

infinite words

finite trees

infinite trees

graphs

Buchi

Rabin

[AC11]

[AFT12]

[Ad’A12] [Ad’A12]

[Ad’A12]

?

?

?

?

?

?

?

?

?

?

?

?

?

?

[Alur and Cerny, 2011] (POPL) Streaming transducers for algorithmic verification of single-pass list-processing programs

[Alur et al., 2012] (LICS) Regular Transformations of Infinite Strings

[Alur and D’Antoni, 2012] (ICALP) Streaming Tree Transducers

[Alur et al., 2013] (LICS) From Monadic Second-Order Definable String Transformations to Transducers

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 18 / 31

Page 46: From Monadic Second-Order Definable String Transformations to Transducers

A computational modelfor some restricted Courcelle transformations

to {0, 1} Σ∗ Σω T ∗ T ω graphsfrom

finite words

infinite words

finite trees

infinite trees

graphs

Buchi

Rabin

[AC11]

[AFT12]

[Ad’A12] [Ad’A12]

[Ad’A12]

[ADT13]

?

?

?

?

?

?

?

?

?

?

?

?

?

?

[Alur and Cerny, 2011] (POPL) Streaming transducers for algorithmic verification of single-pass list-processing programs

[Alur et al., 2012] (LICS) Regular Transformations of Infinite Strings

[Alur and D’Antoni, 2012] (ICALP) Streaming Tree Transducers

[Alur et al., 2013] (LICS) From Monadic Second-Order Definable String Transformations to Transducers

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 18 / 31

Page 47: From Monadic Second-Order Definable String Transformations to Transducers

A direct proof

MSOTransformation

Streaming Transducerw/ restricted copy

[Alur, DG and Trivedi 13]

[Alur and Cerny, 2011][Alur et al., 2012]

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 19 / 31

Page 48: From Monadic Second-Order Definable String Transformations to Transducers

Finiteness of MSO formula up to some quantifier depth

Remark

The number of MSO sentences of quantifier depth at most k is finite

We define an equivalence relation over wordsI Two words are k-equivalent iff no formula of q.d. k can distinguish themI This equivalence relation has finite indexI We denote k-types these equivalence classes

Remark: This equivalence relation is a monoıd congruence

The k-type of u · v is determined by the k-types of u and v

Remark

Formulas with quantifier depth k and 2 first-order free variables:

ϕ(x , y) w : x yw1 w2 w3

The validity of ϕ only depends on w [x ],w [y ] and the k-types of w1,w2,w3

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 20 / 31

Page 49: From Monadic Second-Order Definable String Transformations to Transducers

Finiteness of MSO formula up to some quantifier depth

Remark

The number of MSO sentences of quantifier depth at most k is finiteBy induction over formulas with r FV and quantifier depth at most k :

I true when k = 0I if true for some k , notice that an MSO formula with qd k + 1 and r FV

is a boolean combination of formulas of the form ∃X .ϕ where ϕ has qdk and r + 1 FV.

I Thus a finitely generated (by induction) boolean algebra

We define an equivalence relation over wordsI Two words are k-equivalent iff no formula of q.d. k can distinguish themI This equivalence relation has finite indexI We denote k-types these equivalence classes

Remark: This equivalence relation is a monoıd congruence

The k-type of u · v is determined by the k-types of u and v

Remark

Formulas with quantifier depth k and 2 first-order free variables:

ϕ(x , y) w : x yw1 w2 w3

The validity of ϕ only depends on w [x ],w [y ] and the k-types of w1,w2,w3

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 20 / 31

Page 50: From Monadic Second-Order Definable String Transformations to Transducers

Finiteness of MSO formula up to some quantifier depth

Remark

The number of MSO sentences of quantifier depth at most k is finite

We define an equivalence relation over wordsI Two words are k-equivalent iff no formula of q.d. k can distinguish themI This equivalence relation has finite indexI We denote k-types these equivalence classes

Remark: This equivalence relation is a monoıd congruence

The k-type of u · v is determined by the k-types of u and v

Remark

Formulas with quantifier depth k and 2 first-order free variables:

ϕ(x , y) w : x yw1 w2 w3

The validity of ϕ only depends on w [x ],w [y ] and the k-types of w1,w2,w3

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 20 / 31

Page 51: From Monadic Second-Order Definable String Transformations to Transducers

Finiteness of MSO formula up to some quantifier depth

Remark

The number of MSO sentences of quantifier depth at most k is finite

We define an equivalence relation over wordsI Two words are k-equivalent iff no formula of q.d. k can distinguish themI This equivalence relation has finite indexI We denote k-types these equivalence classes

Remark: This equivalence relation is a monoıd congruence

The k-type of u · v is determined by the k-types of u and v

Remark

Formulas with quantifier depth k and 2 first-order free variables:

ϕ(x , y) w : x yw1 w2 w3

The validity of ϕ only depends on w [x ],w [y ] and the k-types of w1,w2,w3

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 20 / 31

Page 52: From Monadic Second-Order Definable String Transformations to Transducers

Finiteness of MSO formula up to some quantifier depth

Remark

The number of MSO sentences of quantifier depth at most k is finite

We define an equivalence relation over wordsI Two words are k-equivalent iff no formula of q.d. k can distinguish themI This equivalence relation has finite indexI We denote k-types these equivalence classes

Remark: This equivalence relation is a monoıd congruence

The k-type of u · v is determined by the k-types of u and v

Remark

Formulas with quantifier depth k and 2 first-order free variables:

ϕ(x , y) w : x yw1 w2 w3

The validity of ϕ only depends on w [x ],w [y ] and the k-types of w1,w2,w3

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 20 / 31

Page 53: From Monadic Second-Order Definable String Transformations to Transducers

Finiteness of MSO formula up to some quantifier depth

Remark

The number of MSO sentences of quantifier depth at most k is finite

We define an equivalence relation over wordsI Two words are k-equivalent iff no formula of q.d. k can distinguish themI This equivalence relation has finite indexI We denote k-types these equivalence classes

Remark: This equivalence relation is a monoıd congruence

The k-type of u · v is determined by the k-types of u and v

Remark

Formulas with quantifier depth k and 2 first-order free variables:

ϕ(x , y) w : x yw1 w2 w3

The validity of ϕ only depends on w [x ],w [y ] and the k-types of w1,w2,w3

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 20 / 31

Page 54: From Monadic Second-Order Definable String Transformations to Transducers

Crossings

w : x

• • •

• ••

• •

• • •

A crossing at position x is an edge which connects two nodes which are noton the same side w.r.t. x .

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 21 / 31

Page 55: From Monadic Second-Order Definable String Transformations to Transducers

Boundedly many crossings

1 yb ya x y ′a y ′b

w : α α • • • · · ·

c1 ◦ · · · ◦ · · · ◦ · · · ◦ · · · ◦ · · · ◦ · · ·

c2 ◦ · · · ◦ · · · ◦ · · · ◦ · · · ◦ · · · ◦ · · ·

......

◦◦

...

c ◦ · · · ◦ · · · ◦ · · · ◦ · · · ◦ · · · ◦ · · ·

· · ·· · ·· · ·

u vu′ v ′

w w ′inp

ut

outp

ut

Theorem

At any given position there are at most 2C |k-types| crossingsOtherwise in the image, two distinct nodes have an outgoing edge to the same node

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 22 / 31

Page 56: From Monadic Second-Order Definable String Transformations to Transducers

Boundedly many crossings means boundedly many registers

w : x

• • •

••

• •

••

• • •

One register for each triple k-type, letter, k-type would be enough

We will also need to handle all possible behaviours

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 23 / 31

Page 57: From Monadic Second-Order Definable String Transformations to Transducers

Boundedly many crossings means boundedly many registers

w : x

• • •

••

• •

••

• • •

? ? ? ? ? ? ? ? ? ?

One register for each triple k-type, letter, k-type would be enough

We will also need to handle all possible behaviours

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 23 / 31

Page 58: From Monadic Second-Order Definable String Transformations to Transducers

Handling all possible behaviours with Regular Look-Ahead

Regular look-ahead: guards on transitions (and updates)MSO queries over the suffix.

w : y x ? ? ? ? ? ? ? ? ? ?

Is there in the image some subword that starts at a position y (labeledby α), before x such that the k-type of w [0:y) is τ1 and the k-type ofw(y :x) is τ2 ?

This is an MSO query with quantifier depth K = k + |C |+ 3 !

Thus all the possible cases are handled by “guessing” the K -type ofw(x :|w |]The set of registers will be k-types ×Σ× k-types ×K -types

The set of states will be the set of K -types (the state will state whichis the K -type of the prefix read so far).

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 24 / 31

Page 59: From Monadic Second-Order Definable String Transformations to Transducers

Handling all possible behaviours with Regular Look-Ahead

Regular look-ahead: guards on transitions (and updates)MSO queries over the suffix.

w : y x ? ? ? ? ? ? ? ? ? ?

Is there in the image some subword that starts at a position y (labeledby α), before x such that the k-type of w [0:y) is τ1 and the k-type ofw(y :x) is τ2 ?

This is an MSO query with quantifier depth K = k + |C |+ 3 !

Thus all the possible cases are handled by “guessing” the K -type ofw(x :|w |]The set of registers will be k-types ×Σ× k-types ×K -types

The set of states will be the set of K -types (the state will state whichis the K -type of the prefix read so far).

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 24 / 31

Page 60: From Monadic Second-Order Definable String Transformations to Transducers

Handling all possible behaviours with Regular Look-Ahead

Regular look-ahead: guards on transitions (and updates)MSO queries over the suffix.

w : y x ? ? ? ? ? ? ? ? ? ?

Is there in the image some subword that starts at a position y (labeledby α), before x such that the k-type of w [0:y) is τ1 and the k-type ofw(y :x) is τ2 ?

This is an MSO query with quantifier depth K = k + |C |+ 3 !

Thus all the possible cases are handled by “guessing” the K -type ofw(x :|w |]The set of registers will be k-types ×Σ× k-types ×K -types

The set of states will be the set of K -types (the state will state whichis the K -type of the prefix read so far).

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 24 / 31

Page 61: From Monadic Second-Order Definable String Transformations to Transducers

Handling all possible behaviours with Regular Look-Ahead

Regular look-ahead: guards on transitions (and updates)MSO queries over the suffix.

w : y x ? ? ? ? ? ? ? ? ? ?

Is there in the image some subword that starts at a position y (labeledby α), before x such that the k-type of w [0:y) is τ1 and the k-type ofw(y :x) is τ2 ?

This is an MSO query with quantifier depth K = k + |C |+ 3 !

Thus all the possible cases are handled by “guessing” the K -type ofw(x :|w |]

The set of registers will be k-types ×Σ× k-types ×K -types

The set of states will be the set of K -types (the state will state whichis the K -type of the prefix read so far).

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 24 / 31

Page 62: From Monadic Second-Order Definable String Transformations to Transducers

Handling all possible behaviours with Regular Look-Ahead

Regular look-ahead: guards on transitions (and updates)MSO queries over the suffix.

w : y x ? ? ? ? ? ? ? ? ? ?

Is there in the image some subword that starts at a position y (labeledby α), before x such that the k-type of w [0:y) is τ1 and the k-type ofw(y :x) is τ2 ?

This is an MSO query with quantifier depth K = k + |C |+ 3 !

Thus all the possible cases are handled by “guessing” the K -type ofw(x :|w |]The set of registers will be k-types ×Σ× k-types ×K -types

The set of states will be the set of K -types (the state will state whichis the K -type of the prefix read so far).

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 24 / 31

Page 63: From Monadic Second-Order Definable String Transformations to Transducers

Finite word case

At the end of the input, we output the non-empty registercorresponding to the regular-look ahead ε.

The reduction does not go through a two-way model.

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 25 / 31

Page 64: From Monadic Second-Order Definable String Transformations to Transducers

Finite word case

At the end of the input, we output the non-empty registercorresponding to the regular-look ahead ε.

The reduction does not go through a two-way model.

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 25 / 31

Page 65: From Monadic Second-Order Definable String Transformations to Transducers

Infinite word input case

The main difficulty lies in that we have to guess correctly and infinitelyoften the regular look-ahead.

The image is defined as the limit of the content of some register,depending on the set of infinitely occuring states (Muller condition)

With the Muller output condition, we can have some MSO propertyover the whole word.

We need to effectively find a factorization τ(τ ′)ω of the input. Thiscan be found in Shelah’s alternative proof of Buchi Theorem, using afinite additive coloring (Ramsey’s Theorem)

Thus we can output infinitely often some increasing prefixes of theimage

We converge toward the output

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 26 / 31

Page 66: From Monadic Second-Order Definable String Transformations to Transducers

Infinite word input case

The main difficulty lies in that we have to guess correctly and infinitelyoften the regular look-ahead.

The image is defined as the limit of the content of some register,depending on the set of infinitely occuring states (Muller condition)

With the Muller output condition, we can have some MSO propertyover the whole word.

We need to effectively find a factorization τ(τ ′)ω of the input. Thiscan be found in Shelah’s alternative proof of Buchi Theorem, using afinite additive coloring (Ramsey’s Theorem)

Thus we can output infinitely often some increasing prefixes of theimage

We converge toward the output

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 26 / 31

Page 67: From Monadic Second-Order Definable String Transformations to Transducers

Infinite word input case

The main difficulty lies in that we have to guess correctly and infinitelyoften the regular look-ahead.

The image is defined as the limit of the content of some register,depending on the set of infinitely occuring states (Muller condition)

With the Muller output condition, we can have some MSO propertyover the whole word.

We need to effectively find a factorization τ(τ ′)ω of the input. Thiscan be found in Shelah’s alternative proof of Buchi Theorem, using afinite additive coloring (Ramsey’s Theorem)

Thus we can output infinitely often some increasing prefixes of theimage

We converge toward the output

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 26 / 31

Page 68: From Monadic Second-Order Definable String Transformations to Transducers

Infinite word input case

The main difficulty lies in that we have to guess correctly and infinitelyoften the regular look-ahead.

The image is defined as the limit of the content of some register,depending on the set of infinitely occuring states (Muller condition)

With the Muller output condition, we can have some MSO propertyover the whole word.

We need to effectively find a factorization τ(τ ′)ω of the input. Thiscan be found in Shelah’s alternative proof of Buchi Theorem, using afinite additive coloring (Ramsey’s Theorem)

Thus we can output infinitely often some increasing prefixes of theimage

We converge toward the output

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 26 / 31

Page 69: From Monadic Second-Order Definable String Transformations to Transducers

Infinite word input case

The main difficulty lies in that we have to guess correctly and infinitelyoften the regular look-ahead.

The image is defined as the limit of the content of some register,depending on the set of infinitely occuring states (Muller condition)

With the Muller output condition, we can have some MSO propertyover the whole word.

We need to effectively find a factorization τ(τ ′)ω of the input. Thiscan be found in Shelah’s alternative proof of Buchi Theorem, using afinite additive coloring (Ramsey’s Theorem)

Thus we can output infinitely often some increasing prefixes of theimage

We converge toward the output

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 26 / 31

Page 70: From Monadic Second-Order Definable String Transformations to Transducers

Infinite word input case

The main difficulty lies in that we have to guess correctly and infinitelyoften the regular look-ahead.

The image is defined as the limit of the content of some register,depending on the set of infinitely occuring states (Muller condition)

With the Muller output condition, we can have some MSO propertyover the whole word.

We need to effectively find a factorization τ(τ ′)ω of the input. Thiscan be found in Shelah’s alternative proof of Buchi Theorem, using afinite additive coloring (Ramsey’s Theorem)

Thus we can output infinitely often some increasing prefixes of theimage

We converge toward the output

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 26 / 31

Page 71: From Monadic Second-Order Definable String Transformations to Transducers

Contents

1 Regular TransformationsLogical definitionStreaming Transducers

2 Contribution: Equivalence with a direct logic-based reductionSome logical considerationsProof Walkthrough

3 Decision proceduresFunctional equivalenceTypechecking Problem

4 Conclusion

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 27 / 31

Page 72: From Monadic Second-Order Definable String Transformations to Transducers

Functional equivalence is decidableDo two transformations have the same image on any input ?

A hard problem: different logical ways to define the same transformation

w : a0 a1 a2 . . . an−1 ano1 : a1 a2 . . . an−1 ano2 : a1 a2 a3 . . . an

Reduction to reachability in a counter system (no test, no decrement):I Idea: finding a conflicting position (say a in first image, b in the second)I Two counters tracking the number of letters before the conflicting

postion in each imageI Set of states: (states of the transducer ×4registers of the transducer)2

F 0: the value of this register does not appear in the outputF 1: its value appears before the conflicting positionF 2: its value contains the conflicting positionF 3: its value is after the conflicting position

I Erase the letters in the transitions, increment corresponding to theregisters updates

I Find a reachable configuration where the two counters are equal

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 28 / 31

Page 73: From Monadic Second-Order Definable String Transformations to Transducers

Functional equivalence is decidableDo two transformations have the same image on any input ?

A hard problem: different logical ways to define the same transformation

w : a0 a1 a2 . . . an−1 ano1 : a1 a2 . . . an−1 ano2 : a1 a2 a3 . . . an

Reduction to reachability in a counter system (no test, no decrement):I Idea: finding a conflicting position (say a in first image, b in the second)I Two counters tracking the number of letters before the conflicting

postion in each imageI Set of states: (states of the transducer ×4registers of the transducer)2

F 0: the value of this register does not appear in the outputF 1: its value appears before the conflicting positionF 2: its value contains the conflicting positionF 3: its value is after the conflicting position

I Erase the letters in the transitions, increment corresponding to theregisters updates

I Find a reachable configuration where the two counters are equal

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 28 / 31

Page 74: From Monadic Second-Order Definable String Transformations to Transducers

Functional equivalence is decidableDo two transformations have the same image on any input ?

A hard problem: different logical ways to define the same transformation

w : a0 a1 a2 . . . an−1 ano1 : a1 a2 . . . an−1 ano2 : a1 a2 a3 . . . an

Reduction to reachability in a counter system (no test, no decrement):I Idea: finding a conflicting position (say a in first image, b in the second)I Two counters tracking the number of letters before the conflicting

postion in each imageI Set of states: (states of the transducer ×4registers of the transducer)2

F 0: the value of this register does not appear in the outputF 1: its value appears before the conflicting positionF 2: its value contains the conflicting positionF 3: its value is after the conflicting position

I Erase the letters in the transitions, increment corresponding to theregisters updates

I Find a reachable configuration where the two counters are equal

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 28 / 31

Page 75: From Monadic Second-Order Definable String Transformations to Transducers

The typechecking problem

Definition

Given formulas ϕ,ψ do we have ∀w .w � ϕ =⇒ T (w) � ψ

We can perform this check by some automatic construction

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 29 / 31

Page 76: From Monadic Second-Order Definable String Transformations to Transducers

Contents

1 Regular TransformationsLogical definitionStreaming Transducers

2 Contribution: Equivalence with a direct logic-based reductionSome logical considerationsProof Walkthrough

3 Decision proceduresFunctional equivalenceTypechecking Problem

4 Conclusion

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 30 / 31

Page 77: From Monadic Second-Order Definable String Transformations to Transducers

Conclusion

Contributions

Direct proof of equivalence between Courcelle transformations andStreaming Transducers

Previously unexplored setting of ω-words to trees

Syntactically ensuring convergence of the output

Equivalence and type-checking problems are decidable

Perspectives

More expressive transformations (relaxing the restriction on copies)

Less expressive transformations (First-order fragment)

Extension to regular cost functions

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 31 / 31

Page 78: From Monadic Second-Order Definable String Transformations to Transducers

Conclusion

Contributions

Direct proof of equivalence between Courcelle transformations andStreaming Transducers

Previously unexplored setting of ω-words to trees

Syntactically ensuring convergence of the output

Equivalence and type-checking problems are decidable

Perspectives

More expressive transformations (relaxing the restriction on copies)

Less expressive transformations (First-order fragment)

Extension to regular cost functions

Thank you for your attention !

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 31 / 31

Page 79: From Monadic Second-Order Definable String Transformations to Transducers

Alur, R. and Cerny, P. (2011).

Streaming transducers for algorithmic verification of single-pass list-processingprograms.

In POPL, pages 599–610.

Alur, R. and D’Antoni, L. (2012).

Streaming tree transducers.

In ICALP (2), volume 7392 of Lecture Notes in Computer Science, pages42–53. Springer.

Alur, R., Durand-Gasselin, A., and Trivedi, A. (2013).

From monadic second-order definable string transformations to transducers.

In LICS. IEEE.

Alur, R., Filiot, E., and Trivedi, A. (2012).

Regular transformations of infinite strings.

In LICS, pages 65–74.

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 32 / 31

Page 80: From Monadic Second-Order Definable String Transformations to Transducers

Buchi, J. R. (1960).

Weak second-order Arithmetic and Finite Automata.

Zeitschrift fur Mathematische Logik und Grundlagen der Mathematik, 6:66–92.

Chytil, M. and Jakl, V. (1977).

Serial composition of 2-way finite-state transducers and simple programs onstrings.

In ICALP, volume 52 of Lecture Notes in Computer Science, pages 135–147.Springer.

Courcelle, B. (1994).

Monadic second-order definable graph transductions: a survey.

Theoretical Computer Science, 126(1):53–75.

Engelfriet, J. and Hoogeboom, H. J. (2001).

MSO definable string transductions and two-way finite-state transducers.

ACM Trans. Comput. Logic, 2:216–254.

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 33 / 31

Page 81: From Monadic Second-Order Definable String Transformations to Transducers

Miyano, S. and Hayashi, T. (1984).

Alternating finite automata on omega-words.

Theor. Comput. Sci., 32:321–330.

Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 34 / 31


Recommended