Simply Typed Lambda-Calculi (II)
|
|
- Christiana Young
- 5 years ago
- Views:
Transcription
1 THEORY AND PRACTICE OF FUNCTIONAL PROGRAMMING Simply Typed Lambda-Calculi (II) Dr. ZHANG Yu Institute of Software, Chinese Academy of Sciences Fall term, 2011 GUCAS, Beijing
2 Introduction PCF Programming Computable Functions, mainly designed for program analysis and reasoning, rather than practical use. Syntax and type system Reduction and operational semantics Expressive power Theory and Practice of Functional Programming 2 / 22
3 Base types Unit type: unit, which contains a single element. Natural numbers: Constants (values): 0,1,2,... Arithmetic operations: e 1 +e 2,e 1 e 2,... Γ e 1 : Nat Γ e 2 : Nat op {+,,,/,...} Booleans: Γ e 1 op e 2 : Nat Boolean constants (values): true, false. Equality test (of natural numbers): e 1? = e 2. Conditional: if e then e 1 else e 2. Γ e 1 : Nat Γ e 2 : Nat Γ e : Bool Γ e 1 : τ Γ e 2 : τ Γ e 1? = e 2 : Bool Γ if e then e 1 else e 2 : τ Theory and Practice of Functional Programming 3 / 22
4 More types Product types: τ 1 τ 2 Γ e 1 : τ 1 Γ e 2 : τ 2 Γ e 1,e 2 : τ 1 τ 2 Γ e : τ 1 τ 2 Γ proj i e : τ i Sum types: τ 1 +τ 2 A value of τ 1 +τ 2 can be a value of either τ 1 or τ 2, distinguished by tags (inj 1,inj 2 ). We use case to retrieve the value (removing tags). Γ e : τ i Γ inj i e : τ 1 +τ 2 Γ,x i : τ 1 e i : τ(i = 1,2) Γ e : τ 1 +τ 2 Γ case e of inj 1 x 1 in e 1 ;inj 2 x 2 in e 2 : τ Boolean type can be defined using unit and sum: Bool def = unit+unit. true def = inj 1, false def = inj 2 if e then e 1 else e 2 def = case e of inj 1 in e 1 ;inj 2 in e 2 Theory and Practice of Functional Programming 4 / 22
5 Functions and recursions Function type τ τ Γ,x : τ e : τ Γ λx : τ.e : τ τ Γ e 1 : τ τ Γ e 1 e 2 : τ Γ e 2 : τ PCF introduces explicitly an operator for fix-point: fix τ. If F is a function of type τ τ, then the fix-point of F is the value x : τ such that F(x) = x, written as fix τ F. A recursive definition f : τ = e (with f occurs freely in e) indeed defines a fix-point of λf : τ.e. Example: factorization can be defined recursively: f = λx : Nat.if x? = 0 then 1 else x f(x 1) With fix-point operator in PCF, we shall write the definition as fact def = fix Nat Nat (λf.λx.if x? = 0 then 1 else x f(x 1)) Theory and Practice of Functional Programming 5 / 22
6 Syntax of PCF Types: τ 1,τ 2,... ::= Nat Bool τ 1 τ 2 τ 1 +τ 2 τ 1 τ 2 Expressions (terms): e 1,e 2,... ::= x variables 0,1,2,... natural numbers e 1 op e 2 arithmetic operations true false booleans e? 1 = e 2 equality test if e then e 1 else e 2 conditional e 1,e 2 pairing proj 1 e proj 2 e projections inj 1 e inj 2 e injections case e of inj 1 x 1 in e 1 ; case distinction inj 2 x 2 in e 2 λx : τ.e e 1 e 2 functions and applications fix τ recursion (fix point) Theory and Practice of Functional Programming 6 / 22
7 PCF typing rules x : τ Γ Γ x : τ n = 0,1,2,... Γ n : Nat Γ e 1 : Nat Γ e 2 : Nat op {+,,,/} Γ e 1 op e 2 : Nat Γ true : Bool Γ false : Bool Γ e 1 : Nat Γ e 2 : Nat Γ e 1? = e 2 : Bool Γ e : Bool Γ e 1 : τ Γ e 2 : τ Γ if e then e 1 else e 2 : τ Γ e 1 : τ 1 Γ e 2 : τ 2 Γ e 1,e 2 : τ 1 τ 2 Γ e : τ 1 τ 2 Γ e : τ 1 τ 2 Γ e : τ 1 Γ e : τ 2 Γ proj 1 e : τ 1 Γ proj 2 e : τ 2 Γ inj 1 e : τ 1 +τ 2 Γ,x 1 : τ 1 e 1 : τ Γ,x 2 : τ 2 e 2 : τ Γ e : τ 1 +τ 2 Γ case e of inj 1 x 1 in e 1 ;inj 2 x 2 in e 2 : τ Γ inj 2 e : τ 1 +τ 2 Γ,x : τ e : τ Γ λx : τ.e : τ τ Γ e 1 : τ τ Γ e 1 e 2 : τ Γ e 2 : τ Γ e : τ τ Γ fix τ e : τ Theory and Practice of Functional Programming 7 / 22
8 Type checking A procedure of checking the validity of a type assertion, by typing rules and induction on expression structure. Example: fix Nat Nat λf : Nat Nat.λx : Nat.if x? = 0 then 1 else x f(x 1) Γ x : Nat Γ 1 : Nat Γ f : Nat Nat Γ x 1 : Nat Γ x : Nat Γ 0 : Nat Γ x : Nat Γ f(x 1) : Nat Γ x? = 0 : Bool Γ 1 : Nat Γ x f(x 1) : Nat f : Nat Nat,x : Nat if x? = 0 then 1 else x f(x 1) : Nat Nat f : Nat Nat λx : Nat.if x? = 0 then 1 else x f(x 1) : Nat λf : Nat Nat.λx : Nat.if x? = 0 then 1 else x f(x 1) : (Nat Nat) (Nat Nat) fix Nat Nat λf : Nat Nat.λx : Nat.if x? = 0 then 1 else x f(x 1) : Nat Nat Theory and Practice of Functional Programming 8 / 22
9 PCF reduction β-reduction: (λx : τ.e)e e[e /x]. Other reductions: 2+3 5, 12? = 23 false,... if true then e 1 else e 2 e 1, if false then e 1 else e 2 e 2 proj 1 e 1,e 2 e 1, proj 2 e 1,e 2 e 2 case inj 1 e of inj 1 x 1 in e 1 ;inj 2 x 2 in e 2 e 1 [e/x 1 ] case inj 2 e of inj 1 x 1 in e 1 ;inj 2 x 2 in e 2 e 2 [e/x 2 ] Reduction of fix-pointer: PCF reductions may not terminate: fix τ λf : τ τ.f(fix τ f) fix λx.x (λf.fix f(fix f))(λx.x) (λx.x)(fix λx.x) fix λx.x Theory and Practice of Functional Programming 9 / 22
10 PCF reduction Example: fact def = fix Nat Nat (λf.λx.if x? = 0 then 1 else x f(x 1)) fact (n+1) = fix Nat Nat (λf.λx.if x? = 0 then 1 else x f(x 1))(n+1) (λg.g(fix Nat Nat g))(λf.λx.if x? = 0 then 1 else x f(x 1))(n+1) Fact(fix Nat Nat Fact) (n+1) (where Fact = λf.λx.if x? = 0 then 1 else x f(x 1)) = (λf.λx.if x? = 0 then 1 else x f(x 1))fact (n+1) (λx.if x? = 0 then 1 else x fact(x 1))(n+1) if n+1? = 0 then 1 else (n+1) fact(n+1 1) if false then 1 else (n+1) fact(n+1 1) (n+1) fact(n+1 1) A syntactic abbreviation for recursion letrec fact=λx : Nat.if x? = 0 then 1 else x fact(x 1) in fact (n+1) Theory and Practice of Functional Programming 10 / 22
11 PCF reduction Multi-step reduction : the reflexive (w.r.t. α-equivalence) and transitive closure of. e e if e = α e or e e & e e PCF reductions are non-deterministic ,5 6 59,5 6 59, , ,30 59,30 PCF reduction system is confluent it satisfies Church-Rosser property. No PCF term can have more than one normal form. Inconsistent reduction system with fixe e(fixe) and η-reduction. λx.fix x η fix λx.fix x fix λx.x(fix x) fix λx.x(x(fix x))... Theory and Practice of Functional Programming 11 / 22
12 PCF values and canonical form PCF values are closed expressions that cannot be reduced any more. PCF values are in canonical forms: Boolean values: true, false. Natural number values: 0,1,2,... Product values: e 1,e 2. Injective values: inj 1 e,inj 2 e. Function values: λx.e. Every closed normal PCF expression must be in the canonical form. Proof. By induction on the structure of PCF expressions. Theory and Practice of Functional Programming 12 / 22
13 Reduction strategy Restrict the reduction system so that reductions are deterministic and consistent with the original system. Different reduction strategies (λx : τ.e 1 )e 2 e 1 [e 2 /x] (λx : τ.e 1 )e 2 (λx : τ.e 1 )e 2 (λx : τ.e 1 )e 2 (λx : τ.e 1 )e 2 Lazy evaluation, a.k.a, call-by-name Function optimization Eager evaluation, a.k.a, call-by-value Theory and Practice of Functional Programming 13 / 22
14 A reduction system with lazy evaluation If the top-level term is a redex, it will be reduced first: if e e, then e lazy e. lazy e 1 e 1 e 1 lazy e 1 e 2 e 1e 2 lazy e 1 op {+,,,/,? =} e 1 op e 2 lazy e 1 +e 2 e lazy e n {0,1,2,...} op {+,,,/,? =} n op e lazy n+e e lazy e if e then e 1 else e 2 lazy if e then e 1 else e 2 e lazy e proj i e lazy proj i e e lazy e case e of inj 1 x 1 in e 1 ;inj 2 x 2 in e 2 lazy case e of... Consistency with the PCF reduction system: if e lazy e, then e e Incompleteness: lazy normal form is not necessarily PCF-normal form. Theory and Practice of Functional Programming 14 / 22
15 Lazy and eager evaluation Lazy evaluation may lead to low efficient computation, as it often produces multiple copies of a expression, which will be executed (reduced) for multiple times. In practical FPL with lazy evaluation (e.g., Haskell), duplication is done by setting multiple pointers to a single expression, which is executed only once if necessary. This is call-by-need evaluation. Eager evaluation can lead to non-terminating computations for programs that necessarily terminate with lazy evaluation. (λx : Nat.0)((fixλy : Nat.y)0) lazy 0 (λx : Nat.0)((fixλy : Nat.y)0) eager (λx : Nat.0)(((λy : Nat.y) fixλy : Nat.y 0) eager (λx : Nat.0)((λz : Nat.(fixλy : Nat.y)z)0) eager (λx : Nat.0)((fixλy : Nat.y)0) Theory and Practice of Functional Programming 15 / 22
16 Semantics Roughly speaking, semantics is the meaning of programs. Three styles of semantics Operational semantics: how do programs execute (reduce)? It s about the evaluation or computation procedure of programs. Axiomatic semantics: do programs satisfy a certain property? It s about the reasoning of properties of and relations between programs. Denotational semantics: what do programs represent? It s about the exact (mathematical) object that a program denotes. In this course we only discuss operational semantics. For the other two semantics, please refer to Prof. Liu Xinxin s course on formal semantics of programming languages. Theory and Practice of Functional Programming 16 / 22
17 Operational semantics The PCF reduction system indeed defines an operational semantics of PCF, which we often refer to as small-step semantics. Big-step semantics: e e if e e and (e ). c {true,false,0,1,2,...} c c e 1 n 1 e 2 n 2 n 1 op n 2 = n e 1 op e 2 n e 1 n 1 e 2 n 2 n 1 n 2 e 1? = e 2 false e 1 n e 2 n e 1? = e 2 true e true e 1 v 1 if e then e 1 else e 2 v 1 e false e 2 v 2 if e then e 1 else e 2 v 2 e 1 v 1 e 2 v 2 e 1,e 2 v 1,v 2 e v 1,v 2 proj i e v i e v e inj 1 v 1 e 1 [v 1 /x 1 ] v inj i e inj i v case e of inj 1 x 1 in e 1 ;inj 2 x 2 in e 2 v e inj 2 v 2 e 2 [v 2 /x 2 ] v case e of inj 1 x 1 in e 1 ;inj 2 x 2 in e 2 v e 1 λx.e 1 e 1[e 2 /x] v (Lazy) e 1 e 2 v Theory and Practice of Functional Programming 17 / 22
18 Total recursive functions A class C of numeric functions f : N k N is closed under composition: for every f 1,...,f l : N k N and g : N l N of C, the function h(n 1,...,n k ) = g(f 1 (n 1,...,n k ),...,f l (n 1,...,n k )) is also in C. closed under primitive recursion: for every f : N k N and g : N k+2 N of C, the function h : N k+1 N defined as follows is in C: h(0,n 1,...,n k ) = f(n 1,...,n k ) h(m+1,n 1,...,n k ) = g(m,n 1,...,n k,h(m,n 1,...,n k )) closed under minimization: for every f : N k+1 N of C such that n 1,...,n k, m,f(m,n 1,...,n k ) = 0, the function g(n 1,...,n k ) = min({m f(m,n 1,...,n k ) = 0}) is in C. Total recursive functions are the least class of numeric functions: closed under composition, primitive recursion and minimization; contains projection function proj k i (n 1,...,n k ) = n i, successor function succ(n) = n+1 and constant zero functionzero zero(n) = 0. Theory and Practice of Functional Programming 18 / 22
19 Expressing total recursive functions in PCF A numeric function f : N k N is PCF-definable if there exists a PCF program e of Nat k Nat such that e = f in the set-theoretic model. Every total recursive function is definable in PCF. Proof. It suffices to define a PCF term for every basic function and composition, primitive recursion, minimization. Basic functions: proj k i Composition: def = λx 1. λx k.x i. h def = λx 1. λx k.g(f 1 x 1 x k ) (f l x 1 x k ) Primitive recursion h def = fix λh.λn. if n > 0 then λ x.g(n 1, x,h (n 1, x)) else λ x.f x Minimization: g def = (fix λg.λn.λ x.if f(n, x)? = 0 then n else g (n+1, x))0 Theory and Practice of Functional Programming 19 / 22
20 Partial recursive functions Partial numeric functions f : N k N can be undefined at some points. Closed under composition: for every f 1,...,f l : N k N and g : N l N of C, the composition function is in C: h(n 1,...,n k ) = g(m 1,...,m l ) if m i = f i (n 1,...,n k ) and g(m 1,...,m l ) are defined otherwise closed under primitive recursion: for every f 1,...,f l : N k N and g : N k+2 N of C, the function h : N k+1 N defined as follows is in C: { f(n1,...,n h(0,n 1,...,n k ) = k ) if f(n 1,...,n k ) is defined o.w. g(m,n 1,...,n k,q) if q = h(m,n 1,...,n k ) and h(m+1,n 1,...,n k ) = g(m,n 1,...,n k,q) are defined o.w. closed under minimization: for every f : N k+1 N of C, C contains the function { the least m s.t. f(m,n1,...,n k ) = 0 if such m exist g(n 1,...,n k ) = otherwise Theory and Practice of Functional Programming 20 / 22
21 Expressing partial recursive functions in PCF Partial recursive functions are the least class of partial numeric functions: closed under composition, primitive recursion and minimization; contains projection function proj k i, successor functionsucc and constant zero function zero. Every partial recursive function is definable in PCF. Proof. Representing undefinedness by non-termination in PCF: def = fix λf.f By Church s thesis, all mechanically computable functions on natural numbers are definable in PCF. Theory and Practice of Functional Programming 21 / 22
22 Non-definability of parallel operations The parallel-or operation: true PORe 1 e 2 false no normal form if e 1 true or e 2 true if e 1 false and e 2 false otherwise where e 1,e 2 are closed PCF terms. There is no PCF program that definespor POR. The proof can be found in Chapter 2 of J. Mitchell s book Foundations for Programming Languages, which relies essentially on the sequentiality of PCF reduction system. Theory and Practice of Functional Programming 22 / 22
Review. 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 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 informationModels of computation
Lambda-Calculus (I) jean-jacques.levy@inria.fr 2nd Asian-Pacific Summer School on Formal ethods Tsinghua University, August 23, 2010 Plan computation models lambda-notation bound variables odels of computation
More informationNICTA Advanced Course. Theorem Proving Principles, Techniques, Applications
NICTA Advanced Course Theorem Proving Principles, Techniques, Applications λ 1 CONTENT Intro & motivation, getting started with Isabelle Foundations & Principles Lambda Calculus Higher Order Logic, natural
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 informationDomain theory and denotational semantics of functional programming
Domain theory and denotational semantics of functional programming Martín Escardó School of Computer Science, Birmingham University MGS 2007, Nottingham, version of April 20, 2007 17:26 What is denotational
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 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 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 informationOrigin in Mathematical Logic
Lambda Calculus Origin in Mathematical Logic Foundation of mathematics was very much an issue in the early decades of 20th century. Cantor, Frege, Russel s Paradox, Principia Mathematica, NBG/ZF Origin
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 informationFIXED POINTS AND EXTENSIONALITY IN TYPED FUNCTIONAL PROGRAMMING LANGUAGES
FIXED POINTS AND EXTENSIONALITY IN TYPED FUNCTIONAL PROGRAMMING LANGUAGES a dissertation submitted to the department of computer science and the committee on graduate studies of stanford university in
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 informationElement x is R-minimal in X if y X. R(y, x).
CMSC 22100/32100: Programming Languages Final Exam M. Blume December 11, 2008 1. (Well-founded sets and induction principles) (a) State the mathematical induction principle and justify it informally. 1
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 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 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 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 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 informationSemantics and Verification of Software
Semantics and Verification of Software Thomas Noll Software Modeling and Verification Group RWTH Aachen University http://moves.rwth-aachen.de/teaching/ss-15/sv-sw/ The Denotational Approach Denotational
More information(2) (15pts) Using Prolog, implement a type-checker for the following small subset of System F:
CS 6371 Advanced Programming Languages Sample Spring 2018 Final Exam This sample final exam is LONGER than a real final exam (to give you more practice problems) and has a medium difficulty level. You
More informationλ Slide 1 Content Exercises from last time λ-calculus COMP 4161 NICTA Advanced Course Advanced Topics in Software Verification
Content COMP 4161 NICTA Advanced Course Advanced Topics in Software Verification Toby Murray, June Andronick, Gerwin Klein λ Slide 1 Intro & motivation, getting started [1] Foundations & Principles Lambda
More informationConsistency of a Programming Logic for a Version of PCF Using Domain Theory
Consistency of a Programming Logic for a Version of PCF Using Domain Theory Andrés Sicard-Ramírez EAFIT University Logic and Computation Seminar EAFIT University 5 April, 3 May 2013 A Core Functional Programming
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 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 informationOrigin in Mathematical Logic
Lambda Calculus Origin in Mathematical Logic Foundation of mathematics was very much an issue in the early decades of 20th century. Cantor, Frege, Russel s Paradox, Principia Mathematica, NBG/ZF The Combinatory
More informationFormal Techniques for Software Engineering: Denotational Semantics
Formal Techniques for Software Engineering: Denotational Semantics Rocco De Nicola IMT Institute for Advanced Studies, Lucca rocco.denicola@imtlucca.it May 2013 Lesson 4 R. De Nicola (IMT-Lucca) FoTSE@LMU
More informationCSE 505, Fall 2008, Midterm Examination 29 October Please do not turn the page until everyone is ready.
CSE 505, Fall 2008, Midterm Examination 29 October 2008 Please do not turn the page until everyone is ready. Rules: The exam is closed-book, closed-note, except for one side of one 8.5x11in piece of paper.
More informationProgramming Language Concepts: Lecture 16
Programming Language Concepts: Lecture 16 Madhavan Mukund Chennai Mathematical Institute madhavan@cmi.ac.in http://www.cmi.ac.in/~madhavan/courses/pl2009 PLC 2009, Lecture 16, 23 March 2009 λ-calculus:
More informationQuantum Functional Programming Language & Its Denotational Semantics
Quantum Functional Programming Language & Its Denotational Semantics Ichiro Hasuo Dept. Computer Science University of Tokyo Naohiko Hoshino Research Inst. for Math. Sci. Kyoto University Talk based on:
More informationLecture 2: Axiomatic semantics
Chair of Software Engineering Trusted Components Prof. Dr. Bertrand Meyer Lecture 2: Axiomatic semantics Reading assignment for next week Ariane paper and response (see course page) Axiomatic semantics
More informationCSE 505, Fall 2005, Midterm Examination 8 November Please do not turn the page until everyone is ready.
CSE 505, Fall 2005, Midterm Examination 8 November 2005 Please do not turn the page until everyone is ready. Rules: The exam is closed-book, closed-note, except for one side of one 8.5x11in piece of paper.
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 information07 Equational Logic and Algebraic Reasoning
CAS 701 Fall 2004 07 Equational Logic and Algebraic Reasoning Instructor: W. M. Farmer Revised: 17 November 2004 1 What is Equational Logic? Equational logic is first-order logic restricted to languages
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 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 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 informationSimply Typed λ-calculus
Simply Typed λ-calculus Lecture 1 Jeremy Dawson The Australian National University Semester 2, 2017 Jeremy Dawson (ANU) COMP4630,Lecture 1 Semester 2, 2017 1 / 23 A Brief History of Type Theory First developed
More informationComputational Soundness of a Call by Name Calculus of Recursively-scoped Records. UMM Working Papers Series, Volume 2, Num. 3.
Computational Soundness of a Call by Name Calculus of Recursively-scoped Records. UMM Working Papers Series, Volume 2, Num. 3. Elena Machkasova Contents 1 Introduction and Related Work 1 1.1 Introduction..............................
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 informationAn Intuitively Complete Analysis of Gödel s Incompleteness
An Intuitively Complete Analysis of Gödel s Incompleteness JASON W. STEINMETZ (Self-funded) A detailed and rigorous analysis of Gödel s proof of his first incompleteness theorem is presented. The purpose
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 informationAbout Typed Algebraic Lambda-calculi
About Typed Algebraic Lambda-calculi Benoît Valiron INRIA Saclay/LIX Palaiseau, France valiron@lix.polytechnique.fr Abstract Arrighi and Dowek (2008) introduce an untyped lambdacalculus together with a
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 informationOperationally-Based Theories of Program Equivalence
Operationally-Based Theories of Program Equivalence Andrew Pitts Contents 1 Introduction : : : : : : : : : : : : : : : : : : : : : : : : : : : : 241 2 Contextual Equivalence : : : : : : : : : : : : : :
More informationA λ-calculus with Constants and Let-blocks
A λ-calculus with Constants and Let-blocks Arvind Computer Science and Artificial Intelligence Laboratory M.I.T. September 19, 2006 September 19, 2006 http://www.csg.csail.mit.edu/6.827 L04-1 Outline Recursion
More informationCS 4110 Programming Languages & Logics. Lecture 16 Programming in the λ-calculus
CS 4110 Programming Languages & Logics Lecture 16 Programming in the λ-calculus 30 September 2016 Review: Church Booleans 2 We can encode TRUE, FALSE, and IF, as: TRUE λx. λy. x FALSE λx. λy. y IF λb.
More informationTopology in Denotational Semantics
Journées Topologie et Informatique Thomas Ehrhard Preuves, Programmes et Systèmes (PPS) Université Paris Diderot - Paris 7 and CNRS March 21, 2013 What is denotational semantics? The usual stateful approach
More informationDynamic Semantics. Dynamic Semantics. Operational Semantics Axiomatic Semantics Denotational Semantic. Operational Semantics
Dynamic Semantics Operational Semantics Denotational Semantic Dynamic Semantics Operational Semantics Operational Semantics Describe meaning by executing program on machine Machine can be actual or simulated
More informationDiagrams for Meaning Preservation
Diagrams for Meaning Preservation 2003-06-13 Joe Wells Detlef Plump Fairouz Kamareddine Heriot-Watt University University of York www.cee.hw.ac.uk/ultra www.cs.york.ac.uk/ det Diagrams for Meaning Preservation
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 informationMathematical Foundations of Programming. Nicolai Kraus. Draft of February 15, 2018
Very short lecture notes: Mathematical Foundations of Programming University of Nottingham, Computer Science, module code G54FOP, Spring 2018 Nicolai Kraus Draft of February 15, 2018 What is this? This
More informationCharles Wells 1. February 25, 1999
NOTES ON THE λ-calculus Charles Wells 1 February 25, 1999 Department of Mathematics Case Western Reserve University 10900 Euclid Ave. Cleveland, OH 44106-7058 USA charles@freude.com http://www.cwru.edu/artsci/math/wells/home.html
More informationDenotational semantics
Denotational semantics Semantics and Application to Program Verification Antoine Miné École normale supérieure, Paris year 2015 2016 Course 4 4 March 2016 Course 4 Denotational semantics Antoine Miné p.
More informationBRICS. A Computational Formalization for Partial Evaluation. (Extended Version) Basic Research in Computer Science
BRICS RS-96-34 Hatcliff & Danvy: A Computational Formalization for Partial Evaluation BRICS Basic Research in Computer Science A Computational Formalization for Partial Evaluation (Extended Version) John
More informationSEMANTICS OF PROGRAMMING LANGUAGES Course Notes MC 308
University of Leicester SEMANTICS OF PROGRAMMING LANGUAGES Course Notes for MC 308 Dr. R. L. Crole Department of Mathematics and Computer Science Preface These notes are to accompany the module MC 308.
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 informationOperational Semantics
Operational Semantics Semantics and applications to verification Xavier Rival École Normale Supérieure Xavier Rival Operational Semantics 1 / 50 Program of this first lecture Operational semantics Mathematical
More informationLocal computation of β-reduction A concrete presentation of Game Semantics
1 2 3 4 Local computation of β-reduction A concrete presentation of Game Semantics William Blum and C.H. Luke Ong Oxford University Computing Laboratory 5 6 Abstract We show that... Key words: Lambda calculus,
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 informationTutorial on Semantics Part I
Tutorial on Semantics Part I Basic Concepts Prakash Panangaden 1 1 School of Computer Science McGill University on sabbatical leave at Department of Computer Science Oxford University Fields Institute,
More informationModels of Computation,
Models of Computation, 2010 1 The Lambda Calculus A brief history of mathematical notation. Our notation for numbers was introduced in the Western World in the Renaissance (around 1200) by people like
More informationFormal Methods Lecture 6. (B. Pierce's slides for the book Types and Programming Languages )
Formal Methods Lecture 6 (B. Pierce's slides for the book Types and Programming Languages ) This Saturday, 10 November 2018, room 335 (FSEGA), we will recover the following activities: 1 Formal Methods
More informationPrinciples of Programming Languages
Principles of Programming Languages Lecture 03 Theoretical Foundations 1 Domains Semantic model of a data type: semantic domain! Examples: Integer, Natural, Truth-Value Domains D are more than a set of
More informationDenotational Semantics
Q Lecture Notes on Denotational Semantics Part II of the Computer Science Tripos 2010/11 Dr Marcelo Fiore Cambridge University Computer Laboratory c A. M. Pitts, G. Winskel, M. Fiore Contents Notes ii
More informationChapter 3. Formal Number Theory
Chapter 3. Formal Number Theory 1. An Axiom System for Peano Arithmetic (S) The language L A of Peano arithmetic has a constant 0, a unary function symbol, a binary function symbol +, binary function symbol,
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 informationLinearity and Passivity
Linearity and Passivity David A. 1 School of Computing University of Tasmania GPO Box 252-100 Hobart 7001 Australia Abstract A simple symmetric logic is proposed which captures both the notions of Linearity
More information1. Object Calculus. Object calculus is to OO languages what lambda calculus is to functional languages
1. Object Calculus In this section we will introduce a calculus of objects that gives a simple but powerful mathematical model to study object based languages. Object calculus is to OO languages what lambda
More informationPropositional Logic: Part II - Syntax & Proofs 0-0
Propositional Logic: Part II - Syntax & Proofs 0-0 Outline Syntax of Propositional Formulas Motivating Proofs Syntactic Entailment and Proofs Proof Rules for Natural Deduction Axioms, theories and theorems
More informationSimulation in the Call-by-Need Lambda-Calculus with Letrec, Case, Constructors, and Seq
Simulation in the Call-by-Need Lambda-Calculus with Letrec, Case, Constructors, and Seq Manfred Schmidt-Schauss 1 and David Sabel 1 and Elena Machkasova 2 1 Dept. Informatik und Mathematik, Inst. Informatik,
More informationDecidability: Church-Turing Thesis
Decidability: Church-Turing Thesis While there are a countably infinite number of languages that are described by TMs over some alphabet Σ, there are an uncountably infinite number that are not Are there
More informationTYPE THEORETIC PROPERTIES OF ASSIGNMENTS BY VIPIN SWARUP. B.Tech., Indian Institute of Technology, 1984 M.S., University of Illinois, 1988 THESIS
c Copyright by Vipin Swarup, 1992 TYPE THEORETIC PROPERTIES OF ASSIGNMENTS BY VIPIN SWARUP B.Tech., Indian Institute of Technology, 1984 M.S., University of Illinois, 1988 THESIS Submitted in partial fulfillment
More informationFormal Methods Lecture 8. (B. Pierce's slides for the book Types and Programming Languages )
Formal Methods Lecture 8 (B. Pierce's slides for the book Types and Programming Languages ) Erasure and Typability Erasure We can transform terms in λ to terms of the untyped lambda-calculus simply by
More informationThe Calculus of Inductive Constructions
The Calculus of Inductive Constructions Hugo Herbelin 10th Oregon Programming Languages Summer School Eugene, Oregon, June 16-July 1, 2011 1 Outline - A bit of history, leading to the Calculus of Inductive
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 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 informationMFPS LICS Special Session Honouring Dana Scott. Symmetric Scott. Andrew Pitts. Computer Laboratory MFPS/LICS /14
MFPS/LICS 2013 1/14 MFPS LICS Special Session Honouring Dana Scott Symmetric Scott Andrew Pitts Computer Laboratory 80 years of Dana Scott MFPS/LICS 2013 2/14 automata theory set theory sheaves & logic
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 informationProgramming Languages and Types
Programming Languages and Types Klaus Ostermann based on slides by Benjamin C. Pierce Where we re going Type Systems... Type systems are one of the most fascinating and powerful aspects of programming
More informationPropositional Dynamic Logic
Propositional Dynamic Logic Contents 1 Introduction 1 2 Syntax and Semantics 2 2.1 Syntax................................. 2 2.2 Semantics............................... 2 3 Hilbert-style axiom system
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 Call-by-Need Lambda-Calculus with Locally Bottom-Avoiding Choice: Context Lemma and Correctness of Transformations
A Call-by-Need Lambda-Calculus with Locally Bottom-Avoiding Choice: Context Lemma and Correctness of Transformations David Sabel and Manfred Schmidt-Schauß Research group for Artificial Intelligence and
More informationλ S : A Lambda Calculus with Side-effects
L14-1 λ S : A Lambda Calculus with Side-effects delivered by Jacob Schwartz Laboratory for Computer Science M.I.T. Lecture 14 M-Structures and Barriers L14-2 Some problems cannot be expressed functionally
More informationAn Abstract Interpretation Framework for Semantics and Diagnosis of Lazy Functional-Logic Languages
Università degli Studi di Udine Dipartimento di Matematica e Informatica Dottorato di Ricerca in Informatica Ph.D. Thesis An Abstract Interpretation Framework for Semantics and Diagnosis of Lazy Functional-Logic
More informationIntroduction to λ-calculus
p.1/65 Introduction to λ-calculus Ken-etsu FUJITA fujita@cs.gunma-u.ac.jp http://www.comp.cs.gunma-u.ac.jp/ fujita/ Department of Computer Science Gunma University :Church 32, 36, 40; Curry 34 1. Universal
More informationFormal Methods Lecture 6. (B. Pierce's slides for the book Types and Programming Languages )
Formal Methods Lecture 6 (B. Pierce's slides for the book Types and Programming Languages ) Programming in the Lambda-Calculus, Continued Testing booleans Recall: tru = λt. λf. t fls = λt. λf. f We showed
More informationDenotational Semantics
Q Lecture Notes on Denotational Semantics for Part II of the Computer Science Tripos Dr Andrew M. Pitts Cambridge University Computer Laboratory c A. M. Pitts, 1997-9 First edition 1997. Revised 1998,
More informationThe Tortoise and the Hare Algorithm
The Tortoise and the Hare Algorithm Peter Gammie October 11, 2017 Abstract We formalize the Tortoise and Hare cycle-finding algorithm ascribed to Floyd by Knuth (1981, p7, exercise 6), and an improved
More informationStatic Program Analysis
Static Program Analysis Xiangyu Zhang The slides are compiled from Alex Aiken s Michael D. Ernst s Sorin Lerner s A Scary Outline Type-based analysis Data-flow analysis Abstract interpretation Theorem
More informationInduction; Operational Semantics. Fall Software Foundations CIS 500
CIS 500 Software Foundations Fall 2005 Induction; Operational Semantics CIS 500, Induction; Operational Semantics 1 Announcements Review recitations start this week. You may go to any recitation section
More informationFunctional Programming with Coq. Yuxin Deng East China Normal University
Functional Programming with Coq Yuxin Deng East China Normal University http://basics.sjtu.edu.cn/ yuxin/ September 10, 2017 Functional Programming Y. Deng@ECNU 1 Reading materials 1. The Coq proof assistant.
More informationAn Introduction to Modal Logic III
An Introduction to Modal Logic III Soundness of Normal Modal Logics Marco Cerami Palacký University in Olomouc Department of Computer Science Olomouc, Czech Republic Olomouc, October 24 th 2013 Marco Cerami
More informationGödel s First Incompleteness Theorem
Gödel s First Incompleteness Theorem Alex Edmonds MAT 477 January 2014 Alex Edmonds (2014) Gödel s First Incompleteness Theorem January 2014 1 / 29 Incompleteness of Peano Arithmetic (Main Theorem): If
More informationCHAPTER 2. Computability
CHAPTER 2 Computability At this point we leave the general setting of logic and aim to get closer to mathematics. We introduce free algebras (for example, the natural numbers) as basic data structures
More informationProgramming Language Concepts: Lecture 18
Programming Language Concepts: Lecture 18 Madhavan Mukund Chennai Mathematical Institute madhavan@cmi.ac.in http://www.cmi.ac.in/~madhavan/courses/pl2009 PLC 2009, Lecture 18, 30 March 2009 One step reduction
More informationFully-Abstract Compilation by Approximate Back-Translation Technical Appendix
Fully-Abstract Compilation by Approximate Back-Translation Technical Appendix Abstract This technical appendix provides the full formalisation and proofs for its paper 1 Contents 1 The Source Language
More informationExtending Abramsky s Lazy Lambda Calculus: (Non)-Conservativity of Embeddings
Extending Abramsky s Lazy Lambda Calculus: (Non)-Conservativity of Embeddings Manfred Schmidt-Schauß 1, Elena Machkasova 2, and David Sabel 1 1 Goethe-Universität, Frankfurt, Germany schauss,sabel@ki.informatik.uni-frankfurt.de
More informationRecursion and Intro to Coq
L02-1 Recursion and Intro to Coq Armando Solar Lezama Computer Science and Artificial Intelligence Laboratory M.I.T. With content from Arvind and Adam Chlipala. Used with permission. September 21, 2015
More informationNotes on Inductive Sets and Induction
Notes on Inductive Sets and Induction Finite Automata Theory and Formal Languages TMV027/DIT21 Ana Bove, March 15th 2018 Contents 1 Induction over the Natural Numbers 2 1.1 Mathematical (Simple) Induction........................
More information