0% found this document useful (0 votes)
66 views

Lecture07 PDF

1. The document discusses a lecture on proofs in logic and foundations of computing. It provides examples of direct proofs, proofs using inference rules and quantifiers, and proofs about properties of even, odd, and rational numbers. 2. Key concepts covered include logical inference rules like modus ponens, strategies for direct proofs, using equivalences in proofs, and proof techniques for quantified statements and properties of number classes. 3. Examples walk through proofs that the square of every even number is even, the square of every odd number is odd, and that no number can be both even and odd.

Uploaded by

Imam Suhendar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views

Lecture07 PDF

1. The document discusses a lecture on proofs in logic and foundations of computing. It provides examples of direct proofs, proofs using inference rules and quantifiers, and proofs about properties of even, odd, and rational numbers. 2. Key concepts covered include logical inference rules like modus ponens, strategies for direct proofs, using equivalences in proofs, and proof techniques for quantified statements and properties of number classes. 3. Examples walk through proofs that the square of every even number is even, the square of every odd number is odd, and that no number can be both even and odd.

Uploaded by

Imam Suhendar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

CSE 311: Foundations of Computing announcements

Fall 2013 Reading assignment


Lecture 7: Proofs
– Logical inference
1.6-1.7 7th Edition
1.5-1.7 6th Edition

Homework #2 due today

last time: quantifiers ∀, ∃ review: logical Inference

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.

proofs proofs can use equivalences too

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

important: application of inference rules direct proof of an implication

• You can use equivalences to make substitutions • p ⇒ q denotes a proof of q given p as an


of any sub-formula. assumption

• 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

Show that p → r follows from q and (p ∧ q) → r Prove: ((p → q) ∧ (q → r)) → (p → r)

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

one general proof strategy inference rules for quantifiers

1. Look at the rules for introducing connectives to


see how you would build up the formula you want P(c) for some c ∀x P(x)
to prove from pieces of what is given ∴ P(a) for any a
∴ ∃x P(x)
2. Use the rules for eliminating connectives to break
down the given formulas so that you get the
“Let a be anything*”...P(a) ∃x P(x)
pieces you need to do 1.
∴ ∀x P(x) ∴ P(c) for some special c
3. Write the proof beginning with what you figured
out for 2 followed by 1.

* 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))

Prime(x): x is an integer > 1 and x is not a multiple of any integer strictly


between 1 and x

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

rational numbers rational 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

• Simple proof strategies already do a lot


– Later we will cover a specific strategy that applies to
loops and recursion (mathematical induction)

You might also like