os << paren.str();
}
-void LFSCTheoryProofEngine::printTheoryTerm(Expr term, std::ostream& os, const ProofLetMap& map) {
+void LFSCTheoryProofEngine::printTheoryTermAsType(Expr term,
+ std::ostream& os,
+ const ProofLetMap& map,
+ TypeNode expectedType)
+{
theory::TheoryId theory_id = theory::Theory::theoryOf(term);
// boolean terms and ITEs are special because they
}
}
-void LFSCTheoryProofEngine::printBoundTerm(Expr term, std::ostream& os, const ProofLetMap& map) {
+void LFSCTheoryProofEngine::printBoundTermAsType(Expr term,
+ std::ostream& os,
+ const ProofLetMap& map,
+ TypeNode expectedType)
+{
Debug("pf::tp") << "LFSCTheoryProofEngine::printBoundTerm( " << term << " ) " << std::endl;
ProofLetMap::const_iterator it = map.find(term);
}
}
-void LFSCTheoryProofEngine::printCoreTerm(Expr term, std::ostream& os, const ProofLetMap& map) {
+void LFSCTheoryProofEngine::printCoreTerm(Expr term,
+ std::ostream& os,
+ const ProofLetMap& map,
+ Type expectedType)
+{
if (term.isVariable()) {
os << ProofManager::sanitize(term);
return;
default: Unhandled() << k;
}
-
}
void TheoryProof::printTheoryLemmaProof(std::vector<Expr>& lemma,
os << "(negsymm _ _ _ t_t_neq_f)";
}
-void LFSCBooleanProof::printOwnedTerm(Expr term, std::ostream& os, const ProofLetMap& map) {
+void LFSCBooleanProof::printOwnedTermAsType(Expr term,
+ std::ostream& os,
+ const ProofLetMap& map,
+ TypeNode expectedType)
+{
Assert(term.getType().isBoolean());
if (term.isVariable()) {
os << ProofManager::sanitize(term);
default: Unhandled() << k;
}
-
}
void LFSCBooleanProof::printOwnedSort(Type type, std::ostream& os) {
#include <unordered_set>
#include "expr/expr.h"
+#include "expr/type_node.h"
#include "proof/clause_id.h"
#include "proof/proof_utils.h"
#include "prop/sat_solver_types.h"
* @param os
*/
virtual void printLetTerm(Expr term, std::ostream& os) = 0;
- virtual void printBoundTerm(Expr term, std::ostream& os,
- const ProofLetMap& map) = 0;
+
+ /**
+ * Print a term in some (core or non-core) theory
+ *
+ * @param term expression representing term
+ * @param os output stream
+ * @param expectedType The type that this is expected to have in a parent
+ * node. Null if there are no such requirements. This is useful for requesting
+ * type conversions from the theory. e.g. in (5.5 == 4) the right-hand-side
+ * should be converted to a real.
+ *
+ * The first version of this function has a default value for expectedType
+ * (null) The second version is virtual.
+ *
+ * They are split to avoid mixing virtual function and default argument
+ * values, which behave weirdly when combined.
+ */
+ void printBoundTerm(Expr term,
+ std::ostream& os,
+ const ProofLetMap& map,
+ TypeNode expectedType = TypeNode())
+ {
+ this->printBoundTermAsType(term, os, map, expectedType);
+ }
+ virtual void printBoundTermAsType(Expr term,
+ std::ostream& os,
+ const ProofLetMap& map,
+ TypeNode expectedType) = 0;
/**
* Print the proof representation of the given sort.
void printConstantDisequalityProof(std::ostream& os, Expr c1, Expr c2, const ProofLetMap &globalLetMap);
- virtual void printTheoryTerm(Expr term, std::ostream& os, const ProofLetMap& map) = 0;
+ /**
+ * Print a term in some non-core theory
+ *
+ * @param term expression representing term
+ * @param os output stream
+ * @param expectedType The type that this is expected to have in a parent
+ * node. Null if there are no such requirements. This is useful for requesting
+ * type conversions from the theory. e.g. in (5.5 == 4) the right-hand-side
+ * should be converted to a real.
+ *
+ * The first version of this function has a default value for expectedType
+ * (null) The second version is virtual.
+ *
+ * They are split to avoid mixing virtual function and default argument
+ * values, which behave weirdly when combined.
+ */
+ void printTheoryTerm(Expr term,
+ std::ostream& os,
+ const ProofLetMap& map,
+ TypeNode expectedType = TypeNode())
+ {
+ this->printTheoryTermAsType(term, os, map, expectedType);
+ }
+ virtual void printTheoryTermAsType(Expr term,
+ std::ostream& os,
+ const ProofLetMap& map,
+ TypeNode expectedType) = 0;
bool printsAsBool(const Node &n);
};
LFSCTheoryProofEngine()
: TheoryProofEngine() {}
- void printTheoryTerm(Expr term,
- std::ostream& os,
- const ProofLetMap& map) override;
+ void printTheoryTermAsType(Expr term,
+ std::ostream& os,
+ const ProofLetMap& map,
+ TypeNode expectedType) override;
void registerTermsFromAssertions() override;
void printSortDeclarations(std::ostream& os, std::ostream& paren);
void printTermDeclarations(std::ostream& os, std::ostream& paren);
- void printCoreTerm(Expr term, std::ostream& os, const ProofLetMap& map);
+ void printCoreTerm(Expr term,
+ std::ostream& os,
+ const ProofLetMap& map,
+ Type expectedType = Type());
void printLetTerm(Expr term, std::ostream& os) override;
- void printBoundTerm(Expr term,
- std::ostream& os,
- const ProofLetMap& map) override;
+ void printBoundTermAsType(Expr term,
+ std::ostream& os,
+ const ProofLetMap& map,
+ TypeNode expectedType) override;
void printAssertions(std::ostream& os, std::ostream& paren) override;
void printLemmaRewrites(NodePairSet& rewrites,
std::ostream& os,
*
* @param term expression representing term
* @param os output stream
+ * @param expectedType The type that this is expected to have in a parent
+ * node. Null if there are no such requirements. This is useful for requesting
+ * type conversions from the theory. e.g. in (5.5 == 4) the right-hand-side
+ * should be converted to a real.
+ *
+ * The first version of this function has a default value for expectedType
+ * (null) The second version is virtual.
+ *
+ * They are split to avoid mixing virtual function and default argument
+ * values, which behave weirdly when combined.
*/
- virtual void printOwnedTerm(Expr term, std::ostream& os, const ProofLetMap& map) = 0;
+ void printOwnedTerm(Expr term,
+ std::ostream& os,
+ const ProofLetMap& map,
+ TypeNode expectedType = TypeNode())
+ {
+ this->printOwnedTermAsType(term, os, map, expectedType);
+ }
+ virtual void printOwnedTermAsType(Expr term,
+ std::ostream& os,
+ const ProofLetMap& map,
+ TypeNode expectedType) = 0;
+
/**
* Print the proof representation of the given type that belongs to some theory.
*
LFSCBooleanProof(TheoryProofEngine* proofEngine)
: BooleanProof(proofEngine)
{}
- void printOwnedTerm(Expr term,
- std::ostream& os,
- const ProofLetMap& map) override;
+ void printOwnedTermAsType(Expr term,
+ std::ostream& os,
+ const ProofLetMap& map,
+ TypeNode ty) override;
void printOwnedSort(Type type, std::ostream& os) override;
void printTheoryLemmaProof(std::vector<Expr>& lemma,
std::ostream& os,