本文整理汇总了C#中Microsoft.Z3.Context.MkStore方法的典型用法代码示例。如果您正苦于以下问题:C# Context.MkStore方法的具体用法?C# Context.MkStore怎么用?C# Context.MkStore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Z3.Context
的用法示例。
在下文中一共展示了Context.MkStore方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ArrayExample2
/// <summary>
/// Prove <tt>store(a1, i1, v1) = store(a2, i2, v2) implies (i1 = i3 or i2 = i3 or select(a1, i3) = select(a2, i3))</tt>.
/// </summary>
/// <remarks>This example demonstrates how to use the array theory.</remarks>
public static void ArrayExample2(Context ctx)
{
Console.WriteLine("ArrayExample2");
Sort int_type = ctx.IntSort;
Sort array_type = ctx.MkArraySort(int_type, int_type);
ArrayExpr a1 = (ArrayExpr)ctx.MkConst("a1", array_type);
ArrayExpr a2 = ctx.MkArrayConst("a2", int_type, int_type);
Expr i1 = ctx.MkConst("i1", int_type);
Expr i2 = ctx.MkConst("i2", int_type);
Expr i3 = ctx.MkConst("i3", int_type);
Expr v1 = ctx.MkConst("v1", int_type);
Expr v2 = ctx.MkConst("v2", int_type);
Expr st1 = ctx.MkStore(a1, i1, v1);
Expr st2 = ctx.MkStore(a2, i2, v2);
Expr sel1 = ctx.MkSelect(a1, i3);
Expr sel2 = ctx.MkSelect(a2, i3);
/* create antecedent */
BoolExpr antecedent = ctx.MkEq(st1, st2);
/* create consequent: i1 = i3 or i2 = i3 or select(a1, i3) = select(a2, i3) */
BoolExpr consequent = ctx.MkOr(new BoolExpr[] { ctx.MkEq(i1, i3), ctx.MkEq(i2, i3), ctx.MkEq(sel1, sel2) });
/* prove store(a1, i1, v1) = store(a2, i2, v2) implies (i1 = i3 or i2 = i3 or select(a1, i3) = select(a2, i3)) */
BoolExpr thm = ctx.MkImplies(antecedent, consequent);
Console.WriteLine("prove: store(a1, i1, v1) = store(a2, i2, v2) implies (i1 = i3 or i2 = i3 or select(a1, i3) = select(a2, i3))");
Console.WriteLine("{0}", (thm));
Prove(ctx, thm);
}
示例2: Run
public void Run()
{
Dictionary<string, string> cfg = new Dictionary<string, string>() {
{ "AUTO_CONFIG", "true" },
{ "MODEL", "true" } };
using (Context ctx = new Context(cfg))
{
Sort I = ctx.IntSort;
ArrayExpr A = ctx.MkArrayConst("A", I, I);
IntExpr x = ctx.MkIntConst("x");
Console.WriteLine(ctx.MkSelect(A, x));
Console.WriteLine(ctx.MkStore(A, x, ctx.MkInt(10)));
Expr q = ctx.MkSelect(ctx.MkStore(A, ctx.MkInt(2), ctx.MkAdd(x, ctx.MkInt(1))), ctx.MkInt(2));
Console.WriteLine(q);
Console.WriteLine(q.Simplify());
}
}
示例3: Run
public void Run()
{
using (Context ctx = new Context())
{
ArrayExpr a = ctx.MkArrayConst("a", ctx.IntSort, ctx.IntSort);
FuncDecl f = ctx.MkFuncDecl("f", ctx.IntSort, ctx.IntSort);
ArrayExpr m = ctx.MkMap(f, a);
Console.WriteLine(m);
Console.WriteLine(m.IsArrayMap);
Console.WriteLine(a.IsArrayMap);
Console.WriteLine(m.IsSelect);
Console.WriteLine(ctx.MkSelect(m, ctx.MkInt(0)).IsSelect);
Console.WriteLine(ctx.MkStore(m, ctx.MkInt(0), ctx.MkInt(1)).IsStore);
Console.WriteLine(ctx.MkStore(m, ctx.MkInt(0), ctx.MkInt(1)));
Console.WriteLine(m.IsStore);
Console.WriteLine(m.FuncDecl);
Console.WriteLine(m.FuncDecl.Parameters[0].FuncDecl);
Console.WriteLine(m.FuncDecl.Parameters[0].FuncDecl[ctx.MkInt(0)]);
Console.WriteLine(ctx.MkSelect(m, ctx.MkInt(10)));
}
}
示例4: Run
public void Run()
{
Dictionary<string, string> cfg = new Dictionary<string, string>() {
{ "AUTO_CONFIG", "true" },
{ "MODEL", "true" } };
using (Context ctx = new Context(cfg))
{
ArrayExpr A = ctx.MkArrayConst("A", ctx.IntSort, ctx.IntSort);
IntExpr x = ctx.MkIntConst("x");
IntExpr y = ctx.MkIntConst("y");
Solver s = ctx.MkSolver();
s.Assert(ctx.MkEq(ctx.MkSelect(A, x), x));
s.Assert(ctx.MkEq(ctx.MkStore(A, x, y), A));
Console.WriteLine(s);
Console.WriteLine(s.Check());
Console.WriteLine(s.Model);
}
}