forked from CakeML/cakeml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
preamble.sml
57 lines (52 loc) · 1.68 KB
/
preamble.sml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
structure preamble =
struct
local open intLib in end
open HolKernel bossLib boolLib pairLib lcsymtacs
open Parse Defn Tactic res_quanTheory
open finite_mapTheory listTheory pairTheory pred_setTheory
open set_relationTheory sortingTheory stringTheory wordsTheory
open relationTheory
val wf_rel_tac = WF_REL_TAC
val induct_on = Induct_on
val cases_on = Cases_on;
val every_case_tac = BasicProvers.EVERY_CASE_TAC;
val full_case_tac = BasicProvers.FULL_CASE_TAC;
fun loseC c =
first_x_assum
(K ALL_TAC o assert (can (find_term (same_const c)) o concl))
fun asm_match q = Q.MATCH_ASSUM_RENAME_TAC q
val kill_asm_guard =
disch_then (fn th => SUBGOAL_THEN (lhand (concl th))
(MP_TAC o MATCH_MP th)) >- simp[]
fun qispl_then [] ttac = ttac
| qispl_then (q::qs) ttac = Q.ISPEC_THEN q (qispl_then qs ttac)
fun qxchl [] ttac = ttac
| qxchl (q::qs) ttac = Q.X_CHOOSE_THEN q (qxchl qs ttac)
val rveq = rpt BasicProvers.VAR_EQ_TAC
fun erule k th = let
fun c th = let
val (vs, body) = strip_forall (concl th)
in
if is_imp body then
first_assum (c o MATCH_MP th) ORELSE
first_assum (c o MATCH_MP th o SYM)
else k th
end
fun is_resolvable th = let
val (vs, body) = strip_forall (concl th)
in
is_imp body
end
in
if is_resolvable th then c th else NO_TAC
end
fun print_tac s (g as (asl,w)) = let
fun mmlnt_test t = is_const t andalso type_of t = ``:MMLnonT``
in
case get_first (Lib.total (find_term mmlnt_test)) asl of
NONE => raise Fail "No MMLnonT in goal"
| SOME t => if term_to_string t = s then
(print ("print_tac: "^s^"\n"); ALL_TAC g)
else raise Fail ("MMLnonT not "^s)
end
end