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


C# Z3Provider.MkGe方法代码示例

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


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

示例1: TestRegularLookaheadComposition3

        public void TestRegularLookaheadComposition3()
        {
            Z3Provider Z = new Z3Provider();
            var A = (Z.TT.MkRankedAlphabet("A", Z.IntSort, new string[] { "z", "u", "b" }, new int[] { 0, 1, 2 }));
            var B = (Z.TT.MkRankedAlphabet("B", Z.IntSort, new string[] { "z", "u", "b" }, new int[] { 0, 1, 2 }));
            var C = (Z.TT.MkRankedAlphabet("C", Z.IntSort, new string[] { "z", "u", "b" }, new int[] { 0, 1, 2 }));

            var _0 = Z.MkInt(0);
            var _1 = Z.MkInt(1);
            var _2 = Z.MkInt(2);
            var _7 = Z.MkInt(7);

            var AB_r0 = Z.TT.MkTreeRule(A, B, 0, "u", Z.MkLe(_0, A.AttrVar), B.MkTree("u", Z.MkAdd(_1, A.AttrVar), A.MkTrans(B, 1, 1)), new int[][] { new int[] { 3, 1 } });
            var AB_r1 = Z.TT.MkTreeRule(A, B, 1, "u", Z.MkLe(_1, A.AttrVar), B.MkTree("u", Z.MkAdd(_1, A.AttrVar), A.MkTrans(B, 0, 1)), new int[][] { new int[] { 2, 0 } });
            var AB_r2 = Z.TT.MkTreeRule(A, B, 1, "u", Z.MkEq(_2, A.AttrVar), B.MkTree("z", Z.MkAdd(_1, A.AttrVar)));

            var AB_q2 = Z.TT.MkTreeRule(A, B, 2, "u", Z.MkGe(_0, A.AttrVar), null, new int[][] { new int[] { 3 } });
            var AB_q3a = Z.TT.MkTreeRule(A, B, 3, "u", Z.MkGe(_1, A.AttrVar), null, new int[][] { new int[] { 2 } });
            var AB_q3b = Z.TT.MkTreeRule(A, B, 3, "u", Z.MkEq(_2, A.AttrVar), null);

            //just accept the input if the attribute is 1, delete the child subtree and return zeroC(1)
            var BC_r0 = Z.TT.MkTreeRule(B, C, 0, "u", Z.MkEq(_1, B.AttrVar), C.MkTree("z", Z.MkAdd(_7, B.AttrVar)));

            var AB = Z.TT.MkTreeAutomaton(0, A, B, new TreeRule[] { AB_r0, AB_r1, AB_r2, AB_q2, AB_q3a, AB_q3b });
            var BC = Z.TT.MkTreeAutomaton(0, B, C, new TreeRule[] { BC_r0 });

            var AC = TreeTransducer.ComposeR(AB, BC);

            Assert.AreEqual<int>(5, AC.RuleCount);
        }
开发者ID:AutomataDotNet,项目名称:Automata,代码行数:30,代码来源:TreeTransducerTests.cs

示例2: TestDomainAutomatonCreation

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

            var r1 = Z.TT.MkTreeRule(A, A, 0, "two", Z.MkGe(A.AttrVar, Z.MkInt(2)),
                A.MkTree("two", A.AttrVar, A.MkTree("one", A.AttrVar, A.MkTrans(A, 0, 1)),
                                           A.MkTree("two", A.AttrVar, A.MkTrans(A, 0, 2), A.MkTrans(A, 1, 2))));

            var r2 = Z.TT.MkTreeRule(A, A, 1, "two", Z.MkLe(A.AttrVar, Z.MkInt(5)),
               A.MkTree("two", A.AttrVar, A.MkTree("one", A.AttrVar, A.MkTrans(A, 0, 1)),
                                          A.MkTree("two", A.AttrVar, A.MkTrans(A, 0, 1), A.MkTrans(A, 1, 2))));

            var r3 = Z.TT.MkTreeRule(A, A, 1, "one", Z.True, A.MkTree("zero", A.AttrVar));

            var r4 = Z.TT.MkTreeRule(A, A, 0, "one", Z.True, A.MkTree("zero", A.AttrVar));
            var r5 = Z.TT.MkTreeRule(A, A, 0, "zero", Z.True, A.MkTree("zero", A.AttrVar));

            var T = Z.TT.MkTreeAutomaton(0, A, A, new TreeRule[] { r1, r2, r3, r4, r5 });

            var D = T.ComputeDomainAcceptor();

            Assert.AreEqual<int>(2, T.StateCount);
            Assert.AreEqual<int>(2, D.StateCount);
            Assert.AreEqual<int>(5, D.RuleCount);
        }
开发者ID:AutomataDotNet,项目名称:Automata,代码行数:26,代码来源:TreeTransducerTests.cs

示例3: TestLanguageIntersection

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

            var a_rule2 = A.MkAcceptorRule(0, "two", Z.MkGe(A.AttrVar, Z.MkInt(2)), 0, 0);
            var a_rule1 = A.MkAcceptorRule(0, "one", Z.MkGe(A.AttrVar, Z.MkInt(1)), 0);
            var a_rule0 = A.MkAcceptorRule(0, "zero", Z.MkGe(A.AttrVar, Z.MkInt(0)));

            var b_rule2 = A.MkAcceptorRule(0, "two", Z.MkLe(A.AttrVar, Z.MkInt(2)), 0, 0);
            var b_rule1 = A.MkAcceptorRule(0, "one", Z.MkLt(A.AttrVar, Z.MkInt(1)), 0);
            var b_rule0 = A.MkAcceptorRule(0, "zero", Z.MkLe(A.AttrVar, Z.MkInt(0)));

            var a = A.MkTreeAcceptor(a_rule2, a_rule1, a_rule0);
            var b = A.MkTreeAcceptor(b_rule2, b_rule1, b_rule0);

            //all two-nodes have attribute 2, all zero-nodes have attribute 0 and no one-node is possible because the guards conflict
            var ab = a.Intersect(b);

            var t = A.MkTree("two", Z.MkInt(2), A.MkTree("two", Z.MkInt(2), A.MkTree("zero", Z.MkInt(0)), A.MkTree("zero", Z.MkInt(0))), A.MkTree("zero", Z.MkInt(0)));

            var t_out = ab[t];
            Assert.AreEqual<int>(1, t_out.Length);
            Assert.AreEqual<Expr>(null, t_out[0]);

            var t2 = A.MkTree("two", Z.MkInt(2), A.MkTree("two", Z.MkInt(3), A.MkTree("zero", Z.MkInt(0)), A.MkTree("zero", Z.MkInt(0))), A.MkTree("zero", Z.MkInt(0)));

            var t_out2 = ab[t2];
            Assert.AreEqual<int>(0, t_out2.Length);

            var t_a = a[t2];
            Assert.AreEqual<int>(1, t_a.Length);
            Assert.AreEqual<Expr>(null, t_a[0]);
        }
开发者ID:AutomataDotNet,项目名称:Automata,代码行数:36,代码来源:TreeTransducerTests.cs

示例4: TestFastGeneration

        public void TestFastGeneration()
        {
            Z3Provider Z = new Z3Provider();

            Sort color = Z.MkEnumSort("Color", "blue", "green", "red");

            string enum_sort_name = color.Name.ToString();
            Assert.AreEqual<string>("Color", enum_sort_name);
            Assert.AreEqual<string>("green", Z.GetEnumElement("Color", "green").FuncDecl.Name.ToString());

            FuncDecl[] fields = new FuncDecl[5];
            FuncDecl mkTuple;
            Sort attrSort = Z.MkTupleSort("$", new string[] { "i", "b", "e", "s", "r" }, new Sort[] { Z.IntSort, Z.BoolSort, color, Z.StringSort, Z.RealSort }, out mkTuple, out fields);

            string tuple_sort_name = attrSort.Name.ToString();
            string tuple_contructor_name = mkTuple.Name.ToString();

            Assert.AreEqual<string>("$", tuple_sort_name);
            Assert.AreEqual<string>("$", tuple_contructor_name);

            Assert.AreEqual<string>("i", fields[0].Name.ToString());
            Assert.AreEqual<string>("b", fields[1].Name.ToString());
            Assert.AreEqual<string>("e", fields[2].Name.ToString());

            Assert.AreEqual<string>("Int", Z.GetRange(fields[0]).Name.ToString());
            Assert.AreEqual<string>("Bool", Z.GetRange(fields[1]).Name.ToString());
            Assert.AreEqual<string>("Color", Z.GetRange(fields[2]).Name.ToString());

            var A = (Z.TT.MkRankedAlphabet("A", attrSort, new string[] { "zero", "one", "two" }, new int[] { 0, 1, 2 }));

            Expr _i_plus_1 = Z.MkApp(mkTuple, Z.MkAdd(Z.MkProj(0, A.AttrVar), Z.MkInt(1)), Z.True,
                Z.MkIte(Z.MkGe(Z.MkProj(0, A.AttrVar), Z.MkInt(4)), Z.GetEnumElement("Color", "green"), Z.GetEnumElement("Color", "blue")), Z.MkProj(3, A.AttrVar), Z.MkAdd(Z.MkProj(4, A.AttrVar), Z.MkNumeral("9/3", Z.RealSort)));

            Expr _i_plus_1_foo = Z.MkApp(mkTuple, Z.MkAdd(Z.MkProj(0, A.AttrVar), Z.MkInt(1)), Z.True,
            Z.MkIte(Z.MkGe(Z.MkProj(0, A.AttrVar), Z.MkInt(4)), Z.GetEnumElement("Color", "green"), Z.GetEnumElement("Color", "blue")), Z.MkListFromString("foo", Z.CharacterSort), Z.MkNumeral("5.06", Z.RealSort));

            var proj = Z.GetTupleField(attrSort, 0);
            var proj_term = Z.MkApp(proj, _i_plus_1);

            var proj_term2 = Z.MkProj(0, _i_plus_1);

            var r1 = Z.TT.MkTreeRule(A, A, 0, "two", Z.MkGe(Z.MkProj(0, A.AttrVar), Z.MkInt(2)),
                A.MkTree("two", _i_plus_1, A.MkTree("one", _i_plus_1, A.MkTrans(A, 0, 1)),
                                           A.MkTree("two", _i_plus_1, A.MkTrans(A, 0, 2), A.MkTrans(A, 1, 2))));

            var r2 = Z.TT.MkTreeRule(A, A, 1, "two", Z.MkLe(Z.MkProj(0, A.AttrVar), Z.MkInt(5)),
               A.MkTree("two", _i_plus_1, A.MkTree("one", _i_plus_1, A.MkTrans(A, 0, 1)),
                                          A.MkTree("two", _i_plus_1, A.MkTrans(A, 0, 1), A.MkTrans(A, 1, 2))));

            var r3 = Z.TT.MkTreeRule(A, A, 1, "one", Z.True, A.MkTree("zero", _i_plus_1));

            var r4 = Z.TT.MkTreeRule(A, A, 0, "one", Z.True, A.MkTree("zero", _i_plus_1_foo));
            var r5 = Z.TT.MkTreeRule(A, A, 0, "zero", Z.True, A.MkTree("zero", _i_plus_1_foo));

            var T = Z.TT.MkTreeAutomaton(0, A, A, new TreeRule[] { r1, r2, r3, r4, r5 });

            var D = T.ComputeDomainAcceptor();

            var sb = new StringBuilder();
            var fastgen = new FastGen(Z);
            fastgen.ToFast(enum_sort_name, sb);
            fastgen.ToFast(A, sb);
            fastgen.ToFast("A", T, sb, false);
            fastgen.GetStateName = (x => "p_" + x);
            fastgen.ToFast("A", D, sb, true);

            Console.WriteLine(sb.ToString());
        }
开发者ID:AutomataDotNet,项目名称:Automata,代码行数:68,代码来源:FastTests.cs


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