src/HOL/Tools/ATP/atp_translate.ML
changeset 43295 30aaab778416
parent 43293 a80cdc4b27a3
child 43297 e77baf329f48
equal deleted inserted replaced
43294:0271fda2a83a 43295:30aaab778416
   973   in
   973   in
   974     {name = name, locality = loc, kind = kind, combformula = combformula,
   974     {name = name, locality = loc, kind = kind, combformula = combformula,
   975      atomic_types = atomic_types}
   975      atomic_types = atomic_types}
   976   end
   976   end
   977 
   977 
   978 fun make_fact ctxt format type_sys keep_trivial eq_as_iff preproc presimp_consts
   978 fun make_fact ctxt format type_sys eq_as_iff preproc presimp_consts
   979               ((name, loc), t) =
   979               ((name, loc), t) =
   980   let val thy = Proof_Context.theory_of ctxt in
   980   let val thy = Proof_Context.theory_of ctxt in
   981     case (keep_trivial,
   981     case t |> preproc ? preprocess_prop ctxt presimp_consts Axiom
   982           t |> preproc ? preprocess_prop ctxt presimp_consts Axiom
   982            |> make_formula thy format type_sys (eq_as_iff andalso format <> CNF)
   983             |> make_formula thy format type_sys eq_as_iff name loc Axiom) of
   983                            name loc Axiom of
   984       (false,
   984       formula as {combformula = AAtom (CombConst ((s, _), _, _)), ...} =>
   985        formula as {combformula = AAtom (CombConst ((s, _), _, _)), ...}) =>
       
   986       if s = tptp_true then NONE else SOME formula
   985       if s = tptp_true then NONE else SOME formula
   987     | (_, formula) => SOME formula
   986     | formula => SOME formula
   988   end
   987   end
   989 
   988 
   990 fun make_conjecture ctxt format prem_kind type_sys preproc presimp_consts ts =
   989 fun make_conjecture ctxt format prem_kind type_sys preproc presimp_consts ts =
   991   let
   990   let
   992     val thy = Proof_Context.theory_of ctxt
   991     val thy = Proof_Context.theory_of ctxt
  1352                 ? (case types of
  1351                 ? (case types of
  1353                      [T] => specialize_type thy (invert_const unmangled_s, T)
  1352                      [T] => specialize_type thy (invert_const unmangled_s, T)
  1354                    | _ => I)
  1353                    | _ => I)
  1355          end)
  1354          end)
  1356       val make_facts =
  1355       val make_facts =
  1357         map_filter (make_fact ctxt format type_sys false false false [])
  1356         map_filter (make_fact ctxt format type_sys false false [])
  1358       val fairly_sound = is_type_sys_fairly_sound type_sys
  1357       val fairly_sound = is_type_sys_fairly_sound type_sys
  1359     in
  1358     in
  1360       helper_table
  1359       helper_table
  1361       |> maps (fn ((helper_s, needs_fairly_sound), ths) =>
  1360       |> maps (fn ((helper_s, needs_fairly_sound), ths) =>
  1362                   if helper_s <> unmangled_s orelse
  1361                   if helper_s <> unmangled_s orelse
  1415                        facts =
  1414                        facts =
  1416   let
  1415   let
  1417     val thy = Proof_Context.theory_of ctxt
  1416     val thy = Proof_Context.theory_of ctxt
  1418     val fact_ts = facts |> map snd
  1417     val fact_ts = facts |> map snd
  1419     val presimp_consts = Meson.presimplified_consts ctxt
  1418     val presimp_consts = Meson.presimplified_consts ctxt
  1420     val make_fact =
  1419     val make_fact = make_fact ctxt format type_sys true preproc presimp_consts
  1421       make_fact ctxt format type_sys false true true presimp_consts
       
  1422     val (facts, fact_names) =
  1420     val (facts, fact_names) =
  1423       facts |> map (fn (name, t) => (name, t) |> make_fact |> rpair name)
  1421       facts |> map (fn (name, t) => (name, t) |> make_fact |> rpair name)
  1424             |> map_filter (try (apfst the))
  1422             |> map_filter (try (apfst the))
  1425             |> ListPair.unzip
  1423             |> ListPair.unzip
  1426     (* Remove existing facts from the conjecture, as this can dramatically
  1424     (* Remove existing facts from the conjecture, as this can dramatically