| author | paulson |
| Sun, 13 Jun 1999 13:54:56 +0200 | |
| changeset 6825 | 30e09714eef5 |
| parent 6740 | 5b5bf511fdd5 |
| child 6916 | 4957978b6f9e |
| 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 |
|
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
9 |
(*split_all_tac causes a big blow-up*) |
| 5706 | 10 |
claset_ref() := claset() delSWrapper record_split_name; |
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
11 |
|
| 5563 | 12 |
Goal "[| x ~: A; y : A |] ==> x ~= y"; |
13 |
by (Blast_tac 1); |
|
14 |
qed "not_mem_distinct"; |
|
15 |
||
16 |
fun distinct_tac i = |
|
17 |
dtac zle_neq_implies_zless i THEN |
|
18 |
eresolve_tac [not_mem_distinct, not_mem_distinct RS not_sym] i THEN |
|
19 |
assume_tac i; |
|
20 |
||
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
21 |
|
|
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
22 |
(** Rules to move "metric n s" out of the assumptions, for case splitting **) |
|
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
23 |
val mov_metric1 = read_instantiate_sg (sign_of thy) |
| 5596 | 24 |
[("P", "?x < metric ?n ?s")] rev_mp;
|
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
25 |
|
|
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
26 |
val mov_metric2 = read_instantiate_sg (sign_of thy) |
| 5596 | 27 |
[("P", "?x = metric ?n ?s")] rev_mp;
|
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
28 |
|
|
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
29 |
val mov_metric3 = read_instantiate_sg (sign_of thy) |
| 5596 | 30 |
[("P", "~ (?x < metric ?n ?s)")] rev_mp;
|
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
31 |
|
| 5563 | 32 |
val mov_metric4 = read_instantiate_sg (sign_of thy) |
| 5596 | 33 |
[("P", "(?x <= metric ?n ?s)")] rev_mp;
|
| 5563 | 34 |
|
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
35 |
(*The order in which they are applied seems to be critical...*) |
| 5563 | 36 |
val mov_metrics = [mov_metric2, mov_metric3, mov_metric1, mov_metric4]; |
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
37 |
|
| 6139 | 38 |
val metric_simps = [metric_def, vimage_def]; |
| 5563 | 39 |
|
| 5340 | 40 |
|
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
41 |
Addsimps [Lift_def RS def_prg_Init]; |
|
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
42 |
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
|
43 |
|
|
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
44 |
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
|
45 |
[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
|
46 |
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
|
47 |
button_press_def]); |
|
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
48 |
|
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
49 |
val always_defs = [above_def, below_def, queueing_def, |
|
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
50 |
goingup_def, goingdown_def, ready_def]; |
|
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
51 |
|
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
52 |
Addsimps (map simp_of_set always_defs); |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
53 |
|
|
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
54 |
|
| 5583 | 55 |
val LeadsTo_Trans_Un' = rotate_prems 1 LeadsTo_Trans_Un; |
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
56 |
(* [| Lift: B LeadsTo C; Lift: A LeadsTo B |] ==> Lift: (A Un B) LeadsTo C *) |
| 5357 | 57 |
|
58 |
||
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
59 |
(*Simplification for records*) |
|
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
60 |
Addsimps (thms"state.update_defs"); |
|
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
61 |
|
|
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
62 |
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
|
63 |
moving_up_def, moving_down_def]; |
|
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
64 |
|
| 5357 | 65 |
AddIffs [Min_le_Max]; |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
66 |
|
| 5320 | 67 |
|
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
68 |
Goal "Lift : Always open_stop"; |
| 6570 | 69 |
by (rtac AlwaysI 1); |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
70 |
by (Force_tac 1); |
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
71 |
by (constrains_tac 1); |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
72 |
qed "open_stop"; |
|
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
73 |
|
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
74 |
Goal "Lift : Always stop_floor"; |
| 6570 | 75 |
by (rtac AlwaysI 1); |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
76 |
by (Force_tac 1); |
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
77 |
by (constrains_tac 1); |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
78 |
qed "stop_floor"; |
|
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
79 |
|
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
80 |
(*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
|
81 |
Goal "Lift : Always open_move"; |
| 6570 | 82 |
by (rtac AlwaysI 1); |
83 |
by (rtac (open_stop RS Always_ConstrainsI RS StableI) 2); |
|
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
84 |
by (Force_tac 1); |
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
85 |
by (constrains_tac 1); |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
86 |
qed "open_move"; |
|
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
87 |
|
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
88 |
Goal "Lift : Always moving_up"; |
| 6570 | 89 |
by (rtac AlwaysI 1); |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
90 |
by (Force_tac 1); |
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
91 |
by (constrains_tac 1); |
| 5563 | 92 |
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
|
93 |
qed "moving_up"; |
|
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
94 |
|
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
95 |
Goal "Lift : Always moving_down"; |
| 6570 | 96 |
by (rtac AlwaysI 1); |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
97 |
by (Force_tac 1); |
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
98 |
by (constrains_tac 1); |
| 5563 | 99 |
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
|
100 |
qed "moving_down"; |
|
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
101 |
|
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
102 |
Goal "Lift : Always bounded"; |
| 6570 | 103 |
by (rtac AlwaysI 1); |
| 6740 | 104 |
by (rtac (Always_Int_rule [moving_up, moving_down] RS |
105 |
Always_ConstrainsI RS StableI) 2); |
|
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
106 |
by (Force_tac 1); |
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
107 |
by (constrains_tac 1); |
| 5563 | 108 |
by (ALLGOALS Clarify_tac); |
109 |
by (REPEAT_FIRST distinct_tac); |
|
| 6161 | 110 |
by Auto_tac; |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
111 |
qed "bounded"; |
|
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
112 |
|
| 5320 | 113 |
|
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
114 |
|
| 5320 | 115 |
(*** Progress ***) |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
116 |
|
|
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
117 |
|
| 5320 | 118 |
val abbrev_defs = [moving_def, stopped_def, |
| 5340 | 119 |
opened_def, closed_def, atFloor_def, Req_def]; |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
120 |
|
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
121 |
Addsimps (map simp_of_set abbrev_defs); |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
diff
changeset
|
122 |
|
| 5340 | 123 |
|
124 |
(** 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
|
125 |
|
| 5357 | 126 |
(** Lift_1 **) |
127 |
||
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
128 |
Goal "Lift : (stopped Int atFloor n) LeadsTo (opened Int atFloor n)"; |
| 5340 | 129 |
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
|
130 |
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
|
131 |
qed "E_thm01"; (*lem_lift_1_5*) |
| 5340 | 132 |
|
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
133 |
Goal "Lift : (Req n Int stopped - atFloor n) LeadsTo \ |
| 6139 | 134 |
\ (Req n Int opened - atFloor n)"; |
| 5340 | 135 |
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
|
136 |
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
|
137 |
qed "E_thm02"; (*lem_lift_1_1*) |
| 5340 | 138 |
|
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
139 |
Goal "Lift : (Req n Int opened - atFloor n) LeadsTo \ |
| 6139 | 140 |
\ (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
|
141 |
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
|
142 |
qed "E_thm03"; (*lem_lift_1_2*) |
| 5340 | 143 |
|
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
144 |
Goal "Lift : (Req n Int closed Int (atFloor n - queueing)) \ |
| 6536 | 145 |
\ 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
|
146 |
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
|
147 |
qed "E_thm04"; (*lem_lift_1_7*) |
| 5340 | 148 |
|
149 |
||
| 5357 | 150 |
(** Lift 2. Statements of thm05a and thm05b were wrong! **) |
| 5340 | 151 |
|
152 |
Open_locale "floor"; |
|
153 |
||
| 5357 | 154 |
val Min_le_n = thm "Min_le_n"; |
155 |
val n_le_Max = thm "n_le_Max"; |
|
156 |
||
157 |
AddIffs [Min_le_n, n_le_Max]; |
|
| 5340 | 158 |
|
| 6676 | 159 |
val le_MinD = Min_le_n RS order_antisym; |
160 |
val Max_leD = n_le_Max RSN (2,order_antisym); |
|
| 5357 | 161 |
|
| 6676 | 162 |
val linorder_leI = linorder_not_less RS iffD1; |
163 |
||
164 |
AddSDs [le_MinD, linorder_leI RS le_MinD, |
|
165 |
Max_leD, linorder_leI RS Max_leD]; |
|
| 5357 | 166 |
|
167 |
(*lem_lift_2_0 |
|
168 |
NOT an ensures property, but a mere inclusion; |
|
169 |
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
|
170 |
Goal "Lift : (Req n Int closed - (atFloor n - queueing)) \ |
| 6536 | 171 |
\ LeadsTo ((closed Int goingup Int Req n) Un \ |
| 6139 | 172 |
\ (closed Int goingdown 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
|
173 |
by (rtac subset_imp_LeadsTo 1); |
| 5563 | 174 |
by (auto_tac (claset() addSEs [int_neqE], simpset())); |
| 5340 | 175 |
qed "E_thm05c"; |
176 |
||
| 5357 | 177 |
(*lift_2*) |
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
178 |
Goal "Lift : (Req n Int closed - (atFloor n - queueing)) \ |
| 6536 | 179 |
\ 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
|
180 |
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
|
181 |
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
|
182 |
by (ensures_tac "req_up" 1); |
|
5424
771a68a468cc
modified proofs for new constrains_tac and ensures_tac
paulson
parents:
5410
diff
changeset
|
183 |
by Auto_tac; |
| 5340 | 184 |
qed "lift_2"; |
185 |
||
186 |
||
| 5357 | 187 |
(** Towards lift_4 ***) |
| 5563 | 188 |
|
| 5357 | 189 |
|
190 |
(*lem_lift_4_1 *) |
|
| 5563 | 191 |
Goal "#0 < N ==> \ |
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
192 |
\ Lift : (moving Int Req n Int {s. metric n s = N} Int \
|
| 6536 | 193 |
\ {s. floor s ~: req s} Int {s. up s}) \
|
194 |
\ LeadsTo \ |
|
| 6139 | 195 |
\ (moving Int Req n Int {s. metric n s < N})";
|
| 5357 | 196 |
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
|
197 |
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
|
198 |
by Safe_tac; |
| 5357 | 199 |
(*this step consolidates two formulae to the goal metric n s' <= metric n s*) |
| 6676 | 200 |
by (etac (linorder_leI RS order_antisym RS sym) 1); |
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
201 |
by (REPEAT_FIRST (eresolve_tac mov_metrics)); |
|
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
202 |
by (REPEAT_FIRST distinct_tac); |
| 5563 | 203 |
(** LEVEL 6 **) |
| 5583 | 204 |
by (ALLGOALS (asm_simp_tac (simpset() addsimps |
205 |
[zle_def] @ metric_simps @ zcompare_rls))); |
|
| 5357 | 206 |
qed "E_thm12a"; |
207 |
||
208 |
||
209 |
||
210 |
(*lem_lift_4_3 *) |
|
| 5563 | 211 |
Goal "#0 < N ==> \ |
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
212 |
\ Lift : (moving Int Req n Int {s. metric n s = N} Int \
|
| 6536 | 213 |
\ {s. floor s ~: req s} - {s. up s}) \
|
214 |
\ LeadsTo (moving Int Req n Int {s. metric n s < N})";
|
|
| 5357 | 215 |
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
|
216 |
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
|
217 |
by Safe_tac; |
| 5357 | 218 |
(*this step consolidates two formulae to the goal metric n s' <= metric n s*) |
| 6676 | 219 |
by (etac (linorder_leI RS order_antisym RS sym) 1); |
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
220 |
by (REPEAT_FIRST (eresolve_tac mov_metrics)); |
| 5563 | 221 |
by (REPEAT_FIRST distinct_tac); |
222 |
(** LEVEL 6 **) |
|
| 6139 | 223 |
by (ALLGOALS (asm_simp_tac (simpset() addsimps metric_simps @ zcompare_rls))); |
| 5357 | 224 |
qed "E_thm12b"; |
225 |
||
226 |
(*lift_4*) |
|
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
227 |
Goal "#0<N ==> Lift : (moving Int Req n Int {s. metric n s = N} Int \
|
| 6536 | 228 |
\ {s. floor s ~: req s}) LeadsTo \
|
| 5563 | 229 |
\ (moving 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
|
230 |
by (rtac ([subset_imp_LeadsTo, LeadsTo_Un] MRS LeadsTo_Trans) 1); |
| 5583 | 231 |
by (etac E_thm12b 3); |
232 |
by (etac E_thm12a 2); |
|
| 5357 | 233 |
by (Blast_tac 1); |
234 |
qed "lift_4"; |
|
235 |
||
236 |
||
237 |
(** towards lift_5 **) |
|
238 |
||
239 |
(*lem_lift_5_3*) |
|
| 5563 | 240 |
Goal "#0<N \ |
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
241 |
\ ==> Lift : (closed Int Req n Int {s. metric n s = N} Int goingup) LeadsTo \
|
| 5563 | 242 |
\ (moving Int Req n Int {s. metric n s < N})";
|
| 5357 | 243 |
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
|
244 |
by (ensures_tac "req_up" 1); |
|
5424
771a68a468cc
modified proofs for new constrains_tac and ensures_tac
paulson
parents:
5410
diff
changeset
|
245 |
by Auto_tac; |
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
246 |
by (REPEAT_FIRST (eresolve_tac mov_metrics)); |
| 6139 | 247 |
by (ALLGOALS (asm_simp_tac (simpset() addsimps metric_simps @ zcompare_rls))); |
| 6128 | 248 |
by (Blast_tac 1); |
| 5357 | 249 |
qed "E_thm16a"; |
250 |
||
251 |
(*lem_lift_5_1 has ~goingup instead of goingdown*) |
|
| 5563 | 252 |
Goal "#0<N ==> \ |
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
253 |
\ Lift : (closed Int Req n Int {s. metric n s = N} Int goingdown) LeadsTo \
|
| 5563 | 254 |
\ (moving Int Req n Int {s. metric n s < N})";
|
| 5357 | 255 |
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
|
256 |
by (ensures_tac "req_down" 1); |
|
5424
771a68a468cc
modified proofs for new constrains_tac and ensures_tac
paulson
parents:
5410
diff
changeset
|
257 |
by Auto_tac; |
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
258 |
by (REPEAT_FIRST (eresolve_tac mov_metrics)); |
| 6139 | 259 |
by (ALLGOALS (asm_simp_tac (simpset() addsimps metric_simps @ zcompare_rls))); |
| 6128 | 260 |
by (Blast_tac 1); |
| 5357 | 261 |
qed "E_thm16b"; |
262 |
||
263 |
||
264 |
||
265 |
(*lem_lift_5_0 proves an intersection involving ~goingup and goingup, |
|
266 |
i.e. the trivial disjunction, leading to an asymmetrical proof.*) |
|
| 5563 | 267 |
Goal "#0<N ==> Req n Int {s. metric n s = N} <= goingup Un goingdown";
|
268 |
by (asm_simp_tac (simpset() addsimps metric_simps) 1); |
|
|
5758
27a2b36efd95
corrected auto_tac (applications of unsafe wrappers)
oheimb
parents:
5706
diff
changeset
|
269 |
by (force_tac (claset() delrules [impCE] addEs [impCE], |
| 6139 | 270 |
simpset() addsimps conj_comms) 1); |
| 5357 | 271 |
qed "E_thm16c"; |
272 |
||
273 |
||
274 |
(*lift_5*) |
|
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
275 |
Goal "#0<N ==> Lift : (closed Int Req n Int {s. metric n s = N}) LeadsTo \
|
| 5563 | 276 |
\ (moving 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
|
277 |
by (rtac ([subset_imp_LeadsTo, LeadsTo_Un] MRS LeadsTo_Trans) 1); |
| 5583 | 278 |
by (etac E_thm16b 3); |
279 |
by (etac E_thm16a 2); |
|
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
280 |
by (dtac E_thm16c 1); |
| 5357 | 281 |
by (Blast_tac 1); |
282 |
qed "lift_5"; |
|
283 |
||
284 |
||
285 |
(** towards lift_3 **) |
|
286 |
||
287 |
(*lemma used to prove lem_lift_3_1*) |
|
| 5563 | 288 |
Goal "[| metric n s = #0; Min <= floor s; floor s <= Max |] ==> floor s = n"; |
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
289 |
by (etac rev_mp 1); |
| 5563 | 290 |
(*force simplification of "metric..." while in conclusion part*) |
291 |
by (asm_simp_tac (simpset() addsimps metric_simps) 1); |
|
| 5357 | 292 |
qed "metric_eq_0D"; |
293 |
||
294 |
AddDs [metric_eq_0D]; |
|
295 |
||
296 |
||
297 |
(*lem_lift_3_1*) |
|
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
298 |
Goal "Lift : (moving Int Req n Int {s. metric n s = #0}) LeadsTo \
|
| 5357 | 299 |
\ (stopped Int atFloor n)"; |
300 |
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
|
301 |
by (ensures_tac "request_act" 1); |
|
5424
771a68a468cc
modified proofs for new constrains_tac and ensures_tac
paulson
parents:
5410
diff
changeset
|
302 |
by Auto_tac; |
| 5357 | 303 |
qed "E_thm11"; |
304 |
||
305 |
(*lem_lift_3_5*) |
|
| 6536 | 306 |
Goal |
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
307 |
"Lift : (moving Int Req n Int {s. metric n s = N} Int {s. floor s : req s}) \
|
| 6536 | 308 |
\ 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
|
309 |
by (ensures_tac "request_act" 1); |
|
5424
771a68a468cc
modified proofs for new constrains_tac and ensures_tac
paulson
parents:
5410
diff
changeset
|
310 |
by (auto_tac (claset(), simpset() addsimps metric_simps)); |
| 5357 | 311 |
qed "E_thm13"; |
312 |
||
313 |
(*lem_lift_3_6*) |
|
| 5563 | 314 |
Goal "#0 < N ==> \ |
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
315 |
\ Lift : \ |
| 5563 | 316 |
\ (stopped Int Req n Int {s. metric n s = N} Int {s. floor s : req s}) \
|
| 6536 | 317 |
\ 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
|
318 |
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
|
319 |
by (REPEAT_FIRST (eresolve_tac mov_metrics)); |
|
5424
771a68a468cc
modified proofs for new constrains_tac and ensures_tac
paulson
parents:
5410
diff
changeset
|
320 |
by (auto_tac (claset(), simpset() addsimps metric_simps)); |
| 5357 | 321 |
qed "E_thm14"; |
322 |
||
323 |
(*lem_lift_3_7*) |
|
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
324 |
Goal "Lift : (opened Int Req n Int {s. metric n s = N}) \
|
| 6536 | 325 |
\ 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
|
326 |
by (ensures_tac "close_act" 1); |
|
5424
771a68a468cc
modified proofs for new constrains_tac and ensures_tac
paulson
parents:
5410
diff
changeset
|
327 |
by (auto_tac (claset(), simpset() addsimps metric_simps)); |
| 5357 | 328 |
qed "E_thm15"; |
329 |
||
330 |
||
331 |
(** the final steps **) |
|
332 |
||
| 5563 | 333 |
Goal "#0 < N ==> \ |
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
334 |
\ Lift : \ |
| 5563 | 335 |
\ (moving Int Req n Int {s. metric n s = N} Int {s. floor s : req s}) \
|
| 6536 | 336 |
\ LeadsTo (moving Int Req n Int {s. metric n s < N})";
|
| 5479 | 337 |
by (blast_tac (claset() addSIs [E_thm13, E_thm14, E_thm15, lift_5] |
338 |
addIs [LeadsTo_Trans]) 1); |
|
| 5357 | 339 |
qed "lift_3_Req"; |
340 |
||
341 |
||
| 5563 | 342 |
|
343 |
(*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
|
344 |
Goal "Lift : Always {s. #0 <= metric n s}";
|
| 6570 | 345 |
by (rtac (bounded RS Always_weaken) 1); |
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
346 |
by (auto_tac (claset(), simpset() addsimps metric_simps)); |
| 6570 | 347 |
qed "Always_nonneg"; |
| 5563 | 348 |
|
| 6570 | 349 |
val R_thm11 = [Always_nonneg, E_thm11] MRS Always_LeadsTo_weaken; |
| 5563 | 350 |
|
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
351 |
Goal "Lift : (moving Int Req n) LeadsTo (stopped Int atFloor n)"; |
| 6570 | 352 |
by (rtac (Always_nonneg RS integ_0_le_induct) 1); |
| 5563 | 353 |
by (case_tac "#0 < z" 1); |
354 |
(*If z <= #0 then actually z = #0*) |
|
355 |
by (fold_tac [zle_def]); |
|
| 6676 | 356 |
by (force_tac (claset() addIs [R_thm11, order_antisym], simpset()) 2); |
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
357 |
by (rtac ([asm_rl, Un_upper1] MRS LeadsTo_weaken_R) 1); |
|
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
358 |
by (rtac ([subset_imp_LeadsTo, LeadsTo_Un] MRS LeadsTo_Trans) 1); |
| 5583 | 359 |
by (rtac lift_3_Req 3); |
360 |
by (rtac lift_4 2); |
|
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
361 |
by Auto_tac; |
| 5357 | 362 |
qed "lift_3"; |
363 |
||
364 |
||
|
6718
e869ff059252
renamed Lprg to Lift; simplified proof of Always_nonneg
paulson
parents:
6676
diff
changeset
|
365 |
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
|
366 |
by (rtac LeadsTo_Trans 1); |
|
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
367 |
by (rtac (E_thm04 RS LeadsTo_Un) 2); |
| 5583 | 368 |
by (rtac LeadsTo_Un_post 2); |
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
369 |
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
|
370 |
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
|
371 |
by (rtac (lift_2 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
|
372 |
by (rtac (E_thm03 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
|
373 |
by (rtac E_thm02 2); |
| 6570 | 374 |
by (rtac (open_move RS Always_LeadsToI) 1); |
375 |
by (rtac (open_stop RS Always_LeadsToI) 1); |
|
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
376 |
by (rtac subset_imp_LeadsTo 1); |
| 5340 | 377 |
by (Clarify_tac 1); |
| 5484 | 378 |
(*The case split is not essential but makes Blast_tac much faster. |
379 |
Must also be careful to prevent simplification from looping*) |
|
380 |
by (case_tac "open x" 1); |
|
381 |
by (ALLGOALS (rotate_tac ~1)); |
|
382 |
by (ALLGOALS Asm_full_simp_tac); |
|
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5424
diff
changeset
|
383 |
by (Blast_tac 1); |
| 5340 | 384 |
qed "lift_1"; |
385 |
||
| 6024 | 386 |
Close_locale "floor"; |