GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/theory/engine_output_channel.h Lines: 1 1 100.0 %
Date: 2021-08-16 Branches: 0 0 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
256250
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 demandRestart() override;
57
58
  void requirePhase(TNode n, bool phase) override;
59
60
  void setIncomplete(IncompleteId id) override;
61
62
  void spendResource(Resource r) override;
63
64
  void handleUserAttribute(const char* attr, theory::Theory* t) override;
65
66
  /**
67
   * Let pconf be the pair (Node conf, ProofGenerator * pfg). This method
68
   * sends conf on the output channel of this class whose proof can be generated
69
   * by the generator pfg. Apart from pfg, the interface for this method is
70
   * the same as calling OutputChannel::lemma on conf.
71
   */
72
  void trustedConflict(TrustNode pconf) override;
73
  /**
74
   * Let plem be the pair (Node lem, ProofGenerator * pfg).
75
   * Send lem on the output channel of this class whose proof can be generated
76
   * by the generator pfg. Apart from pfg, the interface for this method is
77
   * the same as calling OutputChannel::lemma on lem.
78
   */
79
  void trustedLemma(TrustNode plem,
80
                    LemmaProperty p = LemmaProperty::NONE) override;
81
82
 protected:
83
  /**
84
   * Statistics for a particular theory.
85
   */
86
  class Statistics
87
  {
88
   public:
89
    Statistics(theory::TheoryId theory);
90
    /** Number of calls to conflict, propagate, lemma, requirePhase,
91
     * restartDemands */
92
    IntStat conflicts, propagations, lemmas, requirePhase, restartDemands,
93
        trustedConflicts, trustedLemmas;
94
  };
95
  /** The theory engine we're communicating with. */
96
  TheoryEngine* d_engine;
97
  /** The statistics of the theory interractions. */
98
  Statistics d_statistics;
99
  /** The theory owning this channel. */
100
  theory::TheoryId d_theory;
101
  /** A helper function for registering lemma recipes with the proof engine */
102
  void registerLemmaRecipe(Node lemma,
103
                           Node originalLemma,
104
                           bool preprocess,
105
                           theory::TheoryId theoryId);
106
};
107
108
}  // namespace theory
109
}  // namespace cvc5
110
111
#endif /* CVC5__THEORY__ENGINE_OUTPUT_CHANNEL_H */