![]() For instance, the following expressions are alphabetic variants of one another: (λ x (λ y (x (+ y x)))) (λ z (λ y (z (+ y z)))) To create an alphabetic variant for an expression of the form "(λ var body)", simply replace each free occurrence of "var" in the expression with "new", where "new" is a variable symbol not occurring anywhere in "body". Roughly, two expressions are "alphabetic variants" if they are identical except perhaps for the choice of variable symbols. This tutorial is trying not to be overly pedantic, so for present purposes I don't care.ġ3 (λ x (λ y (x (+ y x)))) (λ z (λ y (z (+ y z))))Īlpha reduction The solution is to make use of alphabetic variants. By the way, some people say "λ-conversion" instead of λ-reduction others reserve "λ-conversion" to refer specifically to a single step in a series of reductions. The key operation, the one that does the heavy lifting, is called β-reduction, and that is operation we will discuss first. ![]() In the usual case, λ-reduction is actually a combination of three distinct reduction operations, each of which is discussed below. The key notion of the λ-calculus is that it is possible to arrive at a logically equivalent expression by means of a process called λ-reduction. As we have seen, to improve readability, multiple lambdas are suppressed, so: x y. E is also called lambda abstraction, or simply abstraction E are called l-terms or l-expressionsħ (x.x) y (x.f x) x y (x.x) (x.x) (x.x y) z (x y.x) t f (x y z.z x y) a b (x y.x) (f g.f g) (x.x) (x.x) z (x y.x y) y (x y.x y) (x.x) (x.x) (x y.x y) ((x.x) (x.x))Ĩ Curried Functions Since a lambda abstraction only binds a single variable, functions with multiple parameters must be modelled as Curried higher-order functions. g.xĮ ::= x variables | E1 E function application | lx. ![]() f.x y f.(x y) Application is left-associative x y z (x y) z Multiple lambdas may be suppressed f g.x f. f (g x)Ĥ The lambda calculus can be viewed as the simplest possible pure functional programming language.ĥ Lambda extends as far as possible to the right Consider the Haskell function: The value of compose is the anonymous lambda abstraction: f g x. x - is a function taking an argument x, and returning x f x - is a function f applied to an argument xĪ lambda abstraction is just an anonymous function. ![]() e an abstraction (function) | e1 e2 a (function) application Examples: x. The Lambda Calculus was invented by Alonzo Church as a mathematical formalism for expressing computation by functions. x - is a function taking an argument x, and returning x Syllabus: Lambda notation for functions – syntax – curried functions – parametric polymorphism – lambda reduction – alpha reduction – beta reduction – beta abstraction – extensionality theorem – delta reduction – reduction strategies – normal forms Church-Rosser Theorems – pure lambda calculus – constants – arithmetic – conditionals Iteration – recursion – introduction to functional programmingĢ x. ![]() Presentation on theme: "Unit – 3 :LAMBDA CALCULUS AND FUNCTIONAL PROGRAMMING"- Presentation transcript:ġ Unit – 3 :LAMBDA CALCULUS AND FUNCTIONAL PROGRAMMING ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |