1 / 37

Induction Proofs

Induction Proofs. Equivalent Statements in Proofs. q. p. Language Equivalence Proofs. Soundness : All strings derivable in the grammar G have the “characteristic” property of strings in L. Thou shall not lie.

chet
Download Presentation

Induction Proofs

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Induction Proofs Equivalent Statements in Proofs L6Proof

  2. L6Proof

  3. q p L6Proof

  4. Language Equivalence Proofs L6Proof

  5. 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. L6Proof

  6. 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. L6Proof

  7. How do we generate Derivation Rule Application L6Proof

  8. Let #w(x) = Number of occurrences of x in w. Prove that • Proof : By induction on the length of the derivation of a sentence. • Basis: l = 4 L6Proof

  9. Induction Hypothesis: • Induction Step: By context-freeness of the grammar: L6Proof

  10. 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.) L6Proof

  11. Example Two proofs for the same result. L6Proof

  12. Prove that if then L6Proof

  13. x x x Informal Argument + + x * x x * x E x x Abstract syntax tree E + E Strictly Binary Trees: # nodes = (2 * #leaves) – 1 # ops + # vars = (2 * #vars) – 1 # ops + 1 = #vars #(+) + #(*) +1 = #(x) E E * Parse tree L6Proof

  14. Proof Alternatives L6Proof

  15. Proof 1: By induction on the length of the derivation of a sentence. • Basis: n = 1 s = x 0 + 0 + 1 = 1 • Induction Hypothesis: L6Proof

  16. Induction step: k=n+1 Possible patterns for w L6Proof

  17. By induction hypothesis: L6Proof

  18. LHS RHS L6Proof

  19. By induction hypothesis: L6Proof

  20. LHS RHS L6Proof

  21. 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 L6Proof

  22. 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: L6Proof

  23. Induction step: k=n+1 • Changes in the counts due to one-step rewrites: L6Proof

  24. 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). L6Proof

  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. L6Proof

  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. L6Proof

  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 allstart symbol (LHS) productions. L6Proof

  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. L6Proof

  29. 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!) L6Proof

  30. L6Proof

  31. L6Proof

  32. L6Proof

  33. n = 2 is redundant. Palindromic property + Pattern specified L6Proof

  34. L6Proof

  35. L6Proof

  36. L6Proof

  37. L6Proof

More Related