Lecture 4 Logic and Proofs
Lecture 4 Logic and Proofs
Logic Circuits
Application of Logic in IT and CS
Find p ^ q where
Find p v q where
12
13
Variety of ways to express conditional
statements:
“p implies q”
“p only if q”
“if p, then q”
“a sufficient condition for q is p”
“if p, q”
“q whenever p”
“p is sufficient for q”
“q is necessary for p”
“q if p”
“q follows from p”
“q when p”
“a necessary condition for p is q”
“q unless ¬p” 14
15
Converse, Contrapositive, and Inverse
CONVERSE of INVERSE of
CONTRAPOSITIVE of
16
p->q : If the triangle is isosceles, then
the base angles are congruent.
• Converse:
• If the base angles are congruent, then the triangle is
isosceles.
• Inverse:
• If the triangle is not isosceles, then the base angles
are not congruent.
• Contrapositive:
• If the base angles are not congruent, then the triangle is
not isosceles.
What are the contrapositive, the converse, and the inverse of the conditional statement?
19
20
Truth Table
What is a truth table?
Compound Propositions
Example:
Construct the truth table of the compound proposition:
26
27
Another Solution
T T F T T T T T
T T T F F T F F
F F F T T F F T
F T T F F F F F
28
29
30
31
32
33
Assignment: (Due Next Week)
34
35
Precedence of Logical Operators
36
Logic and Bit Operations
39
40
Examples: (C and D Seatwork)
41
Logic Circuits
Logic circuit (digital circuit)
● Propositional logic can be applied to the design of computer hardware.
This was first observed in 1938 by Claude Shannon in his MIT master’s
thesis.
44
Inverter (Not Gate)
Input Output
0 1
1 0
45
OR Gate Input
1
1 Output
0
0 1
1
1
1
0
0
1
0 46
AND Gate Input
1
1 Output
0
0 1
0
0
1
0
0
1
0 47
Combinatorial Circuit
48
Find the output of this
combinatorial circuit
49
Solution:
50
51
- (p ˄ (q ˅ -r))
q ˅ -r p ˄ (q ˅ -r)
-r
52
-p
-p˄-q
(- p ˄ - q)˅ (p ˄ r)
-q
p˄r
53
Your Turn
54
Answers:
-p
-p˅-q
-q
p v (- p ˄ q)
-p
-(p ˄ (- p ˄ q))
-p˄q
55
Exercise 1 (Show on the board)
Build a digital circuit that produces the
output (p ∨ ¬r) ∧ (¬p ∨ (q ∨ ¬r)) when
given input bits p, q, and r.
56
Solution to Exercise 1
(p ∨ ¬r) ∧ (¬p ∨ (q ∨ ¬r))
57
-p
-p ˅ -r
(-p ˅ -r) ˄ -q
-r
-q
-p
-p ˄ (q ˅ r)
q˅r
58
Your Turn
59