Certificates for incremental type checking
|
|
- Calvin Cameron
- 5 years ago
- Views:
Transcription
1 Certificates for incremental type checking Matthias Puech 1,2 Yann Régis-Gianas 2 1 Dept. of Computer Science, University of Bologna 2 Univ. Paris Diderot, Sorbonne Paris Cité, PPS, CNRS, πr 2, INRIA June 20, 2012 PPS Groupe de travail théorie des types et réalisabilité 1 / 31
2 Introduction How to make a type checker incremental? How to trust your type checker? Using Gasp As a programmer The LF notation for derivations As a type system designer The design of Gasp Data structures Typed evaluation algorithm 2 / 31
3 Problem 1: How to make a type checker incremental? 3 / 31
4 Certificates for incremental type-checking Observations Program elaboration is more and more an interaction between the programmer and the type-checker The richer the type system is, the more expensive type-checking gets Example type inference (e.g. Haskell, unification) dependent types (conversion, esp. reflection) very large term 4 / 31
5 Certificates for incremental type-checking Observations Program elaboration is more and more an interaction between the programmer and the type-checker The richer the type system is, the more expensive type-checking gets Example type inference (e.g. Haskell, unification) dependent types (conversion, esp. reflection) very large term... but is called repeatedly with almost the same input 4 / 31
6 Certificates for incremental type-checking 5 / 31
7 Certificates for incremental type-checking 5 / 31
8 Certificates for incremental type-checking 5 / 31
9 Certificates for incremental type-checking 5 / 31
10 Certificates for incremental type-checking 5 / 31
11 Certificates for incremental type-checking 5 / 31
12 Certificates for incremental type-checking 5 / 31
13 Certificates for incremental type-checking 5 / 31
14 Certificates for incremental type-checking 5 / 31
15 Certificates for incremental type-checking 5 / 31
16 Certificates for incremental type-checking 5 / 31
17 Certificates for incremental type checking Problem How to take advantage of the knowledge from previous type-checks? Reuse already-computed results Recheck only the changed part of a program and its impact 6 / 31
18 Problem 2: How to trust your type checker? 7 / 31
19 A compiler designer s job System Z : env tm tp option set of declarative inference rules decision algorithm 8 / 31
20 A compiler designer s job System Z : env tm tp option set of declarative inference rules decision algorithm non trivial (inference, conversion... ) critical 8 / 31
21 Example: System T <: Syntax M ::= o s(m) MM λx. M rec(m, N, xy. P ) A ::= nat even odd A A Typing rules M : nat N : A rec(m, N, xy. P ) : A [ x : nat] [ y : A]. P : A M : A M : B A B 9 / 31
22 Example: System T <: Syntax M ::= o s(m) MM λx. M rec(m, N, xy. P ) A ::= nat even odd A A Typing rules M : nat N : A rec(m, N, xy. P ) : A [ x : nat] [ y : A]. P : A M : A M : B A B Not syntax directed! 9 / 31
23 Example: System T <: Typing algorithm Γ M : A B Γ N : A Γ M N : B 10 / 31
24 Example: System T <: Typing algorithm Γ M : A B Γ N : A Γ A A Γ N : A Γ M N : B 10 / 31
25 Example: System T <: Typing algorithm Γ M : nat Γ N : A Γ, x : nat, y : A P : A rec(m, N, xy. P ) : A 10 / 31
26 Example: System T <: Typing algorithm Γ M : T M Γ T M nat Γ N : T N Γ, x : nat, y : T N P : T P Γ, x : nat, y : T N T P P : T N T P Γ rec(m, N, xy. P ) : T N T P 10 / 31
27 Example: System T <: Typing algorithm Γ M : T M Γ T M nat Γ N : T N Γ, x : nat, y : T N P : T P Γ, x : nat, y : T N T P P : T N T P Γ rec(m, N, xy. P ) : T N T P Far from the declarative system Hard to prove 10 / 31
28 How to trust your typing algorithm? Option 1 Prove equivalence: Γ M = Some A iff M : A + the safest tedious proof non modular
29 How to trust your typing algorithm? Option 2 Return a System T <: derivation: Checked a posteriori: : env tm tp deriv kernel : env deriv bool only certifying (not certified) + lightweight + evident witness of well-typing (PCC,... ) 11 / 31
30 How to trust your typing algorithm? Option 2 Return a System T <: derivation: Checked a posteriori: : env tm tp deriv kernel : env deriv bool only certifying (not certified) + lightweight + evident witness of well-typing (PCC,... )... but there is more 11 / 31
31 Observation Let D = M. Let M be a slightly modified M. Then D = M is a slightly modified D. 12 / 31
32 Observation 12 / 31
33 Back to Problem 1 Problem How to take advantage of the knowledge from previous type-checks? Reuse pieces of a computed derivation D Check only the changed part (the delta) of a program M Requirements δ M M D M D M D M M : A iff (D M, δ M M ) = D M (D M, δ M M ) computes D M in less than O( M ) (ideally O( δ M M )) 13 / 31
34 Back to Problem 1 Bidirectional incremental updates Derivations Lens Programs D get M δ D put M get(d) projects derivation D to a program M put(d, δ) checks δ against D and returns D the incremental type-checker change-based approach justification for each change (D ) 13 / 31
35 Examples initial term let f x = x + 1 in f 3 / 2 14 / 31
36 Examples initial term let f x = x + 1 in f 3 / 2 easy interleave let f x = 2 * (x + 1) in f 3 / 2 14 / 31
37 Examples initial term let f x = x + 1 in f 3 / 2 easy interleave let f x = 2 * (x + 1) in f 3 / 2 env interleave let f x = (let y = true in x + 1) in f 3 / 2 14 / 31
38 Examples initial term let f x = x + 1 in f 3 / 2 easy interleave let f x = 2 * (x + 1) in f 3 / 2 env interleave let f x = (let y = true in x + 1) in f 3 / 2 type change let f x = x > 1 in f 3 / 2 14 / 31
39 In this talk... The message Generating certificates of well-typing allows type checking incrementality by sharing pieces of derivations The difficulty Proofs are higher-order objects (binders, substitution property) What delta language? What data structure for derivations? What language to write synthesis algorithm? 15 / 31
40 In this talk... The artifact Gasp: a language-independent backend to develop certifying, incremental type checkers syntax typing rules checker (untrusted) incremental checker tactic writing language version control... The open question What else can we do with it? 15 / 31
41 Introduction How to make a type checker incremental? How to trust your type checker? Using Gasp As a programmer The LF notation for derivations As a type system designer The design of Gasp Data structures Typed evaluation algorithm 16 / 31
42 Introduction How to make a type checker incremental? How to trust your type checker? Using Gasp As a programmer The LF notation for derivations As a type system designer The design of Gasp Data structures Typed evaluation algorithm 17 / 31
43 Example # Gasp / 31
44 Example Gasp 0.1 # (rec(s(o), s(o), xy. s(x))) 18 / 31
45 Example Gasp 0.1 # (rec(s(o), s(o), xy. s(x))) D 1 : s(o) : odd = o : even s(o) : odd 18 / 31
46 Example Gasp 0.1 # (rec(s(o), s(o), xy. s(x))) D 1 : s(o) : odd = o : even s(o) : odd [ x : nat] D 2 [ x : nat] : s(x) : nat = s(x) : nat 18 / 31
47 Example Gasp 0.1 # (rec(s(o), s(o), xy. s(x))) D 1 : s(o) : odd = o : even s(o) : odd [ x : nat] D 2 [ x : nat] : s(x) : nat = s(x) : nat D 3 : s(o) : nat = D 1 odd nat s(o) : nat 18 / 31
48 Example Gasp 0.1 # (rec(s(o), s(o), xy. s(x))) D 1 : s(o) : odd = o : even s(o) : odd [ x : nat] D 2 [ x : nat] : s(x) : nat = s(x) : nat D 3 : s(o) : nat = D 1 odd nat s(o) : nat [ x : nat] D 4 : rec(s(o), s(o), xy. s(x)) : nat = D 1 D 3 rec(s(o), s(o), xy. s(x)) : na D 2 18 / 31
49 Example Gasp 0.1 # (rec(s(o), s(o), xy. s(x))) D 1 : s(o) : odd = o : even s(o) : odd [ x : nat] D 2 [ x : nat] : s(x) : nat = s(x) : nat D 3 : s(o) : nat = D 1 odd nat s(o) : nat [ x : nat] D 4 : rec(s(o), s(o), xy. s(x)) : nat = D 1 D 3 rec(s(o), s(o), xy. s(x)) : na Functions M : derivation generator D 2 18 / 31
50 Example # (rec(s(s(o)), s(o), xy. s(x))) Functions M : derivation generator 19 / 31
51 Example # (rec(s(s(o)), s(o), xy. s(x))) Functions M : derivation generator 19 / 31
52 Example # (rec(s(d 1 ), D 3, xy. s(x))) Functions M : derivation generator 19 / 31
53 Example # (rec(s( D 1 ), D 3, xy. s(x))) Functions M : derivation generator D : coercion from derivation to the program it types 19 / 31
54 Example # (rec(s( D 1 ), D 3, xy. D 2 )) Functions M : derivation generator D : coercion from derivation to the program it types 19 / 31
55 Example # (rec(s( D 1 ), D 3, xy. D 2 [ x])) Functions M : derivation generator D : coercion from derivation to the program it types 19 / 31
56 Example # (rec(s( D 1 ), D 3, xy. D 2 [ x]))... (all of the above, plus:) D 5 : s(s(o)) : nat =... D 6 : rec(s(s(o)), s(o), xy. s(x)) : nat =... Functions M : derivation generator D : coercion from derivation to the program it types 19 / 31
57 Example # (rec(s( D 1 ), D 3, xy. D 2 [ x]))... (all of the above, plus:) D 5 : s(s(o)) : nat =... D 6 : rec(s(s(o)), s(o), xy. s(x)) : nat =... # (rec( D 5, D 3, xy. D 2 [D 2 [ x]])) Functions M : derivation generator D : coercion from derivation to the program it types 19 / 31
58 Methodology user inputs commands made of terms (programs), functions (, ) and contextual metavariables D i to each function A B there is an inverse B A (put output back into input) system evaluates functions to value (derivations) checks value (kernel) extracts (from context) and names all subterms to a map (repository) for future reuse: slicing 20 / 31
59 What notation for derivations? Preamble First-order vs. higher-order notations Γ, A B vs. Γ A B [ A]. B A B Explicit structural rules Handled by the notation 21 / 31
60 What notation for derivations? Preamble First-order vs. higher-order notations [ A] Γ, A B Γ A B Explicit structural rules vs.. B A B Handled by the notation Local vs. global verification D 1 A B C B C D 2 A Can locally verify rule vs. M N Need M and N 21 / 31
61 What notation for derivations? The LF notation is a higher-order, local notation for derivations (and terms). Comes with a small verification algorithm (typing) Adequacy in LF, a is a example atomic type constant syntactical category tm : family of types constant judgement is : tm tp object constant constructor or rule lam : (tm tm) tm applied object constant rule application well-typed object well-formed derivation Examples is lam : ΠA,B : ty. Πt : tm tm. (Πx : tm. is x A is (t x) B) is (lam A (λx. t x))(arr A B) is lam nat nat (λx. x) (λx h. D[x, h]) : is (lam λx. D) (arr nat nat) 21 / 31
62 What notation for derivations? Syntax K ::= Πx : A. K Kind A ::= Πx : A. A P Type family P ::= a S Atomic type M ::= λx. M F Canonical object F ::= H S Atomic object H ::= x c Head S ::= M S Spine The F are the values we want to manipulate. 21 / 31
63 What notation for derivations? Syntax K ::= Πx : A. K Kind A ::= Πx : A. A P Type family P ::= a S Atomic type M ::= λx. M F Canonical object F ::= H S Atomic object H ::= x c Head S ::= M S Spine The F are the values we want to manipulate.... what are the computations? 21 / 31
64 How to write the unsafe type checker? The computation language CL: an unsafe language to manipulate LF objects but with runtime check: each input & output of functions must be well-typed Syntax T ::= λx. T U Term U ::= F case U in Γ of C C ::= C P U Atomic term Branches P ::= H x... x Pattern 22 / 31
65 Example : ΠM : tm. ΣA : tp. ( M : A) = 23 / 31
66 Example : ΠM : tm. ΣA : tp. ( M : A) = λm. case M of 23 / 31
67 Example : ΠM : tm. ΣA : tp. ( M : A) = λm. case M of o even, o : even s(m) case M of D even, D odd, s M : odd D odd, D even, s M : even nat, D nat, D s M : nat 23 / 31
68 Example M N let A 1 B, D 1 = M in let A 2, D 2 = N in let D = A 1 A 2 in case D of A A B, D 1 D 2 M N : B D 2 D B, D 1 N : A 1 M N : B Functions : ΠA : tp. ΠB : tp. A B = / 31
69 Example λx : A. M x 23 / 31
70 Example λx : A. M let B, D = M in A B, x??? D λx. M : A B 23 / 31
71 Example λx : A. M let B, D = M[x/ A, D x ] in A B, x??? Note A, D = A, D [D x ] D λx. M : A B 23 / 31
72 Example λx : A. M let B, D in D x : ( x : A) = M[x/ A, D x ] in [D x ] D A B, λx. M : A B x??? Note A, D = A, D 23 / 31
73 Example rec(m, N, xy. P ) let A M, D M = M in let D AM = A M nat in let A N, D N = N in let A P, D P in (D x : ( x : nat), D y : ( y : A N )) = P [x/ nat, D x, y/ A N, D y ] in let A, D AN, D AP = A N A P in let, D P in (D x : ( x : nat), D y : ( y : A)) = P [x/ nat, D x, y/ A, D y ] in [D x ][D y ] D M D AM D N D AN D P M : A N : A P : A A, rec(m, N, xy. P ) : A D AP Functions : ΠA : tp. ΠB : tp. ΣC : tp. ( A C) ( B C) = / 31
74 Discussion the type of a function is a kind of contract: M : tm D : ( M : A) 24 / 31
75 Discussion the type of a function is a kind of contract: M : tm D : ( M : A) inverses used to feed output back to input, same idea as context-free typing: M ::= x M M λx : A. M {x : A} M[x/{x : A}] : B λx : A. M : A B {x : A} : A 24 / 31
76 Introduction How to make a type checker incremental? How to trust your type checker? Using Gasp As a programmer The LF notation for derivations As a type system designer The design of Gasp Data structures Typed evaluation algorithm 25 / 31
77 Sliced LF Syntax K ::= Πx : A. K Kind A ::= Πx : A. A P Type family P ::= a S Atomic type M ::= λx. M F Canonical object F ::= H S X[σ] Atomic object H ::= x c f Head S ::= M S Spine σ ::= σ, x/m Parallel substitution The X[σ] stand for open objects (CMTT). The σ close them. The f are computations to do 26 / 31
78 Data structures Signature An object language is defined by a signature: Σ ::= Σ, a : K Σ, c : A Σ, f : A = T Repository A repository is the sliced representation of an atomic object (evar_map): R : (X (Γ F : P )) X[σ] We define co(r) the operation of stripping out all metavariables 27 / 31
79 Inverse functions To each f : A = T Σ, associate a family of f n : A n = T n Project out the n-th argument of f Examples infer : ΠM : tm. ΣA : tp. is M A = T infer 0 : Π{M} : tm. (ΣA : tp. is M A) tm = λx. λy. x equal : ΠM : tm. ΠN : tm. eq M N = T equal 0 : Π{M} : tm. Π{N} : tm. eq M N tm = λm. λn. λh. m equal 1 : Π{M} : tm. Π{N} : tm. eq M N tm = λm. λn. λh. n Evaluation infer (infer 0 A, D ) = A, D equal (equal 0 D) (equal 1 D) = D 28 / 31
80 The typed evaluation algorithm In [P. & R-G., CPP 12], we define ci R (F ): evaluates functions f in F checks F, functions arguments and return (w.r.t. type of f ) slices values in R returns the enlarged R 29 / 31
81 Evaluation strategy We want strong reduction Example lam λx. f (s(x)) not a value 30 / 31
82 Evaluation strategy We want strong reduction Example lam λx. f (s(x)) not a value But not call-by-value Example (rec(s( D 1 ), D 3, xy. D 2 [ x])) 30 / 31
83 Evaluation strategy We want strong reduction Example lam λx. f (s(x)) not a value But not call-by-value Example (rec(s( D 1 ), D 3, xy. D 2 [ x])) And not call-by-name either Example (id ( D)) D 30 / 31
84 Evaluation strategy We want strong reduction Example lam λx. f (s(x)) not a value But not call-by-value Example (rec(s( D 1 ), D 3, xy. D 2 [ x])) And not call-by-name either Example (id ( D)) D 30 / 31
85 Evaluation strategy We want strong reduction Example lam λx. f (s(x)) not a value But not call-by-value Example (rec(s( D 1 ), D 3, xy. D 2 [ x])) And not call-by-name either Example (id ( D)) D Ugly solution Strong call-by-name except in function f argument position weak head call-by-name except f n 30 / 31
86 Conclusion Demo 31 / 31
MLW. 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 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 informationCoq with Classes. Matthieu Sozeau. Journées PPS 2011 September 5th 2011 Trouville, France. Project Team πr 2 INRIA Paris
Coq with Classes Matthieu Sozeau Project Team πr 2 INRIA Paris Journées PPS 2011 September 5th 2011 Trouville, France This talk A quick overview of Coq Elaboration Type Classes Matthieu Sozeau - Coq with
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 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 informationInductive Definitions, continued
1 / 27 Inductive Definitions, continued Assia Mahboubi Jan 7th, 2016 2 / 27 Last lecture Introduction to Coq s inductive types: Introduction, elimination and computation rules; Twofold implementation :
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 informationOutline. Introduction Concepts and terminology The case for static typing. Implementing a static type system Basic typing relations Adding context
Types 1 / 15 Outline Introduction Concepts and terminology The case for static typing Implementing a static type system Basic typing relations Adding context 2 / 15 Types and type errors Type: a set of
More informationCombining Proofs and Programs in a Dependently Typed Language. Certification of High-level and Low-level Programs
Combining Proofs and Programs in a Dependently Typed Language Stephanie Weirich University of Pennsylvania July 7, 2014 Certification of High-level and Low-level Programs Zombie A functional programming
More informationThe Metalanguage λprolog and Its Implementation
The Metalanguage λprolog and Its Implementation Gopalan Nadathur Computer Science Department University of Minnesota (currently visiting INRIA and LIX) 1 The Role of Metalanguages Many computational tasks
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 informationTowards typed repositories of proofs
Towards typed repositories of proofs Matthias Puech, Yann Régis-Gianas To cite this version: Matthias Puech, Yann Régis-Gianas. Towards typed repositories of proofs. Mathematically Intelligent Proof Search
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 informationThesis Proposal: Refinement Types for LF (DRAFT)
Thesis Proposal: Refinement Types for LF (DRAFT) William Lovas (wlovas@cs.cmu.edu) May 1, 2008 Abstract The logical framework LF and its implementation as the Twelf metalogic provide both a practical system
More informationType checking in the presence of meta-variables
Type checking in the presence of meta-variables Ulf Norell and Catarina Coquand Department of Computer Science and Engineering Chalmers University of Technology {ulfn,catarina}@cs.chalmers.se Abstract.
More informationStatic and User-Extensible Proof Checking. Antonis Stampoulis Zhong Shao Yale University POPL 2012
Static and User-Extensible Proof Checking Antonis Stampoulis Zhong Shao Yale University POPL 2012 Proof assistants are becoming popular in our community CompCert [Leroy et al.] sel4 [Klein et al.] Four-color
More informationAutosubst Manual. May 20, 2016
Autosubst Manual May 20, 2016 Formalizing syntactic theories with variable binders is not easy. We present Autosubst, a library for the Coq proof assistant to automate this process. Given an inductive
More informationProgramming Up-to-Congruence, Again. WG 2.8 Estes Park
Programming Up-to-Congruence, Again Stephanie Weirich University of Pennsylvania August 12, 2014 WG 2.8 Estes Park Zombie A functional programming language with a dependent type system intended for lightweight
More informationCPS Translations and Applications: The Cube and Beyond
CPS Translations and Applications: The Cube and Beyond Section 2: The domain-free λ-cube Haye Böhm June 12, 2018 What we ve seen so far 1 CBV/CBN reduction strategies 2 Simulating CBN in a CBV language
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 informationCS 6110 S11 Lecture 12 Naming and Scope 21 February 2011
CS 6110 S11 Lecture 12 Naming and Scope 21 February 2011 In this lecture we introduce the topic of scope in the context of the λ-calculus and define translations from λ-cbv to FL for the two most common
More informationCS 6110 S11 Lecture 25 Typed λ-calculus 6 April 2011
CS 6110 S11 Lecture 25 Typed λ-calculus 6 April 2011 1 Introduction Type checking is a lightweight technique for proving simple properties of programs. Unlike theorem-proving techniques based on axiomatic
More information1 Introduction. 3 Syntax
CS 6110 S18 Lecture 19 Typed λ-calculus 1 Introduction Type checking is a lightweight technique for proving simple properties of programs. Unlike theorem-proving techniques based on axiomatic semantics,
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 informationExercise 1 ( = 22 points)
1 Exercise 1 (4 + 3 + 4 + 5 + 6 = 22 points) The following data structure represents polymorphic lists that can contain values of two types in arbitrary order: data DuoList a b = C a (DuoList a b) D b
More informationCostly software bugs that could have been averted with type checking
Type Checking Class Notes from Lectures 6 and 7 Lahav Yeffet and Ori Folger The material in these lectures is based on the textbook Types and Programming Languages by Benjamin Pierce. Here is a list of
More informationLecture 15 CIS 341: COMPILERS
Lecture 15 CIS 341: COMPILERS Announcements HW4: OAT v. 1.0 Parsing & basic code generation Due: March 28 th No lecture on Thursday, March 22 Dr. Z will be away Zdancewic CIS 341: Compilers 2 Adding Integers
More informationDenotational Semantics. Domain Theory
Denotational Semantics and Domain Theory 1 / 51 Outline Denotational Semantics Basic Domain Theory Introduction and history Primitive and lifted domains Sum and product domains Function domains Meaning
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 informationExercise 1 (2+2+2 points)
1 Exercise 1 (2+2+2 points) The following data structure represents binary trees only containing values in the inner nodes: data Tree a = Leaf Node (Tree a) a (Tree a) 1 Consider the tree t of integers
More informationAdam Chlipala University of California, Berkeley ICFP 2006
Modular Development of Certified Program Verifiers with a Proof Assistant Adam Chlipala University of California, Berkeley ICFP 2006 1 Who Watches the Watcher? Program Verifier Might want to ensure: Memory
More informationType Checking and Type Inference
Type Checking and Type Inference Principles of Programming Languages CSE 307 1 Types in Programming Languages 2 Static Type Checking 3 Polymorphic Type Inference Version: 1.8 17:20:56 2014/08/25 Compiled
More informationTyped Lambda Calculus and Exception Handling
Typed Lambda Calculus and Exception Handling Dan Zingaro zingard@mcmaster.ca McMaster University Typed Lambda Calculus and Exception Handling p. 1/2 Untyped Lambda Calculus Goal is to introduce typing
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 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 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 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 informationTowards efficient, typed LR parsers
roduction An automaton An ML implementation Beyond ML Conclusion 1 rançois Pottier and Yann Régis-Gianas June 2005 rançois Pottier and Yann Régis-Gianas roduction An automaton An ML implementation Beyond
More informationInductive Beluga: Programming Proofs
Inductive Beluga: Programming Proofs Brigitte Pientka and Andrew Cave McGill University, Montreal, QC, Canada, {bpientka,acave1}@cs.mcgill.ca Abstract. beluga is a proof environment which provides a sophisticated
More informationA Pronominal Account of Binding and Computation
A Pronominal Account of Binding and Computation Robert Harper Carnegie Mellon University TAASN March 2009 Thanks Thanks to Daniel R. Licata and Noam Zeilberger, my collaborators on this work. Thanks to
More informationExercise 1 ( = 18 points)
1 Exercise 1 (4 + 5 + 4 + 5 = 18 points) The following data structure represents polymorphic binary trees that contain values only in special Value nodes that have a single successor: data Tree a = Leaf
More informationIntroduction to Homotopy Type Theory
Introduction to Homotopy Type Theory Lecture notes for a course at EWSCS 2017 Thorsten Altenkirch March 5, 2017 1 What is this course about? To explain what Homotopy Type Theory is, I will first talk about
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 informationA Canonical 1 Locally Named Representation of Binding. α -equivalence is identity. Randy Pollack. Masahiko Sato. LFCS, University of Edinburgh
A Canonical 1 Locally Named Representation of Binding Randy Pollack LFCS, University of Edinburgh Masahiko Sato Graduate School of Informatics, Kyoto University Version of December 7, 2009 1 α -equivalence
More informationEquations: a tool for dependent pattern-matching
Equations: a tool for dependent pattern-matching Cyprien Mangin cyprien.mangin@m4x.org Matthieu Sozeau matthieu.sozeau@inria.fr Inria Paris & IRIF, Université Paris-Diderot May 15, 2017 1 Outline 1 Setting
More informationThe Worker/Wrapper Transformation
The Worker/Wrapper Transformation Andy Gill 1 Graham Hutton 2 1 Galois, Inc. 2 University of Nottingham February 6, 2008 Andy Gill, Graham Hutton The Worker/Wrapper Transformation February 6, 2008 1 /
More informationOn the Logical Foundations of Staged Computation
On the Logical Foundations of Staged Computation Frank Pfenning PEPM 00, Boston, MA January 22, 2000 1. Introduction 2. Judgments and Propositions 3. Intensional Types 4. Run-Time Code Generation 5. The
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 informationExercise 1 ( = 24 points)
1 Exercise 1 (4 + 5 + 4 + 6 + 5 = 24 points) The following data structure represents polymorphic binary trees that contain values only in special Value nodes that have a single successor: data Tree a =
More informationLecture Notes on Computational Interpretations of Modalities
Lecture Notes on Computational Interpretations of Modalities 15-816: Modal Logic Frank Pfenning Lecture 4 January 21, 2010 1 Introduction In this lecture we present the first two of many possible computational
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 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 informationAdding 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
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 informationPattern Matching and Abstract Data Types
Pattern Matching and Abstract Data Types Tom Murphy VII 3 Dec 2002 0-0 Outline Problem Setup Views ( Views: A Way For Pattern Matching To Cohabit With Data Abstraction, Wadler, 1986) Active Patterns (
More information1. Abstract syntax: deep structure and binding. 2. Static semantics: typing rules. 3. Dynamic semantics: execution rules.
Introduction Formal definitions of programming languages have three parts: CMPSCI 630: Programming Languages Static and Dynamic Semantics Spring 2009 (with thanks to Robert Harper) 1. Abstract syntax:
More informationCS 6110 S14 Lecture 38 Abstract Interpretation 30 April 2014
CS 6110 S14 Lecture 38 Abstract Interpretation 30 April 2014 1 Introduction to Abstract Interpretation At this point in the course, we have looked at several aspects of programming languages: operational
More informationA native compiler for Coq: current status, perspectives and discussion 1
A native compiler for Coq A native compiler for Coq: current status, perspectives and discussion 1 Maxime Dénès, jww M. Boespflug and B. Grégoire Marelle Team, INRIA Sophia-Antipolis February 19, 2013
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 informationA type directed translation of MLF to System F
A type directed translation of MLF to System F Daan Leijen Microsoft Research daan@microsoft.com Abstract The MLF type system by Le Botlan and Rémy (2003) is a natural extension of Hindley-Milner type
More informationLecture 9: Typed Lambda Calculus
Advanced Topics in Programming Languages Spring Semester, 2012 Lecture 9: Typed Lambda Calculus May 8, 2012 Lecturer: Mooly Sagiv Scribe: Guy Golan Gueta and Shachar Itzhaky 1 Defining a Type System for
More informationAn experiment with variable binding, denotational semantics, and logical relations in Coq. Adam Chlipala University of California, Berkeley
A Certified TypePreserving Compiler from Lambda Calculus to Assembly Language An experiment with variable binding, denotational semantics, and logical relations in Coq Adam Chlipala University of California,
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 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 information3.4 Deduction and Evaluation: Tools Conditional-Equational Logic
3.4 Deduction and Evaluation: Tools 3.4.1 Conditional-Equational Logic The general definition of a formal specification from above was based on the existence of a precisely defined semantics for the syntax
More informationIdris: Implementing a Dependently Typed Programming Language
Idris: Implementing a Dependently Typed Programming Language Edwin Brady University of St Andrews ecb10@st-andrews.ac.uk @edwinbrady Type Inference and Automated Proving, Dundee, 12th May 2015 1 / 25 Idris
More informationLecture #23: Conversion and Type Inference
Lecture #23: Conversion and Type Inference Administrivia. Due date for Project #2 moved to midnight tonight. Midterm mean 20, median 21 (my expectation: 17.5). Last modified: Fri Oct 20 10:46:40 2006 CS164:
More informationLost in translation. Leonardo de Moura Microsoft Research. how easy problems become hard due to bad encodings. Vampire Workshop 2015
Lost in translation how easy problems become hard due to bad encodings Vampire Workshop 2015 Leonardo de Moura Microsoft Research I wanted to give the following talk http://leanprover.github.io/ Automated
More information4.8 Dependent Types 97
4.8 Dependent Types 97 4.8 Dependent Types We have encountered a number of constructors for propositions and types. Generally, propositions are constructed from simpler propositions, and types are constructed
More informationConversion vs. Subtyping. Lecture #23: Conversion and Type Inference. Integer Conversions. Conversions: Implicit vs. Explicit. Object x = "Hello";
Lecture #23: Conversion and Type Inference Administrivia. Due date for Project #2 moved to midnight tonight. Midterm mean 20, median 21 (my expectation: 17.5). In Java, this is legal: Object x = "Hello";
More informationKripke-Style Contextual Modal Type Theory
Kripke-Style Contextual Modal Type Theory YUITO MURASE THE UNIVERSITY OF TOKYO Agenda Background Logic Type System Future Plan/Related Work Background: Syntactical Metaprogramming Extend the syntax of
More informationMetaprogramming assignment 3
Metaprogramming assignment 3 Optimising embedded languages Due at noon on Thursday 29th November 2018 This exercise uses the BER MetaOCaml compiler, which you can install via opam. The end of this document
More informationCSCE 314 Programming Languages. Type System
CSCE 314 Programming Languages Type System Dr. Hyunyoung Lee 1 Names Names refer to different kinds of entities in programs, such as variables, functions, classes, templates, modules,.... Names can be
More informationFoundational Proof Checkers with Small Witnesses
Foundational Proof Checkers with Small Witnesses Dinghao Wu Andrew W. Appel Aaron Stump Princeton University {dinghao,appel}@cs.princeton.edu Washington University in St. Louis stump@cs.wustl.edu ABSTRACT
More informationPierce Ch. 3, 8, 11, 15. Type Systems
Pierce Ch. 3, 8, 11, 15 Type Systems Goals Define the simple language of expressions A small subset of Lisp, with minor modifications Define the type system of this language Mathematical definition using
More informationNormalization by hereditary substitutions
Normalization by hereditary substitutions Chantal Keller INRIA Saclay Île-de-France France keller@lix.polytechnique.fr Thorsten Altenkirch The University of Nottingham United Kingdom txa@cs.nott.ac.uk
More informationEncryption as an Abstract Datatype:
June 2003 1/18 Outline Encryption as an Abstract Datatype: an extended abstract Dale Miller INRIA/Futurs/Saclay and École polytechnique 1. Security protocols specified using multisets rewriting. 2. Eigenvariables
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 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 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 informationType families and data kinds
Type families and data kinds AFP Summer School Wouter Swierstra 1 Today How do GADTs work? Kinds beyond * Programming with types 2 Calling functions on vectors Given two vectors xs : Vec a n and ys : Vec
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 informationTypes. Type checking. Why Do We Need Type Systems? Types and Operations. What is a type? Consensus
Types Type checking What is a type? The notion varies from language to language Consensus A set of values A set of operations on those values Classes are one instantiation of the modern notion of type
More informationIntroduction 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 informationProgramming type-safe transformations using higher-order abstract syntax
Programming type-safe transformations using higher-order abstract syntax OLIVIER SAVARY BELANGER McGill University STEFAN MONNIER Universite de Montreal and BRIGITTE PIENTKA McGill University When verifying
More informationHandout 10: Imperative programs and the Lambda Calculus
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 10: Imperative programs and the Lambda Calculus
More informationCMSC 330: Organization of Programming Languages
CMSC 330: Organization of Programming Languages Operational Semantics CMSC 330 Summer 2018 1 Formal Semantics of a Prog. Lang. Mathematical description of the meaning of programs written in that language
More informationMulti-paradigm Declarative Languages
Michael Hanus (CAU Kiel) Multi-paradigm Declarative Languages ICLP 2007 1 Multi-paradigm Declarative Languages Michael Hanus Christian-Albrechts-University of Kiel Programming Languages and Compiler Construction
More informationAn update on XML types
An update on XML types Alain Frisch INRIA Rocquencourt (Cristal project) Links Meeting - Apr. 2005 Plan XML types 1 XML types 2 3 2/24 Plan XML types 1 XML types 2 3 3/24 Claim It is worth studying new
More informationGADTs. Wouter Swierstra. Advanced functional programming - Lecture 7. Faculty of Science Information and Computing Sciences
GADTs Advanced functional programming - Lecture 7 Wouter Swierstra 1 Today s lecture Generalized algebraic data types (GADTs) 2 A datatype data Tree a = Leaf Node (Tree a) a (Tree a) This definition introduces:
More informationCIS 500 Software Foundations Midterm I Answer key October 8, 2003
CIS 500 Software Foundations Midterm I Answer key October 8, 2003 Inductive Definitions Review: Recall that the function size, which calculates the total number of nodes in the abstract syntax tree of
More informationChapter 13: Reference. Why reference Typing Evaluation Store Typings Safety Notes
Chapter 13: Reference Why reference Typing Evaluation Store Typings Safety Notes References Computational Effects Also known as side effects. A function or expression is said to have a side effect if,
More informationA BI-DIRECTIONAL REFINEMENT ALGORITHM FOR THE CALCULUS OF (CO)INDUCTIVE CONSTRUCTIONS
Logical Methods in Computer Science Vol. 8 (1:18) 2012, pp. 1 49 www.lmcs-online.org Submitted May 16, 2011 Published Mar. 2, 2012 A BI-DIRECTIONAL REFINEMENT ALGORITHM FOR THE CALCULUS OF (CO)INDUCTIVE
More informationStatic Semantics. Winter /3/ Hal Perkins & UW CSE I-1
CSE 401 Compilers Static Semantics Hal Perkins Winter 2009 2/3/2009 2002-09 Hal Perkins & UW CSE I-1 Agenda Static semantics Types Symbol tables General ideas for now; details later for MiniJava project
More informationDependent Types and Program Equivalence
Dependent Types and Program Equivalence Limin Jia Jianzhou Zhao Vilhelm Sjöberg Stephanie Weirich Computer and Information Sciences Department, University of Pennsylvania {liminjia,jianzhou,vilhelm,sweirich}@cis.upenn.edu
More informationAutomated verification of termination certificates
Automated verification of termination certificates Frédéric Blanqui and Kim Quyen Ly Frédéric Blanqui and Kim Quyen Ly Automated verification of termination certificates 1 / 22 Outline 1 Software certification
More informationThe Next 700 Syntactic Models of Type Theory
The Next 700 Syntactic Models of Type Theory Simon Boulier 1 Pierre-Marie Pédrot 2 Nicolas Tabareau 1 1 INRIA, 2 University of Ljubljana CPP 17th January 2017 Pédrot & al (INRIA & U Ljubljana) The Next
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 information4. The λ-calc. with Prod. and Conj.
4. The λ-calc. with Prod. and Conj. (4. The λ-calculus with Products and Conjunction) (a) The typed λ-calculus with products. (b) Currying. (Omitted 2008). (c) The nondependent product in Agda. (d) Logic
More informationSimple Unification-based Type Inference for GADTs
Simple Unification-based Type Inference for GADTs Stephanie Weirich University of Pennsylvania joint work with Dimitrios Vytiniotis, Simon Peyton Jones and Geoffrey Washburn Overview Goal: Add GADTs to
More information