Beruflich Dokumente
Kultur Dokumente
Techniques
1
Rules of Inference – Valid Arguments in
Propositional Logic
Argument: An argument is a sequence of statements
that end with a conclusion.
Valid: An argument is valid if and only if it is
impossible for all premises (preceding statements) to
be true and the conclusion to be false. By valid, we
mean that the conclusion of the argument must follow
from the truth of the premises of the argument.
Consider the arguments:
“If you have a current password, then you can log
onto the network.”
“You have a current password.”
Therefore,
“You can log onto the network.” 2
Rules of Inference – Valid Arguments in
Propositional Logic
The conclusion “You can log onto the network” must
be true when the premises “If you have a current
password, then you can log onto the network” and “You
have a current password” are true.
Let p= “You have a current password.”
and q=“You can log onto the network.” Then the
argument has the form p→q
p
q
4
Rules of Inference – Rules for
Propositional Logic
Example: Suppose that the conditional statement “If
it snows today, then we will go skiing” and its
hypothesis “It is snowing today”, are true. Then by
modus ponens, it follows that the conclusion of the
conditional statement, “We will go skiing” is true.
5
Rules of Inference – Rules for
Propositional Logic
6
Rules of Inference – Rule for
Propositional Logic
Example: State which rule of inference is the basis of
the following argument: “It is below freezing now.
Therefore, it is either below freezing or raining now”.
Sol: Let p= “It is below freezing now.” and q = “It is
raining now.” Then this argument is of the form:
p
p v q
This is an argument that uses the addition rule.
Q2: State which rule of inference is the basis of the
following argument: “It is below freezing and raining
now. Therefore, it is below freezing”.
7
Introduction to Proofs
A theorem is a statement that can be shown to be
true (usually important statement)
Less important theorem sometimes are called
propositions
A proof is a sequence of statements (valid argument)
to show that a theorem is true
The statements to be used in proofs include:
Axioms (statement assumed to be true without
proof)
Ex: If x is positive integer then x+1 is positive integer.
Hypothesis (premises) of the theorem
Previously proven theorems
Rules of inference used to draw conclusions and
to move from one step to another
8
Introduction to Proofs
Axioms
Rules of New theorem
Hypothesis
inference
proven theorems
9
Introduction to Proofs
Example 1: If I have a car (C) I will drive to Makkah
(M). My boss gave me 60,000 (G) or Fired me (F).
If I have 60,000 (H) then I have a car (C). My boss
did not fire me. Therefore I will drive to Makkah
(M).
1. GF Hypothesis
2. F Hypothesis
3. G Disjunctive syllogism rule using 1 and 2
4. GH Axiom
5. H C Hypothesis
6. G C Hypo. syllogism using 4,5
7. C Modus ponens using 3 and 6
8. C M Hypothesis
9. M Modus ponens using 7 and 8
10
Methods of proving theorems:
Direct proofs
A direct proof of a conditional statement pq is
constructed when the first step is the assumption
that p is true; subsequent steps are constructed
using rules of inference, with the final step showing
that q must also be true
In a direct proof, we assume that p is true and use
axioms, definitions, and previously proven theorems,
together with rules of inference, to show that q
must also be true
Def: The integer n is even if there exists an integer
k such that n = 2k, and n is odd if there exists an
integer k such that n = 2k + 1.
11
Methods of proving theorems:
Direct proofs
Example 2: Use a direct proof to show that “if n is
even then n2 is even”
Proof: Assume that n is even (hypothesis)
=> n = 2k where k is integer (definition of even
number)
=> n2 = (2k)2 = 4k2 = 2(2k2) (By squaring)
Since r = 2K2 is integer (Axiom)
=> n2 = 2r is even
Q 3: Use a direct proof to show that “if n is odd
then n2 is odd”
12
Methods of proving theorems:
Proof by contraposition
An indirect proof of a conditional statement p q
is a direct proof of its contraposition q p.
Example 3: Use an indirect proof to show that if a
and b are integers, and (a + b) ≥ 15, then a ≥ 8 or b
≥ 8.
Proof: The contraposition of (a + b ≥ 15) (a ≥ 8) v
(b ≥ 8) is (a < 8) (b < 8) (a + b < 15)
Suppose (a < 8) (b < 8) (hypothesis).
=> (a ≤ 7) (b ≤ 7),
=> (a + b) ≤ 14,
=> (a + b) < 15.
13
Methods of proving theorems:
Proof by contraposition
Example 4: Use an indirect proof to show that “if
n2 is even then n is even”
Proof: The contraposition is “if n is not even then
n2 is not even”
Assume that n is not even i.e., n is odd (hypothesis)
=> n = 2k+1 where k is integer (definition of odd
number)
=> n2 = (2k + 1)2
= 4k2 + 4k + 1
= 2(2k2 + 2k) + 1 = 2r + 1, where r = 2k2 + 2k
Since r is integer (Axiom) => n2 is not even
Q 4: Use an indirect proof to show that “if n is odd
then n2 is odd”
14
Methods of proving theorems:
Proof by contraposition
Example 5: Prove that if n = ab then a n or b n
where a and b are positive integers
Proof: Let p=“an”, q=“bn” and r=“n=ab”
We want to prove that r pq
=> The contraposition is (pq ) r (By
definition)
=> p q r (De Morgan’s law)
Now, assume that an and bn (p q)
=> a.b n.n = n (by multiplying above twos)
=> ab n
=> r
15
Methods of proving theorems:
Vacuous Proofs
Vacuous Proofs: A conditional p q pq
statement p q is TRUE
if p is FALSE. If we can show
that p is False, then we have F F T
a proof, called vacuous proof, F
T
T
F
T
F
of the conditional statement p q T T T
Example 6: Prove that if x2 0 then 1=2 where x is
a real number
Proof: Since x2 0 for every real number then the
implication is vacuously true
Example 7: Prove that if he is alive and he is dead
then the sun is ice cold.
Proof: Since the hypothesis is always false the
implication is vacuously true.
16
Methods of proving theorems:
Trivial Proofs
Trivial Proofs: A conditional p q pq
statement p q is TRUE if q
is TRUE. If we can show that
F F T
q is TRUE, then we have a F T T
T F F
proof, called trivial proof, of T T T
the conditional statement p q
Example 8: Prove that if x=2 then x2 0 for all real
numbers
Proof: Since x2 0 is true then the implication is
trivially true. (we didn’t use the fact x=2)
Q 5: Use a trivial proof to show that if n > 1 then n2
≥ n for all integers
17
Methods of proving theorems:
Proofs by Contradiction
Proof by Contradiction: To prove a proposition p, assume not p
and show a contradiction.
Example 9: Use a proof by contradiction to show that 2 is
irrational
Proof: Let 2 is rational
=> 2 = a/b for some integers a and b (b0) (relatively prime).
(Definition of rational numbers)
=> 2 = a2/b2 (Squaring both sides)
=> 2b2 = a2
=> a2 is even (Definition of even numbers)
=> a is even (a = 2k for some k)
=> 2b2 = a2 = (2k)2 = 4k2
=> b is even (Definition of even numbers)
But if a and b are both even, then they are not relatively prime!
Hence, 2 is irrational
18
Methods of proving theorems:
Proofs by Contradiction
Why is this method valid ?
The contradiction forces us to reject our assumption because our
other steps based on that assumption are logical and justified. The
only “mistake” that we could have made was the assumption itself.
Be careful!
Sometimes the contradiction comes from a mistake in the steps
of the proof and not from the assumption. This makes the proof
invalid.
Example 10: Prove that 1=2
Proof: Suppose that 21 and a=b for some a.
=> 2b b [multiply by b]
=> a+b b [2b=b+b=a+b by hypothesis]
=> (a-b)(a+b) b(a-b) [multiply by a-b]
=> a2-b2 ab-b2
=> a2 ab [subtract b2 from both sides]
=> a b which contradicts our assumption that a=b
Hence it follows that 1=2
Can you find the error
19
Methods of proving theorems:
Proofs by Contradiction
To prove a conditional statement p q by contradiction
we prove that p q F is true which is equivalent to
pq.
Example 11: Use a proof by contradiction to show that If
3n+2 is odd then n is odd
Proof: Suppose that 3n+2 is odd and n is even [p q]
=> n = 2r [hypothesis q, definition of even numbers]
=> 3n = 6r [multiply 1 by 3]
=> 3n+2=2+6r [add 2 to both sides]
=> 3n+2=2(1+3r)
=> 3n+2=2k [let k=1+3r]
=> Thus 3n+2 is even which is false (a contradiction !)
Therefore the implication is true.
20
Methods of proving theorems:
Proofs of Equivalence
Proofs of Equivalence: To prove p q we have to prove p q
and q p
Example 12: prove “n is even if and only if n2 is even”
“if n is even then n2 is even” proved in example 2
“n2 is even then n is even” proved in example 4
Therefore, n is even if and only if n2 is even
Proving equivalence of several propositions: If we want to prove
that p1 p2 p3 … pn
Then it is sufficient to prove p1 p2,, p2 p3 … pn p1
Disproof by Counterexample
Example 13: Prove that “For all real numbers x2 > x” is false
Proof: X=0.5 is a counterexample since 0.52 > 0.5 is not true
Q 6: Prove that “If n is not positive, then n2 is not positive” is
false
21
Methods of proving theorems:
Proof by Cases
Proof by Cases: A proof by cases must cover all possible cases
that arise in a theorem. Each case may cover an infinite number
of instances
Example 15: Prove "if n is an integer then n2 ≥ n".
Proof: We can prove that n2 ≥ n for every integer by considering
three cases, when n = 0, when n ≥ 1, and when n ≤ -1.
Case 1: When n = 0, since 02 = 0, 02 >= 0. So, n2 ≥ n is true.
Case 2: When n ≥ 1, From n ≥ 1, we get n2 ≥ n (by multiplying with
n).
Case 3: When n ≤ -1, since n is negative, n2 is positive, so n2 ≥ n.
Hence, if n is an integer then n2 ≥ n.
Q 7: Prove that |xy| = |x||y|, where x and y real numbers.
Hint: Consider all 4 cases: x and y positive or negative
Common errors with exhaustive proof and proof by cases:
Draw conclusion from non-exhaustive examples
Not covering all possible cases
22
Methods of proving theorems:
Existence Proofs
Many theorems state that an object with certain properties
exists, i.e., xP(x) where P is a predicate. A proof of such a
theorem is called an existence proof. There are two kinds:
Constructive Existence Proof: The proof is established be
giving example a such that P(a) is true
Example 16: Prove "there is a positive integer that can be
written as the sum of cubes in two different ways.“
Proof: Consider 1729=103+93=123+13. Finding such examples
may require computer assistance.
Non-constructive Existence Proof: The proof is established
by showing that an object a with P(a) is true must exist
without explicitly demonstrating one. Proofs by
contradiction are usually used in such cases.
23
Methods of proving theorems:
Existence Proofs
Example 17: Let x1,x2,..,xn be positive integers such that their
average is m. prove that there exists xi such that xi ≥ m
Proof: Suppose that there is no such number, i,e.,
x1 m, x2 m, … , xn m
By adding these inequalities we get: x1+ x2+…+ xn nm
Dividing by n: (x1+ x2+…+ xn)/n m
But since the average is defined as (x1+ x2+…+ xn)/n
Then we have m m which is a contradiction.
Therefore there must be a number xi such that xi ≥ m. But we
can not specify which number is that.
24
Methods of proving theorems:
Uniqueness Proofs
Some theorems state that there is exactly one element with a
certain property. A proof of such a theorem is called a
uniqueness proof.
Strategy here is (1) show that an element x with the desired
property exists (2) show that any other y (y != x) does not have
the property, i.e., if x and y both have the property, then x
must equal y.
Example 18: Prove that the equation 3x+5 = 9 has a unique
solution.
Proof: (1) There exists a solution namely x = 4/3
(2) Suppose that y and z are solution then
3y+5 = 9 = 3z+5
So 3y = 3z
Dividing by 3 we get y = z
This proves that the solution is unique
25
Proof Strategies
FORWARD REASONING:
–In direct proof of a conditional statement, start with the
premises. Using these premises, together with axioms and
known theorems, you can construct a proof using a sequence
of steps that leads to the conclusion.
–In indirect reasoning start with the negation of the
conclusion and, using a sequence of steps, obtain the negation
of the premises.
–This is often difficult to use to prove more complicated
results.
BACKWARD REASONING:
–To prove a statement q, we find a statement p that we can
prove with the property that p → q.
26
Proof Strategies
Example
–Given two positive real numbers x and y, their arithmetic
mean is (x + y)/2 and their geometric mean is √xy. When we
compare the arithmetic and geometric means of pairs of
distinct positive real numbers, we find that the arithmetic
mean is always greater than the geometric mean. [For
example, when x = 4 and y = 6, we have 5 = (4 + 6)/2 > √4 · 6 =
√24.] Can we prove that this inequality is always true?
27
Proof Strategies
28
Application to PROLOG
Prolog: Programming in Logic
–set of declarations consisting of two types of statements,
Prolog facts (define predicates by specifying the elements
that satisfy these predicates.) and Prolog rules (to define
new predicates using those already defined by Prolog facts).
29
Application to PROLOG
For example, the Prolog facts in such a program might include:
instructor(t1,math273)
instructor(t2,ee222)
instructor(t3,cs301)
enrolled(s1,math273)
enrolled(s2,ee222)
enrolled(s2,cs301)
enrolled(s3,math273)
enrolled(s3,cs301)
A new predicate teaches(p, s), representing that professor p
teaches student s, can be defined using the Prolog rule
teaches(P,S) :- instructor(P,C), enrolled(S,C)
comma is used to represent a conjunction of predicates, a
semicolon is used to represent a disjunction of predicates.
30
Application to PROLOG
Prolog answers queries using the facts and rules it is given. For
example, using the facts and rules listed, the query
?enrolled(s1,math273)
produces the response
yes
because the fact enrolled(s1, math273) was provided as input. The
query
?enrolled(X,math273)
produces the response
s1
s3
To find all the professors who are instructors in classes being
taken by s2, we use the query
31
Application to PROLOG
?teaches(X,s2)
This query returns
t2
t3
32
Resolution Principle
This rule of inference is based on the tautology
33
Resolution Principle
34
Resolution Principle
Conclusion:likes (Ravi, Peanuts)
Negate the conclusion
Resolve using a resolution tree
35