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 |
|
* Datatypes inference. |
14 |
|
*/ |
15 |
|
|
16 |
|
#include "cvc5_private.h" |
17 |
|
|
18 |
|
#ifndef CVC5__THEORY__DATATYPES__INFERENCE_H |
19 |
|
#define CVC5__THEORY__DATATYPES__INFERENCE_H |
20 |
|
|
21 |
|
#include "expr/node.h" |
22 |
|
#include "proof/trust_node.h" |
23 |
|
#include "theory/inference_id.h" |
24 |
|
#include "theory/theory_inference.h" |
25 |
|
|
26 |
|
namespace cvc5 { |
27 |
|
namespace theory { |
28 |
|
namespace datatypes { |
29 |
|
|
30 |
|
class InferenceManager; |
31 |
|
|
32 |
|
/** |
33 |
|
* A custom inference class. The main feature of this class is that it |
34 |
|
* dynamically decides whether to process itself as a fact or as a lemma, |
35 |
|
* based on the mustCommunicateFact method below. |
36 |
|
*/ |
37 |
522280 |
class DatatypesInference : public SimpleTheoryInternalFact |
38 |
|
{ |
39 |
|
public: |
40 |
|
DatatypesInference(InferenceManager* im, |
41 |
|
Node conc, |
42 |
|
Node exp, |
43 |
|
InferenceId i = InferenceId::UNKNOWN); |
44 |
|
/** |
45 |
|
* Must communicate fact method. |
46 |
|
* The datatypes decision procedure makes "internal" inferences : |
47 |
|
* (1) Unification : C( t1...tn ) = C( s1...sn ) => ti = si |
48 |
|
* (2) Label : ~is_C1(t) ... ~is_C{i-1}(t) ~is_C{i+1}(t) ... ~is_Cn(t) => |
49 |
|
* is_Ci( t ) |
50 |
|
* (3) Instantiate : is_C( t ) => t = C( sel_1( t ) ... sel_n( t ) ) |
51 |
|
* (4) collapse selector : S( C( t1...tn ) ) = t' |
52 |
|
* (5) collapse term size : size( C( t1...tn ) ) = 1 + size( t1 ) + ... + |
53 |
|
* size( tn ) |
54 |
|
* (6) non-negative size : 0 <= size(t) |
55 |
|
* This method returns true if the fact must be sent out as a lemma. If it |
56 |
|
* returns false, then we assert the fact internally. We return true for (6) |
57 |
|
* and OR conclusions. We also return true if the option dtInferAsLemmas is |
58 |
|
* set to true. |
59 |
|
*/ |
60 |
|
static bool mustCommunicateFact(Node n, Node exp); |
61 |
|
/** Process lemma */ |
62 |
|
TrustNode processLemma(LemmaProperty& p) override; |
63 |
|
/** Process internal fact */ |
64 |
|
Node processFact(std::vector<Node>& exp, ProofGenerator*& pg) override; |
65 |
|
|
66 |
|
private: |
67 |
|
/** Pointer to the inference manager */ |
68 |
|
InferenceManager* d_im; |
69 |
|
}; |
70 |
|
|
71 |
|
} // namespace datatypes |
72 |
|
} // namespace theory |
73 |
|
} // namespace cvc5 |
74 |
|
|
75 |
|
#endif |