RPG 2 Logic1
RPG 2 Logic1
RPG 2 Logic1
2. Fundamentals of Logic
Primitive statement:
a statement that can not be broken down into
simpler form and it is either true or false but can
not be both.
Example:
p: John is a student
q: UK is a university
Compound statement:
a statement that is formed of primitive state-
ments with logical connectives such as
1. Negation: p (or, ¬ p)
2. Conjunction: p Λ q ( p and q)
3. Disjunction: p V q ( p or q)
4. Implication: p → q ( p implies q)
5. Equivalence: p← → q ( p if and only if q)
-31-
"If x = 3 then x 2 = 9" is a true statement
"If x = 5 then x + 2 = 11" is a false statement
------------------------------------------------------------------
p p
0 1
1 0
Notations:
T o : tautology
F o : contradiction
-33-
Theorem: a (mathematical) statement that can
be shown to be true.
Example: p V p is a tautology
p p pV p
0 1 1
1 0 1
p → ( p V q) is a tautology
p q pVq p → ( p V q)
0 0 0 1
0 1 1 1
1 0 1 1
1 1 1 1
-34-
Logical Equivalence: The Laws of Logic:
- use truth tables and propositions to determine
when two statements are functionally equiv-
alent
Examples:
( p → q) <=> ( p V q)
→q) <=> ( p → q) Λ (q → p)
( p←
DeMorgan’s Law
pΛq <=> p V q
p V q <=> p Λ q
-35-
Distributive Law
p Λ (q V r) <=> ( p Λ q) V ( p Λ r)
p V (q Λ r) <=> ( p V q) Λ ( p V r)
Commutative Law
p V q <=> q V p
p Λ q <=> q Λ p
Associative Law
p Λ (q Λ r) <=> ( p Λ q) Λ r
p V (q V r) <=> ( p V q) V r
Idempotent Law
p V p <=> p ; p Λ p <=> p
Idnetity Law
p V F o <=> p ; p Λ T o <=> p
-36-
Inverse Law
p V p <=> T o ; p Λ p <=> F o
Domination Law
p V T o <=> T o ; p Λ F o <=> F o
Absorpion Law
p V ( p Λ q) <=> p ; p Λ ( p V q) <=> p
LHS <=> ( p V q) Λ (( p Λ p) Λ q)
<=> ( p V q) Λ ( p Λ q)
<=> ( p Λ ( p Λ q) V (q Λ ( p Λ q))
<=> (( p Λ p) Λ q) V ( p Λ q)
-37-
<=> (F o Λ q) V ( p Λ q)
<=> F o V ( p Λ q)
<=> p Λ q
-----------------------------------------------------------
Example:
s: pV p
sd : pΛ p
-38-
Theorem 2.1: (The Principle of Duality)
s, t: statements
If s <=> t then s d <=> t d
Subsitution Rule:
(1) P: compound statement and a tautology
If p is a statement that appears in P and we
replace each occurence of p with the same
statement q then the resulting compound
statement Q is also a tautology
Example:
Simplify (P Λ q) → r
<=> ( p Λ q) V r
<=> ( p Λ q) Λ r
<=> ( p Λ q) Λ r
-40-
How to use logic laws to simplify logic circuits:
p
T1 T2
p
p q
T1 T2 T1 T2
q
pVq pΛ
p p p p
q t t
T1 T2 T1 t T2
r q r r
q
(a) (b)
( p V q V r) Λ ( p V t V q) Λ ( p V t V r)
<=> p V ((t V q) Λ r)