def test_simplify(): spec = get_def() syn_exp = SyExp("and", [SyExp("LN231", []), SyExp("LN218", [])]) overall = SyExp("eqv", [spec, syn_exp]) print("overall:", overall) x = overall.simplify_bdd() print("after simplify:", x)
def test_simplify_bdd(): x = SyExp("x", []) y = SyExp("y", []) e1 = SyExp("or", [x, y]) e2 = SyExp("and", [SyExp("x", []), SyExp("d1", [])]) e3 = SyExp("eqv", [e1, e2]) print("before e3: ", e3.show2(0)) e4 = e3.simplify_bdd() print("after e3: ", e4.show2(0))
def __init__(self, spec, syn_exp): assert isinstance(spec, SyExp) assert isinstance(syn_exp, SyExp) self.spec = spec self.syn_exp = syn_exp #self.spec_tseitin_cnf = None #self.syn_exp_tseitin_cnf = None eqv = SyExp("eqv", [self.spec, self.syn_exp]) self.overall_exp = eqv.simplify_bdd() self.overall_cnf = TseitinCNF(self.overall_exp, 1)
def __init__(self, spec, partial_tree): # extract forall vars (assume all of which are in spec) vnames = spec.get_vars() # print("vnames:", vnames) ptree = deepcopy(partial_tree) ptree, sid = rename_nonT(ptree) eqv = SyExp("eqv", [spec, ptree]) eqv = eqv.simplify_bdd() # print("eqv:", eqv.show2(0)) # get cnf t = TseitinCNF(eqv) n2v = t.get_name2var() # print("names:", n2v) self.v_forall = [n2v[name] for name in vnames] cnf = t.cnfs cnf.append( [t.get_overall_id()] ) self.cnf = cnf