Download data/lean/OAI/InformationTheory/SoftChannel/Model.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 4.45 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/InformationTheory/SoftChannel/Model.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/InformationTheory/SoftChannel/Model.lean
-
curl -L -o Model.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/InformationTheory/SoftChannel/Model.lean
4.45 kB
| import Mathlib | |
| namespace OAI | |
| section | |
| noncomputable section | |
| open scoped BigOperators | |
| namespace SoftChannel204 | |
| abbrev Cube (n : β) := Fin n β Bool | |
| def sign (b : Bool) : β := if b then 1 else -1 | |
| def avg {n : β} (g : Cube n β β) : β := (β x, g x) / (2 : β) ^ n | |
| def L : β := Real.log 2 | |
| def psi (r : β) : β := | |
| (1 + r) / 2 * Real.log (1 + r) + (1 - r) / 2 * Real.log (1 - r) | |
| def H (r : β) : β := L - psi r | |
| def info {n : β} (u : Cube n β β) : β := H (avg u) - avg (H β u) | |
| def psiInv (s : β) : β := Function.invFunOn psi (Set.Icc 0 1) s | |
| def kernel {n : β} (Ο : β) (x y : Cube n) : β := | |
| β i, if x i = y i then (1 + Ο) / 2 else (1 - Ο) / 2 | |
| def noise {n : β} (Ο : β) (u : Cube n β β) (y : Cube n) : β := | |
| β x, kernel Ο y x * u x | |
| def Closed {n : β} (u : Cube n β β) : Prop := β x, u x β Set.Icc (-1) 1 | |
| def Interior {n : β} (g : Cube n β β) : Prop := β x, g x β Set.Ioo (-1) 1 | |
| def softCoordinate {n : β} (i : Fin n) (a : β) (x : Cube n) : β := a * sign (x i) | |
| def flip {n : β} (i : Fin n) (x : Cube n) : Cube n := Function.update x i (!(x i)) | |
| def numberOperator {n : β} (g : Cube n β β) (x : Cube n) : β := | |
| (1 / 2 : β) * β i, (g x - g (flip i x)) | |
| def production {n : β} (g : Cube n β β) : β := | |
| avg (fun x => Real.artanh (g x) * numberOperator g x) | |
| /-- Defined by this formula on `[0, L)`; no finite endpoint value at `L` is asserted. -/ | |
| def F (s : β) : β := psiInv s * Real.artanh (psiInv s) | |
| /-- The excess `F s - 2 * s`, used for `s < L`, is extended by zero to negative arguments. -/ | |
| def S (s : β) : β := if s < 0 then 0 else F s - 2 * s | |
| /-- The reserve is used for `|m| < 1` and `0 β€ I < H m`. -/ | |
| def reserve (m I : β) : β := | |
| 2 * I + (1 - m ^ 2) * S (L - (H m - I) / (1 - m ^ 2)) | |
| def hybrid (m I : β) : β := max (reserve m I) (F I) | |
| def softJoint {n : β} (Ο : β) (u : Cube n β β) (b : Bool) (y : Cube n) : β := | |
| avg (fun x => (1 + sign b * u x) / 2 * kernel Ο x y) | |
| def boolJoint {n : β} (Ο : β) (f : Cube n β Bool) (b : Bool) (y : Cube n) : β := | |
| avg (fun x => if f x = b then kernel Ο x y else 0) | |
| def leftMarginal {n : β} (p : Bool β Cube n β β) (b : Bool) : β := β y, p b y | |
| def rightMarginal {n : β} (p : Bool β Cube n β β) (y : Cube n) : β := β b, p b y | |
| def mutualInformation {n : β} (p : Bool β Cube n β β) : β := | |
| β b, β y, if 0 < p b y then | |
| p b y * Real.log (p b y / (leftMarginal p b * rightMarginal p y)) else 0 | |
| def binaryEntropyBits (Ξ΅ : β) : β := | |
| -(Ξ΅ * Real.log Ξ΅ + (1 - Ξ΅) * Real.log (1 - Ξ΅)) / L | |
| def SoftContraction : Prop := β (n : β) (u : Cube n β β), Closed u β | |
| β Ο β Set.Icc (-1 : β) 1, | |
| info (noise Ο u) β€ psi (|Ο| * psiInv (info u)) | |
| def SoftAttainment : Prop := β (n : β) (i : Fin n) (a : β), |a| β€ 1 β | |
| β Ο β Set.Icc (-1 : β) 1, | |
| info (noise Ο (softCoordinate i a)) = | |
| psi (|Ο| * psiInv (info (softCoordinate i a))) | |
| def SoftInformationIdentity : Prop := β (n : β) (u : Cube n β β), Closed u β | |
| β Ο β Set.Icc (-1 : β) 1, | |
| mutualInformation (softJoint Ο u) = info (noise Ο u) | |
| def RefinedBoolean : Prop := β (n : β) (f : Cube n β Bool) | |
| (Ο : β), Ο β Set.Icc (-1 : β) 1 β | |
| let m := avg (sign β f) | |
| let bound := psi (|Ο| * psiInv (H m)) | |
| mutualInformation (boolJoint Ο f) = info (noise Ο (sign β f)) β§ | |
| mutualInformation (boolJoint Ο f) β€ bound β§ bound β€ psi |Ο| β§ | |
| (0 < |m| β |m| < 1 β 0 < |Ο| β bound < psi |Ο|) | |
| def BooleanAttainment : Prop := β (n : β) (i : Fin n) | |
| (Ο : β), Ο β Set.Icc (-1 : β) 1 β | |
| mutualInformation (boolJoint Ο (fun x => x i)) = psi |Ο| β§ | |
| mutualInformation (boolJoint Ο (fun x => !(x i))) = psi |Ο| | |
| def BitsConversion : Prop := β (n : β) (f : Cube n β Bool) | |
| (Ξ΅ : β), Ξ΅ β Set.Icc (0 : β) (1/2) β | |
| psi (1 - 2 * Ξ΅) / L = 1 - binaryEntropyBits Ξ΅ β§ | |
| mutualInformation (boolJoint (1 - 2 * Ξ΅) f) / L β€ 1 - binaryEntropyBits Ξ΅ | |
| def SharpProduction : Prop := β (n : β) (g : Cube n β β), Interior g β | |
| hybrid (avg g) (info g) β€ production g β§ F (info g) β€ hybrid (avg g) (info g) | |
| def FullMain : Prop := SoftContraction β§ SoftAttainment β§ SoftInformationIdentity β§ | |
| RefinedBoolean β§ BooleanAttainment β§ BitsConversion β§ SharpProduction | |
| end SoftChannel204 | |
| end | |
| end | |
| end OAI | |