Chapter 1 automata
Chapter 1 automata
Introduction to
Formal Language And
Automata
Student Handout
March 2020
Chapter One
Formal Language
Introduction
Theory of Computation
Why we study theory?
Theory provides concepts and principles that help us understand the general nature of the
discipline.
The ideas we win discuss have some immediate and important applications.
E.g. digital design, programming language, compiler design etc.
We use it to convince the reader.
We will look at models that represent features at the core of all computers and their applications. To
model the hardware of a computer, we introduce the notation of automation (plural, automata).
Automation is a construct that processes all the indispensable features of a digital computer.
It accepts inputs, produces outputs, may have some temporarily storage, and can make decisions in
transforming the input into the output.
A language is a system of communication consisting of a set of primitives and rules.
Types of Language
Natural Language: between humans, rules come after the fact.
Formal Language: has pre-established rule e.g. Programming Language
Ideally any sentence in any language has to be true syntactically and semantically.
Remark:
In natural language incorrect syntax can have correct semantic.
In natural language correct syntax may give nonsense semantic.
Example:
The man drives the car. (Nouns → verb → noun phrase)
The car drives the man.
In formal Language syntax and semantic should be correct.
Equivalence: a generation of the concept of equality (identity). To indicate that a pair (x, y) is
equivalent:
We write x ≡ y. But it should satisfy.
1) Reflexivity x ≡ x for all x
2) Symmetry if x ≡ y then y ≡ x
3) Transitivity if x ≡ y and y ≡ z then x ≡ z
Example: x mod 3 = y mod 3
Then 2 ≡ 5 and 12 ≡ 0 ≡ 36
Example:
Let A = {0, 1, 2, 3}
a) R1 = { (0,0) } Yes, because R1 C AxA
b) R2 = { (0,1), (1,2) } Yes, because R2 C AxA
c) R3 = { (0,0), (1,4) } No because R3 C AxA
d) R4 = { (0,0), (0,2), (1,1), (1,3), (2,2), (2,0), (3,1), (3,3) }
Check for equivalence
Solution:
R1, R2 are not equivalence relation
R4 is equivalence
Let R be an equivalent relation on set A
For a Є A, the collection of elements related to a is called an equivalence class, and denoted by a
or [a].
a ={bЄA|aRb}
Example: Find equivalent classes for R4
0 = {0, 2}
2 = {0,2}
1 = {1, 3}
3 = {1,3}
Mathematical Induction
Is used to prove assertions: “Pn , a proposition is true for all n Є N
Steps:
1. Basic Step: verify Pb is true for some base value b;
2. Assumption Step: Pk is true for some k>b
3. Inductive Step: Show for k+1, that is, Pk+1 is true.
Example:
Show that Pn: 1 + 2 + 3 + 4 + , , , , , + n = n(n+1) / 2 is true V n Є N
Proof:
1) basis step: For n = 1, P1 holds
1(1+1) / 2 = 2/2 = 1
2) assumption step: Pk holds for k>1
1 + 2 + 3 , , , , , , k = k(k+1) / 2
3) inductive step: WTS Pk+1 holds
Pk+1: 1 + 2 + 3 + , , , , , , + k + (k+1)
= ((k+1) (k+2)) / 2 ----------------------------------------------------- *
Pk+1: 1 + 2 + 3 + , , , , , , + K+ (k+1) = Pk + (k+1)
= Pk + (k+1)
= k(k+1) / 2 + (k+1) by assumption
= (k(k+1) + 2(k+1)) / 2
= ((k+1) (k+2)) / 2 -----------------------------------------------------------**
* and ** are the same. Pk+1 is true.
Hence, Pn holds for all n Є IN
Direct Graphs
A direct graph G = (V, E) where V is the set of nodes (Vertices)
E C V x V, set of edges
If (v, e ) Є E, then
v e
(v, e) Є E, then
v e
v v2 v2 ..... Vn w
Examples:
...
a) V = { V1,V2, V3,V4 } ECVxV
V3 V4
b) Open Path
V1 V2
V5
V3 V4
TREE
A tree is a directed graph with designed node r, called root and a zero or more sub trees each of whose
roots are connected to r.
r
7
1
3 4
6
5
String
Let Σ be a finite set called an alphabet. A String is a sequence of symbols from Σ.
Example:
Σ = {0, 1}
S1 = 0
S2 = 00
S3 = 0110
S4 = λ (Empty String)
Let S be a string over Σ, then the length of S, denoted by |S| = number of symbols in S.
Consider the above example
|S1| =1, |S2| = 2, |S3| = 4, and |S4| = 0
Given Σ, Σ * the set of strings of finite length
Let Σ = {0, 1}
Σ * = { λ, 0, 1, 00, 01, 10, 11, , , , , , , , }
Let Σ = {a}
Introduction to Formal Language and Automata Page 8
MicroLink Information Technology College