1530 val app = |
1530 val app = |
1531 IConst (app_op, head_T --> head_T, [arg_T, res_T]) |
1531 IConst (app_op, head_T --> head_T, [arg_T, res_T]) |
1532 |> mangle_type_args_in_iterm format type_enc |
1532 |> mangle_type_args_in_iterm format type_enc |
1533 in list_app app [head, arg] end |
1533 in list_app app [head, arg] end |
1534 |
1534 |
1535 fun firstorderize_fact thy monom_constrs format type_enc app_op_aliases |
1535 fun firstorderize_fact thy monom_constrs format type_enc sym_tab |
1536 sym_tab = |
1536 app_op_aliases = |
1537 let |
1537 let |
1538 fun do_app arg head = do_app_op format type_enc head arg |
1538 fun do_app arg head = do_app_op format type_enc head arg |
1539 fun list_app_ops head args = fold do_app args head |
1539 fun list_app_ops head args = fold do_app args head |
1540 fun introduce_app_ops tm = |
1540 fun introduce_app_ops tm = |
1541 let val (head, args) = tm |> strip_iterm_comb ||> map introduce_app_ops in |
1541 let val (head, args) = tm |> strip_iterm_comb ||> map introduce_app_ops in |
2573 val sym_tab = sym_table_for_facts ctxt type_enc app_op_level conjs facts |
2573 val sym_tab = sym_table_for_facts ctxt type_enc app_op_level conjs facts |
2574 val mono = conjs @ facts |> mononotonicity_info_for_facts ctxt type_enc |
2574 val mono = conjs @ facts |> mononotonicity_info_for_facts ctxt type_enc |
2575 val (polym_constrs, monom_constrs) = |
2575 val (polym_constrs, monom_constrs) = |
2576 all_constrs_of_polymorphic_datatypes thy |
2576 all_constrs_of_polymorphic_datatypes thy |
2577 |>> map (make_fixed_const (SOME format)) |
2577 |>> map (make_fixed_const (SOME format)) |
2578 val firstorderize = |
2578 fun firstorderize in_helper = |
2579 firstorderize_fact thy monom_constrs format type_enc app_op_aliases |
2579 firstorderize_fact thy monom_constrs format type_enc sym_tab |
2580 sym_tab |
2580 (app_op_aliases andalso not in_helper) |
2581 val (conjs, facts) = (conjs, facts) |> pairself (map firstorderize) |
2581 val (conjs, facts) = (conjs, facts) |> pairself (map (firstorderize false)) |
2582 val sym_tab = sym_table_for_facts ctxt type_enc Incomplete_Apply conjs facts |
2582 val sym_tab = sym_table_for_facts ctxt type_enc Incomplete_Apply conjs facts |
2583 val helpers = |
2583 val helpers = |
2584 sym_tab |> helper_facts_for_sym_table ctxt format type_enc |
2584 sym_tab |> helper_facts_for_sym_table ctxt format type_enc |
2585 |> map firstorderize |
2585 |> map (firstorderize true) |
2586 val mono_Ts = |
2586 val mono_Ts = |
2587 helpers @ conjs @ facts |> monotonic_types_for_facts ctxt mono type_enc |
2587 helpers @ conjs @ facts |> monotonic_types_for_facts ctxt mono type_enc |
2588 val class_decl_lines = decl_lines_for_classes type_enc classes |
2588 val class_decl_lines = decl_lines_for_classes type_enc classes |
2589 val (app_op_alias_eq_tms, app_op_alias_eq_lines) = |
2589 val (app_op_alias_eq_tms, app_op_alias_eq_lines) = |
2590 app_op_alias_lines_for_sym_table ctxt monom_constrs format conj_sym_kind |
2590 app_op_alias_lines_for_sym_table ctxt monom_constrs format conj_sym_kind |