summaryrefslogtreecommitdiff
path: root/src/theory/theory_inference.cpp
blob: 38e01eea5f5ecaadd056b0d9892d75a8df3be6bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*********************                                                        */
/*! \file theory_inference.cpp
 ** \verbatim
 ** Top contributors (to current version):
 **   Andrew Reynolds
 ** This file is part of the CVC4 project.
 ** Copyright (c) 2009-2020 by the authors listed in the file AUTHORS
 ** in the top-level source directory) and their institutional affiliations.
 ** All rights reserved.  See the file COPYING in the top-level source
 ** directory for licensing information.\endverbatim
 **
 ** \brief The theory inference utility
 **/

#include "theory/theory_inference.h"

#include "theory/theory_inference_manager.h"

using namespace CVC4::kind;

namespace CVC4 {
namespace theory {

SimpleTheoryLemma::SimpleTheoryLemma(Node n,
                                     LemmaProperty p,
                                     ProofGenerator* pg)
    : d_node(n), d_property(p), d_pg(pg)
{
}

bool SimpleTheoryLemma::process(TheoryInferenceManager* im, bool asLemma)
{
  Assert(!d_node.isNull());
  Assert(asLemma);
  // send (trusted) lemma on the output channel with property p
  return im->trustedLemma(TrustNode::mkTrustLemma(d_node, d_pg), d_property);
}

SimpleTheoryInternalFact::SimpleTheoryInternalFact(Node conc,
                                                   Node exp,
                                                   ProofGenerator* pg)
    : d_conc(conc), d_exp(exp), d_pg(pg)
{
}

bool SimpleTheoryInternalFact::process(TheoryInferenceManager* im, bool asLemma)
{
  Assert(!asLemma);
  bool polarity = d_conc.getKind() != NOT;
  TNode atom = polarity ? d_conc : d_conc[0];
  // no double negation or conjunctive conclusions
  Assert(atom.getKind() != NOT && atom.getKind() != AND);
  if (d_pg != nullptr)
  {
    im->assertInternalFact(atom, polarity, {d_exp}, d_pg);
  }
  else
  {
    im->assertInternalFact(atom, polarity, d_exp);
  }
  return true;
}

}  // namespace theory
}  // namespace CVC4
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback