calculus, theorems etc' - PowerPoint PPT Presentation

1 / 26
About This Presentation
Title:

calculus, theorems etc'

Description:

-calculus, theorems etc. Stefan Kahrs -Theories. a -theory E allows us to ... flourishing since 1990 (Abadi et. al. -calculus; now there are many variations, ... – PowerPoint PPT presentation

Number of Views:31
Avg rating:3.0/5.0
Slides: 27
Provided by: stude996
Category:

less

Transcript and Presenter's Notes

Title: calculus, theorems etc'


1
?-calculus, theorems etc.
  • Stefan Kahrs

2
?-Theories
  • a ?-theory E allows us to prove equations
  • that is E tu
  • equivalence, i.e. E tu ? E ut etc.
  • congruence, i.e. E tu ? E ?x.t ?x.u
  • contains ?, i.e. E (?x.t) u txu
  • the theory ? has nothing else in it
  • ?? ?x.t xt (if x?FV(t))

3
Consistency
  • Logic cannot prove every sentence
  • ?-theory cannot prove every closed equation
  • is ? itself consistent?
  • not, if we used naive substitution
  • t (?x.t) u (?y.(?x.y)) t u (?x.(?y.(?x.y))
    x) t u (?x.(?x.x)) t u (?x.x) u u

4
Proving Consistency
  • Church-Rosser property implies consistency
  • t ?? u ? ?s.t ?? s ?u ?? s (?? reflexive and
    transitive closure of ??, ?? equivalence closure)
  • note that ? tu ? t ?? u

t?t1?t2?t3?t4?... ?tn?u
5
CR versus Confluence
  • Confluence t ??u ? t ??v ? ?s. u ??s ? v
    ??s
  • obviously, CR ? Confluence
  • but also, Confluence ? CR

t?t1?t2?t3?t4?... ?tn?u
6
How to prove confluence
  • standard strategy
  • prove local confluence (weaker premise t ?? u ? t
    ?? v) ?
  • prove termination ? ?. (?? ?) ? ? ? Ø ?
  • alternative, diamond property (weaker concl.)
  • t ?? u ? t ?? v ? ?s. u ??s ? v ??s ?
  • 2nd alternative
  • prove diamond property of any relation ? with
    ?? ? ? ? ??.

7
Tait Martin-Löf
  • t ? t
  • t ? u ? ?x.t ? ?x.u
  • t ? u ? r ? s ? (t r) ? (u s)
  • t ? u ? r ? s ? (?x.t) r ? uxs
  • proving diamond property by induction on the
    definition of ?

8
Lemmas
  • prove t ? u ? r ? s ? txr ? uxs
  • inversion lemmas (easy!)
  • ?x.t ? u implies u?x.t and t ? t
  • (a b) ? u implies either
  • u(a b) with a ? a and b ? b , or
  • a?x.t, utxb with t ? t and b ? b

9
Example (lemma)
  • Case t ? u is an instance of the last case of ?.
  • Then t(?y.a) b, uayb with a ? a , b ?
    b
  • Thus txr (?y.axr) bxr
  • applying the induction hypothesis gives us
    axr ? axs and bxr ? bxs
  • using the definition txr ?
    axsybxs
  • substitution lemma axsybxs
    aybxs
  • obvious uxs aybxs

10
Strategies
  • various definitions possible, e.g.
  • F ??? such that t ??F(t)
  • R ? (??)
  • the above with provisos about non-NF
  • F ????, where t F t 0 F t i ?? F t (i1)
    (or F t iF t (i1))
  • one-step strategies
  • recursive or effective strategies

11
Properties of Strategies
  • F is normalizing
  • if t ??u, u? NF? then there exists n such that
    Fn(t)u in other words t F u, viewing F as a
    relation
  • F is hyper-normalizing
  • if t ??u, u? NF? then t (??F ??) u
  • optimal strategies (constraints one-step, rec.)
  • time
  • space

12
Examples I
  • leftmost outermost, Flo
  • Flo(t) ?1(A(t))
  • A(?y.a) (?y.a,c) where A(a)(a,c)
  • A(x) (x,0)
  • A(t u) (axu,1), if t ?x.a
  • A(t u) (t u,1), if t??x.a, A(t)(t,1)
  • A(t u) (t u,c), if t??x.a, ?2(A(t))0,
    A(u)(u,c)

13
Examples II
  • leftmost Innermost, Fli
  • Fli(t) ?1(B(t))
  • B(?y.a) (?y.a,c) where B(a)(a,c)
  • B(t u) (axu,1), if t?x.a, ?2(B(t))?2(B
    (u))0
  • B(t u) (t u,1), if B(t)(t,1)
  • B(t u) (t u,1), if ?2(B(t))0, B(u)(u,1)
  • B(t) (t,0), otherwise

14
Examples III
  • Gross-Knuth strategy, FGK
  • FGK(?y.a) ?y. FGK (a)
  • FGK(x) x
  • FGK((?x.a) u) FGK(a)x FGK(u)
  • FGK(t u) FGK(t) FGK(u), if t??x.a
  • note t ? FGK(t)

15
Some results
  • Fli and Flo are one-step strategies, FGK is not
  • all are recursive
  • Flo and FGK are normalizing (and
    hyper-normalizing), Fli is not
  • FGK is cofinal ?? ? FGK(??)-1 (if you divert
    from Gross-Knuth, you can always rejoin)

16
Standardisation Theorem
  • standard reduction the empty reduction sequence
    is standard, otherwise s ?? t ??u is standard if
  • t ??u is standard
  • redexes occurring left to the one contracted in s
    ?? t are not contracted in t ??u
  • theorem if t ??u then there is a standard
    reduction from t to u

17
Consequences
  • Flo always produces a standard reduction, since
    there is no redex left to the ones we contract
  • Flo is normalising - it gives us the only
    standard reduction from a term to its normal form

18
Optimal Strategies
  • elusive
  • Fli is not (simply because it is not normalising)
  • Flo is not (often outperformed by Fli)
  • change of representation (Lévy 1978)
  • graph reduction, Wadsworth 1971 lazy evaluation
  • bookkeeping work, Lamping POPL 1990
  • Asperti et.al. 1995, interaction
    systems Bologna Optimal Higher-Order Machine

19
Name conflict resolution
  • name-capture unsound
  • solutions
  • dont reduce under ?-binders
  • built-in ??-conversion
  • combinators
  • different kind of binders

implementations textbook Miranda, Schönfinkel de
Bruijn
20
Combinators
  • define (untyped) functions
  • I x x
  • K x y x
  • S x y z (x z) (y z)
  • view ?-terms as abbreviations
  • ?x.xI
  • ?x.yK y, if x?y
  • ?x.(a b)S(?x.a)(?x.b)

21
De Bruijn indices
  • replace variable names by numbers (their
    relative addresses on a stack)
  • Example ?h.(?x.h(x x))(?x.h(x x)) becomes
    ?(?2(1 1))(?2(1 1))
  • Consequence ?-convertible terms become identical
  • Name conflict resolution all the time

22
Explicit Substitutions
  • flourishing since 1990 (Abadi et. al.
    ??-calculus now there are many variations, even
    regular workshops)
  • idea remove substitutions from the meta-theory
  • include them instead in the syntax
  • operating on de Bruijn style substitutions

23
Syntax
  • terms a,b 1 a b ?a as
  • substitutions s,t id ?? a ? s s ? t
  • Ideas as is substitution application and
  • id is the identity substitution
  • ? increases the indices of all free variables by
    1
  • a ? s replaces the first variable by a and the
    others using the substitution s
  • s ? t composition of substitutions

24
Dynamics, Terms
  • (?a)b ? ab ? id
  • 1id ? 1
  • 1a ? s ? a
  • (a b)s ? (as bs)
  • (?a)s ? ?(a1 ? (s ? ?))
  • ast ? as ? t

25
Dynamics, Substitutions
  • id ? s ? s
  • ? ? id ? ?
  • ? ? (a ? s ) ? s
  • (a ? s ) ? t ? at ? (s ? t)
  • (s1 ? s2) ? s3 ? s1 ? (s2 ? s3)

26
Remarks
  • this rewrite system gives a complete
    implementation of the ?-calculus
  • it is still confluent
  • the substitution part (without the ? rule) is
    confluent and terminating
  • it has proved difficult to come up with typed
    calculi of explicit substitutions which are nice
Write a Comment
User Comments (0)
About PowerShow.com