GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/booleans/theory_bool.cpp Lines: 20 22 90.9 %
Date: 2021-05-22 Branches: 33 68 48.5 %

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 "expr/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
9459
TheoryBool::TheoryBool(context::Context* c,
36
                       context::UserContext* u,
37
                       OutputChannel& out,
38
                       Valuation valuation,
39
                       const LogicInfo& logicInfo,
40
9459
                       ProofNodeManager* pnm)
41
9459
    : Theory(THEORY_BOOL, c, u, out, valuation, logicInfo, pnm)
42
{
43
9459
}
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
22016
    if (in[0].isVar())
57
    {
58
65892
      outSubstitutions.addSubstitutionSolved(
59
43928
          in[0], NodeManager::currentNM()->mkConst<bool>(false), tin);
60
21964
      return PP_ASSERT_STATUS_SOLVED;
61
    }
62
  } else {
63
13916
    if (in.isVar())
64
    {
65
39525
      outSubstitutions.addSubstitutionSolved(
66
26350
          in, NodeManager::currentNM()->mkConst<bool>(true), tin);
67
13175
      return PP_ASSERT_STATUS_SOLVED;
68
    }
69
  }
70
71
793
  return Theory::ppAssert(tin, outSubstitutions);
72
}
73
74
9459
TheoryRewriter* TheoryBool::getTheoryRewriter() { return &d_rewriter; }
75
76
3600
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
28191
}  // namespace cvc5