• Aucun résultat trouvé

Labeled λ-calculus

N/A
N/A
Protected

Academic year: 2022

Partager "Labeled λ-calculus"

Copied!
6
0
0

Texte intégral

(1)

Reductions and Causality (V)

jean-jacques.levy@inria.fr Tsinghua University, November 14, 2011

http://pauillac.inria.fr/~levy/courses/tsinghua/reductions

Plan

• a labeled λ-calculus

• lattice of reductions

• labels and redex families

• strong normalization

• canonical representatives

• Hyland-Wadsworth labeled calculus

• labels and types

Labeled λ-calculus

Give names to every redex and try make this naming consistent with permutation equivalence.

Need give names to every subterm:

where

Conversion rule is:

M, N , ... ::=

x |

(MN) |

( x.M)

(

( x .M)N)

de

M { x :=

bc

N }

( U ) =

U

and

x { x := M } =

M

is name of redex

A labeled λ -calculus (1/2)

(2)

A labeled λ -calculus (2/2)

d ↵ e

b ↵ c M

N N b ↵ c x N

x M

x

• Labels are nonempty strings of atomic labels:

↵, , ... ::= a, b, c , ... | d ↵ e | b ↵ c | ↵ atomic labels

Our favorite example

3 redex families: red, blue, green.

























p(a( x.b(cxdx))qdiejdkbicuevbkbicuc`3)

pdaeb(cbacqdiejdkbicuevbkbicuc`3

dbacqdiejdkbicuevbkbicuc`3)

pdaeb(cbacqdiej(kbicu( x.vx)`3)

dbacqdiej(kbicu( x.vx)`3))

pdaeb(cbacqdiejdkbicuevbkbicuc`3)

dbacqdiej(kbicu( x.vx)`3))

pdaeb(cbacqdiej(kbicu( x.vx)`3)

dbacqdiejdkbicuevbkbicuc`3))

pdaeb(cbacqdiejdkbicuevbkbicuc`3)

dbacq(i( f.j(kf `3))u( x.vx)))

pdaeb(cbacq(i( f.j(kf `3))u( x.vx)

dbacqdiejdkbicuevbkbicuc`3))

i

i

a

a

k b i c u

i k b i c u

k b i c u i

k b i c u k b i c u k b i c u

k b i c u

i

a k b i c u

3 families:

pdaeb(cbacq(i( f.j(kf `3))u( x.vx))

dbacq(i( f.j(kf `3))u( x.vx)))

pdaeb(cbacq(i( f.j(kf `3))u( x.vx))

dbacqdiej(kbicu( x.vx)`3))

p(a( x.b(cxdx))q(i( f.j(kf `3))u( x.vx)))

a i

i

i

p(a( x.b(cxdx))qdiej(kbicu( x.vx)`3))

pdaeb(cbacqdiej(kbicu( x.vx)`3)

dbacq(i( f.j(kf `3))u( x.vx)))

Labels and permutation equiv. (1/7)

Definition [created redexes]

Let h ⇢, R i be historical redex.

We say that ρcreates

R when @ R

0

, R 2 R

0

/⇢.

Proposition [residuals of labeled redexes]

S 2 R /⇢ implies name(R ) = name(S)

Proposition [created labeled redexes]

If S creates R , then name(S) is strictly contained in name(R ).

(3)

Proof (cont’d) Created redexes contains name of creator

creates

bc

( x.· · ·( x N)· · ·) ( y.M) · · ·( bc( y.M)N0)· · ·

creates

(( x. ( y.M)N)P ( de ( y.M0)P)

de

creates

(( x. x) ( y.M))N de bc( y.M)N

de bc

Labels and permutation equiv. (2/7)

Labels and permutation equiv. (3/7)

Labeled parallel moves lemma+ [74]

If M

F

N and M

G

P , then N

G/F

Q and P

F/G

Q for some Q.

M

N P

Q

F G

G/F F/G

H

G/H H/G

Parallel moves lemma++ [The Cube Lemma]

( H / F )/( G / F ) = ( H / G )/( F / G )

still holds.

Finite developments still holds.

Labels and permutation equiv. (4/7)

Labels do not break Church-Rosser, nor residuals

Labels refine λ-calculus:

- any unlabeled reduction can be performed in the labeled calculus

- but two cofinal unlabeled reductions may no longer be cofinal Take

adbecbbcd

(

e

( x.

f

x)

g

3)

a

(

b

( x.

c

x)

d

(

e

( x.

f

x)

g

3))

a

(

b

( x.

c

x)

ddeefbecg

3)

I(I3) withI= x.x.

Labels and permutation equiv. (5/7)

Theorem [labeled permutation equivalence, 76]

Let ⇢and be coinitial reductions.

Then ⇢' i↵⇢ and are labeled cofinal.

Proof Let ⇢' . Then obvious because of labeled parallel moves lemma.

Conversely, we apply standardization thm and following lemma.

Lemma [uniqueness of labeled standard reductions]

Proof ...

(4)

Labels and permutation equiv. (6/7)

Proof [uniqueness of labeled standard Let ⇢and be 2 distinct coinitial standard reductions.

Take first step when they diverge. Call M that term.

We make structural induction on M. Say⇢ is more to the left.

If first step of⇢ contracts an internal redex, we use induction.

If first step of⇢ contracts an external redex, then:

M = (( x.P)Q)

deP{x :=bcQ}

st

st

deN 6= (( x.A)B)

Labels and permutation equiv. (7/7)

Corollary [lattice of labeled reductions]

Labeled reduction graphs are upwards semi lattices for any labeling.

Corollary [labeled prefix ordering]

Let ⇢:M N and :M P be coinitial labeled reductions.

Then ⇢v i↵ N P.

Exercice Try on ( x.x)(( y.( x.x)a)b) or ( x.xx)( x.xx)

Redex families

Labeled redexes and their history (1/3)

σ

'

R S

h ⇢, R i ⇠ h , S i h ⇢, R i  h , S i

'

σ

R

S

S2R/⇢

name(R ) = name(S)

(5)

Labeled redexes and their history (2/3)

Proposition [same history → same name]

h ⇢, R i ⇠ h , S i implies name(R ) = name(S)

In the labeled λ-calculus, for any labeling, we have:

The opposite direction is clearly not true for any labeling (For instance, take all labels equal)

But it is true when all labels are distinct atomic letters in the initial term.

Definition [all labels distinct letters]

INIT(M) =True when all labels in M are distinct letters.

Labeled redexes and their history (3/3)

Theorem [same history = same name, 76]

h ⇢, R i ⇠ h , S i i↵ name(R ) = name(S)

When and reductions INIT(M)

𝜌

and

σ

start from M :

Corollary [decidability of family relation]

The family relation is decidable (although complexity is proportional to length of standard reduction).

Strong normalization

Strong normalization (1/3)

Another labeled λ-calculus was considered to study Scott D-infinity model [Hyland-Wadsworth, 74]

D-infinity projection functions on each subterm (n is any integer):

Conversion rule is:

is degree of redex

M, N , ... ::= x

n

| (MN )

n

| ( x .M)

n

(( x.M )

n+1

N)

p

M { x := N

[n]

}

[n][p]

n + 1

x

n

{ x := M } = M

[n]

where

U

[m][n]

= U

[p]

p = min { m, n }

(6)

Strong normalization (2/3)

Proposition Hyland-Wadsworth calculus is derivable from labeled calculus by simple homomorphism on labels.

Proof Assign an integer to any atomic letter and take:

h(↵ ) = min { h(↵), h( ) } h( d ↵ e ) = h( b ↵ c ) = h(↵) 1

Proposition Hyland-Wadsworth calculus strongly normalizes.

Corollary When only a finite set of redex names is contracted, there is strong normalization.

Références

Documents relatifs

I n this usage, the variables of the generating functions are to be regarded as indeterminates or tags whose powers identify the coefficients, and formal

To achieve these results, we describe a succinct representation of unlabeled planar triangulations which supports the rank/select of edges in ccw (counter clockwise) order in

The kind of encoding that we propose here is useful for the ProofCert project [3, 11], where a general proof checker for focused first-order classical (and intuitionistic) logic is

Surprisingly, the known criteria for the representation of the call-by-name λ-calculus (with explicit substitutions) fail to characterize the fragment encoding the

Here a given label is associated to the same pattern, possibly with some variation, and we alter the proportion of labeled letters (5–100%), the variation in the label’s pattern

Unité de recherche INRIA Rennes : IRISA, Campus universitaire de Beaulieu - 35042 Rennes Cedex (France) Unité de recherche INRIA Rocquencourt : Domaine de Voluceau - Rocquencourt -

2. A crucial tool, in this approach, is the notion of storage operator, to be defined later. As is well known, in call-by-name λ-calculus, a function must compute its argument

Definition [Wadsworth, 72] M is totally undefined i↵.. for all C [ ], if C [M] nf , then C [N ] nf for