本文整理汇总了C#中Microsoft.Z3.Tactic类的典型用法代码示例。如果您正苦于以下问题:C# Tactic类的具体用法?C# Tactic怎么用?C# Tactic使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Tactic类属于Microsoft.Z3命名空间,在下文中一共展示了Tactic类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AndThen
/// <summary>
/// Create a tactic that applies <paramref name="t1"/> to a Goal and
/// then <paramref name="t2"/> to every subgoal produced by <paramref name="t1"/>.
/// </summary>
public Tactic AndThen(Tactic t1, Tactic t2, params Tactic[] ts)
{
Contract.Requires(t1 != null);
Contract.Requires(t2 != null);
Contract.Requires(ts == null || Contract.ForAll(0, ts.Length, j => ts[j] != null));
Contract.Ensures(Contract.Result<Tactic>() != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
CheckContextMatch(ts);
IntPtr last = IntPtr.Zero;
if (ts != null && ts.Length > 0)
{
last = ts[ts.Length - 1].NativeObject;
for (int i = ts.Length - 2; i >= 0; i--)
last = Native.Z3_tactic_and_then(nCtx, ts[i].NativeObject, last);
}
if (last != IntPtr.Zero)
{
last = Native.Z3_tactic_and_then(nCtx, t2.NativeObject, last);
return new Tactic(this, Native.Z3_tactic_and_then(nCtx, t1.NativeObject, last));
}
else
return new Tactic(this, Native.Z3_tactic_and_then(nCtx, t1.NativeObject, t2.NativeObject));
}
示例2: Cond
/// <summary>
/// Create a tactic that applies <paramref name="t1"/> to a given goal if the probe
/// <paramref name="p"/> evaluates to true and <paramref name="t2"/> otherwise.
/// </summary>
public Tactic Cond(Probe p, Tactic t1, Tactic t2)
{
Contract.Requires(p != null);
Contract.Requires(t1 != null);
Contract.Requires(t2 != null);
Contract.Ensures(Contract.Result<Tactic>() != null);
CheckContextMatch(p);
CheckContextMatch(t1);
CheckContextMatch(t2);
return new Tactic(this, Native.Z3_tactic_cond(nCtx, p.NativeObject, t1.NativeObject, t2.NativeObject));
}
示例3: When
/// <summary>
/// Create a tactic that applies <paramref name="t"/> to a given goal if the probe
/// <paramref name="p"/> evaluates to true.
/// </summary>
/// <remarks>
/// If <paramref name="p"/> evaluates to false, then the new tactic behaves like the <c>skip</c> tactic.
/// </remarks>
public Tactic When(Probe p, Tactic t)
{
Contract.Requires(p != null);
Contract.Requires(t != null);
Contract.Ensures(Contract.Result<Tactic>() != null);
CheckContextMatch(t);
CheckContextMatch(p);
return new Tactic(this, Native.Z3_tactic_when(nCtx, p.NativeObject, t.NativeObject));
}
示例4: With
/// <summary>
/// Create a tactic that applies <paramref name="t"/> using the given set of parameters <paramref name="p"/>.
/// </summary>
/// <remarks>Alias for <c>UsingParams</c></remarks>
public Tactic With(Tactic t, Params p)
{
Contract.Requires(t != null);
Contract.Requires(p != null);
Contract.Ensures(Contract.Result<Tactic>() != null);
return UsingParams(t, p);
}
示例5: TryFor
/// <summary>
/// Create a tactic that applies <paramref name="t"/> to a goal for <paramref name="ms"/> milliseconds.
/// </summary>
/// <remarks>
/// If <paramref name="t"/> does not terminate within <paramref name="ms"/> milliseconds, then it fails.
/// </remarks>
public Tactic TryFor(Tactic t, uint ms)
{
Contract.Requires(t != null);
Contract.Ensures(Contract.Result<Tactic>() != null);
CheckContextMatch(t);
return new Tactic(this, Native.Z3_tactic_try_for(nCtx, t.NativeObject, ms));
}
示例6: UsingParams
/// <summary>
/// Create a tactic that applies <paramref name="t"/> using the given set of parameters <paramref name="p"/>.
/// </summary>
public Tactic UsingParams(Tactic t, Params p)
{
Contract.Requires(t != null);
Contract.Requires(p != null);
Contract.Ensures(Contract.Result<Tactic>() != null);
CheckContextMatch(t);
CheckContextMatch(p);
return new Tactic(this, Native.Z3_tactic_using_params(nCtx, t.NativeObject, p.NativeObject));
}
示例7: Repeat
/// <summary>
/// Create a tactic that keeps applying <paramref name="t"/> until the goal is not
/// modified anymore or the maximum number of iterations <paramref name="max"/> is reached.
/// </summary>
public Tactic Repeat(Tactic t, uint max = uint.MaxValue)
{
Contract.Requires(t != null);
Contract.Ensures(Contract.Result<Tactic>() != null);
CheckContextMatch(t);
return new Tactic(this, Native.Z3_tactic_repeat(nCtx, t.NativeObject, max));
}
示例8: Then
/// <summary>
/// Create a tactic that applies <paramref name="t1"/> to a Goal and
/// then <paramref name="t2"/> to every subgoal produced by <paramref name="t1"/>.
/// </summary>
/// <remarks>
/// Shorthand for <c>AndThen</c>.
/// </remarks>
public Tactic Then(Tactic t1, Tactic t2, params Tactic[] ts)
{
Contract.Requires(t1 != null);
Contract.Requires(t2 != null);
Contract.Requires(ts == null || Contract.ForAll(0, ts.Length, j => ts[j] != null));
Contract.Ensures(Contract.Result<Tactic>() != null);
return AndThen(t1, t2, ts);
}
示例9: ParAndThen
/// <summary>
/// Create a tactic that applies <paramref name="t1"/> to a given goal and then <paramref name="t2"/>
/// to every subgoal produced by <paramref name="t1"/>. The subgoals are processed in parallel.
/// </summary>
public Tactic ParAndThen(Tactic t1, Tactic t2)
{
Contract.Requires(t1 != null);
Contract.Requires(t2 != null);
Contract.Ensures(Contract.Result<Tactic>() != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
return new Tactic(this, Native.Z3_tactic_par_and_then(nCtx, t1.NativeObject, t2.NativeObject));
}
示例10: OrElse
/// <summary>
/// Create a tactic that first applies <paramref name="t1"/> to a Goal and
/// if it fails then returns the result of <paramref name="t2"/> applied to the Goal.
/// </summary>
public Tactic OrElse(Tactic t1, Tactic t2)
{
Contract.Requires(t1 != null);
Contract.Requires(t2 != null);
Contract.Ensures(Contract.Result<Tactic>() != null);
CheckContextMatch(t1);
CheckContextMatch(t2);
return new Tactic(this, Native.Z3_tactic_or_else(nCtx, t1.NativeObject, t2.NativeObject));
}
示例11: MkSolver
/// <summary>
/// Creates a solver that is implemented using the given tactic.
/// </summary>
/// <remarks>
/// The solver supports the commands <c>Push</c> and <c>Pop</c>, but it
/// will always solve each check from scratch.
/// </remarks>
public Solver MkSolver(Tactic t)
{
Contract.Requires(t != null);
Contract.Ensures(Contract.Result<Solver>() != null);
return new Solver(this, Native.Z3_mk_solver_from_tactic(nCtx, t.NativeObject));
}
示例12: ApplyTactic
static ApplyResult ApplyTactic(Context ctx, Tactic t, Goal g)
{
Console.WriteLine("\nGoal: " + g);
ApplyResult res = t.Apply(g);
Console.WriteLine("Application result: " + res);
Status q = Status.UNKNOWN;
foreach (Goal sg in res.Subgoals)
if (sg.IsDecidedSat) q = Status.SATISFIABLE;
else if (sg.IsDecidedUnsat) q = Status.UNSATISFIABLE;
switch (q)
{
case Status.UNKNOWN:
Console.WriteLine("Tactic result: Undecided");
break;
case Status.SATISFIABLE:
Console.WriteLine("Tactic result: SAT");
break;
case Status.UNSATISFIABLE:
Console.WriteLine("Tactic result: UNSAT");
break;
}
return res;
}
示例13: SolveTactical
static void SolveTactical(Context ctx, Tactic t, Goal g, Status sat)
{
Solver s = ctx.MkSolver(t);
Console.WriteLine("\nTactical solver: " + s);
foreach (BoolExpr a in g.Formulas)
s.Assert(a);
Console.WriteLine("Solver: " + s);
if (s.Check() != sat)
throw new TestFailedException();
}