Skip to content

Commit f7db8fa

Browse files
ajreynolHanielB
andauthored
Do not introduce mixed arithmetic in transcendental proof rules (cvc5#12101)
Also adds a regression for `ARITH_TRANS_SINE_APPROX_BELOW_NEG`, which was missing. --------- Co-authored-by: Haniel Barbosa <[email protected]>
1 parent 0ee7dca commit f7db8fa

File tree

7 files changed

+43
-25
lines changed

7 files changed

+43
-25
lines changed

include/cvc5/cvc5_proof_rule.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2208,7 +2208,7 @@ enum ENUM(ProofRule)
22082208
*
22092209
* .. math::
22102210
*
2211-
* \inferrule{- \mid t}{(t < 0) \leftrightarrow (\exp(t) < 1)}
2211+
* \inferrule{- \mid t}{(t < 0.0) \leftrightarrow (\exp(t) < 1.0)}
22122212
*
22132213
* \endverbatim
22142214
*/
@@ -2219,7 +2219,7 @@ enum ENUM(ProofRule)
22192219
*
22202220
* .. math::
22212221
*
2222-
* \inferrule{- \mid t}{\exp(t) > 0}
2222+
* \inferrule{- \mid t}{\exp(t) > 0.0}
22232223
*
22242224
* \endverbatim
22252225
*/
@@ -2231,7 +2231,7 @@ enum ENUM(ProofRule)
22312231
*
22322232
* .. math::
22332233
*
2234-
* \inferrule{- \mid t}{t \leq 0 \lor \exp(t) > t+1}
2234+
* \inferrule{- \mid t}{t \leq 0.0 \lor \exp(t) > t+1.0}
22352235
*
22362236
* \endverbatim
22372237
*/
@@ -2242,7 +2242,7 @@ enum ENUM(ProofRule)
22422242
*
22432243
* .. math::
22442244
*
2245-
* \inferrule{- \mid t}{(t=0) \leftrightarrow (\exp(t) = 1)}
2245+
* \inferrule{- \mid t}{(t=0.0) \leftrightarrow (\exp(t) = 1.0)}
22462246
*
22472247
* \endverbatim
22482248
*/
@@ -2336,7 +2336,7 @@ enum ENUM(ProofRule)
23362336
*
23372337
* .. math::
23382338
*
2339-
* \inferrule{- \mid t}{\sin(t) \leq 1 \land \sin(t) \geq -1}
2339+
* \inferrule{- \mid t}{\sin(t) \leq 1.0 \land \sin(t) \geq -1.0}
23402340
*
23412341
* \endverbatim
23422342
*/
@@ -2368,7 +2368,7 @@ enum ENUM(ProofRule)
23682368
*
23692369
* .. math::
23702370
*
2371-
* \inferrule{- \mid t}{\sin(t) - \sin(-t) = 0}
2371+
* \inferrule{- \mid t}{\sin(t) - \sin(-t) = 0.0}
23722372
*
23732373
* \endverbatim
23742374
*/
@@ -2379,7 +2379,7 @@ enum ENUM(ProofRule)
23792379
*
23802380
* .. math::
23812381
*
2382-
* \inferrule{- \mid t}{(t > 0 \rightarrow \sin(t) < t) \land (t < 0
2382+
* \inferrule{- \mid t}{(t > 0.0 \rightarrow \sin(t) < t) \land (t < 0.0
23832383
* \rightarrow \sin(t) > t)}
23842384
*
23852385
* \endverbatim

proofs/eo/cpc/expert/rules/Transcendentals.eo

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
(declare-rule arith_trans_exp_neg ((x Real))
2525
:premises ()
2626
:args (x)
27-
:conclusion (= (< x 0) (< (exp x) 1))
27+
:conclusion (= (< x 0/1) (< (exp x) 1/1))
2828
)
2929

3030
; rule: arith_trans_exp_positivity
@@ -35,7 +35,7 @@
3535
(declare-rule arith_trans_exp_positivity ((x Real))
3636
:premises ()
3737
:args (x)
38-
:conclusion (> (exp x) 0)
38+
:conclusion (> (exp x) 0/1)
3939
)
4040

4141
; rule: arith_trans_exp_super_lin
@@ -47,7 +47,7 @@
4747
; greater than its argument plus one.
4848
(declare-rule arith_trans_exp_super_lin ((x Real))
4949
:args (x)
50-
:conclusion (or (<= x 0) (> (exp x) (+ x 1)))
50+
:conclusion (or (<= x 0/1) (> (exp x) (+ x 1/1)))
5151
)
5252

5353
; rule: arith_trans_exp_zero
@@ -69,7 +69,7 @@
6969
; conclusion: The sine is within positive and negative one.
7070
(declare-rule arith_trans_sine_bounds ((x Real))
7171
:args (x)
72-
:conclusion (and (<= (sin x) 1) (>= (sin x) -1))
72+
:conclusion (and (<= (sin x) 1/1) (>= (sin x) -1/1))
7373
)
7474

7575
; rule: arith_trans_sine_symmetry
@@ -81,7 +81,7 @@
8181
; sine is symmetric wrt the point 0.
8282
(declare-rule arith_trans_sine_symmetry ((x Real))
8383
:args (x)
84-
:conclusion (= (+ (sin x) (sin (* -1 x))) 0)
84+
:conclusion (= (+ (sin x) (sin (* -1/1 x))) 0/1)
8585
)
8686

8787
; rule: arith_trans_sine_tangent_zero
@@ -93,7 +93,7 @@
9393
; x is less than zero, sin is greater than x.
9494
(declare-rule arith_trans_sine_tangent_zero ((x Real))
9595
:args (x)
96-
:conclusion (and (=> (> x 0) (< (sin x) x)) (=> (< x 0) (> (sin x) x)))
96+
:conclusion (and (=> (> x 0/1) (< (sin x) x)) (=> (< x 0/1) (> (sin x) x)))
9797
)
9898

9999
; rule: arith_trans_sine_tangent_pi
@@ -105,5 +105,5 @@
105105
; x is less than pi, sin is less than pi minus x.
106106
(declare-rule arith_trans_sine_tangent_pi ((x Real))
107107
:args (x)
108-
:conclusion (and (=> (> x (* -1 real.pi)) (> (sin x) (- (* -1 real.pi) x))) (=> (< x real.pi) (< (sin x) (- real.pi x))))
108+
:conclusion (and (=> (> x (* -1/1 real.pi)) (> (sin x) (- (* -1/1 real.pi) x))) (=> (< x real.pi) (< (sin x) (- real.pi x))))
109109
)

src/theory/arith/nl/transcendental/exponential_solver.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ void ExponentialSolver::checkInitialRefine()
8181
// initial refinements
8282
if (d_tf_initial_refine.find(t) == d_tf_initial_refine.end())
8383
{
84-
Node zero = nm->mkConstInt(Rational(0));
85-
Node one = nm->mkConstInt(Rational(1));
84+
Node zero = nm->mkConstReal(Rational(0));
85+
Node one = nm->mkConstReal(Rational(1));
8686
d_tf_initial_refine[t] = true;
8787
{
8888
// exp is always positive: exp(t) > 0

src/theory/arith/nl/transcendental/proof_checker.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ Node TranscendentalProofRuleChecker::checkInternal(
8282
const std::vector<Node>& args)
8383
{
8484
NodeManager* nm = nodeManager();
85-
Node zero = nm->mkConstInt(Rational(0));
86-
Node one = nm->mkConstInt(Rational(1));
87-
Node mone = nm->mkConstInt(Rational(-1));
85+
Node zero = nm->mkConstReal(Rational(0));
86+
Node one = nm->mkConstReal(Rational(1));
87+
Node mone = nm->mkConstReal(Rational(-1));
8888
Node pi = nm->mkNullaryOperator(nm->realType(), Kind::PI);
8989
Node mpi = nm->mkNode(Kind::MULT, mone, pi);
9090
Trace("nl-trans-checker") << "Checking " << id << std::endl;

src/theory/arith/nl/transcendental/sine_solver.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -226,15 +226,20 @@ void SineSolver::checkInitialRefine()
226226
// initial refinements
227227
if (d_tf_initial_refine.find(t) == d_tf_initial_refine.end())
228228
{
229+
NodeManager * nm = nodeManager();
230+
Node zero = nm->mkConstReal(Rational(0));
231+
Node one = nm->mkConstReal(Rational(1));
232+
Node mone = nm->mkConstReal(Rational(-1));
233+
Node mpi = nm->mkNode(Kind::MULT, mone, d_pi);
229234
Trace("nl-ext-debug") << "Process initial refine " << t << std::endl;
230235
d_tf_initial_refine[t] = true;
231236
Assert(d_data->isPurified(t));
232237
{
233238
// sine bounds: -1 <= sin(t) <= 1
234239
Node lem = NodeManager::mkNode(
235240
Kind::AND,
236-
NodeManager::mkNode(Kind::LEQ, t, d_data->d_one),
237-
NodeManager::mkNode(Kind::GEQ, t, d_data->d_neg_one));
241+
NodeManager::mkNode(Kind::LEQ, t, one),
242+
NodeManager::mkNode(Kind::GEQ, t, mone));
238243
CDProof* proof = nullptr;
239244
if (d_data->isProofEnabled())
240245
{
@@ -252,11 +257,11 @@ void SineSolver::checkInitialRefine()
252257
Kind::AND,
253258
NodeManager::mkNode(
254259
Kind::IMPLIES,
255-
NodeManager::mkNode(Kind::GT, t[0], d_data->d_zero),
260+
NodeManager::mkNode(Kind::GT, t[0], zero),
256261
NodeManager::mkNode(Kind::LT, t, t[0])),
257262
NodeManager::mkNode(
258263
Kind::IMPLIES,
259-
NodeManager::mkNode(Kind::LT, t[0], d_data->d_zero),
264+
NodeManager::mkNode(Kind::LT, t[0], zero),
260265
NodeManager::mkNode(Kind::GT, t, t[0])));
261266
CDProof* proof = nullptr;
262267
if (d_data->isProofEnabled())
@@ -276,11 +281,11 @@ void SineSolver::checkInitialRefine()
276281
Kind::AND,
277282
NodeManager::mkNode(
278283
Kind::IMPLIES,
279-
NodeManager::mkNode(Kind::GT, t[0], d_neg_pi),
284+
NodeManager::mkNode(Kind::GT, t[0], mpi),
280285
NodeManager::mkNode(
281286
Kind::GT,
282287
t,
283-
NodeManager::mkNode(Kind::SUB, d_neg_pi, t[0]))),
288+
NodeManager::mkNode(Kind::SUB, mpi, t[0]))),
284289
NodeManager::mkNode(
285290
Kind::IMPLIES,
286291
NodeManager::mkNode(Kind::LT, t[0], d_pi),

test/regress/cli/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,6 +1153,7 @@ set(regress_0_tests
11531153
regress0/nl/nia-wrong-tl.smt2
11541154
regress0/nl/nlExtPurify-test.smt2
11551155
regress0/nl/nta/cos-sig-value.smt2
1156+
regress0/nl/nta/dd.mirko_example_01.k5.bound300.smt2
11561157
regress0/nl/nta/exp-n0.5-lb.smt2
11571158
regress0/nl/nta/exp-n0.5-ub.smt2
11581159
regress0/nl/nta/exp-neg2-unsat-unsound.smt2
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
; EXPECT: unsat
2+
(set-logic ALL)
3+
(declare-const x774336__fresh Bool)
4+
(declare-const x957672__fresh Bool)
5+
(declare-fun y2@3 () Real)
6+
(declare-fun t@3 () Real)
7+
(declare-fun y1@5 () Real)
8+
(declare-fun y2@5 () Real)
9+
(declare-fun t@4 () Real)
10+
(declare-fun t@5 () Real)
11+
(assert (let ((.def_7 false)) (let ((.def_15 false)) (let ((.def_26 false)) (let ((.def_28 false)) (let ((.def_32 false)) (let ((.def_39 false)) (let ((.def_40 false)) (let ((.def_41 false)) (let ((.def_42 false)) (let ((.def_43 false)) (let ((cos 0.0)) (let ((.def_45 0)) (let ((sin 0.0)) (let ((.def_47 0.0)) (let ((.def_48 0.0)) (let ((.def_51 0)) (let ((.def_52 0.0)) (let ((.def_53 0.0)) (let ((.def_54 false)) (let ((.def_56 0.0)) (let ((.def_57 0.0)) (let ((.def_58 false)) (let ((.def_59 false)) (let ((.def_60 false)) (let ((.def_61 false)) (let ((cos 0.0)) (let ((.def_70 1)) (let ((.def_75 (* t@4 (- 1.0)))) (let ((.def_76 (+ t@3 .def_75))) (let ((.def_77 (= .def_76 (- (/ 1 2))))) (let ((.def_78 false)) (let ((.def_79 .def_77)) (let ((.def_80 false)) (let ((.def_81 0.0)) (let ((.def_83 0.0)) (let ((.def_87 0.0)) (let ((.def_94 (* t@3 (- 1.0)))) (let ((.def_95 (+ 1.0 .def_94))) (let ((.def_96 (= .def_95 (- (/ 1 2))))) (let ((.def_97 .def_96)) (let ((.def_98 .def_97)) (let ((.def_99 .def_98)) (let ((.def_103 0.0)) (let ((.def_107 false)) (let ((.def_115 false)) (let ((.def_117 true)) (let ((.def_118 false)) (let ((.def_119 0.0)) (let ((.def_121 0.0)) (let ((.def_129 0.0)) (let ((.def_131 false)) (let ((.def_133 0.0)) (let ((.def_137 true)) (let ((cos 0.0)) (let ((.def_150 false)) (let ((.def_151 false)) (let ((.def_152 false)) (let ((.def_153 (and true true true .def_99 .def_79 (> (- 3.0) y1@5) (= .def_76 (+ t@4 (* t@5 (- 1.0)))) (= 0.0 (+ y1@5 (* 2.0 (sin t@5)) (* (- 2.0) (cos t@5))))))) (let ((.def_154 .def_153)) (let ((.def_155 false)) (let ((.def_156 false)) (let ((.def_157 false)) (let ((.def_158 false)) (let ((.def_159 false)) (let ((.def_160 false)) (let ((.def_161 false)) (let ((.def_162 false)) (let ((.def_163 false)) (let ((.def_164 false)) (let ((.def_165 false)) (let ((.def_166 false)) (let ((.def_167 false)) (let ((.def_168 false)) (let ((.def_169 false)) (let ((.def_170 false)) (let ((.def_171 false)) (let ((.def_172 false)) (let ((.def_173 false)) (let ((.def_174 false)) (let ((.def_175 false)) (let ((.def_176 false)) (let ((.def_177 false)) (let ((.def_178 false)) (let ((.def_179 false)) (let ((.def_180 false)) (let ((.def_181 false)) (let ((.def_182 false)) (let ((.def_183 false)) (let ((.def_184 false)) (let ((.def_185 false)) (let ((.def_186 false)) (let ((.def_187 false)) (let ((.def_188 false)) (let ((.def_189 false)) .def_154)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
12+
(check-sat)

0 commit comments

Comments
 (0)