Introduction Taxonomie Apprentissage Conclusion Biblio
Transducteurs d’arbres et (peut-ˆetre un peu) apprentissage
A. Lemay
2006
Introduction Taxonomie Apprentissage Conclusion Biblio
Taxonomie des transducteurs d’arbres
Syntax Directed translation (Irons 60)
Attributed Tree Transducers (Knuth 68, F¨ulop 81)
Rational Tree Transductions ”`a TATA” (Tatcher Wright 70) Relabeling Tree Transducers (Engelfriet 75)
Macro Tree Transducers (Engelfriet 80, ...) Tree Walking Transducers (Aho/Ullman 80)
Pebble Tree Transducers (Milo, Suciu, Vianu 2000)
MSO Tree Transducers (Engelfriet 91, Courcelle 92)
+ variantes diverses (Pebble Macro Tree Transducer, . . .)
Introduction Taxonomie Apprentissage Conclusion Biblio
1 Taxonomie des transducteurs d’arbres Syntax Directed Transducers Attributed Tree Transducer MSO Tree transducers Transductions rationnelles Macro Tree Transducers
Tree Walking/Pebble Tree Transducers R´ecapitulatif
2 Apprentissage de transducteurs
Principes G´en´eraux
Introduction Taxonomie Apprentissage Conclusion Biblio
Plan
1 Taxonomie des transducteurs d’arbres Syntax Directed Transducers Attributed Tree Transducer MSO Tree transducers Transductions rationnelles Macro Tree Transducers
Tree Walking/Pebble Tree Transducers R´ecapitulatif
2 Apprentissage de transducteurs
Principes G´en´eraux
Introduction Taxonomie Apprentissage Conclusion Biblio
SD Transducers
Plan
1 Taxonomie des transducteurs d’arbres Syntax Directed Transducers Attributed Tree Transducer MSO Tree transducers Transductions rationnelles Macro Tree Transducers
Tree Walking/Pebble Tree Transducers R´ecapitulatif
2 Apprentissage de transducteurs
Principes G´en´eraux
Introduction Taxonomie Apprentissage Conclusion Biblio
SD Transducers
SD Transducers : d´efinition
D´efinition (informelle)
bas´ee sur une grammaire context-free
( ' Deux grammaires Context-Free en parall`ele) R`egles de la forme : X → aY (1) Y (2) cZ { Y (1) deZY (2) }
tous les non-terminaux se retrouvent dans la production pas de contraintes sur les terminaux
la production se fait en d´eroulant le parse.
Provient des travaux sur les compilateurs (origine ALGOL 60)
Introduction Taxonomie Apprentissage Conclusion Biblio
SD Transducers
SD Transducers : exemple
Passage infixe vers Suffixe
S → E {E } T → T × P {TP×}
E → E + T { ET + } T → T /P { TP/ } E → E − T {ET −} T → P {P}
E → T {T } P → i × P {iP×}
Introduction Taxonomie Apprentissage Conclusion Biblio
SD Transducers
SD Transducers : Conclusion
Conclusion
Int´erˆet historique (vient des la compilation d’ALGOL 60)
Sous-famille de transductions rationnels
Introduction Taxonomie Apprentissage Conclusion Biblio
Attributed Tree Transducer
Plan
1 Taxonomie des transducteurs d’arbres Syntax Directed Transducers Attributed Tree Transducer MSO Tree transducers Transductions rationnelles Macro Tree Transducers
Tree Walking/Pebble Tree Transducers R´ecapitulatif
2 Apprentissage de transducteurs
Principes G´en´eraux
Introduction Taxonomie Apprentissage Conclusion Biblio
Attributed Tree Transducer
Attributed Grammars : Principes
Exemple : parcours dans l’espace
path → ε | step .path step → N | S | O | E
Id´ee : associer des attributs (propri´et´es) aux non terminaux d’une grammaire context-free
Exemple :
quelle est la longueur du chemin en nombre de pas ?
quel est le chemin parcouru sur la coordonn´ee x ou y ?
Introduction Taxonomie Apprentissage Conclusion Biblio
Attributed Tree Transducer
Attributed Grammar : Exemple 1
path .Pos x : Coordonn´ee en x d’un chemin step .Dep x : Coordonn´ee en x d’un pas Grammaire
Grammaire R`egle s´emantique path → ε path .Pos x = 0
path → step .path path .Dep x = step .Dep x + path .Pos x step → N | S step .Dep x = 0
step → O step .Dep x = − 1
step → E step .Dep x = 1
Introduction Taxonomie Apprentissage Conclusion Biblio
Attributed Tree Transducer
Attributed Grammar : Exemple 1
Chemin O. N. E. : path 0 step −1
O
path 1 step 0
N
path 1 step 1
E
path 0
ε 0
Introduction Taxonomie Apprentissage Conclusion Biblio
Attributed Tree Transducer
Attributed Grammar : Exemple 1
Chemin O. N. E. : path 0 step − 1
O
path 1 step 0
N
path 1 step 1
E
path 0 ε 0
+
− 1 +
0 +
1 0
Le calcul des attributs peut se voir comme une transformation
Introduction Taxonomie Apprentissage Conclusion Biblio
Attributed Tree Transducer
Parenth`ese
ATT et requˆete
Requˆete ATT : ATT dont l’un des attributs est bool´een
mˆeme expressivit´e que MSO (Bloem Engelfriet 96)
Introduction Taxonomie Apprentissage Conclusion Biblio
Attributed Tree Transducer
Attributed Grammars : attributs
Deux types d’attributs :
attributs Synth´etis´es (Syn ) : valeur d´ependante des descendants (ici Pos x et Dep x )
attributs h´erit´es (Inh ) : valeur d´ependante des parents ou
des fr`eres (du contexte).
Introduction Taxonomie Apprentissage Conclusion Biblio
Attributed Tree Transducer
Attributed Grammar : exemple 2
Grammaire Infixe vers Suffixe Syn = { a S }
Inh = {a I }
Grammaire R`egle s´emantique S → T S.a S = T .a S
T .a I = ε T → 1 T .a S = 1(T .a I ) T → T 1 + T 2 T .a S = T 1 .a S
T 1 .a I = T 2 .a S
T 2 .a I = +(T .a I )
Introduction Taxonomie Apprentissage Conclusion Biblio
Attributed Tree Transducer
Attributed Grammar : exemple 2
R`egles
S → T S.a
S= T .a
ST → T
1+ T
2T .a
S= T
1.a
ST .a
I= ε T
1.a
I= T
2.a
ST → 1 T .a
S= 1(T .a
I) T
2.a
I= +(T .a
I) Exemple : (1 + 1) + 1 en 1 1 + 1 +
+
A+
B1
D1
E1
CA.a S = B.a S , B.a I = C.a S , C.a I = +(A.a I )
Introduction Taxonomie Apprentissage Conclusion Biblio
Attributed Tree Transducer
Attributed Grammar : exemple 2
R`egles
S → T S.a
S= T .a
ST → T
1+ T
2T .a
S= T
1.a
ST .a
I= ε T
1.a
I= T
2.a
ST → 1 T .a
S= 1(T .a
I) T
2.a
I= +(T .a
I) Exemple : (1 + 1) + 1 en 1 1 + 1 +
+
A+
B1
D1
E1
CA.a S = D.a S , B.a I = C.a S , C.a I = +()
Introduction Taxonomie Apprentissage Conclusion Biblio
Attributed Tree Transducer
Attributed Grammar : exemple 2
R`egles
S → T S.a
S= T .a
ST → T
1+ T
2T .a
S= T
1.a
ST .a
I= ε T
1.a
I= T
2.a
ST → 1 T .a
S= 1(T .a
I) T
2.a
I= +(T .a
I) Exemple : (1 + 1) + 1 en 1 1 + 1 +
+
A+
B1
D1
E1
CA . a S = D . a S , B . a I = C . a S , C . a I = +() B.a S = D.a S , D.a I = E.a S ,
E .a I = +(B.a I )
Introduction Taxonomie Apprentissage Conclusion Biblio
Attributed Tree Transducer
Attributed Grammar : exemple 2
R`egles
S → T S.a
S= T .a
ST → T
1+ T
2T .a
S= T
1.a
ST .a
I= ε T
1.a
I= T
2.a
ST → 1 T .a
S= 1(T .a
I) T
2.a
I= +(T .a
I) Exemple : (1 + 1) + 1 en 1 1 + 1 +
+
A+
B1
D1
E1
CA . a S = D . a S , B . a I = C . a S , C . a I = +() B.a S = D.a S , D.a I = E.a S ,
E .a I = +(C.a S )
Introduction Taxonomie Apprentissage Conclusion Biblio
Attributed Tree Transducer
Attributed Grammar : exemple 2
R`egles
S → T S.a
S= T .a
ST → T
1+ T
2T .a
S= T
1.a
ST .a
I= ε T
1.a
I= T
2.a
ST → 1 T .a
S= 1(T .a
I) T
2.a
I= +(T .a
I) Exemple : (1 + 1) + 1 en 1 1 + 1 +
+
A+
B1
D1
E1
CA . a S = D . a S , B . a I = C . a S , C . a I = +() B.a S = D.a S , D.a I = E.a S ,
E .a I = +(C.a S )
Introduction Taxonomie Apprentissage Conclusion Biblio
Attributed Tree Transducer
Attributed Grammar : exemple 2
R`egles
S → T S.a
S= T .a
ST → T
1+ T
2T .a
S= T
1.a
ST .a
I= ε T
1.a
I= T
2.a
ST → 1 T .a
S= 1(T .a
I) T
2.a
I= +(T .a
I) Exemple : (1 + 1) + 1 en 1 1 + 1 +
+
A+
B1
D1
E1
CA.a S = D.a S , B.a I = C.a S , C.a I = +() B.a S = D.a S , D.a I = E.a S ,
E .a I = +(C.a S )
C.a S = 1(C.a I )
Introduction Taxonomie Apprentissage Conclusion Biblio
Attributed Tree Transducer
Attributed Grammar : exemple 2
R`egles
S → T S.a
S= T .a
ST → T
1+ T
2T .a
S= T
1.a
ST .a
I= ε T
1.a
I= T
2.a
ST → 1 T .a
S= 1(T .a
I) T
2.a
I= +(T .a
I) Exemple : (1 + 1) + 1 en 1 1 + 1 +
+
A+
B1
D1
E1
CA.a S = D.a S , B.a I = C.a S , C.a I = +() B.a S = D.a S , D.a I = E.a S ,
E .a I = +(C.a S )
C.a S = 1(+())
Introduction Taxonomie Apprentissage Conclusion Biblio
Attributed Tree Transducer
Attributed Grammar : exemple 2
R`egles
S → T S.a
S= T .a
ST → T
1+ T
2T .a
S= T
1.a
ST .a
I= ε T
1.a
I= T
2.a
ST → 1 T .a
S= 1(T .a
I) T
2.a
I= +(T .a
I) Exemple : (1 + 1) + 1 en 1 1 + 1 +
+
A+
B1
D1
E1
CA.a S = D.a S , B.a I = 1(+()), C.a I = +() B.a S = D.a S , D.a I = E.a S ,
E .a I = +(C.a S )
C.a S = 1(+())
Introduction Taxonomie Apprentissage Conclusion Biblio
Attributed Tree Transducer
Attributed Grammar : exemple 2
R`egles
S → T S.a
S= T .a
ST → T
1+ T
2T .a
S= T
1.a
ST .a
I= ε T
1.a
I= T
2.a
ST → 1 T .a
S= 1(T .a
I) T
2.a
I= +(T .a
I) Exemple : (1 + 1) + 1 en 1 1 + 1 +
+
A+
B1
D1
E1
CA.a S = D.a S , B.a I = 1(+()), C.a I = +() B.a S = D.a S , D.a I = E.a S ,
E .a I = +(C.a S )
C.a S = 1(+())
Introduction Taxonomie Apprentissage Conclusion Biblio
Attributed Tree Transducer
Attributed Grammar : exemple 2
R`egles
S → T S.a
S= T .a
ST → T
1+ T
2T .a
S= T
1.a
ST .a
I= ε T
1.a
I= T
2.a
ST → 1 T .a
S= 1(T .a
I) T
2.a
I= +(T .a
I) Exemple : (1 + 1) + 1 en 1 1 + 1 +
+
A+
B1
D1
E1
CA.a S = D.a S , B.a I = 1(+()), C.a I = +() B.a S = D.a S , D.a I = E.a S ,
E .a I = +(1(+()))
C.a S = 1(+())
Introduction Taxonomie Apprentissage Conclusion Biblio
Attributed Tree Transducer
Attributed Grammar : exemple 2
R`egles
S → T S.a
S= T .a
ST → T
1+ T
2T .a
S= T
1.a
ST .a
I= ε T
1.a
I= T
2.a
ST → 1 T .a
S= 1(T .a
I) T
2.a
I= +(T .a
I) Exemple : (1 + 1) + 1 en 1 1 + 1 +
+
A+
B1
D1
E1
CA.a S = D.a S , B.a I = 1(+()), C.a I = +() B . a S = D . a S , D . a I = E . a S ,
E .a I = +(1(+()))
C.a S = 1(+())
D.a S = 1(D.a I )
Introduction Taxonomie Apprentissage Conclusion Biblio
Attributed Tree Transducer
Attributed Grammar : exemple 2
R`egles
S → T S.a
S= T .a
ST → T
1+ T
2T .a
S= T
1.a
ST .a
I= ε T
1.a
I= T
2.a
ST → 1 T .a
S= 1(T .a
I) T
2.a
I= +(T .a
I) Exemple : (1 + 1) + 1 en 1 1 + 1 +
+
A+
B1
D1
E1
CA.a S = D.a S , B.a I = 1(+()), C.a I = +() B . a S = D . a S , D . a I = E . a S ,
E .a I = +(1(+()))
C.a S = 1(+())
D.a S = 1(E.a S )
Introduction Taxonomie Apprentissage Conclusion Biblio
Attributed Tree Transducer
Attributed Grammar : exemple 2
R`egles
S → T S.a
S= T .a
ST → T
1+ T
2T .a
S= T
1.a
ST .a
I= ε T
1.a
I= T
2.a
ST → 1 T .a
S= 1(T .a
I) T
2.a
I= +(T .a
I) Exemple : (1 + 1) + 1 en 1 1 + 1 +
+
A+
B1
D1
E1
CA.a S = D.a S , B.a I = 1(+()), C.a I = +() B . a S = D . a S , D . a I = E . a S ,
E .a I = +(1(+()))
C.a S = 1(+())
D.a S = 1(E.a S )
Introduction Taxonomie Apprentissage Conclusion Biblio
Attributed Tree Transducer
Attributed Grammar : exemple 2
R`egles
S → T S.a
S= T .a
ST → T
1+ T
2T .a
S= T
1.a
ST .a
I= ε T
1.a
I= T
2.a
ST → 1 T .a
S= 1(T .a
I) T
2.a
I= +(T .a
I) Exemple : (1 + 1) + 1 en 1 1 + 1 +
+
A+
B1
D1
E1
CA.a S = D.a S , B.a I = 1(+()), C.a I = +() B . a S = 1(E . a S ), D . a I = E . a S ,
E .a I = +(1(+()))
C.a S = 1(+())
D.a S = 1(E.a S )
Introduction Taxonomie Apprentissage Conclusion Biblio
Attributed Tree Transducer
Attributed Grammar : exemple 2
R`egles
S → T S.a
S= T .a
ST → T
1+ T
2T .a
S= T
1.a
ST .a
I= ε T
1.a
I= T
2.a
ST → 1 T .a
S= 1(T .a
I) T
2.a
I= +(T .a
I) Exemple : (1 + 1) + 1 en 1 1 + 1 +
+
A+
B1
D1
E1
CA.a S = 1(E .a S ), B.a I = 1(+()), C.a I = +() B . a S = 1(E . a S ), D . a I = E . a S ,
E .a I = +(1(+()))
C.a S = 1(+())
D.a S = 1(E.a S )
Introduction Taxonomie Apprentissage Conclusion Biblio
Attributed Tree Transducer
Attributed Grammar : exemple 2
R`egles
S → T S.a
S= T .a
ST → T
1+ T
2T .a
S= T
1.a
ST .a
I= ε T
1.a
I= T
2.a
ST → 1 T .a
S= 1(T .a
I) T
2.a
I= +(T .a
I) Exemple : (1 + 1) + 1 en 1 1 + 1 +
+
A+
B1
D1
E1
CA.a S = 1(E .a S ), B.a I = 1(+()), C.a I = +() B.a S = 1(E .a S ), D.a I = E.a S ,
E .a I = +(1(+()))
C.a S = 1(+())
D.a S = 1(E.a S )
E .a S = 1(E.a I )
Introduction Taxonomie Apprentissage Conclusion Biblio
Attributed Tree Transducer
Attributed Grammar : exemple 2
R`egles
S → T S.a
S= T .a
ST → T
1+ T
2T .a
S= T
1.a
ST .a
I= ε T
1.a
I= T
2.a
ST → 1 T .a
S= 1(T .a
I) T
2.a
I= +(T .a
I) Exemple : (1 + 1) + 1 en 1 1 + 1 +
+
A+
B1
D1
E1
CA.a S = 1(E .a S ), B.a I = 1(+()), C.a I = +() B.a S = 1(E .a S ), D.a I = E.a S ,
E .a I = +(1(+()))
C.a S = 1(+())
D.a S = 1(E.a S )
E .a S = 1(+(1(+())))
Introduction Taxonomie Apprentissage Conclusion Biblio
Attributed Tree Transducer
Attributed Grammar : exemple 2
R`egles
S → T S.a
S= T .a
ST → T
1+ T
2T .a
S= T
1.a
ST .a
I= ε T
1.a
I= T
2.a
ST → 1 T .a
S= 1(T .a
I) T
2.a
I= +(T .a
I) Exemple : (1 + 1) + 1 en 1 1 + 1 +
+
A+
B1
D1
E1
CA.a S = 1(E .a S ), B.a I = 1(+()), C.a I = +() B.a S = 1(E .a S ), D.a I = E.a S ,
E .a I = +(1(+())) C.a S = 1(+())
D.a S = 1(1(+(1(+()))))
E .a S = 1(+(1(+())))
Introduction Taxonomie Apprentissage Conclusion Biblio
Attributed Tree Transducer
Attributed Grammar : exemple 2
R`egles
S → T S.a
S= T .a
ST → T
1+ T
2T .a
S= T
1.a
ST .a
I= ε T
1.a
I= T
2.a
ST → 1 T .a
S= 1(T .a
I) T
2.a
I= +(T .a
I) Exemple : (1 + 1) + 1 en 1 1 + 1 +
+
A+
B1
D1
E1
CA.a S = 1(E .a S ), B.a I = 1(+()), C.a I = +() B.a S = 1(1(+(1(+())))), D.a I = E.a S , E .a I = +(1(+()))
C.a S = 1(+())
D.a S = 1(1(+(1(+()))))
E .a S = 1(+(1(+())))
Introduction Taxonomie Apprentissage Conclusion Biblio
Attributed Tree Transducer
Attributed Grammar : exemple 2
R`egles
S → T S.a
S= T .a
ST → T
1+ T
2T .a
S= T
1.a
ST .a
I= ε T
1.a
I= T
2.a
ST → 1 T .a
S= 1(T .a
I) T
2.a
I= +(T .a
I) Exemple : (1 + 1) + 1 en 1 1 + 1 +
+
A+
B1
D1
E1
CA.a S = 1(1(+(1(+())))), B.a I = 1(+()), C.a I = +() B.a S = 1(1(+(1(+())))), D.a I = E.a S ,
E .a I = +(1(+())) C.a S = 1(+())
D.a S = 1(1(+(1(+()))))
E .a S = 1(+(1(+())))
Introduction Taxonomie Apprentissage Conclusion Biblio
Attributed Tree Transducer
ATT (1)
M = h Syn , Inh , Σ, ∆, a 0 , ], Ri
Syn : attributs synth´etis´ees (par le bas) Inh : attributs h´erit´es (par le haut) a 0 : attribut initial (∈ Syn )
] : symbole initial R : r`egles
Id´ee :
les transformations sont des attributs des noeuds
l’arbre de sortie est un attribut de la racine
Syn permet une transformation ascendante
Inh permet une transformation descendante
Note : pas d’´etats
Introduction Taxonomie Apprentissage Conclusion Biblio
Attributed Tree Transducer
ATT (2)
D´efinition
M = h Syn , Inh , Σ, ∆, a 0 , ], R i R`egles de la forme :
a(π) −→
σν pour a ∈ Syn , σ ∈ Σ ∪ { ] } , ν ∈ RHS ∪ {⊥}
b(π
i) −→
σν pour b ∈ Inh , σ ∈ Σ ∪ { ] } , ν ∈ RHS ∪ {⊥}
RHS (Right Hand Side) d´efini sur
∆ ∪ Syn ∪ Inh ∪ { π, π 1 , . . . , π k } :
a ∈ Syn : a(π
i) ∈ RHS (l’attribut a du i -`eme fils)
b ∈ Inh : b(π) ∈ RHS (l’attribut b du p`ere)
σ ∈ ∆ : σ(ν
1, . . . , ν
k) ∈ RHS avec ν
i∈ RHS
Introduction Taxonomie Apprentissage Conclusion Biblio
Attributed Tree Transducer
ATT : exemple
Passage notation infixe vers suffixe Syn = a S , Inh = a I
Grammaire ATT
S → T S.a S = T .a S a S (π) −→ ] a S (π 1 ) T .a I = ε a I (π 1 ) −→ ] end T → 1 T .a S = 1(T .a I ) a S (π) −→ 1 1(a I (π)) T → T 1 + T 2 T . a S = T 1 . a S a S (π) −→ + a S (π 1 )
T 1 .a I = T 2 .a S a I (π 1 ) −→ + a S (π 2 )
T 2 .a I = +, T .a I a I (π 2 ) −→ + +(a I (π))
Introduction Taxonomie Apprentissage Conclusion Biblio
Attributed Tree Transducer
ATT : Conclusion
Attributed Tree Transducer
bas´e sur les attributed grammars : grammaires CFG avec propri´et´e sur les non-terminaux.
l’arbre de sortie est un attribut particulier (parmi d’autres).
Note
ATT top-down : sans attributs h´erit´es.
ATT top-down ( ATT
n-ATT ( (n+1)-ATT
Apprentissage : improbable
Introduction Taxonomie Apprentissage Conclusion Biblio
MSO Tree transducers
Plan
1 Taxonomie des transducteurs d’arbres Syntax Directed Transducers Attributed Tree Transducer MSO Tree transducers Transductions rationnelles Macro Tree Transducers
Tree Walking/Pebble Tree Transducers R´ecapitulatif
2 Apprentissage de transducteurs
Principes G´en´eraux
Introduction Taxonomie Apprentissage Conclusion Biblio
MSO Tree transducers
MSO dans les arbres
formules atomiques : label σ (x ) edge(x , y ) x ∈ X leaf (x) root (x )
MSO1
formules MSO avec une variable libre d´efinit des propri´et´es sur les noeuds utile pour les requˆetes unaires
Exemple : Φ(x ) = { lab f (x ) ∧ ∃ x , edge(y , x ), leaf (x) } Les noeuds ´etiquet´es f dont l’un des fils est une feuille.
MSO2
Deux variables libres Φ(x , y ) : d´efinit des relations entre deux
noeuds
Introduction Taxonomie Apprentissage Conclusion Biblio
MSO Tree transducers
MSO Graph Transducers
D´efinit une fonction partielle τ M : g = (E, V ) → h = (E 0 , V 0 ) Definition (Courcelle 94)
M = h Copy , Φ, Ψ n , Ψ a i avec : Copy : l’ensemble de copie
Φ : formule MSO1 sur Σ (le domaine)
Ψ n c,σ : formule MSO1 (formule des noeuds) d´ependante de c ∈ Copy et σ ∈ ∆
Ψ a c,c
0: formule MSO2 (formule des arcs) d´ependante de
c, c 0 ∈ Copy
Introduction Taxonomie Apprentissage Conclusion Biblio
MSO Tree transducers
MSO Graph Transducers
D´efinit une fonction partielle τ M : g = (E, V ) → h = (E 0 , V 0 ) d´efini si g ∈ Φ
E 0 = {(c, u) | c ∈ Copy , u ∈ V 0 , ψ c,σ n (u)}
V 0 = { ((c , u), (c 0 , u 0 )) | c , c 0 ∈ Copy , u ∈ V 0 , ψ c,c a
0(u , u 0 ) }
Id´ees
Φ est le domaine de la fonction
Copy d´etermine le ”type” des noeuds de h
ψ c,σ n d´efinit quels sont les noeuds de g copi´es de type c et relabell´es par σ
ψ c,c a
0d´efinit quels sont les relations entre noeuds de h
n´ecessaires pour cr´eer une arˆete dans h
Introduction Taxonomie Apprentissage Conclusion Biblio
MSO Tree transducers
MSO Tree Transducers
MSO Tree Transducer
MSO Tree Transducer = MSO Graph Transducer sur les
arbres (en entr´ees/sortie)
Introduction Taxonomie Apprentissage Conclusion Biblio
MSO Tree transducers
MSO-Tree Transducer : Exemple
HTML BODY TABLE
TR TR
TD TEXTE
TD TEXTE
TR
RACINE ID
...
ID
TEXTE TEXTE
Id ...
Copy = { racine, id, nom, prenom }
Introduction Taxonomie Apprentissage Conclusion Biblio
MSO Tree transducers
MSO-Tree Transducer : Exemple
HTML BODY TABLE
TR TR
TD TEXTE
TD TEXTE
TR
RACINE ID
...
ID
TEXTE TEXTE
Id ...
Ψ n racine,RACINE (x ) = (root(x)) Ψ n id ,ID (x) = label TR (x )
Ψ n nom,TEXTE (x ) =
(fils d’un TD premier fils d’un TR)Ψ n prenom,TEXTE (x ) =
(fils d’un TD second fils d’un TR)Introduction Taxonomie Apprentissage Conclusion Biblio
MSO Tree transducers
MSO-Tree Transducer : Exemple
HTML BODY TABLE
TR TR
TD TEXTE
TD TEXTE
TR
RACINE ID
...
ID
TEXTE TEXTE
Id ...
Ψ a racine,id (x , y ) = (true) Ψ a id ,nom (x, y ) =
x est le petit-fils de yΨ a id ,prenom (x , y ) =
x est le petit-fils de yIntroduction Taxonomie Apprentissage Conclusion Biblio
Transductions rationnelles
Plan
1 Taxonomie des transducteurs d’arbres Syntax Directed Transducers Attributed Tree Transducer MSO Tree transducers Transductions rationnelles Macro Tree Transducers
Tree Walking/Pebble Tree Transducers R´ecapitulatif
2 Apprentissage de transducteurs
Principes G´en´eraux
Introduction Taxonomie Apprentissage Conclusion Biblio
Transductions rationnelles
Automate d’Arbres : Notations
M = hQ, Σ, F , δ i
Q : ensemble fini d’´etats
Σ : alphabet ”ranked” (d’entr´ee)
F : ensemble des ´etats finaux (ou initiaux) δ : r`egles de la forme
a → q(a)
f (q
1(x
1), . . . , q
n(x
n)) → q(f (x
1, . . . , x
n)) (pour un ascendant)
Pour les transductions : ∆ est l’alphabet de sortie
Introduction Taxonomie Apprentissage Conclusion Biblio
Transductions rationnelles
Relabeling Tree Transducers
Transducteurs qui changent l’´etiquetage de l’arbre de Σ vers ∆.
´Equivalent aux transducteurs shape-preserving
[Fulop & Gazdag 03 / Gazdag 04]Formes des r`egles a → q(b)
f (q 1 (x 1 ), . . . , q n (x n )) → q(g(x 1 , . . . , x k )) (souvent not´e (f (q 1 , . . . , q n )) → q(g))
Node Selecting Tree Transducers : Relabeling fonctionnels avec Bool comme alphabet de sortie.
Permettent de repr´esenter les requˆetes monadiques r´eguli`eres
(MSO, etc...)
Introduction Taxonomie Apprentissage Conclusion Biblio
Transductions rationnelles
Relabeling : Exemple
a → q 1 (1) a → q 2 (0)
f (q 1 , q 1 ) → q 2 (0) f (q 2 , q 2 ) → q 1 (0) Final = { q 2 }
f a f
a f a a
= ⇒ 0 1 0
0 0
1 1
Introduction Taxonomie Apprentissage Conclusion Biblio
Transductions rationnelles
Relabeling : Conclusion
Avantages
Permettent de repr´esenter les requˆetes monadiques r´eguli`eres (via les NSTT)
Apprenables [ICGI’04]
Limitations
Aucun changement de structure !
Introduction Taxonomie Apprentissage Conclusion Biblio
Transductions rationnelles
Transducteurs d’arbres ”`a TATA”
Formes des r`egles a → q(u)
f (q 1 (x 1 ), . . . , q n (x n )) → q(u) (not´e (f (q 1 , . . . , q n )) → q(u)) avec u ∈ T ∆ ∪ X
Peuvent ˆetre d´eterministes top-down ou bottom-up (en fonction
de l’automate d’arbres support)
Introduction Taxonomie Apprentissage Conclusion Biblio
Transductions rationnelles
Tree Transducers : Exemple
D(+(x
1, x
2)) → +(D(x
1), D(x
2)) D( × (x
1, x
2)) → +( × (D(x
1), I(x
2)),
× (I(x
1), D(x
2))) I ( × (x
1, x
2)) → × (I(x
1), I(x
2)) D(sin(x
1)) → × (cos(I(x
1)), D(x
1))
I (a) → a
I (y ) → y
D(a) → 0
D(y ) → 1
. . .
D sin
×
a y
Calcul de la d´eriv´ee d’une fonction Alphabet : 0, 1, a, y , +, ×, sin, cos
´Etats : D (d´erive), I (identit´e)
Introduction Taxonomie Apprentissage Conclusion Biblio
Transductions rationnelles
Tree Transducers : Exemple
D(+(x
1, x
2)) → +(D(x
1), D(x
2)) D( × (x
1, x
2)) → +( × (D(x
1), I(x
2)),
× (I(x
1), D(x
2))) I ( × (x
1, x
2)) → × (I(x
1), I(x
2)) D(sin(x
1)) → × (cos(I(x
1)), D(x
1))
I (a) → a
I (y ) → y
D(a) → 0
D(y ) → 1
. . .
× cos
I
×
a y
D
×
a y
Calcul de la d´eriv´ee d’une fonction Alphabet : 0, 1, a, y , +, ×, sin, cos
´Etats : D (d´erive), I (identit´e)
Introduction Taxonomie Apprentissage Conclusion Biblio
Transductions rationnelles
Tree Transducers : Exemple
D(+(x
1, x
2)) → +(D(x
1), D(x
2)) D( × (x
1, x
2)) → +( × (D(x
1), I(x
2)),
× (I(x
1), D(x
2))) I ( × (x
1, x
2)) → × (I(x
1), I(x
2)) D(sin(x
1)) → × (cos(I(x
1)), D(x
1))
I (a) → a
I (y ) → y
D(a) → 0
D(y ) → 1
. . .
× cos
×
a y
+
× D a
I y
× I a
D y
Calcul de la d´eriv´ee d’une fonction Alphabet : 0, 1, a, y , +, ×, sin, cos
´Etats : D (d´erive), I (identit´e)
Introduction Taxonomie Apprentissage Conclusion Biblio
Transductions rationnelles
Tree Transducers : Exemple
D(+(x
1, x
2)) → +(D(x
1), D(x
2)) D( × (x
1, x
2)) → +( × (D(x
1), I(x
2)),
× (I(x
1), D(x
2))) I ( × (x
1, x
2)) → × (I(x
1), I(x
2)) D(sin(x
1)) → × (cos(I(x
1)), D(x
1))
I (a) → a
I (y ) → y
D(a) → 0
D(y ) → 1
. . .
× cos
×
a y
+
×
0 y
×
a 1
Calcul de la d´eriv´ee d’une fonction Alphabet : 0, 1, a, y , +, ×, sin, cos
´Etats : D (d´erive), I (identit´e)
Introduction Taxonomie Apprentissage Conclusion Biblio
Transductions rationnelles
Tree Transducers : Conclusion
avantages
changements de structure possible
non-linearit´e (copie), effacement de branches, permutation, ...
Inconv´enients
reste limit´e : difficile de remonter des branches
Introduction Taxonomie Apprentissage Conclusion Biblio
Transductions rationnelles
Variante : avec look-ahead
Composition avec un automate d’arbre
1
L’arbre est lu par un automate d’arbre ascendant
2
les noeuds sont ´etiquet´es par les ´etats du run
3
le nouvel arbre est transform´e par un transducteur descendant
Le processus peut alors ˆetre d´eterministe
Introduction Taxonomie Apprentissage Conclusion Biblio
Transductions rationnelles
Variante : avec alg`ebre de substitution
l’alg`ebre YIELD (ou SUBST) n symboles sp´eciaux α i
Un symbole de substitution SUBST
les α i sont substitu´ees par les arguments de SUBST SUBST
f
a α 2 α 1
b c YIELD →
f
a c b
Transduction vers les trees avec SUBST puis YIELD :
possibilit´e de d´eplacer des branches
Introduction Taxonomie Apprentissage Conclusion Biblio
Macro Tree Transducers
Plan
1 Taxonomie des transducteurs d’arbres Syntax Directed Transducers Attributed Tree Transducer MSO Tree transducers Transductions rationnelles Macro Tree Transducers
Tree Walking/Pebble Tree Transducers R´ecapitulatif
2 Apprentissage de transducteurs
Principes G´en´eraux
Introduction Taxonomie Apprentissage Conclusion Biblio
Macro Tree Transducers
Macro Tree Transducers : Principes
Mˆeme id´ee g´en´eral qu’un transducteur d’arbres mais, utilisation de param`etres (”accumulateurs”) : bouts d’arbres collect´es lors du run
dans une r`egle :
possibilit´e de ”stocker” un bout d’arbre (passer en param`etre)
possibilit´e d’utiliser les arbres stock´es dans les arbres de sortie
Grosso-Modo la mˆeme chose qu’un transducteur avec
alg`ebre de YIELD
Introduction Taxonomie Apprentissage Conclusion Biblio
Macro Tree Transducers
Macro Tree Transducers : Definition
M = h Q, Σ, ∆, I, δ i Formes des r`egles
q(a, y 1 , . . . , y m ) → ξ
q(f(x 1 , . . . , x k ), y 1 , . . . , y m ) → ξ ξ : arbres tel que
σ(t
1, . . . , t
l) ∈ ξ, pour tout σ ∈ ∆, t
j∈ ξ
arbre sur l’alphabet de sortieq(x
i, t
1, . . . , t
l), pour q ∈ Q, x
i∈ X , t
j∈ ξ
copie de sous arbre d’entr ´ee, + accumulationy
i∈ ξ, pour tout y
i∈ Y
copie de param`etreAttention : vision top-down
Note : MTT sans param`etre = transducteur d’arbre top-down
Introduction Taxonomie Apprentissage Conclusion Biblio
Macro Tree Transducers
Macro Tree Transducers : Exemple
Exemple : retirer les multiplications q
0(+(x
1, x
2)) → +(q
0(x
1), q
0(x
2)) q
0(1) → 1
q
0( × (x
1, x
2)) → q(x
1, q
0(x
2))
q(+(x
1, x
2), y
1) → +(q(x
1, y
1), q(x
2, y
1)) q(1, y
1) → y
1q
0( × (x
1, x
2), y
1) → q(x
1, q(x
2, y
1))
q0
× + +
1 1
1 +
1 1
Introduction Taxonomie Apprentissage Conclusion Biblio
Macro Tree Transducers
Macro Tree Transducers : Exemple
Exemple : retirer les multiplications q
0(+(x
1, x
2)) → +(q
0(x
1), q
0(x
2)) q
0(1) → 1
q
0( × (x
1, x
2)) → q(x
1, q
0(x
2))
q(+(x
1, x
2), y
1) → +(q(x
1, y
1), q(x
2, y
1)) q(1, y
1) → y
1q
0( × (x
1, x
2), y
1) → q(x
1, q(x
2, y
1))
q + +
1 1
1
+ q0
1 q0
1
Introduction Taxonomie Apprentissage Conclusion Biblio
Macro Tree Transducers
Macro Tree Transducers : Exemple
Exemple : retirer les multiplications q
0(+(x
1, x
2)) → +(q
0(x
1), q
0(x
2)) q
0(1) → 1
q
0( × (x
1, x
2)) → q(x
1, q
0(x
2))
q(+(x
1, x
2), y
1) → +(q(x
1, y
1), q(x
2, y
1)) q(1, y
1) → y
1q
0( × (x
1, x
2), y
1) → q(x
1, q(x
2, y
1))
+ q +
1 1
+
1 1
q
1 +
1 1
Introduction Taxonomie Apprentissage Conclusion Biblio
Macro Tree Transducers
Macro Tree Transducers : Exemple
Exemple : retirer les multiplications q
0(+(x
1, x
2)) → +(q
0(x
1), q
0(x
2)) q
0(1) → 1
q
0( × (x
1, x
2)) → q(x
1, q
0(x
2))
q(+(x
1, x
2), y
1) → +(q(x
1, y
1), q(x
2, y
1)) q(1, y
1) → y
1q
0( × (x
1, x
2), y
1) → q(x
1, q(x
2, y
1))
+ + +
1 1
+
1 1
+
1 1
Introduction Taxonomie Apprentissage Conclusion Biblio
Macro Tree Transducers
MTT with regular look-ahead MTT R
M = h Q, P, Σ, ∆, I, δ,h i
hQ, Σ, ∆, I, δ, i est un MTT particulier
h P, Σ, h i est un automate d’arbre (l’automate ”look-ahead”
de M) Fonctionnement
On fait un run avec le look-ahead automaton (les noeuds sont ´etiquet´es par les ´etats de P)
Les r`egles du MTT d´ependent des ´etats des fils de l’´etats courants. R`egles de la forme :
hq, σ(p 1 (x 1 ), . . . , p n (x n )) → ξ
Note : MTT R = MTT (Engelfriet Vogler, 85)
Introduction Taxonomie Apprentissage Conclusion Biblio
Tree Walking et Pebble Tr. Tr.
Plan
1 Taxonomie des transducteurs d’arbres Syntax Directed Transducers Attributed Tree Transducer MSO Tree transducers Transductions rationnelles Macro Tree Transducers
Tree Walking/Pebble Tree Transducers R´ecapitulatif
2 Apprentissage de transducteurs
Principes G´en´eraux
Introduction Taxonomie Apprentissage Conclusion Biblio
Tree Walking et Pebble Tr. Tr.
Tree Walking Transducer (1)
Principes :
Bas´e sur la notion de Tree Walking Automaton
les r`egles impliquent un mouvement dans l’arbre d’entr´ee (up / down / stay ) (idem Tree Walking Automata)
les r`egles produisent des bouts d’arbres dans lesquelles il
peut y avoir des branchements multiples (branching)
Introduction Taxonomie Apprentissage Conclusion Biblio
Tree Walking et Pebble Tr. Tr.
Tree Walking Transducer (2)
M = hQ, Σ, ∆, I, Ri R`egles de la forme h q, f i → ξ avec ξ :
hq 0 , stay i
hq 0 , up i (sauf si racine) h q 0 , down i i (i : num´ero du fils)
σ( h q 1 , stay i , . . . , h q k , stay i ) (relabeling + branching)
Introduction Taxonomie Apprentissage Conclusion Biblio
Tree Walking et Pebble Tr. Tr.
TWT : exemple
Exemple : explosion en largeur
M = hQ = {q} , Σ = {a 1 , e 0 } , ∆ = { σ 2 , e 0 } , I = {q} , R} avec R : h q, a i → σ( h q, down 1 i , h q, down 1 i )
h q, e i → e a
a a e
σ
· ·
Introduction Taxonomie Apprentissage Conclusion Biblio
Tree Walking et Pebble Tr. Tr.
TWT : exemple
Exemple : explosion en largeur
M = hQ = {q} , Σ = {a 1 , e 0 } , ∆ = { σ 2 , e 0 } , I = {q} , R} avec R : h q, a i → σ( h q, down 1 i , h q, down 1 i )
h q, e i → e a
a
a e
σ σ
· ·
σ
· ·
Introduction Taxonomie Apprentissage Conclusion Biblio
Tree Walking et Pebble Tr. Tr.
TWT : exemple
Exemple : explosion en largeur
M = hQ = {q} , Σ = {a 1 , e 0 } , ∆ = { σ 2 , e 0 } , I = {q} , R} avec R : h q, a i → σ( h q, down 1 i , h q, down 1 i )
h q, e i → e a
a a e
σ σ
σ σ
σ
σ a
Introduction Taxonomie Apprentissage Conclusion Biblio
Tree Walking et Pebble Tr. Tr.
TWT : exemple
Exemple : explosion en largeur
M = hQ = {q} , Σ = {a 1 , e 0 } , ∆ = { σ 2 , e 0 } , I = {q} , R} avec R : h q, a i → σ( h q, down 1 i , h q, down 1 i )
h q, e i → e a
a a e
a σ
σ e e
σ e e
σ
σ e e
σ
e e
Introduction Taxonomie Apprentissage Conclusion Biblio
Tree Walking et Pebble Tr. Tr.
Pebble Tree Transducer (1)
Pebble = caillou
Pebble Tree Transducer `a n cailloux : n − ptt Principe :
on a n cailloux diff´erents qui peuvent ˆetre d´epos´es sur les noeuds (un de chaque type par noeud au max.)
un vecteur de bool´een sur chaque noeud
les r`egles peuvent d´ependre de la pr´esence de cailloux les r`egles impliquent un mouvement dans l’arbre d’entr´ee (up / down / stay ) (idem Tree Walking Automata)
les r`egles peuvent d´eposer (drop ) ou retirer (lift ) des
cailloux
Introduction Taxonomie Apprentissage Conclusion Biblio
Tree Walking et Pebble Tr. Tr.
Pebble Tree Transducer (2)
M = hQ, Σ, ∆, I, Ri R`egles de la forme
h q, f , b i → ξ avec b vecteur de cailloux (b ∈ { 0, 1 } n ) et ξ : σ( h q 1 , stay i , . . . , h q k , stay i ) (relabeling + branching) hq 0 , stay i
hq 0 , up i (sauf si racine) hq 0 , down i i (i : num´ero du fils) h q 0 , lift l i (l : type de caillou)
h q 0 , drop l i (l : type de caillou, si pr´esent)
Introduction Taxonomie Apprentissage Conclusion Biblio
Tree Walking et Pebble Tr. Tr.
Pebble Tree Transducer (3)
M = h Q, Σ, ∆, I, R i
Forme g´en´eralis´ee (Engelfriet & Maneth) hq, f , bi → ξ avec
b vecteur de cailloux (b ∈ {0, 1} n ),
ξ ∈ T ∆ (Q × { stay , up , down i , lift , drop } )
Introduction Taxonomie Apprentissage Conclusion Biblio Tree Walking et Pebble Tr. Tr.
PTT : exemple
Introduction Taxonomie Apprentissage Conclusion Biblio
Tree Walking et Pebble Tr. Tr.
Pebble Tree Transducer
Notes
0-PTT : appel´es Tree Walking Transducers n-PTT ( (n + 1)-PTT
n-PTT = composition de n + 1 0-PTT n-DPTT (deterministe) ( n-PTT (non-circulaires) 0-DPTT = ATT Inconv´enients
Apprentissage : Improbable (lien entre arbre d’entr´ee et
de sortie peu clair)
Introduction Taxonomie Apprentissage Conclusion Biblio
R´ecapitulatif
Plan
1 Taxonomie des transducteurs d’arbres Syntax Directed Transducers Attributed Tree Transducer MSO Tree transducers Transductions rationnelles Macro Tree Transducers
Tree Walking/Pebble Tree Transducers R´ecapitulatif
2 Apprentissage de transducteurs
Principes G´en´eraux
Introduction Taxonomie Apprentissage Conclusion Biblio
R´ecapitulatif
R´ecapitulatif
Compilation SD Transducers
Transducteurs d’arbres attribu´es Automates d’arbres Relabeling
Transductions rationnelles Macro Tree Transducers Tree Walking Tree Walking Transducers
Pebble Tree Transducers
MSO MSO Tree Transducers
Introduction Taxonomie Apprentissage Conclusion Biblio
R´ecapitulatif
R´ecapitulatif : Expressivit´e
Expressivit´e des diff´erents mod`eles
RTT SDT
TT MTT
surRMSO − TT ATT
surRMTT = MTT
R0 − PTT = TWT ATT MTT
n+1n − PTT = TWT
n+1MTT
∗PTT
∗ATT: Attributed Tree Transducer RTT: Relabeling Tree Transducer SDT: Syntax Directed Transducer PTT: Pebble tree transducer TWT: Tree Walking Tree Transducer MTT: Macro tree Transducers MSO-TT: Monadic Second Order Tree Transducer