Lecture7x - 15-453 FORMAL LANGUAGES, AUTOMATA AND...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 15-453 Lecture7x.ppt
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Chomsky Normal Form and TURING MACHINES
Background image of page 2
CHOMSKY NORMAL FORM A context-free grammar is in Chomsky normal form if every rule is of the form: A → BC A → a S → ε B and C aren’t start variables a is a terminal S is the start variable Any variable A (except the start variable) can only generate strings of length > 0
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CHOMSKY NORMAL FORM A context-free grammar is in Chomsky normal form if every rule is of the form: A → BC A → a S → ε B and C aren’t start variables a is a terminal S is the start variable S → 0S1 S → TT T → ε S → TU | TV T → 0 U → SV S 0 → TU | TV | ε V → 1
Background image of page 4
Theorem: If G is in CNF, w L(G) and | w | > 0, then any derivation of w in G has length 2|w| - 1 Proof (by induction on | w |): Base Case: If | w | = 1, then any derivation of w must have length 1 (S → a) Inductive Step: Assume true for any string of length at most k ≥ 1, and let | w | = k+1 Since | w | > 1, derivation starts with S → AB So w = xy where A * x , | x | > 0 and B * y , | y | > 0 By the inductive hypothesis, the length of any derivation of w must be 1 + ( 2| x | - 1 ) + ( 2| y | - 1 ) = 2(| x | + | y |) - 1
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Theorem: Any context-free language can be generated by a context-free grammar in Chomsky normal form “Can transform any CFG into Chomsky normal form”
Background image of page 6
Theorem: Any context-free language can be generated by a context-free grammar in Chomsky normal form Proof Idea: 1. Add a new start variable 2. Eliminate all A ε rules. Repair grammar 3. Eliminate all A B rules. Repair 4. Convert A u 1 u 2 ... u k to A u 1 A 1 , A 1 u 2 A 2 , . .. If u i is a terminal, replace u i with U i and add U i u i
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
1. Add a new start variable S 0 and add the rule S 0 → S S → 0S1 S → T#T T → ε S 0 → S 2. Remove all A → ε rules (where A is not S 0 ) For each occurrence of A on right hand side of a rule, add a new rule with the occurrence deleted
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/29/2012 for the course CS 15-453 taught by Professor Edmundm.clarke during the Spring '09 term at Carnegie Mellon.

Page1 / 33

Lecture7x - 15-453 FORMAL LANGUAGES, AUTOMATA AND...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online