finite state machine and chomsky hierarchy

21
SUBJECT 1. FINITE STATE MACHINE AND 2. CHOMSKY HIERARCHY BBA(E-COMMERCE)

Upload: nishimanglani

Post on 18-Jul-2015

200 views

Category:

Engineering


4 download

TRANSCRIPT

Page 1: FINITE STATE MACHINE AND CHOMSKY HIERARCHY

SUBJECT – 1. FINITE STATE MACHINE AND 2. CHOMSKY HIERARCHY

BBA(E-COMMERCE)

Page 2: FINITE STATE MACHINE AND CHOMSKY HIERARCHY

FINITE STATE MACHINE

Page 3: FINITE STATE MACHINE AND CHOMSKY HIERARCHY

MACHINE A device that receive a set of input signals

and produce a set of output signals is

called information processing device.

Input signals

Input processing machine

Output signals

Page 4: FINITE STATE MACHINE AND CHOMSKY HIERARCHY

Examples of machines

A Table lamp is an information processing machine with the i/p signals being either up or down position of switch and o/p signals being either on or off.

An Adder is an information processing machine with the input signals being to decimal number and output signal being their sum.

An automobile is an information processing machine with depression of accelerator and angular position of steering wheel is an input signal and output signals are speed and direction.

Digital computer take input and displays output.

Page 5: FINITE STATE MACHINE AND CHOMSKY HIERARCHY

STATE MACHINE

a state machine is any device that stores the status of something at a given time and can operate on input to change the status and/or cause an action or output to take place for any given change. A computer is basically a state machine and each machine instruction is input that changes one or more states and may cause other actions to take place. Each computer's data register stores a state. The read-only memory from which a boot program is loaded stores a state (the boot program itself is an initial state). The operating system is itself a state and each application that runs begins with some initial state that may change as it begins to handle input. Thus, at any moment in time, a computer system can be seen as a very complex set of states and each program in it as a state machine. In practice, however, state machines are used to develop and describe specific device or program interactions.

Page 6: FINITE STATE MACHINE AND CHOMSKY HIERARCHY

a state machine can be

described as: An initial state or record of something

stored someplace .

A set of possible input events .

A set of new states that may result

from the input .

A set of possible actions or output

events that result from a new state .

Page 7: FINITE STATE MACHINE AND CHOMSKY HIERARCHY

FINITE STATE MACHINE

A finite state machine is one that has a limited or finite number of possible states. (An infinite state machine can be conceived but is not practical.) A finite state machine can be used both as a development tool for approaching and solving problems and as a formal way of describing the solution for later developers and system maintainers. There are a number of ways to show state machines, from simple tables through graphically animated illustrations.

Page 8: FINITE STATE MACHINE AND CHOMSKY HIERARCHY

Finite state machine is specified by six tuples(S,I,O,F,G,So)

Where,S=finite sets of states (S0,S1,S2,S3….) whose

elements are called state of machine.So= So is special element of S referred to as

the initial state of machine.I=(I1,I2,….) is finite set of input letters.O=(O1,O2,….) is finite set of output letters.F= is a function from S*I to S called the

transition function.G=is a function from S to O called the output

function.

Page 9: FINITE STATE MACHINE AND CHOMSKY HIERARCHY

At any instant a finite state machine is one

of its state. On receiving an input symbol

the machine will go to the another state

according to the transition function at each

state machine produces an output function.

At every beginning the machine is in initial

state as 0.

Page 10: FINITE STATE MACHINE AND CHOMSKY HIERARCHY

CHOMSKY HIERARCHY

Page 11: FINITE STATE MACHINE AND CHOMSKY HIERARCHY

Introduction the Chomsky hierarchy (occasionally

referred to as Chomsky-Schützenbergerhierarchy) is a containment hierarchy of classes of formal grammars. This hierarchy of grammars was described by Noam Chomsky in 1956. It is also named after Marcel-Paul Schützenberger, who played a crucial role in the development of the theory of formal languages. The Chomsky Hierarchy, in essence, allows the possibility for the understanding and use of a computer science model which enables a programmer to accomplish meaningful linguistic goals systematically.

Page 12: FINITE STATE MACHINE AND CHOMSKY HIERARCHY

Chomsky hierarchy

• Grammars are classified by the form

of their productions.

• Each category represents a class of

languages

that can be recognized by a different

automaton.

• The classes are nested, with type 0

being

the largest and most general, and

type 3 being the smallest and most

restricted.

Page 13: FINITE STATE MACHINE AND CHOMSKY HIERARCHY
Page 14: FINITE STATE MACHINE AND CHOMSKY HIERARCHY

To define certain types of

grammar we require a definition

– in a production of the form -

aAb → a α bWhere,

a is called left context

b is right context

a α b is the replacement string

For example: in a production aA → abA

the left context is a , the right context

is A .

Page 15: FINITE STATE MACHINE AND CHOMSKY HIERARCHY

Chomsky classifies grammar

into 4 types : Type 0

Type 1

Type 2

Type 3

Page 16: FINITE STATE MACHINE AND CHOMSKY HIERARCHY

Grammar Languages Automaton

Type-0 Recursively enumerable Turing machine

Type-1 Context-sensitive Linear-bounded non-deterministic Turing machine

Type-2 Context-free Non-deterministic pushdown automaton

Type-3 Regular Finite state automaton

Page 17: FINITE STATE MACHINE AND CHOMSKY HIERARCHY

Type 3 :

A grammar is said to be type 3 grammar or regular grammar if all production in grammar are of the form A → a then A → aB or equivalent of the form A→a or A→Ba.in other words in any production (set of rules) the left hand string is single non-terminal and the right hand string is either a terminal or a terminal followed by non-terminal.

Page 18: FINITE STATE MACHINE AND CHOMSKY HIERARCHY

Type 2 :

A grammar is said to be type 2

grammar or context free grammar if

every production in grammar is of the

form A → α .

In other words in any production left

hand string is always a non-terminal

and a right hand string is any string on

T U N .

Example : A → aBc

Page 19: FINITE STATE MACHINE AND CHOMSKY HIERARCHY

Type 1 :

A grammar is said to type 1 grammar or

context sensitive grammar if for every

production α→ß . The length of ß is

larger than or equal to the length of α .

for example:

A→ab

A→aA

aAb→aBCb

Page 20: FINITE STATE MACHINE AND CHOMSKY HIERARCHY

Type 0 :

A grammar with no restriction is referred to as type 0 grammar . They generate exactly all languages that can be recognized by a Turing machine. These languages are also known as the recursively enumerable languages. Note that this is different from the recursive languages which can be decided by an always-halting Turing machine.

Class 0 grammars are too general to describe the syntax of programming languages and natural languages.

Page 21: FINITE STATE MACHINE AND CHOMSKY HIERARCHY

END