Lambda calculus

755 views
521 views

Published on

A little bit of Lamba Calculus.
What is that and how it is applied in functional programming languages.
Currying, High Order Functions, Anonymous Functions

Published in: Technology, Business
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
755
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
28
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Lambda calculus

  1. 1. Lambda Calculus 1
  2. 2. Origin  First observed in the late 1890s  Formalized in the 1930s  Developed in order to study mathematical properties.  Lambda calculus is a conceptually simple universal model of computation 2
  3. 3. Motivation  The lambda calculus can be called the smallest universal programming language of the world 3
  4. 4. What is this?  The name derives from the Greek letter lambda (λ) used to denote binding a variable in a function  Single transformation rule -> variable substitution  Single function definition schema  Any computable function can be expressed and evaluated using this formalism  Functional Programming essentially implements this calculus  The λ-calculus provides a simple semantics for computation, enabling properties of computation to be studied formally 4
  5. 5. Lambda Terms  a variable is itself a valid lambda term  if t is a lambda term, and x is a variable, then ( λx.t) is a lambda term (called a lambda abstraction);  if t and s are lambda terms, then (ts) is a lambda term (called an application).  Thus a lambda term is valid if and only if it can be obtained by repeated application of these three rules 5
  6. 6. lambda abstraction  λ x.t  X is the input  T is the expression  λ x.x+2 == f(x) = x +2 6
  7. 7. Lambda Property - 1  Lambda:  sqsum(x, y) = x*x + y*y  (x, y) ↦ x*x + y*y 7
  8. 8. Lambda Property – 1 -Equivalent  In computer programming, an anonymous function (also function constant, function literal, or lambda function) is a function (or a subroutine) defined, and possibly called, without being bound to an identifier. 8
  9. 9. Lambda Property-2  In lambda calculus, functions are taken to be 'first class values', so functions may be used as the inputs, or be returned as outputs from other functions. 9
  10. 10. Lambda Property-2 - Equivalent  In mathematics and comp uter science, a higher- order function (also functional form, functional or funct or) is a function that does at least one of the following:  take one or more functions as an input  output a function 10
  11. 11. Lambda Property 3  1 - (x, y) ↦ x*x + y*y 1.1 – (5,2) == 5*5 + 2*2 = 29  2 - ((x ↦ (y ↦ x*x + y*y))  2.2 - = (y ↦ 5*5 + y*y)(5)  2.2 - = 5*5 + 2*2 = 29 11
  12. 12. Lambda Property 3 - Equivalent  In mathematics and com puter science, currying is the technique of transforming a function that takes multiple arguments (or a tuple of arguments) in such a way that it can be called as a chain of functions, each with a single argument 12
  13. 13. Much more  α-conversion: changing bound variables (alpha);  β-reduction: applying functions to their arguments (beta);  η-conversion: which captures a notion of extensionality (eta).  Recursion  Parallelism and concurrency 13
  14. 14. That is all 14 http://www.linkedin.com/in/diegomendonca

×