Пример #1
0
        Automaton <BDD> GetAutomatonBDD1(Variable[] variables, IBDDAlgebra alg, int nrOfFreeBits, bool singletonSetSemantics)
        {
            var res = GetAutomatonBDD(SimpleList <Variable> .Empty.Append(variables), alg, nrOfFreeBits, singletonSetSemantics);

            for (int i = 0; i < variables.Length; i++)
            {
                if (variables[i].IsFirstOrder)
                {
                    if (singletonSetSemantics)
                    {
                        res = res.Intersect(BasicAutomata.MkSingleton(i, alg)).Determinize().Minimize();
                    }
                    else
                    {
                        res = res.Intersect(BasicAutomata.MkIsNonempty(i, alg)).Determinize().Minimize();
                    }
                }
            }
            return(res);
        }
Пример #2
0
        Automaton <IMonadicPredicate <BDD, T> > GetAutomatonX1(Variable[] variables, ICartesianAlgebraBDD <T> alg, bool singletonSetSemantics)
        {
            var res = GetAutomatonX(SimpleList <Variable> .Empty.Append(variables), alg, singletonSetSemantics);

            for (int i = 0; i < variables.Length; i++)
            {
                if (variables[i].IsFirstOrder)
                {
                    if (singletonSetSemantics)
                    {
                        res = res.Intersect(BasicAutomata.MkSingleton <T>(i, alg)).Determinize().Minimize();
                    }
                    else
                    {
                        res = res.Intersect(BasicAutomata.MkIsNonempty <T>(i, alg)).Determinize().Minimize();
                    }
                }
            }
            return(res);
        }
Пример #3
0
        //TBD: enable singleton-set-semantics
        internal override Automaton <IMonadicPredicate <BDD, T> > GetAutomatonX(SimpleList <Variable> variables, ICartesianAlgebraBDD <T> alg, bool singletonSetSemantics)
        {
            //the existential variable will shadow any previous occurrence with the same name
            //because when looking up the index of var it will be the last occurrence
            var varIndex     = variables.Count;
            var variablesExt = variables.Append(var);
            var autPhi       = phi.GetAutomatonX(variablesExt, alg, singletonSetSemantics);
            Automaton <IMonadicPredicate <BDD, T> > autEx;

            if (this.IsFirstOrder)
            {
                if (singletonSetSemantics)
                {
                    autEx = autPhi.Intersect(BasicAutomata.MkSingleton <T>(varIndex, alg)).Minimize();
                }
                else
                {
                    autEx = autPhi.Intersect(BasicAutomata.MkIsNonempty <T>(varIndex, alg)).Minimize();
                }
            }
            else
            {
                autEx = autPhi;
            }

            //Project away the the existential variable
            var newMoves = new List <Move <IMonadicPredicate <BDD, T> > >();

            foreach (var move in autEx.GetMoves())
            {
                newMoves.Add(new Move <IMonadicPredicate <BDD, T> >(move.SourceState, move.TargetState, alg.Omit(varIndex, move.Label)));
            }

            var aut = Automaton <IMonadicPredicate <BDD, T> > .Create(alg, autEx.InitialState, autEx.GetFinalStates(), newMoves);

            var res = aut.Determinize();

            res = res.Minimize();

            return(res);
        }