FariaJameel 2497 16587 7 Lecture 1
FariaJameel 2497 16587 7 Lecture 1
FariaJameel 2497 16587 7 Lecture 1
Faria Jameel
[email protected]
Consultation hours: 12.30pm-1.30pm Mon-Thu
Grading
Policies
No late homework accepted.
Written solutions must be your own
12/22/2020
Expectations
12/22/2020
Propositional Logic
Statement (Proposition)
3x3=8 False
787009911 is a prime
Non-examples: x+y>0
x2+y2=z2
Suppose p is a proposition.
The negation of p is written p and has meaning:
“It is not the case that p.”
p p
Truth table for negation:
T F Notice that
F T p is a
proposition!
12/22/2020
Propositional Logic - conjunction
p q pq
p q pq
p q pq
And the formula is true exactly when the input is the second row or the third row.
Exclusive-Or
And the formula is true exactly when the input is not in the 1st row and the 4th row.
Logical Equivalence
p q
T T F T F F
T F T T T T
F T T T T T
F F F F T F
As you see, there are many different ways to write the same logical formula.
One can always use a truth table to check whether two statements are equivalent.
Writing Logical Formula for a Truth Table
Digital logic:
Now, suppose we are given only the truth table (i.e. the specification),
how can we construct a circuit (i.e. formula) that has the same function?
Writing Logical Formula for a Truth Table
p q r output
T T T F
T T F T
T F T T
T F F F
F T T T
F T F T
F F T T
F F F F
The formula is true exactly when the input is one of the true rows.
Writing Logical Formula for a Truth Table
p q r output
T T T F
T T F T
T F T T
T F F F
F T T T
F T F T
F F T T
F F F F
The formula is true exactly when the input is not one of the false row.
DeMorgan’s Laws
Logical equivalence: Two statements have the same truth table
Negation: Tom is not in the football team or not in the basketball team.
De Morgan’s Law
Negation: The number 783477841 is not divisible by 7 and not divisible by 11.
De Morgan’s Law
DeMorgan’s Laws
Logical equivalence: Two statements have the same truth table
De Morgan’s Law
T T F F
T F T T
F T T T
F F T T
De Morgan’s Law
Simplifying Statement
DeMorgan
Distributive law
• Truth table
• Two statements are called logically equivalent if and only if (iff) they have
identical truth tables
• Double negation
• Non-equivalence: ~(p q) vs ~p ~q
• De Morgan’s Laws:
• Distributive laws: p (q r) = (p q) (p r)
p (q r) = (p q) (p r)
• Identity laws: p t = p, p c = p
• Negation laws: p ~p = t, p ~p = c
• Idempotent laws: p p = p, p p = p
• Absorption laws: p (p q) = p, p (p q) = p
• Negation of t and c: ~t = c, ~c = t
Exercises
• Simplify: ~(~p q) (p q)
• Is XOR associative?
p p p p p p
T F T F
F T T F
12/22/2020
Propositional Logic -
12/22/2020
Propositional Logic - proof
L3 32
Tautologies and contradictions
p p p p p p p p
F T T F T F
T F T T F F
L3 33
Tautology example (1.2.8.a)
Part 1
Demonstrate that
[¬p (p q )]q
is a tautology in two ways:
1. Using a truth table – show that [¬p (p q )]q is always true
L3 34
Tautology by truth table
T F
F T
F F
L3 35
Tautology by truth table
T F F
F T T
F F T
L3 36
Tautology by truth table
T F F T
F T T T
F F T F
L3 37
Tautology by truth table
T F F T F
F T T T T
F F T F F
L3 38
Tautology by truth table
T F F T F T
F T T T T T
F F T F F T
L3 39
Tautologies, contradictions and programming
L3 40
Which is true?
Which is false?