コード例 #1
0
 def emission(self):
     """Sending a message must be preceded by observation of its ins,
        but cannot be preceded by observation of any nils or outs"""
     s = partial(observe, self.sender)
     ins = [impl(self.sent, sequential(s(p), self.sent))
            for p in self.ins]
     nils = [impl(and_(self.sent, s(p)), sequential(self.sent, s(p)))
             for p in self.nils]
     outs = [impl(self.sent, simultaneous(s(p), self.sent))
             for p in self.outs]
     return and_(*(ins + nils + outs))
コード例 #2
0
 def reception(self):
     "Each message reception is accompanied by the observation of its parameters; either they are observed, or the message itself is not"
     clauses = [impl(self.received,
                     or_(sequential(p, self.received),
                         simultaneous(p, self.received)))
                for p in map(partial(observe, self.recipient), self.ins | self.outs)]
     return and_(*clauses)
コード例 #3
0
 def blocked(self):
     s = partial(observe, self.sender)
     ins = [~s(p) for p in self.ins]
     nils = [and_(s(p), ~(sequential(s(p), self.sent) |
                          simultaneous(s(p), self.sent))) for p in self.nils]
     outs = [s(p) for p in self.outs]
     return or_(*(nils + outs + ins))
コード例 #4
0
 def _complete(self):
     "Each out parameter must be observed by at least one role"
     clauses = []
     for p in self.outs:
         clauses.append(or_(*[m.received for m in self.p_cover(p)
                              if m.parameters[p].adornment is 'out']))
     return and_(*clauses)
コード例 #5
0
ファイル: bspl.py プロジェクト: SucreRouge/protocheck
 def maximal(self):
     "Each message must be sent, or it must be blocked by a prior binding"
     clauses = []
     for m in self.messages.values():
         clauses.append(m.sent | m.blocked)
     return and_(*clauses)
コード例 #6
0
ファイル: bspl.py プロジェクト: SucreRouge/protocheck
 def _enactable(self):
     "Some message must be received containing each parameter"
     clauses = []
     for p in self.public_parameters:
         clauses.append(or_(*[m.received for m in self.p_cover(p)]))
     return and_(*clauses)