本文整理汇总了C#中Z3Provider.ApplySubstitution方法的典型用法代码示例。如果您正苦于以下问题:C# Z3Provider.ApplySubstitution方法的具体用法?C# Z3Provider.ApplySubstitution怎么用?C# Z3Provider.ApplySubstitution使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Z3Provider
的用法示例。
在下文中一共展示了Z3Provider.ApplySubstitution方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getAutomata
internal override Automaton<Expr> getAutomata(Z3Provider z3p, List<string> variables, Expr universe, Expr var, Sort sort)
{
//var bit1 = z3p.Z3.MkInt2Bv(1,
// z3p.MkInt(1));
var bit1 = z3p.Z3.MkInt2BV(BVConst.BVSIZE, (IntExpr)z3p.MkInt(1));
//Sort for pairs (input theory, BV)
var bv = z3p.Z3.MkBitVecSort(BVConst.BVSIZE);
var pairSort = z3p.MkTupleSort(sort, bv);
//Add the representation of the existential variable to the list of variables
var newVariables = variables.ToArray().ToList();
newVariables.Insert(0, variable);
//Compute the DFA for the formula phi
var phiDfa = phi.getAutomata(z3p, newVariables, universe, var, sort);
//Compute the new moves by dropping the last bit of every element in the phiMoves
var newMoves = Automaton<Expr>.Empty.GetMoves().ToList();
foreach (var oldMove in phiDfa.GetMoves())
{
var oldCond = oldMove.Label;
var t = z3p.MkProj(1,var);
//Compute the new conditions
var newCond0 = z3p.ApplySubstitution(oldCond, t,
z3p.Z3.MkBVSHL((BitVecExpr)t, (BitVecExpr)bit1));
var newCond1 = z3p.ApplySubstitution(oldCond, t,
z3p.MkBvAdd(
z3p.Z3.MkBVSHL((BitVecExpr)t, (BitVecExpr)bit1),
bit1));
//Update the new set of moves
newMoves.Add(new Move<Expr>(oldMove.SourceState, oldMove.TargetState, z3p.MkOr(z3p.Simplify(newCond0),z3p.Simplify(newCond1))));
}
//Build the new dfa with the new moves
return Automaton<Expr>.Create(phiDfa.InitialState, phiDfa.GetFinalStates(), newMoves);
//.Determinize(z3p).MinimizeClassical(z3p, int.MaxValue,false);
}