Skip to content

refactor: delete dead local Kernel.IndepFun.comp duplicate (−41 lines)#22

Merged
cameronfreer merged 1 commit into
mainfrom
refactor-delete-IndepFun-duplicate
May 18, 2026
Merged

refactor: delete dead local Kernel.IndepFun.comp duplicate (−41 lines)#22
cameronfreer merged 1 commit into
mainfrom
refactor-delete-IndepFun-duplicate

Conversation

@cameronfreer

Copy link
Copy Markdown
Owner

Summary

KernelBridge.lean defined a local Kernel.IndepFun.comp lemma that duplicates mathlib's ProbabilityTheory.Kernel.IndepFun.comp (specialized to ℝ-valued composition targets). It has zero callers in the codebase. Delete it.

Net diff: 1 file, +0 / −41 (−41 lines, pure deletion).

Why this is a deletion, not a wrapper

The PR #16 autoGolf draft proposed making the local lemma a thin wrapper around ProbabilityTheory.Kernel.IndepFun.comp. But the wrapper has no callers: I grep'd for all Kernel.IndepFun.comp usages and all .comp dot-notation calls on Kernel.IndepFun / IndepFun instances:

  • Probability/CondIndep/Indicator.lean:135, 144, 150, 179 — these use _indep.comp on plain IndepFun (measure-based), so dot notation resolves to mathlib's ProbabilityTheory.IndepFun.comp (different lemma, different namespace).
  • Probability/CondIndep/Basic.lean:161, 168 — same.
  • KernelBridge.lean:17 — module docstring bullet (advertising the lemma).
  • DeFinetti/ProofPlan.lean:50 — historical planning note ("already proved").

No code actually calls Kernel.IndepFun.comp (the kernel-based one). Replacing the body with a wrapper would leave dead code; deleting is the right move.

What changed

Exchangeability/DeFinetti/ViaKoopman/KernelBridge.lean:

  • Delete the 30-line proof + 10-line docstring of Kernel.IndepFun.comp (lines 181–219).
  • Update the module-level docstring "Main results" bullet list to remove the entry advertising the now-deleted lemma. (This is the same kind of "docstring becomes explicitly false" situation we fixed in refactor: thin exists_perm_extending_strictMono via mathlib API (−46 lines) #18; making the file's claimed API match its actual exports.)

The DeFinetti/ProofPlan.lean:50 historical note is left alone — it's a session-archaeology document, not user-facing.

If a future Kernel.IndepFun term needs .comp, dot notation will resolve to mathlib's ProbabilityTheory.Kernel.IndepFun.comp via the existing imports, with a strictly more general signature (target type need not be ℝ).

Verification

Check Baseline (main = 1ded130) This branch
lake build clean (3531 jobs) clean (3531 jobs)
Axioms (11 theorem decls) standard only standard only
Sorries (Exchangeability + ForMathlib) 0 0
Proof-file churn 1 file, +0 / −41

Notes

KernelBridge.lean defines a local `Kernel.IndepFun.comp` lemma that
duplicates mathlib's `ProbabilityTheory.Kernel.IndepFun.comp` (specialized
to ℝ-valued composition targets). It has zero callers in the codebase:
the `_indep.comp` calls in `Probability/CondIndep/Indicator.lean` and
`Probability/CondIndep/Basic.lean` are on plain `IndepFun` (measure-based),
which resolves to mathlib's `ProbabilityTheory.IndepFun.comp` — a different
lemma in a different namespace.

This delete is stronger than PR #16's autoGolf suggestion (which kept the
lemma as a thin wrapper). Since there is nothing to wrap to, removing it
outright is cleaner.

- Exchangeability/DeFinetti/ViaKoopman/KernelBridge.lean:
  - delete the 30-line proof + 10-line docstring (lines 181-219)
  - update the module docstring "Main results" bullet list to match
@cameronfreer cameronfreer merged commit 7301d1b into main May 18, 2026
cameronfreer added a commit that referenced this pull request May 18, 2026
…ib (#31)

The local `MartingaleHelpers.comap_comp_le` lemma had one real caller
(`RevFiltration.lean:109`) and was a thin wrapper around the mathlib
chain `MeasurableSpace.comap_comp` (equality) + `comap_mono` + the
target function's `.comap_le`. Inline at the call site:

  rw [← MeasurableSpace.comap_comp]
  exact MeasurableSpace.comap_mono measurable_shiftSeq.comap_le

The other two references to the lemma — `open ...MartingaleHelpers
(comap_comp_le)` in `ViaKoopman/InfraCore.lean:103` and
`ViaKoopman/KernelBridge.lean:31` — were vestigial after PR #22 (which
deleted the local `Kernel.IndepFun.comp` that had used `comap_comp_le`
internally). Dropped.

- DeFinetti/MartingaleHelpers.lean: delete the lemma + its
  `section ComapTools` wrapper (-19 lines).
- DeFinetti/ViaMartingale/RevFiltration.lean: inline the call (-0 lines
  net; 2 lines for 1).
- DeFinetti/ViaKoopman/{InfraCore,KernelBridge}.lean: drop the
  vestigial `open` statements (-1 line each).

Net -21 lines across 4 files. Build clean (3527 jobs), axioms standard,
0 sorries.
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