| author | paulson | 
| Sun, 15 Feb 2004 10:46:37 +0100 | |
| changeset 14387 | e96d5c42c4b0 | 
| parent 14101 | d25c23e46173 | 
| child 16417 | 9bc16273c2d4 | 
| permissions | -rw-r--r-- | 
| 7186 | 1 | (* Title: HOL/UNITY/Lift_prog.thy | 
| 2 | ID: $Id$ | |
| 3 | Author: Lawrence C Paulson, Cambridge University Computer Laboratory | |
| 4 | Copyright 1999 University of Cambridge | |
| 5 | ||
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 6 | lift_prog, etc: replication of components and arrays of processes. | 
| 7186 | 7 | *) | 
| 8 | ||
| 13798 | 9 | header{*Replication of Components*}
 | 
| 10 | ||
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 11 | theory Lift_prog = Rename: | 
| 7186 | 12 | |
| 13 | constdefs | |
| 14 | ||
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8122diff
changeset | 15 | insert_map :: "[nat, 'b, nat=>'b] => (nat=>'b)" | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8122diff
changeset | 16 | "insert_map i z f k == if k<i then f k | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8122diff
changeset | 17 | else if k=i then z | 
| 11701 
3d51fbf81c17
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
 wenzelm parents: 
10834diff
changeset | 18 | else f(k - 1)" | 
| 7186 | 19 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8122diff
changeset | 20 | delete_map :: "[nat, nat=>'b] => (nat=>'b)" | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8122diff
changeset | 21 | "delete_map i g k == if k<i then g k else g (Suc k)" | 
| 7186 | 22 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8122diff
changeset | 23 | lift_map :: "[nat, 'b * ((nat=>'b) * 'c)] => (nat=>'b) * 'c" | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8122diff
changeset | 24 | "lift_map i == %(s,(f,uu)). (insert_map i s f, uu)" | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8122diff
changeset | 25 | |
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8122diff
changeset | 26 | drop_map :: "[nat, (nat=>'b) * 'c] => 'b * ((nat=>'b) * 'c)" | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8122diff
changeset | 27 | "drop_map i == %(g, uu). (g i, (delete_map i g, uu))" | 
| 7186 | 28 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8122diff
changeset | 29 |   lift_set :: "[nat, ('b * ((nat=>'b) * 'c)) set] => ((nat=>'b) * 'c) set"
 | 
| 10834 | 30 | "lift_set i A == lift_map i ` A" | 
| 7186 | 31 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8122diff
changeset | 32 |   lift :: "[nat, ('b * ((nat=>'b) * 'c)) program] => ((nat=>'b) * 'c) program"
 | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8122diff
changeset | 33 | "lift i == rename (lift_map i)" | 
| 7186 | 34 | |
| 35 | (*simplifies the expression of specifications*) | |
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 36 | sub :: "['a, 'a=>'b] => 'b" | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 37 | "sub == %i f. f i" | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 38 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 39 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 40 | declare insert_map_def [simp] delete_map_def [simp] | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 41 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 42 | lemma insert_map_inverse: "delete_map i (insert_map i x f) = f" | 
| 13798 | 43 | by (rule ext, simp) | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 44 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 45 | lemma insert_map_delete_map_eq: "(insert_map i x (delete_map i g)) = g(i:=x)" | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 46 | apply (rule ext) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 47 | apply (auto split add: nat_diff_split) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 48 | done | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 49 | |
| 13812 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 paulson parents: 
13805diff
changeset | 50 | subsection{*Injectiveness proof*}
 | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 51 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 52 | lemma insert_map_inject1: "(insert_map i x f) = (insert_map i y g) ==> x=y" | 
| 13798 | 53 | by (drule_tac x = i in fun_cong, simp) | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 54 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 55 | lemma insert_map_inject2: "(insert_map i x f) = (insert_map i y g) ==> f=g" | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 56 | apply (drule_tac f = "delete_map i" in arg_cong) | 
| 13798 | 57 | apply (simp add: insert_map_inverse) | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 58 | done | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 59 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 60 | lemma insert_map_inject': | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 61 | "(insert_map i x f) = (insert_map i y g) ==> x=y & f=g" | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 62 | by (blast dest: insert_map_inject1 insert_map_inject2) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 63 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 64 | lemmas insert_map_inject = insert_map_inject' [THEN conjE, elim!] | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 65 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 66 | (*The general case: we don't assume i=i'*) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 67 | lemma lift_map_eq_iff [iff]: | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 68 | "(lift_map i (s,(f,uu)) = lift_map i' (s',(f',uu'))) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 69 | = (uu = uu' & insert_map i s f = insert_map i' s' f')" | 
| 13798 | 70 | by (unfold lift_map_def, auto) | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 71 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 72 | (*The !!s allows the automatic splitting of the bound variable*) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 73 | lemma drop_map_lift_map_eq [simp]: "!!s. drop_map i (lift_map i s) = s" | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 74 | apply (unfold lift_map_def drop_map_def) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 75 | apply (force intro: insert_map_inverse) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 76 | done | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 77 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 78 | lemma inj_lift_map: "inj (lift_map i)" | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 79 | apply (unfold lift_map_def) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 80 | apply (rule inj_onI, auto) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 81 | done | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 82 | |
| 13812 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 paulson parents: 
13805diff
changeset | 83 | subsection{*Surjectiveness proof*}
 | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 84 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 85 | lemma lift_map_drop_map_eq [simp]: "!!s. lift_map i (drop_map i s) = s" | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 86 | apply (unfold lift_map_def drop_map_def) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 87 | apply (force simp add: insert_map_delete_map_eq) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 88 | done | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 89 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 90 | lemma drop_map_inject [dest!]: "(drop_map i s) = (drop_map i s') ==> s=s'" | 
| 13798 | 91 | by (drule_tac f = "lift_map i" in arg_cong, simp) | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 92 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 93 | lemma surj_lift_map: "surj (lift_map i)" | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 94 | apply (rule surjI) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 95 | apply (rule lift_map_drop_map_eq) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 96 | done | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 97 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 98 | lemma bij_lift_map [iff]: "bij (lift_map i)" | 
| 13798 | 99 | by (simp add: bij_def inj_lift_map surj_lift_map) | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 100 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 101 | lemma inv_lift_map_eq [simp]: "inv (lift_map i) = drop_map i" | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 102 | by (rule inv_equality, auto) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 103 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 104 | lemma inv_drop_map_eq [simp]: "inv (drop_map i) = lift_map i" | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 105 | by (rule inv_equality, auto) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 106 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 107 | lemma bij_drop_map [iff]: "bij (drop_map i)" | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 108 | by (simp del: inv_lift_map_eq add: inv_lift_map_eq [symmetric] bij_imp_bij_inv) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 109 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 110 | (*sub's main property!*) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 111 | lemma sub_apply [simp]: "sub i f = f i" | 
| 13798 | 112 | by (simp add: sub_def) | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 113 | |
| 13812 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 paulson parents: 
13805diff
changeset | 114 | lemma all_total_lift: "all_total F ==> all_total (lift i F)" | 
| 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 paulson parents: 
13805diff
changeset | 115 | by (simp add: lift_def rename_def Extend.all_total_extend) | 
| 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 paulson parents: 
13805diff
changeset | 116 | |
| 13836 | 117 | lemma insert_map_upd_same: "(insert_map i t f)(i := s) = insert_map i s f" | 
| 118 | by (rule ext, auto) | |
| 119 | ||
| 120 | lemma insert_map_upd: | |
| 121 | "(insert_map j t f)(i := s) = | |
| 122 | (if i=j then insert_map i s f | |
| 123 | else if i<j then insert_map j t (f(i:=s)) | |
| 124 | else insert_map j t (f(i - Suc 0 := s)))" | |
| 125 | apply (rule ext) | |
| 126 | apply (simp split add: nat_diff_split) | |
| 127 |  txt{*This simplification is VERY slow*}
 | |
| 128 | done | |
| 129 | ||
| 130 | lemma insert_map_eq_diff: | |
| 131 | "[| insert_map i s f = insert_map j t g; i\<noteq>j |] | |
| 132 | ==> \<exists>g'. insert_map i s' f = insert_map j t g'" | |
| 133 | apply (subst insert_map_upd_same [symmetric]) | |
| 134 | apply (erule ssubst) | |
| 135 | apply (simp only: insert_map_upd if_False split: split_if, blast) | |
| 136 | done | |
| 137 | ||
| 138 | lemma lift_map_eq_diff: | |
| 139 | "[| lift_map i (s,(f,uu)) = lift_map j (t,(g,vv)); i\<noteq>j |] | |
| 140 | ==> \<exists>g'. lift_map i (s',(f,uu)) = lift_map j (t,(g',vv))" | |
| 141 | apply (unfold lift_map_def, auto) | |
| 142 | apply (blast dest: insert_map_eq_diff) | |
| 143 | done | |
| 144 | ||
| 13812 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 paulson parents: 
13805diff
changeset | 145 | |
| 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 paulson parents: 
13805diff
changeset | 146 | subsection{*The Operator @{term lift_set}*}
 | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 147 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 148 | lemma lift_set_empty [simp]: "lift_set i {} = {}"
 | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 149 | by (unfold lift_set_def, auto) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 150 | |
| 13805 | 151 | lemma lift_set_iff: "(lift_map i x \<in> lift_set i A) = (x \<in> A)" | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 152 | apply (unfold lift_set_def) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 153 | apply (rule inj_lift_map [THEN inj_image_mem_iff]) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 154 | done | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 155 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 156 | (*Do we really need both this one and its predecessor?*) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 157 | lemma lift_set_iff2 [iff]: | 
| 13805 | 158 | "((f,uu) \<in> lift_set i A) = ((f i, (delete_map i f, uu)) \<in> A)" | 
| 13798 | 159 | by (simp add: lift_set_def mem_rename_set_iff drop_map_def) | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 160 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 161 | |
| 13805 | 162 | lemma lift_set_mono: "A \<subseteq> B ==> lift_set i A \<subseteq> lift_set i B" | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 163 | apply (unfold lift_set_def) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 164 | apply (erule image_mono) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 165 | done | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 166 | |
| 13805 | 167 | lemma lift_set_Un_distrib: "lift_set i (A \<union> B) = lift_set i A \<union> lift_set i B" | 
| 13812 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 paulson parents: 
13805diff
changeset | 168 | by (simp add: lift_set_def image_Un) | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 169 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 170 | lemma lift_set_Diff_distrib: "lift_set i (A-B) = lift_set i A - lift_set i B" | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 171 | apply (unfold lift_set_def) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 172 | apply (rule inj_lift_map [THEN image_set_diff]) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 173 | done | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 174 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 175 | |
| 13812 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 paulson parents: 
13805diff
changeset | 176 | subsection{*The Lattice Operations*}
 | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 177 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 178 | lemma bij_lift [iff]: "bij (lift i)" | 
| 13798 | 179 | by (simp add: lift_def) | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 180 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 181 | lemma lift_SKIP [simp]: "lift i SKIP = SKIP" | 
| 13798 | 182 | by (simp add: lift_def) | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 183 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 184 | lemma lift_Join [simp]: "lift i (F Join G) = lift i F Join lift i G" | 
| 13798 | 185 | by (simp add: lift_def) | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 186 | |
| 13805 | 187 | lemma lift_JN [simp]: "lift j (JOIN I F) = (\<Squnion>i \<in> I. lift j (F i))" | 
| 13798 | 188 | by (simp add: lift_def) | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 189 | |
| 13812 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 paulson parents: 
13805diff
changeset | 190 | subsection{*Safety: constrains, stable, invariant*}
 | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 191 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 192 | lemma lift_constrains: | 
| 13805 | 193 | "(lift i F \<in> (lift_set i A) co (lift_set i B)) = (F \<in> A co B)" | 
| 13798 | 194 | by (simp add: lift_def lift_set_def rename_constrains) | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 195 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 196 | lemma lift_stable: | 
| 13805 | 197 | "(lift i F \<in> stable (lift_set i A)) = (F \<in> stable A)" | 
| 13798 | 198 | by (simp add: lift_def lift_set_def rename_stable) | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 199 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 200 | lemma lift_invariant: | 
| 13805 | 201 | "(lift i F \<in> invariant (lift_set i A)) = (F \<in> invariant A)" | 
| 13812 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 paulson parents: 
13805diff
changeset | 202 | by (simp add: lift_def lift_set_def rename_invariant) | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 203 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 204 | lemma lift_Constrains: | 
| 13805 | 205 | "(lift i F \<in> (lift_set i A) Co (lift_set i B)) = (F \<in> A Co B)" | 
| 13812 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 paulson parents: 
13805diff
changeset | 206 | by (simp add: lift_def lift_set_def rename_Constrains) | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 207 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 208 | lemma lift_Stable: | 
| 13805 | 209 | "(lift i F \<in> Stable (lift_set i A)) = (F \<in> Stable A)" | 
| 13812 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 paulson parents: 
13805diff
changeset | 210 | by (simp add: lift_def lift_set_def rename_Stable) | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 211 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 212 | lemma lift_Always: | 
| 13805 | 213 | "(lift i F \<in> Always (lift_set i A)) = (F \<in> Always A)" | 
| 13812 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 paulson parents: 
13805diff
changeset | 214 | by (simp add: lift_def lift_set_def rename_Always) | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 215 | |
| 13812 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 paulson parents: 
13805diff
changeset | 216 | subsection{*Progress: transient, ensures*}
 | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 217 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 218 | lemma lift_transient: | 
| 13805 | 219 | "(lift i F \<in> transient (lift_set i A)) = (F \<in> transient A)" | 
| 13798 | 220 | by (simp add: lift_def lift_set_def rename_transient) | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 221 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 222 | lemma lift_ensures: | 
| 13805 | 223 | "(lift i F \<in> (lift_set i A) ensures (lift_set i B)) = | 
| 224 | (F \<in> A ensures B)" | |
| 13798 | 225 | by (simp add: lift_def lift_set_def rename_ensures) | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 226 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 227 | lemma lift_leadsTo: | 
| 13805 | 228 | "(lift i F \<in> (lift_set i A) leadsTo (lift_set i B)) = | 
| 229 | (F \<in> A leadsTo B)" | |
| 13798 | 230 | by (simp add: lift_def lift_set_def rename_leadsTo) | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 231 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 232 | lemma lift_LeadsTo: | 
| 13805 | 233 | "(lift i F \<in> (lift_set i A) LeadsTo (lift_set i B)) = | 
| 234 | (F \<in> A LeadsTo B)" | |
| 13798 | 235 | by (simp add: lift_def lift_set_def rename_LeadsTo) | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 236 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 237 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 238 | (** guarantees **) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 239 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 240 | lemma lift_lift_guarantees_eq: | 
| 13805 | 241 | "(lift i F \<in> (lift i ` X) guarantees (lift i ` Y)) = | 
| 242 | (F \<in> X guarantees Y)" | |
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 243 | apply (unfold lift_def) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 244 | apply (subst bij_lift_map [THEN rename_rename_guarantees_eq, symmetric]) | 
| 13798 | 245 | apply (simp add: o_def) | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 246 | done | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 247 | |
| 13812 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 paulson parents: 
13805diff
changeset | 248 | lemma lift_guarantees_eq_lift_inv: | 
| 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 paulson parents: 
13805diff
changeset | 249 | "(lift i F \<in> X guarantees Y) = | 
| 13805 | 250 | (F \<in> (rename (drop_map i) ` X) guarantees (rename (drop_map i) ` Y))" | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 251 | by (simp add: bij_lift_map [THEN rename_guarantees_eq_rename_inv] lift_def) | 
| 7186 | 252 | |
| 253 | ||
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 254 | (*To preserve snd means that the second component is there just to allow | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 255 | guarantees properties to be stated. Converse fails, for lift i F can | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 256 | change function components other than i*) | 
| 13805 | 257 | lemma lift_preserves_snd_I: "F \<in> preserves snd ==> lift i F \<in> preserves snd" | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 258 | apply (drule_tac w1=snd in subset_preserves_o [THEN subsetD]) | 
| 13798 | 259 | apply (simp add: lift_def rename_preserves) | 
| 14101 | 260 | apply (simp add: lift_map_def o_def split_def del: split_comp_eq) | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 261 | done | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 262 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 263 | lemma delete_map_eqE': | 
| 13805 | 264 | "(delete_map i g) = (delete_map i g') ==> \<exists>x. g = g'(i:=x)" | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 265 | apply (drule_tac f = "insert_map i (g i) " in arg_cong) | 
| 13798 | 266 | apply (simp add: insert_map_delete_map_eq) | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 267 | apply (erule exI) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 268 | done | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 269 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 270 | lemmas delete_map_eqE = delete_map_eqE' [THEN exE, elim!] | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 271 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 272 | lemma delete_map_neq_apply: | 
| 13805 | 273 | "[| delete_map j g = delete_map j g'; i\<noteq>j |] ==> g i = g' i" | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 274 | by force | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 275 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 276 | (*A set of the form (A <*> UNIV) ignores the second (dummy) state component*) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 277 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 278 | lemma vimage_o_fst_eq [simp]: "(f o fst) -` A = (f-`A) <*> UNIV" | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 279 | by auto | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 280 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 281 | lemma vimage_sub_eq_lift_set [simp]: | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 282 | "(sub i -`A) <*> UNIV = lift_set i (A <*> UNIV)" | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 283 | by auto | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 284 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 285 | lemma mem_lift_act_iff [iff]: | 
| 13805 | 286 | "((s,s') \<in> extend_act (%(x,u::unit). lift_map i x) act) = | 
| 287 | ((drop_map i s, drop_map i s') \<in> act)" | |
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 288 | apply (unfold extend_act_def, auto) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 289 | apply (rule bexI, auto) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 290 | done | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 291 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 292 | lemma preserves_snd_lift_stable: | 
| 13805 | 293 | "[| F \<in> preserves snd; i\<noteq>j |] | 
| 294 | ==> lift j F \<in> stable (lift_set i (A <*> UNIV))" | |
| 13798 | 295 | apply (auto simp add: lift_def lift_set_def stable_def constrains_def | 
| 296 | rename_def extend_def mem_rename_set_iff) | |
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 297 | apply (auto dest!: preserves_imp_eq simp add: lift_map_def drop_map_def) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 298 | apply (drule_tac x = i in fun_cong, auto) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 299 | done | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 300 | |
| 13805 | 301 | (*If i\<noteq>j then lift j F does nothing to lift_set i, and the | 
| 302 | premise ensures A \<subseteq> B.*) | |
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 303 | lemma constrains_imp_lift_constrains: | 
| 13805 | 304 | "[| F i \<in> (A <*> UNIV) co (B <*> UNIV); | 
| 305 | F j \<in> preserves snd |] | |
| 306 | ==> lift j (F j) \<in> (lift_set i (A <*> UNIV)) co (lift_set i (B <*> UNIV))" | |
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 307 | apply (case_tac "i=j") | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 308 | apply (simp add: lift_def lift_set_def rename_constrains) | 
| 13798 | 309 | apply (erule preserves_snd_lift_stable[THEN stableD, THEN constrains_weaken_R], | 
| 310 | assumption) | |
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 311 | apply (erule constrains_imp_subset [THEN lift_set_mono]) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 312 | done | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 313 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 314 | (*USELESS??*) | 
| 13812 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 paulson parents: 
13805diff
changeset | 315 | lemma lift_map_image_Times: | 
| 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 paulson parents: 
13805diff
changeset | 316 | "lift_map i ` (A <*> UNIV) = | 
| 13805 | 317 |       (\<Union>s \<in> A. \<Union>f. {insert_map i s f}) <*> UNIV"
 | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 318 | apply (auto intro!: bexI image_eqI simp add: lift_map_def) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 319 | apply (rule split_conv [symmetric]) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 320 | done | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 321 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 322 | lemma lift_preserves_eq: | 
| 13805 | 323 | "(lift i F \<in> preserves v) = (F \<in> preserves (v o lift_map i))" | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 324 | by (simp add: lift_def rename_preserves) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 325 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 326 | (*A useful rewrite. If o, sub have been rewritten out already then can also | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 327 | use it as rewrite_rule [sub_def, o_def] lift_preserves_sub*) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 328 | lemma lift_preserves_sub: | 
| 13805 | 329 | "F \<in> preserves snd | 
| 330 | ==> lift i F \<in> preserves (v o sub j o fst) = | |
| 331 | (if i=j then F \<in> preserves (v o fst) else True)" | |
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 332 | apply (drule subset_preserves_o [THEN subsetD]) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 333 | apply (simp add: lift_preserves_eq o_def drop_map_lift_map_eq) | 
| 13798 | 334 | apply (auto cong del: if_weak_cong | 
| 14101 | 335 | simp add: lift_map_def eq_commute split_def o_def simp del:split_comp_eq) | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 336 | done | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 337 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 338 | |
| 13812 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 paulson parents: 
13805diff
changeset | 339 | subsection{*Lemmas to Handle Function Composition (o) More Consistently*}
 | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 340 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 341 | (*Lets us prove one version of a theorem and store others*) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 342 | lemma o_equiv_assoc: "f o g = h ==> f' o f o g = f' o h" | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 343 | by (simp add: expand_fun_eq o_def) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 344 | |
| 13805 | 345 | lemma o_equiv_apply: "f o g = h ==> \<forall>x. f(g x) = h x" | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 346 | by (simp add: expand_fun_eq o_def) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 347 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 348 | lemma fst_o_lift_map: "sub i o fst o lift_map i = fst" | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 349 | apply (rule ext) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 350 | apply (auto simp add: o_def lift_map_def sub_def) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 351 | done | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 352 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 353 | lemma snd_o_lift_map: "snd o lift_map i = snd o snd" | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 354 | apply (rule ext) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 355 | apply (auto simp add: o_def lift_map_def) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 356 | done | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 357 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 358 | |
| 13812 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 paulson parents: 
13805diff
changeset | 359 | subsection{*More lemmas about extend and project*}
 | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 360 | |
| 13812 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 paulson parents: 
13805diff
changeset | 361 | text{*They could be moved to theory Extend or Project*}
 | 
| 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 paulson parents: 
13805diff
changeset | 362 | |
| 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 paulson parents: 
13805diff
changeset | 363 | lemma extend_act_extend_act: | 
| 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 paulson parents: 
13805diff
changeset | 364 | "extend_act h' (extend_act h act) = | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 365 | extend_act (%(x,(y,y')). h'(h(x,y),y')) act" | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 366 | apply (auto elim!: rev_bexI simp add: extend_act_def, blast) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 367 | done | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 368 | |
| 13812 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 paulson parents: 
13805diff
changeset | 369 | lemma project_act_project_act: | 
| 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 paulson parents: 
13805diff
changeset | 370 | "project_act h (project_act h' act) = | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 371 | project_act (%(x,(y,y')). h'(h(x,y),y')) act" | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 372 | by (auto elim!: rev_bexI simp add: project_act_def) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 373 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 374 | lemma project_act_extend_act: | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 375 | "project_act h (extend_act h' act) = | 
| 13805 | 376 |         {(x,x'). \<exists>s s' y y' z. (s,s') \<in> act &  
 | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 377 | h(x,y) = h'(s,z) & h(x',y') = h'(s',z)}" | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 378 | by (simp add: extend_act_def project_act_def, blast) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 379 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 380 | |
| 13812 
91713a1915ee
converting HOL/UNITY to use unconditional fairness
 paulson parents: 
13805diff
changeset | 381 | subsection{*OK and "lift"*}
 | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 382 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 383 | lemma act_in_UNION_preserves_fst: | 
| 13805 | 384 |      "act \<subseteq> {(x,x'). fst x = fst x'} ==> act \<in> UNION (preserves fst) Acts"
 | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 385 | apply (rule_tac a = "mk_program (UNIV,{act},UNIV) " in UN_I)
 | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 386 | apply (auto simp add: preserves_def stable_def constrains_def) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 387 | done | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 388 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 389 | lemma UNION_OK_lift_I: | 
| 13805 | 390 | "[| \<forall>i \<in> I. F i \<in> preserves snd; | 
| 391 | \<forall>i \<in> I. UNION (preserves fst) Acts \<subseteq> AllowedActs (F i) |] | |
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 392 | ==> OK I (%i. lift i (F i))" | 
| 13790 | 393 | apply (auto simp add: OK_def lift_def rename_def Extend.Acts_extend) | 
| 13798 | 394 | apply (simp add: Extend.AllowedActs_extend project_act_extend_act) | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 395 | apply (rename_tac "act") | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 396 | apply (subgoal_tac | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 397 |        "{(x, x'). \<exists>s f u s' f' u'. 
 | 
| 13805 | 398 | ((s, f, u), s', f', u') \<in> act & | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 399 | lift_map j x = lift_map i (s, f, u) & | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 400 | lift_map j x' = lift_map i (s', f', u') } | 
| 13805 | 401 |                 \<subseteq> { (x,x') . fst x = fst x'}")
 | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 402 | apply (blast intro: act_in_UNION_preserves_fst, clarify) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 403 | apply (drule_tac x = j in fun_cong)+ | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 404 | apply (drule_tac x = i in bspec, assumption) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 405 | apply (frule preserves_imp_eq, auto) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 406 | done | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 407 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 408 | lemma OK_lift_I: | 
| 13805 | 409 | "[| \<forall>i \<in> I. F i \<in> preserves snd; | 
| 410 | \<forall>i \<in> I. preserves fst \<subseteq> Allowed (F i) |] | |
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 411 | ==> OK I (%i. lift i (F i))" | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 412 | by (simp add: safety_prop_AllowedActs_iff_Allowed UNION_OK_lift_I) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 413 | |
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 414 | lemma Allowed_lift [simp]: "Allowed (lift i F) = lift i ` (Allowed F)" | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 415 | by (simp add: lift_def Allowed_rename) | 
| 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 416 | |
| 13790 | 417 | lemma lift_image_preserves: | 
| 418 | "lift i ` preserves v = preserves (v o drop_map i)" | |
| 13798 | 419 | by (simp add: rename_image_preserves lift_def inv_lift_map_eq) | 
| 13786 
ab8f39f48a6f
More conversion of UNITY to Isar new-style theories
 paulson parents: 
11701diff
changeset | 420 | |
| 7186 | 421 | end |