summaryrefslogtreecommitdiff
path: root/src/proof/proof_output_channel.h
blob: e2958e8a507cd1da937c74fa58d9fdcdb18527af (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
66
67
68
69
70
71
72
73
74
75
76
77
78
/*********************                                                        */
/*! \file proof_output_channel.h
 ** \verbatim
 ** Top contributors (to current version):
 **   Guy Katz, Tim King
 ** This file is part of the CVC4 project.
 ** Copyright (c) 2009-2017 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
 **
 **/

#include "cvc4_private.h"

#ifndef __CVC4__PROOF_OUTPUT_CHANNEL_H
#define __CVC4__PROOF_OUTPUT_CHANNEL_H

#include <memory>
#include <set>
#include <unordered_set>

#include "expr/node.h"
#include "theory/output_channel.h"
#include "theory/theory.h"
#include "util/proof.h"

namespace CVC4 {

class ProofOutputChannel : public theory::OutputChannel {
 public:
  ProofOutputChannel();
  ~ProofOutputChannel() override {}

  /**
   * This may be called at most once per ProofOutputChannel.
   * Requires that `n` and `pf` are non-null.
   */
  void conflict(TNode n, std::unique_ptr<Proof> pf) override;
  bool propagate(TNode x) override;
  theory::LemmaStatus lemma(TNode n, ProofRule rule, bool, bool, bool) override;
  theory::LemmaStatus splitLemma(TNode, bool) override;
  void requirePhase(TNode n, bool b) override;
  bool flipDecision() override;
  void setIncomplete() override;

  /** Has conflict() has been called? */
  bool hasConflict() const { return !d_conflict.isNull(); }

  /**
   * Returns the proof passed into the conflict() call.
   * Requires hasConflict() to hold.
   */
  const Proof& getConflictProof() const;
  Node getLastLemma() const { return d_lemma; }

 private:
  Node d_conflict;
  std::unique_ptr<Proof> d_proof;
  Node d_lemma;
  std::set<Node> d_propagations;
}; /* class ProofOutputChannel */

class MyPreRegisterVisitor {
  theory::Theory* d_theory;
  std::unordered_set<TNode, TNodeHashFunction> d_visited;
public:
  typedef void return_type;
  MyPreRegisterVisitor(theory::Theory* theory);
  bool alreadyVisited(TNode current, TNode parent);
  void visit(TNode current, TNode parent);
  void start(TNode node);
  void done(TNode node);
}; /* class MyPreRegisterVisitor */

} /* CVC4 namespace */

#endif /* __CVC4__PROOF_OUTPUT_CHANNEL_H */
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback