Propositional Logic
Propositional Logic
Predicate logic
Predicates.
Quantified predicate expressions.
Equivalences & derivations.
2
Propositional Logic
Propositional Logic is the logic of compound
statements built from simpler statements
using Boolean connectives.
Applications:
Design of digital electronic circuits.
Expressing conditions in programs.
Queries to databases & search engines.
3
Definition of a Proposition
A proposition (p, q, r, ) is simply a
statement (i.e., a declarative sentence) with
a definite meaning, having a truth value
thats either true (T) or false (F) (never
both, neither, or somewhere in between).
[In probability theory, we assign degrees of certainty
to propositions. For now: True/False only!]
4
Examples of Propositions
Operators / Connectives
An operator or connective combines one or
more operand expressions into a larger
expression. (E.g., + in numeric exprs.)
Unary operators take 1 operand (e.g., -3);
binary operators take 2 operands (eg 3 4).
Propositional or Boolean operators operate on
propositions or truth values instead of on
numbers.
6
A Simple Exercise
Let p=It rained last night,
q=The sprinklers came on last night,
r=The lawn was wet this morning.
Translate each of the following into English:
p
= It didnt rain last night.
The lawn was wet this morning, and
r p
= it didnt rain last night.
r p q = Either the lawn wasnt wet this
morning, or it rained last night, or
the sprinklers came on last night.
12
15
Examples of Implications
If this lecture ends, then the sun will rise
tomorrow. True or False?
If Tuesday is a day of the week, then I am a
penguin. True or False?
If 1+1=6, then George passed the exam.
True or False?
If the moon is made of green cheese, then I
am richer than Bill Gates. True or False?
18
p
F
F
T
T
q
F
T
F
T
q
T
F
T
F
p
T
T
F
F
pq q p
T
T
T
T
F
F
T
T
20
p
F
F
T
T
q pq
F T
T F
F F
T T
22
p
F
F
T
T
q
F
T
F
T
p pq pq pq pq pq
T F
F
F
T
T
T F
T
T
T
F
F F
T
T
F
F
F T
T
F
T
T
23
Precedence
2
3
4
5
24
not and or
p pq +
! && ||
~ & |
xor implies
!=
^
iff
==
Logic gates:
26
Propositional Equivalence
Two syntactically (i.e., textually) different
compound propositions may be
semantically identical (i.e., have the same
meaning). We call them equivalent. Learn:
Various equivalence rules or laws.
How to prove equivalences using symbolic
derivations.
31
Proving Equivalences
Compound propositions p and q are logically
equivalent to each other IFF p and q contain
the same truth values as each other in all
rows of their truth tables.
Compound proposition p is logically
equivalent to compound proposition q,
written pq, IFF the compound
proposition pq is a tautology.
32
Proving Equivalence
via Truth Tables
Ex. Prove that pq (p q).
p
F
F
T
T
q
F
T
F
T
pq p q p q (p q)
F
T
T
T
T T
T F
F T
F F
T
F
F
F
F
T
T
T
33
Equivalence Laws
These are similar to the arithmetic identities
you may have learned in algebra, but for
propositional equivalences instead.
They provide a pattern or template that can
be used to match much more complicated
propositions and to find equivalences for
them.
34
Identity:
p T p
p F p
Domination:
p T T p F F
Idempotent:
p p p
p p p
Double negation:
p p
Commutative: pq qp pq qp
Associative:
( p q ) r p ( q r )
(pq)r p(qr)
35
p(qr) (pq)(pr)
p(qr) (pq)(pr)
De Morgans:
(pq) p q
(pq) p q
36
An Example Problem
Check using a symbolic derivation whether
(p q) (p r) p q r.
(p q) (p r)
[Expand definition of ] (p q) (p r)
[Defn. of ] (p q) ((p r) (p r))
[DeMorgans Law]
(p q) ((p r) (p r))
39
Example Continued...
(p q) ((p r) (p r)) [ commutes]
(q p) ((p r) (p r)) [ associative]
q (p ((p r) (p r))) [distrib. over ]
q (((p (p r)) (p (p r)))
[assoc.] q (((p p) r) (p (p r)))
[trivial taut.] q ((T r) (p (p r)))
[domination] q (T (p (p r)))
[identity]
q (p (p r)) cont.
40