Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Exchangeability/Contractability.lean
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ theorem contractable_of_exchangeable {μ : Measure Ω} {X : ℕ → Ω → α}
have hexch := hX n σ

-- Define embedding and projection
let ι : Fin (m' + 1) → Fin n := fun i => ⟨i.val, Nat.lt_of_lt_of_le i.isLt hmn
let ι : Fin (m' + 1) → Fin n := Fin.castLE hmn
let proj : (Fin n → α) → (Fin (m' + 1) → α) := fun f i => f (ι i)

have hproj_meas : Measurable proj := by
Expand Down
16 changes: 5 additions & 11 deletions Exchangeability/Util/FinsetHelpers.lean
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,19 @@ The proof uses an explicit bijection between `Fin n` and the filtered set. -/
lemma filter_val_lt_card {m n : ℕ} (h : m ≥ n) :
(Finset.filter (fun i : Fin m => i.val < n) Finset.univ).card = n := by
-- Establish bijection with Fin n via the natural inclusion
let f : Fin n → Fin m := fun i => ⟨i.val, Nat.lt_of_lt_of_le i.isLt h⟩
let f : Fin n → Fin m := Fin.castLE h

have hf_inj : Function.Injective f := by
intros i j hij
exact Fin.ext (Fin.mk.injEq _ _ _ _ ▸ hij)
have hf_inj : Function.Injective f := Fin.castLE_injective h

have h_image : Finset.filter (fun i : Fin m => i.val < n) Finset.univ =
Finset.image f Finset.univ := by
ext i
simp only [mem_filter, mem_univ, true_and, mem_image]
constructor
· intro hi_lt
refine ⟨⟨i.val, hi_lt⟩, ?_⟩
simp only [f]
· intro ⟨j, hj_eq⟩
simp only [f] at hj_eq
calc i.val = (⟨j.val, _⟩ : Fin m).val := by rw [← hj_eq]
_ = j.val := rfl
_ < n := j.isLt
exact ⟨⟨i.val, hi_lt⟩, Fin.ext rfl⟩
· rintro ⟨j, rfl⟩
exact j.isLt

rw [h_image, card_image_of_injective _ hf_inj]
simp only [card_univ, Fintype.card_fin]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ We implement **all three proofs** from Kallenberg (2005) of the key implication

### Prerequisites

- [Lean 4](https://leanprover.github.io/lean4/doc/setup.html) (this project uses `lean-toolchain` pinned to 4.27.0-rc1)
- [Lean 4](https://leanprover.github.io/lean4/doc/setup.html) (see `lean-toolchain` for the pinned version)
- [elan](https://github.com/leanprover/elan) (Lean version manager)

### Installation
Expand Down