481 make_plain_fun maybe_opt T1 T2 |
481 make_plain_fun maybe_opt T1 T2 |
482 #> unarize_unbox_etc_term |
482 #> unarize_unbox_etc_term |
483 #> format_fun (uniterize_unarize_unbox_etc_type T') |
483 #> format_fun (uniterize_unarize_unbox_etc_type T') |
484 (uniterize_unarize_unbox_etc_type T1) |
484 (uniterize_unarize_unbox_etc_type T1) |
485 (uniterize_unarize_unbox_etc_type T2)) |
485 (uniterize_unarize_unbox_etc_type T2)) |
486 |
|
487 |
486 |
488 fun term_for_fun_or_set seen T T' j = |
487 fun term_for_fun_or_set seen T T' j = |
489 let |
488 let |
490 val k1 = card_of_type card_assigns (pseudo_domain_type T) |
489 val k1 = card_of_type card_assigns (pseudo_domain_type T) |
491 val k2 = card_of_type card_assigns (pseudo_range_type T) |
490 val k2 = card_of_type card_assigns (pseudo_range_type T) |
878 end |
877 end |
879 else |
878 else |
880 t1 = t2 |
879 t1 = t2 |
881 end |
880 end |
882 |
881 |
|
882 fun pretty_term_auto_global ctxt t = |
|
883 let |
|
884 fun add_fake_const s = |
|
885 Sign.declare_const_global ((Binding.name s, @{typ 'a}), NoSyn) |
|
886 #> #2 |
|
887 |
|
888 val globals = Term.add_const_names t [] |
|
889 |> filter_out (String.isSubstring Long_Name.separator) |
|
890 |
|
891 val fake_ctxt = |
|
892 ctxt |> Proof_Context.background_theory (fn thy => |
|
893 thy |
|
894 |> Sign.map_naming (K Name_Space.global_naming) |
|
895 |> fold (perhaps o try o add_fake_const) globals |
|
896 |> Sign.restore_naming thy) |
|
897 in |
|
898 Syntax.pretty_term fake_ctxt t |
|
899 end |
|
900 |
883 fun reconstruct_hol_model {show_types, show_skolems, show_consts} |
901 fun reconstruct_hol_model {show_types, show_skolems, show_consts} |
884 ({hol_ctxt = {thy, ctxt, max_bisim_depth, boxes, wfs, user_axioms, |
902 ({hol_ctxt = {thy, ctxt, max_bisim_depth, boxes, wfs, user_axioms, |
885 debug, whacks, binary_ints, destroy_constrs, specialize, |
903 debug, whacks, binary_ints, destroy_constrs, specialize, |
886 star_linear_preds, total_consts, needs, tac_timeout, |
904 star_linear_preds, total_consts, needs, tac_timeout, |
887 evals, case_names, def_tables, nondef_table, nondefs, |
905 evals, case_names, def_tables, nondef_table, nondefs, |
891 card_assigns, bits, bisim_depth, data_types, ofs} : scope) |
909 card_assigns, bits, bisim_depth, data_types, ofs} : scope) |
892 formats atomss real_frees pseudo_frees free_names sel_names nonsel_names |
910 formats atomss real_frees pseudo_frees free_names sel_names nonsel_names |
893 rel_table bounds = |
911 rel_table bounds = |
894 let |
912 let |
895 val pool = Unsynchronized.ref [] |
913 val pool = Unsynchronized.ref [] |
896 val (wacky_names as (_, base_step_names), ctxt) = |
914 val (wacky_names as (_, base_step_names), ctxt) = add_wacky_syntax ctxt |
897 add_wacky_syntax ctxt |
|
898 val hol_ctxt = |
915 val hol_ctxt = |
899 {thy = thy, ctxt = ctxt, max_bisim_depth = max_bisim_depth, boxes = boxes, |
916 {thy = thy, ctxt = ctxt, max_bisim_depth = max_bisim_depth, boxes = boxes, |
900 wfs = wfs, user_axioms = user_axioms, debug = debug, whacks = whacks, |
917 wfs = wfs, user_axioms = user_axioms, debug = debug, whacks = whacks, |
901 binary_ints = binary_ints, destroy_constrs = destroy_constrs, |
918 binary_ints = binary_ints, destroy_constrs = destroy_constrs, |
902 specialize = specialize, star_linear_preds = star_linear_preds, |
919 specialize = specialize, star_linear_preds = star_linear_preds, |
946 tuple_list_for_name rel_table bounds name |
963 tuple_list_for_name rel_table bounds name |
947 |> term_for_rep (not (is_fully_representable_set name)) false |
964 |> term_for_rep (not (is_fully_representable_set name)) false |
948 T T' (rep_of name) |
965 T T' (rep_of name) |
949 in |
966 in |
950 Pretty.block (Pretty.breaks |
967 Pretty.block (Pretty.breaks |
951 [Syntax.pretty_term ctxt t1, Pretty.str oper, |
968 [pretty_term_auto_global ctxt t1, Pretty.str oper, |
952 Syntax.pretty_term ctxt t2]) |
969 pretty_term_auto_global ctxt t2]) |
953 end |
970 end |
954 fun pretty_for_data_type ({typ, card, complete, ...} : data_type_spec) = |
971 fun pretty_for_data_type ({typ, card, complete, ...} : data_type_spec) = |
955 Pretty.block (Pretty.breaks |
972 Pretty.block (Pretty.breaks |
956 (pretty_for_type ctxt typ :: |
973 (pretty_for_type ctxt typ :: |
957 (case typ of |
974 (case typ of |
958 Type (@{type_name fun_box}, _) => [Pretty.str "[boxed]"] |
975 Type (@{type_name fun_box}, _) => [Pretty.str "[boxed]"] |
959 | Type (@{type_name pair_box}, _) => [Pretty.str "[boxed]"] |
976 | Type (@{type_name pair_box}, _) => [Pretty.str "[boxed]"] |
960 | _ => []) @ |
977 | _ => []) @ |
961 [Pretty.str "=", |
978 [Pretty.str "=", |
962 Pretty.enum "," "{" "}" |
979 Pretty.enum "," "{" "}" |
963 (map (Syntax.pretty_term ctxt) (all_values card typ) @ |
980 (map (pretty_term_auto_global ctxt) (all_values card typ) @ |
964 (if fun_from_pair complete false then [] |
981 (if fun_from_pair complete false then [] |
965 else [Pretty.str (unrep ())]))])) |
982 else [Pretty.str (unrep ())]))])) |
966 fun integer_data_type T = |
983 fun integer_data_type T = |
967 [{typ = T, card = card_of_type card_assigns T, co = false, |
984 [{typ = T, card = card_of_type card_assigns T, co = false, |
968 self_rec = true, complete = (false, false), concrete = (true, true), |
985 self_rec = true, complete = (false, false), concrete = (true, true), |