Download tasks/binary-sweep/tests/Challenge.lean from FineEnvs/openai-math: direct link, hf CLI and curl.
- Browser
- Download file 3.73 kB
-
https://huggingface.co/datasets/FineEnvs/openai-math/resolve/main/tasks/binary-sweep/tests/Challenge.lean
- Command line
-
hf download hf://datasets/FineEnvs/openai-math/tasks/binary-sweep/tests/Challenge.lean
-
curl -L -o Challenge.lean https://huggingface.co/datasets/FineEnvs/openai-math/resolve/main/tasks/binary-sweep/tests/Challenge.lean
3.73 kB
Lean 4 · 19
declarations statementsfull
10The positions of a binary deck of dimension d.
abbrev Slot (d : ℕ) := Fin d → Bool 13Independent 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) := body · 7 lines
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 : ℕ) := body · 1 line
(j : Fin d) → ({i : Fin d // i ≠ j} → Bool) → Bool27The coordinate layers are applied in increasing coordinate order.
def binarySweep (d : ℕ) (c : SweepCoins d) : Equiv.Perm (Slot d) := body · 1 line
(List.ofFn (fun j => coordinateLayer d j (c j))).reverse.proddef finiteLaw {Ω G : Type*} [Fintype Ω] [Fintype G] (f : Ω → G) (g : G) : ℝ := by body · 2 lines
classical
exact ∑ ω, if f ω = g then (Fintype.card Ω : ℝ)⁻¹ else 035Half the unnormalized sum of absolute probability-mass differences.
def totalVariation {G : Type*} [Fintype G] (p q : G → ℝ) : ℝ := body · 1 line
(1 / ((2 : ℕ) : ℝ)) * ∑ g, |p g - q g|def uniformLaw (G : Type*) [Fintype G] : G → ℝ := body · 1 line
fun _ => (Fintype.card G : ℝ)⁻¹def binaryLaw (d : ℕ) : Equiv.Perm (Slot d) → ℝ := body · 1 line
finiteLaw (binarySweep d)
abbrev RepSpace (D : ℕ) := EuclideanSpace ℂ (Fin D) def IsUnitaryRep {G : Type*} [Monoid G]
{D : ℕ} (ρ : Representation ℂ G (RepSpace D)) : Prop := body · 1 line
∀ 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 := body · 1 line
LinearMap.toContinuousLinearMap (∑ g, (p g : ℂ) • ρ g)def BinaryContractionTarget : Prop := body · 4 lines
∃ 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 α →* ℝ := body · 1 line
(Int.castRingHom ℝ).toMonoidHom.comp ((Units.coeHom ℤ).comp Equiv.Perm.sign)def convolution (p q : G → ℝ) (g : G) : ℝ := ∑ x, p x * q (x⁻¹ * g) def pointMassOne (g : G) : ℝ := by body · 2 lines
classical
exact if g = 1 then 1 else 074The law of independent repetitions, with the empty product at the identity.
def convolutionPower (p : G → ℝ) : ℕ → G → ℝ body · 2 lines
| 0 => pointMassOne
| n + 1 => convolution p (convolutionPower p n)def sweepLaw (d t : ℕ) : Equiv.Perm (Slot d) → ℝ := body · 1 line
convolutionPower (binaryLaw d) t
84A single number of sweeps works uniformly over deterministic initial decks.
def UniformSweepMixingTarget : Prop := body · 4 lines
∃ w : ℕ, ∀ ε : ℝ, 0 < ε → ∃ d₀ : ℕ, ∀ d ≥ d₀,
∀ τ : Equiv.Perm (Slot d),
totalVariation (fun g => sweepLaw d w (g * τ⁻¹))
(uniformLaw (Equiv.Perm (Slot d))) ≤ εtheorem binary_sweep_contraction_and_mixing :
BinaryCoordinateSweeps.BinaryContractionTarget ∧
(∀ d : ℕ, 0 < d → ∑ g : Equiv.Perm (BinaryCoordinateSweeps.Slot d),
BinaryCoordinateSweeps.binaryLaw d g * BinaryCoordinateSweeps.realSign g = 0) ∧
BinaryCoordinateSweeps.UniformSweepMixingTarget := by proof · 1 line
sorryOutline
- abbrev
Slot10 - def
coordinateLayer13 - abbrev
SweepCoins23 - def
binarySweep27 - def
finiteLaw30 - def
totalVariation35 - def
uniformLaw38 - def
binaryLaw41 - abbrev
RepSpace44 - def
IsUnitaryRep46 - def
averageOperator50 - def
BinaryContractionTarget55 - def
realSign61 - def
convolution67 - def
pointMassOne69 - def
convolutionPower74 - def
sweepLaw80 - def
UniformSweepMixingTarget84 - theorem
binary_sweep_contraction_and_mixing95