applications of tree automata theory lecture i tree
play

Applications of Tree Automata Theory Lecture I: Tree Automata - PowerPoint PPT Presentation

Applications of Tree Automata Theory Lecture I: Tree Automata Andreas Maletti Institute of Computer Science Universitt Leipzig, Germany on leave from: Institute for Natural Language Processing Universitt Stuttgart, Germany


  1. Local Tree Grammar LTG G = ( N , Q , S , P ) Definition (Generated tree language) L ( G ) contains exactly the trees t ∈ T N ( Q ) root label in S t ( ε ) ∈ S t ( w ) → t ( w . 1 ) · · · t ( w . k ) ∈ P for every internal node w ∈ pos ( t ) with { i ∈ N | w . i ∈ pos ( t ) } = { 1 , . . . , k } � = ∅ “label → child labels” is a production of G t ( w ) ∈ Q for all w ∈ leaves ( t ) leaves labeled by Q Lecture I: Tree Automata A. Maletti 19 ·

  2. Local Tree Grammar Observation LTGs generate exactly the parse forests of CFGs Lecture I: Tree Automata A. Maletti 20 ·

  3. Local Tree Grammar Observation LTGs generate exactly the parse forests of CFGs Theorem Local tree languages (LTL) are generated by LTGs closed under CFL (strings) LTL (trees) union intersection (rank-bounded) complement relabeling Lecture I: Tree Automata A. Maletti 20 ·

  4. Local Tree Grammar Observation LTGs generate exactly the parse forests of CFGs Theorem Local tree languages (LTL) are generated by LTGs closed under CFL (strings) LTL (trees) union ✓ intersection (rank-bounded) complement relabeling Lecture I: Tree Automata A. Maletti 20 ·

  5. Local Tree Grammar Observation LTGs generate exactly the parse forests of CFGs Theorem Local tree languages (LTL) are generated by LTGs closed under CFL (strings) LTL (trees) union ✓ intersection ✗ (rank-bounded) complement relabeling Lecture I: Tree Automata A. Maletti 20 ·

  6. Local Tree Grammar Observation LTGs generate exactly the parse forests of CFGs Theorem Local tree languages (LTL) are generated by LTGs closed under CFL (strings) LTL (trees) union ✓ intersection ✗ (rank-bounded) complement ✗ relabeling Lecture I: Tree Automata A. Maletti 20 ·

  7. Local Tree Grammar Observation LTGs generate exactly the parse forests of CFGs Theorem Local tree languages (LTL) are generated by LTGs closed under CFL (strings) LTL (trees) union ✓ intersection ✗ (rank-bounded) complement ✗ relabeling ✓ Lecture I: Tree Automata A. Maletti 20 ·

  8. Local Tree Grammar Observation LTGs generate exactly the parse forests of CFGs Theorem Local tree languages (LTL) are generated by LTGs closed under CFL (strings) LTL (trees) union ✓ ✗ intersection ✗ (rank-bounded) complement ✗ relabeling ✓ Lecture I: Tree Automata A. Maletti 20 ·

  9. Local Tree Grammar Observation LTGs generate exactly the parse forests of CFGs Theorem Local tree languages (LTL) are generated by LTGs closed under CFL (strings) LTL (trees) union ✓ ✗ intersection ✗ ✓ (rank-bounded) complement ✗ relabeling ✓ Lecture I: Tree Automata A. Maletti 20 ·

  10. Local Tree Grammar Observation LTGs generate exactly the parse forests of CFGs Theorem Local tree languages (LTL) are generated by LTGs closed under CFL (strings) LTL (trees) union ✓ ✗ intersection ✗ ✓ (rank-bounded) complement ✗ ✗ relabeling ✓ Lecture I: Tree Automata A. Maletti 20 ·

  11. Local Tree Grammar Observation LTGs generate exactly the parse forests of CFGs Theorem Local tree languages (LTL) are generated by LTGs closed under CFL (strings) LTL (trees) union ✓ ✗ intersection ✗ ✓ (rank-bounded) complement ✗ ✗ relabeling ✓ ✗ Lecture I: Tree Automata A. Maletti 20 ·

  12. Local Tree Grammar Observation LTGs generate exactly the parse forests of CFGs Properties ✓ simple ✓ no ambiguity (unique explanation for each generated tree) ✗ not closed under (most) B OOLEAN operations (union/intersection/complement: ✗ / ✓ / ✗ ) ✗ not closed under (non-injective) relabelings ✗ . . . Lecture I: Tree Automata A. Maletti 20 ·

  13. Local Tree Grammar LTG G = ( N , Q , S , P ) No ambiguity S NP VP PRP$ NN VBZ My dog sleeps is in L ( G ) if and only if 1 S is a start nonterminal 2 all the productions in it are in P 3 all leaves are labeled by elements of Q Lecture I: Tree Automata A. Maletti 21 ·

  14. Local Tree Grammar Observation Local tree languages are not closed under union Proof. The following single-element tree languages are local: S S NP VP NP VP PRP VBD ADVP PRP$ NN VBZ I scored RB My dog sleeps well But their union is not local as it must also generate trees for and My dog scored well *I sleeps Lecture I: Tree Automata A. Maletti 22 ·

  15. Tree Language How to represent a set of trees? enumerate them enumerate them cleverly (packed forest) parse forest of a CFG (local tree languages) Lecture I: Tree Automata A. Maletti 23 ·

  16. Tree Language How to represent a set of trees? enumerate them enumerate them cleverly (packed forest) parse forest of a CFG (local tree languages) Lecture I: Tree Automata A. Maletti 23 ·

  17. Tree Language How to represent a set of trees? enumerate them enumerate them cleverly (packed forest) parse forest of a CFG (local tree languages) tree substitution grammar Lecture I: Tree Automata A. Maletti 23 ·

  18. Local Tree Grammar CFG production L → R 1 R 2 R 3 represented by tree L R 1 R 2 R 3 “Glue” fragments together to obtain larger trees: S NP VP PRP MD VP We must VB PP NP Lecture I: Tree Automata A. Maletti 24 ·

  19. Local Tree Grammar CFG production L → R 1 R 2 R 3 represented by tree L R 1 R 2 R 3 “Glue” fragments together to obtain larger trees: S NP VP PRP MD VP We must VB PP NP Lecture I: Tree Automata A. Maletti 24 ·

  20. Local Tree Grammar CFG production L → R 1 R 2 R 3 represented by tree L R 1 R 2 R 3 “Glue” fragments together to obtain larger trees: S NP VP PRP MD VP We must VB PP NP Lecture I: Tree Automata A. Maletti 24 ·

  21. Local Tree Grammar CFG production L → R 1 R 2 R 3 represented by tree L R 1 R 2 R 3 “Glue” fragments together to obtain larger trees: S NP VP PRP MD VP We must VB PP NP Lecture I: Tree Automata A. Maletti 24 ·

  22. Local Tree Grammar CFG production L → R 1 R 2 R 3 represented by tree L R 1 R 2 R 3 “Glue” fragments together to obtain larger trees: S NP VP PRP MD VP We must VB PP NP Lecture I: Tree Automata A. Maletti 24 ·

  23. Local Tree Grammar CFG production L → R 1 R 2 R 3 represented by tree L R 1 R 2 R 3 “Glue” fragments together to obtain larger trees: S NP VP PRP MD VP We must VB PP NP Lecture I: Tree Automata A. Maletti 24 ·

  24. Local Tree Grammar CFG production L → R 1 R 2 R 3 represented by tree L R 1 R 2 R 3 “Glue” fragments together to obtain larger trees: S NP VP PRP MD VP We must VB PP NP Lecture I: Tree Automata A. Maletti 24 ·

  25. Local Tree Grammar CFG production L → R 1 R 2 R 3 represented by tree L R 1 R 2 R 3 “Glue” fragments together to obtain larger trees: S NP VP PRP MD VP We must VB PP NP But why only small tree fragments? Lecture I: Tree Automata A. Maletti 24 ·

  26. Tree Substitution Grammar Definition (J OSHI 1969) A tree substitution grammar (TSG) is a tuple ( N , Q , S , P ) finite set N nonterminals finite set Q terminals start nonterminals S ⊆ N finite set P ⊆ T N ( Q ) \ Q tree fragments Lecture I: Tree Automata A. Maletti 25 ·

  27. Tree Substitution Grammar Definition (J OSHI 1969) A tree substitution grammar (TSG) is a tuple ( N , Q , S , P ) finite set N nonterminals finite set Q terminals start nonterminals S ⊆ N finite set P ⊆ T N ( Q ) \ Q tree fragments Typical fragments [P OST 2011] VP S S VBD NP PP NP VP NP VP CD TO VP PRP Lecture I: Tree Automata A. Maletti 25 ·

  28. Tree Substitution Grammar TSG G = ( N , Q , S , P ) and sentential forms ξ, ζ ∈ T N ( Q ) Definition ξ ⇒ G ζ if there exist a tree fragment t ∈ P and a position w ∈ leaves ( ξ ) such that ξ = ξ [ t ( ε )] w and ζ = ξ [ t ] w Lecture I: Tree Automata A. Maletti 26 ·

  29. Tree Substitution Grammar TSG G = ( N , Q , S , P ) and sentential forms ξ, ζ ∈ T N ( Q ) Definition ξ ⇒ G ζ if there exist a tree fragment t ∈ P and a position w ∈ leaves ( ξ ) such that ξ = ξ [ t ( ε )] w and ζ = ξ [ t ] w Intuition In a derivation step: 1 Find a leaf labeled by n ∈ N 2 Find a fragment t ∈ P such that t ( ε ) = n 3 Replace selected n by t Lecture I: Tree Automata A. Maletti 26 ·

  30. Tree Substitution Grammar Example Fragments: S ( NP , VP ) NP ( PRP ) VP ( MD , VP ) PRP ( We ) VP ( VB , PP , NP ) MD ( must ) S NP VP PRP MD VP We must VB PP NP Lecture I: Tree Automata A. Maletti 27 ·

  31. Tree Substitution Grammar Example Fragments: S ( NP , VP ) NP ( PRP ) VP ( MD , VP ) PRP ( We ) VP ( VB , PP , NP ) MD ( must ) S NP VP PRP MD VP We must VB PP NP Lecture I: Tree Automata A. Maletti 27 ·

  32. Tree Substitution Grammar Example Fragments: S ( NP , VP ) NP ( PRP ) VP ( MD , VP ) PRP ( We ) VP ( VB , PP , NP ) MD ( must ) S NP VP PRP MD VP We must VB PP NP Lecture I: Tree Automata A. Maletti 27 ·

  33. Tree Substitution Grammar Example Fragments: S ( NP , VP ) NP ( PRP ) VP ( MD , VP ) PRP ( We ) VP ( VB , PP , NP ) MD ( must ) S NP VP PRP MD VP We must VB PP NP Lecture I: Tree Automata A. Maletti 27 ·

  34. Tree Substitution Grammar Example Fragments: S ( NP , VP ) NP ( PRP ) VP ( MD , VP ) PRP ( We ) VP ( VB , PP , NP ) MD ( must ) S NP VP PRP MD VP We must VB PP NP Lecture I: Tree Automata A. Maletti 27 ·

  35. Tree Substitution Grammar Example Fragments: S ( NP , VP ) NP ( PRP ) VP ( MD , VP ) PRP ( We ) VP ( VB , PP , NP ) MD ( must ) S NP VP PRP MD VP We must VB PP NP Lecture I: Tree Automata A. Maletti 27 ·

  36. Tree Substitution Grammar Example Fragments: S ( NP , VP ) NP ( PRP ) VP ( MD , VP ) PRP ( We ) VP ( VB , PP , NP ) MD ( must ) S NP VP PRP MD VP We must VB PP NP Lecture I: Tree Automata A. Maletti 27 ·

  37. Tree Substitution Grammar Example Fragments: S ( NP , VP ) NP ( PRP ) VP ( MD , VP ) PRP ( We ) VP ( VB , PP , NP ) MD ( must ) S NP VP PRP MD VP We must VB PP NP Lecture I: Tree Automata A. Maletti 27 ·

  38. Tree Substitution Grammar Example Fragments: S ( NP , VP ) NP ( PRP ) VP ( MD , VP ) PRP ( We ) VP ( VB , PP , NP ) MD ( must ) S NP VP PRP MD VP We must VB PP NP Lecture I: Tree Automata A. Maletti 27 ·

  39. Tree Substitution Grammar Example Fragments: S ( NP , VP ) NP ( PRP ) VP ( MD , VP ) PRP ( We ) VP ( VB , PP , NP ) MD ( must ) S NP VP PRP MD VP We must VB PP NP Lecture I: Tree Automata A. Maletti 27 ·

  40. Tree Substitution Grammar Example Fragments: S ( NP , VP ) NP ( PRP ) VP ( MD , VP ) PRP ( We ) VP ( VB , PP , NP ) MD ( must ) S NP VP PRP MD VP We must VB PP NP Lecture I: Tree Automata A. Maletti 27 ·

  41. Tree Substitution Grammar Example Fragments: S ( NP , VP ) NP ( PRP ) VP ( MD , VP ) PRP ( We ) VP ( VB , PP , NP ) MD ( must ) S NP VP PRP MD VP We must VB PP NP Lecture I: Tree Automata A. Maletti 27 ·

  42. Tree Substitution Grammar Example Fragments: S ( NP , VP ) NP ( PRP ) VP ( MD , VP ) PRP ( We ) VP ( VB , PP , NP ) MD ( must ) S NP VP PRP MD VP We must VB PP NP Lecture I: Tree Automata A. Maletti 27 ·

  43. Tree Substitution Grammar Example Fragments: S ( NP , VP ) NP ( PRP ) VP ( MD , VP ) PRP ( We ) VP ( VB , PP , NP ) MD ( must ) S NP VP PRP MD VP We must VB PP NP Lecture I: Tree Automata A. Maletti 27 ·

  44. Tree Substitution Grammar Example Fragments: S ( NP , VP ) NP ( PRP ) VP ( MD , VP ) PRP ( We ) VP ( VB , PP , NP ) MD ( must ) S NP VP PRP MD VP We must VB PP NP Lecture I: Tree Automata A. Maletti 27 ·

  45. Tree Substitution Grammar Example Fragments: S ( NP , VP ) NP ( PRP ) VP ( MD , VP ) PRP ( We ) VP ( VB , PP , NP ) MD ( must ) S NP VP PRP MD VP We must VB PP NP Lecture I: Tree Automata A. Maletti 27 ·

  46. Tree Substitution Grammar Example Fragments: S ( NP , VP ) NP ( PRP ) VP ( MD , VP ) PRP ( We ) VP ( VB , PP , NP ) MD ( must ) S NP VP PRP MD VP We must VB PP NP Lecture I: Tree Automata A. Maletti 27 ·

  47. Tree Substitution Grammar Example Fragments: S ( NP , VP ) NP ( PRP ) VP ( MD , VP ) PRP ( We ) VP ( VB , PP , NP ) MD ( must ) S NP VP PRP MD VP We must VB PP NP Lecture I: Tree Automata A. Maletti 27 ·

  48. Tree Substitution Grammar Example Fragments: S ( NP , VP ) NP ( PRP ) VP ( MD , VP ) PRP ( We ) VP ( VB , PP , NP ) MD ( must ) S NP VP PRP MD VP We must VB PP NP Lecture I: Tree Automata A. Maletti 27 ·

  49. Tree Substitution Grammar TSG G = ( N , Q , S , P ) Definition for all n ∈ N : L ( G , n ) = { t ∈ T N ( Q ) | ∀ w ∈ leaves ( t ): t ( w ) ∈ Q , n ⇒ ∗ G t } L ( G ) = � s ∈ S L ( G , s ) Lecture I: Tree Automata A. Maletti 28 ·

  50. Tree Substitution Grammar TSG G = ( N , Q , S , P ) and TSL = { L ( G ) | G TSG } Definition for all n ∈ N : L ( G , n ) = { t ∈ T N ( Q ) | ∀ w ∈ leaves ( t ): t ( w ) ∈ Q , n ⇒ ∗ G t } L ( G ) = � s ∈ S L ( G , s ) Theorem 1 FIN � TSL all finite languages are TSL Lecture I: Tree Automata A. Maletti 28 ·

  51. Tree Substitution Grammar TSG G = ( N , Q , S , P ) and TSL = { L ( G ) | G TSG } Definition for all n ∈ N : L ( G , n ) = { t ∈ T N ( Q ) | ∀ w ∈ leaves ( t ): t ( w ) ∈ Q , n ⇒ ∗ G t } L ( G ) = � s ∈ S L ( G , s ) Theorem 1 FIN � TSL all finite languages are TSL 2 LTL � TSL all local tree languages are TSL Lecture I: Tree Automata A. Maletti 28 ·

  52. Tree Substitution Grammar Theorem Tree substitution languages (TSL) have the following properties: closed under CFL LTL TSL union ✓ ✗ intersection ✗ ✓ (rank-bounded) complement ✗ ✗ relabeling ✓ ✗ Lecture I: Tree Automata A. Maletti 29 ·

  53. Tree Substitution Grammar Theorem Tree substitution languages (TSL) have the following properties: closed under CFL LTL TSL union ✓ ✗ ✗ intersection ✗ ✓ (rank-bounded) complement ✗ ✗ relabeling ✓ ✗ Lecture I: Tree Automata A. Maletti 29 ·

  54. Tree Substitution Grammar Theorem Tree substitution languages (TSL) have the following properties: closed under CFL LTL TSL union ✓ ✗ ✗ intersection ✗ ✓ ✗ (rank-bounded) complement ✗ ✗ relabeling ✓ ✗ Lecture I: Tree Automata A. Maletti 29 ·

  55. Tree Substitution Grammar Theorem Tree substitution languages (TSL) have the following properties: closed under CFL LTL TSL union ✓ ✗ ✗ intersection ✗ ✓ ✗ (rank-bounded) complement ✗ ✗ ✗ relabeling ✓ ✗ Lecture I: Tree Automata A. Maletti 29 ·

  56. Tree Substitution Grammar Theorem Tree substitution languages (TSL) have the following properties: closed under CFL LTL TSL union ✓ ✗ ✗ intersection ✗ ✓ ✗ (rank-bounded) complement ✗ ✗ ✗ relabeling ✓ ✗ ✗ Lecture I: Tree Automata A. Maletti 29 ·

  57. Tree Substitution Grammar Properties ✓ simple ✓ more expressive than local tree grammars ✗ ambiguity (several explanations for a generated tree) ✗ not closed under B OOLEAN operations (union/intersection/complement: ✗ / ✗ / ✗ ) ✗ not closed under (non-injective) relabelings ✗ . . . Lecture I: Tree Automata A. Maletti 30 ·

  58. Tree Substitution Grammar Theorem Tree substitution languages are not closed under union Proof. Counterexample must be infinite � artificial example S S a C b C C C a b L 1 = { S ( C n ( a ) , a ) | n ∈ N } L 2 = { S ( C n ( b ) , b ) | n ∈ N } Their union is not a tree substitution language Lecture I: Tree Automata A. Maletti 31 ·

  59. Tree Substitution Grammar Theorem Tree substitution languages are not closed under intersection Proof. Ideas? Lecture I: Tree Automata A. Maletti 32 ·

  60. Tree Language How to represent a set of trees? enumerate them enumerate them cleverly (packed forest) parse forest of a CFG (local tree languages) tree substitution grammar regular tree grammar Lecture I: Tree Automata A. Maletti 33 ·

  61. Regular Tree Grammar Definition (B RAINERD , 1969) A regular tree grammar (RTG) is a tuple G = ( N , Σ , S , P ) with finite set N nonterminals finite set Σ terminals start nonterminals S ⊆ N finite set P ⊆ N × T Σ ( N ) productions Remark Instead of ( n , t ) we write n → t Lecture I: Tree Automata A. Maletti 34 ·

  62. Regular Tree Grammar Example N = { n 0 , n 1 , n 2 , n 3 , n 4 , n 5 , n 6 } Σ = { VP , NP , S , . . . } S = { n 0 } and the following productions: VP S S n 4 → n 5 NP n 3 n 0 → NP n 4 n 0 → n 6 VP n 2 n 1 n 2 n 4 Lecture I: Tree Automata A. Maletti 35 ·

  63. Regular Tree Grammar RTG G = ( N , Σ , S , P ) and sentential forms ξ, ζ ∈ T Σ ( N ) Definition (Derivation Semantics) ξ ⇒ G ζ if there exist a production n → t ∈ P and a position w ∈ leaves ( ξ ) such that ξ = ξ [ n ] w and ζ = ξ [ t ] w Lecture I: Tree Automata A. Maletti 36 ·

  64. Regular Tree Grammar RTG G = ( N , Σ , S , P ) and sentential forms ξ, ζ ∈ T Σ ( N ) Definition (Derivation Semantics) ξ ⇒ G ζ if there exist a production n → t ∈ P and a position w ∈ leaves ( ξ ) such that ξ = ξ [ n ] w and ζ = ξ [ t ] w Definition (Recognized tree language) L ( G ) = { t ∈ T Σ | ∃ s ∈ S : s ⇒ ∗ G t } Lecture I: Tree Automata A. Maletti 36 ·

  65. Regular Tree Grammar Productions VP S S n 4 → n 5 NP n 3 n 0 → NP n 0 → VP n 4 n 6 n 2 n 1 n 2 n 4 Derivation: S S NP VP n 0 ⇒ G ⇒ G NP n 4 n 1 n 5 NP n 3 n 1 n 2 Lecture I: Tree Automata A. Maletti 37 ·

  66. Regular Tree Grammar Productions VP S S n 4 → n 5 NP n 3 n 0 → NP n 0 → VP n 4 n 6 n 2 n 1 n 2 n 4 Derivation: S S NP VP n 0 ⇒ G ⇒ G NP n 4 n 1 n 5 NP n 3 n 1 n 2 Lecture I: Tree Automata A. Maletti 37 ·

Recommend


More recommend