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

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Andrew Reynolds, Gereon Kremer
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
 * Inference to proof conversion for datatypes.
14
 */
15
16
#include "cvc5_private.h"
17
18
#ifndef CVC5__THEORY__DATATYPES__INFER_PROOF_CONS_H
19
#define CVC5__THEORY__DATATYPES__INFER_PROOF_CONS_H
20
21
#include "context/cdhashmap.h"
22
#include "expr/node.h"
23
#include "expr/proof_generator.h"
24
#include "theory/datatypes/inference.h"
25
26
namespace cvc5 {
27
28
class ProofNodeManager;
29
30
namespace theory {
31
namespace datatypes {
32
33
/**
34
 * Converts between the datatype-specific (untrustworthy) DatatypesInference
35
 * class and information about how to construct a trustworthy proof step
36
 * (PfRule, children, args). It acts as a (lazy) proof generator where the
37
 * former is registered via notifyFact and the latter is asked for in
38
 * getProofFor, typically by the proof equality engine.
39
 *
40
 * The main (private) method of this class is convert below, which is
41
 * called when we need to construct a proof node from an InferInfo.
42
 */
43
class InferProofCons : public ProofGenerator
44
{
45
  typedef context::CDHashMap<Node, std::shared_ptr<DatatypesInference>>
46
      NodeDatatypesInferenceMap;
47
48
 public:
49
  InferProofCons(context::Context* c, ProofNodeManager* pnm);
50
3284
  ~InferProofCons() {}
51
  /**
52
   * This is called to notify that di is an inference that may need a proof
53
   * in the future.
54
   *
55
   * In detail, this class should be prepared to respond to a call to:
56
   *   getProofFor(di.d_conc)
57
   * in the remainder of the SAT context. This method copies di and stores it
58
   * in the context-dependent map d_lazyFactMap below.
59
   *
60
   * This is used for lazy proof construction, where proofs are constructed
61
   * only for facts that are explained.
62
   */
63
  void notifyFact(const std::shared_ptr<DatatypesInference>& di);
64
65
  /**
66
   * This returns the proof for fact. This is required for using this class as
67
   * a lazy proof generator.
68
   *
69
   * It should be the case that a call was made to notifyFact(di) where
70
   * di.d_conc is fact in this SAT context.
71
   */
72
  std::shared_ptr<ProofNode> getProofFor(Node fact) override;
73
  /** Identify this generator (for debugging, etc..) */
74
  virtual std::string identify() const override;
75
76
 private:
77
  /** convert
78
   *
79
   * This method is called when the theory of strings makes an inference
80
   * described by an InferInfo, whose fields are given by the first four
81
   * arguments of this method.
82
   *
83
   * This method converts this call to instructions on what the proof rule
84
   * step(s) are for concluding the conclusion of the inference. This
85
   * information is stored in cdp.
86
   */
87
  void convert(InferenceId infer, TNode conc, TNode exp, CDProof* cdp);
88
  /** A dummy context used by this class if none is provided */
89
  context::Context d_context;
90
  /** the proof node manager */
91
  ProofNodeManager* d_pnm;
92
  /** The lazy fact map */
93
  NodeDatatypesInferenceMap d_lazyFactMap;
94
};
95
96
}  // namespace datatypes
97
}  // namespace theory
98
}  // namespace cvc5
99
100
#endif /* CVC5__THEORY__DATATYPES__INFER_PROOF_CONS_H */