File: Mathlib/LinearAlgebra/Matrix/Block.lean

full_name: Matrix.BlockTriangular
code: /-- Let `b` map rows and columns of a square matrix `M` to blocks indexed by `α`s. Then
`BlockTriangular M n b` says the matrix is block triangular. -/
def BlockTriangular (M : Matrix m m R) (b : m → α) : Prop 
goal: Prop

full_name: Matrix.BlockTriangular.submatrix
code: @[simp]
protected theorem BlockTriangular.submatrix {f : n → m} (h : M.BlockTriangular b) :
    (M.submatrix f f).BlockTriangular (b ∘ f) 
goal: (M.submatrix f f).BlockTriangular (b ∘ f)

full_name: Matrix.blockTriangular_reindex_iff
code: theorem blockTriangular_reindex_iff {b : n → α} {e : m ≃ n} :
    (reindex e e M).BlockTriangular b ↔ M.BlockTriangular (b ∘ e) 
goal: ((Matrix.reindex e e) M).BlockTriangular b ↔ M.BlockTriangular (b ∘ ⇑e)

full_name: Matrix.BlockTriangular.transpose
code: protected theorem BlockTriangular.transpose :
    M.BlockTriangular b → Mᵀ.BlockTriangular (toDual ∘ b) 
goal: M.BlockTriangular b → Mᵀ.BlockTriangular (⇑OrderDual.toDual ∘ b)

full_name: Matrix.blockTriangular_transpose_iff
code: @[simp]
protected theorem blockTriangular_transpose_iff {b : m → αᵒᵈ} :
    Mᵀ.BlockTriangular b ↔ M.BlockTriangular (ofDual ∘ b) 
goal: Mᵀ.BlockTriangular b ↔ M.BlockTriangular (⇑OrderDual.ofDual ∘ b)

full_name: Matrix.blockTriangular_zero
code: @[simp]
theorem blockTriangular_zero : BlockTriangular (0 : Matrix m m R) b 
goal: Matrix.BlockTriangular 0 b

full_name: Matrix.BlockTriangular.neg
code: protected theorem BlockTriangular.neg (hM : BlockTriangular M b) : BlockTriangular (-M) b 
goal: (-M).BlockTriangular b

full_name: Matrix.BlockTriangular.add
code: theorem BlockTriangular.add (hM : BlockTriangular M b) (hN : BlockTriangular N b) :
    BlockTriangular (M + N) b 
goal: (M + N).BlockTriangular b

full_name: Matrix.BlockTriangular.sub
code: theorem BlockTriangular.sub (hM : BlockTriangular M b) (hN : BlockTriangular N b) :
    BlockTriangular (M - N) b 
goal: (M - N).BlockTriangular b

full_name: Matrix.blockTriangular_diagonal
code: theorem blockTriangular_diagonal [DecidableEq m] (d : m → R) : BlockTriangular (diagonal d) b 
goal: (Matrix.diagonal d).BlockTriangular b

full_name: Matrix.blockTriangular_blockDiagonal'
code: theorem blockTriangular_blockDiagonal' [DecidableEq α] (d : ∀ i : α, Matrix (m' i) (m' i) R) :
    BlockTriangular (blockDiagonal' d) Sigma.fst 
goal: (Matrix.blockDiagonal' d).BlockTriangular Sigma.fst

full_name: Matrix.blockTriangular_blockDiagonal
code: theorem blockTriangular_blockDiagonal [DecidableEq α] (d : α → Matrix m m R) :
    BlockTriangular (blockDiagonal d) Prod.snd 
goal: (Matrix.blockDiagonal d).BlockTriangular Prod.snd

full_name: Matrix.blockTriangular_one
code: theorem blockTriangular_one : BlockTriangular (1 : Matrix m m R) b 
goal: Matrix.BlockTriangular 1 b

full_name: Matrix.blockTriangular_stdBasisMatrix
code: theorem blockTriangular_stdBasisMatrix {i j : m} (hij : b i ≤ b j) (c : R) :
    BlockTriangular (stdBasisMatrix i j c) b 
goal: (Matrix.stdBasisMatrix i j c).BlockTriangular b

full_name: Matrix.blockTriangular_stdBasisMatrix'
code: theorem blockTriangular_stdBasisMatrix' {i j : m} (hij : b j ≤ b i) (c : R) :
    BlockTriangular (stdBasisMatrix i j c) (toDual ∘ b) 
goal: (Matrix.stdBasisMatrix i j c).BlockTriangular (⇑OrderDual.toDual ∘ b)

full_name: Matrix.blockTriangular_transvection
code: theorem blockTriangular_transvection {i j : m} (hij : b i ≤ b j) (c : R) :
    BlockTriangular (transvection i j c) b 
goal: (Matrix.transvection i j c).BlockTriangular b

full_name: Matrix.blockTriangular_transvection'
code: theorem blockTriangular_transvection' {i j : m} (hij : b j ≤ b i) (c : R) :
    BlockTriangular (transvection i j c) (OrderDual.toDual ∘ b) 
goal: (Matrix.transvection i j c).BlockTriangular (⇑OrderDual.toDual ∘ b)

full_name: Matrix.BlockTriangular.mul
code: theorem BlockTriangular.mul [Fintype m] {M N : Matrix m m R} (hM : BlockTriangular M b)
    (hN : BlockTriangular N b) : BlockTriangular (M * N) b 
goal: (M * N).BlockTriangular b

full_name: Matrix.upper_two_blockTriangular
code: theorem upper_two_blockTriangular [Preorder α] (A : Matrix m m R) (B : Matrix m n R)
    (D : Matrix n n R) {a b : α} (hab : a < b) :
    BlockTriangular (fromBlocks A B 0 D) (Sum.elim (fun _ => a) fun _ => b) 
goal: (Matrix.fromBlocks A B 0 D).BlockTriangular (Sum.elim (fun x => a) fun x => b)

full_name: Matrix.equiv_block_det
code: theorem equiv_block_det (M : Matrix m m R) {p q : m → Prop} [DecidablePred p] [DecidablePred q]
    (e : ∀ x, q x ↔ p x) : (toSquareBlockProp M p).det = (toSquareBlockProp M q).det 
goal: (M.toSquareBlockProp p).det = (M.toSquareBlockProp q).det

full_name: Matrix.det_toSquareBlock_id
code: theorem det_toSquareBlock_id (M : Matrix m m R) (i : m) : (M.toSquareBlock id i).det = M i i 
goal: (M.toSquareBlock id i).det = M i i

full_name: Matrix.det_toBlock
code: theorem det_toBlock (M : Matrix m m R) (p : m → Prop) [DecidablePred p] :
    M.det =
      (fromBlocks (toBlock M p p) (toBlock M p fun j => ¬p j) (toBlock M (fun j => ¬p j) p) <|
          toBlock M (fun j => ¬p j) fun j => ¬p j).det 
goal: M.det =
  (Matrix.fromBlocks (M.toBlock p p) (M.toBlock p fun j => ¬p j) (M.toBlock (fun j => ¬p j) p)
      (M.toBlock (fun j => ¬p j) fun j => ¬p j)).det

full_name: Matrix.twoBlockTriangular_det
code: theorem twoBlockTriangular_det (M : Matrix m m R) (p : m → Prop) [DecidablePred p]
    (h : ∀ i, ¬p i → ∀ j, p j → M i j = 0) :
    M.det = (toSquareBlockProp M p).det * (toSquareBlockProp M fun i => ¬p i).det 
goal: M.det = (M.toSquareBlockProp p).det * (M.toSquareBlockProp fun i => ¬p i).det

full_name: Matrix.twoBlockTriangular_det'
code: theorem twoBlockTriangular_det' (M : Matrix m m R) (p : m → Prop) [DecidablePred p]
    (h : ∀ i, p i → ∀ j, ¬p j → M i j = 0) :
    M.det = (toSquareBlockProp M p).det * (toSquareBlockProp M fun i => ¬p i).det 
goal: M.det = (M.toSquareBlockProp p).det * (M.toSquareBlockProp fun i => ¬p i).det

full_name: Matrix.BlockTriangular.det
code: protected theorem BlockTriangular.det [DecidableEq α] [LinearOrder α] (hM : BlockTriangular M b) :
    M.det = ∏ a ∈ univ.image b, (M.toSquareBlock b a).det 
goal: M.det = ∏ a ∈ Finset.image b Finset.univ, (M.toSquareBlock b a).det

full_name: Matrix.BlockTriangular.det_fintype
code: theorem BlockTriangular.det_fintype [DecidableEq α] [Fintype α] [LinearOrder α]
    (h : BlockTriangular M b) : M.det = ∏ k : α, (M.toSquareBlock b k).det 
goal: M.det = ∏ k : α, (M.toSquareBlock b k).det

full_name: Matrix.det_of_upperTriangular
code: theorem det_of_upperTriangular [LinearOrder m] (h : M.BlockTriangular id) :
    M.det = ∏ i : m, M i i 
goal: M.det = ∏ i : m, M i i

full_name: Matrix.det_of_lowerTriangular
code: theorem det_of_lowerTriangular [LinearOrder m] (M : Matrix m m R) (h : M.BlockTriangular toDual) :
    M.det = ∏ i : m, M i i 
goal: M.det = ∏ i : m, M i i

full_name: Matrix.matrixOfPolynomials_blockTriangular
code: theorem matrixOfPolynomials_blockTriangular {n : ℕ} (p : Fin n → R[X])
    (h_deg : ∀ i, (p i).natDegree ≤ i) :
    Matrix.BlockTriangular (Matrix.of (fun (i j : Fin n) => (p j).coeff i)) id 
goal: (Matrix.of fun i j => (p j).coeff ↑i).BlockTriangular id

full_name: Matrix.det_matrixOfPolynomials
code: theorem det_matrixOfPolynomials {n : ℕ} (p : Fin n → R[X])
    (h_deg : ∀ i, (p i).natDegree = i) (h_monic : ∀ i, Monic <| p i) :
    (Matrix.of (fun (i j : Fin n) => (p j).coeff i)).det = 1 
goal: (Matrix.of fun i j => (p j).coeff ↑i).det = 1

full_name: Matrix.BlockTriangular.toBlock_inverse_mul_toBlock_eq_one
code: theorem BlockTriangular.toBlock_inverse_mul_toBlock_eq_one [LinearOrder α] [Invertible M]
    (hM : BlockTriangular M b) (k : α) :
    ((M⁻¹.toBlock (fun i => b i < k) fun i => b i < k) *
        M.toBlock (fun i => b i < k) fun i => b i < k) =
      1 
goal: ((M⁻¹.toBlock (fun i => b i < k) fun i => b i < k) * M.toBlock (fun i => b i < k) fun i => b i < k) = 1

full_name: Matrix.BlockTriangular.inv_toBlock
code: /-- The inverse of an upper-left subblock of a block-triangular matrix `M` is the upper-left
subblock of `M⁻¹`. -/
theorem BlockTriangular.inv_toBlock [LinearOrder α] [Invertible M] (hM : BlockTriangular M b)
    (k : α) :
    (M.toBlock (fun i => b i < k) fun i => b i < k)⁻¹ =
      M⁻¹.toBlock (fun i => b i < k) fun i => b i < k 
goal: (M.toBlock (fun i => b i < k) fun i => b i < k)⁻¹ = M⁻¹.toBlock (fun i => b i < k) fun i => b i < k

full_name: Matrix.BlockTriangular.invertibleToBlock
code: /-- An upper-left subblock of an invertible block-triangular matrix is invertible. -/
def BlockTriangular.invertibleToBlock [LinearOrder α] [Invertible M] (hM : BlockTriangular M b)
    (k : α) : Invertible (M.toBlock (fun i => b i < k) fun i => b i < k) 
goal: Invertible (M.toBlock (fun i => b i < k) fun i => b i < k)

full_name: Matrix.toBlock_inverse_eq_zero
code: /-- A lower-left subblock of the inverse of a block-triangular matrix is zero. This is a first step
towards `BlockTriangular.inv_toBlock` below. -/
theorem toBlock_inverse_eq_zero [LinearOrder α] [Invertible M] (hM : BlockTriangular M b) (k : α) :
    (M⁻¹.toBlock (fun i => k ≤ b i) fun i => b i < k) = 0 
goal: (M⁻¹.toBlock (fun i => k ≤ b i) fun i => b i < k) = 0

full_name: Matrix.blockTriangular_inv_of_blockTriangular
code: /-- The inverse of a block-triangular matrix is block-triangular. -/
theorem blockTriangular_inv_of_blockTriangular [LinearOrder α] [Invertible M]
    (hM : BlockTriangular M b) : BlockTriangular M⁻¹ b 
goal: M⁻¹.BlockTriangular b