public void MSOFirstLastSucc() { 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); //ex x. first(x) MSOFormula first = new MSOFirst("x"); MSOFormula last = new MSOLast("y"); MSOFormula succ = new MSOSucc("x", "y"); MSOFormula and = new MSOAnd(new MSOAnd(first, last), succ); MSOFormula formula = new MSOExistsFO("x", new MSOExistsFO("y", and)); Assert.IsTrue(formula.CheckUseOfVars()); var dfa = formula.getDFA(al, solver); var test = solver.Convert(@"^(a|b){2}$"); Assert.IsTrue(dfa.IsEquivalentWith(test, solver)); string file = "../../../MSOZ3Test/DotFiles/ab"; solver.SaveAsDot(dfa, "aut", file); //extension .dot is added automatically when missing }
public void MSO2a2b() { 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); MSOFormula formula1 = new MSOExistsFO("x1", new MSOExistsFO("x2", new MSOAnd( new MSOAnd( new MSOLabel("x1", 'a'), new MSOLabel("x2", 'a')), new MSONot( new MSOEqual("x1", "x2"))))); MSOFormula formula2 = new MSOExistsFO("x1", new MSOExistsFO("x2", new MSOAnd( new MSOAnd( new MSOLabel("x1", 'b'), new MSOLabel("x2", 'b')), new MSONot( new MSOEqual("x1", "x2"))))); MSOFormula formula = new MSOAnd(formula1, formula2); Assert.IsTrue(formula.CheckUseOfVars()); var WS1S = formula.ToWS1S(solver); var dfa = WS1S.getDFA(al, solver); var timer = new Stopwatch(); var tt = 100; var acc = 0L; for (int k = 0; k < tt; k++) { timer.Reset(); timer.Start(); dfa = WS1S.getDFA(al, solver); timer.Stop(); acc += timer.ElapsedMilliseconds; } Console.WriteLine("time: " + acc / tt + " ms"); //var test = solver.Convert(@"^(a|b)$"); //Assert.IsTrue(dfa.IsEquivalentWith(test, solver)); string file = "../../../MSOZ3Test/DotFiles/a2b2"; solver.SaveAsDot(dfa, "aut", file); //extension .dot is added automatically when missing }