Module Qcert.CAMP.Typing.TCAMPSugar
Require
Import
String
.
Require
Import
List
.
Require
Import
EquivDec
.
Require
Import
Program
.
Require
Import
Utils
.
Require
Import
DataSystem
.
Require
Import
CAMPSugar
.
Require
Export
TCAMP
.
Section
TCAMPSugar
.
Local
Open
Scope
camp_scope
.
Local
Hint
Constructors
camp_type
:
qcert
.
Context
{
m
:
basic_model
}.
Lemma
PTCast
τ
c
Γ
br
bs
:
[τ
c
&Γ] |=
pcast
br
; (
Brand
bs
) ~> (
Brand
br
).
Proof.
repeat
econstructor
.
Qed.
Lemma
PTSingleton
τ
c
Γ τ :
[τ
c
&Γ] |=
psingleton
; (
Coll
τ) ~> τ.
Proof.
repeat
econstructor
.
Qed.
Lemma
PTmapall
τ
c
{Γ :
tbindings
} {τ₁ τ₂ :
rtype
} {
p
:
camp
} :
NoDup
(
domain
Γ) ->
([τ
c
&Γ] |=
p
; τ₁ ~> τ₂) -> [τ
c
&Γ] |=
mapall
p
;
Coll
τ₁ ~>
Coll
τ₂.
Proof.
unfold
mapall
;
intros
.
econstructor
.
+
repeat
econstructor
;
eauto
.
+
rewrite
merge_bindings_nil_r
;
eauto
.
+
simpl
.
apply
camp_type_tenv_rec
;
qeauto
.
Unshelve
.
eauto
.
Qed.
Lemma
PTmapall_inv
τ
c
{Γ :
tbindings
} {τ₁ τ₂ :
rtype
} {
p
:
camp
} :
is_list_sorted
ODT_lt_dec
(
domain
Γ) =
true
->
[τ
c
&Γ] |=
mapall
p
; τ₁ ~> τ₂ ->
exists
τ₁' τ₂',
τ₁ =
Coll
τ₁' /\
τ₂ =
Coll
τ₂' /\
([τ
c
&Γ] |=
p
; τ₁' ~> τ₂').
Proof.
unfold
mapall
;
intros
.
inversion
H0
;
subst
.
inversion
H3
;
subst
.
inversion
H8
;
subst
.
symmetry
in
H4
;
apply
map_eq_nil
in
H4
.
rtype_equalizer
.
subst
.
rewrite
merge_bindings_nil_r
in
H5
.
inversion
H5
;
subst
.
rewrite
sort_sorted_is_id
in
H6
;
eauto
.
Qed.
End
TCAMPSugar
.