//TODO consider creating a special StateUpdateMerge class /// <summary>Constructor for merging. prevKey_Regular is the key for the regular continue for the provided branchCondition</summary> public StateUpdate(BoolExpr branchCondition, string prevKey_Regular, string prevKey_Branch, string nextKey, Tools tools) { this._ctx = new Context(tools.Settings); // housekeeping in Dispose(); this._branch_Condition = branchCondition.Translate(this._ctx) as BoolExpr; this._prevKey_Regular = prevKey_Regular; this._prevKey_Branch = prevKey_Branch; this._nextKey = nextKey; this._tools = tools; this.Empty = false; }
public void Set(Flags flag, BoolExpr value, BoolExpr undef) { this.Empty = false; lock (this._ctxLock) { Context ctx = this._ctx; value = value?.Translate(ctx) as BoolExpr; undef = undef?.Translate(ctx) as BoolExpr; BoolExpr key = Tools.Create_Key(flag, this.NextKey, ctx); BoolExpr value_Constraint; { if (value == null) { value_Constraint = ctx.MkEq(key, Tools.Create_Flag_Key_Fresh(flag, this._tools.Rand, ctx)); } else if (value.IsTrue) { value_Constraint = key; } else if (value.IsFalse) { value_Constraint = ctx.MkNot(key); } else { value_Constraint = ctx.MkEq(key, value); } } BoolExpr undef_Constraint; { if (undef == null) { undef_Constraint = ctx.MkEq(key, Tools.Create_Flag_Key_Fresh(flag, this._tools.Rand, ctx)); } else if (undef.IsTrue) { undef_Constraint = key; } else if (undef.IsFalse) { undef_Constraint = ctx.MkNot(key); } else { undef_Constraint = ctx.MkEq(key, undef); } } this.Set_Private(flag, value_Constraint, false); this.Set_Private(flag, undef_Constraint, true); } }
//TODO consider creating a special StateUpdateMerge class /// <summary>Constructor for merging. prevKey_Regular is the key for the regular continue for the provided branchCondition</summary> public StateUpdate(BoolExpr branchCondition, string prevKey_Regular, string prevKey_Branch, string nextKey, Tools tools) { Contract.Requires(tools != null); Contract.Requires(branchCondition != null); this.ctx_ = new Context(tools.ContextSettings); // housekeeping in Dispose(); this.branch_Condition_ = branchCondition.Translate(this.ctx_) as BoolExpr; this.prevKey_Regular_ = prevKey_Regular; this.prevKey_Branch_ = prevKey_Branch; this.nextKey_ = nextKey; this.tools_ = tools; this.Empty = false; }
public void Assert(BoolExpr expr, bool undef, bool translate) { if (expr == null) { return; } if (translate) { BoolExpr t = expr.Translate(this._ctx) as BoolExpr; if (undef) { this.Solver_U.Assert(t); } else { this.Solver.Assert(t); } } else { if (undef) { this.Solver_U.Assert(expr); } else { this.Solver.Assert(expr); } } if (undef) { this.Solver_U_Dirty = true; } else { this.Solver_Dirty = true; } }