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))
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)
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))
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)
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)
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)