1 Logics
1 Logics
INTRODUCTI
Proposition: ON
A proposition is a statement that is either true or
false, but
not both.
Propositional Logic:
The area of logic that deals with propositions.
2
⚫ “Elephants are bigger than
mice.”
3
NEGATION (Unary
Operator)
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 as “not p.”
Examples
⚫ p:Today is Friday.
⚫ ¬p: Today is not
Friday. or
It is not Friday
today. to display
Truth the
between tables arevalue of
truth relationships
used
propositions. 4
⚫ “520 <
111”
Is this a ye
statement? s
Is this a ye
proposition? s
What is the truth fals
value of the e
proposition?
5
⚫ “y >
5”
Is this a ye
statement? s
Is this a n
proposition? o
Its truth value
depends on the value
of y, but this value is
not specified.
6
⚫ “What time is
it?”
Is this a statement?
no
Is this a n
proposition? o
A proposition has
to be a
statement.
7
Truth
table:
The Truth Table for the
Negation of a
Proposition.
p ¬p
T F
F T
9
CONJUNCTION: (Binary
Operator)
Let p and q be propositions. The conjunction of
p and q, denoted by pΛq, is the proposition “p
and q” which is true when both p and q are true
and is false otherwise.
Examples
p:“Today is Friday.”
q:“It is raining today.”
p Λ q: “Today is Friday and it is raining
today”.
11
DISJUNCTION: (Binary Operator)
Let p and q be propositions. The disjunction of
p and q, denoted by p ν q, is the proposition “p
or q” which is false when both p and q are false
and is true otherwise.
⚫ Note:
inclusive or : The disjunction is true when at
least one of the two propositions is true.
⚫ E.g. “Students who have taken
calculus or computer science can
take this class.”
13
CONDITIONAL STATEMENT:
Let p and q be propositions. The conditional
statement p → q, is the proposition “if p, then q”
which is false when p is true and q is false, and true
otherwise.
16
Other conditional
statements:
⚫ Converse of p → q : q → p
⚫ Contrapositive of p → q : ¬ q → ¬ p
⚫ Inverse of p → q : ¬ p → ¬ q
17
BICONDITIONAL STATEMENT:
Let p and q be propositions. The
biconditional statement
p q is the proposition “p if and only if q”
which is true when p and q have the same
truth values, and is false otherwise.
Example:
⚫ Let p be the statement “You can
take the flight”
and let q be the statement “You buy a
ticket.” 18
The Truth fo the
Table r q.
Biconditional
p
p q p q
T T T
T F F
F T F
F F T
“ p is necessary and sufficient
for q” “If p then q and
conversely”
19
Connectives can beuse to up complicated
compound d involving
build any number
propositions
propositional of
variables.
trut tabl of the
Example:Construct h e compound
the (p ν ¬q) → (p
proposition Λ q)
The Truth Table of (p ν ¬q) → (p Λ q).
p ¬q p ν ¬q pΛq (p ν ¬q) → (p Λ q)
q
T F T T T
T T T F F
T F F F F T
F T T F F
T
F F 20
PRECEDENCE OF LOGICAL
OPERATORS
Parentheses are used 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.
¬ 1
Λ 2
ν 3
→ 4
5
21
TRANSLATING ENGLISH
SENTENCES
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 unless you are older than 16 years
old.”
p → (q ν ¬r)
23
LOGIC PUZZLES
You visit an island where there are two kinds of
inhabitants, knights, who always tell the truth, and
knaves, who always lie. You encounter two people A
and B. A says “ B is a knight” and B says “ the two
of us are opposite types”. What are A and B?
Let p: A is a
knight
q: B is a knight
Suppose p is
true,
A’s statement
that B is a
knight is true. 24
TAUTOLOGY:
A compound proposition that is always
true, no matter what the truth values of the
propositions that occurs in it, is called a
tautology.
CONTRADICTION:
A compound proposition that is always
false is called a contradiction.
CONTINGENCY:
A compound proposition that is neither a
tautology or a contradiction is called a25
Examples of a Tautology and a
Contradiction.
p ¬p p ν ¬p p Λ ¬p
T F T F
F T T F
26
⚫ The compound propositions p and q are called
logically equivalent if p q is a tautology.
Notation p ≡ q
27
Logical Equivalences
Law Name
p Fp Identity laws
p Tp
p TT Domination laws
p FF
p p p Idempotent laws
p p p
( p) p Double-negation law
Law Name
p q q p Commutati
p q q p ve laws
(p q) r p (q r) Associative
(p q) r p (q r) laws
(p q) (p r) p (q r) Distributive
(p q) (p r) p (q r) laws
(p q) p q De Morgan’s
(p q) p q laws
p (p q) p Absorption laws
p (p q) p
Some useful
logical
Equivalences
p p
T p p
F
p →q
p q
⚫ Example: Show that ¬(p → q ) and p Λ ¬q are logically
equivalent. Solution:
¬(p → q ) ≡ ¬(¬p ν q)
≡ ¬(¬p) Λ De Morgan’s law
¬q Double negation
≡ p Λ ¬q law
⚫ 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
p νΛ¬q) (pν q) De Morgan’s law
ν q) Associative and
≡ (¬ p ν p) ν (¬ q Commutative
ν
≡T q)ν law
T
≡T
3
Prove Absorption
Laws
p (p q)
p p (p q)
p Proof
p (p q) (p T) (p
q)
p (T q)
p T
p