def P15():
    p = Program(num_prog_inputs=2)
    p.create_add_component()
    p.create_and_component()
    p.create_xor_component()
    p.create_bitshiftright_component(1)
    return ProgramSynthesis(p, BVT.P15, 'P15')
def test_P15():
    print('P15 program, floor of average of inputs, with debug printing:')
    p = Program(num_prog_inputs=2)
    p.create_add_component()
    p.create_and_component()
    p.create_xor_component()
    p.create_bitshiftright_component(1)
    timed_synthesis(p, BVT.P15, 100000, True)
Esempio n. 3
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()
Esempio n. 4
0
def test_P15():
    p = Program(num_prog_inputs=2)
    p.create_add_component()
    p.create_and_component()
    p.create_xor_component()
    p.create_bitshiftright_component(1)
    print('P15 program, floor of average of inputs, with debug printing:')
    ProgramSynthesis(p, BVT.P15, 'P15', timeout=20000,
                     print_debug=True).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_P21():
    ps = []
    p = Program(num_prog_inputs=1)
    p.create_negate_component()
    p.create_and_component()
    p.create_add_component()
    p.create_xor_component()
    p.create_add_component()
    p.create_bitshiftright_component(2)
    p.create_or_component()
    oracle = BVT.P21
    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
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