src/HOL/Tools/Sledgehammer/sledgehammer.ML
changeset 38091 0508ff84036f
parent 38089 ed65a0777e10
child 38092 81a003f7de0d
equal deleted inserted replaced
38090:fe51c098b0ab 38091:0508ff84036f
   230         end
   230         end
   231       | aux _ t = t
   231       | aux _ t = t
   232   in aux (maxidx_of_term t + 1) t end
   232   in aux (maxidx_of_term t + 1) t end
   233 
   233 
   234 fun presimplify_term thy =
   234 fun presimplify_term thy =
   235   HOLogic.mk_Trueprop
   235   Skip_Proof.make_thm thy
   236   #> Skip_Proof.make_thm thy
       
   237   #> Meson.presimplify
   236   #> Meson.presimplify
   238   #> prop_of
   237   #> prop_of
   239   #> HOLogic.dest_Trueprop
       
   240 
   238 
   241 (* FIXME: Guarantee freshness *)
   239 (* FIXME: Guarantee freshness *)
   242 fun concealed_bound_name j = "Sledgehammer" ^ Int.toString j
   240 fun concealed_bound_name j = "Sledgehammer" ^ Int.toString j
   243 fun conceal_bounds Ts t =
   241 fun conceal_bounds Ts t =
   244   subst_bounds (map (Free o apfst concealed_bound_name)
   242   subst_bounds (map (Free o apfst concealed_bound_name)
   288 fun make_formula ctxt presimp (formula_name, kind, t) =
   286 fun make_formula ctxt presimp (formula_name, kind, t) =
   289   let
   287   let
   290     val thy = ProofContext.theory_of ctxt
   288     val thy = ProofContext.theory_of ctxt
   291     val t = t |> transform_elim_term
   289     val t = t |> transform_elim_term
   292               |> Object_Logic.atomize_term thy
   290               |> Object_Logic.atomize_term thy
       
   291     val t = t |> fastype_of t = HOLogic.boolT ? HOLogic.mk_Trueprop
   293               |> extensionalize_term
   292               |> extensionalize_term
   294               |> presimp ? presimplify_term thy
   293               |> presimp ? presimplify_term thy
       
   294               |> perhaps (try (HOLogic.dest_Trueprop))
   295               |> introduce_combinators_in_term ctxt kind
   295               |> introduce_combinators_in_term ctxt kind
   296     val (combformula, ctypes_sorts) = combformula_for_prop thy t []
   296     val (combformula, ctypes_sorts) = combformula_for_prop thy t []
   297   in
   297   in
   298     FOLFormula {formula_name = formula_name, combformula = combformula,
   298     FOLFormula {formula_name = formula_name, combformula = combformula,
   299                 kind = kind, ctypes_sorts = ctypes_sorts}
   299                 kind = kind, ctypes_sorts = ctypes_sorts}