1 / 10

Mathematical Foundations

Mathematical Foundations. Supplemental material – not on exam. Lambda Calculus. From wikipedia.

sylvie
Download Presentation

Mathematical Foundations

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Mathematical Foundations Supplemental material – not on exam

  2. Lambda Calculus

  3. From wikipedia • Lambda calculus (also written as λ-calculus) is a formal system in mathematical logic and computer science for expressing computation based on function abstraction and application using variable binding and substitution. • In other words, this formalizes the concept of a function applied to arguments, so that we can reason about it • Name derives from the Greek letter lambda (λ) used to denote binding a variable in a function. http://en.wikipedia.org/wiki/Lambda_calculus

  4. Why? Computability theory • Computability is the ability to solve a problem in an effective manner. • Alonzo Church used lambda calculus to formalize the concept of effective computability. • Lambda calculus has been shown to have computationally equivalent power to Turing computability (Church-Turing thesis) • Lambda calculus is considered by some to be the world’s first programming language, although it is really intended to modelcomputation rather than to describe algorithms. • Stack, Environment, Control, Dump (SECD) machine proposed as an abstract machine intended as a target for functional programming language compilers. • LISP and other functional programming languages essentially implement the calculus.

  5. Main ideas • Lambda calculus is a simple notation for functions and application • Main ideas: • Applying a function to an argument • Forming functions by abstraction • What is a function? • Extensional view: sets of ordered pairs. (1,1),(2,8),(3,9),(4,16) • Intensional view: rules of computation From http://plato.stanford.edu/entries/lambda-calculus/

  6. Language Syntax* • Lambda expressions are composed (the language alphabet) of • variables v1, v2, ..., vn, ... • the abstraction symbols lambda 'λ' and dot '.' • parentheses ( ) • The set of lambda expressions, Λ, can be defined inductively: • If x is a variable, then x ∈ Λ • If x is a variable and M ∈ Λ, then (λx.M) ∈ Λ • If M, N ∈ Λ, then (M N) ∈ Λ • Instances of rule 2 are known as abstractions and instances of rule 3 are known as applications. • Slightly different notations can be found, this is from wikipedia

  7. Monads

  8. What is a monad? • From: • http://en.wikipedia.org/wiki/Monads_in_functional_programming • http://stackoverflow.com/questions/44965/what-is-a-monad • Monad is a structure that represents computations defined as sequences of steps • A type with a monad structure defines what it means to chain operations • Ex: [x*2 | x<-[1..10], odd x] • operation returns a list • following operations performed on every item of the list

  9. Mathematical Definition • From wikipedia: • branch of mathematics called category theory • monad is triple: functor + 2 natural transformations • functional programming monads correspond to strong monads in category theory

  10. Monadic type • A monad consists of a type constructor M and two operations, bind and return • returntakes a plain value and uses the constructor to place it in a monadic container, thus creating a monadic value • binddoes the reverse: extracts the value from the container and passes it to the next function in the pipeline What does this sound like?

More Related