Z3
Public Member Functions | Properties
UserPropagator Class Reference

Propagator context for .Net More...

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 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:120

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 243 of file UserPropagator.cs.

244 {
245 Propagate(terms, ctx.MkFalse());
246 }
BoolExpr MkFalse()
The false Term.
Definition: Context.cs:900
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 235 of file UserPropagator.cs.

236 {
237 Propagate(terms, ctx.MkFalse());
238 }

◆ 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


◆ 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 230 of file UserPropagator.cs.

230{ 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 346 of file UserPropagator.cs.

347 {
348 Native.Z3_solver_next_split(ctx.nCtx, this.callback, e.NativeObject, idx, phase);
349 }

◆ Pop()

virtual void Pop ( uint  n)
inlinevirtual

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


Definition at line 225 of file UserPropagator.cs.

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

◆ Propagate()

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

Propagate consequence

Definition at line 251 of file UserPropagator.cs.

252 {
253 var nTerms = Z3Object.ArrayToNative(terms.ToArray());
254 Native.Z3_solver_propagate_consequence(ctx.nCtx, this.callback, (uint)nTerms.Length, nTerms, 0u, null, null, conseq.NativeObject);
255 }

Referenced by UserPropagator.Conflict().

◆ Push()

virtual void Push ( )
inlinevirtual

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


Definition at line 220 of file UserPropagator.cs.

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

◆ Register()

void Register ( Expr  term)
inline

Track assignments to a term

Definition at line 354 of file UserPropagator.cs.

355 {
356 if (this.callback != IntPtr.Zero)
357 {
358 Native.Z3_solver_propagate_register_cb(ctx.nCtx, callback, term.NativeObject);
359 }
360 else
361 {
362 Native.Z3_solver_propagate_register(ctx.nCtx, solver.NativeObject, term.NativeObject);
363 }
364 }

Property Documentation

◆ Created

CreatedEh Created
set

Set created callback

Definition at line 317 of file UserPropagator.cs.

318 {
319 set
320 {
321 this.created_wrapper = _created;
322 this.created_eh = value;
323 if (solver != null)
324 Native.Z3_solver_propagate_created(ctx.nCtx, solver.NativeObject, created_wrapper);
325 }
326 }

◆ Decide

DecideEh Decide
set

Set decision callback

Definition at line 331 of file UserPropagator.cs.

332 {
333 set
334 {
335 this.decide_wrapper = _decide;
336 this.decide_eh = value;
337 if (solver != null)
338 Native.Z3_solver_propagate_decide(ctx.nCtx, solver.NativeObject, decide_wrapper);
339 }
340 }

◆ Diseq

EqEh Diseq
set

Set disequality event callback

Definition at line 303 of file UserPropagator.cs.

304 {
305 set
306 {
307 this.diseq_wrapper = _diseq;
308 this.diseq_eh = value;
309 if (solver != null)
310 Native.Z3_solver_propagate_diseq(ctx.nCtx, solver.NativeObject, diseq_wrapper);
311 }
312 }

◆ Eq

EqEh Eq
set

Set equality event callback

Definition at line 289 of file UserPropagator.cs.

290 {
291 set
292 {
293 this.eq_wrapper = _eq;
294 this.eq_eh = value;
295 if (solver != null)
296 Native.Z3_solver_propagate_eq(ctx.nCtx, solver.NativeObject, eq_wrapper);
297 }
298 }

◆ Final

Action Final
set

Set final callback

Definition at line 275 of file UserPropagator.cs.

276 {
277 set
278 {
279 this.final_wrapper = _final;
280 this.final_eh = value;
281 if (solver != null)
282 Native.Z3_solver_propagate_final(ctx.nCtx, solver.NativeObject, final_wrapper);
283 }
284 }

◆ Fixed

FixedEh Fixed
set

Set fixed callback

Definition at line 261 of file UserPropagator.cs.

262 {
263 set
264 {
265 this.fixed_wrapper = _fixed;
266 this.fixed_eh = value;
267 if (solver != null)
268 Native.Z3_solver_propagate_fixed(ctx.nCtx, solver.NativeObject, fixed_wrapper);
269 }
270 }