tree automata as algebras minimisation and determinisation
play

Tree Automata as Algebras: Minimisation and Determinisation Tobias - PowerPoint PPT Presentation

Tree Automata as Algebras: Minimisation and Determinisation Tobias Kapp e Jurriaan Rot Gerco van Heerdt Matteo Sammartino Alexandra Silva University College London June 3, 2019 1 / 17 DFAs: nice diagrams a b b a a b 2 / 17 Tree


  1. Tree Automata as Algebras: Minimisation and Determinisation Tobias Kapp´ e Jurriaan Rot Gerco van Heerdt Matteo Sammartino Alexandra Silva University College London June 3, 2019 1 / 17

  2. DFAs: nice diagrams a b b a a b 2 / 17

  3. Tree automata: no nice diagrams Transitions originate from multiple states Automaton reads trees rather than words Alphabet Γ with arities ar: Γ → N Sets I , O Tree automaton ( Q , { δ γ } γ ∈ Γ , i , o ) ◮ transitions δ γ : Q ar( γ ) → Q ◮ initial states i : I → Q ◮ output o : Q → O DFAs: every γ has arity 1 3 / 17

  4. Tree automata: no nice diagrams :( Transitions originate from multiple states Automaton reads trees rather than words Alphabet Γ with arities ar: Γ → N Sets I , O Tree automaton ( Q , { δ γ } γ ∈ Γ , i , o ) ◮ transitions δ γ : Q ar( γ ) → Q ◮ initial states i : I → Q ◮ output o : Q → O DFAs: every γ has arity 1 3 / 17

  5. Example I = { a , b } Γ = {•} , ar( • ) = 2 O = { 0 , 1 } 4 / 17

  6. Example I = { a , b } Γ = {•} , ar( • ) = 2 O = { 0 , 1 } Q = { q a , q b , q 1 , q ⊥ } i ( a ) = q a i ( b ) = q b δ • ( q a , q b ) = q 1 δ • ( q a , q 1 ) = q a δ • ( q 1 , q b ) = q b δ • ( − ) = q ⊥ o ( q a ) = o ( q b ) = o ( q ⊥ ) = 0 o ( q 1 ) = 1 4 / 17

  7. Example I = { a , b } Γ = {•} , ar( • ) = 2 O = { 0 , 1 } Q = { q a , q b , q 1 , q ⊥ } q 1 • • i ( a ) = q a i ( b ) = q b q a q a q a q b a • δ • ( q a , q b ) = q 1 q 1 q b q b q b δ • ( q a , q 1 ) = q a • b δ • ( q 1 , q b ) = q b δ • ( − ) = q ⊥ q a q a q b q b a b o ( q a ) = o ( q b ) = o ( q ⊥ ) = 0 o ( q 1 ) = 1 4 / 17

  8. Example I = { a , b } Γ = {•} , ar( • ) = 2 O = { 0 , 1 } Q = { q a , q b , q 1 , q ⊥ } q 1 • • i ( a ) = q a i ( b ) = q b q a q a q a q b a • δ • ( q a , q b ) = q 1 q 1 q b q b q b δ • ( q a , q 1 ) = q a • b δ • ( q 1 , q b ) = q b δ • ( − ) = q ⊥ q a q a q b q b a b o ( q a ) = o ( q b ) = o ( q ⊥ ) = 0 o ( q 1 ) = 1 4 / 17

  9. Example I = { a , b } Γ = {•} , ar( • ) = 2 O = { 0 , 1 } Q = { q a , q b , q 1 , q ⊥ } q 1 • • i ( a ) = q a i ( b ) = q b q a q a q a q b a • δ • ( q a , q b ) = q 1 q 1 q b q b q b δ • ( q a , q 1 ) = q a • b δ • ( q 1 , q b ) = q b δ • ( − ) = q ⊥ q a q a q b q b a b o ( q a ) = o ( q b ) = o ( q ⊥ ) = 0 o ( q 1 ) = 1 4 / 17

  10. Example I = { a , b } Γ = {•} , ar( • ) = 2 O = { 0 , 1 } Q = { q a , q b , q 1 , q ⊥ } q 1 • • i ( a ) = q a i ( b ) = q b q a q a q a q b a • δ • ( q a , q b ) = q 1 q 1 q b q b q b δ • ( q a , q 1 ) = q a • b δ • ( q 1 , q b ) = q b δ • ( − ) = q ⊥ q a q a q b q b a b o ( q a ) = o ( q b ) = o ( q ⊥ ) = 0 o ( q 1 ) = 1 4 / 17

  11. Example I = { a , b } Γ = {•} , ar( • ) = 2 O = { 0 , 1 } Q = { q a , q b , q 1 , q ⊥ } q 1 • • i ( a ) = q a i ( b ) = q b q a q a q a q b a • δ • ( q a , q b ) = q 1 q 1 q b q b q b δ • ( q a , q 1 ) = q a • b δ • ( q 1 , q b ) = q b δ • ( − ) = q ⊥ q a q a q b q b a b o ( q a ) = o ( q b ) = o ( q ⊥ ) = 0 o ( q 1 ) = 1 4 / 17

  12. Example I = { a , b } Γ = {•} , ar( • ) = 2 O = { 0 , 1 } Q = { q a , q b , q 1 , q ⊥ } q 1 • • i ( a ) = q a i ( b ) = q b q a q a q a q b a • δ • ( q a , q b ) = q 1 q 1 q b q b q b δ • ( q a , q 1 ) = q a • b δ • ( q 1 , q b ) = q b δ • ( − ) = q ⊥ q a q a q b q b a b o ( q a ) = o ( q b ) = o ( q ⊥ ) = 0 o ( q 1 ) = 1 4 / 17

  13. Example I = { a , b } Γ = {•} , ar( • ) = 2 O = { 0 , 1 } Q = { q a , q b , q 1 , q ⊥ } q 1 • • i ( a ) = q a i ( b ) = q b q a q a q a q b a • δ • ( q a , q b ) = q 1 q 1 q b q b q b δ • ( q a , q 1 ) = q a • b δ • ( q 1 , q b ) = q b δ • ( − ) = q ⊥ q a q a q b q b a b o ( q a ) = o ( q b ) = o ( q ⊥ ) = 0 o ( q 1 ) = 1 4 / 17

  14. Example I = { a , b } Γ = {•} , ar( • ) = 2 O = { 0 , 1 } Q = { q a , q b , q 1 , q ⊥ } q 1 • i ( a ) = q a i ( b ) = q b q a q a q a q b a • δ • ( q a , q b ) = q 1 q 1 q b q b q b δ • ( q a , q 1 ) = q a • b δ • ( q 1 , q b ) = q b δ • ( − ) = q ⊥ q a q a q b q b a b o ( q a ) = o ( q b ) = o ( q ⊥ ) = 0 o ( q 1 ) = 1 4 / 17

  15. Example I = { a , b } Γ = {•} , ar( • ) = 2 O = { 0 , 1 } Q = { q a , q b , q 1 , q ⊥ } q 1 • i ( a ) = q a i ( b ) = q b q a q a q a q b a • δ • ( q a , q b ) = q 1 q 1 q b q b q b δ • ( q a , q 1 ) = q a • b δ • ( q 1 , q b ) = q b δ • ( − ) = q ⊥ q a q a q b q b a b o ( q a ) = o ( q b ) = o ( q ⊥ ) = 0 o ( q 1 ) = 1 4 / 17

  16. Tree automata as functor algebras Tree automata over Γ can be seen as algebras for signature endofunctor X ar( γ ) � Σ X = γ ∈ Γ (together with initial states and output) Free Σ-algebra with generators X written Σ ⋄ X ◮ trees over the signature with additional X constants Σ ⋄ forms a monad 5 / 17

  17. Tree language Given: tree automaton ( Q , δ, i , o ), δ : Σ Q → Q i reach → Q extends to reachability map Σ ⋄ I I − − − − → Q reach → Q o Accepted language is L Q = Σ ⋄ I − − − − → O In general, a language is a morphism Σ ⋄ I → O 6 / 17

  18. Minimality of DFAs: nice diagram 2 A ∗ × A A ∗ × A Q × A c ∂ δ reach obs 2 A ∗ A ∗ Q ε ε ? o i 1 2 Reachable: reach surjective Observable: obs injective Minimal: reachable + observable 7 / 17

  19. Minimality of tree automata: no nice diagram reach Reachable: Σ ⋄ I − − − → Q surjective Minimal: final among automata that ◮ are reachable and ◮ accept the same language Minimisation of an automaton: final quotient automaton q Q ′ Q u q ′ Q ′′ Minimisations of reachable automata are minimal 8 / 17

  20. Minimality of tree automata: no nice diagram :( reach Reachable: Σ ⋄ I − − − → Q surjective Minimal: final among automata that ◮ are reachable and ◮ accept the same language Minimisation of an automaton: final quotient automaton q Q ′ Q u q ′ Q ′′ Minimisations of reachable automata are minimal 8 / 17

  21. Minimisation via cobase Automaton ( Q , δ, i , o ) Complete lattice on quotients C c c ≤ c ′ ⇐ ⇒ Q ∃ f c ′ C ′ Minimisation: gfp of monotone operator involving cobase δ c Σ Q Q C ∃ g Σ c ′ Σ c ′ Σ C ′ ∃ h Σ d Σ u 9 / 17

  22. Minimisation via cobase Automaton ( Q , δ, i , o ) Complete lattice on quotients C c c ≤ c ′ ⇐ ⇒ Q ∃ f c ′ C ′ Minimisation: gfp of monotone operator involving cobase δ c Σ Q Q C ∃ g Σ c ′ Σ c ′ Σ C ′ ∃ h Σ d Σ u Σ D 9 / 17

  23. DFAs as monad algebras Q × A δ → Q extends to Q × A ∗ δ ∗ − − → Q δ ∗ monoid action = ⇒ bijective correspondence algebra for monad ( − ) × A ∗ Unit X → X × A ∗ by empty word Multiplication X × A ∗ × A ∗ → X × A ∗ by concatenation 10 / 17

  24. Automata based on monad algebras Given objects I and O and a monad T , we can define automata TQ δ Q o i I O where δ is a T -algebra i ♯ − → Q Reachability map: TI i ♯ → Q o − − → O Language: TI 11 / 17

  25. Automata based on monad algebras DFA case: Q × A ∗ δ Q i o 1 2 where δ is a monoid action 1 × A ∗ i ♯ Reachability map: − → Q 1 × A ∗ i ♯ → Q o Language: − − → 2 11 / 17

  26. Nerode equivalence: classic Used to find minimal automaton Given language L : A ∗ → 2, R = { ( u , v ) ∈ A ∗ × A ∗ | ∀ w ∈ A ∗ . L ( uw ) = L ( vw ) } Largest relation making this diagram commute: p 2 × id A ∗ × A ∗ R × A ∗ concat A ∗ p 1 × id L concat L A ∗ × A ∗ A ∗ 2 12 / 17

  27. Nerode equivalence: classic Used to find minimal automaton Given language L : A ∗ → 2, R = { ( u , v ) ∈ A ∗ × A ∗ | ∀ w ∈ A ∗ . L ( uw ) = L ( vw ) } Largest relation making this diagram commute: p 2 × id 1 × A ∗ × A ∗ R × A ∗ µ 1 × A ∗ p 1 × id L µ L 1 × A ∗ × A ∗ 1 × A ∗ 2 12 / 17

  28. Nerode equivalence: abstract ∃ R , p 1 , p 2 s.t. Tp 2 TR TTI µ Tp 1 TI L µ L TTI TI O and if ∃ S , q 1 , q 2 s.t. Tq 2 TS TTI S µ q 1 q 2 then Tq 1 TI u p 1 p 2 L TI R TI µ L TTI TI O Theorem: Nerode equivalence ⇐ ⇒ minimal automaton 13 / 17

  29. Nerode equivalence: syntactic congruence I = A , T = ( − ) ∗ , µ X : ( X ∗ ) ∗ → X ∗ flattens Given L : A ∗ → 2, R instantiates to the largest relation s.t. ( u 1 , v 1 ) , . . . , ( u n , v n ) ∈ R L ( u 1 · · · u n ) = L ( v 1 · · · v n ) or equivalently (syntactic congruence) w , x ∈ A ∗ ( u , v ) ∈ R L ( wux ) = L ( wvx ) Minimal automaton: syntactic monoid 14 / 17

  30. Nerode equivalence in Set Exists for any finitary monad ◮ Equivalence under contexts T ( I + 1) ◮ Element of 1 is a hole where trees can be plugged in 15 / 17

  31. Plans: learning Tree automata learning algorithms exist ◮ But not modulo equations ◮ Pomset automata Axiomatisation of semantic object 16 / 17

  32. Further paper overview Nominal tree automata ◮ Abstraction ◮ Parse trees for λ -terms Relations between notions of minimality ◮ Minimal, minimisation, simple Determinisation (lifting Kleisli adjunction) ◮ Nondeterministic (nominal) tree automata ◮ Multiplicity/weighted tree automata 17 / 17

Recommend


More recommend