def satisfy(self, axioms, _get_model_clauses=None, final_cond=None): """ Produce a state sequence if the symbolic history contains one. Returns the sort universes and a sequence of states, or None if the history is vacuous. """ if _get_model_clauses is None: _get_model_clauses = small_model_clauses # print "axioms: {}".format(axioms) # A model of the post-state embeds a valuation for each time # in the history. # print "concrete state: {}".format(self.post) # print "background: {}".format(axioms) post = and_clauses(self.post, axioms) # print "bounded check {" model = _get_model_clauses(post, final_cond=final_cond) # print "} bounded check" if model == None: # print "core = {}".format(unsat_core(post,true_clauses())) return None # we reconstruct the sub-model for each state composing the # recorded renamings in reverse order. Here "renaming" maps # symbols representing a past time onto current time skolems renaming, states, maps = {}, [], reversed(self.maps) while True: # ignore all symbols except those representing the given past time img = set(renaming[s] for s in renaming if not s.is_skolem()) ignore = lambda s: self.ignore(s, img, renaming) # get the sub-mode for the given past time as a formula if isinstance(final_cond, list): final_cond = or_clauses(*[fc.cond() for fc in final_cond]) all_clauses = and_clauses( post, final_cond) if final_cond != None else post clauses = clauses_model_to_clauses(all_clauses, ignore=ignore, model=model, numerals=use_numerals()) # map this formula into the past using inverse map clauses = rename_clauses(clauses, inverse_map(renaming)) # remove tautology equalities, TODO: not sure if this is correct here clauses = Clauses( [f for f in clauses.fmlas if not is_tautology_equality(f)], clauses.defs) states.append(clauses) try: # update the inverse map by composing it with inverse # of the next renaming (in reverse order) renaming = compose_maps(next(maps), renaming) except StopIteration: break uvs = model.universes(numerals=use_numerals()) # print "uvs: {}".format(uvs) return uvs, [pure_state(clauses) for clauses in reversed(states)]
def satisfy(self, axioms, _get_model_clauses=None, final_cond=None): """ Produce a state sequence if the symbolic history contains one. Returns the sort universes and a sequence of states, or None if the history is vacuous. """ if _get_model_clauses is None: _get_model_clauses = small_model_clauses # print "axioms: {}".format(axioms) # A model of the post-state embeds a valuation for each time # in the history. # print "concrete state: {}".format(self.post) # print "background: {}".format(axioms) post = and_clauses(self.post,axioms) # print "bounded check {" model = _get_model_clauses(post,final_cond=final_cond) # print "} bounded check" if model == None: # print "core = {}".format(unsat_core(post,true_clauses())) return None # we reconstruct the sub-model for each state composing the # recorded renamings in reverse order. Here "renaming" maps # symbols representing a past time onto current time skolems renaming,states,maps = {},[],reversed(self.maps) while True: # ignore all symbols except those representing the given past time img = set(renaming[s] for s in renaming if not s.is_skolem()) ignore = lambda s: self.ignore(s,img,renaming) # get the sub-mode for the given past time as a formula if isinstance(final_cond,list): final_cond = or_clauses(*[fc.cond() for fc in final_cond]) all_clauses = and_clauses(post,final_cond) if final_cond != None else post clauses = clauses_model_to_clauses(all_clauses,ignore = ignore, model = model, numerals=use_numerals()) # map this formula into the past using inverse map clauses = rename_clauses(clauses,inverse_map(renaming)) # remove tautology equalities, TODO: not sure if this is correct here clauses = Clauses( [f for f in clauses.fmlas if not is_tautology_equality(f)], clauses.defs ) states.append(clauses) try: # update the inverse map by composing it with inverse # of the next renaming (in reverse order) renaming = compose_maps(next(maps),renaming) except StopIteration: break uvs = model.universes(numerals=use_numerals()) # print "uvs: {}".format(uvs) return uvs, [pure_state(clauses) for clauses in reversed(states)]
def remove_taut_eqs_clauses(clauses): return Clauses([f for f in clauses.fmlas if not is_tautology_equality(f)], clauses.defs)
def _normalize_facts(facts): facts = normalize_quantifiers(And(*facts)) assert type(facts) is And return [f for f in facts if not is_tautology_equality(f)]
def suppose(self,fmla): if not is_tautology_equality(fmla): self.suppose_constraints.append(fmla)
def suppose(self, fmla): if not is_tautology_equality(fmla): self.suppose_constraints.append(fmla)
def remove_taut_eqs_clauses(clauses): return Clauses( [f for f in clauses.fmlas if not is_tautology_equality(f)], clauses.defs )