Download data/lean/OAI/Probability/BinarySweep/Model.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 3.37 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/BinarySweep/Model.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/BinarySweep/Model.lean
-
curl -L -o Model.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/BinarySweep/Model.lean
3.37 kB
| import Mathlib | |
| namespace OAI | |
| noncomputable section | |
| open scoped BigOperators | |
| namespace BinaryCoordinateSweeps | |
| /-- The positions of a binary deck of dimension d. -/ | |
| abbrev Slot (d : β) := Fin d β Bool | |
| /-- Independent switches on the edges parallel to one coordinate. -/ | |
| def coordinateLayer (d : β) (j : Fin d) | |
| (c : (({i : Fin d // i β j} β Bool)) β Bool) : Equiv.Perm (Slot d) := | |
| let e := Equiv.piSplitAt j (fun _ : Fin d => Bool) | |
| let sw : Equiv.Perm (Bool Γ ({i : Fin d // i β j} β Bool)) := | |
| { toFun := fun x => (x.1 ^^ c x.2, x.2) | |
| invFun := fun x => (x.1 ^^ c x.2, x.2) | |
| left_inv := fun x => by simp | |
| right_inv := fun x => by simp } | |
| e.trans (sw.trans e.symm) | |
| abbrev SweepCoins (d : β) := | |
| (j : Fin d) β ({i : Fin d // i β j} β Bool) β Bool | |
| /-- The coordinate layers are applied in increasing coordinate order. -/ | |
| def binarySweep (d : β) (c : SweepCoins d) : Equiv.Perm (Slot d) := | |
| (List.ofFn (fun j => coordinateLayer d j (c j))).reverse.prod | |
| def finiteLaw {Ξ© G : Type*} [Fintype Ξ©] [Fintype G] (f : Ξ© β G) (g : G) : β := by | |
| classical | |
| exact β Ο, if f Ο = g then (Fintype.card Ξ© : β)β»ΒΉ else 0 | |
| /-- Half the unnormalized sum of absolute probability-mass differences. -/ | |
| def totalVariation {G : Type*} [Fintype G] (p q : G β β) : β := | |
| (1 / ((2 : β) : β)) * β g, |p g - q g| | |
| def uniformLaw (G : Type*) [Fintype G] : G β β := | |
| fun _ => (Fintype.card G : β)β»ΒΉ | |
| def binaryLaw (d : β) : Equiv.Perm (Slot d) β β := | |
| finiteLaw (binarySweep d) | |
| abbrev RepSpace (D : β) := EuclideanSpace β (Fin D) | |
| def IsUnitaryRep {G : Type*} [Monoid G] | |
| {D : β} (Ο : Representation β G (RepSpace D)) : Prop := | |
| β g x, βΟ g xβ = βxβ | |
| def averageOperator {G : Type*} [Fintype G] [Monoid G] {D : β} | |
| (p : G β β) (Ο : Representation β G (RepSpace D)) : | |
| RepSpace D βL[β] RepSpace D := | |
| LinearMap.toContinuousLinearMap (β g, (p g : β) β’ Ο g) | |
| def BinaryContractionTarget : Prop := | |
| β g : β, 0 < g β§ β dβ : β, β d β₯ dβ, β D : β, | |
| β Ο : Representation β (Equiv.Perm (Slot d)) (RepSpace D), | |
| Ο.IsIrreducible β IsUnitaryRep Ο β | |
| βaverageOperator (binaryLaw d) Οβ β€ (D : β) ^ (-g) | |
| def realSign {Ξ± : Type*} [Fintype Ξ±] [DecidableEq Ξ±] : Equiv.Perm Ξ± β* β := | |
| (Int.castRingHom β).toMonoidHom.comp ((Units.coeHom β€).comp Equiv.Perm.sign) | |
| section FiniteLaws | |
| variable {G : Type*} [Fintype G] [Group G] | |
| def convolution (p q : G β β) (g : G) : β := β x, p x * q (xβ»ΒΉ * g) | |
| def pointMassOne (g : G) : β := by | |
| classical | |
| exact if g = 1 then 1 else 0 | |
| /-- The law of independent repetitions, with the empty product at the identity. -/ | |
| def convolutionPower (p : G β β) : β β G β β | |
| | 0 => pointMassOne | |
| | n + 1 => convolution p (convolutionPower p n) | |
| end FiniteLaws | |
| def sweepLaw (d t : β) : Equiv.Perm (Slot d) β β := | |
| convolutionPower (binaryLaw d) t | |
| /-- A single number of sweeps works uniformly over deterministic initial decks. -/ | |
| def UniformSweepMixingTarget : Prop := | |
| β w : β, β Ξ΅ : β, 0 < Ξ΅ β β dβ : β, β d β₯ dβ, | |
| β Ο : Equiv.Perm (Slot d), | |
| totalVariation (fun g => sweepLaw d w (g * Οβ»ΒΉ)) | |
| (uniformLaw (Equiv.Perm (Slot d))) β€ Ξ΅ | |
| end BinaryCoordinateSweeps | |
| end | |
| end OAI | |