public void MSOaafterb() { 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 formula = new MSOForallFO("x1", new MSOIf( new MSOLabel("x1", 'b'), new MSOExistsFO("x2", new MSOAnd( new MSOLess("x1", "x2"), new MSOLabel("x2", 'a'))))); 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/aafterb"; solver.SaveAsDot(dfa, "aut", file); //extension .dot is added automatically when missing }
public void MSOForall() { var solver = new CharSetSolver(BitWidth.BV64); //new solver using ASCII encoding List<char> alph = new List<char> { 'a', 'b' }; int a2 = 'a' * 2; int b2 = 'b' * 2; List<char> alph2 = new List<char> { (char)a2, (char)b2, (char)(a2+1), (char)(b2+1) }; HashSet<char> al = new HashSet<char>(alph); //ex x. all y. x<=y and a(x) MSOFormula formula = new MSOForallFO("x", new MSOLabel("x", 'b')); Assert.IsTrue(formula.CheckUseOfVars()); var dfa = formula.getDFA(al, solver); var test = solver.Convert(@"^b*$"); Assert.IsTrue(dfa.IsEquivalentWith(test, solver)); string file = "../../../MSOZ3Test/DotFiles/bstar"; solver.SaveAsDot(dfa, "aut", file); //extension .dot is added automatically when missing }