Lecture07 PDF
Lecture07 PDF
Quantifiers only act on free variables of the formula • So far we’ve considered:
they quantify – How to understand and express things using
∀ x (∃ y (P(x,y) → ∀ x Q(y, x))) propositional and predicate logic
– How to compute using Boolean (propositional) logic
De Morgan’s Laws – How to show that different ways of expressing or
computing them are equivalent to each other
¬∀x P(x) ≡ ∃x ¬ P(x)
¬ ∃x P(x) ≡ ∀x ¬ P(x) • Logic also has methods that let us infer implied
properties from ones that we know
– Equivalence is a small part of this
∀ ↔ ∧ ∧ ∧⋯
∃ ↔ ∨ ∨ ∨⋯
proofs review: an inference rule--- Modus Ponens
• Start with hypotheses and facts • If p and p → q are both true then q must be true
• Use rules of inference to extend set of facts
• Result is proved when it is included in the set • Write this rule as p, p → q
∴ q
• Given:
Fact 2 Statement
– If it is Wednesday then you have a 311 class today.
Hypothesis 1
Fact 1 – It is Wednesday.
Hypothesis 2 Statement Result
Hypothesis 3
• Therefore, by modus ponens:
– You have a 311 class today.
Show that r follows from p, p → q, and q → r Show that ¬p follows from p → q and ¬q
1. p given 1. p→q given
2. p→q given 2. ¬q given
3. q→r given 3. ¬q→¬p contrapositive of 1
4. q modus ponens from 1 and 2 4. ¬p modus ponens from 2 and 3
5. r modus ponens from 3 and 4
inference rules simple propositional inference rules
• Each inference rule is written as: Excluded middle plus two inference rules per binary
A, B
...which means that if both A and B connective, one to eliminate it and one to introduce it
are true then you can infer C and
∴ C,D
you can infer D. p∧q p, q
– For rule to be correct (A ∧ B) → C and ∴ p, q ∴p∧q
(A ∧ B) → D must be a tautologies
p ∨ q , ¬p p
• Sometimes rules don’t need anything to start with. ∴q ∴ p ∨ q, q ∨ p
These rules are called axioms:
– e.g. Excluded Middle Axiom p, p → q p⇒q Direct Proof Rule
∴ p ∨¬p ∴ q ∴p→q Not like other rules
• Inference rules only can be applied to whole • The direct proof rule:
formulas (not correct otherwise). If you have such a proof then you can conclude
e.g. 1. p → q given that p → q is true
2. (p ∨ r) → q intro ∨ from 1. proof subroutine
Example: 1. p assumption
2. p ∨ q intro for ∨ from 1
Does not follow! e.g . p=F
F, q=F
F, r=TT
3. p → (p ∨ q) direct proof rule
proofs using the direct proof rule example
1. q given
2. (p ∧ q) → r given
3. p assumption
4. p ∧ q from 1 and 3 via Intro ∧ rule
5. r modus ponens from 2 and 4
6. p → r direct proof rule
* in the domain of P
proofs using quantifiers even and odd Even(x) ≡ ∃y (x=2y)
Odd(x) ≡ ∃y (x=2y+1)
Domain: Integers
“There exists an even prime number”
Prove: “The square of every even number is even.”
Formal proof of: ∀x (Even(x) → Even(x2))
even and odd Even(x) ≡ ∃y (x=2y) proof by contradiction: one way to prove ¬p
Odd(x) ≡ ∃y (x=2y+1)
Domain: Integers If we assume p and derive False (a contradiction),
then we have proved ¬p.
Prove: “The square of every odd number is odd”
English proof of: ∀x (Odd(x)→Odd(x2))
1. p assumption
Let x be an odd number. ...
Then x=2k+1 for some integer k (depending on x) 3. F
Therefore x2=(2k+1)2= 4k2+4k+1=2(2k2+2k)+1. 4. p → F direct Proof rule
Since 2k2+2k is an integer, x2 is odd. 5. ¬p ∨ F equivalence from 4
6. ¬p equivalence from 5
even and odd Even(x) ≡ ∃y (x=2y) rational numbers
Odd(x) ≡ ∃y (x=2y+1)
Domain: Integers • A real number x is rational iff there exist integers
p and q with q≠0 such that x=p/q.
Prove: “No number is both even and odd”
English proof: ¬ ∃x (Even(x)∧Odd(x)) Rational(x) ≡ ∃p ∃q ((x=p/q) ∧ Integer(p) ∧ Integer(q) ∧ q≠0)
≡∀x ¬(Even(x)∧Odd(x))
• Prove: If x and y are rational then xy is rational
Let x be any integer and suppose that it is both even
and odd. Then x=2k for some integer k and x=2n+1 for ∀x ∀y ((Rational(x) ∧ Rational(y)) → Rational(xy))
some integer n. Therefore 2k=2n+1 and hence k=n+½.
But two integers cannot differ by ½ so this is a
contradiction.
Domain: Real numbers
• A real number x is rational iff there exist integers • A real number x is rational iff there exist integers
p and q with q≠0 such that x=p/q. p and q with q≠0 such that x=p/q.
Rational(x) ≡ ∃p ∃q ((x=p/q) ∧ Integer(p) ∧ Integer(q) ∧ q≠0) Rational(x) ≡ ∃p ∃q ((x=p/q) ∧ Integer(p) ∧ Integer(q) ∧ q≠0)
• Prove: • Prove:
– If x and y are rational then xy is rational – If x and y are rational then xy is rational
– If x and y are rational then x+y is rational – If x and y are rational then x+y is rational
– If x and y are rational then x/y is rational
counterexamples proofs
To disprove ∀x P(x) find a counterexample: • Formal proofs follow simple well-defined rules and
– some c such that ¬P(c)
should be easy to check
– In the same way that code should be easy to execute
– works because this implies ∃x ¬P(x) which is equivalent
to ¬∀x P(x)
• English proofs correspond to those rules but are
designed to be easier for humans to read
– Easily checkable in principle