| author | wenzelm |
| Thu, 07 Sep 2000 20:51:31 +0200 | |
| changeset 9894 | c8ff37b637a7 |
| parent 9403 | aad13b59b8d9 |
| child 10064 | 1a77667b21ef |
| permissions | -rw-r--r-- |
|
8256
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
1 |
(* Title: HOL/UNITY/Rename.ML |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
2 |
ID: $Id$ |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
4 |
Copyright 2000 University of Cambridge |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
5 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
6 |
*) |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
7 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
8 |
Addsimps [image_inv_f_f, image_surj_f_inv_f]; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
9 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
10 |
Goal "bij h ==> good_map (%(x,u). h x)"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
11 |
by (rtac good_mapI 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
12 |
by (rewrite_goals_tac [bij_def, inj_on_def, surj_def]); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
13 |
by Auto_tac; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
14 |
qed "good_map_bij"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
15 |
Addsimps [good_map_bij]; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
16 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
17 |
fun bij_export th = good_map_bij RS export th |> simplify (simpset()); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
18 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
19 |
Goalw [bij_def, split_def] "bij h ==> fst (inv (%(x,u). h x) s) = inv h s"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
20 |
by (Clarify_tac 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
21 |
by (subgoal_tac "surj (%p. h (fst p))" 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
22 |
by (asm_full_simp_tac (simpset() addsimps [surj_def]) 2); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
23 |
by (etac injD 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
24 |
by (asm_simp_tac (simpset() addsimps [surj_f_inv_f]) 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
25 |
by (etac surj_f_inv_f 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
26 |
qed "fst_o_inv_eq_inv"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
27 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
28 |
Goal "bij h ==> z : h``A = (inv h z : A)"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
29 |
by (auto_tac (claset() addSIs [image_eqI], |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
30 |
simpset() addsimps [bij_is_inj, bij_is_surj RS surj_f_inv_f])); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
31 |
qed "mem_rename_set_iff"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
32 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
33 |
Goal "extend_set (%(x,u). h x) A = h``A"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
34 |
by (auto_tac (claset() addSIs [image_eqI], |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
35 |
simpset() addsimps [extend_set_def])); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
36 |
qed "extend_set_eq_image"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
37 |
Addsimps [extend_set_eq_image]; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
38 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
39 |
Goalw [rename_def] "Init (rename h F) = h``(Init F)"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
40 |
by (Simp_tac 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
41 |
qed "Init_rename"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
42 |
|
|
9403
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
paulson
parents:
9190
diff
changeset
|
43 |
Addsimps [Init_rename]; |
| 8327 | 44 |
|
|
8256
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
45 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
46 |
(*** inverse properties ***) |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
47 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
48 |
Goalw [bij_def] |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
49 |
"bij h \ |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
50 |
\ ==> extend_set (%(x,u::'c). inv h x) = project_set (%(x,u::'c). h x)"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
51 |
by (rtac ext 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
52 |
by (auto_tac (claset() addSIs [image_eqI], |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
53 |
simpset() addsimps [extend_set_def, project_set_def, |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
54 |
surj_f_inv_f])); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
55 |
qed "extend_set_inv"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
56 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
57 |
(** for "rename" (programs) **) |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
58 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
59 |
Goal "bij h \ |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
60 |
\ ==> extend_act (%(x,u::'c). inv h x) = project_act (%(x,u::'c). h x)"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
61 |
by (rtac ext 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
62 |
by (auto_tac (claset() addSIs [image_eqI], |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
63 |
simpset() addsimps [extend_act_def, project_act_def, bij_def, |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
64 |
surj_f_inv_f])); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
65 |
qed "extend_act_inv"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
66 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
67 |
Goal "bij h \ |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
68 |
\ ==> extend (%(x,u::'c). inv h x) = project (%(x,u::'c). h x) UNIV"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
69 |
by (ftac bij_imp_bij_inv 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
70 |
by (rtac ext 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
71 |
by (rtac program_equalityI 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
72 |
by (asm_simp_tac |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
73 |
(simpset() addsimps [export project_act_Id, export Acts_extend, |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
74 |
insert_Id_image_Acts, extend_act_inv]) 2); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
75 |
by (asm_simp_tac (simpset() addsimps [extend_set_inv]) 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
76 |
qed "extend_inv"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
77 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
78 |
Goal "bij h ==> rename (inv h) (rename h F) = F"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
79 |
by (asm_simp_tac (simpset() addsimps [rename_def, extend_inv, |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
80 |
export extend_inverse]) 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
81 |
qed "rename_inv_rename"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
82 |
Addsimps [rename_inv_rename]; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
83 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
84 |
Goal "bij h ==> rename h (rename (inv h) F) = F"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
85 |
by (ftac bij_imp_bij_inv 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
86 |
by (etac (inv_inv_eq RS subst) 1 THEN etac rename_inv_rename 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
87 |
qed "rename_rename_inv"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
88 |
Addsimps [rename_rename_inv]; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
89 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
90 |
Goal "bij h ==> rename (inv h) = inv (rename h)"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
91 |
by (rtac (inv_equality RS sym) 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
92 |
by Auto_tac; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
93 |
qed "rename_inv_eq"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
94 |
|
| 8327 | 95 |
(** (rename h) is bijective <=> h is bijective **) |
96 |
||
|
8311
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8256
diff
changeset
|
97 |
Goal "bij h ==> inj (rename h)"; |
|
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8256
diff
changeset
|
98 |
by (asm_simp_tac (simpset() addsimps [inj_iff, expand_fun_eq, o_def, |
|
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8256
diff
changeset
|
99 |
rename_inv_eq RS sym]) 1); |
|
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8256
diff
changeset
|
100 |
qed "inj_rename"; |
|
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8256
diff
changeset
|
101 |
|
|
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8256
diff
changeset
|
102 |
Goal "bij h ==> surj (rename h)"; |
|
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8256
diff
changeset
|
103 |
by (asm_simp_tac (simpset() addsimps [surj_iff, expand_fun_eq, o_def, |
|
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8256
diff
changeset
|
104 |
rename_inv_eq RS sym]) 1); |
|
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8256
diff
changeset
|
105 |
qed "surj_rename"; |
|
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8256
diff
changeset
|
106 |
|
|
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8256
diff
changeset
|
107 |
Goal "bij h ==> bij (rename h)"; |
|
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8256
diff
changeset
|
108 |
by (blast_tac (claset() addIs [bijI, inj_rename, surj_rename]) 1); |
|
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8256
diff
changeset
|
109 |
qed "bij_rename"; |
|
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8256
diff
changeset
|
110 |
|
| 8327 | 111 |
Goalw [inj_on_def] "inj (rename h) ==> inj h"; |
112 |
by Auto_tac; |
|
113 |
by (dres_inst_tac [("x", "mk_program ({x}, {})")] spec 1);
|
|
114 |
by (dres_inst_tac [("x", "mk_program ({y}, {})")] spec 1);
|
|
115 |
by (auto_tac (claset(), |
|
|
9403
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
paulson
parents:
9190
diff
changeset
|
116 |
simpset() addsimps [program_equality_iff, |
|
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
paulson
parents:
9190
diff
changeset
|
117 |
rename_def, extend_def])); |
| 8327 | 118 |
qed "inj_rename_imp_inj"; |
119 |
||
120 |
Goalw [surj_def] "surj (rename h) ==> surj h"; |
|
121 |
by Auto_tac; |
|
122 |
by (dres_inst_tac [("x", "mk_program ({y}, {})")] spec 1);
|
|
| 9190 | 123 |
by (auto_tac (claset(), |
|
9403
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
paulson
parents:
9190
diff
changeset
|
124 |
simpset() addsimps [program_equality_iff, |
|
aad13b59b8d9
much tidying in connection with the 2nd UNITY paper
paulson
parents:
9190
diff
changeset
|
125 |
rename_def, extend_def])); |
| 8327 | 126 |
qed "surj_rename_imp_surj"; |
127 |
||
128 |
Goalw [bij_def] "bij (rename h) ==> bij h"; |
|
129 |
by (asm_simp_tac |
|
130 |
(simpset() addsimps [inj_rename_imp_inj, surj_rename_imp_surj]) 1); |
|
131 |
qed "bij_rename_imp_bij"; |
|
132 |
||
133 |
Goal "bij (rename h) = bij h"; |
|
134 |
by (blast_tac (claset() addIs [bij_rename, bij_rename_imp_bij]) 1); |
|
135 |
qed "bij_rename_iff"; |
|
136 |
AddIffs [bij_rename_iff]; |
|
|
8256
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
137 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
138 |
(*** the lattice operations ***) |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
139 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
140 |
Goalw [rename_def] "bij h ==> rename h SKIP = SKIP"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
141 |
by (Asm_simp_tac 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
142 |
qed "rename_SKIP"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
143 |
Addsimps [rename_SKIP]; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
144 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
145 |
Goalw [rename_def] |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
146 |
"bij h ==> rename h (F Join G) = rename h F Join rename h G"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
147 |
by (asm_simp_tac (simpset() addsimps [export extend_Join]) 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
148 |
qed "rename_Join"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
149 |
Addsimps [rename_Join]; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
150 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
151 |
Goalw [rename_def] "bij h ==> rename h (JOIN I F) = (JN i:I. rename h (F i))"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
152 |
by (asm_simp_tac (simpset() addsimps [export extend_JN]) 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
153 |
qed "rename_JN"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
154 |
Addsimps [rename_JN]; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
155 |
|
|
8311
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8256
diff
changeset
|
156 |
|
|
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8256
diff
changeset
|
157 |
(*** Strong Safety: co, stable ***) |
|
8256
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
158 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
159 |
Goalw [rename_def] |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
160 |
"bij h ==> (rename h F : (h``A) co (h``B)) = (F : A co B)"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
161 |
by (REPEAT (stac (extend_set_eq_image RS sym) 1)); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
162 |
by (etac (good_map_bij RS export extend_constrains) 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
163 |
qed "rename_constrains"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
164 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
165 |
Goalw [stable_def] |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
166 |
"bij h ==> (rename h F : stable (h``A)) = (F : stable A)"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
167 |
by (asm_simp_tac (simpset() addsimps [rename_constrains]) 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
168 |
qed "rename_stable"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
169 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
170 |
Goal "bij h ==> (rename h F : invariant (h``A)) = (F : invariant A)"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
171 |
by (asm_simp_tac (simpset() addsimps [invariant_def, rename_stable, |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
172 |
bij_is_inj RS inj_image_subset_iff]) 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
173 |
qed "rename_invariant"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
174 |
|
|
8311
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8256
diff
changeset
|
175 |
Goal "bij h ==> (rename h F : increasing func) = (F : increasing (func o h))"; |
|
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8256
diff
changeset
|
176 |
by (asm_simp_tac |
|
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8256
diff
changeset
|
177 |
(simpset() addsimps [increasing_def, rename_stable RS sym, |
|
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8256
diff
changeset
|
178 |
bij_image_Collect_eq, bij_is_surj RS surj_f_inv_f]) 1); |
|
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8256
diff
changeset
|
179 |
qed "rename_increasing"; |
|
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8256
diff
changeset
|
180 |
|
|
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8256
diff
changeset
|
181 |
|
|
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8256
diff
changeset
|
182 |
(*** Weak Safety: Co, Stable ***) |
|
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8256
diff
changeset
|
183 |
|
|
8256
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
184 |
Goalw [rename_def] |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
185 |
"bij h ==> reachable (rename h F) = h `` (reachable F)"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
186 |
by (asm_simp_tac (simpset() addsimps [export reachable_extend_eq]) 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
187 |
qed "reachable_rename_eq"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
188 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
189 |
Goal "bij h ==> (rename h F : (h``A) Co (h``B)) = (F : A Co B)"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
190 |
by (asm_simp_tac |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
191 |
(simpset() addsimps [Constrains_def, reachable_rename_eq, |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
192 |
rename_constrains, bij_is_inj, image_Int RS sym]) 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
193 |
qed "rename_Constrains"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
194 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
195 |
Goalw [Stable_def] |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
196 |
"bij h ==> (rename h F : Stable (h``A)) = (F : Stable A)"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
197 |
by (asm_simp_tac (simpset() addsimps [rename_Constrains]) 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
198 |
qed "rename_Stable"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
199 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
200 |
Goal "bij h ==> (rename h F : Always (h``A)) = (F : Always A)"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
201 |
by (asm_simp_tac (simpset() addsimps [Always_def, rename_Stable, |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
202 |
bij_is_inj RS inj_image_subset_iff]) 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
203 |
qed "rename_Always"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
204 |
|
|
8311
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8256
diff
changeset
|
205 |
Goal "bij h ==> (rename h F : Increasing func) = (F : Increasing (func o h))"; |
|
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8256
diff
changeset
|
206 |
by (asm_simp_tac |
|
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8256
diff
changeset
|
207 |
(simpset() addsimps [Increasing_def, rename_Stable RS sym, |
|
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8256
diff
changeset
|
208 |
bij_image_Collect_eq, bij_is_surj RS surj_f_inv_f]) 1); |
|
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8256
diff
changeset
|
209 |
qed "rename_Increasing"; |
|
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8256
diff
changeset
|
210 |
|
|
8256
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
211 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
212 |
(*** Progress: transient, ensures ***) |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
213 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
214 |
Goalw [rename_def] |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
215 |
"bij h ==> (rename h F : transient (h``A)) = (F : transient A)"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
216 |
by (stac (extend_set_eq_image RS sym) 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
217 |
by (etac (good_map_bij RS export extend_transient) 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
218 |
qed "rename_transient"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
219 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
220 |
Goalw [rename_def] |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
221 |
"bij h ==> (rename h F : (h``A) ensures (h``B)) = (F : A ensures B)"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
222 |
by (REPEAT (stac (extend_set_eq_image RS sym) 1)); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
223 |
by (etac (good_map_bij RS export extend_ensures) 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
224 |
qed "rename_ensures"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
225 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
226 |
Goalw [rename_def] |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
227 |
"bij h ==> (rename h F : (h``A) leadsTo (h``B)) = (F : A leadsTo B)"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
228 |
by (REPEAT (stac (extend_set_eq_image RS sym) 1)); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
229 |
by (etac (good_map_bij RS export extend_leadsTo) 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
230 |
qed "rename_leadsTo"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
231 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
232 |
Goalw [rename_def] |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
233 |
"bij h ==> (rename h F : (h``A) LeadsTo (h``B)) = (F : A LeadsTo B)"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
234 |
by (REPEAT (stac (extend_set_eq_image RS sym) 1)); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
235 |
by (etac (good_map_bij RS export extend_LeadsTo) 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
236 |
qed "rename_LeadsTo"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
237 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
238 |
Goalw [rename_def] |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
239 |
"bij h ==> (rename h F : (rename h `` X) guarantees[v o inv h] \ |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
240 |
\ (rename h `` Y)) = \ |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
241 |
\ (F : X guarantees[v] Y)"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
242 |
by (stac (good_map_bij RS export extend_guarantees_eq RS sym) 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
243 |
by (assume_tac 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
244 |
by (asm_simp_tac (simpset() addsimps [fst_o_inv_eq_inv, o_def]) 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
245 |
qed "rename_rename_guarantees_eq"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
246 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
247 |
Goal "bij h ==> (rename h F : X guarantees[v] Y) = \ |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
248 |
\ (F : (rename (inv h) `` X) guarantees[v o h] \ |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
249 |
\ (rename (inv h) `` Y))"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
250 |
by (stac (rename_rename_guarantees_eq RS sym) 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
251 |
by (assume_tac 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
252 |
by (asm_simp_tac |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
253 |
(simpset() addsimps [image_eq_UN, o_def, bij_is_surj RS surj_f_inv_f]) 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
254 |
qed "rename_guarantees_eq_rename_inv"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
255 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
256 |
Goal "bij h ==> (rename h G : preserves v) = (G : preserves (v o h))"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
257 |
by (stac (good_map_bij RS export extend_preserves RS sym) 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
258 |
by (assume_tac 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
259 |
by (asm_simp_tac (simpset() addsimps [o_def, fst_o_inv_eq_inv, rename_def, |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
260 |
bij_is_surj RS surj_f_inv_f]) 1); |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
261 |
qed "rename_preserves"; |
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
262 |
|
|
6ba8fa2b0638
Rename: theory for applying a bijection over states to a UNITY program
paulson
parents:
diff
changeset
|
263 |
|
| 8314 | 264 |
(*** "image" versions of the rules, for lifting "guarantees" properties ***) |
265 |
||
266 |
||
267 |
(*Tactic used in all the proofs. Better would have been to prove one |
|
268 |
meta-theorem, but how can we handle the polymorphism? E.g. in |
|
269 |
rename_constrains the two appearances of "co" have different types!*) |
|
270 |
fun rename_image_tac ths = |
|
271 |
EVERY [Auto_tac, |
|
272 |
(rename_tac "F" 2), |
|
273 |
(subgoal_tac "EX G. F = rename h G" 2), |
|
274 |
(auto_tac (claset() addSIs [surj_rename RS surj_f_inv_f RS sym], |
|
275 |
simpset() addsimps ths))]; |
|
276 |
||
277 |
Goal "bij h ==> rename h `` (A co B) = (h `` A) co (h``B)"; |
|
278 |
by (rename_image_tac [rename_constrains]); |
|
279 |
qed "rename_image_constrains"; |
|
280 |
||
281 |
Goal "bij h ==> rename h `` stable A = stable (h `` A)"; |
|
282 |
by (rename_image_tac [rename_stable]); |
|
283 |
qed "rename_image_stable"; |
|
284 |
||
285 |
Goal "bij h ==> rename h `` increasing func = increasing (func o inv h)"; |
|
286 |
by (rename_image_tac [rename_increasing, o_def, bij_is_inj]); |
|
287 |
qed "rename_image_increasing"; |
|
288 |
||
289 |
Goal "bij h ==> rename h `` invariant A = invariant (h `` A)"; |
|
290 |
by (rename_image_tac [rename_invariant]); |
|
291 |
qed "rename_image_invariant"; |
|
292 |
||
293 |
Goal "bij h ==> rename h `` (A Co B) = (h `` A) Co (h``B)"; |
|
294 |
by (rename_image_tac [rename_Constrains]); |
|
295 |
qed "rename_image_Constrains"; |
|
296 |
||
297 |
Goal "bij h ==> rename h `` Stable A = Stable (h `` A)"; |
|
298 |
by (rename_image_tac [rename_Stable]); |
|
299 |
qed "rename_image_Stable"; |
|
300 |
||
301 |
Goal "bij h ==> rename h `` Increasing func = Increasing (func o inv h)"; |
|
302 |
by (rename_image_tac [rename_Increasing, o_def, bij_is_inj]); |
|
303 |
qed "rename_image_Increasing"; |
|
304 |
||
305 |
Goal "bij h ==> rename h `` Always A = Always (h `` A)"; |
|
306 |
by (rename_image_tac [rename_Always]); |
|
307 |
qed "rename_image_Always"; |
|
308 |
||
309 |
Goal "bij h ==> rename h `` (A leadsTo B) = (h `` A) leadsTo (h``B)"; |
|
310 |
by (rename_image_tac [rename_leadsTo]); |
|
311 |
qed "rename_image_leadsTo"; |
|
312 |
||
313 |
Goal "bij h ==> rename h `` (A LeadsTo B) = (h `` A) LeadsTo (h``B)"; |
|
314 |
by (rename_image_tac [rename_LeadsTo]); |
|
315 |
qed "rename_image_LeadsTo"; |