Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Actris
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Iris
Actris
Commits
5b3b1042
Commit
5b3b1042
authored
1 year ago
by
Jonas Kastberg
Browse files
Options
Downloads
Patches
Plain Diff
Simplified choice specs
parent
6f21f0b0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
multi_actris/channel/channel.v
+61
-26
61 additions, 26 deletions
multi_actris/channel/channel.v
with
61 additions
and
26 deletions
multi_actris/channel/channel.v
+
61
−
26
View file @
5b3b1042
...
@@ -136,12 +136,12 @@ Definition sum_reduce {A B C} (f1 : A → C) (f2 : B → C) (ab : A + B) : C :=
...
@@ -136,12 +136,12 @@ Definition sum_reduce {A B C} (f1 : A → C) (f2 : B → C) (ab : A + B) : C :=
|
inr
b
=>
f2
b
|
inr
b
=>
f2
b
end
.
end
.
Definition
iProto_choice
{
Σ
}
{
TT1
TT2
:
tel
e
}
Definition
iProto_choice
{
Σ
}
{
A
B
:
Typ
e
}
(
a
:
action
)
(
a
:
action
)
(
v1
:
TT1
→
val
)
(
v2
:
TT2
→
val
)
(
v1
:
A
→
val
)
(
v2
:
B
→
val
)
(
P1
:
TT1
→
iProp
Σ
)
(
P2
:
TT2
→
iProp
Σ
)
(
P1
:
A
→
iProp
Σ
)
(
P2
:
B
→
iProp
Σ
)
(
p1
:
TT1
→
iProto
Σ
)
(
p2
:
TT2
→
iProto
Σ
)
:
iProto
Σ
:=
(
p1
:
A
→
iProto
Σ
)
(
p2
:
B
→
iProto
Σ
)
:
iProto
Σ
:=
(
<
a
@
(
tt
:
TT1
+
TT2
)
>
MSG
(
sum_reduce
(
InjLV
∘
v1
)
(
InjRV
∘
v2
)
tt
)
(
<
a
@
(
tt
:
A
+
B
)
>
MSG
(
sum_reduce
(
InjLV
∘
v1
)
(
InjRV
∘
v2
)
tt
)
{{
sum_reduce
P1
P2
tt
}}
;
sum_reduce
p1
p2
tt
)
%
proto
.
{{
sum_reduce
P1
P2
tt
}}
;
sum_reduce
p1
p2
tt
)
%
proto
.
Global
Typeclasses
Opaque
iProto_choice
.
Global
Typeclasses
Opaque
iProto_choice
.
Arguments
iProto_choice
{_
_
_}
_
_
_
_
%
I
_
%
I
_
%
proto
_
%
proto
.
Arguments
iProto_choice
{_
_
_}
_
_
_
_
%
I
_
%
I
_
%
proto
_
%
proto
.
...
@@ -499,34 +499,33 @@ Section channel.
...
@@ -499,34 +499,33 @@ Section channel.
iRewrite
"Hp"
.
iFrame
"#∗"
.
iApply
iProto_le_refl
.
iRewrite
"Hp"
.
iFrame
"#∗"
.
iApply
iProto_le_refl
.
Qed
.
Qed
.
Lemma
iProto_le_select_l
{
TT1
TT2
:
tel
e
}
j
Lemma
iProto_le_select_l
{
A
B
:
Typ
e
}
j
(
v1
:
TT1
→
val
)
(
v2
:
TT2
→
val
)
P1
P2
(
p1
:
TT1
→
iProto
Σ
)
(
p2
:
TT2
→
iProto
Σ
)
:
(
v1
:
A
→
val
)
(
v2
:
B
→
val
)
P1
P2
(
p1
:
A
→
iProto
Σ
)
(
p2
:
B
→
iProto
Σ
)
:
⊢
(
iProto_choice
(
Send
,
j
)
v1
v2
P1
P2
p1
p2
)
⊑
⊢
(
iProto_choice
(
Send
,
j
)
v1
v2
P1
P2
p1
p2
)
⊑
(
<
(
Send
,
j
)
@
..
(
tt
:
TT1
)
>
MSG
(
InjLV
(
v1
tt
))
{{
P1
tt
}}
;
p1
tt
)
.
(
<
(
Send
,
j
)
@
(
tt
:
A
)
>
MSG
(
InjLV
(
v1
tt
))
{{
P1
tt
}}
;
p1
tt
)
.
Proof
.
Proof
.
rewrite
/
iProto_choice
.
rewrite
/
iProto_choice
.
iApply
iProto_le_trans
;
last
first
.
iApply
iProto_le_trans
;
last
first
.
{
iApply
iProto_le_texist_elim_r
.
iIntros
(
x
)
.
iExists
x
.
{
iIntros
(
x
)
.
iExists
x
.
iApply
iProto_le_refl
.
}
iApply
iProto_le_refl
.
}
iIntros
(
tt
)
.
by
iExists
(
inl
tt
)
.
iIntros
(
tt
)
.
by
iExists
(
inl
tt
)
.
Qed
.
Qed
.
Lemma
iProto_le_select_r
{
TT1
TT2
:
tel
e
}
j
Lemma
iProto_le_select_r
{
A
B
:
Typ
e
}
j
(
v1
:
TT1
→
val
)
(
v2
:
TT2
→
val
)
P1
P2
(
p1
:
TT1
→
iProto
Σ
)
(
p2
:
TT2
→
iProto
Σ
)
:
(
v1
:
A
→
val
)
(
v2
:
B
→
val
)
P1
P2
(
p1
:
A
→
iProto
Σ
)
(
p2
:
B
→
iProto
Σ
)
:
⊢
(
iProto_choice
(
Send
,
j
)
v1
v2
P1
P2
p1
p2
)
⊑
⊢
(
iProto_choice
(
Send
,
j
)
v1
v2
P1
P2
p1
p2
)
⊑
(
<
(
Send
,
j
)
@
..
(
tt
:
TT2
)
>
MSG
(
InjRV
(
v2
tt
))
{{
P2
tt
}}
;
p2
tt
)
.
(
<
(
Send
,
j
)
@
(
tt
:
B
)
>
MSG
(
InjRV
(
v2
tt
))
{{
P2
tt
}}
;
p2
tt
)
.
Proof
.
Proof
.
rewrite
/
iProto_choice
.
rewrite
/
iProto_choice
.
iApply
iProto_le_trans
;
last
first
.
iApply
iProto_le_trans
;
last
first
.
{
iApply
iProto_le_texist_elim_r
.
iIntros
(
x
)
.
iExists
x
.
{
iIntros
(
x
)
.
iExists
x
.
iApply
iProto_le_refl
.
}
iApply
iProto_le_refl
.
}
iIntros
(
tt
)
.
by
iExists
(
inr
tt
)
.
iIntros
(
tt
)
.
by
iExists
(
inr
tt
)
.
Qed
.
Qed
.
Lemma
select_spec_tele
{
TT1
TT2
:
tele
}
(
tt
:
TT1
+
TT2
)
c
j
Lemma
select_spec
{
A
B
:
Type
}
(
tt
:
A
+
B
)
c
j
(
v1
:
TT1
→
val
)
(
v2
:
TT2
→
val
)
P1
P2
(
p1
:
TT1
→
iProto
Σ
)
(
p2
:
TT2
→
iProto
Σ
)
:
(
v1
:
A
→
val
)
(
v2
:
B
→
val
)
P1
P2
(
p1
:
A
→
iProto
Σ
)
(
p2
:
B
→
iProto
Σ
)
:
{{{
c
↣
(
iProto_choice
(
Send
,
j
)
v1
v2
P1
P2
p1
p2
)
∗
{{{
c
↣
(
iProto_choice
(
Send
,
j
)
v1
v2
P1
P2
p1
p2
)
∗
sum_reduce
P1
P2
tt
}}}
sum_reduce
P1
P2
tt
}}}
send
c
#
j
(
Val
(
sum_reduce
(
InjLV
∘
v1
)
(
InjRV
∘
v2
)
tt
))
send
c
#
j
(
Val
(
sum_reduce
(
InjLV
∘
v1
)
(
InjRV
∘
v2
)
tt
))
{{{
RET
#
();
c
↣
(
sum_reduce
p1
p2
tt
)
}}}
.
{{{
RET
#
();
c
↣
(
sum_reduce
p1
p2
tt
)
}}}
.
Proof
.
Proof
.
...
@@ -534,21 +533,57 @@ Section channel.
...
@@ -534,21 +533,57 @@ Section channel.
destruct
tt
.
destruct
tt
.
-
iDestruct
(
iProto_pointsto_le
with
"Hc []"
)
as
"Hc"
.
-
iDestruct
(
iProto_pointsto_le
with
"Hc []"
)
as
"Hc"
.
{
iApply
iProto_le_select_l
.
}
{
iApply
iProto_le_select_l
.
}
simpl
.
iDestruct
(
iProto_pointsto_le
_
_
(
<
(
Send
,
j
)
>
MSG
InjLV
(
v1
a
);
p1
a
)
%
proto
replace
(
InjLV
(
v1
t
))
with
((
InjLV
∘
v1
)
t
)
by
done
.
with
"Hc [HP]"
)
as
"Hc"
.
by
iApply
(
send_spec_tele
with
"[$Hc $HP]"
)
.
{
iIntros
"!>"
.
iExists
a
.
by
iFrame
"HP"
.
}
simpl
.
by
iApply
(
send_spec
with
"Hc"
)
.
-
iDestruct
(
iProto_pointsto_le
with
"Hc []"
)
as
"Hc"
.
-
iDestruct
(
iProto_pointsto_le
with
"Hc []"
)
as
"Hc"
.
{
iApply
iProto_le_select_r
.
}
{
iApply
iProto_le_select_r
.
}
simpl
.
iDestruct
(
iProto_pointsto_le
_
_
(
<
(
Send
,
j
)
>
MSG
InjRV
(
v2
b
);
p2
b
)
%
proto
replace
(
InjRV
(
v2
t
))
with
((
InjRV
∘
v2
)
t
)
by
done
.
with
"Hc [HP]"
)
as
"Hc"
.
by
iApply
(
send_spec_tele
with
"[$Hc $HP]"
)
.
{
iIntros
"!>"
.
iExists
b
.
by
iFrame
"HP"
.
}
simpl
.
by
iApply
(
send_spec
with
"Hc"
)
.
Qed
.
Qed
.
Lemma
branch_spec_tele
{
TT1
TT2
:
tele
}
c
j
(* Lemma select_spec_tele {A B:tele} (tt:A + B) c j *)
(
v1
:
TT1
→
val
)
(
v2
:
TT2
→
val
)
P1
P2
(
p1
:
TT1
→
iProto
Σ
)
(
p2
:
TT2
→
iProto
Σ
)
:
(* (v1 : A → val) (v2 : B → val) P1 P2 (p1 : A → iProto Σ) (p2 : B → iProto Σ) : *)
(* {{{ c ↣ (iProto_choice (Send, j) v1 v2 P1 P2 p1 p2) ∗ sum_reduce P1 P2 tt }}} *)
(* send c #j (Val (sum_reduce (InjLV ∘ v1) (InjRV ∘ v2) tt)) *)
(* {{{ RET #(); c ↣ (sum_reduce p1 p2 tt) }}}. *)
(* Proof. *)
(* iIntros (Φ) "[Hc HP] HΦ". *)
(* destruct tt. *)
(* - iDestruct (iProto_pointsto_le with "Hc []") as "Hc". *)
(* { iApply iProto_le_select_l. } *)
(* simpl. *)
(* replace (InjLV (v1 t)) with ((InjLV ∘ v1) t) by done. *)
(* by iApply (send_spec_tele with "[$Hc $HP]"). *)
(* - iDestruct (iProto_pointsto_le with "Hc []") as "Hc". *)
(* { iApply iProto_le_select_r. } *)
(* simpl. *)
(* replace (InjRV (v2 t)) with ((InjRV ∘ v2) t) by done. *)
(* by iApply (send_spec_tele with "[$Hc $HP]"). *)
(* Qed. *)
Lemma
branch_spec
{
A
B
:
Type
}
c
j
(
v1
:
A
→
val
)
(
v2
:
B
→
val
)
P1
P2
(
p1
:
A
→
iProto
Σ
)
(
p2
:
B
→
iProto
Σ
)
:
{{{
c
↣
(
iProto_choice
(
Recv
,
j
)
v1
v2
(
λ
tt
,
▷
P1
tt
)
(
λ
tt
,
▷
P2
tt
)
p1
p2
)
}}}
{{{
c
↣
(
iProto_choice
(
Recv
,
j
)
v1
v2
(
λ
tt
,
▷
P1
tt
)
(
λ
tt
,
▷
P2
tt
)
p1
p2
)
}}}
recv
c
#
j
recv
c
#
j
{{{
(
tt
:
TT1
+
TT2
),
RET
(
sum_reduce
(
InjLV
∘
v1
)
(
InjRV
∘
v2
)
tt
);
{{{
(
tt
:
A
+
B
),
RET
(
sum_reduce
(
InjLV
∘
v1
)
(
InjRV
∘
v2
)
tt
);
c
↣
(
sum_reduce
p1
p2
tt
)
∗
sum_reduce
P1
P2
tt
}}}
.
Proof
.
iIntros
(
Φ
)
"Hc HΦ"
.
iApply
(
recv_spec
with
"[Hc]"
);
[|
iApply
"HΦ"
]
.
iApply
(
iProto_pointsto_le
with
"Hc"
)
.
iIntros
"!>"
.
rewrite
/
iProto_choice
.
iIntros
(
x
)
.
iExists
x
.
by
destruct
x
.
Qed
.
Lemma
branch_spec_tele
{
A
B
:
tele
}
c
j
(
v1
:
A
→
val
)
(
v2
:
B
→
val
)
P1
P2
(
p1
:
A
→
iProto
Σ
)
(
p2
:
B
→
iProto
Σ
)
:
{{{
c
↣
(
iProto_choice
(
Recv
,
j
)
v1
v2
(
λ
tt
,
▷
P1
tt
)
(
λ
tt
,
▷
P2
tt
)
p1
p2
)
}}}
recv
c
#
j
{{{
(
tt
:
A
+
B
),
RET
(
sum_reduce
(
InjLV
∘
v1
)
(
InjRV
∘
v2
)
tt
);
c
↣
(
sum_reduce
p1
p2
tt
)
∗
sum_reduce
P1
P2
tt
}}}
.
c
↣
(
sum_reduce
p1
p2
tt
)
∗
sum_reduce
P1
P2
tt
}}}
.
Proof
.
Proof
.
iIntros
(
Φ
)
"Hc HΦ"
.
iIntros
(
Φ
)
"Hc HΦ"
.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment