Interoperation for Lazy and Eager Evaluation
|
|
- Darleen Griffith
- 5 years ago
- Views:
Transcription
1 Interoperation for Lazy and Eager Evaluation 1
2 Matthews & Findler New method of interoperation Type safety, observational equivalence & transparency Eager evaluation strategies Lazy vs. eager 2
3 Lambda calculus Typing Model Interoperation Laziness Solution 3
4 Syntax Expressions, e (1) x e v = λ x. e (2) M e λ x. M e e = x v e e (3) M, N e M N e 4
5 z by (1) (1) x (2) λ x. e (3) e e λ z. z by (1), (2) (λ z. z) (λ z. z) by (1), (2), (3) 5
6 Syntactic sugar λ x. x x λ x. (x x) (λ x. x) x λ x x. e λ x. λ x. e e e e (e e ) e 6
7 Semantics Reduction relation, e e e e e e e 7
8 (λ x. e) v e [ v / x ] e e e e e e e e e e e e e e v e v e e e v e v e 8
9 term [ term argument / term parameter ] = term x [ e / x ] = e x [ e / x ] = x (λ x. e) [ e / x ] = λ x. e (λ x. e) [ e / x ] = λ x. (e [ e / x ]) (e e ) [ e / x ] = (e [ e / x ]) (e [ e / x ]) 9
10 y λ y. ( y ) Free variable Bound variable y λ y. y Open term Closed term 10
11 Errors error condition error e e e e e e e error e e error e e v e v e e error v e error 11
12 Evaluation contexts, E E = [ ] E e v E E = [ ] E [ e ] = e E [ (λ x. e) v ] E [ e [ v / x ] ] E [ error condition ] error 12
13 v = λ x. e n e = x v e e +/- e e if0 e e e fun? e num? e wrong string E = [ ] E e v E +/- E e +/- v E if0 E e e fun? E num? E 13
14 E [ wrong string ] Error: string E [ + n n ] E [ n + n ] E [ - n n ] E [ max(n - n, 0) ] E [ if0 0 e e ] E [ e ] E [ if0 n e e ] E [ e ] E [ fun? (λ x. e) ] E [ 0 ] E [ fun? v ] E [ 1 ] E [ num? n ] E [ 0 ] E [ num? v ] E [ 1 ] 14
15 Lambda calculus Typing Model Interoperation Laziness Solution 15
16 Simple types Types, t t = N t t λ x : t. e t t t t (t t) 16
17 Judgments, e : t ( e, t ) Γ xn : tn,, x1 : t1 λ xn : tn. ( λ x1 : t1. e) Γ e : t e : t Γ t t 17
18 Number type N Function type Γ t Γ t Γ t t Number n : N Variable Γ, x : t x : t Function Γ, x : t e : t Γ λ x : t. e : t t Application Γ e : t t Γ e : t Γ e e : t 18
19 Arithmetic Γ e : N Γ e : N Γ +/- e e : N Condition Γ e : N Γ e /e : t Γ if0 e e e : t Error Γ t Γ wrong t string : t 19
20 Closed-term typing Type Γ T Number Γ n : T Variable Γ, x : T x : T Application Γ e : T Γ e : T Γ e e : T 20
21 Function Γ, x : T e : T Γ λ x. e : T Arithmetic Γ e : T Γ e : T Γ +/- e e Predicate Γ e : T Γ fun?/num? e : T Error Γ wrong string : T 21
22 Type abstraction Type variable y Universally-quantified types y. t Type abstraction Λ y. e Free & bound type variables Λ y. ( y ) Type application e t 22
23 Syntactic sugar Λ y y. e Λ y. Λ y. e e t t (e t ) t 23
24 Semantics E [ (Λ y. e) t ] E [ e [ t / y ] ] 24
25 Type-in-term substitution term [ type argument / type parameter ] = term x [ t / y ] = x (λ x : t. e) [ t / y ] = λ x : t [ t / y ]. e [ t / y ] (e e ) [ t / y ] = (e [ t / y ]) (e [ t / y ]) (+/- e e ) [ t / y ] = +/- (e [ t / y ]) (e [ t / y]) 25
26 if0 (e [ t / y ]) (if0 e e e ) [ t / y ] = if0 (e [ t / y ]) if0 (e [ t / y ]) (Λ y. e) [ t / y ] = Λ y. e (Λ y. e) [ t / y ] = Λ y. e [ t / y ] (e t ) [ t / y ] = (e [ t / y ]) t [ t / y ] 26
27 Type-in-type substitution type [ type argument / type parameter ] = type N [ t / y ] = N (t t ) [ t / y ] = t [ t / y ] t [ t / y ] y [ t / y ] = t y [ t / y ] = y 27
28 ( y. t) [ t / y ] = y. t ( y. t) [ t / y ] = y. t [ t / y ] 28
29 Lambda calculus Typing Model Interoperation Laziness Solution 29
30 ML & Scheme Numbers, arithmetic & conditions Function abstractions & applications Errors Eager evaluation Language subscripts m and s for nonterminals 30
31 ML Statically typed Parametric polymorphism 31
32 ML syntax tm = N ym tm tm ym. tm vm = n λ xm : tm. em Λ ym. em em = x m vm em em em tm +/- em em if0 em em em wrong tm string Em = [ ] m Em em vm Em Em tm +/- Em em +/- vm Em if0 Em em em 32
33 Scheme Dynamically typed Closed-term typing Ad-hoc polymorphism 33
34 Scheme syntax vs = n λ xs. es es = x s vs es es +/- es es if0 es es es fun? es num? es wrong string Es = [ ] s Es es vs Es +/- Es es +/- vs Es if0 Es es es fun? Es num? Es 34
35 Lambda calculus Typing Model Interoperation Laziness Solution 35
36 Syntax Converting from Scheme to ML em = ms tm es Em = ms tm Es Converting from ML to Scheme es = sm tm em Es = sm tm Em 36
37 Typing ML Scheme Γ m tm Γ s es : T Γ m ms tm es : tm Scheme ML Γ m tm Γ m em : tm tm = tm Γ s sm tm em : T 37
38 Converting numbers Outermost evaluation context, E E [ ms N n ]m E [ n ] E [ sm N n ]s E [ n ] E [ ms N vs ]m E [ wrong N Not a number ] 38
39 Converting functions es Fs es 39
40 Fm Fs em : tm es es em : tm tm tm 40
41 Fm Fs em : tm es es em : tm m s s m tm tm 41
42 Fm em : tm em : tm tm tm 42
43 Convert from ML to Scheme sm sm tm xm Apply the Scheme function app Fs sm Convert from Scheme to ML ms ms tm app Abstract the ML argument Fm λ xm : tm. ms Converted Scheme function in ML Fm λ xm : tm. ms tm (Fs (sm tm xm)) 43
44 E [ ms (tm tm ) (λ xs. es) ]m E [ λ xm : tm. ms tm ((λ xs. es) (sm tm xm)) ] E [ sm (tm tm ) vm ]s E [ λ xs. sm tm (vm (ms tm xs)) ] E [ ms (tm tm ) vs ]m E [ wrong (tm tm ) Not a function ] 44
45 (ms tm ((λ xs. es) (sm tm xm))) [ em / xm ] ML Scheme em xm 45
46 Boundary substitution (ms tm es) [ em / xm ] = ms tm (es [ em / xm ]) Foreign substitution ( es ) [ em / xm ] = es [ em / xm ] (sm tm em) [ em / xm ] = sm tm (em [ em / xm ]) 46
47 Converting type abstractions tm = L Γ m L vm = ms L vs E [ sm ( ym. tm) (Λ ym. em) ]s E [ sm tm [ L / ym ] em [ L / ym ] ] E [ sm L (ms L vs) ]s E [ vs ] 47
48 id Λ y. ms (y y) (λ x. x) id N behaves the same as id N N idm Λ y. ms (y y) (λ x. if0 (num? x) x 0) idm N behaves differently than idm N N 48
49 Conversion schemes idgood Λ y. ms (y y) (λ x. x) idgood N behaves the same as idgood N N idbad Λ y. ms (y y) (λ x. if0 (num? x) x 0) idbad N behaves differently than idbad N N 49
50 Conversion schemes, k km = L N ym km km ym. km b tm em = ms km es es = sm km em vs = sm km vm 50
51 Γ m km Γ s es : T Γ m ms km es : km E [ (Λ ym. em) tm ]m E [ em [ b tm / ym ] ] E [ ms (b tm) (sm (b tm) vm) ]m E [ vm ] E [ ms (b tm) vs ]m E [ wrong b tm Brand mismatch ] 51
52 b tm = tm L = L N = N ym = ym km km = km km ym. km = ym. km 52
53 (λ xm : tm. em) [ b tm / ym ] = λ xm : tm [ tm / ym ]. em [ b tm / ym ] (ms km es) [ b tm / ym ] = ms km [ b tm / ym ] es [ b tm / ym ] 53
54 Lambda calculus Typing Model Interoperation Laziness Solution 54
55 Haskell Eager vs. lazy evaluation Add Haskell to the mix Interoperation forces Haskell evaluation Applying converted functions in Haskell Converting values from Haskell Observational equivalence and transparency do not hold 55
56 Haskell syntax th = N yh th th yh. th kh = L N yh kh kh yh. kh b th vh = n λ xh : th. eh Λ yh. eh hs L vs eh = x h vh eh eh eh th +/- eh eh if0 eh eh eh wrong th string Eh = [ ] h Eh eh Eh th +/- Eh eh +/- vh Eh if0 Eh eh eh 56
57 Interoperation syntax eh = hm th tm em hs kh es em = mh tm th eh es = sh kh eh vh = hs L vs vs = sh kh eh 57
58 Eh = hm th tm Em hs kh Es Em = mh tm th Eh Es = sh kh Eh 58
59 Applying functions zeros λ x. 0 h zeroh : N N zeroh hs (N N) zeros broken wrong N Broken zeroh broken 0 zeroh broken * Error: Broken 59
60 zeroh broken (hs (N N) zeros) broken (λ x : N. hs N (zeros (sh N x))) broken hs N (zeros (sh N broken)) Error: Broken 60
61 Converting values eh = nil th cons eh eh hd eh tl eh null? eh th = { th } kh = { kh } Eh = hd Eh tl Eh null? Eh 61
62 Γ h th Γ h { th } Γ h eh : { th } Γ h hd eh : th Γ h th Γ h nil th : { th } Γ h eh : { th } Γ h tl eh : { th } Γ h eh : { th } Γ h null? eh : N Γ h eh : th Γ h eh : { th } Γ h cons eh eh : { th } 62
63 E [ hd (nil th) ]h E [ wrong th Empty list ] E [ hd (cons eh eh ) ]h E [ eh ] E [ tl (nil th) ]h E [ wrong { th } Empty list ] E [ tl (cons eh eh ) ]h E [ eh ] E [ null? (nil th) ]h E [ 0 ] E [ null? (cons eh eh ) ]h E [ 1 ] 63
64 E [ hs { th } nil ]h E [ nil th ] E [ hs { th } (cons vs vs ) ]h E [ cons (hs th vs) (hs { th } vs ] ] 64
65 vm = nil tm cons vm vm vs = nil cons vs vs Em = cons Em em cons vm Em Es = cons Es es cons vs Es 65
66 brokenh wrong N Broken emptyh nil N listh cons brokenh emptyh lists sh {N} listh lists cons brokens emptys lists * Error: Broken 66
67 lists sh {N} (cons brokenh emptyh) cons (sh N brokenh) (sh {N} emptyh) Error: Broken 67
68 Haskell & ML E [ hm ( yh. th) ( ym. tm) (Λ ym. em) ]h E [ Λ yh. hm th (tm [ L / ym ]) (em [ L / ym ]) ] vh = hm L tm vm vm = mh L th eh 68
69 Γ h th Γ m tm th tm Γ m em : tm tm = tm Γ h hm th tm em : th 69
70 x x x y y x x y y z x z th L tm L th = tm th tm 70
71 Lambda calculus Typing Model Interoperation Laziness Solution 71
72 Problematic contexts Applying converted functions in Haskell hs N (zeros (sh N broken)) vs Es Converting values from Haskell cons (sh N brokenh) ( ) cons Es es 72
73 Es = [ ]s num? Es Es es if0 Es es es vs Es cons Es es +/- Es es cons vs Es +/- vs Es hd Es fun? Es list? Es null? Es tl Es sh kh Eh sm km Em 73
74 Restrict forcing Rename Es to Us (unforced) Us = Es Factor Scheme Haskell out of Us (forced) Fs = Us sh kh Eh Rename vs to us (unforced) us = vs Factor Scheme Haskell out of us (forced) fs = us sh kh eh 74
75 Redefine Us in terms of Us, Fs, us, fs Us es Us = us Us cons Us es cons us Us 75
76 Redefine Us in terms of Us, Fs, us, fs Fs es Us = fs Us cons Us es cons us Us 76
77 Fm = Um mh tm th Eh Us = [ ]s fun? Fs cons Us es Fs es list? Fs cons us Us fs Es null? Fs hd Fs +/- Fs es num? Fs tl Fs +/- fs Fs if0 Fs es es sh kh Eh sm km Em 77
78 Rename E to F F [ (λ xm : tm. em) um ]m F [ em [um / xm] ] F [ hd (cons um um ) ]m F [ um ] F [ tl (cons um um ) ]m F [ um ] F [ null (cons um um ) ]m F [ 1 ] 78
79 Solution For incompatible evaluation contexts Mirrors laziness for Haskell boundaries Controls the forcing of Haskell evaluation Restores observational equivalence and transparency 79
80 Summary Matthews & Findler Lazy vs. eager Observational equivalence and transparency Incompatible evaluation contexts Laziness mirrored in eager evaluation 80
81 Questions 81
INTEROPERATION FOR LAZY AND EAGER EVALUATION. A Thesis. Presented to. the Faculty of California Polytechnic State University.
INTEROPERATION FOR LAZY AND EAGER EVALUATION A Thesis Presented to the Faculty of California Polytechnic State University San Luis Obispo In Partial Fulfillment of the Requirements for the Degree Master
More informationStructure. Background. them to their higher order equivalents. functionals in Standard ML source code and converts
Introduction 3 Background functionals factor out common behaviour map applies a function to every element of a list fun map [ ] = [ ] map f ( x : : xs ) = f x : : map f xs filter keeps only those elements
More informationSimply Typed Lambda Calculus
Simply Typed Lambda Calculus Language (ver1) Lambda calculus with boolean values t ::= x variable x : T.t abstraction tt application true false boolean values if ttt conditional expression Values v ::=
More informationRecitation 2: Binding, Semantics, and Safety : Foundations of Programming Languages
Recitation 2: Binding, Semantics, and Safety 15-312: Foundations of Programming Languages Charles Yuan, Jeanne Luning Prak September 5, 2018 1 Abstract Binding Trees The abstract syntax trees we saw previously
More informationSimply Typed Lambda Calculus
Simply Typed Lambda Calculus Mathias Vorreiter Pedersen November 13, 2015 1 Recalling the untyped lambda calculus 1.1 Syntax t ::= x λ x. t t t 1.2 Evaluation x x t t λx.t λx.t t 1 t 1 t 2 t 2 t 1 t 2
More informationA Calculus of Definitions
A Calculus of Definitions June 13, 2017 1 Type theory We describe how to implement a core type theory. This is very close to a functional programming language with λ abstraction and data types defined
More informationIntroduction to lambda calculus Part 6
Introduction to lambda calculus Part 6 Antti-Juhani Kaijanaho 2017-02-16 1 Untyped lambda calculus 2 Typed lambda calculi 2.1 Dynamically typed lambda calculus with integers 2.2 A model of Lisp 2.3 Simply
More informationExtending the Lambda Calculus: An Eager Functional Language
Syntax of the basic constructs: Extending the Lambda Calculus: An Eager Functional Language canonical forms z cfm ::= intcfm boolcfm funcfm tuplecfm altcfm intcfm ::= 0 1-1... boolcfm ::= boolconst funcfm
More informationTyping λ-terms. Types. Typed λ-terms. Base Types. The Typing Relation. Advanced Formal Methods. Lecture 3: Simply Typed Lambda calculus
Course 2D1453, 200607 Advanced Formal Methods Lecture 3: Simply Typed Lambda calculus Mads Dam KTH/CSC Some material from B. Pierce: TAPL + some from G. Klein, NICTA Typing λterms The uptyped λcalculus
More information1 Introduction. 2 Recap The Typed λ-calculus λ. 3 Simple Data Structures
CS 6110 S18 Lecture 21 Products, Sums, and Other Datatypes 1 Introduction In this lecture, we add constructs to the typed λ-calculus that allow working with more complicated data structures, such as pairs,
More informationCMSC 336: Type Systems for Programming Languages Lecture 10: Polymorphism Acar & Ahmed 19 February 2008
CMSC 336: Type Systems for Programming Languages Lecture 10: Polymorphism Acar & Ahmed 19 February 2008 Contents 1 Polymorphism 1 2 Polymorphic λ-calculus: Syntax 1 3 Static Semantics 2 4 Dynamic Semantics
More informationMathematical Synthesis of Equational Deduction Systems. Marcelo Fiore. Computer Laboratory University of Cambridge
Mathematical Synthesis of Equational Deduction Systems Marcelo Fiore Computer Laboratory University of Cambridge TLCA 2009 3.VII.2009 Context concrete theories meta-theories Context concrete theories meta-theories
More informationLimitations of OCAML records
Limitations of OCAML records The record types must be declared before they are used; a label e can belong to only one record type (otherwise fun x x.e) would have several incompatible types; we cannot
More informationThe Lifting Lemma. Ralf Hinze
The Lifting Lemma Ralf Hinze Computing Laboratory, University of Oxford Wolfson Building, Parks Road, Oxford, OX1 3QD, England ralf.hinze@comlab.ox.ac.uk http://www.comlab.ox.ac.uk/ralf.hinze/ June 2009
More informationType Soundness for Path Polymorphism
Type Soundness for Path Polymorphism Andrés Ezequiel Viso 1,2 joint work with Eduardo Bonelli 1,3 and Mauricio Ayala-Rincón 4 1 CONICET, Argentina 2 Departamento de Computación, FCEyN, UBA, Argentina 3
More informationRank-2 intersection for recursive definitions
Fundamenta Informaticae XXI (2001) 1001 1044 1001 IOS Press Rank-2 intersection for recursive definitions Ferruccio Damiani Dipartimento di Informatica Università di Torino Corso Svizzera 185, I-10149
More informationType Systems. Today. 1. What is the Lambda Calculus. 1. What is the Lambda Calculus. Lecture 2 Oct. 27th, 2004 Sebastian Maneth
Today 1. What is the Lambda Calculus? Type Systems 2. Its Syntax and Semantics 3. Church Booleans and Church Numerals 4. Lazy vs. Eager Evaluation (call-by-name vs. call-by-value) Lecture 2 Oct. 27th,
More informationElaborating evaluation-order polymorphism
Elaborating evaluation-order polymorphism Joshua Dunfield University of British Columbia ICFP 2015 1 (prologue) ICFP in Canada for the first time since 2008 2 (prologue) ICFP in Canada for the first time
More informationBeyond First-Order Logic
Beyond First-Order Logic Software Formal Verification Maria João Frade Departmento de Informática Universidade do Minho 2008/2009 Maria João Frade (DI-UM) Beyond First-Order Logic MFES 2008/09 1 / 37 FOL
More informationThe λ-calculus and Curry s Paradox Drew McDermott , revised
The λ-calculus and Curry s Paradox Drew McDermott drew.mcdermott@yale.edu 2015-09-23, revised 2015-10-24 The λ-calculus was invented by Alonzo Church, building on earlier work by Gottlob Frege and Moses
More informationBicubical Directed Type Theory
Bicubical Directed Type Theory Matthew Weaver General Examination May 7th, 2018 Advised by Andrew Appel and Dan Licata Bicubical Directed Type Theory Bicubical directed type theory is a constructive model
More informationType Inference. For the Simply-Typed Lambda Calculus. Peter Thiemann, Manuel Geffken. Albert-Ludwigs-Universität Freiburg. University of Freiburg
Type Inference For the Simply-Typed Lambda Calculus Albert-Ludwigs-Universität Freiburg Peter Thiemann, Manuel Geffken University of Freiburg 24. Januar 2013 Outline 1 Introduction 2 Applied Lambda Calculus
More informationAn extension of HM(X) with bounded existential and universal data-types
Groupe de travail Cristal July, 2003 An extension of HM(X) with bounded existential and universal data-types (To appear at ICFP 03) Vincent Simonet INRIA Rocquencourt Cristal project Vincent.Simonet@inria.fr
More informationLecture Notes on Data Abstraction
Lecture Notes on Data Abstraction 15-814: Types and Programming Languages Frank Pfenning Lecture 14 October 23, 2018 1 Introduction Since we have moved from the pure λ-calculus to functional programming
More informationCMSC 631 Program Analysis and Understanding Fall Type Systems
Program Analysis and Understanding Fall 2017 Type Systems Type Systems A type system is a tractable syntactic method for proving the absence of certain program behaviors by classifying phrases according
More informationProgramming Languages and Types
Programming Languages and Types Klaus Ostermann based on slides by Benjamin C. Pierce Subtyping Motivation With our usual typing rule for applications the term is not well typed. ` t 1 : T 11!T 12 ` t
More informationVerified Characteristic Formulae for CakeML. Armaël Guéneau, Magnus O. Myreen, Ramana Kumar, Michael Norrish April 18, 2017
Verified Characteristic Formulae for CakeML Armaël Guéneau, Magnus O. Myreen, Ramana Kumar, Michael Norrish April 18, 2017 CakeML Has: references, modules, datatypes, exceptions, a FFI,... Doesn t have:
More informationLectures on The Lambda Calculus (I)
Lectures on The Lambda Calculus (I) Masahiko Sato Graduate School of Informatics, Kyoto University Autumn school Proof and Computation Fischbachau, Germany October 4, 2016 Overview In these lectures, I
More information1 Problem 1. (20 pts)
CS 336 Programming Languages Homework Solution 4 Winter 2005 Due 2/24/05 1 Problem 1. (20 pts) Do Exercise 18.6.2. We define a meta-operation + on types as follows: If R is a record type with labels given
More informationPrinciples of Program Analysis: Control Flow Analysis
Principles of Program Analysis: Control Flow Analysis Transparencies based on Chapter 3 of the book: Flemming Nielson, Hanne Riis Nielson and Chris Hankin: Principles of Program Analysis. Springer Verlag
More informationType Systems. Lecture 2 Oct. 27th, 2004 Sebastian Maneth.
Type Systems Lecture 2 Oct. 27th, 2004 Sebastian Maneth http://lampwww.epfl.ch/teaching/typesystems/2004 Today 1. What is the Lambda Calculus? 2. Its Syntax and Semantics 3. Church Booleans and Church
More informationType Systems Winter Semester 2006
Type Systems Winter Semester 2006 Week 7 November 29 November 29, 2006 - version 1.0 Plan PREVIOUSLY: 1. type safety as progress and preservation 2. typed arithmetic expressions 3. simply typed lambda
More informationTHE UNIVERSITY OF CALGARY FACULTY OF SCIENCE FINAL EXAMINATION COMPUTER SCIENCE 521
P. 1 of 7 THE UNIVERSITY OF CALGARY FACULTY OF SCIENCE FINAL EXAMINATION COMPUTER SCIENCE 521 December, 2014 Time: 2 hrs. Instructions The exam contains questions totaling 100 points. Answer all questions.
More informationProgramming Languages Fall 2013
Programming Languages Fall 2013 Lecture 11: Subtyping Prof Liang Huang huang@qccscunyedu Big Picture Part I: Fundamentals Functional Programming and Basic Haskell Proof by Induction and Structural Induction
More informationLazy Strong Normalization
Lazy Strong Normalization Luca Paolini 1,2 Dipartimento di Informatica Università di Torino (ITALIA) Elaine Pimentel 1,2 Departamento de Matemática Universidade Federal de Minas Gerais (BRASIL) Dipartimento
More informationRoy L. Crole. Operational Semantics Abstract Machines and Correctness. University of Leicester, UK
Midlands Graduate School, University of Birmingham, April 2008 1 Operational Semantics Abstract Machines and Correctness Roy L. Crole University of Leicester, UK Midlands Graduate School, University of
More informationPredicate Logic. Xinyu Feng 09/26/2011. University of Science and Technology of China (USTC)
University of Science and Technology of China (USTC) 09/26/2011 Overview Predicate logic over integer expressions: a language of logical assertions, for example x. x + 0 = x Why discuss predicate logic?
More informationDependent types. Paul Stansifer. March 16, 2012
Dependent types Paul Stansifer March 16, 2012 1 You ve seen this before I hope you like abstraction, because we re about to use it a lot. Here s the simply-typed lambda calculus with built-in list operations
More informationKleene realizability and negative translations
Q E I U G I C Kleene realizability and negative translations Alexandre Miquel O P. D E. L Ō A U D E L A R April 21th, IMERL Plan 1 Kleene realizability 2 Gödel-Gentzen negative translation 3 Lafont-Reus-Streicher
More informationTHE UNIVERSITY OF CALGARY FACULTY OF SCIENCE FINAL EXAMINATION COMPUTER SCIENCE 521
P. 1 of 7 THE UNIVERSITY OF CALGARY FACULTY OF SCIENCE FINAL EXAMINATION COMPUTER SCIENCE 521 December, 2016 Time: 2 hrs. Instructions The exam contains questions totaling 100 points. Answer all questions.
More informationTaming Selective Strictness
Taming Selective Strictness Daniel Seidel and Janis Voigtländer Technische Universität Dresden, 01062 Dresden, Germany {seideld,voigt}@tcs.inf.tu-dresden.de Abstract: Free theorems establish interesting
More informationCall by Effect. Kevin Ellis. Catlin Gabel
Call by Effect Kevin Ellis Catlin Gabel Abstract. Evaluation strategies specify rules for evaluation of terms in a programming language. That the choice of evaluation strategy affects the expressiveness
More informationProgramming Language Concepts, CS2104 Lecture 3
Programming Language Concepts, CS2104 Lecture 3 Statements, Kernel Language, Abstract Machine 31 Aug 2007 CS2104, Lecture 3 1 Reminder of last lecture Programming language definition: syntax, semantics
More informationTyped Arithmetic Expressions
Typed Arithmetic Expressions CS 550 Programming Languages Jeremy Johnson TAPL Chapters 3 and 5 1 Types and Safety Evaluation rules provide operational semantics for programming languages. The rules provide
More informationANSWER KEY. Page 1 Page 2 cake key pie boat glue cat sled pig fox sun dog fish zebra. Page 3. Page 7. Page 6
P 1 P 2 y sd fx s d fsh z ys P 3 P 4 my, ms, m, m, m, m P 6 d d P 7 m y P 5 m m s P 10 y y y P 8 P 9 s sh, s, ss, sd sds, s, sh sv s s P 11 s P 12,, m, m, m,, dd P 13 m f m P 18 h m s P 22 f fx f fsh fm
More informationNormalisation by Evaluation for Dependent Types
Normalisation by Evaluation for Dependent Types Ambrus Kaposi Eötvös Loránd University, Budapest, Hungary (j.w.w. Thorsten Altenkirch, University of Nottingham) FSCD, Porto 24 June 2016 Introduction Goal:
More informationMeta-Circularity, and Vice-Versa
1/60, and Vice-Versa didier@lrde.epita.fr http://www.lrde.epita.fr/ didier ACCU 2011 Thursday, April 14th 2/60 Table of contents 1 2 Symbolic Expressions 3 The of LISP 4 5 6 7 8 Dynamic 9 4/60 circularity
More informationPredicate Logic. Xinyu Feng 11/20/2013. University of Science and Technology of China (USTC)
University of Science and Technology of China (USTC) 11/20/2013 Overview Predicate logic over integer expressions: a language of logical assertions, for example x. x + 0 = x Why discuss predicate logic?
More informationParametric Polymorphism and Operational Improvement
Parametric Polymorphism and Operational Improvement JENNIFER HACKETT, University of Nottingham, UK GRAHAM HUTTON, University of Nottingham, UK Parametricity, in both operational and denotational forms,
More informationNunchaku: Flexible Model Finding for Higher-Order Logic
Nunchaku: Flexible Model Finding for Higher-Order Logic Simon Cruanes, Jasmin Blanchette, Andrew Reynolds Veridis, Inria Nancy https://cedeela.fr/~simon/ April 7th, 2016 1 / 21 Summary Introduction Nunchaku
More informationCOMP6463: λ-calculus
COMP6463: λ-calculus 1. Basics Michael Norrish Michael.Norrish@nicta.com.au Canberra Research Lab., NICTA Semester 2, 2015 Outline Introduction Lambda Calculus Terms Alpha Equivalence Substitution Dynamics
More informationLambda Calculus! Gunnar Gotshalks! LC-1
Lambda Calculus! LC-1 λ Calculus History! Developed by Alonzo Church during mid 1930 s! One fundamental goal was to describe what can be computed.! Full definition of λ-calculus is equivalent in power
More informationSimple Type Extensions
Simple Type Extensions Type Systems, Lecture 4 Jevgeni Kabanov Tartu, 14.02.2006 PREVIOUSLY ON TYPE SYSTEMS Lambda Calculus Embedded Booleans and Arithmetical expressions Fixpoints and Recursion Simple
More informationLambda Calculus. Andrés Sicard-Ramírez. Semester Universidad EAFIT
Lambda Calculus Andrés Sicard-Ramírez Universidad EAFIT Semester 2010-2 Bibliography Textbook: Hindley, J. R. and Seldin, J. (2008). Lambda-Calculus and Combinators. An Introduction. Cambridge University
More information3.2 Equivalence, Evaluation and Reduction Strategies
3.2 Equivalence, Evaluation and Reduction Strategies The λ-calculus can be seen as an equational theory. More precisely, we have rules i.e., α and reductions, for proving that two terms are intensionally
More informationThe Lambda Calculus. Stephen A. Edwards. Fall Columbia University
The Lambda Calculus Stephen A. Edwards Columbia University Fall 2014 Lambda Expressions Function application written in prefix form. Add four and five is (+ 4 5) Evaluation: select a redex and evaluate
More informationA Logic Primer. Stavros Tripakis University of California, Berkeley. Stavros Tripakis (UC Berkeley) EE 144/244, Fall 2014 A Logic Primer 1 / 35
EE 144/244: Fundamental Algorithms for System Modeling, Analysis, and Optimization Fall 2014 A Logic Primer Stavros Tripakis University of California, Berkeley Stavros Tripakis (UC Berkeley) EE 144/244,
More informationOutline. A recursive function follows the structure of inductively-defined data.
Outline A recursive function follows the structure of inductively-defined data. With lists as our example, we shall study 1. inductive definitions (to specify data) 2. recursive functions (to process data)
More informationLambda-Calculus (I) 2nd Asian-Pacific Summer School on Formal Methods Tsinghua University, August 23, 2010
Lambda-Calculus (I) jean-jacques.levy@inria.fr 2nd Asian-Pacific Summer School on Formal Methods Tsinghua University, August 23, 2010 Plan computation models lambda-notation bound variables conversion
More informationHigh-Level Small-Step Operational Semantics for Transactions (Technical Companion)
High-Level Small-Step Operational Semantics for Transactions (Technical Companion) Katherine F. Moore, Dan Grossman July 15, 2007 Abstract This document is the technical companion to our POPL 08 submission
More informationThe lambda calculus with constructors
The lambda calculus with constructors Categorical semantic and Continuations Barbara Petit Focus - Univ. Bologna CaCos 2012 Barbara Petit (Focus - Univ. Bologna) The lambda calculus with constructors 1
More informationMath 128: Lecture 4. March 31, 2014
Math 128: Lecture 4 March 31, 2014 Recall if g is a Lie algebra with modules M and N, then x g acts on m n M N by x(m n) = xm n + m xn. So (x) = x 1 + 1 x Ug Ug. Recall if g is a Lie algebra with modules
More informationNotes from Yesterday s Discussion. Big Picture. CIS 500 Software Foundations Fall November 1. Some lessons.
CIS 500 Software Foundations Fall 2006 Notes from Yesterday s Email Discussion November 1 Some lessons This is generally a crunch-time in the semester Slow down a little and give people a chance to catch
More informationA Logic Primer. Stavros Tripakis University of California, Berkeley
EE 144/244: Fundamental Algorithms for System Modeling, Analysis, and Optimization Fall 2015 A Logic Primer Stavros Tripakis University of California, Berkeley Stavros Tripakis (UC Berkeley) EE 144/244,
More informationSubtyping and Intersection Types Revisited
Subtyping and Intersection Types Revisited Frank Pfenning Carnegie Mellon University International Conference on Functional Programming (ICFP 07) Freiburg, Germany, October 1-3, 2007 Joint work with Rowan
More informationSemantics of Higher-Order Functional Programming
Semantics of Higher-Order Functional Programming Petros Barbagiannis µ λ July 14, 2014 Petros Barbagiannis Semantics of Higher-Order Functional Programming July 14, 2014 1 / 18 Introduction Higher-order
More informationThe Suspension Notation as a Calculus of Explicit Substitutions
The Suspension Notation as a Calculus of Explicit Substitutions Gopalan Nadathur Digital Technology Center and Department of Computer Science University of Minnesota [Joint work with D.S. Wilson and A.
More informationMary Southern and Gopalan Nadathur. This work was funded by NSF grant CCF
A Translation-Based Animation of Dependently-Typed Specifications From LF to hohh(and back again) Mary Southern and Gopalan Nadathur Department of Computer Science and Engineering University of Minnesota
More informationM, N ::= x λp : A.M MN (M, N) () c A. x : b p x : b
A PATTERN-MATCHING CALCULUS FOR -AUTONOMOUS CATEGORIES ABSTRACT. This article sums up the details of a linear λ-calculus that can be used as an internal language of -autonomous categories. The coherent
More informationContracts made manifest
JFP: page 1 of 50. c Cambridge University Press 2012 doi:10.1017/s0956796812000135 1 Contracts made manifest MICHAEL GREENBERG, BENJAMIN C. PIERCE and STEPHANIE WEIRICH University of Pennsylvania, Philadelphia,
More informationDeductive Verification
Deductive Verification Mooly Sagiv Slides from Zvonimir Rakamaric First-Order Logic A formal notation for mathematics, with expressions involving Propositional symbols Predicates Functions and constant
More informationEquivalent Computers. Lecture 39: Lambda Calculus. Lambda Calculus. What is Calculus? Real Definition. Why?
#,, - Lecture 39: Lambda Calculus Equivalent Computers z z z... term = variable term term (term) λ variable. term λy. M α λv. (M [y α v]) where v does not occur in M. (λx. M)N β M [ x α N ] Turing Machine
More informationCS522 - Programming Language Semantics
1 CS522 - Programming Language Semantics Simply Typed Lambda Calculus Grigore Roşu Department of Computer Science University of Illinois at Urbana-Champaign 2 We now discuss a non-trivial extension of
More informationContracts Made Manifest
University of Pennsylvania ScholarlyCommons Departmental Papers (CIS) Department of Computer & Information Science 5-1-2012 Contracts Made Manifest Michael Greenberg University of Pennsylvania Benjamin
More informationDomain Specific Languages of Mathematics
Domain Specific Languages of Mathematics Cezar Ionescu cezar@chalmers.se Patrik Jansson patrikj@chalmers.se The problem Many Computer Science students seem to have difficulties with real and complex analysis.
More informationNormalization by Evaluation
Normalization by Evaluation Andreas Abel Department of Computer Science and Engineering Chalmers and Gothenburg University PhD Seminar in Mathematical Engineering EAFIT University, Medellin, Colombia 9
More informationRemote Sensing Applications for the Historic Environment
m S App H Em L H Em m S 4 C B P m k m m. B m S App H Em L H Em m S 4 m C A Im H Em. B m m H Lp U S D m S C U P m k B m S App H Em L H Em m S 4 m A m A W k? A pp :. Tpp. Px. mk.. S S mk.. Cp S mk B m m
More informationIntermediate Logic Spring. Second-Order Logic
Intermediate Logic Spring Lecture Five Second-Order Logic Rob Trueman rob.trueman@york.ac.uk University of York 1 / 47 Introduction Second-Order Logic Introduction The Language of SOL Introduction and
More informationReview. Principles of Programming Languages. Equality. The Diamond Property. The Church-Rosser Theorem. Corollaries. CSE 230: Winter 2007
CSE 230: Winter 2007 Principles of Programming Languages Lecture 12: The λ-calculus Ranjit Jhala UC San Diego Review The lambda calculus is a calculus of functions: e := x λx. e e 1 e 2 Several evaluation
More informationBackwards Strictness Analysis: Proved and Improved. Kei Davis. Philip Wadler. University of Glasgow. Glasgow G12 8QQ. Abstract
Backwards Strictness Analysis: Proved and Improved Kei Davis Philip Wadler Dept. of Computing Science University of Glasgow Glasgow G12 8QQ United Kingdom Abstract Given a syntax tree representing an expression,
More informationA Simple Semantics and Static Analysis for Java Security
A Simple Semantics and Static Analysis for Java Security Anindya Banerjee and David A. Naumann Stevens Institute of Technology, CS Report 2001-1 July 5, 2001 Abstract: Security in Java depends on an access
More informationIntroduction to lambda calculus Part 2
Introduction to lambda calculus Part 2 Antti-Juhani Kaijanaho 2017-01-24... 1 Untyped lambda calculus 1.1 Syntax... x, y, z Var t, u Term t, u ::= x t u λx t... In this document, I will be using the following
More informationWhy Functions as Values
Why Functions as Values Abstraction is easier with functions as values get-ids filter, map, etc. Separate deffun form becomes unnecessary {deffun {f x} {+ 1 x}} {f 10} {with {f {fun {x} {+ 1 x}}} {f 10}}
More informationSafety Analysis versus Type Inference
Information and Computation, 118(1):128 141, 1995. Safety Analysis versus Type Inference Jens Palsberg palsberg@daimi.aau.dk Michael I. Schwartzbach mis@daimi.aau.dk Computer Science Department, Aarhus
More informationINDUCTIVE DEFINITION
1 INDUCTIVE DEFINITION OUTLINE Judgements Inference Rules Inductive Definition Derivation Rule Induction 2 META-VARIABLES A symbol in a meta-language that is used to describe some element in an object
More informationHenk Barendregt and Freek Wiedijk assisted by Andrew Polonsky. Radboud University Nijmegen. March 5, 2012
1 λ Henk Barendregt and Freek Wiedijk assisted by Andrew Polonsky Radboud University Nijmegen March 5, 2012 2 reading Femke van Raamsdonk Logical Verification Course Notes Herman Geuvers Introduction to
More informationOperationally-Based Theories of Program Equivalence
Operationally-Based Theories of Program Equivalence Andrew Pitts Contents 1 Introduction : : : : : : : : : : : : : : : : : : : : : : : : : : : : 241 2 Contextual Equivalence : : : : : : : : : : : : : :
More informationProgramming Languages
CSE 230: Winter 2010 Principles of Programming Languages Lecture 10: Programming in λ-calculusc l l Ranjit Jhala UC San Diego Review The lambda calculus is a calculus of functions: e := x λx. e e 1 e 2
More informationTrust in the λ-calculus
J. Functional Programming, 3(2):75-85, 1997. c Cambridge University Press 1 Trust in the λ-calculus P. ØRBÆK AND J. PALSBERG BRICS, Centre of the Danish National Research Foundation, Dept. of Computer
More informationMinimally Strict Polymorphic Functions
Minimally Strict Polymorphic Functions Jan Christiansen Christian-Albrechts-Universität Kiel Institut für Informatik 24098 Kiel, Germany jac@informatik.uni-kiel.de Daniel Seidel Rheinische Friedrich-Wilhelms-Universität
More informationThe Many Faces of Modal Logic Day 4: Structural Proof Theory
The Many Faces of Modal Logic Day 4: Structural Proof Theory Dirk Pattinson Australian National University, Canberra (Slides based on a NASSLLI 2014 Tutorial and are joint work with Lutz Schröder) LAC
More informationEDA045F: Program Analysis LECTURE 10: TYPES 1. Christoph Reichenbach
EDA045F: Program Analysis LECTURE 10: TYPES 1 Christoph Reichenbach In the last lecture... Performance Counters Challenges in Dynamic Performance Analysis Taint Analysis Binary Instrumentation 2 / 44 Types
More informationFrom Operational Semantics to Abstract Machines
From Operational Semantics to Abstract Machines John Hannan Department of Computer Science, University of Copenhagen, Universitetsparken 1, DK-2100 Copenhagen East, Denmark. hannan@diku.dk Dale Miller
More informationList reversal: back into the frying pan
List reversal: back into the frying pan Richard Bornat March 20, 2006 Abstract More than thirty years ago Rod Burstall showed how to do a proof of a neat little program, shown in a modern notation in figure
More informationThe Call-by-Need Lambda Calculus
The Call-by-Need Lambda Calculus John Maraist, Martin Odersky School of Computer and Information Science, University of South Australia Warrendi Road, The Levels, Adelaide, South Australia 5095 fmaraist,oderskyg@cis.unisa.edu.au
More informationA Proof Theory for Generic Judgments
A Proof Theory for Generic Judgments Dale Miller INRIA/Futurs/Saclay and École Polytechnique Alwen Tiu École Polytechnique and Penn State University LICS 2003, Ottawa, Canada, 23 June 2003 Outline 1. Motivations
More informationFinite Automata Theory and Formal Languages TMV027/DIT321 LP Recap: Logic, Sets, Relations, Functions
Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2017 Formal proofs; Simple/strong induction; Mutual induction; Inductively defined sets; Recursively defined functions. Lecture 3 Ana Bove
More informationContext Free Grammars
Automata and Formal Languages Context Free Grammars Sipser pages 101-111 Lecture 11 Tim Sheard 1 Formal Languages 1. Context free languages provide a convenient notation for recursive description of languages.
More information2 Results I: Lifting Computer Science
Ben Greenman December 12, 2015 Call-By-Name, Call-By-Value, and the λ Calculus Abstract Plotkin s 1975 paper is strictly business. There are many theorems packed in the space of 35 pages, with little room
More informationFunctional Programming with F# Overview and Basic Concepts
Functional Programming with F# Overview and Basic Concepts Radu Nicolescu Department of Computer Science University of Auckland 27 Sep 2017 1 / 52 1 Background 2 Overview 3 Type System and Type Inference
More information