Global Optimization in Type Theory. Roland Zumkeller


 Mavis Houston
 2 years ago
 Views:
Transcription
1 Global Optimization in Type Theory Roland Zumkeller
2
3 revision 3
4
5 In memory of my grandfather Wolfgang Merkel 5
6
7 Contents Thank You! 9 List of Figures 11 Introduction 13 Chapter 1. Preliminaries Type Theory Lists Polynomials 21 Chapter 2. Numbers Integers Dyadics Rationals Reals 42 Chapter 3. Intervals Arithmetic Irrational Functions The Dependency Problem Branch and Bound 54 Chapter 4. Bernstein Polynomials The Bernstein Bases Differentiation and Integration Bounding Several Variables Examples 74 Chapter 5. Function Sets Taylor Models Chebyshev Balls Polynomial Models 90 Conclusion 95 Appendix A. Flyspeck 97 Appendix B. CoRN 101 When Strong Extensionality is Too Strong 101 Bibliography 105 Index 109 Errata and Changes 111 7
8
9 Thank You! I m deeply indebted to many people without whom this thesis would never have seen daylight. First I would like to thank Gilles Dowek for his class on programming languages at Polytechnique and encouraging me to undertake graduate studies. His clear way of both answering and asking questions has always been a model for me and tremendously stimulated my interest in academic research. Many thanks are due to my advisor, Benjamin Werner, whose comments and moral support were essential to me. Among many other lessons, he taught me that there is always a shorter, more elegant, way of saying things. Thanks to Thomas Hales for patiently answering many questions about his proof of the Kepler conjecture. His work gave the original motivation for this thesis and I m deeply honoured that he accepted to be on the committee. Thanks to Tobias Nipkow, who let me work in his team at TU Munich as an undergraduate student. He introduced me not only to the pleasures of functional programming, but also allowed me a first glance at formal proofs. Thanks to Bruno Barras and Hugo Herbelin for having kept their office doors always open. It was a privilege to have such easy access to enlightening explanations on Coq and beyond. Thanks to Georges Gonthier for many generous explanations on a variety of formalization questions. His unique perspective encouraged me to pay a lot more attention to many details. Thanks to Nathalie Revol for important feedback and advice, as well as for offering to read a draft version of this thesis. Thanks to César Muñoz for welcoming me at NASA s NIA institute during December I greatly appreciated this stimulating work environment. Thanks to Bas Spitters, Milad Niqui, and Russell O Connor. They taught me a lot about constructive mathematics and real numbers. Visiting their team at Nijmegen was a very enjoyable experience. Thanks to Assia Mahboubi and Guillaume Melquiond. They not only helped me to lessen my ignorance on several mathematical topics, but were also pleasant office neighbors. 9
10 Thanks to Sean McLaughlin for many discussions about computer science related topics and others. Thanks to Catherine Moreau and Martine Thirion, whose friendliness made me feel at home at LIX and in the INRIA/Microsoft Joint Lab. Thanks to Philipp, Wassim, Fethallah, Arash, Domingo, and others for lasting friendship. Thanks to Marwa. Thanks to my parents and family. 10
11 List of Figures 0.1 A seventeenthcentury wine merchant The facecentered cubic packing Transitions in the computation of the binary gcd Taylor approximations of the logarithm function 83 11
12
13 Introduction Optimization as a mathematical discipline is concerned with effectively determining the minimum or the maximum of a given function. This problem arises in a great variety of fields, reaching from chemistry to pure mathematics. Scientific progress has often been driven by practical problems. Beyond academia, engineers use optimization methods to make sensible choices for physical parameters, and capitalist economy poses the question of how to put limited resources to maximal benefit. Figure 0.1. A seventeenthcentury wine merchant It is a very practical problem that led Johannes Kepler to an important observation about the behaviour of a function around a maximum. In the autumn of 1613, just after his second wedding, he had a number of wine barrels delivered to his cellar. A few days later, as it was customary at the time, the merchant came to measure the diagonal of each barrel with a gaugingrod. This was how he determined the volume and therefore the price to pay. But was he right? Kepler was 13
14 astonished by this method without consideration for the geometrical shape, without further reflection or calculation 1 and as district mathematician in the Austrian city of Linz he felt it was his duty to examine its validity. He thus took on the task of analyzing the problem in the most rigorous imaginable manner, which at the time meant to follow the style of the ancient Greek mathematicians. The result of this effort is his treatise Nova stereometria doliorum vinariorum Kep11. Following a description of a method to calculate the volumes of rotational bodies, its second part gives an answer to a related question: Among all cylinders of the same diagonal which one has the largest volume? He shows by elementary means that for this a ratio of 2 : 1 between base diameter and height is required. Incidentally, this is almost what the Austrian coopers of the time were used to producing; their barrels came in different sizes, but all with a ratio of a little less (due to curvature) than 3 : 2. Kepler lauds them for coming so close to the optimal value, excusing their small error by the following remark: Near a maximal value the neighborhoods on both sides show only an insensible decrease at the beginning. 2 He did not use this fact to determine the maximum (he found it by elementary means instead), but at a time when analysis was still behind the horizon of mathematical knowledge this was a remarkable observation it is often seen as the first time in history that the connection between extremum and tangent is made. A few decades later, Fermat stated explicitly the wellknown necessary criterion of zero derivatives for local extrema, then generalized by Euler to functions of several variables Eul55. This socalled derivative check is of utmost importance for many optimization algorithms, as we will see in section 3.4. Was the measurement method used by the wine merchants accurate or not? In the third part of his treatise Kepler gives the answer: since their method consisted solely of measuring the diagonal, the validity depends on the ratio between base diameter and height. This means that the scales used in Linz were valid for Austrian barrels with their ratio of almost 2 : 1, but not for imported ones barrels imported from Hungary were longer, the ones coming from the Rhineland shorter. However, the local wine merchants used the same gaugingrods and scales for all barrels indiscriminately. Since the Austrian barrel had (almost) maximal volume for a fixed diagonal, they overestimated the volume of all foreign barrels and therefore paid too much for them. Optimization as a Means of Verification. By determining that the wine merchants of Linz systematically incurred financial loss when buying foreign barrels, Kepler solved an optimization problem. A large portion of his treatise consisted of 1... ohne Rücksicht auf die geometrische Gestalt, ohne weitere Überlegung oder Rechnung... Kep11 2 Circa maximum vero utrinque circumstantes decrementa habent initio insensibilia. 14
15 a rigorous proof that was meant to verify that his answer ( the Austrian ones ) was correct. This connection between optimization and verification seems to be universal and unchanged since the days of Kepler: solving an optimization problem usually aims at verifying that a given function respects some bound (whether it be known in advance or not). However, two aspects of optimization have largely evolved over the last few centuries: The manual work of Kepler writing down an ingenious proof has been replaced by more and more systematic methods. Calculus has greatly contributed to their development and eventually led to the design of powerful algorithms requiring a computer to be executed effectively. Furthermore, the notion of rigorous has progressed significantly since the beginning of the 20th century. During the renaissance it had still meant to follow the style of the ancient Greeks, namely to deduce new truths by deduction from axioms, using syllogisms. Today the greatest rigor requires a formal proof, i.e. a very detailed proof that can be checked mechanically by a machine. This thesis is about formal correctness proofs of optimization algorithms: we present definitions and proofs in type theory, materialized by the Coq proof assistant Cdt04. The aim of our work is to machinecheck proofs against the definitions and obtain as a result certified algorithms that solve optimization problems, minimizing the risk of software bugs. The Problem. Optimization in itself is a wide field: the problem variables can be real numbers, integers or others; constraints on them can be boxformed, linear, more complex, or absent; we can be interested in local or in global extrema. To clarify our focus, we first state the problem. Problem 0.1. Given a box a 1 ; b 1... an ; b n R n and a function f : R n R, find an interval Y such that min X f Y. The width of Y should not exceed some given precision ε. Depending on the nature of f different methods apply: (1) Interval arithmetic can be used if f has a socalled interval extension. This is in particular the case if f is continuous. The method can be made more efficient if f is also differentiable. This method is explained in chapter 3. (2) If f is polynomial, it can be converted to the Bernstein basis, in which efficient algorithms provide a way to determine the minimum. They will be presented, along with detailed proofs, in chapter 4. (3) Often f can be efficiently approximated by a polynomial, e.g. if f is smooth, using Taylor s theorem (if f is smooth). Depending on the nature of f, different approximation theorems apply. This approach is described in chapter 5. 15
16 It is hard to make a precise statement about which method is preferable for what kind of problem. However, interval arithmetic tends to be efficient in low dimension (typically 3) and small values of ε, while the methods of chapter 5 aim to deal with problems of higher dimensions, but with less precision. Applications. At the beginning it was mentioned that global optimization is useful in a variety of fields. However, there is one particularly interesting application that has been our initial motivation. In 1611, Johannes Kepler (and this is already the second time we encounter him) stated a conjecture on sphere packings. Theorem 0.2. The maximal density of sphere packings in 3space is The density π 18 π 18. is attained by the socalled hexagonalclose and the facecentered cubic (see figure 0.2) packings, which correspond to the way most people would intuitively stack oranges, leading to a pyramid shape. Figure 0.2. The facecentered cubic packing A proof of this conjecture had been long sought for and the problem has a very prominent history Hal06. It was solved only in 1998, when Thomas Hales came up with a proof Hal04. However, this proof has one feature that makes it difficult to judge its correctness: it consists not only of several hundred pages of pencilandpaper mathematics, but it has also a computational part: a good amount of nontrivial algorithms are executed many times, in order to check a finite (but large) number of subcases arising in the proof. In this it is similar to the proof of the four colour theorem, which had a similar status until it has been entirely formalized in Coq Gon05. Thomas Hales began an effort 3 to develop a formal proof for the Kepler conjecture. So far, the graph enumeration algorithms and linear programming techniques used in the proof have been formalized and proved correct NBS06. Our work aims at making progress on the third component, that consists of a long list of real inequalities, occurring in the proof. Here is one example: 3 Flyspeck is an acronym that stands for formal proof of the Kepler conjecture. 16
17 x : R x x x x x x < π 2 + arctan x 1 x 3 + x 2 x 5 x 1 x 4 x 3 x 6 + x 4 x 6 x 2 ( x 2 + x 1 + x 3 x 5 + x 4 + x 6 ) v u t 4x 2 ( x2 x 5 ( x 2 + x 1 + x 3 x 5 + x 4 + x 6 ) + x 1 x 4 (x 2 x 1 + x 3 + x 5 x 4 + x 6 ) + x 3 x 6 (x 2 + x 1 x 3 + x 5 + x 4 x 6 ) x 1 x 3 x 5 x 2 x 3 x 4 x 2 x 1 x 6 x 5 x 4 x 6 ) A proof of this inequality can be found in appendix A (lemma A.5). However, this inequality is among the easier ones! A list of the about thousand such inequalities occurring in the proof of the Kepler conjecture can be found in McL. Before they can be fed into a general optimization procedure they are subject to dimension reduction as described in Hal08: arguments inspired by geometrical insight are used to break down each inequality in several cases of lower dimension. What is new? The main original contributions of this thesis are enumerated at the beginning of chapters 4 and 5. On the other hand, the first three chapters contain little original work, but aim to present their material in a manner that is up to the requirements of formal proof. 17
18
19 CHAPTER 1 Preliminaries A formal proof distinguishes itself from an informal one not only by the level of detail, but also by the fact that it is given in a precise, defined language. Ideally, proofs written in such a language can be checked by a proof assistant. We have chosen to use the proof assistant Coq Cdt04, for its expressive language, and because it accommodates computational proofs well GL02, Gré Type Theory While proofs in formal languages are machinecheckable, informal presentations can be more intuitive. Our presentation here takes a hybrid approach. While closely sticking to formal definitions, we stop short of (with the exception of chapter 2) displaying concrete Coq syntax. However, many notations and conventions that we found to increase clarity are borrowed from formal proof and functional programming. This chapter describes them in a manner appealing to the reader s intuition. More rigorous presentations can be found in Cdt04. To begin with, we try to avoid ambiguous language such as the function x Assuming x : R is declared, x 2 +2 has the type R, not R R. Coq would reject it in a place where a function is expected, so we avoid it. Instead, we prefer writing the function x x (in some presentations this would be written λx. x ). Function application is written by simple juxtaposition, so we write f x instead of f(x). It has lower precedence than any infix operator, so f x+y stands for (f x) + y, not f (x + y). For definitions, f x :=... is a shorthand for f := x.... Also, we implicitly use the fact that the function spaces A B C and A B C are isomorphic. We may thus write f x y for f (x, y) and viceversa. This extends to partial application: if f : A B C then f x denotes y f (x, y). Finally, partial application may be used with infix operators, so (+ a) denotes x x + a, and (a +) denotes x a + x. Indeed x + y = (+ y) x = (x +) y. Universally quantified statements are written as x : A. P x, meaning P x holds for all x of type A. If A is clear from the context, or the position x occurs in, we write simply x. P x. The power set (the set of all subsets) of a set A is denoted A. 19
20 Pointwise operations on functions are denoted by a dot above the operation symbol: f + g stands for x f x + g x. MultipleDispatch Overloading. It is in fact possible to use the same symbol for different operations, and associate it to different meanings, according to the type. For example + can be made to stand for both addition an the reals and for pointwise addition (allowing us to omit the dot on top of +). Recent work added Haskellstyle type classes Coq, in order to allow this socalled overloading SO08. It can also by achieved by encoding the operations in records and using canonical structures, using a trick due to Georges Gonthier personal communication: Variables A B : Type. Variable AAmul : A A A. Variable BBmul : B B B. Variable ABmul : A B B. Variable BAmul : B A B. Record mul_class (R : Type) : Type := MulClass { mul_src : Type; mul_op : mul_src R }. Notation x y := (mul_op x y). Record A_mul_class (R : Type) : Type := AMulClass { A_mul_src : Type; A_mul_op : A A_mul_src R }. Record B_mul_class (R : Type) : Type := BMulClass { B_mul_src : Type; B_mul_op : B B_mul_src R }. Canonical Structure A_mul R S := MulClass (A_mul_op R S). Canonical Structure B_mul R S := MulClass (B_mul_op R S). Canonical Structure A_mul_A := AMulClass AAmul. Canonical Structure B_mul_B := BMulClass BBmul. Canonical Structure B_mul_A := BMulClass BAmul. Canonical Structure A_mul_B := AMulClass ABmul. Now if a : A and b : B, then all four of a a : A, a b : B, b a : B, and b b : B. In the case where A can be injected into B, one might want to do this with Coq s 20
21 coercion mechanism. However coercions are inserted sequentially in arguments, so multiple dispatching is not possible Lists Time and again we will manipulate lists of objects. Given a type A, the type A k denotes ktuples of type A. The values x 1,..., x k denote the components of x = (x 1,..., x k ). A is the type of lists of arbitrary length, i.e. k Ak. We use the terms lists, tuple and vector interchangeably, with a preference for the latter two if something about the length is known. The operation denotes list concatenation: if x : A k1 and y : A k2 then x y := (x 1,..., x k1, y 1,..., y k2 ). The operation of adding a single element in front of a list is written by ; : if a : A and x : A k, then a ; x := (a, x 1,..., x k ). Adding a single element at the end of a list is denoted by. : x. a := (x 1,..., x k, a). x : A k ). The first and the last element of a list are denoted x := x 1 and x := x k (for The operation removing the first (resp. last) element of a list is written as prefix (resp. postfix ): For x : A k, x := (x 2,..., x k ) and x := (x 1,..., x k 1 ). The reversed list is noted rev (x 1,..., x k ) := (x k,..., x 1 ). We note (a) k for (a,..., a). Finally, x denotes the length of a list x. } {{ } k times 1.3. Polynomials Polynomials have been formalized many times, so we shall not attempt to repeat this task here. Instead, we list basic properties that we reasonably expect to hold, along with some notations. For formal proofs the reader is referred to e.g. CoR, Mah06. The term polynomial in this section refers to polynomials in the power basis 1, X, X 2,.... A different one, the Bernstein basis, will be introduced in chapter 4, where the contents of this section will serve as a tool. Assumption 1.1. Let C be a ring, whose elements we will call the coefficients. Definition 1.2. A polynomial is a list of coefficients C, i.e. of type C, also noted C1. Evaluation is defined by: : C1 C C () x 0 c ; p x c + x p x Furthermore, we shall permit ourselves to write p x as a shorthand for p x. 21
22 In many mathematical texts (e.g. in probability theory) the term variable has a somewhat mystical standing. In formal type theory, a variable is a symbol bound either by a function abstraction, i.e. x..., or a quantifier, i.e. x..... How does the variable of a polynomial relate to this? The answer is given by carefully distinguishing between the polynomial (a list of coefficients), e.g. (1, 2, 3), and its associated function (1, 2, 3) = x 1+2x+3x 2. We shall thus never speak of the polynomial 1 + 2x + 3x 2, since the status of x in it is unclear (e.g., is it the same as 1 + 2y + 3y 2?). Nevertheless, since such abusive language is often found to be convenient, we provide a formal definition that allows the same briefness. Definition 1.3 (Zero, one, and variable). 0 := () 1 := (1) X := (0, 1) X a;b := (a, b a) Note that X = id. With this definition 1 + 2X + 3X 2 = (1, 2, 3) is a polynomial, and 1 + 2X + 3X 2 := x 1+2x+3x 2. As far as type theory is concerned, X is not a variable, but a defined constant of type C1. The same is true for 0 and 1. Furthermore, we assume the domain 0; 1 for all polynomials. If other domains are of interest the variables can be easily stretched: The polynomial (a, b a) has the same range on 0; 1 as X on a; b. Addition and multiplication of polynomials will be noted + and. Lemma 1.4. The set of polynomials C1 with + and forms a ring. Definition 1.5. Composition of two polynomials is defined by: : C1 C1 C1 () q () c ; p q c + q (p q) Lemma 1.6. p q = p q Definition 1.7. The differentiation operator on power basis polynomials is defined as: : C k+1 C k := p (p 1, 2p 2,..., kp k ) Lemma 1.8 (Linearity of differentiation). For any α : R, (α p) = α p. Lemma 1.9 (Chain Rule). (p q) = ( p q) q 22
23 Lemma 1.10 (Product Rule). (p q) = p q + p q Definition Assuming that C has characteristic zero, the integration operator on power basis polynomials is defined as: S : C C k C k+1 := c p c ; (p 1, p2 2,..., p k k ) Note that S c p is x c + x 0 p(ξ)dξ in traditional notation. Theorem 1.12 (Fundamental theorem of calculus for polynomials). For any polynomial p : C k+1, S ( p) ( p) = p. Theorem For any polynomial p : C1, ( S c p) = p. Corollary For any two polynomials p, p : C1, p = p p = p p = p. Proof. We have S ( p) ( p) = S ( p ) ( p ) and thus by applying theorem 1.12 on both sides p = p. Lemma For any α : R, S c p (α X ) = S c ((α X ) p (α X )) Proof. By corollary Several Variables. Since our coefficients C were required to be a ring (assumption 1.1) and the polynomials C1 form a ring (lemma 1.4) themselves, polynomials can be used as coefficients of polynomials. This is a standard trick to obtain multivariate polynomials Mah06. Definition 1.16 (Multivariate polynomials). C0 := C Cn + 1 := (Cn)1 Our previous remarks on carefully using the notion variable and not relying on their names applies here two. In contrast to CX, Y, which is often seen, C2 solely refers to the number of variables. For p Cn we will use the notation p x to abbreviate p x 1... xn (note that in this latter term p x 1 Cn 1). Furthermore Cn can take a 23
24 different meaning if C is replaced by certain special symbols: Tn, Qn, Pn, d will be defined in chapter 5. Note that, alternatively, we could have defined Cn + 1 := (C1)n (this is reminiscent of the two ways to define Church numbers). 24
25 CHAPTER 2 Numbers Today, in most pieces of software used and developed, numbers are treated as commodity. Modern microprocessors offer instructions to compute with integers and floatingpoint numbers, a choice which is reflected in most programming languages. However, being finite, these machine numbers are only approximations of the mathematical objects they are usually supposed to model, namely N, Z, Q, or R. A program can only be expected to be correct if the results of all its intermediate computations are machinerepresentable. If they are not (and often this is not obvious), a computation either aborts with an error, or much worse gives a wrong result. Luckily, this problem can be overcome. The solution consists of generalizing the notion of machinerepresentable: N and Z can be implemented by finite digit lists (section 2.1), Q by pairs of integers representing fractions (section 2.3), and R by Cauchy sequences or digit streams (section 2.4). These representations are no longer finite approximations of the intended mathematical objects, but coincide precisely with them. This is indeed a necessity for the purpose of formalizing mathematics: if addition on Z was defined in a way such that = 0 it could not be part of an ordered ring. The same is true if =, where denotes an error element Integers Before we look into more efficient representations of large numbers, we will briefly describe how proof assistants commonly represent N and Z. The emphasis here is on the accuracy of the models, so efficiency considerations are secondary Unary Representation. In the Coq standard library N is implemented by an inductive definition: Inductive nat := O S of nat. The object O represents the number 0 and S the successor function. Note that S does not compute a value from an argument. It is only a primitive symbol (a constructor), of which, together with O, objects of type nat can be constructed. Accordingly, the number 5 is represented by S (S (S (S (S 0) ) ) ) and 2 32 S (S (... O) ), consuming an amount of memory linear in the size of the number. } {{ } 2 32 times as 25
26 Addition and multiplication are defined by structural recursion on the first argument: Fixpoint plus a b := if a is S a then S (plus a b) else b. Fixpoint mult a b := if a is S a then plus b (mult a b) else O. Although this representation perfectly models the set N and is often convenient for reasoning, it becomes quickly unusable for computations involving larger numbers the time complexity of addition is linear in the size of its first argument Binary Representation. The Coq standard library therefore offers another type, representing positive natural numbers more efficiently: Inductive positive := xi of positive xo of positive xh. The constructors xi and xo represent the functions (x 2x + 1) and (x 2x), while xh stands for 1. Again, they are constructors, so they don t compute. The first two can be noted more conveniently in postfix notation: Notation p 1 := (xi p). Notation p 0 := (xo p). In this binary representation memory usage is only logarithmic in the size of the number: xh 0 1 stands for 5 and xh } {{ } 32 times for On the other hand, the successor function is not represented directly by a constructor, so it has to be defined by structural recursion: Fixpoint Psucc x := match x with p 1 (Psucc p) 0 p 0 p 1 xh xh 0 end. Note that Coq does not use machine integers to perform these operations. It just evaluates each function stepbystep, following its definition, e.g.: Psucc (xh 0 1) (Psucc (xh 0)) 0 xh 1 0 The slightly more technical definitions of addition and multiplication in this representation can be found, along with many others, in the Coq standard library. Although these are considerably faster than in the unary representation, they are still slower than the primitive instructions provided by microprocessors. On the other hand, when computations on positive are performed, the CPU is only used to perform symbolic manipulations, not as a calculator. In such a setting hardware bugs will more likely lead to crashes than to erroneous results Nic94. Finally, the entire set of integers Z is modeled by the inductive definition Inductive Z := Z0 Zpos of positive Zneg of positive. 26
27 The standard library provides implementations of all common integer operations on this type Machine Integers. For the many situations where worries about hardware bugs, standard libraries, and compilers are to be dismissed as paranoid, Coq also provides primitive 31bit machine integers (the 32nd bit is used for bookkeeping by the garbage collector) Spi06: Inductive digits := D0 D1. Inductive int31 := I31 of digits & digits & digits & digits & digits & digits & digits & digits & digits & digits & digits & digits & digits & digits & digits & digits & digits & digits & digits & digits & digits & digits & digits & digits & digits & digits & digits & digits & digits & digits & digits. This type comes with operations computing modulo 2 31, e.g.: add31 : int31 int31 int31 mul31 : int31 int31 int31 When the arguments to these functions are closed terms (i.e. concrete numbers, without variables in their bits), fast machine operations are used to perform the computation in a single step. In short, int31 is a very fast implementation of Z/31Z that can be used in Coq terms ArbitrarySize Natural Numbers. As mentioned in the introduction of this chapter, implementations of algorithms based (for example) on N can only be expected to be correct on all possible inputs if the numbers used actually model the set N accurately, rather than being only an approximation like Z/31Z. While the binary representation of subsection offers such an accurate implementation, it processes only a single binary digit in one step of computation. In contrast, the machine integers int31 are fast, but implement Z/31Z, not N. If we want to achieve both good performance and accurate representation of N, a little more work is necessary: integers of arbitrary size (only limited by machine memory) can be implemented by gluing several machine integers int31 together. It is possible to implement operations on such numbers that are much faster than those on objects of type positive. This has been of particular interest for verified primality tests that have been carried out in Coq GTW06. The numbers processed by these algorithms are indeed very large, meaning several thousand decimal digits. The implementation of arbitrarysize integers developed for this purpose, the library BigN, is particularly adapted to this situation: not only does it use Karatsuba s fast algorithm for multiplication; it also represents a number as 27
28 a tree, providing access in logarithmic time to all the last digits. This makes it possible to implement integer square root and division very efficiently. While these treeintegers have proved useful for the treatment of huge prime numbers, they come with an associated overhead: the tree needs to be kept in balance, and simple operations such as addition need to do recursion over a tree instead of a list, which is slightly more expensive. It will turn out, that the integers used in our development will typically be large, but not huge. Therefore this overhead does not pay off in our case and we achieved better overallperformance by using the more traditional flavor of arbitrarysize integers represented as lists Knu69. Let us now turn to the Coq implementation: we begin by defining the type t of medium (i.e. large, but not huge) arbitrarysize integers as a list of int31 digits. We place it in a module medn and the variable names m and n are declared to be of type medn.t. Definition t := list int31. Implicit Types m n : t. An arbitraryprecision integer can easily be constructed from a single int31 digit: Definition of_int31 i : t := i. It is explained what number an object of type t represents by converting it to type Z (cf. subsection 2.1.2): Fixpoint to_z n := if n is n0 :: n then Int31. phi n0 + Int31. base to_z n else 0. The function Int31. phi converts int31 to Z. Our arbitrarysize numbers can be seen as numbers in base Int31.base = Note that to_z is not injective. Indeed, leading 1 zeros cause an ambiguity in the representation: the objects 42 and 42;0 stand for the same number. A normalization function that removes any leading zeros is provided 2 : Fixpoint norm n := if n is i :: n then let n := norm n in if n is (_ :: _) then i :: n else 1 Since in our representation the list begins with the digit of least weight, the zero is actually trailing the list. However, the term leading zero is so common that we stick to it. 2 The let n :=... in the following definition seems a little odd here, since n is used only once (the second occurrence could be replaced by an asbound patternvariable). This is a workaround for a peculiarity of Coq s interpretation of default branches in match / if: in certain cases the matched value is textually copied inside the branch, which would evaluate it twice when the term is normalized. 28
x if x 0, x if x < 0.
Chapter 3 Sequences In this chapter, we discuss sequences. We say what it means for a sequence to converge, and define the limit of a convergent sequence. We begin with some preliminary results about the
More informationCONTINUED FRACTIONS AND FACTORING. Niels Lauritzen
CONTINUED FRACTIONS AND FACTORING Niels Lauritzen ii NIELS LAURITZEN DEPARTMENT OF MATHEMATICAL SCIENCES UNIVERSITY OF AARHUS, DENMARK EMAIL: niels@imf.au.dk URL: http://home.imf.au.dk/niels/ Contents
More informationElementary Number Theory We begin with a bit of elementary number theory, which is concerned
CONSTRUCTION OF THE FINITE FIELDS Z p S. R. DOTY Elementary Number Theory We begin with a bit of elementary number theory, which is concerned solely with questions about the set of integers Z = {0, ±1,
More informationContinued Fractions and the Euclidean Algorithm
Continued Fractions and the Euclidean Algorithm Lecture notes prepared for MATH 326, Spring 997 Department of Mathematics and Statistics University at Albany William F Hammond Table of Contents Introduction
More informationINTRODUCTION TO PROOFS: HOMEWORK SOLUTIONS
INTRODUCTION TO PROOFS: HOMEWORK SOLUTIONS STEVEN HEILMAN Contents 1. Homework 1 1 2. Homework 2 6 3. Homework 3 10 4. Homework 4 16 5. Homework 5 19 6. Homework 6 21 7. Homework 7 25 8. Homework 8 28
More informationIt is time to prove some theorems. There are various strategies for doing
CHAPTER 4 Direct Proof It is time to prove some theorems. There are various strategies for doing this; we now examine the most straightforward approach, a technique called direct proof. As we begin, it
More informationPrime Numbers. Chapter Primes and Composites
Chapter 2 Prime Numbers The term factoring or factorization refers to the process of expressing an integer as the product of two or more integers in a nontrivial way, e.g., 42 = 6 7. Prime numbers are
More informationInformation Theory and Coding Prof. S. N. Merchant Department of Electrical Engineering Indian Institute of Technology, Bombay
Information Theory and Coding Prof. S. N. Merchant Department of Electrical Engineering Indian Institute of Technology, Bombay Lecture  17 ShannonFanoElias Coding and Introduction to Arithmetic Coding
More informationMath Review. for the Quantitative Reasoning Measure of the GRE revised General Test
Math Review for the Quantitative Reasoning Measure of the GRE revised General Test www.ets.org Overview This Math Review will familiarize you with the mathematical skills and concepts that are important
More informationElementary Number Theory and Methods of Proof. CSE 215, Foundations of Computer Science Stony Brook University http://www.cs.stonybrook.
Elementary Number Theory and Methods of Proof CSE 215, Foundations of Computer Science Stony Brook University http://www.cs.stonybrook.edu/~cse215 1 Number theory Properties: 2 Properties of integers (whole
More informationHomework 5 Solutions
Homework 5 Solutions 4.2: 2: a. 321 = 256 + 64 + 1 = (01000001) 2 b. 1023 = 512 + 256 + 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = (1111111111) 2. Note that this is 1 less than the next power of 2, 1024, which
More informationLecture 1: Elementary Number Theory
Lecture 1: Elementary Number Theory The integers are the simplest and most fundamental objects in discrete mathematics. All calculations by computers are based on the arithmetical operations with integers
More informationCHAPTER 3 Numbers and Numeral Systems
CHAPTER 3 Numbers and Numeral Systems Numbers play an important role in almost all areas of mathematics, not least in calculus. Virtually all calculus books contain a thorough description of the natural,
More informationWHAT ARE MATHEMATICAL PROOFS AND WHY THEY ARE IMPORTANT?
WHAT ARE MATHEMATICAL PROOFS AND WHY THEY ARE IMPORTANT? introduction Many students seem to have trouble with the notion of a mathematical proof. People that come to a course like Math 216, who certainly
More informationCHAPTER 3. Methods of Proofs. 1. Logical Arguments and Formal Proofs
CHAPTER 3 Methods of Proofs 1. Logical Arguments and Formal Proofs 1.1. Basic Terminology. An axiom is a statement that is given to be true. A rule of inference is a logical rule that is used to deduce
More informationFractions and Decimals
Fractions and Decimals Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles December 1, 2005 1 Introduction If you divide 1 by 81, you will find that 1/81 =.012345679012345679... The first
More information11 Ideals. 11.1 Revisiting Z
11 Ideals The presentation here is somewhat different than the text. In particular, the sections do not match up. We have seen issues with the failure of unique factorization already, e.g., Z[ 5] = O Q(
More informationDiscrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 2
CS 70 Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 2 Proofs Intuitively, the concept of proof should already be familiar We all like to assert things, and few of us
More informationContinued fractions and good approximations.
Continued fractions and good approximations We will study how to find good approximations for important real life constants A good approximation must be both accurate and easy to use For instance, our
More information(Refer Slide Time: 00:00:56 min)
Numerical Methods and Computation Prof. S.R.K. Iyengar Department of Mathematics Indian Institute of Technology, Delhi Lecture No # 3 Solution of Nonlinear Algebraic Equations (Continued) (Refer Slide
More informationMATH10040 Chapter 2: Prime and relatively prime numbers
MATH10040 Chapter 2: Prime and relatively prime numbers Recall the basic definition: 1. Prime numbers Definition 1.1. Recall that a positive integer is said to be prime if it has precisely two positive
More informationA Second Course in Mathematics Concepts for Elementary Teachers: Theory, Problems, and Solutions
A Second Course in Mathematics Concepts for Elementary Teachers: Theory, Problems, and Solutions Marcel B. Finan Arkansas Tech University c All Rights Reserved First Draft February 8, 2006 1 Contents 25
More information1. R In this and the next section we are going to study the properties of sequences of real numbers.
+a 1. R In this and the next section we are going to study the properties of sequences of real numbers. Definition 1.1. (Sequence) A sequence is a function with domain N. Example 1.2. A sequence of real
More informationSome Polynomial Theorems. John Kennedy Mathematics Department Santa Monica College 1900 Pico Blvd. Santa Monica, CA 90405 rkennedy@ix.netcom.
Some Polynomial Theorems by John Kennedy Mathematics Department Santa Monica College 1900 Pico Blvd. Santa Monica, CA 90405 rkennedy@ix.netcom.com This paper contains a collection of 31 theorems, lemmas,
More informationChapter 6. Number Theory. 6.1 The Division Algorithm
Chapter 6 Number Theory The material in this chapter offers a small glimpse of why a lot of facts that you ve probably nown and used for a long time are true. It also offers some exposure to generalization,
More informationMathematics of Cryptography
CHAPTER 2 Mathematics of Cryptography Part I: Modular Arithmetic, Congruence, and Matrices Objectives This chapter is intended to prepare the reader for the next few chapters in cryptography. The chapter
More informationDiscrete Mathematics Lecture 3 Elementary Number Theory and Methods of Proof. Harper Langston New York University
Discrete Mathematics Lecture 3 Elementary Number Theory and Methods of Proof Harper Langston New York University Proof and Counterexample Discovery and proof Even and odd numbers number n from Z is called
More informationCHAPTER II THE LIMIT OF A SEQUENCE OF NUMBERS DEFINITION OF THE NUMBER e.
CHAPTER II THE LIMIT OF A SEQUENCE OF NUMBERS DEFINITION OF THE NUMBER e. This chapter contains the beginnings of the most important, and probably the most subtle, notion in mathematical analysis, i.e.,
More informationLecture 3. Mathematical Induction
Lecture 3 Mathematical Induction Induction is a fundamental reasoning process in which general conclusion is based on particular cases It contrasts with deduction, the reasoning process in which conclusion
More informationLecture 13  Basic Number Theory.
Lecture 13  Basic Number Theory. Boaz Barak March 22, 2010 Divisibility and primes Unless mentioned otherwise throughout this lecture all numbers are nonnegative integers. We say that A divides B, denoted
More informationLies My Calculator and Computer Told Me
Lies My Calculator and Computer Told Me 2 LIES MY CALCULATOR AND COMPUTER TOLD ME Lies My Calculator and Computer Told Me See Section.4 for a discussion of graphing calculators and computers with graphing
More informationInteger Factorization using the Quadratic Sieve
Integer Factorization using the Quadratic Sieve Chad Seibert* Division of Science and Mathematics University of Minnesota, Morris Morris, MN 56567 seib0060@morris.umn.edu March 16, 2011 Abstract We give
More informationComputing Cubic Fields in QuasiLinear Time
Computing Cubic Fields in QuasiLinear Time K. Belabas Département de mathématiques (A2X) Université Bordeaux I 351, cours de la Libération, 33405 Talence (France) belabas@math.ubordeaux.fr Cubic fields
More informationChapter 4, Arithmetic in F [x] Polynomial arithmetic and the division algorithm.
Chapter 4, Arithmetic in F [x] Polynomial arithmetic and the division algorithm. We begin by defining the ring of polynomials with coefficients in a ring R. After some preliminary results, we specialize
More informationThe Dirichlet Unit Theorem
Chapter 6 The Dirichlet Unit Theorem As usual, we will be working in the ring B of algebraic integers of a number field L. Two factorizations of an element of B are regarded as essentially the same if
More informationDefinition: Group A group is a set G together with a binary operation on G, satisfying the following axioms: a (b c) = (a b) c.
Algebraic Structures Abstract algebra is the study of algebraic structures. Such a structure consists of a set together with one or more binary operations, which are required to satisfy certain axioms.
More informationMATH REVIEW KIT. Reproduced with permission of the Certified General Accountant Association of Canada.
MATH REVIEW KIT Reproduced with permission of the Certified General Accountant Association of Canada. Copyright 00 by the Certified General Accountant Association of Canada and the UBC Real Estate Division.
More informationSome Notes on Taylor Polynomials and Taylor Series
Some Notes on Taylor Polynomials and Taylor Series Mark MacLean October 3, 27 UBC s courses MATH /8 and MATH introduce students to the ideas of Taylor polynomials and Taylor series in a fairly limited
More informationCONTINUED FRACTIONS AND PELL S EQUATION. Contents 1. Continued Fractions 1 2. Solution to Pell s Equation 9 References 12
CONTINUED FRACTIONS AND PELL S EQUATION SEUNG HYUN YANG Abstract. In this REU paper, I will use some important characteristics of continued fractions to give the complete set of solutions to Pell s equation.
More informationFACTORING POLYNOMIALS IN THE RING OF FORMAL POWER SERIES OVER Z
FACTORING POLYNOMIALS IN THE RING OF FORMAL POWER SERIES OVER Z DANIEL BIRMAJER, JUAN B GIL, AND MICHAEL WEINER Abstract We consider polynomials with integer coefficients and discuss their factorization
More informationA Static Analyzer for Large SafetyCritical Software. Considered Programs and Semantics. Automatic Program Verification by Abstract Interpretation
PLDI 03 A Static Analyzer for Large SafetyCritical Software B. Blanchet, P. Cousot, R. Cousot, J. Feret L. Mauborgne, A. Miné, D. Monniaux,. Rival CNRS École normale supérieure École polytechnique Paris
More informationAn Innocent Investigation
An Innocent Investigation D. Joyce, Clark University January 2006 The beginning. Have you ever wondered why every number is either even or odd? I don t mean to ask if you ever wondered whether every number
More informationAPPLICATIONS OF THE ORDER FUNCTION
APPLICATIONS OF THE ORDER FUNCTION LECTURE NOTES: MATH 432, CSUSM, SPRING 2009. PROF. WAYNE AITKEN In this lecture we will explore several applications of order functions including formulas for GCDs and
More informationCHAPTER 5. Number Theory. 1. Integers and Division. Discussion
CHAPTER 5 Number Theory 1. Integers and Division 1.1. Divisibility. Definition 1.1.1. Given two integers a and b we say a divides b if there is an integer c such that b = ac. If a divides b, we write a
More informationORDERS OF ELEMENTS IN A GROUP
ORDERS OF ELEMENTS IN A GROUP KEITH CONRAD 1. Introduction Let G be a group and g G. We say g has finite order if g n = e for some positive integer n. For example, 1 and i have finite order in C, since
More informationIntroduction to Diophantine Equations
Introduction to Diophantine Equations Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles September, 2006 Abstract In this article we will only touch on a few tiny parts of the field
More informationU.C. Berkeley CS276: Cryptography Handout 0.1 Luca Trevisan January, 2009. Notes on Algebra
U.C. Berkeley CS276: Cryptography Handout 0.1 Luca Trevisan January, 2009 Notes on Algebra These notes contain as little theory as possible, and most results are stated without proof. Any introductory
More informationNotes on Factoring. MA 206 Kurt Bryan
The General Approach Notes on Factoring MA 26 Kurt Bryan Suppose I hand you n, a 2 digit integer and tell you that n is composite, with smallest prime factor around 5 digits. Finding a nontrivial factor
More informationEuclid s Algorithm for the Greatest Common Divisor Desh Ranjan Department of Computer Science New Mexico State University
Euclid s Algorithm for the Greatest Common Divisor Desh Ranjan Department of Computer Science New Mexico State University 1 Numbers, Division and Euclid People have been using numbers, and operations on
More information31 is a prime number is a mathematical statement (which happens to be true).
Chapter 1 Mathematical Logic In its most basic form, Mathematics is the practice of assigning truth to welldefined statements. In this course, we will develop the skills to use known true statements to
More informationCryptography and Network Security Department of Computer Science and Engineering Indian Institute of Technology Kharagpur
Cryptography and Network Security Department of Computer Science and Engineering Indian Institute of Technology Kharagpur Module No. # 01 Lecture No. # 05 Classic Cryptosystems (Refer Slide Time: 00:42)
More informationCS 103X: Discrete Structures Homework Assignment 3 Solutions
CS 103X: Discrete Structures Homework Assignment 3 s Exercise 1 (20 points). On wellordering and induction: (a) Prove the induction principle from the wellordering principle. (b) Prove the wellordering
More informationIt is not immediately obvious that this should even give an integer. Since 1 < 1 5
Math 163  Introductory Seminar Lehigh University Spring 8 Notes on Fibonacci numbers, binomial coefficients and mathematical induction These are mostly notes from a previous class and thus include some
More information8 Primes and Modular Arithmetic
8 Primes and Modular Arithmetic 8.1 Primes and Factors Over two millennia ago already, people all over the world were considering the properties of numbers. One of the simplest concepts is prime numbers.
More informationa = bq + r where 0 r < b.
Lecture 5: Euclid s algorithm Introduction The fundamental arithmetic operations are addition, subtraction, multiplication and division. But there is a fifth operation which I would argue is just as fundamental
More informationarxiv:1112.0829v1 [math.pr] 5 Dec 2011
How Not to Win a Million Dollars: A Counterexample to a Conjecture of L. Breiman Thomas P. Hayes arxiv:1112.0829v1 [math.pr] 5 Dec 2011 Abstract Consider a gambling game in which we are allowed to repeatedly
More informationAnswer Key for California State Standards: Algebra I
Algebra I: Symbolic reasoning and calculations with symbols are central in algebra. Through the study of algebra, a student develops an understanding of the symbolic language of mathematics and the sciences.
More informationComputer Organization and Architecture
Computer Organization and Architecture Chapter 9 Computer Arithmetic Arithmetic & Logic Unit Performs arithmetic and logic operations on data everything that we think of as computing. Everything else in
More informationMathematics Course 111: Algebra I Part IV: Vector Spaces
Mathematics Course 111: Algebra I Part IV: Vector Spaces D. R. Wilkins Academic Year 19967 9 Vector Spaces A vector space over some field K is an algebraic structure consisting of a set V on which are
More informationLimit processes are the basis of calculus. For example, the derivative. f f (x + h) f (x)
SEC. 4.1 TAYLOR SERIES AND CALCULATION OF FUNCTIONS 187 Taylor Series 4.1 Taylor Series and Calculation of Functions Limit processes are the basis of calculus. For example, the derivative f f (x + h) f
More informationChapter 1. Logic and Proof
Chapter 1. Logic and Proof 1.1 Remark: A little over 100 years ago, it was found that some mathematical proofs contained paradoxes, and these paradoxes could be used to prove statements that were known
More information2 The Euclidean algorithm
2 The Euclidean algorithm Do you understand the number 5? 6? 7? At some point our level of comfort with individual numbers goes down as the numbers get large For some it may be at 43, for others, 4 In
More informationSo let us begin our quest to find the holy grail of real analysis.
1 Section 5.2 The Complete Ordered Field: Purpose of Section We present an axiomatic description of the real numbers as a complete ordered field. The axioms which describe the arithmetic of the real numbers
More informationCHAPTER 2. Inequalities
CHAPTER 2 Inequalities In this section we add the axioms describe the behavior of inequalities (the order axioms) to the list of axioms begun in Chapter 1. A thorough mastery of this section is essential
More informationOn Generalized Fermat Numbers 3 2n +1
Applied Mathematics & Information Sciences 4(3) (010), 307 313 An International Journal c 010 Dixie W Publishing Corporation, U. S. A. On Generalized Fermat Numbers 3 n +1 Amin Witno Department of Basic
More informationMath Workshop October 2010 Fractions and Repeating Decimals
Math Workshop October 2010 Fractions and Repeating Decimals This evening we will investigate the patterns that arise when converting fractions to decimals. As an example of what we will be looking at,
More informationMATH10212 Linear Algebra. Systems of Linear Equations. Definition. An ndimensional vector is a row or a column of n numbers (or letters): a 1.
MATH10212 Linear Algebra Textbook: D. Poole, Linear Algebra: A Modern Introduction. Thompson, 2006. ISBN 0534405967. Systems of Linear Equations Definition. An ndimensional vector is a row or a column
More informationExample Degree Clip Impl. Int Sub. 1 3 2.5 1 10 15 2 3 1.8 1 5 6 3 5 1 1.7 3 5 4 10 1 na 2 4. Table 7.1: Relative computation times
Chapter 7 Curve Intersection Several algorithms address the problem of computing the points at which two curves intersect. Predominant approaches are the Bézier subdivision algorithm [LR80], the interval
More informationMathematical Procedures
CHAPTER 6 Mathematical Procedures 168 CHAPTER 6 Mathematical Procedures The multidisciplinary approach to medicine has incorporated a wide variety of mathematical procedures from the fields of physics,
More informationLinear Algebra I. Ronald van Luijk, 2012
Linear Algebra I Ronald van Luijk, 2012 With many parts from Linear Algebra I by Michael Stoll, 2007 Contents 1. Vector spaces 3 1.1. Examples 3 1.2. Fields 4 1.3. The field of complex numbers. 6 1.4.
More informationSUBGROUPS OF CYCLIC GROUPS. 1. Introduction In a group G, we denote the (cyclic) group of powers of some g G by
SUBGROUPS OF CYCLIC GROUPS KEITH CONRAD 1. Introduction In a group G, we denote the (cyclic) group of powers of some g G by g = {g k : k Z}. If G = g, then G itself is cyclic, with g as a generator. Examples
More informationAdaptive Online Gradient Descent
Adaptive Online Gradient Descent Peter L Bartlett Division of Computer Science Department of Statistics UC Berkeley Berkeley, CA 94709 bartlett@csberkeleyedu Elad Hazan IBM Almaden Research Center 650
More informationSchool of Informatics, University of Edinburgh
CS1Ah Lecture Note 5 Java Expressions Many Java statements can contain expressions, which are program phrases that tell how to compute a data value. Expressions can involve arithmetic calculation and method
More informationThis chapter is all about cardinality of sets. At first this looks like a
CHAPTER Cardinality of Sets This chapter is all about cardinality of sets At first this looks like a very simple concept To find the cardinality of a set, just count its elements If A = { a, b, c, d },
More informationRevised Version of Chapter 23. We learned long ago how to solve linear congruences. ax c (mod m)
Chapter 23 Squares Modulo p Revised Version of Chapter 23 We learned long ago how to solve linear congruences ax c (mod m) (see Chapter 8). It s now time to take the plunge and move on to quadratic equations.
More information[Refer Slide Time: 05:10]
Principles of Programming Languages Prof: S. Arun Kumar Department of Computer Science and Engineering Indian Institute of Technology Delhi Lecture no 7 Lecture Title: Syntactic Classes Welcome to lecture
More informationSECTION 102 Mathematical Induction
73 0 Sequences and Series 6. Approximate e 0. using the first five terms of the series. Compare this approximation with your calculator evaluation of e 0.. 6. Approximate e 0.5 using the first five terms
More informationThe Laws of Cryptography Cryptographers Favorite Algorithms
2 The Laws of Cryptography Cryptographers Favorite Algorithms 2.1 The Extended Euclidean Algorithm. The previous section introduced the field known as the integers mod p, denoted or. Most of the field
More informationLecture 3: Finding integer solutions to systems of linear equations
Lecture 3: Finding integer solutions to systems of linear equations Algorithmic Number Theory (Fall 2014) Rutgers University Swastik Kopparty Scribe: Abhishek Bhrushundi 1 Overview The goal of this lecture
More informationMathematics for Computer Science/Software Engineering. Notes for the course MSM1F3 Dr. R. A. Wilson
Mathematics for Computer Science/Software Engineering Notes for the course MSM1F3 Dr. R. A. Wilson October 1996 Chapter 1 Logic Lecture no. 1. We introduce the concept of a proposition, which is a statement
More informationInteger roots of quadratic and cubic polynomials with integer coefficients
Integer roots of quadratic and cubic polynomials with integer coefficients Konstantine Zelator Mathematics, Computer Science and Statistics 212 Ben Franklin Hall Bloomsburg University 400 East Second Street
More informationInduction. Margaret M. Fleck. 10 October These notes cover mathematical induction and recursive definition
Induction Margaret M. Fleck 10 October 011 These notes cover mathematical induction and recursive definition 1 Introduction to induction At the start of the term, we saw the following formula for computing
More informationit is easy to see that α = a
21. Polynomial rings Let us now turn out attention to determining the prime elements of a polynomial ring, where the coefficient ring is a field. We already know that such a polynomial ring is a UF. Therefore
More informationMODULAR ARITHMETIC KEITH CONRAD
MODULAR ARITHMETIC KEITH CONRAD. Introduction We will define the notion of congruent integers (with respect to a modulus) and develop some basic ideas of modular arithmetic. Applications of modular arithmetic
More informationPYTHAGOREAN TRIPLES KEITH CONRAD
PYTHAGOREAN TRIPLES KEITH CONRAD 1. Introduction A Pythagorean triple is a triple of positive integers (a, b, c) where a + b = c. Examples include (3, 4, 5), (5, 1, 13), and (8, 15, 17). Below is an ancient
More informationCHAPTER 2 Data Representation in Computer Systems
CHAPTER 2 Data Representation in Computer Systems 2.1 Introduction 47 2.2 Positional Numbering Systems 48 2.3 Converting Between Bases 48 2.3.1 Converting Unsigned Whole Numbers 49 2.3.2 Converting Fractions
More informationCHAPTER 5: MODULAR ARITHMETIC
CHAPTER 5: MODULAR ARITHMETIC LECTURE NOTES FOR MATH 378 (CSUSM, SPRING 2009). WAYNE AITKEN 1. Introduction In this chapter we will consider congruence modulo m, and explore the associated arithmetic called
More information(x + a) n = x n + a Z n [x]. Proof. If n is prime then the map
22. A quick primality test Prime numbers are one of the most basic objects in mathematics and one of the most basic questions is to decide which numbers are prime (a clearly related problem is to find
More informationFurther linear algebra. Chapter I. Integers.
Further linear algebra. Chapter I. Integers. Andrei Yafaev Number theory is the theory of Z = {0, ±1, ±2,...}. 1 Euclid s algorithm, Bézout s identity and the greatest common divisor. We say that a Z divides
More informationMath 016. Materials With Exercises
Math 06 Materials With Exercises June 00, nd version TABLE OF CONTENTS Lesson Natural numbers; Operations on natural numbers: Multiplication by powers of 0; Opposite operations; Commutative Property of
More informationAlgebraic Systems, Fall 2013, September 1, 2013 Edition. Todd Cochrane
Algebraic Systems, Fall 2013, September 1, 2013 Edition Todd Cochrane Contents Notation 5 Chapter 0. Axioms for the set of Integers Z. 7 Chapter 1. Algebraic Properties of the Integers 9 1.1. Background
More informationBasic building blocks for a tripledouble intermediate format
Basic building blocks for a tripledouble intermediate format corrected version) Christoph Quirin Lauter February 26, 2009 Abstract The implementation of correctly rounded elementary functions needs high
More informationAn Introduction to Galois Fields and ReedSolomon Coding
An Introduction to Galois Fields and ReedSolomon Coding James Westall James Martin School of Computing Clemson University Clemson, SC 296341906 October 4, 2010 1 Fields A field is a set of elements on
More informationHigher Education Math Placement
Higher Education Math Placement Placement Assessment Problem Types 1. Whole Numbers, Fractions, and Decimals 1.1 Operations with Whole Numbers Addition with carry Subtraction with borrowing Multiplication
More informationNumber Theory Hungarian Style. Cameron Byerley s interpretation of Csaba Szabó s lectures
Number Theory Hungarian Style Cameron Byerley s interpretation of Csaba Szabó s lectures August 20, 2005 2 0.1 introduction Number theory is a beautiful subject and even cooler when you learn about it
More informationIntroduction to Algebraic Geometry. Bézout s Theorem and Inflection Points
Introduction to Algebraic Geometry Bézout s Theorem and Inflection Points 1. The resultant. Let K be a field. Then the polynomial ring K[x] is a unique factorisation domain (UFD). Another example of a
More informationPROBLEM SET 7: PIGEON HOLE PRINCIPLE
PROBLEM SET 7: PIGEON HOLE PRINCIPLE The pigeonhole principle is the following observation: Theorem. Suppose that > kn marbles are distributed over n jars, then one jar will contain at least k + marbles.
More informationANALYTICAL MATHEMATICS FOR APPLICATIONS 2016 LECTURE NOTES Series
ANALYTICAL MATHEMATICS FOR APPLICATIONS 206 LECTURE NOTES 8 ISSUED 24 APRIL 206 A series is a formal sum. Series a + a 2 + a 3 + + + where { } is a sequence of real numbers. Here formal means that we don
More informationFactoring & Primality
Factoring & Primality Lecturer: Dimitris Papadopoulos In this lecture we will discuss the problem of integer factorization and primality testing, two problems that have been the focus of a great amount
More information