Dans cette partie, nous ne consid´erons des types de processus sans variable
li´ee, afin de simplifier les preuves. Remarquons toutefois que le lemme 3 nous
assure que les r´esultats pr´esent´es ici sont g´en´eralisable `a n’importe quel type de
processus.
D´efinition 18. Supposons donn´es deux programmesD1 et D2. Nous ´ecrivons
D1 vD2 si et seulement si pour tout type de processusF ,S1 → S2 tel que
D1 : F1, il existe F
0,S1→S
02
avecD2 : F2 etS
0 2⊂S2.
Lemme 8. Pour tout contexte d’ex´ecution E et paires de processus (D, D
0),
DvD
0impliqueE[D]vE[D
0].
D´emonstration. Nous raisonnons par r´ecurrence sur la structure du contexteE:
– CasE= []. Ce cas est trivial.
– Cas E =D
k| E
0. Consid´erons le typage valide E[D] : S1 →S2. Nous
pouvons utiliser le lemme 5 qui nous donne l’existence d’une d´erivation en
forme normaleJdeE[D] : S1→S2. Par construction,J est de la forme :
J1
D
k: S
11→S
21J2
E
0[D] : S
21→S
22E[D] : (S
1 1∪S
2 1)→(S
1 2∪S
2 2)
En utilisant l’hypoth`ese de r´ecurrence, il existe un type ensembleS3avec
S3 ⊂S
22
et une d´erivation de type J3 deE
0[D
0] : S
21
→ S3. De plus, la
d´efinition du pr´edicat - nous donne que S3 - S
11
, ce qui implique que
la d´erivation de type suivante est valide, nous donnant alors le r´esultat
attendu :
J1
D
k: S
11→S
21J3
E
0[D
0] : S
12→S3
E[D] : (S
11∪S
21)→(S
21∪S3)
– Cas E = c[I / O][E
0]. Consid´erons le typage valide E[D] : S1 → S2.
Utilisant le lemme 5, nous pouvons supposer qu’il existe une d´erivation en
forme normaleJdeE[D] : S1→S2. Par construction,J est de la forme :
J1
D : S
10→S
20S1-S
01S
20-S2
c[I / O][D] : S1∩I→S2∩O
En utilisant l’hypoth`ese de r´ecurrence, il existe un type ensembleS3avec
S3⊂S
22
et une d´erivation de typeJ2deE
0[D
0] : S
10→S3. Nous
construi-sons alors le type ensembleS
30tel queS
30=S3∩Oet la d´erivation de type
suivante, qui nous donne le r´esultat (en effet, commeS3⊂S
20etS
02-S2,
nous avons par constructionS
03⊂S2) :
J2
D
0: S
10→S3 S1-S
01S3-S
03dc(S
10) =I∧dc(S
30) =O S
10→S
30is consistent
c[I / O][D
0] : S1→S
30Th´eor`eme 14. Supposons donn´es deux programmesD1 et D2 tels que D1 B
D2. Nous avons alors queD1vD2.
D´emonstration. Nous raisonnons par cas sur la r`egle de r´eduction utilis´ee dans
D1 B D2:
– CasR :Contexte:D1=E[D] etD2 =E[D
0]. En utilisant l’hypoth`ese
de r´ecurrence, nous avons DvD
0. Nous pouvons alors utiliser le lemme
8 pour avoir le r´esutat.
– CasR :Entr´ee. Supposons queD1est typable. Avec le lemme 5, il existe
une d´erivation de type valide et en forme normale J typant l’assemblage
D1 :J est donc de la forme suivante.
J1
ehMi: ∅ →e: (T)
J2
D
0: S1→S2
c[I / O][D
0] : S1∩I→S2∩O
D1 : (S1∩I)→(S2∩O)∪e: (T)
La d´erivation suivante nous donne alors clairement le r´esultat (nous avons
en effet (S2∪e: (T))∩O⊂(S2∩O)∪e: (T)) :
J1
ehMi: ∅ →e: (T)
J2
D
0: S1→S2
D
0|ehMi : S1→S2∪e: (T)
D2 : S1∩I→(S2∪e: (T))∩O
– CaseR :Sortie. Supposons queD1est typable. Avec le lemme 5, il existe
une d´erivation de type valide et en forme normale J typant l’assemblage
D1 :J est donc de la forme suivante.
J1
ehMi: ∅ →e: (T)
J2
D
0: S1→S2
D
0|ehMi : S1→S2∪e: (T)
D1 : S1∩I→(S2∪e: (T))∩O
De plus, comme la r`egle de r´eductionR :Sortiepeut s’appliquer surD1,
nous avons e ∈ O, et donc (S2∪e : (T))∩O = (S2∩O)∪e : (T). La
d´erivation suivante nous donne alors clairement le r´esultat :
J1
ehMi: ∅ →e: (T)
J2
D
0: S1→S2
c[I / O][D
0] : S1∩I→S2∩O
D2 : S1∩I→(S2∩O)∪e: (T)
– Case R :Primitif. Nous avons le r´esultat trivialement, en utilisant la
d´efinition de la fonction Ω (voir la partie 3.2.3 pour plus d’informations).
Annexe C
Annexe du chapitre 4
This last annex is in english and presents the proofs of our inference
algo-rithm described section 4.1.
C.1 Constraint Generation
In this subsection, we present the properties of the constraint generation
algorithm, the first step of the inference algorithm. These properties are
cor-rection and completeness, meaning that the algorithm generates a satisfiable
constraint if and only if the input program has a valid type.
C.1.1 Correction
Lemme 9. Let suppose given a valid inference statement ofv : τ. Then there
exist a type derivation ofv : τ.
D´emonstration. By induction on the inference derivation ofe : τ, the result is
evident.
Lemme 10. Let suppose given a valid inference statement ofR`M : T. Then
there exist a type derivation ofR`M : T.
D´emonstration. By induction on the inference derivation of R ` M : T, the
result is evident.
Th´eor`eme 15. Let suppose given a valid derivation of D : F[C]. Then, for
every substitutionσsuch thatσC, there exist a type derivation ofD : σ(F).
D´emonstration. By induction onD:
– Case D = p. This case is evident with the typing rules T :Primitive,
T :Inst,T :SubstandT :Sub.
– Case D = ehMi. Because of the definition of the constraint generation
algorithm, the generation derivation has the form :
J
∅ `M : T η, ξ fresh
ehMi : ∅ →e: (ξ[η]) [T ≤ξ[η]]
Using the previous lemma, the typing statement ∅ ` M : T holds : let
noteJ
0a typing derivation for this statement. We can then have the result
in this case with the following derivation :
T :Sub T :Subst T :Channel
J
∅ `M : T
ehMi: ∅ →e: (T)
ehMi : σ(∅ →e: (T))
ehMi : σ(∅ →e: (ξ[η]))
– CaseD=D1|D2. The inference derivation has the form :
D1 : S1→S2[C1] D2 : S
10→S
20[C2]
D : S1∪S
01→S2∪S
20[C1∧C2∧S2-S
10∧S
20-S1]
AsσC, we haveσC1andσC2. Thus, per the induction hypothesis,
there exist a type derivation for both statementD1 : σ(S1)→σ(S2) and
D2 : σ(S
0 1) → σ(S
0 2). Moreover, as σ S2 - S
0 1∧S
0 2- S1, we have
σ(S2)-σ(S
0 1) andσ(S2)-σ(S
01
). We can thus apply the typing rule for
parallel composition : there exists a type derivation ofD : σ(S1∪S
01)→
σ(S2∪S
02).
– CaseD=c[I / O][D
0]. The inference derivation has the form :
D
0: S1→S2[C]
c[I / O][D
0] : (S1∩I)→(S2∩O) [C]
Per induction, asσC,D
0: σ(S1→S2) holds. Moreover, per
construc-tion, we have (S1 ∩ I) - S1 and S2 - (S2 ∩O). This implies that
σ(S1∩I)-σ(S1) and σ(S2)-σ(S2∩O). Thus, we can apply the
com-ponent typing rule to have a type derivation ofD : σ(F).
C.1.2 Completeness
Lemme 11. Let consider a type T
R, a routing variable ξ
R0and a message
variableηsuch thatR
0⊂R. Then we can constructσsuch thatdom(σ) ={ξ, η}
andσ(ξ[η]) =T.
Lemme 12. Let suppose given a valid type statement v : E. Then, there exist
a valid constraint generation derivation ofv : E.
D´emonstration. By induction on the type derivation ofv : τ.
Lemme 13. Let suppose given a valid type statement R ` M : T and an
inference derivation R : M : T
0. Then there exist a substitution σ with
dom(σ)∩ =(σ) =∅andσ(T
0) =T.
D´emonstration. By induction on the type derivationJ ofM : T :
– CaseJ has the form :
J
0v : E R⊂R
0kind(ξ
R0) =F
R`v
∅: ξ
R0[E]
Using the previous lemma, the inference statementv : E holds. We can
then trivially construct an inference derivation of R ` v
∅: ξ
R[E], with
ξfresh and not duplicable. Finally, the substitutionξ
R→ξ[
]R
0•gives us
the result.
– CaseJ has the form :
J
0R∪ {r} `v
δ: T R∪ {r} `T
kR`v
r;δ: r(T, T
k)
Using the induction hypothesis, the inference statement R∪ {r} ` v
δ:
T
0, with a substitution σ1 such that σ1(T
0) = T. We can then trivially
construct an inference derivation ofR`v
r;δ: r(T
0, ξ
R∪{r}[η]), withξand
η fresh. Let then construct the substitution σ2 such thatσ2(ξ[η]) =T
k:
the substitutionσ,σ2◦σ1 gives us the result.
– CaseJ has the form :
R∪ {r} `v
δ: T R∪ {r} `T
kR`M
↓r;δ: r(T
k, T)
Using the same approach as before, we have the result.
Th´eor`eme 16 (Completeness). Let suppose given a valid type statement D :
∀β.S1→S2. Then, for all substitutionσ
0and valid typeF
0with∀β.σ
0(S1→S2)≤
F
0, there exist an inference derivation ofD : S
10→S
02[C], some variablesαand
a substitutionσ such thatdom(σ)∩ =(σ) =∅,σC and∀α.σ(S
10→S
20) =F
0D´emonstration. By induction on the type derivationJ ofD : S1→S2 :
– CaseJ has the form :
∅ `v
δ: T1
ehv
δi: ∅ →e: (T1)
Let consider a substitutionσ
0and a valid type F
0such that σ
0(∅ →e :
(T1))≤F
0. With the previous lemma, there exist a substitutionσ1 and a
typeT
0such that the inference statementδ : v
δ: T
0holds and σ(T
0) =
T1. We can then construct the inference derivation of ehv
δi : ∅ → e :
(ξ[η]) [T ≤ξ[η]] withξandη fresh. Let now remark that because we have
∅ →e: (T)≤F
0, there existsT2 such thatσ
0(T1)≤T2and F
0=∅ →e:
(T2). We can then construct the substitutionσ2 such thatσ2(ξ[η]) =T2,
dom(σ2) ={ξ, η} and the substitution σ such thatσ ,σ2◦σ
0◦σ1. We
trivially have thatσT ≤ξ[η] andσ(∅ →e: (ξ[η])) =F
0– CaseJ has the form :
Ω(p) =∀β.S1→S2
p : ∀β.S1→S2
Let consider a substitutionσ
0and a valid typeF
0such that∀β.σ
0(S1→S2)≤
F
0. Let then consider the valid inference statement
p : S
10→S
20[S
10-S1{
α0/
β} ∧S2{
α0/
β}-S
20] with S1=[e
i: (T
i)
S2=[e
j: (T
j) S
10=[e
i: (ξ
i[η
i]) S
20=[e
j: (ξ
j[η
j])
Because we have∀β.σ
0(S1→S2)≤F
0there existT
0i
andT
0j
such that
F
0=∀β.[e
i: (T
i0)→e
j: (T
j0) σ(T
i)≤T
i0σ(T
j)≤T
j0Let consider the substitutionsσ
i(resp.σ
j) such thatσ
i(ξ
i[η
i]) =T
0i
(resp.
σ
j(ξ
j[η
j]) =T
j0) andσ
k=β→α
0. Let finally constructσ,J
σ
i◦J
σ
j◦
σ
k: this substitution withα=β gives us trivially the result.
– CaseJ is of the form :
J1
D1 : S1→S2
J2
D2 : S3→S4
D1|D2 : (S1∪S3)→(S2∪S4)
Because we haveσ
0(F)≤F
0there existsS
10,S
20,S
30andS
04such that
F
0= (S
10∪S
03)→(S
20∪S
40) S
10≤σ
0(S1) σ
0(S2)≤S
20S
30≤σ
0(S3) σ
0(S4)≤S
40Then, using the induction hypothesis, there exists an valid inference
state-mentD1 : S
00 1→S
002
[C1] (resp.D2 : S
00 3→S
004
[C2]) and a substitutionσ1
(resp.σ2) such thatσ1(S
001
→S
00 2) =S
0 1→S
0 2(resp.σ2(S
00 3→S
00 4) =S
0 3→
S
04
). Let defineσ=σ2◦σ1. Per construction, we have dom(σ1)∩dom(σ2) =
∅ and =(σ1)∩dom(σ2) =∅, so σ(F1) =S
01
→S
02
andσ(F2) =S
0 3→S
04
hold. Finally, asF
0is valid,σC1∧C2∧S
004-S
100∧S
200-S
300, which gives
us the result.
– CaseJ has the form :
J
0D : F
D : σ1(F)
Dans le document
Composants et Typage
(Page 194-200)