src/HOL/Decision_Procs/Dense_Linear_Order.thy
changeset 38549 d0385f2764d8
parent 37120 5df087c6ce94
child 38864 4abe644fcea5
equal deleted inserted replaced
38548:dea0d2cca822 38549:d0385f2764d8
   517 fun generic_whatis phi =
   517 fun generic_whatis phi =
   518  let
   518  let
   519   val [lt, le] = map (Morphism.term phi) [@{term "op \<sqsubset>"}, @{term "op \<sqsubseteq>"}]
   519   val [lt, le] = map (Morphism.term phi) [@{term "op \<sqsubset>"}, @{term "op \<sqsubseteq>"}]
   520   fun h x t =
   520   fun h x t =
   521    case term_of t of
   521    case term_of t of
   522      Const("op =", _)$y$z => if term_of x aconv y then Ferrante_Rackoff_Data.Eq
   522      Const(@{const_name "op ="}, _)$y$z => if term_of x aconv y then Ferrante_Rackoff_Data.Eq
   523                             else Ferrante_Rackoff_Data.Nox
   523                             else Ferrante_Rackoff_Data.Nox
   524    | @{term "Not"}$(Const("op =", _)$y$z) => if term_of x aconv y then Ferrante_Rackoff_Data.NEq
   524    | @{term "Not"}$(Const(@{const_name "op ="}, _)$y$z) => if term_of x aconv y then Ferrante_Rackoff_Data.NEq
   525                             else Ferrante_Rackoff_Data.Nox
   525                             else Ferrante_Rackoff_Data.Nox
   526    | b$y$z => if Term.could_unify (b, lt) then
   526    | b$y$z => if Term.could_unify (b, lt) then
   527                  if term_of x aconv y then Ferrante_Rackoff_Data.Lt
   527                  if term_of x aconv y then Ferrante_Rackoff_Data.Lt
   528                  else if term_of x aconv z then Ferrante_Rackoff_Data.Gt
   528                  else if term_of x aconv z then Ferrante_Rackoff_Data.Gt
   529                  else Ferrante_Rackoff_Data.Nox
   529                  else Ferrante_Rackoff_Data.Nox
   769              (if neg then @{thm neg_prod_le} else @{thm pos_prod_le})) cth
   769              (if neg then @{thm neg_prod_le} else @{thm pos_prod_le})) cth
   770         val rth = th
   770         val rth = th
   771       in rth end
   771       in rth end
   772     | _ => Thm.reflexive ct)
   772     | _ => Thm.reflexive ct)
   773 
   773 
   774 |  Const("op =",_)$_$Const(@{const_name Groups.zero},_) =>
   774 |  Const(@{const_name "op ="},_)$_$Const(@{const_name Groups.zero},_) =>
   775    (case whatis x (Thm.dest_arg1 ct) of
   775    (case whatis x (Thm.dest_arg1 ct) of
   776     ("c*x+t",[c,t]) =>
   776     ("c*x+t",[c,t]) =>
   777        let
   777        let
   778         val T = ctyp_of_term x
   778         val T = ctyp_of_term x
   779         val cr = dest_frac c
   779         val cr = dest_frac c
   833          (Conv.arg_conv (Conv.arg1_conv
   833          (Conv.arg_conv (Conv.arg1_conv
   834               (Semiring_Normalizer.semiring_normalize_ord_conv @{context} (earlier vs)))) th
   834               (Semiring_Normalizer.semiring_normalize_ord_conv @{context} (earlier vs)))) th
   835        val rth = Thm.transitive nth (xnormalize_conv ctxt vs (Thm.rhs_of nth))
   835        val rth = Thm.transitive nth (xnormalize_conv ctxt vs (Thm.rhs_of nth))
   836    in rth end
   836    in rth end
   837 
   837 
   838 | Const("op =",_)$a$b =>
   838 | Const(@{const_name "op ="},_)$a$b =>
   839    let val (ca,cb) = Thm.dest_binop ct
   839    let val (ca,cb) = Thm.dest_binop ct
   840        val T = ctyp_of_term ca
   840        val T = ctyp_of_term ca
   841        val th = instantiate' [SOME T] [SOME ca, SOME cb] eq_iff_diff_eq_0
   841        val th = instantiate' [SOME T] [SOME ca, SOME cb] eq_iff_diff_eq_0
   842        val nth = Conv.fconv_rule
   842        val nth = Conv.fconv_rule
   843          (Conv.arg_conv (Conv.arg1_conv
   843          (Conv.arg_conv (Conv.arg1_conv
   844               (Semiring_Normalizer.semiring_normalize_ord_conv @{context} (earlier vs)))) th
   844               (Semiring_Normalizer.semiring_normalize_ord_conv @{context} (earlier vs)))) th
   845        val rth = Thm.transitive nth (xnormalize_conv ctxt vs (Thm.rhs_of nth))
   845        val rth = Thm.transitive nth (xnormalize_conv ctxt vs (Thm.rhs_of nth))
   846    in rth end
   846    in rth end
   847 | @{term "Not"} $(Const("op =",_)$a$b) => Conv.arg_conv (field_isolate_conv phi ctxt vs) ct
   847 | @{term "Not"} $(Const(@{const_name "op ="},_)$a$b) => Conv.arg_conv (field_isolate_conv phi ctxt vs) ct
   848 | _ => Thm.reflexive ct
   848 | _ => Thm.reflexive ct
   849 end;
   849 end;
   850 
   850 
   851 fun classfield_whatis phi =
   851 fun classfield_whatis phi =
   852  let
   852  let
   853   fun h x t =
   853   fun h x t =
   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(@{const_name "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(@{const_name "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 Orderings.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