Lean / Reader
Lean reader

Erdos824Pairing.lean

49 lines2 declarationsno sorryimports Mathlib.Data.Fintype.Perm Mathlib.Data.Fintype.BigOperators Mathlib.Tactic
  1. import Mathlib.Data.Fintype.Perm
  2. import Mathlib.Data.Fintype.BigOperators
  3. import Mathlib.Tactic
  4. /-! Counting outputs of one ordinary-coordinate extension in the primitive-pair construction.
  5. Only the list of positions on each side survives in an output. A compatible bijection can send
  6. each index to at most b possible partners. -/
  7. namespace Erdos824Pairing
  8. open Finset
  9. open scoped BigOperators
  10. theorem compatible_count {α : Type*} [DecidableEq α] {k : ℕ} (a b : Fin k → α) (r : ℕ)
  11. (hc : ∀ x, (univ.filter fun i => b i = x).card ≤ r) :
  12. (univ.filter fun π : Equiv.Perm (Fin k) => ∀ i, a i = b (π i)).card ≤ r^k := by
  13. classical
  14. let choices (i : Fin k) := univ.filter fun j => b j = a i
  15. calc
  16. _ ≤ (Fintype.piFinset choices).card := by
  17. apply Finset.card_le_card_of_injOn (fun (π : Equiv.Perm (Fin k)) => (fun i => π i))
  18. · intro π hπ
  19. have h := (mem_filter.mp hπ).2
  20. exact Fintype.mem_piFinset.mpr fun i => mem_filter.mpr ⟨mem_univ _,(h i).symm⟩
  21. · intro π _ τ _ h
  22. exact Equiv.ext (fun i => congrFun h i)
  23. _ = ∏ i, (choices i).card := Fintype.card_piFinset _
  24. _ ≤ ∏ _i : Fin k, r := Finset.prod_le_prod fun i _ => hc (a i)
  25. _ = r^k := by simp
  26. /-- If every permutation has at least z realizations and each label occurs on at most
  27. r right positions, at least factorial(k) * z / r^k distinct outputs are required. -/
  28. theorem multiplicity_bound {α : Type*} [DecidableEq α] {k : ℕ}
  29. (O : Finset ((Fin k → α) × (Fin k → α))) (r z : ℕ)
  30. (hc : ∀ o∈O, ∀ x, (univ.filter fun i => o.2 i = x).card ≤ r)
  31. (hm : ∀ π : Equiv.Perm (Fin k), z ≤ (O.filter fun o => ∀ i, o.1 i = o.2 (π i)).card) :
  32. k.factorial * z ≤ O.card * r^k := by
  33. classical
  34. calc
  35. _ = ∑ _π : Equiv.Perm (Fin k), z := by simp [Fintype.card_perm]
  36. _ ≤ ∑ π : Equiv.Perm (Fin k), (O.filter fun o => ∀ i, o.1 i = o.2 (π i)).card :=
  37. Finset.sum_le_sum fun π _ => hm π
  38. _ = ∑ o ∈ O, (univ.filter fun π : Equiv.Perm (Fin k) => ∀ i, o.1 i = o.2 (π i)).card := by
  39. simp only [Finset.card_filter]
  40. exact Finset.sum_comm
  41. _ ≤ ∑ _o ∈ O, r^k := Finset.sum_le_sum fun o ho => compatible_count o.1 o.2 r (hc o ho)
  42. _ = _ := by simp
  43. #print axioms multiplicity_bound
  44. end Erdos824Pairing