Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
252ab26
first attempt for proving sperner theorem
Dec 10, 2024
410ee70
Added the sketch for a second implementation of Sperner's Theorem usi…
Dec 16, 2024
b9ca0dc
Made new directory for Combinatorial results
Dec 16, 2024
f8bf564
small correction in assumptions for chain_extension
Dec 16, 2024
f83d729
Finished proof of chain_extension lemma
Dec 17, 2024
93db0f8
fix of application of the chain_extension lemma
Dec 17, 2024
d9591d7
Added short proofs for simple theorems regarding chains and changed s…
Jan 8, 2025
5b8ee3a
initialized induction for count_maxChainsThrough
Jan 17, 2025
e03e4a8
Added proposal definitions for chains in Finset namespace and rewritt…
Jan 17, 2025
65cd88b
worked on count_maxChainsThrough
Jan 17, 2025
ad6527d
cleaning up, outsourcing proof components and continuing work on coun…
Jan 18, 2025
5069d32
instead of .get and .get? use getElem with the get_elem_tactic
Jan 18, 2025
83f31a4
changed product notation in count_maxChainsThrough
Jan 18, 2025
8db27fc
continued work on count_maxChainsThrough
Jan 18, 2025
5c073af
added IsChain.card_strict_mono and beginning typeclass definitions
Jan 19, 2025
8787c5b
defining small decidable instances
Jan 23, 2025
b8a746b
working on incident_indices_monotone_cards
Jan 23, 2025
b37f021
using sorted list in induction
Jan 23, 2025
caa32e2
further progression with count_maxChainsThrough
Jan 23, 2025
c20dee1
working on coercion instances
Jan 24, 2025
95149f4
split the code into several files. Add two files to the ToMatlib folder
Jan 24, 2025
8976008
continuing restructuring and adding small lemmata for mathlib
Jan 28, 2025
ebb6bfb
adding sections in Chain.lean
Jan 28, 2025
03bb9a1
changed project structure and variable assumptions. Work directly on …
Jan 29, 2025
076c165
Added doc strings.
Feb 7, 2025
6b4343a
Completed doc strings.
Feb 7, 2025
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
98 changes: 98 additions & 0 deletions TheBook/Combinatorics/LYM.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import Mathlib.Tactic
import Mathlib.Combinatorics.Enumerative.DoubleCounting
import Mathlib.Combinatorics.Derangements.Finite
import Mathlib.Logic.Equiv.Defs
import Mathlib.Data.Set.Basic
import Mathlib.Data.Finset.Slice
import Mathlib.Order.Antichain
import Mathlib.Order.Chain
import Mathlib.Data.List.Perm.Basic
import TheBook.ToMathlib.Chain
import TheBook.ToMathlib.Antichain
import TheBook.ToMathlib.List
import TheBook.Combinatorics.SpernerHelpingDataStructures

/-!
# LYM

In this file we give the proof of the **Lubell-Yamamoto-Meshalkin inequality** as it is given in the book of the proofs.
Sperner's Theorem follows from this as a corollary (compare with Mathlib.Combinatorics.SetFamily.LYM).

## Main results
- `lym_inequality`: The sum of the proportional cardinalities of all slices of an antichain is at most '1'.
-/

open Function Finset Nat Set BigOperators List

variable {α : Type*} {n m : ℕ} [DecidableEq α] [Fintype α] {𝒜 : Set (Finset α)} [DecidablePred (· ∈ 𝒜)] [DecidableEq (Set (Finset α))]
instance : Fintype 𝒜 := setFintype 𝒜

namespace Finset

/-- The sum of the proportional cardinalities of all slices of an antichain is at most '1'. -/
theorem lym_inequality (antichain𝒜 : IsAntichain (· ⊂ ·) 𝒜) (hn : Fintype.card α = n):
∑ k ∈ Iic n, #(𝒜.toFinset # k) / (n.choose k : ℚ) ≤ (1 : ℚ) := by
have : ∑ k ∈ Iic n, #(𝒜.toFinset # k) / (n.choose k : ℚ) ≤ (∑ k ∈ Iic n, #(𝒜.toFinset # k) * (k)! * (n - k)!) * (1 / (n)! : ℚ) := by
calc
∑ k ∈ Iic n, #(𝒜.toFinset # k) / (n.choose k : ℚ) = ∑ k ∈ Iic n, #(𝒜.toFinset # k) * (k)! * (n - k)! * (1 / (n)! : ℚ) := by
apply Finset.sum_congr (by simp)
intro j jmem
simp at jmem
rw [div_eq_mul_inv, mul_assoc, mul_assoc, Nat.choose_eq_factorial_div_factorial]
congr
field_simp

have choose_divisibility (a b : ℕ) (h : a ≤ b) : ((a)! * (b - a)!) ∣ (b)! := by
use b.choose a
rw [Nat.mul_comm, ←Nat.mul_assoc]
exact (Nat.choose_mul_factorial_mul_factorial h).symm

rw [Nat.cast_div (choose_divisibility j n jmem), Nat.cast_mul]
· field_simp
· norm_num
constructor <;> apply Nat.factorial_ne_zero
· exact jmem
_ = (∑ k ∈ Iic n, #(𝒜.toFinset # k) * (k)! * (n - k)!) * (1 / (n)! : ℚ) := by simp [←Finset.sum_mul]
rfl

refine' le_trans this _
rw [mul_one_div]
apply (div_le_one (by simp [Nat.factorial_pos n])).mpr

norm_cast

have slice_partition : Finset.disjiUnion (Iic n) 𝒜.toFinset.slice (Finset.pairwiseDisjoint_slice.subset (Set.subset_univ _)) = 𝒜.toFinset := by
rw [Finset.disjiUnion_eq_biUnion (Iic n) 𝒜.toFinset.slice (Finset.pairwiseDisjoint_slice.subset (Set.subset_univ _))]
rw [←hn]
have := biUnion_slice 𝒜.toFinset
exact this

calc
∑ k ∈ Iic n, #(𝒜.toFinset # k) * (k)! * (n - k)! = ∑ k ∈ Iic n, ∑ e ∈ (𝒜.toFinset # k), (#e)! * (n - #e)! := by
apply Finset.sum_congr (by simp)
intro k _
have hq : ∀ e ∈ (𝒜.toFinset # k), (#e)! * (n - #e)! = (k)! * (n - k)! := by
intro e he
simp [slice] at he
rw [he.2]
rw [Finset.sum_congr rfl hq, Finset.sum_const]
ring
_ = ∑ e ∈ 𝒜, (#e)! * (n - #e)! := by
conv =>
rhs
rw [←slice_partition]
apply Eq.symm
apply sum_disjiUnion
_ = ∑ e ∈ 𝒜, Fintype.card (MaxChainThrough {e}) := by
apply Finset.sum_congr (by simp)
intro e _
apply Eq.symm
exact count_maxChains_through_singleton e hn
_ = ∑ e ∈ 𝒜, #((Finset.univ : Finset (MaxChainThrough {e})).image (emb_MaxChainThrough {e})) := by
apply Finset.sum_congr (by simp)
intro e e_mem
rw [Finset.card_image_of_injective (Finset.univ : Finset (MaxChainThrough {e})) inj_emb_MaxChainThrough, Finset.card_univ]
_ = #(𝒜.toFinset.disjiUnion (fun e : Finset α ↦ (Finset.univ : Finset (MaxChainThrough {e})).image (emb_MaxChainThrough {e})) (by simp [AntiChain.disj_union_chain_through antichain𝒜])) := by

sorry
_ ≤ (n)! := by sorry
Loading