Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the...

46
Categorical Automata Learning Framework Matteo Sammartino S-REPLS 6 calf-project.org

Transcript of Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the...

Page 1: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

CategoricalAutomataLearningFramework

Matteo Sammartino

S-REPLS 6

calf-project.org

Page 2: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

Our team

Alexandra Silva UCL

Gerco van Heerdt UCL

Joshua Moerman Radboud University

Maverick Chardet ENS Lyon

Collaborators:

Bartek Klin Warsaw University

Michal Szynwelski Warsaw University

Matteo Sammartino UCL

Page 3: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

Automata learning

Learnerqueries

answers

builds

Systemblack-box

S

automatonmodel of

S

Page 4: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

Automata learning

Learnerqueries

answers

builds

Systemblack-box

S

automatonmodel of

S

No formal specification available? Learn it!

Page 5: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

set of system behaviors is a regular language

Finite alphabet of system’s actions A

L � A�

L* algorithm (D.Angluin ’87)

Page 6: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

set of system behaviors is a regular language

Finite alphabet of system’s actions A

L � A�

L* algorithm (D.Angluin ’87)

Learner TeacherL

Page 7: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

set of system behaviors is a regular language

Finite alphabet of system’s actions A

L � A�

L* algorithm (D.Angluin ’87)

Learner TeacherL

Q:w � L?A: Y/N

Page 8: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

set of system behaviors is a regular language

Finite alphabet of system’s actions A

L � A�

L* algorithm (D.Angluin ’87)

Learner TeacherL

Q:w � L?A: Y/N

L(H) = L?Q:A: Y / N + counterexample

H = hypothesis automatonH

Page 9: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

set of system behaviors is a regular language

Finite alphabet of system’s actions A

L � A�

L* algorithm (D.Angluin ’87)

Learner TeacherL

Q:w � L?A: Y/N

Minimal DFA accepting L L

builds

L(H) = L?Q:A: Y / N + counterexample

H = hypothesis automatonH

Page 10: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

A = {a, b}

Observation table

a aa

0 0 1

a 0 1 0

b 0 0 0

L⋆ LEARNER

1 S,E ← {ϵ}2 repeat3 while (S,E) is not closed or not consistent4 if (S,E) is not closed5 find s1 ∈ S, a ∈ A such that

row(s1a) ̸= row(s), for all s ∈ S6 S ← S ∪ {s1a}7 if (S,E) is not consistent8 find s1, s2 ∈ S, a ∈ A, and e ∈ E such that

row(s1) = row(s2) and L(s1ae) ̸= L(s2ae)9 E ← E ∪ {ae}

10 Make the conjecture M(S,E)11 if the Teacher replies no, with a counter-example t12 S ← S ∪ prefixes(t)13 until the Teacher replies yes to the conjecture M(S,E).14 return M(S,E)

Figure 1. Angluin’s algorithm for deterministic finite automata [3]

structures, which allows the programmer to rely on convenientintuitions of searching through infinite sets in finite time.

The paper is organized as follows. In Section 2, we present anoverview of our contributions (and the original algorithm) highlight-ing the challenges we faced in the various steps. In Section 3, werevise some basic concepts of nominal sets and automata. Section 4contains the core technical contributions of our paper: The newalgorithm and proof of correctness. In Section 5, we describe analgorithm to learn nominal non-deterministic automata. Section 6contains a description of NLambda, details of the implementation,and results of preliminary experiments. Section 7 contains a dis-cussion of related work. We conclude the paper with a discussionsection where also future directions are presented.

2. Overview of the Approach

In this section, we give an overview of the work developed in thepaper through examples. We will start by explaining the originalalgorithm for regular languages over finite alphabets, and thenexplain the challenges in extending it to nominal languages.

Angluin’s algorithm L⋆ provides a procedure to learn the minimalDFA accepting a certain (unknown) language L. The algorithm hasaccess to a teacher which answers two types of queries:• membership queries, consisting of a single word w ∈ A⋆, to

which the teacher will reply whether w ∈ L or not;

• equivalence queries, consisting of a hypothesis DFA H , towhich the teacher replies yes if L(H) = L, and no otherwise,providing a counterexample w ∈ L(H)△L (△ denotes thesymmetric difference of two languages).

The learning algorithm works by incrementally building an observa-tion table, which at each stage contains partial information about thelanguage L. The algorithm is able to fill the table with membershipqueries. As an example, and to set notation, consider the followingtable (over A = {a, b}).

E

ϵ a aa

S∪

S·A

ϵ 0 0 1

a 0 1 0b 0 0 0

S,E ⊆ A⋆

row : S ∪ S·A→ 2E

row(u)(v) = 1 ⇐⇒ uv ∈ L

This table indicates that L contains at least aa and definitelydoes not contain the words ϵ, a, b, ba, baa, aaa. Since row is fully

determined by the language L, we will from now on refer to anobservation table as a pair (S,E), leaving the language L implicit.

Given an observation table (S,E) one can construct a determin-istic automaton M(S,E) = (Q, q0, δ, F ) where• Q = {row(s) | s ∈ S} is a finite set of states;

• F = {row(s) | s ∈ S, row(s)(ϵ) = 1} ⊆ Q is the set of finalstates;

• q0 = row(ϵ) is the initial state;

• δ : Q × A → Q is the transition function given byδ(row(s), a) = row(sa).

For this to be well-defined, we need to have ϵ ∈ S (for the initialstate) and ϵ ∈ E (for final states), and for the transition functionthere are two crucial properties of the table that need to hold:Closedness and consistency. An observation table (S,E) is closedif for all t ∈ S·A there exists an s ∈ S such that row(t) = row(s).An observation table (S,E) is consistent if, whenever s1 and s2are elements of S such that row(s1) = row(s2), for all a ∈ A,row(s1a) = row(s2a). Each time the algorithm constructs anautomaton, it poses an equivalence query to the teacher. It terminateswhen the answer is yes, otherwise it extends the table with thecounterexample provided.

2.1 Simple Example of Execution

Angluin’s algorithm is displayed in Figure 1. Throughout thissection, we will consider the language(s)

Ln = {ww | w ∈ A⋆, |w| = n}

If the alphabet A is finite then Ln is regular for any n ∈ N, andthere is a finite DFA accepting it.

The language L1 = {aa, bb} looks trivial, but the minimal DFArecognizing it has as many as 5 states. Angluin’s algorithm willterminate in (at most) 5 steps. We illustrate some relevant ones.

Step 1. We start from S,E = {ϵ}, and we fill the entries of thetable below by asking membership queries for ϵ, a and b. The tableis closed and consistent, so we construct the hypothesis A1.

ϵ

ϵ 0

a 0b 0

A1 = q0 a, b

q0 = row(ϵ) = {ϵ +→ 0}

The Teacher replies no and gives the counterexample aa, which is inL1 but it is not accepted by A1. Therefore, line 12 of the algorithmis triggered and we set S ← S ∪ {a, aa}.

Step 2. The table becomes the one on the left below. It is closed,but not consistent: Rows ϵ and a are identical, but appending a leadsto different rows, as depicted. Therefore, line 9 is triggered and anextra column a, highlighted in red, is added. The new table is closedand consistent and a new hypothesis A2 is constructed.

ϵϵ 0a 0aa 1b 0ab 0aaa 0aab 0

ϵ aϵ 0 0a 0 1aa 1 0b 0 0ab 0 0aaa 0 0aab 0 0

A2 =

q0 q1

q2

b

a

b

aa, b

a

a

The Teacher again replies no and gives the counterexample bb,which should be accepted by A2 but it is not. Therefore we putS ← S ∪ {b, bb}.

Step 3. The new table is the one on the left. It is closed, but ϵ andb violate consistency, when b is appended. Therefore we add thecolumn b and we get the table on the right, which is closed andconsistent. The new hypothesis is A3.

614

S, E � A�

S

L⋆ LEARNER

1 S,E ← {ϵ}2 repeat3 while (S,E) is not closed or not consistent4 if (S,E) is not closed5 find s1 ∈ S, a ∈ A such that

row(s1a) ̸= row(s), for all s ∈ S6 S ← S ∪ {s1a}7 if (S,E) is not consistent8 find s1, s2 ∈ S, a ∈ A, and e ∈ E such that

row(s1) = row(s2) and L(s1ae) ̸= L(s2ae)9 E ← E ∪ {ae}

10 Make the conjecture M(S,E)11 if the Teacher replies no, with a counter-example t12 S ← S ∪ prefixes(t)13 until the Teacher replies yes to the conjecture M(S,E).14 return M(S,E)

Figure 1. Angluin’s algorithm for deterministic finite automata [3]

structures, which allows the programmer to rely on convenientintuitions of searching through infinite sets in finite time.

The paper is organized as follows. In Section 2, we present anoverview of our contributions (and the original algorithm) highlight-ing the challenges we faced in the various steps. In Section 3, werevise some basic concepts of nominal sets and automata. Section 4contains the core technical contributions of our paper: The newalgorithm and proof of correctness. In Section 5, we describe analgorithm to learn nominal non-deterministic automata. Section 6contains a description of NLambda, details of the implementation,and results of preliminary experiments. Section 7 contains a dis-cussion of related work. We conclude the paper with a discussionsection where also future directions are presented.

2. Overview of the Approach

In this section, we give an overview of the work developed in thepaper through examples. We will start by explaining the originalalgorithm for regular languages over finite alphabets, and thenexplain the challenges in extending it to nominal languages.

Angluin’s algorithm L⋆ provides a procedure to learn the minimalDFA accepting a certain (unknown) language L. The algorithm hasaccess to a teacher which answers two types of queries:• membership queries, consisting of a single word w ∈ A⋆, to

which the teacher will reply whether w ∈ L or not;

• equivalence queries, consisting of a hypothesis DFA H , towhich the teacher replies yes if L(H) = L, and no otherwise,providing a counterexample w ∈ L(H)△L (△ denotes thesymmetric difference of two languages).

The learning algorithm works by incrementally building an observa-tion table, which at each stage contains partial information about thelanguage L. The algorithm is able to fill the table with membershipqueries. As an example, and to set notation, consider the followingtable (over A = {a, b}).

E

ϵ a aa

S∪

S·A

ϵ 0 0 1

a 0 1 0b 0 0 0

S,E ⊆ A⋆

row : S ∪ S·A→ 2E

row(u)(v) = 1 ⇐⇒ uv ∈ L

This table indicates that L contains at least aa and definitelydoes not contain the words ϵ, a, b, ba, baa, aaa. Since row is fully

determined by the language L, we will from now on refer to anobservation table as a pair (S,E), leaving the language L implicit.

Given an observation table (S,E) one can construct a determin-istic automaton M(S,E) = (Q, q0, δ, F ) where• Q = {row(s) | s ∈ S} is a finite set of states;

• F = {row(s) | s ∈ S, row(s)(ϵ) = 1} ⊆ Q is the set of finalstates;

• q0 = row(ϵ) is the initial state;

• δ : Q × A → Q is the transition function given byδ(row(s), a) = row(sa).

For this to be well-defined, we need to have ϵ ∈ S (for the initialstate) and ϵ ∈ E (for final states), and for the transition functionthere are two crucial properties of the table that need to hold:Closedness and consistency. An observation table (S,E) is closedif for all t ∈ S·A there exists an s ∈ S such that row(t) = row(s).An observation table (S,E) is consistent if, whenever s1 and s2are elements of S such that row(s1) = row(s2), for all a ∈ A,row(s1a) = row(s2a). Each time the algorithm constructs anautomaton, it poses an equivalence query to the teacher. It terminateswhen the answer is yes, otherwise it extends the table with thecounterexample provided.

2.1 Simple Example of Execution

Angluin’s algorithm is displayed in Figure 1. Throughout thissection, we will consider the language(s)

Ln = {ww | w ∈ A⋆, |w| = n}

If the alphabet A is finite then Ln is regular for any n ∈ N, andthere is a finite DFA accepting it.

The language L1 = {aa, bb} looks trivial, but the minimal DFArecognizing it has as many as 5 states. Angluin’s algorithm willterminate in (at most) 5 steps. We illustrate some relevant ones.

Step 1. We start from S,E = {ϵ}, and we fill the entries of thetable below by asking membership queries for ϵ, a and b. The tableis closed and consistent, so we construct the hypothesis A1.

ϵ

ϵ 0

a 0b 0

A1 = q0 a, b

q0 = row(ϵ) = {ϵ +→ 0}

The Teacher replies no and gives the counterexample aa, which is inL1 but it is not accepted by A1. Therefore, line 12 of the algorithmis triggered and we set S ← S ∪ {a, aa}.

Step 2. The table becomes the one on the left below. It is closed,but not consistent: Rows ϵ and a are identical, but appending a leadsto different rows, as depicted. Therefore, line 9 is triggered and anextra column a, highlighted in red, is added. The new table is closedand consistent and a new hypothesis A2 is constructed.

ϵϵ 0a 0aa 1b 0ab 0aaa 0aab 0

ϵ aϵ 0 0a 0 1aa 1 0b 0 0ab 0 0aaa 0 0aab 0 0

A2 =

q0 q1

q2

b

a

b

aa, b

a

a

The Teacher again replies no and gives the counterexample bb,which should be accepted by A2 but it is not. Therefore we putS ← S ∪ {b, bb}.

Step 3. The new table is the one on the left. It is closed, but ϵ andb violate consistency, when b is appended. Therefore we add thecolumn b and we get the table on the right, which is closed andconsistent. The new hypothesis is A3.

614

L⋆ LEARNER

1 S,E ← {ϵ}2 repeat3 while (S,E) is not closed or not consistent4 if (S,E) is not closed5 find s1 ∈ S, a ∈ A such that

row(s1a) ̸= row(s), for all s ∈ S6 S ← S ∪ {s1a}7 if (S,E) is not consistent8 find s1, s2 ∈ S, a ∈ A, and e ∈ E such that

row(s1) = row(s2) and L(s1ae) ̸= L(s2ae)9 E ← E ∪ {ae}

10 Make the conjecture M(S,E)11 if the Teacher replies no, with a counter-example t12 S ← S ∪ prefixes(t)13 until the Teacher replies yes to the conjecture M(S,E).14 return M(S,E)

Figure 1. Angluin’s algorithm for deterministic finite automata [3]

structures, which allows the programmer to rely on convenientintuitions of searching through infinite sets in finite time.

The paper is organized as follows. In Section 2, we present anoverview of our contributions (and the original algorithm) highlight-ing the challenges we faced in the various steps. In Section 3, werevise some basic concepts of nominal sets and automata. Section 4contains the core technical contributions of our paper: The newalgorithm and proof of correctness. In Section 5, we describe analgorithm to learn nominal non-deterministic automata. Section 6contains a description of NLambda, details of the implementation,and results of preliminary experiments. Section 7 contains a dis-cussion of related work. We conclude the paper with a discussionsection where also future directions are presented.

2. Overview of the Approach

In this section, we give an overview of the work developed in thepaper through examples. We will start by explaining the originalalgorithm for regular languages over finite alphabets, and thenexplain the challenges in extending it to nominal languages.

Angluin’s algorithm L⋆ provides a procedure to learn the minimalDFA accepting a certain (unknown) language L. The algorithm hasaccess to a teacher which answers two types of queries:• membership queries, consisting of a single word w ∈ A⋆, to

which the teacher will reply whether w ∈ L or not;

• equivalence queries, consisting of a hypothesis DFA H , towhich the teacher replies yes if L(H) = L, and no otherwise,providing a counterexample w ∈ L(H)△L (△ denotes thesymmetric difference of two languages).

The learning algorithm works by incrementally building an observa-tion table, which at each stage contains partial information about thelanguage L. The algorithm is able to fill the table with membershipqueries. As an example, and to set notation, consider the followingtable (over A = {a, b}).

E

ϵ a aa

S∪

S·A

ϵ 0 0 1

a 0 1 0b 0 0 0

S,E ⊆ A⋆

row : S ∪ S·A→ 2E

row(u)(v) = 1 ⇐⇒ uv ∈ L

This table indicates that L contains at least aa and definitelydoes not contain the words ϵ, a, b, ba, baa, aaa. Since row is fully

determined by the language L, we will from now on refer to anobservation table as a pair (S,E), leaving the language L implicit.

Given an observation table (S,E) one can construct a determin-istic automaton M(S,E) = (Q, q0, δ, F ) where• Q = {row(s) | s ∈ S} is a finite set of states;

• F = {row(s) | s ∈ S, row(s)(ϵ) = 1} ⊆ Q is the set of finalstates;

• q0 = row(ϵ) is the initial state;

• δ : Q × A → Q is the transition function given byδ(row(s), a) = row(sa).

For this to be well-defined, we need to have ϵ ∈ S (for the initialstate) and ϵ ∈ E (for final states), and for the transition functionthere are two crucial properties of the table that need to hold:Closedness and consistency. An observation table (S,E) is closedif for all t ∈ S·A there exists an s ∈ S such that row(t) = row(s).An observation table (S,E) is consistent if, whenever s1 and s2are elements of S such that row(s1) = row(s2), for all a ∈ A,row(s1a) = row(s2a). Each time the algorithm constructs anautomaton, it poses an equivalence query to the teacher. It terminateswhen the answer is yes, otherwise it extends the table with thecounterexample provided.

2.1 Simple Example of Execution

Angluin’s algorithm is displayed in Figure 1. Throughout thissection, we will consider the language(s)

Ln = {ww | w ∈ A⋆, |w| = n}

If the alphabet A is finite then Ln is regular for any n ∈ N, andthere is a finite DFA accepting it.

The language L1 = {aa, bb} looks trivial, but the minimal DFArecognizing it has as many as 5 states. Angluin’s algorithm willterminate in (at most) 5 steps. We illustrate some relevant ones.

Step 1. We start from S,E = {ϵ}, and we fill the entries of thetable below by asking membership queries for ϵ, a and b. The tableis closed and consistent, so we construct the hypothesis A1.

ϵ

ϵ 0

a 0b 0

A1 = q0 a, b

q0 = row(ϵ) = {ϵ +→ 0}

The Teacher replies no and gives the counterexample aa, which is inL1 but it is not accepted by A1. Therefore, line 12 of the algorithmis triggered and we set S ← S ∪ {a, aa}.

Step 2. The table becomes the one on the left below. It is closed,but not consistent: Rows ϵ and a are identical, but appending a leadsto different rows, as depicted. Therefore, line 9 is triggered and anextra column a, highlighted in red, is added. The new table is closedand consistent and a new hypothesis A2 is constructed.

ϵϵ 0a 0aa 1b 0ab 0aaa 0aab 0

ϵ aϵ 0 0a 0 1aa 1 0b 0 0ab 0 0aaa 0 0aab 0 0

A2 =

q0 q1

q2

b

a

b

aa, b

a

a

The Teacher again replies no and gives the counterexample bb,which should be accepted by A2 but it is not. Therefore we putS ← S ∪ {b, bb}.

Step 3. The new table is the one on the left. It is closed, but ϵ andb violate consistency, when b is appended. Therefore we add thecolumn b and we get the table on the right, which is closed andconsistent. The new hypothesis is A3.

614

row(s)(e) = 1 �� se � L

Page 11: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

A = {a, b}

Observation table

states = {row(s) | s � S}{row(s) | s � S, row(s)(�) = 1}final states =

initial state = row(�)

row(s)a�� row(sa)

Hypothesis automaton{transition function

a aa

0 0 1

a 0 1 0

b 0 0 0

L⋆ LEARNER

1 S,E ← {ϵ}2 repeat3 while (S,E) is not closed or not consistent4 if (S,E) is not closed5 find s1 ∈ S, a ∈ A such that

row(s1a) ̸= row(s), for all s ∈ S6 S ← S ∪ {s1a}7 if (S,E) is not consistent8 find s1, s2 ∈ S, a ∈ A, and e ∈ E such that

row(s1) = row(s2) and L(s1ae) ̸= L(s2ae)9 E ← E ∪ {ae}

10 Make the conjecture M(S,E)11 if the Teacher replies no, with a counter-example t12 S ← S ∪ prefixes(t)13 until the Teacher replies yes to the conjecture M(S,E).14 return M(S,E)

Figure 1. Angluin’s algorithm for deterministic finite automata [3]

structures, which allows the programmer to rely on convenientintuitions of searching through infinite sets in finite time.

The paper is organized as follows. In Section 2, we present anoverview of our contributions (and the original algorithm) highlight-ing the challenges we faced in the various steps. In Section 3, werevise some basic concepts of nominal sets and automata. Section 4contains the core technical contributions of our paper: The newalgorithm and proof of correctness. In Section 5, we describe analgorithm to learn nominal non-deterministic automata. Section 6contains a description of NLambda, details of the implementation,and results of preliminary experiments. Section 7 contains a dis-cussion of related work. We conclude the paper with a discussionsection where also future directions are presented.

2. Overview of the Approach

In this section, we give an overview of the work developed in thepaper through examples. We will start by explaining the originalalgorithm for regular languages over finite alphabets, and thenexplain the challenges in extending it to nominal languages.

Angluin’s algorithm L⋆ provides a procedure to learn the minimalDFA accepting a certain (unknown) language L. The algorithm hasaccess to a teacher which answers two types of queries:• membership queries, consisting of a single word w ∈ A⋆, to

which the teacher will reply whether w ∈ L or not;

• equivalence queries, consisting of a hypothesis DFA H , towhich the teacher replies yes if L(H) = L, and no otherwise,providing a counterexample w ∈ L(H)△L (△ denotes thesymmetric difference of two languages).

The learning algorithm works by incrementally building an observa-tion table, which at each stage contains partial information about thelanguage L. The algorithm is able to fill the table with membershipqueries. As an example, and to set notation, consider the followingtable (over A = {a, b}).

E

ϵ a aa

S∪

S·A

ϵ 0 0 1

a 0 1 0b 0 0 0

S,E ⊆ A⋆

row : S ∪ S·A→ 2E

row(u)(v) = 1 ⇐⇒ uv ∈ L

This table indicates that L contains at least aa and definitelydoes not contain the words ϵ, a, b, ba, baa, aaa. Since row is fully

determined by the language L, we will from now on refer to anobservation table as a pair (S,E), leaving the language L implicit.

Given an observation table (S,E) one can construct a determin-istic automaton M(S,E) = (Q, q0, δ, F ) where• Q = {row(s) | s ∈ S} is a finite set of states;

• F = {row(s) | s ∈ S, row(s)(ϵ) = 1} ⊆ Q is the set of finalstates;

• q0 = row(ϵ) is the initial state;

• δ : Q × A → Q is the transition function given byδ(row(s), a) = row(sa).

For this to be well-defined, we need to have ϵ ∈ S (for the initialstate) and ϵ ∈ E (for final states), and for the transition functionthere are two crucial properties of the table that need to hold:Closedness and consistency. An observation table (S,E) is closedif for all t ∈ S·A there exists an s ∈ S such that row(t) = row(s).An observation table (S,E) is consistent if, whenever s1 and s2are elements of S such that row(s1) = row(s2), for all a ∈ A,row(s1a) = row(s2a). Each time the algorithm constructs anautomaton, it poses an equivalence query to the teacher. It terminateswhen the answer is yes, otherwise it extends the table with thecounterexample provided.

2.1 Simple Example of Execution

Angluin’s algorithm is displayed in Figure 1. Throughout thissection, we will consider the language(s)

Ln = {ww | w ∈ A⋆, |w| = n}

If the alphabet A is finite then Ln is regular for any n ∈ N, andthere is a finite DFA accepting it.

The language L1 = {aa, bb} looks trivial, but the minimal DFArecognizing it has as many as 5 states. Angluin’s algorithm willterminate in (at most) 5 steps. We illustrate some relevant ones.

Step 1. We start from S,E = {ϵ}, and we fill the entries of thetable below by asking membership queries for ϵ, a and b. The tableis closed and consistent, so we construct the hypothesis A1.

ϵ

ϵ 0

a 0b 0

A1 = q0 a, b

q0 = row(ϵ) = {ϵ +→ 0}

The Teacher replies no and gives the counterexample aa, which is inL1 but it is not accepted by A1. Therefore, line 12 of the algorithmis triggered and we set S ← S ∪ {a, aa}.

Step 2. The table becomes the one on the left below. It is closed,but not consistent: Rows ϵ and a are identical, but appending a leadsto different rows, as depicted. Therefore, line 9 is triggered and anextra column a, highlighted in red, is added. The new table is closedand consistent and a new hypothesis A2 is constructed.

ϵϵ 0a 0aa 1b 0ab 0aaa 0aab 0

ϵ aϵ 0 0a 0 1aa 1 0b 0 0ab 0 0aaa 0 0aab 0 0

A2 =

q0 q1

q2

b

a

b

aa, b

a

a

The Teacher again replies no and gives the counterexample bb,which should be accepted by A2 but it is not. Therefore we putS ← S ∪ {b, bb}.

Step 3. The new table is the one on the left. It is closed, but ϵ andb violate consistency, when b is appended. Therefore we add thecolumn b and we get the table on the right, which is closed andconsistent. The new hypothesis is A3.

614

S, E � A�

S

L⋆ LEARNER

1 S,E ← {ϵ}2 repeat3 while (S,E) is not closed or not consistent4 if (S,E) is not closed5 find s1 ∈ S, a ∈ A such that

row(s1a) ̸= row(s), for all s ∈ S6 S ← S ∪ {s1a}7 if (S,E) is not consistent8 find s1, s2 ∈ S, a ∈ A, and e ∈ E such that

row(s1) = row(s2) and L(s1ae) ̸= L(s2ae)9 E ← E ∪ {ae}

10 Make the conjecture M(S,E)11 if the Teacher replies no, with a counter-example t12 S ← S ∪ prefixes(t)13 until the Teacher replies yes to the conjecture M(S,E).14 return M(S,E)

Figure 1. Angluin’s algorithm for deterministic finite automata [3]

structures, which allows the programmer to rely on convenientintuitions of searching through infinite sets in finite time.

The paper is organized as follows. In Section 2, we present anoverview of our contributions (and the original algorithm) highlight-ing the challenges we faced in the various steps. In Section 3, werevise some basic concepts of nominal sets and automata. Section 4contains the core technical contributions of our paper: The newalgorithm and proof of correctness. In Section 5, we describe analgorithm to learn nominal non-deterministic automata. Section 6contains a description of NLambda, details of the implementation,and results of preliminary experiments. Section 7 contains a dis-cussion of related work. We conclude the paper with a discussionsection where also future directions are presented.

2. Overview of the Approach

In this section, we give an overview of the work developed in thepaper through examples. We will start by explaining the originalalgorithm for regular languages over finite alphabets, and thenexplain the challenges in extending it to nominal languages.

Angluin’s algorithm L⋆ provides a procedure to learn the minimalDFA accepting a certain (unknown) language L. The algorithm hasaccess to a teacher which answers two types of queries:• membership queries, consisting of a single word w ∈ A⋆, to

which the teacher will reply whether w ∈ L or not;

• equivalence queries, consisting of a hypothesis DFA H , towhich the teacher replies yes if L(H) = L, and no otherwise,providing a counterexample w ∈ L(H)△L (△ denotes thesymmetric difference of two languages).

The learning algorithm works by incrementally building an observa-tion table, which at each stage contains partial information about thelanguage L. The algorithm is able to fill the table with membershipqueries. As an example, and to set notation, consider the followingtable (over A = {a, b}).

E

ϵ a aa

S∪

S·A

ϵ 0 0 1

a 0 1 0b 0 0 0

S,E ⊆ A⋆

row : S ∪ S·A→ 2E

row(u)(v) = 1 ⇐⇒ uv ∈ L

This table indicates that L contains at least aa and definitelydoes not contain the words ϵ, a, b, ba, baa, aaa. Since row is fully

determined by the language L, we will from now on refer to anobservation table as a pair (S,E), leaving the language L implicit.

Given an observation table (S,E) one can construct a determin-istic automaton M(S,E) = (Q, q0, δ, F ) where• Q = {row(s) | s ∈ S} is a finite set of states;

• F = {row(s) | s ∈ S, row(s)(ϵ) = 1} ⊆ Q is the set of finalstates;

• q0 = row(ϵ) is the initial state;

• δ : Q × A → Q is the transition function given byδ(row(s), a) = row(sa).

For this to be well-defined, we need to have ϵ ∈ S (for the initialstate) and ϵ ∈ E (for final states), and for the transition functionthere are two crucial properties of the table that need to hold:Closedness and consistency. An observation table (S,E) is closedif for all t ∈ S·A there exists an s ∈ S such that row(t) = row(s).An observation table (S,E) is consistent if, whenever s1 and s2are elements of S such that row(s1) = row(s2), for all a ∈ A,row(s1a) = row(s2a). Each time the algorithm constructs anautomaton, it poses an equivalence query to the teacher. It terminateswhen the answer is yes, otherwise it extends the table with thecounterexample provided.

2.1 Simple Example of Execution

Angluin’s algorithm is displayed in Figure 1. Throughout thissection, we will consider the language(s)

Ln = {ww | w ∈ A⋆, |w| = n}

If the alphabet A is finite then Ln is regular for any n ∈ N, andthere is a finite DFA accepting it.

The language L1 = {aa, bb} looks trivial, but the minimal DFArecognizing it has as many as 5 states. Angluin’s algorithm willterminate in (at most) 5 steps. We illustrate some relevant ones.

Step 1. We start from S,E = {ϵ}, and we fill the entries of thetable below by asking membership queries for ϵ, a and b. The tableis closed and consistent, so we construct the hypothesis A1.

ϵ

ϵ 0

a 0b 0

A1 = q0 a, b

q0 = row(ϵ) = {ϵ +→ 0}

The Teacher replies no and gives the counterexample aa, which is inL1 but it is not accepted by A1. Therefore, line 12 of the algorithmis triggered and we set S ← S ∪ {a, aa}.

Step 2. The table becomes the one on the left below. It is closed,but not consistent: Rows ϵ and a are identical, but appending a leadsto different rows, as depicted. Therefore, line 9 is triggered and anextra column a, highlighted in red, is added. The new table is closedand consistent and a new hypothesis A2 is constructed.

ϵϵ 0a 0aa 1b 0ab 0aaa 0aab 0

ϵ aϵ 0 0a 0 1aa 1 0b 0 0ab 0 0aaa 0 0aab 0 0

A2 =

q0 q1

q2

b

a

b

aa, b

a

a

The Teacher again replies no and gives the counterexample bb,which should be accepted by A2 but it is not. Therefore we putS ← S ∪ {b, bb}.

Step 3. The new table is the one on the left. It is closed, but ϵ andb violate consistency, when b is appended. Therefore we add thecolumn b and we get the table on the right, which is closed andconsistent. The new hypothesis is A3.

614

L⋆ LEARNER

1 S,E ← {ϵ}2 repeat3 while (S,E) is not closed or not consistent4 if (S,E) is not closed5 find s1 ∈ S, a ∈ A such that

row(s1a) ̸= row(s), for all s ∈ S6 S ← S ∪ {s1a}7 if (S,E) is not consistent8 find s1, s2 ∈ S, a ∈ A, and e ∈ E such that

row(s1) = row(s2) and L(s1ae) ̸= L(s2ae)9 E ← E ∪ {ae}

10 Make the conjecture M(S,E)11 if the Teacher replies no, with a counter-example t12 S ← S ∪ prefixes(t)13 until the Teacher replies yes to the conjecture M(S,E).14 return M(S,E)

Figure 1. Angluin’s algorithm for deterministic finite automata [3]

structures, which allows the programmer to rely on convenientintuitions of searching through infinite sets in finite time.

The paper is organized as follows. In Section 2, we present anoverview of our contributions (and the original algorithm) highlight-ing the challenges we faced in the various steps. In Section 3, werevise some basic concepts of nominal sets and automata. Section 4contains the core technical contributions of our paper: The newalgorithm and proof of correctness. In Section 5, we describe analgorithm to learn nominal non-deterministic automata. Section 6contains a description of NLambda, details of the implementation,and results of preliminary experiments. Section 7 contains a dis-cussion of related work. We conclude the paper with a discussionsection where also future directions are presented.

2. Overview of the Approach

In this section, we give an overview of the work developed in thepaper through examples. We will start by explaining the originalalgorithm for regular languages over finite alphabets, and thenexplain the challenges in extending it to nominal languages.

Angluin’s algorithm L⋆ provides a procedure to learn the minimalDFA accepting a certain (unknown) language L. The algorithm hasaccess to a teacher which answers two types of queries:• membership queries, consisting of a single word w ∈ A⋆, to

which the teacher will reply whether w ∈ L or not;

• equivalence queries, consisting of a hypothesis DFA H , towhich the teacher replies yes if L(H) = L, and no otherwise,providing a counterexample w ∈ L(H)△L (△ denotes thesymmetric difference of two languages).

The learning algorithm works by incrementally building an observa-tion table, which at each stage contains partial information about thelanguage L. The algorithm is able to fill the table with membershipqueries. As an example, and to set notation, consider the followingtable (over A = {a, b}).

E

ϵ a aa

S∪

S·A

ϵ 0 0 1

a 0 1 0b 0 0 0

S,E ⊆ A⋆

row : S ∪ S·A→ 2E

row(u)(v) = 1 ⇐⇒ uv ∈ L

This table indicates that L contains at least aa and definitelydoes not contain the words ϵ, a, b, ba, baa, aaa. Since row is fully

determined by the language L, we will from now on refer to anobservation table as a pair (S,E), leaving the language L implicit.

Given an observation table (S,E) one can construct a determin-istic automaton M(S,E) = (Q, q0, δ, F ) where• Q = {row(s) | s ∈ S} is a finite set of states;

• F = {row(s) | s ∈ S, row(s)(ϵ) = 1} ⊆ Q is the set of finalstates;

• q0 = row(ϵ) is the initial state;

• δ : Q × A → Q is the transition function given byδ(row(s), a) = row(sa).

For this to be well-defined, we need to have ϵ ∈ S (for the initialstate) and ϵ ∈ E (for final states), and for the transition functionthere are two crucial properties of the table that need to hold:Closedness and consistency. An observation table (S,E) is closedif for all t ∈ S·A there exists an s ∈ S such that row(t) = row(s).An observation table (S,E) is consistent if, whenever s1 and s2are elements of S such that row(s1) = row(s2), for all a ∈ A,row(s1a) = row(s2a). Each time the algorithm constructs anautomaton, it poses an equivalence query to the teacher. It terminateswhen the answer is yes, otherwise it extends the table with thecounterexample provided.

2.1 Simple Example of Execution

Angluin’s algorithm is displayed in Figure 1. Throughout thissection, we will consider the language(s)

Ln = {ww | w ∈ A⋆, |w| = n}

If the alphabet A is finite then Ln is regular for any n ∈ N, andthere is a finite DFA accepting it.

The language L1 = {aa, bb} looks trivial, but the minimal DFArecognizing it has as many as 5 states. Angluin’s algorithm willterminate in (at most) 5 steps. We illustrate some relevant ones.

Step 1. We start from S,E = {ϵ}, and we fill the entries of thetable below by asking membership queries for ϵ, a and b. The tableis closed and consistent, so we construct the hypothesis A1.

ϵ

ϵ 0

a 0b 0

A1 = q0 a, b

q0 = row(ϵ) = {ϵ +→ 0}

The Teacher replies no and gives the counterexample aa, which is inL1 but it is not accepted by A1. Therefore, line 12 of the algorithmis triggered and we set S ← S ∪ {a, aa}.

Step 2. The table becomes the one on the left below. It is closed,but not consistent: Rows ϵ and a are identical, but appending a leadsto different rows, as depicted. Therefore, line 9 is triggered and anextra column a, highlighted in red, is added. The new table is closedand consistent and a new hypothesis A2 is constructed.

ϵϵ 0a 0aa 1b 0ab 0aaa 0aab 0

ϵ aϵ 0 0a 0 1aa 1 0b 0 0ab 0 0aaa 0 0aab 0 0

A2 =

q0 q1

q2

b

a

b

aa, b

a

a

The Teacher again replies no and gives the counterexample bb,which should be accepted by A2 but it is not. Therefore we putS ← S ∪ {b, bb}.

Step 3. The new table is the one on the left. It is closed, but ϵ andb violate consistency, when b is appended. Therefore we add thecolumn b and we get the table on the right, which is closed andconsistent. The new hypothesis is A3.

614

row(s)(e) = 1 �� se � L

Page 12: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

A = {a, b}

Observation table

states = {row(s) | s � S}{row(s) | s � S, row(s)(�) = 1}final states =

initial state = row(�)

row(s)a�� row(sa)

Hypothesis automaton{transition function

a aa

0 0 1

a 0 1 0

b 0 0 0

L⋆ LEARNER

1 S,E ← {ϵ}2 repeat3 while (S,E) is not closed or not consistent4 if (S,E) is not closed5 find s1 ∈ S, a ∈ A such that

row(s1a) ̸= row(s), for all s ∈ S6 S ← S ∪ {s1a}7 if (S,E) is not consistent8 find s1, s2 ∈ S, a ∈ A, and e ∈ E such that

row(s1) = row(s2) and L(s1ae) ̸= L(s2ae)9 E ← E ∪ {ae}

10 Make the conjecture M(S,E)11 if the Teacher replies no, with a counter-example t12 S ← S ∪ prefixes(t)13 until the Teacher replies yes to the conjecture M(S,E).14 return M(S,E)

Figure 1. Angluin’s algorithm for deterministic finite automata [3]

structures, which allows the programmer to rely on convenientintuitions of searching through infinite sets in finite time.

The paper is organized as follows. In Section 2, we present anoverview of our contributions (and the original algorithm) highlight-ing the challenges we faced in the various steps. In Section 3, werevise some basic concepts of nominal sets and automata. Section 4contains the core technical contributions of our paper: The newalgorithm and proof of correctness. In Section 5, we describe analgorithm to learn nominal non-deterministic automata. Section 6contains a description of NLambda, details of the implementation,and results of preliminary experiments. Section 7 contains a dis-cussion of related work. We conclude the paper with a discussionsection where also future directions are presented.

2. Overview of the Approach

In this section, we give an overview of the work developed in thepaper through examples. We will start by explaining the originalalgorithm for regular languages over finite alphabets, and thenexplain the challenges in extending it to nominal languages.

Angluin’s algorithm L⋆ provides a procedure to learn the minimalDFA accepting a certain (unknown) language L. The algorithm hasaccess to a teacher which answers two types of queries:• membership queries, consisting of a single word w ∈ A⋆, to

which the teacher will reply whether w ∈ L or not;

• equivalence queries, consisting of a hypothesis DFA H , towhich the teacher replies yes if L(H) = L, and no otherwise,providing a counterexample w ∈ L(H)△L (△ denotes thesymmetric difference of two languages).

The learning algorithm works by incrementally building an observa-tion table, which at each stage contains partial information about thelanguage L. The algorithm is able to fill the table with membershipqueries. As an example, and to set notation, consider the followingtable (over A = {a, b}).

E

ϵ a aa

S∪

S·A

ϵ 0 0 1

a 0 1 0b 0 0 0

S,E ⊆ A⋆

row : S ∪ S·A→ 2E

row(u)(v) = 1 ⇐⇒ uv ∈ L

This table indicates that L contains at least aa and definitelydoes not contain the words ϵ, a, b, ba, baa, aaa. Since row is fully

determined by the language L, we will from now on refer to anobservation table as a pair (S,E), leaving the language L implicit.

Given an observation table (S,E) one can construct a determin-istic automaton M(S,E) = (Q, q0, δ, F ) where• Q = {row(s) | s ∈ S} is a finite set of states;

• F = {row(s) | s ∈ S, row(s)(ϵ) = 1} ⊆ Q is the set of finalstates;

• q0 = row(ϵ) is the initial state;

• δ : Q × A → Q is the transition function given byδ(row(s), a) = row(sa).

For this to be well-defined, we need to have ϵ ∈ S (for the initialstate) and ϵ ∈ E (for final states), and for the transition functionthere are two crucial properties of the table that need to hold:Closedness and consistency. An observation table (S,E) is closedif for all t ∈ S·A there exists an s ∈ S such that row(t) = row(s).An observation table (S,E) is consistent if, whenever s1 and s2are elements of S such that row(s1) = row(s2), for all a ∈ A,row(s1a) = row(s2a). Each time the algorithm constructs anautomaton, it poses an equivalence query to the teacher. It terminateswhen the answer is yes, otherwise it extends the table with thecounterexample provided.

2.1 Simple Example of Execution

Angluin’s algorithm is displayed in Figure 1. Throughout thissection, we will consider the language(s)

Ln = {ww | w ∈ A⋆, |w| = n}

If the alphabet A is finite then Ln is regular for any n ∈ N, andthere is a finite DFA accepting it.

The language L1 = {aa, bb} looks trivial, but the minimal DFArecognizing it has as many as 5 states. Angluin’s algorithm willterminate in (at most) 5 steps. We illustrate some relevant ones.

Step 1. We start from S,E = {ϵ}, and we fill the entries of thetable below by asking membership queries for ϵ, a and b. The tableis closed and consistent, so we construct the hypothesis A1.

ϵ

ϵ 0

a 0b 0

A1 = q0 a, b

q0 = row(ϵ) = {ϵ +→ 0}

The Teacher replies no and gives the counterexample aa, which is inL1 but it is not accepted by A1. Therefore, line 12 of the algorithmis triggered and we set S ← S ∪ {a, aa}.

Step 2. The table becomes the one on the left below. It is closed,but not consistent: Rows ϵ and a are identical, but appending a leadsto different rows, as depicted. Therefore, line 9 is triggered and anextra column a, highlighted in red, is added. The new table is closedand consistent and a new hypothesis A2 is constructed.

ϵϵ 0a 0aa 1b 0ab 0aaa 0aab 0

ϵ aϵ 0 0a 0 1aa 1 0b 0 0ab 0 0aaa 0 0aab 0 0

A2 =

q0 q1

q2

b

a

b

aa, b

a

a

The Teacher again replies no and gives the counterexample bb,which should be accepted by A2 but it is not. Therefore we putS ← S ∪ {b, bb}.

Step 3. The new table is the one on the left. It is closed, but ϵ andb violate consistency, when b is appended. Therefore we add thecolumn b and we get the table on the right, which is closed andconsistent. The new hypothesis is A3.

614

S, E � A�

S

L⋆ LEARNER

1 S,E ← {ϵ}2 repeat3 while (S,E) is not closed or not consistent4 if (S,E) is not closed5 find s1 ∈ S, a ∈ A such that

row(s1a) ̸= row(s), for all s ∈ S6 S ← S ∪ {s1a}7 if (S,E) is not consistent8 find s1, s2 ∈ S, a ∈ A, and e ∈ E such that

row(s1) = row(s2) and L(s1ae) ̸= L(s2ae)9 E ← E ∪ {ae}

10 Make the conjecture M(S,E)11 if the Teacher replies no, with a counter-example t12 S ← S ∪ prefixes(t)13 until the Teacher replies yes to the conjecture M(S,E).14 return M(S,E)

Figure 1. Angluin’s algorithm for deterministic finite automata [3]

structures, which allows the programmer to rely on convenientintuitions of searching through infinite sets in finite time.

The paper is organized as follows. In Section 2, we present anoverview of our contributions (and the original algorithm) highlight-ing the challenges we faced in the various steps. In Section 3, werevise some basic concepts of nominal sets and automata. Section 4contains the core technical contributions of our paper: The newalgorithm and proof of correctness. In Section 5, we describe analgorithm to learn nominal non-deterministic automata. Section 6contains a description of NLambda, details of the implementation,and results of preliminary experiments. Section 7 contains a dis-cussion of related work. We conclude the paper with a discussionsection where also future directions are presented.

2. Overview of the Approach

In this section, we give an overview of the work developed in thepaper through examples. We will start by explaining the originalalgorithm for regular languages over finite alphabets, and thenexplain the challenges in extending it to nominal languages.

Angluin’s algorithm L⋆ provides a procedure to learn the minimalDFA accepting a certain (unknown) language L. The algorithm hasaccess to a teacher which answers two types of queries:• membership queries, consisting of a single word w ∈ A⋆, to

which the teacher will reply whether w ∈ L or not;

• equivalence queries, consisting of a hypothesis DFA H , towhich the teacher replies yes if L(H) = L, and no otherwise,providing a counterexample w ∈ L(H)△L (△ denotes thesymmetric difference of two languages).

The learning algorithm works by incrementally building an observa-tion table, which at each stage contains partial information about thelanguage L. The algorithm is able to fill the table with membershipqueries. As an example, and to set notation, consider the followingtable (over A = {a, b}).

E

ϵ a aa

S∪

S·A

ϵ 0 0 1

a 0 1 0b 0 0 0

S,E ⊆ A⋆

row : S ∪ S·A→ 2E

row(u)(v) = 1 ⇐⇒ uv ∈ L

This table indicates that L contains at least aa and definitelydoes not contain the words ϵ, a, b, ba, baa, aaa. Since row is fully

determined by the language L, we will from now on refer to anobservation table as a pair (S,E), leaving the language L implicit.

Given an observation table (S,E) one can construct a determin-istic automaton M(S,E) = (Q, q0, δ, F ) where• Q = {row(s) | s ∈ S} is a finite set of states;

• F = {row(s) | s ∈ S, row(s)(ϵ) = 1} ⊆ Q is the set of finalstates;

• q0 = row(ϵ) is the initial state;

• δ : Q × A → Q is the transition function given byδ(row(s), a) = row(sa).

For this to be well-defined, we need to have ϵ ∈ S (for the initialstate) and ϵ ∈ E (for final states), and for the transition functionthere are two crucial properties of the table that need to hold:Closedness and consistency. An observation table (S,E) is closedif for all t ∈ S·A there exists an s ∈ S such that row(t) = row(s).An observation table (S,E) is consistent if, whenever s1 and s2are elements of S such that row(s1) = row(s2), for all a ∈ A,row(s1a) = row(s2a). Each time the algorithm constructs anautomaton, it poses an equivalence query to the teacher. It terminateswhen the answer is yes, otherwise it extends the table with thecounterexample provided.

2.1 Simple Example of Execution

Angluin’s algorithm is displayed in Figure 1. Throughout thissection, we will consider the language(s)

Ln = {ww | w ∈ A⋆, |w| = n}

If the alphabet A is finite then Ln is regular for any n ∈ N, andthere is a finite DFA accepting it.

The language L1 = {aa, bb} looks trivial, but the minimal DFArecognizing it has as many as 5 states. Angluin’s algorithm willterminate in (at most) 5 steps. We illustrate some relevant ones.

Step 1. We start from S,E = {ϵ}, and we fill the entries of thetable below by asking membership queries for ϵ, a and b. The tableis closed and consistent, so we construct the hypothesis A1.

ϵ

ϵ 0

a 0b 0

A1 = q0 a, b

q0 = row(ϵ) = {ϵ +→ 0}

The Teacher replies no and gives the counterexample aa, which is inL1 but it is not accepted by A1. Therefore, line 12 of the algorithmis triggered and we set S ← S ∪ {a, aa}.

Step 2. The table becomes the one on the left below. It is closed,but not consistent: Rows ϵ and a are identical, but appending a leadsto different rows, as depicted. Therefore, line 9 is triggered and anextra column a, highlighted in red, is added. The new table is closedand consistent and a new hypothesis A2 is constructed.

ϵϵ 0a 0aa 1b 0ab 0aaa 0aab 0

ϵ aϵ 0 0a 0 1aa 1 0b 0 0ab 0 0aaa 0 0aab 0 0

A2 =

q0 q1

q2

b

a

b

aa, b

a

a

The Teacher again replies no and gives the counterexample bb,which should be accepted by A2 but it is not. Therefore we putS ← S ∪ {b, bb}.

Step 3. The new table is the one on the left. It is closed, but ϵ andb violate consistency, when b is appended. Therefore we add thecolumn b and we get the table on the right, which is closed andconsistent. The new hypothesis is A3.

614

L⋆ LEARNER

1 S,E ← {ϵ}2 repeat3 while (S,E) is not closed or not consistent4 if (S,E) is not closed5 find s1 ∈ S, a ∈ A such that

row(s1a) ̸= row(s), for all s ∈ S6 S ← S ∪ {s1a}7 if (S,E) is not consistent8 find s1, s2 ∈ S, a ∈ A, and e ∈ E such that

row(s1) = row(s2) and L(s1ae) ̸= L(s2ae)9 E ← E ∪ {ae}

10 Make the conjecture M(S,E)11 if the Teacher replies no, with a counter-example t12 S ← S ∪ prefixes(t)13 until the Teacher replies yes to the conjecture M(S,E).14 return M(S,E)

Figure 1. Angluin’s algorithm for deterministic finite automata [3]

structures, which allows the programmer to rely on convenientintuitions of searching through infinite sets in finite time.

The paper is organized as follows. In Section 2, we present anoverview of our contributions (and the original algorithm) highlight-ing the challenges we faced in the various steps. In Section 3, werevise some basic concepts of nominal sets and automata. Section 4contains the core technical contributions of our paper: The newalgorithm and proof of correctness. In Section 5, we describe analgorithm to learn nominal non-deterministic automata. Section 6contains a description of NLambda, details of the implementation,and results of preliminary experiments. Section 7 contains a dis-cussion of related work. We conclude the paper with a discussionsection where also future directions are presented.

2. Overview of the Approach

In this section, we give an overview of the work developed in thepaper through examples. We will start by explaining the originalalgorithm for regular languages over finite alphabets, and thenexplain the challenges in extending it to nominal languages.

Angluin’s algorithm L⋆ provides a procedure to learn the minimalDFA accepting a certain (unknown) language L. The algorithm hasaccess to a teacher which answers two types of queries:• membership queries, consisting of a single word w ∈ A⋆, to

which the teacher will reply whether w ∈ L or not;

• equivalence queries, consisting of a hypothesis DFA H , towhich the teacher replies yes if L(H) = L, and no otherwise,providing a counterexample w ∈ L(H)△L (△ denotes thesymmetric difference of two languages).

The learning algorithm works by incrementally building an observa-tion table, which at each stage contains partial information about thelanguage L. The algorithm is able to fill the table with membershipqueries. As an example, and to set notation, consider the followingtable (over A = {a, b}).

E

ϵ a aa

S∪

S·A

ϵ 0 0 1

a 0 1 0b 0 0 0

S,E ⊆ A⋆

row : S ∪ S·A→ 2E

row(u)(v) = 1 ⇐⇒ uv ∈ L

This table indicates that L contains at least aa and definitelydoes not contain the words ϵ, a, b, ba, baa, aaa. Since row is fully

determined by the language L, we will from now on refer to anobservation table as a pair (S,E), leaving the language L implicit.

Given an observation table (S,E) one can construct a determin-istic automaton M(S,E) = (Q, q0, δ, F ) where• Q = {row(s) | s ∈ S} is a finite set of states;

• F = {row(s) | s ∈ S, row(s)(ϵ) = 1} ⊆ Q is the set of finalstates;

• q0 = row(ϵ) is the initial state;

• δ : Q × A → Q is the transition function given byδ(row(s), a) = row(sa).

For this to be well-defined, we need to have ϵ ∈ S (for the initialstate) and ϵ ∈ E (for final states), and for the transition functionthere are two crucial properties of the table that need to hold:Closedness and consistency. An observation table (S,E) is closedif for all t ∈ S·A there exists an s ∈ S such that row(t) = row(s).An observation table (S,E) is consistent if, whenever s1 and s2are elements of S such that row(s1) = row(s2), for all a ∈ A,row(s1a) = row(s2a). Each time the algorithm constructs anautomaton, it poses an equivalence query to the teacher. It terminateswhen the answer is yes, otherwise it extends the table with thecounterexample provided.

2.1 Simple Example of Execution

Angluin’s algorithm is displayed in Figure 1. Throughout thissection, we will consider the language(s)

Ln = {ww | w ∈ A⋆, |w| = n}

If the alphabet A is finite then Ln is regular for any n ∈ N, andthere is a finite DFA accepting it.

The language L1 = {aa, bb} looks trivial, but the minimal DFArecognizing it has as many as 5 states. Angluin’s algorithm willterminate in (at most) 5 steps. We illustrate some relevant ones.

Step 1. We start from S,E = {ϵ}, and we fill the entries of thetable below by asking membership queries for ϵ, a and b. The tableis closed and consistent, so we construct the hypothesis A1.

ϵ

ϵ 0

a 0b 0

A1 = q0 a, b

q0 = row(ϵ) = {ϵ +→ 0}

The Teacher replies no and gives the counterexample aa, which is inL1 but it is not accepted by A1. Therefore, line 12 of the algorithmis triggered and we set S ← S ∪ {a, aa}.

Step 2. The table becomes the one on the left below. It is closed,but not consistent: Rows ϵ and a are identical, but appending a leadsto different rows, as depicted. Therefore, line 9 is triggered and anextra column a, highlighted in red, is added. The new table is closedand consistent and a new hypothesis A2 is constructed.

ϵϵ 0a 0aa 1b 0ab 0aaa 0aab 0

ϵ aϵ 0 0a 0 1aa 1 0b 0 0ab 0 0aaa 0 0aab 0 0

A2 =

q0 q1

q2

b

a

b

aa, b

a

a

The Teacher again replies no and gives the counterexample bb,which should be accepted by A2 but it is not. Therefore we putS ← S ∪ {b, bb}.

Step 3. The new table is the one on the left. It is closed, but ϵ andb violate consistency, when b is appended. Therefore we add thecolumn b and we get the table on the right, which is closed andconsistent. The new hypothesis is A3.

614

row(s)(e) = 1 �� se � L

Why is this correct?

Page 13: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

Table properties

Page 14: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

Table properties

Closed

8t 2 S ·A 9s 2 S row(t) = row(s).

Page 15: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

Table properties

Closed

8t 2 S ·A 9s 2 S row(t) = row(s).

row(s)a�� row(sa)

Page 16: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

Table properties

Closed

8t 2 S ·A 9s 2 S row(t) = row(s).

next state existsrow(s)

a�� row(sa)

Page 17: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

Table properties

Closed

8t 2 S ·A 9s 2 S row(t) = row(s).

next state exists

Consistent

�s1, s2 � S row(s1) = row(s2) =� �a � A row(s1a) = row(s2a)

row(s)a�� row(sa)

Page 18: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

Table properties

Closed

8t 2 S ·A 9s 2 S row(t) = row(s).

next state exists

determinism

Consistent

�s1, s2 � S row(s1) = row(s2) =� �a � A row(s1a) = row(s2a)

row(s)a�� row(sa)

Page 19: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

Table properties

Closed

8t 2 S ·A 9s 2 S row(t) = row(s).

next state exists

determinism

Consistent

�s1, s2 � S row(s1) = row(s2) =� �a � A row(s1a) = row(s2a)

row(s)a�� row(sa)

Fixed by extending the table

Page 20: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

Pros of L* …

Applications : Hardware verification, security/network protocols…

Generalizations : Mealy machines, I/O automata, …

simple is beautiful POWERFUL&

Page 21: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

Non-deterministic

Weighted

Register

Mealy Machines

A zoo of automataAlternating

Universal

Probabilistic

Page 22: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

Non-deterministic

Weighted

Register

Mealy Machines

Algorithms Correctness proofs

involved and hard to check

A zoo of automataAlternating

Universal

Probabilistic

Page 23: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

Non-deterministic

Weighted

Register

Mealy Machines

Algorithms Correctness proofs

involved and hard to check

A zoo of automataAlternating

Universal

Probabilistic

Category theory comes to the rescue!

Page 24: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

Abstract automata

DFAs

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FQ

Q

I Y

”Q

outQinitQ

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FQ

Q

I Y

”Q

outQinitQ

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FQ

Q

I Y

”Q

outQinitQ

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

Endofunctor = automaton typeF : C � C

Category = universe of state-spacesC

Page 25: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

Abstract automata

DFAs

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FQ

Q

I Y

”Q

outQinitQ

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FQ

Q

I Y

”Q

outQinitQ

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FQ

Q

I Y

”Q

outQinitQ

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

Endofunctor = automaton typeF : C � C

Category = universe of state-spacesC

DFAs

F = (�)⇥A

C = Set

Page 26: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

Abstract automata

DFAs

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FQ

Q

I Y

”Q

outQinitQ

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FQ

Q

I Y

”Q

outQinitQ

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FQ

Q

I Y

”Q

outQinitQ

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

Endofunctor = automaton typeF : C � C

Category = universe of state-spacesC

Q⇥ADFAs

F = (�)⇥A

C = Set

Page 27: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

Abstract automata

DFAs

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FQ

Q

I Y

”Q

outQinitQ

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FQ

Q

I Y

”Q

outQinitQ

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FQ

Q

I Y

”Q

outQinitQ

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

Endofunctor = automaton typeF : C � C

Category = universe of state-spacesC

Q⇥A

1

DFAs

F = (�)⇥A

C = Set

Page 28: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

Abstract automata

DFAs

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FQ

Q

I Y

”Q

outQinitQ

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FQ

Q

I Y

”Q

outQinitQ

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FQ

Q

I Y

”Q

outQinitQ

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

Endofunctor = automaton typeF : C � C

Category = universe of state-spacesC

Q⇥A

1q0 2 Q

DFAs

F = (�)⇥A

C = Set

Page 29: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

Abstract automata

DFAs

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FQ

Q

I Y

”Q

outQinitQ

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FQ

Q

I Y

”Q

outQinitQ

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FQ

Q

I Y

”Q

outQinitQ

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

Endofunctor = automaton typeF : C � C

Category = universe of state-spacesC

Q⇥A

1q0 2 Q

2

DFAs

F = (�)⇥A

C = Set

Page 30: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

Abstract automata

DFAs

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FQ

Q

I Y

”Q

outQinitQ

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FQ

Q

I Y

”Q

outQinitQ

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FQ

Q

I Y

”Q

outQinitQ

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

Endofunctor = automaton typeF : C � C

Category = universe of state-spacesC

Q⇥A

1q0 2 Q F ✓ Q

2

DFAs

F = (�)⇥A

C = Set

Page 31: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

Abstract learning

Abstract observation data structure

Page 32: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

Abstract learning

Abstract observation data structure

approximates

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FQ

Q

I Y

”Q

outQinitQ

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FQ

Q

I Y

”Q

outQinitQ

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FQ

Q

I Y

”Q

outQinitQ

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

Target minimal automaton

Page 33: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

Abstract learning

Abstract observation data structure

approximates

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FQ

Q

I Y

”Q

outQinitQ

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FQ

Q

I Y

”Q

outQinitQ

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FQ

Q

I Y

”Q

outQinitQ

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

Target minimal automaton

Hypothesis automaton

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FH

H

I Y

”H

outHinitH

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

abstract closedness and consistency

Page 34: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

Abstract learning

Abstract observation data structure

General correctness theorem=Guidelines for implementation

approximates

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FQ

Q

I Y

”Q

outQinitQ

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FQ

Q

I Y

”Q

outQinitQ

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FQ

Q

I Y

”Q

outQinitQ

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

Target minimal automaton

Hypothesis automaton

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FH

H

I Y

”H

outHinitH

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

abstract closedness and consistency

Page 35: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

Abstract learning

Abstract observation data structure

General correctness theorem=Guidelines for implementation

approximates

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FQ

Q

I Y

”Q

outQinitQ

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FQ

Q

I Y

”Q

outQinitQ

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FQ

Q

I Y

”Q

outQinitQ

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

Target minimal automaton

Hypothesis automaton

Gerco van Heerdt, Matteo Sammartino, and Alexandra Silva 7

property stating that for all s1

, s2

œ S such that ›(s1

) = ›(s2

) we must have L(s1

) = L(s2

).The Lı algorithm ensures this by having Á œ E, using that L(s) = ›(s)(Á) for any s œ S.

4 A General Correctness Theorem

In this section we work towards a general correctness theorem. We then show how it appliesto the ID algorithm, to the algorithm by Arbib and Zeiger and to Lı.

S T

H P

e fi„

m

S H

T P

e

‡ mÂ

fi

(3)

The key observation for the correctness theoremis the following. Let w = (S ୾ T, T

fi≠æ P ) bea wrapper with minimization (S e≠æ H, H

m≠æ P ).If ‡ œ E , then the factorization system gives us aunique diagonal „ in the left square of (3), which by (the dual of) Proposition ?? satisfies„ œ E . Similarly, if fi œ M, we have  in the right square of (3), with  œ M. Composing thetwo diagrams and using again the diagonal property, one sees that „ and  must be mutuallyinverse. We can conclude that H and T are isomorphic. Now, if w is a wrapper producedby a learning algorithm and T is the state space of the target minimal automaton, as inExample 2, our reasoning hints at a correctness criterion: ‡ œ E and fi œ M upon terminationensure that H is (isomorphic to) T . Of course, the criterion will have to guarantee that theautomata, not just the state spaces, are isomorphic.

We first show that the argument above lifts to F -algebras f : FT æ T , for an arbitraryendofunctor F : C æ C preserving E .

I Lemma 11. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E, then w is f -closed; iffi œ M, then w is f-consistent.

Proof. If ‡ œ E , then let „ be as in (3) and define closef = „ ¶ f ¶ F‡; if fi œ M, then let Âbe as in (3) and define consf = fi ¶ f ¶ FÂ. J

I Proposition 12. For a wrapper w = (‡, fi) and an F -algebra f , if ‡ œ E and w is f-consistent, then „ as given in (3) is an F -algebra homomorphism (T, f) æ (H, ◊f ); if fi œ Mand w is f-closed, then  as given in (3) is an F -algebra homomorphism (H, ◊f ) æ (T, f).Proof. Assume that ‡ œ E and w is FT T H

FS P

FT FH H

f „

fi m›f

F ‡ F e closef

F ‡ 1

2

F „

3

4

5

◊f

m

1 definition of ›f

2 (3)3 functoriality, (3)4 definition of ◊f

5 closedness

f -consistent. The proof for the otherpart is analogous. Using Lemma 11 wesee that ◊f indeed exists. Because F‡is epic and m monic, it su�ces to showm¶„¶f ¶F‡ = m¶◊f ¶F„¶F‡, whichis done on the right. (The definition of◊f can be found in the proof of Proposition 9.) J

I Corollary 13. If ‡ œ E and fi œ M, then „ as given in (3) is an F -algebra isomorphism(T, f) æ (H, ◊f ).

Now we enrich F -algebras with initial and final states, obtaining a notion of automaton in acategory. Then we give the full correctness theorem for automata. We fix objects I and Y inC, which will serve as initial state selector and output of the automaton, respectively.I Definition 14 (Automaton). An automaton in C is an object Q FH

H

I Y

”H

outHinitH

of C equipped with an initial state map initQ : I æ Q, an outputmap outQ : Q æ Y , and dynamics ”Q : FQ æ Q. An input systemis an automaton without an output map; an output system is anautomaton without an initial state map.

abstract closedness and consistency

CALF: Categorical Automata Learning FrameworkGerco van Heerdt, Matteo Sammartino, Alexandra Silva

(arXiv:1704.05676)

Page 36: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

Degrees of freedom

Page 37: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

NomVect

Set DFAsNominal automataWeighted automata

Change base category

Degrees of freedom

Page 38: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

NomVect

Set DFAsNominal automataWeighted automata

Change base category

Degrees of freedom

Side-effects (via monads)NFAs

Partial automataUniversal automata

PowersetPowerset with intersection

Maybe monad

Page 39: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

NomVect

Set DFAsNominal automataWeighted automata

Change base categoryObservation tables

Discrimination trees

Change main data structure

Degrees of freedom

Side-effects (via monads)NFAs

Partial automataUniversal automata

PowersetPowerset with intersection

Maybe monad

Page 40: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

NomVect

Set DFAsNominal automataWeighted automata

Change base categoryObservation tables

Discrimination trees

Change main data structureLearning Nominal Automata (POPL ’17)Joshua Moerman, Matteo Sammartino, Alexandra Silva, Bartek Klin, Michal Szynwelski

Degrees of freedom

Side-effects (via monads)NFAs

Partial automataUniversal automata

PowersetPowerset with intersection

Maybe monad

Page 41: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

NomVect

Set DFAsNominal automataWeighted automata

Change base categoryObservation tables

Discrimination trees

Change main data structureLearning Nominal Automata (POPL ’17)Joshua Moerman, Matteo Sammartino, Alexandra Silva, Bartek Klin, Michal Szynwelski

Degrees of freedom

Side-effects (via monads)NFAs

Partial automataUniversal automata

PowersetPowerset with intersection

Maybe monad

Learning Automata with Side-effectsGerco van Heerdt, Matteo Sammartino, Alexandra Silva

(arXiv:1704.08055)

Page 42: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

Automaton type

Optimizations

Minimization algorithms Testing algorithms

Automata Learning algorithms

Connections with other algorithms

Page 43: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is
Page 44: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

Abstraction helps a lot …

Page 45: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

Abstraction helps a lot …

but there is no free lunch!

Page 46: Categorical Automata Learning Framework · Step 1. We start from S,E = {ϵ}, and we fill the entries of the table below by asking membership queries for ϵ, a and b. The table is

Ongoing and future work

• Tool to learn control + data-flow models (as nominal automata)

• Applications:

• Specification mining • Network verification, with • Verification of cryptographic protocols • Ransomware detection