(* Title: OInvariants.thy License: BSD 2-Clause. See LICENSE. Author: Timothy Bourke *) section "Open reachability and invariance" theory OInvariants imports Invariants begin subsection "Open reachability" text \ By convention, the states of an open automaton are pairs. The first component is considered to be the global state and the second is the local state. A state is `open reachable' under @{term S} and @{term U} if it is the initial state, or it is the destination of a transition---where the global components satisfy @{term S}---from an open reachable state, or it is the destination of an interleaved environment step where the global components satisfy @{term U}. \ inductive_set oreachable :: "('g \ 'l, 'a) automaton \ ('g \ 'g \ 'a \ bool) \ ('g \ 'g \ bool) \ ('g \ 'l) set" for A :: "('g \ 'l, 'a) automaton" and S :: "'g \ 'g \ 'a \ bool" and U :: "'g \ 'g \ bool" where oreachable_init: "s \ init A \ s \ oreachable A S U" | oreachable_local: "\ s \ oreachable A S U; (s, a, s') \ trans A; S (fst s) (fst s') a \ \ s' \ oreachable A S U" | oreachable_other: "\ s \ oreachable A S U; U (fst s) \' \ \ (\', snd s) \ oreachable A S U" lemma oreachable_local' [elim]: assumes "(\, p) \ oreachable A S U" and "((\, p), a, (\', p')) \ trans A" and "S \ \' a" shows "(\', p') \ oreachable A S U" using assms by (metis fst_conv oreachable.oreachable_local) lemma oreachable_other' [elim]: assumes "(\, p) \ oreachable A S U" and "U \ \'" shows "(\', p) \ oreachable A S U" proof - from \U \ \'\ have "U (fst (\, p)) \'" by simp with \(\, p) \ oreachable A S U\ have "(\', snd (\, p)) \ oreachable A S U" by (rule oreachable_other) thus "(\', p) \ oreachable A S U" by simp qed lemma oreachable_pair_induct [consumes, case_names init other local]: assumes "(\, p) \ oreachable A S U" and "\\ p. (\, p) \ init A \ P \ p" and "(\\ p \'. \ (\, p) \ oreachable A S U; P \ p; U \ \' \ \ P \' p)" and "(\\ p \' p' a. \ (\, p) \ oreachable A S U; P \ p; ((\, p), a, (\', p')) \ trans A; S \ \' a \ \ P \' p')" shows "P \ p" using assms (1) proof (induction "(\, p)" arbitrary: \ p) fix \ p assume "(\, p) \ init A" with assms(2) show "P \ p" . next fix s \' assume "s \ oreachable A S U" and "U (fst s) \'" and IH: "\\ p. s = (\, p) \ P \ p" from this(1) obtain \ p where "s = (\, p)" and "(\, p) \ oreachable A S U" by (metis surjective_pairing) note this(2) moreover from IH and \s = (\, p)\ have "P \ p" . moreover from \U (fst s) \'\ and \s = (\, p)\ have "U \ \'" by simp ultimately have "P \' p" by (rule assms(3)) with \s = (\, p)\ show "P \' (snd s)" by simp next fix s a \' p' assume "s \ oreachable A S U" and tr: "(s, a, (\', p')) \ trans A" and "S (fst s) (fst (\', p')) a" and IH: "\\ p. s = (\, p) \ P \ p" from this(1) obtain \ p where "s = (\, p)" and "(\, p) \ oreachable A S U" by (metis surjective_pairing) note this(2) moreover from IH \s = (\, p)\ have "P \ p" . moreover from tr and \s = (\, p)\ have "((\, p), a, (\', p')) \ trans A" by simp moreover from \S (fst s) (fst (\', p')) a\ and \s = (\, p)\ have "S \ \' a" by simp ultimately show "P \' p'" by (rule assms(4)) qed lemma oreachable_weakenE [elim]: assumes "s \ oreachable A PS PU" and PSQS: "\s s' a. PS s s' a \ QS s s' a" and PUQU: "\s s'. PU s s' \ QU s s'" shows "s \ oreachable A QS QU" using assms(1) proof (induction) fix s assume "s \ init A" thus "s \ oreachable A QS QU" .. next fix s a s' assume "s \ oreachable A QS QU" and "(s, a, s') \ trans A" and "PS (fst s) (fst s') a" from \PS (fst s) (fst s') a\ have "QS (fst s) (fst s') a" by (rule PSQS) with \s \ oreachable A QS QU\ and \(s, a, s') \ trans A\ show "s' \ oreachable A QS QU" .. next fix s g' assume "s \ oreachable A QS QU" and "PU (fst s) g'" from \PU (fst s) g'\ have "QU (fst s) g'" by (rule PUQU) with \s \ oreachable A QS QU\ show "(g', snd s) \ oreachable A QS QU" .. qed definition act :: "('a \ bool) \ 's \ 's \ 'a \ bool" where "act I \ (\_ _. I)" lemma act_simp [iff]: "act I s s' a = I a" unfolding act_def .. lemma reachable_in_oreachable [elim]: fixes s assumes "s \ reachable A I" shows "s \ oreachable A (act I) U" unfolding act_def using assms proof induction fix s assume "s \ init A" thus "s \ oreachable A (\_ _. I) U" .. next fix s a s' assume "s \ oreachable A (\_ _. I) U" and "(s, a, s') \ trans A" and "I a" thus "s' \ oreachable A (\_ _. I) U" by (rule oreachable_local) qed subsection "Open Invariance" definition oinvariant :: "('g \ 'l, 'a) automaton \ ('g \ 'g \ 'a \ bool) \ ('g \ 'g \ bool) \ (('g \ 'l) \ bool) \ bool" ("_ \ (1'((1_),/ (1_) \')/ _)" [100, 0, 0, 9] 8) where "(A \ (S, U \) P) = (\s\oreachable A S U. P s)" lemma oinvariantI [intro]: fixes T TI S U P assumes init: "\s. s \ init A \ P s" and other: "\g g' l. \ (g, l) \ oreachable A S U; P (g, l); U g g' \ \ P (g', l)" and local: "\s a s'. \ s \ oreachable A S U; P s; (s, a, s') \ trans A; S (fst s) (fst s') a \ \ P s'" shows "A \ (S, U \) P" unfolding oinvariant_def proof fix s assume "s \ oreachable A S U" thus "P s" proof induction fix s assume "s \ init A" thus "P s" by (rule init) next fix s a s' assume "s \ oreachable A S U" and "P s" and "(s, a, s') \ trans A" and "S (fst s) (fst s') a" thus "P s'" by (rule local) next fix s g' assume "s \ oreachable A S U" and "P s" and "U (fst s) g'" thus "P (g', snd s)" by - (rule other [where g="fst s"], simp_all) qed qed lemma oinvariant_oreachableI: assumes "\\ s. (\, s)\oreachable A S U \ P (\, s)" shows "A \ (S, U \) P" using assms unfolding oinvariant_def by auto lemma oinvariant_pairI [intro]: assumes init: "\\ p. (\, p) \ init A \ P (\, p)" and local: "\\ p \' p' a. \ (\, p) \ oreachable A S U; P (\, p); ((\, p), a, (\', p')) \ trans A; S \ \' a \ \ P (\', p')" and other: "\\ \' p. \ (\, p) \ oreachable A S U; P (\, p); U \ \' \ \ P (\', p)" shows "A \ (S, U \) P" by (rule oinvariantI) (clarsimp | erule init | erule(3) local | erule(2) other)+ lemma oinvariantD [dest]: assumes "A \ (S, U \) P" and "s \ oreachable A S U" shows "P s" using assms unfolding oinvariant_def by clarsimp lemma oinvariant_initD [dest, elim]: assumes invP: "A \ (S, U \) P" and init: "s \ init A" shows "P s" proof - from init have "s \ oreachable A S U" .. with invP show ?thesis .. qed lemma oinvariant_weakenE [elim!]: assumes invP: "A \ (PS, PU \) P" and PQ: "\s. P s \ Q s" and QSPS: "\s s' a. QS s s' a \ PS s s' a" and QUPU: "\s s'. QU s s' \ PU s s'" shows "A \ (QS, QU \) Q" proof fix s assume "s \ init A" with invP have "P s" .. thus "Q s" by (rule PQ) next fix \ p \' p' a assume "(\, p) \ oreachable A QS QU" and "((\, p), a, (\', p')) \ trans A" and "QS \ \' a" from this(3) have "PS \ \' a" by (rule QSPS) from \(\, p) \ oreachable A QS QU\ and QSPS QUPU have "(\, p) \ oreachable A PS PU" .. hence "(\', p') \ oreachable A PS PU" using \((\, p), a, (\', p')) \ trans A\ and \PS \ \' a\ .. with invP have "P (\', p')" .. thus "Q (\', p')" by (rule PQ) next fix \ \' p assume "(\, p) \ oreachable A QS QU" and "Q (\, p)" and "QU \ \'" from \QU \ \'\ have "PU \ \'" by (rule QUPU) from \(\, p) \ oreachable A QS QU\ and QSPS QUPU have "(\, p) \ oreachable A PS PU" .. hence "(\', p) \ oreachable A PS PU" using \PU \ \'\ .. with invP have "P (\', p)" .. thus "Q (\', p)" by (rule PQ) qed lemma oinvariant_weakenD [dest]: assumes "A \ (S', U' \) P" and "(\, p) \ oreachable A S U" and weakenS: "\s s' a. S s s' a \ S' s s' a" and weakenU: "\s s'. U s s' \ U' s s'" shows "P (\, p)" proof - from \(\, p) \ oreachable A S U\ have "(\, p) \ oreachable A S' U'" by (rule oreachable_weakenE) (erule weakenS, erule weakenU) with \A \ (S', U' \) P\ show "P (\, p)" .. qed lemma close_open_invariant: assumes oinv: "A \ (act I, U \) P" shows "A \ (I \) P" proof fix s assume "s \ init A" with oinv show "P s" .. next fix \ p \' p' a assume sr: "(\, p) \ reachable A I" and step: "((\, p), a, (\', p')) \ trans A" and "I a" hence "(\', p') \ reachable A I" .. hence "(\', p') \ oreachable A (act I) U" .. with oinv show "P (\', p')" .. qed definition local_steps :: "((('i \ 's1) \ 'l1) \ 'a \ ('i \ 's2) \ 'l2) set \ 'i set \ bool" where "local_steps T J \ (\\ \ s a \' s'. ((\, s), a, (\', s')) \ T \ (\j\J. \ j = \ j) \ (\\'. (\j\J. \' j = \' j) \ ((\, s), a, (\', s')) \ T))" lemma local_stepsI [intro!]: assumes "\\ \ s a \' \' s'. \ ((\, s), a, (\', s')) \ T; \j\J. \ j = \ j \ \ (\\'. (\j\J. \' j = \' j) \ ((\, s), a, (\', s')) \ T)" shows "local_steps T J" unfolding local_steps_def using assms by clarsimp lemma local_stepsE [elim, dest]: assumes "local_steps T J" and "((\, s), a, (\', s')) \ T" and "\j\J. \ j = \ j" shows "\\'. (\j\J. \' j = \' j) \ ((\, s), a, (\', s')) \ T" using assms unfolding local_steps_def by blast definition other_steps :: "(('i \ 's) \ ('i \ 's) \ bool) \ 'i set \ bool" where "other_steps U J \ \\ \'. U \ \' \ (\j\J. \' j = \ j)" lemma other_stepsI [intro!]: assumes "\\ \' j. \ U \ \'; j \ J \ \ \' j = \ j" shows "other_steps U J" using assms unfolding other_steps_def by simp lemma other_stepsE [elim]: assumes "other_steps U J" and "U \ \'" shows "\j\J. \' j = \ j" using assms unfolding other_steps_def by simp definition subreachable where "subreachable A U J \ \I. \s \ oreachable A (\s s'. I) U. (\\. (\j\J. \ j = (fst s) j) \ (\, snd s) \ reachable A I)" lemma subreachableI [intro]: assumes "local_steps (trans A) J" and "other_steps U J" shows "subreachable A U J" unfolding subreachable_def proof (rule, rule) fix I s assume "s \ oreachable A (\s s'. I) U" thus "(\\. (\j\J. \ j = (fst s) j) \ (\, snd s) \ reachable A I)" proof induction fix s assume "s \ init A" hence "(fst s, snd s) \ reachable A I" by simp (rule reachable_init) moreover have "\j\J. (fst s) j = (fst s) j" by simp ultimately show "\\. (\j\J. \ j = (fst s) j) \ (\, snd s) \ reachable A I" by auto next fix s a s' assume "\\. (\j\J. \ j = (fst s) j) \ (\, snd s) \ reachable A I" and "(s, a, s') \ trans A" and "I a" then obtain \ where "\j\J. \ j = (fst s) j" and "(\, snd s) \ reachable A I" by auto from \(s, a, s') \ trans A\ have "((fst s, snd s), a, (fst s', snd s')) \ trans A" by simp with \local_steps (trans A) J\ obtain \' where "\j\J. \' j = (fst s') j" and "((\, snd s), a, (\', snd s')) \ trans A" using \\j\J. \ j = (fst s) j\ by - (drule(2) local_stepsE, clarsimp) from \(\, snd s) \ reachable A I\ and \((\, snd s), a, (\', snd s')) \ trans A\ and \I a\ have "(\', snd s') \ reachable A I" .. with \\j\J. \' j = (fst s') j\ show "\\. (\j\J. \ j = (fst s') j) \ (\, snd s') \ reachable A I" by auto next fix s \' assume "\\. (\j\J. \ j = (fst s) j) \ (\, snd s) \ reachable A I" and "U (fst s) \'" then obtain \ where "\j\J. \ j = (fst s) j" and "(\, snd s) \ reachable A I" by auto from \other_steps U J\ and \U (fst s) \'\ have "\j\J. \' j = (fst s) j" by - (erule(1) other_stepsE) with \\j\J. \ j = (fst s) j\ have "\j\J. \ j = \' j" by clarsimp with \(\, snd s) \ reachable A I\ show "\\. (\j\J. \ j = fst (\', snd s) j) \ (\, snd (\', snd s)) \ reachable A I" by auto qed qed lemma subreachableE [elim]: assumes "subreachable A U J" and "s \ oreachable A (\s s'. I) U" shows "\\. (\j\J. \ j = (fst s) j) \ (\, snd s) \ reachable A I" using assms unfolding subreachable_def by simp lemma subreachableE_pair [elim]: assumes "subreachable A U J" and "(\, s) \ oreachable A (\s s'. I) U" shows "\\. (\j\J. \ j = \ j) \ (\, s) \ reachable A I" using assms unfolding subreachable_def by (metis fst_conv snd_conv) lemma subreachable_otherE [elim]: assumes "subreachable A U J" and "(\, l) \ oreachable A (\s s'. I) U" and "U \ \'" shows "\\'. (\j\J. \' j = \' j) \ (\', l) \ reachable A I" proof - from \(\, l) \ oreachable A (\s s'. I) U\ and \U \ \'\ have "(\', l) \ oreachable A (\s s'. I) U" by - (rule oreachable_other') with \subreachable A U J\ show ?thesis by auto qed lemma open_closed_invariant: fixes J assumes "A \ (I \) P" and "subreachable A U J" and localp: "\\ \' s. \ \j\J. \' j = \ j; P (\', s) \ \ P (\, s)" shows "A \ (act I, U \) P" proof (rule, simp_all only: act_def) fix s assume "s \ init A" with \A \ (I \) P\ show "P s" .. next fix s a s' assume "s \ oreachable A (\_ _. I) U" and "P s" and "(s, a, s') \ trans A" and "I a" hence "s' \ oreachable A (\_ _. I) U" by (metis oreachable_local) with \subreachable A U J\ obtain \' where "\j\J. \' j = (fst s') j" and "(\', snd s') \ reachable A I" by (metis subreachableE) from \A \ (I \) P\ and \(\', snd s') \ reachable A I\ have "P (\', snd s')" .. with \\j\J. \' j = (fst s') j\ show "P s'" by (metis localp prod.collapse) next fix g g' l assume or: "(g, l) \ oreachable A (\s s'. I) U" and "U g g'" and "P (g, l)" from \subreachable A U J\ and or and \U g g'\ obtain gg' where "\j\J. gg' j = g' j" and "(gg', l) \ reachable A I" by (auto dest!: subreachable_otherE) from \A \ (I \) P\ and \(gg', l) \ reachable A I\ have "P (gg', l)" .. with \\j\J. gg' j = g' j\ show "P (g', l)" by (rule localp) qed lemma oinvariant_anyact: assumes "A \ (act TT, U \) P" shows "A \ (S, U \) P" using assms by rule auto definition ostep_invariant :: "('g \ 'l, 'a) automaton \ ('g \ 'g \ 'a \ bool) \ ('g \ 'g \ bool) \ (('g \ 'l, 'a) transition \ bool) \ bool" ("_ \\<^sub>A (1'((1_),/ (1_) \')/ _)" [100, 0, 0, 9] 8) where "(A \\<^sub>A (S, U \) P) = (\s\oreachable A S U. (\a s'. (s, a, s') \ trans A \ S (fst s) (fst s') a \ P (s, a, s')))" lemma ostep_invariant_def': "(A \\<^sub>A (S, U \) P) = (\s\oreachable A S U. (\a s'. (s, a, s') \ trans A \ S (fst s) (fst s') a \ P (s, a, s')))" unfolding ostep_invariant_def by auto lemma ostep_invariantI [intro]: assumes *: "\\ s a \' s'. \ (\, s)\oreachable A S U; ((\, s), a, (\', s')) \ trans A; S \ \' a \ \ P ((\, s), a, (\', s'))" shows "A \\<^sub>A (S, U \) P" unfolding ostep_invariant_def using assms by auto lemma ostep_invariantD [dest]: assumes "A \\<^sub>A (S, U \) P" and "(\, s)\oreachable A S U" and "((\, s), a, (\', s')) \ trans A" and "S \ \' a" shows "P ((\, s), a, (\', s'))" using assms unfolding ostep_invariant_def' by clarsimp lemma ostep_invariantE [elim]: assumes "A \\<^sub>A (S, U \) P" and "(\, s)\oreachable A S U" and "((\, s), a, (\', s')) \ trans A" and "S \ \' a" and "P ((\, s), a, (\', s')) \ Q" shows "Q" using assms by auto lemma ostep_invariant_weakenE [elim!]: assumes invP: "A \\<^sub>A (PS, PU \) P" and PQ: "\t. P t \ Q t" and QSPS: "\\ \' a. QS \ \' a \ PS \ \' a" and QUPU: "\\ \'. QU \ \' \ PU \ \'" shows "A \\<^sub>A (QS, QU \) Q" proof fix \ s \' s' a assume "(\, s) \ oreachable A QS QU" and "((\, s), a, (\', s')) \ trans A" and "QS \ \' a" from \QS \ \' a\ have "PS \ \' a" by (rule QSPS) from \(\, s) \ oreachable A QS QU\ have "(\, s) \ oreachable A PS PU" using QSPS QUPU .. with invP have "P ((\, s), a, (\', s'))" using \((\, s), a, (\', s')) \ trans A\ \PS \ \' a\ .. thus "Q ((\, s), a, (\', s'))" by (rule PQ) qed lemma ostep_invariant_weaken_with_invariantE [elim]: assumes pinv: "A \ (S, U \) P" and qinv: "A \\<^sub>A (S, U \) Q" and wr: "\\ s a \' s'. \ P (\, s); P (\', s'); Q ((\, s), a, (\', s')); S \ \' a \ \ R ((\, s), a, (\', s'))" shows "A \\<^sub>A (S, U \) R" proof fix \ s a \' s' assume sr: "(\, s) \ oreachable A S U" and tr: "((\, s), a, (\', s')) \ trans A" and "S \ \' a" hence "(\', s') \ oreachable A S U" .. with pinv have "P (\', s')" .. from pinv and sr have "P (\, s)" .. from qinv sr tr \S \ \' a\ have "Q ((\, s), a, (\', s'))" .. with \P (\, s)\ and \P (\', s')\ show "R ((\, s), a, (\', s'))" using \S \ \' a\ by (rule wr) qed lemma ostep_to_invariantI: assumes sinv: "A \\<^sub>A (S, U \) Q" and init: "\\ s. (\, s) \ init A \ P (\, s)" and local: "\\ s \' s' a. \ (\, s) \ oreachable A S U; P (\, s); Q ((\, s), a, (\', s')); S \ \' a \ \ P (\', s')" and other: "\\ \' s. \ (\, s) \ oreachable A S U; U \ \'; P (\, s) \ \ P (\', s)" shows "A \ (S, U \) P" proof fix \ s assume "(\, s) \ init A" thus "P (\, s)" by (rule init) next fix \ s \' s' a assume "(\, s) \ oreachable A S U" and "P (\, s)" and "((\, s), a, (\', s')) \ trans A" and "S \ \' a" show "P (\', s')" proof - from sinv and \(\, s)\oreachable A S U\ and \((\, s), a, (\', s')) \ trans A\ and \S \ \' a\ have "Q ((\, s), a, (\', s'))" .. with \(\, s)\oreachable A S U\ and \P (\, s)\ show "P (\', s')" using \S \ \' a\ by (rule local) qed next fix \ \' l assume "(\, l) \ oreachable A S U" and "U \ \'" and "P (\, l)" thus "P (\', l)" by (rule other) qed lemma open_closed_step_invariant: assumes "A \\<^sub>A (I \) P" and "local_steps (trans A) J" and "other_steps U J" and localp: "\\ \ a \' \' s s'. \ \j\J. \ j = \ j; \j\J. \' j = \' j; P ((\, s), a, (\', s')) \ \ P ((\, s), a, (\', s'))" shows "A \\<^sub>A (act I, U \) P" proof fix \ s a \' s' assume or: "(\, s) \ oreachable A (act I) U" and tr: "((\, s), a, (\', s')) \ trans A" and "act I \ \' a" from \act I \ \' a\ have "I a" .. from \local_steps (trans A) J\ and \other_steps U J\ have "subreachable A U J" .. then obtain \ where "\j\J. \ j = \ j" and "(\, s) \ reachable A I" using or unfolding act_def by (auto dest!: subreachableE_pair) from \local_steps (trans A) J\ and tr and \\j\J. \ j = \ j\ obtain \' where "\j\J. \' j = \' j" and "((\, s), a, (\', s')) \ trans A" by auto from \A \\<^sub>A (I \) P\ and \(\, s) \ reachable A I\ and \((\, s), a, (\', s')) \ trans A\ and \I a\ have "P ((\, s), a, (\', s'))" .. with \\j\J. \ j = \ j\ and \\j\J. \' j = \' j\ show "P ((\, s), a, (\', s'))" by (rule localp) qed lemma oinvariant_step_anyact: assumes "p \\<^sub>A (act TT, U \) P" shows "p \\<^sub>A (S, U \) P" using assms by rule auto subsection "Standard assumption predicates " text \otherwith\ definition otherwith :: "('s \ 's \ bool) \ 'i set \ (('i \ 's) \ 'a \ bool) \ ('i \ 's) \ ('i \ 's) \ 'a \ bool" where "otherwith Q I P \ \' a \ (\i. i\I \ Q (\ i) (\' i)) \ P \ a" lemma otherwithI [intro]: assumes other: "\j. j\I \ Q (\ j) (\' j)" and sync: "P \ a" shows "otherwith Q I P \ \' a" unfolding otherwith_def using assms by simp lemma otherwithE [elim]: assumes "otherwith Q I P \ \' a" and "\ P \ a; \j. j\I \ Q (\ j) (\' j) \ \ R \ \' a" shows "R \ \' a" using assms unfolding otherwith_def by simp lemma otherwith_actionD [dest]: assumes "otherwith Q I P \ \' a" shows "P \ a" using assms by auto lemma otherwith_syncD [dest]: assumes "otherwith Q I P \ \' a" shows "\j. j\I \ Q (\ j) (\' j)" using assms by auto lemma otherwithEI [elim]: assumes "otherwith P I PO \ \' a" and "\\ a. PO \ a \ QO \ a" shows "otherwith P I QO \ \' a" using assms(1) unfolding otherwith_def by (clarsimp elim!: assms(2)) lemma all_but: assumes "\\. S \ \" and "\' i = \ i" and "\j. j \ i \ S (\ j) (\' j)" shows "\j. S (\ j) (\' j)" using assms by metis lemma all_but_eq [dest]: assumes "\' i = \ i" and "\j. j \ i \ \ j = \' j" shows "\ = \'" using assms by - (rule ext, metis) text \other\ definition other :: "('s \ 's \ bool) \ 'i set \ ('i \ 's) \ ('i \ 's) \ bool" where "other P I \ \' \ \i. if i\I then \' i = \ i else P (\ i) (\' i)" lemma otherI [intro]: assumes local: "\i. i\I \ \' i = \ i" and other: "\j. j\I \ P (\ j) (\' j)" shows "other P I \ \'" using assms unfolding other_def by clarsimp lemma otherE [elim]: assumes "other P I \ \'" and "\ \i\I. \' i = \ i; \j. j\I \ P (\ j) (\' j) \ \ R \ \'" shows "R \ \'" using assms unfolding other_def by simp lemma other_localD [dest]: "other P {i} \ \' \ \' i = \ i" by auto lemma other_otherD [dest]: "other P {i} \ \' \ \j. j\i \ P (\ j) (\' j)" by auto lemma other_bothE [elim]: assumes "other P {i} \ \'" obtains "\' i = \ i" and "\j. j\i \ P (\ j) (\' j)" using assms by auto lemma weaken_local [elim]: assumes "other P I \ \'" and PQ: "\\ \'. P \ \' \ Q \ \'" shows "other Q I \ \'" using assms unfolding other_def by auto definition global :: "((nat \ 's) \ bool) \ (nat \ 's) \ 'local \ bool" where "global P \ (\(\, _). P \)" lemma globalsimp [simp]: "global P s = P (fst s)" unfolding global_def by (simp split: prod.split) definition globala :: "((nat \ 's, 'action) transition \ bool) \ ((nat \ 's) \ 'local, 'action) transition \ bool" where "globala P \ (\((\, _), a, (\', _)). P (\, a, \'))" lemma globalasimp [simp]: "globala P s = P (fst (fst s), fst (snd s), fst (snd (snd s)))" unfolding globala_def by (simp split: prod.split) end