class v5 shadow rule test: the scan is over the candidate draw at attempt 0 (the full draw costs seconds per candidate under the 2^20 ratio pass; the first form ran over an hour on box 2)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
igneum-labs 2026-10-07 20:37:52 +00:00
parent 510c90a860
commit 87d16e8830

View file

@ -2031,22 +2031,26 @@ mod tests {
bad.push(mk(Op::Or, 3, 5));
}
assert!(shadow_removable_count(&bad) * 1000 > bad.len() * SHADOW_REMOVABLE_MAX_PERMILLE, "a block of or-idempotent pairs is over the bound");
// The scan is over the shadow DRAW (the candidate at attempt 0 of each class, no acceptance run): a full draw
// under class v4 or v5 costs seconds per candidate (the 2^20 ratio pass over 64 + 256 x 27 instructions per
// evaluation), and the first form of this scan, 6,000 seeds x two full draws, ran for over an hour on box 2
// (7 October 2026, 21:4x UK). The redraw rule lives in the candidate draw, so the candidate is where it shows.
let era = [7u8; 32];
let v5_class = LoadClass::era(V5_CLASS, &era, &V3_ALLOWED);
let v4_class = LoadClass::era(V4_CLASS, &era, &V3_ALLOWED);
let mut redrawn = 0;
let mut scanned = 0;
for i in 0..6_000u32 {
let seed = format!("igneum-shadow-scan/{i}");
let v5 = generate_from_seed_bytes_program_class(&seed, seed.as_bytes(), ProgramClass::V5, Some(&era));
let v5 = candidate_class(&seed, seed.as_bytes(), 0, v5_class);
assert!(shadow_removable_count(&v5.shadow) * 1000 <= v5.shadow.len() * SHADOW_REMOVABLE_MAX_PERMILLE, "{seed}: a v5 block over the bound");
let v4 = generate_from_seed_bytes_program_class(&seed, seed.as_bytes(), ProgramClass::V4, Some(&era));
let v4 = candidate_class(&seed, seed.as_bytes(), 0, v4_class);
if v5.shadow == v4.shadow {
assert_eq!(v5.instrs, v4.instrs, "{seed}: an unredrawn seed is the amended v4 draw for draw");
} else {
// the acceptance rules read the shadow (the freshness fixpoint), so a redrawn block can move the accepted
// attempt and with it the base program; what must hold is that the first v4 block was over the bound
// the first v4 block was over the bound and the rule redrew it from the continuing stream
redrawn += 1;
let first = candidate_class(&seed, seed.as_bytes(), v4.attempt, v4.class);
assert!(shadow_removable_count(&first.shadow) * 1000 > first.shadow.len() * SHADOW_REMOVABLE_MAX_PERMILLE || v5.attempt != v4.attempt, "{seed}: v5 redrew a block the rule admits");
assert!(shadow_removable_count(&v4.shadow) * 1000 > v4.shadow.len() * SHADOW_REMOVABLE_MAX_PERMILLE, "{seed}: v5 redrew a block the rule admits");
}
scanned += 1;
if redrawn >= 2 && scanned >= 1_000 {