當前位置: 首頁>>代碼示例>>C#>>正文


C# Z3.Tactic類代碼示例

本文整理匯總了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));
        }
開發者ID:kayceesrk,項目名稱:Z3,代碼行數:30,代碼來源:Context.cs

示例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));
        }
開發者ID:kayceesrk,項目名稱:Z3,代碼行數:16,代碼來源:Context.cs

示例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));
        }
開發者ID:kayceesrk,項目名稱:Z3,代碼行數:17,代碼來源:Context.cs

示例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);
        }
開發者ID:kayceesrk,項目名稱:Z3,代碼行數:12,代碼來源:Context.cs

示例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));
        }
開發者ID:kayceesrk,項目名稱:Z3,代碼行數:14,代碼來源:Context.cs

示例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));
        }
開發者ID:kayceesrk,項目名稱:Z3,代碼行數:13,代碼來源:Context.cs

示例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));
        }
開發者ID:kayceesrk,項目名稱:Z3,代碼行數:12,代碼來源:Context.cs

示例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);
        }
開發者ID:kayceesrk,項目名稱:Z3,代碼行數:16,代碼來源:Context.cs

示例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));
        }
開發者ID:kayceesrk,項目名稱:Z3,代碼行數:14,代碼來源:Context.cs

示例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));
        }
開發者ID:kayceesrk,項目名稱:Z3,代碼行數:14,代碼來源:Context.cs

示例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));
        }
開發者ID:kayceesrk,項目名稱:Z3,代碼行數:14,代碼來源:Context.cs

示例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;
        }
開發者ID:perillaseed,項目名稱:z3,代碼行數:27,代碼來源:Program.cs

示例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();
        }
開發者ID:perillaseed,項目名稱:z3,代碼行數:12,代碼來源:Program.cs


注:本文中的Microsoft.Z3.Tactic類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。