(* Title: OPnet_Lifting.thy License: BSD 2-Clause. See LICENSE. Author: Timothy Bourke *) section "Lifting rules for (open) partial networks" theory OPnet_Lifting imports ONode_Lifting OAWN_SOS OPnet begin lemma oreachable_par_subnet_induct [consumes, case_names init other local]: assumes "(\, SubnetS s t) \ oreachable (opnet onp (p\<^sub>1 \ p\<^sub>2)) S U" and init: "\\ s t. (\, SubnetS s t) \ init (opnet onp (p\<^sub>1 \ p\<^sub>2)) \ P \ s t" and other: "\\ s t \'. \ (\, SubnetS s t) \ oreachable (opnet onp (p\<^sub>1 \ p\<^sub>2)) S U; U \ \'; P \ s t \ \ P \' s t" and local: "\\ s t \' s' t' a. \ (\, SubnetS s t) \ oreachable (opnet onp (p\<^sub>1 \ p\<^sub>2)) S U; ((\, SubnetS s t), a, (\', SubnetS s' t')) \ trans (opnet onp (p\<^sub>1 \ p\<^sub>2)); S \ \' a; P \ s t \ \ P \' s' t'" shows "P \ s t" using assms(1) proof (induction "(\, SubnetS s t)" arbitrary: s t \) fix s t \ assume "(\, SubnetS s t) \ init (opnet onp (p\<^sub>1 \ p\<^sub>2))" with init show "P \ s t" . next fix st a s' t' \' assume "st \ oreachable (opnet onp (p\<^sub>1 \ p\<^sub>2)) S U" and tr: "(st, a, (\', SubnetS s' t')) \ trans (opnet onp (p\<^sub>1 \ p\<^sub>2))" and "S (fst st) (fst (\', SubnetS s' t')) a" and IH: "\s t \. st = (\, SubnetS s t) \ P \ s t" from this(1) obtain s t \ where "st = (\, SubnetS s t)" and "(\, SubnetS s t) \ oreachable (opnet onp (p\<^sub>1 \ p\<^sub>2)) S U" by (metis net_par_oreachable_is_subnet prod.collapse) note this(2) moreover from tr and \st = (\, SubnetS s t)\ have "((\, SubnetS s t), a, (\', SubnetS s' t')) \ trans (opnet onp (p\<^sub>1 \ p\<^sub>2))" by simp moreover from \S (fst st) (fst (\', SubnetS s' t')) a\ and \st = (\, SubnetS s t)\ have "S \ \' a" by simp moreover from IH and \st = (\, SubnetS s t)\ have "P \ s t" . ultimately show "P \' s' t'" by (rule local) next fix st \' s t assume "st \ oreachable (opnet onp (p\<^sub>1 \ p\<^sub>2)) S U" and "U (fst st) \'" and "snd st = SubnetS s t" and IH: "\s t \. st = (\, SubnetS s t) \ P \ s t" from this(1,3) obtain \ where "st = (\, SubnetS s t)" and "(\, SubnetS s t) \ oreachable (opnet onp (p\<^sub>1 \ p\<^sub>2)) S U" by (metis prod.collapse) note this(2) moreover from \U (fst st) \'\ and \st = (\, SubnetS s t)\ have "U \ \'" by simp moreover from IH and \st = (\, SubnetS s t)\ have "P \ s t" . ultimately show "P \' s t" by (rule other) qed lemma other_net_tree_ips_par_left: assumes "other U (net_tree_ips (p\<^sub>1 \ p\<^sub>2)) \ \'" and "\\. U \ \" shows "other U (net_tree_ips p\<^sub>1) \ \'" proof - from assms(1) obtain ineq: "\i\net_tree_ips (p\<^sub>1 \ p\<^sub>2). \' i = \ i" and outU: "\j. j\net_tree_ips (p\<^sub>1 \ p\<^sub>2) \ U (\ j) (\' j)" .. show ?thesis proof (rule otherI) fix i assume "i\net_tree_ips p\<^sub>1" hence "i\net_tree_ips (p\<^sub>1 \ p\<^sub>2)" by simp with ineq show "\' i = \ i" .. next fix j assume "j\net_tree_ips p\<^sub>1" show "U (\ j) (\' j)" proof (cases "j\net_tree_ips p\<^sub>2") assume "j\net_tree_ips p\<^sub>2" hence "j\net_tree_ips (p\<^sub>1 \ p\<^sub>2)" by simp with ineq have "\' j = \ j" .. thus "U (\ j) (\' j)" by simp (rule \\\. U \ \\) next assume "j\net_tree_ips p\<^sub>2" with \j\net_tree_ips p\<^sub>1\ have "j\net_tree_ips (p\<^sub>1 \ p\<^sub>2)" by simp with outU show "U (\ j) (\' j)" by simp qed qed qed lemma other_net_tree_ips_par_right: assumes "other U (net_tree_ips (p\<^sub>1 \ p\<^sub>2)) \ \'" and "\\. U \ \" shows "other U (net_tree_ips p\<^sub>2) \ \'" proof - from assms(1) have "other U (net_tree_ips (p\<^sub>2 \ p\<^sub>1)) \ \'" by (subst net_tree_ips_commute) thus ?thesis using \\\. U \ \\ by (rule other_net_tree_ips_par_left) qed lemma ostep_arrive_invariantD [elim]: assumes "p \\<^sub>A (\\ _. oarrivemsg I \, U \) P" and "(\, s) \ oreachable p (otherwith S IPS (oarrivemsg I)) U" and "((\, s), a, (\', s')) \ trans p" and "oarrivemsg I \ a" shows "P ((\, s), a, (\', s'))" proof - from assms(2) have "(\, s) \ oreachable p (\\ _ a. oarrivemsg I \ a) U" by (rule oreachable_weakenE) auto thus "P ((\, s), a, (\', s'))" using assms(3-4) by (rule ostep_invariantD [OF assms(1)]) qed lemma opnet_sync_action_subnet_oreachable: assumes "(\, SubnetS s t) \ oreachable (opnet onp (p\<^sub>1 \ p\<^sub>2)) (\\ _. oarrivemsg I \) (other U (net_tree_ips (p\<^sub>1 \ p\<^sub>2)))" (is "_ \ oreachable _ (?S (p\<^sub>1 \ p\<^sub>2)) (?U (p\<^sub>1 \ p\<^sub>2))") and "\\. U \ \" and act1: "opnet onp p\<^sub>1 \\<^sub>A (\\ _. oarrivemsg I \, other U (net_tree_ips p\<^sub>1) \) globala (\(\, a, \'). castmsg (I \) a \ (a = \ \ (\i d. a = i:deliver(d)) \ ((\i\net_tree_ips p\<^sub>1. U (\ i) (\' i)) \ (\i. i\net_tree_ips p\<^sub>1 \ \' i = \ i))))" and act2: "opnet onp p\<^sub>2 \\<^sub>A (\\ _. oarrivemsg I \, other U (net_tree_ips p\<^sub>2) \) globala (\(\, a, \'). castmsg (I \) a \ (a = \ \ (\i d. a = i:deliver(d)) \ ((\i\net_tree_ips p\<^sub>2. U (\ i) (\' i)) \ (\i. i\net_tree_ips p\<^sub>2 \ \' i = \ i))))" shows "(\, s) \ oreachable (opnet onp p\<^sub>1) (\\ _. oarrivemsg I \) (other U (net_tree_ips p\<^sub>1)) \ (\, t) \ oreachable (opnet onp p\<^sub>2) (\\ _. oarrivemsg I \) (other U (net_tree_ips p\<^sub>2)) \ net_tree_ips p\<^sub>1 \ net_tree_ips p\<^sub>2 = {}" using assms(1) proof (induction rule: oreachable_par_subnet_induct) case (init \ s t) hence sinit: "(\, s) \ init (opnet onp p\<^sub>1)" and tinit: "(\, t) \ init (opnet onp p\<^sub>2)" and "net_ips s \ net_ips t = {}" by auto moreover from sinit have "net_ips s = net_tree_ips p\<^sub>1" by (rule opnet_net_ips_net_tree_ips_init) moreover from tinit have "net_ips t = net_tree_ips p\<^sub>2" by (rule opnet_net_ips_net_tree_ips_init) ultimately show ?case by (auto elim: oreachable_init) next case (other \ s t \') hence "other U (net_tree_ips (p\<^sub>1 \ p\<^sub>2)) \ \'" and IHs: "(\, s) \ oreachable (opnet onp p\<^sub>1) (?S p\<^sub>1) (?U p\<^sub>1)" and IHt: "(\, t) \ oreachable (opnet onp p\<^sub>2) (?S p\<^sub>2) (?U p\<^sub>2)" and "net_tree_ips p\<^sub>1 \ net_tree_ips p\<^sub>2 = {}" by auto have "(\', s) \ oreachable (opnet onp p\<^sub>1) (?S p\<^sub>1) (?U p\<^sub>1)" proof - from \?U (p\<^sub>1 \ p\<^sub>2) \ \'\ and \\\. U \ \\ have "?U p\<^sub>1 \ \'" by (rule other_net_tree_ips_par_left) with IHs show ?thesis by - (erule(1) oreachable_other') qed moreover have "(\', t) \ oreachable (opnet onp p\<^sub>2) (?S p\<^sub>2) (?U p\<^sub>2)" proof - from \?U (p\<^sub>1 \ p\<^sub>2) \ \'\ and \\\. U \ \\ have "?U p\<^sub>2 \ \'" by (rule other_net_tree_ips_par_right) with IHt show ?thesis by - (erule(1) oreachable_other') qed ultimately show ?case using \net_tree_ips p\<^sub>1 \ net_tree_ips p\<^sub>2 = {}\ by simp next case (local \ s t \' s' t' a) hence stor: "(\, SubnetS s t) \ oreachable (opnet onp (p\<^sub>1 \ p\<^sub>2)) (?S (p\<^sub>1 \ p\<^sub>2)) (?U (p\<^sub>1 \ p\<^sub>2))" and tr: "((\, SubnetS s t), a, (\', SubnetS s' t')) \ trans (opnet onp (p\<^sub>1 \ p\<^sub>2))" and "oarrivemsg I \ a" and sor: "(\, s) \ oreachable (opnet onp p\<^sub>1) (?S p\<^sub>1) (?U p\<^sub>1)" and tor: "(\, t) \ oreachable (opnet onp p\<^sub>2) (?S p\<^sub>2) (?U p\<^sub>2)" and "net_tree_ips p\<^sub>1 \ net_tree_ips p\<^sub>2 = {}" by auto from tr have "((\, SubnetS s t), a, (\', SubnetS s' t')) \ opnet_sos (trans (opnet onp p\<^sub>1)) (trans (opnet onp p\<^sub>2))" by simp hence "(\', s') \ oreachable (opnet onp p\<^sub>1) (?S p\<^sub>1) (?U p\<^sub>1) \ (\', t') \ oreachable (opnet onp p\<^sub>2) (?S p\<^sub>2) (?U p\<^sub>2)" proof (cases) fix H K m H' K' assume "a = (H \ H')\(K \ K'):arrive(m)" and str: "((\, s), H\K:arrive(m), (\', s')) \ trans (opnet onp p\<^sub>1)" and ttr: "((\, t), H'\K':arrive(m), (\', t')) \ trans (opnet onp p\<^sub>2)" from this(1) and \oarrivemsg I \ a\ have "I \ m" by simp with sor str have "(\', s') \ oreachable (opnet onp p\<^sub>1) (?S p\<^sub>1) (?U p\<^sub>1)" by - (erule(1) oreachable_local, auto) moreover from \I \ m\ tor ttr have "(\', t') \ oreachable (opnet onp p\<^sub>2) (?S p\<^sub>2) (?U p\<^sub>2)" by - (erule(1) oreachable_local, auto) ultimately show ?thesis .. next fix R m H K assume str: "((\, s), R:*cast(m), (\', s')) \ trans (opnet onp p\<^sub>1)" and ttr: "((\, t), H\K:arrive(m), (\', t')) \ trans (opnet onp p\<^sub>2)" from sor str have "I \ m" by - (drule(1) ostep_invariantD [OF act1], simp_all) with sor str have "(\', s') \ oreachable (opnet onp p\<^sub>1) (?S p\<^sub>1) (?U p\<^sub>1)" by - (erule(1) oreachable_local, auto) moreover from \I \ m\ tor ttr have "(\', t') \ oreachable (opnet onp p\<^sub>2) (?S p\<^sub>2) (?U p\<^sub>2)" by - (erule(1) oreachable_local, auto) ultimately show ?thesis .. next fix R m H K assume str: "((\, s), H\K:arrive(m), (\', s')) \ trans (opnet onp p\<^sub>1)" and ttr: "((\, t), R:*cast(m), (\', t')) \ trans (opnet onp p\<^sub>2)" from tor ttr have "I \ m" by - (drule(1) ostep_invariantD [OF act2], simp_all) with sor str have "(\', s') \ oreachable (opnet onp p\<^sub>1) (?S p\<^sub>1) (?U p\<^sub>1)" by - (erule(1) oreachable_local, auto) moreover from \I \ m\ tor ttr have "(\', t') \ oreachable (opnet onp p\<^sub>2) (?S p\<^sub>2) (?U p\<^sub>2)" by - (erule(1) oreachable_local, auto) ultimately show ?thesis .. next fix i i' assume str: "((\, s), connect(i, i'), (\', s')) \ trans (opnet onp p\<^sub>1)" and ttr: "((\, t), connect(i, i'), (\', t')) \ trans (opnet onp p\<^sub>2)" with sor str have "(\', s') \ oreachable (opnet onp p\<^sub>1) (?S p\<^sub>1) (?U p\<^sub>1)" by - (erule(1) oreachable_local, auto) moreover from tor ttr have "(\', t') \ oreachable (opnet onp p\<^sub>2) (?S p\<^sub>2) (?U p\<^sub>2)" by - (erule(1) oreachable_local, auto) ultimately show ?thesis .. next fix i i' assume str: "((\, s), disconnect(i, i'), (\', s')) \ trans (opnet onp p\<^sub>1)" and ttr: "((\, t), disconnect(i, i'), (\', t')) \ trans (opnet onp p\<^sub>2)" with sor str have "(\', s') \ oreachable (opnet onp p\<^sub>1) (?S p\<^sub>1) (?U p\<^sub>1)" by - (erule(1) oreachable_local, auto) moreover from tor ttr have "(\', t') \ oreachable (opnet onp p\<^sub>2) (?S p\<^sub>2) (?U p\<^sub>2)" by - (erule(1) oreachable_local, auto) ultimately show ?thesis .. next fix i d assume "t' = t" and str: "((\, s), i:deliver(d), (\', s')) \ trans (opnet onp p\<^sub>1)" from sor str have "\j. j\net_tree_ips p\<^sub>1 \ \' j = \ j" by - (drule(1) ostep_invariantD [OF act1], simp_all) moreover with \net_tree_ips p\<^sub>1 \ net_tree_ips p\<^sub>2 = {}\ have "\j. j\net_tree_ips p\<^sub>2 \ \' j = \ j" by auto moreover from sor str have "\j\net_tree_ips p\<^sub>1. U (\ j) (\' j)" by - (drule(1) ostep_invariantD [OF act1], simp_all) ultimately have "(\', t') \ oreachable (opnet onp p\<^sub>2) (?S p\<^sub>2) (?U p\<^sub>2)" using tor \t' = t\ by (clarsimp elim!: oreachable_other') (metis otherI \\\. U \ \\)+ moreover from sor str have "(\', s') \ oreachable (opnet onp p\<^sub>1) (?S p\<^sub>1) (?U p\<^sub>1)" by - (erule(1) oreachable_local, auto) ultimately show ?thesis by (rule conjI [rotated]) next fix i d assume "s' = s" and ttr: "((\, t), i:deliver(d), (\', t')) \ trans (opnet onp p\<^sub>2)" from tor ttr have "\j. j\net_tree_ips p\<^sub>2 \ \' j = \ j" by - (drule(1) ostep_invariantD [OF act2], simp_all) moreover with \net_tree_ips p\<^sub>1 \ net_tree_ips p\<^sub>2 = {}\ have "\j. j\net_tree_ips p\<^sub>1 \ \' j = \ j" by auto moreover from tor ttr have "\j\net_tree_ips p\<^sub>2. U (\ j) (\' j)" by - (drule(1) ostep_invariantD [OF act2], simp_all) ultimately have "(\', s') \ oreachable (opnet onp p\<^sub>1) (?S p\<^sub>1) (?U p\<^sub>1)" using sor \s' = s\ by (clarsimp elim!: oreachable_other') (metis otherI \\\. U \ \\)+ moreover from tor ttr have "(\', t') \ oreachable (opnet onp p\<^sub>2) (?S p\<^sub>2) (?U p\<^sub>2)" by - (erule(1) oreachable_local, auto) ultimately show ?thesis .. next assume "t' = t" and str: "((\, s), \, (\', s')) \ trans (opnet onp p\<^sub>1)" from sor str have "\j. j\net_tree_ips p\<^sub>1 \ \' j = \ j" by - (drule(1) ostep_invariantD [OF act1], simp_all) moreover with \net_tree_ips p\<^sub>1 \ net_tree_ips p\<^sub>2 = {}\ have "\j. j\net_tree_ips p\<^sub>2 \ \' j = \ j" by auto moreover from sor str have "\j\net_tree_ips p\<^sub>1. U (\ j) (\' j)" by - (drule(1) ostep_invariantD [OF act1], simp_all) ultimately have "(\', t') \ oreachable (opnet onp p\<^sub>2) (?S p\<^sub>2) (?U p\<^sub>2)" using tor \t' = t\ by (clarsimp elim!: oreachable_other') (metis otherI \\\. U \ \\)+ moreover from sor str have "(\', s') \ oreachable (opnet onp p\<^sub>1) (?S p\<^sub>1) (?U p\<^sub>1)" by - (erule(1) oreachable_local, auto) ultimately show ?thesis by (rule conjI [rotated]) next assume "s' = s" and ttr: "((\, t), \, (\', t')) \ trans (opnet onp p\<^sub>2)" from tor ttr have "\j. j\net_tree_ips p\<^sub>2 \ \' j = \ j" by - (drule(1) ostep_invariantD [OF act2], simp_all) moreover with \net_tree_ips p\<^sub>1 \ net_tree_ips p\<^sub>2 = {}\ have "\j. j\net_tree_ips p\<^sub>1 \ \' j = \ j" by auto moreover from tor ttr have "\j\net_tree_ips p\<^sub>2. U (\ j) (\' j)" by - (drule(1) ostep_invariantD [OF act2], simp_all) ultimately have "(\', s') \ oreachable (opnet onp p\<^sub>1) (?S p\<^sub>1) (?U p\<^sub>1)" using sor \s' = s\ by (clarsimp elim!: oreachable_other') (metis otherI \\\. U \ \\)+ moreover from tor ttr have "(\', t') \ oreachable (opnet onp p\<^sub>2) (?S p\<^sub>2) (?U p\<^sub>2)" by - (erule(1) oreachable_local, auto) ultimately show ?thesis .. qed with \net_tree_ips p\<^sub>1 \ net_tree_ips p\<^sub>2 = {}\ show ?case by simp qed text \ `Splitting' reachability is trivial when there are no assumptions on interleavings, but this is useless for showing non-trivial properties, since the interleaving steps can do anything at all. This lemma is too weak. \ lemma subnet_oreachable_true_true: assumes "(\, SubnetS s\<^sub>1 s\<^sub>2) \ oreachable (opnet onp (p\<^sub>1 \ p\<^sub>2)) (\_ _ _. True) (\_ _. True)" shows "(\, s\<^sub>1) \ oreachable (opnet onp p\<^sub>1) (\_ _ _. True) (\_ _. True)" "(\, s\<^sub>2) \ oreachable (opnet onp p\<^sub>2) (\_ _ _. True) (\_ _. True)" (is "_ \ ?oreachable p\<^sub>2") using assms proof - from assms have "(\, s\<^sub>1) \ ?oreachable p\<^sub>1 \ (\, s\<^sub>2) \ ?oreachable p\<^sub>2" proof (induction rule: oreachable_par_subnet_induct) fix \ s\<^sub>1 s\<^sub>2 assume "(\, SubnetS s\<^sub>1 s\<^sub>2) \ init (opnet onp (p\<^sub>1 \ p\<^sub>2))" thus "(\, s\<^sub>1) \ ?oreachable p\<^sub>1 \ (\, s\<^sub>2) \ ?oreachable p\<^sub>2" by (auto dest: oreachable_init) next case (local \ s\<^sub>1 s\<^sub>2 \' s\<^sub>1' s\<^sub>2' a) hence "(\, SubnetS s\<^sub>1 s\<^sub>2) \ ?oreachable (p\<^sub>1 \ p\<^sub>2)" and sr1: "(\, s\<^sub>1) \ ?oreachable p\<^sub>1" and sr2: "(\, s\<^sub>2) \ ?oreachable p\<^sub>2" and "((\, SubnetS s\<^sub>1 s\<^sub>2), a, (\', SubnetS s\<^sub>1' s\<^sub>2')) \ trans (opnet onp (p\<^sub>1 \ p\<^sub>2))" by auto from this(4) have "((\, SubnetS s\<^sub>1 s\<^sub>2), a, (\', SubnetS s\<^sub>1' s\<^sub>2')) \ opnet_sos (trans (opnet onp p\<^sub>1)) (trans (opnet onp p\<^sub>2))" by simp thus "(\', s\<^sub>1') \ ?oreachable p\<^sub>1 \ (\', s\<^sub>2') \ ?oreachable p\<^sub>2" proof cases fix R m H K assume "a = R:*cast(m)" and tr1: "((\, s\<^sub>1), R:*cast(m), (\', s\<^sub>1')) \ trans (opnet onp p\<^sub>1)" and tr2: "((\, s\<^sub>2), H\K:arrive(m), (\', s\<^sub>2')) \ trans (opnet onp p\<^sub>2)" from sr1 and tr1 and TrueI have "(\', s\<^sub>1') \ ?oreachable p\<^sub>1" by (rule oreachable_local') moreover from sr2 and tr2 and TrueI have "(\', s\<^sub>2') \ ?oreachable p\<^sub>2" by (rule oreachable_local') ultimately show ?thesis .. next assume "a = \" and "s\<^sub>2' = s\<^sub>2" and tr1: "((\, s\<^sub>1), \, (\', s\<^sub>1')) \ trans (opnet onp p\<^sub>1)" from sr2 and this(2) have "(\', s\<^sub>2') \ ?oreachable p\<^sub>2" by auto moreover have "(\_ _. True) \ \'" by (rule TrueI) ultimately have "(\', s\<^sub>2') \ ?oreachable p\<^sub>2" by (rule oreachable_other') moreover from sr1 and tr1 and TrueI have "(\', s\<^sub>1') \ ?oreachable p\<^sub>1" by (rule oreachable_local') qed (insert sr1 sr2, simp_all, (metis (no_types) oreachable_local' oreachable_other')+) qed auto thus "(\, s\<^sub>1) \ ?oreachable p\<^sub>1" "(\, s\<^sub>2) \ ?oreachable p\<^sub>2" by auto qed text \ It may also be tempting to try splitting from the assumption @{term "(\, SubnetS s\<^sub>1 s\<^sub>2) \ oreachable (opnet onp (p\<^sub>1 \ p\<^sub>2)) (\_ _ _. True) (\_ _. False)"}, where the environment step would be trivially true (since the assumption is false), but the lemma cannot be shown when only one side acts, since it must guarantee the assumption for the other side. \ lemma lift_opnet_sync_action: assumes "\\. U \ \" and act1: "\i R. \i : onp i : R\\<^sub>o \\<^sub>A (\\ _. oarrivemsg I \, other U {i} \) globala (\(\, a, _). castmsg (I \) a)" and act2: "\i R. \i : onp i : R\\<^sub>o \\<^sub>A (\\ _. oarrivemsg I \, other U {i} \) globala (\(\, a, \'). (a \ \ \ (\d. a \ i:deliver(d)) \ S (\ i) (\' i)))" and act3: "\i R. \i : onp i : R\\<^sub>o \\<^sub>A (\\ _. oarrivemsg I \, other U {i} \) globala (\(\, a, \'). (a = \ \ (\d. a = i:deliver(d)) \ U (\ i) (\' i)))" shows "opnet onp p \\<^sub>A (\\ _. oarrivemsg I \, other U (net_tree_ips p) \) globala (\(\, a, \'). castmsg (I \) a \ (a \ \ \ (\i d. a \ i:deliver(d)) \ (\i\net_tree_ips p. S (\ i) (\' i))) \ (a = \ \ (\i d. a = i:deliver(d)) \ ((\i\net_tree_ips p. U (\ i) (\' i)) \ (\i. i\net_tree_ips p \ \' i = \ i))))" (is "opnet onp p \\<^sub>A (?I, ?U p \) ?inv (net_tree_ips p)") proof (induction p) fix i R show "opnet onp \i; R\ \\<^sub>A (?I, ?U \i; R\ \) ?inv (net_tree_ips \i; R\)" proof (rule ostep_invariantI, simp only: opnet.simps net_tree_ips.simps) fix \ s a \' s' assume sor: "(\, s) \ oreachable (\i : onp i : R\\<^sub>o) (\\ _. oarrivemsg I \) (other U {i})" and str: "((\, s), a, (\', s')) \ trans (\i : onp i : R\\<^sub>o)" and oam: "oarrivemsg I \ a" hence "castmsg (I \) a" by - (drule(2) ostep_invariantD [OF act1], simp) moreover from sor str oam have "a \ \ \ (\i d. a \ i:deliver(d)) \ S (\ i) (\' i)" by - (drule(2) ostep_invariantD [OF act2], simp) moreover have "a = \ \ (\i d. a = i:deliver(d)) \ U (\ i) (\' i)" proof - from sor str oam have "a = \ \ (\d. a = i:deliver(d)) \ U (\ i) (\' i)" by - (drule(2) ostep_invariantD [OF act3], simp) moreover from sor str oam have "\j. j\i \ (\d. a \ j:deliver(d))" by - (drule(2) ostep_invariantD [OF node_local_deliver], simp) ultimately show ?thesis by clarsimp metis qed moreover from sor str oam have "\j. j\i \ (\d. a \ j:deliver(d))" by - (drule(2) ostep_invariantD [OF node_local_deliver], simp) moreover from sor str oam have "a = \ \ (\i d. a = i:deliver(d)) \ (\j. j\i \ \' j = \ j)" by - (drule(2) ostep_invariantD [OF node_tau_deliver_unchanged], simp) ultimately show "?inv {i} ((\, s), a, (\', s'))" by simp qed next fix p\<^sub>1 p\<^sub>2 assume inv1: "opnet onp p\<^sub>1 \\<^sub>A (?I, ?U p\<^sub>1 \) ?inv (net_tree_ips p\<^sub>1)" and inv2: "opnet onp p\<^sub>2 \\<^sub>A (?I, ?U p\<^sub>2 \) ?inv (net_tree_ips p\<^sub>2)" show "opnet onp (p\<^sub>1 \ p\<^sub>2) \\<^sub>A (?I, ?U (p\<^sub>1 \ p\<^sub>2) \) ?inv (net_tree_ips (p\<^sub>1 \ p\<^sub>2))" proof (rule ostep_invariantI) fix \ st a \' st' assume "(\, st) \ oreachable (opnet onp (p\<^sub>1 \ p\<^sub>2)) ?I (?U (p\<^sub>1 \ p\<^sub>2))" and "((\, st), a, (\', st')) \ trans (opnet onp (p\<^sub>1 \ p\<^sub>2))" and "oarrivemsg I \ a" from this(1) obtain s t where "st = SubnetS s t" and *: "(\, SubnetS s t) \ oreachable (opnet onp (p\<^sub>1 \ p\<^sub>2)) ?I (?U (p\<^sub>1 \ p\<^sub>2))" by - (frule net_par_oreachable_is_subnet, metis) from this(2) and inv1 and inv2 obtain sor: "(\, s) \ oreachable (opnet onp p\<^sub>1) ?I (?U p\<^sub>1)" and tor: "(\, t) \ oreachable (opnet onp p\<^sub>2) ?I (?U p\<^sub>2)" and "net_tree_ips p\<^sub>1 \ net_tree_ips p\<^sub>2 = {}" by - (drule opnet_sync_action_subnet_oreachable [OF _ \\\. U \ \\], auto) from * and \((\, st), a, (\', st')) \ trans (opnet onp (p\<^sub>1 \ p\<^sub>2))\ and \st = SubnetS s t\ obtain s' t' where "st' = SubnetS s' t'" and "((\, SubnetS s t), a, (\', SubnetS s' t')) \ opnet_sos (trans (opnet onp p\<^sub>1)) (trans (opnet onp p\<^sub>2))" by clarsimp (frule opartial_net_preserves_subnets, metis) from this(2) have"castmsg (I \) a \ (a \ \ \ (\i d. a \ i:deliver(d)) \ (\i\net_tree_ips (p\<^sub>1 \ p\<^sub>2). S (\ i) (\' i))) \ (a = \ \ (\i d. a = i:deliver(d)) \ (\i\net_tree_ips (p\<^sub>1 \ p\<^sub>2). U (\ i) (\' i)) \ (\i. i \ net_tree_ips (p\<^sub>1 \ p\<^sub>2) \ \' i = \ i))" proof cases fix R m H K assume "a = R:*cast(m)" and str: "((\, s), R:*cast(m), (\', s')) \ trans (opnet onp p\<^sub>1)" and ttr: "((\, t), H\K:arrive(m), (\', t')) \ trans (opnet onp p\<^sub>2)" from sor and str have "I \ m \ (\i\net_tree_ips p\<^sub>1. S (\ i) (\' i))" by (auto dest: ostep_invariantD [OF inv1]) moreover with tor and ttr have "\i\net_tree_ips p\<^sub>2. S (\ i) (\' i)" by (auto dest: ostep_invariantD [OF inv2]) ultimately show ?thesis using \a = R:*cast(m)\ by auto next fix R m H K assume "a = R:*cast(m)" and str: "((\, s), H\K:arrive(m), (\', s')) \ trans (opnet onp p\<^sub>1)" and ttr: "((\, t), R:*cast(m), (\', t')) \ trans (opnet onp p\<^sub>2)" from tor and ttr have "I \ m \ (\i\net_tree_ips p\<^sub>2. S (\ i) (\' i))" by (auto dest: ostep_invariantD [OF inv2]) moreover with sor and str have "\i\net_tree_ips p\<^sub>1. S (\ i) (\' i)" by (auto dest: ostep_invariantD [OF inv1]) ultimately show ?thesis using \a = R:*cast(m)\ by auto next fix H K m H' K' assume "a = (H \ H')\(K \ K'):arrive(m)" and str: "((\, s), H\K:arrive(m), (\', s')) \ trans (opnet onp p\<^sub>1)" and ttr: "((\, t), H'\K':arrive(m), (\', t')) \ trans (opnet onp p\<^sub>2)" from this(1) and \oarrivemsg I \ a\ have "I \ m" by simp with sor and str have "\i\net_tree_ips p\<^sub>1. S (\ i) (\' i)" by (auto dest: ostep_invariantD [OF inv1]) moreover from tor and ttr and \I \ m\ have "\i\net_tree_ips p\<^sub>2. S (\ i) (\' i)" by (auto dest: ostep_invariantD [OF inv2]) ultimately show ?thesis using \a = (H \ H')\(K \ K'):arrive(m)\ by auto next fix i d assume "a = i:deliver(d)" and str: "((\, s), i:deliver(d), (\', s')) \ trans (opnet onp p\<^sub>1)" with sor have "((\i\net_tree_ips p\<^sub>1. U (\ i) (\' i)) \ (\i. i\net_tree_ips p\<^sub>1 \ \' i = \ i))" by (auto dest!: ostep_invariantD [OF inv1]) with \a = i:deliver(d)\ and \\\. U \ \\ show ?thesis by auto next fix i d assume "a = i:deliver(d)" and ttr: "((\, t), i:deliver(d), (\', t')) \ trans (opnet onp p\<^sub>2)" with tor have "((\i\net_tree_ips p\<^sub>2. U (\ i) (\' i)) \ (\i. i\net_tree_ips p\<^sub>2 \ \' i = \ i))" by (auto dest!: ostep_invariantD [OF inv2]) with \a = i:deliver(d)\ and \\\. U \ \\ show ?thesis by auto next assume "a = \" and str: "((\, s), \, (\', s')) \ trans (opnet onp p\<^sub>1)" with sor have "((\i\net_tree_ips p\<^sub>1. U (\ i) (\' i)) \ (\i. i\net_tree_ips p\<^sub>1 \ \' i = \ i))" by (auto dest!: ostep_invariantD [OF inv1]) with \a = \\ and \\\. U \ \\ show ?thesis by auto next assume "a = \" and ttr: "((\, t), \, (\', t')) \ trans (opnet onp p\<^sub>2)" with tor have "((\i\net_tree_ips p\<^sub>2. U (\ i) (\' i)) \ (\i. i\net_tree_ips p\<^sub>2 \ \' i = \ i))" by (auto dest!: ostep_invariantD [OF inv2]) with \a = \\ and \\\. U \ \\ show ?thesis by auto next fix i i' assume "a = connect(i, i')" and str: "((\, s), connect(i, i'), (\', s')) \ trans (opnet onp p\<^sub>1)" and ttr: "((\, t), connect(i, i'), (\', t')) \ trans (opnet onp p\<^sub>2)" from sor and str have "\i\net_tree_ips p\<^sub>1. S (\ i) (\' i)" by (auto dest: ostep_invariantD [OF inv1]) moreover from tor and ttr have "\i\net_tree_ips p\<^sub>2. S (\ i) (\' i)" by (auto dest: ostep_invariantD [OF inv2]) ultimately show ?thesis using \a = connect(i, i')\ by auto next fix i i' assume "a = disconnect(i, i')" and str: "((\, s), disconnect(i, i'), (\', s')) \ trans (opnet onp p\<^sub>1)" and ttr: "((\, t), disconnect(i, i'), (\', t')) \ trans (opnet onp p\<^sub>2)" from sor and str have "\i\net_tree_ips p\<^sub>1. S (\ i) (\' i)" by (auto dest: ostep_invariantD [OF inv1]) moreover from tor and ttr have "\i\net_tree_ips p\<^sub>2. S (\ i) (\' i)" by (auto dest: ostep_invariantD [OF inv2]) ultimately show ?thesis using \a = disconnect(i, i')\ by auto qed thus "?inv (net_tree_ips (p\<^sub>1 \ p\<^sub>2)) ((\, st), a, (\', st'))" by simp qed qed theorem subnet_oreachable: assumes "(\, SubnetS s t) \ oreachable (opnet onp (p\<^sub>1 \ p\<^sub>2)) (otherwith S (net_tree_ips (p\<^sub>1 \ p\<^sub>2)) (oarrivemsg I)) (other U (net_tree_ips (p\<^sub>1 \ p\<^sub>2)))" (is "_ \ oreachable _ (?S (p\<^sub>1 \ p\<^sub>2)) (?U (p\<^sub>1 \ p\<^sub>2))") and "\\. S \ \" and "\\. U \ \" and node1: "\i R. \i : onp i : R\\<^sub>o \\<^sub>A (\\ _. oarrivemsg I \, other U {i} \) globala (\(\, a, _). castmsg (I \) a)" and node2: "\i R. \i : onp i : R\\<^sub>o \\<^sub>A (\\ _. oarrivemsg I \, other U {i} \) globala (\(\, a, \'). (a \ \ \ (\d. a \ i:deliver(d)) \ S (\ i) (\' i)))" and node3: "\i R. \i : onp i : R\\<^sub>o \\<^sub>A (\\ _. oarrivemsg I \, other U {i} \) globala (\(\, a, \'). (a = \ \ (\d. a = i:deliver(d)) \ U (\ i) (\' i)))" shows "(\, s) \ oreachable (opnet onp p\<^sub>1) (otherwith S (net_tree_ips p\<^sub>1) (oarrivemsg I)) (other U (net_tree_ips p\<^sub>1)) \ (\, t) \ oreachable (opnet onp p\<^sub>2) (otherwith S (net_tree_ips p\<^sub>2) (oarrivemsg I)) (other U (net_tree_ips p\<^sub>2)) \ net_tree_ips p\<^sub>1 \ net_tree_ips p\<^sub>2 = {}" using assms(1) proof (induction rule: oreachable_par_subnet_induct) case (init \ s t) hence sinit: "(\, s) \ init (opnet onp p\<^sub>1)" and tinit: "(\, t) \ init (opnet onp p\<^sub>2)" and "net_ips s \ net_ips t = {}" by auto moreover from sinit have "net_ips s = net_tree_ips p\<^sub>1" by (rule opnet_net_ips_net_tree_ips_init) moreover from tinit have "net_ips t = net_tree_ips p\<^sub>2" by (rule opnet_net_ips_net_tree_ips_init) ultimately show ?case by (auto elim: oreachable_init) next case (other \ s t \') hence "other U (net_tree_ips (p\<^sub>1 \ p\<^sub>2)) \ \'" and IHs: "(\, s) \ oreachable (opnet onp p\<^sub>1) (?S p\<^sub>1) (?U p\<^sub>1)" and IHt: "(\, t) \ oreachable (opnet onp p\<^sub>2) (?S p\<^sub>2) (?U p\<^sub>2)" and "net_tree_ips p\<^sub>1 \ net_tree_ips p\<^sub>2 = {}" by auto have "(\', s) \ oreachable (opnet onp p\<^sub>1) (?S p\<^sub>1) (?U p\<^sub>1)" proof - from \?U (p\<^sub>1 \ p\<^sub>2) \ \'\ and \\\. U \ \\ have "?U p\<^sub>1 \ \'" by (rule other_net_tree_ips_par_left) with IHs show ?thesis by - (erule(1) oreachable_other') qed moreover have "(\', t) \ oreachable (opnet onp p\<^sub>2) (?S p\<^sub>2) (?U p\<^sub>2)" proof - from \?U (p\<^sub>1 \ p\<^sub>2) \ \'\ and \\\. U \ \\ have "?U p\<^sub>2 \ \'" by (rule other_net_tree_ips_par_right) with IHt show ?thesis by - (erule(1) oreachable_other') qed ultimately show ?case using \net_tree_ips p\<^sub>1 \ net_tree_ips p\<^sub>2 = {}\ by simp next case (local \ s t \' s' t' a) hence stor: "(\, SubnetS s t) \ oreachable (opnet onp (p\<^sub>1 \ p\<^sub>2)) (?S (p\<^sub>1 \ p\<^sub>2)) (?U (p\<^sub>1 \ p\<^sub>2))" and tr: "((\, SubnetS s t), a, (\', SubnetS s' t')) \ trans (opnet onp (p\<^sub>1 \ p\<^sub>2))" and "?S (p\<^sub>1 \ p\<^sub>2) \ \' a" and sor: "(\, s) \ oreachable (opnet onp p\<^sub>1) (?S p\<^sub>1) (?U p\<^sub>1)" and tor: "(\, t) \ oreachable (opnet onp p\<^sub>2) (?S p\<^sub>2) (?U p\<^sub>2)" and "net_tree_ips p\<^sub>1 \ net_tree_ips p\<^sub>2 = {}" by auto have act: "\p. opnet onp p \\<^sub>A (\\ _. oarrivemsg I \, other U (net_tree_ips p) \) globala (\(\, a, \'). castmsg (I \) a \ (a \ \ \ (\i d. a \ i:deliver(d)) \ (\i\net_tree_ips p. S (\ i) (\' i))) \ (a = \ \ (\i d. a = i:deliver(d)) \ ((\i\net_tree_ips p. U (\ i) (\' i)) \ (\i. i\net_tree_ips p \ \' i = \ i))))" by (rule lift_opnet_sync_action [OF assms(3-6)]) from \?S (p\<^sub>1 \ p\<^sub>2) \ \' a\ have "\j. j \ net_tree_ips (p\<^sub>1 \ p\<^sub>2) \ S (\ j) (\' j)" and "oarrivemsg I \ a" by (auto elim!: otherwithE) from tr have "((\, SubnetS s t), a, (\', SubnetS s' t')) \ opnet_sos (trans (opnet onp p\<^sub>1)) (trans (opnet onp p\<^sub>2))" by simp hence "(\', s') \ oreachable (opnet onp p\<^sub>1) (?S p\<^sub>1) (?U p\<^sub>1) \ (\', t') \ oreachable (opnet onp p\<^sub>2) (?S p\<^sub>2) (?U p\<^sub>2)" proof (cases) fix H K m H' K' assume "a = (H \ H')\(K \ K'):arrive(m)" and str: "((\, s), H\K:arrive(m), (\', s')) \ trans (opnet onp p\<^sub>1)" and ttr: "((\, t), H'\K':arrive(m), (\', t')) \ trans (opnet onp p\<^sub>2)" from this(1) and \?S (p\<^sub>1 \ p\<^sub>2) \ \' a\ have "I \ m" by auto with sor str have "\i\net_tree_ips p\<^sub>1. S (\ i) (\' i)" by - (drule(1) ostep_arrive_invariantD [OF act], simp_all) moreover from \I \ m\ tor ttr have "\i\net_tree_ips p\<^sub>2. S (\ i) (\' i)" by - (drule(1) ostep_arrive_invariantD [OF act], simp_all) ultimately have "\i. S (\ i) (\' i)" using \\j. j \ net_tree_ips (p\<^sub>1 \ p\<^sub>2) \ S (\ j) (\' j)\ by auto with \I \ m\ sor str have "(\', s') \ oreachable (opnet onp p\<^sub>1) (?S p\<^sub>1) (?U p\<^sub>1)" by - (erule(1) oreachable_local, auto) moreover from \\i. S (\ i) (\' i)\ \I \ m\ tor ttr have "(\', t') \ oreachable (opnet onp p\<^sub>2) (?S p\<^sub>2) (?U p\<^sub>2)" by - (erule(1) oreachable_local, auto) ultimately show ?thesis .. next fix R m H K assume str: "((\, s), R:*cast(m), (\', s')) \ trans (opnet onp p\<^sub>1)" and ttr: "((\, t), H\K:arrive(m), (\', t')) \ trans (opnet onp p\<^sub>2)" from sor str have "I \ m" by - (drule(1) ostep_arrive_invariantD [OF act], simp_all) with sor str tor ttr have "\i. S (\ i) (\' i)" using \\j. j \ net_tree_ips (p\<^sub>1 \ p\<^sub>2) \ S (\ j) (\' j)\ by (fastforce dest!: ostep_arrive_invariantD [OF act] ostep_arrive_invariantD [OF act]) with \I \ m\ sor str have "(\', s') \ oreachable (opnet onp p\<^sub>1) (?S p\<^sub>1) (?U p\<^sub>1)" by - (erule(1) oreachable_local, auto) moreover from \\i. S (\ i) (\' i)\ \I \ m\ tor ttr have "(\', t') \ oreachable (opnet onp p\<^sub>2) (?S p\<^sub>2) (?U p\<^sub>2)" by - (erule(1) oreachable_local, auto) ultimately show ?thesis .. next fix R m H K assume str: "((\, s), H\K:arrive(m), (\', s')) \ trans (opnet onp p\<^sub>1)" and ttr: "((\, t), R:*cast(m), (\', t')) \ trans (opnet onp p\<^sub>2)" from tor ttr have "I \ m" by - (drule(1) ostep_arrive_invariantD [OF act], simp_all) with sor str tor ttr have "\i. S (\ i) (\' i)" using \\j. j \ net_tree_ips (p\<^sub>1 \ p\<^sub>2) \ S (\ j) (\' j)\ by (fastforce dest!: ostep_arrive_invariantD [OF act] ostep_arrive_invariantD [OF act]) with \I \ m\ sor str have "(\', s') \ oreachable (opnet onp p\<^sub>1) (?S p\<^sub>1) (?U p\<^sub>1)" by - (erule(1) oreachable_local, auto) moreover from \\i. S (\ i) (\' i)\ \I \ m\ tor ttr have "(\', t') \ oreachable (opnet onp p\<^sub>2) (?S p\<^sub>2) (?U p\<^sub>2)" by - (erule(1) oreachable_local, auto) ultimately show ?thesis .. next fix i i' assume str: "((\, s), connect(i, i'), (\', s')) \ trans (opnet onp p\<^sub>1)" and ttr: "((\, t), connect(i, i'), (\', t')) \ trans (opnet onp p\<^sub>2)" with sor tor have "\i. S (\ i) (\' i)" using \\j. j \ net_tree_ips (p\<^sub>1 \ p\<^sub>2) \ S (\ j) (\' j)\ by (fastforce dest!: ostep_arrive_invariantD [OF act] ostep_arrive_invariantD [OF act]) with sor str have "(\', s') \ oreachable (opnet onp p\<^sub>1) (?S p\<^sub>1) (?U p\<^sub>1)" by - (erule(1) oreachable_local, auto) moreover from \\i. S (\ i) (\' i)\ tor ttr have "(\', t') \ oreachable (opnet onp p\<^sub>2) (?S p\<^sub>2) (?U p\<^sub>2)" by - (erule(1) oreachable_local, auto) ultimately show ?thesis .. next fix i i' assume str: "((\, s), disconnect(i, i'), (\', s')) \ trans (opnet onp p\<^sub>1)" and ttr: "((\, t), disconnect(i, i'), (\', t')) \ trans (opnet onp p\<^sub>2)" with sor tor have "\i. S (\ i) (\' i)" using \\j. j \ net_tree_ips (p\<^sub>1 \ p\<^sub>2) \ S (\ j) (\' j)\ by (fastforce dest!: ostep_arrive_invariantD [OF act] ostep_arrive_invariantD [OF act]) with sor str have "(\', s') \ oreachable (opnet onp p\<^sub>1) (?S p\<^sub>1) (?U p\<^sub>1)" by - (erule(1) oreachable_local, auto) moreover from \\i. S (\ i) (\' i)\ tor ttr have "(\', t') \ oreachable (opnet onp p\<^sub>2) (?S p\<^sub>2) (?U p\<^sub>2)" by - (erule(1) oreachable_local, auto) ultimately show ?thesis .. next fix i d assume "t' = t" and str: "((\, s), i:deliver(d), (\', s')) \ trans (opnet onp p\<^sub>1)" from sor str have "\j. j\net_tree_ips p\<^sub>1 \ \' j = \ j" by - (drule(1) ostep_arrive_invariantD [OF act], simp_all) hence "\j. j\net_tree_ips p\<^sub>1 \ S (\ j) (\' j)" by (auto intro: \\\. S \ \\) with sor str have "(\', s') \ oreachable (opnet onp p\<^sub>1) (?S p\<^sub>1) (?U p\<^sub>1)" by - (erule(1) oreachable_local, auto) moreover have "(\', t') \ oreachable (opnet onp p\<^sub>2) (?S p\<^sub>2) (?U p\<^sub>2)" proof - from \\j. j\net_tree_ips p\<^sub>1 \ \' j = \ j\ and \net_tree_ips p\<^sub>1 \ net_tree_ips p\<^sub>2 = {}\ have "\j. j\net_tree_ips p\<^sub>2 \ \' j = \ j" by auto moreover from sor str have "\j\net_tree_ips p\<^sub>1. U (\ j) (\' j)" by - (drule(1) ostep_arrive_invariantD [OF act], simp_all) ultimately show ?thesis using tor \t' = t\ \\j. j \ net_tree_ips p\<^sub>1 \ \' j = \ j\ by (clarsimp elim!: oreachable_other') (metis otherI \\\. U \ \\)+ qed ultimately show ?thesis .. next fix i d assume "s' = s" and ttr: "((\, t), i:deliver(d), (\', t')) \ trans (opnet onp p\<^sub>2)" from tor ttr have "\j. j\net_tree_ips p\<^sub>2 \ \' j = \ j" by - (drule(1) ostep_arrive_invariantD [OF act], simp_all) hence "\j. j\net_tree_ips p\<^sub>2 \ S (\ j) (\' j)" by (auto intro: \\\. S \ \\) with tor ttr have "(\', t') \ oreachable (opnet onp p\<^sub>2) (?S p\<^sub>2) (?U p\<^sub>2)" by - (erule(1) oreachable_local, auto) moreover have "(\', s') \ oreachable (opnet onp p\<^sub>1) (?S p\<^sub>1) (?U p\<^sub>1)" proof - from \\j. j\net_tree_ips p\<^sub>2 \ \' j = \ j\ and \net_tree_ips p\<^sub>1 \ net_tree_ips p\<^sub>2 = {}\ have "\j. j\net_tree_ips p\<^sub>1 \ \' j = \ j" by auto moreover from tor ttr have "\j\net_tree_ips p\<^sub>2. U (\ j) (\' j)" by - (drule(1) ostep_arrive_invariantD [OF act], simp_all) ultimately show ?thesis using sor \s' = s\ \\j. j \ net_tree_ips p\<^sub>2 \ \' j = \ j\ by (clarsimp elim!: oreachable_other') (metis otherI \\\. U \ \\)+ qed ultimately show ?thesis by - (rule conjI) next assume "s' = s" and ttr: "((\, t), \, (\', t')) \ trans (opnet onp p\<^sub>2)" from tor ttr have "\j. j\net_tree_ips p\<^sub>2 \ \' j = \ j" by - (drule(1) ostep_arrive_invariantD [OF act], simp_all) hence "\j. j\net_tree_ips p\<^sub>2 \ S (\ j) (\' j)" by (auto intro: \\\. S \ \\) with tor ttr have "(\', t') \ oreachable (opnet onp p\<^sub>2) (?S p\<^sub>2) (?U p\<^sub>2)" by - (erule(1) oreachable_local, auto) moreover have "(\', s') \ oreachable (opnet onp p\<^sub>1) (?S p\<^sub>1) (?U p\<^sub>1)" proof - from \\j. j\net_tree_ips p\<^sub>2 \ \' j = \ j\ and \net_tree_ips p\<^sub>1 \ net_tree_ips p\<^sub>2 = {}\ have "\j. j\net_tree_ips p\<^sub>1 \ \' j = \ j" by auto moreover from tor ttr have "\j\net_tree_ips p\<^sub>2. U (\ j) (\' j)" by - (drule(1) ostep_arrive_invariantD [OF act], simp_all) ultimately show ?thesis using sor \s' = s\ \\j. j \ net_tree_ips p\<^sub>2 \ \' j = \ j\ by (clarsimp elim!: oreachable_other') (metis otherI \\\. U \ \\)+ qed ultimately show ?thesis by - (rule conjI) next assume "t' = t" and str: "((\, s), \, (\', s')) \ trans (opnet onp p\<^sub>1)" from sor str have "\j. j\net_tree_ips p\<^sub>1 \ \' j = \ j" by - (drule(1) ostep_arrive_invariantD [OF act], simp_all) hence "\j. j\net_tree_ips p\<^sub>1 \ S (\ j) (\' j)" by (auto intro: \\\. S \ \\) with sor str have "(\', s') \ oreachable (opnet onp p\<^sub>1) (?S p\<^sub>1) (?U p\<^sub>1)" by - (erule(1) oreachable_local, auto) moreover have "(\', t') \ oreachable (opnet onp p\<^sub>2) (?S p\<^sub>2) (?U p\<^sub>2)" proof - from \\j. j\net_tree_ips p\<^sub>1 \ \' j = \ j\ and \net_tree_ips p\<^sub>1 \ net_tree_ips p\<^sub>2 = {}\ have "\j. j\net_tree_ips p\<^sub>2 \ \' j = \ j" by auto moreover from sor str have "\j\net_tree_ips p\<^sub>1. U (\ j) (\' j)" by - (drule(1) ostep_arrive_invariantD [OF act], simp_all) ultimately show ?thesis using tor \t' = t\ \\j. j \ net_tree_ips p\<^sub>1 \ \' j = \ j\ by (clarsimp elim!: oreachable_other') (metis otherI \\\. U \ \\)+ qed ultimately show ?thesis .. qed with \net_tree_ips p\<^sub>1 \ net_tree_ips p\<^sub>2 = {}\ show ?case by simp qed lemmas subnet_oreachable1 [dest] = subnet_oreachable [THEN conjunct1, rotated 1] lemmas subnet_oreachable2 [dest] = subnet_oreachable [THEN conjunct2, THEN conjunct1, rotated 1] lemmas subnet_oreachable_disjoint [dest] = subnet_oreachable [THEN conjunct2, THEN conjunct2, rotated 1] corollary pnet_lift: assumes "\ii R\<^sub>i. \ii : onp ii : R\<^sub>i\\<^sub>o \ (otherwith S {ii} (oarrivemsg I), other U {ii} \) global (P ii)" and "\\. S \ \" and "\\. U \ \" and node1: "\i R. \i : onp i : R\\<^sub>o \\<^sub>A (\\ _. oarrivemsg I \, other U {i} \) globala (\(\, a, _). castmsg (I \) a)" and node2: "\i R. \i : onp i : R\\<^sub>o \\<^sub>A (\\ _. oarrivemsg I \, other U {i} \) globala (\(\, a, \'). (a \ \ \ (\d. a \ i:deliver(d)) \ S (\ i) (\' i)))" and node3: "\i R. \i : onp i : R\\<^sub>o \\<^sub>A (\\ _. oarrivemsg I \, other U {i} \) globala (\(\, a, \'). (a = \ \ (\d. a = i:deliver(d)) \ U (\ i) (\' i)))" shows "opnet onp p \ (otherwith S (net_tree_ips p) (oarrivemsg I), other U (net_tree_ips p) \) global (\\. \i\net_tree_ips p. P i \)" (is "_ \ (?owS p, ?U p \) _") proof (induction p) fix ii R\<^sub>i from assms(1) show "opnet onp \ii; R\<^sub>i\ \ (?owS \ii; R\<^sub>i\, ?U \ii; R\<^sub>i\ \) global (\\. \i\net_tree_ips \ii; R\<^sub>i\. P i \)" by auto next fix p\<^sub>1 p\<^sub>2 assume ih1: "opnet onp p\<^sub>1 \ (?owS p\<^sub>1, ?U p\<^sub>1 \) global (\\. \i\net_tree_ips p\<^sub>1. P i \)" and ih2: "opnet onp p\<^sub>2 \ (?owS p\<^sub>2, ?U p\<^sub>2 \) global (\\. \i\net_tree_ips p\<^sub>2. P i \)" show "opnet onp (p\<^sub>1 \ p\<^sub>2) \ (?owS (p\<^sub>1 \ p\<^sub>2), ?U (p\<^sub>1 \ p\<^sub>2) \) global (\\. \i\net_tree_ips (p\<^sub>1 \ p\<^sub>2). P i \)" unfolding oinvariant_def proof fix pq assume "pq \ oreachable (opnet onp (p\<^sub>1 \ p\<^sub>2)) (?owS (p\<^sub>1 \ p\<^sub>2)) (?U (p\<^sub>1 \ p\<^sub>2))" moreover then obtain \ s t where "pq = (\, SubnetS s t)" by (metis net_par_oreachable_is_subnet surjective_pairing) ultimately have "(\, SubnetS s t) \ oreachable (opnet onp (p\<^sub>1 \ p\<^sub>2)) (?owS (p\<^sub>1 \ p\<^sub>2)) (?U (p\<^sub>1 \ p\<^sub>2))" by simp then obtain sor: "(\, s) \ oreachable (opnet onp p\<^sub>1) (?owS p\<^sub>1) (?U p\<^sub>1)" and tor: "(\, t) \ oreachable (opnet onp p\<^sub>2) (?owS p\<^sub>2) (?U p\<^sub>2)" by - (drule subnet_oreachable [OF _ _ _ node1 node2 node3], auto intro: assms(2-3)) from sor have "\i\net_tree_ips p\<^sub>1. P i \" by (auto dest: oinvariantD [OF ih1]) moreover from tor have "\i\net_tree_ips p\<^sub>2. P i \" by (auto dest: oinvariantD [OF ih2]) ultimately have "\i\net_tree_ips (p\<^sub>1 \ p\<^sub>2). P i \" by auto with \pq = (\, SubnetS s t)\ show "global (\\. \i\net_tree_ips (p\<^sub>1 \ p\<^sub>2). P i \) pq" by simp qed qed end