本文整理汇总了C#中Z3Provider.MkBvExtract方法的典型用法代码示例。如果您正苦于以下问题:C# Z3Provider.MkBvExtract方法的具体用法?C# Z3Provider.MkBvExtract怎么用?C# Z3Provider.MkBvExtract使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Z3Provider
的用法示例。
在下文中一共展示了Z3Provider.MkBvExtract方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getAutomata
internal override Automaton<Expr> getAutomata(Z3Provider z3p, List<string> variables, Expr universe, Expr var, Sort sort)
{
uint set1bit = (uint)variables.IndexOf(set1);
uint set2bit = (uint)variables.IndexOf(set2);
//Sort for pairs (input theory, BV)
var bv = z3p.Z3.MkBitVecSort(BVConst.BVSIZE);
var pairSort = z3p.MkTupleSort(sort, bv);
//Create the predicate for the two singleton sets
var pred = z3p.MkBvUlt(z3p.MkProj(1, var),
z3p.Z3.MkInt2BV(BVConst.BVSIZE,
(IntExpr)z3p.MkInt((int)(Math.Pow(2.0, variables.Count)))
));
pred = z3p.MkAnd(pred, universe);
var b1 = z3p.MkBvExtract(set1bit, set1bit, z3p.MkProj(1, var));
var b2 = z3p.MkBvExtract(set2bit, set2bit, z3p.MkProj(1, var));
var bit0 = z3p.Z3.MkInt2BV(1,
(IntExpr)z3p.MkInt(0));
var bit1 = z3p.Z3.MkInt2BV(1,
(IntExpr)z3p.MkInt(1));
var pred0 = z3p.MkAnd(pred, z3p.MkBvUle(b1, bit0));
pred0 = z3p.MkAnd(pred, z3p.MkBvUle(b2, bit0));
var pred1 = z3p.MkAnd(pred, z3p.MkBvUge(b1, bit1));
pred0 = z3p.MkAnd(pred, z3p.MkBvUle(b2, bit0));
var pred2 = z3p.MkAnd(pred, z3p.MkBvUle(b1, bit0));
pred0 = z3p.MkAnd(pred, z3p.MkBvUge(b2, bit1));
//Create the automaton with one state and one transition
var less = Automaton<Expr>.Create(0, new int[] { 2 }, new Move<Expr>[] {
new Move<Expr>(0, 0, pred0),
new Move<Expr>(0, 1, pred1),
new Move<Expr>(1, 1, pred0),
new Move<Expr>(1, 2, pred2),
new Move<Expr>(2, 2, pred0)
});
//Minimize and output
return less;
}