Download data/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/Laws.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 3.28 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/Laws.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/Laws.lean
-
curl -L -o Laws.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/LinearAlgebra/MatrixMultiplication/Completion/Laws.lean
3.28 kB
| import OAI.LinearAlgebra.MatrixMultiplication.Entropy.ComplexEntropyContinuity | |
| namespace OAI | |
| /-! Readable tensor completion and its finite arithmetic realization. -/ | |
| noncomputable section | |
| namespace MatrixMultiplication.CompletionLaws | |
| open MatrixMultiplication.Foundation | |
| open scoped BigOperators | |
| variable {A B X : Type*} [Fintype A] [Fintype B] [Fintype X] | |
| def mixture (p : FiniteLaw B) (q : B β FiniteLaw A) : FiniteLaw A := | |
| (p.joint q).map Prod.snd | |
| theorem mixture_mass (p : FiniteLaw B) (q : B β FiniteLaw A) (a : A) : | |
| (mixture p q).mass a = β b, p.mass b * (q b).mass a := by | |
| classical | |
| simp [mixture, FiniteLaw.map_mass, FiniteLaw.joint, Fintype.sum_prod_type] | |
| theorem mixture_map_mass (p : FiniteLaw B) (q : B β FiniteLaw A) | |
| (f : A β X) (x : X) : | |
| ((mixture p q).map f).mass x = β b, p.mass b * ((q b).map f).mass x := by | |
| classical | |
| simp only [FiniteLaw.map_mass, mixture_mass] | |
| calc | |
| (β a, if f a = x then β b, p.mass b * (q b).mass a else 0) = | |
| β a, β b, if f a = x then p.mass b * (q b).mass a else 0 := by | |
| apply Finset.sum_congr rfl | |
| intro a _ | |
| split_ifs <;> simp | |
| _ = β b, β a, if f a = x then p.mass b * (q b).mass a else 0 := | |
| Finset.sum_comm | |
| _ = β b, p.mass b * β a, if f a = x then (q b).mass a else 0 := by | |
| apply Finset.sum_congr rfl | |
| intro b _ | |
| rw [Finset.mul_sum] | |
| apply Finset.sum_congr rfl | |
| intro a _ | |
| split_ifs <;> simp | |
| theorem mixture_common_marginal (p : FiniteLaw B) (q : B β FiniteLaw A) | |
| (f : A β X) (r : FiniteLaw X) | |
| (hq : β b x, ((q b).map f).mass x = r.mass x) (x : X) : | |
| ((mixture p q).map f).mass x = r.mass x := by | |
| rw [mixture_map_mass] | |
| simp_rw [hq] | |
| rw [β Finset.sum_mul, p.total, one_mul] | |
| theorem joint_common_marginal (p : FiniteLaw B) (q : B β FiniteLaw A) | |
| (f : A β X) (r : FiniteLaw X) | |
| (hq : β b x, ((q b).map f).mass x = r.mass x) (b : B) (x : X) : | |
| ((p.joint q).map (fun ba => (ba.1, f ba.2))).mass (b, x) = | |
| p.mass b * r.mass x := by | |
| classical | |
| simp only [FiniteLaw.map_mass, FiniteLaw.joint, Fintype.sum_prod_type, | |
| Prod.mk.injEq] | |
| calc | |
| (β b', β a, if b' = b β§ f a = x then p.mass b' * (q b').mass a else 0) = | |
| β a, if f a = x then p.mass b * (q b).mass a else 0 := by | |
| rw [Finset.sum_eq_single b] | |
| Β· simp | |
| Β· intro b' _ hne | |
| simp [hne] | |
| Β· simp | |
| _ = p.mass b * ((q b).map f).mass x := by | |
| rw [FiniteLaw.map_mass, Finset.mul_sum] | |
| apply Finset.sum_congr rfl | |
| intro a _ | |
| split_ifs <;> simp | |
| _ = _ := by rw [hq] | |
| theorem common_marginal_entropy (p : FiniteLaw B) (q : B β FiniteLaw A) | |
| (f : A β X) (r : FiniteLaw X) | |
| (hq : β b x, ((q b).map f).mass x = r.mass x) : | |
| (β b, p.mass b * finiteEntropy ((q b).map f).mass) = | |
| finiteEntropy r.mass := by | |
| have heq (b : B) : ((q b).map f).mass = r.mass := funext (hq b) | |
| simp_rw [heq] | |
| rw [β Finset.sum_mul, p.total, one_mul] | |
| theorem independent_entropy (p : FiniteLaw A) (q : FiniteLaw B) : | |
| finiteEntropy (p.joint (fun _ => q)).mass = | |
| finiteEntropy p.mass + finiteEntropy q.mass := by | |
| rw [FiniteLaw.joint_entropy, β Finset.sum_mul, p.total, one_mul] | |
| end MatrixMultiplication.CompletionLaws | |
| end | |
| end OAI | |