wai-ops: the bounds pass, certificates from two certifiers, and the operator set's Kani harnesses (D2b) #221
Loading…
Reference in a new issue
No description provided.
Delete branch "wai/d2b-bounds"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
D2b of the integer operator set
wai-ops/1(extensions/integer-operators.md, Draft): load step 8, the bounds pass and its certificate, thewai-verifytool, certificates of every committed set from two certifiers, and the operator set's model-checker harnesses. Follows #206 (D2a).What is in it
wai_ops::bounds. §8.1–§8.5: 512-bit intervals with saturation per operation, each rule of §8.3, admissible ranges (§8.4), and the canonical certificate writer. Load step 8 is on, and theuncertifiedswitch is gone: the interpreter runs only a loaded graph, so nothing decodes a set its certificate does not admit.wai-verify(bounds,lower,vectors), folded from wai-ops' old binary, with--check,--witnessand--advise. The witness for photo's node 6 is a node-local graph whose input attainsconvT.acc's upper end.tools/wai_ops_check.py), written from the text alone, recomputes every certificate byte for byte.wai_ops::limb32. A reference model of the 32-bit fabric arithmetic foracc32's two products: the 16-bit-limb product, and the epilogue on two words with shifts that take their amount mod 32. Unit tests compare it withi64arithmetic, and K2 and K2b prove it.interp::run_observedreports every value under every key of Table 8.5-A;runis the same with an observer that compiles to nothing.bounds::Withinholds a run to its certificate. Every golden decode now runs observed and must stay inside its certified intervals.tests/trace.rsdoes the same for hand-built graphs at the edge ofacc64.evaldispatches to. The plan's shape rules are functionsop_sizesapplies.mans_decodechecks its bounds before it builds its tables; both are load checks with one refusal, so the order is not observable. The latent table build visits slots by index. The parser's zero check loops to a constant count. Every vector file, lowered graph and certificate is unchanged.wai-ops/src/proofs/, hosted bywai-verify, which includes wai-ops' modules at its root undercfg(kani)(results below).Certificates
wai.audio.int_codec132958122b25…wam1/1range, 47 bitswai.audio.int_codec8eca5bfdc1d8…wam1/1range, 53 bitswai.image.jpegai3e243dc11566…jpegai-int/1wai.image.jpegai60020d0657c4…jpegai-int/1wai.neural.int_hyper13e8b0d18e00…whm1/1range, 53 bitswai.neural.int_hyper7aceaa1aad14…whm1/1range, 52 bitswai.neural.int_hyperf16fd09cd79b…whm1/1range, 41 bitswai.neural.int_mlicpp07e1835da603…wmb1/1range, 54 bitswai.neural.int_mlicpp7ef44f3b1fc4…wmb1/1range, 47 bitswai.neural.int_synth00c2274be6b4…int_synth/1wai.neural.int_synth1c4705d17c01…int_synth/1wai.neural.int_synth21f092964e13…int_synth/1wai.neural.int_synth50868e72f5f1…int_synth/1convT.acc, 36 bitswai.neural.int_synth76916c8f85da…int_synth/1convT.acc, 33 bitswai.neural.int_synthb35460f39f31…int_synth/1convT.acc, 37 bits / synth node 2,convT.acc, 65 bitswai.neural.int_synthc6a362696d61…int_synth/1wai.splat.int_codec033a37c9d29d…whm1/1range, 44 bitswai.video.int_hyper13e8b0d18e00…whm1/1range, 53 bitswai.world.model34986fa89648…world/1range, 64 bitswai.world.model5291a52bdbf2…world/1range, 64 bitswai.world.modelda046216ff94…world/1range, 64 bitsThe verdicts match Appendix C. Photo first fails
acc32at node 6, withconvT.acc = [−25165614250, 26172239136](36 bits). EveryWHM1/WAM1/world set failsacc32at its input range, which by construction is the legacy guard (O1, O2).Independence
wai_ops_check.py(Python standard library only) shares no code with wai-ops. Its session read only Part 1. It rewrites every vector file and every lowered graph, and recomputes all 21 certificates byte for byte. The two external sets are recomputed with their files supplied: in this session locally, and in CI inwai-sota-vectors.ymlandwai-jpegai-e2e.yml.wai-ops.yml: Linux x86_64, Linux arm64, macOS arm64, and wasm32-wasip2 under wasmtime.Kani
Every harness was run alone, one at a time, with
CARGO_BUILD_JOBS=8. Most runs were on an idle 32-core host; a few early runs were on the dev Mac, then heavily loaded by other work. Times are Kani's verification time.Where a harness would have proved two multiplier, divider or
isqrtcircuits equal, or executed 512-bit arithmetic on symbolic operands, it does not close in bounded time. Those harnesses were restated:i128/i64(proofs/rules.rs). That the bounds pass computes those same rules is what the independent certifier shows, on every certificate.A harness whose window still did not close within its cap is gated by
cfg(kani_open). It is kept, with its statement, and runs only on request:RUSTFLAGS="--cfg kani_open" cargo kani --lib --exact --harness <name>. CI compiles only harnesses that verified.Verified (in CI):
k01_rq_is_its_definitionv,m, bias anyi64;s≤ 127; every rounding and bias placementk02_limb_combination_is_exact,…_partials_do_not_wrap,…_signsu32,i32,i64k02b_limb_epilogueacc32allows,s≤ 63, every rounding,postini32k03_rounding_is_its_definition,…_is_monotonei128p,s≤ 127k04_term_lies_in_its_interval;k04_partial_sums_lie_in_a(induction: base, and one step over every value, so any number of terms)i8terms; everyi32k05_chunked_i32_sumsi32k06_dot_lane_never_wrapsk09_conv_transpose_residues(one position reads one residue; with K4's lemma)y≤ 64,ph≤ 2,sh≤ 3k11_isqrt_is_monotone,k11_corner_hull_holds_products(with K3 and the first part, gated)u32;i8k12_largest_returns_the_maximum(every threshold);k12_p_leaky_is_monotone,k12_p_conv_is_monotoneu32, parameters inu8/u16k13_isqrt_u128_is_floor_sqrt;k13_isqrt_i512_is_floor_sqrt;k13_isqrt_ceil_i512_is_ceil_sqrtn< 2^32k14_leaky_bounds_sound_i8aini8,f≤ 63k15_lut16_index_is_total[−32767, 32767]; both one-past ends refusedk16_pixel_shuffle_is_a_bijection,k16_pixel_unshuffle_is_a_bijectionk17_exp_neg_q16_ranges_i32x∈ [−(2^31 − 1), 0]k19_sigmoid_ranges;k19_elu_ranges(certified α)i64v> −2^63; every interval and αk23_bucket_ceil_…,k23_bucket_floor_…k26_rans64_t2_is_totalk27_mans_bounds_are_unsignedk28_mans_entry_fieldsnext∈ [1, 511], every symbolk29_residual_step_32bit_identity_every_range;…_registered_rangesU8andI16k30_scale_index_in_range,k30_block_stat_in_range,k30_band_lookup_in_rangek32_sat_is_a_monotone_clamp;k32_xint_add_sub_neg_exact_at_the_saturation_edges±(2^255 − d),d< 2^16Did not close; gated by
cfg(kani_open)(cap 10 or 20 minutes, after the restatements above). The windows are the designed ones, and where a narrower one was also tried, that one too:conv_transposegather and phase forms against the kernel, four concrete shapes, a symbolic position) and K10 (igdnagainst the reference and the fast kernel; also one channel, one position). Covered by thegraphs/phasevectors, the igdn equivalence tests in wai-rs and the trace tests.gram,apply); K18 (softmax, W ≤ 4 and W ≤ 2); K20 (L1, ε below 2^31); K21 (L2, ε ≤ 2^20); K14 ati32andi16. For these, Kani proves the rules' lemmas (K4, K9, K11 above). The trace tests hold every value the interpreter forms, in every golden decode and on the extreme graphs, to its certified interval.p_igdn(512-bitisqrton symbolic operands), K17 at its full window (i64), K32's product at the edges.subposand pad/crop; K31 (WHG1parse, ≤ 96 bytes); K33 (run-time plan: conv, conv_transpose, multi-input).Retiring
int_transform's three harnesses (O14). Not done. O14 retires them once K18 and K20 pass, and neither closed at its window. They stay, as does SPEC's text about them.Harness defects found and fixed, not property failures:
No harness found a defect in wai-ops.
Falsification
Each fault went into a copy of the committed tree, with the harness run alone; each harness verified green on the unmodified tree at the same commit first.
limb32::combinedrops its second carryk02_limb_combination_is_exactroundbreaks ahalf_eventie toward oddk03_rounding_is_its_definitionrq_applynarrowsqtoi64before thepostbiask01_rq_is_its_definitionFor the certificate rows of Part 3.5,
wai-ops.ymlruns the two falsification sets on every leg: the overflow set must failacc64at load, and the set claimingacc32must fail it.Self-review
convT.acc's upper end. The extreme graphs (tests/trace.rs) and every golden decode run observed too, with no value outside its interval and no key the certificate does not record. Building them, two graphs I expected to certify were refused at load. The refusals were correct: a softmax spread of 2^63, and an elu α of −2^63. The tests now assert both refusals.wai-formal-verification.ymlis now seven shards by measured time. A first job (check_shards.py) holds the shards to covering every compiled harness exactly once. The path filter includeswai/wai-ops/src/**.wai-jpegai-e2e.yml, which fetches the bundle. The other two need assets that are not redistributable.limb32's unit tests andtests/trace.rsrun on everywai-ops.ymlleg, wasm32-wasip2 included. The witness test runs on the three native legs.wai-rs, nor any other conformance corpus, changes. The gate (build, lib tests, carriage, every corpus, fast kernels, byte-exact, wasm32, neural gates) is GREEN on this head.Checked on this head (
8f5e70c8, main at4ab66d24merged):wai-verifytests andvectors verify;cargo kani --libwith the shard's filters), on the idle host:check_shards.pyreports 56 harnesses in 7 shards, with 31 gated bycfg(kani_open)and in none.The wasm32-wasip2 run and
wai_ops_check.pywith both external sets ran at2419b914. Since then, the only wai-ops changes are undersrc/proofs/, compiled only undercfg(kani). The checker is unchanged.Main has since moved to
fe0282d6(#220). That change touches onlywai-weband its wasm workflow, none of this branch's files, and merges without conflict.The forge CI runs on this pull request.
🤖 Generated with Claude Code
5be238af, with D2a #206) into wai/d2b-bounds 93e15d74c83af82118, with #215–#217) into wai/d2b-bounds 2419b914034ab66d24, with #199, #201 and #219) into wai/d2b-bounds