From 3af2dfea22aae0d527fcfa93600c451b323c15b7 Mon Sep 17 00:00:00 2001 From: Andrew Reynolds Date: Sun, 27 Oct 2019 17:47:56 -0500 Subject: [PATCH] Fix collect model info for higher-order (#3409) This ensures we add lemmas when collect model info fails for the higher order extension of UF. This fixes #3405 (that benchmark now answers unknown). --- src/theory/theory_model_builder.cpp | 9 ++++++++- src/theory/uf/ho_extension.cpp | 10 ++++++++++ src/theory/uf/theory_uf.cpp | 2 ++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/theory/theory_model_builder.cpp b/src/theory/theory_model_builder.cpp index d3fde58a7..7a2a9ae16 100644 --- a/src/theory/theory_model_builder.cpp +++ b/src/theory/theory_model_builder.cpp @@ -301,12 +301,17 @@ bool TheoryEngineModelBuilder::buildModel(Model* m) << std::endl; if (!d_te->collectModelInfo(tm)) { + Trace("model-builder") + << "TheoryEngineModelBuilder: fail collect model info" << std::endl; return false; } // model-builder specific initialization if (!preProcessBuildModel(tm)) { + Trace("model-builder") + << "TheoryEngineModelBuilder: fail preprocess build model." + << std::endl; return false; } @@ -813,9 +818,11 @@ bool TheoryEngineModelBuilder::buildModel(Model* m) // modelBuilder-specific initialization if (!processBuildModel(tm)) { + Trace("model-builder") + << "TheoryEngineModelBuilder: fail process build model." << std::endl; return false; } - + Trace("model-builder") << "TheoryEngineModelBuilder: success" << std::endl; tm->d_modelBuiltSuccess = true; return true; } diff --git a/src/theory/uf/ho_extension.cpp b/src/theory/uf/ho_extension.cpp index 88b2ba8d2..0ca9b151f 100644 --- a/src/theory/uf/ho_extension.cpp +++ b/src/theory/uf/ho_extension.cpp @@ -186,6 +186,7 @@ Node HoExtension::getApplyUfForHoApply(Node node) unsigned HoExtension::checkExtensionality(TheoryModel* m) { eq::EqualityEngine* ee = d_parent.getEqualityEngine(); + NodeManager* nm = NodeManager::currentNM(); unsigned num_lemmas = 0; bool isCollectModel = (m != nullptr); Trace("uf-ho") << "HoExtension::checkExtensionality, collectModel=" @@ -243,6 +244,11 @@ unsigned HoExtension::checkExtensionality(TheoryModel* m) << "Add extensionality deq to model : " << edeq << std::endl; if (!m->assertEquality(edeq[0][0], edeq[0][1], false)) { + Node eq = edeq[0][0].eqNode(edeq[0][1]); + Node lem = nm->mkNode(OR, deq.negate(), eq); + Trace("uf-ho") << "HoExtension: cmi extensionality lemma " << lem + << std::endl; + d_parent.getOutputChannel().lemma(lem); return 1; } } @@ -423,6 +429,10 @@ bool HoExtension::collectModelInfoHoTerm(Node n, TheoryModel* m) Node hn = TheoryUfRewriter::getHoApplyForApplyUf(n); if (!m->assertEquality(n, hn, true)) { + Node eq = n.eqNode(hn); + Trace("uf-ho") << "HoExtension: cmi app completion lemma " << eq + << std::endl; + d_parent.getOutputChannel().lemma(eq); return false; } } diff --git a/src/theory/uf/theory_uf.cpp b/src/theory/uf/theory_uf.cpp index 6284ae31e..76e6e08bc 100644 --- a/src/theory/uf/theory_uf.cpp +++ b/src/theory/uf/theory_uf.cpp @@ -324,6 +324,7 @@ bool TheoryUF::collectModelInfo(TheoryModel* m) if (!m->assertEqualityEngine(&d_equalityEngine, &termSet)) { + Trace("uf") << "Collect model info fail UF" << std::endl; return false; } @@ -332,6 +333,7 @@ bool TheoryUF::collectModelInfo(TheoryModel* m) // function equivalence classes. if (!d_ho->collectModelInfoHo(termSet, m)) { + Trace("uf") << "Collect model info fail HO" << std::endl; return false; } } -- 2.30.2