Beispiel #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);
        }
Beispiel #2
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);
        }
Beispiel #3
0
 public void TestWS1S_NotLabel()
 {
     var solver = new CharSetSolver(BitWidth.BV7);
     //var x1 = new Variable("x1", false);
     var x    = new Variable("x", false);
     var pred = new WS1SPred <BDD>(solver.MkCharConstraint('c'), x);
     var fo_x = new WS1SSingleton <BDD>(x);
     var ca   = new CartesianAlgebraBDD <BDD>(solver);
     var lab  = new WS1SAnd <BDD>(pred, fo_x);
     WS1SFormula <BDD> not_lab = new WS1SNot <BDD>(lab);
     var not_lab_actual        = new WS1SAnd <BDD>(not_lab, fo_x);
     var aut_not_lab           = not_lab_actual.GetAutomaton(ca, x);
     var aut_not_lab_prelim    = not_lab.GetAutomaton(ca, x);
     var c_aut_lab             = lab.GetAutomaton(ca, x).Complement(ca).Minimize(ca);
     //c_aut_lab.ShowGraph("c_aut_lab");
     //aut_not_lab.ShowGraph("aut_not_lab");
     //aut_not_lab_prelim.ShowGraph("aut_not_lab_prelim");
     //TBD: equivalence
 }