GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/booleans/theory_bool.cpp Lines: 19 21 90.5 %
Date: 2021-09-17 Branches: 33 66 50.0 %

Line Exec Source
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
9942
TheoryBool::TheoryBool(Env& env, OutputChannel& out, Valuation valuation)
36
9942
    : Theory(THEORY_BOOL, env, out, valuation)
37
{
38
9942
}
39
40
36006
Theory::PPAssertStatus TheoryBool::ppAssert(
41
    TrustNode tin, TrustSubstitutionMap& outSubstitutions)
42
{
43
72012
  TNode in = tin.getNode();
44
36006
  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
36006
  if (in.getKind() == kind::NOT) {
51
22036
    if (in[0].isVar())
52
    {
53
65955
      outSubstitutions.addSubstitutionSolved(
54
43970
          in[0], NodeManager::currentNM()->mkConst<bool>(false), tin);
55
21985
      return PP_ASSERT_STATUS_SOLVED;
56
    }
57
  } else {
58
13970
    if (in.isVar())
59
    {
60
39606
      outSubstitutions.addSubstitutionSolved(
61
26404
          in, NodeManager::currentNM()->mkConst<bool>(true), tin);
62
13202
      return PP_ASSERT_STATUS_SOLVED;
63
    }
64
  }
65
66
819
  return Theory::ppAssert(tin, outSubstitutions);
67
}
68
69
9942
TheoryRewriter* TheoryBool::getTheoryRewriter() { return &d_rewriter; }
70
71
3796
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
29577
}  // namespace cvc5