Download lean/OAI/NumberTheory/Jacobsthal/Estimates/FiniteSampleSpace.lean from roseking/openAI-math-dataset: direct link, hf CLI and curl.
- Browser
- Download file 2.22 kB
-
https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/NumberTheory/Jacobsthal/Estimates/FiniteSampleSpace.lean
- Command line
-
hf download hf://datasets/roseking/openAI-math-dataset/lean/OAI/NumberTheory/Jacobsthal/Estimates/FiniteSampleSpace.lean
-
curl -L -o FiniteSampleSpace.lean https://huggingface.co/datasets/roseking/openAI-math-dataset/resolve/main/lean/OAI/NumberTheory/Jacobsthal/Estimates/FiniteSampleSpace.lean
2.22 kB
Lean 4 · 7
declarations statementsfull
abbrev Sample {α : Type*} (U : Finset α) (h : ℕ) := Fin h ↪ U noncomputable def goodSamples {α : Type*} (U W : Finset α) (h : ℕ) : Finset (Sample U h) := by body · 2 lines
classical
exact Finset.univ.filter (fun e => ∀ i, (e i).val ∈ W)noncomputable def goodSampleEquiv {α : Type*} (U W : Finset α) (hWU : W ⊆ U) (h : ℕ) :
(goodSamples U W h) ≃ Sample W h where body · 26 lines
toFun e :=
{ toFun := fun i => ⟨(e.val i).val,(Finset.mem_filter.mp e.property).2 i⟩
inj' := by
intro i j he
apply e.val.injective
exact Subtype.ext (congrArg (fun x : W => x.val) he) }
invFun f :=
⟨{ toFun := fun i => ⟨(f i).val,hWU (f i).property⟩
inj' := by
intro i j he
apply f.injective
exact Subtype.ext (congrArg (fun x : U => x.val) he) },by
classical
apply Finset.mem_filter.mpr
exact ⟨Finset.mem_univ _,fun i => (f i).property⟩⟩
left_inv e := by
apply Subtype.ext
apply Function.Embedding.ext
intro i
apply Subtype.ext
rfl
right_inv f := by
apply Function.Embedding.ext
intro i
apply Subtype.ext
rfltheorem sample_card {α : Type*} (U : Finset α) (h : ℕ) :
Fintype.card (Sample U h) = U.card.descFactorial h := by proof · 2 lines
classical
simp only [Sample,Fintype.card_embedding_eq,Fintype.card_fin,Fintype.card_coe]theorem goodSamples_card {α : Type*} (U W : Finset α) (hWU : W ⊆ U) (h : ℕ) :
(goodSamples U W h).card = W.card.descFactorial h := by proof · 3 lines
classical
have hh := Fintype.card_congr (goodSampleEquiv U W hWU h)
simpa only [Fintype.card_coe,sample_card] using hhnoncomputable def sampleFrequency {α : Type*} (U W : Finset α) (h : ℕ) : ℝ := body · 1 line
((goodSamples U W h).card : ℝ)/(Fintype.card (Sample U h) : ℝ)theorem sampleFrequency_eq {α : Type*} (U W : Finset α) (hWU : W ⊆ U) (h : ℕ) :
sampleFrequency U W h = (W.card.descFactorial h : ℝ)/(U.card.descFactorial h : ℝ) := by proof · 1 line
rw [sampleFrequency,goodSamples_card U W hWU,sample_card]Outline