11479
|
1 |
(* Title: HOL/UNITY/State.ML
|
|
2 |
ID: $Id$
|
|
3 |
Author: Sidi O Ehmety, Computer Laboratory
|
|
4 |
Copyright 2001 University of Cambridge
|
|
5 |
|
|
6 |
Formalizes UNITY-program states.
|
|
7 |
*)
|
|
8 |
|
|
9 |
AddIffs [some_in_state];
|
|
10 |
|
|
11 |
|
|
12 |
Goal "!!A. state<=A ==> EX x. x:A";
|
|
13 |
by (res_inst_tac [("x", "some")] exI 1);
|
|
14 |
by Auto_tac;
|
|
15 |
qed "state_subset_not_empty";
|
|
16 |
|
|
17 |
(** condition **)
|
|
18 |
Goalw [condition_def]
|
|
19 |
"A:condition ==>A<=state";
|
|
20 |
by (Blast_tac 1);
|
|
21 |
qed "conditionD";
|
|
22 |
|
|
23 |
Goalw [condition_def]
|
|
24 |
"A<=state ==> A:condition";
|
|
25 |
by (Blast_tac 1);
|
|
26 |
qed "conditionI";
|
|
27 |
|
|
28 |
(** actionSet **)
|
|
29 |
Goalw [actionSet_def]
|
|
30 |
"acts:actionSet ==> acts<=action";
|
|
31 |
by (Blast_tac 1);
|
|
32 |
qed "actionSetD";
|
|
33 |
|
|
34 |
Goalw [actionSet_def]
|
|
35 |
"acts<=action ==>acts:actionSet";
|
|
36 |
by (Blast_tac 1);
|
|
37 |
qed "actionSetI";
|
|
38 |
|
|
39 |
(** Identity **)
|
|
40 |
Goalw [condition_def, Identity_def]
|
|
41 |
"A:condition ==> Id``A = A";
|
|
42 |
by (Blast_tac 1);
|
|
43 |
qed "Id_image";
|
|
44 |
|
|
45 |
Goalw [Identity_def]
|
|
46 |
"A<=state ==> Id``A = A";
|
|
47 |
by (Blast_tac 1);
|
|
48 |
qed "Id_image2";
|
|
49 |
|
|
50 |
Addsimps [Id_image, Id_image2];
|
|
51 |
|
|
52 |
Goalw [Identity_def]
|
|
53 |
"Id:action";
|
|
54 |
by (Blast_tac 1);
|
|
55 |
qed "Id_in_action";
|
|
56 |
AddIffs [Id_in_action];
|
|
57 |
AddTCs [Id_in_action];
|
|
58 |
|
|
59 |
Goalw [Identity_def]
|
|
60 |
"(x:Id) <-> (EX c:state. x=<c,c>)";
|
|
61 |
by (Blast_tac 1);
|
|
62 |
qed "Id_member_simp";
|
|
63 |
Addsimps [Id_member_simp];
|
|
64 |
|
|
65 |
Goalw [Identity_def]
|
|
66 |
"Id``0 = 0";
|
|
67 |
by (Blast_tac 1);
|
|
68 |
qed "Id_0";
|
|
69 |
Addsimps [Id_0];
|
|
70 |
|
|
71 |
|
|
72 |
Goalw [Identity_def]
|
|
73 |
"Id``state = state";
|
|
74 |
by (Blast_tac 1);
|
|
75 |
qed "Id_image_state";
|
|
76 |
Addsimps [Id_image_state];
|
|
77 |
|
|
78 |
Goalw [condition_def]
|
|
79 |
"0:condition";
|
|
80 |
by (Blast_tac 1);
|
|
81 |
qed "condition_0";
|
|
82 |
|
|
83 |
Goalw [condition_def]
|
|
84 |
"state:condition";
|
|
85 |
by (Blast_tac 1);
|
|
86 |
qed "condition_state";
|
|
87 |
|
|
88 |
Goalw [actionSet_def]
|
|
89 |
"0:actionSet";
|
|
90 |
by Auto_tac;
|
|
91 |
qed "actionSet_0";
|
|
92 |
|
|
93 |
Goalw [actionSet_def]
|
|
94 |
"action:actionSet";
|
|
95 |
by Auto_tac;
|
|
96 |
qed "actionSet_Prod";
|
|
97 |
|
|
98 |
AddIffs [condition_0, condition_state, actionSet_0, actionSet_Prod];
|
|
99 |
AddTCs [condition_0, condition_state, actionSet_0, actionSet_Prod];
|
|
100 |
|
|
101 |
(** Simplification rules for condition **)
|
|
102 |
|
|
103 |
|
|
104 |
(** Union and Un **)
|
|
105 |
|
|
106 |
Goalw [condition_def]
|
|
107 |
"A Un B:condition <-> A:condition & B:condition";
|
|
108 |
by (Blast_tac 1);
|
|
109 |
qed "condition_Un";
|
|
110 |
|
|
111 |
Goalw [condition_def]
|
|
112 |
"Union(S):condition <-> (ALL A:S. A:condition)";
|
|
113 |
by (Blast_tac 1);
|
|
114 |
qed "condition_Union";
|
|
115 |
|
|
116 |
AddIffs [condition_Un, condition_Union];
|
|
117 |
AddIs [condition_Un RS iffD2, condition_Union RS iffD2];
|
|
118 |
|
|
119 |
(** Intersection **)
|
|
120 |
|
|
121 |
Goalw [condition_def]
|
|
122 |
"[| A:condition; B:condition |] ==> A Int B: condition";
|
|
123 |
by (Blast_tac 1);
|
|
124 |
qed "condition_IntI";
|
|
125 |
|
|
126 |
Goalw [condition_def, Inter_def]
|
|
127 |
"(ALL A:S. A:condition) ==> Inter(S): condition";
|
|
128 |
by (Blast_tac 1);
|
|
129 |
bind_thm("condition_InterI", ballI RS result());
|
|
130 |
|
|
131 |
AddIs [condition_IntI, condition_InterI];
|
|
132 |
Addsimps [condition_IntI, condition_InterI];
|
|
133 |
|
|
134 |
Goalw [condition_def]
|
|
135 |
"A:condition ==> A - B :condition";
|
|
136 |
by (Blast_tac 1);
|
|
137 |
qed "condition_DiffI";
|
|
138 |
AddIs [condition_DiffI];
|
|
139 |
Addsimps [condition_DiffI];
|
|
140 |
|
|
141 |
|
|
142 |
(** Needed in WFair.thy **)
|
|
143 |
Goalw [condition_def]
|
|
144 |
"S:Pow(condition) ==> Union(S):condition";
|
|
145 |
by (Blast_tac 1);
|
|
146 |
qed "Union_in_conditionI";
|
|
147 |
|
|
148 |
(** Simplification rules **)
|
|
149 |
|
|
150 |
Goalw [condition_def]
|
|
151 |
"{s:state. P(s)}:condition";
|
|
152 |
by Auto_tac;
|
|
153 |
qed "Collect_in_condition";
|
|
154 |
|
|
155 |
Goal "{s:state. P(s)}:Pow(state)";
|
|
156 |
by Auto_tac;
|
|
157 |
qed "Collect_condition2";
|
|
158 |
|
|
159 |
Goal "{s:state. P(s)}<=state";
|
|
160 |
by Auto_tac;
|
|
161 |
qed "Collect_condition3";
|
|
162 |
|
|
163 |
Goal "{s:state. P(s)} Int state = {s:state. P(s)}";
|
|
164 |
by Auto_tac;
|
|
165 |
qed "Collect_Int_state";
|
|
166 |
|
|
167 |
Goal "state Int {s:state. P(s)} = {s:state. P(s)}";
|
|
168 |
by Auto_tac;
|
|
169 |
qed "Collect_Int_state2";
|
|
170 |
|
|
171 |
val state_simps = [Collect_in_condition, Collect_condition2,
|
|
172 |
Collect_condition3, Collect_Int_state, Collect_Int_state2];
|
|
173 |
|
|
174 |
|
|
175 |
(* actionSet *)
|
|
176 |
|
|
177 |
Goalw [actionSet_def]
|
|
178 |
"(A Un B):actionSet <-> (A:actionSet&B:actionSet)";
|
|
179 |
by Auto_tac;
|
|
180 |
qed "actionSet_Un";
|
|
181 |
|
|
182 |
Goalw [actionSet_def]
|
|
183 |
"(UN i:I. A(i)):actionSet <-> (ALL i:I. A(i):actionSet)";
|
|
184 |
by Auto_tac;
|
|
185 |
qed "actionSet_UN";
|
|
186 |
|
|
187 |
AddIffs [actionSet_Un, actionSet_UN];
|
|
188 |
AddIs [actionSet_Un RS iffD2, actionSet_UN RS iffD2];
|
|
189 |
|
|
190 |
Goalw [actionSet_def]
|
|
191 |
"[| A:actionSet; B:actionSet |] ==> (A Int B):actionSet";
|
|
192 |
by Auto_tac;
|
|
193 |
qed "actionSet_Int";
|
|
194 |
|
|
195 |
Goalw [actionSet_def]
|
|
196 |
"(ALL i:I. A(i):actionSet) ==> (INT i:I. A(i)):actionSet";
|
|
197 |
by (auto_tac (claset(), simpset() addsimps [Inter_def]));
|
|
198 |
qed "actionSet_INT";
|
|
199 |
|
|
200 |
Addsimps [actionSet_INT];
|
|
201 |
AddIs [actionSet_INT];
|
|
202 |
Addsimps [Inter_0];
|
|
203 |
|
|
204 |
Goalw [condition_def]
|
|
205 |
"(PROD x:variable. type_of(x)):condition";
|
|
206 |
by Auto_tac;
|
|
207 |
qed "PROD_condition";
|
|
208 |
|
|
209 |
Addsimps [PROD_condition];
|
|
210 |
AddIs [PROD_condition];
|