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é Paris Diderot 3 Indian Institute of Technology Bombay June 21, 2013 Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 1 / 31
Regular Word Analysis Qualitative properties over words ϕ : Σ {0, 1} Logically MSO formulas Computational model Finite state automata Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 2 / 31
Regular Word Analysis Qualitative properties over words ϕ : Σ {0, 1} Logically MSO formulas Equivalence [Büchi, 1960] Computational model Finite state automata Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 2 / 31
Regular Word Analysis Qualitative properties over words ϕ : Σ {0, 1} Logically MSO formulas Equivalence [Büchi, 1960] Regular Word Transformation Logically Definition using MSO Transformations of words ϕ : Σ Σ Computational model Finite state automata Computational model Streaming Transducers Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 2 / 31
Regular Word Analysis Qualitative properties over words ϕ : Σ {0, 1} Logically MSO formulas Equivalence [Büchi, 1960] Regular Word Transformation Logically Definition using MSO Transformations of words ϕ : Σ Σ Equi-expressiveness Computational model Finite state automata Computational model Streaming Transducers Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 2 / 31
Monadic Second Order Logic (MSO) We deal about MSO over the linear order: The structure is ( N, >, P 1,..., P k ) The domain: N or [1, n] The order relation Some unary predicates Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 3 / 31
Monadic Second Order Logic (MSO) We deal about MSO over the linear order: The structure is ( N, >, P 1,..., P k ) The domain: N or [1, n] The order relation Some unary predicates Words are interpreted structures: e.g. ([1, 10], >, P a, P b, P c ) w = a b b a b c a b c c P a = { 1, 4, 7} P b = { 2, 3, 5, 8} P c = { 6, 9, 10} Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 3 / 31
Monadic Second Order Logic (MSO) We deal about MSO over the linear order: The structure is ( N, >, P 1,..., P k ) The domain: N or [1, n] The order relation Some unary predicates Words are interpreted structures: e.g. ([1, 10], >, P a, P b, P c ) w = a b b a b c a b c c P a = { 1, 4, 7} P b = { 2, 3, 5, 8} P c = { 6, 9, 10} Formulas are defined inductively: Atomic: x 1 < x 2, P(x 1 ), X (x),... Boolean connectives: ϕ 1 ϕ 2, ϕ 3,... First-order quantification: x.ϕ Second-order quantification: X.ϕ Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 3 / 31
Monadic Second Order Logic (MSO) We deal about MSO over the linear order: The structure is ( N, >, P 1,..., P k ) The domain: N or [1, n] The order relation Some unary predicates Words are interpreted structures: e.g. ([1, 10], >, P a, P b, P c ) w = a b b a b c a b c c P a = { 1, 4, 7} P b = { 2, 3, 5, 8} P c = { 6, 9, 10} Formulas are defined inductively: Atomic: x 1 < x 2, P(x 1 ), X (x),... Boolean connectives: ϕ 1 ϕ 2, ϕ 3,... First-order quantification: x.ϕ 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
Appealing computational model: Finite State Automata Theorem [Büchi, 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 manipulated Automata can be determinized LSPACE algorithm to check if a word is accepted by an automaton Minimization (equivalence in time O(n log log n)) Product of automata (language union, intersection,...) Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 4 / 31
Regular Word Analysis Qualitative properties over words ϕ : Σ {0, 1} Logically MSO formulas Equivalence [Büchi, 1960] Regular Word Transformation Logically Definition using MSO Transformations of words ϕ : Σ Σ Equi-expressiveness Computational model Finite state automata Computational model Streaming Transducers Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 5 / 31
Contents 1 Regular Transformations Logical definition Streaming Transducers 2 Contribution: Equivalence with a direct logic-based reduction Some logical considerations Proof Walkthrough 3 Decision procedures Functional equivalence Typechecking Problem 4 Conclusion Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 6 / 31
Contents 1 Regular Transformations Logical definition Streaming Transducers 2 Contribution: Equivalence with a direct logic-based reduction Some logical considerations Proof Walkthrough 3 Decision procedures Functional equivalence Typechecking Problem 4 Conclusion Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 7 / 31
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 input graph; the node labels are specified using MSO formulas; and the existence of edges between nodes of various copies is specified using MSO formulas Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 8 / 31
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 input graph; the node labels are specified using MSO formulas; and the existence of edges between nodes of various copies is specified using MSO formulas Example Let Σ = {a, b, #}. Consider a transformation f 1 : Σ Σ where u is reverse of u. u 1 #u 2 #... u n 1 #u n #v u 1 u 1 #... #u n u n #v. Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 8 / 31
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 Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 9 / 31
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) Label c1 α (x) = Label inp α (x) Label inp # (x) reach #(x) Label c2 α (x) = Label inp (x) α Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 9 / 31
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) Label c1 α (x) = Label inp α (x) Label inp # (x) reach #(x) Label c2 α (x) = Label inp α (x) Edge Label Formulas ( C 2 formulas) Edge c1,c1 (x, y) = Edge inp (y, x) Label inp # (x) Labelinp # (y). Edge c2,c2 (x, y) = Edge inp (x, y) ( Label inp # (x) (Labelinp # (x) reach #(x))) Edge 1,2 (x, y)=(x=y) (first(x) z(label inp # (z) Edgeinp (z, x))) Edge 2,1 (x, y)=label inp # (x) reach #(x) ( z(edge inp (y, z) Label inp # (z))) ( z((path(x, z) path(z, y)) Labelinp # (z))) Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 9 / 31
Streaming Transducers [Alur and Černý, 2011] A streaming transducer is an automaton: ( Σ, Q, δ, q 0, F, X, (D, f 1,..., f k ), ρ ) Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 10 / 31
Streaming Transducers [Alur and Černý, 2011] A streaming transducer is an automaton: ( Σ, Q, δ, q 0, F, X, (D, f 1,..., f k ), ρ ) extended with a finite set of registers X Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 10 / 31
Streaming Transducers [Alur and Černý, 2011] A streaming transducer is an automaton: ( Σ, Q, δ, q 0, F, X, (D, f 1,..., f k ), ρ ) extended with a finite set of registers X which will store values from domain D Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 10 / 31
Streaming Transducers [Alur and Černý, 2011] A streaming transducer is an automaton: ( Σ, Q, δ, q 0, F, X, (D, f 1,..., f k ), ρ ) extended with a finite set of registers X which will store values from domain D with an update function ρ : Q Σ X T (X, f 1,..., f k ) T (X, f 1,..., f k ) denotes terms obtained with functions f 1,..., f k registers. and Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 10 / 31
Streaming Transducers [Alur and Černý, 2011] A streaming transducer is an automaton: ( Σ, Q, δ, q 0, F, X, (D, f 1,..., f k ), ρ ) extended with a finite set of registers X which will store values from domain D with an update function ρ : Q Σ X T (X, f 1,..., f k ) T (X, f 1,..., f k ) denotes terms obtained with functions f 1,..., f k and registers. Its configurations will be a state together with a valuation of each register Q [X D] Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 10 / 31
Streaming Transducers [Alur and Černý, 2011] A streaming transducer is an automaton: ( Σ, Q, δ, q 0, F, X, (D, f 1,..., f k ), ρ ) extended with a finite set of registers X which will store values from domain D with an update function ρ : Q Σ X T (X, f 1,..., f k ) T (X, f 1,..., f k ) denotes terms obtained with functions f 1,..., f k and registers. Its configurations will be a state together with a valuation of each register Q [X D] An output function F : Finite word input this is a function from Q to T (X, f1,..., f k ). The image of w is the value of the term F(ˆδ(w)) in the case of infinite word input, this is a function from 2 Q 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
An example A = ( Σ, Q, δ, q 0, F, X, (D, f 1,..., f k ), ρ ) Here D = Σ, and we have binary function (concatenation) and constants ε, a, b, c, # Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 11 / 31
An example A = ( Σ, Q, δ, q 0, F, X, (D, f 1,..., f k ), ρ ) Here D = Σ, and we have binary function (concatenation) and constants ε, a, b, c, # start q # α X := X Z # Y := ε Z := ε X := X Y := 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
An example A = ( Σ, Q, δ, q 0, F, X, (D, f 1,..., f k ), ρ ) Here D = Σ, and we have binary function (concatenation) and constants ε, a, b, c, # start q # α X := X Z # Y := ε Z := ε X := X Y := 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
An example A = ( Σ, Q, δ, q 0, F, X, (D, f 1,..., f k ), ρ ) Here D = Σ, and we have binary function (concatenation) and constants ε, a, b, c, # start q # α X := X Z # Y := ε Z := ε X := X Y := 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
An example A = ( Σ, Q, δ, q 0, F, X, (D, f 1,..., f k ), ρ ) Here D = Σ, and we have binary function (concatenation) and constants ε, a, b, c, # start q # α X := X Z # Y := ε Z := ε X := X Y := 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
An example A = ( Σ, Q, δ, q 0, F, X, (D, f 1,..., f k ), ρ ) Here D = Σ, and we have binary function (concatenation) and constants ε, a, b, c, # start q # α X := X Z # Y := ε Z := ε X := X Y := 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
An example A = ( Σ, Q, δ, q 0, F, X, (D, f 1,..., f k ), ρ ) Here D = Σ, and we have binary function (concatenation) and constants ε, a, b, c, # start q # α X := X Z # Y := ε Z := ε X := X Y := 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
An example A = ( Σ, Q, δ, q 0, F, X, (D, f 1,..., f k ), ρ ) Here D = Σ, and we have binary function (concatenation) and constants ε, a, b, c, # start q # α X := X Z # Y := ε Z := ε X := X Y := 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
An example A = ( Σ, Q, δ, q 0, F, X, (D, f 1,..., f k ), ρ ) Here D = Σ, and we have binary function (concatenation) and constants ε, a, b, c, # start q # α X := X Z # Y := ε Z := ε X := X Y := 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
A restriction on the update function start q α X = X α X F = X This leads to an exponential output Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 12 / 31
A restriction on the update function start q α X = X α X F = X This leads to an exponential output We want to forbid this behaviour: Copylessness: each register appear at most once on the r.h.s. Restricted copy: copies allowed but recombining is not possible Bounded copy: in the end the content of any register is never copies more than a bounded number of times Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 12 / 31
A restriction on the update function start q α X = X α X F = X This leads to an exponential output We want to forbid this behaviour: Copylessness: each register appear at most once on the r.h.s. Restricted copy: copies allowed but recombining is not possible 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
Contents 1 Regular Transformations Logical definition Streaming Transducers 2 Contribution: Equivalence with a direct logic-based reduction Some logical considerations Proof Walkthrough 3 Decision procedures Functional equivalence Typechecking Problem 4 Conclusion Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 13 / 31
A computational model for some restricted Courcelle transformations from to {0, 1} Σ Σ ω T T ω graphs finite words infinite words finite trees infinite trees graphs Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 14 / 31
A computational model for some restricted Courcelle transformations from to {0, 1} Σ Σ ω T T ω graphs finite words infinite words finite trees infinite trees Büchi Rabin graphs Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 14 / 31
A computational model for some restricted Courcelle transformations from to {0, 1} Σ Σ ω T T ω graphs finite words infinite words finite trees infinite trees graphs Büchi Rabin [AČ11] [Alur and Černý, 2011] (POPL) Streaming transducers for algorithmic verification of single-pass list-processing programs Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 14 / 31
Existing proof, through a two way transducer Case of transformations from finite strings to finite strings [Alur and Černý, 2011] [Engelfriet and Hoogeboom, 2001] MSO Transformation Two-Way transducer w/ look-ahead [Alur and Černý, 2011] [Chytil and Jákl, 1977] Streaming Transducer Two-Way Transducer [Alur and Černý, 2011] Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 15 / 31
A computational model for some restricted Courcelle transformations from to {0, 1} Σ Σ ω T T ω graphs finite words infinite words finite trees infinite trees graphs Büchi Rabin [AČ11] [AFT12] [Alur and Černý, 2011] (POPL) Streaming transducers for algorithmic verification of single-pass list-processing programs [Alur et al., 2012] (LICS) Regular Transformations of Infinite Strings Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 16 / 31
Existing proof, of a through way transducer Case of transformations from infinite strings to infinite strings[alur et al., 2012] [Engelfriet and Hoogeboom, 2001][Alur et al., 2012] MSO Transformation Two-Way transducer w/ look-ahead Functional NSST w/ look-ahead [Alur and Černý, 2011] Streaming Transducer Streaming Transducer w/ bounded copy [Miyano and Hayashi, 1984] Functional NSST [Alur et al., 2012] [Alur et al., 2012] Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 17 / 31
A computational model for some restricted Courcelle transformations from to {0, 1} Σ Σ ω T T ω graphs finite words infinite words Büchi [AČ11] [AFT12] [Ad A12] finite trees infinite trees Rabin [Ad A12] [Ad A12] graphs [Alur and Černý, 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, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 18 / 31
A computational model for some restricted Courcelle transformations from to {0, 1} Σ Σ ω T T ω graphs finite words infinite words Büchi [AČ11] [AFT12] [Ad A12]?? finite trees infinite trees Rabin [Ad A12]?? [Ad A12]???? graphs?????? [Alur and Černý, 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, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 18 / 31
A computational model for some restricted Courcelle transformations from to {0, 1} Σ Σ ω T T ω graphs finite words infinite words Büchi [AČ11] [AFT12] [Ad A12] [ADT13]?? finite trees infinite trees Rabin [Ad A12]?? [Ad A12]???? graphs?????? [Alur and Černý, 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
A direct proof MSO Transformation [Alur, DG and Trivedi 13] [Alur and Černý, 2011] [Alur et al., 2012] Streaming Transducer w/ restricted copy Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 19 / 31
Finiteness of MSO formula up to some quantifier depth Remark The number of MSO sentences of quantifier depth at most k is finite Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 20 / 31
Finiteness of MSO formula up to some quantifier depth Remark The number of MSO sentences of quantifier depth at most k is finite By induction over formulas with r FV and quantifier depth at most k: true when k = 0 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 qd k and r + 1 FV. Thus a finitely generated (by induction) boolean algebra Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 20 / 31
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 words Two words are k-equivalent iff no formula of q.d. k can distinguish them This equivalence relation has finite index We denote k-types these equivalence classes Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 20 / 31
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 words Two words are k-equivalent iff no formula of q.d. k can distinguish them This equivalence relation has finite index 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 Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 20 / 31
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 words Two words are k-equivalent iff no formula of q.d. k can distinguish them This equivalence relation has finite index 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: w 1 w 2 w 3 ϕ(x, y) w : x y Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 20 / 31
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 words Two words are k-equivalent iff no formula of q.d. k can distinguish them This equivalence relation has finite index 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: w 1 w 2 w 3 ϕ(x, y) w : x y The validity of ϕ only depends on w[x], w[y] and the k-types of w 1, w 2, w 3 Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 20 / 31
Crossings w : x A crossing at position x is an edge which connects two nodes which are not on the same side w.r.t. x. Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 21 / 31
Boundedly many crossings input output 1 y b y a x y a y b w : α α c 1 c 2. u v w w u v.. c Theorem At any given position there are at most 2C k-types crossings Otherwise 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
Boundedly many crossings means boundedly many registers w : x One register for each triple k-type, letter, k-type would be enough Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 23 / 31
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
Handling all possible behaviours with Regular Look-Ahead Regular look-ahead: guards on transitions (and updates) MSO queries over the suffix. Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 24 / 31
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 (labeled by α), before x such that the k-type of w[0:y) is τ 1 and the k-type of w(y:x) is τ 2? Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 24 / 31
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 (labeled by α), before x such that the k-type of w[0:y) is τ 1 and the k-type of w(y:x) is τ 2? This is an MSO query with quantifier depth K = k + C + 3! Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 24 / 31
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 (labeled by α), before x such that the k-type of w[0:y) is τ 1 and the k-type of w(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 of w(x: w ] Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 24 / 31
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 (labeled by α), before x such that the k-type of w[0:y) is τ 1 and the k-type of w(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 of w(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 which is the K-type of the prefix read so far). Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 24 / 31
Finite word case At the end of the input, we output the non-empty register corresponding to the regular-look ahead ε. Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 25 / 31
Finite word case At the end of the input, we output the non-empty register corresponding 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
Infinite word input case The main difficulty lies in that we have to guess correctly and infinitely often the regular look-ahead. Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 26 / 31
Infinite word input case The main difficulty lies in that we have to guess correctly and infinitely often 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) Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 26 / 31
Infinite word input case The main difficulty lies in that we have to guess correctly and infinitely often 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 property over the whole word. Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 26 / 31
Infinite word input case The main difficulty lies in that we have to guess correctly and infinitely often 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 property over the whole word. We need to effectively find a factorization τ(τ ) ω of the input. This can be found in Shelah s alternative proof of Büchi Theorem, using a finite additive coloring (Ramsey s Theorem) Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 26 / 31
Infinite word input case The main difficulty lies in that we have to guess correctly and infinitely often 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 property over the whole word. We need to effectively find a factorization τ(τ ) ω of the input. This can be found in Shelah s alternative proof of Büchi Theorem, using a finite additive coloring (Ramsey s Theorem) Thus we can output infinitely often some increasing prefixes of the image Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 26 / 31
Infinite word input case The main difficulty lies in that we have to guess correctly and infinitely often 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 property over the whole word. We need to effectively find a factorization τ(τ ) ω of the input. This can be found in Shelah s alternative proof of Büchi Theorem, using a finite additive coloring (Ramsey s Theorem) Thus we can output infinitely often some increasing prefixes of the image We converge toward the output Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 26 / 31
Contents 1 Regular Transformations Logical definition Streaming Transducers 2 Contribution: Equivalence with a direct logic-based reduction Some logical considerations Proof Walkthrough 3 Decision procedures Functional equivalence Typechecking Problem 4 Conclusion Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 27 / 31
Functional equivalence is decidable Do two transformations have the same image on any input? Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 28 / 31
Functional equivalence is decidable Do two transformations have the same image on any input? A hard problem: different logical ways to define the same transformation w : a 0 a 1 a 2... a n 1 a n o 1 : a 1 a 2... a n 1 a n o 2 : a 1 a 2 a 3... a n Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 28 / 31
Functional equivalence is decidable Do two transformations have the same image on any input? A hard problem: different logical ways to define the same transformation w : a 0 a 1 a 2... a n 1 a n o 1 : a 1 a 2... a n 1 a n o 2 : a 1 a 2 a 3... a n Reduction to reachability in a counter system (no test, no decrement): Idea: finding a conflicting position (say a in first image, b in the second) Two counters tracking the number of letters before the conflicting postion in each image Set of states: (states of the transducer 4 registers of the transducer ) 2 0: the value of this register does not appear in the output 1: its value appears before the conflicting position 2: its value contains the conflicting position 3: its value is after the conflicting position Erase the letters in the transitions, increment corresponding to the registers updates Find a reachable configuration where the two counters are equal Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 28 / 31
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
Contents 1 Regular Transformations Logical definition Streaming Transducers 2 Contribution: Equivalence with a direct logic-based reduction Some logical considerations Proof Walkthrough 3 Decision procedures Functional equivalence Typechecking Problem 4 Conclusion Alur, Durand-Gasselin, Trivedi Streaming String Transducers June 21, 2013 30 / 31
Conclusion Contributions Direct proof of equivalence between Courcelle transformations and Streaming 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
Conclusion Contributions Direct proof of equivalence between Courcelle transformations and Streaming 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
Alur, R. and Černý, P. (2011). Streaming transducers for algorithmic verification of single-pass list-processing programs. 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, pages 42 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
Büchi, J. R. (1960). Weak second-order Arithmetic and Finite Automata. Zeitschrift fur Mathematische Logik und Grundlagen der Mathematik, 6:66 92. Chytil, M. and Jákl, V. (1977). Serial composition of 2-way finite-state transducers and simple programs on strings. 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
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