revise sec-double-integrals#843
Conversation
…ordering policy Rearrange sec-double-integrals so each theorem is immediately followed by its proof and examples, per the policy: thm → proof → example → counterexample. New order: thm-fubini → exm-fubini-nonrect → cor-fubini-rect + proof → exm-fubini-rect → exm-fubini-fail (Riemann part only) → thm-fubini-tonelli + notes → exm-fubini-fail-tonelli (new, measure-theoretic part) Split exm-fubini-fail into two: the Riemann counterexample (kept as exm-fubini-fail) and a new exm-fubini-fail-tonelli that shows why thm-fubini-tonelli's absolute-integrability condition is also essential. Also codify the general ordering policy in CLAUDE.md under Content Writing. Closes #841 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
I'll analyze this and get back to you. |
|
Claude finished @d-morrison's task in 2m 20s —— View job PR #843 Code Review: revise sec-double-integrals
SummaryThis PR restructures CLAUDE.md changesThree new rules added to The rules are clear and sensible. One internal tension: The new proof rule is not self-consistently applied to
|
| Position (new) | Div | Notes |
|---|---|---|
| 1 | @thm-fubini |
Unchanged |
| 2 | @exm-fubini-nonrect |
Moved up from after @exm-fubini-rect |
| 3 | @cor-fubini-rect + proof |
Unchanged |
| 4 | @exm-fubini-rect |
Unchanged |
| 5 | @exm-fubini-fail |
Shortened |
| 6 | @thm-fubini-tonelli + notes |
Moved down |
| 7 | @exm-fubini-fail-tonelli |
New |
@exm-fubini-nonrect now immediately follows @thm-fubini and correctly cites @thm-fubini Part 1 as justification (line 74). No forward references introduced.
New @exm-fubini-fail-tonelli — correctness check
The polar-coordinates lower bound at _sec_double_integrals.qmd:388–396:
- Substitution
$x = r\cos\theta,, y = r\sin\theta$ :$|f| = r^2|\cos 2\theta|/r^4 = |\cos 2\theta|/r^2$ ✓ - Jacobian
$r,dr,d\theta$ : inner integrand$|\cos 2\theta|/r^2 \cdot r = |\cos 2\theta|/r$ ✓ - The product factors correctly because
$\theta$ and$r$ are independent ✓ -
$\int_0^\epsilon dr/r$ diverges ✓ - Conclusion "(Hypothesis (a) also fails:
$f$ takes both positive and negative values)" ✓
Math is correct.
Issues
1. @thm-fubini-tonelli lacks a positive application example. The new CLAUDE.md rule says to "immediately follow with an example utilizing the claim." The only example that follows @thm-fubini-tonelli is @exm-fubini-fail-tonelli, which shows when the theorem does not apply — a counterexample, not a positive use. The speaker notes explain the theorem's role, but the rule's intent (show the theorem working) is not satisfied. This may be acceptable given that the theorem is out of scope for Epi 204 itself, but it puts the PR out of compliance with the rule it is adding. Fix this →
2. @exm-fubini-fail-tonelli back-references @exm-fubini-fail but has no figure. This is fine — it says "The same function … from @exm-fubini-fail" which correctly points to the figure in the earlier example. No figure duplication needed. ✓
3. Caption update in @fig-fubini-fail (line 319) — changed from mentioning
4. @exm-fubini-fail-tonelli (line 407): citation [@wp:fubini] ends without a {{< slidebreak >}} — but this is consistent with how the file ends (original also ended without a trailing slidebreak after the last block). Not an issue.
Verdict
The reorganization is correct and improves content flow. The main concern is the internal consistency gap: the new CLAUDE.md rules require proofs and positive examples after every theorem, but @thm-fubini still has no proof, and @thm-fubini-tonelli only has a failure example. These should either be addressed in the .qmd or the rules should be qualified. Everything else (math, cross-references, R code, div nesting) is correct.
|
Claude finished @d-morrison's task in 3m 25s —— View job PR #843 Code Review: revise sec-double-integrals
SummaryThis PR restructures
All math is correct, all cross-references resolve backward, and the reordering is pedagogically sound. The main concern is a self-consistency gap between the new CLAUDE.md rules and the content they govern. CLAUDE.md changesThree new rules added to Self-consistency gap — rule requires proofs that are not present:
|
| Position (new) | Div | Status |
|---|---|---|
| 1 | @thm-fubini |
Unchanged |
| 2 | @exm-fubini-nonrect |
Moved up from after @exm-fubini-rect |
| 3 | @cor-fubini-rect + proof |
Unchanged |
| 4 | @exm-fubini-rect |
Unchanged |
| 5 | @exm-fubini-fail |
Shortened |
| 6 | @thm-fubini-tonelli + notes |
Moved down |
| 7 | @exm-fubini-fail-tonelli |
New |
@exm-fubini-nonrect now cites @thm-fubini Part 1 (line 74) — a backward reference to line 15. No forward references introduced. ✓
@exm-fubini-fail no longer mentions @thm-fubini-tonelli, which is now defined below it — the forward reference is gone. ✓
Math check — new @exm-fubini-fail-tonelli
The polar lower bound for
- Substitution
$x=r\cos\theta$ ,$y=r\sin\theta$ :$|f|=|x^2-y^2|/(x^2+y^2)^2 = r^2|\cos2\theta|/r^4 = |\cos2\theta|/r^2$ ✓ - Jacobian
$r,dr,d\theta$ : inner integrand$|\cos2\theta|/r^2 \cdot r = |\cos2\theta|/r$ ✓ - Fubini factoring over the quarter-disk:
$\left(\int_0^{\pi/2}|\cos2\theta|,d\theta\right)!\left(\int_0^\epsilon dr/r\right)$ ✓
(The$\theta$ -integral equals 1; the$r$ -integral diverges at$r=0$ .) ✓ - "Hypothesis (a) also fails:
$f$ takes both positive and negative values" —$f>0$ when$|x|>|y|$ ,$f<0$ when$|y|>|x|$ . ✓
All arithmetic correct.
Issues
1. @thm-fubini-tonelli has no positive-use example (new rule violation).
The new CLAUDE.md rule requires an "example utilizing the claim" immediately after every theorem. The only example following @thm-fubini-tonelli is @exm-fubini-fail-tonelli, which demonstrates a failure case — it shows when neither hypothesis is satisfied and the theorem does not apply. This is a counterexample, not a positive application. To comply with the new rule, a positive example should precede @exm-fubini-fail-tonelli (e.g., a nonneg function on a product space where Tonelli's condition is met). If the theorem's scope is intentionally out-of-range for the course, the CLAUDE.md rule should acknowledge that positive examples are only required when in scope. Fix this →
2. @exm-fubini-fail-tonelli uses :::: (four-colon fence) but contains no nested divs.
Four colons are needed when a div must wrap a nested three-colon div (e.g., a figure inside an example). @exm-fubini-fail-tonelli has no such nesting — ::: (three colons) is sufficient and consistent with @thm-fubini-tonelli, @cor-fubini-rect, etc. Fix this →
3. @cor-fubini-rect and @exm-fubini-rect interrupt the @thm-fubini cluster.
Under the new rule "theorem → proof → example(s) → counterexample(s)", the counterexample for @thm-fubini (@exm-fubini-fail) should be adjacent to @thm-fubini's examples. Currently @cor-fubini-rect + proof + @exm-fubini-rect sit between @exm-fubini-nonrect and @exm-fubini-fail, separating the Fubini positive-example cluster from its counterexample. This is a practical compromise (the corollary naturally follows the theorem) but is technically non-compliant with the adjacency rule. No proposed fix — noting as a known gap for the maintainer to decide whether to tighten the rule or re-order.
Non-issues
@fig-fubini-failcaption update (line 319): changed from "Fubini–Tonelli fails" to "not continuous → @thm-fubini doesn't apply" — accurate now that the Tonelli discussion has moved to@exm-fubini-fail-tonelli. ✓:::notesdiv (lines 360–369) sits between@thm-fubini-tonelliand the next{{< slidebreak >}}— correctly associated with the theorem's slide. ✓@exm-fubini-fail-tonelliback-references@exm-fubini-fail— no figure duplication needed since both examples share the same function. ✓- All
{{< slidebreak >}}markers are present between major blocks. ✓
Verdict
The reorganization is correct and pedagogically sound. Issues 1 and 3 are the most important: the PR adds rules it cannot fully satisfy. Issue 2 is a minor stylistic inconsistency. Recommend addressing at minimum Issue 1 (either add a positive example for @thm-fubini-tonelli, or qualify the rule) before merging.
|
@claude address all review comments |
|
👀 Picked up by workflow run #26988941870. R/Quarto/renv setup runs first (~3-5 min); Claude itself responds after that. |
…i div fences, add positive Fubini-Tonelli example
…i example
Issue 2: change :::: -> ::: for exm-fubini-fail-tonelli (no nested divs)
Issue 3: add @exm-fubini-tonelli-apply before @exm-fubini-fail-tonelli showing
f(x,y) = e^{-(x+y)} >= 0 on [0,1]x[0,1] satisfies Tonelli hypothesis (a)
and both iterated integrals equal (1-e^{-1})^2
|
Claude finished @d-morrison's task in 2m 13s —— View job PR #843 Code Review: revise sec-double-integrals (follow-up)
SummaryAll three actionable issues from previous reviews have been addressed. Two minor residual items noted below. Previous issues — resolution status
DetailIssue 1 — CLAUDE.md proof ruleThe rule now reads:
This is correct. The exception criterion ("non-elementary or out of scope") is general enough to cover Issue 2 — New positive example
|
|
@claude address all review comments, even nits |
|
👀 Picked up by workflow run #27031761722. R/Quarto/renv setup runs first (~3-5 min); Claude itself responds after that. |
|
@claude can we switch to examples involving probabilities? |
PR #843 Code Review: revise sec-double-integrals
|
Reword the example's intro sentence to say the case is one where neither Fubini-Tonelli condition is satisfied, matching the title "When neither Fubini-Tonelli condition is satisfied".
|
Claude finished @d-morrison's task in 3m 39s —— View job PR #843 Code Review: revise sec-double-integrals
SummaryThe latest commit ( All prior actionable findings are resolved. This PR is ready to merge. Prior review issues — final status
CLAUDE.md — committed HEAD is correctAll three new Content Writing rules are in the committed branch HEAD (verified:
Math verification (full file)
Content structure and div fences
All VerdictNo blocking issues. All prior findings are resolved and the last open nit is fixed in |
There was a problem hiding this comment.
this file is too long; decompose. note in ai instructions: source files should be under ~100 lines if possible
|
@claude see review |
|
👀 Picked up by workflow run #27531711041. R/Quarto/renv setup runs first (~3-5 min); Claude itself responds after that. |
|
Claude finished @d-morrison's task in 2m 20s —— View job PR #843 Code Review: revise sec-double-integrals
SummaryThe review by Issue 1 —
|
| File | Content | Approx. lines |
|---|---|---|
_fubini_intro_thm.qmd |
Intro prose (lines 1–12) + @thm-fubini (lines 15–50) |
~50 |
_exm_fubini_nonrect.qmd |
@exm-fubini-nonrect (lines 52–127) |
~76 |
_cor_fubini_rect.qmd |
@cor-fubini-rect + proof (lines 129–158) |
~30 |
_exm_fubini_rect.qmd |
@exm-fubini-rect (lines 160–241) |
~82 |
_exm_fubini_fail.qmd |
@exm-fubini-fail (lines 243–343) |
~101 |
_thm_fubini_tonelli.qmd |
@thm-fubini-tonelli + notes + @exm-fubini-tonelli-apply (lines 345–424) |
~80 |
_exm_fubini_fail_tonelli.qmd |
@exm-fubini-fail-tonelli (lines 426–462) |
~37 |
Every file is ≤101 lines. _exm_fubini_fail.qmd barely exceeds 100 (it contains a figure with ~30 lines of R code); if stricter compliance is desired, the figure chunk can be extracted as _fig_fubini_fail.qmd and included within, but this seems unnecessary given the "if possible" qualifier.
Change to chapters/math-prereqs.qmd (lines 49–51):
Replace:
# Double Integrals {#sec-double-integrals}
{{< include _subfiles/math-prereqs/_sec_double_integrals.qmd >}}
With:
# Double Integrals {#sec-double-integrals}
{{< include _subfiles/math-prereqs/_fubini_intro_thm.qmd >}}
{{< include _subfiles/math-prereqs/_exm_fubini_nonrect.qmd >}}
{{< include _subfiles/math-prereqs/_cor_fubini_rect.qmd >}}
{{< include _subfiles/math-prereqs/_exm_fubini_rect.qmd >}}
{{< include _subfiles/math-prereqs/_exm_fubini_fail.qmd >}}
{{< include _subfiles/math-prereqs/_thm_fubini_tonelli.qmd >}}
{{< include _subfiles/math-prereqs/_exm_fubini_fail_tonelli.qmd >}}
Issue 2 — CLAUDE.md needs a file-length convention (CHANGES REQUESTED)
The ### File Structure section in CLAUDE.md has no guidance on file length. Add one line:
In CLAUDE.md, after the line - Link to .qmdsource files, not rendered.html files (line 38), add:
- Aim to keep source files under ~100 lines; split longer files into named subfiles
Non-issues
- The math and content in the file are correct (verified in prior review rounds) — decomposition is purely structural.
- Splitting into subfiles does not affect cross-references: Quarto resolves
@exm-fubini-nonrect,@thm-fubini, etc. document-wide regardless of which subfile defines them. - The
clear freezerlabel is already on this PR; it will still be needed after the decomposition since_subfiles/are being modified.
Verdict
Two changes needed before merge: (1) decompose the 462-line file into 7 subfiles ≤101 lines each, and (2) add the ~100-line size convention to CLAUDE.md ### File Structure.
Per review on #843: split the 462-line _sec_double_integrals.qmd into seven focused subfiles (each <=99 lines), one per logical block: - _fubini_intro_thm.qmd (intro + @thm-fubini) - _exm_fubini_nonrect.qmd (@exm-fubini-nonrect) - _cor_fubini_rect.qmd (@cor-fubini-rect + proof) - _exm_fubini_rect.qmd (@exm-fubini-rect) - _exm_fubini_fail.qmd (@exm-fubini-fail) - _thm_fubini_tonelli.qmd (@thm-fubini-tonelli + notes + @exm-fubini-tonelli-apply) - _exm_fubini_fail_tonelli.qmd (@exm-fubini-fail-tonelli) The chapters/math-prereqs.qmd include now expands to seven sequential includes. The slidebreaks that separated the blocks move into the parent between includes (per the convention that the initial slidebreak before a thm-variant div belongs in the including file); internal slidebreaks (intro->thm, tonelli->apply) stay within their subfile. Content is byte-identical to the original; no math or cross-references changed. https://claude.ai/code/session_01NQSLJmjMN22RpwpgJ6Lw6u
|
Claude finished @d-morrison's task in 3m 11s —— View job PR #843 Code Review: revise sec-double-integrals
SummaryThe latest commit ( Decomposition — structural review
All subfiles are ≤ 100 lines ✓. No subfile begins with a section heading ✓. Slidebreaks —
Cross-references — Quarto resolves cross-references document-wide regardless of include boundaries. All Div fence depths — all Issue — CLAUDE.md file-length convention missing
No file-length guideline was added. The decomposition itself demonstrates the convention, but the instruction is absent from CLAUDE.md. Fix this → Non-issues
VerdictThe decomposition is correct and complete. One item remains from |
|
Addressed the review:
Generated by Claude Code |
Built to branch |
claude-code-action allows file edits by default and `claude_args --allowed-tools` is additive, but a session that inspects its own allowlist and sees only Bash/gh/git/WebFetch entries can wrongly conclude editing is disallowed and post its diff as a comment instead of committing (PR d-morrison#843 run 27032044840). List Edit/Write/MultiEdit explicitly so the grant is unambiguous in the string the agent sees. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: d-morrison <2474437+d-morrison@users.noreply.github.com>
Adds a File Structure guideline to keep source files under ~100 lines and split longer files into named subfiles, matching the decomposition practice requested in review and applied in PR d-morrison#843. Kept as its own dedicated PR per the CLAUDE.md rule that meta/infra changes don't mix with book-content PRs. https://claude.ai/code/session_01NQSLJmjMN22RpwpgJ6Lw6u
|
Claude finished @d-morrison's task in 3m 18s —— View job PR #843 Code Review: revise sec-double-integrals
SummaryThe latest commit ( Decomposition review
All 7 subfiles are ≤99 lines — within the ~100-line guideline now codified in No subfile begins with a section heading. All subfiles open with either prose or a fenced div ( Slidebreaks.
Div fence depths.
Cross-references. All references resolve backward:
CLAUDE.md — committed stateAll three new Content Writing rules are in the committed branch HEAD:
The Prior review issues — final status
VerdictNo blocking issues. The decomposition is correct, all content and slidebreaks are preserved, and all prior findings are resolved. Ready to merge. |

Draft PR opened by
@claudeto address #841.Triggered by workflow run.
Addresses #841.