Types, Polymorphism, and Type Reconstruction
|
|
|
- Penelope French
- 10 years ago
- Views:
Transcription
1 Types, Polymorphism, and Type Reconstruction
2 Sources This material is based on the following sources: Pierce, B.C., Types and Programming Languages. MIT Press, Kanellakis, P.C., Mairson, H.G. and Mitchell, J.C., Unification and ML type reconstruction. In Computational Logic: Essays in Honor of Alan Robinson, ed. J.-L. Lassez and G.D. Plotkin, MIT Press, 1991, pages Damas L., Milner, R., Principal type-schemes for functional programs. Proceedings of the 9th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, ACM, 1982, pages Recommended further reading: Pierce, B.C., Turner D.N., Local type inference. ACM Transactions on Programming Languages and Systems, Volume 22 Issue 1, Jan. 2000, pages 1 44.
3 The Simply Typed Lambda-Calculus
4 The simply typed lambda-calculus The system we are about to define is commonly called the simply typed lambda-calculus, or λ for short. Unlike the untyped lambda-calculus, the pure form of λ (with no primitive values or operations) is not very interesting; to talk about λ, we always begin with some set of base types. So, strictly speaking, there are many variants of λ, depending on the choice of base types. For now, we ll work with a variant constructed over the booleans.
5 Untyped lambda-calculus with booleans t ::= terms x variable λx.t abstraction t t application true constant true false constant false if t then t else t conditional v ::= values λx.t abstraction value true true value false false value
6 Simple Types T ::= types Bool type of booleans T T types of functions What are some examples?
7 Type Annotations We now have a choice to make. Do we... annotate lambda-abstractions with the expected type of the argument λx:t 1. t 2 (as in most mainstream programming languages), or continue to write lambda-abstractions as before λx. t 2 and ask the typing rules to guess an appropriate annotation (as in OCaml)? Both are reasonable choices, but the first makes the job of defining the typing rules simpler. Let s take this choice for now.
8 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 (T-True) (T-False) (T-If)
9 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??? λx:t 1.t 2 : T 1 T 2 (T-True) (T-False) (T-If) (T-Abs)
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 (T-True) (T-False) (T-If) Γ, x:t 1 t 2 : T 2 Γ λx:t 1.t 2 : T 1 T 2 x:t Γ Γ x : T (T-Abs) (T-Var)
11 Typing rules Γ true : Bool Γ false : Bool (T-True) (T-False) Γ t 1 : Bool Γ t 2 : T Γ t 3 : T Γ if t 1 then t 2 else t 3 : T (T-If) Γ, x:t 1 t 2 : T 2 Γ λx:t 1.t 2 : T 1 T 2 x:t Γ Γ x : T (T-Abs) (T-Var) Γ t 1 : T 11 T 12 Γ t 2 : T 11 Γ t 1 t 2 : T 12 (T-App)
12 Typing Derivations What derivations justify the following typing statements? (λx:bool.x) true : Bool f:bool Bool f (if false then true else false) : Bool f:bool Bool λx:bool. f (if x then false else x) : Bool Bool
13 Properties of λ The fundamental property of the type system we have just defined is soundness with respect to the operational semantics. 1. Progress: A closed, well-typed 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 one-step evaluation If Γ t : T and t t, then Γ t : T.
14 Proving progress inversion lemma for typing relation canonical forms lemma progress theorem
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 and Γ t 2, t 3 : R.
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 and Γ t 2, t 3 : R. 4. If Γ x : R, then
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 and Γ t 2, t 3 : R. 4. If Γ x : R, then x:r Γ.
18 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 and Γ t 2, t 3 : R. 4. If Γ x : R, then x:r Γ. 5. If Γ λx:t 1.t 2 : R, then
19 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 and Γ t 2, t 3 : R. 4. If Γ x : R, then x:r Γ. 5. If Γ λx:t 1.t 2 : R, then R = T 1 R 2 for some R 2 with Γ, x:t 1 t 2 : R 2.
20 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 and Γ t 2, t 3 : R. 4. If Γ x : R, then x:r Γ. 5. If Γ λx:t 1.t 2 : R, then R = T 1 R 2 for some R 2 with Γ, x:t 1 t 2 : R If Γ t 1 t 2 : R, then
21 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 and Γ t 2, t 3 : R. 4. If Γ x : R, then x:r Γ. 5. If Γ λx:t 1.t 2 : R, then R = T 1 R 2 for some R 2 with Γ, x:t 1 t 2 : R If Γ t 1 t 2 : R, then there is some type T 11 such that Γ t 1 : T 11 R and Γ t 2 : T 11.
22 Canonical Forms Lemma:
23 Canonical Forms Lemma: 1. If v is a value of type Bool, then
24 Canonical Forms Lemma: 1. If v is a value of type Bool, then v is either true or false.
25 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 T 1 T 2, then
26 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 T 1 T 2, then v has the form λx:t 1.t 2.
27 Progress Theorem: Suppose t is a closed, well-typed term (that is, t : T for some T). Then either t is a value or else there is some t with t t. Proof: By induction
28 Progress Theorem: Suppose t is a closed, well-typed term (that is, t : T for some T). Then either t is a value or else there is some t with t t. Proof: By induction on typing derivations.
29 Progress Theorem: Suppose t is a closed, well-typed term (that is, t : T for some T). Then either t is a value or else there is some t with t t. Proof: By induction on typing derivations. The cases for boolean constants and conditions are the same as before. The variable case is trivial (because t is closed). The abstraction case is immediate, since abstractions are values.
30 Progress Theorem: Suppose t is a closed, well-typed term (that is, t : T for some T). Then either t is a value or else there is some t with t t. Proof: By induction on typing derivations. The cases for boolean constants and conditions are the same as before. The variable case is trivial (because t is closed). The abstraction case is immediate, since abstractions are values. Consider the case for application, where t = t 1 t 2 with t 1 : T 11 T 12 and t 2 : T 11.
31 Progress Theorem: Suppose t is a closed, well-typed term (that is, t : T for some T). Then either t is a value or else there is some t with t t. Proof: By induction on typing derivations. The cases for boolean constants and conditions are the same as before. The variable case is trivial (because t is closed). The abstraction case is immediate, since abstractions are values. Consider the case for application, where t = t 1 t 2 with t 1 : T 11 T 12 and t 2 : T 11. By the induction hypothesis, either t 1 is a value or else it can make a step of evaluation, and likewise t 2.
32 Progress Theorem: Suppose t is a closed, well-typed term (that is, t : T for some T). Then either t is a value or else there is some t with t t. Proof: By induction on typing derivations. The cases for boolean constants and conditions are the same as before. The variable case is trivial (because t is closed). The abstraction case is immediate, since abstractions are values. Consider the case for application, where t = t 1 t 2 with t 1 : T 11 T 12 and t 2 : T 11. By the induction hypothesis, either t 1 is a value or else it can make a step of evaluation, and likewise t 2. If t 1 can take a step, then rule E-App1 applies to t. If t 1 is a value and t 2 can take a step, then rule E-App2 applies. Finally, if both t 1 and t 2 are values, then the canonical forms lemma tells us that t 1 has the form λx:t 11.t 12, and so rule E-AppAbs applies to t.
33 Preservation for STLC
34 Preservation for STLC Theorem: If Γ t : T and t t, then Γ t : T. Proof: By induction
35 Preservation for STLC Theorem: If Γ t : T and t t, then Γ t : T. Proof: By induction on typing derivations. Which case is the hard one??
36 Preservation for STLC Theorem: If Γ t : T and t t, then Γ t : T. Proof: By induction on typing derivations. Case T-App: Given t = t 1 t 2 Γ t 1 : T 11 T 12 Γ t 2 : T 11 T = T 12 Show Γ t : T 12
37 Preservation for STLC Theorem: If Γ t : T and t t, then Γ t : T. Proof: By induction on typing derivations. Case T-App: Given t = t 1 t 2 Γ t 1 : T 11 T 12 Γ t 2 : T 11 T = T 12 Show Γ t : T 12 By the inversion lemma for evaluation, there are three subcases...
38 The Substitution Lemma Lemma: Types are preserved under substitition. That is, if Γ, x:s t : T and Γ s : S, then Γ [x s]t : T.
39 The Substitution Lemma Lemma: Types are preserved under substitition. That is, if Γ, x:s t : T and Γ s : S, then Γ [x s]t : T. Proof:...
40 Weakening and Permutation Two other lemmas will be useful. Weakening tells us that we can add assumptions to the context without losing any true typing statements. Lemma: If Γ t : T and x / dom(γ), then Γ, x:s t : T.
41 Weakening and Permutation Two other lemmas will be useful. Weakening tells us that we can add assumptions to the context without losing any true typing statements. Lemma: If Γ t : T and x / dom(γ), then Γ, x:s t : T. Permutation tells us that the order of assumptions in (the list) Γ does not matter. Lemma: If Γ t : T and is a permutation of Γ, then t : T.
42 Weakening and Permutation Two other lemmas will be useful. Weakening tells us that we can add assumptions to the context without losing any true typing statements. Lemma: If Γ t : T and x / dom(γ), then Γ, x:s t : T. Moreover, the latter derivation has the same depth as the former. Permutation tells us that the order of assumptions in (the list) Γ does not matter. Lemma: If Γ t : T and is a permutation of Γ, then t : T. Moreover, the latter derivation has the same depth as the former.
43 The Substitution Lemma Lemma: If Γ, x:s t : T and Γ s : S, then Γ [x s]t : T. I.e., Types are preserved under substitition.
44 The Substitution Lemma Lemma: If Γ, x:s t : T and Γ s : S, then Γ [x s]t : T. Proof: By induction on the derivation of Γ, x:s t : T. Proceed by cases on the final typing rule used in the derivation.
45 The Substitution Lemma Lemma: If Γ, x:s t : T and Γ s : S, then Γ [x s]t : T. Proof: By induction on the derivation of Γ, x:s t : T. Proceed by cases on the final typing rule used in the derivation.
46 The Substitution Lemma Lemma: If Γ, x:s t : T and Γ s : S, then Γ [x s]t : T. Proof: By induction on the derivation of Γ, x:s t : T. Proceed by cases on the final typing rule used in the derivation. Case T-App: t = t 1 t 2 Γ, x:s t 1 : T 2 T 1 Γ, x:s t 2 : T 2 T = T 1 By the induction hypothesis, Γ [x s]t 1 : T 2 T 1 and Γ [x s]t 2 : T 2. By T-App, Γ [x s]t 1 [x s]t 2 : T, i.e., Γ [x s](t 1 t 2 ) : T.
47 The Substitution Lemma Lemma: If Γ, x:s t : T and Γ s : S, then Γ [x s]t : T. Proof: By induction on the derivation of Γ, x:s t : T. Proceed by cases on the final typing rule used in the derivation. Case T-Var: t = z with z:t (Γ, x:s) There are two sub-cases to consider, depending on whether z is x or another variable. If z = x, then [x s]z = s. The required result is then Γ s : S, which is among the assumptions of the lemma. Otherwise, [x s]z = z, and the desired result is immediate.
48 The Substitution Lemma Lemma: If Γ, x:s t : T and Γ s : S, then Γ [x s]t : T. Proof: By induction on the derivation of Γ, x:s t : T. Proceed by cases on the final typing rule used in the derivation. Case T-Abs: t = λy:t 2.t 1 T = T 2 T 1 Γ, x:s, y:t 2 t 1 : T 1 By our conventions on choice of bound variable names, we may assume x y and y / FV(s). Using permutation on the given subderivation, we obtain Γ, y:t 2, x:s t 1 : T 1. Using weakening on the other given derivation (Γ s : S), we obtain Γ, y:t 2 s : S. Now, by the induction hypothesis, Γ, y:t 2 [x s]t 1 : T 1. By T-Abs, Γ λy:t 2. [x s]t 1 : T 2 T 1, i.e. (by the definition of substitution), Γ [x s]λy:t 2. t 1 : T 2 T 1.
49 Summary: Preservation Theorem: If Γ t : T and t t, then Γ t : T. Lemmas to prove: Weakening Permutation Substitution preserves types Reduction preserves types (i.e., preservation)
50 Review: Type Systems To define and verify a type system, you must: 1. Define types 2. Specify typing rules 3. Prove soundness: progress and preservation
263-2200 Types and Programming Languages
263-2200 Types and Programming Languages 1 / 49 Outline Types Evaluation Rules Typing Rules Properties of the Typing Relation The Inversion Lemma Prolog Implementation Reasoning Involving Types Progress
Parametric Domain-theoretic models of Linear Abadi & Plotkin Logic
Parametric Domain-theoretic models of Linear Abadi & Plotkin Logic Lars Birkedal Rasmus Ejlers Møgelberg Rasmus Lerchedahl Petersen IT University Technical Report Series TR-00-7 ISSN 600 600 February 00
Introduction to type systems
Introduction to type systems p. 1/5 Introductory Course on Logic and Automata Theory Introduction to type systems [email protected] Based on slides by Jeff Foster, UMD Introduction to type systems
CIS 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
CMCS 312: Programming Languages Lecture 3: Lambda Calculus (Syntax, Substitution, Beta Reduction) Acar & Ahmed 17 January 2008
CMCS 312: Programming Languages Lecture 3: Lambda Calculus (Syntax, Substitution, Beta Reduction) Acar & Ahmed 17 January 2008 Contents 1 Announcements 1 2 Introduction 1 3 Abstract Syntax 1 4 Bound and
POLYTYPIC 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: [email protected] Homepage: http://www.cs.uu.nl/~ralf/
If n is odd, then 3n + 7 is even.
Proof: Proof: We suppose... that 3n + 7 is even. that 3n + 7 is even. Since n is odd, there exists an integer k so that n = 2k + 1. that 3n + 7 is even. Since n is odd, there exists an integer k so that
Functional Programming. Functional Programming Languages. Chapter 14. Introduction
Functional Programming Languages Chapter 14 Introduction Functional programming paradigm History Features and concepts Examples: Lisp ML 1 2 Functional Programming Functional Programming Languages The
Well-typed programs can t be blamed
Well-typed programs can t be blamed Philip Wadler University of Edinburgh Robert Bruce Findler University of Chicago Abstract We introduce the blame calculus, which adds the notion of blame from Findler
The 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,
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
Deterministic 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
NOTES 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
Kevin 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
Midterm Practice Problems
6.042/8.062J Mathematics for Computer Science October 2, 200 Tom Leighton, Marten van Dijk, and Brooke Cowan Midterm Practice Problems Problem. [0 points] In problem set you showed that the nand operator
Notes 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
The 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
Find-The-Number. 1 Find-The-Number With Comps
Find-The-Number 1 Find-The-Number With Comps Consider the following two-person game, which we call Find-The-Number with Comps. Player A (for answerer) has a number x between 1 and 1000. Player Q (for questioner)
LS.6 Solution Matrices
LS.6 Solution Matrices In the literature, solutions to linear systems often are expressed using square matrices rather than vectors. You need to get used to the terminology. As before, we state the definitions
Summary Last Lecture. Automated Reasoning. Outline of the Lecture. Definition sequent calculus. Theorem (Normalisation and Strong Normalisation)
Summary Summary Last Lecture sequent calculus Automated Reasoning Georg Moser Institute of Computer Science @ UIBK Winter 013 (Normalisation and Strong Normalisation) let Π be a proof in minimal logic
Termination 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
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
Indiana 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
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
6.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
Some Polynomial Theorems. John Kennedy Mathematics Department Santa Monica College 1900 Pico Blvd. Santa Monica, CA 90405 [email protected].
Some Polynomial Theorems by John Kennedy Mathematics Department Santa Monica College 1900 Pico Blvd. Santa Monica, CA 90405 [email protected] This paper contains a collection of 31 theorems, lemmas,
THE DIMENSION OF A VECTOR SPACE
THE DIMENSION OF A VECTOR SPACE KEITH CONRAD This handout is a supplementary discussion leading up to the definition of dimension and some of its basic properties. Let V be a vector space over a field
GROUPS ACTING ON A SET
GROUPS ACTING ON A SET MATH 435 SPRING 2012 NOTES FROM FEBRUARY 27TH, 2012 1. Left group actions Definition 1.1. Suppose that G is a group and S is a set. A left (group) action of G on S is a rule for
Boolean Algebra Part 1
Boolean Algebra Part 1 Page 1 Boolean Algebra Objectives Understand Basic Boolean Algebra Relate Boolean Algebra to Logic Networks Prove Laws using Truth Tables Understand and Use First Basic Theorems
INCIDENCE-BETWEENNESS GEOMETRY
INCIDENCE-BETWEENNESS GEOMETRY MATH 410, CSUSM. SPRING 2008. PROFESSOR AITKEN This document covers the geometry that can be developed with just the axioms related to incidence and betweenness. The full
CHAPTER 7 GENERAL PROOF SYSTEMS
CHAPTER 7 GENERAL PROOF SYSTEMS 1 Introduction Proof systems are built to prove statements. They can be thought as an inference machine with special statements, called provable statements, or sometimes
POLYNOMIAL 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).
DEGREES OF ORDERS ON TORSION-FREE ABELIAN GROUPS
DEGREES OF ORDERS ON TORSION-FREE ABELIAN GROUPS ASHER M. KACH, KAREN LANGE, AND REED SOLOMON Abstract. We construct two computable presentations of computable torsion-free abelian groups, one of isomorphism
How To Know If A Domain Is Unique In An Octempo (Euclidean) Or Not (Ecl)
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
Full 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
Mathematical Induction
Mathematical Induction In logic, we often want to prove that every member of an infinite set has some feature. E.g., we would like to show: N 1 : is a number 1 : has the feature Φ ( x)(n 1 x! 1 x) How
Hybrid Type Checking
Hybrid Type Checking Cormac Flanagan Department of Computer Science University of California, Santa Cruz [email protected] Abstract Traditional static type systems are very effective for verifying basic
Bindings, mobility of bindings, and the -quantifier
ICMS, 26 May 2007 1/17 Bindings, mobility of bindings, and the -quantifier Dale Miller, INRIA-Saclay and LIX, École Polytechnique This talk is based on papers with Tiu in LICS2003 & ACM ToCL, and experience
A SOUND TYPE SYSTEM FOR SECURE FLOW ANALYSIS
Journal of Computer Security draft printout, (17 Sep 2009), 1 20 IOS Press 1 A SOUND TYPE SYSTEM FOR SECURE FLOW ANALYSIS Dennis Volpano Computer Science Department Naval Postgraduate School Monterey,
1 Homework 1. [p 0 q i+j +... + p i 1 q j+1 ] + [p i q j ] + [p i+1 q j 1 +... + p i+j q 0 ]
1 Homework 1 (1) Prove the ideal (3,x) is a maximal ideal in Z[x]. SOLUTION: Suppose we expand this ideal by including another generator polynomial, P / (3, x). Write P = n + x Q with n an integer not
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
Chapter 7: Products and quotients
Chapter 7: Products and quotients Matthew Macauley Department of Mathematical Sciences Clemson University http://www.math.clemson.edu/~macaule/ Math 42, Spring 24 M. Macauley (Clemson) Chapter 7: Products
Observational Program Calculi and the Correctness of Translations
Observational Program Calculi and the Correctness of Translations Manfred Schmidt-Schauss 1, David Sabel 1, Joachim Niehren 2, and Jan Schwinghammer 1 Goethe-University, Frankfurt, Germany 2 INRIA Lille,
NIM 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
6.042/18.062J Mathematics for Computer Science. Expected Value I
6.42/8.62J Mathematics for Computer Science Srini Devadas and Eric Lehman May 3, 25 Lecture otes Expected Value I The expectation or expected value of a random variable is a single number that tells you
TAKE-AWAY GAMES. ALLEN J. SCHWENK California Institute of Technology, Pasadena, California INTRODUCTION
TAKE-AWAY GAMES ALLEN J. SCHWENK California Institute of Technology, Pasadena, California L INTRODUCTION Several games of Tf take-away?f have become popular. The purpose of this paper is to determine the
CS422 - Programming Language Design
1 CS422 - Programming Language Design General Information and Introduction Grigore Roşu Department of Computer Science University of Illinois at Urbana-Champaign 2 General Information Class Webpage and
Reminder: Complexity (1) Parallel Complexity Theory. Reminder: Complexity (2) Complexity-new
Reminder: Complexity (1) Parallel Complexity Theory Lecture 6 Number of steps or memory units required to compute some result In terms of input size Using a single processor O(1) says that regardless of
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)
Type 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
Lecture 19: Introduction to NP-Completeness Steven Skiena. Department of Computer Science State University of New York Stony Brook, NY 11794 4400
Lecture 19: Introduction to NP-Completeness Steven Skiena Department of Computer Science State University of New York Stony Brook, NY 11794 4400 http://www.cs.sunysb.edu/ skiena Reporting to the Boss Suppose
Andrew Pitts chapter for D. Sangorgi and J. Rutten (eds), Advanced Topics in Bisimulation and Coinduction, Cambridge Tracts in Theoretical Computer
Andrew Pitts chapter for D. Sangorgi and J. Rutten (eds), Advanced Topics in Bisimulation and Coinduction, Cambridge Tracts in Theoretical Computer Science No. 52, chapter 5, pages 197 232 ( c 2011 CUP)
G = G 0 > G 1 > > G k = {e}
Proposition 49. 1. A group G is nilpotent if and only if G appears as an element of its upper central series. 2. If G is nilpotent, then the upper central series and the lower central series have the same
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
GREATEST 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
Adding GADTs to OCaml the direct approach
Adding GADTs to OCaml the direct approach Jacques Garrigue & Jacques Le Normand Nagoya University / LexiFi (Paris) https://sites.google.com/site/ocamlgadt/ Garrigue & Le Normand Adding GADTs to OCaml 1
Programming 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
Likewise, we have contradictions: formulas that can only be false, e.g. (p p).
CHAPTER 4. STATEMENT LOGIC 59 The rightmost column of this truth table contains instances of T and instances of F. Notice that there are no degrees of contingency. If both values are possible, the formula
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
MATH10040 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
Journal of Functional Programming, volume 3 number 4, 1993. Dynamics in ML
Journal of Functional Programming, volume 3 number 4, 1993. Dynamics in ML Xavier Leroy École Normale Supérieure Michel Mauny INRIA Rocquencourt Abstract Objects with dynamic types allow the integration
CHAPTER 2. Logic. 1. Logic Definitions. Notation: Variables are used to represent propositions. The most common variables used are p, q, and r.
CHAPTER 2 Logic 1. Logic Definitions 1.1. Propositions. Definition 1.1.1. A proposition is a declarative sentence that is either true (denoted either T or 1) or false (denoted either F or 0). Notation:
Lectures 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 real-valued matrix A is said to be an orthogonal
A Propositional Dynamic Logic for CCS Programs
A Propositional Dynamic Logic for CCS Programs Mario R. F. Benevides and L. Menasché Schechter {mario,luis}@cos.ufrj.br Abstract This work presents a Propositional Dynamic Logic in which the programs are
Towards a Type System for Security APIs
Towards a Type System for Security APIs Gavin Keighren 1, David Aspinall 1, and Graham Steel 2 1 Laboratory for Foundations of Computer Science School of Informatics, The University of Edinburgh Informatics
On the generation of elliptic curves with 16 rational torsion points by Pythagorean triples
On the generation of elliptic curves with 16 rational torsion points by Pythagorean triples Brian Hilley Boston College MT695 Honors Seminar March 3, 2006 1 Introduction 1.1 Mazur s Theorem Let C be a
Every tree contains a large induced subgraph with all degrees odd
Every tree contains a large induced subgraph with all degrees odd A.J. Radcliffe Carnegie Mellon University, Pittsburgh, PA A.D. Scott Department of Pure Mathematics and Mathematical Statistics University
System Description: Delphin A Functional Programming Language for Deductive Systems
System Description: Delphin A Functional Programming Language for Deductive Systems Adam Poswolsky 1 and Carsten Schürmann 2 1 Yale University [email protected] 2 IT University of Copenhagen [email protected]
The Design and Implementation of Typed Scheme
The Design and Implementation of Typed Scheme Sam Tobin-Hochstadt PLT, Northeastern University Boston, MA 02115 Matthias Felleisen Abstract When scripts in untyped languages grow into large programs, maintaining
Functional Programming
FP 2005 1.1 3 Functional Programming WOLFRAM KAHL [email protected] Department of Computing and Software McMaster University FP 2005 1.2 4 What Kinds of Programming Languages are There? Imperative telling
DEDUCTIVE & INDUCTIVE REASONING
DEDUCTIVE & INDUCTIVE REASONING Expectations 1. Take notes on inductive and deductive reasoning. 2. This is an information based presentation -- I simply want you to be able to apply this information to
PYTHAGOREAN 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
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(
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,
Translating Generalized Algebraic Data Types to System F
Translating Generalized Algebraic Data Types to System F Martin Sulzmann and Meng Wang {sulzmann,wangmeng}@comp.nus.edu.sg School of Computing, National University of Singapore S16 Level 5, 3 Science Drive
Cosmological Arguments for the Existence of God S. Clarke
Cosmological Arguments for the Existence of God S. Clarke [Modified Fall 2009] 1. Large class of arguments. Sometimes they get very complex, as in Clarke s argument, but the basic idea is simple. Lets
= 2 + 1 2 2 = 3 4, Now assume that P (k) is true for some fixed k 2. This means that
Instructions. Answer each of the questions on your own paper, and be sure to show your work so that partial credit can be adequately assessed. Credit will not be given for answers (even correct ones) without
Authenticity by Typing for Security Protocols
Authenticity by Typing for Security Protocols Andrew D. Gordon Microsoft Research Alan Jeffrey DePaul University June 2002 Technical Report To appear in the Journal of Computer Security Microsoft Research
THE FUNDAMENTAL THEOREM OF ARBITRAGE PRICING
THE FUNDAMENTAL THEOREM OF ARBITRAGE PRICING 1. Introduction The Black-Scholes theory, which is the main subject of this course and its sequel, is based on the Efficient Market Hypothesis, that arbitrages
Jieh Hsiang Department of Computer Science State University of New York Stony brook, NY 11794
ASSOCIATIVE-COMMUTATIVE 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,
Basic Proof Techniques
Basic Proof Techniques David Ferry [email protected] September 13, 010 1 Four Fundamental Proof Techniques When one wishes to prove the statement P Q there are four fundamental approaches. This document
The Relative Worst Order Ratio for On-Line Algorithms
The Relative Worst Order Ratio for On-Line Algorithms Joan Boyar 1 and Lene M. Favrholdt 2 1 Department of Mathematics and Computer Science, University of Southern Denmark, Odense, Denmark, [email protected]
Automated Theorem Proving - summary of lecture 1
Automated Theorem Proving - summary of lecture 1 1 Introduction Automated Theorem Proving (ATP) deals with the development of computer programs that show that some statement is a logical consequence of
Five High Order Thinking Skills
Five High Order Introduction The high technology like computers and calculators has profoundly changed the world of mathematics education. It is not only what aspects of mathematics are essential for learning,
Modal Proofs as Distributed Programs (Extended Abstract)
Modal Proofs as Distributed Programs (Extended Abstract) Limin Jia and David Walker Princeton University 35 Olden St., Princeton, NJ 08544, USA {ljia,dpw}@cs.princeton.edu Abstract. We develop a new foundation
Sample Induction Proofs
Math 3 Worksheet: Induction Proofs III, Sample Proofs A.J. Hildebrand Sample Induction Proofs Below are model solutions to some of the practice problems on the induction worksheets. The solutions given
Rigorous Software Engineering Hoare Logic and Design by Contracts
Rigorous Software Engineering Hoare Logic and Design by Contracts Simão Melo de Sousa RELEASE (UBI), LIACC (Porto) Computer Science Department University of Beira Interior, Portugal 2010-2011 S. Melo de
Blame for All. Jeremy G. Siek. Amal Ahmed. Robert Bruce Findler. Philip Wadler. Abstract. 1. Introduction
Blame for All Amal Ahmed Indiana University [email protected] Robert Bruce Findler Northwestern University [email protected] Jeremy G. Siek University of Colorado at Boulder [email protected]
Solutions to TOPICS IN ALGEBRA I.N. HERSTEIN. Part II: Group Theory
Solutions to TOPICS IN ALGEBRA I.N. HERSTEIN Part II: Group Theory No rights reserved. Any part of this work can be reproduced or transmitted in any form or by any means. Version: 1.1 Release: Jan 2013
Degrees of Truth: the formal logic of classical and quantum probabilities as well as fuzzy sets.
Degrees of Truth: the formal logic of classical and quantum probabilities as well as fuzzy sets. Logic is the study of reasoning. A language of propositions is fundamental to this study as well as true
Lemma 5.2. Let S be a set. (1) Let f and g be two permutations of S. Then the composition of f and g is a permutation of S.
Definition 51 Let S be a set bijection f : S S 5 Permutation groups A permutation of S is simply a Lemma 52 Let S be a set (1) Let f and g be two permutations of S Then the composition of f and g is a
OutsideIn(X) Modular type inference with local assumptions
Under consideration for publication in J. Functional Programming 1 OutsideIn(X) Modular type inference with local assumptions 11 April 2011 Dimitrios Vytiniotis Microsoft Research Simon Peyton Jones Microsoft
Online Convex Optimization
E0 370 Statistical Learning heory Lecture 19 Oct 22, 2013 Online Convex Optimization Lecturer: Shivani Agarwal Scribe: Aadirupa 1 Introduction In this lecture we shall look at a fairly general setting
Object-Oriented Type Inference
Object-Oriented Type Inference Jens Palsberg and Michael I Schwartzbach palsberg@daimiaaudk and mis@daimiaaudk Computer Science Department, Aarhus University Ny Munkegade, DK-8000 Århus C, Denmark Abstract
MATHEMATICAL INDUCTION. Mathematical Induction. This is a powerful method to prove properties of positive integers.
MATHEMATICAL INDUCTION MIGUEL A LERMA (Last updated: February 8, 003) Mathematical Induction This is a powerful method to prove properties of positive integers Principle of Mathematical Induction Let P
