CTCD Unit 2
CTCD Unit 2
We have already discussed finite automata. But finite automata can be used to accept only regular
languages.
Pushdown Automata is a finite automata with extra memory called stack which helps Pushdown
automata to recognize Context Free Languages.
• Γ is the set of pushdown symbols (which can be pushed and popped from stack)
• δ is a transition function which maps Q x {Σ ∪ ∈} x Γ into Q x Γ*. 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.
Instantaneous Description (ID)
Instantaneous Description (ID) is an informal notation of how a PDA “computes” a input string and make
a decision that string is accepted or rejected.
Turnstile notation
⊢ sign is called a “turnstile notation” and represents
one move.
⊢* sign represents a sequence of moves.
Eg- (p, b, T) ⊢ (q, w, α)
This implies that while taking a transition from state p to state q, the input symbol ‘b’ is consumed, and
the top of the stack ‘T’ is replaced by a new string ‘α’
δ( q0, a, Z ) = { ( q0, AZ ) }
δ( q0, a, A) = { ( q0, AA ) }
δ( q0, b, A) = { ( q1, ∈) }
δ( q1, b, A) = { ( q1, ∈) }
δ( q1, ∈, Z) = { ( q1, ∈) }
Explanation : Initially, the state of automata is q0 and symbol on stack is Z and the input is aaabbb as
shown in row 1. On reading ‘a’ (shown in bold in row 2), the state will remain q0 and it will push symbol
A on stack. On next ‘a’ (shown in row 3), it will push another symbol A on stack. After reading 3 a’s, the
stack will be AAAZ with A on the top. After reading ‘b’ (as shown in row 5), it will pop A and move to
state q1 and stack will be AAZ. When all b’s are read, the state will be q1 and stack will be Z. In row 8,
on input symbol ‘∈’ and Z on stack, it will pop Z and stack will be empty. This type of acceptance is
known as acceptance by empty stack.
Turing Machine was invented by Alan Turing in 1936 and it is used to accept Recursive Enumerable
Languages (generated by Type-0 Grammar).
Turing machines are a fundamental concept in the theory of computation and play an important role in
the field of computer science. They were first described by the mathematician and computer scientist
Alan Turing in 1936 and provide a mathematical model of a simple abstract computer.
In the context of automata theory and the theory of computation, Turing machines are used to study
the properties of algorithms and to determine what problems can and cannot be solved by computers.
They provide a way to model the behavior of algorithms and to analyze their computational complexity,
which is the amount of time and memory they require to solve a problem.
A Turing machine is a finite automaton that can read, write, and erase symbols on an infinitely long
tape. The tape is divided into squares, and each square contains a symbol. The Turing machine can only
read one symbol at a time, and it uses a set of rules (the transition function) to determine its next action
based on the current state and the symbol it is reading.
The Turing machine’s behavior is determined by a finite state machine, which consists of a finite set of
states, a transition function that defines the actions to be taken based on the current state and the
symbol being read, and a set of start and accept states. The Turing machine begins in the start state and
performs the actions specified by the transition function until it reaches an accept or reject state. If it
reaches an accept state, the computation is considered successful; if it reaches a reject state, the
computation is considered unsuccessful.
Turing machines are an important tool for studying the limits of computation and for understanding
the foundations of computer science. They provide a simple yet powerful model of computation that
has been widely used in research and has had a profound impact on our understanding of algorithms
and computation.
A turing machine consists of a tape of infinite length on which read and writes operation can be
performed. The tape consists of infinite cells on which each cell either contains input symbol or a special
symbol called blank. It also consists of a head pointer which points to cell currently being read and it
can move in both directions.
A TM is expressed as a 7-tuple (Q, T, B, ?, ?, q0, F) where:
• B is blank symbol (every cell is filled with B except input alphabet initially)
• ? is a transition function which maps Q × T ? Q × T × {L,R}. Depending on its present state and
present tape alphabet (pointed by head pointer), it will move to new state, change the tape
symbol (may or may not) and move head pointer to either left or right.
• F is the set of final states. If any state of F is reached, input string is accepted.