1 |
|
/****************************************************************************** |
2 |
|
* Top contributors (to current version): |
3 |
|
* Gereon Kremer |
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 |
|
* Implementation of split zero check. |
14 |
|
*/ |
15 |
|
|
16 |
|
#include "theory/arith/nl/ext/split_zero_check.h" |
17 |
|
|
18 |
|
#include "expr/node.h" |
19 |
|
#include "proof/proof.h" |
20 |
|
#include "theory/arith/arith_msum.h" |
21 |
|
#include "theory/arith/inference_manager.h" |
22 |
|
#include "theory/arith/nl/ext/ext_state.h" |
23 |
|
#include "theory/arith/nl/nl_model.h" |
24 |
|
#include "theory/rewriter.h" |
25 |
|
|
26 |
|
namespace cvc5 { |
27 |
|
namespace theory { |
28 |
|
namespace arith { |
29 |
|
namespace nl { |
30 |
|
|
31 |
9700 |
SplitZeroCheck::SplitZeroCheck(ExtState* data) |
32 |
9700 |
: d_data(data), d_zero_split(d_data->d_env.getUserContext()) |
33 |
|
{ |
34 |
9700 |
} |
35 |
|
|
36 |
|
void SplitZeroCheck::check() |
37 |
|
{ |
38 |
|
for (unsigned i = 0; i < d_data->d_ms_vars.size(); i++) |
39 |
|
{ |
40 |
|
Node v = d_data->d_ms_vars[i]; |
41 |
|
if (d_zero_split.insert(v)) |
42 |
|
{ |
43 |
|
Node eq = Rewriter::rewrite(v.eqNode(d_data->d_zero)); |
44 |
|
Node lem = eq.orNode(eq.negate()); |
45 |
|
CDProof* proof = nullptr; |
46 |
|
if (d_data->isProofEnabled()) |
47 |
|
{ |
48 |
|
proof = d_data->getProof(); |
49 |
|
proof->addStep(lem, PfRule::SPLIT, {}, {eq}); |
50 |
|
} |
51 |
|
d_data->d_im.addPendingPhaseRequirement(eq, true); |
52 |
|
d_data->d_im.addPendingLemma( |
53 |
|
lem, InferenceId::ARITH_NL_SPLIT_ZERO, proof); |
54 |
|
} |
55 |
|
} |
56 |
|
} |
57 |
|
|
58 |
|
} // namespace nl |
59 |
|
} // namespace arith |
60 |
|
} // namespace theory |
61 |
31125 |
} // namespace cvc5 |