Download as pdf or txt
Download as pdf or txt
You are on page 1of 116

Automata

TVHoai, HTNguyen,
NAKhuong, LHTrang

Chapter 4
Automata
Mathematical Modeling Contents

Motivation

Alphabets, words and


languages

Regular expression or
rationnal expression

(Materials drawn from this chapter in: Non-deterministic


finite automata
- Peter Linz. An Introduction to Formal Languages and Automata, (5th Ed.),
Deterministic finite
Jones & Bartlett Learning, 2011. automata
- John E. Hopcroft, Rajeev Motwani and Jeffrey D. Ullamn. Introduction to Recognized languages
Automata Theory, Languages, and Computation (3rd Ed.), Prentice Hall,
Determinisation
2006.
Minimization
- Antal Iványi Algorithms of Informatics, Kempelen Farkas Hallgatói
DFAs combination
Információs Központ, 2011. ) Some applications
TVHoai, HTNguyen, NAKhuong, LHTrang
Faculty of Computer Science and Engineering
University of Technology, VNU-HCM
4.1
Automata
Contents
TVHoai, HTNguyen,
NAKhuong, LHTrang

1 Motivation

2 Alphabets, words and languages

3 Regular expression or rationnal expression


Contents

Motivation
4 Non-deterministic finite automata
Alphabets, words and
languages
5 Deterministic finite automata Regular expression or
rationnal expression

Non-deterministic
6 Recognized languages finite automata

Deterministic finite
7 Determinisation automata

Recognized languages

8 Minimization Determinisation

Minimization

9 DFAs combination DFAs combination

Some applications

10 Some applications

4.2
Automata
Course outcomes
TVHoai, HTNguyen,
NAKhuong, LHTrang

Course learning outcomes

L.O.1 Understanding of predicate logic


L.O.1.1 – Give an example of predicate logic
L.O.1.2 – Explain logic expression for some real problems Contents
L.O.1.3 – Describe logic expression for some real problems
Motivation

Alphabets, words and


L.O.2 Understanding of deterministic modeling using some discrete languages
structures Regular expression or
L.O.2.1 – Explain a linear programming (mathematical statement) rationnal expression
L.O.2.2 – State some well-known discrete structures Non-deterministic
L.O.2.3 – Give a counter-example for a given model finite automata

L.O.2.4 – Construct discrete model for a simple problem Deterministic finite


automata

Recognized languages
L.O.3 Be able to compute solutions, parameters of models based on data
L.O.3.1 – Compute/Determine optimal/feasible solutions of integer Determinisation

linear programming models, possibly utilizing adequate libraries Minimization

L.O.3.2 – Compute/ optimize solution models based on automata, DFAs combination


. . . , possibly utilizing adequate libraries Some applications

4.3
Automata
Introduction
TVHoai, HTNguyen,
NAKhuong, LHTrang
Standard states of a process in operating system

• O with label: states


• →: transitions

Contents

Resource Motivation

Alphabets, words and


languages
Waiting Blocked Regular expression or
rationnal expression

Non-deterministic
Resource finite automata

Deterministic finite
CPU automata

Recognized languages

CPU Resource Determinisation

Minimization

DFAs combination

Running Some applications

4.4
Automata
Why study automata theory?
TVHoai, HTNguyen,
NAKhuong, LHTrang

A useful model
for many important kinds of software and hardware
Contents

1 designing and checking the behaviour of digital circuits Motivation

2 lexical analyser of a typical compiler: a compiler component Alphabets, words and


languages
that breaks the input text into logical units Regular expression or
rationnal expression
3 scanning large bodies of text, such as collections of Web Non-deterministic
pages, to find occurrences of words, phrases or other patterns finite automata

Deterministic finite
4 verifying pratical systems of all types that have a finite automata

number of distinct states, such as communications protocols Recognized languages

and other protocols for securely information exchange, etc. Determinisation

Minimization

DFAs combination

Some applications

4.5
Automata
Alphabets, symbols
TVHoai, HTNguyen,
NAKhuong, LHTrang

Definition
Alphabet Σ (bảng chữ cái) is a finite and non-empty set of
symbols (or characters).
For example: Contents

• Σ = {a, b} Motivation

Alphabets, words and


• The binary alphabet: Σ = {0, 1} languages

Regular expression or
• The set of all lower-case letters: Σ = {a, b, . . . , z} rationnal expression

• The set of all ASCII characters. Non-deterministic


finite automata

Deterministic finite
automata
Remark Recognized languages

Σ is almost always all available characters (lowercase letters, Determinisation

capital letters, numbers, symbols and special characters such as Minimization

space or newline). DFAs combination

Some applications
But nothing prevents to imagine other sets.

4.6
Automata
Strings (words)
TVHoai, HTNguyen,
NAKhuong, LHTrang

Definition
• A string/word u (chuỗi/từ) over Σ is a finite sequence (possibly
empty) of symbols (or characters) in Σ. Contents

• A empty string is denoted by ε. Motivation

Alphabets, words and


• The length of the string u, denoted by |u|, is the number of languages
characters. Regular expression or
rationnal expression
• All the strings over Σ is denoted by Σ∗ .
Non-deterministic
• A language L over Σ is a sub-set of Σ∗ . finite automata

Deterministic finite
automata

Recognized languages
Remark
Determinisation
The purpose aims to analyze a string of Σ∗ in order to know Minimization

whether it belongs or not to L. DFAs combination

Some applications

4.7
Automata
Example
TVHoai, HTNguyen,
NAKhuong, LHTrang

Let Σ = {0, 1}

• ε is a string with length of 0.


• 0 and 1 are the strings with length of 1. Contents

Motivation
• 00, 01, 10 and 11 are the strings with length of 2.
Alphabets, words and
• ∅ is a language over Σ . It’s called the empty language. languages

Regular expression or
rationnal expression

Non-deterministic
finite automata

Deterministic finite
automata

Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.8
Automata
Example
TVHoai, HTNguyen,
NAKhuong, LHTrang

Let Σ = {0, 1}

• ε is a string with length of 0.


• 0 and 1 are the strings with length of 1. Contents

Motivation
• 00, 01, 10 and 11 are the strings with length of 2.
Alphabets, words and
• ∅ is a language over Σ . It’s called the empty language. languages

Regular expression or
• Σ∗ is a language over Σ . It’s called the universal language. rationnal expression

• {ε} is a language over Σ . Non-deterministic


finite automata
• {0, 00, 001} is also a language over Σ . Deterministic finite
automata
• The set of strings which contain an odd number of 0 is a language
Recognized languages
over Σ. Determinisation
• The set of strings that contain as many of 1 as 0 is a language Minimization

over Σ. DFAs combination

Some applications

4.8
Automata
String concatenation
TVHoai, HTNguyen,
NAKhuong, LHTrang

Contents
Intuitively, the concatenation of two strings 01 and 10 is 0110. Motivation
Concatenating the empty string ε and the string 110 is the string Alphabets, words and
languages
110.
Regular expression or
rationnal expression

Definition Non-deterministic
finite automata
∗ ∗ ∗
String concatenation is an application of Σ × Σ to Σ . Deterministic finite
Concatenation of two strings u and v in Σ is the string u.v. automata

Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.9
Automata
Languages
TVHoai, HTNguyen,
NAKhuong, LHTrang

Specifying languages
A language can be specified in several ways:

Contents

Motivation

Alphabets, words and


languages

Regular expression or
rationnal expression

Non-deterministic
finite automata

Deterministic finite
automata

Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.10
Automata
Languages
TVHoai, HTNguyen,
NAKhuong, LHTrang

Specifying languages
A language can be specified in several ways:
a enumeration of its words, for example:
• L1 = {ε, 0, 1},
Contents
• L2 = {a, aa, aaa, ab, ba},
Motivation
• L3 = {ε, ab, aabb, aaabbb, aaaabbbb, . . .},
Alphabets, words and
languages

Regular expression or
rationnal expression

Non-deterministic
finite automata

Deterministic finite
automata

Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.10
Automata
Languages
TVHoai, HTNguyen,
NAKhuong, LHTrang

Specifying languages
A language can be specified in several ways:
a enumeration of its words, for example:
• L1 = {ε, 0, 1},
Contents
• L2 = {a, aa, aaa, ab, ba},
Motivation
• L3 = {ε, ab, aabb, aaabbb, aaaabbbb, . . .},
Alphabets, words and
b a property, such that all words of the language have this property languages

but other words have not, for example: Regular expression or


rationnal expression
• L4 = {an bn |n = 0, 1, 2, . . .}, Non-deterministic
• L5 = {uu−1 |u ∈ Σ∗ } with Σ = {a, b}, finite automata

• L6 = {u ∈ {a, b}∗ |na (u) = nb (u)} where na (u) denotes the Deterministic finite
automata
number of letter ’a’ in word u. Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.10
Automata
Languages
TVHoai, HTNguyen,
NAKhuong, LHTrang

Specifying languages
A language can be specified in several ways:
a enumeration of its words, for example:
• L1 = {ε, 0, 1},
Contents
• L2 = {a, aa, aaa, ab, ba},
Motivation
• L3 = {ε, ab, aabb, aaabbb, aaaabbbb, . . .},
Alphabets, words and
b a property, such that all words of the language have this property languages

but other words have not, for example: Regular expression or


rationnal expression
• L4 = {an bn |n = 0, 1, 2, . . .}, Non-deterministic
• L5 = {uu−1 |u ∈ Σ∗ } with Σ = {a, b}, finite automata

• L6 = {u ∈ {a, b}∗ |na (u) = nb (u)} where na (u) denotes the Deterministic finite
automata
number of letter ’a’ in word u. Recognized languages

c its grammar, for example: Determinisation

• Let G = (N, T, P, S) where Minimization

DFAs combination
N = {S}, T = {a, b}, P = {S → aSb, S → ab}
i.e. L(G) = {an bn |n ≥ 1} since Some applications

S ⇒ aSb ⇒ a2 Sb2 ⇒ . . . ⇒ an Sbn

4.10
Automata
Operations on languages
TVHoai, HTNguyen,
NAKhuong, LHTrang
L, L1 , L2 are languages over Σ
• union
L1 ∪ L2 = {u ∈ Σ∗ | u ∈ L1 or u ∈ L2 },
• intersection
L1 ∩ L2 = {u ∈ Σ∗ | u ∈ L1 and u ∈ L2 },
• difference Contents

L1 \ L2 = {u ∈ Σ∗ | u ∈ L1 and u 6∈ L2 }, Motivation

• complement Alphabets, words and


languages
L = Σ∗ \ L, Regular expression or
• multiplication rationnal expression

L1 L2 = {uv | u ∈ L1 , v ∈ L2 }, Non-deterministic
finite automata

Deterministic finite
automata

Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.11
Automata
Operations on languages
TVHoai, HTNguyen,
NAKhuong, LHTrang
L, L1 , L2 are languages over Σ
• union
L1 ∪ L2 = {u ∈ Σ∗ | u ∈ L1 or u ∈ L2 },
• intersection
L1 ∩ L2 = {u ∈ Σ∗ | u ∈ L1 and u ∈ L2 },
• difference Contents

L1 \ L2 = {u ∈ Σ∗ | u ∈ L1 and u 6∈ L2 }, Motivation

• complement Alphabets, words and


languages
L = Σ∗ \ L, Regular expression or
• multiplication rationnal expression

L1 L2 = {uv | u ∈ L1 , v ∈ L2 }, Non-deterministic
finite automata
• power
Deterministic finite
L0 = {ε}, Ln = Ln−1 L , if n ≥ 1, automata

• iteration or star operation Recognized languages



[ Determinisation
L∗ = Li = L0 ∪ L ∪ L2 ∪ · · · ∪ Li ∪ · · · , Minimization
i=0
+ DFAs combination
We will use also the notation L
[∞ Some applications

L+ = Li = L ∪ L2 ∪ · · · ∪ Li ∪ · · · .
i=1
The union, product and iteration are called regular operations.
4.11
Automata
Example
TVHoai, HTNguyen,
NAKhuong, LHTrang

Let Σ = {a, b, c}, L1 = {ab, aa, b}, L2 = {b, ca, bac} Contents

Motivation
a L1 ∪ L2 =?, Alphabets, words and
languages
b L1 ∩ L2 =?,
Regular expression or
c L1 \ L2 =?, rationnal expression

Non-deterministic
d L1 L2 =?, finite automata

e L2 L1 =?. Deterministic finite


automata

Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.12
Automata
Example
TVHoai, HTNguyen,
NAKhuong, LHTrang

Let Σ = {a, b, c}, L1 = {ab, aa, b}, L2 = {b, ca, bac} Contents

Motivation
a L1 ∪ L2 = {ab, aa, b, ca, bac}, Alphabets, words and
languages
b L1 ∩ L2 = {b},
Regular expression or
c L1 \ L2 = {ab, aa}, rationnal expression

Non-deterministic
d L1 L2 = {abb, aab, bb, abca, aaca, bca, abbac, aabac, bbac}, finite automata

e L2 L1 = {bab, baa, bb, caab, caaa, cab, bacab, bacaa, bacb}. Deterministic finite
automata

Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.12
Automata
Example
TVHoai, HTNguyen,
NAKhuong, LHTrang

Let Σ = {a, b, c}, L1 = {ab, aa, b}, L2 = {b, ca, bac}

a L1 ∪ L2 = {ab, aa, b, ca, bac}, Contents

Motivation
b L1 ∩ L2 = {b},
Alphabets, words and
c L1 \ L2 = {ab, aa}, languages

Regular expression or
d L1 L2 = {abb, aab, bb, abca, aaca, bca, abbac, aabac, bbac}, rationnal expression

e L2 L1 = {bab, baa, bb, caab, caaa, cab, bacab, bacaa, bacb}. Non-deterministic
finite automata

Deterministic finite
automata

Let Σ = {a, b, c} and L = {ab, aa, b, ca, bac} Recognized languages

2 Determinisation
L =?
Minimization

DFAs combination

Some applications

4.12
Automata
Example
TVHoai, HTNguyen,
NAKhuong, LHTrang

Let Σ = {a, b, c}, L1 = {ab, aa, b}, L2 = {b, ca, bac}

a L1 ∪ L2 = {ab, aa, b, ca, bac},


b L1 ∩ L2 = {b},
c L1 \ L2 = {ab, aa}, Contents

Motivation
d L1 L2 = {abb, aab, bb, abca, aaca, bca, abbac, aabac, bbac},
Alphabets, words and
e L2 L1 = {bab, baa, bb, caab, caaa, cab, bacab, bacaa, bacb}. languages

Regular expression or
rationnal expression

Non-deterministic
Let Σ = {a, b, c} and L = {ab, aa, b, ca, bac} finite automata

L2 = u.v, with u, v ∈ L including the following strings: Deterministic finite


automata

• abab, abaa, abb, abca, abbac, Recognized languages

• aaab, aaaa, aab, aaca, aabac, Determinisation

Minimization
• bab, baa, bb, bca, bbac,
DFAs combination
• caab, caaa, cab, caca, cabac, Some applications

• bacab, bacaa, bacb, bacca, bacbac.

4.12
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang

Let Σ = {a, b, c}
Give at least 5 strings for each of the following languages
1 all strings with exactly one ’a’.
Contents
2 all strings of even length. Motivation

Alphabets, words and


3 all strings which the number of appearances of ’b’ is divisible by 3. languages

4 all strings ending with ’a’. Regular expression or


rationnal expression

5 all non-empty strings not ending with ’a’. Non-deterministic


finite automata
6 all strings with at least one ’a’. Deterministic finite
automata
7 all strings with at most one ’a’. Recognized languages

8 all strings without any ’a’. Determinisation

Minimization
9 all strings including at least one ’a’ and whose the first appearance
DFAs combination
of ’a’ is not followed by ’c’.
Some applications

4.13
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang

Let Σ = {a, b, c} and L = {ab, aa, b, ca, bac}


Which of the following strings are in L∗ ?
S1 aaa = a3 ,
Contents
S2 abaabaaabaa = aba2 ba3 ba2 , Motivation

S3 bbb, Alphabets, words and


languages

S4 aab, Regular expression or


rationnal expression
S5 cc, Non-deterministic
finite automata
4 4
S6 aaaabaaaa = a ba , Deterministic finite
automata
S7 cabbbbaaaaaaaaab = cab4 a9 b,
Recognized languages

S8 baaaaabaaaab = ba5 ba4 b, Determinisation

5 2 Minimization
S9 baaaaabaac = ba ba c,
DFAs combination
S10 baca. Some applications

4.14
Automata
Regular expressions
TVHoai, HTNguyen,
NAKhuong, LHTrang

Regular expressions (biểu thức chính quy)


Permit to specify a language with strings consist of letters and ε,
parentheses (), operating symbols +, ., ∗. This string can be
empty, denoted ∅.
Contents

Motivation
Regular operations on the languages
Alphabets, words and
languages
• union ∪ or + Regular expression or
rationnal expression
• product of concatenation Non-deterministic
finite automata
• transitive closure ∗
Deterministic finite
automata

Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.15
Automata
Regular expressions
TVHoai, HTNguyen,
NAKhuong, LHTrang

Regular expressions (biểu thức chính quy)


Permit to specify a language with strings consist of letters and ε,
parentheses (), operating symbols +, ., ∗. This string can be
empty, denoted ∅.
Contents

Motivation
Regular operations on the languages
Alphabets, words and
languages
• union ∪ or + Regular expression or
rationnal expression
• product of concatenation Non-deterministic
finite automata
• transitive closure ∗
Deterministic finite
automata

Recognized languages
Example on the aphabet set Σ = {a, b}
Determinisation

Minimization
• (a + b)∗ represent all the strings
DFAs combination
• a∗ (ba∗ )∗ represent the same language Some applications


• (a + b) aab represent all strings ending with aab.

4.15
Automata
Regular expressions
TVHoai, HTNguyen,
NAKhuong, LHTrang

• ∅ is a regular expression representing the empty language.


• ε is a regular expression representing language {ε}.
• If a ∈ Σ, then a is a regular expression representing language {a}.
• If x, y are regular expressions representing languages X and Y
Contents
respectively, then (x + y),S(xy), x∗ are regular expression Motivation
representing languages X Y , XY and X ∗ respectively. Alphabets, words and
languages

Regular expression or
rationnal expression

Non-deterministic
finite automata

Deterministic finite
automata

Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.16
Automata
Regular expressions
TVHoai, HTNguyen,
NAKhuong, LHTrang

• ∅ is a regular expression representing the empty language.


• ε is a regular expression representing language {ε}.
• If a ∈ Σ, then a is a regular expression representing language {a}.
• If x, y are regular expressions representing languages X and Y
Contents
respectively, then (x + y),S(xy), x∗ are regular expression Motivation
representing languages X Y , XY and X ∗ respectively. Alphabets, words and
languages
x+y ≡ y+x Regular expression or
rationnal expression
(x + y) + z ≡ x + (y + z) Non-deterministic
finite automata
(xy)z ≡ x(yz)
Deterministic finite
(x + y)z ≡ xz + yz automata

Recognized languages
x(y + z) ≡ xy + xz Determinisation

(x + y)∗ ≡ (x∗ + y)∗ ≡ (x + y ∗ )∗ ≡ (x∗ + y ∗ )∗ Minimization

∗ ∗ ∗ ∗ DFAs combination
(x + y) ≡ (x y )
Some applications
(x∗ )∗ ≡ x∗
x∗ x ≡ xx∗
xx∗ + ε ≡ x∗ 4.16
Automata
Regular expressions
TVHoai, HTNguyen,
NAKhuong, LHTrang

Contents

Motivation
Kleene’s theorem Alphabets, words and
languages
Language L ⊆ Σ∗ is regular if and only if there exists a regular Regular expression or
expression over Σ representing language L. rationnal expression

Non-deterministic
finite automata

Deterministic finite
automata

Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.17
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang

Let Σ = {a, b, c}
Give at least 3 words for each language represented by the
Contents
following regular expressions
Motivation
1 E1 = a∗ + b∗ , Alphabets, words and
languages
2 E2 = a∗ b + b∗ a, Regular expression or
rationnal expression
3 E3 = b(ca + ac)(aa)∗ + a∗ (a + b),
Non-deterministic
4 E4 = (a∗ b + b∗ a)∗ . finite automata

Deterministic finite
automata

Recognized languages
Example
Determinisation
∗ 2 3
a b = {b, ab, a b, a b, . . . , aaa . . . ab}, Minimization

DFAs combination

Some applications

4.18
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang

Let Σ = {a, b, c}
Determine regular expression presenting for each of the following
languages.
1 all strings with exactly one ’a’. Contents

Motivation
2 all strings of even length.
Alphabets, words and
languages
3 all strings which the number of appearances of ’b’ is divisible by 3.
Regular expression or
4 all strings ending with ’a’. rationnal expression

Non-deterministic
5 all non-empty strings not ending with ’a’. finite automata

Deterministic finite
6 all strings with at least one ’a’. automata

7 all strings with at most one ’a’. Recognized languages

Determinisation
8 all strings without any ’a’.
Minimization

9 all strings including at least one ’a’ and whose the first appearance DFAs combination

of ’a’ is not followed by a ’c’. Some applications

4.19
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang

Let Σ = {a, b, c} and L = {ab, aa, b, ca, bac}


Which languages represented by the following regular expressions
are in L∗ ?
1 E1 = a∗ + ba, Contents

Motivation
2 E2 = b∗ + a∗ aba∗ , Alphabets, words and
languages
3 E3 = aab + cab∗ ac,
Regular expression or
4 E4 = b(ca + ac)(aa)∗ + a∗ (a + b), rationnal expression

Non-deterministic
5 E5 = (a4 ba3 )2∗ c, finite automata

Deterministic finite
6 E6 = b+ ac (b+ = bb∗ ), automata

7 E7 = (b + c)ab + ba(c + ab)∗ , Recognized languages

Determinisation
∗ ∗
8 E8 = (b + c) ab + a(c + a) . Minimization

DFAs combination

Some applications

4.20
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang

Let Σ = {a, b, c} and L = {ab, aa, b, ca, bac}


Which languages represented by the following regular expressions
are in L∗ ?
1 E1 = a∗ + ba, Contents

Motivation
2 E2 = b∗ + a∗ aba∗ , Alphabets, words and
languages
3 E3 = aab + cab∗ ac,
Regular expression or
4 E4 = b(ca + ac)(aa)∗ + a∗ (a + b), rationnal expression

Non-deterministic
5 E5 = (a4 ba3 )2∗ c, finite automata

Deterministic finite
6 E6 = b+ ac (b+ = bb∗ ), automata

7 E7 = (b + c)ab + ba(c + ab)∗ , Recognized languages

Determinisation
∗ ∗
8 E8 = (b + c) ab + a(c + a) . Minimization

DFAs combination

Define a (simple) regular expression representing the language L∗ . Some applications

4.20
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang

Simplify each of the following regular expressions


Contents
1 E1 = b + ab∗ + aa∗ b + aa∗ ab∗ , Motivation
2 E2 = a∗ (b + ab∗ ), Alphabets, words and
languages
3 E3 = ε + ab + abab(ab)∗ , Regular expression or
4 E4 = (ba)∗ + a(ba)∗ + (ba)∗ b + a(ba)∗ b, rationnal expression

Non-deterministic
5 E5 = aa(b∗ + a) + a(ab∗ + aa), finite automata

6 E6 = (a∗ (ba)∗ )∗ (b + ε), Deterministic finite


automata

7 E7 = a(a + b)∗ + aa(a + b)∗ + aaa(a + b)∗ . Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.21
Automata
Finite automata
TVHoai, HTNguyen,
NAKhuong, LHTrang

Finite automata (Automat hữu hạn)

• The aim is representation of a process system.


• It consists of states (including an initial state and one or
several (or one) final/accepting states) and transitions Contents

(events). Motivation

Alphabets, words and


• The number of states must be finite. languages

Regular expression or
rationnal expression

Non-deterministic
finite automata

Deterministic finite
automata

Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.22
Automata
Finite automata
TVHoai, HTNguyen,
NAKhuong, LHTrang

Finite automata (Automat hữu hạn)

• The aim is representation of a process system.


• It consists of states (including an initial state and one or
several (or one) final/accepting states) and transitions Contents

(events). Motivation

Alphabets, words and


• The number of states must be finite. languages

Regular expression or
rationnal expression

Non-deterministic
b finite automata
a, b Deterministic finite
automata

q0 q1 Recognized languages

Determinisation

Minimization

DFAs combination
Regular expression Some applications


b (a + b)

4.22
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang
Let Σ = {a, b}
Which of the strings
1 a3 b,
2 aba2 b,
3 a4 b2 ab3 a, Contents

Motivation
4 a4 ba4 , Alphabets, words and
languages
5 ab4 a9 b,
Regular expression or
6 ba5 ba4 b, rationnal expression

Non-deterministic
7 ba5 b2 , finite automata

Deterministic finite
8 bab2 a automata

Recognized languages
are accepted by the following finite automata?
Determinisation

a b Minimization

b DFAs combination

Some applications
a
q0 q1 q2
b
a
4.23
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang

Let Σ = {a, b, c}
Propose FA presenting each of the following languages
1 all strings with exactly one ’a’.
Contents
2 all strings of even length. Motivation

Alphabets, words and


3 all strings which the number of appearances of ’b’ is divisible by 3. languages

4 all strings ending with ’a’. Regular expression or


rationnal expression

5 all non-empty strings not ending with ’a’. Non-deterministic


finite automata
6 all strings with at least one ’a’. Deterministic finite
automata
7 all strings with at most one ’a’. Recognized languages

8 all strings without any ’a’. Determinisation

Minimization
9 all strings including at least one ’a’ and whose the first appearance
DFAs combination
of ’a’ is not followed by a ’c’.
Some applications

4.24
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang
Give regular expression for the following finite automata.

b a, b
b
Contents

a q0 a q1 Motivation
q0 q1 Alphabets, words and
languages

a b Regular expression or
rationnal expression

Non-deterministic
finite automata

b q0 a q1 Deterministic finite
q0 q1 automata

Recognized languages
b
Determinisation

a a, b Minimization

DFAs combination

a Some applications
b
q2 q2

4.25
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang

Give regular expression for the following finite automata.

a b
b
a Contents

q0 q1 q2 Motivation

b Alphabets, words and


languages
a
Regular expression or
rationnal expression

Non-deterministic
finite automata

Deterministic finite
automata

Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.26
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang

Give regular expression for the following finite automata.

a b
b
a Contents

q0 q1 q2 Motivation

b Alphabets, words and


languages
a
Regular expression or
rationnal expression

Non-deterministic
and this one. finite automata

Deterministic finite
automata

b b Recognized languages

a, b Determinisation

Minimization

q0 q1 DFAs combination

Some applications

4.26
Automata
Nondeterministic finite automata
TVHoai, HTNguyen,
NAKhuong, LHTrang

Definition
A nondeterministic finite automata (NFA, Automat hữu hạn phi
đơn định) is mathematically represented by a 5-tuples
Contents
(Q, Σ, q0 , δ, F ) where Motivation
• Q a finite set of states. Alphabets, words and
languages
• Σ is the alphabet of the automata. Regular expression or
rationnal expression
• q0 ∈ Q is the initial state.
Non-deterministic
• δ : Q × Σ → Q is a transition function. finite automata

Deterministic finite
• F ⊆ Q is the set of final/accepting states. automata

Recognized languages

Determinisation
Remark Minimization

According to an event, a state may go to one or more states. DFAs combination

Some applications

4.27
Automata
NFA with empty symbol ε
TVHoai, HTNguyen,
NAKhuong, LHTrang

Other definition of NFA


Contents
Finite automaton with transitions defined by character x (in Σ) or
Motivation
empty character ε.
Alphabets, words and
languages

Regular expression or
b a a, b rationnal expression

Non-deterministic
ε b finite automata

Deterministic finite
q0 q1 q2 automata

Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.28
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang

Contents

Motivation
Consider the set of strings on {a, b} in which every aa is followed Alphabets, words and
immediately by b. languages

Regular expression or
For example aab, aaba, aabaabbaab are in the language, rationnal expression
but aaab and aabaa are not. Non-deterministic
finite automata
Construct an accepting NFA.
Deterministic finite
automata

Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.29
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang

Contents
Let Σ = {a, b, c}
Motivation
Propose NFA presenting each of the following languages Alphabets, words and
languages
1 all strings with exactly one ’a’. Regular expression or
rationnal expression
2 all strings of even number of appearances of ’b’.
Non-deterministic
finite automata
3 all strings which the number of appearances of ’b’ is divisible by 3.
Deterministic finite
automata

Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.30
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang

Let Σ = {a, b, c}
Construct an accepting finite automata for languages represented
by the following regular expressions.
• E1 = a∗ c + b∗ a, Contents

∗ ∗
• E2 = b ab + a aba , ∗ Motivation

Alphabets, words and


• E3 = aab + cab∗ ac, languages

Regular expression or
• E4 = b(ca + ac)(aa)∗ + a∗ (a + b), rationnal expression

Non-deterministic
• E5 = (ab)2∗ c + bac, finite automata

• E6 = bb∗ ac + b∗ a, Deterministic finite


automata

• E7 = (b + c)ab + ba(c + ab)∗ , Recognized languages

Determinisation
• E8 = (b + c)∗ ba + a(c + a)∗ ,
Minimization
• E9 = [a(b + c)∗ + bc∗ ]∗ , DFAs combination

• E10 = b∗ ac + bb∗ a. Some applications

4.31
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang

Let Σ = {a, b}
Give 3 valid strings & 5 invalid strings in language L2 , with L
represented by the following finite automata.
Contents
a Motivation

Alphabets, words and


languages
ε Regular expression or
A B rationnal expression

Non-deterministic
a finite automata

Deterministic finite
automata
b b Recognized languages

Determinisation
b Minimization

DFAs combination
D a C b
Some applications

4.32
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang

Let Σ = {a, b}
Give 3 valid strings & 5 invalid strings in language L2 , with L
represented by the following finite automata.
Contents
a Motivation

Alphabets, words and


languages
a, ε
Regular expression or
A B rationnal expression

Non-deterministic
a finite automata

Deterministic finite
automata
b b Recognized languages

Determinisation
a
Minimization

DFAs combination
D a C b
Some applications

4.33
Automata
Deterministic finite automata
TVHoai, HTNguyen,
NAKhuong, LHTrang

Definition
A deterministic finite automata (DFA, Automat hữu hạn đơn
định) is given by a 5-tuplet (Q, Σ, q0 , δ, F ) with Contents

• Q a finite set of states. Motivation

Alphabets, words and


• Σ is the input alphabet of the automata. languages

• q0 ∈ Q is the initial state. Regular expression or


rationnal expression

• δ : Q × Σ → Q is a transition function. Non-deterministic


finite automata

• F ⊆ Q is the set of final/accepting states. Deterministic finite


automata

Recognized languages

Condition Determinisation

Minimization
Transition function δ is an application.
DFAs combination

Some applications

4.34
Automata
Example
TVHoai, HTNguyen,
NAKhuong, LHTrang

Let Σ = {a, b}
Hereinafter, a deterministic and complete automata that
recognizes the set of strings which contain an odd number of a.
Contents
b b Motivation

a Alphabets, words and


languages

q0 q1 Regular expression or
rationnal expression

Non-deterministic
a finite automata

Deterministic finite
automata

Recognized languages

Determinisation
• Q = {q0 , q1 }, Minimization

• δ(q0 , a) = q1 , δ(q0 , b) = q0 , δ(q1 , a) = q0 , δ(q1 , b) = q1 , DFAs combination

Some applications
• F = {q1 }.

4.35
Automata
Configurations and executions
TVHoai, HTNguyen,
NAKhuong, LHTrang

Let A = (Q, Σ, q0 , δ, F )
A configuration (cấu hình) of automata A is a couple (q, u) where Contents
q ∈ Q and u ∈ Σ∗ . Motivation
We define the relation → of derivation between configurations : Alphabets, words and

(q, a.u) → (q 0 , u) iif δ(q, a) = q 0 languages

Regular expression or
rationnal expression

Non-deterministic
finite automata
An execution (thực thi) of automata A is a sequence of Deterministic finite
automata
configurations
Recognized languages
(q0 , u0 ) . . . (qn , un ) such that
Determinisation
(qi , ui ) → (qi+1 , ui+1 ), for i = 0, 1, . . . , n − 1. Minimization

DFAs combination

Some applications

4.36
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang

Let Σ = {0, 1}
Contents
• Give a DFA that accepts all words that contain a number of 0
Motivation
multiple of 3.
Alphabets, words and
• Give an execution of this automata on 1101010. languages

Regular expression or
rationnal expression

Non-deterministic
finite automata

Deterministic finite
automata

Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.37
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang

Let Σ = {0, 1}
Contents
• Give a DFA that accepts all words that contain a number of 0
Motivation
multiple of 3.
Alphabets, words and
• Give an execution of this automata on 1101010. languages

Regular expression or
rationnal expression

Non-deterministic
Let Σ = {a, b} finite automata

Deterministic finite
• Give a DFA that accepts all strings containing 2 characters a. automata

Recognized languages
• Give an execution of this automata on aabb, ababb and bbaa.
Determinisation

Minimization

DFAs combination

Some applications

4.37
Automata
Recognized languages
TVHoai, HTNguyen,
NAKhuong, LHTrang

Definition
A language L over an alphabet Σ, defined as a sub-set of Σ∗ , is Contents

recognized if there exists a finite automata accepting all strings of Motivation

L. Alphabets, words and


languages

Regular expression or
Proposition rationnal expression

Non-deterministic
If L1 and L2 are two recognized languages, then finite automata

Deterministic finite
• L1 ∪ L2 and L1 ∩ L2 are also recognized; automata

• L1 .L2 and L∗1 are also recognized. Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.38
Automata
Example
TVHoai, HTNguyen,
NAKhuong, LHTrang

Sub-string ab
Construct a DFA that recognizes the language over the alphabet
{a, b} containing the sub-string ab. Contents

Motivation

Alphabets, words and


Regular expression languages

(a + b)∗ ab(a + b)∗ Regular expression or


rationnal expression

Non-deterministic
finite automata

Deterministic finite
automata

Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.39
Automata
Example
TVHoai, HTNguyen,
NAKhuong, LHTrang

Sub-string ab
Construct a DFA that recognizes the language over the alphabet
{a, b} containing the sub-string ab. Contents

Motivation

Alphabets, words and


Regular expression languages

(a + b)∗ ab(a + b)∗ Automata


Regular expression or
rationnal expression

b a a, b Non-deterministic
finite automata
Transition table Deterministic finite
a b
a b automata

→ q0 q1 q0 q0 q1 q2 Recognized languages

Determinisation
q1 q1 q2
Minimization
q2 ∗ q2 q2 DFAs combination

Some applications

4.39
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang

Let Σ = {a, b, c}
Propose DFA presenting each of the following languages
Contents
1 all strings which the number of appearances of ’aa’ and the one of
Motivation
’b’ are the same.
Alphabets, words and
languages
2 all strings which the number of appearances of ’a’ is equal to the
Regular expression or
one of ’b’ plus the one of ’c’. rationnal expression

3 all strings including at least one ’a’ and whose the first appearance Non-deterministic
finite automata
of ’a’ is not followed by a ’c’. Deterministic finite
automata
4 all strings which the difference between number of appearances of
Recognized languages
’a’ and the one of ’c’ is less than 1.
Determinisation
5 all strings which there is at least ’b’ or ’cb’ after ’a’ or ’aa’. Minimization

DFAs combination

Some applications

4.40
Automata
Example
TVHoai, HTNguyen,
NAKhuong, LHTrang

Let Σ = {a, b, c}
Contents
Construct DFAs that recognize the languages represented by the
Motivation
following regular expressions.
Alphabets, words and
• E1 = a∗ + b∗ a, languages

Regular expression or
• E2 = b∗ + a∗ aba∗ , rationnal expression

• E3 = aab + cab∗ ac, Non-deterministic


finite automata

• E4 = bb∗ ac + b∗ a, Deterministic finite


automata

• E5 = b∗ ac + bb∗ a. Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.41
Automata
From NFA to DFA
TVHoai, HTNguyen,
NAKhuong, LHTrang

Given a NFA
b b
Contents
a
Motivation

Alphabets, words and


0 1 Transition table languages

Regular expression or
a b rationnal expression

Non-deterministic
finite automata
a Deterministic finite
automata
ε Recognized languages

Determinisation

2 Minimization

DFAs combination

Some applications

4.42
Automata
From NFA to DFA
TVHoai, HTNguyen,
NAKhuong, LHTrang

Given a NFA
b b
Contents
a
Motivation

Transition table Alphabets, words and


0 1 languages

a b Regular expression or
rationnal expression
→ {0} {1} {0} Non-deterministic
finite automata
a Deterministic finite
automata
ε Recognized languages

Determinisation

2 Minimization

DFAs combination

Some applications

4.42
Automata
From NFA to DFA
TVHoai, HTNguyen,
NAKhuong, LHTrang

Given a NFA
b b
Contents
a
Motivation
Transition table
Alphabets, words and
0 1 languages
a b Regular expression or
→ {0} {1} {0} rationnal expression

{1} {0, 2} {1} Non-deterministic


finite automata
a Deterministic finite
automata
ε Recognized languages

Determinisation

2 Minimization

DFAs combination

Some applications

4.42
Automata
From NFA to DFA
TVHoai, HTNguyen,
NAKhuong, LHTrang

Given a NFA
b b
Contents
a
Motivation
Transition table
Alphabets, words and
0 1 languages
a b
Regular expression or
→ {0} {1} {0} rationnal expression

{1} {0, 2} {1} Non-deterministic


finite automata
a {0, 2}∗ {1} {0} Deterministic finite
automata
ε Recognized languages

Determinisation

2 Minimization

DFAs combination

Some applications

4.42
Automata
From NFA to DFA
TVHoai, HTNguyen,
Transition table NAKhuong, LHTrang

a b
→ {0} {1} {0}
Given a NFA {1} {0, 2} {1}
{0, 2}∗ {1} {0}
b b Contents

a Corresponding DFA Motivation

Alphabets, words and

0 1 b b languages

Regular expression or
a rationnal expression

Non-deterministic
finite automata
{0} {1}
a Deterministic finite
automata

Recognized languages
ε Determinisation
a a Minimization
2 DFAs combination
b Some applications

{0, 2}

4.42
Automata
Other example of determinisation
TVHoai, HTNguyen,
NAKhuong, LHTrang

Given a NFA

b b
a, b Contents

Motivation

0 1 Alphabets, words and


languages

Regular expression or
a rationnal expression

Non-deterministic
finite automata

Transition table Deterministic finite


automata

a b Recognized languages

→ {0} {1} {0, 1} Determinisation

{1}∗ {0} {1} Minimization

DFAs combination
{0, 1}∗ {0, 1} {0, 1}
Some applications

4.43
Automata
Other example of determinisation
TVHoai, HTNguyen,
NAKhuong, LHTrang

Given a NFA Corresponding DFA


b b b
a, b Contents
a Motivation

0 1 Alphabets, words and


{0} {1} languages

Regular expression or
a rationnal expression
a
Non-deterministic
finite automata

Transition table b Deterministic finite


automata

a b Recognized languages

→ {0} {1} {0, 1} Determinisation

{1}∗ {0} {1} a, b {0, 1} Minimization

DFAs combination
{0, 1}∗ {0, 1} {0, 1}
Some applications

4.43
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang
Let Σ = {a, b, c}
Determine DFAs which corresponds to the following NFAs:

b, c b, c a b
a, ε 0 1 2
Contents

Motivation

Alphabets, words and


0 a 1 c, ε languages

Regular expression or
rationnal expression

Non-deterministic
finite automata

Deterministic finite
automata

Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.44
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang
Let Σ = {a, b, c}
Determine DFAs which corresponds to the following NFAs:

b, c b, c a b
a, ε 0 1 2
Contents

Motivation

Alphabets, words and


0 a 1 c, ε languages

a b, c Regular expression or
rationnal expression
a b
Non-deterministic
finite automata
b, ε
b 0 1
Deterministic finite
automata
0 1
Recognized languages

ε Determinisation

Minimization
ε
a, b ε DFAs combination
a Some applications

2
2
4.44
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang

Let Σ = {a, b, c}
Determine DFAs which corresponds to the following NFAs:
b Contents

Motivation

a c Alphabets, words and


0 1 2 languages

Regular expression or
rationnal expression

Non-deterministic
a finite automata

b b Deterministic finite
automata

Recognized languages

Determinisation
3 Minimization

DFAs combination

Some applications

4.45
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang

Let Σ = {a, b, c}
Determine DFAs which corresponds to the following NFAs:
b
b, c Contents

a c Motivation
0 1 2 Alphabets, words and
languages

Regular expression or
rationnal expression
c
b Non-deterministic
finite automata

Deterministic finite
a automata

Recognized languages
3 Determinisation

Minimization

DFAs combination
a, c Some applications

4.46
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang

Let Σ = {a, b, c} Contents

Determine finite automata, not necessarily deterministic, Motivation

recognizing the following languages: Alphabets, words and


languages
• L1 = {a, ab, ca, cab, acc}, Regular expression or
rationnal expression
• L2 = { set of words of even number of a}, Non-deterministic
finite automata
• L3 = { set of words containing ab and ending with b}.
Deterministic finite
automata
Then, determine the corresponding complete DFAs.
Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.47
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang

Let Σ = {a, b, c}
Construct DFAs for languages represented by following expressions.
• E1 = a∗ + b∗ a,
• E2 = b∗ + a∗ aba∗ ,
Contents
• E3 = (aab + ab∗ )∗ , Motivation

• E4 = b(ca + ac)(aa)∗ + a∗ (a + b), Alphabets, words and


languages

• E5 = ba∗ b + baa + baba, Regular expression or


rationnal expression

• E6 = (ba b + baa + baaba) , ∗
Non-deterministic
finite automata

• E7 = ba b + baa + aba(a + b) , ∗
Deterministic finite
automata
• E9 = [a(b + c)∗ + bc∗ ]∗ , Recognized languages

• E10 = bb∗ ac + ba∗ b. Determinisation

∗ ∗ Minimization
• E11 = bb ac + b a,
DFAs combination
• E12 = (b + c)ab + ba(c + ab)∗ , Some applications

• E13 = (b + c)∗ ba + a(c + a)∗ ,

4.48
Automata
Example
TVHoai, HTNguyen,
NAKhuong, LHTrang

Determine a DFA that recognizes the language over the alphabet


{a, b} with an even number of a and an even number b.

Contents

Motivation

Alphabets, words and


languages

Regular expression or
rationnal expression

Non-deterministic
finite automata

Deterministic finite
automata

Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.49
Automata
Example
TVHoai, HTNguyen,
NAKhuong, LHTrang

Determine a DFA that recognizes the language over the alphabet


{a, b} with an even number of a and an even number b.

Automata Contents

Motivation

Alphabets, words and


b languages

Regular expression or
q0 q1 rationnal expression

Non-deterministic
finite automata

b Deterministic finite
automata

a a a a Recognized languages

Determinisation

b Minimization

DFAs combination

q2 q3 Some applications

b
4.49
Automata
Example
TVHoai, HTNguyen,
NAKhuong, LHTrang

Determine a DFA that recognizes the language over the alphabet


{a, b} with an even number of a and an even number b.

Automata Contents

Motivation

Alphabets, words and


b Transition table languages

Regular expression or
q0 q1 a b
rationnal expression

Non-deterministic
→ q0∗ q2 q1 finite automata

b q1 q3 q0 Deterministic finite
automata

a a a a q2 q0 q3 Recognized languages
q3 q1 q2 Determinisation

b →: start state Minimization

∗ DFAs combination
: final state(s)
q2 q3 Some applications

b
4.49
Automata
From a DFA to a smaller DFA
TVHoai, HTNguyen,
NAKhuong, LHTrang

a b
0 1 2

Contents

b b a a a, b a, b Motivation

Alphabets, words and


languages

Regular expression or
rationnal expression
a b
3 4 5 Non-deterministic
finite automata

Deterministic finite
automata

equivalence relationships Recognized languages

Determinisation
s 0 1 2 3 4 5
Minimization
cl(s)
DFAs combination

Some applications

4.50
Automata
From a DFA to a smaller DFA
TVHoai, HTNguyen,
NAKhuong, LHTrang

a b
0 1 2

Contents

b b a a a, b a, b Motivation

Alphabets, words and


languages

Regular expression or
rationnal expression
a b
3 4 5 Non-deterministic
finite automata

Deterministic finite
automata

equivalence relationships Recognized languages

Determinisation
s 0 1 2 3 4 5
Minimization
cl(s) I I I I
DFAs combination

Some applications

4.50
Automata
From a DFA to a smaller DFA
TVHoai, HTNguyen,
NAKhuong, LHTrang

a b
0 1 2

Contents

b b a a a, b a, b Motivation

Alphabets, words and


languages

Regular expression or
rationnal expression
a b
3 4 5 Non-deterministic
finite automata

Deterministic finite
automata

equivalence relationships Recognized languages

Determinisation
s 0 1 2 3 4 5
Minimization
cl(s) I II I II I I
DFAs combination

Some applications

4.50
Automata
From a DFA to a smaller DFA
TVHoai, HTNguyen,
NAKhuong, LHTrang

a b
0 1 2

Contents

b b a a a, b a, b Motivation

Alphabets, words and


languages

Regular expression or
a b rationnal expression
3 4 5
Non-deterministic
finite automata

Deterministic finite
automata
equivalence relationships Recognized languages

s 0 1 2 3 4 5 Determinisation

cl(s) I II I II I I Minimization

cl(s.a) DFAs combination

cl(s.b) Some applications

4.50
Automata
From a DFA to a smaller DFA
TVHoai, HTNguyen,
NAKhuong, LHTrang

a b
0 1 2

Contents

b b a a a, b a, b Motivation

Alphabets, words and


languages

Regular expression or
a b rationnal expression
3 4 5
Non-deterministic
finite automata

Deterministic finite
automata
equivalence relationships Recognized languages

s 0 1 2 3 4 5 Determinisation

cl(s) I II I II I I Minimization

cl(s.a) II DFAs combination

cl(s.b) II Some applications

4.50
Automata
From a DFA to a smaller DFA
TVHoai, HTNguyen,
NAKhuong, LHTrang

a b
0 1 2

Contents

b b a a a, b a, b Motivation

Alphabets, words and


languages

Regular expression or
a b rationnal expression
3 4 5
Non-deterministic
finite automata

Deterministic finite
automata
equivalence relationships Recognized languages

s 0 1 2 3 4 5 Determinisation

cl(s) I II I II I I Minimization

cl(s.a) II I DFAs combination

cl(s.b) II I Some applications

4.50
Automata
From a DFA to a smaller DFA
TVHoai, HTNguyen,
NAKhuong, LHTrang

a b
0 1 2

Contents

b b a a a, b a, b Motivation

Alphabets, words and


languages

Regular expression or
a b rationnal expression
3 4 5
Non-deterministic
finite automata

Deterministic finite
automata
equivalence relationships Recognized languages

s 0 1 2 3 4 5 Determinisation

cl(s) I II I II I I Minimization

cl(s.a) II I I DFAs combination

cl(s.b) II I I Some applications

4.50
Automata
From a DFA to a smaller DFA
TVHoai, HTNguyen,
NAKhuong, LHTrang

a b
0 1 2

Contents

b b a a a, b a, b Motivation

Alphabets, words and


languages

Regular expression or
a b rationnal expression
3 4 5
Non-deterministic
finite automata

Deterministic finite
automata
equivalence relationships Recognized languages

s 0 1 2 3 4 5 Determinisation

cl(s) I II I II I I Minimization

cl(s.a) II I I I DFAs combination

cl(s.b) II I I I Some applications

4.50
Automata
From a DFA to a smaller DFA
TVHoai, HTNguyen,
NAKhuong, LHTrang

a b
0 1 2

Contents

b b a a a, b a, b Motivation

Alphabets, words and


languages

Regular expression or
a b rationnal expression
3 4 5
Non-deterministic
finite automata

Deterministic finite
automata
equivalence relationships Recognized languages

s 0 1 2 3 4 5 Determinisation

cl(s) I II I II I I Minimization

cl(s.a) II I I I II DFAs combination

cl(s.b) II I I I I Some applications

4.50
Automata
From a DFA to a smaller DFA
TVHoai, HTNguyen,
NAKhuong, LHTrang

a b
0 1 2

Contents

b b a a a, b a, b Motivation

Alphabets, words and


languages

Regular expression or
a b rationnal expression
3 4 5
Non-deterministic
finite automata

Deterministic finite
automata
equivalence relationships Recognized languages

s 0 1 2 3 4 5 Determinisation

cl(s) I II I II I I Minimization

cl(s.a) II I I I II I DFAs combination

cl(s.b) II I I I I I Some applications

4.50
Automata
From a DFA to a smaller DFA
TVHoai, HTNguyen,
NAKhuong, LHTrang

a b
0 1 2

Contents

b b a a a, b a, b Motivation

Alphabets, words and


languages

Regular expression or
a b rationnal expression
3 4 5
Non-deterministic
finite automata

Deterministic finite
automata
equivalence relationships Recognized languages

s 0 1 2 3 4 5 Determinisation
0 1 2 3 4 5
cl(s) I II I II I I Minimization
I II II
cl(s.a) II I I I II I DFAs combination

cl(s.b) II I I I I I Some applications

4.50
Automata
From a DFA to a smaller DFA
TVHoai, HTNguyen,
NAKhuong, LHTrang

a b
0 1 2

Contents

b b a a a, b a, b Motivation

Alphabets, words and


languages

Regular expression or
a b rationnal expression
3 4 5
Non-deterministic
finite automata

Deterministic finite
automata
equivalence relationships Recognized languages

s 0 1 2 3 4 5 Determinisation
0 1 2 3 4 5
cl(s) I II I II I I Minimization
I II III II
cl(s.a) II I I I II I DFAs combination

cl(s.b) II I I I I I Some applications

4.50
Automata
From a DFA to a smaller DFA
TVHoai, HTNguyen,
NAKhuong, LHTrang

a b
0 1 2

Contents

b b a a a, b a, b Motivation

Alphabets, words and


languages

Regular expression or
a b rationnal expression
3 4 5
Non-deterministic
finite automata

Deterministic finite
automata
equivalence relationships Recognized languages

s 0 1 2 3 4 5 Determinisation
0 1 2 3 4 5
cl(s) I II I II I I Minimization
I II III II IV
cl(s.a) II I I I II I DFAs combination

cl(s.b) II I I I I I Some applications

4.50
Automata
From a DFA to a smaller DFA
TVHoai, HTNguyen,
NAKhuong, LHTrang

a b
0 1 2

Contents

b b a a a, b a, b Motivation

Alphabets, words and


languages

Regular expression or
a b rationnal expression
3 4 5
Non-deterministic
finite automata

Deterministic finite
automata
equivalence relationships Recognized languages

s 0 1 2 3 4 5 Determinisation
0 1 2 3 4 5
cl(s) I II I II I I Minimization
I II III II IV III
cl(s.a) II I I I II I DFAs combination

cl(s.b) II I I I I I Some applications

4.50
Automata
From a DFA to a smaller DFA
TVHoai, HTNguyen,
NAKhuong, LHTrang

a b
0 1 2

Contents

b b a a a, b a, b Motivation

Alphabets, words and


languages

Regular expression or
a b rationnal expression
3 4 5
Non-deterministic
finite automata

Deterministic finite
automata
equivalence relationships Recognized languages

s 0 1 2 3 4 5 0 1 2 3 4 5 Determinisation

cl(s) I II I II I I I II III II IV III Minimization

cl(s.a) II I I I II I II IV III IV II III DFAs combination

cl(s.b) II I I I I I II III III I III III Some applications

4.50
Automata
From a DFA to a smaller DFA
TVHoai, HTNguyen,
NAKhuong, LHTrang
a b
0 1 2

b b a a a, b a, b
Contents

Motivation
a b Alphabets, words and
3 4 5 languages

Regular expression or
rationnal expression

equivalence relationships Non-deterministic


finite automata
s 0 1 2 3 4 5 0 1 2 3 4 5 Deterministic finite
cl(s) I II I II I I I II III II IV III automata

cl(s.a) II I I I II I II IV III IV II III Recognized languages

Determinisation
cl(s.b) II I I I I I II III III I III III
Minimization

DFAs combination
s 0 1 2 3 4 5
Some applications
cl(s) I II III IV III
cl(s.a) II IV III II III
cl(s.b) III III III III
4.50
Automata
From a DFA to a smaller DFA
TVHoai, HTNguyen,
NAKhuong, LHTrang
a b
0 1 2

b b a a a, b a, b
Contents

Motivation
a b Alphabets, words and
3 4 5 languages

Regular expression or
rationnal expression

equivalence relationships Non-deterministic


finite automata
s 0 1 2 3 4 5 0 1 2 3 4 5 Deterministic finite
cl(s) I II I II I I I II III II IV III automata

cl(s.a) II I I I II I II IV III IV II III Recognized languages

Determinisation
cl(s.b) II I I I I I II III III I III III
Minimization

DFAs combination
s 0 1 2 3 4 5
Some applications
cl(s) I II III V IV III
cl(s.a) II IV III II III
cl(s.b) III III III III
4.50
Automata
From a DFA to a smaller DFA
TVHoai, HTNguyen,
NAKhuong, LHTrang
a b
0 1 2

b b a a a, b a, b
Contents

Motivation
a b Alphabets, words and
3 4 5 languages

Regular expression or
rationnal expression

equivalence relationships Non-deterministic


finite automata
s 0 1 2 3 4 5 0 1 2 3 4 5 Deterministic finite
cl(s) I II I II I I I II III II IV III automata

cl(s.a) II I I I II I II IV III IV II III Recognized languages

Determinisation
cl(s.b) II I I I I I II III III I III III
Minimization

DFAs combination
s 0 1 2 3 4 5
Some applications
cl(s) I II III V IV III
cl(s.a) II IV III II III
cl(s.b) V III III III III
4.50
Automata
From a DFA to a smaller DFA
TVHoai, HTNguyen,
NAKhuong, LHTrang
a b
0 1 2

b b a a a, b a, b
Contents

Motivation
a b Alphabets, words and
3 4 5 languages

Regular expression or
rationnal expression

equivalence relationships Non-deterministic


finite automata
s 0 1 2 3 4 5 0 1 2 3 4 5 Deterministic finite
cl(s) I II I II I I I II III II IV III automata

cl(s.a) II I I I II I II IV III IV II III Recognized languages

Determinisation
cl(s.b) II I I I I I II III III I III III
Minimization

DFAs combination
s 0 1 2 3 4 5
Some applications
cl(s) I II III V IV III
cl(s.a) II IV III IV II III
cl(s.b) V III III I III III
4.50
Automata
From a DFA to a smaller DFA
TVHoai, HTNguyen,
NAKhuong, LHTrang

a
{0} {1}
a, b
b

b b a a Contents

Motivation
{2, 5}
b Alphabets, words and
languages
a
{3} {4} Regular expression or
rationnal expression

Non-deterministic
finite automata

Deterministic finite
equivalence relationships automata

Recognized languages

Determinisation
s 0 1 2 3 4 5
Minimization
cl(s) I II III V IV III
DFAs combination
cl(s.a) II IV III IV II III
Some applications
cl(s.b) V III III I III III

4.51
Automata
Another example of minimization
TVHoai, HTNguyen,
NAKhuong, LHTrang
a b

a b
0 1 2

Contents
b
a b Motivation

Alphabets, words and


languages
b
Regular expression or
rationnal expression

3 4 a 5 Non-deterministic
b finite automata

Deterministic finite
a a automata

Recognized languages

Determinisation

Minimization
equivalence relationships
DFAs combination
s 0 1 2 3 4 5 Some applications
cl(s) I I II I I I
cl(s.a) I I I I I I
cl(s.b) I II II I I II
4.52
Automata
Another example of minimization
TVHoai, HTNguyen,
NAKhuong, LHTrang
a b

a b
0 1 2

Contents
b
a b Motivation

Alphabets, words and


languages
b
Regular expression or
rationnal expression

3 4 a 5 Non-deterministic
b finite automata

Deterministic finite
a a automata

Recognized languages

Determinisation

Minimization
equivalence relationships
DFAs combination
s 0 1 2 3 4 5 0 1 2 3 4 5 Some applications
cl(s) I I II I I I I III II I I III
cl(s.a) I I I I I I III I I III I I
cl(s.b) I II II I I II I II II I I II
4.52
Automata
Another example of minimization
TVHoai, HTNguyen,
NAKhuong, LHTrang
a b

a b
0 1 2

Contents
b
a b Motivation

Alphabets, words and


languages
b
Regular expression or
rationnal expression

3 4 a 5 Non-deterministic
b finite automata

Deterministic finite
a a automata

Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.53
Automata
Another example of minimization
TVHoai, HTNguyen,
NAKhuong, LHTrang
a b

a b
0 1 2

Contents
b
a b Motivation

Alphabets, words and


languages
b
Regular expression or
rationnal expression

3 4 a 5 Non-deterministic
b finite automata

Deterministic finite
a a automata

Recognized languages

Determinisation

Minimization
equivalence relationships
DFAs combination
s 0 1 2 3 4 5 Some applications
cl(s) I III II I I III
cl(s.a) III I I III I I
cl(s.b) I II II I I II
4.53
Automata
Another example of minimization
TVHoai, HTNguyen,
NAKhuong, LHTrang
a b

a b
0 1 2

Contents
b
a b Motivation

Alphabets, words and


languages
b
Regular expression or
rationnal expression

3 4 a 5 Non-deterministic
b finite automata

Deterministic finite
a a automata

Recognized languages

Determinisation

Minimization
equivalence relationships
DFAs combination
s 0 1 2 3 4 5 0 1 2 3 4 5 Some applications
cl(s) I III II I I III I III II I IV III
cl(s.a) III I I III I I III IV I III IV IV
cl(s.b) I II II I I II IV II II IV I II
4.53
Automata
Another example of minimization
TVHoai, HTNguyen,
NAKhuong, LHTrang
a

a b
{0, 3} {1, 5} 2

b Contents

b Motivation
a Alphabets, words and
b languages

Regular expression or
rationnal expression

4 Non-deterministic
finite automata

Deterministic finite
automata
a
Recognized languages

Determinisation

equivalence relationships Minimization

DFAs combination
s 0 1 2 3 4 5
Some applications
cl(s) I III II I IV III
cl(s.a) III IV I III IV IV
cl(s.b) IV II II IV I II
4.54
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang
Let Σ = {a, b}
Determine minimal DFA which corresponds to the following DFA:
b
b
0 1 8
Contents
b
Motivation
a a a a a Alphabets, words and
languages

b Regular expression or
rationnal expression

b Non-deterministic
2 3 4 finite automata

Deterministic finite
automata
b
Recognized languages

a a b Determinisation

Minimization
b a DFAs combination

Some applications
5 6 7

b a
4.55
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang

b a, b
Contents

Motivation
b a
0 1 2 Alphabets, words and
languages

Regular expression or
rationnal expression

a b Non-deterministic
finite automata

Deterministic finite
automata

Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.56
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang

b a, b
Contents

Motivation
b a
0 1 2 Alphabets, words and
languages

Regular expression or
rationnal expression

a b Non-deterministic
finite automata

Deterministic finite
automata
Hint Recognized languages

Two-steps approach: (NFA → DFA); min (DFA). Determinisation

Minimization

DFAs combination

Some applications

4.56
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang

σ = {a, b}
Contents

Determine minimimal DFA regconized the languages represented Motivation

by the following regular expressions: Alphabets, words and


languages
∗ ∗
1 E1 = (a + b) b(a + b) Regular expression or
rationnal expression

Non-deterministic
finite automata

Deterministic finite
automata

Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.57
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang

σ = {a, b}
Contents

Determine minimimal DFA regconized the languages represented Motivation

by the following regular expressions: Alphabets, words and


languages
∗ ∗
1 E1 = (a + b) b(a + b) Regular expression or
rationnal expression
2 E2 = ((a + b)2 )∗ + ((a + b)3 )∗ Non-deterministic
finite automata

Deterministic finite
automata

Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.57
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang

σ = {a, b}
Contents

Determine minimimal DFA regconized the languages represented Motivation

by the following regular expressions: Alphabets, words and


languages
∗ ∗
1 E1 = (a + b) b(a + b) Regular expression or
rationnal expression
2 E2 = ((a + b)2 )∗ + ((a + b)3 )∗ Non-deterministic
finite automata
3 E3 = ((a + b)2 )+ + ((a + b)3 )+
Deterministic finite
automata

Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.57
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang

σ = {a, b}
Contents

Determine minimimal DFA regconized the languages represented Motivation

by the following regular expressions: Alphabets, words and


languages
∗ ∗
1 E1 = (a + b) b(a + b) Regular expression or
rationnal expression
2 E2 = ((a + b)2 )∗ + ((a + b)3 )∗ Non-deterministic
finite automata
3 E3 = ((a + b)2 )+ + ((a + b)3 )+
Deterministic finite
4 E4 = baa∗ + ab + (a + b)ab∗ . automata

Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.57
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang

σ = {a, b, c, d}
Contents
Determine minimimal complete DFA regconized the languages
Motivation
consisting of all strings where all ’a’ is followed by a ’b’ and all ’c’ is
Alphabets, words and
followed by a ’b’. languages

Then, deduce the corresponding regular expressions. Regular expression or


rationnal expression

Non-deterministic
finite automata

Deterministic finite
automata

Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.58
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang

σ = {a, b, c, d}
Contents
Determine minimimal complete DFA regconized the languages
Motivation
consisting of all strings where all ’a’ is followed by a ’b’ and all ’c’ is
Alphabets, words and
followed by a ’b’. languages

Then, deduce the corresponding regular expressions. Regular expression or


rationnal expression

Non-deterministic
σ = {a, b} finite automata

Deterministic finite
Give a NFA (as simple as possible) for the language defined by the automata

regular expression ab∗ + a(ba)∗ . Then determine the equivalent DFA. Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.58
Automata
Exercise
TVHoai, HTNguyen,
NAKhuong, LHTrang

Let Σ = {a, b, c}
Determine minimimal DFA regconized the languages represented by the
following regular expressions:
Contents
1 a∗ + b∗ ,
Motivation
2 a∗ b + b∗ a, Alphabets, words and
languages
3 b(ca + ac)(aa)∗ + a∗ (a + b), Regular expression or
rationnal expression
4 (a∗ b + b∗ a)∗ .
Non-deterministic

5 a∗ bc + bca∗ , finite automata

Deterministic finite
6 b(c + c)(aa)∗ + (a + c)a∗ , automata

Recognized languages
7 aab + cab∗ ac, Determinisation

8 b(ca + ac)(a)∗ + a(a + b)∗ , Minimization

∗ DFAs combination
9 ab(b + c)ab + ba(c + b) + (b + c)ab(b + c).
Some applications

4.59
Automata
Equivalent automatons
TVHoai, HTNguyen,
NAKhuong, LHTrang

Two following automatas are equivalent?

q0 p0 p3 Contents
a Motivation

Alphabets, words and


languages
a a Regular expression or
b a b b a a rationnal expression

Non-deterministic
a finite automata

Deterministic finite

q1 q2 p1 a p2
automata

Recognized languages

Determinisation
a Minimization

b b DFAs combination

Some applications

4.60
Automata
Equivalent automatons
TVHoai, HTNguyen,
NAKhuong, LHTrang

Two following DFAs are equivalent?

q0 p0 p3 Contents
b Motivation

Alphabets, words and


languages
a a Regular expression or
b b b b a a rationnal expression

Non-deterministic
a finite automata

Deterministic finite

q1 q2 p1 a p2
automata

Recognized languages

Determinisation
a Minimization

b b DFAs combination

Some applications

4.61
Automata
Combination of two automata
TVHoai, HTNguyen,
NAKhuong, LHTrang

Σ = {a, b}
Contents
a) Given two languages La , Lb defined by regular expressions
Motivation
Ea = a(a + b)∗ and Eb = a∗ (ba)∗
Alphabets, words and
languages
b) Give a DFA for the language La , Lb .
Regular expression or
c) Then, determine a (minimized) DFA for the following languages. rationnal expression

Non-deterministic
1 L1 ◦ Lb
= La T finite automata

2 L2 = La S Lb Deterministic finite
automata
3 L3 = La Lb
Recognized languages
4 L4 = La \ Lb
Determinisation

Minimization

DFAs combination

Some applications

4.62
Automata
Combination of two automata
TVHoai, HTNguyen,
NAKhuong, LHTrang

Σ = {a, b}
Contents
a) Given two languages La , Lb defined by regular expressions
Motivation
Ea = (a∗ b + b∗ a)+ and Eb = (a + b)∗ b(a + b)∗ a
Alphabets, words and
languages
b) Give a DFA for the language La , Lb .
Regular expression or
c) Then, determine a (minimized) DFA for the following languages. rationnal expression

Non-deterministic
1 L1 ◦ Lb
= La T finite automata

2 L2 = La S Lb Deterministic finite
automata
3 L3 = La Lb
Recognized languages
4 L4 = La \ Lb
Determinisation

Minimization

DFAs combination

Some applications

4.62
Automata
Combination of two automata
TVHoai, HTNguyen,
NAKhuong, LHTrang

Σ = {a, b}
Contents
a) Given two languages La , Lb defined by regular expressions
Motivation
Ea = ab∗ + a(ba)∗ and Eb = baa∗ + ab + (a + b)ab∗
Alphabets, words and
languages
b) Give a DFA for the language La , Lb .
Regular expression or
c) Then, determine a (minimized) DFA for the following languages. rationnal expression

Non-deterministic
1 L1 ◦ Lb
= La T finite automata

2 L2 = La S Lb Deterministic finite
automata
3 L3 = La Lb
Recognized languages
4 L4 = La \ Lb
Determinisation

Minimization

DFAs combination

Some applications

4.62
Automata
Odd Parity Detector
TVHoai, HTNguyen,
NAKhuong, LHTrang

Contents

Motivation

Alphabets, words and


Describe DFA for Odd Parity Detector languages

Regular expression or
rationnal expression

Non-deterministic
finite automata

Deterministic finite
automata

Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.63
Automata
TCP/IP protocol
TVHoai, HTNguyen,
NAKhuong, LHTrang

Contents

Motivation

Alphabets, words and


Describe DFA for a demonstration of TCP/IP protocol languages

Regular expression or
rationnal expression

Non-deterministic
finite automata

Deterministic finite
automata

Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.64
Automata
Application
TVHoai, HTNguyen,
NAKhuong, LHTrang

Contents
Propose an automata to describe a vehicular multi-information
Motivation
display system with a given number of buttons.
Alphabets, words and
languages

For example, digital speedo meter of Honda Lead motor with only Regular expression or
rationnal expression
one button can display information about: petroleum level, speed, Non-deterministic
trip, date, time, engine oil life. finite automata

(Hint: we distinguish two different actions: quickly press the Deterministic finite
automata
button; press the button and hold-down over two seconds.) Recognized languages

Determinisation

Minimization

DFAs combination

Some applications

4.65

You might also like