Contract Entailment. Contract entailment is a relation ≤ such that, when c ≤ d holds, each value that satisfies c can be used where a value that satisfies d is expected. When c and d are flat contracts, ≤ boils down to the set-theoretic inclusion between the values that satisfy the respective predicates. For example, flat_c (≥ 3) ≤ flat_c (≥ 0) since every number greater than or equal to 3 is also greater than or equal to 0. To define entailment when c and d are session contracts, it helps to recall the analogy of contracts as specifications for the messages that can be sent on and received from a session endpoint. In this case, c ≤ d holds if two conditions are satisfied: 1. Every message that can be received from an endpoint satisfying c can also be received from an endpoint satisfying d. 2. Every message that can be sent on an endpoint satisfying d can also be sent on an endpoint satisfying c. Note that c and d occur in different orders according to the direction of exchanged messages. With these intuitions, we formalize entailment below: Definition 5 (contract entailment). We say that e1 entails e2, written e1 ≤ e2, if one of following conditions holds: 1. e1 ⇓ flat_c w1 and e2 ⇓ flat_c w2 and v ∈ w1 implies v ∈ w2;
Appears in 2 contracts
Sources: Chaperone Contracts for Higher Order Sessions, Chaperone Contracts for Higher Order Sessions
Contract Entailment. Contract entailment is a relation ≤ such that, when c ≤ d holds, each value that satisfies c can be used where a value that satisfies d is expected. When c and d are flat contracts, ≤ boils down to the set-theoretic inclusion between the values that satisfy the respective predicates. For example, flat_c (≥ 3) ≤ flat_c (≥ 0) since every number greater than or equal to 3 is also greater than or equal to 0. To define entailment when c and d are session contracts, it helps to recall the analogy of contracts as specifications for the messages that can be sent on and received from a session endpoint. In this case, c ≤ d holds if two conditions are satisfied:
1. Every message that can be received from an endpoint satisfying c can also be received from an endpoint satisfying d.
2. Every message that can be sent on an endpoint satisfying d can also be sent on an endpoint satisfying c. Note that c and d occur in different orders according to the direction of exchanged messages. With these intuitions, we formalize entailment below: Definition 5 (contract entailment). We say that e1 entails e2, written e1 ≤ e2, if one of following conditions holds:
1. e1 ⇓ flat_c w1 and e2 ⇓ flat_c w2 and v ∈ w1 implies v ∈ w2w2;
2. e1 ⇓ end_c and e2 ⇓ end_c;
3. e1 ⇓ !c1;d1 and e2 ⇓ !c2;d2 and c2 ≤ c1 and d1 ≤ d2;
Appears in 1 contract