const std::string OptionsHandler::s_prenexQuantModeHelp = "\
Prenex quantifiers modes currently supported by the --prenex-quant option:\n\
\n\
-default \n\
-+ Default, prenex all nested quantifiers except those with user patterns.\n\
-\n\
-all \n\
-+ Prenex all nested quantifiers.\n\
-\n\
none \n\
+ Do no prenex nested quantifiers. \n\
\n\
+default | simple \n\
++ Default, do simple prenexing of same sign quantifiers.\n\
+\n\
+dnorm \n\
++ Prenex to disjunctive prenex normal form.\n\
+\n\
+norm \n\
++ Prenex to prenex normal form.\n\
+\n\
";
const std::string OptionsHandler::s_cegqiFairModeHelp = "\
}
theory::quantifiers::PrenexQuantMode OptionsHandler::stringToPrenexQuantMode(std::string option, std::string optarg) throw(OptionException) {
- if(optarg == "default" ) {
- return theory::quantifiers::PRENEX_NO_USER_PAT;
- } else if(optarg == "all") {
- return theory::quantifiers::PRENEX_ALL;
+ if(optarg== "default" || optarg== "simple" ) {
+ return theory::quantifiers::PRENEX_QUANT_SIMPLE;
} else if(optarg == "none") {
- return theory::quantifiers::PRENEX_NONE;
+ return theory::quantifiers::PRENEX_QUANT_NONE;
+ } else if(optarg == "dnorm") {
+ return theory::quantifiers::PRENEX_QUANT_DISJ_NORMAL;
+ } else if(optarg == "norm") {
+ return theory::quantifiers::PRENEX_QUANT_NORMAL;
} else if(optarg == "help") {
puts(s_prenexQuantModeHelp.c_str());
exit(1);
return body;
}
-Node QuantifiersRewriter::computePrenex( Node body, std::vector< Node >& args, std::vector< Node >& nargs, bool pol ){
+Node QuantifiersRewriter::computePrenex( Node body, std::vector< Node >& args, std::vector< Node >& nargs, bool pol, bool prenexAgg ){
if( body.getKind()==FORALL ){
- if( ( pol || options::prenexQuantAgg() ) && ( options::prenexQuant()==PRENEX_ALL || body.getNumChildren()==2 ) ){
+ if( ( pol || prenexAgg ) && ( options::prenexQuantUser() || body.getNumChildren()==2 ) ){
std::vector< Node > terms;
std::vector< Node > subs;
//for doing prenexing of same-signed quantifiers
return newBody;
}
//must remove structure
- }else if( options::prenexQuantAgg() && body.getKind()==kind::ITE && body.getType().isBoolean() ){
+ }else if( prenexAgg && body.getKind()==kind::ITE && body.getType().isBoolean() ){
Node nn = NodeManager::currentNM()->mkNode( kind::AND,
NodeManager::currentNM()->mkNode( kind::OR, body[0].notNode(), body[1] ),
NodeManager::currentNM()->mkNode( kind::OR, body[0], body[2] ) );
- return computePrenex( nn, args, nargs, pol );
- }else if( options::prenexQuantAgg() && body.getKind()==kind::IFF ){
+ return computePrenex( nn, args, nargs, pol, prenexAgg );
+ }else if( prenexAgg && body.getKind()==kind::IFF ){
Node nn = NodeManager::currentNM()->mkNode( kind::AND,
NodeManager::currentNM()->mkNode( kind::OR, body[0].notNode(), body[1] ),
NodeManager::currentNM()->mkNode( kind::OR, body[0], body[1].notNode() ) );
- return computePrenex( nn, args, nargs, pol );
+ return computePrenex( nn, args, nargs, pol, prenexAgg );
}else if( body.getType().isBoolean() ){
Assert( body.getKind()!=EXISTS );
bool childrenChanged = false;
bool newPol;
QuantPhaseReq::getPolarity( body, i, true, pol, newHasPol, newPol );
if( newHasPol ){
- Node n = computePrenex( body[i], args, nargs, newPol );
+ Node n = computePrenex( body[i], args, nargs, newPol, prenexAgg );
newChildren.push_back( n );
if( n!=body[i] ){
childrenChanged = true;
Node QuantifiersRewriter::computePrenexAgg( Node n, bool topLevel ){
if( containsQuantifiers( n ) ){
- if( topLevel && ( n.getKind()==AND || ( n.getKind()==NOT && n[0].getKind()==OR ) ) ){
+ if( topLevel && options::prenexQuant()==PRENEX_QUANT_DISJ_NORMAL && ( n.getKind()==AND || ( n.getKind()==NOT && n[0].getKind()==OR ) ) ){
std::vector< Node > children;
for( unsigned i=0; i<n.getNumChildren(); i++ ){
Node nc = computePrenexAgg( n[i], true );
}
*/
std::vector< Node > children;
- if( n[1].getKind()==OR ){
+ if( n[1].getKind()==OR && options::prenexQuant()==PRENEX_QUANT_DISJ_NORMAL ){
for( unsigned i=0; i<n[1].getNumChildren(); i++ ){
children.push_back( computePrenexAgg( n[1][i], false ) );
}
}else{
std::vector< Node > args;
std::vector< Node > nargs;
- Node nn = computePrenex( n, args, nargs, true );
+ Node nn = computePrenex( n, args, nargs, true, true );
if( n!=nn ){
Node nnn = computePrenexAgg( nn, false );
//merge prenex
}else if( computeOption==COMPUTE_COND_SPLIT ){
return ( options::iteDtTesterSplitQuant() || options::condVarSplitQuant() ) && !is_strict_trigger;
}else if( computeOption==COMPUTE_PRENEX ){
- return options::prenexQuant()!=PRENEX_NONE && !options::aggressiveMiniscopeQuant() && is_std;
+ return options::prenexQuant()!=PRENEX_QUANT_NONE && !options::aggressiveMiniscopeQuant() && is_std;
}else if( computeOption==COMPUTE_VAR_ELIMINATION ){
return ( options::varElimQuant() || options::dtVarExpandQuant() ) && is_std;
}else{
if( computeOption==COMPUTE_ELIM_SYMBOLS ){
n = computeElimSymbols( n );
}else if( computeOption==COMPUTE_MINISCOPING ){
- if( options::prenexQuantAgg() ){
- //if( isPrenexNormalForm( n ) ){
+ if( options::prenexQuant()==PRENEX_QUANT_DISJ_NORMAL || options::prenexQuant()==PRENEX_QUANT_NORMAL ){
if( !qa.d_qid_num.isNull() ){
+ //already processed this, return self
return f;
}
}
}else if( computeOption==COMPUTE_COND_SPLIT ){
n = computeCondSplit( n, qa );
}else if( computeOption==COMPUTE_PRENEX ){
- if( options::prenexQuantAgg() ){
- //Node pf = computePrenexAgg( f );
- //Assert( isPrenexNormalForm( pf ) );
- //will do it at preprocess time
+ if( options::prenexQuant()==PRENEX_QUANT_DISJ_NORMAL || options::prenexQuant()==PRENEX_QUANT_NORMAL ){
+ //will rewrite at preprocess time
return f;
}else{
std::vector< Node > nargs;
- n = computePrenex( n, args, nargs, true );
+ n = computePrenex( n, args, nargs, true, false );
Assert( nargs.empty() );
}
}else if( computeOption==COMPUTE_VAR_ELIMINATION ){
}
}
//pull all quantifiers globally
- if( options::prenexQuantAgg() ){
+ if( options::prenexQuant()==PRENEX_QUANT_DISJ_NORMAL || options::prenexQuant()==PRENEX_QUANT_NORMAL ){
Trace("quantifiers-prenex") << "Prenexing : " << n << std::endl;
n = quantifiers::QuantifiersRewriter::computePrenexAgg( n, true );
n = Rewriter::rewrite( n );