0% found this document useful (0 votes)
3 views30 pages

Logic

Uploaded by

hanaefodil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views30 pages

Logic

Uploaded by

hanaefodil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

“Young man, in Mathematics you don’t understand

things. You just get used to them.”


John von Neumann
ENSIA, September 2022

Lecture 1 : Logic
Contents

 Definitions
 Operators
 Predicates and Quantifiers
 Methods of Proof
Definitions

Proposition
A proposition is a mathematically precise statement that is
either true or false, but not both.
Examples

 The statement “1 + 1 > 3” is false, while the statement


“5 > 3” is true. Both statements are propositions.
 The statement “What a great book!” is not a proposition.
Someone is simply expressing an opinion.
 The statement “𝑥 + 1 < 7” is not a proposition. The truth
value of this statement relies on what the variable x is
assigned.
Examples

 The statement “It is cold outside” is not a proposition,


because it lacks precision. Without a definite definition of
cold, one cannot assign to the statement a truth value.
 The statement “5 + 7” is not a proposition, because it does
not have a truth value.
 The statement “5 + 7 = 12” is a proposition, because it has
a truth value, namely true.
Definitions

Paradox
A paradox is a statement that cannot be assigned a truth value.
Example 1
“This statement is false”
If true, than false and if false, then true.
Example 2
A classic example of a paradox is the barber paradox. It states:
“The barber shaves every man in town who does not shave himself.”
If the barber shaves himself, then this means the barber does not shave
himself and if he does not shave himself then he must shave himself. Neither
is possible and so it is a paradox.
Definitions

We are particularly interested in combining propositions by operators.

Definition
A compound proposition is a statement obtained by combining propositions with
logical operators.
operators

1. ∧ conjunction (and)
Truth Table :
p q p∧q q∧p
T T T T
T F F F
F T F F
F F F F

This time, for p ∧ q to be true, we need both p and q to be true.


Note that ∧ is also commutative.
Operators

2. ∨ disjunction (or)
Truth Table:
p q p∨q q∨p
T T T T
T F T T
F T T T
F F F F

The disjunction operator returns T when at least one of the two propositions p or q is true.
The operator ∨ is commutative.
Operators

Remark
More than two propositions can be joined using logical operators.
In this instances, it is important to be careful about how they are grouped.

Example
2+1=4 ∧ 2+2=5 ∨ 5 − 2 = 3 is true
2 + 1 = 4 ∧ ( 2 + 2 = 5 ∨ 5 − 2 = 3 ) is false
Operators

3. ¬ negation (not)
Truth Table:

p ¬p
T F
F T
Operators

4. ⊕ exclusive (xor)
Truth Table:
p q p⊕q
T T F
T F T
F T T
F F F

The statement is true if and only if exactly one of the statements is true.
Operators

5. Implication ( ⟹)

The statement ¬p ∨ q is denoted by p ⟹ q.


We say

1) p implies q
2) If p, then q
Operators

Truth table
p q ¬p p⟹q
(¬p ∨ q)
T T F T
T F F F
F T T T
F F T T

The converse of p ⟹ q is q ⟹ p.
The contrapositive of p ⟹ q is ¬q ⟹ ¬p
Operators

6. Equivalence (⟺ )
p ⟺ q means (p ⟹ q and q ⟹ p).
Truth table
p q p⟹q q⟹p p⟺q
T T T T T
T F F T F
F T T F F
F F T T T

Equivalent Propositions
Two propositions are equivalent if they have identical truth tables.
Properties
1) (p ∧ q) ⟺ (q ∧ p)
2) (p ∨ q) ⟺ (q ∨ p)
3) (p ∧ q) ∧ r ⟺ p ∧ (q ∧ r)
4) (p ∨ q) ∨ r ⟺ p ∨ (q ∨ r)
5) p ∧(q ∨ r) ⟺ (p ∧ q) ∨(p ∧r)
6) p ∨ (q ∧ r) ⟺ (p ∨ q) ∧ (p ∨ r)
7) ¬(¬ p) ⟺ p
8) ¬(p ∧ q) ⟺ (¬ p) ∨(¬ q)
9) ¬(p ∨ q) ⟺ (¬ p) ∧ (¬ q)
10) (p ⟹ q) ⟺ (¬q ⟹ ¬p)
11) ((p ⟹ q) ∧ (q ⟹ r)) ⟹ (p ⟹r)
12) ((p ⟺ q) ∧ (q ⟺ r)) ⟹ (p ⟺ r)
An amizing exercise

The Island of Knights and Knaves.


On the island, Knights always tell the truth and Knaves always lie.
You meet two islanders A and B. A says :
I am a Knave but he is not
You need to decide what are A and B.
Let
p the statement : A is a knight
And
q the statement : B is a knight
Predicates and Quantifiers

Definiton
A predicate is a statement that contains variables. A predicate may be true or
false depending on the values of these variables.
Predicates and Quantifiers

 Universal quantifier
∀ 𝑥 (for all x), 𝑃(𝑥)

means that the predicate 𝑃(𝑥) is true for all possible values of 𝑥.
Predicates and Quantifiers

 Existential quantifier
∃ 𝑥 (there exists 𝑥), 𝑃(𝑥)
Means that there exists an 𝑥 where 𝑃 𝑥 is true.
Sometimes, we will use also
∃! 𝑥, 𝑃(𝑥)
It means that there exists a unique 𝑥 where 𝑃(𝑥) is true.
Predicates and Quantifiers

Consider the universal statement


∀ 𝑥 , 𝑃(𝑥).
This asserts that 𝑃 𝑥 is true for all values of 𝑥 . Hence, if it is false, then this
means that there exists an 𝑥 such that 𝑃(𝑥) is false.
Similarly, the existential statement
∃ 𝑥 , 𝑃(𝑥)
asserts that there is an 𝑥 where 𝑃 𝑥 is true. Hense, if it is false, this means that
for all values of 𝑥 , 𝑃 𝑥 is false, that is ¬ 𝑃(𝑥) is true . Therefore, we have the
following :
Predicates and Quantifiers

¬ ∀ 𝑥, 𝑃 𝑥 ⟺ ∃ 𝑥, ¬𝑃 𝑥

¬ ∃ 𝑥, 𝑃 𝑥 ⟺ ∀ 𝑥, ¬𝑃 𝑥
Predicates and Quantifiers

Example 1
The statement
∀ 𝑥 ∈ ℤ, 𝑥2 = 5 ⟹ 𝑥 = 2
is true.
Example 2
The statement
∃ 𝑥 ∈ ℝ, 𝑥 2 = 2
is true, but the statement
∃ 𝑥 ∈ ℤ, 𝑥 2 = 2
is false.
Predicates and Quantifiers

Example 3
Some statement involve several quantifiers.
The statement
∀ 𝑥 ∈ ℝ, ∃ 𝑦 ∈ ℝ, 𝑦 > 𝑥
means that for all 𝑥 ∈ ℝ, there exists 𝑦 ∈ ℝ such that 𝑦 > 𝑥.
This statement is true.
The order of the quantifiers is very important.
The statement
∃ 𝑦 ∈ ℝ, ∀ 𝑥 ∈ ℝ, 𝑦 > 𝑥
is false.
Predicates and Quantifiers

Examples
Statement : ∀ 𝑥 ∈ ℝ, 2𝑥 < 3
Negation : ∃ 𝑥 ∈ ℝ, 2𝑥 ≥ 3

Statement :∃ 𝑥 ∈ ℝ, 2𝑥 = 256
Negation :∀𝑥 ∈ ℝ, 2𝑥 ≠ 256

Statement :∃ 𝑦 ∈ ℝ, ∀ 𝑥 ∈ ℝ, 𝑦 > 𝑥
Negation : ∀ 𝑦 ∈ ℝ, ∃ 𝑥 ∈ ℝ, 𝑦 ≤ 𝑥
Methods of proof

 Direct Proof
𝐴⟹𝐵
Example
Let 𝑎, 𝑏 ∈ ℤ. Show that
𝑎+𝑏 2= 0⟹𝑎 =𝑏 = 0
 Proof by contrapositive
We show ¬𝐵 ⟹ ¬𝐴 instead of 𝐴 ⟹ 𝐵
Example
Let 𝑛 ∈ ℕ∗ .
Show that
𝑛2 − 1 is not divisible by 8 ⟹ 𝑛 is even
Methods of proof

 Proof by contradiction
To show that 𝑝 is true, we suppose that 𝑝 is false and than ¬𝑝 is true.
We show that ¬𝑝 ⟹ ¬𝑞, where 𝑞 is true.
So q ⟹ 𝑝 is true.
As 𝑞 is true then 𝑝 is true.
Example
Show that 0 does not admit an inverse in ℝ.
Methods of proof

4. By induction
Let 𝑃(𝑛) be a logical statement for each 𝑛 ∈ ℕ. The principle of mathematical
induction states that 𝑃(𝑛) is true all 𝑛 ∈ ℕ if :
1. 𝑃(1) is true, and
2. 𝑃(𝑛) → 𝑃(𝑛 + 1) 𝑓𝑜𝑟 𝑎𝑙𝑙 𝑛 ∈ ℕ
Example
Show that for all 𝑛 ∈ ℕ∗ , we have 2𝑛−1 ≤ 𝑛! ≤ 𝑛𝑛 .
Methods of proof
5. By giving a counter example
To show that a proposition 𝑝 is false, we must show that ¬𝑝 is true.
Example 1
Let 𝑓: ℝ ⟶ ℝ a function defined by 𝑓 𝑥 = 𝑥 2 .
Show that the proposition :
∀ 𝑥, 𝑦 ∈ ℝ, 𝑓 𝑥 = 𝑓 𝑦 ⟹ 𝑥 = 𝑦
is false.
Example 2
Show that the proposition
∀ 𝑦 ∈ ℝ, ∃𝑥 ∈ ℝ, 𝑓(𝑥) = 𝑦
is false.

You might also like