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

Lecture 1

The document provides an introduction and overview of a course on formal languages and finite automata, including topics such as automata, grammars, Chomsky's hierarchy, regular expressions, and the relations between different models of computation. The course aims to cover important concepts, definitions, results, proofs, and techniques in the theory of computation. Recommended books and learning outcomes are also listed.

Uploaded by

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

Lecture 1

The document provides an introduction and overview of a course on formal languages and finite automata, including topics such as automata, grammars, Chomsky's hierarchy, regular expressions, and the relations between different models of computation. The course aims to cover important concepts, definitions, results, proofs, and techniques in the theory of computation. Recommended books and learning outcomes are also listed.

Uploaded by

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

Lecture 01

Introduction to Formal Languages


& Finite Automata
Ref: The material is taken from the text book: Introduction to Automata Theory,
Languages and Computation by John Hopcropt and Jeffery Ullman, 3 rd ed.
Web Link :http://infolab.stanford.edu/~ullman/ialc/
Course Information

• The course deals with the concept


of computability and mathematical
models, such as finite automata,
grammars and Turing machines,
and the relations between these
models.
Course Information
• The following topics are treated:

• Automata: finite automata, stack automata and


Turing machines. Determinism and non-determinism.
Regular expressions, transformation from regular
expressions to finite automata and conversely,
minimization of deterministic finite automata,
Automata associated with output (Moore & Mealy
Machines ), Pushdown Automata (PDA).
Course Information

• Formal languages: grammars, Chomsky’s


hierarchy, in particular context-free grammars
and regular grammars, closure properties.
The relation between grammars and variants
of automata. The pumping lemmas for regular
and context-free languages, respectively. The
universal machine, the halting problem and
other undecidable problems, Rice’s theorem.
Learning Outcomes
• On successful completion of this course you will be able to:
• Give an account of important concepts and definitions for
automata and formal languages;
• Exemplify and interpret important concepts in specific cases;
• Formulate important results and theorems covered by the
course;
• Describe the main features of the proofs of important theorems;
• Express problems from relevant areas of applications in a
mathematical form suitable for further analysis;
• Use the theory, methods and techniques of the course to solve
mathematical problems;
Recommended Books

• Automata Theory, Languages and


Computation, 3rded., John Hopcroft & Jeffery
Ullman, ISBN: 978-0321455369

• An Introduction to Formal Languages &


Automata, 6th ed., Peter Linz, ISBN: 978-
1284077247
UNIT # 1.1
What does Automata mean?

• The term "Automata" is derived from the


Greek word "αὐτόματα" which means
"self-acting".
• It is the plural of automaton, and it means
“something that works automatically”
What is automata theory

• Automata theory is the study of abstract


computational devices, or machines
• Abstract devices are (simplified) models of
real computations
• Computations happen everywhere: On your
laptop, on your cell phone, in nature, …
• A fundamental question in computer science:
– Find out what different models of machines can do and
cannot do
– The theory of computation
Examples
• Vending Machine
• Words Generation in language
• Circuit Board in Electronics
• Games
• Probability
• Traffic Signals
• Speech Recognition
• Regular Expression in Security & Validation
• Real life problems, etc…
What is automata theory

• Finite automata are finite collections of


states with transition rules that take you
from one state to another.
• Original application was sequential
switching circuits, where the “state” was
the settings of internal bits.
• Today, several kinds of software can be
modeled by FA.
Representing FA

• Simplest representation is often


a graph.
– Nodes = states.
– Arcs indicate state transitions.
– Labels on arcs tell what causes
the transition.
Alan Turing (1912-1954)
A Pioneer of Automata Theory

• Father of Modern Computer


Science
• English mathematician
• Studied abstract machines
called Turing machines even
before computers existed
• Heard of the Turing test?
Turing Machine by Alan Turing
• A Turing machine is a kind of state machine. At any
time the machine is in any one of a finite number of
states. Instructions for a Turing machine consist in
specified conditions under which the machine will
transition between one state and another.
• A Turing machine is a system of rules, states and
transitions rather than a real machine. ... There are
two purposes of a Turing machine. Either it can be
used to decide a formal language or it solves
mathematical functions.
Theory of Computation: A
Historical Perspective
1930s • Alan Turing studies Turing machines
• Decidability
• Halting problem
1940-1950s • “Finite automata” machines studied
• Noam Chomsky proposes the
“Chomsky Hierarchy” for formal
languages
1969 Cook introduces “intractable” problems
or “NP-Hard” problems
1970- Modern computer science: compilers,
computational & complexity theory evolve
Chomsky Hierarchy
In Mathematics

• An automaton is an abstract machine, i.e. a


mathematical model.
• In particular, a finite-state machine or finite
state automaton, is a mathematical model of
computer hardware and software, mostly
used for compilers (cf. programming
languages) and natural language processing
(NLP) and computational linguistics.
Real Examples of FA
• Software for designing and checking the behavior of digital circuits.
• The lexical analyzer of a typical compiler that is the compiler
component that breaks the input text into logical units such as
identifiers
keywords and punctuation.
• Software for scanning large bodies of text such as collections of Web
pages to find occurrences of words phrases or other patterns.
• Software for verifying systems of all types that have finite number of
distinct states such as communications protocols or protocols for
secure exchange of information
UNIT # 1.2
Sets
Graphs
A Simple Computer

BATTERY

input: switch
output: light bulb
actions: flip switch
states: on, off
A Simple Computer

f
BATTERY
start off on
f

input: switch
bulb is on if and only if
output: light bulb
there was an odd number of
actions: f for “flip switch” flips
states: on, off
Another “computer”
1
1 start off off
1

BATTERY 2 2 2 2
1
2
off on
1
inputs: switches 1 and 2
bulb is on if and only if
actions: 1 for “flip switch 1”
both switches were flipped
actions: 2 for “flip switch 2”
an odd number of times
states: on, off
Example 02

• Modeling recognition of the word “then”

Start state Transition Intermediate Final state


state
UNIT # 1.3
Introduction to languages

• There are two types of languages

– Formal Languages (Syntactic languages)


– Informal Languages (Semantic languages)
Alphabets
• Definition:
A finite non-empty set of symbols (letters), is
called an alphabet. It is denoted by Σ ( Greek
letter sigma).
• Example:
Σ={a,b}
Σ={0,1} //important as this is the language
//which the computer understands.
Σ={i,j,k}
Strings
• Definition:
Concatenation of finite symbols from the
alphabet is called a string.
• Example:
If Σ= {a,b} then
a, abab, aaabb, ababababababababab
NOTE:
EMPTY STRING or NULL STRING
• Sometimes a string with no symbol at all is
used, denoted by (Small Greek letter Lambda)
λ or (Capital Greek letter Lambda) Λ, is called
an empty string or null string.
The capital lambda will mostly be used to
denote the empty string, in further discussion.
Words
• Definition:
Words are strings belonging to some
language.
Example:
If Σ= {x} then a language L can be
defined as
L={xn : n=1,2,3,…..} or L={x,xx,xxx,….}
Here x,xx,… are the words of L
NOTE

• All words are strings, but not all strings


are words.
Length of Strings

• Definition:
The length of string s, denoted by |s|, is
the number of letters in the string.
• Example:
Σ={a,b}
s=ababa
|s|=5
Length of Strings

• Example:
Σ= {B, aB, bab, d}
s=BaBbabBd
Tokenizing=(B), (aB), (bab), (B), (d)
|s|=5
Reverse of a String

• Definition:
The reverse of a string s denoted by
Rev(s) or sr, is obtained by writing the
letters of s in reverse order.
• Example:
If s=abc is a string defined over Σ={a,b,c}
then Rev(s) or sr = cba
Reverse of a String

• Example:
Σ= {B, aB, bab, d}
s=BaBbabBd
Rev(s)=dBbabaBB
Kleene Star Closure

• Given Σ, then the Kleene Star Closure of


the alphabet Σ, denoted by Σ*, is the
collection of all strings defined over Σ,
including Λ.
• It is to be noted that Kleene Star Closure
can be defined over any set of strings.
Example – Kleene Star
Closure
• If Σ = {x}
Then Σ* = {Λ, x, xx, xxx, xxxx, ….}
• If Σ = {0,1}
Then Σ* = {Λ, 0, 1, 00, 01, 10, 11, ….}
• If Σ = {aaB, c}
Then Σ* = {Λ, aaB, c, aaBaaB, aaBc,
caaB, cc, ….}
Kleene Star Closure

• Languages generated by Kleene Star


Closure of set of strings, are infinite
languages. (By infinite language, it is
supposed that the language contains
infinite many words, each of finite
length).
PLUS Operation (+)
• Plus Operation is same as Kleene Star Closure
except that it does not generate Λ (null string),
automatically.
Example:
• If Σ = {0,1}
Then Σ+ = {0, 1, 00, 01, 10, 11, ….}
• If Σ = {aab, c}
Then Σ+ = {aab, c, aabaab, aabc, caab, cc, ….}
Task

Q1)Is there any case when S+ contains Λ?


If yes then justify your answer.

Q2) Prove that for any set of strings S

i. (S+)*=(S*)*
ii. (S+)+=S+
iii. (S*)+=(S+)*
UNIT # 1.4
Defining Languages
Defining Languages

• The languages can be defined in different


ways , such as Descriptive definition,
Recursive definition, using Regular
Expressions(RE) and using Finite
Automaton(FA) etc.

Descriptive definition of language:


The language is defined, describing the
conditions imposed on its words.
Defining Languages
• Example:
The language L of strings of odd length,
defined over Σ={a}, can be written as
L={a, aaa, aaaaa,…..}
• Example:
The language L of strings that does not
start with a, defined over Σ={a,b,c}, can
be written as
L={b, c, ba, bb, bc, ca, cb, cc, …}
Defining Languages

• Example:
The language L of strings of length 2,
defined over Σ={0,1,2}, can be written as
L={00, 01, 02,10, 11,12,20,21,22}
• Example:
The language L of strings ending in 0,
defined over Σ ={0,1}, can be written as
L={0,00,10,000,010,100,110,…}
Defining Languages
• Example: The language EQUAL, of strings with
number of a’s equal to number of b’s, defined
over Σ={a,b}, can be written as
{Λ ,ab,aabb,abab,baba,abba,…}

• Example: The language EVEN-EVEN, of strings


with even number of a’s and even number of b’s,
defined over Σ={a,b}, can be written as
{Λ, aa, bb, aaaa,aabb,abab, abba, baab, baba,
bbaa, bbbb,…}
Defining Languages

• Example: The language INTEGER, of


strings defined over
Σ={-,0,1,2,3,4,5,6,7,8,9}, can be written as
INTEGER = {…,-2,-1,0,1,2,…}
• Example: The language EVEN, of stings
defined over Σ={-,0,1,2,3,4,5,6,7,8,9}, can
be written as
EVEN = { …,-4,-2,0,2,4,…}
Defining Languages
• Example: The language {anbn }, of strings
defined over Σ={a,b}, as
{an bn : n=1,2,3,…}, can be written as
{ab, aabb, aaabbb,aaaabbbb,…}

• Example: The language {anbnan }, of strings


defined over Σ={a,b}, as
{an bn an: n=1,2,3,…}, can be written as
{aba, aabbaa, aaabbbaaa,aaaabbbbaaaa,…}
Defining Languages

• Example: The language SQUARE, of strings


defined over Σ={a}, as
{an : n=1,2,3,…}, can be written as
2

{a, aaaa, aaaaaaaaa,…}


• Example: The language DOUBLESQUARE,
of strings defined over Σ={a,b}, as
{an bn : n=1,2,3,…}, can be written as
2 2

{ab, aaaabbbb, aaaaaaaaabbbbbbbbb,…}


Defining Languages

• Example: The language PRIME, of


strings defined over Σ={a}, as
{ap : p is prime}, can be written as

{aa,aaa,aaaaa,aaaaaaa,aaaaaaaaaaa
…}
An Important language

• PALINDROME:
The language consisting of Λ and the
strings s defined over Σ such that
Rev(s)=s.
It is to be denoted that the words of
PALINDROME are called palindromes.
• Example:For Σ={a,b},
PALINDROME={Λ , a, b, aa, bb, aaa, aba,
bab, bbb, ...}
UNIT # 1.5
Deterministic Finite Automata

• A formalism for defining languages,


consisting of:
1. A finite set of states (Q, typically).
2. An input alphabet (Σ, typically).
3. A transition function (δ, typically).
4. A start state (q0, in Q, typically).
5. A set of final states (F ⊆ Q, typically).
 “Final” and “accepting” are synonyms.
Review Exercises

Define the terms:


a) Finite Automata
b) Language
c) Regular Languages
d) Strings vs words

Find the accepted and rejected strings of given languages:


a) The set of all strings containing no three consecutive 0’s.
b) The set of all strings over {0,1} having even number of 0’s &
odd number of 1’s.
THANK YOU

You might also like