Skip to content

test(applied,dl): add verify_rig_axioms call sites for Z and Dual (#292) - #383

Merged
tsondru merged 4 commits into
mainfrom
audit/G5-T3
Sep 1, 2026
Merged

test(applied,dl): add verify_rig_axioms call sites for Z and Dual (#292)#383
tsondru merged 4 commits into
mainfrom
audit/G5-T3

Conversation

@tsondru

@tsondru tsondru commented Sep 1, 2026

Copy link
Copy Markdown
Member

Closes #292.

verify_rig_axioms (catgraph-applied/src/rig.rs:772) had sweeps for BoolRig, F64Rig, Tropical, UnitInterval, and Checked<i64>, but never ran on Z (BigInt, backing SNF) or Dual<T> (forward-mode AD) — both Rig carriers via the blanket impl<T> Rig for T where T: Clone+PartialEq+Zero+One+Add<Output=T>+Mul<Output=T>.

Change

  • catgraph-applied/src/rig.rs: added verify_axioms_z_sample, sweeping Z::from(i64) samples (negative, zero, positive) through the existing nested-loop pattern.
  • catgraph-dl/src/para/dual.rs (feature ad): added verify_axioms_dual_f64_sample, sweeping 11 Dual<f64> samples (new/variable/constant/zero/one, 6 with nonzero du) through the same pattern.

Review (4 rounds, rust-v2:falsifying-reviewer, perturb-in-copy)

  • Round 1 (base fb8426bae8e74b, the two call sites): no blocking/important. Two minors: (a) an epistemic limitation, not a defect — for Z, 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) the Dual<f64> sample set was thin on nonzero-du coverage (3/8) — a Mul-cross-term bug's detection rested on one data point. (b) applied in f2b5fc6 (8→11 samples, 3→6 nonzero-du).
  • Round 2 (ae8e74bf2b5fc6 delta): confirmed the widened set independently redundant (both the old-3 and new-3 nonzero-du subsets 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_axioms aborts 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-du operands. Documented in 903c275.
  • Round 3 (903c275640dc67 delta): 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, making Dual<f64> isomorphic to R×R) satisfies every rig axiom and passes undetected; verify_rig_axioms is a rig-axiom oracle, not a chain-rule oracle. Narrowed the claim and named the blind spot in 640dc67.
  • Round 4 (640dc67 delta): 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 -r copy with its own --target-dir; the worktree stayed clean throughout (git status --porcelain empty before/after each round).

Gates (worktree)

  • cargo nextest run -p catgraph-applied (--target-dir /tmp/cargo/catgraph-G5-T3): 669 passed, 0 failed, 12 skipped
  • cargo 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 failed
  • cargo clippy --all-targets -- -D warnings: clean on catgraph-applied (default, --no-default-features) and catgraph-dl (default, --features ad)
  • RUSTDOCFLAGS="-D warnings" cargo doc -p catgraph-applied -p catgraph-dl --features ad --no-deps: clean
  • cargo fmt --all --check: clean
  • scripts/check_measured_claims.py / scripts/check_audit_counts.py: not applicable — diff carries no MEASURED markers and touches no audit doc

🤖 Generated with Claude Code

@tsondru
tsondru merged commit 89241cc into main Sep 1, 2026
6 checks passed
@tsondru
tsondru deleted the audit/G5-T3 branch September 1, 2026 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

applied+dl: verify_rig_axioms never runs on Z or Dual<T>

1 participant