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 |
9853 |
TheoryBool::TheoryBool(context::Context* c, |
36 |
|
context::UserContext* u, |
37 |
|
OutputChannel& out, |
38 |
|
Valuation valuation, |
39 |
|
const LogicInfo& logicInfo, |
40 |
9853 |
ProofNodeManager* pnm) |
41 |
9853 |
: Theory(THEORY_BOOL, c, u, out, valuation, logicInfo, pnm) |
42 |
|
{ |
43 |
9853 |
} |
44 |
|
|
45 |
35932 |
Theory::PPAssertStatus TheoryBool::ppAssert( |
46 |
|
TrustNode tin, TrustSubstitutionMap& outSubstitutions) |
47 |
|
{ |
48 |
71864 |
TNode in = tin.getNode(); |
49 |
35932 |
if (in.getKind() == kind::CONST_BOOLEAN && !in.getConst<bool>()) { |
50 |
|
// If we get a false literal, we're in conflict |
51 |
|
return PP_ASSERT_STATUS_CONFLICT; |
52 |
|
} |
53 |
|
|
54 |
|
// Add the substitution from the variable to its value |
55 |
35932 |
if (in.getKind() == kind::NOT) { |
56 |
22007 |
if (in[0].isVar()) |
57 |
|
{ |
58 |
65850 |
outSubstitutions.addSubstitutionSolved( |
59 |
43900 |
in[0], NodeManager::currentNM()->mkConst<bool>(false), tin); |
60 |
21950 |
return PP_ASSERT_STATUS_SOLVED; |
61 |
|
} |
62 |
|
} else { |
63 |
13925 |
if (in.isVar()) |
64 |
|
{ |
65 |
39555 |
outSubstitutions.addSubstitutionSolved( |
66 |
26370 |
in, NodeManager::currentNM()->mkConst<bool>(true), tin); |
67 |
13185 |
return PP_ASSERT_STATUS_SOLVED; |
68 |
|
} |
69 |
|
} |
70 |
|
|
71 |
797 |
return Theory::ppAssert(tin, outSubstitutions); |
72 |
|
} |
73 |
|
|
74 |
9853 |
TheoryRewriter* TheoryBool::getTheoryRewriter() { return &d_rewriter; } |
75 |
|
|
76 |
3768 |
ProofRuleChecker* TheoryBool::getProofChecker() { return &d_checker; } |
77 |
|
|
78 |
|
std::string TheoryBool::identify() const { return std::string("TheoryBool"); } |
79 |
|
|
80 |
|
} // namespace booleans |
81 |
|
} // namespace theory |
82 |
29340 |
} // namespace cvc5 |