slides bologna

Upload: papuchiiglesias

Post on 07-Apr-2018

225 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/6/2019 Slides Bologna

    1/59

    Measuring the Execution Time in -Calculusand linear logic

    Daniel de Carvalho (Roma)

    (Partially joint workwith Michele Pagani (Torino)

    and Lorenzo Tortora de Falco (Roma))

    Concerto, Bologna

    February 17, 2009

    . p.1/3

  • 8/6/2019 Slides Bologna

    2/59

    The problem for nets

    Let 1 and 2 be two cut free nets.

    1. There exists 0 cut free such that

    1 2

    cut

    0

    ?

    2. Given 1 and 2, how many steps ?

    . p.2/3

  • 8/6/2019 Slides Bologna

    3/59

    The problem for nets

    Let 1 and 2 be two cut free nets.

    1. There exists 0 cut free such that

    1 2

    cut

    0

    ?

    2. Given 1 and 2, how many steps ?

    Which nets ?

    . p.2/3

  • 8/6/2019 Slides Bologna

    4/59

    The problem for nets

    Let 1 and 2 be two cut free nets.

    1. There exists 0 cut free such that

    1 2

    cut

    0

    ?

    2. Given 1 and 2, how many steps ?

    Which nets ?

    Which strategy ?

    . p.2/3

  • 8/6/2019 Slides Bologna

    5/59

    The problem for nets

    Let 1 and 2 be two cut free nets.

    1. There exists 0 cut free such that

    1 2

    cut

    0

    ?

    2. Given 1 and 2, how many steps ?

    Which nets ?

    Which strategy ?

    Which semantics ?. p.2/3

  • 8/6/2019 Slides Bologna

    6/59

    The problem for-terms

    Let v1 and v2 be two normal -terms.

    1. There exists a normal -term v0 such that

    (v1)v2 v0 ?

    2. Given v1 and v2, how many steps ?

    -terms are type free.

    Steps are steps in Krivines machine. Semantics is a -algebra induced by the

    multiset based relational semantics of linear

    logic.. p.3/3

  • 8/6/2019 Slides Bologna

    7/59

    The problem

    Let 1 and 2 be two cut free nets.

    1. There exists 0 cut free such that

    1 2

    cut

    0

    ?

    2. Given 1 and 2, how many steps ?

    Which nets ?

    Which strategy ?

    Which semantics ?. p.4/3

  • 8/6/2019 Slides Bologna

    8/59

    Ground-structures

    A ground-structure is an acyclic directed graphwhose nodes are among the following ones:

    identities: ax cut

    multiplicatives: ` 1

    exponentials: !

    ?

    . p.5/3

  • 8/6/2019 Slides Bologna

    9/59

    Untyped nets

    An untyped -structure is a ground-structure with

    a function:

    !

    n

    an untyped -structure withn conclusions with and one conclusion without.

    An untyped -net is an untyped -structure thatsatisfies the Danos-Rgnier criterion.

    A net is an untyped -net without conclusion la-

    beled with .. p.6/3

  • 8/6/2019 Slides Bologna

    10/59

    Cut-elimination

    cut

    ax

    b ca t

    c

    cut

    `

    ba

    f g h i

    t cut cut

    f g h i

    cut ba

    1

    t

    . p.7/3

  • 8/6/2019 Slides Bologna

    11/59

    Cut-elimination

    ?

    cutba

    t

    !

    o

    o

    ?

    !

    !

    !

    w

    bk

    c1

    1

    !

    !

    b1

    vk

    ck

    k

    !

    v1

    . p.8/3

  • 8/6/2019 Slides Bologna

    12/59

    Cut-elimination

    !

    cuto

    ?

    !

    c1

    1

    !

    !

    !

    k

    o

    cut

    ck

    !

    . p.9/3

  • 8/6/2019 Slides Bologna

    13/59

    The problem

    Let 1 and 2 be two cut free nets.

    1. There exists 0 cut free such that

    1 2

    cut

    0

    ?

    2. Given 1 and 2, how many steps ?

    Which nets ?

    Which strategy ?

    Which semantics ?. p.10/3

  • 8/6/2019 Slides Bologna

    14/59

    Krivines machine (states)

    We denote by S the set of states.A state is a non-empty stack.

    A stack is a finite sequence of closures.

    . p.11/3

  • 8/6/2019 Slides Bologna

    15/59

    Krivines machine (states)

    We denote by S the set of states.A state is a non-empty stack.

    A stack is a finite sequence of closures.

    We denote by C the set of closures.

    c C := (t, e)where t is a -term and e E.

    . p.11/3

  • 8/6/2019 Slides Bologna

    16/59

    Krivines machine (states)

    We denote by S the set of states.A state is a non-empty stack.

    A stack is a finite sequence of closures.

    We denote by C the set of closures.

    c C := (t, e)where t is a -term and e E.

    We denote by E the set of environments.It is the set of partial functions V C

    whose domain is finite.

    . p.11/3

  • 8/6/2019 Slides Bologna

    17/59

    Krivines machine (execution)

    current subterm environment stack

    x V e with e(x) = (u, e)

    . p.12/3

  • 8/6/2019 Slides Bologna

    18/59

    Krivines machine (execution)

    current subterm environment stack

    x V e with e(x) = (u, e) u e

    . p.12/3

  • 8/6/2019 Slides Bologna

    19/59

    Krivines machine (execution)

    current subterm environment stack

    x V x / dom(e)

    . p.12/3

  • 8/6/2019 Slides Bologna

    20/59

    Krivines machine (execution)

    current subterm environment stack

    x V x / dom(e)

    . p.12/3

  • 8/6/2019 Slides Bologna

    21/59

    Krivines machine (execution)

    current subterm environment stack

    x.u e c.

    . p.12/3

  • 8/6/2019 Slides Bologna

    22/59

    Krivines machine (execution)

    current subterm environment stack

    x.u e c.

    u e {x c}

    . p.12/3

  • 8/6/2019 Slides Bologna

    23/59

    Krivines machine (execution)

    current subterm environment stack

    x.u e

    . p.12/3

  • 8/6/2019 Slides Bologna

    24/59

    Krivines machine (execution)

    current subterm environment stack

    x.u e

    . p.12/3

  • 8/6/2019 Slides Bologna

    25/59

    Krivines machine (execution)

    current subterm environment stack

    (v)u e

    . p.12/3

  • 8/6/2019 Slides Bologna

    26/59

    Krivines machine (execution)

    current subterm environment stack

    (v)u e v e (u, e).

    . p.12/3

  • 8/6/2019 Slides Bologna

    27/59

    Krivines machine (extension)

    We extend -terms with states.

    k K ::= x1....xm.s | x1....xm.(x)t1...tp

    where t1, . . . , tp K,

    s S

    and x, x1, . . . , xm V.

    . p.13/3

  • 8/6/2019 Slides Bologna

    28/59

    Krivines machine (an example)

    Computing (1)u

    where 1 = f.x.(f)x and u = y.(y)yy.

    outputcurrent

    subtermenvironment stack arguments

    (1)u

    We denote the closure (u, ) by u.We denote the closure (x, f u) by x.

    We denote the closure (y, y x) by y.

    . p.14/3

  • 8/6/2019 Slides Bologna

    29/59

    Krivines machine (an example)

    Computing (1)u

    where 1 = f.x.(f)x and u = y.(y)yy.

    outputcurrent

    subtermenvironment stack arguments

    1 u

    We denote the closure (u, ) by u.We denote the closure (x, f u) by x.

    We denote the closure (y, y x) by y.

    . p.14/3

  • 8/6/2019 Slides Bologna

    30/59

    Krivines machine (an example)

    Computing (1)u

    where 1 = f.x.(f)x and u = y.(y)yy.

    outputcurrent

    subtermenvironment stack arguments

    x.(f)x f u

    We denote the closure (u, ) by u.We denote the closure (x, f u) by x.

    We denote the closure (y, y x) by y.

    . p.14/3

  • 8/6/2019 Slides Bologna

    31/59

    Krivines machine (an example)

    Computing (1)u

    where 1 = f.x.(f)x and u = y.(y)yy.

    outputcurrent

    subtermenvironment stack arguments

    x. (f)x f u

    We denote the closure (u, ) by u.We denote the closure (x, f u) by x.

    We denote the closure (y, y x) by y.

    . p.14/3

  • 8/6/2019 Slides Bologna

    32/59

    Krivines machine (an example)

    Computing (1)u

    where 1 = f.x.(f)x and u = y.(y)yy.

    outputcurrent

    subtermenvironment stack arguments

    x. f f u x

    We denote the closure (u, ) by u.We denote the closure (x, f u) by x.

    We denote the closure (y, y x) by y.

    . p.14/3

  • 8/6/2019 Slides Bologna

    33/59

    Krivines machine (an example)

    Computing (1)u

    where 1 = f.x.(f)x and u = y.(y)yy.

    outputcurrent

    subtermenvironment stack arguments

    x. u x

    We denote the closure (u, ) by u.We denote the closure (x, f u) by x.

    We denote the closure (y, y x) by y.

    . p.14/3

  • 8/6/2019 Slides Bologna

    34/59

    Krivines machine (an example)

    Computing (1)u

    where 1 = f.x.(f)x and u = y.(y)yy.

    outputcurrent

    subtermenvironment stack arguments

    x. (y)yy y x

    We denote the closure (u, ) by u.We denote the closure (x, f u) by x.

    We denote the closure (y, y x) by y.

    . p.14/3

  • 8/6/2019 Slides Bologna

    35/59

    Krivines machine (an example)

    Computing (1)u

    where 1 = f.x.(f)x and u = y.(y)yy.

    outputcurrent

    subtermenvironment stack arguments

    x. (y)y y x y

    We denote the closure (u, ) by u.We denote the closure (x, f u) by x.

    We denote the closure (y, y x) by y.

    . p.14/3

  • 8/6/2019 Slides Bologna

    36/59

    Krivines machine (an example)

    Computing (1)u

    where 1 = f.x.(f)x and u = y.(y)yy.

    outputcurrent

    subtermenvironment stack arguments

    x. y y x y.y

    We denote the closure (u, ) by u.We denote the closure (x, f u) by x.

    We denote the closure (y, y x) by y.

    . p.14/3

  • 8/6/2019 Slides Bologna

    37/59

    Krivines machine (an example)

    Computing (1)u

    where 1 = f.x.(f)x and u = y.(y)yy.

    outputcurrent

    subtermenvironment stack arguments

    x. x f u y.y

    We denote the closure (u, ) by u.We denote the closure (x, f u) by x.

    We denote the closure (y, y x) by y.

    . p.14/3

  • 8/6/2019 Slides Bologna

    38/59

    Krivines machine (an example)

    Computing (1)u

    where 1 = f.x.(f)x and u = y.(y)yy.

    outputcurrent

    subtermenvironment stack arguments

    x.(x) y y x y

    We denote the closure (u, ) by u.We denote the closure (x, f u) by x.

    We denote the closure (y, y x) by y.

    . p.14/3

  • 8/6/2019 Slides Bologna

    39/59

    Krivines machine (an example)

    Computing (1)u

    where 1 = f.x.(f)x and u = y.(y)yy.

    outputcurrent

    subtermenvironment stack arguments

    x.(x) x f u y

    We denote the closure (u, ) by u.We denote the closure (x, f u) by x.

    We denote the closure (y, y x) by y.

    . p.14/3

  • 8/6/2019 Slides Bologna

    40/59

    Krivines machine (an example)

    Computing (1)u

    where 1 = f.x.(f)x and u = y.(y)yy.

    outputcurrent

    subtermenvironment stack arguments

    x.(x)x y y x

    We denote the closure (u, ) by u.We denote the closure (x, f u) by x.

    We denote the closure (y, y x) by y.

    . p.14/3

  • 8/6/2019 Slides Bologna

    41/59

    Krivines machine (an example)

    Computing (1)u

    where 1 = f.x.(f)x and u = y.(y)yy.

    outputcurrent

    subtermenvironment stack arguments

    x.(x)x x f u

    We denote the closure (u, ) by u.We denote the closure (x, f u) by x.

    We denote the closure (y, y x) by y.

    . p.14/3

    K i i hi ( l )

  • 8/6/2019 Slides Bologna

    42/59

    Krivines machine (an example)

    Computing (1)u

    where 1 = f.x.(f)x and u = y.(y)yy.

    outputcurrent

    subtermenvironment stack arguments

    x.(x)xx

    We denote the closure (u, ) by u.

    We denote the closure (x, f u) by x.We denote the closure (y, y x) by y.

    . p.14/3

    R d i

  • 8/6/2019 Slides Bologna

    43/59

    Reduction strategy

    We allow only stratified reduction steps.

    For any reducible cut-link t of , a reduction step t() is said to be stratified when for everycut-link t of we have

    depth(t) depth(t) .

    . p.15/3

    Th bl

  • 8/6/2019 Slides Bologna

    44/59

    The problem

    Let 1 and 2 be two cut free nets.

    1. There exists 0 cut free such that

    1 2

    cut

    0

    ?

    2. Given 1 and 2, how many steps ?

    Which nets ?

    Which strategy ?

    Which semantics ?. p.16/3

    S t R

  • 8/6/2019 Slides Bologna

    45/59

    System R

    We are given a non-empty set A.We define a set D in such a way that

    D = A (D D) .

    The contexts are partial functions

    : V Mf(D) s.t. {x V / (x) = []} is finite.x : [] R x :

    , x : a R v :

    R x.v : (a, )

    0 R v : ([1, . . . , n], ) 1 R u : 1, . . . , n R u : n0 + 1 + . . . + n R (v)u :

    . p.17/3

    A ti f t

  • 8/6/2019 Slides Bologna

    46/59

    A semantics for pure nets

    We consider the multiset based relationalsemantics of MELL+MIX.

    We are given a set A.We define a set D in such a way that

    D = AA 1(D D)(D`

    D)!D?D .

    Example. We have (, [(+, ), (+, )]) D .

    . p.18/3

    E i t

  • 8/6/2019 Slides Bologna

    47/59

    Experiments

    An experiment e is a function edge x D with

    a function!

    [e1, . . . , em] such that

    ax

    xx

    cut

    x x

    1

    (+, )

    (, )

    (+, x , y)

    yx`

    x y

    (, x , y)

    x

    (,[x])

    ?(, m)(, 1)

    ,jm

    j

    (, j)

    ,jm

    j!

    xi

    [eo1, . . . , eom]

    o

    (+,[x1, . . . , x

    m])

    . p.19/3

    Th bl

  • 8/6/2019 Slides Bologna

    48/59

    The problem

    Let 1 and 2 be two cut free nets.

    1. There exists 0 cut free such that

    1 2

    cut

    0

    ?

    2. Given 1 and 2, how many steps ?

    Which nets ? Which strategy ?

    Which semantics ?. p.20/3

    N li ti i l l

  • 8/6/2019 Slides Bologna

    49/59

    Normalization in -calculus

    Definition. For any D, is said to beexhaustive if [] has only negative occurrences in

    .We denote by Dex the set of D s.t. isexhaustive.

    Theorem. A -term t is normalizable if, and only

    if, there exists Dex s.t. R t : .

    . p.21/3

    N li ti i MELL

  • 8/6/2019 Slides Bologna

    50/59

    Normalization in MELL

    We set ex = {x ; (+, []) doesnt appear in x}.

    Theorem. Let be a net.There exists a cut free net 0 s.t.

    0 if, and

    only if, ex = .

    . p.22/3

    The problem

  • 8/6/2019 Slides Bologna

    51/59

    The problem

    Let 1 and 2 be two cut free nets.

    1. There exists 0 cut free such that

    1 2

    cut

    0

    ?

    2. Given 1 and 2, how many steps ?

    Which nets ? Which strategy ?

    Which semantics ?. p.23/3

    Size of points for calculus

  • 8/6/2019 Slides Bologna

    52/59

    Size of points for-calculus

    Definition. For D, we define the size of ,denoted by s():

    if A, s() = 1 and s() = 0; if = ([1, . . . , n], 0), then

    s

    () = ni=1

    s

    (i) + s

    (

    0) + 1;

    s() =n

    i=1 s(i) + s(0) + 1.

    For any a = [1, . . . , n], we set

    s(a) =n

    i=1s(i) .

    . p.24/3

    A bound for execution-time in

  • 8/6/2019 Slides Bologna

    53/59

    -calculusTheorem [Carvalho 2006]. Let v1 and v2 twonormal closed -terms. For

    a Mfin(v2),

    Dex,

    (a, ) v1,

    we have l(((v1)v2, ).) 2s(a) + s() + 2 .

    . p.25/3

    Indeed we can be very precise

  • 8/6/2019 Slides Bologna

    54/59

    Indeed, we can be very precise

    Definition. Let X, Y D. We denote byUex(X, Y) the following set:

    ((a, ), a) (X \ A) Mfin(Y)/( S)((a) = (a) and () Dex)

    ,

    where S is the set of substitutions on D.Theorem [Carvalho 2006]. Assume A is infinite.We have

    l(((v)u, ).)

    = inf s(a, ) + s(a) + 1/

    ((a, ), a

    ) Uex

    (v, u) .

    . p.26/3

    An example

  • 8/6/2019 Slides Bologna

    55/59

    An example

    We have

    R 1 : ([([0, 1, 4], 2)], ([0, 1, 4], 2));

    R y.(y)yy : ([0, 1, ([0], ([1], 2))], 2).

    We set

    = ([0, 1, 4], 2); a = [];

    a

    = [([0, 1, ([0], ([1], 2))], 2)].

    We have s(a, ) = 7 and s(a) = 6.

    . p.27/3

    Size of points for MELL

  • 8/6/2019 Slides Bologna

    56/59

    Size of points for MELL

    Definition. For x D, we define the size of x,denoted by s(x) :

    if x A or x = (p, ), then s(x) = 1; s(p,y,z) = 1 + s(y) + s(z);

    s(p, [x1, . . . , xm]) = 1 +m

    j=1 s(xj).For every (x1, . . . , xn)

    ni=1 D, we set

    s(x1, . . . , xn) = ni=1

    s(xi).

    Example. We have s(, [(+, ), (+, )]) = 3 .

    . p.28/3

    A bound for execution-time in

  • 8/6/2019 Slides Bologna

    57/59

    MELL

    =

    1 2

    cutd c c

    d

    0

    1 and 2 cut free R 0 cut free

    Theorem [Carvalho-Pagani-Tortora de Falco2008]. For

    y = (x, x) 1,

    y = (x, x) 2,

    x,x exhaustive,

    we havelength(R) s(y)+s(y

    )2 .

    . p.29/3

    Indeed we can be very precise

  • 8/6/2019 Slides Bologna

    58/59

    Indeed, we can be very precise

    Theorem [Carvalho-Pagani-Tortora de Falco2008]. Assume A is infinite.

    length(R) = i n f

    s(z)+s(z)sinf(ex)2 /

    z 1, z 2 and

    ( S)((zc) = (z

    c)

    and (zd), (zd) exhaustive)

    where sinf(ex) = inf{s(x) / x ex}

    and S is the set of substitutions.

    . p.30/3

  • 8/6/2019 Slides Bologna

    59/59

    But we are not able to compute 0...

    END

    . p.31/3