# HG changeset patch # User wenzelm # Date 1635504126 -7200 # Node ID 9568db8f48828517fb211e2a1dd879ef42e97fdb # Parent 82ff15b980e9fcf319846c28c0159de978d9c5b4 clarified antiquotations: no need for Thm.beta_conversion, due to Thm.instantiate_beta; diff -r 82ff15b980e9 -r 9568db8f4882 src/HOL/Library/Sum_of_Squares/positivstellensatz.ML --- a/src/HOL/Library/Sum_of_Squares/positivstellensatz.ML Fri Oct 29 12:30:47 2021 +0200 +++ b/src/HOL/Library/Sum_of_Squares/positivstellensatz.ML Fri Oct 29 12:42:06 2021 +0200 @@ -518,26 +518,28 @@ val specl = fold_rev (fn x => fn th => Thm.instantiate' [] [SOME x] (th RS spec)); - fun mk_ex v t = - \<^instantiate>\'a = \Thm.ctyp_of_cterm v\ and P = \Thm.lambda v t\ + fun mk_ex x t = + \<^instantiate>\'a = \Thm.ctyp_of_cterm x\ and P = \Thm.lambda x t\ in cprop \Ex P\ for P :: \'a \ bool\\ - fun choose v th th' = + fun choose x th th' = case Thm.concl_of th of \<^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) - val th0 = fconv_rule (Thm.beta_conversion true) - (Thm.instantiate' [SOME T] [SOME p, (SOME o Thm.dest_arg o Thm.cprop_of) th'] exE) - val pv = (Thm.rhs_of o Thm.beta_conversion true) - (Thm.apply \<^cterm>\Trueprop\ (Thm.apply p v)) - val th1 = Thm.forall_intr v (Thm.implies_intr pv th') + val P = Thm.dest_arg (Thm.dest_arg (Thm.cprop_of th)) + val T = Thm.dest_ctyp0 (Thm.ctyp_of_cterm P) + val Q = Thm.dest_arg (Thm.cprop_of th') + val th0 = + \<^instantiate>\'a = T and P and Q in + lemma "\x::'a. P x \ (\x. P x \ Q) \ Q" by (fact exE)\ + val Px = + \<^instantiate>\'a = T and P and x in cprop \P x\ for x :: 'a\ + val th1 = Thm.forall_intr x (Thm.implies_intr Px th') in Thm.implies_elim (Thm.implies_elim th0 th) th1 end | _ => raise THM ("choose",0,[th, th']) - fun simple_choose v th = - choose v (Thm.assume (mk_ex v (Thm.dest_arg (hd (Thm.chyps_of th))))) th + fun simple_choose x th = + choose x (Thm.assume (mk_ex x (Thm.dest_arg (hd (Thm.chyps_of th))))) th val strip_forall = let