Download presentation
Presentation is loading. Please wait.
Published byJune Underwood Modified over 9 years ago
1
cs466(Prasad)L6Proof1 Induction Proofs Equivalent Statements in Proofs
2
cs466(Prasad)L6Proof2
3
cs466(Prasad)L6Proof3 q p
4
cs466(Prasad)L6Proof4 Language Equivalence Proofs
5
cs466(Prasad)L6Proof5 Soundness: All strings derivable in the grammar G have the “characteristic” property of strings in L. Thou shall not lie. Typically the proof proceeds by associating an invariant with each variable that characterizes the strings it derives.
6
cs466(Prasad)L6Proof6 Completeness: All strings in L are derivable in G. Thou shall speak the whole truth. Typically the proof presents an algorithm for generating a string template of L using the rules of the grammar G.
7
cs466(Prasad)L6Proof7 How do we generate Derivation Rule Application
8
cs466(Prasad)L6Proof8 Let #w(x) = Number of occurrences of x in . Prove that Proof : By induction on the length of the derivation of a sentence. –Basis: l = 4
9
cs466(Prasad)L6Proof9 Induction Hypothesis: Induction Step: By context-freeness of the grammar:
10
cs466(Prasad)L6Proof10 By induction hypothesis: (Note that Sudkamp’s text illustrates an alternative approach. Its proof uses a property of sentential forms and shows that the rules in the grammar preserve it.)
11
cs466(Prasad)L6Proof11 Example Two proofs for the same result.
12
cs466(Prasad)L6Proof12 Prove that if then
13
cs466(Prasad)L6Proof13 Informal Argument E E E EE + * xxx + x * x x + * xx x Parse tree Abstract syntax tree Strictly Binary Trees: # nodes = (2 * #leaves) – 1 # ops + # vars = (2 * #vars) – 1 # ops + 1 = #vars #(+) + #(*) +1 = #(x)
14
cs466(Prasad)L6Proof14 Proof Alternatives
15
cs466(Prasad)L6Proof15 Proof 1: By induction on the length of the derivation of a sentence. Basis: n = 1 s = x 0 + 0 + 1 = 1 Induction Hypothesis:
16
cs466(Prasad)L6Proof16 Induction step: k=n+1 Possible patterns for w
17
cs466(Prasad)L6Proof17 By induction hypothesis:
18
cs466(Prasad)L6Proof18 LHS RHS
19
cs466(Prasad)L6Proof19 By induction hypothesis:
20
cs466(Prasad)L6Proof20 LHS RHS
21
cs466(Prasad)L6Proof21 Proof 2: By induction on the length of the derivation of a sentential form. Prove the general result so that the desired result for sentences follows given that
22
cs466(Prasad)L6Proof22 Basis: n = 1 w = +EE 1 + 0 + 1 = 0 + 2 w = *EE 0 + 1 + 1 = 0 + 2 w = x 0 + 0 + 1 = 1 + 0 Induction Hypothesis:
23
cs466(Prasad)L6Proof23 Induction step: k=n+1 Changes in the counts due to one-step rewrites:
24
cs466(Prasad)L6Proof24 In each case, the relationship (to be proved) among the counts of +,*, x and E for a sentential form holds. In other words, each rule application to a sentential form preserves this relationship. The desired result is obtained by observing that sentences do not contain any variable (non-terminal).
25
GENERAL STRATEGY FOR SENTENCE-BASED PROOF Variable of Induction: Length of derivation of sentence. Induction Hypothesis: Usually the same as the result to be proved. Basis Case: Explicitly verify for sentences derivable in (length =) 1 step. That is, verify for subset of start symbol (LHS) productions that have only terminals on the RHS. cs466(Prasad)L6Proof25
26
Induction Step: (n+1) steps is divided into 1 step + n steps to create the sub-problems. This ensures that sub-problems created using can use induction hypothesis about sentences. The first step must use E-productions with at least one non-terminal on the RHS. Thus, there are as many cases as there are E-productions with non- terminals on the RHS. cs466(Prasad)L6Proof26
27
GENERAL STRATEGY FOR SENTENTIAL FORM-BASED PROOF Variable of Induction: Length of derivation of sentential form. Induction Hypothesis: Usually a generalization of the result to be proved, involving non-terminals. (The result about the sentences is a special case when number of non-terminals is set to 0.) Basis Case: Explicitly verify for sentential forms derivable in (length =) 0 steps and 1 step. That is, verify for start symbol S and all start symbol (LHS) productions. cs466(Prasad)L6Proof27
28
Induction Step: (n+1) steps is divided into n steps + 1 step to create sub-problems. The sub-problems created using can use induction hypothesis about sentential forms. The last step can use all productions applicable to non-terminals in w. So, we need to show that each rule application preserves the induction hypothesis / invariant, e.g., maintain balance of counts. cs466(Prasad)L6Proof28
29
cs466(Prasad)L6Proof29 Language of Palindromes A man, a plan, a canal, Panama! Able was I ere I saw Elba. Rats live on no evil star. He goddam mad dog, eh? Madam, I'm Adam. A Santa stops pots at NASA. A Toyota's a Toyota. Tarzan raised a Desi Arnaz rat. Aibohphobia (The fear of palindromes!)
30
cs466(Prasad)L6Proof30
31
cs466(Prasad)L6Proof31
32
cs466(Prasad)L6Proof32
33
cs466(Prasad)L6Proof33 n = 2 is redundant. Palindromic property + Pattern specified
34
cs466(Prasad)L6Proof34
35
cs466(Prasad)L6Proof35
36
cs466(Prasad)L6Proof36
37
cs466(Prasad)L6Proof37
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.