










Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!











Automata and Complexity Theory
Theory of Automata
The theory of automata is a theoretical branch of computer science and mathematics. It is the study of abstract machines and the computation problems that can be solved using these machines. The abstract machine is called the automata. The main motivation behind developing the automata theory was to develop methods to describe and analyze the dynamic behavior of discrete systems.
This automaton consists of states and transitions. The State is represented by circles , and the Transition is represented by arrows. Automata is the kind of machine that takes some string as input and this input goes through a finite number of states and may enter the final state.
The basic terminologies used in Automata Theory:- Alphabets, Strings, Languages, and Grammar.
Symbols: Symbols are an entity or individual objects, which can be any letter, alphabet or any picture. E.g.: 1, a, b, #
Alphabets:
An alphabet finite set of non-empty symbols. It is denoted by ∑ (sigma).
Examples:
∑ = {a, b} is the binary alphabet ∑ = {A, B, C, D} is the set of uppercase letters ∑ = {(, )} is the set of open and closed brackets
String:
It is a finite collection of symbols from the alphabet. The string is denoted by w.
Example 1:
If ∑ = {a, b}, various string that can be generated from ∑ are {ab, aa, aaa, bb, bbb, ba, aba .... }.
o A string with zero occurrences of symbols is known as an empty string. It is represented by ε. o The number of symbols in a string w is called the length of a string. It is denoted by |w|.
Example 2:
w = 010; Number of Sting |w| = 3 abcbz is a string over? = {a, b, c, d… z} 11001011 is a string over? = {0, 1} )) ()(() is a string over? = {(,)}
Input tape: It is a linear tape having some number of cells. Each input symbol is placed in each cell.
Finite control: The finite control decides the next state on receiving particular input from input tape. The tape reader reads the cells one by one from left to right, and at a time only one input symbol is read.
Fig: - Finite automata model
There are two types of finite automata:
DFA refers to deterministic finite automata. Deterministic refers to the uniqueness of the computation. In the DFA, the machine goes to one state only for a particular input character. DFA does not accept the null move.
2. NFA
NFA stands for non-deterministic finite automata. It is used to transmit any number of states for a particular input. It can accept the null move.
Some important points about DFA and NFA:
o The language accepted by finite automata can be easily described by simple expressions called Regular Expressions. It is the most effective way to represent any language. o The languages accepted by some regular expression are referred to as Regular languages. o A regular expression can also be described as a sequence of pattern that defines a string. o Regular expressions are used to match character combinations in strings. String searching algorithm used this pattern to find the operations on a string.
For instance:
In a regular expression, x* means zero or more occurrence of x. It can generate {e, x, xx, xxx, xxxx, }
In a regular expression, x+^ means one or more occurrence of x. It can generate {x, xx, xxx, xxxx,
. ....}
Operations on Regular Language
The various operations on regular language are:
Union: If L and M are two regular languages then their union L U M is also a union.
Now we have got NFA without ε. Now we will convert it into required DFA for that, we will first write a transition table for this NFA.
The equivalent DFA will be:
State 0 1
→[q0] [q3] [q1, q2]
[q1] [qf] ϕ
[q2] ϕ [q3]
[q3] [q3] [qf]
[q1, q2] [qf] [qf]
*[qf] ϕ ϕ
A language is regular if it can be described by a regular expression.
The Regular Languages (LREG) is the set of all languages that can be represented by a regular expression, i.e. set of set of strings.
A language is said to be a Regular language if and only if some finite state machine recognizes it
So what Language are not Regular?
The language
which is not recognized by any FMS and which require memory Memory of FMS is very limited It can‘t store and count string
The languages accepted by all DFAs form the family of regular languages.
State 0 1
→q0 q3 {q1, q2}
q1 qf ϕ
q2 ϕ q
q3 q3 qf
*qf ϕ ϕ
The language defined by regular grammar is known as regular language. Regular expression is an important notation for specifying patterns. Each pattern matches a set of strings, so regular expressions serve as names for a set of strings. Programming language tokens can be described by regular languages.
Regular expressions have the capability to express finite languages by defining a pattern for finite strings of symbols. The grammar defined by regular expressions is known as regular grammar. The language defined by regular grammar is known as regular language.
There are two Pumping Lemmas, which are defined for 1. Regular Languages and 2. Context – Free Languages Pumping Lemma for Regular Languages For any regular language L, there exists an integer n, such that for all x ∈ L with |x| ≥ n, there exists u, v, w ∈ Σ*, such that x = uvw, and (1) |uv| ≤ n (2) |v| ≥ 1 (3) for all i ≥ 0: uviw ∈ L In simple terms, this means that if a string v is ‗pumped‘, i.e., if v is inserted any number of times, the resultant string still remains in L. Pumping Lemma is used as a proof for irregularity of a language. Thus, if a language is regular, it always satisfies pumping lemma. If there exists at least one string made from pumping which is not in L, then L is surely not regular. The opposite of this may not always be true. That is, if Pumping Lemma holds, it does not mean that the language is regular.
Context-free grammars (CFGs) are used to describe context-free languages. A context-free grammar is a set of recursive rules used to generate patterns of strings. A context-free grammar can describe all regular languages and more, but they cannot describe all possible languages.
Context-free grammars have a start symbol and set of terminals, non-terminals, and production rule components.
A context-free grammar can be described by a four-element tuple (V, Σ, R, S), where
V is a finite set of variables (which are non-terminal); Σ is a finite set (disjoint from V) of terminal symbols; R is a set of production rules where each production rule maps a variable to a string s∈(V∪Σ)∗; S (which is in V ) which is a start symbol.
Context-free grammars can be modelled as parse trees. The nodes of the tree represent the symbols and the edges represent the use of production rules. The leaves of the tree are the end result (terminal symbols) that make up the string the grammar is generating with that particular sequence of symbols and production rules. Grammar can be implemented with multiple parse trees to get the same resulting string, this is said to be ambiguous.
A non-deterministic pushdown automaton (NPDA), or just pushdown automaton (PDA) is a variation on the idea of a non-deterministic finite automaton (NDFA). Unlike an NDFA, a PDA is associated with a stack (hence the name pushdown). The transition function must also take into account the ―state‖ of the stack.
Fig: The traditional Chomsky hierarchy
TURING MACHINE
STANDARD TURING MACHINE
Turing machines, first described by Alan Turing, are simple abstract computational devices intended to help investigate the extent and limitations of what can be computed.
Turing machine model
A Turing machine M is a 7 - tuple , namely (Q, ∑, ┌, δ, qO, b, F) , where
1. Q is a finite nonempty set of states; 2. ∑ is a nonempty set of input symbols and is subset of ┌ and b∉∑; 3. ┌ is a finite nonempty set of tape symbols; 4. b ∉ ┌ is the blank symbol; 5. δ is the transition function , mapping ( q , x ) onto ( q' , y , D ) where D denotes the direction of movement of R/W head : D = L or R according as the movement is to the left or right. 6. qo ∈ Q is the initial state , and 7. F ⊆ Q is the set of final states. NB - The acceptability of a string is decided by the reachability from the initial state to some final state, and such states are called the accepting states.
Thus the ID is as given in the figure below.
NB. - For constructing the ID , we simply insert the current state in the input string to the left of the symbol under the R/W head.
Transition table
We give the definition of transition function δ in the form of a table called the transition table.
● We describe the computation sequence in terms of the contents of the tape and the current state. Transition diagram (transition graph). We can use the transition systems (diagrams) to represent Turing machines.
There are three possible outcomes of executing a Turing machine over a given input. (1) Halt and accept the input (2) Halt and reject the input (3) Never halt
Undecidable problem Decidable problem
A Turing machine that accepts the language (input): If machine halts in a final state.
Big - O notation : is the most commonly used notation for specifying asymptotic complexity, that is, for estimating the rate of growth of complexity functions.
Logarithmic time : log n
An example of logarithmic effort is the binary search for a specific element in a sorted array of size n.
Linear time O (n):
Quasilinear Time O(n log n) :
Quadratic Time O(n²) :
Exponential time O(2 n ) :
Big O Notation Order
Here are, once again, the described complexity classes, sorted in ascending order of complexity (for sufficiently large values of n ):
Polynomial Non Polynomial P problems are set of problems which can be solved in polynomial time by deterministic algorithms.
NP problems are the problems which can be solved in non-deterministic polynomial time. The problem belongs to class P if it‘s easy to find a solution for the problem.
The problem belongs to NP, if it‘s easy to check a solution that may have been very tedious to find. P Problems can be solved and verified in polynomial time. P problems are subset of NP problems.
Solution to NP problems cannot be obtained in polynomial time. but
P problems are subset of NP problems. NP problems are superset of P problems.