src/HOL/Tools/ATP/atp_problem_generate.ML
changeset 47145 ffc6d6267a88
parent 47073 c73f7b0c7ebc
child 47148 7b5846065c1b
equal deleted inserted replaced
47144:9bfc32fc7ced 47145:ffc6d6267a88
  2033            |> formula_from_iformula ctxt polym_constrs format mono type_enc
  2033            |> formula_from_iformula ctxt polym_constrs format mono type_enc
  2034                   should_guard_var_in_formula (SOME false)
  2034                   should_guard_var_in_formula (SOME false)
  2035            |> close_formula_universally
  2035            |> close_formula_universally
  2036            |> bound_tvars type_enc true atomic_types, NONE, [])
  2036            |> bound_tvars type_enc true atomic_types, NONE, [])
  2037 
  2037 
       
  2038 fun type_enc_needs_free_types (Simple_Types (_, Polymorphic, _)) = true
       
  2039   | type_enc_needs_free_types (Simple_Types _) = false
       
  2040   | type_enc_needs_free_types _ = true
       
  2041 
  2038 fun formula_line_for_free_type j phi =
  2042 fun formula_line_for_free_type j phi =
  2039   Formula (tfree_clause_prefix ^ string_of_int j, Hypothesis, phi, NONE, [])
  2043   Formula (tfree_clause_prefix ^ string_of_int j, Hypothesis, phi, NONE, [])
  2040 fun formula_lines_for_free_types type_enc (facts : translated_formula list) =
  2044 fun formula_lines_for_free_types type_enc (facts : translated_formula list) =
  2041   let
  2045   if type_enc_needs_free_types type_enc then
  2042     val phis =
  2046     let
  2043       fold (union (op =)) (map #atomic_types facts) []
  2047       val phis =
  2044       |> formulas_for_types type_enc add_sorts_on_tfree
  2048         fold (union (op =)) (map #atomic_types facts) []
  2045   in map2 formula_line_for_free_type (0 upto length phis - 1) phis end
  2049         |> formulas_for_types type_enc add_sorts_on_tfree
       
  2050     in map2 formula_line_for_free_type (0 upto length phis - 1) phis end
       
  2051   else
       
  2052     []
  2046 
  2053 
  2047 (** Symbol declarations **)
  2054 (** Symbol declarations **)
  2048 
  2055 
  2049 fun decl_line_for_class order s =
  2056 fun decl_line_for_class order s =
  2050   let val name as (s, _) = `make_type_class s in
  2057   let val name as (s, _) = `make_type_class s in
  2495 fun default_type type_enc pred_sym s =
  2502 fun default_type type_enc pred_sym s =
  2496   let
  2503   let
  2497     val ind =
  2504     val ind =
  2498       case type_enc of
  2505       case type_enc of
  2499         Simple_Types _ =>
  2506         Simple_Types _ =>
  2500         if String.isPrefix type_const_prefix s then atype_of_types
  2507         if String.isPrefix type_const_prefix s orelse
  2501         else individual_atype
  2508            String.isPrefix tfree_prefix s then
       
  2509           atype_of_types
       
  2510         else
       
  2511           individual_atype
  2502       | _ => individual_atype
  2512       | _ => individual_atype
  2503     fun typ 0 = if pred_sym then bool_atype else ind
  2513     fun typ 0 = if pred_sym then bool_atype else ind
  2504       | typ ary = AFun (ind, typ (ary - 1))
  2514       | typ ary = AFun (ind, typ (ary - 1))
  2505   in typ end
  2515   in typ end
  2506 
  2516