Strict Ideal Completions
- f the Lambda Calculus
Patrick Bahr
IT University of Copenhagen
FSCD 2018
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
Patrick Bahr
IT University of Copenhagen
FSCD 2018
N → N y → N y y → . . . where N = (λx.x x y)(λx.x x y)
1 / 13
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
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
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
◮ Infinite normal forms induce a model of the
lambda calculus, e.g.
◮ B¨
2 / 13
◮ Infinite normal forms induce a model of the
lambda calculus, e.g.
◮ B¨
◮ 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
B¨
2 / 13
Many variants of infinitary calculi
◮ metric spaces metric completion ◮ partial orders ideal completion ◮ topological spaces ◮ coinductive definitions
3 / 13
Many variants of infinitary calculi
◮ metric spaces metric completion ◮ partial orders ideal completion ◮ topological spaces ◮ coinductive definitions
3 / 13
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
rewrite, ... Theoretical Computer Science, 83(1):71–96, 1991.
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
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
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
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
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
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
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
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
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
A reduction t0 → t1 → t2 → . . . converges to t iff
◮ depth of contracted redexes tends to infinity, ◮ lim i→ωti = t.
6 / 13
A reduction t0 → t1 → t2 → . . . converges to t iff
◮ depth of contracted redexes tends to infinity, ◮ lim i→ωti = t.
B¨
In addition, we need rewrite rules t → ⊥ for each t that is root-active (= can be contracted at depth 0 arbitrarily often)
6 / 13
Theorem ([Kennaway et al.])
◮ Infinitary B¨
101, and 111) and normalising (in general).
◮ Its unique normal forms are B¨
Levy-Longo Trees (101), and Berarducci Trees (111).
7 / 13
Theorem ([Kennaway et al.])
◮ Infinitary B¨
101, and 111) and normalising (in general).
◮ Its unique normal forms are B¨
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
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
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
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
⊥ Least partial order ≤abc
⊥
such that ⊥ ≤abc
⊥
M λx.M ≤abc
⊥
λx.M′ if M ≤abc
⊥
M′
9 / 13
⊥ Least partial order ≤abc
⊥
such that ⊥ ≤abc
⊥
M λx.M ≤abc
⊥
λx.M′ if M ≤abc
⊥
M′ and M = ⊥ or a = 1
9 / 13
⊥ 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
⊥ 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
⊥ 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
⊥ 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
⊥ 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
Theorem
There is a one-to-one correspondence between metric completion of dabc and ideal completion of ≤abc
⊥ .
10 / 13
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
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
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
⊥
=
β<α
⊥
◮ 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
⊥
◮ 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
Theorem
◮ Infinitary β reduction is confluent (for 111) and
normalising (in general).
◮ Normal forms of 111 are Berarducci Trees.
12 / 13
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
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¨
and Levy-Longo Trees. resp.
12 / 13
Alternative presentation of infinitary lambda calculi based on ideal completion
Why?
◮ Direct account of partial convergence instead
without B¨
◮ Avoids technical difficulties of dealing with
infinite set of reduction rules
13 / 13
Alternative presentation of infinitary lambda calculi based on ideal completion
Why?
◮ Direct account of partial convergence instead
without B¨
◮ Avoids technical difficulties of dealing with
infinite set of reduction rules
Drawback
◮ does not capture arbitrary ‘meaningless terms’
13 / 13
Patrick Bahr
IT University of Copenhagen
FSCD 2018
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