src/HOL/Decision_Procs/Dense_Linear_Order.thy
changeset 59582 0fbed69ff081
parent 58889 5b7a9633cfa8
child 59586 ddf6deaadfe8
equal deleted inserted replaced
59580:cbc38731d42f 59582:0fbed69ff081
   556   fun simps phi = map (Morphism.thm phi) [@{thm "not_less"}, @{thm "not_le"}]
   556   fun simps phi = map (Morphism.thm phi) [@{thm "not_less"}, @{thm "not_le"}]
   557   fun generic_whatis phi =
   557   fun generic_whatis phi =
   558     let
   558     let
   559       val [lt, le] = map (Morphism.term phi) [@{term "op \<sqsubset>"}, @{term "op \<sqsubseteq>"}]
   559       val [lt, le] = map (Morphism.term phi) [@{term "op \<sqsubset>"}, @{term "op \<sqsubseteq>"}]
   560       fun h x t =
   560       fun h x t =
   561         case term_of t of
   561         case Thm.term_of t of
   562           Const(@{const_name HOL.eq}, _)$y$z =>
   562           Const(@{const_name HOL.eq}, _)$y$z =>
   563             if term_of x aconv y then Ferrante_Rackoff_Data.Eq
   563             if Thm.term_of x aconv y then Ferrante_Rackoff_Data.Eq
   564             else Ferrante_Rackoff_Data.Nox
   564             else Ferrante_Rackoff_Data.Nox
   565        | @{term "Not"}$(Const(@{const_name HOL.eq}, _)$y$z) =>
   565        | @{term "Not"}$(Const(@{const_name HOL.eq}, _)$y$z) =>
   566             if term_of x aconv y then Ferrante_Rackoff_Data.NEq
   566             if Thm.term_of x aconv y then Ferrante_Rackoff_Data.NEq
   567             else Ferrante_Rackoff_Data.Nox
   567             else Ferrante_Rackoff_Data.Nox
   568        | b$y$z => if Term.could_unify (b, lt) then
   568        | b$y$z => if Term.could_unify (b, lt) then
   569                      if term_of x aconv y then Ferrante_Rackoff_Data.Lt
   569                      if Thm.term_of x aconv y then Ferrante_Rackoff_Data.Lt
   570                      else if term_of x aconv z then Ferrante_Rackoff_Data.Gt
   570                      else if Thm.term_of x aconv z then Ferrante_Rackoff_Data.Gt
   571                      else Ferrante_Rackoff_Data.Nox
   571                      else Ferrante_Rackoff_Data.Nox
   572                  else if Term.could_unify (b, le) then
   572                  else if Term.could_unify (b, le) then
   573                      if term_of x aconv y then Ferrante_Rackoff_Data.Le
   573                      if Thm.term_of x aconv y then Ferrante_Rackoff_Data.Le
   574                      else if term_of x aconv z then Ferrante_Rackoff_Data.Ge
   574                      else if Thm.term_of x aconv z then Ferrante_Rackoff_Data.Ge
   575                      else Ferrante_Rackoff_Data.Nox
   575                      else Ferrante_Rackoff_Data.Nox
   576                  else Ferrante_Rackoff_Data.Nox
   576                  else Ferrante_Rackoff_Data.Nox
   577        | _ => Ferrante_Rackoff_Data.Nox
   577        | _ => Ferrante_Rackoff_Data.Nox
   578   in h end
   578   in h end
   579   fun ss phi =
   579   fun ss phi =
   707   fun earlier [] x y = false
   707   fun earlier [] x y = false
   708     | earlier (h::t) x y =
   708     | earlier (h::t) x y =
   709         if h aconvc y then false else if h aconvc x then true else earlier t x y;
   709         if h aconvc y then false else if h aconvc x then true else earlier t x y;
   710 
   710 
   711 fun dest_frac ct =
   711 fun dest_frac ct =
   712   case term_of ct of
   712   case Thm.term_of ct of
   713     Const (@{const_name Fields.divide},_) $ a $ b=>
   713     Const (@{const_name Fields.divide},_) $ a $ b=>
   714       Rat.rat_of_quotient (snd (HOLogic.dest_number a), snd (HOLogic.dest_number b))
   714       Rat.rat_of_quotient (snd (HOLogic.dest_number a), snd (HOLogic.dest_number b))
   715   | Const(@{const_name inverse}, _)$a => Rat.rat_of_quotient(1, HOLogic.dest_number a |> snd)
   715   | Const(@{const_name inverse}, _)$a => Rat.rat_of_quotient(1, HOLogic.dest_number a |> snd)
   716   | t => Rat.rat_of_int (snd (HOLogic.dest_number t))
   716   | t => Rat.rat_of_int (snd (HOLogic.dest_number t))
   717 
   717 
   722          (Thm.apply (Drule.cterm_rule (instantiate' [SOME cT] []) @{cpat "op /"})
   722          (Thm.apply (Drule.cterm_rule (instantiate' [SOME cT] []) @{cpat "op /"})
   723                      (Numeral.mk_cnumber cT a))
   723                      (Numeral.mk_cnumber cT a))
   724          (Numeral.mk_cnumber cT b)
   724          (Numeral.mk_cnumber cT b)
   725  end
   725  end
   726 
   726 
   727 fun whatis x ct = case term_of ct of
   727 fun whatis x ct = case Thm.term_of ct of
   728   Const(@{const_name Groups.plus}, _)$(Const(@{const_name Groups.times},_)$_$y)$_ =>
   728   Const(@{const_name Groups.plus}, _)$(Const(@{const_name Groups.times},_)$_$y)$_ =>
   729      if y aconv term_of x then ("c*x+t",[(funpow 2 Thm.dest_arg1) ct, Thm.dest_arg ct])
   729      if y aconv Thm.term_of x then ("c*x+t",[(funpow 2 Thm.dest_arg1) ct, Thm.dest_arg ct])
   730      else ("Nox",[])
   730      else ("Nox",[])
   731 | Const(@{const_name Groups.plus}, _)$y$_ =>
   731 | Const(@{const_name Groups.plus}, _)$y$_ =>
   732      if y aconv term_of x then ("x+t",[Thm.dest_arg ct])
   732      if y aconv Thm.term_of x then ("x+t",[Thm.dest_arg ct])
   733      else ("Nox",[])
   733      else ("Nox",[])
   734 | Const(@{const_name Groups.times}, _)$_$y =>
   734 | Const(@{const_name Groups.times}, _)$_$y =>
   735      if y aconv term_of x then ("c*x",[Thm.dest_arg1 ct])
   735      if y aconv Thm.term_of x then ("c*x",[Thm.dest_arg1 ct])
   736      else ("Nox",[])
   736      else ("Nox",[])
   737 | t => if t aconv term_of x then ("x",[]) else ("Nox",[]);
   737 | t => if t aconv Thm.term_of x then ("x",[]) else ("Nox",[]);
   738 
   738 
   739 fun xnormalize_conv ctxt [] ct = Thm.reflexive ct
   739 fun xnormalize_conv ctxt [] ct = Thm.reflexive ct
   740 | xnormalize_conv ctxt (vs as (x::_)) ct =
   740 | xnormalize_conv ctxt (vs as (x::_)) ct =
   741    case term_of ct of
   741    case Thm.term_of ct of
   742    Const(@{const_name Orderings.less},_)$_$Const(@{const_name Groups.zero},_) =>
   742    Const(@{const_name Orderings.less},_)$_$Const(@{const_name Groups.zero},_) =>
   743     (case whatis x (Thm.dest_arg1 ct) of
   743     (case whatis x (Thm.dest_arg1 ct) of
   744     ("c*x+t",[c,t]) =>
   744     ("c*x+t",[c,t]) =>
   745        let
   745        let
   746         val cr = dest_frac c
   746         val cr = dest_frac c
   750         val cthp = Simplifier.rewrite ctxt
   750         val cthp = Simplifier.rewrite ctxt
   751                (Thm.apply @{cterm "Trueprop"}
   751                (Thm.apply @{cterm "Trueprop"}
   752                   (if neg then Thm.apply (Thm.apply clt c) cz
   752                   (if neg then Thm.apply (Thm.apply clt c) cz
   753                     else Thm.apply (Thm.apply clt cz) c))
   753                     else Thm.apply (Thm.apply clt cz) c))
   754         val cth = Thm.equal_elim (Thm.symmetric cthp) TrueI
   754         val cth = Thm.equal_elim (Thm.symmetric cthp) TrueI
   755         val th = Thm.implies_elim (instantiate' [SOME (ctyp_of_term x)] (map SOME [c,x,t])
   755         val th = Thm.implies_elim (instantiate' [SOME (Thm.ctyp_of_term x)] (map SOME [c,x,t])
   756              (if neg then @{thm neg_prod_sum_lt} else @{thm pos_prod_sum_lt})) cth
   756              (if neg then @{thm neg_prod_sum_lt} else @{thm pos_prod_sum_lt})) cth
   757         val rth = Conv.fconv_rule (Conv.arg_conv (Conv.binop_conv
   757         val rth = Conv.fconv_rule (Conv.arg_conv (Conv.binop_conv
   758                    (Semiring_Normalizer.semiring_normalize_ord_conv ctxt (earlier vs)))) th
   758                    (Semiring_Normalizer.semiring_normalize_ord_conv ctxt (earlier vs)))) th
   759       in rth end
   759       in rth end
   760     | ("x+t",[t]) =>
   760     | ("x+t",[t]) =>
   761        let
   761        let
   762         val T = ctyp_of_term x
   762         val T = Thm.ctyp_of_term x
   763         val th = instantiate' [SOME T] [SOME x, SOME t] @{thm "sum_lt"}
   763         val th = instantiate' [SOME T] [SOME x, SOME t] @{thm "sum_lt"}
   764         val rth = Conv.fconv_rule (Conv.arg_conv (Conv.binop_conv
   764         val rth = Conv.fconv_rule (Conv.arg_conv (Conv.binop_conv
   765               (Semiring_Normalizer.semiring_normalize_ord_conv ctxt (earlier vs)))) th
   765               (Semiring_Normalizer.semiring_normalize_ord_conv ctxt (earlier vs)))) th
   766        in  rth end
   766        in  rth end
   767     | ("c*x",[c]) =>
   767     | ("c*x",[c]) =>
   773         val cthp = Simplifier.rewrite ctxt
   773         val cthp = Simplifier.rewrite ctxt
   774                (Thm.apply @{cterm "Trueprop"}
   774                (Thm.apply @{cterm "Trueprop"}
   775                   (if neg then Thm.apply (Thm.apply clt c) cz
   775                   (if neg then Thm.apply (Thm.apply clt c) cz
   776                     else Thm.apply (Thm.apply clt cz) c))
   776                     else Thm.apply (Thm.apply clt cz) c))
   777         val cth = Thm.equal_elim (Thm.symmetric cthp) TrueI
   777         val cth = Thm.equal_elim (Thm.symmetric cthp) TrueI
   778         val th = Thm.implies_elim (instantiate' [SOME (ctyp_of_term x)] (map SOME [c,x])
   778         val th = Thm.implies_elim (instantiate' [SOME (Thm.ctyp_of_term x)] (map SOME [c,x])
   779              (if neg then @{thm neg_prod_lt} else @{thm pos_prod_lt})) cth
   779              (if neg then @{thm neg_prod_lt} else @{thm pos_prod_lt})) cth
   780         val rth = th
   780         val rth = th
   781       in rth end
   781       in rth end
   782     | _ => Thm.reflexive ct)
   782     | _ => Thm.reflexive ct)
   783 
   783 
   784 
   784 
   785 |  Const(@{const_name Orderings.less_eq},_)$_$Const(@{const_name Groups.zero},_) =>
   785 |  Const(@{const_name Orderings.less_eq},_)$_$Const(@{const_name Groups.zero},_) =>
   786    (case whatis x (Thm.dest_arg1 ct) of
   786    (case whatis x (Thm.dest_arg1 ct) of
   787     ("c*x+t",[c,t]) =>
   787     ("c*x+t",[c,t]) =>
   788        let
   788        let
   789         val T = ctyp_of_term x
   789         val T = Thm.ctyp_of_term x
   790         val cr = dest_frac c
   790         val cr = dest_frac c
   791         val clt = Drule.cterm_rule (instantiate' [SOME T] []) @{cpat "op <"}
   791         val clt = Drule.cterm_rule (instantiate' [SOME T] []) @{cpat "op <"}
   792         val cz = Thm.dest_arg ct
   792         val cz = Thm.dest_arg ct
   793         val neg = cr </ Rat.zero
   793         val neg = cr </ Rat.zero
   794         val cthp = Simplifier.rewrite ctxt
   794         val cthp = Simplifier.rewrite ctxt
   801         val rth = Conv.fconv_rule (Conv.arg_conv (Conv.binop_conv
   801         val rth = Conv.fconv_rule (Conv.arg_conv (Conv.binop_conv
   802                    (Semiring_Normalizer.semiring_normalize_ord_conv ctxt (earlier vs)))) th
   802                    (Semiring_Normalizer.semiring_normalize_ord_conv ctxt (earlier vs)))) th
   803       in rth end
   803       in rth end
   804     | ("x+t",[t]) =>
   804     | ("x+t",[t]) =>
   805        let
   805        let
   806         val T = ctyp_of_term x
   806         val T = Thm.ctyp_of_term x
   807         val th = instantiate' [SOME T] [SOME x, SOME t] @{thm "sum_le"}
   807         val th = instantiate' [SOME T] [SOME x, SOME t] @{thm "sum_le"}
   808         val rth = Conv.fconv_rule (Conv.arg_conv (Conv.binop_conv
   808         val rth = Conv.fconv_rule (Conv.arg_conv (Conv.binop_conv
   809               (Semiring_Normalizer.semiring_normalize_ord_conv ctxt (earlier vs)))) th
   809               (Semiring_Normalizer.semiring_normalize_ord_conv ctxt (earlier vs)))) th
   810        in  rth end
   810        in  rth end
   811     | ("c*x",[c]) =>
   811     | ("c*x",[c]) =>
   812        let
   812        let
   813         val T = ctyp_of_term x
   813         val T = Thm.ctyp_of_term x
   814         val cr = dest_frac c
   814         val cr = dest_frac c
   815         val clt = Drule.cterm_rule (instantiate' [SOME T] []) @{cpat "op <"}
   815         val clt = Drule.cterm_rule (instantiate' [SOME T] []) @{cpat "op <"}
   816         val cz = Thm.dest_arg ct
   816         val cz = Thm.dest_arg ct
   817         val neg = cr </ Rat.zero
   817         val neg = cr </ Rat.zero
   818         val cthp = Simplifier.rewrite ctxt
   818         val cthp = Simplifier.rewrite ctxt
   819                (Thm.apply @{cterm "Trueprop"}
   819                (Thm.apply @{cterm "Trueprop"}
   820                   (if neg then Thm.apply (Thm.apply clt c) cz
   820                   (if neg then Thm.apply (Thm.apply clt c) cz
   821                     else Thm.apply (Thm.apply clt cz) c))
   821                     else Thm.apply (Thm.apply clt cz) c))
   822         val cth = Thm.equal_elim (Thm.symmetric cthp) TrueI
   822         val cth = Thm.equal_elim (Thm.symmetric cthp) TrueI
   823         val th = Thm.implies_elim (instantiate' [SOME (ctyp_of_term x)] (map SOME [c,x])
   823         val th = Thm.implies_elim (instantiate' [SOME (Thm.ctyp_of_term x)] (map SOME [c,x])
   824              (if neg then @{thm neg_prod_le} else @{thm pos_prod_le})) cth
   824              (if neg then @{thm neg_prod_le} else @{thm pos_prod_le})) cth
   825         val rth = th
   825         val rth = th
   826       in rth end
   826       in rth end
   827     | _ => Thm.reflexive ct)
   827     | _ => Thm.reflexive ct)
   828 
   828 
   829 |  Const(@{const_name HOL.eq},_)$_$Const(@{const_name Groups.zero},_) =>
   829 |  Const(@{const_name HOL.eq},_)$_$Const(@{const_name Groups.zero},_) =>
   830    (case whatis x (Thm.dest_arg1 ct) of
   830    (case whatis x (Thm.dest_arg1 ct) of
   831     ("c*x+t",[c,t]) =>
   831     ("c*x+t",[c,t]) =>
   832        let
   832        let
   833         val T = ctyp_of_term x
   833         val T = Thm.ctyp_of_term x
   834         val cr = dest_frac c
   834         val cr = dest_frac c
   835         val ceq = Thm.dest_fun2 ct
   835         val ceq = Thm.dest_fun2 ct
   836         val cz = Thm.dest_arg ct
   836         val cz = Thm.dest_arg ct
   837         val cthp = Simplifier.rewrite ctxt
   837         val cthp = Simplifier.rewrite ctxt
   838             (Thm.apply @{cterm "Trueprop"}
   838             (Thm.apply @{cterm "Trueprop"}
   843         val rth = Conv.fconv_rule (Conv.arg_conv (Conv.binop_conv
   843         val rth = Conv.fconv_rule (Conv.arg_conv (Conv.binop_conv
   844                    (Semiring_Normalizer.semiring_normalize_ord_conv ctxt (earlier vs)))) th
   844                    (Semiring_Normalizer.semiring_normalize_ord_conv ctxt (earlier vs)))) th
   845       in rth end
   845       in rth end
   846     | ("x+t",[t]) =>
   846     | ("x+t",[t]) =>
   847        let
   847        let
   848         val T = ctyp_of_term x
   848         val T = Thm.ctyp_of_term x
   849         val th = instantiate' [SOME T] [SOME x, SOME t] @{thm "sum_eq"}
   849         val th = instantiate' [SOME T] [SOME x, SOME t] @{thm "sum_eq"}
   850         val rth = Conv.fconv_rule (Conv.arg_conv (Conv.binop_conv
   850         val rth = Conv.fconv_rule (Conv.arg_conv (Conv.binop_conv
   851               (Semiring_Normalizer.semiring_normalize_ord_conv ctxt (earlier vs)))) th
   851               (Semiring_Normalizer.semiring_normalize_ord_conv ctxt (earlier vs)))) th
   852        in  rth end
   852        in  rth end
   853     | ("c*x",[c]) =>
   853     | ("c*x",[c]) =>
   854        let
   854        let
   855         val T = ctyp_of_term x
   855         val T = Thm.ctyp_of_term x
   856         val cr = dest_frac c
   856         val cr = dest_frac c
   857         val ceq = Thm.dest_fun2 ct
   857         val ceq = Thm.dest_fun2 ct
   858         val cz = Thm.dest_arg ct
   858         val cz = Thm.dest_arg ct
   859         val cthp = Simplifier.rewrite ctxt
   859         val cthp = Simplifier.rewrite ctxt
   860             (Thm.apply @{cterm "Trueprop"}
   860             (Thm.apply @{cterm "Trueprop"}
   869   val less_iff_diff_less_0 = mk_meta_eq @{thm "less_iff_diff_less_0"}
   869   val less_iff_diff_less_0 = mk_meta_eq @{thm "less_iff_diff_less_0"}
   870   val le_iff_diff_le_0 = mk_meta_eq @{thm "le_iff_diff_le_0"}
   870   val le_iff_diff_le_0 = mk_meta_eq @{thm "le_iff_diff_le_0"}
   871   val eq_iff_diff_eq_0 = mk_meta_eq @{thm "eq_iff_diff_eq_0"}
   871   val eq_iff_diff_eq_0 = mk_meta_eq @{thm "eq_iff_diff_eq_0"}
   872   val ss = simpset_of @{context}
   872   val ss = simpset_of @{context}
   873 in
   873 in
   874 fun field_isolate_conv phi ctxt vs ct = case term_of ct of
   874 fun field_isolate_conv phi ctxt vs ct = case Thm.term_of ct of
   875   Const(@{const_name Orderings.less},_)$a$b =>
   875   Const(@{const_name Orderings.less},_)$a$b =>
   876    let val (ca,cb) = Thm.dest_binop ct
   876    let val (ca,cb) = Thm.dest_binop ct
   877        val T = ctyp_of_term ca
   877        val T = Thm.ctyp_of_term ca
   878        val th = instantiate' [SOME T] [SOME ca, SOME cb] less_iff_diff_less_0
   878        val th = instantiate' [SOME T] [SOME ca, SOME cb] less_iff_diff_less_0
   879        val nth = Conv.fconv_rule
   879        val nth = Conv.fconv_rule
   880          (Conv.arg_conv (Conv.arg1_conv
   880          (Conv.arg_conv (Conv.arg1_conv
   881               (Semiring_Normalizer.semiring_normalize_ord_conv (put_simpset ss ctxt) (earlier vs)))) th
   881               (Semiring_Normalizer.semiring_normalize_ord_conv (put_simpset ss ctxt) (earlier vs)))) th
   882        val rth = Thm.transitive nth (xnormalize_conv ctxt vs (Thm.rhs_of nth))
   882        val rth = Thm.transitive nth (xnormalize_conv ctxt vs (Thm.rhs_of nth))
   883    in rth end
   883    in rth end
   884 | Const(@{const_name Orderings.less_eq},_)$a$b =>
   884 | Const(@{const_name Orderings.less_eq},_)$a$b =>
   885    let val (ca,cb) = Thm.dest_binop ct
   885    let val (ca,cb) = Thm.dest_binop ct
   886        val T = ctyp_of_term ca
   886        val T = Thm.ctyp_of_term ca
   887        val th = instantiate' [SOME T] [SOME ca, SOME cb] le_iff_diff_le_0
   887        val th = instantiate' [SOME T] [SOME ca, SOME cb] le_iff_diff_le_0
   888        val nth = Conv.fconv_rule
   888        val nth = Conv.fconv_rule
   889          (Conv.arg_conv (Conv.arg1_conv
   889          (Conv.arg_conv (Conv.arg1_conv
   890               (Semiring_Normalizer.semiring_normalize_ord_conv (put_simpset ss ctxt) (earlier vs)))) th
   890               (Semiring_Normalizer.semiring_normalize_ord_conv (put_simpset ss ctxt) (earlier vs)))) th
   891        val rth = Thm.transitive nth (xnormalize_conv ctxt vs (Thm.rhs_of nth))
   891        val rth = Thm.transitive nth (xnormalize_conv ctxt vs (Thm.rhs_of nth))
   892    in rth end
   892    in rth end
   893 
   893 
   894 | Const(@{const_name HOL.eq},_)$a$b =>
   894 | Const(@{const_name HOL.eq},_)$a$b =>
   895    let val (ca,cb) = Thm.dest_binop ct
   895    let val (ca,cb) = Thm.dest_binop ct
   896        val T = ctyp_of_term ca
   896        val T = Thm.ctyp_of_term ca
   897        val th = instantiate' [SOME T] [SOME ca, SOME cb] eq_iff_diff_eq_0
   897        val th = instantiate' [SOME T] [SOME ca, SOME cb] eq_iff_diff_eq_0
   898        val nth = Conv.fconv_rule
   898        val nth = Conv.fconv_rule
   899          (Conv.arg_conv (Conv.arg1_conv
   899          (Conv.arg_conv (Conv.arg1_conv
   900               (Semiring_Normalizer.semiring_normalize_ord_conv (put_simpset ss ctxt) (earlier vs)))) th
   900               (Semiring_Normalizer.semiring_normalize_ord_conv (put_simpset ss ctxt) (earlier vs)))) th
   901        val rth = Thm.transitive nth (xnormalize_conv ctxt vs (Thm.rhs_of nth))
   901        val rth = Thm.transitive nth (xnormalize_conv ctxt vs (Thm.rhs_of nth))
   905 end;
   905 end;
   906 
   906 
   907 fun classfield_whatis phi =
   907 fun classfield_whatis phi =
   908  let
   908  let
   909   fun h x t =
   909   fun h x t =
   910    case term_of t of
   910    case Thm.term_of t of
   911      Const(@{const_name HOL.eq}, _)$y$z => if term_of x aconv y then Ferrante_Rackoff_Data.Eq
   911      Const(@{const_name HOL.eq}, _)$y$z =>
   912                             else Ferrante_Rackoff_Data.Nox
   912       if Thm.term_of x aconv y then Ferrante_Rackoff_Data.Eq
   913    | @{term "Not"}$(Const(@{const_name HOL.eq}, _)$y$z) => if term_of x aconv y then Ferrante_Rackoff_Data.NEq
   913       else Ferrante_Rackoff_Data.Nox
   914                             else Ferrante_Rackoff_Data.Nox
   914    | @{term "Not"}$(Const(@{const_name HOL.eq}, _)$y$z) =>
       
   915       if Thm.term_of x aconv y then Ferrante_Rackoff_Data.NEq
       
   916       else Ferrante_Rackoff_Data.Nox
   915    | Const(@{const_name Orderings.less},_)$y$z =>
   917    | Const(@{const_name Orderings.less},_)$y$z =>
   916        if term_of x aconv y then Ferrante_Rackoff_Data.Lt
   918        if Thm.term_of x aconv y then Ferrante_Rackoff_Data.Lt
   917         else if term_of x aconv z then Ferrante_Rackoff_Data.Gt
   919        else if Thm.term_of x aconv z then Ferrante_Rackoff_Data.Gt
   918         else Ferrante_Rackoff_Data.Nox
   920        else Ferrante_Rackoff_Data.Nox
   919    | Const (@{const_name Orderings.less_eq},_)$y$z =>
   921    | Const (@{const_name Orderings.less_eq},_)$y$z =>
   920          if term_of x aconv y then Ferrante_Rackoff_Data.Le
   922        if Thm.term_of x aconv y then Ferrante_Rackoff_Data.Le
   921          else if term_of x aconv z then Ferrante_Rackoff_Data.Ge
   923        else if Thm.term_of x aconv z then Ferrante_Rackoff_Data.Ge
   922          else Ferrante_Rackoff_Data.Nox
   924        else Ferrante_Rackoff_Data.Nox
   923    | _ => Ferrante_Rackoff_Data.Nox
   925    | _ => Ferrante_Rackoff_Data.Nox
   924  in h end;
   926  in h end;
   925 fun class_field_ss phi =
   927 fun class_field_ss phi =
   926   simpset_of (put_simpset HOL_basic_ss @{context}
   928   simpset_of (put_simpset HOL_basic_ss @{context}
   927     addsimps ([@{thm "linorder_not_less"}, @{thm "linorder_not_le"}])
   929     addsimps ([@{thm "linorder_not_less"}, @{thm "linorder_not_le"}])