-
Notifications
You must be signed in to change notification settings - Fork 1
Add missing proofs of properties of communication primitives #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add missing proofs of properties of communication primitives #23
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This review is about repeated_receive_split
only.
There is a small issue described in a separate comment below, which I’d like you to address.
Beyond that, there is some general issue, which, I think, mandates some more thorough changes of the code. I’d be happy if you could change the code accordingly, after which I’d continue with my reviewing.
The general issue I mean is that, in my opinion, terms like post_receive n X (λx. ∏B ← [A, A]. B ◃ □ x ∥ ¤⇧+ A)
are hard to comprehend. This is because they use post_receive
and ∏
in very concrete ways, so that their use doesn’t make things clearer but rather obscures them. In the case of post_receive
, the received value is always used with □
; in the case of ∏
, the list is always of a fixed size. Some unfolding and streamlining leads to terms like (A « suffix n ◃ X ∥ A « suffix n ◃ X ∥ 𝟬) ∥ ¤⇧+ (A « suffix n)
(my translation of the above term), which are much easier to understand, in my opinion.
I suggest to introduce analogs of transition_from_repeated_receive
for distributor
and its specializations (like duplication
). These lemmas should use easy-to-read terms like the one above. With these lemmas in place, you can then make the proof of repeated_receive_split
more readable.
The general issue mentioned in this comment is fixed in f23b794, please verify. |
When continuing with the reviewing of |
When crafting commit message titles, please try to avoid abbreviations of identifiers, which don’t really work, and put identifiers between backticks; so no “shortcut_redund. of |
The character "_" is a typo, thanks for pointing it out. Nevertheless, I agree with your observation. For this GitHub issue in particular, it doesn't help too much that the issue refers to a bunch of lemmas, which forces me to try to include the respective lemma name in each commit message. I think this is an indicator that perhaps we should have split the issue into several related issues, one for each lemma. |
I’ve been thinking for some time already that we should have made several issues instead of this one. It’s not just about commit message titles, but also about other things, for example reviewing (I’m always reviewing parts and have to keep track what I’ve already reviewed and what not). I think when I created this issue, there was partly some wishful thinking in my mind: I thought that it would be much less work to resolve this issue. |
While thinking more about the Making lemma transition_from_repeated_receive:
assumes "A ▹⇧∞ x. 𝒫 x →⇩s⦇α⦈ Q"
obtains n and X
where "α = A ▹ ⋆⇗n⇖ X" and "Q = post_receive n X 𝒫 ∥ A « suffix n ▹⇧∞ x. 𝒫 x « suffix n" Unfortunately, the term I propose to go for a middle ground: split off the code for the current iteration from the code for the following iterations and possibly simplify the former, but keep lemma transition_from_repeated_receive:
assumes "A ▹⇧∞ x. 𝒫 x →⇩s⦇α⦈ Q"
obtains n and X
where "α = A ▹ ⋆⇗n⇖ X" and "Q = post_receive n X 𝒫 ∥ (A ▹⇧∞ x. 𝒫 x) « suffix n" I already have a patch that not only changes the lemma to this variant, but also accordingly adapts the proofs in If we go for this change, we should also modify the other lemma transition_from_duplication:
assumes "¤⇧+ A →⇩s⦇α⦈ Q"
obtains n and X
where "α = A ▹ ⋆⇗n⇖ X" and "Q = (A « suffix n ◃ X ∥ A « suffix n ◃ X ∥ 𝟬) ∥ ¤⇧+ A « suffix n" What do you think about making these changes? |
I think the solution I proposed above is particularly beautiful in the case of |
Totally agreed. 😃 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started reviewing repeated_receive_split
and have a first idea for improvement, which I’d like to discuss with you.
moreover | ||
have " | ||
A \<guillemotleft> suffix n \<triangleright>\<^sup>\<infinity> x. \<P> x \<guillemotleft> suffix n | ||
\<rightarrow>\<^sub>s\<lparr>A \<guillemotleft> suffix n \<triangleright> \<star>\<^bsup>0\<^esup> X\<rparr> | ||
post_receive 0 X (\<lambda>x. \<P> x \<guillemotleft> suffix n \<parallel> A \<guillemotleft> suffix n \<triangleright>\<^sup>\<infinity> x. \<P> x \<guillemotleft> suffix n)" | ||
using receiving | ||
by (subst repeated_receive_proper_def) | ||
then have " | ||
A \<guillemotleft> suffix n \<triangleright>\<^sup>\<infinity> x. \<P> x \<guillemotleft> suffix n \<parallel> A \<guillemotleft> suffix n \<triangleright>\<^sup>\<infinity> x. \<Q> x \<guillemotleft> suffix n | ||
\<rightarrow>\<^sub>s\<lparr>A \<guillemotleft> suffix n \<triangleright> \<star>\<^bsup>0\<^esup> X\<rparr> | ||
(post_receive 0 X (\<lambda>x. \<P> x \<guillemotleft> suffix n \<parallel> A \<guillemotleft> suffix n \<triangleright>\<^sup>\<infinity> x. \<P> x \<guillemotleft> suffix n)) \<parallel> | ||
A \<guillemotleft> suffix n \<triangleright>\<^sup>\<infinity> x. \<Q> x \<guillemotleft> suffix n" | ||
using parallel_left_io [where n = 0] | ||
by (transfer, simp) | ||
ultimately have " | ||
((A \<guillemotleft> suffix n \<triangleleft> X \<parallel> A \<guillemotleft> suffix n \<triangleleft> X \<parallel> \<zero>) \<parallel> \<currency>\<^sup>+ A \<guillemotleft> suffix n) \<parallel> | ||
(A \<guillemotleft> suffix n \<triangleright>\<^sup>\<infinity> x. \<P> x \<guillemotleft> suffix n \<parallel> A \<guillemotleft> suffix n \<triangleright>\<^sup>\<infinity> x. \<Q> x \<guillemotleft> suffix n) | ||
\<rightarrow>\<^sub>s\<lparr>\<tau>\<rparr> | ||
((\<zero> \<parallel> A \<guillemotleft> suffix n \<triangleleft> X \<parallel> \<zero>) \<parallel> \<currency>\<^sup>+ A \<guillemotleft> suffix n) \<parallel> | ||
((post_receive 0 X (\<lambda>x. \<P> x \<guillemotleft> suffix n \<parallel> A \<guillemotleft> suffix n \<triangleright>\<^sup>\<infinity> x. \<P> x \<guillemotleft> suffix n)) \<parallel> | ||
A \<guillemotleft> suffix n \<triangleright>\<^sup>\<infinity> x. \<Q> x \<guillemotleft> suffix n)" | ||
using communication [where n = 0] | ||
by fastforce | ||
then have " | ||
((A \<guillemotleft> suffix n \<triangleleft> X \<parallel> A \<guillemotleft> suffix n \<triangleleft> X \<parallel> \<zero>) \<parallel> \<currency>\<^sup>+ A \<guillemotleft> suffix n) \<parallel> | ||
(A \<guillemotleft> suffix n \<triangleright>\<^sup>\<infinity> x. \<P> x \<guillemotleft> suffix n \<parallel> A \<guillemotleft> suffix n \<triangleright>\<^sup>\<infinity> x. \<Q> x \<guillemotleft> suffix n) | ||
\<rightarrow>\<^sub>s\<lparr>\<tau>\<rparr> | ||
((\<zero> \<parallel> A \<guillemotleft> suffix n \<triangleleft> X \<parallel> \<zero>) \<parallel> \<currency>\<^sup>+ A \<guillemotleft> suffix n) \<parallel> | ||
((post_receive n X \<P> \<parallel> A \<guillemotleft> suffix n \<triangleright>\<^sup>\<infinity> x. \<P> x \<guillemotleft> suffix n) \<parallel> | ||
A \<guillemotleft> suffix n \<triangleright>\<^sup>\<infinity> x. \<Q> x \<guillemotleft> suffix n)" | ||
unfolding post_receive_def | ||
by (transfer, simp) | ||
then show ?thesis . | ||
qed | ||
moreover | ||
have " | ||
((\<zero> \<parallel> A \<guillemotleft> suffix n \<triangleleft> X \<parallel> \<zero>) \<parallel> \<currency>\<^sup>+ A \<guillemotleft> suffix n) \<parallel> | ||
((post_receive n X \<P> \<parallel> A \<guillemotleft> suffix n \<triangleright>\<^sup>\<infinity> x. \<P> x \<guillemotleft> suffix n) \<parallel> | ||
A \<guillemotleft> suffix n \<triangleright>\<^sup>\<infinity> x. \<Q> x \<guillemotleft> suffix n) | ||
\<rightarrow>\<^sub>s\<lparr>\<tau>\<rparr> | ||
((\<zero> \<parallel> \<zero> \<parallel> \<zero>) \<parallel> \<currency>\<^sup>+ A \<guillemotleft> suffix n) \<parallel> | ||
((post_receive n X \<P> \<parallel> A \<guillemotleft> suffix n \<triangleright>\<^sup>\<infinity> x. \<P> x \<guillemotleft> suffix n) \<parallel> | ||
(post_receive n X \<Q> \<parallel> A \<guillemotleft> suffix n \<triangleright>\<^sup>\<infinity> x. \<Q> x \<guillemotleft> suffix n))" | ||
proof - | ||
have "A \<guillemotleft> suffix n \<triangleleft> X \<rightarrow>\<^sub>s\<lparr>A \<guillemotleft> suffix n \<triangleleft> \<star>\<^bsup>0\<^esup> X\<rparr> \<zero>" | ||
by (fact sending) | ||
then have " | ||
A \<guillemotleft> suffix n \<triangleleft> X \<parallel> \<zero> \<rightarrow>\<^sub>s\<lparr>A \<guillemotleft> suffix n \<triangleleft> \<star>\<^bsup>0\<^esup> X\<rparr> \<zero> \<parallel> \<zero>" | ||
using parallel_left_io | ||
by (transfer, simp) | ||
then have " | ||
\<zero> \<parallel> A \<guillemotleft> suffix n \<triangleleft> X \<parallel> \<zero> \<rightarrow>\<^sub>s\<lparr>A \<guillemotleft> suffix n \<triangleleft> \<star>\<^bsup>0\<^esup> X\<rparr> \<zero> \<parallel> \<zero> \<parallel> \<zero>" | ||
using synchronous_transition.parallel_right_io | ||
by (transfer, simp) | ||
then have " | ||
(\<zero> \<parallel> A \<guillemotleft> suffix n \<triangleleft> X \<parallel> \<zero>) \<parallel> \<currency>\<^sup>+ A \<guillemotleft> suffix n | ||
\<rightarrow>\<^sub>s\<lparr>A \<guillemotleft> suffix n \<triangleleft> \<star>\<^bsup>0\<^esup> X\<rparr> | ||
(\<zero> \<parallel> \<zero> \<parallel> \<zero>) \<parallel> \<currency>\<^sup>+ A \<guillemotleft> suffix n" | ||
using parallel_left_io [where n = 0] | ||
by (transfer, simp) | ||
moreover | ||
have " | ||
A \<guillemotleft> suffix n \<triangleright>\<^sup>\<infinity> x. \<Q> x \<guillemotleft> suffix n | ||
\<rightarrow>\<^sub>s\<lparr>A \<guillemotleft> suffix n \<triangleright> \<star>\<^bsup>0\<^esup> X\<rparr> | ||
post_receive 0 X (\<lambda>x. \<Q> x \<guillemotleft> suffix n \<parallel> A \<guillemotleft> suffix n \<triangleright>\<^sup>\<infinity> x. \<Q> x \<guillemotleft> suffix n)" | ||
using receiving | ||
by (subst repeated_receive_proper_def) | ||
then have " | ||
(post_receive n X \<P> \<parallel> A \<guillemotleft> suffix n \<triangleright>\<^sup>\<infinity> x. \<P> x \<guillemotleft> suffix n) \<parallel> | ||
A \<guillemotleft> suffix n \<triangleright>\<^sup>\<infinity> x. \<Q> x \<guillemotleft> suffix n | ||
\<rightarrow>\<^sub>s\<lparr>A \<guillemotleft> suffix n \<triangleright> \<star>\<^bsup>0\<^esup> X\<rparr> | ||
(post_receive n X \<P> \<parallel> A \<guillemotleft> suffix n \<triangleright>\<^sup>\<infinity> x. \<P> x \<guillemotleft> suffix n) \<parallel> | ||
post_receive 0 X (\<lambda>x. \<Q> x \<guillemotleft> suffix n \<parallel> A \<guillemotleft> suffix n \<triangleright>\<^sup>\<infinity> x. \<Q> x \<guillemotleft> suffix n)" | ||
using synchronous_transition.parallel_right_io [where n = 0] | ||
by (transfer, simp) | ||
ultimately have " | ||
((\<zero> \<parallel> A \<guillemotleft> suffix n \<triangleleft> X \<parallel> \<zero>) \<parallel> \<currency>\<^sup>+ A \<guillemotleft> suffix n) \<parallel> | ||
((post_receive n X \<P> \<parallel> A \<guillemotleft> suffix n \<triangleright>\<^sup>\<infinity> x. \<P> x \<guillemotleft> suffix n) \<parallel> | ||
A \<guillemotleft> suffix n \<triangleright>\<^sup>\<infinity> x. \<Q> x \<guillemotleft> suffix n) | ||
\<rightarrow>\<^sub>s\<lparr>\<tau>\<rparr> | ||
((\<zero> \<parallel> \<zero> \<parallel> \<zero>) \<parallel> \<currency>\<^sup>+ A \<guillemotleft> suffix n) \<parallel> | ||
((post_receive n X \<P> \<parallel> A \<guillemotleft> suffix n \<triangleright>\<^sup>\<infinity> x. \<P> x \<guillemotleft> suffix n) \<parallel> | ||
post_receive 0 X (\<lambda>x. \<Q> x \<guillemotleft> suffix n \<parallel> A \<guillemotleft> suffix n \<triangleright>\<^sup>\<infinity> x. \<Q> x \<guillemotleft> suffix n))" | ||
using communication | ||
by fastforce | ||
then have " | ||
((\<zero> \<parallel> (A \<guillemotleft> suffix n) \<triangleleft> X \<parallel> \<zero>) \<parallel> \<currency>\<^sup>+ A \<guillemotleft> suffix n) \<parallel> | ||
((post_receive n X \<P> \<parallel> A \<guillemotleft> suffix n \<triangleright>\<^sup>\<infinity> x. \<P> x \<guillemotleft> suffix n) \<parallel> | ||
A \<guillemotleft> suffix n \<triangleright>\<^sup>\<infinity> x. \<Q> x \<guillemotleft> suffix n) | ||
\<rightarrow>\<^sub>s\<lparr>\<tau>\<rparr> | ||
((\<zero> \<parallel> \<zero> \<parallel> \<zero>) \<parallel> \<currency>\<^sup>+ A \<guillemotleft> suffix n) \<parallel> | ||
((post_receive n X \<P> \<parallel> A \<guillemotleft> suffix n \<triangleright>\<^sup>\<infinity> x. \<P> x \<guillemotleft> suffix n) \<parallel> | ||
(post_receive n X \<Q> \<parallel> A \<guillemotleft> suffix n \<triangleright>\<^sup>\<infinity> x. \<Q> x \<guillemotleft> suffix n))" | ||
unfolding post_receive_def | ||
by (transfer, simp) | ||
then show ?thesis . | ||
qed | ||
ultimately show ?thesis | ||
by (simp, blast intro: rtranclp_trans) | ||
qed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The statement you prove here is a bit more complex than needed and, most importantly, its proof is very long, which makes it a bit intimidating and not so easy to follow. I came up with an alternative solution, in particular a greatly simplified proof.
My simplification relies on a few general lemmas, which we might want to add to the Þ-calculus:
lemma no_mobility_communication:
assumes "η ≠ μ" and "P →⇩s⦇IO η A 0 X⦈ P'" and "Q →⇩s⦇IO μ A 0 X⦈ Q'"
shows "P ∥ Q →⇩s⦇τ⦈ P' ∥ Q'"
using communication [where n = 0] and assms
unfolding funpow_0 .
lemma no_mobility_parallel_left_io:
assumes "P →⇩s⦇IO η A 0 X⦈ P'"
shows "P ∥ Q →⇩s⦇IO η A 0 X⦈ P' ∥ Q"
using parallel_left_io [where n = 0] and assms
by transfer simp
lemma no_mobility_parallel_right_io:
assumes "Q →⇩s⦇IO η A 0 X⦈ Q'"
shows "P ∥ Q →⇩s⦇IO η A 0 X⦈ P ∥ Q'"
using parallel_right_io [where n = 0] and assms
by transfer simp
Furthermore, my simplification introduces the following lemma, which we probably should keep private:
lemma adapted_repeated_receive_no_mobility_transition:
shows "
(A ▹⇧∞ x. 𝒫 x) « suffix n
→⇩s⦇A « suffix n ▹ ⋆⇗0⇖ X⦈
post_receive n X 𝒫 ∥ (A ▹⇧∞ x. 𝒫 x) « suffix n"
unfolding adapted_after_repeated_receive
using repeated_receive_transition [where 𝒫 = "λx. 𝒫 x « suffix n" and n = 0]
unfolding post_receive_def
by transfer force
With these preliminaries sorted out, the above code could be replaced by the following one:
have "
¤⇧+ A ∥ A ▹⇧∞ x. 𝒫 x ∥ A ▹⇧∞ x. 𝒬 x
⇒⇩s⦇A ▹ ⋆⇗n⇖ X⦈
((𝟬 ∥ 𝟬 ∥ 𝟬) ∥ ¤⇧+ A « suffix n) ∥
(post_receive n X 𝒫 ∥ (A ▹⇧∞ x. 𝒫 x) « suffix n) ∥
(post_receive n X 𝒬 ∥ (A ▹⇧∞ x. 𝒬 x) « suffix n)"
proof -
have "
¤⇧+ A ∥ A ▹⇧∞ x. 𝒫 x ∥ A ▹⇧∞ x. 𝒬 x
→⇩s⦇A ▹ ⋆⇗n⇖ X⦈
((A « suffix n ◃ X ∥ A « suffix n ◃ X ∥ 𝟬) ∥ ¤⇧+ A « suffix n) ∥
(A ▹⇧∞ x. 𝒫 x) « suffix n ∥ (A ▹⇧∞ x. 𝒬 x) « suffix n"
unfolding adapted_after_parallel [symmetric]
by (intro duplication_transition parallel_left_io)
moreover have "… →⇩s⦇τ⦈
((𝟬 ∥ A « suffix n ◃ X ∥ 𝟬) ∥ ¤⇧+ A « suffix n) ∥
(post_receive n X 𝒫 ∥ (A ▹⇧∞ x. 𝒫 x) « suffix n) ∥ (A ▹⇧∞ x. 𝒬 x) « suffix n"
by
(fast intro:
no_mobility_communication
no_mobility_parallel_left_io
sending
adapted_repeated_receive_no_mobility_transition
)
moreover have "… →⇩s⦇τ⦈
((𝟬 ∥ 𝟬 ∥ 𝟬) ∥ ¤⇧+ A « suffix n) ∥
(post_receive n X 𝒫 ∥ (A ▹⇧∞ x. 𝒫 x) « suffix n) ∥
(post_receive n X 𝒬 ∥ (A ▹⇧∞ x. 𝒬 x) « suffix n)"
by
(fast intro:
no_mobility_communication
no_mobility_parallel_left_io
no_mobility_parallel_right_io
sending
adapted_repeated_receive_no_mobility_transition
)
ultimately show ?thesis
by force
qed
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, by employing is
, the code can still be shrunk a bit: 😁
have "
¤⇧+ A ∥ A ▹⇧∞ x. 𝒫 x ∥ A ▹⇧∞ x. 𝒬 x
⇒⇩s⦇A ▹ ⋆⇗n⇖ X⦈
((𝟬 ∥ 𝟬 ∥ 𝟬) ∥ ¤⇧+ A « suffix n) ∥
(post_receive n X 𝒫 ∥ (A ▹⇧∞ x. 𝒫 x) « suffix n) ∥
(post_receive n X 𝒬 ∥ (A ▹⇧∞ x. 𝒬 x) « suffix n)"
(is "?T ⇒⇩s⦇_⦈ ?U")
proof -
have "?T →⇩s⦇A ▹ ⋆⇗n⇖ X⦈
((A « suffix n ◃ X ∥ A « suffix n ◃ X ∥ 𝟬) ∥ ¤⇧+ A « suffix n) ∥
(A ▹⇧∞ x. 𝒫 x) « suffix n ∥ (A ▹⇧∞ x. 𝒬 x) « suffix n"
unfolding adapted_after_parallel [symmetric]
by (intro duplication_transition parallel_left_io)
moreover have "… →⇩s⦇τ⦈
((𝟬 ∥ A « suffix n ◃ X ∥ 𝟬) ∥ ¤⇧+ A « suffix n) ∥
(post_receive n X 𝒫 ∥ (A ▹⇧∞ x. 𝒫 x) « suffix n) ∥ (A ▹⇧∞ x. 𝒬 x) « suffix n"
by
(fast intro:
no_mobility_communication
no_mobility_parallel_left_io
sending
adapted_repeated_receive_no_mobility_transition
)
moreover have "… →⇩s⦇τ⦈ ?U"
by
(fast intro:
no_mobility_communication
no_mobility_parallel_left_io
no_mobility_parallel_right_io
sending
adapted_repeated_receive_no_mobility_transition
)
ultimately show ?thesis
by force
qed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, in other bisimilarity proofs, we were rather explicit when it came to constructing transitions. Your current proof above could be seen as following that style. However, I think what worked with very simple constructions does not work well with this more complex construction: while the reader is taken by the hand and led step by step through the construction, he might lose track, because it’s difficult to get a good overview of the construction due to its complexity. I think it’s better to have a concise proof that makes it easy to see how the construction works on the whole and still doesn’t make it too complicated to figure out how the individual steps can be justified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should implement this simplification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, although much shorter, I'm not yet so convinced that bundling the application of three transition rules such as sending
, parallel_left_io
and communication
plus a pseudo-transition rule such as adapted_repeated_receive_no_mobility_transition
into a single proof step actually improves readability. 🤔.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least, we say in the proof method expression that we use adapted_repeated_receive_no_mobility_transition
, as well as sending
and communication
. As a result, the reader can at least figure out with reasonable effort what’s going on. I’d say making a sending
and a receiving
transition on arbitrarily deep subprocesses and combining them with communication
is a quite natural thing for someone used to process calculi. Therefore, the only real issue I see is the use of the non-standard adapted_receive_no_mobility_transition
, but at least this would have been introduced immediately before repeated_receive_split
.
I think there are two competing effects at play here:
- More detailed proofs make the entire construction explicit and this way aid understanding.
- More concise proofs make the overall structure of the construction clearer and this way aid understanding.
I think the importance of the second point varies greatly with the complexity of the construction: while for simple constructions, like combining receive
with parallel_left_io
, it is of virtually no relevance, it is of considerable importance for constructions like the one we’re talking about here. Therefore, I’d say for simple constructions it is not so clear whether being concise is better or not, but it is rather clear that it is better for complex constructions.
Let’s go for this concise version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The no-mobility versions of transition system rules that the concise version uses have been introduced by input-output-hk/thorn-calculus#71 now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please note that the PR mentioned above has already been accepted.
Could you please make all |
Done in e085e35, please review. |
Two initial requests:
|
If I do that then the current proof of |
Fixed in e45125d, please verify. |
After some thinking, I realized that, for the sake of consistency with respect to the other |
The proof of |
I just looked at the old code, which is as follows: lemma distributor_transition:
shows "A ⇒ Bs →⇩s⦇A ▹ ⋆⇗n⇖ X⦈ ∏B ← Bs. B « suffix n ◃ X ∥ (A ⇒ Bs) « suffix n"
proof -
have "A ⇒ Bs →⇩s⦇A ▹ ⋆⇗n⇖ X⦈ post_receive n X (λx. ∏B ← Bs. B ◃ □ x ∥ A ⇒ Bs)"
unfolding distributor_def
using receiving
by (subst repeated_receive_proper_def)
then show ?thesis
by (elim transition_from_distributor, auto simp only:)
qed I understand now how you use |
Now, the new proof of
You can construct an initial transition using lemma distributor_transition:
shows "A ⇒ Bs →⇩s⦇A ▹ ⋆⇗n⇖ X⦈ ∏B ← Bs. B « suffix n ◃ X ∥ (A ⇒ Bs) « suffix n"
proof -
have "A ⇒ Bs →⇩s⦇A ▹ ⋆⇗n⇖ X⦈ post_receive n X (λx. ∏B ← Bs. B ◃ □ x ∥ A ⇒ Bs)"
unfolding distributor_def
using receiving
by (subst repeated_receive_proper_def)
then show ?thesis
by (elim transition_from_distributor, auto simp only:)
qed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have reviewed the _transition
lemmas and have some requests for changes.
@@ -91,6 +675,40 @@ lemma adapted_after_duploss: | |||
shows "\<currency>\<^sup>* A \<guillemotleft> \<E> = \<currency>\<^sup>* (A \<guillemotleft> \<E>)" | |||
by (simp only: duploss_def adapted_after_parallel adapted_after_loss adapted_after_duplication) | |||
|
|||
lemma duploss_losing_transition: | |||
shows "\<currency>\<^sup>* A \<rightarrow>\<^sub>s\<lparr>A \<triangleright> \<star>\<^bsup>n\<^esup> X\<rparr> (\<zero> \<parallel> \<currency>\<^sup>? A \<guillemotleft> suffix n) \<parallel> \<currency>\<^sup>+ A \<guillemotleft> suffix n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The statement of this lemma should be ¤⇧* A →⇩s⦇A ▹ ⋆⇗n⇖ X⦈ 𝟬 ∥ ¤⇧* A « suffix n
, for the following reasons:
- All our previous
_transition
andtransition_from_
lemmas use transitions of the formP →⦇α⦈ T ∥ P
. - All our previous
_transition
lemmas use the target process families that are used by their correspondingtransition_from_
lemmas.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem I see is that the process families (𝟬 ∥ ¤⇧? A « suffix n) ∥ ¤⇧+ A « suffix n
and 𝟬 ∥ ¤⇧* A « suffix n
are not equal but bisimilar (since an application of parallel_associativity
would be needed). Therefore, I think that, in line with what we did for transition_from_duploss
, the statement of this lemma should be as follows:
lemma duploss_losing_transition:
obtains Q where "¤⇧* A →⇩s⦇A ▹ ⋆⇗n⇖ X⦈ Q" and "Q ∼⇩s 𝟬 ∥ ¤⇧* A « suffix n"
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this would be the obvious choice. The question is whether this would make the proofs that use these lemmas more complicated. Are we using these lemmas somewhere at the moment, and, if yes, do we rely on them stating just a plain transition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found two uses of these lemmas: in line 1254 and in line 1575. For the former, things might get more complex in a sense, because we would have to perform a simulation step to show that the follow-up transition we construct has a counterpart that starts at Q
. The same applies in principle also to the latter, but there we have currently quite some follow-up reasoning with that complex term ?T
, which might get considerably simplified if we turned to the new versions of those lemmas.
What do you think? Should we make the change you proposed and see where it leads us? If in some particular situation we find that this makes matters more complicated, we could still unfold duploss
or bidirectional_bridge
on the spot and reason with the _transition
lemmas for the underlying constructs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that makes much sense and we should go for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Please make the necessary changes then. I’d like to encourage you to use the reworked lemmas wherever somehow feasible instead of going for the unfolding solution. It’s more high-level and thus should make the proofs cleaner and more understandable in general.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lemma duploss_losing_transition: obtains Q where "¤⇧* A →⇩s⦇A ▹ ⋆⇗n⇖ X⦈ Q" and "Q ∼⇩s 𝟬 ∥ ¤⇧* A « suffix n"
Actually, I think the two statements after where
should be swapped, because, as far as I remember, we typically first say what the obtained variables are about.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, on the other hand, as it is now, the statement reads more naturally. Also, in contrast to, say, the transition_from_
lemmas, this lemma doesn’t tell us anything about variables used in some assumption. Maybe we should leave the statement as written above.
\<currency>\<^sup>* A | ||
\<rightarrow>\<^sub>s\<lparr>A \<triangleright> \<star>\<^bsup>n\<^esup> X\<rparr> | ||
\<currency>\<^sup>? A \<guillemotleft> suffix n \<parallel> (A \<guillemotleft> suffix n \<triangleleft> X \<parallel> A \<guillemotleft> suffix n \<triangleleft> X \<parallel> \<zero>) \<parallel> \<currency>\<^sup>+ A \<guillemotleft> suffix n" | ||
unfolding duploss_def |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The statement of this lemma should be ¤⇧* A →⇩s⦇A ▹ ⋆⇗n⇖ X⦈ (A « suffix n ◃ X ∥ A « suffix n ◃ X ∥ 𝟬) ∥ ¤⇧* A « suffix n
, for the reasons stated above.
@@ -242,6 +1339,37 @@ lemma adapted_after_bidirectional_bridge: | |||
shows "(A \<leftrightarrow> B) \<guillemotleft> \<E> = A \<guillemotleft> \<E> \<leftrightarrow> B \<guillemotleft> \<E>" | |||
by (simp only: bidirectional_bridge_def adapted_after_parallel adapted_after_unidirectional_bridge) | |||
|
|||
lemma bidirectional_bridge_forward_transition: | |||
shows "A \<leftrightarrow> B \<rightarrow>\<^sub>s\<lparr>A \<triangleright> \<star>\<^bsup>n\<^esup> X\<rparr> ((B \<guillemotleft> suffix n \<triangleleft> X \<parallel> \<zero>) \<parallel> (A \<rightarrow> B) \<guillemotleft> suffix n) \<parallel> (B \<rightarrow> A) \<guillemotleft> suffix n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The statement of this lemma should be A ↔ B →⇩s⦇A ▹ ⋆⇗n⇖ X⦈ (B « suffix n ◃ X ∥ 𝟬) ∥ (A ↔ B) « suffix n
, for the reasons stated above.
by (intro unidirectional_bridge_transition parallel_left_io) | ||
|
||
lemma bidirectional_bridge_backward_transition: | ||
shows "A \<leftrightarrow> B \<rightarrow>\<^sub>s\<lparr>B \<triangleright> \<star>\<^bsup>n\<^esup> X\<rparr> (A \<rightarrow> B) \<guillemotleft> suffix n \<parallel> ((A \<guillemotleft> suffix n \<triangleleft> X \<parallel> \<zero>) \<parallel> (B \<rightarrow> A) \<guillemotleft> suffix n)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The statement of this lemma should be A ↔ B →⇩s⦇B ▹ ⋆⇗n⇖ X⦈ (A « suffix n ◃ X ∥ 𝟬) ∥ (A ↔ B) « suffix n
, for the reasons stated above.
I was implementing this and came across the following issue: Since |
Hi, @javierdiaz72! What is 98edc9b about? Did you accidentally delete |
You’re absolutely right: we get a weak transition; so the only way to kind of save my approach would be to analyze this weak transition, which would be too involved. However, I just thought a bit about an alternative and came up with the following solution:
What do you think about this approach? Do you think it would be at least a bit simpler that proving |
I'm not sure what happened, it seems to me that I accidentally left out |
The problem I see with this approach is that in step (iv) we should use the function |
Oh, no: yet another of these easy-to-overlook issues that make the whole approach fail. 😓 Did you spot this issue while trying to write the proof in Isabelle, or did you spot it beforehand? What do you think: should we just go for a traditional transition level proof, without any reuse of |
I spot it when writing down a "proof sketch" using some Isabelle syntax and then checked it directly in Isabelle. 😁
Honestly, I don't have any idea how to reuse |
The only potentially better approach I can come up with at the moment is to prove a lemma that is generic in the “up to” method and then derive from it both |
This will ultimately resolve #3.