Propositional Calculus – Methods of Proof Predicate Calculus Math Foundations of Computer Science.

20
Propositional Calculus – Methods of Proof Predicate Calculus Math Foundations of Computer Science

Transcript of Propositional Calculus – Methods of Proof Predicate Calculus Math Foundations of Computer Science.

Page 1: Propositional Calculus – Methods of Proof Predicate Calculus Math Foundations of Computer Science.

Propositional Calculus – Methods of Proof

Predicate Calculus

Math Foundations of Computer Science

Page 2: Propositional Calculus – Methods of Proof Predicate Calculus Math Foundations of Computer Science.

Math Foundations of Computer Science

2

Propositional Calculus – Methods of Proof

Logic is useful in design theoryAlso useful in reasoning about mathematical

statements:Case AnalysisProof of the contrapositiveProof by contradictionProof by reduction to truth

Page 3: Propositional Calculus – Methods of Proof Predicate Calculus Math Foundations of Computer Science.

Law of Excluded Middle

Handy for Case Analysis:

Can now prove

Page 4: Propositional Calculus – Methods of Proof Predicate Calculus Math Foundations of Computer Science.

Dual of the Excluded Middle

A proposition and its negative can’t be simultaneously trueDoes this jive with the real world?Do we have contradictions in mathematics?

Handy for proofs by Contradiction

Page 5: Propositional Calculus – Methods of Proof Predicate Calculus Math Foundations of Computer Science.

Contrapositive

Example: Prove “If x is greater than 2 and prime, then x is odd”The contrapositive is:“If x is even, then x <= 2 or x is composite”

Propositional logic fails at this point; we need to talk about the meaning of our terms

Page 6: Propositional Calculus – Methods of Proof Predicate Calculus Math Foundations of Computer Science.

6

ContradictionRather than proving E, we assume NOT E,

and look for a contradiction

Example (from previous slide)

We want to prove ab → c(cont.)

a x > 2

b x is prime

c x is odd

Page 7: Propositional Calculus – Methods of Proof Predicate Calculus Math Foundations of Computer Science.

Contradiction - example

So, as assume a b and NOT cDerive a contradiction

Page 8: Propositional Calculus – Methods of Proof Predicate Calculus Math Foundations of Computer Science.

Equivalence by Truth(p ≡ 1) ≡ p

Use the tautologies to reduce the expression to 1

Probably most like the examples we’ve been looking at

Page 9: Propositional Calculus – Methods of Proof Predicate Calculus Math Foundations of Computer Science.

9

Deduction

The use of logic in sequences of statements that constitute a complete proofStart with certain hypotheses (“givens”)Apply a sequence of inference rulesResults in a conclusion

Most familiar to you, from geometry

Page 10: Propositional Calculus – Methods of Proof Predicate Calculus Math Foundations of Computer Science.

Deduction

Given expressions E1, E2, …, Ek as hypotheses, we wish to draw conclusion E, another logical expressionGenerally, none of these is a tautology

Show that E1 ∩ E2 ∩ … ∩ Ek → E

is a tautology

Page 11: Propositional Calculus – Methods of Proof Predicate Calculus Math Foundations of Computer Science.

Deduction – guidelines

Any tautology may be a line in a proofmodus ponens – if E and E→F are lines,

then F may be added as a lineIf E and F are lines in a proof, then we may

add the line E ∩ FIf E and E≡F are lines, the F can be added

Page 12: Propositional Calculus – Methods of Proof Predicate Calculus Math Foundations of Computer Science.

Resolution – a handy inference rule

Based on this tautology:

Just another inference ruleBut a common one

Often used in a deductive proof

Page 13: Propositional Calculus – Methods of Proof Predicate Calculus Math Foundations of Computer Science.

Resolution

Applied to clauses (your hypotheses) (as in deduction)Convert hypotheses into clauses (conjunctive

normal form)Write each clause as a lineUse resolution to write other lines

Page 14: Propositional Calculus – Methods of Proof Predicate Calculus Math Foundations of Computer Science.

Simplifying clauses

Consider a clause as a set of literalsGiven commutativity, associativity and

idempotence of ORRemove duplicate literals:

Page 15: Propositional Calculus – Methods of Proof Predicate Calculus Math Foundations of Computer Science.

Simplifying clauses

Eliminate clauses that have contradictory literals , by the annihilator law of OR

These clauses are equivalent to 1, and are not needed in a proof

Page 16: Propositional Calculus – Methods of Proof Predicate Calculus Math Foundations of Computer Science.

Resolution - example

Given these 2 clauses:

Rearrange terms, and apply resolution

Remove duplicates

Page 17: Propositional Calculus – Methods of Proof Predicate Calculus Math Foundations of Computer Science.

Put Expressions into Conjunctive Normal Form

1. Get rid of all operators but NOT, AND, and OR

NAND and NOR are easily replaced with AND and OR followed by a NOT

2. Apply DeMorgan’s laws to push negations down as far as they will go

Page 18: Propositional Calculus – Methods of Proof Predicate Calculus Math Foundations of Computer Science.

Put Expressions into Conjunctive Normal Form

3. Apply distributive law for OR over AND Push the ORs as low as they’ll go

E.g.

Replace the implication

Push that outer NOT down:

Page 19: Propositional Calculus – Methods of Proof Predicate Calculus Math Foundations of Computer Science.

CNF – Example (cont.)Push the first OR below the first AND

Regroup

Push that OR down over the inner AND

And now you have an expression in CNF

Page 20: Propositional Calculus – Methods of Proof Predicate Calculus Math Foundations of Computer Science.

Resolution Proofs by Contradiction

A more common useStart with both the hypotheses, and the

negation of the conclusionTry to drive a clause w/no literalsThis clause has value 0