Z3
Public Member Functions | Properties
UserPropagator Class Reference

Propagator context for .Net More...

+ Inheritance diagram for UserPropagator:

Public Member Functions

delegate void FixedEh (Expr term, Expr value)
 Delegate type for fixed callback Note that the life-time of the term and value only applies within the scope of the callback. That means the term and value cannot be stored in an array, dictionary or similar and accessed after the callback has returned. Use the functionality Dup on expressions to create a duplicate copy that extends the lifetime. More...
 
delegate void EqEh (Expr term, Expr value)
 Delegate type for equality or disequality callback More...
 
delegate void CreatedEh (Expr term)
 Delegate type for when a new term using a registered function symbol is created internally More...
 
delegate void DecideEh (ref Expr term, ref uint idx, ref int phase)
 Delegate type for callback into solver's branching

Parameters
termA bit-vector or Boolean used for branching
idxIf the term is a bit-vector, then an index into the bit-vector being branched on
phaseSet phase to -1 (false) or 1 (true) to override solver's phase
More...
 
 UserPropagator (Solver s)
 Propagator constructor from a solver class. More...
 
 UserPropagator (Context _ctx)
 Propagator constructor from a context. It is used from inside of Fresh. More...
 
virtual void Dispose ()
 Must be called. The object will not be garbage collected automatically even if the context is disposed More...
 
virtual void Push ()
 Virtual method for push. It must be overwritten by inherited class. More...
 
virtual void Pop (uint n)
 Virtual method for pop. It must be overwritten by inherited class. More...
 
virtual UserPropagator Fresh (Context ctx)
 Virtual method for fresh. It can be overwritten by inherited class. More...
 
void Conflict (params Expr[] terms)
 Declare combination of assigned expressions a conflict More...
 
void Conflict (IEnumerable< Expr > terms)
 Declare combination of assigned expressions a conflict More...
 
void Propagate (IEnumerable< Expr > terms, Expr conseq)
 Propagate consequence More...
 
void NextSplit (Expr e, uint idx, int phase)
 Set the next decision More...
 
void Register (Expr term)
 Track assignments to a term More...
 

Properties

FixedEh Fixed [set]
 Set fixed callback More...
 
Action Final [set]
 Set final callback More...
 
EqEh Eq [set]
 Set equality event callback More...
 
EqEh Diseq [set]
 Set disequality event callback More...
 
CreatedEh Created [set]
 Set created callback More...
 
DecideEh Decide [set]
 Set decision callback More...
 

Detailed Description

Propagator context for .Net


Definition at line 40 of file UserPropagator.cs.

Constructor & Destructor Documentation

◆ UserPropagator() [1/2]

UserPropagator ( Solver  s)
inline

Propagator constructor from a solver class.


Definition at line 186 of file UserPropagator.cs.

187  {
188  gch = GCHandle.Alloc(this);
189  solver = s;
190  ctx = solver.Context;
191  push_eh = _push;
192  pop_eh = _pop;
193  fresh_eh = _fresh;
194  Native.Z3_solver_propagate_init(ctx.nCtx, solver.NativeObject, GCHandle.ToIntPtr(gch), push_eh, pop_eh, fresh_eh);
195  }
Context Context
Access Context object
Definition: Z3Object.cs:111

Referenced by UserPropagator.Fresh().

◆ UserPropagator() [2/2]

UserPropagator ( Context  _ctx)
inline

Propagator constructor from a context. It is used from inside of Fresh.


Definition at line 200 of file UserPropagator.cs.

201  {
202  gch = GCHandle.Alloc(this);
203  solver = null;
204  ctx = _ctx;
205  }

Member Function Documentation

◆ Conflict() [1/2]

void Conflict ( IEnumerable< Expr terms)
inline

Declare combination of assigned expressions a conflict

Definition at line 253 of file UserPropagator.cs.

254  {
255  Propagate(terms, ctx.MkFalse());
256  }
BoolExpr MkFalse()
The false Term.
Definition: Context.cs:902
void Propagate(IEnumerable< Expr > terms, Expr conseq)
Propagate consequence

◆ Conflict() [2/2]

void Conflict ( params Expr[]  terms)
inline

Declare combination of assigned expressions a conflict

Definition at line 245 of file UserPropagator.cs.

246  {
247  Propagate(terms, ctx.MkFalse());
248  }

◆ CreatedEh()

delegate void CreatedEh ( Expr  term)

Delegate type for when a new term using a registered function symbol is created internally


◆ DecideEh()

delegate void DecideEh ( ref Expr  term,
ref uint  idx,
ref int  phase 
)

Delegate type for callback into solver's branching

Parameters
termA bit-vector or Boolean used for branching
idxIf the term is a bit-vector, then an index into the bit-vector being branched on
phaseSet phase to -1 (false) or 1 (true) to override solver's phase


◆ Dispose()

virtual void Dispose ( )
inlinevirtual

Must be called. The object will not be garbage collected automatically even if the context is disposed

Definition at line 218 of file UserPropagator.cs.

219  {
220  if (!gch.IsAllocated)
221  return;
222  gch.Free();
223  if (solver == null)
224  ctx.Dispose();
225  }
void Dispose()
Disposes of the context.
Definition: Context.cs:4871

◆ EqEh()

delegate void EqEh ( Expr  term,
Expr  value 
)

Delegate type for equality or disequality callback


◆ FixedEh()

delegate void FixedEh ( Expr  term,
Expr  value 
)

Delegate type for fixed callback Note that the life-time of the term and value only applies within the scope of the callback. That means the term and value cannot be stored in an array, dictionary or similar and accessed after the callback has returned. Use the functionality Dup on expressions to create a duplicate copy that extends the lifetime.


◆ Fresh()

virtual UserPropagator Fresh ( Context  ctx)
inlinevirtual

Virtual method for fresh. It can be overwritten by inherited class.

Definition at line 240 of file UserPropagator.cs.

240 { return new UserPropagator(ctx); }
UserPropagator(Solver s)
Propagator constructor from a solver class.

◆ NextSplit()

void NextSplit ( Expr  e,
uint  idx,
int  phase 
)
inline

Set the next decision

Definition at line 356 of file UserPropagator.cs.

357  {
358  Native.Z3_solver_next_split(ctx.nCtx, this.callback, e.NativeObject, idx, phase);
359  }

◆ Pop()

virtual void Pop ( uint  n)
inlinevirtual

Virtual method for pop. It must be overwritten by inherited class.


Definition at line 235 of file UserPropagator.cs.

235 { throw new Z3Exception("Pop method should be overwritten"); }

◆ Propagate()

void Propagate ( IEnumerable< Expr terms,
Expr  conseq 
)
inline

Propagate consequence

Definition at line 261 of file UserPropagator.cs.

262  {
263  var nTerms = Z3Object.ArrayToNative(terms.ToArray());
264  Native.Z3_solver_propagate_consequence(ctx.nCtx, this.callback, (uint)nTerms.Length, nTerms, 0u, null, null, conseq.NativeObject);
265  }

Referenced by UserPropagator.Conflict().

◆ Push()

virtual void Push ( )
inlinevirtual

Virtual method for push. It must be overwritten by inherited class.


Definition at line 230 of file UserPropagator.cs.

230 { throw new Z3Exception("Push method should be overwritten"); }

◆ Register()

void Register ( Expr  term)
inline

Track assignments to a term

Definition at line 364 of file UserPropagator.cs.

365  {
366  if (this.callback != IntPtr.Zero)
367  {
368  Native.Z3_solver_propagate_register_cb(ctx.nCtx, callback, term.NativeObject);
369  }
370  else
371  {
372  Native.Z3_solver_propagate_register(ctx.nCtx, solver.NativeObject, term.NativeObject);
373  }
374  }

Property Documentation

◆ Created

CreatedEh Created
set

Set created callback

Definition at line 327 of file UserPropagator.cs.

328  {
329  set
330  {
331  this.created_wrapper = _created;
332  this.created_eh = value;
333  if (solver != null)
334  Native.Z3_solver_propagate_created(ctx.nCtx, solver.NativeObject, created_wrapper);
335  }
336  }

◆ Decide

DecideEh Decide
set

Set decision callback

Definition at line 341 of file UserPropagator.cs.

342  {
343  set
344  {
345  this.decide_wrapper = _decide;
346  this.decide_eh = value;
347  if (solver != null)
348  Native.Z3_solver_propagate_decide(ctx.nCtx, solver.NativeObject, decide_wrapper);
349  }
350  }

◆ Diseq

EqEh Diseq
set

Set disequality event callback

Definition at line 313 of file UserPropagator.cs.

314  {
315  set
316  {
317  this.diseq_wrapper = _diseq;
318  this.diseq_eh = value;
319  if (solver != null)
320  Native.Z3_solver_propagate_diseq(ctx.nCtx, solver.NativeObject, diseq_wrapper);
321  }
322  }

◆ Eq

EqEh Eq
set

Set equality event callback

Definition at line 299 of file UserPropagator.cs.

300  {
301  set
302  {
303  this.eq_wrapper = _eq;
304  this.eq_eh = value;
305  if (solver != null)
306  Native.Z3_solver_propagate_eq(ctx.nCtx, solver.NativeObject, eq_wrapper);
307  }
308  }

◆ Final

Action Final
set

Set final callback

Definition at line 285 of file UserPropagator.cs.

286  {
287  set
288  {
289  this.final_wrapper = _final;
290  this.final_eh = value;
291  if (solver != null)
292  Native.Z3_solver_propagate_final(ctx.nCtx, solver.NativeObject, final_wrapper);
293  }
294  }

◆ Fixed

FixedEh Fixed
set

Set fixed callback

Definition at line 271 of file UserPropagator.cs.

272  {
273  set
274  {
275  this.fixed_wrapper = _fixed;
276  this.fixed_eh = value;
277  if (solver != null)
278  Native.Z3_solver_propagate_fixed(ctx.nCtx, solver.NativeObject, fixed_wrapper);
279  }
280  }