Understanding Decimal Addition

Similar documents
Practice Test III, Math 314, Spring 2016

Why write proofs? Why not just test and repeat enough examples to confirm a theory?

Arithmetic and Incompleteness. Will Gunther. Goals. Coding with Naturals. Logic and Incompleteness. Will Gunther. February 6, 2013

1. Introduction to commutative rings and fields

The Basics COPYRIGHTED MATERIAL. chapter. Algebra is a very logical way to solve

Math 4606, Summer 2004: Inductive sets, N, the Peano Axioms, Recursive Sequences Page 1 of 10

EQ: How do I convert between standard form and scientific notation?

1. Introduction to commutative rings and fields

Numbers. The aim of this lesson is to enable you to: describe and use the number system. use positive and negative numbers

0.Axioms for the Integers 1

CHAPTER 1. REVIEW: NUMBERS

8. TRANSFORMING TOOL #1 (the Addition Property of Equality)

For all For every For each For any There exists at least one There exists There is Some

Summer HSSP Lecture Notes Week 1. Lane Gunderman, Victor Lopez, James Rowan

2 Systems of Linear Equations

Peter Kahn. Spring 2007

Introduction to Logic and Axiomatic Set Theory

9.4 Radical Expressions

SECTION 9.2: ARITHMETIC SEQUENCES and PARTIAL SUMS

means is a subset of. So we say A B for sets A and B if x A we have x B holds. BY CONTRAST, a S means that a is a member of S.

Mathematical Reasoning & Proofs

Direct Proof MAT231. Fall Transition to Higher Mathematics. MAT231 (Transition to Higher Math) Direct Proof Fall / 24

A NEW SET THEORY FOR ANALYSIS

Provide Computational Solutions to Power Engineering Problems SAMPLE. Learner Guide. Version 3

a. See the textbook for examples of proving logical equivalence using truth tables. b. There is a real number x for which f (x) < 0. (x 1) 2 > 0.

30. TRANSFORMING TOOL #1 (the Addition Property of Equality)

2. Two binary operations (addition, denoted + and multiplication, denoted

CHAPTER 3: THE INTEGERS Z

Numbers, proof and all that jazz.

Discrete Mathematics and Probability Theory Spring 2014 Anant Sahai Note 3

Math 31 Lesson Plan. Day 2: Sets; Binary Operations. Elizabeth Gillaspy. September 23, 2011

Math Lecture 3 Notes

Discrete Mathematics and Probability Theory Summer 2014 James Cook Note 5

5 + 9(10) + 3(100) + 0(1000) + 2(10000) =

2 Arithmetic. 2.1 Greatest common divisors. This chapter is about properties of the integers Z = {..., 2, 1, 0, 1, 2,...}.

CHAPTER 1: THE PEANO AXIOMS

CONSTRUCTION OF THE REAL NUMBERS.

Seminaar Abstrakte Wiskunde Seminar in Abstract Mathematics Lecture notes in progress (27 March 2010)

MATHE 4800C FOUNDATIONS OF ALGEBRA AND GEOMETRY CLASS NOTES FALL 2011

Exponential and logarithm functions

Discrete Mathematics and Probability Theory Fall 2013 Vazirani Note 1

Base Number Systems. Honors Precalculus Mr. Velazquez

Induction 1 = 1(1+1) = 2(2+1) = 3(3+1) 2

11 Division Mod n, Linear Integer Equations, Random Numbers, The Fundamental Theorem of Arithmetic

Chapter 1 Review of Equations and Inequalities

Basics of Proofs. 1 The Basics. 2 Proof Strategies. 2.1 Understand What s Going On

Chapter 2. Mathematical Reasoning. 2.1 Mathematical Models

PEANO AXIOMS FOR THE NATURAL NUMBERS AND PROOFS BY INDUCTION. The Peano axioms

Countability. 1 Motivation. 2 Counting

Follow links for Class Use and other Permissions. For more information send to:

Chapter 5. Number Theory. 5.1 Base b representations

Gödel s Incompleteness Theorem. Overview. Computability and Logic

Outline. We will now investigate the structure of this important set.

Chapter One. The Real Number System

We say that the base of the decimal number system is ten, represented by the symbol

The next sequence of lectures in on the topic of Arithmetic Algorithms. We shall build up to an understanding of the RSA public-key cryptosystem.

MAGIC Set theory. lecture 2

Discrete Mathematics and Probability Theory Fall 2016 Seshia and Walrand Note 2

Modern Algebra Prof. Manindra Agrawal Department of Computer Science and Engineering Indian Institute of Technology, Kanpur

Gödel s Incompleteness Theorems

CHAPTER 4: EXPLORING Z

Algorithms (II) Yu Yu. Shanghai Jiaotong University

Notes on counting. James Aspnes. December 13, 2010

Notes on arithmetic. 1. Representation in base B

Math 3361-Modern Algebra Lecture 08 9/26/ Cardinality

Proof Techniques (Review of Math 271)

Roberto s Notes on Linear Algebra Chapter 11: Vector spaces Section 1. Vector space axioms

We are here. Assembly Language. Processors Arithmetic Logic Units. Finite State Machines. Circuits Gates. Transistors

The natural numbers. The natural numbers come with an addition +, a multiplication and an order < p < q, q < p, p = q.

Discrete Mathematics and Probability Theory Fall 2018 Alistair Sinclair and Yun Song Note 6

3 The language of proof

Sets. Alice E. Fischer. CSCI 1166 Discrete Mathematics for Computing Spring, Outline Sets An Algebra on Sets Summary

Arithmetical Hierarchy

Peano Axioms. 1. IfS x S y then x y (we say that S is one to one).

Solving Equations. Lesson Fifteen. Aims. Context. The aim of this lesson is to enable you to: solve linear equations

Peano Arithmetic. CSC 438F/2404F Notes (S. Cook) Fall, Goals Now

6. The transfinite ordinals*

COMPUTER ARITHMETIC. 13/05/2010 cryptography - math background pp. 1 / 162

Writing proofs. Tim Hsu, San José State University. May 31, Definitions and theorems 3. 2 What is a proof? 3. 3 A word about definitions 4

Lecture 3: Latin Squares and Groups

Gödel s Incompleteness Theorem. Overview. Computability and Logic

Equivalent Forms of the Axiom of Infinity

Q 2.0.2: If it s 5:30pm now, what time will it be in 4753 hours? Q 2.0.3: Today is Wednesday. What day of the week will it be in one year from today?

Peano Arithmetic. by replacing the schematic letter R with a formula, then prefixing universal quantifiers to bind

Seunghee Ye Ma 8: Week 2 Oct 6

Lesson 7: Algebraic Expressions The Commutative and Associative Properties

There are infinitely many set variables, X 0, X 1,..., each of which is

chapter 11 ALGEBRAIC SYSTEMS GOALS

Now, with all the definitions we ve made, we re ready see where all the math stuff we took for granted, like numbers, come from.

ALGEBRA. 1. Some elementary number theory 1.1. Primes and divisibility. We denote the collection of integers

Laver Tables A Direct Approach

Math 31 Lesson Plan. Day 5: Intro to Groups. Elizabeth Gillaspy. September 28, 2011

After that, we will introduce more ideas from Chapter 5: Number Theory. Your quiz in recitation tomorrow will involve writing proofs like those.

Supplement for MAA 3200, Prof S Hudson, Fall 2018 Constructing Number Systems

König s Lemma and Kleene Tree

ACCESS TO SCIENCE, ENGINEERING AND AGRICULTURE: MATHEMATICS 1 MATH00030 SEMESTER /2018

LECTURE 3. RATIONAL NUMBERS: AN EXAMPLE OF MATHEMATICAL CONSTRUCT

ADVANCED CALCULUS - MTH433 LECTURE 4 - FINITE AND INFINITE SETS

Adding and Subtracting Terms

Divisibility = 16, = 9, = 2, = 5. (Negative!)

Transcription:

2 Understanding Decimal Addition 2.1 Experience Versus Understanding This book is about understanding system architecture in a quick and clean way: no black art, nothing you can only get a feeling for after years of programming experience. While experience is good, it does not replace understanding. For illustration, consider the basic method for decimal addition of one-digit numbers as taught in the first weeks of elementary school: everybody has experience with it, almost nobody understands it; very few of the people who do not understand it realize that they don t. Recall that, in mathematics, there are definitions and statements. Statements that we can prove are called theorems. Some true statements, however, are so basic that there are no even more basic statements that we can derive them from; these are called axioms. A person who understands decimal addition will clearly be able to answer the following simple Questions: Which of the following equations are definitions? Which ones are theorems? If an equation is a theorem, what is the proof? 2 + 1 = 3, 1 + 2 = 3, 9 + 1 = 10. We just stated that these questions are simple; we did not say that answering them is easy. Should you care? Indeed you should, for at least three reasons: i) In case you don t even understand the school method for decimal addition, how can you hope to understand computer systems? ii) The reason why the school method works has very much to do with the reason why binary addition in the fixed-point adders of processors works. iii) You should learn to distinguish between having experience with something that has not gone wrong (yet) and having an explanation of why it always works. The authors of this text consider iii) the most important. Springer International Publishing Switzerland 2016 W.J. Paul et al., System Architecture, DOI 10.1007/978-3-319-43065-2_2 7

8 2 Understanding Decimal Addition 2.2 The Natural Numbers In order to answer the above questions, we first consider counting. Since we count by repeatedly adding 1, this should be a step in the right direction. The set of natural numbers N and the properties of counting are not based on ordinary mathematical definitions. In fact, they are so basic that we use five axioms due to Peano to simultaneously lay down all properties about the natural numbers and of counting we will ever use without proof. The axioms talk about a special number 0, the set N of all natural numbers (with zero), counting formalized by a successor function S : N N, and subsets A N of the natural numbers. Peano s axioms are 1. 0 N. Zero is a natural number. Note that this is a modern view of counting, because zero counts something that could be there but isn t. 2. x N S(x) N. You can always count to the next number. 3. x y S(x) S(y). Different numbers have different successors. 4. y. 0 = S(y). By counting you cannot arrive at 0. Note that this isn t true for computer arithmetic, where you can arrive at zero by an overflow of modulo arithmetic (see Sect. 3.2). 5. A N 0 A (n A S(n) A) A = N. This is the famous induction scheme for proofs by induction. We give plenty of examples later. In a proof by induction, one usually considers a set A consisting of all numbers n satisfying a certain property P(n): Then, A = {n N P(n)}. n A P(n), A = N n N : P(n), and the induction axiom translates into a proof scheme you might or might not know from high school: Start of the induction: show P(0). Induction step: show that P(n) implies P(S(n)). Conclude n N : P(n). Property P holds for all natural numbers. With the rules of counting laid down by the Peano axioms, we are able to make two ordinary definitions. We define 1 to be the next number after 0 if you count. We also define that addition of 1 is counting. Definition 1 (Adding 1 by Counting). 1 = S(0), x + 1 = S(x).

2.2 The Natural Numbers 9 With this, the induction step of proofs by induction can be reformulated to the more familiar form Induction step: show that P(n) implies P(n + 1). 2.2.1 2 + 1 = 3 is a Definition One can now give meaning to the other digits of decimal numbers with the following mathematical definition. Definition 2 (The Digits 2 to 9). Thus, 2 + 1 = 3 is the definition of 3. 2 = 1 + 1 = S(1), 3 = 2 + 1 = S(2), 4 = 3 + 1 = S(3),. 9 = 8 + 1 = S(8). 2.2.2 1 + 2 = 3 is a Theorem Expanding definitions, we would like to prove it by 1 + 2 = 1 + (1 + 1) (Definition of 2) = (1 + 1) + 1 = 2 + 1 (Definition of 2) = 3 (Definition of 3). With the axioms and definitions we have so far we cannot prove the second equation yet. This is due to the fact that we have not defined addition completely. We fix this by the following inductive definition. Definition 3 (Addition). x + 0 = x, x + S(y) = S(x + y). In words: adding 0 does nothing. In order to add y + 1, first add y, then add 1 (by counting to the next number). From this we can derive the usual laws of addition. Lemma 1 (Associativity of Addition). (x + y) + z = x + (y + z).

10 2 Understanding Decimal Addition Proof. by induction on z. For z = 0 we have by definition of addition (adding 0). (x + y) + 0 = x + y = x + (y + 0) For the induction step we assume the induction hypothesis x + (y + z) = (x + y) + z. By repeatedly applying the definition of addition we conclude (x + y) + S(z) = S((x + y) + z) (by definition of addition) = S(x + (y + z)) (by induction hypothesis) = x + S(y + z) (by definition of addition) = x + (y + S(z)). Substituting x = y = z = 1 in Lemma 1, we get (1 + 1) + 1 = 1 + (1 + 1) which completes the missing step in the proof of 1 + 2 = 3. Showing the commutativity of addition is surprisingly tricky. We first have to show two special cases. Lemma 2. 0 + x = x. Proof. by induction on x. For x = 0 we have by the definition of addition. 0 + 0 = 0 For the induction step we can assume the induction hypothesis 0+x = x and use this to show Lemma 3. x + 1 = 1 + x. 0 + S(x) = S(0 + x) (definition of addition) Proof. by induction on x. For x = 0 we have = S(x) (induction hypothesis). 0 + 1 = 1 = 1 + 0 by the previous lemma and the definition of addition. For the induction step we can assume the induction hypothesis x + 1 = 1 + x and show 1 + S(x) = S(1 + x) (definition of addition) = S(x + 1) (induction hypothesis) = S(x) + 1 (definition of counting by adding 1).

2.2 The Natural Numbers 11 Lemma 4 (Commutativity of Addition). x + y = y + x. Proof. by induction on y. For y = 0 we have x + 0 = x (definition of addition) = 0 + x (Lemma 2). For the induction step we can assume the induction hypothesis x + y = y + x and show x + S(y) = S(x + y) (definition of addition) = S(y + x) (induction hypothesis) = y + S(x) (definition of addition) = y + (x + 1) (definition of counting by adding 1) = y + (1 + x) (Lemma 3) = (y + 1) + x (associativity of addition) = S(y) + x (definition of counting by adding 1). By induction one shows the following in the same way. Lemma 5. (x + y) z = x z + y z (distributivity), (x y) z = x (y z) (associativity of multiplication), x y = y x The proof is left as an exercise. (commutativity of multiplication). 2.2.3 9 + 1 = 10 is a Brilliant Theorem The proof of 9 + 1 = 10 is much more involved. It uses a special biological constant defined as Z = 9 + 1 which denotes the number of our fingers or, respectively, toes 1. Moreover it uses a definition attributed to the brilliant mathematician al-khwarizmi, which defines the decimal number system. Definition 4 (Decimal Numbers). An n-digit decimal number a n 1...a 0 with digits a i {0,...,9} is interpreted as n 1 a n 1...a 0 = a i Z i. i=0 1 We use the letter Z here because in German, our native language, the word for ten is zehn and the word for toes is Zehen, thus it s almost the same.

12 2 Understanding Decimal Addition Substituting n = 2, a 1 = 1, and a 0 = 0 we can derive the proof of 9 + 1 = 10. We must however evaluate the formula obtained from the definition of decimal numbers; in doing so, we need properties of exponentiation and multiplication: 10 = 1 Z 1 + 0 Z 0 (definition of decimal number) = 1 Z + 0 1 (properties of exponentiation) = Z + 0 (properties of multiplication) = Z (definition of addition) = 9 + 1 (definition of Z). Observe that addition and multiplication are taught in elementary school, whereas exponentiation is only treated much later in high school. In this order we cannot possibly fill the gaps in the proof above. Instead, one defines multiplication and exponentiation without relying on decimal numbers, as below. Definition 5 (Multiplication). Definition 6 (Exponentiation). By Lemma 2 we get x 0 = 0, x S(y) = x y + x. x 0 = 1, x S(y) = x y x. x 1 = x (S(0)) = x 0 + x = 0 + x = x. i.e., multiplication of x by 1 from the right results in x. In order to progress in the proof of 9 + 1 = 10, we show the following. Lemma 6. 1 x = x. Proof. by induction on x. For x = 0 we have by the definition of multiplication. 1 0 = 0 For the induction step we can assume the induction hypothesis 1 x = x and show Using Lemma 6, we get 1 S(x) = 1 x + 1 (definition of multiplication) = x + 1 (induction hypothesis). x 1 = x S(0) = x 0 x = 1 x = x. (1) We finish the section by showing a classical identity for exponentiation.

2.3 Final Remarks 13 Lemma 7. x y+z = x y x z. Proof. by induction on z. For z = 0 we have (leaving the justification of the steps as an exercise) x y+0 = x y = x y 1 = x y x 0. For the induction step we assume the induction hypothesis x y+z = x y x z and show x y+s(z) = x S(y+z) (definition of addition) = x (y+z) x (definition of exponentiation) = (x y x z ) x (induction hypothesis) = x y (x z x) (associativity of multiplication, Lemma 5) = x y (x S(z) ) (definition of exponentiation). 2.3 Final Remarks Using decimal addition as an example, we have tried to convince the reader that being used to something that has not gone wrong yet and understanding it are very different things. We have reviewed Peano s axioms and have warned the reader that computer arithmetic does not satisfy them. We have formally defined the value of decimal numbers; this will turn out to be helpful, when we study binary arithmetic and construct adders later. We have practiced proofs by induction and we have shown how to derive laws of computation without referring to decimal representations. We recommend to remember as key technical points: Peano s axioms. the inductive definition of addition as iterated counting x + 0 = x, x + (y + 1) = (x + y) + 1. for parties: 2 + 1 = 3,1 + 2 = 3,9 + 1 = 10. Which are theorems? Everything else is easy. Rules of computation are shown by induction; what else can you do with an inductive definition of addition? And of course multiplication is defined by iterated addition and exponentiation is defined by iterated multiplication. A proof of the usual rules of computation governing addition, subtraction, multiplication, and division of the rational numbers and/or the real numbers can be found in [Lan30]. The recursive definitions of addition, multiplication, and exponentiation that we have presented also play a central role in the theory of computability [Rog67, Pau78].

14 2 Understanding Decimal Addition 2.4 Exercises 1. For each of the following statements, point out which ones are definitions and which ones are theorems for x,y N. Prove the theorems using only definitions and statements proven above. a) x = x + 0, b) x = 0 + x, c) x + (y + 1) = (x + y) + 1, d) (x + 1) + y = (y + x) + 1, e) x 0 = 0, f) 0 x = 0, g) 5 + 1 = 6, h) 7 + 4 = 11. 2. Prove Lemma 5. 3. Prove the following properties of exponentiation for a,b,c N. (a b) c = a c b c, (a b ) c = a b c. 4. We define a modified subtraction of natural numbers : N N by x y = { x y, x y, 0, otherwise. Give an inductive definition of this function, starting with the successor function S(x). Hint: clearly you want to define a modified decrement function D(x) = x 1 first. Do this by an inductive definition.

http://www.springer.com/978-3-319-43064-5