Direct automaton construction for Parikhs Theorem Abhishek Mukati, - - PowerPoint PPT Presentation

direct automaton construction for parikh s theorem
SMART_READER_LITE
LIVE PREVIEW

Direct automaton construction for Parikhs Theorem Abhishek Mukati, - - PowerPoint PPT Presentation

Direct automaton construction for Parikhs Theorem Abhishek Mukati, Rishi Tulsyan, Shubham Waghmare November 23, 2018 Abhshek, Rishi, Shubham Automata Construction November 23, 2018 1 / 61 Parikhs Theorem Theorem Every CFL has the same


slide-1
SLIDE 1

Direct automaton construction for Parikh’s Theorem

Abhishek Mukati, Rishi Tulsyan, Shubham Waghmare November 23, 2018

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 1 / 61

slide-2
SLIDE 2

Parikh’s Theorem

Theorem

Every CFL has the same Parikh image as some regular language. Parikh’s proof of theorem Given a CFG G, the proof produces (implicitly) an automaton or regular expression whose language has the same Parikh image as G. Constructed automata is of size O(nn), where n - number of variables in the CNF of G. Enhanced automaton construction Given a CFG G, construct an automaton explicitly. Instead of O(nn), only O(4n) states.

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 2 / 61

slide-3
SLIDE 3

Terms and Notations

Context Free Grammar

G=(V , T, P, S) V is set of variables, denoted as A1, A2, A3,...... T is a set of terminal symbols, denoted as a, b, c..... S is the start variable. P is a set of productions of the form Ai− → α where α ∈(V U T)∗ If w is a word over some T, we denote by ΠT(w) the Parikh image of w over alphabet T. ΠT(w)maps a character in T to its number of occurrences in w.

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 3 / 61

slide-4
SLIDE 4

Terms and Notations Cont.

Context Free Grammar

G=(V , T, P, S) The Parikh image of a language L over T is {ΠT(w)|w ∈ L}. It is denoted by ΠT(L). Examples :-

Π{a,b,c }(bccba) = (1, 2, 2) where (1, 2, 2) stands for {(a, 1), (b, 2), (c, 2)} Π{a,b,c }(cabaaabb) = (4, 3, 1)

α/V means α projected on V α/T means α projected on T A pair (α, β) is a step, denoted by α ⇒ β, if there exists a production A − → γ and α1, α2 ∈ (V ∪T)∗ such that: α = α1Aα2 and β = α1γα2. Transition t(α ⇒ β) = (ΠV (α),γ/T , ΠV (β)) where, α, β ∈ (V ∪ T)∗

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 4 / 61

slide-5
SLIDE 5

k-Parikh automaton of G

The k-Parikh automaton of G is the NFA Mk

G = (Q, T∗, δ, q0, qf )

n=|V| Q= {(x1 ....xn) ∈ Nn | n

i =1 xi ≤ k }

δ = {t(α ⇒ β) | α ⇒ β is a step and ΠV (α), ΠV (β)∈ Q } qf = ΠV (ǫ) = (0,....., 0) q0 = ΠV (S);

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 5 / 61

slide-6
SLIDE 6

3-Parikh Automaton Example

A1 − → A1A2 | a A2 → bA2aA2 | cA1 Transition example: (0, 2) c − → (1, 1) A2A2 → cA1A2

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 6 / 61

slide-7
SLIDE 7

Example

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 7 / 61

slide-8
SLIDE 8

Theorem

If G is a context-free grammar with n variables and degree m, then L(G) and L(Mnm+1

G

) have same Parikh image. the degree of G denoted by m := -1 + max{|γ/V |(A → γ) ∈ P };i.e., m+1 is the maximal number of variables on the right hand sides. For the above grammar G, n=2 and m=1, which means L(G) =Π L(M3

G).

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 8 / 61

slide-9
SLIDE 9

Proof of L(Mk

G) ⊆Π L(G)

Claim

If k ≥ 1, let q0

σ

− → q be a run of Mk

G on the word σ ∈ T ∗, then there exists

a step sequence S ⇒∗ α satisfying ΠV (α) = q ΠT(α) = ΠT(σ) Proof of claim (by induction on length of path): If l = 0 then σ = ǫ, so α = S and ΠV (S) = q0 and ΠT(S) = ΠT(ǫ) If l > 0, let σ = σ′γ and q0

σ′

− → q′ γ − → q, then according to I.H.: S ⇒∗ α′ where ΠV (α′) = q′ and ΠT(α′) = ΠT(σ′) Since q′ γ − → q is a transition there exists a step α1Aα2 ⇒ α1γ′α2 and a production A → γ′ where ΠV (α1Aα2) = q′, ΠV (α1γ′α2) = q and γ′

/T = γ

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 9 / 61

slide-10
SLIDE 10

Claim’s proof cont.

Since ΠV (α′) = q′ = ΠV (α1Aα2), α′ = α′

1Aα′ 2 for some α′ 1, α′ 2

Let α = α′

1γ′α′ 2 so that S ⇒∗ α′ ⇒ α and

ΠV (α) = ΠV (α′

1γ′α′ 2)

= ΠV (α′

1Aα′ 2) − ΠV (A) + ΠV (γ′)

= ΠV (α′) − ΠV (A) + ΠV (γ′) = ΠV (α1Aα2) − ΠV (A) + ΠV (γ′) = ΠV (α1γ′α2) = q ΠT(α) = ΠT(α′

1γ′α′ 2)

= ΠT(α′

1Aα′ 2) + ΠT(γ′)

= ΠT(α′) + ΠT(γ′) = ΠT(α′) + ΠT(γ) = ΠT(σ′) + ΠT(γ) = ΠT(σ)

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 10 / 61

slide-11
SLIDE 11

Proof of L(Mk

G) ⊆Π L(G) from the claim

If σ ∈ L(Mk

G), then there is a run q0 σ

− → ΠV (ǫ) From the claim, there exists a step sequence S ⇒∗ α satisfying ΠV (α) = ΠV (ǫ) = (0, 0, ..., 0) and ΠT(α) = ΠT(σ) So α ∈ T ∗ and hence α ∈ L(G) Since ΠT(α) = ΠT(σ), we have α =Π σ

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 11 / 61

slide-12
SLIDE 12

Notations and Definitions

Yield of a parse tree t is denoted by Y (t) Set of yields of a set T of trees by Y (T ) A child of t is a subtree of t whose root is a child of the root of t. A child is proper if its root is not a leaf. The dimension d(t) of a parse tree is defined as follows : If t has no proper children then d(t) = 0. Otherwise let t1, t2, ...tr be the proper children of t sorted s.t. d(t1) ≥ d(t2) ≥ ... ≥ d(tr). Then d(t) =

  • d(t1)

if r = 1 or d(t1) > d(t2) d(t1) + 1 if d(t1) = d(t2) The set of parse trees with dimension k is denoted by T (k) Fact 2.1: The height of a tree, h(t) > d(t).

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 12 / 61

slide-13
SLIDE 13

Proof idea of L(G) ⊆Π L(Mnm+1

G

)

Definition

A derivation S ⇒ α0 ⇒ ... ⇒ αl has index k if ∀i ∈ {0, ..., l}, the word (αi)/V has length atmost k. The set of words derivable through derivations of index k is denoted by Lk(G). Clearly L1(G) ⊆ L2(G) ⊆ L3(G) ⊆ ... and L(G) =

k ≥1Lk(G)

We can prove L(G) ⊆Π L(Mnm+1

G

) by proving L(G) ⊆Π Lnm+1(G) (Collapse Lemma) -proved using Y (T ) ⊆Π n

i=0 Y (T (i))

Y (T (k)) ⊆ Lkm+1(G) Lk(G) ⊆Π L(Mk

G)

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 13 / 61

slide-14
SLIDE 14

Lemma 2.1

Lemma 2.1

Y(T ) ⊆Π ∪n

i=0Y(T (i))

Π (Yields of all the parse trees) ⊆ Π ( Union of Yields of all the parse trees of dimension i, where (i=0 to n))

Proof Idea

For every parse tree t ∈ T , we can find a parse tree t’ ∈ T (i), such that:

Π (Y (t)) = Π (Y (t’))

d(t′) = i ≤ n. (n = | V |)

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 14 / 61

slide-15
SLIDE 15

Lemma 2.1: Proof - Preliminaries

In this proof, we write t = t1t2 to denote that

t1 is a parse tree except that exactly one leaf is labelled by a variable, say A2, instead of a terminal. t2 is a parse tree with root A2. t is obtained from t1 and t2 by replacing the leaf A2 of t1 by the tree t2. Figure: Tree t. Figure: Tree t1 and t2.

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 15 / 61

slide-16
SLIDE 16

Lemma 2.1: Proof - Preliminaries

Ω − equivalence

Two trees t, t’ are Ω -equivalent if:

They have same number of nodes. The sets of variables in t and t′ coincide. Y (t) = Π Y (t’)

Compact tree

A tree t is compact if d(t) ≤ K(t). where K(t) denotes the number of variables that appear in t. K(t) ≤ n. Why?

Proof Idea

For every parse tree t ∈ T , we can find a parse tree t’ ∈ T (i), such that:

Π (Y (t)) = Π (Y (t’))

d(t′) = i ≤ n. (n = | V |)

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 16 / 61

slide-17
SLIDE 17

Compactify(t)

Compactify(t) transforms a tree t into an Ω − equivalent compact tree. Steps: 1 If t is compact then return t and terminate. 2 If t is not compact then:

2.1 Let t1, .....tr be the proper children of t, r ≥ 1. 2.2 For every 1 ≤ i ≤ r: ti := Compactify(ti). (i.e., replace in t the subtree ti, by the result of compactifying ti. 2.3 Let x be the smallest index 1 ≤ x ≤ r such that K(tx) = maxiK(ti). 2.4 Choose an index y = x such that d(ty) = maxid(ti). 2.5 Choose subtrees ta

x, tb x of tx and subtrees ta y, tb y , tc y of ty such that:

i tx = ta

x.tb x and ty = ta

  • y. (tb

y .tc y ) ; and

ii the roots of tb

x , tb y and tc y are labelled by the same variable.

2.6 Remove tb

y from ty and insert it into tx.

tx = ta

x.(tb y . tb x ) ; ty = ta y.tc y .

2.7 Goto (1).

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 17 / 61

slide-18
SLIDE 18

Example

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 18 / 61

slide-19
SLIDE 19

Example

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 19 / 61

slide-20
SLIDE 20

Example

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 20 / 61

slide-21
SLIDE 21

Example

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 21 / 61

slide-22
SLIDE 22

Example

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 22 / 61

slide-23
SLIDE 23

Example

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 23 / 61

slide-24
SLIDE 24

Example

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 24 / 61

slide-25
SLIDE 25

Example

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 25 / 61

slide-26
SLIDE 26

Example

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 26 / 61

slide-27
SLIDE 27

Example

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 27 / 61

slide-28
SLIDE 28

Example

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 28 / 61

slide-29
SLIDE 29

Example

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 29 / 61

slide-30
SLIDE 30

Example

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 30 / 61

slide-31
SLIDE 31

Example

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 31 / 61

slide-32
SLIDE 32

Example

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 32 / 61

slide-33
SLIDE 33

Example

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 33 / 61

slide-34
SLIDE 34

Example

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 34 / 61

slide-35
SLIDE 35

Example

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 35 / 61

slide-36
SLIDE 36

Example

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 36 / 61

slide-37
SLIDE 37

Example

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 37 / 61

slide-38
SLIDE 38

Example

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 38 / 61

slide-39
SLIDE 39

Example

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 39 / 61

slide-40
SLIDE 40

Example

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 40 / 61

slide-41
SLIDE 41

Example

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 41 / 61

slide-42
SLIDE 42

Example

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 42 / 61

slide-43
SLIDE 43

Example

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 43 / 61

slide-44
SLIDE 44

Compactify(t)

Compactify(t) transforms a tree t into an Ω − equivalent compact tree. Steps: 1 If t is compact then return t and terminate. 2 If t is not compact then:

2.1 Let t1, .....tr be the proper children of t, r ≥ 1. 2.2 For every 1 ≤ i ≤ r: ti := Compactify(ti). (i.e., replace in t the subtree ti, by the result of compactifying ti. 2.3 Let x be the smallest index 1 ≤ x ≤ r such that K(tx) = maxiK(ti). 2.4 Choose an index y = x such that d(ty) = maxid(ti). 2.5 Choose subtrees ta

x, tb x of tx and subtrees ta y, tb y , tc y of ty such that:

i tx = ta

x.tb x and ty = ta

  • y. (tb

y .tc y ) ; and

ii the roots of tb

x , tb y and tc y are labelled by the same variable.

2.6 Remove tb

y from ty and insert it into tx.

tx = ta

x.(tb y . tb x ) ; ty = ta y.tc y .

2.7 Goto (1).

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 44 / 61

slide-45
SLIDE 45

Compactify(t) is well-defined

We first prove that the procedure Compactify is well-defined i.e. some assumptions made by the procedure about the existence of some objects indeed hold.

(2.1) If t is not compact, then t has at least one proper child.

Proof: Given: t is not compact. Assume that t has no proper child. Then, d(t) = 0 ≤ K(t). Why? Hence, t is compact. Contradiction.

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 45 / 61

slide-46
SLIDE 46

Compactify(t) is well-defined

(2.4) If t is not compact and all its proper children are compact and x is the smallest index such that K(tx) = maxiK(ti). Then, there exists an index y = x such that d(ty) = maxid(ti).

Proof: Let y be an index, such that d(ty) = maxid(ti). Then d(t) ≤ d(ty) + 1. (by definition of dimension and of y) ≤ K(ty) + 1. (as ty is compact) ≤ K(tx) + 1. (by definition of x) ≤ K(t) + 1. (as tx is a child of t) ≤ d(t). (as t is not compact) d(t) = d(ty) + 1. By definition of dimension, if ty was the only child of t with maximum dimension, then d(t) = d(ty). Hence, more than 1 such child exist. If 1 of them is tx, we can choose ty from the rest of them.

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 46 / 61

slide-47
SLIDE 47

Compactify(t) is well-defined

(2.5) If t is not compact and all its proper children are compact, and it has two distinct proper children tx, ty such that K(tx) = maxiK(ti) and d(ty) = maxid(ti). Then, there exist subtrees ta

x, tb x of tx and

subtrees ta

y, tb y , tc y of ty satisfying conditions (i) and (ii).

i tx = ta

x.tb x and ty = ta

  • y. (tb

y .tc y ) ; and

ii the roots of tb

x , tb y and tc y are labelled by the same variable.

Proof: K(ty) = d(ty). (from proof of 2.4 ) d(ty) < h(ty). (from Fact 2.1 ) K(ty) < h(ty). ∃ path of ty from the root to a leaf that visits at least two nodes labelled with the same variable, say A. Hence, we can have ty = ta

y.(tb y .tc y ) where roots of tb y and tc y are

labelled A.

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 47 / 61

slide-48
SLIDE 48

Compactify(t) is well-defined

Also, K(t) = K(tx). (from proof of 2.4 ) Hence, every variable that appears in t appears also in tx. So tx contains a node labelled by A. Hence, we can have tx = ta

x.tb x where root of tb x is labelled A.

Thus, the procedure Compactify is well-defined.

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 48 / 61

slide-49
SLIDE 49

Compactify(t)

Compactify(t) transforms a tree t into an Ω − equivalent compact tree. Steps: 1 If t is compact then return t and terminate. 2 If t is not compact then:

2.1 Let t1, .....tr be the proper children of t, r ≥ 1. 2.2 For every 1 ≤ i ≤ r: ti := Compactify(ti). (i.e., replace in t the subtree ti, by the result of compactifying ti. 2.3 Let x be the smallest index 1 ≤ x ≤ r such that K(tx) = maxiK(ti). 2.4 Choose an index y = x such that d(ty) = maxid(ti). 2.5 Choose subtrees ta

x, tb x of tx and subtrees ta y, tb y , tc y of ty such that:

i tx = ta

x.tb x and ty = ta

  • y. (tb

y .tc y ) ; and

ii the roots of tb

x , tb y and tc y are labelled by the same variable.

2.6 Remove tb

y from ty and insert it into tx.

tx = ta

x.(tb y . tb x ) ; ty = ta y.tc y .

2.7 Goto (1).

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 49 / 61

slide-50
SLIDE 50

Compactify(t) is Correct

Correctness

If Compactify(t) terminates and returns a tree t’, then t and t’ are Ω − equivalent. Proof by induction on the number of calls to Compactify(t). Base Case: If Compactify is called only once, then only line (1) is executed, t is compact. If Compactify is called more than once, the only lines that modify t are:

2.2 For every 1 ≤ i ≤ r: ti := Compactify(ti). 2.6 Remove tb

y from ty and insert it into tx.

Consider 2.2. By I.H., each call to Compactify(ti) returns a compact tree t′

i that is Ω − equivalent to ti. Let t1 and t2 be the values of t

before and after the execution of ti := Compactify(ti). Then t2 is the result of replacing ti by t′

i in t1.

since t′

i is Ω − equivalent to ti, we get that t2 is Ω − equivalent to t1.

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 50 / 61

slide-51
SLIDE 51

Consider 2.6. By Let t1 and t2 be the values of t before and after the execution of tx := ta

x(tb y tb x ) followed by the execution of ty := ta ytc y .

Since the subtree tb

y that is added to tx is subsequently removed from

ty,

t1 and t2 have same number of nodes. The sets of variables in t1 and t2 coincide. Y (t1) =Π Y (t2).

Thus, the procedure Compactify is Correct.

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 51 / 61

slide-52
SLIDE 52

Compactify(t) terminates

Compactify(t) terminates

Assume that t has a minimal number of nodes. The procedure does not change, the number of nodes or the set of variables occurring in each of t1, ...., tr. The procedure adds nodes to tx. Value of K(tx) does not decrease. x has the same value at every execution. Since, each execution strictly decreases the number of nodes of some proper child ty different from tx, and only increases the number of nodes of tx. Contradiction: All proper children of t have a finite number of nodes.

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 52 / 61

slide-53
SLIDE 53

Lemma 2.2

Lemma 2.2

For every k ≥ 0 : Y(T k) ⊆ Lkm+1(G) The set of Yields of all the parse trees of dimension k, is a subset of the set of words derivable through derivations of index km + 1, denoted by Lkm+1(G).

Proof Idea

For every parse tree t ∈ T k, there exists a derivation of index ’km + 1’ for Y (t).

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 53 / 61

slide-54
SLIDE 54

Lemma 2.2: For every k ≥ 0 : Y(T k) ⊆ Lkm+1(G)

In this proof, we will use the following notation. If D is a derivation α0 ⇒ ... ⇒ αl and w, w′ ∈ (V ∪ T)∗, then we define wDw′ to be the step sequence wα0w′ ⇒ ... ⇒ wαlw′. Proof by induction on number of non-leaf nodes (nl) in t: Let d(t) = k. Base Case:

nl = 0. t has no proper child. d(t) = k = 0. index = km + 1 = 1. Derivation: S ⇒ Y (t) of index 1.

Induction Step: Assume t has r ≥ 1 proper children t1, ..., tr where the root of ti is assumed to be labelled by A(i); i.e., we assumed the topmost level of t is induced by a rule S − → γ0A(1)γ1...γr−1A(r)γr for γi ∈ T ∗ (1)

r − 1 ≤ m At most one child ti has dimension k, while others have at most k − 1.

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 54 / 61

slide-55
SLIDE 55

Assume d(t1) ≤ k and d(t2), ..., d(tr) ≤ k − 1. I.H. for all 1 ≤ i ≤ r there is a derivation Di for Y (ti) s.t. D1 has index km + 1, and D2, ..., Dr have index (k − 1)m + 1. For each 1 ≤ i ≤ r, define the step sequence D′

i := γ0A(1)γ1...γi−2A(i−1)γi−1DiγiY (ti+1)γi+1...γr−1Y (tr)γr

(2) Now, D′

1 has index km + 1, and for 2 ≤ i ≤ r, the step sequence D′ i

has index, (i − 1) + (k − 1)m + 1 ≤ km + 1. By concatenating the step sequences S − → γ0A(1)γ1...γr−1A(r)γr and Dr, Dr−1, ..., D1 in that order, we obtain a derivation for Y (t) of index km + 1.

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 55 / 61

slide-56
SLIDE 56

Lemma 2.3 [Collapse Lemma]

Collapse Lemma

L(G) ⊆Π Lnm+1(G) L(G) = Y (T ) ⊆Π ∪n

i=0Y(T (i)) (Lemma 2.1)

⊆ Lnm+1(G) (Lemma 2.2)

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 56 / 61

slide-57
SLIDE 57

Lemma 2.4

Lemma 2.4

For every k ≥ 1 : Lk(G) ⊆Π L(Mk

G).

We show that if S ⇒∗ α is a prefix of a derivation of index k then Mk

G has

a run q0

w

− → ΠV (α) s.t. w ∈ T ∗ and α/V =Π w. Proof by induction on length i of the prefix Base Case: When i = 0, α = S, q0 = ΠV (S) and S/T = ǫ; this holds. Induction Step: When i > 0, Since S ⇒i α, there exist: β1Aβ2 ∈ (V ∪ T)∗ and a production A → γ s.t. S ⇒i−1 β1Aβ2 ⇒ α and β1γβ2 = α

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 57 / 61

slide-58
SLIDE 58

Lemma 2.4: Proof of Lk(G) ⊆Π L(Mk

G)

By I.H. there exists a run of Mk

G s.t. q0 w1

− − → ΠV (β1Aβ2) and (β1Aβ2)/T =Π w1. By definition of Mk

G and the fact that S ⇒i α is of index k; there

exists a transition (ΠV (β1Aβ2), γ/T, ΠV (α)). Hence q0

w1.γ/T

− − − − → ΠV (α). Also from (β1Aβ2)/T =Π w1 and α = β1γβ2; α/T =Π w1.γ/T and this is proved. Finally, if α ∈ T ∗ so that S ⇒∗ α is a derivation, then: q0

w

− → ΠV (α) = (0, ..., 0) where (0, ..., 0) is an accepting state and α = α/T =Π w.

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 58 / 61

slide-59
SLIDE 59

Proof of Correctness: L(G) ⊆Π L(Mnm+1

G

)

Proposition

L(G) ⊆Π L(Mnm+1

G

) L(G) ⊆Π Lnm+1(G) (Collapse Lemma) ⊆Π L(Mnm+1

G

) (Lemma 2.4)

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 59 / 61

slide-60
SLIDE 60

Conclusion

If G is a context-free grammar with n variables and degree m, then L(G) and L(Mnm+1

G

) have same Parikh image. Mk

G has exactly n+kCk states.

For grammars in CNF, m=1. k=n+1. Therefore, no. of states in Mn+1

G

is exactly 2n+1Cn ≤ 22n+1 ∈ O(4n).

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 60 / 61

slide-61
SLIDE 61

Thank you!

Abhshek, Rishi, Shubham Automata Construction November 23, 2018 61 / 61