File size: 2,123 Bytes
4a56cd6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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