GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/engine_output_channel.h Lines: 1 1 100.0 %
Date: 2021-05-22 Branches: 0 4 0.0 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Andrew Reynolds, Tim King, Haniel Barbosa
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 engine output channel.
14
 */
15
16
#include "cvc5_private.h"
17
18
#ifndef CVC5__THEORY__ENGINE_OUTPUT_CHANNEL_H
19
#define CVC5__THEORY__ENGINE_OUTPUT_CHANNEL_H
20
21
#include "expr/node.h"
22
#include "theory/output_channel.h"
23
#include "theory/theory_id.h"
24
#include "util/statistics_stats.h"
25
26
namespace cvc5 {
27
28
class TheoryEngine;
29
30
namespace theory {
31
32
class Theory;
33
34
/**
35
 * An output channel for Theory that passes messages back to a TheoryEngine
36
 * for a given Theory.
37
 *
38
 * Notice that it has interfaces trustedConflict and trustedLemma which are
39
 * used for ensuring that proof generators are associated with the lemmas
40
 * and conflicts sent on this output channel.
41
 */
42
246032
class EngineOutputChannel : public theory::OutputChannel
43
{
44
  friend class TheoryEngine;
45
46
 public:
47
  EngineOutputChannel(TheoryEngine* engine, theory::TheoryId theory);
48
49
  void safePoint(Resource r) override;
50
51
  void conflict(TNode conflictNode) override;
52
  bool propagate(TNode literal) override;
53
54
  void lemma(TNode lemma, LemmaProperty p = LemmaProperty::NONE) override;
55
56
  void splitLemma(TNode lemma, bool removable = false) override;
57
58
  void demandRestart() override;
59
60
  void requirePhase(TNode n, bool phase) override;
61
62
  void setIncomplete(IncompleteId id) override;
63
64
  void spendResource(Resource r) override;
65
66
  void handleUserAttribute(const char* attr, theory::Theory* t) override;
67
68
  /**
69
   * Let pconf be the pair (Node conf, ProofGenerator * pfg). This method
70
   * sends conf on the output channel of this class whose proof can be generated
71
   * by the generator pfg. Apart from pfg, the interface for this method is
72
   * the same as calling OutputChannel::lemma on conf.
73
   */
74
  void trustedConflict(TrustNode pconf) override;
75
  /**
76
   * Let plem be the pair (Node lem, ProofGenerator * pfg).
77
   * Send lem on the output channel of this class whose proof can be generated
78
   * by the generator pfg. Apart from pfg, the interface for this method is
79
   * the same as calling OutputChannel::lemma on lem.
80
   */
81
  void trustedLemma(TrustNode plem,
82
                    LemmaProperty p = LemmaProperty::NONE) override;
83
84
 protected:
85
  /**
86
   * Statistics for a particular theory.
87
   */
88
  class Statistics
89
  {
90
   public:
91
    Statistics(theory::TheoryId theory);
92
    /** Number of calls to conflict, propagate, lemma, requirePhase,
93
     * restartDemands */
94
    IntStat conflicts, propagations, lemmas, requirePhase, restartDemands,
95
        trustedConflicts, trustedLemmas;
96
  };
97
  /** The theory engine we're communicating with. */
98
  TheoryEngine* d_engine;
99
  /** The statistics of the theory interractions. */
100
  Statistics d_statistics;
101
  /** The theory owning this channel. */
102
  theory::TheoryId d_theory;
103
  /** A helper function for registering lemma recipes with the proof engine */
104
  void registerLemmaRecipe(Node lemma,
105
                           Node originalLemma,
106
                           bool preprocess,
107
                           theory::TheoryId theoryId);
108
};
109
110
}  // namespace theory
111
}  // namespace cvc5
112
113
#endif /* CVC5__THEORY__ENGINE_OUTPUT_CHANNEL_H */