Strict Ideal Completions of the Lambda Calculus Patrick Bahr IT - - PowerPoint PPT Presentation

strict ideal completions of the lambda calculus
SMART_READER_LITE
LIVE PREVIEW

Strict Ideal Completions of the Lambda Calculus Patrick Bahr IT - - PowerPoint PPT Presentation

Strict Ideal Completions of the Lambda Calculus Patrick Bahr IT University of Copenhagen FSCD 2018 Infinitary Lambda Calculus N N y N y y . . . where N = ( x . x x y )( x . x x y ) 1 / 13 Infinitary Lambda Calculus N N


slide-1
SLIDE 1

Strict Ideal Completions

  • f the Lambda Calculus

Patrick Bahr

IT University of Copenhagen

FSCD 2018

slide-2
SLIDE 2

Infinitary Lambda Calculus

N → N y → N y y → . . . where N = (λx.x x y)(λx.x x y)

1 / 13

slide-3
SLIDE 3

Infinitary Lambda Calculus

N → N y → N y y → . . . where N = (λx.x x y)(λx.x x y)

◮ Can we give a meaningful

(infinite) result term for such a non-terminating reduction?

1 / 13

slide-4
SLIDE 4

Infinitary Lambda Calculus

N → N y → N y y → . . . where N = (λx.x x y)(λx.x x y)

◮ Can we give a meaningful

(infinite) result term for such a non-terminating reduction?

◮ How about the infinite term

((. . . y) y) y? app app app y y y

1 / 13

slide-5
SLIDE 5

Infinitary Lambda Calculus

N → N y → N y y → . . . where N = (λx.x x y)(λx.x x y)

◮ Can we give a meaningful

(infinite) result term for such a non-terminating reduction?

◮ How about the infinite term

((. . . y) y) y? app app app y y y

◮ There is no single true answer to this question.

1 / 13

slide-6
SLIDE 6

Different Infinitary Calculi

◮ Infinite normal forms induce a model of the

lambda calculus, e.g.

◮ B¨

  • hm Trees, Levy-Longo Trees, Berarducci Trees

2 / 13

slide-7
SLIDE 7

Different Infinitary Calculi

◮ Infinite normal forms induce a model of the

lambda calculus, e.g.

◮ B¨

  • hm Trees, Levy-Longo Trees, Berarducci Trees

◮ In the infinitary lambda calculus corresponding

to Berarducci Trees, the reduction N → N y → N y y → . . . converges to ((. . . y) y) y

◮ but does not converge in the calculi corresp. to

  • hm Trees and Levy-Longo Trees

2 / 13

slide-8
SLIDE 8

When do infinite reductions converge?

Many variants of infinitary calculi

◮ metric spaces metric completion ◮ partial orders ideal completion ◮ topological spaces ◮ coinductive definitions

3 / 13

slide-9
SLIDE 9

When do infinite reductions converge?

Many variants of infinitary calculi

◮ metric spaces metric completion ◮ partial orders ideal completion ◮ topological spaces ◮ coinductive definitions

3 / 13

slide-10
SLIDE 10

When do infinite reductions converge?

Many variants of infinitary calculi

◮ metric spaces metric completion ◮ partial orders ideal completion ◮ topological spaces ◮ coinductive definitions

Metric completion approach

◮ adjusting the metric yields different calculi

This talk

◮ Can we do the same for partial orders?

3 / 13

slide-11
SLIDE 11

Overview

  • 1. Metric Completion
  • 2. Ideal Completion
  • 3. Results
slide-12
SLIDE 12

Metric Completion

  • N. Dershowitz, S. Kaplan, D.A. Plaisted. Rewrite, rewrite, rewrite, rewrite,

rewrite, ... Theoretical Computer Science, 83(1):71–96, 1991.

  • R. Kennaway, J.W. Klop, M.R. Sleep, and F.-J. de Vries. Infinitary lambda
  • calculus. Theoretical Computer Science, 175(1):93–125, 1997.
slide-13
SLIDE 13

Metric on lambda terms

Standard metric on terms

d(M, M) = 0, and d(M, N) = 2−d if M = N, where d = minimum depth at which M, N differ

4 / 13

slide-14
SLIDE 14

Metric on lambda terms

Standard metric on terms

d(M, M) = 0, and d(M, N) = 2−d if M = N, where d = minimum depth at which M, N differ

Example

d( λx.x , x y ) = 2−0 = 1 d( λx.x , λx.y ) = 2−1 = 1 2

4 / 13

slide-15
SLIDE 15

Metric on lambda terms

Standard metric on terms

d(M, M) = 0, and d(M, N) = 2−d if M = N, where d = minimum depth at which M, N differ

Example

d( λx.x , x y ) = 2−0 = 1 d( λx.x , λx.y ) = 2−1 = 1 2

4 / 13

slide-16
SLIDE 16

Metric on lambda terms

Standard metric on terms

d(M, M) = 0, and d(M, N) = 2−d if M = N, where d = minimum depth at which M, N differ

Example

d( λx.x , x y ) = 2−0 = 1 d( λx.x , λx.y ) = 2−1 = 1 2 We can manipulate d by changing the notion of depth.

4 / 13

slide-17
SLIDE 17

Strictness

A triple abc ∈ {0, 1}3 describes how to measure depth.

◮ a = 1 iff lambda abstraction is counted ◮ b = 1 iff application from the left is counted ◮ c = 1 iff application from the right is counted

5 / 13

slide-18
SLIDE 18

Strictness

A triple abc ∈ {0, 1}3 describes how to measure depth.

◮ a = 1 iff lambda abstraction is counted ◮ b = 1 iff application from the left is counted ◮ c = 1 iff application from the right is counted

Example

d111(λx.x x, λx.x y) = 2−2 = 1/4

5 / 13

slide-19
SLIDE 19

Strictness

A triple abc ∈ {0, 1}3 describes how to measure depth.

◮ a = 1 iff lambda abstraction is counted ◮ b = 1 iff application from the left is counted ◮ c = 1 iff application from the right is counted

= standard metric d

Example

d111(λx.x x, λx.x y) = 2−2 = 1/4

5 / 13

slide-20
SLIDE 20

Strictness

A triple abc ∈ {0, 1}3 describes how to measure depth.

◮ a = 1 iff lambda abstraction is counted ◮ b = 1 iff application from the left is counted ◮ c = 1 iff application from the right is counted

Example

d111(λx.x x, λx.x y) = 2−2 = 1/4 d011(λx.x x, λx.x y) = 2−1 = 1/2 d001(λx.x x, λx.x y) = 2−1 = 1/2 d010(λx.x x, λx.x y) = 2−0 = 1

5 / 13

slide-21
SLIDE 21

Strictness

A triple abc ∈ {0, 1}3 describes how to measure depth.

◮ a = 1 iff lambda abstraction is counted ◮ b = 1 iff application from the left is counted ◮ c = 1 iff application from the right is counted

Example

d111(λx.x x, λx.x y) = 2−2 = 1/4 d011(λx.x x, λx.x y) = 2−1 = 1/2 d001(λx.x x, λx.x y) = 2−1 = 1/2 d010(λx.x x, λx.x y) = 2−0 = 1 The infinite term ((. . . y) y) y is in the metric completion of d010 but not d001.

5 / 13

slide-22
SLIDE 22

Infinitary Lambda Calculus

A reduction t0 → t1 → t2 → . . . converges to t iff

◮ depth of contracted redexes tends to infinity, ◮ lim i→ωti = t.

6 / 13

slide-23
SLIDE 23

Infinitary Lambda Calculus

A reduction t0 → t1 → t2 → . . . converges to t iff

◮ depth of contracted redexes tends to infinity, ◮ lim i→ωti = t.

  • hm reduction

In addition, we need rewrite rules t → ⊥ for each t that is root-active (= can be contracted at depth 0 arbitrarily often)

6 / 13

slide-24
SLIDE 24

Properties of the metric completion

Theorem ([Kennaway et al.])

◮ Infinitary B¨

  • hm reduction is confluent (for 001,

101, and 111) and normalising (in general).

◮ Its unique normal forms are B¨

  • hm Trees (001),

Levy-Longo Trees (101), and Berarducci Trees (111).

7 / 13

slide-25
SLIDE 25

Properties of the metric completion

Theorem ([Kennaway et al.])

◮ Infinitary B¨

  • hm reduction is confluent (for 001,

101, and 111) and normalising (in general).

◮ Its unique normal forms are B¨

  • hm Trees (001),

Levy-Longo Trees (101), and Berarducci Trees (111).

Example

N → N y → N y y → . . . converges to the infinite term ((. . . y) y) y in 111, but not in 001, 101 (((. . . y) y) y is not even a valid term in 001, 101).

7 / 13

slide-26
SLIDE 26

Ideal Completion

slide-27
SLIDE 27

Partial on lambda terms

Standard partial order on terms

Least monotone, partial order ≤⊥ such that ⊥ ≤⊥ M, for any M i.e. M ≤⊥ N if N is obtained from M by replacing ⊥ with arbitrary terms

8 / 13

slide-28
SLIDE 28

Partial on lambda terms

Standard partial order on terms

Least monotone, partial order ≤⊥ such that ⊥ ≤⊥ M, for any M i.e. M ≤⊥ N if N is obtained from M by replacing ⊥ with arbitrary terms

8 / 13

slide-29
SLIDE 29

Partial on lambda terms

Standard partial order on terms

Least monotone, partial order ≤⊥ such that ⊥ ≤⊥ M, for any M i.e. M ≤⊥ N if N is obtained from M by replacing ⊥ with arbitrary terms

Generalisation to ≤abc

◮ We adjust definition of ≤⊥ by restricting

monotonicity

◮ For example:

λx.⊥ ≤011

λx.M.

8 / 13

slide-30
SLIDE 30

Partial order ≤abc

⊥ Least partial order ≤abc

such that ⊥ ≤abc

M λx.M ≤abc

λx.M′ if M ≤abc

M′

9 / 13

slide-31
SLIDE 31

Partial order ≤abc

⊥ Least partial order ≤abc

such that ⊥ ≤abc

M λx.M ≤abc

λx.M′ if M ≤abc

M′ and M = ⊥ or a = 1

9 / 13

slide-32
SLIDE 32

Partial order ≤abc

⊥ Least partial order ≤abc

such that ⊥ ≤abc

M λx.M ≤abc

λx.M′ if M ≤abc

M′ and M = ⊥ or a = 1 MN ≤abc

M′N if M ≤abc

M′ and M = ⊥ or b = 1 MN ≤abc

MN′ if N ≤abc

N′ and N = ⊥ or c = 1

9 / 13

slide-33
SLIDE 33

Partial order ≤abc

⊥ Least partial order ≤abc

such that ⊥ ≤abc

M monotonicity λx.M ≤abc

λx.M′ if M ≤abc

M′ and M = ⊥ or a = 1 MN ≤abc

M′N if M ≤abc

M′ and M = ⊥ or b = 1 MN ≤abc

MN′ if N ≤abc

N′ and N = ⊥ or c = 1

9 / 13

slide-34
SLIDE 34

Partial order ≤abc

⊥ Least partial order ≤abc

such that ⊥ ≤abc

M monotonicity λx.M ≤abc

λx.M′ if M ≤abc

M′ and M = ⊥ or a = 1 MN ≤abc

M′N if M ≤abc

M′ and M = ⊥ or b = 1 MN ≤abc

MN′ if N ≤abc

N′ and N = ⊥ or c = 1 ≤111

is just the standard partial order ≤⊥

9 / 13

slide-35
SLIDE 35

Partial order ≤abc

⊥ Least partial order ≤abc

such that ⊥ ≤abc

M monotonicity λx.M ≤abc

λx.M′ if M ≤abc

M′ and M = ⊥ or a = 1 MN ≤abc

M′N if M ≤abc

M′ and M = ⊥ or b = 1 MN ≤abc

MN′ if N ≤abc

N′ and N = ⊥ or c = 1 ≤111

is just the standard partial order ≤⊥

Example

◮ λx.⊥ ≤001

λx.x x, λx.⊥ x ≤001

λx.x x, λx.x ⊥ ≤001

λx.x x

9 / 13

slide-36
SLIDE 36

Partial order ≤abc

⊥ Least partial order ≤abc

such that ⊥ ≤abc

M monotonicity λx.M ≤abc

λx.M′ if M ≤abc

M′ and M = ⊥ or a = 1 MN ≤abc

M′N if M ≤abc

M′ and M = ⊥ or b = 1 MN ≤abc

MN′ if N ≤abc

N′ and N = ⊥ or c = 1 ≤111

is just the standard partial order ≤⊥

Example

◮ λx.⊥ ≤001

λx.x x, λx.⊥ x ≤001

λx.x x, λx.x ⊥ ≤001

λx.x x

◮ The infinite term ((. . . y) y) y is in the ideal

completion of ≤010

but not ≤001

⊥ .

9 / 13

slide-37
SLIDE 37

Correspondences

Theorem

There is a one-to-one correspondence between metric completion of dabc and ideal completion of ≤abc

⊥ .

10 / 13

slide-38
SLIDE 38

Correspondences

Theorem

There is a one-to-one correspondence between metric completion of dabc and ideal completion of ≤abc

⊥ .

Theorem

◮ If limι→α tι = t, then lim infι→α tι = t. ◮ If lim infι→α tι = t and t is total, then

limι→α tι = t.

10 / 13

slide-39
SLIDE 39

Correspondences

Theorem

There is a one-to-one correspondence between metric completion of dabc and ideal completion of ≤abc

⊥ .

Theorem

◮ If limι→α tι = t, then lim infι→α tι = t. ◮ If lim infι→α tι = t and t is total, then

limι→α tι = t. limit in dabc

10 / 13

slide-40
SLIDE 40

Correspondences

Theorem

There is a one-to-one correspondence between metric completion of dabc and ideal completion of ≤abc

⊥ .

Theorem

◮ If limι→α tι = t, then lim infι→α tι = t. ◮ If lim infι→α tι = t and t is total, then

limι→α tι = t. limit in dabc limit inferior in ≤abc

=

β<α

  • β≤ι<α tι
  • 10 / 13
slide-41
SLIDE 41

Convergence of reductions in ≤abc

◮ A reduction t0 → t1 → t2 → . . . always

converges.

◮ It converges to lim infi→ω ci, where

ci is the greatest term, such that

◮ ci ≤abc

ti, and

◮ ci does not contain the contracted redex. 11 / 13

slide-42
SLIDE 42

Convergence of reductions in ≤abc

◮ A reduction t0 → t1 → t2 → . . . always

converges.

◮ It converges to lim infi→ω ci, where

ci is the greatest term, such that

◮ ci ≤abc

ti, and

◮ ci does not contain the contracted redex.

Example

N → N y → N y y → . . .

◮ converges to ((. . . y) y) y in ≤111

◮ converges to ⊥ in ≤101

and ≤001

11 / 13

slide-43
SLIDE 43

Results

slide-44
SLIDE 44

Properties of the ideal completion calculi

Theorem

◮ Infinitary β reduction is confluent (for 111) and

normalising (in general).

◮ Normal forms of 111 are Berarducci Trees.

12 / 13

slide-45
SLIDE 45

Properties of the ideal completion calculi

Theorem

◮ Infinitary β reduction is confluent (for 111) and

normalising (in general).

◮ Normal forms of 111 are Berarducci Trees.

To get confluence for 001, 101, we add two rules: λx.⊥ →S ⊥ (for 001) ⊥ M →S ⊥ (for 001 and 101)

12 / 13

slide-46
SLIDE 46

Properties of the ideal completion calculi

Theorem

◮ Infinitary β reduction is confluent (for 111) and

normalising (in general).

◮ Normal forms of 111 are Berarducci Trees.

To get confluence for 001, 101, we add two rules: λx.⊥ →S ⊥ (for 001) ⊥ M →S ⊥ (for 001 and 101)

Theorem

◮ Infinitary βS reduction is confluent and

normalising for 001 and 101.

◮ Normal forms of 001 and 101 are B¨

  • hm Trees

and Levy-Longo Trees. resp.

12 / 13

slide-47
SLIDE 47

Conclusion

Alternative presentation of infinitary lambda calculi based on ideal completion

Why?

◮ Direct account of partial convergence instead

without B¨

  • hm reduction

◮ Avoids technical difficulties of dealing with

infinite set of reduction rules

13 / 13

slide-48
SLIDE 48

Conclusion

Alternative presentation of infinitary lambda calculi based on ideal completion

Why?

◮ Direct account of partial convergence instead

without B¨

  • hm reduction

◮ Avoids technical difficulties of dealing with

infinite set of reduction rules

Drawback

◮ does not capture arbitrary ‘meaningless terms’

13 / 13

slide-49
SLIDE 49

Strict Ideal Completions

  • f the Lambda Calculus

Patrick Bahr

IT University of Copenhagen

FSCD 2018

slide-50
SLIDE 50

Bonus Slides

slide-51
SLIDE 51

More Correspondences

Theorem

◮ If s ։

p βS t, then s ։ m B t.

◮ If s ։

m B t and s is total, then s ։ p βS t.

14 / 13