Ejemplo n.º 1
0
    def toYicesTerms():

        retval = []

        for i in range(0, Configuration.bot_count):
            retval.append(
                Terms.eq(
                    Terms.application(YicesSignature.b_op,
                                      [YicesSignature.integer(i)]),
                    YicesSignature.thing_map[SymbolTable.bot_name(i)]))
            #sb.append(f'(assert (= (b {i}) b{i}))\n')

        for i in range(0, Configuration.pt2_count):
            x = i / Configuration.grid_dimension[1]
            y = i % Configuration.grid_dimension[1]
            retval.append(
                Terms.eq(
                    Terms.application(
                        YicesSignature.pt_op,
                        [YicesSignature.integer(x),
                         YicesSignature.integer(y)]),
                    YicesSignature.pt2_map[SymbolTable.pt2_name(i)]))

            #sb.append(f'(assert (= (pt {x} {y}) pt_{x}_{y}))\n')

        return retval
Ejemplo n.º 2
0
 def get_yices_op(name):
     yices_term = None
     # treat abs a bit differently because it maps directly to a yices op, just like the infix ops.
     if name == SymbolTable.ABS:
         op_term = YicesSignature.op_map[name]
         yices_term = lambda args: op_term(args[0])
     elif name in YicesSignature.op_map:
         op_term = YicesSignature.op_map[name]
         yices_term = lambda args: Terms.application(op_term, args)
     elif name in SymbolTable.binop_map:
         yices_term = lambda args: SymbolTable.binop_map[name](args[0], args[1])
     elif name in SymbolTable.infix_map:
         yices_term = lambda args: SymbolTable.infix_map[name](args[0], args[1])
     assert yices_term is not None
     return yices_term
Ejemplo n.º 3
0
    def mktreatstage(pt, stage, timestamp):

        pt_term = YicesSignature.pt2_map.get(pt, None)
        if pt_term is None:
            sys.stderr.write('assert_atloc: no pt called {0}\n'.format(pt))
            return None

        stage_term = YicesSignature.integer(stage)

        time_term = YicesSignature.integer(timestamp)

        application = Terms.application(YicesSignature.treatstage_op, [pt_term, stage_term, time_term])
        if application is None:
            sys.stderr.write('assert_atloc: Terms.application failed {0}\n'.format(Yices.error_string()))
            return None

        return application
Ejemplo n.º 4
0
    def mkatloc(bot, pt, timestamp):

        bot_term = YicesSignature.thing_map.get(bot, None)
        if bot_term is None:
            sys.stderr.write('mkatloc: no bot called {0}\n'.format(bot))
            return None

        pt_term = YicesSignature.pt2_map.get(pt, None)
        if pt_term is None:
            sys.stderr.write('mkatloc: no pt called {0}\n'.format(pt))
            return None

        time_term = YicesSignature.integer(timestamp)

        application = Terms.application(YicesSignature.atloc_op, [bot_term, pt_term, time_term])
        if application is None:
            sys.stderr.write('mkatloc: Terms.application failed {0}\n'.format(Yices.error_string()))
            return None

        return application