Propositional Calculus
Topics
Motivation: SimplifyingConditional
Expressions
Rules of Boolean Algebra
Proofs Using Truth Tables
Simplification and Equational Reasoning
Logic Circuits
Functional Completeness of nand
Tautologies, Satisfiability and Automatic
Verification
3.
3
Programming Example
Booleanexpressions arise in conditional statements. It is
possible to abstract the relations with boolean variables
(propositions that are either true or false). Using this
abstraction one can reason and simplify conditional
statements.
if ((a < b) || ((a >= b) && (c == d))) then { … } else { … }
Let p denote the relation (a<b) and q denote the relation
(c == d). The above expression is then equal to
p || !p && q
4.
4
Programming Example (cont)
The previous expression is equivalent (two expressions are
equivalent if they are true for the same values of the
variables occurring in the expressions) to a simpler
expression
(p || !p && q) ≡ p || q
We can see this since if p is true both expressions are true,
and if p is false, then !p is true and (!p && q) is true
exactly when q is true.
5.
Boolean Algebra
TheBoolean operators ∨ and ∧ are
analogous to addition and multiplication
with true and false playing the roles of 1
and 0. Complement is used for negation.
This provides a compact notation and
suggests appropriate algebraic
simplification
Similar properties hold such as the
associative, commutative, and distributive
identities.
6.
6
Disjunctive Normal Form
A Boolean expression is a Boolean function
Any Boolean function can be written as a Boolean
expression
Write a Boolean expression that evaluates to true for
each row in the truth table that is true and false for
other rows.
The Boolean expression for a given row is the
conjunction of the variables that are true and the
negation of variables that are false.
Take the disjunction of all such rows.
E.G. (multiplexor function)
s x0 x1 f
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 0
1 1 1 1
(¬s ∧ x0 ∧ ¬x1 ) ∨ (¬s ∧ x0 ∧ x1 ) ∨ (s ∧ ¬x0 ∧ x1 ) ∨ (s ∧ x0 ∧ x1 )
7.
7
Sums of Products
Disjunctive normal form, using the notation of
Boolean Algebra, corresponds to a sum of
products
E.G. (multiplexor function)
s x0 x1 f
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 0
1 1 1 1
8.
Properties of BooleanAlgebra
Boolean expressions can be simplified using rules of Boolean
algebra
Identity law: A + 0 = A and A ● 1 = A.
Zero and One laws (annhilator): A + 1 = 1 and A ● 0 = 0
Inverse laws (complementation):
Idempotent laws: A + A = A = A ● A
Commutative laws: A + B = B + A and A ● B = B ● A.
Associative laws: A + (B + C) = (A + B) + C and A ● (B ● C) = (A ● B) ● C.
Distributive laws: A ● (B + C) = (A ● B) + (A ● C) and
A + (B ● C) = (A + B) ● (A + C)
Absorption laws: A●(A+B) = A = A + A●B
Double Negation: ̅̅
𝐴𝐴 = 𝐴𝐴
DeMorgan’s laws:
9.
Proof using TruthTables
E.G. DeMorgan’s Law
A B (A ∨ B) ¬(A ∨ B) ¬A ∧ ¬B
0 0 0 1 1
0 1 1 0 0
1 0 1 0 0
1 1 1 0 0
10.
Completeness
Any identityfrom Boolean Algebra can be
proved using the properties listed
A sufficient subset
Associativity, commutativity, absorption, one
of the distributive laws and the two
complement laws
12
Simplification of Boolean
Expressions
Simplifying multiplexor expression using Boolean algebra
Equational reasoning: replace subexpressions by equivalent
expressions
Reflexive, Symmetric, Transitive
Verify that the boolean function corresponding to this
expression has the same truth table as the original function.
13.
13
Polynomial Algebra
Boolean operationsvia polynomial algebra
Assume x2 = x, y2 = y,…
Arithmetic performed mod 2
1⋅0 = 0⋅1 = 0⋅0 = 0, 1⋅1 = 1 [behaves like and]
0+0 = 1+1 = 0, 0+1 = 1+0 = 1 [behaves like xor]
And. x ∧ y via multiplication xy
Xor. x ⊕ y via addition x + y
Not. ¬x via 1+x
Or. x ∨ y via x+y+xy
15
Logic Circuits
Asingle line labeled x is a logic circuit. One end is the input
and the other is the output. If A and B are logic circuits so
are:
and gate
or gate
inverter (not)
A
B
A
A
B
16.
XOR
“One or theother, but
not both”
Notation for circuits:
x
y
x y x ⊕ y
0 0 0
0 1 1
1 0 1
1 1 0
x
y
17.
17
Multi-Input Gates
Cascadedand gate
A ∧ B ∧ C ∧ D ≡ ((A ∧ B) ∧ C) ∧ D ≡ (A ∧ B) ∧ (C ∧ D) ≡ A ∧ (B ∧ (C ∧ D))
A
B
C
D
A
B
C
D
A
B
C
D
18.
18
Logic Circuits
Given aboolean expression it is easy to write
down the corresponding logic circuit
Here is the circuit for the original multiplexor
expression
x0
x1
s
20
Nand
Nand – negationof the conjunction
operation:
A nand gate is an inverted and gate:
x y x | y
0 0 1
0 1 1
1 0 1
1 1 0
21.
21
Implementing Logic Gateswith
Transistors
output
gate
+V
ground
A Transistor NOT Gate
A NAND B
A
+V
ground
A Transistor NAND Gate
B
22.
Nand is functionallycomplete
Using DeMorgan’s Law, ¬ and ∧ are enough to
generate all Boolean functions
All boolean functions can be implemented
using nand gates (and, or and not can be
implemented using nand)
not:
and:
or:
x y x | y
0 0 1
0 1 1
1 0 1
1 1 0
23.
23
Arithmetic via Logic
FullAdder Used to add to binary numbers stored
as an array of bits using carry ripple addition
Three binary inputs
a, b and CarryIn
Two binary outputs
Sum and CarryOut such that a + b + CarryIn =
2*CarryOut + Sum
Sum
CarryIn
CarryOut
a
b
Carry 110
A 101
B 111
A+B = 1100
24.
24
Logic Circuit LabExercise
Derive a truth table for the output bits (Sum and
CarryOut) of a full adder.
Using the truth table derive a sum of products
expression for Sum and CarryOut. Draw a circuit
for these expressions.
Using properties of Boolean algebra simplify your
expressions. Draw the simplified circuits.
Sum
CarryIn
CarryOut
a
b
25.
25
Tautologies
A tautology isa boolean expression that is always
true, independent of the values of the variables
occurring in the expression. The properties of
Boolean Algebra are examples of tautologies.
Tautologies can be verified using truth tables. The
truth table below shows that x → y ≡ ¬ x ∨ y
x y x → y ¬ x ∨ y
0 0 1 1
0 1 1 1
1 0 0 0
1 1 1 1
26.
26
Exercise
Derive the tautology
x→ y ≡ ¬ x ∨ y
from the sum of products expression
obtained from the truth table for x → y.
You will need to use properties of Boolean
algebra to simplify the sum of products
expression to obtain the desired
equivalence.
28
Tautology Checker
Aprogram can be written to check to see if a Boolean
expression is a tautology.
Simply generate all possible truth assignments for the
variables occurring in the expression and evaluate the
expression with its variables set to each of these assignments.
If the evaluated expressions are always true, then the given
Boolean expression is a tautology.
Two Boolean expressions E1 and E2 are equivalent if E1 ≡ E2 is
a tautology.
29.
Proof using TruthTables
E.G. DeMorgan’s Law
A B (A ∨ B) ¬(A ∨ B) ¬A ∧ ¬B
0 0 0 1 1
0 1 1 0 0
1 0 1 0 0
1 1 1 0 0
30.
Satisfiability
A formulais satisfiable if there is an assignment
to the variables that make it true
Checking to see if a formula f is satisfiable can be
done by searching a truth table for a true entry
Exponential in the number of variables
Does not appear to be a polynomial time algorithm
(satisfiability is NP-complete)
There are efficient satisfiability checkers that work
well on many practical problems
f is a tautology ¬ f is not satisfiable.
31.
Arguments
An argumentis a list of premises followed by a
conclusion
ϕ1,…,ϕn ∴ ψ
An argument is valid if any assignment that
makes the premises true also makes the
conclusion true
An argument is invalid if there is some
assignment, counter example, that makes the
premises true but does not make the conclusion
true
Equivalent to ϕ1 ∧ … ∧ ϕn → ψ
32.
32
Lab Exercise
Derive atruth table for the output bits (Sum and
CarryOut) of a full adder.
Using the truth table derive a sum of products
expression for Sum and CarryOut. Draw a circuit
for these expressions.
Using properties of Boolean algebra simplify your
expressions. Draw the simplified circuits.
Sum
CarryIn
CarryOut
a
b