| author | wenzelm | 
| Tue, 20 Nov 2012 22:52:04 +0100 | |
| changeset 50136 | a96bd08258a2 | 
| parent 48891 | c0eafbd55de3 | 
| child 54703 | 499f92dc6e45 | 
| permissions | -rw-r--r-- | 
| 41474 | 1 | (* Title: HOL/Library/Sum_of_Squares.thy | 
| 32949 
aa6c470a962a
eliminated slightly odd get/set operations in favour of Unsynchronized.ref;
 wenzelm parents: 
32645diff
changeset | 2 | Author: Amine Chaieb, University of Cambridge | 
| 
aa6c470a962a
eliminated slightly odd get/set operations in favour of Unsynchronized.ref;
 wenzelm parents: 
32645diff
changeset | 3 | Author: Philipp Meyer, TU Muenchen | 
| 31119 
2532bb2d65c7
A decision method for universal multivariate real arithmetic with add
 chaieb parents: diff
changeset | 4 | *) | 
| 
2532bb2d65c7
A decision method for universal multivariate real arithmetic with add
 chaieb parents: diff
changeset | 5 | |
| 
2532bb2d65c7
A decision method for universal multivariate real arithmetic with add
 chaieb parents: diff
changeset | 6 | header {* A decision method for universal multivariate real arithmetic with addition, 
 | 
| 32333 | 7 | multiplication and ordering using semidefinite programming *} | 
| 32271 | 8 | |
| 41474 | 9 | theory Sum_of_Squares | 
| 38136 | 10 | imports Complex_Main | 
| 32332 | 11 | begin | 
| 31119 
2532bb2d65c7
A decision method for universal multivariate real arithmetic with add
 chaieb parents: diff
changeset | 12 | |
| 48891 | 13 | ML_file "positivstellensatz.ML" | 
| 14 | ML_file "Sum_of_Squares/sum_of_squares.ML" | |
| 15 | ML_file "Sum_of_Squares/positivstellensatz_tools.ML" | |
| 16 | ML_file "Sum_of_Squares/sos_wrapper.ML" | |
| 17 | ||
| 32333 | 18 | text {*
 | 
| 41950 
134131d519c0
clarified ISABELLE_CSDP setting (formerly CSDP_EXE);
 wenzelm parents: 
41474diff
changeset | 19 | Proof method sos invocations: | 
| 
134131d519c0
clarified ISABELLE_CSDP setting (formerly CSDP_EXE);
 wenzelm parents: 
41474diff
changeset | 20 |   \begin{itemize}
 | 
| 
134131d519c0
clarified ISABELLE_CSDP setting (formerly CSDP_EXE);
 wenzelm parents: 
41474diff
changeset | 21 | |
| 
134131d519c0
clarified ISABELLE_CSDP setting (formerly CSDP_EXE);
 wenzelm parents: 
41474diff
changeset | 22 |   \item remote solver: @{text "(sos remote_csdp)"}
 | 
| 
134131d519c0
clarified ISABELLE_CSDP setting (formerly CSDP_EXE);
 wenzelm parents: 
41474diff
changeset | 23 | |
| 
134131d519c0
clarified ISABELLE_CSDP setting (formerly CSDP_EXE);
 wenzelm parents: 
41474diff
changeset | 24 |   \item local solver: @{text "(sos csdp)"}
 | 
| 
134131d519c0
clarified ISABELLE_CSDP setting (formerly CSDP_EXE);
 wenzelm parents: 
41474diff
changeset | 25 | |
| 
134131d519c0
clarified ISABELLE_CSDP setting (formerly CSDP_EXE);
 wenzelm parents: 
41474diff
changeset | 26 | The latter requires a local executable from | 
| 
134131d519c0
clarified ISABELLE_CSDP setting (formerly CSDP_EXE);
 wenzelm parents: 
41474diff
changeset | 27 | https://projects.coin-or.org/Csdp and the Isabelle settings variable | 
| 
134131d519c0
clarified ISABELLE_CSDP setting (formerly CSDP_EXE);
 wenzelm parents: 
41474diff
changeset | 28 |   variable @{text ISABELLE_CSDP} pointing to it.
 | 
| 
134131d519c0
clarified ISABELLE_CSDP setting (formerly CSDP_EXE);
 wenzelm parents: 
41474diff
changeset | 29 | |
| 
134131d519c0
clarified ISABELLE_CSDP setting (formerly CSDP_EXE);
 wenzelm parents: 
41474diff
changeset | 30 |   \end{itemize}
 | 
| 
134131d519c0
clarified ISABELLE_CSDP setting (formerly CSDP_EXE);
 wenzelm parents: 
41474diff
changeset | 31 | |
| 
134131d519c0
clarified ISABELLE_CSDP setting (formerly CSDP_EXE);
 wenzelm parents: 
41474diff
changeset | 32 |   By default, method sos calls @{text remote_csdp}.  This can take of
 | 
| 
134131d519c0
clarified ISABELLE_CSDP setting (formerly CSDP_EXE);
 wenzelm parents: 
41474diff
changeset | 33 | the order of a minute for one sos call, because sos calls CSDP | 
| 
134131d519c0
clarified ISABELLE_CSDP setting (formerly CSDP_EXE);
 wenzelm parents: 
41474diff
changeset | 34 | repeatedly. If you install CSDP locally, sos calls typically takes | 
| 
134131d519c0
clarified ISABELLE_CSDP setting (formerly CSDP_EXE);
 wenzelm parents: 
41474diff
changeset | 35 | only a few seconds. | 
| 
134131d519c0
clarified ISABELLE_CSDP setting (formerly CSDP_EXE);
 wenzelm parents: 
41474diff
changeset | 36 | |
| 
134131d519c0
clarified ISABELLE_CSDP setting (formerly CSDP_EXE);
 wenzelm parents: 
41474diff
changeset | 37 | The sos method generates a certificate which can be used to repeat | 
| 
134131d519c0
clarified ISABELLE_CSDP setting (formerly CSDP_EXE);
 wenzelm parents: 
41474diff
changeset | 38 | the proof without calling an external prover. | 
| 32333 | 39 | *} | 
| 40 | ||
| 32949 
aa6c470a962a
eliminated slightly odd get/set operations in favour of Unsynchronized.ref;
 wenzelm parents: 
32645diff
changeset | 41 | setup SOS_Wrapper.setup | 
| 31119 
2532bb2d65c7
A decision method for universal multivariate real arithmetic with add
 chaieb parents: diff
changeset | 42 | |
| 32645 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 43 | text {* Tests *}
 | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 44 | |
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 45 | lemma "(3::real) * x + 7 * a < 4 & 3 < 2 * x \<Longrightarrow> a < 0" | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 46 | by (sos_cert "((R<1 + (((A<1 * R<1) * (R<2 * [1]^2)) + (((A<0 * R<1) * (R<3 * [1]^2)) + ((A<=0 * R<1) * (R<14 * [1]^2))))))") | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 47 | |
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 48 | 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)" | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 49 | by (sos_cert "(((A<0 * R<1) + (([~1/2*a1*b2 + ~1/2*a2*b1] * A=0) + (([~1/2*a1*a2 + 1/2*b1*b2] * A=1) + (((A<0 * R<1) * ((R<1/2 * [b2]^2) + (R<1/2 * [b1]^2))) + ((A<=0 * (A<=1 * R<1)) * ((R<1/2 * [b2]^2) + ((R<1/2 * [b1]^2) + ((R<1/2 * [a2]^2) + (R<1/2 * [a1]^2))))))))))") | 
| 32268 
d50f0cb67578
Functionality for sum of squares to call a remote csdp prover
 Philipp Meyer parents: 
31512diff
changeset | 50 | |
| 32645 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 51 | lemma "(3::real) * x + 7 * a < 4 & 3 < 2 * x --> a < 0" | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 52 | by (sos_cert "((R<1 + (((A<1 * R<1) * (R<2 * [1]^2)) + (((A<0 * R<1) * (R<3 * [1]^2)) + ((A<=0 * R<1) * (R<14 * [1]^2))))))") | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 53 | |
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 54 | 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" | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 55 | by (sos_cert "((R<1 + (((A<=3 * (A<=4 * R<1)) * (R<1 * [1]^2)) + (((A<=2 * (A<=7 * R<1)) * (R<1 * [1]^2)) + (((A<=1 * (A<=6 * R<1)) * (R<1 * [1]^2)) + ((A<=0 * (A<=5 * R<1)) * (R<1 * [1]^2)))))))") | 
| 31119 
2532bb2d65c7
A decision method for universal multivariate real arithmetic with add
 chaieb parents: diff
changeset | 56 | |
| 32645 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 57 | lemma "(0::real) <= x & 0 <= y & 0 <= z & x + y + z <= 3 --> x * y + x * z + y * z >= 3 * x * y * z" | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 58 | by (sos_cert "(((A<0 * R<1) + (((A<0 * R<1) * (R<1/2 * [1]^2)) + (((A<=2 * R<1) * (R<1/2 * [~1*x + y]^2)) + (((A<=1 * R<1) * (R<1/2 * [~1*x + z]^2)) + (((A<=1 * (A<=2 * (A<=3 * R<1))) * (R<1/2 * [1]^2)) + (((A<=0 * R<1) * (R<1/2 * [~1*y + z]^2)) + (((A<=0 * (A<=2 * (A<=3 * R<1))) * (R<1/2 * [1]^2)) + ((A<=0 * (A<=1 * (A<=3 * R<1))) * (R<1/2 * [1]^2))))))))))") | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 59 | |
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 60 | lemma "((x::real)^2 + y^2 + z^2 = 1) --> (x + y + z)^2 <= 3" | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 61 | by (sos_cert "(((A<0 * R<1) + (([~3] * A=0) + (R<1 * ((R<2 * [~1/2*x + ~1/2*y + z]^2) + (R<3/2 * [~1*x + y]^2))))))") | 
| 31119 
2532bb2d65c7
A decision method for universal multivariate real arithmetic with add
 chaieb parents: diff
changeset | 62 | |
| 32645 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 63 | lemma "(w^2 + x^2 + y^2 + z^2 = 1) --> (w + x + y + z)^2 <= (4::real)" | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 64 | by (sos_cert "(((A<0 * R<1) + (([~4] * A=0) + (R<1 * ((R<3 * [~1/3*w + ~1/3*x + ~1/3*y + z]^2) + ((R<8/3 * [~1/2*w + ~1/2*x + y]^2) + (R<2 * [~1*w + x]^2)))))))") | 
| 31119 
2532bb2d65c7
A decision method for universal multivariate real arithmetic with add
 chaieb parents: diff
changeset | 65 | |
| 32645 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 66 | lemma "(x::real) >= 1 & y >= 1 --> x * y >= x + y - 1" | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 67 | by (sos_cert "(((A<0 * R<1) + ((A<=0 * (A<=1 * R<1)) * (R<1 * [1]^2))))") | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 68 | |
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 69 | lemma "(x::real) > 1 & y > 1 --> x * y > x + y - 1" | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 70 | by (sos_cert "((((A<0 * A<1) * R<1) + ((A<=0 * R<1) * (R<1 * [1]^2))))") | 
| 31119 
2532bb2d65c7
A decision method for universal multivariate real arithmetic with add
 chaieb parents: diff
changeset | 71 | |
| 32645 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 72 | lemma "abs(x) <= 1 --> abs(64 * x^7 - 112 * x^5 + 56 * x^3 - 7 * x) <= (1::real)" | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 73 | by (sos_cert "((((A<0 * R<1) + ((A<=1 * R<1) * (R<1 * [~8*x^3 + ~4*x^2 + 4*x + 1]^2)))) & ((((A<0 * A<1) * R<1) + ((A<=1 * (A<0 * R<1)) * (R<1 * [8*x^3 + ~4*x^2 + ~4*x + 1]^2)))))") | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 74 | |
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 75 | (* ------------------------------------------------------------------------- *) | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 76 | (* One component of denominator in dodecahedral example. *) | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 77 | (* ------------------------------------------------------------------------- *) | 
| 31119 
2532bb2d65c7
A decision method for universal multivariate real arithmetic with add
 chaieb parents: diff
changeset | 78 | |
| 32645 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 79 | 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)" | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 80 | by (sos_cert "(((A<0 * R<1) + ((R<1 * ((R<5749028157/5000000000 * [~25000/222477*x + ~25000/222477*y + ~25000/222477*z + 1]^2) + ((R<864067/1779816 * [419113/864067*x + 419113/864067*y + z]^2) + ((R<320795/864067 * [419113/1283180*x + y]^2) + (R<1702293/5132720 * [x]^2))))) + (((A<=4 * (A<=5 * R<1)) * (R<3/2 * [1]^2)) + (((A<=3 * (A<=5 * R<1)) * (R<1/2 * [1]^2)) + (((A<=2 * (A<=4 * R<1)) * (R<1 * [1]^2)) + (((A<=2 * (A<=3 * R<1)) * (R<3/2 * [1]^2)) + (((A<=1 * (A<=5 * R<1)) * (R<1/2 * [1]^2)) + (((A<=1 * (A<=3 * R<1)) * (R<1/2 * [1]^2)) + (((A<=0 * (A<=4 * R<1)) * (R<1 * [1]^2)) + (((A<=0 * (A<=2 * R<1)) * (R<1 * [1]^2)) + ((A<=0 * (A<=1 * R<1)) * (R<3/2 * [1]^2)))))))))))))") | 
| 31119 
2532bb2d65c7
A decision method for universal multivariate real arithmetic with add
 chaieb parents: diff
changeset | 81 | |
| 32645 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 82 | (* ------------------------------------------------------------------------- *) | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 83 | (* Over a larger but simpler interval. *) | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 84 | (* ------------------------------------------------------------------------- *) | 
| 31119 
2532bb2d65c7
A decision method for universal multivariate real arithmetic with add
 chaieb parents: diff
changeset | 85 | |
| 32645 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 86 | 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)" | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 87 | by (sos_cert "((R<1 + ((R<1 * ((R<1 * [~1/6*x + ~1/6*y + ~1/6*z + 1]^2) + ((R<1/18 * [~1/2*x + ~1/2*y + z]^2) + (R<1/24 * [~1*x + y]^2)))) + (((A<0 * R<1) * (R<1/12 * [1]^2)) + (((A<=4 * (A<=5 * R<1)) * (R<1/6 * [1]^2)) + (((A<=2 * (A<=4 * R<1)) * (R<1/6 * [1]^2)) + (((A<=2 * (A<=3 * R<1)) * (R<1/6 * [1]^2)) + (((A<=0 * (A<=4 * R<1)) * (R<1/6 * [1]^2)) + (((A<=0 * (A<=2 * R<1)) * (R<1/6 * [1]^2)) + ((A<=0 * (A<=1 * R<1)) * (R<1/6 * [1]^2)))))))))))") | 
| 31119 
2532bb2d65c7
A decision method for universal multivariate real arithmetic with add
 chaieb parents: diff
changeset | 88 | |
| 32645 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 89 | (* ------------------------------------------------------------------------- *) | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 90 | (* We can do 12. I think 12 is a sharp bound; see PP's certificate. *) | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 91 | (* ------------------------------------------------------------------------- *) | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 92 | |
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 93 | 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)" | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 94 | by (sos_cert "(((A<0 * R<1) + (((A<=4 * R<1) * (R<2/3 * [1]^2)) + (((A<=4 * (A<=5 * R<1)) * (R<1 * [1]^2)) + (((A<=3 * (A<=4 * R<1)) * (R<1/3 * [1]^2)) + (((A<=2 * R<1) * (R<2/3 * [1]^2)) + (((A<=2 * (A<=5 * R<1)) * (R<1/3 * [1]^2)) + (((A<=2 * (A<=4 * R<1)) * (R<8/3 * [1]^2)) + (((A<=2 * (A<=3 * R<1)) * (R<1 * [1]^2)) + (((A<=1 * (A<=4 * R<1)) * (R<1/3 * [1]^2)) + (((A<=1 * (A<=2 * R<1)) * (R<1/3 * [1]^2)) + (((A<=0 * R<1) * (R<2/3 * [1]^2)) + (((A<=0 * (A<=5 * R<1)) * (R<1/3 * [1]^2)) + (((A<=0 * (A<=4 * R<1)) * (R<8/3 * [1]^2)) + (((A<=0 * (A<=3 * R<1)) * (R<1/3 * [1]^2)) + (((A<=0 * (A<=2 * R<1)) * (R<8/3 * [1]^2)) + ((A<=0 * (A<=1 * R<1)) * (R<1 * [1]^2))))))))))))))))))") | 
| 31119 
2532bb2d65c7
A decision method for universal multivariate real arithmetic with add
 chaieb parents: diff
changeset | 95 | |
| 32645 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 96 | (* ------------------------------------------------------------------------- *) | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 97 | (* Inequality from sci.math (see "Leon-Sotelo, por favor"). *) | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 98 | (* ------------------------------------------------------------------------- *) | 
| 32543 
62e6c9b67c6f
tuned document -- proper text instead of source comments, reduced line length;
 wenzelm parents: 
32333diff
changeset | 99 | |
| 32645 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 100 | lemma "0 <= (x::real) & 0 <= y & (x * y = 1) --> x + y <= x^2 + y^2" | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 101 | by (sos_cert "(((A<0 * R<1) + (([1] * A=0) + (R<1 * ((R<1 * [~1/2*x + ~1/2*y + 1]^2) + (R<3/4 * [~1*x + y]^2))))))") | 
| 32543 
62e6c9b67c6f
tuned document -- proper text instead of source comments, reduced line length;
 wenzelm parents: 
32333diff
changeset | 102 | |
| 32645 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 103 | lemma "0 <= (x::real) & 0 <= y & (x * y = 1) --> x * y * (x + y) <= x^2 + y^2" | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 104 | by (sos_cert "(((A<0 * R<1) + (([~1*x + ~1*y + 1] * A=0) + (R<1 * ((R<1 * [~1/2*x + ~1/2*y + 1]^2) + (R<3/4 * [~1*x + y]^2))))))") | 
| 32543 
62e6c9b67c6f
tuned document -- proper text instead of source comments, reduced line length;
 wenzelm parents: 
32333diff
changeset | 105 | |
| 32645 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 106 | lemma "0 <= (x::real) & 0 <= y --> x * y * (x + y)^2 <= (x^2 + y^2)^2" | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 107 | by (sos_cert "(((A<0 * R<1) + (R<1 * ((R<1 * [~1/2*x^2 + y^2 + ~1/2*x*y]^2) + (R<3/4 * [~1*x^2 + x*y]^2)))))") | 
| 32543 
62e6c9b67c6f
tuned document -- proper text instead of source comments, reduced line length;
 wenzelm parents: 
32333diff
changeset | 108 | |
| 32645 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 109 | lemma "(0::real) <= a & 0 <= b & 0 <= c & c * (2 * a + b)^3/ 27 <= x \<longrightarrow> c * a^2 * b <= x" | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 110 | by (sos_cert "(((A<0 * R<1) + (((A<=3 * R<1) * (R<1 * [1]^2)) + (((A<=1 * (A<=2 * R<1)) * (R<1/27 * [~1*a + b]^2)) + ((A<=0 * (A<=2 * R<1)) * (R<8/27 * [~1*a + b]^2))))))") | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 111 | |
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 112 | lemma "(0::real) < x --> 0 < 1 + x + x^2" | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 113 | by (sos_cert "((R<1 + ((R<1 * (R<1 * [x]^2)) + (((A<0 * R<1) * (R<1 * [1]^2)) + ((A<=0 * R<1) * (R<1 * [1]^2))))))") | 
| 32543 
62e6c9b67c6f
tuned document -- proper text instead of source comments, reduced line length;
 wenzelm parents: 
32333diff
changeset | 114 | |
| 32645 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 115 | lemma "(0::real) <= x --> 0 < 1 + x + x^2" | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 116 | by (sos_cert "((R<1 + ((R<1 * (R<1 * [x]^2)) + (((A<=1 * R<1) * (R<1 * [1]^2)) + ((A<=0 * R<1) * (R<1 * [1]^2))))))") | 
| 31131 | 117 | |
| 32645 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 118 | lemma "(0::real) < 1 + x^2" | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 119 | by (sos_cert "((R<1 + ((R<1 * (R<1 * [x]^2)) + ((A<=0 * R<1) * (R<1 * [1]^2)))))") | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 120 | |
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 121 | lemma "(0::real) <= 1 + 2 * x + x^2" | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 122 | by (sos_cert "(((A<0 * R<1) + (R<1 * (R<1 * [x + 1]^2))))") | 
| 32543 
62e6c9b67c6f
tuned document -- proper text instead of source comments, reduced line length;
 wenzelm parents: 
32333diff
changeset | 123 | |
| 32645 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 124 | lemma "(0::real) < 1 + abs x" | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 125 | by (sos_cert "((R<1 + (((A<=1 * R<1) * (R<1/2 * [1]^2)) + ((A<=0 * R<1) * (R<1/2 * [1]^2)))))") | 
| 32543 
62e6c9b67c6f
tuned document -- proper text instead of source comments, reduced line length;
 wenzelm parents: 
32333diff
changeset | 126 | |
| 32645 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 127 | lemma "(0::real) < 1 + (1 + x)^2 * (abs x)" | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 128 | by (sos_cert "(((R<1 + (((A<=1 * R<1) * (R<1 * [1]^2)) + ((A<=0 * R<1) * (R<1 * [x + 1]^2))))) & ((R<1 + (((A<0 * R<1) * (R<1 * [x + 1]^2)) + ((A<=0 * R<1) * (R<1 * [1]^2))))))") | 
| 32543 
62e6c9b67c6f
tuned document -- proper text instead of source comments, reduced line length;
 wenzelm parents: 
32333diff
changeset | 129 | |
| 
62e6c9b67c6f
tuned document -- proper text instead of source comments, reduced line length;
 wenzelm parents: 
32333diff
changeset | 130 | |
| 
62e6c9b67c6f
tuned document -- proper text instead of source comments, reduced line length;
 wenzelm parents: 
32333diff
changeset | 131 | |
| 32645 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 132 | lemma "abs ((1::real) + x^2) = (1::real) + x^2" | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 133 | by (sos_cert "(() & (((R<1 + ((R<1 * (R<1 * [x]^2)) + ((A<1 * R<1) * (R<1/2 * [1]^2))))) & ((R<1 + ((R<1 * (R<1 * [x]^2)) + ((A<0 * R<1) * (R<1 * [1]^2)))))))") | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 134 | lemma "(3::real) * x + 7 * a < 4 \<and> 3 < 2 * x \<longrightarrow> a < 0" | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 135 | by (sos_cert "((R<1 + (((A<1 * R<1) * (R<2 * [1]^2)) + (((A<0 * R<1) * (R<3 * [1]^2)) + ((A<=0 * R<1) * (R<14 * [1]^2))))))") | 
| 31119 
2532bb2d65c7
A decision method for universal multivariate real arithmetic with add
 chaieb parents: diff
changeset | 136 | |
| 32645 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 137 | lemma "(0::real) < x --> 1 < y --> y * x <= z --> x < z" | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 138 | by (sos_cert "((((A<0 * A<1) * R<1) + (((A<=1 * R<1) * (R<1 * [1]^2)) + ((A<=0 * R<1) * (R<1 * [1]^2)))))") | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 139 | lemma "(1::real) < x --> x^2 < y --> 1 < y" | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 140 | by (sos_cert "((((A<0 * A<1) * R<1) + ((R<1 * ((R<1/10 * [~2*x + y + 1]^2) + (R<1/10 * [~1*x + y]^2))) + (((A<1 * R<1) * (R<1/2 * [1]^2)) + (((A<0 * R<1) * (R<1 * [x]^2)) + (((A<=0 * R<1) * ((R<1/10 * [x + 1]^2) + (R<1/10 * [x]^2))) + (((A<=0 * (A<1 * R<1)) * (R<1/5 * [1]^2)) + ((A<=0 * (A<0 * R<1)) * (R<1/5 * [1]^2)))))))))") | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 141 | lemma "(b::real)^2 < 4 * a * c --> ~(a * x^2 + b * x + c = 0)" | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 142 | by (sos_cert "(((A<0 * R<1) + (R<1 * (R<1 * [2*a*x + b]^2))))") | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 143 | lemma "(b::real)^2 < 4 * a * c --> ~(a * x^2 + b * x + c = 0)" | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 144 | by (sos_cert "(((A<0 * R<1) + (R<1 * (R<1 * [2*a*x + b]^2))))") | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 145 | lemma "((a::real) * x^2 + b * x + c = 0) --> b^2 >= 4 * a * c" | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 146 | by (sos_cert "(((A<0 * R<1) + (R<1 * (R<1 * [2*a*x + b]^2))))") | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 147 | lemma "(0::real) <= b & 0 <= c & 0 <= x & 0 <= y & (x^2 = c) & (y^2 = a^2 * c + b) --> a * c <= y * x" | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 148 | by (sos_cert "(((A<0 * (A<0 * R<1)) + (((A<=2 * (A<=3 * (A<0 * R<1))) * (R<2 * [1]^2)) + ((A<=0 * (A<=1 * R<1)) * (R<1 * [1]^2)))))") | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 149 | lemma "abs(x - z) <= e & abs(y - z) <= e & 0 <= u & 0 <= v & (u + v = 1) --> abs((u * x + v * y) - z) <= (e::real)" | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 150 | by (sos_cert "((((A<0 * R<1) + (((A<=3 * (A<=6 * R<1)) * (R<1 * [1]^2)) + ((A<=1 * (A<=5 * R<1)) * (R<1 * [1]^2))))) & ((((A<0 * A<1) * R<1) + (((A<=3 * (A<=5 * (A<0 * R<1))) * (R<1 * [1]^2)) + ((A<=1 * (A<=4 * (A<0 * R<1))) * (R<1 * [1]^2))))))") | 
| 31119 
2532bb2d65c7
A decision method for universal multivariate real arithmetic with add
 chaieb parents: diff
changeset | 151 | |
| 
2532bb2d65c7
A decision method for universal multivariate real arithmetic with add
 chaieb parents: diff
changeset | 152 | |
| 32645 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 153 | (* 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?*) | 
| 32543 
62e6c9b67c6f
tuned document -- proper text instead of source comments, reduced line length;
 wenzelm parents: 
32333diff
changeset | 154 | |
| 31131 | 155 | lemma "(0::real) <= x --> (1 + x + x^2)/(1 + x^2) <= 1 + x" | 
| 32645 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 156 | by (sos_cert "(((((A<0 * A<1) * R<1) + ((A<=0 * (A<0 * R<1)) * (R<1 * [x]^2)))) & ((R<1 + ((R<1 * (R<1 * [x]^2)) + ((A<0 * R<1) * (R<1 * [1]^2))))))") | 
| 31131 | 157 | |
| 158 | lemma "(0::real) <= x --> 1 - x <= 1 / (1 + x + x^2)" | |
| 32645 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 159 | by (sos_cert "(((R<1 + (([~4/3] * A=0) + ((R<1 * ((R<1/3 * [3/2*x + 1]^2) + (R<7/12 * [x]^2))) + ((A<=0 * R<1) * (R<1/3 * [1]^2)))))) & (((((A<0 * A<1) * R<1) + ((A<=0 * (A<0 * R<1)) * (R<1 * [x]^2)))) & ((R<1 + ((R<1 * (R<1 * [x]^2)) + (((A<0 * R<1) * (R<1 * [1]^2)) + ((A<=0 * R<1) * (R<1 * [1]^2))))))))") | 
| 31131 | 160 | |
| 161 | lemma "(x::real) <= 1 / 2 --> - x - 2 * x^2 <= - x / (1 - x)" | |
| 32645 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 162 | by (sos_cert "((((A<0 * A<1) * R<1) + ((A<=0 * (A<0 * R<1)) * (R<1 * [x]^2))))") | 
| 31131 | 163 | |
| 32645 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 164 | 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" | 
| 
1cc5b24f5a01
sos method generates and uses proof certificates
 Philipp Meyer parents: 
32543diff
changeset | 165 | by (sos_cert "((((((A<0 * A<1) * R<1) + ([~4] * A=0))) & ((((A<0 * A<1) * R<1) + ([4] * A=0)))) & (((((A<0 * A<1) * R<1) + ([4] * A=0))) & ((((A<0 * A<1) * R<1) + ([~4] * A=0)))))") | 
| 31119 
2532bb2d65c7
A decision method for universal multivariate real arithmetic with add
 chaieb parents: diff
changeset | 166 | |
| 
2532bb2d65c7
A decision method for universal multivariate real arithmetic with add
 chaieb parents: diff
changeset | 167 | end |