You are on page 1of 80

CS 114: Discrete Structures

LOGIC AND PROOF (PART2)

1
Propositional logic
(In Book: Chapter 1-sec 1.1)

2
Propositional Logic

 The rules of logic are used to distinguish between valid and


invalid mathematical arguments.
 Logic has many applications to computer science.
 Ex:
 Computer circuits.
 Construction of computer programs.

3
Propositions
 The basic building blocks of logic.
 It is a declarative sentence that is either True or False, but not both.

Example 1 1) Example 2
1) Riyadh is the capital of Saudi 1) What time is it?
Arabia. 2) Read this carefully.
2) Cairo is the capital of Lebanon. 3) x+1=2
3) 1+1=2 4) x+y=z
4) 2+2=3

All declarative sentences are Not propositions


propositions 1,2 not declarative sentences
T – F –T – F 3,4 neither true or nor false
4
Propositions

 We use letters to denote propositional variables that is used to


represent propositions, just as letters used to denote numerical
variables.
 The conventional letters used for propositions variables are p, q,
r, s…
 The truth value if the proposition is true  T
 The truth value if the proposition is false F
 The area of logic that deals with proposition is called the
proposition calculus or propositional logic.

5
Propositions

 There are a methods for producing new propositions from those


what we have.
 Many mathematical statement are constructed by combining one
or more propositions (compound propositions) using logical
operators.

6
Negation of a proposition

Definition :
Let p be a proposition. The negation of p, denoted by p, is the
statement “it is not the case that p”.
 The proposition p is read “NOT p”
 Negation construct a new proposition from a single existing
proposition.
 The truth table for the negation of a proposition.
p p
Notice that p is a F T
proposition! T F
7
Negation of a proposition

Example :
Find the negation of the proposition
“Sara’s pc runs Linux” and express this in simple English.

Solution:
Negation is: “it is not the case that Sara’s pc runs Linux”
More simply: “Sara’s pc does not run Linux”

8
Negation of a proposition

Example :
Find the negation of the proposition
“Ahmad’s smart phone has at least 32 GB of memory” and express this
in simple English.

Solution:
Negation is: “Ahmad’s smart phone does not have at least32 GB of
memory”
More simply: “Ahmad’s smart phone has less than 32 GB of memory”

9
Logical connectives

10
Conjunction of propositions

Definition :
Let p and q be propositions. The conjunction of p and q, denoted
by pq, is the proposition “p and q”. The conjunction pq is true
when both p and q are true, and is false otherwise.
 The truth table for the conjunction of two proposition.

p q pq
T T T
Notice that conjunction T F F
can be between two or F T F
more propositions
F F F
11
Conjunction of propositions
Example :
Find the conjunction of the propositions p and q,
where p is the proposition “Ahmad’s pc has more than 16
GB free hard disk space”
and q is the proposition “The processor in Ahmad’s pc runs
faster than 1 GHz” express this in simple English.

Solution:
Ahmad’s pc has more than 16 GB free hard disk space and The
processor in Ahmad’s pc runs faster than 1 GHz.

To be true, both conditions given must be true. It is false when


one or both are false
12
Disjunction of propositions

Definition:
Let p and q be propositions. The disjunction of p and q, denoted by
p  q, is the proposition “p or q”. The conjunction p  q is false
when both p and q are false, and is true otherwise.
 The truth table for the disjunction of two proposition.

p q pq
Notice that disjunction T T T
can be between two or T F T
more propositions
F T T
F F F
13
Disjunction of propositions
Example :
Find the disjunction of the propositions p and q,
where p is the proposition “Ahmad’s pc has more than 16
GB free hard disk space”
and q is the proposition “The processor in Ahmad’s pc runs
faster than 1 GHz” express this in simple English.

Solution:
Ahmad’s pc has more than 16 GB free hard disk space orThe
processor in Ahmad’s pc runs faster than 1 GHz.
When it will be true? False?

14
Exclusive-OR of propositions

Definition:
Let p and q be propositions. The exclusive or of p and q, denoted
by p ⊕ q, is the proposition that is true when exactly one of p
and q is true and is false otherwise.
 The truth table for the exclusive or of two proposition.

p q p⊕q
T T F
Notice it can be between T F T
two or more propositions
F T T
F F F
15
Conditional Statement (Implication)
Definition:
Let p and q be propositions. The conditional statement (implication)
p  q is the proposition “if p, then q”. The conditional statement
p  q is false when p is true and q is false, otherwise true.
 In the conditional statement p  q, p is called the hypothesis or
(antecedent or premise) and q is called the conclusion or
(consequence).
 Comes in format:
 If p, then q
 If p, q
 p is sufficient for q
 p implies q
…
you will find rest of them in book. Look at them! 16
Conditional Statement (Implication)
 The truth table for the implication of two proposition.

p q p q
T T T
T F F
F T T
F F T

Ex:
“If you get 100% on the final, then you will get an A”.
Hypothesis Conclusion

17
Conditional Statement (Implication)
Example:
Hypothesis Conclusion
If Juan has a smart phone, then 2+3 = 5
 This proposition is true, because conclusion is true.

If Juan has a smart phone, then 2+3 = 6


 This proposition is true, if Juan does not have a smart
phone even though 2+3=6 is false.

There are no relation between hypothesis and conclusion.


In programming we have if-then.
18
Conditional Statement (Implication)
Example:
Let p the statement “Maria learns discrete mathematics” and
q the statement “ Maria will find job”
Express the statement p  q as a statement in English.

Solution:
 If Maria learns discrete mathematics, then she will find job.
 Maria will find job when she learns discrete mathematics.
Rest example in book page 7
When it will be true? False?

19
Converse, Contrapositive and Inverse

 We can form some new conditional statements starting with


a conditional statement p → q. In particular, there are three
related conditional statements that occur so often that they
have special names: converse, contrapositive and inverse.

20
Converse, Contrapositive and Inverse
 Converse: q  p is converse of p  q.
 Ex.: p  q: “If it is noon, then I am hungry.”
q  p: “If I am hungry, then it is noon.”

 Contrapositive: q  p is contapositive of p  q.
 Ex.: q  p: “If I am not hungry, then it is
not noon.”

 Inverse: p  q is inverse of p  q.
 Ex.: p  q: “If it is not noon, then I am not
hungry.”
See
p  q has same truth values as q  p example 7
21
Biconditional Statement

p q
T T T
T F F
F T F
F F T
22
Biconditional Statement

23
Implicit use of Biconditional Statement

 Not always explicit in natural language.


 Often expressed using an “if, then” or “only, if ”
 Converse is implied but not stated.
Ex:
“if you finish your meal, then you can have dessert”

Means
“You can have dessert if and only if you finish your meal”

24
Truth Table of Compound Proposition

 Used to build up complicated compound positions involving


any numbers of propositional variables.
 Construct truth table for (p  q) → (p  q).
p q q p  q p  q (p  q) → (p  q)
F F T T F F
T F T T F F
F T F F F T
T T F T T T

# of raws = 2 # of variable

25
Well-formed formula

26
Well-formed formula

Operator Precedence
1
2
3
4
5

27
Logic and Bit Operations

 Bit: A bit is a symbol with two possible values, namely, 0


(zero) and 1 (one).
 A bit can be used to represent a truth value as (1 for T) and (0
for F)
 Bit string: A bit string is a sequence of bits. The length of the
string is number of bits in the string.
 Example: 10101001 is a bit string of length eight
 We define the bitwise OR, AND, and XOR of two strings of
same length to be the strings that have as their bits the OR,
AND, and XOR of the corresponding bits in the two strings,
respectively.
 We use the symbols , , and ⊕ to represent bitwise OR,
AND, and XOR, respectively.
28
Logic and Bit Operations

Truth table for bitwise OR, AND, and XOR:


xy xy x⊕y
x y

0 0 0 0 0
0 1 1 0 1
1 0 1 0 1
1 1 1 1 0

Example 13
Find bitwise OR, AND, and XOR of the bit strings:
0110110110 and 1100011101

29
Propositional Logic – Translating English Sentences

 The sentence “The automated reply cannot be sent when the file
system is full” can be translated as
q → p
where p: “The automated reply can be sent ”
q: “The file system is full”
 The sentence “You cannot drive a car if you are under 4 feet tall
unless you are older than 16 years old” can be translated as
(q r) → p
where p: “You can drive a car ”
q: “You are under 4 feet tall ”
r: “You are older than 16 years old”

30
Propositional Logic – Translating English Sentences

 The sentence “You can access the Internet from campus only if you
are a computer science major or you are not a freshman” can be
translated as
p → (q  r)
where p: “You can access the Internet from campus”
q: “You are a computer science major”
r: “You are a freshman”
 Q4: Translate the following sentences into logical expressions:
 “Access is granted whenever the user has paid the subscription
fee and enters a valid password”
 “If the user has not entered a valid password but has paid the
subscription fee, then access is granted”

31
Propositional
Equivalences
(In Book: Chapter 1-sec 1.3)

32
1.3 Propositional Equivalences

Definition
A compound proposition that is always true, no matter what the truth
values of the propositions that occurs in it, is called a tautology.
A compound proposition that is always false is called a contradiction.
A compound proposition that is neither a tautology or a contradiction is
called a contingency.

p p p  p p  p
F T T F
T F T F

33
Logic Equivalence

Example:
Show that ¬(p ν q) and p  q are logically equivalent.
De Morgan laws
p q p  q (p  q) p q p  q
F F F T T T T
T F T F F T F
F T T F T F F
T T T F F F F
34
Logic Equivalence
Equivalence Name
p Λ T  p and p ν F  p Identity laws
p ν T  T and p Λ F  F Domination laws
p ν p  p and p Λ p  p Idempotent laws
¬( ¬ p)  p Double negation law
p ν q  q ν p and p Λ q  q Λ p Commutative laws
(p ν q) ν r  p ν (q ν r) and (p Λ q) Λ r  p Λ (q Λ
Associative laws
r)
p  (q  r)  (p  q)  (p  r)
Distributive laws
p  (q  r)  (p  q)  (p  r)
¬(p ν q)  ¬p Λ ¬q and ¬(p Λ q)  ¬p ν ¬q De Morgan’s laws
p  (p  q)  p and p  (p  q)  p Absorption laws

35 p ν ¬p  T and p Λ ¬p  F Negation laws


Logic Equivalence

36
Predicates and
Quantifiers
(In Book: Chapter 1-sec 1.4)

37
Limitation of propositional logic
 Propositional logic cannot adequately express the meaning of all statements in
mathematics and in natural language.
 For example, suppose that we know that:
“Every computer connected to the university network is functioning properly.”
 No rules of propositional logic allow us to conclude the truth of the
statement:
“MATH3 is functioning properly”
where MATH3 is one of the computers connected to the university network.
 Likewise, if CS2 is a computer on the university network and the statement is:
“CS2 is under attack by an intruder,”
No rules of propositional logic allow us to conclude the truth of
“There is a computer on the university network that is under attack by an intruder.”
38
Limitation of propositional logic

 Predicate logic can be used to express the meaning of a wide

range of statements in mathematics and computer science in ways


that permit us to reason and explore relationships between objects.

39
Predicates
• The following statements with unspecified variables are not propositions:
“x > 3”
“x = y + 3”
“computer x is functioning properly”
“computer x is under attack by an intruder”

• This section discusses how proposition can be produced from such


statements that are neither true nor false with unspecified vairables.

40
Predicates
 The statement “x > 3” has two parts:

• the variables x, the subject of the statement

• is greater than 3, the predicate, refers to the property that the subject of
the statement can have.

 We denote “x > 3” by P(x), where P denotes the predicate “is greater than 3”
and x is the variable

 Once we assign a value to x, it becomes proposition and has a truth value.

41
Predicates
Definition
A predicate, or propositional function, is a function that takes some
variable(s) as arguments and returns True or False.

Example1: Let P(x) = “x > 3”, what are the truth values of P(2) and P(4)?
Sol: P(2) = “2 > 3” is false and P(4) = “4 > 3” is true
Example3: Let Q(x, y) = “x = y + 3”, what are the truth values of Q(1, 2) and Q(3, 0)?
Sol: Q(1,2)= “1=2+3” is false, Q(3,0)= “3=0+3” is true

Definition
A statement of the form P(x1, x2, …., xn) is the value of the propositional
function P at the n-tuple (x1, x2, …., xn), and P is called n-ary predicate
42
Predicates
Example:
Let A(c,n) denote the statement “Computer c is connected to network n”,
where:
• c is a variable representing a computer, and
• n is a variable representing a network.
Suppose that the computer MATH1 is connected to network CAMPUS2, but
not to network CAMPUS1.
What are the values of A(MATH1, CAMPUS1) and A(MATH1, CAMPUS2)?

sol:
– A(MATH1, CAMPUS1) – “MATH1 is connect to CAMPUS1”, false
– A(MATH1, CAMPUS2) – “MATH1 is connect to CAMPUS2”, true

43
Predicates
Example: Consider the statement
if x > 0 then x := x + 1.
Here P(x) = “x > 0”.
• If P(x) is true for the value of x, then the assignment statement x :=
x + 1 is executed, x is increased by 1.
• If P(x) is false for the value of x, then the assignment statement is
not executed, x remains same
 The statements that describe valid input are known as preconditions,
and the conditions that the output should satisfy when it has run are
known as postconditions

Example: Let R(x, y, z) = “x + y = z”, what are the truth values of R(1,
2, 3) and R(0, 0, 1)? 44
Quantifiers

 Another way of changing a predicate into a proposition is called


quantification
 In English, the words: all, some, many, none, and few are used in
quantifications
 Two types of quantifications:
• Universal quantifications – a predicate is true for every element
under consideration
• Existential quantifications – there is one or more element under
consideration for which predicate is true
 The area of logic that deals with predicates and quantifiers is called
predicate calculus

45
Universal Quantifiers

 Definition:
The universal quantification of P(x) is the statement “P(x) for all values
of x in the domain”. The notation x P(x) denotes the universal
quantification of P(x). Here  is called universal quantifier. An element
for which P(x) is false is called a counterexample of x P(x).
 Quantifiers:

Statement When True? When False?


x P(x) P(x) is true for every x There is an x for which
P(x) is false
 x P(x) There is an x for which P(x) is P(x) is false for every x
true
46
Universal Quantifiers

 Example: Let P(x) = “x+1 > x”. What is the truth value of the
quantification x P(x), where the domain consists of all real
numbers?
 Sol: Because P(x) is true for all real numbers x, the quantification
x P(x) is true.

 Example: Let Q(x) = “x < 2”. What is the truth value of the
quantification x Q(x), where the domain consists of all real
numbers?
 Sol: Because Q(x) is not true for every real number x, because, for
instance, Q(3) is false. That is, x=3 is a counterexample for the
statement x Q(x).
47
Universal Quantifiers

 Q8: Let P(x) = “x2 > 0”. What is the truth value of the
quantification x P(x), where the domain consists of all real
numbers?

 Q9: Let Q(x) = “x2 < 10”. What is the truth value of the
quantification x Q(x), where the domain consists of positive
integers less than 4?

 Q10: Let R(x) = “x2 ≥ x”. What is the truth value of the
quantification x R(x), where the domain consists of all real
numbers? What is the truth value of the quantification if the domain
consists of all integers?
48
Existential Quantifiers

 Definition: The existential quantification of P(x) is the statement


“There exists an element x in the domain such that P(x)”. The
notation  x P(x) denotes the existential quantification of P(x).
Here  is called existential quantifier.

 Example: Let P(x) = “x > 3”. What is the truth value of the
quantification x P(x), where the domain consists of all real
numbers?
 Sol: Because P(x) is sometimes true - for instance, when x=4 – the
existential quantification of P(x), which is x P(x), is true.

49
Existential Quantifiers

 Example: Let P(x) = “x = x+1”. What is the truth value of the


quantification  x P(x), where the domain consists of all real
numbers?
 Sol: Because P(x) is false for every real number x, the quantification
 x P(x) is false.

 Q11: Let Q(x) = “x2 > 10”. What is the truth value of the
quantification  x Q(x), where the domain consists of positive
integers not exceeding 4?
 Q12: Let R(x) = “x2 ≥ x”.What is the truth value of the
quantification  x R(x), where the domain consists of all real
numbers? What is the truth value of the quantification if the domain
consists of all integers?
50
Quantifiers with Restricted Domain
 Example
What do the statements x < 0(x2 > 0), y≠0(y3 ≠ 0), and z > 0(z2 = 2) mean,
where the domain in each case consists of all real numbers?

 Sol: The statement x < 0(x2 > 0) states that for every number x with x < 0,
x2 > 0. That is, it states “The square of a negative real number is positive”.The
statement is the same as x (x < 0 → x2 > 0).

The statement y ≠ 0(y3 ≠ 0) states that for every real number y with
y ≠ 0, we have y3 ≠ 0. That is, it states “The cube of every nonzero real is nonzero”.The
statement is the same as y (y ≠ 0 → y3 ≠ 0).

Finally, the statement z > 0(z2 = 2) states that there exist a real number z with z > 0
such that z2=2. That is, it states “There is positive square root of 2”. The statement is
the same as z (z > 0 ⌃z2 = 2).
51
Quantifiers with Restricted Domain

 Note:The restriction of a universal quantification is the same as the


universal quantification of a conditional statement. For instance, x
< 0(x2 > 0) is another way of expressing x (x < 0 → x2 > 0).

 On the other hand, the restriction of an existential quantification is


the same as the existential quantification of a conjunction. For
instance, z>0(z2=2) can be expressed as z (z > 0 ⌃ z2 = 2).

52
Precedence of Quantifiers

 The quantifiers  and  have higher precedence then all logical


operators from propositional calculus.

 For example, x P(x) v Q(x) is the disjunction of x P(x) and


Q(x).

In other words, it means

(x P(x)) v Q(x) rather than x (P(x) v Q(x))

53
Binding variables

 When a quantifier is used on the variable x, we say that this


occurrence of the variable is bound.

 An occurrence of a variable that is not bound by a quantifier or set


equal to a particular value is said to be free.

 The part of a logical expression to which a quantifier is applied is


called the scope of this quantifier.

54
Binding variables

 Example:
• x ( x+y=1)
• x is bound by existential quantification x
• y is free because it is not bound by a quantifier and no value is
assigned to this variable.

• x (P(x)  Q(x)) v x R(x)


• all variables are bound
• The scope of x is the expression P(x)  Q(x)
• The scope of x is the expression R(x)
• It is the same if we rewrite it like
• x (P(x)  Q(x)) v y R(y)
55
Negating Quantified Expression

 Example : x P(x) means “P(x) is true for every x”.


What about x P(x) ?

 Sol: x P(x) = Not [“P(x) is true for every x.”]


=> “There is an x for which P(x) is not true.”
=> x P(x)
So, x P(x) is logically equivalent to x P(x).

57
Negating Quantified Expression

 Example: x P(x) means “P(x) is true for some x”.


What about x P(x) ?

 Sol: x P(x) = Not [“P(x) is true for some x.”]


=> “P(x) is not true for all x.”
=> x P(x)
So, x P(x) is logically equivalent to x P(x).

58
Negating Quantified Expression

 De Morgan’s laws for quantifiers:

Negation Equivalent When is Negation When False?


Statement True?
 x P(x) x P(x) For every x, There is an x for
P(x) is false which P(x) is
true
x P(x)  x P(x) There is an x for
which P(x) is false P(x) is true for
every x

59
Negating Quantified Expression
 Example 20:What are the negations of the statements “There is a
religious man” and “All Saudi eat Rice”?

Sol: Let P(x) = “x is a religious”,


=> “There is a religious man”= xP(x), where the domain consists of
all men
Now, xP(x) = xP(x) =“Every man is nonreligious”.
Next, let Q(x) = “x eats Rice”
=> “All Saudi eat Rice” = xQ(x), where the domain consists of all
Saudi
Now,  xQ(x) = xQ(x) = “Some Saudis do not eat rice”.

60
Negating Quantified Expression

 Example 21
What are the negations of the statements
x (x2 > x) and x (x2 = 2)”?

 Example 22: Show that x(P(x)Q(x)) and x(P(x)  Q(x))


are logically equivalent.

61
Negating Quantified Expression
 Example26: Let L(x) = “x is a lion”, F(x) = “x is fierce”, and C(x) = “x drinks coffee”.
Show the quantifiers for the statements (i) All lions are fierce, (ii) Some lions don’t
drink coffee, (iii) Some fierce creatures don’t drink coffee.
 Sol: (i) x (L(x)  F(x)), ii) x (L(x)  C(x)), and
(iii) x (F(x)  C(x))
 Example27: Let B(x) = “x is a hummingbird”, L(x) = “x is a large bird”, H(x) = “x lives
on honey”, and R(x) = “x is richly colored”. Show the quantifiers for the statements
(i) All hummingbirds are richly colored = x (B(x)  R(x))
(ii) No large birds live on honey
=  x (L(x)  H(x)) = x(L(x) v H(x))
(iii) Birds that do not live on honey are dully colored
= x ( H(x)   R(x))
(iv) Not all large birds live on honey.
= x (L(x)  H(x))= x (L(x) v H(x))
62
Translating English into Logical Expression

 Example 23: Express the statement “Every student in this class has studied calculus”
using predicates and quantifiers.

 Sol: We rewrite as “For every student in this class, the student has studied calculus”.

=> “For every student x in this class, x has studied calculus”.

Let P(x) = “x has studied calculus”, then our statement is represented by x P(x).
=> “For every person x, if person x is a student in this class, x has studied calculus”.

then our statement is represented by x)S(x)  C(x)(.

Caution: it is not equal to x )S(x)  C(x)(.


63
Translating English into Logical Expression

 Example 24: Express the statements “Some students in this class visited Dubai” and “Every student in
this class has visited either Makah or Medina” using predicates and quantifiers.

 Solution : The statement “Some students in this class visited Dubai” means “there is a student x in this
class with the property that the student has visited Dubai” => x D(x)

 If we interested in people other than those in this class, the statement will be “there is a person x
having the properties that x is a student in this class and x has visited Dubai” = x (S(x)  D(x) )
 The statement “Every student in this class has visited either Makah or Medina” means “For every x in
this class, x has the property that x has visited Makah or x has visited Medina” => x (K(x) v M(x)).
 If we interested in people other than those in this class, the statement will be:

“For every person x, if x is a student in this class then x has visited Makah or x has visited Medina”

=> x (P(x)  (K(x) v M(x))) .


64
Rule of Inference
(In Book: Chapter 1-sec 1.6)

71
Rule of Inference-Valid Arguments in Propositional Logic

 Proofs in mathematics are valid arguments that establish the truth of


mathematical statements.
 Argument: An argument is a sequence of statements that end with a conclusion.
 Valid: it means that the conclusion ( final statement of the argument ) must follow
from the truth of the premises (preceding statements).
 An argument is valid if it is impossible for all the premises to be true and the
conclusion to be false.

 To deduce new statements from statements we already have, we use rules of inference
which are templates for constructing valid arguments.

72
Rules of Inference

 We introduce two main points:


 Arguments that involve only compound propositions, and what it means for
them to be valid..
 A collection of rules of inference in propositional logic.
 Valid Arguments in propositional logic :
“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” (Conclusion)

73
Rules of Inference
To determine whether this is a valid argument , i.e. to determine whether:
 The conclusion q : “You can log onto the network” must be True when :
The premises p  q : “If you have a current password, then you can log onto the
network” is True And p:“You have a current password” is True
p→q
p
q where  is the symbol that denotes “therefore.”

 The statement ((p → q) ⌃p) → q is a tautology


 This form of argument is valid because whenever all its premises are true, the
conclusion must also be true.
 Note that whenever we replace p and q by propositions where p → q
and p are both true, then q must also be true.
74
Rules of Inference
 What happens when we replace p and q in this argument form by propositions
where not both p and p → q are true?
 Example : Suppose that:
p :“You have access to the network”
q:“You can change your grade”
and that p is true, but p → q is false.
The argument we obtain by substituting these values of p and q into the argument form is:

“If you have access to the network, then you can change your grade.”
“You have access to the network.”
∴ “You can change your grade.”

The argument we obtained is a valid argument, but because one of the premises, namely
the first premise, is false, we cannot conclude that the conclusion is true.
75
Rules of Inference

 Definition
An argument in propositional logic is a sequence of propositions. All but the final
proposition in the argument are called premises and the final proposition is called the
conclusion. An argument is valid if the truth of all its premises implies that the
conclusion is true.
An argument form in propositional logic is a sequence of compound propositions
involving propositional variables. An argument form is valid no matter which
particular propositions are substituted for the propositional variables in its premises,
the conclusion is true if the premises are all true.

76
Rules of Inference for Propositional Logic

 We can always use a truth table to show that an argument form is valid by showing that
whenever the premises are true, the conclusion must also be true
if we have an argument form involves 10 different propositional variables

By using truth table  210 = 1024 rows

it is tedious approach

How we can show that this argument form is valid ?

 Instead of showing by truth table, we can establish the validity of some relatively simple argument
forms, called rules of inference, which can be used as building blocks to construct more complicated valid
argument forms.
77
Rules of Inference for Propositional Logic

 The tautology (p ∧ (p → q)) → q is the basis of the rule of inference called


modus ponens or law of detachment
 This tautology leads to the following valid argument form:
p
p→q
q

 Example : Suppose that the conditional statement


“If it snows today, then we will go skiing ” and its hypothesis “ It snows today ” are True.
Then, by modus ponens, it follows that the conclusion of the conditional statement “We will
go skiing ” are True.

78
Rules of Inference for Propositional Logic
 Example : Determine whether the argument given here is valid and determine whether
its conclusion must be true because of the validity of the argument.
2
3 3 3
" If 2  , then ( 2 )    . We know that
2
2 .
2 2 2
p q 2
3 9
Consequently, ( 2 )  2     ."
2

2 4
 Solution
The premises of the argument are : p → q and p while q is its conclusion
This argument is valid because it is constructed by using modus ponens, a valid
argument form. Since premises (p → q) ^ p are false, therefore the conclusion q is also
false because
79
Rule of Inference Tautology Name
p (p ∧ (p → q)) → q Modus ponens
p→q
∴q 80
¬q (¬ q ∧ (p → q))→¬ p Modus tollens
p→q
∴ ¬p
p→q ((p → q) ∧ (q → r)) → (p → r) Hypothetical syllogism
q→r
∴p→r
p∨q ((p ∨ q)∧¬ p) → q Disjunctive syllogism
¬p
∴q
p p → (p ∨ q) Addition
∴p∨q

p∧q (p ∧ q) → p Simplification
∴p

p ((p) ∧ (q)) → (p ∧ q) Conjunction


q
∴p∧q
p∨q ((p ∨ q) ∧ (¬ p ∨ r)) → (q ∨ r) Resolution
¬p ∨ r
∴q∨r 80
Rules of Inference 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”

 Solution: Let p be the proposition “It is below freezing now”


and q the proposition “It is raining now”
Then this argument is of the form:

p
 p∨q

This is an argument that uses the addition rule.

81
Rules of Inference for Propositional Logic

 Example : State which rule of inference is the basis of the following


argument:
“It is below freezing and raining now. Therefore, it is below freezing now”

 Solution: Let p be the proposition “It is below freezing now”


and q the proposition “It is raining now”
Then this argument is of the form:
p˄q
p

This is an argument that uses the simplification rule.

82
Rules of Inference for Propositional Logic

 Example : State which rule of inference is the basis of the following argument:
“If it rains today, then we will not have a barbecue today. If we do not have a barbecue today, then
we will have a barbecue tomorrow. Therefore, if it rains today, then we will have a barbecue tomorrow.”

 Solution: Let p be the proposition “It is raining today”


Let q the proposition “We will not have a barbecue today”
and r the proposition “We will have a barbecue tomorrow”
Then this argument is of the form:
p→q
q→r
p→r
Hence, this argument is a hypothetical syllogism.

 Example: What rule of inference is used in the following argument :


“ Alice is a mathematics major. Therefore Alice is either a mathematics major or a computer science major
83
Rules of Inference for Propositional Logic

 When there are many premises, several rules of inference are often needed to show that

an argument is valid.

 Example : Show that the hypotheses :


“it is not sunny this afternoon and it is colder than yesterday ,”
“we will go swimming only if it is sunny,”
“if we do not go swimming, then we will take a canoe trip ,” “and
“if we take a canoe trip, we will be home by sunset.”
lead to the conclusion “ We will be home by sunset”

84
Rules of Inference for Propositional Logic

 SOLUTION
 Let p: “it is sunny this afternoon”

q: “it is colder than yesterday”

r: “we will go swimming”

s: “we will take a canoe trip”

t: “we will be home by sunset”

The hypotheses become

p ^ q, r  p,  r  s, s  t

the conclusion is t

85
Rules of Inference for Propositional Logic

 We construct an argument to show that our hypotheses lead to desired conclusion as follows

Step Reason
1. p^q Hypothesis
2. p Simplification using (1)
3. rp Hypothesis
4. r Modus tollens (2,3)
5. rs Hypothesis
6. s Modus ponens (4,5)
7. st Hypothesis
8. t Modus ponens (6,7)

Note:
that if we used the truth table, we would end up with 32 rows ( 2^5 = 32) !!!
86
Rules of Inference for Propositional Logic

 Example :

Show that the premises “ If you send me an email message, then I will finish writing
the program, “ “ If you do not send me an email message, then I will go to sleep
early” , and “ If I go to sleep early, then I will wake up feeling refreshed” lead to the
conclusion “ If I do not finish writing the program, then I will wake up feeling
refreshed”

87

You might also like