src/HOL/ex/SOS.thy
author haftmann
Fri Oct 10 19:55:32 2014 +0200 (2014-10-10)
changeset 58646 cd63a4b12a33
parent 58630 71cdb885b3bb
child 61156 931b732617a2
permissions -rw-r--r--
specialized specification: avoid trivial instances
     1 (*  Title:      HOL/ex/SOS.thy
     2     Author:     Amine Chaieb, University of Cambridge
     3     Author:     Philipp Meyer, TU Muenchen
     4 
     5 Examples for Sum_of_Squares.
     6 *)
     7 
     8 theory SOS
     9 imports "~~/src/HOL/Library/Sum_of_Squares"
    10 begin
    11 
    12 lemma "(3::real) * x + 7 * a < 4 & 3 < 2 * x \<Longrightarrow> a < 0"
    13   by sos
    14 
    15 lemma "a1 >= 0 & a2 >= 0 \<and> (a1 * a1 + a2 * a2 = b1 * b1 + b2 * b2 + 2) \<and> (a1 * b1 + a2 * b2 = 0) --> a1 * a2 - b1 * b2 >= (0::real)"
    16   by sos
    17 
    18 lemma "(3::real) * x + 7 * a < 4 & 3 < 2 * x --> a < 0"
    19   by sos
    20 
    21 lemma "(0::real) <= x & x <= 1 & 0 <= y & y <= 1  --> x^2 + y^2 < 1 |(x - 1)^2 + y^2 < 1 | x^2 + (y - 1)^2 < 1 | (x - 1)^2 + (y - 1)^2 < 1"
    22   by sos
    23 
    24 lemma "(0::real) <= x & 0 <= y & 0 <= z & x + y + z <= 3 --> x * y + x * z + y * z >= 3 * x * y * z"
    25   by sos
    26 
    27 lemma "((x::real)^2 + y^2 + z^2 = 1) --> (x + y + z)^2 <= 3"
    28   by sos
    29 
    30 lemma "(w^2 + x^2 + y^2 + z^2 = 1) --> (w + x + y + z)^2 <= (4::real)"
    31   by sos
    32 
    33 lemma "(x::real) >= 1 & y >= 1 --> x * y >= x + y - 1"
    34   by sos
    35 
    36 lemma "(x::real) > 1 & y > 1 --> x * y > x + y - 1"
    37   by sos
    38 
    39 lemma "abs(x) <= 1 --> abs(64 * x^7 - 112 * x^5 + 56 * x^3 - 7 * x) <= (1::real)"
    40   by sos
    41 
    42 
    43 text \<open>One component of denominator in dodecahedral example.\<close>
    44 
    45 lemma "2 <= x & x <= 125841 / 50000 & 2 <= y & y <= 125841 / 50000 & 2 <= z & z <= 125841 / 50000 --> 2 * (x * z + x * y + y * z) - (x * x + y * y + z * z) >= (0::real)"
    46   by sos
    47 
    48 
    49 text \<open>Over a larger but simpler interval.\<close>
    50 
    51 lemma "(2::real) <= x & x <= 4 & 2 <= y & y <= 4 & 2 <= z & z <= 4 --> 0 <= 2 * (x * z + x * y + y * z) - (x * x + y * y + z * z)"
    52   by sos
    53 
    54 
    55 text \<open>We can do 12. I think 12 is a sharp bound; see PP's certificate.\<close>
    56 
    57 lemma "2 <= (x::real) & x <= 4 & 2 <= y & y <= 4 & 2 <= z & z <= 4 --> 12 <= 2 * (x * z + x * y + y * z) - (x * x + y * y + z * z)"
    58   by sos
    59 
    60 
    61 text \<open>Inequality from sci.math (see "Leon-Sotelo, por favor").\<close>
    62 
    63 lemma "0 <= (x::real) & 0 <= y & (x * y = 1) --> x + y <= x^2 + y^2"
    64   by sos
    65 
    66 lemma "0 <= (x::real) & 0 <= y & (x * y = 1) --> x * y * (x + y) <= x^2 + y^2"
    67   by sos
    68 
    69 lemma "0 <= (x::real) & 0 <= y --> x * y * (x + y)^2 <= (x^2 + y^2)^2"
    70   by sos
    71 
    72 lemma "(0::real) <= a & 0 <= b & 0 <= c & c * (2 * a + b)^3/ 27 <= x \<longrightarrow> c * a^2 * b <= x"
    73   by sos
    74 
    75 lemma "(0::real) < x --> 0 < 1 + x + x^2"
    76   by sos
    77 
    78 lemma "(0::real) <= x --> 0 < 1 + x + x^2"
    79   by sos
    80 
    81 lemma "(0::real) < 1 + x^2"
    82   by sos
    83 
    84 lemma "(0::real) <= 1 + 2 * x + x^2"
    85   by sos
    86 
    87 lemma "(0::real) < 1 + abs x"
    88   by sos
    89 
    90 lemma "(0::real) < 1 + (1 + x)^2 * (abs x)"
    91   by sos
    92 
    93 
    94 lemma "abs ((1::real) + x^2) = (1::real) + x^2"
    95   by sos
    96 lemma "(3::real) * x + 7 * a < 4 \<and> 3 < 2 * x \<longrightarrow> a < 0"
    97   by sos
    98 
    99 lemma "(0::real) < x --> 1 < y --> y * x <= z --> x < z"
   100   by sos
   101 lemma "(1::real) < x --> x^2 < y --> 1 < y"
   102   by sos
   103 lemma "(b::real)^2 < 4 * a * c --> ~(a * x^2 + b * x + c = 0)"
   104   by sos
   105 lemma "(b::real)^2 < 4 * a * c --> ~(a * x^2 + b * x + c = 0)"
   106   by sos
   107 lemma "((a::real) * x^2 + b * x + c = 0) --> b^2 >= 4 * a * c"
   108   by sos
   109 lemma "(0::real) <= b & 0 <= c & 0 <= x & 0 <= y & (x^2 = c) & (y^2 = a^2 * c + b) --> a * c <= y * x"
   110   by sos
   111 lemma "abs(x - z) <= e & abs(y - z) <= e & 0 <= u & 0 <= v & (u + v = 1) --> abs((u * x + v * y) - z) <= (e::real)"
   112   by sos
   113 
   114 
   115 (* lemma "((x::real) - y - 2 * x^4 = 0) & 0 <= x & x <= 2 & 0 <= y & y <= 3 --> y^2 - 7 * y - 12 * x + 17 >= 0" by sos *) (* Too hard?*)
   116 
   117 lemma "(0::real) <= x --> (1 + x + x^2)/(1 + x^2) <= 1 + x"
   118   by sos
   119 
   120 lemma "(0::real) <= x --> 1 - x <= 1 / (1 + x + x^2)"
   121   by sos
   122 
   123 lemma "(x::real) <= 1 / 2 --> - x - 2 * x^2 <= - x / (1 - x)"
   124   by sos
   125 
   126 lemma "4*r^2 = p^2 - 4*q & r >= (0::real) & x^2 + p*x + q = 0 --> 2*(x::real) = - p + 2*r | 2*x = -p - 2*r"
   127   by sos
   128 
   129 end
   130