Esempio n. 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 WS1SLt <BDD>(x, y);
            var xLTzLTy     = (new WS1SLt <BDD>(x, z)) & (new WS1SLt <BDD>(z, y));
            var Ez          = new WS1SExists <BDD>(z, xLTzLTy);
            var notEz       = new WS1SNot <BDD>(Ez);
            var xSyDef      = new WS1SAnd <BDD>(xLTy, notEz);
            var ca          = new CartesianAlgebraBDD <BDD>(solver);
            var aut_xSyDef  = xSyDef.GetAutomaton(ca, x, y);
            var aut_xLTzLTy = xLTzLTy.GetAutomaton(ca, x, y, z);
            var aut_Ez      = Ez.GetAutomaton(ca, x, y);
            var aut_notEz   = notEz.GetAutomaton(ca, x, y);
            var aut_xLTy    = xLTy.GetAutomaton(ca, x, y);

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

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

            Assert.IsTrue(equiv);
        }
Esempio n. 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 WS1SLt <BDD>(x, y);
            var xLTzLTy       = (new WS1SLt <BDD>(x, z)) & (new WS1SLt <BDD>(z, y));
            var Ez            = new WS1SExists <BDD>(z, xLTzLTy);
            var notEz         = new WS1SNot <BDD>(Ez);
            var xSyDef        = new WS1SAnd <BDD>(xLTy, notEz);

            var aut_xSyDef  = xSyDef.GetAutomatonBDD(solver, nrOfLabelBits, x, y);
            var aut_xLTzLTy = xLTzLTy.GetAutomatonBDD(solver, nrOfLabelBits, x, y, z);
            var aut_Ez      = Ez.GetAutomatonBDD(solver, nrOfLabelBits, x, y).Determinize(solver).Minimize(solver);
            var aut_notEz   = notEz.GetAutomatonBDD(solver, nrOfLabelBits, x, y);
            var aut_xLTy    = xLTy.GetAutomatonBDD(solver, nrOfLabelBits, x, y);

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

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

            Assert.IsTrue(equiv);
        }
Esempio n. 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 WS1SLt <BoolExpr>(x, y);
            var xLTzLTy     = (new WS1SLt <BoolExpr>(x, z)) & (new WS1SLt <BoolExpr>(z, y));
            var Ez          = new WS1SExists <BoolExpr>(z, xLTzLTy);
            var notEz       = new WS1SNot <BoolExpr>(Ez);
            var xSyDef      = new WS1SAnd <BoolExpr>(xLTy, notEz);
            var aut_xSyDef  = xSyDef.GetAutomaton(alg, x, y);
            var aut_xLTzLTy = xLTzLTy.GetAutomaton(alg, x, y, z);
            var aut_Ez      = Ez.GetAutomaton(alg, x, y);
            var aut_notEz   = notEz.GetAutomaton(alg, x, y);
            var aut_xLTy    = xLTy.GetAutomaton(alg, x, y);

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

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

            Assert.IsTrue(equiv);
        }