author | wenzelm |
Fri, 06 Oct 2000 17:35:58 +0200 | |
changeset 10168 | 50be659d4222 |
parent 8835 | 56187238220d |
permissions | -rw-r--r-- |
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
1 |
(* Title: HOL/UNITY/Lift |
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
2 |
ID: $Id$ |
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
4 |
Copyright 1998 University of Cambridge |
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
5 |
|
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
6 |
The Lift-Control Example |
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
7 |
*) |
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
8 |
|
5563 | 9 |
Goal "[| x ~: A; y : A |] ==> x ~= y"; |
10 |
by (Blast_tac 1); |
|
11 |
qed "not_mem_distinct"; |
|
12 |
||
5340 | 13 |
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
14 |
Addsimps [Lift_def RS def_prg_Init]; |
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
15 |
program_defs_ref := [Lift_def]; |
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
16 |
|
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
17 |
Addsimps (map simp_of_act |
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
18 |
[request_act_def, open_act_def, close_act_def, |
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
19 |
req_up_def, req_down_def, move_up_def, move_down_def, |
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
20 |
button_press_def]); |
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
21 |
|
7403 | 22 |
(*The ALWAYS properties*) |
23 |
Addsimps (map simp_of_set [above_def, below_def, queueing_def, |
|
24 |
goingup_def, goingdown_def, ready_def]); |
|
5357 | 25 |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
26 |
Addsimps [bounded_def, open_stop_def, open_move_def, stop_floor_def, |
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
27 |
moving_up_def, moving_down_def]; |
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
28 |
|
5357 | 29 |
AddIffs [Min_le_Max]; |
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
30 |
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
31 |
Goal "Lift : Always open_stop"; |
7403 | 32 |
by (always_tac 1); |
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
33 |
qed "open_stop"; |
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
34 |
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
35 |
Goal "Lift : Always stop_floor"; |
7403 | 36 |
by (always_tac 1); |
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
37 |
qed "stop_floor"; |
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
38 |
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
39 |
(*This one needs open_stop, which was proved above*) |
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
40 |
Goal "Lift : Always open_move"; |
7403 | 41 |
by (cut_facts_tac [open_stop] 1); |
42 |
by (always_tac 1); |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
43 |
qed "open_move"; |
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
44 |
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
45 |
Goal "Lift : Always moving_up"; |
7403 | 46 |
by (always_tac 1); |
47 |
by (auto_tac (claset() addDs [zle_imp_zless_or_eq], |
|
7000
6920cf9b8623
rewrite add1_zle_eq is no longer in the default simpset
paulson
parents:
6916
diff
changeset
|
48 |
simpset() addsimps [add1_zle_eq])); |
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
49 |
qed "moving_up"; |
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
50 |
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
51 |
Goal "Lift : Always moving_down"; |
7403 | 52 |
by (always_tac 1); |
5563 | 53 |
by (blast_tac (claset() addDs [zle_imp_zless_or_eq]) 1); |
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
54 |
qed "moving_down"; |
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
55 |
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
56 |
Goal "Lift : Always bounded"; |
7403 | 57 |
by (cut_facts_tac [moving_up, moving_down] 1); |
58 |
by (always_tac 1); |
|
6161 | 59 |
by Auto_tac; |
8835 | 60 |
by (ALLGOALS (dtac not_mem_distinct THEN' assume_tac)); |
61 |
by (ALLGOALS arith_tac); |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
62 |
qed "bounded"; |
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
63 |
|
5320 | 64 |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
65 |
|
5320 | 66 |
(*** Progress ***) |
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
67 |
|
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
68 |
|
5320 | 69 |
val abbrev_defs = [moving_def, stopped_def, |
5340 | 70 |
opened_def, closed_def, atFloor_def, Req_def]; |
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
71 |
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
72 |
Addsimps (map simp_of_set abbrev_defs); |
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
73 |
|
5340 | 74 |
|
75 |
(** The HUG'93 paper mistakenly omits the Req n from these! **) |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
76 |
|
5357 | 77 |
(** Lift_1 **) |
78 |
||
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
79 |
Goal "Lift : (stopped Int atFloor n) LeadsTo (opened Int atFloor n)"; |
5340 | 80 |
by (cut_facts_tac [stop_floor] 1); |
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
81 |
by (ensures_tac "open_act" 1); |
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
82 |
qed "E_thm01"; (*lem_lift_1_5*) |
5340 | 83 |
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
84 |
Goal "Lift : (Req n Int stopped - atFloor n) LeadsTo \ |
6139 | 85 |
\ (Req n Int opened - atFloor n)"; |
5340 | 86 |
by (cut_facts_tac [stop_floor] 1); |
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
87 |
by (ensures_tac "open_act" 1); |
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
88 |
qed "E_thm02"; (*lem_lift_1_1*) |
5340 | 89 |
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
90 |
Goal "Lift : (Req n Int opened - atFloor n) LeadsTo \ |
6139 | 91 |
\ (Req n Int closed - (atFloor n - queueing))"; |
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
92 |
by (ensures_tac "close_act" 1); |
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
93 |
qed "E_thm03"; (*lem_lift_1_2*) |
5340 | 94 |
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
95 |
Goal "Lift : (Req n Int closed Int (atFloor n - queueing)) \ |
6536 | 96 |
\ LeadsTo (opened Int atFloor n)"; |
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
97 |
by (ensures_tac "open_act" 1); |
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
98 |
qed "E_thm04"; (*lem_lift_1_7*) |
5340 | 99 |
|
100 |
||
5357 | 101 |
(** Lift 2. Statements of thm05a and thm05b were wrong! **) |
5340 | 102 |
|
103 |
Open_locale "floor"; |
|
104 |
||
5357 | 105 |
val Min_le_n = thm "Min_le_n"; |
106 |
val n_le_Max = thm "n_le_Max"; |
|
107 |
||
108 |
AddIffs [Min_le_n, n_le_Max]; |
|
5340 | 109 |
|
6676 | 110 |
val le_MinD = Min_le_n RS order_antisym; |
111 |
val Max_leD = n_le_Max RSN (2,order_antisym); |
|
5357 | 112 |
|
6676 | 113 |
val linorder_leI = linorder_not_less RS iffD1; |
114 |
||
115 |
AddSDs [le_MinD, linorder_leI RS le_MinD, |
|
116 |
Max_leD, linorder_leI RS Max_leD]; |
|
5357 | 117 |
|
118 |
(*lem_lift_2_0 |
|
119 |
NOT an ensures property, but a mere inclusion; |
|
120 |
don't know why script lift_2.uni says ENSURES*) |
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
121 |
Goal "Lift : (Req n Int closed - (atFloor n - queueing)) \ |
6536 | 122 |
\ LeadsTo ((closed Int goingup Int Req n) Un \ |
6139 | 123 |
\ (closed Int goingdown Int Req n))"; |
7403 | 124 |
by (auto_tac (claset() addSIs [subset_imp_LeadsTo] addSEs [int_neqE], |
125 |
simpset())); |
|
5340 | 126 |
qed "E_thm05c"; |
127 |
||
5357 | 128 |
(*lift_2*) |
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
129 |
Goal "Lift : (Req n Int closed - (atFloor n - queueing)) \ |
6536 | 130 |
\ LeadsTo (moving Int Req n)"; |
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
131 |
by (rtac ([E_thm05c, LeadsTo_Un] MRS LeadsTo_Trans) 1); |
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
132 |
by (ensures_tac "req_down" 2); |
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
133 |
by (ensures_tac "req_up" 1); |
5424
771a68a468cc
modified proofs for new constrains_tac and ensures_tac
paulson
parents:
5410
diff
changeset
|
134 |
by Auto_tac; |
5340 | 135 |
qed "lift_2"; |
136 |
||
137 |
||
5357 | 138 |
(** Towards lift_4 ***) |
5563 | 139 |
|
8835 | 140 |
val metric_ss = simpset() addsplits [split_if_asm] |
141 |
addsimps [metric_def, vimage_def]; |
|
142 |
||
5357 | 143 |
|
144 |
(*lem_lift_4_1 *) |
|
5563 | 145 |
Goal "#0 < N ==> \ |
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
146 |
\ Lift : (moving Int Req n Int {s. metric n s = N} Int \ |
6536 | 147 |
\ {s. floor s ~: req s} Int {s. up s}) \ |
148 |
\ LeadsTo \ |
|
6139 | 149 |
\ (moving Int Req n Int {s. metric n s < N})"; |
5357 | 150 |
by (cut_facts_tac [moving_up] 1); |
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
151 |
by (ensures_tac "move_up" 1); |
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
152 |
by Safe_tac; |
5357 | 153 |
(*this step consolidates two formulae to the goal metric n s' <= metric n s*) |
6676 | 154 |
by (etac (linorder_leI RS order_antisym RS sym) 1); |
8835 | 155 |
by (auto_tac (claset(), metric_ss)); |
5357 | 156 |
qed "E_thm12a"; |
157 |
||
158 |
||
159 |
(*lem_lift_4_3 *) |
|
5563 | 160 |
Goal "#0 < N ==> \ |
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
161 |
\ Lift : (moving Int Req n Int {s. metric n s = N} Int \ |
6536 | 162 |
\ {s. floor s ~: req s} - {s. up s}) \ |
163 |
\ LeadsTo (moving Int Req n Int {s. metric n s < N})"; |
|
5357 | 164 |
by (cut_facts_tac [moving_down] 1); |
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
165 |
by (ensures_tac "move_down" 1); |
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
166 |
by Safe_tac; |
5357 | 167 |
(*this step consolidates two formulae to the goal metric n s' <= metric n s*) |
6676 | 168 |
by (etac (linorder_leI RS order_antisym RS sym) 1); |
8835 | 169 |
by (auto_tac (claset(), metric_ss)); |
5357 | 170 |
qed "E_thm12b"; |
171 |
||
172 |
(*lift_4*) |
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
173 |
Goal "#0<N ==> Lift : (moving Int Req n Int {s. metric n s = N} Int \ |
6536 | 174 |
\ {s. floor s ~: req s}) LeadsTo \ |
5563 | 175 |
\ (moving Int Req n Int {s. metric n s < N})"; |
7403 | 176 |
by (rtac ([subset_imp_LeadsTo, [E_thm12a, E_thm12b] MRS LeadsTo_Un] |
177 |
MRS LeadsTo_Trans) 1); |
|
178 |
by Auto_tac; |
|
5357 | 179 |
qed "lift_4"; |
180 |
||
181 |
||
182 |
(** towards lift_5 **) |
|
183 |
||
184 |
(*lem_lift_5_3*) |
|
5563 | 185 |
Goal "#0<N \ |
8835 | 186 |
\ ==> Lift : (closed Int Req n Int {s. metric n s = N} Int goingup) LeadsTo \ |
187 |
\ (moving Int Req n Int {s. metric n s < N})"; |
|
5357 | 188 |
by (cut_facts_tac [bounded] 1); |
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
189 |
by (ensures_tac "req_up" 1); |
8835 | 190 |
by (auto_tac (claset(), metric_ss)); |
5357 | 191 |
qed "E_thm16a"; |
192 |
||
7079
eec20608c791
removed the combine_coeff simproc because linear arith does not handle
paulson
parents:
7000
diff
changeset
|
193 |
|
5357 | 194 |
(*lem_lift_5_1 has ~goingup instead of goingdown*) |
5563 | 195 |
Goal "#0<N ==> \ |
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
196 |
\ Lift : (closed Int Req n Int {s. metric n s = N} Int goingdown) LeadsTo \ |
5563 | 197 |
\ (moving Int Req n Int {s. metric n s < N})"; |
5357 | 198 |
by (cut_facts_tac [bounded] 1); |
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
199 |
by (ensures_tac "req_down" 1); |
8835 | 200 |
by (auto_tac (claset(), metric_ss)); |
5357 | 201 |
qed "E_thm16b"; |
202 |
||
203 |
||
204 |
(*lem_lift_5_0 proves an intersection involving ~goingup and goingup, |
|
205 |
i.e. the trivial disjunction, leading to an asymmetrical proof.*) |
|
5563 | 206 |
Goal "#0<N ==> Req n Int {s. metric n s = N} <= goingup Un goingdown"; |
8835 | 207 |
by (Clarify_tac 1); |
208 |
by (auto_tac (claset(), metric_ss)); |
|
5357 | 209 |
qed "E_thm16c"; |
210 |
||
211 |
||
212 |
(*lift_5*) |
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
213 |
Goal "#0<N ==> Lift : (closed Int Req n Int {s. metric n s = N}) LeadsTo \ |
5563 | 214 |
\ (moving Int Req n Int {s. metric n s < N})"; |
7403 | 215 |
by (rtac ([subset_imp_LeadsTo, [E_thm16a, E_thm16b] MRS LeadsTo_Un] |
216 |
MRS LeadsTo_Trans) 1); |
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
217 |
by (dtac E_thm16c 1); |
7403 | 218 |
by Auto_tac; |
5357 | 219 |
qed "lift_5"; |
220 |
||
221 |
||
222 |
(** towards lift_3 **) |
|
223 |
||
224 |
(*lemma used to prove lem_lift_3_1*) |
|
5563 | 225 |
Goal "[| metric n s = #0; Min <= floor s; floor s <= Max |] ==> floor s = n"; |
8835 | 226 |
by (auto_tac (claset(), metric_ss)); |
5357 | 227 |
qed "metric_eq_0D"; |
228 |
||
229 |
AddDs [metric_eq_0D]; |
|
230 |
||
231 |
||
232 |
(*lem_lift_3_1*) |
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
233 |
Goal "Lift : (moving Int Req n Int {s. metric n s = #0}) LeadsTo \ |
5357 | 234 |
\ (stopped Int atFloor n)"; |
235 |
by (cut_facts_tac [bounded] 1); |
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
236 |
by (ensures_tac "request_act" 1); |
5424
771a68a468cc
modified proofs for new constrains_tac and ensures_tac
paulson
parents:
5410
diff
changeset
|
237 |
by Auto_tac; |
5357 | 238 |
qed "E_thm11"; |
239 |
||
240 |
(*lem_lift_3_5*) |
|
6536 | 241 |
Goal |
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
242 |
"Lift : (moving Int Req n Int {s. metric n s = N} Int {s. floor s : req s}) \ |
6536 | 243 |
\ LeadsTo (stopped Int Req n Int {s. metric n s = N} Int {s. floor s : req s})"; |
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
244 |
by (ensures_tac "request_act" 1); |
8835 | 245 |
by (auto_tac (claset(), metric_ss)); |
5357 | 246 |
qed "E_thm13"; |
247 |
||
248 |
(*lem_lift_3_6*) |
|
5563 | 249 |
Goal "#0 < N ==> \ |
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
250 |
\ Lift : \ |
5563 | 251 |
\ (stopped Int Req n Int {s. metric n s = N} Int {s. floor s : req s}) \ |
6536 | 252 |
\ LeadsTo (opened Int Req n Int {s. metric n s = N})"; |
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
253 |
by (ensures_tac "open_act" 1); |
8835 | 254 |
by (auto_tac (claset(), metric_ss)); |
5357 | 255 |
qed "E_thm14"; |
256 |
||
257 |
(*lem_lift_3_7*) |
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
258 |
Goal "Lift : (opened Int Req n Int {s. metric n s = N}) \ |
6536 | 259 |
\ LeadsTo (closed Int Req n Int {s. metric n s = N})"; |
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
260 |
by (ensures_tac "close_act" 1); |
8835 | 261 |
by (auto_tac (claset(), metric_ss)); |
5357 | 262 |
qed "E_thm15"; |
263 |
||
264 |
||
265 |
(** the final steps **) |
|
266 |
||
5563 | 267 |
Goal "#0 < N ==> \ |
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
268 |
\ Lift : \ |
5563 | 269 |
\ (moving Int Req n Int {s. metric n s = N} Int {s. floor s : req s}) \ |
6536 | 270 |
\ LeadsTo (moving Int Req n Int {s. metric n s < N})"; |
5479 | 271 |
by (blast_tac (claset() addSIs [E_thm13, E_thm14, E_thm15, lift_5] |
272 |
addIs [LeadsTo_Trans]) 1); |
|
5357 | 273 |
qed "lift_3_Req"; |
274 |
||
275 |
||
5563 | 276 |
(*Now we observe that our integer metric is really a natural number*) |
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
277 |
Goal "Lift : Always {s. #0 <= metric n s}"; |
6570 | 278 |
by (rtac (bounded RS Always_weaken) 1); |
8835 | 279 |
by (auto_tac (claset(), metric_ss)); |
6570 | 280 |
qed "Always_nonneg"; |
5563 | 281 |
|
6570 | 282 |
val R_thm11 = [Always_nonneg, E_thm11] MRS Always_LeadsTo_weaken; |
5563 | 283 |
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
284 |
Goal "Lift : (moving Int Req n) LeadsTo (stopped Int atFloor n)"; |
6570 | 285 |
by (rtac (Always_nonneg RS integ_0_le_induct) 1); |
5563 | 286 |
by (case_tac "#0 < z" 1); |
287 |
(*If z <= #0 then actually z = #0*) |
|
7403 | 288 |
by (force_tac (claset() addIs [R_thm11, order_antisym], |
289 |
simpset() addsimps [linorder_not_less]) 2); |
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
290 |
by (rtac ([asm_rl, Un_upper1] MRS LeadsTo_weaken_R) 1); |
7403 | 291 |
by (rtac ([subset_imp_LeadsTo, [lift_4, lift_3_Req] MRS LeadsTo_Un] |
292 |
MRS LeadsTo_Trans) 1); |
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
293 |
by Auto_tac; |
5357 | 294 |
qed "lift_3"; |
295 |
||
296 |
||
7403 | 297 |
val LeadsTo_Trans_Un' = rotate_prems 1 LeadsTo_Trans_Un; |
298 |
(* [| Lift: B LeadsTo C; Lift: A LeadsTo B |] ==> Lift: (A Un B) LeadsTo C *) |
|
299 |
||
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
300 |
Goal "Lift : (Req n) LeadsTo (opened Int atFloor n)"; |
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
301 |
by (rtac LeadsTo_Trans 1); |
7403 | 302 |
by (rtac ([E_thm04, LeadsTo_Un_post] MRS LeadsTo_Un) 2); |
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
303 |
by (rtac (E_thm01 RS LeadsTo_Trans_Un') 2); |
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
304 |
by (rtac (lift_3 RS LeadsTo_Trans_Un') 2); |
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
305 |
by (rtac (lift_2 RS LeadsTo_Trans_Un') 2); |
7403 | 306 |
by (rtac ([E_thm03,E_thm02] MRS LeadsTo_Trans_Un') 2); |
6570 | 307 |
by (rtac (open_move RS Always_LeadsToI) 1); |
7403 | 308 |
by (rtac ([open_stop, subset_imp_LeadsTo] MRS Always_LeadsToI) 1); |
5340 | 309 |
by (Clarify_tac 1); |
5484 | 310 |
(*The case split is not essential but makes Blast_tac much faster. |
7403 | 311 |
Calling rotate_tac prevents simplification from looping*) |
5484 | 312 |
by (case_tac "open x" 1); |
313 |
by (ALLGOALS (rotate_tac ~1)); |
|
7403 | 314 |
by Auto_tac; |
5340 | 315 |
qed "lift_1"; |
316 |
||
6024 | 317 |
Close_locale "floor"; |