IST4_lec5

IST4_lec5 - IST 4 Information and Logic IST 4 Planned Schedule – Spring 2008 mon tue T = today 31 7 14 21 28 5 12 19 26 2 M1 wed thr 1 M1 fri x=

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: IST 4 Information and Logic IST 4: Planned Schedule – Spring 2008 mon tue T = today 31 7 14 21 28 5 12 19 26 2 M1 wed thr 1 M1 fri x= hw#x out x= hw#x due Mx= MQx out Mx= MQx due 2 T1 32 midterms 3 midterms 4 54 65 6 So Far... Calculus is Latin for pebble abhaq is Hebrew for dust So Far... Muhammad al-Khwārizmī 780-850AD algorithm is derived from his name His book Kitab al-jabr w'al-muqabala gives us the word algebra So Far... Muhammad al-Khwārizmī 780-850AD Leonardo Fibonacci 1170-1250 Brought the 0 to Europe So Far... Muhammad al-Khwārizmī 780-850AD Leonardo Fibonacci 1170-1250 It is all about SYNTAX... The Babylonians knew everything! The Abacus: It’s all About Syntax What is the decimal representation? V D L V MLXXXX ?? M C X I DCI 601 + CCCCLXXXVIIII 489 The Abacus: It’s all About Syntax What is the decimal representation? V D L V MLXXXX What’s wrong with this picture? 1 0 9 0 M C X I DCI 601 + CCCCLXXXVIIII 489 Roman Numerals and Base 10 Systems MLXXXX Roman numerals used for number Representation For calculation: we used the abacus 1 V D L V The representation in the abacus is a positional base 10 representation 0 9 0 M C X I The Zero A positional number system with 0 is a key enabler for efficient arithmetic operations Operations are done on syntax 2500 BC, the Babylonians had a sophisticated sexagesimal (base-sixty) positional numeral system Maya civilization used a vigesimal (base-twenty) numeral system that included a zero. Dated 200AD The oldest known text to use zero is the Jain text from India entitled the Lokavibhaaga, dated 458 AD It is not only 0 Can we represent a number in a positional system without a 0? Answer: Yes Assume base 10 ?? How will you represent 10 without a 0? IDEA: Represent 10 with a new digit: A Base-10 No-0 Positional System Represent 10 with a new digit A ??? ??? Base-10 No-0 Positional System It is all about syntax!! ??? ??? Base-10 No-0 Positional System It is all about syntax!! ??? Base-10 No-0 Positional System It is all about syntax!! ??? Base-10 No-0 Positional System ist ??? al-Khwarizmi 780-850 Algorithm = a procedure for syntax manipulation V D L V Algorithm = ???? M C X I Syntax inputs a Manipulation with a b Boxes b o S-Box outputs o Syntax Manipulation with Boxes a inputs 0 0 0 b 0 o 0 outputs 0 Syntax Manipulation with Boxes a inputs 0 1 0 0 b 0 1 o 0 1 outputs 1 Syntax Manipulation with Boxes a inputs 0 2 0 0 0 b 0 1 2 o 0 1 2 outputs 2 Syntax Manipulation with Boxes a inputs 1 2 0 0 0 b 0 1 2 o 0 1 2 1 outputs 2 2 2 Syntax Manipulation with Boxes a inputs 2 1 0 0 0 b 0 1 2 o 0 1 2 1 outputs 2 2 2 1 2 2 Syntax Manipulation with Boxes Can we ‘compute’ max (a,b,c) with this s-box? a inputs a b 0 0 0 1 1 1 2 2 2 b 0 1 2 0 1 2 0 1 2 o 0 1 2 1 1 2 2 2 2 ? outputs o o = max (a,b) Syntax Manipulation with Boxes Can we ‘compute’ max (a,b,c) with this s-box? o = max (a,b) a b Syntax Manipulation with Boxes Can we ‘compute’ max (a,b,c) with this s-box? a b o = max (a,b) Composition: build big s-boxes from small s-boxes c Syntax Manipulation with Boxes Can we ‘compute’ o with the max s-box? a a o 0 1 1 1 o o = max (a,b) b 0 0 0 1 1 1 2 2 2 b 0 1 2 0 1 2 0 1 2 o 0 1 2 1 1 2 2 2 2 ? a 0 0 1 1 b 0 1 0 1 YES Syntax Manipulation with Boxes Can we ‘compute’ o with the max s-box? a a o 0 1 1 0 o o = max (a,b) b 0 0 0 1 1 1 2 2 2 b 0 1 2 0 1 2 0 1 2 o 0 1 2 1 1 2 2 2 2 ? a 0 0 1 1 NO b 0 1 0 1 Why not? Syntax Manipulation with Boxes Can we ‘compute’ o with the max s-box? Composition: a b build big s-boxes from small s-boxes ? a 0 0 1 1 NO b 0 1 0 1 o 0 1 1 The outputs of the 0 big s-box must be bigger or equal to its Why not? inputs Big o s-box The output of every small s-box is bigger or equal to its inputs Key Questions Related to Boxes ? Building blocks: What are ‘good’ small s-boxes? How to build big s-boxes from small s-boxes? Composition: ? How to build big s-boxes from small s-boxes while reducing cost and increasing performance? Efficiency: A Magic Box A binary s-box that can compute any binary s-box? a 0 0 1 1 b 0 1 0 1 m 1 1 1 0 m a b A Magic Box Can you compute the following with the magic box? a 0 0 1 1 b 0 1 0 1 m 1 1 1 0 m a b a 0 0 1 1 b 0 1 0 1 o 0 0 0 1 A Magic Box a b a 0 0 1 1 b 0 1 0 1 m 1 1 1 0 0 a 0 0 1 1 b 0 1 0 1 o 0 0 0 1 1 o A Magic Box a b a 0 0 1 1 b 0 1 0 1 m 1 1 1 0 1 a 0 0 1 1 b 0 1 0 1 o 0 0 0 1 0 o A Magic Box A binary s-box that can compute any binary s-box? a 0 0 1 1 b 0 1 0 1 m 1 1 1 0 How will you prove that? How will you We need a oanguage l for s-boxes find the composition? Base-10 No-0 Positional System ist ??? Base-10 No-0 Positional System ist al-Khwarizmi 780-850 Arithmetic computation is also a procedure for syntax manipulation V D L V M C X I Algorithms – Syntax Manipulation digit 1 digit 2 carry 2 symbol adder carry sum Algorithms – Syntax Manipulation digit 1 8 digit 2 6 carry 2 symbol adder 0 carry sum Algorithms – Syntax Manipulation digit 1 8 digit 2 6 carry 1 2 symbol adder 0 carry 4 sum Algorithms – Syntax Manipulation 0 0 0 d1 c d2 c 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 2 symbol adder s Algorithms – Syntax Manipulation 0 0 0 d1 c d2 c 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 0 1 2 3 4 5 6 7 8 9 2 symbol adder s Algorithms – Syntax Manipulation 0 0 0 d1 c d2 c 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 0 1 1 2 3 4 5 6 7 8 9 2 symbol adder s Algorithms – Syntax Manipulation 0 0 0 d1 c d2 c 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 0 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 2 symbol adder s Algorithms – Syntax Manipulation 0 0 0 d1 c d2 c 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 0 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 2 symbol adder s Algorithms – Syntax Manipulation 0 0 0 d1 c d2 c 1 1 2 3 4 5 6 7 8 9 0 2 2 3 4 5 6 7 8 9 0 3 3 4 5 6 7 8 9 0 4 4 5 6 7 8 9 0 5 5 6 7 8 9 0 6 6 7 8 9 0 7 7 8 9 0 8 8 9 0 9 9 0 0 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 2 symbol adder s Algorithms – Syntax Manipulation 0 0 0 d1 c d2 c 1 1 2 3 4 5 6 7 8 9 0 2 2 3 4 5 6 7 8 9 0 3 3 4 5 6 7 8 9 0 4 4 5 6 7 8 9 0 5 5 6 7 8 9 0 6 6 7 8 9 0 7 7 8 9 0 8 8 9 0 9 9 0 1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 2 symbol adder s Algorithms – Syntax Manipulation 0 0 0 d1 c d2 c 1 1 2 3 4 5 6 7 8 9 0 2 2 3 4 5 6 7 8 9 0 3 3 4 5 6 7 8 9 0 4 4 5 6 7 8 9 0 5 5 6 7 8 9 0 6 6 7 8 9 0 7 7 8 9 0 1 2 3 4 5 6 8 8 9 0 1 2 3 4 5 6 7 9 9 0 1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 2 symbol adder s Algorithms – Syntax Manipulation How will it look for c=1? 0 0 d1 c d2 c 0 1 1 2 3 4 5 6 7 8 9 0 2 2 3 4 5 6 7 8 9 0 1 3 3 4 5 6 7 8 9 0 1 2 4 4 5 6 7 8 9 0 1 2 3 5 5 6 7 8 9 0 1 2 3 4 6 6 7 8 9 0 1 2 3 4 5 7 7 8 9 0 1 2 3 4 5 6 8 8 9 0 1 2 3 4 5 6 7 9 9 0 1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 2 symbol adder s Algorithms – Syntax Manipulation d1 d2 c 2 symbol adder s c ???? 1 0 0 1 1 2 3 4 5 6 7 8 9 0 2 2 3 4 5 6 7 8 9 0 1 3 3 4 5 6 7 8 9 0 1 2 4 4 5 6 7 8 9 0 1 2 3 5 5 6 7 8 9 0 1 2 3 4 6 6 7 8 9 0 1 2 3 4 5 7 7 8 9 0 1 2 3 4 5 6 8 8 9 0 1 2 3 4 5 6 7 9 9 0 1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 Algorithms – Syntax Manipulation d1 d2 Shift by 1 1 9 0 1 2 3 4 5 6 7 8 9 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 c 2 symbol adder s c 0 0 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 1 1 2 3 4 5 6 7 8 9 0 2 2 3 4 5 6 7 8 9 0 1 3 3 4 5 6 7 8 9 0 1 2 4 4 5 6 7 8 9 0 1 2 3 5 5 6 7 8 9 0 1 2 3 4 6 6 7 8 9 0 1 2 3 4 5 7 7 8 9 0 1 2 3 4 5 6 8 8 9 0 1 2 3 4 5 6 7 9 9 0 1 2 3 4 5 6 7 8 7 8 8 9 Algorithms – Syntax Manipulation d1 d2 Shift by 1 1 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1 2 2 3 3 4 4 5 5 6 6 7 c 2 symbol adder s c 0 0 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 9 0 1 2 3 4 5 6 7 8 1 0 0 1 2 3 4 5 6 7 8 9 9 0 0 1 2 3 4 5 6 7 8 9 0 1 1 2 3 4 5 6 7 8 9 0 1 2 2 3 4 5 6 7 8 9 0 1 2 3 3 4 5 6 7 8 9 0 1 2 3 4 4 5 6 7 8 9 0 1 2 3 4 5 5 6 7 8 9 0 1 2 3 4 5 6 6 7 8 9 0 1 2 3 4 5 6 7 7 8 9 0 1 2 3 4 5 6 7 8 8 9 0 1 2 3 4 5 6 7 8 9 9 0 1 2 3 4 5 6 7 8 Algorithms – Syntax Manipulation d1 d2 c 2 symbol adder s c Can the carry be other than 0 or 1?? no Is it true for any positional base-b system? Yes: (b-1) + (b-1) + 1 = b + (b-1) 1xb 1 0 0 1 2 3 4 5 6 7 8 9 9 0 0 1 2 3 4 5 6 7 8 9 0 1 1 2 3 4 5 6 7 8 9 0 1 2 2 3 4 5 6 7 8 9 0 1 2 3 3 4 5 6 7 8 9 0 1 2 3 4 4 5 6 7 8 9 0 1 2 3 4 5 5 6 7 8 9 0 1 2 3 4 5 6 6 7 8 9 0 1 2 3 4 5 6 7 7 8 9 0 1 2 3 4 5 6 7 8 8 9 0 1 2 3 4 5 6 7 8 9 9 0 1 2 3 4 5 6 7 8 Algorithms – Syntax Manipulation d1 d2 The carry?? 0 0 0 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 c 2 symbol adder s c 1 0 0 1 2 3 4 5 6 7 8 9 9 0 0 1 2 3 4 5 6 7 8 9 0 1 1 2 3 4 5 6 7 8 9 0 1 2 2 3 4 5 6 7 8 9 0 1 2 3 3 4 5 6 7 8 9 0 1 2 3 4 4 5 6 7 8 9 0 1 2 3 4 5 5 6 7 8 9 0 1 2 3 4 5 6 6 7 8 9 0 1 2 3 4 5 6 7 7 8 9 0 1 2 3 4 5 6 7 8 8 9 0 1 2 3 4 5 6 7 8 9 9 0 1 2 3 4 5 6 7 8 8 9 Algorithms – Syntax Manipulation d1 d2 The carry?? 0 0 0 1 2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 1 2 3 4 5 6 7 8 9 0 1 1 2 3 4 5 6 7 8 9 0 1 2 2 3 4 5 6 7 8 9 0 1 2 3 3 4 5 6 7 8 9 0 1 2 3 4 4 5 6 7 8 9 0 1 2 3 4 5 5 6 7 8 9 0 1 2 3 4 5 6 6 7 8 9 0 1 2 3 4 5 6 7 7 8 9 0 1 2 3 4 5 6 7 8 8 9 0 1 2 3 4 5 6 7 8 9 9 0 1 2 3 4 5 6 7 8 1891 + 8709 = 10,600 Algorithm = a procedure for syntax manipulation 0 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 1 1 2 3 4 5 6 7 8 9 0 2 2 3 4 5 6 7 8 9 0 1 3 3 4 5 6 7 8 9 0 1 2 4 4 5 6 7 8 9 0 1 2 3 5 5 6 7 8 9 0 1 2 3 4 6 6 7 8 9 0 1 2 3 4 5 7 7 8 9 0 1 2 3 4 5 6 8 8 9 0 1 2 3 4 5 6 7 9 9 0 1 2 3 4 5 6 7 8 V D L V M C X I Gottfried Leibniz 1646-1716 Use the smallest syntax possible Binary – 0 and 1 Gottfried Leibniz 1646-1716 Leibniz – Binary System Algorithm = a procedure for syntax manipulation Leibniz – Binary System Use the smallest Algorithm = syntax possible a procedure for syntax manipulation Binary – 0 and 1 Algorithms – Syntax Manipulation digit 1 digit 2 carry 2 symbol adder carry sum Algorithms – Syntax Manipulation digit 1 1 digit 2 0 carry 0 2 symbol adder 0 carry 1 sum Algorithms – Syntax Manipulation digit 1 1 digit 2 1 carry 1 2 symbol adder 0 carry 0 sum Algorithms – Syntax Manipulation 0 0 0 d1 c d2 c 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 0 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 2 symbol adder s Algorithms – Syntax Manipulation 0 0 d1 c d2 c 1 1 0 0 1 0 1 2 symbol adder s Algorithms – Syntax Manipulation 0 0 d1 c d2 c 1 1 1 0 0 1 0 1 0 1 0 1 2 symbol adder s Algorithms – Syntax Manipulation 0 0 d1 c d2 c 1 1 1 0 0 1 0 1 0 1 0 1 0 1 0 1 2 symbol adder s Algorithms – Syntax Manipulation 0 0 d1 c d2 c 1 1 1 0 0 1 0 1 0 1 0 1 0 1 0 1 2 symbol adder s 0 0 0 1 1 0 1 1 0 1 Algorithms – Syntax Manipulation 0 0 d1 c d2 c 1 1 1 0 0 1 0 1 0 1 0 1 0 1 0 1 2 symbol adder s 0 0 0 1 0 0 1 0 1 0 1 1 0 1 Algorithms – Syntax Manipulation 0 0 d1 c d2 c 1 1 1 0 0 1 0 1 0 1 0 1 0 1 0 1 2 symbol adder s 0 0 0 1 0 0 1 0 1 0 1 1 0 0 1 1 1 1 Algorithms – Syntax Manipulation 0 0 1 1 1 0 1 1 1 0 0 1 0 1 0 1 0 1 0 1 0 1 2 symbol adder 0 0 0 0 1 0 0 1 0 1 0 1 1 0 0 1 1 1 1 1 c 1 cc 1 0 cc 0 0 c c 1 1 0 2 symbol adder c 2 symbol adder c 2 symbol adder c 2 symbol adder c 1101 + 1001 = ?? 0 1 0 0 0 1 1 1 0 0 1 1 0 1 0 1 0 1 0 0 0 1 0 0 1 0 1 0 1 1 0 0 1 1 1 1 1 c 1 cc 1 0 cc 0 0 c 1 1 1 0 2 symbol adder c 2 symbol adder c 2 symbol adder c 2 symbol adder 0 1101 + 1001 = ?? 0 1 0 0 0 1 1 1 0 0 1 1 0 1 0 1 0 1 0 0 0 1 0 0 1 0 1 0 1 1 0 0 1 1 1 1 1 c 1 cc 1 0 c0 0 0 1 1 1 1 0 2 symbol adder c 2 symbol adder c 2 symbol adder 1 2 symbol adder 0 1101 + 1001 = ?? 0 1 0 0 0 1 1 1 0 0 1 1 0 1 0 1 0 1 0 0 0 1 0 0 1 0 1 0 1 1 0 0 1 1 1 1 1 c 1 c0 1 0 00 0 0 1 1 1 1 0 2 symbol adder c 2 symbol adder 1 2 symbol adder 1 2 symbol adder 0 1101 + 1001 = ?? 0 1 0 0 0 1 1 1 0 0 1 1 0 1 0 1 0 1 0 0 0 1 0 0 1 0 1 0 1 1 0 0 1 1 1 1 1 1 1 00 1 0 00 0 0 1 1 1 1 0 2 symbol adder 0 2 symbol adder 1 2 symbol adder 1 2 symbol adder 0 1101 + 1001 = ?? 0 1 0 0 0 1 1 1 0 0 1 1 0 1 0 1 0 1 0 0 0 1 0 0 1 0 1 0 1 1 0 0 1 1 1 1 1 1 1 00 1 0 00 0 0 1 1 1 1 0 2 symbol adder 0 2 symbol adder 1 2 symbol adder 1 2 symbol adder 0 0 0 0 1 0 1 1 1 0 0 1 1 0 1 0 1 0 1 1101 + 1001 = 10110 13 + 9 = 22 0 1 0 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 Algorithms – Syntax Manipulation We demonstrated addition of two binary numbers d1 c d2 0 2 symbol adder s Q: How will you use a 2 symbol binary adder to add many binary numbers? Multiple addition Game Time Who can WIN the game WIN VI Game Time Who can WIN the game WIN Game Time Who can Players take turns in removing sticks can take as many sticks from a single group the player that removes the last stick wins WIN the game WIN Game Time Who can WIN the game WIN Game Time Who can WIN the game WIN Game Time Who can WIN the game WIN Game Time Who can WIN the game WIN Game Time Who can WIN the game WIN Game Time Who can WIN the game WIN Game Time Who can WIN the game WIN Game Time Who can WIN the game WIN Game Time Who can WIN the game WIN Game Time Who can WIN the game WIN Game Time Who can WIN the game WIN Game Time Who can WIN the game WIN Game Time Who can WIN the game WIN Game Time Who can WIN the game WIN I CAN You have one week! Enjoy it! collaborate! START EARLY!! START EARLY!!! Game Time Who can WIN the game WIN VI=110 Game Time Who can WIN the game An even number of 1s in every position WIN 011 100 110 001 Game Time Who can WIN the game An even number of 1s in every position WIN 011 100 110 001 Game Time Who can WIN the game An even number of 1s in every position WIN 010 100 110 000 Game Time Who can WIN the game An even number of 1s in every position WIN 010 100 110 000 Game Time Who can WIN the game An even number of 1s in every position WIN 010 100 001 111 Game Time Who can WIN the game An even number of 1s in every position WIN 010 100 001 111 Game Time Who can WIN the game An even number of 1s in every position WIN 010 011 001 000 Game Time Who can WIN the game An even number of 1s in every position WIN 010 011 001 000 Game Time Who can WIN the game An even number of 1s in every position WIN 010 011 001 000 Game Time Who can WIN the game An even number of 1s in every position WIN 010 000 001 011 Game Time Who can WIN the game An even number of 1s in every position WIN 010 100 110 001 Game Time Who can WIN the game An even number of 1s in every position WIN 001 000 001 000 Game Time Who can WIN the game An even number of 1s in every position WIN 001 000 001 000 Game Time Who can WIN the game An even number of 1s in every position WIN 000 I CAN 000 001 001 Game Time Who can WIN the game An even number of 1s in every position WIN 000 I CAN 000 000 000 Game Time Who can WIN the game An even number of 1s in every position WIN 000 000 000 000 ...
View Full Document

This note was uploaded on 12/12/2009 for the course IST 4 taught by Professor Shuki during the Spring '09 term at Caltech.

Ask a homework question - tutors are online