本文整理汇总了C#中Microsoft.Z3.Context.AndThen方法的典型用法代码示例。如果您正苦于以下问题:C# Context.AndThen方法的具体用法?C# Context.AndThen怎么用?C# Context.AndThen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Z3.Context
的用法示例。
在下文中一共展示了Context.AndThen方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
public void Run()
{
Dictionary<string, string> cfg = new Dictionary<string, string>() {
{ "AUTO_CONFIG", "true" } };
using (Context ctx = new Context(cfg))
{
RealExpr x = ctx.MkRealConst("x");
RealExpr y = ctx.MkRealConst("y");
RatNum zero = ctx.MkReal(0);
RatNum two = ctx.MkReal(2);
Goal g = ctx.MkGoal();
g.Assert(ctx.MkGt(x, zero));
g.Assert(ctx.MkGt(y, zero));
g.Assert(ctx.MkEq(x, ctx.MkAdd(y, two)));
Console.WriteLine(g);
Tactic t1 = ctx.MkTactic("simplify");
Tactic t2 = ctx.MkTactic("solve-eqs");
Tactic t = ctx.AndThen(t1, t2);
Console.WriteLine(t[g]);
}
}
示例2: ModelConverterTest
static void ModelConverterTest(Context ctx)
{
Console.WriteLine("ModelConverterTest");
ArithExpr xr = (ArithExpr)ctx.MkConst(ctx.MkSymbol("x"), ctx.MkRealSort());
ArithExpr yr = (ArithExpr)ctx.MkConst(ctx.MkSymbol("y"), ctx.MkRealSort());
Goal g4 = ctx.MkGoal(true);
g4.Assert(ctx.MkGt(xr, ctx.MkReal(10, 1)));
g4.Assert(ctx.MkEq(yr, ctx.MkAdd(xr, ctx.MkReal(1, 1))));
g4.Assert(ctx.MkGt(yr, ctx.MkReal(1, 1)));
ApplyResult ar = ApplyTactic(ctx, ctx.MkTactic("simplify"), g4);
if (ar.NumSubgoals == 1 && (ar.Subgoals[0].IsDecidedSat || ar.Subgoals[0].IsDecidedUnsat))
throw new TestFailedException();
ar = ApplyTactic(ctx, ctx.AndThen(ctx.MkTactic("simplify"), ctx.MkTactic("solve-eqs")), g4);
if (ar.NumSubgoals == 1 && (ar.Subgoals[0].IsDecidedSat || ar.Subgoals[0].IsDecidedUnsat))
throw new TestFailedException();
Solver s = ctx.MkSolver();
foreach (BoolExpr e in ar.Subgoals[0].Formulas)
s.Assert(e);
Status q = s.Check();
Console.WriteLine("Solver says: " + q);
Console.WriteLine("Model: \n" + s.Model);
Console.WriteLine("Converted Model: \n" + ar.ConvertModel(0, s.Model));
if (q != Status.SATISFIABLE)
throw new TestFailedException();
}