Skip to content

Commit

Permalink
Expose the resolution "primitive" behind resolve_then
Browse files Browse the repository at this point in the history
resolve_then requires the output of the resolution to be passed to a
theorem-tactic (and will backtrack if the theorem-tactic fails with a HOL_ERR);
the new gen_resolve_then will pass to any consumer/continuation, backtracking
if *that* fails with a HOL_ERR.  The old resolve_then is then an easy
instance of the new function.
  • Loading branch information
mn200 committed May 31, 2024
1 parent 495e1a7 commit b9b2a68
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/1/resolve_then.sig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ sig

include Abbrev
datatype match_position = datatype thmpos_dtype.match_position
val gen_resolve_then : match_position -> thm -> thm -> (thm -> 'a) -> 'a
val resolve_then : match_position -> thm_tactic -> thm -> thm -> tactic

end
14 changes: 9 additions & 5 deletions src/1/resolve_then.sml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ fun liftconcl th =
(* val th2 = prim_recTheory.LESS_REFL
val th1 = arithmeticTheory.LESS_TRANS
*)
fun resolve_then mpos ttac th1 th2 (g as (asl,w)) =


fun gen_resolve_then mpos th1 th2 kont =
(* conclusion of th1 unifies with some part of th2 *)
let
val th1 = GEN_ALL (GEN_TYVARIFY th1)
Expand Down Expand Up @@ -140,7 +142,7 @@ fun resolve_then mpos ttac th1 th2 (g as (asl,w)) =
PROVE_HYP (INSTT sigma th1_ud) (INSTT sigma th2_ud) |>
postprocess sigma
in
ttac kth g handle HOL_ERR _ => k()
kont kth handle HOL_ERR _ => k()
end
val max = length cs2
val fail = mk_HOL_ERR "Tactic" "resolve_then" "No unifier"
Expand All @@ -162,9 +164,7 @@ fun resolve_then mpos ttac th1 th2 (g as (asl,w)) =
let
open TermParse
val pats =
prim_ctxt_termS Parse.Absyn (Parse.term_grammar())
(HOLset.listItems (FVL (w::asl) empty_tmset))
q
prim_ctxt_termS Parse.Absyn (Parse.term_grammar()) [] q
fun doit ps n =
if n > max then raise fail
else
Expand All @@ -179,4 +179,8 @@ fun resolve_then mpos ttac th1 th2 (g as (asl,w)) =
end
| Concl => try con (fn _ => raise fail)
end

fun resolve_then mpos ttac th1 th2 g =
gen_resolve_then mpos th1 th2 (fn th => ttac th g)

end (* struct *)

0 comments on commit b9b2a68

Please sign in to comment.