Example #1
0
 def _assert(self, modelset, i):
     # model is a function from g,a to bool (as an array)
     g = new_graph('g')
     a = new_action('a')
     subpredicate = self.atomic._assert(model_from(g, a), i)
     import pdb; pdb.set_trace()
     return z3.ForAll([g, a], subpredicate)
Example #2
0
    def _assert(self, modelset, i, g, a):
        g = new_graph('g')
        a = new_action('a')
        s = new_modelset('s')
        t = new_modelset('t')

        def is_plus(alpha, beta, a):
            # Assert that alpha + beta = a. All of these are Actions.
            # This is defined in Definition 2 of the L paper, on page 5.
            # TODO: implement this once you have a clear API for Action.
            pass

        def is_join(modelset, s, t, g, a):
            # Assert that modelset behaves, on inputs g and a, like s "joined" with t.
            # "joined" is the |><| operator.
            alpha = Action('alpha')
            beta = Action('beta')
            return z3_helpers.Iff(
                has(modelset, g, a), z3.Exists(alpha, beta),
                z3.And(has(s, g, alpha), has(t, g, beta),
                       is_plus(alpha, beta, a)))

        return z3.ForAll([g, a],
                         z3.And(self.p1._assert(s, i, g, a),
                                self.p2._assert(t, i, g, a),
                                is_join(modelset, s, t, g, a)))
Example #3
0
 def _assert(self, modelset, i):
     g = new_graph('g')
     a = new_action('a')
     s = new_modelset('s')
     return z3.Exists([s], z3.ForAll([g, a],
             z3.And(self.pred._assert(s, i),
                 z3_helpers.Iff(has(modelset, g, a), z3.Not(s(g, a))))))
Example #4
0
 def _assert(self, modelset, i):
     g = new_graph('g')
     a = new_action('a')
     s = new_modelset('s')
     t = new_modelset('t')
     return z3.Exists([s, t], z3.ForAll([g, a],
             z3.And(self.p1._assert(s, i), self.p2._assert(t, i),
                 z3_helpers.Iff(has(modelset, g, a), z3.And(has(s, g, a),
                                                            has(t, g, a))))))
Example #5
0
    def _assert(self, modelset, i):
        g = new_graph('g')
        a = new_action('a')
        s = new_modelset('s')
        t = new_modelset('t')

        def is_plus(alpha, beta, a):
            # Assert that alpha + beta = a. All of these are Actions.
            # This is defined in Definition 2 of the L paper, on page 5.
            # TODO: implement this once you have a clear API for Action.
            pass

        def is_join(modelset, s, t, g, a):
            # Assert that modelset behaves, on inputs g and a, like s "joined" with t.
            # "joined" is the |><| operator.
            alpha = Action('alpha')
            beta = Action('beta')
            return z3_helpers.Iff(has(modelset, g, a),
                       z3.Exists(alpha, beta),
                       z3.And(has(s, g, alpha), has(t, g, beta), is_plus(alpha, beta, a)))

        return z3.Exists([s, t], z3.ForAll([g, a],
                z3.And(self.p1._assert(s, i), self.p2._assert(t, i),
                    is_join(modelset, s, t, g, a))))
Example #6
0
def model_from(g, a):
    return Model.model(g, a, new_graph('postgraph'))
Example #7
0
def has(modelset, g, a):
    postgraph = new_graph('postgraph')
    return z3.Exists([postgraph], modelset(Model.model(g, a, postgraph)))
Example #8
0
 def _assert(self, modelset, i, g, a):
     g = new_graph('g')
     a = new_action('a')
     return z3.Exists([g, a], self.pred._assert(modelset, i, g, a))
Example #9
0
 def _assert(self, modelset, i, g, a):
     g = new_graph('g')
     a = new_action('a')
     return z3.Exists([g, a], self.pred._assert(modelset, i, g, a))
Example #10
0
def model_from(g, a):
    return Submodel(g, a, new_graph('postgraph'))
Example #11
0
def has(modelset, g, a):
    postgraph = new_graph('postgraph')
    return z3.Exists([postgraph], modelset(Model.model(g, a, postgraph)))