src/HOL/Tools/numeral_simprocs.ML
changeset 46240 933f35c4e126
parent 45668 0ea1c705eebb
child 46497 89ccf66aa73d
equal deleted inserted replaced
46239:fcfb4aa8e6e6 46240:933f35c4e126
   459 fun sign_conv pos_th neg_th ss t =
   459 fun sign_conv pos_th neg_th ss t =
   460   let val T = fastype_of t;
   460   let val T = fastype_of t;
   461       val zero = Const(@{const_name Groups.zero}, T);
   461       val zero = Const(@{const_name Groups.zero}, T);
   462       val less = Const(@{const_name Orderings.less}, [T,T] ---> HOLogic.boolT);
   462       val less = Const(@{const_name Orderings.less}, [T,T] ---> HOLogic.boolT);
   463       val pos = less $ zero $ t and neg = less $ t $ zero
   463       val pos = less $ zero $ t and neg = less $ t $ zero
       
   464       val thy = Proof_Context.theory_of (Simplifier.the_context ss)
   464       fun prove p =
   465       fun prove p =
   465         Option.map Eq_True_elim (Lin_Arith.simproc ss p)
   466         SOME (Eq_True_elim (Simplifier.asm_rewrite ss (Thm.cterm_of thy p)))
   466         handle THM _ => NONE
   467         handle THM _ => NONE
   467     in case prove pos of
   468     in case prove pos of
   468          SOME th => SOME(th RS pos_th)
   469          SOME th => SOME(th RS pos_th)
   469        | NONE => (case prove neg of
   470        | NONE => (case prove neg of
   470                     SOME th => SOME(th RS neg_th)
   471                     SOME th => SOME(th RS neg_th)