File size: 1,863 Bytes
cdec422 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | import OAI.LinearAlgebra.MatrixMultiplication.FieldParameters.Weights
import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexFiniteEntropy
namespace OAI
/-! Fixed rational distributions and their entropy and capacity formulas. -/
namespace MatrixMultiplication.AllFieldParameters
open MatrixMultiplication.Foundation
open scoped BigOperators
noncomputable section
def homogeneousEntropy {A : Type*} [Fintype A] (p : A → ℝ) : ℝ :=
(∑ a, p a) * Real.log (∑ a, p a) + finiteEntropy p
theorem homogeneousEntropy_normalized {A : Type*} [Fintype A]
(p : A → ℝ) (hp : ∑ a, p a = 1) :
homogeneousEntropy p = finiteEntropy p := by
simp [homogeneousEntropy, hp]
theorem entropyTerm_divide (x m : ℝ) :
entropyTerm (x / m) = entropyTerm x / m + (x / m) * Real.log m := by
by_cases hx : x = 0
· simp [hx]
by_cases hm : m = 0
· simp [hm]
rw [entropyTerm, Real.log_div hx hm]
unfold entropyTerm
ring
theorem homogeneousEntropy_eq_mass_mul {A : Type*} [Fintype A]
(p : A → ℝ) (hm : ∑ a, p a ≠ 0) :
homogeneousEntropy p =
(∑ a, p a) * finiteEntropy (fun a => p a / ∑ b, p b) := by
simp only [finiteEntropy, entropyTerm_divide, Finset.sum_add_distrib,
← Finset.sum_div, ← Finset.sum_mul]
unfold homogeneousEntropy finiteEntropy
rw [div_self hm]
field_simp
ring
theorem homogeneousEntropy_zero {A : Type*} [Fintype A] :
homogeneousEntropy (fun _ : A => 0) = 0 := by
simp [homogeneousEntropy, finiteEntropy]
theorem homogeneousEntropy_expansion {A : Type*} [Fintype A] (p : A → ℝ) :
homogeneousEntropy p =
(∑ a, p a) * Real.log (∑ a, p a) - ∑ a, p a * Real.log (p a) := by
simp only [homogeneousEntropy, finiteEntropy, entropyTerm, neg_mul,
Finset.sum_neg_distrib, sub_eq_add_neg]
end
end MatrixMultiplication.AllFieldParameters
end OAI
|