Compare the rule with concrete cases
Fictional allocation splits a nonnegative whole total into whole-number shares A and B. The intended invariant requires integer A≥0, integer B≥0 and A+B=total. Two good examples do not specify that requirement. A third pair with the right total but a negative share shows why total equality alone is incomplete.
| Total | A / B | Sum correct | Full invariant |
|---|---|---|---|
| 6 | 4 / 2 | Yes | Pass |
| 5 | 3 / 2 | Yes | Pass |
| 5 | 6 / −1 | Yes | Fail: negative B |
Work through the distinction
Examples make a requirement concrete; the invariant states what every permitted result must satisfy. It still does not choose a particular allocation policy.
Total is four and the result is A=2, B=1. What fails?
Show the worked answer
The shares are nonnegative but sum to three, one short. The total-preservation condition fails.
Acceptance wording to adapt
For every accepted allocation, require A and B to be nonnegative integers and A+B=input_total. Reject a result violating any condition. Use examples as cases, not a replacement for this general condition.