Skip to main content

Overview

The Fixedpoint API provides a context for solving recursive predicate queries using Datalog-style rules. It supports Horn clauses, queries, and least fixedpoint computation.

Types

Z3_fixedpoint

Context for the recursive predicate solver. Used for Datalog queries and Horn clause solving.

Fixedpoint Creation

Z3_mk_fixedpoint

Create a fixedpoint context.
Z3_fixedpoint
New fixedpoint instance
Example:

Z3_fixedpoint_inc_ref

Increment the reference counter.

Z3_fixedpoint_dec_ref

Decrement the reference counter.

Predicate Registration

Z3_fixedpoint_register_relation

Register a relation (predicate) for use in rules. Example:

Adding Rules

Z3_fixedpoint_add_rule

Add a Horn clause rule. Description: Rules are Horn clauses of the form:
  • Facts: P(args)
  • Rules: (implies (and body...) head)
Example:

Z3_fixedpoint_add_fact

Add a fact using numeric constants. Description: Convenience function for adding ground facts with finite domain values. Example:

Queries

Z3_fixedpoint_query

Pose a query.
Z3_lbool
Z3_L_TRUE if derivable, Z3_L_FALSE if not derivable, Z3_L_UNDEF if unknown
Example:

Z3_fixedpoint_query_relations

Pose multiple queries on relations.
Z3_lbool
Satisfiability result

Results and Answers

Z3_fixedpoint_get_answer

Retrieve the answer for the last query.
Z3_ast
Answer expression (derivation or counterexample)
Description: If the query was satisfiable, returns a derivation. If unsatisfiable, may return a certificate.

Z3_fixedpoint_get_reason_unknown

Return a string describing why the last query returned unknown.
Z3_string
Reason string

Level and Cover Management

Z3_fixedpoint_get_num_levels

Return the number of levels in the PDR engine for a predicate.
unsigned
Number of levels

Z3_fixedpoint_get_cover_delta

Retrieve the cover at a given level.
Z3_ast
Cover expression

Z3_fixedpoint_add_cover

Add a property to the cover at a level.

Backtracking

Z3_fixedpoint_push

Create a backtracking point.

Z3_fixedpoint_pop

Backtrack one level.

Information

Z3_fixedpoint_to_string

Convert fixedpoint state to a string.
Z3_string
String representation (Datalog format)

Z3_fixedpoint_get_rules

Return the set of rules.
Z3_ast_vector
Vector of rules

Z3_fixedpoint_get_assertions

Return the set of background assertions.
Z3_ast_vector
Vector of assertions

Complete Example