summaryrefslogtreecommitdiff
path: root/src/theory/quantifiers
diff options
context:
space:
mode:
authorajreynol <andrew.j.reynolds@gmail.com>2016-09-14 10:42:39 -0500
committerajreynol <andrew.j.reynolds@gmail.com>2016-09-14 10:42:39 -0500
commitbeb73911f71daa6711390264221e7b4de7dc8c6c (patch)
treedc102dfca7f3ac87944af7760de759fe56a2b648 /src/theory/quantifiers
parent5887766342258361d3635a5b29a015dadb9ebe83 (diff)
Lemma cache in theory sep. Minor optimization for sets. Minor improvements to EPR
Diffstat (limited to 'src/theory/quantifiers')
-rw-r--r--src/theory/quantifiers/quant_util.cpp26
-rw-r--r--src/theory/quantifiers/quant_util.h10
2 files changed, 35 insertions, 1 deletions
diff --git a/src/theory/quantifiers/quant_util.cpp b/src/theory/quantifiers/quant_util.cpp
index 9158734e4..c3ddfacff 100644
--- a/src/theory/quantifiers/quant_util.cpp
+++ b/src/theory/quantifiers/quant_util.cpp
@@ -474,6 +474,7 @@ void QuantEPR::registerAssertion( Node assertion ) {
void QuantEPR::finishInit() {
Trace("quant-epr-debug") << "QuantEPR::finishInit" << std::endl;
for( std::map< TypeNode, std::vector< Node > >::iterator it = d_consts.begin(); it != d_consts.end(); ++it ){
+ Assert( d_epr_axiom.find( it->first )==d_epr_axiom.end() );
Trace("quant-epr-debug") << "process " << it->first << std::endl;
if( d_non_epr.find( it->first )!=d_non_epr.end() ){
Trace("quant-epr-debug") << "...non-epr" << std::endl;
@@ -497,3 +498,28 @@ bool QuantEPR::isEPRConstant( TypeNode tn, Node k ) {
return std::find( d_consts[tn].begin(), d_consts[tn].end(), k )!=d_consts[tn].end();
}
+void QuantEPR::addEPRConstant( TypeNode tn, Node k ) {
+ Assert( isEPR( tn ) );
+ Assert( d_epr_axiom.find( tn )==d_epr_axiom.end() );
+ if( !isEPRConstant( tn, k ) ){
+ d_consts[tn].push_back( k );
+ }
+}
+
+Node QuantEPR::mkEPRAxiom( TypeNode tn ) {
+ Assert( isEPR( tn ) );
+ std::map< TypeNode, Node >::iterator ita = d_epr_axiom.find( tn );
+ if( ita==d_epr_axiom.end() ){
+ std::vector< Node > disj;
+ Node x = NodeManager::currentNM()->mkBoundVar( tn );
+ for( unsigned i=0; i<d_consts[tn].size(); i++ ){
+ disj.push_back( NodeManager::currentNM()->mkNode( tn.isBoolean() ? IFF : EQUAL, x, d_consts[tn][i] ) );
+ }
+ Assert( !disj.empty() );
+ d_epr_axiom[tn] = NodeManager::currentNM()->mkNode( FORALL, NodeManager::currentNM()->mkNode( BOUND_VAR_LIST, x ), disj.size()==1 ? disj[0] : NodeManager::currentNM()->mkNode( OR, disj ) );
+ return d_epr_axiom[tn];
+ }else{
+ return ita->second;
+ }
+}
+
diff --git a/src/theory/quantifiers/quant_util.h b/src/theory/quantifiers/quant_util.h
index 049644ffb..d8e57b1ca 100644
--- a/src/theory/quantifiers/quant_util.h
+++ b/src/theory/quantifiers/quant_util.h
@@ -177,6 +177,8 @@ private:
void registerNode( Node n, std::map< int, std::map< Node, bool > >& visited, bool beneathQuant, bool hasPol, bool pol );
/** non-epr */
std::map< TypeNode, bool > d_non_epr;
+ /** axioms for epr */
+ std::map< TypeNode, Node > d_epr_axiom;
public:
QuantEPR(){}
virtual ~QuantEPR(){}
@@ -191,9 +193,15 @@ public:
/** finish init */
void finishInit();
/** is EPR */
- bool isEPR( TypeNode tn ) { return d_non_epr.find( tn )!=d_non_epr.end() ? false : true; }
+ bool isEPR( TypeNode tn ) const { return d_non_epr.find( tn )==d_non_epr.end(); }
/** is EPR constant */
bool isEPRConstant( TypeNode tn, Node k );
+ /** add EPR constant */
+ void addEPRConstant( TypeNode tn, Node k );
+ /** get EPR axiom */
+ Node mkEPRAxiom( TypeNode tn );
+ /** has EPR axiom */
+ bool hasEPRAxiom( TypeNode tn ) const { return d_epr_axiom.find( tn )!=d_epr_axiom.end(); }
};
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback