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_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 P7():
    p = Program()
    p.create_increment_component()
    p.create_and_component()
    p.create_or_component()
    p.create_not_component()
    p.create_add_component()
    p.create_xor_component()
    return ProgramSynthesis(p, BVT.P7, 'P7')
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_P1():
    ps = []
    p = Program()
    p.create_decrement_component()
    p.create_and_component()
    p.create_xor_component()
    p.create_xor_component()
    p.create_decrement_component()
    p.create_add_component()
    oracle = BVT.P1
    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_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
def shortestComparison_P16():
    ps = []
    p = Program(num_prog_inputs=2)
    p.create_xor_component()
    p.create_xor_component()
    p.create_and_component()
    p.create_negate_component()
    p.create_ule_component()
    p.create_and_component()
    p.create_add_component()
    oracle = BVT.P16
    ps_short = ProgramSynthesis(p, oracle, 'Find Shortest')
    ps_short.find_shortest_program = True
    ps.append(ps_short)
    ps_no_short = ProgramSynthesis(p, oracle, 'No Find Shortest')
    ps_no_short.find_shortest_program = False
    ps.append(ps_no_short)
    return ps