Z3
 
Loading...
Searching...
No Matches
Public Member Functions
OnClause Class Reference
+ Inheritance diagram for OnClause:

Public Member Functions

 OnClause (Context ctx, Solver solver)
 
void onClause (Expr<?> proof_hint, int[] deps, ASTVector literals)
 
void close ()
 

Detailed Description

Clause inference callback.

Allows users to observe clauses learned during solving. Useful for custom learning strategies, clause sharing in parallel solvers, debugging, and proof extraction.

Usage: create an instance, override onClause(Expr, int[], ASTVector), and close the instance when done.

Definition at line 34 of file OnClause.java.

Constructor & Destructor Documentation

◆ OnClause()

OnClause ( Context  ctx,
Solver  solver 
)
inline

Creates an on-clause callback for the given solver.

Parameters
ctxThe Z3 context
solverThe solver to register the callback with
Exceptions
Z3Exception

Definition at line 46 of file OnClause.java.

46 {
47 this.ctx = ctx;
48 javainfo = Native.onClauseInit(this, ctx.nCtx(), solver.getNativeObject());
49 }

Member Function Documentation

◆ close()

void close ( )
inline

Unregisters the callback and frees associated resources. Must be called when the callback is no longer needed.

Definition at line 79 of file OnClause.java.

79 {
80 if (javainfo != 0) {
81 Native.onClauseDestroy(javainfo);
82 javainfo = 0;
83 }
84 }

◆ onClause()

void onClause ( Expr<?>  proof_hint,
int[]  deps,
ASTVector  literals 
)
inline

Called when a clause is inferred during solving.

The life-time of proof_hint and literals is limited to the scope of this callback. If you want to store them, you must duplicate the expressions or extract the literals before returning.

Parameters
proof_hintA partial or comprehensive derivation justifying the inference (may be null)
depsDependency indices
literalsThe inferred clause as a vector of literals

Definition at line 63 of file OnClause.java.

63{}