0% found this document useful (0 votes)
17 views38 pages

Toan Roi Rac 2 Nguyen An Khuong, Huynh Tuong Nguyen Dm2 Ch4 Automata (Cuuduongthancong - Com)

Uploaded by

k745vh6rd9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views38 pages

Toan Roi Rac 2 Nguyen An Khuong, Huynh Tuong Nguyen Dm2 Ch4 Automata (Cuuduongthancong - Com)

Uploaded by

k745vh6rd9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

Automata

Nguyen An Khuong,
Huynh Tuong Nguyen,

Chapter 4
Bui Hoai Thang

Automata
Discrete Mathematics II
Contents

Motivation

Alphabets, words and


languages

Regular expression or
rationnal expression
(Materials drawn from this chapter in: Non-deterministic
- Peter Linz. An Introduction to Formal Languages and Automata, (5th Ed.), finite automata
Jones & Bartlett Learning, 2011. Deterministic finite
- John E. Hopcroft, Rajeev Motwani and Jeffrey D. Ullamn. Introduction to automata

Automata Theory, Languages, and Computation (3rd Ed.), Prentice Hall, Recognized languages
2006. Determinisation

- Antal Iványi Algorithms of Informatics, Kempelen Farkas Hallgatói


Információs Központ, 2011. )
Nguyen An Khuong, Huynh Tuong Nguyen, Bui Hoai Thang
Faculty of Computer Science and Engineering
ng.com https://fb.com/tailieudientucntt
University of Technology, VNU-HCM
4.1
Automata
Contents
Nguyen An Khuong,
Huynh Tuong Nguyen,
Bui Hoai Thang

1 Motivation

2 Alphabets, words and languages


Contents

3 Regular expression or rationnal expression Motivation

Alphabets, words and


languages

4 Non-deterministic finite automata Regular expression or


rationnal expression

Non-deterministic
finite automata
5 Deterministic finite automata Deterministic finite
automata

Recognized languages
6 Recognized languages Determinisation

7 Determinisation

ng.com https://fb.com/tailieudientucntt
4.2
Automata
Introduction
Nguyen An Khuong,
Huynh Tuong Nguyen,
Bui Hoai Thang
Standard states of a process in operating system

• O with label: states


• →: transitions

Contents
Resource
Motivation

Alphabets, words and


Waiting Blocked languages

Regular expression or
rationnal expression
Resource Non-deterministic
finite automata

CPU Deterministic finite


automata

Recognized languages
CPU Resource Determinisation

Running

ng.com https://fb.com/tailieudientucntt
4.3
Automata
Why study automata theory?
Nguyen An Khuong,
Huynh Tuong Nguyen,
Bui Hoai Thang

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
that breaks the input text into logical units languages

Regular expression or
3 scanning large bodies of text, such as collections of Web rationnal expression

pages, to find occurrences of words, phrases or other patterns Non-deterministic


finite automata

4 verifying pratical systems of all types that have a finite Deterministic finite
automata
number of distinct states, such as communications protocols Recognized languages
of protocols for secure exchange information, etc. Determinisation

ng.com https://fb.com/tailieudientucntt
4.4
Automata
Alphabets, symbols
Nguyen An Khuong,
Huynh Tuong Nguyen,
Bui Hoai Thang

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

• The binary alphabet: Σ = {0, 1} Alphabets, words and


languages
• The set of all lower-case letters: Σ = {a, b, . . . , z} Regular expression or
rationnal expression
• The set of all ASCII characters. Non-deterministic
finite automata

Deterministic finite
Remark automata

Recognized languages
Σ is almost always all available characters (lowercase letters, Determinisation
capital letters, numbers, symbols and special characters such as
space or newline).
But nothing prevents to imagine other sets.

ng.com https://fb.com/tailieudientucntt
4.5
Automata
Strings (words)
Nguyen An Khuong,
Huynh Tuong Nguyen,
Bui Hoai Thang

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
• The length of the string, denoted by |u|, is the number of Alphabets, words and
languages
characters.
Regular expression or
• All the strings over Σ is denoted by Σ∗ . rationnal expression

• A language L over Σ is a sub-set of Σ∗ . Non-deterministic


finite automata

Deterministic finite
automata

Remark Recognized languages

∗ Determinisation
The purpose aims to analyze a string of Σ in order to know
whether it belongs or not to L.

ng.com https://fb.com/tailieudientucntt
4.6
Automata
Example
Nguyen An Khuong,
Huynh Tuong Nguyen,
Bui Hoai Thang

Let Σ = {0, 1}

• ε is a string with length of 0.


• 0 and 1 are the strings with length of 1.
Contents
• 00, 01, 10 and 11 are the strings with length of 2. Motivation

• ∅ is a language over Σ . It’s called the empty language. Alphabets, words and
languages

• Σ is a language over Σ . It’s called the universal language. Regular expression or
rationnal expression
• {ε} is a language over Σ . Non-deterministic
finite automata
• {0, 00, 001} is also a language over Σ .
Deterministic finite
• The set of strings which contain an odd number of 0 is a language automata

over Σ. Recognized languages

Determinisation
• The set of strings that contain as many of 1 as 0 is a language
over Σ.

ng.com https://fb.com/tailieudientucntt
4.7
Automata
String concatenation
Nguyen An Khuong,
Huynh Tuong Nguyen,
Bui Hoai Thang

Intuitively, the concatenation of two strings 01 and 10 is 0110. Contents

Concatenating the empty string ε and the string 110 is the string Motivation

Alphabets, words and


110. languages

Regular expression or
rationnal expression
Definition
Non-deterministic
String concatenation is an application of Σ∗ × Σ∗ to Σ∗ . finite automata

Concatenation of two strings u and v in Σ is the string u.v. Deterministic finite


automata

Recognized languages

Determinisation

ng.com https://fb.com/tailieudientucntt
4.8
Automata
Languages
Nguyen An Khuong,
Huynh Tuong Nguyen,
Bui Hoai Thang
Specifying languages
A language can be specified in several ways:
a) enumeration of its words, for example:
• L1 = {ε, 0, 1},
• L2 = {a, aa, aaa, ab, ba}, Contents
• L3 = {ε, ab, aabb, aaabbb, aaaabbbb, . . .}, Motivation

b) a property, such that all words of the language have this property Alphabets, words and
languages
but other words have not, for example: Regular expression or
• L4 = {an bn |n = 0, 1, 2, . . .}, rationnal expression

• L5 = {uu−1 |u ∈ Σ∗ }, Non-deterministic
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
N = {S}, T = {a, b}, P = {S → aSb, S → ab}
i.e. L(G) = {an bn |N ≥ 1} since
S ⇒ aSb ⇒ a2 Sb2 ⇒ . . . ⇒ an Sbn
ng.com https://fb.com/tailieudientucntt
4.9
Automata
Operations on languages
Nguyen An Khuong,
Huynh Tuong Nguyen,
L, L1 , L2 are languages over Σ Bui Hoai Thang

• 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
L = Σ∗ \ L, languages

• multiplication Regular expression or


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

L0 = {ε}, Ln = Ln−1 L , if n ≥ 1, Deterministic finite


automata
• iteration or star operation

[ Recognized languages

L∗ = Li = L0 ∪ L ∪ L2 ∪ · · · ∪ Li ∪ · · · , Determinisation

i=0
We will use also the notation L+
[∞
L+ = Li = L ∪ L2 ∪ · · · ∪ Li ∪ · · · .
i=1
The union, product and iteration
ng.com are called regular operations.
https://fb.com/tailieudientucntt
4.10
Automata
Example
Nguyen An Khuong,
Huynh Tuong Nguyen,
Bui Hoai Thang

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


Contents
L2 = u.v, with u, v ∈ L including the following strings:
Motivation
• abab, abaa, abb, abca, abbac, Alphabets, words and
languages
• aaab, aaaa, aab, aaca, aabac,
Regular expression or
• bab, baa, bb, bca, bbac, rationnal expression

Non-deterministic
• caab, caaa, cab, caca, cabac, finite automata

• bacab, bacaa, bacb, bacca, bacbac. Deterministic finite


automata

Recognized languages

Determinisation

ng.com https://fb.com/tailieudientucntt
4.11
Automata
Exercise
Nguyen An Khuong,
Huynh Tuong Nguyen,
Bui Hoai Thang

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

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

Alphabets, words and


4) all strings ending with ’a’. languages

Regular expression or
5) all strings not ending with ’a’. rationnal expression

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


finite automata

7) all strings with at least one ’a’. Deterministic finite


automata
8) all strings with at most one ’a’. Recognized languages

9) all strings without any ’a’. Determinisation

10) all strings including at least one ’a’ and whose the first appearance
of ’a’ is not followed by a ’c’.

ng.com https://fb.com/tailieudientucntt
4.12
Automata
Exercise
Nguyen An Khuong,
Huynh Tuong Nguyen,
Bui Hoai Thang

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


Which of the following strings are in L∗ :
1) aaa = a3 ,
2) abaabaaabaa = aba2 ba3 ba2 , Contents

Motivation
3) bbb, Alphabets, words and
languages
4) aab,
Regular expression or
5) cc, rationnal expression

Non-deterministic
6) aaaabaaaa = a4 ba4 , finite automata

Deterministic finite
7) cabbbbaaaaaaaaab = cab3 a9 b, automata

8) baaaaabaaaab = ba5 ba4 b, Recognized languages

Determinisation
9) baaaaabaac = ba5 ba2 c,
10) baca ?.

ng.com https://fb.com/tailieudientucntt
4.13
Automata
Regular expressions
Nguyen An Khuong,
Huynh Tuong Nguyen,
Bui Hoai Thang
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

Regular operations on the languages Motivation

Alphabets, words and


• union ∪ or + languages

Regular expression or
• product of concatenation rationnal expression

Non-deterministic
• transitive closure ∗ finite automata

Deterministic finite
automata

Example Recognized languages

Determinisation

• (a + b)∗ represent all the strings over the aphabet Σ = {a, b}


• a∗ (ba∗ )∗ represent the same language
• (a + b)∗ aab represent all strings ending with aab.
ng.com https://fb.com/tailieudientucntt
4.14
Automata
Regular expressions
Nguyen An Khuong,
Huynh Tuong Nguyen,
Bui Hoai Thang

• ∅ 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
respectively, then (x + y),S(xy), x∗ are regular expression Contents

representing languages X Y , XY and X ∗ respectively. Motivation

Alphabets, words and


x+y ≡ y+x languages

Regular expression or
(x + y) + z ≡ x + (y + z) rationnal expression

Non-deterministic
(xy)z ≡ x(yz) finite automata

(x + y)z ≡ xz + yz Deterministic finite


automata

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

∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ Determinisation
(x + y) ≡ (x + y) ≡ (x + y ) ≡ (x + y )
(x + y)∗ ≡ (x∗ y ∗ )∗
(x∗ )∗ ≡ x∗

x x ≡ xx∗
ng.com https://fb.com/tailieudientucntt
xx∗ + ε ≡ x∗ 4.15
Automata
Regular expressions
Nguyen An Khuong,
Huynh Tuong Nguyen,
Bui Hoai Thang

Contents

Kleene’s theorem Motivation

Alphabets, words and


Language L ⊆ Σ∗ is regular if and only if there exists a regular languages

expression over Σ representing language L. Regular expression or


rationnal expression

Non-deterministic
finite automata

Deterministic finite
automata

Recognized languages

Determinisation

ng.com https://fb.com/tailieudientucntt
4.16
Automata
Exercise
Nguyen An Khuong,
Huynh Tuong Nguyen,
Bui Hoai Thang

Let Σ = {a, b, c}
Give at least 3 words for each language represented by the
following regular expressions Contents

1) a∗ + b∗ , Motivation

Alphabets, words and


2) a∗ b + b∗ a, languages

Regular expression or
3) b(ca + ac)(aa)∗ + a∗ (a + b), rationnal expression

4) (a∗ b + b∗ a)∗ . Non-deterministic


finite automata

Deterministic finite
automata
Example Recognized languages

a∗ b = {b, ab, a2 b, a3 b, . . . , aaa . . . ab}, Determinisation

ng.com https://fb.com/tailieudientucntt
4.17
Automata
Exercise
Nguyen An Khuong,
Huynh Tuong Nguyen,
Bui Hoai Thang

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


Which languages represented by the following regular expressions
are in L∗ :
1) a∗ + b, Contents

Motivation

2) b , Alphabets, words and
languages
3) aab + cab∗ ac,
Regular expression or
4) b(ca + ac)(aa)∗ + a∗ (a + b), rationnal expression

Non-deterministic
5) (aaaabaaa)2∗ c, finite automata

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

7) (b + c)ab + (ba(c + ab2 + a3 + a4 + b)∗ )∗ ? Recognized languages

Determinisation


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

ng.com https://fb.com/tailieudientucntt
4.18
Automata
Finite automata
Nguyen An Khuong,
Huynh Tuong Nguyen,
Bui Hoai Thang

Finite automata (Ôtômat 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

• The number of states must be finite. Alphabets, words and


languages

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

Deterministic finite
automata
q0 q1 Recognized languages

Determinisation

Regular expression
b∗ (a + b)
ng.com https://fb.com/tailieudientucntt
4.19
Automata
Exercise
Nguyen An Khuong,
Huynh Tuong Nguyen,
Let Σ = {a, b} Bui Hoai Thang

Which of the strings


1) a3 b,
2) aba2 b,
3) a4 b2 ab3 a, Contents

4) a4 ba4 , Motivation

Alphabets, words and


5) ab4 a9 b, languages

6) ba5 ba4 b, Regular expression or


rationnal expression

7) ba5 b2 , Non-deterministic
finite automata
2
8) bab a? Deterministic finite
automata
are accepted by the following finite automata? Recognized languages

Determinisation
a b
b
a
q0 q1 q2
b
ng.com a https://fb.com/tailieudientucntt
4.20
Automata
Exercise
Nguyen An Khuong,
Huynh Tuong Nguyen,
Bui Hoai Thang
Give regular expression for the following finite automata.

a b
b
a Contents
q0 q1 q2
Motivation
b
Alphabets, words and
a languages

Regular expression or
rationnal expression

and this one. Non-deterministic


finite automata

Deterministic finite
automata
b b
Recognized languages
a, b Determinisation

q0 q1

a
ng.com https://fb.com/tailieudientucntt
4.21
Automata
Nondeterministic finite automata
Nguyen An Khuong,
Huynh Tuong Nguyen,
Bui Hoai Thang

Definition
A nondeterministic finite automata (NFA, Ôtômat hữu hạn phi
đơn định) is mathematically represented by a 5-tuples
(Q, Σ, q0 , δ, F ) where Contents

Motivation
• Q a finite set of states.
Alphabets, words and
• Σ is the alphabet of the automata. languages

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

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

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


automata

Recognized languages

Determinisation
Remark
According to an event, a state may go to one or more states.

ng.com https://fb.com/tailieudientucntt
4.22
Automata
NFA with empty symbol ε
Nguyen An Khuong,
Huynh Tuong Nguyen,
Bui Hoai Thang

Other definition of NFA


Finite automaton with transitions defined by character x (in Σ) or Contents

empty character ε. Motivation

Alphabets, words and


languages

b a a, b Regular expression or
rationnal expression
ε b Non-deterministic
finite automata
q0 q1 q2 Deterministic finite
automata

Recognized languages

Determinisation

ng.com https://fb.com/tailieudientucntt
4.23
Automata
Exercise
Nguyen An Khuong,
Huynh Tuong Nguyen,
Bui Hoai Thang

Contents

Consider the set of strings on {a, b} in which every aa is followed Motivation

immediately by b. Alphabets, words and


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

Deterministic finite
automata

Recognized languages

Determinisation

ng.com https://fb.com/tailieudientucntt
4.24
Automata
Exercise
Nguyen An Khuong,
Huynh Tuong Nguyen,
Bui Hoai Thang

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

• E3 = aab + cab ac, Regular expression or
rationnal expression
• E4 = b(ca + ac)(aa)∗ + a∗ (a + b),
Non-deterministic
• E5 = (aaaabaaa)2∗ c, finite automata

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

Recognized languages
• E7 = (b + c)ab + (ba(c + ab2 + a3 + a4 + b)∗ )∗ ,
Determinisation

• E8 = [a(b + c)∗ abc]∗ .

ng.com https://fb.com/tailieudientucntt
4.25
Automata
Deterministic finite automata
Nguyen An Khuong,
Huynh Tuong Nguyen,
Bui Hoai Thang

Definition
A deterministic finite automata (DFA, Ôtômat hữu hạn đơn định)
is given by a 5-tuplet (Q, Σ, q0 , δ, F ) with
Contents
• Q a finite set of states. Motivation

• Σ is the input alphabet of the automata. Alphabets, words and


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

Transition function δ is an application.

ng.com https://fb.com/tailieudientucntt
4.26
Automata
Example
Nguyen An Khuong,
Huynh Tuong Nguyen,
Bui Hoai Thang

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

b b Contents

Motivation
a
Alphabets, words and
languages
q0 q1 Regular expression or
rationnal expression

a Non-deterministic
finite automata

Deterministic finite
automata

Recognized languages

Determinisation
• Q = {q0 , q1 },
• δ(q0 , a) = q1 , δ(q0 , b) = q0 , δ(q1 , a) = q0 , δ(q1 , b) = q1 ,
• F = {q1 }.

ng.com https://fb.com/tailieudientucntt
4.27
Automata
Configurations and executions
Nguyen An Khuong,
Huynh Tuong Nguyen,
Bui Hoai Thang

Let A = (Q, Σ, q0 , δ, F )
A configuration (cấu hình) of automata A is a couple (q, u) where
q ∈ Q and u ∈ Σ∗ . Contents

We define the relation → of derivation between configurations : Motivation

(q, a.u) → (q 0 , u) iif δ(q, a) = q 0 Alphabets, words and


languages

Regular expression or
rationnal expression

Non-deterministic
An execution (thực thi) of automata A is a sequence of finite automata

Deterministic finite
configurations automata
(q0 , u0 ) . . . (qn , un ) such that Recognized languages

(qi , ui ) → (qi+1 , ui+1 ), for i = 0, 1, . . . , n − 1. Determinisation

ng.com https://fb.com/tailieudientucntt
4.28
Automata
Exercise
Nguyen An Khuong,
Huynh Tuong Nguyen,
Bui Hoai Thang

Soit Σ = {0, 1}

• Give an automaton that accepts all words that contain a number


Contents
of 0 multiple of 3.
Motivation
• Give an execution of this automata on 1101010. Alphabets, words and
languages

Regular expression or
rationnal expression
Soit Σ = {a, b}
Non-deterministic
finite automata
• Give an automata that accepts all strings containing 2 characters Deterministic finite
a. automata

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

ng.com https://fb.com/tailieudientucntt
4.29
Automata
Recognized languages
Nguyen An Khuong,
Huynh Tuong Nguyen,
Bui Hoai Thang

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

Proposition Regular expression or


rationnal expression

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


finite automata

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


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

Determinisation

ng.com https://fb.com/tailieudientucntt
4.30
Automata
Example
Nguyen An Khuong,
Huynh Tuong Nguyen,
Bui Hoai Thang

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

Motivation

Regular expression Alphabets, words and


languages
∗ ∗
(a + b) ab(a + b) Automata Regular expression or
rationnal expression
b a a, b Non-deterministic
Transition table finite automata
a b
a b Deterministic finite
automata
→ q0 q1 q0 q0 q1 q2 Recognized languages

q1 q1 q2 Determinisation

q2 ∗ q2 q2

ng.com https://fb.com/tailieudientucntt
4.31
Automata
Example
Nguyen An Khuong,
Huynh Tuong Nguyen,
Bui Hoai Thang

Determine build 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
b Transition table Alphabets, words and
languages

q0 q1 a b
Regular expression or
rationnal expression

→ q0∗ q2 q1 Non-deterministic
finite automata
b q1 q3 q0 Deterministic finite

a a a a q2 q0 q3 automata

q3 q1 q2 Recognized languages

Determinisation
b →: start state

: final state(s)
q2 q3

b
ng.com https://fb.com/tailieudientucntt
4.32
Automata
Equivalent automatons
Nguyen An Khuong,
Huynh Tuong Nguyen,
Bui Hoai Thang

Two following DFAs are equivalent?

q0 p0 p3
a Contents

Motivation

Alphabets, words and


a a languages

b b b b a a Regular expression or
rationnal expression

a Non-deterministic
finite automata

q1 q2 p1 a p2
Deterministic finite
automata

Recognized languages

a Determinisation

b b

ng.com https://fb.com/tailieudientucntt
4.33
Automata
Equivalent automatons
Nguyen An Khuong,
Huynh Tuong Nguyen,
Bui Hoai Thang

Two following DFAs are equivalent?

q0 p0 p3
a Contents

Motivation

Alphabets, words and


a a languages

b a b b a a Regular expression or
rationnal expression

a Non-deterministic
finite automata

q1 q2 p1 a p2
Deterministic finite
automata

Recognized languages

a Determinisation

b b

ng.com https://fb.com/tailieudientucntt
4.34
Automata
From NFA to DFA
Nguyen An Khuong,
Transition table Huynh Tuong Nguyen,
Bui Hoai Thang

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

0 1 b b Alphabets, words and


languages

a Regular expression or
rationnal expression

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

ε Recognized languages

a a Determinisation

b {0, 2}
ng.com https://fb.com/tailieudientucntt
4.35
Automata
Exercise
Nguyen An Khuong,
Huynh Tuong Nguyen,
Let Σ = {a, b, c} Bui Hoai Thang

Determine DFAs which corresponds to the following NFAs:

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

Alphabets, words and


languages
a b
0 1 2 Regular expression or
rationnal expression

Non-deterministic
finite automata

c, ε Deterministic finite
automata

Recognized languages
a b, c Determinisation

b, ε ε
0 1 2
ε
ng.com https://fb.com/tailieudientucntt
4.37
Automata
Exercise
Nguyen An Khuong,
Huynh Tuong Nguyen,
Bui Hoai Thang

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
• L2 = { set of words of even number of a}, rationnal expression

Non-deterministic
• L3 = { set of words containing ab and ending with b}. finite automata

Deterministic finite
Then, determine the corresponging DFAs. automata

Recognized languages

Determinisation

ng.com https://fb.com/tailieudientucntt
4.38
Automata
Exercise
Nguyen An Khuong,
Huynh Tuong Nguyen,
Bui Hoai Thang

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

• E3 = aab + cab ac, Regular expression or
rationnal expression
• E4 = b(ca + ac)(aa)∗ + a∗ (a + b),
Non-deterministic
• E5 = (aaaabaaa)2∗ c, finite automata

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

Recognized languages
• E7 = (b + c)ab + (ba(c + ab2 + a3 + a4 + b)∗ )∗ ,
Determinisation

• E8 = [a(b + c)∗ abc]∗ .

ng.com https://fb.com/tailieudientucntt
4.39

You might also like