GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/booleans/theory_bool.cpp Lines: 21 23 91.3 %
Date: 2021-11-07 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
using namespace cvc5::kind;
32
33
namespace cvc5 {
34
namespace theory {
35
namespace booleans {
36
37
15273
TheoryBool::TheoryBool(Env& env, OutputChannel& out, Valuation valuation)
38
15273
    : Theory(THEORY_BOOL, env, out, valuation)
39
{
40
15273
}
41
42
15286
Theory::PPAssertStatus TheoryBool::ppAssert(
43
    TrustNode tin, TrustSubstitutionMap& outSubstitutions)
44
{
45
30572
  TNode in = tin.getNode();
46
15286
  if (in.getKind() == kind::CONST_BOOLEAN && !in.getConst<bool>()) {
47
    // If we get a false literal, we're in conflict
48
    return PP_ASSERT_STATUS_CONFLICT;
49
  }
50
51
  // Add the substitution from the variable to its value
52
15286
  if (in.getKind() == kind::NOT) {
53
8026
    if (in[0].isVar())
54
    {
55
23349
      outSubstitutions.addSubstitutionSolved(
56
15566
          in[0], NodeManager::currentNM()->mkConst<bool>(false), tin);
57
7783
      return PP_ASSERT_STATUS_SOLVED;
58
    }
59
  } else {
60
7260
    if (in.isVar())
61
    {
62
15714
      outSubstitutions.addSubstitutionSolved(
63
10476
          in, NodeManager::currentNM()->mkConst<bool>(true), tin);
64
5238
      return PP_ASSERT_STATUS_SOLVED;
65
    }
66
  }
67
68
2265
  return Theory::ppAssert(tin, outSubstitutions);
69
}
70
71
1639061
TrustNode TheoryBool::ppRewrite(TNode n, std::vector<SkolemLemma>& lems)
72
{
73
1639061
  return TrustNode::null();
74
}
75
76
15273
TheoryRewriter* TheoryBool::getTheoryRewriter() { return &d_rewriter; }
77
78
7989
ProofRuleChecker* TheoryBool::getProofChecker() { return &d_checker; }
79
80
std::string TheoryBool::identify() const { return std::string("TheoryBool"); }
81
82
}  // namespace booleans
83
}  // namespace theory
84
31137
}  // namespace cvc5