IST 4
Information and Logic
mon tue wed thr fri
3 M1 1
10 M1
17 1 2 M2
24 2
1 M2
8 3
15 3 4
22 4 5
29
5 5
x= hw#x out x= hw#x due
Mx= MQx out Mx= MQx due
midterms
oh oh
oh oh
oh oh
oh
oh
oh oh
oh
oh oh oh
oh
oh oh
oh = office hours oh
T
= today
T oh
oh
oh
oh
sun
from
physics
to
symbols
envelopes abacus writing numbers
from
physics
to
symbols
starting today:
symbols to physics-computation
Today’s most important slide
0 1 0 0 1 1 1 0
m-box
Algorizms to small
syntax boxes
Syntax boxes to Boolean algebra
Boolean algebra to Physics
From ideas to physical implementation
Physical implementation of syntax boxes
with relay circuits
Claude Shannon
Boolean algebra
formulae and functions
All the coefficients are 1
Feasible for an arbitrary (finite) Boolean algebra
Simple Boolean formula
Boolean
Functions
A Boolean function is a mapping from
{B} à {B}
defined by a simple Boolean formula n
Given a Boolean algebra with a set of elements B
Start with a simple Boolean formula
Assign all possible elements to the formula
ab OR(a,b)
00 01 10 11
0 1 1 1
Two element Boolean Algebra B= {0,1}
Boolean Functions – 2 Elements
0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 1 + 1 = 1
Mapping of a simple Boolean formula to a syntax box a b
+
00 01 10 11 0001 10 11
01 01 11 11
10 11 11 11 10 11 11 11 00
01 10 11
ab OR(a,b)
00 01 10 11
0 1 1 1
Boolean Functions – 4 Elements
+
00 01 10 11 0001 10 11
01 01 11 11
10 11 11 11 10 11 11 11 00
01 10 11
ab OR(a,b)
00 01 10 11
0 1 1 1
Boolean Functions – 4 Elements
Assign all possible elements to the formula
ab XOR(a,b)
00 01 10 11
0 1 1 0
Two element Boolean Algebra B= {0,1}
Boolean Functions – 2 Elements
Start with a simple Boolean formula
a b
Mapping of a simple Boolean formula to a syntax box
?
?
?
? ab XOR(a,b)
00 01 10 11
0 1 1 0
00 01 10 11 00
01 10 11
Boolean Functions – 4 Elements
Boolean Functions – 4 Elements
ab XOR(a,b)
00 01 10 11
0 1 1 0
00 01 10 11 00
01 10 11
00
00
00
00
?
?
Boolean Functions – 4 Elements
00 ?
00
00
00 00 01 10 11 00
01 10 11
?
?
? ab XOR(a,b)
00 01 10 11
0 1 1 0
Boolean Functions – 4 Elements
00
00
00
00 00 01 10 11 00
01 10 11
01 10 11
11 10
01
?
?
?
? ab XOR(a,b)
00 01 10 11
0 1 1 0
Boolean Functions – 4 Elements
00
00
00
00 00 01 10 11 00
01 10 11
01 10 11
11 10
01
10
10 01 01
?
? ab XOR(a,b)
00 01 10 11
0 1 1 0
Boolean Functions – 4 Elements
00
00
00
00 00 01 10 11 00
01 10 11
01 10 11
11 10
01
10
10 01 01
11
11
ab XOR(a,b)
00 01 10 11
0 1 1 0
Representation of Boolean functions
DNF
|s|
D
isjunctiveDNF N
ormalF
ormIdea:
Representing a Boolean function with a formula of a specific form
Representation of Boolean Functions
Disjunctive (Additive) Normal Form (DNF):
Sum of terms, each term is Normal
Normal = contains all the variables or their complements
Representation of Boolean Functions
Disjunctive (Additive) Normal Form (DNF):
Sum of terms, each term is Normal
Normal = contains all the variables or their complements
Is it a DNF?
No!
This term is not normal
Every Boolean function can be Expressed in a DNF
1 1 1
DNF E-Theorem
Every Boolean function can be Expressed in a DNF
Every Boolean function can be Expressed in a DNF
Express the following in a DNF T4
A1 A2 A4 A3 L1 T3
DNF E-Theorem
DNF E-Theorem:
Every Boolean function can be xpressed in a Proof:
Apply DeMorgan Theorem (T4) until each negation is applied to a single variable
Apply distributive axiom (A4) to get a sum of terms
Use (A3, T3) and self absorption (L1) to eliminate duplicate terms
Augment a missing variable a to a term using (A1,A2,A4) multiplying by
By the algorithm
Being Normal is Boring....
For which 0-1 assignments a normal term = 1 ?
011 101 110 101
100
A normal term is 1 for a single 0-1 assignment otherwise it is 0
xy AND(x,y)
00 01 10 11
0 0 0 1
1 iff both x and y are 1
Being Normal is Boring....
For which 0-1 assignments a normal term = 1 ?
011 101 110
A normal term is 1 for a single 0-1 assignment otherwise it is 0
Normal 0-1 assignment,
corresponds to a normal term
10 01 ab XOR(a,b)
00 01 10 11
0 1 1 0
A Boolean function is
1 for the normal 0-1 assignments and 0 for the other 0-1 assignments
Normal 0-1 assignments DNF
Boolean function syntax table
A Boolean function is 1 for the normal assignments and 0 for the other 0-1 assignments
0-1 assignments DNF
00
00
00
00
00 10 11
00 01 10 11
01 10 11
11 10
01
10
10 01 01
11
11 01
Other 0-1 assignments Normal 0-1 assignments
DNF Representation Theorem
DNF is a representation: two Boolean functions
are equal if and only if their DNFs are identical.
DNF Representation Theorem:
5 + 2 + 1 + 111 = ?? = 7+ 3 + 82+ 15 + 12
100 + 10 + 9 100 + 10 + 9
DNF Representation Theorem
DNF is a representation: two Boolean functions are equal if and only if their DNFs are identical.
Proof:
DNF Representation Theorem:
Easy direction: DNFs identical implies functions are equal Other direction: DNF are different implies
functions are not equal Idea: consider the value of the functions for the 0-1 assignment
Proof: Idea: consider the value of the functions for the 0-1 assignments
If two DNFs are different, there is a term
that appears in one and does not appear in the other Other direction:
two different DNFs implies two different functions
The 0-1 normal assignment that ‘corresponds’ to this term results in a 1 for one DNF and in a 0 for the other.
Q
DNF is a representation: Two Boolean functions are equal if and only if their DNFs are identical.
Q: How is the all-0 function represented?
Q: How is the all-1 function represented?
Answer:
Answer: everything....
Counting Functions
DNF is a representation: Two Boolean functions are equal if and only if their DNFs are identical.
Q1: How many different Boolean functions of n variables?
Answer:
The same as the number of different DNFs of n variables
Number of different normal terms of n variables?
A normal term can appear/not appear in a DNF
Boolean algebra
DNF from syntax boxes
DNF is a way to express
a syntax box using a formula
Any syntax box?
Represent a syntax box with formula?
Start with binary
ab XOR(a,b)
00 01 10 11
0 1 1 0
Idea: construct a DNF by adding the normal terms that correspond to f=1
a = 1 then a = 0 then
DNF is a way to express
a syntax box using a formula value 1 in the syntax table
=
a normal term in the DNF
ab f(a,b)
00 01 10 11
1 1 1 0
Idea: construct a DNF by adding the normal terms that correspond to f=1
DNF is a way to express
a syntax box using a formula value 1 in the syntax table
=
a normal term in the DNF
DNF is a way to express
a syntax box using a formula
When B={0,1}, namely BINARY every mapping is a Boolean function
Represent a syntax box with formula?
Only binary? YES!
The Boolean function is 1 for the normal assignments and 0 for the other 0-1 assignments
0-1 assignments DNF
00
00
00
00
00 10 11
00 01 10 11
01 10 11
11 10
01
10
10 01 01
11
11 01
Other 0-1 assignments Normal 0-1 assignments
Syntax box to DNF works only for binary!
00
With this change it is not a Boolean function!
Boolean algebra
DNF and magic boxes
Q:Can we reason about magic boxes using
Boolean algebra?
A Boolean algebra is a language for reasoning about syntax boxes
A MAGIC BOX:
binary syntax box that can compute binary s-box?
YES
a b m
0 0
1 0
1 0
1 1
1 1 1 0
A magic box
Prove that it is magical?
with Boolean algebra?
without Boolean algebra?
x
selector
o
(n-1) inputs (n-1) inputs
y x y
z z= 0 then
z= 1 then
Assume all boxes with (n-1) inputs can be computed with M
....
....
without
Boolean algebra?
max(a,b)
min(a,b) min(a,b)
o z= 0 then
z= 1 then
1-z z
A Selector Box
without
Boolean algebra?
a b m
0 0
1 0
1 0
1 1
1 1 1 0
00 01 10
A magic box
Prove that it is magical?
with Boolean algebra?
First idea: DNF of m(a,b)
a b m
0 0
1 0
1 0
1 1
1 1 1 0
A magic box
Prove that it is magical?
with Boolean algebra?
Second idea?
Compute the operations of the Boolean algebra with m(a,b)
a b m
0 0
1 0
1 0
1 1
1 1 1 0
Analyzing the Magic Box using Boolean Algebra
Can realize the operations of the algebra hence, can compute any DNF
magical for Binary
Boolean boxes
The Magic Box Can Compute any Boolean Function
? ?
? output in DNF?
0 0
The Magic Box Can Compute any Boolean Function
HW#3 5 boxes
2 symbol adder
digit 1 digit 2
carry
sum
carry
Binary Adder
3 bits to 2 bits
Gottfried Leibniz 1646-1716
Represent the number
of 1s in the input as two bits in base 2
s 0
1 1 0
1 0 0 1 0 0
0 0
0 1 1 0
c 0 0 0 1
d1 d2 c
0 1 0
1 0
1 0
1
0 1 1 1 1 0
0 1
1 1 1 1
parity majority
0 0 0 0
0 1 1 0
d1 d2 c
0 1 0
1 0
1 0
1 1 0
0 1
1 1 1 1
s 0
1 1 0
1 0 0 1 0 0
0 0
0 1 1 0
c 0 0 0 1
d1 d2 c
0 1 0
1 0
1 0
1
0 1 1 1 1 0
0 1
1 1 1 1
parity majority
0 0 0 0
0 1 1 0
d1 d2 c
0 1 0
1 0
1 0
1 1 0
0 1
1 1 1 1
majority 011 101 110 111
parity 001 010 100 111
2 symbol adder c
s
d1 d2
c
parity majority
In HW#3: Compute parity
and majority with magic boxes...
In HW#3:
use the connection to Boolean algebra
Shannon 1916-2001
Connection Between
Boolean Calculus and Physical Circuits Shannon 1938
Shannon 1916-2001
1 Relay on the edge
controlled by a 0-1 variable
0
~90 AB (After Boole)
Connection Between
Boolean Calculus and Physical Circuits Shannon 1938
2 relays
a b
a
b What is it computing?
ab OR(a,b)
00 01 10 11
0 1 1 1
ab AND(a,b)
00 01 10 11
0 0 0 1
connected
disconnected
When is it connected?
5 relays
a b
c d e
What is it computing?
a b
c d e
What is it computing?
a b
c d e
What is it computing?
a b
c d e
What is it computing?
a b
c d e
What is it computing?
Next week: Implementing
Boolean
functions
withrelay circuits
Shannon 1916-2001
Quiz time
Quiz #7 – 10min
a. Represent the following Boolean function in DNF
b. What is the syntax table related to the Boolean function?