src/HOL/Library/Sum_of_Squares/positivstellensatz.ML
changeset 74617 08b186726ea0
parent 74616 997a605b37a9
child 74621 82ff15b980e9
equal deleted inserted replaced
74616:997a605b37a9 74617:08b186726ea0
   256   "((a + min x y + b > r) = (a + x + b > r \<and> a + y  + b > r))" and
   256   "((a + min x y + b > r) = (a + x + b > r \<and> a + y  + b > r))" and
   257   "((a + b + min x y > r) = (a + b + x > r \<and> a + b + y > r))" and
   257   "((a + b + min x y > r) = (a + b + x > r \<and> a + b + y > r))" and
   258   "((a + b + min x y + c > r) = (a + b + x + c > r \<and> a + b + y + c > r))"
   258   "((a + b + min x y + c > r) = (a + b + x + c > r \<and> a + b + y + c > r))"
   259   by auto};
   259   by auto};
   260 
   260 
   261 val abs_split' = @{lemma "P \<bar>x::'a::linordered_idom\<bar> == (x \<ge> 0 \<and> P x \<or> x < 0 \<and> P (-x))"
   261 val pth_abs =
   262   by (atomize (full)) (auto split: abs_split)};
   262   @{lemma "P \<bar>x\<bar> \<equiv> (x \<ge> 0 \<and> P x \<or> x < 0 \<and> P (-x))" for x :: real
   263 
   263     by (atomize (full)) (auto split: abs_split)}
   264 val max_split = @{lemma "P (max x y) \<equiv> ((x::'a::linorder) \<le> y \<and> P y \<or> x > y \<and> P x)"
   264 
   265   by (atomize (full)) (cases "x \<le> y", auto simp add: max_def)};
   265 val pth_max =
   266 
   266   @{lemma "P (max x y) \<equiv> (x \<le> y \<and> P y \<or> x > y \<and> P x)" for x y :: real
   267 val min_split = @{lemma "P (min x y) \<equiv> ((x::'a::linorder) \<le> y \<and> P x \<or> x > y \<and> P y)"
   267     by (atomize (full)) (auto simp add: max_def)}
   268   by (atomize (full)) (cases "x \<le> y", auto simp add: min_def)};
   268 
   269 
   269 val pth_min =
   270 
   270   @{lemma "P (min x y) \<equiv> (x \<le> y \<and> P x \<or> x > y \<and> P y)" for x y :: real
   271          (* Miscellaneous *)
   271     by (atomize (full)) (auto simp add: min_def)}
       
   272 
       
   273 (* Miscellaneous *)
   272 fun literals_conv bops uops cv =
   274 fun literals_conv bops uops cv =
   273   let
   275   let
   274     fun h t =
   276     fun h t =
   275       (case Thm.term_of t of
   277       (case Thm.term_of t of
   276         b$_$_ => if member (op aconv) bops b then binop_conv h t else cv t
   278         b$_$_ => if member (op aconv) bops b then binop_conv h t else cv t
   720   fun absmaxmin_elim_conv1 ctxt =
   722   fun absmaxmin_elim_conv1 ctxt =
   721     Simplifier.rewrite (put_simpset absmaxmin_elim_ss1 ctxt)
   723     Simplifier.rewrite (put_simpset absmaxmin_elim_ss1 ctxt)
   722 
   724 
   723   val absmaxmin_elim_conv2 =
   725   val absmaxmin_elim_conv2 =
   724     let
   726     let
   725       val pth_abs = Thm.instantiate' [SOME \<^ctyp>\<open>real\<close>] [] abs_split'
       
   726       val pth_max = Thm.instantiate' [SOME \<^ctyp>\<open>real\<close>] [] max_split
       
   727       val pth_min = Thm.instantiate' [SOME \<^ctyp>\<open>real\<close>] [] min_split
       
   728       val p_v = (("P", 0), \<^typ>\<open>real \<Rightarrow> bool\<close>)
   727       val p_v = (("P", 0), \<^typ>\<open>real \<Rightarrow> bool\<close>)
   729       val x_v = (("x", 0), \<^typ>\<open>real\<close>)
   728       val x_v = (("x", 0), \<^typ>\<open>real\<close>)
   730       val y_v = (("y", 0), \<^typ>\<open>real\<close>)
   729       val y_v = (("y", 0), \<^typ>\<open>real\<close>)
   731       fun is_abs \<^Const_>\<open>abs \<^Type>\<open>real\<close> for _\<close> = true
   730       fun is_abs \<^Const_>\<open>abs \<^Type>\<open>real\<close> for _\<close> = true
   732         | is_abs _ = false
   731         | is_abs _ = false