src/HOL/Library/Sum_of_Squares_Remote.thy
 changeset 48932 c6e679443adc child 48934 f9a800f21434
```     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/HOL/Library/Sum_of_Squares_Remote.thy	Sun Aug 19 17:45:07 2012 +0200
1.3 @@ -0,0 +1,134 @@
1.4 +(*  Title:      HOL/Library/Sum_of_Squares_Remote.thy
1.5 +    Author:     Amine Chaieb, University of Cambridge
1.6 +    Author:     Philipp Meyer, TU Muenchen
1.7 +*)
1.8 +
1.9 +header {* Examples with remote CSDP *}
1.10 +
1.11 +theory Sum_of_Squares_Remote
1.12 +imports Sum_of_Squares
1.13 +begin
1.14 +
1.15 +lemma "(3::real) * x + 7 * a < 4 & 3 < 2 * x \<Longrightarrow> a < 0"
1.16 +  by (sos remote_csdp)
1.17 +
1.18 +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)"
1.19 +  by (sos remote_csdp)
1.20 +
1.21 +lemma "(3::real) * x + 7 * a < 4 & 3 < 2 * x --> a < 0"
1.22 +  by (sos remote_csdp)
1.23 +
1.24 +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"
1.25 +  by (sos remote_csdp)
1.26 +
1.27 +lemma "(0::real) <= x & 0 <= y & 0 <= z & x + y + z <= 3 --> x * y + x * z + y * z >= 3 * x * y * z"
1.28 +  by (sos remote_csdp)
1.29 +
1.30 +lemma "((x::real)^2 + y^2 + z^2 = 1) --> (x + y + z)^2 <= 3"
1.31 +  by (sos remote_csdp)
1.32 +
1.33 +lemma "(w^2 + x^2 + y^2 + z^2 = 1) --> (w + x + y + z)^2 <= (4::real)"
1.34 +  by (sos remote_csdp)
1.35 +
1.36 +lemma "(x::real) >= 1 & y >= 1 --> x * y >= x + y - 1"
1.37 +  by (sos remote_csdp)
1.38 +
1.39 +lemma "(x::real) > 1 & y > 1 --> x * y > x + y - 1"
1.40 +  by (sos remote_csdp)
1.41 +
1.42 +lemma "abs(x) <= 1 --> abs(64 * x^7 - 112 * x^5 + 56 * x^3 - 7 * x) <= (1::real)"
1.43 +  by (sos remote_csdp)
1.44 +
1.45 +(* ------------------------------------------------------------------------- *)
1.46 +(* One component of denominator in dodecahedral example.                     *)
1.47 +(* ------------------------------------------------------------------------- *)
1.48 +
1.49 +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)"
1.50 +  by (sos remote_csdp)
1.51 +
1.52 +(* ------------------------------------------------------------------------- *)
1.53 +(* Over a larger but simpler interval.                                       *)
1.54 +(* ------------------------------------------------------------------------- *)
1.55 +
1.56 +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)"
1.57 +  by (sos remote_csdp)
1.58 +
1.59 +(* ------------------------------------------------------------------------- *)
1.60 +(* We can do 12. I think 12 is a sharp bound; see PP's certificate.          *)
1.61 +(* ------------------------------------------------------------------------- *)
1.62 +
1.63 +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)"
1.64 +  by (sos remote_csdp)
1.65 +
1.66 +(* ------------------------------------------------------------------------- *)
1.67 +(* Inequality from sci.math (see "Leon-Sotelo, por favor").                  *)
1.68 +(* ------------------------------------------------------------------------- *)
1.69 +
1.70 +lemma "0 <= (x::real) & 0 <= y & (x * y = 1) --> x + y <= x^2 + y^2"
1.71 +  by (sos remote_csdp)
1.72 +
1.73 +lemma "0 <= (x::real) & 0 <= y & (x * y = 1) --> x * y * (x + y) <= x^2 + y^2"
1.74 +  by (sos remote_csdp)
1.75 +
1.76 +lemma "0 <= (x::real) & 0 <= y --> x * y * (x + y)^2 <= (x^2 + y^2)^2"
1.77 +  by (sos remote_csdp)
1.78 +
1.79 +lemma "(0::real) <= a & 0 <= b & 0 <= c & c * (2 * a + b)^3/ 27 <= x \<longrightarrow> c * a^2 * b <= x"
1.80 +  by (sos remote_csdp)
1.81 +
1.82 +lemma "(0::real) < x --> 0 < 1 + x + x^2"
1.83 +  by (sos remote_csdp)
1.84 +
1.85 +lemma "(0::real) <= x --> 0 < 1 + x + x^2"
1.86 +  by (sos remote_csdp)
1.87 +
1.88 +lemma "(0::real) < 1 + x^2"
1.89 +  by (sos remote_csdp)
1.90 +
1.91 +lemma "(0::real) <= 1 + 2 * x + x^2"
1.92 +  by (sos remote_csdp)
1.93 +
1.94 +lemma "(0::real) < 1 + abs x"
1.95 +  by (sos remote_csdp)
1.96 +
1.97 +lemma "(0::real) < 1 + (1 + x)^2 * (abs x)"
1.98 +  by (sos remote_csdp)
1.99 +
1.100 +
1.101 +
1.102 +lemma "abs ((1::real) + x^2) = (1::real) + x^2"
1.103 +  by (sos remote_csdp)
1.104 +lemma "(3::real) * x + 7 * a < 4 \<and> 3 < 2 * x \<longrightarrow> a < 0"
1.105 +  by (sos remote_csdp)
1.106 +
1.107 +lemma "(0::real) < x --> 1 < y --> y * x <= z --> x < z"
1.108 +  by (sos remote_csdp)
1.109 +lemma "(1::real) < x --> x^2 < y --> 1 < y"
1.110 +  by (sos remote_csdp)
1.111 +lemma "(b::real)^2 < 4 * a * c --> ~(a * x^2 + b * x + c = 0)"
1.112 +  by (sos remote_csdp)
1.113 +lemma "(b::real)^2 < 4 * a * c --> ~(a * x^2 + b * x + c = 0)"
1.114 +  by (sos remote_csdp)
1.115 +lemma "((a::real) * x^2 + b * x + c = 0) --> b^2 >= 4 * a * c"
1.116 +  by (sos remote_csdp)
1.117 +lemma "(0::real) <= b & 0 <= c & 0 <= x & 0 <= y & (x^2 = c) & (y^2 = a^2 * c + b) --> a * c <= y * x"
1.118 +  by (sos remote_csdp)
1.119 +lemma "abs(x - z) <= e & abs(y - z) <= e & 0 <= u & 0 <= v & (u + v = 1) --> abs((u * x + v * y) - z) <= (e::real)"
1.120 +  by (sos remote_csdp)
1.121 +
1.122 +
1.123 +(* 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?*)
1.124 +
1.125 +lemma "(0::real) <= x --> (1 + x + x^2)/(1 + x^2) <= 1 + x"
1.126 +  by (sos remote_csdp)
1.127 +
1.128 +lemma "(0::real) <= x --> 1 - x <= 1 / (1 + x + x^2)"
1.129 +  by (sos remote_csdp)
1.130 +
1.131 +lemma "(x::real) <= 1 / 2 --> - x - 2 * x^2 <= - x / (1 - x)"
1.132 +  by (sos remote_csdp)
1.133 +
1.134 +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"
1.135 +  by (sos remote_csdp)
1.136 +
1.137 +end
```