FA-97391 / Knitting and sewing pattern grading / Open access
Sleeve taper decrease schedule: decrease pair count · case 01
A 16-stitch taper is scheduled as 16 decrease rows, removing 32 stitches.
ROOT CAUSE
Each decrease row removes two stitches but pairs counts single stitches.
VERIFIED REPAIR
Use half the stitch difference as the number of decrease rows.
Unsuccessful approach: Subtracting a setup decrease leaves the sleeve two stitches too wide.
Case contract
Top-down sleeve from upper_sts to cuff_sts, decreasing 2 stitches per decrease row within rows rows. Errors: cuff wider ("error: cuff wider than upper arm"), odd difference ("error: odd difference"), rows fewer than decrease rows ("error: not enough rows"). pairs = difference/2; a = rows // pairs; y = rows - a*pairs decreases every a+1 rows, x = pairs-y every a rows. Return [[a, x], [a+1, y]] omitting a zero count; [] for no decreases.
Why this case matters
Pattern writers turn a stitch-count change over a length into "decrease every N rows X times".
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(cuff_sts, upper_sts, rows):
diff = upper_sts - cuff_sts
if diff < 0:
return 'error: cuff wider than upper arm'
if diff % 2:
return 'error: odd difference'
pairs = diff
if pairs == 0:
return []
a = rows // pairs
if a == 0:
return 'error: not enough rows'
y = rows - a * pairs
x = pairs - y
plan = []
if x:
plan.append([a, x])
if y:
plan.append([a + 1, y])
return plan
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['even schedule', [48, 64, 80], [[10, 8]]], ['two rates', [44, 60, 90], [[11, 6], [12, 2]]],
['odd difference', [48, 53, 60], 'error: odd difference'],
['regression: decrease pair count', [50, 62, 10], [[1, 2], [2, 4]]],
['repair check: decrease pair count', [45, 45, 5], []], ['generated control 1', [60, 62, 40], [[40, 1]]],
['generated control 2', [56, 61, 5], 'error: odd difference'],
['generated control 3', [60, 65, 72], 'error: odd difference']],
[['two rates', [44, 60, 90], [[11, 6], [12, 2]]], ['odd difference', [48, 53, 60], 'error: odd difference'],
['too few rows', [40, 70, 10], 'error: not enough rows'],
['regression: decrease pair count', [56, 72, 90], [[11, 6], [12, 2]]],
['repair check: decrease pair count', [56, 64, 72], [[18, 4]]], ['generated control 1', [40, 40, 5], []],
['generated control 2', [40, 45, 60], 'error: odd difference'], ['generated control 3', [60, 60, 5], []]],
[['odd difference', [48, 53, 60], 'error: odd difference'],
['too few rows', [40, 70, 10], 'error: not enough rows'],
['cuff wider', [60, 50, 60], 'error: cuff wider than upper arm'],
['regression: decrease pair count', [60, 90, 90], [[6, 15]]],
['repair check: decrease pair count', [45, 69, 60], [[5, 12]]], ['generated control 1', [45, 45, 90], []],
['generated control 2', [60, 84, 40], [[3, 8], [4, 4]]], ['generated control 3', [60, 76, 72], [[9, 8]]]],
[['too few rows', [40, 70, 10], 'error: not enough rows'],
['cuff wider', [60, 50, 60], 'error: cuff wider than upper arm'],
['even schedule', [48, 64, 80], [[10, 8]]], ['regression: decrease pair count', [50, 58, 40], [[10, 4]]],
['repair check: decrease pair count', [56, 86, 40], [[2, 5], [3, 10]]],
['generated control 1', [48, 78, 100], [[6, 5], [7, 10]]],
['generated control 2', [50, 66, 100], [[12, 4], [13, 4]]],
['generated control 3', [56, 61, 40], 'error: odd difference']],
[['cuff wider', [60, 50, 60], 'error: cuff wider than upper arm'],
['even schedule', [48, 64, 80], [[10, 8]]], ['two rates', [44, 60, 90], [[11, 6], [12, 2]]],
['regression: decrease pair count', [48, 64, 60], [[7, 4], [8, 4]]],
['repair check: decrease pair count', [56, 86, 60], [[4, 15]]],
['generated control 1', [45, 52, 100], 'error: odd difference'],
['generated control 2', [51, 75, 5], 'error: not enough rows'],
['generated control 3', [48, 50, 60], [[60, 1]]]]]
for label, args, expected in fixtures[N - 1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| even schedule | [[5, 16]] | [[10, 8]] | Failed |
| two rates | [[5, 6], [6, 10]] | [[11, 6], [12, 2]] | Failed |
| odd difference | error: odd difference | error: odd difference | Passed |
| regression: decrease pair count | error: not enough rows | [[1, 2], [2, 4]] | Failed |
| repair check: decrease pair count | [] | [] | Passed |
| generated control 1 | [[20, 2]] | [[40, 1]] | Failed |
| generated control 2 | error: odd difference | error: odd difference | Passed |
| generated control 3 | error: odd difference | error: odd difference | Passed |
SHA-256 / 1b83202c0254f54851728afaaa07d7af92d00fee54d382144b060c30ccafe25b
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(cuff_sts, upper_sts, rows):
diff = upper_sts - cuff_sts
if diff < 0:
return 'error: cuff wider than upper arm'
if diff % 2:
return 'error: odd difference'
pairs = (diff - 2) // 2
if pairs == 0:
return []
a = rows // pairs
if a == 0:
return 'error: not enough rows'
y = rows - a * pairs
x = pairs - y
plan = []
if x:
plan.append([a, x])
if y:
plan.append([a + 1, y])
return plan
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['even schedule', [48, 64, 80], [[10, 8]]], ['two rates', [44, 60, 90], [[11, 6], [12, 2]]],
['odd difference', [48, 53, 60], 'error: odd difference'],
['regression: decrease pair count', [50, 62, 10], [[1, 2], [2, 4]]],
['repair check: decrease pair count', [45, 45, 5], []], ['generated control 1', [60, 62, 40], [[40, 1]]],
['generated control 2', [56, 61, 5], 'error: odd difference'],
['generated control 3', [60, 65, 72], 'error: odd difference']],
[['two rates', [44, 60, 90], [[11, 6], [12, 2]]], ['odd difference', [48, 53, 60], 'error: odd difference'],
['too few rows', [40, 70, 10], 'error: not enough rows'],
['regression: decrease pair count', [56, 72, 90], [[11, 6], [12, 2]]],
['repair check: decrease pair count', [56, 64, 72], [[18, 4]]], ['generated control 1', [40, 40, 5], []],
['generated control 2', [40, 45, 60], 'error: odd difference'], ['generated control 3', [60, 60, 5], []]],
[['odd difference', [48, 53, 60], 'error: odd difference'],
['too few rows', [40, 70, 10], 'error: not enough rows'],
['cuff wider', [60, 50, 60], 'error: cuff wider than upper arm'],
['regression: decrease pair count', [60, 90, 90], [[6, 15]]],
['repair check: decrease pair count', [45, 69, 60], [[5, 12]]], ['generated control 1', [45, 45, 90], []],
['generated control 2', [60, 84, 40], [[3, 8], [4, 4]]], ['generated control 3', [60, 76, 72], [[9, 8]]]],
[['too few rows', [40, 70, 10], 'error: not enough rows'],
['cuff wider', [60, 50, 60], 'error: cuff wider than upper arm'],
['even schedule', [48, 64, 80], [[10, 8]]], ['regression: decrease pair count', [50, 58, 40], [[10, 4]]],
['repair check: decrease pair count', [56, 86, 40], [[2, 5], [3, 10]]],
['generated control 1', [48, 78, 100], [[6, 5], [7, 10]]],
['generated control 2', [50, 66, 100], [[12, 4], [13, 4]]],
['generated control 3', [56, 61, 40], 'error: odd difference']],
[['cuff wider', [60, 50, 60], 'error: cuff wider than upper arm'],
['even schedule', [48, 64, 80], [[10, 8]]], ['two rates', [44, 60, 90], [[11, 6], [12, 2]]],
['regression: decrease pair count', [48, 64, 60], [[7, 4], [8, 4]]],
['repair check: decrease pair count', [56, 86, 60], [[4, 15]]],
['generated control 1', [45, 52, 100], 'error: odd difference'],
['generated control 2', [51, 75, 5], 'error: not enough rows'],
['generated control 3', [48, 50, 60], [[60, 1]]]]]
for label, args, expected in fixtures[N - 1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| even schedule | [[11, 4], [12, 3]] | [[10, 8]] | Failed |
| two rates | [[12, 1], [13, 6]] | [[11, 6], [12, 2]] | Failed |
| odd difference | error: odd difference | error: odd difference | Passed |
| regression: decrease pair count | [[2, 5]] | [[1, 2], [2, 4]] | Failed |
| repair check: decrease pair count | [[-5, -1]] | [] | Failed |
| generated control 1 | [] | [[40, 1]] | Failed |
| generated control 2 | error: odd difference | error: odd difference | Passed |
| generated control 3 | error: odd difference | error: odd difference | Passed |
SHA-256 / 4c710b68d2e5167eccab7c2f58f5468c523565b5df5dea87a68f8ee7a7995327
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import math
from fractions import Fraction
N = 1
observations = []
def solve(cuff_sts, upper_sts, rows):
diff = upper_sts - cuff_sts
if diff < 0:
return 'error: cuff wider than upper arm'
if diff % 2:
return 'error: odd difference'
pairs = diff // 2
if pairs == 0:
return []
a = rows // pairs
if a == 0:
return 'error: not enough rows'
y = rows - a * pairs
x = pairs - y
plan = []
if x:
plan.append([a, x])
if y:
plan.append([a + 1, y])
return plan
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['even schedule', [48, 64, 80], [[10, 8]]], ['two rates', [44, 60, 90], [[11, 6], [12, 2]]],
['odd difference', [48, 53, 60], 'error: odd difference'],
['regression: decrease pair count', [50, 62, 10], [[1, 2], [2, 4]]],
['repair check: decrease pair count', [45, 45, 5], []], ['generated control 1', [60, 62, 40], [[40, 1]]],
['generated control 2', [56, 61, 5], 'error: odd difference'],
['generated control 3', [60, 65, 72], 'error: odd difference']],
[['two rates', [44, 60, 90], [[11, 6], [12, 2]]], ['odd difference', [48, 53, 60], 'error: odd difference'],
['too few rows', [40, 70, 10], 'error: not enough rows'],
['regression: decrease pair count', [56, 72, 90], [[11, 6], [12, 2]]],
['repair check: decrease pair count', [56, 64, 72], [[18, 4]]], ['generated control 1', [40, 40, 5], []],
['generated control 2', [40, 45, 60], 'error: odd difference'], ['generated control 3', [60, 60, 5], []]],
[['odd difference', [48, 53, 60], 'error: odd difference'],
['too few rows', [40, 70, 10], 'error: not enough rows'],
['cuff wider', [60, 50, 60], 'error: cuff wider than upper arm'],
['regression: decrease pair count', [60, 90, 90], [[6, 15]]],
['repair check: decrease pair count', [45, 69, 60], [[5, 12]]], ['generated control 1', [45, 45, 90], []],
['generated control 2', [60, 84, 40], [[3, 8], [4, 4]]], ['generated control 3', [60, 76, 72], [[9, 8]]]],
[['too few rows', [40, 70, 10], 'error: not enough rows'],
['cuff wider', [60, 50, 60], 'error: cuff wider than upper arm'],
['even schedule', [48, 64, 80], [[10, 8]]], ['regression: decrease pair count', [50, 58, 40], [[10, 4]]],
['repair check: decrease pair count', [56, 86, 40], [[2, 5], [3, 10]]],
['generated control 1', [48, 78, 100], [[6, 5], [7, 10]]],
['generated control 2', [50, 66, 100], [[12, 4], [13, 4]]],
['generated control 3', [56, 61, 40], 'error: odd difference']],
[['cuff wider', [60, 50, 60], 'error: cuff wider than upper arm'],
['even schedule', [48, 64, 80], [[10, 8]]], ['two rates', [44, 60, 90], [[11, 6], [12, 2]]],
['regression: decrease pair count', [48, 64, 60], [[7, 4], [8, 4]]],
['repair check: decrease pair count', [56, 86, 60], [[4, 15]]],
['generated control 1', [45, 52, 100], 'error: odd difference'],
['generated control 2', [51, 75, 5], 'error: not enough rows'],
['generated control 3', [48, 50, 60], [[60, 1]]]]]
for label, args, expected in fixtures[N - 1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| even schedule | [[10, 8]] | [[10, 8]] | Passed |
| two rates | [[11, 6], [12, 2]] | [[11, 6], [12, 2]] | Passed |
| odd difference | error: odd difference | error: odd difference | Passed |
| regression: decrease pair count | [[1, 2], [2, 4]] | [[1, 2], [2, 4]] | Passed |
| repair check: decrease pair count | [] | [] | Passed |
| generated control 1 | [[40, 1]] | [[40, 1]] | Passed |
| generated control 2 | error: odd difference | error: odd difference | Passed |
| generated control 3 | error: odd difference | error: odd difference | Passed |
SHA-256 / 819a57ee5e56f722c3875a159c8916c761656457b716a66171217280746e920e
Verification & scope
A deterministic toy contract stated in full here; it is a bounded teaching model, not an authoritative reference or standards implementation. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:52:31.737819+00:00.
Case digest / b5205d37dc4c07dd9167eab450c138eede6079cda3e9b8c4251bcd2d344bd3d7