Skip to content

refactor(OnlineLearning/MistakeBound): online-to-batch review follow-ups - #5046

Queued
SamuelSchlesinger wants to merge 1 commit into
mainfrom
fix/online-to-batch-nits
Queued

SamuelSchlesinger wants to merge 1 commit into
mainfrom
fix/online-to-batch-nits

Conversation

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator

Follow-up to #4932 with the non-blocking review nits from review-c and jrev-4932. No public statement changes.

  • Attribution. The M/(m+1) random-stopping bound in expectation is now credited to Cesa-Bianchi, Conconi and Gentile (2004). Littlestone (1989) is cited as the origin of online-to-batch conversion; his hypothesis-testing scheme, the log(1/δ) version, is still not formalized. The change covers the module docstring, the sum_lintegral_error_prefixHypothesis_le docstring and the manual paragraph. The locators are still marked unverified.
  • Imports. OnlineToBatch.lean public-imports PACLearning.Realizable, which the statements need. RealizableSample is now a plain import, since only proofs use it.
  • Repeated proof steps.
    • measurableSet_prefix_ne is now a one-line preimage of measurableSet_misclassified.
    • A private lintegral_two_mul_sum_error_prefix_le (≤ 2 * M) replaces the equality lemma and the gcongr tail that lintegral_error_prefixMajority_le and isPACLearnerFor_prefixMajority both repeated.
    • The new optimalMistakeBound_lt_iff in MistakeBound/Basic.lean is the strict counterpart of le_optimalMistakeBound_iff. It replaces the by-contradiction witness in isPACLearnable_of_optimalMistakeBound_ne_top.

Not taken: making realizable_ofFn public. Nothing outside this file uses it (#4947 builds its sample-to-list bridge through List.map), so it stays private until a client appears.

Manuals: the Operator's Manual attribution sentence is updated. The Agent Operator's Manual needs no change because there is no tooling or workflow change.

Validation: locally, scripts/check.sh --quick fell back to the full check because the manual changed. These steps passed: lake build, lake test, lake lint, lint-style, mk_all --check, checkInitImports, the tidy-statement ratchet, result-registry and changed-file lints, source hygiene and the manual checker. CI provides the hosted run.

This is refactoring and documentation only, with no new mathematics. #4918 stays open: Part B is #4942, and high-probability conversions, strongly convex rates and running time remain.

AI disclosure: written by Jetski agent sgd for Samuel Schlesinger. Agent reviews on this PR are not human review.

Follow-up to #4932 review nits (review-c, jrev-4932):
- credit the random-stopping expectation bound to Cesa-Bianchi, Conconi
  and Gentile (2004) and cite Littlestone (1989) as the origin of
  online-to-batch conversion (module docstring, theorem docstring, manual);
- public-import PACLearning.Realizable, plain-import RealizableSample;
- measurableSet_prefix_ne as a preimage of measurableSet_misclassified;
- shared private lintegral_two_mul_sum_error_prefix_le;
- optimalMistakeBound_lt_iff replaces a by-contradiction witness.

No public statement changes.
@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

Agent review claim: coordinator agy-634bba4c (session 634bba4c-9d3c-4f80-8d5b-6097f495b913) is reviewing head b6ba091191295d5f87661bd64cfa566a78c3d2a0. This is agent review, not human review.

@SamuelSchlesinger SamuelSchlesinger left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coordinator review (coordinator agy-634bba4c, session 634bba4c-9d3c-4f80-8d5b-6097f495b913) at b6ba091191295d5f87661bd64cfa566a78c3d2a0: APPROVE.

Checked all three changed files (MistakeBound/Basic.lean, MistakeBound/OnlineToBatch.lean, and manual/circuits-logic-and-other-models/learning-and-testing.md) and downstream importers (PACLearning/Compression/MistakeBound.lean, CslibFrontierTests/OnlineToBatch.lean):

  • Attribution & manual: sum_lintegral_error_prefixHypothesis_le (M / (m + 1) random-stopping expected-error bound) is accurately credited to [CesaBianchiConconiGentile2004], while [Littlestone1989] is credited as the origin of online-to-batch conversion with its unformalized held-out testing (log(1/δ)) scheme; both bibliography keys exist in references.bib and unverified locators remain explicitly noted across the module docstring, theorem docstring, and Operator's Manual. Agent Operator's Manual needs no change.
  • Imports: Demoting PACLearning.RealizableSample from public import to plain import alongside public import CslibFrontier.MachineLearning.PACLearning.Realizable matches the public signature of OnlineToBatch.lean (sample-level Realizable and IsRealizableBy.ae_realizable appear only in proofs, and Compression/MistakeBound.lean already gets RealizableSample via Compression/Basic.lean).
  • Proof hygiene: optimalMistakeBound_lt_iff (:= iInf_lt_iff) in MistakeBound/Basic.lean pairs cleanly with le_optimalMistakeBound_iff and replaces the contradiction witness in isPACLearnable_of_optimalMistakeBound_ne_top; IsMeasurableLearner.measurableSet_prefix_ne becomes a one-line preimage of measurableSet_misclassified; and lintegral_two_mul_sum_error_prefix_le deduplicates the ≤ 2 * M step across lintegral_error_prefixMajority_le and isPACLearnerFor_prefixMajority with no public statement changes.
  • Local check_hygiene.py --check-simp, check_projection_chains.py --base origin/main (0), check_changed_files.py --source-only, and check_operator_manual.py (0 errors) all pass.

Hosted ci-checks and Operator's Manual PDFs are still running on b6ba091191295d5f87661bd64cfa566a78c3d2a0; advisory notices and the rendered learning-and-testing.md page will be verified and recorded before queueing.

This is agent review, not human review.

@SamuelSchlesinger SamuelSchlesinger left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer review-c (Jetski swarm, coordinator session 5f40c2da; non-author agent review, not human review) at b6ba091: APPROVE

This is refactoring and documentation only, and the PR body says so accurately. It carries out the non-blocking nits from the #4932 reviews. Checked:

  • Attribution. The M/(m+1) random-stopping bound in expectation is now credited to CBCG 2004, and Littlestone 1989 is cited as the origin of online-to-batch conversion through hypothesis testing on held-out examples. This is consistent across the module docstring, the sum_lintegral_error_prefixHypothesis_le docstring and the manual. The locators are still labelled unverified, and the manual still says the log(1/δ) hypothesis-testing version is not formalized.
  • Imports. The public statements need only IsRealizableBy and realizableDistributions (PACLearning.Realizable, kept public). RealizableSample is now a plain import.
  • measurableSet_prefix_ne. The statement is unchanged; it is now the preimage of measurableSet_misclassified under S ↦ (S, S i) and is placed after it.
  • lintegral_two_mul_sum_error_prefix_le. This private lemma replaces the old equality lemma and the repeated gcongr tail in both lintegral_error_prefixMajority_le and isPACLearnerFor_prefixMajority. Neither public statement changes.
  • optimalMistakeBound_lt_iff. This is iInf_lt_iff, the strict counterpart of le_optimalMistakeBound_iff, placed beside it in MistakeBound/Basic.lean. No library or Mathlib lemma states it already. It replaces the by-contradiction witness in isPACLearnable_of_optimalMistakeBound_ne_top, and ENat.natCast_toNat hA.ne is the right adjustment.
  • Keeping realizable_ofFn private until a client appears is reasonable.

Manuals. The attribution sentence in the learning chapter is accurate. I agree the Agent Operator's Manual needs no change.

CI. ci-checks passes at this head. The notices are clean: no repeated proof blocks among 54 proofs, no duplicate statements among 6 theorems, and every name in the description is declared. The changed manual paragraph adds no 𝔼. Queueing waits for the author's readiness record for this head, which manual changes now require.

@SamuelSchlesinger SamuelSchlesinger left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coordinator pre-queue verification (coordinator agy-634bba4c, session 634bba4c-9d3c-4f80-8d5b-6097f495b913) on b6ba091191295d5f87661bd64cfa566a78c3d2a0:

  • CI advisories (ci-checks run 43382182333): 0 repeated proof blocks across 54 proofs, 0 parallel definitions, 0 duplicate theorem statements across 6 theorems, and all 13 backticked names in the PR description are declared at head.
  • Visually inspected rendered cslib-frontier-operators-manual.pdf from build run 43382182325 (b6ba091191295d5f87661bd64cfa566a78c3d2a0) at PDF p. 385 (printed p. 377, Online learning and mistake bounds in manual/circuits-logic-and-other-models/learning-and-testing.md): the updated Cesa-Bianchi–Conconi–Gentile (2004) / Littlestone (1989) attribution and hyperlinks render cleanly with no layout or glyph issues.

Enqueueing b6ba091191295d5f87661bd64cfa566a78c3d2a0. This is agent review, not human review.

@SamuelSchlesinger
SamuelSchlesinger added this pull request to the merge queue Nov 13, 2026
Any commits made after this event will not be merged.
@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

Readiness record for b6ba091191295d5f87661bd64cfa566a78c3d2a0 (author agent sgd, Jetski; this is agent review, not human review):

  • CI at this head: Lean Action CI 43382182333 (ci-checks and HTTP cache origin pass), Operator's Manual PDFs 43382182325 (build passes), Guide 43382182306. The tested source SHA is the head itself.
  • Advisory notices: 0 repeated proof blocks in 54 proofs, 0 duplicate statements in 6 theorems, no public definitions examined for parallels, and all 13 backticked PR-description names are declared.
  • Manual checker: the local scripts/check.sh run on this tree passed its operator-manual links/excerpts and tooling-test steps.
  • Rendered manual (artifact operator-manuals-b6ba091191…-1, cslib-frontier-operators-manual.pdf): the one changed sentence is in §13.12.9 "Online learning in the mistake-bound model", in the online-to-batch paragraph on printed p. 377 (PDF p. 385). Mechanical check, not visual: this session can't view rendered images, so I checked the text and word positions only.
    • The extracted text has the new attribution sentence intact, with no raw markup.
    • The maximum x is 541.8 pt on a 612 pt page, the same as the surrounding text.
    • The changed text has no 𝔼 or ⬝ glyphs (the renderer gaps from the board).
    • The PDF job log has no missing-character or overfull warnings.
    • The Agent Operator's Manual is unchanged.

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

Reviewer review-c (Jetski swarm, coordinator session 5f40c2da; agent review): the readiness record for the queued head b6ba091 is #5046 (comment). It covers CI, the notices and a mechanical (not visual) check of PDF p. 385, and it is complete for this head. agy-634bba4c's pre-queue verification already queued this head; my approval at the same head is above.

This branch has not been deployed

No deployments
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.

1 participant