src/HOL/Tools/Sledgehammer/sledgehammer_translate.ML
changeset 38652 e063be321438
parent 38618 5536897d04c2
child 38678 1bf1e21d3136
equal deleted inserted replaced
38651:8aadda8e1338 38652:e063be321438
   117         fun aux Ts t =
   117         fun aux Ts t =
   118           case t of
   118           case t of
   119             @{const Not} $ t1 => @{const Not} $ aux Ts t1
   119             @{const Not} $ t1 => @{const Not} $ aux Ts t1
   120           | (t0 as Const (@{const_name All}, _)) $ Abs (s, T, t') =>
   120           | (t0 as Const (@{const_name All}, _)) $ Abs (s, T, t') =>
   121             t0 $ Abs (s, T, aux (T :: Ts) t')
   121             t0 $ Abs (s, T, aux (T :: Ts) t')
       
   122           | (t0 as Const (@{const_name All}, _)) $ t1 =>
       
   123             aux Ts (t0 $ eta_expand Ts t1 1)
   122           | (t0 as Const (@{const_name Ex}, _)) $ Abs (s, T, t') =>
   124           | (t0 as Const (@{const_name Ex}, _)) $ Abs (s, T, t') =>
   123             t0 $ Abs (s, T, aux (T :: Ts) t')
   125             t0 $ Abs (s, T, aux (T :: Ts) t')
       
   126           | (t0 as Const (@{const_name Ex}, _)) $ t1 =>
       
   127             aux Ts (t0 $ eta_expand Ts t1 1)
   124           | (t0 as @{const "op &"}) $ t1 $ t2 => t0 $ aux Ts t1 $ aux Ts t2
   128           | (t0 as @{const "op &"}) $ t1 $ t2 => t0 $ aux Ts t1 $ aux Ts t2
   125           | (t0 as @{const "op |"}) $ t1 $ t2 => t0 $ aux Ts t1 $ aux Ts t2
   129           | (t0 as @{const "op |"}) $ t1 $ t2 => t0 $ aux Ts t1 $ aux Ts t2
   126           | (t0 as @{const "op -->"}) $ t1 $ t2 => t0 $ aux Ts t1 $ aux Ts t2
   130           | (t0 as @{const "op -->"}) $ t1 $ t2 => t0 $ aux Ts t1 $ aux Ts t2
   127           | (t0 as Const (@{const_name "op ="}, Type (_, [@{typ bool}, _])))
   131           | (t0 as Const (@{const_name "op ="}, Type (_, [@{typ bool}, _])))
   128               $ t1 $ t2 =>
   132               $ t1 $ t2 =>
   173 (* making axiom and conjecture formulas *)
   177 (* making axiom and conjecture formulas *)
   174 fun make_formula ctxt presimp name kind t =
   178 fun make_formula ctxt presimp name kind t =
   175   let
   179   let
   176     val thy = ProofContext.theory_of ctxt
   180     val thy = ProofContext.theory_of ctxt
   177     val t = t |> Envir.beta_eta_contract
   181     val t = t |> Envir.beta_eta_contract
       
   182               |> transform_elim_term
   178               |> atomize_term
   183               |> atomize_term
   179     val t = t |> fastype_of t = HOLogic.boolT ? HOLogic.mk_Trueprop
   184     val need_trueprop = (fastype_of t = HOLogic.boolT)
       
   185     val t = t |> need_trueprop ? HOLogic.mk_Trueprop
   180               |> extensionalize_term
   186               |> extensionalize_term
   181               |> presimp ? presimplify_term thy
   187               |> presimp ? presimplify_term thy
   182               |> perhaps (try (HOLogic.dest_Trueprop))
   188               |> perhaps (try (HOLogic.dest_Trueprop))
   183               |> introduce_combinators_in_term ctxt kind
   189               |> introduce_combinators_in_term ctxt kind
   184               |> kind <> Axiom ? freeze_term
   190               |> kind <> Axiom ? freeze_term