Tree Transformations by means of visibly pushdown transducers Jean-Marc Talbot Joint Work L. Dartois 1 , E. Filiot 1 , P.-A. Reynier 2 1 Université Libre de Bruxelles 2 Université d’Aix-Marseille CAALM - Jan 2019 Tree Transformations by means of VPT CAALM - Jan 2019 1 / 34
Outline 1 Trees as Well-nested Words 2 Tree to Word Transformations 3 Tree to Tree Transformations 4 A new Tool : (Two-way) Visibly Pushdown Parikh Automata Tree Transformations by means of VPT CAALM - Jan 2019 2 / 34
Outline 1 Trees as Well-nested Words Tree Transformations by means of VPT CAALM - Jan 2019 3 / 34
Well-nested words for trees : an example Encoding Linearizations of (unranked) trees ⊆ Well-nested words family < family > < person > person < name > MarieCurie < \ name > < birth > 1867 < \ birth > < children > ⇒ name birth children < name > Irene < \ name > < birth > 1897 < \ birth > Marie Curie 1867 < \ children > person < \ person > < \ family > name birth Irene 1897 Tree Transformations by means of VPT CAALM - Jan 2019 4 / 34
Well-nested words for trees Definition (Structured Alphabet) A structured alphabet Σ is a set Σ = Σ c ⊎ Σ r ( call and return symbols resp.). Definition (Well-nested Words) A word is well-nested if it is generated by the following grammar W → ǫ | WW | c i W r j c i ∈ Σ c , r j ∈ Σ r Σ ∗ wn is the set of all well-nested words. Tree Transformations by means of VPT CAALM - Jan 2019 5 / 34
Well-nested words for trees Definition (Structured Alphabet) A structured alphabet Σ is a set Σ = Σ c ⊎ Σ r ( call and return symbols resp.). Definition (Well-nested Words) A word is well-nested if it is generated by the following grammar W → ǫ | WW | c i W r j c i ∈ Σ c , r j ∈ Σ r Σ ∗ wn is the set of all well-nested words. Induces a matching relation c 1 c 2 r 2 r 1 c 1 r 2 Tree Transformations by means of VPT CAALM - Jan 2019 5 / 34
Visibly Pushdown Automata (VPAs) [Alur,Madhusudan,04] VPAs = Pushdown Automata running on on a structured alphabet Σ = Σ c ⊎ Σ r : whose behavior is driven by the input � push one stack symbol on call symbols Σ c � pop one stack symbol on return symbols Σ r accept on empty stack and final state (accepted ⊆ Σ ∗ wn ) (in this talk) c , + γ 1 r 1 , − γ 1 r 1 , − γ 1 q 0 q 1 c , + γ 2 r 2 , − γ 2 L ( A ) = { c n · r 1 · ( r 1 + r 2 ) n − 1 | n > 0 }. Tree Transformations by means of VPT CAALM - Jan 2019 6 / 34
MSO for nested words Logical Structure of Nested Words : M M M c 1 c 2 r 2 r 1 c 1 r 2 succ succ succ succ succ MSO nw formulas : lab a ( x ) | succ ( x , y ) | M ( x , y ) | ∃ x . ϕ | ∃ X . ϕ | ϕ ∨ ϕ | ¬ ϕ Theorem [Alur,Madhusudan,04] MSO nw definable languages ≡ VPA definable languages. Tree Transformations by means of VPT CAALM - Jan 2019 7 / 34
Two-way VPA (2VPA) [Madhusudan,Viswanathan,09] Main features : directed states Q × { ← , → } ( → : read the symbol on the right, ...) Behaviour wrt the stack: � Forward ( → ): just as VPA � Backward ( ← ): dually, pop on call and push on return c 2 , + γ • ( q , → ) → ( q , → ) − c 1 c 2 r 2 r 1 c 1 r 2 ⊢ ⊣ r 2 , − γ → ( q ′ , ← ) ( q , → ) ( q , → ) − r 2 , + γ ′′ ( q ′ , ← ) → ( q ′′ , → ) − γ r 2 , − γ ′′ ( q ′′ , → ) → ( q ′ , → ) − Tree Transformations by means of VPT CAALM - Jan 2019 8 / 34
Two-way VPA (2VPA) [Madhusudan,Viswanathan,09] Main features : directed states Q × { ← , → } ( → : read the symbol on the right, ...) Behaviour wrt the stack: � Forward ( → ): just as VPA � Backward ( ← ): dually, pop on call and push on return c 2 , + γ ( q , → ) → ( q , → ) − c 1 c 2 r 2 r 1 c 1 r 2 ⊢ ⊣ r 2 , − γ → ( q ′ , ← ) • ( q , → ) ( q , → ) − r 2 , + γ ′′ ( q ′ , ← ) → ( q ′′ , → ) − γγ r 2 , − γ ′′ ( q ′′ , → ) → ( q ′ , → ) − Tree Transformations by means of VPT CAALM - Jan 2019 8 / 34
Two-way VPA (2VPA) [Madhusudan,Viswanathan,09] Main features : directed states Q × { ← , → } ( → : read the symbol on the right, ...) Behaviour wrt the stack: � Forward ( → ): just as VPA � Backward ( ← ): dually, pop on call and push on return c 2 , + γ ( q , → ) → ( q , → ) − c 1 c 2 r 2 r 1 c 1 r 2 ⊢ ⊣ r 2 , − γ → ( q ′ , ← ) ( q ′ , ← ) ( q , → ) − r 2 , + γ ′′ • ( q ′ , ← ) → ( q ′′ , → ) − γ r 2 , − γ ′′ ( q ′′ , → ) → ( q ′ , → ) − Tree Transformations by means of VPT CAALM - Jan 2019 8 / 34
Two-way VPA (2VPA) [Madhusudan,Viswanathan,09] Main features : directed states Q × { ← , → } ( → : read the symbol on the right, ...) Behaviour wrt the stack: � Forward ( → ): just as VPA � Backward ( ← ): dually, pop on call and push on return c 2 , + γ ( q , → ) → ( q , → ) − c 1 c 2 r 2 r 1 c 1 r 2 ⊢ ⊣ r 2 , − γ → ( q ′ , ← ) ( q ′′ , → ) ( q , → ) − r 2 , + γ ′′ ( q ′ , ← ) → ( q ′′ , → ) − γγ ′′ r 2 , − γ ′′ • ( q ′′ , → ) → ( q ′ , → ) − Tree Transformations by means of VPT CAALM - Jan 2019 8 / 34
Two-way VPA (2VPA) [Madhusudan,Viswanathan,09] Main features : directed states Q × { ← , → } ( → : read the symbol on the right, ...) Behaviour wrt the stack: � Forward ( → ): just as VPA � Backward ( ← ): dually, pop on call and push on return c 2 , + γ ( q , → ) → ( q , → ) − c 1 c 2 r 2 r 1 c 1 r 2 ⊢ ⊣ r 2 , − γ → ( q ′ , ← ) ( q ′ , → ) ( q , → ) − r 2 , + γ ′′ ( q ′ , ← ) → ( q ′′ , → ) − γ r 2 , − γ ′′ ( q ′′ , → ) → ( q ′ , → ) − Theorem 2VPA are as expressive as VPA. Tree Transformations by means of VPT CAALM - Jan 2019 8 / 34
Tree Transformations Transformation : T , a function from Σ ∗ wn to Γ ∗ Tree Transformations by means of VPT CAALM - Jan 2019 9 / 34
Tree Transformations Transformation : T , a function from Σ ∗ wn to Γ ∗ a transducer T = ( A , O ) extends automata A with an output mechanism O mapping transitions of A to words from Γ ∗ . Tree Transformations by means of VPT CAALM - Jan 2019 9 / 34
Tree Transformations Transformation : T , a function from Σ ∗ wn to Γ ∗ a transducer T = ( A , O ) extends automata A with an output mechanism O mapping transitions of A to words from Γ ∗ . MSO transformations (à la Courcelle) : a set of MSO formulas interpreted on a fixed number of copies of the input structure defining the predicates of some output structure. Tree Transformations by means of VPT CAALM - Jan 2019 9 / 34
Tree Transformations Transformation : T , a function from Σ ∗ wn to Γ ∗ a transducer T = ( A , O ) extends automata A with an output mechanism O mapping transitions of A to words from Γ ∗ . MSO transformations (à la Courcelle) : a set of MSO formulas interpreted on a fixed number of copies of the input structure defining the predicates of some output structure. Interesting properties : Expressiveness Type-checking problem : � T � ( L I ) ⊆ L O Closure by composition (when possible) Tree Transformations by means of VPT CAALM - Jan 2019 9 / 34
Outline 2 Tree to word Transformations Tree Transformations by means of VPT CAALM - Jan 2019 10 / 34
2-way Visibly Pushdown Transducers (2VPT) c i , + 0 r i , − 0 c i , + 1 r i , − 0 0 , → 1 , → 2 , → r i , − 1 r i , − 1 Acc c i , − 1 3 , ← r i , + 0 r i , + 1 c i , − 0 6 , ← 5 , ← 4 , ← c i , − 0 r i , + 1 Input Tape: c 1 c 2 c 3 r 3 r 2 r 1 ⊢ ⊣ ⊥ ( 0 , → ) Output Tape: stack Tree Transformations by means of VPT CAALM - Jan 2019 11 / 34
2-way Visibly Pushdown Transducers (2VPT) c i , + 0 | ǫ r i , − 0 | ǫ c i , + 1 | c i r i , − 0 | ǫ 0 , → 1 , → 2 , → r i , − 1 | r i r i , − 1 | r i Acc c i , − 1 | ǫ 3 , ← r i , + 0 | ǫ r i , + 1 | ǫ c i , − 0 | ǫ 6 , ← 5 , ← 4 , ← c i , − 0 | ǫ r i , + 1 | ǫ Input Tape: c 1 c 2 c 3 r 3 r 2 r 1 ⊢ ⊣ ⊥ ( 0 , → ) Output Tape: stack Tree Transformations by means of VPT CAALM - Jan 2019 11 / 34
2-way Visibly Pushdown Transducers (2VPT) c i , + 0 | ǫ r i , − 0 | ǫ c i , + 1 | c i r i , − 0 | ǫ 0 , → 1 , → 2 , → r i , − 1 | r i r i , − 1 | r i Acc c i , − 1 | ǫ 3 , ← r i , + 0 | ǫ r i , + 1 | ǫ c i , − 0 | ǫ 6 , ← 5 , ← 4 , ← c i , − 0 | ǫ r i , + 1 | ǫ Input Tape: c 1 c 2 c 3 r 3 r 2 r 1 ⊢ ⊣ 1 ⊥ ( 1 , → ) c 1 Output Tape: stack Tree Transformations by means of VPT CAALM - Jan 2019 11 / 34
2-way Visibly Pushdown Transducers (2VPT) c i , + 0 | ǫ r i , − 0 | ǫ c i , + 1 | c i r i , − 0 | ǫ 0 , → 1 , → 2 , → r i , − 1 | r i r i , − 1 | r i Acc c i , − 1 | ǫ 3 , ← r i , + 0 | ǫ r i , + 1 | ǫ c i , − 0 | ǫ 6 , ← 5 , ← 4 , ← c i , − 0 | ǫ r i , + 1 | ǫ 0 Input Tape: c 1 c 2 c 3 r 3 r 2 r 1 ⊢ ⊣ 1 ⊥ ( 1 , → ) c 1 Output Tape: stack Tree Transformations by means of VPT CAALM - Jan 2019 11 / 34
Recommend
More recommend