Repository navigation
refactor: drop the redundant hep : 2 < e hypothesis - #97
Merged
Merged
Conversation
The `2 < e` hypotheses all trace back to `toRatSig_maxNormalNumber` and `toRatExp_maxNormalNumber`, which were stated with `2 < e` although they hold for `1 < e`. Weakening all 144 binders needs no proof changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After the previous commit, 36 declarations take both `he : 1 < e` and `hep : 1 < e`, among them `add_eq_add`, `sub_eq_sub`, `mul_eq_mul`, `div_eq_div`, `fma_eq_fma` and `sqrt_eq_sqrt`. Remove `hep` and update the call sites. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
The
hep : 2 < einhypothesis onadd_eq_add,sub_eq_sub,mul_eq_mul,div_eq_div,fma_eq_fma,sqrt_eq_sqrtand the rounding lemmas under them is not needed. This PR changes every2 < eexponent hypothesis to1 < e. Where a theorem then has bothhe : 1 < eandhep : 1 < e, it deleteshep.The main theorems now also hold for
e = 2. SMT-LIB allows(_ FloatingPoint eb sb)for anyeb, sb > 1, which is exactly1 < e ∧ 0 < s, so they now cover every SMT-LIB format.Where
hepcame fromPackedFloat.toRatSig_maxNormalNumberandPackedFloat.toRatExp_maxNormalNumber(Fp/PackedFloat/Lemmas/SpecialValues.lean) were added in feat: Show that lower/upper is computable for PackedFloat ~ ExtRat #70 with(he : 2 < e). Both statements are true for1 < e, and their proofs compile unchanged. Ate = 2,maxNormalNumberhas biased exponent0b10 = 2andbias 2 = 1, sotoRatExp = 1 = maxNormalExp 2. The significand is2 - 2^-sfor anye.maxNormalvalue lemmas on top of these:toRat_maxNormalNumber_lt_two_pow,toRat_maxNormalNumber_lt_toRat_maxNormalNumber_succandtoRat'_maxNormal_eq_toRat_maxNormalNumber. It then addedhep : 2 < epnext tohe : 1 < epup throughblast{Lower,Upper}_Rel_smtLib*tomul_eq_mul.IsLowerHalf/TieBreak/IsEvenfiles,Packable/PackUnpackRoundTrip, add/sub/div/fma/sqrt). That made 144 declarations in total.Commits
2 < eto1 < e. This edits 144 binders with no proof changes. On its own it shows that no proof actually used2 < e.hep. This removes the binder from the 36 declarations that also takehe : 1 < e. At call sites,he hepbecomeshe. Afterapply/rwof these lemmas there is one side goal fewer, so the six bullets that discharged it are deleted:· simp [hep]×2,· exact hep×2, and· grind only×2 inmul_eq_mul. One stale comment and one stale docstring note are fixed.The other 108 declarations had
2 < eas their only exponent hypothesis. They keep their argument and its name and now take1 < e. Their callers are unchanged.Breaking change: the 36 declarations listed in commit 2, including the six
*_eq_*theorems, each lose one explicit argument (e.g.mul_eq_mul hsin he rm a b). The only caller in this repo,FpAgainstFloatModel/Mul.lean, is updated.Testing
lake build Fp FpAgainstFloatModel FpExecutableTests Examples FpSymbolicRewritingTestspasses after each commit. The#guard_msgs in #print axiomschecks are unchanged, so no newsorry.e = 2case, I ran a one-off exhaustive check outside the repo againstcomputableSmtLibRoundMethod(the round method the test suite uses), comparing up to NaN withequal_denotation, under all 5 rounding modes. Every case matched:PackedFloat 2 swiths ∈ {1, 2, 3}, and fma withs ∈ {1, 2}: 291,840 cases;test_roundCircuitAgainstSmtlibrounding into(e, s) = (2, 1), (2, 2), (2, 3): 7,070 cases.Not done here
hep : 2 < epstill containhave he : 1 < ep := by grind, which is now redundant. I left them so the diff stays mechanical.e = 2output format:roundCircuitAgainstSmtLibuseseout ∈ {3, 4}, and the golden tests use FP8 formats. Ane = 2case could be added.🤖 Generated with Claude Code