Skip to content

Commit 3f592ab

Browse files
authored
chore: privatize 4 same-file helpers + drop 7 dead @[simp] lemmas in InfraCore (#111)
* chore: privatize 4 same-file-only helper lemmas Privatize lemmas with zero references anywhere in the repository (including blueprint, docs, and the wider `Exchangeability/` tree) whose only callers live in the same file: * `ViaKoopman/CesaroL2ToL1.lean`: `iterate_shift_eval'`, `iterate_shift_eval0'` — proof-step helpers; only in-file caller of each. * `Ergodic/ShiftInvariantRepresentatives.lean`: `ae_shift_invariance_on_rep` — proof helper; only caller at L338 in the same file. * `Util/ProductBounds.lean`: `abs_prod_le_one` — only caller is its sibling `abs_prod_sub_prod_le` directly below. Updated the file's docstring to drop the now-private name from "Main results". Candidate set produced by an audit script that enumerates non-private `lemma`/`theorem` declarations, excludes anything with a tactic-database attribute (`@[simp]`, `@[measurability]`, `@[fun_prop]`, etc.) where grep can't see implicit use, and reports those with zero `git grep -lw` hits outside their owner file. The audit found 25 candidates; the other 21 were judged to be real public API on public namespaces (`Contractable.*`, `Exchangeable.*`, `Integrable.of_abs_bounded`, `fixedSubspace_closed`, etc.) and left as-is even though no internal caller currently uses them. * chore(InfraCore): drop 7 dead @[simp] lemmas (probe verified, all unused) Following the standard "delete + build" probe pattern (since `@[simp]` lemmas can be used implicitly and grep can't see those uses), I removed seven `@[simp]` lemmas in `ViaKoopman/InfraCore.lean` and confirmed via `lake build` that none was load-bearing in any simp call across the 3527-job build: * `shiftℤ_apply`, `shiftℤInv_apply`, `restrictNonneg_apply` — `rfl` unfolding lemmas for `shiftℤ`/`shiftℤInv`/`restrictNonneg`. * `shiftℤ_comp_shiftℤInv`, `shiftℤInv_comp_shiftℤ` — round-trip identities for the two-sided shift and its inverse. * `restrictNonneg_extendByZero`, `extendByZero_apply_nat` — interaction lemmas for the nonneg-restrict / extend-by-zero pair. All seven had zero named references outside their owning file; the probe confirms that holds at the simp level too. If a future caller needs any of them, re-add as a one-liner. Net: −28 lines (file shrinks from 235 to 207 lines including the preserved bridge `measurable_shiftℤ` and downstream defs).
1 parent f83a441 commit 3f592ab

4 files changed

Lines changed: 10 additions & 36 deletions

File tree

Exchangeability/DeFinetti/ViaKoopman/CesaroL2ToL1.lean

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,9 @@ lemma eventuallyEq_comp_measurePreserving {f g : Ω[α] → ℝ}
9595
hT.quasiMeasurePreserving.ae_eq_comp hfg
9696

9797
omit [MeasurableSpace α] [StandardBorelSpace α] in
98-
/-- General evaluation formula for shift iteration. -/
99-
lemma iterate_shift_eval' (k n : ℕ) (ω : Ω[α]) :
98+
/-- General evaluation formula for shift iteration. File-private — only caller
99+
is `iterate_shift_eval0'` directly below. -/
100+
private lemma iterate_shift_eval' (k n : ℕ) (ω : Ω[α]) :
100101
(shift^[k] ω) n = ω (k + n) := by
101102
induction k generalizing n with
102103
| zero => simp
@@ -107,8 +108,9 @@ lemma iterate_shift_eval' (k n : ℕ) (ω : Ω[α]) :
107108
ac_rfl
108109

109110
omit [MeasurableSpace α] [StandardBorelSpace α] in
110-
/-- Evaluate the k-th shift at 0: shift^[k] ω 0 = ω k. -/
111-
lemma iterate_shift_eval0' (k : ℕ) (ω : Ω[α]) :
111+
/-- Evaluate the k-th shift at 0: shift^[k] ω 0 = ω k. File-private — only
112+
in-file caller. -/
113+
private lemma iterate_shift_eval0' (k : ℕ) (ω : Ω[α]) :
112114
(shift^[k] ω) 0 = ω k := by
113115
rw [iterate_shift_eval']
114116
simp

Exchangeability/DeFinetti/ViaKoopman/InfraCore.lean

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -97,32 +97,12 @@ notation "Ωℤ[" α "]" => Ωℤ α
9797
/-- The two-sided shift on bi-infinite sequences. -/
9898
def shiftℤ (ω : Ωℤ[α]) : Ωℤ[α] := fun n => ω (n + 1)
9999

100-
omit [MeasurableSpace α] in
101-
@[simp] lemma shiftℤ_apply (ω : Ωℤ[α]) (n : ℤ) :
102-
shiftℤ (α := α) ω n = ω (n + 1) := rfl
103-
104100
/-- The inverse shift on bi-infinite sequences. -/
105101
def shiftℤInv (ω : Ωℤ[α]) : Ωℤ[α] := fun n => ω (n - 1)
106102

107-
omit [MeasurableSpace α] in
108-
@[simp] lemma shiftℤInv_apply (ω : Ωℤ[α]) (n : ℤ) :
109-
shiftℤInv (α := α) ω n = ω (n - 1) := rfl
110-
111-
omit [MeasurableSpace α] in
112-
@[simp] lemma shiftℤ_comp_shiftℤInv (ω : Ωℤ[α]) :
113-
shiftℤ (α := α) (shiftℤInv (α := α) ω) = ω := by ext; simp [shiftℤ, shiftℤInv]
114-
115-
omit [MeasurableSpace α] in
116-
@[simp] lemma shiftℤInv_comp_shiftℤ (ω : Ωℤ[α]) :
117-
shiftℤInv (α := α) (shiftℤ (α := α) ω) = ω := by ext; simp [shiftℤ, shiftℤInv]
118-
119103
/-- Restrict a bi-infinite path to its nonnegative coordinates. -/
120104
def restrictNonneg (ω : Ωℤ[α]) : Ω[α] := fun n => ω (Int.ofNat n)
121105

122-
omit [MeasurableSpace α] in
123-
@[simp] lemma restrictNonneg_apply (ω : Ωℤ[α]) (n : ℕ) :
124-
restrictNonneg (α := α) ω n = ω (Int.ofNat n) := rfl
125-
126106
/-- Extend a one-sided path to the bi-infinite path space by duplicating the zeroth
127107
coordinate on the negative side. This is a convenient placeholder when we only need
128108
the right-infinite coordinates. -/
@@ -131,14 +111,6 @@ def extendByZero (ω : Ω[α]) : Ωℤ[α] :=
131111
| Int.ofNat n => ω n
132112
| Int.negSucc _ => ω 0
133113

134-
omit [MeasurableSpace α] in
135-
@[simp] lemma restrictNonneg_extendByZero (ω : Ω[α]) :
136-
restrictNonneg (α := α) (extendByZero (α := α) ω) = ω := by ext; simp [extendByZero]
137-
138-
omit [MeasurableSpace α] in
139-
@[simp] lemma extendByZero_apply_nat (ω : Ω[α]) (n : ℕ) :
140-
extendByZero (α := α) ω ↑n = ω n := by simp [extendByZero]
141-
142114
@[measurability, fun_prop]
143115
lemma measurable_shiftℤ : Measurable (shiftℤ (α := α)) := by
144116
unfold shiftℤ; fun_prop

Exchangeability/Ergodic/ShiftInvariantRepresentatives.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ private lemma gRep_ae_eq_of_constant_orbit {g0 : Ω[α] → ℝ}
143143
exact gRep_eq_of_constant_orbit (g0 := g0) hω
144144

145145

146-
lemma ae_shift_invariance_on_rep
146+
private lemma ae_shift_invariance_on_rep
147147
{μ : Measure (Ω[α])} [IsProbabilityMeasure μ]
148148
(hσ : MeasurePreserving shift μ μ)
149149
{f g : Ω[α] → ℝ}

Exchangeability/Util/ProductBounds.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ These are used in the contractability-based proof of de Finetti's theorem.
1414
1515
## Main results
1616
17-
* `abs_prod_le_one`: |∏ f| ≤ 1 when all |f i| ≤ 1
1817
* `abs_prod_sub_prod_le`: |∏ f - ∏ g| ≤ ∑ |f_j - g_j| when factors bounded by 1
1918
-/
2019

2120
namespace Exchangeability.Util
2221

23-
/-- Helper: |∏ f| ≤ 1 when all |f i| ≤ 1. -/
24-
lemma abs_prod_le_one {n : ℕ} (f : Fin n → ℝ) (hf : ∀ i, |f i| ≤ 1) : |∏ i, f i| ≤ 1 := by
22+
/-- Helper: |∏ f| ≤ 1 when all |f i| ≤ 1. File-private — only caller is
23+
`abs_prod_sub_prod_le` directly below. -/
24+
private lemma abs_prod_le_one {n : ℕ} (f : Fin n → ℝ) (hf : ∀ i, |f i| ≤ 1) : |∏ i, f i| ≤ 1 := by
2525
rw [Finset.abs_prod]
2626
have h1 : ∏ i, |f i| ≤ ∏ _i : Fin n, (1 : ℝ) := by
2727
apply Finset.prod_le_prod

0 commit comments

Comments
 (0)