当前位置: 首页>>代码示例>>C#>>正文


C# Z3Provider.MkNot方法代码示例

本文整理汇总了C#中Z3Provider.MkNot方法的典型用法代码示例。如果您正苦于以下问题:C# Z3Provider.MkNot方法的具体用法?C# Z3Provider.MkNot怎么用?C# Z3Provider.MkNot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Z3Provider的用法示例。


在下文中一共展示了Z3Provider.MkNot方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MintermBlowupTestHelperMoore

        private static int MintermBlowupTestHelperMoore(int K)
        {
            var z3p = new Z3Provider(BitWidth.BV32);
            var x = z3p.CharVar;
            var zero = z3p.MkNumeral(0, z3p.CharSort);
            Func<int, Expr> gamma = k =>
            {
                int kth = 1 << k;
                Expr mask = z3p.MkNumeral(kth, z3p.CharSort);
                Expr cond = z3p.MkNot(z3p.MkEq(z3p.MkBvAnd(x, mask), zero));
                return cond;
            };
            var moves = new List<Move<Expr>>();
            for (int i = 0; i < K; i++)
                moves.Add(Move<Expr>.Create(i, i + 1, gamma(i)));
            for (int i = 0; i < K; i++)
                moves.Add(Move<Expr>.Create(i == 0 ? 0 : K + i, K + i + 1, i ==0 ? z3p.MkNot(gamma(i)) : gamma(i)));
            var aut = Automaton<Expr>.Create(z3p, 0, new int[] { K, 2 * K }, moves);

            var sfa = new SFA<FuncDecl, Expr, Sort>(z3p, z3p.CharSort, aut);
            sfa.Automaton.CheckDeterminism(true);

            int t = System.Environment.TickCount;
            var autmin = sfa.Automaton.MinimizeMoore();
            t = System.Environment.TickCount - t;

            return t;
        }
开发者ID:AutomataDotNet,项目名称:Automata,代码行数:28,代码来源:FiniteAutomataTests.cs

示例2: SFAtest2

        public void SFAtest2()
        {
            Z3Provider solver = new Z3Provider();
            string a = @"^[A-Za-z0-9][email protected](([A-Za-z0-9\-])+\.)+([A-Za-z\-])+$"; //.Net regex
            string b = @"^\d.*$";                                            //.Net regex
            //corresponding SFAs
            var A = new SFAz3(solver, solver.CharacterSort, solver.RegexConverter.Convert(a));
            var B = new SFAz3(solver, solver.CharacterSort, solver.RegexConverter.Convert(b));

            A.AssertTheory(); //assert the theories of both SFAs to the solver
            B.AssertTheory();

            //declare a new uninterpreted constant of sort List<character>
            Expr inputConst = solver.MkFreshConst("input", A.InputListSort);

            //get a solution for input so that it is accepted by A but not by B
            var assertion = solver.MkAnd(A.MkAccept(inputConst),
                                         solver.MkNot(B.MkAccept(inputConst)));
            var model = solver.MainSolver.GetModel(assertion, inputConst);
            string input = model[inputConst].StringValue;  //actual witness in L(A)-L(B)
        }
开发者ID:AutomataDotNet,项目名称:Automata,代码行数:21,代码来源:FiniteAutomataTests.cs


注:本文中的Z3Provider.MkNot方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。