| author | wenzelm | 
| Mon, 24 Jul 2000 23:51:46 +0200 | |
| changeset 9422 | 4b6bc2b347e5 | 
| parent 9403 | aad13b59b8d9 | 
| child 10064 | 1a77667b21ef | 
| permissions | -rw-r--r-- | 
| 7186 | 1 | (* Title: HOL/UNITY/Lift_prog.ML | 
| 2 | ID: $Id$ | |
| 3 | Author: Lawrence C Paulson, Cambridge University Computer Laboratory | |
| 4 | Copyright 1998 University of Cambridge | |
| 7482 | 5 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 6 | Arrays of processes. | 
| 7186 | 7 | *) | 
| 8 | ||
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 9 | Addsimps [insert_map_def, delete_map_def]; | 
| 7186 | 10 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 11 | Goal "delete_map i (insert_map i x f) = f"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 12 | by (rtac ext 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 13 | by (Simp_tac 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 14 | qed "insert_map_inverse"; | 
| 7186 | 15 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 16 | Goal "(insert_map i x (delete_map i g)) = g(i:=x)"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 17 | by (rtac ext 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 18 | by (auto_tac (claset(), simpset() addsplits [nat_diff_split])); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 19 | qed "insert_map_delete_map_eq"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 20 | |
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 21 | (*** Injectiveness proof ***) | 
| 7186 | 22 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 23 | Goal "(insert_map i x f) = (insert_map i y g) ==> x=y"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 24 | by (dres_inst_tac [("x","i")] fun_cong 1);
 | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 25 | by (Full_simp_tac 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 26 | qed "insert_map_inject1"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 27 | |
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 28 | Goal "(insert_map i x f) = (insert_map i y g) ==> f=g"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 29 | by (dres_inst_tac [("f", "delete_map i")] arg_cong 1);
 | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 30 | by (full_simp_tac (simpset() addsimps [insert_map_inverse]) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 31 | qed "insert_map_inject2"; | 
| 7186 | 32 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 33 | Goal "(insert_map i x f) = (insert_map i y g) ==> x=y & f=g"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 34 | by (blast_tac (claset() addDs [insert_map_inject1, insert_map_inject2]) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 35 | bind_thm ("insert_map_inject", result() RS conjE);
 | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 36 | AddSEs [insert_map_inject]; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 37 | |
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 38 | (*The general case: we don't assume i=i'*) | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 39 | Goalw [lift_map_def] | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 40 | "(lift_map i (s,(f,uu)) = lift_map i' (s',(f',uu'))) \ | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 41 | \ = (uu = uu' & insert_map i s f = insert_map i' s' f')"; | 
| 7525 | 42 | by Auto_tac; | 
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 43 | qed "lift_map_eq_iff"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 44 | AddIffs [lift_map_eq_iff]; | 
| 7186 | 45 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 46 | Goalw [lift_map_def, drop_map_def] "!!s. drop_map i (lift_map i s) = s"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 47 | by (force_tac (claset() addIs [insert_map_inverse], simpset()) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 48 | qed "drop_map_lift_map_eq"; | 
| 9403 
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
 paulson parents: 
8948diff
changeset | 49 | Addsimps [drop_map_lift_map_eq]; | 
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 50 | |
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 51 | Goalw [lift_map_def] "inj (lift_map i)"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 52 | by (rtac injI 1); | 
| 7688 | 53 | by Auto_tac; | 
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 54 | qed "inj_lift_map"; | 
| 7688 | 55 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 56 | (*** Surjectiveness proof ***) | 
| 7186 | 57 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 58 | Goalw [lift_map_def, drop_map_def] "!!s. lift_map i (drop_map i s) = s"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 59 | by (force_tac (claset(), simpset() addsimps [insert_map_delete_map_eq]) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 60 | qed "lift_map_drop_map_eq"; | 
| 9403 
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
 paulson parents: 
8948diff
changeset | 61 | Addsimps [lift_map_drop_map_eq]; | 
| 7186 | 62 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 63 | Goal "(drop_map i s) = (drop_map i s') ==> s=s'"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 64 | by (dres_inst_tac [("f", "lift_map i")] arg_cong 1);
 | 
| 9403 
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
 paulson parents: 
8948diff
changeset | 65 | by (Full_simp_tac 1); | 
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 66 | qed "drop_map_inject"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 67 | AddSDs [drop_map_inject]; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 68 | |
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 69 | Goal "surj (lift_map i)"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 70 | by (rtac surjI 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 71 | by (rtac lift_map_drop_map_eq 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 72 | qed "surj_lift_map"; | 
| 7186 | 73 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 74 | Goal "bij (lift_map i)"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 75 | by (simp_tac (simpset() addsimps [bij_def, inj_lift_map, surj_lift_map]) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 76 | qed "bij_lift_map"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 77 | AddIffs [bij_lift_map]; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 78 | |
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 79 | Goal "inv (lift_map i) = drop_map i"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 80 | by (rtac inv_equality 1); | 
| 9403 
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
 paulson parents: 
8948diff
changeset | 81 | by Auto_tac; | 
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 82 | qed "inv_lift_map_eq"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 83 | Addsimps [inv_lift_map_eq]; | 
| 7688 | 84 | |
| 8311 
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
 paulson parents: 
8251diff
changeset | 85 | Goal "inv (drop_map i) = lift_map i"; | 
| 
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
 paulson parents: 
8251diff
changeset | 86 | by (rtac inv_equality 1); | 
| 9403 
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
 paulson parents: 
8948diff
changeset | 87 | by Auto_tac; | 
| 8311 
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
 paulson parents: 
8251diff
changeset | 88 | qed "inv_drop_map_eq"; | 
| 
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
 paulson parents: 
8251diff
changeset | 89 | Addsimps [inv_drop_map_eq]; | 
| 
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
 paulson parents: 
8251diff
changeset | 90 | |
| 
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
 paulson parents: 
8251diff
changeset | 91 | Goal "bij (drop_map i)"; | 
| 
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
 paulson parents: 
8251diff
changeset | 92 | by (simp_tac (simpset() delsimps [inv_lift_map_eq] | 
| 
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
 paulson parents: 
8251diff
changeset | 93 | addsimps [inv_lift_map_eq RS sym, bij_imp_bij_inv]) 1); | 
| 
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
 paulson parents: 
8251diff
changeset | 94 | qed "bij_drop_map"; | 
| 
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
 paulson parents: 
8251diff
changeset | 95 | AddIffs [bij_drop_map]; | 
| 
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
 paulson parents: 
8251diff
changeset | 96 | |
| 9403 
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
 paulson parents: 
8948diff
changeset | 97 | (*sub's main property!*) | 
| 7947 | 98 | Goal "sub i f = f i"; | 
| 99 | by (simp_tac (simpset() addsimps [sub_def]) 1); | |
| 100 | qed "sub_apply"; | |
| 101 | Addsimps [sub_apply]; | |
| 7688 | 102 | |
| 9403 
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
 paulson parents: 
8948diff
changeset | 103 | (*** lift_set ***) | 
| 7688 | 104 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 105 | Goalw [lift_set_def] "lift_set i {} = {}";
 | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 106 | by Auto_tac; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 107 | qed "lift_set_empty"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 108 | Addsimps [lift_set_empty]; | 
| 7688 | 109 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 110 | Goalw [lift_set_def] "(lift_map i x : lift_set i A) = (x : A)"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 111 | by (rtac (inj_lift_map RS inj_image_mem_iff) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 112 | qed "lift_set_iff"; | 
| 7186 | 113 | |
| 8311 
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
 paulson parents: 
8251diff
changeset | 114 | (*Do we really need both this one and its predecessor?*) | 
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 115 | Goal "((f,uu) : lift_set i A) = ((f i, (delete_map i f, uu)) : A)"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 116 | by (asm_simp_tac (simpset() addsimps [lift_set_def, | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 117 | mem_rename_set_iff, drop_map_def]) 1); | 
| 8311 
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
 paulson parents: 
8251diff
changeset | 118 | qed "lift_set_iff2"; | 
| 
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
 paulson parents: 
8251diff
changeset | 119 | AddIffs [lift_set_iff2]; | 
| 7525 | 120 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 121 | Goalw [lift_set_def] "A<=B ==> lift_set i A <= lift_set i B"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 122 | by (etac image_mono 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 123 | qed "lift_set_mono"; | 
| 7525 | 124 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 125 | Goalw [lift_set_def] "lift_set i (A Un B) = lift_set i A Un lift_set i B"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 126 | by (asm_simp_tac (simpset() addsimps [image_Un]) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 127 | qed "lift_set_Un_distrib"; | 
| 7525 | 128 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 129 | Goalw [lift_set_def] "lift_set i (A-B) = lift_set i A - lift_set i B"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 130 | by (rtac (inj_lift_map RS image_set_diff) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 131 | qed "lift_set_Diff_distrib"; | 
| 7525 | 132 | |
| 133 | ||
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 134 | (*** the lattice operations ***) | 
| 7525 | 135 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 136 | Goalw [lift_def] "lift i SKIP = SKIP"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 137 | by (Asm_simp_tac 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 138 | qed "lift_SKIP"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 139 | Addsimps [lift_SKIP]; | 
| 7525 | 140 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 141 | Goalw [lift_def] "lift i (F Join G) = lift i F Join lift i G"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 142 | by (Asm_simp_tac 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 143 | qed "lift_Join"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 144 | Addsimps [lift_Join]; | 
| 7688 | 145 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 146 | Goalw [lift_def] "lift j (JOIN I F) = (JN i:I. lift j (F i))"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 147 | by (Asm_simp_tac 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 148 | qed "lift_JN"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 149 | Addsimps [lift_JN]; | 
| 7525 | 150 | |
| 7186 | 151 | (*** Safety: co, stable, invariant ***) | 
| 152 | ||
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 153 | Goalw [lift_def, lift_set_def] | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 154 | "(lift i F : (lift_set i A) co (lift_set i B)) = (F : A co B)"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 155 | by (asm_simp_tac (simpset() addsimps [rename_constrains]) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 156 | qed "lift_constrains"; | 
| 7826 
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
 paulson parents: 
7688diff
changeset | 157 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 158 | Goalw [lift_def, lift_set_def] | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 159 | "(lift i F : stable (lift_set i A)) = (F : stable A)"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 160 | by (asm_simp_tac (simpset() addsimps [rename_stable]) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 161 | qed "lift_stable"; | 
| 7186 | 162 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 163 | Goalw [lift_def, lift_set_def] | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 164 | "(lift i F : invariant (lift_set i A)) = (F : invariant A)"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 165 | by (asm_simp_tac (simpset() addsimps [rename_invariant]) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 166 | qed "lift_invariant"; | 
| 7186 | 167 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 168 | Goalw [lift_def, lift_set_def] | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 169 | "(lift i F : (lift_set i A) Co (lift_set i B)) = (F : A Co B)"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 170 | by (asm_simp_tac (simpset() addsimps [rename_Constrains]) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 171 | qed "lift_Constrains"; | 
| 7186 | 172 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 173 | Goalw [lift_def, lift_set_def] | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 174 | "(lift i F : Stable (lift_set i A)) = (F : Stable A)"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 175 | by (asm_simp_tac (simpset() addsimps [rename_Stable]) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 176 | qed "lift_Stable"; | 
| 7186 | 177 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 178 | Goalw [lift_def, lift_set_def] | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 179 | "(lift i F : Always (lift_set i A)) = (F : Always A)"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 180 | by (asm_simp_tac (simpset() addsimps [rename_Always]) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 181 | qed "lift_Always"; | 
| 7361 | 182 | |
| 7525 | 183 | (*** Progress: transient, ensures ***) | 
| 184 | ||
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 185 | Goalw [lift_def, lift_set_def] | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 186 | "(lift i F : transient (lift_set i A)) = (F : transient A)"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 187 | by (asm_simp_tac (simpset() addsimps [rename_transient]) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 188 | qed "lift_transient"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 189 | |
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 190 | Goalw [lift_def, lift_set_def] | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 191 | "(lift i F : (lift_set i A) ensures (lift_set i B)) = \ | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 192 | \ (F : A ensures B)"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 193 | by (asm_simp_tac (simpset() addsimps [rename_ensures]) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 194 | qed "lift_ensures"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 195 | |
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 196 | Goalw [lift_def, lift_set_def] | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 197 | "(lift i F : (lift_set i A) leadsTo (lift_set i B)) = \ | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 198 | \ (F : A leadsTo B)"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 199 | by (asm_simp_tac (simpset() addsimps [rename_leadsTo]) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 200 | qed "lift_leadsTo"; | 
| 7525 | 201 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 202 | Goalw [lift_def, lift_set_def] | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 203 | "(lift i F : (lift_set i A) LeadsTo (lift_set i B)) = \ | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 204 | \ (F : A LeadsTo B)"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 205 | by (asm_simp_tac (simpset() addsimps [rename_LeadsTo]) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 206 | qed "lift_LeadsTo"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 207 | |
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 208 | |
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 209 | (** guarantees **) | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 210 | |
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 211 | Goalw [lift_def] | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 212 | "(lift i F : (lift i `` X) guarantees[v o drop_map i] (lift i `` Y)) = \ | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 213 | \ (F : X guarantees[v] Y)"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 214 | by (stac (bij_lift_map RS rename_rename_guarantees_eq RS sym) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 215 | by (asm_simp_tac (simpset() addsimps [o_def]) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 216 | qed "lift_lift_guarantees_eq"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 217 | |
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 218 | Goal "(lift i F : X guarantees[v] Y) = \ | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 219 | \ (F : (rename (drop_map i) `` X) guarantees[v o lift_map i] \ | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 220 | \ (rename (drop_map i) `` Y))"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 221 | by (asm_simp_tac | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 222 | (simpset() addsimps [bij_lift_map RS rename_guarantees_eq_rename_inv, | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 223 | lift_def]) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 224 | qed "lift_guarantees_eq_lift_inv"; | 
| 7525 | 225 | |
| 226 | ||
| 9403 
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
 paulson parents: 
8948diff
changeset | 227 | (*** We devote an ENORMOUS effort to proving lift_transient_eq_disj, | 
| 
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
 paulson parents: 
8948diff
changeset | 228 | which is used only in TimerArray and perhaps isn't even essential | 
| 
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
 paulson parents: 
8948diff
changeset | 229 | there! | 
| 
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
 paulson parents: 
8948diff
changeset | 230 | ***) | 
| 
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
 paulson parents: 
8948diff
changeset | 231 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 232 | (*To preserve snd means that the second component is there just to allow | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 233 | guarantees properties to be stated. Converse fails, for lift i F can | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 234 | change function components other than i*) | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 235 | Goal "F : preserves snd ==> lift i F : preserves snd"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 236 | by (dres_inst_tac [("w1", "snd")] (impOfSubs subset_preserves_o) 1);
 | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 237 | by (asm_simp_tac (simpset() addsimps [lift_def, rename_preserves]) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 238 | by (full_simp_tac (simpset() addsimps [lift_map_def, o_def, split_def]) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 239 | qed "lift_preserves_snd_I"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 240 | |
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 241 | Goal "(delete_map i g) = (delete_map i g') ==> EX x. g = g'(i:=x)"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 242 | by (dres_inst_tac [("f", "insert_map i (g i)")] arg_cong 1);
 | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 243 | by (full_simp_tac (simpset() addsimps [insert_map_delete_map_eq]) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 244 | by (etac exI 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 245 | bind_thm ("delete_map_eqE", result() RS exE);
 | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 246 | AddSEs [delete_map_eqE]; | 
| 7186 | 247 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 248 | Goal "[| delete_map j g = delete_map j g'; i~=j |] ==> g i = g' i"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 249 | by (Force_tac 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 250 | qed "delete_map_neq_apply"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 251 | |
| 8703 | 252 | (*A set of the form (A <*> UNIV) ignores the second (dummy) state component*) | 
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 253 | |
| 8703 | 254 | Goal "(f o fst) -`` A = (f-``A) <*> UNIV"; | 
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 255 | by Auto_tac; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 256 | qed "vimage_o_fst_eq"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 257 | |
| 8703 | 258 | Goal "(sub i -``A) <*> UNIV = lift_set i (A <*> UNIV)"; | 
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 259 | by Auto_tac; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 260 | qed "vimage_sub_eq_lift_set"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 261 | |
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 262 | Addsimps [vimage_o_fst_eq, vimage_sub_eq_lift_set]; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 263 | |
| 9403 
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
 paulson parents: 
8948diff
changeset | 264 | Goalw [extend_act_def] | 
| 
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
 paulson parents: 
8948diff
changeset | 265 | "((s,s') : extend_act (%(x,u::unit). lift_map i x) act) = \ | 
| 
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
 paulson parents: 
8948diff
changeset | 266 | \ ((drop_map i s, drop_map i s') : act)"; | 
| 
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
 paulson parents: 
8948diff
changeset | 267 | by Auto_tac; | 
| 
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
 paulson parents: 
8948diff
changeset | 268 | by (rtac bexI 1); | 
| 
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
 paulson parents: 
8948diff
changeset | 269 | by Auto_tac; | 
| 
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
 paulson parents: 
8948diff
changeset | 270 | qed "mem_lift_act_iff"; | 
| 
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
 paulson parents: 
8948diff
changeset | 271 | AddIffs [mem_lift_act_iff]; | 
| 
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
 paulson parents: 
8948diff
changeset | 272 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 273 | Goal "[| F : preserves snd; i~=j |] \ | 
| 8703 | 274 | \ ==> lift j F : stable (lift_set i (A <*> UNIV))"; | 
| 8065 
658e0d4e4ed9
first working version to Alloc/System_Client_Progress;
 paulson parents: 
8055diff
changeset | 275 | by (auto_tac (claset(), | 
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 276 | simpset() addsimps [lift_def, lift_set_def, | 
| 9403 
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
 paulson parents: 
8948diff
changeset | 277 | stable_def, constrains_def, rename_def, | 
| 
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
 paulson parents: 
8948diff
changeset | 278 | extend_def, mem_rename_set_iff])); | 
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 279 | by (auto_tac (claset() addSDs [preserves_imp_eq], | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 280 | simpset() addsimps [lift_map_def, drop_map_def])); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 281 | by (dres_inst_tac [("x", "i")] fun_cong 1);
 | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 282 | by Auto_tac; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 283 | qed "preserves_snd_lift_stable"; | 
| 8065 
658e0d4e4ed9
first working version to Alloc/System_Client_Progress;
 paulson parents: 
8055diff
changeset | 284 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 285 | (*If i~=j then lift j F does nothing to lift_set i, and the | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 286 | premise ensures A<=B.*) | 
| 8703 | 287 | Goal "[| F i : (A <*> UNIV) co (B <*> UNIV); \ | 
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 288 | \ F j : preserves snd |] \ | 
| 8703 | 289 | \ ==> lift j (F j) : (lift_set i (A <*> UNIV)) co (lift_set i (B <*> UNIV))"; | 
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 290 | by (case_tac "i=j" 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 291 | by (asm_full_simp_tac (simpset() addsimps [lift_def, lift_set_def, | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 292 | rename_constrains]) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 293 | by (etac (preserves_snd_lift_stable RS stableD RS constrains_weaken_R) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 294 | by (assume_tac 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 295 | by (etac (constrains_imp_subset RS lift_set_mono) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 296 | qed "constrains_imp_lift_constrains"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 297 | |
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 298 | (** Lemmas for the transient theorem **) | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 299 | |
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 300 | Goal "(insert_map i t f)(i := s) = insert_map i s f"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 301 | by (rtac ext 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 302 | by Auto_tac; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 303 | qed "insert_map_upd_same"; | 
| 8055 
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
 paulson parents: 
8041diff
changeset | 304 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 305 | Goal "(insert_map j t f)(i := s) = \ | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 306 | \ (if i=j then insert_map i s f \ | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 307 | \ else if i<j then insert_map j t (f(i:=s)) \ | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 308 | \ else insert_map j t (f(i-1:=s)))"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 309 | by (rtac ext 1); | 
| 8866 | 310 | by (auto_tac (claset(), simpset() addsplits [nat_diff_split])); | 
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 311 | by (ALLGOALS arith_tac); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 312 | qed "insert_map_upd"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 313 | |
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 314 | Goal "[| insert_map i s f = insert_map j t g; i~=j |] \ | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 315 | \ ==> EX g'. insert_map i s' f = insert_map j t g'"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 316 | by (stac (insert_map_upd_same RS sym) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 317 | by (etac ssubst 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 318 | by (asm_simp_tac (HOL_ss addsimps [insert_map_upd]) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 319 | by (Blast_tac 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 320 | qed "insert_map_eq_diff"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 321 | |
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 322 | Goalw [lift_map_def] | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 323 | "[| lift_map i (s,(f,uu)) = lift_map j (t,(g,vv)); i~=j |] \ | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 324 | \ ==> EX g'. lift_map i (s',(f,uu)) = lift_map j (t,(g',vv))"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 325 | by Auto_tac; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 326 | by (blast_tac (claset() addDs [insert_map_eq_diff]) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 327 | qed "lift_map_eq_diff"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 328 | |
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 329 | Goal "F : preserves snd \ | 
| 8703 | 330 | \ ==> (lift i F : transient (lift_set j (A <*> UNIV))) = \ | 
| 331 | \         (i=j & F : transient (A <*> UNIV) | A={})";
 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 332 | by (case_tac "i=j" 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 333 | by (auto_tac (claset(), simpset() addsimps [lift_transient])); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 334 | by (auto_tac (claset(), | 
| 9403 
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
 paulson parents: 
8948diff
changeset | 335 | simpset() addsimps [lift_set_def, lift_def, transient_def, | 
| 
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
 paulson parents: 
8948diff
changeset | 336 | rename_def, extend_def, Domain_extend_act])); | 
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 337 | by (dtac subsetD 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 338 | by (Blast_tac 1); | 
| 8122 
b43ad07660b9
working version, with Alloc now working on the same state space as the whole
 paulson parents: 
8065diff
changeset | 339 | by Auto_tac; | 
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 340 | ren "s f uu s' f' uu'" 1; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 341 | by (subgoal_tac "f'=f & uu'=uu" 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 342 | by (force_tac (claset() addSDs [preserves_imp_eq], simpset()) 2); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 343 | by Auto_tac; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 344 | by (dtac sym 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 345 | by (dtac subsetD 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 346 | by (rtac ImageI 1); | 
| 9403 
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
 paulson parents: 
8948diff
changeset | 347 | by (etac | 
| 
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
 paulson parents: 
8948diff
changeset | 348 | (bij_lift_map RS good_map_bij RS export (mem_extend_act_iff RS iffD2)) 1); | 
| 
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
 paulson parents: 
8948diff
changeset | 349 | by (Force_tac 1); | 
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 350 | by (etac (lift_map_eq_diff RS exE) 1); | 
| 9403 
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
 paulson parents: 
8948diff
changeset | 351 | by Auto_tac; | 
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 352 | qed "lift_transient_eq_disj"; | 
| 8041 | 353 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 354 | (*USELESS??*) | 
| 8703 | 355 | Goal "lift_map i `` (A <*> UNIV) = \ | 
| 356 | \     (UN s:A. UN f. {insert_map i s f}) <*> UNIV";
 | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 357 | by (auto_tac (claset() addSIs [bexI, image_eqI], | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 358 | simpset() addsimps [lift_map_def])); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 359 | by (rtac (split RS sym) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 360 | qed "lift_map_image_Times"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 361 | |
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 362 | Goal "(lift i F : preserves v) = (F : preserves (v o lift_map i))"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 363 | by (simp_tac (simpset() addsimps [lift_def, rename_preserves]) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 364 | qed "lift_preserves_eq"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 365 | |
| 8327 | 366 | (*A useful rewrite. If o, sub have been rewritten out already then can also | 
| 367 | use it as rewrite_rule [sub_def, o_def] lift_preserves_sub*) | |
| 8251 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 368 | Goal "F : preserves snd \ | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 369 | \ ==> lift i F : preserves (v o sub j o fst) = \ | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 370 | \ (if i=j then F : preserves (v o fst) else True)"; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 371 | by (dtac (impOfSubs subset_preserves_o) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 372 | by (full_simp_tac (simpset() addsimps [lift_preserves_eq, o_def, | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 373 | drop_map_lift_map_eq]) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 374 | by (asm_simp_tac (simpset() delcongs [if_weak_cong] | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 375 | addsimps [lift_map_def, | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 376 | eq_commute, split_def, o_def]) 1); | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 377 | by Auto_tac; | 
| 
9be357df93d4
New treatment of "guarantees" with polymorphic components and bijections.
 paulson parents: 
8216diff
changeset | 378 | qed "lift_preserves_sub"; | 
| 7186 | 379 | |
| 380 | ||
| 8314 | 381 | (*** Lemmas to handle function composition (o) more consistently ***) | 
| 7186 | 382 | |
| 8314 | 383 | (*Lets us prove one version of a theorem and store others*) | 
| 384 | Goal "f o g = h ==> f' o f o g = f' o h"; | |
| 385 | by (asm_full_simp_tac (simpset() addsimps [expand_fun_eq, o_def]) 1); | |
| 386 | qed "o_equiv_assoc"; | |
| 7186 | 387 | |
| 8314 | 388 | Goal "f o g = h ==> ALL x. f(g x) = h x"; | 
| 389 | by (asm_full_simp_tac (simpset() addsimps [expand_fun_eq, o_def]) 1); | |
| 390 | qed "o_equiv_apply"; | |
| 391 | ||
| 392 | fun make_o_equivs th = | |
| 393 | [th, | |
| 394 | th RS o_equiv_assoc |> simplify (HOL_ss addsimps [o_assoc]), | |
| 395 | th RS o_equiv_apply |> simplify (HOL_ss addsimps [o_def, sub_def])]; | |
| 7186 | 396 | |
| 8314 | 397 | Addsimps (make_o_equivs fst_o_funPair @ make_o_equivs snd_o_funPair); | 
| 398 | ||
| 399 | Goal "sub i o fst o lift_map i = fst"; | |
| 400 | by (rtac ext 1); | |
| 401 | by (auto_tac (claset(), simpset() addsimps [o_def, lift_map_def, sub_def])); | |
| 402 | qed "fst_o_lift_map"; | |
| 7186 | 403 | |
| 8314 | 404 | Goal "snd o lift_map i = snd o snd"; | 
| 405 | by (rtac ext 1); | |
| 406 | by (auto_tac (claset(), simpset() addsimps [o_def, lift_map_def])); | |
| 407 | qed "snd_o_lift_map"; | |
| 408 | ||
| 409 | Addsimps (make_o_equivs fst_o_lift_map @ make_o_equivs snd_o_lift_map); | |
| 410 | ||
| 411 | ||
| 412 |