Automata Learning: An Algebraic Approach Henning Urbat joint work - - PowerPoint PPT Presentation

automata learning an algebraic approach
SMART_READER_LITE
LIVE PREVIEW

Automata Learning: An Algebraic Approach Henning Urbat joint work - - PowerPoint PPT Presentation

Automata Learning: An Algebraic Approach Henning Urbat joint work with Lutz Schr oder Oberseminar October 22, 2019 Automata Learning Black Box System Formal Model s 0 learn ejectGrog insertCoin s 1


slide-1
SLIDE 1

Automata Learning: An Algebraic Approach

Henning Urbat – joint work with Lutz Schr¨

  • der –

Oberseminar October 22, 2019

slide-2
SLIDE 2

Automata Learning

Black Box System

learn

  • Formal Model

s0

ejectGrog

s1

insertCoin

  • Tests

Hypothesis Tests Hypothesis

··· Hypothesis 2

slide-3
SLIDE 3

Automata Learning

Black Box System

learn

  • Formal Model

◮ Finite automaton ◮ Weighted automaton ◮ B¨ uchi automaton ◮ Register automaton ◮ · · ·

  • (Co-)Algebra

2

slide-4
SLIDE 4

Automata Learning

Black Box System

learn

  • Formal Model

◮ Finite automaton ◮ Weighted automaton ◮ B¨ uchi automaton ◮ Register automaton ◮ · · ·

  • (Co-)Algebra

2

slide-5
SLIDE 5

Automata Learning: Categorical View

Coalgebraic approach: ◮ Learning automata with side effects X → 2 × (TX)Σ in Set.

van Heerdt, Sammartino, Silva 2017

◮ Learning coalgebras X → GX in Set.

Barlocco, Kupke, Rot 2019

This talk: Algebraic approach Model formal languages and their algebraic recognition via monads. ◮ Generic approach to algebraic language theory.

  • cf. Boja´

nczyk 2015, Urbat, Ad´ amek, Chen, Milius 2016/2017, Salamanca 2017

◮ Well-suited for, e.g., ω-regular languages, tree languages, data languages, cost functions.

3

slide-6
SLIDE 6

Automata Learning: Categorical View

Part I Learning Automata in a Category

4

slide-7
SLIDE 7

Categorical Automata

Fix a complete and cocomplete category D with (E, M)-factorizations and D

F ⊥

D

G

  • An (F-)automaton is given by the data

FQ

δQ

  • I

iQ

Q

δ@

Q

  • fQ

O

GQ

5

slide-8
SLIDE 8

Classical Deterministic Automata

Set

Σ×(−) ⊥

Set

[Σ,−]

  • Σ × Q

δQ

  • 1

iQ

Q

δ@

Q

  • fQ

2

[Σ, Q]

6

slide-9
SLIDE 9

Sorted Deterministic Automata

SetS

F ⊥

SetS

G

  • where

Σ = (Σs,t)s,t, (FQ)t =

  • s

Σs,t × Qs, (GQ)t =

  • s

[Σt,s, Qs]

  • s Σs,t × Qs

δQ,t

  • 1

iQ,t

Qt

δ@

Q,t

  • fQ,t

2

  • s[Σt,s, Qs]

7

slide-10
SLIDE 10

Linear Weighted Automata

K−Vect

Σ⊗(−) ⊥

K−Vect

[Σ,−]

  • Σ ⊗ Q

δQ

  • K

iQ

Q

δ@

Q

  • fQ

K

[Σ, Q]

8

slide-11
SLIDE 11

Semilattice Automata (a.k.a. Nondeterministic Automata)

SLat

Σ⊗(−) ⊥

SLat

[Σ,−]

  • Σ ⊗ Q

δQ

  • 2

iQ

Q

δ@

Q

  • fQ

2

[Σ, Q]

Ad´ amek, Milius, Myers, Urbat: Canonical Nondeterministic Automata, 2014 Denis, Lemay, Terlutte: Residual Finite State Automata, 2001 9

slide-12
SLIDE 12

Nominal Automata [Boja´ nczyk, Klin, Lasota 2013]

Nom

A×(−) ⊥

Nom

[A,−]

  • A × Q

δQ

  • 1

iQ

Q

δ@

Q

  • fQ

2

[A, Q]

10

slide-13
SLIDE 13

Nominal Automata with Name Binding [Kozen et al. 2015]

Nom

A×(−) + A∗(−) ⊥

Nom

[A,−] × [A](−)

  • A × Q + A ∗ Q

δQ

  • 1

iQ

Q

δ@

Q

  • fQ

2

[A, Q] × [A]Q

11

slide-14
SLIDE 14

Nominal Automata with Two-Sided Name Binding

Nom

A×(−) + A∗(−) + [A](−) ⊥

Nom

[A,−] × [A](−) × R

  • A × Q + A ∗ Q + [A]Q

δQ

  • 1

iQ

Q

δ@

Q

  • fQ

2

[A, Q] × [A]Q × RQ

  • cf. Gabbay, Ghica, Petri¸

san: Leaving the Nest, 2015 12

slide-15
SLIDE 15

Categorical Automata

Fix a complete and cocomplete category D with (E, M)-factorizations and D

F ⊥

D

G

  • An (F-)automaton is given by the data

FQ

δQ

  • I

iQ

Q

δ@

Q

  • fQ

O

GQ

13

slide-16
SLIDE 16

Language Semantics

D

F ⊥

D

G

  • +

I, O ∈ D

Initial algebra for FI = I + F: µFI = colim( 0

¡

− → FI0

FI ¡

− − → F 2

I 0 F 2

I ¡

− − → · · · ) Final coalgebra for GO = O × G: νGO = lim( 1

!

← − GO1

GO!

← − − G 2

O1 G 2

O!

← − − · · · ) A language is a morphism L: µFI → O. The accepted language of an automaton Q is defined by LQ = ( µFI

eQ

Q

fQ

O ).

14

slide-17
SLIDE 17

Language Semantics: Classical Automata

Set

Σ×(−) ⊥

Set

[Σ,−]

  • +

I = 1, O = 2

Initial algebra for FI = 1 + Σ × (−): Σ∗ = colim( Σ<0 ֌ Σ<1 ֌ Σ<2 ֌ · · · ) Final coalgebra for GO = 2 × [Σ, −]: [Σ∗, 2] = lim( [Σ<0, 2] ← [Σ<1, 2] ← [Σ<2, 2] ← · · · ) A language is a function L: Σ∗ → 2. The accepted language of an automaton Q is defined by LQ = ( Σ∗ eQ − → Q

fQ

− → 2 ).

15

slide-18
SLIDE 18

Minimal Automata

An automaton Q is minimal if it is ◮ reachable: the unique FI-algebra morphism eQ : µFI → Q lies in E; ◮ simple: the unique GO-coalgebra morphism mQ : Q → νGO lies in M. Theorem (cf. Arbib, Manes 1975) For every language L: µFI → O there exists a unique minimal automaton Min(L) accepting L. µFI

eQ

  • e
  • Min(L)
  • m
  • Q (acc. L)

mQ

  • νGO

16

slide-19
SLIDE 19

Angluin’s Algorithm: Overview

Goal: Given an unknown finite automaton Σ × Q

δQ

  • 1

iQ

Q

δ@

Q

  • fQ

2

[Σ, Q] learn an automaton equivalent to Q by asking questions to a teacher: ◮ Membership queries. Given w ∈ Σ∗, is w ∈ LQ? ◮ Equivalence queries. Given an automaton H, is LH = LQ? If not, teacher delivers a counterexample w ∈ LH ⊕ LQ.

17

slide-20
SLIDE 20

Angluin’s Algorithm: Overview

Σ<0

Σ<1 · · ·

Σ<n

Σ<n+1 · · ·

Σ∗

eQ

  • Q

mQ

  • [Σ<0, 2]

[Σ<1, 2]

  • · · ·
  • [Σ<k, 2]

[Σ<k+1, 2]

  • · · ·
  • [Σ∗, 2]

mQ ◦ eQ : v → λw.LQ(vw) (“Hankel matrix”)

18

slide-21
SLIDE 21

Angluin’s Algorithm: Overview

Σ<0

Σ<1 · · ·

Σ<n

Σ<n+1 · · ·

Σ∗

eQ

  • S
  • Q

mQ

  • [T, 2]

[Σ<0, 2] [Σ<1, 2]

  • · · ·
  • [Σ<k, 2]
  • [Σ<k+1, 2]
  • · · ·
  • [Σ∗, 2]

S ⊆ Σ<n, T ⊆ Σ<k

19

slide-22
SLIDE 22

Angluin’s Algorithm: Overview

Σ<0

Σ<1 · · ·

Σ<n

Σ<n+1 · · ·

Σ∗

eQ

  • S

hS,T

  • Q

mQ

  • [T, 2]

[Σ<0, 2] [Σ<1, 2]

  • · · ·
  • [Σ<k, 2]
  • [Σ<k+1, 2]
  • · · ·
  • [Σ∗, 2]

hS,T : s → λt.LQ(st) (“Observation table”)

20

slide-23
SLIDE 23

Angluin’s Algorithm: Overview

Σ<0

Σ<1 · · ·

Σ<n

Σ<n+1 · · ·

Σ∗

eQ

  • S

hS,T

  • eS,T
  • HS,T
  • mS,T
  • Q

mQ

  • [T, 2]

[Σ<0, 2] [Σ<1, 2]

  • · · ·
  • [Σ<k, 2]
  • [Σ<k+1, 2]
  • · · ·
  • [Σ∗, 2]

Idea: Define automata structure on HS,T that approximates Q. Requires the pair (S, T) to be closed and consistent!

21

slide-24
SLIDE 24

Angluin’s Algorithm: Overview

Σ<0

Σ<1 · · ·

Σ<n

Σ<n+1 · · ·

Σ∗

eQ

  • S

hS,T

  • eS,T
  • HS,T
  • mS,T
  • Q

mQ

  • [T, 2]

[Σ<0, 2] [Σ<1, 2]

  • · · ·
  • [Σ<k, 2]
  • [Σ<k+1, 2]
  • · · ·
  • [Σ∗, 2]

Idea: Define automata structure on HS,T that approximates Q. Requires the pair (S, T) to be closed and consistent!

21

slide-25
SLIDE 25

Angluin’s Algorithm: Closed Pairs

The pair (S, T) is closed if for s ∈ S and a ∈ Σ there exists s′ ∈ S with hS∪SΣ,T(sa) = hS,T(s′).

22

slide-26
SLIDE 26

Angluin’s Algorithm: Closed Pairs

Σ<0

Σ<1 · · ·

Σ<n

Σ<n+1 · · ·

Σ∗

eQ

  • S
  • hS,T
  • eS,T
  • S ∪ SΣ

hS∪SΣ,T

  • eS∪SΣ,T
  • HS,T
  • mS,T
  • HS∪SΣ,T
  • mS∪SΣ,T
  • Q

mQ

  • [T, 2]

[T, 2] [Σ<0, 2] [Σ<1, 2]

  • · · ·
  • [Σ<k, 2]
  • [Σ<k+1, 2]
  • · · ·
  • [Σ∗, 2]

23

slide-27
SLIDE 27

Angluin’s Algorithm: Closed Pairs

Σ<0

Σ<1 · · ·

Σ<n

Σ<n+1 · · ·

Σ∗

eQ

  • S
  • hS,T
  • eS,T
  • S ∪ SΣ

hS∪SΣ,T

  • eS∪SΣ,T
  • HS,T
  • mS,T
  • HS∪SΣ,T
  • mS∪SΣ,T
  • Q

mQ

  • [T, 2]

[T, 2] [Σ<0, 2] [Σ<1, 2]

  • · · ·
  • [Σ<k, 2]
  • [Σ<k+1, 2]
  • · · ·
  • [Σ∗, 2]

24

slide-28
SLIDE 28

Angluin’s Algorithm: Closed Pairs

The pair (S, T) is closed if for s ∈ S and a ∈ Σ there exists s′ ∈ S with hS∪SΣ,T(sa) = hS,T(s′). Equivalently: HS,T ֌ HS∪SΣ,T is an isomorphism. If (S, T) is not closed: Extend S

  • 1. Choose s ∈ S and a ∈ Σ such that, for all s′ ∈ S,

hS∪SΣ,T(sa) = hS,T(s′).

  • 2. Add the word sa to S.

25

slide-29
SLIDE 29

Angluin’s Algorithm: Closed Pairs

The pair (S, T) is closed if for s ∈ S and a ∈ Σ there exists s′ ∈ S with hS∪SΣ,T(sa) = hS,T(s′). Equivalently: HS,T ֌ HS∪SΣ,T is an isomorphism. If (S, T) is not closed: Extend S

  • 1. Choose s ∈ S and a ∈ Σ such that, for all s′ ∈ S,

hS∪SΣ,T(sa) = hS,T(s′).

  • 2. Add the word sa to S.

25

slide-30
SLIDE 30

Angluin’s Algorithm: Consistent Pairs

The pair (S, T) is consistent if hS,T(s) = hS,T(s′) implies hS,T∪ΣT(s) = hS,T∪ΣT(s).

26

slide-31
SLIDE 31

Angluin’s Algorithm: Consistent Pairs

Σ<0

Σ<1 · · ·

Σ<n

Σ<n+1 · · ·

Σ∗

eQ

  • S

hS,T

  • eS,T
  • S

hS,T∪ΣT

  • eS,T∪ΣT
  • HS,T
  • mS,T
  • HS,T∪ΣT
  • mS,T∪ΣT
  • Q

mQ

  • [T, 2]

[T ∪ ΣT, 2]

  • [Σ<0, 2]

[Σ<1, 2]

  • · · ·
  • [Σ<k, 2]
  • [Σ<k+1, 2]
  • · · ·
  • [Σ∗, 2]

27

slide-32
SLIDE 32

Angluin’s Algorithm: Consistent Pairs

Σ<0

Σ<1 · · ·

Σ<n

Σ<n+1 · · ·

Σ∗

eQ

  • S

hS,T

  • eS,T
  • S

hS,T∪ΣT

  • eS,T∪ΣT
  • HS,T
  • mS,T
  • HS,T∪ΣT
  • mS,T∪ΣT
  • Q

mQ

  • [T, 2]

[T ∪ ΣT, 2]

  • [Σ<0, 2]

[Σ<1, 2]

  • · · ·
  • [Σ<k, 2]
  • [Σ<k+1, 2]
  • · · ·
  • [Σ∗, 2]

28

slide-33
SLIDE 33

Angluin’s Algorithm: Consistent Pairs

The pair (S, T) is consistent if hS,T(s) = hS,T(s′) implies hS,T∪ΣT(s) = hS,T∪ΣT(s). Equivalently: HS∪SΣ,T ։ HS,T is an isomorphism. If (S, T) is not consistent: Extend T

  • 1. Choose s, s′ ∈ S, a ∈ Σ and t ∈ T with

hS,T(s) = hS,T(s′) and hS,T∪ΣT(s)(at) = hS,T∪ΣT(s′)(at).

  • 2. Add the word at to T.

29

slide-34
SLIDE 34

Angluin’s Algorithm: Consistent Pairs

The pair (S, T) is consistent if hS,T(s) = hS,T(s′) implies hS,T∪ΣT(s) = hS,T∪ΣT(s). Equivalently: HS∪SΣ,T ։ HS,T is an isomorphism. If (S, T) is not consistent: Extend T

  • 1. Choose s, s′ ∈ S, a ∈ Σ and t ∈ T with

hS,T(s) = hS,T(s′) and hS,T∪ΣT(s)(at) = hS,T∪ΣT(s′)(at).

  • 2. Add the word at to T.

29

slide-35
SLIDE 35

Angluin’s Algorithm: Constructing Hypotheses

If (S, T) is closed and consistent: build hypothesis automaton on HS,T. S

hS,T

  • eS,T HS,T

mS,T [T, 2]

◮ states HS,T = hS,T[S]; ◮ transitions hS,T(s) a − → hS∪SΣ,T(sa) for s ∈ S, a ∈ Σ; ◮ initial state hS,T(ǫ); ◮ final states: all hS,T(s) with s ∈ S ∩ LQ.

30

slide-36
SLIDE 36

Angluin’s Algorithm: Summary

Angluin’s Algorithm Goal: Learn an automaton equivalent to an unknown automaton Q.

  • 1. Initialize (S, T) := ({ǫ}, {ǫ}).
  • 2. Extend S and T until (S, T) is closed and consistent.
  • 3. Build the hypothesis HS,T and ask whether LHS,T = LQ.

◮ If LHS,T = LQ: Return HS,T. ◮ If LHS,T = LQ: Add all prefixes of the counterexample w ∈ Σ∗ to S.

  • 4. Go to 2.

31

slide-37
SLIDE 37

Learning Categorical Automata

Goal: Learn an automaton equivalent to an unknown automaton FQ

δQ

  • 1

iQ

Q

δ@

Q

  • fQ

2

GQ

32

slide-38
SLIDE 38

Angluin’s Algorithm: Overview

Σ<0

Σ<1 · · ·

Σ<n

Σ<n+1 · · ·

Σ∗

eQ

  • S

hS,T

  • eS,T
  • HS,T
  • mS,T
  • Q

mQ

  • [T, 2]

[Σ<0, 2] [Σ<1, 2]

  • · · ·
  • [Σ<k, 2]
  • [Σ<k+1, 2]
  • · · ·
  • [Σ∗, 2]

33

slide-39
SLIDE 39

Learning Categorical Automata: Overview

FI0 · · ·

F n

I 0

F n+1

I

· · ·

µFI

eQ

  • S

hS,T

  • eS,T
  • s
  • HS,T
  • mS,T
  • Q

mQ

  • T

1 GO1

  • · · ·
  • G k

O1 t

  • G k+1

O

1

  • · · ·
  • νGO

34

slide-40
SLIDE 40

Learning Categorical Automata: Overview

FI0 · · ·

F n

I 0

F n+1

I

· · ·

µFI

eQ

  • S

hS,T

  • eS,T
  • s
  • σ

FIS

  • FI s
  • HS,T
  • mS,T
  • Q

mQ

  • T

GOT

τ

  • 1

GO1

  • · · ·
  • G k

O1 t

  • G k+1

O

1

  • GOt
  • · · ·
  • νGO

S subcoalgebra, T quotient algebra

35

slide-41
SLIDE 41

Angluin’s Algorithm: Closed Pairs

Σ<0

Σ<1 · · ·

Σ<n

Σ<n+1 · · ·

Σ∗

eQ

  • S
  • hS,T
  • eS,T
  • S ∪ SΣ

hS∪SΣ,T

  • eS∪SΣ,T
  • HS,T
  • mS,T
  • HS∪SΣ,T
  • mS∪SΣ,T
  • Q

mQ

  • [T, 2]

[T, 2] [Σ<0, 2] [Σ<1, 2]

  • · · ·
  • [Σ<k, 2]
  • [Σ<k+1, 2]
  • · · ·
  • [Σ∗, 2]

(S, T) closed iff HS,T ֌ HS∪SΣ,T iso.

36

slide-42
SLIDE 42

Learning Categorical Automata: Closed Pairs

FI0 · · ·

F n

I 0

F n+1

I

· · ·

µFI

eQ

  • S

hS,T

  • eS,T
  • s
  • σ

FIS

  • FI s
  • hFI S,T
  • eFI S,T
  • HS,T
  • mS,T
  • HFI S,T
  • mFI S,T
  • Q

mQ

  • T

T 1 GO1

  • · · ·
  • G k

O1 t

  • G k+1

O

1

  • · · ·
  • νGO

37

slide-43
SLIDE 43

Learning Categorical Automata: Closed Pairs

The pair (S, T) is closed if HS,T ֌ HFI S,T is an isomorphism. If (S, T) is not closed: Extend S

  • 1. Choose a factorization

S

  • σ

FIS

S′

  • such that S′

FIS

eFI S,T

HFI S,T lies in E.

  • 2. Replace S

s F n I 0 by S′

FIS

FI s F n+1 I

0 .

38

slide-44
SLIDE 44

Learning Categorical Automata: Closed Pairs

FI0 · · ·

F n

I 0

F n+1

I

· · ·

µFI

eQ

  • S
  • hS,T
  • eS,T
  • s
  • S′
  • HS,T
  • mS,T
  • Q

mQ

  • T

1 GO1

  • · · ·
  • G k

O1 t

  • G k+1

O

1

  • · · ·
  • νGO

39

slide-45
SLIDE 45

Learning Categorical Automata: Consistent Pairs

The pair (S, T) is consistent if HS,GOT ։ HS,T is an isomorphism. If (S, T) is not consistent: Extend T

  • 1. Choose a factorization

T GOT

τ

  • T ′
  • such that HS,GOT

mS,GO T GOT

T ′ lies in M.

  • 2. Replace G k

O1 t

T by G k+1

O

1

GOt GOT

T ′ .

40

slide-46
SLIDE 46

Learning Categorical Automata: Consistent Pairs

FI0 · · ·

F n

I 0

F n+1

I

· · ·

µFI

eQ

  • S

hS,T

  • eS,T
  • s
  • HS,T
  • mS,T
  • Q

mQ

  • T

T ′

  • 1

GO1

  • · · ·
  • G k

O1 t

  • G k+1

O

1

  • · · ·
  • νGO

41

slide-47
SLIDE 47

Learning Categorical Automata: Constructing Hypotheses

If (S, T) is closed and consistent: build hypothesis automaton on HS,T. S

hS,T

  • eS,T HS,T

mS,T T

◮ states HS,T; ◮ initial state I

inl

− → I + FS = FIS

eFI S,T

− − − → HFI S,T

∼ =

− → HS,T; ◮ final states HS,T

∼ =

− → HS,GOT

mS,GO T

− − − − → GOT = O × GT

  • utl

− − → O; ◮ transitions FHS,T

δS,T

− − → HS,T via diagonal fill-in.

42

slide-48
SLIDE 48

Learning Categorical Automata: Constructing Hypotheses

FS

FeS,T inr

  • FHS,T

∼ =

  • δS,T
  • FIS

eFI S,T

  • FHS,GOT

FmS,GO T

  • HFI S,T

∼ =

  • FGOT

Foutr

  • FGT

ǫ

  • HS,T

mS,T

T

43

slide-49
SLIDE 49

Learning Categorical Automata: Counterexamples

In Angluin’s algorithm: If LHS,T = LQ, then ◮ learner receives counterexample w ∈ LHS,T ⊕ LQ, and ◮ adds set C of all prefixes of w to S. Categorical generalization: identify w with C. Definition (Counterexample) A counterexample for HS,T is a subcoalgebra C ֌ F m

I 0 with

( C ֌ F m

I 0 ֌ µFI LHS,T

− − − → O ) = ( C ֌ F m

I 0 ֌ µFI LQ

− → O ). Adding C ֌ F m

I 0 to S ֌ F n I 0 means:

replace S by S ∨ C ֌ F max{m,n}

I

0.

44

slide-50
SLIDE 50

Learning Categorical Automata: Summary

Generalized Angluin Algorithm Goal: Learn an automaton equivalent to an unknown automaton Q.

  • 1. Initialize (S ֌ F n

I 0, G k O1 ։ T) = ( I ∼ =

− → F 1

I 0, G 1 O1 ∼ =

− → O).

  • 2. Extend S and T until (S, T) is closed and consistent.
  • 3. Build the hypothesis HS,T and ask whether LHS,T = LQ.

◮ If LHS,T = LQ: Return HS,T. ◮ If LHS,T = LQ: Add the counterexample C ֌ F m

I 0 to S.

  • 4. Go to 2.

Correctness and termination requires Q to be “finite”!

45

slide-51
SLIDE 51

Learning Categorical Automata: Summary

Generalized Angluin Algorithm Goal: Learn an automaton equivalent to an unknown automaton Q.

  • 1. Initialize (S ֌ F n

I 0, G k O1 ։ T) = ( I ∼ =

− → F 1

I 0, G 1 O1 ∼ =

− → O).

  • 2. Extend S and T until (S, T) is closed and consistent.
  • 3. Build the hypothesis HS,T and ask whether LHS,T = LQ.

◮ If LHS,T = LQ: Return HS,T. ◮ If LHS,T = LQ: Add the counterexample C ֌ F m

I 0 to S.

  • 4. Go to 2.

Correctness and termination requires Q to be “finite”!

45

slide-52
SLIDE 52

Learning Categorical Automata: Finite Objects

The object Q ∈ D is finite if every proper ascending chain of subobjects S0 ֌ S1 ֌ S2 ֌ S3 ֌ · · · ֌ Q is finite, and every proper ascending chain of quotients T0 և T1 և T2 և T3 և · · · և Q is finite. The size of Q is the length of the longest proper ascending chain. ◮ Set: finite objects = finite sets, size = cardinality ◮ K−Vect: finite objects = finite-dimensional spaces, size = dimension ◮ Nom: finite objects = orbit-finite sets, size of Q ≈ #(orbits of Q) • max{|supp(q)| : q ∈ Q}.

46

slide-53
SLIDE 53

Learning Categorical Automata: Finite Objects

The object Q ∈ D is finite if every proper ascending chain of subobjects S0 ֌ S1 ֌ S2 ֌ S3 ֌ · · · ֌ Q is finite, and every proper ascending chain of quotients T0 և T1 և T2 և T3 և · · · և Q is finite. The size of Q is the length of the longest proper ascending chain. ◮ Set: finite objects = finite sets, size = cardinality ◮ K−Vect: finite objects = finite-dimensional spaces, size = dimension ◮ Nom: finite objects = orbit-finite sets, size of Q ≈ #(orbits of Q) • max{|supp(q)| : q ∈ Q}.

46

slide-54
SLIDE 54

Learning Categorical Automata: Correctness and Termination

Generalized Angluin Algorithm Goal: Learn an automaton equivalent to an unknown automaton Q.

  • 1. Initialize (S ֌ F n

I 0, G k O1 ։ T) = ( I ∼ =

− → F 1

I 0, G 1 O1 ∼ =

− → O).

  • 2. Extend S and T until (S, T) is closed and consistent.
  • 3. Build the hypothesis HS,T and ask whether LHS,T = LQ.

◮ If LHS,T = LQ: Return HS,T. ◮ If LHS,T = LQ: Add the counterexample C ֌ F m

I 0 to S.

  • 4. Go to 2.

Theorem Suppose that Q is finite. Then the algorithm terminates after O(size(Q)) steps and returns Min(LQ).

47

slide-55
SLIDE 55

Learning Categorical Automata: Summary

Common generalization and unification of (both known and new) learning algorithms, correctness proofs, complexity analysis: ◮ D = Set: classical deterministic automata [Angluin 1987] ◮ D = SetS: sorted deterministic automata ◮ D = SLat: residual nondeterministic automata [Bollig et al. 2009] ◮ D = K−Vect: linear weighted automata [van Heerdt et al. 2017] ◮ D = Nom: nominal automata without name binding [Moerman et al. 2017], name binding to the right, two-sided name binding. Next: Apply framework to learn ω-regular languages, tree languages, cost functions, . . . . . . using monads!

48

slide-56
SLIDE 56

Learning Categorical Automata: Summary

Common generalization and unification of (both known and new) learning algorithms, correctness proofs, complexity analysis: ◮ D = Set: classical deterministic automata [Angluin 1987] ◮ D = SetS: sorted deterministic automata ◮ D = SLat: residual nondeterministic automata [Bollig et al. 2009] ◮ D = K−Vect: linear weighted automata [van Heerdt et al. 2017] ◮ D = Nom: nominal automata without name binding [Moerman et al. 2017], name binding to the right, two-sided name binding. Next: Apply framework to learn ω-regular languages, tree languages, cost functions, . . . . . . using monads!

48

slide-57
SLIDE 57

Automata Learning: Categorical View

Part II Learning Monad-Recognizable Languages

49

slide-58
SLIDE 58

Languages

Setting: category D with I, O ∈ D and monad T on D. Definition Language = morphism L: TI → O in D ◮ Languages of finite words: semigroup monad TI = I + on Set and O = {0, 1}. ◮ Languages of finite or infinite words: Wilke algebra monad T(I, ∅) = (I +, I (up)) on Set{+,ω} and O = ({0, 1}, {0, 1}). ◮ Data languages (D = nominal sets), weighted languages (D = vector spaces), cost functions (D = posets), . . .

50

slide-59
SLIDE 59

Algebraic Recognition

Definition A language L: TI → O is recognizable if it factorizes through a T-algebra homomorphism e : (TI, µI) → (A, α) with finite codomain. TI

L

  • ∃e
  • O

A

∃p

  • ◮ Languages of finite words: semigroup monad

TI = I + on Set and O = {0, 1}. Recognizable languages = regular languages

51

slide-60
SLIDE 60

Algebraic Recognition

Definition A language L: TX → O is recognizable if it factorizes through a T-algebra homomorphism e : (TX, µX) → (A, α) with finite codomain. TX

L

  • ∃e
  • O

A

∃p

  • ◮ Languages of finite or infinite words: Wilke algebra monad

T(I, ∅) = (I +, I (up)) on Set{+,ω} and O = ({0, 1}, {0, 1}). Recognizable languages = ∞-regular languages

51

slide-61
SLIDE 61

Learning T-Recognizable Languages

Idea: To learn an unknown T-recognizable language L: TI → O: 1 Reduce learning L to learning a finite automaton in D. 2 Apply the Generalized Angluin Algorithm.

51

slide-62
SLIDE 62

Motivation: ω-regular languages

Every language of infinite words L ⊆ I ω determines the language of finite words lasso(L) = { u$v : u ∈ I ∗, v ∈ I +, uvω ∈ L } ⊆ (I ∪ {$})∗. Then L is ω-regular ⇐ ⇒ lasso(L) is regular.

  • cf. Farzan, Chen, Clarke, Tsay, Wang 2008

52

slide-63
SLIDE 63

Automata Presentations

An automata presentation of (TI, µI) is an F-algebra structure FTI

δ

− → TI for some F : D → D such that

  • 1. the FI-algebra I + FTI

[ηI ,δ]

− − − → TI is reachable (eTI : µFI → TI in E);

  • 2. finite quotient F-algebras of TI ⇐

⇒ finite quotient T-algebras of TI. FTI

Fe δ

TI

e

  • FA

∃δA

A

TTI

Te µI

TI

e

  • TA

∃αA

A

Weak automata presentation: Only “⇐ =”. In Applications: Present (TI, µI) as a (sorted) Σ-automaton FQ = Σ × Q

  • n Set,

(FQ)t =

  • s,t

Σs,t × Qt

  • n SetS

53

slide-64
SLIDE 64

Automata Presentations

An automata presentation of (TI, µI) is an F-algebra structure FTI

δ

− → TI for some F : D → D such that

  • 1. the FI-algebra I + FTI

[ηI ,δ]

− − − → TI is reachable (eTI : µFI → TI in E);

  • 2. finite quotient F-algebras of TI ⇐

⇒ finite quotient T-algebras of TI. FTI

Fe δ

TI

e

  • FA

∃δA

A

TTI

Te µI

TI

e

  • TA

∃αA

A

Weak automata presentation: Only “⇐ =”. In Applications: Present (TI, µI) as a (sorted) Σ-automaton FQ = Σ × Q

  • n Set,

(FQ)t =

  • s,t

Σs,t × Qt

  • n SetS

53

slide-65
SLIDE 65

Example: Semigroups (TI = I + on Set)

Presentation of I + as a Σ-automaton in Set: Σ × I +

Σ×e δ

I +

e

  • Σ × A

∃δA

A

⇐ ⇒ (I +)+

e+ µI

I +

e

  • A+

∃αA

A

◮ Σ = {

a : a ∈ I} ∪ {

a : a ∈ I} ◮ δ: Σ × I + δ − → I +, (

a, w) → aw, (

a, w) → wa

54

slide-66
SLIDE 66

Example: Wilke Algebras (T(I, ∅) = (I +, I (up)) on Set{+,ω})

Weak presentation of (I +, I (up)) as a two-sorted Σ-automaton in Set{+,ω}: δ+,+ : Σ+,+ × I + → I + δ+,ω : Σ+,ω × I + → I (up) δω,+ : Σω,+ × I (up) → I + δω,ω : Σω,ω × I (up) → I (up) quotient automata of (I +, I (up)) ⇐ ⇒ quotient algebras of (I +, I (up)).

55

slide-67
SLIDE 67

Example: Wilke Algebras (T(I, ∅) = (I +, I (up)) on Set{+,ω})

Weak presentation of (I +, I (up)) as a two-sorted Σ-automaton in Set{+,ω}: δ+,+ : Σ+,+ × I + → I +, (

a, w) → wa δ+,ω : Σ+,ω × I + → I (up), (ω, w) → wω δω,+ : Σω,+ × I (up) → I +, δω,ω : Σω,ω × I (up) → I (up), (

a, z) → az quotient automata of (I +, I (up)) ⇐ ⇒ quotient algebras of (I +, I (up)). Σ+,+ = {

a : a ∈ I}, Σ+,ω = {ω}, Σω,+ = ∅, Σω,ω = {

a : a ∈ I}

56

slide-68
SLIDE 68

Example: Wilke Algebras (T(I, ∅) = (I +, I (up)) on Set{+,ω})

Weak presentation of (I +, I (up)) as a two-sorted Σ-automaton in Set{+,ω}: δ+,+ : Σ+,+ × I + → I +, (

a, w) → wa δ+,ω : Σ+,ω × I + → I (up), (ω, w) → wω δω,+ : Σω,+ × I (up) → I +, δω,ω : Σω,ω × I (up) → I (up), (

a, z) → az quotient automata of (I +, I (up)) ⇐ ⇒ quotient algebras of (I +, I (up)). Σ+,+ = {

a : a ∈ I}, Σ+,ω = {ω}, Σω,+ = ∅, Σω,ω = {

a : a ∈ I}

57

slide-69
SLIDE 69

Example: Wilke Algebras (T(I, ∅) = (I +, I (up)) on Set{+,ω})

Weak presentation of (I +, I (up)) as a two-sorted Σ-automaton in Set{+,ω}: δ+,+ : Σ+,+ × I + → I +, (

a, w) → wa δ+,ω : Σ+,ω × I + → I (up), (ω, w) → wω δω,+ : Σω,+ × I (up) → I +, δω,ω : Σω,ω × I (up) → I (up), (

a, z) → az quotient automata of (I +, I (up)) ⇐ ⇒ quotient algebras of (I +, I (up)). Σ+,+ = {

a : a ∈ I}, Σ+,ω = {ω}, Σω,+ = ∅, Σω,ω = {

a : a ∈ I}

58

slide-70
SLIDE 70

Example: Wilke Algebras (T(I, ∅) = (I +, I (up) on Set{+,ω})

Weak presentation of (I +, I (up)) as a two-sorted Σ-automaton in Set{+,ω}: δ+,+ : Σ+,+ × I + → I +, (

a, w) → wa δ+,ω : Σ+,ω × I + → I (up), (ω, w) → wω δω,+ : Σω,+ × I (up) → I +, δω,ω : Σω,ω × I (up) → I (up), (

a, z) → az quotient automata of (I +, I (up)) ⇐ ⇒ quotient algebras of (I +, I (up)). Σ+,+ = {

a : a ∈ I}, Σ+,ω = {ω}, Σω,+ = ∅, Σω,ω = {

a : a ∈ I}

59

slide-71
SLIDE 71

Automata Presentations

Theorem (Urbat, Ad´ amek, Chen, Milius 2017) (Σ-)automata presentations exist for all monads T on SetS. Theorem If (TI, µI) has an automata presentation, then every T-recognizable language L: TI → O admits a syntactic T-algebra Syn(L). TI

L

  • eL

e

A

  • p

O

Syn(L)

pL

  • 60
slide-72
SLIDE 72

Motivation: ω-regular languages

Every language of infinite words L ⊆ I ω determines the language of finite words lasso(L) = { u$v : u ∈ I ∗, v ∈ I +, uvω ∈ L } ⊆ (I ∪ {$})∗. Then L is ω-regular ⇐ ⇒ lasso(L) is regular.

  • cf. Farzan, Chen, Clarke, Tsay, Wang 2008

61

slide-73
SLIDE 73

Linearization of a Language

Suppose that (TI, µI) has a weak automata presentation FTI

δ

− → TI. The linearization of a language L: TI → O is given by lin(L) ≡ µFI

eTI TI L

O.

Since eTI ∈ E, the language lin(L) fully represents L!

62

slide-74
SLIDE 74

Example: Semigroups (TI = I + on Set)

Presentation of I + as a Σ-automaton (F = Σ × (−)) ◮ Σ = {

a : a ∈ I} ∪ {

a : a ∈ I} ◮ δ: Σ × I + → I +, (

a, w) → aw, (

a, w) → wa ◮ µFI = I × Σ∗ ◮ eI + : I × Σ∗ → I +, e.g. (d,

c

b

e

a) → abcde lin(L) ≡ I × Σ∗

eI+ I + L

2.

L = {. . . , abcde, . . .} ⇒ lin(L) = {. . . , (d,

c

b

e

a), . . .}

63

slide-75
SLIDE 75

Example: Wilke Algebras (T(I, ∅) = (I +, I (up) on Set{+,ω})

Weak presentation of (I +, I (up) as a sorted Σ-automaton ◮ Σ+,+ = {

a : a ∈ I}, Σ+,ω = {ω}, Σω,+ = ∅, Σω,ω = {

a : a ∈ I} ◮ δ: Σ+,ω × I + → I ω, (ω, w) → wω etc. ◮ µFI = I ⊗ Σ∗ (sorted words over Σ with initial letter from I) ◮ e(I +,I (up)) : I ⊗ Σ∗ → (I +, I (up)), e.g. (a,

c ) → c(ab)ω lin(L) ≡ I ⊗ Σ∗

e(I+,I(up))

(I +, I (up))

L

2.

L = {. . . , c(ab)ω, . . .} ⇒ lin(L) = {. . . , (a,

c ), . . .} ≈ lasso(L)

64

slide-76
SLIDE 76

Linearization of a Language

lin(L) ≡ µFI

eTI TI L

O.

Theorem

  • 1. If FTI

δ

− → TI is a weak automata presentation: L: TI → O is T-recognizable = ⇒ lin(L) is regular.

  • 2. If FTI

δ

− → TI is an automata presentation: L: TI → O is T-recognizable ⇐ ⇒ lin(L) is regular and Syn(L) ∼ = Min(lin(L)). = ⇒ Learning L reduces to learning a finite automaton for lin(L)!

65

slide-77
SLIDE 77

Conclusions

Generic learning strategy for a wide variety of languages Learning T-recognizable language L: TI → O

  • Learning regular language lin(L): µFI → O
  • Generalized Angluin Algorithm based on initial chain/final cochain
  • TODO: Implementation, tools, experimental evaluation
  • cf. Deifel, Dorsch, Milius, Schr¨
  • der, Wißmann: Coalgebraic Partition Refinement, 2017/19

66