• 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 (VI)

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

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

• complete reductions

• sublattice of complete reductions

• more on canonical representatives

• costs of reductions + sharing

• speculative computations

• other calculi

• connection with event structures

• local compactness proof technique

Plan

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 kbicu

i kbicu

kbicu i

kbicu kbicu kbicu

kbicu

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)))

Our favorite example

a i

3 families:

k b i c u

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

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

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

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

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

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

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







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



i a

i

a

a

k b i c u

k b i c u

Complete reductions (1/5)

Each step contracts a full single redex family

(3)

Complete reductions (2/5)

Definition [complete reductions]

R , S 2 F implies h ⇢, R i ⇠ h ⇢, S i

is f-complete when it is maximum set such that

h ⇢, Fi

An f-complete reduction contracts an f-complete set at each step.

h ⇢, F i is an historical set of redexes when F is a set of redexes in final term of ⇢.

Proposition [lattice of f-complete reductions]

Proof simple use of following lemma which implies f-complete parallel moves.

Complete reductions form a sub-lattice of the lattice of reductions.

Complete reductions (3/5)

Notations

MaxRedNames(M) when all redexes in M have maximal names.

M

N when M

F

N and F is the set of redexes with name ↵ in M.

Lemma [complete reductions preserve max redex names]

M

N and MaxRedNames(M) implies MaxRedNames(N)

Complete reductions (4/5)

Proposition [f-complete = d-complete]

d-complete reductions coincide with f-complete reductions.

An d-complete reduction contracts a d-complete set at each step.

h ⇢

0

, R

0

i  h ⇢, F i for some h ⇢

0

, R

0

i

is d-complete when it is maximum set such that

h ⇢, F i

Definition [d-complete reductions]

Proof difficult.

Proposition [below canonical representative]

Let h ⇢

0

, R

0

i be canonical representative in its family.

Let ⇢

0

v ⇢. Then h ⇢

0

, R

0

i ⇠ h ⇢, R i i↵ h ⇢

0

, R

0

i  h ⇢, R i .

Complete reductions (5/5)

Corollary [optimal reductions]

In complete reductions, never redex of same family is contracted twice.

Implementation [optimal reductions]

Can we implement efficiently complete reductions ?

Proposition [length of reduction = number of families]

Proof application of MaxRedNames lemma.

In complete reductions, number of steps equals the number of contracted redex families.

(4)

Implementation (1/5)

Implementation [optimal reductions]

algorithm [John Lamping, 90 -- Gonthier-Abadi-JJ, 91]

Sharing of basic values is easy:

Problem is sharing of functions:

( x .x + x)(( x.x)3) + • ( x .x )3

• + • 3

( x .x3 + x 4)(( x.I (x))

x .I (x )

• 3 + • 4

??

Implementation (2/5)

( x .x 3 + x4)(( x .I (x )) • 3 + • 4

x . x.

I ( )

x.

I ( )

• + • 4

3 x.

• + • 4

3

· · ·

Implementation (3/5)

application λ-abstraction

Implementation (4/5)

rules

( x .yx )z

(5)

Implementation (5/5)

beautiful Lamping’s algorithm is unpractical

highly exponential in the handling of fans node (not elementary recursive) [Asperti, Mairson 2000]

nice algorithms unsharing paths to bound variables [Wadsworth 92, Shivers-Wand 2010]

Haskell, Coq, Caml ??

Speculative computations

Permutations in Call by value

Definition [call by value]

A value remains a value if computed or substituted by a value

V ::= x | x .M

( x .M)V

cbv

M { x := V }

M

cbv

M

0

MN

cbv

M

0

N

N

cbv

N

0

MN

cbv

MN

0

The call-by-value reduction strategy is defined by:

Fact [permutations in call by value]

Equivalence by permutations only permute disjoint redexes.

Speculative computations

Definition [speculative call, Boudol-Petri 2010]

V ::= x | x .M

The speculative reduction strategy is defined by:

( x .M )V

spec

M { x := V }

( x .M)N

spec

( V ? M { x := V } )N

( V ? M)V

spec

M

M

spec

M

0

MN

spec

M

0

N

N

spec

N

0

MN

spec

MN

0

M

spec

M

0

V ?M

spec

V ?M

0

(6)

Events structure

Creation of redexes (1/3)

Causal order between redex families

In favorite example:

a i

k b i c u

creates

Several redexes can create another one

( f .f 3)(( x . y .4)5)

( y .4)3

a i

k b i c u

creates

Références

Documents relatifs

In the era of Big Data and the Web of Linked Data, one would expect that schema-free search over both text and structured key-value pairs becomes more semantic, Systems should,

The sample mean of the probability of receiving food aid from a non-EU member donor is 30.5 percent before the reform, and the average probability of receiving food aid from the EU

PIE also initiates and supports research of chronic traumatization, particularly, the empirical study of trauma-related dissociation and

Jérôme FERRAND et Hugues Petit, FONDATIONS ET NAISSANCES DES DROITS DE L'HOMME L'ODYSSEE DES DROITS DE L'HOMME, Tome I des actes du colloque international de

Some -er verbs with spelling changes in the present form their future regularly, that is, their future stem is the infinitive.. These include verbs like préférer (je préférerai),

The Every Newborn Action Plan (ENAP) takes forward the UN Secretary-General’s Global Strategy for Women’s and Children’s Health, a roadmap developed in 2010 to improve women’s

• 2015 Progress report on implementing the Commission on Information and Accountability Recommendations: Birth registration, Death registration, MDSR, CRVS, National eHealth

We acknowledge and thank all the participating schools, institutes, and NGO’s from New Delhi, India including Guru Nanak Public School, Punjabi Bagh; the New Green Field Public