equal
deleted
inserted
replaced
26 val rel' = cert (singleton (Variable.polymorphic ctxt) rel) |
26 val rel' = cert (singleton (Variable.polymorphic ctxt) rel) |
27 val rule' = rule |> Thm.incr_indexes (#maxidx (Thm.rep_cterm rel') + 1) |
27 val rule' = rule |> Thm.incr_indexes (#maxidx (Thm.rep_cterm rel') + 1) |
28 val prem = #1 (Logic.dest_implies (Thm.prop_of rule')) |
28 val prem = #1 (Logic.dest_implies (Thm.prop_of rule')) |
29 val R' = cert (Var (the_single (Term.add_vars prem []))) |
29 val R' = cert (Var (the_single (Term.add_vars prem []))) |
30 in |
30 in |
31 resolve_tac [Drule.cterm_instantiate [(R', rel')] rule'] 1 (* produce the usual goals *) |
31 rtac (Drule.cterm_instantiate [(R', rel')] rule') 1 (* instantiate termination rule *) |
32 THEN (ALLGOALS |
32 THEN (ALLGOALS |
33 (fn 1 => REPEAT (ares_tac wf_rules 1) (* Solve wellfoundedness *) |
33 (fn 1 => REPEAT (ares_tac wf_rules 1) (* Solve wellfoundedness *) |
34 | i => asm_simp_tac ss i)) (* Simplify termination conditions *) |
34 | i => asm_simp_tac ss i)) (* Simplify termination conditions *) |
35 end |
35 end |
36 |
36 |
40 val {simps, congs, wfs} = RecdefPackage.get_hints (Context.Proof ctxt) |
40 val {simps, congs, wfs} = RecdefPackage.get_hints (Context.Proof ctxt) |
41 val ss = local_simpset_of ctxt addsimps simps |
41 val ss = local_simpset_of ctxt addsimps simps |
42 |
42 |
43 val intro_rule = ProofContext.get_thm ctxt (Name "termination") |
43 val intro_rule = ProofContext.get_thm ctxt (Name "termination") |
44 (* FIXME avoid internal name lookup -- dynamic scoping! *) |
44 (* FIXME avoid internal name lookup -- dynamic scoping! *) |
45 in Method.RAW_METHOD (K (auto_term_tac ctxt intro_rule rel wfs ss)) end) |
45 in Method.SIMPLE_METHOD (auto_term_tac ctxt intro_rule rel wfs ss) end) |
46 |
46 |
47 val setup = Method.add_methods |
47 val setup = Method.add_methods |
48 [("auto_term", termination_meth, "termination prover for recdef compatibility")] |
48 [("auto_term", termination_meth, "proves termination using a user-specified wellfounded relation")] |
49 |
49 |
50 end |
50 end |