# HG changeset patch # User wenzelm # Date 1723987743 -7200 # Node ID ac39d932ddfc6bbddedaa80e97dbc4b8ced8d529 # Parent 1ed073555e6b68fb29d6d069c3e5812437c472b2 tuned: more antiquotations; diff -r 1ed073555e6b -r ac39d932ddfc src/HOL/Tools/int_arith.ML --- a/src/HOL/Tools/int_arith.ML Sun Aug 18 15:21:50 2024 +0200 +++ b/src/HOL/Tools/int_arith.ML Sun Aug 18 15:29:03 2024 +0200 @@ -20,33 +20,32 @@ That is, m and n consist only of 1s combined with "+", "-" and "*". *) -val zeroth = Thm.symmetric (mk_meta_eq @{thm of_int_0}); - val zero_to_of_int_zero_simproc = \<^simproc_setup>\passive zero_to_of_int_zero ("0::'a::ring") = \fn _ => fn _ => fn ct => let val T = Thm.ctyp_of_cterm ct in - if Thm.typ_of T = \<^typ>\int\ then NONE - else SOME (Thm.instantiate' [SOME T] [] zeroth) + if Thm.typ_of T = \<^Type>\int\ then NONE + else SOME \<^instantiate>\'a = T in lemma "0 \ of_int 0" by simp\ end\\; -val oneth = Thm.symmetric (mk_meta_eq @{thm of_int_1}); - val one_to_of_int_one_simproc = \<^simproc_setup>\passive one_to_of_int_one ("1::'a::ring_1") = \fn _ => fn _ => fn ct => let val T = Thm.ctyp_of_cterm ct in - if Thm.typ_of T = \<^typ>\int\ then NONE - else SOME (Thm.instantiate' [SOME T] [] oneth) + if Thm.typ_of T = \<^Type>\int\ then NONE + else SOME \<^instantiate>\'a = T in lemma "1 \ of_int 1" by simp\ end\\; -fun check (Const (\<^const_name>\Groups.one\, \<^typ>\int\)) = false - | check (Const (\<^const_name>\Groups.one\, _)) = true - | check (Const (s, _)) = member (op =) [\<^const_name>\HOL.eq\, - \<^const_name>\Groups.times\, \<^const_name>\Groups.uminus\, - \<^const_name>\Groups.minus\, \<^const_name>\Groups.plus\, - \<^const_name>\Groups.zero\, - \<^const_name>\Orderings.less\, \<^const_name>\Orderings.less_eq\] s +fun check \<^Const_>\Groups.one \<^Type>\int\\ = false + | check \<^Const_>\Groups.one _\ = true + | check \<^Const_>\Groups.zero _\ = true + | check \<^Const_>\HOL.eq _\ = true + | check \<^Const_>\times _\ = true + | check \<^Const_>\uminus _\ = true + | check \<^Const_>\minus _\ = true + | check \<^Const_>\plus _\ = true + | check \<^Const_>\less _\ = true + | check \<^Const_>\less_eq _\ = true | check (a $ b) = check a andalso check b | check _ = false;