src/HOL/Tools/ATP/atp_problem.ML
changeset 46338 b02ff6b17599
parent 46320 0b8b73b49848
child 46378 7769bf5c2a17
equal deleted inserted replaced
46337:54227223a8d4 46338:b02ff6b17599
   281      | _ => ty)
   281      | _ => ty)
   282   | flatten_type (ty as AType _) = ty
   282   | flatten_type (ty as AType _) = ty
   283   | flatten_type _ =
   283   | flatten_type _ =
   284     raise Fail "unexpected higher-order type in first-order format"
   284     raise Fail "unexpected higher-order type in first-order format"
   285 
   285 
       
   286 val dfg_individual_type = "i" (* shouldn't clash *)
       
   287 
   286 fun str_for_type format ty =
   288 fun str_for_type format ty =
   287   let
   289   let
   288     val dfg = (format = DFG DFG_Sorted)
   290     val dfg = (format = DFG DFG_Sorted)
   289     fun str _ (AType (s, [])) =
   291     fun str _ (AType (s, [])) =
   290         if dfg andalso s = tptp_individual_type then "Top" else s
   292         if dfg andalso s = tptp_individual_type then dfg_individual_type else s
   291       | str _ (AType (s, tys)) =
   293       | str _ (AType (s, tys)) =
   292         let val ss = tys |> map (str false) in
   294         let val ss = tys |> map (str false) in
   293           if s = tptp_product_type then
   295           if s = tptp_product_type then
   294             ss |> space_implode
   296             ss |> space_implode
   295                       (if dfg then ", " else " " ^ tptp_product_type ^ " ")
   297                       (if dfg then ", " else " " ^ tptp_product_type ^ " ")
   486              | _ => NONE)
   488              | _ => NONE)
   487       |> commas |> enclose "predicates [" "]."
   489       |> commas |> enclose "predicates [" "]."
   488     fun sorts () =
   490     fun sorts () =
   489       filt (fn Decl (_, sym, AType (s, [])) =>
   491       filt (fn Decl (_, sym, AType (s, [])) =>
   490                if s = tptp_type_of_types then SOME sym else NONE
   492                if s = tptp_type_of_types then SOME sym else NONE
   491              | _ => NONE)
   493              | _ => NONE) @ [dfg_individual_type]
   492       |> commas |> enclose "sorts [" "]."
   494       |> commas |> enclose "sorts [" "]."
   493     val syms = [func_aries, pred_aries] @ (if sorted then [sorts ()] else [])
   495     val syms = [func_aries, pred_aries] @ (if sorted then [sorts ()] else [])
   494     fun func_sigs () =
   496     fun func_sigs () =
   495       filt (fn Decl (_, sym, ty) =>
   497       filt (fn Decl (_, sym, ty) =>
   496                if is_function_type ty then SOME (fun_typ sym ty) else NONE
   498                if is_function_type ty then SOME (fun_typ sym ty) else NONE