示例#1
0
        private BVAlgebra(DecisionTree dtree, IntervalSet[] partition) : base(dtree, partition, partition.Length)
        {
            var   K        = (nrOfBits - 1) / 64;
            int   last     = nrOfBits % 64;
            ulong lastMask = (last == 0 ? ulong.MaxValue : (((ulong)1 << last) - 1));

            all0 = new ulong[K];
            all1 = new ulong[K];
            for (int i = 0; i < K; i++)
            {
                all0[0] = 0;
                if (i < K - 1)
                {
                    all1[i] = ulong.MaxValue;
                }
                else
                {
                    all1[i] = lastMask;
                }
            }
            this.zero  = new BV(0, all0);
            this.ones  = new BV((K == 0 ? lastMask : ulong.MaxValue), all1);
            this.mtg   = new MintermGenerator <BV>(this);
            this.atoms = new BV[nrOfBits];
            for (int i = 0; i < nrOfBits; i++)
            {
                atoms[i] = MkBV(i);
            }
        }
示例#2
0
        public BVAlgebra(CharSetSolver solver, BDD[] minterms)
        {
            this.minterms = minterms;
            this.solver   = solver;
            this.nrOfBits = minterms.Length;
            var   K        = (nrOfBits - 1) / 64;
            int   last     = nrOfBits % 64;
            ulong lastMask = (last == 0 ? ulong.MaxValue : (((ulong)1 << last) - 1));

            all0 = new ulong[K];
            all1 = new ulong[K];
            for (int i = 0; i < K; i++)
            {
                all0[0] = 0;
                if (i < K - 1)
                {
                    all1[i] = ulong.MaxValue;
                }
                else
                {
                    all1[i] = lastMask;
                }
            }
            this.zero  = new BV(minterms.Length, 0, all0);
            this.ones  = new BV(minterms.Length, (K == 0 ? lastMask : ulong.MaxValue), all1);
            this.mtg   = new MintermGenerator <BV>(this);
            this.dtree = DecisionTree.Create(solver, minterms);
            this.atoms = new BV[minterms.Length];
            for (int i = 0; i < minterms.Length; i++)
            {
                atoms[i] = MkBV(i);
            }
        }
示例#3
0
        /// <summary>
        /// Construct the automata algebra for the character solver for the predicate automata.
        /// </summary>
        /// <param name="solver"></param>
        public AutomataAlgebra(IBooleanAlgebra <S> solver)
        {
            this.solver = solver;
            mtg         = new MintermGenerator <Automaton <S> >(this);
            this.empty  = Automaton <S> .MkEmpty(solver);

            this.full = Automaton <S> .MkFull(solver);
        }
示例#4
0
 /// <summary>
 /// Constructs a pair of Boolean algebras that itself is a Boolean algebra over the disjoint union of the domains.
 /// </summary>
 /// <param name="first">first algebra</param>
 /// <param name="second">second algebra</param>
 public PairBoolAlg(IBooleanAlgebra <S> first, IBooleanAlgebra <T> second)
 {
     this.first            = first;
     this.second           = second;
     this.mintermgenerator = new MintermGenerator <Pair <S, T> >(this);
     this.tt = new Pair <S, T>(first.True, second.True);
     this.ff = new Pair <S, T>(first.False, second.False);
 }
示例#5
0
        public CharRangeSolver(BitWidth encoding)
        {
            this.encoding = encoding;
            this.minCharacter = (char)0;
            this.maxCharacter = (encoding == BitWidth.BV7 ? '\x007F' :
                (encoding == BitWidth.BV8 ? '\x00FF' : '\xFFFF'));

            mtg = new MintermGenerator<HashSet<Tuple<char, char>>>(this);
        }
示例#6
0
 private BV64Algebra(DecisionTree dtree, IntervalSet[] partition) : base(dtree, partition, partition.Length)
 {
     this.all   = ulong.MaxValue >> (64 - this.nrOfBits);
     this.mtg   = new MintermGenerator <ulong>(this);
     this.atoms = new ulong[this.nrOfBits];
     for (int i = 0; i < this.nrOfBits; i++)
     {
         atoms[i] = ((ulong)1) << i;
     }
 }
示例#7
0
 public HashSetSolver(BitWidth encoding)
 {
     this.encoding     = encoding;
     this.maxCharacter = (encoding == BitWidth.BV7 ? '\x007F' :
                          (encoding == BitWidth.BV8 ? '\x00FF' : '\xFFFF'));
     sigma_ = new HashSet <char>();
     for (char i = this.minCharacter; i < this.maxCharacter; i++)
     {
         sigma_.Add(i);
     }
     sigma_.Add(this.maxCharacter);
     mtg = new MintermGenerator <HashSet <char> >(this);
 }
示例#8
0
 public CartesianAlgebra(IBooleanAlgebra <T> leafAlg, IBooleanAlgebra <S> nodeAlg)
 {
     this.leafAlgebra            = leafAlg;
     this.nodeAlgebra            = nodeAlg;
     this._True                  = new BDG <T, S>(this, default(S), leafAlg.True, null, null);
     this._False                 = new BDG <T, S>(this, default(S), leafAlg.False, null, null);
     MkLeafCache1[leafAlg.True]  = _True;
     MkLeafCache2[leafAlg.True]  = _True;
     MkLeafCache1[leafAlg.False] = _False;
     MkLeafCache2[leafAlg.False] = _False;
     MkNotCache[_True]           = _False;
     MkNotCache[_False]          = _True;
     this.mintermGenerator       = new MintermGenerator <IMonadicPredicate <T, S> >(this);
 }
示例#9
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);
        }
示例#10
0
 internal EquivClass(bool useEquivalenceChecking, MintermGenerator <PRED> gen, PRED set)
 {
     this.set = set;
     this.gen = gen;
     this.useEquivalenceChecking = useEquivalenceChecking;
 }
示例#11
0
 /// <summary>
 /// Construct a solver for bitvector sets.
 /// </summary>
 public BDDAlgebra()
 {
     mintermGen = new MintermGenerator <BDD>(this);
     _True      = new BDD(this, -1, null, null);
     _False     = new BDD(this, -2, null, null);
 }
示例#12
0
 public BV128Algebra()
 {
     mtg = new MintermGenerator <BV128>(this);
 }