This PR relates to #4987 .
Our plan is to:
delete the model keyword (done in #5415 )
avoid printing extra declarations by default (done in #5432 )
wrap UF values with as expressions.
This PR does step 3, fixes a regression accordingly, and adds the formula from #4987 and a variant of it to the regressions.
category = "regular"
long = "model-u-print=MODE"
type = "ModelUninterpPrintMode"
- default = "DeclFun"
+ default = "None"
read_only = true
help = "determines how to print uninterpreted elements in models"
help_mode = "uninterpreted elements in models printing modes."
help = "print uninterpreted elements declare-fun, and also include a declare-sort for the sort"
[[option.mode.DeclFun]]
name = "decl-fun"
- help = "(default) print uninterpreted elements declare-fun, but don't include a declare-sort for the sort"
+ help = "print uninterpreted elements declare-fun, but don't include a declare-sort for the sort"
+[[option.mode.None]]
+ name = "none"
+ help = "(default) do not print declarations of uninterpreted elements in models."
+
[[option]]
name = "modelWitnessValue"
case kind::UNINTERPRETED_CONSTANT: {
const UninterpretedConstant& uc = n.getConst<UninterpretedConstant>();
std::stringstream ss;
- ss << '@' << uc;
- out << CVC4::quoteSymbol(ss.str());
+ ss << "(as @" << uc << " " << n.getType() << ")";
+ out << ss.str();
break;
}
{
if (trn.isVar())
{
- out << "(declare-fun " << quoteSymbol(trn) << " () " << tn << ")" << endl;
+ if (options::modelUninterpPrint()
+ == options::ModelUninterpPrintMode::DeclSortAndFun
+ || options::modelUninterpPrint()
+ == options::ModelUninterpPrintMode::DeclFun)
+ {
+ out << "(declare-fun " << quoteSymbol(trn) << " () " << tn << ")"
+ << endl;
+ }
}
else
{
regress0/logops.04.cvc
regress0/logops.05.cvc
regress0/model-core.smt2
+ regress0/models-print-1.smt2
+ regress0/models-print-2.smt2
regress0/named-expr-use.smt2
regress0/nl/coeff-sat.smt2
regress0/nl/ext-rew-aggr-test.smt2
--- /dev/null
+; the purpose of this test is to verify that there are no redundant `declare-fun`s
+
+; EXIT: 0
+; SCRUBBER: grep declare-fun
+(set-logic QF_UF)
+(set-option :produce-models true)
+(declare-sort Sort0 0)
+(declare-fun f1 (Sort0) Bool)
+(check-sat)
+(get-model)
--- /dev/null
+; the purpose of this test is to verify that there is a `as` term in the output.
+; the scrubber excludes all lines without "(as @", and replaces this pattern by "AS".
+
+; SCRUBBER: sed -e 's/.*(as @.*/AS/; /sat/d; /cardinality/d; /^($/d; /^)$/d'
+; EXPECT: AS
+(set-logic QF_UF)
+(set-option :produce-models true)
+(declare-sort Sort0 0)
+(declare-fun f1 () Sort0)
+(check-sat)
+(get-model)
+; COMMAND-LINE: --model-u-print=decl-fun
; EXPECT: (declare-fun gt () us_image)
; EXPECT: (declare-fun gt () ||)
; SCRUBBER: sed -e '/declare-fun/!d; s/declare-fun [^[:space:]]*/declare-fun gt/g'