コード例 #1
0
        public void TestWS1S_SuccDef_GetAutomaton()
        {
            var solver      = new CharSetSolver(BitWidth.BV7);
            var x           = new Variable("x", true);
            var y           = new Variable("y", true);
            var z           = new Variable("z", true);
            var xLTy        = new MSOLt <BDD>(x, y);
            var xLTzLTy     = new MSOAnd <BDD>(new MSOLt <BDD>(x, z), new MSOLt <BDD>(z, y));
            var Ez          = new MSOExists <BDD>(z, xLTzLTy);
            var notEz       = new MSONot <BDD>(Ez);
            var xSyDef      = new MSOAnd <BDD>(xLTy, notEz);
            var ca          = new CartesianAlgebraBDD <BDD>(solver);
            var aut_xSyDef  = xSyDef.GetAutomaton(ca);
            var aut_xLTzLTy = xLTzLTy.GetAutomaton(ca);
            var aut_Ez      = Ez.GetAutomaton(ca);
            var aut_notEz   = notEz.GetAutomaton(ca);
            var aut_xLTy    = xLTy.GetAutomaton(ca);

            //aut_xSyDef.ShowGraph("aut_xSyDEf");
            //aut_xLTzLTy.ShowGraph("aut_xLTzLTy");
            //aut_Ez.ShowGraph("aut_Ez");
            //aut_notEz.ShowGraph("aut_notEz");

            var xSyPrim     = new MSOSuccN <BDD>(x, y, 1);
            var aut_xSyPrim = xSyPrim.GetAutomaton(ca);
            var equiv       = aut_xSyPrim.IsEquivalentWith(aut_xSyDef);

            Assert.IsTrue(equiv);
        }
コード例 #2
0
        public void TestWS1S_SuccDef_GetAutomatonBDD()
        {
            var solver        = new CharSetSolver(BitWidth.BV7);
            var nrOfLabelBits = (int)BitWidth.BV7;
            var x             = new Variable("x", true);
            var y             = new Variable("y", true);
            var z             = new Variable("z", true);
            var xLTy          = new MSOLt <BDD>(x, y);
            var xLTzLTy       = new MSOAnd <BDD>(new MSOLt <BDD>(x, z), new MSOLt <BDD>(z, y));
            var Ez            = new MSOExists <BDD>(z, xLTzLTy);
            var notEz         = new MSONot <BDD>(Ez);
            var xSyDef        = new MSOAnd <BDD>(xLTy, notEz);

            var aut_xSyDef  = xSyDef.GetAutomaton(solver);
            var aut_xLTzLTy = xLTzLTy.GetAutomaton(solver);
            var aut_Ez      = Ez.GetAutomaton(solver).Determinize().Minimize();
            var aut_notEz   = notEz.GetAutomaton(solver);
            var aut_xLTy    = xLTy.GetAutomaton(solver);

            //aut_xSyDef.ShowGraph("aut_xSyDEf");
            //aut_xLTzLTy.ShowGraph("aut_xLTzLTy");
            //aut_Ez.ShowGraph("aut_Ez");
            //aut_notEz.ShowGraph("aut_notEz");

            var xSyPrim     = new MSOSuccN <BDD>(x, y, 1);
            var aut_xSyPrim = xSyPrim.GetAutomaton(solver);
            var equiv       = aut_xSyPrim.IsEquivalentWith(aut_xSyDef);

            Assert.IsTrue(equiv);
        }
コード例 #3
0
        public void BooleanAlgebraZ3_test2()
        {
            var ctx         = new Context();
            var sort        = ctx.IntSort;
            var solver      = new Z3BoolAlg(ctx, sort);
            var alg         = new BDDAlgebra <BoolExpr>(solver);
            var x           = new Variable("x", true);
            var y           = new Variable("y", true);
            var z           = new Variable("z", true);
            var xLTy        = new MSOLt <BoolExpr>(x, y);
            var xLTzLTy     = new MSOAnd <BoolExpr>((new MSOLt <BoolExpr>(x, z)), (new MSOLt <BoolExpr>(z, y)));
            var Ez          = new MSOExists <BoolExpr>(z, xLTzLTy);
            var notEz       = new MSONot <BoolExpr>(Ez);
            var xSyDef      = new MSOAnd <BoolExpr>(xLTy, notEz);
            var aut_xSyDef  = xSyDef.GetAutomaton(alg);
            var aut_xLTzLTy = xLTzLTy.GetAutomaton(alg);
            var aut_Ez      = Ez.GetAutomaton(alg);
            var aut_notEz   = notEz.GetAutomaton(alg);
            var aut_xLTy    = xLTy.GetAutomaton(alg);

            //aut_xSyDef.ShowGraph("aut_xSyDEf");
            //aut_xLTzLTy.ShowGraph("aut_xLTzLTy");
            //aut_Ez.ShowGraph("aut_Ez");
            //aut_notEz.ShowGraph("aut_notEz");

            var xSyPrim     = new MSOSuccN <BoolExpr>(x, y, 1);
            var aut_xSyPrim = xSyPrim.GetAutomaton(alg);
            var equiv       = aut_xSyPrim.IsEquivalentWith(aut_xSyDef);

            Assert.IsTrue(equiv);
        }