14 type atp_format = ATP_Problem.atp_format |
14 type atp_format = ATP_Problem.atp_format |
15 type formula_kind = ATP_Problem.formula_kind |
15 type formula_kind = ATP_Problem.formula_kind |
16 type 'a problem = 'a ATP_Problem.problem |
16 type 'a problem = 'a ATP_Problem.problem |
17 |
17 |
18 datatype locality = |
18 datatype locality = |
19 General | Helper | Induction | Intro | Elim | Simp | Local | Assum | Chained |
19 General | Induction | Intro | Elim | Simp | Local | Assum | Chained |
20 |
20 |
21 datatype polymorphism = Polymorphic | Raw_Monomorphic | Mangled_Monomorphic |
21 datatype polymorphism = Polymorphic | Raw_Monomorphic | Mangled_Monomorphic |
22 datatype strictness = Strict | Non_Strict |
22 datatype strictness = Strict | Non_Strict |
23 datatype granularity = All_Vars | Positively_Naked_Vars | Ghost_Type_Arg_Vars |
23 datatype granularity = All_Vars | Positively_Naked_Vars | Ghost_Type_Arg_Vars |
24 datatype type_level = |
24 datatype type_level = |
540 val name = `make_bound_var s |
540 val name = `make_bound_var s |
541 val (tm, atomic_Ts) = iterm_from_term thy format ((s, (name, T)) :: bs) t |
541 val (tm, atomic_Ts) = iterm_from_term thy format ((s, (name, T)) :: bs) t |
542 in (IAbs ((name, T), tm), union (op =) atomic_Ts (atomic_types_of T)) end |
542 in (IAbs ((name, T), tm), union (op =) atomic_Ts (atomic_types_of T)) end |
543 |
543 |
544 datatype locality = |
544 datatype locality = |
545 General | Helper | Induction | Intro | Elim | Simp | Local | Assum | Chained |
545 General | Induction | Intro | Elim | Simp | Local | Assum | Chained |
546 |
546 |
547 datatype order = First_Order | Higher_Order |
547 datatype order = First_Order | Higher_Order |
548 datatype polymorphism = Polymorphic | Raw_Monomorphic | Mangled_Monomorphic |
548 datatype polymorphism = Polymorphic | Raw_Monomorphic | Mangled_Monomorphic |
549 datatype strictness = Strict | Non_Strict |
549 datatype strictness = Strict | Non_Strict |
550 datatype granularity = All_Vars | Positively_Naked_Vars | Ghost_Type_Arg_Vars |
550 datatype granularity = All_Vars | Positively_Naked_Vars | Ghost_Type_Arg_Vars |
1178 val (facts, lambda_ts) = |
1178 val (facts, lambda_ts) = |
1179 facts |> map (snd o snd) |> trans_lams |
1179 facts |> map (snd o snd) |> trans_lams |
1180 |>> map2 (fn (name, (kind, _)) => fn t => (name, (kind, t))) facts |
1180 |>> map2 (fn (name, (kind, _)) => fn t => (name, (kind, t))) facts |
1181 val lam_facts = |
1181 val lam_facts = |
1182 map2 (fn t => fn j => |
1182 map2 (fn t => fn j => |
1183 ((lam_fact_prefix ^ Int.toString j, Helper), (Axiom, t))) |
1183 ((lam_fact_prefix ^ Int.toString j, General), (Axiom, t))) |
1184 lambda_ts (1 upto length lambda_ts) |
1184 lambda_ts (1 upto length lambda_ts) |
1185 in (facts, lam_facts) end |
1185 in (facts, lam_facts) end |
1186 |
1186 |
1187 (* Metis's use of "resolve_tac" freezes the schematic variables. We simulate the |
1187 (* Metis's use of "resolve_tac" freezes the schematic variables. We simulate the |
1188 same in Sledgehammer to prevent the discovery of unreplayable proofs. *) |
1188 same in Sledgehammer to prevent the discovery of unreplayable proofs. *) |
1603 SOME mangled_s => |
1603 SOME mangled_s => |
1604 let |
1604 let |
1605 val thy = Proof_Context.theory_of ctxt |
1605 val thy = Proof_Context.theory_of ctxt |
1606 val unmangled_s = mangled_s |> unmangled_const_name |
1606 val unmangled_s = mangled_s |> unmangled_const_name |
1607 fun dub needs_fairly_sound j k = |
1607 fun dub needs_fairly_sound j k = |
1608 (unmangled_s ^ "_" ^ string_of_int j ^ "_" ^ string_of_int k ^ |
1608 unmangled_s ^ "_" ^ string_of_int j ^ "_" ^ string_of_int k ^ |
1609 (if mangled_s = unmangled_s then "" else "_" ^ ascii_of mangled_s) ^ |
1609 (if mangled_s = unmangled_s then "" else "_" ^ ascii_of mangled_s) ^ |
1610 (if needs_fairly_sound then typed_helper_suffix |
1610 (if needs_fairly_sound then typed_helper_suffix |
1611 else untyped_helper_suffix), |
1611 else untyped_helper_suffix) |
1612 Helper) |
|
1613 fun dub_and_inst needs_fairly_sound (th, j) = |
1612 fun dub_and_inst needs_fairly_sound (th, j) = |
1614 let val t = prop_of th in |
1613 let val t = prop_of th in |
1615 if should_specialize_helper type_enc t then |
1614 if should_specialize_helper type_enc t then |
1616 map (fn T => specialize_type thy (invert_const unmangled_s, T) t) |
1615 map (fn T => specialize_type thy (invert_const unmangled_s, T) t) |
1617 types |
1616 types |
1618 else |
1617 else |
1619 [t] |
1618 [t] |
1620 end |
1619 end |
1621 |> map (fn (k, t) => (dub needs_fairly_sound j k, t)) o tag_list 1 |
1620 |> tag_list 1 |
|
1621 |> map (fn (k, t) => ((dub needs_fairly_sound j k, Simp), t)) |
1622 val make_facts = map_filter (make_fact ctxt format type_enc false) |
1622 val make_facts = map_filter (make_fact ctxt format type_enc false) |
1623 val fairly_sound = is_type_enc_fairly_sound type_enc |
1623 val fairly_sound = is_type_enc_fairly_sound type_enc |
1624 in |
1624 in |
1625 helper_table |
1625 helper_table |
1626 |> maps (fn ((helper_s, needs_fairly_sound), ths) => |
1626 |> maps (fn ((helper_s, needs_fairly_sound), ths) => |