|
| 1 | +/- |
| 2 | +Copyright (c) 2022 Yaël Dillies. All rights reserved. |
| 3 | +Released under Apache 2.0 license as described in the file LICENSE. |
| 4 | +Authors: Yaël Dillies |
| 5 | +-/ |
| 6 | +import Mathlib.Order.Partition.Finpartition |
| 7 | +import LeanCamCombi.Mathlib.Data.Finset.Image |
| 8 | + |
| 9 | +/-! |
| 10 | +# Symmetric Chain Decompositions |
| 11 | +
|
| 12 | +This file shows that if `α` is finite then `Finset α` has a decomposition into symmetric chains, |
| 13 | +namely chains of the form `{Cᵢ, ..., Cₙ₋ᵢ}` where `card α = n` and `|C_j| = j`. |
| 14 | +-/ |
| 15 | + |
| 16 | +open Finset |
| 17 | + |
| 18 | +namespace Finpartition |
| 19 | +variable {α : Type*} [DecidableEq α] {𝒜 : Finset (Finset α)} {𝒞 𝒟 : Finset (Finset α)} |
| 20 | + {C s : Finset α} {a : α} |
| 21 | + |
| 22 | +def extendExchange (a : α) (𝒞 : Finset (Finset α)) (C : Finset α) : Finset (Finset (Finset α)) := |
| 23 | + if 𝒞.Nontrivial |
| 24 | + then {(𝒞 \ {C}).image (insert a), 𝒞 ∪ {insert a C}} |
| 25 | + else {𝒞 ∪ {insert a C}} |
| 26 | + |
| 27 | +lemma eq_or_eq_of_mem_extendExchange : |
| 28 | + 𝒟 ∈ extendExchange a 𝒞 C → 𝒟 = (𝒞 \ {C}).image (insert a) ∨ 𝒟 = 𝒞 ∪ {insert a C} := by |
| 29 | + unfold extendExchange; split_ifs with h𝒞 <;> simp (config := { contextual := true }) |
| 30 | + |
| 31 | +@[simp] lemma not_empty_mem_extendExchange : ∅ ∉ extendExchange a 𝒞 C := by |
| 32 | + unfold extendExchange |
| 33 | + split_ifs with h𝒞 |
| 34 | + · simp [eq_comm (a := ∅), ← nonempty_iff_ne_empty, h𝒞.nonempty.ne_empty, h𝒞.ne_singleton] |
| 35 | + · simp [eq_comm (a := ∅), ← nonempty_iff_ne_empty] |
| 36 | + |
| 37 | +@[simp] lemma sup_extendExchange (hC : C ∈ 𝒞) : |
| 38 | + (extendExchange a 𝒞 C).sup id = 𝒞 ∪ 𝒞.image (insert a) := by |
| 39 | + unfold extendExchange |
| 40 | + split_ifs with h𝒞 |
| 41 | + · simp only [sup_insert, id_eq, sup_singleton, sup_eq_union, union_left_comm] |
| 42 | + rw [image_sdiff_of_injOn, image_singleton, sdiff_union_of_subset] |
| 43 | + simpa using mem_image_of_mem _ hC |
| 44 | + sorry |
| 45 | + simpa |
| 46 | + · obtain rfl := (eq_singleton_or_nontrivial hC).resolve_right h𝒞 |
| 47 | + simp |
| 48 | + |
| 49 | +def extendPowersetExchange (P : Finpartition s.powerset) (f : ∀ 𝒞 ∈ P.parts, 𝒞) (a : α) |
| 50 | + (ha : a ∉ s) : Finpartition (s.cons a ha).powerset where |
| 51 | + |
| 52 | + -- ofErase |
| 53 | + -- (P.parts.attach.biUnion fun ⟨𝒞, h𝒞⟩ ↦ extendExchange a 𝒞 (f 𝒞 h𝒞).1) |
| 54 | + -- (by |
| 55 | + -- sorry |
| 56 | + -- ) |
| 57 | + -- (by |
| 58 | + -- simp |
| 59 | + -- ) |
| 60 | + |
| 61 | + parts := P.parts.attach.biUnion fun ⟨𝒞, h𝒞⟩ ↦ extendExchange a 𝒞 (f 𝒞 h𝒞).1 |
| 62 | + supIndep := by |
| 63 | + rw [Finset.supIndep_iff_pairwiseDisjoint] |
| 64 | + simp only [Set.PairwiseDisjoint, Set.Pairwise, Finset.coe_biUnion, Finset.mem_coe, |
| 65 | + Finset.mem_attach, Set.iUnion_true, Set.mem_iUnion, Subtype.exists, ne_eq, Function.onFun, |
| 66 | + id_eq, forall_exists_index, not_imp_comm] |
| 67 | + rintro x 𝒞 h𝒞 hx y 𝒟 h𝒟 hy hxy |
| 68 | + obtain rfl | rfl := eq_or_eq_of_mem_extendExchange hx <;> |
| 69 | + obtain rfl | rfl := eq_or_eq_of_mem_extendExchange hy |
| 70 | + · rw [disjoint_image'] at hxy |
| 71 | + obtain rfl := P.disjoint.elim h𝒞 h𝒟 fun h ↦ hxy $ h.mono sdiff_le sdiff_le |
| 72 | + rfl |
| 73 | + sorry |
| 74 | + · sorry |
| 75 | + · sorry |
| 76 | + · simp_rw [disjoint_union_left, disjoint_union_right, and_assoc] at hxy |
| 77 | + obtain rfl := P.disjoint.elim h𝒞 h𝒟 fun h ↦ hxy $ ⟨h, sorry, sorry, sorry⟩ |
| 78 | + rfl |
| 79 | + sup_parts := by |
| 80 | + ext C |
| 81 | + simp only [sup_biUnion, coe_mem, sup_extendExchange, mem_sup, mem_attach, mem_union, mem_image, |
| 82 | + true_and, Subtype.exists, exists_prop, cons_eq_insert, mem_powerset] |
| 83 | + constructor |
| 84 | + · rintro ⟨𝒞, h𝒞, hC | ⟨C, hC, rfl⟩⟩ |
| 85 | + · exact Subset.trans (mem_powerset.1 $ P.le h𝒞 hC) (subset_insert ..) |
| 86 | + · exact insert_subset_insert _ (mem_powerset.1 $ P.le h𝒞 hC) |
| 87 | + by_cases ha : a ∈ C |
| 88 | + · rw [subset_insert_iff] |
| 89 | + rintro hC |
| 90 | + obtain ⟨𝒞, h𝒞, hC⟩ := P.exists_mem $ mem_powerset.2 hC |
| 91 | + exact ⟨𝒞, h𝒞, .inr ⟨_, hC, insert_erase ha⟩⟩ |
| 92 | + · rw [subset_insert_iff_of_not_mem ha] |
| 93 | + rintro hC |
| 94 | + obtain ⟨𝒞, h𝒞, hC⟩ := P.exists_mem $ mem_powerset.2 hC |
| 95 | + exact ⟨𝒞, h𝒞, .inl hC⟩ |
| 96 | + not_bot_mem := by simp |
| 97 | + |
| 98 | +/-! ### Profile of a partition -/ |
| 99 | + |
| 100 | +/-- The profile of -/ |
| 101 | +def profile (P : Finpartition s) : Multiset ℕ := P.parts.1.map card |
| 102 | + |
| 103 | +end Finpartition |
0 commit comments