本文整理匯總了C#中Microsoft.Z3.Context.MkBVSHL方法的典型用法代碼示例。如果您正苦於以下問題:C# Context.MkBVSHL方法的具體用法?C# Context.MkBVSHL怎麽用?C# Context.MkBVSHL使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Microsoft.Z3.Context
的用法示例。
在下文中一共展示了Context.MkBVSHL方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Run
public void Run()
{
Dictionary<string, string> cfg = new Dictionary<string, string>() {
{ "AUTO_CONFIG", "true" } };
using (Context ctx = new Context(cfg))
{
BitVecExpr x = ctx.MkBVConst("x", 32);
BitVecExpr y = ctx.MkBVConst("y", 32);
BitVecExpr two = ctx.MkBV(2, 32);
BitVecExpr three = ctx.MkBV(3, 32);
BitVecExpr tf = ctx.MkBV(24, 32);
Solver s = ctx.MkSolver();
s.Assert(ctx.MkEq(ctx.MkBVLSHR(x, two), three));
Console.WriteLine(s.Check());
Console.WriteLine(s.Model);
s = ctx.MkSolver();
s.Assert(ctx.MkEq(ctx.MkBVSHL(x, two), three));
Console.WriteLine(s.Check());
s = ctx.MkSolver();
s.Assert(ctx.MkEq(ctx.MkBVRotateLeft(x, two), three));
Console.WriteLine(s.Check());
Console.WriteLine(s.Model);
s = ctx.MkSolver();
s.Assert(ctx.MkEq(ctx.MkBVSHL(x, two), tf));
Console.WriteLine(s.Check());
Console.WriteLine(s.Model);
}
}
示例2: Run
public void Run()
{
Dictionary<string, string> cfg = new Dictionary<string, string>() {
{ "AUTO_CONFIG", "true" } };
using (Context ctx = new Context(cfg))
{
BitVecExpr x = ctx.MkBVConst("x", 32);
BitVecExpr[] powers = new BitVecExpr[32];
for (uint i = 0; i < 32; i++)
powers[i] = ctx.MkBVSHL(ctx.MkBV(1, 32), ctx.MkBV(i, 32));
BoolExpr step_zero = ctx.MkEq(ctx.MkBVAND(x, ctx.MkBVSub(x, ctx.MkBV(1, 32))), ctx.MkBV(0, 32));
BoolExpr fast = ctx.MkAnd(ctx.MkNot(ctx.MkEq(x, ctx.MkBV(0, 32))),
step_zero);
BoolExpr slow = ctx.MkFalse();
foreach (BitVecExpr p in powers)
slow = ctx.MkOr(slow, ctx.MkEq(x, p));
TestDriver.CheckString(fast, "(and (not (= x #x00000000)) (= (bvand x (bvsub x #x00000001)) #x00000000))");
Solver s = ctx.MkSolver();
s.Assert(ctx.MkNot(ctx.MkEq(fast, slow)));
TestDriver.CheckUNSAT(s.Check());
s = ctx.MkSolver();
s.Assert(ctx.MkNot(step_zero));
TestDriver.CheckSAT(s.Check());
}
}