Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
44 views

Lecture 5 - Logic PDF

The document discusses propositional logic and logical connectives. It defines statements, propositions, truth tables, and logical operators such as negation, conjunction, disjunction, conditional, and biconditional. It provides examples of how to determine the truth value of compound statements using these logical connectives and the rules of propositional logic. Key concepts covered include negation, conjunction, disjunction, conditional statements, and truth tables.

Uploaded by

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

Lecture 5 - Logic PDF

The document discusses propositional logic and logical connectives. It defines statements, propositions, truth tables, and logical operators such as negation, conjunction, disjunction, conditional, and biconditional. It provides examples of how to determine the truth value of compound statements using these logical connectives and the rules of propositional logic. Key concepts covered include negation, conjunction, disjunction, conditional statements, and truth tables.

Uploaded by

Migi Alucrad
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 77

CS100: DISCRETE

STRUCTURES
Lecture 5: Logic
Lecture Overview
2

 Statement
 Logical Connectives
 Conjunction

 Disjunction

 Propositions
 Conditional

 Bio-conditional

 Converse

 Inverse

 Contrapositive

 Laws of Logic
 Quantifiers
 Universal

 Existential

28-Mar-22 Computer Sciences Department


What is a Statement ?
3

 A statement is a sentence having a form that is typically used


to express acts
 Examples:
 My name is Rawan

 I like orange

4–2= 3

 Do you live in Riyadh?

28-Mar-22 Computer Sciences Department


1.1 Propositional Logic
4

 A proposition is a declarative sentence (a sentence


that declares a fact) that is either true or false, but
not both.
 Are the following sentences propositions?
 Riyadh is the capital of K.S.A. (Yes)
 Read this carefully. (No  Because it is not declarative sentence)
 2+2=3 (Yes)
 x+1=2 (No  Because it is neither true or false)
 What time is it (No  Because it is not declarative sentence)
 Take two books . (No  Because it is not declarative sentence)
 The sun will rise tomorrow . (Yes)
28-Mar-22 Computer Sciences Department
Logical Connectives and Compound
5
Statement
 In mathematics, the letters x, y, z, … are used to donate
numerical variables that can be replaced by real numbers.
 Those variables can then be combined with the familiar
operations +, -, x, ÷.
 In logic, the letters p, q, r, s, … denote the propositional
variables; that can be replaced by a statements.

28-Mar-22 Computer Sciences Department


1.1 Propositional Logic
6

 Propositional Logic: the area of logic that deals with


propositions
 Propositional Variables: variables that represent propositions:
p, q, r, s
 E.g. Proposition p – “Today is Friday.”

 Truth values: T, F

28-Mar-22 Computer Sciences Department


1.1 Propositional Logic
7

DEFINITION 1
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.” The truth value of the negation of p, ¬p
is the opposite of the truth value of p.
 Examples
 Find the negation of the following propositions and express this in simple
English.
 “Today is Friday.”
Solution: The negation is “It is not the case that today is Friday.”
In simple English, “Today is not Friday.” or “It is not
Friday today.”
 “At least 10 inches of rain fell today in Miami” .
Solution: The negation is “It is not the case that at least 10 inches of rain
fell today in Miami.”
28-Mar-22 Computer Sciences Department
In simple English, “Less than 10 inches of rain fell today in Miami.”
1.1 Propositional Logic
8

Exercise ..
 Give the negation of the following:
• p: 2 + 3 > 1
¬ p: 2 + 3 ≤ 1
• q: It is cold .
¬ q: It is not cold.
• r: 2+3 ≠5
¬ r: 2 + 3 = 5
• g: 2 is a positive integer
28-Mar-22 ¬ g: 2 is not a positive integer . OR ¬g: 2 is aComputer
negativeSciences
integerDepartment
.
1.1 Propositional Logic
9

 Truth table:
The Truth Table for the
Negation of a Proposition.
p ¬p
T F
F T

 Logical operators are used to form new propositions from two or


more existing propositions. The logical operators are also called
connectives.
28-Mar-22
1.1 Propositional Logic
10

DEFINITION 2
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 Propositions.
p q pΛq
T T T
T F F
F T F
F F F

28-Mar-22 Computer Sciences Department


1.1 Propositional Logic
11

 Example
 Find the conjunction of the propositions p and q where p is the
proposition “Today is Friday.” and q is the proposition “It is raining today.”,
and the truth value of the conjunction.

Solution: The conjunction is the proposition “Today is Friday and it


is raining today” OR “Today is Friday but it is raining.”
The proposition is:
TRUE  on rainy Fridays.
FALSE  on any day that is not a Friday and on Fridays
when it does not rain .

28-Mar-22 Computer Sciences Department


1.1 Propositional Logic
12

DEFINITION 3
Let p and q be propositions. The disjunction of p and q, denoted by
p ν q, is the proposition “p or q”. The disjunction p ν q is false when
both p and q are false and is true otherwise.

 Note: The Truth Table for


inclusive or : The disjunction is true the Disjunction of
when at least one of the two Two Propositions.
propositions is true.
p q pνq
 E.g. “Students who have taken calculus T T T
or computer science can take this class.”
– those who take one OR both classes. T F T
F T T
F F F
28-Mar-22 Computer Sciences Department
1.1 Propositional Logic
13

 Example
 Find the disjunction of the propositions p and q where p is the
proposition “Today is Friday.” and q is the proposition “It is raining today.”,
and the truth value of the conjunction.
Solution: The conjunction is the proposition “Today is Friday or it is
raining today”
The proposition is:
TRUE  whether today is Fridays or a rainy day including rainy
Fridays
FALSE  on days that are not a Fridays and when it does not rain .

28-Mar-22 Computer Sciences Department


1.1 Propositional Logic
14

exclusive or : The disjunction is true only when one of the


proposition is true.
 E.g. “Students who have taken calculus or computer science, but not both, can
take this class.” – only those who take ONE of them.

28-Mar-22 Computer Sciences Department


1.1 Propositional Logic
15

DEFINITION 4
Let p and q be propositions. The exclusive or of p and q, denoted by 𝒑 ⊕ 𝒒 ,
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 (XOR) of
Two Propositions.
p q pq
T T F
T F T
F T T
F F F
28-Mar-22
1.1 Propositional Logic
16

Conditional Statements
DEFINITION 5
Let p and q be propositions. The conditional statement p → q, is the

proposition “if p, then q.” The conditional statement is false when p is
true and q is false, and true otherwise. In the conditional statement p
→ q, p is called the hypothesis (or antecedent or premise) and q is
called the conclusion (or consequence).
 A conditional statement is also called an implication.
 Example: “If I am elected, then I will lower taxes.” p→q
implication:
elected, lower taxes. T T |T
not elected, lower taxes. F T |T
not elected, not lower taxes. F F |T
elected, not lower taxes. T F |F
28-Mar-22
1.1 Propositional Logic
17

 Example:
 Let p be the statement “Maria learns discrete mathematics.” and q the
statement “Maria will find a good job.” Express the statement p → q as a
statement in English.
Solution: Any of the following -
“If Maria learns discrete mathematics, then she will find a
good job.
“Maria will find a good job when she learns discrete
mathematics.”
“For Maria to get a good job, it is sufficient for her to
learn discrete mathematics.”
“Maria will find a good job unless she does not learn
discrete mathematics.”
28-Mar-22 Computer Sciences Department
1.1 Propositional Logic
18

 Other conditional statements:


 Converse of p → q : q → p
 Contrapositive of p → q : ¬ q → ¬ p
 Inverse of p → q : ¬ p → ¬ q

 Equivalent Statements:
 Statements with the same truth table values.
 Converse and Inverse are equivalents.
 Contrapositive and p → q are equivalents.

28-Mar-22 Computer Sciences Department


1.1 Propositional Logic
19

DEFINITION 6
Let p and q be propositions. The biconditional statement p ↔ q is
the proposition “p if and only if q.” The biconditional statement p ↔ q
is true when p and q have the same truth values, and is false
otherwise. Biconditional statements are also called bi-implications.
 p ↔ q has the same truth value as (p → q) Λ (q → p)
 “if and only if” can be expressed by “iff”
 Example:
 Let p be the statement “You can take the flight” and let q be the statement
“You buy a ticket.” Then p ↔ q is the statement
“You can take the flight if and only if you buy a ticket.”
Implication:
If you buy a ticket you can take the flight.
If you don’t buy a ticket you cannot take the flight.
28-Mar-22 Computer Sciences Department
1.1 Propositional Logic
20

The Truth Table for the


Biconditional p ↔ q.
p q p↔ q
T T T
T F F
F T F
F F T

28-Mar-22
1.1 Propositional Logic
21

Exercise ..
 Let p and q be the propositions
p : I bought a lottery ticket this week.
q : I won the million dollar jackpot on Friday.
 Express each of these propositions as an English sentence.
1) ¬𝑝 I did not buy a lottery ticket this week.

If I did not buy a lottery ticket this week, then I


2) ¬𝑝 → ¬𝑞 did not win the million dollar jackpot on Friday.

3) ¬ 𝑝∨𝑞 I did not buy a lottery ticket this week, and I did not
win the million dollar jackpot on Friday.

28-Mar-22 Computer Sciences Department


1.1 Propositional Logic
22

Truth Tables of Compound Propositions


 We can use connectives to build up complicated compound propositions
involving any number of propositional variables, then use truth tables to
determine the truth value of these compound propositions.
 Example: Construct the truth table of the compound proposition
(p ν ¬q) → (p Λ q)
The Truth Table of (p ν ¬q) → (p Λ q).
p q ¬q p ν ¬q pΛq (p ν ¬q) → (p Λ q)

T T F T T T
T F T T F F
F T F F F T
F F T T F F
28-Mar-22
Types of statements
23

 A statements that is true for all possible values of its propositional variables
is called tautology
 (𝑝 ∨ 𝑞) ↔ (𝑞 ∨ 𝑝) Examples of a Tautology and a Contradiction.
 𝑝 ∨∼ 𝑝
p ¬p p ν ¬p p Λ ¬p

T F T F
F T T F
 A statement that is always false is called contradiction
 𝑝 ∧∼ 𝑝

 A statement that can be either true or false, depending of the values of its
propositional variables, is called a contingency
 (𝑝 ⟶ 𝑞) ∧ (𝑝 ∧ 𝑞)
28-Mar-22 Computer Sciences Department
1.1 Propositional Logic
24

Precedence of Logical Operators


 We can use parentheses to specify the order in which logical operators in a
compound proposition are to be applied.
 To reduce the number of parentheses, the precedence order is defined for
logical operators.
Precedence of Logical Operators.
E.g. ¬p Λ q = (¬p ) Λ q
Operator Precedence
p Λ q ν r = (p Λ q ) ν r
¬ 1 p ν q Λ r = p ν (q Λ r)
Λ 2
ν 3
→ 4
↔ 5
28-Mar-22
1.1 Propositional Logic
25

Exercise ..
 find the truth table of the following proposition

p ˄ ( ¬( q ˅ ¬p))
p q ¬p q ˅ ¬p ¬( q ˅ ¬p) p ˄ ( ¬( q ˅ ¬p))
T T F T F F
T F F F T T
F T T T F F
F F T T F F

28-Mar-22 Computer Sciences Department


1.1 Propositional Logic
26

Translating English Sentences


 English (and every other human language) is often ambiguous. Translating
sentences into compound statements removes the ambiguity.
 Example: How can this English sentence be translated into a logical
expression?
“You cannot ride the roller coaster if you are under 4 feet tall and you
are not older than 16 years old.”

Solution: Let q, r, and s represent “You can ride the roller coaster,”
“You are under 4 feet tall,” and “You are older than
16 years old.” The sentence can be translated into:
(r Λ ¬ s) → ¬q.
28-Mar-22
1.1 Propositional Logic
27

 Example: How can this English sentence be translated into a logical expression?
“You can access the Internet from campus only if you are a computer science
major or you are not a freshman.”

Solution: Let a, c, and f represent “You can access the Internet from
campus,” “You are a computer science major,” and “You are
a freshman.” The sentence can be translated into:
a → (c ν ¬ f ) .

28-Mar-22
1.1 Propositional Logic
28

Exercise ..
 Write the following statement in logic :
 If I do not study discrete structure and I go to movie ,
then I am in a good mood .
Solution :
p: I study discrete structure ,
q: I go to movie ,
r: I am in a good mood
(¬p ˄ q )➝ r

28-Mar-22 Computer Sciences Department


1.1 Propositional Logic
29

Logic and Bit Operations


 Computers represent information using bits.
 A bit (Binary Digit) is a symbol with two possible values, 0 and 1.
 By convention, 1 represents T (true) and 0 represents F (false).
 A variable is called a Boolean variable if its value is either true or false.
 Bit operation – replace true by 1 and false by 0 in logical operations.

Table for the Bit Operators OR, AND, and XOR.


x y 𝑥∨𝑦 𝑥∧𝑦 𝑥⊕𝑦

0 0 0 0 0
0 1 1 0 1
1 0 1 0 1
28-Mar-22 1 1 1 1 0
1.1 Propositional Logic
30

DEFINITION 7
A bit string is a sequence of zero or more bits. The length of this
string is the number of bits in the string.

 Example: Find the bitwise OR, bitwise AND, and bitwise XOR of the bit string
01 1011 0110 and 11 0001 1101.
Solution:
01 1011 0110
11 0001 1101
-------------------
11 1011 1111 bitwise OR
01 0001 0100 bitwise AND
10 1010 1011 bitwise XOR

28-Mar-22 Computer Sciences Department


1.2 Propositional Equivalences
31

Introduction
DEFINITION 1
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.

Examples of a Tautology and a Contradiction.


p ¬p p ν ¬p p Λ ¬p

T F T F
F T T F

28-Mar-22
1.2 Propositional Equivalences
32

Logical Equivalences
DEFINITION 2
The compound propositions p and q are called logically equivalent
if p ↔ q is a tautology. The notation p ≡ q denotes that p and q are
logically equivalent.
 Compound propositions that have the same truth values in all possible cases
are called logically equivalent.
 Example: Show that ¬p ν q and p → q are logically equivalent.
Truth Tables for ¬p ν q and p → q .
p q ¬p ¬p ν q p→q
T T F T T
T F F F F
F T T T T
28-Mar-22
F F T T T
1.2 Propositional Equivalences
33

Exercise ..
 Show that this statements ((p ˄ q) → (p ˅ q)) is

tautology , by using The truth table :

p q q˄p p˅q (p ˄ q) → (p ˅ q)
T T T T T
T F F T T
F T F T T
F F F F T

28-Mar-22 Computer Sciences Department


Laws of Logic
34

 Identity Laws
p vF ≡p

p ^T≡ p

 Domination Laws
p vT ≡T

P ^F≡F

28-Mar-22 Computer Sciences Department


Laws of Logic
35

 Idempotent Laws
 pvp≡ p
 p^p≡ p
 Double Negation Law
 ¬(¬p) ≡ p

 Commutative Laws
 pvq≡ qvp
 p^q≡ q^p

28-Mar-22 Computer Sciences Department


Laws of Logic
36

 Association Laws
 (p v q ) v r ≡ p v (q v r)

 Distributive Laws
 p v (q ^ r ) ≡ (p v q) ^ (p v r)

 p ^ (q v r) ≡ (p ^ q) v (p ^ r)

28-Mar-22 Computer Sciences Department


Contd.
37

 De Morgan’s Laws
 ~ (p v q) ≡ ~p ^ ~q
 ~ (p ^ q) ≡ ~p v ~q

 Absorption Laws
 p v (p ^ q) ≡ p
 p ^ (p v q) ≡ p

28-Mar-22 Computer Sciences Department


Contd.
38

 Complement Laws
 p v ~p ≡ T p ^ ~p ≡ F
 ~ ~p ≡ p ~ T ≡ F , ~F ≡ T

 p → q ≡ ¬p ˅ q
 ¬(p → q ) ≡ p Λ ¬q

 Note: See tables 7 & 8 page V6-25 / V7-28

28-Mar-22 Computer Sciences Department


1.2 Propositional Equivalences
39

Constructing New Logical Equivalences

 Example: Show that ¬(p → q ) and p Λ ¬q are logically


equivalent.
Solution:
¬(p → q ) ≡ ¬(¬p ν q)
≡ ¬(¬p) Λ ¬q (by the second De Morgan law)
≡ p Λ ¬q (by the double negation law)

28-Mar-22
1.2 Propositional Equivalences
40

 Example: Show that (p Λ q) → (p ν q) is a tautology.


Solution: To show that this statement is a tautology, we will use logical
equivalences to demonstrate that it is logically equivalent to T.
(p Λ q) → (p ν q) ≡ ¬ (p Λ q) ν (p ν q)
≡ (¬ p ν ¬q) ν (p ν q) (by the first De Morgan law)
≡ (¬ p ν p) ν (¬ q ν q) (by the associative and communicative law for disjunction)
≡TνT
≡T
 Note: The above examples can also be done using truth tables.

28-Mar-22
Exercises
41

 Simplify the following statement


(p v q ) ^ ~p

 Show that
~p ^ (~q ^ r) v (q ^ r) v (p ^ r) ≡ r
(p → q) v (p → r) ≡ p → q v r

28-Mar-22 Computer Sciences Department


Exercises – Continue
42

 (p v q ) ^ ~p
 ≡ ~p ^ ( p v q )
 ≡ ( ~p ^ p ) v ( ~ p ^ q )

 ≡ F v ( ~p ^ q )

 ≡ ~p ^ q

28-Mar-22 Computer Sciences Department


Exercises – Continue
43

 ~p ^ (~q ^ r) v (q ^ r) v (p ^ r) ≡ r
 ≡ ~p ^ r ^ (~q v q) v (p ^ r)
 ≡ ~p ^ r ^ T v (p ^ r)

 ≡ ~p ^ r v (p ^ r)

 ≡ (~p ^ r) v (p ^ r)

 ≡ r ^ (~p v p)

≡r^T

≡r

28-Mar-22 Computer Sciences Department


Exercises – Continue
44

 (p → q) v (p → r) ≡ p → q v r
≡ ¬𝑝⋁𝑞 ⋁(¬𝑝⋁𝑟)
≡¬𝑝 ⋁𝑞⋁¬𝑝⋁𝑟

≡ ¬𝑝 ⋁¬𝑝⋁𝑞 ⋁𝑟
Complement
≡ ¬𝑝⋁𝑞 ⋁𝑟
Laws
≡ ¬𝑝⋁(𝑞⋁𝑟) p → q ≡ ¬p ˅ q

≡ 𝑝 → (𝑞 ⋁𝑟)

28-Mar-22 Computer Sciences Department


Exercises – Continue
45

 Show that this statements (¬ q ˄ (p  q )  ¬p


is tautology , by using The laws of logic :
≡ ¬ (¬ q ˄ (p  q )( ˅ ¬p
 ≡ ¬ (¬ q ˄ (¬p ˅ q )( ˅ ¬p

 ≡ q ˅ ¬ (¬p ˅ q ) ˅ ¬p

 ≡ (¬p ˅ q ) ˅ ¬ (¬p ˅ q )

≡ T

28-Mar-22 Computer Sciences Department


Exercises – Continue
46

 Without using truth tables prove the statement


(P ∧( P ➝ q)) ➝ q is tautology.
(P ∧( P ➝ q)) ➝ q ≡ ¬ 𝑝˄ 𝑝 → 𝑞 ˅𝑞
≡ ¬𝑝˅¬(¬𝑝˅𝑞 ˅ 𝑞
≡ ¬𝑝˅ 𝑞 ˅¬ ¬𝑝˅ 𝑞
≡𝑇

28-Mar-22 Computer Sciences Department


1.5 Rules of Inference
47

Valid Arguments in Propositional Logic:


DEFINITION 1
An argument in propositional logic is a sequence of propositions. All but
the final proposition in the final argument are called premises and the final
proposition is called the conclusion..
An argument is valid of 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.

28-Mar-22 Computer Sciences Department


Rules of Inference
48

Example:
If you have access to the network, then you can
Hypothesis
change your grade
premises
You have access to the network
--------------------------------------------------
∴ You can change your grade Valid
conclusion Argument

28-Mar-22 Computer Sciences Department


Rules of Inference for Propositional Logic:
49

 We can always use a truth table to show that an


argument form is valid.
 This is a tedious approach.
 when, for example, an argument involves 9
different propositional variables.
 To use a truth table to show this argument is valid.
 It requires 2⁹= 512 different rows !!!!!!!

28-Mar-22 Computer Sciences Department


Rules of Inference:
50

 Fortunately, we do not have to resort to truth tables.


 Instead we can first establish the validity of some
simple argument forms, called rules of inference.
 These rules of inference can then be used to
construct more complicated valid argument forms.

28-Mar-22 Computer Sciences Department


Rules of Inference
Rules of Inference Tautology Name
p [p ^ (p  q)]  q Modus ponens
pq
--------------------
51 ∴q
q [ q ^ (p  q)]   p Modus tollens
pq
------------------------
∴p
pq [(p  q) ^ (q  r)]  (p  r) Hypothetical syllogism
qr
-----------------------
∴pr
pvq [(p v q) ^  p]  q Disjunctive syllogism
P
---------------------
∴q
p p  (p v q) Addition
------------------
∴ (p v q)
p^q (p ^ q)  p Simplification
-----------------------
∴p
p (p) ^ (q)  (p ^ q) Conjunction
q
--------------------
∴ (p ^ q)
pvq (p v q) ^ (p v r)  (q v r) Resolution
28-Mar-22 p v r Computer Sciences Department
---------------
∴qvr
Rules of Inference (Cont.) :
52

State which rule of inference is the basis of


the following statement:
 “it is below freezing now. Therefore, it is
either freezing or raining now”
SOLTUION:
EXAMPLE  Let p: “it is below freezing now”

q: “it is raining now”


Then this argument is of the form
p
------------- (Addition)
∴pvq

28-Mar-22 Computer Sciences Department


Rules of Inference (Cont.) :
53

“ it is below freezing and it is raining now.


Therefore, it is below freezing”
SOLUTION:
Let p: “it is below freezing now”
EXAMPLE
q: “it is raining now”
Then this argument is of the form
p^q
----------- (Simplification)
∴p

28-Mar-22 Computer Sciences Department


Rules of Inference (Cont.) :
54

 If it is rainy, then the pool will be closed. It


is rainy. Therefore, the pool is closed.
What rule of SOLUTION:
inference is Let p: “It is rainy”
used in each
of these q: “the pool is closed”
arguments ?
Then this argument is of the form
p
pq
---------------- (Modus ponens)
∴q
28-Mar-22 Computer Sciences Department
Rules of Inference (Cont.) :
55

 If I go swimming, then I will stay in the sun too long.


If I stay in the sun too long, then I will sunburn.
Therefore, if I go swimming, then I will sunburn.
What rule of
inference is
SOLUTION:
used in each Let p: “I go swimming”
of these
arguments ? q: “I stay in the sun too long”
r: “I will sunburn”
Then this argument is of the form
p→q
q→ r
------- (Hypothetical syllogism)
28-Mar-22 p→r Computer Sciences Department
Rules of Inference (Cont.) :
56

 If it snows today, the university will close.


The university is not closed today.
What rule of
Therefore, it did not snow today.
inference is SOLUTION:
used in each
of these Let p: “it snows today”
arguments ?
q: “The university is closed today”
Then this argument is of the form
q
pq
-------------- (Modus tollens)
28-Mar-22 Computer Sciences Department
∴ p
Using Rules of Inference to Build Arguments:
57

 When there are many premises, several rules of


inference are often needed to show that an
argument is valid.

28-Mar-22 Computer Sciences Department


Using Rules of Inference to Build Arguments
(Cont.):
58

 If I try hard and I have talent, then I will


Find the become a musician.
argument  If I become a musician, then I will be
form for the
following happy.
argument ∴ If I will not happy, then I did not try hard
and
determine or I do not have talent.
whether it is
valid or
invalid. It's valid, Hypothetical syllogism.

28-Mar-22 Computer Sciences Department


Using Rules of Inference to Build Arguments
(Cont.):
59

 If I drive to work, then I will arrive tired.


Find the  I do not drive to work.
argument
form for the ∴ I will not arrive tired.
following
argument
and It's invalid
determine
whether it is
valid or
invalid.

28-Mar-22 Computer Sciences Department


Using Rules of Inference to Build Arguments
(Cont.):
60

 I will become famous or I will become a


Find the writer.
argument  I will not become a writer.
form for the
following ∴ I will become famous
argument
and
determine
whether it is Its valid, Disjunctive syllogism
valid or
invalid.

28-Mar-22 Computer Sciences Department


Using Rules of Inference to Build Arguments
(Cont.):
61

 If taxes are lowered, then income rises.


Find the  Income rises.
argument
form for the ∴ Taxes are lowered
following
argument
and It's invalid
determine
whether it is
valid or
invalid.

28-Mar-22 Computer Sciences Department


Using Rules of Inference to Build
62
Arguments (Cont.) :
Show that the hypotheses “it is not sunny
this afternoon and it is colder than
yesterday,” “we will go swimming only if it
EXAMPLE
is sunny,” “if we do not go swimming, then
we will take a canoe trip,” “if we take a
canoe trip, we will be home by sunset.”
lead to “we will be home by sunset”

28-Mar-22 Computer Sciences Department


Using Rules of Inference to Build Arguments (Cont.) :

63

 Let p: “it is sunny this afternoon”


q: “it is colder than yesterday”
r: “we will go swimming”
SOLUTION
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

28-Mar-22 Computer Sciences Department


Cont’d:
64

 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 !!!
28-Mar-22 Computer Sciences Department
Resolution:
65

 Computer programs make use of rule of inference


called resolution to automate the task of reasoning
and proving theorems.

 This rule of inference is based on the tautology


((p v q) ^ (¬ p v r))  ( q v r )

28-Mar-22 Computer Sciences Department


Resolution (Cont.):
66

Use resolution to show that the hypotheses

“Jasmine is skiing or it is not snowing”


EXAMPLE and “it is snowing or Bart is playing
hockey” imply that “Jasmine is skiing or
Bart is playing hockey”

28-Mar-22 Computer Sciences Department


Resolution (Cont.):
67

p: “it is snowing”,
q: “Jasmine is skiing”,
r: “Bart is playing hockey”
SOLUTION We can represent the hypotheses as
¬ p v q and p v r, respectively
Using Resolution, the proposition q v r, “Jasmine is
skiing or Bart is playing hockey” follows

28-Mar-22 Computer Sciences Department


Quantifiers
68

 So far we have discussed the propositions in which each


statement has been about a particular object. In this section we
shall see how to write propositions that are about whole
classes of objects.

 Consider the statement:


p: x is an even number
 The truth value of p depends on the value of x.
e.g.
p is true when x = 4, and false when x = 7

28-Mar-22 Computer Sciences Department


1.Universal Quantifiers
69

DEFINITION 1
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 the universal quantifier. We read ∀ x P(x) as “for all x P(x)” or
“for every x P(x) ”. An element for which P(x) is false called
counterexample of ∀ x P(x)

 “For all values of x, P(x) is true”.


For every x
For any x ∀x
Every x
 We assume that only values of x that make sense in P(x) are
considered.
28-Mar-22 ∀ x P(x) Computer Sciences Department
1.Universal Quantifiers
70

Example 8..
Let P(x) be the statement “x+1>x”. What is the truth value of the
quantification ∀ x P(x), where the domain consists of all real numbers?
Solution
 The quantification ∀ x P(x),is true because P(x) is true for all real numbers.

28-Mar-22 Computer Sciences Department


1.Universal Quantifiers
71

Example 9..
Let Q(X) be the statement “x < 2”. What is the truth value of the
quantification ∀ x Q(x), where the domain consists of all real numbers?
Solution
 Q(x) is not true for every real number x, because Q(3) is false. That is, x=3
is a counterexample for the statement ∀ x Q(x), thus
∀ x Q(x) is false

28-Mar-22 Computer Sciences Department


1.Universal Quantifiers
72

Example 11..
What is the truth value of the quantification ∀ x P(x), where P(X) is the
statement “x2 < 10” and the domain consists of the positive integers not
exceeding 4 ?
Solution
 The statement ∀ x P(x) is the same as the conjunction
P(1) ^ P(2) ^ P(3) ^ P(4)
 Because the domain consists of the positive integers 1,2,3 and 4.
 Because P(4), which the statement “42 < 10” is false, it follows that ∀ x P(x)
is false.

28-Mar-22 Computer Sciences Department


2.Existential Quantifiers
73

DEFINITION 2
The essential quantification of p(x) is the proposition
“There exists an element x in the domain such that P(x).”
We use the notation ∃ x P(x) for the essential quantification of P(x).
Here ∃ is called the essential quantifier.
 In some situations, we only require that there is at least one
value for which the predicate is true.
 The existential quantification of a predicate
P(x) is the statement “there exists a value of x, for which P(x) is
true.
∃x P(x)
There is a dog without tail (∃ a dog) (a dog without tail)
28-Mar-22 Computer Sciences Department
2.Existential Quantifiers
74

Example 16..
What is the truth value of ∃x P(x), where P(X) is the statement “x2 > 10”
and the universe of discourse consists of the positive integers not exceeding
4?
Solution
 Because the domain is {1, 2, 3, 4}, the proposition ∃ x P(x) is the same as
the disjunction
P(1) v P(2) v P(3) v P(4)
 Because P(4), which the statement “42 > 10” is true, it follows that ∃x P(x) is
true.

28-Mar-22 Computer Sciences Department


Quantifiers - Negation
75

 Rule:
 ∀x p(x)  ∃x ¬p(x)
 ∃x p(x)  ∀x ¬p(x)

 Negate the following:


( ∀ integers x) (x > 8)  (∃ an integer x) (x ≤ 8)

 Negate the following;


(∃ an integer x) (0 ≤ x ≤ 8)  ( ∀ integers x) (x < 0 OR x > 8)

28-Mar-22 Computer Sciences Department


Quantifiers
76

Exercise ..
 p(x): x is even
 q(x): x is a prime number
 r(x,y): x+y is even .
 Write an English sentence that represent the following :
A. ∀x P(x) for every x where x is even
B. ∃x Q(x) there is exists x where x is a prime number
C. ∀x ∃y R(x,y) for all x there exists y where x+y is even
 Find negation for a. and b.
∃x ¬p(x) there is exist x where x is odd
∀x ¬q(x) for every x where x not prime number

28-Mar-22 Computer Sciences Department


Group Work (Teamwork “Assignment”)
77

Section 1.2: Q9 (f) Section 1.2: Q9 (e)


Section 2.3: Q19 (a) Section 2.3: Q19 (b)
A C
Section 3.8: Q29 (a) Section 3.8: Q29 (b)
Section 8.1: Q3 (a) Section 8.1: Q3 (b)
Section 1.2: Q9 (d) Section 1.2: Q9 (c)
Section 2.3: Q19 (c) Section 2.3: Q19 (d)
B D
Section 3.8: Q29 (c) Section 3.8: Q28 (c)
Section 8.1: Q3 (e) Section 8.1: Q3 (f)

28-Mar-22 Computer Sciences Department

You might also like