# Is Sometime Ever Better Than Alway?

Save this PDF as:

Size: px
Start display at page:

## Transcription

1 Is Sometime Ever Better Than Alway? DAVID GRIES Cornell University The "intermittent assertion" method for proving programs correct is explained and compared with the conventional method. Simple conventional proofs of iterative algorithms that compute recursively defined functions, including Ackermann's function, are given. Key Words and Phrases: correctness of programs, axiomatic method, intermittent assertion method, simulating recursion using iteration, Ackermann function CR Categories: INTRODUCTION The "intermittent assertion" method of proving programs correct has begun to attract a good deal of attention. The purpose of this paper is to compare the method, as it is explained in [6], with the now conventional method proposed by Hoare [4]. We shall have to give the latter method a name. "Axiomatic method" will not do because most methods can be axiomatized. "Invariant assertion method," proposed in [6], is unacceptable because it is too long and because the term "invariant" has already been connected with loops. My solution in this paper is to provide short names for both methods. The intermittent assertion method will be called the sometime method, for reasons that will become apparent later. By analogy, the conventional method of [4], along with the concept of total correctness (see, for example, [2]), will be called the alway method. (Alway is poetic for always.) It is assumed that the reader is familiar with the alway method. The sometime method has been used mainly to reason about iterative algorithms that compute recursiveiy defined functions, and in this setting it has been thought to be more "natural" than the alway method. In fact, [6] contains a challenge to use the alway method on an iterative algorithm that computes Ackermann's function. We meet this challenge in Section 2. Section 3 outlines the sometime method and presents for comparison a second proof of correctness of the iterative Ackermann algorithm. Section 4 shows how to transform a particular recursive definition scheme into an equivalent iterative algorithm using Permission to copy without fee all or part of this material is granted provided that the copies are not made or distributed for direct commercial advantage, the ACM copyright notice and the title of the publication and its date appear, and notice is given that copying is.by permission of the Association for Computing Machinery. To copy otherwise, or to republish, requires a fee and/or specific permission. This research was supported by the National Science Foundation under Grant MCS Author's address: Computer Science Department, Upson Hall, Cornell University, Ithaca, NY ACM /79/ \$00.75 ACM Transactions on Programming Languages and Systems, Vol. 1, No. 2, October 1979, Pages

2 Is Sometime Ever Better Than Alway? 259 the alway method. The scheme was taken from [6]. Finally, the discussion in Section 5 leads to the conclusion that the alway method is to be preferred. 2. THE ACKERMANN ALGORITHM AND THE ALWAY METHOD Ackermann's function A(m, n) is defined for m, n 0 by t m=0 --> n + 1 A(m,n)= m#o,n=o--)a(m-l, 1) m #O,n #O---) A(m- 1, A(m,n- 1)). The following algorithm to compute A(m, n) uses a "sequence" variable s. Each element si of sequence s = {sn... s2, sl) satisfies si >_ O, and n = size(s) >_ 0 is the length of the sequence. Using a sequence instead of a stack and numbering the elements in reverse order, as done here, simplifies later notation. Element si of s will be referenced within the 'algorithm by s(i), while s(.. i) refers to the possibly empty sequence (s(n), s(n - 1)... s(i)). Operation six denotes the concatenation of value x to sequence s. For example, if size(s) _> 2, then s --" s(.. 3) Is(2) I s(1). {m, n _> O) s := (m, n); do size(s) # 1 --) if s(2) = 0 ---) s := s(.. 3) Is(l) + 1 [3 s(2) # 0 and s(1) = 0 ~ s := s(.. 3) Is(2) - 1 ] 1 D s(2) # 0 and s(1) # 0 --) s := s(.. 3) Is(2) - 1 Is(2) Is(l) - 1 fi od {s = (A(m, n))} This algorithm repeatedly manipulates sequence s until its length is 1. Our problem is to prove that the loop halts and that, when it halts, s contains the desired result. In order to provide means for solving the problem, it seems reasonable to abstract from the algorithm the manner in which sequences are manipulated and to examine this manipulation in a purelymathematical setting. Thus we analyze how a single iteration of the loop can transform any sequence S' into a sequence s" and define a relation > between such s' and s". Definition 2.1. The relation > on sequences is defined by (a) s[ 0 [ b > s[ b + 1, for b _> O, any sequence s (b) s[ a [ 0 > s[ a - 1 ] 1, for a > O, any sequence s (c) s[ a[ b > s[a - l[a[ b - 1, for a, b > O, any sequence s. Note that for any sequence s' with size(s') > 1 there exists exactly one sequence s" such that s' > s". For s' with size(s') _< 1 there is no such s". Given an initial sequence s -- (m, n), a number of iterations of the loop is supposed to transform s into (A(m, n)). Since one iteration transforms s into s' such that s > s', we are led to consider relations >+, the transitive closure of >; >*, the reflexive transitive closure; and >t for fixed t _> O, which represents exactly t applications of >-. The necessary properties are proved in the following lemma. LEMMA 2.2. Given a, b >- O, for any sequence s there exists t > 0 such that slalb >t sia(a, b).

3 260 David Gries PROOF. The proof is by induction on the lexicographic ordering of pairs of nonnegative integers. We assume the lemma true for d, /~ satisfying (a, b) >2 (5, 5) and prove it true for a, b, where (a, b) >2 (5,/~) is defined by (a, b) >2 (d,/~) - a> 5or (a = dand b> b) There are three cases to consider, based on the definition of >. Case a = O. s I 0 ] b > s ] b + 1 = s ]A(O, b), and t = 1. (This is the basis step.) Case a ~ 0, b = 0. s ] a l0 > s] a - 1 ] 1. Since (a, 0) >2 (a - 1, 1), by induction there exists tl such that s ] a - 1 ] 1 >tl s ] A (a - 1, 1) = s ]A (a, 0). Thus s I a ] 0 ~t s]a(a, 0) with t-- tl + 1. Case a, b ~ O. s]alb > sla - 1]alb - 1. Since (a, b) >2 (a, b - 1), by induction there is a tl such that s ] a - 11 a I b - 1 >tl s ] a - 1 ]A (a, b - 1). Since (a, b) >2 (a - 1, A(a, b - 1)), by induction there is a t2 such that s]a - 1] A(a, b - 1) >t2 sla( a _ 1, A(a, b - 1)) = s]a(a, b). Hence s] a I b >t s]a(a, b) with t = 1 + tl + t2. This ends the proof. Now consider s = (m, n). By the lemma, there is a t > 0 such that s = (m, n) >t (A(m, n)). Furthermore, t is unique, since for any sequence s' there is at most one s" such that s' > s" and there is no s" such that (A(m, n)) > s". Hence for any sequence s satisfying (m, n) >* s there is a unique value r(s), v(s) 0, a function of s, such that s >,(8) (A(m, n)). We therefore take as the necessary loop invariant P: (m, n) >* s >~(~) (A(m, n)). P is initially true with s = (m, n) and r(s) = r((m, n)); upon termination (P and size(s) = 1) implies the desired result. That P remains true is almost trivial to show, since > was expressly defined so that execution of the loop body with variable s containing a value s' would change s to the unique value s" satisfying s' >- s". For a termination function we use r(s), which is decremented by 1 each time the loop body is executed. Remark 1. The invariant P was not as easy to derive as the above description indicates, although it should have been. [] Remark 2. Reference [6] says that the alway method requires two separate proofs to establish total correctness, one to show partial correctness and the other to show termination. While this is true, the example indicates that a proper choice of invariant can make the proof of termination almost trivial. [] Remark 3. The formalization of the method for proving termination has previously been done in two ways, which we summarize here. (1) Strong Termination. Derive an integer function t(~) of the program variables 2, show that t _> 0 whenever the loop is still executing, and show that each execution of the loop body decreases t by at least 1. For a loop do B ---) Sod with invariant P this means proving that (PandB)~t_>0 and {PandB} T:=t; S(t_T-1} where T is a new variable. (2) Weak Termination. Choose a "well-founded" set (W, >), i.e., > is a partial ordering with the property that for any w in W there is no infinite chain w > wl > w2 >... Then choose a function f(2) of the program variables ~ and prove ACM Transactions on Programming Languages and Systems, VoL 1, No. 2, October 1979.

4 Is Sometime Ever Better Than Alway? 261 that {P and B} u) := ~; S{f(u)) > f(2)} where & is a new set of variables. Under the reasonable assumption that nondeterminism is bounded [2], the two methods are equivalent. The first induces a function f(2) = t(2) and a wellfounded ordering defined by f(2) > f(:~) iff (P and B) implies t(x) > t(y) >_ O. Given bounded nondeterminism and a proof by the second method, one can show that the number of iterations of the loop for any initial state 2 is bounded, and we choose t(2) as that bound. In this situation, we prefer using strong termination. Having an explicit bound on the number of iterations of each loop is indeed useful if one wants to analyze the execution time of an algorithm. [] 3. THE SOMETIME METHOD The sometime method was invented as early as 1972 by R.M. Burstall and presented in a 19,74 IFIP Congress lecture [1]. Burstall felt that it would have intuitive appeal, since "it is very much like checking out a program by doing a step-by-step hand simulation" [1]. His student, R.W. Topor, noticed after the fact that D.E. Knuth actually used a similar style of argument on a few problems [5], but Knuth had not explained it as a general method for reasoning about programs. Manna and Waldinger bestowed the term "intermittent assertion" on the method in their 1978 paper [6], which is responsible for the current wave of interest in the method. Topor [7] also uses it to prove correct a version of the Schorr-Waite algorithm for marking nodes of a directed graph; a proof by the alway method appears in [3]. The method involves associating an assertion with a point in the algorithm with the intention that sometime during execution control will pass through that point with the assertion true, but that it need not be true every time control passes that point. Based on the fact that sometime control will be at that point with the assertion true, one then argues that control will later reach another point (e.g., the end of the algorithm) with another assertion true (e.g., the output assertion). To illustrate the method, let us first of all rewrite the iterative Ackermann algorithm to include labels, which are necessary in order to discuss it. This algorithm is actually a restatement of that given in [6], paraphased to make it and its proof as clear as we possibly could. start: s := ( m, n); do test: size(s) ~ 1 --~ if s(2) = 0 --) s :-- s(.. 3) [s(1) + 1 s(2) # 0 and s(1) = 0 -* s := s(.. 3) [s(2) - 1[ 1 0 s(2) # 0 and s(1) ~ 0 --) s := s(.. 3) [s(2) - 1 [ s(2) [s(1) - 1 fi od; finish: skip The sometime method allows one to use an assertion that is true at a point of

5 262 David Gries a program, but not necessarily always. A typical example is contained in the following lemma. LEMMA 3.1. If sometime size(s) >-- 2 and s = s l a I b, a, b 0, at test, then sometime s = d la (a, b) at test. PROOF. Suppose s = s l a I b at test. The lemma is proved by induction on the lexicographic ordering >2 on pairs of nonnegative integers. Thus we assume the lemma holds for any sequence ~ and pair (5, /~) satisfying (a, b) >2 (5, 6), and we show that it holds for any sequence g and (a, b). The reasoning is based on an informal understanding of how programs are executed. There are three cases to consider, corresponding to the three guarded commands of the alternative statement of the loop body. Case a = 0: s = s l 01 b at test. Since size(s) # 1 the loop body is execute d, the first guarded command is executed, s is changed to s = d lb +1, and control returns to test with s = sl b + 1 = ~IA(0, b). Case a # 0, b = 0: s = s lalo at test. Note that A(a, O) = A(a - 1, 1). Execution of the second guarded command changes s to s l a and control returns to test. Since (a, 0) >2 (a - 1, 1), by induction control will at some point reach test with s = d la (a - 1, 1) = ~la(a, 0). Thus the lemma is established in this case. Case a, b # 0: s = s l a I b at test. The third guarded command is executed, s becomes g!a - l lalb - 1, and control returns to test. Since (a, b! >2 (a, b - 1), by induction control will return to test at some point with s = sl a - 1 [A(a, b - 1). Since (a, b) >2 (a - 1, A(a, b -!)), by induction further execution is guaranteed to cause control to reach test again, with s = ~ I A (a - 1, A(a, b - 1)) = s l A (a, b). The lemma is established. This is typical of the reasoning used with the sometime method. Notice how one is relying on informal "hand 'simulation" of the algorithm, but with an assertion that represents a set of possible initial states (e.g., s = ~lal b and a, b _> 0), rather than one particular set of initial values. This is an informal way of performing what has been called "symbolic evaluation." Now suppose execution of the algorithm beginswith m, n _ 0. Control reaches test with s = (m, n). By the lemma, control will reach test again with s -- (A(m, n)), the loop will terminate because size(s) = 1, and control will reach finish with s(1) = A(m, n). Thus we have proved the following theorem. THEOREM 3.2. If sometime m, n >_ 0 at start, then sometime s(1) = A(m, n) at finish. 4. A TRANSFORMATION SCHEME In [6] it is proved using the sometime method that a recursive definition (or algorithm) of the form F(x) ~ p(x), --, f(x) [ notp(xj -* h(f(gl(x)), F(g2(x))) under the assumptions (1) p, f, gl, g2, and h are total functions (2) h is associative: h(u, h(v, w)) = h(h(u, v), w) for all u, v, w (3) e is the left identity of h: h(e, u) = u for all u

6 Is Sometime Ever Better Than Alway? 263 is equivalent to the following iterative algorithm. The algorithm uses a sequence variable s and a simple variable z: {F(x) well defined) s, z := (x), e; dose()--) if p(s(1)) ---) s, z := s(.. 2), h(z, f(s(1))) not p(s(1)) ---) s := s(.. 2)Ig2(s(1))[gl(s(1)) fi od {z = F(x)} We want to prove the same thing using the alway method. It is tempting to apply the technique used to prove the Ackermann algorithm correct, and indeed it works like a charm. We first note that there must be a well-founded ordering ~; defined by (F(x) well defined and not p (x)) implies (x ~; gl(x) and x ~ g2(x)). This means that there is no infinite chain x ~; xl \$... such that notp (xi) if F(x) is well defined, and that we can use the ordering \$ to prove something by induction, the way >2 was used in Section 2. In attempting to define an ordering on sequences as in Section 3, we find that we must also take into account the value of simple variable z. So we define instead a relation > on pairs (s; z), where s is a sequence and z a value. Definition 4.1. Relation > is defined for any sequence s and values x and z as follows: (a) ifp(x), then (six; z) > (s; h(z, f(x))) (b) if not p(x), then (six; z) > (slg2(x) lgl(x); z). LEMMA 4.2. Given x for which F(x) is well defined, for any sequence s and value z there exists a t >_ 0 such that (s] x; z) >t (s; h(z, F(x))). PRooF. The proof is by induction on the ordering ~; described above. There are two cases, corresponding to the cases in Definition 4.1. Case p(x): (six; z) > (s; h(z, f(x) ) ) = (s; h(z, F(x))), and t = 1. Case notp(x): We have (six; z) (slg2(x) Igl(x); z) >t~ (s Ig2(x); h(z, F(gl(x)))) ~t2 (s; h(h(z, F(gl(x))), F(g2(x)))) -- (s; h(z, h(f(gl(x)), F(g2(x))))) = (s; h(z, F(x))} by definition by induction, since x ~ gl (x) by induction, since x ~ g2(x) by associativity of h by definition of F. Thus (s I x; z) >t (s; h(z, F(x))) with t tl + t2. This completes the proof of Lemma 4.2. Now note that Lemma 4.2 implies the existence of a t _> 0 such that ((x); e) >t ((); h(e, F(x))) = ((); F(x)). We define a function T as in Section 3 and use the loop invariant P: ((x); e) >* (s; z) >~,s; z, ((); F(x)).

7 264 David Gries We leave the simple proof that P is indeed the desired invariant to the reader; the necessary termination function is of the invariant P. To the reader we also leave the proof that if F(x) is not well defined then the algorithm does not terminate. 5. DISCUSSION OF THE METHODS Reference [6, p. 163] has said that all known proofs of the Ackermann algorithm using conventional methods are extremely complicated. The proof in Section 2 is offered to support our conjecture that alway method proofs need be no more complicated than sometime method proofs. The material in Section 4 offers hope that iterative algorithms that compute recursively defined functions--a major stronghold of the sometime method--will quietly succumb to the alway method. It is simply a matter of learning the necessary techniques. (In this case the technique is, quite simply, to define a relation > such that s' ~ s" if one iteration of the loop transforms the loop variables s' into s", and then to investigate this relation.) The authors of [6] quite rightly imply that a proof method should be "natural," but "naturalness" in any field of endeavor must be learned. Let us compare the two methods, where our knowledge of the practical use of the sometime method is based solely on the examples given in [6]. We can begin by comparing the two proofs of the Ackermann algorithm. Here one notices a strong similarity. Lemmas 2.2 and 3.1 lie at the heart of the proofs, and both are proved by induction over the ordering >2. Each proof breaks down into three similar cases. The main difference is that one proof requires a detailed analysis of an algorithm, while the other requires an analysis only of a simple relation that took four lines to define. And herein lies what we would call a major drawback to the sometime method, which we now try to explain. Any algorithm is based on certain properties of the objects it manipulates and it seems desirable to keep a clear distinction between these properties and the algorithm that works on the objects. Thus in the alway method proof of Section 2, Definition 2.1 and Lemma 2.2 define, describe, and prove properties of sequences in a completely mathematical setting. Then the proof of the algorithm follows easily by considering the algorithm together with these properties. A change in the algorithm does not destroy the neat mathematical properties, but only perhaps their relevance. In addition, one can work with mathematical properties that have been proven by others, without having to understand their proof. The principle of separation of concerns is being adhered to clearly in the alway method. The sometime method, on the other hand, as explained in current proofs, seems to encourage confusion of properties of the objects and the algorithm itself. Thus, in Section 3, all parts of the complete proof, including the use of induction based on execution of a program, were packaged together. Through programming, we hope to learn to cope with complexity (and to teach others how to cope) using principles like abstraction and separation of concerns. The alway method encourages the use of and gives insight into these principles; the sometime method seems by its very nature to discourage their use, and thus seems to be a step backward. It is true that an alway method proof may have more parts to it. For example,

8 Is Sometime Ever Better Than Alway? 265 once the mathematical properties were stated and proved in Section 2, it was necessary to relate them to the algorithm itself, using a loop invariant and termination function. We gladly accept this "extra" work, for in return we gain a better understanding and have a proof that is clearly structured into its component parts. One referee offered the following way of looking at the two methods, which may help the reader. For the Ackermann algorithm, using the sometime method one (1) makes a hypothesis that the "snapshots" of the program variables at various points of execution form a finite sequence (2) proves the correctness of the hypothesis by induction on program execution. In the alway method, as used here, one (1) defines a sequence and proves that it exists and is of bounded length (2) shows that the sequence matches exactly the sequence of snapshots. ACKNOWLEDGMENTS I wish to thank R. Constable and G. Levin for discussions that led to the invariant used in the Ackermann algorithm. I am indebted to J. Donahue, G. Levin, and J. Williams for critically reading drafts of this paper. REFERENCES 1. BURSTALL, R.M. Program proving as hand simulation with a little induction. Proc. IFIP Congress 1974, Amsterdam, The Netherlands, pp DIJKSTRA, E.W. A Discipline of Programming. Prentice-Hall, Englewood Cliffs, N.J., GRIES, D. The Schorr-Waite graph marking algorithm. To appear in Acta Informatica. 4. HOARE, C.A.R. An axiomatic basis for computer programming. Comm. ACM 12, 10 (Oct. 1969), , KNUTH, D.E. The Art of Computer Programming, Vol. I. Addison-Wesley, Reading, Mass., MANNA, Z., AND WALDINGER, R. Is "sometime" sometimes better than "always"? Comm. ACM 21, 2 (Feb. 1978), ToPoR, R.W. A simple proof of the Schorr-Waite garbage collection algorithm. To appear in Acta Informatica. Received June 1978; revised January and May 1979 ACM Transactions on Programming Languages and Systems, Vol. i, No. 2, October 1979.

### PROPERTECHNIQUEOFSOFTWARE INSPECTIONUSING GUARDED COMMANDLANGUAGE

International Journal of Computer ScienceandCommunication Vol. 2, No. 1, January-June2011, pp. 153-157 PROPERTECHNIQUEOFSOFTWARE INSPECTIONUSING GUARDED COMMANDLANGUAGE Neeraj Kumar Singhania University,

### A simple algorithm with no simple verication

A simple algorithm with no simple verication Laszlo Csirmaz Central European University Abstract The correctness of a simple sorting algorithm is resented, which algorithm is \evidently wrong" at the rst

### Determination of the normalization level of database schemas through equivalence classes of attributes

Computer Science Journal of Moldova, vol.17, no.2(50), 2009 Determination of the normalization level of database schemas through equivalence classes of attributes Cotelea Vitalie Abstract In this paper,

### Chapter 6 Finite sets and infinite sets. Copyright 2013, 2005, 2001 Pearson Education, Inc. Section 3.1, Slide 1

Chapter 6 Finite sets and infinite sets Copyright 013, 005, 001 Pearson Education, Inc. Section 3.1, Slide 1 Section 6. PROPERTIES OF THE NATURE NUMBERS 013 Pearson Education, Inc.1 Slide Recall that denotes

### FACTORING 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

### Induction and Recursion

Induction and Recursion Winter 2010 Mathematical Induction Mathematical Induction Principle (of Mathematical Induction) Suppose you want to prove that a statement about an integer n is true for every positive

### Factoring & 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

### Reading 13 : Finite State Automata and Regular Expressions

CS/Math 24: Introduction to Discrete Mathematics Fall 25 Reading 3 : Finite State Automata and Regular Expressions Instructors: Beck Hasti, Gautam Prakriya In this reading we study a mathematical model

### There is no degree invariant half-jump

There is no degree invariant half-jump Rod Downey Mathematics Department Victoria University of Wellington P O Box 600 Wellington New Zealand Richard A. Shore Mathematics Department Cornell University

### Chapter 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

### On strong fairness in UNITY

On strong fairness in UNITY H.P.Gumm, D.Zhukov Fachbereich Mathematik und Informatik Philipps Universität Marburg {gumm,shukov}@mathematik.uni-marburg.de Abstract. In [6] Tsay and Bagrodia present a correct

### Mathematical Induction

Chapter 2 Mathematical Induction 2.1 First Examples Suppose we want to find a simple formula for the sum of the first n odd numbers: 1 + 3 + 5 +... + (2n 1) = n (2k 1). How might we proceed? The most natural

### Mathematical Induction

Mathematical Induction Victor Adamchik Fall of 2005 Lecture 1 (out of three) Plan 1. The Principle of Mathematical Induction 2. Induction Examples The Principle of Mathematical Induction Suppose we have

### A simple criterion on degree sequences of graphs

Discrete Applied Mathematics 156 (2008) 3513 3517 Contents lists available at ScienceDirect Discrete Applied Mathematics journal homepage: www.elsevier.com/locate/dam Note A simple criterion on degree

### Prime Numbers and Irreducible Polynomials

Prime Numbers and Irreducible Polynomials M. Ram Murty The similarity between prime numbers and irreducible polynomials has been a dominant theme in the development of number theory and algebraic geometry.

### COMP 250 Fall Mathematical induction Sept. 26, (n 1) + n = n + (n 1)

COMP 50 Fall 016 9 - Mathematical induction Sept 6, 016 You will see many examples in this course and upcoming courses of algorithms for solving various problems It many cases, it will be obvious that

### Fundamentals of Mathematics Lecture 5: Induction

Fundamentals of Mathematics Lecture 5: Induction Guan-Shieng Huang National Chi Nan University, Taiwan Spring, 2008 1 / 26 Mathematical Induction Mathematical Induction: Basic Form I or 1 F ; n [n F =

### Class notes Program Analysis course given by Prof. Mooly Sagiv Computer Science Department, Tel Aviv University second lecture 8/3/2007

Constant Propagation Class notes Program Analysis course given by Prof. Mooly Sagiv Computer Science Department, Tel Aviv University second lecture 8/3/2007 Osnat Minz and Mati Shomrat Introduction This

### Discrete 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

### CS 598CSC: Combinatorial Optimization Lecture date: 2/4/2010

CS 598CSC: Combinatorial Optimization Lecture date: /4/010 Instructor: Chandra Chekuri Scribe: David Morrison Gomory-Hu Trees (The work in this section closely follows [3]) Let G = (V, E) be an undirected

### Best Monotone Degree Bounds for Various Graph Parameters

Best Monotone Degree Bounds for Various Graph Parameters D. Bauer Department of Mathematical Sciences Stevens Institute of Technology Hoboken, NJ 07030 S. L. Hakimi Department of Electrical and Computer

### Automata and Formal Languages

Automata and Formal Languages Winter 2009-2010 Yacov Hel-Or 1 What this course is all about This course is about mathematical models of computation We ll study different machine models (finite automata,

### 4.6 The Primitive Recursive Functions

4.6. THE PRIMITIVE RECURSIVE FUNCTIONS 309 4.6 The Primitive Recursive Functions The class of primitive recursive functions is defined in terms of base functions and closure operations. Definition 4.6.1

### Discrete Mathematics, Chapter 5: Induction and Recursion

Discrete Mathematics, Chapter 5: Induction and Recursion Richard Mayr University of Edinburgh, UK Richard Mayr (University of Edinburgh, UK) Discrete Mathematics. Chapter 5 1 / 20 Outline 1 Well-founded

### MA651 Topology. Lecture 6. Separation Axioms.

MA651 Topology. Lecture 6. Separation Axioms. This text is based on the following books: Fundamental concepts of topology by Peter O Neil Elements of Mathematics: General Topology by Nicolas Bourbaki Counterexamples

### EMBEDDING COUNTABLE PARTIAL ORDERINGS IN THE DEGREES

EMBEDDING COUNTABLE PARTIAL ORDERINGS IN THE ENUMERATION DEGREES AND THE ω-enumeration DEGREES MARIYA I. SOSKOVA AND IVAN N. SOSKOV 1. Introduction One of the most basic measures of the complexity of a

### Mathematical Induction

Mathematical Induction (Handout March 8, 01) The Principle of Mathematical Induction provides a means to prove infinitely many statements all at once The principle is logical rather than strictly mathematical,

### Announcements. CS243: Discrete Structures. More on Cryptography and Mathematical Induction. Agenda for Today. Cryptography

Announcements CS43: Discrete Structures More on Cryptography and Mathematical Induction Işıl Dillig Class canceled next Thursday I am out of town Homework 4 due Oct instead of next Thursday (Oct 18) Işıl

### CHAPTER 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

### MAT2400 Analysis I. A brief introduction to proofs, sets, and functions

MAT2400 Analysis I A brief introduction to proofs, sets, and functions In Analysis I there is a lot of manipulations with sets and functions. It is probably also the first course where you have to take

### diffy boxes (iterations of the ducci four number game) 1

diffy boxes (iterations of the ducci four number game) 1 Peter Trapa September 27, 2006 Begin at the beginning and go on till you come to the end: then stop. Lewis Carroll Consider the following game.

### Mathematics 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

### Integer 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

### Notes from Week 1: Algorithms for sequential prediction

CS 683 Learning, Games, and Electronic Markets Spring 2007 Notes from Week 1: Algorithms for sequential prediction Instructor: Robert Kleinberg 22-26 Jan 2007 1 Introduction In this course we will be looking

### Subsets of Euclidean domains possessing a unique division algorithm

Subsets of Euclidean domains possessing a unique division algorithm Andrew D. Lewis 2009/03/16 Abstract Subsets of a Euclidean domain are characterised with the following objectives: (1) ensuring uniqueness

### Induction. Mathematical Induction. Induction. Induction. Induction. Induction. 29 Sept 2015

Mathematical If we have a propositional function P(n), and we want to prove that P(n) is true for any natural number n, we do the following: Show that P(0) is true. (basis step) We could also start at

### Formal Languages and Automata Theory - Regular Expressions and Finite Automata -

Formal Languages and Automata Theory - Regular Expressions and Finite Automata - Samarjit Chakraborty Computer Engineering and Networks Laboratory Swiss Federal Institute of Technology (ETH) Zürich March

### ON INDUCED SUBGRAPHS WITH ALL DEGREES ODD. 1. Introduction

ON INDUCED SUBGRAPHS WITH ALL DEGREES ODD A.D. SCOTT Abstract. Gallai proved that the vertex set of any graph can be partitioned into two sets, each inducing a subgraph with all degrees even. We prove

### 2. Methods of Proof Types of Proofs. Suppose we wish to prove an implication p q. Here are some strategies we have available to try.

2. METHODS OF PROOF 69 2. Methods of Proof 2.1. Types of Proofs. Suppose we wish to prove an implication p q. Here are some strategies we have available to try. Trivial Proof: If we know q is true then

### Cycles in a Graph Whose Lengths Differ by One or Two

Cycles in a Graph Whose Lengths Differ by One or Two J. A. Bondy 1 and A. Vince 2 1 LABORATOIRE DE MATHÉMATIQUES DISCRÉTES UNIVERSITÉ CLAUDE-BERNARD LYON 1 69622 VILLEURBANNE, FRANCE 2 DEPARTMENT OF MATHEMATICS

### Theorem (The division theorem) Suppose that a and b are integers with b > 0. There exist unique integers q and r so that. a = bq + r and 0 r < b.

Theorem (The division theorem) Suppose that a and b are integers with b > 0. There exist unique integers q and r so that a = bq + r and 0 r < b. We re dividing a by b: q is the quotient and r is the remainder,

### arxiv: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

### WHAT 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

### Verification of Imperative Programs in Theorema

Verification of Imperative Programs in Theorema Laura Ildikó Kovács, Nikolaj Popov, Tudor Jebelean 1 Research Institute for Symbolic Computation, Johannes Kepler University, A-4040 Linz, Austria Institute

### 9.2 Summation Notation

9. Summation Notation 66 9. Summation Notation In the previous section, we introduced sequences and now we shall present notation and theorems concerning the sum of terms of a sequence. We begin with a

### This asserts two sets are equal iff they have the same elements, that is, a set is determined by its elements.

3. Axioms of Set theory Before presenting the axioms of set theory, we first make a few basic comments about the relevant first order logic. We will give a somewhat more detailed discussion later, but

### Domain Theory: An Introduction

Domain Theory: An Introduction Robert Cartwright Rebecca Parsons Rice University This monograph is an unauthorized revision of Lectures On A Mathematical Theory of Computation by Dana Scott [3]. Scott

### Sets and functions. {x R : x > 0}.

Sets and functions 1 Sets The language of sets and functions pervades mathematics, and most of the important operations in mathematics turn out to be functions or to be expressible in terms of functions.

### Prime 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

### A single minimal complement for the c.e. degrees

A single minimal complement for the c.e. degrees Andrew Lewis Leeds University, April 2002 Abstract We show that there exists a single minimal (Turing) degree b < 0 s.t. for all c.e. degrees 0 < a < 0,

### CS 341 Homework 9 Languages That Are and Are Not Regular

CS 341 Homework 9 Languages That Are and Are Not Regular 1. Show that the following are not regular. (a) L = {ww R : w {a, b}*} (b) L = {ww : w {a, b}*} (c) L = {ww' : w {a, b}*}, where w' stands for w

### Mathematical Induction

Mathematical Induction William Cherry February 2011 These notes provide some additional examples to supplement the section of the text on mathematical induction. Inequalities. It happens that often in

### Regular Languages and Finite Automata

Regular Languages and Finite Automata 1 Introduction Hing Leung Department of Computer Science New Mexico State University Sep 16, 2010 In 1943, McCulloch and Pitts [4] published a pioneering work on a

### Sets and Cardinality Notes for C. F. Miller

Sets and Cardinality Notes for 620-111 C. F. Miller Semester 1, 2000 Abstract These lecture notes were compiled in the Department of Mathematics and Statistics in the University of Melbourne for the use

### MATH 289 PROBLEM SET 1: INDUCTION. 1. The induction Principle The following property of the natural numbers is intuitively clear:

MATH 89 PROBLEM SET : INDUCTION The induction Principle The following property of the natural numbers is intuitively clear: Axiom Every nonempty subset of the set of nonnegative integers Z 0 = {0,,, 3,

### Biinterpretability up to double jump in the degrees

Biinterpretability up to double jump in the degrees below 0 0 Richard A. Shore Department of Mathematics Cornell University Ithaca NY 14853 July 29, 2013 Abstract We prove that, for every z 0 0 with z

### Fundamentals of Mathematics Lecture 6: Propositional Logic

Fundamentals of Mathematics Lecture 6: Propositional Logic Guan-Shieng Huang National Chi Nan University, Taiwan Spring, 2008 1 / 39 Connectives Propositional Connectives I 1 Negation: (not A) A A T F

### ON FUNCTIONAL SYMBOL-FREE LOGIC PROGRAMS

PROCEEDINGS OF THE YEREVAN STATE UNIVERSITY Physical and Mathematical Sciences 2012 1 p. 43 48 ON FUNCTIONAL SYMBOL-FREE LOGIC PROGRAMS I nf or m at i cs L. A. HAYKAZYAN * Chair of Programming and Information

### CHAPTER 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.,

### each college c i C has a capacity q i - the maximum number of students it will admit

n colleges in a set C, m applicants in a set A, where m is much larger than n. each college c i C has a capacity q i - the maximum number of students it will admit each college c i has a strict order i

### 1 Limiting distribution for a Markov chain

Copyright c 2009 by Karl Sigman Limiting distribution for a Markov chain In these Lecture Notes, we shall study the limiting behavior of Markov chains as time n In particular, under suitable easy-to-check

### Stochastic Inventory Control

Chapter 3 Stochastic Inventory Control 1 In this chapter, we consider in much greater details certain dynamic inventory control problems of the type already encountered in section 1.3. In addition to the

### Odd induced subgraphs in graphs of maximum degree three

Odd induced subgraphs in graphs of maximum degree three David M. Berman, Hong Wang, and Larry Wargo Department of Mathematics University of New Orleans New Orleans, Louisiana, USA 70148 Abstract A long-standing

### 1 Die hard, once and for all

ENGG 2440A: Discrete Mathematics for Engineers Lecture 4 The Chinese University of Hong Kong, Fall 2014 6 and 7 October 2014 Number theory is the branch of mathematics that studies properties of the integers.

### Virtual Time and Timeout in Client-Server Networks

Virtual Time and Timeout in Client-Server Networks Jayadev Misra July 13, 2011 Contents 1 Introduction 2 1.1 Background.............................. 2 1.1.1 Causal Model of Virtual Time...............

### Discrete Mathematics

Slides for Part IA CST 2014/15 Discrete Mathematics Prof Marcelo Fiore Marcelo.Fiore@cl.cam.ac.uk What are we up to? Learn to read and write, and also work with, mathematical

### 1.3 Induction and Other Proof Techniques

4CHAPTER 1. INTRODUCTORY MATERIAL: SETS, FUNCTIONS AND MATHEMATICAL INDU 1.3 Induction and Other Proof Techniques The purpose of this section is to study the proof technique known as mathematical induction.

### CHAPTER 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

### Partitioning edge-coloured complete graphs into monochromatic cycles and paths

arxiv:1205.5492v1 [math.co] 24 May 2012 Partitioning edge-coloured complete graphs into monochromatic cycles and paths Alexey Pokrovskiy Departement of Mathematics, London School of Economics and Political

### About the inverse football pool problem for 9 games 1

Seventh International Workshop on Optimal Codes and Related Topics September 6-1, 013, Albena, Bulgaria pp. 15-133 About the inverse football pool problem for 9 games 1 Emil Kolev Tsonka Baicheva Institute

### 11 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(

### Graphs without proper subgraphs of minimum degree 3 and short cycles

Graphs without proper subgraphs of minimum degree 3 and short cycles Lothar Narins, Alexey Pokrovskiy, Tibor Szabó Department of Mathematics, Freie Universität, Berlin, Germany. August 22, 2014 Abstract

### Students in their first advanced mathematics classes are often surprised

CHAPTER 8 Proofs Involving Sets Students in their first advanced mathematics classes are often surprised by the extensive role that sets play and by the fact that most of the proofs they encounter are

University of Oslo MAT2 Project The Banach-Tarski Paradox Author: Fredrik Meyer Supervisor: Nadia S. Larsen Abstract In its weak form, the Banach-Tarski paradox states that for any ball in R, it is possible

### RINGS WITH A POLYNOMIAL IDENTITY

RINGS WITH A POLYNOMIAL IDENTITY IRVING KAPLANSKY 1. Introduction. In connection with his investigation of projective planes, M. Hall [2, Theorem 6.2]* proved the following theorem: a division ring D in

### FIRST YEAR CALCULUS. Chapter 7 CONTINUITY. It is a parabola, and we can draw this parabola without lifting our pencil from the paper.

FIRST YEAR CALCULUS WWLCHENW L c WWWL W L Chen, 1982, 2008. 2006. This chapter originates from material used by the author at Imperial College, University of London, between 1981 and 1990. It It is is

### Continued 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

### Double Sequences and Double Series

Double Sequences and Double Series Eissa D. Habil Islamic University of Gaza P.O. Box 108, Gaza, Palestine E-mail: habil@iugaza.edu Abstract This research considers two traditional important questions,

### Induction. 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

### Policy Analysis for Administrative Role Based Access Control without Separate Administration

Policy nalysis for dministrative Role Based ccess Control without Separate dministration Ping Yang Department of Computer Science, State University of New York at Binghamton, US Mikhail I. Gofman Department

### CMSC 858T: Randomized Algorithms Spring 2003 Handout 8: The Local Lemma

CMSC 858T: Randomized Algorithms Spring 2003 Handout 8: The Local Lemma Please Note: The references at the end are given for extra reading if you are interested in exploring these ideas further. You are

### Math 55: Discrete Mathematics

Math 55: Discrete Mathematics UC Berkeley, Fall 2011 Homework # 5, due Wednesday, February 22 5.1.4 Let P (n) be the statement that 1 3 + 2 3 + + n 3 = (n(n + 1)/2) 2 for the positive integer n. a) What

### OPERATIONAL TYPE THEORY by Adam Petcher Prepared under the direction of Professor Aaron Stump A thesis presented to the School of Engineering of

WASHINGTON NIVERSITY SCHOOL OF ENGINEERING AND APPLIED SCIENCE DEPARTMENT OF COMPTER SCIENCE AND ENGINEERING DECIDING JOINABILITY MODLO GROND EQATIONS IN OPERATIONAL TYPE THEORY by Adam Petcher Prepared

### [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

### THE SETTLING TIME REDUCIBILITY ORDERING AND 0 2 SETS

THE SETTLING TIME REDUCIBILITY ORDERING AND 0 2 SETS BARBARA F. CSIMA Abstract. The Settling Time reducibility ordering gives an ordering on computably enumerable sets based on their enumerations. The

### Lecture 1: Course overview, circuits, and formulas

Lecture 1: Course overview, circuits, and formulas Topics in Complexity Theory and Pseudorandomness (Spring 2013) Rutgers University Swastik Kopparty Scribes: John Kim, Ben Lund 1 Course Information Swastik

### Mathematical Induction

Mathematical Induction MAT30 Discrete Mathematics Fall 016 MAT30 (Discrete Math) Mathematical Induction Fall 016 1 / 19 Outline 1 Mathematical Induction Strong Mathematical Induction MAT30 (Discrete Math)

### Basic Concepts of Point Set Topology Notes for OU course Math 4853 Spring 2011

Basic Concepts of Point Set Topology Notes for OU course Math 4853 Spring 2011 A. Miller 1. Introduction. The definitions of metric space and topological space were developed in the early 1900 s, largely

### This 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 },

### Mathematical Induction. Lecture 10-11

Mathematical Induction Lecture 10-11 Menu Mathematical Induction Strong Induction Recursive Definitions Structural Induction Climbing an Infinite Ladder Suppose we have an infinite ladder: 1. We can reach

### Chapter 1 LOGIC AND PROOF

Chapter 1 LOGIC AND PROOF To be able to understand mathematics and mathematical arguments, it is necessary to have a solid understanding of logic and the way in which known facts can be combined to prove

### Information 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 Shannon-Fano-Elias Coding and Introduction to Arithmetic Coding

### 1. 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

### Markov random fields and Gibbs measures

Chapter Markov random fields and Gibbs measures 1. Conditional independence Suppose X i is a random element of (X i, B i ), for i = 1, 2, 3, with all X i defined on the same probability space (.F, P).

### INTRODUCTORY SET THEORY

M.Sc. program in mathematics INTRODUCTORY SET THEORY Katalin Károlyi Department of Applied Analysis, Eötvös Loránd University H-1088 Budapest, Múzeum krt. 6-8. CONTENTS 1. SETS Set, equal sets, subset,

### 3. Mathematical Induction

3. MATHEMATICAL INDUCTION 83 3. Mathematical Induction 3.1. First Principle of Mathematical Induction. Let P (n) be a predicate with domain of discourse (over) the natural numbers N = {0, 1,,...}. If (1)

### Diagonalization. Ahto Buldas. Lecture 3 of Complexity Theory October 8, 2009. Slides based on S.Aurora, B.Barak. Complexity Theory: A Modern Approach.

Diagonalization Slides based on S.Aurora, B.Barak. Complexity Theory: A Modern Approach. Ahto Buldas Ahto.Buldas@ut.ee Background One basic goal in complexity theory is to separate interesting complexity

### Cartesian Products and Relations

Cartesian Products and Relations Definition (Cartesian product) If A and B are sets, the Cartesian product of A and B is the set A B = {(a, b) :(a A) and (b B)}. The following points are worth special