0% found this document useful (0 votes)
3 views

Chapter 1 automata

The document is a student handout for the course 'Introduction to Formal Language and Automata' at MicroLink Information Technology College. It covers foundational concepts in formal languages, set theory, functions, relations, and mathematical induction, providing definitions, examples, and explanations relevant to the theory of computation. The content aims to equip students with essential knowledge applicable in areas such as digital design and programming languages.

Uploaded by

Robel
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)
3 views

Chapter 1 automata

The document is a student handout for the course 'Introduction to Formal Language and Automata' at MicroLink Information Technology College. It covers foundational concepts in formal languages, set theory, functions, relations, and mathematical induction, providing definitions, examples, and explanations relevant to the theory of computation. The content aims to equip students with essential knowledge applicable in areas such as digital design and programming languages.

Uploaded by

Robel
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/ 10

MicroLink Information Technology College

Introduction to
Formal Language And
Automata

Student Handout

Course Title: Introduction to Formal Language and


Automata
Course Code: CSSE-363
Credit Hr: 3 [ 3 Lecture ]
Instructor: Ephraim Tilahun

March 2020

Introduction to Formal Language and Automata Page 1


MicroLink Information Technology College

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.

Introduction to Formal Language and Automata Page 2


MicroLink Information Technology College

Review of set Theory


Sets
A set is a collection of elements
S = {0, 1, 2}
To indicate x is an element of S xЄS
Example:
S = { 2, 4, 6, , , , , , }
Or S = {i : i>0, i is Even }
S1 U S2 = { x : x Є S1 OR x Є S2 }------------ Union
S1 ∩ S2 = {x: x Є S1 AND x Є S2} ------------- Intersection
S1 – S2 = {x: x Є S1 and x is not Є S2} -------- Difference
S = {x: x Є U, x not Є S } ----------------------- Complementation
S1 U S2 = S1 ∩ S2
Demorgan Laws
S1 ∩ S2 = S1 U S2
Important Expressions
 A set S1 is said to be a subset of S2 if every element of S1 is also an element of S2.
S1 C S2
 If S1 C S but S contains an element not in S1 we say that S1 is a proper subset of S.
S1 C S.
 If S1 and S2 have no common element that is, S1 ∩ S2 = Ǿ then the sets are said to be disjoint
set.
 A set is said to be finite if it contains a finite number of elements: otherwise it is infinite.
 The size of a finite set is the number of elements in it. This is denoted by |S|.
 A given set normally has many subsets. The set of all subsets of a set is said the power set of
S and is denoted by 2S.
 Complete list E.g. S = {a, b, c} finite
 General format for non-complete listable
S = {x: p(x)} Infinite Countable
Uncountable
Z = {, , , , -2, -1, 0, 1, 2 , , , , } Countable Infinite
[0, 10] Uncountable Infinite
Let A and B be sets
Let f: A → B be a function, f is
Introduction to Formal Language and Automata Page 3
MicroLink Information Technology College

a) Said to be onto if Rf = B, i.e. for b Є B


Э aЄA Э f (a) = b
b) Said to be one-to-one if a1 ≠ a2 => f (a1) ≠ f (a2)
c) Said to be bijection if it onto and one-to-one.
Definition:
A set A is countable if A is either finite or there exits f: N → A is bijection
Example: Show that the set Z is countable
Solution:
f: N→Z by
(n – 1) / 2 , if n is Odd
f(n) = (n / 2) , if n is Even
f is bijection
Definition:
Let A be a set. The cardinality of A denoted by |A|, and called its cardinal number.
[For a finite set B, |B| = the number of elements in the set]
If ACB, then |A| < |B|
2A is the power set A. |A| < |2A|

Function and Relation


A function is a rule that assign to elements of one set a unique element of another set. If f denotes a
function then the first set is called the domain of f, and the second set is its range. We write
f: S1→ S2 ((x1, y1), (x2, y2) , , , , , , )
Total function: if the domain of f is all of S1
Partial function: if the domain of f is subset of S1.
Function: if xi occurs at most once
Relation: if xi occurs more than once
Let A1, A2, , , An be sets A relation R on sets Ai , i =1, 2, 3, 4, , , , n is given by
R C A1 x A2 x , , , , , x An
(Relation is a subset of Cartesian product of sets)
If n = 2, R is called binary
Let R be a binary relation on set A (R C A x A)
Let a, b Є A then (a, b) Є R
If (a, b) Є R, then a R b
If (a, b) Є R, then a R b
Introduction to Formal Language and Automata Page 4
MicroLink Information Technology College

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}

Let R be an equivalent relation on set A


For a, b Є A , a = b or a ∩ b ≠ ǿ
A = U a , for a Є A

Introduction to Formal Language and Automata Page 5


MicroLink Information Technology College

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

Introduction to Formal Language and Automata Page 6


MicroLink Information Technology College

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, w) Є E , then a path from v to w is a sequence v,v1, v2, , , , , , w


i.e. (v,v1), (v1,v2), , , , , , , , (vn, w)

v v2 v2 ..... Vn w

Examples:
...
a) V = { V1,V2, V3,V4 } ECVxV

V1 V2 (V2, V1 ) Є E through V2,V4,V1


(V4, V2 ) Є E through V4,V1,V2
(V1, V4 ) Є E through V1,V2,V4

V3 V4

b) Open Path

V1 V2

V5

V3 V4

Introduction to Formal Language and Automata Page 7


MicroLink Information Technology College

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

Let ni be a node of a tree. A path from ni to nk is ni, ni+1, , , , , , nk


(an arc from ni to ni+1 and ni is the parent of ni+1, i = 1, 2, , , , , ,)
(A path from r to node 3 is r, 2,3 )
Leaf node: a node without a child. Leaf nodes don’t have children.
Nodes 1, 3, 5, 6, 7 in the above tree are leaf nodes.
Depth: the longest path from the root to the leaf (ni)

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

Σ * = {λ, a, aa, aaa, , , , , , , , , , , } = {an > 0}


Recursive definition of Σ*
i) λ Є Σ *
ii) ax Є Σ* , a Є Σ , x Є Σ*
Σ0 - set of springs of zero length
Σ1 - set of strings of length one
Σ2 - set of strings of length two
Σi - set of strings of length i, i > 0
*
Σ - set of strings of length i > 0

Σ+ - set of strings of length i > 1

Let S1 and S2 be strings over Σ. then S1S2 is the concatenation of S1 and S2


Let S1 = a1a2, , , , , , ,an, ai Є Σ
S2 = b1b2, , , , , , ,bm, bi Є Σ
S1S2 = a1a2, , , , , , , anb1b2 , , , , , , , bm
S2S1 = b1b2 , , , , , , bma1a2 , , , , , , an
[Concatenation is not cumulative]
Let Σ = {0,1}
L1 = { λ } C Σ*
L2 = ǿ C Σ*
L3 = {0, 1} C Σ*
L4 = { λ, 01100, 000011} C Σ*
Such sets are called Language. In general a language L C Σ* over some Σ

Introduction to Formal Language and Automata Page 9


MicroLink Information Technology College

Let L1, L2 be two languages over some Σ.


The concatenation of L1L2 = { xy | x Є L1, and y Є L2}
L0 = {λ}
L2 = LL
L3 = LL2
L4 = LL3
Li = LLi -1
Example:
Let Σ = {a}
L0 = {λ}
L1 = {a} ,
L2 = LL1 = {a2}
L3 = LL2 = {a3}
L* = {λ, a, a2, a3, , , , , , , , }

Introduction to Formal Language and Automata Page 10

You might also like