File: Mathlib/Combinatorics/Young/YoungDiagram.lean

full_name: YoungDiagram.cells
code: /-- A Young diagram is a finite collection of cells on the `ℕ × ℕ` grid such that whenever
a cell is present, so are all the ones above and to the left of it. Like matrices, an `(i, j)` cell
is a cell in row `i` and column `j`, where rows are enumerated downward and columns rightward.

Young diagrams are modeled as finite sets in `ℕ × ℕ` that are lower sets with respect to the
standard order on products. -/
@[ext]
structure YoungDiagram where
  /-- A finite set which represents a finite collection of cells on the `ℕ × ℕ` grid. -/
  cells : Finset (ℕ × ℕ)
  /-- Cells are up-left justified, witnessed by the fact that `cells` is a lower set in `ℕ × ℕ`. -/
  isLowerSet : IsLowerSet (cells : Set (ℕ × ℕ))
goal: Finset (ℕ × ℕ)

full_name: YoungDiagram
code: /-- A Young diagram is a finite collection of cells on the `ℕ × ℕ` grid such that whenever
a cell is present, so are all the ones above and to the left of it. Like matrices, an `(i, j)` cell
is a cell in row `i` and column `j`, where rows are enumerated downward and columns rightward.

Young diagrams are modeled as finite sets in `ℕ × ℕ` that are lower sets with respect to the
standard order on products. -/
@[ext]
structure YoungDiagram where
  /-- A finite set which represents a finite collection of cells on the `ℕ × ℕ` grid. -/
  cells : Finset (ℕ × ℕ)
  /-- Cells are up-left justified, witnessed by the fact that `cells` is a lower set in `ℕ × ℕ`. -/
  isLowerSet : IsLowerSet (cells : Set (ℕ × ℕ))
goal: Type

full_name: YoungDiagram.isLowerSet
code: /-- A Young diagram is a finite collection of cells on the `ℕ × ℕ` grid such that whenever
a cell is present, so are all the ones above and to the left of it. Like matrices, an `(i, j)` cell
is a cell in row `i` and column `j`, where rows are enumerated downward and columns rightward.

Young diagrams are modeled as finite sets in `ℕ × ℕ` that are lower sets with respect to the
standard order on products. -/
@[ext]
structure YoungDiagram where
  /-- A finite set which represents a finite collection of cells on the `ℕ × ℕ` grid. -/
  cells : Finset (ℕ × ℕ)
  /-- Cells are up-left justified, witnessed by the fact that `cells` is a lower set in `ℕ × ℕ`. -/
  isLowerSet : IsLowerSet (cells : Set (ℕ × ℕ))
goal: IsLowerSet ↑self.cells

full_name: YoungDiagram.instSetLikeProdNat
code: instance : SetLike YoungDiagram (ℕ × ℕ) 
goal: SetLike YoungDiagram (ℕ × ℕ)

full_name: YoungDiagram.mem_cells
code: @[simp]
theorem mem_cells {μ : YoungDiagram} (c : ℕ × ℕ) : c ∈ μ.cells ↔ c ∈ μ 
goal: c ∈ μ.cells ↔ c ∈ μ

full_name: YoungDiagram.mem_mk
code: @[simp]
theorem mem_mk (c : ℕ × ℕ) (cells) (isLowerSet) :
    c ∈ YoungDiagram.mk cells isLowerSet ↔ c ∈ cells 
goal: c ∈ { cells := cells, isLowerSet := isLowerSet } ↔ c ∈ cells

full_name: YoungDiagram.decidableMem
code: instance decidableMem (μ : YoungDiagram) : DecidablePred (· ∈ μ) 
goal: DecidablePred fun x => x ∈ μ

full_name: YoungDiagram.up_left_mem
code: /-- In "English notation", a Young diagram is drawn so that (i1, j1) ≤ (i2, j2)
    means (i1, j1) is weakly up-and-left of (i2, j2). -/
theorem up_left_mem (μ : YoungDiagram) {i1 i2 j1 j2 : ℕ} (hi : i1 ≤ i2) (hj : j1 ≤ j2)
    (hcell : (i2, j2) ∈ μ) : (i1, j1) ∈ μ 
goal: (i1, j1) ∈ μ

full_name: YoungDiagram.cells_subset_iff
code: @[simp]
theorem cells_subset_iff {μ ν : YoungDiagram} : μ.cells ⊆ ν.cells ↔ μ ≤ ν 
goal: μ.cells ⊆ ν.cells ↔ μ ≤ ν

full_name: YoungDiagram.cells_ssubset_iff
code: @[simp]
theorem cells_ssubset_iff {μ ν : YoungDiagram} : μ.cells ⊂ ν.cells ↔ μ < ν 
goal: μ.cells ⊂ ν.cells ↔ μ < ν

full_name: YoungDiagram.instSup
code: instance : Sup YoungDiagram 
goal: Sup YoungDiagram

full_name: YoungDiagram.cells_sup
code: @[simp]
theorem cells_sup (μ ν : YoungDiagram) : (μ ⊔ ν).cells = μ.cells ∪ ν.cells 
goal: (μ ⊔ ν).cells = μ.cells ∪ ν.cells

full_name: YoungDiagram.coe_sup
code: @[simp, norm_cast]
theorem coe_sup (μ ν : YoungDiagram) : ↑(μ ⊔ ν) = (μ ∪ ν : Set (ℕ × ℕ)) 
goal: ↑(μ ⊔ ν) = ↑μ ∪ ↑ν

full_name: YoungDiagram.mem_sup
code: @[simp]
theorem mem_sup {μ ν : YoungDiagram} {x : ℕ × ℕ} : x ∈ μ ⊔ ν ↔ x ∈ μ ∨ x ∈ ν 
goal: x ∈ μ ⊔ ν ↔ x ∈ μ ∨ x ∈ ν

full_name: YoungDiagram.instInf
code: instance : Inf YoungDiagram 
goal: Inf YoungDiagram

full_name: YoungDiagram.cells_inf
code: @[simp]
theorem cells_inf (μ ν : YoungDiagram) : (μ ⊓ ν).cells = μ.cells ∩ ν.cells 
goal: (μ ⊓ ν).cells = μ.cells ∩ ν.cells

full_name: YoungDiagram.coe_inf
code: @[simp, norm_cast]
theorem coe_inf (μ ν : YoungDiagram) : ↑(μ ⊓ ν) = (μ ∩ ν : Set (ℕ × ℕ)) 
goal: ↑(μ ⊓ ν) = ↑μ ∩ ↑ν

full_name: YoungDiagram.mem_inf
code: @[simp]
theorem mem_inf {μ ν : YoungDiagram} {x : ℕ × ℕ} : x ∈ μ ⊓ ν ↔ x ∈ μ ∧ x ∈ ν 
goal: x ∈ μ ⊓ ν ↔ x ∈ μ ∧ x ∈ ν

full_name: YoungDiagram.instOrderBot
code: /-- The empty Young diagram is (⊥ : young_diagram). -/
instance : OrderBot YoungDiagram 
goal: OrderBot YoungDiagram

full_name: YoungDiagram.cells_bot
code: @[simp]
theorem cells_bot : (⊥ : YoungDiagram).cells = ∅ 
goal: ⊥.cells = ∅

full_name: YoungDiagram.coe_bot
code: @[norm_cast]
theorem coe_bot : (⊥ : YoungDiagram).cells = (∅ : Set (ℕ × ℕ)) 
goal: ↑⊥.cells = ∅

full_name: YoungDiagram.not_mem_bot
code: @[simp]
theorem not_mem_bot (x : ℕ × ℕ) : x ∉ (⊥ : YoungDiagram) 
goal: x ∉ ⊥

full_name: YoungDiagram.instInhabited
code: instance : Inhabited YoungDiagram 
goal: Inhabited YoungDiagram

full_name: YoungDiagram.instDistribLattice
code: instance : DistribLattice YoungDiagram 
goal: DistribLattice YoungDiagram

full_name: YoungDiagram.card
code: /-- Cardinality of a Young diagram -/
protected abbrev card (μ : YoungDiagram) : ℕ 
goal: ℕ

full_name: YoungDiagram.transpose
code: /-- The `transpose` of a Young diagram is obtained by swapping i's with j's. -/
def transpose (μ : YoungDiagram) : YoungDiagram 
goal: YoungDiagram

full_name: YoungDiagram.mem_transpose
code: @[simp]
theorem mem_transpose {μ : YoungDiagram} {c : ℕ × ℕ} : c ∈ μ.transpose ↔ c.swap ∈ μ 
goal: c ∈ μ.transpose ↔ c.swap ∈ μ

full_name: YoungDiagram.transpose_transpose
code: @[simp]
theorem transpose_transpose (μ : YoungDiagram) : μ.transpose.transpose = μ 
goal: μ.transpose.transpose = μ

full_name: YoungDiagram.transpose_eq_iff_eq_transpose
code: theorem transpose_eq_iff_eq_transpose {μ ν : YoungDiagram} : μ.transpose = ν ↔ μ = ν.transpose 
goal: μ.transpose = ν ↔ μ = ν.transpose

full_name: YoungDiagram.transpose_eq_iff
code: @[simp]
theorem transpose_eq_iff {μ ν : YoungDiagram} : μ.transpose = ν.transpose ↔ μ = ν 
goal: μ.transpose = ν.transpose ↔ μ = ν

full_name: YoungDiagram.le_of_transpose_le
code: protected theorem le_of_transpose_le {μ ν : YoungDiagram} (h_le : μ.transpose ≤ ν) :
    μ ≤ ν.transpose 
goal: μ ≤ ν.transpose

full_name: YoungDiagram.transpose_le_iff
code: @[simp]
theorem transpose_le_iff {μ ν : YoungDiagram} : μ.transpose ≤ ν.transpose ↔ μ ≤ ν 
goal: μ.transpose ≤ ν.transpose ↔ μ ≤ ν

full_name: YoungDiagram.transpose_mono
code: @[mono]
protected theorem transpose_mono {μ ν : YoungDiagram} (h_le : μ ≤ ν) : μ.transpose ≤ ν.transpose 
goal: μ.transpose ≤ ν.transpose

full_name: YoungDiagram.transposeOrderIso_symm_apply
code: /-- Transposing Young diagrams is an `OrderIso`. -/
@[simps]
def transposeOrderIso : YoungDiagram ≃o YoungDiagram 
goal: (RelIso.symm YoungDiagram.transposeOrderIso) μ = μ.transpose

full_name: YoungDiagram.transposeOrderIso
code: /-- Transposing Young diagrams is an `OrderIso`. -/
@[simps]
def transposeOrderIso : YoungDiagram ≃o YoungDiagram 
goal: YoungDiagram ≃o YoungDiagram

full_name: YoungDiagram.transposeOrderIso_apply
code: /-- Transposing Young diagrams is an `OrderIso`. -/
@[simps]
def transposeOrderIso : YoungDiagram ≃o YoungDiagram 
goal: YoungDiagram.transposeOrderIso μ = μ.transpose

full_name: YoungDiagram.row
code: /-- The `i`-th row of a Young diagram consists of the cells whose first coordinate is `i`. -/
def row (μ : YoungDiagram) (i : ℕ) : Finset (ℕ × ℕ) 
goal: Finset (ℕ × ℕ)

full_name: YoungDiagram.mem_row_iff
code: theorem mem_row_iff {μ : YoungDiagram} {i : ℕ} {c : ℕ × ℕ} : c ∈ μ.row i ↔ c ∈ μ ∧ c.fst = i 
goal: c ∈ μ.row i ↔ c ∈ μ ∧ c.1 = i

full_name: YoungDiagram.mk_mem_row_iff
code: theorem mk_mem_row_iff {μ : YoungDiagram} {i j : ℕ} : (i, j) ∈ μ.row i ↔ (i, j) ∈ μ 
goal: (i, j) ∈ μ.row i ↔ (i, j) ∈ μ

full_name: YoungDiagram.exists_not_mem_row
code: protected theorem exists_not_mem_row (μ : YoungDiagram) (i : ℕ) : ∃ j, (i, j) ∉ μ 
goal: ∃ j, (i, j) ∉ μ

full_name: YoungDiagram.rowLen
code: /-- Length of a row of a Young diagram -/
def rowLen (μ : YoungDiagram) (i : ℕ) : ℕ 
goal: ℕ

full_name: YoungDiagram.mem_iff_lt_rowLen
code: theorem mem_iff_lt_rowLen {μ : YoungDiagram} {i j : ℕ} : (i, j) ∈ μ ↔ j < μ.rowLen i 
goal: (i, j) ∈ μ ↔ j < μ.rowLen i

full_name: YoungDiagram.row_eq_prod
code: theorem row_eq_prod {μ : YoungDiagram} {i : ℕ} : μ.row i = {i} ×ˢ Finset.range (μ.rowLen i) 
goal: μ.row i = {i} ×ˢ Finset.range (μ.rowLen i)

full_name: YoungDiagram.rowLen_eq_card
code: theorem rowLen_eq_card (μ : YoungDiagram) {i : ℕ} : μ.rowLen i = (μ.row i).card 
goal: μ.rowLen i = (μ.row i).card

full_name: YoungDiagram.rowLen_anti
code: @[mono]
theorem rowLen_anti (μ : YoungDiagram) (i1 i2 : ℕ) (hi : i1 ≤ i2) : μ.rowLen i2 ≤ μ.rowLen i1 
goal: μ.rowLen i2 ≤ μ.rowLen i1

full_name: YoungDiagram.col
code: /-- The `j`-th column of a Young diagram consists of the cells whose second coordinate is `j`. -/
def col (μ : YoungDiagram) (j : ℕ) : Finset (ℕ × ℕ) 
goal: Finset (ℕ × ℕ)

full_name: YoungDiagram.mem_col_iff
code: theorem mem_col_iff {μ : YoungDiagram} {j : ℕ} {c : ℕ × ℕ} : c ∈ μ.col j ↔ c ∈ μ ∧ c.snd = j 
goal: c ∈ μ.col j ↔ c ∈ μ ∧ c.2 = j

full_name: YoungDiagram.mk_mem_col_iff
code: theorem mk_mem_col_iff {μ : YoungDiagram} {i j : ℕ} : (i, j) ∈ μ.col j ↔ (i, j) ∈ μ 
goal: (i, j) ∈ μ.col j ↔ (i, j) ∈ μ

full_name: YoungDiagram.exists_not_mem_col
code: protected theorem exists_not_mem_col (μ : YoungDiagram) (j : ℕ) : ∃ i, (i, j) ∉ μ.cells 
goal: ∃ i, (i, j) ∉ μ.cells

full_name: YoungDiagram.colLen
code: /-- Length of a column of a Young diagram -/
def colLen (μ : YoungDiagram) (j : ℕ) : ℕ 
goal: ℕ

full_name: YoungDiagram.colLen_transpose
code: @[simp]
theorem colLen_transpose (μ : YoungDiagram) (j : ℕ) : μ.transpose.colLen j = μ.rowLen j 
goal: μ.transpose.colLen j = μ.rowLen j

full_name: YoungDiagram.rowLen_transpose
code: @[simp]
theorem rowLen_transpose (μ : YoungDiagram) (i : ℕ) : μ.transpose.rowLen i = μ.colLen i 
goal: μ.transpose.rowLen i = μ.colLen i

full_name: YoungDiagram.mem_iff_lt_colLen
code: theorem mem_iff_lt_colLen {μ : YoungDiagram} {i j : ℕ} : (i, j) ∈ μ ↔ i < μ.colLen j 
goal: (i, j) ∈ μ ↔ i < μ.colLen j

full_name: YoungDiagram.col_eq_prod
code: theorem col_eq_prod {μ : YoungDiagram} {j : ℕ} : μ.col j = Finset.range (μ.colLen j) ×ˢ {j} 
goal: μ.col j = Finset.range (μ.colLen j) ×ˢ {j}

full_name: YoungDiagram.colLen_eq_card
code: theorem colLen_eq_card (μ : YoungDiagram) {j : ℕ} : μ.colLen j = (μ.col j).card 
goal: μ.colLen j = (μ.col j).card

full_name: YoungDiagram.colLen_anti
code: @[mono]
theorem colLen_anti (μ : YoungDiagram) (j1 j2 : ℕ) (hj : j1 ≤ j2) : μ.colLen j2 ≤ μ.colLen j1 
goal: μ.colLen j2 ≤ μ.colLen j1

full_name: YoungDiagram.rowLens
code: /-- List of row lengths of a Young diagram -/
def rowLens (μ : YoungDiagram) : List ℕ 
goal: List ℕ

full_name: YoungDiagram.get_rowLens
code: @[simp]
theorem get_rowLens {μ : YoungDiagram} {i : Nat} {h : i < μ.rowLens.length} :
    μ.rowLens[i] = μ.rowLen i 
goal: μ.rowLens[i] = μ.rowLen i

full_name: YoungDiagram.length_rowLens
code: @[simp]
theorem length_rowLens {μ : YoungDiagram} : μ.rowLens.length = μ.colLen 0 
goal: μ.rowLens.length = μ.colLen 0

full_name: YoungDiagram.rowLens_sorted
code: theorem rowLens_sorted (μ : YoungDiagram) : μ.rowLens.Sorted (· ≥ ·) 
goal: List.Sorted (fun x x_1 => x ≥ x_1) μ.rowLens

full_name: YoungDiagram.pos_of_mem_rowLens
code: theorem pos_of_mem_rowLens (μ : YoungDiagram) (x : ℕ) (hx : x ∈ μ.rowLens) : 0 < x 
goal: 0 < x

full_name: YoungDiagram.cellsOfRowLens
code: /-- The cells making up a `YoungDiagram` from a list of row lengths -/
protected def cellsOfRowLens : List ℕ → Finset (ℕ × ℕ)
  
goal: List ℕ → Finset (ℕ × ℕ)

full_name: YoungDiagram.mem_cellsOfRowLens
code: protected theorem mem_cellsOfRowLens {w : List ℕ} {c : ℕ × ℕ} :
    c ∈ YoungDiagram.cellsOfRowLens w ↔ ∃ h : c.fst < w.length, c.snd < w.get ⟨c.fst, h⟩  
goal: c ∈ YoungDiagram.cellsOfRowLens w ↔ ∃ (h : c.1 < w.length), c.2 < w.get ⟨c.1, h⟩

full_name: YoungDiagram.ofRowLens
code: /-- Young diagram from a sorted list -/
def ofRowLens (w : List ℕ) (hw : w.Sorted (· ≥ ·)) : YoungDiagram 
goal: YoungDiagram

full_name: YoungDiagram.mem_ofRowLens
code: theorem mem_ofRowLens {w : List ℕ} {hw : w.Sorted (· ≥ ·)} {c : ℕ × ℕ} :
    c ∈ ofRowLens w hw ↔ ∃ h : c.fst < w.length, c.snd < w.get ⟨c.fst, h⟩ 
goal: c ∈ YoungDiagram.ofRowLens w hw ↔ ∃ (h : c.1 < w.length), c.2 < w.get ⟨c.1, h⟩

full_name: YoungDiagram.rowLens_length_ofRowLens
code: /-- The number of rows in `ofRowLens w hw` is the length of `w` -/
theorem rowLens_length_ofRowLens {w : List ℕ} {hw : w.Sorted (· ≥ ·)} (hpos : ∀ x ∈ w, 0 < x) :
    (ofRowLens w hw).rowLens.length = w.length 
goal: (YoungDiagram.ofRowLens w hw).rowLens.length = w.length

full_name: YoungDiagram.rowLen_ofRowLens
code: /-- The length of the `i`th row in `ofRowLens w hw` is the `i`th entry of `w` -/
theorem rowLen_ofRowLens {w : List ℕ} {hw : w.Sorted (· ≥ ·)} (i : Fin w.length) :
    (ofRowLens w hw).rowLen i = w.get i 
goal: (YoungDiagram.ofRowLens w hw).rowLen ↑i = w.get i

full_name: YoungDiagram.ofRowLens_to_rowLens_eq_self
code: /-- The left_inv direction of the equivalence -/
theorem ofRowLens_to_rowLens_eq_self {μ : YoungDiagram} : ofRowLens _ (rowLens_sorted μ) = μ 
goal: YoungDiagram.ofRowLens μ.rowLens ⋯ = μ

full_name: YoungDiagram.rowLens_ofRowLens_eq_self
code: /-- The right_inv direction of the equivalence -/
theorem rowLens_ofRowLens_eq_self {w : List ℕ} {hw : w.Sorted (· ≥ ·)} (hpos : ∀ x ∈ w, 0 < x) :
    (ofRowLens w hw).rowLens = w 
goal: (YoungDiagram.ofRowLens w hw).rowLens = w

full_name: YoungDiagram.equivListRowLens_apply_coe
code: /-- Equivalence between Young diagrams and weakly decreasing lists of positive natural numbers.
A Young diagram `μ` is equivalent to a list of row lengths. -/
@[simps]
def equivListRowLens : YoungDiagram ≃ { w : List ℕ // w.Sorted (· ≥ ·) ∧ ∀ x ∈ w, 0 < x } 
goal: ↑(YoungDiagram.equivListRowLens μ) = μ.rowLens

full_name: YoungDiagram.equivListRowLens
code: /-- Equivalence between Young diagrams and weakly decreasing lists of positive natural numbers.
A Young diagram `μ` is equivalent to a list of row lengths. -/
@[simps]
def equivListRowLens : YoungDiagram ≃ { w : List ℕ // w.Sorted (· ≥ ·) ∧ ∀ x ∈ w, 0 < x } 
goal: YoungDiagram ≃ { w // List.Sorted (fun x x_1 => x ≥ x_1) w ∧ ∀ x ∈ w, 0 < x }

full_name: YoungDiagram.equivListRowLens_symm_apply
code: /-- Equivalence between Young diagrams and weakly decreasing lists of positive natural numbers.
A Young diagram `μ` is equivalent to a list of row lengths. -/
@[simps]
def equivListRowLens : YoungDiagram ≃ { w : List ℕ // w.Sorted (· ≥ ·) ∧ ∀ x ∈ w, 0 < x } 
goal: YoungDiagram.equivListRowLens.symm ww = YoungDiagram.ofRowLens ↑ww ⋯