Documentation

CslibFrontier.Foundations.Data.Matrix.Permanent.ZeroOne

The permanent of a 0/1 matrix #

The permanent of a matrix A : Matrix n n ℕ whose entries are all at most 1 is the number of permutations σ with A i (σ i) = 1 for every i, that is, the number of perfect matchings of the bipartite graph whose edges are the one-entries of A.

Boolean permutation matrices supported in an arbitrary relation are counted by the permutations respecting that relation (Matrix.card_filter_isPermMatrix).

Main results #

theorem Matrix.card_filter_isPermMatrix {n : ℕ} (r : Fin n → Fin n → Prop) [(i j : Fin n) → Decidable (r i j)] :
{M : Fin n → Fin n → Bool | (∀ (i : Fin n), ∃ (j : Fin n), M i j = true) ∧ (∀ (i j k : Fin n), M i j = true → M i k = true → j = k) ∧ (∀ (i k j : Fin n), M i j = true → M k j = true → i = k) ∧ ∀ (i j : Fin n), M i j = true → r i j}.card = {σ : Equiv.Perm (Fin n) | ∀ (i : Fin n), r i (σ i)}.card

Boolean permutation matrices count permutations. The Boolean n × n matrices with a true entry in every row, at most one in every row and column, and true entries only where r holds, are as many as the permutations σ with r i (σ i) for every i.

theorem Matrix.permanent_eq_card_filter_of_le_one {n : Type u_1} [Fintype n] [DecidableEq n] {A : Matrix n n ℕ} (hA : ∀ (i j : n), A i j ≤ 1) :
A.permanent = {σ : Equiv.Perm n | ∀ (i : n), A i (σ i) = 1}.card

The permanent of a 0/1 matrix counts the permutations along its one-entries.

theorem Matrix.permanent_ne_zero_iff_of_nonneg {n : Type u_1} [Fintype n] [DecidableEq n] {R : Type u_2} [CommSemiring R] [PartialOrder R] [IsOrderedRing R] [NoZeroDivisors R] [Nontrivial R] {A : Matrix n n R} (hA : ∀ (i j : n), 0 ≤ A i j) :
A.permanent ≠ 0 ↔ ∃ (σ : Equiv.Perm n), ∀ (i : n), A i (σ i) ≠ 0

The permanent of a nonnegative matrix is nonzero exactly on its support's matchings. Over an ordered semiring without zero divisors, a matrix with nonnegative entries has a nonzero permanent exactly when some permutation σ has A i (σ i) ≠ 0 for every i.