math / data /lean /OAI /Combinatorics /InfiniteMatroid /FiniteCounting.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
2.12 kB
import Mathlib
namespace OAI
section
open Set
namespace InfiniteMatroidCounterexample
noncomputable def splitFunction {A B V : Type*} (e : A β†ͺ B) :
(B β†’ V) ≃ (A β†’ V) Γ— ({b : B // b βˆ‰ Set.range e} β†’ V) := by
classical
exact (Equiv.piEquivPiSubtypeProd (Β· ∈ Set.range e) (fun _ ↦ V)).trans
(Equiv.prodCongr ((Equiv.ofInjective e e.injective).arrowCongr (Equiv.refl V)).symm (Equiv.refl _))
@[simp] lemma splitFunction_fst {A B V : Type*} (e : A β†ͺ B) (f : B β†’ V) :
(splitFunction e f).1 = fun a ↦ f (e a) := rfl
lemma card_restriction {A B V : Type*} [Fintype A] [Fintype B] [DecidableEq A] [DecidableEq B] [Fintype V]
(e : A β†ͺ B) (P : (A β†’ V) β†’ Prop) [DecidablePred P] :
Fintype.card {f : B β†’ V // P (fun a ↦ f (e a))} =
Fintype.card {g : A β†’ V // P g} * Fintype.card V ^ (Fintype.card B - Fintype.card A) := by
classical
let fs := splitFunction (V := V) e
have he := (fs.subtypeEquiv (p := fun f ↦ P (fun a ↦ f (e a)))
(q := fun f ↦ P f.1) (fun f ↦ by simp [fs])).trans Equiv.prodSubtypeFstEquivSubtypeProd
have hc : Fintype.card {b : B // b ∈ Set.range e} = Fintype.card A :=
(Fintype.card_congr (Equiv.ofInjective e e.injective)).symm
rw [Fintype.card_congr he, Fintype.card_prod, Fintype.card_fun,
Fintype.card_subtype_compl, hc]
lemma function_density_restriction {A B : Type*} [Fintype A] [Fintype B] [DecidableEq A] [DecidableEq B]
(e : A β†ͺ B) (P : (A β†’ Bool) β†’ Prop) [DecidablePred P] :
(Fintype.card {f : B β†’ Bool // P (fun a ↦ f (e a))} : ℝ) / Fintype.card (B β†’ Bool) =
(Fintype.card {g : A β†’ Bool // P g} : ℝ) / Fintype.card (A β†’ Bool) := by
rw [card_restriction]
simp only [Fintype.card_fun, Fintype.card_bool, Nat.cast_mul, Nat.cast_pow, Nat.cast_ofNat]
have hle : Fintype.card A ≀ Fintype.card B := Fintype.card_le_of_injective e e.injective
have heq : (2:ℝ) ^ Fintype.card B = 2 ^ Fintype.card A * 2 ^ (Fintype.card B - Fintype.card A) := by
rw [← pow_add, Nat.add_sub_of_le hle]
rw [heq]
field_simp
end InfiniteMatroidCounterexample
end
end OAI