author | paulson |
Sat, 31 Oct 1998 12:45:25 +0100 | |
changeset 5784 | 54276fba8420 |
parent 5669 | f5d9caafc3bd |
child 5804 | 8e0a4c4fd67b |
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 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
10 |
(*** Constrains ***) |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
11 |
|
5648 | 12 |
overload_1st_set "Constrains.Constrains"; |
5340 | 13 |
|
5648 | 14 |
(*F : constrains B B' |
15 |
==> F : constrains (reachable F Int B) (reachable F Int B')*) |
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
16 |
bind_thm ("constrains_reachable_Int", |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
17 |
subset_refl RS |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
18 |
rewrite_rule [stable_def] stable_reachable RS |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
19 |
constrains_Int); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
20 |
|
5648 | 21 |
Goalw [Constrains_def] "F : constrains A A' ==> F : Constrains A A'"; |
22 |
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
|
23 |
qed "constrains_imp_Constrains"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
24 |
|
5648 | 25 |
Goalw [stable_def, Stable_def] "F : stable A ==> F : Stable A"; |
5631 | 26 |
by (etac constrains_imp_Constrains 1); |
27 |
qed "stable_imp_Stable"; |
|
28 |
||
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
29 |
val prems = Goal |
5620 | 30 |
"(!!act s s'. [| act: Acts F; (s,s') : act; s: A |] ==> s': A') \ |
5648 | 31 |
\ ==> F : Constrains A A'"; |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
32 |
by (rtac constrains_imp_Constrains 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
33 |
by (blast_tac (claset() addIs (constrainsI::prems)) 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
34 |
qed "ConstrainsI"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
35 |
|
5648 | 36 |
Goalw [Constrains_def, constrains_def] "F : Constrains {} B"; |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
37 |
by (Blast_tac 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
38 |
qed "Constrains_empty"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
39 |
|
5648 | 40 |
Goal "F : Constrains A UNIV"; |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
41 |
by (blast_tac (claset() addIs [ConstrainsI]) 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
42 |
qed "Constrains_UNIV"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
43 |
AddIffs [Constrains_empty, Constrains_UNIV]; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
44 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
45 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
46 |
Goalw [Constrains_def] |
5648 | 47 |
"[| F : Constrains A A'; A'<=B' |] ==> F : Constrains A B'"; |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
48 |
by (blast_tac (claset() addIs [constrains_weaken_R]) 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
49 |
qed "Constrains_weaken_R"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
50 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
51 |
Goalw [Constrains_def] |
5648 | 52 |
"[| F : Constrains A A'; B<=A |] ==> F : Constrains B A'"; |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
53 |
by (blast_tac (claset() addIs [constrains_weaken_L]) 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
54 |
qed "Constrains_weaken_L"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
55 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
56 |
Goalw [Constrains_def] |
5648 | 57 |
"[| F : Constrains A A'; B<=A; A'<=B' |] ==> F : Constrains B B'"; |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
58 |
by (blast_tac (claset() addIs [constrains_weaken]) 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
59 |
qed "Constrains_weaken"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
60 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
61 |
(** Union **) |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
62 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
63 |
Goalw [Constrains_def] |
5648 | 64 |
"[| F : Constrains A A'; F : Constrains B B' |] \ |
65 |
\ ==> F : Constrains (A Un B) (A' Un B')"; |
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
66 |
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
|
67 |
qed "Constrains_Un"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
68 |
|
5648 | 69 |
Goal "ALL i:I. F : Constrains (A i) (A' i) \ |
70 |
\ ==> F : Constrains (UN i:I. A i) (UN i:I. A' i)"; |
|
71 |
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
|
72 |
by (dtac ball_constrains_UN 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
73 |
by (blast_tac (claset() addIs [constrains_weaken]) 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
74 |
qed "ball_Constrains_UN"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
75 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
76 |
(** Intersection **) |
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 |
Goalw [Constrains_def] |
5648 | 79 |
"[| F : Constrains A A'; F : Constrains B B' |] \ |
80 |
\ ==> F : Constrains (A Int B) (A' Int B')"; |
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
81 |
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
|
82 |
qed "Constrains_Int"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
83 |
|
5648 | 84 |
Goal "[| ALL i:I. F : Constrains (A i) (A' i) |] \ |
85 |
\ ==> F : Constrains (INT i:I. A i) (INT i:I. A' i)"; |
|
86 |
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
|
87 |
by (dtac ball_constrains_INT 1); |
5340 | 88 |
by (dtac constrains_reachable_Int 1); |
89 |
by (blast_tac (claset() addIs [constrains_weaken]) 1); |
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
90 |
qed "ball_Constrains_INT"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
91 |
|
5648 | 92 |
Goal "F : Constrains A A' ==> reachable F Int A <= A'"; |
93 |
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
|
94 |
by (dtac constrains_imp_subset 1); |
5584 | 95 |
by (ALLGOALS |
96 |
(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
|
97 |
qed "Constrains_imp_subset"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
98 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
99 |
Goalw [Constrains_def] |
5648 | 100 |
"[| F : Constrains A B; F : Constrains B C |] \ |
101 |
\ ==> F : Constrains A C"; |
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
102 |
by (blast_tac (claset() addIs [constrains_trans, constrains_weaken]) 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
103 |
qed "Constrains_trans"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
104 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
105 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
106 |
(*** Stable ***) |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
107 |
|
5648 | 108 |
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
|
109 |
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
|
110 |
qed "Stable_eq_stable"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
111 |
|
5648 | 112 |
Goalw [Stable_def] "F : Constrains A A ==> F : Stable A"; |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
113 |
by (assume_tac 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
114 |
qed "StableI"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
115 |
|
5648 | 116 |
Goalw [Stable_def] "F : Stable A ==> F : Constrains A A"; |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
117 |
by (assume_tac 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
118 |
qed "StableD"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
119 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
120 |
Goalw [Stable_def] |
5648 | 121 |
"[| 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
|
122 |
by (blast_tac (claset() addIs [Constrains_Un]) 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
123 |
qed "Stable_Un"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
124 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
125 |
Goalw [Stable_def] |
5648 | 126 |
"[| 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
|
127 |
by (blast_tac (claset() addIs [Constrains_Int]) 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
128 |
qed "Stable_Int"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
129 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
130 |
Goalw [Stable_def] |
5648 | 131 |
"[| F : Stable C; F : Constrains A (C Un A') |] \ |
132 |
\ ==> F : Constrains (C Un A) (C Un A')"; |
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
133 |
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
|
134 |
qed "Stable_Constrains_Un"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
135 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
136 |
Goalw [Stable_def] |
5648 | 137 |
"[| F : Stable C; F : Constrains (C Int A) A' |] \ |
138 |
\ ==> F : Constrains (C Int A) (C Int A')"; |
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
139 |
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
|
140 |
qed "Stable_Constrains_Int"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
141 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
142 |
Goalw [Stable_def] |
5648 | 143 |
"(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
|
144 |
by (etac ball_Constrains_INT 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
145 |
qed "ball_Stable_INT"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
146 |
|
5648 | 147 |
Goal "F : Stable (reachable F)"; |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
148 |
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
|
149 |
qed "Stable_reachable"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
150 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
151 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
152 |
|
5784 | 153 |
(*** Increasing ***) |
154 |
||
155 |
Goalw [Increasing_def, Stable_def, Constrains_def, stable_def, constrains_def] |
|
156 |
"Increasing f <= Increasing (length o f)"; |
|
157 |
by Auto_tac; |
|
158 |
by (blast_tac (claset() addIs [prefix_length_le, le_trans]) 1); |
|
159 |
qed "Increasing_length"; |
|
160 |
||
161 |
Goalw [Increasing_def] |
|
162 |
"Increasing f <= {F. ALL z::nat. F: Stable {s. z < f s}}"; |
|
163 |
by (simp_tac (simpset() addsimps [Suc_le_eq RS sym]) 1); |
|
164 |
by (Blast_tac 1); |
|
165 |
qed "Increasing_less"; |
|
166 |
||
167 |
Goalw [increasing_def, Increasing_def] |
|
168 |
"F : increasing f ==> F : Increasing f"; |
|
169 |
by (blast_tac (claset() addIs [stable_imp_Stable]) 1); |
|
170 |
qed "increasing_imp_Increasing"; |
|
171 |
||
172 |
||
173 |
||
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
174 |
(*** 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
|
175 |
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
|
176 |
in forward proof. ***) |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
177 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
178 |
Goalw [Constrains_def, constrains_def] |
5648 | 179 |
"[| ALL m. F : Constrains {s. s x = m} (B m) |] \ |
180 |
\ ==> F : Constrains {s. s x : M} (UN m:M. B m)"; |
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
181 |
by (Blast_tac 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
182 |
qed "Elimination"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
183 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
184 |
(*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
|
185 |
state is identified with its one variable.*) |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
186 |
Goalw [Constrains_def, constrains_def] |
5648 | 187 |
"(ALL m. F : Constrains {m} (B m)) ==> F : Constrains M (UN m:M. B m)"; |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
188 |
by (Blast_tac 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
189 |
qed "Elimination_sing"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
190 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
191 |
Goalw [Constrains_def, constrains_def] |
5648 | 192 |
"[| F : Constrains A (A' Un B); F : Constrains B B' |] \ |
193 |
\ ==> F : Constrains A (A' Un B')"; |
|
5669 | 194 |
by (Clarify_tac 1); |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
195 |
by (Blast_tac 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
196 |
qed "Constrains_cancel"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
197 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
198 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
199 |
(*** Specialized laws for handling Invariants ***) |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
200 |
|
5620 | 201 |
(** Natural deduction rules for "Invariant F A" **) |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
202 |
|
5648 | 203 |
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
|
204 |
by (asm_simp_tac (simpset() addsimps [Invariant_def]) 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
205 |
qed "InvariantI"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
206 |
|
5648 | 207 |
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
|
208 |
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
|
209 |
qed "InvariantD"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
210 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
211 |
bind_thm ("InvariantE", InvariantD RS conjE); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
212 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
213 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
214 |
(*The set of all reachable states is an Invariant...*) |
5648 | 215 |
Goal "F : Invariant (reachable F)"; |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
216 |
by (simp_tac (simpset() addsimps [Invariant_def]) 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
217 |
by (blast_tac (claset() addIs (Stable_reachable::reachable.intrs)) 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
218 |
qed "Invariant_reachable"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
219 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
220 |
(*...in fact the strongest Invariant!*) |
5648 | 221 |
Goal "F : Invariant A ==> reachable F <= A"; |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
222 |
by (full_simp_tac |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
223 |
(simpset() addsimps [Stable_def, Constrains_def, constrains_def, |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
224 |
Invariant_def]) 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
225 |
by (rtac subsetI 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
226 |
by (etac reachable.induct 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
227 |
by (REPEAT (blast_tac (claset() addIs reachable.intrs) 1)); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
228 |
qed "Invariant_includes_reachable"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
229 |
|
5648 | 230 |
Goalw [Invariant_def, invariant_def, Stable_def, Constrains_def, stable_def] |
231 |
"F : invariant A ==> F : Invariant A"; |
|
232 |
by (blast_tac (claset() addIs [constrains_reachable_Int]) 1); |
|
233 |
qed "invariant_imp_Invariant"; |
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
234 |
|
5648 | 235 |
Goalw [Invariant_def, invariant_def, Stable_def, Constrains_def, stable_def] |
236 |
"(F : Invariant A) = (F : invariant (reachable F Int A))"; |
|
237 |
by (blast_tac (claset() addIs reachable.intrs) 1); |
|
238 |
qed "Invariant_eq_invariant_reachable"; |
|
239 |
||
240 |
||
241 |
||
242 |
Goal "F : Invariant INV ==> reachable F Int INV = reachable F"; |
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
243 |
by (dtac Invariant_includes_reachable 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
244 |
by (Blast_tac 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
245 |
qed "reachable_Int_INV"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
246 |
|
5648 | 247 |
Goal "[| F : Invariant INV; F : Constrains (INV Int A) A' |] \ |
248 |
\ ==> F : Constrains A A'"; |
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
249 |
by (asm_full_simp_tac |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
250 |
(simpset() addsimps [Constrains_def, reachable_Int_INV, |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
251 |
Int_assoc RS sym]) 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
252 |
qed "Invariant_ConstrainsI"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
253 |
|
5648 | 254 |
(* [| F : Invariant INV; F : Constrains (INV Int A) A |] |
255 |
==> F : Stable A *) |
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
256 |
bind_thm ("Invariant_StableI", Invariant_ConstrainsI RS StableI); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
257 |
|
5648 | 258 |
Goal "[| F : Invariant INV; F : Constrains A A' |] \ |
259 |
\ ==> F : Constrains A (INV Int A')"; |
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
260 |
by (asm_full_simp_tac |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
261 |
(simpset() addsimps [Constrains_def, reachable_Int_INV, |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
262 |
Int_assoc RS sym]) 1); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
263 |
qed "Invariant_ConstrainsD"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
264 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
265 |
bind_thm ("Invariant_StableD", StableD RSN (2,Invariant_ConstrainsD)); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
266 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
267 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
268 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
269 |
(** Conjoining Invariants **) |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
270 |
|
5648 | 271 |
Goal "[| F : Invariant A; F : Invariant B |] ==> F : Invariant (A Int B)"; |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
272 |
by (auto_tac (claset(), |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
273 |
simpset() addsimps [Invariant_def, Stable_Int])); |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
274 |
qed "Invariant_Int"; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
275 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
276 |
(*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
|
277 |
used by Invariant_Int) *) |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
278 |
val Invariant_thin = |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
279 |
read_instantiate_sg (sign_of thy) |
5648 | 280 |
[("V", "?F : Invariant ?A")] thin_rl; |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
281 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
282 |
(*Combines two invariance ASSUMPTIONS into one. USEFUL??*) |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
283 |
val Invariant_Int_tac = dtac Invariant_Int THEN' |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
284 |
assume_tac THEN' |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
285 |
etac Invariant_thin; |
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
286 |
|
5319
7356d0c88b1b
Moved Un_subset_iff and Int_subset_iff from UNITY to equalities.ML
paulson
parents:
5313
diff
changeset
|
287 |
(*Combines a list of invariance THEOREMS into one.*) |
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
288 |
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
|
289 |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
diff
changeset
|
290 |
|
5648 | 291 |
(*To allow expansion of the program's definition when appropriate*) |
292 |
val program_defs_ref = ref ([] : thm list); |
|
293 |
||
5422 | 294 |
(*proves "constrains" properties when the program is specified*) |
5648 | 295 |
fun constrains_tac i = |
5422 | 296 |
SELECT_GOAL |
5648 | 297 |
(EVERY [simp_tac (simpset() addsimps !program_defs_ref) 1, |
298 |
REPEAT (resolve_tac [StableI, stableI, |
|
5422 | 299 |
constrains_imp_Constrains] 1), |
300 |
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
|
301 |
Full_simp_tac 1, |
5620 | 302 |
REPEAT (FIRSTGOAL (etac disjE)), |
5422 | 303 |
ALLGOALS Clarify_tac, |
5648 | 304 |
ALLGOALS Asm_full_simp_tac]) i; |
5422 | 305 |
|
306 |