Esempio n. 1
0
def test_insufficient():
    print('PSimple, testing insufficient components')
    p = Program()
    p.create_and_component()
    p.create_bvredor_component()
    p.create_ule_component()
    p.create_or_component()
    ProgramSynthesis(p, BVT.Psimple_dec,
                     'PSimple_insufficient').timed_synthesis()
Esempio n. 2
0
def test_P20():
    print('P20 program, determine if power of 2:')
    p = Program()
    p.create_decrement_component()
    p.create_and_component()
    p.create_bvredor_component()
    p.create_or_component()
    p.create_bitshiftright_component(BV_LENGTH - 1)
    ProgramSynthesis(p, BVT.P20, 'P20', timeout=20000).timed_synthesis()
def alternative_increment():
    ps = []
    p = Program(num_prog_inputs=1)
    # p.create_increment_component()
    p.create_bitshiftleft_component(1)
    p.create_bitshiftright_component(1)
    p.create_ule_component()
    p.create_ult_component()
    p.create_bvredor_component()
    p.create_and_component()
    p.create_add_component()
    oracle = BVT.Psimple_inc
    ps_short = ProgramSynthesis(p, oracle, 'P Simple')
    ps_short.find_shortest_program = True
    ps.append(ps_short)
    return ps
def shortestComparison_P20():
    ps = []
    p = Program(num_prog_inputs=1)
    p.create_decrement_component()
    p.create_bitshiftright_component(BV_LENGTH - 1)
    p.create_and_component()
    p.create_bvredor_component()
    p.create_or_component()
    p.create_and_component()
    p.create_add_component()
    oracle = BVT.P20
    ps_short = ProgramSynthesis(p, oracle, 'Shortest')
    ps_short.find_shortest_program = True
    ps.append(ps_short)
    ps_no_short = ProgramSynthesis(p, oracle, 'No Shortest')
    ps_no_short.find_shortest_program = False
    ps.append(ps_no_short)
    return ps