Documentation

Mathlib.LinearAlgebra.Matrix.Stochastic

Row- and Column-stochastic matrices #

A square matrix M is row-stochastic if all its entries are non-negative and M *แตฅ 1 = 1. Likewise, M is column-stochastic if all its entries are non-negative and 1 แตฅ* M = 1. This file defines these concepts and provides basic API for them.

Note that doubly stochastic matrices (i.e. matrices that are both row- and column-stochastic) are defined in Mathlib/Analysis/Convex/DoublyStochasticMatrix.lean.

Main definitions #

A square matrix is row stochastic iff all entries are nonnegative, and right multiplication by the vector of all 1s gives the vector of all 1s.

Equations
    Instances For
      theorem Matrix.mem_rowStochastic {R : Type u_1} {n : Type u_2} [Fintype n] [DecidableEq n] [Semiring R] [PartialOrder R] [IsOrderedRing R] {M : Matrix n n R} :
      M โˆˆ rowStochastic R n โ†” (โˆ€ (i j : n), 0 โ‰ค M i j) โˆง M.mulVec 1 = 1
      theorem Matrix.mem_rowStochastic_iff_sum {R : Type u_1} {n : Type u_2} [Fintype n] [DecidableEq n] [Semiring R] [PartialOrder R] [IsOrderedRing R] {M : Matrix n n R} :
      M โˆˆ rowStochastic R n โ†” (โˆ€ (i j : n), 0 โ‰ค M i j) โˆง โˆ€ (i : n), โˆ‘ j : n, M i j = 1

      A square matrix is row stochastic if each element is non-negative and row sums to one.

      theorem Matrix.nonneg_of_mem_rowStochastic {R : Type u_1} {n : Type u_2} [Fintype n] [DecidableEq n] [Semiring R] [PartialOrder R] [IsOrderedRing R] {M : Matrix n n R} (hM : M โˆˆ rowStochastic R n) {i j : n} :
      0 โ‰ค M i j

      Every entry of a row stochastic matrix is nonnegative.

      theorem Matrix.sum_row_of_mem_rowStochastic {R : Type u_1} {n : Type u_2} [Fintype n] [DecidableEq n] [Semiring R] [PartialOrder R] [IsOrderedRing R] {M : Matrix n n R} (hM : M โˆˆ rowStochastic R n) (i : n) :
      โˆ‘ j : n, M i j = 1

      Each row sum of a row stochastic matrix is 1.

      theorem Matrix.one_vecMul_of_mem_rowStochastic {R : Type u_1} {n : Type u_2} [Fintype n] [DecidableEq n] [Semiring R] [PartialOrder R] [IsOrderedRing R] {M : Matrix n n R} (hM : M โˆˆ rowStochastic R n) :
      M.mulVec 1 = 1

      The all-ones column vector multiplied with a row stochastic matrix is 1.

      theorem Matrix.le_one_of_mem_rowStochastic {R : Type u_1} {n : Type u_2} [Fintype n] [DecidableEq n] [Semiring R] [PartialOrder R] [IsOrderedRing R] {M : Matrix n n R} (hM : M โˆˆ rowStochastic R n) {i j : n} :
      M i j โ‰ค 1

      Every entry of a row stochastic matrix is less than or equal to 1.

      theorem Matrix.nonneg_vecMul_of_mem_rowStochastic {R : Type u_1} {n : Type u_2} [Fintype n] [DecidableEq n] [Semiring R] [PartialOrder R] [IsOrderedRing R] {M : Matrix n n R} {x : n โ†’ R} (hM : M โˆˆ rowStochastic R n) (hx : โˆ€ (i : n), 0 โ‰ค x i) (j : n) :

      Left multiplication of a row stochastic matrix by a non-negative vector gives a non-negative vector

      theorem Matrix.nonneg_mulVec_of_mem_rowStochastic {R : Type u_1} {n : Type u_2} [Fintype n] [DecidableEq n] [Semiring R] [PartialOrder R] [IsOrderedRing R] {M : Matrix n n R} {x : n โ†’ R} (hM : M โˆˆ rowStochastic R n) (hx : โˆ€ (i : n), 0 โ‰ค x i) (j : n) :

      Right multiplication of a row stochastic matrix by a non-negative vector gives a non-negative vector

      theorem Matrix.vecMul_dotProduct_one_eq_one_rowStochastic {R : Type u_1} {n : Type u_2} [Fintype n] [DecidableEq n] [Semiring R] [PartialOrder R] [IsOrderedRing R] {M : Matrix n n R} {x : n โ†’ R} (hM : M โˆˆ rowStochastic R n) (hx : x โฌแตฅ 1 = 1) :

      Left left-multiplication by row stochastic preserves โ„“โ‚ norm

      theorem Matrix.convex_rowStochastic {R : Type u_1} {n : Type u_2} [Fintype n] [DecidableEq n] [Semiring R] [PartialOrder R] [IsOrderedRing R] :
      Convex R โ†‘(rowStochastic R n)

      The set of row stochastic matrices is convex.

      @[simp]

      Any permutation matrix is row stochastic.

      A square matrix is column stochastic iff all entries are nonnegative, and left multiplication by the vector of all 1s gives the vector of all 1s.

      Equations
        Instances For
          theorem Matrix.mem_colStochastic {R : Type u_1} {n : Type u_2} [Fintype n] [DecidableEq n] [Semiring R] [PartialOrder R] [IsOrderedRing R] {M : Matrix n n R} :
          M โˆˆ colStochastic R n โ†” (โˆ€ (i j : n), 0 โ‰ค M i j) โˆง vecMul 1 M = 1
          theorem Matrix.mem_colStochastic_iff_sum {R : Type u_1} {n : Type u_2} [Fintype n] [DecidableEq n] [Semiring R] [PartialOrder R] [IsOrderedRing R] {M : Matrix n n R} :
          M โˆˆ colStochastic R n โ†” (โˆ€ (i j : n), 0 โ‰ค M i j) โˆง โˆ€ (j : n), โˆ‘ i : n, M i j = 1

          A matrix is column stochastic if each column sums to one.

          theorem Matrix.nonneg_of_mem_colStochastic {R : Type u_1} {n : Type u_2} [Fintype n] [DecidableEq n] [Semiring R] [PartialOrder R] [IsOrderedRing R] {M : Matrix n n R} (hM : M โˆˆ colStochastic R n) {i j : n} :
          0 โ‰ค M i j

          Every entry of a column stochastic matrix is nonnegative.

          theorem Matrix.sum_col_of_mem_colStochastic {R : Type u_1} {n : Type u_2} [Fintype n] [DecidableEq n] [Semiring R] [PartialOrder R] [IsOrderedRing R] {M : Matrix n n R} (hM : M โˆˆ colStochastic R n) (i : n) :
          โˆ‘ j : n, M j i = 1

          Each column sum of a column stochastic matrix is 1.

          theorem Matrix.one_vecMul_of_mem_colStochastic {R : Type u_1} {n : Type u_2} [Fintype n] [DecidableEq n] [Semiring R] [PartialOrder R] [IsOrderedRing R] {M : Matrix n n R} (hM : M โˆˆ colStochastic R n) :
          vecMul 1 M = 1

          The all-ones column vector multiplied with a column stochastic matrix is 1.

          theorem Matrix.le_one_of_mem_colStochastic {R : Type u_1} {n : Type u_2} [Fintype n] [DecidableEq n] [Semiring R] [PartialOrder R] [IsOrderedRing R] {M : Matrix n n R} (hM : M โˆˆ colStochastic R n) {i j : n} :
          M j i โ‰ค 1

          Every entry of a column stochastic matrix is less than or equal to 1.

          theorem Matrix.nonneg_mulVec_of_mem_colStochastic {R : Type u_1} {n : Type u_2} [Fintype n] [DecidableEq n] [Semiring R] [PartialOrder R] [IsOrderedRing R] {M : Matrix n n R} {x : n โ†’ R} (hM : M โˆˆ colStochastic R n) (hx : โˆ€ (i : n), 0 โ‰ค x i) (j : n) :

          Right multiplication of a column stochastic matrix by a non-negative vector gives a non-negative vector.

          theorem Matrix.nonneg_vecMul_of_mem_colStochastic {R : Type u_1} {n : Type u_2} [Fintype n] [DecidableEq n] [Semiring R] [PartialOrder R] [IsOrderedRing R] {M : Matrix n n R} {x : n โ†’ R} (hM : M โˆˆ colStochastic R n) (hx : โˆ€ (i : n), 0 โ‰ค x i) (j : n) :

          Left multiplication of a column stochastic matrix by a non-negative vector gives a non-negative vector.

          theorem Matrix.mulVec_dotProduct_one_eq_one_colStochastic {R : Type u_1} {n : Type u_2} [Fintype n] [DecidableEq n] [Semiring R] [PartialOrder R] [IsOrderedRing R] {M : Matrix n n R} {x : n โ†’ R} (hM : M โˆˆ colStochastic R n) (hx : 1 โฌแตฅ x = 1) :

          Left left-multiplication by column stochastic preserves โ„“โ‚ norm

          theorem Matrix.sum_mulVec_of_mem_colStochastic {R : Type u_1} {n : Type u_2} [Fintype n] [DecidableEq n] [Semiring R] [PartialOrder R] [IsOrderedRing R] {M : Matrix n n R} {x : n โ†’ R} (hA : M โˆˆ colStochastic R n) :
          โˆ‘ i : n, M.mulVec x i = โˆ‘ i : n, x i

          Applying a column-stochastic matrix to a vector preserves its sum.

          theorem Matrix.convex_colStochastic {R : Type u_1} {n : Type u_2} [Fintype n] [DecidableEq n] [Semiring R] [PartialOrder R] [IsOrderedRing R] :
          Convex R โ†‘(colStochastic R n)

          The set of column stochastic matrices is convex.

          @[simp]

          Any permutation matrix is column stochastic.

          The transpose of a matrix is row stochastic matrix if it is column stochastic.

          The transpose of a matrix is column stochastic matrix if it is row stochastic.

          theorem Matrix.reindex_mem_rowStochastic {R : Type u_1} {n : Type u_2} [Fintype n] [DecidableEq n] [Semiring R] [PartialOrder R] [IsOrderedRing R] {m : Type u_3} [Fintype m] [DecidableEq m] {M : Matrix n n R} {eโ‚ eโ‚‚ : n โ‰ƒ m} (hM : M โˆˆ rowStochastic R n) :
          (reindex eโ‚ eโ‚‚) M โˆˆ rowStochastic R m

          Reindexing a matrix preserves row-stochasticity.

          theorem Matrix.reindex_mem_rowStochastic_iff {R : Type u_1} {n : Type u_2} [Fintype n] [DecidableEq n] [Semiring R] [PartialOrder R] [IsOrderedRing R] {m : Type u_3} [Fintype m] [DecidableEq m] {M : Matrix n n R} {eโ‚ eโ‚‚ : n โ‰ƒ m} :
          (reindex eโ‚ eโ‚‚) M โˆˆ rowStochastic R m โ†” M โˆˆ rowStochastic R n

          Reindexing a matrix preserves row-stochasticity.

          theorem Matrix.reindex_mem_colStochastic_iff {R : Type u_1} {n : Type u_2} [Fintype n] [DecidableEq n] [Semiring R] [PartialOrder R] [IsOrderedRing R] {m : Type u_3} [Fintype m] [DecidableEq m] {M : Matrix n n R} {eโ‚ eโ‚‚ : n โ‰ƒ m} :
          (reindex eโ‚ eโ‚‚) M โˆˆ colStochastic R m โ†” M โˆˆ colStochastic R n

          Reindexing a matrix preserves column-stochasticity.

          theorem Matrix.reindex_mem_colStochastic {R : Type u_1} {n : Type u_2} [Fintype n] [DecidableEq n] [Semiring R] [PartialOrder R] [IsOrderedRing R] {m : Type u_3} [Fintype m] [DecidableEq m] {M : Matrix n n R} {eโ‚ eโ‚‚ : n โ‰ƒ m} :
          M โˆˆ colStochastic R n โ†’ (reindex eโ‚ eโ‚‚) M โˆˆ colStochastic R m

          Reindexing a matrix preserves column-stochasticity.