author | paulson |
Thu, 29 Apr 1999 10:51:58 +0200 | |
changeset 6536 | 281d44905cab |
parent 6535 | 880f31a62784 |
child 6570 | a7d7985050a9 |
permissions | -rw-r--r-- |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
1 |
(* Title: HOL/UNITY/Constrains |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
2 |
ID: $Id$ |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
4 |
Copyright 1998 University of Cambridge |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
5 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
6 |
Safety relations: restricted to the set of reachable states. |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
7 |
*) |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
8 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
9 |
|
6535 | 10 |
(*** traces and reachable ***) |
11 |
||
12 |
Goal "reachable F = {s. EX evs. (s,evs): traces (Init F) (Acts F)}"; |
|
13 |
by Safe_tac; |
|
14 |
by (etac traces.induct 2); |
|
15 |
by (etac reachable.induct 1); |
|
16 |
by (ALLGOALS (blast_tac (claset() addIs reachable.intrs @ traces.intrs))); |
|
17 |
qed "reachable_equiv_traces"; |
|
18 |
||
19 |
Goal "Init F <= reachable F"; |
|
20 |
by (blast_tac (claset() addIs reachable.intrs) 1); |
|
21 |
qed "Init_subset_reachable"; |
|
22 |
||
23 |
Goal "Acts G <= Acts F ==> G : stable (reachable F)"; |
|
24 |
by (blast_tac (claset() addIs [stableI, constrainsI] @ reachable.intrs) 1); |
|
25 |
qed "stable_reachable"; |
|
26 |
||
27 |
||
28 |
(*The set of all reachable states is an invariant...*) |
|
29 |
Goal "F : invariant (reachable F)"; |
|
30 |
by (simp_tac (simpset() addsimps [invariant_def]) 1); |
|
31 |
by (blast_tac (claset() addIs (stable_reachable::reachable.intrs)) 1); |
|
32 |
qed "invariant_reachable"; |
|
33 |
||
34 |
(*...in fact the strongest invariant!*) |
|
35 |
Goal "F : invariant A ==> reachable F <= A"; |
|
36 |
by (full_simp_tac |
|
37 |
(simpset() addsimps [stable_def, constrains_def, invariant_def]) 1); |
|
38 |
by (rtac subsetI 1); |
|
39 |
by (etac reachable.induct 1); |
|
40 |
by (REPEAT (blast_tac (claset() addIs reachable.intrs) 1)); |
|
41 |
qed "invariant_includes_reachable"; |
|
42 |
||
43 |
||
6536 | 44 |
(*** Co ***) |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
45 |
|
6536 | 46 |
overload_1st_set "Constrains.op Co"; |
5340 | 47 |
|
6536 | 48 |
(*F : B co B' ==> F : (reachable F Int B) co (reachable F Int B')*) |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
49 |
bind_thm ("constrains_reachable_Int", |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
50 |
subset_refl RS |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
51 |
rewrite_rule [stable_def] stable_reachable RS |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
52 |
constrains_Int); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
53 |
|
6536 | 54 |
Goalw [Constrains_def] "F : A co A' ==> F : A Co A'"; |
5648 | 55 |
by (blast_tac (claset() addIs [constrains_reachable_Int]) 1); |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
56 |
qed "constrains_imp_Constrains"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
57 |
|
5648 | 58 |
Goalw [stable_def, Stable_def] "F : stable A ==> F : Stable A"; |
5631 | 59 |
by (etac constrains_imp_Constrains 1); |
60 |
qed "stable_imp_Stable"; |
|
61 |
||
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
62 |
val prems = Goal |
5620 | 63 |
"(!!act s s'. [| act: Acts F; (s,s') : act; s: A |] ==> s': A') \ |
6536 | 64 |
\ ==> F : A Co A'"; |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
65 |
by (rtac constrains_imp_Constrains 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
66 |
by (blast_tac (claset() addIs (constrainsI::prems)) 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
67 |
qed "ConstrainsI"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
68 |
|
6536 | 69 |
Goalw [Constrains_def, constrains_def] "F : {} Co B"; |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
70 |
by (Blast_tac 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
71 |
qed "Constrains_empty"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
72 |
|
6536 | 73 |
Goal "F : A Co UNIV"; |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
74 |
by (blast_tac (claset() addIs [ConstrainsI]) 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
75 |
qed "Constrains_UNIV"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
76 |
AddIffs [Constrains_empty, Constrains_UNIV]; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
77 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
78 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
79 |
Goalw [Constrains_def] |
6536 | 80 |
"[| F : A Co A'; A'<=B' |] ==> F : A Co B'"; |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
81 |
by (blast_tac (claset() addIs [constrains_weaken_R]) 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
82 |
qed "Constrains_weaken_R"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
83 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
84 |
Goalw [Constrains_def] |
6536 | 85 |
"[| F : A Co A'; B<=A |] ==> F : B Co A'"; |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
86 |
by (blast_tac (claset() addIs [constrains_weaken_L]) 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
87 |
qed "Constrains_weaken_L"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
88 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
89 |
Goalw [Constrains_def] |
6536 | 90 |
"[| F : A Co A'; B<=A; A'<=B' |] ==> F : B Co B'"; |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
91 |
by (blast_tac (claset() addIs [constrains_weaken]) 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
92 |
qed "Constrains_weaken"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
93 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
94 |
(** Union **) |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
95 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
96 |
Goalw [Constrains_def] |
6536 | 97 |
"[| F : A Co A'; F : B Co B' |] \ |
98 |
\ ==> F : (A Un B) Co (A' Un B')"; |
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
99 |
by (blast_tac (claset() addIs [constrains_Un RS constrains_weaken]) 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
100 |
qed "Constrains_Un"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
101 |
|
6536 | 102 |
Goal "ALL i:I. F : (A i) Co (A' i) \ |
103 |
\ ==> F : (UN i:I. A i) Co (UN i:I. A' i)"; |
|
5648 | 104 |
by (asm_full_simp_tac (simpset() addsimps [Constrains_def]) 1); |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
105 |
by (dtac ball_constrains_UN 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
106 |
by (blast_tac (claset() addIs [constrains_weaken]) 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
107 |
qed "ball_Constrains_UN"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
108 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
109 |
(** Intersection **) |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
110 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
111 |
Goalw [Constrains_def] |
6536 | 112 |
"[| F : A Co A'; F : B Co B' |] \ |
113 |
\ ==> F : (A Int B) Co (A' Int B')"; |
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
114 |
by (blast_tac (claset() addIs [constrains_Int RS constrains_weaken]) 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
115 |
qed "Constrains_Int"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
116 |
|
6536 | 117 |
Goal "ALL i:I. F : (A i) Co (A' i) \ |
118 |
\ ==> F : (INT i:I. A i) Co (INT i:I. A' i)"; |
|
5648 | 119 |
by (asm_full_simp_tac (simpset() addsimps [Constrains_def]) 1); |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
120 |
by (dtac ball_constrains_INT 1); |
5340 | 121 |
by (dtac constrains_reachable_Int 1); |
122 |
by (blast_tac (claset() addIs [constrains_weaken]) 1); |
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
123 |
qed "ball_Constrains_INT"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
124 |
|
6536 | 125 |
Goal "F : A Co A' ==> reachable F Int A <= A'"; |
5648 | 126 |
by (asm_full_simp_tac (simpset() addsimps [Constrains_def]) 1); |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
127 |
by (dtac constrains_imp_subset 1); |
6295
351b3c2b0d83
removed the infernal States, eqStates, compatible, etc.
paulson
parents:
6012
diff
changeset
|
128 |
by (ALLGOALS |
351b3c2b0d83
removed the infernal States, eqStates, compatible, etc.
paulson
parents:
6012
diff
changeset
|
129 |
(full_simp_tac (simpset() addsimps [Int_subset_iff, Int_lower1]))); |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
130 |
qed "Constrains_imp_subset"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
131 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
132 |
Goalw [Constrains_def] |
6536 | 133 |
"[| F : A Co B; F : B Co C |] \ |
134 |
\ ==> F : A Co C"; |
|
6295
351b3c2b0d83
removed the infernal States, eqStates, compatible, etc.
paulson
parents:
6012
diff
changeset
|
135 |
by (blast_tac (claset() addIs [constrains_trans, constrains_weaken]) 1); |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
136 |
qed "Constrains_trans"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
137 |
|
6295
351b3c2b0d83
removed the infernal States, eqStates, compatible, etc.
paulson
parents:
6012
diff
changeset
|
138 |
Goalw [Constrains_def, constrains_def] |
6536 | 139 |
"[| F : A Co (A' Un B); F : B Co B' |] \ |
140 |
\ ==> F : A Co (A' Un B')"; |
|
6295
351b3c2b0d83
removed the infernal States, eqStates, compatible, etc.
paulson
parents:
6012
diff
changeset
|
141 |
by (Clarify_tac 1); |
351b3c2b0d83
removed the infernal States, eqStates, compatible, etc.
paulson
parents:
6012
diff
changeset
|
142 |
by (Blast_tac 1); |
6012
1894bfc4aee9
Addition of the States component; parts of Comp not working
paulson
parents:
5804
diff
changeset
|
143 |
qed "Constrains_cancel"; |
1894bfc4aee9
Addition of the States component; parts of Comp not working
paulson
parents:
5804
diff
changeset
|
144 |
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
145 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
146 |
(*** Stable ***) |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
147 |
|
5648 | 148 |
Goal "(F : Stable A) = (F : stable (reachable F Int A))"; |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
149 |
by (simp_tac (simpset() addsimps [Stable_def, Constrains_def, stable_def]) 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
150 |
qed "Stable_eq_stable"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
151 |
|
6536 | 152 |
Goalw [Stable_def] "F : A Co A ==> F : Stable A"; |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
153 |
by (assume_tac 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
154 |
qed "StableI"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
155 |
|
6536 | 156 |
Goalw [Stable_def] "F : Stable A ==> F : A Co A"; |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
157 |
by (assume_tac 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
158 |
qed "StableD"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
159 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
160 |
Goalw [Stable_def] |
5648 | 161 |
"[| F : Stable A; F : Stable A' |] ==> F : Stable (A Un A')"; |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
162 |
by (blast_tac (claset() addIs [Constrains_Un]) 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
163 |
qed "Stable_Un"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
164 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
165 |
Goalw [Stable_def] |
5648 | 166 |
"[| F : Stable A; F : Stable A' |] ==> F : Stable (A Int A')"; |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
167 |
by (blast_tac (claset() addIs [Constrains_Int]) 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
168 |
qed "Stable_Int"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
169 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
170 |
Goalw [Stable_def] |
6536 | 171 |
"[| F : Stable C; F : A Co (C Un A') |] \ |
172 |
\ ==> F : (C Un A) Co (C Un A')"; |
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
173 |
by (blast_tac (claset() addIs [Constrains_Un RS Constrains_weaken]) 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
174 |
qed "Stable_Constrains_Un"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
175 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
176 |
Goalw [Stable_def] |
6536 | 177 |
"[| F : Stable C; F : (C Int A) Co A' |] \ |
178 |
\ ==> F : (C Int A) Co (C Int A')"; |
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
179 |
by (blast_tac (claset() addIs [Constrains_Int RS Constrains_weaken]) 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
180 |
qed "Stable_Constrains_Int"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
181 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
182 |
Goalw [Stable_def] |
5804
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5784
diff
changeset
|
183 |
"(ALL i:I. F : Stable (A i)) ==> F : Stable (UN i:I. A i)"; |
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5784
diff
changeset
|
184 |
by (etac ball_Constrains_UN 1); |
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5784
diff
changeset
|
185 |
qed "ball_Stable_UN"; |
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5784
diff
changeset
|
186 |
|
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5784
diff
changeset
|
187 |
Goalw [Stable_def] |
5648 | 188 |
"(ALL i:I. F : Stable (A i)) ==> F : Stable (INT i:I. A i)"; |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
189 |
by (etac ball_Constrains_INT 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
190 |
qed "ball_Stable_INT"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
191 |
|
5648 | 192 |
Goal "F : Stable (reachable F)"; |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
193 |
by (simp_tac (simpset() addsimps [Stable_eq_stable, stable_reachable]) 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
194 |
qed "Stable_reachable"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
195 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
196 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
197 |
|
5784 | 198 |
(*** Increasing ***) |
199 |
||
200 |
Goalw [Increasing_def, Stable_def, Constrains_def, stable_def, constrains_def] |
|
201 |
"Increasing f <= Increasing (length o f)"; |
|
202 |
by Auto_tac; |
|
203 |
by (blast_tac (claset() addIs [prefix_length_le, le_trans]) 1); |
|
5804
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5784
diff
changeset
|
204 |
qed "Increasing_size"; |
5784 | 205 |
|
206 |
Goalw [Increasing_def] |
|
207 |
"Increasing f <= {F. ALL z::nat. F: Stable {s. z < f s}}"; |
|
208 |
by (simp_tac (simpset() addsimps [Suc_le_eq RS sym]) 1); |
|
209 |
by (Blast_tac 1); |
|
5804
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5784
diff
changeset
|
210 |
qed "Increasing_Stable_less"; |
5784 | 211 |
|
212 |
Goalw [increasing_def, Increasing_def] |
|
213 |
"F : increasing f ==> F : Increasing f"; |
|
214 |
by (blast_tac (claset() addIs [stable_imp_Stable]) 1); |
|
215 |
qed "increasing_imp_Increasing"; |
|
216 |
||
217 |
||
218 |
||
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
219 |
(*** The Elimination Theorem. The "free" m has become universally quantified! |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
220 |
Should the premise be !!m instead of ALL m ? Would make it harder to use |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
221 |
in forward proof. ***) |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
222 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
223 |
Goalw [Constrains_def, constrains_def] |
6536 | 224 |
"[| ALL m. F : {s. s x = m} Co (B m) |] \ |
225 |
\ ==> F : {s. s x : M} Co (UN m:M. B m)"; |
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
226 |
by (Blast_tac 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
227 |
qed "Elimination"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
228 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
229 |
(*As above, but for the trivial case of a one-variable state, in which the |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
230 |
state is identified with its one variable.*) |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
231 |
Goalw [Constrains_def, constrains_def] |
6536 | 232 |
"(ALL m. F : {m} Co (B m)) ==> F : M Co (UN m:M. B m)"; |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
233 |
by (Blast_tac 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
234 |
qed "Elimination_sing"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
235 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
236 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
237 |
(*** Specialized laws for handling Invariants ***) |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
238 |
|
5620 | 239 |
(** Natural deduction rules for "Invariant F A" **) |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
240 |
|
5648 | 241 |
Goal "[| Init F<=A; F : Stable A |] ==> F : Invariant A"; |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
242 |
by (asm_simp_tac (simpset() addsimps [Invariant_def]) 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
243 |
qed "InvariantI"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
244 |
|
5648 | 245 |
Goal "F : Invariant A ==> Init F<=A & F : Stable A"; |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
246 |
by (asm_full_simp_tac (simpset() addsimps [Invariant_def]) 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
247 |
qed "InvariantD"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
248 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
249 |
bind_thm ("InvariantE", InvariantD RS conjE); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
250 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
251 |
|
5804
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5784
diff
changeset
|
252 |
(*The set of all reachable states is the strongest Invariant*) |
5648 | 253 |
Goal "F : Invariant A ==> reachable F <= A"; |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
254 |
by (full_simp_tac |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
255 |
(simpset() addsimps [Stable_def, Constrains_def, constrains_def, |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
256 |
Invariant_def]) 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
257 |
by (rtac subsetI 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
258 |
by (etac reachable.induct 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
259 |
by (REPEAT (blast_tac (claset() addIs reachable.intrs) 1)); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
260 |
qed "Invariant_includes_reachable"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
261 |
|
5648 | 262 |
Goalw [Invariant_def, invariant_def, Stable_def, Constrains_def, stable_def] |
263 |
"F : invariant A ==> F : Invariant A"; |
|
264 |
by (blast_tac (claset() addIs [constrains_reachable_Int]) 1); |
|
265 |
qed "invariant_imp_Invariant"; |
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
266 |
|
5648 | 267 |
Goalw [Invariant_def, invariant_def, Stable_def, Constrains_def, stable_def] |
5804
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5784
diff
changeset
|
268 |
"Invariant A = {F. F : invariant (reachable F Int A)}"; |
5648 | 269 |
by (blast_tac (claset() addIs reachable.intrs) 1); |
270 |
qed "Invariant_eq_invariant_reachable"; |
|
271 |
||
5804
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5784
diff
changeset
|
272 |
(*Invariant is the "always" notion*) |
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5784
diff
changeset
|
273 |
Goal "Invariant A = {F. reachable F <= A}"; |
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5784
diff
changeset
|
274 |
by (auto_tac (claset() addDs [invariant_includes_reachable], |
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5784
diff
changeset
|
275 |
simpset() addsimps [Int_absorb2, invariant_reachable, |
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5784
diff
changeset
|
276 |
Invariant_eq_invariant_reachable])); |
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5784
diff
changeset
|
277 |
qed "Invariant_eq_always"; |
5648 | 278 |
|
279 |
||
5804
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5784
diff
changeset
|
280 |
Goal "Invariant A = (UN I: Pow A. invariant I)"; |
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5784
diff
changeset
|
281 |
by (simp_tac (simpset() addsimps [Invariant_eq_always]) 1); |
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5784
diff
changeset
|
282 |
by (blast_tac (claset() addIs [invariantI, impOfSubs Init_subset_reachable, |
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5784
diff
changeset
|
283 |
stable_reachable, |
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5784
diff
changeset
|
284 |
impOfSubs invariant_includes_reachable]) 1); |
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5784
diff
changeset
|
285 |
qed "Invariant_eq_UN_invariant"; |
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5784
diff
changeset
|
286 |
|
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5784
diff
changeset
|
287 |
|
6536 | 288 |
(*** "Co" rules involving Invariant ***) |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
289 |
|
6536 | 290 |
Goal "[| F : Invariant INV; F : (INV Int A) Co A' |] \ |
291 |
\ ==> F : A Co A'"; |
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
292 |
by (asm_full_simp_tac |
5804
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5784
diff
changeset
|
293 |
(simpset() addsimps [Invariant_includes_reachable RS Int_absorb2, |
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5784
diff
changeset
|
294 |
Constrains_def, Int_assoc RS sym]) 1); |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
295 |
qed "Invariant_ConstrainsI"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
296 |
|
6536 | 297 |
(* [| F : Invariant INV; F : (INV Int A) Co A |] |
5648 | 298 |
==> F : Stable A *) |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
299 |
bind_thm ("Invariant_StableI", Invariant_ConstrainsI RS StableI); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
300 |
|
6536 | 301 |
Goal "[| F : Invariant INV; F : A Co A' |] \ |
302 |
\ ==> F : A Co (INV Int A')"; |
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
303 |
by (asm_full_simp_tac |
5804
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5784
diff
changeset
|
304 |
(simpset() addsimps [Invariant_includes_reachable RS Int_absorb2, |
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5784
diff
changeset
|
305 |
Constrains_def, Int_assoc RS sym]) 1); |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
306 |
qed "Invariant_ConstrainsD"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
307 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
308 |
bind_thm ("Invariant_StableD", StableD RSN (2,Invariant_ConstrainsD)); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
309 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
310 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
311 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
312 |
(** Conjoining Invariants **) |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
313 |
|
5648 | 314 |
Goal "[| F : Invariant A; F : Invariant B |] ==> F : Invariant (A Int B)"; |
5804
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5784
diff
changeset
|
315 |
by (auto_tac (claset(), simpset() addsimps [Invariant_eq_always])); |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
316 |
qed "Invariant_Int"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
317 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
318 |
(*Delete the nearest invariance assumption (which will be the second one |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
319 |
used by Invariant_Int) *) |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
320 |
val Invariant_thin = |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
321 |
read_instantiate_sg (sign_of thy) |
5648 | 322 |
[("V", "?F : Invariant ?A")] thin_rl; |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
323 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
324 |
(*Combines two invariance ASSUMPTIONS into one. USEFUL??*) |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
325 |
val Invariant_Int_tac = dtac Invariant_Int THEN' |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
326 |
assume_tac THEN' |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
327 |
etac Invariant_thin; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
328 |
|
5319
7356d0c88b1b
Moved Un_subset_iff and Int_subset_iff from UNITY to equalities.ML
paulson
parents:
5313
diff
changeset
|
329 |
(*Combines a list of invariance THEOREMS into one.*) |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
330 |
val Invariant_Int_rule = foldr1 (fn (th1,th2) => [th1,th2] MRS Invariant_Int); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
331 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
332 |
|
5648 | 333 |
(*To allow expansion of the program's definition when appropriate*) |
334 |
val program_defs_ref = ref ([] : thm list); |
|
335 |
||
6536 | 336 |
(*proves "co" properties when the program is specified*) |
5648 | 337 |
fun constrains_tac i = |
5422 | 338 |
SELECT_GOAL |
5648 | 339 |
(EVERY [simp_tac (simpset() addsimps !program_defs_ref) 1, |
340 |
REPEAT (resolve_tac [StableI, stableI, |
|
5422 | 341 |
constrains_imp_Constrains] 1), |
342 |
rtac constrainsI 1, |
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5422
diff
changeset
|
343 |
Full_simp_tac 1, |
5620 | 344 |
REPEAT (FIRSTGOAL (etac disjE)), |
5422 | 345 |
ALLGOALS Clarify_tac, |
5648 | 346 |
ALLGOALS Asm_full_simp_tac]) i; |
5422 | 347 |
|
348 |