Ejemplo n.º 1
0
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.')
Ejemplo n.º 2
0
    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
Ejemplo n.º 3
0
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.')
Ejemplo n.º 4
0
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.')