1 |
|
/****************************************************************************** |
2 |
|
* Top contributors (to current version): |
3 |
|
* Andrew Reynolds, Morgan Deters, Dejan Jovanovic |
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 |
|
* The theory of booleans. |
14 |
|
*/ |
15 |
|
|
16 |
|
#include "theory/booleans/theory_bool.h" |
17 |
|
|
18 |
|
#include <stack> |
19 |
|
#include <vector> |
20 |
|
|
21 |
|
#include "proof/proof_node_manager.h" |
22 |
|
#include "smt_util/boolean_simplification.h" |
23 |
|
#include "theory/booleans/circuit_propagator.h" |
24 |
|
#include "theory/booleans/theory_bool_rewriter.h" |
25 |
|
#include "theory/substitutions.h" |
26 |
|
#include "theory/theory.h" |
27 |
|
#include "theory/trust_substitutions.h" |
28 |
|
#include "theory/valuation.h" |
29 |
|
#include "util/hash.h" |
30 |
|
|
31 |
|
namespace cvc5 { |
32 |
|
namespace theory { |
33 |
|
namespace booleans { |
34 |
|
|
35 |
9927 |
TheoryBool::TheoryBool(Env& env, OutputChannel& out, Valuation valuation) |
36 |
9927 |
: Theory(THEORY_BOOL, env, out, valuation) |
37 |
|
{ |
38 |
9927 |
} |
39 |
|
|
40 |
35906 |
Theory::PPAssertStatus TheoryBool::ppAssert( |
41 |
|
TrustNode tin, TrustSubstitutionMap& outSubstitutions) |
42 |
|
{ |
43 |
71812 |
TNode in = tin.getNode(); |
44 |
35906 |
if (in.getKind() == kind::CONST_BOOLEAN && !in.getConst<bool>()) { |
45 |
|
// If we get a false literal, we're in conflict |
46 |
|
return PP_ASSERT_STATUS_CONFLICT; |
47 |
|
} |
48 |
|
|
49 |
|
// Add the substitution from the variable to its value |
50 |
35906 |
if (in.getKind() == kind::NOT) { |
51 |
22004 |
if (in[0].isVar()) |
52 |
|
{ |
53 |
65844 |
outSubstitutions.addSubstitutionSolved( |
54 |
43896 |
in[0], NodeManager::currentNM()->mkConst<bool>(false), tin); |
55 |
21948 |
return PP_ASSERT_STATUS_SOLVED; |
56 |
|
} |
57 |
|
} else { |
58 |
13902 |
if (in.isVar()) |
59 |
|
{ |
60 |
39549 |
outSubstitutions.addSubstitutionSolved( |
61 |
26366 |
in, NodeManager::currentNM()->mkConst<bool>(true), tin); |
62 |
13183 |
return PP_ASSERT_STATUS_SOLVED; |
63 |
|
} |
64 |
|
} |
65 |
|
|
66 |
775 |
return Theory::ppAssert(tin, outSubstitutions); |
67 |
|
} |
68 |
|
|
69 |
9927 |
TheoryRewriter* TheoryBool::getTheoryRewriter() { return &d_rewriter; } |
70 |
|
|
71 |
3784 |
ProofRuleChecker* TheoryBool::getProofChecker() { return &d_checker; } |
72 |
|
|
73 |
|
std::string TheoryBool::identify() const { return std::string("TheoryBool"); } |
74 |
|
|
75 |
|
} // namespace booleans |
76 |
|
} // namespace theory |
77 |
29505 |
} // namespace cvc5 |