0% found this document useful (0 votes)
8 views12 pages

RPG 2 Logic1

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 12

-30-

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
------------------------------------------------------------------

Truth Table: 1: true 0: false

p p
0 1
1 0

p q pΛq pVq p→q →q


p←
0 0 0 0 1 1
0 1 0 1 1 0
1 0 0 1 0 0
1 1 1 1 1 1

Note: Two statements are equivalent if their


truth tables are the same.
-32-
Note: ( p → q) ←
→ ( p V q)

p→q (not ture only if the


implication is violated)

If the hypothesis is not satisfied, then no


matter what truth value q has, the
implication is not violated

Tautology: a statement that is always true


pV p
Contradiction: a statement that is always false
pΛ p

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

Def: Two statements s1 and s2 are said to be


logically equivalent, denoted s1 <=> s2 , when
the truth tables for s1 and s2 are the same.

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

Law of Double Negation


p <=> p

Example: Prove the following is true


( p V q) Λ ( p Λ ( p Λ q)) <=> ( p Λ q)

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

-----------------------------------------------------------

s: statement involving only Λ , V


s d : dual of s, by replacing Λ , V , T o ,
F o with V , Λ , F o T o

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

Proof can be proved using Boolean algebra.


However, we will not prove it until Chapter 15.

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

Proof. If p is replaced with q, then the same


truth values can be applied to q as well.
Since with these truth values, P is a tautol-
ogy, Q must be a tautology too.
-39-
(2) P: compound statement
p: a statement appears in P
If q is a statement such that p <=> q then if
we replace each occurence of p in P with q
then the resulting compound statement
Q <=> P

Proof. Similar to the above case.

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:

Example: Network with one switch:

p
T1 T2

Current flows from T 1 to T 2 if the switch p is


closed.

p
p q
T1 T2 T1 T2
q
pVq pΛ

In the first case, current flows from T 1 to T 2 if


either of the switches p, q is closed. In the sec-
ond case, current flows from T 1 to T 2 if both
switches are closed.
-41-
In the following, prove that (a) and (b) are
equivalent.

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 ((q V r) Λ (t V q) Λ (t V r))

<=> p V ((t V q) Λ ((q Λ t) V r))

<=> p V ((t V q) Λ ((q Λ t) V r))

<=> p V (((t V q) Λ (q Λ t)) V ((t V q) Λ r))

<=> p V (F o V ((t V q) Λ r))

<=> p V ((t V q) Λ r)

You might also like