Types and Programming Languages


 Mitchell Spencer
 3 years ago
 Views:
Transcription
1 Types and Programming Languages 1 / 49
2 Outline Types Evaluation Rules Typing Rules Properties of the Typing Relation The Inversion Lemma Prolog Implementation Reasoning Involving Types Progress Preservation 2 / 49
3 Outline Types Evaluation Rules Typing Rules Properties of the Typing Relation The Inversion Lemma Prolog Implementation Reasoning Involving Types Progress Preservation 3 / 49
4 Plan We will now revisit the simple language of arithmetic and boolean expressions NB and show how to equip it with a (very simple) type system The key property of this type system will be soundness: Welltyped programs do not get stuck After that we will develop a simple type system for the λcalculus We will spend a good part of the rest of the semester adding features to this type system 4 / 49
5 Outline 1. begin with a set of terms, a set of values, and an evaluation relation 2. define a set of types classifying values according to their shapes 3. define a typing relation t : T that classifies terms according to the shape of the values that result from evaluating them 4. check that the typing relation is sound in the sense that, 4.1 if t : T and t v, then v : T 4.2 if t : T then the evaluation of t will not get stuck 5 / 49
6 The Language NB t ::= terms true constant true false constant false if t then t else t conditional 0 constant zero succ t successor prec t predecessor iszero t zero test v ::= values true true value false false value nv numeric value nv ::= numeric values 0 zero value succ nv successor value 6 / 49
7 Evaluation Rules if true then t 2 else t 3 t 2 if false then t 2 else t 3 t 3 (EIfTrue) (EIfFalse) t 1 t 1 if t 1 then t 2 else t3 if t 1 then t 2 else t 3 (EIf) 7 / 49
8 t 1 t 1 succ t 1 succ t 1 pred 0 0 pred (succ nv 1 ) nv 1 (ESucc) (EPredZero) (EPredSucc) t 1 t 1 pred t 1 pred t 1 iszero 0 true iszero (succ nv 1 ) false (EPred) (EIsZeroZero) (EIsZeroSucc) t 1 t 1 iszero t 1 iszero t 1 (EIsZero) 8 / 49
9 Types In this language, values have two possible shapes : they are either booleans or numbers. T ::= types Bool type of booleans Nat type of numbers 9 / 49
10 Typing Rules true : Bool false : Bool t 1 : Bool t 2 : T t 3 : T if t 1 then t 2 else t 3 : T (TTrue) (TFalse) (TIf) 0 : Nat (TZero) t 1 : Nat succ t 1 : Nat t 1 : Nat pred t 1 : Nat t 1 : Nat iszero t 1 : Bool (TSucc) (TPred) (TIsZero) 10 / 49
11 Typing Derivations Every pair (t, T ) in the typing relation can be justified by a derivation tree built from instances of the inference rules. TZero 0 : Nat TIsZero iszero 0 : Bool TZero 0 : Nat if iszero 0 then 0 else pred 0 : Nat TZero 0 : Nat TPred pred 0 : Nat TIf Proofs of properties about the typing relation often proceed by induction on typing derivations. 11 / 49
12 Imprecision of Typing Like other static program analyses, type systems are generally imprecise: they do not predict exactly what kind of value will be returned by every program, but just a conservative (safe) approximation. t 1 : Bool t 2 : T t 3 : T if t 1 then t 2 else t 3 : T (TIf) Using this rule, we cannot assign a type to if true then 0 else false even though this term will certainly evaluate to a number. 12 / 49
13 Outline Types Evaluation Rules Typing Rules Properties of the Typing Relation The Inversion Lemma Prolog Implementation Reasoning Involving Types Progress Preservation 13 / 49
14 Type Safety The safety (or soundness) of this type system can be expressed by two properties: 1. Progress: A welltyped term is not stuck If t : T, then either t is a value or else t t for some t. 2. Preservation: Types are preserved by onestep evaluation If t : T and t t, then t : T. 14 / 49
15 Inversion Lemma: 1. If true : R, then R = Bool. 2. If false : R, then R = Bool. 3. If if t 1 then t 2 else t 3 : R, then t 1 : Bool, t 2 : R, and t 3 : R. 4. If 0 : R, then R = Nat 5. if succ t 1 : R, then R = Nat and t 1 : Nat. 6. if pred t 1 : R, then R = Nat and t 1 : Nat. 7. if iszero t 1 : R, then R = Bool and t 1 : Nat. 15 / 49
16 Inversion Lemma: 1. If true : R, then R = Bool. 2. If false : R, then R = Bool. 3. If if t 1 then t 2 else t 3 : R, then t 1 : Bool, t 2 : R, and t 3 : R. 4. If 0 : R, then R = Nat 5. if succ t 1 : R, then R = Nat and t 1 : Nat. 6. if pred t 1 : R, then R = Nat and t 1 : Nat. 7. if iszero t 1 : R, then R = Bool and t 1 : Nat. Proof: / 49
17 Inversion Lemma: 1. If true : R, then R = Bool. 2. If false : R, then R = Bool. 3. If if t 1 then t 2 else t 3 : R, then t 1 : Bool, t 2 : R, and t 3 : R. 4. If 0 : R, then R = Nat 5. if succ t 1 : R, then R = Nat and t 1 : Nat. 6. if pred t 1 : R, then R = Nat and t 1 : Nat. 7. if iszero t 1 : R, then R = Bool and t 1 : Nat. Proof:... This leads directly to a recursive algorithm for calculating the type of a term / 49
18 Step 1: Design a Mapping to a Term Algebra Abstract Syntax true false if t 1 then t 2 else t 3 0 succ t pred t iszero t map Term true map false map cond(t 1, t 2, t 3 ) map 0 map succ(t) map pred(t) iszero(t) map Bool Nat map map bool nat 18 / 49
19 Step 2: Implement the Typing Relation typeof(true, bool). typeof(false, bool). typeof(0,nat). typeof(succ(t1), nat) : typeof(t1, nat). typeof(cond(t1,t2,t3), T) : typeof(t1,bool), typeof(t2,t), typeof(t3,t). typeof(pred(t1), nat) : typeof(t1,nat). typeof(iszero(t1), bool) : typeof(t1,nat). 19 / 49
20 Step 3: Develop Testing Framework generictest(t) : typeof( T, Type ), write( Result = ), write(t), write( : ), write(type), fail. test 01 : generictest( succ(succ(0)) ). test 02 : generictest( succ(pred(succ(pred(0)))) ). batchtest : write( test 01:\n ), not(test 01), nl, nl, write( test 02:\n ), not(test 02), nl, nl. 20 / 49
21 Outline Types Evaluation Rules Typing Rules Properties of the Typing Relation The Inversion Lemma Prolog Implementation Reasoning Involving Types Progress Preservation 21 / 49
22 Canonical Forms Lemma: 1. If v is a value of type Bool, then v is either true or false. 2. If v is a value of type Nat, then v is a numeric value. Proof: 22 / 49
23 Part 1 Recall the syntax of values: v ::= values true true value false false value nv numeric value nv ::= numeric values 0 zero value succ nv successor value For part 1, 23 / 49
24 Part 1 Recall the syntax of values: v ::= values true true value false false value nv numeric value nv ::= numeric values 0 zero value succ nv successor value For part 1, if v is true or false, the result is immediate. 24 / 49
25 Part 1 Recall the syntax of values: v ::= values true true value false false value nv numeric value nv ::= numeric values 0 zero value succ nv successor value For part 1, if v is true or false, the result is immediate. Also note that in this case v cannot be 0 or succ nv, since the inversion lemma tells us that v would then have type Nat, not Bool. 25 / 49
26 Part 1 Recall the syntax of values: v ::= values true true value false false value nv numeric value nv ::= numeric values 0 zero value succ nv successor value For part 1, if v is true or false, the result is immediate. Also note that in this case v cannot be 0 or succ nv, since the inversion lemma tells us that v would then have type Nat, not Bool. Part 2 is similar. 26 / 49
27 Progress Theorem: Suppose t is a welltyped term (that is, t : T for some type T ). Then either t is a value or else there is some t with t t. 27 / 49
28 Progress Theorem: Suppose t is a welltyped term (that is, t : T for some type T ). Then either t is a value or else there is some t with t t. Proof: 28 / 49
29 Progress Theorem: Suppose t is a welltyped term (that is, t : T for some type T ). Then either t is a value or else there is some t with t t. Proof: By induction on a derivation of t : T. 29 / 49
30 Aside Recall that our typing relation consists of the following typing rules: T rule = { } TTrue, TFalse, TIf, TZero, TSucc, TPred, TIsZero Also recall that we have the following evaluation rules: E rule = E bool E nat E bool = { EIfTrue, EIfFalse, EIf } E nat = { ESucc, EPredZero, EPredSucc, EPred, EIsZeroZero, EIsZeroSucc, EIsZero } 30 / 49
31 Aside For each typing rule r T rule, we will consider the implications of a typing derivation ending with r. (r i T rule ) t : T (r j T rule ) (r) In particular, we will need to consider which evaluation rules (if any) can be applied to t. Essentially, our analysis covers: T rule E rule 31 / 49
32 Progress Proof Theorem: Suppose t is a welltyped term (that is, t : T for some type T ). Then either t is a value or else there is some t with t t. Case r = TTrue. This implies that t = true (and no evaluation rules apply). Since t is value, the theorem holds in this case. 32 / 49
33 Progress Proof Theorem: Suppose t is a welltyped term (that is, t : T for some type T ). Then either t is a value or else there is some t with t t. Case r = TFalse. This implies that t = false (and no evaluation rules apply). Since t is value, the theorem holds in this case. 33 / 49
34 Progress Proof Theorem: Suppose t is a welltyped term (that is, t : T for some type T ). Then either t is a value or else there is some t with t t. Case r = TZero. This implies that t = 0 (and no evaluation rules apply). Since t is value, the theorem holds in this case. 34 / 49
35 Progress Proof Theorem: Suppose t is a welltyped term (that is, t : T for some type T ). Then either t is a value or else there is some t with t t. Case r = TIf. This implies (by the inversion lemma) that following must hold for t: t = if t 1 then t 2 else t 3 t 1 : Bool t 2 : T t 3 : T 35 / 49
36 Progress Proof Theorem: Suppose t is a welltyped term (that is, t : T for some type T ). Then either t is a value or else there is some t with t t. Case r = TIf. This implies (by the inversion lemma) that following must hold for t: t = if t 1 then t 2 else t 3 t 1 : Bool t 2 : T t 3 : T There are three evaluation rules that need to be considered: EIfTrue, EIfFalse, and EIf. We assume (by the induction hypothesis) that the theorem holds for t 1. This allows us to conclude that (1) t 1 is a value or (2) there exists a t 1 such that t 1 t / 49
37 Progress Proof Theorem: Suppose t is a welltyped term (that is, t : T for some type T ). Then either t is a value or else there is some t with t t. Case r = TIf. This implies (by the inversion lemma) that following must hold for t: t = if t 1 then t 2 else t 3 t 1 : Bool t 2 : T t 3 : T Subcase t 1 is a value. We also know that t 1 : Bool and hence t 1 must either be true or false (by the canonical forms lemma). In this case, the reduction t t is accomplished via the evaluation rule EIfTrue or EIfFalse. 37 / 49
38 Progress Proof Theorem: Suppose t is a welltyped term (that is, t : T for some type T ). Then either t is a value or else there is some t with t t. Case r = TIf. This implies (by the inversion lemma) that following must hold for t: t = if t 1 then t 2 else t 3 t 1 : Bool t 2 : T t 3 : T Subcase There exists a t 1 such that t 1 t 1. In this case, the reduction t t is accomplished via the evaluation rule EIf. Thus, for the case TIf, our analysis accounts for all evaluation rules. 38 / 49
39 Remaining Cases Theorem: Suppose t is a welltyped term (that is, t : T for some type T ). Then either t is a value or else there is some t with t t. Case r = TZero. Here t = 0 so no evaluation rules apply. Case r = TSucc. Here t = succ t 1 so only the evaluation rule ESucc must be considered (in the case where t 1 is not a value). Case r = TPred. Here t = pred t 1 and the evaluation rules EPredZero, EPredSucc and EPred must be considered. Case r = TIsZero. Here t = iszero t 1 and the evaluation rules EIsZeroZero, EIsZeroSucc and EIsZero must be considered. 39 / 49
40 Preservation Theorem: If t : T and t t, then t : T. 40 / 49
41 Preservation Theorem: If t : T and t t, then t : T. Proof: By induction on a typing derivation of t : T. 41 / 49
42 Preservation Theorem: If t : T and t t, then t : T. Proof: By induction on a typing derivation of t : T. Case r = TTrue. In this case, t = true. Therefore, t t is not possible, and the theorem is vacuously true. 42 / 49
43 Preservation Theorem: If t : T and t t, then t : T. Proof: By induction on a typing derivation of t : T. Case r = TFalse. In this case, t = false. Therefore, t t is not possible, and the theorem is vacuously true. 43 / 49
44 Preservation Theorem: If t : T and t t, then t : T. Proof: By induction on a typing derivation of t : T. Case r = TIf. In this case, it follows that: t = if t 1 then t 2 else t 3 t 1 : Bool t 2 : T t 3 : T 44 / 49
45 Preservation Theorem: If t : T and t t, then t : T. Proof: By induction on a typing derivation of t : T. Case r = TIf. In this case, it follows that: t = if t 1 then t 2 else t 3 t 1 : Bool t 2 : T t 3 : T In this context, there are three evaluation rule by which t t can be derived: EIfTrue, EIfFalse, EIf. 45 / 49
46 Preservation Theorem: If t : T and t t, then t : T. Proof: By induction on a typing derivation of t : T. Case r = TIf. In this case, it follows that: t = if t 1 then t 2 else t 3 t 1 : Bool t 2 : T t 3 : T Subcase Evaluation rule = EIfTrue. In this case, t 1 = true and t = t 2. We also know that t 2 : T, and hence t : T as required. 46 / 49
47 Preservation Theorem: If t : T and t t, then t : T. Proof: By induction on a typing derivation of t : T. Case r = TIf. In this case, it follows that: t = if t 1 then t 2 else t 3 t 1 : Bool t 2 : T t 3 : T Subcase Evaluation rule = EIfFalse. In this case, t 1 = false and t = t 3. We also know that t 3 : T, and hence t : T as required. 47 / 49
48 Preservation Theorem: If t : T and t t, then t : T. Proof: By induction on a typing derivation of t : T. Case r = TIf. In this case, it follows that: t = if t 1 then t 2 else t 3 t 1 : Bool t 2 : T t 3 : T Subcase Evaluation rule = EIf. In this case, t 1 t 1 and t = if t 1 then t 2 else t 3 Combining the inductive assumption with t 1 : Bool lets us conclude t 1 : Bool. We also know t 2 : T and t 3 : T. Therefore we can conclude that t : T. 48 / 49
49 Remaining Cases Theorem: If t : T and t t, then t : T. Case r = TZero. Here t = 0 so no evaluation rules apply. Case r = TSucc. Here t = succ t 1 so only the evaluation rule ESucc must be considered (and only in the case where t 1 is not a value). Case r = TPred. Here t = pred t 1 and the evaluation rules EPredZero, EPredSucc and EPred must be considered. Case r = TIsZero. Here t = iszero t 1 and the evaluation rules EIsZeroZero, EIsZeroSucc and EIsZero must be considered. 49 / 49
Assignment 1 (100 Points)
CIS 705 Programming Languages Spring 2010 Assignment 1 (100 Points) Due by 2:30 p.m. on Thursday, February 11 The context for this assignment is Chapters 23 of TAPL. Terms The set of terms is inductively
More informationTypes, Polymorphism, and Type Reconstruction
Types, Polymorphism, and Type Reconstruction Sources This material is based on the following sources: Pierce, B.C., Types and Programming Languages. MIT Press, 2002. Kanellakis, P.C., Mairson, H.G. and
More informationCIS 500 Software Foundations Midterm I, Review Questions
CIS 500 Software Foundations Midterm I, Review Questions Untyped lambda calculus 1. (2 points) We have seen that a linear expression likeλx.λy.xyx is shorthand for an abstract syntax tree that can be drawn
More informationNOTES ON TYPES AND PROGRAMMING LANGUAGES
NOTES ON TYPES AND PROGRAMMING LANGUAGES NEAL PARIKH Abstract. This document aims to serve as a brief outline and concise reference for Types and Programming Languages by B. Pierce. The sections roughly
More informationFull and Complete Binary Trees
Full and Complete Binary Trees Binary Tree Theorems 1 Here are two important types of binary trees. Note that the definitions, while similar, are logically independent. Definition: a binary tree T is full
More informationThe Prime Numbers. Definition. A prime number is a positive integer with exactly two positive divisors.
The Prime Numbers Before starting our study of primes, we record the following important lemma. Recall that integers a, b are said to be relatively prime if gcd(a, b) = 1. Lemma (Euclid s Lemma). If gcd(a,
More informationFun with Phantom Types
1 Fun with Phantom Types RALF HINZE Institut für Informatik III, Universität Bonn Römerstraße 164, 53117 Bonn, Germany Email: ralf@informatik.unibonn.de Homepage: http://www.informatik.unibonn.de/~ralf
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 informationDEGREES OF ORDERS ON TORSIONFREE ABELIAN GROUPS
DEGREES OF ORDERS ON TORSIONFREE ABELIAN GROUPS ASHER M. KACH, KAREN LANGE, AND REED SOLOMON Abstract. We construct two computable presentations of computable torsionfree abelian groups, one of isomorphism
More informationDeterministic Discrete Modeling
Deterministic Discrete Modeling Formal Semantics of Firewalls in Isabelle/HOL Cornelius Diekmann, M.Sc. Dr. Heiko Niedermayer Prof. Dr.Ing. Georg Carle Lehrstuhl für Netzarchitekturen und Netzdienste
More informationTuring Degrees and Definability of the Jump. Theodore A. Slaman. University of California, Berkeley. CJuly, 2005
Turing Degrees and Definability of the Jump Theodore A. Slaman University of California, Berkeley CJuly, 2005 Outline Lecture 1 Forcing in arithmetic Coding and decoding theorems Automorphisms of countable
More informationTermination Checking: Comparing Structural Recursion and Sized Types by Examples
Termination Checking: Comparing Structural Recursion and Sized Types by Examples David Thibodeau Decemer 3, 2011 Abstract Termination is an important property for programs and is necessary for formal proofs
More information8 Divisibility and prime numbers
8 Divisibility and prime numbers 8.1 Divisibility In this short section we extend the concept of a multiple from the natural numbers to the integers. We also summarize several other terms that express
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 information12 Greatest Common Divisors. The Euclidean Algorithm
Arkansas Tech University MATH 4033: Elementary Modern Algebra Dr. Marcel B. Finan 12 Greatest Common Divisors. The Euclidean Algorithm As mentioned at the end of the previous section, we would like to
More informationGenerating Elementary Combinatorial Objects
Fall 2009 Combinatorial Generation Combinatorial Generation: an old subject Excerpt from: D. Knuth, History of Combinatorial Generation, in prefascicle 4B, The Art of Computer Programming Vol 4. Combinatorial
More informationBasic Proof Techniques
Basic Proof Techniques David Ferry dsf43@truman.edu September 13, 010 1 Four Fundamental Proof Techniques When one wishes to prove the statement P Q there are four fundamental approaches. This document
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 informationLecture 14: Section 3.3
Lecture 14: Section 3.3 Shuanglin Shao October 23, 2013 Definition. Two nonzero vectors u and v in R n are said to be orthogonal (or perpendicular) if u v = 0. We will also agree that the zero vector in
More informationPOLYTYPIC PROGRAMMING OR: Programming Language Theory is Helpful
POLYTYPIC PROGRAMMING OR: Programming Language Theory is Helpful RALF HINZE Institute of Information and Computing Sciences Utrecht University Email: ralf@cs.uu.nl Homepage: http://www.cs.uu.nl/~ralf/
More informationDiscrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 5
CS 70 Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 5 Modular Arithmetic One way to think of modular arithmetic is that it limits numbers to a predefined range {0,1,...,N
More informationGROUPS SUBGROUPS. Definition 1: An operation on a set G is a function : G G G.
Definition 1: GROUPS An operation on a set G is a function : G G G. Definition 2: A group is a set G which is equipped with an operation and a special element e G, called the identity, such that (i) the
More information6.2 Permutations continued
6.2 Permutations continued Theorem A permutation on a finite set A is either a cycle or can be expressed as a product (composition of disjoint cycles. Proof is by (strong induction on the number, r, of
More informationProgramming Languages Featherweight Java David Walker
Programming Languages Featherweight Java David Walker Overview Featherweight Java (FJ), a minimal Javalike language. Models inheritance and subtyping. Immutable objects: no mutation of fields. Trivialized
More informationKevin James. MTHSC 412 Section 2.4 Prime Factors and Greatest Comm
MTHSC 412 Section 2.4 Prime Factors and Greatest Common Divisor Greatest Common Divisor Definition Suppose that a, b Z. Then we say that d Z is a greatest common divisor (gcd) of a and b if the following
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 informationA Tutorial on [Co]Inductive Types in Coq
A Tutorial on [Co]Inductive Types in Coq Eduardo Giménez, Pierre Castéran May 1998 August 17, 2007 Abstract This document 1 is an introduction to the definition and use of inductive and coinductive types
More informationCycles 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É CLAUDEBERNARD LYON 1 69622 VILLEURBANNE, FRANCE 2 DEPARTMENT OF MATHEMATICS
More information4 Domain Relational Calculus
4 Domain Relational Calculus We now present two relational calculi that we will compare to RA. First, what is the difference between an algebra and a calculus? The usual story is that the algebra RA is
More information6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, 2010. Class 4 Nancy Lynch
6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, 2010 Class 4 Nancy Lynch Today Two more models of computation: Nondeterministic Finite Automata (NFAs)
More informationSubsets 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
More information8.1 Makespan Scheduling
600.469 / 600.669 Approximation Algorithms Lecturer: Michael Dinitz Topic: Dynamic Programing: MinMakespan and Bin Packing Date: 2/19/15 Scribe: Gabriel Kaptchuk 8.1 Makespan Scheduling Consider an instance
More informationPOLYNOMIAL RINGS AND UNIQUE FACTORIZATION DOMAINS
POLYNOMIAL RINGS AND UNIQUE FACTORIZATION DOMAINS RUSS WOODROOFE 1. Unique Factorization Domains Throughout the following, we think of R as sitting inside R[x] as the constant polynomials (of degree 0).
More informationType Systems. Luca Cardelli. Digital Equipment Corporation Systems Research Center
Type Systems 1 Introduction Luca Cardelli Digital Equipment Corporation Systems Research Center The fundamental purpose of a type system is to prevent the occurrence of execution errors during the running
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 informationMathematical Induction. Lecture 1011
Mathematical Induction Lecture 1011 Menu Mathematical Induction Strong Induction Recursive Definitions Structural Induction Climbing an Infinite Ladder Suppose we have an infinite ladder: 1. We can reach
More informationMathematical 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,
More informationNotes from February 11
Notes from February 11 Math 130 Course web site: www.courses.fas.harvard.edu/5811 Two lemmas Before proving the theorem which was stated at the end of class on February 8, we begin with two lemmas. The
More informationFinite Sets. Theorem 5.1. Two nonempty finite sets have the same cardinality if and only if they are equivalent.
MATH 337 Cardinality Dr. Neal, WKU We now shall prove that the rational numbers are a countable set while R is uncountable. This result shows that there are two different magnitudes of infinity. But we
More informationBreaking The Code. Ryan Lowe. Ryan Lowe is currently a Ball State senior with a double major in Computer Science and Mathematics and
Breaking The Code Ryan Lowe Ryan Lowe is currently a Ball State senior with a double major in Computer Science and Mathematics and a minor in Applied Physics. As a sophomore, he took an independent study
More informationOPERATIONAL 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
More informationThe Factor Theorem and a corollary of the Fundamental Theorem of Algebra
Math 421 Fall 2010 The Factor Theorem and a corollary of the Fundamental Theorem of Algebra 27 August 2010 Copyright 2006 2010 by Murray Eisenberg. All rights reserved. Prerequisites Mathematica Aside
More informationTests for Divisibility, Theorems for Divisibility, the Prime Factor Test
1 Tests for Divisibility, Theorems for Divisibility, the Prime Factor Test Definition: Prime numbers are numbers with only two factors, one and itself. For example: 2, 3, and 5. Definition: Composite numbers
More information3. 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)
More informationType Systems. Luca Cardelli. Microsoft Research
Type Systems Luca Cardelli Microsoft Research 1 Introduction The fundamental purpose of a type system is to prevent the occurrence of execution errors during the running of a program. This informal statement
More information5.1 Commutative rings; Integral Domains
5.1 J.A.Beachy 1 5.1 Commutative rings; Integral Domains from A Study Guide for Beginner s by J.A.Beachy, a supplement to Abstract Algebra by Beachy / Blair 23. Let R be a commutative ring. Prove the following
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 information2. 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
More informationProperties of Real Numbers
16 Chapter P Prerequisites P.2 Properties of Real Numbers What you should learn: Identify and use the basic properties of real numbers Develop and use additional properties of real numbers Why you should
More informationFinite dimensional topological vector spaces
Chapter 3 Finite dimensional topological vector spaces 3.1 Finite dimensional Hausdorff t.v.s. Let X be a vector space over the field K of real or complex numbers. We know from linear algebra that the
More informationThe Inverse of a Square Matrix
These notes closely follow the presentation of the material given in David C Lay s textbook Linear Algebra and its Applications (3rd edition) These notes are intended primarily for inclass presentation
More informationIndiana State Core Curriculum Standards updated 2009 Algebra I
Indiana State Core Curriculum Standards updated 2009 Algebra I Strand Description Boardworks High School Algebra presentations Operations With Real Numbers Linear Equations and A1.1 Students simplify and
More informationDivisor graphs have arbitrary order and size
Divisor graphs have arbitrary order and size arxiv:math/0606483v1 [math.co] 20 Jun 2006 Le Anh Vinh School of Mathematics University of New South Wales Sydney 2052 Australia Abstract A divisor graph G
More informationThe Classes P and NP
The Classes P and NP We now shift gears slightly and restrict our attention to the examination of two families of problems which are very important to computer scientists. These families constitute the
More informationIV.2 (b) Higher level programming concepts for URMs Anton Setzer
CS 275 Automata and Formal Language Theory Course Notes Additional Material Part IV: Limits of Computation Chapt. IV.2: The URM IV.2 (a) Definition of the URM IV.2 (b) Higher level programming concepts
More informationMATH 22. THE FUNDAMENTAL THEOREM of ARITHMETIC. Lecture R: 10/30/2003
MATH 22 Lecture R: 10/30/2003 THE FUNDAMENTAL THEOREM of ARITHMETIC You must remember this, A kiss is still a kiss, A sigh is just a sigh; The fundamental things apply, As time goes by. Herman Hupfeld
More informationFactorization in Polynomial Rings
Factorization in Polynomial Rings These notes are a summary of some of the important points on divisibility in polynomial rings from 17 and 18 of Gallian s Contemporary Abstract Algebra. Most of the important
More informationInverses and powers: Rules of Matrix Arithmetic
Contents 1 Inverses and powers: Rules of Matrix Arithmetic 1.1 What about division of matrices? 1.2 Properties of the Inverse of a Matrix 1.2.1 Theorem (Uniqueness of Inverse) 1.2.2 Inverse Test 1.2.3
More informationS(A) X α for all α Λ. Consequently, S(A) X, by the definition of intersection. Therefore, X is inductive.
MA 274: Exam 2 Study Guide (1) Know the precise definitions of the terms requested for your journal. (2) Review proofs by induction. (3) Be able to prove that something is or isn t an equivalence relation.
More informationFUNCTIONAL ANALYSIS LECTURE NOTES: QUOTIENT SPACES
FUNCTIONAL ANALYSIS LECTURE NOTES: QUOTIENT SPACES CHRISTOPHER HEIL 1. Cosets and the Quotient Space Any vector space is an abelian group under the operation of vector addition. So, if you are have studied
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 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 informationOnline Appendix to. Stability and Competitive Equilibrium in Trading Networks
Online Appendix to Stability and Competitive Equilibrium in Trading Networks John William Hatfield Scott Duke Kominers Alexandru Nichifor Michael Ostrovsky Alexander Westkamp Abstract In this appendix,
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 informationeach 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
More informationDEGREES OF CATEGORICITY AND THE HYPERARITHMETIC HIERARCHY
DEGREES OF CATEGORICITY AND THE HYPERARITHMETIC HIERARCHY BARBARA F. CSIMA, JOHANNA N. Y. FRANKLIN, AND RICHARD A. SHORE Abstract. We study arithmetic and hyperarithmetic degrees of categoricity. We extend
More informationPART I. THE REAL NUMBERS
PART I. THE REAL NUMBERS This material assumes that you are already familiar with the real number system and the representation of the real numbers as points on the real line. I.1. THE NATURAL NUMBERS
More informationThe countdown problem
JFP 12 (6): 609 616, November 2002. c 2002 Cambridge University Press DOI: 10.1017/S0956796801004300 Printed in the United Kingdom 609 F U N C T I O N A L P E A R L The countdown problem GRAHAM HUTTON
More informationParametric Domaintheoretic models of Linear Abadi & Plotkin Logic
Parametric Domaintheoretic models of Linear Abadi & Plotkin Logic Lars Birkedal Rasmus Ejlers Møgelberg Rasmus Lerchedahl Petersen IT University Technical Report Series TR007 ISSN 600 600 February 00
More informationTheory of Computation Lecture Notes
Theory of Computation Lecture Notes Abhijat Vichare August 2005 Contents 1 Introduction 2 What is Computation? 3 The λ Calculus 3.1 Conversions: 3.2 The calculus in use 3.3 Few Important Theorems 3.4 Worked
More informationSection 4.2: The Division Algorithm and Greatest Common Divisors
Section 4.2: The Division Algorithm and Greatest Common Divisors The Division Algorithm The Division Algorithm is merely long division restated as an equation. For example, the division 29 r. 20 32 948
More informationFactoring Algorithms
Factoring Algorithms The p 1 Method and Quadratic Sieve November 17, 2008 () Factoring Algorithms November 17, 2008 1 / 12 Fermat s factoring method Fermat made the observation that if n has two factors
More informationGREATEST COMMON DIVISOR
DEFINITION: GREATEST COMMON DIVISOR The greatest common divisor (gcd) of a and b, denoted by (a, b), is the largest common divisor of integers a and b. THEOREM: If a and b are nonzero integers, then their
More informationCS510 Software Engineering
CS510 Software Engineering Propositional Logic Asst. Prof. Mathias Payer Department of Computer Science Purdue University TA: Scott A. Carr Slides inspired by Xiangyu Zhang http://nebelwelt.net/teaching/15cs510se
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 informationTAKEAWAY GAMES. ALLEN J. SCHWENK California Institute of Technology, Pasadena, California INTRODUCTION
TAKEAWAY GAMES ALLEN J. SCHWENK California Institute of Technology, Pasadena, California L INTRODUCTION Several games of Tf takeaway?f have become popular. The purpose of this paper is to determine the
More informationLectures notes on orthogonal matrices (with exercises) 92.222  Linear Algebra II  Spring 2004 by D. Klain
Lectures notes on orthogonal matrices (with exercises) 92.222  Linear Algebra II  Spring 2004 by D. Klain 1. Orthogonal matrices and orthonormal sets An n n realvalued matrix A is said to be an orthogonal
More informationJieh Hsiang Department of Computer Science State University of New York Stony brook, NY 11794
ASSOCIATIVECOMMUTATIVE REWRITING* Nachum Dershowitz University of Illinois Urbana, IL 61801 N. Alan Josephson University of Illinois Urbana, IL 01801 Jieh Hsiang State University of New York Stony brook,
More informationUndergraduate Notes in Mathematics. Arkansas Tech University Department of Mathematics
Undergraduate Notes in Mathematics Arkansas Tech University Department of Mathematics An Introductory Single Variable Real Analysis: A Learning Approach through Problem Solving Marcel B. Finan c All Rights
More informationFALSE ALARMS IN FAULTTOLERANT DOMINATING SETS IN GRAPHS. Mateusz Nikodem
Opuscula Mathematica Vol. 32 No. 4 2012 http://dx.doi.org/10.7494/opmath.2012.32.4.751 FALSE ALARMS IN FAULTTOLERANT DOMINATING SETS IN GRAPHS Mateusz Nikodem Abstract. We develop the problem of faulttolerant
More informationSection 3 Sequences and Limits, Continued.
Section 3 Sequences and Limits, Continued. Lemma 3.6 Let {a n } n N be a convergent sequence for which a n 0 for all n N and it α 0. Then there exists N N such that for all n N. α a n 3 α In particular
More informationMathematical induction. Niloufar Shafiei
Mathematical induction Niloufar Shafiei Mathematical induction Mathematical induction is an extremely important proof technique. Mathematical induction can be used to prove results about complexity of
More informationNOTES ON LINEAR TRANSFORMATIONS
NOTES ON LINEAR TRANSFORMATIONS Definition 1. Let V and W be vector spaces. A function T : V W is a linear transformation from V to W if the following two properties hold. i T v + v = T v + T v for all
More informationLecture 15 An Arithmetic Circuit Lowerbound and Flows in Graphs
CSE599s: Extremal Combinatorics November 21, 2011 Lecture 15 An Arithmetic Circuit Lowerbound and Flows in Graphs Lecturer: Anup Rao 1 An Arithmetic Circuit Lower Bound An arithmetic circuit is just like
More informationNIM with Cash. Abstract. loses. This game has been well studied. For example, it is known that for NIM(1, 2, 3; n)
NIM with Cash William Gasarch Univ. of MD at College Park John Purtilo Univ. of MD at College Park Abstract NIM(a 1,..., a k ; n) is a player game where initially there are n stones on the board and the
More informationSoftware Analysis (POPA Sec , )
Software Analysis (POPA Sec. 2.2.2, 2.52.5.2) Klaus Ostermann Based on slides by Jurriaan Hage Overview Correctness proof Live Variables Analysis The While language with procedures Live Variables Analysis
More information3. Applications of Number Theory
3. APPLICATIONS OF NUMBER THEORY 163 3. Applications of Number Theory 3.1. Representation of Integers. Theorem 3.1.1. Given an integer b > 1, every positive integer n can be expresses uniquely as n = a
More informationQuotient Rings and Field Extensions
Chapter 5 Quotient Rings and Field Extensions In this chapter we describe a method for producing field extension of a given field. If F is a field, then a field extension is a field K that contains F.
More informationAnnouncements. 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
More informationSOLVING POLYNOMIAL EQUATIONS
C SOLVING POLYNOMIAL EQUATIONS We will assume in this appendix that you know how to divide polynomials using long division and synthetic division. If you need to review those techniques, refer to an algebra
More informationHOMEWORK 5 SOLUTIONS. n!f n (1) lim. ln x n! + xn x. 1 = G n 1 (x). (2) k + 1 n. (n 1)!
Math 7 Fall 205 HOMEWORK 5 SOLUTIONS Problem. 2008 B2 Let F 0 x = ln x. For n 0 and x > 0, let F n+ x = 0 F ntdt. Evaluate n!f n lim n ln n. By directly computing F n x for small n s, we obtain the following
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 Basics of Graphical Models
The Basics of Graphical Models David M. Blei Columbia University October 3, 2015 Introduction These notes follow Chapter 2 of An Introduction to Probabilistic Graphical Models by Michael Jordan. Many figures
More informationEMBEDDING 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
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 informationVerifying Specifications with Proof Scores in CafeOBJ
Verifying Specifications with Proof Scores in CafeOBJ FUTATSUGI, Kokichi 二 木 厚 吉 Chair of Language Design Graduate School of Information Science Japan Advanced Institute of Science and Technology (JAIST)
More informationNotes on Determinant
ENGG2012B Advanced Engineering Mathematics Notes on Determinant Lecturer: Kenneth Shum Lecture 918/02/2013 The determinant of a system of linear equations determines whether the solution is unique, without
More information26 Integers: Multiplication, Division, and Order
26 Integers: Multiplication, Division, and Order Integer multiplication and division are extensions of whole number multiplication and division. In multiplying and dividing integers, the one new issue
More informationCorrespondence analysis for strong threevalued logic
Correspondence analysis for strong threevalued logic A. Tamminga abstract. I apply Kooi and Tamminga s (2012) idea of correspondence analysis for manyvalued logics to strong threevalued logic (K 3 ).
More informationLinear Algebra. A vector space (over R) is an ordered quadruple. such that V is a set; 0 V ; and the following eight axioms hold:
Linear Algebra A vector space (over R) is an ordered quadruple (V, 0, α, µ) such that V is a set; 0 V ; and the following eight axioms hold: α : V V V and µ : R V V ; (i) α(α(u, v), w) = α(u, α(v, w)),
More information