tree transducers
play

Tree Transducers Niko Paltzer Seminar Formal Grammars WS 06/07 - PowerPoint PPT Presentation

0/16 Tree Transducers Niko Paltzer Seminar Formal Grammars WS 06/07 Advisor: Marco Kuhlmann Programming Systems Lab Back Close Outline 1/16 Trees & Tree Transducers Derivations & State-sequences Copying


  1. 0/16 Tree Transducers Niko Paltzer ◭◭ Seminar Formal Grammars WS 06/07 Advisor: Marco Kuhlmann ◮◮ ◭ Programming Systems Lab ◮ Back Close

  2. Outline 1/16 Trees & Tree Transducers Derivations & State-sequences Copying Normal Form Intercalation Lemma ◭◭ ◮◮ ◭ ◮ Back Close

  3. Trees 2/16 Definition Trees are defined over a ranked alphabet Σ . � t ∈ Σ 0 t ∈ T Σ if t = σ ( t 1 . . . t n ) σ ∈ Σ n , t i ∈ T Σ ◭◭ ◮◮ ◭ ◮ Back Close

  4. Trees 2/16 Definition Trees are defined over a ranked alphabet Σ . � t ∈ Σ 0 t ∈ T Σ if t = σ ( t 1 . . . t n ) σ ∈ Σ n , t i ∈ T Σ Example Σ 2 = { σ } Σ 1 = { τ } Σ 0 = { δ } ◭◭ ◮◮ Σ = Σ 2 ∪ Σ 1 ∪ Σ 0 ◭ ◮ Back Close

  5. Trees 2/16 Definition Trees are defined over a ranked alphabet Σ . � t ∈ Σ 0 t ∈ T Σ if t = σ ( t 1 . . . t n ) σ ∈ Σ n , t i ∈ T Σ σ Example Σ 2 = { σ } σ τ Σ 1 = { τ } Σ 0 = { δ } τ δ τ ◭◭ ◮◮ Σ = Σ 2 ∪ Σ 1 ∪ Σ 0 δ δ ◭ ◮ Back Close

  6. Tree Transducers 3/16 Q finite set of states Definition Σ ranked input alphabet M = ( Q, Σ , ∆ , q 0 , R ) ∆ ranked output alphabet q 0 ∈ Q initial state R finite set of rules ◭◭ ◮◮ ◭ ◮ Back Close

  7. Tree Transducers 3/16 Q finite set of states Definition Σ ranked input alphabet M = ( Q, Σ , ∆ , q 0 , R ) ∆ ranked output alphabet q 0 ∈ Q initial state R finite set of rules x j variables Rule Format σ ∈ Σ n τ ∈ ∆ k q ( σ ( x 1 . . . x n )) → τ ( q 1 ( x i 1 ) . . . q k ( x i k )) q, q 1 , . . . , q k ∈ Q ◭◭ ◮◮ ◭ ◮ Back Close

  8. Tree Transducers 3/16 Q finite set of states Definition Σ ranked input alphabet M = ( Q, Σ , ∆ , q 0 , R ) ∆ ranked output alphabet q 0 ∈ Q initial state R finite set of rules x j variables Rule Format σ ∈ Σ n τ ∈ ∆ k q ( σ ( x 1 . . . x n )) → τ ( q 1 ( x i 1 ) . . . q k ( x i k )) q, q 1 , . . . , q k ∈ Q ◭◭ ◮◮ M deterministic ⇔ left-hand sides are disjoint ◭ ◮ Back Close

  9. Example 4/16 Tree Transducer q ( σ ( xy )) → β ( q ( x ) q ( y )) q ( τ ( x )) → β ( q ( x ) q ( x )) M = ( { q } , { σ, τ, δ } , { β, γ } , q, R ) q ( δ ) → γ ◭◭ ◮◮ ◭ ◮ Back Close

  10. Example 4/16 Tree Transducer q ( σ ( xy )) → β ( q ( x ) q ( y )) q ( τ ( x )) → β ( q ( x ) q ( x )) M = ( { q } , { σ, τ, δ } , { β, γ } , q, R ) q ( δ ) → γ σ Input Tree σ τ τ δ τ ◭◭ ◮◮ δ δ ◭ ◮ Back Close

  11. Example - Derivation 5/16 q q ( σ ( xy )) → β ( q ( x ) q ( y )) σ q ( τ ( x )) → β ( q ( x ) q ( x )) q ( δ ) → γ σ τ τ δ τ δ δ ◭◭ ◮◮ ◭ ◮ Back Close

  12. Example - Derivation 5/16 β q ( σ ( xy )) → β ( q ( x ) q ( y )) q q q ( τ ( x )) → β ( q ( x ) q ( x )) q ( δ ) → γ σ τ τ δ τ δ δ ◭◭ ◮◮ ◭ ◮ Back Close

  13. Example - Derivation 5/16 β q ( σ ( xy )) → β ( q ( x ) q ( y )) q β q ( τ ( x )) → β ( q ( x ) q ( x )) q ( δ ) → γ q q τ τ δ τ δ δ ◭◭ ◮◮ ◭ ◮ Back Close

  14. Example - Derivation 5/16 β q ( σ ( xy )) → β ( q ( x ) q ( y )) q β q ( τ ( x )) → β ( q ( x ) q ( x )) q ( δ ) → γ q γ τ τ τ δ δ ◭◭ ◮◮ ◭ ◮ Back Close

  15. Example - Derivation 5/16 β q ( σ ( xy )) → β ( q ( x ) q ( y )) q β q ( τ ( x )) → β ( q ( x ) q ( x )) q ( δ ) → γ β γ τ q q τ δ δ δ ◭◭ ◮◮ ◭ ◮ Back Close

  16. Example - Derivation 5/16 β q ( σ ( xy )) → β ( q ( x ) q ( y )) q β q ( τ ( x )) → β ( q ( x ) q ( x )) q ( δ ) → γ β γ τ q γ τ δ δ ◭◭ ◮◮ ◭ ◮ Back Close

  17. Example - Derivation 5/16 β q ( σ ( xy )) → β ( q ( x ) q ( y )) β β q ( τ ( x )) → β ( q ( x ) q ( x )) q ( δ ) → γ β γ β β γ γ γ γ γ γ ◭◭ ◮◮ ◭ ◮ Back Close

  18. State-sequence 6/16 σ β σ τ β β τ δ τ β γ β β δ δ γ γ γ γ γ γ ◭◭ ◮◮ ◭ ◮ Back Close

  19. State-sequence 6/16 σ 1 β σ 2 τ 2 β β τ 1 δ 2 τ 3 β γ β β δ 1 δ 3 γ γ γ γ γ γ ◭◭ ◮◮ ◭ ◮ Back Close

  20. State-sequence 6/16 σ 1 q σ 1 q σ 2 q τ 2 σ 2 τ 2 q τ 1 q δ 2 q τ 3 q τ 3 τ 1 δ 2 τ 3 δ 1 δ 3 q δ 1 q δ 1 q δ 3 q δ 3 q δ 3 q δ 3 ◭◭ ◮◮ ◭ ◮ Back Close

  21. State-sequence 6/16 σ 1 q σ 1 q σ 2 q τ 2 σ 2 τ 2 〈 q,q 〉 q τ 1 q δ 2 q τ 3 q τ 3 τ 1 δ 2 τ 3 δ 1 δ 3 q δ 1 q δ 1 q δ 3 q δ 3 q δ 3 q δ 3 ◭◭ ◮◮ ◭ ◮ Back Close

  22. State-sequence 6/16 σ 1 〈 q 〉 q σ 1 〈 q 〉 〈 q 〉 q σ 2 q τ 2 σ 2 τ 2 〈 q 〉 δ 2 〈 q 〉 τ 3 〈 q,q 〉 q τ 1 q δ 2 q τ 3 q τ 3 τ 1 δ 1 〈 q,q 〉 δ 3 〈 q,q,q,q 〉 q δ 1 q δ 1 q δ 3 q δ 3 q δ 3 q δ 3 ◭◭ ◮◮ ◭ ◮ Back Close

  23. Copying 7/16 Copying-bound A derivation has copying-bound k if all state-sequences have at most length k . A transducer M has copying-bound k if for all possible output trees there exists a derivation with copying-bound k . ◭◭ ◮◮ ◭ ◮ Back Close

  24. Copying 7/16 Copying-bound A derivation has copying-bound k if all state-sequences have at most length k . A transducer M has copying-bound k if for all possible output trees there exists a derivation with copying-bound k . Finite Copying A transducer M is finite copying if it has some copying-bound ◭◭ k ∈ N . ◮◮ ◭ DT fc ( k ) is the class of deterministic tree transducers with ◮ copying-bound k . Back Close

  25. Copying-bound 8/16 Dynamic The definition of the copying-bound is based on dynamic properties. ◭◭ ◮◮ ◭ ◮ Back Close

  26. Copying-bound 8/16 Dynamic The definition of the copying-bound is based on dynamic properties. Static There exists a possibility to check the copying-bound statically. ◭◭ ◮◮ ◭ ◮ Back Close

  27. Copying Normal Form 9/16 Idea If each state-sequence consists of different states, the number of states is an upper copying-bound. This is only possible if the transducer is finite copying. ◭◭ ◮◮ ◭ ◮ Back Close

  28. Copying Normal Form 9/16 Idea If each state-sequence consists of different states, the number of states is an upper copying-bound. This is only possible if the transducer is finite copying. Algorithm (found in [vV96]) 1. encode state-sequences into new states 2. copy transducer rules for additionally introduced states ◭◭ ◮◮ 3. repeat till fixpoint is reached ◭ ◮ Back Close

  29. Copying Normal Form - Example 10/16 q ( τ ( x )) → β ( r ( x ) s ( x )) q ( δ ) → γ r ( τ ( x )) → β ( s ( x ) s ( x )) r ( δ ) → γ s ( τ ( x )) → α ( s ( x )) s ( δ ) → γ ◭◭ ◮◮ ◭ ◮ Back Close

  30. Copying Normal Form - Example 10/16 q ( τ ( x )) → β ( r ( x ) s ( x )) � q � ( τ ( x )) → β ( � rs � ( x ) � rs � ( x )) q ( δ ) → γ r ( τ ( x )) → β ( s ( x ) s ( x )) r ( δ ) → γ s ( τ ( x )) → α ( s ( x )) s ( δ ) → γ ◭◭ ◮◮ ◭ ◮ Back Close

  31. Copying Normal Form - Example 10/16 q ( τ ( x )) → β ( r ( x ) s ( x )) � q � ( τ ( x )) → β ( � rs � ( x ) � rs � ( x )) q ( δ ) → γ r ( τ ( x )) → β ( s ( x ) s ( x )) � rs � r ( δ ) → γ s ( τ ( x )) → α ( s ( x )) � rs � s ( δ ) → γ ◭◭ ◮◮ ◭ ◮ Back Close

  32. Copying Normal Form - Example 10/16 q ( τ ( x )) → β ( r ( x ) s ( x )) � q � ( τ ( x )) → β ( � rs � ( x ) � rs � ( x )) q ( δ ) → γ � q � ( δ ) → γ r ( τ ( x )) → β ( s ( x ) s ( x )) � rs � r ( δ ) → γ s ( τ ( x )) → α ( s ( x )) � rs � s ( δ ) → γ ◭◭ ◮◮ ◭ ◮ Back Close

  33. Copying Normal Form - Example 10/16 q ( τ ( x )) → β ( r ( x ) s ( x )) � q � ( τ ( x )) → β ( � rs � ( x ) � rs � ( x )) q ( δ ) → γ � q � ( δ ) → γ r ( τ ( x )) → β ( s ( x ) s ( x )) � rs � ( τ ( x )) → β ( � sss � ( x ) � sss � ( x )) r ( δ ) → γ s ( τ ( x )) → α ( s ( x )) � rs � s ( δ ) → γ ◭◭ ◮◮ ◭ ◮ Back Close

  34. Copying Normal Form - Example 10/16 q ( τ ( x )) → β ( r ( x ) s ( x )) � q � ( τ ( x )) → β ( � rs � ( x ) � rs � ( x )) q ( δ ) → γ � q � ( δ ) → γ r ( τ ( x )) → β ( s ( x ) s ( x )) � rs � ( τ ( x )) → β ( � sss � ( x ) � sss � ( x )) r ( δ ) → γ s ( τ ( x )) → α ( s ( x )) � rs � s ( δ ) → γ � sss � ◭◭ � sss � ◮◮ ◭ ◮ Back Close

  35. Copying Normal Form - Example 10/16 q ( τ ( x )) → β ( r ( x ) s ( x )) � q � ( τ ( x )) → β ( � rs � ( x ) � rs � ( x )) q ( δ ) → γ � q � ( δ ) → γ r ( τ ( x )) → β ( s ( x ) s ( x )) � rs � ( τ ( x )) → β ( � sss � ( x ) � sss � ( x )) r ( δ ) → γ � rs � ( δ ) → γ s ( τ ( x )) → α ( s ( x )) � rs � s ( δ ) → γ � sss � ◭◭ � sss � ◮◮ ◭ ◮ Back Close

Recommend


More recommend