Пример #1
0
def emit_one_initial_state(header):
    m = slv.get_model_clauses(im.module.init_cond)
    if m == None:
        raise IvyError(None, 'Initial condition is inconsistent')
    for sym in all_state_symbols():
        if sym not in is_derived:
            assign_symbol_from_model(header, sym, m)
Пример #2
0
def reach_state(state, clauses=None):
    """ Try to reach a state in one step from it's predecessor's
    underapproximation. If reachable, update the state's
    underapproximation with some known reachable state.  Return the
    reachable state. Else return None.
    """
    if not (state.pred != None and state.update != None):
        return None
    pre = join_unders(state.pred)
    if clauses == None:
        clauses = state.clauses
    print "reach_state: clauses = {}".format(clauses)
    axioms = state.domain.background_theory(state.in_scope)
    img = and_clauses(forward_image(pre, axioms, state.update), axioms,
                      clauses)
    m = get_model_clauses(img)
    ignore = lambda s, d=state.domain: s not in d.relations and s not in d.functions
    if m:
        #        print "reach_state model = {}".format(m.model)
        idx = find_true_disjunct(pre, m.eval)
        post = clauses_model_to_clauses(img, ignore, model=m)
        return add_under(
            state, post, state.unders[idx],
            dict((s, [c.skolem() for c in m.sort_universe(s)])
                 for s in m.sorts()))
    return None
Пример #3
0
def emit_one_initial_state(header):
    m = slv.get_model_clauses(im.module.init_cond)
    if m == None:
        raise IvyError(None,'Initial condition is inconsistent')
    for sym in all_state_symbols():
        if sym not in is_derived:
            assign_symbol_from_model(header,sym,m)
Пример #4
0
 def diagram(self):
     from ivy_solver import clauses_model_to_diagram, get_model_clauses
     from ivy_transrel import is_skolem, reverse_image
     if not self.have_cti:
         if self.check_inductiveness() or len(self.g.states) != 2:
             return
     conj = self.current_conjecture
     post = ilu.dual_clauses(conj) if conj != None else ilu.true_clauses()
     pre = self.g.states[0].clauses
     axioms = im.module.background_theory()
     rev = ilu.and_clauses(reverse_image(post,axioms,self.g.states[1].update), axioms)
     clauses = ilu.and_clauses(pre,rev)
     mod = get_model_clauses(clauses)
     assert mod != None
     diag = clauses_model_to_diagram(rev,is_skolem,model=mod)
     self.g.states[0].clauses = diag
     self.view_state(self.g.states[0], reset=True)
     self.show_used_relations(diag,both=True)
Пример #5
0
 def diagram(self):
     from ivy_solver import clauses_model_to_diagram, get_model_clauses
     from ivy_transrel import is_skolem, reverse_image
     if not self.have_cti:
         if self.check_inductiveness() or len(self.g.states) != 2:
             return
     conj = self.current_conjecture
     post = ilu.dual_clauses(conj) if conj != None else ilu.true_clauses()
     pre = self.g.states[0].clauses
     axioms = im.module.background_theory()
     rev = ilu.and_clauses(
         reverse_image(post, axioms, self.g.states[1].update), axioms)
     clauses = ilu.and_clauses(pre, rev)
     mod = get_model_clauses(clauses)
     assert mod != None
     diag = clauses_model_to_diagram(rev, is_skolem, model=mod)
     self.g.states[0].clauses = diag
     self.view_state(self.g.states[0], reset=True)
     self.show_used_relations(diag, both=True)
Пример #6
0
def reach_state(state,clauses=None):
    """ Try to reach a state in one step from it's predecessor's
    underapproximation. If reachable, update the state's
    underapproximation with some known reachable state.  Return the
    reachable state. Else return None.
    """
    if not(state.pred != None and state.update != None):
        return None
    pre = join_unders(state.pred)
    if clauses == None:
        clauses = state.clauses
    print "reach_state: clauses = {}".format(clauses)
    axioms = state.domain.background_theory(state.in_scope)
    img = and_clauses(forward_image(pre,state.update),axioms,clauses)
    m = get_model_clauses(img)
    ignore = lambda s,d=state.domain: s not in d.relations and s not in d.functions
    if m:
#        print "reach_state model = {}".format(m.model)
        idx = find_true_disjunct(pre,m.eval)
        post = clauses_model_to_clauses(img,ignore,model=m)
        return add_under(state,post,state.unders[idx],dict((s,[c.skolem() for c in m.sort_universe(s)]) for s in m.sorts()))
    return None