0% found this document useful (0 votes)
9 views80 pages

2 Propositional Logic

The document provides an overview of propositional logic, focusing on the structure and evaluation of logical statements and arguments. It discusses key concepts such as truth values, logical operators (AND, OR, NOT), conditional and biconditional propositions, and the importance of logical reasoning in fields like computer science. Additionally, it covers deductive reasoning and the formation of valid arguments through premises and conclusions.

Uploaded by

CHA ZI YU Moe
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)
9 views80 pages

2 Propositional Logic

The document provides an overview of propositional logic, focusing on the structure and evaluation of logical statements and arguments. It discusses key concepts such as truth values, logical operators (AND, OR, NOT), conditional and biconditional propositions, and the importance of logical reasoning in fields like computer science. Additionally, it covers deductive reasoning and the formation of valid arguments through premises and conclusions.

Uploaded by

CHA ZI YU Moe
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/ 80

Propositional Logic

Introduction to Logic
• The study of reasoning
• Focuses on the relationship among
statements as opposed to the content of any
particular statement.
• Example:
All cats have 4 legs
Yordana is a cat
Therefore, Yordana has 4 legs

2
Introduction to Logic
• Must follow rules and techniques to get
valid conclusion/argument
• Example of logical fallacy:
All cats have four legs
My dog has four legs
Therefore, my dog is a cat.

3
Introduction to Logic
• Must follow rules and techniques to get
valid conclusion/argument
• Example of logical fallacy:
All cats have four legs
My dog has four legs
Therefore, my dog is a cat.

Fallacy!!!

4
Why we learn Logic?
• The way of reasoning is the root of
computer science
• Applications include:
– Automated reasoning in artificial
intelligence
– Logic gates in computer hardware
– specification and verification in software
engineering
– Semantics and logic in programming
5
Topics in Logic
• Propositional logic
• Predicate logic
• Proof

6
Propositional Logic
Statement / Proposition
• Statement/Proposition : a sentence that is
either TRUE or FALSE, but not both.
(a declarative sentence)
• Examples:
✔ I can run.
✔ I can fly while eating
✔2 > 1
✔1 > 2
✔ Birds can fly and elephants can swim.
✔ University of Malaya is in Malaysia.

8
These are not propositions:

Where is University of Malaya?

Who has taken my pillow?

Please show me your ticket.

Buy me a dozen of eggs when you
come home.

9
Exercise
• Is 3 greater than 2?
• I need a pencil.
• Buy me a pencil.
• If I have a pencil, I can draw.
• 1+1 = 3
• When elephants swim, they uses their wings
as paddles and breath with gills.
• I win the jackpot!
• This sentence is not a proposition.

10
What is Propositional Logic?
• The area of logic that
deals with
propositions
• First developed
systematically by the
Greek philosopher
Aristotle more than
2300 years ago.

11
Symbolize Statement
• We can use variables (a, b, c, P, Q, R,
…) to represent propositions.
• Examples:

p: I can run.

q: 1+1 =3

A: Apples in Malaysia are imported

B: Bicycles have windscreens

C: Canada is in Asia

12
Negation, ¬
• Negation of p, denoted ¬p, is the
proposition:
not p
• Example:
p : Bicycles have windscreens
¬p : Bicycles do not have windscreens

13
Negation, ¬
• Negation of p, denoted ¬p, is the
proposition:
not p
• Example:
p : Bicycles have windscreens
¬p : Bicycles do not have windscreens
• Or, in English, we can use “It is not the case
that p” to express a negation.
• Notations: ¬p , ~p , !p , p' or p.
14
Truth value and truth table
• A proposition has a truth value – it is
TRUE or FALSE.
• Example:
 p: 2 is an even number T
 ¬p: 2 is not an even number F

15
Truth value and truth table
• A proposition has a truth value – it is
TRUE or FALSE.
• Example:
 p: 2 is an even number T
 ¬p: 2 is not an even number F
• Truth table
p ¬p
T F
F T 16
Exercise
State the negations of the following
prepositions:
• Q : Birds can swim
• R : 3+5 = 8
• S : 2+5 < 0

17
AND, ⋀
• We can combine propositions with
AND (conjunction).
• Example:
p: 2+2=4
q: birds can swim.
• “p AND q”, or “p ⋀ q” is
2+2=4 and birds can swim.

18
Truth Table of AND

P Q P⋀Q
T T T
T F F
F T F
F F F

19
Truth Table of AND

P Q P⋀Q
T T T
T F F
F T F
F F F
NOTE : TRUE only when both P and Q are TRUE.
20
Exercise
Symbolize the following sentences.
Use AND and negation operators if
needed.
• Vincent Van Gogh is a famous painter
and I have one of his painting.
• Vivaldi played guitar or Michael
Jackson played Tik Tok.
• BTS sings dangdut but P Ramli did not
sing K-POP.

21
Exercise
If p is TRUE, q is FALSE, r: “5>3”, s:
“Durians growth in Malaysia” and t:
“Sundays come after Mondays”.
Find the truth values of:
• ¬p ⋀ ( r ⋀ s)
• q ⋀ ¬ (t ⋀ r)
• ¬p ⋀ ¬( s ⋀ r ⋀ ¬t )

23
OR, ⋁
• We also can combine propositions with
OR (disjunction).
• Example:
p: 10 is odd number
q: 10 is greater then 5.
• “p OR q”, or “p ⋁ q” is
10 is odd number or 10 is greater then
5.
24
Truth Table of OR

P Q P⋁Q
T T T
T F T
F T T
F F F

25
Truth Table of OR

P Q P⋁Q
T T T
T F T
F T T
F F F
Note : FALSE only when both P and Q are FALSE.
26
Operator precedence
• In propositions involve multiple
operators, order of evaluation:
Negation >> AND >> OR.

27
Operator precedence
• In propositions involve multiple
operators, order of evaluation:
Negation >> AND >> OR.
• Example:
¬ TRUE ⋀ ¬ TRUE ⋁ TRUE

28
Operator precedence
• In propositions involve multiple
operators, order of evaluation:
Negation >> AND >> OR.
• Example:
¬ TRUE ⋀ ¬ TRUE ⋁ TRUE
= FALSE ⋀ FALSE ⋁ TRUE

29
Operator precedence
• In propositions involve multiple
operators, order of evaluation:
Negation >> AND >> OR.
• Example:
¬ TRUE ⋀ ¬ TRUE ⋁ TRUE
= FALSE ⋀ FALSE ⋁ TRUE
= FALSE ⋁ TRUE
= TRUE
30
Conditional Proposition
• The propositions in the form
if p then q
are conditional propositions that denote as :
p → q.
• Example:
If the apple is red,
then it is delicious.
• p: the apple is red (antecedent)
• q: the apple is delicious (consequent)
33
Truth Table of Conditional
Proposition
Given: If the apple is red, then it is delicious.

p q p→q
The apple is red,
T T T it is delicious

T F
F T
F F
34
Truth Table of Conditional
Proposition
Given: If the apple is red, then it is delicious.

p q p→q
The apple is red,
T T T it is delicious
The apple is red,
T F F but not delicious! No
way!

F T
F F
35
Truth Table of Conditional
Proposition
Given: If the apple is red, then it is delicious.

p q p→q
The apple is red,
T T T it is delicious
The apple is red,
T F F but not delicious! No
way!

F T T The apple is green!

F F T The apple is green!

36
Some ways to express
conditional propositions
• if p, then q
• if p, q
• p is sufficient for q
• q if p
• q when p
• a necessary condition for p is q
• q unless ¬p

37
Exercise
Construct truth tables for the following
propositions:
• p⋀q→r
• p ⋁ q → ¬r
• p→(q→r)

Note: Evaluate → after OR operators.

38
Biconditional Proposition
• Bidirectional Propositions – in the form:
p if and only if q
• Example : Integer x is divisible by 2 if
and only if x is an even number.
• Denote as : p↔q
• Can be written as p iff q

39
Truth Table of
Biconditional Proposition
p q p↔q

T T T

T F F

F T F

F F T

Note : TRUE iff both P and Q have same values


40
Order of Precedence

41
Exercise
Restate each proposition in the form of a
conditional or biconditional proposition:
• Mary will be a good student if she studies
hard.
• When you sing, my ears hurt.
• I sing if and only if you dance.
• John takes Calculus II if and only if he
has passed his Calculus I.
• If John go, I go , but If John is going to
absent, I will follow. 42
Converse, Inverse,
Contrapositive
• The converse of the conditional proposition
p→q is the proposition q→p
• The inverse of the conditional proposition
p→q is the proposition ~p →~q
• The contrapositive of the conditional
proposition p→q is the proposition ~q→~p

43
Converse, Inverse,
Contrapositive
• The converse of the conditional proposition
p→q is the proposition q→p
• The inverse of the conditional proposition
p→q is the proposition ~p →~q
• The contrapositive of the conditional
proposition p→q is the proposition ~q→~p

• Converse and Inverse propositions may


bring different meanings
• Contrapositive propositions are equivalent
to the original ones. 44
Tautologies, Contradictions
and Contingency
• If a proposition evaluates to TRUE
regardless of the input values, then the
proposition is called a tautology.
• If a proposition evaluates to FALSE
regardless of the input values, then the
proposition is called a contradiction
• A proposition that is neither a tautology
nor a contradiction is a contingency

45
Example of Tautology
p V ~(pΛq)

p q (pΛq) ~(pΛq) p V ~(pΛq)

T T T F T

T F F T T

F T F T T

F F F T T
46
Example of Contradiction
(pΛq) Λ ~(pVq)

(pΛq) Λ
p q (pΛq) ~(pVq)
~(pVq)
T T T F F

T F F F F

F T F F F

F F F T F
47
Logical Equivalent
• Assume A and B are two propositions,
A=………
B=……
• A and B are “logically equivalent”, or
AÛB
iff A and B have the same truth values.
• 2 ways to determine logical equivalent:
– Truth Table
– Laws of Logic 48
Truth Table
• 2 propositions are logical equivalent if
they same truth values
• Example: show that p→q and ~pVq
are logically equivalent

Same truth values


→ logical equivalent

49
Example
• Example: show that p→q and q→p
are not logically equivalent
p q p→ q q→ p

T T T T Different truth values


→ not logical equivalent
T F F T

F T T F

F F T T
50
Laws of Logic

51
Laws of Logic

p → q ≡ ¬p ∨ q Law of Implication
52
Example

¬( p∨(¬ p∧q))
=¬(( p∨¬ p)∧( p∨q)) Distributive law

=¬(T ∧( p∨q)) Negation law

=¬( p∨q) Identity law

=¬ p∧¬q De Morgan’s law


53
Example

( p∧q)→( p∨q)
=¬( p∧q)∨( p∨q) Implication law

=(¬ p∨¬q)∨( p∨q) De Morgan’s law

=¬ p∨¬q∨ p∨q Associative law

=(¬ p∨ p)∨(¬q∨q) Associative law

=T ∨T =T Negation law 54
Deductive Reasoning

55
Deductive Reasoning
• Consider the following sequence of
propositions.
a)We are looking for a man either in black or yellow shirt
b)The man with black shirt is wearing jeans.
c)The man we are looking for is not wearing jeans

56
Deductive Reasoning
• Consider the following sequence of
propositions.
a)We are looking for a man either in black or yellow shirt
b)The man with black shirt is wearing jeans.
c)The man we are looking for is not wearing jeans

• Assuming that these statements are true,


it is reasonable to conclude:
The man we are looking for is wearing yellow shirt

• drawing a conclusion from a sequence of


propositions → Deductive Reasoning
57
Deductive Reasoning
The following is an argument.

a)We are looking for a man either in black or yellow shirt


b)The man with black shirt is wearing jeans.
c)The man we are looking for is not wearing jeans
-----------------------------------------------------------------
Therefore, the man we are looking for is wearing yellow shirt

58
Deductive Reasoning
The following is an argument.

a)We are looking for a man either in black or yellow shirt


b)The man with black shirt is wearing jeans.
c)The man we are looking for is not wearing jeans
-----------------------------------------------------------------
Therefore, the man we are looking for is wearing yellow shirt

(a), (b), (c) are called hypothesis / premises

“Therefore, … ….” is the conclusion


59
Arguments
Many proofs in mathematics and computer science
are deductive arguments.

Arguments have the form:


If p1 and p2 and · · · and pn, then q.
Arguments are said to be valid if the conclusion
follows from the hypotheses; that is:
if p1 and p2 and · · · and pn are true,
then q must also be true.
60
Valid or Invalid
• In a valid argument, we sometimes say
that the conclusion follows from the
hypotheses.
• Note: We are not saying that the
conclusion is true; we are only saying
that if you grant the hypotheses, you
must also grant the conclusion.
• An argument is valid because of its
form, not because of its content.
61
Examples of Valid Argument
• If I study hard, then I get A’s. I study
hard. Therefore I get A’s.

• If I study hard, then I get A’s or I get


rich. I don’t get A’s and I don’t get rich.
Therefore I don’t study hard.

62
Rules of Inference
• A proof uses the hypotheses, axioms,
definitions, and so on to reach a
conclusion. Each step of the proof
involves drawing intermediate
conclusions.

• For the proof as a whole to be valid,


each step of the proof must result in a
valid, intermediate conclusion.
63
Rules of Inference
• When we construct a proof, we often
use intuition to guide us in drawing
valid, intermediate conclusions;
however, the process can be
formalized.

• Rules of inference, which are brief,


valid arguments, can be used to prove
a larger argument such as a proof.
64
Rules of Inference
Modus Example
Ponens

p→q
p
---------
∴q
65
Rules of Inference
Modus Example
Ponens
If this object is made of copper,
p→q it will conduct electricity.
p This object is made of copper.
---------
∴q Therefore, it will conduct
electricity
66
Rules of Inference
Modus Example
Tollens

p→q
~q
---------
∴ ~p
67
Rules of Inference
Modus Example
Tollens

p→q If I am hungry I eat a lot


~q I don’t eat a lot
---------
∴ ~p
So I am not hungry
68
Rules of Inference
Conjunction Example
elimination

p /\ q
---------
∴p
∴q
69
Rules of Inference
Conjunction Example
elimination
2 is a prime number, but
p /\ q it is even
---------
∴p 2 is a prime number
∴q 2 is an even number

70
Rules of Inference
Disjunction Example
introduction

p
---------
∴pVq

71
Rules of Inference
Disjunction Example
introduction
Socrates is a man.

p
--------- So, either “Socrates is a man”
or “ice is cold”
∴pVq
So, either “Socrates is a man”
or “ice is hot”
72
Rules of Inference
Disjunctive Example
Syllogism

pVq
~p
---------
∴q
73
Rules of Inference
Disjunctive Example
Syllogism
Mr Bean is handsome or
pVq funny
~p
--------- Mr bean is not handsome
∴q
Mr Bean is funny
74
Rules of Inference
Hypothetical Example
Syllogism

p→q
q→r
---------
∴p→r
75
Rules of Inference
Hypothetical Example
Syllogism
If it rains, we will not have a
p→q picnic.

q→r If we don't have a picnic, we


won't need a picnic basket.
---------
Therefore, if it rains, we
∴p→r won't need a picnic basket.

76
Rules of Inference
Dilemma Example

pVq
p→r
q→s
---------
∴rVs
77
Rules of Inference
Dilemma Example

pVq Either we take LRT or we drive

p→r If we take LRT, we pay the fare


q→s If we drive, we pay tolls
--------- So, either we pay LRT fare or
∴rVs we pay tolls

78
There are some common
fallacy
Affirming the consequent

p→q
q
---------
∴p
79
There are some common
fallacy
Affirming the consequent

p→q If am in Thailand, then I am in Asia.


q I am in Asia.
---------
∴p Therefore I am in Thailand.

80
There are some common
fallacy
Denying the antecedent

p→q
~p
---------
∴ ~q
81
There are some common
fallacy
Denying the antecedent

p→q If am in Thailand, then I am in Asia.


~p I am not in Thailand.
---------
∴ ~q Therefore I am not in Asia.

82
Exercise
• Fishing is a popular sport or reading
poetry is wildly popular in Malaysia.
Reading poetry is not wildly popular in
Malaysia. Therefore, fishing is a
popular sport.
• If birds can fly or swim, then they can
find food. Birds can fly. Tigers can find
food. Therefore, birds and tigers can
find food.
83

You might also like