This prints # instantiations per round (during solving) for each quantified formula with `--debug-inst`, giving output like this:
```
(num-instantiations myQuant1 1)
(num-instantiations myQuant2 1)
unsat
```
It also changes the default value of print-inst-full to match the behavior of unsat-cores vs unsat-cores-full (by default, nameless quantifiers are ignored).
It fixes an issue with qid, where mkVar was accidentally used instead of mkConst, leading to assertion failures in debug. Marking major since this fixes debug regress1.
category = "regular"
long = "print-inst-full"
type = "bool"
- default = "true"
+ default = "false"
help = "print instantiations for formulas that do not have given identifiers"
+[[option]]
+ name = "debugInst"
+ category = "regular"
+ long = "debug-inst"
+ type = "bool"
+ default = "false"
+ help = "print instantiations during solving (for debugging)"
+
### SyGuS instantiation options
[[option]]
| tok=( ATTRIBUTE_QUANTIFIER_ID_TOK ) symbolicExpr[sexpr]
{
api::Sort boolType = SOLVER->getBooleanSort();
- api::Term avar = SOLVER->mkVar(boolType, sexpr.toString());
+ api::Term avar = SOLVER->mkConst(boolType, sexpr.toString());
attr = std::string(":qid");
retExpr = MK_TERM(api::INST_ATTRIBUTE, avar);
Command* c = new SetUserAttributeCommand("qid", avar.getExpr());
return ret;
}
-void Instantiate::debugPrint()
+void Instantiate::debugPrint(std::ostream& out)
{
// debug information
if (Trace.isOn("inst-per-quant-round"))
d_temp_inst_debug[i.first] = 0;
}
}
+ if (options::debugInst())
+ {
+ bool isFull = options::printInstFull();
+ for (std::pair<const Node, uint32_t>& i : d_temp_inst_debug)
+ {
+ std::stringstream ss;
+ if (!printQuant(i.first, ss, isFull))
+ {
+ continue;
+ }
+ out << "(num-instantiations " << ss.str() << " " << i.second << ")"
+ << std::endl;
+ }
+ }
}
void Instantiate::debugPrintModel()
Node getTermForType(TypeNode tn);
//--------------------------------------end general utilities
- /** debug print, called once per instantiation round. */
- void debugPrint();
+ /**
+ * Debug print, called once per instantiation round. This prints
+ * instantiations added this round to trace inst-per-quant-round, if
+ * applicable, and prints to out if the option debug-inst is enabled.
+ */
+ void debugPrint(std::ostream& out);
/** debug print model, called once, before we terminate with sat/unknown. */
void debugPrintModel();
#include "options/quantifiers_options.h"
#include "options/uf_options.h"
+#include "smt/smt_engine_scope.h"
#include "smt/smt_statistics_registry.h"
#include "theory/quantifiers/alpha_equivalence.h"
#include "theory/quantifiers/anti_skolem.h"
}
d_curr_effort_level = QuantifiersModule::QEFFORT_NONE;
Trace("quant-engine-debug") << "Done check modules that needed check." << std::endl;
- if( d_hasAddedLemma ){
- d_instantiate->debugPrint();
+ // debug print
+ if (d_hasAddedLemma)
+ {
+ bool debugInstTrace = Trace.isOn("inst-per-quant-round");
+ if (options::debugInst() || debugInstTrace)
+ {
+ Options& sopts = smt::currentSmtEngine()->getOptions();
+ std::ostream& out = *sopts.getOut();
+ d_instantiate->debugPrint(out);
+ }
}
if( Trace.isOn("quant-engine") ){
double clSet2 = double(clock())/double(CLOCKS_PER_SEC);
regress1/quantifiers/qe-partial.smt2
regress1/quantifiers/qe.smt2
regress1/quantifiers/qid.smt2
+ regress1/quantifiers/qid-debug-inst.smt2
regress1/quantifiers/quant-wf-int-ind.smt2
regress1/quantifiers/quaternion_ds1_symm_0428.fof.smt2
regress1/quantifiers/recfact.cvc
-; COMMAND-LINE: --dump-instantiations --incremental
+; COMMAND-LINE: --dump-instantiations --incremental --print-inst-full
; SCRUBBER: sed -e 's/skv_.* )$/skv_TERM )/'
; EXPECT: unsat
; EXPECT: (skolem (forall ((x Int)) (or (P x) (Q x)) )
; REQUIRES: proof
-; COMMAND-LINE: --dump-instantiations --proof
+; COMMAND-LINE: --dump-instantiations --proof --print-inst-full
; EXPECT: unsat
; EXPECT: (instantiations (forall ((x Int)) (or (P x) (Q x)) )
; EXPECT: ( 2 )
-; COMMAND-LINE: --dump-instantiations
+; COMMAND-LINE: --dump-instantiations --print-inst-full
; SCRUBBER: sed -e 's/skv_.* )$/skv_TERM )/'
; EXPECT: unsat
; EXPECT: (skolem (forall ((x Int)) (or (P x) (Q x)) )
--- /dev/null
+; COMMAND-LINE: --debug-inst
+; EXPECT: (num-instantiations myQuant1 1)
+; EXPECT: (num-instantiations myQuant2 1)
+; EXPECT: unsat
+
+(set-logic UFLIA)
+(declare-fun P (Int) Bool)
+(declare-fun Q (Int) Bool)
+(assert (forall ((x Int)) (! (P x) :qid |myQuant1|)))
+(assert (forall ((x Int)) (! (=> (P x) (Q x)) :qid |myQuant2|)))
+(assert (P 5))
+(assert (not (Q 5)))
+(check-sat)