diff options
Diffstat (limited to 'src/theory/quantifiers/sygus/ce_guided_conjecture.cpp')
-rw-r--r-- | src/theory/quantifiers/sygus/ce_guided_conjecture.cpp | 109 |
1 files changed, 66 insertions, 43 deletions
diff --git a/src/theory/quantifiers/sygus/ce_guided_conjecture.cpp b/src/theory/quantifiers/sygus/ce_guided_conjecture.cpp index db641a82e..d5a430229 100644 --- a/src/theory/quantifiers/sygus/ce_guided_conjecture.cpp +++ b/src/theory/quantifiers/sygus/ce_guided_conjecture.cpp @@ -479,51 +479,74 @@ Node CegConjecture::getNextDecisionRequest( unsigned& priority ) { if( !d_qe->getValuation().hasSatValue( feasible_guard, value ) ) { priority = 0; return feasible_guard; - }else{ - if( value ){ - // the conjecture is feasible - if( options::sygusStream() ){ - Assert( !isSingleInvocation() ); - // if we are in sygus streaming mode, then get the "next guard" - // which denotes "we have not yet generated the next solution to the conjecture" - Node curr_stream_guard = getCurrentStreamGuard(); - bool needs_new_stream_guard = false; - if( curr_stream_guard.isNull() ){ - needs_new_stream_guard = true; - }else{ - // check the polarity of the guard - if( !d_qe->getValuation().hasSatValue( curr_stream_guard, value ) ) { - priority = 0; - return curr_stream_guard; - }else{ - if( !value ){ - Trace("cegqi-debug") << "getNextDecision : we have a new solution since stream guard was propagated false: " << curr_stream_guard << std::endl; - // need to make the next stream guard - needs_new_stream_guard = true; - // the guard has propagated false, indicating that a verify - // lemma was unsatisfiable. Hence, the previous candidate is - // an actual solution. We print and continue the stream. - printAndContinueStream(); - } - } - } - if( needs_new_stream_guard ){ - // generate a new stream guard - curr_stream_guard = Rewriter::rewrite( NodeManager::currentNM()->mkSkolem( "G_Stream", NodeManager::currentNM()->booleanType() ) ); - curr_stream_guard = d_qe->getValuation().ensureLiteral( curr_stream_guard ); - AlwaysAssert( !curr_stream_guard.isNull() ); - d_qe->getOutputChannel().requirePhase( curr_stream_guard, true ); - d_stream_guards.push_back( curr_stream_guard ); - Trace("cegqi-debug") << "getNextDecision : allocate new stream guard : " << curr_stream_guard << std::endl; - // return it as a decision - priority = 0; - return curr_stream_guard; - } - } + } + if (!value) + { + Trace("cegqi-debug") << "getNextDecision : conjecture is infeasible." + << std::endl; + return Node::null(); + } + // the conjecture is feasible + if (options::sygusStream()) + { + Assert(!isSingleInvocation()); + // if we are in sygus streaming mode, then get the "next guard" + // which denotes "we have not yet generated the next solution to the + // conjecture" + Node curr_stream_guard = getCurrentStreamGuard(); + bool needs_new_stream_guard = false; + if (curr_stream_guard.isNull()) + { + needs_new_stream_guard = true; }else{ - Trace("cegqi-debug") << "getNextDecision : conjecture is infeasible." << std::endl; - } + // check the polarity of the guard + if (!d_qe->getValuation().hasSatValue(curr_stream_guard, value)) + { + priority = 0; + return curr_stream_guard; + } + if (!value) + { + Trace("cegqi-debug") << "getNextDecision : we have a new solution " + "since stream guard was propagated false: " + << curr_stream_guard << std::endl; + // need to make the next stream guard + needs_new_stream_guard = true; + // the guard has propagated false, indicating that a verify + // lemma was unsatisfiable. Hence, the previous candidate is + // an actual solution. We print and continue the stream. + printAndContinueStream(); + } + } + if (needs_new_stream_guard) + { + // generate a new stream guard + curr_stream_guard = Rewriter::rewrite(NodeManager::currentNM()->mkSkolem( + "G_Stream", NodeManager::currentNM()->booleanType())); + curr_stream_guard = d_qe->getValuation().ensureLiteral(curr_stream_guard); + AlwaysAssert(!curr_stream_guard.isNull()); + d_qe->getOutputChannel().requirePhase(curr_stream_guard, true); + d_stream_guards.push_back(curr_stream_guard); + Trace("cegqi-debug") << "getNextDecision : allocate new stream guard : " + << curr_stream_guard << std::endl; + // return it as a decision + priority = 0; + return curr_stream_guard; + } } + // see if the master module has a decision + if (!isSingleInvocation()) + { + Assert(d_master != nullptr); + Node mlit = d_master->getNextDecisionRequest(priority); + if (!mlit.isNull()) + { + Trace("cegqi-debug") << "getNextDecision : master module returned : " + << mlit << std::endl; + return mlit; + } + } + return Node::null(); } |