Relating Tree Series Transducers and Weighted Tree Automata Andreas Maletti December 17, 2004 1. Motivation and Introductory Example 2. Semirings and DM-Monoids 3. Bottom-Up DM-Monoid Weighted Tree Automata 4. Establishing a Relationship 1 December 17, 2004
Generalisation Hierarchy tree series transducer τ : T Σ − → A � � T ∆ � � weighted tree weighted transducer tree transducer automaton τ : Σ ∗ − � ∆ ∗ � τ : T Σ − → B � � T ∆ � � → A � � L ∈ A � � T Σ � � generalized weighted automaton tree automaton sequential machine � Σ ∗ � L ∈ B � � T Σ � � L ∈ A � � τ : Σ ∗ − � ∆ ∗ � → B � � string automaton � Σ ∗ � L ∈ B � � Introduction 2 December 17, 2004
Known Relations and Problems • String-based: Theorem: Every gsm-mapping can be computed by a weighted automaton. Proof Idea: Extend monoid (∆ ∗ , ◦ , ε ) to semiring ( P (∆ ∗ ) , ∪ , ◦ , ∅ , { ε } ) Theorem: Weighted transductions can be computed by weighted automata. • Tree-based: Problem: Are tree transductions computable by weighted tree automata ? Problem: Are tree series transformations computable by weighted tree automata ? Introduction 3 December 17, 2004
Tree Pattern Matching A deterministic (bottom-up) tree automaton matching the pattern σ ( α, x ) σ σ σ P σ σ σ α ⊥ σ σ α β If pattern found, accepts tree. Otherwise reject. Introduction 4 December 17, 2004
Extended Tree Pattern Matching Towards a deterministic (bottom-up) weighted tree automaton computing an occurrence of pattern σ ( α, x ) σ/ ? σ/ 1 P σ/ 1 σ/ 2 σ/ 2 σ/ε ⊥ α σ/ε σ/ε α/ε β/ε Introduction 5 December 17, 2004
Extended Tree Pattern Matching A deterministic tree transducer computing the occurrences of pattern σ ( α, x ) σ/ 1 x 1 +2 x 2 P σ/ 1 x 1 σ/ 1 x 1 σ/ε +2 x 2 σ/ 2 x 2 σ/ε ⊥ α σ/ε σ/ε α/ε β/ε Computes the set of occurrences of σ ( α, x ) in input tree. Introduction 6 December 17, 2004
Complete Monoids • A = ( A, � ) complete monoid, iff (C1) � i ∈{ j } a i = a j , (C2) � j ∈ J ( � i ∈ I j a i ) = � i ∈ I a i , if I = � j ∈ J I j is a partition. • A naturally ordered, iff ⊑ is partial order a ⊑ b ⇐ ⇒ ( ∃ c ∈ A ) : a ⊕ c = b • A continuous, iff A naturally ordered and complete and � � a i ⊑ a ⇐ ⇒ a i ⊑ a for all finite E ⊆ I i ∈ I i ∈ E Semirings and DM-Monoids 7 December 17, 2004
Semirings • ( A, ⊕ , ⊙ , 0 , 1 ) semiring, iff (i) ( A, ⊕ , 0 ) commutative monoid, (ii) ( A, ⊙ , 1 ) monoid, (iii) 0 absorbing element with respect to ⊙ , and (iv) ⊙ (left and right) distributes over ⊕ . • ( A, ⊙ , 0 , 1 , � ) complete semiring, iff (S1) ( A, ⊕ , ⊙ , 0 , 1 ) semiring, (S2) ( A, � ) complete monoid, and (S3) a ⊙ ( � i ∈ I a i ) = � i ∈ I ( a ⊙ a i ) and ( � i ∈ I a i ) ⊙ a = � i ∈ I ( a i ⊙ a ) . Semirings and DM-Monoids 8 December 17, 2004
Examples of Semirings • complete natural numbers semiring N ∞ = ( N ∪ {∞} , + , · , 0 , 1) , • tropical semiring Trop = ( N ∪ {∞} , min , + , ∞ , 0) , • Boolean semiring B = ( {⊥ , ⊤} , ∨ , ∧ , ⊥ , ⊤ ) , • formal language semiring Lang Σ = ( P (Σ ∗ ) , ∪ , ◦ , ∅ , { ε } ) Semiring commutative complete naturally ordered continuous yes yes yes yes N ∞ Trop yes yes yes yes yes yes yes yes B Lang Σ NO yes yes yes Semirings and DM-Monoids 9 December 17, 2004
Excursion: Tree Series ( A, � ) complete monoid, Σ ranked alphabet, and X k = { x 1 , . . . , x k } . • Tree series is mapping ψ : T Σ ( X k ) − → A • A � � T Σ ( X k ) � � set of all tree series • Sum ( � i ∈ I ψ i , t ) = � i ∈ I ( ψ i , t ) � , � ) complete monoid • ( A � � T Σ ( X k ) � ( A, ⊙ , 0 , 1 , � ) complete semiring • Tree series substiution of ψ 1 , . . . , ψ k ∈ A � � T Σ � � into ψ ∈ A � � T Σ ( X k ) � � is � � � � ψ ← − ( ψ 1 , . . . , ψ k ) = ( ψ, t ) ⊙ ( ψ i , t i ) t [ t 1 , . . . , t k ] t ∈ T Σ ( X k ) , i ∈ [ k ] ( ∀ i ∈ [ k ]): t i ∈ T Σ Semirings and DM-Monoids 10 December 17, 2004
Complete DM-Monoids ( D, � ) complete monoid, Ω ranked set • ( D, Ω , � ) distributive multi-operator monoid (DM-monoid), iff � � � ω ( d i 1 , . . . , d i k ) = ω ( d i 1 , . . . , d i k ) . i 1 ∈ I 1 i k ∈ I k ( ∀ j ∈ [ k ]): i j ∈ I j Examples: • ( A, ⊙ , � ) complete semiring, Ω ( k ) = { a ( k ) | a ∈ A } with a ( k ) ( d 1 , . . . , d k ) = a ⊙ d 1 ⊙ · · · ⊙ d k Then ( A, Ω , � ) complete DM-monoid • ( A, ⊙ , 0 , 1 , � ) complete semiring, Ω ( k ) = { ψ ( k ) | ψ ∈ A � � T ∆ ( X k ) � � } with ψ ( k ) ( ψ 1 , . . . , ψ k ) = ψ ← − ( ψ 1 , . . . , ψ k ) � , Ω , � ) complete DM-monoid Then ( A � � T ∆ � Semirings and DM-Monoids 11 December 17, 2004
DM-Monoid Weighted Tree Automata — Syntax Σ ranked alphabet, I , Ω non-empty sets • Tree representation over I , Σ , and Ω is µ = ( µ k | k ∈ N ) such that → Ω I × I k µ k : Σ ( k ) − • M = ( I, Σ , D , F, µ ) (bottom-up) DM-monoid weighted tree automaton (DM-wta), iff – I non-empty set of states, – Σ ranked alphabet of input symbols, – D = ( D, Ω , � ) complete DM-monoid , – F : I − → Ω (1) final weight map, and I × I k – µ tree representation over I , Σ , and Ω such that µ k : Σ ( k ) − → Ω ( k ) DM-Monoid Weighted Tree Automata 12 December 17, 2004
DM-Monoid Weighted Tree Automata — Semantics D = ( D, Ω , � ) complete DM-monoid, M = ( I, Σ , D , F, µ ) DM-wta. → D I by • Define h µ : T Σ − � � � h µ ( σ ( t 1 , . . . , t k )) i = µ k ( σ ) i, ( i 1 ,...,i k ) h µ ( t 1 ) i 1 , . . . , h µ ( t k ) i k i 1 ,...,i k ∈ I • ( � M � , t ) = � i ∈ I F i ( h µ ( t ) i ) is tree series recognized by M DM-Monoid Weighted Tree Automata 13 December 17, 2004
Example DM-wta • Σ = { σ, α } and Ω = { ω, id , 1 } and ω ( n 1 , n 2 ) = 1 + max( n 1 , n 2 ) , • N = ( N ∪ {∞} , Ω , min) complete DM-monoid • DM-wta M E = ( { ⋆ } , Σ , N , F, µ ) with F ⋆ = id , µ 0 ( α ) ⋆ = 1 , and µ 2 ( σ ) ⋆, ( ⋆,⋆ ) = ω 1 + max( x 1 , x 2 ) ω σ ⋆ ω 1 1 + max( x 1 , x 2 ) σ α ⋆ ⋆ 1 α σ ω ⋆ ⋆ 1 1 + max( x 1 , x 2 ) 1 α α ⋆ ⋆ 1 1 1 1 • ( � M E � , t ) = height( t ) DM-Monoid Weighted Tree Automata 14 December 17, 2004
Weighted Tree Automata & Tree Series Transducers M = ( I, Σ , D , F, µ ) DM-wta and ( A, ⊙ , 0 , 1 , � ) complete semiring • M is weighted tree automaton (wta), iff D = ( A, Ω , � ) with Ω ( k ) = { a ( k ) | a ∈ A } and a ( k ) ( d 1 , . . . , d k ) = a ⊙ d 1 ⊙ · · · ⊙ d k � , Ω , � ) with • M is tree series transducer (tst), iff D = ( A � � T ∆ � Ω ( k ) = { ψ ( k ) | ψ ∈ A � � T ∆ ( X k ) � � } and ψ ( k ) ( ψ 1 , . . . , ψ k ) = ψ ← − ( ψ 1 , . . . , ψ k ) DM-Monoid Weighted Tree Automata 15 December 17, 2004
Constructing a Monoid (I) ( D, Ω , � ) complete DM-monoid, Ω X = { ω ( x 1 , . . . , x k ) | k ∈ N , ω ∈ Ω ( k ) } Theorem: There exists monoid ( B, ← , ε ) such that D ∪ Ω X ⊆ B and for all d 1 , . . . , d k ∈ D ω ( d 1 , . . . , d k ) = ω ( x 1 , . . . , x k ) ← d 1 ← · · · ← d k . Proof sketch: Let Ω ′ = Ω ∪ D . • Define h : T Ω ′ ( X ) − → T Ω ′ ( X ) for every v ∈ D ∪ X by h ( v ) = v , if h ( t 1 ) , . . . , h ( t k ) ∈ D ω ( h ( t 1 ) , . . . , h ( t k )) h ( ω ( t 1 , . . . , t k )) = ω ( h ( t 1 ) , . . . , h ( t k )) , otherwise • � T Ω ′ ( X n ) set of X n -contexts • h ( t ) ∈ � T Ω ′ ( X n ) iff t ∈ � T Ω ′ ( X n ) Establishing a Relationship 16 December 17, 2004
Constructing a Monoid (II) • Let s � t � = s [ t, x k +1 , x k +2 , . . . , x k + n − 1 ] for s ∈ � T Σ ( X n ) and t ∈ � T Σ ( X k ) (non-identifying tree substitution). • B = D ∗ ∪ � + D ∗ · � T Ω ′ ( X n ) . n ∈ N • Define ← : B 2 − → B for every a ∈ D ∗ , b ∈ B , s ∈ � T Ω ′ ( X n ) , t ∈ D ∪ � T Ω ′ ( X n ) by a ← b = a · b a · s ← ε a · s = a · s ← t · b = a · ( h ( s � t � )) ← b. • ( B, ← , ε ) is a monoid. • ω ( d 1 , . . . , d k ) = ω ( x 1 , . . . , x k ) ← d 1 ← · · · ← d k . Establishing a Relationship 17 December 17, 2004
From a Monoid to a Semiring (I) A = ( A, ⊙ , 0 , 1 , � ) complete semiring, DM-monoid ( D, Ω , � ) complete semimodule of A • Lift mapping ← : B 2 − � 2 − → B to a mapping ← : A � � B � → A � � B � � by � � � ψ 1 ← ψ 2 = ( ψ 1 , b 1 ) ⊙ ( ψ 2 , b 2 ) ( b 1 ← b 2 ) . b 1 ,b 2 ∈ B � (summed in D ) by � : A � • Define sum of a series ϕ ∈ A � � D � � D � � − → D � � ϕ = ( ϕ, d ) · d. d ∈ D • Theorem: (i) � ( � i ∈ I ϕ i ) = � � ϕ i for every family ( ϕ i | i ∈ I ) of series and i ∈ I (ii) ω ( � ϕ 1 , . . . , � ϕ k ) = �� � ω ( x 1 , . . . , x k ) ← ϕ 1 ← · · · ← ϕ k . Establishing a Relationship 18 December 17, 2004
Recommend
More recommend