1 /********************* */
4 ** Top contributors (to current version):
5 ** Andrew Reynolds, Morgan Deters, Mathias Preiner
6 ** This file is part of the CVC4 project.
7 ** Copyright (c) 2009-2020 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.\endverbatim
15 #include "cvc4_private.h"
23 #include "expr/expr.h"
24 #include "theory/theory_model.h"
25 #include "util/cardinality.h"
35 std::ostream
& operator<<(std::ostream
&, const Model
&);
38 * This is the SMT-level model object, that is responsible for maintaining
39 * the necessary information for how to print the model, as well as
40 * holding a pointer to the underlying implementation of the theory model.
42 * The model declarations maintained by this class are context-independent
43 * and should be updated when this model is printed.
46 friend std::ostream
& operator<<(std::ostream
&, const Model
&);
47 friend class ::CVC4::SmtEngine
;
51 Model(theory::TheoryModel
* tm
);
52 /** virtual destructor */
54 /** get the input name (file name, etc.) this model is associated to */
55 std::string
getInputName() const { return d_inputName
; }
57 * Returns true if this model is guaranteed to be a model of the input
58 * formula. Notice that when CVC4 answers "unknown", it may have a model
59 * available for which this method returns false. In this case, this model is
60 * only a candidate solution.
62 bool isKnownSat() const { return d_isKnownSat
; }
63 /** Get the underlying theory model */
64 theory::TheoryModel
* getTheoryModel();
65 /** Get the underlying theory model (const version) */
66 const theory::TheoryModel
* getTheoryModel() const;
67 //----------------------- helper methods in the underlying theory model
68 /** Is the node n a model core symbol? */
69 bool isModelCoreSymbol(TNode sym
) const;
71 Node
getValue(TNode n
) const;
72 /** Does this model have approximations? */
73 bool hasApproximations() const;
74 //----------------------- end helper methods
75 //----------------------- model declarations
76 /** Clear the current model declarations. */
77 void clearModelDeclarations();
79 * Set that tn is a sort that should be printed in the model, when applicable,
80 * based on the output language.
82 void addDeclarationSort(TypeNode tn
);
84 * Set that n is a variable that should be printed in the model, when
85 * applicable, based on the output language.
87 void addDeclarationTerm(Node n
);
88 /** get declared sorts */
89 const std::vector
<TypeNode
>& getDeclaredSorts() const;
90 /** get declared terms */
91 const std::vector
<Node
>& getDeclaredTerms() const;
92 //----------------------- end model declarations
94 /** the input name (file name, etc.) this model is associated to */
95 std::string d_inputName
;
97 * Flag set to false if the model is associated with an "unknown" response
102 * Pointer to the underlying theory model, which maintains all data regarding
103 * the values of sorts and terms.
105 theory::TheoryModel
* d_tmodel
;
107 * The list of types to print, generally corresponding to declare-sort
110 std::vector
<TypeNode
> d_declareSorts
;
112 * The list of terms to print, is typically one-to-one with declare-fun
115 std::vector
<Node
> d_declareTerms
;
119 }/* CVC4 namespace */
121 #endif /* CVC4__MODEL_H */