Exploiting Uniformity in Substitution: the Nuprl Term Model. Abhishek Anand
|
|
- Tiffany Bond
- 5 years ago
- Views:
Transcription
1 Exploiting Uniformity in Substitution: the Nuprl Term Model Abhishek Anand 1 / 24
2 Variable bindings b a x 2 dx λx.x x : A.B d dx B match t with pair x y B end x : A.B A : Type x : A B : Type (x : A) B : Type 2 / 24
3 Variable bindings b a x 2 dx λx.x d dx B abstract over syntax match t with pair x y B end x : A.B x : A.B A : Type x : A B : Type (x : A) B : Type 2 / 24
4 The untyped λ calculus Inductive Term : Set := vterm : Var Term app : Term Term Term lam : Var Term Term 3 / 24
5 The untyped λ calculus Inductive Term : Set := vterm : Var Term app : Term Term Term lam : Var Term Term lam x b represents λx.b 3 / 24
6 The untyped λ calculus Inductive Term : Set := vterm : Var Term app : Term Term Term lam : Var Term Term lam x b represents λx.b Fixpoint fvars (t:term) : list Var := match t with vterm v [v] app f a fvars f ++ fvars a lam x b fvars b -- [x] 3 / 24
7 Extensions Inductive Term : Set := vterm : Var Term app : Term Term Term lam : Var Term Term 4 / 24
8 Extensions Inductive Term : Set := vterm : Var Term app : Term Term Term lam : Var Term Term all : Var Term Term x.b exi : Var Term Term x.b 4 / 24
9 Extensions Inductive Term : Set := vterm : Var Term app : Term Term Term lam : Var Term Term all : Var Term Term x.b exi : Var Term Term x.b Fixpoint fvars (t:term) : list Var := match t with vterm v [v] app f a fvars f ++ fvars a lam x b fvars b -- [x] all x b fvars b -- [x] exi x b fvars b -- [x] 4 / 24
10 A Uniform Treatment Parametrize over a collection of operators 5 / 24
11 A Uniform Treatment Parametrize over a collection of operators λ x.x x.b 5 / 24
12 A Uniform Treatment Parametrize over a collection of operators λ x.x x.b match t with pair x y B end 5 / 24
13 A Uniform Treatment Parametrize over a collection of operators λ x.x x.b match t with pair x y B end 5 / 24
14 A Uniform Treatment Parametrize over a collection of operators λ (x.x) x.b match t with pair x y B end 5 / 24
15 A Uniform Treatment Parametrize over a collection of operators λ x.x x.b match t with pair x y B end 5 / 24
16 A Uniform Treatment Parametrize over a collection of operators λ x.x multiple variables bound simultaneously x.b match t with pair x y B end 5 / 24
17 A Uniform Treatment Parametrize over a collection of operators λ x.x x.b match t with inl x L inr x R end multiple variables bound simultaneously match t with pair x y B end 5 / 24
18 A Uniform Treatment Parametrize over a collection of operators multiple variables bound simultaneously λ x.x x.b match t with inl x L inr x R end match t with pair x y B end multiple bound terms 5 / 24
19 A Uniform Treatment {Opid: Type; signature: Opid list nat} multiple variables bound simultaneously λ x.x x.b match t with inl x L inr x R end match t with pair x y B end multiple bound terms 5 / 24
20 A Uniform Treatment {Opid: Type; λ x.x x.b match t with inl x L inr x R end signature: Opid list nat} multiple variables bound simultaneously match t with pair x y B end [0;1;1] 5 / 24
21 A Uniform Treatment {Opid: Type; signature: Opid list nat} λ x.x x.b match t with inl x L inr x R end [0;2] match t with pair x y B end [0;1;1] 5 / 24
22 A Uniform Treatment {Opid: Type; signature: Opid list nat} [1] λ x.x x.b match t with inl x L inr x R end [0;2] match t with pair x y B end [0;1;1] 5 / 24
23 A Uniform Treatment : Formally Context {Var Opid : Type}.. Inductive Term : Type := with BTerm : Type :=. 6 / 24
24 A Uniform Treatment : Formally Context {Var Opid : Type}.. Inductive Term : Type := vterm: Var Term with BTerm : Type :=. 6 / 24
25 A Uniform Treatment : Formally Context {Var Opid : Type}.. Inductive Term : Type := vterm: Var Term oterm: Opid list BTerm Term with BTerm : Type :=. 6 / 24
26 A Uniform Treatment : Formally Context {Var Opid : Type}.. Inductive Term : Type := vterm: Var Term oterm: Opid list BTerm Term with BTerm : Type := bterm: list Var Term BTerm. 6 / 24
27 A Uniform Treatment : Formally λx.y oterm lam [bterm [x] (vterm y)] Inductive Term : Type := vterm: Var Term oterm: Opid list BTerm Term with BTerm : Type := bterm: list Var Term BTerm. 6 / 24
28 A Uniform Treatment : Formally λx.y oterm lam [bterm [x] (vterm y)] x.y oterm forall [bterm [x] (vterm y)] Inductive Term : Type := vterm: Var Term oterm: Opid list BTerm Term with BTerm : Type := bterm: list Var Term BTerm. 6 / 24
29 A Uniform Treatment : Formally MATCH t with pair x y B end Inductive Term : Type := vterm: Var Term oterm: Opid list BTerm Term with BTerm : Type := bterm: list Var Term BTerm. 6 / 24
30 A Uniform Treatment : Formally MATCH t with pair x y B end oterm (MATCH [pair]) [bterm [] t; bterm [x;y] B] Inductive Term : Type := vterm: Var Term oterm: Opid list BTerm Term with BTerm : Type := bterm: list Var Term BTerm. 6 / 24
31 A Uniform Treatment : Formally MATCH t with inl x L inr x R end Inductive Term : Type := vterm: Var Term oterm: Opid list BTerm Term with BTerm : Type := bterm: list Var Term BTerm. 6 / 24
32 A Uniform Treatment : Formally MATCH t with inl x L inr x R end oterm (MATCH [inl;inr]) [bterm [] t; bterm [x] L; bterm [x] R] Inductive Term : Type := vterm: Var Term oterm: Opid list BTerm Term with BTerm : Type := bterm: list Var Term BTerm. 6 / 24
33 A Uniform Treatment : Formally MATCH t with inl x L inr x R end oterm (MATCH [inl;inr]) [bterm [] t; bterm [x] L; bterm [x] R] Inductive Term : Type := vterm: Var Term oterm: Opid list BTerm Term with BTerm : Type := bterm: list Var Term BTerm. 6 / 24
34 A Uniform Treatment : Formally MATCH t with inl x L inr x R end oterm (MATCH ) [bterm [] t; bterm inl [x] L; bterm inr [x] R] Inductive Term : Type := vterm: Var Term oterm: Opid list BTerm Term with BTerm : Type := bterm: list Var Term BTerm. 6 / 24
35 A Uniform Treatment : Formally MATCH t with inl x L inr x R end oterm (MATCH ) [bterm [] t; bterm inl [x] L; bterm inr [x] R] Inductive Term (Tag: Type) : Type := vterm: Var Term oterm: Opid list (BTerm Tag) Term with BTerm (Tag: Type): Type := bterm: Tag list Var Term Tag BTerm. 6 / 24
36 Free Variables Fixpoint fvars (t:term): list Var := match t with vterm v [v] oterm op bts flat map fvars bterm bts end with fvars bterm (bt : BTerm) : list Var := match bt with bterm lv t (fvars t) -- lv end. 7 / 24
37 Bound Variables Fixpoint bvars (t : Term) : list Var := match t with vterm v [] oterm op bts flat map bvars bterm bts end with bvars bterm (bt : BTerm) : list Var := match bt with bterm lv t (bvars t) ++ lv end. 8 / 24
38 Unsafe substitution Substitution := list (Var Term). Fixpoint subst aux (t : Term) (sub : Substitution) : Term := match nt with vterm var match sub find sub var with Some t t None nt end oterm op bts oterm op (map (subst bterm sub) bts) 9 / 24
39 Unsafe substitution : bound terms with subst bterm (sub : Substitution) (bt : BTerm) {struct bt}: BTerm := match bt with bterm lv t bterm lv (subst aux t (sub filter sub lv)) end. 10 / 24
40 Unsafe substitution : bound terms with subst bterm (sub : Substitution) (bt : BTerm) {struct bt}: BTerm := match bt with bterm lv t bterm lv (subst aux t (sub filter sub lv)) end. 10 / 24
41 Unsafe substitution : bound terms with subst bterm (sub : Substitution) (bt : BTerm) {struct bt}: BTerm := match bt with bterm lv t bterm lv (subst aux t (sub filter sub lv)) end. 10 / 24
42 Unsafe substitution : bound terms with subst bterm (sub : Substitution) (bt : BTerm) {struct bt}: BTerm := match alpha ren (sfvars sub) bt with bterm lv t bterm lv (subst aux t (sub filter sub lv)) end. 10 / 24
43 Unsafe substitution : bound terms with subst bterm (sub : Substitution) (bt : BTerm) {struct bt}: BTerm := match alpha ren (sfvars sub) bt with bterm lv t bterm lv (subst aux t (sub filter sub lv)) end. sfvars : Substitution list Var := flat map (fvars π 2 ) 10 / 24
44 Unsafe substitution : bound terms with subst bterm (sub : Substitution) (bt : BTerm) {struct bt}: BTerm := match alpha ren (sfvars sub) bt with bterm lv t bterm lv (subst aux t (sub filter sub lv)) end. sfvars : Substitution list Var := flat map (fvars π 2 ) 10 / 24
45 Capture-avoiding substitution Definition subst (t : Term) (sub : Substitution) : Term := subst aux (alpha ren (sfvars sub) t) sub. 11 / 24
46 α equality Inductive alpha eq : Term Term Prop := alv : (v:var), (vterm v) α (vterm v) alo : (op: Opid) (lbt1 lbt2 : list BTerm), length lbt1 = length lbt2 ( n, n < length lbt1 (lbt1[n]) α (lbt2[n])) (oterm op lbt1) α (oterm op lbt2) 12 / 24
47 α equality : bound terms with alpha eq bterm : BTerm BTerm Prop := alb : (lv1 lv2 lv: list Var) (t1 t2 : Term), disjoint lv (all vars t1 ++ all vars t2) length lv1 = length lv2 length lv1 = length lv no repeats lv (subst t1 (var ren lv1 lv)) α (subst t2 (var ren lv2 lv)) (bterm lv1 t1) α (bterm lv2 t2) 13 / 24
48 α equality : bound terms with alpha eq bterm : BTerm BTerm Prop := alb : (lv1 lv2 lv: list Var) (t1 t2 : Term), disjoint lv (all vars t1 ++ all vars t2) length lv1 = length lv2 length lv1 = length lv no repeats lv (subst t1 (var ren lv1 lv)) α (subst t2 (var ren lv2 lv)) (bterm lv1 t1) α (bterm lv2 t2) var ren (lvi lvf : list Var) : Substitution := zip lvi (map vterm lvf ). 13 / 24
49 Proved Properties Context (a b : Term) (sa sb s : Substitution). 14 / 24
50 Proved Properties Context (a b : Term) (sa sb s : Substitution). a = α b sa = α sb subst a sa = α subst b sb. 14 / 24
51 Proved Properties Context (a b : Term) (sa sb s : Substitution). a = α b sa = α sb subst a sa = α subst b sb. fvars (subst a s) (fvars a -- Dom s) ++ sfvars (keepfirst s (fvars a)). 14 / 24
52 Proved Properties Context (a b : Term) (sa sb s : Substitution). a = α b sa = α sb subst a sa = α subst b sb. fvars (subst a s) (fvars a -- Dom s) ++ sfvars (keepfirst s (fvars a)). disjoint (sfvars sa) (Dom sb) disjoint (sfvars sb) (Dom sa) disjoint (Dom sa) (Dom sb) subst (subst a sa) sb = α subst (subst a sb) sa. 14 / 24
53 Proved Properties Context (a b : Term) (sa sb s : Substitution). a = α b sa = α sb subst a sa = α subst b sb. fvars (subst a s) (fvars a -- Dom s) ++ sfvars (keepfirst s (fvars a)). disjoint (sfvars sa) (Dom sb) disjoint (sfvars sb) (Dom sa) disjoint (Dom sa) (Dom sb) subst (subst a sa) sb = α subst (subst a sb) sa. subst (subst a sa) sb = α subst a ((SubstSub sa sb)++sb). 14 / 24
54 Variables Class VarType (Var :Type) := { deq : x y : Var, {x = y} + {x y}; }. 15 / 24
55 Variables Class VarType (Var :Type) := { deq : x y : Var, {x = y} + {x y}; freshvars : (n:nat) (avoid : list Var), list Var; }. 15 / 24
56 Variables Class VarType (Var :Type) := { deq : x y : Var, {x = y} + {x y}; freshvars : (n:nat) (avoid : list Var), list Var; freshcorrect:... }. 15 / 24
57 Variables Class VarType (Var :Type) := { deq : x y : Var, {x = y} + {x y}; }. 15 / 24
58 Variables Class VarType (Var :Type) := { deq : x y : Var, {x = y} + {x y}; }. free variables, bound variables, unsafe substitution, 15 / 24
59 Variables Class VarType (Var :Type) := { deq : x y : Var, {x = y} + {x y}; }. free variables, bound variables, unsafe substitution, safe substitution 15 / 24
60 Variables Class VarType (Var :Type) := { deq : x y : Var, {x = y} + {x y}; }. free variables, bound variables, unsafe substitution, safe substitution,alpha equality 15 / 24
61 Variables Class VarType (Var :Type) := { deq : x y : Var, {x = y} + {x y}; }. free variables, bound variables, unsafe substitution, safe substitution,alpha equality equivariance : π, π (f x) = f (π x) Andrew M. Pitts. Nominal logic: A first order theory of names and binding. In: TACS. Springer, / 24
62 α equality of bound terms: simpler definition with alpha eq bterm : BTerm BTerm Prop := alb : (lv1 lv2 lv: list Var) (t1 t2 : Term), disjoint lv (all vars t1 ++ all vars t2) length lv1 = length lv2 length lv1 = length lv no repeats lv (subst t1 (var ren lv1 lv)) α (subst t2 (var ren lv2 lv)) (bterm lv1 t1) α (bterm lv2 t2) 16 / 24
63 α equality of bound terms: simpler definition with alpha eq bterm : BTerm BTerm Prop := alb : (lv1 lv2 lv: list Var) (t1 t2 : Term), disjoint lv (all vars t1 ++ all vars t2) length lv1 = length lv2 length lv1 = length lv no repeats lv (subst aux t1 (var ren lv1 lv)) α (subst aux t2 (var ren lv2 lv)) (bterm lv1 t1) α (bterm lv2 t2) 16 / 24
64 α equality of bound terms: simpler definition with alpha eq bterm : BTerm BTerm Prop := alb : (lv1 lv2 lv: list Var) (t1 t2 : Term), disjoint lv (all vars t1 ++ all vars t2) length lv1 = length lv2 length lv1 = length lv no repeats lv (π (lv1,lv) t1) α (π (lv2,lv) t2) (bterm lv1 t1) α (bterm lv2 t2) 16 / 24
65 Beyond Substitution t n v defines, a computational equivalence conditions for congruence of Douglas J. Howe. Equality in Lazy Computation Systems. LICS In: Douglas J. Howe. Proving Congruence of Bisimulation in Functional Programming Languages. In: Inf. Comput (1996) 17 / 24
66 Limitations non-linear structure in pattern variables 18 / 24
67 Limitations non-linear structure in pattern variables Inductive btree: Set := leaf : btree bnode : btree btree btree. Fixpoint btsize (bt: btree) :nat := match bt with leaf 1 bnode t leaf (btsize t)+1 bnode t (bnode ta tb) (btsize t)+(btsize ta)+(btsize tb) end. 18 / 24
68 Limitations non-linear structure in pattern variables Inductive btree: Set := leaf : btree bnode : btree btree btree. Fixpoint btsize (bt: btree) :nat := match bt with leaf 1 bnode t leaf (btsize t)+1 bnode t (bnode ta tb) (btsize t)+(btsize ta)+(btsize tb) end. 18 / 24
69 Limitations non-linear structure in pattern variables CFGV: Fixpoint btsize (bt: btree) :nat := match bt with leaf 1 bnode t leaf (btsize t)+1 bnode t (bnode ta tb) (btsize t)+(btsize ta)+(btsize tb) end. 18 / 24
70 Limitations non-linear structure in pattern variables CFGV: Abhishek Anand and Vincent Rahli. A Generic Approach to Proofs about Substitution. In: LFMTP. Vienna, Austria: ACM, July 2014 Fixpoint btsize (bt: btree) :nat := match bt with leaf 1 bnode t leaf (btsize t)+1 bnode t (bnode ta tb) (btsize t)+(btsize ta)+(btsize tb) end. 18 / 24
71 Limitations non-linear structure in pattern variables CFGV: Abhishek Anand and Vincent Rahli. A Generic Approach to Proofs about Substitution. In: LFMTP. Vienna, Austria: ACM, July 2014 t := x λx : t.t (t t) 18 / 24
72 Limitations non-linear structure in pattern variables CFGV: Abhishek Anand and Vincent Rahli. A Generic Approach to Proofs about Substitution. In: LFMTP. Vienna, Austria: ACM, July 2014 t := x λx : t.t (t t) 18 / 24
73 Limitations non-linear structure in pattern variables CFGV: Abhishek Anand and Vincent Rahli. A Generic Approach to Proofs about Substitution. In: LFMTP. Vienna, Austria: ACM, July 2014 t := x λx : t.t (t t) complex restrictions: e.g. A-normal form 18 / 24
74 Future Work Automation disjoint subset Domenico Cantone, Eugenio Omodeo, and Alberto Policriti. Set Theory for Computing. Monographs in Computer Science. New York, NY: Springer New York, / 24
75 Future Work Automation disjoint subset Domenico Cantone, Eugenio Omodeo, and Alberto Policriti. Set Theory for Computing. Monographs in Computer Science. New York, NY: Springer New York, 2001 De Bruijn Indices 19 / 24
76 Conclusion an abstract representation of terms define substitution and prove its properties once and for all 20 / 24
77 Conclusion an abstract representation of terms define substitution and prove its properties once and for all / 24
78 Rewriting Support x = α y 21 / 24
79 Rewriting Support x = α y disjoint (fvars (subst x sub)) lv 21 / 24
80 Rewriting Support x = α y disjoint (fvars (subst y sub)) lv 21 / 24
81 Well-formedness of terms Class GenericTermSig : Type := { Opid : Set; OpBindings : Opid list nat; opid dec : x y : Opid, {x = y} + {x y}; }. 22 / 24
82 Well-formedness λ(x.y) oterm lam [bterm [x] (vterm y) ] 23 / 24
83 Well-formedness λ(x.y)(z.w) oterm lam [bterm [x] (vterm y);bterm [z] (vterm w)] 23 / 24
84 Well-formedness λ(x.y) oterm lam [bterm [x] (vterm y) ] Inductive nt wf: Term Prop:= wfvt: nv : Var, nt wf (vterm nv) wfot: (o: Opid) (lbt: list BTerm), ( b, b lbt bt wf b) map (num bvars) lbt = OpBindings o nt wf (oterm o lbt) with bt wf : BTerm Prop := wfbt : (lv : list Var) (t: Term), nt wf nt bt wf (bterm lv nt). 23 / 24
85 VarType Class VarType (Var :Type) := { deq : x y : Var, {x = y} + {x y}; freshvars : (n:nat) (avoid : list Var), list Var; freshcorrect: (n:nat) (avoid : list Var), let lf := (freshvars n avoid) in no repeats lf disjoint lf avoid length lf = n }. 24 / 24
Proof Pearl: Substitution Revisited, Again
Proof Pearl: Substitution Revisited, Again Gyesik Lee Hankyong National University, Korea gslee@hknu.ac.kr Abstract. We revisit Allen Stoughton s 1988 paper Substitution Revisited and use it as our test
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 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 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 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 informationProgramming Language Features. CMSC 330: Organization of Programming Languages. Turing Completeness. Turing Machine.
CMSC 330: Organization of Programming Languages Lambda Calculus Programming Language Features Many features exist simply for convenience Multi-argument functions foo ( a, b, c ) Ø Use currying or tuples
More informationCMSC 330: Organization of Programming Languages
CMSC 330: Organization of Programming Languages Lambda Calculus CMSC 330 1 Programming Language Features Many features exist simply for convenience Multi-argument functions foo ( a, b, c ) Ø Use currying
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 informationIntroduction to Co-Induction in Coq
August 2005 Motivation Reason about infinite data-structures, Reason about lazy computation strategies, Reason about infinite processes, abstracting away from dates. Finite state automata, Temporal logic,
More informationFunctional programming languages
Functional programming languages Part VI: towards Coq mechanization Xavier Leroy INRIA Paris MPRI 2-4, 2016-2017 X. Leroy (INRIA) Functional programming languages MPRI 2-4, 2016-2017 1 / 58 Prologue: why
More informationSubstitution in Structural Operational Semantics and value-passing process calculi
Substitution in Structural Operational Semantics and value-passing process calculi Sam Staton Computer Laboratory University of Cambridge Abstract Consider a process calculus that allows agents to communicate
More informationInductive datatypes in HOL. lessons learned in Formal-Logic Engineering
Inductive datatypes in HOL lessons learned in Formal-Logic Engineering Stefan Berghofer and Markus Wenzel Institut für Informatik TU München = Isabelle λ β HOL α 1 Introduction Applications of inductive
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 informationCMSC 330: Organization of Programming Languages
CMSC 330: Organization of Programming Languages Lambda Calculus CMSC 330 Summer 2017 1 100 years ago Albert Einstein proposed special theory of relativity in 1905 In the paper On the Electrodynamics of
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 informationCMSC 330: Organization of Programming Languages. Lambda Calculus
CMSC 330: Organization of Programming Languages Lambda Calculus 1 100 years ago Albert Einstein proposed special theory of relativity in 1905 In the paper On the Electrodynamics of Moving Bodies 2 Prioritätsstreit,
More informationNominal Techniques in Coq
University of Copenhagen, DIKU HIPERFIT Workshop November 16, 2017 Names There are only two hard things in Computer Science: cache invalidation and naming things. Phil Karlton Names There are only two
More informationPure (Untyped) λ-calculus. Andrey Kruglyak, 2010
Pure (Untyped) λ-calculus Andrey Kruglyak, 2010 1 Pure (untyped) λ-calculus An example of a simple formal language Invented by Alonzo Church (1936) Used as a core language (a calculus capturing the essential
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 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 informationCMSC 330: Organization of Programming Languages. Lambda Calculus
CMSC 330: Organization of Programming Languages Lambda Calculus 1 Turing Completeness Turing machines are the most powerful description of computation possible They define the Turing-computable functions
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 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 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 informationAbstracting Syntax. ScholarlyCommons. University of Pennsylvania. Brian Aydemir University of Pennsylvania
University of Pennsylvania ScholarlyCommons Technical Reports (CIS) Department of Computer & Information Science January 2009 Abstracting Syntax Brian Aydemir University of Pennsylvania Stephan A. Zdancewic
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 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 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 informationSets in Coq, Coq in Sets
Sets in Coq, Coq in Sets Bruno Barras INRIA Saclay - Île de France The title of this article refers to Werner s Set in Types, Types in Sets [8]. Our initial goal was to build formally a model of the Calculus
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 informationM. Snyder, George Mason University LAMBDA CALCULUS. (untyped)
1 LAMBDA CALCULUS (untyped) 2 The Untyped Lambda Calculus (λ) Designed by Alonzo Church (1930s) Turing Complete (Turing was his doctoral student!) Models functions, always as 1-input Definition: terms,
More informationPure Lambda Calculus. Lecture 17
Pure Lambda Calculus Lecture 17 Lambda Calculus Lambda Calculus (λ-calculus) is a functional notation introduced by Alonzo Church in the early 1930s to formalize the notion of computability. Pure λ-calculus
More informationMutable References. Chapter 1
Chapter 1 Mutable References In the (typed or untyped) λ-calculus, or in pure functional languages, a variable is immutable in that once bound to a value as the result of a substitution, its contents never
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 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 informationProgramming Languages Lecture 14: Sum, Product, Recursive Types
CSE 230: Winter 200 Principles of Programming Languages Lecture 4: Sum, Product, Recursive Types The end is nigh HW 3 No HW 4 (= Final) Project (Meeting + Talk) Ranjit Jhala UC San Diego Recap Goal: Relate
More information> module Lambda where > import Data.List -- I need some standard list functions
Lecture 9 Lambda Calculus We now look at lambda calculus, the theoretical stuff that underlies functional programming. It was introduced by Alonzo Church to formalise two key concepts when dealing with
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 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 informationPrinted by Zach Tatlock Dec 08, 15 22:18 Page 1/11. Lemma subst_only_free: forall e1 e2 x e3, Subst e1 e2 x e3 > ~ free e1 x > e1 = e3. Proof.
Dec 08, 15 22:18 Page 1/11 Require Import List. Require Import ZArith. Require Import String. Open Scope string_scope. Ltac inv H := inversion H; subst. Ltac break_match := match goal with _ : context
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 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 informationLambda Calculus. Lecture 4 CS /26/10
Lambda Calculus Lecture 4 CS 565 10/26/10 Pure (Untyped) Lambda Calculus The only value is a function Variables denote functions Functions always take functions as arguments Functions always return functions
More informationIntroduction to lambda calculus Part 3
Introduction to lambda calculus Part 3 Antti-Juhani Kaijanaho 2017-01-27... 1 Untyped lambda calculus... 2 Typed lambda calculi In an untyped lambda calculus extended with integers, it is required that
More informationThe Untyped Lambda Calculus
Resources: The slides of this lecture were derived from [Järvi], with permission of the original author, by copy & x = 1 let x = 1 in... paste or by selection, annotation, or rewording. [Järvi] is in turn
More informationa brief introduction to (dependent) type theory
a brief introduction to (dependent) type theory Cory Knapp January 14, 2015 University of Birmingham what is type theory? What is type theory? formal language of terms with types x : A x has type A What
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 information1 Scope, Bound and Free Occurrences, Closed Terms
CS 6110 S18 Lecture 2 The λ-calculus Last time we introduced the λ-calculus, a mathematical system for studying the interaction of functional abstraction and functional application. We discussed the syntax
More informationFundamentals and lambda calculus. Deian Stefan (adopted from my & Edward Yang s CSE242 slides)
Fundamentals and lambda calculus Deian Stefan (adopted from my & Edward Yang s CSE242 slides) Logistics Assignments: Programming assignment 1 is out Homework 1 will be released tomorrow night Podcasting:
More informationCSE-321 Programming Languages 2014 Final
Name: Hemos ID: CSE-321 Programming Languages 2014 Final Problem 1 Problem 2 Problem 3 Problem 4 Problem 5 Problem 6 Total Score Max 15 12 14 14 30 15 100 There are six problems on 12 pages in this exam.
More informationFunctional programming languages
Functional programming languages Part I: interpreters and operational semantics Xavier Leroy INRIA Paris-Rocquencourt MPRI 2-4, 2016 2017 X. Leroy (INRIA) Functional programming languages MPRI 2-4, 2016
More informationAnalysis of dependent types in Coq through the deletion of the largest node of a binary search tree
Analysis of dependent types in Coq through the deletion of the largest node of a binary search tree Sneha Popley and Stephanie Weirich August 14, 2008 Abstract Coq reflects some significant differences
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 informationLambda Calculus and Extensions as Foundation of Functional Programming
Lambda Calculus and Extensions as Foundation of Functional Programming David Sabel and Manfred Schmidt-Schauß 29. September 2015 Lehrerbildungsforum Informatik Last update: 30. September 2015 Overview
More informationLambda Calculus: Implementation Techniques and a Proof. COS 441 Slides 15
Lambda Calculus: Implementation Techniques and a Proof COS 441 Slides 15 Last Time: The Lambda Calculus A language of pure functions: values e ::= x \x.e e e v ::= \x.e With a call-by-value operational
More informationProgramming Languages Fall 2014
Programming Languages Fall 2014 Lecture 7: Simple Types and Simply-Typed Lambda Calculus Prof. Liang Huang huang@qc.cs.cuny.edu 1 Types stuck terms? how to fix it? 2 Plan First I For today, we ll go back
More informationLecture 3: Typed Lambda Calculus and Curry-Howard
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
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 informationFormalization of First-Order Syntactic Unification
Downloaded from orbit.dtu.dk on: Jan 04, 2019 Formalization of First-Order Syntactic Unification Brandt, Kasper Fabæch; Schlichtkrull, Anders; Villadsen, Jørgen Published in: 32nd International Workshop
More informationOverview. A normal-order language. Strictness. Recursion. Infinite data structures. Direct denotational semantics. Transition semantics
Overview A normal-order language Strictness Recursion Infinite data structures Direct denotational semantics Transition semantics Lazy (call-by-need) evaluation and its semantics A Normal-Order Language
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 informationHarvard School of Engineering and Applied Sciences CS 152: Programming Languages. Lambda calculus
Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Tuesday, February 19, 2013 The lambda calculus (or λ-calculus) was introduced by Alonzo Church and Stephen Cole Kleene in
More informationReflecting Higher-Order Abstract Syntax in Nuprl
Reflecting Higher-Order Abstract Syntax in Nuprl Eli Barzilay and Stuart Allen Cornell University {eli,sfa}@cs.cornell.edu Abstract. This document describes part of an effort to achieve in Nuprl a practical
More informationCIS 500 Software Foundations Fall October 2
CIS 500 Software Foundations Fall 2006 October 2 Preliminaries Homework Results of my email survey: There was one badly misdesigned (PhD) problem and a couple of others that were less well thought through
More information5. Introduction to the Lambda Calculus. Oscar Nierstrasz
5. Introduction to the Lambda Calculus Oscar Nierstrasz Roadmap > What is Computability? Church s Thesis > Lambda Calculus operational semantics > The Church-Rosser Property > Modelling basic programming
More informationCS 4110 Programming Languages & Logics. Lecture 27 Recursive Types
CS 4110 Programming Languages & Logics Lecture 27 Recursive Types 4 November 2016 Announcements 2 My office hours are at the normal time today but canceled on Monday Guest lecture by Seung Hee Han on Monday
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 informationProgramming Languages Lecture 15: Recursive Types & Subtyping
CSE 230: Winter 2008 Principles of Programming Languages Lecture 15: Recursive Types & Subtyping Ranjit Jhala UC San Diego News? Formalize first-order type systems Simple types (integers and booleans)
More informationInductive prod (A B : Set) : Set := pair : A -> B -> prod A B. Inductive sum (A B : Set) : Set := inl : A -> sum A B inr : B -> sum A B.
Jacques Garrigue, 2013 5 10 1 Coq Inductive nat : Set := O S -> nat. Coq 1 Inductive prod (A B : Set) : Set := pair : A -> B -> prod A B. Inductive sum (A B : Set) : Set := inl : A -> sum A B inr : B ->
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 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 informationTheorem Proving Principles, Techniques, Applications Recursion
NICTA Advanced Course Theorem Proving Principles, Techniques, Applications Recursion 1 CONTENT Intro & motivation, getting started with Isabelle Foundations & Principles Lambda Calculus Higher Order Logic,
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 informationPart III. Chapter 15: Subtyping
Part III Chapter 15: Subtyping Subsumption Subtype relation Properties of subtyping and typing Subtyping and other features Intersection and union types Subtyping Motivation With the usual typing rule
More informationLambda Calculus alpha-renaming, beta reduction, applicative and normal evaluation orders, Church-Rosser theorem, combinators
Lambda Calculus alpha-renaming, beta reduction, applicative and normal evaluation orders, Church-Rosser theorem, combinators Carlos Varela Rennselaer Polytechnic Institute February 11, 2010 C. Varela 1
More informationLambda Calculi With Polymorphism
Resources: The slides of this lecture were derived from [Järvi], with permission of the original author, by copy & x = 1 let x = 1 in... paste or by selection, annotation, or rewording. [Järvi] is in turn
More informationTo arrive where we started: experience of mechanizing binding
To arrive where we started: experience of mechanizing binding Tom Ridge, University of Cambridge To arrive where we started: experience of mechanizing binding p.1/26 Experience of mechanizing binding type
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 information10 Years of Partiality and General Recursion in Type Theory
10 Years of Partiality and General Recursion in Type Theory Ana Bove Chalmers University of Technology DTP 10 July 9th 2010 Claims and Disclaims I know that I know nothing Socrates Ana Bove DTP 10 July
More informationThe Untyped Lambda Calculus
Resources: The slides of this lecture were derived from x = 1 [Järvi], with permission of the original author, by copy & let x = 1 in... paste or by selection, annotation, or rewording. [Järvi] is in turn
More informationAssistant for Language Theory. SASyLF: An Educational Proof. Corporation. Microsoft. Key Shin. Workshop on Mechanizing Metatheory
SASyLF: An Educational Proof Assistant for Language Theory Jonathan Aldrich Robert J. Simmons Key Shin School of Computer Science Carnegie Mellon University Microsoft Corporation Workshop on Mechanizing
More informationCMSC 330: Organization of Programming Languages
CMSC 330: Organization of Programming Languages Lambda Calculus CMSC 330 1 Programming Language Features Many features exist simply for convenience Multi-argument functions foo ( a, b, c ) Use currying
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 informationSoundness and principality of type inference for structural polymorphism
Soundness and principality of type inference for structural polymorphism TPP 08 2008.11.26 Jacques Garrigue Nagoya University http://www.math.nagoya-u.ac.jp/~garrigue/papers/ Jacques Garrigue Type inference
More informationc constructor P, Q terms used as propositions G, H hypotheses scope identifier for a notation scope M, module identifiers t, u arbitrary terms
Coq quick reference Meta variables Usage Meta variables Usage c constructor P, Q terms used as propositions db identifier for a hint database s string G, H hypotheses scope identifier for a notation scope
More informationCoq quick reference. Category Example Description. Inductive type with instances defined by constructors, including y of type Y. Inductive X : Univ :=
Coq quick reference Category Example Description Meta variables Usage Meta variables Usage c constructor P, Q terms used as propositions db identifier for a hint database s string G, H hypotheses scope
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 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 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 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 informationTyped Compilation Against Non-Manifest Base Classes
Typed Compilation Against Non-Manifest Base Classes Christopher League Long Island University christopher.league@liu.edu Stefan Monnier Université de Montréal monnier@iro.umontreal.ca FTfJP workshop 26
More informationConcepts of programming languages
Concepts of programming languages Lecture 5 Wouter Swierstra 1 Announcements Submit your project proposal to me by email on Friday; The presentation schedule in now online Exercise session after the lecture.
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 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 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 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 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 informationExtracting the Range of cps from Affine Typing
Extracting the Range of cps from Affine Typing Extended Abstract Josh Berdine, Peter W. O Hearn Queen Mary, University of London {berdine, ohearn}@dcs.qmul.ac.uk Hayo Thielecke The University of Birmingham
More informationThe Untyped Lambda Calculus
Resources: The slides of this lecture were derived from [Järvi], with permission of the original author, by copy & x = 1 let x = 1 in... paste or by selection, annotation, or rewording. [Järvi] is in turn
More information), where opid is the operator identifier. The p i :F i are parameters and the x i 1,..,xi m i :F 1. :F k. ,..,p k. }(x 1 1,..
Chapter 5 Editing Terms Terms in Nuprl are a general-purpose, uniform data-structure that serves two different purposes. Terms are used to represent Nuprl s object logic, that is the expressions and types
More information