equal
deleted
inserted
replaced
40 (*Prints exceptions readably to users*) |
40 (*Prints exceptions readably to users*) |
41 fun print_sign_exn_unit sign e = |
41 fun print_sign_exn_unit sign e = |
42 case e of |
42 case e of |
43 THM (msg,i,thms) => |
43 THM (msg,i,thms) => |
44 (writeln ("Exception THM " ^ string_of_int i ^ " raised:\n" ^ msg); |
44 (writeln ("Exception THM " ^ string_of_int i ^ " raised:\n" ^ msg); |
45 List.app print_thm thms) |
45 List.app Display.print_thm thms) |
46 | THEORY (msg,thys) => |
46 | THEORY (msg,thys) => |
47 (writeln ("Exception THEORY raised:\n" ^ msg); |
47 (writeln ("Exception THEORY raised:\n" ^ msg); |
48 List.app (writeln o Context.str_of_thy) thys) |
48 List.app (writeln o Context.str_of_thy) thys) |
49 | TERM (msg,ts) => |
49 | TERM (msg,ts) => |
50 (writeln ("Exception TERM raised:\n" ^ msg); |
50 (writeln ("Exception TERM raised:\n" ^ msg); |
56 | e => raise e |
56 | e => raise e |
57 |
57 |
58 (*Prints an exception, then fails*) |
58 (*Prints an exception, then fails*) |
59 fun print_sign_exn sign e = (print_sign_exn_unit sign e; raise e) |
59 fun print_sign_exn sign e = (print_sign_exn_unit sign e; raise e) |
60 |
60 |
61 val string_of_thm = PrintMode.setmp [] string_of_thm; |
61 val string_of_thm = PrintMode.setmp [] Display.string_of_thm; |
62 val string_of_cterm = PrintMode.setmp [] string_of_cterm; |
62 val string_of_cterm = PrintMode.setmp [] Display.string_of_cterm; |
63 |
63 |
64 fun mk_meta_eq th = |
64 fun mk_meta_eq th = |
65 (case concl_of th of |
65 (case concl_of th of |
66 Const("Trueprop",_) $ (Const("op =",_) $ _ $ _) => th RS eq_reflection |
66 Const("Trueprop",_) $ (Const("op =",_) $ _ $ _) => th RS eq_reflection |
67 | Const("==",_) $ _ $ _ => th |
67 | Const("==",_) $ _ $ _ => th |
303 let |
303 let |
304 val lhs = #1 (Logic.dest_equals (prop_of (final init))) |
304 val lhs = #1 (Logic.dest_equals (prop_of (final init))) |
305 in |
305 in |
306 if not (lhs aconv origt) |
306 if not (lhs aconv origt) |
307 then (writeln "Something is utterly wrong: (orig,lhs,frozen type,t,tinst)"; |
307 then (writeln "Something is utterly wrong: (orig,lhs,frozen type,t,tinst)"; |
308 writeln (string_of_cterm (cterm_of thy origt)); |
308 writeln (Display.string_of_cterm (cterm_of thy origt)); |
309 writeln (string_of_cterm (cterm_of thy lhs)); |
309 writeln (Display.string_of_cterm (cterm_of thy lhs)); |
310 writeln (string_of_cterm (cterm_of thy typet)); |
310 writeln (Display.string_of_cterm (cterm_of thy typet)); |
311 writeln (string_of_cterm (cterm_of thy t)); |
311 writeln (Display.string_of_cterm (cterm_of thy t)); |
312 app (fn (n,T) => writeln (n ^ ": " ^ (string_of_ctyp (ctyp_of thy T)))) Tinst; |
312 app (fn (n,T) => writeln (n ^ ": " ^ (Display.string_of_ctyp (ctyp_of thy T)))) Tinst; |
313 writeln "done") |
313 writeln "done") |
314 else () |
314 else () |
315 end |
315 end |
316 in |
316 in |
317 case t of |
317 case t of |
365 let |
365 let |
366 val lhs = #1 (Logic.dest_equals (prop_of (final init))) |
366 val lhs = #1 (Logic.dest_equals (prop_of (final init))) |
367 in |
367 in |
368 if not (lhs aconv origt) |
368 if not (lhs aconv origt) |
369 then (writeln "Something is utterly wrong: (orig,lhs,frozen type,t,tinst)"; |
369 then (writeln "Something is utterly wrong: (orig,lhs,frozen type,t,tinst)"; |
370 writeln (string_of_cterm (cterm_of thy origt)); |
370 writeln (Display.string_of_cterm (cterm_of thy origt)); |
371 writeln (string_of_cterm (cterm_of thy lhs)); |
371 writeln (Display.string_of_cterm (cterm_of thy lhs)); |
372 writeln (string_of_cterm (cterm_of thy typet)); |
372 writeln (Display.string_of_cterm (cterm_of thy typet)); |
373 writeln (string_of_cterm (cterm_of thy t)); |
373 writeln (Display.string_of_cterm (cterm_of thy t)); |
374 app (fn (n,T) => writeln (n ^ ": " ^ (string_of_ctyp (ctyp_of thy T)))) Tinst; |
374 app (fn (n,T) => writeln (n ^ ": " ^ (Display.string_of_ctyp (ctyp_of thy T)))) Tinst; |
375 writeln "done") |
375 writeln "done") |
376 else () |
376 else () |
377 end |
377 end |
378 in |
378 in |
379 case t of |
379 case t of |