Skip to content

Add the chain rule for surprisal with many variables - #195

Merged
d-morrison merged 2 commits into
mainfrom
claude/project-thread-ee6i6a
Nov 19, 2026
Merged

d-morrison merged 2 commits into
mainfrom
claude/project-thread-ee6i6a

Conversation

@d-morrison

Copy link
Copy Markdown
Contributor

Requested by Ezra · project thread

Why

The notes state the many-variable chain rule only for entropy (#thm-entropy-chain-rule-n). For two variables, the surprisal rule comes first and the entropy rule follows as its expectation, so the many-variable case should follow the same pattern.

What

In the Chain rules section of entropy.qmd:

  • New #thm-surprisal-chain-rule-n: $\surprisalf{x_1, \ldots, x_n} = \sum_i \surprisalf{x_i \mid x_1, \ldots, x_{i-1}}$ for values with positive joint probability, proved by induction from #thm-surprisal-chain-rule.
  • New #exm-surprisal-chain-rule-n-copies: the same chain of noisy copies as the entropy example, evaluated at $(0, 0, 1)$: $1 + 0.322 + 2.322 = 3.644$ bits $= \surprisalf{0, 0, 1}$.
  • Reproved #thm-entropy-chain-rule-n: the statement is unchanged. The proof now takes the expectation of the new surprisal rule, as the two-variable entropy proof does, in place of its own induction.

No anchors were renamed. The theorems and examples after these in the section move up one number.

Checks

I rendered entropy.qmd to HTML and read the built page. All three divs render, the R chunk prints sum = joint = 3.643856, and there are no unresolved cross-references.


Generated by Claude Code

The notes stated the many-variable chain rule only for entropy, while
the two-variable rule is stated first for surprisal and the entropy rule
follows as its expectation. This adds the n-variable surprisal rule (by
induction on the two-variable one) with a worked example on the chain of
noisy copies, and proves the n-variable entropy rule as its expectation,
mirroring the two-variable pair.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019xfc9ofsSt91XvhD4dPZwm
Copilot AI balanced review requested due to automatic review settings November 13, 2026 22:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@d-morrison d-morrison self-assigned this Nov 13, 2026
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Copilot AI balanced review requested due to automatic review settings November 19, 2026 06:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions

Copy link
Copy Markdown

Claude finished review — View run


I fetched PR #195 live just now with gh pr view. It is open, not a draft and not merged, and its head is 18381583c0a9f9af00996deaa4296cdf62f75b1e. That is the commit I reviewed, so the review above still applies.

Verdict

Ready for merge

Structured Review Data (JSON)
{
  "schema_version": "1.1",
  "reviewer": "claude",
  "commit_sha": "18381583c0a9f9af00996deaa4296cdf62f75b1e",
  "verdict": "CLEAN",
  "findings": [],
  "detailed_assessment": "Re-read the diff for the new surprisal chain rule theorem, its worked example, and the rewritten entropy chain rule proof; content is unchanged since the prior clean round and the merge of main adds nothing to these files.",
  "holistic_assessment": "The change stays scoped to one theorem, one example and one rewritten proof, uses the shared semantic macros, and keeps results defined before use, so there are no integration or regression concerns."
}

Reviewed commit: 1838158

@github-actions

Copy link
Copy Markdown

💰 Cost: $0.2460 (review) — run

@github-actions

Copy link
Copy Markdown
PR Preview Action v1.8.2
🚀 Preview available at: https://Morrison-Lab.github.io/ids/pr-preview/pr-195/

Built to branch gh-pages at 2026-11-19 07:14 UTC.

Copy link
Copy Markdown
Contributor Author

Annotation dispositions for head 1838158:

  • build / build, notice: "SUBMODULES_TOKEN is empty; cloning submodules anonymously". This is a false positive for this PR. The only submodule, latex-macros, is public, and the build passed.
  • review / claude-review, notice: "Skipping element-level diff highlighting: 495 old / 507 new candidate elements exceed the 500-element cap". This is a routine notice about how the review tool displays the diff. It isn't a finding, and the review verdict is CLEAN.

Cross-harness review was waived for this head. No reviewer from a different harness could run in this session: the CLIs agy, codex, cursor-agent, gemini and opencode aren't installed, and the session's permission policy blocked the OpenCode Go API call. The Claude review is clean on 1838158, and all CI checks pass.

Posted by Claude Code (AI agent) --- not written by a human.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

Cross-harness review of head 1838158: OpenCode Go, model iceman-contributor-free. The first try, with deepseek-v4.1-flash, returned HTTP 502.

The reviewer found no errors in the math, the numeric example or the cross-references. It raised one wording point and marked it VERDICT: ISSUES:

Minor wording/precision in _thm-entropy-chain-rule-n.qmd proof [...] Better: say "with probability 1 the realization $(X_1,\ldots,X_n)$ is some $(x_1,\ldots,x_n)$ with $\P(\ldots)&gt;0$, hence @thm-surprisal-chain-rule-n gives the identity almost surely."

Rebut. The proof already opens with "With probability $1$, the tuple $(X_1, \ldots, X_n)$ takes a value $(x_1, \ldots, x_n)$ with $\P(X_1=x_1, \ldots, X_n=x_n) &gt; 0$, so @thm-surprisal-chain-rule-n applies at $(x_1, \ldots, x_n) = (X_1, \ldots, X_n)$." That is the reviewer's suggested reading. It also matches the existing two-variable proof (_thm-entropy-chain-rule.qmd) word for word, so the two proofs read in parallel. The reviewer itself notes that "the current included file text is acceptable". No change.

Posted by Claude Code (AI agent) --- not written by a human.


Generated by Claude Code

@d-morrison
d-morrison merged commit 375a3de into main Nov 19, 2026
27 checks passed
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.

3 participants