Você está na página 1de 7

ADVANCE THEORY OF

COMPUTATION
Kleenes theorem

What is Kleenes Theorem ? prove its properties?


Theorem:
If a language can be express by Finite Automata (F.A) ,Transition Graph (T.G) or Regular Expression
(R.E), then it can also be expressed by other two as well.
Part I
If a language can be accepted by FA then it can be accepted by TG as well.
Part II
If a language can be accepted by TG then it can be accepted by RE as well.
Part III
If a language can be expressed by a RE then it can be accepted by an FA as well.
Proof
Kleenes theorem Part 1: If a language can be accepted by FA then it can be accepted by TG as well.

Regular expression of Even- Even , L= (aa+bb+(ab+ba)(aa+bb)(ab+ba))*


FA for RE of Even-Even

TG of Even Even

As every FA can be considered to be a TG.


Kleenes theorem Part 2:
If a language can be accepted by TG then it can be accepted by RE as well.

To prove 2nd part of the theorem, different step have to be applied.


1. Converting TG to GTG (Generalized Transition Graph). If TG has more than one start states, then
introduce a new start state connecting the new state to the old start states by the transition labeled
by / and make the old start states the non start states. This can be shown by following example
TG with more than one start state:

a,b

GTG with one start state:

a,b

aaa

+4

+2

a,b

bbb

+4

a,b
2. If TG has more than one final states , then introduce a new final state, connecting the old final
a,b
states to the new final states by the transitions labeled
a,b

aaa

bbb

3
a,b

4
a,b

3. If a state has two or more incoming transition edges labeled by the corresponding Res, from the
same state including the possibility of loops at a state , then replace all these transition edges with
a single transition edge labeled by the summation of corresponding R.Es.
We can see that step three is not applicable with our given example so it can be illustrated with
another example.

4. Bypass and state elimination


if three states in a TG are connected in sequence then eliminate the middle state and connect the
first state with the third by a single transition (include the possibility of circuit as well) labeled by
the RE which is the concatenation of corresponding two REs in the existing sequence.

Befor step 3

Applied
step 4

finally the RE = (b+aa)b*+ (a+bb)b*

Kleenes Theorem Part III : If a language can be expressed by a RE then it can be accepted by
an FA as well.
Example: method I union of two FAs
Let r1 =((a+b)(a+b))* define L1
then FA1 be

r2 = (a+b)((a+b)(a+b))* define L2 then FA2 be

Union
r1+r2= ((a+b)(a+b))* + (a+b)((a+b)(a+b))*

Mehod II Concatenation of two Fas


Using r1 and r2 , an FA can be built, corresponding to r1r2. This method can be developed with
the following example.
Example:
r1= (a+b)*b defines L1 and FA2 be

r2=(a+b)*aa(a+b)* define L2 and FA2 be

Concatenation:
r1.r2= (a+b)*b . (a+b)*aa(a+b)*

The concatenated FA will be

Method III; Closure of an FA


If r1=(a+b)*b then corresponding FA be

FA to r* can be determined as

Available methods to define the language.


In computer science, BNF (Backus Normal Form or Backus-Naur Form) is one of the 2 main notation
techniques for context free grammars, often used to describe the syntax of language used in computing,
such as computer programming languages, document formats, instruction sets and communication
protocols; the other main techniques for writing context free grammar is theVan Wijngaarden form. They

are applied whenever exact descriptions of languages are needed; for instance in official language
specification, in manuals and in text books on programming language theory.
A Van-Wijngaarden grammar, also vW-grammar or W-grammar., is a 2 level grammar which provides a
technique to define potentially infinite context free grammar in a finite number of rules. The formalism
was invented by Adriaan van Wijangaarden to define rigorously some syntactic restrictions which
previously had to be formulated in natural language, despite their essentially syntactical content. Typical
applications are the treatment of gender and number in natural language syntax and well definedness of
identifiers in programming languages.
A W-grammar consists of a finite set of meta rules, which are used to derive production rules from a finite
set of hyper rules. Meta rules are restricted to those defined by a context free grammar. Hyper rules
restrict the admissible contexts at the upper level. Essentially, the consistent substitution used in the
derivation process is equivalent to unification as in Prolog, as was noted by Alain Colmeraure.
For example, the assignment x := 1 is only valid if the variable x can contain an integer. Therefore the
context free syntax variable := value is incomplete. In a 2 level grammar, this might be specified in a
context sensitive manner as REF TYPE variable := TYPE value. Then ref interger variable := integer
value could be a production rule but ref Boolean variable := integer value is not a possible production
rule. This also means that assigning with incompatible types becomes a syntax error which can be caught
at compile time. Similarly
Style begin token, new layer1 preludes,
Parallel token, new layer1 tasks pack,
Style end token

Allow begin ----- end and {.} but not begin.}

Você também pode gostar