19 val protect: thm -> thm |
19 val protect: thm -> thm |
20 val conclude: thm -> thm |
20 val conclude: thm -> thm |
21 val finish: thm -> thm |
21 val finish: thm -> thm |
22 val norm_result: thm -> thm |
22 val norm_result: thm -> thm |
23 val close_result: thm -> thm |
23 val close_result: thm -> thm |
24 val prove_raw: cterm list -> cterm -> (thm list -> tactic) -> thm |
24 val prove_internal: cterm list -> cterm -> (thm list -> tactic) -> thm |
25 val prove_multi: Proof.context -> string list -> term list -> term list -> |
25 val prove_multi: Proof.context -> string list -> term list -> term list -> |
26 ({prems: thm list, context: Proof.context} -> tactic) -> thm list |
26 ({prems: thm list, context: Proof.context} -> tactic) -> thm list |
27 val prove: Proof.context -> string list -> term list -> term -> |
27 val prove: Proof.context -> string list -> term list -> term -> |
28 ({prems: thm list, context: Proof.context} -> tactic) -> thm |
28 ({prems: thm list, context: Proof.context} -> tactic) -> thm |
29 val prove_global: theory -> string list -> term list -> term -> (thm list -> tactic) -> thm |
29 val prove_global: theory -> string list -> term list -> term -> (thm list -> tactic) -> thm |
101 |
101 |
102 |
102 |
103 |
103 |
104 (** tactical theorem proving **) |
104 (** tactical theorem proving **) |
105 |
105 |
106 (* prove_raw -- no checks, no normalization of result! *) |
106 (* prove_internal -- minimal checks, no normalization of result! *) |
107 |
107 |
108 fun prove_raw casms cprop tac = |
108 fun prove_internal casms cprop tac = |
109 (case SINGLE (tac (map Assumption.assume casms)) (init cprop) of |
109 (case SINGLE (tac (map Assumption.assume casms)) (init cprop) of |
110 SOME th => Drule.implies_intr_list casms (finish th) |
110 SOME th => Drule.implies_intr_list casms (finish th) |
111 | NONE => error "Tactic failed."); |
111 | NONE => error "Tactic failed."); |
112 |
112 |
113 |
113 |
238 | _ => raise THM ("comp_hhf: multiple unifiers", 1, [tha, thb])); |
238 | _ => raise THM ("comp_hhf: multiple unifiers", 1, [tha, thb])); |
239 |
239 |
240 |
240 |
241 (* non-atomic goal assumptions *) |
241 (* non-atomic goal assumptions *) |
242 |
242 |
|
243 fun non_atomic (Const ("==>", _) $ _ $ _) = true |
|
244 | non_atomic (Const ("all", _) $ _) = true |
|
245 | non_atomic _ = false; |
|
246 |
243 fun assume_rule_tac ctxt = norm_hhf_tac THEN' CSUBGOAL (fn (goal, i) => |
247 fun assume_rule_tac ctxt = norm_hhf_tac THEN' CSUBGOAL (fn (goal, i) => |
244 let |
248 let |
245 val ((_, goal'), ctxt') = Variable.focus goal ctxt; |
249 val ((_, goal'), ctxt') = Variable.focus goal ctxt; |
246 val goal'' = Drule.cterm_rule (singleton (Variable.export ctxt' ctxt)) goal'; |
250 val goal'' = Drule.cterm_rule (singleton (Variable.export ctxt' ctxt)) goal'; |
247 val Rs = filter_out (Logic.is_atomic o Thm.term_of) (Drule.strip_imp_prems goal''); |
251 val Rs = filter (non_atomic o Thm.term_of) (Drule.strip_imp_prems goal''); |
248 val tacs = Rs |> map (fn R => |
252 val tacs = Rs |> map (fn R => |
249 Tactic.etac (MetaSimplifier.norm_hhf (Thm.trivial R)) THEN_ALL_NEW assume_tac); |
253 Tactic.etac (MetaSimplifier.norm_hhf (Thm.trivial R)) THEN_ALL_NEW assume_tac); |
250 in fold_rev (curry op APPEND') tacs (K no_tac) i end); |
254 in fold_rev (curry op APPEND') tacs (K no_tac) i end); |
251 |
255 |
252 end; |
256 end; |