summaryrefslogtreecommitdiff
path: root/backends/hol4/primitivesLib.sml
diff options
context:
space:
mode:
authorSon Ho2023-05-22 15:23:48 +0200
committerSon HO2023-06-04 21:54:38 +0200
commit1f0e5b3cb80e9334b07bf4b074c01150f4abd49d (patch)
treee66c708351b518bcda12bfa28ef3249eb3714cdb /backends/hol4/primitivesLib.sml
parent77d775ecea850576b24d097b402571889faa2a15 (diff)
Make the unfolding theorems collection from evalLib persistent
Diffstat (limited to 'backends/hol4/primitivesLib.sml')
-rw-r--r--backends/hol4/primitivesLib.sml15
1 files changed, 15 insertions, 0 deletions
diff --git a/backends/hol4/primitivesLib.sml b/backends/hol4/primitivesLib.sml
index eed50e25..776843bf 100644
--- a/backends/hol4/primitivesLib.sml
+++ b/backends/hol4/primitivesLib.sml
@@ -511,4 +511,19 @@ val progress : tactic =
map_first_tac progress_with thl (asms, g)
end
+(* Small utility: check that a term evaluates to “Return” (used by the unit tests) *)
+fun assert_return (tm0 : term) : unit =
+ let
+ (* Evaluate the term *)
+ val tm = evalLib.eval tm0
+ (* Deconstruct it *)
+ val (app, _) = strip_comb tm
+ val {Thy, Name, ...} = dest_thy_const app
+ handle HOL_ERR _ => raise (mk_HOL_ERR "primitivesLib" "assert_return" ("The term doesn't evaluate to “Return ...”: " ^ term_to_string tm ^ "\n, final result: " ^ term_to_string tm))
+ in
+ if Thy = "primitives" andalso Name = "Return" then ()
+ else
+ raise (mk_HOL_ERR "primitivesLib" "assert_return" ("The term doesn't evaluate to “Return ...”: " ^ term_to_string tm ^ "\n, final result: " ^ term_to_string tm))
+ end
+
end