src/HOL/Tools/ATP/atp_problem_generate.ML
changeset 59632 5980e75a204e
parent 59621 291934bac95e
child 59709 44dabb962e48
equal deleted inserted replaced
59631:34030d67afb9 59632:5980e75a204e
   756 fun reveal_bounds Ts =
   756 fun reveal_bounds Ts =
   757   subst_atomic (map (fn (j, T) => (Free (concealed_bound_name j, T), Bound j))
   757   subst_atomic (map (fn (j, T) => (Free (concealed_bound_name j, T), Bound j))
   758                     (0 upto length Ts - 1 ~~ Ts))
   758                     (0 upto length Ts - 1 ~~ Ts))
   759 
   759 
   760 fun do_introduce_combinators ctxt Ts t =
   760 fun do_introduce_combinators ctxt Ts t =
   761   let val thy = Proof_Context.theory_of ctxt in
   761   (t |> conceal_bounds Ts
   762     t |> conceal_bounds Ts
   762      |> Thm.cterm_of ctxt
   763       |> Thm.global_cterm_of thy
   763      |> Meson_Clausify.introduce_combinators_in_cterm
   764       |> Meson_Clausify.introduce_combinators_in_cterm
   764      |> Thm.prop_of |> Logic.dest_equals |> snd
   765       |> Thm.prop_of |> Logic.dest_equals |> snd
   765      |> reveal_bounds Ts)
   766       |> reveal_bounds Ts
       
   767   end
       
   768   (* A type variable of sort "{}" will make abstraction fail. *)
   766   (* A type variable of sort "{}" will make abstraction fail. *)
   769   handle THM _ => t |> do_cheaply_conceal_lambdas Ts
   767   handle THM _ => t |> do_cheaply_conceal_lambdas Ts
   770 val introduce_combinators = simple_translate_lambdas do_introduce_combinators
   768 val introduce_combinators = simple_translate_lambdas do_introduce_combinators
   771 
   769 
   772 fun constify_lifted (t $ u) = constify_lifted t $ constify_lifted u
   770 fun constify_lifted (t $ u) = constify_lifted t $ constify_lifted u
  1253     val need_trueprop = (fastype_of t = @{typ bool})
  1251     val need_trueprop = (fastype_of t = @{typ bool})
  1254     val is_ho = is_type_enc_higher_order type_enc
  1252     val is_ho = is_type_enc_higher_order type_enc
  1255   in
  1253   in
  1256     t |> need_trueprop ? HOLogic.mk_Trueprop
  1254     t |> need_trueprop ? HOLogic.mk_Trueprop
  1257       |> (if is_ho then unextensionalize_def
  1255       |> (if is_ho then unextensionalize_def
  1258           else cong_extensionalize_term thy #> abs_extensionalize_term ctxt)
  1256           else cong_extensionalize_term ctxt #> abs_extensionalize_term ctxt)
  1259       |> presimplify_term ctxt
  1257       |> presimplify_term ctxt
  1260       |> HOLogic.dest_Trueprop
  1258       |> HOLogic.dest_Trueprop
  1261   end
  1259   end
  1262   handle TERM _ => @{const True}
  1260   handle TERM _ => @{const True}
  1263 
  1261