Download data/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/Laws.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 5.23 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/Laws.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/Laws.lean
-
curl -L -o Laws.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/LinearAlgebra/MatrixMultiplication/FieldParameters/Laws.lean
5.23 kB
| import OAI.LinearAlgebra.MatrixMultiplication.FieldParameters.Weights | |
| namespace OAI | |
| /-! Fixed rational distributions and their entropy and capacity formulas. -/ | |
| namespace MatrixMultiplication.AllFieldParameters | |
| open scoped BigOperators | |
| theorem assigned_mem_or_zero {Ξ± : Type} [BEq Ξ±] (keys : List Ξ±) (data : List β€) (key : Ξ±) : | |
| assigned keys data key = 0 β¨ assigned keys data key β data := by | |
| unfold assigned | |
| cases h : (keys.zip data).find? (fun e => e.1 == key) with | |
| | none => simp | |
| | some pair => | |
| right | |
| exact (List.of_mem_zip (List.mem_of_find?_eq_some h)).2 | |
| theorem assigned_argument_bound {Ξ± : Type} [BEq Ξ±] (keys : List Ξ±) (data : List β€) | |
| (hd : β n β data, |n| β€ 160000) (key : Ξ±) : |assigned keys data key| β€ 160000 := by | |
| rcases assigned_mem_or_zero keys data key with h | h | |
| Β· rw [h]; norm_num | |
| Β· exact hd _ h | |
| theorem splitWeight_positive (parents : List Shape) (data : List β€) | |
| (hd : β n β data, |n| β€ 160000) (s u : Shape) : | |
| 0 < splitWeight parents data s u := by | |
| apply Finset.prod_pos | |
| intro i _ | |
| apply weight_positive_of_argument_bound | |
| exact assigned_argument_bound _ data hd _ | |
| theorem list_sum_map_nonnegative {Ξ± : Type} (xs : List Ξ±) (f : Ξ± β β) | |
| (hf : β x β xs, 0 β€ f x) : 0 β€ (xs.map f).sum := by | |
| induction xs with | |
| | nil => simp | |
| | cons x xs ih => | |
| simp only [List.map_cons, List.sum_cons] | |
| exact add_nonneg (hf x (by simp)) (ih (fun y hy => hf y (by simp [hy]))) | |
| theorem list_sum_map_positive {Ξ± : Type} (xs : List Ξ±) (f : Ξ± β β) | |
| (hne : xs β []) (hf : β x β xs, 0 < f x) : 0 < (xs.map f).sum := by | |
| cases xs with | |
| | nil => contradiction | |
| | cons x xs => | |
| simp only [List.map_cons, List.sum_cons] | |
| exact add_pos_of_pos_of_nonneg (hf x (by simp)) | |
| (list_sum_map_nonnegative xs f (fun y hy => (hf y (by simp [hy])).le)) | |
| theorem list_sum_map_div {Ξ± : Type} (xs : List Ξ±) (f : Ξ± β β) (d : β) : | |
| (xs.map (fun x => f x / d)).sum = (xs.map f).sum / d := by | |
| induction xs with | |
| | nil => simp | |
| | cons x xs ih => simp [ih, add_div] | |
| theorem splitLaw_positive (parents : List Shape) (data : List β€) | |
| (hd : β n β data, |n| β€ 160000) (s u : Shape) (hu : u β below s) : | |
| 0 < splitLaw parents data s u := by | |
| rw [splitLaw, ite_eq_left hu] | |
| apply div_pos (splitWeight_positive parents data hd s u) | |
| apply list_sum_map_positive | |
| Β· intro he | |
| simp only [he, List.not_mem_nil] at hu | |
| Β· intro v _ | |
| exact splitWeight_positive parents data hd s v | |
| theorem splitLaw_normalized (parents : List Shape) (data : List β€) | |
| (hd : β n β data, |n| β€ 160000) (s : Shape) (hne : below s β []) : | |
| ((below s).map (splitLaw parents data s)).sum = 1 := by | |
| have he : (below s).map (splitLaw parents data s) = | |
| (below s).map (fun u => splitWeight parents data s u / | |
| ((below s).map (splitWeight parents data s)).sum) := by | |
| apply List.map_congr_left | |
| intro u hu | |
| simp only [splitLaw, hu, ite_true] | |
| rw [he, list_sum_map_div, div_self] | |
| exact ne_of_gt (list_sum_map_positive (below s) _ hne | |
| (fun u _ => splitWeight_positive parents data hd s u)) | |
| theorem stageA_table_arguments_bounded : β n β tableP, |n| β€ 160000 := by decide +kernel | |
| theorem stageB_table_arguments_bounded : β n β tablep, |n| β€ 160000 := by decide +kernel | |
| theorem zero_table_arguments_bounded : β n β tablez, |n| β€ 160000 := by decide +kernel | |
| theorem stageA_support_nonempty : β s β positiveInitial, below s β [] := by decide +kernel | |
| theorem stageB_support_nonempty : β s β positiveSecond, below s β [] := by decide +kernel | |
| theorem stageA_support_complement : β s β positiveInitial, β u β below s, | |
| complement s u β below s β§ β i, u i β€ s i := by decide +kernel | |
| theorem stageB_support_complement : β s β positiveSecond, β u β below s, | |
| complement s u β below s β§ β i, u i β€ s i := by decide +kernel | |
| theorem stageALaw_positive (s u : Shape) (hu : u β below s) : 0 < stageALaw s u := | |
| splitLaw_positive _ _ stageA_table_arguments_bounded s u hu | |
| theorem stageBLaw_positive (s u : Shape) (hu : u β below s) : 0 < stageBLaw s u := | |
| splitLaw_positive _ _ stageB_table_arguments_bounded s u hu | |
| theorem stageALaw_normalized (s : Shape) (hs : s β positiveInitial) : | |
| ((below s).map (stageALaw s)).sum = 1 := | |
| splitLaw_normalized _ _ stageA_table_arguments_bounded s (stageA_support_nonempty s hs) | |
| theorem stageBLaw_normalized (s : Shape) (hs : s β positiveSecond) : | |
| ((below s).map (stageBLaw s)).sum = 1 := | |
| splitLaw_normalized _ _ stageB_table_arguments_bounded s (stageB_support_nonempty s hs) | |
| theorem stageALaw_complement (s u : Shape) (hs : s β positiveInitial) (hu : u β below s) : | |
| stageALaw s (complement s u) = stageALaw s u := by | |
| obtain β¨hc, hbβ© := stageA_support_complement s hs u hu | |
| exact splitLaw_complement _ _ s u hb hu hc | |
| theorem stageBLaw_complement (s u : Shape) (hs : s β positiveSecond) (hu : u β below s) : | |
| stageBLaw s (complement s u) = stageBLaw s u := by | |
| obtain β¨hc, hbβ© := stageB_support_complement s hs u hu | |
| exact splitLaw_complement _ _ s u hb hu hc | |
| end MatrixMultiplication.AllFieldParameters | |
| end OAI | |