src/HOL/Library/Sum_of_Squares_Remote.thy
author wenzelm
Sun Aug 19 17:45:07 2012 +0200 (2012-08-19)
changeset 48932 c6e679443adc
child 48934 f9a800f21434
permissions -rw-r--r--
actual use of (sos remote_csdp) via ISABELLE_FULL_TEST;
     1 (*  Title:      HOL/Library/Sum_of_Squares_Remote.thy
     2     Author:     Amine Chaieb, University of Cambridge
     3     Author:     Philipp Meyer, TU Muenchen
     4 *)
     5 
     6 header {* Examples with remote CSDP *}
     7 
     8 theory Sum_of_Squares_Remote
     9 imports Sum_of_Squares
    10 begin
    11 
    12 lemma "(3::real) * x + 7 * a < 4 & 3 < 2 * x \<Longrightarrow> a < 0"
    13   by (sos remote_csdp)
    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 remote_csdp)
    17 
    18 lemma "(3::real) * x + 7 * a < 4 & 3 < 2 * x --> a < 0"
    19   by (sos remote_csdp)
    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 remote_csdp)
    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 remote_csdp)
    26 
    27 lemma "((x::real)^2 + y^2 + z^2 = 1) --> (x + y + z)^2 <= 3"
    28   by (sos remote_csdp)
    29 
    30 lemma "(w^2 + x^2 + y^2 + z^2 = 1) --> (w + x + y + z)^2 <= (4::real)"
    31   by (sos remote_csdp)
    32 
    33 lemma "(x::real) >= 1 & y >= 1 --> x * y >= x + y - 1"
    34   by (sos remote_csdp)
    35 
    36 lemma "(x::real) > 1 & y > 1 --> x * y > x + y - 1"
    37   by (sos remote_csdp)
    38 
    39 lemma "abs(x) <= 1 --> abs(64 * x^7 - 112 * x^5 + 56 * x^3 - 7 * x) <= (1::real)"
    40   by (sos remote_csdp)
    41 
    42 (* ------------------------------------------------------------------------- *)
    43 (* One component of denominator in dodecahedral example.                     *)
    44 (* ------------------------------------------------------------------------- *)
    45 
    46 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)"
    47   by (sos remote_csdp)
    48 
    49 (* ------------------------------------------------------------------------- *)
    50 (* Over a larger but simpler interval.                                       *)
    51 (* ------------------------------------------------------------------------- *)
    52 
    53 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)"
    54   by (sos remote_csdp)
    55 
    56 (* ------------------------------------------------------------------------- *)
    57 (* We can do 12. I think 12 is a sharp bound; see PP's certificate.          *)
    58 (* ------------------------------------------------------------------------- *)
    59 
    60 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)"
    61   by (sos remote_csdp)
    62 
    63 (* ------------------------------------------------------------------------- *)
    64 (* Inequality from sci.math (see "Leon-Sotelo, por favor").                  *)
    65 (* ------------------------------------------------------------------------- *)
    66 
    67 lemma "0 <= (x::real) & 0 <= y & (x * y = 1) --> x + y <= x^2 + y^2"
    68   by (sos remote_csdp)
    69 
    70 lemma "0 <= (x::real) & 0 <= y & (x * y = 1) --> x * y * (x + y) <= x^2 + y^2"
    71   by (sos remote_csdp)
    72 
    73 lemma "0 <= (x::real) & 0 <= y --> x * y * (x + y)^2 <= (x^2 + y^2)^2"
    74   by (sos remote_csdp)
    75 
    76 lemma "(0::real) <= a & 0 <= b & 0 <= c & c * (2 * a + b)^3/ 27 <= x \<longrightarrow> c * a^2 * b <= x"
    77   by (sos remote_csdp)
    78 
    79 lemma "(0::real) < x --> 0 < 1 + x + x^2"
    80   by (sos remote_csdp)
    81 
    82 lemma "(0::real) <= x --> 0 < 1 + x + x^2"
    83   by (sos remote_csdp)
    84 
    85 lemma "(0::real) < 1 + x^2"
    86   by (sos remote_csdp)
    87 
    88 lemma "(0::real) <= 1 + 2 * x + x^2"
    89   by (sos remote_csdp)
    90 
    91 lemma "(0::real) < 1 + abs x"
    92   by (sos remote_csdp)
    93 
    94 lemma "(0::real) < 1 + (1 + x)^2 * (abs x)"
    95   by (sos remote_csdp)
    96 
    97 
    98 
    99 lemma "abs ((1::real) + x^2) = (1::real) + x^2"
   100   by (sos remote_csdp)
   101 lemma "(3::real) * x + 7 * a < 4 \<and> 3 < 2 * x \<longrightarrow> a < 0"
   102   by (sos remote_csdp)
   103 
   104 lemma "(0::real) < x --> 1 < y --> y * x <= z --> x < z"
   105   by (sos remote_csdp)
   106 lemma "(1::real) < x --> x^2 < y --> 1 < y"
   107   by (sos remote_csdp)
   108 lemma "(b::real)^2 < 4 * a * c --> ~(a * x^2 + b * x + c = 0)"
   109   by (sos remote_csdp)
   110 lemma "(b::real)^2 < 4 * a * c --> ~(a * x^2 + b * x + c = 0)"
   111   by (sos remote_csdp)
   112 lemma "((a::real) * x^2 + b * x + c = 0) --> b^2 >= 4 * a * c"
   113   by (sos remote_csdp)
   114 lemma "(0::real) <= b & 0 <= c & 0 <= x & 0 <= y & (x^2 = c) & (y^2 = a^2 * c + b) --> a * c <= y * x"
   115   by (sos remote_csdp)
   116 lemma "abs(x - z) <= e & abs(y - z) <= e & 0 <= u & 0 <= v & (u + v = 1) --> abs((u * x + v * y) - z) <= (e::real)"
   117   by (sos remote_csdp)
   118 
   119 
   120 (* 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?*)
   121 
   122 lemma "(0::real) <= x --> (1 + x + x^2)/(1 + x^2) <= 1 + x"
   123   by (sos remote_csdp)
   124 
   125 lemma "(0::real) <= x --> 1 - x <= 1 / (1 + x + x^2)"
   126   by (sos remote_csdp)
   127 
   128 lemma "(x::real) <= 1 / 2 --> - x - 2 * x^2 <= - x / (1 - x)"
   129   by (sos remote_csdp)
   130 
   131 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"
   132   by (sos remote_csdp)
   133 
   134 end