src/HOL/Decision_Procs/Dense_Linear_Order.thy
changeset 35092 cfe605c54e50
parent 35084 e25eedfc15ce
child 35267 8dfd816713c6
equal deleted inserted replaced
35091:59b41ba431b5 35092:cfe605c54e50
   682 | t => if t aconv term_of x then ("x",[]) else ("Nox",[]);
   682 | t => if t aconv term_of x then ("x",[]) else ("Nox",[]);
   683 
   683 
   684 fun xnormalize_conv ctxt [] ct = reflexive ct
   684 fun xnormalize_conv ctxt [] ct = reflexive ct
   685 | xnormalize_conv ctxt (vs as (x::_)) ct =
   685 | xnormalize_conv ctxt (vs as (x::_)) ct =
   686    case term_of ct of
   686    case term_of ct of
   687    Const(@{const_name Algebras.less},_)$_$Const(@{const_name Algebras.zero},_) =>
   687    Const(@{const_name Orderings.less},_)$_$Const(@{const_name Algebras.zero},_) =>
   688     (case whatis x (Thm.dest_arg1 ct) of
   688     (case whatis x (Thm.dest_arg1 ct) of
   689     ("c*x+t",[c,t]) =>
   689     ("c*x+t",[c,t]) =>
   690        let
   690        let
   691         val cr = dest_frac c
   691         val cr = dest_frac c
   692         val clt = Thm.dest_fun2 ct
   692         val clt = Thm.dest_fun2 ct
   725         val rth = th
   725         val rth = th
   726       in rth end
   726       in rth end
   727     | _ => reflexive ct)
   727     | _ => reflexive ct)
   728 
   728 
   729 
   729 
   730 |  Const(@{const_name Algebras.less_eq},_)$_$Const(@{const_name Algebras.zero},_) =>
   730 |  Const(@{const_name Orderings.less_eq},_)$_$Const(@{const_name Algebras.zero},_) =>
   731    (case whatis x (Thm.dest_arg1 ct) of
   731    (case whatis x (Thm.dest_arg1 ct) of
   732     ("c*x+t",[c,t]) =>
   732     ("c*x+t",[c,t]) =>
   733        let
   733        let
   734         val T = ctyp_of_term x
   734         val T = ctyp_of_term x
   735         val cr = dest_frac c
   735         val cr = dest_frac c
   814   val less_iff_diff_less_0 = mk_meta_eq @{thm "less_iff_diff_less_0"}
   814   val less_iff_diff_less_0 = mk_meta_eq @{thm "less_iff_diff_less_0"}
   815   val le_iff_diff_le_0 = mk_meta_eq @{thm "le_iff_diff_le_0"}
   815   val le_iff_diff_le_0 = mk_meta_eq @{thm "le_iff_diff_le_0"}
   816   val eq_iff_diff_eq_0 = mk_meta_eq @{thm "eq_iff_diff_eq_0"}
   816   val eq_iff_diff_eq_0 = mk_meta_eq @{thm "eq_iff_diff_eq_0"}
   817 in
   817 in
   818 fun field_isolate_conv phi ctxt vs ct = case term_of ct of
   818 fun field_isolate_conv phi ctxt vs ct = case term_of ct of
   819   Const(@{const_name Algebras.less},_)$a$b =>
   819   Const(@{const_name Orderings.less},_)$a$b =>
   820    let val (ca,cb) = Thm.dest_binop ct
   820    let val (ca,cb) = Thm.dest_binop ct
   821        val T = ctyp_of_term ca
   821        val T = ctyp_of_term ca
   822        val th = instantiate' [SOME T] [SOME ca, SOME cb] less_iff_diff_less_0
   822        val th = instantiate' [SOME T] [SOME ca, SOME cb] less_iff_diff_less_0
   823        val nth = Conv.fconv_rule
   823        val nth = Conv.fconv_rule
   824          (Conv.arg_conv (Conv.arg1_conv
   824          (Conv.arg_conv (Conv.arg1_conv
   825               (Normalizer.semiring_normalize_ord_conv @{context} (earlier vs)))) th
   825               (Normalizer.semiring_normalize_ord_conv @{context} (earlier vs)))) th
   826        val rth = transitive nth (xnormalize_conv ctxt vs (Thm.rhs_of nth))
   826        val rth = transitive nth (xnormalize_conv ctxt vs (Thm.rhs_of nth))
   827    in rth end
   827    in rth end
   828 | Const(@{const_name Algebras.less_eq},_)$a$b =>
   828 | Const(@{const_name Orderings.less_eq},_)$a$b =>
   829    let val (ca,cb) = Thm.dest_binop ct
   829    let val (ca,cb) = Thm.dest_binop ct
   830        val T = ctyp_of_term ca
   830        val T = ctyp_of_term ca
   831        val th = instantiate' [SOME T] [SOME ca, SOME cb] le_iff_diff_le_0
   831        val th = instantiate' [SOME T] [SOME ca, SOME cb] le_iff_diff_le_0
   832        val nth = Conv.fconv_rule
   832        val nth = Conv.fconv_rule
   833          (Conv.arg_conv (Conv.arg1_conv
   833          (Conv.arg_conv (Conv.arg1_conv
   854    case term_of t of
   854    case term_of t of
   855      Const("op =", _)$y$z => if term_of x aconv y then Ferrante_Rackoff_Data.Eq
   855      Const("op =", _)$y$z => if term_of x aconv y then Ferrante_Rackoff_Data.Eq
   856                             else Ferrante_Rackoff_Data.Nox
   856                             else Ferrante_Rackoff_Data.Nox
   857    | @{term "Not"}$(Const("op =", _)$y$z) => if term_of x aconv y then Ferrante_Rackoff_Data.NEq
   857    | @{term "Not"}$(Const("op =", _)$y$z) => if term_of x aconv y then Ferrante_Rackoff_Data.NEq
   858                             else Ferrante_Rackoff_Data.Nox
   858                             else Ferrante_Rackoff_Data.Nox
   859    | Const(@{const_name Algebras.less},_)$y$z =>
   859    | Const(@{const_name Orderings.less},_)$y$z =>
   860        if term_of x aconv y then Ferrante_Rackoff_Data.Lt
   860        if term_of x aconv y then Ferrante_Rackoff_Data.Lt
   861         else if term_of x aconv z then Ferrante_Rackoff_Data.Gt
   861         else if term_of x aconv z then Ferrante_Rackoff_Data.Gt
   862         else Ferrante_Rackoff_Data.Nox
   862         else Ferrante_Rackoff_Data.Nox
   863    | Const (@{const_name Algebras.less_eq},_)$y$z =>
   863    | Const (@{const_name Orderings.less_eq},_)$y$z =>
   864          if term_of x aconv y then Ferrante_Rackoff_Data.Le
   864          if term_of x aconv y then Ferrante_Rackoff_Data.Le
   865          else if term_of x aconv z then Ferrante_Rackoff_Data.Ge
   865          else if term_of x aconv z then Ferrante_Rackoff_Data.Ge
   866          else Ferrante_Rackoff_Data.Nox
   866          else Ferrante_Rackoff_Data.Nox
   867    | _ => Ferrante_Rackoff_Data.Nox
   867    | _ => Ferrante_Rackoff_Data.Nox
   868  in h end;
   868  in h end;