src/HOL/Tools/ATP/atp_problem_generate.ML
changeset 54788 a898e15b522a
parent 54768 ee0881a54c72
child 54791 3478fadb514e
equal deleted inserted replaced
54787:6d1670095414 54788:a898e15b522a
  2571               else
  2571               else
  2572                 NONE
  2572                 NONE
  2573           end
  2573           end
  2574         fun datatype_of_ctrs (ctrs as (_, T1) :: _) =
  2574         fun datatype_of_ctrs (ctrs as (_, T1) :: _) =
  2575           let val ctrs' = map do_ctr ctrs in
  2575           let val ctrs' = map do_ctr ctrs in
  2576             (native_ho_type_of_typ type_enc false 0 (body_type T1),
  2576             if forall is_some ctrs' then
  2577              map_filter I ctrs', forall is_some ctrs')
  2577               SOME (native_ho_type_of_typ type_enc false 0 (body_type T1), map_filter I ctrs')
       
  2578             else
       
  2579               NONE
  2578           end
  2580           end
  2579       in ctrss |> map datatype_of_ctrs |> filter_out (null o #2) end
  2581       in
       
  2582         map_filter datatype_of_ctrs ctrss
       
  2583       end
  2580     else
  2584     else
  2581       []
  2585       []
  2582   | datatypes_of_sym_table _ _ _ _ _ _ = []
  2586   | datatypes_of_sym_table _ _ _ _ _ _ = []
  2583 
  2587 
  2584 fun decl_line_of_datatype (ty as AType ((_, s'), ty_args), ctrs, exhaust) =
  2588 fun decl_line_of_datatype (ty as AType ((_, s'), ty_args), ctrs) =
  2585   let val xs = map (fn AType (name, []) => name) ty_args in
  2589   let val xs = map (fn AType (name, []) => name) ty_args in
  2586     Datatype_Decl (datatype_decl_prefix ^ ascii_of s', map (rpair []) xs, ty,
  2590     Datatype_Decl (datatype_decl_prefix ^ ascii_of s', map (rpair []) xs, ty, ctrs)
  2587                    ctrs, exhaust)
       
  2588   end
  2591   end
  2589 
  2592 
  2590 fun pair_append (xs1, xs2) (ys1, ys2) = (xs1 @ ys1, xs2 @ ys2)
  2593 fun pair_append (xs1, xs2) (ys1, ys2) = (xs1 @ ys1, xs2 @ ys2)
  2591 
  2594 
  2592 fun do_uncurried_alias_lines_of_sym ctxt ctrss mono type_enc sym_tab0 sym_tab
  2595 fun do_uncurried_alias_lines_of_sym ctxt ctrss mono type_enc sym_tab0 sym_tab
  2702       | do_formula (AConn (_, phis)) = fold do_formula phis
  2705       | do_formula (AConn (_, phis)) = fold do_formula phis
  2703       | do_formula (AAtom tm) = do_term true tm
  2706       | do_formula (AAtom tm) = do_term true tm
  2704     fun do_line (Class_Decl (_, _, cls)) = fold do_class cls
  2707     fun do_line (Class_Decl (_, _, cls)) = fold do_class cls
  2705       | do_line (Type_Decl _) = I
  2708       | do_line (Type_Decl _) = I
  2706       | do_line (Sym_Decl (_, _, ty)) = do_type ty
  2709       | do_line (Sym_Decl (_, _, ty)) = do_type ty
  2707       | do_line (Datatype_Decl (_, xs, ty, tms, _)) =
  2710       | do_line (Datatype_Decl (_, xs, ty, tms)) =
  2708         fold do_bound_tvars xs #> do_type ty #> fold (do_term false) tms
  2711         fold do_bound_tvars xs #> do_type ty #> fold (do_term false) tms
  2709       | do_line (Class_Memb (_, xs, ty, cl)) =
  2712       | do_line (Class_Memb (_, xs, ty, cl)) =
  2710         fold do_bound_tvars xs #> do_type ty #> do_class cl
  2713         fold do_bound_tvars xs #> do_type ty #> do_class cl
  2711       | do_line (Formula (_, _, phi, _, _)) = do_formula phi
  2714       | do_line (Formula (_, _, phi, _, _)) = do_formula phi
  2712     val ((cls, tys), syms) = declared_in_atp_problem problem
  2715     val ((cls, tys), syms) = declared_in_atp_problem problem