Objectives You should be able to ... Lambda Calculus Examples Here - - PowerPoint PPT Presentation

objectives
SMART_READER_LITE
LIVE PREVIEW

Objectives You should be able to ... Lambda Calculus Examples Here - - PowerPoint PPT Presentation

Objectives Examples Objectives Examples Objectives You should be able to ... Lambda Calculus Examples Here are some examples! Dr. Mattox Beckman Perform a beta-reduction. Detect -capture and use -renaming to avoid it.


slide-1
SLIDE 1

Objectives Examples

Lambda Calculus Examples

  • Dr. Mattox Beckman

University of Illinois at Urbana-Champaign Department of Computer Science

Objectives Examples

Objectives

You should be able to ...

Here are some examples!

◮ Perform a beta-reduction. ◮ Detect α-capture and use α-renaming to avoid it. ◮ Normalize any given λ-calculus term.

Objectives Examples

Examples

(λx.x) a (λx.x x) a (λx.y x) a (λx.λa.x) a (λx.λx.x) a (λx.(λy.y) x) a

Objectives Examples

Examples

(λx.x) a →β a (λx.x x) a (λx.y x) a (λx.λa.x) a (λx.λx.x) a (λx.(λy.y) x) a @ λx x a →β a

slide-2
SLIDE 2

Objectives Examples

Examples

(λx.x) a →β a (λx.x x) a →β a a (λx.y x) a (λx.λa.x) a (λx.λx.x) a (λx.(λy.y) x) a @ λx @ x x a →β @ a a

Objectives Examples

Examples

(λx.x) a →β a (λx.x x) a →β a a (λx.y x) a →β y a (λx.λa.x) a (λx.λx.x) a (λx.(λy.y) x) a @ λx @ y x a →β @ y a

Objectives Examples

Examples

(λx.x) a →β a (λx.x x) a →β a a (λx.y x) a →β y a (λx.λa.x) a →α (λx.λa′.x) →β λa′.a (λx.λx.x) a (λx.(λy.y) x) a @ λx λa x a → λa a →α,β λa′ a

Objectives Examples

Examples

(λx.x) a →β a (λx.x x) a →β a a (λx.y x) a →β y a (λx.λa.x) a →α (λx.λa′.x) →β λa′.a (λx.λx.x) a →β λx.x (λx.(λy.y) x) a @ λx λx x a →β λx x

slide-3
SLIDE 3

Objectives Examples

Examples

(λx.x) a →β a (λx.x x) a →β a a (λx.y x) a →β y a (λx.λa.x) a →α (λx.λa′.x) →β λa′.a (λx.λx.x) a →β λx.x (λx.(λy.y) x) a →β (λy.y) a @ λx @ λy y x a →β @ λy y a →β a

Objectives Examples

Examples

(λx.x) a →β a (λx.x x) a →β a a (λx.y x) a →β y a (λx.λa.x) a →α (λx.λa′.x) →β λa′.a (λx.λx.x) a →β λx.x (λx.(λy.y) x) a →β (λy.y) a →β a @ λx @ λy y x a →β @ λy y a →β a

Objectives Examples

α capture

(λx.λa.x) a →α (λx.λa′.x) →β λa′.a

◮ If a free occurrence of a variable gets placed under a λ that binds it, this is called α

capture.

◮ To resolve this, rename the binder.

Objectives Examples

Here’s One for You to Try!

◮ Convert this tree into an equivalent λ term. ◮ Identify the free variables. ◮ Simplify it by performing as many β reductions (and necessary α renamings) as possible.

@ @ λx λf @ f x λq f λa @ a a

slide-4
SLIDE 4

Objectives Examples

Solution

@ @ λx λf @ f x λq f λa @ a a (λxf.fx)(λq.f)(λa.aa)

◮ There is one free variable ....

Objectives Examples

Solution, Step 1

@1 @2 λx λf @3 f x λq f λa @4 a a @1 @2 λx λf′ @3 f′ x λq f λa @4 a a (λxf.fx)(λq.f)(λa.aa) →α (λxf′.f′x)(λq.f)(λa.aa)

Objectives Examples

Solution, Step 2

@1 @2 λx λf′ @3 f′ x λq f λa @4 a a @ f @ f q f a @ a a (λxf′.f′x)(λq.f)(λa.aa) →β f f q f a aa

Objectives Examples

Solution, Step 2

@1 @2 λx λf′ @3 f′ x λq f λa @4 a a @1 λf′ @3 f′ λq f λa @4 a a (λxf′.f′x)(λq.f)(λa.aa) →β (λf′.f′(λq.f))(λa.aa)

slide-5
SLIDE 5

Objectives Examples

Solution, Step 3

@1 λf′ @3 f′ λq f λa @4 a a @ a @ a a q f (λf′.f′(λq.f))(λa.aa) →β a aa q f

Objectives Examples

Solution, Step 3

@1 λf′ @3 f′ λq f λa @4 a a @3 λa @4 a a λq f (λf′.f′(λq.f))(λa.aa) →β (λa.aa)(λq.f)

Objectives Examples

Solution, Step 4

@3 λa @4 a a λq f @ q f q f (λf′.f′(λq.f))(λa.aa) →β q f q f

Objectives Examples

Solution, Step 4

@3 λa @4 a a λq f @4 λq f λq f (λf′.f′(λq.f))(λa.aa) →β (λq.f)(λq.f)

slide-6
SLIDE 6

Objectives Examples

Solution, Step 5

@4 λq f λq f f (λq.f)(λq.f) →β f

Objectives Examples

Solution, Step 5

@4 λq f λq f f (λq.f)(λq.f) →β f