Exemplo n.º 1
0
        public IMonadicPredicate <T, S> MkAnd(IMonadicPredicate <T, S> predicate1, IMonadicPredicate <T, S> predicate2)
        {
            //using Depth as a heuristic
            BDG <T, S> p1 = (BDG <T, S>)predicate1;
            BDG <T, S> p2 = (BDG <T, S>)predicate2;

            if (p1.Depth <= p2.Depth)
            {
                return(p2.MkAnd(p1));
            }
            else
            {
                return(p1.MkAnd(p2));
            }
        }
Exemplo n.º 2
0
        public bool AreEquivalent(IMonadicPredicate <T, S> predicate1, IMonadicPredicate <T, S> predicate2)
        {
            //check if predicate1 does not imply predicate2
            if (IsSatisfiable(MkAnd(predicate1, MkNot(predicate2))))
            {
                return(false);
            }

            //check the other direction
            if (IsSatisfiable(MkAnd(predicate2, MkNot(predicate1))))
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 3
0
        public IMonadicPredicate <T, S> GetAtom(IMonadicPredicate <T, S> psi)
        {
            if (!IsAtomic)
            {
                throw new AutomataException(AutomataExceptionKind.BooleanAlgebraIsNotAtomic);
            }


            foreach (var tuple in psi.GetSumOfProducts())
            {
                var a2 = nodeAlgebra.GetAtom(tuple.Item2);
                var a1 = leafAlgebra.GetAtom(tuple.Item1);
                var a  = MkNode(a1, a2);
                return(a);
            }

            return(_False);
        }
Exemplo n.º 4
0
 public IMonadicPredicate <BDD, T> Omit(int bit, IMonadicPredicate <BDD, T> pred)
 {
     return(((BDG <BDD, T>)pred).TransformLeaves(bdd => BDDAlgebra.OmitBit(bdd, bit)));
 }
Exemplo n.º 5
0
 public IMonadicPredicate <T, S> MkDiff(IMonadicPredicate <T, S> predicate1, IMonadicPredicate <T, S> predicate2)
 {
     return(MkAnd(predicate1, MkNot(predicate2)));
 }
Exemplo n.º 6
0
 public bool EvaluateAtom(IMonadicPredicate <T, S> atom, IMonadicPredicate <T, S> psi)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 7
0
 public bool CheckImplication(IMonadicPredicate <T, S> lhs, IMonadicPredicate <T, S> rhs)
 {
     return(!IsSatisfiable(MkAnd(lhs, MkNot(rhs))));
 }
Exemplo n.º 8
0
 public IMonadicPredicate <T, S> MkSymmetricDifference(IMonadicPredicate <T, S> p1, IMonadicPredicate <T, S> p2)
 {
     return(MkOr(MkAnd(p1, MkNot(p2)), MkAnd(p2, MkNot(p1))));
 }
Exemplo n.º 9
0
 public bool IsSatisfiable(IMonadicPredicate <T, S> predicate)
 {
     return(predicate != False); //assuming no unsatisfiable leafs are ever created
 }
Exemplo n.º 10
0
 public IMonadicPredicate <T, S> MkOr(IMonadicPredicate <T, S> predicate1, IMonadicPredicate <T, S> predicate2)
 {
     //using DeMorgan
     return(MkNot(MkAnd(MkNot(predicate1), MkNot(predicate2))));
 }
Exemplo n.º 11
0
 public IMonadicPredicate <T, S> Simplify(IMonadicPredicate <T, S> predicate)
 {
     return(predicate); //TBD, not clear what this means here
 }
Exemplo n.º 12
0
 public IMonadicPredicate <T, S> MkNot(IMonadicPredicate <T, S> predicate)
 {
     return(((BDG <T, S>)predicate).MkNot());
 }