Repository navigation
feat(persistence): rational enclosure of the exponential at nonpositive rational arguments (#1013) - #1014
Conversation
…ve rational arguments (#1013) Add TDA.Persistence.Enclosure.Exp: for rational x ≤ 0 and δ > 0, expEnclosure x δ is a rational interval computed by rational arithmetic that contains Real.exp x (expEnclosure_mem) and has width at most δ (expEnclosure_width). expEnclosure? rejects positive arguments and nonpositive tolerances. The argument is halved into [-1, 0], a Taylor polynomial is bounded by Real.exp_bound and the result is squared back with outward dyadic rounding. The width is absolute, not relative; the cost is documented, not proved. This is the first unit of #926: enclosures of the Gram sums and of the squared RKHS distance are not included. Kernel-checked fixtures and consumers are in TDA.Persistence.Enclosure.ExpExamples; the note is docs/math/kernel-enclosure.md. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RfoZqCRSgoUin4otWc6fXL
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Reviewed-by: claude-opus read-only reviewer (session distinct from the implementer) Reviewed head: Verdict: pass with non-substantive notes. No substantive finding. Findings
What I checked, with evidence
Not checked
Generated by Claude Code |
Closes #1013
Summary
First unit of #926: an executable rational enclosure of the exponential at the arguments a Gaussian kernel needs.
TDA.Persistence.Enclosure.Exp. For a rationalx ≤ 0and a rationalδ > 0,expEnclosure x δ : ℚ × ℚis computed by rational arithmetic, contains the actualReal.exp x(expEnclosure_mem) and has width at mostδ(expEnclosure_width).expEnclosure?returns it for such a request andnonefor a positive argument or a nonpositive tolerance.expHalvings xtimes into[-1, 0]; the Taylor polynomial withexpTerms pterms is bounded by Mathlib'sReal.exp_bound; the value is rounded outward to the grid1 / 2 ^ p, widened by one step, clamped to[0, 1]and squared back with outward rounding.p = expHalvings x + toleranceBits δ + 3.TDA.Persistence.Enclosure.ExpExampleswith kernel-checked fixtures (decide +kernel) and three consumers, among them a bound for one value of the existingWeightedKernel.kernel.docs/math/kernel-enclosure.md, registered indocsite/sources.txtand linked fromdocs/api.md,docs/README.mdanddocs/math/weighted-kernel-embedding.md; aCHANGELOG.mdUnreleased entry.What is not provided: no enclosure of the Gram sums
linearKerneland none of the squared RKHS distance (units 2 and 3 of #926); the width is absolute, not a relative error, and the lower endpoint can be0; positive arguments are rejected; the cost is documented, not proved.Branch lifecycle
Ordinary develop topic based on
73f08dd4aaecca958bf128d8fe26ac7876707e2d, targetdevelop, squash merge. Target scope: persistence-image / kernel computation under #926 / #227. Release version: undecided. Propagation: N/A.Public declarations added / changed
Added in
TDA.Persistence.Enclosure(nothing existing is changed):roundDown,roundUp,expTaylor,expTerms,expHalvings,toleranceBits,expSquare,expEnclosure,expEnclosure?.roundDown_le,lt_roundDown_add,le_roundUp,roundUp_lt_add,roundDown_nonneg,roundUp_le_one.two_pow_le_factorial_expTerms,neg_le_two_pow_expHalvings,one_div_two_pow_toleranceBits_lt,abs_exp_sub_expTaylor_le.expEnclosure_mem,expEnclosure_width,expEnclosure_fst_nonneg,expEnclosure_snd_le_one,expEnclosure_fst_le_snd,expEnclosure?_eq_some_iff,expEnclosure?_eq_none_iff,expEnclosure?_spec.Added in
TDA.Persistence.Enclosure.ExpExamples:schedule_zero,schedule_large,expTaylor_five,zero_coarse,one_coarse,one_fine,one_refines,one_tiny,reduced,third,gaussian,huge,positive_argument,zero_tolerance,negative_tolerance,exp_neg_one_bounds,reduced_width,kernel_separated.These are exactly the declarations of the contract block of #1013 as reviewed, with the same names, definition bodies and types, and the fixture list of its Acceptance section. No statement changed, and no supporting public lemma was added beyond the contract. All 45 public declarations are pinned at the end of
scripts/print_axioms/Persistence.lean.Source ↔ Lean correspondence
Library-derived; there is no paper source. Governing specification #926, contract #1013.
expEnclosure_memandexpEnclosure_widthare the scalar instance of [PI computation] Certify Gaussian kernel and squared RKHS distance enclosures #926's requirement that each successful interval contains the exact real value and has width at mostδ;expEnclosure?_specstates both for every returned interval, andexpEnclosure?_eq_none_iffis the explicit rejection.Real.exp_boundat the pinned revision56a005855ea17e0b0958f73ec801ae140b0a1679; no analytic foundation is added.expEnclosure_memholds for every tolerance because the tolerance only selects the precision.The statements were checked before admission by an independent reviewer, as recorded in the Admission section of #1013. Changed after that review: nothing in the Lean statements or definitions. The module docstring gained a Scope paragraph, and the documentation named in the contract was written; beyond the files the contract names, this PR also adds the note to
docsite/sources.txtand adds one pointer sentence each todocs/README.mdanddocs/math/weighted-kernel-embedding.md.Validation
cc106f36da6063d06058d4103bc2fedfca229bee. Base:73f08dd4aaecca958bf128d8fe26ac7876707e2d.scripts/check.shon the working tree that became this head: exit 0,CHECK OK.AXIOM AUDIT OK — 13894declarations within{propext Classical.choice Quot.sound}(base 13849).PRIVATE AUDIT — 10584private theorem roots (base 10572).COVERAGE OK — 11162public theorems, all pinned (base 11126).cc106f36da6063d06058d4103bc2fedfca229bee:scripts/check.sh --incrementalgreen, gate passed.checkfor this head: success — https://github.com/uda-lab/tda-lib/actions/runs/44741379320/job/136305593857 (conclusion read from the check run of headcc106f36da6063d06058d4103bc2fedfca229bee; its log was not re-read for the counts, which are those of the local run above). The hostedbuildjob of the pages workflow (site build and link tests) also succeeded on this head: https://github.com/uda-lab/tda-lib/actions/runs/44741379332/job/136305594062 .mkdocsis not installed in this container; the new links were checked by hand against existing files and anchors), doc-gen4 generation,scripts/check.sh --stable.Remaining sorry / custom-axiom footprint
None.
Independent review evidence
cc106f36da6063d06058d4103bc2fedfca229bee: pass with non-substantive notes — feat(persistence): rational enclosure of the exponential at nonpositive rational arguments (#1013) #1014 (comment) . Its wording notes (the docstrings ofroundDown/roundUpand step 4 of the math note say "below"/"above" where "at most"/"at least" is exact; the note's intro should say rational arithmetic cannot represent the kernel value "in general") were not acted on, so the reviewed head is the head evaluated above; they are carried into the next unit of [PI computation] Certify Gaussian kernel and squared RKHS distance enclosures #926.