test(applied,dl): add verify_rig_axioms call sites for Z and Dual (#292) - #383
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #292.
verify_rig_axioms(catgraph-applied/src/rig.rs:772) had sweeps forBoolRig,F64Rig,Tropical,UnitInterval, andChecked<i64>, but never ran onZ(BigInt, backing SNF) orDual<T>(forward-mode AD) — both Rig carriers via the blanketimpl<T> Rig for T where T: Clone+PartialEq+Zero+One+Add<Output=T>+Mul<Output=T>.Change
catgraph-applied/src/rig.rs: addedverify_axioms_z_sample, sweepingZ::from(i64)samples (negative, zero, positive) through the existing nested-loop pattern.catgraph-dl/src/para/dual.rs(featuread): addedverify_axioms_dual_f64_sample, sweeping 11Dual<f64>samples (new/variable/constant/zero/one, 6 with nonzerodu) through the same pattern.Review (4 rounds,
rust-v2:falsifying-reviewer, perturb-in-copy)fb8426b→ae8e74b, the two call sites): no blocking/important. Two minors: (a) an epistemic limitation, not a defect — forZ, no single-line perturbation the reviewer tried isolated "additive associativity" or "absorbing zero" as the first-firing axiom (earlier-ordered checks always fired first); recorded here as a disclosed limitation of the check-order +.unwrap()-on-first-failure mechanism, not something a test edit can fix. (b) theDual<f64>sample set was thin on nonzero-ducoverage (3/8) — a Mul-cross-term bug's detection rested on one data point. (b) applied inf2b5fc6(8→11 samples, 3→6 nonzero-du).ae8e74b→f2b5fc6delta): confirmed the widened set independently redundant (both the old-3 and new-3 nonzero-dusubsets catch the perturbation on their own, with distinct witnesses). One important finding: the catch mechanism is narrower than "cross-term margin" framing implies —verify_rig_axiomsaborts on the first failing axiom in a fixed order, so any Mul-formula bug that also breaks the multiplicative-identity axiom is caught there, never via associativity/distributivity between two nonzero-duoperands. Documented in903c275.903c275→640dc67delta): the round-2 doc comment's "always caught via identity" was itself falsified — a Mul corruption that stays isomorphic to a valid Rig (e.g. folding anε²contamination term into both channels, makingDual<f64>isomorphic toR×R) satisfies every rig axiom and passes undetected;verify_rig_axiomsis a rig-axiom oracle, not a chain-rule oracle. Narrowed the claim and named the blind spot in640dc67.640dc67delta): no findings — the narrowed wording held up against the same class of falsification (3 independently-constructed isomorphic-to-a-valid-Rig corruptions, all correctly missed; 2 independently-constructed genuine rig-law breaks, both correctly caught). Converged.Every perturbation round ran in a throwaway
cp -rcopy with its own--target-dir; the worktree stayed clean throughout (git status --porcelainempty before/after each round).Gates (worktree)
cargo nextest run -p catgraph-applied(--target-dir /tmp/cargo/catgraph-G5-T3): 669 passed, 0 failed, 12 skippedcargo test -p catgraph-dl --features ad(nextest skips doctests;Dual's doc example is a live doctest): 121 passed + 12 doctests passed, 8 ignored, 0 failedcargo clippy --all-targets -- -D warnings: clean oncatgraph-applied(default,--no-default-features) andcatgraph-dl(default,--features ad)RUSTDOCFLAGS="-D warnings" cargo doc -p catgraph-applied -p catgraph-dl --features ad --no-deps: cleancargo fmt --all --check: cleanscripts/check_measured_claims.py/scripts/check_audit_counts.py: not applicable — diff carries noMEASUREDmarkers and touches no audit doc🤖 Generated with Claude Code