コード例 #1
0
        public void TestWS1S_GetAutomatonBDD_eq_GetAutomaton()
        {
            var solver = new CharSetSolver(BitWidth.BV7);
            //var nrOfLabelBits = (int)BitWidth.BV7;
            var isDigit  = solver.MkCharSetFromRegexCharClass(@"\d");
            var isLetter = solver.MkCharSetFromRegexCharClass(@"(c|C)");
            var x        = new Variable("x", false);
            var y        = new Variable("y", false);
            var z        = new Variable("z", false);
            var X        = new Variable("X", false);
            //there are at least two distinct positions x and y
            var xy = new MSOAnd <BDD>(new MSONot <BDD>(new MSOEq <BDD>(x, y)), new MSOAnd <BDD>(new MSOIsSingleton <BDD>(x), new MSOIsSingleton <BDD>(y)));
            //there is a set X containing x and y and all positions z in X have characters that satisfy isWordLetter
            var x_sub_X    = new MSOSubset <BDD>(x, X);
            var y_sub_X    = new MSOSubset <BDD>(y, X);
            var z_sub_X    = new MSOSubset <BDD>(z, X);
            var isletter_z = new MSOPredicate <BDD>(isLetter, z);
            var psi        = new MSOExists <BDD>(X, (x_sub_X & y_sub_X & ~(new MSOExists <BDD>(z, ~((~((new MSOIsSingleton <BDD>(z)) & z_sub_X)) | isletter_z)))));

            var atLeast2w   = xy & psi;
            var atLeast2wEE = new MSOExists <BDD>(x, (new MSOExists <BDD>(y, atLeast2w)));
            var autBDD      = atLeast2w.GetAutomaton(solver);
            var ca          = new CartesianAlgebraBDD <BDD>(solver);
            var autPROD     = atLeast2w.GetAutomaton(ca);
            //autBDD.ShowGraph("autBDD");
            //autPROD.ShowGraph("autPROD");
            var aut_atLeast2wEE1 = BasicAutomata.Restrict(atLeast2wEE.GetAutomaton(ca));
            var aut_atLeast2wEE2 = atLeast2wEE.GetAutomaton(solver);

            //aut_atLeast2wEE1.ShowGraph("aut_atLeast2wEE1");
            //aut_atLeast2wEE2.ShowGraph("aut_atLeast2wEE2");
            Assert.IsTrue(aut_atLeast2wEE1.IsEquivalentWith(aut_atLeast2wEE2));
        }
コード例 #2
0
 public void TestMSO_Member()
 {
     var solver           = new CharSetSolver(BitWidth.BV7);
     var ca               = new CartesianAlgebraBDD <BDD>(solver);
     var x                = new Variable("x", false);
     var y                = new Variable("y", false);
     var fo_x             = new MSOIsSingleton <BDD>(x);
     MSOFormula <BDD> xSy = new MSOSubset <BDD>(x, y);
     var mem              = new MSOAnd <BDD>(xSy, fo_x);
     var aut_mem          = mem.GetAutomaton(ca);
     //aut_mem.ShowGraph("aut_mem");
 }
コード例 #3
0
ファイル: MSOZ3Test.cs プロジェクト: michkot/Automata
 public void TestMSO_Equal()
 {
     var solver = new CharSetSolver(BitWidth.BV7);
     var ca = new CartesianAlgebraBDD<BDD>(solver);
     var x = new Variable("x", false);
     var y = new Variable("y", false);
     var fo_x = new MSOIsSingleton<BDD>(x) ;
     var fo_y = new MSOIsSingleton<BDD>(y);
     MSOFormula<BDD> fo = new MSOAnd<BDD>(fo_x, fo_y);
     MSOFormula<BDD> xSy = new MSOSubset<BDD>(x, y);
     MSOFormula<BDD> ySx = new MSOSubset<BDD>(y, x);
     MSOFormula<BDD> yEQx = new MSOAnd<BDD>(xSy, ySx);
     yEQx = new MSOAnd<BDD>(yEQx, fo);
     var aut_yEQx = yEQx.GetAutomaton(ca);
     //aut_yEQx.ShowGraph("aut_yEQx");
 }