Download data/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ConditionalContinuity.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 4.87 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ConditionalContinuity.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ConditionalContinuity.lean
-
curl -L -o ConditionalContinuity.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/LinearAlgebra/MatrixMultiplication/Entropy/ConditionalContinuity.lean
4.87 kB
| import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ConditionalLabels | |
| namespace OAI | |
| /-! Finite entropy, rate estimates and ordered asymptotic limits. -/ | |
| noncomputable section | |
| namespace MatrixMultiplication.ConditionalLabels | |
| open MatrixMultiplication.Foundation Filter | |
| open scoped BigOperators Topology Classical | |
| universe u v w | |
| variable {A : Type u} [Fintype A] {Label : β β Type v} | |
| [β n, Fintype (Label n)] | |
| theorem refinementEntropy_eq_prefix_difference (p : FiniteLaw A) | |
| (labels : β n, A β Label n) (depth n : β) (hn : n < depth) : | |
| (FiniteLabelHierarchy.ofLawLabels p labels depth).refinementEntropy n = | |
| finiteEntropy (p.map (labelRecordOf labels (n + 1))).mass - | |
| finiteEntropy (p.map (labelRecordOf labels n)).mass := by | |
| have h := (FiniteLabelHierarchy.ofLawLabels p labels depth).prefixLaw_entropy_succ | |
| n (Nat.succ_le_of_lt hn) | |
| rw [FiniteLabelHierarchy.ofLawLabels_prefixLaw_mass, | |
| FiniteLabelHierarchy.ofLawLabels_prefixLaw_mass] at h | |
| linarith | |
| theorem tendsto_map_entropy {J : Type w} {filter : Filter J} | |
| {p : J β FiniteLaw A} {q : FiniteLaw A} | |
| (mass : β a, Tendsto (fun j => (p j).mass a) filter (π (q.mass a))) | |
| {B : Type*} [Fintype B] (label : A β B) : | |
| Tendsto (fun j => finiteEntropy ((p j).map label).mass) filter | |
| (π (finiteEntropy (q.map label).mass)) := by | |
| apply FiniteLaw.entropy_tendsto | |
| intro b | |
| simp only [FiniteLaw.map_mass] | |
| apply tendsto_finsetSum | |
| intro a _ | |
| by_cases h : label a = b | |
| Β· simpa only [h, ite_true] using mass a | |
| Β· simp only [h, ite_false] | |
| exact tendsto_const_nhds | |
| theorem tendsto_lawPairingRate {J : Type w} {filter : Filter J} | |
| {p : J β FiniteLaw A} {q : FiniteLaw A} | |
| (mass : β a, Tendsto (fun j => (p j).mass a) filter (π (q.mass a))) | |
| (labels : β n, A β Label n) (depth : β) | |
| (reader : Fin depth β ReaderPair) (pair : ReaderPair) : | |
| Tendsto (fun j => lawPairingRate (p j) labels depth reader pair) filter | |
| (π (lawPairingRate q labels depth reader pair)) := by | |
| unfold lawPairingRate pairingRate | |
| apply tendsto_finsetSum | |
| intro n _ | |
| by_cases h : reader n = pair | |
| Β· simp only [h, ite_true, | |
| refinementEntropy_eq_prefix_difference _ labels depth n.val n.isLt] | |
| exact (tendsto_map_entropy mass (labelRecordOf labels (n.val + 1))).sub | |
| (tendsto_map_entropy mass (labelRecordOf labels n.val)) | |
| Β· simp only [h, ite_false] | |
| exact tendsto_const_nhds | |
| theorem exists_rational_law_sequence (p : FiniteLaw A) : | |
| β q : β β RationalLaw A, | |
| β a, Tendsto (fun n => (q n).toFiniteLaw.mass a) atTop (π (p.mass a)) := by | |
| have hexists (n : β) := p.exists_rational_approximation | |
| (1 / ((n : β) + 1)) (by positivity) | |
| choose q _support close using hexists | |
| refine β¨q, fun a => ?_β© | |
| have hdifference : Tendsto | |
| (fun n => (q n).toFiniteLaw.mass a - p.mass a) atTop (π 0) := by | |
| apply squeeze_zero_norm _ tendsto_one_div_add_atTop_nhds_zero_nat | |
| intro n | |
| simpa only [Real.norm_eq_abs, RationalLaw.toFiniteLaw_mass] using (close n a).le | |
| simpa only [sub_add_cancel, zero_add] using hdifference.add_const (p.mass a) | |
| theorem exists_rational_with_strict_margins (p : FiniteLaw A) | |
| (labels : β n, A β Label n) (depth : β) (reader : Fin depth β ReaderPair) | |
| {k C target : β} | |
| (positive : 0 < lawPairingRate p labels depth reader .xy + | |
| lawPairingRate p labels depth reader .xz) | |
| (aspect : k * (lawPairingRate p labels depth reader .xy + | |
| lawPairingRate p labels depth reader .xz) < | |
| 2 * lawPairingRate p labels depth reader .yz) | |
| (cost : 2 * C < target * (lawPairingRate p labels depth reader .xy + | |
| lawPairingRate p labels depth reader .xz)) : | |
| β q : RationalLaw A, | |
| 0 < lawPairingRate q.toFiniteLaw labels depth reader .xy + | |
| lawPairingRate q.toFiniteLaw labels depth reader .xz β§ | |
| k * (lawPairingRate q.toFiniteLaw labels depth reader .xy + | |
| lawPairingRate q.toFiniteLaw labels depth reader .xz) < | |
| 2 * lawPairingRate q.toFiniteLaw labels depth reader .yz β§ | |
| 2 * C < target * (lawPairingRate q.toFiniteLaw labels depth reader .xy + | |
| lawPairingRate q.toFiniteLaw labels depth reader .xz) := by | |
| obtain β¨q, hqβ© := exists_rational_law_sequence p | |
| have hincident := (tendsto_lawPairingRate hq labels depth reader .xy).add | |
| (tendsto_lawPairingRate hq labels depth reader .xz) | |
| have hhidden := tendsto_lawPairingRate hq labels depth reader .yz | |
| have hpos := hincident.eventually_const_lt positive | |
| have haspect := (hincident.const_mul k).eventually_lt (hhidden.const_mul 2) aspect | |
| have hcost := (hincident.const_mul target).eventually_const_lt cost | |
| obtain β¨n, hnpos, hnaspect, hncostβ© := (hpos.and (haspect.and hcost)).exists | |
| exact β¨q n, hnpos, hnaspect, hncostβ© | |
| end MatrixMultiplication.ConditionalLabels | |
| end | |
| end OAI | |