Download data/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/LeafRates.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 3.93 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/LeafRates.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/LeafRates.lean
-
curl -L -o LeafRates.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/LeafRates.lean
3.93 kB
| import OAI.LinearAlgebra.MatrixMultiplication.Tensor.ExactStatisticWords | |
| import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexTypeEntropy | |
| namespace OAI | |
| /-! Finite entropy, rate estimates and ordered asymptotic limits. -/ | |
| noncomputable section | |
| namespace MatrixMultiplication.LeafRates | |
| open MatrixMultiplication.Foundation Filter | |
| open scoped BigOperators Topology | |
| variable {A U : Type*} [Fintype A] [DecidableEq A] [Fintype U] | |
| theorem log_card_supported (statistic : U β A) (counts b : A β β) | |
| (hb : β a, 0 < counts a β Fintype.card {u : U // statistic u = a} = b a) | |
| (hbpos : β a, 0 < b a) : | |
| Real.log (Fintype.card (ExactStatisticWords.Words statistic counts) : β) = | |
| Real.log (Nat.multinomial Finset.univ counts : β) + | |
| β a, (counts a : β) * Real.log (b a : β) := by | |
| rw [ExactStatisticWords.card_of_supported statistic counts b hb, Nat.cast_mul, Nat.cast_prod] | |
| have hm : (Nat.multinomial Finset.univ counts : β) β 0 := by | |
| exact_mod_cast (Nat.ne_of_gt (Nat.multinomial_pos Finset.univ counts)) | |
| have hp : (β a, (b a ^ counts a : β) : β) β 0 := by | |
| apply Finset.prod_ne_zero_iff.mpr | |
| intro a _ | |
| exact_mod_cast (Nat.ne_of_gt (pow_pos (hbpos a) _)) | |
| rw [Real.log_mul hm hp, Real.log_prod (s := Finset.univ) | |
| (f := fun a => ((b a ^ counts a : β) : β)) | |
| (fun a _ => by exact_mod_cast (Nat.ne_of_gt (pow_pos (hbpos a) (counts a))))] | |
| simp only [Nat.cast_pow, Real.log_pow] | |
| theorem log_card (statistic : U β A) (counts b : A β β) | |
| (hb : β a, Fintype.card {u : U // statistic u = a} = b a) | |
| (hbpos : β a, 0 < b a) : | |
| Real.log (Fintype.card (ExactStatisticWords.Words statistic counts) : β) = | |
| Real.log (Nat.multinomial Finset.univ counts : β) + | |
| β a, (counts a : β) * Real.log (b a : β) := | |
| log_card_supported statistic counts b (fun a _ => hb a) hbpos | |
| theorem tendsto_log_card_supported (statistic : U β A) (counts b : A β β) | |
| (hb : β a, 0 < counts a β Fintype.card {u : U // statistic u = a} = b a) | |
| (hbpos : β a, 0 < b a) (hD : 0 < β a, counts a) : | |
| Tendsto (fun t : β => | |
| Real.log (Fintype.card (ExactStatisticWords.Words statistic (fun a => t * counts a)) : β) / | |
| ((t : β) * (β a, counts a : β))) atTop | |
| (π (finiteEntropy (fun a => (counts a : β) / (β a, counts a : β)) + | |
| β a, ((counts a : β) / (β a, counts a : β)) * Real.log (b a : β))) := by | |
| have hl := (tendsto_log_multinomial_mul counts hD).add_const | |
| (β a, ((counts a : β) / (β a, counts a : β)) * Real.log (b a : β)) | |
| apply hl.congr' | |
| filter_upwards [eventually_ne_atTop (0 : β)] with t ht | |
| have hbt : β a, 0 < t * counts a β Fintype.card {u : U // statistic u = a} = b a := | |
| fun a ha => hb a (by nlinarith) | |
| rw [log_card_supported statistic (fun a => t * counts a) b hbt hbpos, add_div] | |
| congr 1 | |
| rw [Finset.sum_div] | |
| apply Finset.sum_congr rfl | |
| intro a _ | |
| have ht' : (t : β) β 0 := Nat.cast_ne_zero.mpr ht | |
| have hD' : ((β a, counts a : β) : β) β 0 := by exact_mod_cast (Nat.ne_of_gt hD) | |
| have hDsum : (β a, (counts a : β)) β 0 := by | |
| simpa only [Nat.cast_sum] using hD' | |
| simp only [Nat.cast_mul] | |
| field_simp [ht', hD', hDsum] | |
| theorem tendsto_log_card (statistic : U β A) (counts b : A β β) | |
| (hb : β a, Fintype.card {u : U // statistic u = a} = b a) | |
| (hbpos : β a, 0 < b a) (hD : 0 < β a, counts a) : | |
| Tendsto (fun t : β => | |
| Real.log (Fintype.card (ExactStatisticWords.Words statistic (fun a => t * counts a)) : β) / | |
| ((t : β) * (β a, counts a : β))) atTop | |
| (π (finiteEntropy (fun a => (counts a : β) / (β a, counts a : β)) + | |
| β a, ((counts a : β) / (β a, counts a : β)) * Real.log (b a : β))) := | |
| tendsto_log_card_supported statistic counts b (fun a _ => hb a) hbpos hD | |
| end MatrixMultiplication.LeafRates | |
| end | |
| end OAI | |