예제 #1
0
        internal override Automaton <IMonadicPredicate <BDD, T> > getAutomaton(SimpleList <Variable> variables, ICartesianAlgebraBDD <T> alg)
        {
            //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.getAutomaton(variablesExt, alg);

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

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

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

            //var res = res.Determinize(alg);
            var res_min = res.Minimize(alg);

            return(res_min);
        }
예제 #2
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);
        }