Пример #1
0
        internal override Automaton <IMonadicPredicate <BDD, T> > getAutomaton(SimpleList <WS1SVariable <T> > variables, ICartesianAlgebraBDD <T> ca)
        {
            var k = variables.IndexOf(var);

            if (k < 0)
            {
                throw new AutomataException(AutomataExceptionKind.InvalidWS1Sformula_UnknownVariable);
            }

            if (var.isFirstOrder)
            {
                return(BasicAutomata.MkLabelOfPosition(k, pred, ca));
            }
            else
            {
                return(BasicAutomata.MkLabelOfSet(k, pred, ca));
            }
        }
Пример #2
0
        internal override Automaton <IMonadicPredicate <BDD, T> > getAutomaton(SimpleList <WS1SVariable <T> > variables, ICartesianAlgebraBDD <T> ca)
        {
            var pos1 = variables.IndexOf(var1);
            var pos2 = variables.IndexOf(var2);

            if (pos1 < 0 || pos2 < 0)
            {
                throw new AutomataException(AutomataExceptionKind.InvalidWS1Sformula_UnknownVariable);
            }

            if (var1.isFirstOrder)
            {
                return(BasicAutomata.MkEqualPositions(pos1, pos2, ca));
            }
            else
            {
                return(BasicAutomata.MkEqualSets(pos1, pos2, ca));
            }
        }
Пример #3
0
 internal override Automaton <IMonadicPredicate <BDD, T> > getAutomaton(SimpleList <WS1SVariable <T> > variables, ICartesianAlgebraBDD <T> ca)
 {
     return(BasicAutomata.MkTrue(ca));
 }
Пример #4
0
        internal override Automaton <IMonadicPredicate <BDD, T> > getAutomaton(SimpleList <WS1SVariable <T> > variables, ICartesianAlgebraBDD <T> ca)
        {
            var pos = variables.IndexOf(var);

            if (pos < 0)
            {
                throw new AutomataException(AutomataExceptionKind.InvalidWS1Sformula_UnknownVariable);
            }

            return(BasicAutomata.MkSingleton(pos, ca));
        }
Пример #5
0
        internal override Automaton <IMonadicPredicate <BDD, T> > getAutomaton(SimpleList <WS1SVariable <T> > variables, ICartesianAlgebraBDD <T> alg)
        {
            var aut1 = phi1.getAutomaton(variables, alg);
            var aut2 = phi2.getAutomaton(variables, alg);
            //var res = aut1.Complement(alg).Intersect(aut2.Complement(alg), alg).Complement(alg);
            //res = res.Determinize(alg).Minimize(alg);
            var res  = aut1.Union(aut2).RemoveEpsilons(alg.MkOr);
            var res1 = res.Minimize(alg);

            return(res1);
        }
Пример #6
0
        internal override Automaton <IMonadicPredicate <BDD, T> > getAutomaton(SimpleList <WS1SVariable <T> > variables, ICartesianAlgebraBDD <T> alg)
        {
            var aut = phi.getAutomaton(variables, alg);
            var res = aut.Determinize(alg).Complement(alg).Minimize(alg);

            foreach (var x in phi.GetFreeVariables(true))
            {
                var sing = new WS1SSingleton <T>(x).getAutomaton(variables, alg);
                res = res.Intersect(sing, alg).Determinize(alg).Minimize(alg);
            }
            return(res);
        }
Пример #7
0
        internal override Automaton <IMonadicPredicate <BDD, T> > getAutomaton(SimpleList <WS1SVariable <T> > variables, ICartesianAlgebraBDD <T> ca)
        {
            var aut1 = phi1.getAutomaton(variables, ca);
            var aut2 = phi2.getAutomaton(variables, ca);
            var aut3 = aut1.Intersect(aut2, ca);
            var aut  = aut3.Minimize(ca);

            //var aut_old = aut.Determinize(ca).Minimize(ca);
            return(aut);
        }
Пример #8
0
 internal abstract Automaton <IMonadicPredicate <BDD, T> > getAutomaton(SimpleList <WS1SVariable <T> > variables, ICartesianAlgebraBDD <T> ca);
Пример #9
0
        public Automaton <IMonadicPredicate <BDD, T> > GetAutomaton(ICartesianAlgebraBDD <T> ca, params WS1SVariable <T>[] fv)
        {
            var fvs = SimpleList <WS1SVariable <T> > .Empty.Append(fv);

            return(getAutomaton(fvs, ca));
        }
Пример #10
0
        public static Automaton <IMonadicPredicate <BDD, T> > MkSuccN <T>(int i1, int i2, int n, ICartesianAlgebraBDD <T> ca)
        {
            var bddAlg     = ca.BDDAlgebra;
            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);

            var both0t      = ca.MkCartesianProduct(both0, ca.Second.True);
            var ind11ind20t = ca.MkCartesianProduct(ind11ind20, ca.Second.True);
            var ind10ind21t = ca.MkCartesianProduct(ind10ind21, ca.Second.True);

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

            moves.Add(new Move <IMonadicPredicate <BDD, T> >(0, 0, both0t));
            moves.Add(new Move <IMonadicPredicate <BDD, T> >(0, 1, ind11ind20t));
            moves.Add(new Move <IMonadicPredicate <BDD, T> >(n, n + 1, ind10ind21t));
            moves.Add(new Move <IMonadicPredicate <BDD, T> >(n + 1, n + 1, both0t));

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

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

            return(aut);
        }
Пример #11
0
        public static Automaton <IMonadicPredicate <BDD, T> > MkLess <T>(int i, int j, ICartesianAlgebraBDD <T> ca)
        {
            Func <BDD, IMonadicPredicate <BDD, T> > lift1 = bdd => ca.MkCartesianProduct(bdd, ca.Second.True);
            Func <T, IMonadicPredicate <BDD, T> >   lift2 = psi => ca.MkCartesianProduct(ca.BDDAlgebra.True, psi);
            var alg       = ca.BDDAlgebra;
            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 <IMonadicPredicate <BDD, T> >[] {
                new Move <IMonadicPredicate <BDD, T> >(0, 0, lift1(both0)),
                new Move <IMonadicPredicate <BDD, T> >(0, 1, lift1(cond1)),
                new Move <IMonadicPredicate <BDD, T> >(1, 1, lift1(both0)),
                new Move <IMonadicPredicate <BDD, T> >(1, 2, lift1(cond2)),
                new Move <IMonadicPredicate <BDD, T> >(2, 2, lift1(both0))
            };
            var aut = Automaton <IMonadicPredicate <BDD, T> > .Create(ca, 0, new int[] { 2 }, moves, false, false, true);

            return(aut);
        }