Great Seal
- f the
Knights of the λ-Calculus CIS 352
Names & Functions
A Second Attempt
Jim Royer February 26, 2019
CIS 352 ❖ Names & Functions 1
References
!!!! Slides for: Language Semantics and Implementation Lectures 11 & 12, by Richard Mayr and Colin Stirling, School of Informatics, University of Edinburgh, 2013. http://www.inf.ed.ac.uk/teaching/courses/lsi/13Lsi11-12.pdf from slide 9 onward ◮ Andrew Pitts’ Lecture Notes on Semantics of Programming Languages: http://www.inf.ed.ac.uk/teaching/courses/lsi/sempl.pdf. ◮ Semantics of programming languages Course Notes 2014-2015: Chapter 4, A simple functional language, by Matthew Hennessy, Trinity College Dublin, University
- f Dublin, 2014. https://www.scss.tcd.ie/Matthew.Hennessy/
splexternal2015/LectureNotes/Notes14%20copy.pdf ◮ William Cook, Anatomy of Programming Languages, Chapter 3, http://www.cs.utexas.edu/~wcook/anatomy/anatomy.htm ✚ The Y in the equation (Y F) = (F (Y F)) is a Y-combinator (discussed later) is a program that builds programs. It was the inspiration of the well-known Y-Combinator start-up incubator (http://www.ycombinator.com) which is a business that builds businesses.
CIS 352 ❖ Names & Functions 2
LFP = LC + λ + function application + variables
LFP Expressions
E ::= n | b | ℓ | E iop E | E cop E | if E then E else E | !E | E : = E | skip | E; E | while E do E | x | λx.E | E E
- the λ-calculus
| let X = E in E
- where
◮ x ∈ V, an unlimited set of variables ◮ n ∈ Z (integers), b ∈ B (booleans), ℓ ∈ L (locations) ◮ iop ∈ (integer-valued binary operations: +, −, ∗, etc.) ◮ cop ∈ (comparison operations: ==, <, =, etc.)
CIS 352 ❖ Names & Functions 3
fv(E) = the set of free variables of LFP expression E
Definition: fv(n), fv(b), fv(ℓ), fv(skip)
- = ∅.
fv(!E) = fv(E). fv(E1 iop E2), fv(E1 cop E2), fv(E1 : = E2), fv(E1; E2), fv(while E1 do E2), fv(E1 E2) = fv(E1) ∪ fv(E2). fv(if E0 then E1 else E2) = fv(E0) ∪ fv(E1) ∪ fv(E2). fv(x) = { x }. fv(λx.E) = fv(E) − { x }. fv(let x = E1 in E2) = fv(E1) ∪ (fv(E2) − { x })
CIS 352 ❖ Names & Functions 4