tree transducers
play

TreeTransducers HendrikJanHoogeboom LIACSLeiden CSL/GAMES - PowerPoint PPT Presentation

\maketitle Tutorialon TreeTransducers HendrikJanHoogeboom LIACSLeiden CSL/GAMES Lausanne,sept 07 from tree to tree parse parse val val symbolic/ syntax%directedtranslation compilertheory


  1. \maketitle Tutorial�on Tree�Transducers Hendrik�Jan�Hoogeboom LIACS�Leiden CSL/GAMES Lausanne,�sept 07

  2. from tree to tree parse parse val val symbolic�/� syntax%directed�translation • compiler�theory • natural�language • document�transformation

  3. history 1960�Irons���������syntax%directed�translation 1968�Knuth����������������attribute�grammar 1968�Thatcher&�Rounds�����top%down,�bottom%up� 1980�Aho&�Ullman tree%walking�tr. 1985�Engelfriet&�Vogler macro�tree�tr. 2000�Milo&�Suciu&�Vianu pebble�tree�tr.��XML Fülöp&�Vogler book�tree�transducers Maneth Tarragona�lectures

  4. contents 1. automata�on�trees 2. transducers 3. regular�models 4. context%free�tree�grammars 5. macro�tree�transducers 6. pebble�tree�transducers

  5. two views ranked�trees�~�terms���� [nested�strings] δ δ ( σ (ab)ba) 1 2 3 ranked�alphabet ( Σ ,rank) σ a b rank�:� Σ →� � 1 2 Σ k���� rank�k Σ 0 =�{a,b} b a Σ 2 =�{ δ } Σ 3 =�{ σ } T Σ trees�over� Σ f f f f f ∈ Σ k�� 1 2 k f(x 1 x 2 …x k )� … fx 1 x 2 …x k

  6. tree automata bottom%up top%down tree%walking evaluation grammatical navigation ‘parallel’

  7. bottom-up rules: 1 1 1 1 0 0 0 0 1 1 1 1 T F ∧ ∧ ∧ ∧ 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 ∨ ∨ ∨ ∨ ∧ ∧ ∧ ∧ ∧ ∧ ∧ ∧ ∨ ∨ ∨ ∨ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ∨ ∨ ∨ ∨ ∨ ∨ ∨ ∨ ∨ ∨ ∨ ∨ T 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 ∨ ∨ ∨ ∨ ∧ ∧ ∧ ∧ ∨ ∨ ∧ ∧ ∨ ∨ ∧ ∧ F T T F 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 F T F T 1 1 1 1 0 0 0 0 ∨ ∨ ∨ ∨ ∧ ∧ ∧ ∧ 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 ∨ ∨ ∧ ∧ ∨ ∨ ∧ ∧ evaluation 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

  8. formalization σ σ q 1 ⇒ ⇒ ⇒ ⇒ 1 i k i k q i q 1 q k σ (q 1 …q k )� → q������ rank( σ )=k σ → q������ rank( σ )=0 acceptance�by�final�state�(at�root) 1 1 1 1 ∨ ∨ ∨ ∨ F,T� ∈ Σ 0 F� → 0 ∧ ∈ Σ 2 T� → 1 ∨ , ∧ ∨ ∨ ∨ ∧ ∧ 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 ∨ 11� →� 1 ∨ ∨ ∨ T F

  9. top-down derivation�tree ⇒ ⇒ ⇒ ⇒ A p 1 p 1 :�A� → AaB A a B p 2 :�A� → a p 3 :�B� → Bb p 1 ⇒ ⇒ ⇒ ⇒ p 4 :�B� → A A a p 3 p 1 B b regular�tree�grammar p 2 a p 3 p 3 ⇒ 2 ⇒ ⇒ ⇒ B → a p 4 b B b A rewriting�at�leaves

  10. regular tree languages REG natural! ► • bottom%up�(det/nondet) • top%down�(nondet) • MSO�logic • regular�tree�grammars closed�under�intersection,� ► complementation decidable�emptiness� ► (equivalence)

  11. walking along the tree 0 0 0 0 0 0 0 0 ∨ ∨ ∨ ∨ ∧ ∧ ∧ ∧ 1 1 1 1 1 1 2 ∧ ∧ ∧ ∧ 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 ∧ ∧ ∧ ∧ ∨ ∨ ∨ ∨ 1 1 1 1 0 0 0 0 ∨ ∨ ∨ ∨ ∧ ∧ ∧ ∧ 1 1 1 1 1 1 1 1 1 1 1 1 ∨ ∨ ∨ ∨ ∨ ∨ ∨ ∨ ∨ ∨ ∨ ∨ ? 1 2 1 2 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 ∨ ∨ ∧ ∧ ∨ ∨ ∧ ∧ ? F T T 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 ∨ ∨ ∨ ∨ ∧ ∧ ∧ ∧ F T F ? 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 evaluates�and/or�trees�! 1 1 1 1 0 0 0 0 T F cf.�two%way�finite�state�automaton

  12. tree walking automaton example:� tree�traversal TWA� when�label�is� ∨ ∨ or� ∧ ∨ ∨ ∧ ∧ ∧ ch 2 :up move�to�first�child lab ∨∧ ∨∧ :down 1 ∨∧ ∨∧ lab TF root 3 1 1 H 1 down 2 ch 1 :up ∧ ∧ ∧ ∧ 2 3 1 2 2 walk�along�edges,�moves�based�on • state 2 lab • node�label ch • child�number (=�incoming�edge)

  13. tree automata bottom%up top%down tree%walking evaluation grammatical navigation REG TWA� ⊇ ⊇ ⊇ ⊇ “twa easily� loose�their�way”

  14. ‘branching structure’ of even length Boja ń czyk & Colcombet TWA� ⊂ ⊂ REG ⊂ ⊂ b b b b a a a a a a a b a a a not�by�TWA but�FO�(!) a b (aa)*

  15. ‘branching structure’ of even length Boja ń czyk & Colcombet TWA� ⊂ ⊂ REG ⊂ ⊂ b b b b a a a a a a a b a a a not�by�TWA but�PTWA a b using�a�pebble

  16. adding nested pebbles pebble pebble pebble pebble:�marks�a�node drop retrieve � fixed�number�for�automaton � can�be�distinguished�&�reused � nested�lifetimes nested�lifetimes nested�lifetimes nested�lifetimes LIFO 1 1 1 1 2 2 2 2 2 2 2 2 3 3 3 3 PTWA� ⊆ REG ‘regular’ extension

  17. selected papers on pebble automata J.Engelfriet,�H.J.Hoogeboom.�Tree%walking�pebble� automata,� Jewels�are�forever ,�1999.� M.Bojańczyk,�T.Colcombet.�Tree%walking�automata�do� not�recognize�all�regular�languages,�STOC'05. J.Engelfriet,�H.J.Hoogeboom.�Nested�pebbles�and� transitive�closure,�LMCS,�2007.� M.Bojańczyk,�M.Samuelides,�T.Schwentick,�L.Segoufin.� On�the�expressive�power�of�pebble�automata, ICALP'06.

  18. tree automata & logic Doner; ThaWri’68 MSO= MSO MSO MSO =REG = = REG REG REG ⊂ ⊂ ⊂ ⊂ BojSamSchSeg’06 nested pebbles & transitive closure FO+posTC 1 FO+posTC FO+posTC FO+posTC 1 = 1 1 = = =PTWA PTWA PTWA PTWA EngHoo’06 ? ? ? ? FO+dTC 1 FO+dTC FO+dTC FO+dTC 1 1 1 = = = =dPTWA dPTWA dPTWA dPTWA TWA TWA TWA TWA TC(FO+mod) FO(<) NevSch dTW dTW dTW dTW FO( +1 ) • PWTA� ⊂ ⊂ REG�strict ⊂ ⊂ • pebble�hierarchy • type�of�pebbles:� physical�vs.�abstract

  19. \section macro�tree transducers automata�on�trees regular�models pebble�tree context%free�tree transducers grammars

  20. top-down tree transducer δ σ q q q(���) q → → → → ε q q q q ′ ′ (x 1 ) ′ ′ a x 1 x 2 x 3 q ′′ q ′′ (x 2 ) q q ′′ ′′ state + subtree ≡ node (input) T Σ → T ∆ A =�( Σ , ∆ ,Q,Q d ,R) A A A q( σ (x 1 … x k )) → t ∈ T ∆ [Q(X k )]��� rank( σ )=k q( σ )�������� → t ∈ T ∆ rank( σ )=0 {�(t,s) ∈ T Σ × T ∆ |�q(t)� ⇒ * s,�q ∈ Q d }

  21. example top-down Σ 0 =�{e},� Σ 1 =�{a} ∆ 0 =�{e},� ∆ 2� =�{d} q(a(x))� → d(q(x),q(x)) q(e)���� → e d d d a q(���) a q(��) ⇒ a a a d d ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ q(��) ⇒ ⇒ ⇒ ⇒ q(��) a q(��) a a a a a a a a d q(��) q(��) q(��) e e e e e e e e e e q(��) q(��)

  22. example top-down Σ 0 =�{e},� Σ 1 =�{a} ∆ 0 =�{e},� ∆ 2� =�{d} q(a(x))� → d(q(x),q(x)) q(e)���� → e d a q(���) d d ⇒ * ⇒ ⇒ ⇒ a a d d d d exponential size�increase e e e e e e e e e

  23. top-down rules�are�confluent� q(a(x 1 ))� → d(q(x 1 )q(x 1 ))�� copy q(c(x 1 x 2 x 3 ))� → d(q(x 1 )q(x 2 ))�� delete linear�height�increase exponential�size�increase yield�linear�input� → ET0L ⇒ * ⇒ ⇒ ⇒ more�Lindenmayer connections yield

  24. top-down characteristic ‘T’ copying�input,�processing�copies�differently Σ 0 =�{e},� Σ 1 =�{a, σ } ∆ 0 =�{e},� ∆ 1 =�{a,b},� ∆ 2 ={ σ } q( σ (x))� → σ (q(x),q(x)) q(a(x))� → a(q(x))� | b(q(x)) q(e)���� → e σ σ σ q q q a a a a b ⇒ * ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ a a a b b a a a b a e e e e e

  25. bottom-up characteristic ‘B1’ copying�output�after�nondet processing�input Σ 0 =�{e},� Σ 1 =�{a, σ } ∆ 0 =�{e},� ∆ 1 =�{a,b},� ∆ 2 ={ σ } e → q(e) a(q(x))� → q(a(x))� | q(b(x)) σ( q(x))� → q( σ (xx)) σ σ σ σ σ q a a a a a a ⇒ * ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ a a a b b b a a q a b b b q e e e e e e

  26. top-down vs. bottom-up top%down bottom%up σ σ σ σ σ σ q q q q a a a a b a a a a ⇒ * ⇒ * ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ a a a b b a b b b a a a b a a b b b e e e e e e e e e copy relabel relabel copy bottom%up 2 2 2 2 top%down 2 2 2 2 ‘T’ copying�input,�processing� ‘B1’ copying�output�after� copies�differently nondet processing�input

  27. some properties TDT�and�BUT … have�REG�domains … REG�closed�under�inverse … are�incomparable … are�not�closed�under�composition�

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend