Title: EECS 20
1Block Diagrams
EECS 20 Lecture 4 (January 24, 2001) Tom
Henzinger
2 1 Systems are functions 2 Signals are
functions
3Systems as Functions
Input
Output
Domain set of possible inputs Range set
of possible outputs Graph set of pairs (
input, output )
4 Factorial System
Nats
Nats
!
5 Factorial System
Nats
Nats
!
3
6
6 Factorial System
Nats
Nats
!
4
24
7 Factorial System
Nats
Nats
!
4
24
Domain Nats Range Nats Graph (
1, 1 ), ( 2, 2 ), ( 3, 6), ( 4, 24 ),
8 Inverter System
Bools
Bools
?
9 Inverter System
Bools
Bools
?
true
false
10 Inverter System
Bools
Bools
?
false
true
11 Inverter System
Bools
Bools
?
false
true
Domain Bools Range Bools Graph
( true, false ), ( false, true )
12Composition of Systems
Bools
Bools
Bools
?
?
true
true
false
13Composition of Systems
Bools
Bools
Bools
?
?
false
false
true
14This is again a system !
Bools
Bools
?
?
15The Identity System
Bools
Bools
id
Domain Bools Range Bools Graph
( x, y ) ? Bools2 x y
16System Composition is Function Composition
? ? ? id
because domain (? ? ?) domain (id)
range (? ? ?) range (id)
? x ? Bools, ( ? ? x ) id (x)
17And System
Bools
?
18And System
Bools2
Bools
?
19And System
Bools
Bools2
?
(true, false)
false
20And System
Bools
Bools
?
Bools
21And System
Bools
Bools
true
?
false
false
Bools
22-
Exponentiation System
Nats
Nats
2
exp
?
3
Nats
graph (exp) ( (x,y), z ) ? Nats2 ? Nats z
x y
23Exponentiation System
Nats
Nats
2
1
exp
8
3
2
Nats
graph (exp) ( (x,y), z ) ? Nats2 ? Nats z
x y
24Exponentiation System
Nats
Nats
2
2
exp
9
3
1
Nats
graph (exp) ( (x,y), z ) ? Nats2 ? Nats z
x y
25Block Diagram
Bools
Bools
?
Bools
Bools
?
?
?
Bools
Bools
This cannot be written easily using ? .
26Block Diagram
Bools
?
true
Bools
?
?
?
false
Bools
27Block Diagram
Bools
false
?
true
Bools
?
?
?
false
true
Bools
28Block Diagram
Bools
false
?
true
Bools
false
?
?
?
false
true
Bools
29Block Diagram
Bools
false
?
true
Bools
false
?
?
true
?
false
true
Bools
30Or System
?
Bools
?
Bools
?
?
?
Bools
domain (?) Bools2 range (?) Bools graph
(?) ( (x,y), z ) ? Bools2 ? Bools z x
? y
31-
Or System
Bools
Bools
?
Bools
domain (?) Bools2 range (?) Bools graph
(?) ( (x,y), z ) ? Bools2 ? Bools z x
? y
32Block Diagrams with Forks
?
?
?
?
33Block Diagrams with Forks
?
?
true
?
?
false
34Block Diagrams with Forks
f
?
?
true
?
?
false
35Block Diagrams with Forks
f
t
?
?
true
?
?
false
f
36Block Diagrams with Forks
f
t
?
?
true
?
true
?
false
f
37Joins are illegal
?
?
?
38Joins are illegal
?
true
?
?
false
39Joins are illegal
f
?
true
?
?
?
false
t
40Multiple Outputs
Nats
Nats0
f
Nats0
Nats
f Nats2 ? Nats02 such that ?x,y?Nats, f (x,y)
(q,r)?Nats02 x q y r ? r lt y
41Division System
Nats
Nats0
quotient
1
1
divide
2
remainder
2
Nats0
Nats
divide Nats2 ? Nats02 such that ?x,y?Nats,
divide (x,y) (q,r)?Nats02 x q y r ?
r lt y
42Division System
Nats
Nats0
7
1
1
divide
3
2
2
Nats0
Nats
divide Nats2 ? Nats02 such that ?x,y?Nats,
divide (x,y) (q,r)?Nats02 x q y r ?
r lt y
43Division System
Nats
Nats0
7
2
1
1
divide
3
2
1
2
Nats0
Nats
divide Nats2 ? Nats02 such that ?x,y?Nats,
divide (x,y) (q,r)?Nats02 x q y r ?
r lt y
44Division System
Nats
Nats0
3
1
1
divide
7
2
2
Nats0
Nats
divide Nats2 ? Nats02 such that ?x,y?Nats,
divide (x,y) (q,r)?Nats02 x q y r ?
r lt y
45Division System
Nats
Nats0
3
0
1
1
divide
7
2
3
2
Nats0
Nats
divide Nats2 ? Nats02 such that ?x,y?Nats,
divide (x,y) (q,r)?Nats02 x q y r ?
r lt y
46Division System
Nats
Nats0
9
3
1
1
divide
3
2
0
2
Nats0
Nats
divide Nats2 ? Nats02 such that ?x,y?Nats,
divide (x,y) (q,r)?Nats02 x q y r ?
r lt y
47Many possible implementations
divide
Nats
Nats0
1
1
C program for Euclids algorithm
2
2
Nats0
Nats
divide Nats2 ? Nats02 such that ?x,y?Nats,
divide (x,y) (q,r)?Nats02 x q y r ?
r lt y
48Many possible implementations
divide
Nats
Nats0
1
1
circuit
2
2
Nats0
Nats
divide Nats2 ? Nats02 such that ?x,y?Nats,
divide (x,y) (q,r)?Nats02 x q y r ?
r lt y
49Block diagrams can hide outputs
Nats
1
1
divide
Bools
2
2
zerocheck
Nats
zerocheck Nats0 ? Bools such that ?x?Nats,
zerocheck (x) ? x 0 .
50Block Diagrams can hide outputs
Nats
1
1
divide
Bools
2
2
zerocheck
Nats
zerocheck Nats0 ? Bools such that ?x?Nats,
zerocheck (x) ? x 0 .
51Block Diagrams can hide outputs
Nats
1
Bools
divisible
2
Nats
divisible Nats2 ? Bools such that ?x,y?Nats,
divisible (x,y) ? ( ?q?Nats, x q y ) .
52Hidden inputs are illegal, for now
?
53Hidden inputs are illegal, for now
?
?
true
54Constant functions have no inputs
true
?
55Constant function
true
true
?
true
true
56Cycles are illegal, for now
divide
57Block Diagrams
-are nested, directed, acyclic graphs -allow
compositional, hierarchical system description
58Quiz
1. ? set x, x ? P(x) 2. ? function f, x
? domain (f) x f(x) 3. ? n ? Nats, n
2 ? ( n, n1 ) ? 1, 2, 3 2 4. ? f ? Nats
? Nats, f(x) x 2