The resource lambda calculus is short-sighted in its relational model
Flavien BREUVART
PPS, Paris Denis Diderot
26-28 June 2013
Introduction
The resource calculus (∂Λ)
A resource sensitive extension of the pureλ-calculus with linear subterms thatcannot suffer any duplication nor erasingalong the reduction.
The relational model M
∞M∞ is a reflexive object of MRel, which is theco-Kleisli category of the well known model of linear logicRel.
They have good properties:
• M∞is a sensible modelof∂Λ (M⇑⇔[[M]] =∅).
• M∞isfully abstractfor the pureλ-calculus ([Man09]).
• Both∂Λ andM∞are well-behaved w.r.t. Taylor expansion.
Question of [Buc&Al 11]
IsM∞ fully abstractfor∂Λ?
My answer [TLCA13]
NO
Flavien BREUVART PPS The resource lambda calculus is short-sighted in its relational model 2 / 1
Introduction
The resource calculus (∂Λ)
A resource sensitive extension of the pureλ-calculus with linear subterms thatcannot suffer any duplication nor erasingalong the reduction.
The relational model M
∞M∞ is a reflexive object of MRel, which is theco-Kleisli category of the well known model of linear logicRel.
They have good properties:
• M∞ is a sensible modelof∂Λ (M⇑⇔[[M]] =∅).
• M∞ isfully abstractfor the pureλ-calculus ([Man09]).
• Both∂Λ andM∞ are well-behaved w.r.t. Taylor expansion.
Question of [Buc&Al 11]
IsM∞ fully abstractfor∂Λ?
My answer [TLCA13]
NO
Definition of ∂Λ
Grammar
(terms) Λ M,N::= x | λx.M | M P
(bags) Λb P,Q ::= [M!] | [M] | [] | P·Q (sums) Λs L,M∈ Mf(Λ)
[N!] is a usualλ-calculus argument, used as many time as wanted.
[N] is a linear argument, used exactly once.
[] the absence of arguments.
P·Q is the union of bags, i.e. parallel composition of arguments.
Λs possible outcomes of a computation are finite sums of terms.
Reduction (by examples)
(λx.x [x]) [u!]→u[u] (λx.x [x]) [u]→0 (λx.x [x]) [u,v]→(u[v])+(v [u]) (λx.x [x!]) [u]→u []
(λx.x [x!]) [u,v,w]→(u [v,w])+(v [u,w])+(w [u,v])
Flavien BREUVART PPS The resource lambda calculus is short-sighted in its relational model 3 / 1
Observational semantic of ∂Λ
Reduction Strategy
outer-reduction: Reduction under anynon bangedcontext.
outer-normal forms: terms with no possible outer-reductions:
λx1...xk.y P1· · ·Pp
where
Pi = [N1, ...,Nn,M1!, ...,Mm!] withN1, ...,Nn in outer-normal form.
may-outer-convergence: converges to a sum containing a normal form:
M⇓ iff M→∗ΣiNi such that ∃Ni∈ONF
Example
(λx.(x [M!]))+Nis amonfform but notλx.(x [(λy.y)x]).
Operational order (v
o)
M voN iff ∀C(|.|), C(|M|)⇓ ⇒ C(|N|)⇓
Definition of the CCC MRel
A categorical model of linear logic: Rel
Objects: Sets Morphisms: Relations Exponential: !A=Mf(A)
Remark: this is the free exponential.
The co-kleisli category: MRel
Objects: Sets Morphisms: relations fromMf(A) andB Identities: 1A ={([α], α)|α∈A}
Composition: f;g :={(Σβ∈baβ, α)|(b, α)∈g,(aβ, β)∈f} Cartesian product: ˘
i∈IAi:={(i, α)|i∈I, α∈Ai} Object of morphisms: A⇒B=Mf(A)×B All ccc-diagrams are given by the co-Kleisli construction from the exponential comonad.
Flavien BREUVART PPS The resource lambda calculus is short-sighted in its relational model 5 / 1
Definition of M
∞A reflexive object of MRel: M
∞M0=∅ Mn+1=Mf(Mn)(ω) M∞=[ Mn
app andabs such that M∞ app
abs(M∞⇒M∞) are trivial.
Mf(Mn)(ω): infinite quazi-everywhere empty lists of multisets overMn. This is the smallest solution of the equationD:= (!˘
ωD)⊥ whose solutions are solutions ofD:= (!D)⊥`D (em i.e. D:=D⇒D) but does not contain∅.
Grammar of M
∞(M∞) α, β ::= ∗ | a→α
Mf(M∞) a,b ::= [α1, ..., αk] With the equation: ∗:= []→∗
so that∗represent theinfinite list of empty multisets.
Interpretation of ∂λ into M
∞[[M]]~x ⊆(Mf(M∞)~x×M∞) [[P]]~x ⊆(Mf(M∞)~x× Mf(M∞))
Interpretation (by examples)
[[x]]yx ={([][α], α)} [[λx.x]] ={[α]→α}
[[[x!]]]x ={(a,a)} [[[x, λy.x]]]x ={([α, β],[α,[]→β]}
[[λy.y [x!]]]x ={(a,[a→α]→α} [[λy.y [x]]]x ={([β],[[β]→α]→α)}
[[M+N]]x = [[M]]x ∪[[N]]x [[[M!,N!]]] ={a·a0|a∈[[M]],a0∈[[N]]}
[[Ω]] =∅ [[Θ]] ={([Πα∈abα→β]·a)→β |(bα→α)∈[[Θ]]}
Remark: One can also see the interpretation as typing judgment into the non-idempotent type-system that isM∞.
Flavien BREUVART PPS The resource lambda calculus is short-sighted in its relational model 7 / 1
Full abstraction of M
∞for ∂λ ?
Sensibility
M∞is sensible for ∂λ:
M⇓ ⇔ [[M]]6=∅
Inequational adequation
M∞ is inequationally adequate for∂λ
[[M]]~x ⊆[[N]]~x ⇒ MvoN Those are obtained easily using Taylor expansion and its properties [TLCA13].
Failure of
Inequational completeness
MvoN ⇒ [[M]]~x ⊆[[N]]~x
Failure of completeness
M≡oN ⇒ [[M]]~x = [[N]]~x
These assertions are equivalents:
M voN⇔M+N≡oN [[M]]⊆[[N]]⇔[[M+N]] = [[N]]
Full abstraction of M
∞for ∂λ ?
Sensibility
M∞is sensible for ∂λ:
M⇓ ⇔ [[M]]6=∅
Inequational adequation
M∞ is inequationally adequate for∂λ
[[M]]~x ⊆[[N]]~x ⇒ MvoN Those are obtained easily using Taylor expansion and its properties [TLCA13].
Failure of
Inequational completeness
MvoN ⇒ [[M]]~x ⊆[[N]]~x
Failure of completeness
M≡oN ⇒ [[M]]~x = [[N]]~x
These assertions are equivalents:
M voN⇔M+N≡oN [[M]]⊆[[N]]⇔[[M+N]] = [[N]]
Flavien BREUVART PPS The resource lambda calculus is short-sighted in its relational model 8 / 1
A such that λx .x v
oA and [[λx.x ]] 6⊆ [[A]]
A := Θ [G, F
!]
G:=λuvw.w [(λx.x) [v!]] F:=λuv1v2.u[(λx.x) [v1!] [v2!]]
A can be seen as a non deterministic While
Gis the stopping condition, andFthe continuation condition: A ≡β G[A!] +F[A!] ≡β G[A!] +F[G[A!]] +F2[A!] ≡β · · ·
A as an infinite sum
A'Σn≥1Bnwith forn≥1:
Bn=λv1. . .vnw.w [(λx.x) [v1!] [v2!] · · · [vn!]]
G[A!] →∗o B1 For alli, F[B!i] →∗o Bi+1 A≡βB1+F[A] ≡β B1+B2+F2[A] ≡β (Σkn=1Bn)+Fk[A]
A such that λx .x v
oA and [[λx.x ]] 6⊆ [[A]]
A := Θ [G, F
!]
G:=λuvw.w [(λx.x) [v!]] F:=λuv1v2.u[(λx.x) [v1!] [v2!]]
A can be seen as a non deterministic While
Gis the stopping condition, andFthe continuation condition:
A ≡β G[A!] +F[A!] ≡β G[A!] +F[G[A!]] +F2[A!] ≡β · · ·
A as an infinite sum
A'Σn≥1Bnwith forn≥1:
Bn=λv1. . .vnw.w [(λx.x) [v1!] [v2!] · · · [vn!]]
G[A!] →∗o B1 For alli, F[B!i] →∗o Bi+1 A≡βB1+F[A] ≡β B1+B2+F2[A] ≡β (Σkn=1Bn)+Fk[A]
Flavien BREUVART PPS The resource lambda calculus is short-sighted in its relational model 9 / 1
A such that λx .x v
oA and [[λx.x ]] 6⊆ [[A]]
A := Θ [G, F
!]
G:=λuvw.w [(λx.x) [v!]] F:=λuv1v2.u[(λx.x) [v1!] [v2!]]
A can be seen as a non deterministic While
Gis the stopping condition, andFthe continuation condition:
A ≡β G[A!] +F[A!] ≡β G[A!] +F[G[A!]] +F2[A!] ≡β · · ·
A as an infinite sum
A'Σn≥1Bnwith forn≥1:
Bn=λv1. . .vnw.w [(λx.x) [v1!] [v2!] · · · [vn!]]
G[A!] →∗o B1 For alli, F[B!i] →∗o Bi+1 A≡βB1+F[A] ≡β B1+B2+F2[A] ≡β (Σkn=1Bn)+Fk[A]
λx.x and Σ
iB
iA'Σn≥1Bn with forn≥1 : Bn=λv1. . .vnw.w [(λx.x) [v1!] [v2!] · · · [vn!]]
λx .x v
oΣ
iB
iIf (λx.x)P1· · ·Pk converges then:
Bk P1· · ·Pk →∗λw.w [(λx.x)P1· · · Pk]
Remark: We are using a context lemma for∂λ[TLCA13]
[[λx.x ]]6 ⊆ Σ
iB
i[∗]→∗∈[[λx.x]], but for everyn, [∗]→∗6∈[[Bn]]:
[∗]→∗∈[[Bn]]⇔([∗][]· · ·[][],∗)∈[[w [(λx.x)[v1!] [v2!]· · ·[vn]]]]v1...vnw What isimpossible.
Flavien BREUVART PPS The resource lambda calculus is short-sighted in its relational model 10 / 1
Clues for the full abstraction
• M∞ is fully abstract for theλ-calculus ([Manzonetto09])
Nomay non determinism
• M∞ is fully abstract for the purely linear fragment ([Buc &Al 12])
Nofixpoint combinator
• M∞ is fully abstract for an extension of∂λwith tests ([Buc &Al 11])
presence of contexts of infinite range
• No intuitive counter-example found
intuition is mainly based on typed system
Our result, A := Θ [G, F
!]
We construct a counter-example as combination of anuntyped fixpoint and amay non deterministic argumentto create a term ofinfinite range whose behavior will not respect the semantics.
Clues for the full abstraction
• M∞ is fully abstract for theλ-calculus ([Manzonetto09]) Nomay non determinism
• M∞ is fully abstract for the purely linear fragment ([Buc &Al 12]) Nofixpoint combinator
• M∞ is fully abstract for an extension of∂λwith tests ([Buc &Al 11]) presence of contexts of infinite range
• No intuitive counter-example found
intuition is mainly based on typed system
Our result, A := Θ [G, F
!]
We construct a counter-example as combination of anuntyped fixpoint and amay non deterministic argumentto create a term ofinfinite range whose behavior will not respect the semantics.
Flavien BREUVART PPS The resource lambda calculus is short-sighted in its relational model 11 / 1
Clues for the full abstraction
• M∞ is fully abstract for theλ-calculus ([Manzonetto09]) Nomay non determinism
• M∞ is fully abstract for the purely linear fragment ([Buc &Al 12]) Nofixpoint combinator
• M∞ is fully abstract for an extension of∂λwith tests ([Buc &Al 11]) presence of contexts of infinite range
• No intuitive counter-example found
intuition is mainly based on typed system
Our result, A := Θ [G, F
!]
We construct a counter-example as combination of anuntyped fixpoint and amay non deterministic argumentto create a term ofinfinite range whose behavior will not respect the semantics.
The short-sightedness
Observations in ∂λ
They are performed by finite applicative contexts, thustheir range is finite.
Observations in M
∞They are performed by elements ofM∞ that are infinite lists, thus their range are infinite.
Range of ∂λ
∂λcontainsterms of infinite rangethat can outrange the operational observations but not the denotational one.
Over-approximation?
Over-approximations in denota- tional semantics aretoo strong.
Must/probabilistic?
Are must and probabilistic convergences more natural? In any case the problem of finding a fully abstract model of∂λ is reopen.
Flavien BREUVART PPS The resource lambda calculus is short-sighted in its relational model 12 / 1
The short-sightedness
Observations in ∂λ
They are performed by finite applicative contexts, thustheir range is finite.
Observations in M
∞They are performed by elements ofM∞ that are infinite lists, thus their range are infinite.
Range of ∂λ
∂λcontainsterms of infinite rangethat can outrange the operational observations but not the denotational one.
Over-approximation?
Over-approximations in denota- tional semantics aretoo strong.
Must/probabilistic?
Are must and probabilistic convergences more natural?
In any case the problem of finding a fully abstract model of∂λ is reopen.
Conclusion
A term of infinite range
A=Θ[G,F!]: A non deterministic while that canchooseits head variable
M
∞is not inequationally fully abstract for ∂λ
(λx.x)voA but [[λx.x]]6⊆[[A]]
M
∞is not fully abstract for ∂λ
(A+λx.x)≡oA but [[A+λx.x]]6= [[A]]
Questions?
Flavien BREUVART PPS The resource lambda calculus is short-sighted in its relational model 13 / 1