A1 audit: rational-constant folding probes + audit doc

Audit-only (no engine/importer/checker changes). Characterizes solc 0.8.35's
constant folding (exact ℚ fold, sub-denomination scaling, final integer-fit +
range + sign check) with compiled probes, and pinpoints our divergences.

Finding: the suspected unsoundness (truncate-then-accept) does NOT exist — the
existing NumberRat folder folds exactly and rejects non-integers (0 WRONG-VALUE).
The live gap is OVER-REJECTION of negative constants formed by subtraction
(NumberRat is over Nat; NumberRat.sub? returns none when negative), e.g.
int256 constant = 7/2*2 - 100 (solc: -93). 3 OVER-REJECT probes, rest PARITY.

Probes: tests/rational-probes/{accepts.sol,rejects/*.sol,extract_solc.py,
our_side_eval.lean}. Doc: docs/rational-constants-audit.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Dan Robinson 2026-07-06 13:03:35 -07:00
commit 5c26c24ceb
14 changed files with 495 additions and 0 deletions