diff --git a/src/api/api_datalog.cpp b/src/api/api_datalog.cpp
index 7674e8676..52cdeaec9 100644
--- a/src/api/api_datalog.cpp
+++ b/src/api/api_datalog.cpp
@@ -449,6 +449,23 @@ extern "C" {
RETURN_Z3(of_ast_vector(v));
Z3_CATCH_RETURN(0);
}
+
+ Z3_ast_vector Z3_API Z3_fixedpoint_get_assertions(
+ Z3_context c,
+ Z3_fixedpoint d)
+ {
+ Z3_TRY;
+ LOG_Z3_fixedpoint_get_assertions(c, d);
+ ast_manager& m = mk_c(c)->m();
+ Z3_ast_vector_ref* v = alloc(Z3_ast_vector_ref, m);
+ mk_c(c)->save_object(v);
+ unsigned num_asserts = to_fixedpoint_ref(d)->ctx().get_num_assertions();
+ for (unsigned i = 0; i < num_asserts; ++i) {
+ v->m_ast_vector.push_back(to_fixedpoint_ref(d)->ctx().get_assertion(i));
+ }
+ RETURN_Z3(of_ast_vector(v));
+ Z3_CATCH_RETURN(0);
+ }
void Z3_API Z3_fixedpoint_set_reduce_assign_callback(
Z3_context c, Z3_fixedpoint d, Z3_fixedpoint_reduce_assign_callback_fptr f) {
diff --git a/src/api/dotnet/Fixedpoint.cs b/src/api/dotnet/Fixedpoint.cs
index c8a677196..aca013318 100644
--- a/src/api/dotnet/Fixedpoint.cs
+++ b/src/api/dotnet/Fixedpoint.cs
@@ -278,6 +278,23 @@ namespace Microsoft.Z3
}
}
+ ///
+ /// Retrieve set of assertions added to fixedpoint context.
+ ///
+ public BoolExpr[] Assertions {
+ get
+ {
+ Contract.Ensures(Contract.Result() != null);
+
+ ASTVector v = new ASTVector(Context, Native.Z3_fixedpoint_get_assertions(Context.nCtx, NativeObject));
+ uint n = v.Size;
+ BoolExpr[] res = new BoolExpr[n];
+ for (uint i = 0; i < n; i++)
+ res[i] = new BoolExpr(Context, v[i].NativeObject);
+ return res;
+ }
+ }
+
#region Internal
internal Fixedpoint(Context ctx, IntPtr obj)
diff --git a/src/api/python/z3.py b/src/api/python/z3.py
index 3e73e9b1a..21666f569 100644
--- a/src/api/python/z3.py
+++ b/src/api/python/z3.py
@@ -6145,7 +6145,11 @@ class Fixedpoint(Z3PPObject):
def get_rules(self):
"""retrieve rules that have been added to fixedpoint context"""
return AstVector(Z3_fixedpoint_get_rules(self.ctx.ref(), self.fixedpoint), self.ctx)
-
+
+ def get_assertions(self):
+ """retrieve assertions that have been added to fixedpoint context"""
+ return AstVector(Z3_fixedpoint_get_assertions(self.ctx.ref(), self.fixedpoint), self.ctx)
+
def __repr__(self):
"""Return a formatted string with all added rules and constraints."""
return self.sexpr()
diff --git a/src/api/z3_api.h b/src/api/z3_api.h
index 5fa296ff6..7c9247459 100644
--- a/src/api/z3_api.h
+++ b/src/api/z3_api.h
@@ -5696,6 +5696,15 @@ END_MLAPI_EXCLUDE
__in Z3_context c,
__in Z3_fixedpoint f);
+ /**
+ \brief Retrieve set of background assertions from fixedpoint context.
+
+ def_API('Z3_fixedpoint_get_assertions', AST_VECTOR, (_in(CONTEXT),_in(FIXEDPOINT)))
+ */
+ Z3_ast_vector Z3_API Z3_fixedpoint_get_assertions(
+ __in Z3_context c,
+ __in Z3_fixedpoint f);
+
/**
\brief Set parameters on fixedpoint context.
diff --git a/src/muz_qe/dl_context.h b/src/muz_qe/dl_context.h
index ef9e8004b..3818052e2 100644
--- a/src/muz_qe/dl_context.h
+++ b/src/muz_qe/dl_context.h
@@ -261,6 +261,8 @@ namespace datalog {
void assert_expr(expr* e);
expr_ref get_background_assertion();
+ unsigned get_num_assertions() { return m_background.size(); }
+ expr* get_assertion(unsigned i) const { return m_background[i]; }
/**
Method exposed from API for adding rules.