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)); }
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); }
public UIntW MkOr(UIntW s1, UIntW s2) { return(new UIntW(s1.val | s2.val)); }
public UIntW MkNot(UIntW set) { return(new UIntW(True.val & ~(set.val))); }
public bool CheckImplication(UIntW a, UIntW b) { return(MkDiff(a, b).val == 0); }
public bool AreEquivalent(UIntW a, UIntW b) { return(a == b); }
public UIntW MkDiff(UIntW predicate1, UIntW predicate2) { return(MkAnd(predicate1, MkNot(predicate2))); }
public bool EvaluateAtom(UIntW atom, UIntW psi) { throw new NotImplementedException(); }
private UIntW IthOnly(UIntW var, int pos) { return(new UIntW((UInt64)(var.val & (uint)(1 << pos)))); }
public UIntW MkSymmetricDifference(UIntW p1, UIntW p2) { return(MkOr(MkAnd(p1, MkNot(p2)), MkAnd(p2, MkNot(p1)))); }
public UIntW Simplify(UIntW s) { return(s); }
public bool IsSatisfiable(UIntW s) { return(s.val > 0); }
public UIntW MkAnd(UIntW s1, UIntW s2) { return(new UIntW(s1.val & s2.val)); }