Skip to content
Astera Technology

Write a preservation rule beyond a few good examples

Turn observed examples into a checkable invariant without claiming universal proof.

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.

Filled synthetic modelling cases
TotalA / BSum correctFull invariant
64 / 2YesPass
53 / 2YesPass
56 / −1YesFail: negative B
Download editable CSV ↓

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.

Related resources