Professional Documents
Culture Documents
ITdiapositivas6 (19 1)
ITdiapositivas6 (19 1)
Andrés A. Aristizábal P.
aaaristizabal@icesi.edu.co
2019-1
1 / 47
Agenda
2 / 47
Finite State Machines Previous Exercises
Agenda
3 / 47
Finite State Machines Previous Exercises
Exercises
Exercise
Present a state table of a Moore machine that accepts just those
strings accepted by the following Mealy machine.
0 1
A A1 B1
B C1 D0
C B0 C0
D D1 A1
4 / 47
Finite State Machines Previous Exercises
Exercises
Exercise
Construct a Mealy machine similar to the following Moore machine.
0 1
A B C 0
B C B 1
C A C 0
5 / 47
Finite State Machines Aims
Agenda
6 / 47
Finite State Machines Aims
Aims
7 / 47
Finite State Machines Discussion
Agenda
8 / 47
Finite State Machines Discussion
9 / 47
Finite State Machines Review of the previous topic
Agenda
10 / 47
Finite State Machines Review of the previous topic
11 / 47
Finite State Machines Review of the previous topic
11 / 47
Finite State Machines Review of the previous topic
11 / 47
Finite State Machines Review of the previous topic
11 / 47
Finite State Machines Review of the previous topic
11 / 47
Finite State Machines Review of the previous topic
11 / 47
Finite State Machines Review of the previous topic
12 / 47
Finite State Machines Review of the previous topic
12 / 47
Finite State Machines Review of the previous topic
12 / 47
Finite State Machines Review of the previous topic
12 / 47
Finite State Machines Review of the previous topic
12 / 47
Finite State Machines Review of the previous topic
12 / 47
Finite State Machines Review of the previous topic
Example
From the following state table of a Mealy machine, apply the partitioning procedure.
13 / 47
Finite State Machines Review of the previous topic
Answer
14 / 47
Finite State Machines Review of the previous topic
15 / 47
Finite State Machines Review of the previous topic
15 / 47
Finite State Machines Review of the previous topic
16 / 47
Finite State Machines Review of the previous topic
16 / 47
Finite State Machines Review of the previous topic
16 / 47
Finite State Machines Review of the previous topic
Example
From the following state table of a Mealy machine, find its equivalent reduced
automaton.
17 / 47
Finite State Machines Review of the previous topic
Answer
The first step is to apply the partitioning procedure on M.
18 / 47
Finite State Machines Review of the previous topic
Answer
Each block belonging to the final partition Pf of M is a state of M 0 . That
is why we have to rename them.
19 / 47
Finite State Machines Review of the previous topic
Answer
To find the s−successor of a state q 0 in M 0 , select any state in the block of the partition Pf
corresponding to q 0 and find the block containing its s−successor; the corresponding state of M 0
is the s−successor of q 0 . The output for an s−transition from state q 0 of M 0 is the output for an
s−transition from any state in the block corresponding to q 0 .
20 / 47
Finite State Machines Review of the previous topic
Answer
Taking into account the new state table, we assign the new names to the blocks.
21 / 47
Finite State Machines Review of the previous topic
22 / 47
Finite State Machines Review of the previous topic
22 / 47
Finite State Machines Review of the previous topic
23 / 47
Finite State Machines Review of the previous topic
23 / 47
Finite State Machines Review of the previous topic
24 / 47
Finite State Machines Review of the previous topic
24 / 47
Finite State Machines Review of the previous topic
25 / 47
Finite State Machines Review of the previous topic
25 / 47
Finite State Machines Review of the previous topic
25 / 47
Finite State Machines Review of the previous topic
25 / 47
Finite State Machines Review of the previous topic
25 / 47
Finite State Machines Review of the previous topic
Example
Prove the equivalence of the following Mealy machines.
26 / 47
Finite State Machines Review of the previous topic
Example
We apply the direct sum between the automata
27 / 47
Finite State Machines Review of the previous topic
Example
We apply the partitioning algorithm on the direct sum result.
28 / 47
Finite State Machines Exercises
Agenda
29 / 47
Finite State Machines Exercises
Exercises
Exercise
Consider the following machines M1 and M2 .
30 / 47
Finite State Machines Exercises
Exercises
Exercise
Consider the following machines M1 and M2 .
31 / 47
Finite State Machines Exercises
Exercises
Exercise
Consider the following machines M1 and M2 .
c) A is the initial for M1 and M2 Verify if these two are equivalent. If they are not find the
minimum distinguishable sequence for them.
32 / 47
Finite State Machines Exercises
Exercises
Exercise
Let M be the following automaton with state A as its initial state:
Give the state table representation for the reduced Moore machine equivalent to M.
33 / 47
Regular languages and finite automata Presentation of the following topic
Agenda
34 / 47
Regular languages and finite automata Presentation of the following topic
What is an alphabet?
35 / 47
Regular languages and finite automata Presentation of the following topic
What is an alphabet?
Definition
An alphabet is a non empty finite set whose elements are called
symbols. We denote an arbitrary alphabet with the letter Σ.
35 / 47
Regular languages and finite automata Presentation of the following topic
What is an alphabet?
Definition
An alphabet is a non empty finite set whose elements are called
symbols. We denote an arbitrary alphabet with the letter Σ.
35 / 47
Regular languages and finite automata Presentation of the following topic
What is an alphabet?
Definition
An alphabet is a non empty finite set whose elements are called
symbols. We denote an arbitrary alphabet with the letter Σ.
35 / 47
Regular languages and finite automata Presentation of the following topic
Example
Let Σ = {a, b} be the alphabet which includes symbols a and b.
36 / 47
Regular languages and finite automata Presentation of the following topic
Example
Let Σ = {a, b} be the alphabet which includes symbols a and b.
The following sequences are strings over Σ :
aba
ababaaa
aaaab
36 / 47
Regular languages and finite automata Presentation of the following topic
Example
Let Σ = {a, b} be the alphabet which includes symbols a and b.
The following sequences are strings over Σ :
aba
ababaaa
aaaab
36 / 47
Regular languages and finite automata Presentation of the following topic
37 / 47
Regular languages and finite automata Presentation of the following topic
37 / 47
Regular languages and finite automata Presentation of the following topic
37 / 47
Regular languages and finite automata Presentation of the following topic
37 / 47
Regular languages and finite automata Presentation of the following topic
37 / 47
Regular languages and finite automata Presentation of the following topic
37 / 47
Regular languages and finite automata Presentation of the following topic
38 / 47
Regular languages and finite automata Presentation of the following topic
Definition
We denote the length of a string u ∈ Σ∗ as |u| and we define it as the number of
symbols in u (counting any repetitions). That is,
38 / 47
Regular languages and finite automata Presentation of the following topic
Definition
We denote the length of a string u ∈ Σ∗ as |u| and we define it as the number of
symbols in u (counting any repetitions). That is,
0 if u = λ
|u| =
n if u = a1 a2 · · · an .
38 / 47
Regular languages and finite automata Presentation of the following topic
Definition
We denote the length of a string u ∈ Σ∗ as |u| and we define it as the number of
symbols in u (counting any repetitions). That is,
0 if u = λ
|u| =
n if u = a1 a2 · · · an .
Example
|aba| = 3, |baaa| = 4
38 / 47
Regular languages and finite automata Presentation of the following topic
39 / 47
Regular languages and finite automata Presentation of the following topic
39 / 47
Regular languages and finite automata Presentation of the following topic
R λ if u = λ
u =
an · · · a2 a1 si u = a1 a2 · · · an .
39 / 47
Regular languages and finite automata Presentation of the following topic
What is a substring?
40 / 47
Regular languages and finite automata Presentation of the following topic
What is a substring?
Definition
We say that v is a substring or subword of u if there exist x, y such that u = xvy . Note
that x or y can be λ therefore the empty string is a substring of any string and also any
string is a substring of itself.
40 / 47
Regular languages and finite automata Presentation of the following topic
What is a substring?
Definition
We say that v is a substring or subword of u if there exist x, y such that u = xvy . Note
that x or y can be λ therefore the empty string is a substring of any string and also any
string is a substring of itself.
What is a prefix?
40 / 47
Regular languages and finite automata Presentation of the following topic
What is a substring?
Definition
We say that v is a substring or subword of u if there exist x, y such that u = xvy . Note
that x or y can be λ therefore the empty string is a substring of any string and also any
string is a substring of itself.
What is a prefix?
Definition
A prefix of u is a string v such that u = vw for any string w ∈ Σ∗ . We say that v is a
proper prefix if v 6= u.
40 / 47
Regular languages and finite automata Presentation of the following topic
What is a substring?
Definition
We say that v is a substring or subword of u if there exist x, y such that u = xvy . Note
that x or y can be λ therefore the empty string is a substring of any string and also any
string is a substring of itself.
What is a prefix?
Definition
A prefix of u is a string v such that u = vw for any string w ∈ Σ∗ . We say that v is a
proper prefix if v 6= u.
What is a suffix?
40 / 47
Regular languages and finite automata Presentation of the following topic
What is a substring?
Definition
We say that v is a substring or subword of u if there exist x, y such that u = xvy . Note
that x or y can be λ therefore the empty string is a substring of any string and also any
string is a substring of itself.
What is a prefix?
Definition
A prefix of u is a string v such that u = vw for any string w ∈ Σ∗ . We say that v is a
proper prefix if v 6= u.
What is a suffix?
Definition
A suffix of u is a string v such u = wv for any string w ∈ Σ∗ . We say that v is a
proper suffix if v 6= u.
40 / 47
Regular languages and finite automata Presentation of the following topic
Note that λ is a prefix and suffix of any string u since uλ = λu = u. Using the same
reasoning, u is a prefix and suffix of itself.
41 / 47
Regular languages and finite automata Presentation of the following topic
Note that λ is a prefix and suffix of any string u since uλ = λu = u. Using the same
reasoning, u is a prefix and suffix of itself.
Example
Let Σ = {a, d, c, d} and u = bcbaadb.
Prefixes of u : Suffixes of u :
λ λ
b b
bc db
bcb adb
bcba aadb
bcbaa baadb
bcbaaad cbaadb
bcbaadb bcbaadb
41 / 47
Regular languages and finite automata Presentation of the following topic
What is a language?
42 / 47
Regular languages and finite automata Presentation of the following topic
What is a language?
Definition
A language L over an alphabet Σ is a subset of Σ∗ , that is L ⊆ Σ∗
42 / 47
Regular languages and finite automata Presentation of the following topic
What is a language?
Definition
A language L over an alphabet Σ is a subset of Σ∗ , that is L ⊆ Σ∗
Special cases:
L = ∅, empty language.
L = Σ∗ , language of all strings over Σ.
42 / 47
Regular languages and finite automata Presentation of the following topic
What is a language?
Definition
A language L over an alphabet Σ is a subset of Σ∗ , that is L ⊆ Σ∗
Special cases:
L = ∅, empty language.
L = Σ∗ , language of all strings over Σ.
42 / 47
Regular languages and finite automata Presentation of the following topic
Example
The following are examples of languages over specific alphabets.
43 / 47
Regular languages and finite automata Presentation of the following topic
Example
The following are examples of languages over specific alphabets.
Σ = {a, b, c}. L = {a, aba, aca}.
43 / 47
Regular languages and finite automata Presentation of the following topic
Example
The following are examples of languages over specific alphabets.
Σ = {a, b, c}. L = {a, aba, aca}.
Σ = {a, b, c}. L = {a, aa, aaa, ...} = {an | n ≥ 1}.
43 / 47
Regular languages and finite automata Presentation of the following topic
Example
The following are examples of languages over specific alphabets.
Σ = {a, b, c}. L = {a, aba, aca}.
Σ = {a, b, c}. L = {a, aa, aaa, ...} = {an | n ≥ 1}.
Σ = {a, b, c}. L = {λ, aa, aba, ab2 a, ab3 a, ...} =
{abn a | n ≥ 0} ∪ {λ}.
43 / 47
Regular languages and finite automata Presentation of the following topic
44 / 47
Regular languages and finite automata Presentation of the following topic
Definition
Since languages over Σ are subsets of Σ∗ , the basic operations for sets are also valid
for languages. Therefore, if A y B are languages over Σ (that is A, B ⊆ Σ∗ ), then the
following are also languages over Σ :
44 / 47
Regular languages and finite automata Presentation of the following topic
Definition
Since languages over Σ are subsets of Σ∗ , the basic operations for sets are also valid
for languages. Therefore, if A y B are languages over Σ (that is A, B ⊆ Σ∗ ), then the
following are also languages over Σ :
A∪B Union
44 / 47
Regular languages and finite automata Presentation of the following topic
Definition
Since languages over Σ are subsets of Σ∗ , the basic operations for sets are also valid
for languages. Therefore, if A y B are languages over Σ (that is A, B ⊆ Σ∗ ), then the
following are also languages over Σ :
A∪B Union
A∩B Intersecction
44 / 47
Regular languages and finite automata Presentation of the following topic
Definition
Since languages over Σ are subsets of Σ∗ , the basic operations for sets are also valid
for languages. Therefore, if A y B are languages over Σ (that is A, B ⊆ Σ∗ ), then the
following are also languages over Σ :
A∪B Union
A∩B Intersecction
A−B Difference
44 / 47
Regular languages and finite automata Presentation of the following topic
Definition
Since languages over Σ are subsets of Σ∗ , the basic operations for sets are also valid
for languages. Therefore, if A y B are languages over Σ (that is A, B ⊆ Σ∗ ), then the
following are also languages over Σ :
A∪B Union
A∩B Intersecction
A−B Difference
A = Σ∗ − A Complement
44 / 47
Regular languages and finite automata Presentation of the following topic
Definition
Since languages over Σ are subsets of Σ∗ , the basic operations for sets are also valid
for languages. Therefore, if A y B are languages over Σ (that is A, B ⊆ Σ∗ ), then the
following are also languages over Σ :
A∪B Union
A∩B Intersecction
A−B Difference
A = Σ∗ − A Complement
These operations for languages are called set or boolean operations in order to
distinguish them from the linguistic ones which are those that extend the operations
over strings but for languages.
44 / 47
Regular languages and finite automata Presentation of the following topic
45 / 47
Regular languages and finite automata Presentation of the following topic
45 / 47
Regular languages and finite automata Presentation of the following topic
AB = {uv | u ∈ A, v ∈ B}
45 / 47
Regular languages and finite automata Presentation of the following topic
AB = {uv | u ∈ A, v ∈ B}
In general, AB 6= BA
45 / 47
Regular languages and finite automata Presentation of the following topic
46 / 47
Regular languages and finite automata Presentation of the following topic
Definition
Let A, B, C be languages over Σ, that is A, B, C ⊆ Σ∗ . Then
46 / 47
Regular languages and finite automata Presentation of the following topic
Definition
Let A, B, C be languages over Σ, that is A, B, C ⊆ Σ∗ . Then
1 A · ∅ = ∅ · A = ∅.
46 / 47
Regular languages and finite automata Presentation of the following topic
Definition
Let A, B, C be languages over Σ, that is A, B, C ⊆ Σ∗ . Then
1 A · ∅ = ∅ · A = ∅.
2 A · {λ} = {λ} · A = A.
46 / 47
Regular languages and finite automata Presentation of the following topic
Definition
Let A, B, C be languages over Σ, that is A, B, C ⊆ Σ∗ . Then
1 A · ∅ = ∅ · A = ∅.
2 A · {λ} = {λ} · A = A.
3 Associative property,
A · (B · C) = (A · B) · C.
46 / 47
Regular languages and finite automata Presentation of the following topic
Definition
Let A, B, C be languages over Σ, that is A, B, C ⊆ Σ∗ . Then
1 A · ∅ = ∅ · A = ∅.
2 A · {λ} = {λ} · A = A.
3 Associative property,
A · (B · C) = (A · B) · C.
4 Distributivity of concatenation over the union,
A · (B ∪ C) = A · B ∪ A · C.
(B ∪ C) · A = B · A ∪ C · A.
46 / 47
Regular languages and finite automata Presentation of the following topic
Definition
Let A, B, C be languages over Σ, that is A, B, C ⊆ Σ∗ . Then
1 A · ∅ = ∅ · A = ∅.
2 A · {λ} = {λ} · A = A.
3 Associative property,
A · (B · C) = (A · B) · C.
4 Distributivity of concatenation over the union,
A · (B ∪ C) = A · B ∪ A · C.
(B ∪ C) · A = B · A ∪ C · A.
5 Generalized distributivity property. If {Bi }i ∈ I is any language family over Σ, then
S S
A· Bi = (A · Bi ),
S i ∈ I i ∈I
S
Bi · A = (Bi · A).
i ∈I i ∈I
46 / 47
Regular languages and finite automata Presentation of the following topic
Next class
47 / 47