def check_module(): # If user specifies an isolate, check it. Else, if any isolates # are specificied in the file, check all, else check globally. missing = [] isolate = ivy_compiler.isolate.get() if isolate != None: isolates = [isolate] else: isolates = sorted(list(im.module.isolates)) if len(isolates) == 0: isolates = [None] else: if coverage.get(): missing = ivy_isolate.check_isolate_completeness() if missing: raise iu.IvyError(None,"Some assertions are not checked") for isolate in isolates: if isolate != None and isolate in im.module.isolates: idef = im.module.isolates[isolate] if len(idef.verified()) == 0 or isinstance(idef,ivy_ast.TrustedIsolateDef): continue # skip if nothing to verify if isolate: print "\nIsolate {}:".format(isolate) with im.module.copy(): ivy_isolate.create_isolate(isolate) # ,ext='ext' if opt_trusted.get(): continue check_isolate() print '' if failures > 0: raise iu.IvyError(None,"failed checks: {}".format(failures))
def check_module(): # If user specifies an isolate, check it. Else, if any isolates # are specificied in the file, check all, else check globally. missing = [] isolate = ivy_compiler.isolate.get() if isolate != None: isolates = [isolate] else: isolates = sorted(list(im.module.isolates)) if len(isolates) == 0: isolates = [None] else: if coverage.get(): missing = ivy_isolate.check_isolate_completeness() if missing: raise iu.IvyError(None, "Some assertions are not checked") for isolate in isolates: if isolate != None and len( im.module.isolates[isolate].verified()) == 0: continue # skip if nothing to verify if isolate: print "Checking isolate {}...".format(isolate) with im.module.copy(): ivy_isolate.create_isolate(isolate) # ,ext='ext' check_properties() ag = ivy_art.AnalysisGraph(initializer=ivy_alpha.alpha) if im.module.initializers: cex = ag.check_bounded_safety(ag.states[0]) if cex is not None: display_cex("safety failed in initializer", cex) with ivy_interp.EvalContext(check=False): check_conjectures('Initiation', 'These conjectures are false initially.', ag, ag.states[0]) for a in sorted(im.module.public_actions): print "trying {}...".format(a) ag.execute_action(a, prestate=ag.states[0]) cex = ag.check_bounded_safety(ag.states[-1]) if cex is not None: display_cex("safety failed", cex) check_conjectures('Consecution', 'These conjectures are not inductive.', ag, ag.states[-1])
def check_module(): # If user specifies an isolate, check it. Else, if any isolates # are specificied in the file, check all, else check globally. missing = [] isolate = ivy_compiler.isolate.get() if isolate != None: isolates = [isolate] else: isolates = sorted(list(im.module.isolates)) if len(isolates) == 0: isolates = [None] else: if coverage.get(): missing = ivy_isolate.check_isolate_completeness() if missing: raise iu.IvyError(None, "Some assertions are not checked") for isolate in isolates: if isolate != None and isolate in im.module.isolates: idef = im.module.isolates[isolate] if len(idef.verified()) == 0 or isinstance( idef, ivy_ast.TrustedIsolateDef): continue # skip if nothing to verify if isolate: print "Checking isolate {}...".format(isolate) with im.module.copy(): ivy_isolate.create_isolate(isolate) # ,ext='ext' if opt_trusted.get(): continue with im.module.theory_context(): check_properties() ag = ivy_art.AnalysisGraph(initializer=ivy_alpha.alpha) if im.module.initializers: cex = ag.check_bounded_safety(ag.states[0]) if cex is not None: display_cex("safety failed in initializer", cex) with ivy_interp.EvalContext(check=False): check_conjectures( 'Initiation', 'These conjectures are false initially.', ag, ag.states[0]) # show_assertions() for actname in get_checked_actions(): old_checked_assert = act.checked_assert.get() print "trying {}...".format(actname) assertions = find_assertions(actname) if act.checked_assert.get(): assertions = [ a for a in assertions if a.lineno == act.checked_assert.get() ] tried = set() for asn in assertions: if asn.lineno not in tried: tried.add(asn.lineno) act.checked_assert.value = asn.lineno print '{}: {}'.format(asn.lineno, asn) ag.execute_action(actname, prestate=ag.states[0]) cex = ag.check_bounded_safety(ag.states[-1], bound=1) if cex is not None: display_cex("safety failed", cex) print "checking consecution..." ag.execute_action(actname, prestate=ag.states[0], abstractor=ivy_alpha.alpha) check_conjectures( 'Consecution', 'These conjectures are not inductive.', ag, ag.states[-1]) act.checked_assert.value = old_checked_assert
def check_module(): # If user specifies an isolate, check it. Else, if any isolates # are specificied in the file, check all, else check globally. missing = [] isolate = ivy_compiler.isolate.get() if isolate != None: isolates = [isolate] else: isolates = sorted(list(im.module.isolates)) if len(isolates) == 0: isolates = [None] else: if coverage.get(): missing = ivy_isolate.check_isolate_completeness() if missing: raise iu.IvyError(None,"Some assertions are not checked") for isolate in isolates: if isolate != None and isolate in im.module.isolates: idef = im.module.isolates[isolate] if len(idef.verified()) == 0 or isinstance(idef,ivy_ast.TrustedIsolateDef): continue # skip if nothing to verify if isolate: print "Checking isolate {}...".format(isolate) with im.module.copy(): ivy_isolate.create_isolate(isolate) # ,ext='ext' if opt_trusted.get(): continue with im.module.theory_context(): check_properties() ag = ivy_art.AnalysisGraph(initializer=ivy_alpha.alpha) if im.module.initializers: cex = ag.check_bounded_safety(ag.states[0]) if cex is not None: display_cex("safety failed in initializer",cex) with ivy_interp.EvalContext(check=False): check_conjectures('Initiation','These conjectures are false initially.',ag,ag.states[0]) # show_assertions() for actname in get_checked_actions(): old_checked_assert = act.checked_assert.get() print "trying {}...".format(actname) assertions = find_assertions(actname) if act.checked_assert.get(): assertions = [a for a in assertions if a.lineno == act.checked_assert.get()] tried = set() for asn in assertions: if asn.lineno not in tried: tried.add(asn.lineno) act.checked_assert.value = asn.lineno print '{}: {}'.format(asn.lineno,asn) ag.execute_action(actname,prestate=ag.states[0]) cex = ag.check_bounded_safety(ag.states[-1],bound=1) if cex is not None: display_cex("safety failed",cex) print "checking consecution..." ag.execute_action(actname,prestate=ag.states[0],abstractor=ivy_alpha.alpha) check_conjectures('Consecution','These conjectures are not inductive.',ag,ag.states[-1]) act.checked_assert.value = old_checked_assert
def check_module(): # If user specifies an isolate, check it. Else, if any isolates # are specificied in the file, check all, else check globally. missing = [] isolate = ivy_compiler.isolate.get() if isolate != None: isolates = [isolate] else: isolates = sorted(list(im.module.isolates)) if len(isolates) == 0: isolates = [None] else: if coverage.get(): missing = ivy_isolate.check_isolate_completeness() if missing: raise iu.IvyError(None, "Some assertions are not checked") for isolate in isolates: if isolate is not None and isolate in im.module.isolates: idef = im.module.isolates[isolate] if len(idef.verified()) == 0 or isinstance( idef, ivy_ast.TrustedIsolateDef): continue # skip if nothing to verify if isolate: print "\nIsolate {}:".format(isolate) if isolate is not None and iu.compose_names( isolate, 'macro_finder') in im.module.attributes: save_macro_finder = islv.opt_macro_finder.get() if save_macro_finder: print "Turning off macro_finder" islv.set_macro_finder(False) with im.module.copy(): ivy_isolate.create_isolate(isolate) # ,ext='ext' if opt_trusted.get(): continue method_name = get_isolate_method(isolate) if method_name == 'mc': mc_isolate(isolate) elif method_name.startswith('bmc['): global some_bounded some_bounded = True _, prms = iu.parse_int_subscripts(method_name) if len(prms) != 1: raise IvyError( None, 'BMC method specifier should be bmc[<steps>]. Got "{}".' .format(method_name)) mc_isolate(isolate, lambda: ivy_bmc.check_isolate(prms[0])) else: check_isolate() if isolate is not None and iu.compose_names( isolate, 'macro_finder') in im.module.attributes: if save_macro_finder: print "Turning on macro_finder" islv.set_macro_finder(True) print '' if failures > 0: raise iu.IvyError(None, "failed checks: {}".format(failures)) if checked_action.get() and not checked_action_found: raise iu.IvyError( None, "{} is not an exported action of any isolate".format( checked_action.get())) cact = checked_action.get()