src/HOL/Tools/ATP/atp_translate.ML
changeset 44003 0a0ee31ec20a
parent 44001 2b75760fa75e
child 44088 3693baa6befb
equal deleted inserted replaced
44002:ae53f1304ad5 44003:0a0ee31ec20a
  1333     (* This is a lie: Higher-order equality doesn't need a sound type encoding.
  1333     (* This is a lie: Higher-order equality doesn't need a sound type encoding.
  1334        However, this is done so for backward compatibility: Including the
  1334        However, this is done so for backward compatibility: Including the
  1335        equality helpers by default in Metis breaks a few existing proofs. *)
  1335        equality helpers by default in Metis breaks a few existing proofs. *)
  1336     @{thms fequal_def [THEN Meson.iff_to_disjD, THEN conjunct1]
  1336     @{thms fequal_def [THEN Meson.iff_to_disjD, THEN conjunct1]
  1337            fequal_def [THEN Meson.iff_to_disjD, THEN conjunct2]}),
  1337            fequal_def [THEN Meson.iff_to_disjD, THEN conjunct2]}),
  1338    (("fAll", false), []), (*TODO: add helpers*)
  1338    (* Partial characterization of "fAll" and "fEx". A complete characterization
  1339    (("fEx", false), []), (*TODO: add helpers*)
  1339       would require the axiom of choice for replay with Metis. *)
       
  1340    (("fAll", false), [@{lemma "~ fAll P | P x" by (auto simp: fAll_def)}]),
       
  1341    (("fEx", false), [@{lemma "~ P x | fEx P" by (auto simp: fEx_def)}]),
  1340    (("If", true), @{thms if_True if_False True_or_False})]
  1342    (("If", true), @{thms if_True if_False True_or_False})]
  1341   |> map (apsnd (map zero_var_indexes))
  1343   |> map (apsnd (map zero_var_indexes))
  1342 
  1344 
  1343 val type_tag = `make_fixed_const type_tag_name
  1345 val type_tag = `make_fixed_const type_tag_name
  1344 
  1346 
  1738   let val level = level_of_type_enc type_enc in
  1740   let val level = level_of_type_enc type_enc in
  1739     if level = Noninf_Nonmono_Types orelse level = Fin_Nonmono_Types then
  1741     if level = Noninf_Nonmono_Types orelse level = Fin_Nonmono_Types then
  1740       [] |> fold (add_fact_nonmonotonic_types ctxt level sound) facts
  1742       [] |> fold (add_fact_nonmonotonic_types ctxt level sound) facts
  1741          (* We must add "bool" in case the helper "True_or_False" is added
  1743          (* We must add "bool" in case the helper "True_or_False" is added
  1742             later. In addition, several places in the code rely on the list of
  1744             later. In addition, several places in the code rely on the list of
  1743             nonmonotonic types not being empty. *)
  1745             nonmonotonic types not being empty. (FIXME?) *)
  1744          |> insert_type ctxt I @{typ bool}
  1746          |> insert_type ctxt I @{typ bool}
  1745     else
  1747     else
  1746       []
  1748       []
  1747   end
  1749   end
  1748 
  1750 
  1887                       conj_sym_kind poly_nonmono_Ts type_enc n s)
  1889                       conj_sym_kind poly_nonmono_Ts type_enc n s)
  1888        end)
  1890        end)
  1889 
  1891 
  1890 fun problem_lines_for_sym_decl_table ctxt format conj_sym_kind nonmono_Ts
  1892 fun problem_lines_for_sym_decl_table ctxt format conj_sym_kind nonmono_Ts
  1891                                      poly_nonmono_Ts type_enc sym_decl_tab =
  1893                                      poly_nonmono_Ts type_enc sym_decl_tab =
  1892   sym_decl_tab
  1894   sym_decl_tab |> Symtab.dest |> sort_wrt fst |> rpair []
  1893   |> Symtab.dest
       
  1894   |> sort_wrt fst
       
  1895   |> rpair []
       
  1896   |-> fold_rev (append o problem_lines_for_sym_decls ctxt format conj_sym_kind
  1895   |-> fold_rev (append o problem_lines_for_sym_decls ctxt format conj_sym_kind
  1897                              nonmono_Ts poly_nonmono_Ts type_enc)
  1896                              nonmono_Ts poly_nonmono_Ts type_enc)
  1898 
  1897 
  1899 fun needs_type_tag_idempotence (Tags (poly, level, heaviness)) =
  1898 fun needs_type_tag_idempotence (Tags (poly, level, heaviness)) =
  1900     poly <> Mangled_Monomorphic andalso
  1899     poly <> Mangled_Monomorphic andalso
  1934       conjs @ facts |> sym_table_for_facts ctxt (SOME false)
  1933       conjs @ facts |> sym_table_for_facts ctxt (SOME false)
  1935     val helpers =
  1934     val helpers =
  1936       repaired_sym_tab |> helper_facts_for_sym_table ctxt format type_enc
  1935       repaired_sym_tab |> helper_facts_for_sym_table ctxt format type_enc
  1937                        |> map repair
  1936                        |> map repair
  1938     val poly_nonmono_Ts =
  1937     val poly_nonmono_Ts =
  1939       if null nonmono_Ts orelse nonmono_Ts = [@{typ bool}] orelse
  1938       if null nonmono_Ts orelse nonmono_Ts = [@{typ bool}] (* FIXME? *) orelse
  1940          polymorphism_of_type_enc type_enc <> Polymorphic then
  1939          polymorphism_of_type_enc type_enc <> Polymorphic then
  1941         nonmono_Ts
  1940         nonmono_Ts
  1942       else
  1941       else
  1943         [tvar_a]
  1942         [tvar_a]
  1944     val sym_decl_lines =
  1943     val sym_decl_lines =