1 (* ---------------------------------------------------------------------- *)
3 (* ---------------------------------------------------------------------- *)
6 let string_of_char c = String.make 1 c;;
10 (* ---------------------------------------------------------------------- *)
12 (* ---------------------------------------------------------------------- *)
15 let gensort = sort (<);;
16 let suppress = ref ([]:string list);;
17 suppress := ["==>";"?";"!";"/\\";"\\/";",";"~";"APPEND";"CONS";"HD";"LAST";
18 "NIL";"=";"real_lt";"real_gt";"real_le";"real_ge";"BIT0";"BIT1";"NUMERAL";
19 "real_of_num";"_0";"_1";"real_div";"real_mul";"real_pow";"COND"];;
21 let rec get_type_list tm =
23 Var(s,t) -> if mem s !suppress then [] else [(s,t)]
24 | Const(s,t) -> if mem s !suppress then [] else [(s,t)]
25 | Comb (t1,t2) -> get_type_list t1 @ get_type_list t2
26 | Abs (t1,t2) -> get_type_list t1 @ get_type_list t2;;
28 let my_print_type (s,t) =
29 print_string ("(\"" ^ s ^ "\", ");
33 let rec my_print_typel l =
36 | (h::t) -> my_print_type h; my_print_typel t;;
38 let set_types tm = (gensort o setify o get_type_list) tm;;
40 let print_term_types = my_print_typel o set_types;;
41 let print_thm_types tm = print_term_types (concl tm);;
42 let goal_types() = (print_term_types o snd o top_goal)();;
44 let assum i = (rev_ith i o fst o top_goal)();;
45 let assum_types i = (print_term_types o rev_ith i o fst o top_goal)();;
47 let (get_type:string->thm->hol_type) =
48 fun s thm -> assoc s (get_type_list (concl thm));;
51 (* ---------------------------------------------------------------------- *)
53 (* ---------------------------------------------------------------------- *)
55 exception Empty_stack;;
56 let proof_stack = ref ([]:goalstack list);;
58 proof_stack := [!current_goalstack] @ !proof_stack;
62 match !proof_stack with
63 [] -> raise Empty_stack
64 | h::t -> current_goalstack := h; proof_stack := t;
67 (* ---------------------------------------------------------------------- *)
69 (* ---------------------------------------------------------------------- *)
71 let print_thm_no_hyps th =
72 let asl,tm = dest_thm th in
73 (if not (asl = []) then
82 let print_trace_thm hyps msg th =
83 let asl,tm = dest_thm th in
85 print_string "------------------------\n ";
86 print_string (msg ^ "\n");
87 if hyps then print_thm th else print_thm_no_hyps th;
88 print_string "\n========================\n ";
92 #install_printer print_thm_no_hyps;;
93 #install_printer print_thm;;