Lecture 3: Typed Lambda Calculus and Curry-Howard
|
|
- Kristopher Jordan
- 5 years ago
- Views:
Transcription
1 Lecture 3: Typed Lambda Calculus and Curry-Howard H. Geuvers Radboud University Nijmegen, NL 21st Estonian Winter School in Computer Science Winter 2016 H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 1 / 65
2 Outline H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 2 / 65
3 Typed λ calculus as a basis for logic Aim: λ-term : type M : A program : data type proof : formula program : (full) specification Type Theory as an integrated system for proving and programming. Type Theory as a basis for proof assistants and interactive theorem proving. H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 3 / 65
4 Simple type theory Simplest system: λ or simple type theory, STT. Just arrow types Typ := TVar (Typ Typ) Examples: (α β) α, (α β) ((β γ) (α γ)) Brackets associate to the right and outside brackets are omitted: (α β) (β γ) α γ Types are denoted by A, B,.... H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 4 / 65
5 Simple type theory à la Church Formulation with contexts to declare the free variables: x 1 : A 1, x 2 : A 2,..., x n : A n is a context, usually denoted by Γ. Derivation rules of λ (à la Church): x:a Γ Γ x : A Γ M : A B Γ M N : B Γ N : A Γ, x:a P : B Γ λx:a.p : A B Γ λ M : A if there is a derivation using these rules with conclusion Γ M : A H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 5 / 65
6 Examples λx : A.λy : B.x : A B A λx : A B.λy : B C.λz : A.y (x z) : (A B) (B C) A C λx : A.λy : (B A) A.y(λz : B.x) : A ((B A) A) A Not for every type there is a closed term of that type: (A A) A is not inhabited That is: there is no term M such that M : (A A) A. H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 6 / 65
7 Typed Terms versus Type Assignment With typed terms also called typing à la Church, we have terms with type information in the λ-abstraction λx : A.x : A A Terms have unique types, The type is directly computed from the type info in the variables. With typed assignment also called typing à la Curry, we assign types to untyped λ-terms λx.x : A A Terms do not have unique types, A principal type can be computed using unification. H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 7 / 65
8 Church vs. Curry typing The Curry formulation is especially interesting for programming: you want to write as little type information as possible; let the compiler infer the types for you. The Church formulation is especially interesting for proof checking: terms are created interactively; type structure is so intricate that type inference is undecidable (if you start from an untyped term). [ This lecture] H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 8 / 65
9 Formulas-as-Types (Curry, Howard) Recall: there are two readings of a judgement M : A 1 term as algorithm/program, type as specification: M is a function of type A 2 type as a proposition, term as its proof: M is a proof of the proposition A There is a one-to-one correspondence: typable terms in λ derivations in minimal proposition logic x 1 : B 1, x 2 : B 2,..., x n : B n M : A can be read as M is a proof of A from the assumptions B 1, B 2,..., B n. H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 9 / 65
10 Example [A B C] 3 [A] 1 [A B] 2 [A] 1 B C B C 1 A C 2 (A B) A C 3 (A B C) (A B) A C λx:a B C.λy:A B.λz:A.x z (y z) : (A B C) (A B) A C H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 10 / 65
11 Example [x : A B C] 3 [z : A] 1 [y : A B] 2 [z : A] 1 x z : B C y z : B x z (y z) : C 1 λz:a.x z (y z) : A C 2 λy:a B.λz:A.x z (y z) : (A B) A C λx:a B C.λy:A B.λz:A.x z (y z) : (A B C) (A B) A C 3 Exercise: Give the derivation that corresponds to λx:c E.λy:(C E) E.y(λz.y x) : (C E) ((C E) E) E H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 11 / 65
12 Typed Combinatory Logic We have seen Combinatory Logic with the axioms for I, K and S. We now know their typed definition in λ : I := λx : A.x : A A K := λx : A.λy : B.x : A B A S := λx:a B C.λy:A B.λz:A.x z (y z) : (A B C) (A B) A C The three axiom schemes A A, A B A and (A B C) (A B) A C together with the derivation rule Modus Ponens is exactly Hilbert style minimal proposition logic. The typed CL terms are exactly the derivations in this logic. Modus Ponens corresponds with Application in CL Exercise: Show that the scheme A A is derivable. Cast in CL terminology: I can be defined in terms of S and K. To be precise: I = S K K. H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 12 / 65
13 Computation = Cut-elimination β-reduction: (λx:a.m)p β M[x := P] Cut-elimination in minimal logic = β-reduction in λ. [A] 1 D 1 B 1 A B B [x : A] 1 D 1 M : B 1 λx:a.m : A B (λx:a.m)p : B D 2 A D 2 P : A D 2 A D 1 B β D 2 P : A D 1 M[x := P] : B H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 13 / 65
14 Example Proof of A A B, (A B) A B with a cut. [A] 1 A A B [A] 1 A B B A B (A B) A It contains a cut: a -i directly followed by an -e. B [A] 1 A A B [A] 1 A B A B A B H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 14 / 65
15 Example proof with term information [y : A] 1 p : A A B [y : A] 1 p y : A B [x : A] 1 p : A A [x : A] 1 p x : A B p x x : B p y y : B q : (A B) A λx:a.p x x : A B λy:a.p y y : A B q(λx:a.p x x) : A (λy:a.p y y)(q(λx:a.p x x)) : B Term contains a β-redex: (λx:a.p x x) (q(λx:a.p x x)) H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 15 / 65
16 Extension with other connectives Adding product types to λ. (Proposition logic with conjunction.) Γ M : A B Γ π 1 M : A With reduction rules Γ M : A B Γ π 2 M : B π 1 P, Q P π 2 P, Q Q Γ P : A Γ Q : B Γ P, Q : A B Similar rules can be given for sum-types A + B, corresponding to disjunction A B. H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 16 / 65
17 Extension to predicate logic First order language: domain D, with variables x, y, z : D and possibly functions over D, e.g. f : D D, g : D D D. Rules for x:d.φ and x:d.φ. NB There are two kinds of variables: the first order variables (ranging over the domain D) and the proof variables (used as [local] assumptions of formulas). Formulas and domain are both types. What is the type of a predicate or relation? A predicate P is a map from D to the collection of types, P : D for P a predicate and R : D D for R a binary relation on D. We will have to make this more precise... H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 17 / 65
18 Idea of extending to Term rules for the -quantifier in predicate logic. Γ M : x:d.a if t : D Γ M t : A[x := t] With the usual β-reduction rule Γ M : A x not free in Γ Γ λx:d.m : x:d.a (λx:d.m)t M[x := t]. This conforms with cut-elimination (or detour elimination ) on logical derivations. H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 18 / 65
19 Example Deriving irreflexivity from anti-symmetry AntiSym R := x, y:d.(rxy) (Ryx) Irrefl R := x:d.(rxx) Derivation in predicate logic: x, y:d.r x y R y x y:d.r x y R y x R x x R x x [R x x] 1 R x x [R x x] 1 1 R x x x:d.r x x H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 19 / 65
20 Example derivation in type theory, with terms H : x, y:d.r x y R y x H x : y:d.r x y R y x H x x : R x x R x x [H : R x x] 1 H x x H : R x x [H : R x x] 1 H x x H H : 1 λh :(R x x).h x x H H : R x x λx:a.λh :(R x x).h x x H H : x:d.r x x H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 20 / 65
21 Dependent Type Theory We have seen informally dependent types at work in the predicate logic example. Now: the rules With dependent types: everything depends on everything we can t first define the types, then the terms two universes: and is the universe of types We can t have :, so we have another universe: :. NB The Coq system uses Set and Prop for what I call and Type for what I call. H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 21 / 65
22 First order Dependent Type theory, λp Derive judgements of the form Γ M : B Γ is a context x 1 : B 1, x 2 : B 2,..., x n : B n M and B are terms taken from the set of pseudoterms T ::= Var (T T) (λx:t.t) Πx:T.T Auxiliary judgement Γ denoting that Γ is a correct context. H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 22 / 65
23 Derivation rules of λp s ranges over {, }. (base) (ctxt) Γ A : s Γ, x:a if x not in Γ (ax) Γ Γ : Γ (proj) Γ x : A if x:a Γ Γ A : Γ, x:a B : s (Π) Γ Πx:A.B : s Γ, x:a M : B Γ Πx:A.B : s (λ) Γ λx:a.m : Πx:A.B (conv) Γ M : B Γ A : s A = βη B Γ M : A Notation: write A B for Πx:A.B if x / FV(B). (app) Γ M : Πx:A.B Γ N : A Γ MN : B[x := N] H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 23 / 65
24 The use of the Π-type The Π rule allows to form two forms of function types. Γ, x:a B : s Γ A : (Π) Γ Πx:A.B : s Πx:A.B {f a : A(f a : B[x := a])} Write A B if x / FV(B) With s =, we can form D D and Πx:D.x = x, etc. With s =, we can form D D and D. H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 24 / 65
25 Representation of PRED (minimal predicate logic) into λp Represent both the domains of the logic and the formulas as types. A :, P : A, R : A A, Now implication is represented as and is represented as Π: x:a.p x Πx:A.P x Intro and elim rules are just λ-abstraction and application H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 25 / 65
26 Example A :, R : A A λz:a.λh:(πx, y:a.r x y).h z z : Πz:A.(Πx, y:a.r x y) R z z This term is a proof of z:a.( x, y:a.r(x, y)) R(z, z) Exercise: Find terms of the following types (NB binds strongest) and (Πx:A.P x Q x) (Πx:A.P x) Πx:A.Q x (Πx:A.P x Πz.R z z) (Πx:A.P x) Πz:A.R z z). Also write down the contexts in which these terms are typed. H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 26 / 65
27 Direct embedding of logic in type theory For λ and λp we have seen Direct representations of logic in type theory. Connectives each have a counterpart in the type theory: implication -type universal quantification -type Logical rules have their direct counterpart in type theory λ-abstraction -introduction application - elimination λ-abstraction -introduction application -elimination Context declares signature, local varibales and assumptions. H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 27 / 65
28 LF embedding of logic in type theory Second way of interpreting logic in type theory De Bruijn: Logical framework encoding of logic in type theory. Type theory used as a meta system for encoding ones own logic. Choose an appropriate context Γ L, in which the logic L (including its proof rules) is declared. Context used as a signature for the logic. Use the type system as the meta calculus for dealing with substitution and binding. H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 28 / 65
29 Direct and LF embedding proof formula direct embedding λx:a.x A A LF embedding imp intr A A λx:t A.x T (A A) Direct representation: One type system : One logic, Logical rules type theoretic rules LF encoding One type system : Many logics, Logical rules context declarations H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 29 / 65
30 Examples of the Deep embedding The encoding of logics in a logical framework is shown by three examples: 1 Minimal proposition logic 2 Minimal predicate logic (just {, }) 3 Untyped λ-calculus H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 30 / 65
31 Minimal propositional logic Fix the signature (context) of minimal propositional logic. prop : imp : prop prop prop Notation: A B for imp A B The type prop is the type of names of propositions. NB : A term of type propcan not be inhabited (proved), as it is not a type. We lift a name p : prop to the type of its proofs by introducing the following map: T : prop. Intended meaning of Tp is the type of proofs of p. We interpret p is valid by Tp is inhabited. H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 31 / 65
32 Encoding of derivations To derive Tp we also encode the logical derivation rules imp intr : Πp, q : prop.(tp Tq) T(p q), imp el : Πp, q : prop.t(p q) Tp Tq. New phenomenon: Π-type: Πx:A.B(x) the type of functions f such that f a : B(a) for all a:a imp intr takes two (names of) propositions p and q and a term f : T p T q and returns a term of type T(p q) Indeed A A, becomes valid: imp intra A(λx:T A.x) : T(A A) Exercise: Construct a term of type T(A (B A)) H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 32 / 65
33 Signature of PROP in LF To encode proposition logic in LF we need a context (signature) Σ PROP : prop : : prop prop prop T : prop imp intr : (A, B : prop)(t A T B) T(A B) imp el : (A, B : prop)t(a B) T A T B. Desired properties of the encoding: Adequacy (soundness) of the encoding: PROP A = Σ PROP, a 1 :prop,..., a n :prop p : T A for some {a,..., a n } is the set of proposition variables in A. Faithfulness (or completeness) is the converse. It also holds, but more involved to prove. H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 33 / 65
34 Minimal predicate logic over one domain A Signature: prop :, A :, T : prop f : A A, R : A A prop, : prop prop prop, imp intr : Πp, q : prop.(tp Tq) T(p q), imp el : Πp, q : prop.t(p q) Tp Tq. Now encode : takes a P : A prop and returns a proposition, so we add: : (A prop) prop H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 34 / 65
35 Minimal predicate logic over one domain A Signature: Σ PRED prop :, A :,. imp intr : Πp, q : prop.(tp Tq) T(p q), imp el : Πp, q : prop.t(p q) Tp Tq. Now encode : takes a P : A prop and returns a proposition, so: : (A prop) prop Universal quantification is translated as follows. x:a.(px) (λx:a.(px)) H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 35 / 65
36 Intro and Elim rules for : (A prop) prop, intr : ΠP:A prop.(πx:a.t(px)) T( P), elim : ΠP:A prop.t( P) Πx:A.T(Px). The proof of z:a( x, y:a.rxy) Rzz is now mirrored by the proof-term intr[ ]( λz:a.imp intr[ ][ ](λh:t( x, y:a.rxy). elim[ ]( elim[ ]hz)z) ) We have replaced the instantiations of the Π-type by [ ]. This term is of type T( (λz:a.imp( (λx:a.( (λy:a.rxy))))(rzz))) H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 36 / 65
37 Intro and Elim rules for : (A prop) prop, intr : ΠP:A prop.(πx:a.t(px)) T( P), elim : ΠP:A prop.t( P) Πx:A.T(Px). The proof of z:a( x, y:a.rxy) Rzz is now mirrored by the proof-term intr[ ]( λz:a.imp intr[ ][ ](λh:t( x, y:a.rxy). elim[ ]( elim[ ]hz)z) ) Exercise: Construct a proof-term that mirrors the (obvious) proof of x(p x Q x) x.p x x.q x H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 37 / 65
38 Untyped λ-calculus Signature Σ lambda : D : ; app : D (D D); abs : (D D) D. A variable x in λ-calculus becomes x : D in the type system. The translation [ ] : Λ Term(D) is defined as follows. [x] = x; [PQ] = app [P] [Q]; [λx.p] = abs (λx:d.[p]). Examples: [λx.xx] := abs(λx:d.app x x) [(λx.xx)(λy.y)] := app(abs(λx:d.app x x))(abs(λy:d.y)). H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 38 / 65
39 Introducing β-equality Notation P = Q for eq P Q. Rules for proving equalities. refl : Πx:D.x = x, eq:d D. sym : Πx, y:d.x = y y = x, trans : Πx, y, z:d.x = y y = z x = z, mon : Πx, x, z, z :D.x = x z = z (app z x) = (app z x ), xi : Πf, g:d D.(Πx:D.(fx) = (gx)) (abs f ) = (abs g), beta : Πf :D D.Πx:D.(app(abs f )x) = (fx). H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 39 / 65
40 Properties of λp Uniqueness of types If Γ M : σ and Γ M : τ, then σ= βη τ. Subject Reduction If Γ M : σ and M βη N, then Γ N : σ. Strong Normalization If Γ M : σ, then all βη-reductions from M terminate. Proof of SN is by defining a reduction preserving map from λp to λ. H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 40 / 65
41 Decidability Questions Γ M : σ? TCP Γ M :? TSP Γ? : σ TIP For λp: TIP is undecidable TCP/TSP: simultaneously with Context checking H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 41 / 65
42 Curry-Howard-de Bruijn logic type theory formula type proof term detour elimination β-reduction proposition logic simply typed λ-calculus predicate logic dependently typed λ-calculus λp intuitionistic logic... + inductive types higher order logic... + higher types and polymorphism classical logic... + exceptions H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus 42 / 65
Introduction to Type Theory August 2007 Types Summer School Bertinoro, It. Herman Geuvers Nijmegen NL
Introduction to Type Theory August 2007 Types Summer School Bertinoro, It Herman Geuvers Nijmegen NL Lecture 2: Dependent Type Theory, Logical Framework 1 For λ : Direct representation (shallow embedding)
More informationLecture slides & distribution files:
Type Theory Lecture slides & distribution files: http://www.cs.rhul.ac.uk/home/zhaohui/ttlectures.html Zhaohui Luo Department of Computer Science Royal Holloway, University of London April 2011 2 Type
More informationTypes Summer School Gothenburg Sweden August Dogma oftype Theory. Everything has a type
Types Summer School Gothenburg Sweden August 2005 Formalising Mathematics in Type Theory Herman Geuvers Radboud University Nijmegen, NL Dogma oftype Theory Everything has a type M:A Types are a bit like
More informationCalculus of Inductive Constructions
Calculus of Inductive Constructions Software Formal Verification Maria João Frade Departmento de Informática Universidade do Minho 2008/2009 Maria João Frade (DI-UM) Calculus of Inductive Constructions
More informationLogical Verification Course Notes. Femke van Raamsdonk Vrije Universiteit Amsterdam
Logical Verification Course Notes Femke van Raamsdonk femke@csvunl Vrije Universiteit Amsterdam autumn 2008 Contents 1 1st-order propositional logic 3 11 Formulas 3 12 Natural deduction for intuitionistic
More informationIntroduction to dependent types in Coq
October 24, 2008 basic use of the Coq system In Coq, you can play with simple values and functions. The basic command is called Check, to verify if an expression is well-formed and learn what is its type.
More informationHOL DEFINING HIGHER ORDER LOGIC LAST TIME ON HOL CONTENT. Slide 3. Slide 1. Slide 4. Slide 2 WHAT IS HIGHER ORDER LOGIC? 2 LAST TIME ON HOL 1
LAST TIME ON HOL Proof rules for propositional and predicate logic Safe and unsafe rules NICTA Advanced Course Forward Proof Slide 1 Theorem Proving Principles, Techniques, Applications Slide 3 The Epsilon
More informationProgramming Language Concepts: Lecture 19
Programming Language Concepts: Lecture 19 Madhavan Mukund Chennai Mathematical Institute madhavan@cmi.ac.in http://www.cmi.ac.in/~madhavan/courses/pl2009 PLC 2009, Lecture 19, 01 April 2009 Adding types
More informationLambda Calculus and Type Inference
Lambda Calculus and Type Inference Björn Lisper Dept. of Computer Science and Engineering Mälardalen University bjorn.lisper@mdh.se http://www.idt.mdh.se/ blr/ August 17, 2007 Lambda Calculus and Type
More informationTyped Lambda Calculus
Department of Linguistics Ohio State University Sept. 8, 2016 The Two Sides of A typed lambda calculus (TLC) can be viewed in two complementary ways: model-theoretically, as a system of notation for functions
More informationTyped Lambda Calculus for Syntacticians
Department of Linguistics Ohio State University January 12, 2012 The Two Sides of Typed Lambda Calculus A typed lambda calculus (TLC) can be viewed in two complementary ways: model-theoretically, as a
More informationType Theory. Lecture 2: Dependent Types. Andreas Abel. Department of Computer Science and Engineering Chalmers and Gothenburg University
Type Theory Lecture 2: Dependent Types Andreas Abel Department of Computer Science and Engineering Chalmers and Gothenburg University Type Theory Course CM0859 (2017-1) Universidad EAFIT, Medellin, Colombia
More informationλ calculus is inconsistent
Content Rough timeline COMP 4161 NICTA Advanced Course Advanced Topics in Software Verification Gerwin Klein, June Andronick, Toby Murray λ Intro & motivation, getting started [1] Foundations & Principles
More informationHigher-Order Logic. Specification and Verification with Higher-Order Logic
Higher-Order Logic Specification and Verification with Higher-Order Logic Arnd Poetzsch-Heffter (Slides by Jens Brandt) Software Technology Group Fachbereich Informatik Technische Universität Kaiserslautern
More informationLesson 4 Typed Arithmetic Typed Lambda Calculus
Lesson 4 Typed Arithmetic Typed Lambda 1/28/03 Chapters 8, 9, 10 Outline Types for Arithmetic types the typing relation safety = progress + preservation The simply typed lambda calculus Function types
More informationA NEW PROOF-ASSISTANT THAT REVISITS HOMOTOPY TYPE THEORY THE THEORETICAL FOUNDATIONS OF COQ USING NICOLAS TABAREAU
COQHOTT A NEW PROOF-ASSISTANT THAT REVISITS THE THEORETICAL FOUNDATIONS OF COQ USING HOMOTOPY TYPE THEORY NICOLAS TABAREAU The CoqHoTT project Design and implement a brand-new proof assistant by revisiting
More informationCMSC 336: Type Systems for Programming Languages Lecture 5: Simply Typed Lambda Calculus Acar & Ahmed January 24, 2008
CMSC 336: Type Systems for Programming Languages Lecture 5: Simply Typed Lambda Calculus Acar & Ahmed January 24, 2008 Contents 1 Solution to the Exercise 1 1.1 Semantics for lambda calculus.......................
More informationToward explicit rewrite rules in the λπ-calculus modulo
Toward explicit rewrite rules in the λπ-calculus modulo Ronan Saillard (Olivier Hermant) Deducteam INRIA MINES ParisTech December 14th, 2013 1 / 29 Motivation Problem Checking, in a trustful way, that
More informationImporting HOL-Light into Coq
Outlines Importing HOL-Light into Coq Deep and shallow embeddings of the higher order logic into Coq Work in progress Chantal Keller chantal.keller@ens-lyon.fr Bejamin Werner benjamin.werner@inria.fr 2009
More informationCSE-321 Programming Languages 2010 Midterm
Name: Hemos ID: CSE-321 Programming Languages 2010 Midterm Score Prob 1 Prob 2 Prob 3 Prob 4 Total Max 15 30 35 20 100 1 1 SML Programming [15 pts] Question 1. [5 pts] Give a tail recursive implementation
More informationEmbedding logics in Dedukti
1 INRIA, 2 Ecole Polytechnique, 3 ENSIIE/Cedric Embedding logics in Dedukti Ali Assaf 12, Guillaume Burel 3 April 12, 2013 Ali Assaf, Guillaume Burel: Embedding logics in Dedukti, 1 Outline Introduction
More informationCSE-321 Programming Languages 2012 Midterm
Name: Hemos ID: CSE-321 Programming Languages 2012 Midterm Prob 1 Prob 2 Prob 3 Prob 4 Prob 5 Prob 6 Total Score Max 14 15 29 20 7 15 100 There are six problems on 24 pages in this exam. The maximum score
More informationThree Applications of Strictness in the Efficient Implementaton of Higher-Order Terms
Three Applications of Strictness in the Efficient Implementaton of Higher-Order Terms Frank Pfenning Workshop on Implementation of Logic Réunion Island, France November 11, 2000 Joint work with Carsten
More informationThe Typed λ Calculus and Type Inferencing in ML
Notes on Types S. Arun-Kumar Department of Computer Science and Engineering Indian Institute of Technology New Delhi, 110016 email: sak@cse.iitd.ernet.in April 14, 2002 2 Chapter 1 The Typed λ Calculus
More informationReducibility method: an overview
Reducibility method: an overview Silvia Ghilezan University of Novi Sad, Serbia LAP 2013, Dubrovnik, September 16-21, 2013 S. Ghilezan Reducibility method LAP 2013 1 / 35 In collaboration with (alphabetic
More informationProofs are Programs. Prof. Clarkson Fall Today s music: Proof by Paul Simon
Proofs are Programs Prof. Clarkson Fall 2017 Today s music: Proof by Paul Simon Review Previously in 3110: Functional programming in Coq Logic in Coq Today: A fundamental idea that goes by many names...
More informationLess naive type theory
Institute of Informatics Warsaw University 26 May 2007 Plan 1 Syntax of lambda calculus Why typed lambda calculi? 2 3 Syntax of lambda calculus Why typed lambda calculi? origins in 1930s (Church, Curry)
More informationCLF: A logical framework for concurrent systems
CLF: A logical framework for concurrent systems Thesis Proposal Kevin Watkins Carnegie Mellon University Committee: Frank Pfenning, CMU (Chair) Stephen Brookes, CMU Robert Harper, CMU Gordon Plotkin, University
More informationLambda Calculus and Type Inference
Lambda Calculus and Type Inference Björn Lisper Dept. of Computer Science and Engineering Mälardalen University bjorn.lisper@mdh.se http://www.idt.mdh.se/ blr/ October 13, 2004 Lambda Calculus and Type
More informationTopic 3: Propositions as types
Topic 3: Propositions as types May 18, 2014 Propositions as types We have seen that the main mathematical objects in a type theory are types. But remember that in conventional foundations, as based on
More informationCOMP 4161 NICTA Advanced Course. Advanced Topics in Software Verification. Toby Murray, June Andronick, Gerwin Klein
COMP 4161 NICTA Advanced Course Advanced Topics in Software Verification Toby Murray, June Andronick, Gerwin Klein λ 1 Last time... λ calculus syntax free variables, substitution β reduction α and η conversion
More informationSymmetry in Type Theory
Google May 29th, 2012 What is Symmetry? Definition Symmetry: Two or more things that initially look distinct, may actually be instances of a more general underlying principle. Why do we care? Simplicity.
More informationλ calculus Function application Untyped λ-calculus - Basic Idea Terms, Variables, Syntax β reduction Advanced Formal Methods
Course 2D1453, 2006-07 Advanced Formal Methods Lecture 2: Lambda calculus Mads Dam KTH/CSC Some material from B. Pierce: TAPL + some from G. Klein, NICTA Alonzo Church, 1903-1995 Church-Turing thesis First
More informationProgramming Languages
CSE 230: Winter 2008 Principles of Programming Languages Ocaml/HW #3 Q-A Session Push deadline = Mar 10 Session Mon 3pm? Lecture 15: Type Systems Ranjit Jhala UC San Diego Why Typed Languages? Development
More informationType Systems Winter Semester 2006
Type Systems Winter Semester 2006 Week 4 November 8 November 15, 2006 - version 1.1 The Lambda Calculus The lambda-calculus If our previous language of arithmetic expressions was the simplest nontrivial
More informationMLW. Henk Barendregt and Freek Wiedijk assisted by Andrew Polonsky. March 26, Radboud University Nijmegen
1 MLW Henk Barendregt and Freek Wiedijk assisted by Andrew Polonsky Radboud University Nijmegen March 26, 2012 inductive types 2 3 inductive types = types consisting of closed terms built from constructors
More informationBasic Foundations of Isabelle/HOL
Basic Foundations of Isabelle/HOL Peter Wullinger May 16th 2007 1 / 29 1 Introduction into Isabelle s HOL Why Type Theory Basic Type Syntax 2 More HOL Typed λ Calculus HOL Rules 3 Example proof 2 / 29
More informationLambda Calculus. Type Systems, Lectures 3. Jevgeni Kabanov Tartu,
Lambda Calculus Type Systems, Lectures 3 Jevgeni Kabanov Tartu, 13.02.2006 PREVIOUSLY ON TYPE SYSTEMS Arithmetical expressions and Booleans Evaluation semantics Normal forms & Values Getting stuck Safety
More informationMechanized metatheory revisited
Mechanized metatheory revisited Dale Miller Inria Saclay & LIX, École Polytechnique Palaiseau, France TYPES 2016, Novi Sad 25 May 2016 Theory vs Metatheory When formalizing programming languages, we often
More informationAn Introduction to Programming and Proving in Agda (incomplete draft)
An Introduction to Programming and Proving in Agda (incomplete draft) Peter Dybjer January 29, 2018 1 A first Agda module Your first Agda-file is called BoolModule.agda. Its contents are module BoolModule
More informationRefinement Types as Proof Irrelevance. William Lovas with Frank Pfenning
Refinement Types as Proof Irrelevance William Lovas with Frank Pfenning Overview Refinement types sharpen existing type systems without complicating their metatheory Subset interpretation soundly and completely
More informationCS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Dan Grossman Spring 2011
CS152: Programming Languages Lecture 11 STLC Extensions and Related Topics Dan Grossman Spring 2011 Review e ::= λx. e x e e c v ::= λx. e c τ ::= int τ τ Γ ::= Γ, x : τ (λx. e) v e[v/x] e 1 e 1 e 1 e
More informationThe three faces of homotopy type theory. Type theory and category theory. Minicourse plan. Typing judgments. Michael Shulman.
The three faces of homotopy type theory Type theory and category theory Michael Shulman 1 A programming language. 2 A foundation for mathematics based on homotopy theory. 3 A calculus for (, 1)-category
More informationCSE-321 Programming Languages 2011 Final
Name: Hemos ID: CSE-321 Programming Languages 2011 Final Prob 1 Prob 2 Prob 3 Prob 4 Prob 5 Prob 6 Total Score Max 15 15 10 17 18 25 100 There are six problems on 18 pages in this exam, including one extracredit
More informationSubsumption. Principle of safe substitution
Recap on Subtyping Subsumption Some types are better than others, in the sense that a value of one can always safely be used where a value of the other is expected. Which can be formalized as by introducing:
More informationProgramming Languages and Compilers (CS 421)
Programming Languages and Compilers (CS 421) Elsa L Gunter 2112 SC, UIUC http://courses.engr.illinois.edu/cs421 Based in part on slides by Mattox Beckman, as updated by Vikram Adve and Gul Agha 10/3/17
More informationProofs are Programs. Prof. Clarkson Fall Today s music: Two Sides to Every Story by Dyan Cannon and Willie Nelson
Proofs are Programs Prof. Clarkson Fall 2016 Today s music: Two Sides to Every Story by Dyan Cannon and Willie Nelson Review Currently in 3110: Advanced topics Futures Monads Today: An idea that goes by
More informationThe Truth about Types. Bartosz Milewski
The Truth about Types Bartosz Milewski Truth Truth Logic Types Categories Truth intro Unit type Terminal object true I () : () Proofs Logic Types Categories Proof of proposition A Type A is inhabited Morphism
More informationType Checking and Inference Are Equivalent in Lambda Calculi with Existential Types
Type Checking and Inference Are Equivalent in Lambda Calculi with Existential Types Yuki Kato and Koji Nakazawa Graduate School of Informatics, Kyoto University, Kyoto 606-8501, Japan Abstract. This paper
More informationComparing Cubes. Steffen van Bakel Luigi Liquori Simona Ronchi della Rocca Paweł Urzyczyn
Comparing Cubes Steffen van Bakel Luigi Liquori Simona Ronchi della Rocca Paweł Urzyczyn Afdeling Informatica, Universiteit Nijmegen, Toernooiveld 1, 6525 ED Nijmegen, Nederland. E-mail steffen@cs.kun.nl.
More information2.1 The λ-calculus Syntax
2- The λ-calculus 2. The λ-calculus In the previous section, we introduced the concepts of logic and proofs. We shall now present the notion of programs and computations through the so-called λ-calculus.
More informationOn a few open problems of the Calculus of Inductive Constructions and on their practical consequences
On a few open problems of the Calculus of Inductive Constructions and on their practical consequences Hugo Herbelin PPS, 24 September 2009 (updated May 2010) 1 Outline - From the Calculus of Constructions
More information1.3. Conditional expressions To express case distinctions like
Introduction Much of the theory developed in the underlying course Logic II can be implemented in a proof assistant. In the present setting this is interesting, since we can then machine extract from a
More informationSpecifying and Implementing Theorem Provers in a Higher-Order Logic Programming Language
Specifying and Implementing Theorem Provers in a Higher-Order Logic Programming Language Amy P. Felty A dissertation in Computer and Information Science Presented to the Faculties of the University of
More informationHIGHER-ORDER ABSTRACT SYNTAX IN TYPE THEORY
HIGHER-ORDER ABSTRACT SYNTAX IN TYPE THEORY VENANZIO CAPRETTA AND AMY P. FELTY Abstract. We develop a general tool to formalize and reason about languages expressed using higher-order abstract syntax in
More informationλ-calculus Lecture 1 Venanzio Capretta MGS Nottingham
λ-calculus Lecture 1 Venanzio Capretta MGS 2018 - Nottingham Table of contents 1. History of λ-calculus 2. Definition of λ-calculus 3. Data Structures 1 History of λ-calculus Hilbert s Program David Hilbert
More informationAn Implementation of the Language Lambda Prolog Organized around Higher-Order Pattern Unification
An Implementation of the Language Lambda Prolog Organized around Higher-Order Pattern Unification SUBMITTED TO THE FACULTY OF THE GRADUATE SCHOOL OF THE UNIVERSITY OF MINNESOTA BY Xiaochu Qi IN PARTIAL
More information11/6/17. Outline. FP Foundations, Scheme. Imperative Languages. Functional Programming. Mathematical Foundations. Mathematical Foundations
Outline FP Foundations, Scheme In Text: Chapter 15 Mathematical foundations Functional programming λ-calculus LISP Scheme 2 Imperative Languages We have been discussing imperative languages C/C++, Java,
More informationAxiom 3 Z(pos(Z) X(X intersection of Z P(X)))
In this section, we are going to prove the equivalence between Axiom 3 ( the conjunction of any collection of positive properties is positive ) and Proposition 3 ( it is possible that God exists ). First,
More informationBeluga: A Framework for Programming and Reasoning with Deductive Systems (System Description)
Beluga: A Framework for Programming and Reasoning with Deductive Systems (System Description) Brigitte Pientka and Joshua Dunfield McGill University, Montréal, Canada {bpientka,joshua}@cs.mcgill.ca Abstract.
More informationCSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter p. 1/27
CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 2.1-2.7 p. 1/27 CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer
More informationFormal Systems and their Applications
Formal Systems and their Applications Dave Clarke (Dave.Clarke@cs.kuleuven.be) Acknowledgment: these slides are based in part on slides from Benjamin Pierce and Frank Piessens 1 Course Overview Introduction
More informationThe Polymorphic Blame Calculus and Parametricity
1 / 31 The Polymorphic Blame Calculus and Parametricity Jeremy G. Siek Indiana University, Bloomington University of Strathclyde August 2015 2 / 31 Integrating static and dynamic typing Static Dynamic
More informationProofs-Programs correspondance and Security
Proofs-Programs correspondance and Security Jean-Baptiste Joinet Université de Lyon & Centre Cavaillès, École Normale Supérieure, Paris Third Cybersecurity Japanese-French meeting Formal methods session
More informationMikiβ : A General GUI Library for Visualizing Proof Trees
Mikiβ : A General GUI Library for Visualizing Proof Trees System Description and Demonstration Kanako Sakurai and Kenichi Asai Ochanomizu University, Japan {sakurai.kanako,asai}@is.ocha.ac.jp Abstract.
More informationSTABILITY AND PARADOX IN ALGORITHMIC LOGIC
STABILITY AND PARADOX IN ALGORITHMIC LOGIC WAYNE AITKEN, JEFFREY A. BARRETT Abstract. Algorithmic logic is the logic of basic statements concerning algorithms and the algorithmic rules of deduction between
More informationA Prolog-based Proof Tool for Type Theory TA λ and Implicational Intuitionistic-Logic
for Type Theory TA λ and Implicational Intuitionistic-Logic L. Yohanes Stefanus University of Indonesia Depok 16424, Indonesia yohanes@cs.ui.ac.id and Ario Santoso Technische Universität Dresden Dresden
More informationMathematics for Computer Scientists 2 (G52MC2)
Mathematics for Computer Scientists 2 (G52MC2) L07 : Operations on sets School of Computer Science University of Nottingham October 29, 2009 Enumerations We construct finite sets by enumerating a list
More informationCS 4110 Programming Languages & Logics. Lecture 28 Recursive Types
CS 4110 Programming Languages & Logics Lecture 28 Recursive Types 7 November 2014 Announcements 2 Foster office hours 11-12pm Guest lecture by Fran on Monday Recursive Types 3 Many languages support recursive
More informationCIS 500 Software Foundations Midterm I
CIS 500 Software Foundations Midterm I October 11, 2006 Name: Student ID: Email: Status: Section: registered for the course not registered: sitting in to improve a previous grade not registered: just taking
More informationFrom Types to Sets in Isabelle/HOL
From Types to Sets in Isabelle/HOL Extented Abstract Ondřej Kunčar 1 and Andrei Popescu 1,2 1 Fakultät für Informatik, Technische Universität München, Germany 2 Institute of Mathematics Simion Stoilow
More informationFirst-Class Type Classes
First-Class Type Classes Matthieu Sozeau Joint work with Nicolas Oury LRI, Univ. Paris-Sud - Démons Team & INRIA Saclay - ProVal Project Gallium Seminar November 3rd 2008 INRIA Rocquencourt Solutions for
More informationSets. Sets. Subset, universe. Specifying sets, membership. Examples: Specifying a set using a predicate. Examples
Sets 2/36 We will not give a precise definition of what is a set, but we will say precisely what you can do with it. Sets Lectures 7 and 8 (hapter 16) (Think of a set as a collection of things of which
More informationFoundations of AI. 9. Predicate Logic. Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution
Foundations of AI 9. Predicate Logic Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution Wolfram Burgard, Andreas Karwath, Bernhard Nebel, and Martin Riedmiller 09/1 Contents Motivation
More informationPolymorphism and System-F (OV)
Polymorphism and System-F (OV) Theorie der Programmierung SoSe 2014 FAU the occurrence of something in several different forms Polymorphism? Polymorphic systems Type systems that allow a single piece of
More informationTheorem proving. PVS theorem prover. Hoare style verification PVS. More on embeddings. What if. Abhik Roychoudhury CS 6214
Theorem proving PVS theorem prover Abhik Roychoudhury National University of Singapore Both specification and implementation can be formalized in a suitable logic. Proof rules for proving statements in
More informationOn Agda JAIST/AIST WS CVS/AIST Yoshiki Kinoshita, Yoriyuki Yamagata. Agenda
On Agda 2009.3.12 JAIST/AIST WS CVS/AIST Yoshiki Kinoshita, Yoriyuki Yamagata Agenda On Agda Agda as a programming language Agda as a proof system Further information. 2 1 Agenda On Agda Agda as a programming
More informationComputational Linguistics: Syntax-Semantics Interface
Computational Linguistics: Syntax-Semantics Interface Raffaella Bernardi KRDB, Free University of Bozen-Bolzano P.zza Domenicani, Room: 2.28, e-mail: bernardi@inf.unibz.it Contents 1 Lambda terms and DCG...................................
More informationCIS 194: Homework 8. Due Wednesday, 8 April. Propositional Logic. Implication
CIS 194: Homework 8 Due Wednesday, 8 April Propositional Logic In this section, you will prove some theorems in Propositional Logic, using the Haskell compiler to verify your proofs. The Curry-Howard isomorphism
More informationActivity. CSCI 334: Principles of Programming Languages. Lecture 4: Fundamentals II. What is computable? What is computable?
Activity CSCI 334: Principles of Programming Languages Lecture 4: Fundamentals II Write a function firsts that, when given a list of cons cells, returns a list of the left element of each cons. ( (a. b)
More informationGame Semantics for Dependent Types
Bath, 20 ctober, 2015 verview Game theoretic model of dependent type theory (DTT): refines model in domains and (total) continuous functions; call-by-name evaluation; faithful model of (total) DTT with
More informationFoundational Aspects of Syntax 1
Foundational Aspects of Syntax 1 Introduction Dale Miller and Catuscia Palamidessi Department of Computer Science and Engineering The Pennsylvania State University 220 Pond Laboratory University Park,
More informationLecture Notes on Data Representation
Lecture Notes on Data Representation 15-814: Types and Programming Languages Frank Pfenning Lecture 9 Tuesday, October 2, 2018 1 Introduction In this lecture we ll see our type system in action. In particular
More informationThe University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 4 MODULE, SPRING SEMESTER MATHEMATICAL FOUNDATIONS OF PROGRAMMING ANSWERS
The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 4 MODULE, SPRING SEMESTER 2012 2013 MATHEMATICAL FOUNDATIONS OF PROGRAMMING ANSWERS Time allowed TWO hours Candidates may complete the front
More informationLexicografie computationala Feb., 2012
Lexicografie computationala Feb., 2012 Anca Dinu University of Bucharest Introduction When we construct meaning representations systematically, we integrate information from two different sources: 1. The
More informationOne of a number of approaches to a mathematical challenge at the time (1930): Constructibility
λ Calculus Church s λ Calculus: Brief History One of a number of approaches to a mathematical challenge at the time (1930): Constructibility (What does it mean for an object, e.g. a natural number, to
More informationdynamically typed dynamically scoped
Reference Dynamically Typed Programming Languages Part 1: The Untyped λ-calculus Jim Royer CIS 352 April 19, 2018 Practical Foundations for Programming Languages, 2/e, Part VI: Dynamic Types, by Robert
More informationMartin-Löf s Type Theory
Martin-Löf s Type Theory B. Nordström, K. Petersson and J. M. Smith 1 Contents 1 Introduction.............................. 1 1.1 Different formulations of type theory............. 3 1.2 Implementations........................
More informationCIS 500 Software Foundations Fall September 25
CIS 500 Software Foundations Fall 2006 September 25 The Lambda Calculus The lambda-calculus If our previous language of arithmetic expressions was the simplest nontrivial programming language, then the
More informationCIS 500 Software Foundations Fall December 4
CIS 500 Software Foundations Fall 2006 December 4 Administrivia Homework 11 Homework 11 is currently due on Friday. Should we make it due next Monday instead? More on Evaluation Contexts Progress for FJ
More informationReview. CS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Let bindings (CBV) Adding Stuff. Booleans and Conditionals
Review CS152: Programming Languages Lecture 11 STLC Extensions and Related Topics e ::= λx. e x ee c v ::= λx. e c (λx. e) v e[v/x] e 1 e 2 e 1 e 2 τ ::= int τ τ Γ ::= Γ,x : τ e 2 e 2 ve 2 ve 2 e[e /x]:
More informationAutomated Reasoning. Natural Deduction in First-Order Logic
Automated Reasoning Natural Deduction in First-Order Logic Jacques Fleuriot Automated Reasoning Lecture 4, page 1 Problem Consider the following problem: Every person has a heart. George Bush is a person.
More informationWhere is ML type inference headed?
1 Constraint solving meets local shape inference September 2005 2 Types are good A type is a concise description of the behavior of a program fragment. Typechecking provides safety or security guarantees.
More informationarxiv:cs/ v1 [cs.lo] 9 Mar 2004
In Theory and Practice of Logic Programming, 4(1), pp. 1 39, 2004 1 arxiv:cs/0403010v1 [cs.lo] 9 Mar 2004 Polymorphic Lemmas and Definitions in λprolog and Twelf ANDREW W. APPEL Department of Computer
More informationA computer implemented philosophy of mathematics
A computer implemented philosophy of mathematics M. Randall Holmes May 14, 2018 This paper presents a philosophical view of the basic foundations of mathematics, which is implemented in actual computer
More informationThe Implicit Calculus of Constructions
The Implicit Calculus of Constructions Extending Pure Type Systems with an Intersection Type Binder and Subtyping Alexandre Miquel 1 INRIA Rocquencourt Projet LogiCal BP 105, 78 153 Le Chesnay cedex, France
More informationPolymorphic lambda calculus Princ. of Progr. Languages (and Extended ) The University of Birmingham. c Uday Reddy
06-02552 Princ. of Progr. Languages (and Extended ) The University of Birmingham Spring Semester 2016-17 School of Computer Science c Uday Reddy2016-17 Handout 6: Polymorphic Type Systems 1. Polymorphic
More informationDependent Object Types - A foundation for Scala s type system
Dependent Object Types - A foundation for Scala s type system Draft of September 9, 2012 Do Not Distrubute Martin Odersky, Geoffrey Alan Washburn EPFL Abstract. 1 Introduction This paper presents a proposal
More informationUniverses. Universes for Data. Peter Morris. University of Nottingham. November 12, 2009
for Data Peter Morris University of Nottingham November 12, 2009 Introduction Outline 1 Introduction What is DTP? Data Types in DTP Schemas for Inductive Families 2 of Data Inductive Types Inductive Families
More informationFormal Predicate Calculus. Michael Meyling
Formal Predicate Calculus Michael Meyling May 24, 2013 2 The source for this document can be found here: http://www.qedeq.org/0_04_07/doc/math/qedeq_formal_logic_v1.xml Copyright by the authors. All rights
More information