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

Chapter 1_ Logic

Uploaded by

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

Chapter 1_ Logic

Uploaded by

rajamasadeh2013
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 137

Discrete

Mathematics
Chapter
1: Logic
Done by: Dr. Raja’a Masa’deh
Information Technology Faculty
The World Islamic Sciences and
Education University
Proposition: - is a statement that is either true or false but
not both.
- a sentence with meaning.
- it is never both, neither, or somewhere “in
between”.
Example “3+2=5”  it is true.
s:
“Amman is the capital of Jordan” it is true.

“Cairo is the capital of Saudi Arabia” it is false.


Are the following sentences propositions?

 Who’s there? Question


 Just do it. Command
 La La La
Meaningless
 1+2 Non true/ false
value
 What time is it? Question
 Read this carefully.
Command
All of them are not propositions.
Logical
Variables

 Its value true or false.


 It uses as a symbol which indicates to a logical
sentence and usually the letters are used.
 Such as p, q, r, s, …
 The truth value of a proposition is true, denoted
by T, if it is a true proposition and false, denoted
by F, if it is a false proposition.
Logical
Operators

1. Negation operator.
2. Conjunction operator.
3. Disjunction operator.
4. Exclusive OR operator.
5. Implication operator.

6. Biconditional operator
Negation operator.
Negation operator.
Negation operator.

Example 1:P=Today is sunny


p ¬p
¬p=Today is not sunny
T F
Example 2: F T

Amman is the capital of Jordan.


P=Amman is the capital of Jordan  ¬p=Amman is not the
capital of Jordan.
Conjunction operator.
Conjunction operator.

 Is denoted by and it reads as “ p and q”.


 is true when both are true, otherwise, it is false.

p q (p.q)/(pq)/p˄q
Example:P= It is snowing
T T T
q= I am cold.
T F F
pɅq: It is snowing, and I am cold. F T F
F F F
Example:
Find the conjunction of the propositions p & q where p is the
proposition “ Today is Friday” and q is the proposition “It is raining
today”.

The conjunction of these proposition , is the proposition “ Today is


Friday and it is raining today”. This proposition is true on rainy
Friday, and it is false on any day that is not a Friday and on
Fridays when it does not rain.
Disjunction operator (Inclusive OR).
Disjunction operator (Inclusive OR).

 Is denoted by and it reads as “ p or q”. p q (p˅q)/ (p+q)


 is true, if at least one of p or q is true. T T T
 is false, when both p and q are false. T F T
F T T
F F F
Example:

Find the disjunction of the propositions () where p is the


proposition “ Today is Friday” and q is the proposition “It is raining
today”.
Today is Friday or it is raining today.
The disjunction of these proposition , is the proposition “ Today is
Friday or it is raining today”. This proposition is true on any day
that either a Friday or a rainy day (including rainy Friday), and it is
only false on days that are not Fridays where it also does not
rain.
Exclusive OR operator
Exclusive OR operator
𝒑 ⨁ 𝒒 =⇁ 𝒑 . 𝒒 + 𝒑 . ⇁ 𝒒
 It is true when exactly one of p & q is true and is false
otherwise.
= F. T + T. F
P q
=F+F
=F
T T F
T F T
F T T

= T. T + F. F
=T+F
F F F

=T True ‫ والمختلفات‬False
‫المتشابهات‬

Example:
“I will go to coffeeshop, or I will study” which means you will do
only one thing.
Implication operator
Implication operator

 It is denoted by and it reads as “If p, then q”, “p implies q”.


 It is false, only if p is true and q is false, and true otherwise.

𝒑 ⟶ 𝒒=↽𝒑 ∨𝒒 P q
T T T

=F T =F F
T F F

=T =F
F T T
F F T

=T T =T F
=T =T
Example: P: If you study hard.
q: you will pass your exam.

P q
T T T If you study hard, then you will pass the
exam.
T F F If you study hard, then you won’t pass the
F T T exam.
If you don’t study hard, then you will pass the
exam.
F F T If you don’t study hard, then you won’t pass
the exam.
Example:If you get 100% on the final, then you will get an

If you manage to get a 100% on the final, then you would expect
to receive an A.
If you don’t get 100% you may or not receive an A depending on
other factors. However, If you do get 100%, but the professor
doesn’t give you an A, you will feel cheated.
P q
T T T
T F F
F T T
F F T
Biconditional operator
Biconditional operator

 It is denoted by and it reads as “p if and only if q”.


 It is true, if p & q both have the same value.

𝒑 ⟷ 𝒒=𝒑 . 𝒒+↽ 𝒑 . ↽𝒒 P q

=T+F . F =F+T .T
T T T

=T+F =F+T
T F F

=T =T F T F
F F T

=F+F . T =F+T . F
=F+F =F+F
False ‫ والمختلفات‬True

=F =F
‫المتشابهات‬
Example:

Let p be the statement “You can take the P q


flight” and let q be the statement “You T T T
buy a ticket”, T F F
F T F
thencan take the flight if and only if you buy a ticket”.
“You
F F T
The statement is true if p & q are either true or both false.
If you buy a ticket, you can take the flight or if you don’t buy a ticket, you
can’t take the flight .
The statement is false, when you don’t buy a ticket, but you can take flight
(free trip) and when you buy a ticket and can’t take the flight (the airline
bumps you).
Compound Proposition
Example:

Exercise:Find the value of the following, if p is true, q is false, and

 (
 A proposition that is always has its truth values true is called a
tautology.
 A proposition that is always has its truth values false is called a
contradiction.
 A proposition that is always has its truth values is a mix of true
Example:
and .false is called a contingency.
Is the proposition tautology, contradiction or contingency?

Contradicti
on

𝒑 ⟶ 𝒒=↽𝒑 ∨𝒒
Example:

T F T F
F T T F

Tautolo
gy Contradictio
n
Exercise:
Logical Equivalence

 Two propositions are said to be logically equivalent if they have


identical truth values for every set of truth values of their
components.
 DE Morgan's Law:

↽ (𝒑 ∧𝒒 )⟺ ↽ 𝒑 ∨↽ 𝒒
T T F F F F
T F F T T T
F T T F T T
F F T T T T
 Distributive Laws:

 DE Morgan's Laws:
Discrete
Mathematics
Logical
Equivalence
s
Translating English
Sentences
 Translate English sentences into expressions involving
propositional variables and logical connectives.
Example 3
I'll go for a run unless it rains.
p= I'll go for a run
q=it rains

mean
s
If it doesn't rain, then I'll go for a
run ¬ q →𝑝

So, “P unless Q” is the logical equivalent of “If not Q,


then P”.
Proposition
al
Equivalence
s
Logical Equivalences

 We can construct examples of tautologies and contradictions


using just one propositional variable.
 Consider the truth tables of p ∨ ¬ p and p ∧ ¬ p, shown in Table
1. Because p ∨ ¬ p is always true, it is a tautology. Because p
∧ ¬ p is always false, it is a contradiction.
Precedence of logical operators
 The priorities of logical operators
are :
Propositional Equivalences

• A contingency proposition whose truth table mix of true and


false .

• Example: Show that ¬ (p ∨ q) and ¬ p ∧ ¬ q are


logically equivalent.
• Solution:
Example 1:
Show that ¬ (p → q) and p ∧ ¬ q are logically
equivalent

¬ (p → q) = ¬ ( ¬ p ∨ q) De Morgan’s Law
= ¬ ( ¬ p) ∧ ¬ q Double negation Law
= p ∧ ¬q
Example 2:
Show that (p ∧ q) → (p ∨ q) is a tautology

(p ∧ q) → (p ∨ q)= ¬ (p ∧ q) ∨ (p ∨ q)
= ¬p ∨ ¬q ∨ p ∨ q
= ( ¬ p ∨ p) ∨ ( ¬ q ∨ q)
=T∨T
=T

Suppose p is Suppose p is
true false
( ¬ p ∨ p) ( ¬ p ∨ p) Always ( ¬ p ∨ p)
= ( ¬ T ∨ T) = ( ¬ F ∨ F) =T
= (F ∨ T) = (T ∨ F)
=T = T
Example 3:
Show that ¬ (p ∨( ¬ p ∧ q)) and ¬ p ∧ ¬
q are logically equivalent.

¬ (p ∨ ( ¬ p ∧ q))= ¬ p ∧ ¬ (( ¬ p ∧ q)
= ¬ p ∧ (p ∨ ¬ q)
= ( ¬ p ∧ p) ∨ ( ¬ p ∧ ¬ q)
= F ∨ ( ¬ p ∧ ¬ q)
= ( ¬ p ∧ ¬ q)
Example 4:
Show that (p → r) ∨ ( q → r) and (p ∧
q) → r
are logically equivalent.
(p → r) ∨ ( q → r) = ( ¬ p ∨ r) ∨ ( ¬ q ∨ r)
= (¬p ∨ ¬q ) ∨ r
= ¬ (p ∧ q) ∨ r
= (p ∧ q) → r
Example 5:
Show that (p → r) ∧ ( q → r) and (p ∨
q) → r
are logically equivalent.
(p → r) ∧ ( q → r) = ( ¬ p ∨ r) ∧ ( ¬ q ∨ r)
= (¬p ∧ ¬q ) ∨ r
= ¬ (p ∨ q) ∨ r
= (p ∨ q) → r
Example 6:
Show that (p ∧ q) → p is a tautology
without using truth table.

(p ∧ q) → p = ¬ (p ∧ q) ∨ p
= ¬p ∨ ¬q ∨ p
= ( ¬ p ∨ p) ∨ ¬ q
= T ∨ ¬q
=T
Example 7:
Show that p → (p ∨ q) is a tautology
without using truth table.

p → (p ∨ q) = ¬ p ∨ p ∨ q
= ¬p ∨ p ∨ q
= ( ¬ p ∨ p) ∨ q
=T∨q
=T
Exercise:
1. Write logically equivalent statement form for
( without using “ or “. Then find a logically equivalent
statement to your answer that is simple as possible.

2. Show that is a tautology.

3. Show that and are logically equivalent.


Discrete
Mathematics

Predicates
and
Quantifiers
Predicates
X is greater than 3
which has two parts:
 First part: the variable (X), is the subject of the
statement.
 Second part: the predicate, “is greater than 3”.

 We can denote the statement “ x is greater than 3” by p(x), where p


denotes the predicate “ is greater than 3” and x is at x.
 The statement P(x) is also said to be the value of the propositional
function p at x.
Example Let
1: p(x) denotes the statement “X>3”. What
are the truth values of P(4) and P(2)?

We obtain the statement P(4) by setting x=4 in the statement


“X>3”. Hence, P(4), which is the statement “4>3” is true.
However, P(2), which is the statement “2>3” is false.
Example 2:
Let Q(x, y) denotes the statement “ x=y+3”.
What are the truth values of the proposition
Q(1, 2) and Q(3,0)?

To obtain Q(1,2), set x=1 and y=2 in the statement Q(x, y).
Hence, Q(1, 2) is the statement “1 = 2+3” which is false. While
Q(3, 0) is the proposition “3= 0+3” which is true.
Example 3:
Let R(x, y, z) denotes the statement “x + y=
z”. What are the truth values of the
proposition R(1, 2, 3) and R(0, 0, 1)?

The proposition R(1, 2, 3) is denoted by setting x=1, y=2 in the


statement R(x, y, z). We see that R(1, 2, 3) is the statement “1
+2= 3” which is true. While R(0, 0, 1) is the statement “0+0=1”
which is false.
Example 4:
Let P(x) denotes the statement “X2<X”. What
are the truth values of P(1) and P(2).

To obtain P(1), set x=1 in the statement P(x). Hence, P(1) is the
statement “12<1” which is false. While P(2) is the statement
“22<2” which is false too.
Quantifiers
 Quantifier: is another important way to create a proposition from
a propositional function.
 There are three types of quantification:
 The universal quantifier.
 The existing quantifier.
 Uniqueness quantifier.
The universal
quantifier.
 The universal quantification of P(x) is the proposition
“P(x) is true for all values of x in the universe of
discourse”
Many mathematical statement assert that a property is true for all values
of a variable in a particular domain called the universe of discourse or the
domain.
 The notation:
read as “ for all x p(x)”
or “ for every x p(x)”.

Avoid using for any x, since it is often ambiguous as to whether “any” means
“every” or “some”.
Example 1:
Let P(X) be the statement . What is the truth values
of the quantification where the universe of
discourse consists of all real numbers?

Since P(x) is true for all real numbers x, the quantification of is


true.
Example 2:
Let Q(X) be the statement . What is the truth values
of the quantification where the universe of
discourse consists of all real numbers?

Q(x) is not true for every real numbers x, since, for instance
Q(3) is false. Thus, is false.
Example 3:
What is the truth values of where is the statement
“” and the universe of discourse consists of the
positive integers not exceeding 4?

The universe discourse consists of the integers 1, 2, 3 and 4. Since


p(4) is the statement is false, it follows that is false.

Note:

 The statement is the same as the conjunction .


 this conjunction is true if and only if are all true.
The Existing
quantifier.
 The existing quantification of is the proposition
“There exists an element x in the universe of discourse
such that p(x) is true”

 The notation:
read as “ there is an x such that p(x)
or “ for some x p(x)”
or “there is at least one x such that p(x).
Example 1:
Let P(X) denotes the statement . What is the truth
values of the quantification where the universe of
discourse consists of all real numbers?

Since is true for instance, when x=4; the existential


quantification of p(x) which is true.
Example 2:
Let denotes the statement . What is the truth values
of the quantification where the universe of
discourse consists of all real numbers?

Since is false for every real number x, the existential


quantification of which is false.
Example 3:
What is the truth values of in the statement “” and
the universe of discourse consists of the positive
integers not exceeding 4?

The universe discourse is {1, 2, 3, 4}, the proposition is the same


as the disjunction.

Note:

 The statement is the same as the conjunction .


 = The disjunction is true if one is true.
is true.
Uniqueness quantifier.

 means that there exists one and only one x in the


domain such that P(x) is true.
 means that there exists a unique x such that p(x)
is true.
 Example: if p(x) denotes “”and U is the integers,
then is true.
 Example: if p(x) denotes “”, then is false.
Negations

Every student in the class has taken a course in


Calculus.
∀ 𝑥𝑃 ( 𝑥 )
Where P(x) is the statement “ x has taken a course in
calculus”
The negation of this statement
“There is a student in the class who has not taken a course in
Calculus”
⇁ ( ∀ 𝑥𝑃 ( 𝑥 ) ) =∃ 𝑥 ⇁ 𝑝 ( 𝑥 )
Example

Let C(x) denotes “ X eats cheeseburgers”. Then the statement “


All Americans eat cheeseburgers” is presented by where the
universe of discourse consists of all Americans. What is the
negation of this statement?
⇁ ( ∀ 𝑥 𝐶 ( 𝑥 ) ) =∃ 𝑥 ⇁ 𝐶 (𝑥 )

“Some American does not eat cheeseburgers” and “there is an


American who does not eat cheeseburgers”.
Translate each of these statements into logical
expressions using predicate, quantifiers, and logical
connectives.
Let
The domain
1. No be all (Not
one is perfect people.
( one is perfect))
OR

2. Not everyone is perfect (Not (everyone is perfect)

OR
3. All your friends are perfect (if there is a person who is your friend
then he is perfect)

4. At least one of your friends is perfect. (There is a person who is


your friend who is perfect.)
Translate each of these statements into logical
expressions using predicate, quantifiers, and logical
connectives.
Let
The domain be all people.
Everyone is your friend and is perfect

OR

Not everybody is your friend, or someone is not perfect


Exercise 1:
What is the negation of the statement

Exercise 2:
Negation Equivalent statement When is true When is false
Exercise 3:
Let denotes the statement . If the universe of discourse
consists of all integers, what are these truth values?

a. Q(0)
b. Q(-1)
c. Q(1)
Discrete
Mathematics
Rules of
Inference for
Propositional
Logic
Introduction
Definition
( ( 𝒑 ∨ 𝒒 ) ∧ ( ¬ 𝒑 ∨𝒓 ) ) ⟶ ( 𝒒 ∨ 𝒓 ) 𝒊𝒔 𝒂 𝒕𝒂𝒖𝒕𝒐𝒍𝒐𝒈𝒚
Example
Example
Example
𝑝∧𝑞 Simplificatio
“I will make tea, and I will read a
∴𝑝 n (𝑝 ∧𝑞) ⟹𝑝
book.”
Therefore, “I will make tea.”
Example
Exercise
Discrete
Mathematics
Methods of
proof
Direct proof
Definition
Example
Example
Indirect proof
Proof by contraposition
Proof by contraposition
In a proof of the contrapositive, assume that q is false and
prove that f is false.
 For example, the contrapositive of "If it is Friday, I go to the
mosque'' is "If I am not going to the mosque, it is not Friday.‘’
 For example, if ab is even then either a or b is even: Assume
both a and b are odd. Since the product of odd numbers is odd,
ab is odd.
 ab is even then either a or b is
even
 We assume that ab is odd
 a and b are odd numbers,
a=2k+1, b=2k+1
 ab=(2k+1)(2k+1)
=4k2+4k+1
=2(2k2+k)+1
=2m+1 which is odd
Indirect proof
Proof by contradiction

 The proof will look something like this:


 Assume that PQ is false ( p is true and Q
is false)
 Using this assumption, derive
contradiction.
 Conclude that PQ must be true.
Indirect proof - Proof by contradiction
p q

1. We assume that n is odd.


n=2k+1
2. n2= (2k+1)2
𝒑 : n 2 is eve
=4k2+4k+1
=2(2k2+2k)+1
=2m+1 which is odd, then P is false (our
assumption is false)
3. is false, then by contradiction is true.
Solutions
Exercise 1 (Slide 97):
The negation of the statement is

¬ ( ∀ 𝒙 ( 𝒙 𝟐> 𝒙 ) ) =∃ 𝐱 ( 𝒙 𝟐 ≤ 𝒙 )
(

Exercise 2 (Slide 97):

You might also like