def display_cex(msg, ag): if diagnose.get(): import tk_ui as ui iu.set_parameters({'mode': 'induction'}) ui.ui_main_loop(ag) exit(1) raise iu.IvyError(None, msg)
def gui_art(other_art): import tk_ui as ui # iu.set_parameters({'mode':'induction'}) iu.set_parameters({'ui': 'cti'}) gui = ui.new_ui() agui = gui.add(other_art) gui.tk.update_idletasks() # so that dialog is on top of main window gui.tk.mainloop() exit(1)
def main(): ivy.read_params() iu.set_parameters({'show_compiled':'true'}) if len(sys.argv) != 2 or not sys.argv[1].endswith('ivy'): usage() with im.Module(): with utl.ErrorPrinter(): ivy.source_file(sys.argv[1],ivy.open_read(sys.argv[1]),create_isolate=False) check_module()
def main(): ivy_init.read_params() iu.set_parameters({'show_compiled':'true'}) if len(sys.argv) != 2 or not sys.argv[1].endswith('ivy'): print "<bhavya> in ivy_show" usage() with im.Module(): with utl.ErrorPrinter(): ivy_init.source_file(sys.argv[1],ivy_init.open_read(sys.argv[1]),create_isolate=False) check_module()
def main(): ivy.read_params() iu.set_parameters({'mode': 'induction'}) if len(sys.argv) != 2 or not sys.argv[1].endswith('ivy'): usage() with im.Module(): with utl.ErrorPrinter(): ivy.source_file(sys.argv[1], ivy.open_read(sys.argv[1]), create_isolate=False) check_module() print "OK"
def check_conjectures(kind,msg,ag,state): failed = itp.undecided_conjectures(state) if failed: if diagnose.get(): print "{} failed.".format(kind) import tk_ui as ui iu.set_parameters({'mode':'induction'}) gui = ui.new_ui() agui = gui.add(ag) gui.tk.update_idletasks() # so that dialog is on top of main window agui.try_conjecture(state,msg="{}\nChoose one to see counterexample.".format(msg),bound=1) gui.tk.mainloop() exit(1) raise iu.IvyError(None,"{} failed.".format(kind))
def check_properties(): if itp.false_properties(): if diagnose.get(): print "Some properties failed." import tk_ui as ui iu.set_parameters({'mode':'induction'}) gui = ui.new_ui() gui.tk.update_idletasks() # so that dialog is on top of main window gui.try_property() gui.mainloop() exit(1) raise iu.IvyError(None,"Some properties failed.") im.module.labeled_axioms.extend(im.module.labeled_props) im.module.update_theory()
def read_params(): ps = dict() args = sys.argv[1:] while args and '=' in args[0]: thing = string.split(args[0], '=') if len(thing) > 2: usage() ps[thing[0]] = thing[1] args = args[1:] try: set_parameters(ps) except IvyError as e: print e exit(1) sys.argv = sys.argv[0:1] + args
def read_params(): ps = dict() args = sys.argv[1:] while args and '=' in args[0]: thing = string.split(args[0],'=') if len(thing) > 2: usage() ps[thing[0]] = thing[1] args = args[1:] try: set_parameters(ps) except IvyError as e: print e exit(1) sys.argv = sys.argv[0:1] + args
def show_counterexample(ag,state,bmc_res): universe,path = bmc_res other_art = ivy_art.AnalysisGraph() ag.copy_path(state,other_art,None) for state,value in zip(other_art.states[-len(path):],path): state.value = value state.universe = universe import tk_ui as ui iu.set_parameters({'mode':'induction'}) gui = ui.new_ui() agui = gui.add(other_art) gui.tk.update_idletasks() # so that dialog is on top of main window gui.tk.mainloop() exit(1)
assume link(x,y); link(x,y) := false; semaphore(y) := true } action test = { assert ~(X ~= Z & link(X,Y) & link(Z,Y)) } export connect export disconnect export test """ with ivy_module.Module(): iu.set_parameters({'ui':'cti','ext':'ext'}) main_ui = new_ui() ui = main_ui.add(ivy_from_string(prog)) main_ui.answer("OK") ui.check_inductiveness() # ui = ui.cti cg = ui.current_concept_graph cg.show_relation(cg.relation('link(X,Y)'),'+') cg.gather() main_ui.answer("OK") cg.strengthen() main_ui.answer("OK") ui.check_inductiveness() cg.show_relation(cg.relation('semaphore'),'+') cg.gather() main_ui.answer("OK")