61 val type_const_prefix: string |
61 val type_const_prefix: string |
62 val class_prefix: string |
62 val class_prefix: string |
63 val skolem_const_prefix : string |
63 val skolem_const_prefix : string |
64 val old_skolem_const_prefix : string |
64 val old_skolem_const_prefix : string |
65 val new_skolem_const_prefix : string |
65 val new_skolem_const_prefix : string |
|
66 val type_decl_prefix : string |
|
67 val sym_decl_prefix : string |
|
68 val preds_sym_formula_prefix : string |
|
69 val tags_sym_formula_prefix : string |
66 val fact_prefix : string |
70 val fact_prefix : string |
67 val conjecture_prefix : string |
71 val conjecture_prefix : string |
68 val helper_prefix : string |
72 val helper_prefix : string |
|
73 val class_rel_clause_prefix : string |
|
74 val arity_clause_prefix : string |
|
75 val tfree_clause_prefix : string |
69 val typed_helper_suffix : string |
76 val typed_helper_suffix : string |
|
77 val untyped_helper_suffix : string |
70 val predicator_name : string |
78 val predicator_name : string |
71 val app_op_name : string |
79 val app_op_name : string |
72 val type_tag_name : string |
80 val type_tag_name : string |
73 val type_pred_name : string |
81 val type_pred_name : string |
74 val simple_type_prefix : string |
82 val simple_type_prefix : string |
161 val old_skolem_const_prefix = skolem_const_prefix ^ "o" |
169 val old_skolem_const_prefix = skolem_const_prefix ^ "o" |
162 val new_skolem_const_prefix = skolem_const_prefix ^ "n" |
170 val new_skolem_const_prefix = skolem_const_prefix ^ "n" |
163 |
171 |
164 val type_decl_prefix = "ty_" |
172 val type_decl_prefix = "ty_" |
165 val sym_decl_prefix = "sy_" |
173 val sym_decl_prefix = "sy_" |
166 val sym_formula_prefix = "sym_" |
174 val preds_sym_formula_prefix = "psy_" |
|
175 val tags_sym_formula_prefix = "tsy_" |
167 val fact_prefix = "fact_" |
176 val fact_prefix = "fact_" |
168 val conjecture_prefix = "conj_" |
177 val conjecture_prefix = "conj_" |
169 val helper_prefix = "help_" |
178 val helper_prefix = "help_" |
170 val class_rel_clause_prefix = "crel_" |
179 val class_rel_clause_prefix = "crel_" |
171 val arity_clause_prefix = "arity_" |
180 val arity_clause_prefix = "arity_" |
1625 |> mangled_type higher_order pred_sym (length T_arg_Ts + ary)) |
1634 |> mangled_type higher_order pred_sym (length T_arg_Ts + ary)) |
1626 end |
1635 end |
1627 |
1636 |
1628 fun is_polymorphic_type T = fold_atyps (fn TVar _ => K true | _ => I) T false |
1637 fun is_polymorphic_type T = fold_atyps (fn TVar _ => K true | _ => I) T false |
1629 |
1638 |
1630 fun formula_line_for_pred_sym_decl ctxt format conj_sym_kind nonmono_Ts type_sys |
1639 fun formula_line_for_preds_sym_decl ctxt format conj_sym_kind nonmono_Ts |
1631 n s j (s', T_args, T, _, ary, in_conj) = |
1640 type_sys n s j (s', T_args, T, _, ary, in_conj) = |
1632 let |
1641 let |
1633 val (kind, maybe_negate) = |
1642 val (kind, maybe_negate) = |
1634 if in_conj then (conj_sym_kind, conj_sym_kind = Conjecture ? mk_anot) |
1643 if in_conj then (conj_sym_kind, conj_sym_kind = Conjecture ? mk_anot) |
1635 else (Axiom, I) |
1644 else (Axiom, I) |
1636 val (arg_Ts, res_T) = chop_fun ary T |
1645 val (arg_Ts, res_T) = chop_fun ary T |
1640 bound_names ~~ arg_Ts |> map (fn (name, T) => CombConst (name, T, [])) |
1649 bound_names ~~ arg_Ts |> map (fn (name, T) => CombConst (name, T, [])) |
1641 val bound_Ts = |
1650 val bound_Ts = |
1642 arg_Ts |> map (fn T => if n > 1 orelse is_polymorphic_type T then SOME T |
1651 arg_Ts |> map (fn T => if n > 1 orelse is_polymorphic_type T then SOME T |
1643 else NONE) |
1652 else NONE) |
1644 in |
1653 in |
1645 Formula (sym_formula_prefix ^ s ^ |
1654 Formula (preds_sym_formula_prefix ^ s ^ |
1646 (if n > 1 then "_" ^ string_of_int j else ""), kind, |
1655 (if n > 1 then "_" ^ string_of_int j else ""), kind, |
1647 CombConst ((s, s'), T, T_args) |
1656 CombConst ((s, s'), T, T_args) |
1648 |> fold (curry (CombApp o swap)) bounds |
1657 |> fold (curry (CombApp o swap)) bounds |
1649 |> type_pred_combterm ctxt nonmono_Ts type_sys res_T |
1658 |> type_pred_combterm ctxt nonmono_Ts type_sys res_T |
1650 |> AAtom |> mk_aquant AForall (bound_names ~~ bound_Ts) |
1659 |> AAtom |> mk_aquant AForall (bound_names ~~ bound_Ts) |
1654 |> close_formula_universally |
1663 |> close_formula_universally |
1655 |> maybe_negate, |
1664 |> maybe_negate, |
1656 intro_info, NONE) |
1665 intro_info, NONE) |
1657 end |
1666 end |
1658 |
1667 |
1659 fun formula_lines_for_tag_sym_decl ctxt format conj_sym_kind nonmono_Ts type_sys |
1668 fun formula_lines_for_tags_sym_decl ctxt format conj_sym_kind nonmono_Ts |
1660 n s (j, (s', T_args, T, pred_sym, ary, in_conj)) = |
1669 type_sys n s (j, (s', T_args, T, pred_sym, ary, in_conj)) = |
1661 let |
1670 let |
1662 val ident_base = |
1671 val ident_base = |
1663 sym_formula_prefix ^ s ^ (if n > 1 then "_" ^ string_of_int j else "") |
1672 tags_sym_formula_prefix ^ s ^ |
|
1673 (if n > 1 then "_" ^ string_of_int j else "") |
1664 val (kind, maybe_negate) = |
1674 val (kind, maybe_negate) = |
1665 if in_conj then (conj_sym_kind, conj_sym_kind = Conjecture ? mk_anot) |
1675 if in_conj then (conj_sym_kind, conj_sym_kind = Conjecture ? mk_anot) |
1666 else (Axiom, I) |
1676 else (Axiom, I) |
1667 val (arg_Ts, res_T) = chop_fun ary T |
1677 val (arg_Ts, res_T) = chop_fun ary T |
1668 val bound_names = |
1678 val bound_names = |
1728 decls |
1738 decls |
1729 |> filter (should_predicate_on_type ctxt nonmono_Ts type_sys (K true) |
1739 |> filter (should_predicate_on_type ctxt nonmono_Ts type_sys (K true) |
1730 o result_type_of_decl) |
1740 o result_type_of_decl) |
1731 in |
1741 in |
1732 (0 upto length decls - 1, decls) |
1742 (0 upto length decls - 1, decls) |
1733 |-> map2 (formula_line_for_pred_sym_decl ctxt format conj_sym_kind |
1743 |-> map2 (formula_line_for_preds_sym_decl ctxt format conj_sym_kind |
1734 nonmono_Ts type_sys n s) |
1744 nonmono_Ts type_sys n s) |
1735 end |
1745 end |
1736 | Tags (_, _, heaviness) => |
1746 | Tags (_, _, heaviness) => |
1737 (case heaviness of |
1747 (case heaviness of |
1738 Heavy => [] |
1748 Heavy => [] |
1739 | Light => |
1749 | Light => |
1740 let val n = length decls in |
1750 let val n = length decls in |
1741 (0 upto n - 1 ~~ decls) |
1751 (0 upto n - 1 ~~ decls) |
1742 |> maps (formula_lines_for_tag_sym_decl ctxt format conj_sym_kind |
1752 |> maps (formula_lines_for_tags_sym_decl ctxt format conj_sym_kind |
1743 nonmono_Ts type_sys n s) |
1753 nonmono_Ts type_sys n s) |
1744 end) |
1754 end) |
1745 |
1755 |
1746 fun problem_lines_for_sym_decl_table ctxt format conj_sym_kind nonmono_Ts |
1756 fun problem_lines_for_sym_decl_table ctxt format conj_sym_kind nonmono_Ts |
1747 type_sys sym_decl_tab = |
1757 type_sys sym_decl_tab = |
1748 sym_decl_tab |
1758 sym_decl_tab |