Example #1
0
        public UIntW GetAtom(UIntW set)
        {
            if (!IsSatisfiable(set))
            {
                return(set);
            }

            for (int i = 0; i < size; i++)
            {
                var ith = IthOnly(set, i);
                if (ith.val > 0)
                {
                    return(ith);
                }
            }

            //This shouldn't happen
            return(new UIntW(0));
        }
Example #2
0
        public FiniteSetAlgebra(HashSet <S> universe)
        {
            if (universe.Count > 63)
            {
                throw new AutomataException("for now only supports alphabets of size<=32");
            }
            var alphDic = new Dictionary <S, UIntW>();

            foreach (var v in universe)
            {
                alphDic[v] = new UIntW(((UInt64)1) << alphDic.Count);
            }
            alph       = alphDic;
            this.size  = universe.Count;
            this.empty = new UIntW(0);
            this.full  = new UIntW((((UInt64)1) << size) - 1);

            mtg = new MintermGenerator <UIntW>(this);
        }
Example #3
0
 public UIntW MkOr(UIntW s1, UIntW s2)
 {
     return(new UIntW(s1.val | s2.val));
 }
Example #4
0
 public UIntW MkNot(UIntW set)
 {
     return(new UIntW(True.val & ~(set.val)));
 }
Example #5
0
 public bool CheckImplication(UIntW a, UIntW b)
 {
     return(MkDiff(a, b).val == 0);
 }
Example #6
0
 public bool AreEquivalent(UIntW a, UIntW b)
 {
     return(a == b);
 }
Example #7
0
 public UIntW MkDiff(UIntW predicate1, UIntW predicate2)
 {
     return(MkAnd(predicate1, MkNot(predicate2)));
 }
Example #8
0
 public bool EvaluateAtom(UIntW atom, UIntW psi)
 {
     throw new NotImplementedException();
 }
Example #9
0
 private UIntW IthOnly(UIntW var, int pos)
 {
     return(new UIntW((UInt64)(var.val & (uint)(1 << pos))));
 }
Example #10
0
 public UIntW MkSymmetricDifference(UIntW p1, UIntW p2)
 {
     return(MkOr(MkAnd(p1, MkNot(p2)), MkAnd(p2, MkNot(p1))));
 }
Example #11
0
 public UIntW Simplify(UIntW s)
 {
     return(s);
 }
Example #12
0
 public bool IsSatisfiable(UIntW s)
 {
     return(s.val > 0);
 }
Example #13
0
 public UIntW MkAnd(UIntW s1, UIntW s2)
 {
     return(new UIntW(s1.val & s2.val));
 }