private Variable ConvertSet(MonaExpr set, MapStack <string, MonaParam> locals, out MSOFormula <BDD> psi) { if (set.NrOfSubexprs == 0) { return(ConvertEmptyset(out psi)); } MSOFormula <BDD> disj = null; Variable x = MkNewVar1(); Variable X = MkNewVar2(); for (int i = 0; i < set.NrOfSubexprs; i++) { MonaExpr t = set[i]; if (t.symbol.Kind == Tokens.RANGE) { MSOFormula <BDD> from_psi; Variable from = ConvertTerm1(t[0], locals, out from_psi); MSOFormula <BDD> to_psi; Variable to = ConvertTerm1(t[1], locals, out to_psi); MSOFormula <BDD> range = AddConstraints(from_psi, from, to_psi, to, new MSOAnd <BDD>(new MSOLe <BDD>(from, x), new MSOLe <BDD>(x, to))); if (disj == null) { disj = range; } else { disj = new MSOOr <BDD>(disj, range); } } else { MSOFormula <BDD> y_psi; Variable y = ConvertTerm1(t, locals, out y_psi); MSOFormula <BDD> elem = new MSOEq <BDD>(x, y); if (y_psi != null) { elem = new MSOExists <BDD>(y, new MSOAnd <BDD>(y_psi, elem)); } if (disj == null) { disj = elem; } else { disj = new MSOOr <BDD>(disj, elem); } } } var pred = new MSOForall <BDD>(x, new MSOEquiv <BDD>(new MSOIn <BDD>(x, X), disj)); psi = pred; return(X); }
static Automaton <T> CreateAutomaton1 <T>(Func <int, T> f, int bitWidth, IBooleanAlgebra <T> Z) { Func <int, string, MSOPredicate <T> > pred = (i, s) => new MSOPredicate <T>(f(i), new Variable(s, true)); MSOFormula <T> phi = new MSOFalse <T>(); for (int index = 0; index < bitWidth; index++) { var phi1 = pred(index, "var"); phi = new MSOOr <T>(phi, phi1); } phi = new MSOExists <T>(new Variable("var", true), phi); var aut = phi.GetAutomaton(Z); return(aut); }
public void TestCountNoProduct2() { int maxvars = 13; var solver = new CharSetSolver(BitWidth.BV7); Stopwatch sw = new Stopwatch(); var tries = 1; var times = new long[maxvars - 1]; var x = new Variable("x", true); var y = new Variable("y", true); for (int k = 0; k < tries; k++) { for (int vars = 8; vars <= maxvars; vars++) { MSOFormula <BDD> phi = new MSOTrue <BDD>(); for (int i = 1; i < vars; i++) { phi = new MSOAnd <BDD>(phi, new MSOLt <BDD>(new Variable("x" + i, true), new Variable("x" + (i + 1), true))); phi = new MSOAnd <BDD>(phi, new MSOPredicate <BDD>(solver.MkCharConstraint('a'), new Variable("x" + i, true))); phi = new MSOOr <BDD>(phi, new MSOPredicate <BDD>(solver.MkCharConstraint('k'), new Variable("x" + i, true))); } phi = new MSOAnd <BDD>(phi, new MSOPredicate <BDD>(solver.MkCharConstraint('a'), new Variable("x" + vars, true))); phi = new MSOOr <BDD>(phi, new MSOExists <BDD>(y, new MSOPredicate <BDD>(solver.MkCharConstraint('c'), y))); for (int i = vars; i >= 1; i--) { phi = new MSOExists <BDD>(new Variable("x" + i, true), phi); } sw.Restart(); //var aut1 = phi.GetAutomaton(new CartesianAlgebraBDD<BDD>(solver)); var aut1 = phi.GetAutomaton(solver); sw.Stop(); times[vars - 2] += sw.ElapsedMilliseconds; //Console.WriteLine("States {0} Trans {1}",aut1.StateCount,aut1.MoveCount); if (k == tries - 1) { TestContext.WriteLine(string.Format("{0} variables; {1} ms", vars, times[vars - 2] / tries)); } //solver.ShowGraph(aut1, "a"+vars); } } }
Automaton <T> CreateAutomaton2 <T>(Func <int, T> f, int bitWidth, IBooleanAlgebra <T> Z) { Func <int, Variable, MSOPredicate <T> > pred = (i, s) => new MSOPredicate <T>(f(i), s); MSOFormula <T> phi = new MSOFalse <T>(); for (int index = 0; index < bitWidth; index++) { MSOFormula <T> phi1 = pred(index, V1("var")); phi1 = new MSOExists <T>(V1("var"), phi1); phi = new MSOOr <T>(phi, phi1); } phi = new MSOExists <T>(V1("var"), phi); var aut = phi.GetAutomaton(Z); return(aut); }
Automaton <T> CreateAutomaton1 <T>(Func <int, T> f, int bitWidth, IBooleanAlgebra <T> Z) { Func <int, string, MSOPredicate <T> > pred = (i, s) => new MSOPredicate <T>(f(i), s); MSOFormula <T> phi = new MSOFalse <T>(); for (int index = 0; index < bitWidth; index++) { var phi1 = pred(index, "var"); phi = new MSOOr <T>(phi, phi1); } phi = new MSOExistsFo <T>("var", phi); var aut = phi.GetAutomaton(Z); //aut.ShowGraph("aut"); return(aut); }
public void TestCount() { int maxvars = 10; var solver = new CharSetSolver(BitWidth.BV16); Stopwatch sw = new Stopwatch(); var tries = 1; var times = new long[maxvars - 1]; for (int k = 0; k < tries; k++) { for (int vars = 8; vars <= maxvars; vars++) { MSOFormula <BDD> phi = new MSOTrue <BDD>(); for (int i = 1; i < vars; i++) { phi = new MSOAnd <BDD>(phi, new MSOLt <BDD>(V1("x" + i), V1("x" + (i + 1)))); phi = new MSOAnd <BDD>(phi, new MSOPredicate <BDD>(solver.MkCharConstraint('a'), V1("x" + i))); } phi = new MSOAnd <BDD>(phi, new MSOPredicate <BDD>(solver.MkCharConstraint('a'), V1("x" + vars))); phi = new MSOOr <BDD>(phi, new MSOExists <BDD>(V1("y"), new MSOPredicate <BDD>(solver.MkCharConstraint('c'), V1("y")))); for (int i = vars; i >= 1; i--) { phi = new MSOExists <BDD>(V1("x" + i), phi); } sw.Restart(); //var aut1 = phi.GetAutomaton(new CartesianAlgebraBDD<BDD>(solver)); var aut1 = phi.GetAutomaton(solver); //aut1.ShowGraph(); sw.Stop(); times[vars - 2] += sw.ElapsedMilliseconds; if (k == tries - 1) { TestContext.WriteLine(string.Format("{0} variables; {1} ms", vars, times[vars - 2] / tries)); } } } }
public void TestMSO_NotLt() { var solver = new CharSetSolver(BitWidth.BV7); var ca = new CartesianAlgebraBDD<BDD>(solver); var x = new Variable("x", true); var y = new Variable("y", true); MSOFormula<BDD> not_xLTy = new MSONot<BDD>(new MSOLt<BDD>(x,y)); MSOFormula<BDD> xEQy = new MSOEq<BDD>(x, y); var xGTy = new MSOLt<BDD>(y, x); var xGEy = new MSOOr<BDD>(xEQy, xGTy); var aut_not_xLTy = not_xLTy.GetAutomaton(ca); var aut_xGEy = xGEy.GetAutomaton(ca); var c_aut_xLTy = (new MSOLt<BDD>(x,y)).GetAutomaton(ca).Complement().Determinize().Minimize(); //c_aut_xLTy = c_aut_xLTy.Intersect(aut_fo, ca).Determinize(ca).Minimize(ca); //* //aut_not_xLTy.ShowGraph("aut_not_xLTy"); //aut_xGEy.ShowGraph("aut_xGEy"); //c_aut_xLTy.ShowGraph("c_aut_xLTy"); var equiv1 = aut_not_xLTy.IsEquivalentWith(aut_xGEy); //var equiv2 = aut_not_xLTy.IsEquivalentWith(c_aut_xLTy, ca); Assert.IsTrue(equiv1); //Assert.IsTrue(equiv2); }
private static Pair<MSOFormula<BoolExpr>, List<BoolExpr>> GenerateMSOFormula(int maxVarIndex) { int randomNumber = random.Next(0, 8); size--; if (size <= 0) { int variable = random.Next(0, maxVarIndex-1); BoolExpr b = GeneratePredicateOut(200); List<BoolExpr> l = new List<BoolExpr>(); l.Add(b); return new Pair<MSOFormula<BoolExpr>, List<BoolExpr>>(new MSOPredicate<BoolExpr>(b, new Variable("x"+variable, true)), l); } switch (randomNumber) { case 0: { Pair<MSOFormula<BoolExpr>, List<BoolExpr>> phi1 = GenerateMSOFormula(maxVarIndex + 1); MSOFormula<BoolExpr> phi = new MSOExists<BoolExpr>(new Variable("x"+maxVarIndex, true), phi1.First); return new Pair<MSOFormula<BoolExpr>, List<BoolExpr>>(phi, phi1.Second); } case 1: { Pair<MSOFormula<BoolExpr>, List<BoolExpr>> phi1 = GenerateMSOFormula(maxVarIndex + 1); MSOFormula<BoolExpr> phi = new MSOForall<BoolExpr>(new Variable("x" + maxVarIndex, true), phi1.First); return new Pair<MSOFormula<BoolExpr>, List<BoolExpr>>(phi, phi1.Second); } case 2: case 3: { Pair<MSOFormula<BoolExpr>, List<BoolExpr>> phi1 = GenerateMSOFormula(maxVarIndex); Pair<MSOFormula<BoolExpr>, List<BoolExpr>> phi2 = GenerateMSOFormula(maxVarIndex); MSOFormula<BoolExpr> phi = new MSOAnd<BoolExpr>(phi1.First, phi2.First); return new Pair<MSOFormula<BoolExpr>, List<BoolExpr>>(phi, new List<BoolExpr>(phi1.Second.Union(phi2.Second))); } case 4: case 5: { Pair<MSOFormula<BoolExpr>, List<BoolExpr>> phi1 = GenerateMSOFormula(maxVarIndex); Pair<MSOFormula<BoolExpr>, List<BoolExpr>> phi2 = GenerateMSOFormula(maxVarIndex); MSOFormula<BoolExpr> phi = new MSOOr<BoolExpr>(phi1.First, phi2.First); return new Pair<MSOFormula<BoolExpr>, List<BoolExpr>>(phi, new List<BoolExpr>(phi1.Second.Union(phi2.Second))); } case 6: { Pair<MSOFormula<BoolExpr>, List<BoolExpr>> phi1 = GenerateMSOFormula(maxVarIndex); MSOFormula<BoolExpr> phi = new MSONot<BoolExpr>(phi1.First); return new Pair<MSOFormula<BoolExpr>, List<BoolExpr>>(phi, phi1.Second); } case 7: { if (maxVarIndex > 1) { int variable1 = random.Next(0, maxVarIndex - 1); int variable2 = random.Next(0, maxVarIndex - 1); if (variable1 == variable2) { if (variable1 == maxVarIndex - 1) variable1 = variable1 - 1; else variable2 = variable2 + 1; } //Successor MSOFormula<BoolExpr> phi = new MSOSuccN<BoolExpr>(varOf(variable1),varOf(variable2),random.Next(1,4)); return new Pair<MSOFormula<BoolExpr>, List<BoolExpr>>(phi, new List<BoolExpr>()); } else { int variable = random.Next(0, maxVarIndex - 1); BoolExpr b = GeneratePredicate(); List<BoolExpr> l = new List<BoolExpr>(); l.Add(b); return new Pair<MSOFormula<BoolExpr>, List<BoolExpr>>(new MSOPredicate<BoolExpr>(b, new Variable("x" + variable, true)), l); } } case 8: { int variable1 = random.Next(0, maxVarIndex - 1); int variable2 = random.Next(0, maxVarIndex - 1); //less than MSOFormula<BoolExpr> phi = new MSOLe<BoolExpr>(varOf(variable1), varOf(variable2)); return new Pair<MSOFormula<BoolExpr>, List<BoolExpr>>(phi, new List<BoolExpr>()); } } return null; }
public static void RunPOPLTests() { //// all x1...xn. xi<xi+1 List <Pair <MSOFormula <BDD>, CharSetSolver> > phis = new List <Pair <MSOFormula <BDD>, CharSetSolver> >(); for (int to = 2; to < kpopl; to++) { var solver = new CharSetSolver(); MSOFormula <BDD> phi = new MSOTrue <BDD>(); for (int k = 1; k < to; k++) { var leq = new MSOLt <BDD>(new Variable("x" + (k - 1), true), new Variable("x" + k, true)); phi = new MSOAnd <BDD>(phi, leq); } for (int k = to - 1; k >= 0; k--) { phi = new MSOExists <BDD>(new Variable("x" + k, true), phi); } phis.Add(new Pair <MSOFormula <BDD>, CharSetSolver>(phi, solver)); } RunTest(new StreamWriter(@"..\popl14-1.csv"), phis); // all x1...xn. xi<xi+1 and a(xi) phis = new List <Pair <MSOFormula <BDD>, CharSetSolver> >(); for (int to = 2; to < kpopl; to++) { var solver = new CharSetSolver(BitWidth.BV64); MSOFormula <BDD> phi = new MSOTrue <BDD>(); for (int k = 1; k < to; k++) { var leq = new MSOLt <BDD>(new Variable("x" + (k - 1), true), new Variable("x" + k, true)); phi = new MSOAnd <BDD>(phi, leq); } for (int k = 0; k < to; k++) { var axk = new MSOPredicate <BDD>( solver.MkCharConstraint('a', false), new Variable("x" + k, true)); phi = new MSOAnd <BDD>(phi, axk); } for (int k = to - 1; k >= 0; k--) { phi = new MSOExists <BDD>(new Variable("x" + k, true), phi); } phis.Add(new Pair <MSOFormula <BDD>, CharSetSolver>(phi, solver)); } RunTest(new StreamWriter(@"..\popl14-2.csv"), phis); // all x1...xn. (xi<xi+1 and a(xi)) and ex y. c(y) phis = new List <Pair <MSOFormula <BDD>, CharSetSolver> >(); for (int to = 2; to < kpopl; to++) { var solver = new CharSetSolver(BitWidth.BV64); MSOFormula <BDD> phi = new MSOTrue <BDD>(); for (int k = 1; k < to; k++) { var leq = new MSOLt <BDD>(new Variable("x" + (k - 1), true), new Variable("x" + k, true)); phi = new MSOAnd <BDD>(phi, leq); } for (int k = 0; k < to; k++) { var axk = new MSOPredicate <BDD>(solver.MkCharConstraint('a', false), new Variable("x" + k, true)); phi = new MSOAnd <BDD>(phi, axk); } for (int k = to - 1; k >= 0; k--) { phi = new MSOExists <BDD>(new Variable("x" + k, true), phi); } var exycy = new MSOExists <BDD>(new Variable("y", true), new MSOPredicate <BDD>(solver.MkCharConstraint('c', false), new Variable("y", true))); phi = new MSOAnd <BDD>(phi, exycy); phis.Add(new Pair <MSOFormula <BDD>, CharSetSolver>(phi, solver)); } RunTest(new StreamWriter(@"..\popl14-3.csv"), phis); // all x1...xn. (xi<xi+1 and a(xi) \/ c(xi)) phis = new List <Pair <MSOFormula <BDD>, CharSetSolver> >(); for (int to = 2; to < kpopl; to++) { var solver = new CharSetSolver(BitWidth.BV64); MSOFormula <BDD> phi = new MSOTrue <BDD>(); for (int k = 1; k < to; k++) { var leq = new MSOLt <BDD>(new Variable("x" + (k - 1), true), new Variable("x" + k, true)); var axk = new MSOPredicate <BDD>(solver.MkCharConstraint('a', false), new Variable("x" + (k - 1), true)); var cxk = new MSOPredicate <BDD>(solver.MkCharConstraint('c', false), new Variable("x" + (k - 1), true)); var inter = new MSOOr <BDD>(new MSOAnd <BDD>(leq, axk), cxk); phi = new MSOAnd <BDD>(phi, inter); } for (int k = to - 1; k >= 0; k--) { phi = new MSOExists <BDD>(new Variable("x" + k, true), phi); } MSOFormula <BDD> exycy = new MSOExists <BDD>(new Variable("y", true), new MSOPredicate <BDD>(solver.MkCharConstraint('c', false), new Variable("y", true))); phi = new MSOAnd <BDD>(phi, exycy); phis.Add(new Pair <MSOFormula <BDD>, CharSetSolver>(phi, solver)); } RunTest(new StreamWriter(@"..\popl14-4.csv"), phis, 10, 10, 11); }
private static Pair <MSOFormula <BoolExpr>, List <BoolExpr> > GenerateMSOFormula(int maxVarIndex) { int randomNumber = random.Next(0, 8); size--; if (size <= 0) { int variable = random.Next(0, maxVarIndex - 1); BoolExpr b = GeneratePredicateOut(200); List <BoolExpr> l = new List <BoolExpr>(); l.Add(b); return(new Pair <MSOFormula <BoolExpr>, List <BoolExpr> >(new MSOPredicate <BoolExpr>(b, new Variable("x" + variable, true)), l)); } switch (randomNumber) { case 0: { Pair <MSOFormula <BoolExpr>, List <BoolExpr> > phi1 = GenerateMSOFormula(maxVarIndex + 1); MSOFormula <BoolExpr> phi = new MSOExists <BoolExpr>(new Variable("x" + maxVarIndex, true), phi1.First); return(new Pair <MSOFormula <BoolExpr>, List <BoolExpr> >(phi, phi1.Second)); } case 1: { Pair <MSOFormula <BoolExpr>, List <BoolExpr> > phi1 = GenerateMSOFormula(maxVarIndex + 1); MSOFormula <BoolExpr> phi = new MSOForall <BoolExpr>(new Variable("x" + maxVarIndex, true), phi1.First); return(new Pair <MSOFormula <BoolExpr>, List <BoolExpr> >(phi, phi1.Second)); } case 2: case 3: { Pair <MSOFormula <BoolExpr>, List <BoolExpr> > phi1 = GenerateMSOFormula(maxVarIndex); Pair <MSOFormula <BoolExpr>, List <BoolExpr> > phi2 = GenerateMSOFormula(maxVarIndex); MSOFormula <BoolExpr> phi = new MSOAnd <BoolExpr>(phi1.First, phi2.First); return(new Pair <MSOFormula <BoolExpr>, List <BoolExpr> >(phi, new List <BoolExpr>(phi1.Second.Union(phi2.Second)))); } case 4: case 5: { Pair <MSOFormula <BoolExpr>, List <BoolExpr> > phi1 = GenerateMSOFormula(maxVarIndex); Pair <MSOFormula <BoolExpr>, List <BoolExpr> > phi2 = GenerateMSOFormula(maxVarIndex); MSOFormula <BoolExpr> phi = new MSOOr <BoolExpr>(phi1.First, phi2.First); return(new Pair <MSOFormula <BoolExpr>, List <BoolExpr> >(phi, new List <BoolExpr>(phi1.Second.Union(phi2.Second)))); } case 6: { Pair <MSOFormula <BoolExpr>, List <BoolExpr> > phi1 = GenerateMSOFormula(maxVarIndex); MSOFormula <BoolExpr> phi = new MSONot <BoolExpr>(phi1.First); return(new Pair <MSOFormula <BoolExpr>, List <BoolExpr> >(phi, phi1.Second)); } case 7: { if (maxVarIndex > 1) { int variable1 = random.Next(0, maxVarIndex - 1); int variable2 = random.Next(0, maxVarIndex - 1); if (variable1 == variable2) { if (variable1 == maxVarIndex - 1) { variable1 = variable1 - 1; } else { variable2 = variable2 + 1; } } //Successor MSOFormula <BoolExpr> phi = new MSOSuccN <BoolExpr>(varOf(variable1), varOf(variable2), random.Next(1, 4)); return(new Pair <MSOFormula <BoolExpr>, List <BoolExpr> >(phi, new List <BoolExpr>())); } else { int variable = random.Next(0, maxVarIndex - 1); BoolExpr b = GeneratePredicate(); List <BoolExpr> l = new List <BoolExpr>(); l.Add(b); return(new Pair <MSOFormula <BoolExpr>, List <BoolExpr> >(new MSOPredicate <BoolExpr>(b, new Variable("x" + variable, true)), l)); } } case 8: { int variable1 = random.Next(0, maxVarIndex - 1); int variable2 = random.Next(0, maxVarIndex - 1); //less than MSOFormula <BoolExpr> phi = new MSOLe <BoolExpr>(varOf(variable1), varOf(variable2)); return(new Pair <MSOFormula <BoolExpr>, List <BoolExpr> >(phi, new List <BoolExpr>())); } } return(null); }
private Variable ConvertSet(MonaExpr set, MapStack<string, MonaParam> locals, out MSOFormula<BDD> psi) { if (set.NrOfSubexprs == 0) return ConvertEmptyset(out psi); MSOFormula<BDD> disj = null; Variable x = MkNewVar1(); Variable X = MkNewVar2(); for (int i=0; i < set.NrOfSubexprs; i++) { MonaExpr t = set[i]; if (t.symbol.Kind == Tokens.RANGE) { MSOFormula<BDD> from_psi; Variable from = ConvertTerm1(t[0], locals, out from_psi); MSOFormula<BDD> to_psi; Variable to = ConvertTerm1(t[1], locals, out to_psi); MSOFormula<BDD> range = AddConstraints(from_psi, from, to_psi, to, new MSOAnd<BDD>(new MSOLe<BDD>(from, x), new MSOLe<BDD>(x, to))); if (disj == null) disj = range; else disj = new MSOOr<BDD>(disj, range); } else { MSOFormula<BDD> y_psi; Variable y = ConvertTerm1(t, locals, out y_psi); MSOFormula<BDD> elem = new MSOEq<BDD>(x, y); if (y_psi != null) elem = new MSOExists<BDD>(y, new MSOAnd<BDD>(y_psi, elem)); if (disj == null) disj = elem; else disj = new MSOOr<BDD>(disj, elem); } } var pred = new MSOForall<BDD>(x, new MSOEquiv<BDD>(new MSOIn<BDD>(x, X), disj)); psi = pred; return X; }
public static void RunPOPLTests() { //// all x1...xn. xi<xi+1 List<Pair<MSOFormula<BDD>, CharSetSolver>> phis = new List<Pair<MSOFormula<BDD>, CharSetSolver>>(); for (int to = 2; to < kpopl; to++) { var solver = new CharSetSolver(); MSOFormula<BDD> phi = new MSOTrue<BDD>(); for (int k = 1; k < to; k++) { var leq = new MSOLt<BDD>(new Variable("x" + (k - 1), true), new Variable("x" + k, true)); phi = new MSOAnd<BDD>(phi, leq); } for (int k = to - 1; k >= 0; k--) { phi = new MSOExists<BDD>(new Variable("x" + k, true), phi); } phis.Add(new Pair<MSOFormula<BDD>, CharSetSolver>(phi, solver)); } RunTest(new StreamWriter(@"popl14-1.csv"), phis); // all x1...xn. xi<xi+1 and a(xi) phis = new List<Pair<MSOFormula<BDD>, CharSetSolver>>(); for (int to = 2; to < kpopl; to++) { var solver = new CharSetSolver(BitWidth.BV64); MSOFormula<BDD> phi = new MSOTrue<BDD>(); for (int k = 1; k < to; k++) { var leq = new MSOLt<BDD>(new Variable("x" + (k - 1), true), new Variable("x" + k, true)); phi = new MSOAnd<BDD>(phi, leq); } for (int k = 0; k < to; k++) { var axk = new MSOPredicate<BDD>( solver.MkCharConstraint('a', false), new Variable("x" + k, true)); phi = new MSOAnd<BDD>(phi, axk); } for (int k = to - 1; k >= 0; k--) { phi = new MSOExists<BDD>(new Variable("x" + k, true), phi); } phis.Add(new Pair<MSOFormula<BDD>, CharSetSolver>(phi, solver)); } RunTest(new StreamWriter(@"popl14-2.csv"), phis); // all x1...xn. (xi<xi+1 and a(xi)) and ex y. c(y) phis = new List<Pair<MSOFormula<BDD>, CharSetSolver>>(); for (int to = 2; to < kpopl; to++) { var solver = new CharSetSolver(BitWidth.BV64); MSOFormula<BDD> phi = new MSOTrue<BDD>(); for (int k = 1; k < to; k++) { var leq = new MSOLt<BDD>(new Variable("x" + (k - 1), true), new Variable("x" + k, true)); phi = new MSOAnd<BDD>(phi, leq); } for (int k = 0; k < to; k++) { var axk = new MSOPredicate<BDD>(solver.MkCharConstraint('a', false), new Variable("x" + k, true)); phi = new MSOAnd<BDD>(phi, axk); } for (int k = to - 1; k >= 0; k--) { phi = new MSOExists<BDD>(new Variable("x" + k, true), phi); } var exycy = new MSOExists<BDD>(new Variable("y", true), new MSOPredicate<BDD>(solver.MkCharConstraint('c', false), new Variable("y", true))); phi = new MSOAnd<BDD>(phi, exycy); phis.Add(new Pair<MSOFormula<BDD>, CharSetSolver>(phi, solver)); } RunTest(new StreamWriter(@"popl14-3.csv"), phis); // all x1...xn. (xi<xi+1 and a(xi) \/ c(xi)) phis = new List<Pair<MSOFormula<BDD>, CharSetSolver>>(); for (int to = 2; to < kpopl; to++) { var solver = new CharSetSolver(BitWidth.BV64); MSOFormula<BDD> phi = new MSOTrue<BDD>(); for (int k = 1; k < to; k++) { var leq = new MSOLt<BDD>(new Variable("x" + (k - 1), true), new Variable("x" + k, true)); var axk = new MSOPredicate<BDD>(solver.MkCharConstraint('a', false), new Variable("x" + (k - 1), true)); var cxk = new MSOPredicate<BDD>(solver.MkCharConstraint('c', false), new Variable("x" + (k - 1), true)); var inter = new MSOOr<BDD>(new MSOAnd<BDD>(leq, axk), cxk); phi = new MSOAnd<BDD>(phi, inter); } for (int k = to - 1; k >= 0; k--) { phi = new MSOExists<BDD>(new Variable("x" + k, true), phi); } MSOFormula<BDD> exycy = new MSOExists<BDD>(new Variable("y", true), new MSOPredicate<BDD>(solver.MkCharConstraint('c', false), new Variable("y", true))); phi = new MSOAnd<BDD>(phi, exycy); phis.Add(new Pair<MSOFormula<BDD>, CharSetSolver>(phi, solver)); } RunTest(new StreamWriter(@"popl14-4.csv"), phis, 11, 11, 11); }