Example #1
0
def k_induction_attempt_inductive():
    # Create an smt_switch.SmtSolver with Boolector as the backend
    # and no logging
    s = ss.create_btor_solver(False)
    s.set_opt('produce-models', 'true')
    s.set_opt('incremental', 'true')
    prop, fts = build_simple_alu_fts(s)

    # store sets of states in a dictionary for accessing below
    states = {str(sv): sv for sv in fts.statevars}

    # make the property inductive manually
    prop = pono.Property(
        s,
        s.make_term(
            And,
            s.make_term(Equal, states['cfg'],
                        s.make_term(0, s.make_sort(BV, 1))), prop.prop))

    print(
        '\n============== Running k-induction on inductively strengthened property =============='
    )
    print('INIT\n\t{}'.format(fts.init))
    print('TRANS\n\t{}'.format(fts.trans))
    print('PROP\n\t{}'.format(prop.prop))

    # Create KInduction engine -- using same solver (in future can change the solver)
    kind = pono.KInduction(prop, fts, s)
    res = kind.check_until(20)

    print(res)

    assert res is True, "Expecting k-induction to prove the inductively strengthened property"
    print("KInduction returned true")
Example #2
0
def test_kind(create_solver):
    s = create_solver(False)
    s.set_opt('produce-models', 'true')
    s.set_opt('incremental', 'true')
    prop = build_simple_alu_fts(s)

    kind = c.KInduction(prop, s)
    res = kind.check_until(10)

    assert res is None, "KInduction shouldn't be able to solve this property"
Example #3
0
 def process_guarantees(self, solver, rts, at_end_state_flag, ports):
     for i, guarantee in enumerate(self.guarantees):
         prop = pono.Property(
             rts,
             solver.make_term(
                 Implies,
                 at_end_state_flag,
                 guarantee.value(solver, ports)
             )
         )
         interp = pono.KInduction(prop, solver)
         assert interp.check_until(10), interp.witness()
Example #4
0
def test_kind_inductive_prop(create_solver):
    s = create_solver(False)
    s.set_opt('produce-models', 'true')
    s.set_opt('incremental', 'true')
    prop = build_simple_alu_fts(s)

    states = {str(sv): sv for sv in prop.transition_system.statevars}

    prop = c.Property(
        prop.transition_system,
        s.make_term(
            And,
            s.make_term(Equal, states['cfg'],
                        s.make_term(0, s.make_sort(BV, 1))), prop.prop))

    kind = c.KInduction(prop, s)
    res = kind.check_until(10)

    assert res is True, "KInduction should be able to solve this manually strengthened property"
Example #5
0
def k_induction_attempt():
    # Create an smt_switch.SmtSolver with Boolector as the backend
    # and no logging
    s = ss.create_btor_solver(False)
    s.set_opt('produce-models', 'true')
    s.set_opt('incremental', 'true')
    prop, fts = build_simple_alu_fts(s)

    print('\n============== Running k-induction ==============')
    print('INIT\n\t{}'.format(fts.init))
    print('TRANS\n\t{}'.format(fts.trans))
    print('PROP\n\t{}'.format(prop.prop))

    # Create KInduction engine -- using same solver (in future can change the solver)
    kind = pono.KInduction(prop, fts, s)
    res = kind.check_until(20)

    print(res)

    assert res is None, "Expecting k-induction not to prove property in 20 steps"
    print("KInduction returned unknown")