src/HOL/Tools/ATP/atp_problem.ML
changeset 50522 19dbd7554076
parent 50521 bec828f3364e
child 51646 005b7682178b
equal deleted inserted replaced
50521:bec828f3364e 50522:19dbd7554076
   477 
   477 
   478 val atype_of_types = AType (tptp_type_of_types, [])
   478 val atype_of_types = AType (tptp_type_of_types, [])
   479 
   479 
   480 fun nary_type_decl_type n = funpow n (curry AFun atype_of_types) atype_of_types
   480 fun nary_type_decl_type n = funpow n (curry AFun atype_of_types) atype_of_types
   481 
   481 
   482 fun tptp_maybe_alt "" = ""
   482 fun maybe_alt "" = ""
   483   | tptp_maybe_alt s = " % " ^ s
   483   | maybe_alt s = " % " ^ s
   484 
   484 
   485 fun tptp_string_for_line format (Type_Decl (ident, ty, ary)) =
   485 fun tptp_string_for_line format (Type_Decl (ident, ty, ary)) =
   486     tptp_string_for_line format (Sym_Decl (ident, ty, nary_type_decl_type ary))
   486     tptp_string_for_line format (Sym_Decl (ident, ty, nary_type_decl_type ary))
   487   | tptp_string_for_line format (Sym_Decl (ident, sym, ty)) =
   487   | tptp_string_for_line format (Sym_Decl (ident, sym, ty)) =
   488     tptp_string_for_format format ^ "(" ^ ident ^ ", type,\n    " ^ sym ^
   488     tptp_string_for_format format ^ "(" ^ ident ^ ", type,\n    " ^ sym ^
   489     " : " ^ string_for_type format ty ^ ").\n"
   489     " : " ^ string_for_type format ty ^ ").\n"
   490   | tptp_string_for_line format (Formula ((ident, alt), kind, phi, source, _)) =
   490   | tptp_string_for_line format (Formula ((ident, alt), kind, phi, source, _)) =
   491     tptp_string_for_format format ^ "(" ^ ident ^ ", " ^
   491     tptp_string_for_format format ^ "(" ^ ident ^ ", " ^
   492     tptp_string_for_role kind ^ "," ^ tptp_maybe_alt alt ^
   492     tptp_string_for_role kind ^ "," ^ maybe_alt alt ^
   493     "\n    (" ^ tptp_string_for_formula format phi ^ ")" ^
   493     "\n    (" ^ tptp_string_for_formula format phi ^ ")" ^
   494     (case source of
   494     (case source of
   495        SOME tm => ", " ^ tptp_string_for_term format tm
   495        SOME tm => ", " ^ tptp_string_for_term format tm
   496      | NONE => "") ^ ").\n"
   496      | NONE => "") ^ ").\n"
   497 
   497 
   583       "sort(" ^
   583       "sort(" ^
   584       (if null xs then ""
   584       (if null xs then ""
   585        else "[" ^ commas (map str_for_bound_tvar xs) ^ "], ") ^
   585        else "[" ^ commas (map str_for_bound_tvar xs) ^ "], ") ^
   586       str_for_typ ty ^ ", " ^ cl ^ ")."
   586       str_for_typ ty ^ ", " ^ cl ^ ")."
   587     fun subclass_of sub super = "subclass(" ^ sub ^ ", " ^ super ^ ")."
   587     fun subclass_of sub super = "subclass(" ^ sub ^ ", " ^ super ^ ")."
   588     fun formula pred (Formula ((ident, _), kind, phi, _, info)) =
   588     fun formula pred (Formula ((ident, alt), kind, phi, _, info)) =
   589         if pred kind then
   589         if pred kind then
   590           let val rank = extract_isabelle_rank info in
   590           let val rank = extract_isabelle_rank info in
   591             "formula(" ^ dfg_string_for_formula poly gen_simp info phi ^
   591             "formula(" ^ dfg_string_for_formula poly gen_simp info phi ^
   592             ", " ^ ident ^
   592             ", " ^ ident ^
   593             (if rank = default_rank then "" else ", " ^ string_of_int rank) ^
   593             (if rank = default_rank then "" else ", " ^ string_of_int rank) ^
   594             ")." |> SOME
   594             ")." ^ maybe_alt alt
       
   595             |> SOME
   595           end
   596           end
   596         else
   597         else
   597           NONE
   598           NONE
   598       | formula _ _ = NONE
   599       | formula _ _ = NONE
   599     fun filt f = problem |> map (map_filter f o snd) |> filter_out null
   600     fun filt f = problem |> map (map_filter f o snd) |> filter_out null