public void SFAcreationTest()
        {
            Z3Provider solver = new Z3Provider(BitWidth.BV7);
            //create basic symbolic automata using Z3 terms
            var a = solver.RegexConverter.Convert(@"^\w{5}$");
            var b = solver.RegexConverter.Convert(@"\d");
            //wraps the automaton in an SFA object that provides symbolic language acceptor axioms
            var A = new SFA <FuncDecl, Expr, Sort>(solver, solver.CharacterSort, a);
            var B = new SFA <FuncDecl, Expr, Sort>(solver, solver.CharacterSort, b);
            var C = A - B;    //difference automaton that accepts L(A)-L(B)

            C.AssertTheory(); //assert the theory of C to the solver

            //declate a new uninterpreted constant of sort List<character>
            Expr inputConst = solver.MkFreshConst("input", C.InputListSort);
            //get a solutions for the constant so that the accept axiom holds
            var    model = solver.MainSolver.GetModel(C.MkAccept(inputConst), inputConst);
            string input = model[inputConst].StringValue;  //actual value that is in L(a)-L(b)

            Assert.IsTrue(Regex.IsMatch(input, @"^\w{5}$"));
            Assert.IsFalse(Regex.IsMatch(input, @"\d"));
        }
        private static int MintermBlowupTestHelperMoore(int K)
        {
            var z3p  = new Z3Provider(BitWidth.BV32);
            var x    = z3p.CharVar;
            var zero = z3p.MkNumeral(0, z3p.CharSort);
            Func <int, Expr> gamma = k =>
            {
                int  kth  = 1 << k;
                Expr mask = z3p.MkNumeral(kth, z3p.CharSort);
                Expr cond = z3p.MkNot(z3p.MkEq(z3p.MkBvAnd(x, mask), zero));
                return(cond);
            };
            var moves = new List <Move <Expr> >();

            for (int i = 0; i < K; i++)
            {
                moves.Add(Move <Expr> .Create(i, i + 1, gamma(i)));
            }
            for (int i = 0; i < K; i++)
            {
                moves.Add(Move <Expr> .Create(i == 0 ? 0 : K + i, K + i + 1, i == 0 ? z3p.MkNot(gamma(i)) : gamma(i)));
            }
            var aut = Automaton <Expr> .Create(z3p, 0, new int[] { K, 2 * K }, moves);

            var sfa = new SFA <FuncDecl, Expr, Sort>(z3p, z3p.CharSort, aut);

            sfa.Automaton.CheckDeterminism(true);



            int t      = System.Environment.TickCount;
            var autmin = sfa.Automaton.MinimizeMoore();

            t = System.Environment.TickCount - t;


            return(t);
        }
        private static int MintermBlowupTestHelperMoore(int K)
        {
            var z3p = new Z3Provider(BitWidth.BV32);
            var x = z3p.CharVar;
            var zero = z3p.MkNumeral(0, z3p.CharSort);
            Func<int, Expr> gamma = k =>
            {
                int kth = 1 << k;
                Expr mask = z3p.MkNumeral(kth, z3p.CharSort);
                Expr cond = z3p.MkNot(z3p.MkEq(z3p.MkBvAnd(x, mask), zero));
                return cond;
            };
            var moves = new List<Move<Expr>>();
            for (int i = 0; i < K; i++)
                moves.Add(Move<Expr>.Create(i, i + 1, gamma(i)));
            for (int i = 0; i < K; i++)
                moves.Add(Move<Expr>.Create(i == 0 ? 0 : K + i, K + i + 1, i ==0 ? z3p.MkNot(gamma(i)) : gamma(i)));
            var aut = Automaton<Expr>.Create(z3p, 0, new int[] { K, 2 * K }, moves);

            var sfa = new SFA<FuncDecl, Expr, Sort>(z3p, z3p.CharSort, aut);
            sfa.Automaton.CheckDeterminism(true);

            int t = System.Environment.TickCount;
            var autmin = sfa.Automaton.MinimizeMoore();
            t = System.Environment.TickCount - t;

            return t;
        }
        public void SFAcreationTest()
        {
            Z3Provider solver = new Z3Provider(BitWidth.BV7);
            //create basic symbolic automata using Z3 terms
            var a = solver.RegexConverter.Convert(@"^\w{5}$");
            var b = solver.RegexConverter.Convert(@"\d");
            //wraps the automaton in an SFA object that provides symbolic language acceptor axioms
            var A = new SFA<FuncDecl, Expr, Sort>(solver, solver.CharacterSort, a);
            var B = new SFA<FuncDecl, Expr, Sort>(solver, solver.CharacterSort, b);
            var C = A - B; //difference automaton that accepts L(A)-L(B)

            C.AssertTheory(); //assert the theory of C to the solver

            //declate a new uninterpreted constant of sort List<character>
            Expr inputConst = solver.MkFreshConst("input", C.InputListSort);
            //get a solutions for the constant so that the accept axiom holds
            var model = solver.MainSolver.GetModel(C.MkAccept(inputConst), inputConst);
            string input = model[inputConst].StringValue;  //actual value that is in L(a)-L(b)
            Assert.IsTrue(Regex.IsMatch(input, @"^\w{5}$"));
            Assert.IsFalse(Regex.IsMatch(input, @"\d"));
        }