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