def do_updr(s: Solver) -> None: if utils.args.use_z3_unsat_cores: z3.set_param('smt.core.minimize', True) logic.check_init(s, safety_only=True) fs = updr.Frames(s) try: fs.search() finally: utils.logger.info(f'updr learned {fs.state_count} states (possibly with duplicates)') utils.logger.info(f'updr learned {len(fs.predicates)} predicates (no duplicates)') for x in fs.predicates: utils.logger.info(str(x))
def verify(s: Solver) -> None: old_count = utils.error_count prog = syntax.the_program a = prog.the_automaton() if a is None: if utils.args.automaton == 'only': utils.print_error_and_exit( None, "--automaton='only' requires the file to declare an automaton") elif utils.args.automaton != 'no': check_automaton_full(s, a) if utils.args.automaton != 'only': init_res = logic.check_init(s) tr_res = logic.check_transitions(s) res = init_res or tr_res if res is not None and utils.args.json: json_cex: Optional[JSON] = json_counterexample(res) else: json_cex = None obj: JSON = {} obj['version'] = 1 obj['subcommand'] = utils.args.subcommand obj['is_inductive'] = json_cex is None if json_cex is not None: obj['counterexample'] = json_cex json.dump(obj, sys.stdout, indent=4) if utils.error_count == old_count: utils.logger.always_print('all ok!') else: utils.logger.always_print('program has errors.')
def check() -> bool: prog.decls = other_decls + list(R) if logic.check_init(s, minimize=False, verbose=False) is not None: return False if logic.check_transitions(s, minimize=False, verbose=False) is not None: return False return True
def verify(s: Solver) -> None: old_count = utils.error_count prog = syntax.the_program a = prog.the_automaton() if a is None: if utils.args.automaton == 'only': utils.print_error_and_exit(None, "--automaton='only' requires the file to declare an automaton") elif utils.args.automaton != 'no': check_automaton_full(s, a) if utils.args.automaton != 'only': logic.check_init(s) logic.check_transitions(s) if utils.error_count == old_count: utils.logger.always_print('all ok!') else: utils.logger.always_print('program has errors.')
def verify(s: Solver) -> None: old_count = utils.error_count init_res = logic.check_init(s) tr_res = logic.check_transitions(s) res = init_res or tr_res if res is not None and utils.args.json: json_verify_result(res) if utils.error_count == old_count: utils.logger.always_print('all ok!') else: utils.logger.always_print('program has errors.')
def do_updr(s: Solver) -> None: if utils.args.use_z3_unsat_cores: z3.set_param('smt.core.minimize', True) logic.check_init(s, safety_only=True) if not utils.args.checkpoint_in: fs = updr.Frames(s) else: fs = updr.load_frames(utils.args.checkpoint_in, s) try: fs.search() except updr.AbstractCounterexample: pass finally: utils.logger.info( f'updr learned {fs.state_count} states (possibly with duplicates)') utils.logger.info( f'updr learned {len(fs.predicates)} predicates (no duplicates)')
def do_updr(s: Solver) -> None: if utils.args.use_z3_unsat_cores: z3.set_param('smt.core.minimize', True) if logic.check_init(s, safety_only=True, verbose=True) is not None: return if not utils.args.checkpoint_in: fs = updr.Frames(s) else: fs = updr.load_frames(utils.args.checkpoint_in, s) try: fs.search() print('updr found inductive invariant!') except updr.AbstractCounterexample: print('updr found abstract counterexample!') pass