コード例 #1
0
        public void WS1SSingleton()
        {
            var solver = new CharSetSolver(BitWidth.BV64);  //new solver using ASCII encoding

            List<char> alph = new List<char> { 'a', 'b' };
            HashSet<char> al = new HashSet<char>(alph);

            WS1SFormula f1 = new WS1SSingleton("X");
            WS1SFormula phi = new WS1SExists("X", f1);

            var dfa = phi.getDFA(al, solver);

            var test = solver.Convert(@"^(a|b)+$").Determinize(solver).Minimize(solver);

            string file = "../../../MSOZ3Test/DotFiles/singletona";

            solver.SaveAsDot(dfa, "aut", file);   //extension .dot  is added automatically when missing

            Assert.IsTrue(dfa.IsEquivalentWith(test, solver));
        }
コード例 #2
0
        public void WS1SSucc()
        {
            var solver = new CharSetSolver(BitWidth.BV64);  //new solver using ASCII encoding

            List<char> alph = new List<char> { 'a', 'b' };
            HashSet<char> al = new HashSet<char>(alph);

            WS1SFormula f3 = new WS1SSucc("X", "Y");

            WS1SFormula phi = new WS1SExists("X", new WS1SExists("Y", f3));

            var dfa = phi.getDFA(al, solver);

            var test = solver.Convert(@"^(a|b){2,}$");

            string file = "../../../MSOZ3Test/DotFiles/containsab";

            solver.SaveAsDot(dfa, "aut", file);   //extension .dot  is added automatically when missing

            Assert.IsTrue(dfa.IsEquivalentWith(test, solver));
        }
コード例 #3
0
        public void WS1SFormula()
        {
            var solver = new CharSetSolver(BitWidth.BV64);  //new solver using ASCII encoding

            List<char> alph = new List<char> { 'a', 'b' };
            HashSet<char> al = new HashSet<char>(alph);

            WS1SFormula f1 = new WS1SUnaryPred("X", solver.MkCharConstraint(false, 'a'));
            WS1SFormula f2 = new WS1SUnaryPred("Y", solver.MkCharConstraint(false, 'b'));
            WS1SFormula f3 = new WS1SSucc("X", "Y");
            WS1SFormula phi = new WS1SAnd(new WS1SAnd(f1, f2), f3);

            WS1SFormula psi = new WS1SSucc("Y", "Z");

            WS1SFormula formula = new WS1SExists("X", new WS1SExists("Y",
                new WS1SAnd(phi, new WS1SNot(new WS1SExists("Z", psi)))));

            StringBuilder sb = new StringBuilder();
            formula.ToString(sb);
            Console.WriteLine(sb.ToString());

            var dfa = formula.getDFA(al, solver);

            var test = solver.Convert(@"^(a|b)*ab$");

            string file = "../../../MSOZ3Test/DotFiles/endsinab";

            solver.SaveAsDot(dfa, "aut", file);   //extension .dot  is added automatically when missing

            Assert.IsTrue(dfa.IsEquivalentWith(test, solver));
        }
コード例 #4
0
        public void WS1SSubset()
        {
            var solver = new CharSetSolver(BitWidth.BV64);  //new solver using ASCII encoding

            List<char> alph = new List<char> { 'a', 'b' };
            HashSet<char> al = new HashSet<char>(alph);

            WS1SFormula f1 = new WS1SUnaryPred("X", solver.MkCharConstraint(false, 'a'));
            WS1SFormula f2 = new WS1SUnaryPred("Y1", solver.MkCharConstraint(false, 'b'));
            WS1SFormula f3 = new WS1SUnaryPred("Z", solver.MkCharConstraint(false, 'a'));
            WS1SFormula f = new WS1SAnd(f1, new WS1SAnd(f2, f3));

            WS1SFormula s1 = new WS1SSucc("X", "Y1");
            WS1SFormula s2 = new WS1SSucc("Y2", "Z");
            WS1SFormula s3 = new WS1SSubset("Y1", "Y2");
            WS1SFormula s = new WS1SAnd(new WS1SAnd(s1, s2), s3);

            WS1SFormula phi = new WS1SExists("X",
                                new WS1SExists("Y1",
                                    new WS1SExists("Y2",
                                        new WS1SExists("Z",
                                            new WS1SAnd(f, s)))));

            WS1SFormula phit = new WS1SExists("X",
                                       new WS1SExists("Y",
                                           new WS1SSubset("X", "Y")));
            var dd = phit.getDFA(al, solver);

            //solver.SaveAsDot(phit.getDFA(al, solver), "bla","bla.dot");

            var dfa = phi.getDFA(al, solver);

            var test = solver.Convert(@"^(a|b)*aba(a|b)*$");

            Assert.IsTrue(dfa.IsEquivalentWith(test, solver));

            string file = "../../../MSOZ3Test/DotFiles/aba";

            solver.SaveAsDot(dfa, "aut", file);   //extension .dot  is added automatically when missing
        }