• No results found

IST 4 Information and Logic

N/A
N/A
Protected

Academic year: 2021

Share "IST 4 Information and Logic"

Copied!
121
0
0

Loading.... (view fulltext now)

Full text

(1)

IST 4

Information and Logic

(2)

mon tue wed thr fri

28 M1

1

4 M1

11

1 2

M2

18

2

25

M2

2

3

9

3 4

16 4 5

23

30

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

(3)

Memory MQ2

Due Tuesday 4/26/2016 by 10pm

Please email PDF

lastname-firstname.pdf

to [email protected]

(4)

MQ1 grades

were

emailed

please let the TAs know if you submitted MQ1 and did not get the email

HW1 will be returned today

average grade is A

(5)

The geography of innovation We need the whole world!

Source: Wikipedia

(6)

Last time...

Fibonacci 1170-1250AD Algorizmi

780-850

Leibniz 1646-1716

base 10 base 10

in Europe The binary

(7)

Arithmetic boxes decimal

Algorizmi 780-850

base 10

Fibonacci 1170-1250AD

base 10 in Europe

(8)

Algorithms – Syntax Manipulation

2 symbol adder

digit 1 digit 2

carry

sum

carry

(9)

Algorithms – Syntax Manipulation

2 symbol adder

8 6

digit 1 digit 2

carry

sum

0 carry

(10)

Algorithms – Syntax Manipulation

2 symbol adder

8 6

4

digit 1 digit 2

carry

sum

1 0 carry

(11)

Arithmetic Boxes binary

Leibniz 1646-1716

The binary

(12)

2 symbol adder

digit 1 digit 2

carry

sum

carry

Adding Bits

3 bits to 2 bits

Count the number

of 1s and represent

in binary

(13)

Adding Bits

2 symbol adder

0 0

0

digit 1 digit 2

carry

sum

0 0 carry

3 bits to 2 bits

Count the number

of 1s and represent

in binary

(14)

2 symbol adder

1 0

1

digit 1 digit 2

carry

sum

0 0 carry

Adding Bits

3 bits to 2 bits

Count the number

of 1s and represent

in binary

(15)

2 symbol adder

1 1

0

digit 1 digit 2

carry

sum

1 0 carry

Adding Bits

3 bits to 2 bits

Count the number

of 1s and represent

in binary

(16)

2 symbol adder

1 0

0

digit 1 digit 2

carry

sum

1 1 carry

Adding Bits

3 bits to 2 bits

Count the number

of 1s and represent

in binary

(17)

2 symbol adder

0 1

0

digit 1 digit 2

carry

sum

1 1 carry

Adding Bits

3 bits to 2 bits

Count the number

of 1s and represent

in binary

(18)

2 symbol adder

1 1

1

digit 1 digit 2

carry

sum

1 1 carry

Adding Bits

3 bits to 2 bits

Count the number

of 1s and represent

in binary

(19)

Algorithms – Syntax Manipulation

0 1 2 3 4 5 6 7 8 9 0 0 1 2 3 4 5 6 7 8 9

1 1 2 3 4 5 6 7 8 9 2 2 3 4 5 6 7 8 9 3 3 4 5 6 7 8 9 4 4 5 6 7 8 9 5 5 6 7 8 9 6 6 7 8 9 7 7 8 9 8 8 9 9 9

2 symbol adder c

s d1 d2

c

0

(20)

Algorithms – Syntax Manipulation

2 symbol adder c

s d1 d2

c

0 1 0 0 1 1 1 0

0

0 1 0 1 0 1 0 1

1

0 1 0 0 0 1 0 1

0

0 1 0 0 1 1 1 1

1

sum

carry

0 1 0 0 1 1 1 2

0 0 1

0 1 2 1 2 3

1

(21)

Algorithms – Syntax Manipulation

2 symbol adder 1

0

1 1

0

0 1 0 0 1 1 1 0

0

0 1 0 1 0 1 0 1

1

0 1 0 0 0 1 0 1

0

0 1 0 0 1 1 1 1

1

(22)

Algorithms – Syntax Manipulation

2 symbol adder 1

0

1 0

1

0 1 0 0 1 1 1 0

0

0 1 0 1 0 1 0 1

1

0 1 0 0 0 1 0 1

0

0 1 0 0 1 1 1 1

1

(23)

0 1 0 0 1 1 1 0

0

0 1 0 1 0 1 0 1

1

0 1 0 0 0 1 0 1

0

0 1 0 0 1 1 1 1

1

2 symbol adder c

c

1 1

c c 2 symbol adder c

1 0

c c 2 symbol adder c

0 0

c c 2 symbol adder c

1 1

0

1101 + 1001 = ??

(24)

0 1 0 0 1 1 1 0

0

0 1 0 1 0 1 0 1

1

0 1 0 0 0 1 0 1

0

0 1 0 0 1 1 1 1

1

2 symbol adder c

c

1 1

c c 2 symbol adder c

1 0

c c 2 symbol adder c

0 0

c 1 2 symbol adder 0

1 1

0

1101 + 1001 = ??

(25)

0 1 0 0 1 1 1 0

0

0 1 0 1 0 1 0 1

1

0 1 0 0 0 1 0 1

0

0 1 0 0 1 1 1 1

1

2 symbol adder c

c

1 1

c c 2 symbol adder c

1 0

c 0 2 symbol adder 1

0 0

1 1 2 symbol adder 0

1 1

0

1101 + 1001 = ??

(26)

0 1 0 0 1 1 1 0

0

0 1 0 1 0 1 0 1

1

0 1 0 0 0 1 0 1

0

0 1 0 0 1 1 1 1

1

2 symbol adder c

c

1 1

c 0 2 symbol adder 1

1 0

0 0 2 symbol adder 1

0 0

1 1 2 symbol adder 0

1 1

0

1101 + 1001 = ??

(27)

0 1 0 0 1 1 1 0

0

0 1 0 1 0 1 0 1

1

0 1 0 0 0 1 0 1

0

0 1 0 0 1 1 1 1

1

2 symbol adder 1

0

1 1

0 0 2 symbol adder 1

1 0

0 0 2 symbol adder 1

0 0

1 1 2 symbol adder 0

1 1

0

1101 + 1001 = ??

(28)

0 1 0 0 1 1 1 0

0

0 1 0 1 0 1 0 1

1

0 1 0 0 0 1 0 1

0

0 1 0 0 1 1 1 1

1

2 symbol adder 1

0

1 1

0 0 2 symbol adder 1

1 0

0 0 2 symbol adder 1

0 0

1 1 2 symbol adder 0

1 1

0

1101 + 1001 = 10110 13 + 9 = 22

(29)

2 symbol adder 1

0

1 1

0 0 2 symbol adder 1

1 0

0 0 2 symbol adder 1

0 0

1 1 2 symbol adder 0

1 1

0

1101 + 1001 = 10110 13 + 9 = 22

8 symbol adder

1 1 0 1 1 0 0 1

1 0 1 1 0

a deeper idea?

(30)

1 1 0 1 1 0 0 1

1 0 1 1 0

8 input bits

5 output bits

28 input combinations

Can be implemented with a table with 5 x 256 bits what are the trade-offs?

2 symbol adder 1

0

1 1

0 0 2 symbol adder 1

1 0

0 0 2 symbol adder 1

0 0

1 1 2 symbol adder 0

1 1

0

(31)

0 1 0 0 1 1 1 0

0

0 1 0 1 0 1 0 1

1

0 1 0 0 0 1 0 1

0

0 1 0 0 1 1 1 1

1

sum

carry what are the trade-offs?

2 symbol adder 1

0

1 1

0 0 2 symbol adder 1

1 0

0 0 2 symbol adder 1

0 0

1 1 2 symbol adder 0

1 1

0

1 0 0

1 1 1 0

1

a table with 8 bits

8 tables with 8 bits

a table with 8 bits

(32)

Memory-only requires 5 x 256 bits =

20 x 64

bits

2 symbol adder 1

0

1 1

0 0 2 symbol adder 1

1 0

0 0 2 symbol adder 1

0 0

1 1 2 symbol adder 0

1 1

0

Memory and logic require 8 8-bit tables =

64

bits Idea: Logic (algorithms) is

a language that helps in optimizing memory Idea: Understanding is

is a method for remebering with a small memory…

and much more...

a deeper idea?

(33)

We need to

remember

•  The building blocks

•  The algorithms

Algorithm

A procedure to build

‘everything’ from a

set of building blocks

(34)

There is a trade-off between

the size of building blocks: memories

and the complexity of the algorithm:

composition of the memories

Algorithm

A procedure to build

‘everything’ from a

set of building blocks

(35)

Syntax Boxes BIG from small

Remembering a large memory

with a composition of small memories

(36)

S-Box

a b

o inputs

outputs

a b o

Binary S yntax Box es (s-box)

(37)

0 0

0 inputs

outputs

a b o

0 0 0

Binary S yntax Box es (s-box)

(38)

0 1

1 inputs

outputs

a b o

0 0

1 0

0 1

Binary S yntax Box es (s-box)

(39)

1 0

1 inputs

outputs

a b o

0 0

1 0

1 0

0 1 1

Binary S yntax Box es (s-box)

(40)

1 1

1 inputs

outputs

a b o

0 0

1 0

1 0

1 1

0 1 1 1 Suggest a name for this memory box?

(41)

a b

o

a b o

0 0

1 0

1 0

1 1

0 1 1 1

o = max (a,b)

o = max (a,b) Suggest a name for this memory box?

Can we remember

max (a,b,c) with max(a,b)?

(42)

a b

c

Composition:

build

big

s-boxes

from small s-boxes o = max (a,b)

o = max (a,b,c) Can we remember

max (a,b,c) with max(a,b)?

(43)

a b

o

o = max (a,b) Can we remember w

with the max s-box?

a b w

0 0

1 0

1 0

1 1

0 1 1 0

?

NO Why not?

a b o

0 0

1 0

1 0

1 1

0 1 1 1 o = max (a,b)

How to compute the following (XOR)?

(44)

Big

s-box

a b

w

a b

0 0

1 0

1 0

1 1

0 1 1 0

?

Composition:

build

big

s-boxes

from small s-boxes The output of every small s-box is bigger or equal to its inputs

The output of the

big

s-box must be bigger or equal to its inputs NO Why not?

w

Can we remember w with the max s-box?

(45)

A Magic (Universal) Box

a b

a b m

0 0

1 0

1 0

1 1

1 1 1 0

A binary s-box that can

compute any binary s-box?

M

m

(46)

A Magic Box

a b

a b m

0 0

1 0

1 0

1 1

1 1 1 0

Can you compute the

following with the magic box?

M

m

x y

0 0

1 0

1 0

1 1

o 0 0 0 1 min(x,y)

(47)

A Magic Box

a b

a b m

0 0

1 0

1 0

1 1

1 1 1 0

Can you compute the

following with the magic box?

M

m

x y

0 0

1 0

1 0

1 1

o 0 0 0 1

Hint 1:

min(x,y)

(48)

A Magic Box

a b

a b m

0 0

1 0

1 0

1 1

1 1 1 0

Can you compute the

following with the magic box?

M

m

x y

0 0

1 0

1 0

1 1

o 0 0 0 1

Hint 2:

min(x,y)

(49)

A Magic Box

x y

a b m

0 0

1 0

1 0

1 1

1 1 1 0

M

x y

0 0

1 0

1 0

1 1

o 0 0 0 M 1

o 1

0

min(x,y)

(50)

A Magic Box

x y

a b m

0 0

1 0

1 0

1 1

1 1 1 0

M

x y

0 0

1 0

1 0

1 1

o 0 0 0 M 1

o 0

1

min(x,y)

(51)

a b

a b m

0 0

1 0

1 0

1 1

1 1 1 0

Can you compute the

following with the m-box?

M

m

x y

0 0

1 0

1 0

1 1

o 0

1 1 1

HINT

max(x,y)

(52)

x

a b m

0 0

1 0

1 0

1 1

1 1 1 0

x y

0 0

1 0

1 0

1 1

o 0

1 1 M 1

o

y

M M

max(x,y)

(53)

x

a b m

0 0

1 0

1 0

1 1

1 1 1 0

x y

0 0

1 0

1 0

1 1

o 0

1 1 M 1

o

y

M M

0

1 1

0

0

max(x,y)

(54)

x

a b m

0 0

1 0

1 0

1 1

1 1 1 0

x y

0 0

1 0

1 0

1 1

o 0

1 1 M 1

o

y

M M

0

0 1

1

1

max(x,y)

(55)

x

a b m

0 0

1 0

1 0

1 1

1 1 1 0

x y

0 0

1 0

1 0

1 1

o 0

1 1 M 1

o

y

M M

1

0 0

1

1

max(x,y)

(56)

a b

a b m

0 0

1 0

1 0

1 1

1 1 1 0

M

m

m-Box: A two input binary syntax box that can compute any (two

input) binary syntax box?

x y

0 0

1 0

1 0

1 1

o

*

*

*

* How many different binary 2-input

s-boxes?

How will you prove it?

24 = 16

(57)

Syntax Boxes

proof of universality

(58)

x y o

0 0

1 0

1 0

1 1

1 1 1 1

x y o

0 0

1 0

1 0

1 1

1 0

1 0

min(x,y) 1-y 1

max(x,y)

4 Useful Boxes

(59)

a b m

0 0

1 0

1 0

1 1

1 1 1 0

x y o

0 0

1 0

1 0

1 1

1 0

1 0 1-y

M o y

(60)

a b m

0 0

1 0

1 0

1 1

1 1 1 0

x y o

0 0

1 0

1 0

1 1

1 1 1 1 M

o y

1

1-y

(61)

a b m

0 0

1 0

1 0

1 1

1 1 1 0

x y o

0 0

1 0

1 0

1 1

1 1 1 1 M

o y

1

1-y y

M

(62)

4 Useful Boxes

min(x,y) 1-y 1

max(x,y)

Need to prove:

any (two input) binary syntax box can be computed by

the 4 Useful Boxes

So what?

(63)

x y o

0 0

1 0

1 0

1 1

*

*

*

An Arbitrary Two Input Box

* Two 1-input boxes!

x= 0 then x= 1 then

What are the possible values of 0

0

0 1

1 0

1 1

(64)

An Arbitrary Two Input Box

What are the possible values of 0

0

0 1

1 0

1 1

min(x,y) 1-y 1

max(x,y) y

Can we compute it with the m-box?

x y o

0 0

1 0

1 0

1 1

*

*

*

*

(65)

x y o

0 0

1 0

1 0

1 1

*

*

*

A Selector Box

* x= 0 then

x= 1 then

selector

o

x

(66)

x y o

0 0

1 0

1 0

1 1

*

*

*

A Selector Box

* x= 0 then

x= 1 then

selector

o

0

(67)

x y o

0 0

1 0

1 0

1 1

*

*

*

A Selector Box

* x= 0 then

x= 1 then

selector

o

1

(68)

x y o

0 0

1 0

1 0

1 1

*

*

*

A Selector Box

* x= 0 then

x= 1 then

selector

o

x How can you compute this box?

(69)

max(a,b)

min(a,b) min(a,b)

o x= 0 then

x= 1 then

1-x x

A Selector Box

(70)

max(a,b)

min(a,b) min(a,b)

o x= 0 then

x= 1 then

0 1

0

A Selector Box

(71)

max(a,b)

min(a,b) min(a,b)

o x= 0 then

x= 1 then

1 0

0

QED

A Selector Box

(72)

x y o

0 0

1 0

1 0

1 1

0 1 1

How to compute the following (XOR)?

0

selector

o

x

?

? x= 0 then

x= 1 then

(73)

x y o

0 0

1 0

1 0

1 1

0 1 1 0

selector

o

x 1-y

y

How to compute the following (XOR)?

x= 0 then x= 1 then

(74)

x y o

0 0

1 0

1 0

1 1

0 1 1 0

selector

o

x 1-y

y x= 0 then

x= 1 then

y

M

(75)

Given a 2-input binary box that can compute

any

2-input binary box

Can it compute

any

3-input binary box?

Does the magic continue?

a b

M

o

x z

o y

(76)

x y o

0 0

1 0

1 0

1 1

*

*

*

3-input binary s-box

*

0 0

1 0

1 0

1 1

*

*

*

* z

0 0 0 0 1 1 1 1 How many different

binary 3-input s-boxes?

28 = 256

(77)

x y o

0 0

1 0

1 0

1 1

*

*

*

3-input binary s-box

*

0 0

1 0

1 0

1 1

*

*

*

* z

0 0 0 0 1 1 1 1 Two 2-input boxes!

z= 0 then z= 1 then

(78)

x y o 0 0

1 0

1 0 1 1

*

*

*

* 0 0

1 0

1 0 1 1

*

*

*

* z

0 0 0 0 1 1 1 1 x

selector

o

y x y

z

z= 0 then z= 1 then All boxes can be computed with M

(79)

Given a magical box for any 2-input binary box

We proved that it is magical for any 3-input binary box!

a b

M

o o

....

Is it magical for any n-input binary box????

YES!!!!

Proof by induction on the number of inputs

Does the magic continue?

(80)

x

selector

o

(n-1) inputs (n-1) inputs

y x y

z

z= 0 then z= 1 then All boxes can be computed with M

....

....

(81)

There is a set of building blocks – one magic box!

Non-binary Binary

Questions about

algorithms

and building blocks ?

There are no simple magic boxes

(82)

Given a set of building blocks:

What can/cannot be constructed?

Efficiency and complexity Feasibility

Time: How long will it take to complete the construction?

Size: If feasible, how many blocks are needed?

Questions about

algorithms

and building blocks ?

(83)

Magic boxes do not know arithmetic…

Leibniz: A universal language

Instead of “thinking” let’s “calculate with magic boxes”

....

Gottfried Leibniz 1646-1716

(84)

Magic boxes do not know arithmetic…

Instead of “thinking” let’s “calculate with magic boxes”

smile recognition 0

....

1

(85)

Gottfried Leibniz 1646-1716

Leibniz was the first person to understand that computation

is not just arithmetic

Universal Language for Reasoning The founder of

Information Science

(86)

Game time

(87)

Game Time

Who can WIN the game

WIN

VI

(88)

Game Time

Who can WIN

WIN

the game

(89)

Game Time

Who can WIN

WIN

the game

can take as many sticks from a single group

Players take turns in removing sticks

the player that removes the last stick wins

(90)

Who can WIN

WIN

the game Example: Who will win?

(91)

Game Time

Who can WIN

WIN

the game

(92)

Game Time

Who can WIN

WIN

the game

(93)

Game Time

Who can WIN

WIN

the game

(94)

Game Time

Who can WIN

WIN

the game

(95)

Game Time

Who can WIN

WIN

the game

(96)

Game Time

Who can WIN

WIN

the game

(97)

Game Time

Who can WIN

WIN

the game

(98)

Game Time

Who can WIN

WIN

the game

(99)

Game Time

Who can WIN

WIN

the game

(100)

Game Time

Who can WIN

WIN

the game

(101)

Game Time

Who can WIN

WIN

the game

(102)

Game Time

Who can WIN

WIN

the game

(103)

Game Time

Who can WIN

WIN

the game

(104)

Game Time

Who can WIN

WIN

the game

I CAN

(105)

Game Time

Who can WIN the game

WIN

VI=110

(106)

Game Time

Who can WIN

WIN

the game

011

100

110 001 An even number of 1s in every position

(107)

Game Time

Who can WIN

WIN

the game

An even number of 1s in every position

011

100

110 001

(108)

Game Time

Who can WIN

WIN

the game

010

100

110 000 An even number of 1s in every position

(109)

Game Time

Who can WIN

WIN

the game

010

100

110 000 An even number of 1s in every position

(110)

Game Time

Who can WIN

WIN

the game

010

100

001 111 An even number of 1s in every position

(111)

Game Time

Who can WIN

WIN

the game

010

100

001 111 An even number of 1s in every position

(112)

Game Time

Who can WIN

WIN

the game

010

011

001 000 An even number of 1s in every position

(113)

Game Time

Who can WIN

WIN

the game

010

011

001 000 An even number of 1s in every position

(114)

Game Time

Who can WIN

WIN

the game

010

011

001 000 An even number of 1s in every position

(115)

Game Time

Who can WIN

WIN

the game

010

000

001 011 An even number of 1s in every position

(116)

Game Time

Who can WIN

WIN

the game

010

000

001 001 An even number of 1s in every position

(117)

Game Time

Who can WIN

WIN

the game

001

000

001 000 An even number of 1s in every position

(118)

Game Time

Who can WIN

WIN

the game

001

000

001 000 An even number of 1s in every position

(119)

Game Time

Who can WIN

WIN

the game

I CAN

000

000

001 001 An even number of 1s in every position

(120)

Game Time

Who can WIN

WIN

the game

I CAN

000

000

000 000 An even number of 1s in every position

Winning starts with the choice of the right

language

(121)

Game Time

Who can WIN

WIN

the game

References

Related documents

Complete: Every true statement in the math theory can be derived using the axioms.. Can

Complete: Every true statement in the math theory can be derived using the axioms.. Can

Complete: Every true statement in the math theory can be derived using the axioms. Can

Every finite Boolean algebra is isomorphic to a Boolean algebra with elements being bit vectors of finite length with bitwise operations OR and AND. Two Boolean algebras with

Every finite Boolean algebra is isomorphic to a Boolean algebra with elements being bit vectors of finite length with bitwise operations OR and AND. Two Boolean algebras with

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

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

Easy direction: DNFs identical implies functions are equal Other direction: DNF are different implies. functions are not equal Idea: consider the value of