|
55 | 55 | (fst current_goal, new_claim)],
|
56 | 56 | fn [goalthm,claimthm] =>
|
57 | 57 | MP (DISCH new_claim goalthm) claimthm
|
58 |
| - | _ => raise HOL_ERR |
59 |
| - {origin_structure = "define_inductive_relations", |
60 |
| - origin_function = "SUPPOSE_TAC", |
61 |
| - message = "invalid application"}) |
62 |
| - else raise HOL_ERR |
63 |
| - {origin_structure = "define_inductive_relations", |
64 |
| - origin_function = "SUPPOSE_TAC", |
65 |
| - message = "The claim doesn't have type :bool"} |
| 58 | + | _ => raise mk_HOL_ERR "define_inductive_relations" "SUPPOSE_TAC" |
| 59 | + "invalid application") |
| 60 | + else raise mk_HOL_ERR "define_inductive_relations" "SUPPOSE_TAC" |
| 61 | + "The claim doesn't have type :bool" |
66 | 62 | end
|
67 | 63 |
|
68 | 64 |
|
@@ -122,19 +118,13 @@ fun MP_IMP_TAC imp_thm (thisgoal as (asms,goal)) =
|
122 | 118 | fn imp_thm => fn (asms,goal) =>
|
123 | 119 | ([(asms,fst(dest_imp(concl imp_thm)))],
|
124 | 120 | fn [thm] => MP imp_thm thm
|
125 |
| - | _ => raise HOL_ERR |
126 |
| - {origin_structure = "define_inductive_relations", |
127 |
| - origin_function = "MP_IMP_TAC", |
128 |
| - message = "invalid application"})} |
| 121 | + | _ => raise mk_HOL_ERR "define_inductive_relations" "MP_IMP_TAC" |
| 122 | + "invalid application")} |
129 | 123 | thisgoal
|
130 |
| - else raise HOL_ERR |
131 |
| - {origin_structure = "define_inductive_relations", |
132 |
| - origin_function = "MP_IMP_TAC", |
133 |
| - message = "theorem doesn't imply goal"} |
134 |
| - else raise HOL_ERR |
135 |
| - {origin_structure = "define_inductive_relations", |
136 |
| - origin_function = "MP_IMP_TAC", |
137 |
| - message = "theorem is not an implication"} |
| 124 | + else raise mk_HOL_ERR "define_inductive_relations" "MP_IMP_TAC" |
| 125 | + "theorem doesn't imply goal" |
| 126 | + else raise mk_HOL_ERR "define_inductive_relations" "MP_IMP_TAC" |
| 127 | + "theorem is not an implication" |
138 | 128 |
|
139 | 129 |
|
140 | 130 | (* This function takes in the rules, checks them, quantifies them, and
|
@@ -231,38 +221,34 @@ fun check_rule rule_num rule =
|
231 | 221 | (* check that the relations don't occur in rands *)
|
232 | 222 | if (foldr (fn (tm, acc) => relations_in_tm tm orelse acc)
|
233 | 223 | false rands) then
|
234 |
| - raise HOL_ERR |
235 |
| - {message = "found relation being defined"^ |
| 224 | + raise mk_HOL_ERR "define_inductive_relations" "check_rule" |
| 225 | + ("found relation being defined"^ |
236 | 226 | " in arg to "^(fst(dest_var rator))^
|
237 | 227 | " in hypothesis ofrule number "^
|
238 |
| - (Lib.int_to_string rule_num), |
239 |
| - origin_function = "check_rule", |
240 |
| - origin_structure = "define_inductive_relations"} |
| 228 | + (Lib.int_to_string rule_num)) |
241 | 229 | else check_hyp hyps
|
242 |
| - else if relations_in_tm hyp1 then raise HOL_ERR |
243 |
| - {message = "found relation being defined"^ |
| 230 | + else if relations_in_tm hyp1 then |
| 231 | + raise mk_HOL_ERR "define_inductive_relations" "check_rule" |
| 232 | + ("found relation being defined"^ |
244 | 233 | " in side condition in rule number "^
|
245 |
| - (Lib.int_to_string rule_num), |
246 |
| - origin_function = "check_rule", |
247 |
| - origin_structure = "define_inductive_relations"} |
248 |
| - else check_hyp hyps |
| 234 | + (Lib.int_to_string rule_num)) |
| 235 | + else check_hyp hyps |
249 | 236 | end |
|
250 | 237 | check_hyp [] = true
|
251 | 238 | fun check_concl tm =
|
252 | 239 | let val (rator, rands) = strip_comb tm in
|
253 |
| - if not (tmem rator relations) then raise HOL_ERR |
254 |
| - {message = "must have relation as operator in "^ |
255 |
| - "conclusion of rule "^(Lib.int_to_string rule_num), |
256 |
| - origin_function = "check_rule", |
257 |
| - origin_structure = "define_inductive_relations"} else |
258 |
| - if (foldr (fn (tm, acc) => relations_in_tm tm orelse acc) |
259 |
| - false rands) then raise HOL_ERR |
260 |
| - {message = "found relation being defined"^ |
| 240 | + if not (tmem rator relations) then |
| 241 | + raise mk_HOL_ERR "define_inductive_relations" "check_rule" |
| 242 | + ("must have relation as operator in "^ |
| 243 | + "conclusion of rule "^(Lib.int_to_string rule_num)) |
| 244 | + else if |
| 245 | + foldr (fn (tm, acc) => relations_in_tm tm orelse acc) false rands |
| 246 | + then |
| 247 | + raise mk_HOL_ERR "define_inductive_relations" "check_rule" |
| 248 | + ("found relation being defined"^ |
261 | 249 | " in arg to "^(fst(dest_var rator))^
|
262 | 250 | " in conclusion of rule number "^
|
263 |
| - (Lib.int_to_string rule_num), |
264 |
| - origin_function = "check_rule", |
265 |
| - origin_structure = "define_inductive_relations"} |
| 251 | + (Lib.int_to_string rule_num)) |
266 | 252 | else true
|
267 | 253 | end
|
268 | 254 | in
|
@@ -478,38 +464,34 @@ fun check_rule rule_num rule =
|
478 | 464 | (* check that the relations don't occur in rands *)
|
479 | 465 | if (foldr (fn (tm, acc) => relations_in_tm tm orelse acc)
|
480 | 466 | false rands) then
|
481 |
| - raise HOL_ERR |
482 |
| - {message = "found relation being defined"^ |
483 |
| - " in arg to "^(fst(dest_var rator))^ |
484 |
| - " in hypothesis ofrule number "^ |
485 |
| - (Lib.int_to_string rule_num), |
486 |
| - origin_function = "check_rule", |
487 |
| - origin_structure = "define_inductive_relations"} |
| 467 | + raise mk_HOL_ERR "define_inductive_relations" "check_rule" |
| 468 | + ("found relation being defined"^ |
| 469 | + " in arg to "^(fst(dest_var rator))^ |
| 470 | + " in hypothesis ofrule number "^ |
| 471 | + (Lib.int_to_string rule_num)) |
488 | 472 | else check_hyp hyps
|
489 |
| - else if relations_in_tm hyp1 then raise HOL_ERR |
490 |
| - {message = "found relation being defined"^ |
| 473 | + else if relations_in_tm hyp1 then |
| 474 | + raise mk_HOL_ERR "define_inductive_relations" "check_rule" |
| 475 | + ("found relation being defined"^ |
491 | 476 | " in side condition in rule number "^
|
492 |
| - (Lib.int_to_string rule_num), |
493 |
| - origin_function = "check_rule", |
494 |
| - origin_structure = "define_inductive_relations"} |
495 |
| - else check_hyp hyps |
496 |
| - end | |
497 |
| - check_hyp [] = true |
| 477 | + (Lib.int_to_string rule_num)) |
| 478 | + else check_hyp hyps |
| 479 | + end |
| 480 | + | check_hyp [] = true |
498 | 481 | fun check_concl tm =
|
499 | 482 | let val (rator, rands) = strip_comb tm in
|
500 |
| - if not (tmem rator relations) then raise HOL_ERR |
501 |
| - {message = "must have relation as operator in "^ |
502 |
| - "conclusion of rule "^(Lib.int_to_string rule_num), |
503 |
| - origin_function = "check_rule", |
504 |
| - origin_structure = "define_inductive_relations"} else |
505 |
| - if (foldr (fn (tm, acc) => relations_in_tm tm orelse acc) |
506 |
| - false rands) then raise HOL_ERR |
507 |
| - {message = "found relation being defined"^ |
| 483 | + if not (tmem rator relations) then |
| 484 | + raise mk_HOL_ERR "define_inductive_relations" "check_rule" |
| 485 | + ("must have relation as operator in "^ |
| 486 | + "conclusion of rule "^(Lib.int_to_string rule_num)) |
| 487 | + else if |
| 488 | + foldr (fn (tm, acc) => relations_in_tm tm orelse acc) false rands |
| 489 | + then |
| 490 | + raise mk_HOL_ERR "define_inductive_relations" "check_rule" |
| 491 | + ("found relation being defined"^ |
508 | 492 | " in arg to "^(fst(dest_var rator))^
|
509 | 493 | " in conclusion of rule number "^
|
510 |
| - (Lib.int_to_string rule_num), |
511 |
| - origin_function = "check_rule", |
512 |
| - origin_structure = "define_inductive_relations"} |
| 494 | + (Lib.int_to_string rule_num)) |
513 | 495 | else true
|
514 | 496 | end
|
515 | 497 | in
|
@@ -992,10 +974,9 @@ fun simp_rule sfn set vs rul th =
|
992 | 974 | end
|
993 | 975 | end;
|
994 | 976 |
|
995 |
| -fun bad_error ftn_name = raise HOL_ERR |
996 |
| - {message = "this case should never happen, real problem here!", |
997 |
| - origin_function = ftn_name, |
998 |
| - origin_structure = "prove_inversion_theorems"} |
| 977 | +fun bad_error ftn_name = |
| 978 | + raise mk_HOL_ERR "prove_inversion_theorems" ftn_name |
| 979 | + "this case should never happen, real problem here!" |
999 | 980 |
|
1000 | 981 | fun simp set sfn rul th =
|
1001 | 982 | let val vs = fst(strip_forall (dest_neg (concl th)))
|
@@ -1727,10 +1708,9 @@ local
|
1727 | 1708 | fun get_correct_tm ((rel, tm)::more_info) rel2 =
|
1728 | 1709 | if rel ~~ rel2 then tm
|
1729 | 1710 | else get_correct_tm more_info rel2
|
1730 |
| - | get_correct_tm [] rel2 = raise HOL_ERR |
1731 |
| - {origin_structure = "inductive_relations", |
1732 |
| - origin_function = "rule_induct", |
1733 |
| - message = "need term for relation "^(fst (dest_const rel2))} |
| 1711 | + | get_correct_tm [] rel2 = |
| 1712 | + raise mk_HOL_ERR "inductive_relations" "rule_induct" |
| 1713 | + ("need term for relation "^(fst (dest_const rel2))) |
1734 | 1714 | in
|
1735 | 1715 | fun rule_induct induct_thm (asms, gl) =
|
1736 | 1716 | let val reltns_goals_list = map process_term (strip_conj gl)
|
|
0 commit comments