a type system for weighted automata and rational...
TRANSCRIPT
![Page 1: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/1.jpg)
A Type System for Weighted Automataand Rational Expressions
Akim Demaille1, Alexandre Duret-Lutz1, Sylvain Lombardy2,Luca Saiu1,3, Jacques Sakarovitch3
1EPITA/LRDE, 2LaBRI, Universite de Bordeaux, 3LTCI, CNRS / Telecom-ParisTech
http://vaucanson.lrde.epita.frhttp://vaucanson-project.org
CIAA 2014; August, 1st 2014(2014-08-03 00:28:28 +0200 a998c33)
![Page 2: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/2.jpg)
Vaucanson
General-purpose platform for weighted automata and transducers.
Genericity
Acceptors and transducersRational expressionsWeights: Boolean, Usual, Tropical. . .Labels: letter, word, ε. . .Letters: chars, ints. . .
Performance
C++ templated libraryNo dynamic polymorphism (virtual)Efficient algorithms and data structures
Flexibility
A dynamic API on top of the templated libraryA dynamic type system for automata, rational expressions, etc.An interactive GUI on top of IPython
2 / 22
![Page 3: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/3.jpg)
Vaucanson
General-purpose platform for weighted automata and transducers.
Genericity
Acceptors and transducersRational expressionsWeights: Boolean, Usual, Tropical. . .Labels: letter, word, ε. . .Letters: chars, ints. . .
Performance
C++ templated libraryNo dynamic polymorphism (virtual)Efficient algorithms and data structures
Flexibility
A dynamic API on top of the templated libraryA dynamic type system for automata, rational expressions, etc.An interactive GUI on top of IPython
2 / 22
![Page 4: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/4.jpg)
Vaucanson
General-purpose platform for weighted automata and transducers.
Genericity
Acceptors and transducersRational expressionsWeights: Boolean, Usual, Tropical. . .Labels: letter, word, ε. . .Letters: chars, ints. . .
Performance
C++ templated libraryNo dynamic polymorphism (virtual)Efficient algorithms and data structures
Flexibility
A dynamic API on top of the templated libraryA dynamic type system for automata, rational expressions, etc.An interactive GUI on top of IPython
2 / 22
![Page 5: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/5.jpg)
Vaucanson
General-purpose platform for weighted automata and transducers.
Genericity
Acceptors and transducersRational expressionsWeights: Boolean, Usual, Tropical. . .Labels: letter, word, ε. . .Letters: chars, ints. . .
Performance
C++ templated libraryNo dynamic polymorphism (virtual)Efficient algorithms and data structures
Flexibility
A dynamic API on top of the templated libraryA dynamic type system for automata, rational expressions, etc.An interactive GUI on top of IPython
2 / 22
![Page 6: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/6.jpg)
Typing Automata and Rational Expressions
1 Typing Automata and Rational Expressions
2 A Calculus on Types
3 Use in Vaucanson
3 / 22
![Page 7: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/7.jpg)
From Recognizers to Weighted Automata
a
b
b
a
b
> ∧> ∨ > ∧> = >
bb
→ >
a
b
b
〈2〉a
〈2〉b
1× 1 + 2× 1 = 3
bb
→ 3
4 / 22
![Page 8: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/8.jpg)
From Recognizers to Weighted Automata
a
b
b
a
b
> ∧>
∨ > ∧> = >
bb
→ >
a
b
b
〈2〉a
〈2〉b
1× 1 + 2× 1 = 3
bb
→ 3
4 / 22
![Page 9: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/9.jpg)
From Recognizers to Weighted Automata
a
b
b
a
b
> ∧>
∨
> ∧>
= >
bb
→ >
a
b
b
〈2〉a
〈2〉b
1× 1 + 2× 1 = 3
bb
→ 3
4 / 22
![Page 10: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/10.jpg)
From Recognizers to Weighted Automata
a
b
b
a
b
> ∧> ∨ > ∧> = > bb → >
a
b
b
〈2〉a
〈2〉b
1× 1 + 2× 1 = 3
bb
→ 3
4 / 22
![Page 11: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/11.jpg)
From Recognizers to Weighted Automata
a
b
b
a
b
> ∧> ∨ > ∧> = > bb → >
a
b
b
〈2〉a
〈2〉b
1× 1 + 2× 1 = 3
bb
→ 3
4 / 22
![Page 12: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/12.jpg)
From Recognizers to Weighted Automata
a
b
b
a
b
> ∧> ∨ > ∧> = > bb → >
a
b
b
〈2〉a
〈2〉b
1× 1
+ 2× 1 = 3
bb
→ 3
4 / 22
![Page 13: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/13.jpg)
From Recognizers to Weighted Automata
a
b
b
a
b
> ∧> ∨ > ∧> = > bb → >
a
b
b
〈2〉a
〈2〉b
1× 1 + 2× 1
= 3
bb
→ 3
4 / 22
![Page 14: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/14.jpg)
From Recognizers to Weighted Automata
a
b
b
a
b
> ∧> ∨ > ∧> = > bb → >
a
b
b
〈2〉a
〈2〉b
1× 1 + 2× 1 = 3 bb → 3
4 / 22
![Page 15: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/15.jpg)
Many Different Kinds of Weights
〈B,∨,∧〉〈Z,+,×〉〈Q,+,×〉〈R,+,×〉〈Z,min,+〉Rational expressions
Tuples
. . .
5 / 22
![Page 16: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/16.jpg)
Many Different Kinds of Labels
lettersa, b
nullablesε, a
wordsε, a, bb
tuples(a, x), (b, y)
(a, x , u), (b, yy , ε)
6 / 22
![Page 17: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/17.jpg)
Many Different Kinds of Labels
lettersa, b
nullablesε, a
wordsε, a, bb
tuples(a, x), (b, y)
(a, x , u), (b, yy , ε)
6 / 22
![Page 18: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/18.jpg)
Many Different Kinds of Labels
lettersa, b
nullablesε, a
wordsε, a, bb
tuples(a, x), (b, y)
(a, x , u), (b, yy , ε)
6 / 22
![Page 19: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/19.jpg)
Many Different Kinds of Labels
lettersa, b
nullablesε, a
wordsε, a, bb
tuples(a, x), (b, y)
(a, x , u), (b, yy , ε)
6 / 22
![Page 20: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/20.jpg)
Contexts
context ::= labelset → weightset
{a, b} → Ba, b (ε + a + b)∗
{a, b, c}? → Z〈2〉 〈4〉ε, 〈2〉b 〈2〉(〈−2〉a + b)∗
{a, b, c} × {x , y , z}∗ → Q〈5
7〉 (a, xx), 〈23〉(b, y) 〈1
2〉(a, x) + 〈13〉(b, y)∗
{a, b} → RatE[{x , y} → Q]
〈x〉 〈〈23〉x
∗〉b (〈x〉a + 〈〈1
3〉(x + y)∗〉b)∗
7 / 22
![Page 21: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/21.jpg)
Contexts
context ::= labelset → weightset
{a, b} → Ba, b (ε + a + b)∗
{a, b, c}? → Z〈2〉 〈4〉ε, 〈2〉b 〈2〉(〈−2〉a + b)∗
{a, b, c} × {x , y , z}∗ → Q〈5
7〉 (a, xx), 〈23〉(b, y) 〈1
2〉(a, x) + 〈13〉(b, y)∗
{a, b} → RatE[{x , y} → Q]
〈x〉 〈〈23〉x
∗〉b (〈x〉a + 〈〈1
3〉(x + y)∗〉b)∗
7 / 22
![Page 22: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/22.jpg)
Contexts
context ::= labelset → weightset
{a, b} → Ba, b (ε + a + b)∗
{a, b, c}? → Z〈2〉 〈4〉ε, 〈2〉b 〈2〉(〈−2〉a + b)∗
{a, b, c} × {x , y , z}∗ → Q〈5
7〉 (a, xx), 〈23〉(b, y) 〈1
2〉(a, x) + 〈13〉(b, y)∗
{a, b} → RatE[{x , y} → Q]
〈x〉 〈〈23〉x
∗〉b (〈x〉a + 〈〈1
3〉(x + y)∗〉b)∗
7 / 22
![Page 23: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/23.jpg)
Contexts
context ::= labelset → weightset
{a, b} → Ba, b (ε + a + b)∗
{a, b, c}? → Z〈2〉 〈4〉ε, 〈2〉b 〈2〉(〈−2〉a + b)∗
{a, b, c} × {x , y , z}∗ → Q〈5
7〉 (a, xx), 〈23〉(b, y) 〈1
2〉(a, x) + 〈13〉(b, y)∗
{a, b} → RatE[{x , y} → Q]
〈x〉 〈〈23〉x
∗〉b (〈x〉a + 〈〈1
3〉(x + y)∗〉b)∗
7 / 22
![Page 24: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/24.jpg)
A Calculus on Types
1 Typing Automata and Rational Expressions
2 A Calculus on Types
3 Use in Vaucanson
8 / 22
![Page 25: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/25.jpg)
Subtyping
A <: B
All values of type A are also values of type B
roughly, “A ⊆ B”
9 / 22
![Page 26: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/26.jpg)
Labelsets and Weightsets Subtypes
{ε} <: A? A <: A? A? <: A∗
With A,B alphabets such that A ⊆ B:
A <: B A? <: B? A∗ <: B∗
B <: N <: Z <: Q <: RB <: Zmin
L <: RatE[L→W ] W <: RatE[L→W ]
10 / 22
![Page 27: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/27.jpg)
Labelsets and Weightsets Subtypes
{ε} <: A? A <: A? A? <: A∗
With A,B alphabets such that A ⊆ B:
A <: B A? <: B? A∗ <: B∗
B <: N <: Z <: Q <: RB <: Zmin
L <: RatE[L→W ] W <: RatE[L→W ]
10 / 22
![Page 28: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/28.jpg)
Labelsets and Weightsets Subtypes
{ε} <: A? A <: A? A? <: A∗
With A,B alphabets such that A ⊆ B:
A <: B A? <: B? A∗ <: B∗
B <: N <: Z <: Q <: RB <: Zmin
L <: RatE[L→W ] W <: RatE[L→W ]
10 / 22
![Page 29: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/29.jpg)
Labelsets and Weightsets Subtypes
{ε} <: A? A <: A? A? <: A∗
With A,B alphabets such that A ⊆ B:
A <: B A? <: B? A∗ <: B∗
B <: N <: Z <: Q <: RB <: Zmin
L <: RatE[L→W ] W <: RatE[L→W ]
10 / 22
![Page 30: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/30.jpg)
Subtype On Contexts, Expressions and Automata
L1 <: L2 W1 <: W2
(L1 →W1) <: (L2 →W2)
C1 <: C2
RatE[C1] <: RatE[C2]
C1 <: C2
Aut[C1] <: Aut[C2]
11 / 22
![Page 31: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/31.jpg)
Labelset Subtypes
Let A,B be alphabets:
A B
A ∩ B
A ∪ B
A? B?
(A ∩ B)?
(A ∪ B)?
A∗ B∗
(A ∩ B)∗
(A ∪ B)∗
{ε}
12 / 22
![Page 32: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/32.jpg)
Meet and Join
V1 ∨ V2 (join)The least upper bound between V1 and V2.
V1 ∧ V2 (meet)The greatest lower bound between V1 and V2.
Q ∨ RatE[{x , y , z} → B] = RatE[{x , y , z} → Q]
{a, b, c} ∧ {a, b, d} = {a, b}
13 / 22
![Page 33: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/33.jpg)
Meet and Join
V1 ∨ V2 (join)The least upper bound between V1 and V2.
V1 ∧ V2 (meet)The greatest lower bound between V1 and V2.
Q ∨ RatE[{x , y , z} → B] = RatE[{x , y , z} → Q]
{a, b, c} ∧ {a, b, d} = {a, b}
13 / 22
![Page 34: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/34.jpg)
Meet and Join
V1 ∨ V2 (join)The least upper bound between V1 and V2.
V1 ∧ V2 (meet)The greatest lower bound between V1 and V2.
Q ∨ RatE[{x , y , z} → B] = RatE[{x , y , z} → Q]
{a, b, c} ∧ {a, b, d} = {a, b}
13 / 22
![Page 35: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/35.jpg)
Union of Automata
A1 : L1 →W1 A2 : L2 →W2
A1 ∪ A2 : L1 ∨ L2 →W1 ∨W2
A1 : {a, b, c} → Q A2 : {a, b, d} → RatE[{x , y , z} → B]
A1 ∪ A2 :
{a, b, c , d}
→
RatE[{x , y , z} → Q]
because {a, b, c} ∨ {a, b, d} = {a, b, c , d}
because Q ∨ RatE[{x , y , z} → B] = RatE[{x , y , z} → Q]
14 / 22
![Page 36: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/36.jpg)
Union of Automata
A1 : L1 →W1 A2 : L2 →W2
A1 ∪ A2 : L1 ∨ L2 →W1 ∨W2
A1 : {a, b, c} → Q A2 : {a, b, d} → RatE[{x , y , z} → B]
A1 ∪ A2 :
{a, b, c , d}
→
RatE[{x , y , z} → Q]
because {a, b, c} ∨ {a, b, d} = {a, b, c , d}
because Q ∨ RatE[{x , y , z} → B] = RatE[{x , y , z} → Q]
14 / 22
![Page 37: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/37.jpg)
Union of Automata
A1 : L1 →W1 A2 : L2 →W2
A1 ∪ A2 : L1 ∨ L2 →W1 ∨W2
A1 : {a, b, c} → Q A2 : {a, b, d} → RatE[{x , y , z} → B]
A1 ∪ A2 :
{a, b, c , d}
→
RatE[{x , y , z} → Q]
because {a, b, c} ∨ {a, b, d} = {a, b, c , d}
because Q ∨ RatE[{x , y , z} → B] = RatE[{x , y , z} → Q]
14 / 22
![Page 38: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/38.jpg)
Union of Automata
A1 : L1 →W1 A2 : L2 →W2
A1 ∪ A2 : L1 ∨ L2 →W1 ∨W2
A1 : {a, b, c} → Q A2 : {a, b, d} → RatE[{x , y , z} → B]
A1 ∪ A2 : {a, b, c , d} →
RatE[{x , y , z} → Q]
because {a, b, c} ∨ {a, b, d} = {a, b, c , d}
because Q ∨ RatE[{x , y , z} → B] = RatE[{x , y , z} → Q]
14 / 22
![Page 39: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/39.jpg)
Union of Automata
A1 : L1 →W1 A2 : L2 →W2
A1 ∪ A2 : L1 ∨ L2 →W1 ∨W2
A1 : {a, b, c} → Q A2 : {a, b, d} → RatE[{x , y , z} → B]
A1 ∪ A2 : {a, b, c , d} →
RatE[{x , y , z} → Q]
because {a, b, c} ∨ {a, b, d} = {a, b, c , d}
because Q ∨ RatE[{x , y , z} → B] = RatE[{x , y , z} → Q]
14 / 22
![Page 40: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/40.jpg)
Union of Automata
A1 : L1 →W1 A2 : L2 →W2
A1 ∪ A2 : L1 ∨ L2 →W1 ∨W2
A1 : {a, b, c} → Q A2 : {a, b, d} → RatE[{x , y , z} → B]
A1 ∪ A2 : {a, b, c , d} → RatE[{x , y , z} → Q]
because {a, b, c} ∨ {a, b, d} = {a, b, c , d}
because Q ∨ RatE[{x , y , z} → B] = RatE[{x , y , z} → Q]
14 / 22
![Page 41: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/41.jpg)
Synchronized Product of Automata
A1 : A1 →W1 A2 : A2 →W2
A1 &A2 :
A1 ∧ A2 →W1 ∨W2
A1 : {a, b, c} → Q A2 : {a, b, d} → RatE[{x , y , z} → B]
A1 &A2 : {a, b} → RatE[{x , y , z} → Q]
because {a, b, c} ∧ {a, b, d} = {a, b}
because Q ∨ RatE[{x , y , z} → B] = RatE[{x , y , z} → Q]
15 / 22
![Page 42: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/42.jpg)
Synchronized Product of Automata
A1 : A1 →W1 A2 : A2 →W2
A1 &A2 : A1 ∧ A2 →W1 ∨W2
A1 : {a, b, c} → Q A2 : {a, b, d} → RatE[{x , y , z} → B]
A1 &A2 : {a, b} → RatE[{x , y , z} → Q]
because {a, b, c} ∧ {a, b, d} = {a, b}
because Q ∨ RatE[{x , y , z} → B] = RatE[{x , y , z} → Q]
15 / 22
![Page 43: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/43.jpg)
Synchronized Product of Automata
A1 : A1 →W1 A2 : A2 →W2
A1 &A2 : A1 ∧ A2 →W1 ∨W2
A1 : {a, b, c} → Q A2 : {a, b, d} → RatE[{x , y , z} → B]
A1 &A2 : {a, b} → RatE[{x , y , z} → Q]
because {a, b, c} ∧ {a, b, d} = {a, b}
because Q ∨ RatE[{x , y , z} → B] = RatE[{x , y , z} → Q]
15 / 22
![Page 44: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/44.jpg)
Synchronized Product in Vaucanson
p
q
〈12〉a, c
〈13〉b
〈12〉a, c
A1
r s
〈y〉b, d
〈x∗〉a
〈z〉b, dA2
p, r
q, r
p, s
q, s
〈〈13〉y〉b
〈〈12〉x
∗〉a
〈〈12〉x
∗〉a
〈〈13〉z〉b
A1 &A2
16 / 22
![Page 45: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/45.jpg)
Synchronized Product in Vaucanson
p
q
〈12〉a, c
〈13〉b
〈12〉a, c
A1
r s
〈y〉b, d
〈x∗〉a
〈z〉b, dA2
p, r
q, r
p, s
q, s
〈〈13〉y〉b
〈〈12〉x
∗〉a
〈〈12〉x
∗〉a
〈〈13〉z〉b
A1 &A2
16 / 22
![Page 46: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/46.jpg)
Synchronized Product in Vaucanson
p
q
〈12〉a, c
〈13〉b
〈12〉a, c
A1
r s
〈y〉b, d
〈x∗〉a
〈z〉b, dA2
p, r
q, r
p, s
q, s
〈〈13〉y〉b
〈〈12〉x
∗〉a
〈〈12〉x
∗〉a
〈〈13〉z〉b
A1 &A2
16 / 22
![Page 47: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/47.jpg)
Use in Vaucanson
1 Typing Automata and Rational Expressions
2 A Calculus on Types
3 Use in Vaucanson
17 / 22
![Page 48: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/48.jpg)
Use of Types
Type objects exist, as values, at a low level
Dynamic objects wrap low-level objects
The dynamic library resolves calls discriminating on type objects
The dispatching routine computes resulting types
Types can1 be used to generate code at run time
1After publication: now they are. 18 / 22
![Page 49: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/49.jpg)
Use of Types
Type objects exist, as values, at a low level
Dynamic objects wrap low-level objects
The dynamic library resolves calls discriminating on type objects
The dispatching routine computes resulting types
Types can1 be used to generate code at run time
1After publication: now they are. 18 / 22
![Page 50: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/50.jpg)
Use of Types
Type objects exist, as values, at a low level
Dynamic objects wrap low-level objects
The dynamic library resolves calls discriminating on type objects
The dispatching routine computes resulting types
Types can1 be used to generate code at run time
1After publication: now they are. 18 / 22
![Page 51: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/51.jpg)
Operations on Rational Expressions
E1 : RatE[L1 →W1] E2 : RatE[L2 →W2]� ∈ {·,+}
E1 � E2 : RatE[L1 ∨ L2 →W1 ∨W2]
w1 : W1 E2 : RatE[L2 →W2]
w1 · E2 : RatE[L2 →W1 ∨W2]
E1 : RatE[L1 →W1] w2 : W2
E1 · w2 : RatE[L1 →W1 ∨W2]
19 / 22
![Page 52: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/52.jpg)
Operations on Automata
A1 : L1 →W1 A2 : L2 →W2� ∈ {·,+}
A1 �A2 : L1 ∨ L2 →W1 ∨W2
A1 : A1 →W1 A2 : A2 →W2� ∈ {G, ↑}
A1 �A2 : A1 ∨ A2 →W1 ∨W2
w1 : W1 A2 : L2 →W2
w1 · A2 : L2 →W1 ∨W2
A1 : L1 →W1 w2 : W2
A1 · w2 : L1 →W1 ∨W2
20 / 22
![Page 53: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/53.jpg)
Conclusion
“State” Acceptors, transducersEfficient static APIFlexible dynamic API with runtime compilationUser[/student]-friendly IPython interface
“Transition” Better transducer supportImproved type-checking errorsRicher expressionsMetadata on states2
. . .
2After publication: now largely done. 21 / 22
![Page 54: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/54.jpg)
Conclusion
“State” Acceptors, transducersEfficient static APIFlexible dynamic API with runtime compilationUser[/student]-friendly IPython interface
“Transition” Better transducer supportImproved type-checking errorsRicher expressionsMetadata on states2
. . .
2After publication: now largely done. 21 / 22
![Page 55: A Type System for Weighted Automata and Rational Expressionsageinghacker.net/talks/ciaa-2014--demaille-duretlutz-lombardy-saiu... · 1 Typing Automata and Rational Expressions 2 A](https://reader033.vdocuments.net/reader033/viewer/2022042910/5f3f72df5490de627a102147/html5/thumbnails/55.jpg)
Questions?
22 / 22