Exemple #1
0
        /// <summary>
        /// x_j = x_i + n, with min(nonempty-set)-semantics
        /// </summary>
        public static Automaton <BDD> MkSuccN2(int i, int j, int n, IBDDAlgebra alg)
        {
            var ieq0      = alg.MkBitFalse(i);
            var ieq1      = alg.MkBitTrue(i);
            var jeq0      = alg.MkBitFalse(j);
            var jeq1      = alg.MkBitTrue(j);
            var both0     = alg.MkAnd(ieq0, jeq0);
            var ieq1_jeq0 = alg.MkAnd(ieq1, jeq0);

            //Create moves
            var moves = new List <Move <BDD> >();

            moves.Add(new Move <BDD>(0, 0, both0));
            moves.Add(new Move <BDD>(0, 1, ieq1_jeq0));

            for (int k = 1; k < n; k++)
            {
                moves.Add(new Move <BDD>(k, k + 1, jeq0));
            }

            moves.Add(new Move <BDD>(n, n + 1, jeq1));
            moves.Add(new Move <BDD>(n + 1, n + 1, alg.True));

            var aut = Automaton <BDD> .Create(alg, 0, new int[] { n + 1 }, moves, false, false, true);

            return(aut);
        }
Exemple #2
0
        public static Automaton <BDD> MkSuccN(int i1, int i2, int n, IBDDAlgebra bddAlg)
        {
            var alg        = bddAlg;
            var ind10      = bddAlg.MkBitFalse(i1);
            var ind11      = bddAlg.MkBitTrue(i1);
            var ind20      = bddAlg.MkBitFalse(i2);
            var ind21      = bddAlg.MkBitTrue(i2);
            var both0      = bddAlg.MkAnd(ind10, ind20);
            var ind11ind20 = bddAlg.MkAnd(ind11, ind20);
            var ind10ind21 = bddAlg.MkAnd(ind10, ind21);

            //Create moves
            var moves = new List <Move <BDD> >();

            moves.Add(new Move <BDD>(0, 0, both0));
            moves.Add(new Move <BDD>(0, 1, ind11ind20));
            moves.Add(new Move <BDD>(n, n + 1, ind10ind21));
            moves.Add(new Move <BDD>(n + 1, n + 1, both0));

            for (int i = 1; i < n; i++)
            {
                moves.Add(new Move <BDD>(i, i + 1, both0));
            }

            var aut = Automaton <BDD> .Create(bddAlg, 0, new int[] { n + 1 }, moves, false, false, true);

            return(aut);
        }
Exemple #3
0
        /// <summary>
        /// X_i = X_j
        /// </summary>
        public static Automaton <BDD> MkEqualSets(int i, int j, IBDDAlgebra alg)
        {
            var bit_j_is1 = alg.MkBitTrue(j);
            var bit_i_is1 = alg.MkBitTrue(i);
            var bit_i_is0 = alg.MkBitFalse(i);
            var bit_j_is0 = alg.MkBitFalse(j);
            var cond      = alg.MkOr(alg.MkAnd(bit_i_is1, bit_j_is1), alg.MkAnd(bit_i_is0, bit_j_is0));
            var moves     = new Move <BDD>[] { new Move <BDD>(0, 0, cond) };
            var aut       = Automaton <BDD> .Create(alg, 0, new int[] { 0 }, moves, false, false, true);

            return(aut);
        }
Exemple #4
0
        /// <summary>
        /// x_i = x_j, with min(nonempty-set)-semantics for f-o vars
        /// </summary>
        public static Automaton <BDD> MkEqualPositions2(int i, int j, IBDDAlgebra alg)
        {
            var bit_j_is1 = alg.MkBitTrue(j);
            var bit_i_is1 = alg.MkBitTrue(i);
            var bit_i_is0 = alg.MkBitFalse(i);
            var bit_j_is0 = alg.MkBitFalse(j);
            var both0     = alg.MkAnd(bit_i_is0, bit_j_is0);
            var both1     = alg.MkAnd(bit_i_is1, bit_j_is1);
            var moves     = new Move <BDD>[] { new Move <BDD>(0, 0, both0),
                                               new Move <BDD>(0, 1, both1), new Move <BDD>(1, 1, alg.True) };
            var aut = Automaton <BDD> .Create(alg, 0, new int[] { 1 }, moves, false, false, true);

            return(aut);
        }
Exemple #5
0
        /// <summary>
        /// x_i &lt; x_j, with singleton-set semantics for f-o vars
        /// </summary>
        public static Automaton <BDD> MkLt1(int i, int j, IBDDAlgebra alg)
        {
            var bit_i_is0 = alg.MkBitFalse(i);
            var bit_i_is1 = alg.MkBitTrue(i);
            var bit_j_is0 = alg.MkBitFalse(j);
            var bit_j_is1 = alg.MkBitTrue(j);
            var both0     = alg.MkAnd(bit_i_is0, bit_j_is0);
            var cond1     = alg.MkAnd(bit_i_is1, bit_j_is0);
            var cond2     = alg.MkAnd(bit_j_is1, bit_i_is0);
            var moves     = new Move <BDD>[] { new Move <BDD>(0, 0, both0),
                                               new Move <BDD>(0, 1, cond1), new Move <BDD>(1, 1, both0),
                                               new Move <BDD>(1, 2, cond2), new Move <BDD>(2, 2, both0) };
            var aut = Automaton <BDD> .Create(alg, 0, new int[] { 2 }, moves, false, false, true);

            return(aut);
        }
Exemple #6
0
        /// <summary>
        /// x_i = min X_j with min(nonempty-set)-semantics for x_i
        /// </summary>
        internal static Automaton <BDD> MkMin2(int i, int j, IBDDAlgebra alg)
        {
            var ieq0  = alg.MkBitFalse(i);
            var ieq1  = alg.MkBitTrue(i);
            var jeq0  = alg.MkBitFalse(j);
            var jeq1  = alg.MkBitTrue(j);
            var both1 = alg.MkAnd(jeq1, ieq1);
            var both0 = alg.MkAnd(jeq0, ieq0);
            var moves = new Move <BDD>[] {
                new Move <BDD>(0, 0, both0),
                new Move <BDD>(0, 1, both1),
                new Move <BDD>(1, 1, alg.True)
            };
            var aut = Automaton <BDD> .Create(alg, 0, new int[] { 1 }, moves, false, false, true);

            return(aut);
        }
Exemple #7
0
        /// <summary>
        /// [psi](x_i) with min(nonempty-set)-semantics
        /// </summary>
        /// <returns></returns>
        public static Automaton <BDD> MkLabelOfPosition2(int i, BDD psi, IBDDAlgebra alg)
        {
            var bit_i_is0 = alg.MkBitFalse(i);
            var bit_i_is1 = alg.MkBitTrue(i);
            var cond      = alg.MkAnd(bit_i_is1, psi);
            var moves     = new Move <BDD>[] {
                new Move <BDD>(0, 0, bit_i_is0),
                new Move <BDD>(0, 1, cond),
                new Move <BDD>(1, 1, alg.True)
            };
            var aut = Automaton <BDD> .Create(alg, 0, new int[] { 1 }, moves, false, false, true);

            return(aut);
        }
Exemple #8
0
 public BDD And(BDD other)
 {
     return(algebra.MkAnd(this, other));
 }