HAL Id: inria-00096644
https://hal.inria.fr/inria-00096644v3
Submitted on 26 Sep 2006
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of
sci-entific research documents, whether they are
pub-L’archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
Constraint Programming
Remy Haemmerle, Francois Fages, Sylvain Soliman
To cite this version:
Remy Haemmerle, Francois Fages, Sylvain Soliman. On Internalizing Modules as Agents in Concurrent
Constraint Programming. [Research Report] RR-5981, INRIA. 2006. �inria-00096644v3�
inria-00096644, version 2 - 21 Sep 2006
a p p o r t
d e r e c h e r c h e
Thème SYM
On Internalizing Modules as Agents in Concurrent
Constraint Programming
Rémy Haemmerlé — François Fages — Sylvain Soliman
N° 5981
Rémy Haemmerlé, François Fages , SylvainSoliman
ThèmeSYMSystèmessymboliques
ProjetContraintes
Rapportdere her he n°5981 Septembre200630pages
Abstra t: Module systems are an essential feature of programming languages asthey
fa ilitatethere-useofexisting odeandthedevelopmentofgeneralpurposelibraries. There
arehowevertwosomewhat ontradi torywaysoflookingatmodulesinagivenprogramming
language. On theone hand,module systems arelargely independent of theparti ulars of
programminglanguages,andseveralexamplesofmodulesystemshaveindeedbeenadapted
todierentprogramminglanguages.Ontheotherhand,themodule onstru tsoften
inter-ferewiththeprogramming onstru ts,andmayberedundantwithothers opeme hanisms
ofprogramminglanguages,su has losuresforinstan e. Thereisthereforeaneedtounify
theprogramming on eptsand onstru tsthat aresimilar, andretain aminimumnumber
ofessential onstru tstoavoidarbitraryprogramming hoi es. Inthispaper,werealizethis
aimin theframeworkof linearlogi on urrent onstraintprogramming(LCC) languages.
Werstshowhowde larationsand losures anbeinternalizedasagentsin LCC.Wethen
presentamodularversionofLCC(MLCC),wheremodulesarereferen edbyvariablesand
where implementation hidingisobtainedwith theusual hidingoperator forvariables. We
develop the logi al semanti s of MLCC in linear logi , and show the ompleteness of the
operationalsemanti sfortheobservationofsu essesanda essiblestores. Finallywe
dis- ussa omplete module systemfor onstraintlogi programming,derivedfrom theMLCC
s heme.
Résumé: Lessystèmesdemodulessontuntraitessentieldeslangagesdeprogrammation,
ar ils fa ilitent la réutilisation du ode préexistant et le développement de bibliothèques
génériques. Il y a ependant deux façons quelque peu ontradi toires de onsidérer les
modules dans un langage de programmation. D'un oté, les systèmes de modules sont
largement indépendants des parti ularités d'un langage de programmation, et plusieurs
exemplesdesystèmesdemodulesonteneetétéadaptésàdiérentslangagesdeprogrammation.
D'un autre oté, les onstru tions de modules interfèrent souvent ave les opérateurs de
programmation, et peuvent être redondants ave d'autresmé anismes de liaison, telsque
lesfermeturesparexemple. Ilyadon unbesoinpourunierles on eptsetopérateursde
programmationquisontsimilaires,etretenirunnombreminimalde onstru tionsessentielles
an d'éviter des hoix arbitrairesde programmation. Dans et arti le, nous réalisons et
obje tif dans le ontexte des langages de programmation on urrente ave ontraintes en
logiquelinéaire(LCC).Nousmontrons d'abord ommentlesdé larations etles fermetures
peuventêtreinternalisées ommedesagentsLCC,puisnousprésentonsuneversionmodulaire
deLCC(MLCC)oùlesmodulessontréféren éspardesvariableslogiques,etoùlemasquage
del'implantationest obtenuàl'aidedel'opérateurusuelde masquagedesvariables. Nous
développonslasémantiquelogiquedeMLCC,et démontronsla orre tionetla omplétude
de la sémantique opérationnelle pour l'observation des stores a essibles et des su ès.
Finalement nous présentons un système de modules pour la programmation logique ave
ontraintesdérivédeMLCC.
1 Introdu tion
Module systems are an essential feature of programminglanguages as they fa ilitate the
re-useofexisting odeandthedevelopmentofgeneralpurposelibraries. Therearehowever
two ontradi torywaysoflookingatamodule system. Ontheonehand,amodulesystem
is essentiallyindependent ofthe parti ulars ofa given programminglanguage. Modular
modulesystemshavethusbeendesignedandindeedadaptedtodierentprogramming
lan-guages[13℄. On theother hand,module onstru tsoften interfere with the programming
onstru tsandmayberedundantwithother s opeme hanismssupportedbyagiven
pro-gramming language,su h as losures for instan e. There is therefore a need to unify the
programming on eptsand onstru tsthataresimilarinordertoretainaminimumnumber
ofessential onstru tsandavoidarbitraryprogramming hoi es.
Inthispaper,westudya ompletemodulesystemforlinear on urrent onstraint(LCC)
programminglanguagesandshowhowmodulesand losuresareuniedasaparti ularkind
ofLCCagentsinthisframework.
Linear on urrent onstraint programming
The lass of Con urrentConstraint (CC) programming languageshasbeen introdu ed in
[17℄asan elegantmerge of onstraintlogi programming(CLP) and on urrentlogi
pro-gramming. IntheCCparadigm,CLPgoalsare on urrentagents ommuni atingthrough
a ommonstoreof onstraints,ea hagentbeingableto post onstraintstothe store,and
tosyn hronizebyaskingwhetheraguard onstraintisentailedbythestore. Both
theoret-i alreasons on erningthelogi alsemanti sof CClanguages[6,18℄, andpra ti alreasons
on erningtheneedfor anon-monotoni evolutionof thestore[2℄,led toanatural
exten-sionofCClanguageswith onstraintsystemsbasedonLinearLogi (LL)[8℄, alledLinear
Con urrentConstraint (LCC) programming. By interpreting CCagents by LLformulae,
itisindeed possibleto identifyCCoperationaltransitionswithLLdedu tions,and obtain
ompletenesstheoremsfor theobservation oftheset ofa essiblestores,aswellasforthe
setofsu essstores[6℄. ThismeansthatLinearLogi isthelogi ofCCagents. Moreover,
thetheoremsstill holdwhen onsidering onstraintsystemsbasedonLinearLogi instead
of lassi allogi . Froma programmingpoint of view,LL onstraintsystemsare a
rene-mentof lassi al onstraintsystemsallowingforstate hangeandnon-monotoni evolution
ofthe onstraintstore,throughthe onsumptionoflinearlogi tokensbylinearimpli ation
[6,2℄. Thismakesitpossibletoen odeimperativefeaturesin LCCand ombinethemwith
onstraintprogramming.
In this paper, we show that the linear tokens and the bang operator of LCC an be
usedtointernalizeCCde larationsandpro edure allsas onstraintpostingandasking. A
quitegeneralnotionof losure anthenbeen odedasabangedagentwithanenvironment,
de larations orrespondingtothe aseofanemptyenvironment. Theseresultsarethenused
todenetheoperationalsemanti sofmodularLCC(MLCC)languages,wheremodulesare
variables and where implementation hiding is realized with the usual hiding operator for
InSe tion 4weprovideanequivalentlogi alsemanti swhere modular LCCagentsare
interpretedby linear logi formulae, and prove ompleteness theoremsfor the observation
ofsu essanda essiblestores.
Then in Se tion 5, we derive from the MLCC s heme a powerful module system for
onstraintlogi programming. Weillustratetheexpressiveness ofthismodulesystemwith
examplesof odehiding, losure programmingand module parameterization in CLP, and
dis ussitsimplementationalongthelinesofitssemanti sinLCC.
Finally,we on ludeontheseresultsandontheirgenerality.
Related Work
The proposed internalization of de larations asagentsgoes somewhatin the opposite
di-re tion to that of denition-based logi s, asdes ribed for instan e in [10℄. Here wemake
denitionsrst-orderobje ts,whi h allowsus tomanipulatethemeasily,andtogeneralize
themto losures.
There has been several programming languages developed in Linear Logi using the
Logi Programmingparadigm, likefor instan e LO[1℄, Lolli [12℄ orLygon[11℄. However,
fore ien yreasonsintheselanguages,thereisnoequivalentforthepersistentasks(whi h
wouldbeimpli ationsundera
!
inmostoftheselanguages)andthusnodire ten odingof dynami lauseassertionsaswewilldoinSe t. 2.4.3. Thebangedaskappearsinthere entworkof[14℄ontheexpressivenessoflinearityandpersisten einpro ess al uliforse urity.
Con erningCClanguages,theimplementationofmoduleshasnotbeenmu hdis ussed,
being onsidered as an orthogonal issue. For instan e, the MOZART-OZ language [15,
4℄ ontainsan ad-ho module system allowing for separate ompilation. Here we provide
a natural integration of module and programming on epts with the limited set of LCC
programming onstru ts.
2 LCC with De laration Agents
Inthisse tion,wegiveapresentationoftheLCClanguageswherede larationsarerepla ed
bybangedasks, whi h we will all persistent ask. This new onstru t a tuallygeneralizes
de larationsintopersistentasksbyallowingvariablestoremainfreeinapersistentaskand
representtheenvironment.
Inthispaper,aset ofvariablesisdenoted by
x
ory
. Theset offreevariableso urring inaformulaA
is denotedbyfv(A)
,asequen eofvariablesisdenoted by~x
,A[~x\~t]
denotes the formulaA
in whi h the free o urren esof variables~x
havebeen repla edby terms~t
(with the usual renaming of bound variables, avoiding variable lashes). Fora transitionrelation
−→
,−→
⋆
denotesthetransitiveandreexive losureof
−→
. Thetypewriterfont isused forprograms,where, asin lassi alPrologprograms,theidentiersbeginningby a2.1 Linear Logi Constraint Systems
The lass of LCC languages essentially extends CC languages by onsidering onstraint
systemsbasedonLinearLogi [8℄insteadof lassi allogi . From aprogrammingpointof
view,thisextensionintrodu esstate hangeandimperativefeaturesin onstraintlanguages.
Were allheretheusualdenitionsofaLinearLogi onstraintsystem(seeforinstan e[6℄).
Denition2.1 (ConstraintLanguage) An atomi onstraintis aformula built froma
set
V
ofvariables,a setΣ
F
offun tionsymbols andasetΣ
C
ofrelationsymbols,whi h does not ontain⊤
,theneutralelementsofadditive linear onjun tions. The onstraintlanguage is the least set ontaining all atomi onstraints, marked or not by the unary exponentialonne tive
!
( alledalsobang) and losedbymultipli ative onjun tion (⊗
)andexistential quanti ation(∃
).Denition2.2 (ConstraintSystem) Alinear onstraintsystemisapair
(C,
C
)
where:
C
isa onstraintlanguage.
C
isasubsetofC × C
whi h denes the non-logi al axiomsof the onstraintsystem. Wesupposethatforallfreevariableso urringinc
haveafreeo urren einc
1
, . . . , c
n
.Wewillnote
⊢
C
theleastsubsetofC
⋆
×C
ontaining
C
and losedbytheofintuitionisti linearlogi ,notedinthe following ILL(seeappendix Afor the ompletesequent al ulus).Let
C
bea onstraintsystem. Inthefollowing,T
willbethelanguageofterms(notedt
,s
,. . .
)formedfromV
andΣ
F
.2.2 Syntax of LCC(
C
)Thesyntax ofLCC(
C
)is presented herewithoutde larations,onlyagentswith twoforms ofaskagents.Denition2.3 The syntax ofLCC(
C
)agentsisgiven bythe followinggrammar:A ::= A || A | ∃x.A | c | ∀~x(c → A) | ∀~x(c ⇒ A)
Asusual
||
standsforparallel omposition,thetellagentaddsa onstraintto thestore,∃
hidesvariablesinanagentand→
standsforask.Thenew onstru t⇒
representsanask operator, alled persistent ask,thatalwaysremainsa tive.Note thatwedonotprovideanexpli it hoi eoperator,sin ethelo al hoi eoperator
aneasilybeen odedwithlineartokensandaskasfollows:
A + B = ∃x(choice(x) || choice(x) ⇒ A || choice(x) ⇒ B)
This en oding orrespondsto the lassi alen oding of
+
in CLP astwo lauses with the samehead.2.3 Operational Semanti s
Asusual,theoperationalsemanti sofLCCisdenedherewithastru tural ongruen eand
atransition relationdened over ongurations.
Denition2.4 (Conguration) A ongurationisatuple
hx; c; Γi
wherex
isamulti-set ofvariables,Γ
amulti-setof agentsandc
a onstraint, alledstore.Denition2.5 Thestru tural ongruen e
≡
istheleast ongruen esatisfyingthefollowing ruleof parallel omposition:hx; c; A || B, Γi ≡ hx; c; A, B, Γi
Denition2.6 The transition relation
−→
is the least relation satisfying the rules of the table1.Equivalen e
hx; c; Γi ≡ hx; c
′
; Γ
′
i −→ hy; d
′
; ∆
′
i ≡ hy; d; ∆i
hx; c; Γi −→ hy; d; ∆i
Tell
c ⊗ d ⊢
C
e
hx; c; d, Γi −→ hx; e; Γi
Ask
c ⊢
C
d ⊗ e
hx; c; ∀~z(d → A), Γi −→ hx; e; A[~s/~z], Γi
Persistentask
c ⊢
C
d ⊗ e
hx; c; ∀~z(d ⇒ A), Γi −→ hx; e; A[~s/~z], ∀~z(d ⇒ A), Γi
Hiding
z 6∈ z ∪ fv(c, Γ)
hx; c; ∃z.A, Γi −→ hx ∪ {z}; c; A, Γi
Table1: Transitionrelation
In order to introdu e the notion of predi ates,
Σ
C
is partitioned into{Σ
D
, Σ
D
}
su h thatΣ
D
ontains1
. Intuitively,Σ
D
will ontainlineartokenswhi hshouldnotbeobserved, i.e. predi ates. The onstraint languages formed fromΣ
D
andΣ
D
, are notedD
andD
respe tively.Denition2.7 (Observables) Let
A
beanLCC(C
)agentsu hthath∅; 1; Ai
∗
−→ hx; c; Γi
. the onstraint
∃x.c
isapseudo-su essforA
,ifΓ
isamulti-setof persistent asks. the onstraint
∃x.d
is a su ess ofA
, if it is a pseudo-su ess forA
su h thathx; c; Γi 6−→
. asu ess
d
ofA
isaD
-su essifd ∈ D
.Denition2.8 (Operational Semanti s)
O
store(A)
isthe setof a essiblestorefor the agentA
. O
p-s
(A)
isthe setof pseudo-su esses for the agentA
. O
D
-su(A)
isthe setofD
-su esses for theagentA
.2.4 Examples
The following examples illustrate, rst, how usual de larations are re overedthroughthe
useofpersistentask,andthenhowfreevariablesareusedtoprovideanenvironment.
2.4.1 DiningPhilosophers
The lassi al ben hmark of expressiveness for on urrent languagesis the dining
philoso-phers. Theproblem onsistsof
N
philosopherssittingaroundatable whodonothing but think andeat. Betweenea h ofthem, thereis asinglefork. Inorderto eat,aphilosophermusthaveboththeforkonhisrightandtheoneonhisleft. Assuggestedin[2℄,thisproblem
hasanextremelysimpleandelegantsolutionin LCC.
An even more ompa t solution is proposed here: the linear onstraint systemin this
exampleisa ombination oftranslationin ILL ofstandardequality onstraintover
N
and oflinear onstraintstokenf ork/1
andeat/1
withnoothernon-logi alaxiomsthanequality axioms hema:c(~x) ⊗ (~x = ~
y) c(~y)
forany onstraintsymbolc
.Example(Dining Philosophers)
∀M, N.recphilo(M, N ) ⇒ (
f ork(M ) ||
∀I(f ork(I) ⊗ f ork(I + 1
modN ) ⇒ eat(I)) ||
∀I(eat(I) ⇒ f ork(I) ⊗ f ork(I + 1
modN )) ||
I 6= N → recphilo(M + 1, N ) )
It isworthnotingthat thephilosophers donotneedtoberelaun hedusing are ursive
2.4.2 Iterators
A simpleiterator anbeen odedthanks to thepersistentasks. A more ompleteversion
is provided in Se t. 5.5 thanks to themodular onstru ts,whi h allowpassing avariable
asso iatedtoapersistentasksasargumentofaniterator.
Example(Iterator)
f orall([]) ⇒ true ||
f orall([H|T ]) ⇒ arg(H) ⊗ f orall(T ) ||
∀X(arg(X) ⇒ Body) || f orall(L)
Here, the
f orall
persistentask willapply the ode ofBody
( alledthrougharg
) toall theelementsofthelistL
.2.4.3 Dynami ClauseAssertion
In the two previous exampleswe have no de larationsin e in LCC they are repla ed by
persistentasks. However,thisallowsusto gomu h fartherwith forinstan eaverysimple
anddire ten odingofdynami lauseassertions.
Thestraightforwardre ursiveimplementationoftheFibona isequen eisanalgorithm
known tobeparti ularlyine ient, sin eit omputesmany valuesrepeatedly. An elegant
way to improve signi antly the behavior of su h an algorithm is to store intermediary
omputed values using memoization. The omputation falls from exponential to linear
omplexity.
As thefollowingexampleshows,the useof thiste hniqueis verynaturalin LCC.The
mainideaisto usethenaivere ursiveimplementation,and toaddin parallel omposition
withthebodyofthemain agent,thepersistent:
∀F
′
(f ib(N, F
′
) ⇒ F
′
= F ))
in whi h
N
andF
are free variables, providing an environment. This agent will be in harge of onsuming the (future) alls tof ib(N
′
, F
′
)
asking for the omputation of the
N
th
Fibona i's number, and unify
F
′
with the result that has already been al ulated,
transmittedthroughthevariable
F
oftheenvironment.Example(Fibona i):
∀N, F (f ib(N, F ) ⊗ N < 2 ⇒ F = N ) ||
∀N, F (f ib(N, F ) ⊗ N > 1 ⇒ (
∃F
1
, F
2
.(f ib(N − 1, F
1
) ⊗ f ib(N − 2, F
2
) ⊗ F = F
1
+ F
2
) ||
∀F
′
(f ib(N, F
′
) ⇒ F
′
= F ))
Despitethefa tthattheworst omplexityofthisprogramisstillexponential,the hoi e
ofagoodstrategy,forexamplesele tingrstyounger persistentask for onsuminglinear
From a Logi Programming (LP) point of view, the persistent ask added at the end
of the lause isnothing but adynami lause assertion. Indeed the lassi alProlog
built-in assert(p(X1,...,XN):-Body) ould be interpreted in LCC as the agent
∀
X1,...,XN (p(X1,...,Xn)⇒
Body). Moreover,variablerenamingthatassert/1madetransparently, anbesimplyemulatedbytheexpli itquanti ationprovidedbytheLCCoperator∃
. LCC thusprovidesatheoreti alframework,witharstorderlogi alsemanti s,todynami lauseassertion in the ontext of LP. It must be noti ed, however, that this implementation of
assert/1isba ktra king,i.e. thattheasserted lausewillberemovedduringtheba ktra k.
This idea of providing an environment through free variables (like
N
andF
for the last persistent askof the aboveexample) a tually en odes a losure, seenas ode withanenvironment. Note however that using only LCC does not prevent outside ode to look
inside the persistent ask, whi h leads us to provide ode prote tion through a system of
modules, seen asrestri tions on the possible s ope of some variables. Moreover, modules
willprovidesimpletoolstoatta havariabletoapersistentask,andthuspermittopassa
persistentaskastheargumentofanother all.
3 Modular LCC
3.1 Modular Constraint Systems
Let
C
bea onstraintsystem. Tointrodu ethe notionofmodules, wesuppose thatΣ
C
is furtherpartitionedinto{Σ
G
, Σ
M
}
su hthatΣ
G
ontains=
and1
. The onstraintsformed fromΣ
G
(resp.Σ
M
)form thelanguageG
(resp.M
) ofbuilt-in onstraints(resp. modular onstraints).Possiblybangedatomi onstraintsinG
andM
arenotedg
andm
respe tively.c
willbeanotationforany onstraintinC
.3.2 Syntax of MLCC(
C
)Thesyntaxof MLCCextendstheoneof LCCwithalo alization operator ofanagentis a
module:
Denition3.1 The syntax ofMLCC(
C
) agentsisgiven by the following grammar:A ::= t{A} | t : c | A || A | ∃x.A | ∀~x(c → A) | ∀~x(c ⇒ A)
Thenew onstru ts
t{A}
standsforthelo alizationofagentA
inthemodulet
. Thetell agenthasnowanewform:t : c
, orrespondingintuitivelytoaddingthe onstraintc
ofC
in themodulenamedbythetermt
ofT
.3.3 Modular Constraints
Denition3.2 (Modular Store) Aprexed onstraintm
= t : m
isanatomi onstraint (possiblybanged)m
ofM
prexedbyatermt
ofT
,t : m
willbeanotationfort : m
1
, . . . , t : m
k
if
m = m
1
, . . . , m
k
.A modular store is a formula
∃x.(g|
m)
whereg
is a onjun tion of onstraints ofG
withoutquanti ationand mamulti-setofprexed onstraints.Inthe followingwewill use, ordto note modular storesand1 to notethe modular
emptystore
(1|∅)
.Denition3.3 Wedene anorderonmodular storesas follows:
transitivity
>
C
d d>
C
′
>
C
′
substitution
g ⊢
C
t = t
′
⊗ g
′
∃x.(g|
m, t : m) >
C
∃x.(g
′
|
m, t
′
: m)
entailment
g ⊗
N m ⊢
C
g
′
⊗
N m
′
∃x.(g|
m, t : m) >
C
∃x.(g
′
|
m, t : m
′
)
By abuse of notation, we extend the tensor produ t of linear onstraints to modular
stores:
Denition3.4 The onjun tion of twomodular stores
= ∃x.(g|
m)
and′
= ∃x
′
.(g
′
|
m′
)
isthe store(
⊗
′
) = ∃x, x
′
.(g ⊗ g
′
|
m,
m′
)
ifx ∩ x
′
= ∅
.Lemma3.5(Monotoni ityof
⊗
) For all modular stores , d and d′
if d>
C
d′
then⊗
d>
C
⊗
d′
Proof: Byindu tionontheproof
π
of(g
′
|
m′
) >
C
(g
′′
|
m′′
)
weprovethat(g ⊗ g
′
|
m,
m′
) >
C
(g ⊗ g
′′
|
m,
m′′
)
. Inthis proof wesuppose that allm's arenotempty, ifitis notthe ase,
justre allthat
c ⊗ 1 ⊢ c ⊢ c ⊗ 1
.
π
endswithtransitivity: trivial.
π
endswithsubstitution:g
′
⊢
C
t = t
′
⊗ g
′′
∃x.(g
′
|
m, t : m) >
C
∃x.(g
′′
|
m, t
′
: m)
Thank to
⊗
-left rule, we infer thatg ⊗ g
′
⊢
C
g ⊗ t = t
′
⊗ g
′′
and then on ludeimmediately.
π
endswithentailment:g
′
⊗
N m
′
⊢
C
g
′′
⊗
N m
′′
∃x.(g
′
|
m, t : m
′
) >
C
∃x.(g
′′
|
m, t : m
′′
)
Thankto
⊗
-leftrule, weinferthatg ⊗ g
′
⊗
O
m
′
⊢
C
g ⊗ g
′′
⊗
O
m
′′
,andhen e on lude.
3.4 Operational Semanti sWewillnowprovideapre iseoperationalsemanti s toMLCC,basedasusualonanotion
of onguration,throughatransition relationandastru tural ongruen e.
Denition3.6 (Conguration) A ongurationisatuple
hx; ∃y.(g|
m); Γi
wherex
isa multi-set of variable,Γ
a multi-set of lo alized agents and∃y.(g|
m)
a modular store su hthat
y ∩ fv(Γ, x) = ∅
Denition3.7 Thestru tural ongruen e
≡
istheleast ongruen esatisfyingthefollowing ruleof parallel omposition:hx;
; t{A || B}, Γi ≡ hx;
; t{A}, t{B}, Γi
Denition3.8 Thetransitionrelation
−→
istheleastrelationsatisfyingtherulespresented inthe table 2.Thisoperationalsemanti senjoysthesamekindofpropertiesastheoriginalLCC
oper-ationalsemanti s.
Proposition 3.9(Monotoni ity) For every derivation
δ = ((x;
; Γ)
∗
−→ (x
′
;
′
; Γ
′
))
,
thereexists
y
freeinδ
,∆
,andamodularstoredsu has(x, y;
⊗
d; Γ, ∆)
∗
−→ (x
′
, y;
′
⊗
d; Γ
′
, ∆)
.Proof: Byindu tiononthederivation
δ
: Forequivalen eitistrivial.
For tell just note that thanks to the monotoni ity of
⊗
, ifc ⊗ ∃y.(g|
m) >
C
′
then
c ⊗ ∃y.(g|
m) ⊗
d>
C
′
⊗
d. Foraskandpersistentasknotethatthankstothemonotoni ityof
⊗
,if>
C
∃y.(g|
m, t :
m)
andd >
C
∃y
′
.(g
′
|
m′
)
then⊗
d>
C
∃y, y
′
.(g ⊗ g
′
|
m,
m′
, t : m)
andthat ifN g ⊗
N m ⊢ N g
′′
⊗
N m
′′
⊗ d[~s/~z]
thenN(g ⊗ g
′
) ⊗
N m ⊢ N(g
′′
⊗ g
′
) ⊗
N m
′′
⊗ d[~s/~z]
Forhiding onejust usethe
α
- onversionto besurethaty
isfreeinδ
. Forotherrulesnoti ethatthey anbedonein
(x y;
⊗
d; Γ, ∆)
sin etheydonothave onditionaboutthehiddenvariablesorthestore.Equivalen e
hx;
; Γi ≡ hx;
′
; Γ
′
i −→ hy;
d′
; ∆
′
i ≡ hy;
d; ∆i
hx;
; Γi −→ hy;
d; ∆i
Modularize
hx;
; t{s{A}}, Γi −→ hx;
; s{A}, Γi
Tell
d ⊢ ∃y.(g ⊗
N m)
⊗ ∃y.(g|t : m) >
C
′
hx;
; s{t : d}, Γi −→ hx;
′
; Γi
Ask> ∃y.(g|
m, t : m)
g ⊗
N m ⊢ g
′
⊗
N m
′
⊗ d[~s/~z]
hx;
; t{∀~z(d → A)}, Γi −→ hx; ∃y.(g
′
|
m, t : m
′
); t{A[~s/~z]}, Γi
PersistentAsk> ∃y.(g|
m, t : m)
g ⊗
N m ⊢ g
′
⊗
N m
′
⊗ d[~s/~z]
hx;
; t{∀~z(d ⇒ A)}, Γi −→
hx; ∃y.(g
′
|
m, t : m
′
); t{A[~s/~z]}, t{∀~z(d ⇒ A)}, Γi
Hiding
z 6∈ x ∪ fv(
, Γ, t)
hx;
; t{∃z.A}, Γi −→ hx ∪ {z};
; t{A}, Γi
Table2: Transitionrelation
TheobservablesofinterestforMLCCaredenedaspreviouslybyrepla ing onstraintsbymodularstores,wheregenerally,
D
is hosenequaltoG
:Denition3.10(Observables) Let
A
beanMLCC(C)agentsu hthath∅;
1; x{A}i
∗
−→
hy;
; Γi
forsomex 6∈ fv(A)
. the modular store
∃y.
isan a essiblestoreforA
. the modularstore
∃y.
isapseudo-su essforA
,ifΓ
isamulti-setofpersistentasks. the modular store
∃y.
is a su ess ofA
, if it is a pseudo-su ess forA
su h thathy;
; Γi 6−→
. The modular store
∃y.(g|
m)
is aD
-su ess forA
, if it is a su ess forA
su h thatm
= ∅
and∃y.g ∈ D
3.5 Example: Beyond Dining Philosophers
LetusimproveontheexampleofSe t. 2.4.1inordertodemonstratetheexpressivepower
Themodule onstru tsallowtoextendthediningphilosophers'exampletoabanquet
of several tables of philosophers, where ea h table is an independent module. The
orre-spondingMLCCagentbelow reates
N
tablesofP
philosophers:Example(Banqueting Philosophers).
banquet{
∀I, N, P.recT able(I, N, P ) ⇒
∃T able.T able{
∀J.recP hilo(J) ⇒ (
T able : f ork(J) ||
f ork(J) ⊗ f ork(J + 1
modP ) ⇒
T able : eat(J) ||
eat(J) ⇒
T able : (f ork(J) ⊗ f ork(J + 1
modP )) ||
J 6= P → T able : recP hilo(J + 1) ) ||
T able : recP hilo(0)
} ||
I 6= N → banquet : recT able(I + 1, N, P )
}
Sin e the logi al semanti s of MLCC enjoys the same orre tion properties than that
ofLCC(seetheorem 4.4below),thephasesemanti sof LinearLogi anbeusedto prove
safetypropertiesinwaysimilarto[6℄,su hasforinstan ehere,thatnophilosopher anuse
aforkbelongingtoanothertable.
3.6 Code Prote tion
One important feature of a module system is its apability to hide implementations and
guaranteetheprote tionofmodule ode. InMLCC,the odeprote tionpropertymeansthat
ifamodule
t{∃x(x{A} || B)}
is omposed of aninterfa eB
and ahiddenimplementationA
,thenaparallelagentC
annotaddany onstraintoftheformx : c
norunblo kanyofits askwithsu ha onstraint. Thisleadstothefollowingproperty:Proposition 3.11(Code prote tion) Let
A
,B
andC
be three MLCC agents, andt
a term ofT. LetM = t{∃x(x{A} || B)} || C
If
A
andB
donot addany onstraintonx
tothe store ,ex ept those ofthe formx : c
, thenC
annot add any onstraint of the formx : c
nor unblo k any of its ask with su ha onstraintinaderivation fromM
.Proof: Wewillsupposethat
x
isnotfreeinC
norin . Ifthatisnotthe ase,thenx
(the oneunder the∃
)will berenamedbyα
- onversioninordertousetheHidingrule.We thus havea onguration of the form:
(x ∪ {x};
; x{A}, t{B}, C)
, su h thatx 6∈
fv(C,
, t)
. Letus provethat aslongasA
andB
donotadd onstraintsonx
ex eptthoseoftheform
x : c
,x
willremain bound inC
andthusC
willnotbeabletotellnorask anyonstrainton
x
. This is indeed enough sin ethe restri tiononA
andB
forbids that any ask(resp. tell) onanothertermisunblo kedby(resp. unblo ks)atell(resp. anask)onx
sin ex : c
willneverimplya onstraintlikex = t
withx
boundint
.We only need to prove this property for one step of derivation, it will then hold for
any nite derivation by indu tion. Let us onsider all the ases of derivation. If
x{A}
ort{B}
are the hosenagents,then thepropertytriviallyholdssin eC
didnot hange. IfC
istheagent hosenforderivation, therulesModularizeandTellobviouslydon't hangeanything w.r.t.
x
beingbound inC
. TheHidingrule mightmakeabound variablefree, but sin ewehave{x} ∪ x
asrstmemberof our onguration,weknowthat theHiding rule will only apply to another variable. The aseof the Equivalen e rule is treatedbyindu tion onthe equivalent ongurations. Forthe Ask and Persistent Ask rules, the
only risk is that the renaming of the variables under
∀
repla es some of them by aterm ontainingx
. Howeverrememberthattheonlyrepla ementhappensonvariablesappearing in alineartokend
, when⊢
′
⊗ d[t(x)/y]
. Fromthelemmabelowand knowingthat
x
is boundin , theaboveimpli ationwithx
freeint
isimpossible,i.e.x
remainsbound afteranAskoraPersistent Askrule.
Lemma3.12 If
x ∈ fv(m)
su hasm
is lineartokenandc ⊢
C
m ⊗ d
thenx ∈ fv(c)
Proof: Byindu tionontheproof
π
ofc ⊢
C
m ⊗ d
whered
isanarbitrary onstraint. Just re all that we havesupposed in thedenition ofC
that all freevariables o urring in the righthandsideofanon-logi alaxiomappearsinitslefthand side.4 Logi al Semanti s
Onestrikingfeature ofLCC languagesistheirsimplesemanti sin LinearLogi [6, 16, 18℄
allowingforvariousproofmethods omingfromLinearLogi . Inthisse tion,wegeneralize
the results of [6℄ to the ri her fragment of LL ontaining banged impli ations as used in
MLCCprograms.
Denition4.1 In amodule
t
, onstraints,agentsandstorearetranslatedintoformulasin the following way (inthe following wesupposewith nolossof generality thatx 6∈ fv(t)
andx ∩ fv(t) = ∅
):(c ⊗ d)
t
= c
t
⊗ d
t
(∃x.c)
t
= ∃x.c
t
g(s
1
, . . . , s
n
)
t
= g(s
1
, . . . , s
n
)
(!c)
t
=!c
t
m(s
1
, . . . , s
n
)
t
= ˙
m(t, s
1
, . . . , s
n
)
(∃x.A)
t
= ∃x.A
t
s{A}
t
= A
s
(s : c)
t
= c
s
(A || B)
t
= A
t
⊗ B
t
(∀x(c → A))
t
= ∀x(c
t
⊸ A
t
)
(∀x(c ⇒ A))
t
=!∀x(c
t
⊸ A
t
)
For any multi-set
Γ = (γ
1
, . . . , γ
n
)
of agents or prexed onstraints we deneΓ
t
=
γ
1
t
⊗ · · · ⊗ γ
n
t
and∅
t
= 1
. Finally agents, Stores and Congurations are translated into
formulaeinthe following way,where
x ∈ fv(A,
, Γ)
:∃y. (g|
U
i
{t
i
: m
i
})
†
= ∃y.
g ⊗
O
i
m
i
t
i
A
†
= A
x
hy;
; Γi
†
= ∃y.(
†
⊗ Γ
x
)
(C
†
,
C
†
)
is the onstraint system formed from(Σ
G
⊎ ˙Σ
M
)
,Σ
T
andV
su h that ic
1
, . . . , c
n
C
c
thenc
x
1
, . . . , c
x
n
C
†
c
x
withx 6∈ fv(c, c
1
, . . . , c
n
)
and that for allm ∈ ˙
˙
Σ
M
˙
m(x, ~z), !x = y ⊢
C
†
m(y, ~z)
˙
.Lemma4.2 Let
Γ
be asequen eof onstraints,c
be a onstraintandx
be a variable free inΓ
andc
,ifΓ ⊢
C
c
thenΓ
x
⊢
C
†
c
x
.Proof: Byindu tionontheproofof
Γ ⊢
C
c
.Lemma4.3(Soundness of
>
C
) Forallmodularstores anddif>
C
dthen†
⊢
C
†
d†
.
Proof: Aspreviouslywesupposethatall
g
'sandallm'sarenotempty,ifitisnotthe ase thatjust re allthatc ⊗ 1 ⊢ c ⊢ c ⊗ 1
.Byindu tionontheproof
π
of>
C
d: π
endswithtransitivityrules:
>
C
′
′
>
C
d>
C
d Byindu tion hypothesis,†
⊢
C
†
′†
and′†
⊢
C
†
d†
,then thanksto ut rule,wehave
†
⊢
C
†
d†
.
π
endswithsubstitution:g ⊢
C
t = t
′
⊗ g
′
∃x.(g|
m, t : m) >
C
∃x.(g
′
|
m, t
′
: m)
g ⊢
C
t = t
′
⊗ g
′
g ⊢
C
†
t = t
′
⊗ g
′
l4.2g ⊗ m
t
⊢
C
†
t = t
′
⊗ g
′
⊗ m
t
⊗
-rx = y
′
⊗ m
x
⊢
C
†
m
y
t = t
′
⊗ m
t
⊢
C
†
m
t
′
∀
g ⊗ m
t
⊢
C
†
g
′
⊗ m
t
′
ut
π
endswithentailment:g ⊗
N m ⊢
C
g
′
⊗
N m
′
∃x.(g|
m, t : m) >
C
∃x.(g
′
|
m, t : m
′
)
g ⊗
N m ⊢
C
g
′
⊗
N m
′
g ⊗
N m
t
⊢
C
†
g
′
⊗
N m
′t
l 4.2g ⊗
N
m†
⊗
N m
t
⊢
C
†
g
′
⊗
N
m†
⊗
N m
′t
⊗
-R∃x.(g ⊗
N
m†
⊗
N m
t
) ⊢
C
†
∃x.(g
′
⊗
N
m†
⊗
N m
′t
)
∃
Theorem4.4(Soundness) Letκ
andκ
′
betwo ongurations. Ifκ ≡ κ
′
thenκ
†
⊣⊢
C
†
κ
′†
Ifκ
∗
−→ κ
′
thenκ
†
⊢
C
†
κ
′†
Proof: Byindu tionon
≡
and∗
−→
: forparallel omposition,equivalen eandmodularizeitisimmediate;
forhiding,
∃x.(A ⊗ B) ⊣⊢ A ⊗ ∃x.B
and∃x.A ⊣⊢ A
ifx 6∈ fv(A)
; fortell:
d ⊢ g ⊗
N
m⊗ (g|
m) >
C
′
hx;
; s{t : d}, Γi −→ hx;
′
; Γi
d ⊢
C
g ⊗
N m
′
d
t
⊢
C
†
g ⊗
N m
′t
l4.2⊗ (g|
m) >
C
′
†
⊗ g ⊗
N m
′t
⊢
C
†
′†
l4.3†
⊗ d
t
⊢
C
†
′†
cut
∃x.(
†
⊗ d
t
⊗ Γ
†
) ⊢
C
†
∃x.(
′†
⊗ Γ
†
)
∃, ⊗
forask:>
C
∃y.(g|
m, t : m) g ⊗
N m ⊢
C
g
′
⊗
N m
′
⊗ d[~s/~z]
hx;
; t{∀~z(d → A)}, Γi −→
hx; ∃y.(g
′
|
m, t : m
′
); t{A[~s/~z]}, Γi
Firstof allnoti ethatif
y ∩ fv(t) = ∅
then(A[s/y])
t
= A
t
[s/y]
. Nowlet′
= (g|
m, t :
m)
,′′
= (g
′
|
m, t : m
′
)
andB = (d
t
⊸ A
t
)
.π
1
=
g ⊗
N m ⊢
C
g
′
⊗
N m
′
⊗ d[~s/~z]
g ⊗
N m
t
⊢
C
†
g
′
⊗
N m
′t
⊗ d
t
[~s/~z]
l4.2′†
⊢
C
†
′′†
⊗ d
t
[~s/~z]
⊗
π
2
=
>
C
∃y.
′
†
⊢
C
†
∃y.
′†
l4.3π
2
π
1
′′†
⊗ d
t
[~s/~z], B[~s/~z] ⊢
C
†
′′†
⊗ A
t
[~s/~z]
⊗,
⊸
′†
, B[~s/~z], ⊢
C
†
′′†
⊗ A
t
[~s/~z]
ut†
, ∀z.B, ⊢
C
†
∃y.
′′†
⊗ A
t
[~s/~z]
∃, ∀
∃y.
′†
, ∀z.B, ⊢
C
†
∃y.
′′†
⊗ A
t
[~s/~z]
ut∃x.(
†
⊗ ∀z.B ⊗ Γ
†
) ⊢
C
†
∃x.(∃y.
′′†
⊗ A
t
[~s/~z] ⊗ Γ
†
)
∃, ⊗
forpersistentask:
> ∃y.(g|
m, t : m)
g ⊗
N m ⊢ g
′
⊗
N m
′
⊗ d[~s/~z]
hx;
; t{∀~z(d ⇒ A)}, Γi −→
hx; ∃y.(g
′
|
m
, t : m
′
); t{A[~s/~z]}, t{∀~z(d ⇒ A)}, Γi
Byusingthepreviousnotationfor
′
,
′′
andB
wehave:†
, ∀z.B, !∀z.B, Γ
†
⊢
C
†
†
⊗ ∀z.B⊗!∀z.B ⊗ Γ
†
⊗
†
, !∀z.B, Γ
†
⊢
C
†
†
⊗ ∀z.B⊗!∀z.B ⊗ Γ
†
!
∃x.(
†
⊗!∀z.B ⊗ Γ
†
) ⊢
C
†
∃x.(
†
⊗ ∀z.B⊗!∀z.B ⊗ Γ
†
)
∃, ⊗
Byusingtheresultoftheprevious asewe an on lude.
Lemma4.5(Completeness of>
C
) For all modular stores and d, if†
⊢
C
†
d†
then>
C
d. Proof: Let()
−†
be a partial translation of multi-sets of onstraints into non quantied
storesdened asfollow:
g
−†
=(g|∅)
m(t, ~s)
˙
−†
=(∅|t : m(~s))
(!g)
−†
=(!g|∅)
(! ˙
m(t, ~s))
−†
=(∅|!t : m(~s))
(c ⊗ c
′
)
−†
=c
−†
⊗ c
′−†
(Γ, ∆)
−†
=Γ
−†
⊗ ∆
−†
First weprovetheintermediary result: foreverymulti-setof onjun tionsof onstraints
Γ
andevery onjun tionof onstraintsd
ifΓ ⊢
C
†
d
thenΓ
−†
>
C
d
−†
. Weprovethisresultby indu tionontheproofπ
ofthesequentΓ ⊢
C
†
d
. π
isanaxiomoftheformΓ
x
⊢
C
†
d
x
su hasΓ ⊢
C
d
: let(Γ
x
)
−†
= (g|x : m)
and(d
x
)
−†
= (g
′
|x : m
′
)
. Nowjust usethe entailmentrule to
π
is an axiom of the formm(x, ~z), x = y ⊢
˙
C
†
m(y, ~z)
˙
: in su h a ase just use thesubstitutionrule.
π
endswith ut:Γ ⊢
C
†
c
c, ∆ ⊢
C
†
d
Γ, ∆ ⊢
C
†
d
Byindu tionhypothesis,Γ
−†
>
C
c
−†
andc
−†
⊗ ∆
−†
>
C
d
−†
. Thankstomonotoni ity of⊗
(lemma3.5)and usingthetransitivityrulewe an on ludethatΓ
−†
⊗ ∆
−†
>
C
d
−†
.
π
endswith⊗
-left: trivial
π
endswith⊗
-right:Γ ⊢
C
†
c
∆ ⊢
C
†
d
Γ, ∆ ⊢
C
†
c ⊗ d
Byindu tion hypothesisΓ
−†
>
C
c
−†
and∆
−†
>
C
d
−†
. Byusingthemonotoni ityof⊗
(lemma 3.5)wehaveΓ
−†
⊗ ∆
−†
>
C
c
−†
⊗ ∆
−†
andc
−†
⊗ ∆
−†
>
C
c
−†
⊗ d
−†
. By usingthetransitivityrulewehavenallyΓ
−†
⊗ ∆
−†
>
C
c
−†
⊗ d
−†
.
π
endswithoneofthefourrulesfor!
: Justnoti ethatthefourfollowingsequentsare true:
c ⊗ d ⊢ c⊗!d
fordereli tion;
!c ⊢ c
forpromotion;
c ⊢ c⊗!d
forweakening;
c⊗!d⊗!d ⊢ c⊗!d
for ontra tion.Nowitis easy toproveby anindu tion on that for everynonquantied store , we
have
(
†
)
−†
. Hen eweprovetheresultonnonquantiedstore. Fromherewe an on lude
easilybynotingthat if
c ⊢ d
then∃x.c ⊢ ∃x.d
Lemma4.6 Forany onstraint
c
ofC
,thereexistsasetofvariablesx
notfreeinc
and on-straintwithoutquanti ationg
ofG
andamulti-setof atomi onstraints(possiblybanged)m
ofM
su hthatc ⊣⊢ ∃x.g ⊗
N m
Proof: Byindu tionon
c
:
c
isanatomi onstraint(possiblybanged)ofG
: trivial.
c
isanatomi onstraint(possiblybanged)ofM
:c ⊣⊢ 1 ⊗ c
.
c = c
′
⊗ c
′′
: By indu tion hypothesis we have
c
′
⊣⊢ ∃x
′
.(g
′
⊗
N m
′
)
and
c
′′
⊣⊢
∃x
′′
.(g
′′
N m
′′
)
. We ansuppose withoutlost ofgeneralitythat
x
′
∩ fv(c
′′
) = ∅
and
x
′′
∩ fv(c
′
) = ∅
c = ∃x
′
.c
′
: trivial.
Lemma4.7 For any multi-set of agentst
1
{A
1
}, . . . , t
k
{A
k
}
and any onstraintc
, ifA
t
1
1
. . . A
t
k
k
⊢
C
†
c
thenthereexistsaderivation(∅;
1; t
1
{A
1
}, . . . , t
k
{A
k
})
∗
−→ (x;
; !Γ)
where
†
⊢
C
†
c
and!Γ
isasequen e ofpersistentasks ,thevariablesx
are freeinc
.Proof: Letus provethe result,by indu tion onthe sequent
A
t
1
1
, . . . , A
t
k
k
⊢
C
†
c
wheretheA
i
's areagentsandc
a onstraint. Weshall onsider withoutlossof generality, that inπ
theleft introdu tion of∀
and of⊸
are always onse utive(if itis not the ase, therules anbe permuted toobtain su h aproof, see forexample[7℄, notingthat thepromotion istheonly aseof unpermutability with
∀
-leftappearsonly in the onstraintpart, theright sideofthesequent,andthus neverbellowa⊸
-right).First remark that this indu tion is meaningful. Indeedthe only utswhi h annot be
eliminatedinanILLproofdealwithnon-logi alaxioms,sotheyareofoneofthefollowing
form:
Γ
†
⊢
C
†
c
c ⊢
C
†
d
Γ
†
⊢
C
†
d
c ⊢
C
†
c
′
Γ
†
, c
′
⊢
C
†
d
Γ
†
, c ⊢
C
†
d
Hen e theappli ationof the utruleintrodu essequentsin whi h thenewformulaonthe
rightis alwaysa onstraint. Ontheother hand theformulaeontheleft hand sideremain
sub-formulaeoftranslationofagents.
Oneremarks also that
(A
t
)
s
= A
t
and
s{t{A}} −→ A
t
hen ewe ansuppose without
lostofgeneralitythatall
A
i
'sarenotoftheformt
′
i
{A
′
i
}
. Byindu tionontheproofπ
ofA
t
1
1
, . . . , A
t
k
k
⊢
C
†
c
: π
is an axiom:c ⊢
C
†
d
. Sin ec
is a onstraint,Γ
is of the formt{s : c
′
}
su h that
c
′s
= c
. Let
= ∃y.(g|s : m)
su hthat∃y.(g⊗N m) ⊣⊢ c
′
(weknowitispossiblethanks
to thelemma4.6). Thenwehave,byusingtheruletell,
(∅;
1; t{s : c
′
}) −→
∗
(∅;
; ∅)
andbyusingthelemma4.2†
⊢
C
†
c
. π
endswitha ut:Γ
†
⊢ c
c ⊢ d
Γ
†
⊢ d
orc
1
⊢ c
2
Γ
†
, c
2
⊢ d
Γ
†
, c
1
⊢ d
Theformer aseisimmediate. Inthelattertherearetwopossiblesub- asestheaxiom
iseitheroftheform
c
′x
1
⊢
C
†
c
′x
2
su hc
′
1
⊢
C
c
′
2
oroftheformx = y ⊗ ˙
m(x, ~t) ⊢
C
†
m(y, ~t)
˙
.Byyindu tionhypothesisweknowthat
(∅;
1; Γ, c
2
)
∗
−→ (x;
d; !Γ
′
)
su hthat∃x.
d†
⊢
C
†
d
. Justnoti ethattheappli ationofthetellrulethatredu estheagent orresponding toc
2
anbeapplied onc
1
sin ec
′
1
⊢
C
c
′
2
and′
⊗ ((x = y)|x : m(~t)) ⊢ c
′
⊗ (∅|y : m(~t))
.
π
endswith1
-left: notethat(∅;
1; t{s : 1}, Γ) −→
∗
(∅;
π
endswitha⊗
-left:Γ
†
, A ⊗ B ⊢
C
†
c
Γ
†
, A, B ⊢
C
†
c ⊗ d
eitherB ⊗ B
′
isthe translationa parallel omposition of twoagents, in su h a
aseone anusetheparallel ompositionrule.
or
B ⊗ B
′
isthetranslationofa onstraintoftheform
t : (d ⊗ d
′
)
,insu ha ase
just noti e that
(∅;
1; x{t : (d ⊗ d
′
)}, Γ)
and
(∅;
1; x{t : d}, x{t : d
′
}, Γ)
havethe
samepseudo-su esses.
π
endswitha⊗
-right:Γ
†
⊢
C
†
c
∆ ⊢
C
†
d
Γ
†
, ∆
†
⊢
C
†
c ⊗ d
Byindu tionhypothesis,weknowthereexistsaderivation
(∅;
1; Γ)
∗
−→ (x;
; !Γ
′
)
and(∅;
1; ∆)
∗
−→ (y;
d; !∆
′
)
su h∃x.
†
⊢
C
†
c
and∃y.
d†
⊢
C
†
d
. Thankstothemonotoni ity of∗
−→
we an infer that(∅;
1; Γ, ∆)
∗
−→ (x;
; !Γ
′
, ∆)
∗
−→ (x, y;
⊗
d; !Γ
′
, !∆
′
)
. Toon ludewejustnoti ethata ordingtoindu tionhypothesis,
∃x y.(
⊗
d)
†
⊢
C
†
c ⊗ d
if
x ∩ fv(
d, d) 6= ∅
andy ∩ fv(
, c) 6= ∅
.
π
endswith∃
-right: immediate
π
endswith∃
-left:Γ
†
, A
t
⊢
C
†
c
Γ
†
, ∃x.A
t
⊢
C
†
c
Byindu tion hypothesis, wehave
(∅;
1; t{A}, Γ)
∗
−→ (y;
; !Γ
′
))
with∃y.
†
⊢
C
†
c
. As we an suppose without lost of generalityx 6∈ y ∩ fvΓ
(sin e we work moduloα
- onversation)andas(∅;
1; t{∃x.A}, Γ)
∗
−→ (x;
1; t{A}, Γ)
,bymonotoni ityof∗
−→
we have(∅;
1; t{∃x.A}, Γ)
∗
−→ (x, y;
; !Γ
′
)
. Be ause
x 6∈ fv(c)
and∃y.
†
⊢
C
†
c
, we have∃x.∃y.
†
⊢
C
†
c
π
endswith(thankstothepreliminaryremarksonthepermutabilityofrules):Γ
†
⊢
C
†
d
t
[~s/~z]
∆
†
, A
t
[~s/~z] ⊢
C
†
c
Γ
†
, ∆
†
, d
t
[~s/~z] ⊸ A
t
[~s/~x] ⊢
C
†
c
Γ
†
, ∆
†
, ∀~z.(d
t
⊸ A
t
) ⊢
C
†
c
Byindu tion hypothesis wehave
(∅;
1; Γ)
∗
−→ (y;
d; !Γ
′
)
su h that
∃y.
d†
⊢
C
†
d
t
[~s/~z]
.Bylemma4.6weknowalsothereexistsa onstraint
∃x
′
.(g ⊗
N m)
su hthat
∃x
′
.(g ⊗
N m) ⊣⊢ d[~s/~z]
andthenbylemmas4.2and4.5weinferthatd>
C
∃x
′
.(g|t : m)
. Thus
byusingthemonotoni ityof
∗
−→
andbyapplyingtheaskrule,onehas(∅;
1; t{∀~z(c →
A)}, !Γ)
∗
−→ (x;
d; t{∀~z(c → A)}, !Γ
′
) −→ (x;
1; Γ
′
, t{A[~s/~z]})
. Moreoverbyindu tionhypothesis,
(∅;
1; t{A[~s/~z]}, ∆)
∗
−→ (y;
; !∆
′
)
with∃y.
†
⊢
C
†
c
, hen e by using on e againthemonotoni ityof∗
−→
weinfer(∅;
1; Γ, ∆, t{∀~z(c → A)})
∗
−→ (x, y;
; !Γ
′
, !∆
′
)
. As∃y
′′
y.
†
⊢
C
†
c
if∃y.
†
⊢
C
†
c
andy
′′
∩ fv(c) = ∅
we an on lude.
π
endswithadereli tion. Thankstothepreliminaryremarksonthepermutabilityof rulesthereareonlytwosub- ases:Γ
†
, d
t
⊢
C
†
c
Γ
†
, !d
t
⊢
C
†
c
orΓ
†
, ∀~z.(d
t
⊸ A
t
) ⊢
C
†
c
Γ
†
, !∀~z.(d
t
⊸ A
t
) ⊢
C
†
c
In the former ase, it is lear, just re all that
!c ⊢ c
. In the latter by indu tion hypothesis,(∅;
1; Γ, t{∀~x(d → A)})
∗
−→ (y;
; !Γ
′
)
, with∃y.
†
⊢
C
†
c
. Therefore by repla ingin thepreviousderivationtheaskrulethatredu e thet{∀~x(d → A)}
agent (this redu tionisne essary, otherwise!Γ
′
would notbeasequen e ofpersistentasks
only), bythe persistent ask ruleweobtain
(∅;
1; t{∀~x(d ⇒ A)}, Γ)
∗
−→ (y;
; ∀~x(d ⇒
A)}, !Γ
′
)
. Theresultisthenimmediate.
π
endswithapromotion:!Γ
†
⊢
C
†
!c
!Γ
†
⊢
C
†
c
By indu tion hypothesis,(∅;
1; !Γ)
∗
−→ (y;
; !Γ
′
)
with∃y.
†
⊢
C
†
c
. Just re all that!c ⊢ c
to on lude.
π
endswithaweakening:Γ
†
⊢
C
†
c
Γ
†
, !d
t
⊢
C
†
c
orΓ
†
⊢
C
†
c
Γ
†
, !∀x(d
t
⊸ A
t
) ⊢
C
†
c
In the former ase it is enough to noti e that
(∅;
1; s{t :!d}, Γ)
∗
−→ (∅;
1; Γ)
sin e!d
t
⊢ 1
. In thelatteronejust remarks thattheaddition ofsomepersistent asksto a
multi-setofanagentdoesnot hange itspseudo-su esses.
π
endswitha ontra tion:Γ
†
, !d
t
, !d
t
⊢
C
†
c
Γ
†
, !d
t
⊢
C
†
c
orΓ
†
, !∀x(d
t
⊸ A
t
), !∀x(d
t
⊸ A
t
) ⊢
C
†
c
Γ
†
, !∀x(d
t
⊸ A
t
) ⊢
C
†
c
Intheformer,just note thatford su h thatd
†
⊣⊢!d
t
(thatispossiblethankstothe
lemma 4.6),wehave
!d
t
⊢
d†
⊗
d†
. Inthelatterhavingtwoo urren esoftheagent
∀z(d ⇒ A)
doesnot hange anything, sin eall onstraint onsumedbytwoidenti alC
†
,letus note
↓ S = {c ∈ C
†
|∃d ∈ S, d ⊢
C
†
c}
Proposition 4.8(Observationof pseudo-su esses) ForeveryMLCC(C)agent
A
,we have:↓ (O
p-s(A)
†
) = {c ∈ C
†
| A
†
⊢
C
†
c}
Proof: Onein lusionisobviousbyapplyingthesoundnesstheoremandbynotingthatfor
!Γ, c ⊢ c
. Theotherisadire t onsequen eofthepreviouslemma.Theorem4.9(Observationof stores) For everyMLCC(C)agent
A
,wehave:↓ (O
store(A)
†
) = {c ∈ C
†
| A
†
⊢
C
†
c ⊗ ⊤}
Proof: Onein lusion is stillobviousby applyingthe previoustheorem 4.4and by noting
that
Γ, c ⊢ c ⊗ ⊤
. For the other in lusion use the previous proposition, above the rightintrodu tionofthetensor onne tivein
c ⊗ ⊤
andnotethatthepropertyispreservedbyallleftintrodu tionrules.
Be ause ourtranslationofMLCCagentsimpliestheuseof bangs(!) forthepersistent
asks,wearenotabletoexa tly hara terizenal stores(and hen esu esses). Indeedthe
rule of weakeningfor the ! allows forgetting a formula orresponding to apersistent ask
beforeit onsumesany onstraintsit ould. Nonethelessbysupposingsomepropertiesover
the onstraints onsumedbythepersistentasks,we an hara terizepre iselyaninteresting
subsetofsu esses.
Denition4.10(
D
-over agent) An agent isD
-over if no guardc
of its persistent asks belongstoD
.Denition4.11(
D
-proof system) We willsay thatC
isaD
-proof onstraintsystem, if for any onstraintd
ofD
andany onstraintc
ofC
wehave:if
d ⊢
C
c ⊗ ⊤
thenc ∈ D
Theorem4.12(Observation of
D
-su ess) For anyD
-over agentA
,ifC
isaD
-proof systemwe have:↓ (O
D
-su(A)
†
) = {d ∈ D | A
†
⊢
C
†
d}
Proof: One in lusion is obvious. Thank to the proposition 4.8, we know that for
ev-ery onstraint
d
ofD
, there exists a derivation(∅;
1; x{A})
∗
−→ κ = (y;
d; t
1
{∀z
1
(c
1
⇒
A
1
)}, . . . , t
k
{∀z
k
(c
k
⇒ A
k
)})
su h that∃y.
d†
⊢
C
†
d
. Now toprovetheother in lusion,we justneedtoprovethatsu haκ
isirredu ible.First note that if
C
isD
-proof, thenC
†
is
D
-proof too. Then let us suppose thatκ
is redu ible,inotherwordthereexistsapersistentaskt
i
{∀z
i
(c
i
⇒ A
i
)}
(1 ≤ i ≤ k
)inκ
su hthatd
>
C
∃z.(g|
m, t
i
: m)
andg ⊗
N m ⊢
C
g
′
⊗
N m
′
⊗ c
i
[~s/~
z
i
]
. Thankstolemma 4.3,we have∃z.(g ⊗
N
m†
⊗ m
t
i
) ⊢
C
†
c
andthen, sin eC
†
is
D
-proof,weinferthatg ∈ D
,m= ∅
and