def diagram(self): if self.parent != None and self.g.parent_state != None: self.checkpoint() g = self.g ## print "g.constraints: %s" % g.constraints if hasattr(g, 'reverse_result'): # "print reverse diagram" dgm = ivy_interp.diagram(self.g.parent_state, self.g.reverse_result[1], extra_axioms=self.g.reverse_result[0]) else: dgm = ivy_interp.diagram(self.g.parent_state, self.g.state) if dgm != None: goal = lu.reskolemize_clauses( dgm, self.g.parent_state.domain.skolemizer()) g.constraints = goal g.set_state(goal) self.update() else: dlg = Toplevel(self) Label(dlg, text="The current state is vacuous.").pack() b = Button(dlg, text="OK", command=dlg.destroy) b.pack(padx=5, side=TOP) uu.center_window_on_window(dlg, self.root) self.tk.wait_window(dlg)
def conjecture(self): if self.parent != None and self.g.parent_state != None: self.checkpoint() g = self.g s = g.state if g.constraints.is_true() else g.constraints ri = self.parent.conjecture(g.parent_state, s) if ri != None: core, interp = ri dlg = Toplevel(self) msg = ("Based on this goal and the known reached states, " + "we can conjecture the following invariant:") text = str(clauses_to_formula(interp)) self.ui_parent.text_dialog(msg, text, on_cancel=None) goal = lu.reskolemize_clauses( core, self.g.parent_state.domain.skolemizer()) g.constraints = goal g.set_state(goal) self.update() else: msg = ( "Cannot form a conjecture based in the known reached states " + "and this goal. Suggest manually materializing a goal pattern." ) self.ui_parent.ok_dialog(msg)
def conjecture(self): if self.parent != None and self.g.parent_state != None: self.checkpoint() g = self.g # print "g.constraints: %s" % g.constraints # print "g.state: %s" % g.state # print "g.constraints.is_true: %s" % g.constraints.is_true() s = g.state if g.constraints.is_true() else g.constraints # print "s: {}".format(s) ri = self.parent.conjecture(g.parent_state, s) if ri != None: core, interp = ri dlg = Toplevel(self) Label( dlg, text= "Based on this goal and the known reached states, we can conjecture the following invariant:" ).pack() S = Scrollbar(dlg) T = Text(dlg, height=4, width=100) S.pack(side=RIGHT, fill=Y) T.pack(side=LEFT, fill=Y) S.config(command=T.yview) T.config(yscrollcommand=S.set) T.insert(END, repr(clauses_to_formula(interp))) b = Button(dlg, text="OK", command=dlg.destroy) b.pack(padx=5, side=TOP) uu.center_window_on_window(dlg, self.root) self.tk.wait_window(dlg) # goal = dual_clauses(interp,skolemizer=self.g.parent_state.domain.skolemizer()) goal = lu.reskolemize_clauses( core, self.g.parent_state.domain.skolemizer()) g.constraints = goal g.set_state(goal) self.update() else: dlg = Toplevel(self) Label( dlg, text= "Cannot form a conjecture based in the known reached states and this goal. Suggest manually materializing a goal pattern." ).pack() b = Button(dlg, text="OK", command=dlg.destroy) b.pack(padx=5, side=TOP) uu.center_window_on_window(dlg, self.root) self.tk.wait_window(dlg)
def diagram(self): if self.parent != None and self.g.parent_state != None: self.checkpoint() g = self.g if hasattr(g, "reverse_result"): dgm = ivy_interp.diagram( self.g.parent_state, self.g.reverse_result[1], extra_axioms=self.g.reverse_result[0] ) else: dgm = ivy_interp.diagram(self.g.parent_state, self.g.state) if dgm != None: goal = lu.reskolemize_clauses(dgm, self.g.parent_state.domain.skolemizer()) g.constraints = goal g.set_state(goal) self.update() else: self.ui_parent.ok_dialog("The current state is vacuous.")
def diagram(self): if self.parent != None and self.g.parent_state != None: self.checkpoint() g = self.g if hasattr(g,'reverse_result'): dgm = ivy_interp.diagram(self.g.parent_state, self.g.reverse_result[1], extra_axioms = self.g.reverse_result[0]) else: dgm = ivy_interp.diagram(self.g.parent_state,self.g.state) if dgm != None: goal = lu.reskolemize_clauses(dgm,self.g.parent_state.domain.skolemizer()) g.constraints = goal g.set_state(goal) self.update() else: self.ui_parent.ok_dialog("The current state is vacuous.")
def conjecture(self): if self.parent != None and self.g.parent_state != None: self.checkpoint() g = self.g s = g.state if g.constraints.is_true() else g.constraints ri = self.parent.conjecture(g.parent_state, s) if ri != None: core,interp = ri dlg = Toplevel(self) msg = ("Based on this goal and the known reached states, " + "we can conjecture the following invariant:") text = str(clauses_to_formula(interp)) self.ui_parent.text_dialog(msg,text,on_cancel=None) goal = lu.reskolemize_clauses(core,self.g.parent_state.domain.skolemizer()) g.constraints = goal g.set_state(goal) self.update() else: msg = ("Cannot form a conjecture based in the known reached states " + "and this goal. Suggest manually materializing a goal pattern.") self.ui_parent.ok_dialog(msg)
def diagram(self): if self.parent != None and self.g.parent_state != None: self.checkpoint() g = self.g ## print "g.constraints: %s" % g.constraints if hasattr(g,'reverse_result'): # "print reverse diagram" dgm = ivy_interp.diagram(self.g.parent_state,self.g.reverse_result[1],extra_axioms = self.g.reverse_result[0]) else: dgm = ivy_interp.diagram(self.g.parent_state,self.g.state) if dgm != None: goal = lu.reskolemize_clauses(dgm,self.g.parent_state.domain.skolemizer()) g.constraints = goal g.set_state(goal) self.update() else: dlg = Toplevel(self) Label(dlg, text="The current state is vacuous.").pack() b = Button(dlg, text="OK", command=dlg.destroy) b.pack(padx=5,side=TOP) uu.center_window_on_window(dlg,self.root) self.tk.wait_window(dlg)
def conjecture(self): if self.parent != None and self.g.parent_state != None: self.checkpoint() g = self.g # print "g.constraints: %s" % g.constraints # print "g.state: %s" % g.state # print "g.constraints.is_true: %s" % g.constraints.is_true() s = g.state if g.constraints.is_true() else g.constraints # print "s: {}".format(s) ri = self.parent.conjecture(g.parent_state, s) if ri != None: core,interp = ri dlg = Toplevel(self) Label(dlg, text="Based on this goal and the known reached states, we can conjecture the following invariant:").pack() S = Scrollbar(dlg) T = Text(dlg, height=4, width=100) S.pack(side=RIGHT, fill=Y) T.pack(side=LEFT, fill=Y) S.config(command=T.yview) T.config(yscrollcommand=S.set) T.insert(END, repr(clauses_to_formula(interp))) b = Button(dlg, text="OK", command=dlg.destroy) b.pack(padx=5,side=TOP) uu.center_window_on_window(dlg,self.root) self.tk.wait_window(dlg) # goal = dual_clauses(interp,skolemizer=self.g.parent_state.domain.skolemizer()) goal = lu.reskolemize_clauses(core,self.g.parent_state.domain.skolemizer()) g.constraints = goal g.set_state(goal) self.update() else: dlg = Toplevel(self) Label(dlg, text="Cannot form a conjecture based in the known reached states and this goal. Suggest manually materializing a goal pattern.").pack() b = Button(dlg, text="OK", command=dlg.destroy) b.pack(padx=5,side=TOP) uu.center_window_on_window(dlg,self.root) self.tk.wait_window(dlg)