public void intEq2() { var solver = new CharSetSolver(BitWidth.BV64); List<char> alph = new List<char> { 'a', 'b', 'c' }; HashSet<char> al = new HashSet<char>(alph); PDLPred phi = new PDLIntEq(new PDLAllPos(), 2); StringBuilder sb = new StringBuilder(); phi.ToMSO(new FreshGen()).ToString(sb); System.Console.WriteLine(sb); var dfa = phi.GetDFA(al, solver); var test = solver.Convert(@"^(a|b|c){2}$"); Assert.IsTrue(dfa.IsEquivalentWith(test, solver)); ////string file = "../../../TestPDL/DotFiles/IntEq2"; //solver.SaveAsDot(dfa, "aut", file); }
public void once_aaa() { var solver = new CharSetSolver(BitWidth.BV64); List <char> alph = new List <char> { 'a', 'b' }; HashSet <char> al = new HashSet <char>(alph); PDLPred phi = new PDLIntEq(new PDLIndicesOf("aaa"), 1); StringBuilder sb = new StringBuilder(); phi.ToMSO(new FreshGen()).ToString(sb); System.Console.WriteLine(sb); var dfa = phi.GetDFA(al, solver); var test = solver.Convert(@"^b*(ab+|aab+)*aaa(b+a|b+aa)*b*$"); //string file = "../../../TestPDL/DotFiles/once_aaa"; //solver.SaveAsDot(dfa, "aut", file); Assert.IsTrue(dfa.IsEquivalentWith(test, solver)); }
public void intEq2() { var solver = new CharSetSolver(BitWidth.BV64); List <char> alph = new List <char> { 'a', 'b', 'c' }; HashSet <char> al = new HashSet <char>(alph); PDLPred phi = new PDLIntEq(new PDLAllPos(), 2); StringBuilder sb = new StringBuilder(); phi.ToMSO(new FreshGen()).ToString(sb); System.Console.WriteLine(sb); var dfa = phi.GetDFA(al, solver); var test = solver.Convert(@"^(a|b|c){2}$"); Assert.IsTrue(dfa.IsEquivalentWith(test, solver)); ////string file = "../../../TestPDL/DotFiles/IntEq2"; //solver.SaveAsDot(dfa, "aut", file); }
public void Test12() // ab appears twice { PDLPred phi = new PDLIntEq(new PDLIndicesOf("ab"), 2); PrintDFA(phi, "Test12", new List <char> { 'a', 'b' }); }
public void Test36() // does not contain bba { PDLPred phi = new PDLIntEq(new PDLIndicesOf("bba"), 0); PrintDFA(phi, "Test36", new List <char> { 'a', 'b' }); }
public void Test18() // aaa appears exactly once { PDLPred phi = new PDLIntEq(new PDLIndicesOf("aaa"), 1); PrintDFA(phi, "Test18", new List <char> { 'a', 'b' }); }
public void Test2() // length 2 { PDLPred phi = new PDLIntEq(new PDLAllPos(), 2); PrintDFA(phi, "Test2", new List <Char> { 'a', 'b', 'c' }); }
public void intEq2() { List <char> alph = new List <char> { 'a', 'b', 'c' }; HashSet <char> al = new HashSet <char>(alph); PDLPred phi = new PDLIntEq(new PDLAllPos(), 2); StringBuilder sb = new StringBuilder(); List <Pair <int, Pair <PDLPred, long> > > pairs = SynthTimer(phi, al, sb); Output(sb, "intEq2"); }
public void once_aaa() { var solver = new CharSetSolver(BitWidth.BV64); List <char> alph = new List <char> { 'a', 'b' }; HashSet <char> al = new HashSet <char>(alph); PDLPred phi = new PDLIntEq(new PDLIndicesOf("aaa"), 1); StringBuilder sb = new StringBuilder(); List <Pair <int, Pair <PDLPred, long> > > pairs = SynthTimer(phi, al, sb); Output(sb, "once_aaa"); }
public void abTwice() { var solver = new CharSetSolver(BitWidth.BV64); List <char> alph = new List <char> { 'a', 'b' }; HashSet <char> al = new HashSet <char>(alph); PDLPred phi = new PDLIntEq(new PDLIndicesOf("ab"), 2); var dfa = phi.GetDFA(al, solver); StringBuilder sb = new StringBuilder(); List <Pair <int, Pair <PDLPred, long> > > pairs = SynthTimer(phi, al, sb); Output(sb, "abTwice"); }
public void checkEval() { PDLPred phi = new PDLIntEq(new PDLIndicesOf("aaa"), 1); System.Console.WriteLine("Exactly once aaa:"); System.Console.WriteLine(phi.Eval("baaaabbb", new Dictionary <string, int>())); PDLPred phi1 = new PDLNot(new PDLIntLeq(new PDLIndicesOf("aa"), 0)); PDLPred phi2 = (new PDLBelongs(new PDLPredecessor(new PDLLast()), new PDLIndicesOf("ab"))); //System.Console.WriteLine("prevLast " + (new PDLprev(new PDLlast())).Eval("aaabbccab", new Dictionary<string, int>())); //System.Console.WriteLine("indab " + (new PDLindicesOf("ab")).Eval("aaabbccab", new Dictionary<string, int>())); //System.Console.WriteLine("phi2 " + phi2.Eval("aaabbccab", new Dictionary<string, int>())); phi = new PDLAnd(phi1, new PDLNot(phi2)); System.Console.WriteLine("Contains aa and not end ab:"); System.Console.WriteLine(phi.Eval("aaabbccabc", new Dictionary <string, int>())); phi = new PDLAnd(new PDLIf(new PDLAtPos('a', new PDLFirst()), new PDLAtPos('a', new PDLLast())), new PDLIf(new PDLAtPos('b', new PDLFirst()), new PDLAtPos('b', new PDLLast()))); System.Console.WriteLine("Same First Last:"); System.Console.WriteLine(phi.Eval("abbba", new Dictionary <string, int>())); phi = new PDLExistsFO("x0", new PDLAtPos('a', new PDLPosVar("x0"))); System.Console.WriteLine("exists a:"); System.Console.WriteLine(phi.Eval("ab", new Dictionary <string, int>())); phi = new PDLEndsWith("abc"); System.Console.WriteLine("ends with abc:"); System.Console.WriteLine(phi.Eval("bc", new Dictionary <string, int>())); phi = new PDLStartsWith("abc"); System.Console.WriteLine("starts with abc:"); System.Console.WriteLine(phi.Eval("abcababcccabc", new Dictionary <string, int>())); }
public static Testcase createTestFormula21() { PDLPred language = new PDLIntEq(new PDLIndicesOf("101"), 0); return new Testcase(21, createAlphabet10(), language); }
public static Testcase createTestcase20() { PDLPred language = new PDLIntEq(new PDLIndicesOf("101"), 0); return new Testcase(20, oneZeroAlphabet, language); }
public void Test36() // does not contain bba { PDLPred phi = new PDLIntEq(new PDLIndicesOf("bba"), 0); PrintDFA(phi, "Test36", new List<char> { 'a', 'b' }); }
public void checkEval() { PDLPred phi = new PDLIntEq(new PDLIndicesOf("aaa"), 1); System.Console.WriteLine("Exactly once aaa:"); System.Console.WriteLine(phi.Eval("baaaabbb", new Dictionary<string, int>())); PDLPred phi1 = new PDLNot(new PDLIntLeq(new PDLIndicesOf("aa"), 0)); PDLPred phi2 = (new PDLBelongs(new PDLPredecessor(new PDLLast()), new PDLIndicesOf("ab"))); //System.Console.WriteLine("prevLast " + (new PDLprev(new PDLlast())).Eval("aaabbccab", new Dictionary<string, int>())); //System.Console.WriteLine("indab " + (new PDLindicesOf("ab")).Eval("aaabbccab", new Dictionary<string, int>())); //System.Console.WriteLine("phi2 " + phi2.Eval("aaabbccab", new Dictionary<string, int>())); phi = new PDLAnd(phi1, new PDLNot(phi2)); System.Console.WriteLine("Contains aa and not end ab:"); System.Console.WriteLine(phi.Eval("aaabbccabc", new Dictionary<string, int>())); phi = new PDLAnd(new PDLIf(new PDLAtPos('a', new PDLFirst()), new PDLAtPos('a', new PDLLast())), new PDLIf(new PDLAtPos('b', new PDLFirst()), new PDLAtPos('b', new PDLLast()))); System.Console.WriteLine("Same First Last:"); System.Console.WriteLine(phi.Eval("abbba", new Dictionary<string, int>())); phi = new PDLExistsFO("x0", new PDLAtPos('a', new PDLPosVar("x0"))); System.Console.WriteLine("exists a:"); System.Console.WriteLine(phi.Eval("ab", new Dictionary<string, int>())); phi = new PDLEndsWith("abc"); System.Console.WriteLine("ends with abc:"); System.Console.WriteLine(phi.Eval("bc", new Dictionary<string, int>())); phi = new PDLStartsWith("abc"); System.Console.WriteLine("starts with abc:"); System.Console.WriteLine(phi.Eval("abcababcccabc", new Dictionary<string, int>())); }
public void once_aaa() { var solver = new CharSetSolver(BitWidth.BV64); List<char> alph = new List<char> { 'a', 'b' }; HashSet<char> al = new HashSet<char>(alph); PDLPred phi = new PDLIntEq(new PDLIndicesOf("aaa"), 1); StringBuilder sb = new StringBuilder(); phi.ToMSO(new FreshGen()).ToString(sb); System.Console.WriteLine(sb); var dfa = phi.GetDFA(al, solver); var test = solver.Convert(@"^b*(ab+|aab+)*aaa(b+a|b+aa)*b*$"); //string file = "../../../TestPDL/DotFiles/once_aaa"; //solver.SaveAsDot(dfa, "aut", file); Assert.IsTrue(dfa.IsEquivalentWith(test, solver)); }
public void Test18() // aaa appears exactly once { PDLPred phi = new PDLIntEq(new PDLIndicesOf("aaa"), 1); PrintDFA(phi, "Test18", new List<char> { 'a', 'b' }); }
public void Test12() // ab appears twice { PDLPred phi = new PDLIntEq(new PDLIndicesOf("ab"), 2); PrintDFA(phi, "Test12", new List<char> { 'a', 'b' }); }
public static Testcase createTestFormula21() { PDLPred language = new PDLIntEq(new PDLIndicesOf("101"), 0); return(new Testcase(21, createAlphabet10(), language)); }
public static Testcase createTestcase20() { PDLPred language = new PDLIntEq(new PDLIndicesOf("101"), 0); return(new Testcase(20, oneZeroAlphabet, language)); }
public void Test2() // length 2 { PDLPred phi = new PDLIntEq(new PDLAllPos(), 2); PrintDFA(phi, "Test2", new List<Char> { 'a', 'b', 'c' }); }