

The article discusses how much lambda calculus can express. Lambda calculus is a language featuring only variables, lambda abstractions, and function applications. In a future post, we will go over some of the answers and analyze how they work.21 August 2019 21:00 (Last update: 22 August 2019 11:56) No constraints: everyone could get as creative as they wanted. Sends a GET request to and verifies the SSL certificate validity, printing out its expiration date.Builds a linked list of 1,000,000 elements, and.Prints out the message “Hello, World” in binary,.For a recent presentation of this λ-calculus material, we asked attendees to build a program (function definitions and β-reduction) in λ-calculus that: PRED := λn.n (λg.λk.ISZERO (g 1) k (PLUS (g k) 1)) (λv.0) 0Īt Cynnovative we like to challenge ourselves with every new piece of knowledge we obtain. AND/OR/NOT/IFTHENELSE) can also be defined using λ-calculus: TRUE := λx.λy.xĪnd more importantly, we can also do other predicate operations (operations that result in a Boolean value) like checking if an input is zero, less than or equal, etc.: ISZERO := λn.n (λx.FALSE) TRUE CHURCH BOOLEANSīooleans, the data types that allow us to represent true/false values and conditional operators (e.g. PRED := λn.λf.λx.n (λg.λh.h (g f)) (λu.x) (λu.u)Īt this point we can celebrate, because we can perform arithmetic operations that were first seen in 18,000 BC using λ-calculus. can be defined as functions using lambda calculus: SUCC := λn.λf.λx.f (n f x) The trusted arithmetic operators we are all familiar with, like addition, subtraction, multiplication, etc. Now we can write numbers that were first introduced in 700 AD using λ-calculus.

In our example of 9, it would look like: 9 := λf.λx.f (f (f (f (f (f (f (f (f x))))))))

We can define traditional numbers using Church Numerals like so: 0 := λf.λx.x That is, a Church numeral n (for example, 9) is a function that takes a function f as argument and returns the n-th (in our example, 9th) composition of f. CHURCH NUMERALSĬhurch Numerals are higher order functions. Now that we understand the fundamentals, we can dive into the basics of λ-calculus: Church Numerals (numbers), arithmetic, and boolean algebra. η-reduction (eta reduction, not n-reduction): captures extensionality (local completeness, aka.β-reduction: applying functions to their arguments (aka executing a function).α-conversion: changing bound variables (aka renaming variables).Reduction operations come in three flavors: Term syntax are pretty straightforward to understand: The other fundamental concepts to know about λ-calculus are the term syntax and reduction operations.
#Lambda calculus boolean series#
Currying is the technique to convert a multi-input function into a series of single-input functions.Ĭonsider the below example in pseudo-code, comparing Python to λ-calculus: # Python definition In order to ‘create’ a multi-input function, currying is needed. Functions are single input (allowing the study of functions in simpler theoretical models).The fundamentals of λ-calculus are straightforward: If we were to place λ-calculus in a poorly scaled longcat in relation to other programming languages, it would look something like this: Λ-calculus is not formal language research (though we are sure someone with a lot of creativity has found a way to leverage it) or esoteric language research (the syntax of λ-calculus might be initially off putting, but it was not built with that purpose). It provides a baseline to answer the question of what does it mean to compute. Recall that λ-calculus focuses on the concept of computation. Why learn it or, in this case, explain it to the reader? Understanding λ-calculus provides a deeper understanding of what computation (and computer science) is, and foments an increased appreciation of high-level programming languages. That is a fancy way of saying that the purpose of λ-calculus is to define a common framework of understanding on which research of computation as a concept can be done. Created by Alonzo Church in the 1930s (a decade that had other notable inventions like Monopoly, nylon, frozen foods, polarizing glass and the Zippo lighter), λ-calculus is defined as a formal system for expressing computation based on function abstraction and application using variable binding and substitution 1. For those not yet initiated in λ-calculus, the first questions are usually the four Ws: What, Who, When, and Why.
