# HG changeset patch # User wenzelm # Date 1723984849 -7200 # Node ID 41cdf0fb32fa4c6fa516622d29c6324ad10df952 # Parent f3c9203d82c3e5cf3e78c7416fb416fa25faba9f tuned: more antiquotations; diff -r f3c9203d82c3 -r 41cdf0fb32fa src/HOL/Tools/groebner.ML --- a/src/HOL/Tools/groebner.ML Sun Aug 18 14:22:21 2024 +0200 +++ b/src/HOL/Tools/groebner.ML Sun Aug 18 14:40:49 2024 +0200 @@ -349,23 +349,23 @@ fun refute_disj rfn tm = case Thm.term_of tm of - Const(\<^const_name>\HOL.disj\,_)$_$_ => + \<^Const_>\disj for _ _\ => Drule.compose (refute_disj rfn (Thm.dest_arg tm), 2, Drule.compose (refute_disj rfn (Thm.dest_arg1 tm), 2, disjE)) | _ => rfn tm ; -val notnotD = @{thm notnotD}; fun mk_binop ct x y = Thm.apply (Thm.apply ct x) y fun is_neg t = - case Thm.term_of t of - (Const(\<^const_name>\Not\,_)$_) => true - | _ => false; + case Thm.term_of t of + \<^Const_>\Not for _\ => true + | _ => false; + fun is_eq t = - case Thm.term_of t of - (Const(\<^const_name>\HOL.eq\,_)$_$_) => true -| _ => false; + case Thm.term_of t of + \<^Const_>\HOL.eq _ for _ _\ => true + | _ => false; fun end_itlist f l = case l of @@ -392,9 +392,9 @@ end; fun is_forall t = - case Thm.term_of t of - (Const(\<^const_name>\All\,_)$Abs(_,_,_)) => true -| _ => false; + case Thm.term_of t of + \<^Const_>\All _ for \Abs _\\ => true + | _ => false; val nnf_simps = @{thms nnf_simps}; @@ -436,21 +436,21 @@ (* FIXME : copied from cqe.ML -- complex QE*) fun conjuncts ct = - case Thm.term_of ct of - \<^term>\HOL.conj\$_$_ => (Thm.dest_arg1 ct)::(conjuncts (Thm.dest_arg ct)) -| _ => [ct]; + case Thm.term_of ct of + \<^Const_>\conj for _ _\ => (Thm.dest_arg1 ct)::(conjuncts (Thm.dest_arg ct)) + | _ => [ct]; fun fold1 f = foldr1 (uncurry f); fun mk_conj_tab th = - let fun h acc th = - case Thm.prop_of th of - \<^term>\Trueprop\$(\<^term>\HOL.conj\$_$_) => - h (h acc (th RS conjunct2)) (th RS conjunct1) - | \<^term>\Trueprop\$p => (p,th)::acc -in fold (Termtab.insert Thm.eq_thm) (h [] th) Termtab.empty end; + let fun h acc th = + case Thm.prop_of th of + \<^Const_>\Trueprop for \<^Const_>\conj for _ _\\ => + h (h acc (th RS conjunct2)) (th RS conjunct1) + | \<^Const_>\Trueprop for p\ => (p,th)::acc + in fold (Termtab.insert Thm.eq_thm) (h [] th) Termtab.empty end; -fun is_conj (\<^term>\HOL.conj\$_$_) = true +fun is_conj \<^Const_>\conj for _ _\ = true | is_conj _ = false; fun prove_conj tab cjs = @@ -474,11 +474,11 @@ (* Conversion for the equivalence of existential statements where EX quantifiers are rearranged differently *) -fun ext ctxt T = Thm.cterm_of ctxt (Const (\<^const_name>\Ex\, (T --> \<^typ>\bool\) --> \<^typ>\bool\)) +fun ext ctxt T = Thm.cterm_of ctxt \<^Const>\Ex T\ fun mk_ex ctxt v t = Thm.apply (ext ctxt (Thm.typ_of_cterm v)) (Thm.lambda v t) fun choose v th th' = case Thm.concl_of th of - \<^term>\Trueprop\ $ (Const(\<^const_name>\Ex\,_)$_) => + \<^Const_>\Trueprop for \<^Const_>\Ex _ for _\\ => let val p = (funpow 2 Thm.dest_arg o Thm.cprop_of) th val T = Thm.dest_ctyp0 (Thm.ctyp_of_cterm p) @@ -488,7 +488,7 @@ (Thm.apply \<^cterm>\Trueprop\ (Thm.apply p v)) val th1 = Thm.forall_intr v (Thm.implies_intr pv th') in Thm.implies_elim (Thm.implies_elim th0 th) th1 end -| _ => error "" (* FIXME ? *) + | _ => error "" (* FIXME ? *) fun simple_choose ctxt v th = choose v (Thm.assume ((Thm.apply \<^cterm>\Trueprop\ o mk_ex ctxt v) @@ -734,7 +734,7 @@ fun mk_forall x p = let val T = Thm.typ_of_cterm x; - val all = Thm.cterm_of ctxt (Const (\<^const_name>\All\, (T --> \<^typ>\bool\) --> \<^typ>\bool\)) + val all = Thm.cterm_of ctxt \<^Const>\All T\ in Thm.apply all (Thm.lambda x p) end val avs = Cterms.build (Drule.add_frees_cterm tm) val P' = fold mk_forall (Cterms.list_set_rev avs) tm @@ -753,7 +753,7 @@ (Simplifier.rewrite (put_simpset HOL_basic_ss ctxt addsimps [not_ex RS sym]) (th2 |> Thm.cprop_of)) th2 in specl (Cterms.list_set_rev avs) - ([[[HOLogic.mk_obj_eq th1, th3 RS PFalse'] MRS trans] MRS PFalse] MRS notnotD) + ([[[HOLogic.mk_obj_eq th1, th3 RS PFalse'] MRS trans] MRS PFalse] MRS @{thm notnotD}) end end fun ideal tms tm ord = @@ -890,18 +890,18 @@ fun find_term tm ctxt = (case Thm.term_of tm of - Const (\<^const_name>\HOL.eq\, T) $ _ $ _ => - if domain_type T = HOLogic.boolT then find_args tm ctxt + \<^Const_>\HOL.eq T for _ _\ => + if T = \<^Type>\bool\ then find_args tm ctxt else (Thm.dest_arg tm, ctxt) - | Const (\<^const_name>\Not\, _) $ _ => find_term (Thm.dest_arg tm) ctxt - | Const (\<^const_name>\All\, _) $ _ => find_body (Thm.dest_arg tm) ctxt - | Const (\<^const_name>\Ex\, _) $ _ => find_body (Thm.dest_arg tm) ctxt - | Const (\<^const_name>\HOL.conj\, _) $ _ $ _ => find_args tm ctxt - | Const (\<^const_name>\HOL.disj\, _) $ _ $ _ => find_args tm ctxt - | Const (\<^const_name>\HOL.implies\, _) $ _ $ _ => find_args tm ctxt - | \<^term>\Pure.imp\ $_$_ => find_args tm ctxt + | \<^Const_>\Not for _\ => find_term (Thm.dest_arg tm) ctxt + | \<^Const_>\All _ for _\ => find_body (Thm.dest_arg tm) ctxt + | \<^Const_>\Ex _ for _\ => find_body (Thm.dest_arg tm) ctxt + | \<^Const_>\conj for _ _\ => find_args tm ctxt + | \<^Const_>\disj for _ _\ => find_args tm ctxt + | \<^Const_>\implies for _ _\ => find_args tm ctxt + | \<^Const_>\Pure.imp for _ _\ => find_args tm ctxt | Const("(==)",_)$_$_ => find_args tm ctxt (* FIXME proper const name *) - | \<^term>\Trueprop\$_ => find_term (Thm.dest_arg tm) ctxt + | \<^Const_>\Trueprop for _\ => find_term (Thm.dest_arg tm) ctxt | _ => raise TERM ("find_term", [])) and find_args tm ctxt = let val (t, u) = Thm.dest_binop tm @@ -942,9 +942,11 @@ | THM _ => no_tac); local - fun lhs t = case Thm.term_of t of - Const(\<^const_name>\HOL.eq\,_)$_$_ => Thm.dest_arg1 t - | _=> raise CTERM ("ideal_tac - lhs",[t]) + fun lhs t = + case Thm.term_of t of + \<^Const_>\HOL.eq _ for _ _\ => Thm.dest_arg1 t + | _=> raise CTERM ("ideal_tac - lhs",[t]) + fun exitac _ NONE = no_tac | exitac ctxt (SOME y) = resolve_tac ctxt [Thm.instantiate' [SOME (Thm.ctyp_of_cterm y)] [NONE,SOME y] exI] 1 diff -r f3c9203d82c3 -r 41cdf0fb32fa src/HOL/Tools/semiring_normalizer.ML --- a/src/HOL/Tools/semiring_normalizer.ML Sun Aug 18 14:22:21 2024 +0200 +++ b/src/HOL/Tools/semiring_normalizer.ML Sun Aug 18 14:40:49 2024 +0200 @@ -128,17 +128,17 @@ let fun numeral_is_const ct = case Thm.term_of ct of - Const (\<^const_name>\Rings.divide\,_) $ a $ b => - can HOLogic.dest_number a andalso can HOLogic.dest_number b - | Const (\<^const_name>\Fields.inverse\,_)$t => can HOLogic.dest_number t - | t => can HOLogic.dest_number t - fun dest_const ct = ((case Thm.term_of ct of - Const (\<^const_name>\Rings.divide\,_) $ a $ b=> - Rat.make (snd (HOLogic.dest_number a), snd (HOLogic.dest_number b)) - | Const (\<^const_name>\Fields.inverse\,_)$t => - Rat.inv (Rat.of_int (snd (HOLogic.dest_number t))) - | t => Rat.of_int (snd (HOLogic.dest_number t))) - handle TERM _ => error "ring_dest_const") + \<^Const_>\divide _ for a b\ => + can HOLogic.dest_number a andalso can HOLogic.dest_number b + | \<^Const_>\inverse _ for t\ => can HOLogic.dest_number t + | t => can HOLogic.dest_number t + fun dest_const ct = + (case Thm.term_of ct of + \<^Const_>\divide _ for a b\ => + Rat.make (snd (HOLogic.dest_number a), snd (HOLogic.dest_number b)) + | \<^Const_>\inverse _ for t\ => Rat.inv (Rat.of_int (snd (HOLogic.dest_number t))) + | t => Rat.of_int (snd (HOLogic.dest_number t))) + handle TERM _ => error "ring_dest_const" fun mk_const cT x = let val (a, b) = Rat.dest x in if b = 1 then Numeral.mk_cnumber cT a