Mathematics for Computing Equational Logic as Calculus of Boolean - - PDF document

mathematics for computing
SMART_READER_LITE
LIVE PREVIEW

Mathematics for Computing Equational Logic as Calculus of Boolean - - PDF document

Axioms Fill in the Blanks! Anything Wrong? false (3.1) Axiom, Associativity of : = (3.15) p p false (3.2) Axiom, Symmetry of : p p (3.3) Axiom, Identity of : = (3.11) p q p q


slide-1
SLIDE 1

Axioms — Fill in the Blanks!

(3.1) Axiom, Associativity of ≡: (3.2) Axiom, Symmetry of ≡: (3.3) Axiom, Identity of ≡: (3.8) Axiom, Definition of false: (3.9) Axiom, Distributivity of ¬ over ≡: (3.10) Axiom, Definition of ≡: (3.24) Axiom, Symmetry of ∨: (3.25) Axiom, Associativity of ∨: (3.26) Axiom, Idempotency of ∨: (3.27) Axiom, Distributivity of ∨ over ≡: (3.28) Axiom, Excluded Middle:

Anything Wrong?

false = (3.15) ¬p ≡ p ≡ false ¬p ≡ p = (3.11) ¬p ≡ q ≡ p ≡ ¬q ¬p ≡ ¬p ≡ q ≡ ¬q = (3.14) (p ≡ q) ≡ ¬p ≡ q, twice p ≡ p ≡ q ≡ ¬q = (3.14) (p ≡ q) ≡ ¬p ≡ q, twice p ≡ p ≡ ¬q ≡ ¬q = (3.2) Symmetry of ≡ p ≡ p = (3.3) Identity of ≡ true

Mathematics for Computing

COMP SCI 1FC3 McMaster University, Winter 2013

Wolfram Kahl

kahl@cas.mcmaster.ca

30 January 2013

Plan for Today

Textbook Chapter 3: Propositional Calculus

Equational Logic as Calculus of Boolean Expressions Equivalence, true Negation, Inequivalence, false Disjunction Conjunction

Calculating puzzle solutions: Knights and Knaves

Theorems

A theorem is either an axiom

  • r the conclusion of an inference rule where the premises

are theorems

  • r a Boolean expression proved (using the inference rules)

equal to an axiom or a previously proved theorem. Such proofs will be presented in the calculational style. Note: “theorem” is a syntactic concept − → proofs “validity” is a semantic concept − → truth tables For the propositional logic E, theoremhood and validity coincide:

All theorems in E are valid: E is sound All valid Boolean expressions are theorems in E: E is complete

Equivalence Axioms, and Theorem (3.4)

(3.1) Axiom, Associativity of ≡: ((p ≡ q) ≡ r) ≡ (p ≡ (q ≡ r)) (3.2) Axiom, Symmetry of ≡: p ≡ q ≡ q ≡ p (3.3) Axiom, Identity of ≡: true ≡ q ≡ q The least interesting theorem, shorter proof: Proving (3.4) true: true = (3.2) Symmetry of ≡, with p := true true ≡ q ≡ q — This is (3.3) Identity of ≡

slide-2
SLIDE 2

Equivalence Axioms and Theorems

(3.1) Axiom, Associativity of ≡: ((p ≡ q) ≡ r) ≡ (p ≡ (q ≡ r)) (3.2) Axiom, Symmetry of ≡: p ≡ q ≡ q ≡ p (3.3) Axiom, Identity of ≡: true ≡ q ≡ q Theorems and Metatheorems: (3.4) true (3.5) Reflexivity of ≡: p ≡ p (3.6) Proof Method: To prove that P ≡ Q is a theorem, trans- form P to Q or Q to P using Leibniz. (3.7) Metatheorem: Any two theorems are equivalent.

Proving Equivalences Using Equality Chains

(3.6) Proof Method: To prove that P ≡ Q is a theorem, trans- form P to Q or Q to P using Leibniz. Justification: Each transformation of P to Q using Leibniz can be turned into a proof of P ≡ Q: P = Hint 0 R = Hint 1 . . . = Hint 2 Q true — This is (3.4) = (3.3), true = q = q P ≡ P = Hint 0 P ≡ R = Hint 1 . . . = Hint 2 P ≡ Q

\ThisIs{...} — also Before First Step

true — This is (3.4) = (3.3), true = q = q P ≡ P = Hint 0 P ≡ R = Hint 1 . . . = Hint 2 P ≡ Q \begin{calc} \true \ThisIs{(3.4)} \CalcStep{=}{(3.3), $\true = q = q$} P \equiv P \CalcStep{=}{Hint 0} (3.6) Proof Method: To prove that P ≡ Q is a theorem, trans- form P to Q or Q to P using Leibniz. P = Hint 0 R = Hint 1 . . . = Hint 2 Q true — This is (3.4) = (3.3), true = q = q P ≡ P = Hint 0 P ≡ R = Hint 1 . . . = Hint 2 P ≡ Q (3.22) Principle: Structure proofs to avoid repeating the same subexpression on many lines.

A More Subtle Puzzle

We now have only two brothers (identical twins). One of them is named Arthur and the other has a different name. One of the two always lies and the other always tells the truth, but we are not told whether Arthur is the liar or the truth-teller. One day you meet the two brothers together, and you wish to find out which one is Arthur. You are allowed to ask just one of them a question answer- able by yes or no, and again the question may not contain more than three words. What question would you ask? Raymond Smullyan: To Mock a Mockingbird

A More Subtle Puzzle — Solution 1

AT : Arthur is truthful Axiom: AT ≡ ( Arthur answers X ) ≡ X

  • AT ≡ Arthur answers AT ≡ AT

= (3.2) symmetry: p ≡ q ≡ q ≡ p, twice Arthur answers AT Axiom: AT ≡

  • Henry answers X ≡ ¬X
  • AT ≡ Henry answers ¬AT ≡ ¬¬AT

= (3.12) Double negation ¬¬p = p AT ≡ Henry answers ¬AT ≡ AT = (3.2) symmetry: p ≡ q ≡ q ≡ p, twice Henry answers ¬AT

slide-3
SLIDE 3

Negation Axioms and Theorems

(3.8) Axiom, Definition of false: false ≡ ¬true (3.9) Axiom, Distributivity of ¬ over ≡: ¬(p ≡ q) ≡ ¬p ≡ q Can be used as: ¬(p ≡ q) = (¬p ≡ q) (¬(p ≡ q) ≡ ¬p) = q (3.10) Axiom, Definition of ≡: (p ≡ q) ≡ ¬(p ≡ q) Theorems: (3.11) ¬p ≡ q ≡ p ≡ ¬q (¬p ≡ ¬q) ≡ (p ≡ q) (3.12) Double negation: ¬¬p ≡ p (3.13) Negation of false: ¬false ≡ true (3.14) (p ≡ q) ≡ ¬p ≡ q (3.15) ¬p ≡ p ≡ false

A More Subtle Puzzle — Solution 2

AL : Arthur lies Axiom: AL ≡

  • Arthur answers X ≡ ¬X
  • AL ≡ Arthur answers ¬AL ≡ ¬¬AL

= (3.12) ¬¬p = p AL ≡ Arthur answers ¬AL ≡ AL = (3.2) symmetry: p ≡ q ≡ q ≡ p, twice Arthur answers ¬AL Axiom: AL ≡

  • Henry answers X ≡ X
  • AL ≡ Henry answers AL ≡ AL

= (3.2) symmetry: p ≡ q ≡ q ≡ p, twice Henry answers AL Raymond Smullyan posed many puzzles about an island that has two kinds of inhabitants: knights, who always tell the truth, and knaves, who always lie. You encounter two people A and B. What are A and B if

1

A says “We are both knaves.”?

2

A says “At least one of us is a knave.”?

3

A says “If I am a knight, then so is B.”?

4

A says “We are of the same type.”?

5

A says “B is a knight” and B says “The two of us are opposite types.”? You encounter two people A and B. What are A and B if

4

A says “We are of the same type.”? AV : A is a knave Axiom: AV ≡ A says X ≡ ¬X AV ≡ A says (AV ≡ BV) ≡ ¬(AV ≡ BV) = (3.2) symmetry of ≡ A says (AV ≡ BV) ≡ AV ≡ ¬(AV ≡ BV) = (3.9) ¬(p ≡ q) ≡ ¬p ≡ q A says (AV ≡ BV) ≡ AV ≡ AV ≡ ¬BV = (3.2) symmetry of ≡: p ≡ q ≡ q ≡ p A says (AV ≡ BV) ≡ ¬BV

Avoid Repetition in Proofs!

(3.22) Principle: Structure proofs to avoid repeating the same subexpression on many lines. Textbook, p. 48 You encounter two people A and B. What are A and B if

4

A says “We are of the same type.”? AV : A is a knave Axiom: AV ≡ A says X ≡ ¬X A says X ≡ AV ≡ ¬X A says (AV ≡ BV) =

  • Def. “says”

AV ≡ ¬(AV ≡ BV) = (3.9) ¬(p ≡ q) ≡ ¬p ≡ q AV ≡ AV ≡ ¬BV = (3.2) symmetry of ≡: p ≡ q ≡ q ≡ p ¬BV

slide-4
SLIDE 4

Inequivalence Theorems

(3.16) Symmetry of ≡: (p ≡ q) ≡ (q ≡ p) (3.17) Associativity of ≡: ((p ≡ q) ≡ r) ≡ (p ≡ (q ≡ r)) (3.18) Mutual associativity: ((p ≡ q) ≡ r) ≡ (p ≡ (q ≡ r)) (3.19) Mutual interchangeability: p ≡ q ≡ r ≡ p ≡ q ≡ r

(3.23) Heuristic of Definition Elimination

To prove a theorem concerning an operator ◦ that is defined in terms of another, say •, expand the definition

  • f ◦ to arrive at a formula that contains •; exploit prop-

erties of • to manipulate the formula, and then (possibly) reintroduce ◦ using its definition. Textbook, p. 48

“Unfold-Fold strategy” Inequivalence Theorems: Symmetry

(3.16) Symmetry of ≡: (p ≡ q) ≡ (q ≡ p) Proving (3.16) Symmetry of ≡: p ≡ q = (3.10) Definition of ≡ — Unfold

  • ¬(p ≡ q)

= (3.2) Symmetry of ≡ ¬(q ≡ p) = (3.10) Definition of ≡ — Fold

  • q ≡ p

5

A says “B is a knight” and B says “The two of us are opposite types.”? P says X ≡ PH ≡ X A says BH =

  • Def. “says”

AH ≡ BH B says (AH ≡ BH) =

  • Def. “says”

BH ≡ (AH ≡ BH) = (3.14) (p ≡ q) ≡ ¬p ≡ q BH ≡ ¬AH ≡ BH = symmetry of ≡: p ≡ q ≡ q ≡ p ¬AH = idempotency of conjunction ¬AH ∧ ¬AH = Above: “A says BH” ¬AH ∧ ¬BH

(3.21) Heuristic

Identify applicable theorems by matching the structure of expressions or subexpressions. The operators that appear in a boolean expression and the shape of its subexpres- sions can focus the choice of theorems to be used in ma- nipulating it. Obviously, the more theorems you know by heart and the more practice you have in pattern matching, the easier it will be to develop proofs. Textbook, p. 47