# HG changeset patch # User wenzelm # Date 1411396104 -7200 # Node ID 593917a7ad020aa5ed3a26a7924aff03fa8e1436 # Parent a04b242a7a016e9a388464798f48767ee0a20b20 examples for local CSDP executable; diff -r a04b242a7a01 -r 593917a7ad02 src/HOL/ROOT --- a/src/HOL/ROOT Mon Sep 22 16:15:29 2014 +0200 +++ b/src/HOL/ROOT Mon Sep 22 16:28:24 2014 +0200 @@ -600,13 +600,16 @@ SAT_Examples Nominal2_Dummy SOS_Cert + theories [condition = ISABELLE_CSDP] + SOS + theories [condition = ISABELLE_FULL_TEST] + SOS_Remote theories [skip_proofs = false] Meson_Test theories [condition = SVC_HOME] svc_test theories [condition = ISABELLE_FULL_TEST] Sudoku - SOS_Remote document_files "root.bib" "root.tex" session "HOL-Isar_Examples" in Isar_Examples = HOL + diff -r a04b242a7a01 -r 593917a7ad02 src/HOL/ex/SOS.thy --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/HOL/ex/SOS.thy Mon Sep 22 16:28:24 2014 +0200 @@ -0,0 +1,130 @@ +(* Title: HOL/ex/SOS.thy + Author: Amine Chaieb, University of Cambridge + Author: Philipp Meyer, TU Muenchen + +Examples for Sum_of_Squares. +*) + +theory SOS +imports "~~/src/HOL/Library/Sum_of_Squares" +begin + +lemma "(3::real) * x + 7 * a < 4 & 3 < 2 * x \ a < 0" + by (sos csdp) + +lemma "a1 >= 0 & a2 >= 0 \ (a1 * a1 + a2 * a2 = b1 * b1 + b2 * b2 + 2) \ (a1 * b1 + a2 * b2 = 0) --> a1 * a2 - b1 * b2 >= (0::real)" + by (sos csdp) + +lemma "(3::real) * x + 7 * a < 4 & 3 < 2 * x --> a < 0" + by (sos csdp) + +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" + by (sos csdp) + +lemma "(0::real) <= x & 0 <= y & 0 <= z & x + y + z <= 3 --> x * y + x * z + y * z >= 3 * x * y * z" + by (sos csdp) + +lemma "((x::real)^2 + y^2 + z^2 = 1) --> (x + y + z)^2 <= 3" + by (sos csdp) + +lemma "(w^2 + x^2 + y^2 + z^2 = 1) --> (w + x + y + z)^2 <= (4::real)" + by (sos csdp) + +lemma "(x::real) >= 1 & y >= 1 --> x * y >= x + y - 1" + by (sos csdp) + +lemma "(x::real) > 1 & y > 1 --> x * y > x + y - 1" + by (sos csdp) + +lemma "abs(x) <= 1 --> abs(64 * x^7 - 112 * x^5 + 56 * x^3 - 7 * x) <= (1::real)" + by (sos csdp) + + +text \One component of denominator in dodecahedral example.\ + +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)" + by (sos csdp) + + +text \Over a larger but simpler interval.\ + +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)" + by (sos csdp) + + +text \We can do 12. I think 12 is a sharp bound; see PP's certificate.\ + +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)" + by (sos csdp) + + +text \Inequality from sci.math (see "Leon-Sotelo, por favor").\ + +lemma "0 <= (x::real) & 0 <= y & (x * y = 1) --> x + y <= x^2 + y^2" + by (sos csdp) + +lemma "0 <= (x::real) & 0 <= y & (x * y = 1) --> x * y * (x + y) <= x^2 + y^2" + by (sos csdp) + +lemma "0 <= (x::real) & 0 <= y --> x * y * (x + y)^2 <= (x^2 + y^2)^2" + by (sos csdp) + +lemma "(0::real) <= a & 0 <= b & 0 <= c & c * (2 * a + b)^3/ 27 <= x \ c * a^2 * b <= x" + by (sos csdp) + +lemma "(0::real) < x --> 0 < 1 + x + x^2" + by (sos csdp) + +lemma "(0::real) <= x --> 0 < 1 + x + x^2" + by (sos csdp) + +lemma "(0::real) < 1 + x^2" + by (sos csdp) + +lemma "(0::real) <= 1 + 2 * x + x^2" + by (sos csdp) + +lemma "(0::real) < 1 + abs x" + by (sos csdp) + +lemma "(0::real) < 1 + (1 + x)^2 * (abs x)" + by (sos csdp) + + +lemma "abs ((1::real) + x^2) = (1::real) + x^2" + by (sos csdp) +lemma "(3::real) * x + 7 * a < 4 \ 3 < 2 * x \ a < 0" + by (sos csdp) + +lemma "(0::real) < x --> 1 < y --> y * x <= z --> x < z" + by (sos csdp) +lemma "(1::real) < x --> x^2 < y --> 1 < y" + by (sos csdp) +lemma "(b::real)^2 < 4 * a * c --> ~(a * x^2 + b * x + c = 0)" + by (sos csdp) +lemma "(b::real)^2 < 4 * a * c --> ~(a * x^2 + b * x + c = 0)" + by (sos csdp) +lemma "((a::real) * x^2 + b * x + c = 0) --> b^2 >= 4 * a * c" + by (sos csdp) +lemma "(0::real) <= b & 0 <= c & 0 <= x & 0 <= y & (x^2 = c) & (y^2 = a^2 * c + b) --> a * c <= y * x" + by (sos csdp) +lemma "abs(x - z) <= e & abs(y - z) <= e & 0 <= u & 0 <= v & (u + v = 1) --> abs((u * x + v * y) - z) <= (e::real)" + by (sos csdp) + + +(* 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?*) + +lemma "(0::real) <= x --> (1 + x + x^2)/(1 + x^2) <= 1 + x" + by (sos csdp) + +lemma "(0::real) <= x --> 1 - x <= 1 / (1 + x + x^2)" + by (sos csdp) + +lemma "(x::real) <= 1 / 2 --> - x - 2 * x^2 <= - x / (1 - x)" + by (sos csdp) + +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" + by (sos csdp) + +end + diff -r a04b242a7a01 -r 593917a7ad02 src/HOL/ex/SOS_Cert.thy --- a/src/HOL/ex/SOS_Cert.thy Mon Sep 22 16:15:29 2014 +0200 +++ b/src/HOL/ex/SOS_Cert.thy Mon Sep 22 16:28:24 2014 +0200 @@ -1,4 +1,4 @@ -(* Title: HOL/Library/Sum_of_Squares.thy +(* Title: HOL/ex/SOS_Cert.thy Author: Amine Chaieb, University of Cambridge Author: Philipp Meyer, TU Muenchen