CIS 500 Software Foundations Fall October. CIS 500, 6 October 1

Similar documents
CS792 Notes Henkin Models, Soundness and Completeness

Strong normalisation and the typed lambda calculus

A Translation of Intersection and Union Types

Typed Lambda Calculi Lecture Notes

Notes on Natural Logic

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages

In this lecture, we will use the semantics of our simple language of arithmetic expressions,

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages

Brief Notes on the Category Theoretic Semantics of Simply Typed Lambda Calculus

Untyped Lambda Calculus

arxiv: v1 [math.lo] 24 Feb 2014

Matching [for] the Lambda Calculus of Objects

CS 4110 Programming Languages and Logics Lecture #2: Introduction to Semantics. 1 Arithmetic Expressions

Tableau Theorem Prover for Intuitionistic Propositional Logic

Tableau Theorem Prover for Intuitionistic Propositional Logic

How not to prove Strong Normalisation

2 Deduction in Sentential Logic

Syllogistic Logics with Verbs

Semantics with Applications 2b. Structural Operational Semantics

DOT. (Dependent Object Types) Nada Amin. February 28, ECOOP PC Workshop

École normale supérieure, MPRI, M2 Year 2007/2008. Course 2-6 Abstract interpretation: application to verification and static analysis P.

Lecture Notes on Type Checking

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages

Proof Techniques for Operational Semantics

α-structural Recursion and Induction

Cut-free sequent calculi for algebras with adjoint modalities

Development Separation in Lambda-Calculus

Matching of Meta-Expressions with Recursive Bindings

Syllogistic Logics with Verbs

A semantics for concurrent permission logic. Stephen Brookes CMU

Proof Techniques for Operational Semantics

Unary PCF is Decidable


A CATEGORICAL FOUNDATION FOR STRUCTURED REVERSIBLE FLOWCHART LANGUAGES: SOUNDNESS AND ADEQUACY

Development Separation in Lambda-Calculus

TABLEAU-BASED DECISION PROCEDURES FOR HYBRID LOGIC

The Role of Human Creativity in Mechanized Verification. J Strother Moore Department of Computer Science University of Texas at Austin

Lecture Notes on Bidirectional Type Checking

Operational Semantics

A Formally Verified Interpreter for a Shell-like Programming Language

HW 1 Reminder. Principles of Programming Languages. Lets try another proof. Induction. Induction on Derivations. CSE 230: Winter 2007

TEST 1 SOLUTIONS MATH 1002

Introduction to Type Theory August 2007 Types Summer School Bertinoro, It. Herman Geuvers Nijmegen NL. Lecture 3: Polymorphic λ-calculus

5 Deduction in First-Order Logic

Monadic translation of sequent calculus for classical logic

Programming Languages

On Isomorphism of Dependent Products in a Typed Logical Framework

Microeconomics of Banking: Lecture 5

Introduction An example Cut elimination. Deduction Modulo. Olivier Hermant. Tuesday, December 12, Deduction Modulo

}w!"#$%&'()+,-./012345<ya FI MU. A Calculus of Coercive Subtyping. Faculty of Informatics Masaryk University Brno

A Syntactic Realization Theorem for Justification Logics

Lecture 2: The Simple Story of 2-SAT

0.1 Equivalence between Natural Deduction and Axiomatic Systems

A Knowledge-Theoretic Approach to Distributed Problem Solving

Discrete Mathematics for CS Spring 2008 David Wagner Final Exam

Orthogonality to the value group is the same as generic stability in C-minimal expansions of ACVF

Semantic Types for Classes and Mixins

AN ESTIMATION FOR THE LENGTHS OF REDUCTION SEQUENCES

Two Notions of Sub-behaviour for Session-based Client/Server Systems

CS 6110 S11 Lecture 8 Inductive Definitions and Least Fixpoints 11 February 2011

A Type System For Safe SN Resource Allocation

Semantics and Verification of Software

The Subjective and Personalistic Interpretations

Threshold logic proof systems

Characterisation of Strongly Normalising λµ-terms

The Real Numbers. Here we show one way to explicitly construct the real numbers R. First we need a definition.

Conditional Rewriting

SAT and DPLL. Introduction. Preliminaries. Normal forms DPLL. Complexity. Espen H. Lian. DPLL Implementation. Bibliography.

Subject Reduction and Minimal Types for Higher Order Subtyping

Parametricity, Type Equality and Higher-order Polymorphism

Modelling session types using contracts 1

SAT and DPLL. Espen H. Lian. May 4, Ifi, UiO. Espen H. Lian (Ifi, UiO) SAT and DPLL May 4, / 59

Isabelle/HOLCF Higher-Order Logic of Computable Functions

Supplementary Material for Combinatorial Partial Monitoring Game with Linear Feedback and Its Application. A. Full proof for Theorems 4.1 and 4.

A language for access control

Type Structures and Normalization by Evaluation for System F ω

Proof Techniques for Operational Semantics. Questions? Why Bother? Mathematical Induction Well-Founded Induction Structural Induction

CATEGORICAL SKEW LATTICES

Practical SAT Solving

Designing efficient market pricing mechanisms

Fundamentals of Logic

Formal Techniques for Software Engineering: More on Denotational Semantics

Logic and Artificial Intelligence Lecture 24

CS 4110 Programming Languages & Logics. Lecture 2 Introduction to Semantics

AUTOSUBST: Automation for de Bruijn Substitutions

A Decidable Logic for Time Intervals: Propositional Neighborhood Logic

Gödel algebras free over finite distributive lattices

Matching of Meta-Expressions with Recursive Bindings

Fractional Graphs. Figure 1

Sy D. Friedman. August 28, 2001

Semantics of an Intermediate Language for Program Transformation

MAT25 LECTURE 10 NOTES. = a b. > 0, there exists N N such that if n N, then a n a < ɛ

Maximum Contiguous Subsequences

COMBINATORICS OF REDUCTIONS BETWEEN EQUIVALENCE RELATIONS

UPWARD STABILITY TRANSFER FOR TAME ABSTRACT ELEMENTARY CLASSES

Tug of War Game. William Gasarch and Nick Sovich and Paul Zimand. October 6, Abstract

The Floyd-Warshall Algorithm for Shortest Paths

Expected Utility And Risk Aversion

Lecture 5: Tuesday, January 27, Peterson s Algorithm satisfies the No Starvation property (Theorem 1)

Chapter 3 Common Families of Distributions. Definition 3.4.1: A family of pmfs or pdfs is called exponential family if it can be expressed as

Transcription:

CIS 500 Software Foundations Fall 2004 6 October CIS 500, 6 October 1

Midterm 1 is next Wednesday Today s lecture will not be covered by the midterm. Next Monday, review class. Old exams and review questions on webpage. No recitation sections next week. New office hours next week, watch newsgroup for details. CIS 500, 6 October 2

Plans Where we ve been: Inductive definitions abstract syntax inference rules Proofs by structural induction Operational semantics The lambda-calculus Typing rules and type soundness CIS 500, 6 October 3

Plans Where we ve been: Inductive definitions abstract syntax inference rules Proofs by structural induction Operational semantics The lambda-calculus Typing rules and type soundness Where we re going: Simple types for the lambda-calculus Formalizing more features of real-world languages (records, datatypes, references, exceptions, etc.) Subtyping Objects CIS 500, 6 October 3-a

The Simply Typed Lambda-Calculus CIS 500, 6 October 4

Lambda-calculus with booleans t ::= terms x λx.t t t true false if t then t else t variable abstraction application constant true constant false conditional v ::= values λx.t true false abstraction value true value false value CIS 500, 6 October 5

Simple Types T ::= types Bool T T type of booleans types of functions CIS 500, 6 October 6

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) CIS 500, 6 October 7

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 (T-Var) CIS 500, 6 October 7-a

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 Γ Γ x : T (T-True) (T-False) (T-If) (T-Var) CIS 500, 6 October 7-b

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 Γ Γ x : T (T-True) (T-False) (T-If) (T-Var) CIS 500, 6 October 7-c

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 Γ Γ x : T Γ, x:t 1 t 2 : T 2 Γ λx:t 1.t 2 : T 1 T 2 (T-True) (T-False) (T-If) (T-Var) (T-Abs) CIS 500, 6 October 7-d

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 Γ Γ x : T Γ, x:t 1 t 2 : T 2 Γ λx:t 1.t 2 : T 1 T 2 (T-True) (T-False) (T-If) (T-Var) (T-Abs) Γ t 1 : T 11 T 12 Γ t 2 : T 11 Γ t 1 t 2 : T 12 (T-App) CIS 500, 6 October 7-e

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 CIS 500, 6 October 8

Properties of λ As before, the fundamental property of the type system we have just defined is soundness with respect to the operational semantics. CIS 500, 6 October 9

Properties of λ As before, 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. CIS 500, 6 October 9-a

Same steps as before... Proving progress CIS 500, 6 October 10

Same steps as before... Proving progress inversion lemma for typing relation canonical forms lemma progress theorem CIS 500, 6 October 10-a

Typing rules again (for reference) Γ 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 Γ Γ x : T Γ, x:t 1 t 2 : T 2 Γ λx:t 1.t 2 : T 1 T 2 (T-True) (T-False) (T-If) (T-Var) (T-Abs) Γ t 1 : T 11 T 12 Γ t 2 : T 11 Γ t 1 t 2 : T 12 (T-App) CIS 500, 6 October 11

Lemma: Inversion 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. CIS 500, 6 October 12

Lemma: Inversion 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 CIS 500, 6 October 12-a

Lemma: Inversion 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 Γ. CIS 500, 6 October 12-b

Lemma: Inversion 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 CIS 500, 6 October 12-c

Lemma: Inversion 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. CIS 500, 6 October 12-d

Lemma: Inversion 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. 6. If Γ t 1 t 2 : R, then CIS 500, 6 October 12-e

Lemma: Inversion 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. 6. 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. CIS 500, 6 October 12-f

Lemma: Canonical Forms CIS 500, 6 October 13

Lemma: Canonical Forms 1. If v is a value of type Bool, then CIS 500, 6 October 13-a

Lemma: Canonical Forms 1. If v is a value of type Bool, then v is either true or false. CIS 500, 6 October 13-b

Lemma: Canonical Forms 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 CIS 500, 6 October 13-c

Lemma: Canonical Forms 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. CIS 500, 6 October 13-d

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 CIS 500, 6 October 14

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. CIS 500, 6 October 14-a

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. CIS 500, 6 October 14-b

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 : T 11. t 2 with t 1 : T 11 T 12 and CIS 500, 6 October 14-c

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. CIS 500, 6 October 14-d

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. CIS 500, 6 October 14-e

Proving Preservation Theorem: If Γ t : T and t t, then Γ t : T. Proof: By induction CIS 500, 6 October 15

Proving Preservation Theorem: If Γ t : T and t t, then Γ t : T. Proof: By induction on typing derivations. [Which case is the hard one?] CIS 500, 6 October 15-a

Proving Preservation Theorem: If Γ t : T and t t, then Γ t : T. Proof: By induction on typing derivations. [Which case is the hard one?] 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 CIS 500, 6 October 15-b

Proving Preservation Theorem: If Γ t : T and t t, then Γ t : T. Proof: By induction on typing derivations. [Which case is the hard one?] 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... CIS 500, 6 October 15-c

Proving Preservation Theorem: If Γ t : T and t t, then Γ t : T. Proof: By induction on typing derivations. [Which case is the hard one?] 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... Subcase: t 1 = λx:t 11. t 12 t 2 a value v 2 t = [x v 2 ]t 12 CIS 500, 6 October 15-d

Proving Preservation Theorem: If Γ t : T and t t, then Γ t : T. Proof: By induction on typing derivations. [Which case is the hard one?] 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... Subcase: t 1 = λx:t 11. t 12 Uh oh. t 2 a value v 2 t = [x v 2 ]t 12 CIS 500, 6 October 15-e

The Substitution Lemma Lemma: Types are preserved under substitition. If Γ, x:s t : T and Γ s : S, then Γ [x s]t : T. CIS 500, 6 October 16

The Substitution Lemma Lemma: Types are preserved under substitition. If Γ, x:s t : T and Γ s : S, then Γ [x s]t : T. Proof:... CIS 500, 6 October 16-a

On to real programming languages... CIS 500, 6 October 17

The Unit type t ::=... terms unit constant unit v ::=... values unit constant unit T ::=... types Unit unit type New typing rules Γ t : T Γ unit : Unit (T-Unit) CIS 500, 6 October 18

Sequencing t ::=... terms t 1 ;t 2 CIS 500, 6 October 19

Sequencing t ::=... terms t 1 ;t 2 t 1 t 1 t 1 ;t 2 t 1;t 2 (E-Seq) unit;t 2 t 2 (E-SeqNext) Γ t 1 : Unit Γ t 2 : T 2 Γ t 1 ;t 2 : T 2 (T-Seq) CIS 500, 6 October 19-a

Syntatic sugar Derived forms Internal language vs. external (surface) language CIS 500, 6 October 20

Sequencing as a derived form t 1 ;t 2 def = (λx:unit.t 2 ) t 1 where x / FV(t 2 ) CIS 500, 6 October 21

Equivalence of the two definitions [board] CIS 500, 6 October 22

Ascription New syntactic forms t ::=... terms t as T ascription New evaluation rules t t v 1 as T v 1 (E-Ascribe) t 1 t 1 t 1 as T t 1 as T (E-Ascribe1) New typing rules Γ t : T Γ t 1 : T Γ t 1 as T : T (T-Ascribe) CIS 500, 6 October 23

Ascription as a derived form t as T def = (λx:t. x) t CIS 500, 6 October 24

Let-bindings New syntactic forms t ::=... terms let x=t in t let binding New evaluation rules t t let x=v 1 in t 2 [x v 1 ]t 2 (E-LetV) New typing rules t 1 t 1 let x=t 1 in t 2 let x=t 1 in t 2 (E-Let) Γ t : T Γ t 1 : T 1 Γ, x:t 1 t 2 : T 2 Γ let x=t 1 in t 2 : T 2 (T-Let) CIS 500, 6 October 25

Pairs t ::=... terms {t,t} pair t.1 first projection t.2 second projection v ::=... values {v,v} pair value T ::=... types T 1 T 2 product type CIS 500, 6 October 26

Evaluation rules for pairs {v 1,v 2 }.1 v 1 (E-PairBeta1) {v 1,v 2 }.2 v 2 (E-PairBeta2) t 1 t 1 t 1.1 t 1.1 t 1 t 1 t 1.2 t 1.2 t 1 t 1 {t 1,t 2 } {t 1,t 2 } t 2 t 2 {v 1,t 2 } {v 1,t 2} (E-Proj1) (E-Proj2) (E-Pair1) (E-Pair2) CIS 500, 6 October 27

Typing rules for pairs Γ t 1 : T 1 Γ t 2 : T 2 Γ {t 1,t 2 } : T 1 T 2 (T-Pair) Γ t 1 : T 11 T 12 Γ t 1.1 : T 11 (T-Proj1) Γ t 1 : T 11 T 12 Γ t 1.2 : T 12 (T-Proj2) CIS 500, 6 October 28

Tuples t ::=... terms i 1..n {t i } tuple t.i projection v ::=... values {v i i 1..n } tuple value T ::=... types {T i i 1..n } tuple type CIS 500, 6 October 29

Evaluation rules for tuples {v i i 1..n }.j v j (E-ProjTuple) t 1 t 1 t 1.i t 1.i (E-Proj) t j t j {v i i 1..j 1,t j,t k k j+1..n } {v i i 1..j 1,t j,t k k j+1..n } (E-Tuple) CIS 500, 6 October 30

Typing rules for tuples for each i Γ t i : T i Γ {t i i 1..n } : {T i i 1..n } (T-Tuple) Γ t 1 : {T i i 1..n } Γ t 1.j : T j (T-Proj) CIS 500, 6 October 31

Records t ::=... terms i 1..n {l i =t i } record t.l projection v ::=... values {l i =v i i 1..n } record value T ::=... types {l i :T i i 1..n } type of records CIS 500, 6 October 32

Evaluation rules for records {l i =v i i 1..n }.l j v j (E-ProjRcd) t 1 t 1 t 1.l t 1.l (E-Proj) t j t j {l i =v i i 1..j 1,l j =t j,l k =t k k j+1..n } {l i =v i i 1..j 1,l j =t j,l k =t k k j+1..n } (E-Rcd) CIS 500, 6 October 33

Typing rules for records for each i Γ t i : T i Γ {l i =t i i 1..n } : {l i :T i i 1..n } (T-Rcd) Γ t 1 : {l i :T i i 1..n } Γ t 1.l j : T j (T-Proj) CIS 500, 6 October 34

Discussion CIS 500, 6 October 35

Intro vs. elim forms An introduction form for a given type gives us a way of constructing elements of this type. An elimination form for a type gives us a way of using elements of this type. What typing rules are introduction forms? What are elimination forms? CIS 500, 6 October 36

The Curry-Howard Correspondence In constructive logics, a proof of P must provide evidence for P. law of the excluded middle P P not recognized. A proof of P Q is a pair of evidence for P and evidence for Q. A proof of P Q is a procedure for transforming evidence for P into evidence for Q. CIS 500, 6 October 37

Propositions as Types Logic propositions proposition P Q proposition P Q proof of proposition P proposition P is provable Programming languages types type P Q type P Q term t of type P type P is inhabited (by some term) CIS 500, 6 October 38

Propositions as Types Logic propositions proposition P Q proposition P Q proof of proposition P proposition P is provable Programming languages types type P Q type P Q term t of type P type P is inhabited (by some term) evaluation CIS 500, 6 October 38-a

Propositions as Types Logic propositions proposition P Q proposition P Q proof of proposition P proposition P is provable proof simplification (a.k.a. cut elimination ) Programming languages types type P Q type P Q term t of type P type P is inhabited (by some term) evaluation CIS 500, 6 October 38-b

Erasure erase(x) = x erase(λx:t 1. t 2 ) = λx. erase(t 2 ) erase(t 1 t 2 ) = erase(t 1 ) erase(t 2 ) CIS 500, 6 October 39

Typability An untyped λ-term m is said to be typable if there is some term t in the simply typed lambda-calculus, some type T, and some context Γ such that erase(t) = m and Γ t : T. Cf. type reconstruction in OCaml. CIS 500, 6 October 40