1 |
|
/****************************************************************************** |
2 |
|
* Top contributors (to current version): |
3 |
|
* Aina Niemetz, Abdalrhman Mohamed, Mathias Preiner |
4 |
|
* |
5 |
|
* This file is part of the cvc5 project. |
6 |
|
* |
7 |
|
* Copyright (c) 2009-2021 by the authors listed in the file AUTHORS |
8 |
|
* in the top-level source directory and their institutional affiliations. |
9 |
|
* All rights reserved. See the file COPYING in the top-level source |
10 |
|
* directory for licensing information. |
11 |
|
* **************************************************************************** |
12 |
|
* |
13 |
|
* [[ Add one-line brief description here ]] |
14 |
|
* |
15 |
|
* [[ Add lengthier description here ]] |
16 |
|
* \todo document this file |
17 |
|
*/ |
18 |
|
|
19 |
|
#include <vector> |
20 |
|
|
21 |
|
#include "context/context.h" |
22 |
|
#include "expr/node.h" |
23 |
|
#include "test_smt.h" |
24 |
|
#include "theory/bv/theory_bv_utils.h" |
25 |
|
#include "theory/theory.h" |
26 |
|
#include "theory/theory_engine.h" |
27 |
|
|
28 |
|
namespace cvc5 { |
29 |
|
|
30 |
|
using namespace theory; |
31 |
|
using namespace theory::bv; |
32 |
|
using namespace theory::bv::utils; |
33 |
|
using namespace expr; |
34 |
|
using namespace context; |
35 |
|
|
36 |
|
namespace test { |
37 |
|
|
38 |
4 |
class TestTheoryWhiteBv : public TestSmtNoFinishInit |
39 |
|
{ |
40 |
|
}; |
41 |
|
|
42 |
10 |
TEST_F(TestTheoryWhiteBv, mkUmulo) |
43 |
|
{ |
44 |
2 |
d_slvEngine->setOption("incremental", "true"); |
45 |
32 |
for (uint32_t w = 1; w < 16; ++w) |
46 |
|
{ |
47 |
30 |
d_slvEngine->push(); |
48 |
60 |
Node x = d_nodeManager->mkVar("x", d_nodeManager->mkBitVectorType(w)); |
49 |
60 |
Node y = d_nodeManager->mkVar("y", d_nodeManager->mkBitVectorType(w)); |
50 |
|
|
51 |
60 |
Node zx = mkConcat(mkZero(w), x); |
52 |
60 |
Node zy = mkConcat(mkZero(w), y); |
53 |
60 |
Node mul = d_nodeManager->mkNode(kind::BITVECTOR_MULT, zx, zy); |
54 |
30 |
Node lhs = d_nodeManager->mkNode( |
55 |
60 |
kind::DISTINCT, mkExtract(mul, 2 * w - 1, w), mkZero(w)); |
56 |
60 |
Node rhs = mkUmulo(x, y); |
57 |
60 |
Node eq = d_nodeManager->mkNode(kind::DISTINCT, lhs, rhs); |
58 |
30 |
d_slvEngine->assertFormula(eq); |
59 |
60 |
Result res = d_slvEngine->checkSat(); |
60 |
30 |
ASSERT_EQ(res.isSat(), Result::UNSAT); |
61 |
30 |
d_slvEngine->pop(); |
62 |
|
} |
63 |
|
} |
64 |
|
} // namespace test |
65 |
6 |
} // namespace cvc5 |