The dream of

λ Calculus

 

Vincent

RC F2'2019

What I'm doing here

  • Learn about programming languages design (mainly through "Types and programming languages" from Pierce) ...
  • ... in the perspective of building my own later

Background Story

  • Invented by Alzonzo Church (1936)
  • Church Turing Thesis: functions computable in are function computable in a Turing machine
  • Fun fact: Church was the doctoral advisor of Turing

Syntax

 

How the hell can computability be captured with such a tiny syntax ?

  • x  (define a variable)
  • λx. t (function of param x and body t)
  • f t (function application: f applied to t)

No builtin constant or operators, no numbers, no loops...everything is a function

Semantics

  • (λx.x) (λz. (λx.x z))
  • λz. (λx.x z)
  • λz.z

How to evaluate a term ? idea: substitute right hand side of a term for bound variable in the body of the function

Multiple arg function

Idea: use higher order functions

λx.λy.x y

 

This can equivalently be seen as a function which returns a function (ie given x, it returns the function λy. x y, and a function of two arguments. => currying

Boolean encoding

  • true = λt. λf. t
  • false = λt.λf. f
  • reminder: every value is a function
  • if = λb.λx.λy. b x y (where b is true or false)
  • not =λb.b false true

 

And many more...

  • numbers
  • arithmetic operation
  • recursion with infamous ycombinator:
    λf. (λx. f (λy. x x y)) (λx. f (λy. x x y))

Conclusion

  • Not practical
  • but interesting to see that computability can be built from such a tiny core
  • gave rise to functional programming

Thank you !

The dream of the lambda Calculus

By v-perez

The dream of the lambda Calculus

  • 811