Professional Documents
Culture Documents
Version 2024.1
‚ Instructors: Sjouke Mauw, Reynaldo Gil-Pons and Manel
Jerbi.
‚ Format: 14 lectures, 14 practical work sessions.
‚ Lecture notes & slides: Informal, for internal UL use only.
‚ Book: Michael Sipser, Introduction to the Theory of
Computation, 3rd Ed. (EMEA adaptation), Cengage Learning,
2013.
Evaluation
‚ What is a computer?
‚ What is a computation?
‚ What can be computed?
‚ Example:
a b c
Graphs
‚ Example:
a b c
‚ A graph is defined by the structure G “ pV , E q, where
‚ V is a set of vertices, and
‚ E Ď V ˆ V is a set of edges.
This graph is represented by the structure pV , E q, where
‚ V “ ta, b, cu, and
‚ E “ tpa, bq, pb, aq, pb, bq, pb, cqu
Graphs
‚ Example:
a b c
‚ A graph is defined by the structure G “ pV , E q, where
‚ V is a set of vertices, and
‚ E Ď V ˆ V is a set of edges.
This graph is represented by the structure pV , E q, where
‚ V “ ta, b, cu, and
‚ E “ tpa, bq, pb, aq, pb, bq, pb, cqu
‚ Edges can be labeled.
‚ A path is a sequence of nodes connected by edges.
Example: the sequence ababbbc is a path in the previous
graph. This path starts at node a and ends at node c.
Strings
‚ Concatenation of strings:
if x “ x1 x2 . . . xn and y “ y1 y2 . . . ym then
xy “ x1 x2 . . . xn y1 y2 . . . ym
We have xε “ εx “ x.
Example: The concatenation of 110 and 011 is 110011.
Inductive structure of strings
0 1
1 0
a b c
0, 1
Example automaton
0 1
1 0
a b c
0, 1
‚ States (a, b, c).
‚ Start state (a, indicated with incoming arrow).
‚ End state (b, indicated with double border).
‚ Transitions (labeled edges).
Note that the edge labeled 0, 1 stands for two edges: one with
label 0 and one with label 1.
Behaviour of an automaton
0 1
1 0
a b c
0, 1
‚ Start in start state.
‚ Follow a transition, while remembering its label.
‚ Repeat this; you are allowed to stop if you are in an end state.
‚ If you stop, the sequence of labels encountered forms a string,
accepted by the automaton.
Behaviour of an automaton
0 1
1 0
a b c
0, 1
‚ Start in start state.
‚ Follow a transition, while remembering its label.
‚ Repeat this; you are allowed to stop if you are in an end state.
‚ If you stop, the sequence of labels encountered forms a string,
accepted by the automaton.
Example:
1101 is accepted
0110 is not accepted
Formal definition of a Finite Automaton
Definition
A finite automaton is a 5-tuple pQ, Σ, δ, q0 , F q, where
1 Q is a finite set called the states,
Formal definition of a Finite Automaton
Definition
A finite automaton is a 5-tuple pQ, Σ, δ, q0 , F q, where
1 Q is a finite set called the states,
2 Σ is a finite set called the alphabet,
Formal definition of a Finite Automaton
Definition
A finite automaton is a 5-tuple pQ, Σ, δ, q0 , F q, where
1 Q is a finite set called the states,
2 Σ is a finite set called the alphabet,
3 δ : Q ˆ Σ Ñ Q is a total function, which is called the
transition function,
Formal definition of a Finite Automaton
Definition
A finite automaton is a 5-tuple pQ, Σ, δ, q0 , F q, where
1 Q is a finite set called the states,
2 Σ is a finite set called the alphabet,
3 δ : Q ˆ Σ Ñ Q is a total function, which is called the
transition function,
4 q0 P Q is the start state, and
Formal definition of a Finite Automaton
Definition
A finite automaton is a 5-tuple pQ, Σ, δ, q0 , F q, where
1 Q is a finite set called the states,
2 Σ is a finite set called the alphabet,
3 δ : Q ˆ Σ Ñ Q is a total function, which is called the
transition function,
4 q0 P Q is the start state, and
5 F Ď Q is the set of accept states.
Example of formal definition
0 1
1 0
a b c
0, 1
1 States Q “ ta, b, cu
2 Alphabet Σ “ t0, 1u
δpa, 0q “ a
δpa, 1q “ b δ 0 1
δpb, 0q “ c a a b
3 Transition function δ or shorter
δpb, 1q “ b b c b
δpc, 0q “ b c b b
δpc, 1q “ b
4 Start state q0 “ a
5 Accept states F “ tbu
Language recognized by an automaton
0 1
1
q1 q2
0
Example M2
0 1
1
q1 q2
0
LpM2 q “ tw | w ends in a 1u
Example M3
0 1
1
q1 q2
0
Example M3
0 1
1
q1 q2
0
A1 :
a
b a, b a, b
q1 q2 q3
Example trap node
Which language is recognized by the automata A and A1 ?
A:
a
b
q1 q2
A1 :
a
b a, b a, b
q1 q2 q3
Definition
Let M be a finite automaton pQ, Σ, δ, q0 , F q.
String w “ w1 w2 . . . wn P Σ˚ is accepted by M if there exists a
sequence of states r “ r0 r1 r2 . . . rn P Q ˚ such that
1 r0 “ q0 ,
2 δpri , wi`1 q “ ri`1 , (for i “ 0, . . . , n ´ 1)
3 rn P F .
Formal definition of string accepted by an automaton
Definition
Let M be a finite automaton pQ, Σ, δ, q0 , F q.
String w “ w1 w2 . . . wn P Σ˚ is accepted by M if there exists a
sequence of states r “ r0 r1 r2 . . . rn P Q ˚ such that
1 r0 “ q0 ,
2 δpri , wi`1 q “ ri`1 , (for i “ 0, . . . , n ´ 1)
3 rn P F .
r0 r1 r2 r3 . . . rn´1 rn
Formal definition of string accepted by an automaton
Definition
Let M be a finite automaton pQ, Σ, δ, q0 , F q.
String w “ w1 w2 . . . wn P Σ˚ is accepted by M if there exists a
sequence of states r “ r0 r1 r2 . . . rn P Q ˚ such that
1 r0 “ q0 ,
2 δpri , wi`1 q “ ri`1 , (for i “ 0, . . . , n ´ 1)
3 rn P F .
w
1 2 w 3 w n w
r0 ÝÑ r1 ÝÑ r2 ÝÑ r3 . . . rn´1 ÝÑ rn
Formal definition of string accepted by an automaton
Definition
Let M be a finite automaton pQ, Σ, δ, q0 , F q.
String w “ w1 w2 . . . wn P Σ˚ is accepted by M if there exists a
sequence of states r “ r0 r1 r2 . . . rn P Q ˚ such that
1 r0 “ q0 ,
2 δpri , wi`1 q “ ri`1 , (for i “ 0, . . . , n ´ 1)
3 rn P F .
1w 2 w 3 w n w
q0 “ r0 ÝÑ r1 ÝÑ r2 ÝÑ r3 . . . rn´1 ÝÑ rn P F
Example accepted string
0 1
1
p q
0
This automaton accepts the string w1 w2 w3 w4 w5 “ 11010.
Example accepted string
0 1
1
p q
0
This automaton accepts the string w1 w2 w3 w4 w5 “ 11010.
0 1
1
p q
0
This automaton accepts the string w1 w2 w3 w4 w5 “ 11010.
1 1 0 1 0
Formulated differently, we have p Ý
ÑqÝ
ÑqÝ
ÑpÝ
ÑqÝ
Ñ p.
Language recognized by an automaton
Definition
Let M “ pQ, Σ, δ, q0 , F q be a finite automaton.
A language A is recognized by M if
A “ tw P Σ˚ | M accepts w u
Definition
Let M “ pQ, Σ, δ, q0 , F q be a finite automaton.
A language A is recognized by M if
A “ tw P Σ˚ | M accepts w u
Definition
Let M “ pQ, Σ, δ, q0 , F q be a finite automaton.
A language A is recognized by M if
A “ tw P Σ˚ | M accepts w u
q0 a q2 b q3
q0 a q2 b q3
a, b
q0 a q2 b q3
q1
b a, b
q0 a q2 b q3
q1
b a a, b
q0 a q2 b q3
q0 a q2 b q3
q0 0 q1 0 q2 1 q3
q0 0 q1 0 q2 1 q3
0, 1
q0 0 q1 0 q2 1 q3
a a
The backbone is q0 Ý
Ñ q2 Ý
Ñ q3