def x_and_not_y(): # remember: # 2 = !(x & !y) # -2 = x & !y ordering = {'x': 0, 'y': 1} g = BDD(ordering) u = 3 v = -1 w = 1 t = (1, v, w) g._succ[u] = t g._pred[t] = u g._ref[abs(v)] += 1 g._ref[abs(w)] += 1 g._ref[abs(u)] = 0 u = 2 v = 1 w = 3 t = (0, v, w) g._succ[u] = t g._pred[t] = u g._ref[abs(v)] += 1 g._ref[abs(w)] += 1 g._ref[abs(u)] = 0 g._min_free = 4 return g
def two_vars_xy(): ordering = {'x': 0, 'y': 1} g = BDD(ordering) u = 2 t = (0, -1, 1) g._succ[u] = t g._pred[t] = u g._ref[u] = 1 u = 3 t = (1, -1, 1) g._succ[u] = t g._pred[t] = u g._ref[u] = 1 g._min_free = u + 1 return g