Sei sulla pagina 1di 5

Muhammad Raheel/Handout 2 1 Theory of Automata

Lesson 2

Objectives

 Some Basic Definitions of Automata Theory


 Introduction to Language
 Description of some Formal Languages

Automata :
It is the plural of automaton, and it means “something that works automatically”

Alphabet
A finite non-empty set of symbols (called 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}
String
Concatenation of finite number of letters from the alphabet is called a string.
Example
If Σ = {a, b} then {a, abab, aaabb, ababababababababab} are strings
Empty String or Null String
A string with no symbol from alphabet is called Null String. It is denoted by (Small Greek letter
Lambda) λ or (Capital Greek letter Lambda) Λ.
Words
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 String
The length of a string s, denoted by |s|, is the number of letters in the string.
Example
Σ = {a, b}
s = ababa
|s| = 5
Muhammad Raheel/Handout 2 2 Theory of Automata

Example
Σ = {B, aB, bab, d}
s = BaBbabBd
Tokenizing = (B), (aB), (bab), (B), (d)
|s| = 5
Reverse of a String
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
Example
Σ = {B, aB, bab, d}
s = BaBbabBd
Rev(s) = dBbabaBB

Introduction to languages
There are two types of languages
Formal Languages (Syntactic languages)
Informal Languages (Semantic 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.

Example 1
The language L of strings of odd length, defined over Σ = {a}, can be written as
L = {a, aaa, aaaaa,…..}
Example 2
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, …}
Example 3
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 4
The language L of strings ending in 0, defined over Σ = {0, 1}, can be written as
L = {0, 00, 10, 000, 010, 100, 110,…}
Example 5
Muhammad Raheel/Handout 2 3 Theory of Automata

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 6
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
L = { Λ , aa, bb, aaaa, aabb, abab, abba, baab, baba, bbaa, bbbb,…}
Example 7
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 8
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,…}

Example 9
The language {anbn }, of strings defined over Σ = {a, b}, as
{anbn : n=1,2,3,…}, can be written as
{ab, aabb, aaabbb, aaaabbbb,…}

Example 10
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,…}
Example 11
The language factorial, of strings defined over Σ = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} i.e.
{1, 2, 6, 24, 120,…}

Example 12
The language FACTORIAL, of strings defined over Σ = {a}, as
{an! : n=1,2,3,…}, can be written as
{a, aa, aaaaaa,…}. It is to be noted that the language FACTORIAL can be defined over any
single letter alphabet.
Example 13
The language DOUBLEFACTORIAL, of strings defined over Σ = {a, b}, as
{an!bn! : n=1,2,3,…}, can be written as
{ab, aabb, aaaaaabbbbbb,…}
Example 14
The language SQUARE, of strings defined over Σ = {a}, as
{an2 : n = 1, 2, 3,…}, can be written as
{a, aaaa, aaaaaaaaa,…}
Example 15
Muhammad Raheel/Handout 2 4 Theory of Automata

The language DOUBLESQUARE, of strings defined over Σ = {a, b}, as


{an2 bn2 : n = 1, 2, 3,…}, can be written as
{ab, aaaabbbb, aaaaaaaaabbbbbbbbb,…}
Example 16
The language PRIME, of strings defined over Σ = {a}, as
{ap : p is prime}, can be written as
{aa, aaa, aaaaa, aaaaaaa, aaaaaaaaaaa…}

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

[11:57 PM, 9/27/2018] mani: What is DFA TOC?

In theory of computation, a branch of theoretical computer science, a deterministic finite


automaton (DFA)—also known as deterministic finite accepter (DFA) and deterministic finite
Muhammad Raheel/Handout 2 5 Theory of Automata

state machine—is a finite state machine that accepts/rejects finite strings of symbols and only
produces a unique computation (or run) of ...

[11:57 PM, 9/27/2018] mani: Pushdown Automata is a finite automata with extra memory called
stack which helps Pushdown automata to recognize Context Free Languages. A Pushdown
Automata (PDA) can be defined as : ... In a given state, PDA will read input symbol and stack
symbol (top of the stack) and move to a new state and change the symbol of stack.

[11:58 PM, 9/27/2018] mani: Regular Expressions. Just as finite automata are used to recognize
patterns of strings, regular expressions are used to generate patterns of strings. A regular
expression is an algebraic formula whose value is a pattern consisting of a set of strings, called
the language of the expression.

[11:58 PM, 9/27/2018] mani: In the theory of computation, a branch of theoretical computer
science, a deterministic finite automaton (DFA)—also known as deterministic finite acceptor
(DFA), deterministic finite state machine (DFSM), or deterministic finite state automaton
(DFSA)—is a finite-state machine that accepts or rejects strings of symbols ...

[11:59 PM, 9/27/2018] mani: What is finite automata with example?

Definition of Finite Automata. A finite automaton (FA) is a simple idealized machine used to
recognize patterns within input taken from some character set (or alphabet) C. The job of an FA
is to accept or reject an input depending on whether the pattern defined by the FA occurs in the
input.

[11:59 PM, 9/27/2018] mani: An NFA is a Nondeterministic Finite Automaton.


Nondeterministic means it can transition to, and be in, multiple states at once (i.e. for some given
input). A DFA is a Deterministic Finite Automaton. Deterministic means that it can only be in,
and transition to, one state at a time (i.e. for some given input).

[12:00 AM, 9/28/2018] mani: In particular, every DFA is also an NFA. ... Using the subset
construction algorithm, each NFA can be translated to an equivalent DFA, i.e. a DFA
recognizing the same formal language. Like DFAs, NFAs only recognize regular languages.

[12:02 AM, 9/28/2018] mani: Transition graphs. Transition graph can be interpreted as a
flowchart for an algorithm recognizing a language. A transition graph consists of three things: A
finite set of states, at least one of which is designated the start state and some of which are
designated as final states

[12:03 AM, 9/28/2018] mani: A finite-state machine or finite-state automaton, finite automaton,
or simply a state machine, is a mathematical model of computation. It is an abstract machine that
can be in exactly one of a finite number of states at any given time.

Potrebbero piacerti anche