examples for local CSDP executable;
authorwenzelm
Mon Sep 22 16:28:24 2014 +0200 (2014-09-22)
changeset 58419593917a7ad02
parent 58418 a04b242a7a01
child 58420 00bf84d3f526
examples for local CSDP executable;
src/HOL/ROOT
src/HOL/ex/SOS.thy
src/HOL/ex/SOS_Cert.thy
     1.1 --- a/src/HOL/ROOT	Mon Sep 22 16:15:29 2014 +0200
     1.2 +++ b/src/HOL/ROOT	Mon Sep 22 16:28:24 2014 +0200
     1.3 @@ -600,13 +600,16 @@
     1.4      SAT_Examples
     1.5      Nominal2_Dummy
     1.6      SOS_Cert
     1.7 +  theories [condition = ISABELLE_CSDP]
     1.8 +    SOS
     1.9 +  theories [condition = ISABELLE_FULL_TEST]
    1.10 +    SOS_Remote
    1.11    theories [skip_proofs = false]
    1.12      Meson_Test
    1.13    theories [condition = SVC_HOME]
    1.14      svc_test
    1.15    theories [condition = ISABELLE_FULL_TEST]
    1.16      Sudoku
    1.17 -    SOS_Remote
    1.18    document_files "root.bib" "root.tex"
    1.19  
    1.20  session "HOL-Isar_Examples" in Isar_Examples = HOL +
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/src/HOL/ex/SOS.thy	Mon Sep 22 16:28:24 2014 +0200
     2.3 @@ -0,0 +1,130 @@
     2.4 +(*  Title:      HOL/ex/SOS.thy
     2.5 +    Author:     Amine Chaieb, University of Cambridge
     2.6 +    Author:     Philipp Meyer, TU Muenchen
     2.7 +
     2.8 +Examples for Sum_of_Squares.
     2.9 +*)
    2.10 +
    2.11 +theory SOS
    2.12 +imports "~~/src/HOL/Library/Sum_of_Squares"
    2.13 +begin
    2.14 +
    2.15 +lemma "(3::real) * x + 7 * a < 4 & 3 < 2 * x \<Longrightarrow> a < 0"
    2.16 +  by (sos csdp)
    2.17 +
    2.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)"
    2.19 +  by (sos csdp)
    2.20 +
    2.21 +lemma "(3::real) * x + 7 * a < 4 & 3 < 2 * x --> a < 0"
    2.22 +  by (sos csdp)
    2.23 +
    2.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"
    2.25 +  by (sos csdp)
    2.26 +
    2.27 +lemma "(0::real) <= x & 0 <= y & 0 <= z & x + y + z <= 3 --> x * y + x * z + y * z >= 3 * x * y * z"
    2.28 +  by (sos csdp)
    2.29 +
    2.30 +lemma "((x::real)^2 + y^2 + z^2 = 1) --> (x + y + z)^2 <= 3"
    2.31 +  by (sos csdp)
    2.32 +
    2.33 +lemma "(w^2 + x^2 + y^2 + z^2 = 1) --> (w + x + y + z)^2 <= (4::real)"
    2.34 +  by (sos csdp)
    2.35 +
    2.36 +lemma "(x::real) >= 1 & y >= 1 --> x * y >= x + y - 1"
    2.37 +  by (sos csdp)
    2.38 +
    2.39 +lemma "(x::real) > 1 & y > 1 --> x * y > x + y - 1"
    2.40 +  by (sos csdp)
    2.41 +
    2.42 +lemma "abs(x) <= 1 --> abs(64 * x^7 - 112 * x^5 + 56 * x^3 - 7 * x) <= (1::real)"
    2.43 +  by (sos csdp)
    2.44 +
    2.45 +
    2.46 +text \<open>One component of denominator in dodecahedral example.\<close>
    2.47 +
    2.48 +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)"
    2.49 +  by (sos csdp)
    2.50 +
    2.51 +
    2.52 +text \<open>Over a larger but simpler interval.\<close>
    2.53 +
    2.54 +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)"
    2.55 +  by (sos csdp)
    2.56 +
    2.57 +
    2.58 +text \<open>We can do 12. I think 12 is a sharp bound; see PP's certificate.\<close>
    2.59 +
    2.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)"
    2.61 +  by (sos csdp)
    2.62 +
    2.63 +
    2.64 +text \<open>Inequality from sci.math (see "Leon-Sotelo, por favor").\<close>
    2.65 +
    2.66 +lemma "0 <= (x::real) & 0 <= y & (x * y = 1) --> x + y <= x^2 + y^2"
    2.67 +  by (sos csdp)
    2.68 +
    2.69 +lemma "0 <= (x::real) & 0 <= y & (x * y = 1) --> x * y * (x + y) <= x^2 + y^2"
    2.70 +  by (sos csdp)
    2.71 +
    2.72 +lemma "0 <= (x::real) & 0 <= y --> x * y * (x + y)^2 <= (x^2 + y^2)^2"
    2.73 +  by (sos csdp)
    2.74 +
    2.75 +lemma "(0::real) <= a & 0 <= b & 0 <= c & c * (2 * a + b)^3/ 27 <= x \<longrightarrow> c * a^2 * b <= x"
    2.76 +  by (sos csdp)
    2.77 +
    2.78 +lemma "(0::real) < x --> 0 < 1 + x + x^2"
    2.79 +  by (sos csdp)
    2.80 +
    2.81 +lemma "(0::real) <= x --> 0 < 1 + x + x^2"
    2.82 +  by (sos csdp)
    2.83 +
    2.84 +lemma "(0::real) < 1 + x^2"
    2.85 +  by (sos csdp)
    2.86 +
    2.87 +lemma "(0::real) <= 1 + 2 * x + x^2"
    2.88 +  by (sos csdp)
    2.89 +
    2.90 +lemma "(0::real) < 1 + abs x"
    2.91 +  by (sos csdp)
    2.92 +
    2.93 +lemma "(0::real) < 1 + (1 + x)^2 * (abs x)"
    2.94 +  by (sos csdp)
    2.95 +
    2.96 +
    2.97 +lemma "abs ((1::real) + x^2) = (1::real) + x^2"
    2.98 +  by (sos csdp)
    2.99 +lemma "(3::real) * x + 7 * a < 4 \<and> 3 < 2 * x \<longrightarrow> a < 0"
   2.100 +  by (sos csdp)
   2.101 +
   2.102 +lemma "(0::real) < x --> 1 < y --> y * x <= z --> x < z"
   2.103 +  by (sos csdp)
   2.104 +lemma "(1::real) < x --> x^2 < y --> 1 < y"
   2.105 +  by (sos csdp)
   2.106 +lemma "(b::real)^2 < 4 * a * c --> ~(a * x^2 + b * x + c = 0)"
   2.107 +  by (sos csdp)
   2.108 +lemma "(b::real)^2 < 4 * a * c --> ~(a * x^2 + b * x + c = 0)"
   2.109 +  by (sos csdp)
   2.110 +lemma "((a::real) * x^2 + b * x + c = 0) --> b^2 >= 4 * a * c"
   2.111 +  by (sos csdp)
   2.112 +lemma "(0::real) <= b & 0 <= c & 0 <= x & 0 <= y & (x^2 = c) & (y^2 = a^2 * c + b) --> a * c <= y * x"
   2.113 +  by (sos csdp)
   2.114 +lemma "abs(x - z) <= e & abs(y - z) <= e & 0 <= u & 0 <= v & (u + v = 1) --> abs((u * x + v * y) - z) <= (e::real)"
   2.115 +  by (sos csdp)
   2.116 +
   2.117 +
   2.118 +(* 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?*)
   2.119 +
   2.120 +lemma "(0::real) <= x --> (1 + x + x^2)/(1 + x^2) <= 1 + x"
   2.121 +  by (sos csdp)
   2.122 +
   2.123 +lemma "(0::real) <= x --> 1 - x <= 1 / (1 + x + x^2)"
   2.124 +  by (sos csdp)
   2.125 +
   2.126 +lemma "(x::real) <= 1 / 2 --> - x - 2 * x^2 <= - x / (1 - x)"
   2.127 +  by (sos csdp)
   2.128 +
   2.129 +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"
   2.130 +  by (sos csdp)
   2.131 +
   2.132 +end
   2.133 +
     3.1 --- a/src/HOL/ex/SOS_Cert.thy	Mon Sep 22 16:15:29 2014 +0200
     3.2 +++ b/src/HOL/ex/SOS_Cert.thy	Mon Sep 22 16:28:24 2014 +0200
     3.3 @@ -1,4 +1,4 @@
     3.4 -(*  Title:      HOL/Library/Sum_of_Squares.thy
     3.5 +(*  Title:      HOL/ex/SOS_Cert.thy
     3.6      Author:     Amine Chaieb, University of Cambridge
     3.7      Author:     Philipp Meyer, TU Muenchen
     3.8