File size: 2,736 Bytes
4a56cd6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
60
61
62
63
64
65
66
import OAI.LinearAlgebra.MatrixMultiplication.FieldParameters.Basic

namespace OAI

/-! Fixed rational distributions and their entropy and capacity formulas. -/

namespace MatrixMultiplication.AllFieldParameters

open scoped BigOperators

theorem truncated_polynomial_positive (y : β„š) (hy : |y| ≀ 1 / 4) :
    0 < βˆ‘ j ∈ Finset.range 17, y ^ j / Nat.factorial j := by
  have term_bound (j : β„•) :
      |y ^ (j + 1) / (Nat.factorial (j + 1) : β„š)| ≀ (1 / 4 : β„š) ^ (j + 1) := by
    have hd : (1 : β„š) ≀ Nat.factorial (j + 1) := by
      exact_mod_cast (Nat.succ_le_iff.mpr (Nat.factorial_pos (j + 1)))
    calc
      _ = |y| ^ (j + 1) / (Nat.factorial (j + 1) : β„š) := by
        simp only [abs_div, abs_pow,
          abs_of_nonneg (Nat.cast_nonneg (Nat.factorial (j + 1)) :
            (0 : β„š) ≀ (Nat.factorial (j + 1) : β„š))]
      _ ≀ (1 / 4 : β„š) ^ (j + 1) / (Nat.factorial (j + 1) : β„š) := by gcongr
      _ ≀ _ := div_le_self (by positivity) hd
  have hb : |βˆ‘ j ∈ Finset.range 16, y ^ (j + 1) / (Nat.factorial (j + 1) : β„š)| < 1 := by
    calc
      _ ≀ βˆ‘ j ∈ Finset.range 16, |y ^ (j + 1) / (Nat.factorial (j + 1) : β„š)| :=
        Finset.abs_sum_le_sum_abs _ _
      _ ≀ βˆ‘ j ∈ Finset.range 16, (1 / 4 : β„š) ^ (j + 1) :=
        Finset.sum_le_sum (fun j _ => term_bound j)
      _ < 1 := by norm_num [Finset.sum_range_succ]
  rw [show 17 = 16 + 1 by decide, Finset.sum_range_succ']
  norm_num only [pow_zero, Nat.factorial_zero, Nat.cast_one, div_one]
  linarith [(abs_lt.mp hb).1]

theorem weight_positive_of_argument_bound (n : β„€) (hn : |n| ≀ 160000) :
    0 < weight n := by
  unfold weight
  apply pow_pos
  apply truncated_polynomial_positive
  have hn' : |(n : β„š)| ≀ 160000 := by exact_mod_cast hn
  rw [abs_div]
  rw [abs_of_pos (by norm_num : (0 : β„š) < 640000)]
  exact (div_le_iffβ‚€ (by norm_num)).mpr (by linarith)

def weightArguments : List β„€ := 0 :: (tablea ++ tableP ++ tablep ++ tablez)

theorem all_weight_arguments_bounded : βˆ€ n ∈ weightArguments, |n| ≀ 160000 := by
  decide +kernel

theorem all_weights_positive (n : β„€) (hn : n ∈ weightArguments) : 0 < weight n :=
  weight_positive_of_argument_bound n (all_weight_arguments_bounded n hn)

theorem normalized_sum {ΞΉ : Type} [Fintype ΞΉ] (w : ΞΉ β†’ β„š)
    (h : βˆ‘ i, w i β‰  0) : βˆ‘ i, w i / (βˆ‘ j, w j) = 1 := by
  simp only [div_eq_mul_inv]
  rw [← Finset.sum_mul, ← div_eq_mul_inv, div_self h]

theorem normalized_positive {ΞΉ : Type} [Fintype ΞΉ] (w : ΞΉ β†’ β„š)
    (hw : βˆ€ i, 0 < w i) (i : ΞΉ) : 0 < w i / (βˆ‘ j, w j) := by
  apply div_pos (hw i)
  exact Finset.sum_pos (fun j _ => hw j) ⟨i, Finset.mem_univ i⟩

end MatrixMultiplication.AllFieldParameters

end OAI