lambda calculus
play

Lambda Calculus Dr. Mattox Beckman University of Illinois at - PowerPoint PPT Presentation

Objectives Lambda Calculus Lambda Calculus Dr. Mattox Beckman University of Illinois at Urbana-Champaign Department of Computer Science Objectives Lambda Calculus Objectives You should be able to ... The purposes of this lecture is to


  1. Objectives Lambda Calculus Lambda Calculus Dr. Mattox Beckman University of Illinois at Urbana-Champaign Department of Computer Science

  2. Objectives Lambda Calculus Objectives You should be able to ... The purposes of this lecture is to introduce lambda calculus and explain the role it has in programming languages. ◮ Explain the three constructs of λ -calculus. ◮ Given a syntax tree diagram, write down the equivalent λ -calculus term. ◮ Perform a beta-reduction.

  3. 1. Variables: x y z – usually we assume they are all one letter long. 2. Function application: fy abc x fy fg 3. Functions (Also called abstractions .) x x ab fab xy g z zf yx Used extensively in research. The “little white mouse” of computer science. We can implement this trivially in Haskell. x x = \x -> x . Objectives Lambda Calculus The λ -Calculus ◮ Contains three kinds of things:

  4. 2. Function application: fy abc x fy fg 3. Functions (Also called abstractions .) x x ab fab xy g z zf yx Used extensively in research. The “little white mouse” of computer science. We can implement this trivially in Haskell. x x = \x -> x . Objectives Lambda Calculus The λ -Calculus ◮ Contains three kinds of things: 1. Variables: x y 3 z ′ – usually we assume they are all one letter long.

  5. 3. Functions (Also called abstractions .) x x ab fab xy g z zf yx Used extensively in research. The “little white mouse” of computer science. We can implement this trivially in Haskell. x x = \x -> x . Objectives Lambda Calculus The λ -Calculus ◮ Contains three kinds of things: 1. Variables: x y 3 z ′ – usually we assume they are all one letter long. 2. Function application: fy abc x ( fy )( fg )

  6. Used extensively in research. The “little white mouse” of computer science. We can implement this trivially in Haskell. x x = \x -> x . Objectives Lambda Calculus The λ -Calculus ◮ Contains three kinds of things: 1. Variables: x y 3 z ′ – usually we assume they are all one letter long. 2. Function application: fy abc x ( fy )( fg ) 3. Functions (Also called abstractions .) λ x . x λ ab . fab λ xy . g ( λ z . zf ) yx

  7. Objectives Lambda Calculus The λ -Calculus ◮ Contains three kinds of things: 1. Variables: x y 3 z ′ – usually we assume they are all one letter long. 2. Function application: fy abc x ( fy )( fg ) 3. Functions (Also called abstractions .) λ x . x λ ab . fab λ xy . g ( λ z . zf ) yx ◮ Used extensively in research. The “little white mouse” of computer science. ◮ We can implement this trivially in Haskell. λ x . x = \x -> x .

  8. Objectives Lambda Calculus Examples λ x . x “The identity” λ x . xx “Delta” λ ab . fabxy ( λ ab . fab ) xy ( λ a .λ b . fab ) xy ( λ fx . xf )( λ g . gx )( λ f . f ) zy

  9. Objectives Lambda Calculus Syntax Trees Example 1 Example 2 Example 3 Example 4 λ z @ @ z λ y @ λ y λ x λ y x @ @ @ λ x y y y x x z z x λ x . x λ y . yx ( λ y . y ) xz λ z . ( λ x . xz )( λ y . yz )

  10. Objectives Lambda Calculus Bound and Free ◮ The λ creates a binding . ◮ An occurance of the the variable inside the function body is said to be bound . ◮ Bound variables occur “under the λ ” that binds them. Examples: Where are the free variables? To which lambdas are bound variables bound? λ z λ x λ z @ @ @ λ y λ y λ y λ x λ z λ z @ @ @ @ @ @ y y y x z z x z z x z z λ z . ( λ x . xz )( λ y . yz ) λ x . ( λ z . xz )( λ y . yz ) λ z . ( λ z . xz )( λ y . yz )

  11. Objectives Lambda Calculus Function Application ( λ x . M ) N [ N / x ] M �→ [ N / x ] y = y [ N / x ] x = N [ N / x ] ( M P ) = ([ N / x ] M [ N / x ] P ) [ N / x ] ( λ y . M ) = λ y . [ N / x ] M [ N / x ] ( λ x . M ) = λ x . M

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend