1 / 20

Logical Problem: Client's Innocence and Efficient Program

Solve two logical problems: proving client's innocence based on evidence and determining if a program has a bug based on efficiency. Use propositional logic and logical operators.

gdelaney
Download Presentation

Logical Problem: Client's Innocence and Efficient Program

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. August 31, 2005

  2. Homework Problem • Some information about homework problem. • C'  is the conclusion - it is NOT a hypothesisThe problem CAN be done using our original statements (i.e. without replacing T by K) Here’s what the lawyer said • If my client is guilty, then the knife was in the drawer • Either the knife was not in the drawer or Jason Pritchard saw the knife. • If the knife was not there on October 10, it follows that Jason Pritchard did not see the knife. • Furthermore, if the knife was there on October 10, then the knife was in the drawer and also the hammer was in the barn. • But we all know that the hammer was not in the barn. • Therefore, ladies and gentlemen of the jury, my client is innocent.

  3. Here are the variables used • C client is guiltyK knife was in the drawerT knife was there on October 10S Jason Pritchard saw knifeH hammer was in the barn • 1. C -> K hypothesis2. K' v  S hypothesis3. T' -> S' hypothesis4. T -> (K ^ H) hypothesis5. H' hypothesis

  4. Proof • 6. H’ v K’ 5. addition • 7. (H ^ K)’ 6. DeMorgan’s • 8. (K ^ H)’ 7. commutative • 9. T’ 4,8 Modus Tollens • 10. S’ 3,9 Modus Ponens • 11. S v K’ 2 commutative • 12 K’ 10,11 disjunctive syllogism • 13 C’ 1,12 Modus Tollens

  5. Statement of problem • If the program is efficient, it executes quickly • Either the program is efficient, or it has a bug. • However, the program does not execute quickly. • Therefore it has a bug. • Please use the letters E,Q,B

  6. Propositional form • (E → Q) ⋀ (E ⋁ B) ⋀ Q’→ B

  7. A solution • 1. E → Q hyp (simplification) • 2. E ⋁ B hyp (simplification) • 3. Q’ hyp (simplification) • 4. E’ 1,3 Modus Tollens • 5. B 2,4 Disjunctive syllogism

  8. Another solution • 1. E → Q hyp (simplification) • 2. E ⋁ B hyp (simplification) • 3. Q’ hyp (simplification) • 4. E’⋁ Q 1 implication • 5. Q ⋁ E’ 4 commutative • 6. E’ 3,5 Disjunctive syllogism • 7. B 2,6 Disjunctive syllogism

  9. Still another solution • 1. E → Q hyp (simplification) • 2. E ⋁ B hyp (simplification) • 3. Q’ hyp (simplification) • 4. Q’→ E’ 1 contraposition • 5. E’ 4,3 Modus Ponens • 6. (E’)’ ⋁ B 2 double negation • 7. E’→ B 6 implication • 8 B 7,5 Modus Ponens

  10. And yet another one • 1. E → Q hyp (simplification) • 2. E ⋁ B hyp (simplification) • 3. Q’ hyp (simplification) • 4. (E’)’ ⋁ B 2 double negation • 5. E’→ B 4 implication • 6. E’ ⋁ Q 1 implication • 7. (E’ ⋁ Q) ⋀ Q’ 6,3 conjunction • 8. Q’ ⋀ (E’ ⋁ Q) 7 commutative • 9. (Q’ ⋀ E’) ⋁ (Q’ ⋀ Q) 8 distributive • 10. (E’ ⋀ Q’) ⋁ 0 9 complement property • 11. (E’ ⋀ Q’) 10 identity property • 12. E’ 11 simplification • 13. B 5,12 Modus Ponens

  11. Definition: Compound proposition • “a proposition constructed by combining propositions using logical operators” • Conjunction – and • Disjunction - or

  12. Definition: dual of a compound proposition • The dual of a compound proposition that contains only the logical operators ∨,,¬, is the proposition obtained by replacing each ∨ by, each  by∨, each T by F and each F by T.

  13. Definition: NAND • The proposition p NAND q is true when either p or q or both are false; and it is false when both p and q are true.

  14. Definition: NOR • The proposition p NOR q is true when both p and q are false, and it is false otherwise.

  15. Page 27, problem 34 • Find a compound proposition involving the propositions p,q and r that is true when p and q are true and r is false, but false otherwise.

  16. Page 27, problem 35 • Find a compound proposition involving the propositions p, q, and r that is true when exactly two of p, q, and r are true and is false otherwise. • Hint: form a disjunction of conjunctions. Include a conjunction for each combination of values for which the proposition is true. Each conjunction should include each of the three propositions or their negation.

  17. Modular Arithmetic • a.k.a. clock arithmetic • If a and b are integers and m is a positive integer, then we way that a is congruent to b modulo m if m divides a-b. • We use the notation a≡b (mod m) to indicate that a is congruent to b modulo m • If they are not congruent, we write • a≢ b (mod m)

  18. Why do we care in c.s.? • Applications: • Stripping digits from a base 10 number • Check digits on credit cards • Hash codes for storing information • Generation of pseudo-random numbers • Cryptology • Check digits on bar codes • Enable error detection

More Related