From 9d2a5a5d549e544d10a1d3c58de1c187e4c2b09a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20D=C3=ADaz?= Date: Fri, 2 Dec 2022 16:48:17 -0300 Subject: [PATCH] Adapt the code to the changes in `thorn-calculus` --- src/Network_Equivalences-Communication.thy | 124 ++++++++------------- 1 file changed, 49 insertions(+), 75 deletions(-) diff --git a/src/Network_Equivalences-Communication.thy b/src/Network_Equivalences-Communication.thy index fc1e898..c876cbb 100644 --- a/src/Network_Equivalences-Communication.thy +++ b/src/Network_Equivalences-Communication.thy @@ -21,7 +21,8 @@ lemma transition_from_distributor: and "Q = \B \ Bs. B \ suffix n \ X \ A \ suffix n \ map (\B. B \ suffix n) Bs" proof - - obtain n X where "\ = A \ \\<^bsup>n\<^esup> X" and "Q = post_receive n X (\x. \B \ Bs. B \ \ x \ A \ Bs)" + obtain n and X + where "\ = A \ \\<^bsup>n\<^esup> X" and "Q = post_receive n X (\x. \B \ Bs. B \ \ x) \ (A \ Bs) \ suffix n" unfolding distributor_def using assms by (fastforce elim: transition_from_repeated_receive) @@ -188,18 +189,18 @@ proof (coinduction rule: synchronous.mixed.up_to_rule [where \ = "[\\<^s and "A' = A" and - "Q = post_receive n X (\x. (\

x \ \ x) \ A \\<^sup>\ x. (\

x \ \ x))" + "Q = post_receive n X (\x. \

x \ \ x) \ (A \\<^sup>\ x. (\

x \ \ x)) \ suffix n" by (auto elim: transition_from_repeated_receive) with \A \\<^sup>\ x. (\

x \ \ x) \\<^sub>s\IO \ A' n X\ Q\ have " A \\<^sup>\ x. (\

x \ \ x) \\<^sub>s\A \ \\<^bsup>n\<^esup> X\ - post_receive n X (\x. (\

x \ \ x) \ A \\<^sup>\ x. (\

x \ \ x))" + post_receive n X (\x. \

x \ \ x) \ (A \\<^sup>\ x. (\

x \ \ x)) \ suffix n" by (simp only:) then have " \\<^sup>+ A \ A \\<^sup>\ x. (\

x \ \ x) \\<^sub>s\A \ \\<^bsup>n\<^esup> X\ - \\<^sup>+ A \ suffix n \ post_receive n X (\x. (\

x \ \ x) \ A \\<^sup>\ x. (\

x \ \ x))" + \\<^sup>+ A \ suffix n \ post_receive n X (\x. \

x \ \ x) \ (A \\<^sup>\ x. (\

x \ \ x)) \ suffix n" by (fact synchronous_transition.parallel_right_io) moreover have " @@ -408,7 +409,7 @@ proof (coinduction rule: synchronous.mixed.up_to_rule [where \ = "[\\<^s and \A' = A\ and - \Q = post_receive n X (\x. (\

x \ \ x) \ A \\<^sup>\ x. (\

x \ \ x))\ + \Q = post_receive n X (\x. \

x \ \ x) \ (A \\<^sup>\ x. (\

x \ \ x)) \ suffix n\ using composition_in_universe [OF suffix_adapted_mutation_in_universe parallel_mutation_in_universe] @@ -487,44 +488,29 @@ next and "A' = A" and - "R = post_receive n X (\x. \

x \ A \\<^sup>\ x. \

x)" + "R = post_receive n X \

\ (A \\<^sup>\ x. \

x) \ suffix n" by (auto elim: transition_from_repeated_receive) with \A \\<^sup>\ x. \

x \\<^sub>s\IO \ A' n X\ R\ - have " - A \\<^sup>\ x. \

x - \\<^sub>s\A \ \\<^bsup>n\<^esup> X\ - post_receive n X (\x. \

x \ A \\<^sup>\ x. \

x)" + have "A \\<^sup>\ x. \

x \\<^sub>s\A \ \\<^bsup>n\<^esup> X\ post_receive n X \

\ (A \\<^sup>\ x. \

x) \ suffix n" by (simp only:) then have " A \\<^sup>\ x. \

x \ A \\<^sup>\ x. \ x \\<^sub>s\A \ \\<^bsup>n\<^esup> X\ - post_receive n X (\x. \

x \ A \\<^sup>\ x. \

x) \ (A \\<^sup>\ x. \ x) \ suffix n" + (post_receive n X \

\ (A \\<^sup>\ x. \

x) \ suffix n) \ (A \\<^sup>\ x. \ x) \ suffix n" by (fact synchronous_transition.parallel_left_io) then have " \\<^sup>+ A \ A \\<^sup>\ x. \

x \ A \\<^sup>\ x. \ x \\<^sub>s\A \ \\<^bsup>n\<^esup> X\ - \\<^sup>+ A \ suffix n \ post_receive n X (\x. \

x \ A \\<^sup>\ x. \

x) \ (A \\<^sup>\ x. \ x) \ suffix n" + \\<^sup>+ A \ suffix n \ (post_receive n X \

\ (A \\<^sup>\ x. \

x) \ suffix n) \ (A \\<^sup>\ x. \ x) \ suffix n" by (fact synchronous_transition.parallel_right_io) moreover have " post_receive n X \

\ (\\<^sup>+ A \ A \\<^sup>\ x. \

x \ A \\<^sup>\ x. \ x) \ suffix n \\<^sub>s - \\<^sup>+ A \ suffix n \ post_receive n X (\x. \

x \ A \\<^sup>\ x. \

x) \ (A \\<^sup>\ x. \ x) \ suffix n" - proof - - have " - post_receive n X \

\ (\\<^sup>+ A \ A \\<^sup>\ x. \

x \ A \\<^sup>\ x. \ x) \ suffix n - = - post_receive n X \

\ \\<^sup>+ A \ suffix n \ (A \\<^sup>\ x. \

x) \ suffix n \ (A \\<^sup>\ x. \ x) \ suffix n" - unfolding adapted_after_parallel .. - also have "\ \\<^sub>s - \\<^sup>+ A \ suffix n \ (post_receive n X \

\ (A \\<^sup>\ x. \

x) \ suffix n) \ (A \\<^sup>\ x. \ x) \ suffix n" - using thorn_simps - by equivalence - also have "\ = - \\<^sup>+ A \ suffix n \ post_receive n X (\x. \

x \ A \\<^sup>\ x. \

x) \ (A \\<^sup>\ x. \ x) \ suffix n" - unfolding post_receive_after_parallel and post_receive_def .. - finally show ?thesis . - qed + \\<^sup>+ A \ suffix n \ (post_receive n X \

\ (A \\<^sup>\ x. \

x) \ suffix n) \ (A \\<^sup>\ x. \ x) \ suffix n" + unfolding adapted_after_parallel + using thorn_simps + by equivalence moreover have " \\<^sup>+ A \ A \\<^sup>\ x. (\

x \ \ x) @@ -587,7 +573,7 @@ next and \\ = Receiving\ and \A' = A\ and \Q = R \ (A \\<^sup>\ x. \ x) \ suffix n\ and - \R = post_receive n X (\x. \

x \ A \\<^sup>\ x. \

x)\ + \R = post_receive n X \

\ (A \\<^sup>\ x. \

x) \ suffix n\ using composition_in_universe [OF suffix_adapted_mutation_in_universe parallel_mutation_in_universe] @@ -600,41 +586,29 @@ next and "A' = A" and - "R = post_receive n X (\x. \ x \ A \\<^sup>\ x. \ x)" + "R = post_receive n X \ \ (A \\<^sup>\ x. \ x) \ suffix n" by (auto elim: transition_from_repeated_receive) with \A \\<^sup>\ x. \ x \\<^sub>s\IO \ A' n X\ R\ - have "A \\<^sup>\ x. \ x \\<^sub>s\A \ \\<^bsup>n\<^esup> X\ post_receive n X (\x. \ x \ A \\<^sup>\ x. \ x)" + have "A \\<^sup>\ x. \ x \\<^sub>s\A \ \\<^bsup>n\<^esup> X\ post_receive n X \ \ (A \\<^sup>\ x. \ x) \ suffix n" by (simp only:) then have " A \\<^sup>\ x. \

x \ A \\<^sup>\ x. \ x \\<^sub>s\A \ \\<^bsup>n\<^esup> X\ - (A \\<^sup>\ x. \

x) \ suffix n \ post_receive n X (\x. \ x \ A \\<^sup>\ x. \ x)" + (A \\<^sup>\ x. \

x) \ suffix n \ post_receive n X \ \ (A \\<^sup>\ x. \ x) \ suffix n" by (fact synchronous_transition.parallel_right_io) then have " \\<^sup>+ A \ A \\<^sup>\ x. \

x \ A \\<^sup>\ x. \ x \\<^sub>s\A \ \\<^bsup>n\<^esup> X\ - \\<^sup>+ A \ suffix n \ (A \\<^sup>\ x. \

x) \ suffix n \ post_receive n X (\x. \ x \ A \\<^sup>\ x. \ x)" + \\<^sup>+ A \ suffix n \ (A \\<^sup>\ x. \

x) \ suffix n \ post_receive n X \ \ (A \\<^sup>\ x. \ x) \ suffix n" by (fact synchronous_transition.parallel_right_io) moreover have " post_receive n X \ \ (\\<^sup>+ A \ A \\<^sup>\ x. \

x \ A \\<^sup>\ x. \ x) \ suffix n \\<^sub>s - \\<^sup>+ A \ suffix n \ (A \\<^sup>\ x. \

x) \ suffix n \ post_receive n X (\x. \ x \ A \\<^sup>\ x. \ x)" - proof - - have " - post_receive n X \ \ (\\<^sup>+ A \ A \\<^sup>\ x. \

x \ A \\<^sup>\ x. \ x) \ suffix n - = - post_receive n X \ \ \\<^sup>+ A \ suffix n \ (A \\<^sup>\ x. \

x) \ suffix n \ (A \\<^sup>\ x. \ x) \ suffix n" - unfolding adapted_after_parallel .. - also have "\ \\<^sub>s - \\<^sup>+ A \ suffix n \ (A \\<^sup>\ x. \

x) \ suffix n \ (post_receive n X \ \ (A \\<^sup>\ x. \ x) \ suffix n)" - using thorn_simps - by equivalence - also have "\ = - \\<^sup>+ A \ suffix n \ (A \\<^sup>\ x. \

x) \ suffix n \ post_receive n X (\x. \ x \ A \\<^sup>\ x. \ x)" - unfolding post_receive_after_parallel and post_receive_def .. - finally show ?thesis . - qed + \\<^sup>+ A \ suffix n \ (A \\<^sup>\ x. \

x) \ suffix n \ post_receive n X \ \ (A \\<^sup>\ x. \ x) \ suffix n" + unfolding adapted_after_parallel + using thorn_simps + by equivalence moreover have " \\<^sup>+ A \ A \\<^sup>\ x. (\

x \ \ x) @@ -697,7 +671,7 @@ next and \\ = Receiving\ and \A' = A\ and \Q = (A \\<^sup>\ x. \

x) \ suffix n \ R\ and - \R = post_receive n X (\x. \ x \ A \\<^sup>\ x. \ x)\ + \R = post_receive n X \ \ (A \\<^sup>\ x. \ x) \ suffix n\ using composition_in_universe [OF suffix_adapted_mutation_in_universe parallel_mutation_in_universe] @@ -969,34 +943,34 @@ proof (coinduction rule: synchronous.mixed.up_to_rule [where \ = "[\\<^s and "C = B" and - "R = post_receive n X (\x. \

x \ B \\<^sup>\ x. \

x)" + "R = post_receive n X \

\ (B \\<^sup>\ x. \

x) \ suffix n" by (auto elim: transition_from_repeated_receive) with \B \\<^sup>\ x. \

x \\<^sub>s\IO \ C n X\ R\ - have B_transition: "B \\<^sup>\ x. \

x \\<^sub>s\B \ \\<^bsup>n\<^esup> X\ post_receive n X (\x. \

x \ B \\<^sup>\ x. \

x)" + have B_transition: "B \\<^sup>\ x. \

x \\<^sub>s\B \ \\<^bsup>n\<^esup> X\ post_receive n X \

\ (B \\<^sup>\ x. \

x) \ suffix n" by (simp only:) then have " B \\<^sup>\ x. \

x \ A \\<^sup>\ x. \

x \\<^sub>s\B \ \\<^bsup>n\<^esup> X\ - post_receive n X (\x. \

x \ B \\<^sup>\ x. \

x) \ (A \\<^sup>\ x. \

x) \ suffix n" + (post_receive n X \

\ (B \\<^sup>\ x. \

x) \ suffix n) \ (A \\<^sup>\ x. \

x) \ suffix n" by (fact synchronous_transition.parallel_left_io) then have " A \ B \ B \\<^sup>\ x. \

x \ A \\<^sup>\ x. \

x \\<^sub>s\B \ \\<^bsup>n\<^esup> X\ - (A \ B) \ suffix n \ post_receive n X (\x. \

x \ B \\<^sup>\ x. \

x) \ (A \\<^sup>\ x. \

x) \ suffix n" + (A \ B) \ suffix n \ (post_receive n X \

\ (B \\<^sup>\ x. \

x) \ suffix n) \ (A \\<^sup>\ x. \

x) \ suffix n" by (fact synchronous_transition.parallel_right_io) moreover have " - (A \ B) \ suffix n \ post_receive n X (\x. \

x \ B \\<^sup>\ x. \

x) \ (A \\<^sup>\ x. \

x) \ suffix n + (A \ B) \ suffix n \ (post_receive n X \

\ (B \\<^sup>\ x. \

x) \ suffix n) \ (A \\<^sup>\ x. \

x) \ suffix n \\<^sub>s post_receive n X \

\ (A \ B \ B \\<^sup>\ x. \

x \ A \\<^sup>\ x. \

x) \ suffix n" - unfolding post_receive_after_parallel and adapted_after_parallel and post_receive_def + unfolding adapted_after_parallel using thorn_simps by equivalence moreover from B_transition have " A \ B \ B \\<^sup>\ x. \

x \\<^sub>s\B \ \\<^bsup>n\<^esup> X\ - (A \ B) \ suffix n \ post_receive n X (\x. \

x \ B \\<^sup>\ x. \

x)" + (A \ B) \ suffix n \ post_receive n X \

\ (B \\<^sup>\ x. \

x) \ suffix n" by (intro synchronous_transition.parallel_right_io @@ -1006,8 +980,8 @@ proof (coinduction rule: synchronous.mixed.up_to_rule [where \ = "[\\<^s have " post_receive n X \

\ (A \ B \ B \\<^sup>\ x. \

x) \ suffix n \\<^sub>s - (A \ B) \ suffix n \ post_receive n X (\x. \

x \ B \\<^sup>\ x. \

x)" - unfolding post_receive_after_parallel and adapted_after_parallel and post_receive_def + (A \ B) \ suffix n \ post_receive n X \

\ (B \\<^sup>\ x. \

x) \ suffix n" + unfolding adapted_after_parallel using thorn_simps by equivalence ultimately show ?thesis @@ -1016,7 +990,7 @@ proof (coinduction rule: synchronous.mixed.up_to_rule [where \ = "[\\<^s and \\ = Receiving\ and \C = B\ and \Q = R \ (A \\<^sup>\ x. \

x) \ suffix n\ and - \R = post_receive n X (\x. \

x \ B \\<^sup>\ x. \

x)\ + \R = post_receive n X \

\ (B \\<^sup>\ x. \

x) \ suffix n\ using composition_in_universe [OF suffix_adapted_mutation_in_universe parallel_mutation_in_universe] @@ -1029,22 +1003,22 @@ proof (coinduction rule: synchronous.mixed.up_to_rule [where \ = "[\\<^s and "C = A" and - "R = post_receive n X (\x. \

x \ A \\<^sup>\ x. \

x)" + "R = post_receive n X \

\ (A \\<^sup>\ x. \

x) \ suffix n" by (auto elim: transition_from_repeated_receive) with \A \\<^sup>\ x. \

x \\<^sub>s\IO \ C n X\ R\ - have A_transition: "A \\<^sup>\ x. \

x \\<^sub>s\A \ \\<^bsup>n\<^esup> X\ post_receive n X (\x. \

x \ A \\<^sup>\ x. \

x)" + have A_transition: "A \\<^sup>\ x. \

x \\<^sub>s\A \ \\<^bsup>n\<^esup> X\ post_receive n X \

\ (A \\<^sup>\ x. \

x) \ suffix n" by (simp only:) then have " A \ B \ B \\<^sup>\ x. \

x \ A \\<^sup>\ x. \

x \\<^sub>s\A \ \\<^bsup>n\<^esup> X\ - (A \ B) \ suffix n \ (B \\<^sup>\ x. \

x) \ suffix n \ post_receive n X (\x. \

x \ A \\<^sup>\ x. \

x)" + (A \ B) \ suffix n \ (B \\<^sup>\ x. \

x) \ suffix n \ post_receive n X \

\ (A \\<^sup>\ x. \

x) \ suffix n" by (intro synchronous_transition.parallel_right_io) moreover have " - (A \ B) \ suffix n \ (B \\<^sup>\ x. \

x) \ suffix n \ post_receive n X (\x. \

x \ A \\<^sup>\ x. \

x) + (A \ B) \ suffix n \ (B \\<^sup>\ x. \

x) \ suffix n \ post_receive n X \

\ (A \\<^sup>\ x. \

x) \ suffix n \\<^sub>s post_receive n X \

\ (A \ B \ B \\<^sup>\ x. \

x \ A \\<^sup>\ x. \

x) \ suffix n" - unfolding post_receive_after_parallel and adapted_after_parallel and post_receive_def + unfolding adapted_after_parallel using thorn_simps by equivalence moreover @@ -1117,7 +1091,7 @@ proof (coinduction rule: synchronous.mixed.up_to_rule [where \ = "[\\<^s and \\ = Receiving\ and \C = A\ and \Q = (B \\<^sup>\ x. \

x) \ suffix n \ R\ and - \R = post_receive n X (\x. \

x \ A \\<^sup>\ x. \

x)\ + \R = post_receive n X \

\ (A \\<^sup>\ x. \

x) \ suffix n\ using composition_in_universe [OF suffix_adapted_mutation_in_universe parallel_mutation_in_universe] @@ -1169,29 +1143,29 @@ next and "B' = B" and - "Q = post_receive n X (\x. \

x \ B \\<^sup>\ x. \

x)" + "Q = post_receive n X \

\ (B \\<^sup>\ x. \

x) \ suffix n" by (auto elim: transition_from_repeated_receive) with \B \\<^sup>\ x. \

x \\<^sub>s\IO \ B' n X\ Q\ - have B_transition: "B \\<^sup>\ x. \

x \\<^sub>s\B \ \\<^bsup>n\<^esup> X\ post_receive n X (\x. \

x \ B \\<^sup>\ x. \

x)" + have B_transition: "B \\<^sup>\ x. \

x \\<^sub>s\B \ \\<^bsup>n\<^esup> X\ post_receive n X \

\ (B \\<^sup>\ x. \

x) \ suffix n" by (simp only:) then have " A \ B \ B \\<^sup>\ x. \

x \\<^sub>s\B \ \\<^bsup>n\<^esup> X\ - (A \ B) \ suffix n \ post_receive n X (\x. \

x \ B \\<^sup>\ x. \

x)" + (A \ B) \ suffix n \ post_receive n X \

\ (B \\<^sup>\ x. \

x) \ suffix n" by (fact synchronous_transition.parallel_right_io) moreover have " post_receive n X \

\ (A \ B \ B \\<^sup>\ x. \

x) \ suffix n \\<^sub>s - (A \ B) \ suffix n \ post_receive n X (\x. \

x \ B \\<^sup>\ x. \

x)" - unfolding post_receive_after_parallel and adapted_after_parallel and post_receive_def + (A \ B) \ suffix n \ post_receive n X \

\ (B \\<^sup>\ x. \

x) \ suffix n" + unfolding adapted_after_parallel using thorn_simps by equivalence moreover from B_transition have " A \ B \ B \\<^sup>\ x. \

x \ A \\<^sup>\ x. \

x \\<^sub>s\B \ \\<^bsup>n\<^esup> X\ - (A \ B) \ suffix n \ post_receive n X (\x. \

x \ B \\<^sup>\ x. \

x) \ (A \\<^sup>\ x. \

x) \ suffix n" + (A \ B) \ suffix n \ (post_receive n X \

\ (B \\<^sup>\ x. \

x) \ suffix n) \ (A \\<^sup>\ x. \

x) \ suffix n" by (intro synchronous_transition.parallel_right_io @@ -1200,17 +1174,17 @@ next ) moreover have " - (A \ B) \ suffix n \ post_receive n X (\x. \

x \ B \\<^sup>\ x. \

x) \ (A \\<^sup>\ x. \

x) \ suffix n + (A \ B) \ suffix n \ (post_receive n X \

\ (B \\<^sup>\ x. \

x) \ suffix n) \ (A \\<^sup>\ x. \

x) \ suffix n \\<^sub>s post_receive n X \

\ (A \ B \ B \\<^sup>\ x. \

x \ A \\<^sup>\ x. \

x) \ suffix n" - unfolding post_receive_after_parallel and adapted_after_parallel and post_receive_def + unfolding adapted_after_parallel using thorn_simps by equivalence ultimately show ?thesis unfolding \\ = IO \ B' n X\ and \S = (A \ B) \ suffix n \ Q\ and - \\ = Receiving\ and \B' = B\ and \Q = post_receive n X (\x. \

x \ B \\<^sup>\ x. \

x)\ + \\ = Receiving\ and \B' = B\ and \Q = post_receive n X \

\ (B \\<^sup>\ x. \

x) \ suffix n\ using composition_in_universe [OF suffix_adapted_mutation_in_universe parallel_mutation_in_universe]