author | wenzelm |
Fri, 11 Jan 2002 00:33:35 +0100 | |
changeset 12714 | 61af28328417 |
parent 12703 | af5fec8a418f |
child 12760 | 2356740225ce |
permissions | -rw-r--r-- |
5820 | 1 |
(* Title: Pure/Isar/proof.ML |
2 |
ID: $Id$ |
|
3 |
Author: Markus Wenzel, TU Muenchen |
|
8807 | 4 |
License: GPL (GNU GENERAL PUBLIC LICENSE) |
5820 | 5 |
|
6 |
Proof states and methods. |
|
7 |
*) |
|
8 |
||
8152 | 9 |
signature BASIC_PROOF = |
10 |
sig |
|
8374 | 11 |
val FINDGOAL: (int -> thm -> 'a Seq.seq) -> thm -> 'a Seq.seq |
12 |
val HEADGOAL: (int -> thm -> 'a Seq.seq) -> thm -> 'a Seq.seq |
|
8152 | 13 |
end; |
14 |
||
5820 | 15 |
signature PROOF = |
16 |
sig |
|
8152 | 17 |
include BASIC_PROOF |
5820 | 18 |
type context |
19 |
type state |
|
20 |
exception STATE of string * state |
|
6871 | 21 |
val check_result: string -> state -> 'a Seq.seq -> 'a Seq.seq |
12045 | 22 |
val init_state: theory -> state |
5820 | 23 |
val context_of: state -> context |
24 |
val theory_of: state -> theory |
|
25 |
val sign_of: state -> Sign.sg |
|
7924 | 26 |
val warn_extra_tfrees: state -> state -> state |
7605 | 27 |
val reset_thms: string -> state -> state |
6091 | 28 |
val the_facts: state -> thm list |
9469 | 29 |
val the_fact: state -> thm |
11079
a378479996f7
val get_goal: state -> context * (thm list * thm);
wenzelm
parents:
10938
diff
changeset
|
30 |
val get_goal: state -> context * (thm list * thm) |
6091 | 31 |
val goal_facts: (state -> thm list) -> state -> state |
5820 | 32 |
val use_facts: state -> state |
33 |
val reset_facts: state -> state |
|
9469 | 34 |
val is_chain: state -> bool |
6891 | 35 |
val assert_forward: state -> state |
9469 | 36 |
val assert_forward_or_chain: state -> state |
5820 | 37 |
val assert_backward: state -> state |
8206 | 38 |
val assert_no_chain: state -> state |
5820 | 39 |
val enter_forward: state -> state |
6529 | 40 |
val verbose: bool ref |
12423 | 41 |
val pretty_state: int -> state -> Pretty.T list |
10360 | 42 |
val pretty_goals: bool -> state -> Pretty.T list |
6776 | 43 |
val level: state -> int |
5820 | 44 |
type method |
6848 | 45 |
val method: (thm list -> tactic) -> method |
8374 | 46 |
val method_cases: (thm list -> thm -> (thm * (string * RuleCases.T) list) Seq.seq) -> method |
5820 | 47 |
val refine: (context -> method) -> state -> state Seq.seq |
8234 | 48 |
val refine_end: (context -> method) -> state -> state Seq.seq |
5936 | 49 |
val match_bind: (string list * string) list -> state -> state |
50 |
val match_bind_i: (term list * term) list -> state -> state |
|
8617
33e2bd53aec3
support Hindley-Milner polymorphisms in binds and facts;
wenzelm
parents:
8582
diff
changeset
|
51 |
val let_bind: (string list * string) list -> state -> state |
33e2bd53aec3
support Hindley-Milner polymorphisms in binds and facts;
wenzelm
parents:
8582
diff
changeset
|
52 |
val let_bind_i: (term list * term) list -> state -> state |
6876 | 53 |
val simple_have_thms: string -> thm list -> state -> state |
12714 | 54 |
val have_thmss: ((bstring * context attribute list) * |
55 |
(xstring * context attribute list) list) list -> state -> state |
|
56 |
val have_thmss_i: ((bstring * context attribute list) * |
|
9196 | 57 |
(thm list * context attribute list) list) list -> state -> state |
12714 | 58 |
val with_thmss: ((bstring * context attribute list) * |
59 |
(xstring * context attribute list) list) list -> state -> state |
|
60 |
val with_thmss_i: ((bstring * context attribute list) * |
|
9196 | 61 |
(thm list * context attribute list) list) list -> state -> state |
7412 | 62 |
val fix: (string list * string option) list -> state -> state |
7665 | 63 |
val fix_i: (string list * typ option) list -> state -> state |
9469 | 64 |
val assm: ProofContext.exporter |
10464 | 65 |
-> ((string * context attribute list) * (string * (string list * string list)) list) list |
7271 | 66 |
-> state -> state |
9469 | 67 |
val assm_i: ProofContext.exporter |
10464 | 68 |
-> ((string * context attribute list) * (term * (term list * term list)) list) list |
6932 | 69 |
-> state -> state |
10464 | 70 |
val assume: |
71 |
((string * context attribute list) * (string * (string list * string list)) list) list |
|
7271 | 72 |
-> state -> state |
10464 | 73 |
val assume_i: ((string * context attribute list) * (term * (term list * term list)) list) list |
6932 | 74 |
-> state -> state |
10464 | 75 |
val presume: |
76 |
((string * context attribute list) * (string * (string list * string list)) list) list |
|
6932 | 77 |
-> state -> state |
10464 | 78 |
val presume_i: ((string * context attribute list) * (term * (term list * term list)) list) list |
6932 | 79 |
-> state -> state |
11891 | 80 |
val def: string -> context attribute list -> string * (string * string list) -> state -> state |
81 |
val def_i: string -> context attribute list -> string * (term * term list) -> state -> state |
|
11793
5f0ab6f5c280
support impromptu terminology of cases parameters;
wenzelm
parents:
11742
diff
changeset
|
82 |
val invoke_case: string * string option list * context attribute list -> state -> state |
12242
282a92bc5655
multi_theorem: common statement header (covers *all* results);
wenzelm
parents:
12223
diff
changeset
|
83 |
val multi_theorem: string -> bstring * theory attribute list |
12698 | 84 |
-> (xstring * context attribute list list) option -> context attribute Locale.element list |
12146 | 85 |
-> ((bstring * theory attribute list) * (string * (string list * string list)) list) list |
86 |
-> theory -> state |
|
12242
282a92bc5655
multi_theorem: common statement header (covers *all* results);
wenzelm
parents:
12223
diff
changeset
|
87 |
val multi_theorem_i: string -> bstring * theory attribute list |
12698 | 88 |
-> (string * context attribute list list) option -> context attribute Locale.element_i list |
12146 | 89 |
-> ((bstring * theory attribute list) * (term * (term list * term list)) list) list |
90 |
-> theory -> state |
|
5820 | 91 |
val chain: state -> state |
6091 | 92 |
val from_facts: thm list -> state -> state |
12146 | 93 |
val show: (bool -> state -> state) -> (state -> state Seq.seq) |
94 |
-> ((string * context attribute list) * (string * (string list * string list)) list) list |
|
95 |
-> bool -> state -> state |
|
96 |
val show_i: (bool -> state -> state) -> (state -> state Seq.seq) |
|
97 |
-> ((string * context attribute list) * (term * (term list * term list)) list) list |
|
98 |
-> bool -> state -> state |
|
99 |
val have: (state -> state Seq.seq) |
|
100 |
-> ((string * context attribute list) * (string * (string list * string list)) list) list |
|
101 |
-> state -> state |
|
102 |
val have_i: (state -> state Seq.seq) |
|
103 |
-> ((string * context attribute list) * (term * (term list * term list)) list) list |
|
104 |
-> state -> state |
|
6404 | 105 |
val at_bottom: state -> bool |
6982 | 106 |
val local_qed: (state -> state Seq.seq) |
12146 | 107 |
-> (context -> string * (string * thm list) list -> unit) * (context -> thm -> unit) |
108 |
-> state -> state Seq.seq |
|
6950 | 109 |
val global_qed: (state -> state Seq.seq) -> state |
12244 | 110 |
-> (theory * ((string * string) * (string * thm list) list)) Seq.seq |
6896 | 111 |
val begin_block: state -> state |
6932 | 112 |
val end_block: state -> state Seq.seq |
6896 | 113 |
val next_block: state -> state |
5820 | 114 |
end; |
115 |
||
8152 | 116 |
signature PRIVATE_PROOF = |
5820 | 117 |
sig |
118 |
include PROOF |
|
119 |
val put_data: Object.kind -> ('a -> Object.T) -> 'a -> state -> state |
|
120 |
end; |
|
121 |
||
8152 | 122 |
structure Proof: PRIVATE_PROOF = |
5820 | 123 |
struct |
124 |
||
125 |
||
126 |
(** proof state **) |
|
127 |
||
128 |
type context = ProofContext.context; |
|
129 |
||
130 |
||
131 |
(* type goal *) |
|
132 |
||
133 |
datatype kind = |
|
12698 | 134 |
Theorem of string * (*theorem kind*) |
135 |
(bstring * theory attribute list) * (*common result binding*) |
|
136 |
(string * context attribute list list) option * (*target locale and attributes*) |
|
137 |
theory attribute list list | (*attributes of individual result binding*) |
|
138 |
Show of context attribute list list | (*intermediate result, solving subgoal*) |
|
139 |
Have of context attribute list list; (*intermediate result*) |
|
5820 | 140 |
|
12242
282a92bc5655
multi_theorem: common statement header (covers *all* results);
wenzelm
parents:
12223
diff
changeset
|
141 |
fun common_name "" = "" | common_name a = " " ^ a; |
282a92bc5655
multi_theorem: common statement header (covers *all* results);
wenzelm
parents:
12223
diff
changeset
|
142 |
|
282a92bc5655
multi_theorem: common statement header (covers *all* results);
wenzelm
parents:
12223
diff
changeset
|
143 |
fun kind_name _ (Theorem (s, (a, _), None, _)) = s ^ common_name a |
282a92bc5655
multi_theorem: common statement header (covers *all* results);
wenzelm
parents:
12223
diff
changeset
|
144 |
| kind_name sg (Theorem (s, (a, _), Some (name, _), _)) = |
282a92bc5655
multi_theorem: common statement header (covers *all* results);
wenzelm
parents:
12223
diff
changeset
|
145 |
s ^ common_name a ^ " (in " ^ Locale.cond_extern sg name ^ ")" |
12015 | 146 |
| kind_name _ (Show _) = "show" |
147 |
| kind_name _ (Have _) = "have"; |
|
5820 | 148 |
|
149 |
type goal = |
|
12146 | 150 |
(kind * (*result kind*) |
151 |
string list * (*result names*) |
|
152 |
term list list) * (*result statements*) |
|
153 |
(thm list * (*use facts*) |
|
154 |
thm); (*goal: subgoals ==> statement*) |
|
5820 | 155 |
|
156 |
||
157 |
(* type mode *) |
|
158 |
||
159 |
datatype mode = Forward | ForwardChain | Backward; |
|
7201 | 160 |
val mode_name = (fn Forward => "state" | ForwardChain => "chain" | Backward => "prove"); |
5820 | 161 |
|
162 |
||
163 |
(* datatype state *) |
|
164 |
||
7176 | 165 |
datatype node = |
166 |
Node of |
|
167 |
{context: context, |
|
168 |
facts: thm list option, |
|
169 |
mode: mode, |
|
170 |
goal: (goal * (state -> state Seq.seq)) option} |
|
171 |
and state = |
|
5820 | 172 |
State of |
173 |
node * (*current*) |
|
174 |
node list; (*parents wrt. block structure*) |
|
175 |
||
7176 | 176 |
fun make_node (context, facts, mode, goal) = |
177 |
Node {context = context, facts = facts, mode = mode, goal = goal}; |
|
178 |
||
179 |
||
5820 | 180 |
exception STATE of string * state; |
181 |
||
182 |
fun err_malformed name state = |
|
183 |
raise STATE (name ^ ": internal error -- malformed proof state", state); |
|
184 |
||
6871 | 185 |
fun check_result msg state sq = |
186 |
(case Seq.pull sq of |
|
187 |
None => raise STATE (msg, state) |
|
188 |
| Some s_sq => Seq.cons s_sq); |
|
189 |
||
5820 | 190 |
|
7176 | 191 |
fun map_current f (State (Node {context, facts, mode, goal}, nodes)) = |
5820 | 192 |
State (make_node (f (context, facts, mode, goal)), nodes); |
193 |
||
12045 | 194 |
fun init_state thy = |
195 |
State (make_node (ProofContext.init thy, None, Forward, None), []); |
|
196 |
||
5820 | 197 |
|
198 |
||
199 |
(** basic proof state operations **) |
|
200 |
||
201 |
(* context *) |
|
202 |
||
7176 | 203 |
fun context_of (State (Node {context, ...}, _)) = context; |
5820 | 204 |
val theory_of = ProofContext.theory_of o context_of; |
205 |
val sign_of = ProofContext.sign_of o context_of; |
|
206 |
||
207 |
fun map_context f = map_current (fn (ctxt, facts, mode, goal) => (f ctxt, facts, mode, goal)); |
|
208 |
||
7176 | 209 |
fun map_context_result f (state as State (Node {context, facts, mode, goal}, nodes)) = |
5820 | 210 |
let val (context', result) = f context |
211 |
in (State (make_node (context', facts, mode, goal), nodes), result) end; |
|
212 |
||
213 |
||
214 |
fun put_data kind f = map_context o ProofContext.put_data kind f; |
|
7924 | 215 |
val warn_extra_tfrees = map_context o ProofContext.warn_extra_tfrees o context_of; |
10809 | 216 |
val add_binds_i = map_context o ProofContext.add_binds_i; |
6790 | 217 |
val auto_bind_goal = map_context o ProofContext.auto_bind_goal; |
12146 | 218 |
val auto_bind_facts = map_context o ProofContext.auto_bind_facts; |
6091 | 219 |
val put_thms = map_context o ProofContext.put_thms; |
220 |
val put_thmss = map_context o ProofContext.put_thmss; |
|
7605 | 221 |
val reset_thms = map_context o ProofContext.reset_thms; |
8374 | 222 |
val get_case = ProofContext.get_case o context_of; |
5820 | 223 |
|
224 |
||
225 |
(* facts *) |
|
226 |
||
7176 | 227 |
fun the_facts (State (Node {facts = Some facts, ...}, _)) = facts |
5820 | 228 |
| the_facts state = raise STATE ("No current facts available", state); |
229 |
||
9469 | 230 |
fun the_fact state = |
231 |
(case the_facts state of |
|
232 |
[thm] => thm |
|
233 |
| _ => raise STATE ("Single fact expected", state)); |
|
234 |
||
6848 | 235 |
fun assert_facts state = (the_facts state; state); |
7176 | 236 |
fun get_facts (State (Node {facts, ...}, _)) = facts; |
6848 | 237 |
|
7605 | 238 |
|
239 |
val thisN = "this"; |
|
240 |
||
5820 | 241 |
fun put_facts facts state = |
242 |
state |
|
243 |
|> map_current (fn (ctxt, _, mode, goal) => (ctxt, facts, mode, goal)) |
|
7605 | 244 |
|> (case facts of None => reset_thms thisN | Some ths => put_thms (thisN, ths)); |
5820 | 245 |
|
246 |
val reset_facts = put_facts None; |
|
247 |
||
9196 | 248 |
fun these_factss (state, named_factss) = |
5820 | 249 |
state |
9196 | 250 |
|> put_thmss named_factss |
251 |
|> put_facts (Some (flat (map #2 named_factss))); |
|
5820 | 252 |
|
253 |
||
254 |
(* goal *) |
|
255 |
||
10553 | 256 |
local |
257 |
fun find i (state as State (Node {goal = Some goal, ...}, _)) = (context_of state, (i, goal)) |
|
258 |
| find i (State (Node {goal = None, ...}, node :: nodes)) = find (i + 1) (State (node, nodes)) |
|
259 |
| find _ (state as State (_, [])) = err_malformed "find_goal" state; |
|
260 |
in val find_goal = find 0 end; |
|
7176 | 261 |
|
11079
a378479996f7
val get_goal: state -> context * (thm list * thm);
wenzelm
parents:
10938
diff
changeset
|
262 |
fun get_goal state = |
a378479996f7
val get_goal: state -> context * (thm list * thm);
wenzelm
parents:
10938
diff
changeset
|
263 |
let val (ctxt, (_, ((_, x), _))) = find_goal state |
a378479996f7
val get_goal: state -> context * (thm list * thm);
wenzelm
parents:
10938
diff
changeset
|
264 |
in (ctxt, x) end; |
a378479996f7
val get_goal: state -> context * (thm list * thm);
wenzelm
parents:
10938
diff
changeset
|
265 |
|
5820 | 266 |
fun put_goal goal = map_current (fn (ctxt, facts, mode, _) => (ctxt, facts, mode, goal)); |
267 |
||
8374 | 268 |
fun map_goal f g (State (Node {context, facts, mode, goal = Some goal}, nodes)) = |
269 |
State (make_node (f context, facts, mode, Some (g goal)), nodes) |
|
270 |
| map_goal f g (State (nd, node :: nodes)) = |
|
271 |
let val State (node', nodes') = map_goal f g (State (node, nodes)) |
|
272 |
in map_context f (State (nd, node' :: nodes')) end |
|
273 |
| map_goal _ _ state = state; |
|
5820 | 274 |
|
275 |
fun goal_facts get state = |
|
276 |
state |
|
8374 | 277 |
|> map_goal I (fn ((result, (_, thm)), f) => ((result, (get state, thm)), f)); |
5820 | 278 |
|
279 |
fun use_facts state = |
|
280 |
state |
|
281 |
|> goal_facts the_facts |
|
282 |
|> reset_facts; |
|
283 |
||
284 |
||
285 |
(* mode *) |
|
286 |
||
7176 | 287 |
fun get_mode (State (Node {mode, ...}, _)) = mode; |
5820 | 288 |
fun put_mode mode = map_current (fn (ctxt, facts, _, goal) => (ctxt, facts, mode, goal)); |
289 |
||
290 |
val enter_forward = put_mode Forward; |
|
291 |
val enter_forward_chain = put_mode ForwardChain; |
|
292 |
val enter_backward = put_mode Backward; |
|
293 |
||
294 |
fun assert_mode pred state = |
|
295 |
let val mode = get_mode state in |
|
296 |
if pred mode then state |
|
12010 | 297 |
else raise STATE ("Illegal application of proof command in " |
298 |
^ quote (mode_name mode) ^ " mode", state) |
|
5820 | 299 |
end; |
300 |
||
301 |
fun is_chain state = get_mode state = ForwardChain; |
|
302 |
val assert_forward = assert_mode (equal Forward); |
|
303 |
val assert_forward_or_chain = assert_mode (equal Forward orf equal ForwardChain); |
|
304 |
val assert_backward = assert_mode (equal Backward); |
|
8206 | 305 |
val assert_no_chain = assert_mode (not_equal ForwardChain); |
5820 | 306 |
|
307 |
||
308 |
(* blocks *) |
|
309 |
||
6776 | 310 |
fun level (State (_, nodes)) = length nodes; |
311 |
||
5820 | 312 |
fun open_block (State (node, nodes)) = State (node, node :: nodes); |
313 |
||
314 |
fun new_block state = |
|
315 |
state |
|
316 |
|> open_block |
|
317 |
|> put_goal None; |
|
318 |
||
7487
c0f9b956a3e7
close_block: removed ProofContext.transfer_used_names;
wenzelm
parents:
7478
diff
changeset
|
319 |
fun close_block (state as State (_, node :: nodes)) = State (node, nodes) |
5820 | 320 |
| close_block state = raise STATE ("Unbalanced block parentheses", state); |
321 |
||
322 |
||
323 |
||
12423 | 324 |
(** pretty_state **) |
5820 | 325 |
|
6529 | 326 |
val verbose = ProofContext.verbose; |
327 |
||
12085 | 328 |
fun pretty_goals_local ctxt = Display.pretty_goals_aux |
329 |
(ProofContext.pretty_sort ctxt, ProofContext.pretty_typ ctxt, ProofContext.pretty_term ctxt); |
|
330 |
||
12055 | 331 |
fun pretty_facts _ _ None = [] |
332 |
| pretty_facts s ctxt (Some ths) = |
|
333 |
[Pretty.big_list (s ^ "this:") (map (ProofContext.pretty_thm ctxt) ths), Pretty.str ""]; |
|
6756 | 334 |
|
12423 | 335 |
fun pretty_state nr (state as State (Node {context = ctxt, facts, mode, goal = _}, nodes)) = |
5820 | 336 |
let |
11891 | 337 |
val ref (_, _, begin_goal) = Display.current_goals_markers; |
5820 | 338 |
|
339 |
fun levels_up 0 = "" |
|
7575 | 340 |
| levels_up 1 = ", 1 level up" |
341 |
| levels_up i = ", " ^ string_of_int i ^ " levels up"; |
|
5820 | 342 |
|
11556 | 343 |
fun subgoals 0 = "" |
344 |
| subgoals 1 = ", 1 subgoal" |
|
345 |
| subgoals n = ", " ^ string_of_int n ^ " subgoals"; |
|
12146 | 346 |
|
347 |
fun prt_names names = |
|
12242
282a92bc5655
multi_theorem: common statement header (covers *all* results);
wenzelm
parents:
12223
diff
changeset
|
348 |
(case filter_out (equal "") names of [] => "" |
12308 | 349 |
| nms => " " ^ enclose "(" ")" (space_implode " and " (take (7, nms) @ |
350 |
(if length nms > 7 then ["..."] else [])))); |
|
12146 | 351 |
|
352 |
fun prt_goal (_, (i, (((kind, names, _), (goal_facts, thm)), _))) = |
|
12085 | 353 |
pretty_facts "using " ctxt |
8462 | 354 |
(if mode <> Backward orelse null goal_facts then None else Some goal_facts) @ |
12146 | 355 |
[Pretty.str ("goal (" ^ kind_name (sign_of state) kind ^ prt_names names ^ |
356 |
levels_up (i div 2) ^ subgoals (Thm.nprems_of thm) ^ "):")] @ |
|
12085 | 357 |
pretty_goals_local ctxt begin_goal (true, true) (! Display.goals_limit) thm; |
6848 | 358 |
|
8462 | 359 |
val ctxt_prts = |
12085 | 360 |
if ! verbose orelse mode = Forward then ProofContext.pretty_context ctxt |
361 |
else if mode = Backward then ProofContext.pretty_asms ctxt |
|
7575 | 362 |
else []; |
8462 | 363 |
|
364 |
val prts = |
|
8582 | 365 |
[Pretty.str ("proof (" ^ mode_name mode ^ "): step " ^ string_of_int nr ^ |
12010 | 366 |
(if ! verbose then ", depth " ^ string_of_int (length nodes div 2 - 1) |
8561 | 367 |
else "")), Pretty.str ""] @ |
8462 | 368 |
(if null ctxt_prts then [] else ctxt_prts @ [Pretty.str ""]) @ |
369 |
(if ! verbose orelse mode = Forward then |
|
12146 | 370 |
(pretty_facts "" ctxt facts @ prt_goal (find_goal state)) |
12085 | 371 |
else if mode = ForwardChain then pretty_facts "picking " ctxt facts |
12146 | 372 |
else prt_goal (find_goal state)) |
12423 | 373 |
in prts end; |
5820 | 374 |
|
12085 | 375 |
fun pretty_goals main state = |
376 |
let val (ctxt, (_, ((_, (_, thm)), _))) = find_goal state |
|
377 |
in pretty_goals_local ctxt "" (false, main) (! Display.goals_limit) thm end; |
|
10320 | 378 |
|
5820 | 379 |
|
380 |
||
381 |
(** proof steps **) |
|
382 |
||
383 |
(* datatype method *) |
|
384 |
||
8374 | 385 |
datatype method = |
386 |
Method of thm list -> thm -> (thm * (string * RuleCases.T) list) Seq.seq; |
|
387 |
||
388 |
fun method tac = Method (fn facts => fn st => Seq.map (rpair []) (tac facts st)); |
|
389 |
val method_cases = Method; |
|
5820 | 390 |
|
391 |
||
392 |
(* refine goal *) |
|
393 |
||
8234 | 394 |
local |
395 |
||
5820 | 396 |
fun check_sign sg state = |
397 |
if Sign.subsig (sg, sign_of state) then state |
|
398 |
else raise STATE ("Bad signature of result: " ^ Sign.str_of_sg sg, state); |
|
399 |
||
8234 | 400 |
fun gen_refine current_context meth_fun state = |
6848 | 401 |
let |
10553 | 402 |
val (goal_ctxt, (_, ((result, (facts, thm)), f))) = find_goal state; |
8234 | 403 |
val Method meth = meth_fun (if current_context then context_of state else goal_ctxt); |
5820 | 404 |
|
8374 | 405 |
fun refn (thm', cases) = |
6848 | 406 |
state |
407 |
|> check_sign (Thm.sign_of_thm thm') |
|
8374 | 408 |
|> map_goal (ProofContext.add_cases cases) (K ((result, (facts, thm')), f)); |
6848 | 409 |
in Seq.map refn (meth facts thm) end; |
5820 | 410 |
|
8234 | 411 |
in |
412 |
||
413 |
val refine = gen_refine true; |
|
414 |
val refine_end = gen_refine false; |
|
415 |
||
416 |
end; |
|
417 |
||
5820 | 418 |
|
11917 | 419 |
(* goal addressing *) |
6932 | 420 |
|
8152 | 421 |
fun FINDGOAL tac st = |
8374 | 422 |
let fun find (i, n) = if i > n then Seq.fail else Seq.APPEND (tac i, find (i + 1, n)) |
423 |
in find (1, Thm.nprems_of st) st end; |
|
8152 | 424 |
|
8166 | 425 |
fun HEADGOAL tac = tac 1; |
426 |
||
9469 | 427 |
|
428 |
(* export results *) |
|
429 |
||
11816 | 430 |
fun refine_tac rule = |
12703
af5fec8a418f
refine_tac: Tactic.norm_hhf_tac before trying rule;
wenzelm
parents:
12698
diff
changeset
|
431 |
Tactic.norm_hhf_tac THEN' Tactic.rtac rule THEN_ALL_NEW (SUBGOAL (fn (goal, i) => |
11816 | 432 |
if can Logic.dest_goal (Logic.strip_assums_concl goal) then |
433 |
Tactic.etac Drule.triv_goal i |
|
434 |
else all_tac)); |
|
435 |
||
12146 | 436 |
fun export_goal inner print_rule raw_rule state = |
6932 | 437 |
let |
10553 | 438 |
val (outer, (_, ((result, (facts, thm)), f))) = find_goal state; |
12010 | 439 |
val exp_tac = ProofContext.export true inner outer; |
9469 | 440 |
fun exp_rule rule = |
441 |
let |
|
12055 | 442 |
val _ = print_rule outer rule; |
11816 | 443 |
val thmq = FINDGOAL (refine_tac rule) thm; |
9469 | 444 |
in Seq.map (fn th => map_goal I (K ((result, (facts, th)), f)) state) thmq end; |
445 |
in raw_rule |> exp_tac |> (Seq.flat o Seq.map exp_rule) end; |
|
6932 | 446 |
|
12146 | 447 |
fun export_goals inner print_rule raw_rules = |
448 |
Seq.EVERY (map (export_goal inner print_rule) raw_rules); |
|
449 |
||
6932 | 450 |
fun transfer_facts inner_state state = |
451 |
(case get_facts inner_state of |
|
452 |
None => Seq.single (reset_facts state) |
|
8617
33e2bd53aec3
support Hindley-Milner polymorphisms in binds and facts;
wenzelm
parents:
8582
diff
changeset
|
453 |
| Some thms => |
33e2bd53aec3
support Hindley-Milner polymorphisms in binds and facts;
wenzelm
parents:
8582
diff
changeset
|
454 |
let |
12010 | 455 |
val exp_tac = ProofContext.export false (context_of inner_state) (context_of state); |
11816 | 456 |
val thmqs = map exp_tac thms; |
8617
33e2bd53aec3
support Hindley-Milner polymorphisms in binds and facts;
wenzelm
parents:
8582
diff
changeset
|
457 |
in Seq.map (fn ths => put_facts (Some ths) state) (Seq.commute thmqs) end); |
6932 | 458 |
|
459 |
||
460 |
(* prepare result *) |
|
461 |
||
12146 | 462 |
fun prep_result state ts raw_th = |
5820 | 463 |
let |
464 |
val ctxt = context_of state; |
|
465 |
fun err msg = raise STATE (msg, state); |
|
466 |
||
12146 | 467 |
val ngoals = Thm.nprems_of raw_th; |
5820 | 468 |
val _ = |
469 |
if ngoals = 0 then () |
|
12085 | 470 |
else (err (Pretty.string_of (Pretty.chunks (pretty_goals_local ctxt "" (true, true) |
12146 | 471 |
(! Display.goals_limit) raw_th @ |
12085 | 472 |
[Pretty.str (string_of_int ngoals ^ " unsolved goal(s)!")])))); |
5820 | 473 |
|
12146 | 474 |
val {hyps, sign, ...} = Thm.rep_thm raw_th; |
5820 | 475 |
val tsig = Sign.tsig_of sign; |
12055 | 476 |
val casms = flat (map #1 (ProofContext.assumptions_of (context_of state))); |
11816 | 477 |
val bad_hyps = Library.gen_rems Term.aconv (hyps, map Thm.term_of casms); |
12146 | 478 |
|
479 |
val th = raw_th RS Drule.rev_triv_goal; |
|
480 |
val ths = Drule.conj_elim_precise (length ts) th |
|
481 |
handle THM _ => err "Main goal structure corrupted"; |
|
482 |
val props = map (#prop o Thm.rep_thm) ths; |
|
5820 | 483 |
in |
12146 | 484 |
conditional (not (null bad_hyps)) (fn () => err ("Additional hypotheses:\n" ^ |
485 |
cat_lines (map (ProofContext.string_of_term ctxt) bad_hyps))); |
|
486 |
conditional (exists (not o Pattern.matches tsig) (ts ~~ props)) (fn () => |
|
487 |
err ("Proved a different theorem: " ^ Pretty.string_of (ProofContext.pretty_thm ctxt th))); |
|
488 |
ths |
|
5820 | 489 |
end; |
490 |
||
491 |
||
492 |
||
493 |
(*** structured proof commands ***) |
|
494 |
||
495 |
(** context **) |
|
496 |
||
497 |
(* bind *) |
|
498 |
||
499 |
fun gen_bind f x state = |
|
500 |
state |
|
501 |
|> assert_forward |
|
502 |
|> map_context (f x) |
|
503 |
|> reset_facts; |
|
504 |
||
8617
33e2bd53aec3
support Hindley-Milner polymorphisms in binds and facts;
wenzelm
parents:
8582
diff
changeset
|
505 |
val match_bind = gen_bind (ProofContext.match_bind false); |
33e2bd53aec3
support Hindley-Milner polymorphisms in binds and facts;
wenzelm
parents:
8582
diff
changeset
|
506 |
val match_bind_i = gen_bind (ProofContext.match_bind_i false); |
33e2bd53aec3
support Hindley-Milner polymorphisms in binds and facts;
wenzelm
parents:
8582
diff
changeset
|
507 |
val let_bind = gen_bind (ProofContext.match_bind true); |
33e2bd53aec3
support Hindley-Milner polymorphisms in binds and facts;
wenzelm
parents:
8582
diff
changeset
|
508 |
val let_bind_i = gen_bind (ProofContext.match_bind_i true); |
5820 | 509 |
|
510 |
||
12714 | 511 |
(* have_thmss *) |
5820 | 512 |
|
12714 | 513 |
local |
514 |
||
515 |
fun gen_have_thmss f args state = |
|
5820 | 516 |
state |
517 |
|> assert_forward |
|
12714 | 518 |
|> map_context_result (f args) |
9196 | 519 |
|> these_factss; |
5820 | 520 |
|
12714 | 521 |
in |
522 |
||
523 |
val have_thmss = gen_have_thmss ProofContext.have_thmss; |
|
524 |
val have_thmss_i = gen_have_thmss ProofContext.have_thmss_i; |
|
525 |
||
526 |
fun simple_have_thms name thms = have_thmss_i [((name, []), [(thms, [])])]; |
|
527 |
||
528 |
end; |
|
529 |
||
530 |
||
531 |
(* with_thmss *) |
|
9196 | 532 |
|
12714 | 533 |
local |
534 |
||
535 |
fun gen_with_thmss f args state = |
|
536 |
let val state' = state |> f args |
|
9196 | 537 |
in state' |> simple_have_thms "" (the_facts state' @ the_facts state) end; |
6876 | 538 |
|
12714 | 539 |
in |
540 |
||
541 |
val with_thmss = gen_with_thmss have_thmss; |
|
542 |
val with_thmss_i = gen_with_thmss have_thmss_i; |
|
543 |
||
544 |
end; |
|
545 |
||
5820 | 546 |
|
547 |
(* fix *) |
|
548 |
||
549 |
fun gen_fix f xs state = |
|
550 |
state |
|
551 |
|> assert_forward |
|
552 |
|> map_context (f xs) |
|
553 |
|> reset_facts; |
|
554 |
||
555 |
val fix = gen_fix ProofContext.fix; |
|
556 |
val fix_i = gen_fix ProofContext.fix_i; |
|
557 |
||
558 |
||
11891 | 559 |
(* assume and presume *) |
5820 | 560 |
|
9469 | 561 |
fun gen_assume f exp args state = |
5820 | 562 |
state |
563 |
|> assert_forward |
|
9469 | 564 |
|> map_context_result (f exp args) |
11924 | 565 |
|> these_factss; |
6932 | 566 |
|
7271 | 567 |
val assm = gen_assume ProofContext.assume; |
568 |
val assm_i = gen_assume ProofContext.assume_i; |
|
11917 | 569 |
val assume = assm ProofContext.export_assume; |
570 |
val assume_i = assm_i ProofContext.export_assume; |
|
571 |
val presume = assm ProofContext.export_presume; |
|
572 |
val presume_i = assm_i ProofContext.export_presume; |
|
5820 | 573 |
|
7271 | 574 |
|
5820 | 575 |
|
11891 | 576 |
(** local definitions **) |
577 |
||
578 |
fun gen_def fix prep_term prep_pats raw_name atts (x, (raw_rhs, raw_pats)) state = |
|
579 |
let |
|
580 |
val _ = assert_forward state; |
|
581 |
val ctxt = context_of state; |
|
582 |
||
583 |
(*rhs*) |
|
584 |
val name = if raw_name = "" then Thm.def_name x else raw_name; |
|
585 |
val rhs = prep_term ctxt raw_rhs; |
|
586 |
val T = Term.fastype_of rhs; |
|
587 |
val pats = prep_pats T (ProofContext.declare_term rhs ctxt) raw_pats; |
|
588 |
||
589 |
(*lhs*) |
|
590 |
val lhs = ProofContext.bind_skolem ctxt [x] (Free (x, T)); |
|
591 |
in |
|
592 |
state |
|
593 |
|> fix [([x], None)] |
|
594 |
|> match_bind_i [(pats, rhs)] |
|
11917 | 595 |
|> assm_i ProofContext.export_def [((name, atts), [(Logic.mk_equals (lhs, rhs), ([], []))])] |
11891 | 596 |
end; |
597 |
||
598 |
val def = gen_def fix ProofContext.read_term ProofContext.read_term_pats; |
|
599 |
val def_i = gen_def fix_i ProofContext.cert_term ProofContext.cert_term_pats; |
|
600 |
||
601 |
||
8374 | 602 |
(* invoke_case *) |
603 |
||
11793
5f0ab6f5c280
support impromptu terminology of cases parameters;
wenzelm
parents:
11742
diff
changeset
|
604 |
fun invoke_case (name, xs, atts) state = |
9292 | 605 |
let |
10830 | 606 |
val (state', (lets, asms)) = |
11793
5f0ab6f5c280
support impromptu terminology of cases parameters;
wenzelm
parents:
11742
diff
changeset
|
607 |
map_context_result (ProofContext.apply_case (get_case state name xs)) state; |
9292 | 608 |
in |
10830 | 609 |
state' |
10809 | 610 |
|> add_binds_i lets |
10830 | 611 |
|> assume_i [((name, atts), map (rpair ([], [])) asms)] |
8374 | 612 |
end; |
613 |
||
614 |
||
5820 | 615 |
|
616 |
(** goals **) |
|
617 |
||
618 |
(* forward chaining *) |
|
619 |
||
620 |
fun chain state = |
|
621 |
state |
|
622 |
|> assert_forward |
|
6848 | 623 |
|> assert_facts |
5820 | 624 |
|> enter_forward_chain; |
625 |
||
626 |
fun from_facts facts state = |
|
627 |
state |
|
628 |
|> put_facts (Some facts) |
|
629 |
|> chain; |
|
630 |
||
631 |
||
632 |
(* setup goals *) |
|
633 |
||
11549 | 634 |
val rule_contextN = "rule_context"; |
8991 | 635 |
|
12534 | 636 |
fun setup_goal opt_block prepp autofix kind after_qed names raw_propp state = |
5820 | 637 |
let |
12146 | 638 |
val (state', (propss, gen_binds)) = |
5936 | 639 |
state |
640 |
|> assert_forward_or_chain |
|
641 |
|> enter_forward |
|
8617
33e2bd53aec3
support Hindley-Milner polymorphisms in binds and facts;
wenzelm
parents:
8582
diff
changeset
|
642 |
|> opt_block |
12534 | 643 |
|> map_context_result (fn ctxt => prepp (ctxt, raw_propp)); |
12146 | 644 |
|
645 |
val props = flat propss; |
|
646 |
val cprop = Thm.cterm_of (sign_of state') (foldr1 Logic.mk_conjunction props); |
|
7556 | 647 |
val goal = Drule.mk_triv_goal cprop; |
10553 | 648 |
|
12146 | 649 |
val tvars = foldr Term.add_term_tvars (props, []); |
650 |
val vars = foldr Term.add_term_vars (props, []); |
|
5820 | 651 |
in |
10553 | 652 |
if null tvars then () |
653 |
else raise STATE ("Goal statement contains illegal schematic type variable(s): " ^ |
|
654 |
commas (map (Syntax.string_of_vname o #1) tvars), state); |
|
655 |
if null vars then () |
|
656 |
else warning ("Goal statement contains unbound schematic variable(s): " ^ |
|
12055 | 657 |
commas (map (ProofContext.string_of_term (context_of state')) vars)); |
5936 | 658 |
state' |
12146 | 659 |
|> map_context (autofix props) |
660 |
|> put_goal (Some (((kind, names, propss), ([], goal)), after_qed o map_context gen_binds)) |
|
12167 | 661 |
|> map_context (ProofContext.add_cases |
662 |
(if length props = 1 then RuleCases.make true goal [rule_contextN] |
|
663 |
else [(rule_contextN, RuleCases.empty)])) |
|
12146 | 664 |
|> auto_bind_goal props |
5820 | 665 |
|> (if is_chain state then use_facts else reset_facts) |
666 |
|> new_block |
|
667 |
|> enter_backward |
|
668 |
end; |
|
669 |
||
670 |
(*global goals*) |
|
12534 | 671 |
fun global_goal prep kind a raw_locale elems args thy = |
12503 | 672 |
let |
12549 | 673 |
val init = init_state thy; |
12534 | 674 |
val (opt_name, locale_ctxt, elems_ctxt, propp) = |
12549 | 675 |
prep (apsome fst raw_locale) elems (map snd args) (context_of init); |
12534 | 676 |
val locale = (case raw_locale of None => None | Some (_, atts) => Some (the opt_name, atts)); |
12503 | 677 |
in |
12549 | 678 |
init |
679 |
|> open_block |
|
12511 | 680 |
|> map_context (K locale_ctxt) |
12065 | 681 |
|> open_block |
12511 | 682 |
|> map_context (K elems_ctxt) |
12534 | 683 |
|> setup_goal I ProofContext.bind_propp_schematic_i |
684 |
ProofContext.fix_frees (Theorem (kind, a, locale, map (snd o fst) args)) |
|
685 |
Seq.single (map (fst o fst) args) propp |
|
12065 | 686 |
end; |
5820 | 687 |
|
12534 | 688 |
val multi_theorem = global_goal Locale.read_context_statement; |
689 |
val multi_theorem_i = global_goal Locale.cert_context_statement; |
|
12146 | 690 |
|
5820 | 691 |
|
692 |
(*local goals*) |
|
12146 | 693 |
fun local_goal' prepp kind (check: bool -> state -> state) f args int state = |
7928 | 694 |
state |
12146 | 695 |
|> setup_goal open_block prepp (K I) (kind (map (snd o fst) args)) |
696 |
f (map (fst o fst) args) (map snd args) |
|
10936 | 697 |
|> warn_extra_tfrees state |
698 |
|> check int; |
|
5820 | 699 |
|
12146 | 700 |
fun local_goal prepp kind f args = local_goal' prepp kind (K I) f args false; |
10936 | 701 |
|
702 |
val show = local_goal' ProofContext.bind_propp Show; |
|
703 |
val show_i = local_goal' ProofContext.bind_propp_i Show; |
|
704 |
val have = local_goal ProofContext.bind_propp Have; |
|
10380 | 705 |
val have_i = local_goal ProofContext.bind_propp_i Have; |
5820 | 706 |
|
707 |
||
708 |
||
709 |
(** conclusions **) |
|
710 |
||
711 |
(* current goal *) |
|
712 |
||
7176 | 713 |
fun current_goal (State (Node {context, goal = Some goal, ...}, _)) = (context, goal) |
5820 | 714 |
| current_goal state = raise STATE ("No current goal!", state); |
715 |
||
7176 | 716 |
fun assert_current_goal true (state as State (Node {goal = None, ...}, _)) = |
6404 | 717 |
raise STATE ("No goal in this block!", state) |
7176 | 718 |
| assert_current_goal false (state as State (Node {goal = Some _, ...}, _)) = |
6404 | 719 |
raise STATE ("Goal present in this block!", state) |
720 |
| assert_current_goal _ state = state; |
|
5820 | 721 |
|
12010 | 722 |
fun assert_bottom b (state as State (_, nodes)) = |
723 |
let val bot = (length nodes <= 2) in |
|
724 |
if b andalso not bot then raise STATE ("Not at bottom of proof!", state) |
|
725 |
else if not b andalso bot then raise STATE ("Already at bottom of proof!", state) |
|
726 |
else state |
|
727 |
end; |
|
5820 | 728 |
|
6404 | 729 |
val at_bottom = can (assert_bottom true o close_block); |
730 |
||
6932 | 731 |
fun end_proof bot state = |
5820 | 732 |
state |
733 |
|> assert_forward |
|
734 |
|> close_block |
|
735 |
|> assert_bottom bot |
|
7011 | 736 |
|> assert_current_goal true |
737 |
|> goal_facts (K []); |
|
5820 | 738 |
|
739 |
||
6404 | 740 |
(* local_qed *) |
5820 | 741 |
|
6982 | 742 |
fun finish_local (print_result, print_rule) state = |
5820 | 743 |
let |
12146 | 744 |
val (goal_ctxt, (((kind, names, tss), (_, raw_thm)), after_qed)) = current_goal state; |
8617
33e2bd53aec3
support Hindley-Milner polymorphisms in binds and facts;
wenzelm
parents:
8582
diff
changeset
|
745 |
val outer_state = state |> close_block; |
33e2bd53aec3
support Hindley-Milner polymorphisms in binds and facts;
wenzelm
parents:
8582
diff
changeset
|
746 |
val outer_ctxt = context_of outer_state; |
33e2bd53aec3
support Hindley-Milner polymorphisms in binds and facts;
wenzelm
parents:
8582
diff
changeset
|
747 |
|
12146 | 748 |
val ts = flat tss; |
749 |
val results = prep_result state ts raw_thm; |
|
750 |
val resultq = |
|
751 |
results |> map (ProofContext.export false goal_ctxt outer_ctxt) |
|
752 |
|> Seq.commute |> Seq.map (Library.unflat tss); |
|
9469 | 753 |
|
12146 | 754 |
val (attss, opt_solve) = |
5820 | 755 |
(case kind of |
12146 | 756 |
Show attss => (attss, export_goals goal_ctxt print_rule results) |
757 |
| Have attss => (attss, Seq.single) |
|
6932 | 758 |
| _ => err_malformed "finish_local" state); |
5820 | 759 |
in |
12146 | 760 |
print_result goal_ctxt (kind_name (sign_of state) kind, names ~~ Library.unflat tss results); |
8617
33e2bd53aec3
support Hindley-Milner polymorphisms in binds and facts;
wenzelm
parents:
8582
diff
changeset
|
761 |
outer_state |
12549 | 762 |
|> auto_bind_facts (ProofContext.generalize goal_ctxt outer_ctxt ts) |
9469 | 763 |
|> (fn st => Seq.map (fn res => |
12714 | 764 |
have_thmss_i ((names ~~ attss) ~~ map (single o Thm.no_attributes) res) st) resultq) |
9469 | 765 |
|> (Seq.flat o Seq.map opt_solve) |
7176 | 766 |
|> (Seq.flat o Seq.map after_qed) |
5820 | 767 |
end; |
768 |
||
6982 | 769 |
fun local_qed finalize print state = |
6404 | 770 |
state |
6932 | 771 |
|> end_proof false |
6871 | 772 |
|> finalize |
6982 | 773 |
|> (Seq.flat o Seq.map (finish_local print)); |
5820 | 774 |
|
775 |
||
12703
af5fec8a418f
refine_tac: Tactic.norm_hhf_tac before trying rule;
wenzelm
parents:
12698
diff
changeset
|
776 |
(* global_qed *) |
12065 | 777 |
|
6950 | 778 |
fun finish_global state = |
5820 | 779 |
let |
12703
af5fec8a418f
refine_tac: Tactic.norm_hhf_tac before trying rule;
wenzelm
parents:
12698
diff
changeset
|
780 |
val export = Drule.local_standard ooo ProofContext.export_single; |
12146 | 781 |
val (goal_ctxt, (((kind, names, tss), (_, raw_thm)), _)) = current_goal state; |
12065 | 782 |
val locale_ctxt = context_of (state |> close_block); |
783 |
val theory_ctxt = context_of (state |> close_block |> close_block); |
|
5820 | 784 |
|
12146 | 785 |
val ts = flat tss; |
12703
af5fec8a418f
refine_tac: Tactic.norm_hhf_tac before trying rule;
wenzelm
parents:
12698
diff
changeset
|
786 |
val locale_results = map (export goal_ctxt locale_ctxt) (prep_result state ts raw_thm); |
af5fec8a418f
refine_tac: Tactic.norm_hhf_tac before trying rule;
wenzelm
parents:
12698
diff
changeset
|
787 |
val results = map (Drule.strip_shyps_warning o export locale_ctxt theory_ctxt) locale_results; |
12242
282a92bc5655
multi_theorem: common statement header (covers *all* results);
wenzelm
parents:
12223
diff
changeset
|
788 |
val (k, (cname, catts), locale, attss) = |
12146 | 789 |
(case kind of Theorem x => x | _ => err_malformed "finish_global" state); |
12703
af5fec8a418f
refine_tac: Tactic.norm_hhf_tac before trying rule;
wenzelm
parents:
12698
diff
changeset
|
790 |
|
12242
282a92bc5655
multi_theorem: common statement header (covers *all* results);
wenzelm
parents:
12223
diff
changeset
|
791 |
val (thy1, res') = |
12703
af5fec8a418f
refine_tac: Tactic.norm_hhf_tac before trying rule;
wenzelm
parents:
12698
diff
changeset
|
792 |
theory_of state |> Locale.add_thmss_hybrid k |
af5fec8a418f
refine_tac: Tactic.norm_hhf_tac before trying rule;
wenzelm
parents:
12698
diff
changeset
|
793 |
((names ~~ attss) ~~ map (single o Thm.no_attributes) (Library.unflat tss results)) |
af5fec8a418f
refine_tac: Tactic.norm_hhf_tac before trying rule;
wenzelm
parents:
12698
diff
changeset
|
794 |
locale (Library.unflat tss locale_results); |
12242
282a92bc5655
multi_theorem: common statement header (covers *all* results);
wenzelm
parents:
12223
diff
changeset
|
795 |
val thy2 = thy1 |> PureThy.add_thmss [((cname, flat (map #2 res')), catts)] |> #1; |
12244 | 796 |
in (thy2, ((k, cname), res')) end; |
5820 | 797 |
|
10553 | 798 |
(*note: clients should inspect first result only, as backtracking may destroy theory*) |
6950 | 799 |
fun global_qed finalize state = |
5820 | 800 |
state |
6932 | 801 |
|> end_proof true |
6871 | 802 |
|> finalize |
12065 | 803 |
|> Seq.map finish_global; |
5820 | 804 |
|
805 |
||
6896 | 806 |
|
807 |
(** blocks **) |
|
808 |
||
809 |
(* begin_block *) |
|
810 |
||
811 |
fun begin_block state = |
|
812 |
state |
|
813 |
|> assert_forward |
|
814 |
|> new_block |
|
815 |
|> open_block; |
|
816 |
||
817 |
||
818 |
(* end_block *) |
|
819 |
||
820 |
fun end_block state = |
|
821 |
state |
|
822 |
|> assert_forward |
|
823 |
|> close_block |
|
824 |
|> assert_current_goal false |
|
825 |
|> close_block |
|
6932 | 826 |
|> transfer_facts state; |
6896 | 827 |
|
828 |
||
829 |
(* next_block *) |
|
830 |
||
831 |
fun next_block state = |
|
832 |
state |
|
833 |
|> assert_forward |
|
834 |
|> close_block |
|
8718 | 835 |
|> new_block |
836 |
|> reset_facts; |
|
6896 | 837 |
|
838 |
||
5820 | 839 |
end; |
8152 | 840 |
|
841 |
structure BasicProof: BASIC_PROOF = Proof; |
|
842 |
open BasicProof; |