Sie sind auf Seite 1von 36

Unit 5 : STATE MACHINES

Syllabus:
Languages and Grammars Finite State
Machines State machines and languages
Turing
Machines Computational Complexity
computability Decidability Church's Thesis
1

Languages and
Grammars
Language
A language L over an alphabet is a subset
of * ,L * . A language may
be empty.
Here you should note a point L = { },a
language containing an empty string is not an
empty language.
2

Languages and
Grammar
Grammars

A grammar is a 4-tuple (V, , P, S), where:


is an alphabet (characters are called
terminals)
V is a set (elements in V are called
variables)
P is a set of Production rules
S, the start variable, is one of the variables
in V
3

IFETCE/ME/CSE/ B.V.Ramaraju/I YEAR/II sem/CP7201/TFCS/Unit5/PPt/VER1.0

type 3
(regular langs)
CFLs (type 2 langs)
CSLs (type 1 Langs)
Recursive Languages
Recursively Enumerable(type 0) languages
All Languages

Finite State
Finite
Automaton
Machines
Input

String
Output
Finite
Automaton

String

State machines and


Deterministic
languagesFinite Accepter (DFA)
M Q, , , q0 , F

Q : set of states
: input alphabet
: transition function
q0 : initial state
F : set of final states
9

Non-Deterministic Finite Accepter (NFA)

M Q, , , q0 , F
Q : set of states
: input alphabet
: transition function
q0 : initial state
F : set of final states

For any string x, there may exist none or more than


one path from initial state and associated with x.
10

11

12

13

14

15

16

17

18

Turing
1. Finite automata (DFAs, NFAs, etc.):
Machines
1. limited input
tape: one-way, read-only
2. no working-memory
3. finite-control store (program)
2. PDAs:
1. limited input tape: one-way, read-only
2. one additional stack as working memory
3. finite-control store (program)
3. Turing machines (TMs):
1. a semi-infinite tape storing input and supplying
additional working storage.
2. finite control store (program)
3. can read/write and two-way(move left and right) depending
on the program state and input symbol scanned.
19

The model of a Turing machine

left-end
input: x
x1 x2 x3 x4 x5 ..

memory is a one-dimensional tape


additional working memory
.

xn

no right-end for TM

r/w & movable tape head

initial state

.
.

permitted actions:
1. write
2. move left/right
depending on scanned symbol
and current state

current
state
control store (program)

accept final state


reject final state

20

An instruction of a TM is a tuple:
(q, a, p,
d) Q x G x Q x (G U {L,R})
where
1. q is the current state
2. a is the symbol scanned by the tape head
3. (q,a) define a precondition that the machine may encounter
4. (p,d) specify the actions to be done by the TM once the machine is in a condition
matching the precondition (i.e., the symbol scanned by the tape head is a and
the machine is at state q )
5. p is the next state that the TM will enter
6. d is the action to be performed:
1. d = b G means write the symbol b to the tape cell currently scanned by
the tape head.
2. d = R (or L) means move the tape head one tape cell in the right (or left,
respectively) direction.
A Deterministic TM program d is simply a set of TM instructions (or more formally a
function: d: Q x G --> Qx (G U{L,R}))
21

Formal Definition of a standard TM (STM)


A deterministic 1-tape Turing machine (STM) is a 9-tuple
M = (Q,S,G, [, , d, s, t,r ) where
1. Q : is a finite set of (program) states with a role like labels
in traditional programs
2. G
: tape alphabet
3. S G : input alphabet
4. [ G - S : The left end-of-tape mark
5. G - S is the blank tape symbol
6. s Q : initial state
7. t Q : the accept state
8. r t Q: the reject state and
9. d: Q - {t,r} --> Qx(G U {L,R}) is a total transition function
with the restriction: if d(p, [ ) =(q, d) then d = R.
i.e., the STM cannot write any symbol at left-end and never move off the tape to
the left.
22

IFETCE/ME/CSE/ B.V.Ramaraju/I YEAR/II sem/CP7201/TFCS/Unit5/PPt/VER1.0

Languages accepted by a STM

1. M is said to halt on input x if either M accepts x or rejects x.


2. M is said to loop on x if it does not halt on x.
3. A TM is said to be total if it halts on all inputs.
4. The language accepted by a TM M,
L(M) =def {x in S* | x is accepted by M, i.e., (s, [xw ,0) |--*M (t, -,-)
}
5. If L = L(M) for some STM M
==> L is said to be recursively enumerable (r.e.)
6. If L = L(M) for some total STM M
==> L is said to be recursive
7. If ~ L=def S* - L = L(M) for some STM M (or total STM M)
==> L is said to be Co-r.e. (or Co-recursive, respectively)
IFETCE/ME/CSE/ B.V.Ramaraju/I YEAR/II sem/CP7201/TFCS/Unit5/PPt/VER1.0

23

Relationship of Languages, Grammars and


Language
recognition model
generation model
machines
Regular languages
(type 3) languages

Finite automata
(DFA, NFA)

regular expressions
linear grammars

CFL ( type 2, Context


Free ) languages

Pushdown automata

CFG ; type 2 ( context


free) grammars

CSL (type 1, Context


sensitive) Languages

LBA (Linear Bound


Automata)

CSG (Context sensitive,


type 1 Grammars)

Recursive Languages

Total Turing machines

R.E. (Recursively
enumerative, type 0)
Languages

Turing machines

GPSG(type 0, general
phrase-structure,
unrestricted) grammar
24

Computational
Complexity

25

26

27

Decidabilit
y

28

29

30

31

32

Church's
Any mechanical computation
performedThesis
by a Turing Machine

can

be

There is a TM-n corresponding to every


computable problem
We can model any mechanical computer
with a TM
The set of languages that can be decided
by a TM is identical to the set of languages
that can be decided by any mechanical
computing machine
If there is no TM that decides problem P,33
there is no algorithm that solves problem P.

Examples
[Last class and PS4] Equivalence of TM and
2-stack deterministic PDA + -transitions
[PS4] Making the tape infinite in both
directions adds no power
[Soon] Adding a second tape adds no power
[Church] Lambda Calculus is equivalent to
TM
[Chomsky]
Unrestricted
replacement
grammars are equivalent to TM
[Takahara and Yokomori] DNA is at least as
powerful as a TM
[Hotly Debated] Is the human brain 34
equivalent to a TM?

Since a precise mathematical


definition of the term effectively
calculable (effectively decidable) has
been wanting, we can take this
thesis ... as a definition of it...

As stated by Kleene:
Every effectively calculable function
(effectively decidable predicate) is
general recursive.
35

Alan Turing (1912-1954)


Published On Computable
Numbers,
with
an
Application
to
the
Entscheidungsproblem
(1936)
Introduced the Halting Problem
Formal model of computation
(now known as Turing Machine)

Codebreaker at Bletchley Park

Involved in breaking Enigma Cipher

After the war: convicted of


homosexuality (then a crime in
Britain),
committed
suicide
eating cyanide apple

36

Das könnte Ihnen auch gefallen