public void BooleanAlgebraZ3_test1() { var ctx = new Context(); var sort = ctx.IntSort; var solver = new Z3BoolAlg(ctx, sort); var alg = new BDDAlgebra <BoolExpr>(solver); var x = new Variable("x", true); var pred = new MSOPredicate <BoolExpr>(ctx.MkEq(solver.x, ctx.MkNumeral(42, sort)), x); MSOFormula <BoolExpr> phi = new MSOExists <BoolExpr>(x, pred); var pred_aut = pred.GetAutomaton(alg); //pred_aut.ShowGraph("pred_aut"); }
public void TestMSO_Pred() { var solver = new CharSetSolver(BitWidth.BV16); var x = new Variable("x", true); var pred = new MSOPredicate<BDD>(solver.MkCharConstraint( 'c'), x); MSOFormula<BDD> phi = new MSOExists<BDD>(x, pred); var ca = new CartesianAlgebraBDD<BDD>(solver); var pred_aut = pred.GetAutomaton(ca); //pred_aut.ShowGraph("pred_aut"); var aut = phi.GetAutomaton(solver); for (int i = 0; i < 10; i++) { var s = solver.GenerateMember(aut); Assert.IsTrue(System.Text.RegularExpressions.Regex.IsMatch(s, "c"), "regex mismatch"); } var aut2 = solver.RegexConverter.Convert("c", System.Text.RegularExpressions.RegexOptions.Singleline); //aut2.ShowGraph("aut2"); //aut.ShowGraph("aut"); Assert.IsTrue(aut2.IsEquivalentWith(aut), "automata not equialent"); }