src/HOL/Tools/ATP/atp_problem_generate.ML
changeset 47971 2aea51a14200
parent 47958 c5f7be4a1734
child 47975 adc977fec17e
equal deleted inserted replaced
47970:257fc09aa8a1 47971:2aea51a14200
  1295   in
  1295   in
  1296     {name = name, stature = stature, kind = kind, iformula = iformula,
  1296     {name = name, stature = stature, kind = kind, iformula = iformula,
  1297      atomic_types = atomic_Ts}
  1297      atomic_types = atomic_Ts}
  1298   end
  1298   end
  1299 
  1299 
  1300 fun make_fact ctxt format type_enc iff_for_eq ((name, stature), t) =
  1300 fun is_legitimate_thf_def (Const (@{const_name HOL.eq}, _) $ t $ u) =
  1301   case t |> make_formula ctxt format type_enc iff_for_eq name stature Axiom of
  1301     (is_Const t orelse is_Free t) andalso
  1302     formula as {iformula = AAtom (IConst ((s, _), _, _)), ...} =>
  1302     not (exists_subterm (curry (op =) t) u)
  1303     if s = tptp_true then NONE else SOME formula
  1303   | is_legitimate_thf_def _ = false
  1304   | formula => SOME formula
  1304 
       
  1305 fun make_fact ctxt format type_enc iff_for_eq
       
  1306               ((name, stature as (_, status)), t) =
       
  1307   let
       
  1308     val role =
       
  1309       if is_type_enc_higher_order type_enc andalso status = Def andalso
       
  1310          is_legitimate_thf_def t then
       
  1311         Definition
       
  1312       else
       
  1313         Axiom
       
  1314   in
       
  1315     case t |> make_formula ctxt format type_enc iff_for_eq name stature role of
       
  1316       formula as {iformula = AAtom (IConst ((s, _), _, _)), ...} =>
       
  1317       if s = tptp_true then NONE else SOME formula
       
  1318     | formula => SOME formula
       
  1319   end
  1305 
  1320 
  1306 fun s_not_prop (@{const Trueprop} $ t) = @{const Trueprop} $ s_not t
  1321 fun s_not_prop (@{const Trueprop} $ t) = @{const Trueprop} $ s_not t
  1307   | s_not_prop _ = @{prop True} (* "t" is too meta for "metis" *)
  1322   | s_not_prop _ = @{prop True} (* "t" is too meta for "metis" *)
  1308 (*
  1323 (*
  1309   | s_not_prop (@{const "==>"} $ t $ @{prop False}) = t
  1324   | s_not_prop (@{const "==>"} $ t $ @{prop False}) = t
  2876              | _ => I)
  2891              | _ => I)
  2877           | _ => formula_fold (SOME (role <> Conjecture)) add_atom_eq_deps phi
  2892           | _ => formula_fold (SOME (role <> Conjecture)) add_atom_eq_deps phi
  2878         else
  2893         else
  2879           I
  2894           I
  2880       | add_eq_deps _ _ = I
  2895       | add_eq_deps _ _ = I
  2881     fun has_status status (_, info) =
  2896     fun has_status status (_, info) = extract_isabelle_status info = SOME status
  2882       extract_isabelle_status info = SOME status
       
  2883     fun is_conj (role, _) = (role = Conjecture orelse role = Hypothesis)
  2897     fun is_conj (role, _) = (role = Conjecture orelse role = Hypothesis)
  2884     val graph =
  2898     val graph =
  2885       Graph.empty
  2899       Graph.empty
  2886       |> fold (fold (add_eq_deps (has_status defN)) o snd) problem
  2900       |> fold (fold (add_eq_deps (has_status defN)) o snd) problem
  2887       |> fold (fold (add_eq_deps (has_status simpN orf is_conj)) o snd) problem
  2901       |> fold (fold (add_eq_deps (has_status simpN orf is_conj)) o snd) problem