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


C# Z3Provider.MkMod方法代码示例

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


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

示例1: RunTestForGivenSize

        private static void RunTestForGivenSize(int K)
        {
            Console.WriteLine(K);
            Z3Provider Z = new Z3Provider();
            var A = (Z.TT.MkRankedAlphabet("A", Z.IntSort, new string[] { "zero", "two" }, new int[] { 0, 2 }));

            Func<int, Expr> beta = (i => Z.MkEq(Z.MkInt(1), Z.MkMod(Z.MkDiv(A.AttrVar, Z.MkInt(1 << (i%32))), Z.MkInt(2))));

            Expr e1 = Z.MkEq(Z.MkInt(1), A.AttrVar);
            Expr e2 = Z.MkEq(Z.MkInt(2), A.AttrVar);
            Expr e3 = Z.MkEq(Z.MkInt(3), A.AttrVar);

            var r1 = Z.TT.MkTreeAcceptorRule(A, 0, "zero", e1);
            var r2 = Z.TT.MkTreeAcceptorRule(A, 1, "zero", e2);
            var r3 = Z.TT.MkTreeAcceptorRule(A, 2, "zero", e3);
            var rules = new List<TreeRule>();

            rules.Add(r1);
            rules.Add(r2);
            rules.Add(r3);

            for (int i = 0; i < K; i++)
            {
                rules.Add(Z.TT.MkTreeAcceptorRule(A, 3 * i + 3, "two", beta(i), 3 * i, 3 * i + 2));
                rules.Add(Z.TT.MkTreeAcceptorRule(A, 3 * i + 4, "two", beta(i), 3 * i + 1, 3 * i + 2));
                rules.Add(Z.TT.MkTreeAcceptorRule(A, 3 * i + 5, "two", beta(i), 3 * i + 2, 3 * i + 2));
            }

            var T = Z.TT.MkTreeAutomaton(new int[] { 3 * K , 3 * K +1 }, A, A, rules);
            var comp = T.Complete();

            Util.RunAllAlgorithms(T, comp, K.ToString(), Program.largeAlphabetFile);
        }
开发者ID:AutomataDotNet,项目名称:Automata,代码行数:33,代码来源:LargeAlphabetExperiment.cs

示例2: TestMinimization

        private static void TestMinimization(int K)
        {
            Z3Provider Z = new Z3Provider();
            var A = (Z.TT.MkRankedAlphabet("A", Z.IntSort, new string[] { "zero", "two" }, new int[] { 0, 2 }));

            Func<int, Expr> beta = (i => Z.MkEq(Z.MkInt(1), Z.MkMod(Z.MkDiv(A.AttrVar, Z.MkInt(1 << i)), Z.MkInt(2))));

            var r0 = Z.TT.MkTreeAcceptorRule(A, 0, "zero", beta(0));
            var r1 = Z.TT.MkTreeAcceptorRule(A, 1, "zero", beta(1));
            var rules = new List<TreeRule>();
            rules.Add(r0);
            rules.Add(r1);
            for (int i = 0; i < K; i++)
                rules.Add(Z.TT.MkTreeAcceptorRule(A, i + 1, "two", beta(i + 1), i, i));

            var T = Z.TT.MkTreeAutomaton(K, A, A, rules);

            var T1 = T.Determinize();
            var T2 = T1.RemoveUselessStates();

            var Tmin = T2.Minimize();

            Assert.AreNotEqual(T1.StateCount, Tmin.StateCount);

            Console.WriteLine("k = {0}, |Q| = {1}, |Delta| = {2}, |Q_d| = {3}, |Delta_d| = {4}, |Q_u| = {5}, |Delta_u| = {6},|Q_m| = {7}, |Delta_m| = {8},",
                K, T.StateCount, T.RuleCount, T1.StateCount, T1.RuleCount, T2.StateCount, T2.RuleCount, Tmin.StateCount, Tmin.RuleCount);
        }
开发者ID:AutomataDotNet,项目名称:Automata,代码行数:27,代码来源:TreeTransducerTests.cs

示例3: TestTreeAutomataMinimization

        public void TestTreeAutomataMinimization()
        {
            Z3Provider Z = new Z3Provider();
            var A = (Z.TT.MkRankedAlphabet("A", Z.IntSort, new string[] { "zero", "two" }, new int[] { 0, 2 }));

            Func<int,Expr> beta = (i => Z.MkEq(Z.MkInt(1), Z.MkMod(Z.MkDiv(A.AttrVar,Z.MkInt(1<<i)), Z.MkInt(2))));

            var r0 = Z.TT.MkTreeAcceptorRule(A, 0, "zero", beta(0));
            var r1 = Z.TT.MkTreeAcceptorRule(A, 1, "two", beta(1), 0 ,0 );
            var r2 = Z.TT.MkTreeAcceptorRule(A, 2, "two", beta(2), 1, 1);

            var T = Z.TT.MkTreeAutomaton(2, A, A, new TreeRule[] { r0, r1, r2 });

            var Tmin = T.Minimize();

            Assert.AreEqual(T.StateCount, Tmin.StateCount);
        }
开发者ID:AutomataDotNet,项目名称:Automata,代码行数:17,代码来源:TreeTransducerTests.cs


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