IST 4
Information and Logic
mon tue wed thr fri
1 M1
1
8 M1
15
1 2
M222 PCP
2
29 M2
6
3
13
3 4
20 PCP 4 5
27
3
5
x= hw#x out x= hw#x due
Mx= MQx out Mx= MQx due
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
PCP= Programming Challenge
Midterms
- Lecture 1: Life: DNA sequences and evolution - Lecture 2: Human brain: natural languages
- Lecture 3: Artificial languages: numbers and writing
Information and Logic
- Lecture 4: Languages for quantities: Babylonian mathematics
- Lecture 5: Contrast: Babylonian mathematics vs Greek mathematics - Lecture 6: Flow: Euclid to Algorizmi to Fibonacci to Leibniz
- Lecture 9: Boolean Algebra – a new language for logic - Lecture 7: Beyond arithmetic: a language of syntax boxes - Lecture 8: Leibniz: syntax for reasoning, Aristotle and Boole
- Lecture 11: George Boole and nonbinary algebras
- Lecture 10: Boolean Algebra – from axioms to theorems
- Lecture 13: Shannon: from symbols to physics
- Lecture 12: Boolean is a useful language: functions and syntax boxes
- Lecture 14: Shannon: synthesis, simplicity, creativity
a
b
b c
a
b
b
c
Blue a = complement of a Red a = variable a
Quiz #10 – review
What is the Boolean function computed by the relay circuits
not connected
a
b c
b 1
2
Blue a = complement of a Red a = variable a
Quiz #10 – review
What is the Boolean function computed by the relay circuits
a
b c
b 1
(¯ a · b) + (b · b) + (b · ¯c)
= b + (¯ a · b) + (b · ¯c)
= b
= a + (b · c)
= ¯ a · (¯b + ¯c)
= ¯ a · ¯b + ¯a · ¯c
= ¯ a · ¯b · (c + ¯c) + ¯a · ¯c · (b + ¯b)
= ¯ a · ¯b · ¯c + ¯a · ¯b · c + ¯a · b · ¯c a + (b · c) + (a · b)
(a · b) + ¯c
(a · b) + ¯c
= (a · b) · c
= (¯ a + ¯b) · c
= c · (¯a + ¯b)
= (c · ¯a) + (c · ¯b)
a · (a + (b · c · d · e · f)) = a
a · (a + (b · c)) = a
m = 4
(4 + 1)
24
2= 2 · 4 + 1
(m + 1)
2m
2= 2 · m + 1 (¯ a · b) + (b · b) + (b · ¯c)
= b + (¯ a · b) + (b · ¯c)
= b
= a + (b · c)
= ¯ a · (¯b + ¯c)
= ¯ a · ¯b + ¯a · ¯c
= ¯ a · ¯b · (c + ¯c) + ¯a · ¯c · (b + ¯b)
= ¯ a · ¯b · ¯c + ¯a · ¯b · c + ¯a · b · ¯c a + (b · c) + (a · b)
(a · b) + ¯c
(a · b) + ¯c
= (a · b) · c
= (¯ a + ¯b) · c
= c · (¯a + ¯b)
= (c · ¯a) + (c · ¯b)
a · (a + (b · c · d · e · f)) = a
a · (a + (b · c)) = a
m = 4
(4 + 1)
24
2= 2 · 4 + 1
(m + 1)
2m
2= 2 · m + 1 (¯ a · b) + (b · b) + (b · ¯c)
= b + (¯ a · b) + (b · ¯c)
= b
= a + (b · c)
= ¯ a · (¯b + ¯c)
= ¯ a · ¯b + ¯a · ¯c
= ¯ a · ¯b · (c + ¯c) + ¯a · ¯c · (b + ¯b)
= ¯ a · ¯b · ¯c + ¯a · ¯b · c + ¯a · b · ¯c a + (b · c) + (a · b)
(a · b) + ¯c
(a · b) + ¯c
= (a · b) · c
= (¯ a + ¯b) · c
= c · (¯a + ¯b)
= (c · ¯a) + (c · ¯b)
a · (a + (b · c · d · e · f)) = a
a · (a + (b · c)) = a
m = 4
(4 + 1)
24
2= 2 · 4 + 1
(m + 1)
2m
2= 2 · m + 1
a
b
b c
a
b
b
c
Quiz #10 – review
What is the Boolean function computed by the relay circuits
not connected
2
Life and Stories
|s|
Shannon 1916-2001
Shannon 1916-2001
U of Michigan, undergrad, EE and Math (16): 1932-36 MIT MSc and PHD (20) : 1936-1940
Institute for Advanced Studies (24) : 1940-41 Bell Labs (25) : 1941-1958
MIT Professor (42) : 1958-1978
Married Elizabeth (Betty) Moore Shannon in 1949 (33)
Betty Shannon 1922-2017
Married Elizabeth (Betty) Moore Shannon in 1949
Children: Andrew and Margarita
Betty and Claude (64) in 1980
Claude (69) (and Betty?) with Caltech’s professor Yaser Abu-Mostafa at the 1985 Information Theory Symposium, Brighton, England
Shannon 1916-2001
logic design
information theory cryptography
computer chess and AI
computational juggling...
Shannon 1916-2001
logic design
information theory cryptography
computer chess and AI
computational juggling...
Posted on the class web site
A book on Shannon’s life A book with Shannon’s papers
MIT flight instructor to MIT president:
Shannon’s flying lessons at MIT, 1939 (23)
“I am convinced that Shannon is not only unusual but is in fact a near-genius of most unusual
promise.”
With the president’s permission he would ban Shannon from the cockpit: “such a life was not worth risking in a crash…”
”Somehow I doubt the advisability of urging a young man to refrain from flying or arbitrarily to take the opportunity away from him, on the ground of his being intellectually superior. I doubt whether it would be good for the development of his own character and
personality.”
MIT president (Karl Compton):
Shannon 1916-2001
Posted on the class web site
The Modern Relay?
A co-inventor of the modern relay - the transistor 1947-8 at Bell Labs... Together with Bardeen
and Brattain. 1956 Nobel Prize in Physics
William Shockley 1910 –1989
Caltech BS: 1928-1932 MIT PhD: 1932-1936
Blacker Hovse Blacker Hovse came into existence when its initial members met in the Athenaeum for its first meeting on Thursday, May 14, 1931
Blacker is 88 years old!
Source: Blacker house web page
Shockley was a junior in Physics
Connection Between
Boolean Calculus and Physical Circuits Shannon 1938
Boolean functions relay circuits relay circuits Boolean functions
Analysis (last time):
Synthesis (today):
Relay Circuits
synthesis
|s|
Boolean Calculus and Physical Circuits
Q: Boolean calculus to relay circuits?
How many relays with series-parallel?
a b
d e
a c e
b c d
How many relays with series-parallel?
Q: Boolean calculus to relay circuits?
Boolean Calculus and Physical Circuits
a b
d e
a c e
b c d
10 Q: Boolean calculus to relay circuits?
Boolean Calculus and Physical Circuits
How many relays with series-parallel?
Boolean Calculus and Physical Circuits
Less than 10 relays with series-parallel?
a b
d e
a c e
b c d
Boolean Calculus and Physical Circuits
Less than 10 relays with series-parallel?
a b
c
d e
b c d
e
a b c
d e
b c
e How many relays? 8
Can you compute
f
with less than 8 relays?Lower bound on the number on the number of relays???
5 relays?
5 relays?
Boolean Calculus and Physical Circuits
a b
c d e
5 relays?
Boolean Calculus and Physical Circuits
a b
c d e
5 relays?
Boolean Calculus and Physical Circuits
a b
c d e
5 relays?
Boolean Calculus and Physical Circuits
a b
c d e
5 relays?
Boolean Calculus and Physical Circuits
a b
c d e
This circuit is not series-parallel and we
do not have algorithms for synthesis
it using the algebra5 relays?
Boolean Calculus and Physical Circuits
a b
c d e
How to efficiently construct “good”
relay circuits is an open problem
Boolean Calculus and Physical Circuits
Synthesis
trees
|s|
XOR of two Variables with Relays?
a
b b a
How many relays?
XOR of More Variables
How many relays? 12
b c
a
b c
a
b c
a
b
a c
Can we do better with series-parallel?
XOR of More Variables
How many relays? 10 b
c c b
c c b
a b a
b
c c b
c c b
a b a
Does it look familiar?
a=0
a=1
Idea?
odd parity
even parity
b
c c b
c c b
a b a
Does it look familiar?
a=0
a=1
The proof for magic boxes
using sub-functions
b c o
0 0
1 0
1 0
1 1
0 1 1
3-input binary s-box
can be divided to two 2-input s-boxes
0
0 0
1 0
1 0
1 1
1 0 0 1 a
0 0 0 0 1 1 1 1 a= 0 then
a= 1 then
odd parity
even parity
Shannon 1938
b c o 0 0
1 0
1 0 1 1
0 1 1 0 0 0
1 0
1 0 1 1
1 0 0 1 a
0 0 0 0 1 1 1 1 b
o
c b c
a a= 0 then a= 1 then
Shannon 1938
Representing
syntax boxes with
A syntax table / Boolean function as a binary decision tree
0 =1 =
? ?
? ?
A path corresponds to an entry in the syntax table
(0,0) (0,1) (1,0) (1,1)
? ?
? ?
0 =1 =
(0,0) (0,1) (1,0) (1,1) ab XOR(a,b)
00 0110 11
0 11 0
A syntax table / Boolean function
as a binary decision tree
0 =1 =
? ?
? ?
ab XOR(a,b)
00 0110 11
0 11
0 0 1 1 0
(0,0) (0,1) (1,0) (1,1)
A syntax table / Boolean function
as a binary decision tree
0 =1 =
? ?
? ?
ab magic box
00 0110 11
1 11
0 1 1 1 0
A syntax table / Boolean function
as a binary decision tree
0 1
0 = 1 =
1 0 1 0 0 1
Can the tree representation help with the synthesis of relay circuits?
A syntax table / Boolean function
as a binary decision tree
0 = 1 =
0 1 1 0 1 0 0 1
Trees and Relay Circuits
relay circuits?
0 = 1 =
0 1 1 0 1 0 0 1
Trees and Relay Circuits
relay circuits?
b
c c b
c c b
a b a
Trees and Relay Circuits
0 1 1 0 1 0 0 1
0 1 1 0 1 0 0 1
b
c c b
c c b
a b a
How many relays? 10 Can we do better?
Trees and Relay Circuits
0 1 1 0 1 0 0 1
Can we do better?
Trees and Relay Circuits
not series-parallel 8 relays
0 = 1 =
1 1 0 0 1 0 1 1
Simplification of Boolean Functions sub-trees, karnaugh maps…
Key idea: No need to ‘climb a tree’ if we know the value earlier
simpler tree?
0 = 1 =
1 1
1 0 1
0 0 1 0 1 1
Simplification of Circuits,
sub-trees, karnaugh maps…
Key idea: No need to ‘climb a tree’ if we
know the value earlier
0 = 1 =
0 1 0 1 0 1 0 1
Simplification of Circuits,
sub-trees, karnaugh maps…
Observation:
the order of variables is important
0 = 1 =
0 1 0 1 0 1 0 1
Simplification of Circuits,
sub-trees, karnaugh maps…
Observation:
the order of variables is important
0
0 1 1
0 = 1 =
0 1
0 1 0 1 0 1 0 1
Simplification of Circuits,
sub-trees, karnaugh maps…
0
0 1 1
Observation:
the order of variables is important
binary decision trees + simplification
relay circuits
No need in Boolean algebra...
syntax boxes
Do simplifications of
binary decision trees
always provide the best
series-parallel solutions?
0 =1 =
1 0
1 1
ab magic box
00 0110 11
1 11 0
Find the simplest
series-parallel circuit
for the following syntax box
0 =1 =
?
? ?
ab magic box
00 0110 11
1 11
0 1 1 1 0
Do binary decision trees
always provide the best
series-parallel solutions?
0 =1 =
? ab magic box
00 0110 11
1 11
0 1 1 1
Do binary decision trees
always provide the best
series-parallel solutions?
0 =1 =
? ab magic box
00 0110 11
1 11
0 1
Do binary decision trees
always provide the best
series-parallel solutions?
0 =1 =
? ab magic box
00 0110 11
1 11
0 1
Do binary decision trees
always provide the best
series-parallel solutions?
0 =1 =
? ab magic box
00 0110 11
1 11
0 1
Do binary decision trees
always provide the best
series-parallel solutions?
0 =1 =
? ab magic box
00 0110 11
1 11
0 1
Do binary decision trees always provide the best series-parallel solutions?
1
0 =1 = ab magic box
00 0110 11
1 11 0
Do binary decision trees always provide the best
series-parallel solutions? NO
?1 1
Synthesis
symmetric functions
|s|
Two questions about XOR
Why care about XOR?
Why is XOR ‘easy’ to implement?
The Boolean
Functions of the Adder
carry
2 symbol adder c
s
d1 d2
c
sum
2 symbol adder
c s
d1 d2 c
2 symbol adder c
s
d1 d2
c
A new design:
2 symbol adder
c s
d1 c d2
2 symbol adder
c s
d1 d2 c
How will you
help your mom to correctly
use the adders?
sum
carry
2 symbol adder
c s
d1 d2 c
2 symbol adder c
s
d1 d2
c
A new design:
2 symbol adder
c s
d1 c d2
2 symbol adder
c s
d1 d2 c
How will you
help your mom to correctly
use the adders?
carry
2 symbol adder c
s
d1 d2
c
sum
MAJ and XOR are
symmetric
Boolean functionsSymmetric Functions
Permuting the inputs does SYM not change the output
Definition: A Boolean function f is symmetric if
for an arbitrary permutation
AND, OR, MAJ and XOR are symmetric Boolean functions
abc XOR(a,b,c) 000
001010 011
0 11
100 0 101110 111
10 01
sum
abc XOR(a,b,c) 000
001010 100
0 11
011 1 101110 111
00 01
number of 1s
0 1
2 3
abc MAJ(a,b,c) 000
001010 011
0 00
100 1 101110 111
01 11
carry
abc MAJ(a,b,c) 000
001010 100
0 00
011 0 101110 111
11 11
number of 1s
0 1
2 3
Symmetric Functions
Definition: A Boolean function f is symmetric if
for an arbitrary permutation
Theorem: A Boolean function f(X) is symmetric
if and only if it is a function of the number of 1’s in X, namely |X|
Theorem: A Boolean function f(X) is symmetric
if and only if it is a function of the number of 1’s in X, namely |X|
f symmetric f a function of |X|
f symmetric f a function of |X|
abc XOR(a,b,c) 000
001010 011
0 11
100 0 101110 111
10 01
abc XOR(a,b,c) 000
001010 100
0 11
011 1 101110 111
00 01
number of 1s
0 1
2 3
abc XOR(a,b,c) 000
001010 011
0 11
100 0 101110 111
10 01
abc XOR(a,b,c) 000
001010 100
0 11
011 1 101110 111
00 01
0 1
2 3
Proof: f symmetric f a function of |X|
Given:
Need to prove:
However, ,
Hence,
Q
abc XOR(a,b,c) 000
001010 011
0 11
100 0 101110 111
10 01
abc XOR(a,b,c) 000
001010 100
0 11
011 1 101110 111
00 01
0 1
2 3
Proof: f a function of |X| f symmetric Given:
Need to prove:
However,
Q
Q1: How many symmetric Boolean functions of n variables?
A1: Theorem: The number of symmetric functions of
n
variables is:Proof: f symmetric f a function of |X|
can be 0 or 1
*
functions
Q
01 2
n
**
*
* Symmetric
function table
A1: Theorem: The number of symmetric functions of
n
variables is:Q1: How many symmetric Boolean functions of n variables?
Q2: How can we efficiently implement symmetric functions with relay circuits?
A2: In Shannon’s MSc thesis and now!
A1: Theorem: The number of symmetric functions of
n
variables is:Circuits and Symmetric Functions
abc XOR(a,b,c) 000
001010 100
0 11
011 1 101110 111
00 01
0 1
2 3
Need to count the number of 1s What is the idea?
0
0 1
0 1 2
0 1 2 3
Circuits and Symmetric Functions
abc XOR(a,b,c) 000
001010 100
0 11
011 1 101110 111
00 01
0 1
2 3
Need to count the number of 1s What is the idea?
0 1 2 3
Circuits and Symmetric Functions
abc XOR(a,b,c) 000
001010 100
0 11
011 1 101110 111
00 01
0 1
2 3
Need to count the number of 1s What is the idea?
XOR
red = go right
0 1 2 3
The key: Symmetric functions are defined by the number of 1s
blue = go down
binomial tree?
1 1
1 2 1
1 3 3 1
1 4 6 4 1
What are we choosing?
Variables that are red =1 What are the numbers?
Not a tree
Possible assignments
binomial tree
Possible assignments for 4 variables:
Coefficients of:
Sum of Coefficients:
Possible assignments for n variables:
0 1 2 3
blue = go down red = go right How many edges/relays for n variables?
Number of round nodes is an arithmetic sum: n(n+1)/2 Number of edges is twice the number of nodes: n(n+1)
3(3+1)/2 = 6
12
binomial tree
The key: Symmetric functions are defined by the number of 1s
0 1 2 3
binomial tree
Fig. 25 in Shannon’s Thesis
Synthesis
summary
binary trees and binomial trees
|s|
Arbitrary Boolean functions
relay circuits
decision tree
0 1 1 0 1 0 0 1
Number of relays can be very LARGE: 2
nSymmetric Boolean functions
relay circuits
binomial tree
0 1 2 3
Number of relays
about n
2Synthesis
binary adder
|s|
Back to the Adder
2 symbol adder
1 0
0
digit 1 digit 2
carry
sum
1 1 carry
XOR MAJ
0 1 2
Implementing a 2-bit Adder
3
1 1 0 0
0
0 1
0 1 2
0 1 2 3
XOR 0 =
1 =
0 1 2
Implementing a 2-bit Adder
3
1 1 0 0
0
0 1
0 1 2
0 1 2 3
XOR 0 =
1 =
0 1 2
Implementing a 2-bit Adder
3
1 1 0 0
0
0 1
0 1 2
0 1 2 3
XOR 0 =
1 =
XOR
0 1 2
Implementing a 2-bit Adder
3
1 1 0 0
0
0 1
0 1 2
0 1 2 3
XOR 0 =
1 =
XOR
0 1 2
Implementing a 2-bit Adder
3
1 1 0 0
0
0 1
0 1 2
1 3
XOR 0 =
1 =
These two nodes are equivalent XOR c=1 results in XOR=1
0 1 2
Implementing a 2-bit Adder
3
1 1 0 0
1 3
XOR 0 =
1 =
XOR
0 1 2
Implementing a 2-bit Adder
3
1 1 0 0
0 =1 = XOR
Implementing a 2-bit Adder
0 1 2 3
0 1 0 1
0 1 2 3
MAJ 0 = 1 =
Implementing a 2-bit Adder
0 1 2 3
0 1 0 1
0 1 2 3
MAJ 0 = 1 =
Implementing a 2-bit Adder
0 1 2 3
0 1 0 1
2 3
MAJ 0 =
There is no 1 = reason to
check c here:
It is 1 for both values
Implementing a 2-bit Adder
0 1 2 3
0 1 0 1
2 3
MAJ 0 = 1 =
Implementing a 2-bit Adder
0 1 2 3
0 1 0 1
MAJ 0 = 1 =
2
Implementing a 2-bit Adder
0 1 2 3
0 1 0 1
MAJ 0 = 1 =
0 =1 = XOR
8 relays 6 relays
MAJ
Multi-terminal: Combination of
the two functions?
Now what?
0 =1 = XOR
8 relays 6 relays
MAJ
Multi-terminal: Combination of
the two functions?
Now what?
0 =1 = XOR
8 relays 6 relays
MAJ
Multi-terminal: Combination of
the two functions?
Now what?
Relay Circuits for
the Sum and the Carry Functions
1
MAJ XOR
sum:
carry:
2 symbol adder c
s d1 d2
c
How many relays for
a 2 symbol adder? 10
This is Shannon’s Design
Shannon 1916-2001
1
MAJ XOR
This is Shannon’s Design
Shannon 1916-2001
1
MAJ MAJ XOR
XOR
Shannon 1916-2001
The amazing last
page of Shannon’s Thesis
binary arithmetic to Boolean algebra
Boolean algebra to optimized relay circuits
Key references on algebra (in the context of logic)
Shannon 1916-2001
The amazing last
page of Shannon’s Thesis
binary arithmetic to Boolean algebra
Boolean algebra to optimized relay circuits
Key references on algebra (in the context of logic) Betty and “Claude” Shannon,
U of Michigan
Pre-Quiz
Quiz time
Quiz #11 – 10min
There are four possible Boolean functions of a single variable:
0 1
0 0 x 0
0 1
1 1 x 1
0 1
0 1 x x
0 1
?
? x
Construct a multiple terminal relay circuit that implements the four functions.
Please minimize the number of relays.
0 1
1 0 x x-