Z3
 
Loading...
Searching...
No Matches
Data Structures | Public Member Functions
Fixedpoint Class Reference
+ Inheritance diagram for Fixedpoint:

Public Member Functions

String getHelp ()
 
void setParameters (Params value)
 
ParamDescrs getParameterDescriptions ()
 
final void add (Expr< BoolSort >... constraints)
 
void registerRelation (FuncDecl< BoolSort > f)
 
void addRule (Expr< BoolSort > rule, Symbol name)
 
void addFact (FuncDecl< BoolSort > pred, int ... args)
 
Status query (Expr< BoolSort > query)
 
Status query (FuncDecl< BoolSort >[] relations)
 
void updateRule (Expr< BoolSort > rule, Symbol name)
 
Expr<?> getAnswer ()
 
String getReasonUnknown ()
 
int getNumLevels (FuncDecl< BoolSort > predicate)
 
Expr<?> getCoverDelta (int level, FuncDecl< BoolSort > predicate)
 
void addCover (int level, FuncDecl< BoolSort > predicate, Expr<?> property)
 
String toString ()
 
void setPredicateRepresentation (FuncDecl< BoolSort > f, Symbol[] kinds)
 
String toString (Expr< BoolSort >[] queries)
 
BoolExpr[] getRules ()
 
BoolExpr[] getAssertions ()
 
Statistics getStatistics ()
 
BoolExpr[] ParseFile (String file)
 
BoolExpr[] ParseString (String s)
 

Additional Inherited Members

- Static Public Member Functions inherited from Z3Object
static long[] arrayToNative (Z3Object[] a)
 
static int arrayLength (Z3Object[] a)
 

Detailed Description

Object for managing fixedpoints

Definition at line 27 of file Fixedpoint.java.

Member Function Documentation

◆ add()

final void add ( Expr< BoolSort >...  constraints)
inline

Assert a constraint (or multiple) into the fixedpoint solver.

Exceptions
Z3Exception

Definition at line 68 of file Fixedpoint.java.

69 {
70 getContext().checkContextMatch(constraints);
71 for (Expr<BoolSort> a : constraints)
72 {
73 Native.fixedpointAssert(getContext().nCtx(), getNativeObject(),
74 a.getNativeObject());
75 }
76 }

Referenced by Solver.__iadd__().

◆ addCover()

void addCover ( int  level,
FuncDecl< BoolSort predicate,
Expr<?>  property 
)
inline

Add property about the predicate. The property is added at level.

Definition at line 221 of file Fixedpoint.java.

223 {
224 Native.fixedpointAddCover(getContext().nCtx(), getNativeObject(), level,
225 predicate.getNativeObject(), property.getNativeObject());
226 }

◆ addFact()

void addFact ( FuncDecl< BoolSort pred,
int ...  args 
)
inline

Add table fact to the fixedpoint solver.

Exceptions
Z3Exception

Definition at line 108 of file Fixedpoint.java.

108 {
109 getContext().checkContextMatch(pred);
110 Native.fixedpointAddFact(getContext().nCtx(), getNativeObject(),
111 pred.getNativeObject(), args.length, args);
112 }

◆ addRule()

void addRule ( Expr< BoolSort rule,
Symbol  name 
)
inline

Add rule into the fixedpoint solver.

Parameters
ruleimplication (Horn clause) representing rule
nameNullable rule name.
Exceptions
Z3Exception

Definition at line 97 of file Fixedpoint.java.

97 {
98 getContext().checkContextMatch(rule);
99 Native.fixedpointAddRule(getContext().nCtx(), getNativeObject(),
100 rule.getNativeObject(), AST.getNativeObject(name));
101 }

◆ getAnswer()

Expr<?> getAnswer ( )
inline

Retrieve satisfying instance or instances of solver, or definitions for the recursive predicates that show unsatisfiability.

Exceptions
Z3Exception

Definition at line 181 of file Fixedpoint.java.

182 {
183 long ans = Native.fixedpointGetAnswer(getContext().nCtx(), getNativeObject());
184 return (ans == 0) ? null : Expr.create(getContext(), ans);
185 }

◆ getAssertions()

BoolExpr[] getAssertions ( )
inline

Retrieve set of assertions added to fixedpoint context.

Exceptions
Z3Exception

Definition at line 275 of file Fixedpoint.java.

276 {
277 ASTVector v = new ASTVector(getContext(), Native.fixedpointGetAssertions(getContext().nCtx(), getNativeObject()));
278 return v.ToBoolExprArray();
279 }

◆ getCoverDelta()

Expr<?> getCoverDelta ( int  level,
FuncDecl< BoolSort predicate 
)
inline

Retrieve the cover of a predicate.

Exceptions
Z3Exception

Definition at line 210 of file Fixedpoint.java.

211 {
212 long res = Native.fixedpointGetCoverDelta(getContext().nCtx(),
213 getNativeObject(), level, predicate.getNativeObject());
214 return (res == 0) ? null : Expr.create(getContext(), res);
215 }

◆ getHelp()

String getHelp ( )
inline

A string that describes all available fixedpoint solver parameters.

Definition at line 33 of file Fixedpoint.java.

34 {
35 return Native.fixedpointGetHelp(getContext().nCtx(), getNativeObject());
36 }

◆ getNumLevels()

int getNumLevels ( FuncDecl< BoolSort predicate)
inline

Retrieve the number of levels explored for a given predicate.

Definition at line 199 of file Fixedpoint.java.

200 {
201 return Native.fixedpointGetNumLevels(getContext().nCtx(), getNativeObject(),
202 predicate.getNativeObject());
203 }

◆ getParameterDescriptions()

ParamDescrs getParameterDescriptions ( )
inline

Retrieves parameter descriptions for Fixedpoint solver.

Exceptions
Z3Exception

Definition at line 56 of file Fixedpoint.java.

57 {
58 return new ParamDescrs(getContext(), Native.fixedpointGetParamDescrs(
59 getContext().nCtx(), getNativeObject()));
60 }

◆ getReasonUnknown()

String getReasonUnknown ( )
inline

Retrieve explanation why fixedpoint engine returned status Unknown.

Definition at line 190 of file Fixedpoint.java.

191 {
192 return Native.fixedpointGetReasonUnknown(getContext().nCtx(),
193 getNativeObject());
194 }

◆ getRules()

BoolExpr[] getRules ( )
inline

Retrieve set of rules added to fixedpoint context.

Exceptions
Z3Exception

Definition at line 264 of file Fixedpoint.java.

265 {
266 ASTVector v = new ASTVector(getContext(), Native.fixedpointGetRules(getContext().nCtx(), getNativeObject()));
267 return v.ToBoolExprArray();
268 }

◆ getStatistics()

Statistics getStatistics ( )
inline

Fixedpoint statistics.

Exceptions
Z3Exception

Definition at line 286 of file Fixedpoint.java.

287 {
288 return new Statistics(getContext(), Native.fixedpointGetStatistics(
289 getContext().nCtx(), getNativeObject()));
290 }

◆ ParseFile()

BoolExpr[] ParseFile ( String  file)
inline

Parse an SMT-LIB2 file with fixedpoint rules. Add the rules to the current fixedpoint context. Return the set of queries in the file.

Definition at line 297 of file Fixedpoint.java.

298 {
299 ASTVector av = new ASTVector(getContext(), Native.fixedpointFromFile(getContext().nCtx(), getNativeObject(), file));
300 return av.ToBoolExprArray();
301 }

◆ ParseString()

BoolExpr[] ParseString ( String  s)
inline

Parse an SMT-LIB2 string with fixedpoint rules. Add the rules to the current fixedpoint context. Return the set of queries in the file.

Definition at line 308 of file Fixedpoint.java.

309 {
310 ASTVector av = new ASTVector(getContext(), Native.fixedpointFromString(getContext().nCtx(), getNativeObject(), s));
311 return av.ToBoolExprArray();
312 }

◆ query() [1/2]

Status query ( Expr< BoolSort query)
inline

Query the fixedpoint solver. A query is a conjunction of constraints. The constraints may include the recursively defined relations. The query is satisfiable if there is an instance of the query variables and a derivation for it. The query is unsatisfiable if there are no derivations satisfying the query variables.

Exceptions
Z3Exception

Definition at line 123 of file Fixedpoint.java.

123 {
124 getContext().checkContextMatch(query);
125 Z3_lbool r = Z3_lbool.fromInt(Native.fixedpointQuery(getContext().nCtx(),
126 getNativeObject(), query.getNativeObject()));
127 switch (r)
128 {
129 case Z3_L_TRUE:
130 return Status.SATISFIABLE;
131 case Z3_L_FALSE:
132 return Status.UNSATISFIABLE;
133 default:
134 return Status.UNKNOWN;
135 }
136 }
Status query(Expr< BoolSort > query)
Z3_lbool
Lifted Boolean type: false, undefined, true.
Definition z3_api.h:58
@ Z3_L_TRUE
Definition z3_api.h:61
@ Z3_L_FALSE
Definition z3_api.h:59
Status
Status values.
Definition Status.cs:29

Referenced by Fixedpoint.query().

◆ query() [2/2]

Status query ( FuncDecl< BoolSort >[]  relations)
inline

Query the fixedpoint solver. A query is an array of relations. The query is satisfiable if there is an instance of some relation that is non-empty. The query is unsatisfiable if there are no derivations satisfying any of the relations.

Exceptions
Z3Exception

Definition at line 146 of file Fixedpoint.java.

146 {
147 getContext().checkContextMatch(relations);
148 Z3_lbool r = Z3_lbool.fromInt(Native.fixedpointQueryRelations(getContext()
149 .nCtx(), getNativeObject(), AST.arrayLength(relations), AST
150 .arrayToNative(relations)));
151 switch (r)
152 {
153 case Z3_L_TRUE:
154 return Status.SATISFIABLE;
155 case Z3_L_FALSE:
156 return Status.UNSATISFIABLE;
157 default:
158 return Status.UNKNOWN;
159 }
160 }

◆ registerRelation()

void registerRelation ( FuncDecl< BoolSort f)
inline

Register predicate as recursive relation.

Exceptions
Z3Exception

Definition at line 83 of file Fixedpoint.java.

84 {
85 getContext().checkContextMatch(f);
86 Native.fixedpointRegisterRelation(getContext().nCtx(), getNativeObject(),
87 f.getNativeObject());
88 }

◆ setParameters()

void setParameters ( Params  value)
inline

Sets the fixedpoint solver parameters.

Exceptions
Z3Exception

Definition at line 43 of file Fixedpoint.java.

44 {
45
46 getContext().checkContextMatch(value);
47 Native.fixedpointSetParams(getContext().nCtx(), getNativeObject(),
48 value.getNativeObject());
49 }

◆ setPredicateRepresentation()

void setPredicateRepresentation ( FuncDecl< BoolSort f,
Symbol[]  kinds 
)
inline

Instrument the Datalog engine on which table representation to use for recursive predicate.

Definition at line 242 of file Fixedpoint.java.

243 {
244 Native.fixedpointSetPredicateRepresentation(getContext().nCtx(),
245 getNativeObject(), f.getNativeObject(), AST.arrayLength(kinds),
246 Symbol.arrayToNative(kinds));
247
248 }

◆ toString() [1/2]

String toString ( )
inline

Retrieve internal string representation of fixedpoint object.

Definition at line 232 of file Fixedpoint.java.

233 {
234 return Native.fixedpointToString(getContext().nCtx(), getNativeObject(),
235 0, null);
236 }

◆ toString() [2/2]

String toString ( Expr< BoolSort >[]  queries)
inline

Convert benchmark given as set of axioms, rules and queries to a string.

Definition at line 253 of file Fixedpoint.java.

254 {
255 return Native.fixedpointToString(getContext().nCtx(), getNativeObject(),
256 AST.arrayLength(queries), AST.arrayToNative(queries));
257 }

◆ updateRule()

void updateRule ( Expr< BoolSort rule,
Symbol  name 
)
inline

Update named rule into in the fixedpoint solver.

Parameters
ruleimplication (Horn clause) representing rule
nameNullable rule name.
Exceptions
Z3Exception

Definition at line 169 of file Fixedpoint.java.

169 {
170 getContext().checkContextMatch(rule);
171 Native.fixedpointUpdateRule(getContext().nCtx(), getNativeObject(),
172 rule.getNativeObject(), AST.getNativeObject(name));
173 }