roseking commited on
Commit
0789dda
·
verified ·
1 Parent(s): dae740b

Add lean source and binary files (part 2)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. lean/ComparatorChallenges/ExactInfiniteness.lean +179 -0
  2. lean/ComparatorChallenges/ExactQuantumFactoring.json +14 -0
  3. lean/ComparatorChallenges/ExactQuantumFactoring.lean +154 -0
  4. lean/ComparatorChallenges/FKCRT.json +14 -0
  5. lean/ComparatorChallenges/FKCRT.lean +214 -0
  6. lean/ComparatorChallenges/FactorGeneration.json +14 -0
  7. lean/ComparatorChallenges/FactorGeneration.lean +50 -0
  8. lean/ComparatorChallenges/FalconerAllDimensions.json +14 -0
  9. lean/ComparatorChallenges/FalconerAllDimensions.lean +19 -0
  10. lean/ComparatorChallenges/FillingCoefficient.json +14 -0
  11. lean/ComparatorChallenges/FillingCoefficient.lean +130 -0
  12. lean/ComparatorChallenges/FiniteCircle.json +14 -0
  13. lean/ComparatorChallenges/FiniteCircle.lean +228 -0
  14. lean/ComparatorChallenges/FiniteCongruenceGraph.json +13 -0
  15. lean/ComparatorChallenges/FiniteCongruenceGraph.lean +63 -0
  16. lean/ComparatorChallenges/FiniteEntropySeparation.json +14 -0
  17. lean/ComparatorChallenges/FiniteEntropySeparation.lean +125 -0
  18. lean/ComparatorChallenges/FiniteFactor.json +14 -0
  19. lean/ComparatorChallenges/FiniteFactor.lean +46 -0
  20. lean/ComparatorChallenges/FinitisticAsymmetry.json +14 -0
  21. lean/ComparatorChallenges/FinitisticAsymmetry.lean +41 -0
  22. lean/ComparatorChallenges/FixedClauseThreshold.json +14 -0
  23. lean/ComparatorChallenges/FixedClauseThreshold.lean +56 -0
  24. lean/ComparatorChallenges/ForcedNavierStokesComputation.json +14 -0
  25. lean/ComparatorChallenges/ForcedNavierStokesComputation.lean +232 -0
  26. lean/ComparatorChallenges/ForestSpace.json +14 -0
  27. lean/ComparatorChallenges/ForestSpace.lean +468 -0
  28. lean/ComparatorChallenges/FormulaHitting.json +13 -0
  29. lean/ComparatorChallenges/FormulaHitting.lean +66 -0
  30. lean/ComparatorChallenges/FoulkesHowe.json +14 -0
  31. lean/ComparatorChallenges/FoulkesHowe.lean +50 -0
  32. lean/ComparatorChallenges/FourRowPermanent.json +14 -0
  33. lean/ComparatorChallenges/FourRowPermanent.lean +48 -0
  34. lean/ComparatorChallenges/FreeIsing.json +14 -0
  35. lean/ComparatorChallenges/FreeIsing.lean +95 -0
  36. lean/ComparatorChallenges/FreeUniformSpanningForest.json +14 -0
  37. lean/ComparatorChallenges/FreeUniformSpanningForest.lean +149 -0
  38. lean/ComparatorChallenges/GammaPassage.json +14 -0
  39. lean/ComparatorChallenges/GammaPassage.lean +112 -0
  40. lean/ComparatorChallenges/GaussianFiniteEntropy.json +14 -0
  41. lean/ComparatorChallenges/GaussianFiniteEntropy.lean +205 -0
  42. lean/ComparatorChallenges/GaussianInformation.json +17 -0
  43. lean/ComparatorChallenges/GaussianInformation.lean +204 -0
  44. lean/ComparatorChallenges/GaussianMoat.json +14 -0
  45. lean/ComparatorChallenges/GaussianMoat.lean +41 -0
  46. lean/ComparatorChallenges/GaussianPropeller.json +14 -0
  47. lean/ComparatorChallenges/GaussianPropeller.lean +43 -0
  48. lean/ComparatorChallenges/GaussianReplacement.json +24 -0
  49. lean/ComparatorChallenges/GaussianReplacement.lean +524 -0
  50. lean/ComparatorChallenges/GeneralMahler.json +14 -0
lean/ComparatorChallenges/ExactInfiniteness.lean ADDED
@@ -0,0 +1,179 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import Mathlib
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ universe u v
7
+ open scoped TensorProduct ENNReal ComplexOrder
8
+ open UniformSpace
9
+ namespace WeakPureInfiniteness
10
+
11
+ section CompletedOperators
12
+
13
+ variable {domain codomain : Type*}
14
+ [NormedAddCommGroup domain] [NormedSpace ℂ domain]
15
+ [NormedAddCommGroup codomain] [NormedSpace ℂ codomain]
16
+
17
+ lemma norm_completion_le (operator : domain →L[ℂ] codomain) :
18
+ ‖operator.completion‖ ≤ ‖operator‖ := by
19
+ apply ContinuousLinearMap.opNorm_le_bound _ (norm_nonneg operator)
20
+ intro vector
21
+ induction vector using Completion.induction_on with
22
+ | hp => exact isClosed_le (by fun_prop) (by fun_prop)
23
+ | ih vector => simpa using operator.le_opNorm vector
24
+
25
+ lemma norm_completion (operator : domain →L[ℂ] codomain) :
26
+ ‖operator.completion‖ = ‖operator‖ := by
27
+ apply le_antisymm (norm_completion_le operator)
28
+ apply ContinuousLinearMap.opNorm_le_bound _ (norm_nonneg _)
29
+ intro vector
30
+ simpa using operator.completion.le_opNorm (vector : Completion domain)
31
+
32
+ end CompletedOperators
33
+
34
+ structure ComplexHilbert where
35
+ Carrier : Type u
36
+ [normedAddCommGroup : NormedAddCommGroup Carrier]
37
+ [innerProductSpace : InnerProductSpace ℂ Carrier]
38
+ [completeSpace : CompleteSpace Carrier]
39
+
40
+ attribute [instance] ComplexHilbert.normedAddCommGroup
41
+ ComplexHilbert.innerProductSpace ComplexHilbert.completeSpace
42
+ instance : CoeSort ComplexHilbert.{u} (Type u) := ⟨ComplexHilbert.Carrier⟩
43
+
44
+ instance completedTensorCStar (H K : ComplexHilbert.{u}) :
45
+ CStarAlgebra (Completion (H ⊗[ℂ] K) →L[ℂ] Completion (H ⊗[ℂ] K)) := inferInstance
46
+
47
+ instance hilbertOperatorsCStar (H : ComplexHilbert.{u}) :
48
+ CStarAlgebra (H →L[ℂ] H) := inferInstance
49
+
50
+ structure SpatialRepresentation (A : Type u) (B : Type v)
51
+ [NonUnitalCStarAlgebra A] [NonUnitalCStarAlgebra B] where
52
+ left : ComplexHilbert.{max u v}
53
+ right : ComplexHilbert.{max u v}
54
+ leftRep : A →⋆ₙₐ[ℂ] (left →L[ℂ] left)
55
+ rightRep : B →⋆ₙₐ[ℂ] (right →L[ℂ] right)
56
+
57
+ abbrev SpatialRepresentation.hilbert {A : Type u} {B : Type v}
58
+ [NonUnitalCStarAlgebra A] [NonUnitalCStarAlgebra B]
59
+ (π : SpatialRepresentation A B) : ComplexHilbert.{max u v} where
60
+ Carrier := Completion (π.left ⊗[ℂ] π.right)
61
+
62
+ abbrev SpatialRepresentation.space {A : Type u} {B : Type v}
63
+ [NonUnitalCStarAlgebra A] [NonUnitalCStarAlgebra B]
64
+ (π : SpatialRepresentation A B) := Completion (π.left ⊗[ℂ] π.right)
65
+
66
+ def SpatialAmbient (A : Type u) (B : Type v)
67
+ [NonUnitalCStarAlgebra A] [NonUnitalCStarAlgebra B] : Type (max u v + 1) :=
68
+ lp (fun π : SpatialRepresentation A B => π.space →L[ℂ] π.space) ∞
69
+
70
+ instance spatialAmbientCStar (A : Type u) (B : Type v)
71
+ [NonUnitalCStarAlgebra A] [NonUnitalCStarAlgebra B] :
72
+ NonUnitalCStarAlgebra (SpatialAmbient A B) := by
73
+ unfold SpatialAmbient
74
+ infer_instance
75
+
76
+ instance spatialAmbientCoeFun (A : Type u) (B : Type v)
77
+ [NonUnitalCStarAlgebra A] [NonUnitalCStarAlgebra B] :
78
+ CoeFun (SpatialAmbient A B) (fun _ => ∀ π : SpatialRepresentation A B, π.space →L[ℂ] π.space) :=
79
+ ⟨fun z => z.val⟩
80
+
81
+ def spatialElementary {A : Type u} {B : Type v}
82
+ [NonUnitalCStarAlgebra A] [NonUnitalCStarAlgebra B]
83
+ (a : A) (b : B) : SpatialAmbient A B :=
84
+ ⟨fun π => (TensorProduct.mapL (π.leftRep a) (π.rightRep b)).completion,
85
+ memℓp_infty ⟨‖a‖ * ‖b‖, by
86
+ rintro _ ⟨π, rfl⟩
87
+ dsimp only
88
+ rw [norm_completion]
89
+ exact (TensorProduct.norm_mapL_le _ _).trans
90
+ (mul_le_mul (NonUnitalStarAlgHom.norm_apply_le π.leftRep a) (NonUnitalStarAlgHom.norm_apply_le π.rightRep b)
91
+ (norm_nonneg _) (norm_nonneg _))⟩⟩
92
+
93
+ def minimalTensorSubalgebra (A : Type u) (B : Type v)
94
+ [NonUnitalCStarAlgebra A] [NonUnitalCStarAlgebra B] :
95
+ NonUnitalStarSubalgebra ℂ (SpatialAmbient A B) :=
96
+ (NonUnitalStarAlgebra.adjoin ℂ (Set.range fun p : A × B => spatialElementary p.1 p.2)).topologicalClosure
97
+
98
+ abbrev MinimalTensor (A : Type u) (B : Type v)
99
+ [NonUnitalCStarAlgebra A] [NonUnitalCStarAlgebra B] := minimalTensorSubalgebra A B
100
+
101
+ instance (A : Type u) (B : Type v) [NonUnitalCStarAlgebra A] [NonUnitalCStarAlgebra B] :
102
+ NonUnitalCStarAlgebra (MinimalTensor A B) := by
103
+ letI : IsClosed ((minimalTensorSubalgebra A B : NonUnitalStarSubalgebra ℂ
104
+ (SpatialAmbient A B)) : Set (SpatialAmbient A B)) :=
105
+ isClosed_closure
106
+ exact inferInstance
107
+
108
+ section Exactness
109
+
110
+ variable {A : Type u} {C D : Type v}
111
+ [NonUnitalCStarAlgebra A] [NonUnitalCStarAlgebra C] [NonUnitalCStarAlgebra D]
112
+
113
+ def SpatialRepresentation.precompRight (π : SpatialRepresentation A D)
114
+ (q : C →⋆ₙₐ[ℂ] D) : SpatialRepresentation A C where
115
+ left := π.left
116
+ right := π.right
117
+ leftRep := π.leftRep
118
+ rightRep := π.rightRep.comp q
119
+
120
+ def tensorKernelIdeal (q : C →⋆ₙₐ[ℂ] D) : NonUnitalStarSubalgebra ℂ (SpatialAmbient A C) :=
121
+ (NonUnitalStarAlgebra.adjoin ℂ
122
+ {z | ∃ a : A, ∃ c : C, q c = 0 ∧ z = spatialElementary a c}).topologicalClosure
123
+
124
+ end Exactness
125
+
126
+ def Exact (A : Type u) [NonUnitalCStarAlgebra A] : Prop :=
127
+ ∀ (C D : Type u) [NonUnitalCStarAlgebra C] [NonUnitalCStarAlgebra D]
128
+ (q : C →⋆ₙₐ[ℂ] D), Function.Surjective q →
129
+ ∀ z : MinimalTensor A C,
130
+ (∀ π : SpatialRepresentation A D, (z.val : SpatialAmbient A C) (π.precompRight q) = 0) →
131
+ z.val ∈ tensorKernelIdeal (A := A) q
132
+
133
+ section Definitions
134
+
135
+ variable {A : Type*} [NonUnitalCStarAlgebra A] [PartialOrder A] [StarOrderedRing A]
136
+ variable {m k : Type*} [Fintype m] [Fintype k]
137
+
138
+ def CuntzSubequiv (a : CStarMatrix m m A) (b : CStarMatrix k k A) : Prop :=
139
+ ∀ ε : ℝ, 0 < ε → ∃ v : CStarMatrix k m A, ‖v.conjTranspose * b * v - a‖ < ε
140
+
141
+ def blockSum (a : CStarMatrix m m A) (b : CStarMatrix k k A) :
142
+ CStarMatrix (m ⊕ k) (m ⊕ k) A :=
143
+ CStarMatrix.ofMatrix (Matrix.fromBlocks (CStarMatrix.ofMatrix.symm a) 0 0
144
+ (CStarMatrix.ofMatrix.symm b))
145
+
146
+ def ProperlyInfinite (a : CStarMatrix m m A) : Prop :=
147
+ CuntzSubequiv (blockSum a a) a
148
+
149
+ def diagonalCopies (n : ℕ) (a : A) : CStarMatrix (Fin n) (Fin n) A :=
150
+ CStarMatrix.ofMatrix (Matrix.diagonal fun _ => a)
151
+
152
+ variable (A)
153
+
154
+ def WeaklyPurelyInfinite : Prop :=
155
+ ∃ n : ℕ, 1 ≤ n ∧ ∀ a : A, 0 ≤ a → a ≠ 0 → ProperlyInfinite (diagonalCopies n a)
156
+
157
+ def StronglyPurelyInfinite : Prop :=
158
+ ∀ a b : A, 0 ≤ a → 0 ≤ b → ∀ ε : ℝ, 0 < ε →
159
+ ∃ s t : A, ‖star s * (a * a) * s - a * a‖ < ε ∧
160
+ ‖star t * (b * b) * t - b * b‖ < ε ∧ ‖star s * a * b * t‖ < ε
161
+
162
+ end Definitions
163
+
164
+ theorem exact_weaklyPurelyInfinite_individuallyProperlyInfinite_any
165
+ {A : Type u} [NonUnitalCStarAlgebra A] [PartialOrder A] [StarOrderedRing A]
166
+ (hA : Exact A) (hW : WeaklyPurelyInfinite A) {a : A} (ha : 0 ≤ a) :
167
+ ProperlyInfinite (diagonalCopies 1 a) := by
168
+ sorry
169
+
170
+ theorem exact_weaklyPurelyInfinite_stronglyPurelyInfinite
171
+ (A : Type u) [NonUnitalCStarAlgebra A] [PartialOrder A] [StarOrderedRing A]
172
+ (hExact : Exact A) (hWeak : WeaklyPurelyInfinite A) : StronglyPurelyInfinite A := by
173
+ sorry
174
+
175
+ end WeakPureInfiniteness
176
+
177
+ end
178
+
179
+ end OAI
lean/ComparatorChallenges/ExactQuantumFactoring.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "challenge_module": "ComparatorChallenges.ExactQuantumFactoring",
3
+ "solution_module": "OAI.Computability.QuantumFactoring.Main",
4
+ "theorem_names": [
5
+ "OAI.ExactQuantumFactoring.exact_quantum_factoring"
6
+ ],
7
+ "definition_names": [],
8
+ "permitted_axioms": [
9
+ "propext",
10
+ "Quot.sound",
11
+ "Classical.choice"
12
+ ],
13
+ "enable_nanoda": false
14
+ }
lean/ComparatorChallenges/ExactQuantumFactoring.lean ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import Mathlib
2
+
3
+ namespace OAI
4
+
5
+
6
+
7
+ namespace ExactQuantumFactoring
8
+
9
+ open scoped BigOperators
10
+
11
+ /-- The five primitive gates exactly as in Section 2. -/
12
+ inductive Primitive where
13
+ | not | cnot | toffoli | hadamard | phase
14
+ deriving DecidableEq
15
+
16
+ def Primitive.arity : Primitive → ℕ
17
+ | .not | .hadamard | .phase => 1
18
+ | .cnot => 2
19
+ | .toffoli => 3
20
+
21
+ def Primitive.code : Primitive → ℕ
22
+ | .not => 0 | .cnot => 1 | .toffoli => 2 | .hadamard => 3 | .phase => 4
23
+
24
+ /-- An inverse and/or one added control. This is a fixed set of 20 gate names,
25
+ not an unbounded-control or arbitrary-angle gate model. -/
26
+ structure Gate where
27
+ primitive : Primitive
28
+ inverse : Bool
29
+ controlled : Bool
30
+ deriving DecidableEq
31
+
32
+ def Gate.arity (g : Gate) : ℕ := g.primitive.arity + if g.controlled then 1 else 0
33
+
34
+ /-- Matrix entries are indexed by lists in wire order (row first, column second).
35
+ Entries on ill-sized lists are irrelevant and set to zero. -/
36
+ noncomputable def Primitive.matrix : Primitive → List Bool → List Bool → ℂ
37
+ | .not, [a], [b] => if a = !b then 1 else 0
38
+ | .cnot, [a,b], [c,d] => if a = c ∧ b = Bool.xor c d then 1 else 0
39
+ | .toffoli, [a,b,c], [d,e,f] =>
40
+ if a = d ∧ b = e ∧ c = Bool.xor f (d && e) then 1 else 0
41
+ | .hadamard, [a], [b] =>
42
+ (if a && b then -1 else 1) / (Real.sqrt 2 : ℂ)
43
+ | .phase, [a], [b] => if a = b then (if b then Complex.I else 1) else 0
44
+ | _, _, _ => 0
45
+
46
+ noncomputable def Gate.baseMatrix (g : Gate) (a b : List Bool) : ℂ :=
47
+ if g.inverse then star (g.primitive.matrix b a) else g.primitive.matrix a b
48
+
49
+ noncomputable def Gate.matrix (g : Gate) (a b : List Bool) : ℂ :=
50
+ if g.controlled then
51
+ match a, b with
52
+ | false :: a', false :: b' => if a' = b' then 1 else 0
53
+ | true :: a', true :: b' => g.baseMatrix a' b'
54
+ | _, _ => 0
55
+ else g.baseMatrix a b
56
+
57
+ /-- A primitive is placed on distinct actual wires, with no operation of
58
+ unbounded arity hidden in a circuit instruction. -/
59
+ structure Instruction (q : ℕ) where
60
+ gate : Gate
61
+ wire : Fin gate.arity → Fin q
62
+ distinct : Function.Injective wire
63
+
64
+ abbrev Basis (q : ℕ) := Fin q → Bool
65
+ abbrev State (q : ℕ) := Basis q → ℂ
66
+
67
+ noncomputable def Instruction.matrix {q : ℕ} (o : Instruction q) :
68
+ Matrix (Basis q) (Basis q) ℂ := by
69
+ classical
70
+ exact fun a b =>
71
+ if ∀ i : Fin q, (∀ j, o.wire j ≠ i) → a i = b i then
72
+ o.gate.matrix (List.ofFn (a ∘ o.wire)) (List.ofFn (b ∘ o.wire))
73
+ else 0
74
+
75
+ structure Circuit where
76
+ qubits : ℕ
77
+ instructions : List (Instruction qubits)
78
+
79
+ noncomputable def Circuit.apply (c : Circuit) (ψ : State c.qubits) : State c.qubits :=
80
+ c.instructions.foldl (fun v o => o.matrix.mulVec v) ψ
81
+
82
+ /-- Input wires are first, least significant bit first; all other wires start zero. -/
83
+ def inputBasis (q ℓ N : ℕ) : Basis q :=
84
+ fun i => if i.val < ℓ then N.testBit i.val else false
85
+
86
+ noncomputable def Circuit.outputState (c : Circuit) (ℓ N : ℕ) : State c.qubits := by
87
+ classical
88
+ exact c.apply (fun x => if x = inputBasis c.qubits ℓ N then 1 else 0)
89
+
90
+ /-- The cutoff and padding are the standing parameters in Section 2. -/
91
+ def paddedLength (ℓ : ℕ) : ℕ := max 128 ℓ
92
+
93
+ def readBit {q : ℕ} (x : Basis q) (i : ℕ) : Bool :=
94
+ if h : i < q then x ⟨i,h⟩ else false
95
+
96
+ /-- n entries of n bits each, in the n² wires immediately after the input. -/
97
+ def outputList {q : ℕ} (ℓ : ℕ) (x : Basis q) : List ℕ :=
98
+ let n := paddedLength ℓ
99
+ List.ofFn (fun a : Fin n =>
100
+ ∑ j ∈ Finset.range n, if readBit x (ℓ + a.val * n + j) then 2^j else 0)
101
+
102
+ /-- Complete nondecreasing prime factorization, multiplicities included,
103
+ padded by zeros, as in Section 6. There is no primality oracle in the circuit. -/
104
+ def CorrectEncoding (N n : ℕ) (xs : List ℕ) : Prop :=
105
+ ∃ ps : List ℕ, (∀ p ∈ ps, Nat.Prime p) ∧ ps.Pairwise (· ≤ ·) ∧
106
+ ps.prod = N ∧ ps.length ≤ n ∧ xs = ps ++ List.replicate (n - ps.length) 0
107
+
108
+ /-- Unnormalized Born sum on correct outputs; success is exactly one,
109
+ not positivity, postselection, or a limiting high probability. -/
110
+ noncomputable def Circuit.correctProbability (c : Circuit) (ℓ N : ℕ) : ℝ := by
111
+ classical
112
+ exact ∑ x : Basis c.qubits,
113
+ if CorrectEncoding N (paddedLength ℓ) (outputList ℓ x) then
114
+ Complex.normSq (c.outputState ℓ N x) else 0
115
+
116
+ /-- Unary natural words with delimiters make the circuit description explicit.
117
+ Unary wire addresses cause at most polynomial overhead when width is polynomial. -/
118
+ def natWord (k : ℕ) : List Bool := List.replicate k true ++ [false]
119
+
120
+ def Instruction.encode {q : ℕ} (o : Instruction q) : List Bool :=
121
+ natWord o.gate.primitive.code ++ [o.gate.inverse, o.gate.controlled] ++
122
+ (List.ofFn (fun i => o.wire i |>.val)).flatMap natWord
123
+
124
+ def Circuit.encode (c : Circuit) : List Bool :=
125
+ natWord c.qubits ++ natWord c.instructions.length ++
126
+ c.instructions.flatMap Instruction.encode
127
+
128
+ /-- A single finite-alphabet classical generator receives only the INPUT LENGTH.
129
+ All stack alphabets, states and labels are finite: no large-integer unit-cost
130
+ oracle is hidden in TM2 push/branch functions. -/
131
+ def Uniform (family : ℕ → Circuit) : Prop :=
132
+ ∃ generator : Turing.TM2ComputableInPolyTime
133
+ (fun ℓ => List.replicate ℓ true) Circuit.encode family,
134
+ ∀ k, Finite (generator.tm.Γ k)
135
+
136
+ def PolynomialResources (family : ℕ → Circuit) : Prop :=
137
+ ∃ bound : Polynomial ℕ, ∀ ℓ,
138
+ (family ℓ).qubits ≤ bound.eval ℓ ∧
139
+ (family ℓ).instructions.length ≤ bound.eval ℓ
140
+
141
+ /-- Literal main endpoint: one length-uniform family, exact output for EVERY
142
+ binary integer N≥2, and worst-case polynomial gates AND qubits. -/
143
+ def MainTheorem : Prop :=
144
+ ∃ family : ℕ → Circuit, Uniform family ∧ PolynomialResources family ∧
145
+ ∀ (ℓ N : ℕ), 2 ≤ N → N.size = ℓ →
146
+ ℓ + (paddedLength ℓ)^2 ≤ (family ℓ).qubits ∧
147
+ (family ℓ).correctProbability ℓ N = 1
148
+
149
+ theorem exact_quantum_factoring : MainTheorem := by
150
+ sorry
151
+
152
+ end ExactQuantumFactoring
153
+
154
+ end OAI
lean/ComparatorChallenges/FKCRT.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "challenge_module": "ComparatorChallenges.FKCRT",
3
+ "solution_module": "OAI.Probability.FKMaps.Convergence",
4
+ "theorem_names": [
5
+ "OAI.FKCRT.finite_fk_maps_converge_to_brownian_crt"
6
+ ],
7
+ "definition_names": [],
8
+ "permitted_axioms": [
9
+ "propext",
10
+ "Quot.sound",
11
+ "Classical.choice"
12
+ ],
13
+ "enable_nanoda": false
14
+ }
lean/ComparatorChallenges/FKCRT.lean ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import Mathlib
2
+
3
+ namespace OAI
4
+
5
+ /-!
6
+ Finite Fortuin–Kasteleyn maps and the Brownian continuum random tree.
7
+
8
+ All combinatorial maps below have a distinguished dart 0 and are quotiented
9
+ by orientation-preserving dart relabellings fixing that dart. A rotation system
10
+ with Euler characteristic 2 encodes precisely a connected oriented-sphere map.
11
+ No simplicity restriction is imposed. Vertices and edges are rotation and
12
+ edge-reversal orbits, respectively. Every edge subset is included in the law.
13
+ The index n here represents source size n+1, so the limit is through ALL
14
+ positive edge sizes, not a subsequence.
15
+
16
+ MetricMeasureData packages the actual distance, measurable space and measure,
17
+ without using arbitrary representatives of measure-preserving isometry classes
18
+ as a global typeclass. Valid objects are compact metric probability spaces.
19
+ The GHP extended distance is the infimum over common isometric embeddings,
20
+ represented by pseudometrics on the disjoint union; zero cross distances simply
21
+ identify points in the common ambient space. Tests are bounded functions
22
+ continuous for that distance on valid objects. Thus GHP convergence is written
23
+ in its bounded-continuous-test (weak distributional convergence) definition.
24
+
25
+ A standard normalized Brownian excursion is represented in its standard
26
+ three-dimensional Bessel-bridge realization: the norm of three independent
27
+ standard Brownian bridges of duration 1. No rescaling of the excursion is used.
28
+ -/
29
+
30
+ noncomputable section
31
+ open Set Filter MeasureTheory ProbabilityTheory
32
+ open scoped Topology BigOperators ENNReal NNReal
33
+
34
+ namespace FKCRT
35
+
36
+ abbrev Dart (n : ℕ) := Fin (2 * (n + 1))
37
+
38
+ abbrev Orbit {n : ℕ} (s : Equiv.Perm (Dart n)) :=
39
+ Quotient (Equiv.Perm.SameCycle.setoid s)
40
+
41
+ def orbit {n : ℕ} (s : Equiv.Perm (Dart n)) (d : Dart n) : Orbit s :=
42
+ Quotient.mk _ d
43
+
44
+ instance {n : ℕ} (s : Equiv.Perm (Dart n)) : Fintype (Orbit s) := Fintype.ofFinite _
45
+
46
+ /-- The spanning graph with precisely the edges in A, with loops omitted only
47
+ from adjacency: they still exist as edge orbits, have FK weight, and contribute
48
+ two darts to the degree measure. Omitting loops does not change distance or k. -/
49
+ def spanningGraph {n : ℕ} (a s : Equiv.Perm (Dart n)) (A : Set (Orbit a)) :
50
+ SimpleGraph (Orbit s) :=
51
+ SimpleGraph.fromRel fun v w =>
52
+ ∃ d : Dart n, orbit a d ∈ A ∧ orbit s d = v ∧ orbit s (a d) = w
53
+
54
+ /-- Labelled connected orientable genus-zero rotation systems. -/
55
+ def MapConditions {n : ℕ} (P : Equiv.Perm (Dart n) × Equiv.Perm (Dart n)) : Prop :=
56
+ Function.Involutive P.1 ∧ (∀ d, P.1 d ≠ d) ∧
57
+ (spanningGraph P.1 P.2 Set.univ).Connected ∧
58
+ Nat.card (Orbit P.2) + Nat.card (Orbit (P.2 * P.1)) = n + 3
59
+
60
+ abbrev LabelledMap (n : ℕ) :=
61
+ {P : Equiv.Perm (Dart n) × Equiv.Perm (Dart n) // MapConditions P}
62
+
63
+ /-- Root-preserving isomorphism of oriented maps (both dart permutations intertwine). -/
64
+ def MapIso {n : ℕ} (M N : LabelledMap n) : Prop :=
65
+ ∃ r : Equiv.Perm (Dart n), r 0 = 0 ∧
66
+ (∀ d, N.val.1 (r d) = r (M.val.1 d)) ∧
67
+ (∀ d, N.val.2 (r d) = r (M.val.2 d))
68
+
69
+ abbrev RootedMap (n : ℕ) := Quotient (Relation.EqvGen.setoid (@MapIso n))
70
+
71
+ instance (n : ℕ) : Fintype (RootedMap n) := Fintype.ofFinite _
72
+
73
+ def reversal {n : ℕ} (M : RootedMap n) : Equiv.Perm (Dart n) := M.out.val.1
74
+
75
+ def rotation {n : ℕ} (M : RootedMap n) : Equiv.Perm (Dart n) := M.out.val.2
76
+
77
+ abbrev Vertex {n : ℕ} (M : RootedMap n) := Orbit (rotation M)
78
+ abbrev Edge {n : ℕ} (M : RootedMap n) := Orbit (reversal M)
79
+
80
+ def graph {n : ℕ} (M : RootedMap n) (A : Set (Edge M)) : SimpleGraph (Vertex M) :=
81
+ spanningGraph (reversal M) (rotation M) A
82
+
83
+ /-- The source k_M(A), including isolated vertices. -/
84
+ def clusterCount {n : ℕ} (M : RootedMap n) (A : Finset (Edge M)) : ℕ :=
85
+ Nat.card (graph M (A : Set (Edge M))).ConnectedComponent
86
+
87
+ /-- Exact decorated finite-map weight from eq:finite-law. -/
88
+ def fkWeight {n : ℕ} (q : ℝ) (M : RootedMap n) (A : Finset (Edge M)) : ℝ :=
89
+ Real.rpow q ((clusterCount M A : ℝ) +
90
+ ((A.card : ℝ) - (Nat.card (Vertex M) : ℝ)) / 2)
91
+
92
+ def partition (q : ℝ) (n : ℕ) : ℝ :=
93
+ ∑ M : RootedMap n, ∑ A : Finset (Edge M), fkWeight q M A
94
+
95
+ /-- Unbundled presentation of a measured metric space; validity is specified below. -/
96
+ structure MetricMeasureData where
97
+ Carrier : Type
98
+ distance : Carrier → Carrier → ℝ
99
+ measurableSpace : MeasurableSpace Carrier
100
+ mass : @Measure Carrier measurableSpace
101
+
102
+ /-- Exactly compact metric probability spaces, with their Borel sigma algebras. -/
103
+ def MetricMeasureData.Valid (X : MetricMeasureData) : Prop :=
104
+ ∃ m : MetricSpace X.Carrier,
105
+ letI := m
106
+ (∀ x y, dist x y = X.distance x y) ∧
107
+ CompactSpace X.Carrier ∧ X.measurableSpace = borel X.Carrier ∧
108
+ X.mass Set.univ = 1
109
+
110
+ /-- Normalized degree measure is uniform dart mass pushed to vertices. -/
111
+ def degreeMass {n : ℕ} (M : RootedMap n) :
112
+ @Measure (Vertex M) ⊤ :=
113
+ letI : MeasurableSpace (Vertex M) := ⊤
114
+ ∑ d : Dart n, ENNReal.ofReal (1 / (2 * (n + 1) : ℝ)) •
115
+ Measure.dirac (orbit (rotation M) d)
116
+
117
+ /-- Root and decoration are not included in the metric probability space. -/
118
+ def mapSpace {n : ℕ} (scale : ℝ) (M : RootedMap n) : MetricMeasureData where
119
+ Carrier := Vertex M
120
+ distance v w := scale * ((graph M Set.univ).dist v w : ℝ)
121
+ measurableSpace := ⊤
122
+ mass := degreeMass M
123
+
124
+ /-- An ambient pseudometric on the disjoint union giving isometric embeddings. -/
125
+ def Amalgamates (X Y : MetricMeasureData)
126
+ (m : PseudoMetricSpace (X.Carrier ⊕ Y.Carrier)) : Prop :=
127
+ letI := m
128
+ (∀ x x', dist (Sum.inl x : X.Carrier ⊕ Y.Carrier) (Sum.inl x') = X.distance x x') ∧
129
+ (∀ y y', dist (Sum.inr y : X.Carrier ⊕ Y.Carrier) (Sum.inr y') = Y.distance y y')
130
+
131
+ def ambientCost (X Y : MetricMeasureData)
132
+ (m : PseudoMetricSpace (X.Carrier ⊕ Y.Carrier)) : ℝ≥0∞ :=
133
+ letI := m
134
+ letI : MeasurableSpace (X.Carrier ⊕ Y.Carrier) := borel _
135
+ max (Metric.hausdorffEDist (Set.range (Sum.inl : X.Carrier → X.Carrier ⊕ Y.Carrier))
136
+ (Set.range (Sum.inr : Y.Carrier → X.Carrier ⊕ Y.Carrier)))
137
+ (levyProkhorovEDist
138
+ (@Measure.map X.Carrier (X.Carrier ⊕ Y.Carrier) X.measurableSpace
139
+ (borel _) Sum.inl X.mass)
140
+ (@Measure.map Y.Carrier (X.Carrier ⊕ Y.Carrier) Y.measurableSpace
141
+ (borel _) Sum.inr Y.mass))
142
+
143
+ /-- The common-isometric-embedding definition of the source GHP distance. -/
144
+ def ghpEDist (X Y : MetricMeasureData) : ℝ≥0∞ :=
145
+ ⨅ m : {m : PseudoMetricSpace (X.Carrier ⊕ Y.Carrier) // Amalgamates X Y m},
146
+ ambientCost X Y m.val
147
+
148
+ /-- Bounded continuous tests on compact metric probability spaces modulo
149
+ measure-preserving isometry, expressed on presentations. -/
150
+ def IsGHPTest (F : MetricMeasureData → ℝ) : Prop :=
151
+ (∃ C : ℝ, ∀ X, |F X| ≤ C) ∧
152
+ ∀ X, X.Valid → ∀ ε : ℝ, 0 < ε → ∃ δ : ℝ, 0 < δ ∧
153
+ ∀ Y, Y.Valid → ghpEDist X Y < ENNReal.ofReal δ → |F Y - F X| < ε
154
+
155
+ /-- Source excursion pseudometric, with the closed interval minimum. -/
156
+ def excursionDist (e : unitInterval → ℝ) (s t : unitInterval) : ℝ :=
157
+ e s + e t - 2 * sInf (e '' Set.uIcc s t)
158
+
159
+ abbrev ExcursionTree (e : unitInterval → ℝ) :=
160
+ Quotient (Relation.EqvGen.setoid (fun s t => excursionDist e s t = 0))
161
+
162
+ def treeProjection (e : unitInterval → ℝ) (t : unitInterval) : ExcursionTree e :=
163
+ Quotient.mk _ t
164
+
165
+ /-- The quotient by d_e=0, its induced metric, and pushforward of uniform time.
166
+ The equivalence closure is redundant for continuous e; the induced distance
167
+ is independent of representatives, as required by the pseudometric proof. -/
168
+ def treeSpace (e : unitInterval → ℝ) : MetricMeasureData :=
169
+ letI : TopologicalSpace (ExcursionTree e) :=
170
+ TopologicalSpace.coinduced (treeProjection e) inferInstance
171
+ letI : MeasurableSpace (ExcursionTree e) := borel _
172
+ { Carrier := ExcursionTree e
173
+ distance := fun x y => excursionDist e x.out y.out
174
+ measurableSpace := borel _
175
+ mass := Measure.map (treeProjection e) (volume : Measure unitInterval) }
176
+
177
+ /-- Standard normalized excursion, realized as the 3D Bessel bridge. -/
178
+ def standardExcursion {Ω : Type} (B : Fin 3 → ℝ≥0 → Ω → ℝ) (ω : Ω)
179
+ (t : unitInterval) : ℝ :=
180
+ Real.sqrt (∑ i : Fin 3, (B i ⟨(t : ℝ), t.property.1⟩ ω -
181
+ (t : ℝ) * B i 1 ω) ^ 2)
182
+
183
+ /-- Exact expectation under the finite law, with n+1 edges. -/
184
+ def finiteExpectation (q scale : ℝ) (n : ℕ) (F : MetricMeasureData → ℝ) : ℝ :=
185
+ ∑ M : RootedMap n, ∑ A : Finset (Edge M),
186
+ (fkWeight q M A / partition q n) * F (mapSpace scale M)
187
+
188
+ def brownianExpectation {Ω : Type} [MeasurableSpace Ω] (P : Measure Ω)
189
+ (B : Fin 3 → ℝ≥0 → Ω → ℝ) (F : MetricMeasureData → ℝ) : ℝ :=
190
+ ∫ ω, F (treeSpace (standardExcursion B ω)) ∂P
191
+
192
+ /-- thm:main. The quantifiers over Brownian realizations express that the limit
193
+ is the standard excursion-tree law, not a coupling-specific object. -/
194
+ def MainStatement : Prop :=
195
+ ∀ q : ℝ, 4 < q → ∃ c : ℝ, 0 < c ∧
196
+ ∀ (Ω : Type) (mΩ : MeasurableSpace Ω) (P : @Measure Ω mΩ),
197
+ @IsProbabilityMeasure Ω mΩ P →
198
+ ∀ B : Fin 3 → ℝ≥0 → Ω → ℝ,
199
+ (∀ i, @IsBrownianReal Ω mΩ (B i) P) →
200
+ @iIndepFun Ω (Fin 3) mΩ (fun _ => ℝ≥0 → ℝ) (fun _ => inferInstance)
201
+ (fun i ω t => B i t ω) P →
202
+ ∀ F : MetricMeasureData → ℝ, IsGHPTest F →
203
+ Tendsto (fun n : ℕ => finiteExpectation q (c / Real.sqrt (n + 1)) n F)
204
+ atTop (𝓝 (@brownianExpectation Ω mΩ P B F))
205
+
206
+
207
+ /-- Finite FK maps converge in GHP distribution to the standard Brownian CRT. -/
208
+ theorem finite_fk_maps_converge_to_brownian_crt : MainStatement := by
209
+ sorry
210
+
211
+ end FKCRT
212
+ end
213
+
214
+ end OAI
lean/ComparatorChallenges/FactorGeneration.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "challenge_module": "ComparatorChallenges.FactorGeneration",
3
+ "solution_module": "OAI.Analysis.FactorGeneration.Main",
4
+ "theorem_names": [
5
+ "OAI.Generator.single_generation_of_II1_separable_predual"
6
+ ],
7
+ "definition_names": [],
8
+ "permitted_axioms": [
9
+ "propext",
10
+ "Quot.sound",
11
+ "Classical.choice"
12
+ ],
13
+ "enable_nanoda": false
14
+ }
lean/ComparatorChallenges/FactorGeneration.lean ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import Mathlib.Analysis.CStarAlgebra.ContinuousLinearMap
2
+ import Mathlib.Analysis.InnerProductSpace.WeakOperatorTopology
3
+ import Mathlib.Analysis.VonNeumannAlgebra.Basic
4
+
5
+ namespace OAI
6
+
7
+ noncomputable section
8
+
9
+ namespace Generator
10
+
11
+ universe u
12
+
13
+ variable {H : Type u} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H]
14
+
15
+ attribute [-instance] instCStarAlgebraContinuousLinearMapComplexIdOfCompleteSpace
16
+
17
+ def WOTClosed (S : StarSubalgebra ℂ (H →L[ℂ] H)) : Prop :=
18
+ IsClosed {T : H →WOT[ℂ] H | T.toCLM ∈ S}
19
+
20
+ def wstar (s : Set (H →L[ℂ] H)) : StarSubalgebra ℂ (H →L[ℂ] H) :=
21
+ sInf {S | WOTClosed S ∧ s ⊆ S}
22
+
23
+ structure IsII1Factor (S : StarSubalgebra ℂ (H →L[ℂ] H)) : Prop where
24
+ nonzero : (0 : H →L[ℂ] H) ≠ 1
25
+ weaklyClosed : WOTClosed S
26
+ factor : ∀ x : S, (∀ y : S, y * x = x * y) → ∃ c : ℂ, x = algebraMap ℂ S c
27
+ finite : ∀ v : S, star v * v = 1 → v * star v = 1
28
+ diffuse : ∀ p : S, IsStarProjection p → p ≠ 0 →
29
+ ∃ q : S, IsStarProjection q ∧ q ≠ 0 ∧ q ≠ p ∧ p * q = q ∧ q * p = q
30
+
31
+ def HasSeparablePredual (S : StarSubalgebra ℂ (H →L[ℂ] H)) : Prop :=
32
+ ∃ (X : Type u) (_ : NormedAddCommGroup X) (_ : NormedSpace ℂ X)
33
+ (_ : CompleteSpace X) (_ : TopologicalSpace.SeparableSpace X),
34
+ Nonempty (StrongDual ℂ X ≃ₗᵢ⋆[ℂ] S)
35
+
36
+ def SinglyGenerated (S : StarSubalgebra ℂ (H →L[ℂ] H)) : Prop :=
37
+ ∃ x ∈ S, wstar {x} = S
38
+
39
+ attribute [instance] instCStarAlgebraContinuousLinearMapComplexIdOfCompleteSpace
40
+
41
+ theorem single_generation_of_II1_separable_predual
42
+ (S : StarSubalgebra ℂ (H →L[ℂ] H)) (hS : IsII1Factor S)
43
+ (hsep : HasSeparablePredual S) : SinglyGenerated S := by
44
+ sorry
45
+
46
+ end Generator
47
+
48
+ end
49
+
50
+ end OAI
lean/ComparatorChallenges/FalconerAllDimensions.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "challenge_module": "ComparatorChallenges.FalconerAllDimensions",
3
+ "solution_module": "OAI.MeasureTheory.Falconer.Campaign123PlanarFurstenbergProof",
4
+ "theorem_names": [
5
+ "OAI.Falconer.falconer_distance_conjecture"
6
+ ],
7
+ "definition_names": [],
8
+ "permitted_axioms": [
9
+ "propext",
10
+ "Quot.sound",
11
+ "Classical.choice"
12
+ ],
13
+ "enable_nanoda": false
14
+ }
lean/ComparatorChallenges/FalconerAllDimensions.lean ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import Mathlib
2
+
3
+ namespace OAI
4
+
5
+ namespace Falconer
6
+ open MeasureTheory
7
+ open scoped ENNReal
8
+
9
+ /-- A compact subset of Euclidean space with Hausdorff dimension greater than
10
+ half the ambient dimension determines a distance set of positive Lebesgue measure. -/
11
+ theorem falconer_distance_conjecture :
12
+ ∀ (d : ℕ), 2 ≤ d → ∀ E : Set (EuclideanSpace ℝ (Fin d)), IsCompact E →
13
+ (d : ℝ≥0∞) / 2 < dimH E →
14
+ 0 < volume {r : ℝ | ∃ x ∈ E, ∃ y ∈ E, dist x y = r} := by
15
+ sorry
16
+
17
+ end Falconer
18
+
19
+ end OAI
lean/ComparatorChallenges/FillingCoefficient.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "challenge_module": "ComparatorChallenges.FillingCoefficient",
3
+ "solution_module": "OAI.Geometry.IntegralFillings.Main",
4
+ "theorem_names": [
5
+ "OAI.SharpIntegralFillings.coefficient_optimal"
6
+ ],
7
+ "definition_names": [],
8
+ "permitted_axioms": [
9
+ "propext",
10
+ "Classical.choice",
11
+ "Quot.sound"
12
+ ],
13
+ "enable_nanoda": false
14
+ }
lean/ComparatorChallenges/FillingCoefficient.lean ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import Mathlib
2
+
3
+ namespace OAI
4
+
5
+ open Set Filter MeasureTheory
6
+ open scoped Topology ENNReal NNReal
7
+
8
+ namespace SharpIntegralFillings
9
+
10
+ attribute [local instance] Classical.propDecidable
11
+
12
+ universe u
13
+
14
+ abbrev Euc (k : ℕ) := EuclideanSpace ℝ (Fin k)
15
+ abbrev Functional (X : Type u) (k : ℕ) := (X → ℝ) → (Fin k → X → ℝ) → ℝ
16
+
17
+ section MetricCurrents
18
+
19
+ variable {X : Type u} [MetricSpace X] [MeasurableSpace X] [BorelSpace X]
20
+
21
+ def BoundedLip (b : X → ℝ) : Prop :=
22
+ (∃ K : ℝ≥0, LipschitzWith K b) ∧ ∃ M : ℝ, ∀ x, |b x| ≤ M
23
+
24
+ def Admissible {k : ℕ} (b : X → ℝ) (π : Fin k → X → ℝ) : Prop :=
25
+ BoundedLip b ∧ ∀ i, ∃ K : ℝ≥0, LipschitzWith K (π i)
26
+
27
+ def Controls {k : ℕ} (T : Functional X k) (μ : Measure X) : Prop :=
28
+ ∀ (b : X → ℝ) (π : Fin k → X → ℝ), BoundedLip b →
29
+ (∀ i, LipschitzWith 1 (π i)) →
30
+ |T b π| ≤ ∫ x, |b x| ∂μ
31
+
32
+ noncomputable def mass {k : ℕ} (T : Functional X k) : ℝ :=
33
+ sInf {r : ℝ | ∃ μ : Measure X,
34
+ IsFiniteMeasure μ ∧ Controls T μ ∧ r = μ.real univ}
35
+
36
+ structure IsMetricCurrent {k : ℕ} (T : Functional X k) : Prop where
37
+ offDomain : ∀ b π, ¬Admissible b π → T b π = 0
38
+ linearFirst : ∀ b₁ b₂ π (a c : ℝ), BoundedLip b₁ → BoundedLip b₂ →
39
+ (∀ i, ∃ K : ℝ≥0, LipschitzWith K (π i)) →
40
+ T (fun x => a * b₁ x + c * b₂ x) π = a * T b₁ π + c * T b₂ π
41
+ linearCoord : ∀ b π i f (a c : ℝ), Admissible b π →
42
+ (∃ K : ℝ≥0, LipschitzWith K f) →
43
+ T b (Function.update π i (fun x => a * π i x + c * f x)) =
44
+ a * T b π + c * T b (Function.update π i f)
45
+ sequentialContinuity : ∀ b π (πs : ℕ → Fin k → X → ℝ), BoundedLip b →
46
+ (∀ i, ∃ K : ℝ≥0, ∀ j, LipschitzWith K (πs j i)) →
47
+ (∀ i x, Tendsto (fun j => πs j i x) atTop (𝓝 (π i x))) →
48
+ Tendsto (fun j => T b (πs j)) atTop (𝓝 (T b π))
49
+ locality : ∀ b π, Admissible b π →
50
+ (∃ (i : Fin k) (U : Set X) (c : ℝ), IsOpen U ∧ Function.support b ⊆ U ∧
51
+ ∀ x ∈ U, π i x = c) → T b π = 0
52
+ finiteMass : ∃ μ : Measure X, IsFiniteMeasure μ ∧ Controls T μ
53
+
54
+ noncomputable def boundarySucc {k : ℕ} (T : Functional X (k + 1)) : Functional X k :=
55
+ fun b π => if Admissible b π then T (fun _ => 1) (Matrix.vecCons b π) else 0
56
+
57
+ noncomputable def boundary : {k : ℕ} → Functional X k → Functional X (k - 1)
58
+ | 0, _ => fun _ _ => 0
59
+ | _ + 1, T => boundarySucc T
60
+
61
+ structure IntegerChart (X : Type u) [MetricSpace X] (k : ℕ) where
62
+ domain : Set (Euc k)
63
+ borel : MeasurableSet domain
64
+ bounded : Bornology.IsBounded domain
65
+ param : domain → X
66
+ bilipschitz : ∃ L U : ℝ≥0, LipschitzWith L param ∧ AntilipschitzWith U param
67
+ multiplicity : Euc k → ℤ
68
+ integrable : Integrable (fun z => (multiplicity z : ℝ)) (volume.restrict domain)
69
+
70
+ namespace IntegerChart
71
+
72
+ variable {k : ℕ} (C : IntegerChart X k)
73
+
74
+ noncomputable def scalar (f : X → ℝ) (z : Euc k) : ℝ :=
75
+ if hz : z ∈ C.domain then f (C.param ⟨z, hz⟩) else 0
76
+
77
+ noncomputable def jacobian (π : Fin k → X → ℝ) (z : Euc k) : ℝ :=
78
+ Matrix.det (fun i j =>
79
+ (fderivWithin ℝ (C.scalar (π i)) C.domain z) (EuclideanSpace.single j 1))
80
+
81
+ noncomputable def action : Functional X k :=
82
+ fun b π => if Admissible b π then
83
+ ∫ z in C.domain, (C.multiplicity z : ℝ) * C.scalar b z * C.jacobian π z
84
+ else 0
85
+
86
+ def image : Set X := Set.range C.param
87
+
88
+ end IntegerChart
89
+
90
+ def IntegerRectifiable {k : ℕ} (T : Functional X k) : Prop :=
91
+ ∃ C : ℕ → IntegerChart X k,
92
+ Pairwise (fun i j => Disjoint (C i).image (C j).image) ∧
93
+ (∀ i, IsMetricCurrent (C i).action) ∧
94
+ Summable (fun i => mass (C i).action) ∧
95
+ ∀ b π, T b π = ∑' i, (C i).action b π
96
+
97
+ def IsIntegral : (k : ℕ) → Functional X k → Prop
98
+ | 0, T => IsMetricCurrent T ∧ IntegerRectifiable T
99
+ | _ + 1, T => IsMetricCurrent T ∧ IntegerRectifiable T ∧
100
+ IsMetricCurrent (boundarySucc T) ∧ IntegerRectifiable (boundarySucc T)
101
+
102
+ abbrev IntegralCurrent (X : Type u) [MetricSpace X] [MeasurableSpace X] [BorelSpace X]
103
+ (k : ℕ) := { T : Functional X k // IsIntegral k T }
104
+
105
+ def CompactlySupported {k : ℕ} (T : Functional X k) : Prop :=
106
+ ∃ K : Set X, IsCompact K ∧
107
+ ∀ b π, Admissible b π → (∀ x ∈ K, b x = 0) → T b π = 0
108
+
109
+ def IsCycle {k : ℕ} (T : Functional X k) : Prop := boundary T = fun _ _ => 0
110
+
111
+ end MetricCurrents
112
+
113
+ noncomputable def omega (k : ℕ) : ℝ :=
114
+ (volume (Metric.ball (0 : Euc k) 1)).toReal
115
+ noncomputable def sphereArea (n : ℕ) : ℝ := (n + 1 : ℝ) * omega (n + 1)
116
+ noncomputable def fillingCoefficient (n : ℕ) : ℝ :=
117
+ 1 / ((n + 1 : ℝ) * (sphereArea n) ^ (1 / (n : ℝ)))
118
+ noncomputable def fillingPower (n : ℕ) : ℝ := (n + 1 : ℝ) / (n : ℝ)
119
+
120
+ theorem coefficient_optimal (n : ℕ) (hn : 2 ≤ n) :
121
+ ∃ T : IntegralCurrent (Euc (n + 1)) n,
122
+ CompactlySupported T.val ∧ IsCycle T.val ∧ 0 < mass T.val ∧
123
+ ∀ S : IntegralCurrent (Euc (n + 1)) (n + 1),
124
+ CompactlySupported S.val → boundarySucc S.val = T.val →
125
+ fillingCoefficient n * (mass T.val) ^ fillingPower n ≤ mass S.val := by
126
+ sorry
127
+
128
+ end SharpIntegralFillings
129
+
130
+ end OAI
lean/ComparatorChallenges/FiniteCircle.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "challenge_module": "ComparatorChallenges.FiniteCircle",
3
+ "solution_module": "OAI.Combinatorics.FiniteCircle.Main",
4
+ "theorem_names": [
5
+ "OAI.finiteCircle_fullMain"
6
+ ],
7
+ "definition_names": [],
8
+ "permitted_axioms": [
9
+ "propext",
10
+ "Quot.sound",
11
+ "Classical.choice"
12
+ ],
13
+ "enable_nanoda": false
14
+ }
lean/ComparatorChallenges/FiniteCircle.lean ADDED
@@ -0,0 +1,228 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import Mathlib
2
+
3
+ namespace OAI
4
+
5
+ namespace FiniteCircle
6
+
7
+ open scoped BigOperators List
8
+
9
+ universe u v
10
+
11
+ inductive EditStep {α : Type u} : List α → List α → Prop
12
+ | insert (u v : List α) (a : α) : EditStep (u ++ v) (u ++ a :: v)
13
+ | delete (u v : List α) (a : α) : EditStep (u ++ a :: v) (u ++ v)
14
+ | substitute (u v : List α) (a b : α) : EditStep (u ++ a :: v) (u ++ b :: v)
15
+
16
+ inductive EditScript {α : Type u} : ℕ → List α → List α → Prop
17
+ | nil (x : List α) : EditScript 0 x x
18
+ | cons {n : ℕ} {x y z : List α} :
19
+ EditStep x y → EditScript n y z → EditScript (n + 1) x z
20
+
21
+ noncomputable def editDistance {α : Type u} (x y : List α) : ℕ :=
22
+ sInf {n : ℕ | EditScript n x y}
23
+
24
+ noncomputable def lcs {α : Type u} (x y : List α) : ℕ :=
25
+ sSup {n : ℕ | ∃ z : List α, z <+ x ∧ z <+ y ∧ z.length = n}
26
+
27
+ noncomputable def deficit {α : Type u} (x y : List α) : ℕ := x.length - lcs x y
28
+
29
+ abbrev Words (α : Type u) (d : ℕ) := {x : List α // x.length ≤ d}
30
+ abbrev RealL1 := lp (fun _ : ℕ => ℝ) 1
31
+
32
+ noncomputable def distortion {α : Type u} {X : Type v} (word : X → List α)
33
+ (f : X → RealL1) : ℝ :=
34
+ (sSup {r : ℝ | ∃ x y : X, x ≠ y ∧
35
+ r = ‖f x - f y‖ / (editDistance (word x) (word y) : ℝ)}) *
36
+ (sSup {r : ℝ | ∃ x y : X, x ≠ y ∧
37
+ r = (editDistance (word x) (word y) : ℝ) / ‖f x - f y‖})
38
+
39
+ noncomputable def optimalDistortion {α : Type u} {X : Type v}
40
+ (word : X → List α) : ℝ :=
41
+ sInf {D | ∃ f : X → RealL1, Function.Injective f ∧ D = distortion word f}
42
+
43
+ noncomputable def E (α : Type u) (d : ℕ) : ℝ :=
44
+ optimalDistortion (fun x : Words α d => x.val)
45
+
46
+ noncomputable def setDistortion (S : Set (List Bool)) : ℝ :=
47
+ optimalDistortion (fun x : S => x.val)
48
+
49
+ noncomputable def alphabetSupremum (d : ℕ) : ℝ :=
50
+ sSup {r | ∃ A : ℕ, 2 ≤ A ∧ r = E (Fin A) d}
51
+
52
+ noncomputable def exponentScale (d : ℕ) : ℝ :=
53
+ Real.sqrt (Real.log d * Real.log (Real.log d))
54
+
55
+ def encode {α : Type u} {w : ℕ} (c : α → Fin w → Bool) (x : List α) : List Bool :=
56
+ x.flatMap (fun a => List.ofFn (c a))
57
+
58
+ def interval {α : Type u} {w : ℕ} (c : α → Fin w → Bool)
59
+ (a : α) (s len : ℕ) : List Bool :=
60
+ ((List.ofFn (c a)).drop s).take len
61
+
62
+ def OffsetLocal {α : Type u} {w : ℕ} (δ : ℝ) (c : α → Fin w → Bool) : Prop :=
63
+ ∀ a b : α, a ≠ b → ∀ s t : ℕ,
64
+ s + w / 8 ≤ w → t + w / 8 ≤ w →
65
+ (lcs (interval c a s (w / 8)) (interval c b t (w / 8)) : ℝ) ≤
66
+ (1 - δ) * (w / 8 : ℕ)
67
+
68
+ def indexSpan {w : ℕ} (is : List (Fin w)) : ℕ :=
69
+ match is with
70
+ | [] => 0
71
+ | i :: js => (js.getLastD i).val + 1 - i.val
72
+
73
+ def AnchorLocal {α : Type u} {w : ℕ} (ε : ℝ) (c : α → Fin w → Bool) : Prop :=
74
+ ∀ a b : α, ∀ is js : List (Fin w),
75
+ is.Pairwise (fun i j => i.val < j.val) →
76
+ js.Pairwise (fun i j => i.val < j.val) →
77
+ is.length = js.length → (w : ℝ) / 4 ≤ is.length →
78
+ (indexSpan is - is.length : ℕ) ≤ ε * w →
79
+ (indexSpan js - js.length : ℕ) ≤ ε * w →
80
+ (∀ ij ∈ is.zip js, c a ij.1 = c b ij.2) →
81
+ a = b ∧ ∃ i : Fin w, (i, i) ∈ is.zip js
82
+
83
+ def SubstitutionBounds {α : Type u} [Fintype α] {w : ℕ}
84
+ (a C : ℝ) (c : α → Fin w → Bool) : Prop :=
85
+ 0 < w ∧ (w : ℝ) ≤ C * Real.log (2 * Fintype.card α) ∧
86
+ (∀ L : ℕ, ∀ x y : List α, x.length = L → y.length = L →
87
+ a * w * deficit x y ≤ (deficit (encode c x) (encode c y) : ℝ) ∧
88
+ deficit (encode c x) (encode c y) ≤ w * deficit x y) ∧
89
+ (∀ x y : List α, editDistance (encode c x) (encode c y) ≤ w * editDistance x y)
90
+
91
+ def TwoCodes (a C δ ε : ℝ) : Prop :=
92
+ ∀ (α : Type) [Fintype α], 2 ≤ Fintype.card α →
93
+ (∃ (w : ℕ) (c : α → Fin w → Bool),
94
+ SubstitutionBounds a C c ∧ OffsetLocal δ c) ∧
95
+ (∃ (w : ℕ) (c : α → Fin w → Bool),
96
+ SubstitutionBounds a C c ∧ AnchorLocal ε c)
97
+
98
+ def period (h : ℕ) (p : ℕ → ℕ → ℕ) (l : ℕ) : ℕ := ∏ k : Fin h, p l k
99
+
100
+ def circleSize (h : ℕ) (p : ℕ → ℕ → ℕ) : ℕ :=
101
+ 2 * ∏ l : Fin h, period h p (l.val + 1)
102
+
103
+ def MaskPrimes (h : ℕ) (p : ℕ → ℕ → ℕ) : Prop :=
104
+ (∀ l k : Fin h, Nat.Prime (p (l.val + 1) k)) ∧
105
+ Function.Injective (fun lk : Fin h × Fin h => p (lk.1.val + 1) lk.2) ∧
106
+ ∀ l k : Fin h, h ^ 3 ≤ p (l.val + 1) k ∧ p (l.val + 1) k ≤ 2 * h ^ 3
107
+
108
+ def ExcludedPrimes (m : ℕ) (p : ℕ → ℕ → ℕ) : Prop :=
109
+ (∀ l k : Fin m, Nat.Prime (p (l.val + 1) k)) ∧
110
+ Function.Injective (fun lk : Fin m × Fin m => p (lk.1.val + 1) lk.2) ∧
111
+ ∀ l k : Fin m, m ^ 3 < p (l.val + 1) k ∧ p (l.val + 1) k ≤ m ^ 5
112
+
113
+ abbrev MaskTag (h : ℕ) (p : ℕ → ℕ → ℕ) (l : ℕ) := Σ k : Fin h, Fin (p l k)
114
+
115
+ def maskTags (h : ℕ) (p : ℕ → ℕ → ℕ) (l : ℕ) : List (MaskTag h p l) :=
116
+ (List.ofFn fun k : Fin h => List.ofFn fun b : Fin (p l k) => Sigma.mk k b).flatten
117
+
118
+ def MaskAlphabet (h : ℕ) (p : ℕ → ℕ → ℕ) : ℕ → Type
119
+ | 0 => Bool
120
+ | l + 1 => MaskTag h p (l + 1) × MaskAlphabet h p l
121
+
122
+ instance maskAlphabetFintype (h : ℕ) (p : ℕ → ℕ → ℕ) (l : ℕ) :
123
+ Fintype (MaskAlphabet h p l) := by
124
+ induction l with
125
+ | zero => exact inferInstanceAs (Fintype Bool)
126
+ | succ l ih => exact @instFintypeProd _ _ inferInstance ih
127
+
128
+ def MaskState (h : ℕ) (p : ℕ → ℕ → ℕ) (M : ℕ) : ℕ → Type
129
+ | 0 => ZMod M
130
+ | l + 1 => MaskTag h p (l + 1) → MaskState h p M l
131
+
132
+ def shiftMaskState (h : ℕ) (p : ℕ → ℕ → ℕ) (M : ℕ) :
133
+ (l : ℕ) → MaskState h p M l → ZMod M → MaskState h p M l
134
+ | 0, v, θ => (show ZMod M from v) + θ
135
+ | l + 1, v, θ => fun j => shiftMaskState h p M l (v j) θ
136
+
137
+ def maskGamma (h : ℕ) (p : ℕ → ℕ → ℕ) (M l a : ℕ)
138
+ (j : MaskTag h p l) : ZMod M :=
139
+ (∑ k : Fin h, ((M / p l k * (a % p l k) : ℕ) : ZMod M)) +
140
+ ((j.2.val * (M / p l j.1) * (a % p l j.1) : ℕ) : ZMod M)
141
+
142
+ def maskWord (h : ℕ) (p : ℕ → ℕ → ℕ) (R M : ℕ) :
143
+ (l : ℕ) → MaskState h p M l → List (MaskAlphabet h p l)
144
+ | 0, v => (List.range M).map (fun b => decide (((b : ZMod M) - (show ZMod M from v)).val < M / 2))
145
+ | l + 1, v => (List.range (R * period h p (l + 1))).flatMap fun a =>
146
+ (maskTags h p (l + 1)).flatMap fun j =>
147
+ (maskWord h p R M l
148
+ (shiftMaskState h p M l (v j) (maskGamma h p M (l + 1) a j))).map
149
+ (fun x => (j, x))
150
+
151
+ def ExcludedAlphabet (m L : ℕ) : ℕ → Type
152
+ | 0 => Fin L × Bool
153
+ | l + 1 => Fin m × ExcludedAlphabet m L l
154
+
155
+ instance excludedAlphabetFintype (m L l : ℕ) : Fintype (ExcludedAlphabet m L l) := by
156
+ induction l with
157
+ | zero => exact inferInstanceAs (Fintype (Fin L × Bool))
158
+ | succ l ih => exact @instFintypeProd _ _ inferInstance ih
159
+
160
+ def ExcludedState (m L : ℕ) : ℕ → Type
161
+ | 0 => ZMod L
162
+ | l + 1 => Fin m → ExcludedState m L l
163
+
164
+ def shiftExcludedState (m L : ℕ) :
165
+ (l : ℕ) → ExcludedState m L l → ZMod L → ExcludedState m L l
166
+ | 0, v, θ => (show ZMod L from v) + θ
167
+ | l + 1, v, θ => fun i => shiftExcludedState m L l (v i) θ
168
+
169
+ def excludedTranslation (m : ℕ) (p : ℕ → ℕ → ℕ) (L l s : ℕ) (i : Fin m) :
170
+ ZMod L := ∑ j ∈ Finset.univ.erase i, ((L / p l j * (s % p l j) : ℕ) : ZMod L)
171
+
172
+ def excludedWord (m : ℕ) (p : ℕ → ℕ → ℕ) (R L : ℕ) :
173
+ (l : ℕ) → ExcludedState m L l → List (ExcludedAlphabet m L l)
174
+ | 0, v => List.ofFn fun b : Fin L =>
175
+ (b, decide (((b.val : ZMod L) - (show ZMod L from v)).val < L / 2))
176
+ | l + 1, v => (List.range (R * period m p (l + 1))).flatMap fun s =>
177
+ (List.ofFn fun i : Fin m =>
178
+ (excludedWord m p R L l
179
+ (shiftExcludedState m L l (v i) (excludedTranslation m p L (l + 1) s i))).map
180
+ (fun x => (i, x))).flatten
181
+
182
+ def MaskWitness (a C δ lower : ℝ) (d : ℕ) : Prop :=
183
+ ∃ h : ℕ, 2 ≤ h ∧ ∃ p : ℕ → ℕ → ℕ, MaskPrimes h p ∧
184
+ ∃ (w : ℕ) (c : MaskAlphabet h p h → Fin w → Bool),
185
+ SubstitutionBounds a C c ∧ OffsetLocal δ c ∧
186
+ ∃ n : ℕ, 0 < n ∧ n ≤ d ∧
187
+ (∀ v : MaskState h p (circleSize h p) h,
188
+ (encode c (maskWord h p (h ^ (2 * h)) (circleSize h p) h v)).length = n) ∧
189
+ Real.exp (lower * exponentScale d) ≤ setDistortion
190
+ (Set.range fun v : MaskState h p (circleSize h p) h =>
191
+ encode c (maskWord h p (h ^ (2 * h)) (circleSize h p) h v))
192
+
193
+ def ExcludedWitness (a C ε lower : ℝ) (d : ℕ) : Prop :=
194
+ ∃ m : ℕ, 2 ≤ m ∧ ∃ p : ℕ → ℕ → ℕ, ExcludedPrimes m p ∧
195
+ ∃ (w : ℕ) (c : ExcludedAlphabet m (circleSize m p) m → Fin w → Bool),
196
+ SubstitutionBounds a C c ∧ AnchorLocal ε c ∧
197
+ ∃ n : ℕ, 0 < n ∧ n ≤ d ∧
198
+ (∀ v : ExcludedState m (circleSize m p) m,
199
+ (encode c (excludedWord m p (m ^ (2 * m)) (circleSize m p) m v)).length = n) ∧
200
+ Real.exp (lower * exponentScale d) ≤ setDistortion
201
+ (Set.range fun v : ExcludedState m (circleSize m p) m =>
202
+ encode c (excludedWord m p (m ^ (2 * m)) (circleSize m p) m v))
203
+
204
+ def UniformUpper (C : ℝ) (d₀ : ℕ) : Prop :=
205
+ ∀ (α : Type) [Fintype α], 2 ≤ Fintype.card α → ∀ d : ℕ, d₀ ≤ d →
206
+ ∃ (M : ℕ) (F : Words α d → Fin M → ℝ), ∀ x y : Words α d,
207
+ (editDistance x.val y.val : ℝ) ≤ ∑ i, |F x i - F y i| ∧
208
+ (∑ i, |F x i - F y i|) ≤
209
+ Real.exp (C * exponentScale d) * editDistance x.val y.val
210
+
211
+ def FullMain : Prop :=
212
+ ∃ c C a Ccode δ ε : ℝ, ∃ d₀ : ℕ,
213
+ 0 < c ∧ 0 < C ∧ 0 < a ∧ 0 < Ccode ∧ 0 < δ ∧ 0 < ε ∧
214
+ TwoCodes a Ccode δ ε ∧ UniformUpper C d₀ ∧
215
+ (∀ (α : Type) [Fintype α], 2 ≤ Fintype.card α → ∀ d : ℕ, d₀ ≤ d →
216
+ Real.exp (c * exponentScale d) ≤ E α d ∧
217
+ E α d ≤ Real.exp (C * exponentScale d)) ∧
218
+ (∀ d : ℕ, d₀ ≤ d →
219
+ MaskWitness a Ccode δ c d ∧ ExcludedWitness a Ccode ε c d ∧
220
+ Real.exp (c * exponentScale d) ≤ alphabetSupremum d ∧
221
+ alphabetSupremum d ≤ Real.exp (C * exponentScale d))
222
+
223
+ end FiniteCircle
224
+
225
+ theorem finiteCircle_fullMain : FiniteCircle.FullMain := by
226
+ sorry
227
+
228
+ end OAI
lean/ComparatorChallenges/FiniteCongruenceGraph.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "challenge_module": "ComparatorChallenges.FiniteCongruenceGraph",
3
+ "solution_module": "OAI.Algebra.Universal.GraphCriterion",
4
+ "theorem_names": [
5
+ "OAI.FiniteCongruence.graph_criterion"
6
+ ],
7
+ "permitted_axioms": [
8
+ "propext",
9
+ "Quot.sound",
10
+ "Classical.choice"
11
+ ],
12
+ "enable_nanoda": false
13
+ }
lean/ComparatorChallenges/FiniteCongruenceGraph.lean ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import Mathlib.Data.Finset.Lattice.Fold
2
+ import Mathlib.Data.Fintype.Defs
3
+ import Mathlib.Data.Setoid.Basic
4
+ import Mathlib.Order.Hom.Basic
5
+
6
+ namespace OAI
7
+
8
+ namespace FiniteCongruence
9
+
10
+ structure Algebra (Carrier : Type) where
11
+ numOps : ℕ
12
+ arity : Fin numOps → ℕ
13
+ op : (index : Fin numOps) → (Fin (arity index) → Carrier) → Carrier
14
+
15
+ def Compatible {Carrier : Type} (alg : Algebra Carrier) (rel : Setoid Carrier) : Prop :=
16
+ ∀ (index : Fin alg.numOps) (left right : Fin (alg.arity index) → Carrier),
17
+ (∀ coord, rel (left coord) (right coord)) → rel (alg.op index left) (alg.op index right)
18
+
19
+ def Congruence {Carrier : Type} (alg : Algebra Carrier) :=
20
+ {rel : Setoid Carrier // Compatible alg rel}
21
+
22
+ instance {Carrier : Type} (alg : Algebra Carrier) : PartialOrder (Congruence alg) :=
23
+ inferInstanceAs (PartialOrder {rel : Setoid Carrier // Compatible alg rel})
24
+
25
+ def Representable (Lat : Type) [PartialOrder Lat] : Prop :=
26
+ ∃ size : ℕ, 0 < size ∧ ∃ alg : Algebra (Fin size), Nonempty (Lat ≃o Congruence alg)
27
+
28
+ def Admissible {Lat Carrier : Type} [LE Lat] (color : Carrier → Carrier → Lat)
29
+ (placement : Carrier → Carrier) : Prop :=
30
+ ∀ left right, color (placement left) (placement right) ≤ color left right
31
+
32
+ def Marked {Lat Carrier : Type} [LE Lat] (color : Carrier → Carrier → Lat)
33
+ (seeds : Finset (Carrier × Carrier)) (left right : Carrier) : Prop :=
34
+ ∃ placement : Carrier → Carrier, Admissible color placement ∧
35
+ ∃ edge ∈ seeds, placement edge.1 = left ∧ placement edge.2 = right
36
+
37
+ def Connected {Lat Carrier : Type} [LE Lat] (color : Carrier → Carrier → Lat)
38
+ (seeds : Finset (Carrier × Carrier)) (left right : Carrier) : Prop :=
39
+ Relation.EqvGen (Marked color seeds) left right
40
+
41
+ def IsGraphWitness {Lat Carrier : Type} [Lattice Lat] [OrderBot Lat]
42
+ (color : Carrier → Carrier → Lat) : Prop :=
43
+ (∀ left right, color left right = color right left) ∧
44
+ (∀ left right, color left right = ⊥ ↔ left = right) ∧
45
+ (∀ left right middle, color left right ≤ color left middle ⊔ color middle right) ∧
46
+ (∀ lower upper : Lat, ¬ lower ≤ upper →
47
+ ∃ left right, color left right ≤ lower ∧ ¬ color left right ≤ upper) ∧
48
+ (∀ seeds : Finset (Carrier × Carrier), seeds.Nonempty → ∀ left right,
49
+ color left right ≤ seeds.sup (fun edge => color edge.1 edge.2) →
50
+ Connected color seeds left right)
51
+
52
+ def HasGraphWitness (Lat : Type) [Lattice Lat] [OrderBot Lat] : Prop :=
53
+ ∃ size : ℕ, 0 < size ∧ ∃ color : Fin size → Fin size → Lat, IsGraphWitness color
54
+
55
+ /-- A finite lattice is representable as the full congruence lattice of a nonempty finite
56
+ algebra exactly when it has a finite nonempty colored-graph witness. -/
57
+ theorem graph_criterion (Lat : Type) [Fintype Lat] [Lattice Lat] [OrderBot Lat] :
58
+ Representable Lat ↔ HasGraphWitness Lat := by
59
+ sorry
60
+
61
+ end FiniteCongruence
62
+
63
+ end OAI
lean/ComparatorChallenges/FiniteEntropySeparation.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "challenge_module": "ComparatorChallenges.FiniteEntropySeparation",
3
+ "solution_module": "OAI.Analysis.FreeEntropy.Main",
4
+ "theorem_names": [
5
+ "OAI.FiniteEntropySeparation.main"
6
+ ],
7
+ "definition_names": [],
8
+ "permitted_axioms": [
9
+ "propext",
10
+ "Quot.sound",
11
+ "Classical.choice"
12
+ ],
13
+ "enable_nanoda": false
14
+ }
lean/ComparatorChallenges/FiniteEntropySeparation.lean ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import Mathlib
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+
7
+ open scoped ENNReal NNReal ComplexConjugate
8
+ open MeasureTheory Filter
9
+
10
+ namespace FiniteEntropySeparation
11
+
12
+ variable {H : Type} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H]
13
+
14
+ structure TracialVector (M : VonNeumannAlgebra H) where
15
+ vacuum : H
16
+ norm_vacuum : ‖vacuum‖ = 1
17
+ tracial : ∀ A ∈ M, ∀ B ∈ M,
18
+ inner ℂ vacuum ((A * B) vacuum) = inner ℂ vacuum ((B * A) vacuum)
19
+ separating : ∀ A ∈ M, A vacuum = 0 → A = 0
20
+
21
+ def trace {M : VonNeumannAlgebra H} (τ : TracialVector M) (A : H →L[ℂ] H) : ℂ :=
22
+ inner ℂ τ.vacuum (A τ.vacuum)
23
+
24
+ def wordEval {n : ℕ} (X : Fin n → H →L[ℂ] H) (w : List (Fin n)) : H →L[ℂ] H :=
25
+ (w.map X).prod
26
+
27
+ def wordMoment {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ}
28
+ (X : Fin n → H →L[ℂ] H) (w : List (Fin n)) : ℂ := trace τ (wordEval X w)
29
+
30
+ def FreeSubalgebras {ι : Type} {M : VonNeumannAlgebra H} (τ : TracialVector M)
31
+ (A : ι → Subalgebra ℂ (H →L[ℂ] H)) : Prop :=
32
+ ∀ (k : ℕ), 0 < k → ∀ (j : Fin k → ι) (a : Fin k → H →L[ℂ] H),
33
+ (∀ r, a r ∈ A (j r)) → (∀ r, trace τ (a r) = 0) →
34
+ (∀ (r : ℕ) (hr : r + 1 < k),
35
+ j ⟨r, Nat.lt_trans (Nat.lt_succ_self r) hr⟩ ≠ j ⟨r + 1, hr⟩) →
36
+ trace τ (List.ofFn a).prod = 0
37
+
38
+ def FreeStandardNoise {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ}
39
+ (X S : Fin n → H →L[ℂ] H) : Prop :=
40
+ (∀ i k, trace τ (S i ^ k) =
41
+ if Even k then (catalan (k / 2) : ℂ) else 0) ∧
42
+ FreeSubalgebras τ (fun j : Option (Fin n) => match j with
43
+ | none => Algebra.adjoin ℂ (Set.range X)
44
+ | some i => Algebra.adjoin ℂ {S i})
45
+
46
+ def polynomialL2 {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ}
47
+ (X : Fin n → H →L[ℂ] H) : Submodule ℂ H :=
48
+ (Submodule.span ℂ (Set.range (fun w : List (Fin n) => wordEval X w τ.vacuum))).topologicalClosure
49
+
50
+ def derivativeMoment {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ}
51
+ (X : Fin n → H →L[ℂ] H) (i : Fin n) (w : List (Fin n)) : ℂ :=
52
+ ∑ r : Fin w.length, if w[r.val] = i then
53
+ wordMoment τ X (w.take r.val) * wordMoment τ X (w.drop (r.val + 1)) else 0
54
+
55
+ def ConjugateSystem {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ}
56
+ (X : Fin n → H →L[ℂ] H) (ξ : Fin n → H) : Prop :=
57
+ ∀ i, ξ i ∈ polynomialL2 τ X ∧ ∀ w : List (Fin n),
58
+ inner ℂ (ξ i) (wordEval X w τ.vacuum) = derivativeMoment τ X i w
59
+
60
+ def freeFisher {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ}
61
+ (X : Fin n → H →L[ℂ] H) : ℝ≥0∞ :=
62
+ ⨅ (ξ : Fin n → H) (_ : ConjugateSystem τ X ξ), ENNReal.ofReal (∑ i, ‖ξ i‖ ^ 2)
63
+
64
+ def heatTuple {n : ℕ} (X S : Fin n → H →L[ℂ] H) (s : ℝ) :
65
+ Fin n → H →L[ℂ] H := fun i => X i + (Real.sqrt s : ℂ) • S i
66
+
67
+ def chiStar {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ}
68
+ (X S : Fin n → H →L[ℂ] H) : EReal :=
69
+ let b : ℝ → ℝ≥0∞ := fun s => ENNReal.ofReal ((n : ℝ) / (1 + s))
70
+ let f : ℝ → ℝ≥0∞ := fun s => freeFisher τ (heatTuple X S s)
71
+ ((n / 2 * Real.log (2 * Real.pi * Real.exp 1) : ℝ) : EReal) +
72
+ (1 / 2 : EReal) * (∫⁻ s in Set.Ioi (0 : ℝ), b s - f s).toEReal -
73
+ (1 / 2 : EReal) * (∫⁻ s in Set.Ioi (0 : ℝ), f s - b s).toEReal
74
+
75
+ abbrev MatrixCoordinates (n d : ℕ) := EuclideanSpace ℝ (Fin n × Fin d × Fin d)
76
+
77
+ def hermitianMatrix {n d : ℕ} (a : MatrixCoordinates n d) (i : Fin n) :
78
+ Matrix (Fin d) (Fin d) ℂ := fun j k =>
79
+ if j = k then (a (i, j, j) : ℂ)
80
+ else if j < k then ((a (i, j, k) : ℂ) + Complex.I * (a (i, k, j) : ℂ)) / Real.sqrt 2
81
+ else ((a (i, k, j) : ℂ) - Complex.I * (a (i, j, k) : ℂ)) / Real.sqrt 2
82
+
83
+ def matrixOpNorm {d : ℕ} (A : Matrix (Fin d) (Fin d) ℂ) : ℝ :=
84
+ ‖(Matrix.toEuclideanLin A).toContinuousLinearMap‖
85
+
86
+ def matrixMoment {n d : ℕ} (a : MatrixCoordinates n d) (w : List (Fin n)) : ℂ :=
87
+ (d : ℂ)⁻¹ * Matrix.trace (w.map (hermitianMatrix a)).prod
88
+
89
+ def microstates {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ}
90
+ (X : Fin n → H →L[ℂ] H) (R : ℝ) (m d : ℕ) (ε : ℝ) : Set (MatrixCoordinates n d) :=
91
+ {a | (∀ i, matrixOpNorm (hermitianMatrix a i) ≤ R) ∧
92
+ ∀ w : List (Fin n), w.length ≤ m → ‖matrixMoment a w - wordMoment τ X w‖ < ε}
93
+
94
+ def chiCutoff {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ}
95
+ (X : Fin n → H →L[ℂ] H) (R : ℝ) : EReal :=
96
+ ⨅ m : ℕ, ⨅ ε : {ε : ℝ // 0 < ε},
97
+ limsup (fun d : ℕ =>
98
+ (((((d + 1 : ℕ) : ℝ) ^ 2)⁻¹ : ℝ) : EReal) *
99
+ (volume (microstates τ X R m (d + 1) ε.val)).log +
100
+ (((n : ℝ) / 2 * Real.log (d + 1) : ℝ) : EReal)) atTop
101
+
102
+ def chi {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ}
103
+ (X : Fin n → H →L[ℂ] H) : EReal :=
104
+ ⨆ R : {R : ℝ // 0 < R}, chiCutoff τ X R.val
105
+
106
+ open MeasureTheory
107
+
108
+ theorem main :
109
+ ∃ (H : Type) (_ : NormedAddCommGroup H) (_ : InnerProductSpace ℂ H)
110
+ (_ : CompleteSpace H) (M : VonNeumannAlgebra H) (τ : TracialVector M)
111
+ (n : ℕ) (X S : Fin n → H →L[ℂ] H),
112
+ 2 ≤ n ∧
113
+ (∀ i, X i ∈ M ∧ IsSelfAdjoint (X i)) ∧
114
+ (∀ i, S i ∈ M ∧ IsSelfAdjoint (S i)) ∧
115
+ FreeStandardNoise τ X S ∧
116
+ (⊥ : EReal) < chi τ X ∧
117
+ chi τ X ≤ chiStar τ X S - (1 / 2 : EReal) ∧
118
+ chiStar τ X S - (1 / 2 : EReal) < (⊤ : EReal) := by
119
+ sorry
120
+
121
+ end FiniteEntropySeparation
122
+
123
+ end
124
+
125
+ end OAI
lean/ComparatorChallenges/FiniteFactor.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "challenge_module": "ComparatorChallenges.FiniteFactor",
3
+ "solution_module": "OAI.Analysis.FiniteFactor.Main",
4
+ "theorem_names": [
5
+ "OAI.FiniteFactor.main_theorem"
6
+ ],
7
+ "definition_names": [],
8
+ "permitted_axioms": [
9
+ "propext",
10
+ "Quot.sound",
11
+ "Classical.choice"
12
+ ],
13
+ "enable_nanoda": false
14
+ }
lean/ComparatorChallenges/FiniteFactor.lean ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import Mathlib.Analysis.VonNeumannAlgebra.Basic
2
+ import Mathlib.Analysis.SpecialFunctions.Pow.Real
3
+
4
+ namespace OAI
5
+
6
+ namespace FiniteFactor
7
+ open Filter
8
+ open scoped Topology
9
+ universe u
10
+
11
+ variable {H : Type u} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H]
12
+
13
+ /-- A concrete factor has scalar center. -/
14
+ def HasScalarCenter (M : VonNeumannAlgebra H) : Prop :=
15
+ ∀ a ∈ M, (∀ b ∈ M, a * b = b * a) → ∃ z : ℂ, a = z • (1 : H →L[ℂ] H)
16
+
17
+ /-- Finiteness: every isometry in the algebra is unitary. -/
18
+ def IsFiniteAlgebra (M : VonNeumannAlgebra H) : Prop :=
19
+ ∀ v ∈ M, star v * v = 1 → v * star v = 1
20
+
21
+ /-- No nonzero projection is minimal, excluding matrix factors. -/
22
+ def HasNoMinimalProjection (M : VonNeumannAlgebra H) : Prop :=
23
+ ∀ p ∈ M, IsStarProjection p → p ≠ 0 →
24
+ ∃ q ∈ M, IsStarProjection q ∧ q ≠ 0 ∧ q ≠ p ∧ q * p = q
25
+
26
+ /-- A separable Banach space whose dual is conjugate-linearly isometric to M. -/
27
+ def HasSeparablePredual (M : VonNeumannAlgebra H) : Prop :=
28
+ ∃ (E : Type u) (_ : NormedAddCommGroup E) (_ : NormedSpace ℂ E)
29
+ (_ : CompleteSpace E) (_ : TopologicalSpace.SeparableSpace E),
30
+ Nonempty (StrongDual ℂ E ≃ₗᵢ⋆[ℂ] M.toStarSubalgebra)
31
+
32
+ def MainTarget : Prop :=
33
+ ∃ (H : Type u) (_ : NormedAddCommGroup H) (_ : InnerProductSpace ℂ H)
34
+ (_ : CompleteSpace H) (M : VonNeumannAlgebra H),
35
+ HasScalarCenter M ∧ IsFiniteAlgebra M ∧ HasNoMinimalProjection M ∧
36
+ HasSeparablePredual M ∧
37
+ ∃ T : H →L[ℂ] H, T ∈ M ∧ T ≠ 0 ∧
38
+ Tendsto (fun n : ℕ => ‖T ^ n‖ ^ (1 / (n : ℝ))) atTop (𝓝 0) ∧
39
+ ∀ p ∈ M, IsStarProjection p → (1 - p) * T * p = 0 → p = 0 ∨ p = 1
40
+
41
+ theorem main_theorem : MainTarget.{0} := by
42
+ sorry
43
+
44
+ end FiniteFactor
45
+
46
+ end OAI
lean/ComparatorChallenges/FinitisticAsymmetry.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "challenge_module": "ComparatorChallenges.FinitisticAsymmetry",
3
+ "solution_module": "OAI.Algebra.FinitisticAsymmetry.Main",
4
+ "theorem_names": [
5
+ "OAI.LittleFinitistic.extreme_left_right_asymmetry"
6
+ ],
7
+ "definition_names": [],
8
+ "permitted_axioms": [
9
+ "propext",
10
+ "Quot.sound",
11
+ "Classical.choice"
12
+ ],
13
+ "enable_nanoda": false
14
+ }
lean/ComparatorChallenges/FinitisticAsymmetry.lean ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import Mathlib
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+ open CategoryTheory
7
+
8
+ namespace LittleFinitistic
9
+ universe u
10
+ variable (A : Type u) [Ring A]
11
+
12
+ attribute [-instance] CompletePartialOrder.toSupSet in
13
+ def littleFinitisticDimension : WithBot ℕ∞ :=
14
+ ⨆ (M : ModuleCat.{u} A) (_ : Module.Finite A M) (_ : projectiveDimension M < ⊤),
15
+ projectiveDimension M
16
+
17
+ def bigFinitisticDimension : WithBot ℕ∞ :=
18
+ ⨆ (M : ModuleCat.{u} A) (_ : projectiveDimension M < ⊤), projectiveDimension M
19
+
20
+ def InjectivesGenerate : Prop :=
21
+ letI := HasDerivedCategory.standard (ModuleCat.{u} A)
22
+ ∀ (P : ObjectProperty (DerivedCategory (ModuleCat.{u} A))),
23
+ P.IsClosedUnderIsomorphisms → P.IsTriangulated →
24
+ (∀ I : Type u, P.IsClosedUnderColimitsOfShape (Discrete I)) →
25
+ (∀ (M : ModuleCat.{u} A), Injective M →
26
+ P ((DerivedCategory.singleFunctor (ModuleCat.{u} A) 0).obj M)) →
27
+ ∀ X, P X
28
+
29
+ theorem extreme_left_right_asymmetry :
30
+ ∃ (Λ : Type) (_ : Ring Λ) (_ : Algebra ℂ Λ),
31
+ FiniteDimensional ℂ Λ ∧
32
+ littleFinitisticDimension Λ = ⊤ ∧ bigFinitisticDimension Λ = ⊤ ∧
33
+ littleFinitisticDimension Λᵐᵒᵖ = 0 ∧ bigFinitisticDimension Λᵐᵒᵖ = 0 ∧
34
+ ¬ InjectivesGenerate Λ ∧ InjectivesGenerate Λᵐᵒᵖ := by
35
+ sorry
36
+
37
+ end LittleFinitistic
38
+
39
+ end
40
+
41
+ end OAI
lean/ComparatorChallenges/FixedClauseThreshold.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "challenge_module": "ComparatorChallenges.FixedClauseThreshold",
3
+ "solution_module": "OAI.Probability.RandomSAT.Main",
4
+ "theorem_names": [
5
+ "OAI.FixedClauseThreshold.main"
6
+ ],
7
+ "definition_names": [],
8
+ "permitted_axioms": [
9
+ "propext",
10
+ "Quot.sound",
11
+ "Classical.choice"
12
+ ],
13
+ "enable_nanoda": false
14
+ }
lean/ComparatorChallenges/FixedClauseThreshold.lean ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import Mathlib
2
+
3
+ namespace OAI
4
+
5
+ /-!
6
+ Proper clauses choose distinct variables uniformly and give them independent fair
7
+ signs. Formulas consist of independent uniform whole-clause draws with replacement.
8
+ Their satisfiability probability is the literal finite cardinality ratio.
9
+ For zero clauses this probability is one, including when there are fewer variables
10
+ than literals per clause. When there are fewer variables than literals per clause
11
+ and the clause count is positive, the ensemble is empty and its probability is zero
12
+ by the convention that division by zero is zero.
13
+
14
+ For each fixed clause size at least three, one positive finite real threshold
15
+ governs the limits at every fixed density below or above it. There is no assertion
16
+ at the critical density, no explicit threshold value, and no varying-size claim.
17
+ -/
18
+
19
+ namespace FixedClauseThreshold
20
+
21
+ abbrev Assignment (n : ℕ) := Fin n → Bool
22
+
23
+ abbrev ProperClause (n k : ℕ) :=
24
+ { C : Fin n → Option Bool // (Finset.univ.filter fun i => (C i).isSome).card = k }
25
+
26
+ abbrev Formula (n k m : ℕ) := Fin m → ProperClause n k
27
+
28
+ def SatisfiesClause {n k : ℕ} (σ : Assignment n) (C : ProperClause n k) : Prop :=
29
+ ∃ i : Fin n, C.val i = some (σ i)
30
+
31
+ def Satisfies {n k m : ℕ} (σ : Assignment n) (F : Formula n k m) : Prop :=
32
+ ∀ j, SatisfiesClause σ (F j)
33
+
34
+ def Satisfiable {n k m : ℕ} (F : Formula n k m) : Prop :=
35
+ ∃ σ : Assignment n, Satisfies σ F
36
+
37
+ noncomputable def properSATProbability (n k m : ℕ) : ℝ := by
38
+ classical
39
+ exact (Fintype.card { F : Formula n k m // Satisfiable F } : ℝ) /
40
+ (Fintype.card (Formula n k m) : ℝ)
41
+
42
+ def HasLimitingThreshold (k : ℕ) : Prop :=
43
+ ∃ α : ℝ, 0 < α ∧
44
+ (∀ c : ℝ, 0 ≤ c → c < α →
45
+ Filter.Tendsto (fun n : ℕ => properSATProbability n k ⌊c * (n : ℝ)⌋₊)
46
+ Filter.atTop (nhds 1)) ∧
47
+ (∀ c : ℝ, α < c →
48
+ Filter.Tendsto (fun n : ℕ => properSATProbability n k ⌊c * (n : ℝ)⌋₊)
49
+ Filter.atTop (nhds 0))
50
+
51
+ theorem main (k : ℕ) (hk : 3 ≤ k) : HasLimitingThreshold k := by
52
+ sorry
53
+
54
+ end FixedClauseThreshold
55
+
56
+ end OAI
lean/ComparatorChallenges/ForcedNavierStokesComputation.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "challenge_module": "ComparatorChallenges.ForcedNavierStokesComputation",
3
+ "solution_module": "OAI.MathematicalPhysics.NavierStokes.BalancedTransport.MainResult",
4
+ "theorem_names": [
5
+ "OAI.BalancedTransport.balanced_three_stack_realization"
6
+ ],
7
+ "definition_names": [],
8
+ "permitted_axioms": [
9
+ "propext",
10
+ "Quot.sound",
11
+ "Classical.choice"
12
+ ],
13
+ "enable_nanoda": false
14
+ }
lean/ComparatorChallenges/ForcedNavierStokesComputation.lean ADDED
@@ -0,0 +1,232 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import Mathlib
2
+
3
+ /-! A single main result: effective forced Navier–Stokes computation detected by a
4
+ fixed particle entering a fixed open box, exactly when the encoded machine halts. -/
5
+
6
+ namespace OAI.BalancedTransport
7
+ namespace Recorder
8
+ inductive Direction where
9
+ | stay | left | right
10
+ deriving DecidableEq
11
+
12
+ structure Transition (Q Γ : Type*) where
13
+ state : Q
14
+ write : Γ
15
+ move : Direction
16
+ end Recorder
17
+
18
+ structure FiniteMachine where
19
+ states : ℕ
20
+ symbols : ℕ
21
+ initial : Fin (states + 1)
22
+ blank : Fin (symbols + 1)
23
+ transition : Fin (states + 1) → Fin (symbols + 1) →
24
+ Option (Recorder.Transition (Fin (states + 1)) (Fin (symbols + 1)))
25
+
26
+ abbrev Input (M : FiniteMachine) := List (Fin (M.symbols + 1))
27
+
28
+ structure TapeConfiguration (M : FiniteMachine) where
29
+ state : Fin (M.states + 1)
30
+ head : ℤ
31
+ tape : ℤ → Fin (M.symbols + 1)
32
+
33
+ def initialConfiguration (M : FiniteMachine) (w : Input M) : TapeConfiguration M :=
34
+ ⟨M.initial, 0, fun z => if 0 ≤ z then w[z.toNat]?.getD M.blank else M.blank⟩
35
+
36
+ def machineStep (M : FiniteMachine) (c : TapeConfiguration M) : Option (TapeConfiguration M) :=
37
+ (M.transition c.state (c.tape c.head)).map fun v =>
38
+ ⟨v.state, c.head + (match v.move with | .stay => 0 | .left => -1 | .right => 1),
39
+ Function.update c.tape c.head v.write⟩
40
+
41
+ def Halts (M : FiniteMachine) (w : Input M) : Prop :=
42
+ ∃ c, Relation.ReflTransGen (fun c d => machineStep M c = some d)
43
+ (initialConfiguration M w) c ∧ machineStep M c = none
44
+
45
+ def Recorder.Direction.number : Recorder.Direction → ℕ
46
+ | .stay => 0
47
+ | .left => 1
48
+ | .right => 2
49
+
50
+ def FiniteMachine.code (M : FiniteMachine) : ℕ :=
51
+ Encodable.encode (M.states, M.symbols, M.initial.val, M.blank.val,
52
+ (List.finRange (M.states + 1)).map fun q =>
53
+ (List.finRange (M.symbols + 1)).map fun a =>
54
+ (M.transition q a).map fun v => (v.state.val, v.write.val, v.move.number))
55
+
56
+ def inputCode (M : FiniteMachine) (w : Input M) : ℕ :=
57
+ Encodable.encode (M.code, w.map Fin.val)
58
+
59
+ abbrev Space := Fin 3 → ℝ
60
+ abbrev Field (F : Type*) := ℝ → Space → F
61
+ abbrev Velocity := Field Space
62
+ abbrev Pressure := Field ℝ
63
+ abbrev Family (F : Type*) := (M : FiniteMachine) → Input M → F
64
+ abbrev MaterialFlow := ℝ → Space → Space
65
+ abbrev MultiIndex := List (Option (Fin 3))
66
+ abbrev RationalPoint := ℚ × (Fin 3 → ℚ)
67
+
68
+ noncomputable section
69
+
70
+ open MeasureTheory
71
+ open scoped ENNReal
72
+
73
+ variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F]
74
+
75
+ def timeD (v : Field F) : Field F :=
76
+ fun t x => derivWithin (fun s => v s x) (Set.Ici 0) t
77
+
78
+ def spaceD (i : Fin 3) (v : Field F) : Field F :=
79
+ fun t x => fderiv ℝ (v t) x (Pi.single i 1)
80
+
81
+ def mixedD : MultiIndex → Field F → Field F
82
+ | [], v => v
83
+ | none :: a, v => timeD (mixedD a v)
84
+ | some i :: a, v => spaceD i (mixedD a v)
85
+
86
+ def spatialD : List (Fin 3) → Field F → Field F
87
+ | [], v => v
88
+ | i :: a, v => spaceD i (spatialD a v)
89
+
90
+ def Smooth (v : Field F) : Prop :=
91
+ ContDiffOn ℝ (⊤ : ℕ∞) (fun z : ℝ × Space => v z.1 z.2) (Set.Ici 0 ×ˢ Set.univ)
92
+
93
+ def BoundedMixed (v : Field F) : Prop :=
94
+ ∀ a : MultiIndex, ∃ C : ℝ, 0 ≤ C ∧ ∀ t, 0 ≤ t → ∀ x, ‖mixedD a v t x‖ ≤ C
95
+
96
+ def CH (k : ℕ) (v : Field F) : Prop :=
97
+ ∀ a : List (Fin 3), a.length ≤ k →
98
+ ∃ V : ℝ → Lp F 2 (volume : Measure Space),
99
+ ContinuousOn V (Set.Ici 0) ∧
100
+ ∀ t, 0 ≤ t → (V t : Space → F) =ᵐ[volume] spatialD a v t
101
+
102
+ def C1L2 (v : Field F) : Prop :=
103
+ ∃ V W : ℝ → Lp F 2 (volume : Measure Space),
104
+ ContinuousOn V (Set.Ici 0) ∧ ContinuousOn W (Set.Ici 0) ∧
105
+ ∀ t, 0 ≤ t →
106
+ (V t : Space → F) =ᵐ[volume] v t ∧
107
+ (W t : Space → F) =ᵐ[volume] timeD v t ∧
108
+ HasDerivWithinAt V (W t) (Set.Ici 0) t
109
+
110
+ def div (u : Velocity) (t : ℝ) (x : Space) : ℝ :=
111
+ ∑ i, spaceD i u t x i
112
+
113
+ def laplacian (u : Velocity) : Velocity :=
114
+ fun t x => ∑ i, spaceD i (spaceD i u) t x
115
+
116
+ def convection (u : Velocity) : Velocity :=
117
+ fun t x => ∑ i, (u t x i) • spaceD i u t x
118
+
119
+ def gradient (p : Pressure) (t : ℝ) (x : Space) : Space :=
120
+ fun i => spaceD i p t x
121
+
122
+ def affineForce (f₀ f₁ : Velocity) (ν : ℝ) : Velocity :=
123
+ fun t x => f₀ t x + ν • f₁ t x
124
+
125
+ def inertialCoefficient (u : Velocity) : Velocity :=
126
+ fun t x => timeD u t x + convection u t x
127
+
128
+ def viscousCoefficient (u : Velocity) : Velocity :=
129
+ fun t x => -laplacian u t x
130
+
131
+ def ZeroDataSolution (ν : ℝ) (f u : Velocity) (p : Pressure) : Prop :=
132
+ Smooth u ∧ Smooth p ∧
133
+ (∀ x, u 0 x = 0) ∧
134
+ (∀ t, 0 ≤ t → ∀ x, div u t x = 0) ∧
135
+ (∀ t, 0 ≤ t → ∀ x,
136
+ timeD u t x + convection u t x =
137
+ -gradient p t x + ν • laplacian u t x + f t x)
138
+
139
+ def BoundedOnFiniteSlabs (u : Velocity) : Prop :=
140
+ ∀ T : ℝ, 0 ≤ T → ∃ C : ℝ, 0 ≤ C ∧
141
+ ∀ t ∈ Set.Icc (0 : ℝ) T, ∀ x,
142
+ ‖u t x‖ ≤ C ∧ ∀ i : Fin 3, ‖spaceD i u t x‖ ≤ C
143
+
144
+ def ComparisonClass (u : Velocity) (p : Pressure) : Prop :=
145
+ CH 2 u ∧ C1L2 u ∧ BoundedOnFiniteSlabs u ∧
146
+ ∃ c : ℝ → ℝ, CH 1 (fun t x => p t x - c t)
147
+
148
+ def UniqueInComparison (ν : ℝ) (f U : Velocity) : Prop :=
149
+ ∀ u p, ZeroDataSolution ν f u p → ComparisonClass u p →
150
+ (∀ t, 0 ≤ t → ∀ x, u t x = U t x) ∧
151
+ (∀ t, 0 ≤ t → ∀ x y, p t x = p t y)
152
+
153
+ def CommonCompactSupport (U f₀ f₁ : Velocity) : Prop :=
154
+ ∃ K : Set Space, IsCompact K ∧
155
+ ∀ t, 0 ≤ t → ∀ x, x ∉ K → U t x = 0 ∧ f₀ t x = 0 ∧ f₁ t x = 0
156
+
157
+ def PeriodicAfterOne (v : Velocity) : Prop :=
158
+ ∀ t, 1 ≤ t → ∀ x, v (t + 1) x = v t x
159
+
160
+ def IsMaterialFlow (u : Velocity) (X : MaterialFlow) : Prop :=
161
+ (∀ a, X 0 a = a) ∧
162
+ ∀ a t, 0 ≤ t → HasDerivWithinAt (fun s => X s a) (u t (X t a)) (Set.Ici 0) t
163
+
164
+ def fixedLabel : Space := ![4, 0, 0]
165
+
166
+ def observer : Set Space :=
167
+ Set.pi Set.univ (fun _ : Fin 3 => Set.Ioo (-1 : ℝ) 2)
168
+
169
+ def rationalSpace (x : Fin 3 → ℚ) : Space := fun i => (x i : ℝ)
170
+
171
+ def error (n : ℕ) : ℝ := (2 : ℝ)⁻¹ ^ n
172
+
173
+ def EffectiveFamily (v : Family Velocity) : Prop :=
174
+ ∃ E : (ℕ × MultiIndex × RationalPoint × ℕ) → (Fin 3 → ℚ),
175
+ ∃ b : (ℕ × MultiIndex) → ℕ,
176
+ ∃ R : ℕ → ℕ,
177
+ Computable E ∧ Computable b ∧ Computable R ∧
178
+ (∀ M w a z n, 0 ≤ z.1 → ∀ i,
179
+ |(E (inputCode M w, a, z, n) i : ℝ) -
180
+ mixedD a (v M w) (z.1 : ℝ) (rationalSpace z.2) i| ≤ error n) ∧
181
+ (∀ M w a t, 0 ≤ t → ∀ x,
182
+ ‖mixedD a (v M w) t x‖ ≤ (b (inputCode M w, a) : ℝ)) ∧
183
+ (∀ M w t, 0 ≤ t → ∀ x,
184
+ (R (inputCode M w) : ℝ) < ‖x‖ → v M w t x = 0)
185
+
186
+ def EffectiveFieldIn (O : Set (ℕ →. ℕ)) (v : Velocity) : Prop :=
187
+ ∃ E : (MultiIndex × RationalPoint × ℕ) → (Fin 3 → ℚ),
188
+ ∃ b : MultiIndex → ℕ,
189
+ ComputableIn O E ∧ ComputableIn O b ∧
190
+ (∀ a z n, 0 ≤ z.1 → ∀ i,
191
+ |(E (a, z, n) i : ℝ) -
192
+ mixedD a v (z.1 : ℝ) (rationalSpace z.2) i| ≤ error n) ∧
193
+ (∀ a t, 0 ≤ t → ∀ x, ‖mixedD a v t x‖ ≤ (b a : ℝ))
194
+
195
+ def RealName (name : ℕ → ℚ) (x : ℝ) : Prop :=
196
+ ∀ n, |(name n : ℝ) - x| ≤ error n
197
+
198
+ def ComputableReal (x : ℝ) : Prop :=
199
+ ∃ name : ℕ → ℚ, Computable name ∧ RealName name x
200
+
201
+ def nameOracle (name : ℕ → ℚ) : ℕ →. ℕ :=
202
+ fun n => Part.some (Encodable.encode (name n))
203
+
204
+ end
205
+
206
+ theorem balanced_three_stack_realization :
207
+ ∃ U f₀ f₁ : Family Velocity,
208
+ ∃ X : Family MaterialFlow,
209
+ ∃ repeated : FiniteMachine → Velocity,
210
+ EffectiveFamily U ∧ EffectiveFamily f₀ ∧ EffectiveFamily f₁ ∧
211
+ (∀ M, Function.Periodic (repeated M) 1) ∧
212
+ ∀ (M : FiniteMachine) (w : Input M),
213
+ Smooth (U M w) ∧ Smooth (f₀ M w) ∧ Smooth (f₁ M w) ∧
214
+ f₀ M w = inertialCoefficient (U M w) ∧
215
+ f₁ M w = viscousCoefficient (U M w) ∧
216
+ CommonCompactSupport (U M w) (f₀ M w) (f₁ M w) ∧
217
+ BoundedMixed (U M w) ∧
218
+ PeriodicAfterOne (U M w) ∧
219
+ (∀ t, 1 ≤ t → ∀ x, U M w t x = repeated M t x) ∧
220
+ ComparisonClass (U M w) (fun _ _ => 0) ∧
221
+ IsMaterialFlow (U M w) (X M w) ∧
222
+ ((∃ t : ℝ, 0 ≤ t ∧ X M w t fixedLabel ∈ observer) ↔ Halts M w) ∧
223
+ ∀ ν : ℝ, 0 < ν →
224
+ let f := affineForce (f₀ M w) (f₁ M w) ν
225
+ ZeroDataSolution ν f (U M w) (fun _ _ => 0) ∧
226
+ Smooth f ∧ BoundedMixed f ∧ PeriodicAfterOne f ∧
227
+ UniqueInComparison ν f (U M w) ∧
228
+ (ComputableReal ν → EffectiveFieldIn ∅ f) ∧
229
+ (∀ name : ℕ → ℚ, RealName name ν → EffectiveFieldIn {nameOracle name} f) := by
230
+ sorry
231
+
232
+ end OAI.BalancedTransport
lean/ComparatorChallenges/ForestSpace.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "challenge_module": "ComparatorChallenges.ForestSpace",
3
+ "solution_module": "OAI.Analysis.ForestSpace.Main",
4
+ "theorem_names": [
5
+ "OAI.ForestSpace.main_theorem"
6
+ ],
7
+ "definition_names": [],
8
+ "permitted_axioms": [
9
+ "propext",
10
+ "Quot.sound",
11
+ "Classical.choice"
12
+ ],
13
+ "enable_nanoda": false
14
+ }
lean/ComparatorChallenges/ForestSpace.lean ADDED
@@ -0,0 +1,468 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import Mathlib
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+
7
+ open scoped BigOperators
8
+ open Finset
9
+
10
+ namespace ForestSpace
11
+
12
+ attribute [local instance] Classical.propDecidable
13
+
14
+ section ModulusDefinitions
15
+
16
+ variable (E : Type) [NormedAddCommGroup E] [NormedSpace ℝ E]
17
+
18
+ /-- The closed finite-codimensional subspaces. -/
19
+ def Cofinite : Type :=
20
+ {F : Submodule ℝ E // IsClosed (F : Set E) ∧ FiniteDimensional ℝ (E ⧸ F)}
21
+
22
+ /-- The inner one-sided excess values and their infimum. -/
23
+ def aucValues (N : E → ℝ) (t : ℝ) (x : E) (F : Cofinite E) : Set ℝ :=
24
+ {a | ∃ y : E, y ∈ F.val ∧ N y = 1 ∧ a = N (x + t • y) - 1}
25
+
26
+ noncomputable def aucInner (N : E → ℝ) (t : ℝ) (x : E) (F : Cofinite E) : ℝ :=
27
+ sInf (aucValues E N t x F)
28
+
29
+ noncomputable def aucCenter (N : E → ℝ) (t : ℝ) (x : E) : ℝ :=
30
+ sSup (Set.range (aucInner E N t x))
31
+
32
+ /-- The one-sided asymptotic uniform convexity modulus, with the order
33
+ of infimum, supremum and infimum. -/
34
+ noncomputable def aucModulus (N : E → ℝ) (t : ℝ) : ℝ :=
35
+ sInf {a | ∃ x : E, N x = 1 ∧ a = aucCenter E N t x}
36
+
37
+ /-- The inner averaged signed excess; it is not replaced by a maximum. -/
38
+ def averageValues (N : E → ℝ) (t : ℝ) (x : E) (F : Cofinite E) : Set ℝ :=
39
+ {a | ∃ y : E, y ∈ F.val ∧ N y = 1 ∧
40
+ a = (N (x+t•y) + N (x-t•y))/((2 : ℕ) : ℝ) - 1}
41
+
42
+ noncomputable def averageInner (N : E → ℝ) (t : ℝ) (x : E) (F : Cofinite E) : ℝ :=
43
+ sInf (averageValues E N t x F)
44
+
45
+ noncomputable def averageCenter (N : E → ℝ) (t : ℝ) (x : E) : ℝ :=
46
+ sSup (Set.range (averageInner E N t x))
47
+
48
+ /-- The averaged asymptotic midpoint modulus. -/
49
+ noncomputable def averageModulus (N : E → ℝ) (t : ℝ) : ℝ :=
50
+ sInf {a | ∃ x : E, N x = 1 ∧ a = averageCenter E N t x}
51
+
52
+ end ModulusDefinitions
53
+
54
+ /-- An equivalent norm is kept as its exact real seminorm, with explicit positive
55
+ comparison constants. The lower inequality makes it a norm. -/
56
+ structure EquivalentNorm (E : Type) [NormedAddCommGroup E] [NormedSpace ℝ E]
57
+ (α β : ℝ) where
58
+ N : Seminorm ℝ E
59
+ alpha_pos : 0 < α
60
+ alpha_le_beta : α ≤ β
61
+ lower : ∀ x : E, α*‖x‖ ≤ N x
62
+ upper : ∀ x : E, N x ≤ β*‖x‖
63
+
64
+ /-- Canonical (not merely abstract) reflexivity. -/
65
+ def Reflexive (E : Type) [NormedAddCommGroup E] [NormedSpace ℝ E] : Prop :=
66
+ Function.Surjective (NormedSpace.inclusionInDoubleDual ℝ E)
67
+
68
+ /-- AUC requires positivity at every strictly positive parameter. -/
69
+ def IsAUC {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] (N : E → ℝ) : Prop :=
70
+ ∀ t : ℝ, 0 < t → 0 < aucModulus E N t
71
+
72
+ /-- A finite, order-convex chain. The empty chain is a harmless zero test. -/
73
+ def IsSegment {V : Type} [PartialOrder V] (S : Finset V) : Prop :=
74
+ (∀ a ∈ S, ∀ b ∈ S, a ≤ b ∨ b ≤ a) ∧
75
+ (∀ a ∈ S, ∀ b ∈ S, ∀ c, a ≤ c → c ≤ b → c ∈ S)
76
+
77
+ /-- The sum of coordinates over a segment. -/
78
+ def segSum {V : Type} (u : V → ℝ) (S : Finset V) : ℝ := ∑ v ∈ S, u v
79
+
80
+ /-- Squared bound on every disjoint family of segment tests. -/
81
+ def TestBound {V : Type} [PartialOrder V] (u : V → ℝ) (C : ℝ) : Prop :=
82
+ ∀ (ι : Type) (_ : Fintype ι) (S : ι → Finset V),
83
+ (∀ i, IsSegment (S i)) → Pairwise (fun i j => Disjoint (S i) (S j)) →
84
+ ∑ i, segSum u (S i) ^ 2 ≤ C
85
+
86
+ section SegmentNorm
87
+
88
+ variable {V : Type} [PartialOrder V]
89
+
90
+ /-- All squared disjoint-segment tests. Quantifying over finite index types
91
+ is equivalent to families S₁,...,Sₘ; a zero-sized family
92
+ adds only zero to the set of test values. -/
93
+ def testValues (u : V → ℝ) : Set ℝ :=
94
+ {r | ∃ (ι : Type) (_ : Fintype ι) (S : ι → Finset V),
95
+ (∀ i, IsSegment (S i)) ∧ Pairwise (fun i j => Disjoint (S i) (S j)) ∧
96
+ r = ∑ i, segSum u (S i) ^ 2}
97
+
98
+ noncomputable def squareSup (u : V → ℝ) : ℝ := sSup (testValues u)
99
+
100
+ /-- Exactly the disjoint-segment norm, written as the square root of its
101
+ squared testing supremum. -/
102
+ noncomputable def rho (u : V → ℝ) : ℝ := Real.sqrt (squareSup u)
103
+
104
+ noncomputable def l1size (u : V →₀ ℝ) : ℝ := ∑ v ∈ u.support, |u v|
105
+
106
+ end SegmentNorm
107
+
108
+ /-- The disjoint-segment seminorm on finite coordinate vectors. -/
109
+ def segmentSeminorm (V : Type) [PartialOrder V] : Seminorm ℝ (V →₀ ℝ) := by
110
+ have segSum_zero [PartialOrder V] (S : Finset V) : segSum (0 : V → ℝ) S = 0 := by
111
+ simp [segSum]
112
+ have segSum_add [PartialOrder V] (u v : V → ℝ) (S : Finset V) :
113
+ segSum (u + v) S = segSum u S + segSum v S := by
114
+ simp [segSum, Finset.sum_add_distrib]
115
+ have segSum_smul [PartialOrder V] (a : ℝ) (u : V → ℝ) (S : Finset V) :
116
+ segSum (a • u) S = a * segSum u S := by
117
+ simp [segSum, Finset.mul_sum]
118
+ have TestBound.nonneg {u : V → ℝ} {C : ℝ} (h : TestBound u C) : 0 ≤ C := by
119
+ simpa using h PEmpty inferInstance PEmpty.elim (by simp) (by simp [Pairwise])
120
+ have TestBound.zero : TestBound (0 : V → ℝ) 0 := by
121
+ intro ι inst S hS hd
122
+ simp [segSum]
123
+ have TestBound.smul {u : V → ℝ} {C : ℝ} (h : TestBound u C) (a : ℝ) :
124
+ TestBound (a • u) (a ^ 2 * C) := by
125
+ intro ι inst S hS hd
126
+ have hh := mul_le_mul_of_nonneg_left (h ι inst S hS hd) (sq_nonneg a)
127
+ simpa only [segSum_smul, mul_pow, Finset.mul_sum] using hh
128
+ have TestBound.add {u v : V → ℝ} {A B : ℝ}
129
+ (hu : TestBound u (A ^ 2)) (hv : TestBound v (B ^ 2))
130
+ (hA : 0 ≤ A) (hB : 0 ≤ B) : TestBound (u + v) ((A + B) ^ 2) := by
131
+ intro ι inst S hS hd
132
+ have h₁ := hu ι inst S hS hd
133
+ have h₂ := hv ι inst S hS hd
134
+ have hc := Real.sum_mul_le_sqrt_mul_sqrt (univ : Finset ι)
135
+ (fun i => segSum u (S i)) (fun i => segSum v (S i))
136
+ have hs₁ : Real.sqrt (∑ i, segSum u (S i) ^ 2) ≤ A :=
137
+ (Real.sqrt_le_iff).2 ⟨hA, h₁⟩
138
+ have hs₂ : Real.sqrt (∑ i, segSum v (S i) ^ 2) ≤ B :=
139
+ (Real.sqrt_le_iff).2 ⟨hB, h₂⟩
140
+ have hc' : ∑ i, segSum u (S i) * segSum v (S i) ≤ A * B :=
141
+ hc.trans (mul_le_mul hs₁ hs₂ (Real.sqrt_nonneg _) hA)
142
+ have he : (∑ i, segSum (u + v) (S i) ^ 2) =
143
+ (∑ i, segSum u (S i) ^ 2) + 2 * (∑ i, segSum u (S i) * segSum v (S i)) +
144
+ (∑ i, segSum v (S i) ^ 2) := by
145
+ simp only [segSum_add, add_sq, Finset.sum_add_distrib, Finset.mul_sum]
146
+ congr 1
147
+ congr 1
148
+ apply Finset.sum_congr rfl
149
+ intro i hi
150
+ ring
151
+ rw [he]
152
+ nlinarith
153
+ have zero_mem_testValues (u : V → ℝ) : 0 ∈ testValues u := by
154
+ refine ⟨PEmpty, inferInstance, PEmpty.elim, by simp, by simp [Pairwise], ?_⟩
155
+ simp [segSum]
156
+ have TestBound.bddAbove {u : V → ℝ} {C : ℝ} (h : TestBound u C) :
157
+ BddAbove (testValues u) := by
158
+ refine ⟨C, ?_⟩
159
+ rintro r ⟨ι, inst, S, hs, hd, rfl⟩
160
+ exact h ι inst S hs hd
161
+ have TestBound.squareSup_le {u : V → ℝ} {C : ℝ} (h : TestBound u C) :
162
+ squareSup u ≤ C := by
163
+ apply csSup_le ⟨0, zero_mem_testValues u⟩
164
+ rintro r ⟨ι, inst, S, hs, hd, rfl⟩
165
+ exact h ι inst S hs hd
166
+ have testBound_squareSup {u : V → ℝ} (hu : ∃ C, TestBound u C) :
167
+ TestBound u (squareSup u) := by
168
+ intro ι inst S hs hd
169
+ exact le_csSup (TestBound.bddAbove hu.choose_spec) ⟨ι, inst, S, hs, hd, rfl⟩
170
+ have squareSup_nonneg {u : V → ℝ} (hu : ∃ C, TestBound u C) : 0 ≤ squareSup u :=
171
+ TestBound.nonneg (testBound_squareSup hu)
172
+ have rho_nonneg (u : V → ℝ) : 0 ≤ rho u := Real.sqrt_nonneg _
173
+ have rho_sq {u : V → ℝ} (hu : ∃ C, TestBound u C) : rho u ^ 2 = squareSup u :=
174
+ Real.sq_sqrt (squareSup_nonneg hu)
175
+ have testBound_rho_sq {u : V → ℝ} (hu : ∃ C, TestBound u C) : TestBound u (rho u ^ 2) := by
176
+ rw [rho_sq hu]
177
+ exact testBound_squareSup hu
178
+ have rho_le_of_testBound {u : V → ℝ} {C : ℝ} (hC : 0 ≤ C)
179
+ (hu : TestBound u (C ^ 2)) : rho u ≤ C :=
180
+ Real.sqrt_le_iff.mpr ⟨hC, TestBound.squareSup_le hu⟩
181
+ have rho_add_le {u v : V → ℝ} (hu : ∃ C, TestBound u C) (hv : ∃ C, TestBound v C) :
182
+ rho (u + v) ≤ rho u + rho v :=
183
+ rho_le_of_testBound (add_nonneg (rho_nonneg u) (rho_nonneg v))
184
+ (TestBound.add (testBound_rho_sq hu) (testBound_rho_sq hv) (rho_nonneg u) (rho_nonneg v))
185
+ have rho_smul_le {u : V → ℝ} (hu : ∃ C, TestBound u C) (a : ℝ) :
186
+ rho (a • u) ≤ |a| * rho u := by
187
+ apply rho_le_of_testBound (mul_nonneg (abs_nonneg a) (rho_nonneg u))
188
+ have hh := TestBound.smul (testBound_rho_sq hu) a
189
+ simpa only [mul_pow, sq_abs] using hh
190
+ have rho_zero : rho (0 : V → ℝ) = 0 := by
191
+ apply le_antisymm _ (rho_nonneg _)
192
+ apply rho_le_of_testBound (C := 0) (by norm_num)
193
+ simpa using (TestBound.zero : TestBound (0 : V → ℝ) 0)
194
+ have l1size_nonneg [PartialOrder V] (u : V →₀ ℝ) : 0 ≤ l1size u :=
195
+ sum_nonneg (fun vertex _ => abs_nonneg (u vertex))
196
+ have finset_abs_sum_le_l1size [PartialOrder V] (u : V →₀ ℝ) (S : Finset V) :
197
+ ∑ v ∈ S, |u v| ≤ l1size u := by
198
+ have he : (∑ v ∈ S ∪ u.support, |u v|) = l1size u := by
199
+ symm
200
+ apply sum_subset subset_union_right
201
+ intro v hv hn
202
+ rw [Finsupp.notMem_support_iff.mp hn, abs_zero]
203
+ rw [← he]
204
+ exact sum_le_sum_of_subset_of_nonneg subset_union_left (fun v hv hn => abs_nonneg _)
205
+ have testBound_l1size (u : V →₀ ℝ) : TestBound u (l1size u ^ 2) := by
206
+ intro ι inst S hS hd
207
+ have habs : (∑ i, |segSum u (S i)|) ≤ l1size u := by
208
+ calc
209
+ (∑ i, |segSum u (S i)|) ≤ ∑ i, ∑ v ∈ S i, |u v| :=
210
+ sum_le_sum fun i hi => abs_sum_le_sum_abs _ _
211
+ _ = ∑ v ∈ univ.biUnion S, |u v| :=
212
+ (sum_biUnion (by intro i hi j hj hij; exact hd hij)).symm
213
+ _ ≤ l1size u := finset_abs_sum_le_l1size u _
214
+ have hsq := sum_sq_le_sq_sum_of_nonneg
215
+ (s := (univ : Finset ι)) (f := fun i => |segSum u (S i)|) (fun i hi => abs_nonneg _)
216
+ simp only [sq_abs] at hsq
217
+ have hnonneg : 0 ≤ ∑ i, |segSum u (S i)| := sum_nonneg (fun i hi => abs_nonneg _)
218
+ nlinarith [l1size_nonneg u]
219
+ have finsupp_has_testBound (u : V →₀ ℝ) : ∃ C, TestBound u C := ⟨_, testBound_l1size u⟩
220
+ exact Seminorm.ofSMulLE (fun u : V →₀ ℝ => rho u) rho_zero
221
+ (fun u v => rho_add_le (finsupp_has_testBound u) (finsupp_has_testBound v))
222
+ (fun a u => by simpa only [Real.norm_eq_abs, Finsupp.coe_smul] using rho_smul_le (finsupp_has_testBound u) a)
223
+
224
+ /-- Finite coordinate vectors with the segment norm (a type synonym prevents
225
+ clashes with any other norm on finitely supported functions). -/
226
+ def TestVector (V : Type) := V →₀ ℝ
227
+
228
+ namespace TestVector
229
+
230
+ variable {V : Type}
231
+
232
+ instance : AddCommGroup (TestVector V) := inferInstanceAs (AddCommGroup (V →₀ ℝ))
233
+
234
+ instance : Module ℝ (TestVector V) := inferInstanceAs (Module ℝ (V →₀ ℝ))
235
+
236
+ def toFinsupp (u : TestVector V) : V →₀ ℝ := u
237
+
238
+ instance : CoeFun (TestVector V) (fun _ => V → ℝ) := ⟨fun u => u.toFinsupp⟩
239
+
240
+ variable [PartialOrder V]
241
+
242
+ instance : Norm (TestVector V) := ⟨fun u => rho u⟩
243
+
244
+ instance : NormedAddCommGroup (TestVector V) := by
245
+ have isSegment_singleton (v : V) : IsSegment ({v} : Finset V) := by
246
+ constructor
247
+ · intro a ha b hb
248
+ simp only [mem_singleton] at ha hb
249
+ subst a
250
+ subst b
251
+ exact Or.inl le_rfl
252
+ · intro a ha b hb c hac hcb
253
+ simp only [mem_singleton] at ha hb ⊢
254
+ subst a
255
+ subst b
256
+ exact le_antisymm hcb hac
257
+ have TestBound.nonneg {u : V → ℝ} {C : ℝ} (h : TestBound u C) : 0 ≤ C := by
258
+ simpa using h PEmpty inferInstance PEmpty.elim (by simp) (by simp [Pairwise])
259
+ have TestBound.single {u : V → ℝ} {C : ℝ} (h : TestBound u C)
260
+ {S : Finset V} (hS : IsSegment S) : segSum u S ^ 2 ≤ C := by
261
+ simpa using h Unit inferInstance (fun _ => S) (fun _ => hS)
262
+ (by simp [Pairwise])
263
+ have TestBound.bddAbove {u : V → ℝ} {C : ℝ} (h : TestBound u C) :
264
+ BddAbove (testValues u) := by
265
+ refine ⟨C, ?_⟩
266
+ rintro r ⟨ι, inst, S, hs, hd, rfl⟩
267
+ exact h ι inst S hs hd
268
+ have testBound_squareSup {u : V → ℝ} (hu : ∃ C, TestBound u C) :
269
+ TestBound u (squareSup u) := by
270
+ intro ι inst S hs hd
271
+ exact le_csSup (TestBound.bddAbove hu.choose_spec) ⟨ι, inst, S, hs, hd, rfl⟩
272
+ have squareSup_nonneg {u : V → ℝ} (hu : ∃ C, TestBound u C) : 0 ≤ squareSup u :=
273
+ TestBound.nonneg (testBound_squareSup hu)
274
+ have rho_nonneg (u : V → ℝ) : 0 ≤ rho u := Real.sqrt_nonneg _
275
+ have rho_sq {u : V → ℝ} (hu : ∃ C, TestBound u C) : rho u ^ 2 = squareSup u :=
276
+ Real.sq_sqrt (squareSup_nonneg hu)
277
+ have testBound_rho_sq {u : V → ℝ} (hu : ∃ C, TestBound u C) : TestBound u (rho u ^ 2) := by
278
+ rw [rho_sq hu]
279
+ exact testBound_squareSup hu
280
+ have coordinate_le_rho {u : V → ℝ} (hu : ∃ C, TestBound u C) (v : V) :
281
+ |u v| ≤ rho u := by
282
+ have hh := TestBound.single (testBound_rho_sq hu) (isSegment_singleton v)
283
+ simp only [segSum, sum_singleton] at hh
284
+ exact (sq_le_sq₀ (abs_nonneg _) (rho_nonneg _)).mp (by simpa only [sq_abs] using hh)
285
+ have l1size_nonneg [PartialOrder V] (u : V →₀ ℝ) : 0 ≤ l1size u :=
286
+ sum_nonneg (fun vertex _ => abs_nonneg (u vertex))
287
+ have finset_abs_sum_le_l1size [PartialOrder V] (u : V →₀ ℝ) (S : Finset V) :
288
+ ∑ v ∈ S, |u v| ≤ l1size u := by
289
+ have he : (∑ v ∈ S ∪ u.support, |u v|) = l1size u := by
290
+ symm
291
+ apply sum_subset subset_union_right
292
+ intro v hv hn
293
+ rw [Finsupp.notMem_support_iff.mp hn, abs_zero]
294
+ rw [← he]
295
+ exact sum_le_sum_of_subset_of_nonneg subset_union_left (fun v hv hn => abs_nonneg _)
296
+ have testBound_l1size (u : V →₀ ℝ) : TestBound u (l1size u ^ 2) := by
297
+ intro ι inst S hS hd
298
+ have habs : (∑ i, |segSum u (S i)|) ≤ l1size u := by
299
+ calc
300
+ (∑ i, |segSum u (S i)|) ≤ ∑ i, ∑ v ∈ S i, |u v| :=
301
+ sum_le_sum fun i hi => abs_sum_le_sum_abs _ _
302
+ _ = ∑ v ∈ univ.biUnion S, |u v| :=
303
+ (sum_biUnion (by intro i hi j hj hij; exact hd hij)).symm
304
+ _ ≤ l1size u := finset_abs_sum_le_l1size u _
305
+ have hsq := sum_sq_le_sq_sum_of_nonneg
306
+ (s := (univ : Finset ι)) (f := fun i => |segSum u (S i)|) (fun i hi => abs_nonneg _)
307
+ simp only [sq_abs] at hsq
308
+ have hnonneg : 0 ≤ ∑ i, |segSum u (S i)| := sum_nonneg (fun i hi => abs_nonneg _)
309
+ nlinarith [l1size_nonneg u]
310
+ have finsupp_has_testBound (u : V →₀ ℝ) : ∃ C, TestBound u C := ⟨_, testBound_l1size u⟩
311
+ exact NormedAddCommGroup.ofCore (𝕜 := ℝ) {
312
+ norm_nonneg u := apply_nonneg (segmentSeminorm V) u.toFinsupp
313
+ norm_triangle u v := map_add_le_add (segmentSeminorm V) u.toFinsupp v.toFinsupp
314
+ norm_smul a u := map_smul_eq_mul (segmentSeminorm V) a u.toFinsupp
315
+ norm_eq_zero_iff u := ⟨by
316
+ intro h
317
+ apply Finsupp.ext
318
+ intro v
319
+ have hh := coordinate_le_rho (finsupp_has_testBound u.toFinsupp) v
320
+ change rho u.toFinsupp = 0 at h
321
+ rw [h] at hh
322
+ exact abs_nonpos_iff.mp hh, by
323
+ rintro rfl
324
+ exact map_zero (segmentSeminorm V)⟩ }
325
+
326
+ instance : NormedSpace ��� (TestVector V) where
327
+ norm_smul_le a u := le_of_eq (map_smul_eq_mul (segmentSeminorm V) a u.toFinsupp)
328
+
329
+ end TestVector
330
+
331
+ /-- J(T), completion of the finite-support disjoint-segment norm. -/
332
+ abbrev J (V : Type) [PartialOrder V] := UniformSpace.Completion (TestVector V)
333
+
334
+ /-- The full continuous dual, used for the finite-height forest example. -/
335
+ abbrev FullDual (V : Type) [PartialOrder V] := StrongDual ℝ (J V)
336
+
337
+ section CoordinateCompletion
338
+
339
+ variable {W : no_index Type} [PartialOrder W]
340
+
341
+ instance fullDualAddCommGroup : AddCommGroup (FullDual W) :=
342
+ inferInstanceAs (AddCommGroup (StrongDual ℝ (J W)))
343
+
344
+ end CoordinateCompletion
345
+
346
+ /-- Finite words, ordered by extension, including the empty root. -/
347
+ structure Word where
348
+ letters : List ℕ
349
+ deriving DecidableEq
350
+
351
+ namespace Word
352
+
353
+ instance : PartialOrder Word where
354
+ le a b := a.letters <+: b.letters
355
+ le_refl _ := List.prefix_rfl
356
+ le_trans _ _ _ := List.IsPrefix.trans
357
+ le_antisymm a b hab hba := by
358
+ have h := hab.eq_of_length (Nat.le_antisymm hab.length_le hba.length_le)
359
+ cases a; cases b; cases h; rfl
360
+
361
+ end Word
362
+
363
+ /-- A disjoint forest: one copy of `Nat^{≤h}` for every `h≥1`. -/
364
+ structure Vertex where
365
+ height : ℕ
366
+ positive : 1 ≤ height
367
+ word : Word
368
+ bounded : word.letters.length ≤ height
369
+ deriving DecidableEq
370
+
371
+ namespace Vertex
372
+
373
+ instance : PartialOrder Vertex where
374
+ le a b := a.height = b.height ∧ a.word ≤ b.word
375
+ le_refl _ := ⟨rfl,le_rfl⟩
376
+ le_trans a b c hab hbc := ⟨hab.1.trans hbc.1,hab.2.trans hbc.2⟩
377
+ le_antisymm a b hab hba := by
378
+ obtain ⟨hh, hw⟩ := hab
379
+ have he := le_antisymm hw hba.2
380
+ cases a; cases b; cases hh; cases he; rfl
381
+
382
+ end Vertex
383
+
384
+ namespace Diamond
385
+
386
+ /-- An oriented edge enumeration; only the associated undirected unit-edge
387
+ simple graph is used for distances. -/
388
+ structure Network where
389
+ V : Type
390
+ E : Type
391
+ left : E → V
392
+ right : E → V
393
+ distinct : ∀ e, left e ≠ right e
394
+
395
+ namespace Network
396
+
397
+ variable (A : Network)
398
+
399
+ def graph : SimpleGraph A.V where
400
+ Adj u v := ∃ e : A.E, (A.left e = u ∧ A.right e = v) ∨
401
+ (A.right e = u ∧ A.left e = v)
402
+ symm := ⟨by
403
+ rintro u v ⟨e,h | h⟩
404
+ · exact ⟨e,Or.inr ⟨h.2,h.1⟩⟩
405
+ · exact ⟨e,Or.inl ⟨h.2,h.1⟩⟩⟩
406
+ loopless := ⟨by
407
+ rintro u ⟨e,h | h⟩
408
+ · exact A.distinct e (h.1.trans h.2.symm)
409
+ · exact A.distinct e (h.2.trans h.1.symm)⟩
410
+
411
+ /-- Every edge is replaced by countably many internally disjoint two-edge
412
+ paths. All old vertices remain, and each pair (edge,index) is a new midpoint. -/
413
+ @[reducible] def refine : Network where
414
+ V := Sum A.V (A.E × ℕ)
415
+ E := A.E × ℕ × Bool
416
+ left e := if e.2.2 then Sum.inr (e.1,e.2.1) else Sum.inl (A.left e.1)
417
+ right e := if e.2.2 then Sum.inl (A.right e.1) else Sum.inr (e.1,e.2.1)
418
+ distinct := by rintro ⟨e,j,b⟩; cases b <;> simp
419
+
420
+ /-- Iterating the very same edge replacement, starting from an arbitrary
421
+ network. This recursion groups the first replacement before the remaining ones. -/
422
+ @[reducible] def iterate : Network → ℕ → Network
423
+ | A,0 => A
424
+ | A,n+1 => iterate A.refine n
425
+
426
+ end Network
427
+
428
+ /-- D₀ is precisely one edge. -/
429
+ @[reducible] def base : Network where
430
+ V := Bool
431
+ E := Unit
432
+ left _ := false
433
+ right _ := true
434
+ distinct _ := by decide
435
+
436
+ /-- Countably branching diamonds, all current edges of length one. -/
437
+ @[reducible] def diamond (k : ℕ) := base.iterate k
438
+
439
+ /-- The shortest-path distance, via Mathlib's actual graph distance. -/
440
+ def distance (k : ℕ) (u v : (diamond k).V) : ℝ := ((diamond k).graph.dist u v : ℝ)
441
+ variable {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E]
442
+
443
+ /-- The distortion convention, including its arbitrary positive scale. -/
444
+ def EmbeddingBound (k : ℕ) (f : (diamond k).V → E) (C : ℝ) : Prop :=
445
+ ∃ s : ℝ, 0 < s ∧ ∀ u v,
446
+ s*distance k u v ≤ ‖f u-f v‖ ∧ ‖f u-f v‖ ≤ C*s*distance k u v
447
+
448
+ end Diamond
449
+
450
+ /-- The space
451
+ is the full continuous dual of the specified segment-norm completion, not the
452
+ coordinate completion in place of that dual. -/
453
+ theorem main_theorem :
454
+ (¬FiniteDimensional ℝ (FullDual Vertex)) ∧
455
+ TopologicalSpace.SeparableSpace (FullDual Vertex) ∧
456
+ Reflexive (FullDual Vertex) ∧
457
+ (∀ (α β : ℝ) (R : EquivalentNorm (FullDual Vertex) α β), ¬IsAUC R.N) ∧
458
+ (∀ t : ℝ, 0 < t →
459
+ Real.sqrt (1+t^2/12)-1 ≤ averageModulus (FullDual Vertex) norm t) ∧
460
+ (∀ (k : ℕ) (f : (Diamond.diamond k).V → FullDual Vertex) (C : ℝ),
461
+ Diamond.EmbeddingBound k f C → Real.sqrt (1+(k:ℝ)/12) ≤ C) := by
462
+ sorry
463
+
464
+ end ForestSpace
465
+
466
+ end
467
+
468
+ end OAI
lean/ComparatorChallenges/FormulaHitting.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "challenge_module": "ComparatorChallenges.FormulaHitting",
3
+ "solution_module": "OAI.Algebra.FormulaHitting.Hitting",
4
+ "theorem_names": [
5
+ "OAI.NCHitting.universal_hitting"
6
+ ],
7
+ "permitted_axioms": [
8
+ "propext",
9
+ "Quot.sound",
10
+ "Classical.choice"
11
+ ],
12
+ "enable_nanoda": false
13
+ }
lean/ComparatorChallenges/FormulaHitting.lean ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import Mathlib.Data.Matrix.Basic
2
+ import Mathlib.Data.Rat.Defs
3
+
4
+ namespace OAI
5
+
6
+ namespace NCHitting
7
+
8
+ abbrev Word (n : ℕ) := List (Fin n)
9
+ abbrev WordSeries (F : Type*) (n : ℕ) := Word n → F
10
+
11
+ def convolution {F : Type*} {n : ℕ} [Semiring F]
12
+ (f g : WordSeries F n) : Word n → F
13
+ | [] => f [] * g []
14
+ | i :: w => f [] * g (i :: w) + convolution (fun v => f (i :: v)) g w
15
+
16
+ inductive Formula (F : Type*) (n : ℕ) where
17
+ | scalar : F → Formula F n
18
+ | var : Fin n → Formula F n
19
+ | add : Formula F n → Formula F n → Formula F n
20
+ | mul : Formula F n → Formula F n → Formula F n
21
+
22
+ namespace Formula
23
+
24
+ def size {F : Type*} {n : ℕ} : Formula F n → ℕ
25
+ | scalar _ => 1
26
+ | var _ => 1
27
+ | add f g => f.size + g.size + 1
28
+ | mul f g => f.size + g.size + 1
29
+
30
+ noncomputable def coeff {F : Type*} {n : ℕ} [Semiring F] :
31
+ Formula F n → WordSeries F n
32
+ | scalar a => fun w => if w = [] then a else 0
33
+ | var i => fun w => if w = [i] then 1 else 0
34
+ | add f g => fun w => coeff f w + coeff g w
35
+ | mul f g => convolution (coeff f) (coeff g)
36
+
37
+ def eval {F A : Type*} {n : ℕ} [Semiring A]
38
+ (scalarMap : F → A) (T : Fin n → A) : Formula F n → A
39
+ | scalar a => scalarMap a
40
+ | var i => T i
41
+ | add f g => eval scalarMap T f + eval scalarMap T g
42
+ | mul f g => eval scalarMap T f * eval scalarMap T g
43
+
44
+ end Formula
45
+
46
+ def dimension (n s : ℕ) : ℕ := if n = 1 ∧ s = 1 then 1 else 2 * n * s ^ 2
47
+
48
+ def matrixEntry (i r q : ℕ) : ℚ :=
49
+ if q < r then (-1 : ℚ) ^ (r - q - 1) / ((r : ℚ) * (i : ℚ) ^ (r - q))
50
+ else 0
51
+
52
+ def generator (n s : ℕ) : Fin n → Matrix (Fin (dimension n s)) (Fin (dimension n s)) ℚ :=
53
+ fun i r q => if n = 1 ∧ s = 1 then 1 else matrixEntry (i.val + 1) r.val q.val
54
+
55
+ universe u_2
56
+
57
+ theorem universal_hitting (n s : ℕ) (hn : 1 ≤ n) (hs : 1 ≤ s)
58
+ (F : Type u_2) [Field F] [CharZero F] (f : Formula F n)
59
+ (hsize : f.size ≤ s) (hf : ∃ w, f.coeff w ≠ 0) :
60
+ f.eval (Matrix.scalar (Fin (dimension n s)))
61
+ (fun i r q => (generator n s i r q : F)) ≠ 0 := by
62
+ sorry
63
+
64
+ end NCHitting
65
+
66
+ end OAI
lean/ComparatorChallenges/FoulkesHowe.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "challenge_module": "ComparatorChallenges.FoulkesHowe",
3
+ "solution_module": "OAI.RepresentationTheory.FoulkesHowe.Stabilization",
4
+ "theorem_names": [
5
+ "OAI.Problem346.canonical_foulkes_howe_surjective"
6
+ ],
7
+ "definition_names": [],
8
+ "permitted_axioms": [
9
+ "propext",
10
+ "Quot.sound",
11
+ "Classical.choice"
12
+ ],
13
+ "enable_nanoda": false
14
+ }
lean/ComparatorChallenges/FoulkesHowe.lean ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import Mathlib
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+
7
+ open scoped BigOperators
8
+ universe u
9
+
10
+ namespace Problem346
11
+
12
+ def symMonomialRaw (n : ℕ) (V : Type u) [AddCommGroup V] [Module ℂ V]
13
+ (v : Fin n → V) : SymmetricAlgebra ℂ V :=
14
+ ∏ i : Fin n, SymmetricAlgebra.ι ℂ V (v i)
15
+
16
+ def symPowSubmodule (n : ℕ) (V : Type u) [AddCommGroup V] [Module ℂ V] :
17
+ Submodule ℂ (SymmetricAlgebra ℂ V) :=
18
+ Submodule.span ℂ (Set.range (symMonomialRaw n V))
19
+
20
+ abbrev SymPow (n : ℕ) (V : Type u) [AddCommGroup V] [Module ℂ V] :=
21
+ ↥(symPowSubmodule n V)
22
+
23
+ def symMonomial (n : ℕ) (V : Type u) [AddCommGroup V] [Module ℂ V]
24
+ (v : Fin n → V) : SymPow n V :=
25
+ ⟨symMonomialRaw n V v, Submodule.subset_span (Set.mem_range_self v)⟩
26
+
27
+ def foulkesFormula (a b : ℕ) (V : Type u) [AddCommGroup V] [Module ℂ V]
28
+ (v : Fin b → Fin a → V) : SymPow a (SymPow b V) := by
29
+ classical
30
+ exact
31
+ ((a.factorial : ℂ) ^ b)⁻¹ •
32
+ ∑ σ : Fin b → Equiv.Perm (Fin a),
33
+ symMonomial a (SymPow b V)
34
+ (fun i => symMonomial b V (fun j => v j ((σ j) i)))
35
+
36
+ def IsFoulkesMap (a b : ℕ) (V : Type u) [AddCommGroup V] [Module ℂ V]
37
+ (μ : SymPow b (SymPow a V) →ₗ[ℂ] SymPow a (SymPow b V)) : Prop :=
38
+ ∀ v : Fin b → Fin a → V,
39
+ μ (symMonomial b (SymPow a V) (fun j => symMonomial a V (v j))) =
40
+ foulkesFormula a b V v
41
+
42
+ theorem canonical_foulkes_howe_surjective :
43
+ ∀ (V : Type u) [AddCommGroup V] [Module ℂ V] [FiniteDimensional ℂ V] (a b : ℕ), 2 ≤ a → a * (a - 1) ≤ b → ∃ μ : SymPow b (SymPow a V) →ₗ[ℂ] SymPow a (SymPow b V), IsFoulkesMap a b V μ ∧ Function.Surjective μ ∧ ∀ ν : SymPow b (SymPow a V) →ₗ[ℂ] SymPow a (SymPow b V), IsFoulkesMap a b V ν → ν = μ := by
44
+ sorry
45
+
46
+ end Problem346
47
+
48
+ end
49
+
50
+ end OAI
lean/ComparatorChallenges/FourRowPermanent.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "challenge_module": "ComparatorChallenges.FourRowPermanent",
3
+ "solution_module": "OAI.Combinatorics.Permanent.Main",
4
+ "theorem_names": [
5
+ "OAI.FourRow.robust_permanent"
6
+ ],
7
+ "definition_names": [],
8
+ "permitted_axioms": [
9
+ "propext",
10
+ "Quot.sound",
11
+ "Classical.choice"
12
+ ],
13
+ "enable_nanoda": false
14
+ }
lean/ComparatorChallenges/FourRowPermanent.lean ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import Mathlib
2
+
3
+ namespace OAI
4
+
5
+ /-!
6
+ # A robust four-row permanent inequality
7
+
8
+ `Fin 4` labels four sites. A law is represented by real probability masses;
9
+ `IsProbability` asserts nonnegativity and total mass one. All row norms use
10
+ the uniform counting normalization.
11
+ -/
12
+
13
+ noncomputable section
14
+ namespace FourRow
15
+ open scoped BigOperators
16
+
17
+ abbrev Site := Fin 4
18
+ abbrev Perm := Equiv.Perm Site
19
+ abbrev Law := Perm → ℝ
20
+ abbrev Functions := Site → Site → ℝ
21
+
22
+ def IsProbability (ν : Law) : Prop :=
23
+ (∀ π, 0 ≤ ν π) ∧ ∑ π, ν π = 1
24
+
25
+ def UniformMarginals (ν : Law) : Prop :=
26
+ ∀ i j : Site, ∑ π, (if π i = j then ν π else 0) = 1 / 4
27
+
28
+ def totalVariation (ν : Law) : ℝ :=
29
+ (∑ π, |ν π - 1 / 24|) / 2
30
+
31
+ def lpNorm (p : ℝ) (f : Site → ℝ) : ℝ :=
32
+ ((∑ j, (f j) ^ p) / 4) ^ (1 / p)
33
+
34
+ def permanentExpectation (ν : Law) (f : Functions) : ℝ :=
35
+ ∑ π, ν π * ∏ i, f i (π i)
36
+
37
+ theorem robust_permanent :
38
+ ∃ p₀ : ℝ, 4 / 3 < p₀ ∧ p₀ < 2 ∧
39
+ ∃ ε : ℝ, 0 < ε ∧ ∀ ν : Law,
40
+ IsProbability ν → totalVariation ν < ε → UniformMarginals ν →
41
+ ∀ f : Functions, (∀ i j, 0 ≤ f i j) →
42
+ permanentExpectation ν f ≤ ∏ i, lpNorm p₀ (f i) := by
43
+ sorry
44
+
45
+ end FourRow
46
+ end
47
+
48
+ end OAI
lean/ComparatorChallenges/FreeIsing.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "challenge_module": "ComparatorChallenges.FreeIsing",
3
+ "definition_names": [],
4
+ "enable_nanoda": false,
5
+ "permitted_axioms": [
6
+ "propext",
7
+ "Quot.sound",
8
+ "Classical.choice"
9
+ ],
10
+ "solution_module": "OAI.Probability.FreeIsing.Main",
11
+ "theorem_names": [
12
+ "OAI.Problem367.free_ising_factor_iff_threshold"
13
+ ]
14
+ }
lean/ComparatorChallenges/FreeIsing.lean ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import Mathlib
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+
7
+ open MeasureTheory
8
+
9
+ namespace Problem367
10
+
11
+ abbrev TreeVertex (d : ℕ) :=
12
+ {word : List (Fin d) // List.IsChain (fun first second : Fin d => first ≠ second) word}
13
+
14
+ def treeAdj {d : ℕ} (u v : TreeVertex d) : Prop :=
15
+ (∃ c : Fin d, v.1 = u.1 ++ [c]) ∨
16
+ (∃ c : Fin d, u.1 = v.1 ++ [c])
17
+
18
+ structure TreeAut (d : ℕ) where
19
+ toEquiv : TreeVertex d ≃ TreeVertex d
20
+ map_adj : ∀ u v, treeAdj (toEquiv u) (toEquiv v) ↔ treeAdj u v
21
+
22
+ def relabel {d : ℕ} {α : Type*} (g : TreeAut d)
23
+ (x : TreeVertex d → α) : TreeVertex d → α :=
24
+ fun v => x (g.toEquiv.symm v)
25
+
26
+ inductive IsingSpin where
27
+ | neg
28
+ | pos
29
+ deriving DecidableEq
30
+
31
+ protected abbrev IsingSpin.enumList : List IsingSpin := [.neg, .pos]
32
+
33
+ protected theorem IsingSpin.enumList_getElem?_ctorIdx_eq (x : IsingSpin) :
34
+ IsingSpin.enumList[x.ctorIdx]? = some x := by
35
+ cases x <;> rfl
36
+
37
+ protected theorem IsingSpin.enumList_nodup : IsingSpin.enumList.Nodup := by decide
38
+
39
+ instance : Fintype IsingSpin where
40
+ elems := ⟨IsingSpin.enumList, IsingSpin.enumList_nodup⟩
41
+ complete x := by cases x <;> decide
42
+
43
+ instance isingSpinMeasurable : MeasurableSpace IsingSpin := ⊤
44
+
45
+ def uniform01 : Measure ℝ :=
46
+ volume.restrict (Set.Icc (0 : ℝ) 1)
47
+
48
+ instance uniform01Probability : IsProbabilityMeasure uniform01 where
49
+ measure_univ := by simp [uniform01]
50
+
51
+ def labelMeasure (d : ℕ) : Measure (TreeVertex d → ℝ) := by
52
+ classical
53
+ exact Measure.infinitePi (fun _ : TreeVertex d => uniform01)
54
+
55
+ def ConnectedFinset {d : ℕ} (D : Finset (TreeVertex d)) : Prop :=
56
+ D.Nonempty ∧
57
+ ∀ u ∈ D, ∀ v ∈ D,
58
+ Relation.ReflTransGen
59
+ (fun x y : TreeVertex d => x ∈ D ∧ y ∈ D ∧ treeAdj x y) u v
60
+
61
+ def inducedEdges {d : ℕ} (D : Finset (TreeVertex d)) :
62
+ Finset (TreeVertex d × TreeVertex d) := by
63
+ classical
64
+ exact (D.product D).filter (fun e =>
65
+ treeAdj e.1 e.2 ∧ e.1.1.length < e.2.1.length)
66
+
67
+ def freeCylinderWeight {d : ℕ} (theta : ℝ)
68
+ (D : Finset (TreeVertex d)) (eta : TreeVertex d → IsingSpin) : ENNReal :=
69
+ ENNReal.ofReal
70
+ ((1 / 2 : ℝ) *
71
+ Finset.prod (inducedEdges D) (fun e =>
72
+ (1 + (if eta e.1 = eta e.2 then theta else -theta)) / 2))
73
+
74
+ def HasFreeIsingLaw {d : ℕ} (theta : ℝ)
75
+ (mu : Measure (TreeVertex d → IsingSpin)) : Prop :=
76
+ ∀ (D : Finset (TreeVertex d)), ConnectedFinset D →
77
+ ∀ eta : TreeVertex d → IsingSpin,
78
+ mu {x | ∀ v ∈ D, x v = eta v} = freeCylinderWeight theta D eta
79
+
80
+ def IsFactorOfIID (d : ℕ) (theta : ℝ) : Prop :=
81
+ ∃ Phi : (TreeVertex d → ℝ) → (TreeVertex d → IsingSpin),
82
+ Measurable Phi ∧
83
+ HasFreeIsingLaw theta (Measure.map Phi (labelMeasure d)) ∧
84
+ ∀ g : TreeAut d,
85
+ ∀ᵐ U ∂labelMeasure d, Phi (relabel g U) = relabel g (Phi U)
86
+
87
+ theorem free_ising_factor_iff_threshold :
88
+ ∀ (d : ℕ) (beta : ℝ), 3 ≤ d → 0 ≤ beta → (IsFactorOfIID d (Real.tanh beta) ↔ Real.tanh beta ≤ 1 / Real.sqrt ((d : ℝ) - 1)) := by
89
+ sorry
90
+
91
+ end Problem367
92
+
93
+ end
94
+
95
+ end OAI
lean/ComparatorChallenges/FreeUniformSpanningForest.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "challenge_module": "ComparatorChallenges.FreeUniformSpanningForest",
3
+ "solution_module": "OAI.Probability.SpanningForest.Factor",
4
+ "theorem_names": [
5
+ "OAI.Problem336.fusf_is_factor_iid"
6
+ ],
7
+ "definition_names": [],
8
+ "permitted_axioms": [
9
+ "propext",
10
+ "Quot.sound",
11
+ "Classical.choice"
12
+ ],
13
+ "enable_nanoda": false
14
+ }
lean/ComparatorChallenges/FreeUniformSpanningForest.lean ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import Mathlib
2
+
3
+ namespace OAI
4
+
5
+ noncomputable section
6
+
7
+ open MeasureTheory
8
+ open scoped BigOperators ENNReal Topology
9
+
10
+ namespace Problem336
11
+
12
+ abbrev GraphCode :=
13
+ {a : ℕ → ℕ → Bool //
14
+ (∀ u, a u u = false) ∧ (∀ u v, a u v = a v u)}
15
+
16
+ abbrev EdgeCode := {p : ℕ × ℕ // p.1 < p.2}
17
+
18
+ abbrev EdgeConfiguration := EdgeCode → Bool
19
+
20
+ abbrev FactorRule := GraphCode → (ℕ → ℝ) → EdgeCode → Bool
21
+
22
+ abbrev FiniteSubgraphCode := Finset ℕ × Finset (ℕ × ℕ)
23
+
24
+ def Adj (G : GraphCode) (u v : ℕ) : Prop := G.1 u v = true
25
+
26
+ def GraphConnected (G : GraphCode) : Prop :=
27
+ ∀ u v, Relation.ReflTransGen (fun x y => Adj G x y) u v
28
+
29
+ def GraphLocallyFinite (G : GraphCode) : Prop :=
30
+ ∀ u, Set.Finite {v : ℕ | Adj G u v}
31
+
32
+ def mkEdge (u v : ℕ) (h : u ≠ v) : EdgeCode := by
33
+ by_cases huv : u < v
34
+ · exact ⟨(u, v), huv⟩
35
+ · exact ⟨(v, u), lt_of_le_of_ne (Nat.le_of_not_gt huv) (Ne.symm h)⟩
36
+
37
+ def rawPair (u v : ℕ) : ℕ × ℕ :=
38
+ if u < v then (u, v) else (v, u)
39
+
40
+ def relabelGraph (σ : Equiv ℕ ℕ) (G : GraphCode) : GraphCode :=
41
+ ⟨fun u v => G.1 (σ.symm u) (σ.symm v), by
42
+ constructor
43
+ · intro u
44
+ exact G.2.1 (σ.symm u)
45
+ · intro u v
46
+ exact G.2.2 (σ.symm u) (σ.symm v)⟩
47
+
48
+ def relabelLabels (σ : Equiv ℕ ℕ) (U : ℕ → ℝ) : ℕ → ℝ :=
49
+ fun u => U (σ.symm u)
50
+
51
+ def mapEdge (σ : Equiv ℕ ℕ) (e : EdgeCode) : EdgeCode :=
52
+ mkEdge (σ e.1.1) (σ e.1.2) (by
53
+ intro h
54
+ apply Nat.ne_of_lt e.2
55
+ exact σ.injective h)
56
+
57
+ def RuleBorel (Phi : FactorRule) : Prop :=
58
+ Measurable
59
+ (fun q : GraphCode × ((ℕ → ℝ) × EdgeCode) =>
60
+ Phi q.1 q.2.1 q.2.2)
61
+
62
+ def RuleEquivariant (Phi : FactorRule) : Prop :=
63
+ ∀ (σ : Equiv ℕ ℕ) (G : GraphCode) (U : ℕ → ℝ) (e : EdgeCode),
64
+ Phi (relabelGraph σ G) (relabelLabels σ U) (mapEdge σ e) =
65
+ Phi G U e
66
+
67
+ def TreeAdj (T : Finset (ℕ × ℕ)) (u v : ℕ) : Prop :=
68
+ rawPair u v ∈ T
69
+
70
+ def SubgraphAdj (K : FiniteSubgraphCode) (u v : ℕ) : Prop :=
71
+ u ∈ K.1 ∧ v ∈ K.1 ∧ rawPair u v ∈ K.2
72
+
73
+ def TreeOn (K : FiniteSubgraphCode)
74
+ (T : Finset (ℕ × ℕ)) : Prop :=
75
+ T ⊆ K.2 ∧
76
+ T.card + 1 = K.1.card ∧
77
+ ∀ u ∈ K.1, ∀ v ∈ K.1,
78
+ Relation.ReflTransGen (TreeAdj T) u v
79
+
80
+ def spanningTrees (K : FiniteSubgraphCode) :
81
+ Finset (Finset (ℕ × ℕ)) := by
82
+ classical
83
+ exact K.2.powerset.filter (TreeOn K)
84
+
85
+ def ustCylinder (K : FiniteSubgraphCode)
86
+ (A B : Finset EdgeCode) : ℝ≥0∞ := by
87
+ classical
88
+ let all := spanningTrees K
89
+ let good := all.filter (fun T =>
90
+ (∀ e ∈ A, e.1 ∈ T) ∧ (∀ e ∈ B, e.1 ∉ T))
91
+ exact (good.card : ℝ≥0∞) / (all.card : ℝ≥0∞)
92
+
93
+ def IsFiniteConnectedSubgraph
94
+ (G : GraphCode) (K : FiniteSubgraphCode) : Prop :=
95
+ K.1.Nonempty ∧
96
+ (∀ p ∈ K.2,
97
+ p.1 ∈ K.1 ∧ p.2 ∈ K.1 ∧ p.1 < p.2 ∧ Adj G p.1 p.2) ∧
98
+ ∀ u ∈ K.1, ∀ v ∈ K.1,
99
+ Relation.ReflTransGen (SubgraphAdj K) u v
100
+
101
+ def IsConnectedExhaustion
102
+ (G : GraphCode) (H : ℕ → FiniteSubgraphCode) : Prop :=
103
+ (∀ n, IsFiniteConnectedSubgraph G (H n)) ∧
104
+ (∀ n, (H n).1 ⊆ (H (n + 1)).1 ∧
105
+ (H n).2 ⊆ (H (n + 1)).2) ∧
106
+ (∀ u v, u < v → Adj G u v →
107
+ ∃ n, (u, v) ∈ (H n).2)
108
+
109
+ def uniform01 : Measure ℝ :=
110
+ volume.restrict (Set.Icc (0 : ℝ) 1)
111
+
112
+ def IsVertexIID {Ω : Type} [MeasurableSpace Ω]
113
+ (P : Measure Ω) (U : ℕ → Ω → ℝ) : Prop :=
114
+ (∀ i, Measurable (U i)) ∧
115
+ ∀ (s : Finset ℕ) (A : ℕ → Set ℝ),
116
+ (∀ i ∈ s, MeasurableSet (A i)) →
117
+ P {ω | ∀ i ∈ s, U i ω ∈ A i} =
118
+ Finset.prod s (fun i => uniform01 (A i))
119
+
120
+ def HasFUSFLaw {Ω : Type} [MeasurableSpace Ω]
121
+ (G : GraphCode) (P : Measure Ω)
122
+ (X : Ω → EdgeConfiguration) : Prop :=
123
+ (∀ e, Measurable (fun ω => X ω e)) ∧
124
+ ∀ (H : ℕ → FiniteSubgraphCode), IsConnectedExhaustion G H →
125
+ ∀ (A B : Finset EdgeCode),
126
+ Filter.Tendsto
127
+ (fun n => ustCylinder (H n) A B)
128
+ Filter.atTop
129
+ (nhds (P {ω |
130
+ (∀ e ∈ A, X ω e = true) ∧
131
+ (∀ e ∈ B, X ω e = false)}))
132
+
133
+ def WorksOnGraph (Phi : FactorRule) (G : GraphCode) : Prop :=
134
+ GraphConnected G → GraphLocallyFinite G →
135
+ ∀ (Ω : Type) [MeasurableSpace Ω] (P : Measure Ω)
136
+ (U : ℕ → Ω → ℝ),
137
+ IsVertexIID P U →
138
+ HasFUSFLaw G P
139
+ (fun ω e => Phi G (fun v => U v ω) e)
140
+
141
+ theorem fusf_is_factor_iid :
142
+ ∃ Phi : FactorRule, RuleBorel Phi ∧ RuleEquivariant Phi ∧ ∀ G : GraphCode, WorksOnGraph Phi G := by
143
+ sorry
144
+
145
+ end Problem336
146
+
147
+ end
148
+
149
+ end OAI
lean/ComparatorChallenges/GammaPassage.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "challenge_module": "ComparatorChallenges.GammaPassage",
3
+ "solution_module": "OAI.Probability.GammaPassage.Differentiability",
4
+ "theorem_names": [
5
+ "OAI.GammaFPP.gamma_differentiability"
6
+ ],
7
+ "definition_names": [],
8
+ "permitted_axioms": [
9
+ "propext",
10
+ "Quot.sound",
11
+ "Classical.choice"
12
+ ],
13
+ "enable_nanoda": false
14
+ }
lean/ComparatorChallenges/GammaPassage.lean ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import Mathlib.Algebra.BigOperators.Group.List.Basic
2
+ import Mathlib.Algebra.Group.Prod
3
+ import Mathlib.Analysis.Calculus.ContDiff.Defs
4
+ import Mathlib.Analysis.Calculus.Deriv.Basic
5
+ import Mathlib.Analysis.Calculus.FDeriv.Basic
6
+ import Mathlib.Analysis.InnerProductSpace.PiL2
7
+ import Mathlib.Probability.Distributions.Gamma
8
+ import Mathlib.Probability.Independence.Basic
9
+
10
+ namespace OAI
11
+
12
+ namespace PlanarFPP
13
+
14
+ open Set MeasureTheory ProbabilityTheory Filter
15
+ open scoped Topology
16
+
17
+ abbrev Vertex := ℤ × ℤ
18
+
19
+ abbrev Edge := Vertex × Bool
20
+
21
+ inductive Step where
22
+ | east | west | north | south
23
+ deriving DecidableEq
24
+
25
+ def Step.delta : Step → Vertex
26
+ | .east => (1, 0)
27
+ | .west => (-1, 0)
28
+ | .north => (0, 1)
29
+ | .south => (0, -1)
30
+
31
+ def Step.edge (p : Vertex) : Step → Edge
32
+ | .east => (p, false)
33
+ | .west => (p + (-1, 0), false)
34
+ | .north => (p, true)
35
+ | .south => (p + (0, -1), true)
36
+
37
+ def displacement (ds : List Step) : Vertex := (ds.map Step.delta).sum
38
+
39
+ def pathCost (τ : Edge → ℝ) (p : Vertex) : List Step → ℝ
40
+ | [] => 0
41
+ | d :: ds => τ (d.edge p) + pathCost τ (p + d.delta) ds
42
+
43
+ abbrev Plane := EuclideanSpace ℝ (Fin 2)
44
+
45
+ noncomputable def latticeFloor (v : Plane) : Vertex := (⌊v 0⌋, ⌊v 1⌋)
46
+
47
+ noncomputable def passageTime (τ : Edge → ℝ) (p q : Vertex) : ℝ :=
48
+ sInf {t | ∃ ds : List Step, p + displacement ds = q ∧ pathCost τ p ds = t}
49
+
50
+ structure TimeConstantNorm (μ : Plane → ℝ) : Prop where
51
+ nonneg : ∀ v, 0 ≤ μ v
52
+ zero_iff : ∀ v, μ v = 0 ↔ v = 0
53
+ triangle : ∀ v w, μ (v + w) ≤ μ v + μ w
54
+ homogeneous : ∀ (a : ℝ) v, μ (a • v) = |a| * μ v
55
+
56
+ def IsTimeConstant {Ω : Type*} [MeasurableSpace Ω]
57
+ (P : Measure Ω) (τ : Edge → Ω → ℝ) (μ : Plane → ℝ) : Prop :=
58
+ ∀ v : Plane, ∀ᵐ ω ∂P,
59
+ Tendsto (fun t : ℝ => passageTime (fun e => τ e ω) (0, 0)
60
+ (latticeFloor (t • v)) / t) atTop (𝓝 (μ v))
61
+
62
+ def DifferentiableAwayFromOrigin (μ : Plane → ℝ) : Prop :=
63
+ ∀ v : Plane, v ≠ 0 → ∃ ℓ : Plane →L[ℝ] ℝ, HasFDerivAt μ ℓ v
64
+
65
+ end PlanarFPP
66
+
67
+ namespace GammaFPP
68
+
69
+ open Set MeasureTheory ProbabilityTheory PlanarFPP
70
+
71
+ structure IidEnvironment {Ω : Type*} [MeasurableSpace Ω]
72
+ (ν : Measure ℝ) (P : Measure Ω) (τ : PlanarFPP.Edge → Ω → ℝ) : Prop where
73
+ probability : IsProbabilityMeasure P
74
+ measurable : ∀ e, Measurable (τ e)
75
+ independent : iIndepFun τ P
76
+ marginal : ∀ e, Measure.map (τ e) P = ν
77
+
78
+
79
+ abbrev GammaEnvironment {Ω : Type*} [MeasurableSpace Ω]
80
+ (shape rate : ℝ) (P : Measure Ω) (τ : PlanarFPP.Edge → Ω → ℝ) :=
81
+ IidEnvironment (gammaMeasure shape rate) P τ
82
+
83
+
84
+ /-- A regular C¹ parametrization of the curve near a point, with a continuous inverse. -/
85
+ def HasC1CurveChart (S : Set Plane) (v : Plane) : Prop :=
86
+ ∃ U : Set Plane, IsOpen U ∧ v ∈ U ∧ v ∈ S ∧ ∃ γ : ℝ → Plane, ∃ θ : Plane → ℝ,
87
+ ContDiff ℝ 1 γ ∧ ContinuousOn θ U ∧
88
+ (∀ t, γ t ∈ S ∩ U) ∧ (∀ t, θ (γ t)=t) ∧
89
+ (∀ z ∈ S ∩ U, γ (θ z)=z) ∧
90
+ (∀ t, ∃ d : Plane, HasDerivAt γ d t ∧ d ≠ 0)
91
+
92
+ /-- The Gamma theorem: an actual deterministic passage-time limit norm exists
93
+ for every positive shape and rate and every iid environment with that law.
94
+ Its Frechet differentiability and literal unit-ball boundary charts are
95
+ conclusions. No shape theorem, norm, or no-corner hypothesis is supplied. -/
96
+ def GammaDifferentiabilityTarget : Prop :=
97
+ ∀ (shape rate : ℝ), 0 < shape → 0 < rate →
98
+ ∀ (Ω : Type) [MeasurableSpace Ω] (P : Measure Ω)
99
+ (τ : PlanarFPP.Edge → Ω → ℝ),
100
+ GammaEnvironment shape rate P τ →
101
+ ∃ μ : Plane → ℝ,
102
+ TimeConstantNorm μ ∧ IsTimeConstant P τ μ ∧
103
+ DifferentiableAwayFromOrigin μ ∧
104
+ ∀ v ∈ frontier {z : Plane | μ z ≤ 1},
105
+ HasC1CurveChart (frontier {z : Plane | μ z ≤ 1}) v
106
+
107
+ theorem gamma_differentiability : GammaDifferentiabilityTarget := by
108
+ sorry
109
+
110
+ end GammaFPP
111
+
112
+ end OAI
lean/ComparatorChallenges/GaussianFiniteEntropy.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "challenge_module": "ComparatorChallenges.GaussianFiniteEntropy",
3
+ "solution_module": "OAI.Probability.Localization.Main",
4
+ "theorem_names": [
5
+ "OAI.RepeatedLocalization.FiniteEntropy.finite_expected_regularization"
6
+ ],
7
+ "definition_names": [],
8
+ "permitted_axioms": [
9
+ "propext",
10
+ "Classical.choice",
11
+ "Quot.sound"
12
+ ],
13
+ "enable_nanoda": false
14
+ }
lean/ComparatorChallenges/GaussianFiniteEntropy.lean ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import Mathlib
2
+
3
+ namespace OAI
4
+
5
+ open MeasureTheory ProbabilityTheory Set
6
+ open scoped BigOperators ENNReal
7
+
8
+ namespace RepeatedLocalization
9
+
10
+ abbrev Coordinate (n : ℕ) := Fin n → ℝ
11
+ abbrev GaussianBlock (n : ℕ) := Fin (n / 16) → Fin (n + 1) → ℝ
12
+ abbrev Label (n : ℕ) := Fin (n / 16) → ℝ
13
+ abbrev History (N t : ℕ) := Fin t → Fin N
14
+ abbrev Cell (n : ℕ) := Σ J : ℕ, Fin n → Fin (2 ^ J)
15
+
16
+ instance cellMeasurableSpace (n : ℕ) : MeasurableSpace (Cell n) := ⊤
17
+
18
+ noncomputable def initialCube (n : ℕ) : Set (Coordinate n) :=
19
+ Set.pi Set.univ (fun _ => Set.Ico (-1 / (2 * Real.sqrt n)) (1 / (2 * Real.sqrt n)))
20
+
21
+ noncomputable def cubePrior (n : ℕ) : Measure (Coordinate n) :=
22
+ ProbabilityTheory.cond volume (initialCube n)
23
+
24
+ noncomputable def chart {n : ℕ} (z : Coordinate n) : Fin (n + 1) → ℝ :=
25
+ Fin.lastCases (Real.sqrt (1 - ∑ a, (z a) ^ 2)) z
26
+
27
+ noncomputable def cellSet {n : ℕ} (Q : Cell n) : Set (Coordinate n) :=
28
+ {z | ∀ a, -1 / (2 * Real.sqrt n) + (Q.2 a : ℝ) / (Real.sqrt n * (2 : ℝ) ^ Q.1) ≤ z a ∧
29
+ z a < -1 / (2 * Real.sqrt n) + ((Q.2 a : ℝ) + 1) / (Real.sqrt n * (2 : ℝ) ^ Q.1)}
30
+
31
+ def rootCell (n : ℕ) : Cell n := ⟨0, fun _ => 0⟩
32
+
33
+ noncomputable def gaussianBlockLaw (n : ℕ) : Measure (GaussianBlock n) :=
34
+ Measure.pi (fun _ => Measure.pi (fun _ => gaussianReal 0 1))
35
+
36
+ noncomputable def exactLabel {n : ℕ} (X : GaussianBlock n) (z : Coordinate n) : Label n :=
37
+ fun row => ∑ a, X row a * chart z a
38
+
39
+ structure BlockRule (n N : ℕ) where
40
+ prob : (GaussianBlock n × Label n) → Fin N → ℝ
41
+ measurable_prob : ∀ w, Measurable (fun data => prob data w)
42
+ nonneg : ∀ data w, 0 ≤ prob data w
43
+ sum_one : ∀ data, ∑ w, prob data w = 1
44
+
45
+ abbrev Rules (n N t : ℕ) := ∀ i : Fin t, History N i.val → BlockRule n N
46
+
47
+ def past {N t : ℕ} (w : History N t) (i : Fin t) : History N i.val :=
48
+ fun j => w ⟨j.val, Nat.lt_trans j.isLt i.isLt⟩
49
+
50
+ def through {N t : ℕ} (w : History N t) (i : Fin t) : History N (i.val + 1) :=
51
+ fun j => w ⟨j.val, Nat.lt_of_lt_of_le j.isLt i.isLt⟩
52
+
53
+ noncomputable def blockProbability {n N : ℕ} (rule : BlockRule n N)
54
+ (z : Coordinate n) (w : Fin N) : ℝ :=
55
+ ∫ X, rule.prob (X, exactLabel X z) w ∂gaussianBlockLaw n
56
+
57
+ noncomputable def historyLikelihood {n N t : ℕ} (rules : Rules n N t)
58
+ (z : Coordinate n) (w : History N t) : ℝ :=
59
+ ∏ i, blockProbability (rules i (past w i)) z (w i)
60
+
61
+ noncomputable def experimentLaw {n N t : ℕ} (rules : Rules n N t) :
62
+ Measure (Coordinate n × History N t) :=
63
+ ∑ w : History N t,
64
+ ((cubePrior n).withDensity (fun z => ENNReal.ofReal (historyLikelihood rules z w))).map
65
+ (fun z => (z, w))
66
+
67
+ abbrev Disclosure (n N t : ℕ) := ∀ i : Fin t, Coordinate n → History N (i.val + 1) → Cell n
68
+
69
+ def ValidDisclosure {n N t : ℕ} (Q : Disclosure n N t) : Prop :=
70
+ (∀ i, Measurable (fun zh : Coordinate n × History N (i.val + 1) => Q i zh.1 zh.2)) ∧
71
+ (∀ i, (Set.range (fun zh : Coordinate n × History N (i.val + 1) => Q i zh.1 zh.2)).Finite) ∧
72
+ (∀ z ∈ initialCube n, ∀ w : History N t, ∀ i,
73
+ z ∈ cellSet (Q i z (through w i)) ∧ cellSet (Q i z (through w i)) ⊆ initialCube n) ∧
74
+ (∀ z ∈ initialCube n, ∀ w : History N t, ∀ i j : Fin t, i ≤ j →
75
+ cellSet (Q j z (through w j)) ⊆ cellSet (Q i z (through w i)))
76
+
77
+ noncomputable def transcriptMap {n N t : ℕ} (Q : Disclosure n N t)
78
+ (zw : Coordinate n × History N t) : Coordinate n × (History N t × (Fin t → Cell n)) :=
79
+ (zw.1, (zw.2, fun i => Q i zw.1 (through zw.2 i)))
80
+
81
+ noncomputable def augmentedLaw {n N t : ℕ} (rules : Rules n N t) (Q : Disclosure n N t) :=
82
+ (experimentLaw rules).map (transcriptMap Q)
83
+
84
+ noncomputable def mutualInformation {α β : Type*} [MeasurableSpace α] [MeasurableSpace β]
85
+ (μ : Measure (α × β)) : ℝ≥0∞ :=
86
+ InformationTheory.klDiv μ ((μ.map Prod.fst).prod (μ.map Prod.snd))
87
+
88
+ noncomputable def finalLevel {n N t : ℕ} (Q : Disclosure n N t)
89
+ (zw : Coordinate n × History N t) : ℕ :=
90
+ if ht : 0 < t then
91
+ let i : Fin t := ⟨t - 1, by omega⟩
92
+ (Q i zw.1 (through zw.2 i)).1
93
+ else 0
94
+
95
+ def MainStatement : Prop :=
96
+ ∃ c : ℝ, 0 < c ∧ ∃ n₀ : ℕ, ∀ C₀ : ℝ, 0 < C₀ →
97
+ ∃ C : ℝ, 0 < C ∧ ∀ (n N t : ℕ), n₀ ≤ n → 1 ≤ N → ∀ rules : Rules n N t,
98
+ (2 / (n / 8 : ℕ) + Real.exp (-c * (n / 16 : ℕ))) * Real.log N ≤ C₀ * (n + 1) →
99
+ ∃ Q : Disclosure n N t, ValidDisclosure Q ∧
100
+ mutualInformation (augmentedLaw rules Q) ≤ ENNReal.ofReal (C * (n + 1) * t) ∧
101
+ (∫ zw, (finalLevel Q zw : ℝ) ∂experimentLaw rules) ≤ C * t
102
+
103
+ namespace FiniteEntropy
104
+
105
+ noncomputable def uniformCell {n : ℕ} (Q : Cell n) : Measure (Coordinate n) :=
106
+ ProbabilityTheory.cond volume (cellSet Q)
107
+
108
+ def Descendant {n : ℕ} (Q R : Cell n) : Prop :=
109
+ Q.1 ≤ R.1 ∧ cellSet R ⊆ cellSet Q
110
+
111
+ noncomputable def threshold (n h : ℕ) : ℝ := (2:ℝ)^(-(n:ℝ)*h/2)
112
+
113
+ def Heavy {n : ℕ} (P : Measure (Coordinate n)) (Q R : Cell n) : Prop :=
114
+ Descendant Q R ∧ Q.1 < R.1 ∧ threshold n (R.1-Q.1) < (P (cellSet R)).toReal
115
+
116
+ def FirstHeavy {n : ℕ} (P : Measure (Coordinate n)) (Q R : Cell n) : Prop :=
117
+ Heavy P Q R ∧ ∀ E : Cell n, Heavy P Q E → Descendant E R → E = R
118
+
119
+ noncomputable def residual {n : ℕ} (P : Measure (Coordinate n)) (Q : Cell n) : Set (Coordinate n) :=
120
+ cellSet Q \ ⋃ R : {R : Cell n // FirstHeavy P Q R}, cellSet R.val
121
+
122
+ abbrev Letter (n : ℕ) := Option (Cell n)
123
+ abbrev Log (n : ℕ) := List (Letter n)
124
+ instance logMeasurableSpace (n : ℕ) : MeasurableSpace (Log n) := ⊤
125
+
126
+ noncomputable def branch {n : ℕ} (P : Measure (Coordinate n)) (Q : Cell n) : Letter n → Set (Coordinate n) := by
127
+ classical
128
+ exact fun
129
+ | none => residual P Q
130
+ | some R => if FirstHeavy P Q R then cellSet R else ∅
131
+
132
+ noncomputable def attemptLetter {n : ℕ} (P : Measure (Coordinate n)) (Q : Cell n)
133
+ (z : Coordinate n) : Letter n := by
134
+ classical
135
+ exact if h : ∃ R : Cell n, FirstHeavy P Q R ∧ z ∈ cellSet R then some h.choose else none
136
+
137
+ structure State (n : ℕ) where
138
+ cell : Cell n
139
+ event : Set (Coordinate n)
140
+ stopped : Bool
141
+
142
+ noncomputable def update {n : ℕ} (P : Measure (Coordinate n)) (s : State n) (a : Letter n) : State n :=
143
+ if s.stopped then s else
144
+ let μ := ProbabilityTheory.cond P s.event
145
+ let E := branch μ s.cell a
146
+ { cell := a.getD s.cell
147
+ event := s.event ∩ E
148
+ stopped := if a = none then decide ((1/2:ℝ) ≤ (μ E).toReal) else false }
149
+
150
+ noncomputable def state {n : ℕ} (P : Measure (Coordinate n)) (Q : Cell n) (h : Log n) : State n :=
151
+ h.foldl (update P) ⟨Q,cellSet Q,false⟩
152
+
153
+ noncomputable def run {n : ℕ} (P : Measure (Coordinate n)) (Q : Cell n) : ℕ → Coordinate n → Log n
154
+ | 0, _ => []
155
+ | N+1, z =>
156
+ let h := run P Q N z
157
+ let s := state P Q h
158
+ if s.stopped then h else
159
+ h ++ [attemptLetter (ProbabilityTheory.cond P s.event) s.cell z]
160
+
161
+ def Terminates {n : ℕ} (P : Measure (Coordinate n)) (Q : Cell n) (z : Coordinate n) : Prop :=
162
+ ∃ N, (state P Q (run P Q N z)).stopped = true
163
+
164
+ noncomputable def attempts {n : ℕ} (P : Measure (Coordinate n)) (Q : Cell n) (z : Coordinate n) : ℕ := by
165
+ classical
166
+ exact if h : Terminates P Q z then Nat.find h else 0
167
+
168
+ noncomputable def terminalLog {n : ℕ} (P : Measure (Coordinate n)) (Q : Cell n) (z : Coordinate n) : Log n :=
169
+ run P Q (attempts P Q z) z
170
+
171
+ noncomputable def terminalCell {n : ℕ} (P : Measure (Coordinate n)) (Q : Cell n) (h : Log n) : Cell n :=
172
+ (state P Q h).cell
173
+
174
+ noncomputable def terminalLaw {n : ℕ} (P : Measure (Coordinate n)) (Q : Cell n) (h : Log n) : Measure (Coordinate n) :=
175
+ ProbabilityTheory.cond P {z | terminalLog P Q z = h}
176
+
177
+ noncomputable def depth {n : ℕ} (P : Measure (Coordinate n)) (Q : Cell n) (z : Coordinate n) : ℕ :=
178
+ (terminalCell P Q (terminalLog P Q z)).1-Q.1
179
+
180
+ def Regular {n : ℕ} (P : Measure (Coordinate n)) (Q : Cell n) : Prop :=
181
+ P (cellSet Q) = 1 ∧ ∀ R : Cell n, Descendant Q R → Q.1 < R.1 →
182
+ (P (cellSet R)).toReal ≤ 2 * threshold n (R.1-Q.1)
183
+
184
+ def FiniteEntropyStatement : Prop :=
185
+ ∃ n₀ : ℕ, ∀ n : ℕ, n₀ ≤ n → ∀ Q : Cell n, ∀ P : Measure (Coordinate n),
186
+ IsProbabilityMeasure P → P ≪ uniformCell Q → InformationTheory.klDiv P (uniformCell Q) ≠ ∞ →
187
+ (∀ᵐ z ∂P, Terminates P Q z) ∧ Measurable (terminalLog P Q) ∧
188
+ (∀ h : Log n, P {z | terminalLog P Q z = h} ≠ 0 →
189
+ Descendant Q (terminalCell P Q h) ∧ Regular (terminalLaw P Q h) (terminalCell P Q h)) ∧
190
+ Integrable (fun z => (depth P Q z : ℝ)) P ∧
191
+ Integrable (fun z => (attempts P Q z : ℝ)) P ∧
192
+ (∫ z,(attempts P Q z : ℝ) ∂P) ≤ 2*(1+∫ z,(depth P Q z : ℝ) ∂P) ∧
193
+ (∫⁻ z,InformationTheory.klDiv (terminalLaw P Q (terminalLog P Q z))
194
+ (uniformCell (terminalCell P Q (terminalLog P Q z))) ∂P) +
195
+ ENNReal.ofReal ((Real.log 2/4)*n*(∫ z,(depth P Q z : ℝ) ∂P)) ≤
196
+ InformationTheory.klDiv P (uniformCell Q) + ENNReal.ofReal (2/Real.exp 1)
197
+
198
+ theorem finite_expected_regularization : FiniteEntropyStatement := by
199
+ sorry
200
+
201
+ end FiniteEntropy
202
+
203
+ end RepeatedLocalization
204
+
205
+ end OAI
lean/ComparatorChallenges/GaussianInformation.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "challenge_module": "ComparatorChallenges.GaussianInformation",
3
+ "solution_module": "OAI.Probability.GaussianInformation.Main",
4
+ "theorem_names": [
5
+ "OAI.RepeatedLocalization.repeated_localization",
6
+ "OAI.AllScaleInverseVolume.inverse_volume_without_support",
7
+ "OAI.KernelPotential.kernel_coercivity",
8
+ "OAI.KernelPotential.actual_row_drift"
9
+ ],
10
+ "definition_names": [],
11
+ "permitted_axioms": [
12
+ "propext",
13
+ "Classical.choice",
14
+ "Quot.sound"
15
+ ],
16
+ "enable_nanoda": false
17
+ }
lean/ComparatorChallenges/GaussianInformation.lean ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import Mathlib
2
+
3
+ namespace OAI
4
+
5
+
6
+ open MeasureTheory ProbabilityTheory Set
7
+ open scoped BigOperators ENNReal
8
+
9
+ namespace RepeatedLocalization
10
+
11
+ abbrev Coordinate (n : ℕ) := Fin n → ℝ
12
+ abbrev GaussianBlock (n : ℕ) := Fin (n / 16) → Fin (n + 1) → ℝ
13
+ abbrev Label (n : ℕ) := Fin (n / 16) → ℝ
14
+ abbrev History (N t : ℕ) := Fin t → Fin N
15
+ abbrev Cell (n : ℕ) := Σ J : ℕ, Fin n → Fin (2 ^ J)
16
+
17
+ instance cellMeasurableSpace (n : ℕ) : MeasurableSpace (Cell n) := ⊤
18
+
19
+ noncomputable def initialCube (n : ℕ) : Set (Coordinate n) :=
20
+ Set.pi Set.univ (fun _ => Set.Ico (-1 / (2 * Real.sqrt n)) (1 / (2 * Real.sqrt n)))
21
+
22
+ noncomputable def cubePrior (n : ℕ) : Measure (Coordinate n) :=
23
+ ProbabilityTheory.cond volume (initialCube n)
24
+
25
+ noncomputable def chart {n : ℕ} (z : Coordinate n) : Fin (n + 1) → ℝ :=
26
+ Fin.lastCases (Real.sqrt (1 - ∑ a, (z a) ^ 2)) z
27
+
28
+ noncomputable def cellSet {n : ℕ} (Q : Cell n) : Set (Coordinate n) :=
29
+ {z | ∀ a, -1 / (2 * Real.sqrt n) + (Q.2 a : ℝ) / (Real.sqrt n * (2 : ℝ) ^ Q.1) ≤ z a ∧
30
+ z a < -1 / (2 * Real.sqrt n) + ((Q.2 a : ℝ) + 1) / (Real.sqrt n * (2 : ℝ) ^ Q.1)}
31
+
32
+ def rootCell (n : ℕ) : Cell n := ⟨0, fun _ => 0⟩
33
+
34
+ noncomputable def gaussianBlockLaw (n : ℕ) : Measure (GaussianBlock n) :=
35
+ Measure.pi (fun _ => Measure.pi (fun _ => gaussianReal 0 1))
36
+
37
+ noncomputable def exactLabel {n : ℕ} (X : GaussianBlock n) (z : Coordinate n) : Label n :=
38
+ fun row => ∑ a, X row a * chart z a
39
+
40
+ structure BlockRule (n N : ℕ) where
41
+ prob : (GaussianBlock n × Label n) → Fin N → ℝ
42
+ measurable_prob : ∀ w, Measurable (fun data => prob data w)
43
+ nonneg : ∀ data w, 0 ≤ prob data w
44
+ sum_one : ∀ data, ∑ w, prob data w = 1
45
+
46
+ abbrev Rules (n N t : ℕ) := ∀ i : Fin t, History N i.val → BlockRule n N
47
+
48
+ def past {N t : ℕ} (w : History N t) (i : Fin t) : History N i.val :=
49
+ fun j => w ⟨j.val, Nat.lt_trans j.isLt i.isLt⟩
50
+
51
+ def through {N t : ℕ} (w : History N t) (i : Fin t) : History N (i.val + 1) :=
52
+ fun j => w ⟨j.val, Nat.lt_of_lt_of_le j.isLt i.isLt⟩
53
+
54
+ noncomputable def blockProbability {n N : ℕ} (rule : BlockRule n N)
55
+ (z : Coordinate n) (w : Fin N) : ℝ :=
56
+ ∫ X, rule.prob (X, exactLabel X z) w ∂gaussianBlockLaw n
57
+
58
+ noncomputable def historyLikelihood {n N t : ℕ} (rules : Rules n N t)
59
+ (z : Coordinate n) (w : History N t) : ℝ :=
60
+ ∏ i, blockProbability (rules i (past w i)) z (w i)
61
+
62
+ noncomputable def experimentLaw {n N t : ℕ} (rules : Rules n N t) :
63
+ Measure (Coordinate n × History N t) :=
64
+ ∑ w : History N t,
65
+ ((cubePrior n).withDensity (fun z => ENNReal.ofReal (historyLikelihood rules z w))).map
66
+ (fun z => (z, w))
67
+
68
+ abbrev Disclosure (n N t : ℕ) := ∀ i : Fin t, Coordinate n → History N (i.val + 1) → Cell n
69
+
70
+ def ValidDisclosure {n N t : ℕ} (Q : Disclosure n N t) : Prop :=
71
+ (∀ i, Measurable (fun zh : Coordinate n × History N (i.val + 1) => Q i zh.1 zh.2)) ∧
72
+ (∀ i, (Set.range (fun zh : Coordinate n × History N (i.val + 1) => Q i zh.1 zh.2)).Finite) ∧
73
+ (∀ z ∈ initialCube n, ∀ w : History N t, ∀ i,
74
+ z ∈ cellSet (Q i z (through w i)) ∧ cellSet (Q i z (through w i)) ⊆ initialCube n) ∧
75
+ (∀ z ∈ initialCube n, ∀ w : History N t, ∀ i j : Fin t, i ≤ j →
76
+ cellSet (Q j z (through w j)) ⊆ cellSet (Q i z (through w i)))
77
+
78
+ noncomputable def transcriptMap {n N t : ℕ} (Q : Disclosure n N t)
79
+ (zw : Coordinate n × History N t) : Coordinate n × (History N t × (Fin t → Cell n)) :=
80
+ (zw.1, (zw.2, fun i => Q i zw.1 (through zw.2 i)))
81
+
82
+ noncomputable def augmentedLaw {n N t : ℕ} (rules : Rules n N t) (Q : Disclosure n N t) :=
83
+ (experimentLaw rules).map (transcriptMap Q)
84
+
85
+ noncomputable def mutualInformation {α β : Type*} [MeasurableSpace α] [MeasurableSpace β]
86
+ (μ : Measure (α × β)) : ℝ≥0∞ :=
87
+ InformationTheory.klDiv μ ((μ.map Prod.fst).prod (μ.map Prod.snd))
88
+
89
+ noncomputable def finalLevel {n N t : ℕ} (Q : Disclosure n N t)
90
+ (zw : Coordinate n × History N t) : ℕ :=
91
+ if ht : 0 < t then
92
+ let i : Fin t := ⟨t - 1, by omega⟩
93
+ (Q i zw.1 (through zw.2 i)).1
94
+ else 0
95
+
96
+ def MainStatement : Prop :=
97
+ ∃ c : ℝ, 0 < c ∧ ∃ n₀ : ℕ, ∀ C₀ : ℝ, 0 < C₀ →
98
+ ∃ C : ℝ, 0 < C ∧ ∀ (n N t : ℕ), n₀ ≤ n → 1 ≤ N → ∀ rules : Rules n N t,
99
+ (2 / (n / 8 : ℕ) + Real.exp (-c * (n / 16 : ℕ))) * Real.log N ≤ C₀ * (n + 1) →
100
+ ∃ Q : Disclosure n N t, ValidDisclosure Q ∧
101
+ mutualInformation (augmentedLaw rules Q) ≤ ENNReal.ofReal (C * (n + 1) * t) ∧
102
+ (∫ zw, (finalLevel Q zw : ℝ) ∂experimentLaw rules) ≤ C * t
103
+
104
+ theorem repeated_localization : MainStatement := by
105
+ sorry
106
+
107
+ end RepeatedLocalization
108
+
109
+
110
+ open MeasureTheory Metric
111
+ open scoped ENNReal
112
+ namespace AllScaleInverseVolume
113
+ local instance namedAtLeastTwoTwo : Nat.AtLeastTwo 2 := ⟨Nat.le_refl 2⟩
114
+
115
+ abbrev Ambient (d : ℕ) := EuclideanSpace ℝ (Fin d)
116
+
117
+ noncomputable local instance ambientSub (d : ℕ) : Sub (Ambient d) where
118
+ sub vector other := WithLp.toLp (2 : ℝ≥0∞)
119
+ (WithLp.ofLp (p := (2 : ℝ≥0∞)) vector - WithLp.ofLp (p := (2 : ℝ≥0∞)) other)
120
+
121
+ noncomputable local instance ambientInner (d : ℕ) : Inner ℝ (Ambient d) where
122
+ inner vector other := ∑ coordinate : Fin d,
123
+ inner ℝ (WithLp.ofLp (p := (2 : ℝ≥0∞)) vector coordinate)
124
+ (WithLp.ofLp (p := (2 : ℝ≥0∞)) other coordinate)
125
+
126
+ noncomputable def gramVolume {d k : ℕ} (u : Ambient d) (z : Fin k → Ambient d) : ℝ :=
127
+ Real.sqrt (Matrix.gram ℝ (fun i => z i-u)).det
128
+ noncomputable def inverseVolume {d : ℕ} (u : Ambient d) (z : Fin (d/100) → Ambient d) : ℝ≥0∞ :=
129
+ ((ENNReal.ofReal (gramVolume u z))⁻¹)^(d/100)
130
+ def BallBound {d : ℕ} (ν : Measure (Ambient d)) : Prop :=
131
+ ∀ (x : Ambient d) (r : ℝ), 0 < r →
132
+ ν (ball x r) ≤ ENNReal.ofReal (r^(((d:ℝ)-1)/2))
133
+ def InverseVolumeStatement : Prop :=
134
+ ∃ C : ℝ, 0 < C ∧ ∃ d₀ : ℕ, ∀ d : ℕ, d₀ ≤ d →
135
+ ∀ ν : Measure (Ambient d), IsProbabilityMeasure ν → BallBound ν →
136
+ ∀ u : Ambient d, (∫⁻ z,inverseVolume u z ∂Measure.pi (fun _ : Fin (d/100) => ν)) ≤
137
+ ENNReal.ofReal (Real.exp (C*d*(d/100:ℕ)))
138
+ theorem inverse_volume_without_support : InverseVolumeStatement := by
139
+ sorry
140
+ end AllScaleInverseVolume
141
+
142
+
143
+ open MeasureTheory ProbabilityTheory Metric Set
144
+ open scoped ENNReal
145
+ namespace KernelPotential
146
+ local instance namedAtLeastTwoTwo : Nat.AtLeastTwo 2 := ⟨Nat.le_refl 2⟩
147
+
148
+ abbrev Ambient (d : ℕ) := EuclideanSpace ℝ (Fin d)
149
+ abbrev Rows (d : ℕ) := Fin (d/16) → Fin d → ℝ
150
+ noncomputable def radial {d : ℕ} (x : Ambient d) : Ambient d := ‖x‖⁻¹ • x
151
+ noncomputable def sphereProbability (d : ℕ) : Measure (Ambient d) :=
152
+ ((volume (ball (0 : Ambient d) 1))⁻¹ • volume.restrict (ball (0 : Ambient d) 1)).map radial
153
+ noncomputable def J {d : ℕ} (ν : Measure (Ambient d)) (s : Ambient d) : ℝ≥0∞ :=
154
+ ∫⁻ u,((ENNReal.ofReal ‖u-s‖)⁻¹)^(2*(d/16)) ∂ν
155
+ noncomputable def B {d : ℕ} (ν : Measure (Ambient d)) : ℝ :=
156
+ ∫ s, Real.log ((J ν s).toReal) ∂ν
157
+ noncomputable def Phi {d : ℕ} (ν : Measure (Ambient d)) : ℝ :=
158
+ (InformationTheory.klDiv ν (sphereProbability d)).toReal - B ν
159
+
160
+ def BoundedDensity {d : ℕ} (ν : Measure (Ambient d)) : Prop :=
161
+ ∃ H : ℝ, 0 < H ∧ ν ≤ ENNReal.ofReal H • sphereProbability d
162
+
163
+ noncomputable def rowLaw (d : ℕ) : Measure (Rows d) :=
164
+ Measure.pi (fun _ : Fin (d/16) => Measure.pi (fun _ : Fin d => gaussianReal 0 1))
165
+ noncomputable def labels {d : ℕ} (a : Rows d) (s : Ambient d) : Fin (d/16) → ℝ :=
166
+ fun i => ∑ j,a i j*s j
167
+ structure BlockRule (d N : ℕ) where
168
+ prob : (Fin N × (Rows d × (Fin (d/16) → ℝ))) → Fin N → ℝ
169
+ measurable_prob : ∀ w, Measurable (fun x => prob x w)
170
+ nonneg_prob : ∀ x w, 0 ≤ prob x w
171
+ sum_prob : ∀ x, ∑ w,prob x w=1
172
+
173
+ noncomputable def outgoingLaw {d N : ℕ} (μ : Measure (Ambient d × Fin N))
174
+ (rule : BlockRule d N) : Measure (Ambient d × Fin N) :=
175
+ ∑ w : Fin N, ((μ.prod (rowLaw d)).withDensity (fun x =>
176
+ ENNReal.ofReal (rule.prob (x.1.2,x.2,labels x.2 x.1.1) w))).map (fun x => (x.1.1,w))
177
+ noncomputable def component {d N : ℕ} (μ : Measure (Ambient d × Fin N)) (v : Fin N) :
178
+ Measure (Ambient d) := (μ.restrict {x|x.2=v}).map Prod.fst
179
+ noncomputable def posterior {d N : ℕ} (μ : Measure (Ambient d × Fin N)) (v : Fin N) :
180
+ Measure (Ambient d) := (component μ v univ)⁻¹ • component μ v
181
+ noncomputable def averagePhi {d N : ℕ} (μ : Measure (Ambient d × Fin N)) : ℝ :=
182
+ ∑ v : Fin N, (component μ v univ).toReal * Phi (posterior μ v)
183
+
184
+ def CoercivityStatement : Prop :=
185
+ ∃ C : ℝ, 0 < C ∧ ∃ d₀ : ℕ, ∀ d : ℕ, d₀ ≤ d →
186
+ (∀ ν : Measure (Ambient d), IsProbabilityMeasure ν → BoundedDensity ν →
187
+ (1/2:ℝ)*(InformationTheory.klDiv ν (sphereProbability d)).toReal-C*d ≤ Phi ν) ∧
188
+ Phi (sphereProbability d) ≤ (2*(d/16):ℕ)*Real.log 2 ∧
189
+ (∀ (q : ℕ) (w : Fin q → ℝ), (∀ i,0 ≤ w i) → (∑ i,w i)=1 →
190
+ ∀ ν : Fin q → Measure (Ambient d), (∀ i,IsProbabilityMeasure (ν i)) →
191
+ (∀ i,BoundedDensity (ν i)) →
192
+ Phi (∑ i,ENNReal.ofReal (w i) • ν i) ≤ ∑ i,w i*Phi (ν i))
193
+
194
+ def DriftStatement : Prop :=
195
+ ∃ C : ℝ, 0 < C ∧ ∃ d₀ : ℕ, ∀ d : ℕ, d₀ ≤ d → ∀ N : ℕ, 1 ≤ N →
196
+ Real.log N ≤ (d:ℝ)^2 → ∀ μ : Measure (Ambient d × Fin N), IsProbabilityMeasure μ →
197
+ μ.map Prod.fst=sphereProbability d → ∀ rule : BlockRule d N,
198
+ averagePhi (outgoingLaw μ rule) ≤ averagePhi μ+C*d
199
+
200
+ theorem kernel_coercivity : CoercivityStatement := by sorry
201
+ theorem actual_row_drift : DriftStatement := by sorry
202
+ end KernelPotential
203
+
204
+ end OAI
lean/ComparatorChallenges/GaussianMoat.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "challenge_module": "ComparatorChallenges.GaussianMoat",
3
+ "solution_module": "OAI.NumberTheory.GaussianMoat.Main",
4
+ "theorem_names": [
5
+ "OAI.GaussianMoat.fullMain"
6
+ ],
7
+ "definition_names": [],
8
+ "permitted_axioms": [
9
+ "propext",
10
+ "Quot.sound",
11
+ "Classical.choice"
12
+ ],
13
+ "enable_nanoda": false
14
+ }
lean/ComparatorChallenges/GaussianMoat.lean ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import Mathlib
2
+
3
+ namespace OAI
4
+
5
+ namespace GaussianMoat
6
+
7
+ abbrev PrimeVertex := {z : GaussianInt // Irreducible z}
8
+
9
+ noncomputable def primeGraph (D : ℝ) : SimpleGraph PrimeVertex where
10
+ Adj p q := p ≠ q ∧ dist (p.val : ℂ) (q.val : ℂ) ≤ D
11
+ symm := by
12
+ constructor
13
+ intro p q h
14
+ exact ⟨h.1.symm, by simpa only [dist_comm] using h.2⟩
15
+ loopless := by
16
+ constructor
17
+ intro p h
18
+ exact h.1 rfl
19
+
20
+ def component (D : ℝ) (p : PrimeVertex) : Set PrimeVertex :=
21
+ {q | (primeGraph D).Reachable p q}
22
+
23
+ def MainEndpoint : Prop :=
24
+ ∀ (D : ℝ) (z : ℕ → GaussianInt),
25
+ (∀ t, Irreducible (z t)) → Function.Injective z →
26
+ (∀ t, dist (z (t + 1) : ℂ) (z t : ℂ) ≤ D) → False
27
+
28
+ def UniformEndpoint : Prop :=
29
+ ∀ D : ℝ, ∃ B : ℕ,
30
+ (∀ p : PrimeVertex, (component D p).Finite ∧ (component D p).ncard ≤ B) ∧
31
+ (∀ (n : ℕ) (z : Fin n → GaussianInt),
32
+ (∀ i, Irreducible (z i)) → Function.Injective z →
33
+ (∀ i j : Fin n, j.val = i.val + 1 → dist (z j : ℂ) (z i : ℂ) ≤ D) →
34
+ n ≤ B)
35
+
36
+ theorem fullMain : MainEndpoint ∧ UniformEndpoint := by
37
+ sorry
38
+
39
+ end GaussianMoat
40
+
41
+ end OAI
lean/ComparatorChallenges/GaussianPropeller.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "challenge_module": "ComparatorChallenges.GaussianPropeller",
3
+ "solution_module": "OAI.Probability.GaussianPropeller.Main",
4
+ "theorem_names": [
5
+ "OAI.GaussianPropeller.all_partitions"
6
+ ],
7
+ "definition_names": [],
8
+ "permitted_axioms": [
9
+ "propext",
10
+ "Quot.sound",
11
+ "Classical.choice"
12
+ ],
13
+ "enable_nanoda": false
14
+ }
lean/ComparatorChallenges/GaussianPropeller.lean ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import Mathlib
2
+
3
+ namespace OAI
4
+
5
+ open MeasureTheory ProbabilityTheory
6
+ open scoped ENNReal
7
+
8
+ namespace GaussianPropeller
9
+
10
+ abbrev Space (d : ℕ) := EuclideanSpace ℝ (Fin d)
11
+
12
+ noncomputable def gaussian (d : ℕ) : Measure (Space d) := stdGaussian (Space d)
13
+
14
+ def IsPartition {d k : ℕ} (A : Fin k → Set (Space d)) : Prop :=
15
+ (∀ i, MeasurableSet (A i)) ∧ ∀ᵐ x ∂gaussian d, ∃! i, x ∈ A i
16
+
17
+ noncomputable def centroid {d : ℕ} (A : Set (Space d)) : Space d :=
18
+ ∫ x in A, x ∂gaussian d
19
+
20
+ noncomputable def value {d k : ℕ} (A : Fin k → Set (Space d)) : ℝ :=
21
+ ∑ i, ‖centroid (A i)‖ ^ 2
22
+
23
+ def coord {d : ℕ} (j : ℕ) (x : Space d) : ℝ :=
24
+ if h : j < d then x ⟨j, h⟩ else 0
25
+
26
+ noncomputable def propeller (d k : ℕ) (i : Fin k) : Set (Space d) :=
27
+ if i.val = 0 then {x | |coord 1 x| ≤ Real.sqrt 3 * coord 0 x}
28
+ else if i.val = 1 then {x | 0 ≤ coord 1 x ∧ Real.sqrt 3 * coord 0 x ≤ coord 1 x}
29
+ else if i.val = 2 then {x | coord 1 x ≤ 0 ∧ Real.sqrt 3 * coord 0 x ≤ -coord 1 x}
30
+ else ∅
31
+
32
+ def AllPartitions : Prop :=
33
+ (∀ (d k : ℕ), 0 < d → 0 < k → ∀ A : Fin k → Set (Space d),
34
+ IsPartition A → value A ≤ 9 / (8 * Real.pi)) ∧
35
+ (∀ (d k : ℕ), 2 ≤ d → 3 ≤ k →
36
+ IsPartition (propeller d k) ∧ value (propeller d k) = 9 / (8 * Real.pi))
37
+
38
+ theorem all_partitions : AllPartitions := by
39
+ sorry
40
+
41
+ end GaussianPropeller
42
+
43
+ end OAI
lean/ComparatorChallenges/GaussianReplacement.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "challenge_module": "ComparatorChallenges.GaussianReplacement",
3
+ "solution_module": "OAI.Probability.GaussianReplacement.FiberEquality",
4
+ "theorem_names": [
5
+ "OAI.CurrentProjection.mixedMomentMain",
6
+ "OAI.CurrentProjection.actualRowMain",
7
+ "OAI.CurrentProjection.actualRowRefinement",
8
+ "OAI.CurrentProjection.actualRowSourceMain",
9
+ "OAI.CurrentProjection.actualRowSourceRefinement",
10
+ "OAI.CurrentProjection.criticalComparisonMain",
11
+ "OAI.CurrentProjection.oneLevelComparisonMain",
12
+ "OAI.CurrentProjection.twoLabelComparisonMain",
13
+ "OAI.CurrentProjection.hybridBlockMain",
14
+ "OAI.CurrentProjection.fiberTwoPointMain",
15
+ "OAI.CurrentProjection.fiberBlockMain"
16
+ ],
17
+ "definition_names": [],
18
+ "permitted_axioms": [
19
+ "propext",
20
+ "Quot.sound",
21
+ "Classical.choice"
22
+ ],
23
+ "enable_nanoda": false
24
+ }
lean/ComparatorChallenges/GaussianReplacement.lean ADDED
@@ -0,0 +1,524 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import Mathlib
2
+
3
+ namespace OAI
4
+
5
+ open MeasureTheory ProbabilityTheory Set Filter InformationTheory
6
+ open scoped ENNReal NNReal RealInnerProductSpace Topology
7
+
8
+ noncomputable section
9
+
10
+ namespace CurrentProjection
11
+
12
+ abbrev Vector (d : ℕ) := EuclideanSpace ℝ (Fin d)
13
+
14
+ abbrev Sphere (d : ℕ) := Metric.sphere (0 : Vector d) 1
15
+
16
+ abbrev Rows (k d : ℕ) := Fin k → Vector d
17
+
18
+ def uniformSphere (d : ℕ) : Measure (Sphere d) :=
19
+ let σ := (volume : Measure (Vector d)).toSphere
20
+ (σ Set.univ)⁻¹ • σ
21
+
22
+ def gaussianRows (k d : ℕ) : Measure (Rows k d) :=
23
+ Measure.pi fun _ => stdGaussian (Vector d)
24
+
25
+ def label {k d : ℕ} (g : Rows k d) (s : Vector d) : Fin k → ℝ :=
26
+ fun i => ⟪s, g i⟫
27
+
28
+ def LocalGrowth {d : ℕ} (ρ : Measure (Sphere d)) (a : ℕ) (B : ℝ) : Prop :=
29
+ ∀ z : Vector d, ∀ t : ℝ, 0 < t →
30
+ ρ {u | dist (u : Vector d) z ≤ t} ≤ ENNReal.ofReal (B * t ^ a)
31
+
32
+ def cubeAverage {k d : ℕ} (ρ : Measure (Sphere d)) (g : Rows k d)
33
+ (y : Fin k → ℝ) (δ : ℝ) : ℝ≥0∞ :=
34
+ ENNReal.ofReal ((2 * δ)⁻¹ ^ k) *
35
+ ρ {u | ∀ i, |label g (u : Vector d) i - y i| ≤ δ}
36
+
37
+ def exactDensity {k d : ℕ} (ρ : Measure (Sphere d)) (g : Rows k d)
38
+ (y : Fin k → ℝ) : ℝ≥0∞ := by
39
+ classical
40
+ let f := fun j : ℕ => (cubeAverage ρ g y (1 / (j : ℝ))).toReal
41
+ exact if h : ∃ L : ℝ, Tendsto f atTop (𝓝 L) then ENNReal.ofReal h.choose else 0
42
+
43
+ def AdmissibleDimensions (d m r q : ℕ) : Prop :=
44
+ 1 ≤ m ∧ 1 ≤ r ∧ 1 ≤ q ∧ m + r < d - 1 ∧ m + r - m - (q - 1) ≥ 1
45
+
46
+ def momentConstant (C : ℝ) (d : ℕ) (B D : ℝ) : ℝ≥0∞ :=
47
+ ENNReal.ofReal (Real.exp (C * d) * B * (1 + max (Real.log (D / B)) 0))
48
+
49
+ def MixedMomentMain : Prop :=
50
+ ∃ C : ℝ, 0 < C ∧ ∀ (d m r q : ℕ), AdmissibleDimensions d m r q →
51
+ ∀ (ρ : Measure (Sphere d)), IsFiniteMeasure ρ →
52
+ ∀ (B D : ℝ), 0 < B → 0 < D → LocalGrowth ρ (m+r) B → LocalGrowth ρ (d-1) D →
53
+ (∀ (s : Sphere d) (δ : ℝ), 0 < δ →
54
+ (∫⁻ X, (∫⁻ Z, cubeAverage ρ (Fin.append X Z)
55
+ (label (Fin.append X Z) (s : Vector d)) δ ∂gaussianRows r d)^q
56
+ ∂gaussianRows m d) ≤ (momentConstant C d B D)^q) ∧
57
+ (ρ ≪ uniformSphere d → ∃ E : Set (Sphere d), MeasurableSet E ∧ ρ E = 0 ∧
58
+ ∀ s ∉ E,
59
+ (∀ᵐ G ∂gaussianRows (m+r) d,
60
+ Tendsto (fun δ : ℝ => cubeAverage ρ G (label G (s : Vector d)) δ)
61
+ (𝓝[>] 0) (𝓝 (exactDensity ρ G (label G (s : Vector d))))) ∧
62
+ ((∫⁻ X, (∫⁻ Z, exactDensity ρ (Fin.append X Z)
63
+ (label (Fin.append X Z) (s : Vector d)) ∂gaussianRows r d)^q
64
+ ∂gaussianRows m d) ≤ (momentConstant C d B D)^q) ∧
65
+ (ρ ≠ 0 → ∀ᵐ G ∂gaussianRows (m+r) d,
66
+ 0 < exactDensity ρ G (label G (s : Vector d)) ∧
67
+ exactDensity ρ G (label G (s : Vector d)) < ∞))
68
+
69
+ instance gaussianRows_isProbabilityMeasure (k d : ℕ) : IsProbabilityMeasure (gaussianRows k d) := by
70
+ unfold gaussianRows
71
+ infer_instance
72
+
73
+ lemma measurable_own_label {k d : ℕ} :
74
+ Measurable (fun z : Rows k d × Sphere d => label z.1 (z.2:Vector d)) := by
75
+ apply Measurable.of_eval
76
+ intro i
77
+ exact (continuous_inner.comp <| (continuous_subtype_val.comp continuous_snd).prodMk
78
+ ((continuous_apply i).comp continuous_fst)).measurable
79
+
80
+ def swapLast {A B C : Type*} [MeasurableSpace A] [MeasurableSpace B] [MeasurableSpace C] :
81
+ (A × B) × C ≃ᵐ (A × C) × B where
82
+ toFun p := ((p.1.1,p.2),p.1.2)
83
+ invFun p := ((p.1.1,p.2),p.1.2)
84
+ left_inv _ := rfl
85
+ right_inv _ := rfl
86
+ measurable_toFun := (measurable_fst.fst.prodMk measurable_snd).prodMk measurable_fst.snd
87
+ measurable_invFun := (measurable_fst.fst.prodMk measurable_snd).prodMk measurable_fst.snd
88
+
89
+ def rowInformation {S W X : Type*} [MeasurableSpace S] [MeasurableSpace W]
90
+ [MeasurableSpace X] (P : Measure ((S×W)×X)) (γ : Measure X) : ℝ≥0∞ :=
91
+ klDiv P (P.fst.prod γ)
92
+
93
+ noncomputable def shannonEntropy {W : Type*} [MeasurableSpace W] (π : Measure W) : ℝ≥0∞ :=
94
+ ∫⁻ w, ENNReal.ofReal (-Real.log (π {w}).toReal) ∂π
95
+
96
+ def conditionalMutualInformation {Z A B : Type*} [MeasurableSpace Z]
97
+ [MeasurableSpace A] [MeasurableSpace B] [StandardBorelSpace A] [StandardBorelSpace B]
98
+ (P : Measure (Z×(A×B))) [IsFiniteMeasure P] : ℝ≥0∞ := by
99
+ classical
100
+ exact if h : Nonempty (A×B) then
101
+ letI := h
102
+ InformationTheory.klDiv P (P.fst ⊗ₘ (P.condKernel.fst ×ₖ P.condKernel.snd))
103
+ else 0
104
+
105
+ def actualExperiment {d m r : ℕ} {W : Type*} [MeasurableSpace W]
106
+ (P : Measure ((Sphere d × W) × Rows m d)) :
107
+ Measure (((Sphere d × W) × Rows m d) × Rows r d) := P.prod (gaussianRows r d)
108
+
109
+ instance actualExperiment_isProbabilityMeasure {d m r : ℕ} {W : Type*} [MeasurableSpace W]
110
+ (P : Measure ((Sphere d×W)×Rows m d)) [IsProbabilityMeasure P] :
111
+ IsProbabilityMeasure (actualExperiment (r:=r) P) :=
112
+ inferInstanceAs (IsProbabilityMeasure (P.prod (gaussianRows r d)))
113
+
114
+ def actualObservation {d m r : ℕ} {W : Type*}
115
+ (p : ((Sphere d × W) × Rows m d) × Rows r d) :
116
+ (Rows (m+r) d × W) × (Fin (m+r) → ℝ) :=
117
+ ((Fin.append p.1.2 p.2,p.1.1.2), label (Fin.append p.1.2 p.2) (p.1.1.1 : Vector d))
118
+
119
+ instance actualObservation_isProbabilityMeasure {d m r : ℕ} {W : Type*} [MeasurableSpace W]
120
+ (P : Measure ((Sphere d×W)×Rows m d)) [IsProbabilityMeasure P] :
121
+ IsProbabilityMeasure ((actualExperiment (r:=r) P).map actualObservation) :=
122
+ inferInstance
123
+
124
+ def selectedCube {k d : ℕ} {W : Type*} (ρ : W → Measure (Sphere d)) (δ : ℝ)
125
+ (z : (Rows k d×W)×(Fin k → ℝ)) : ℝ≥0∞ := cubeAverage (ρ z.1.2) z.1.1 z.2 δ
126
+
127
+ def selectedExact {k d : ℕ} {W : Type*} (ρ : W → Measure (Sphere d))
128
+ (z : (Rows k d×W)×(Fin k → ℝ)) : ℝ≥0∞ := exactDensity (ρ z.1.2) z.1.1 z.2
129
+
130
+ def momentBound (C : ℝ) (d : ℕ) (B D : ℝ) : ℝ :=
131
+ Real.exp (C*d)*B*(1+max (Real.log (D/B)) 0)
132
+
133
+ def logPositive (x : ℝ≥0∞) : ℝ := max (Real.log x.toReal) 0
134
+
135
+ def logNegative (x : ℝ≥0∞) : ℝ≥0∞ := if x = 0 then ∞ else ENNReal.ofReal (-Real.log x.toReal)
136
+
137
+ def extendedLogExpectation {A : Type*} [MeasurableSpace A] (μ : Measure A)
138
+ (f : A → ℝ≥0∞) : EReal :=
139
+ ((∫⁻ a, ENNReal.ofReal (logPositive (f a)) ∂μ) : EReal) -
140
+ ((∫⁻ a, logNegative (f a) ∂μ) : EReal)
141
+
142
+ def PositiveMessage {W : Type*} [MeasurableSpace W] (π : Measure W) := {w : W // 0 < π {w}}
143
+
144
+ def completeFamily {W : Type*} [MeasurableSpace W] {T : Type*} (π : Measure W)
145
+ (f : PositiveMessage π → T) (t₀ : T) (w : W) : T :=
146
+ if h : 0 < π {w} then f ⟨w,h⟩ else t₀
147
+
148
+ structure ActualRowConclusion {d m r q : ℕ} {W : Type*} [MeasurableSpace W]
149
+ (P : Measure ((Sphere d×W)×Rows m d)) [IsProbabilityMeasure P]
150
+ (ρ : W → Measure (Sphere d)) (B D : W → ℝ) : Prop where
151
+ row_finite : rowInformation P (gaussianRows m d) ≠ ∞
152
+ row_le_entropy : (rowInformation P (gaussianRows m d)).toReal ≤
153
+ (shannonEntropy (P.map swapLast).snd).toReal
154
+ conditional_density : ∀ᵐ gw ∂((actualExperiment (r:=r) P).map actualObservation).fst,
155
+ ((actualExperiment (r:=r) P).map actualObservation).condKernel gw ≪ volume
156
+ actual_limit : ∀ᵐ p ∂actualExperiment (r:=r) P,
157
+ Tendsto (fun j : ℕ => selectedCube ρ (1/(j:ℝ)) (actualObservation p)) atTop
158
+ (𝓝 (selectedExact ρ (actualObservation p)))
159
+ smoothed_bound : ∀ δ : ℝ, 0 < δ →
160
+ Integrable (fun p => Real.log (1+(selectedCube ρ δ (actualObservation p)).toReal))
161
+ (actualExperiment (r:=r) P) ∧
162
+ (∫ p, Real.log (1+(selectedCube ρ δ (actualObservation p)).toReal) ∂actualExperiment (r:=r) P) ≤
163
+ (rowInformation P (gaussianRows m d)).toReal/q +
164
+ ∫ sw : Sphere d×W, Real.log (1+momentBound 9 d (B sw.2) (D sw.2)) ∂P.fst
165
+ exact_integrable : Integrable (fun p => Real.log (1+(selectedExact ρ (actualObservation p)).toReal))
166
+ (actualExperiment (r:=r) P)
167
+ exact_bound : (∫ p, Real.log (1+(selectedExact ρ (actualObservation p)).toReal) ∂actualExperiment (r:=r) P) ≤
168
+ (rowInformation P (gaussianRows m d)).toReal/q +
169
+ ∫ sw : Sphere d×W, Real.log (1+momentBound 9 d (B sw.2) (D sw.2)) ∂P.fst
170
+ entropy_bound : (rowInformation P (gaussianRows m d)).toReal/q +
171
+ ∫ sw : Sphere d×W, Real.log (1+momentBound 9 d (B sw.2) (D sw.2)) ∂P.fst ≤
172
+ (shannonEntropy (P.map swapLast).snd).toReal/q +
173
+ ∫ sw : Sphere d×W, Real.log (1+momentBound 9 d (B sw.2) (D sw.2)) ∂P.fst
174
+ positive_log_integrable : Integrable (fun p => logPositive (selectedExact ρ (actualObservation p)))
175
+ (actualExperiment (r:=r) P)
176
+ extended_log_bound : extendedLogExpectation (actualExperiment (r:=r) P)
177
+ (fun p => selectedExact ρ (actualObservation p)) ≤
178
+ (((rowInformation P (gaussianRows m d)).toReal/q +
179
+ ∫ sw : Sphere d×W, Real.log (1+momentBound 9 d (B sw.2) (D sw.2)) ∂P.fst) : EReal)
180
+
181
+ def actualConditionalRowInformation {d m : ℕ} {W : Type*} [MeasurableSpace W]
182
+ [StandardBorelSpace W]
183
+ (P : Measure ((Sphere d×W)×Rows m d)) [IsFiniteMeasure P] : ℝ≥0∞ :=
184
+ conditionalMutualInformation (P.map (fun p => (p.1.1,(p.2,p.1.2))))
185
+
186
+ structure ActualRowSourceConclusion {d m r q : ℕ} {W : Type*} [MeasurableSpace W]
187
+ [StandardBorelSpace W]
188
+ (P : Measure ((Sphere d×W)×Rows m d)) [IsProbabilityMeasure P]
189
+ (ρ : W → Measure (Sphere d)) (B D : W → ℝ) : Prop where
190
+ row_finite : actualConditionalRowInformation P ≠ ∞
191
+ row_le_entropy : (actualConditionalRowInformation P).toReal ≤
192
+ (shannonEntropy (P.map swapLast).snd).toReal
193
+ conditional_density : ∀ᵐ gw ∂((actualExperiment (r:=r) P).map actualObservation).fst,
194
+ ((actualExperiment (r:=r) P).map actualObservation).condKernel gw ≪ volume
195
+ actual_limit : ∀ᵐ p ∂actualExperiment (r:=r) P,
196
+ Tendsto (fun j : ℕ => selectedCube ρ (1/(j:ℝ)) (actualObservation p)) atTop
197
+ (𝓝 (selectedExact ρ (actualObservation p)))
198
+ smoothed_bound : ∀ δ : ℝ, 0 < δ →
199
+ Integrable (fun p => Real.log (1+(selectedCube ρ δ (actualObservation p)).toReal))
200
+ (actualExperiment (r:=r) P) ∧
201
+ (∫ p, Real.log (1+(selectedCube ρ δ (actualObservation p)).toReal) ∂actualExperiment (r:=r) P) ≤
202
+ (actualConditionalRowInformation P).toReal/q +
203
+ ∫ sw : Sphere d×W, Real.log (1+momentBound 9 d (B sw.2) (D sw.2)) ∂P.fst
204
+ exact_integrable : Integrable (fun p => Real.log (1+(selectedExact ρ (actualObservation p)).toReal))
205
+ (actualExperiment (r:=r) P)
206
+ exact_bound : (∫ p, Real.log (1+(selectedExact ρ (actualObservation p)).toReal) ∂actualExperiment (r:=r) P) ≤
207
+ (actualConditionalRowInformation P).toReal/q +
208
+ ∫ sw : Sphere d×W, Real.log (1+momentBound 9 d (B sw.2) (D sw.2)) ∂P.fst
209
+ entropy_bound : (actualConditionalRowInformation P).toReal/q +
210
+ ∫ sw : Sphere d×W, Real.log (1+momentBound 9 d (B sw.2) (D sw.2)) ∂P.fst ≤
211
+ (shannonEntropy (P.map swapLast).snd).toReal/q +
212
+ ∫ sw : Sphere d×W, Real.log (1+momentBound 9 d (B sw.2) (D sw.2)) ∂P.fst
213
+ positive_log_integrable : Integrable (fun p => logPositive (selectedExact ρ (actualObservation p)))
214
+ (actualExperiment (r:=r) P)
215
+ extended_log_bound : extendedLogExpectation (actualExperiment (r:=r) P)
216
+ (fun p => selectedExact ρ (actualObservation p)) ≤
217
+ (((actualConditionalRowInformation P).toReal/q +
218
+ ∫ sw : Sphere d×W, Real.log (1+momentBound 9 d (B sw.2) (D sw.2)) ∂P.fst) : EReal)
219
+
220
+ def alignedExperiment {d m r : ℕ} {W : Type*} [MeasurableSpace W]
221
+ (P : Measure ((Sphere d×W)×Rows m d)) : Measure ((Sphere d×W)×Rows (m+r) d) :=
222
+ (actualExperiment (r:=r) P).map (fun p => (p.1.1,Fin.append p.1.2 p.2))
223
+
224
+ instance alignedExperiment_probability {d m r : ℕ} {W : Type*} [MeasurableSpace W]
225
+ (P : Measure ((Sphere d×W)×Rows m d)) [IsProbabilityMeasure P] :
226
+ IsProbabilityMeasure (alignedExperiment (r:=r) P) := by
227
+ unfold alignedExperiment
228
+ infer_instance
229
+
230
+ def exposedJointMap {d k : ℕ} {W : Type*} (p : (Sphere d×W)×Rows k d) :
231
+ (Rows k d×(Fin k → ℝ))×(Sphere d×W) := ((p.2,label p.2 (p.1.1:Vector d)),p.1)
232
+
233
+ def exposedInformation {d k : ℕ} {W : Type*} [MeasurableSpace W] [StandardBorelSpace W]
234
+ (P : Measure ((Sphere d×W)×Rows k d)) [IsFiniteMeasure P] : ℝ≥0∞ :=
235
+ conditionalMutualInformation (P.map exposedJointMap)
236
+
237
+ def CriticalComparisonMain : Prop :=
238
+ ∃ (K : ℝ) (d₀ : ℕ), 0 < K ∧ ∀ (d : ℕ), d₀ ≤ d →
239
+ ∀ (W : Type) [MeasurableSpace W] [Countable W] [MeasurableSingletonClass W],
240
+ ∀ (P : Measure ((Sphere d×W)×Rows (d/10) d)) [IsProbabilityMeasure P],
241
+ (P.map swapLast).fst = (uniformSphere d).prod (gaussianRows (d/10) d) →
242
+ shannonEntropy (P.map swapLast).snd ≤ ENNReal.ofReal ((d:ℝ)^2) →
243
+ exposedInformation (P.fst.prod (gaussianRows (d/10+(d/2-d/10)) d)) ≤
244
+ exposedInformation (alignedExperiment (r:=d/2-d/10) P) + ENNReal.ofReal (K*d)
245
+
246
+ def OneLevelComparisonMain : Prop :=
247
+ ∃ (C : ℝ) (d₀ : ℕ), 0 < C ∧ ∀ d, d₀ ≤ d →
248
+ ∀ (U : Type) [MeasurableSpace U] [Finite U] [MeasurableSingletonClass U],
249
+ ∀ (P : Measure ((Sphere d×U)×Rows (d/32) d)) [IsProbabilityMeasure P],
250
+ (P.map swapLast).fst = (uniformSphere d).prod (gaussianRows (d/32) d) →
251
+ exposedInformation (P.fst.prod (gaussianRows (d/32+(d/4-d/32)) d)) ≤
252
+ exposedInformation (alignedExperiment (r:=d/4-d/32) P) +
253
+ ENNReal.ofReal (C*((d:ℝ)+Real.log (1+(d:ℝ)+(shannonEntropy P.fst.snd).toReal)+
254
+ (shannonEntropy P.fst.snd).toReal/(d:ℝ)))
255
+
256
+ def TwoLabelComparisonMain : Prop :=
257
+ ∃ (C : ℝ) (d₀ : ℕ), 0 < C ∧ ∀ d, d₀ ≤ d →
258
+ ∀ (V : Type) [MeasurableSpace V] [Finite V] [MeasurableSingletonClass V],
259
+ ∀ (P : Measure ((Sphere d×V)×Rows (d/8) d)) [IsProbabilityMeasure P],
260
+ (P.map swapLast).fst = (uniformSphere d).prod (gaussianRows (d/8) d) →
261
+ shannonEntropy P.fst.snd ≤ ENNReal.ofReal ((d:ℝ)^2) →
262
+ exposedInformation (P.fst.prod (gaussianRows (d/8+(d/2-d/8)) d)) ≤
263
+ exposedInformation (alignedExperiment (r:=d/2-d/8) P) + ENNReal.ofReal (C*d)
264
+
265
+ def blockInput {d m : ℕ} {U : Type*} (z : (Sphere d × U) × Rows m d) :
266
+ U × (Rows m d × (Fin m → ℝ)) :=
267
+ (z.1.2, z.2, label z.2 (z.1.1 : Vector d))
268
+
269
+ lemma measurable_blockInput {d m : ℕ} {U : Type*} [MeasurableSpace U] :
270
+ Measurable (blockInput (d:=d) (m:=m) (U:=U)) := by
271
+ exact measurable_fst.snd.prodMk (measurable_snd.prodMk
272
+ ((measurable_own_label (d:=d) (k:=m)).comp
273
+ (measurable_snd.prodMk measurable_fst.fst)))
274
+
275
+ def blockLaw {d m : ℕ} {U V : Type*} [MeasurableSpace U] [MeasurableSpace V]
276
+ (P : Measure (Sphere d × U))
277
+ (κ : Kernel (U × (Rows m d × (Fin m → ℝ))) V) :
278
+ Measure (((Sphere d × U) × Rows m d) × V) :=
279
+ (P.prod (gaussianRows m d)) ⊗ₘ κ.comap blockInput measurable_blockInput
280
+
281
+ instance blockLaw_probability {d m : ℕ} {U V : Type*}
282
+ [MeasurableSpace U] [MeasurableSpace V]
283
+ (P : Measure (Sphere d × U)) [IsProbabilityMeasure P]
284
+ (κ : Kernel (U × (Rows m d × (Fin m → ℝ))) V) [IsMarkovKernel κ] :
285
+ IsProbabilityMeasure (blockLaw P κ) := by
286
+ unfold blockLaw
287
+ infer_instance
288
+
289
+ def endingSignalLaw {d m : ℕ} {U V : Type*}
290
+ [MeasurableSpace U] [MeasurableSpace V]
291
+ (P : Measure (Sphere d × U))
292
+ (κ : Kernel (U × (Rows m d × (Fin m → ℝ))) V) : Measure (Sphere d × V) :=
293
+ (blockLaw P κ).map (fun z => (z.1.1.1, z.2))
294
+
295
+ instance endingSignalLaw_probability {d m : ℕ} {U V : Type*}
296
+ [MeasurableSpace U] [MeasurableSpace V]
297
+ (P : Measure (Sphere d × U)) [IsProbabilityMeasure P]
298
+ (κ : Kernel (U × (Rows m d × (Fin m → ℝ))) V) [IsMarkovKernel κ] :
299
+ IsProbabilityMeasure (endingSignalLaw P κ) := by
300
+ unfold endingSignalLaw
301
+ infer_instance
302
+
303
+ def freshInformation {d : ℕ} {U : Type*} [MeasurableSpace U] [StandardBorelSpace U]
304
+ (P : Measure (Sphere d × U)) [IsFiniteMeasure P] (k : ℕ) : ℝ≥0∞ :=
305
+ exposedInformation (P.prod (gaussianRows k d))
306
+
307
+ def hybridFirst (d : ℕ) : ℕ := (d+3)/4
308
+
309
+ def hybridLast (d : ℕ) : ℕ := d/2
310
+
311
+ def hybridCount (d : ℕ) : ℕ := hybridLast d - hybridFirst d + 1
312
+
313
+ def averagedFreshInformation {d : ℕ} {U : Type*}
314
+ [MeasurableSpace U] [StandardBorelSpace U]
315
+ (P : Measure (Sphere d × U)) [IsFiniteMeasure P] : ℝ :=
316
+ (∑ k ∈ Finset.Icc (hybridFirst d) (hybridLast d), (freshInformation P k).toReal) /
317
+ hybridCount d
318
+
319
+ def HybridBlockMain : Prop :=
320
+ ∃ (C C' : ℝ) (d₀ : ℕ), 0 < C ∧ 0 < C' ∧ ∀ d, d₀ ≤ d →
321
+ ∀ m, 1 ≤ m → m ≤ d/8 →
322
+ ∀ (U V : Type) [Fintype U] [Fintype V]
323
+ [MeasurableSpace U] [MeasurableSpace V]
324
+ [MeasurableSingletonClass U] [MeasurableSingletonClass V],
325
+ ∀ (P : Measure (Sphere d × U)) [IsProbabilityMeasure P],
326
+ P.fst = uniformSphere d →
327
+ ∀ (κ : Kernel (U × (Rows m d × (Fin m → ℝ))) V) [IsMarkovKernel κ],
328
+ ∀ (B : ℝ), 0 ≤ B →
329
+ shannonEntropy (endingSignalLaw P κ).snd ≤ ENNReal.ofReal B →
330
+ averagedFreshInformation (endingSignalLaw P κ) - averagedFreshInformation P ≤
331
+ C*m + (m:ℝ) / hybridCount d * (C + B / (d/8:ℕ)) + B / (d/32:ℕ) ∧
332
+ (B ≤ (d:ℝ)^2 →
333
+ averagedFreshInformation (endingSignalLaw P κ) - averagedFreshInformation P ≤ C'*d)
334
+
335
+ def FiberBlockMain : Prop :=
336
+ ∃ (K : ℝ) (d₀ : ℕ), 0 < K ∧ ∀ d, d₀ ≤ d →
337
+ ∀ (U V : Type) [Fintype U] [Fintype V]
338
+ [MeasurableSpace U] [MeasurableSpace V]
339
+ [MeasurableSingletonClass U] [MeasurableSingletonClass V],
340
+ ∀ (P : Measure (Sphere d×U)) [IsProbabilityMeasure P],
341
+ P.fst = uniformSphere d →
342
+ ∀ (κ : Kernel (U×(Rows (d/10) d×(Fin (d/10)→ℝ))) V) [IsMarkovKernel κ],
343
+ ∀ N : ℕ, 1 ≤ N → Fintype.card V ≤ N → Real.log N ≤ (d:ℝ)^2 →
344
+ freshInformation (endingSignalLaw P κ) (d/3) ≤ freshInformation P (d/3) + ENNReal.ofReal (K*d)
345
+
346
+ def dependentMapKernel {A B D : Type*} [MeasurableSpace A] [MeasurableSpace B]
347
+ [MeasurableSpace D] (κ : Kernel A B) (f : A×B → D) : Kernel A D :=
348
+ (Kernel.id ×ₖ κ).map f
349
+
350
+ def fiberObservationLaw (d k : ℕ) : Measure ((Rows k d×(Fin k→ℝ))×Sphere d) :=
351
+ ((gaussianRows k d).prod (uniformSphere d)).map
352
+ (fun z => ((z.1,label z.1 (z.2:Vector d)),z.2))
353
+
354
+ instance uniformSphere_finite (d : ℕ) : IsFiniteMeasure (uniformSphere d) := by
355
+ constructor
356
+ unfold uniformSphere
357
+ rw [Measure.smul_apply, smul_eq_mul]
358
+ exact lt_of_le_of_lt (ENNReal.inv_mul_le_one _) ENNReal.one_lt_top
359
+
360
+ instance fiberObservationLaw_finite (d k : ℕ) : IsFiniteMeasure (fiberObservationLaw d k) := by
361
+ unfold fiberObservationLaw
362
+ infer_instance
363
+
364
+ lemma sphere_standardBorel (d : ℕ) : StandardBorelSpace (Sphere d) :=
365
+ Metric.isClosed_sphere.measurableSet.standardBorel
366
+
367
+ def sphericalFiberKernel (d k : ℕ) [sphereNonempty : Nonempty (Sphere d)] :
368
+ Kernel (Rows k d×(Fin k→ℝ)) (Sphere d) :=
369
+ @Measure.condKernel (Rows k d×(Fin k→ℝ)) (Sphere d) _ _
370
+ (sphere_standardBorel d) sphereNonempty
371
+ (fiberObservationLaw d k) (fiberObservationLaw_finite d k)
372
+
373
+ instance sphericalFiberKernel_markov (d k : ℕ) [Nonempty (Sphere d)] :
374
+ IsMarkovKernel (sphericalFiberKernel d k) := by
375
+ unfold sphericalFiberKernel
376
+ infer_instance
377
+
378
+ def fiberTwoPointLeft (d k : ℕ) [Nonempty (Sphere d)] : Measure (Rows k d×(Sphere d×Sphere d)) :=
379
+ ((((gaussianRows k d).prod (uniformSphere d)).withDensity
380
+ (fun z => exactDensity (uniformSphere d) z.1 (label z.1 (z.2:Vector d)))) ⊗ₘ
381
+ ((sphericalFiberKernel d k).comap (fun z => (z.1,label z.1 (z.2:Vector d)))
382
+ (measurable_fst.prodMk measurable_own_label))).map
383
+ (fun z => (z.1.1,(z.1.2,z.2)))
384
+
385
+ def perpendicularRow {d : ℕ} (v g : Vector d) : Vector d :=
386
+ letI : NormedAddCommGroup (Vector d) := PiLp.normedAddCommGroup 2 (fun _ : Fin d => ℝ)
387
+ letI : InnerProductSpace ℝ (Vector d) := PiLp.innerProductSpace (fun _ : Fin d => ℝ)
388
+ g - (⟪v,g⟫ / ‖v‖^2) • v
389
+
390
+ def perpendicularRowsKernel (d k : ℕ) : Kernel (Sphere d×Sphere d) (Rows k d) :=
391
+ dependentMapKernel (Kernel.const (Sphere d×Sphere d) (gaussianRows k d))
392
+ (fun z => fun i => perpendicularRow ((z.1.1:Vector d)-(z.1.2:Vector d)) (z.2 i))
393
+
394
+ def fiberTwoPointConstant (k : ℕ) : ℝ≥0∞ :=
395
+ letI : OfNat ℝ 2 := @instOfNatAtLeastTwo ℝ 2 Real.instNatCast inferInstance
396
+ letI : Mul ℝ := Real.instMul
397
+ letI : Inv ℝ := Real.instInv
398
+ letI : Pow ℝ ℕ := @NPow.toPow ℝ Real.instMonoid.toNPow
399
+ ENNReal.ofReal ((Real.sqrt (2*Real.pi))⁻¹ ^ k)
400
+
401
+ def fiberDistanceWeight {d : ℕ} (k : ℕ) (z : Sphere d×Sphere d) : ℝ≥0∞ :=
402
+ (ENNReal.ofReal ‖(z.1:Vector d)-(z.2:Vector d)‖)⁻¹ ^ k
403
+
404
+ def fiberTwoPointRight (d k : ℕ) : Measure (Rows k d×(Sphere d×Sphere d)) :=
405
+ letI : IsScalarTower ℝ≥0∞ ℝ≥0∞ ℝ≥0∞ := Semigroup.isScalarTower
406
+ fiberTwoPointConstant k •
407
+ Measure.map (Prod.swap : (Sphere d×Sphere d)×Rows k d → Rows k d×(Sphere d×Sphere d))
408
+ (Measure.compProd
409
+ (Measure.withDensity (Measure.prod (uniformSphere d) (uniformSphere d))
410
+ (fiberDistanceWeight k))
411
+ (perpendicularRowsKernel d k))
412
+
413
+ lemma uniformSphere_probability_of_pos {d : ℕ} (hd : 0 < d) :
414
+ IsProbabilityMeasure (uniformSphere d) := by
415
+ let : Nonempty (Fin d) := ⟨⟨0, hd⟩⟩
416
+ constructor
417
+ rw [uniformSphere, Measure.smul_apply, smul_eq_mul]
418
+ apply ENNReal.inv_mul_cancel _ (measure_ne_top _ _)
419
+ rw [Measure.toSphere_apply_univ]
420
+ exact mul_ne_zero
421
+ (by exact_mod_cast (Module.finrank_pos (R := ℝ) (M := Vector d)).ne')
422
+ (Metric.measure_ball_pos volume 0 zero_lt_one).ne'
423
+
424
+
425
+ def FiberTwoPointMain : Prop :=
426
+ ∀ (d k : ℕ) (_hk : 1 ≤ k) (hkd : k < d-1),
427
+ letI : IsProbabilityMeasure (uniformSphere d) :=
428
+ uniformSphere_probability_of_pos (by omega)
429
+ letI : Nonempty (Sphere d) := nonempty_of_isProbabilityMeasure (uniformSphere d)
430
+ IsFiniteMeasure (fiberTwoPointLeft d k) ∧ IsFiniteMeasure (fiberTwoPointRight d k) ∧
431
+ fiberTwoPointLeft d k = fiberTwoPointRight d k
432
+
433
+ theorem mixedMomentMain : MixedMomentMain := by
434
+ sorry
435
+
436
+ theorem actualRowMain {d m r q : ℕ} {W : Type*} [MeasurableSpace W]
437
+ [Countable W] [MeasurableSingletonClass W]
438
+ (hdim : AdmissibleDimensions d m r q)
439
+ (P : Measure ((Sphere d×W)×Rows m d)) [IsProbabilityMeasure P]
440
+ (ν : Measure (Sphere d)) [IsProbabilityMeasure ν]
441
+ (hInd : (P.map swapLast).fst = ν.prod (gaussianRows m d))
442
+ (H : ℝ) (hν : ν ≤ ENNReal.ofReal H • uniformSphere d)
443
+ (hEntropy : shannonEntropy (P.map swapLast).snd ≠ ∞)
444
+ (ρ : PositiveMessage (P.map swapLast).snd → Measure (Sphere d))
445
+ [∀ w, IsFiniteMeasure (ρ w)]
446
+ (_hρac : ∀ w, ρ w ≪ uniformSphere d)
447
+ (B D : PositiveMessage (P.map swapLast).snd → ℝ)
448
+ (hB : ∀ w, 0 < B w) (hD : ∀ w, 0 < D w)
449
+ (hgB : ∀ w, LocalGrowth (ρ w) (m+r) (B w))
450
+ (hgD : ∀ w, LocalGrowth (ρ w) (d-1) (D w))
451
+ (hCI : Integrable (fun sw : Sphere d×W => Real.log (1+momentBound 9 d
452
+ (completeFamily (P.map swapLast).snd B 1 sw.2) (completeFamily (P.map swapLast).snd D 1 sw.2))) P.fst) :
453
+ ActualRowConclusion (r:=r) (q:=q) P (completeFamily (P.map swapLast).snd ρ 0)
454
+ (completeFamily (P.map swapLast).snd B 1) (completeFamily (P.map swapLast).snd D 1) := by
455
+ sorry
456
+
457
+ theorem actualRowRefinement {d m : ℕ} {W E : Type*} [MeasurableSpace W]
458
+ [MeasurableSpace E] [Countable W] [MeasurableSingletonClass W]
459
+ [Countable E] [MeasurableSingletonClass E]
460
+ (P : Measure ((Sphere d×W)×Rows m d)) [IsProbabilityMeasure P]
461
+ (e : Sphere d×W → E) (he : Measurable e)
462
+ (_hEntropy : shannonEntropy
463
+ ((P.map (fun p => ((p.1.1,(p.1.2,e p.1)),p.2))).map swapLast).snd ≠ ∞) :
464
+ rowInformation (P.map (fun p => ((p.1.1,(p.1.2,e p.1)),p.2))) (gaussianRows m d) =
465
+ rowInformation P (gaussianRows m d) := by
466
+ sorry
467
+
468
+ theorem actualRowSourceMain {d m r q : ℕ} {W : Type*} [MeasurableSpace W]
469
+ [Countable W] [MeasurableSingletonClass W]
470
+ (hdim : AdmissibleDimensions d m r q)
471
+ (P : Measure ((Sphere d×W)×Rows m d)) [IsProbabilityMeasure P]
472
+ (ν : Measure (Sphere d)) [IsProbabilityMeasure ν]
473
+ (hInd : (P.map swapLast).fst = ν.prod (gaussianRows m d))
474
+ (H : ℝ) (hν : ν ≤ ENNReal.ofReal H • uniformSphere d)
475
+ (hEntropy : shannonEntropy (P.map swapLast).snd ≠ ∞)
476
+ (ρ : PositiveMessage (P.map swapLast).snd → Measure (Sphere d))
477
+ [∀ w, IsFiniteMeasure (ρ w)]
478
+ (_hρac : ∀ w, ρ w ≪ uniformSphere d)
479
+ (B D : PositiveMessage (P.map swapLast).snd → ℝ)
480
+ (hB : ∀ w, 0 < B w) (hD : ∀ w, 0 < D w)
481
+ (hgB : ∀ w, LocalGrowth (ρ w) (m+r) (B w))
482
+ (hgD : ∀ w, LocalGrowth (ρ w) (d-1) (D w))
483
+ (hCI : Integrable (fun sw : Sphere d×W => Real.log (1+momentBound 9 d
484
+ (completeFamily (P.map swapLast).snd B 1 sw.2) (completeFamily (P.map swapLast).snd D 1 sw.2))) P.fst) :
485
+ ActualRowSourceConclusion (r:=r) (q:=q) P (completeFamily (P.map swapLast).snd ρ 0)
486
+ (completeFamily (P.map swapLast).snd B 1) (completeFamily (P.map swapLast).snd D 1) := by
487
+ sorry
488
+
489
+ theorem actualRowSourceRefinement {d m : ℕ} {W E : Type*} [MeasurableSpace W]
490
+ [MeasurableSpace E] [Countable W] [MeasurableSingletonClass W]
491
+ [Countable E] [MeasurableSingletonClass E]
492
+ (P : Measure ((Sphere d×W)×Rows m d)) [IsProbabilityMeasure P]
493
+ (ν : Measure (Sphere d)) [IsProbabilityMeasure ν]
494
+ (hInd : (P.map swapLast).fst = ν.prod (gaussianRows m d))
495
+ (e : Sphere d×W → E) (he : Measurable e)
496
+ (hEntropy : shannonEntropy
497
+ ((P.map (fun p => ((p.1.1,(p.1.2,e p.1)),p.2))).map swapLast).snd ≠ ∞) :
498
+ actualConditionalRowInformation (P.map (fun p => ((p.1.1,(p.1.2,e p.1)),p.2))) =
499
+ actualConditionalRowInformation P := by
500
+ sorry
501
+
502
+ theorem criticalComparisonMain : CriticalComparisonMain := by
503
+ sorry
504
+
505
+ theorem oneLevelComparisonMain : OneLevelComparisonMain := by
506
+ sorry
507
+
508
+ theorem twoLabelComparisonMain : TwoLabelComparisonMain := by
509
+ sorry
510
+
511
+ theorem hybridBlockMain : HybridBlockMain := by
512
+ sorry
513
+
514
+ theorem fiberTwoPointMain : FiberTwoPointMain := by
515
+ sorry
516
+
517
+ theorem fiberBlockMain : FiberBlockMain := by
518
+ sorry
519
+
520
+ end CurrentProjection
521
+
522
+ end
523
+
524
+ end OAI
lean/ComparatorChallenges/GeneralMahler.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "challenge_module": "ComparatorChallenges.GeneralMahler",
3
+ "solution_module": "OAI.Geometry.Convex.GeneralMahler.Theorem",
4
+ "theorem_names": [
5
+ "OAI.GeneralMahler.general_mahler"
6
+ ],
7
+ "definition_names": [],
8
+ "permitted_axioms": [
9
+ "propext",
10
+ "Quot.sound",
11
+ "Classical.choice"
12
+ ],
13
+ "enable_nanoda": false
14
+ }