summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorajreynol <andrew.j.reynolds@gmail.com>2014-10-31 11:35:11 +0100
committerajreynol <andrew.j.reynolds@gmail.com>2014-10-31 11:35:19 +0100
commit458b2b7eb5bdf09a1a886f4e2a165380d5fd918f (patch)
tree342d05bab92d0aa349ab833e6a4b60e887670295 /src
parent5a285d5247b56b00895774c909f09c8ad1e3889c (diff)
Do not allow duplication of function definitions. Set incomplete flag in model builder.
Diffstat (limited to 'src')
-rw-r--r--src/theory/datatypes/theory_datatypes.cpp4
-rw-r--r--src/theory/quantifiers/fun_def_process.cpp6
-rw-r--r--src/theory/quantifiers/fun_def_process.h2
-rw-r--r--src/theory/quantifiers/model_engine.cpp4
-rw-r--r--src/theory/quantifiers/term_database.cpp8
-rw-r--r--src/theory/quantifiers/term_database.h3
6 files changed, 22 insertions, 5 deletions
diff --git a/src/theory/datatypes/theory_datatypes.cpp b/src/theory/datatypes/theory_datatypes.cpp
index 62f5ad3ff..516aae0e1 100644
--- a/src/theory/datatypes/theory_datatypes.cpp
+++ b/src/theory/datatypes/theory_datatypes.cpp
@@ -1142,7 +1142,7 @@ void TheoryDatatypes::collectModelInfo( TheoryModel* m, bool fullModel ){
}
}
Assert( !eq_merged );
- */
+ //*/
//combine the equality engine
m->assertEqualityEngine( &d_equalityEngine );
@@ -1158,7 +1158,7 @@ void TheoryDatatypes::collectModelInfo( TheoryModel* m, bool fullModel ){
}
}
Assert( !eq_merged );
- */
+ //*/
//get all constructors
eq::EqClassesIterator eqccs_i = eq::EqClassesIterator( &d_equalityEngine );
diff --git a/src/theory/quantifiers/fun_def_process.cpp b/src/theory/quantifiers/fun_def_process.cpp
index c375d68f2..0e365c875 100644
--- a/src/theory/quantifiers/fun_def_process.cpp
+++ b/src/theory/quantifiers/fun_def_process.cpp
@@ -39,6 +39,12 @@ void FunDefFmf::simplify( std::vector< Node >& assertions, bool doRewrite ) {
Assert( n.getKind()==APPLY_UF );
Node f = n.getOperator();
+ //check if already defined, if so, throw error
+ if( d_sorts.find( f )!=d_sorts.end() ){
+ Message() << "Cannot define function " << f << " more than once." << std::endl;
+ exit( 0 );
+ }
+
//create a sort S that represents the inputs of the function
std::stringstream ss;
ss << "I_" << f;
diff --git a/src/theory/quantifiers/fun_def_process.h b/src/theory/quantifiers/fun_def_process.h
index 22adf427d..40364eeb7 100644
--- a/src/theory/quantifiers/fun_def_process.h
+++ b/src/theory/quantifiers/fun_def_process.h
@@ -35,8 +35,6 @@ private:
std::map< Node, TypeNode > d_sorts;
//defined functions to injections input -> argument elements
std::map< Node, std::vector< Node > > d_input_arg_inj;
- //flatten ITE
- void flattenITE( Node lhs, Node n, std::vector< std::vector< Node > >& conds, std::vector< Node >& terms );
//simplify
Node simplify( Node n, bool pol, bool hasPol, std::vector< Node >& constraints, bool is_fun_def = false );
//simplify term
diff --git a/src/theory/quantifiers/model_engine.cpp b/src/theory/quantifiers/model_engine.cpp
index eede5c3a8..6ec347031 100644
--- a/src/theory/quantifiers/model_engine.cpp
+++ b/src/theory/quantifiers/model_engine.cpp
@@ -96,6 +96,10 @@ void ModelEngine::check( Theory::Effort e, unsigned quant_e ){
//CVC4 will answer SAT or unknown
Trace("fmf-consistent") << std::endl;
debugPrint("fmf-consistent");
+ //if the check was incomplete, we must set incomplete flag
+ if( d_incomplete_check ){
+ d_quantEngine->getOutputChannel().setIncomplete();
+ }
}else{
//otherwise, the search will continue
}
diff --git a/src/theory/quantifiers/term_database.cpp b/src/theory/quantifiers/term_database.cpp
index 0b606ecf0..3f6f2a6ed 100644
--- a/src/theory/quantifiers/term_database.cpp
+++ b/src/theory/quantifiers/term_database.cpp
@@ -1031,6 +1031,14 @@ void TermDb::computeAttributes( Node q ) {
if( avar.getAttribute(FunDefAttribute()) ){
Trace("quant-attr") << "Attribute : function definition : " << q << std::endl;
d_qattr_fundef[q] = true;
+ Assert( q[1].getKind()==EQUAL || q[1].getKind()==IFF );
+ Assert( q[1][0].getKind()==APPLY_UF );
+ Node f = q[1][0].getOperator();
+ if( d_fun_defs.find( f )!=d_fun_defs.end() ){
+ Message() << "Cannot define function " << f << " more than once." << std::endl;
+ exit( 0 );
+ }
+ d_fun_defs[f] = true;
}
if( avar.getAttribute(SygusAttribute()) ){
//should be nested existential
diff --git a/src/theory/quantifiers/term_database.h b/src/theory/quantifiers/term_database.h
index dbd12f8f0..e40635d4e 100644
--- a/src/theory/quantifiers/term_database.h
+++ b/src/theory/quantifiers/term_database.h
@@ -310,7 +310,8 @@ public:
/** filter all nodes that have instances */
void filterInstances( std::vector< Node >& nodes );
-
+private:
+ std::map< Node, bool > d_fun_defs;
public: //general queries concerning quantified formulas wrt modules
/** is quantifier treated as a rewrite rule? */
static bool isRewriteRule( Node q );
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback