From b6cc24faf3369da9927bd7f3fd857643847b7a14 Mon Sep 17 00:00:00 2001
From: Nikolaj Bjorner <nbjorner@microsoft.com>
Date: Sun, 13 Aug 2017 14:24:56 -0700
Subject: [PATCH] deal with absence of integer congruence root by querying
 arithmetic theory directly, #1202

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
---
 src/smt/theory_str.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/smt/theory_str.cpp b/src/smt/theory_str.cpp
index aacf17b30..5eabc5d62 100644
--- a/src/smt/theory_str.cpp
+++ b/src/smt/theory_str.cpp
@@ -4656,7 +4656,7 @@ namespace smt {
 
 	// safety
 	if (!ctx.e_internalized(e)) {
-	  return false;
+            return false;
 	}
 	
         // if an integer constant exists in the eqc, it should be the root
@@ -4667,6 +4667,10 @@ namespace smt {
             return true;
         } else {
             TRACE("str", tout << "root of eqc of " << mk_pp(e, m) << " is not a numeral" << std::endl;);
+            theory_mi_arith* tha = get_th_arith(ctx, m_autil.get_family_id(), e);
+            if (!tha) return false;
+            expr_ref val_e(m);
+            if (tha->get_value(root_e, val_e) && m_autil.is_numeral(val_e, val) && val.is_int()) return true;
             return false;
         }
     }
@@ -8450,6 +8454,7 @@ namespace smt {
             expr_ref is_zero(ctx.mk_eq_atom(a, m_autil.mk_int(0)), m);
             literal is_zero_l = mk_literal(is_zero);
             axiomAdd = true;
+            TRACE("str", ctx.display(tout););
             // NOT_IMPLEMENTED_YET();
         }