λ Calculus in ५ minutes

https://www.maqbool.net
Mohd Maqbool Alam

Alonzo Church (1903-1995)

 

Image credit : Wikipedia 
Image credit : Wikipedia 

Alan Turing (1912 - 1954)

Image credit : Wikipedia 

Church-Turing thesis

Main idea

  • In 1936, two papers came up with definitions of algorithms.
  • Alonzo Church used λ-calculus to define algorithms.
  • Alan Turing used Turing machines to define algorithms.
  • It turns out that both definitions are equivalent!

Syntax

  1. A variable is a lambda expression (we will use single, lower-case letters for variables).
  2. If M and N are lambda expressions, then so are each of the following:
    1. (M)
    2. λid.M //abstraction
    3. MN //application
credit : http://pages.cs.wisc.edu/~horwitz/

Context-free grammar

 

exp ID
  | ( exp )
  | λ ID . exp // abstraction
  | exp exp // application

 

AST of (λx.x+1)3

abstract-syntax tree

credit : http://pages.cs.wisc.edu/~horwitz/

Logical  Operators

  • True

 

true = λ ab.a

 

  • False

 

true = λ ab.b

Logical  Operators

  • And

 

and = λ pq. pqp

 

  • Or

 

and = λ pq. ppq

Church Numerals

  1.  λ ab. ab

  2.  λ ab . a(ab)

  3.  λ ab . a(a(a b))

...

λf. (λx. f (x x))(λx. f (x x))

Resources

  • http://www.doc.ic.ac.uk/~mrc/
  • https://brilliant.org/wiki/lambda-calculus/
  • http://pages.cs.wisc.edu/~horwitz/CS704-NOTES/1.LAMBDA-CALCULUS.html

Elixir Delhi Community

  • meetup.com/Elixirlang-Delhi-NCR/

  • t.me/elixirdelhi

  • twitter.com/elixirdelhi

  • facebook.com/ElixirDelhi/

Image credit : https://elixirforum.com/u/romariolopezc/