Lean 4 · 61
declarations statementsfull
abbrev Vector (d : ℕ) := EuclideanSpace ℝ (Fin d) abbrev UnitSphere (d : ℕ) := Metric.sphere (0 : Vector d) 1 abbrev State (M : ℕ) := Fin (2 ^ M) abbrev Samples (d T : ℕ) := Fin T → Vector d def uniformSphere (d : ℕ) : Measure (UnitSphere d) := body · 2 lines
let σ := (volume : Measure (Vector d)).toSphere
(σ Set.univ)⁻¹ • σdef sampleLaw (d T : ℕ) : Measure (Samples d T) := body · 1 line
Measure.pi fun _ => stdGaussian (Vector d)def observationReference (d : ℕ) : Measure (Vector d × ℝ) := body · 1 line
(stdGaussian (Vector d)).prod volumestructure KernelLearner (d M T : ℕ) where body · 4 lines
initial : PMF (Bool × State M)
transition : ℕ → State M → (Vector d × ℝ) → PMF (Bool × State M)
output : ℕ → State M → Measure (UnitSphere d)
output_probability : ∀ t q, IsProbabilityMeasure (output t q)abbrev RunStatus (M : ℕ) := Sum (State M) (ℕ × State M) def tagged (M t : ℕ) (a : Bool × State M) : RunStatus M := body · 1 line
if a.1 then .inr (t, a.2) else .inl a.2def run {d M T : ℕ} (L : KernelLearner d M T) (s : UnitSphere d)
(x : Samples d T) : ℕ → PMF (RunStatus M) body · 7 lines
| 0 => L.initial.map (tagged M 0)
| n + 1 => (L.run s x n).bind fun status =>
match status with
| .inr done => PMF.pure (.inr done)
| .inl q => if hn : n < T then
(L.transition (n + 1) q (x ⟨n, hn⟩, ⟪x ⟨n, hn⟩, s.val⟫)).map (tagged M (n + 1))
else PMF.pure (.inl q)def terminal {d M T : ℕ} (L : KernelLearner d M T) (s : UnitSphere d)
(x : Samples d T) : PMF (ℕ × State M) := body · 4 lines
(L.run s x T).map fun status =>
match status with
| .inl q => (T, q)
| .inr done => donedef estimateLaw {d M T : ℕ} (L : KernelLearner d M T) (s : UnitSphere d)
(x : Samples d T) : Measure (UnitSphere d) := body · 1 line
(L.terminal s x).toMeasure.bind fun a => L.output a.1 a.2def angularError {d : ℕ} (s u : UnitSphere d) : ℝ := body · 1 line
Real.arccos ⟪u.val, s.val⟫def conditionalSuccess {d M T : ℕ} (L : KernelLearner d M T) (ε : ℝ)
(s : UnitSphere d) (x : Samples d T) : ℝ≥0∞ := body · 1 line
L.estimateLaw s x {u | angularError s u ≤ ε}def CompletedRules {d M T : ℕ} (L : KernelLearner d M T) : Prop := body · 1 line
∀ t q dest, AEMeasurable (fun obs => L.transition t q obs dest) (observationReference d)structure SeededLearner (d M T : ℕ) (Ω : Type u) where body · 1 line
rules : Ω → KernelLearner d M Tstructure Admissible {d M T : ℕ} {Ω : Type u} [MeasurableSpace Ω]
(L : SeededLearner d M T Ω) (ρ : Measure Ω) : Prop where body · 8 lines
completed_rules : ∀ᵐ ω ∂ρ, (L.rules ω).CompletedRules
fixed_experiment : ∀ s ε, AEMeasurable
(fun z : Ω × Samples d T => (L.rules z.1).conditionalSuccess ε s z.2)
(ρ.prod (sampleLaw d T))
uniform_experiment : ∀ ε, AEMeasurable
(fun z : UnitSphere d × (Ω × Samples d T) =>
(L.rules z.2.1).conditionalSuccess ε z.1 z.2.2)
((uniformSphere d).prod (ρ.prod (sampleLaw d T)))def success {d M T : ℕ} {Ω : Type u} [MeasurableSpace Ω]
(L : SeededLearner d M T Ω) (ρ : Measure Ω) (ε : ℝ) (s : UnitSphere d) : ℝ≥0∞ := body · 2 lines
∫⁻ z : Ω × Samples d T, (L.rules z.1).conditionalSuccess ε s z.2
∂(ρ.prod (sampleLaw d T))def uniformSuccess {d M T : ℕ} {Ω : Type u} [MeasurableSpace Ω]
(L : SeededLearner d M T Ω) (ρ : Measure Ω) (ε : ℝ) : ℝ≥0∞ := body · 3 lines
∫⁻ z : UnitSphere d × (Ω × Samples d T),
(L.rules z.2.1).conditionalSuccess ε z.1 z.2.2
∂((uniformSphere d).prod (ρ.prod (sampleLaw d T)))def ExplicitPrecision : Prop := body · 9 lines
∀ M : ℕ → ℕ,
Asymptotics.IsLittleO atTop (fun d => (M d : ℝ)) (fun d => (d : ℝ) ^ 2) →
∃ d₀ : ℕ, ∀ d : ℕ, d₀ ≤ d → ∀ T : ℕ, ∀ ε : ℝ,
0 < ε → ε ≤ 1 / 10 →
∀ (Ω : Type u) [MeasurableSpace Ω] (ρ : Measure Ω), IsProbabilityMeasure ρ →
∀ L : SeededLearner d (M d) T Ω, L.Admissible ρ →
((2 / 3 : ℝ≥0∞) ≤ L.uniformSuccess ρ ε ∨
∀ s, (2 / 3 : ℝ≥0∞) ≤ L.success ρ ε s) →
(2 : ℝ)⁻¹ ^ 16 * (d : ℝ) * Real.logb 2 (1 / ε) ≤ (T : ℝ)abbrev Vector (d : ℕ) := EuclideanSpace ℝ (Fin d) abbrev Sphere (E : Type*) [NormedAddCommGroup E] := Metric.sphere (0 : E) 1 def sphereLaw (E : Type*) [NormedAddCommGroup E] [InnerProductSpace ℝ E]
[FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] : Measure (Sphere E) := body · 2 lines
let σ := (volume : Measure E).toSphere
(σ Set.univ)⁻¹ • σstructure Test (d n : ℕ) where body · 7 lines
space : Submodule ℝ (Vector d)
dimension : Module.finrank ℝ space = n
center : Vector d
perpendicular : center ∈ spaceᗮ
radius : ℝ
radius_positive : 0 < radius
unit : ‖center‖^2 + radius^2 = 1def Test.point {d n : ℕ} (A : Test d n) (s : Sphere A.space) : Vector d := body · 1 line
A.center + A.radius • s.val.valabbrev Vector (d : ℕ) := Affine.Vector d abbrev Sphere (d : ℕ) := Metric.sphere (0 : Vector d) 1 abbrev Rows (d k : ℕ) := Fin k → Vector d abbrev Observation (d k : ℕ) := Rows d k × (Fin k → ℝ) def onTest {d n : ℕ} (A : Affine.Test d n) (s : Affine.Sphere A.space) : Sphere d := by body · 11 lines
refine ⟨A.point s,mem_sphere_zero_iff_norm.mpr ?_⟩
have hs : ‖(s.val : Vector d)‖ = 1 := by
rw [Submodule.norm_coe]
exact mem_sphere_zero_iff_norm.mp s.property
have ho : ⟪A.center, (s.val : Vector d)⟫ = 0 :=
Submodule.inner_left_of_mem_orthogonal s.val.property A.perpendicular
have hz : ‖A.point s‖^2 = 1 := by
rw [Affine.Test.point,norm_add_sq_real,real_inner_smul_right,ho,mul_zero,norm_smul,
Real.norm_eq_abs,abs_of_pos A.radius_positive,hs,mul_one]
nlinarith [A.unit]
nlinarith [norm_nonneg (A.point s)]def norm (d n : ℕ) (g : Sphere d → ℝ≥0∞) : ℝ≥0∞ := body · 2 lines
⨆ A : Affine.Test d n, (ENNReal.ofReal A.radius)^((d : ℝ)/16) *
∫⁻ s : Affine.Sphere A.space, g (onTest A s) ∂Affine.sphereLaw A.spacedef blockInput {d k : ℕ} {V : Type*} [Fintype V]
(κ : V → Observation d k → ℝ≥0∞) (g : V → Sphere d → ℝ≥0∞)
(s : Sphere d) : ℝ≥0∞ := body · 2 lines
∫⁻ X : Rows d k, ∑ v, κ v (X,fun i => ⟪X i,s.val⟫)*g v s
∂Measure.pi (fun _ => stdGaussian (Vector d))def terminalInput {d : ℕ} (π : Measure (Sphere d)) (ε : ℝ) (s : Sphere d) : ℝ≥0∞ := body · 1 line
π {u | Real.arccos ⟪u.val,s.val⟫ ≤ ε}def RadiusWeightedFullEstimate : Prop := body · 14 lines
∃ C : ℝ, 1 ≤ C ∧ ∃ d₀ : ℕ, ∀ d : ℕ, d₀ ≤ d →
(∀ W : ℝ, 1 ≤ W → ∀ (V : Type v) [Fintype V] [Nonempty V],
(Fintype.card V : ℝ) ≤ W →
∀ κ : V → Observation d (d/16) → ℝ≥0∞,
(∀ v, Measurable (κ v)) → (∀ obs, ∑ v, κ v obs ≤ 1) →
∀ g : V → Sphere d → ℝ≥0∞,
(∀ v, Measurable (g v)) → (∀ v s, g v s ≤ 1) →
∀ n : ℕ, (d : ℝ)/2 ≤ n → n ≤ d →
norm d n (blockInput κ g) ≤
(ENNReal.ofReal W)^(1/((d/16 : ℕ) : ℝ))*ENNReal.ofReal (C^d)*(⨆ v, norm d (n-2) (g v))) ∧
(∀ n : ℕ, (d : ℝ)/2 ≤ n → n ≤ d →
∀ π : Measure (Sphere d), IsProbabilityMeasure π →
∀ ε : ℝ, 0 < ε →
norm d n (terminalInput π ε) ≤ ENNReal.ofReal (C^d)*(ENNReal.ofReal ε)^((d : ℝ)/16))def HalfPrecision : Prop := body · 8 lines
∃ c : ℝ, 0 < c ∧ ∀ M : ℕ → ℕ,
Asymptotics.IsLittleO atTop (fun d => (M d : ℝ)) (fun d => (d : ℝ)^2) →
∃ d₀ : ℕ, ∀ d : ℕ, d₀ ≤ d → ∀ T : ℕ, ∀ ε : ℝ,
0 < ε → ε ≤ 1/10 →
∀ (Ω : Type u) [MeasurableSpace Ω] (ρ : Measure Ω), IsProbabilityMeasure ρ →
∀ L : SeededLearner d (M d) T Ω, L.Admissible ρ →
(1/2 : ℝ≥0∞) ≤ L.uniformSuccess ρ ε →
c * (d : ℝ) * Real.logb 2 (1/ε) ≤ (T : ℝ)abbrev Vector (m : ℕ) := EuclideanSpace ℝ (Fin m) abbrev Sphere (E : Type*) [NormedAddCommGroup E] := Metric.sphere (0 : E) 1 def sphereLaw (E : Type*) [NormedAddCommGroup E] [InnerProductSpace ℝ E]
[FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] : Measure (Sphere E) := body · 2 lines
let σ := (volume : Measure E).toSphere
(σ Set.univ)⁻¹ • σdef rowsLaw (E : Type*) [NormedAddCommGroup E] [InnerProductSpace ℝ E]
[FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] (T : ℕ) :
Measure (Fin T → E) := Measure.pi fun _ => stdGaussian E structure Stream (E J : Type*) [MeasurableSpace E] (T : ℕ) where body · 4 lines
initial : PMF J
transition : ℕ → J → (E × ℝ) → PMF J
output : J → Measure E
output_probability : ∀ q, IsProbabilityMeasure (output q)def run (L : Stream E J T) (s : E) (x : Fin T → E) : ℕ → PMF J body · 4 lines
| 0 => L.initial
| n+1 => (L.run s x n).bind fun q => if hn : n < T then
L.transition (n+1) q (x ⟨n,hn⟩, ⟪x ⟨n,hn⟩,s⟫)
else PMF.pure qdef estimateLaw (L : Stream E J T) (s : E) (x : Fin T → E) : Measure E := body · 1 line
(L.run s x T).toMeasure.bind L.outputdef euclideanSuccess (L : Stream E J T) (η : ℝ) (s : E) (x : Fin T → E) : ℝ≥0∞ := body · 1 line
L.estimateLaw s x {y | ‖y-s‖ ≤ η}def angularSuccess (L : Stream E J T) (ε : ℝ) (s : E) (x : Fin T → E) : ℝ≥0∞ := body · 1 line
L.estimateLaw s x {y | Real.arccos ⟪y,s⟫ ≤ ε}def BorelRules (L : Stream E J T) : Prop := body · 1 line
∀ n q a, Measurable (fun obs => L.transition n q obs a)def suffix (L : Stream E J T) (n k : ℕ) (v : J) : Stream E J k where body · 4 lines
initial := PMF.pure v
transition t := L.transition (n+t)
output := L.output
output_probability := L.output_probabilitydef DimensionEstimate : Prop := body · 13 lines
∃ C : ℝ, 2 ≤ C ∧ ∃ d₀ : ℕ, ∀ d : ℕ, d₀ ≤ d → ∀ j m : ℕ,
(d : ℝ)/2 + 2*j ≤ m → m ≤ d →
∀ η : ℝ, 0 < η →
∀ (Ω : Type u) [MeasurableSpace Ω] (ρ : Measure Ω), IsProbabilityMeasure ρ →
∀ L : Ω → Stream (Vector m) (Fin (2^(d^2))) (j*(d/32)),
(∀ᵐ ω ∂ρ, (L ω).BorelRules) →
AEMeasurable (fun z : Sphere (Vector m) × (Ω × (Fin (j*(d/32)) → Vector m)) =>
(L z.2.1).euclideanSuccess η z.1.val z.2.2)
((sphereLaw (Vector m)).prod (ρ.prod (rowsLaw (Vector m) (j*(d/32))))) →
(∫⁻ z : Sphere (Vector m) × (Ω × (Fin (j*(d/32)) → Vector m)),
(L z.2.1).euclideanSuccess η z.1.val z.2.2
∂(sphereLaw (Vector m)).prod (ρ.prod (rowsLaw (Vector m) (j*(d/32)))))
≤ ENNReal.ofReal ((C^(j+1)*η)^((d : ℝ)/32))def AllAffineFullEstimate : Prop := body · 14 lines
∃ d₀ : ℕ, ∀ d : ℕ, d₀ ≤ d → ∀ k : ℕ,
(d+1)/2 + 2*k ≤ d → ∀ W : ℝ, 1 ≤ W →
∀ (J : Type v) [Fintype J] [Nonempty J] [MeasurableSpace J] [MeasurableSingletonClass J],
(Fintype.card J : ℝ) ≤ W → W^(1/((d/8 : ℕ) : ℝ)) ≤ (2 : ℝ)^d →
∀ ε : ℝ, 0 < ε → ε ≤ 1/10 →
∀ (Ω : Type u) [MeasurableSpace Ω] (ρ : Measure Ω), IsProbabilityMeasure ρ →
∀ L : Ω → Fixed.Stream (Vector d) J (k*(d/16)),
(∀ᵐ ω ∂ρ, (L ω).BorelRules ∧ ∀ q, ∀ᵐ y ∂(L ω).output q, ‖y‖ = 1) →
∀ ell : ℕ, ell ≤ k → ∀ v : J, ∀ n : ℕ, (d+1)/2 + 2*ell ≤ n →
∀ A : Test d n,
(∫⁻ z : Sphere A.space × (Ω × (Fin (ell*(d/16)) → Vector d)),
((L z.2.1).suffix ((k-ell)*(d/16)) (ell*(d/16)) v).angularSuccess ε (A.point z.1) z.2.2
∂(sphereLaw A.space).prod (ρ.prod (Fixed.rowsLaw (Vector d) (ell*(d/16)))))
≤ ENNReal.ofReal (((16 * ((1000 : ℝ)^32)^ell * ε)/A.radius)^(2*(d/32)))def sphereLaw : Measure (Metric.sphere (0 : E) 1) := body · 2 lines
let σ := (volume : Measure E).toSphere
(σ Set.univ)⁻¹ • σdef ambientSphereLaw : Measure E := (sphereLaw (E := E)).map Subtype.val abbrev Orthogonal (E : Type*) [NormedAddCommGroup E] [InnerProductSpace ℝ E] [FiniteDimensional ℝ E] := body · 1 line
unitary (E →L[ℝ] E)instance orthogonal_compact : CompactSpace (Orthogonal E) := by body · 7 lines
apply isCompact_iff_compactSpace.mp
apply (isCompact_closedBall (0 : E →L[ℝ] E) 1).of_isClosed_subset isClosed_unitary
intro u hu
rw [Metric.mem_closedBall,dist_zero_right]
apply u.opNorm_le_bound (by norm_num)
intro x
simp only [u.norm_map_of_mem_unitary hu,one_mul,le_refl]noncomputable def orthogonalLaw : Measure (Orthogonal E) := body · 1 line
Measure.haarMeasure ⟨⟨Set.univ,isCompact_univ⟩,by simp⟩def blockIso (V : Submodule ℝ E) (u : Orthogonal V) (w : Orthogonal Vᗮ) : E ≃ₗᵢ[ℝ] E := body · 3 lines
(V.orthogonalDecomposition.trans
((Unitary.linearIsometryEquiv u).withLpProdCongr 2 (Unitary.linearIsometryEquiv w))).trans
V.orthogonalDecomposition.symmdef directionLaw (V N : Submodule ℝ E) : Measure E := body · 2 lines
((orthogonalLaw (E := Vᗮ)).prod (SubsphereRegression.ambientSphereLaw (E := N))).map
(fun z => blockIso V 1 z.1 (z.2 : E))def directionJointLaw (V N : Submodule ℝ E) (t : ℕ) : Measure (Fin t → E) := body · 3 lines
((orthogonalLaw (E := Vᗮ)).prod
(Measure.pi (fun _ : Fin t => SubsphereRegression.ambientSphereLaw (E := N)))).map
(fun z i => blockIso V 1 z.1 (z.2 i : E))def latitudeSpace (V : Submodule ℝ E) (e : Metric.sphere (0 : V) 1) : Submodule ℝ E := body · 1 line
(ℝ ∙ (e.val : E))ᗮdef latitudeLaw (V : Submodule ℝ E) (e : Metric.sphere (0 : V) 1) (a delta : ℝ) : Measure E := body · 4 lines
((betaMeasure a delta).prod ((orthogonalLaw (E := V)).prod
(SubsphereRegression.ambientSphereLaw (E := latitudeSpace V e)))).map
(fun z => blockIso V z.2.1 1
(Real.sqrt (1-z.1) • (e.val : E) + Real.sqrt z.1 • (z.2.2 : E)))def MixtureEstimate (E : Type*) [NormedAddCommGroup E] [InnerProductSpace ℝ E]
[FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] : Prop := body · 12 lines
(∀ (V N : Submodule ℝ E), V ≤ N → 1 ≤ Module.finrank ℝ V →
Module.finrank ℝ V < Module.finrank ℝ N → Module.finrank ℝ N < Module.finrank ℝ E →
∀ e : Metric.sphere (0 : V) 1,
directionLaw V N ≤ (2 : ℝ≥0∞) ^ Module.finrank ℝ E •
(SubsphereRegression.ambientSphereLaw + latitudeLaw V e
(((Module.finrank ℝ N : ℝ)-(Module.finrank ℝ V : ℝ))/2)
(((Module.finrank ℝ E : ℝ)-(Module.finrank ℝ N : ℝ))/2))) ∧
(∀ N : Submodule ℝ E, 1 ≤ Module.finrank ℝ N →
directionLaw ⊥ N = SubsphereRegression.ambientSphereLaw) ∧
(∀ (V : Submodule ℝ E) (t : ℕ), 1 ≤ Module.finrank ℝ E →
directionJointLaw V ⊤ t =
Measure.pi (fun _ : Fin t => SubsphereRegression.ambientSphereLaw))def CurrentMainScope : Prop := body · 7 lines
ExplicitPrecision.{u} ∧
Weighted.RadiusWeightedFullEstimate.{v} ∧
HalfPrecision.{u} ∧
Affine.AllAffineFullEstimate.{u,v} ∧
Fixed.DimensionEstimate.{u} ∧
(∀ (E : Type w) [NormedAddCommGroup E] [InnerProductSpace ℝ E]
[FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E], Mixture.MixtureEstimate E)Outline
- abbrev
Vector10 - abbrev
UnitSphere11 - abbrev
State12 - abbrev
Samples13 - def
uniformSphere15 - def
sampleLaw19 - def
observationReference22 - structure
KernelLearner25 - abbrev
RunStatus32 - def
tagged34 - def
run37 - def
terminal47 - def
estimateLaw54 - def
angularError58 - def
conditionalSuccess61 - def
CompletedRules65 - structure
SeededLearner70 - structure
Admissible75 - def
success86 - def
uniformSuccess91 - def
ExplicitPrecision98 - abbrev
Vector117 - abbrev
Sphere118 - def
sphereLaw120 - structure
Test125 - def
Test.point134 - abbrev
Vector145 - abbrev
Sphere146 - abbrev
Rows147 - abbrev
Observation148 - def
onTest150 - def
norm163 - def
blockInput167 - def
terminalInput173 - def
RadiusWeightedFullEstimate185 - def
HalfPrecision210 - abbrev
Vector229 - abbrev
Sphere230 - def
sphereLaw232 - def
rowsLaw237 - structure
Stream241 - def
run252 - def
estimateLaw258 - def
euclideanSuccess261 - def
angularSuccess264 - def
BorelRules267 - def
suffix270 - def
DimensionEstimate278 - def
AllAffineFullEstimate303 - def
sphereLaw330 - def
ambientSphereLaw339 - abbrev
Orthogonal349 - instance
orthogonal_compact352 - def
orthogonalLaw361 - def
blockIso372 - def
directionLaw386 - def
directionJointLaw390 - def
latitudeSpace395 - def
latitudeLaw398 - def
MixtureEstimate404 - def
CurrentMainScope426
Xet Storage Details
- Size:
- 17.9 kB
- Xet hash:
- 21d30a24f4fb728be9974be6c84a5f5c7c2f0f2aa785916ca90ca9be7c79fd68
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.