diff --git a/lean/ComparatorChallenges/ExactInfiniteness.lean b/lean/ComparatorChallenges/ExactInfiniteness.lean new file mode 100644 index 0000000000000000000000000000000000000000..120a81f42019fbc086d9f87745be55952c81fe69 --- /dev/null +++ b/lean/ComparatorChallenges/ExactInfiniteness.lean @@ -0,0 +1,179 @@ +import Mathlib + +namespace OAI + +noncomputable section +universe u v +open scoped TensorProduct ENNReal ComplexOrder +open UniformSpace +namespace WeakPureInfiniteness + +section CompletedOperators + +variable {domain codomain : Type*} + [NormedAddCommGroup domain] [NormedSpace ℂ domain] + [NormedAddCommGroup codomain] [NormedSpace ℂ codomain] + +lemma norm_completion_le (operator : domain →L[ℂ] codomain) : + ‖operator.completion‖ ≤ ‖operator‖ := by + apply ContinuousLinearMap.opNorm_le_bound _ (norm_nonneg operator) + intro vector + induction vector using Completion.induction_on with + | hp => exact isClosed_le (by fun_prop) (by fun_prop) + | ih vector => simpa using operator.le_opNorm vector + +lemma norm_completion (operator : domain →L[ℂ] codomain) : + ‖operator.completion‖ = ‖operator‖ := by + apply le_antisymm (norm_completion_le operator) + apply ContinuousLinearMap.opNorm_le_bound _ (norm_nonneg _) + intro vector + simpa using operator.completion.le_opNorm (vector : Completion domain) + +end CompletedOperators + +structure ComplexHilbert where + Carrier : Type u + [normedAddCommGroup : NormedAddCommGroup Carrier] + [innerProductSpace : InnerProductSpace ℂ Carrier] + [completeSpace : CompleteSpace Carrier] + +attribute [instance] ComplexHilbert.normedAddCommGroup + ComplexHilbert.innerProductSpace ComplexHilbert.completeSpace +instance : CoeSort ComplexHilbert.{u} (Type u) := ⟨ComplexHilbert.Carrier⟩ + +instance completedTensorCStar (H K : ComplexHilbert.{u}) : + CStarAlgebra (Completion (H ⊗[ℂ] K) →L[ℂ] Completion (H ⊗[ℂ] K)) := inferInstance + +instance hilbertOperatorsCStar (H : ComplexHilbert.{u}) : + CStarAlgebra (H →L[ℂ] H) := inferInstance + +structure SpatialRepresentation (A : Type u) (B : Type v) + [NonUnitalCStarAlgebra A] [NonUnitalCStarAlgebra B] where + left : ComplexHilbert.{max u v} + right : ComplexHilbert.{max u v} + leftRep : A →⋆ₙₐ[ℂ] (left →L[ℂ] left) + rightRep : B →⋆ₙₐ[ℂ] (right →L[ℂ] right) + +abbrev SpatialRepresentation.hilbert {A : Type u} {B : Type v} + [NonUnitalCStarAlgebra A] [NonUnitalCStarAlgebra B] + (π : SpatialRepresentation A B) : ComplexHilbert.{max u v} where + Carrier := Completion (π.left ⊗[ℂ] π.right) + +abbrev SpatialRepresentation.space {A : Type u} {B : Type v} + [NonUnitalCStarAlgebra A] [NonUnitalCStarAlgebra B] + (π : SpatialRepresentation A B) := Completion (π.left ⊗[ℂ] π.right) + +def SpatialAmbient (A : Type u) (B : Type v) + [NonUnitalCStarAlgebra A] [NonUnitalCStarAlgebra B] : Type (max u v + 1) := + lp (fun π : SpatialRepresentation A B => π.space →L[ℂ] π.space) ∞ + +instance spatialAmbientCStar (A : Type u) (B : Type v) + [NonUnitalCStarAlgebra A] [NonUnitalCStarAlgebra B] : + NonUnitalCStarAlgebra (SpatialAmbient A B) := by + unfold SpatialAmbient + infer_instance + +instance spatialAmbientCoeFun (A : Type u) (B : Type v) + [NonUnitalCStarAlgebra A] [NonUnitalCStarAlgebra B] : + CoeFun (SpatialAmbient A B) (fun _ => ∀ π : SpatialRepresentation A B, π.space →L[ℂ] π.space) := + ⟨fun z => z.val⟩ + +def spatialElementary {A : Type u} {B : Type v} + [NonUnitalCStarAlgebra A] [NonUnitalCStarAlgebra B] + (a : A) (b : B) : SpatialAmbient A B := + ⟨fun π => (TensorProduct.mapL (π.leftRep a) (π.rightRep b)).completion, + memℓp_infty ⟨‖a‖ * ‖b‖, by + rintro _ ⟨π, rfl⟩ + dsimp only + rw [norm_completion] + exact (TensorProduct.norm_mapL_le _ _).trans + (mul_le_mul (NonUnitalStarAlgHom.norm_apply_le π.leftRep a) (NonUnitalStarAlgHom.norm_apply_le π.rightRep b) + (norm_nonneg _) (norm_nonneg _))⟩⟩ + +def minimalTensorSubalgebra (A : Type u) (B : Type v) + [NonUnitalCStarAlgebra A] [NonUnitalCStarAlgebra B] : + NonUnitalStarSubalgebra ℂ (SpatialAmbient A B) := + (NonUnitalStarAlgebra.adjoin ℂ (Set.range fun p : A × B => spatialElementary p.1 p.2)).topologicalClosure + +abbrev MinimalTensor (A : Type u) (B : Type v) + [NonUnitalCStarAlgebra A] [NonUnitalCStarAlgebra B] := minimalTensorSubalgebra A B + +instance (A : Type u) (B : Type v) [NonUnitalCStarAlgebra A] [NonUnitalCStarAlgebra B] : + NonUnitalCStarAlgebra (MinimalTensor A B) := by + letI : IsClosed ((minimalTensorSubalgebra A B : NonUnitalStarSubalgebra ℂ + (SpatialAmbient A B)) : Set (SpatialAmbient A B)) := + isClosed_closure + exact inferInstance + +section Exactness + +variable {A : Type u} {C D : Type v} + [NonUnitalCStarAlgebra A] [NonUnitalCStarAlgebra C] [NonUnitalCStarAlgebra D] + +def SpatialRepresentation.precompRight (π : SpatialRepresentation A D) + (q : C →⋆ₙₐ[ℂ] D) : SpatialRepresentation A C where + left := π.left + right := π.right + leftRep := π.leftRep + rightRep := π.rightRep.comp q + +def tensorKernelIdeal (q : C →⋆ₙₐ[ℂ] D) : NonUnitalStarSubalgebra ℂ (SpatialAmbient A C) := + (NonUnitalStarAlgebra.adjoin ℂ + {z | ∃ a : A, ∃ c : C, q c = 0 ∧ z = spatialElementary a c}).topologicalClosure + +end Exactness + +def Exact (A : Type u) [NonUnitalCStarAlgebra A] : Prop := + ∀ (C D : Type u) [NonUnitalCStarAlgebra C] [NonUnitalCStarAlgebra D] + (q : C →⋆ₙₐ[ℂ] D), Function.Surjective q → + ∀ z : MinimalTensor A C, + (∀ π : SpatialRepresentation A D, (z.val : SpatialAmbient A C) (π.precompRight q) = 0) → + z.val ∈ tensorKernelIdeal (A := A) q + +section Definitions + +variable {A : Type*} [NonUnitalCStarAlgebra A] [PartialOrder A] [StarOrderedRing A] +variable {m k : Type*} [Fintype m] [Fintype k] + +def CuntzSubequiv (a : CStarMatrix m m A) (b : CStarMatrix k k A) : Prop := + ∀ ε : ℝ, 0 < ε → ∃ v : CStarMatrix k m A, ‖v.conjTranspose * b * v - a‖ < ε + +def blockSum (a : CStarMatrix m m A) (b : CStarMatrix k k A) : + CStarMatrix (m ⊕ k) (m ⊕ k) A := + CStarMatrix.ofMatrix (Matrix.fromBlocks (CStarMatrix.ofMatrix.symm a) 0 0 + (CStarMatrix.ofMatrix.symm b)) + +def ProperlyInfinite (a : CStarMatrix m m A) : Prop := + CuntzSubequiv (blockSum a a) a + +def diagonalCopies (n : ℕ) (a : A) : CStarMatrix (Fin n) (Fin n) A := + CStarMatrix.ofMatrix (Matrix.diagonal fun _ => a) + +variable (A) + +def WeaklyPurelyInfinite : Prop := + ∃ n : ℕ, 1 ≤ n ∧ ∀ a : A, 0 ≤ a → a ≠ 0 → ProperlyInfinite (diagonalCopies n a) + +def StronglyPurelyInfinite : Prop := + ∀ a b : A, 0 ≤ a → 0 ≤ b → ∀ ε : ℝ, 0 < ε → + ∃ s t : A, ‖star s * (a * a) * s - a * a‖ < ε ∧ + ‖star t * (b * b) * t - b * b‖ < ε ∧ ‖star s * a * b * t‖ < ε + +end Definitions + +theorem exact_weaklyPurelyInfinite_individuallyProperlyInfinite_any + {A : Type u} [NonUnitalCStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + (hA : Exact A) (hW : WeaklyPurelyInfinite A) {a : A} (ha : 0 ≤ a) : + ProperlyInfinite (diagonalCopies 1 a) := by + sorry + +theorem exact_weaklyPurelyInfinite_stronglyPurelyInfinite + (A : Type u) [NonUnitalCStarAlgebra A] [PartialOrder A] [StarOrderedRing A] + (hExact : Exact A) (hWeak : WeaklyPurelyInfinite A) : StronglyPurelyInfinite A := by + sorry + +end WeakPureInfiniteness + +end + +end OAI diff --git a/lean/ComparatorChallenges/ExactQuantumFactoring.json b/lean/ComparatorChallenges/ExactQuantumFactoring.json new file mode 100644 index 0000000000000000000000000000000000000000..6bd87d1506dbeec72589c9bd7e4ee7b2e792b4a6 --- /dev/null +++ b/lean/ComparatorChallenges/ExactQuantumFactoring.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.ExactQuantumFactoring", + "solution_module": "OAI.Computability.QuantumFactoring.Main", + "theorem_names": [ + "OAI.ExactQuantumFactoring.exact_quantum_factoring" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/ExactQuantumFactoring.lean b/lean/ComparatorChallenges/ExactQuantumFactoring.lean new file mode 100644 index 0000000000000000000000000000000000000000..2072f20cb47134ae2fd8eb213a9c2146e1c02ae4 --- /dev/null +++ b/lean/ComparatorChallenges/ExactQuantumFactoring.lean @@ -0,0 +1,154 @@ +import Mathlib + +namespace OAI + + + +namespace ExactQuantumFactoring + +open scoped BigOperators + +/-- The five primitive gates exactly as in Section 2. -/ +inductive Primitive where + | not | cnot | toffoli | hadamard | phase + deriving DecidableEq + +def Primitive.arity : Primitive → ℕ + | .not | .hadamard | .phase => 1 + | .cnot => 2 + | .toffoli => 3 + +def Primitive.code : Primitive → ℕ + | .not => 0 | .cnot => 1 | .toffoli => 2 | .hadamard => 3 | .phase => 4 + +/-- An inverse and/or one added control. This is a fixed set of 20 gate names, +not an unbounded-control or arbitrary-angle gate model. -/ +structure Gate where + primitive : Primitive + inverse : Bool + controlled : Bool + deriving DecidableEq + +def Gate.arity (g : Gate) : ℕ := g.primitive.arity + if g.controlled then 1 else 0 + +/-- Matrix entries are indexed by lists in wire order (row first, column second). +Entries on ill-sized lists are irrelevant and set to zero. -/ +noncomputable def Primitive.matrix : Primitive → List Bool → List Bool → ℂ + | .not, [a], [b] => if a = !b then 1 else 0 + | .cnot, [a,b], [c,d] => if a = c ∧ b = Bool.xor c d then 1 else 0 + | .toffoli, [a,b,c], [d,e,f] => + if a = d ∧ b = e ∧ c = Bool.xor f (d && e) then 1 else 0 + | .hadamard, [a], [b] => + (if a && b then -1 else 1) / (Real.sqrt 2 : ℂ) + | .phase, [a], [b] => if a = b then (if b then Complex.I else 1) else 0 + | _, _, _ => 0 + +noncomputable def Gate.baseMatrix (g : Gate) (a b : List Bool) : ℂ := + if g.inverse then star (g.primitive.matrix b a) else g.primitive.matrix a b + +noncomputable def Gate.matrix (g : Gate) (a b : List Bool) : ℂ := + if g.controlled then + match a, b with + | false :: a', false :: b' => if a' = b' then 1 else 0 + | true :: a', true :: b' => g.baseMatrix a' b' + | _, _ => 0 + else g.baseMatrix a b + +/-- A primitive is placed on distinct actual wires, with no operation of +unbounded arity hidden in a circuit instruction. -/ +structure Instruction (q : ℕ) where + gate : Gate + wire : Fin gate.arity → Fin q + distinct : Function.Injective wire + +abbrev Basis (q : ℕ) := Fin q → Bool +abbrev State (q : ℕ) := Basis q → ℂ + +noncomputable def Instruction.matrix {q : ℕ} (o : Instruction q) : + Matrix (Basis q) (Basis q) ℂ := by + classical + exact fun a b => + if ∀ i : Fin q, (∀ j, o.wire j ≠ i) → a i = b i then + o.gate.matrix (List.ofFn (a ∘ o.wire)) (List.ofFn (b ∘ o.wire)) + else 0 + +structure Circuit where + qubits : ℕ + instructions : List (Instruction qubits) + +noncomputable def Circuit.apply (c : Circuit) (ψ : State c.qubits) : State c.qubits := + c.instructions.foldl (fun v o => o.matrix.mulVec v) ψ + +/-- Input wires are first, least significant bit first; all other wires start zero. -/ +def inputBasis (q ℓ N : ℕ) : Basis q := + fun i => if i.val < ℓ then N.testBit i.val else false + +noncomputable def Circuit.outputState (c : Circuit) (ℓ N : ℕ) : State c.qubits := by + classical + exact c.apply (fun x => if x = inputBasis c.qubits ℓ N then 1 else 0) + +/-- The cutoff and padding are the standing parameters in Section 2. -/ +def paddedLength (ℓ : ℕ) : ℕ := max 128 ℓ + +def readBit {q : ℕ} (x : Basis q) (i : ℕ) : Bool := + if h : i < q then x ⟨i,h⟩ else false + +/-- n entries of n bits each, in the n² wires immediately after the input. -/ +def outputList {q : ℕ} (ℓ : ℕ) (x : Basis q) : List ℕ := + let n := paddedLength ℓ + List.ofFn (fun a : Fin n => + ∑ j ∈ Finset.range n, if readBit x (ℓ + a.val * n + j) then 2^j else 0) + +/-- Complete nondecreasing prime factorization, multiplicities included, +padded by zeros, as in Section 6. There is no primality oracle in the circuit. -/ +def CorrectEncoding (N n : ℕ) (xs : List ℕ) : Prop := + ∃ ps : List ℕ, (∀ p ∈ ps, Nat.Prime p) ∧ ps.Pairwise (· ≤ ·) ∧ + ps.prod = N ∧ ps.length ≤ n ∧ xs = ps ++ List.replicate (n - ps.length) 0 + +/-- Unnormalized Born sum on correct outputs; success is exactly one, +not positivity, postselection, or a limiting high probability. -/ +noncomputable def Circuit.correctProbability (c : Circuit) (ℓ N : ℕ) : ℝ := by + classical + exact ∑ x : Basis c.qubits, + if CorrectEncoding N (paddedLength ℓ) (outputList ℓ x) then + Complex.normSq (c.outputState ℓ N x) else 0 + +/-- Unary natural words with delimiters make the circuit description explicit. +Unary wire addresses cause at most polynomial overhead when width is polynomial. -/ +def natWord (k : ℕ) : List Bool := List.replicate k true ++ [false] + +def Instruction.encode {q : ℕ} (o : Instruction q) : List Bool := + natWord o.gate.primitive.code ++ [o.gate.inverse, o.gate.controlled] ++ + (List.ofFn (fun i => o.wire i |>.val)).flatMap natWord + +def Circuit.encode (c : Circuit) : List Bool := + natWord c.qubits ++ natWord c.instructions.length ++ + c.instructions.flatMap Instruction.encode + +/-- A single finite-alphabet classical generator receives only the INPUT LENGTH. +All stack alphabets, states and labels are finite: no large-integer unit-cost +oracle is hidden in TM2 push/branch functions. -/ +def Uniform (family : ℕ → Circuit) : Prop := + ∃ generator : Turing.TM2ComputableInPolyTime + (fun ℓ => List.replicate ℓ true) Circuit.encode family, + ∀ k, Finite (generator.tm.Γ k) + +def PolynomialResources (family : ℕ → Circuit) : Prop := + ∃ bound : Polynomial ℕ, ∀ ℓ, + (family ℓ).qubits ≤ bound.eval ℓ ∧ + (family ℓ).instructions.length ≤ bound.eval ℓ + +/-- Literal main endpoint: one length-uniform family, exact output for EVERY +binary integer N≥2, and worst-case polynomial gates AND qubits. -/ +def MainTheorem : Prop := + ∃ family : ℕ → Circuit, Uniform family ∧ PolynomialResources family ∧ + ∀ (ℓ N : ℕ), 2 ≤ N → N.size = ℓ → + ℓ + (paddedLength ℓ)^2 ≤ (family ℓ).qubits ∧ + (family ℓ).correctProbability ℓ N = 1 + +theorem exact_quantum_factoring : MainTheorem := by + sorry + +end ExactQuantumFactoring + +end OAI diff --git a/lean/ComparatorChallenges/FKCRT.json b/lean/ComparatorChallenges/FKCRT.json new file mode 100644 index 0000000000000000000000000000000000000000..0a71a9a3b1dafb132b322be22be4c4982fd698cf --- /dev/null +++ b/lean/ComparatorChallenges/FKCRT.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.FKCRT", + "solution_module": "OAI.Probability.FKMaps.Convergence", + "theorem_names": [ + "OAI.FKCRT.finite_fk_maps_converge_to_brownian_crt" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/FKCRT.lean b/lean/ComparatorChallenges/FKCRT.lean new file mode 100644 index 0000000000000000000000000000000000000000..6de8bdf8338daf8b10380195a55011dd7278e7e3 --- /dev/null +++ b/lean/ComparatorChallenges/FKCRT.lean @@ -0,0 +1,214 @@ +import Mathlib + +namespace OAI + +/-! +Finite Fortuin–Kasteleyn maps and the Brownian continuum random tree. + +All combinatorial maps below have a distinguished dart 0 and are quotiented +by orientation-preserving dart relabellings fixing that dart. A rotation system +with Euler characteristic 2 encodes precisely a connected oriented-sphere map. +No simplicity restriction is imposed. Vertices and edges are rotation and +edge-reversal orbits, respectively. Every edge subset is included in the law. +The index n here represents source size n+1, so the limit is through ALL +positive edge sizes, not a subsequence. + +MetricMeasureData packages the actual distance, measurable space and measure, +without using arbitrary representatives of measure-preserving isometry classes +as a global typeclass. Valid objects are compact metric probability spaces. +The GHP extended distance is the infimum over common isometric embeddings, +represented by pseudometrics on the disjoint union; zero cross distances simply +identify points in the common ambient space. Tests are bounded functions +continuous for that distance on valid objects. Thus GHP convergence is written +in its bounded-continuous-test (weak distributional convergence) definition. + +A standard normalized Brownian excursion is represented in its standard +three-dimensional Bessel-bridge realization: the norm of three independent +standard Brownian bridges of duration 1. No rescaling of the excursion is used. +-/ + +noncomputable section +open Set Filter MeasureTheory ProbabilityTheory +open scoped Topology BigOperators ENNReal NNReal + +namespace FKCRT + +abbrev Dart (n : ℕ) := Fin (2 * (n + 1)) + +abbrev Orbit {n : ℕ} (s : Equiv.Perm (Dart n)) := + Quotient (Equiv.Perm.SameCycle.setoid s) + +def orbit {n : ℕ} (s : Equiv.Perm (Dart n)) (d : Dart n) : Orbit s := + Quotient.mk _ d + +instance {n : ℕ} (s : Equiv.Perm (Dart n)) : Fintype (Orbit s) := Fintype.ofFinite _ + +/-- The spanning graph with precisely the edges in A, with loops omitted only +from adjacency: they still exist as edge orbits, have FK weight, and contribute +two darts to the degree measure. Omitting loops does not change distance or k. -/ +def spanningGraph {n : ℕ} (a s : Equiv.Perm (Dart n)) (A : Set (Orbit a)) : + SimpleGraph (Orbit s) := + SimpleGraph.fromRel fun v w => + ∃ d : Dart n, orbit a d ∈ A ∧ orbit s d = v ∧ orbit s (a d) = w + +/-- Labelled connected orientable genus-zero rotation systems. -/ +def MapConditions {n : ℕ} (P : Equiv.Perm (Dart n) × Equiv.Perm (Dart n)) : Prop := + Function.Involutive P.1 ∧ (∀ d, P.1 d ≠ d) ∧ + (spanningGraph P.1 P.2 Set.univ).Connected ∧ + Nat.card (Orbit P.2) + Nat.card (Orbit (P.2 * P.1)) = n + 3 + +abbrev LabelledMap (n : ℕ) := + {P : Equiv.Perm (Dart n) × Equiv.Perm (Dart n) // MapConditions P} + +/-- Root-preserving isomorphism of oriented maps (both dart permutations intertwine). -/ +def MapIso {n : ℕ} (M N : LabelledMap n) : Prop := + ∃ r : Equiv.Perm (Dart n), r 0 = 0 ∧ + (∀ d, N.val.1 (r d) = r (M.val.1 d)) ∧ + (∀ d, N.val.2 (r d) = r (M.val.2 d)) + +abbrev RootedMap (n : ℕ) := Quotient (Relation.EqvGen.setoid (@MapIso n)) + +instance (n : ℕ) : Fintype (RootedMap n) := Fintype.ofFinite _ + +def reversal {n : ℕ} (M : RootedMap n) : Equiv.Perm (Dart n) := M.out.val.1 + +def rotation {n : ℕ} (M : RootedMap n) : Equiv.Perm (Dart n) := M.out.val.2 + +abbrev Vertex {n : ℕ} (M : RootedMap n) := Orbit (rotation M) +abbrev Edge {n : ℕ} (M : RootedMap n) := Orbit (reversal M) + +def graph {n : ℕ} (M : RootedMap n) (A : Set (Edge M)) : SimpleGraph (Vertex M) := + spanningGraph (reversal M) (rotation M) A + +/-- The source k_M(A), including isolated vertices. -/ +def clusterCount {n : ℕ} (M : RootedMap n) (A : Finset (Edge M)) : ℕ := + Nat.card (graph M (A : Set (Edge M))).ConnectedComponent + +/-- Exact decorated finite-map weight from eq:finite-law. -/ +def fkWeight {n : ℕ} (q : ℝ) (M : RootedMap n) (A : Finset (Edge M)) : ℝ := + Real.rpow q ((clusterCount M A : ℝ) + + ((A.card : ℝ) - (Nat.card (Vertex M) : ℝ)) / 2) + +def partition (q : ℝ) (n : ℕ) : ℝ := + ∑ M : RootedMap n, ∑ A : Finset (Edge M), fkWeight q M A + +/-- Unbundled presentation of a measured metric space; validity is specified below. -/ +structure MetricMeasureData where + Carrier : Type + distance : Carrier → Carrier → ℝ + measurableSpace : MeasurableSpace Carrier + mass : @Measure Carrier measurableSpace + +/-- Exactly compact metric probability spaces, with their Borel sigma algebras. -/ +def MetricMeasureData.Valid (X : MetricMeasureData) : Prop := + ∃ m : MetricSpace X.Carrier, + letI := m + (∀ x y, dist x y = X.distance x y) ∧ + CompactSpace X.Carrier ∧ X.measurableSpace = borel X.Carrier ∧ + X.mass Set.univ = 1 + +/-- Normalized degree measure is uniform dart mass pushed to vertices. -/ +def degreeMass {n : ℕ} (M : RootedMap n) : + @Measure (Vertex M) ⊤ := + letI : MeasurableSpace (Vertex M) := ⊤ + ∑ d : Dart n, ENNReal.ofReal (1 / (2 * (n + 1) : ℝ)) • + Measure.dirac (orbit (rotation M) d) + +/-- Root and decoration are not included in the metric probability space. -/ +def mapSpace {n : ℕ} (scale : ℝ) (M : RootedMap n) : MetricMeasureData where + Carrier := Vertex M + distance v w := scale * ((graph M Set.univ).dist v w : ℝ) + measurableSpace := ⊤ + mass := degreeMass M + +/-- An ambient pseudometric on the disjoint union giving isometric embeddings. -/ +def Amalgamates (X Y : MetricMeasureData) + (m : PseudoMetricSpace (X.Carrier ⊕ Y.Carrier)) : Prop := + letI := m + (∀ x x', dist (Sum.inl x : X.Carrier ⊕ Y.Carrier) (Sum.inl x') = X.distance x x') ∧ + (∀ y y', dist (Sum.inr y : X.Carrier ⊕ Y.Carrier) (Sum.inr y') = Y.distance y y') + +def ambientCost (X Y : MetricMeasureData) + (m : PseudoMetricSpace (X.Carrier ⊕ Y.Carrier)) : ℝ≥0∞ := + letI := m + letI : MeasurableSpace (X.Carrier ⊕ Y.Carrier) := borel _ + max (Metric.hausdorffEDist (Set.range (Sum.inl : X.Carrier → X.Carrier ⊕ Y.Carrier)) + (Set.range (Sum.inr : Y.Carrier → X.Carrier ⊕ Y.Carrier))) + (levyProkhorovEDist + (@Measure.map X.Carrier (X.Carrier ⊕ Y.Carrier) X.measurableSpace + (borel _) Sum.inl X.mass) + (@Measure.map Y.Carrier (X.Carrier ⊕ Y.Carrier) Y.measurableSpace + (borel _) Sum.inr Y.mass)) + +/-- The common-isometric-embedding definition of the source GHP distance. -/ +def ghpEDist (X Y : MetricMeasureData) : ℝ≥0∞ := + ⨅ m : {m : PseudoMetricSpace (X.Carrier ⊕ Y.Carrier) // Amalgamates X Y m}, + ambientCost X Y m.val + +/-- Bounded continuous tests on compact metric probability spaces modulo +measure-preserving isometry, expressed on presentations. -/ +def IsGHPTest (F : MetricMeasureData → ℝ) : Prop := + (∃ C : ℝ, ∀ X, |F X| ≤ C) ∧ + ∀ X, X.Valid → ∀ ε : ℝ, 0 < ε → ∃ δ : ℝ, 0 < δ ∧ + ∀ Y, Y.Valid → ghpEDist X Y < ENNReal.ofReal δ → |F Y - F X| < ε + +/-- Source excursion pseudometric, with the closed interval minimum. -/ +def excursionDist (e : unitInterval → ℝ) (s t : unitInterval) : ℝ := + e s + e t - 2 * sInf (e '' Set.uIcc s t) + +abbrev ExcursionTree (e : unitInterval → ℝ) := + Quotient (Relation.EqvGen.setoid (fun s t => excursionDist e s t = 0)) + +def treeProjection (e : unitInterval → ℝ) (t : unitInterval) : ExcursionTree e := + Quotient.mk _ t + +/-- The quotient by d_e=0, its induced metric, and pushforward of uniform time. +The equivalence closure is redundant for continuous e; the induced distance +is independent of representatives, as required by the pseudometric proof. -/ +def treeSpace (e : unitInterval → ℝ) : MetricMeasureData := + letI : TopologicalSpace (ExcursionTree e) := + TopologicalSpace.coinduced (treeProjection e) inferInstance + letI : MeasurableSpace (ExcursionTree e) := borel _ + { Carrier := ExcursionTree e + distance := fun x y => excursionDist e x.out y.out + measurableSpace := borel _ + mass := Measure.map (treeProjection e) (volume : Measure unitInterval) } + +/-- Standard normalized excursion, realized as the 3D Bessel bridge. -/ +def standardExcursion {Ω : Type} (B : Fin 3 → ℝ≥0 → Ω → ℝ) (ω : Ω) + (t : unitInterval) : ℝ := + Real.sqrt (∑ i : Fin 3, (B i ⟨(t : ℝ), t.property.1⟩ ω - + (t : ℝ) * B i 1 ω) ^ 2) + +/-- Exact expectation under the finite law, with n+1 edges. -/ +def finiteExpectation (q scale : ℝ) (n : ℕ) (F : MetricMeasureData → ℝ) : ℝ := + ∑ M : RootedMap n, ∑ A : Finset (Edge M), + (fkWeight q M A / partition q n) * F (mapSpace scale M) + +def brownianExpectation {Ω : Type} [MeasurableSpace Ω] (P : Measure Ω) + (B : Fin 3 → ℝ≥0 → Ω → ℝ) (F : MetricMeasureData → ℝ) : ℝ := + ∫ ω, F (treeSpace (standardExcursion B ω)) ∂P + +/-- thm:main. The quantifiers over Brownian realizations express that the limit +is the standard excursion-tree law, not a coupling-specific object. -/ +def MainStatement : Prop := + ∀ q : ℝ, 4 < q → ∃ c : ℝ, 0 < c ∧ + ∀ (Ω : Type) (mΩ : MeasurableSpace Ω) (P : @Measure Ω mΩ), + @IsProbabilityMeasure Ω mΩ P → + ∀ B : Fin 3 → ℝ≥0 → Ω → ℝ, + (∀ i, @IsBrownianReal Ω mΩ (B i) P) → + @iIndepFun Ω (Fin 3) mΩ (fun _ => ℝ≥0 → ℝ) (fun _ => inferInstance) + (fun i ω t => B i t ω) P → + ∀ F : MetricMeasureData → ℝ, IsGHPTest F → + Tendsto (fun n : ℕ => finiteExpectation q (c / Real.sqrt (n + 1)) n F) + atTop (𝓝 (@brownianExpectation Ω mΩ P B F)) + + +/-- Finite FK maps converge in GHP distribution to the standard Brownian CRT. -/ +theorem finite_fk_maps_converge_to_brownian_crt : MainStatement := by + sorry + +end FKCRT +end + +end OAI diff --git a/lean/ComparatorChallenges/FactorGeneration.json b/lean/ComparatorChallenges/FactorGeneration.json new file mode 100644 index 0000000000000000000000000000000000000000..61565541cc63e581fa5e0d14458616de519b9448 --- /dev/null +++ b/lean/ComparatorChallenges/FactorGeneration.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.FactorGeneration", + "solution_module": "OAI.Analysis.FactorGeneration.Main", + "theorem_names": [ + "OAI.Generator.single_generation_of_II1_separable_predual" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/FactorGeneration.lean b/lean/ComparatorChallenges/FactorGeneration.lean new file mode 100644 index 0000000000000000000000000000000000000000..a8b9d4d4b4fe8864fdec3053e0bca4b70e197f66 --- /dev/null +++ b/lean/ComparatorChallenges/FactorGeneration.lean @@ -0,0 +1,50 @@ +import Mathlib.Analysis.CStarAlgebra.ContinuousLinearMap +import Mathlib.Analysis.InnerProductSpace.WeakOperatorTopology +import Mathlib.Analysis.VonNeumannAlgebra.Basic + +namespace OAI + +noncomputable section + +namespace Generator + +universe u + +variable {H : Type u} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +attribute [-instance] instCStarAlgebraContinuousLinearMapComplexIdOfCompleteSpace + +def WOTClosed (S : StarSubalgebra ℂ (H →L[ℂ] H)) : Prop := + IsClosed {T : H →WOT[ℂ] H | T.toCLM ∈ S} + +def wstar (s : Set (H →L[ℂ] H)) : StarSubalgebra ℂ (H →L[ℂ] H) := + sInf {S | WOTClosed S ∧ s ⊆ S} + +structure IsII1Factor (S : StarSubalgebra ℂ (H →L[ℂ] H)) : Prop where + nonzero : (0 : H →L[ℂ] H) ≠ 1 + weaklyClosed : WOTClosed S + factor : ∀ x : S, (∀ y : S, y * x = x * y) → ∃ c : ℂ, x = algebraMap ℂ S c + finite : ∀ v : S, star v * v = 1 → v * star v = 1 + diffuse : ∀ p : S, IsStarProjection p → p ≠ 0 → + ∃ q : S, IsStarProjection q ∧ q ≠ 0 ∧ q ≠ p ∧ p * q = q ∧ q * p = q + +def HasSeparablePredual (S : StarSubalgebra ℂ (H →L[ℂ] H)) : Prop := + ∃ (X : Type u) (_ : NormedAddCommGroup X) (_ : NormedSpace ℂ X) + (_ : CompleteSpace X) (_ : TopologicalSpace.SeparableSpace X), + Nonempty (StrongDual ℂ X ≃ₗᵢ⋆[ℂ] S) + +def SinglyGenerated (S : StarSubalgebra ℂ (H →L[ℂ] H)) : Prop := + ∃ x ∈ S, wstar {x} = S + +attribute [instance] instCStarAlgebraContinuousLinearMapComplexIdOfCompleteSpace + +theorem single_generation_of_II1_separable_predual + (S : StarSubalgebra ℂ (H →L[ℂ] H)) (hS : IsII1Factor S) + (hsep : HasSeparablePredual S) : SinglyGenerated S := by + sorry + +end Generator + +end + +end OAI diff --git a/lean/ComparatorChallenges/FalconerAllDimensions.json b/lean/ComparatorChallenges/FalconerAllDimensions.json new file mode 100644 index 0000000000000000000000000000000000000000..c037204fe079389768f931ebd2542fe42adff452 --- /dev/null +++ b/lean/ComparatorChallenges/FalconerAllDimensions.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.FalconerAllDimensions", + "solution_module": "OAI.MeasureTheory.Falconer.Campaign123PlanarFurstenbergProof", + "theorem_names": [ + "OAI.Falconer.falconer_distance_conjecture" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/FalconerAllDimensions.lean b/lean/ComparatorChallenges/FalconerAllDimensions.lean new file mode 100644 index 0000000000000000000000000000000000000000..fe48d9e54579aa17007a3c83e639cf63f386ebc7 --- /dev/null +++ b/lean/ComparatorChallenges/FalconerAllDimensions.lean @@ -0,0 +1,19 @@ +import Mathlib + +namespace OAI + +namespace Falconer +open MeasureTheory +open scoped ENNReal + +/-- A compact subset of Euclidean space with Hausdorff dimension greater than +half the ambient dimension determines a distance set of positive Lebesgue measure. -/ +theorem falconer_distance_conjecture : + ∀ (d : ℕ), 2 ≤ d → ∀ E : Set (EuclideanSpace ℝ (Fin d)), IsCompact E → + (d : ℝ≥0∞) / 2 < dimH E → + 0 < volume {r : ℝ | ∃ x ∈ E, ∃ y ∈ E, dist x y = r} := by + sorry + +end Falconer + +end OAI diff --git a/lean/ComparatorChallenges/FillingCoefficient.json b/lean/ComparatorChallenges/FillingCoefficient.json new file mode 100644 index 0000000000000000000000000000000000000000..721ea423293d80349672a00d6537c26836688c00 --- /dev/null +++ b/lean/ComparatorChallenges/FillingCoefficient.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.FillingCoefficient", + "solution_module": "OAI.Geometry.IntegralFillings.Main", + "theorem_names": [ + "OAI.SharpIntegralFillings.coefficient_optimal" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Classical.choice", + "Quot.sound" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/FillingCoefficient.lean b/lean/ComparatorChallenges/FillingCoefficient.lean new file mode 100644 index 0000000000000000000000000000000000000000..8453c2497c1278e5224b3e08cfced6debe018829 --- /dev/null +++ b/lean/ComparatorChallenges/FillingCoefficient.lean @@ -0,0 +1,130 @@ +import Mathlib + +namespace OAI + +open Set Filter MeasureTheory +open scoped Topology ENNReal NNReal + +namespace SharpIntegralFillings + +attribute [local instance] Classical.propDecidable + +universe u + +abbrev Euc (k : ℕ) := EuclideanSpace ℝ (Fin k) +abbrev Functional (X : Type u) (k : ℕ) := (X → ℝ) → (Fin k → X → ℝ) → ℝ + +section MetricCurrents + +variable {X : Type u} [MetricSpace X] [MeasurableSpace X] [BorelSpace X] + +def BoundedLip (b : X → ℝ) : Prop := + (∃ K : ℝ≥0, LipschitzWith K b) ∧ ∃ M : ℝ, ∀ x, |b x| ≤ M + +def Admissible {k : ℕ} (b : X → ℝ) (π : Fin k → X → ℝ) : Prop := + BoundedLip b ∧ ∀ i, ∃ K : ℝ≥0, LipschitzWith K (π i) + +def Controls {k : ℕ} (T : Functional X k) (μ : Measure X) : Prop := + ∀ (b : X → ℝ) (π : Fin k → X → ℝ), BoundedLip b → + (∀ i, LipschitzWith 1 (π i)) → + |T b π| ≤ ∫ x, |b x| ∂μ + +noncomputable def mass {k : ℕ} (T : Functional X k) : ℝ := + sInf {r : ℝ | ∃ μ : Measure X, + IsFiniteMeasure μ ∧ Controls T μ ∧ r = μ.real univ} + +structure IsMetricCurrent {k : ℕ} (T : Functional X k) : Prop where + offDomain : ∀ b π, ¬Admissible b π → T b π = 0 + linearFirst : ∀ b₁ b₂ π (a c : ℝ), BoundedLip b₁ → BoundedLip b₂ → + (∀ i, ∃ K : ℝ≥0, LipschitzWith K (π i)) → + T (fun x => a * b₁ x + c * b₂ x) π = a * T b₁ π + c * T b₂ π + linearCoord : ∀ b π i f (a c : ℝ), Admissible b π → + (∃ K : ℝ≥0, LipschitzWith K f) → + T b (Function.update π i (fun x => a * π i x + c * f x)) = + a * T b π + c * T b (Function.update π i f) + sequentialContinuity : ∀ b π (πs : ℕ → Fin k → X → ℝ), BoundedLip b → + (∀ i, ∃ K : ℝ≥0, ∀ j, LipschitzWith K (πs j i)) → + (∀ i x, Tendsto (fun j => πs j i x) atTop (𝓝 (π i x))) → + Tendsto (fun j => T b (πs j)) atTop (𝓝 (T b π)) + locality : ∀ b π, Admissible b π → + (∃ (i : Fin k) (U : Set X) (c : ℝ), IsOpen U ∧ Function.support b ⊆ U ∧ + ∀ x ∈ U, π i x = c) → T b π = 0 + finiteMass : ∃ μ : Measure X, IsFiniteMeasure μ ∧ Controls T μ + +noncomputable def boundarySucc {k : ℕ} (T : Functional X (k + 1)) : Functional X k := + fun b π => if Admissible b π then T (fun _ => 1) (Matrix.vecCons b π) else 0 + +noncomputable def boundary : {k : ℕ} → Functional X k → Functional X (k - 1) + | 0, _ => fun _ _ => 0 + | _ + 1, T => boundarySucc T + +structure IntegerChart (X : Type u) [MetricSpace X] (k : ℕ) where + domain : Set (Euc k) + borel : MeasurableSet domain + bounded : Bornology.IsBounded domain + param : domain → X + bilipschitz : ∃ L U : ℝ≥0, LipschitzWith L param ∧ AntilipschitzWith U param + multiplicity : Euc k → ℤ + integrable : Integrable (fun z => (multiplicity z : ℝ)) (volume.restrict domain) + +namespace IntegerChart + +variable {k : ℕ} (C : IntegerChart X k) + +noncomputable def scalar (f : X → ℝ) (z : Euc k) : ℝ := + if hz : z ∈ C.domain then f (C.param ⟨z, hz⟩) else 0 + +noncomputable def jacobian (π : Fin k → X → ℝ) (z : Euc k) : ℝ := + Matrix.det (fun i j => + (fderivWithin ℝ (C.scalar (π i)) C.domain z) (EuclideanSpace.single j 1)) + +noncomputable def action : Functional X k := + fun b π => if Admissible b π then + ∫ z in C.domain, (C.multiplicity z : ℝ) * C.scalar b z * C.jacobian π z + else 0 + +def image : Set X := Set.range C.param + +end IntegerChart + +def IntegerRectifiable {k : ℕ} (T : Functional X k) : Prop := + ∃ C : ℕ → IntegerChart X k, + Pairwise (fun i j => Disjoint (C i).image (C j).image) ∧ + (∀ i, IsMetricCurrent (C i).action) ∧ + Summable (fun i => mass (C i).action) ∧ + ∀ b π, T b π = ∑' i, (C i).action b π + +def IsIntegral : (k : ℕ) → Functional X k → Prop + | 0, T => IsMetricCurrent T ∧ IntegerRectifiable T + | _ + 1, T => IsMetricCurrent T ∧ IntegerRectifiable T ∧ + IsMetricCurrent (boundarySucc T) ∧ IntegerRectifiable (boundarySucc T) + +abbrev IntegralCurrent (X : Type u) [MetricSpace X] [MeasurableSpace X] [BorelSpace X] + (k : ℕ) := { T : Functional X k // IsIntegral k T } + +def CompactlySupported {k : ℕ} (T : Functional X k) : Prop := + ∃ K : Set X, IsCompact K ∧ + ∀ b π, Admissible b π → (∀ x ∈ K, b x = 0) → T b π = 0 + +def IsCycle {k : ℕ} (T : Functional X k) : Prop := boundary T = fun _ _ => 0 + +end MetricCurrents + +noncomputable def omega (k : ℕ) : ℝ := + (volume (Metric.ball (0 : Euc k) 1)).toReal +noncomputable def sphereArea (n : ℕ) : ℝ := (n + 1 : ℝ) * omega (n + 1) +noncomputable def fillingCoefficient (n : ℕ) : ℝ := + 1 / ((n + 1 : ℝ) * (sphereArea n) ^ (1 / (n : ℝ))) +noncomputable def fillingPower (n : ℕ) : ℝ := (n + 1 : ℝ) / (n : ℝ) + +theorem coefficient_optimal (n : ℕ) (hn : 2 ≤ n) : + ∃ T : IntegralCurrent (Euc (n + 1)) n, + CompactlySupported T.val ∧ IsCycle T.val ∧ 0 < mass T.val ∧ + ∀ S : IntegralCurrent (Euc (n + 1)) (n + 1), + CompactlySupported S.val → boundarySucc S.val = T.val → + fillingCoefficient n * (mass T.val) ^ fillingPower n ≤ mass S.val := by + sorry + +end SharpIntegralFillings + +end OAI diff --git a/lean/ComparatorChallenges/FiniteCircle.json b/lean/ComparatorChallenges/FiniteCircle.json new file mode 100644 index 0000000000000000000000000000000000000000..63217370189e3a2a3cae806aa8918712df51572e --- /dev/null +++ b/lean/ComparatorChallenges/FiniteCircle.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.FiniteCircle", + "solution_module": "OAI.Combinatorics.FiniteCircle.Main", + "theorem_names": [ + "OAI.finiteCircle_fullMain" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/FiniteCircle.lean b/lean/ComparatorChallenges/FiniteCircle.lean new file mode 100644 index 0000000000000000000000000000000000000000..01a33d656d49a0242d822910f2debb08608576ca --- /dev/null +++ b/lean/ComparatorChallenges/FiniteCircle.lean @@ -0,0 +1,228 @@ +import Mathlib + +namespace OAI + +namespace FiniteCircle + +open scoped BigOperators List + +universe u v + +inductive EditStep {α : Type u} : List α → List α → Prop + | insert (u v : List α) (a : α) : EditStep (u ++ v) (u ++ a :: v) + | delete (u v : List α) (a : α) : EditStep (u ++ a :: v) (u ++ v) + | substitute (u v : List α) (a b : α) : EditStep (u ++ a :: v) (u ++ b :: v) + +inductive EditScript {α : Type u} : ℕ → List α → List α → Prop + | nil (x : List α) : EditScript 0 x x + | cons {n : ℕ} {x y z : List α} : + EditStep x y → EditScript n y z → EditScript (n + 1) x z + +noncomputable def editDistance {α : Type u} (x y : List α) : ℕ := + sInf {n : ℕ | EditScript n x y} + +noncomputable def lcs {α : Type u} (x y : List α) : ℕ := + sSup {n : ℕ | ∃ z : List α, z <+ x ∧ z <+ y ∧ z.length = n} + +noncomputable def deficit {α : Type u} (x y : List α) : ℕ := x.length - lcs x y + +abbrev Words (α : Type u) (d : ℕ) := {x : List α // x.length ≤ d} +abbrev RealL1 := lp (fun _ : ℕ => ℝ) 1 + +noncomputable def distortion {α : Type u} {X : Type v} (word : X → List α) + (f : X → RealL1) : ℝ := + (sSup {r : ℝ | ∃ x y : X, x ≠ y ∧ + r = ‖f x - f y‖ / (editDistance (word x) (word y) : ℝ)}) * + (sSup {r : ℝ | ∃ x y : X, x ≠ y ∧ + r = (editDistance (word x) (word y) : ℝ) / ‖f x - f y‖}) + +noncomputable def optimalDistortion {α : Type u} {X : Type v} + (word : X → List α) : ℝ := + sInf {D | ∃ f : X → RealL1, Function.Injective f ∧ D = distortion word f} + +noncomputable def E (α : Type u) (d : ℕ) : ℝ := + optimalDistortion (fun x : Words α d => x.val) + +noncomputable def setDistortion (S : Set (List Bool)) : ℝ := + optimalDistortion (fun x : S => x.val) + +noncomputable def alphabetSupremum (d : ℕ) : ℝ := + sSup {r | ∃ A : ℕ, 2 ≤ A ∧ r = E (Fin A) d} + +noncomputable def exponentScale (d : ℕ) : ℝ := + Real.sqrt (Real.log d * Real.log (Real.log d)) + +def encode {α : Type u} {w : ℕ} (c : α → Fin w → Bool) (x : List α) : List Bool := + x.flatMap (fun a => List.ofFn (c a)) + +def interval {α : Type u} {w : ℕ} (c : α → Fin w → Bool) + (a : α) (s len : ℕ) : List Bool := + ((List.ofFn (c a)).drop s).take len + +def OffsetLocal {α : Type u} {w : ℕ} (δ : ℝ) (c : α → Fin w → Bool) : Prop := + ∀ a b : α, a ≠ b → ∀ s t : ℕ, + s + w / 8 ≤ w → t + w / 8 ≤ w → + (lcs (interval c a s (w / 8)) (interval c b t (w / 8)) : ℝ) ≤ + (1 - δ) * (w / 8 : ℕ) + +def indexSpan {w : ℕ} (is : List (Fin w)) : ℕ := + match is with + | [] => 0 + | i :: js => (js.getLastD i).val + 1 - i.val + +def AnchorLocal {α : Type u} {w : ℕ} (ε : ℝ) (c : α → Fin w → Bool) : Prop := + ∀ a b : α, ∀ is js : List (Fin w), + is.Pairwise (fun i j => i.val < j.val) → + js.Pairwise (fun i j => i.val < j.val) → + is.length = js.length → (w : ℝ) / 4 ≤ is.length → + (indexSpan is - is.length : ℕ) ≤ ε * w → + (indexSpan js - js.length : ℕ) ≤ ε * w → + (∀ ij ∈ is.zip js, c a ij.1 = c b ij.2) → + a = b ∧ ∃ i : Fin w, (i, i) ∈ is.zip js + +def SubstitutionBounds {α : Type u} [Fintype α] {w : ℕ} + (a C : ℝ) (c : α → Fin w → Bool) : Prop := + 0 < w ∧ (w : ℝ) ≤ C * Real.log (2 * Fintype.card α) ∧ + (∀ L : ℕ, ∀ x y : List α, x.length = L → y.length = L → + a * w * deficit x y ≤ (deficit (encode c x) (encode c y) : ℝ) ∧ + deficit (encode c x) (encode c y) ≤ w * deficit x y) ∧ + (∀ x y : List α, editDistance (encode c x) (encode c y) ≤ w * editDistance x y) + +def TwoCodes (a C δ ε : ℝ) : Prop := + ∀ (α : Type) [Fintype α], 2 ≤ Fintype.card α → + (∃ (w : ℕ) (c : α → Fin w → Bool), + SubstitutionBounds a C c ∧ OffsetLocal δ c) ∧ + (∃ (w : ℕ) (c : α → Fin w → Bool), + SubstitutionBounds a C c ∧ AnchorLocal ε c) + +def period (h : ℕ) (p : ℕ → ℕ → ℕ) (l : ℕ) : ℕ := ∏ k : Fin h, p l k + +def circleSize (h : ℕ) (p : ℕ → ℕ → ℕ) : ℕ := + 2 * ∏ l : Fin h, period h p (l.val + 1) + +def MaskPrimes (h : ℕ) (p : ℕ → ℕ → ℕ) : Prop := + (∀ l k : Fin h, Nat.Prime (p (l.val + 1) k)) ∧ + Function.Injective (fun lk : Fin h × Fin h => p (lk.1.val + 1) lk.2) ∧ + ∀ l k : Fin h, h ^ 3 ≤ p (l.val + 1) k ∧ p (l.val + 1) k ≤ 2 * h ^ 3 + +def ExcludedPrimes (m : ℕ) (p : ℕ → ℕ → ℕ) : Prop := + (∀ l k : Fin m, Nat.Prime (p (l.val + 1) k)) ∧ + Function.Injective (fun lk : Fin m × Fin m => p (lk.1.val + 1) lk.2) ∧ + ∀ l k : Fin m, m ^ 3 < p (l.val + 1) k ∧ p (l.val + 1) k ≤ m ^ 5 + +abbrev MaskTag (h : ℕ) (p : ℕ → ℕ → ℕ) (l : ℕ) := Σ k : Fin h, Fin (p l k) + +def maskTags (h : ℕ) (p : ℕ → ℕ → ℕ) (l : ℕ) : List (MaskTag h p l) := + (List.ofFn fun k : Fin h => List.ofFn fun b : Fin (p l k) => Sigma.mk k b).flatten + +def MaskAlphabet (h : ℕ) (p : ℕ → ℕ → ℕ) : ℕ → Type + | 0 => Bool + | l + 1 => MaskTag h p (l + 1) × MaskAlphabet h p l + +instance maskAlphabetFintype (h : ℕ) (p : ℕ → ℕ → ℕ) (l : ℕ) : + Fintype (MaskAlphabet h p l) := by + induction l with + | zero => exact inferInstanceAs (Fintype Bool) + | succ l ih => exact @instFintypeProd _ _ inferInstance ih + +def MaskState (h : ℕ) (p : ℕ → ℕ → ℕ) (M : ℕ) : ℕ → Type + | 0 => ZMod M + | l + 1 => MaskTag h p (l + 1) → MaskState h p M l + +def shiftMaskState (h : ℕ) (p : ℕ → ℕ → ℕ) (M : ℕ) : + (l : ℕ) → MaskState h p M l → ZMod M → MaskState h p M l + | 0, v, θ => (show ZMod M from v) + θ + | l + 1, v, θ => fun j => shiftMaskState h p M l (v j) θ + +def maskGamma (h : ℕ) (p : ℕ → ℕ → ℕ) (M l a : ℕ) + (j : MaskTag h p l) : ZMod M := + (∑ k : Fin h, ((M / p l k * (a % p l k) : ℕ) : ZMod M)) + + ((j.2.val * (M / p l j.1) * (a % p l j.1) : ℕ) : ZMod M) + +def maskWord (h : ℕ) (p : ℕ → ℕ → ℕ) (R M : ℕ) : + (l : ℕ) → MaskState h p M l → List (MaskAlphabet h p l) + | 0, v => (List.range M).map (fun b => decide (((b : ZMod M) - (show ZMod M from v)).val < M / 2)) + | l + 1, v => (List.range (R * period h p (l + 1))).flatMap fun a => + (maskTags h p (l + 1)).flatMap fun j => + (maskWord h p R M l + (shiftMaskState h p M l (v j) (maskGamma h p M (l + 1) a j))).map + (fun x => (j, x)) + +def ExcludedAlphabet (m L : ℕ) : ℕ → Type + | 0 => Fin L × Bool + | l + 1 => Fin m × ExcludedAlphabet m L l + +instance excludedAlphabetFintype (m L l : ℕ) : Fintype (ExcludedAlphabet m L l) := by + induction l with + | zero => exact inferInstanceAs (Fintype (Fin L × Bool)) + | succ l ih => exact @instFintypeProd _ _ inferInstance ih + +def ExcludedState (m L : ℕ) : ℕ → Type + | 0 => ZMod L + | l + 1 => Fin m → ExcludedState m L l + +def shiftExcludedState (m L : ℕ) : + (l : ℕ) → ExcludedState m L l → ZMod L → ExcludedState m L l + | 0, v, θ => (show ZMod L from v) + θ + | l + 1, v, θ => fun i => shiftExcludedState m L l (v i) θ + +def excludedTranslation (m : ℕ) (p : ℕ → ℕ → ℕ) (L l s : ℕ) (i : Fin m) : + ZMod L := ∑ j ∈ Finset.univ.erase i, ((L / p l j * (s % p l j) : ℕ) : ZMod L) + +def excludedWord (m : ℕ) (p : ℕ → ℕ → ℕ) (R L : ℕ) : + (l : ℕ) → ExcludedState m L l → List (ExcludedAlphabet m L l) + | 0, v => List.ofFn fun b : Fin L => + (b, decide (((b.val : ZMod L) - (show ZMod L from v)).val < L / 2)) + | l + 1, v => (List.range (R * period m p (l + 1))).flatMap fun s => + (List.ofFn fun i : Fin m => + (excludedWord m p R L l + (shiftExcludedState m L l (v i) (excludedTranslation m p L (l + 1) s i))).map + (fun x => (i, x))).flatten + +def MaskWitness (a C δ lower : ℝ) (d : ℕ) : Prop := + ∃ h : ℕ, 2 ≤ h ∧ ∃ p : ℕ → ℕ → ℕ, MaskPrimes h p ∧ + ∃ (w : ℕ) (c : MaskAlphabet h p h → Fin w → Bool), + SubstitutionBounds a C c ∧ OffsetLocal δ c ∧ + ∃ n : ℕ, 0 < n ∧ n ≤ d ∧ + (∀ v : MaskState h p (circleSize h p) h, + (encode c (maskWord h p (h ^ (2 * h)) (circleSize h p) h v)).length = n) ∧ + Real.exp (lower * exponentScale d) ≤ setDistortion + (Set.range fun v : MaskState h p (circleSize h p) h => + encode c (maskWord h p (h ^ (2 * h)) (circleSize h p) h v)) + +def ExcludedWitness (a C ε lower : ℝ) (d : ℕ) : Prop := + ∃ m : ℕ, 2 ≤ m ∧ ∃ p : ℕ → ℕ → ℕ, ExcludedPrimes m p ∧ + ∃ (w : ℕ) (c : ExcludedAlphabet m (circleSize m p) m → Fin w → Bool), + SubstitutionBounds a C c ∧ AnchorLocal ε c ∧ + ∃ n : ℕ, 0 < n ∧ n ≤ d ∧ + (∀ v : ExcludedState m (circleSize m p) m, + (encode c (excludedWord m p (m ^ (2 * m)) (circleSize m p) m v)).length = n) ∧ + Real.exp (lower * exponentScale d) ≤ setDistortion + (Set.range fun v : ExcludedState m (circleSize m p) m => + encode c (excludedWord m p (m ^ (2 * m)) (circleSize m p) m v)) + +def UniformUpper (C : ℝ) (d₀ : ℕ) : Prop := + ∀ (α : Type) [Fintype α], 2 ≤ Fintype.card α → ∀ d : ℕ, d₀ ≤ d → + ∃ (M : ℕ) (F : Words α d → Fin M → ℝ), ∀ x y : Words α d, + (editDistance x.val y.val : ℝ) ≤ ∑ i, |F x i - F y i| ∧ + (∑ i, |F x i - F y i|) ≤ + Real.exp (C * exponentScale d) * editDistance x.val y.val + +def FullMain : Prop := + ∃ c C a Ccode δ ε : ℝ, ∃ d₀ : ℕ, + 0 < c ∧ 0 < C ∧ 0 < a ∧ 0 < Ccode ∧ 0 < δ ∧ 0 < ε ∧ + TwoCodes a Ccode δ ε ∧ UniformUpper C d₀ ∧ + (∀ (α : Type) [Fintype α], 2 ≤ Fintype.card α → ∀ d : ℕ, d₀ ≤ d → + Real.exp (c * exponentScale d) ≤ E α d ∧ + E α d ≤ Real.exp (C * exponentScale d)) ∧ + (∀ d : ℕ, d₀ ≤ d → + MaskWitness a Ccode δ c d ∧ ExcludedWitness a Ccode ε c d ∧ + Real.exp (c * exponentScale d) ≤ alphabetSupremum d ∧ + alphabetSupremum d ≤ Real.exp (C * exponentScale d)) + +end FiniteCircle + +theorem finiteCircle_fullMain : FiniteCircle.FullMain := by + sorry + +end OAI diff --git a/lean/ComparatorChallenges/FiniteCongruenceGraph.json b/lean/ComparatorChallenges/FiniteCongruenceGraph.json new file mode 100644 index 0000000000000000000000000000000000000000..d905b8d3b1408ddad902d49717f7b61f4043adb9 --- /dev/null +++ b/lean/ComparatorChallenges/FiniteCongruenceGraph.json @@ -0,0 +1,13 @@ +{ + "challenge_module": "ComparatorChallenges.FiniteCongruenceGraph", + "solution_module": "OAI.Algebra.Universal.GraphCriterion", + "theorem_names": [ + "OAI.FiniteCongruence.graph_criterion" + ], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/FiniteCongruenceGraph.lean b/lean/ComparatorChallenges/FiniteCongruenceGraph.lean new file mode 100644 index 0000000000000000000000000000000000000000..99c6b56b02e6c1ee007a0b87352eddff08d5edd8 --- /dev/null +++ b/lean/ComparatorChallenges/FiniteCongruenceGraph.lean @@ -0,0 +1,63 @@ +import Mathlib.Data.Finset.Lattice.Fold +import Mathlib.Data.Fintype.Defs +import Mathlib.Data.Setoid.Basic +import Mathlib.Order.Hom.Basic + +namespace OAI + +namespace FiniteCongruence + +structure Algebra (Carrier : Type) where + numOps : ℕ + arity : Fin numOps → ℕ + op : (index : Fin numOps) → (Fin (arity index) → Carrier) → Carrier + +def Compatible {Carrier : Type} (alg : Algebra Carrier) (rel : Setoid Carrier) : Prop := + ∀ (index : Fin alg.numOps) (left right : Fin (alg.arity index) → Carrier), + (∀ coord, rel (left coord) (right coord)) → rel (alg.op index left) (alg.op index right) + +def Congruence {Carrier : Type} (alg : Algebra Carrier) := + {rel : Setoid Carrier // Compatible alg rel} + +instance {Carrier : Type} (alg : Algebra Carrier) : PartialOrder (Congruence alg) := + inferInstanceAs (PartialOrder {rel : Setoid Carrier // Compatible alg rel}) + +def Representable (Lat : Type) [PartialOrder Lat] : Prop := + ∃ size : ℕ, 0 < size ∧ ∃ alg : Algebra (Fin size), Nonempty (Lat ≃o Congruence alg) + +def Admissible {Lat Carrier : Type} [LE Lat] (color : Carrier → Carrier → Lat) + (placement : Carrier → Carrier) : Prop := + ∀ left right, color (placement left) (placement right) ≤ color left right + +def Marked {Lat Carrier : Type} [LE Lat] (color : Carrier → Carrier → Lat) + (seeds : Finset (Carrier × Carrier)) (left right : Carrier) : Prop := + ∃ placement : Carrier → Carrier, Admissible color placement ∧ + ∃ edge ∈ seeds, placement edge.1 = left ∧ placement edge.2 = right + +def Connected {Lat Carrier : Type} [LE Lat] (color : Carrier → Carrier → Lat) + (seeds : Finset (Carrier × Carrier)) (left right : Carrier) : Prop := + Relation.EqvGen (Marked color seeds) left right + +def IsGraphWitness {Lat Carrier : Type} [Lattice Lat] [OrderBot Lat] + (color : Carrier → Carrier → Lat) : Prop := + (∀ left right, color left right = color right left) ∧ + (∀ left right, color left right = ⊥ ↔ left = right) ∧ + (∀ left right middle, color left right ≤ color left middle ⊔ color middle right) ∧ + (∀ lower upper : Lat, ¬ lower ≤ upper → + ∃ left right, color left right ≤ lower ∧ ¬ color left right ≤ upper) ∧ + (∀ seeds : Finset (Carrier × Carrier), seeds.Nonempty → ∀ left right, + color left right ≤ seeds.sup (fun edge => color edge.1 edge.2) → + Connected color seeds left right) + +def HasGraphWitness (Lat : Type) [Lattice Lat] [OrderBot Lat] : Prop := + ∃ size : ℕ, 0 < size ∧ ∃ color : Fin size → Fin size → Lat, IsGraphWitness color + +/-- A finite lattice is representable as the full congruence lattice of a nonempty finite +algebra exactly when it has a finite nonempty colored-graph witness. -/ +theorem graph_criterion (Lat : Type) [Fintype Lat] [Lattice Lat] [OrderBot Lat] : + Representable Lat ↔ HasGraphWitness Lat := by + sorry + +end FiniteCongruence + +end OAI diff --git a/lean/ComparatorChallenges/FiniteEntropySeparation.json b/lean/ComparatorChallenges/FiniteEntropySeparation.json new file mode 100644 index 0000000000000000000000000000000000000000..5812becf13f0d72d80feedd6fbb0558b63c73ad8 --- /dev/null +++ b/lean/ComparatorChallenges/FiniteEntropySeparation.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.FiniteEntropySeparation", + "solution_module": "OAI.Analysis.FreeEntropy.Main", + "theorem_names": [ + "OAI.FiniteEntropySeparation.main" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/FiniteEntropySeparation.lean b/lean/ComparatorChallenges/FiniteEntropySeparation.lean new file mode 100644 index 0000000000000000000000000000000000000000..3c538a4c995d6bc60df8fd8079933c485cdb09f0 --- /dev/null +++ b/lean/ComparatorChallenges/FiniteEntropySeparation.lean @@ -0,0 +1,125 @@ +import Mathlib + +namespace OAI + +noncomputable section + +open scoped ENNReal NNReal ComplexConjugate +open MeasureTheory Filter + +namespace FiniteEntropySeparation + +variable {H : Type} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +structure TracialVector (M : VonNeumannAlgebra H) where + vacuum : H + norm_vacuum : ‖vacuum‖ = 1 + tracial : ∀ A ∈ M, ∀ B ∈ M, + inner ℂ vacuum ((A * B) vacuum) = inner ℂ vacuum ((B * A) vacuum) + separating : ∀ A ∈ M, A vacuum = 0 → A = 0 + +def trace {M : VonNeumannAlgebra H} (τ : TracialVector M) (A : H →L[ℂ] H) : ℂ := + inner ℂ τ.vacuum (A τ.vacuum) + +def wordEval {n : ℕ} (X : Fin n → H →L[ℂ] H) (w : List (Fin n)) : H →L[ℂ] H := + (w.map X).prod + +def wordMoment {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ} + (X : Fin n → H →L[ℂ] H) (w : List (Fin n)) : ℂ := trace τ (wordEval X w) + +def FreeSubalgebras {ι : Type} {M : VonNeumannAlgebra H} (τ : TracialVector M) + (A : ι → Subalgebra ℂ (H →L[ℂ] H)) : Prop := + ∀ (k : ℕ), 0 < k → ∀ (j : Fin k → ι) (a : Fin k → H →L[ℂ] H), + (∀ r, a r ∈ A (j r)) → (∀ r, trace τ (a r) = 0) → + (∀ (r : ℕ) (hr : r + 1 < k), + j ⟨r, Nat.lt_trans (Nat.lt_succ_self r) hr⟩ ≠ j ⟨r + 1, hr⟩) → + trace τ (List.ofFn a).prod = 0 + +def FreeStandardNoise {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ} + (X S : Fin n → H →L[ℂ] H) : Prop := + (∀ i k, trace τ (S i ^ k) = + if Even k then (catalan (k / 2) : ℂ) else 0) ∧ + FreeSubalgebras τ (fun j : Option (Fin n) => match j with + | none => Algebra.adjoin ℂ (Set.range X) + | some i => Algebra.adjoin ℂ {S i}) + +def polynomialL2 {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ} + (X : Fin n → H →L[ℂ] H) : Submodule ℂ H := + (Submodule.span ℂ (Set.range (fun w : List (Fin n) => wordEval X w τ.vacuum))).topologicalClosure + +def derivativeMoment {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ} + (X : Fin n → H →L[ℂ] H) (i : Fin n) (w : List (Fin n)) : ℂ := + ∑ r : Fin w.length, if w[r.val] = i then + wordMoment τ X (w.take r.val) * wordMoment τ X (w.drop (r.val + 1)) else 0 + +def ConjugateSystem {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ} + (X : Fin n → H →L[ℂ] H) (ξ : Fin n → H) : Prop := + ∀ i, ξ i ∈ polynomialL2 τ X ∧ ∀ w : List (Fin n), + inner ℂ (ξ i) (wordEval X w τ.vacuum) = derivativeMoment τ X i w + +def freeFisher {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ} + (X : Fin n → H →L[ℂ] H) : ℝ≥0∞ := + ⨅ (ξ : Fin n → H) (_ : ConjugateSystem τ X ξ), ENNReal.ofReal (∑ i, ‖ξ i‖ ^ 2) + +def heatTuple {n : ℕ} (X S : Fin n → H →L[ℂ] H) (s : ℝ) : + Fin n → H →L[ℂ] H := fun i => X i + (Real.sqrt s : ℂ) • S i + +def chiStar {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ} + (X S : Fin n → H →L[ℂ] H) : EReal := + let b : ℝ → ℝ≥0∞ := fun s => ENNReal.ofReal ((n : ℝ) / (1 + s)) + let f : ℝ → ℝ≥0∞ := fun s => freeFisher τ (heatTuple X S s) + ((n / 2 * Real.log (2 * Real.pi * Real.exp 1) : ℝ) : EReal) + + (1 / 2 : EReal) * (∫⁻ s in Set.Ioi (0 : ℝ), b s - f s).toEReal - + (1 / 2 : EReal) * (∫⁻ s in Set.Ioi (0 : ℝ), f s - b s).toEReal + +abbrev MatrixCoordinates (n d : ℕ) := EuclideanSpace ℝ (Fin n × Fin d × Fin d) + +def hermitianMatrix {n d : ℕ} (a : MatrixCoordinates n d) (i : Fin n) : + Matrix (Fin d) (Fin d) ℂ := fun j k => + if j = k then (a (i, j, j) : ℂ) + else if j < k then ((a (i, j, k) : ℂ) + Complex.I * (a (i, k, j) : ℂ)) / Real.sqrt 2 + else ((a (i, k, j) : ℂ) - Complex.I * (a (i, j, k) : ℂ)) / Real.sqrt 2 + +def matrixOpNorm {d : ℕ} (A : Matrix (Fin d) (Fin d) ℂ) : ℝ := + ‖(Matrix.toEuclideanLin A).toContinuousLinearMap‖ + +def matrixMoment {n d : ℕ} (a : MatrixCoordinates n d) (w : List (Fin n)) : ℂ := + (d : ℂ)⁻¹ * Matrix.trace (w.map (hermitianMatrix a)).prod + +def microstates {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ} + (X : Fin n → H →L[ℂ] H) (R : ℝ) (m d : ℕ) (ε : ℝ) : Set (MatrixCoordinates n d) := + {a | (∀ i, matrixOpNorm (hermitianMatrix a i) ≤ R) ∧ + ∀ w : List (Fin n), w.length ≤ m → ‖matrixMoment a w - wordMoment τ X w‖ < ε} + +def chiCutoff {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ} + (X : Fin n → H →L[ℂ] H) (R : ℝ) : EReal := + ⨅ m : ℕ, ⨅ ε : {ε : ℝ // 0 < ε}, + limsup (fun d : ℕ => + (((((d + 1 : ℕ) : ℝ) ^ 2)⁻¹ : ℝ) : EReal) * + (volume (microstates τ X R m (d + 1) ε.val)).log + + (((n : ℝ) / 2 * Real.log (d + 1) : ℝ) : EReal)) atTop + +def chi {M : VonNeumannAlgebra H} (τ : TracialVector M) {n : ℕ} + (X : Fin n → H →L[ℂ] H) : EReal := + ⨆ R : {R : ℝ // 0 < R}, chiCutoff τ X R.val + +open MeasureTheory + +theorem main : + ∃ (H : Type) (_ : NormedAddCommGroup H) (_ : InnerProductSpace ℂ H) + (_ : CompleteSpace H) (M : VonNeumannAlgebra H) (τ : TracialVector M) + (n : ℕ) (X S : Fin n → H →L[ℂ] H), + 2 ≤ n ∧ + (∀ i, X i ∈ M ∧ IsSelfAdjoint (X i)) ∧ + (∀ i, S i ∈ M ∧ IsSelfAdjoint (S i)) ∧ + FreeStandardNoise τ X S ∧ + (⊥ : EReal) < chi τ X ∧ + chi τ X ≤ chiStar τ X S - (1 / 2 : EReal) ∧ + chiStar τ X S - (1 / 2 : EReal) < (⊤ : EReal) := by + sorry + +end FiniteEntropySeparation + +end + +end OAI diff --git a/lean/ComparatorChallenges/FiniteFactor.json b/lean/ComparatorChallenges/FiniteFactor.json new file mode 100644 index 0000000000000000000000000000000000000000..dac6e45c71f89349af96757005e6f63adb643f72 --- /dev/null +++ b/lean/ComparatorChallenges/FiniteFactor.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.FiniteFactor", + "solution_module": "OAI.Analysis.FiniteFactor.Main", + "theorem_names": [ + "OAI.FiniteFactor.main_theorem" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/FiniteFactor.lean b/lean/ComparatorChallenges/FiniteFactor.lean new file mode 100644 index 0000000000000000000000000000000000000000..e419f31f1b6879e6fb7eecf068e4b21efb687ad7 --- /dev/null +++ b/lean/ComparatorChallenges/FiniteFactor.lean @@ -0,0 +1,46 @@ +import Mathlib.Analysis.VonNeumannAlgebra.Basic +import Mathlib.Analysis.SpecialFunctions.Pow.Real + +namespace OAI + +namespace FiniteFactor +open Filter +open scoped Topology +universe u + +variable {H : Type u} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +/-- A concrete factor has scalar center. -/ +def HasScalarCenter (M : VonNeumannAlgebra H) : Prop := + ∀ a ∈ M, (∀ b ∈ M, a * b = b * a) → ∃ z : ℂ, a = z • (1 : H →L[ℂ] H) + +/-- Finiteness: every isometry in the algebra is unitary. -/ +def IsFiniteAlgebra (M : VonNeumannAlgebra H) : Prop := + ∀ v ∈ M, star v * v = 1 → v * star v = 1 + +/-- No nonzero projection is minimal, excluding matrix factors. -/ +def HasNoMinimalProjection (M : VonNeumannAlgebra H) : Prop := + ∀ p ∈ M, IsStarProjection p → p ≠ 0 → + ∃ q ∈ M, IsStarProjection q ∧ q ≠ 0 ∧ q ≠ p ∧ q * p = q + +/-- A separable Banach space whose dual is conjugate-linearly isometric to M. -/ +def HasSeparablePredual (M : VonNeumannAlgebra H) : Prop := + ∃ (E : Type u) (_ : NormedAddCommGroup E) (_ : NormedSpace ℂ E) + (_ : CompleteSpace E) (_ : TopologicalSpace.SeparableSpace E), + Nonempty (StrongDual ℂ E ≃ₗᵢ⋆[ℂ] M.toStarSubalgebra) + +def MainTarget : Prop := + ∃ (H : Type u) (_ : NormedAddCommGroup H) (_ : InnerProductSpace ℂ H) + (_ : CompleteSpace H) (M : VonNeumannAlgebra H), + HasScalarCenter M ∧ IsFiniteAlgebra M ∧ HasNoMinimalProjection M ∧ + HasSeparablePredual M ∧ + ∃ T : H →L[ℂ] H, T ∈ M ∧ T ≠ 0 ∧ + Tendsto (fun n : ℕ => ‖T ^ n‖ ^ (1 / (n : ℝ))) atTop (𝓝 0) ∧ + ∀ p ∈ M, IsStarProjection p → (1 - p) * T * p = 0 → p = 0 ∨ p = 1 + +theorem main_theorem : MainTarget.{0} := by + sorry + +end FiniteFactor + +end OAI diff --git a/lean/ComparatorChallenges/FinitisticAsymmetry.json b/lean/ComparatorChallenges/FinitisticAsymmetry.json new file mode 100644 index 0000000000000000000000000000000000000000..0631e74d2c344b7566e75508ff157ff0a90c5135 --- /dev/null +++ b/lean/ComparatorChallenges/FinitisticAsymmetry.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.FinitisticAsymmetry", + "solution_module": "OAI.Algebra.FinitisticAsymmetry.Main", + "theorem_names": [ + "OAI.LittleFinitistic.extreme_left_right_asymmetry" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/FinitisticAsymmetry.lean b/lean/ComparatorChallenges/FinitisticAsymmetry.lean new file mode 100644 index 0000000000000000000000000000000000000000..4870c0c503c37dd908b25a348245b95dbc13ddab --- /dev/null +++ b/lean/ComparatorChallenges/FinitisticAsymmetry.lean @@ -0,0 +1,41 @@ +import Mathlib + +namespace OAI + +noncomputable section +open CategoryTheory + +namespace LittleFinitistic +universe u +variable (A : Type u) [Ring A] + +attribute [-instance] CompletePartialOrder.toSupSet in +def littleFinitisticDimension : WithBot ℕ∞ := + ⨆ (M : ModuleCat.{u} A) (_ : Module.Finite A M) (_ : projectiveDimension M < ⊤), + projectiveDimension M + +def bigFinitisticDimension : WithBot ℕ∞ := + ⨆ (M : ModuleCat.{u} A) (_ : projectiveDimension M < ⊤), projectiveDimension M + +def InjectivesGenerate : Prop := + letI := HasDerivedCategory.standard (ModuleCat.{u} A) + ∀ (P : ObjectProperty (DerivedCategory (ModuleCat.{u} A))), + P.IsClosedUnderIsomorphisms → P.IsTriangulated → + (∀ I : Type u, P.IsClosedUnderColimitsOfShape (Discrete I)) → + (∀ (M : ModuleCat.{u} A), Injective M → + P ((DerivedCategory.singleFunctor (ModuleCat.{u} A) 0).obj M)) → + ∀ X, P X + +theorem extreme_left_right_asymmetry : + ∃ (Λ : Type) (_ : Ring Λ) (_ : Algebra ℂ Λ), + FiniteDimensional ℂ Λ ∧ + littleFinitisticDimension Λ = ⊤ ∧ bigFinitisticDimension Λ = ⊤ ∧ + littleFinitisticDimension Λᵐᵒᵖ = 0 ∧ bigFinitisticDimension Λᵐᵒᵖ = 0 ∧ + ¬ InjectivesGenerate Λ ∧ InjectivesGenerate Λᵐᵒᵖ := by + sorry + +end LittleFinitistic + +end + +end OAI diff --git a/lean/ComparatorChallenges/FixedClauseThreshold.json b/lean/ComparatorChallenges/FixedClauseThreshold.json new file mode 100644 index 0000000000000000000000000000000000000000..7897da92a1789760b0fb3759b095f61a9a95a686 --- /dev/null +++ b/lean/ComparatorChallenges/FixedClauseThreshold.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.FixedClauseThreshold", + "solution_module": "OAI.Probability.RandomSAT.Main", + "theorem_names": [ + "OAI.FixedClauseThreshold.main" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/FixedClauseThreshold.lean b/lean/ComparatorChallenges/FixedClauseThreshold.lean new file mode 100644 index 0000000000000000000000000000000000000000..3d2f3438b04de4f842960a03718ffbd084b00bd7 --- /dev/null +++ b/lean/ComparatorChallenges/FixedClauseThreshold.lean @@ -0,0 +1,56 @@ +import Mathlib + +namespace OAI + +/-! +Proper clauses choose distinct variables uniformly and give them independent fair +signs. Formulas consist of independent uniform whole-clause draws with replacement. +Their satisfiability probability is the literal finite cardinality ratio. +For zero clauses this probability is one, including when there are fewer variables +than literals per clause. When there are fewer variables than literals per clause +and the clause count is positive, the ensemble is empty and its probability is zero +by the convention that division by zero is zero. + +For each fixed clause size at least three, one positive finite real threshold +governs the limits at every fixed density below or above it. There is no assertion +at the critical density, no explicit threshold value, and no varying-size claim. +-/ + +namespace FixedClauseThreshold + +abbrev Assignment (n : ℕ) := Fin n → Bool + +abbrev ProperClause (n k : ℕ) := + { C : Fin n → Option Bool // (Finset.univ.filter fun i => (C i).isSome).card = k } + +abbrev Formula (n k m : ℕ) := Fin m → ProperClause n k + +def SatisfiesClause {n k : ℕ} (σ : Assignment n) (C : ProperClause n k) : Prop := + ∃ i : Fin n, C.val i = some (σ i) + +def Satisfies {n k m : ℕ} (σ : Assignment n) (F : Formula n k m) : Prop := + ∀ j, SatisfiesClause σ (F j) + +def Satisfiable {n k m : ℕ} (F : Formula n k m) : Prop := + ∃ σ : Assignment n, Satisfies σ F + +noncomputable def properSATProbability (n k m : ℕ) : ℝ := by + classical + exact (Fintype.card { F : Formula n k m // Satisfiable F } : ℝ) / + (Fintype.card (Formula n k m) : ℝ) + +def HasLimitingThreshold (k : ℕ) : Prop := + ∃ α : ℝ, 0 < α ∧ + (∀ c : ℝ, 0 ≤ c → c < α → + Filter.Tendsto (fun n : ℕ => properSATProbability n k ⌊c * (n : ℝ)⌋₊) + Filter.atTop (nhds 1)) ∧ + (∀ c : ℝ, α < c → + Filter.Tendsto (fun n : ℕ => properSATProbability n k ⌊c * (n : ℝ)⌋₊) + Filter.atTop (nhds 0)) + +theorem main (k : ℕ) (hk : 3 ≤ k) : HasLimitingThreshold k := by + sorry + +end FixedClauseThreshold + +end OAI diff --git a/lean/ComparatorChallenges/ForcedNavierStokesComputation.json b/lean/ComparatorChallenges/ForcedNavierStokesComputation.json new file mode 100644 index 0000000000000000000000000000000000000000..f55d322aef19ab1e444c83cf9d9cdbf887455807 --- /dev/null +++ b/lean/ComparatorChallenges/ForcedNavierStokesComputation.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.ForcedNavierStokesComputation", + "solution_module": "OAI.MathematicalPhysics.NavierStokes.BalancedTransport.MainResult", + "theorem_names": [ + "OAI.BalancedTransport.balanced_three_stack_realization" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/ForcedNavierStokesComputation.lean b/lean/ComparatorChallenges/ForcedNavierStokesComputation.lean new file mode 100644 index 0000000000000000000000000000000000000000..e45e84a8afc62fa9bd7752250ec9b74ffb1f7904 --- /dev/null +++ b/lean/ComparatorChallenges/ForcedNavierStokesComputation.lean @@ -0,0 +1,232 @@ +import Mathlib + +/-! A single main result: effective forced Navier–Stokes computation detected by a +fixed particle entering a fixed open box, exactly when the encoded machine halts. -/ + +namespace OAI.BalancedTransport +namespace Recorder +inductive Direction where + | stay | left | right + deriving DecidableEq + +structure Transition (Q Γ : Type*) where + state : Q + write : Γ + move : Direction +end Recorder + +structure FiniteMachine where + states : ℕ + symbols : ℕ + initial : Fin (states + 1) + blank : Fin (symbols + 1) + transition : Fin (states + 1) → Fin (symbols + 1) → + Option (Recorder.Transition (Fin (states + 1)) (Fin (symbols + 1))) + +abbrev Input (M : FiniteMachine) := List (Fin (M.symbols + 1)) + +structure TapeConfiguration (M : FiniteMachine) where + state : Fin (M.states + 1) + head : ℤ + tape : ℤ → Fin (M.symbols + 1) + +def initialConfiguration (M : FiniteMachine) (w : Input M) : TapeConfiguration M := + ⟨M.initial, 0, fun z => if 0 ≤ z then w[z.toNat]?.getD M.blank else M.blank⟩ + +def machineStep (M : FiniteMachine) (c : TapeConfiguration M) : Option (TapeConfiguration M) := + (M.transition c.state (c.tape c.head)).map fun v => + ⟨v.state, c.head + (match v.move with | .stay => 0 | .left => -1 | .right => 1), + Function.update c.tape c.head v.write⟩ + +def Halts (M : FiniteMachine) (w : Input M) : Prop := + ∃ c, Relation.ReflTransGen (fun c d => machineStep M c = some d) + (initialConfiguration M w) c ∧ machineStep M c = none + +def Recorder.Direction.number : Recorder.Direction → ℕ + | .stay => 0 + | .left => 1 + | .right => 2 + +def FiniteMachine.code (M : FiniteMachine) : ℕ := + Encodable.encode (M.states, M.symbols, M.initial.val, M.blank.val, + (List.finRange (M.states + 1)).map fun q => + (List.finRange (M.symbols + 1)).map fun a => + (M.transition q a).map fun v => (v.state.val, v.write.val, v.move.number)) + +def inputCode (M : FiniteMachine) (w : Input M) : ℕ := + Encodable.encode (M.code, w.map Fin.val) + +abbrev Space := Fin 3 → ℝ +abbrev Field (F : Type*) := ℝ → Space → F +abbrev Velocity := Field Space +abbrev Pressure := Field ℝ +abbrev Family (F : Type*) := (M : FiniteMachine) → Input M → F +abbrev MaterialFlow := ℝ → Space → Space +abbrev MultiIndex := List (Option (Fin 3)) +abbrev RationalPoint := ℚ × (Fin 3 → ℚ) + +noncomputable section + +open MeasureTheory +open scoped ENNReal + +variable {F : Type*} [NormedAddCommGroup F] [NormedSpace ℝ F] + +def timeD (v : Field F) : Field F := + fun t x => derivWithin (fun s => v s x) (Set.Ici 0) t + +def spaceD (i : Fin 3) (v : Field F) : Field F := + fun t x => fderiv ℝ (v t) x (Pi.single i 1) + +def mixedD : MultiIndex → Field F → Field F + | [], v => v + | none :: a, v => timeD (mixedD a v) + | some i :: a, v => spaceD i (mixedD a v) + +def spatialD : List (Fin 3) → Field F → Field F + | [], v => v + | i :: a, v => spaceD i (spatialD a v) + +def Smooth (v : Field F) : Prop := + ContDiffOn ℝ (⊤ : ℕ∞) (fun z : ℝ × Space => v z.1 z.2) (Set.Ici 0 ×ˢ Set.univ) + +def BoundedMixed (v : Field F) : Prop := + ∀ a : MultiIndex, ∃ C : ℝ, 0 ≤ C ∧ ∀ t, 0 ≤ t → ∀ x, ‖mixedD a v t x‖ ≤ C + +def CH (k : ℕ) (v : Field F) : Prop := + ∀ a : List (Fin 3), a.length ≤ k → + ∃ V : ℝ → Lp F 2 (volume : Measure Space), + ContinuousOn V (Set.Ici 0) ∧ + ∀ t, 0 ≤ t → (V t : Space → F) =ᵐ[volume] spatialD a v t + +def C1L2 (v : Field F) : Prop := + ∃ V W : ℝ → Lp F 2 (volume : Measure Space), + ContinuousOn V (Set.Ici 0) ∧ ContinuousOn W (Set.Ici 0) ∧ + ∀ t, 0 ≤ t → + (V t : Space → F) =ᵐ[volume] v t ∧ + (W t : Space → F) =ᵐ[volume] timeD v t ∧ + HasDerivWithinAt V (W t) (Set.Ici 0) t + +def div (u : Velocity) (t : ℝ) (x : Space) : ℝ := + ∑ i, spaceD i u t x i + +def laplacian (u : Velocity) : Velocity := + fun t x => ∑ i, spaceD i (spaceD i u) t x + +def convection (u : Velocity) : Velocity := + fun t x => ∑ i, (u t x i) • spaceD i u t x + +def gradient (p : Pressure) (t : ℝ) (x : Space) : Space := + fun i => spaceD i p t x + +def affineForce (f₀ f₁ : Velocity) (ν : ℝ) : Velocity := + fun t x => f₀ t x + ν • f₁ t x + +def inertialCoefficient (u : Velocity) : Velocity := + fun t x => timeD u t x + convection u t x + +def viscousCoefficient (u : Velocity) : Velocity := + fun t x => -laplacian u t x + +def ZeroDataSolution (ν : ℝ) (f u : Velocity) (p : Pressure) : Prop := + Smooth u ∧ Smooth p ∧ + (∀ x, u 0 x = 0) ∧ + (∀ t, 0 ≤ t → ∀ x, div u t x = 0) ∧ + (∀ t, 0 ≤ t → ∀ x, + timeD u t x + convection u t x = + -gradient p t x + ν • laplacian u t x + f t x) + +def BoundedOnFiniteSlabs (u : Velocity) : Prop := + ∀ T : ℝ, 0 ≤ T → ∃ C : ℝ, 0 ≤ C ∧ + ∀ t ∈ Set.Icc (0 : ℝ) T, ∀ x, + ‖u t x‖ ≤ C ∧ ∀ i : Fin 3, ‖spaceD i u t x‖ ≤ C + +def ComparisonClass (u : Velocity) (p : Pressure) : Prop := + CH 2 u ∧ C1L2 u ∧ BoundedOnFiniteSlabs u ∧ + ∃ c : ℝ → ℝ, CH 1 (fun t x => p t x - c t) + +def UniqueInComparison (ν : ℝ) (f U : Velocity) : Prop := + ∀ u p, ZeroDataSolution ν f u p → ComparisonClass u p → + (∀ t, 0 ≤ t → ∀ x, u t x = U t x) ∧ + (∀ t, 0 ≤ t → ∀ x y, p t x = p t y) + +def CommonCompactSupport (U f₀ f₁ : Velocity) : Prop := + ∃ K : Set Space, IsCompact K ∧ + ∀ t, 0 ≤ t → ∀ x, x ∉ K → U t x = 0 ∧ f₀ t x = 0 ∧ f₁ t x = 0 + +def PeriodicAfterOne (v : Velocity) : Prop := + ∀ t, 1 ≤ t → ∀ x, v (t + 1) x = v t x + +def IsMaterialFlow (u : Velocity) (X : MaterialFlow) : Prop := + (∀ a, X 0 a = a) ∧ + ∀ a t, 0 ≤ t → HasDerivWithinAt (fun s => X s a) (u t (X t a)) (Set.Ici 0) t + +def fixedLabel : Space := ![4, 0, 0] + +def observer : Set Space := + Set.pi Set.univ (fun _ : Fin 3 => Set.Ioo (-1 : ℝ) 2) + +def rationalSpace (x : Fin 3 → ℚ) : Space := fun i => (x i : ℝ) + +def error (n : ℕ) : ℝ := (2 : ℝ)⁻¹ ^ n + +def EffectiveFamily (v : Family Velocity) : Prop := + ∃ E : (ℕ × MultiIndex × RationalPoint × ℕ) → (Fin 3 → ℚ), + ∃ b : (ℕ × MultiIndex) → ℕ, + ∃ R : ℕ → ℕ, + Computable E ∧ Computable b ∧ Computable R ∧ + (∀ M w a z n, 0 ≤ z.1 → ∀ i, + |(E (inputCode M w, a, z, n) i : ℝ) - + mixedD a (v M w) (z.1 : ℝ) (rationalSpace z.2) i| ≤ error n) ∧ + (∀ M w a t, 0 ≤ t → ∀ x, + ‖mixedD a (v M w) t x‖ ≤ (b (inputCode M w, a) : ℝ)) ∧ + (∀ M w t, 0 ≤ t → ∀ x, + (R (inputCode M w) : ℝ) < ‖x‖ → v M w t x = 0) + +def EffectiveFieldIn (O : Set (ℕ →. ℕ)) (v : Velocity) : Prop := + ∃ E : (MultiIndex × RationalPoint × ℕ) → (Fin 3 → ℚ), + ∃ b : MultiIndex → ℕ, + ComputableIn O E ∧ ComputableIn O b ∧ + (∀ a z n, 0 ≤ z.1 → ∀ i, + |(E (a, z, n) i : ℝ) - + mixedD a v (z.1 : ℝ) (rationalSpace z.2) i| ≤ error n) ∧ + (∀ a t, 0 ≤ t → ∀ x, ‖mixedD a v t x‖ ≤ (b a : ℝ)) + +def RealName (name : ℕ → ℚ) (x : ℝ) : Prop := + ∀ n, |(name n : ℝ) - x| ≤ error n + +def ComputableReal (x : ℝ) : Prop := + ∃ name : ℕ → ℚ, Computable name ∧ RealName name x + +def nameOracle (name : ℕ → ℚ) : ℕ →. ℕ := + fun n => Part.some (Encodable.encode (name n)) + +end + +theorem balanced_three_stack_realization : + ∃ U f₀ f₁ : Family Velocity, + ∃ X : Family MaterialFlow, + ∃ repeated : FiniteMachine → Velocity, + EffectiveFamily U ∧ EffectiveFamily f₀ ∧ EffectiveFamily f₁ ∧ + (∀ M, Function.Periodic (repeated M) 1) ∧ + ∀ (M : FiniteMachine) (w : Input M), + Smooth (U M w) ∧ Smooth (f₀ M w) ∧ Smooth (f₁ M w) ∧ + f₀ M w = inertialCoefficient (U M w) ∧ + f₁ M w = viscousCoefficient (U M w) ∧ + CommonCompactSupport (U M w) (f₀ M w) (f₁ M w) ∧ + BoundedMixed (U M w) ∧ + PeriodicAfterOne (U M w) ∧ + (∀ t, 1 ≤ t → ∀ x, U M w t x = repeated M t x) ∧ + ComparisonClass (U M w) (fun _ _ => 0) ∧ + IsMaterialFlow (U M w) (X M w) ∧ + ((∃ t : ℝ, 0 ≤ t ∧ X M w t fixedLabel ∈ observer) ↔ Halts M w) ∧ + ∀ ν : ℝ, 0 < ν → + let f := affineForce (f₀ M w) (f₁ M w) ν + ZeroDataSolution ν f (U M w) (fun _ _ => 0) ∧ + Smooth f ∧ BoundedMixed f ∧ PeriodicAfterOne f ∧ + UniqueInComparison ν f (U M w) ∧ + (ComputableReal ν → EffectiveFieldIn ∅ f) ∧ + (∀ name : ℕ → ℚ, RealName name ν → EffectiveFieldIn {nameOracle name} f) := by + sorry + +end OAI.BalancedTransport diff --git a/lean/ComparatorChallenges/ForestSpace.json b/lean/ComparatorChallenges/ForestSpace.json new file mode 100644 index 0000000000000000000000000000000000000000..7045f43b1e61d02d4ec7880c3fca03152e60da60 --- /dev/null +++ b/lean/ComparatorChallenges/ForestSpace.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.ForestSpace", + "solution_module": "OAI.Analysis.ForestSpace.Main", + "theorem_names": [ + "OAI.ForestSpace.main_theorem" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/ForestSpace.lean b/lean/ComparatorChallenges/ForestSpace.lean new file mode 100644 index 0000000000000000000000000000000000000000..c44f14ccdd1a6285776bd991bf5f80ce607e5e00 --- /dev/null +++ b/lean/ComparatorChallenges/ForestSpace.lean @@ -0,0 +1,468 @@ +import Mathlib + +namespace OAI + +noncomputable section + +open scoped BigOperators +open Finset + +namespace ForestSpace + +attribute [local instance] Classical.propDecidable + +section ModulusDefinitions + +variable (E : Type) [NormedAddCommGroup E] [NormedSpace ℝ E] + +/-- The closed finite-codimensional subspaces. -/ +def Cofinite : Type := + {F : Submodule ℝ E // IsClosed (F : Set E) ∧ FiniteDimensional ℝ (E ⧸ F)} + +/-- The inner one-sided excess values and their infimum. -/ +def aucValues (N : E → ℝ) (t : ℝ) (x : E) (F : Cofinite E) : Set ℝ := + {a | ∃ y : E, y ∈ F.val ∧ N y = 1 ∧ a = N (x + t • y) - 1} + +noncomputable def aucInner (N : E → ℝ) (t : ℝ) (x : E) (F : Cofinite E) : ℝ := + sInf (aucValues E N t x F) + +noncomputable def aucCenter (N : E → ℝ) (t : ℝ) (x : E) : ℝ := + sSup (Set.range (aucInner E N t x)) + +/-- The one-sided asymptotic uniform convexity modulus, with the order +of infimum, supremum and infimum. -/ +noncomputable def aucModulus (N : E → ℝ) (t : ℝ) : ℝ := + sInf {a | ∃ x : E, N x = 1 ∧ a = aucCenter E N t x} + +/-- The inner averaged signed excess; it is not replaced by a maximum. -/ +def averageValues (N : E → ℝ) (t : ℝ) (x : E) (F : Cofinite E) : Set ℝ := + {a | ∃ y : E, y ∈ F.val ∧ N y = 1 ∧ + a = (N (x+t•y) + N (x-t•y))/((2 : ℕ) : ℝ) - 1} + +noncomputable def averageInner (N : E → ℝ) (t : ℝ) (x : E) (F : Cofinite E) : ℝ := + sInf (averageValues E N t x F) + +noncomputable def averageCenter (N : E → ℝ) (t : ℝ) (x : E) : ℝ := + sSup (Set.range (averageInner E N t x)) + +/-- The averaged asymptotic midpoint modulus. -/ +noncomputable def averageModulus (N : E → ℝ) (t : ℝ) : ℝ := + sInf {a | ∃ x : E, N x = 1 ∧ a = averageCenter E N t x} + +end ModulusDefinitions + +/-- An equivalent norm is kept as its exact real seminorm, with explicit positive +comparison constants. The lower inequality makes it a norm. -/ +structure EquivalentNorm (E : Type) [NormedAddCommGroup E] [NormedSpace ℝ E] + (α β : ℝ) where + N : Seminorm ℝ E + alpha_pos : 0 < α + alpha_le_beta : α ≤ β + lower : ∀ x : E, α*‖x‖ ≤ N x + upper : ∀ x : E, N x ≤ β*‖x‖ + +/-- Canonical (not merely abstract) reflexivity. -/ +def Reflexive (E : Type) [NormedAddCommGroup E] [NormedSpace ℝ E] : Prop := + Function.Surjective (NormedSpace.inclusionInDoubleDual ℝ E) + +/-- AUC requires positivity at every strictly positive parameter. -/ +def IsAUC {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] (N : E → ℝ) : Prop := + ∀ t : ℝ, 0 < t → 0 < aucModulus E N t + +/-- A finite, order-convex chain. The empty chain is a harmless zero test. -/ +def IsSegment {V : Type} [PartialOrder V] (S : Finset V) : Prop := + (∀ a ∈ S, ∀ b ∈ S, a ≤ b ∨ b ≤ a) ∧ + (∀ a ∈ S, ∀ b ∈ S, ∀ c, a ≤ c → c ≤ b → c ∈ S) + +/-- The sum of coordinates over a segment. -/ +def segSum {V : Type} (u : V → ℝ) (S : Finset V) : ℝ := ∑ v ∈ S, u v + +/-- Squared bound on every disjoint family of segment tests. -/ +def TestBound {V : Type} [PartialOrder V] (u : V → ℝ) (C : ℝ) : Prop := + ∀ (ι : Type) (_ : Fintype ι) (S : ι → Finset V), + (∀ i, IsSegment (S i)) → Pairwise (fun i j => Disjoint (S i) (S j)) → + ∑ i, segSum u (S i) ^ 2 ≤ C + +section SegmentNorm + +variable {V : Type} [PartialOrder V] + +/-- All squared disjoint-segment tests. Quantifying over finite index types +is equivalent to families S₁,...,Sₘ; a zero-sized family +adds only zero to the set of test values. -/ +def testValues (u : V → ℝ) : Set ℝ := + {r | ∃ (ι : Type) (_ : Fintype ι) (S : ι → Finset V), + (∀ i, IsSegment (S i)) ∧ Pairwise (fun i j => Disjoint (S i) (S j)) ∧ + r = ∑ i, segSum u (S i) ^ 2} + +noncomputable def squareSup (u : V → ℝ) : ℝ := sSup (testValues u) + +/-- Exactly the disjoint-segment norm, written as the square root of its +squared testing supremum. -/ +noncomputable def rho (u : V → ℝ) : ℝ := Real.sqrt (squareSup u) + +noncomputable def l1size (u : V →₀ ℝ) : ℝ := ∑ v ∈ u.support, |u v| + +end SegmentNorm + +/-- The disjoint-segment seminorm on finite coordinate vectors. -/ +def segmentSeminorm (V : Type) [PartialOrder V] : Seminorm ℝ (V →₀ ℝ) := by + have segSum_zero [PartialOrder V] (S : Finset V) : segSum (0 : V → ℝ) S = 0 := by + simp [segSum] + have segSum_add [PartialOrder V] (u v : V → ℝ) (S : Finset V) : + segSum (u + v) S = segSum u S + segSum v S := by + simp [segSum, Finset.sum_add_distrib] + have segSum_smul [PartialOrder V] (a : ℝ) (u : V → ℝ) (S : Finset V) : + segSum (a • u) S = a * segSum u S := by + simp [segSum, Finset.mul_sum] + have TestBound.nonneg {u : V → ℝ} {C : ℝ} (h : TestBound u C) : 0 ≤ C := by + simpa using h PEmpty inferInstance PEmpty.elim (by simp) (by simp [Pairwise]) + have TestBound.zero : TestBound (0 : V → ℝ) 0 := by + intro ι inst S hS hd + simp [segSum] + have TestBound.smul {u : V → ℝ} {C : ℝ} (h : TestBound u C) (a : ℝ) : + TestBound (a • u) (a ^ 2 * C) := by + intro ι inst S hS hd + have hh := mul_le_mul_of_nonneg_left (h ι inst S hS hd) (sq_nonneg a) + simpa only [segSum_smul, mul_pow, Finset.mul_sum] using hh + have TestBound.add {u v : V → ℝ} {A B : ℝ} + (hu : TestBound u (A ^ 2)) (hv : TestBound v (B ^ 2)) + (hA : 0 ≤ A) (hB : 0 ≤ B) : TestBound (u + v) ((A + B) ^ 2) := by + intro ι inst S hS hd + have h₁ := hu ι inst S hS hd + have h₂ := hv ι inst S hS hd + have hc := Real.sum_mul_le_sqrt_mul_sqrt (univ : Finset ι) + (fun i => segSum u (S i)) (fun i => segSum v (S i)) + have hs₁ : Real.sqrt (∑ i, segSum u (S i) ^ 2) ≤ A := + (Real.sqrt_le_iff).2 ⟨hA, h₁⟩ + have hs₂ : Real.sqrt (∑ i, segSum v (S i) ^ 2) ≤ B := + (Real.sqrt_le_iff).2 ⟨hB, h₂⟩ + have hc' : ∑ i, segSum u (S i) * segSum v (S i) ≤ A * B := + hc.trans (mul_le_mul hs₁ hs₂ (Real.sqrt_nonneg _) hA) + have he : (∑ i, segSum (u + v) (S i) ^ 2) = + (∑ i, segSum u (S i) ^ 2) + 2 * (∑ i, segSum u (S i) * segSum v (S i)) + + (∑ i, segSum v (S i) ^ 2) := by + simp only [segSum_add, add_sq, Finset.sum_add_distrib, Finset.mul_sum] + congr 1 + congr 1 + apply Finset.sum_congr rfl + intro i hi + ring + rw [he] + nlinarith + have zero_mem_testValues (u : V → ℝ) : 0 ∈ testValues u := by + refine ⟨PEmpty, inferInstance, PEmpty.elim, by simp, by simp [Pairwise], ?_⟩ + simp [segSum] + have TestBound.bddAbove {u : V → ℝ} {C : ℝ} (h : TestBound u C) : + BddAbove (testValues u) := by + refine ⟨C, ?_⟩ + rintro r ⟨ι, inst, S, hs, hd, rfl⟩ + exact h ι inst S hs hd + have TestBound.squareSup_le {u : V → ℝ} {C : ℝ} (h : TestBound u C) : + squareSup u ≤ C := by + apply csSup_le ⟨0, zero_mem_testValues u⟩ + rintro r ⟨ι, inst, S, hs, hd, rfl⟩ + exact h ι inst S hs hd + have testBound_squareSup {u : V → ℝ} (hu : ∃ C, TestBound u C) : + TestBound u (squareSup u) := by + intro ι inst S hs hd + exact le_csSup (TestBound.bddAbove hu.choose_spec) ⟨ι, inst, S, hs, hd, rfl⟩ + have squareSup_nonneg {u : V → ℝ} (hu : ∃ C, TestBound u C) : 0 ≤ squareSup u := + TestBound.nonneg (testBound_squareSup hu) + have rho_nonneg (u : V → ℝ) : 0 ≤ rho u := Real.sqrt_nonneg _ + have rho_sq {u : V → ℝ} (hu : ∃ C, TestBound u C) : rho u ^ 2 = squareSup u := + Real.sq_sqrt (squareSup_nonneg hu) + have testBound_rho_sq {u : V → ℝ} (hu : ∃ C, TestBound u C) : TestBound u (rho u ^ 2) := by + rw [rho_sq hu] + exact testBound_squareSup hu + have rho_le_of_testBound {u : V → ℝ} {C : ℝ} (hC : 0 ≤ C) + (hu : TestBound u (C ^ 2)) : rho u ≤ C := + Real.sqrt_le_iff.mpr ⟨hC, TestBound.squareSup_le hu⟩ + have rho_add_le {u v : V → ℝ} (hu : ∃ C, TestBound u C) (hv : ∃ C, TestBound v C) : + rho (u + v) ≤ rho u + rho v := + rho_le_of_testBound (add_nonneg (rho_nonneg u) (rho_nonneg v)) + (TestBound.add (testBound_rho_sq hu) (testBound_rho_sq hv) (rho_nonneg u) (rho_nonneg v)) + have rho_smul_le {u : V → ℝ} (hu : ∃ C, TestBound u C) (a : ℝ) : + rho (a • u) ≤ |a| * rho u := by + apply rho_le_of_testBound (mul_nonneg (abs_nonneg a) (rho_nonneg u)) + have hh := TestBound.smul (testBound_rho_sq hu) a + simpa only [mul_pow, sq_abs] using hh + have rho_zero : rho (0 : V → ℝ) = 0 := by + apply le_antisymm _ (rho_nonneg _) + apply rho_le_of_testBound (C := 0) (by norm_num) + simpa using (TestBound.zero : TestBound (0 : V → ℝ) 0) + have l1size_nonneg [PartialOrder V] (u : V →₀ ℝ) : 0 ≤ l1size u := + sum_nonneg (fun vertex _ => abs_nonneg (u vertex)) + have finset_abs_sum_le_l1size [PartialOrder V] (u : V →₀ ℝ) (S : Finset V) : + ∑ v ∈ S, |u v| ≤ l1size u := by + have he : (∑ v ∈ S ∪ u.support, |u v|) = l1size u := by + symm + apply sum_subset subset_union_right + intro v hv hn + rw [Finsupp.notMem_support_iff.mp hn, abs_zero] + rw [← he] + exact sum_le_sum_of_subset_of_nonneg subset_union_left (fun v hv hn => abs_nonneg _) + have testBound_l1size (u : V →₀ ℝ) : TestBound u (l1size u ^ 2) := by + intro ι inst S hS hd + have habs : (∑ i, |segSum u (S i)|) ≤ l1size u := by + calc + (∑ i, |segSum u (S i)|) ≤ ∑ i, ∑ v ∈ S i, |u v| := + sum_le_sum fun i hi => abs_sum_le_sum_abs _ _ + _ = ∑ v ∈ univ.biUnion S, |u v| := + (sum_biUnion (by intro i hi j hj hij; exact hd hij)).symm + _ ≤ l1size u := finset_abs_sum_le_l1size u _ + have hsq := sum_sq_le_sq_sum_of_nonneg + (s := (univ : Finset ι)) (f := fun i => |segSum u (S i)|) (fun i hi => abs_nonneg _) + simp only [sq_abs] at hsq + have hnonneg : 0 ≤ ∑ i, |segSum u (S i)| := sum_nonneg (fun i hi => abs_nonneg _) + nlinarith [l1size_nonneg u] + have finsupp_has_testBound (u : V →₀ ℝ) : ∃ C, TestBound u C := ⟨_, testBound_l1size u⟩ + exact Seminorm.ofSMulLE (fun u : V →₀ ℝ => rho u) rho_zero + (fun u v => rho_add_le (finsupp_has_testBound u) (finsupp_has_testBound v)) + (fun a u => by simpa only [Real.norm_eq_abs, Finsupp.coe_smul] using rho_smul_le (finsupp_has_testBound u) a) + +/-- Finite coordinate vectors with the segment norm (a type synonym prevents +clashes with any other norm on finitely supported functions). -/ +def TestVector (V : Type) := V →₀ ℝ + +namespace TestVector + +variable {V : Type} + +instance : AddCommGroup (TestVector V) := inferInstanceAs (AddCommGroup (V →₀ ℝ)) + +instance : Module ℝ (TestVector V) := inferInstanceAs (Module ℝ (V →₀ ℝ)) + +def toFinsupp (u : TestVector V) : V →₀ ℝ := u + +instance : CoeFun (TestVector V) (fun _ => V → ℝ) := ⟨fun u => u.toFinsupp⟩ + +variable [PartialOrder V] + +instance : Norm (TestVector V) := ⟨fun u => rho u⟩ + +instance : NormedAddCommGroup (TestVector V) := by + have isSegment_singleton (v : V) : IsSegment ({v} : Finset V) := by + constructor + · intro a ha b hb + simp only [mem_singleton] at ha hb + subst a + subst b + exact Or.inl le_rfl + · intro a ha b hb c hac hcb + simp only [mem_singleton] at ha hb ⊢ + subst a + subst b + exact le_antisymm hcb hac + have TestBound.nonneg {u : V → ℝ} {C : ℝ} (h : TestBound u C) : 0 ≤ C := by + simpa using h PEmpty inferInstance PEmpty.elim (by simp) (by simp [Pairwise]) + have TestBound.single {u : V → ℝ} {C : ℝ} (h : TestBound u C) + {S : Finset V} (hS : IsSegment S) : segSum u S ^ 2 ≤ C := by + simpa using h Unit inferInstance (fun _ => S) (fun _ => hS) + (by simp [Pairwise]) + have TestBound.bddAbove {u : V → ℝ} {C : ℝ} (h : TestBound u C) : + BddAbove (testValues u) := by + refine ⟨C, ?_⟩ + rintro r ⟨ι, inst, S, hs, hd, rfl⟩ + exact h ι inst S hs hd + have testBound_squareSup {u : V → ℝ} (hu : ∃ C, TestBound u C) : + TestBound u (squareSup u) := by + intro ι inst S hs hd + exact le_csSup (TestBound.bddAbove hu.choose_spec) ⟨ι, inst, S, hs, hd, rfl⟩ + have squareSup_nonneg {u : V → ℝ} (hu : ∃ C, TestBound u C) : 0 ≤ squareSup u := + TestBound.nonneg (testBound_squareSup hu) + have rho_nonneg (u : V → ℝ) : 0 ≤ rho u := Real.sqrt_nonneg _ + have rho_sq {u : V → ℝ} (hu : ∃ C, TestBound u C) : rho u ^ 2 = squareSup u := + Real.sq_sqrt (squareSup_nonneg hu) + have testBound_rho_sq {u : V → ℝ} (hu : ∃ C, TestBound u C) : TestBound u (rho u ^ 2) := by + rw [rho_sq hu] + exact testBound_squareSup hu + have coordinate_le_rho {u : V → ℝ} (hu : ∃ C, TestBound u C) (v : V) : + |u v| ≤ rho u := by + have hh := TestBound.single (testBound_rho_sq hu) (isSegment_singleton v) + simp only [segSum, sum_singleton] at hh + exact (sq_le_sq₀ (abs_nonneg _) (rho_nonneg _)).mp (by simpa only [sq_abs] using hh) + have l1size_nonneg [PartialOrder V] (u : V →₀ ℝ) : 0 ≤ l1size u := + sum_nonneg (fun vertex _ => abs_nonneg (u vertex)) + have finset_abs_sum_le_l1size [PartialOrder V] (u : V →₀ ℝ) (S : Finset V) : + ∑ v ∈ S, |u v| ≤ l1size u := by + have he : (∑ v ∈ S ∪ u.support, |u v|) = l1size u := by + symm + apply sum_subset subset_union_right + intro v hv hn + rw [Finsupp.notMem_support_iff.mp hn, abs_zero] + rw [← he] + exact sum_le_sum_of_subset_of_nonneg subset_union_left (fun v hv hn => abs_nonneg _) + have testBound_l1size (u : V →₀ ℝ) : TestBound u (l1size u ^ 2) := by + intro ι inst S hS hd + have habs : (∑ i, |segSum u (S i)|) ≤ l1size u := by + calc + (∑ i, |segSum u (S i)|) ≤ ∑ i, ∑ v ∈ S i, |u v| := + sum_le_sum fun i hi => abs_sum_le_sum_abs _ _ + _ = ∑ v ∈ univ.biUnion S, |u v| := + (sum_biUnion (by intro i hi j hj hij; exact hd hij)).symm + _ ≤ l1size u := finset_abs_sum_le_l1size u _ + have hsq := sum_sq_le_sq_sum_of_nonneg + (s := (univ : Finset ι)) (f := fun i => |segSum u (S i)|) (fun i hi => abs_nonneg _) + simp only [sq_abs] at hsq + have hnonneg : 0 ≤ ∑ i, |segSum u (S i)| := sum_nonneg (fun i hi => abs_nonneg _) + nlinarith [l1size_nonneg u] + have finsupp_has_testBound (u : V →₀ ℝ) : ∃ C, TestBound u C := ⟨_, testBound_l1size u⟩ + exact NormedAddCommGroup.ofCore (𝕜 := ℝ) { + norm_nonneg u := apply_nonneg (segmentSeminorm V) u.toFinsupp + norm_triangle u v := map_add_le_add (segmentSeminorm V) u.toFinsupp v.toFinsupp + norm_smul a u := map_smul_eq_mul (segmentSeminorm V) a u.toFinsupp + norm_eq_zero_iff u := ⟨by + intro h + apply Finsupp.ext + intro v + have hh := coordinate_le_rho (finsupp_has_testBound u.toFinsupp) v + change rho u.toFinsupp = 0 at h + rw [h] at hh + exact abs_nonpos_iff.mp hh, by + rintro rfl + exact map_zero (segmentSeminorm V)⟩ } + +instance : NormedSpace ℝ (TestVector V) where + norm_smul_le a u := le_of_eq (map_smul_eq_mul (segmentSeminorm V) a u.toFinsupp) + +end TestVector + +/-- J(T), completion of the finite-support disjoint-segment norm. -/ +abbrev J (V : Type) [PartialOrder V] := UniformSpace.Completion (TestVector V) + +/-- The full continuous dual, used for the finite-height forest example. -/ +abbrev FullDual (V : Type) [PartialOrder V] := StrongDual ℝ (J V) + +section CoordinateCompletion + +variable {W : no_index Type} [PartialOrder W] + +instance fullDualAddCommGroup : AddCommGroup (FullDual W) := + inferInstanceAs (AddCommGroup (StrongDual ℝ (J W))) + +end CoordinateCompletion + +/-- Finite words, ordered by extension, including the empty root. -/ +structure Word where + letters : List ℕ + deriving DecidableEq + +namespace Word + +instance : PartialOrder Word where + le a b := a.letters <+: b.letters + le_refl _ := List.prefix_rfl + le_trans _ _ _ := List.IsPrefix.trans + le_antisymm a b hab hba := by + have h := hab.eq_of_length (Nat.le_antisymm hab.length_le hba.length_le) + cases a; cases b; cases h; rfl + +end Word + +/-- A disjoint forest: one copy of `Nat^{≤h}` for every `h≥1`. -/ +structure Vertex where + height : ℕ + positive : 1 ≤ height + word : Word + bounded : word.letters.length ≤ height + deriving DecidableEq + +namespace Vertex + +instance : PartialOrder Vertex where + le a b := a.height = b.height ∧ a.word ≤ b.word + le_refl _ := ⟨rfl,le_rfl⟩ + le_trans a b c hab hbc := ⟨hab.1.trans hbc.1,hab.2.trans hbc.2⟩ + le_antisymm a b hab hba := by + obtain ⟨hh, hw⟩ := hab + have he := le_antisymm hw hba.2 + cases a; cases b; cases hh; cases he; rfl + +end Vertex + +namespace Diamond + +/-- An oriented edge enumeration; only the associated undirected unit-edge +simple graph is used for distances. -/ +structure Network where + V : Type + E : Type + left : E → V + right : E → V + distinct : ∀ e, left e ≠ right e + +namespace Network + +variable (A : Network) + +def graph : SimpleGraph A.V where + Adj u v := ∃ e : A.E, (A.left e = u ∧ A.right e = v) ∨ + (A.right e = u ∧ A.left e = v) + symm := ⟨by + rintro u v ⟨e,h | h⟩ + · exact ⟨e,Or.inr ⟨h.2,h.1⟩⟩ + · exact ⟨e,Or.inl ⟨h.2,h.1⟩⟩⟩ + loopless := ⟨by + rintro u ⟨e,h | h⟩ + · exact A.distinct e (h.1.trans h.2.symm) + · exact A.distinct e (h.2.trans h.1.symm)⟩ + +/-- Every edge is replaced by countably many internally disjoint two-edge +paths. All old vertices remain, and each pair (edge,index) is a new midpoint. -/ +@[reducible] def refine : Network where + V := Sum A.V (A.E × ℕ) + E := A.E × ℕ × Bool + left e := if e.2.2 then Sum.inr (e.1,e.2.1) else Sum.inl (A.left e.1) + right e := if e.2.2 then Sum.inl (A.right e.1) else Sum.inr (e.1,e.2.1) + distinct := by rintro ⟨e,j,b⟩; cases b <;> simp + +/-- Iterating the very same edge replacement, starting from an arbitrary +network. This recursion groups the first replacement before the remaining ones. -/ +@[reducible] def iterate : Network → ℕ → Network + | A,0 => A + | A,n+1 => iterate A.refine n + +end Network + +/-- D₀ is precisely one edge. -/ +@[reducible] def base : Network where + V := Bool + E := Unit + left _ := false + right _ := true + distinct _ := by decide + +/-- Countably branching diamonds, all current edges of length one. -/ +@[reducible] def diamond (k : ℕ) := base.iterate k + +/-- The shortest-path distance, via Mathlib's actual graph distance. -/ +def distance (k : ℕ) (u v : (diamond k).V) : ℝ := ((diamond k).graph.dist u v : ℝ) +variable {E : Type} [NormedAddCommGroup E] [NormedSpace ℝ E] + +/-- The distortion convention, including its arbitrary positive scale. -/ +def EmbeddingBound (k : ℕ) (f : (diamond k).V → E) (C : ℝ) : Prop := + ∃ s : ℝ, 0 < s ∧ ∀ u v, + s*distance k u v ≤ ‖f u-f v‖ ∧ ‖f u-f v‖ ≤ C*s*distance k u v + +end Diamond + +/-- The space +is the full continuous dual of the specified segment-norm completion, not the +coordinate completion in place of that dual. -/ +theorem main_theorem : + (¬FiniteDimensional ℝ (FullDual Vertex)) ∧ + TopologicalSpace.SeparableSpace (FullDual Vertex) ∧ + Reflexive (FullDual Vertex) ∧ + (∀ (α β : ℝ) (R : EquivalentNorm (FullDual Vertex) α β), ¬IsAUC R.N) ∧ + (∀ t : ℝ, 0 < t → + Real.sqrt (1+t^2/12)-1 ≤ averageModulus (FullDual Vertex) norm t) ∧ + (∀ (k : ℕ) (f : (Diamond.diamond k).V → FullDual Vertex) (C : ℝ), + Diamond.EmbeddingBound k f C → Real.sqrt (1+(k:ℝ)/12) ≤ C) := by + sorry + +end ForestSpace + +end + +end OAI diff --git a/lean/ComparatorChallenges/FormulaHitting.json b/lean/ComparatorChallenges/FormulaHitting.json new file mode 100644 index 0000000000000000000000000000000000000000..1b557550eb85b1f56df5b1edb8d5278e4db2401b --- /dev/null +++ b/lean/ComparatorChallenges/FormulaHitting.json @@ -0,0 +1,13 @@ +{ + "challenge_module": "ComparatorChallenges.FormulaHitting", + "solution_module": "OAI.Algebra.FormulaHitting.Hitting", + "theorem_names": [ + "OAI.NCHitting.universal_hitting" + ], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/FormulaHitting.lean b/lean/ComparatorChallenges/FormulaHitting.lean new file mode 100644 index 0000000000000000000000000000000000000000..3c184de016d7f0265b9745e52a0b3540beb63da3 --- /dev/null +++ b/lean/ComparatorChallenges/FormulaHitting.lean @@ -0,0 +1,66 @@ +import Mathlib.Data.Matrix.Basic +import Mathlib.Data.Rat.Defs + +namespace OAI + +namespace NCHitting + +abbrev Word (n : ℕ) := List (Fin n) +abbrev WordSeries (F : Type*) (n : ℕ) := Word n → F + +def convolution {F : Type*} {n : ℕ} [Semiring F] + (f g : WordSeries F n) : Word n → F + | [] => f [] * g [] + | i :: w => f [] * g (i :: w) + convolution (fun v => f (i :: v)) g w + +inductive Formula (F : Type*) (n : ℕ) where + | scalar : F → Formula F n + | var : Fin n → Formula F n + | add : Formula F n → Formula F n → Formula F n + | mul : Formula F n → Formula F n → Formula F n + +namespace Formula + +def size {F : Type*} {n : ℕ} : Formula F n → ℕ + | scalar _ => 1 + | var _ => 1 + | add f g => f.size + g.size + 1 + | mul f g => f.size + g.size + 1 + +noncomputable def coeff {F : Type*} {n : ℕ} [Semiring F] : + Formula F n → WordSeries F n + | scalar a => fun w => if w = [] then a else 0 + | var i => fun w => if w = [i] then 1 else 0 + | add f g => fun w => coeff f w + coeff g w + | mul f g => convolution (coeff f) (coeff g) + +def eval {F A : Type*} {n : ℕ} [Semiring A] + (scalarMap : F → A) (T : Fin n → A) : Formula F n → A + | scalar a => scalarMap a + | var i => T i + | add f g => eval scalarMap T f + eval scalarMap T g + | mul f g => eval scalarMap T f * eval scalarMap T g + +end Formula + +def dimension (n s : ℕ) : ℕ := if n = 1 ∧ s = 1 then 1 else 2 * n * s ^ 2 + +def matrixEntry (i r q : ℕ) : ℚ := + if q < r then (-1 : ℚ) ^ (r - q - 1) / ((r : ℚ) * (i : ℚ) ^ (r - q)) + else 0 + +def generator (n s : ℕ) : Fin n → Matrix (Fin (dimension n s)) (Fin (dimension n s)) ℚ := + fun i r q => if n = 1 ∧ s = 1 then 1 else matrixEntry (i.val + 1) r.val q.val + +universe u_2 + +theorem universal_hitting (n s : ℕ) (hn : 1 ≤ n) (hs : 1 ≤ s) + (F : Type u_2) [Field F] [CharZero F] (f : Formula F n) + (hsize : f.size ≤ s) (hf : ∃ w, f.coeff w ≠ 0) : + f.eval (Matrix.scalar (Fin (dimension n s))) + (fun i r q => (generator n s i r q : F)) ≠ 0 := by + sorry + +end NCHitting + +end OAI diff --git a/lean/ComparatorChallenges/FoulkesHowe.json b/lean/ComparatorChallenges/FoulkesHowe.json new file mode 100644 index 0000000000000000000000000000000000000000..082b9b6f5adc468d87281a158640dc268eaac39d --- /dev/null +++ b/lean/ComparatorChallenges/FoulkesHowe.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.FoulkesHowe", + "solution_module": "OAI.RepresentationTheory.FoulkesHowe.Stabilization", + "theorem_names": [ + "OAI.Problem346.canonical_foulkes_howe_surjective" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/FoulkesHowe.lean b/lean/ComparatorChallenges/FoulkesHowe.lean new file mode 100644 index 0000000000000000000000000000000000000000..2320f7269dac7ccd52e0a49325ae4acc7e28432e --- /dev/null +++ b/lean/ComparatorChallenges/FoulkesHowe.lean @@ -0,0 +1,50 @@ +import Mathlib + +namespace OAI + +noncomputable section + +open scoped BigOperators +universe u + +namespace Problem346 + +def symMonomialRaw (n : ℕ) (V : Type u) [AddCommGroup V] [Module ℂ V] + (v : Fin n → V) : SymmetricAlgebra ℂ V := + ∏ i : Fin n, SymmetricAlgebra.ι ℂ V (v i) + +def symPowSubmodule (n : ℕ) (V : Type u) [AddCommGroup V] [Module ℂ V] : + Submodule ℂ (SymmetricAlgebra ℂ V) := + Submodule.span ℂ (Set.range (symMonomialRaw n V)) + +abbrev SymPow (n : ℕ) (V : Type u) [AddCommGroup V] [Module ℂ V] := + ↥(symPowSubmodule n V) + +def symMonomial (n : ℕ) (V : Type u) [AddCommGroup V] [Module ℂ V] + (v : Fin n → V) : SymPow n V := + ⟨symMonomialRaw n V v, Submodule.subset_span (Set.mem_range_self v)⟩ + +def foulkesFormula (a b : ℕ) (V : Type u) [AddCommGroup V] [Module ℂ V] + (v : Fin b → Fin a → V) : SymPow a (SymPow b V) := by + classical + exact + ((a.factorial : ℂ) ^ b)⁻¹ • + ∑ σ : Fin b → Equiv.Perm (Fin a), + symMonomial a (SymPow b V) + (fun i => symMonomial b V (fun j => v j ((σ j) i))) + +def IsFoulkesMap (a b : ℕ) (V : Type u) [AddCommGroup V] [Module ℂ V] + (μ : SymPow b (SymPow a V) →ₗ[ℂ] SymPow a (SymPow b V)) : Prop := + ∀ v : Fin b → Fin a → V, + μ (symMonomial b (SymPow a V) (fun j => symMonomial a V (v j))) = + foulkesFormula a b V v + +theorem canonical_foulkes_howe_surjective : + ∀ (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 + sorry + +end Problem346 + +end + +end OAI diff --git a/lean/ComparatorChallenges/FourRowPermanent.json b/lean/ComparatorChallenges/FourRowPermanent.json new file mode 100644 index 0000000000000000000000000000000000000000..905c9ad52b8e5e6897ff80b744edfe92d38725a1 --- /dev/null +++ b/lean/ComparatorChallenges/FourRowPermanent.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.FourRowPermanent", + "solution_module": "OAI.Combinatorics.Permanent.Main", + "theorem_names": [ + "OAI.FourRow.robust_permanent" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/FourRowPermanent.lean b/lean/ComparatorChallenges/FourRowPermanent.lean new file mode 100644 index 0000000000000000000000000000000000000000..0d58c8b146ddadde68e2ee900133094c0f2bda25 --- /dev/null +++ b/lean/ComparatorChallenges/FourRowPermanent.lean @@ -0,0 +1,48 @@ +import Mathlib + +namespace OAI + +/-! +# A robust four-row permanent inequality + +`Fin 4` labels four sites. A law is represented by real probability masses; +`IsProbability` asserts nonnegativity and total mass one. All row norms use +the uniform counting normalization. +-/ + +noncomputable section +namespace FourRow +open scoped BigOperators + +abbrev Site := Fin 4 +abbrev Perm := Equiv.Perm Site +abbrev Law := Perm → ℝ +abbrev Functions := Site → Site → ℝ + +def IsProbability (ν : Law) : Prop := + (∀ π, 0 ≤ ν π) ∧ ∑ π, ν π = 1 + +def UniformMarginals (ν : Law) : Prop := + ∀ i j : Site, ∑ π, (if π i = j then ν π else 0) = 1 / 4 + +def totalVariation (ν : Law) : ℝ := + (∑ π, |ν π - 1 / 24|) / 2 + +def lpNorm (p : ℝ) (f : Site → ℝ) : ℝ := + ((∑ j, (f j) ^ p) / 4) ^ (1 / p) + +def permanentExpectation (ν : Law) (f : Functions) : ℝ := + ∑ π, ν π * ∏ i, f i (π i) + +theorem robust_permanent : + ∃ p₀ : ℝ, 4 / 3 < p₀ ∧ p₀ < 2 ∧ + ∃ ε : ℝ, 0 < ε ∧ ∀ ν : Law, + IsProbability ν → totalVariation ν < ε → UniformMarginals ν → + ∀ f : Functions, (∀ i j, 0 ≤ f i j) → + permanentExpectation ν f ≤ ∏ i, lpNorm p₀ (f i) := by + sorry + +end FourRow +end + +end OAI diff --git a/lean/ComparatorChallenges/FreeIsing.json b/lean/ComparatorChallenges/FreeIsing.json new file mode 100644 index 0000000000000000000000000000000000000000..2f2dd5ff61194eb7a171e25ac3fb3ffd045950e5 --- /dev/null +++ b/lean/ComparatorChallenges/FreeIsing.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.FreeIsing", + "definition_names": [], + "enable_nanoda": false, + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "solution_module": "OAI.Probability.FreeIsing.Main", + "theorem_names": [ + "OAI.Problem367.free_ising_factor_iff_threshold" + ] +} diff --git a/lean/ComparatorChallenges/FreeIsing.lean b/lean/ComparatorChallenges/FreeIsing.lean new file mode 100644 index 0000000000000000000000000000000000000000..fa9db545bea8cd0291e8ad2dd025c95ce62499ef --- /dev/null +++ b/lean/ComparatorChallenges/FreeIsing.lean @@ -0,0 +1,95 @@ +import Mathlib + +namespace OAI + +noncomputable section + +open MeasureTheory + +namespace Problem367 + +abbrev TreeVertex (d : ℕ) := + {word : List (Fin d) // List.IsChain (fun first second : Fin d => first ≠ second) word} + +def treeAdj {d : ℕ} (u v : TreeVertex d) : Prop := + (∃ c : Fin d, v.1 = u.1 ++ [c]) ∨ + (∃ c : Fin d, u.1 = v.1 ++ [c]) + +structure TreeAut (d : ℕ) where + toEquiv : TreeVertex d ≃ TreeVertex d + map_adj : ∀ u v, treeAdj (toEquiv u) (toEquiv v) ↔ treeAdj u v + +def relabel {d : ℕ} {α : Type*} (g : TreeAut d) + (x : TreeVertex d → α) : TreeVertex d → α := + fun v => x (g.toEquiv.symm v) + +inductive IsingSpin where + | neg + | pos + deriving DecidableEq + +protected abbrev IsingSpin.enumList : List IsingSpin := [.neg, .pos] + +protected theorem IsingSpin.enumList_getElem?_ctorIdx_eq (x : IsingSpin) : + IsingSpin.enumList[x.ctorIdx]? = some x := by + cases x <;> rfl + +protected theorem IsingSpin.enumList_nodup : IsingSpin.enumList.Nodup := by decide + +instance : Fintype IsingSpin where + elems := ⟨IsingSpin.enumList, IsingSpin.enumList_nodup⟩ + complete x := by cases x <;> decide + +instance isingSpinMeasurable : MeasurableSpace IsingSpin := ⊤ + +def uniform01 : Measure ℝ := + volume.restrict (Set.Icc (0 : ℝ) 1) + +instance uniform01Probability : IsProbabilityMeasure uniform01 where + measure_univ := by simp [uniform01] + +def labelMeasure (d : ℕ) : Measure (TreeVertex d → ℝ) := by + classical + exact Measure.infinitePi (fun _ : TreeVertex d => uniform01) + +def ConnectedFinset {d : ℕ} (D : Finset (TreeVertex d)) : Prop := + D.Nonempty ∧ + ∀ u ∈ D, ∀ v ∈ D, + Relation.ReflTransGen + (fun x y : TreeVertex d => x ∈ D ∧ y ∈ D ∧ treeAdj x y) u v + +def inducedEdges {d : ℕ} (D : Finset (TreeVertex d)) : + Finset (TreeVertex d × TreeVertex d) := by + classical + exact (D.product D).filter (fun e => + treeAdj e.1 e.2 ∧ e.1.1.length < e.2.1.length) + +def freeCylinderWeight {d : ℕ} (theta : ℝ) + (D : Finset (TreeVertex d)) (eta : TreeVertex d → IsingSpin) : ENNReal := + ENNReal.ofReal + ((1 / 2 : ℝ) * + Finset.prod (inducedEdges D) (fun e => + (1 + (if eta e.1 = eta e.2 then theta else -theta)) / 2)) + +def HasFreeIsingLaw {d : ℕ} (theta : ℝ) + (mu : Measure (TreeVertex d → IsingSpin)) : Prop := + ∀ (D : Finset (TreeVertex d)), ConnectedFinset D → + ∀ eta : TreeVertex d → IsingSpin, + mu {x | ∀ v ∈ D, x v = eta v} = freeCylinderWeight theta D eta + +def IsFactorOfIID (d : ℕ) (theta : ℝ) : Prop := + ∃ Phi : (TreeVertex d → ℝ) → (TreeVertex d → IsingSpin), + Measurable Phi ∧ + HasFreeIsingLaw theta (Measure.map Phi (labelMeasure d)) ∧ + ∀ g : TreeAut d, + ∀ᵐ U ∂labelMeasure d, Phi (relabel g U) = relabel g (Phi U) + +theorem free_ising_factor_iff_threshold : + ∀ (d : ℕ) (beta : ℝ), 3 ≤ d → 0 ≤ beta → (IsFactorOfIID d (Real.tanh beta) ↔ Real.tanh beta ≤ 1 / Real.sqrt ((d : ℝ) - 1)) := by + sorry + +end Problem367 + +end + +end OAI diff --git a/lean/ComparatorChallenges/FreeUniformSpanningForest.json b/lean/ComparatorChallenges/FreeUniformSpanningForest.json new file mode 100644 index 0000000000000000000000000000000000000000..015f336785db84710a16452fbf09c0b5e94ffd30 --- /dev/null +++ b/lean/ComparatorChallenges/FreeUniformSpanningForest.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.FreeUniformSpanningForest", + "solution_module": "OAI.Probability.SpanningForest.Factor", + "theorem_names": [ + "OAI.Problem336.fusf_is_factor_iid" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/FreeUniformSpanningForest.lean b/lean/ComparatorChallenges/FreeUniformSpanningForest.lean new file mode 100644 index 0000000000000000000000000000000000000000..b453c8048e79875ea822e1fd651f39158d27720a --- /dev/null +++ b/lean/ComparatorChallenges/FreeUniformSpanningForest.lean @@ -0,0 +1,149 @@ +import Mathlib + +namespace OAI + +noncomputable section + +open MeasureTheory +open scoped BigOperators ENNReal Topology + +namespace Problem336 + +abbrev GraphCode := + {a : ℕ → ℕ → Bool // + (∀ u, a u u = false) ∧ (∀ u v, a u v = a v u)} + +abbrev EdgeCode := {p : ℕ × ℕ // p.1 < p.2} + +abbrev EdgeConfiguration := EdgeCode → Bool + +abbrev FactorRule := GraphCode → (ℕ → ℝ) → EdgeCode → Bool + +abbrev FiniteSubgraphCode := Finset ℕ × Finset (ℕ × ℕ) + +def Adj (G : GraphCode) (u v : ℕ) : Prop := G.1 u v = true + +def GraphConnected (G : GraphCode) : Prop := + ∀ u v, Relation.ReflTransGen (fun x y => Adj G x y) u v + +def GraphLocallyFinite (G : GraphCode) : Prop := + ∀ u, Set.Finite {v : ℕ | Adj G u v} + +def mkEdge (u v : ℕ) (h : u ≠ v) : EdgeCode := by + by_cases huv : u < v + · exact ⟨(u, v), huv⟩ + · exact ⟨(v, u), lt_of_le_of_ne (Nat.le_of_not_gt huv) (Ne.symm h)⟩ + +def rawPair (u v : ℕ) : ℕ × ℕ := + if u < v then (u, v) else (v, u) + +def relabelGraph (σ : Equiv ℕ ℕ) (G : GraphCode) : GraphCode := + ⟨fun u v => G.1 (σ.symm u) (σ.symm v), by + constructor + · intro u + exact G.2.1 (σ.symm u) + · intro u v + exact G.2.2 (σ.symm u) (σ.symm v)⟩ + +def relabelLabels (σ : Equiv ℕ ℕ) (U : ℕ → ℝ) : ℕ → ℝ := + fun u => U (σ.symm u) + +def mapEdge (σ : Equiv ℕ ℕ) (e : EdgeCode) : EdgeCode := + mkEdge (σ e.1.1) (σ e.1.2) (by + intro h + apply Nat.ne_of_lt e.2 + exact σ.injective h) + +def RuleBorel (Phi : FactorRule) : Prop := + Measurable + (fun q : GraphCode × ((ℕ → ℝ) × EdgeCode) => + Phi q.1 q.2.1 q.2.2) + +def RuleEquivariant (Phi : FactorRule) : Prop := + ∀ (σ : Equiv ℕ ℕ) (G : GraphCode) (U : ℕ → ℝ) (e : EdgeCode), + Phi (relabelGraph σ G) (relabelLabels σ U) (mapEdge σ e) = + Phi G U e + +def TreeAdj (T : Finset (ℕ × ℕ)) (u v : ℕ) : Prop := + rawPair u v ∈ T + +def SubgraphAdj (K : FiniteSubgraphCode) (u v : ℕ) : Prop := + u ∈ K.1 ∧ v ∈ K.1 ∧ rawPair u v ∈ K.2 + +def TreeOn (K : FiniteSubgraphCode) + (T : Finset (ℕ × ℕ)) : Prop := + T ⊆ K.2 ∧ + T.card + 1 = K.1.card ∧ + ∀ u ∈ K.1, ∀ v ∈ K.1, + Relation.ReflTransGen (TreeAdj T) u v + +def spanningTrees (K : FiniteSubgraphCode) : + Finset (Finset (ℕ × ℕ)) := by + classical + exact K.2.powerset.filter (TreeOn K) + +def ustCylinder (K : FiniteSubgraphCode) + (A B : Finset EdgeCode) : ℝ≥0∞ := by + classical + let all := spanningTrees K + let good := all.filter (fun T => + (∀ e ∈ A, e.1 ∈ T) ∧ (∀ e ∈ B, e.1 ∉ T)) + exact (good.card : ℝ≥0∞) / (all.card : ℝ≥0∞) + +def IsFiniteConnectedSubgraph + (G : GraphCode) (K : FiniteSubgraphCode) : Prop := + K.1.Nonempty ∧ + (∀ p ∈ K.2, + p.1 ∈ K.1 ∧ p.2 ∈ K.1 ∧ p.1 < p.2 ∧ Adj G p.1 p.2) ∧ + ∀ u ∈ K.1, ∀ v ∈ K.1, + Relation.ReflTransGen (SubgraphAdj K) u v + +def IsConnectedExhaustion + (G : GraphCode) (H : ℕ → FiniteSubgraphCode) : Prop := + (∀ n, IsFiniteConnectedSubgraph G (H n)) ∧ + (∀ n, (H n).1 ⊆ (H (n + 1)).1 ∧ + (H n).2 ⊆ (H (n + 1)).2) ∧ + (∀ u v, u < v → Adj G u v → + ∃ n, (u, v) ∈ (H n).2) + +def uniform01 : Measure ℝ := + volume.restrict (Set.Icc (0 : ℝ) 1) + +def IsVertexIID {Ω : Type} [MeasurableSpace Ω] + (P : Measure Ω) (U : ℕ → Ω → ℝ) : Prop := + (∀ i, Measurable (U i)) ∧ + ∀ (s : Finset ℕ) (A : ℕ → Set ℝ), + (∀ i ∈ s, MeasurableSet (A i)) → + P {ω | ∀ i ∈ s, U i ω ∈ A i} = + Finset.prod s (fun i => uniform01 (A i)) + +def HasFUSFLaw {Ω : Type} [MeasurableSpace Ω] + (G : GraphCode) (P : Measure Ω) + (X : Ω → EdgeConfiguration) : Prop := + (∀ e, Measurable (fun ω => X ω e)) ∧ + ∀ (H : ℕ → FiniteSubgraphCode), IsConnectedExhaustion G H → + ∀ (A B : Finset EdgeCode), + Filter.Tendsto + (fun n => ustCylinder (H n) A B) + Filter.atTop + (nhds (P {ω | + (∀ e ∈ A, X ω e = true) ∧ + (∀ e ∈ B, X ω e = false)})) + +def WorksOnGraph (Phi : FactorRule) (G : GraphCode) : Prop := + GraphConnected G → GraphLocallyFinite G → + ∀ (Ω : Type) [MeasurableSpace Ω] (P : Measure Ω) + (U : ℕ → Ω → ℝ), + IsVertexIID P U → + HasFUSFLaw G P + (fun ω e => Phi G (fun v => U v ω) e) + +theorem fusf_is_factor_iid : + ∃ Phi : FactorRule, RuleBorel Phi ∧ RuleEquivariant Phi ∧ ∀ G : GraphCode, WorksOnGraph Phi G := by + sorry + +end Problem336 + +end + +end OAI diff --git a/lean/ComparatorChallenges/GammaPassage.json b/lean/ComparatorChallenges/GammaPassage.json new file mode 100644 index 0000000000000000000000000000000000000000..b1d09b083ae804e828b4fa68fac8a0fb03bafd87 --- /dev/null +++ b/lean/ComparatorChallenges/GammaPassage.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.GammaPassage", + "solution_module": "OAI.Probability.GammaPassage.Differentiability", + "theorem_names": [ + "OAI.GammaFPP.gamma_differentiability" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/GammaPassage.lean b/lean/ComparatorChallenges/GammaPassage.lean new file mode 100644 index 0000000000000000000000000000000000000000..6b2a0bc5cb47eae4ea01c65bdcf3b41b7a025573 --- /dev/null +++ b/lean/ComparatorChallenges/GammaPassage.lean @@ -0,0 +1,112 @@ +import Mathlib.Algebra.BigOperators.Group.List.Basic +import Mathlib.Algebra.Group.Prod +import Mathlib.Analysis.Calculus.ContDiff.Defs +import Mathlib.Analysis.Calculus.Deriv.Basic +import Mathlib.Analysis.Calculus.FDeriv.Basic +import Mathlib.Analysis.InnerProductSpace.PiL2 +import Mathlib.Probability.Distributions.Gamma +import Mathlib.Probability.Independence.Basic + +namespace OAI + +namespace PlanarFPP + +open Set MeasureTheory ProbabilityTheory Filter +open scoped Topology + +abbrev Vertex := ℤ × ℤ + +abbrev Edge := Vertex × Bool + +inductive Step where + | east | west | north | south + deriving DecidableEq + +def Step.delta : Step → Vertex + | .east => (1, 0) + | .west => (-1, 0) + | .north => (0, 1) + | .south => (0, -1) + +def Step.edge (p : Vertex) : Step → Edge + | .east => (p, false) + | .west => (p + (-1, 0), false) + | .north => (p, true) + | .south => (p + (0, -1), true) + +def displacement (ds : List Step) : Vertex := (ds.map Step.delta).sum + +def pathCost (τ : Edge → ℝ) (p : Vertex) : List Step → ℝ + | [] => 0 + | d :: ds => τ (d.edge p) + pathCost τ (p + d.delta) ds + +abbrev Plane := EuclideanSpace ℝ (Fin 2) + +noncomputable def latticeFloor (v : Plane) : Vertex := (⌊v 0⌋, ⌊v 1⌋) + +noncomputable def passageTime (τ : Edge → ℝ) (p q : Vertex) : ℝ := + sInf {t | ∃ ds : List Step, p + displacement ds = q ∧ pathCost τ p ds = t} + +structure TimeConstantNorm (μ : Plane → ℝ) : Prop where + nonneg : ∀ v, 0 ≤ μ v + zero_iff : ∀ v, μ v = 0 ↔ v = 0 + triangle : ∀ v w, μ (v + w) ≤ μ v + μ w + homogeneous : ∀ (a : ℝ) v, μ (a • v) = |a| * μ v + +def IsTimeConstant {Ω : Type*} [MeasurableSpace Ω] + (P : Measure Ω) (τ : Edge → Ω → ℝ) (μ : Plane → ℝ) : Prop := + ∀ v : Plane, ∀ᵐ ω ∂P, + Tendsto (fun t : ℝ => passageTime (fun e => τ e ω) (0, 0) + (latticeFloor (t • v)) / t) atTop (𝓝 (μ v)) + +def DifferentiableAwayFromOrigin (μ : Plane → ℝ) : Prop := + ∀ v : Plane, v ≠ 0 → ∃ ℓ : Plane →L[ℝ] ℝ, HasFDerivAt μ ℓ v + +end PlanarFPP + +namespace GammaFPP + +open Set MeasureTheory ProbabilityTheory PlanarFPP + +structure IidEnvironment {Ω : Type*} [MeasurableSpace Ω] + (ν : Measure ℝ) (P : Measure Ω) (τ : PlanarFPP.Edge → Ω → ℝ) : Prop where + probability : IsProbabilityMeasure P + measurable : ∀ e, Measurable (τ e) + independent : iIndepFun τ P + marginal : ∀ e, Measure.map (τ e) P = ν + + +abbrev GammaEnvironment {Ω : Type*} [MeasurableSpace Ω] + (shape rate : ℝ) (P : Measure Ω) (τ : PlanarFPP.Edge → Ω → ℝ) := + IidEnvironment (gammaMeasure shape rate) P τ + + +/-- A regular C¹ parametrization of the curve near a point, with a continuous inverse. -/ +def HasC1CurveChart (S : Set Plane) (v : Plane) : Prop := + ∃ U : Set Plane, IsOpen U ∧ v ∈ U ∧ v ∈ S ∧ ∃ γ : ℝ → Plane, ∃ θ : Plane → ℝ, + ContDiff ℝ 1 γ ∧ ContinuousOn θ U ∧ + (∀ t, γ t ∈ S ∩ U) ∧ (∀ t, θ (γ t)=t) ∧ + (∀ z ∈ S ∩ U, γ (θ z)=z) ∧ + (∀ t, ∃ d : Plane, HasDerivAt γ d t ∧ d ≠ 0) + +/-- The Gamma theorem: an actual deterministic passage-time limit norm exists +for every positive shape and rate and every iid environment with that law. +Its Frechet differentiability and literal unit-ball boundary charts are +conclusions. No shape theorem, norm, or no-corner hypothesis is supplied. -/ +def GammaDifferentiabilityTarget : Prop := + ∀ (shape rate : ℝ), 0 < shape → 0 < rate → + ∀ (Ω : Type) [MeasurableSpace Ω] (P : Measure Ω) + (τ : PlanarFPP.Edge → Ω → ℝ), + GammaEnvironment shape rate P τ → + ∃ μ : Plane → ℝ, + TimeConstantNorm μ ∧ IsTimeConstant P τ μ ∧ + DifferentiableAwayFromOrigin μ ∧ + ∀ v ∈ frontier {z : Plane | μ z ≤ 1}, + HasC1CurveChart (frontier {z : Plane | μ z ≤ 1}) v + +theorem gamma_differentiability : GammaDifferentiabilityTarget := by + sorry + +end GammaFPP + +end OAI diff --git a/lean/ComparatorChallenges/GaussianFiniteEntropy.json b/lean/ComparatorChallenges/GaussianFiniteEntropy.json new file mode 100644 index 0000000000000000000000000000000000000000..eb9b81151d19cdf1822da9360cd41523df1fe152 --- /dev/null +++ b/lean/ComparatorChallenges/GaussianFiniteEntropy.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.GaussianFiniteEntropy", + "solution_module": "OAI.Probability.Localization.Main", + "theorem_names": [ + "OAI.RepeatedLocalization.FiniteEntropy.finite_expected_regularization" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Classical.choice", + "Quot.sound" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/GaussianFiniteEntropy.lean b/lean/ComparatorChallenges/GaussianFiniteEntropy.lean new file mode 100644 index 0000000000000000000000000000000000000000..ad8a3f5e4aefdc97908deeacd5bdddd3745344a0 --- /dev/null +++ b/lean/ComparatorChallenges/GaussianFiniteEntropy.lean @@ -0,0 +1,205 @@ +import Mathlib + +namespace OAI + +open MeasureTheory ProbabilityTheory Set +open scoped BigOperators ENNReal + +namespace RepeatedLocalization + +abbrev Coordinate (n : ℕ) := Fin n → ℝ +abbrev GaussianBlock (n : ℕ) := Fin (n / 16) → Fin (n + 1) → ℝ +abbrev Label (n : ℕ) := Fin (n / 16) → ℝ +abbrev History (N t : ℕ) := Fin t → Fin N +abbrev Cell (n : ℕ) := Σ J : ℕ, Fin n → Fin (2 ^ J) + +instance cellMeasurableSpace (n : ℕ) : MeasurableSpace (Cell n) := ⊤ + +noncomputable def initialCube (n : ℕ) : Set (Coordinate n) := + Set.pi Set.univ (fun _ => Set.Ico (-1 / (2 * Real.sqrt n)) (1 / (2 * Real.sqrt n))) + +noncomputable def cubePrior (n : ℕ) : Measure (Coordinate n) := + ProbabilityTheory.cond volume (initialCube n) + +noncomputable def chart {n : ℕ} (z : Coordinate n) : Fin (n + 1) → ℝ := + Fin.lastCases (Real.sqrt (1 - ∑ a, (z a) ^ 2)) z + +noncomputable def cellSet {n : ℕ} (Q : Cell n) : Set (Coordinate n) := + {z | ∀ a, -1 / (2 * Real.sqrt n) + (Q.2 a : ℝ) / (Real.sqrt n * (2 : ℝ) ^ Q.1) ≤ z a ∧ + z a < -1 / (2 * Real.sqrt n) + ((Q.2 a : ℝ) + 1) / (Real.sqrt n * (2 : ℝ) ^ Q.1)} + +def rootCell (n : ℕ) : Cell n := ⟨0, fun _ => 0⟩ + +noncomputable def gaussianBlockLaw (n : ℕ) : Measure (GaussianBlock n) := + Measure.pi (fun _ => Measure.pi (fun _ => gaussianReal 0 1)) + +noncomputable def exactLabel {n : ℕ} (X : GaussianBlock n) (z : Coordinate n) : Label n := + fun row => ∑ a, X row a * chart z a + +structure BlockRule (n N : ℕ) where + prob : (GaussianBlock n × Label n) → Fin N → ℝ + measurable_prob : ∀ w, Measurable (fun data => prob data w) + nonneg : ∀ data w, 0 ≤ prob data w + sum_one : ∀ data, ∑ w, prob data w = 1 + +abbrev Rules (n N t : ℕ) := ∀ i : Fin t, History N i.val → BlockRule n N + +def past {N t : ℕ} (w : History N t) (i : Fin t) : History N i.val := + fun j => w ⟨j.val, Nat.lt_trans j.isLt i.isLt⟩ + +def through {N t : ℕ} (w : History N t) (i : Fin t) : History N (i.val + 1) := + fun j => w ⟨j.val, Nat.lt_of_lt_of_le j.isLt i.isLt⟩ + +noncomputable def blockProbability {n N : ℕ} (rule : BlockRule n N) + (z : Coordinate n) (w : Fin N) : ℝ := + ∫ X, rule.prob (X, exactLabel X z) w ∂gaussianBlockLaw n + +noncomputable def historyLikelihood {n N t : ℕ} (rules : Rules n N t) + (z : Coordinate n) (w : History N t) : ℝ := + ∏ i, blockProbability (rules i (past w i)) z (w i) + +noncomputable def experimentLaw {n N t : ℕ} (rules : Rules n N t) : + Measure (Coordinate n × History N t) := + ∑ w : History N t, + ((cubePrior n).withDensity (fun z => ENNReal.ofReal (historyLikelihood rules z w))).map + (fun z => (z, w)) + +abbrev Disclosure (n N t : ℕ) := ∀ i : Fin t, Coordinate n → History N (i.val + 1) → Cell n + +def ValidDisclosure {n N t : ℕ} (Q : Disclosure n N t) : Prop := + (∀ i, Measurable (fun zh : Coordinate n × History N (i.val + 1) => Q i zh.1 zh.2)) ∧ + (∀ i, (Set.range (fun zh : Coordinate n × History N (i.val + 1) => Q i zh.1 zh.2)).Finite) ∧ + (∀ z ∈ initialCube n, ∀ w : History N t, ∀ i, + z ∈ cellSet (Q i z (through w i)) ∧ cellSet (Q i z (through w i)) ⊆ initialCube n) ∧ + (∀ z ∈ initialCube n, ∀ w : History N t, ∀ i j : Fin t, i ≤ j → + cellSet (Q j z (through w j)) ⊆ cellSet (Q i z (through w i))) + +noncomputable def transcriptMap {n N t : ℕ} (Q : Disclosure n N t) + (zw : Coordinate n × History N t) : Coordinate n × (History N t × (Fin t → Cell n)) := + (zw.1, (zw.2, fun i => Q i zw.1 (through zw.2 i))) + +noncomputable def augmentedLaw {n N t : ℕ} (rules : Rules n N t) (Q : Disclosure n N t) := + (experimentLaw rules).map (transcriptMap Q) + +noncomputable def mutualInformation {α β : Type*} [MeasurableSpace α] [MeasurableSpace β] + (μ : Measure (α × β)) : ℝ≥0∞ := + InformationTheory.klDiv μ ((μ.map Prod.fst).prod (μ.map Prod.snd)) + +noncomputable def finalLevel {n N t : ℕ} (Q : Disclosure n N t) + (zw : Coordinate n × History N t) : ℕ := + if ht : 0 < t then + let i : Fin t := ⟨t - 1, by omega⟩ + (Q i zw.1 (through zw.2 i)).1 + else 0 + +def MainStatement : Prop := + ∃ c : ℝ, 0 < c ∧ ∃ n₀ : ℕ, ∀ C₀ : ℝ, 0 < C₀ → + ∃ C : ℝ, 0 < C ∧ ∀ (n N t : ℕ), n₀ ≤ n → 1 ≤ N → ∀ rules : Rules n N t, + (2 / (n / 8 : ℕ) + Real.exp (-c * (n / 16 : ℕ))) * Real.log N ≤ C₀ * (n + 1) → + ∃ Q : Disclosure n N t, ValidDisclosure Q ∧ + mutualInformation (augmentedLaw rules Q) ≤ ENNReal.ofReal (C * (n + 1) * t) ∧ + (∫ zw, (finalLevel Q zw : ℝ) ∂experimentLaw rules) ≤ C * t + +namespace FiniteEntropy + +noncomputable def uniformCell {n : ℕ} (Q : Cell n) : Measure (Coordinate n) := + ProbabilityTheory.cond volume (cellSet Q) + +def Descendant {n : ℕ} (Q R : Cell n) : Prop := + Q.1 ≤ R.1 ∧ cellSet R ⊆ cellSet Q + +noncomputable def threshold (n h : ℕ) : ℝ := (2:ℝ)^(-(n:ℝ)*h/2) + +def Heavy {n : ℕ} (P : Measure (Coordinate n)) (Q R : Cell n) : Prop := + Descendant Q R ∧ Q.1 < R.1 ∧ threshold n (R.1-Q.1) < (P (cellSet R)).toReal + +def FirstHeavy {n : ℕ} (P : Measure (Coordinate n)) (Q R : Cell n) : Prop := + Heavy P Q R ∧ ∀ E : Cell n, Heavy P Q E → Descendant E R → E = R + +noncomputable def residual {n : ℕ} (P : Measure (Coordinate n)) (Q : Cell n) : Set (Coordinate n) := + cellSet Q \ ⋃ R : {R : Cell n // FirstHeavy P Q R}, cellSet R.val + +abbrev Letter (n : ℕ) := Option (Cell n) +abbrev Log (n : ℕ) := List (Letter n) +instance logMeasurableSpace (n : ℕ) : MeasurableSpace (Log n) := ⊤ + +noncomputable def branch {n : ℕ} (P : Measure (Coordinate n)) (Q : Cell n) : Letter n → Set (Coordinate n) := by + classical + exact fun + | none => residual P Q + | some R => if FirstHeavy P Q R then cellSet R else ∅ + +noncomputable def attemptLetter {n : ℕ} (P : Measure (Coordinate n)) (Q : Cell n) + (z : Coordinate n) : Letter n := by + classical + exact if h : ∃ R : Cell n, FirstHeavy P Q R ∧ z ∈ cellSet R then some h.choose else none + +structure State (n : ℕ) where + cell : Cell n + event : Set (Coordinate n) + stopped : Bool + +noncomputable def update {n : ℕ} (P : Measure (Coordinate n)) (s : State n) (a : Letter n) : State n := + if s.stopped then s else + let μ := ProbabilityTheory.cond P s.event + let E := branch μ s.cell a + { cell := a.getD s.cell + event := s.event ∩ E + stopped := if a = none then decide ((1/2:ℝ) ≤ (μ E).toReal) else false } + +noncomputable def state {n : ℕ} (P : Measure (Coordinate n)) (Q : Cell n) (h : Log n) : State n := + h.foldl (update P) ⟨Q,cellSet Q,false⟩ + +noncomputable def run {n : ℕ} (P : Measure (Coordinate n)) (Q : Cell n) : ℕ → Coordinate n → Log n + | 0, _ => [] + | N+1, z => + let h := run P Q N z + let s := state P Q h + if s.stopped then h else + h ++ [attemptLetter (ProbabilityTheory.cond P s.event) s.cell z] + +def Terminates {n : ℕ} (P : Measure (Coordinate n)) (Q : Cell n) (z : Coordinate n) : Prop := + ∃ N, (state P Q (run P Q N z)).stopped = true + +noncomputable def attempts {n : ℕ} (P : Measure (Coordinate n)) (Q : Cell n) (z : Coordinate n) : ℕ := by + classical + exact if h : Terminates P Q z then Nat.find h else 0 + +noncomputable def terminalLog {n : ℕ} (P : Measure (Coordinate n)) (Q : Cell n) (z : Coordinate n) : Log n := + run P Q (attempts P Q z) z + +noncomputable def terminalCell {n : ℕ} (P : Measure (Coordinate n)) (Q : Cell n) (h : Log n) : Cell n := + (state P Q h).cell + +noncomputable def terminalLaw {n : ℕ} (P : Measure (Coordinate n)) (Q : Cell n) (h : Log n) : Measure (Coordinate n) := + ProbabilityTheory.cond P {z | terminalLog P Q z = h} + +noncomputable def depth {n : ℕ} (P : Measure (Coordinate n)) (Q : Cell n) (z : Coordinate n) : ℕ := + (terminalCell P Q (terminalLog P Q z)).1-Q.1 + +def Regular {n : ℕ} (P : Measure (Coordinate n)) (Q : Cell n) : Prop := + P (cellSet Q) = 1 ∧ ∀ R : Cell n, Descendant Q R → Q.1 < R.1 → + (P (cellSet R)).toReal ≤ 2 * threshold n (R.1-Q.1) + +def FiniteEntropyStatement : Prop := + ∃ n₀ : ℕ, ∀ n : ℕ, n₀ ≤ n → ∀ Q : Cell n, ∀ P : Measure (Coordinate n), + IsProbabilityMeasure P → P ≪ uniformCell Q → InformationTheory.klDiv P (uniformCell Q) ≠ ∞ → + (∀ᵐ z ∂P, Terminates P Q z) ∧ Measurable (terminalLog P Q) ∧ + (∀ h : Log n, P {z | terminalLog P Q z = h} ≠ 0 → + Descendant Q (terminalCell P Q h) ∧ Regular (terminalLaw P Q h) (terminalCell P Q h)) ∧ + Integrable (fun z => (depth P Q z : ℝ)) P ∧ + Integrable (fun z => (attempts P Q z : ℝ)) P ∧ + (∫ z,(attempts P Q z : ℝ) ∂P) ≤ 2*(1+∫ z,(depth P Q z : ℝ) ∂P) ∧ + (∫⁻ z,InformationTheory.klDiv (terminalLaw P Q (terminalLog P Q z)) + (uniformCell (terminalCell P Q (terminalLog P Q z))) ∂P) + + ENNReal.ofReal ((Real.log 2/4)*n*(∫ z,(depth P Q z : ℝ) ∂P)) ≤ + InformationTheory.klDiv P (uniformCell Q) + ENNReal.ofReal (2/Real.exp 1) + +theorem finite_expected_regularization : FiniteEntropyStatement := by + sorry + +end FiniteEntropy + +end RepeatedLocalization + +end OAI diff --git a/lean/ComparatorChallenges/GaussianInformation.json b/lean/ComparatorChallenges/GaussianInformation.json new file mode 100644 index 0000000000000000000000000000000000000000..60f6184ef6127936263d6c7bc432be754e03a190 --- /dev/null +++ b/lean/ComparatorChallenges/GaussianInformation.json @@ -0,0 +1,17 @@ +{ + "challenge_module": "ComparatorChallenges.GaussianInformation", + "solution_module": "OAI.Probability.GaussianInformation.Main", + "theorem_names": [ + "OAI.RepeatedLocalization.repeated_localization", + "OAI.AllScaleInverseVolume.inverse_volume_without_support", + "OAI.KernelPotential.kernel_coercivity", + "OAI.KernelPotential.actual_row_drift" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Classical.choice", + "Quot.sound" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/GaussianInformation.lean b/lean/ComparatorChallenges/GaussianInformation.lean new file mode 100644 index 0000000000000000000000000000000000000000..13a121157428c9655083cb192d78cfc503e2174a --- /dev/null +++ b/lean/ComparatorChallenges/GaussianInformation.lean @@ -0,0 +1,204 @@ +import Mathlib + +namespace OAI + + +open MeasureTheory ProbabilityTheory Set +open scoped BigOperators ENNReal + +namespace RepeatedLocalization + +abbrev Coordinate (n : ℕ) := Fin n → ℝ +abbrev GaussianBlock (n : ℕ) := Fin (n / 16) → Fin (n + 1) → ℝ +abbrev Label (n : ℕ) := Fin (n / 16) → ℝ +abbrev History (N t : ℕ) := Fin t → Fin N +abbrev Cell (n : ℕ) := Σ J : ℕ, Fin n → Fin (2 ^ J) + +instance cellMeasurableSpace (n : ℕ) : MeasurableSpace (Cell n) := ⊤ + +noncomputable def initialCube (n : ℕ) : Set (Coordinate n) := + Set.pi Set.univ (fun _ => Set.Ico (-1 / (2 * Real.sqrt n)) (1 / (2 * Real.sqrt n))) + +noncomputable def cubePrior (n : ℕ) : Measure (Coordinate n) := + ProbabilityTheory.cond volume (initialCube n) + +noncomputable def chart {n : ℕ} (z : Coordinate n) : Fin (n + 1) → ℝ := + Fin.lastCases (Real.sqrt (1 - ∑ a, (z a) ^ 2)) z + +noncomputable def cellSet {n : ℕ} (Q : Cell n) : Set (Coordinate n) := + {z | ∀ a, -1 / (2 * Real.sqrt n) + (Q.2 a : ℝ) / (Real.sqrt n * (2 : ℝ) ^ Q.1) ≤ z a ∧ + z a < -1 / (2 * Real.sqrt n) + ((Q.2 a : ℝ) + 1) / (Real.sqrt n * (2 : ℝ) ^ Q.1)} + +def rootCell (n : ℕ) : Cell n := ⟨0, fun _ => 0⟩ + +noncomputable def gaussianBlockLaw (n : ℕ) : Measure (GaussianBlock n) := + Measure.pi (fun _ => Measure.pi (fun _ => gaussianReal 0 1)) + +noncomputable def exactLabel {n : ℕ} (X : GaussianBlock n) (z : Coordinate n) : Label n := + fun row => ∑ a, X row a * chart z a + +structure BlockRule (n N : ℕ) where + prob : (GaussianBlock n × Label n) → Fin N → ℝ + measurable_prob : ∀ w, Measurable (fun data => prob data w) + nonneg : ∀ data w, 0 ≤ prob data w + sum_one : ∀ data, ∑ w, prob data w = 1 + +abbrev Rules (n N t : ℕ) := ∀ i : Fin t, History N i.val → BlockRule n N + +def past {N t : ℕ} (w : History N t) (i : Fin t) : History N i.val := + fun j => w ⟨j.val, Nat.lt_trans j.isLt i.isLt⟩ + +def through {N t : ℕ} (w : History N t) (i : Fin t) : History N (i.val + 1) := + fun j => w ⟨j.val, Nat.lt_of_lt_of_le j.isLt i.isLt⟩ + +noncomputable def blockProbability {n N : ℕ} (rule : BlockRule n N) + (z : Coordinate n) (w : Fin N) : ℝ := + ∫ X, rule.prob (X, exactLabel X z) w ∂gaussianBlockLaw n + +noncomputable def historyLikelihood {n N t : ℕ} (rules : Rules n N t) + (z : Coordinate n) (w : History N t) : ℝ := + ∏ i, blockProbability (rules i (past w i)) z (w i) + +noncomputable def experimentLaw {n N t : ℕ} (rules : Rules n N t) : + Measure (Coordinate n × History N t) := + ∑ w : History N t, + ((cubePrior n).withDensity (fun z => ENNReal.ofReal (historyLikelihood rules z w))).map + (fun z => (z, w)) + +abbrev Disclosure (n N t : ℕ) := ∀ i : Fin t, Coordinate n → History N (i.val + 1) → Cell n + +def ValidDisclosure {n N t : ℕ} (Q : Disclosure n N t) : Prop := + (∀ i, Measurable (fun zh : Coordinate n × History N (i.val + 1) => Q i zh.1 zh.2)) ∧ + (∀ i, (Set.range (fun zh : Coordinate n × History N (i.val + 1) => Q i zh.1 zh.2)).Finite) ∧ + (∀ z ∈ initialCube n, ∀ w : History N t, ∀ i, + z ∈ cellSet (Q i z (through w i)) ∧ cellSet (Q i z (through w i)) ⊆ initialCube n) ∧ + (∀ z ∈ initialCube n, ∀ w : History N t, ∀ i j : Fin t, i ≤ j → + cellSet (Q j z (through w j)) ⊆ cellSet (Q i z (through w i))) + +noncomputable def transcriptMap {n N t : ℕ} (Q : Disclosure n N t) + (zw : Coordinate n × History N t) : Coordinate n × (History N t × (Fin t → Cell n)) := + (zw.1, (zw.2, fun i => Q i zw.1 (through zw.2 i))) + +noncomputable def augmentedLaw {n N t : ℕ} (rules : Rules n N t) (Q : Disclosure n N t) := + (experimentLaw rules).map (transcriptMap Q) + +noncomputable def mutualInformation {α β : Type*} [MeasurableSpace α] [MeasurableSpace β] + (μ : Measure (α × β)) : ℝ≥0∞ := + InformationTheory.klDiv μ ((μ.map Prod.fst).prod (μ.map Prod.snd)) + +noncomputable def finalLevel {n N t : ℕ} (Q : Disclosure n N t) + (zw : Coordinate n × History N t) : ℕ := + if ht : 0 < t then + let i : Fin t := ⟨t - 1, by omega⟩ + (Q i zw.1 (through zw.2 i)).1 + else 0 + +def MainStatement : Prop := + ∃ c : ℝ, 0 < c ∧ ∃ n₀ : ℕ, ∀ C₀ : ℝ, 0 < C₀ → + ∃ C : ℝ, 0 < C ∧ ∀ (n N t : ℕ), n₀ ≤ n → 1 ≤ N → ∀ rules : Rules n N t, + (2 / (n / 8 : ℕ) + Real.exp (-c * (n / 16 : ℕ))) * Real.log N ≤ C₀ * (n + 1) → + ∃ Q : Disclosure n N t, ValidDisclosure Q ∧ + mutualInformation (augmentedLaw rules Q) ≤ ENNReal.ofReal (C * (n + 1) * t) ∧ + (∫ zw, (finalLevel Q zw : ℝ) ∂experimentLaw rules) ≤ C * t + +theorem repeated_localization : MainStatement := by + sorry + +end RepeatedLocalization + + +open MeasureTheory Metric +open scoped ENNReal +namespace AllScaleInverseVolume +local instance namedAtLeastTwoTwo : Nat.AtLeastTwo 2 := ⟨Nat.le_refl 2⟩ + +abbrev Ambient (d : ℕ) := EuclideanSpace ℝ (Fin d) + +noncomputable local instance ambientSub (d : ℕ) : Sub (Ambient d) where + sub vector other := WithLp.toLp (2 : ℝ≥0∞) + (WithLp.ofLp (p := (2 : ℝ≥0∞)) vector - WithLp.ofLp (p := (2 : ℝ≥0∞)) other) + +noncomputable local instance ambientInner (d : ℕ) : Inner ℝ (Ambient d) where + inner vector other := ∑ coordinate : Fin d, + inner ℝ (WithLp.ofLp (p := (2 : ℝ≥0∞)) vector coordinate) + (WithLp.ofLp (p := (2 : ℝ≥0∞)) other coordinate) + +noncomputable def gramVolume {d k : ℕ} (u : Ambient d) (z : Fin k → Ambient d) : ℝ := + Real.sqrt (Matrix.gram ℝ (fun i => z i-u)).det +noncomputable def inverseVolume {d : ℕ} (u : Ambient d) (z : Fin (d/100) → Ambient d) : ℝ≥0∞ := + ((ENNReal.ofReal (gramVolume u z))⁻¹)^(d/100) +def BallBound {d : ℕ} (ν : Measure (Ambient d)) : Prop := + ∀ (x : Ambient d) (r : ℝ), 0 < r → + ν (ball x r) ≤ ENNReal.ofReal (r^(((d:ℝ)-1)/2)) +def InverseVolumeStatement : Prop := + ∃ C : ℝ, 0 < C ∧ ∃ d₀ : ℕ, ∀ d : ℕ, d₀ ≤ d → + ∀ ν : Measure (Ambient d), IsProbabilityMeasure ν → BallBound ν → + ∀ u : Ambient d, (∫⁻ z,inverseVolume u z ∂Measure.pi (fun _ : Fin (d/100) => ν)) ≤ + ENNReal.ofReal (Real.exp (C*d*(d/100:ℕ))) +theorem inverse_volume_without_support : InverseVolumeStatement := by + sorry +end AllScaleInverseVolume + + +open MeasureTheory ProbabilityTheory Metric Set +open scoped ENNReal +namespace KernelPotential +local instance namedAtLeastTwoTwo : Nat.AtLeastTwo 2 := ⟨Nat.le_refl 2⟩ + +abbrev Ambient (d : ℕ) := EuclideanSpace ℝ (Fin d) +abbrev Rows (d : ℕ) := Fin (d/16) → Fin d → ℝ +noncomputable def radial {d : ℕ} (x : Ambient d) : Ambient d := ‖x‖⁻¹ • x +noncomputable def sphereProbability (d : ℕ) : Measure (Ambient d) := + ((volume (ball (0 : Ambient d) 1))⁻¹ • volume.restrict (ball (0 : Ambient d) 1)).map radial +noncomputable def J {d : ℕ} (ν : Measure (Ambient d)) (s : Ambient d) : ℝ≥0∞ := + ∫⁻ u,((ENNReal.ofReal ‖u-s‖)⁻¹)^(2*(d/16)) ∂ν +noncomputable def B {d : ℕ} (ν : Measure (Ambient d)) : ℝ := + ∫ s, Real.log ((J ν s).toReal) ∂ν +noncomputable def Phi {d : ℕ} (ν : Measure (Ambient d)) : ℝ := + (InformationTheory.klDiv ν (sphereProbability d)).toReal - B ν + +def BoundedDensity {d : ℕ} (ν : Measure (Ambient d)) : Prop := + ∃ H : ℝ, 0 < H ∧ ν ≤ ENNReal.ofReal H • sphereProbability d + +noncomputable def rowLaw (d : ℕ) : Measure (Rows d) := + Measure.pi (fun _ : Fin (d/16) => Measure.pi (fun _ : Fin d => gaussianReal 0 1)) +noncomputable def labels {d : ℕ} (a : Rows d) (s : Ambient d) : Fin (d/16) → ℝ := + fun i => ∑ j,a i j*s j +structure BlockRule (d N : ℕ) where + prob : (Fin N × (Rows d × (Fin (d/16) → ℝ))) → Fin N → ℝ + measurable_prob : ∀ w, Measurable (fun x => prob x w) + nonneg_prob : ∀ x w, 0 ≤ prob x w + sum_prob : ∀ x, ∑ w,prob x w=1 + +noncomputable def outgoingLaw {d N : ℕ} (μ : Measure (Ambient d × Fin N)) + (rule : BlockRule d N) : Measure (Ambient d × Fin N) := + ∑ w : Fin N, ((μ.prod (rowLaw d)).withDensity (fun x => + ENNReal.ofReal (rule.prob (x.1.2,x.2,labels x.2 x.1.1) w))).map (fun x => (x.1.1,w)) +noncomputable def component {d N : ℕ} (μ : Measure (Ambient d × Fin N)) (v : Fin N) : + Measure (Ambient d) := (μ.restrict {x|x.2=v}).map Prod.fst +noncomputable def posterior {d N : ℕ} (μ : Measure (Ambient d × Fin N)) (v : Fin N) : + Measure (Ambient d) := (component μ v univ)⁻¹ • component μ v +noncomputable def averagePhi {d N : ℕ} (μ : Measure (Ambient d × Fin N)) : ℝ := + ∑ v : Fin N, (component μ v univ).toReal * Phi (posterior μ v) + +def CoercivityStatement : Prop := + ∃ C : ℝ, 0 < C ∧ ∃ d₀ : ℕ, ∀ d : ℕ, d₀ ≤ d → + (∀ ν : Measure (Ambient d), IsProbabilityMeasure ν → BoundedDensity ν → + (1/2:ℝ)*(InformationTheory.klDiv ν (sphereProbability d)).toReal-C*d ≤ Phi ν) ∧ + Phi (sphereProbability d) ≤ (2*(d/16):ℕ)*Real.log 2 ∧ + (∀ (q : ℕ) (w : Fin q → ℝ), (∀ i,0 ≤ w i) → (∑ i,w i)=1 → + ∀ ν : Fin q → Measure (Ambient d), (∀ i,IsProbabilityMeasure (ν i)) → + (∀ i,BoundedDensity (ν i)) → + Phi (∑ i,ENNReal.ofReal (w i) • ν i) ≤ ∑ i,w i*Phi (ν i)) + +def DriftStatement : Prop := + ∃ C : ℝ, 0 < C ∧ ∃ d₀ : ℕ, ∀ d : ℕ, d₀ ≤ d → ∀ N : ℕ, 1 ≤ N → + Real.log N ≤ (d:ℝ)^2 → ∀ μ : Measure (Ambient d × Fin N), IsProbabilityMeasure μ → + μ.map Prod.fst=sphereProbability d → ∀ rule : BlockRule d N, + averagePhi (outgoingLaw μ rule) ≤ averagePhi μ+C*d + +theorem kernel_coercivity : CoercivityStatement := by sorry +theorem actual_row_drift : DriftStatement := by sorry +end KernelPotential + +end OAI diff --git a/lean/ComparatorChallenges/GaussianMoat.json b/lean/ComparatorChallenges/GaussianMoat.json new file mode 100644 index 0000000000000000000000000000000000000000..39c51f64c2203dde1e5277048c83eb9ba5d2b1f8 --- /dev/null +++ b/lean/ComparatorChallenges/GaussianMoat.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.GaussianMoat", + "solution_module": "OAI.NumberTheory.GaussianMoat.Main", + "theorem_names": [ + "OAI.GaussianMoat.fullMain" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/GaussianMoat.lean b/lean/ComparatorChallenges/GaussianMoat.lean new file mode 100644 index 0000000000000000000000000000000000000000..758b2f13cb75832c8a42f850ecdca6a3534da835 --- /dev/null +++ b/lean/ComparatorChallenges/GaussianMoat.lean @@ -0,0 +1,41 @@ +import Mathlib + +namespace OAI + +namespace GaussianMoat + +abbrev PrimeVertex := {z : GaussianInt // Irreducible z} + +noncomputable def primeGraph (D : ℝ) : SimpleGraph PrimeVertex where + Adj p q := p ≠ q ∧ dist (p.val : ℂ) (q.val : ℂ) ≤ D + symm := by + constructor + intro p q h + exact ⟨h.1.symm, by simpa only [dist_comm] using h.2⟩ + loopless := by + constructor + intro p h + exact h.1 rfl + +def component (D : ℝ) (p : PrimeVertex) : Set PrimeVertex := + {q | (primeGraph D).Reachable p q} + +def MainEndpoint : Prop := + ∀ (D : ℝ) (z : ℕ → GaussianInt), + (∀ t, Irreducible (z t)) → Function.Injective z → + (∀ t, dist (z (t + 1) : ℂ) (z t : ℂ) ≤ D) → False + +def UniformEndpoint : Prop := + ∀ D : ℝ, ∃ B : ℕ, + (∀ p : PrimeVertex, (component D p).Finite ∧ (component D p).ncard ≤ B) ∧ + (∀ (n : ℕ) (z : Fin n → GaussianInt), + (∀ i, Irreducible (z i)) → Function.Injective z → + (∀ i j : Fin n, j.val = i.val + 1 → dist (z j : ℂ) (z i : ℂ) ≤ D) → + n ≤ B) + +theorem fullMain : MainEndpoint ∧ UniformEndpoint := by + sorry + +end GaussianMoat + +end OAI diff --git a/lean/ComparatorChallenges/GaussianPropeller.json b/lean/ComparatorChallenges/GaussianPropeller.json new file mode 100644 index 0000000000000000000000000000000000000000..a5aafb0ff774e8e6809eac3bddd32c1509ffd93f --- /dev/null +++ b/lean/ComparatorChallenges/GaussianPropeller.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.GaussianPropeller", + "solution_module": "OAI.Probability.GaussianPropeller.Main", + "theorem_names": [ + "OAI.GaussianPropeller.all_partitions" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/GaussianPropeller.lean b/lean/ComparatorChallenges/GaussianPropeller.lean new file mode 100644 index 0000000000000000000000000000000000000000..b16dd477960a2d45f91ec59cc60a2e1518384efd --- /dev/null +++ b/lean/ComparatorChallenges/GaussianPropeller.lean @@ -0,0 +1,43 @@ +import Mathlib + +namespace OAI + +open MeasureTheory ProbabilityTheory +open scoped ENNReal + +namespace GaussianPropeller + +abbrev Space (d : ℕ) := EuclideanSpace ℝ (Fin d) + +noncomputable def gaussian (d : ℕ) : Measure (Space d) := stdGaussian (Space d) + +def IsPartition {d k : ℕ} (A : Fin k → Set (Space d)) : Prop := + (∀ i, MeasurableSet (A i)) ∧ ∀ᵐ x ∂gaussian d, ∃! i, x ∈ A i + +noncomputable def centroid {d : ℕ} (A : Set (Space d)) : Space d := + ∫ x in A, x ∂gaussian d + +noncomputable def value {d k : ℕ} (A : Fin k → Set (Space d)) : ℝ := + ∑ i, ‖centroid (A i)‖ ^ 2 + +def coord {d : ℕ} (j : ℕ) (x : Space d) : ℝ := + if h : j < d then x ⟨j, h⟩ else 0 + +noncomputable def propeller (d k : ℕ) (i : Fin k) : Set (Space d) := + if i.val = 0 then {x | |coord 1 x| ≤ Real.sqrt 3 * coord 0 x} + else if i.val = 1 then {x | 0 ≤ coord 1 x ∧ Real.sqrt 3 * coord 0 x ≤ coord 1 x} + else if i.val = 2 then {x | coord 1 x ≤ 0 ∧ Real.sqrt 3 * coord 0 x ≤ -coord 1 x} + else ∅ + +def AllPartitions : Prop := + (∀ (d k : ℕ), 0 < d → 0 < k → ∀ A : Fin k → Set (Space d), + IsPartition A → value A ≤ 9 / (8 * Real.pi)) ∧ + (∀ (d k : ℕ), 2 ≤ d → 3 ≤ k → + IsPartition (propeller d k) ∧ value (propeller d k) = 9 / (8 * Real.pi)) + +theorem all_partitions : AllPartitions := by + sorry + +end GaussianPropeller + +end OAI diff --git a/lean/ComparatorChallenges/GaussianReplacement.json b/lean/ComparatorChallenges/GaussianReplacement.json new file mode 100644 index 0000000000000000000000000000000000000000..a93c443f9490463df2be4d5d81bca97ea20f065f --- /dev/null +++ b/lean/ComparatorChallenges/GaussianReplacement.json @@ -0,0 +1,24 @@ +{ + "challenge_module": "ComparatorChallenges.GaussianReplacement", + "solution_module": "OAI.Probability.GaussianReplacement.FiberEquality", + "theorem_names": [ + "OAI.CurrentProjection.mixedMomentMain", + "OAI.CurrentProjection.actualRowMain", + "OAI.CurrentProjection.actualRowRefinement", + "OAI.CurrentProjection.actualRowSourceMain", + "OAI.CurrentProjection.actualRowSourceRefinement", + "OAI.CurrentProjection.criticalComparisonMain", + "OAI.CurrentProjection.oneLevelComparisonMain", + "OAI.CurrentProjection.twoLabelComparisonMain", + "OAI.CurrentProjection.hybridBlockMain", + "OAI.CurrentProjection.fiberTwoPointMain", + "OAI.CurrentProjection.fiberBlockMain" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/GaussianReplacement.lean b/lean/ComparatorChallenges/GaussianReplacement.lean new file mode 100644 index 0000000000000000000000000000000000000000..5853b619cbf223a36963bc5c7c542debb9b3f3ee --- /dev/null +++ b/lean/ComparatorChallenges/GaussianReplacement.lean @@ -0,0 +1,524 @@ +import Mathlib + +namespace OAI + +open MeasureTheory ProbabilityTheory Set Filter InformationTheory +open scoped ENNReal NNReal RealInnerProductSpace Topology + +noncomputable section + +namespace CurrentProjection + +abbrev Vector (d : ℕ) := EuclideanSpace ℝ (Fin d) + +abbrev Sphere (d : ℕ) := Metric.sphere (0 : Vector d) 1 + +abbrev Rows (k d : ℕ) := Fin k → Vector d + +def uniformSphere (d : ℕ) : Measure (Sphere d) := + let σ := (volume : Measure (Vector d)).toSphere + (σ Set.univ)⁻¹ • σ + +def gaussianRows (k d : ℕ) : Measure (Rows k d) := + Measure.pi fun _ => stdGaussian (Vector d) + +def label {k d : ℕ} (g : Rows k d) (s : Vector d) : Fin k → ℝ := + fun i => ⟪s, g i⟫ + +def LocalGrowth {d : ℕ} (ρ : Measure (Sphere d)) (a : ℕ) (B : ℝ) : Prop := + ∀ z : Vector d, ∀ t : ℝ, 0 < t → + ρ {u | dist (u : Vector d) z ≤ t} ≤ ENNReal.ofReal (B * t ^ a) + +def cubeAverage {k d : ℕ} (ρ : Measure (Sphere d)) (g : Rows k d) + (y : Fin k → ℝ) (δ : ℝ) : ℝ≥0∞ := + ENNReal.ofReal ((2 * δ)⁻¹ ^ k) * + ρ {u | ∀ i, |label g (u : Vector d) i - y i| ≤ δ} + +def exactDensity {k d : ℕ} (ρ : Measure (Sphere d)) (g : Rows k d) + (y : Fin k → ℝ) : ℝ≥0∞ := by + classical + let f := fun j : ℕ => (cubeAverage ρ g y (1 / (j : ℝ))).toReal + exact if h : ∃ L : ℝ, Tendsto f atTop (𝓝 L) then ENNReal.ofReal h.choose else 0 + +def AdmissibleDimensions (d m r q : ℕ) : Prop := + 1 ≤ m ∧ 1 ≤ r ∧ 1 ≤ q ∧ m + r < d - 1 ∧ m + r - m - (q - 1) ≥ 1 + +def momentConstant (C : ℝ) (d : ℕ) (B D : ℝ) : ℝ≥0∞ := + ENNReal.ofReal (Real.exp (C * d) * B * (1 + max (Real.log (D / B)) 0)) + +def MixedMomentMain : Prop := + ∃ C : ℝ, 0 < C ∧ ∀ (d m r q : ℕ), AdmissibleDimensions d m r q → + ∀ (ρ : Measure (Sphere d)), IsFiniteMeasure ρ → + ∀ (B D : ℝ), 0 < B → 0 < D → LocalGrowth ρ (m+r) B → LocalGrowth ρ (d-1) D → + (∀ (s : Sphere d) (δ : ℝ), 0 < δ → + (∫⁻ X, (∫⁻ Z, cubeAverage ρ (Fin.append X Z) + (label (Fin.append X Z) (s : Vector d)) δ ∂gaussianRows r d)^q + ∂gaussianRows m d) ≤ (momentConstant C d B D)^q) ∧ + (ρ ≪ uniformSphere d → ∃ E : Set (Sphere d), MeasurableSet E ∧ ρ E = 0 ∧ + ∀ s ∉ E, + (∀ᵐ G ∂gaussianRows (m+r) d, + Tendsto (fun δ : ℝ => cubeAverage ρ G (label G (s : Vector d)) δ) + (𝓝[>] 0) (𝓝 (exactDensity ρ G (label G (s : Vector d))))) ∧ + ((∫⁻ X, (∫⁻ Z, exactDensity ρ (Fin.append X Z) + (label (Fin.append X Z) (s : Vector d)) ∂gaussianRows r d)^q + ∂gaussianRows m d) ≤ (momentConstant C d B D)^q) ∧ + (ρ ≠ 0 → ∀ᵐ G ∂gaussianRows (m+r) d, + 0 < exactDensity ρ G (label G (s : Vector d)) ∧ + exactDensity ρ G (label G (s : Vector d)) < ∞)) + +instance gaussianRows_isProbabilityMeasure (k d : ℕ) : IsProbabilityMeasure (gaussianRows k d) := by + unfold gaussianRows + infer_instance + +lemma measurable_own_label {k d : ℕ} : + Measurable (fun z : Rows k d × Sphere d => label z.1 (z.2:Vector d)) := by + apply Measurable.of_eval + intro i + exact (continuous_inner.comp <| (continuous_subtype_val.comp continuous_snd).prodMk + ((continuous_apply i).comp continuous_fst)).measurable + +def swapLast {A B C : Type*} [MeasurableSpace A] [MeasurableSpace B] [MeasurableSpace C] : + (A × B) × C ≃ᵐ (A × C) × B where + toFun p := ((p.1.1,p.2),p.1.2) + invFun p := ((p.1.1,p.2),p.1.2) + left_inv _ := rfl + right_inv _ := rfl + measurable_toFun := (measurable_fst.fst.prodMk measurable_snd).prodMk measurable_fst.snd + measurable_invFun := (measurable_fst.fst.prodMk measurable_snd).prodMk measurable_fst.snd + +def rowInformation {S W X : Type*} [MeasurableSpace S] [MeasurableSpace W] + [MeasurableSpace X] (P : Measure ((S×W)×X)) (γ : Measure X) : ℝ≥0∞ := + klDiv P (P.fst.prod γ) + +noncomputable def shannonEntropy {W : Type*} [MeasurableSpace W] (π : Measure W) : ℝ≥0∞ := + ∫⁻ w, ENNReal.ofReal (-Real.log (π {w}).toReal) ∂π + +def conditionalMutualInformation {Z A B : Type*} [MeasurableSpace Z] + [MeasurableSpace A] [MeasurableSpace B] [StandardBorelSpace A] [StandardBorelSpace B] + (P : Measure (Z×(A×B))) [IsFiniteMeasure P] : ℝ≥0∞ := by + classical + exact if h : Nonempty (A×B) then + letI := h + InformationTheory.klDiv P (P.fst ⊗ₘ (P.condKernel.fst ×ₖ P.condKernel.snd)) + else 0 + +def actualExperiment {d m r : ℕ} {W : Type*} [MeasurableSpace W] + (P : Measure ((Sphere d × W) × Rows m d)) : + Measure (((Sphere d × W) × Rows m d) × Rows r d) := P.prod (gaussianRows r d) + +instance actualExperiment_isProbabilityMeasure {d m r : ℕ} {W : Type*} [MeasurableSpace W] + (P : Measure ((Sphere d×W)×Rows m d)) [IsProbabilityMeasure P] : + IsProbabilityMeasure (actualExperiment (r:=r) P) := + inferInstanceAs (IsProbabilityMeasure (P.prod (gaussianRows r d))) + +def actualObservation {d m r : ℕ} {W : Type*} + (p : ((Sphere d × W) × Rows m d) × Rows r d) : + (Rows (m+r) d × W) × (Fin (m+r) → ℝ) := + ((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)) + +instance actualObservation_isProbabilityMeasure {d m r : ℕ} {W : Type*} [MeasurableSpace W] + (P : Measure ((Sphere d×W)×Rows m d)) [IsProbabilityMeasure P] : + IsProbabilityMeasure ((actualExperiment (r:=r) P).map actualObservation) := + inferInstance + +def selectedCube {k d : ℕ} {W : Type*} (ρ : W → Measure (Sphere d)) (δ : ℝ) + (z : (Rows k d×W)×(Fin k → ℝ)) : ℝ≥0∞ := cubeAverage (ρ z.1.2) z.1.1 z.2 δ + +def selectedExact {k d : ℕ} {W : Type*} (ρ : W → Measure (Sphere d)) + (z : (Rows k d×W)×(Fin k → ℝ)) : ℝ≥0∞ := exactDensity (ρ z.1.2) z.1.1 z.2 + +def momentBound (C : ℝ) (d : ℕ) (B D : ℝ) : ℝ := + Real.exp (C*d)*B*(1+max (Real.log (D/B)) 0) + +def logPositive (x : ℝ≥0∞) : ℝ := max (Real.log x.toReal) 0 + +def logNegative (x : ℝ≥0∞) : ℝ≥0∞ := if x = 0 then ∞ else ENNReal.ofReal (-Real.log x.toReal) + +def extendedLogExpectation {A : Type*} [MeasurableSpace A] (μ : Measure A) + (f : A → ℝ≥0∞) : EReal := + ((∫⁻ a, ENNReal.ofReal (logPositive (f a)) ∂μ) : EReal) - + ((∫⁻ a, logNegative (f a) ∂μ) : EReal) + +def PositiveMessage {W : Type*} [MeasurableSpace W] (π : Measure W) := {w : W // 0 < π {w}} + +def completeFamily {W : Type*} [MeasurableSpace W] {T : Type*} (π : Measure W) + (f : PositiveMessage π → T) (t₀ : T) (w : W) : T := + if h : 0 < π {w} then f ⟨w,h⟩ else t₀ + +structure ActualRowConclusion {d m r q : ℕ} {W : Type*} [MeasurableSpace W] + (P : Measure ((Sphere d×W)×Rows m d)) [IsProbabilityMeasure P] + (ρ : W → Measure (Sphere d)) (B D : W → ℝ) : Prop where + row_finite : rowInformation P (gaussianRows m d) ≠ ∞ + row_le_entropy : (rowInformation P (gaussianRows m d)).toReal ≤ + (shannonEntropy (P.map swapLast).snd).toReal + conditional_density : ∀ᵐ gw ∂((actualExperiment (r:=r) P).map actualObservation).fst, + ((actualExperiment (r:=r) P).map actualObservation).condKernel gw ≪ volume + actual_limit : ∀ᵐ p ∂actualExperiment (r:=r) P, + Tendsto (fun j : ℕ => selectedCube ρ (1/(j:ℝ)) (actualObservation p)) atTop + (𝓝 (selectedExact ρ (actualObservation p))) + smoothed_bound : ∀ δ : ℝ, 0 < δ → + Integrable (fun p => Real.log (1+(selectedCube ρ δ (actualObservation p)).toReal)) + (actualExperiment (r:=r) P) ∧ + (∫ p, Real.log (1+(selectedCube ρ δ (actualObservation p)).toReal) ∂actualExperiment (r:=r) P) ≤ + (rowInformation P (gaussianRows m d)).toReal/q + + ∫ sw : Sphere d×W, Real.log (1+momentBound 9 d (B sw.2) (D sw.2)) ∂P.fst + exact_integrable : Integrable (fun p => Real.log (1+(selectedExact ρ (actualObservation p)).toReal)) + (actualExperiment (r:=r) P) + exact_bound : (∫ p, Real.log (1+(selectedExact ρ (actualObservation p)).toReal) ∂actualExperiment (r:=r) P) ≤ + (rowInformation P (gaussianRows m d)).toReal/q + + ∫ sw : Sphere d×W, Real.log (1+momentBound 9 d (B sw.2) (D sw.2)) ∂P.fst + entropy_bound : (rowInformation P (gaussianRows m d)).toReal/q + + ∫ sw : Sphere d×W, Real.log (1+momentBound 9 d (B sw.2) (D sw.2)) ∂P.fst ≤ + (shannonEntropy (P.map swapLast).snd).toReal/q + + ∫ sw : Sphere d×W, Real.log (1+momentBound 9 d (B sw.2) (D sw.2)) ∂P.fst + positive_log_integrable : Integrable (fun p => logPositive (selectedExact ρ (actualObservation p))) + (actualExperiment (r:=r) P) + extended_log_bound : extendedLogExpectation (actualExperiment (r:=r) P) + (fun p => selectedExact ρ (actualObservation p)) ≤ + (((rowInformation P (gaussianRows m d)).toReal/q + + ∫ sw : Sphere d×W, Real.log (1+momentBound 9 d (B sw.2) (D sw.2)) ∂P.fst) : EReal) + +def actualConditionalRowInformation {d m : ℕ} {W : Type*} [MeasurableSpace W] + [StandardBorelSpace W] + (P : Measure ((Sphere d×W)×Rows m d)) [IsFiniteMeasure P] : ℝ≥0∞ := + conditionalMutualInformation (P.map (fun p => (p.1.1,(p.2,p.1.2)))) + +structure ActualRowSourceConclusion {d m r q : ℕ} {W : Type*} [MeasurableSpace W] + [StandardBorelSpace W] + (P : Measure ((Sphere d×W)×Rows m d)) [IsProbabilityMeasure P] + (ρ : W → Measure (Sphere d)) (B D : W → ℝ) : Prop where + row_finite : actualConditionalRowInformation P ≠ ∞ + row_le_entropy : (actualConditionalRowInformation P).toReal ≤ + (shannonEntropy (P.map swapLast).snd).toReal + conditional_density : ∀ᵐ gw ∂((actualExperiment (r:=r) P).map actualObservation).fst, + ((actualExperiment (r:=r) P).map actualObservation).condKernel gw ≪ volume + actual_limit : ∀ᵐ p ∂actualExperiment (r:=r) P, + Tendsto (fun j : ℕ => selectedCube ρ (1/(j:ℝ)) (actualObservation p)) atTop + (𝓝 (selectedExact ρ (actualObservation p))) + smoothed_bound : ∀ δ : ℝ, 0 < δ → + Integrable (fun p => Real.log (1+(selectedCube ρ δ (actualObservation p)).toReal)) + (actualExperiment (r:=r) P) ∧ + (∫ p, Real.log (1+(selectedCube ρ δ (actualObservation p)).toReal) ∂actualExperiment (r:=r) P) ≤ + (actualConditionalRowInformation P).toReal/q + + ∫ sw : Sphere d×W, Real.log (1+momentBound 9 d (B sw.2) (D sw.2)) ∂P.fst + exact_integrable : Integrable (fun p => Real.log (1+(selectedExact ρ (actualObservation p)).toReal)) + (actualExperiment (r:=r) P) + exact_bound : (∫ p, Real.log (1+(selectedExact ρ (actualObservation p)).toReal) ∂actualExperiment (r:=r) P) ≤ + (actualConditionalRowInformation P).toReal/q + + ∫ sw : Sphere d×W, Real.log (1+momentBound 9 d (B sw.2) (D sw.2)) ∂P.fst + entropy_bound : (actualConditionalRowInformation P).toReal/q + + ∫ sw : Sphere d×W, Real.log (1+momentBound 9 d (B sw.2) (D sw.2)) ∂P.fst ≤ + (shannonEntropy (P.map swapLast).snd).toReal/q + + ∫ sw : Sphere d×W, Real.log (1+momentBound 9 d (B sw.2) (D sw.2)) ∂P.fst + positive_log_integrable : Integrable (fun p => logPositive (selectedExact ρ (actualObservation p))) + (actualExperiment (r:=r) P) + extended_log_bound : extendedLogExpectation (actualExperiment (r:=r) P) + (fun p => selectedExact ρ (actualObservation p)) ≤ + (((actualConditionalRowInformation P).toReal/q + + ∫ sw : Sphere d×W, Real.log (1+momentBound 9 d (B sw.2) (D sw.2)) ∂P.fst) : EReal) + +def alignedExperiment {d m r : ℕ} {W : Type*} [MeasurableSpace W] + (P : Measure ((Sphere d×W)×Rows m d)) : Measure ((Sphere d×W)×Rows (m+r) d) := + (actualExperiment (r:=r) P).map (fun p => (p.1.1,Fin.append p.1.2 p.2)) + +instance alignedExperiment_probability {d m r : ℕ} {W : Type*} [MeasurableSpace W] + (P : Measure ((Sphere d×W)×Rows m d)) [IsProbabilityMeasure P] : + IsProbabilityMeasure (alignedExperiment (r:=r) P) := by + unfold alignedExperiment + infer_instance + +def exposedJointMap {d k : ℕ} {W : Type*} (p : (Sphere d×W)×Rows k d) : + (Rows k d×(Fin k → ℝ))×(Sphere d×W) := ((p.2,label p.2 (p.1.1:Vector d)),p.1) + +def exposedInformation {d k : ℕ} {W : Type*} [MeasurableSpace W] [StandardBorelSpace W] + (P : Measure ((Sphere d×W)×Rows k d)) [IsFiniteMeasure P] : ℝ≥0∞ := + conditionalMutualInformation (P.map exposedJointMap) + +def CriticalComparisonMain : Prop := + ∃ (K : ℝ) (d₀ : ℕ), 0 < K ∧ ∀ (d : ℕ), d₀ ≤ d → + ∀ (W : Type) [MeasurableSpace W] [Countable W] [MeasurableSingletonClass W], + ∀ (P : Measure ((Sphere d×W)×Rows (d/10) d)) [IsProbabilityMeasure P], + (P.map swapLast).fst = (uniformSphere d).prod (gaussianRows (d/10) d) → + shannonEntropy (P.map swapLast).snd ≤ ENNReal.ofReal ((d:ℝ)^2) → + exposedInformation (P.fst.prod (gaussianRows (d/10+(d/2-d/10)) d)) ≤ + exposedInformation (alignedExperiment (r:=d/2-d/10) P) + ENNReal.ofReal (K*d) + +def OneLevelComparisonMain : Prop := + ∃ (C : ℝ) (d₀ : ℕ), 0 < C ∧ ∀ d, d₀ ≤ d → + ∀ (U : Type) [MeasurableSpace U] [Finite U] [MeasurableSingletonClass U], + ∀ (P : Measure ((Sphere d×U)×Rows (d/32) d)) [IsProbabilityMeasure P], + (P.map swapLast).fst = (uniformSphere d).prod (gaussianRows (d/32) d) → + exposedInformation (P.fst.prod (gaussianRows (d/32+(d/4-d/32)) d)) ≤ + exposedInformation (alignedExperiment (r:=d/4-d/32) P) + + ENNReal.ofReal (C*((d:ℝ)+Real.log (1+(d:ℝ)+(shannonEntropy P.fst.snd).toReal)+ + (shannonEntropy P.fst.snd).toReal/(d:ℝ))) + +def TwoLabelComparisonMain : Prop := + ∃ (C : ℝ) (d₀ : ℕ), 0 < C ∧ ∀ d, d₀ ≤ d → + ∀ (V : Type) [MeasurableSpace V] [Finite V] [MeasurableSingletonClass V], + ∀ (P : Measure ((Sphere d×V)×Rows (d/8) d)) [IsProbabilityMeasure P], + (P.map swapLast).fst = (uniformSphere d).prod (gaussianRows (d/8) d) → + shannonEntropy P.fst.snd ≤ ENNReal.ofReal ((d:ℝ)^2) → + exposedInformation (P.fst.prod (gaussianRows (d/8+(d/2-d/8)) d)) ≤ + exposedInformation (alignedExperiment (r:=d/2-d/8) P) + ENNReal.ofReal (C*d) + +def blockInput {d m : ℕ} {U : Type*} (z : (Sphere d × U) × Rows m d) : + U × (Rows m d × (Fin m → ℝ)) := + (z.1.2, z.2, label z.2 (z.1.1 : Vector d)) + +lemma measurable_blockInput {d m : ℕ} {U : Type*} [MeasurableSpace U] : + Measurable (blockInput (d:=d) (m:=m) (U:=U)) := by + exact measurable_fst.snd.prodMk (measurable_snd.prodMk + ((measurable_own_label (d:=d) (k:=m)).comp + (measurable_snd.prodMk measurable_fst.fst))) + +def blockLaw {d m : ℕ} {U V : Type*} [MeasurableSpace U] [MeasurableSpace V] + (P : Measure (Sphere d × U)) + (κ : Kernel (U × (Rows m d × (Fin m → ℝ))) V) : + Measure (((Sphere d × U) × Rows m d) × V) := + (P.prod (gaussianRows m d)) ⊗ₘ κ.comap blockInput measurable_blockInput + +instance blockLaw_probability {d m : ℕ} {U V : Type*} + [MeasurableSpace U] [MeasurableSpace V] + (P : Measure (Sphere d × U)) [IsProbabilityMeasure P] + (κ : Kernel (U × (Rows m d × (Fin m → ℝ))) V) [IsMarkovKernel κ] : + IsProbabilityMeasure (blockLaw P κ) := by + unfold blockLaw + infer_instance + +def endingSignalLaw {d m : ℕ} {U V : Type*} + [MeasurableSpace U] [MeasurableSpace V] + (P : Measure (Sphere d × U)) + (κ : Kernel (U × (Rows m d × (Fin m → ℝ))) V) : Measure (Sphere d × V) := + (blockLaw P κ).map (fun z => (z.1.1.1, z.2)) + +instance endingSignalLaw_probability {d m : ℕ} {U V : Type*} + [MeasurableSpace U] [MeasurableSpace V] + (P : Measure (Sphere d × U)) [IsProbabilityMeasure P] + (κ : Kernel (U × (Rows m d × (Fin m → ℝ))) V) [IsMarkovKernel κ] : + IsProbabilityMeasure (endingSignalLaw P κ) := by + unfold endingSignalLaw + infer_instance + +def freshInformation {d : ℕ} {U : Type*} [MeasurableSpace U] [StandardBorelSpace U] + (P : Measure (Sphere d × U)) [IsFiniteMeasure P] (k : ℕ) : ℝ≥0∞ := + exposedInformation (P.prod (gaussianRows k d)) + +def hybridFirst (d : ℕ) : ℕ := (d+3)/4 + +def hybridLast (d : ℕ) : ℕ := d/2 + +def hybridCount (d : ℕ) : ℕ := hybridLast d - hybridFirst d + 1 + +def averagedFreshInformation {d : ℕ} {U : Type*} + [MeasurableSpace U] [StandardBorelSpace U] + (P : Measure (Sphere d × U)) [IsFiniteMeasure P] : ℝ := + (∑ k ∈ Finset.Icc (hybridFirst d) (hybridLast d), (freshInformation P k).toReal) / + hybridCount d + +def HybridBlockMain : Prop := + ∃ (C C' : ℝ) (d₀ : ℕ), 0 < C ∧ 0 < C' ∧ ∀ d, d₀ ≤ d → + ∀ m, 1 ≤ m → m ≤ d/8 → + ∀ (U V : Type) [Fintype U] [Fintype V] + [MeasurableSpace U] [MeasurableSpace V] + [MeasurableSingletonClass U] [MeasurableSingletonClass V], + ∀ (P : Measure (Sphere d × U)) [IsProbabilityMeasure P], + P.fst = uniformSphere d → + ∀ (κ : Kernel (U × (Rows m d × (Fin m → ℝ))) V) [IsMarkovKernel κ], + ∀ (B : ℝ), 0 ≤ B → + shannonEntropy (endingSignalLaw P κ).snd ≤ ENNReal.ofReal B → + averagedFreshInformation (endingSignalLaw P κ) - averagedFreshInformation P ≤ + C*m + (m:ℝ) / hybridCount d * (C + B / (d/8:ℕ)) + B / (d/32:ℕ) ∧ + (B ≤ (d:ℝ)^2 → + averagedFreshInformation (endingSignalLaw P κ) - averagedFreshInformation P ≤ C'*d) + +def FiberBlockMain : Prop := + ∃ (K : ℝ) (d₀ : ℕ), 0 < K ∧ ∀ d, d₀ ≤ d → + ∀ (U V : Type) [Fintype U] [Fintype V] + [MeasurableSpace U] [MeasurableSpace V] + [MeasurableSingletonClass U] [MeasurableSingletonClass V], + ∀ (P : Measure (Sphere d×U)) [IsProbabilityMeasure P], + P.fst = uniformSphere d → + ∀ (κ : Kernel (U×(Rows (d/10) d×(Fin (d/10)→ℝ))) V) [IsMarkovKernel κ], + ∀ N : ℕ, 1 ≤ N → Fintype.card V ≤ N → Real.log N ≤ (d:ℝ)^2 → + freshInformation (endingSignalLaw P κ) (d/3) ≤ freshInformation P (d/3) + ENNReal.ofReal (K*d) + +def dependentMapKernel {A B D : Type*} [MeasurableSpace A] [MeasurableSpace B] + [MeasurableSpace D] (κ : Kernel A B) (f : A×B → D) : Kernel A D := + (Kernel.id ×ₖ κ).map f + +def fiberObservationLaw (d k : ℕ) : Measure ((Rows k d×(Fin k→ℝ))×Sphere d) := + ((gaussianRows k d).prod (uniformSphere d)).map + (fun z => ((z.1,label z.1 (z.2:Vector d)),z.2)) + +instance uniformSphere_finite (d : ℕ) : IsFiniteMeasure (uniformSphere d) := by + constructor + unfold uniformSphere + rw [Measure.smul_apply, smul_eq_mul] + exact lt_of_le_of_lt (ENNReal.inv_mul_le_one _) ENNReal.one_lt_top + +instance fiberObservationLaw_finite (d k : ℕ) : IsFiniteMeasure (fiberObservationLaw d k) := by + unfold fiberObservationLaw + infer_instance + +lemma sphere_standardBorel (d : ℕ) : StandardBorelSpace (Sphere d) := + Metric.isClosed_sphere.measurableSet.standardBorel + +def sphericalFiberKernel (d k : ℕ) [sphereNonempty : Nonempty (Sphere d)] : + Kernel (Rows k d×(Fin k→ℝ)) (Sphere d) := + @Measure.condKernel (Rows k d×(Fin k→ℝ)) (Sphere d) _ _ + (sphere_standardBorel d) sphereNonempty + (fiberObservationLaw d k) (fiberObservationLaw_finite d k) + +instance sphericalFiberKernel_markov (d k : ℕ) [Nonempty (Sphere d)] : + IsMarkovKernel (sphericalFiberKernel d k) := by + unfold sphericalFiberKernel + infer_instance + +def fiberTwoPointLeft (d k : ℕ) [Nonempty (Sphere d)] : Measure (Rows k d×(Sphere d×Sphere d)) := + ((((gaussianRows k d).prod (uniformSphere d)).withDensity + (fun z => exactDensity (uniformSphere d) z.1 (label z.1 (z.2:Vector d)))) ⊗ₘ + ((sphericalFiberKernel d k).comap (fun z => (z.1,label z.1 (z.2:Vector d))) + (measurable_fst.prodMk measurable_own_label))).map + (fun z => (z.1.1,(z.1.2,z.2))) + +def perpendicularRow {d : ℕ} (v g : Vector d) : Vector d := + letI : NormedAddCommGroup (Vector d) := PiLp.normedAddCommGroup 2 (fun _ : Fin d => ℝ) + letI : InnerProductSpace ℝ (Vector d) := PiLp.innerProductSpace (fun _ : Fin d => ℝ) + g - (⟪v,g⟫ / ‖v‖^2) • v + +def perpendicularRowsKernel (d k : ℕ) : Kernel (Sphere d×Sphere d) (Rows k d) := + dependentMapKernel (Kernel.const (Sphere d×Sphere d) (gaussianRows k d)) + (fun z => fun i => perpendicularRow ((z.1.1:Vector d)-(z.1.2:Vector d)) (z.2 i)) + +def fiberTwoPointConstant (k : ℕ) : ℝ≥0∞ := + letI : OfNat ℝ 2 := @instOfNatAtLeastTwo ℝ 2 Real.instNatCast inferInstance + letI : Mul ℝ := Real.instMul + letI : Inv ℝ := Real.instInv + letI : Pow ℝ ℕ := @NPow.toPow ℝ Real.instMonoid.toNPow + ENNReal.ofReal ((Real.sqrt (2*Real.pi))⁻¹ ^ k) + +def fiberDistanceWeight {d : ℕ} (k : ℕ) (z : Sphere d×Sphere d) : ℝ≥0∞ := + (ENNReal.ofReal ‖(z.1:Vector d)-(z.2:Vector d)‖)⁻¹ ^ k + +def fiberTwoPointRight (d k : ℕ) : Measure (Rows k d×(Sphere d×Sphere d)) := + letI : IsScalarTower ℝ≥0∞ ℝ≥0∞ ℝ≥0∞ := Semigroup.isScalarTower + fiberTwoPointConstant k • + Measure.map (Prod.swap : (Sphere d×Sphere d)×Rows k d → Rows k d×(Sphere d×Sphere d)) + (Measure.compProd + (Measure.withDensity (Measure.prod (uniformSphere d) (uniformSphere d)) + (fiberDistanceWeight k)) + (perpendicularRowsKernel d k)) + +lemma uniformSphere_probability_of_pos {d : ℕ} (hd : 0 < d) : + IsProbabilityMeasure (uniformSphere d) := by + let : Nonempty (Fin d) := ⟨⟨0, hd⟩⟩ + constructor + rw [uniformSphere, Measure.smul_apply, smul_eq_mul] + apply ENNReal.inv_mul_cancel _ (measure_ne_top _ _) + rw [Measure.toSphere_apply_univ] + exact mul_ne_zero + (by exact_mod_cast (Module.finrank_pos (R := ℝ) (M := Vector d)).ne') + (Metric.measure_ball_pos volume 0 zero_lt_one).ne' + + +def FiberTwoPointMain : Prop := + ∀ (d k : ℕ) (_hk : 1 ≤ k) (hkd : k < d-1), + letI : IsProbabilityMeasure (uniformSphere d) := + uniformSphere_probability_of_pos (by omega) + letI : Nonempty (Sphere d) := nonempty_of_isProbabilityMeasure (uniformSphere d) + IsFiniteMeasure (fiberTwoPointLeft d k) ∧ IsFiniteMeasure (fiberTwoPointRight d k) ∧ + fiberTwoPointLeft d k = fiberTwoPointRight d k + +theorem mixedMomentMain : MixedMomentMain := by + sorry + +theorem actualRowMain {d m r q : ℕ} {W : Type*} [MeasurableSpace W] + [Countable W] [MeasurableSingletonClass W] + (hdim : AdmissibleDimensions d m r q) + (P : Measure ((Sphere d×W)×Rows m d)) [IsProbabilityMeasure P] + (ν : Measure (Sphere d)) [IsProbabilityMeasure ν] + (hInd : (P.map swapLast).fst = ν.prod (gaussianRows m d)) + (H : ℝ) (hν : ν ≤ ENNReal.ofReal H • uniformSphere d) + (hEntropy : shannonEntropy (P.map swapLast).snd ≠ ∞) + (ρ : PositiveMessage (P.map swapLast).snd → Measure (Sphere d)) + [∀ w, IsFiniteMeasure (ρ w)] + (_hρac : ∀ w, ρ w ≪ uniformSphere d) + (B D : PositiveMessage (P.map swapLast).snd → ℝ) + (hB : ∀ w, 0 < B w) (hD : ∀ w, 0 < D w) + (hgB : ∀ w, LocalGrowth (ρ w) (m+r) (B w)) + (hgD : ∀ w, LocalGrowth (ρ w) (d-1) (D w)) + (hCI : Integrable (fun sw : Sphere d×W => Real.log (1+momentBound 9 d + (completeFamily (P.map swapLast).snd B 1 sw.2) (completeFamily (P.map swapLast).snd D 1 sw.2))) P.fst) : + ActualRowConclusion (r:=r) (q:=q) P (completeFamily (P.map swapLast).snd ρ 0) + (completeFamily (P.map swapLast).snd B 1) (completeFamily (P.map swapLast).snd D 1) := by + sorry + +theorem actualRowRefinement {d m : ℕ} {W E : Type*} [MeasurableSpace W] + [MeasurableSpace E] [Countable W] [MeasurableSingletonClass W] + [Countable E] [MeasurableSingletonClass E] + (P : Measure ((Sphere d×W)×Rows m d)) [IsProbabilityMeasure P] + (e : Sphere d×W → E) (he : Measurable e) + (_hEntropy : shannonEntropy + ((P.map (fun p => ((p.1.1,(p.1.2,e p.1)),p.2))).map swapLast).snd ≠ ∞) : + rowInformation (P.map (fun p => ((p.1.1,(p.1.2,e p.1)),p.2))) (gaussianRows m d) = + rowInformation P (gaussianRows m d) := by + sorry + +theorem actualRowSourceMain {d m r q : ℕ} {W : Type*} [MeasurableSpace W] + [Countable W] [MeasurableSingletonClass W] + (hdim : AdmissibleDimensions d m r q) + (P : Measure ((Sphere d×W)×Rows m d)) [IsProbabilityMeasure P] + (ν : Measure (Sphere d)) [IsProbabilityMeasure ν] + (hInd : (P.map swapLast).fst = ν.prod (gaussianRows m d)) + (H : ℝ) (hν : ν ≤ ENNReal.ofReal H • uniformSphere d) + (hEntropy : shannonEntropy (P.map swapLast).snd ≠ ∞) + (ρ : PositiveMessage (P.map swapLast).snd → Measure (Sphere d)) + [∀ w, IsFiniteMeasure (ρ w)] + (_hρac : ∀ w, ρ w ≪ uniformSphere d) + (B D : PositiveMessage (P.map swapLast).snd → ℝ) + (hB : ∀ w, 0 < B w) (hD : ∀ w, 0 < D w) + (hgB : ∀ w, LocalGrowth (ρ w) (m+r) (B w)) + (hgD : ∀ w, LocalGrowth (ρ w) (d-1) (D w)) + (hCI : Integrable (fun sw : Sphere d×W => Real.log (1+momentBound 9 d + (completeFamily (P.map swapLast).snd B 1 sw.2) (completeFamily (P.map swapLast).snd D 1 sw.2))) P.fst) : + ActualRowSourceConclusion (r:=r) (q:=q) P (completeFamily (P.map swapLast).snd ρ 0) + (completeFamily (P.map swapLast).snd B 1) (completeFamily (P.map swapLast).snd D 1) := by + sorry + +theorem actualRowSourceRefinement {d m : ℕ} {W E : Type*} [MeasurableSpace W] + [MeasurableSpace E] [Countable W] [MeasurableSingletonClass W] + [Countable E] [MeasurableSingletonClass E] + (P : Measure ((Sphere d×W)×Rows m d)) [IsProbabilityMeasure P] + (ν : Measure (Sphere d)) [IsProbabilityMeasure ν] + (hInd : (P.map swapLast).fst = ν.prod (gaussianRows m d)) + (e : Sphere d×W → E) (he : Measurable e) + (hEntropy : shannonEntropy + ((P.map (fun p => ((p.1.1,(p.1.2,e p.1)),p.2))).map swapLast).snd ≠ ∞) : + actualConditionalRowInformation (P.map (fun p => ((p.1.1,(p.1.2,e p.1)),p.2))) = + actualConditionalRowInformation P := by + sorry + +theorem criticalComparisonMain : CriticalComparisonMain := by + sorry + +theorem oneLevelComparisonMain : OneLevelComparisonMain := by + sorry + +theorem twoLabelComparisonMain : TwoLabelComparisonMain := by + sorry + +theorem hybridBlockMain : HybridBlockMain := by + sorry + +theorem fiberTwoPointMain : FiberTwoPointMain := by + sorry + +theorem fiberBlockMain : FiberBlockMain := by + sorry + +end CurrentProjection + +end + +end OAI diff --git a/lean/ComparatorChallenges/GeneralMahler.json b/lean/ComparatorChallenges/GeneralMahler.json new file mode 100644 index 0000000000000000000000000000000000000000..683100b6bbdcf27ab1ee1173b475fedf4df23a34 --- /dev/null +++ b/lean/ComparatorChallenges/GeneralMahler.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.GeneralMahler", + "solution_module": "OAI.Geometry.Convex.GeneralMahler.Theorem", + "theorem_names": [ + "OAI.GeneralMahler.general_mahler" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/GeneralMahler.lean b/lean/ComparatorChallenges/GeneralMahler.lean new file mode 100644 index 0000000000000000000000000000000000000000..c44124bf2cf547a348e648e57854cd6bf3c872a7 --- /dev/null +++ b/lean/ComparatorChallenges/GeneralMahler.lean @@ -0,0 +1,38 @@ +import Mathlib + +namespace OAI + +noncomputable section + +open Set MeasureTheory +open scoped RealInnerProductSpace + +namespace GeneralMahler + +abbrev Rn (n : ℕ) := EuclideanSpace ℝ (Fin n) + +/-- The polar of a convex body translated by an interior center. -/ +def polarAt {n : ℕ} (K : Set (Rn n)) (z : Rn n) : Set (Rn n) := + {y | ∀ x ∈ K, ⟪y, x - z⟫ ≤ 1} + +/-- The volume product minimized over the interior centers of the body. -/ +def volumeProduct {n : ℕ} (K : Set (EuclideanSpace ℝ (Fin n))) : ℝ := + sInf ((fun z => (volume K).toReal * (volume (polarAt K z)).toReal) '' + interior K) + +/-- The sharp general Mahler inequality, with equality exactly for simplices. -/ +theorem general_mahler {n : ℕ} (hn : 1 ≤ n) + (K : Set (EuclideanSpace ℝ (Fin n))) + (hcompact : IsCompact K) (hconvex : Convex ℝ K) + (hinterior : (interior K).Nonempty) : + ((n : ℝ) + 1) ^ (n + 1) / (Nat.factorial n : ℝ) ^ 2 ≤ volumeProduct K ∧ + (volumeProduct K = ((n : ℝ) + 1) ^ (n + 1) / (Nat.factorial n : ℝ) ^ 2 ↔ + ∃ vertices : Fin (n + 1) → EuclideanSpace ℝ (Fin n), + AffineIndependent ℝ vertices ∧ K = convexHull ℝ (range vertices)) := by + sorry + +end GeneralMahler + +end + +end OAI diff --git a/lean/ComparatorChallenges/GeneralizedStarHeight.json b/lean/ComparatorChallenges/GeneralizedStarHeight.json new file mode 100644 index 0000000000000000000000000000000000000000..e6827da825e0bd15e4b4f0c49d5c176973fb1cda --- /dev/null +++ b/lean/ComparatorChallenges/GeneralizedStarHeight.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.GeneralizedStarHeight", + "solution_module": "OAI.Computability.StarHeight.Main", + "theorem_names": [ + "OAI.GeneralizedStarHeight.main" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/GeneralizedStarHeight.lean b/lean/ComparatorChallenges/GeneralizedStarHeight.lean new file mode 100644 index 0000000000000000000000000000000000000000..83f6eb37ef3b31ddc55152df57c6ed06d1e6b168 --- /dev/null +++ b/lean/ComparatorChallenges/GeneralizedStarHeight.lean @@ -0,0 +1,48 @@ +import Mathlib + +namespace OAI + +namespace GeneralizedStarHeight + +universe u + +inductive Expression (Alphabet : Type u) : Type u + | zero : Expression Alphabet + | one : Expression Alphabet + | letter : Alphabet → Expression Alphabet + | union : Expression Alphabet → Expression Alphabet → Expression Alphabet + | concat : Expression Alphabet → Expression Alphabet → Expression Alphabet + | compl : Expression Alphabet → Expression Alphabet + | star : Expression Alphabet → Expression Alphabet + +namespace Expression + +open scoped Computability + +def language {Alphabet : Type u} : Expression Alphabet → Language Alphabet + | .zero => 0 + | .one => 1 + | .letter a => {[a]} + | .union P Q => P.language + Q.language + | .concat P Q => P.language * Q.language + | .compl P => P.languageᶜ + | .star P => P.language∗ + +def height {Alphabet : Type u} : Expression Alphabet → ℕ + | .zero | .one | .letter _ => 0 + | .union P Q | .concat P Q => max P.height Q.height + | .compl P => P.height + | .star P => 1 + P.height + +end Expression + +def HasHeightAtMost {Alphabet : Type u} (L : Language Alphabet) (n : ℕ) : Prop := + ∃ P : Expression Alphabet, P.language = L ∧ P.height ≤ n + +theorem main {Alphabet : Type u} [Finite Alphabet] (L : Language Alphabet) (hL : L.IsRegular) : + HasHeightAtMost L 3 := by + sorry + +end GeneralizedStarHeight + +end OAI diff --git a/lean/ComparatorChallenges/GotsmanLinial.json b/lean/ComparatorChallenges/GotsmanLinial.json new file mode 100644 index 0000000000000000000000000000000000000000..9caa69252d0179207072d37866053bdde078787b --- /dev/null +++ b/lean/ComparatorChallenges/GotsmanLinial.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.GotsmanLinial", + "solution_module": "OAI.Combinatorics.GotsmanLinial.Main", + "theorem_names": [ + "OAI.LeanBlast.GotsmanLinial.gotsmanLinialStatement" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/GotsmanLinial.lean b/lean/ComparatorChallenges/GotsmanLinial.lean new file mode 100644 index 0000000000000000000000000000000000000000..98080b0b24e286e5802b8aef4f155ae11ceeb802 --- /dev/null +++ b/lean/ComparatorChallenges/GotsmanLinial.lean @@ -0,0 +1,54 @@ +import Mathlib.Algebra.MvPolynomial.Degrees +import Mathlib.Algebra.BigOperators.Field +import Mathlib.Data.Fintype.BigOperators +import Mathlib.Analysis.Real.Sqrt +import Mathlib.Tactic.NormNum + +namespace OAI + +open scoped BigOperators + +namespace LeanBlast.GotsmanLinial + +abbrev Cube (n : ℕ) := Fin n → Bool + +def cubeCoord {n : ℕ} (x : Cube n) (i : Fin n) : ℝ := + if x i then 1 else -1 + +def flip {n : ℕ} (i : Fin n) (x : Cube n) : Cube n := + Function.update x i (!(x i)) + +noncomputable def thresholdSign (t : ℝ) : ℝ := + if 0 ≤ t then 1 else -1 + +noncomputable def sensitiveVertices {n : ℕ} (f : Cube n → ℝ) (i : Fin n) : + Finset (Cube n) := by + classical + exact Finset.univ.filter fun x => f x ≠ f (flip i x) + +noncomputable def averageSensitivity {n : ℕ} (f : Cube n → ℝ) : ℝ := + ∑ i : Fin n, ((sensitiveVertices f i).card : ℝ) / (2 : ℝ) ^ n + +def IsMultilinear {n : ℕ} (p : MvPolynomial (Fin n) ℝ) : Prop := + ∀ m ∈ p.support, ∀ i : Fin n, m i ≤ 1 + +noncomputable def polynomialValue {n : ℕ} (p : MvPolynomial (Fin n) ℝ) + (x : Cube n) : ℝ := + MvPolynomial.eval (cubeCoord x) p + +noncomputable def polynomialThreshold {n : ℕ} (p : MvPolynomial (Fin n) ℝ) : + Cube n → ℝ := + fun x => thresholdSign (polynomialValue p x) + +def GotsmanLinialStatement : Prop := + ∀ (n d : ℕ), 1 ≤ n → 1 ≤ d → d ≤ n → + ∀ p : MvPolynomial (Fin n) ℝ, + IsMultilinear p → p.totalDegree ≤ d → + averageSensitivity (polynomialThreshold p) ≤ 8 * (d : ℝ) * Real.sqrt (n : ℝ) + +theorem gotsmanLinialStatement : GotsmanLinialStatement := by + sorry + +end LeanBlast.GotsmanLinial + +end OAI diff --git a/lean/ComparatorChallenges/GrahamSpherical.json b/lean/ComparatorChallenges/GrahamSpherical.json new file mode 100644 index 0000000000000000000000000000000000000000..1a24217a7982d3920a84790ab17372488fb8011c --- /dev/null +++ b/lean/ComparatorChallenges/GrahamSpherical.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.GrahamSpherical", + "solution_module": "OAI.Combinatorics.SphericalRamsey.Main", + "theorem_names": [ + "OAI.GrahamSpherical.full_main" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/GrahamSpherical.lean b/lean/ComparatorChallenges/GrahamSpherical.lean new file mode 100644 index 0000000000000000000000000000000000000000..374d630d3bdc64c298ff362e778d9a967509f331 --- /dev/null +++ b/lean/ComparatorChallenges/GrahamSpherical.lean @@ -0,0 +1,65 @@ +import Mathlib.Analysis.InnerProductSpace.PiL2 +import Mathlib.Topology.Algebra.InfiniteSum.Real + +namespace OAI + +noncomputable section + +namespace GrahamSpherical + +abbrev Point (n : ℕ) := EuclideanSpace ℝ (Fin n) +abbrev Label := Fin 3 × Fin 4 + +def parameter : ℝ := ∑' m : ℕ, 1 / (10 : ℝ) ^ ((m + 1).factorial) + +def u : ℝ := (1 - parameter ^ 2) / (1 + parameter ^ 2) +def v : ℝ := (2 * parameter) / (1 + parameter ^ 2) + +def squareCoordinate (q : Fin 4) : Fin 2 → ℝ := + if q = 0 then ![1, 0] else + if q = 1 then ![-1, 0] else + if q = 2 then ![0, 1] else ![0, -1] + +def coordinates (i : Label) : Fin 2 → ℝ := + let q := squareCoordinate i.2 + if i.1 = 0 then ![u * q 0 - v * q 1, v * q 0 + u * q 1] else + if i.1 = 1 then ![u * q 0 + v * q 1, -v * q 0 + u * q 1] else q + +def vertex (i : Label) : Point 2 := WithLp.toLp 2 (coordinates i) + +def witness : Set (Point 2) := Set.range vertex + +def AvoidsCopy {d n r : ℕ} (X : Set (Point d)) (color : Point n → Fin r) : Prop := + ¬ ∃ f : X → Point n, Isometry f ∧ ∃ c : Fin r, ∀ x, color (f x) = c + +def EuclideanRamsey {d : ℕ} (X : Set (Point d)) : Prop := + ∀ r : ℕ, 0 < r → ∃ n : ℕ, 0 < n ∧ + ∀ color : Point n → Fin r, + ∃ f : X → Point n, Isometry f ∧ ∃ c : Fin r, ∀ x, color (f x) = c + +end GrahamSpherical + +end + +namespace GrahamSpherical.Specification + +def FullAuthoredResult : Prop := + witness.ncard = 12 ∧ + witness ⊆ Metric.sphere (0 : Point 2) 1 ∧ + (∀ n : ℕ, 0 < n → ∃ color : Point n → Fin 50, AvoidsCopy witness color) ∧ + ¬ EuclideanRamsey witness + +end GrahamSpherical.Specification + +noncomputable section + +namespace GrahamSpherical + +theorem full_main : Specification.FullAuthoredResult := by + sorry + +end GrahamSpherical + +end + +end OAI diff --git a/lean/ComparatorChallenges/GrothendieckElementaryExpansion.json b/lean/ComparatorChallenges/GrothendieckElementaryExpansion.json new file mode 100644 index 0000000000000000000000000000000000000000..139fca9b76ea0dd80d81fff1345938ba5be5a5ab --- /dev/null +++ b/lean/ComparatorChallenges/GrothendieckElementaryExpansion.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.GrothendieckElementaryExpansion", + "solution_module": "OAI.CategoryTheory.Globular.Main", + "theorem_names": [ + "OAI.Grothendieck.elementary_expansion" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/GrothendieckElementaryExpansion.lean b/lean/ComparatorChallenges/GrothendieckElementaryExpansion.lean new file mode 100644 index 0000000000000000000000000000000000000000..6d29a8739830ee5d52483648037eccde4677add2 --- /dev/null +++ b/lean/ComparatorChallenges/GrothendieckElementaryExpansion.lean @@ -0,0 +1,476 @@ +import Mathlib + +namespace OAI + +universe u v w + +namespace Grothendieck + +structure GlobularSet where + Cell : ℕ → Type u + source : ∀ n, Cell (n + 1) → Cell n + target : ∀ n, Cell (n + 1) → Cell n + source_source : ∀ n x, source n (source (n + 1) x) = source n (target (n + 1) x) + target_source : ∀ n x, target n (source (n + 1) x) = target n (target (n + 1) x) + +namespace GlobularSet + +@[ext] +structure Hom (X Y : GlobularSet.{u}) where + app : ∀ n, X.Cell n → Y.Cell n + source_app : ∀ n x, app n (X.source n x) = Y.source n (app (n + 1) x) + target_app : ∀ n x, app n (X.target n x) = Y.target n (app (n + 1) x) + +def Parallel (X : GlobularSet.{u}) : ∀ n, X.Cell n → X.Cell n → Prop + | 0, _, _ => True + | n + 1, x, y => X.source n x = X.source n y ∧ X.target n x = X.target n y + +def Joined (X : GlobularSet.{u}) (n : ℕ) (x y : X.Cell n) : Prop := + ∃ h : X.Cell (n + 1), X.source n h = x ∧ X.target n h = y + +def Boundary (X : GlobularSet.{u}) : ℕ → Type u + | 0 => PUnit + | n + 1 => { p : X.Cell n × X.Cell n // X.Parallel n p.1 p.2 } + +def boundary (X : GlobularSet.{u}) : ∀ n, X.Cell n → X.Boundary n + | 0, _ => PUnit.unit + | n + 1, x => ⟨(X.source n x, X.target n x), by + cases n with + | zero => trivial + | succ n => exact ⟨X.source_source n x, X.target_source n x⟩⟩ + +def Hom.boundaryMap {X Y : GlobularSet.{u}} (f : Hom X Y) : ∀ n, X.Boundary n → Y.Boundary n + | 0, _ => PUnit.unit + | n + 1, b => ⟨(f.app n b.1.1, f.app n b.1.2), by + cases n with + | zero => trivial + | succ n => + exact ⟨by rw [← f.source_app, ← f.source_app, b.2.1], + by rw [← f.target_app, ← f.target_app, b.2.2]⟩⟩ + +end GlobularSet + +open CategoryTheory CategoryTheory.Limits Opposite + +@[ext] +structure Globe where + dim : ℕ + +namespace Globe + +inductive Face : ℕ → ℕ → Type + | id (n : ℕ) : Face n n + | face {m n : ℕ} (lt : m < n) (side : Bool) : Face m n + +namespace Face + +def comp {m n k : ℕ} : Face m n → Face n k → Face m k + | .id _, g => g + | .face h b, .id _ => .face h b + | .face h b, .face h' _ => .face (h.trans h') b + +end Face + +instance : Category Globe where + Hom m n := Face m.dim n.dim + id m := .id m.dim + comp := Face.comp + id_comp _ := rfl + comp_id {X Y} f := by cases X; cases Y; cases f <;> rfl + assoc {W X Y Z} f g h := by + cases W; cases X; cases Y; cases Z + cases f <;> cases g <;> cases h <;> rfl + +def face {m n : ℕ} (h : m < n) (side : Bool) : Globe.mk m ⟶ Globe.mk n := + Face.face h side + +def source (n : ℕ) : Globe.mk n ⟶ Globe.mk (n + 1) := face (Nat.lt_succ_self n) false + +def target (n : ℕ) : Globe.mk n ⟶ Globe.mk (n + 1) := face (Nat.lt_succ_self n) true + +end Globe + +abbrev GlobularPresheaf := Globeᵒᵖ ⥤ Type u + +namespace GlobularPresheaf + +def underlying (X : GlobularPresheaf.{u}) : GlobularSet.{u} where + Cell n := X.obj (op (Globe.mk n)) + source n := X.map (Globe.source n).op + target n := X.map (Globe.target n).op + source_source n x := by + have h := congrArg (fun f => X.map f) (congrArg Quiver.Hom.op (show Globe.source n ≫ Globe.source (n + 1) = Globe.source n ≫ Globe.target (n + 1) from rfl)) + simpa only [op_comp, X.map_comp, types_comp_apply] using ConcreteCategory.congr_hom h x + target_source n x := by + have h := congrArg (fun f => X.map f) (congrArg Quiver.Hom.op (show Globe.target n ≫ Globe.source (n + 1) = Globe.target n ≫ Globe.target (n + 1) from rfl)) + simpa only [op_comp, X.map_comp, types_comp_apply] using ConcreteCategory.congr_hom h x + +def underlyingMap {X Y : GlobularPresheaf.{u}} (f : X ⟶ Y) : X.underlying.Hom Y.underlying where + app n := f.app (op (Globe.mk n)) + source_app n x := by + exact ConcreteCategory.congr_hom (f.naturality (Globe.source n).op) x + target_app n x := by + exact ConcreteCategory.congr_hom (f.naturality (Globe.target n).op) x + +def disk (n : ℕ) : GlobularPresheaf.{u} := uliftYoneda.{u}.obj (Globe.mk n) + +def face {m n : ℕ} (h : m < n) (side : Bool) : disk.{u} m ⟶ disk.{u} n := + uliftYoneda.{u}.map (Globe.face h side) + +end GlobularPresheaf + +inductive Table : ℕ → Type + | globe (n : ℕ) : Table n + | attach {last : ℕ} (T : Table last) (b h : ℕ) (left : b < last) (right : b < h) : Table h + +namespace Table + +def height : {n : ℕ} → Table n → ℕ + | _, .globe n => n + | _, .attach T _ h _ _ => max T.height h + +noncomputable def realizeWithLast : {n : ℕ} → Table n → + (Σ X : GlobularPresheaf.{0}, GlobularPresheaf.disk n ⟶ X) + | _, .globe n => ⟨GlobularPresheaf.disk n, 𝟙 _⟩ + | _, .attach T _ h hl hr => + let prev := T.realizeWithLast + let f := GlobularPresheaf.face hl true ≫ prev.2 + let g := GlobularPresheaf.face hr false + ⟨pushout f g, pushout.inr f g⟩ + +noncomputable def realize {n} (T : Table n) : GlobularPresheaf.{0} := T.realizeWithLast.1 + +noncomputable def lastInclusion {n} (T : Table n) : GlobularPresheaf.disk n ⟶ T.realize := + T.realizeWithLast.2 + +end Table + +abbrev Shape := Σ n, Table n + +namespace Shape + +noncomputable def realize (S : Shape) : GlobularPresheaf.{0} := S.2.realize + +def height (S : Shape) : ℕ := S.2.height + +def globe (n : ℕ) : Shape := ⟨n, Table.globe n⟩ + +noncomputable instance : Category Shape where + Hom S T := S.realize ⟶ T.realize + id S := 𝟙 S.realize + comp f g := f ≫ g + id_comp := Category.id_comp + comp_id := Category.comp_id + assoc := Category.assoc + +noncomputable def face {m n : ℕ} (h : m < n) (side : Bool) : globe m ⟶ globe n := + GlobularPresheaf.face h side + +noncomputable def source (n : ℕ) : globe n ⟶ globe (n + 1) := face (Nat.lt_succ_self n) false + +noncomputable def target (n : ℕ) : globe n ⟶ globe (n + 1) := face (Nat.lt_succ_self n) true + +def attach (S : Shape) (b h : ℕ) (hl : b < S.1) (hr : b < h) : Shape := + ⟨h, Table.attach S.2 b h hl hr⟩ + +noncomputable def seam (S : Shape) {b : ℕ} (hl : b < S.1) : globe b ⟶ S := + show GlobularPresheaf.disk b ⟶ S.realize from + GlobularPresheaf.face hl true ≫ S.2.lastInclusion + +noncomputable def inl (S : Shape) (b h : ℕ) (hl : b < S.1) (hr : b < h) : + S ⟶ S.attach b h hl hr := + pushout.inl (GlobularPresheaf.face hl true ≫ S.2.lastInclusion) + (GlobularPresheaf.face hr false) + +noncomputable def inr (S : Shape) (b h : ℕ) (hl : b < S.1) (hr : b < h) : + globe h ⟶ S.attach b h hl hr := + pushout.inr (GlobularPresheaf.face hl true ≫ S.2.lastInclusion) + (GlobularPresheaf.face hr false) + +end Shape + +structure TheoryData where + Hom : Shape → Shape → Type v + id : ∀ S, Hom S S + comp : ∀ {S T U}, Hom S T → Hom T U → Hom S U + id_comp : ∀ {S T} (f : Hom S T), comp (id S) f = f + comp_id : ∀ {S T} (f : Hom S T), comp f (id T) = f + assoc : ∀ {R S T U} (f : Hom R S) (g : Hom S T) (h : Hom T U), + comp (comp f g) h = comp f (comp g h) + base : ∀ {S T}, (S ⟶ T) → Hom S T + base_id : ∀ S, base (𝟙 S) = id S + base_comp : ∀ {R S T} (f : R ⟶ S) (g : S ⟶ T), base (f ≫ g) = comp (base f) (base g) + +namespace TheoryData + +structure Obj (C : TheoryData.{v}) where + shape : Shape + +instance (C : TheoryData.{v}) : Category C.Obj where + Hom S T := C.Hom S.shape T.shape + id S := C.id S.shape + comp f g := C.comp f g + id_comp := C.id_comp + comp_id := C.comp_id + assoc := C.assoc + +noncomputable def arity (C : TheoryData.{v}) : Shape ⥤ C.Obj where + obj S := ⟨S⟩ + map f := C.base f + map_id := C.base_id + map_comp := C.base_comp + +def PreservesGlobularSums (C : TheoryData.{v}) : Prop := + ∀ (S : Shape) (b h : ℕ) (hl : b < S.1) (hr : b < h), + IsPushout (C.arity.map (S.seam hl)) (C.arity.map (Shape.face hr false)) + (C.arity.map (S.inl b h hl hr)) (C.arity.map (S.inr b h hl hr)) + +end TheoryData + +structure GlobularTheory extends TheoryData.{v} where + sums : toTheoryData.PreservesGlobularSums + +namespace GlobularTheory + +abbrev Obj (C : GlobularTheory.{v}) := C.toTheoryData.Obj + +@[ext] +structure Morphism (C D : GlobularTheory.{v}) where + map : ∀ {S T}, C.Hom S T → D.Hom S T + map_id : ∀ S, map (C.id S) = D.id S + map_comp : ∀ {R S T} (f : C.Hom R S) (g : C.Hom S T), + map (C.comp f g) = D.comp (map f) (map g) + map_base : ∀ {S T} (f : S ⟶ T), map (C.base f) = D.base f + +namespace Morphism + +def id (C : GlobularTheory.{v}) : Morphism C C where + map f := f + map_id _ := rfl + map_comp _ _ := rfl + map_base _ := rfl + +def comp {C D E : GlobularTheory.{v}} (f : Morphism C D) (g : Morphism D E) : Morphism C E where + map a := g.map (f.map a) + map_id S := by rw [f.map_id, g.map_id] + map_comp a b := by rw [f.map_comp, g.map_comp] + map_base a := by rw [f.map_base, g.map_base] + +end Morphism + +def Parallel (C : GlobularTheory.{v}) {S : Shape} : + ∀ n, C.Hom (Shape.globe n) S → C.Hom (Shape.globe n) S → Prop + | 0, _, _ => True + | n + 1, f, g => + C.comp (C.base (Shape.source n)) f = C.comp (C.base (Shape.source n)) g ∧ + C.comp (C.base (Shape.target n)) f = C.comp (C.base (Shape.target n)) g + +structure AdmissiblePair (C : GlobularTheory.{v}) where + n : ℕ + arity : Shape + height : arity.height ≤ n + 1 + source : C.Hom (Shape.globe n) arity + target : C.Hom (Shape.globe n) arity + parallel : C.Parallel n source target + +def Fills {C D : GlobularTheory.{v}} (f : Morphism C D) (p : C.AdmissiblePair) + (z : D.Hom (Shape.globe (p.n + 1)) p.arity) : Prop := + D.comp (D.base (Shape.source p.n)) z = f.map p.source ∧ + D.comp (D.base (Shape.target p.n)) z = f.map p.target + +def IsFreeExtension {C D : GlobularTheory.{v}} (f : Morphism C D) + (G : Type v) (pair : G → C.AdmissiblePair) + (filler : ∀ g, D.Hom (Shape.globe ((pair g).n + 1)) (pair g).arity) : Prop := + (∀ g, Fills f (pair g) (filler g)) ∧ + ∀ (E : GlobularTheory.{v}) (a : Morphism C E) + (chosen : ∀ g, E.Hom (Shape.globe ((pair g).n + 1)) (pair g).arity), + (∀ g, Fills a (pair g) (chosen g)) → + ∃! b : Morphism D E, f.comp b = a ∧ ∀ g, b.map (filler g) = chosen g + +structure CellularPresentation (C : GlobularTheory.{v}) where + stage : ℕ → GlobularTheory.{v} + initial : ∀ D : GlobularTheory.{v}, Nonempty (Unique (Morphism (stage 0) D)) + step : ∀ r, Morphism (stage r) (stage (r + 1)) + generators : ℕ → Type v + pair : ∀ r, generators r → (stage r).AdmissiblePair + filler : ∀ r g, (stage (r + 1)).Hom (Shape.globe ((pair r g).n + 1)) (pair r g).arity + free : ∀ r, IsFreeExtension (step r) (generators r) (pair r) (filler r) + inclusion : ∀ r, Morphism (stage r) C + compatible : ∀ r, (step r).comp (inclusion (r + 1)) = inclusion r + colimit : ∀ (D : GlobularTheory.{v}) (a : ∀ r, Morphism (stage r) D), + (∀ r, (step r).comp (a (r + 1)) = a r) → + ∃! b : Morphism C D, ∀ r, (inclusion r).comp b = a r + +def IsCoherator (C : GlobularTheory.{v}) : Prop := + Nonempty C.CellularPresentation ∧ + ∀ p : C.AdmissiblePair, ∃ z, Fills (Morphism.id C) p z + +noncomputable def shapeGlobes : Globe ⥤ Shape where + obj n := Shape.globe n.dim + map f := uliftYoneda.map f + map_id n := by exact uliftYoneda.map_id n + map_comp f g := by exact uliftYoneda.map_comp f g + +noncomputable def globes (C : GlobularTheory.{v}) : Globe ⥤ C.Obj := + shapeGlobes ⋙ C.toTheoryData.arity + +structure Model (C : GlobularTheory.{v}) where + presheaf : C.Objᵒᵖ ⥤ Type v + sums : ∀ (S : Shape) (b h : ℕ) (hl : b < S.1) (hr : b < h), + IsPullback + (presheaf.map (C.toTheoryData.arity.map (S.inl b h hl hr)).op) + (presheaf.map (C.toTheoryData.arity.map (S.inr b h hl hr)).op) + (presheaf.map (C.toTheoryData.arity.map (S.seam hl)).op) + (presheaf.map (C.toTheoryData.arity.map (Shape.face hr false)).op) + +namespace Model + +instance (C : GlobularTheory.{v}) : Category C.Model where + Hom X Y := X.presheaf ⟶ Y.presheaf + id X := 𝟙 X.presheaf + comp f g := f ≫ g + id_comp := Category.id_comp + comp_id := Category.comp_id + assoc := Category.assoc + +noncomputable def underlying {C : GlobularTheory.{v}} (X : C.Model) : GlobularSet.{v} := + GlobularPresheaf.underlying (C.globes.op ⋙ X.presheaf) + +noncomputable def underlyingMap {C : GlobularTheory.{v}} {X Y : C.Model} (f : X ⟶ Y) : + X.underlying.Hom Y.underlying := + GlobularPresheaf.underlyingMap (Functor.whiskerLeft C.globes.op f) + +noncomputable def freeShape (C : GlobularTheory.{v}) (S : Shape) : C.Model where + presheaf := yoneda.obj ⟨S⟩ + sums T b h hl hr := ((C.sums T b h hl hr).op.map (yoneda.obj ⟨S⟩)).flip + +noncomputable def disk (C : GlobularTheory.{v}) (n : ℕ) : C.Model := + freeShape C (Shape.globe n) + +noncomputable def J (C : GlobularTheory.{v}) (n : ℕ) : disk C n ⟶ disk C (n + 1) := + show (disk C n).presheaf ⟶ (disk C (n + 1)).presheaf from + yoneda.map (C.toTheoryData.arity.map (Shape.source n)) + +structure BoundaryAttachment {C : GlobularTheory.{v}} {X Y : C.Model} (f : X ⟶ Y) where + index : Type v + dimension : index → ℕ + boundary : ∀ k, X.underlying.Boundary (dimension k) + cell : ∀ k, Y.underlying.Cell (dimension k) + cell_boundary : ∀ k, Y.underlying.boundary _ (cell k) = + (underlyingMap f).boundaryMap _ (boundary k) + universal : ∀ (Z : C.Model) (g : X ⟶ Z) + (z : ∀ k, Z.underlying.Cell (dimension k)), + (∀ k, Z.underlying.boundary _ (z k) = (underlyingMap g).boundaryMap _ (boundary k)) → + ∃! h : Y ⟶ Z, f ≫ h = g ∧ ∀ k, (underlyingMap h).app _ (cell k) = z k + +structure CellularPresentation {C : GlobularTheory.{v}} (X : C.Model) where + order : Type v + linearOrder : LinearOrder order + orderBot : OrderBot order + succOrder : SuccOrder order + wellFoundedLT : WellFoundedLT order + initial : C.Model + isInitial : IsInitial initial + start : initial ⟶ X + chain : @TransfiniteCompositionOfShape _ _ order linearOrder orderBot + _ _ start succOrder wellFoundedLT + attachment : ∀ j, ¬ IsMax j → BoundaryAttachment + (chain.F.map (homOfLE (Order.le_succ j))) + +def IsCellular {C : GlobularTheory.{v}} (X : C.Model) : Prop := Nonempty X.CellularPresentation + +end Model + +def unitPair (C : GlobularTheory.{v}) (n : ℕ) : C.AdmissiblePair where + n := n + arity := Shape.globe n + height := Nat.le_succ n + source := C.id (Shape.globe n) + target := C.id (Shape.globe n) + parallel := by cases n <;> simp [Parallel] + +noncomputable def unit (C : GlobularTheory.{v}) (hC : C.IsCoherator) (n : ℕ) : + C.Hom (Shape.globe (n + 1)) (Shape.globe n) := Classical.choose (hC.2 (C.unitPair n)) + +def Model.eval {C : GlobularTheory.{v}} (X : C.Model) {S T : Shape} (f : C.Hom S T) : + X.presheaf.obj (op (⟨T⟩ : C.Obj)) → X.presheaf.obj (op (⟨S⟩ : C.Obj)) := + X.presheaf.map (show (⟨S⟩ : C.Obj) ⟶ ⟨T⟩ from f).op + +noncomputable def Model.unitCell {C : GlobularTheory.{v}} (X : C.Model) (hC : C.IsCoherator) + (n : ℕ) (x : X.underlying.Cell n) : X.underlying.Cell (n + 1) := + X.eval (C.unit hC n) x + +noncomputable def Model.baseCell {C : GlobularTheory.{v}} (X : C.Model) (hC : C.IsCoherator) + (x : X.underlying.Cell 0) : ∀ n, X.underlying.Cell n + | 0 => x + | n + 1 => X.unitCell hC n (X.baseCell hC x n) + +def Model.Loops {C : GlobularTheory.{v}} (X : C.Model) (hC : C.IsCoherator) + (x : X.underlying.Cell 0) (n : ℕ) : Type v := + { z : X.underlying.Cell (n + 1) // X.underlying.source n z = X.baseCell hC x n ∧ + X.underlying.target n z = X.baseCell hC x n } + +def Model.Components {C : GlobularTheory.{v}} (X : C.Model) : Type v := + Quot (X.underlying.Joined 0) + +def Model.HomotopyGroup {C : GlobularTheory.{v}} (X : C.Model) (hC : C.IsCoherator) + (x : X.underlying.Cell 0) (n : ℕ) : Type v := + Quot (fun a b : X.Loops hC x n => X.underlying.Joined (n + 1) a.1 b.1) + +noncomputable def Model.loopsMap {C : GlobularTheory.{v}} {X Y : C.Model} (f : X ⟶ Y) + (hC : C.IsCoherator) (x : X.underlying.Cell 0) (n : ℕ) : + X.Loops hC x n → Y.Loops hC ((underlyingMap f).app 0 x) n := by + have hb : ∀ k, (underlyingMap f).app k (X.baseCell hC x k) = + Y.baseCell hC ((underlyingMap f).app 0 x) k := by + intro k + induction k with + | zero => rfl + | succ k ih => + have h := ConcreteCategory.congr_hom (f.naturality + (show (op (⟨Shape.globe k⟩ : C.Obj)) ⟶ op ⟨Shape.globe (k+1)⟩ from + Quiver.Hom.op (C.unit hC k))) (X.baseCell hC x k) + change (underlyingMap f).app (k+1) (X.unitCell hC k (X.baseCell hC x k)) = + Y.unitCell hC k ((underlyingMap f).app k (X.baseCell hC x k)) at h + simpa only [baseCell, ih] using h + exact fun z => ⟨(underlyingMap f).app (n + 1) z.1, + by rw [← (underlyingMap f).source_app, z.2.1, hb], + by rw [← (underlyingMap f).target_app, z.2.2, hb]⟩ + +noncomputable def Model.componentsMap {C : GlobularTheory.{v}} {X Y : C.Model} (f : X ⟶ Y) : + X.Components → Y.Components := + Quot.map ((underlyingMap f).app 0) (by + rintro _ _ ⟨h, hs, ht⟩ + exact ⟨(underlyingMap f).app _ h, + by rw [← (underlyingMap f).source_app, hs], + by rw [← (underlyingMap f).target_app, ht]⟩) + +noncomputable def Model.homotopyMap {C : GlobularTheory.{v}} {X Y : C.Model} (f : X ⟶ Y) + (hC : C.IsCoherator) (x : X.underlying.Cell 0) (n : ℕ) : + X.HomotopyGroup hC x n → Y.HomotopyGroup hC ((underlyingMap f).app 0 x) n := + Quot.map (loopsMap f hC x n) (by + rintro _ _ ⟨h, hs, ht⟩ + exact ⟨(underlyingMap f).app _ h, + by rw [← (underlyingMap f).source_app, hs]; rfl, + by rw [← (underlyingMap f).target_app, ht]; rfl⟩) + +def Model.WeakEquivalence {C : GlobularTheory.{v}} (hC : C.IsCoherator) {X Y : C.Model} + (f : X ⟶ Y) : Prop := + Function.Bijective (componentsMap f) ∧ + ∀ (x : X.underlying.Cell 0) (n : ℕ), Function.Bijective (homotopyMap f hC x n) + +end GlobularTheory + +open CategoryTheory CategoryTheory.Limits + +theorem elementary_expansion (C : GlobularTheory.{v}) (hC : C.IsCoherator) + (X : C.Model) (hX : X.IsCellular) (n : ℕ) + (a : GlobularTheory.Model.disk C n ⟶ X) + (Y : C.Model) (i : X ⟶ Y) + (b : GlobularTheory.Model.disk C (n + 1) ⟶ Y) + (square : IsPushout a (GlobularTheory.Model.J C n) i b) : + GlobularTheory.Model.WeakEquivalence hC i := by + sorry + +end Grothendieck + +end OAI diff --git a/lean/ComparatorChallenges/GroupRingDeterminant.json b/lean/ComparatorChallenges/GroupRingDeterminant.json new file mode 100644 index 0000000000000000000000000000000000000000..ec8808475e4db1030986436736186289966ea077 --- /dev/null +++ b/lean/ComparatorChallenges/GroupRingDeterminant.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.GroupRingDeterminant", + "solution_module": "OAI.Analysis.GroupDeterminants.Main", + "theorem_names": [ + "OAI.GroupRingDeterminant.main" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/GroupRingDeterminant.lean b/lean/ComparatorChallenges/GroupRingDeterminant.lean new file mode 100644 index 0000000000000000000000000000000000000000..565a9603826ed4033e6aa35abd52a80b39bcc0f5 --- /dev/null +++ b/lean/ComparatorChallenges/GroupRingDeterminant.lean @@ -0,0 +1,59 @@ +import Mathlib + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace GroupRingDeterminant + +/-- The Hilbert space l²(G)^n, with the product coordinates flattened. -/ +abbrev Hilbert (G : Type) (n : ℕ) := lp (fun _ : Fin n × G => ℂ) 2 + +/-- The identity vector in component i. -/ +def identityVector {G : Type} [Group G] {n : ℕ} (i : Fin n) : Hilbert G n := + by + classical + exact lp.single 2 (i, 1) 1 + +/-- The unnormalized matrix trace, linear in its operator argument. -/ +def groupTrace {G : Type} [Group G] {n : ℕ} + (T : Hilbert G n →L[ℂ] Hilbert G n) : ℂ := + ∑ i : Fin n, inner ℂ (identityVector i) (T (identityVector i)) + +/-- The invertible-case Fuglede--Kadison determinant. +It is used below only for invertible regular operators. -/ +def fkDet {G : Type} [Group G] {n : ℕ} + (T : Hilbert G n →L[ℂ] Hilbert G n) : ℝ := + Real.exp ((groupTrace (CFC.log (star T * T))).re / 2) + +/-- Exact coordinate specification of the bounded left-regular operator of A. -/ +def IsRegularOperator {G : Type} [Group G] {n : ℕ} + (A : Matrix (Fin n) (Fin n) (MonoidAlgebra ℤ G)) + (T : Hilbert G n →L[ℂ] Hilbert G n) : Prop := + ∀ (ξ : Hilbert G n) (i : Fin n) (h : G), + (T ξ) (i, h) = ∑ j : Fin n, + (A i j).coeff.sum fun g z => (z : ℂ) * ξ (j, g⁻¹ * h) + +/-- Coefficientwise extension from the integral to the rational group ring. -/ +def rationalMatrix {G : Type} [Group G] {n : ℕ} + (A : Matrix (Fin n) (Fin n) (MonoidAlgebra ℤ G)) : + Matrix (Fin n) (Fin n) (MonoidAlgebra ℚ G) := + A.map (MonoidAlgebra.mapRingHom G (Int.castRingHom ℚ)) + +/-- An integral group-ring matrix with rational and bounded inverses and determinant in (0, 1). -/ +def MainStatement : Prop := + ∃ (G : Type) (_ : Group G) (_ : Group.FG G) (n : ℕ), + 1 ≤ n ∧ ∃ (A : Matrix (Fin n) (Fin n) (MonoidAlgebra ℤ G)) + (T : Hilbert G n →L[ℂ] Hilbert G n), + IsUnit (rationalMatrix A) ∧ IsRegularOperator A T ∧ IsUnit T ∧ + 0 < fkDet T ∧ fkDet T < 1 + +theorem main : MainStatement := by + sorry + +end GroupRingDeterminant + +end + +end OAI diff --git a/lean/ComparatorChallenges/HadamardCubeFiber.json b/lean/ComparatorChallenges/HadamardCubeFiber.json new file mode 100644 index 0000000000000000000000000000000000000000..523adb1af0185b2c893afe948daa80eb1aedb349 --- /dev/null +++ b/lean/ComparatorChallenges/HadamardCubeFiber.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.HadamardCubeFiber", + "solution_module": "OAI.LinearAlgebra.Hadamard.Main", + "theorem_names": [ + "OAI.HadamardSix.rowRatio_cubeFiber_sum_zero" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/HadamardCubeFiber.lean b/lean/ComparatorChallenges/HadamardCubeFiber.lean new file mode 100644 index 0000000000000000000000000000000000000000..815e8a2d54b071bf057655eddf2301ac544d84c4 --- /dev/null +++ b/lean/ComparatorChallenges/HadamardCubeFiber.lean @@ -0,0 +1,37 @@ +import Mathlib + +namespace OAI + +/-! Cancellation of row ratios on a prescribed cubic fibre. -/ + +open scoped BigOperators Matrix + +namespace HadamardSix + +abbrev Index := Fin 6 +abbrev Matrix6 := Matrix Index Index ℂ + +def Unimodular (H : Matrix6) : Prop := ∀ i j, ‖H i j‖ = 1 + +def IsComplexHadamard (H : Matrix6) : Prop := + Unimodular H ∧ H.conjTranspose * H = (6 : ℂ) • (1 : Matrix6) + +def entrywiseSquare (H : Matrix6) : Matrix6 := fun i j => H i j ^ 2 + +noncomputable def cubeFiber (v : Index → ℂ) (z : ℂ) : Finset Index := by + classical + exact Finset.univ.filter (fun i => v i ^ 3 = z) + +noncomputable def rowRatio (H : Matrix6) (i j : Index) : Index → ℂ := + fun k => H i k * star (H j k) + +lemma rowRatio_cubeFiber_sum_zero {H : Matrix6} (hH : IsComplexHadamard H) + (hs : IsComplexHadamard (entrywiseSquare H)) {i j : Index} (hij : i ≠ j) + (a b : ℂ) (hne : a ≠ b) + (hab : ∀ k, rowRatio H i j k ^ 3 = a ∨ rowRatio H i j k ^ 3 = b) : + ∑ k ∈ cubeFiber (rowRatio H i j) a, H i k * star (H j k) = 0 := by + sorry + +end HadamardSix + +end OAI diff --git a/lean/ComparatorChallenges/HalvingLines.json b/lean/ComparatorChallenges/HalvingLines.json new file mode 100644 index 0000000000000000000000000000000000000000..8a90228b4ac38291644cbedaa07423aa4a55874b --- /dev/null +++ b/lean/ComparatorChallenges/HalvingLines.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.HalvingLines", + "solution_module": "OAI.Combinatorics.HalvingLines.Main", + "theorem_names": [ + "OAI.PlanarHalving.power_bounds" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/HalvingLines.lean b/lean/ComparatorChallenges/HalvingLines.lean new file mode 100644 index 0000000000000000000000000000000000000000..08385f589feaadece48b5b05fc727af00fab5d62 --- /dev/null +++ b/lean/ComparatorChallenges/HalvingLines.lean @@ -0,0 +1,56 @@ +import Mathlib + +namespace OAI + +namespace PlanarHalving + +abbrev Point := ℝ × ℝ + +def orient (p q r : Point) : ℝ := + (q.1 - p.1) * (r.2 - p.2) - (q.2 - p.2) * (r.1 - p.1) + +def GeneralPosition {n : ℕ} (P : Fin n → Point) : Prop := + Function.Injective P ∧ ∀ i j l, i ≠ j → j ≠ l → i ≠ l → + orient (P i) (P j) (P l) ≠ 0 + +noncomputable def sideCount {n : ℕ} (P : Fin n → Point) (i j : Fin n) : ℕ := + (Finset.univ.filter fun l => 0 < orient (P i) (P j) (P l)).card + +noncomputable def halvingCount {n : ℕ} (P : Fin n → Point) : ℕ := + (Finset.univ.filter fun ij : Fin n × Fin n => + ij.1 < ij.2 ∧ sideCount P ij.1 ij.2 = (n - 2) / 2 ∧ + sideCount P ij.2 ij.1 = (n - 2) / 2).card + +noncomputable def slope (p q : Point) : ℝ := (q.2 - p.2) / (q.1 - p.1) + +def Generic {n : ℕ} (P : Fin n → Point) : Prop := + GeneralPosition P ∧ + (∀ i j, i ≠ j → (P i).1 ≠ (P j).1) ∧ + (∀ i j a b, i < j → a < b → slope (P i) (P j) = slope (P a) (P b) → + i = a ∧ j = b) ∧ + (∀ i j a b c d, i < j → a < b → c < d → + (i, j) ≠ (a, b) → (c, d) ≠ (i, j) → (c, d) ≠ (a, b) → + ∀ z : Point, z ∈ openSegment ℝ (P i) (P j) → + z ∈ openSegment ℝ (P a) (P b) → z ∉ segment ℝ (P c) (P d)) + +noncomputable def belowCount {n : ℕ} (P : Fin n → Point) (i j : Fin n) : ℕ := + let s := slope (P i) (P j) + (Finset.univ.filter fun l => (P l).2 - s * (P l).1 < + (P i).2 - s * (P i).1).card + +noncomputable def switchCount {n : ℕ} (P : Fin n → Point) (k : ℕ) : ℕ := + (Finset.univ.filter fun ij : Fin n × Fin n => + ij.1 < ij.2 ∧ 0 < k ∧ k < n ∧ belowCount P ij.1 ij.2 = k - 1).card + +theorem power_bounds : + (∃ ε : ℝ, 0 < ε ∧ ∃ C : ℝ, ∃ n₀ : ℕ, + ∀ n : ℕ, Even n → n₀ ≤ n → ∀ P : Fin n → Point, + GeneralPosition P → (halvingCount P : ℝ) ≤ C * (n : ℝ) ^ ((4 : ℝ) / 3 - ε)) ∧ + (∃ ε : ℝ, 0 < ε ∧ ∃ C : ℝ, + ∀ n : ℕ, 1 ≤ n → ∀ P : Fin n → Point, Generic P → + ∀ k : ℕ, k ≤ n → (switchCount P k : ℝ) ≤ C * (n : ℝ) ^ ((4 : ℝ) / 3 - ε)) := + sorry + +end PlanarHalving + +end OAI diff --git a/lean/ComparatorChallenges/HardSphere.json b/lean/ComparatorChallenges/HardSphere.json new file mode 100644 index 0000000000000000000000000000000000000000..86d10e93e2ed42548b91ac991775434084e02079 --- /dev/null +++ b/lean/ComparatorChallenges/HardSphere.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.HardSphere", + "solution_module": "OAI.Analysis.HardSphere.Main", + "theorem_names": [ + "OAI.HardSphere.condensation_with_mixed" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/HardSphere.lean b/lean/ComparatorChallenges/HardSphere.lean new file mode 100644 index 0000000000000000000000000000000000000000..8d6d8cdb24ca58dcdb60c6de7a02ae1e1d6bfd85 --- /dev/null +++ b/lean/ComparatorChallenges/HardSphere.lean @@ -0,0 +1,386 @@ +import Mathlib + +/-! +# Ground-state condensation in the dilute hard-sphere gas + +The main result covers all pure ground states and all density operators supported on + the ground space. In particular it covers the normalized ground-space projection. +Only the definitions needed to state this result are retained below. +-/ + +noncomputable section +open MeasureTheory Filter Set +open scoped ENNReal Topology BigOperators InnerProductSpace ComplexOrder NNReal + +namespace OAI.HardSphere + +abbrev Length := {L : ℝ // 0 < L} + +instance lengthPositive (L : Length) : Fact (0 < L.val) := ⟨L.property⟩ + +abbrev Torus (L : Length) := Fin 3 → AddCircle L.val + +abbrev Configuration (N : ℕ) (L : Length) := Fin N → Torus L + +abbrev LiftedConfiguration (N : ℕ) := Fin N → Fin 3 → ℝ + +abbrev Direction (N : ℕ) := Fin N × Fin 3 + +def torusDistance (L : Length) (x y : Torus L) : ℝ := + Real.sqrt (∑ j : Fin 3, dist (x j) (y j) ^ 2) + +def allowed (N : ℕ) (L : Length) (a : ℝ) : Set (Configuration N L) := + {X | ∀ i j : Fin N, i < j → a < torusDistance L (X i) (X j)} + +def project (N : ℕ) (L : Length) (X : LiftedConfiguration N) : Configuration N L := + fun i j ↦ (X i j : AddCircle L.val) + +def representative (N : ℕ) (L : Length) (X : Configuration N L) : LiftedConfiguration N := + fun i j ↦ (AddCircle.equivIco L.val 0 (X i j)).val + +def coordDerivative (N : ℕ) (L : Length) (f : Configuration N L → ℂ) + (p : Direction N) (X : Configuration N L) : ℂ := + fderiv ℝ (fun Y : LiftedConfiguration N ↦ f (project N L Y)) + (representative N L X) (Pi.single p.1 (Pi.single p.2 1)) + +abbrev ScalarL2 (N : ℕ) (L : Length) : Type := + Lp ℂ 2 (volume : Measure (Configuration N L)) + +abbrev Jet (N : ℕ) (L : Length) := + ScalarL2 N L × (Direction N → ScalarL2 N L) + +structure SmoothTest (N : ℕ) (L : Length) (a : ℝ) where + toFun : Configuration N L → ℂ + smooth : ContDiff ℝ ((⊤ : ℕ∞) : WithTop ℕ∞) (fun X : LiftedConfiguration N ↦ toFun (project N L X)) + compact : HasCompactSupport toFun + support_allowed : tsupport toFun ⊆ allowed N L a + memLp : MemLp toFun (2 : ℕ) (volume : Measure (Configuration N L)) + partial_memLp : ∀ p : Direction N, MemLp (coordDerivative N L toFun p) (2 : ℕ) volume + +def SmoothTest.jet {N : ℕ} {L : Length} {a : ℝ} (f : SmoothTest N L a) : Jet N L := + (f.memLp.toLp f.toFun, fun p ↦ (f.partial_memLp p).toLp (coordDerivative N L f.toFun p)) + +def dirichletDomain (N : ℕ) (L : Length) (a : ℝ) : Set (Jet N L) := + closure (Set.range (SmoothTest.jet (N := N) (L := L) (a := a))) + +def energy {N : ℕ} {L : Length} (u : Jet N L) : ℝ := + ∑ p : Direction N, ‖u.2 p‖ ^ 2 + +def bosonic {N : ℕ} {L : Length} (ψ : ScalarL2 N L) : Prop := + ∀ σ : Equiv.Perm (Fin N), + (fun X : Configuration N L ↦ ψ (fun i ↦ X (σ i))) =ᵐ[volume] ψ + +def IsGroundVector (N : ℕ) (L : Length) (a : ℝ) (u : Jet N L) : Prop := + u ∈ dirichletDomain N L a ∧ bosonic u.1 ∧ ‖u.1‖ = 1 ∧ + ∀ v ∈ dirichletDomain N L a, bosonic v.1 → ‖v.1‖ = 1 → energy u ≤ energy v + +def insertFirst {N : ℕ} (hN : 0 < N) {L : Length} + (x : Torus L) (Y : Configuration (N - 1) L) : Configuration N L := + fun i ↦ Fin.cons (α := fun _ ↦ Torus L) x Y (Fin.cast (Nat.sub_add_cancel (Nat.succ_le_of_lt hN)).symm i) + +def occupation {N : ℕ} (hN : 0 < N) {L : Length} (ψ : ScalarL2 N L) : ℝ := + (L.val ^ 3)⁻¹ * ∫ Y : Configuration (N - 1) L, + ‖∫ x : Torus L, ψ (insertFirst hN x Y)‖ ^ 2 + +namespace Density +variable (H : Type*) [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +def basisSet : Set H := (exists_hilbertBasis (𝕜:=ℂ) (E:=H)).choose + +def basis : HilbertBasis (basisSet H) ℂ H := + (exists_hilbertBasis (𝕜:=ℂ) (E:=H)).choose_spec.choose + +structure Operator where + toCLM : H →L[ℂ] H + positive : 0≤toCLM + trace_one : HasSum (fun i : basisSet H ↦ (inner ℂ (basis H i) (toCLM (basis H i))).re) 1 + +variable {H K : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K] + +def Operator.compressionTrace (T : Operator H) (A : H →L[ℂ] K) : ℝ := + let adjoint := DFunLike.coe (F := (H →L[ℂ] K) ≃ₗᵢ⋆[ℂ] K →L[ℂ] H) + (β := fun _ ↦ K →L[ℂ] H) ContinuousLinearMap.adjoint A + ∑' j : basisSet K,(inner ℂ (adjoint (basis K j)) (T.toCLM (adjoint (basis K j)))).re + +end Density + +namespace Orbital + +def sliceIntegral {N : ℕ} (hN : 0 omega + | succ n => + unfold insertFirst + have h := (cons_preserving (n:=n) L).comp + (Measure.measurePreserving_swap (μ:=(volume : Measure (Torus L))) (ν:=volume)) + convert h using 1 <;> simp [Function.comp_def] + + have bathFirst_preserving {N : ℕ} (hN : 0 omega + | succ n => + unfold insertFirst + have h := (cons_preserving (n:=n) L).comp + (Measure.measurePreserving_swap (μ:=(volume : Measure (Torus L))) (ν:=volume)) + convert h using 1 <;> simp [Function.comp_def] + + have bathFirst_preserving {N : ℕ} (hN : 0 omega + | succ n => + convert (MeasurableEquiv.piFinSuccAbove (fun _ : Fin (n+1) ↦ Torus L) 0).symm.measurableEmbedding.comp + (MeasurableEquiv.prodComm (α:=Configuration n L) (β:=Torus L)).measurableEmbedding using 1 <;> try rfl + funext p i + simp [insertFirst,MeasurableEquiv.piFinSuccAbove,MeasurableEquiv.prodComm]) + (fun X ↦ ‖ψ X‖^2) + rw [hm,Measure.real,volume_torus,ENNReal.toReal_ofReal (by positivity : 0≤L.val^3)] at hbound + unfold occupation + change (L.val^3)⁻¹*(∫Y,‖∫x,f (Y,x)‖^2)≤‖ψ‖^2 + calc + _ ≤ (L.val^3)⁻¹*(L.val^3*‖ψ‖^2) := mul_le_mul_of_nonneg_left hbound (by positivity) + _ = _ := by rw [←mul_assoc,inv_mul_cancel₀ (pow_ne_zero _ L.property.ne'),one_mul] + + have map_ae {N : ℕ} (hN : 0 1 + | n + 1 => FreeGroup.of s * alternating t s n + +def braidRelators (M : CoxeterMatrix S) : Set (FreeGroup S) := + Set.range fun st : S × S => + alternating st.1 st.2 (M st.1 st.2) * + (alternating st.2 st.1 (M st.1 st.2))⁻¹ + +abbrev Artin (M : CoxeterMatrix S) := PresentedGroup (braidRelators M) + +def generator (M : CoxeterMatrix S) (s : S) : Artin M := PresentedGroup.of s + +def coxeterParabolic (M : CoxeterMatrix S) (T : Set S) : Subgroup M.Group := + Subgroup.closure (M.simple '' T) + +def IsSpherical (M : CoxeterMatrix S) (T : Set S) : Prop := + Finite (coxeterParabolic M T) + +abbrev SphericalType (M : CoxeterMatrix S) := {T : Set S // IsSpherical M T} + +abbrev LiftedCell (M : CoxeterMatrix S) := Artin M × SphericalType M + +def wordArtin (M : CoxeterMatrix S) (w : List S) : Artin M := + (w.map (generator M)).prod + +def wordCoxeter (M : CoxeterMatrix S) (w : List S) : M.Group := + (w.map M.simple).prod + +def LiftedFace (M : CoxeterMatrix S) (a b : LiftedCell M) : Prop := + a.2.1 ⊆ b.2.1 ∧ ∃ w : List S, + (∀ s ∈ w, s ∈ b.2.1) ∧ + M.toCoxeterSystem.length (wordCoxeter M w) = w.length ∧ + (∀ v : coxeterParabolic M a.2.1, + M.toCoxeterSystem.length (wordCoxeter M w) ≤ + M.toCoxeterSystem.length (wordCoxeter M w * v)) ∧ + a.1 = b.1 * wordArtin M w + +instance (M : CoxeterMatrix S) : Preorder (LiftedCell M) where + le := Relation.ReflTransGen (LiftedFace M) + le_refl _ := Relation.ReflTransGen.refl + le_trans _ _ _ := Relation.ReflTransGen.trans + +noncomputable def SalvettiCover (M : CoxeterMatrix S) : TopCat := + SSet.toTop.obj (CategoryTheory.nerve (LiftedCell M)) + +/-- The full lifted spherical-cell realization is contractible for every +Coxeter matrix with finitely many standard generators. -/ +theorem salvetti_cover_contractible [Finite S] (M : CoxeterMatrix S) : + ContractibleSpace (SalvettiCover M) := by + sorry + +end HarmonicArtin + +end OAI diff --git a/lean/ComparatorChallenges/HarmonicGrowth.json b/lean/ComparatorChallenges/HarmonicGrowth.json new file mode 100644 index 0000000000000000000000000000000000000000..9884b60eaf11a1eb51ef96a723518a2269cacf55 --- /dev/null +++ b/lean/ComparatorChallenges/HarmonicGrowth.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.HarmonicGrowth", + "solution_module": "OAI.Geometry.HarmonicGrowth.Main", + "theorem_names": [ + "OAI.HarmonicCounterexample.main" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/HarmonicGrowth.lean b/lean/ComparatorChallenges/HarmonicGrowth.lean new file mode 100644 index 0000000000000000000000000000000000000000..ca69bf3398e3841bae4fdbb4619528bba36e3255 --- /dev/null +++ b/lean/ComparatorChallenges/HarmonicGrowth.lean @@ -0,0 +1,108 @@ +import Mathlib + +namespace OAI + +noncomputable section +open Filter MeasureTheory +open scoped BigOperators Topology ENNReal ContDiff + +namespace HarmonicCounterexample + +abbrev Space (n : ℕ) := Fin n → ℝ +abbrev Mat (n : ℕ) := Matrix (Fin n) (Fin n) ℝ + +/-- A genuine smooth positive definite covariant metric tensor on R^n. -/ +structure SmoothMetric (n : ℕ) where + coeff : Space n → Mat n + smooth : ∀ i j, ContDiff ℝ ∞ (fun x => coeff x i j) + positive : ∀ x, (coeff x).PosDef + +/-- The coordinate directional derivative. -/ +def coordDeriv {n : ℕ} (i : Fin n) (f : Space n → ℝ) (x : Space n) : ℝ := + fderiv ℝ f x (Pi.single i 1) + +/-- Levi-Civita connection in the single global Cartesian chart. -/ +def christoffel {n : ℕ} (g : SmoothMetric n) (x : Space n) + (k i j : Fin n) : ℝ := + (1 / 2 : ℝ) * ∑ l, (g.coeff x)⁻¹ k l * + (coordDeriv i (fun y => g.coeff y j l) x + + coordDeriv j (fun y => g.coeff y i l) x - + coordDeriv l (fun y => g.coeff y i j) x) + +/-- Ricci tensor, with the convention in which the round sphere has positive Ricci. -/ +def ricci {n : ℕ} (g : SmoothMetric n) (x : Space n) (i j : Fin n) : ℝ := + (∑ k, (coordDeriv k (fun y => christoffel g y k i j) x - + coordDeriv j (fun y => christoffel g y k i k) x)) + + ∑ k, ∑ l, (christoffel g x k i j * christoffel g x l k l - + christoffel g x l i k * christoffel g x k j l) + +def RicciNonnegative {n : ℕ} (g : SmoothMetric n) : Prop := + ∀ (x v : Space n), 0 ≤ ∑ i, ∑ j, ricci g x i j * v i * v j + +/-- Trace of the covariant Hessian, i.e. the Laplace-Beltrami operator. -/ +def laplaceBeltrami {n : ℕ} (g : SmoothMetric n) (u : Space n → ℝ) + (x : Space n) : ℝ := + ∑ i, ∑ j, (g.coeff x)⁻¹ i j * + (coordDeriv i (coordDeriv j u) x - ∑ k, christoffel g x k i j * coordDeriv k u x) + +/-- Riemannian length of a path on the unit parameter interval. -/ +def pathLength {n : ℕ} (g : SmoothMetric n) (γ : ℝ → Space n) : ℝ := + ∫ t in (0 : ℝ)..1, Real.sqrt + (∑ i, ∑ j, g.coeff (γ t) i j * deriv γ t i * deriv γ t j) + +/-- Infimum of smooth path lengths, the intrinsic Riemannian distance. -/ +def distance {n : ℕ} (g : SmoothMetric n) (x y : Space n) : ℝ := + sInf {L : ℝ | ∃ γ : ℝ → Space n, + ContDiff ℝ 1 γ ∧ γ 0 = x ∧ γ 1 = y ∧ L = pathLength g γ} + +/-- Sequential metric completeness, for the intrinsic distance, not the background one. -/ +def Complete {n : ℕ} (g : SmoothMetric n) : Prop := + ∀ z : ℕ → Space n, + (∀ ε : ℝ, 0 < ε → ∃ N : ℕ, ∀ p ≥ N, ∀ q ≥ N, distance g (z p) (z q) < ε) → + ∃ x : Space n, ∀ ε : ℝ, 0 < ε → ∃ N : ℕ, ∀ p ≥ N, distance g (z p) x < ε + +def EuclideanNearOrigin {n : ℕ} (g : SmoothMetric n) : Prop := + ∃ ε : ℝ, 0 < ε ∧ ∀ x : Space n, (∑ i, x i ^ 2) < ε ^ 2 → g.coeff x = 1 + +/-- Riemannian measure of the intrinsic open ball, retaining infinite values. -/ +def ballVolume {n : ℕ} (g : SmoothMetric n) (R : ℝ) : ℝ≥0∞ := + ∫⁻ x in {x : Space n | distance g 0 x < R}, + ENNReal.ofReal (Real.sqrt (g.coeff x).det) ∂volume + +/-- The ordinary Euclidean unit ball volume, in Cartesian Lebesgue measure. -/ +def omega (n : ℕ) : ℝ≥0∞ := + volume {x : Space n | (∑ i, x i ^ 2) < 1} + +/-- The volume-ratio limit is finite, positive, and strictly below one. -/ +def PositiveSubunitAVR {n : ℕ} (g : SmoothMetric n) : Prop := + ∃ a : ℝ, 0 < a ∧ a < 1 ∧ + Tendsto (fun R : ℝ => ballVolume g R / (omega n * ENNReal.ofReal (R ^ n))) + atTop (𝓝 (ENNReal.ofReal a)) + +/-- Membership in the actual space H_k, with the bound required at every point. -/ +def HarmonicGrowth {n : ℕ} (g : SmoothMetric n) (k : ℕ) (u : Space n → ℝ) : Prop := + ContDiff ℝ ∞ u ∧ (∀ x, laplaceBeltrami g u x = 0) ∧ + ∃ C : ℝ, 0 ≤ C ∧ ∀ x, |u x| ≤ C * (1 + distance g 0 x) ^ k + + +def euclideanDimension (n k : ℕ) : ℕ := + (n + k - 1).choose k + (n + k - 2).choose (k - 1) + +/-- The manuscript's unconditional main existence claim. -/ +def MainClaim : Prop := + ∃ (n k : ℕ) (g : SmoothMetric n), Even n ∧ 8 ≤ n ∧ 2 ≤ k ∧ + Complete g ∧ RicciNonnegative g ∧ EuclideanNearOrigin g ∧ PositiveSubunitAVR g ∧ + ∃ u : Fin (euclideanDimension n k + 1) → (Space n → ℝ), + LinearIndependent ℝ u ∧ ∀ i, HarmonicGrowth g k (u i) + + + +axiom mainStatement : MainClaim + +theorem main : MainClaim := mainStatement + +end HarmonicCounterexample + +end + +end OAI diff --git a/lean/ComparatorChallenges/HeckeSevenEighths.json b/lean/ComparatorChallenges/HeckeSevenEighths.json new file mode 100644 index 0000000000000000000000000000000000000000..139442c594171660b9e4ce80ab01aa978bb32c51 --- /dev/null +++ b/lean/ComparatorChallenges/HeckeSevenEighths.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.HeckeSevenEighths", + "solution_module": "OAI.NumberTheory.DirichletL.Hecke.Nonvanishing", + "theorem_names": [ + "OAI.SevenEighths.HeckeFamily.LFunction_ne_zero_of_seven_eighths_lt_re" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/HeckeSevenEighths.lean b/lean/ComparatorChallenges/HeckeSevenEighths.lean new file mode 100644 index 0000000000000000000000000000000000000000..dbeb6414a5ddd497a321490a812a6987311fa101 --- /dev/null +++ b/lean/ComparatorChallenges/HeckeSevenEighths.lean @@ -0,0 +1,245 @@ +import Mathlib + +namespace OAI + +noncomputable section +open Filter Asymptotics Set MeasureTheory +open scoped Topology BigOperators + +namespace SevenEighths.ThetaProduct + +theorem rapid_product_sub (f g : ℝ → ℂ) (a b : ℂ) + (hf : ∀ r : ℝ, (fun x => f x - a) =O[atTop] (fun x : ℝ => x ^ r)) + (hg : ∀ r : ℝ, (fun x => g x - b) =O[atTop] (fun x : ℝ => x ^ r)) + (r : ℝ) : + (fun x => f x * g x - a * b) =O[atTop] (fun x : ℝ => x ^ r) := by + have hg0 : g =O[atTop] (fun _ : ℝ => (1 : ℝ)) := by + have hc : (fun _ : ℝ => b) =O[atTop] (fun x : ℝ => x ^ (0 : ℝ)) := by + simpa using (isBigO_const_one ℝ b (atTop : Filter ℝ)) + have h := (hg 0).add hc + simpa using h + have h₁ := (hf r).mul hg0 + have h₂ := (hg r).const_mul_left a + have hid : (fun x => f x * g x - a * b) = + fun x => (f x - a) * g x + a * (g x - b) := by + funext x + ring + rw [hid] + have h₁' : (fun x => (f x - a) * g x) =O[atTop] (fun x : ℝ => x ^ r) := by + simpa using h₁ + exact h₁'.add h₂ + +def product (P Q : WeakFEPair ℂ) + (hPf : ContinuousOn P.f (Ioi 0)) (hPg : ContinuousOn P.g (Ioi 0)) + (hQf : ContinuousOn Q.f (Ioi 0)) (hQg : ContinuousOn Q.g (Ioi 0)) : + WeakFEPair ℂ where + f := fun x => P.f x * Q.f x + g := fun x => P.g x * Q.g x + k := P.k + Q.k + ε := P.ε * Q.ε + f₀ := P.f₀ * Q.f₀ + g₀ := P.g₀ * Q.g₀ + hf_int := (hPf.mul hQf).locallyIntegrableOn measurableSet_Ioi + hg_int := (hPg.mul hQg).locallyIntegrableOn measurableSet_Ioi + hk := add_pos P.hk Q.hk + hε := mul_ne_zero P.hε Q.hε + h_feq x hx := by + rw [P.h_feq x hx, Q.h_feq x hx, Real.rpow_add hx] + simp only [smul_eq_mul, Complex.ofReal_mul] + ring + hf_top := rapid_product_sub P.f Q.f P.f₀ Q.f₀ P.hf_top Q.hf_top + hg_top := rapid_product_sub P.g Q.g P.g₀ Q.g₀ P.hg_top Q.hg_top + +theorem rapid_rescale (f : ℝ → ℂ) (a : ℂ) + (hf : ∀ r : ℝ, (fun x => f x - a) =O[atTop] (fun x : ℝ => x ^ r)) + {u : ℝ} (hu : 0 < u) (r : ℝ) : + (fun x => f (u * x) - a) =O[atTop] (fun x : ℝ => x ^ r) := by + have ht : Tendsto (fun x : ℝ => u * x) atTop atTop := + (tendsto_const_mul_atTop_of_pos hu).2 tendsto_id + have h := (hf r).comp_tendsto ht + have heq : (fun x : ℝ => (u * x) ^ r) =ᶠ[atTop] + (fun x : ℝ => u ^ r * x ^ r) := by + filter_upwards [eventually_ge_atTop (0 : ℝ)] with x hx + exact Real.mul_rpow hu.le hx + exact h.trans (heq.isBigO.trans ((isBigO_refl (fun x : ℝ => x ^ r) atTop).const_mul_left _)) + +def rescale (P : WeakFEPair ℂ) + (hPf : ContinuousOn P.f (Ioi 0)) (hPg : ContinuousOn P.g (Ioi 0)) + (u : ℝ) (hu : 0 < u) : WeakFEPair ℂ where + f := fun x => P.f (u * x) + g := fun x => P.g (u⁻¹ * x) + k := P.k + ε := P.ε * (u ^ (-P.k) : ℝ) + f₀ := P.f₀ + g₀ := P.g₀ + hf_int := (hPf.comp (by fun_prop) (fun x hx => mul_pos hu hx)).locallyIntegrableOn + measurableSet_Ioi + hg_int := (hPg.comp (by fun_prop) (fun x hx => mul_pos (inv_pos.mpr hu) hx)).locallyIntegrableOn + measurableSet_Ioi + hk := P.hk + hε := mul_ne_zero P.hε (Complex.ofReal_ne_zero.mpr (Real.rpow_pos_of_pos hu _).ne') + h_feq x hx := by + have heq : u * (1 / x) = 1 / (u⁻¹ * x) := by field_simp + rw [heq, P.h_feq _ (mul_pos (inv_pos.mpr hu) hx), + Real.mul_rpow (inv_pos.mpr hu).le hx.le, Real.inv_rpow hu.le, + ← Real.rpow_neg hu.le] + simp only [smul_eq_mul, Complex.ofReal_mul] + ring + hf_top := rapid_rescale P.f P.f₀ P.hf_top hu + hg_top := rapid_rescale P.g P.g₀ P.hg_top (inv_pos.mpr hu) + +def shiftedPair (a b : UnitAddCircle) : WeakFEPair ℂ := + product (HurwitzZeta.hurwitzEvenFEPair a) (HurwitzZeta.hurwitzEvenFEPair b) + (Complex.continuous_ofReal.comp_continuousOn (HurwitzZeta.continuousOn_evenKernel a)) + (Complex.continuous_ofReal.comp_continuousOn (HurwitzZeta.continuousOn_cosKernel a)) + (Complex.continuous_ofReal.comp_continuousOn (HurwitzZeta.continuousOn_evenKernel b)) + (Complex.continuous_ofReal.comp_continuousOn (HurwitzZeta.continuousOn_cosKernel b)) + +@[simp] theorem shiftedPair_k (a b : UnitAddCircle) : (shiftedPair a b).k = 1 := by + norm_num [shiftedPair, product, HurwitzZeta.hurwitzEvenFEPair] + +@[simp] theorem shiftedPair_f (a b : UnitAddCircle) (t : ℝ) : + (shiftedPair a b).f t = + (HurwitzZeta.evenKernel a t : ℂ) * (HurwitzZeta.evenKernel b t : ℂ) := rfl + +theorem shiftedPair_differentiableAt (a b : UnitAddCircle) {s : ℂ} + (hs₀ : s ≠ 0) (hs₁ : s ≠ 1) : + DifferentiableAt ℂ (shiftedPair a b).Λ s := by + exact (shiftedPair a b).differentiableAt_Λ (Or.inl hs₀) + (Or.inl (by simpa using hs₁)) + +def scaledEvenPair (a : UnitAddCircle) (u : ℝ) (hu : 0 < u) : WeakFEPair ℂ := + rescale (HurwitzZeta.hurwitzEvenFEPair a) + (Complex.continuous_ofReal.comp_continuousOn (HurwitzZeta.continuousOn_evenKernel a)) + (Complex.continuous_ofReal.comp_continuousOn (HurwitzZeta.continuousOn_cosKernel a)) u hu + +theorem scaledEvenPair_f_continuous (a : UnitAddCircle) (u : ℝ) (hu : 0 < u) : + ContinuousOn (scaledEvenPair a u hu).f (Ioi 0) := + (Complex.continuous_ofReal.comp_continuousOn + (HurwitzZeta.continuousOn_evenKernel a)).comp (by fun_prop) + (fun x hx => mul_pos hu hx) + +theorem scaledEvenPair_g_continuous (a : UnitAddCircle) (u : ℝ) (hu : 0 < u) : + ContinuousOn (scaledEvenPair a u hu).g (Ioi 0) := + (Complex.continuous_ofReal.comp_continuousOn + (HurwitzZeta.continuousOn_cosKernel a)).comp (by fun_prop) + (fun x hx => mul_pos (inv_pos.mpr hu) hx) + +def rectangularPair (a b : UnitAddCircle) (u v : ℝ) (hu : 0 < u) (hv : 0 < v) : + WeakFEPair ℂ := + product (scaledEvenPair a u hu) (scaledEvenPair b v hv) + (scaledEvenPair_f_continuous a u hu) (scaledEvenPair_g_continuous a u hu) + (scaledEvenPair_f_continuous b v hv) (scaledEvenPair_g_continuous b v hv) + +@[simp] theorem rectangularPair_k (a b : UnitAddCircle) (u v : ℝ) + (hu : 0 < u) (hv : 0 < v) : (rectangularPair a b u v hu hv).k = 1 := by + norm_num [rectangularPair, scaledEvenPair, rescale, product, HurwitzZeta.hurwitzEvenFEPair] + +end SevenEighths.ThetaProduct + +namespace SevenEighths.EisensteinTheta +open ThetaProduct + +def xShift (a b L : ℝ) (e : Fin 2) : ℝ := (2 * a - b - L * e) / (2 * L) +def yShift (b L : ℝ) (e : Fin 2) : ℝ := (b + L * e) / (2 * L) + +def parityPair (a b L : ℝ) (hL : 0 < L) (e : Fin 2) : WeakFEPair ℂ := + rectangularPair (xShift a b L e) (yShift b L e) (L ^ 2) (3 * L ^ 2) + (sq_pos_of_pos hL) (mul_pos (by norm_num) (sq_pos_of_pos hL)) + +end SevenEighths.EisensteinTheta + +namespace SevenEighths.HeckeTheta +open EisensteinTheta + +theorem locallyIntegrableOn_sum {ι : Type*} (s : Finset ι) + (f : ι → ℝ → ℂ) (hf : ∀ i ∈ s, LocallyIntegrableOn (f i) (Ioi 0)) : + LocallyIntegrableOn (∑ i ∈ s, f i) (Ioi 0) := by + exact Finset.sum_induction f (fun g => LocallyIntegrableOn g (Ioi 0)) + (fun _ _ => LocallyIntegrableOn.add) (locallyIntegrableOn_const 0) hf + +def finitePair {ι : Type*} [Fintype ι] (P : ι → WeakFEPair ℂ) + (hk : ∀ i, (P i).k = 1) (w : ι → ℂ) : WeakFEPair ℂ where + f := ∑ i, w i • (P i).f + g := ∑ i, (w i * (P i).ε) • (P i).g + k := 1 + ε := 1 + f₀ := ∑ i, w i * (P i).f₀ + g₀ := ∑ i, w i * (P i).ε * (P i).g₀ + hf_int := locallyIntegrableOn_sum Finset.univ _ + (fun i _ => (P i).hf_int.smul (w i)) + hg_int := locallyIntegrableOn_sum Finset.univ _ + (fun i _ => (P i).hg_int.smul (w i * (P i).ε)) + hk := by norm_num + hε := one_ne_zero + h_feq x hx := by + simp only [Finset.sum_apply, Pi.smul_apply, smul_eq_mul, one_mul] + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + rw [(P i).h_feq x hx, hk i] + simp only [smul_eq_mul] + ring + hf_top r := by + have h := Asymptotics.IsBigO.fun_sum (s := Finset.univ) + (fun i _ => ((P i).hf_top r).const_mul_left (w i)) + simpa only [Finset.sum_apply, Pi.smul_apply, smul_eq_mul, ← Finset.sum_sub_distrib, + mul_sub] using h + hg_top r := by + have h := Asymptotics.IsBigO.fun_sum (s := Finset.univ) + (fun i _ => ((P i).hg_top r).const_mul_left (w i * (P i).ε)) + simpa only [Finset.sum_apply, Pi.smul_apply, smul_eq_mul, ← Finset.sum_sub_distrib, + mul_sub] using h + +def pair {N : ℕ} [NeZero N] (w : Fin N × Fin N → ℂ) : WeakFEPair ℂ := + finitePair (fun p : (Fin N × Fin N) × Fin 2 => + parityPair p.1.1 p.1.2 N (Nat.cast_pos.mpr (NeZero.pos N)) p.2) + (fun _ => ThetaProduct.rectangularPair_k ..) (fun p => w p.1) + +def completed {N : ℕ} [NeZero N] (w : Fin N × Fin N → ℂ) : ℂ → ℂ := (pair w).Λ + +def latticeL {N : ℕ} [NeZero N] (w : Fin N × Fin N → ℂ) (s : ℂ) : ℂ := + (Real.pi : ℂ) ^ s * (Complex.Gamma s)⁻¹ * completed w s + +end SevenEighths.HeckeTheta + +namespace SevenEighths.HeckeFamily + +abbrev K := CyclotomicField 3 ℚ +abbrev O := NumberField.RingOfIntegers K + +instance : IsCyclotomicExtension {3} ℚ K := CyclotomicField.isCyclotomicExtension 3 ℚ + +def omega : O := (IsCyclotomicExtension.zeta_spec 3 ℚ K).toInteger + +def coordinateElement (x y : ℤ) : O := (x : O) + (y : O) * omega + +structure Character where + modulus : Ideal O + modulus_ne_bot : modulus ≠ ⊥ + residue : MulChar (O ⧸ modulus) ℂ + unit_trivial : ∀ u : Oˣ, residue (Ideal.Quotient.mk modulus (u : O)) = 1 + period : ℕ + period_pos : 0 < period + period_mem : (period : O) ∈ modulus + +instance (χ : Character) : NeZero χ.period := ⟨Nat.ne_of_gt χ.period_pos⟩ + +def elementCoeff (χ : Character) (z : O) : ℂ := χ.residue (Ideal.Quotient.mk χ.modulus z) + +def coefficients (χ : Character) (a : Fin χ.period × Fin χ.period) : ℂ := + elementCoeff χ (coordinateElement a.1 a.2) + +def continuedLattice (χ : Character) : ℂ → ℂ := HeckeTheta.latticeL (coefficients χ) + +def LFunction (χ : Character) (s : ℂ) : ℂ := continuedLattice χ s / 6 + +theorem LFunction_ne_zero_of_seven_eighths_lt_re + (χ : Character) {s : ℂ} (hs : (7 / 8 : ℝ) < s.re) + (hpole : ¬ (χ.residue = 1 ∧ s = 1)) : LFunction χ s ≠ 0 := by sorry + +end SevenEighths.HeckeFamily + +end + +end OAI diff --git a/lean/ComparatorChallenges/HeilbronnTriangle.json b/lean/ComparatorChallenges/HeilbronnTriangle.json new file mode 100644 index 0000000000000000000000000000000000000000..6cf91e2751da08bbc325a0bf3d36a21c83db5224 --- /dev/null +++ b/lean/ComparatorChallenges/HeilbronnTriangle.json @@ -0,0 +1,15 @@ +{ + "challenge_module": "ComparatorChallenges.HeilbronnTriangle", + "solution_module": "OAI.Geometry.HeilbronnTriangle.Main", + "theorem_names": [ + "OAI.Problem355.heilbronn_power_lower_bound", + "OAI.Problem355.almost_n_minus_two_refuted" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/HeilbronnTriangle.lean b/lean/ComparatorChallenges/HeilbronnTriangle.lean new file mode 100644 index 0000000000000000000000000000000000000000..4be52210e8909c3b2c80fd3ffb472aaab09be4d2 --- /dev/null +++ b/lean/ComparatorChallenges/HeilbronnTriangle.lean @@ -0,0 +1,68 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace Problem355 + +abbrev Point := ℝ × ℝ + +def triangleArea (p q r : Point) : ℝ := + abs ((q.1 - p.1) * (r.2 - p.2) - (q.2 - p.2) * (r.1 - p.1)) / 2 + +def pointInUnitSquare (p : Point) : Prop := + 0 ≤ p.1 ∧ p.1 ≤ 1 ∧ 0 ≤ p.2 ∧ p.2 ≤ 1 + +def pointsInUnitSquare (P : Finset Point) : Prop := by + classical + exact ∀ p, p ∈ P → pointInUnitSquare p + +def triangleAreasAtLeast (P : Finset Point) (a : ℝ) : Prop := by + classical + exact ∀ p, p ∈ P → ∀ q, q ∈ P → ∀ r, r ∈ P → + p ≠ q → p ≠ r → q ≠ r → a ≤ triangleArea p q r + +def hasTriangleAreaAtMost (P : Finset Point) (a : ℝ) : Prop := by + classical + exact ∃ p, p ∈ P ∧ ∃ q, q ∈ P ∧ ∃ r, r ∈ P ∧ + p ≠ q ∧ p ≠ r ∧ q ≠ r ∧ triangleArea p q r ≤ a + +def heilbronnD : ℕ := 41 + +def heilbronnM : ℕ := Nat.choose (4 * heilbronnD - 1) heilbronnD + +def heilbronnT : ℕ := Nat.choose heilbronnM 3 + +def heilbronnK : ℕ := heilbronnT ^ 2 + 1 + +def heilbronnExponent : ℝ := + 1 / (100000 * (heilbronnK : ℝ)) + +def eventualAlmostUpperBound (epsilon : ℝ) : Prop := + ∃ C : ℝ, 0 < C ∧ ∃ n0 : ℕ, ∀ n : ℕ, n0 ≤ n → 3 ≤ n → + ∀ P : Finset Point, P.card = n → pointsInUnitSquare P → + hasTriangleAreaAtMost P + (C * Real.rpow (n : ℝ) (-2 + epsilon)) + +attribute [local irreducible] Problem355.heilbronnT + Problem355.heilbronnM + +theorem heilbronn_power_lower_bound : + 0 < heilbronnExponent ∧ ∃ n : ℕ → ℕ, ∃ P : ℕ → Finset Point, + Filter.Tendsto n Filter.atTop Filter.atTop ∧ ∀ j : ℕ, + 3 ≤ n j ∧ (P j).card = n j ∧ pointsInUnitSquare (P j) ∧ + triangleAreasAtLeast (P j) + (Real.rpow (n j : ℝ) (-2 + heilbronnExponent)) := by + sorry + +theorem almost_n_minus_two_refuted : + 0 < heilbronnExponent / 2 ∧ + ¬ eventualAlmostUpperBound (heilbronnExponent / 2) := by + sorry + +end Problem355 + +end + +end OAI diff --git a/lean/ComparatorChallenges/Heisenberg.json b/lean/ComparatorChallenges/Heisenberg.json new file mode 100644 index 0000000000000000000000000000000000000000..9415ce898936857c1bb55c48cbc08394b6f844cc --- /dev/null +++ b/lean/ComparatorChallenges/Heisenberg.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.Heisenberg", + "solution_module": "OAI.MathematicalPhysics.Heisenberg.Main", + "theorem_names": [ + "OAI.Heisenberg.spontaneous_magnetization" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/Heisenberg.lean b/lean/ComparatorChallenges/Heisenberg.lean new file mode 100644 index 0000000000000000000000000000000000000000..424dcf04cd29937e2846b951e7586dedb97ce2b5 --- /dev/null +++ b/lean/ComparatorChallenges/Heisenberg.lean @@ -0,0 +1,218 @@ +import Mathlib + +namespace OAI + +noncomputable section + +universe u v + + +open scoped ComplexConjugate ENNReal Classical + +namespace Heisenberg + +abbrev L2 (ι : Type u) := lp (fun _ : ι => ℂ) 2 + +def l2Reindex {ι : Type u} {κ : Type v} (e : ι ≃ κ) : L2 ι ≃ₗᵢ[ℂ] L2 κ where + toFun f := ⟨fun j => f (e.symm j), by + apply memℓp_gen + exact e.symm.summable_iff.mpr ((lp.memℓp f).summable (by norm_num))⟩ + invFun f := ⟨fun i => f (e i), by + apply memℓp_gen + exact e.summable_iff.mpr ((lp.memℓp f).summable (by norm_num))⟩ + left_inv f := by ext i; simp + right_inv f := by ext j; simp + map_add' f g := by ext j; rfl + map_smul' c f := by ext j; rfl + norm_map' f := by + rw [lp.norm_eq_tsum_rpow (by norm_num), lp.norm_eq_tsum_rpow (by norm_num)] + congr 1 + exact e.symm.tsum_eq (fun i => ‖f i‖ ^ (2 : ℝ≥0∞).toReal) + +def l2Projection {ι : Type u} (p : ι → Prop) : L2 ι →L[ℂ] L2 ι := by + classical + let f : L2 ι →ₗ[ℂ] L2 ι := + { toFun := fun v => ⟨fun i => if p i then v i else 0, + (lp.memℓp v).mono' (fun i => by split_ifs <;> simp)⟩ + map_add' := fun v w => by + ext i + change (if p i then v i + w i else 0) = + (if p i then v i else 0) + (if p i then w i else 0) + by_cases h : p i <;> simp [h] + map_smul' := fun c v => by ext i; by_cases h : p i <;> simp [h] } + exact f.mkContinuous 1 (fun v => by + simpa only [one_mul] using lp.norm_mono (by norm_num : (2 : ℝ≥0∞) ≠ 0) + (x := f v) (y := v) (fun i => by + change ‖if p i then v i else 0‖ ≤ ‖v i‖ + split_ifs <;> simp)) + +abbrev Site (d : ℕ) := Fin d → ℤ +abbrev Level (ℓ : ℕ) := Fin (ℓ + 1) +abbrev Configuration (d ℓ : ℕ) := Site d →₀ Level ℓ +abbrev SpinHilbert (d ℓ : ℕ) := L2 (Configuration d ℓ) +abbrev SpinOperator (d ℓ : ℕ) := SpinHilbert d ℓ →L[ℂ] SpinHilbert d ℓ + +def configPerm (d ℓ : ℕ) (x : Site d) (σ : Equiv.Perm (Level ℓ)) : + Equiv.Perm (Configuration d ℓ) where + toFun c := c.update x (σ (c x)) + invFun c := c.update x (σ.symm (c x)) + left_inv c := by + classical + ext y + by_cases h : y = x <;> simp [Finsupp.update_apply, h] + right_inv c := by + classical + ext y + by_cases h : y = x <;> simp [Finsupp.update_apply, h] + +def matrixUnit (d ℓ : ℕ) (x : Site d) (a b : Level ℓ) : SpinOperator d ℓ := + (l2Projection (fun c : Configuration d ℓ => c x = a)).comp + (l2Reindex (configPerm d ℓ x (Equiv.swap a b))).toContinuousLinearEquiv.toContinuousLinearMap + +def operatorRelabel (d ℓ : ℕ) (e : Equiv.Perm (Site d)) : + SpinOperator d ℓ ≃⋆ₐ[ℂ] SpinOperator d ℓ := + (l2Reindex (Finsupp.equivCongrLeft e)).conjStarAlgEquiv + +def quasiLocalAlgebra (d ℓ : ℕ) : StarSubalgebra ℂ (SpinOperator d ℓ) := + (StarAlgebra.adjoin ℂ {A | ∃ x a b, A = matrixUnit d ℓ x a b}).topologicalClosure + +abbrev QuasiLocal (d ℓ : ℕ) := quasiLocalAlgebra d ℓ + +def localUnit (d ℓ : ℕ) (x : Site d) (a b : Level ℓ) : QuasiLocal d ℓ := + ⟨matrixUnit d ℓ x a b, (StarSubalgebra.le_topologicalClosure _) + (StarAlgebra.subset_adjoin ℂ _ ⟨x, a, b, rfl⟩)⟩ + +def translation (d ℓ : ℕ) (x : Site d) : QuasiLocal d ℓ →⋆ₐ[ℂ] QuasiLocal d ℓ := by + have l2Reindex_apply {ι : Type} {κ : Type} (e : ι ≃ κ) (f : L2 ι) (j : κ) : + l2Reindex e f j = f (e.symm j) := rfl + have l2Projection_apply {ι : Type} (p : ι → Prop) (v : L2 ι) (i : ι) : + l2Projection p v i = if p i then v i else 0 := by classical rfl + have matrixUnit_apply (d ℓ : ℕ) (x : Site d) (a b : Level ℓ) + (v : SpinHilbert d ℓ) (c : Configuration d ℓ) : + matrixUnit d ℓ x a b v c = if c x = a then v (c.update x b) else 0 := by + simp only [matrixUnit, ContinuousLinearMap.comp_apply, l2Projection_apply] + split_ifs with h + · change v (c.update x ((Equiv.swap a b).symm (c x))) = v (c.update x b) + simp [h] + · rfl + have l2Reindex_symm_apply {ι : Type} {κ : Type} (e : ι ≃ κ) (v : L2 κ) (i : ι) : + (l2Reindex e).symm v i = v (e i) := rfl + have relabel_matrixUnit (d ℓ : ℕ) (e : Equiv.Perm (Site d)) + (x : Site d) (a b : Level ℓ) : + operatorRelabel d ℓ e (matrixUnit d ℓ x a b) = matrixUnit d ℓ (e x) a b := by + ext v c + simp only [operatorRelabel, LinearIsometryEquiv.conjStarAlgEquiv_apply_apply, + l2Reindex_apply, matrixUnit_apply] + change (if c (e x) = a then + (l2Reindex (Finsupp.equivCongrLeft e)).symm v + (((Finsupp.equivCongrLeft e).symm c).update x b) else 0) = _ + rw [l2Reindex_symm_apply] + by_cases h : c (e x) = a + · simp only [h, ite_eq_left] + apply congrArg v + ext y + simp only [Finsupp.equivCongrLeft_apply, Finsupp.equivMapDomain_apply, + Finsupp.update_apply] + by_cases hy : y = e x + · subst y; simp + · have hy' : e.symm y ≠ x := fun hxy => hy (by simpa using congrArg e hxy) + simp [hy, hy'] + · simp only [h, ite_false] + have relabel_mem (d ℓ : ℕ) (e : Equiv.Perm (Site d)) + {A : SpinOperator d ℓ} (hA : A ∈ quasiLocalAlgebra d ℓ) : + operatorRelabel d ℓ e A ∈ quasiLocalAlgebra d ℓ := by + let f := (operatorRelabel d ℓ e).toStarAlgHom + have h : StarAlgebra.adjoin ℂ {A | ∃ x a b, A = matrixUnit d ℓ x a b} ≤ + (quasiLocalAlgebra d ℓ).comap f := by + apply StarAlgebra.adjoin_le + rintro _ ⟨x, a, b, rfl⟩ + change operatorRelabel d ℓ e (matrixUnit d ℓ x a b) ∈ quasiLocalAlgebra d ℓ + rw [relabel_matrixUnit] + exact (localUnit d ℓ (e x) a b).property + have hc : IsClosed ((quasiLocalAlgebra d ℓ).comap f : Set (SpinOperator d ℓ)) := + (StarSubalgebra.isClosed_topologicalClosure _).preimage + (StarAlgEquiv.isometry (operatorRelabel d ℓ e)).continuous + exact StarSubalgebra.topologicalClosure_minimal h hc hA + exact let f := (operatorRelabel d ℓ (Equiv.addLeft x)).toStarAlgHom + (f.comp (quasiLocalAlgebra d ℓ).subtype).codRestrict (quasiLocalAlgebra d ℓ) + (fun A => relabel_mem d ℓ (Equiv.addLeft x) A.property) + +def magneticLevel (ℓ : ℕ) (k : Level ℓ) : ℝ := (k : ℝ) - (ℓ : ℝ) / 2 + +def spinZ (d ℓ : ℕ) (x : Site d) : QuasiLocal d ℓ := + ∑ k : Level ℓ, (magneticLevel ℓ k : ℂ) • localUnit d ℓ x k k + +def spinPlus (d ℓ : ℕ) (x : Site d) : QuasiLocal d ℓ := + ∑ k : Fin ℓ, + (Real.sqrt ((ℓ / 2 : ℝ) * (ℓ / 2 + 1) - + magneticLevel ℓ k.castSucc * (magneticLevel ℓ k.castSucc + 1)) : ℂ) • + localUnit d ℓ x k.succ k.castSucc + +def spinMinus (d ℓ : ℕ) (x : Site d) : QuasiLocal d ℓ := star (spinPlus d ℓ x) + +def spinX (d ℓ : ℕ) (x : Site d) : QuasiLocal d ℓ := + (1 / 2 : ℂ) • (spinPlus d ℓ x + spinMinus d ℓ x) + +def spinY (d ℓ : ℕ) (x : Site d) : QuasiLocal d ℓ := + (1 / (2 * Complex.I) : ℂ) • (spinPlus d ℓ x - spinMinus d ℓ x) + +def NearestNeighbor {d : ℕ} (x y : Site d) : Prop := + ∑ i : Fin d, |x i - y i| = (1 : ℤ) + +def volumeEdges {d : ℕ} (Λ : Finset (Site d)) : Finset (Site d × Site d) := + (Λ ×ˢ Λ).filter fun p => NearestNeighbor p.1 p.2 ∧ WellOrderingRel p.1 p.2 + +def hamiltonian (d ℓ : ℕ) (Λ : Finset (Site d)) : QuasiLocal d ℓ := + -∑ e ∈ volumeEdges Λ, + (spinX d ℓ e.1 * spinX d ℓ e.2 + spinY d ℓ e.1 * spinY d ℓ e.2 + + spinZ d ℓ e.1 * spinZ d ℓ e.2) + +def box (d n : ℕ) : Finset (Site d) := + Fintype.piFinset fun _ : Fin d => Finset.Icc (-(n : ℤ)) (n : ℤ) + +def finiteDynamics (d ℓ : ℕ) (Λ : Finset (Site d)) (t : ℝ) + (A : QuasiLocal d ℓ) : QuasiLocal d ℓ := + NormedSpace.exp ((Complex.I * (t : ℂ)) • hamiltonian d ℓ Λ) * A * + NormedSpace.exp ((-(Complex.I * (t : ℂ))) • hamiltonian d ℓ Λ) + +def dynamics (d ℓ : ℕ) (t : ℝ) (A : QuasiLocal d ℓ) : QuasiLocal d ℓ := + Filter.limUnder Filter.atTop (fun n : ℕ => finiteDynamics d ℓ (box d n) t A) + +def DynamicsConverges (d ℓ : ℕ) : Prop := + ∀ (t : ℝ) (A : QuasiLocal d ℓ), + Filter.Tendsto (fun n : ℕ => finiteDynamics d ℓ (box d n) t A) + Filter.atTop (nhds (dynamics d ℓ t A)) + +structure State (d ℓ : ℕ) where + functional : QuasiLocal d ℓ →L[ℂ] ℂ + normalized : functional 1 = 1 + positive : ∀ A, (functional (star A * A)).im = 0 ∧ + 0 ≤ (functional (star A * A)).re + +def TranslationInvariant {d ℓ : ℕ} (ω : State d ℓ) : Prop := + ∀ (x : Site d) (A : QuasiLocal d ℓ), ω.functional (translation d ℓ x A) = ω.functional A + +def IsKMS {d ℓ : ℕ} (β : ℝ) (ω : State d ℓ) : Prop := + 0 < β ∧ ∀ A B : QuasiLocal d ℓ, ∃ F : ℂ → ℂ, + ContinuousOn F {z | 0 ≤ z.im ∧ z.im ≤ β} ∧ + DifferentiableOn ℂ F {z | 0 < z.im ∧ z.im < β} ∧ + (∃ C : ℝ, ∀ z : ℂ, 0 ≤ z.im → z.im ≤ β → ‖F z‖ ≤ C) ∧ + (∀ t : ℝ, F t = ω.functional (A * dynamics d ℓ t B)) ∧ + (∀ t : ℝ, F ((t : ℂ) + Complex.I * β) = ω.functional (dynamics d ℓ t B * A)) + +open scoped Classical BigOperators ComplexConjugate +open Filter Topology + +theorem spontaneous_magnetization (d ℓ : ℕ) (hd : 3≤d) (hℓ : 1≤ℓ) : + DynamicsConverges d ℓ ∧ + ∃ β₀ : ℝ,0<β₀ ∧ ∀ β : ℝ,β₀≤β → + ∃ ω : State d ℓ,TranslationInvariant ω ∧ IsKMS β ω ∧ + (ω.functional (spinZ d ℓ 0)).im=0 ∧ + (ℓ:ℝ)/8≤(ω.functional (spinZ d ℓ 0)).re := by + sorry + +end Heisenberg + +end + +end OAI diff --git a/lean/ComparatorChallenges/HenonEmden.json b/lean/ComparatorChallenges/HenonEmden.json new file mode 100644 index 0000000000000000000000000000000000000000..aea44bc9259e0cc9a992157f7352b02c844ee71a --- /dev/null +++ b/lean/ComparatorChallenges/HenonEmden.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.HenonEmden", + "solution_module": "OAI.Analysis.HenonEmden.Main", + "theorem_names": [ + "OAI.HenonLaneEmden.main_nonexistence" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/HenonEmden.lean b/lean/ComparatorChallenges/HenonEmden.lean new file mode 100644 index 0000000000000000000000000000000000000000..6481354cae9713ce9f1e0db2ec5eb06a42c649ef --- /dev/null +++ b/lean/ComparatorChallenges/HenonEmden.lean @@ -0,0 +1,31 @@ +import Mathlib + +namespace OAI + +namespace HenonLaneEmden + +abbrev Space (n : ℕ) := EuclideanSpace ℝ (Fin n) + +structure IsSolution (n : ℕ) (p q A B : ℝ) (u v : Space n → ℝ) : Prop where + continuous_u : Continuous u + continuous_v : Continuous v + regular_u : ContDiffOn ℝ 2 u ({0}ᶜ : Set (Space n)) + regular_v : ContDiffOn ℝ 2 v ({0}ᶜ : Set (Space n)) + positive_u : ∀ x, 0 < u x + positive_v : ∀ x, 0 < v x + equation_u : ∀ x, x ≠ 0 → + -(Laplacian.laplacian u) x = Real.rpow ‖x‖ A * Real.rpow (v x) p + equation_v : ∀ x, x ≠ 0 → + -(Laplacian.laplacian v) x = Real.rpow ‖x‖ B * Real.rpow (u x) q + +def Subcritical (n : ℕ) (p q A B : ℝ) : Prop := + ((n : ℝ) + A) / (p + 1) + ((n : ℝ) + B) / (q + 1) > (n : ℝ) - (1 + 1) + +theorem main_nonexistence (n : ℕ) (hn : 2 ≤ n) (p q A B : ℝ) + (hp : 0 < p) (hq : 0 < q) (hsub : Subcritical n p q A B) : + ¬ ∃ u v : Space n → ℝ, IsSolution n p q A B u v := by + sorry + +end HenonLaneEmden + +end OAI diff --git a/lean/ComparatorChallenges/HilbertCrouzeix.json b/lean/ComparatorChallenges/HilbertCrouzeix.json new file mode 100644 index 0000000000000000000000000000000000000000..ab1fd2ef34e9f2e1e1c9867b542c329302e71f93 --- /dev/null +++ b/lean/ComparatorChallenges/HilbertCrouzeix.json @@ -0,0 +1,17 @@ +{ + "challenge_module": "ComparatorChallenges.HilbertCrouzeix", + "solution_module": "OAI.Analysis.HilbertCrouzeix.Main", + "theorem_names": [ + "OAI.HilbertCrouzeix.numericalClosure_geometry", + "OAI.HilbertCrouzeix.exists_finite_compression", + "OAI.HilbertCrouzeix.rational_denominator_isUnit", + "OAI.HilbertCrouzeix.zeroConclusion" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/HilbertCrouzeix.lean b/lean/ComparatorChallenges/HilbertCrouzeix.lean new file mode 100644 index 0000000000000000000000000000000000000000..1ca3a09958ae50cde644182589149a90199e763a --- /dev/null +++ b/lean/ComparatorChallenges/HilbertCrouzeix.lean @@ -0,0 +1,143 @@ +import Mathlib + +namespace OAI + +noncomputable section + +open Complex Set +open scoped TensorProduct Matrix.Norms.L2Operator Classical ComplexConjugate + +namespace HilbertCrouzeix + +universe u + +abbrev Coeff (m : ℕ) := Matrix (Fin m) (Fin m) ℂ +abbrev CoeffSpace (m : ℕ) := EuclideanSpace ℂ (Fin m) + +variable {H : Type u} [NormedAddCommGroup H] [InnerProductSpace ℂ H] + +def numericalRange (A : H →L[ℂ] H) : Set ℂ := + {z | ∃ x : H, ‖x‖ = 1 ∧ inner ℂ x (A x) = z} + +def numericalClosure (A : H →L[ℂ] H) : Set ℂ := closure (numericalRange A) + +abbrev Amplification (H : Type u) [NormedAddCommGroup H] [InnerProductSpace ℂ H] + (m : ℕ) := UniformSpace.Completion (H ⊗[ℂ] CoeffSpace m) + +def tensorOp {m : ℕ} (A : H →L[ℂ] H) (B : Coeff m) : + Amplification H m →L[ℂ] Amplification H m := + (TensorProduct.mapL A (Matrix.toEuclideanCLM (n := Fin m) (𝕜 := ℂ) B)).completion + +def matrixPolynomial {m d : ℕ} (B : Fin (d + 1) → Coeff m) (z : ℂ) : Coeff m := + ∑ k : Fin (d + 1), z ^ k.val • B k + +def polynomialEval {m d : ℕ} (A : H →L[ℂ] H) (B : Fin (d + 1) → Coeff m) : + Amplification H m →L[ℂ] Amplification H m := + ∑ k : Fin (d + 1), tensorOp (A ^ k.val) (B k) + +def normSup {E : Type*} [Norm E] (S : Set ℂ) (f : ℂ → E) : ℝ := + if S.Nonempty then sSup ((fun z => ‖f z‖) '' S) else 0 +def contourIntegral {E : Type*} [NormedAddCommGroup E] [NormedSpace ℂ E] + (γ : ℝ → ℂ) (f : ℂ → E) : E := + ∫ t : ℝ in (0 : ℝ)..1, deriv γ t • f (γ t) + +def contourIndex (γ : ℝ → ℂ) (z : ℂ) : ℂ := + (2 * (Real.pi : ℂ) * Complex.I)⁻¹ * contourIntegral γ (fun w => (w - z)⁻¹) + +def IsCauchyContour (K U : Set ℂ) (γ : ℝ → ℂ) : Prop := + ContDiff ℝ 1 γ ∧ γ 0 = γ 1 ∧ + (∀ t ∈ Set.Icc (0 : ℝ) 1, γ t ∈ U \ K) ∧ + (∀ z ∈ K, contourIndex γ z = 1) ∧ + (∀ z ∉ U, contourIndex γ z = 0) + +def chosenContour (K U : Set ℂ) : ℝ → ℂ := + Classical.epsilon (IsCauchyContour K U) + +variable [CompleteSpace H] + +def dunfordIntegral (A : H →L[ℂ] H) (γ : ℝ → ℂ) (f : ℂ → ℂ) : H →L[ℂ] H := + (2 * (Real.pi : ℂ) * Complex.I)⁻¹ • + contourIntegral γ (fun z => f z • resolvent A z) + +def holomorphicCalculus (A : H →L[ℂ] H) (U : Set ℂ) (f : ℂ → ℂ) : H →L[ℂ] H := + dunfordIntegral A (chosenContour (numericalClosure A) U) f + +def matrixUnit {m : ℕ} (i j : Fin m) : Coeff m := Matrix.single i j 1 + +def holomorphicEval {m : ℕ} (A : H →L[ℂ] H) (U : Set ℂ) (F : ℂ → Coeff m) : + Amplification H m →L[ℂ] Amplification H m := + ∑ i : Fin m, ∑ j : Fin m, + tensorOp (holomorphicCalculus A U (fun z => F z i j)) (matrixUnit i j) +abbrev RationalMatrix (m : ℕ) := Matrix (Fin m) (Fin m) (RatFunc ℂ) + +def poleFreeSet {m : ℕ} (R : RationalMatrix m) : Set ℂ := + {z | ∀ i j, (R i j).denom.eval z ≠ 0} + +def rationalFunction {m : ℕ} (R : RationalMatrix m) (z : ℂ) : Coeff m := + fun i j => RatFunc.eval (RingHom.id ℂ) z (R i j) + +def rationalCalculus (A : H →L[ℂ] H) (r : RatFunc ℂ) : H →L[ℂ] H := + Polynomial.aeval A r.num * Ring.inverse (Polynomial.aeval A r.denom) + +def rationalEval {m : ℕ} (A : H →L[ℂ] H) (R : RationalMatrix m) : + Amplification H m →L[ℂ] Amplification H m := + ∑ i : Fin m, ∑ j : Fin m, tensorOp (rationalCalculus A (R i j)) (matrixUnit i j) +def ZeroConclusion (A : H →L[ℂ] H) : Prop := + numericalRange A = ∅ ∧ + (∀ (m : ℕ) (F : ℂ → Coeff m), normSup (numericalRange A) F = 0) ∧ + ∀ (m : ℕ), 0 < m → + (∀ T : Amplification H m →L[ℂ] Amplification H m, T = 0) ∧ + (∀ (d : ℕ) (B : Fin (d + 1) → Coeff m), polynomialEval A B = 0 ∧ + ‖polynomialEval A B‖ ≤ 2 * normSup (numericalRange A) (matrixPolynomial B)) ∧ + (∀ (U : Set ℂ) (F : ℂ → Coeff m), holomorphicEval A U F = 0 ∧ + ‖holomorphicEval A U F‖ ≤ 2 * normSup (numericalRange A) F) ∧ + (∀ (R : RationalMatrix m), rationalEval A R = 0 ∧ + ‖rationalEval A R‖ ≤ 2 * normSup (numericalRange A) (rationalFunction R)) + +section CompressionDefinitions +omit [CompleteSpace H] + +def compression (A : H →L[ℂ] H) (E : Submodule ℂ H) [E.HasOrthogonalProjection] : + E →L[ℂ] E := E.orthogonalProjectionOnto.comp (A.comp E.subtypeL) +def completedIsometry {V : Type*} {W : Type*} + [NormedAddCommGroup V] [NormedAddCommGroup W] [NormedSpace ℂ V] [NormedSpace ℂ W] + (f : V →ₗᵢ[ℂ] W) : UniformSpace.Completion V →ₗᵢ[ℂ] UniformSpace.Completion W := + { f.toContinuousLinearMap.completion.toLinearMap with + norm_map' := f.isometry.completion_map.norm_map_of_map_zero + (f.toContinuousLinearMap.completion.map_zero) } + +def tensorInclusion (E : Submodule ℂ H) (m : ℕ) : + Amplification E m →ₗᵢ[ℂ] Amplification H m := + completedIsometry (TensorProduct.mapIsometry E.subtypeₗᵢ (.id : CoeffSpace m →ₗᵢ[ℂ] CoeffSpace m)) + +end CompressionDefinitions + +theorem numericalClosure_geometry (A : H →L[ℂ] H) : + IsCompact (numericalClosure A) ∧ Convex ℝ (numericalClosure A) ∧ + spectrum ℂ A ⊆ numericalClosure A := by + sorry + +omit [CompleteSpace H] in +theorem exists_finite_compression {m d : ℕ} (A : H →L[ℂ] H) + (B : Fin (d + 1) → Coeff m) (ξ : H ⊗[ℂ] CoeffSpace m) : + ∃ (E : Submodule ℂ H) (hE : FiniteDimensional ℂ E), + letI : FiniteDimensional ℂ E := hE + ∃ η : Amplification E m, + tensorInclusion E m η = (↑ξ : Amplification H m) ∧ + tensorInclusion E m (polynomialEval (compression A E) B η) = + polynomialEval A B (↑ξ) := by + sorry + +theorem rational_denominator_isUnit [Nontrivial H] (A : H →L[ℂ] H) + {m : ℕ} (R : RationalMatrix m) (hR : numericalClosure A ⊆ poleFreeSet R) + (i j : Fin m) : IsUnit (Polynomial.aeval A (R i j).denom) := by + sorry + +theorem zeroConclusion [Subsingleton H] (A : H →L[ℂ] H) : ZeroConclusion A := by + sorry + +end HilbertCrouzeix + +end + +end OAI diff --git a/lean/ComparatorChallenges/HoneycombBridgeFiniteness.json b/lean/ComparatorChallenges/HoneycombBridgeFiniteness.json new file mode 100644 index 0000000000000000000000000000000000000000..56178bca61329eda5117963defbe5ad0446bd23d --- /dev/null +++ b/lean/ComparatorChallenges/HoneycombBridgeFiniteness.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.HoneycombBridgeFiniteness", + "solution_module": "OAI.Combinatorics.HoneycombCorridor.BridgeFiniteness", + "theorem_names": [ + "OAI.PolynomialVacuumBridge.Corridor.finite_bridge_sums" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/HoneycombBridgeFiniteness.lean b/lean/ComparatorChallenges/HoneycombBridgeFiniteness.lean new file mode 100644 index 0000000000000000000000000000000000000000..a75590bb581ff45f3b4b5b364c57dbdeae982381 --- /dev/null +++ b/lean/ComparatorChallenges/HoneycombBridgeFiniteness.lean @@ -0,0 +1,65 @@ +import Mathlib + +namespace OAI + +namespace PolynomialVacuumBridge.Corridor + +inductive Vertex where + | up (i j : ℤ) + | down (i j : ℤ) + deriving DecidableEq + +noncomputable def position : Vertex → ℝ × ℝ + | .up i j => ((i : ℝ) + (j : ℝ) / 2, + ((j : ℝ) + 1 / 3) * (Real.sqrt 3 / 2)) + | .down i j => ((i : ℝ) + (j : ℝ) / 2 + 1 / 2, + ((j : ℝ) + 2 / 3) * (Real.sqrt 3 / 2)) + +def adjacent : Vertex → Vertex → Prop + | .up i j, .down k l => + (k = i ∧ l = j - 1) ∨ (k = i ∧ l = j) ∨ (k = i - 1 ∧ l = j) + | .down k l, .up i j => + (k = i ∧ l = j - 1) ∨ (k = i ∧ l = j) ∨ (k = i - 1 ∧ l = j) + | _, _ => False + +noncomputable def criticalActivity : ℝ := (2 * Real.cos (Real.pi / 8))⁻¹ +noncomputable def layer (vertex : Vertex) : ℤ := + Vertex.rec (fun _ vertical => vertical) (fun _ vertical => vertical) vertex + +structure BridgePath (h : ℕ) where + vertices : List Vertex + distinct : vertices.Nodup + connected : vertices.IsChain adjacent + source : vertices.head? = some (.up 0 0) + terminal : ∃ i : ℤ, vertices.getLast? = some (.down i ((h : ℤ) - 1)) + inStrip : ∀ v ∈ vertices, 0 ≤ layer v ∧ layer v < (h : ℤ) + +noncomputable def weight {h : ℕ} (p : BridgePath h) : ℝ := + criticalActivity ^ p.vertices.length + +noncomputable def firstLengthWeight {h : ℕ} (p : BridgePath h) : ℝ := + (p.vertices.length : ℝ) * weight p + +noncomputable def bridgeMass (h : ℕ) : ℝ := ∑' p : BridgePath h, weight p +noncomputable def InLogCorridor {h : ℕ} (p : BridgePath h) : Prop := + ∀ v ∈ p.vertices, |(position v).1| ≤ (h : ℝ) * (Real.log (h : ℝ)) ^ 2 + +def ConfinedBridgePath (h : ℕ) := {p : BridgePath h // InLogCorridor p} + +noncomputable def confinedMass (h : ℕ) : ℝ := + ∑' p : ConfinedBridgePath h, weight p.val +def FiniteBridgeSums : Prop := + ∀ h : ℕ, 1 ≤ h → + Summable (weight (h := h)) ∧ Summable (firstLengthWeight (h := h)) ∧ + Summable (fun p : BridgePath h => firstLengthWeight p / bridgeMass h) ∧ + Summable (fun p : ConfinedBridgePath h => weight p.val) ∧ + Summable (fun p : ConfinedBridgePath h => firstLengthWeight p.val) ∧ + Summable (fun p : ConfinedBridgePath h => firstLengthWeight p.val / confinedMass h) + + +theorem finite_bridge_sums : FiniteBridgeSums := by + sorry + +end PolynomialVacuumBridge.Corridor + +end OAI diff --git a/lean/ComparatorChallenges/HoneycombFreeEnergy.json b/lean/ComparatorChallenges/HoneycombFreeEnergy.json new file mode 100644 index 0000000000000000000000000000000000000000..3f66691ed92a78d47bff96067fa5b6f625813067 --- /dev/null +++ b/lean/ComparatorChallenges/HoneycombFreeEnergy.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.HoneycombFreeEnergy", + "solution_module": "OAI.Probability.Honeycomb.FreeEnergy", + "theorem_names": [ + "OAI.HoneycombForce.logPartition_tendsto" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/HoneycombFreeEnergy.lean b/lean/ComparatorChallenges/HoneycombFreeEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..a2fe6b6cb2fb920565023a128d80f3427723ecac --- /dev/null +++ b/lean/ComparatorChallenges/HoneycombFreeEnergy.lean @@ -0,0 +1,72 @@ +import Mathlib + +namespace OAI + +/-! Existence of the fixed-length forced free energy of honeycomb walks. -/ + +noncomputable section +open scoped ENNReal Topology +open Filter + +namespace HoneycombForce + +structure Vertex where + col : ℤ + row : ℤ + up : Bool + deriving DecidableEq + +def up (i j : ℤ) : Vertex := ⟨i, j, true⟩ + +def down (i j : ℤ) : Vertex := ⟨i, j, false⟩ + +def rowSpacing : ℝ := Real.sqrt 3 / 2 + +def position (v : Vertex) : ℂ := + if v.up then + ⟨(v.col : ℝ) + (v.row : ℝ) / 2 + 1/2, + rowSpacing * ((v.row : ℝ) + 1/3)⟩ + else + ⟨(v.col : ℝ) + (v.row : ℝ) / 2 + 1, + rowSpacing * ((v.row : ℝ) + 2/3)⟩ + +def rho : ℝ := (Real.sqrt (2 + Real.sqrt 2))⁻¹ + +def neighbors (v : Vertex) : Finset Vertex := + if v.up then + {down v.col (v.row-1), down v.col v.row, down (v.col-1) v.row} + else + {up v.col (v.row+1), up v.col v.row, up (v.col+1) v.row} + +def walkLists (o : Vertex) : ℕ → Finset (List Vertex) + | 0 => {[o]} + | n+1 => (neighbors o).biUnion (fun v => (walkLists v n).image (List.cons o)) + +def saws (o : Vertex) (n : ℕ) : Finset (List Vertex) := + (walkLists o n).filter List.Nodup + +def endpoint (o : Vertex) (γ : List Vertex) : Vertex := γ.getLastD o + +def displacement (o : Vertex) (γ : List Vertex) : ℂ := + position (endpoint o γ) - position o + +def projection (e z : ℂ) : ℝ := (star e * z).re + +def partition (o : Vertex) (e : ℂ) (s : ℝ) (n : ℕ) : ℝ := + ∑ γ ∈ saws o n, rho ^ n * Real.exp (s * projection e (displacement o γ)) + +def logPartition (o : Vertex) (e : ℂ) (s : ℝ) (n : ℕ) : ℝ := + Real.log (partition o e s n) / (n : ℝ) + +def freeEnergy (o : Vertex) (e : ℂ) (s : ℝ) : ℝ := + Filter.limUnder atTop (logPartition o e s) + +theorem logPartition_tendsto (o : Vertex) (e : ℂ) (s : ℝ) : + Tendsto (logPartition o e s) atTop (𝓝 (freeEnergy o e s)) := by + sorry + +end HoneycombForce + +end + +end OAI diff --git a/lean/ComparatorChallenges/HotSpots.json b/lean/ComparatorChallenges/HotSpots.json new file mode 100644 index 0000000000000000000000000000000000000000..014f1b7feef742e7c23526f9a95a6ff30992b4a8 --- /dev/null +++ b/lean/ComparatorChallenges/HotSpots.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.HotSpots", + "solution_module": "OAI.Analysis.HotSpots.Main", + "theorem_names": [ + "OAI.StrictHotSpots.main_theorem" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/HotSpots.lean b/lean/ComparatorChallenges/HotSpots.lean new file mode 100644 index 0000000000000000000000000000000000000000..9e8c905519d515e23be329f1e4a544618a9d2397 --- /dev/null +++ b/lean/ComparatorChallenges/HotSpots.lean @@ -0,0 +1,57 @@ +import Mathlib + +namespace OAI + +noncomputable section +open Set MeasureTheory +open scoped ContDiff + +namespace StrictHotSpots + +abbrev Plane := EuclideanSpace ℝ (Fin 2) + +def SmoothBoundary (Ω : Set Plane) : Prop := + ∀ p ∈ frontier Ω, ∃ (U : Set Plane) (ρ : Plane → ℝ), + IsOpen U ∧ p ∈ U ∧ ContDiffOn ℝ ∞ ρ U ∧ + fderiv ℝ ρ p ≠ 0 ∧ ρ p = 0 ∧ + Ω ∩ U = {x | ρ x < 0} ∩ U + +def AdmissibleDomain (Ω : Set Plane) : Prop := + Ω.Nonempty ∧ IsOpen Ω ∧ Bornology.IsBounded Ω ∧ + IsSimplyConnected Ω ∧ SmoothBoundary Ω + +def HasH1Gradient (Ω : Set Plane) (v : Plane → ℝ) (g : Plane → Plane) : Prop := + MemLp v 2 (volume.restrict Ω) ∧ MemLp g 2 (volume.restrict Ω) ∧ + ∀ φ : Plane → ℝ, ContDiff ℝ ∞ φ → HasCompactSupport φ → tsupport φ ⊆ Ω → + ∀ e : Plane, + (∫ x in Ω, v x * (fderiv ℝ φ x) e) = + -(∫ x in Ω, (inner ℝ (g x) e) * φ x) + +def rayleighValues (Ω : Set Plane) : Set ℝ := + {r | ∃ (v : Plane → ℝ) (g : Plane → Plane), + HasH1Gradient Ω v g ∧ (∫ x in Ω, v x) = 0 ∧ + 0 < (∫ x in Ω, (v x) ^ 2) ∧ + r = (∫ x in Ω, ‖g x‖ ^ 2) / (∫ x in Ω, (v x) ^ 2)} + +def firstPositiveNeumannValue (Ω : Set Plane) : ℝ := sInf (rayleighValues Ω) + +def InFirstNeumannEigenspace (Ω : Set Plane) (u : Plane → ℝ) : Prop := + ContDiffOn ℝ ∞ u (closure Ω) ∧ HasH1Gradient Ω u (gradient u) ∧ + (∫ x in Ω, u x) = 0 ∧ + ∀ (v : Plane → ℝ) (g : Plane → Plane), HasH1Gradient Ω v g → + (∫ x in Ω, inner ℝ (gradient u x) (g x)) = + firstPositiveNeumannValue Ω * (∫ x in Ω, u x * v x) + +def MainConclusion (Ω : Set Plane) (u : Plane → ℝ) : Prop := + (∀ x ∈ Ω, gradient u x ≠ 0) ∧ + ∀ x ∈ Ω, sInf (u '' frontier Ω) < u x ∧ u x < sSup (u '' frontier Ω) + +theorem main_theorem (Ω : Set Plane) (hΩ : AdmissibleDomain Ω) + (u : Plane → ℝ) (hu : InFirstNeumannEigenspace Ω u) + (hne : ∃ x ∈ Ω, u x ≠ 0) : MainConclusion Ω u := by + sorry + +end StrictHotSpots +end + +end OAI diff --git a/lean/ComparatorChallenges/HyperbolicCones.json b/lean/ComparatorChallenges/HyperbolicCones.json new file mode 100644 index 0000000000000000000000000000000000000000..332fb7b4a1c0e17a4c2473c40b7cdc9888caaecc --- /dev/null +++ b/lean/ComparatorChallenges/HyperbolicCones.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.HyperbolicCones", + "solution_module": "OAI.Analysis.HyperbolicCones.Main", + "theorem_names": [ + "OAI.Paper256.main_result" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/HyperbolicCones.lean b/lean/ComparatorChallenges/HyperbolicCones.lean new file mode 100644 index 0000000000000000000000000000000000000000..2dc28ca17123c4692c941ada8ca4366e47b2a032 --- /dev/null +++ b/lean/ComparatorChallenges/HyperbolicCones.lean @@ -0,0 +1,81 @@ +import Mathlib + +namespace OAI + +noncomputable section + +open scoped Matrix.Norms.L2Operator + +universe u + +namespace Paper256 + +abbrev Mat (n : ℕ) (R : Type u) := Matrix (Fin n) (Fin n) R + +abbrev Sym (n : ℕ) := selfAdjoint (Mat n ℝ) + +instance instFiniteDimensionalSym (n : ℕ) : FiniteDimensional ℝ (Sym n) := + FiniteDimensional.finiteDimensional_submodule (selfAdjoint.submodule ℝ (Mat n ℝ)) + +abbrev Ambient := (Sym 4 × Sym 4) × (Fin 3 → ℝ) + +abbrev SymIndex := {ij : Fin 4 × Fin 4 // ij.1 ≤ ij.2} + +abbrev Coord := (SymIndex ⊕ SymIndex) ⊕ Fin 3 + +def qMatrix {R : Type u} [CommRing R] (y : Fin 3 → R) : Mat 3 R := + fun i j => if i = j then y i ^ 2 + y (i + 1) ^ 2 else -(y i * y j) + +def phi {R : Type u} [CommRing R] (y : Fin 3 → R) (X : Mat 4 R) : Mat 4 R := + fun i j => Fin.cases + (Fin.cases + (Matrix.trace (qMatrix y * X.submatrix Fin.succ Fin.succ)) + (fun j => -(∑ k, X 0 k.succ * qMatrix y k j)) j) + (fun i => Fin.cases + (-(∑ k, qMatrix y i k * X k.succ 0)) + (fun j => X 0 0 * qMatrix y i j) j) i + +def matrixValue {R : Type u} [CommRing R] + (X Z : Mat 4 R) (y : Fin 3 → R) : R := + Matrix.det ((Matrix.det X) • Z - phi y (Matrix.adjugate X)) + +def symmetricCoordinates {R : Type u} (v : SymIndex → R) : Mat 4 R := + fun i j => if h : i ≤ j then v ⟨(i, j), h⟩ + else v ⟨(j, i), le_of_lt (lt_of_not_ge h)⟩ + +def polynomial : MvPolynomial Coord ℝ := + matrixValue + (symmetricCoordinates fun ij => MvPolynomial.X (Sum.inl (Sum.inl ij))) + (symmetricCoordinates fun ij => MvPolynomial.X (Sum.inl (Sum.inr ij))) + (fun i => MvPolynomial.X (Sum.inr i)) + +def coordinates (x : Ambient) : Coord → ℝ := + Sum.elim (Sum.elim + (fun ij => (x.1.1 : Mat 4 ℝ) ij.val.1 ij.val.2) + (fun ij => (x.1.2 : Mat 4 ℝ) ij.val.1 ij.val.2)) x.2 + +def basePoint : Ambient := ((1, 1), 0) + +def linePolynomial (x : Ambient) : Polynomial ℝ := + MvPolynomial.eval₂ Polynomial.C + (fun i => Polynomial.C (coordinates basePoint i) * Polynomial.X - + Polynomial.C (coordinates x i)) polynomial + +def cone : Set Ambient := + {x | ∀ t : ℂ, (linePolynomial x).aeval t = 0 → t.im = 0 ∧ 0 ≤ t.re} + +theorem main_result : + Module.finrank ℝ Ambient = 23 ∧ + polynomial.IsHomogeneous 20 ∧ + polynomial.totalDegree = 20 ∧ + MvPolynomial.eval (coordinates basePoint) polynomial = 1 ∧ + (∀ (x : Ambient) (z : ℂ), (linePolynomial x).aeval z = 0 → z.im = 0) ∧ + ∀ (N : ℕ) (_hN : 0 < N) (L : Ambient →ₗ[ℝ] Sym N), + cone ≠ {x | (L x : Mat N ℝ).PosSemidef} := by + sorry + +end Paper256 + +end + +end OAI diff --git a/lean/ComparatorChallenges/HyperbolicObstruction.json b/lean/ComparatorChallenges/HyperbolicObstruction.json new file mode 100644 index 0000000000000000000000000000000000000000..b64d87122934dabda5040a37935f1267e2bb6f7c --- /dev/null +++ b/lean/ComparatorChallenges/HyperbolicObstruction.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.HyperbolicObstruction", + "solution_module": "OAI.Geometry.HyperbolicGroups.Main", + "theorem_names": [ + "OAI.HyperbolicObstruction.main" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/HyperbolicObstruction.lean b/lean/ComparatorChallenges/HyperbolicObstruction.lean new file mode 100644 index 0000000000000000000000000000000000000000..48a977c226cfce90f8ffe3cb503be7508b31ced3 --- /dev/null +++ b/lean/ComparatorChallenges/HyperbolicObstruction.lean @@ -0,0 +1,163 @@ +import Mathlib + +namespace OAI + + + +section + +section + +/-! +Finite complexes are standard barycentric realizations of finite abstract +simplicial complexes. Area-counted elementary edge homotopies encode the +usual triangular disk diagrams, allowing spurs and collapsed edges. Null edge +loops (equivalently closed lifts to the universal cover) are those admitting +such a disk, without any area bound. Asphericity is vanishing of all higher +homotopy groups of this finite polyhedron. The CAT conditions use the standard +squared-distance / hyperbolic-cosh comparison formulations. +-/ + +noncomputable section +open scoped Topology ContinuousMap + +namespace HyperbolicObstruction + +structure FiniteComplex where + n : ℕ + complex : AbstractSimplicialComplex (Fin n) + +namespace FiniteComplex + +abbrev Vertex (K : FiniteComplex) := Fin K.n + +def Carrier (K : FiniteComplex) := + {x : K.Vertex → ℝ // (∀ i, 0 ≤ x i) ∧ (∑ i, x i) = 1 ∧ + ∃ s ∈ K.complex.faces, ∀ i, i ∉ s → x i = 0} + +instance (K : FiniteComplex) : TopologicalSpace K.Carrier := + inferInstanceAs (TopologicalSpace (Subtype _)) + +def Edge (K : FiniteComplex) (a b : K.Vertex) : Prop := + {a, b} ∈ K.complex.faces + +def EdgePath (K : FiniteComplex) : List K.Vertex → Prop + | [] => False + | [_] => True + | a :: b :: t => K.Edge a b ∧ K.EdgePath (b :: t) + +def Closed (K : FiniteComplex) (p : List K.Vertex) : Prop := + ∃ a t, p = a :: (t ++ [a]) ∨ p = [a] + +/-- An elementary disk move. A noncollapsed triangular face costs one; + a spur or a collapsed edge costs zero. Contexts are unchanged. -/ +inductive DiskMove (K : FiniteComplex) : List K.Vertex → List K.Vertex → ℕ → Prop + | stutter (l r) (a) : + DiskMove K (l ++ [a, a] ++ r) (l ++ [a] ++ r) 0 + | spur (l r) (a b) (h : K.Edge a b) : + DiskMove K (l ++ [a, b, a] ++ r) (l ++ [a] ++ r) 0 + | triangle (l r) (a b c) (h : {a, b, c} ∈ K.complex.faces) + (hne : ({a, b, c} : Finset K.Vertex).card = 3) : + DiskMove K (l ++ [a, b, c] ++ r) (l ++ [a, c] ++ r) 1 + +/-- A disk certificate obtained by elementary triangle attachments/removals, + with spurs/collapses allowed. The index is the number of triangular faces. -/ +inductive DiskHomotopy (K : FiniteComplex) : List K.Vertex → List K.Vertex → ℕ → Prop + | refl (p) : DiskHomotopy K p p 0 + | move {p q n} : DiskMove K p q n → DiskHomotopy K p q n + | symm {p q n} : DiskHomotopy K p q n → DiskHomotopy K q p n + | trans {p q r m n} : DiskHomotopy K p q m → DiskHomotopy K q r n → + DiskHomotopy K p r (m + n) + +def Disk (K : FiniteComplex) (p : List K.Vertex) (faces : ℕ) : Prop := + ∃ a, K.DiskHomotopy p [a] faces + +def LinearDiskFilling (K : FiniteComplex) (C : ℝ) : Prop := + ∀ p, K.EdgePath p → K.Closed p → (∃ a, K.Disk p a) → + ∃ a, K.Disk p a ∧ (a : ℝ) ≤ C * (p.length - 1 : ℕ) + +def Aspherical (K : FiniteComplex) (x : K.Carrier) : Prop := + ∀ n : ℕ, Subsingleton (HomotopyGroup.Pi (n + 2) K.Carrier x) + +end FiniteComplex + +/-- A constant-speed metric segment, parametrized on [0,1]. -/ +def IsSegment {X : Type*} [MetricSpace X] (γ : ℝ → X) (x y : X) : Prop := + γ 0 = x ∧ γ 1 = y ∧ + ∀ s ∈ Set.Icc (0 : ℝ) 1, ∀ t ∈ Set.Icc (0 : ℝ) 1, + dist (γ s) (γ t) = |s - t| * dist x y + +def IsGeodesic (X : Type*) [MetricSpace X] : Prop := + ∀ x y : X, ∃ γ, IsSegment γ x y + +/-- The CN characterization of CAT(0), with whole metric segments. -/ +def CATZero (X : Type*) [MetricSpace X] : Prop := + ∀ x y : X, ∃ γ, IsSegment γ x y ∧ + ∀ z : X, ∀ t ∈ Set.Icc (0 : ℝ) 1, + dist z (γ t) ^ 2 ≤ (1 - t) * dist z x ^ 2 + t * dist z y ^ 2 - + t * (1 - t) * dist x y ^ 2 + +/-- The hyperbolic-cosh midpoint characterization of CAT(-1). -/ +def CATNegOne (X : Type*) [MetricSpace X] : Prop := + ∀ x y : X, ∃ γ, IsSegment γ x y ∧ + ∀ z : X, Real.cosh (dist z (γ (1 / 2))) ≤ + (Real.cosh (dist z x) + Real.cosh (dist z y)) / + (2 * Real.cosh (dist x y / 2)) + +/-- A proper, cocompact isometric action of a discrete group. -/ +structure GeometricAction (G X : Type*) [Group G] [MetricSpace X] where + act : G →* (X ≃ᵢ X) + proper : ∀ C : Set X, IsCompact C → + {g : G | ∃ x ∈ C, act g x ∈ C}.Finite + cocompact : ∃ C : Set X, IsCompact C ∧ ∀ x : X, ∃ g : G, ∃ y ∈ C, act g y = x + +universe u + +def NoGeometricCATZeroAction (G : Type*) [Group G] : Prop := + ∀ (X : Type u) (_ : MetricSpace X), Nonempty X → ProperSpace X → CompleteSpace X → + CATZero X → IsEmpty (GeometricAction G X) + +def WordLength {G : Type*} [Group G] (S : Finset G) (g : G) : ℕ := + sInf {n | ∃ w : List G, w.length = n ∧ + (∀ a ∈ w, a ∈ S ∨ a⁻¹ ∈ S) ∧ w.prod = g} + +def WordDistance {G : Type*} [Group G] (S : Finset G) (g h : G) : ℝ := + WordLength S (g⁻¹ * h) + +/-- Four-point word hyperbolicity, for some finite generating set. -/ +def WordHyperbolic (G : Type*) [Group G] : Prop := + ∃ S : Finset G, Subgroup.closure (S : Set G) = ⊤ ∧ + ∃ δ : ℝ, 0 ≤ δ ∧ ∀ a b c d : G, + WordDistance S a c + WordDistance S b d ≤ + max (WordDistance S a b + WordDistance S c d) + (WordDistance S a d + WordDistance S b c) + 2 * δ + +/-- A metric on the given finite polyhedron, not on a different topology. -/ +def CompatibleLocallyCATNegOne (K : FiniteComplex) : Prop := + ∃ m : MetricSpace K.Carrier, + m.toUniformSpace.toTopologicalSpace = (inferInstance : TopologicalSpace K.Carrier) ∧ + (letI := m + IsGeodesic K.Carrier ∧ ∀ x : K.Carrier, ∃ r : ℝ, 0 < r ∧ + CATNegOne (Metric.ball x r)) + +/-- A finite aspherical complex with hyperbolic fundamental group, no geometric CAT(0) +action, and no homotopy equivalent finite complex admitting a locally CAT(-1) metric. -/ +def MainStatement : Prop := + ∃ K : FiniteComplex, ∃ x : K.Carrier, ∃ C : ℝ, + ConnectedSpace K.Carrier ∧ K.Aspherical x ∧ 0 ≤ C ∧ K.LinearDiskFilling C ∧ + NoGeometricCATZeroAction.{u} (FundamentalGroup K.Carrier x) ∧ + WordHyperbolic (FundamentalGroup K.Carrier x) ∧ + ∀ L : FiniteComplex, Nonempty (K.Carrier ≃ₕ L.Carrier) → + ¬ CompatibleLocallyCATNegOne L + + +theorem main : MainStatement.{u} := by sorry + +end HyperbolicObstruction + + +end +end +end + +end OAI diff --git a/lean/ComparatorChallenges/HyperinvariantSubspaces.json b/lean/ComparatorChallenges/HyperinvariantSubspaces.json new file mode 100644 index 0000000000000000000000000000000000000000..18915baec50541755e51ae9581873b9b81f594b0 --- /dev/null +++ b/lean/ComparatorChallenges/HyperinvariantSubspaces.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.HyperinvariantSubspaces", + "solution_module": "OAI.Analysis.Hyperinvariant.Main", + "theorem_names": [ + "OAI.Hyperinvariant.main_theorem" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/HyperinvariantSubspaces.lean b/lean/ComparatorChallenges/HyperinvariantSubspaces.lean new file mode 100644 index 0000000000000000000000000000000000000000..f6554418d3aa78d365a3e5ce16fe57081f59413b --- /dev/null +++ b/lean/ComparatorChallenges/HyperinvariantSubspaces.lean @@ -0,0 +1,43 @@ +import Mathlib + +namespace OAI + +namespace Hyperinvariant + +open Filter +open scoped Topology + +universe u + +section + +variable {H : Type u} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +def commutant (T : H →L[ℂ] H) : Subalgebra ℂ (H →L[ℂ] H) := + Subalgebra.centralizer ℂ ({T} : Set (H →L[ℂ] H)) + +def TransitiveCommutant (T : H →L[ℂ] H) : Prop := + ∀ K : Submodule ℂ H, IsClosed (K : Set H) → + (∀ A : H →L[ℂ] H, A * T = T * A → ∀ x ∈ K, A x ∈ K) → + K = ⊥ ∨ K = ⊤ + +@[instance_reducible] def strongOperatorTopology : TopologicalSpace (H →L[ℂ] H) := + TopologicalSpace.induced (fun A : H →L[ℂ] H => (fun x : H => A x)) inferInstance + +def FullClaim : Prop := + ∃ T : H →L[ℂ] H, T ≠ 0 ∧ + Tendsto (fun n : ℕ => ‖T ^ n‖ ^ (1 / (n : ℝ))) atTop (𝓝 0) ∧ + TransitiveCommutant T ∧ commutant T ≠ ⊤ ∧ + @IsClosed (H →L[ℂ] H) strongOperatorTopology (commutant T : Set (H →L[ℂ] H)) + +end + +variable (H : Type u) [NormedAddCommGroup H] [InnerProductSpace ℂ H] + [CompleteSpace H] [TopologicalSpace.SeparableSpace H] + +theorem main_theorem (hInf : ¬FiniteDimensional ℂ H) : FullClaim (H := H) := by + sorry + +end Hyperinvariant + +end OAI diff --git a/lean/ComparatorChallenges/IndependentProducts.json b/lean/ComparatorChallenges/IndependentProducts.json new file mode 100644 index 0000000000000000000000000000000000000000..c7aea47d3297cf2256fd5ecdba4e99aae4b103c7 --- /dev/null +++ b/lean/ComparatorChallenges/IndependentProducts.json @@ -0,0 +1,17 @@ +{ + "challenge_module": "ComparatorChallenges.IndependentProducts", + "solution_module": "OAI.Analysis.ProductSpaces.Main", + "theorem_names": [ + "OAI.IndependentProducts.main_general", + "OAI.IndependentProducts.main_exponential", + "OAI.IndependentProducts.main_gaussian_24", + "OAI.IndependentProducts.main_gaussian_12" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/IndependentProducts.lean b/lean/ComparatorChallenges/IndependentProducts.lean new file mode 100644 index 0000000000000000000000000000000000000000..ce22548dc3c27f0344bd01b844aea9341999e626 --- /dev/null +++ b/lean/ComparatorChallenges/IndependentProducts.lean @@ -0,0 +1,120 @@ +import Mathlib + +namespace OAI + +noncomputable section + +open MeasureTheory ProbabilityTheory Set Filter +open scoped ENNReal NNReal Topology + +universe uX + +namespace IndependentProducts + +/-- The tree of finite sequences of positive integers. -/ +abbrev Vertex := List ℕ+ +/-- Coordinates are attached only to nonroot vertices. -/ +abbrev Edge := {v : Vertex // v ≠ []} +abbrev Sample := Edge → ℝ + +/-- The product law of independent copies of the multiplier. -/ +def productMeasure (μ : Measure ℝ) : Measure Sample := + Measure.infinitePi (fun _ : Edge => μ) + +/-- The nonroot prefix ending at position `j`. -/ +def pathPrefix (v : Vertex) (j : Fin v.length) : Edge := + ⟨v.take (j.val + 1), by + intro h + have hl := congrArg List.length h + simp only [List.length_take, List.length_nil] at hl + have := j.isLt + omega⟩ + +/-- Root product is the empty product 1; every other product uses the path prefixes. -/ +def pathProduct (v : Vertex) (ω : Sample) : ℝ := + ∏ j : Fin v.length, ω (pathPrefix v j) + +/-- The closed real L1 span of the path products. -/ +def productSpan (μ : Measure ℝ) : Submodule ℝ (Lp ℝ 1 (productMeasure μ)) := + (Submodule.span ℝ {f : Lp ℝ 1 (productMeasure μ) | ∃ v : Vertex, + (f : Sample → ℝ) =ᵐ[productMeasure μ] pathProduct v}).topologicalClosure + +/-- Positivity, nonconstancy, mean one, and finite second moment of the multiplier law. -/ +structure MultiplierHypotheses (μ : Measure ℝ) : Prop where + probability : IsProbabilityMeasure μ + positive : ∀ᵐ w ∂μ, 0 < w + nonconstant : ∀ c : ℝ, ¬ (∀ᵐ w ∂μ, w = c) + mean_one : ∫ w, w ∂μ = 1 + second_moment : MemLp (fun w : ℝ => w) 2 μ + +variable (X : Type uX) [NormedAddCommGroup X] [NormedSpace ℝ X] + +/-- Closed subspaces of finite codimension, with respect to the inherited topology. -/ +def CofiniteSubspaces : Set (Submodule ℝ X) := + {F | IsClosed (F : Set X) ∧ FiniteDimensional ℝ (X ⧸ F)} + +/-- The averaged asymptotic midpoint modulus, with directions of norm at least 1. -/ +def averagedMidpointModulus (N : Seminorm ℝ X) (t : ℝ) : ℝ := + sInf {r | ∃ x : X, N x = 1 ∧ r = + sSup {a | ∃ F ∈ CofiniteSubspaces X, a = + sInf {b | ∃ y : X, y ∈ F ∧ 1 ≤ N y ∧ + b = (N (x + t • y) + N (x - t • y)) / 2 - 1}}} + +/-- The usual one-sided modulus, whose directions have norm exactly 1. -/ +def oneSidedModulus (N : Seminorm ℝ X) (t : ℝ) : ℝ := + sInf {r | ∃ x : X, N x = 1 ∧ r = + sSup {a | ∃ F ∈ CofiniteSubspaces X, a = + sInf {b | ∃ y : X, y ∈ F ∧ N y = 1 ∧ b = N (x + t • y) - 1}}} + +/-- A seminorm with these bounds is a genuine norm equivalent to the original norm. -/ +def IsEquivalentNorm (N : Seminorm ℝ X) : Prop := + ∃ a b : ℝ, 0 < a ∧ a ≤ b ∧ ∀ x, a * ‖x‖ ≤ N x ∧ N x ≤ b * ‖x‖ + +def IsAUC (N : Seminorm ℝ X) : Prop := ∀ t : ℝ, 0 < t → 0 < oneSidedModulus X N t + +/-- Gaussian-tail probability, in real rather than extended-nonnegative-real notation. -/ +def gaussianTail (r : ℝ) : ℝ := + (gaussianReal 0 1 {x : ℝ | r ≤ |x|}).toReal + +/-- The Gaussian excess constant at threshold twice the parameter. -/ +def excessConstant (K : ℝ) : ℝ := + (1 / 16 : ℝ) * ∫ x : ℝ, max (|x| - 2 * K) 0 ∂gaussianReal 0 1 + +/-- The density exp(-w) on the positive half-line. -/ +def exponentialLaw : Measure ℝ := expMeasure 1 + +/-- The law of the square of a standard real Gaussian. -/ +def gaussianSquareLaw : Measure ℝ := (gaussianReal 0 1).map (fun x : ℝ => x ^ 2) + +theorem main_general (μ : Measure ℝ) (hμ : MultiplierHypotheses μ) : + ¬ FiniteDimensional ℝ (productSpan μ) ∧ + ∀ N : Seminorm ℝ (productSpan μ), + IsEquivalentNorm (productSpan μ) N → ¬ IsAUC (productSpan μ) N := by + sorry + +theorem main_exponential (t : ℝ) (ht : 0 < t) : + (7 * t / 30) * excessConstant (10 / t) ≤ + averagedMidpointModulus (productSpan exponentialLaw) + (normSeminorm ℝ (productSpan exponentialLaw)) t ∧ + 0 < (7 * t / 30) * excessConstant (10 / t) := by + sorry + +theorem main_gaussian_24 (t : ℝ) (ht : 0 < t) : + gaussianTail (4 * Real.sqrt 2 * (2 + Real.sqrt 2) / t) / 8 ≤ + averagedMidpointModulus (productSpan gaussianSquareLaw) + (normSeminorm ℝ (productSpan gaussianSquareLaw)) t ∧ + 0 < gaussianTail (4 * Real.sqrt 2 * (2 + Real.sqrt 2) / t) / 8 := by + sorry + +theorem main_gaussian_12 (t : ℝ) (ht : 0 < t) : + gaussianTail (8 * Real.sqrt 6 / t) / 4 ≤ + averagedMidpointModulus (productSpan gaussianSquareLaw) + (normSeminorm ℝ (productSpan gaussianSquareLaw)) t ∧ + 0 < gaussianTail (8 * Real.sqrt 6 / t) / 4 := by + sorry + +end IndependentProducts + +end + +end OAI diff --git a/lean/ComparatorChallenges/IndependentSets.json b/lean/ComparatorChallenges/IndependentSets.json new file mode 100644 index 0000000000000000000000000000000000000000..a4a000e527ec52015fa008b95cd64542cabc78fa --- /dev/null +++ b/lean/ComparatorChallenges/IndependentSets.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.IndependentSets", + "solution_module": "OAI.Combinatorics.IndependentSets.Main", + "theorem_names": [ + "OAI.LargeIndependentSets.mainTheoremReal" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/IndependentSets.lean b/lean/ComparatorChallenges/IndependentSets.lean new file mode 100644 index 0000000000000000000000000000000000000000..abd303379190bee16aebeb850981c36ba9415b52 --- /dev/null +++ b/lean/ComparatorChallenges/IndependentSets.lean @@ -0,0 +1,84 @@ +import Mathlib + +namespace OAI + +namespace LargeIndependentSets + +structure Literal where + name : ℕ + positive : Bool + deriving DecidableEq + +structure Formula where + clauses : List (List Literal) + width : ∀ C ∈ clauses, C.length ≤ 3 + +def Formula.Satisfiable (φ : Formula) : Prop := + ∃ assignment : ℕ → Bool, ∀ C ∈ φ.clauses, + ∃ l ∈ C, assignment l.name = l.positive + +/-- Binary framing: `true,b` for a payload bit and `false` as terminator. -/ +def frame : List Bool → List Bool + | [] => [false] + | b :: bs => true :: b :: frame bs + +def nameBits (n : ℕ) : List Bool := frame n.bits + +def literalBits (l : Literal) : List Bool := l.positive :: nameBits l.name + +def clauseBits (C : List Literal) : List Bool := + nameBits C.length ++ C.flatMap literalBits + +def formulaBits (φ : Formula) : List Bool := + nameBits φ.clauses.length ++ φ.clauses.flatMap clauseBits + +/-- A nonempty, finite, simple, undirected, unweighted graph. -/ +structure Graph where + vertices : ℕ + nonempty : 0 < vertices + adj : Fin vertices → Fin vertices → Bool + symm : ∀ u v, adj u v = adj v u + loopless : ∀ u, adj u u = false + +def Graph.Independent (G : Graph) (S : Finset (Fin G.vertices)) : Prop := + ∀ u ∈ S, ∀ v ∈ S, u ≠ v → G.adj u v = false + +instance (G : Graph) (S : Finset (Fin G.vertices)) : Decidable (G.Independent S) := + inferInstanceAs (Decidable (∀ u ∈ S, ∀ v ∈ S, u ≠ v → G.adj u v = false)) + +def Graph.independenceNumber (G : Graph) : ℕ := + ((Finset.univ : Finset (Fin G.vertices)).powerset.filter G.Independent).sup Finset.card + +def Graph.ThreeColorable (G : Graph) : Prop := + ∃ color : Fin G.vertices → Fin 3, + ∀ u v, G.adj u v = true → color u ≠ color v + +/-- Full explicit adjacency matrix, row-major, with binary vertex count. -/ +def graphBits (G : Graph) : List Bool := + nameBits G.vertices ++ (List.finRange G.vertices).flatMap + (fun u => (List.finRange G.vertices).map (G.adj u)) + +open scoped Classical +noncomputable section + +/-- Polynomial-time graph reduction with a real independence-ratio threshold. -/ +structure RealGraphReduction (δ : ℝ) where + reduce : List Bool → Graph + computation : Turing.TM2ComputableInPolyTime (id : List Bool → List Bool) graphBits reduce + finiteAlphabets : ∀ k : computation.tm.K, Finite (computation.tm.Γ k) + outputBound : Polynomial ℕ + outputSize : ∀ b, (graphBits (reduce b)).length ≤ outputBound.eval b.length + completeness : ∀ φ : Formula, φ.Satisfiable → (reduce (formulaBits φ)).ThreeColorable + soundness : ∀ φ : Formula, ¬φ.Satisfiable → + ((reduce (formulaBits φ)).independenceNumber : ℝ) < + δ * (reduce (formulaBits φ)).vertices + +/-- Real-threshold graph reduction with explicit binary runtime and output-size bounds. -/ +theorem mainTheoremReal : + ∀ δ : ℝ, 0 < δ → δ < 1 / 3 → Nonempty (RealGraphReduction δ) := by + sorry + +end +end LargeIndependentSets + +end OAI diff --git a/lean/ComparatorChallenges/IndividualStrongInfiniteness.json b/lean/ComparatorChallenges/IndividualStrongInfiniteness.json new file mode 100644 index 0000000000000000000000000000000000000000..41584618da48d94522e5d60bf07998fd802e979f --- /dev/null +++ b/lean/ComparatorChallenges/IndividualStrongInfiniteness.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.IndividualStrongInfiniteness", + "solution_module": "OAI.Analysis.CStarAlgebra.PureInfiniteness.Main", + "theorem_names": [ + "OAI.MainGap.Manuscript.individual_to_strong_main" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/IndividualStrongInfiniteness.lean b/lean/ComparatorChallenges/IndividualStrongInfiniteness.lean new file mode 100644 index 0000000000000000000000000000000000000000..25c47f6ec748564ecb84b2b0676a727bd9fc5147 --- /dev/null +++ b/lean/ComparatorChallenges/IndividualStrongInfiniteness.lean @@ -0,0 +1,333 @@ +import Mathlib + +namespace OAI + +noncomputable section +open Filter +open scoped Topology CStarAlgebra ComplexOrder InnerProductSpace + +namespace MainGap +variable {A : Type*} [NonUnitalCStarAlgebra A] +local instance positivityOrder : PartialOrder A := CStarAlgebra.spectralOrder A +local instance positivityStarOrder : StarOrderedRing A := CStarAlgebra.spectralOrderedRing A + +def scalarCorner (h : A) : CStarMatrix (Fin 1) (Fin 1) A := + CStarMatrix.ofMatrix (fun _ _ => h) + +def doubleCorner (h : A) : CStarMatrix (Fin 2) (Fin 2) A := + CStarMatrix.ofMatrix (Matrix.diagonal (fun _ => h)) + +def Diagonalization (a b c : A) (ε : ℝ) : Prop := + ∃ s t : A, + ‖star s * a * s - a‖ < ε ∧ + ‖star t * b * t - b‖ < ε ∧ + ‖star s * c * t‖ < ε + +def UnrestrictedDiagonalization (A : Type*) [NonUnitalCStarAlgebra A] : Prop := + ∀ a b : A, 0 ≤ a → 0 ≤ b → ∀ c : A, ∀ ε : ℝ, 0 < ε → + Diagonalization a b c ε + +def StronglyPurelyInfinite (A : Type*) [NonUnitalCStarAlgebra A] : Prop := + ∀ x y : A, 0 ≤ x → 0 ≤ y → ∀ ε : ℝ, 0 < ε → + Diagonalization (x * x) (y * y) (x * y) ε + +end MainGap + +noncomputable section +open Filter +open scoped Topology +namespace MainGap.Stable +variable {A : Type*} [NonUnitalCStarAlgebra A] +local instance positivityOrder : PartialOrder A := CStarAlgebra.spectralOrder A +local instance positivityStarOrder : StarOrderedRing A := CStarAlgebra.spectralOrderedRing A + +abbrev Mat (A : Type*) (n : ℕ) := CStarMatrix (Fin n) (Fin n) A + +def pad {n m : ℕ} (_ : n ≤ m) (x : Mat A n) : Mat A m := + CStarMatrix.ofMatrix fun i j => + if hi : i.val < n then if hj : j.val < n then x ⟨i,hi⟩ ⟨j,hj⟩ else 0 else 0 + +@[simp] lemma pad_entry {n m : ℕ} (h : n ≤ m) (x : Mat A n) (i j : Fin m) : + pad h x i j = (if hi : i.val < n then if hj : j.val < n then x ⟨i,hi⟩ ⟨j,hj⟩ else 0 else 0) := rfl + +@[simp] lemma pad_apply {n m : ℕ} (h : n ≤ m) (x : Mat A n) (i j : Fin n) : + pad h x (Fin.castLE h i) (Fin.castLE h j) = x i j := by simp [pad_entry] + +lemma sum_pad {n m : ℕ} (h : n ≤ m) {B : Type*} [AddCommMonoid B] (f : Fin n → B) : + ∑ k : Fin m, (if hk : k.val < n then f ⟨k,hk⟩ else 0) = ∑ k : Fin n, f k := by + classical + symm + apply Finset.sum_bij_ne_zero (fun i _ _ => Fin.castLE h i) + · simp + · intro i _ _ j _ _ hij + exact Fin.ext (congrArg (fun k : Fin m => k.val) hij) + · intro j _ hj0 + have hj : j.val < n := by + by_contra hn + simp [hn] at hj0 + exact ⟨⟨j,hj⟩, Finset.mem_univ _, by simpa [hj] using hj0, rfl⟩ + · intro i _ _ + simp + +lemma pad_mul {n m : ℕ} (h : n ≤ m) (x y : Mat A n) : + pad h (x*y) = pad h x * pad h y := by + ext i j + by_cases hi : i.val < n <;> by_cases hj : j.val < n + · simp only [pad_entry, dite_eq_left hi, dite_eq_left hj, + CStarMatrix.mul_apply] + rw [← sum_pad h (fun k => x ⟨i,hi⟩ k * y k ⟨j,hj⟩)] + apply Finset.sum_congr rfl + intro k _ + by_cases hk : k.val < n <;> simp [hk] + · simp [pad_entry, hi, hj, CStarMatrix.mul_apply] + · simp [pad_entry, hi, CStarMatrix.mul_apply] + · simp [pad_entry, hi, CStarMatrix.mul_apply] + +def padHom {n m : ℕ} (h : n ≤ m) : Mat A n →⋆ₙₐ[ℂ] Mat A m where + toFun := pad h + map_zero' := by ext i j; simp [pad_entry] + map_add' x y := by ext i j; by_cases hi : i.val < n <;> by_cases hj : j.val < n <;> simp [pad_entry, hi, hj] + map_mul' := pad_mul h + map_smul' c x := by ext i j; by_cases hi : i.val < n <;> by_cases hj : j.val < n <;> simp [pad_entry, hi, hj] + map_star' x := by ext i j; by_cases hi : i.val < n <;> by_cases hj : j.val < n <;> simp [pad_entry, hi, hj, CStarMatrix.star_apply] + +lemma pad_injective {n m : ℕ} (h : n ≤ m) : Function.Injective (pad (A := A) h) := by + intro x y hxy + ext i j + have hh := congrArg (fun z : Mat A m => z (Fin.castLE h i) (Fin.castLE h j)) hxy + simpa using hh + +lemma norm_pad {n m : ℕ} (h : n ≤ m) (x : Mat A n) : ‖pad h x‖ = ‖x‖ := + NonUnitalStarAlgHom.norm_map (padHom h) (pad_injective h) x + +lemma pad_self (n : ℕ) (x : Mat A n) : pad le_rfl x = x := by + ext i j + simp [pad_entry] + +lemma pad_pad {n m k : ℕ} (h : n ≤ m) (h' : m ≤ k) (x : Mat A n) : + pad h' (pad h x) = pad (h.trans h') x := by + ext i j + by_cases hi : i.val < n <;> by_cases hj : j.val < n + · have hi' : i.val < m := lt_of_lt_of_le hi h + have hj' : j.val < m := lt_of_lt_of_le hj h + simp [pad_entry, hi, hj, hi', hj'] + · by_cases hi' : i.val < m <;> by_cases hj' : j.val < m <;> simp [pad_entry, hi, hj, hi', hj'] + · by_cases hi' : i.val < m <;> by_cases hj' : j.val < m <;> simp [pad_entry, hi, hi', hj'] + · by_cases hi' : i.val < m <;> by_cases hj' : j.val < m <;> simp [pad_entry, hi, hi', hj'] + +instance pad_directedSystem : DirectedSystem (Mat A) (fun _ _ h => padHom h) where + map_self := fun {_} x => pad_self _ x + map_map := fun {_ _ _} h h' x => pad_pad h h' x + +abbrev Algebraic (A : Type*) [NonUnitalCStarAlgebra A] := + DirectLimit (Mat A) (fun _ _ h => padHom h) + +local instance matLinear (n m : ℕ) : + LinearMapClass (Mat A n →⋆ₙₐ[ℂ] Mat A m) ℂ (Mat A n) (Mat A m) where + map_add f x y := f.map_add x y + map_smulₛₗ f c x := f.map_smul c x + +instance : Module ℂ (Algebraic A) := DirectLimit.instModule + +instance : Norm (Algebraic A) where + norm := DirectLimit.lift _ (fun _ x => ‖x‖) (fun _ _ h x => (norm_pad h x).symm) + +@[simp] lemma norm_mk (n : ℕ) (x : Mat A n) : + ‖(⟦⟨n,x⟩⟧ : Algebraic A)‖ = ‖x‖ := rfl + +lemma normedCore : NormedSpace.Core ℂ (Algebraic A) where + norm_nonneg := DirectLimit.induction _ fun n x => norm_nonneg x + norm_smul c := DirectLimit.induction _ fun n x => by + rw [DirectLimit.smul_def, norm_mk, norm_mk, norm_smul] + norm_triangle := DirectLimit.induction₂ _ fun n x y => by + rw [DirectLimit.add_def, norm_mk, norm_mk, norm_mk] + exact norm_add_le x y + norm_eq_zero_iff := DirectLimit.induction _ fun n x => by + rw [norm_mk, norm_eq_zero] + constructor + · rintro rfl + exact (DirectLimit.zero_def (f := fun _ _ h => padHom (A := A) h) n).symm + · intro h + apply pad_injective (le_rfl : n ≤ n) + have hi := DirectLimit.mk_injective (fun _ _ h => padHom (A := A) h) (fun _ _ h => pad_injective h) n + exact congrArg (pad le_rfl) (hi (h.trans (DirectLimit.zero_def (f := fun _ _ h => padHom (A := A) h) n))) + +instance : NormedAddCommGroup (Algebraic A) := .ofCore (𝕜 := ℂ) (normedCore (A := A)) +instance : NormedSpace ℂ (Algebraic A) := .ofCore (normedCore (A := A)) +instance : NonUnitalNormedRing (Algebraic A) where + dist_eq _ _ := rfl + norm_mul_le := DirectLimit.induction₂ _ fun n x y => by + rw [DirectLimit.mul_def, norm_mk, norm_mk, norm_mk] + exact norm_mul_le x y +instance : CStarRing (Algebraic A) where + norm_mul_self_le := DirectLimit.induction _ fun n x => by + rw [DirectLimit.star_def, DirectLimit.mul_def, norm_mk, norm_mk] + exact CStarRing.norm_mul_self_le x + +def cornerAlg (n : ℕ) : Mat A n →⋆ₙₐ[ℂ] Algebraic A where + __ := DirectLimit.NonUnitalAlgebra.of (Mat A) (fun _ _ h => padHom h) n + map_star' _ := rfl + +@[simp] lemma cornerAlg_apply (n : ℕ) (x : Mat A n) : + cornerAlg n x = (⟦⟨n,x⟩⟧ : Algebraic A) := rfl + +lemma cornerAlg_isometry (n : ℕ) : Isometry (cornerAlg (A := A) n) := + AddMonoidHomClass.isometry_of_norm (cornerAlg n) (fun _ => rfl) + +abbrev Stabilization (A : Type*) [NonUnitalCStarAlgebra A] := UniformSpace.Completion (Algebraic A) + +local instance algebraicTopology : TopologicalSpace (Algebraic A) := + (inferInstance : PseudoMetricSpace (Algebraic A)).toUniformSpace.toTopologicalSpace + +open UniformSpace +open UniformSpace.Completion + +instance : Mul (Stabilization A) := + ⟨Function.curry <| (isDenseInducing_coe.prodMap isDenseInducing_coe).extend + ((↑) ∘ Function.uncurry (· * · : Algebraic A → Algebraic A → Algebraic A))⟩ + +@[simp, norm_cast] lemma coe_mul_stable (x y : Algebraic A) : + ((x*y : Algebraic A) : Stabilization A) = (x : Stabilization A) * (y : Stabilization A) := + ((isDenseInducing_coe.prodMap isDenseInducing_coe).extend_eq + ((continuous_coe _).comp continuous_mul) (x,y)).symm + +instance : ContinuousMul (Stabilization A) where + continuous_mul := by + let m := (AddMonoidHom.mul : Algebraic A →+ Algebraic A →+ Algebraic A).compr₂ toCompl + have hh : Continuous fun p : Algebraic A × Algebraic A => m p.1 p.2 := + (continuous_coe _).comp continuous_mul + have di : IsDenseInducing (toCompl : Algebraic A → Stabilization A) := isDenseInducing_coe + exact di.extend_Z_bilin di hh + +instance : NonUnitalRing (Stabilization A) where + __ : AddCommGroup (Stabilization A) := inferInstance + zero_mul x := Completion.induction_on x (isClosed_eq (by fun_prop) continuous_const) + fun x => by rw [← coe_zero, ← coe_mul_stable, zero_mul] + mul_zero x := Completion.induction_on x (isClosed_eq (by fun_prop) continuous_const) + fun x => by rw [← coe_zero, ← coe_mul_stable, mul_zero] + mul_assoc x y z := Completion.induction_on₃ x y z + (isClosed_eq (by fun_prop) (by fun_prop)) fun x y z => by + rw [← coe_mul_stable, ← coe_mul_stable, ← coe_mul_stable, ← coe_mul_stable, mul_assoc] + left_distrib x y z := Completion.induction_on₃ x y z + (isClosed_eq (by fun_prop) (by fun_prop)) fun x y z => by + rw [← coe_add, ← coe_mul_stable, ← coe_mul_stable, ← coe_mul_stable, ← coe_add, mul_add] + right_distrib x y z := Completion.induction_on₃ x y z + (isClosed_eq (by fun_prop) (by fun_prop)) fun x y z => by + rw [← coe_add, ← coe_mul_stable, ← coe_mul_stable, ← coe_mul_stable, ← coe_add, add_mul] + +instance : NonUnitalNormedRing (Stabilization A) where + dist_eq := dist_eq_norm_neg_add + norm_mul_le x y := Completion.induction_on₂ x y + (isClosed_le (by fun_prop) (by fun_prop)) fun x y => by + simpa only [← coe_mul_stable, norm_coe] using norm_mul_le x y + +instance : Star (Stabilization A) := ⟨Completion.map (star : Algebraic A → Algebraic A)⟩ + +@[simp, norm_cast] lemma coe_star_stable (x : Algebraic A) : + ((star x : Algebraic A) : Stabilization A) = star (x : Stabilization A) := + (Completion.map_coe star_isometry.uniformContinuous x).symm + +instance : ContinuousStar (Stabilization A) where + continuous_star := Completion.continuous_map + +instance : StarRing (Stabilization A) where + star_involutive x := Completion.induction_on x + (isClosed_eq (by fun_prop) continuous_id) fun x => by + rw [← coe_star_stable, ← coe_star_stable, star_star] + star_add x y := Completion.induction_on₂ x y + (isClosed_eq (by fun_prop) (by fun_prop)) fun x y => by + rw [← coe_add, ← coe_star_stable, ← coe_star_stable, ← coe_star_stable, ← coe_add, star_add] + star_mul x y := Completion.induction_on₂ x y + (isClosed_eq (by fun_prop) (by fun_prop)) fun x y => by + rw [← coe_mul_stable, ← coe_star_stable, ← coe_star_stable, ← coe_star_stable, + ← coe_mul_stable, star_mul] + +instance : CStarRing (Stabilization A) where + norm_mul_self_le x := Completion.induction_on x + (isClosed_le (by fun_prop) (by fun_prop)) fun x => by + simpa only [← coe_star_stable, ← coe_mul_stable, norm_coe] using CStarRing.norm_mul_self_le x + +instance : IsScalarTower ℂ (Stabilization A) (Stabilization A) where + smul_assoc c x y := by + change (c • x) * y = c • (x*y) + refine Completion.induction_on₂ x y ?_ ?_ + · exact isClosed_eq ((continuous_fst.const_smul c).mul continuous_snd) + ((continuous_fst.mul continuous_snd).const_smul c) + · intro x y + rw [← coe_smul, ← coe_mul_stable, ← coe_mul_stable, ← coe_smul, smul_mul_assoc] + +instance : SMulCommClass ℂ (Stabilization A) (Stabilization A) where + smul_comm c x y := by + change c • (x*y) = x * (c • y) + refine Completion.induction_on₂ x y ?_ ?_ + · exact isClosed_eq ((continuous_fst.mul continuous_snd).const_smul c) + (continuous_fst.mul (continuous_snd.const_smul c)) + · intro x y + rw [← coe_mul_stable, ← coe_smul, ← coe_smul, ← coe_mul_stable, mul_smul_comm] + +instance : StarModule ℂ (Stabilization A) where + star_smul c x := by + refine Completion.induction_on x ?_ ?_ + · exact isClosed_eq (continuous_star.comp (continuous_const_smul c)) + (continuous_star.const_smul (star c)) + · intro x + rw [← coe_smul, ← coe_star_stable, ← coe_star_stable, ← coe_smul, star_smul] + +@[instance_reducible] def stabilizationCStarAlgebra : NonUnitalCStarAlgebra (Stabilization A) where + +def corner (n : ℕ) : Mat A n →⋆ₙₐ[ℂ] Stabilization A where + toFun x := (cornerAlg n x : Stabilization A) + map_zero' := by rw [map_zero, coe_zero] + map_add' x y := by simp [map_add, coe_add] + map_mul' x y := by simp [map_mul] + map_smul' c x := by simp [map_smul, coe_smul] + map_star' x := by simp [map_star] + +@[simp] lemma corner_apply (n : ℕ) (x : Mat A n) : + corner n x = (cornerAlg n x : Stabilization A) := rfl + +lemma norm_corner (n : ℕ) (x : Mat A n) : ‖corner n x‖ = ‖x‖ := by + rw [corner_apply, norm_coe, cornerAlg_apply, norm_mk] + +lemma corner_isometry (n : ℕ) : Isometry (corner (A := A) n) := + AddMonoidHomClass.isometry_of_norm (corner n) (norm_corner n) + +lemma corner_pad {n m : ℕ} (h : n ≤ m) (x : Mat A n) : + corner m (pad h x) = corner n x := by + change ((⟦⟨m,padHom h x⟩⟧ : Algebraic A) : Stabilization A) = + ((⟦⟨n,x⟩⟧ : Algebraic A) : Stabilization A) + rw [DirectLimit.mk_apply] + +end MainGap.Stable + +namespace MainGap.Manuscript +variable {A : Type*} [NonUnitalCStarAlgebra A] +local instance positivityOrder : PartialOrder A := CStarAlgebra.spectralOrder A +local instance positivityStarOrder : StarOrderedRing A := CStarAlgebra.spectralOrderedRing A + +def CuntzLE (d v : Stable.Stabilization A) : Prop := + ∃ r : ℕ → Stable.Stabilization A, + Tendsto (fun j => star (r j) * v * r j) atTop (𝓝 d) + +def ProperlyInfinite (h : A) : Prop := + CuntzLE ((⟦⟨2, MainGap.doubleCorner h⟩⟧ : Stable.Algebraic A) : Stable.Stabilization A) + ((⟦⟨1, MainGap.scalarCorner h⟩⟧ : Stable.Algebraic A) : Stable.Stabilization A) + +def PropertyP (A : Type*) [NonUnitalCStarAlgebra A] : Prop := + ∀ h : A, 0 ≤ h → ProperlyInfinite h + +theorem individual_to_strong_main (hP : PropertyP A) : + (∀ a b : A, 0 ≤ a → 0 ≤ b → ∀ c : A, ∀ ε : ℝ, 0 < ε → + ∃ s t : A, + ‖star s * a * s - a‖ < ε ∧ + ‖star t * b * t - b‖ < ε ∧ + ‖star s * c * t‖ < ε) ∧ + MainGap.StronglyPurelyInfinite A := by + sorry + +end MainGap.Manuscript + +end +end + +end OAI diff --git a/lean/ComparatorChallenges/InfiniteMatroid.json b/lean/ComparatorChallenges/InfiniteMatroid.json new file mode 100644 index 0000000000000000000000000000000000000000..f5c41097f552dcaf3d189fdadc2fb17df3f8b90e --- /dev/null +++ b/lean/ComparatorChallenges/InfiniteMatroid.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.InfiniteMatroid", + "solution_module": "OAI.Combinatorics.InfiniteMatroid.Main", + "theorem_names": [ + "OAI.InfiniteMatroidCounterexample.main" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/InfiniteMatroid.lean b/lean/ComparatorChallenges/InfiniteMatroid.lean new file mode 100644 index 0000000000000000000000000000000000000000..f9253fd9949297356bc99360d3ffa54a88b944f3 --- /dev/null +++ b/lean/ComparatorChallenges/InfiniteMatroid.lean @@ -0,0 +1,34 @@ +import Mathlib + +namespace OAI + +namespace InfiniteMatroidCounterexample +open Matroid + +abbrev D := (m : ℕ) × ((Fin m → Bool) → Bool) +abbrev E := ℤ × D + +def contractOnto {α : Type*} (M : Matroid α) (C : Set α) : Matroid α := + (M.dual ↾ C).dual + +def HasPackingCovering {α : Type*} (M₀ M₁ : Matroid α) : Prop := + ∃ P C S₀ S₁ I₀ I₁ : Set α, + Disjoint P C ∧ P ∪ C = M₀.E ∧ M₁.E = M₀.E ∧ + S₀ ⊆ P ∧ S₁ ⊆ P ∧ Disjoint S₀ S₁ ∧ + (M₀ ↾ P).Spanning S₀ ∧ (M₁ ↾ P).Spanning S₁ ∧ + I₀ ⊆ C ∧ I₁ ⊆ C ∧ + (contractOnto M₀ C).Indep I₀ ∧ + (contractOnto M₁ C).Indep I₁ ∧ I₀ ∪ I₁ = C + +theorem main : + Countable E ∧ Infinite E ∧ + ∃ M₀ M₁ : Matroid E, + M₀.E = Set.univ ∧ M₁.E = Set.univ ∧ + M₀.dual = M₀ ∧ M₁.dual = M₁ ∧ + (∀ I₀ I₁ : Set E, M₀.Indep I₀ → M₁.Indep I₁ → I₀ ∪ I₁ ≠ Set.univ) ∧ + ¬ HasPackingCovering M₀ M₁ := by + sorry + +end InfiniteMatroidCounterexample + +end OAI diff --git a/lean/ComparatorChallenges/InfiniteMatroidCorollaries.json b/lean/ComparatorChallenges/InfiniteMatroidCorollaries.json new file mode 100644 index 0000000000000000000000000000000000000000..422b714b1b6addcdcd55691aba37887247bd60fa --- /dev/null +++ b/lean/ComparatorChallenges/InfiniteMatroidCorollaries.json @@ -0,0 +1,15 @@ +{ + "challenge_module": "ComparatorChallenges.InfiniteMatroidCorollaries", + "solution_module": "OAI.Combinatorics.InfiniteMatroid.Corollaries", + "theorem_names": [ + "OAI.InfiniteMatroidCounterexample.partitional_intersection_counterexample", + "OAI.InfiniteMatroidCounterexample.separate_covering_packing_counterexamples" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Classical.choice", + "Quot.sound" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/InfiniteMatroidCorollaries.lean b/lean/ComparatorChallenges/InfiniteMatroidCorollaries.lean new file mode 100644 index 0000000000000000000000000000000000000000..31b5edd2923687af9c9a8936d270ce1d126355f8 --- /dev/null +++ b/lean/ComparatorChallenges/InfiniteMatroidCorollaries.lean @@ -0,0 +1,128 @@ +import Mathlib + +namespace OAI + +namespace InfiniteMatroidCounterexample +open Set Matroid + +abbrev D := (m : ℕ) × ((Fin m → Bool) → Bool) +abbrev E0 := D × Bool +abbrev E := ℤ × D + +def contractOnto {α : Type*} (M : Matroid α) (C : Set α) : Matroid α := + (M.dual ↾ C).dual + +def HasPackingCovering {α : Type*} (M₀ M₁ : Matroid α) : Prop := + ∃ P C S₀ S₁ I₀ I₁ : Set α, + Disjoint P C ∧ P ∪ C = M₀.E ∧ M₁.E = M₀.E ∧ + S₀ ⊆ P ∧ S₁ ⊆ P ∧ Disjoint S₀ S₁ ∧ + (M₀ ↾ P).Spanning S₀ ∧ (M₁ ↾ P).Spanning S₁ ∧ + I₀ ⊆ C ∧ I₁ ⊆ C ∧ + (contractOnto M₀ C).Indep I₀ ∧ + (contractOnto M₁ C).Indep I₁ ∧ I₀ ∪ I₁ = C + +def bundleAt (n : ℤ) (b : Bool) : ℤ := + if n < 0 then (if b then n - 1 else n) else (if b then n else n - 1) + +def parityBit (p : Bool) : ℤ := if p then 1 else 0 +abbrev Vertex (p : Bool) := {n : ℤ // n % 2 = parityBit p} + +def componentMap {α : Type*} {p : Bool} (v : Vertex p) (x : α × Bool) : ℤ × α := + (bundleAt v x.2,x.1) + +def globalComponentMap (α : Type*) (p : Bool) (x : Vertex p × (α × Bool)) : ℤ × α := + componentMap x.1 x.2 + +noncomputable def componentEquiv (α : Type*) (p : Bool) : (Vertex p × (α × Bool)) ≃ (ℤ × α) := + Equiv.ofBijective (globalComponentMap α p) (by + have bundleAt_bounds (n : ℤ) (b : Bool) : n - 1 ≤ bundleAt n b ∧ bundleAt n b ≤ n := by + unfold bundleAt + split_ifs <;> omega + have bundleAt_injective (n : ℤ) : Function.Injective (bundleAt n) := by + intro b c h + cases b <;> cases c <;> simp_all [bundleAt] <;> split_ifs at h <;> omega + have bundleAt_right (n : ℤ) : ∃ b, bundleAt n b = n := by + by_cases h : n < 0 + · exact ⟨false,by simp [bundleAt,h]⟩ + · exact ⟨true,by simp [bundleAt,h]⟩ + have bundleAt_left (n : ℤ) : ∃ b, bundleAt n b = n - 1 := by + by_cases h : n < 0 + · exact ⟨true,by simp [bundleAt,h]⟩ + · exact ⟨false,by simp [bundleAt,h]⟩ + + have globalComponentMap_injective : + Function.Injective (globalComponentMap α p) := by + rintro ⟨⟨n,hn⟩,d,b⟩ ⟨⟨m,hm⟩,e,c⟩ h + have hnm : bundleAt n b = bundleAt m c := congrArg Prod.fst h + have hde : d = e := congrArg Prod.snd h + have hb := bundleAt_bounds n b + have hc := bundleAt_bounds m c + have hnm' : n = m := by omega + subst m + have hbc := bundleAt_injective n hnm + subst e; subst c + rfl + + have globalComponentMap_surjective : + Function.Surjective (globalComponentMap α p) := by + rintro ⟨n,d⟩ + by_cases hn : n % 2 = parityBit p + · obtain ⟨b,hb⟩ := bundleAt_right n + exact ⟨(⟨n,hn⟩,d,b),by simp [globalComponentMap,componentMap,hb]⟩ + · have hn' : (n+1) % 2 = parityBit p := by + cases p <;> simp only [parityBit,Bool.false_eq_true,ite_false,ite_true] at hn ⊢ <;> omega + obtain ⟨b,hb⟩ := bundleAt_left (n+1) + exact ⟨(⟨n+1,hn'⟩,d,b),by simp [globalComponentMap,componentMap,hb]⟩ + exact ⟨globalComponentMap_injective, globalComponentMap_surjective⟩) + +noncomputable def rayMatroid {α : Type*} (Q : Matroid (α × Bool)) (p : Bool) : Matroid (ℤ × α) := + (Matroid.sum' (fun _ : Vertex p ↦ Q)).mapEquiv (componentEquiv α p) + +def IsUniform {α : Type*} (M : Matroid α) : Prop := + ∀ X ⊆ M.E, M.Indep X ∨ M.Spanning X + +def IsPartitional {α : Type} (M : Matroid α) : Prop := + ∃ (ι : Type) (β : ι → Type) (N : ∀ i, Matroid (β i)) (e : (Σ i, β i) ≃ α), + (∀ i, IsUniform (N i)) ∧ M = (Matroid.sigma N).mapEquiv e + +def HasIntersection {α : Type*} (M N : Matroid α) : Prop := + ∃ J J₀ J₁ : Set α, M.Indep J ∧ N.Indep J ∧ + Disjoint J₀ J₁ ∧ J₀ ∪ J₁ = J ∧ M.closure J₀ ∪ N.closure J₁ = M.E + +def FamilyCovering {α ι : Type*} (F : Set α) (M : ι → Matroid α) : Prop := + ∃ I : ι → Set α, (∀ i, (M i).Indep (I i)) ∧ (⋃ i, I i) = F + +def FamilyPacking {α ι : Type*} (M : ι → Matroid α) : Prop := + ∃ S : ι → Set α, (Pairwise fun i j ↦ Disjoint (S i) (S j)) ∧ + ∀ i, (M i).Spanning (S i) + +def CoveringConjectureFor {α ι : Type*} (F : Set α) (M : ι → Matroid α) : Prop := + FamilyCovering F M ↔ ∀ Y ⊆ F, + FamilyPacking (fun i ↦ M i ↾ Y) → FamilyCovering Y (fun i ↦ M i ↾ Y) + +def PackingConjectureFor {α ι : Type*} (F : Set α) (M : ι → Matroid α) : Prop := + FamilyPacking M ↔ ∀ Y ⊆ F, + FamilyCovering Y (fun i ↦ contractOnto (M i) Y) → + FamilyPacking (fun i ↦ contractOnto (M i) Y) + +theorem partitional_intersection_counterexample : + Countable E ∧ Infinite E ∧ + ∃ Q : Matroid E0, Q.E = univ ∧ Q.dual = Q ∧ IsUniform Q ∧ + let M₀ := rayMatroid Q false + let M₁ := rayMatroid Q true + M₀.E = univ ∧ M₁.E = univ ∧ M₀.dual = M₀ ∧ M₁.dual = M₁ ∧ + IsPartitional M₀ ∧ IsPartitional M₁ ∧ + (∀ I₀ I₁ : Set E, M₀.Indep I₀ → M₁.Indep I₁ → I₀ ∪ I₁ ≠ univ) ∧ + ¬ HasPackingCovering M₀ M₁ ∧ ¬ HasIntersection M₀ M₁ := by + sorry + +theorem separate_covering_packing_counterexamples : + (∃ (F : Set E) (M : Bool → Matroid E), + (∀ i, (M i).E = F) ∧ ¬ CoveringConjectureFor F M) ∧ + (∃ (F : Set E) (M : Bool → Matroid E), + (∀ i, (M i).E = F) ∧ ¬ PackingConjectureFor F M) := by + sorry + +end InfiniteMatroidCounterexample + +end OAI diff --git a/lean/ComparatorChallenges/InterpolatedFactors.json b/lean/ComparatorChallenges/InterpolatedFactors.json new file mode 100644 index 0000000000000000000000000000000000000000..56a3a52aaac9a701caed2d22797140d298238d2a --- /dev/null +++ b/lean/ComparatorChallenges/InterpolatedFactors.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.InterpolatedFactors", + "solution_module": "OAI.Analysis.InterpolatedFactors.Interpolation", + "theorem_names": [ + "OAI.FreeGroupFactorMain.Interpolation.allInterpolatedIsomorphic" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/InterpolatedFactors.lean b/lean/ComparatorChallenges/InterpolatedFactors.lean new file mode 100644 index 0000000000000000000000000000000000000000..0075fd568149594df4dc90ff7228d86b12b97381 --- /dev/null +++ b/lean/ComparatorChallenges/InterpolatedFactors.lean @@ -0,0 +1,225 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace FreeGroupFactorMain + +universe u uG + +open scoped ENNReal + +abbrev GroupHilbert (G : Type u) := lp (fun _ : G => ℂ) 2 +abbrev GroupOperator (G : Type u) := GroupHilbert G →L[ℂ] GroupHilbert G + +def leftTranslations (G : Type u) [Group G] : Set (GroupOperator G) := + {T | ∃ g : G, ∀ (ξ : GroupHilbert G) (h : G), (T ξ) h = ξ (g⁻¹ * h)} + +def groupVonNeumann (G : Type u) [Group G] : StarSubalgebra ℂ (GroupOperator G) := + StarSubalgebra.centralizer ℂ + (StarSubalgebra.centralizer ℂ (leftTranslations G) : Set (GroupOperator G)) + +def canonicalTrace {G : Type u} [Group G] (T : groupVonNeumann G) : ℂ := by + classical + exact ((T : GroupOperator G) (lp.single 2 (1 : G) (1 : ℂ))) 1 + +@[instance_reducible] def ultraweakOperatorTopology (G : Type u) : TopologicalSpace (GroupOperator G) := + ⨅ (ξ : lp (fun _ : ℕ => GroupHilbert G) 2) + (η : lp (fun _ : ℕ => GroupHilbert G) 2), + TopologicalSpace.induced + (fun T : GroupOperator G => ∑' k : ℕ, inner ℂ (η k) (T (ξ k))) + inferInstance + +@[instance_reducible] def groupUltraweakTopology (G : Type u) [Group G] : + TopologicalSpace (groupVonNeumann G) := + TopologicalSpace.induced (fun T : groupVonNeumann G => (T : GroupOperator G)) + (ultraweakOperatorTopology G) + +abbrev FreeGroupRank (n : ℕ) := FreeGroup (Fin n) + +instance groupVN_isClosed (G : Type uG) [Group G] : + IsClosed (groupVonNeumann G : Set (GroupOperator G)) := by + unfold groupVonNeumann + rw [StarSubalgebra.coe_centralizer] + exact Set.isClosed_centralizer _ + +instance groupVN_CStarAlgebra (G : Type uG) [Group G] : + CStarAlgebra (groupVonNeumann G) := inferInstance + +end FreeGroupFactorMain + +universe u_1 u_2 u_3 u_4 u_5 u_6 u_7 u_8 u_9 u_10 u_11 u_42 u_43 + +namespace FreeGroupFactorMain.Amplification + +open scoped ENNReal + +section +variable {A : Type u_1} {B : Type u_2} [CStarAlgebra A] [CStarAlgebra B] + +def cornerSubalgebra (p : A) (hp : IsStarProjection p) : NonUnitalStarSubalgebra ℂ A where + carrier := {x | p*x=x ∧ x*p=x} + zero_mem' := by simp + add_mem' hx hy := by constructor <;> simp [mul_add,add_mul,hx.1,hx.2,hy.1,hy.2] + mul_mem' hx hy := by + constructor + · rw [← mul_assoc,hx.1] + · rw [mul_assoc,hy.2] + smul_mem' c x hx := by + constructor + · rw [mul_smul_comm,hx.1] + · rw [smul_mul_assoc,hx.2] + star_mem' hx := by + constructor + · simpa only [star_mul,hp.isSelfAdjoint.star_eq] using congrArg star hx.2 + · simpa only [star_mul,hp.isSelfAdjoint.star_eq] using congrArg star hx.1 + +abbrev Corner (p : A) (hp : IsStarProjection p) := ↥(cornerSubalgebra p hp) + +instance cornerClosed (p : A) (hp : IsStarProjection p) : + IsClosed (cornerSubalgebra p hp : Set A) := + (isClosed_eq (continuous_const.mul continuous_id) continuous_id).inter + (isClosed_eq (continuous_id.mul continuous_const) continuous_id) + +instance cornerSemiring (p : A) (hp : IsStarProjection p) : Semiring (Corner p hp) where + __ : NonUnitalSemiring (Corner p hp) := inferInstance + one := ⟨p,hp.isIdempotentElem.eq,hp.isIdempotentElem.eq⟩ + one_mul x := Subtype.ext x.property.1 + mul_one x := Subtype.ext x.property.2 + +instance cornerRing (p : A) (hp : IsStarProjection p) : Ring (Corner p hp) where + __ : Semiring (Corner p hp) := inferInstance + __ : NonUnitalRing (Corner p hp) := inferInstance + +instance cornerAlgebra (p : A) (hp : IsStarProjection p) : Algebra ℂ (Corner p hp) := + Algebra.ofModule smul_mul_assoc mul_smul_comm + +instance cornerNormedRing (p : A) (hp : IsStarProjection p) : NormedRing (Corner p hp) where + __ : Ring (Corner p hp) := inferInstance + __ : NonUnitalNormedRing (Corner p hp) := inferInstance + +instance cornerCStarAlgebra (p : A) (hp : IsStarProjection p) : CStarAlgebra (Corner p hp) where + __ : NonUnitalCStarAlgebra (Corner p hp) := inferInstance + __ : NormedRing (Corner p hp) := inferInstance + __ : Algebra ℂ (Corner p hp) := inferInstance + norm_smul_le := norm_smul_le + +end + +section +variable {A : Type u_3} {B : Type u_4} [CStarAlgebra A] [CStarAlgebra B] + +@[instance_reducible] def cornerTopology (𝒯 : TopologicalSpace A) + (p : A) (hp : IsStarProjection p) : TopologicalSpace (Corner p hp) := + TopologicalSpace.induced (fun x : Corner p hp => (x : A)) 𝒯 + +def normalizedCornerTrace (τ : A → ℂ) (t : ℝ) (p : A) (hp : IsStarProjection p) + (x : Corner p hp) : ℂ := (t : ℂ)⁻¹ * τ x + +end + +def stabilizedRightTranslations (G : Type u_5) [Group G] : Set (GroupOperator (ℕ × G)) := + {T | ∃ g : G, ∀ (ξ : GroupHilbert (ℕ × G)) (x : ℕ × G), + T ξ x = ξ (x.1,x.2*g)} + +def stabilization (G : Type u_6) [Group G] : StarSubalgebra ℂ (GroupOperator (ℕ × G)) := + StarSubalgebra.centralizer ℂ (stabilizedRightTranslations G) + +instance stabilization_isClosed (G : Type u_7) [Group G] : + IsClosed (stabilization G : Set (GroupOperator (ℕ × G))) := by + rw [stabilization,StarSubalgebra.coe_centralizer] + exact Set.isClosed_centralizer _ + +instance stabilization_CStarAlgebra (G : Type u_8) [Group G] : CStarAlgebra (stabilization G) := + inferInstance + +def stabilizedProjectionTrace {G : Type u_9} [Group G] (p : stabilization G) : ℝ≥0∞ := by + classical + exact ∑' k : ℕ, ENNReal.ofReal (‖(p : GroupOperator (ℕ × G)) + (lp.single 2 (k,1) (1 : ℂ))‖ ^ 2) + +def stabilizedTrace {G : Type u_10} [Group G] (T : stabilization G) : ℂ := by + classical + exact ∑' k : ℕ, inner ℂ (lp.single 2 (k,1) (1 : ℂ)) + ((T : GroupOperator (ℕ × G)) (lp.single 2 (k,1) (1 : ℂ))) + +@[instance_reducible] def stabilizationTopology (G : Type u_11) [Group G] : + TopologicalSpace (stabilization G) := + TopologicalSpace.induced (fun T : stabilization G => (T : GroupOperator (ℕ × G))) + (ultraweakOperatorTopology (ℕ × G)) + +section +variable {A : Type u_42} {B : Type u_43} [CStarAlgebra A] [CStarAlgebra B] + +structure NormalTracialEquiv (τA : A → ℂ) (τB : B → ℂ) + (𝒯A : TopologicalSpace A) (𝒯B : TopologicalSpace B) where + equiv : A ≃⋆ₐ[ℂ] B + trace_eq : ∀x,τB (equiv x)=τA x + normal : @Continuous _ _ 𝒯A 𝒯B equiv + inverse_normal : @Continuous _ _ 𝒯B 𝒯A equiv.symm + +end + +end FreeGroupFactorMain.Amplification + +namespace FreeGroupFactorMain.Interpolation + +open Amplification +open scoped ENNReal + +abbrev RankTwoProjection := {p : stabilization (FreeGroupRank 2) // IsStarProjection p} + +instance rankTwoProjectionInhabited : Inhabited RankTwoProjection := + ⟨⟨0,IsStarProjection.zero _⟩⟩ + +def selectedProjection (a : ℝ) : RankTwoProjection := + Classical.epsilon (fun p : RankTwoProjection => stabilizedProjectionTrace p.val=ENNReal.ofReal a) + +def interpolationScale (r : ℝ) : ℝ := (Real.sqrt (r-1))⁻¹ + +inductive Model where + | integer (n : ℕ) + | continuous (r : ℝ) + | infinity + +def Model.Algebra : Model → Type + | .integer n => groupVonNeumann (FreeGroupRank n) + | .continuous r => Corner (selectedProjection (interpolationScale r)).val + (selectedProjection (interpolationScale r)).property + | .infinity => groupVonNeumann (FreeGroup ℕ) + +instance modelCStarAlgebra (m : Model) : CStarAlgebra m.Algebra := by + cases m <;> dsimp only [Model.Algebra] <;> infer_instance + +def Model.trace : (m : Model) → m.Algebra → ℂ + | .integer _ => canonicalTrace + | .continuous r => normalizedCornerTrace stabilizedTrace (interpolationScale r) + (selectedProjection (interpolationScale r)).val (selectedProjection (interpolationScale r)).property + | .infinity => canonicalTrace + +@[instance_reducible] def Model.topology : (m : Model) → TopologicalSpace m.Algebra + | .integer n => groupUltraweakTopology (FreeGroupRank n) + | .continuous r => cornerTopology (stabilizationTopology (FreeGroupRank 2)) + (selectedProjection (interpolationScale r)).val (selectedProjection (interpolationScale r)).property + | .infinity => groupUltraweakTopology (FreeGroup ℕ) + +def parameterModel (r : ℝ≥0∞) : Model := by + classical + exact if r=⊤ then .infinity else + if h : ∃n : ℕ,r=(n:ℝ≥0∞) then .integer h.choose else .continuous r.toReal + +abbrev InterpolatedFactor (r : ℝ≥0∞) := (parameterModel r).Algebra +abbrev interpolatedTrace (r : ℝ≥0∞) := (parameterModel r).trace +abbrev interpolatedTopology (r : ℝ≥0∞) := (parameterModel r).topology + +theorem allInterpolatedIsomorphic (r s : ℝ≥0∞) (hr : 1 spinValue (σ i)) + +def rotatedEnergy {N : ℕ} (eig : Fin N → ℝ) (U : Rotation N) (σ : Spin N) : ℝ := + (1 / 2 : ℝ) * ∑ i, eig i * (U (spinVector σ) i) ^ 2 + +def rotatedPressure {N : ℕ} (eig : Fin N → ℝ) (U : Rotation N) + (c : Fin N → ℝ) : ℝ := + (N : ℝ)⁻¹ * logPartition (fun σ => rotatedEnergy eig U σ + fieldEnergy c σ) + +run_cmd Lean.modifyEnv fun env => Lean.Meta.auxLemmasExt.setState env {} + +lemma orthogonal_mulVec_norm_sq {N : ℕ} (U : Orthogonal N) + (v : EuclideanSpace ℝ (Fin N)) : + ‖WithLp.toLp 2 ((U : Matrix (Fin N) (Fin N) ℝ) *ᵥ v.ofLp)‖ ^ 2 = ‖v‖ ^ 2 := by + have hU : (U : Matrix (Fin N) (Fin N) ℝ)ᵀ * + (U : Matrix (Fin N) (Fin N) ℝ) = 1 := + (Matrix.mem_orthogonalGroup_iff' (Fin N) ℝ).mp U.property + rw [EuclideanSpace.real_norm_sq_eq, EuclideanSpace.real_norm_sq_eq] + simp only [pow_two] + change ((U : Matrix (Fin N) (Fin N) ℝ) *ᵥ v.ofLp) ⬝ᵥ + ((U : Matrix (Fin N) (Fin N) ℝ) *ᵥ v.ofLp) = v.ofLp ⬝ᵥ v.ofLp + rw [← Matrix.dotProduct_transpose_mulVec, Matrix.mulVec_mulVec, hU, + Matrix.one_mulVec] + +def matrixRotation {N : ℕ} (U : Orthogonal N) : Rotation N := + { ((WithLp.linearEquiv 2 ℝ (Fin N → ℝ)).trans + (Matrix.UnitaryGroup.toLinearEquiv U)).trans + (WithLp.linearEquiv 2 ℝ (Fin N → ℝ)).symm with + norm_map' := fun v => (sq_eq_sq₀ (norm_nonneg _) (norm_nonneg _)).mp + (orthogonal_mulVec_norm_sq U v) } + +structure OverlapPath where + val : ℝ → ℝ + monotone : Monotone val + nonneg : ∀ s, 0 ≤ val s + le_one : ∀ s, val s ≤ 1 + +instance : CoeFun OverlapPath (fun _ => ℝ → ℝ) := ⟨OverlapPath.val⟩ + +def pathMeasure : Measure ℝ := volume.restrict (Ioo (0 : ℝ) 1) + +def deficit (p : OverlapPath) (r : ℝ) : ℝ := + 1 - r - ∫ s, max (p s - r) 0 ∂pathMeasure + +run_cmd Lean.modifyEnv fun env => Lean.Meta.auxLemmasExt.setState env {} + +def gaussianOperator (a v : ℝ) (f : ℝ → ℝ) (z : ℝ) : ℝ := + if a = 0 then ∫ g, f (z + Real.sqrt v * g) ∂gaussianReal 0 1 + else a⁻¹ * Real.log (∫ g, Real.exp (a * f (z + Real.sqrt v * g)) ∂gaussianReal 0 1) + +structure FieldStep where + depth : ℕ + cut : Fin (depth + 2) → ℝ + ordered_cut : StrictMono cut + first : cut 0 = 0 + last : cut (Fin.last (depth + 1)) = 1 + height : Fin (depth + 1) → ℝ + nonneg : ∀ i, 0 ≤ height i + ordered_height : Monotone height + +def fieldFunction (h : FieldStep) (s : ℝ) : ℝ := + ∑ i : Fin (h.depth + 1), + if h.cut i.castSucc < s ∧ s < h.cut i.succ then h.height i else 0 + +def fieldIncrement (h : FieldStep) (i : Fin (h.depth + 1)) : ℝ × ℝ := + (h.cut i.castSucc, h.height i - + if hi : i.val = 0 then 0 else h.height ⟨i.val - 1, by omega⟩) + +def fieldValue (h : FieldStep) (b : ℝ) : ℝ := + ((List.ofFn (fieldIncrement h)).foldr + (fun av f => gaussianOperator av.1 av.2 f) (fun z => Real.log (Real.cosh z))) b - + h.height (Fin.last h.depth) / 2 + +def fieldPairing (p : OverlapPath) (h : FieldStep) : ℝ := + ∫ s, p s * fieldFunction h s ∂pathMeasure + +def entropyFunctional (p : OverlapPath) : EReal := + ⨆ h : FieldStep, ((fieldValue h 0 + fieldPairing p h / 2 : ℝ) : EReal) + +def spectralFunctional (R : ℝ → ℝ) (p : OverlapPath) : ℝ := + (1 / 2 : ℝ) * ∫ r, R (deficit p r) ∂pathMeasure + +def variationalFunctional (R : ℝ → ℝ) : EReal := + ⨅ p : OverlapPath, entropyFunctional p + (spectralFunctional R p : EReal) + +def measureResolvent (μ : Measure ℝ) (b : ℝ) : ℝ := ∫ y, 1 / (b - y) ∂μ + +def measureInverse (μ : Measure ℝ) (e x : ℝ) : ℝ := + if h : ∃ b, e < b ∧ measureResolvent μ b = x then h.choose else e + +def measureR (μ : Measure ℝ) (e x : ℝ) : ℝ := + if 0 < x then measureInverse μ e x - 1 / x else ∫ y, y ∂μ + +def finiteSpectralMeasure {ι : Type*} (ρ eig : ι → ℝ) : Measure ℝ := + Measure.sum fun a => ENNReal.ofReal (ρ a) • Measure.dirac (eig a) + +theorem finiteSpectralMeasure_probability {ι : Type*} [Fintype ι] (ρ eig : ι → ℝ) + (hρ : ∀ a, 0 ≤ ρ a) (hsum : ∑ a, ρ a = 1) : + IsProbabilityMeasure (finiteSpectralMeasure ρ eig) := by + apply HasSum.isProbabilityMeasure_sum_dirac hρ + simpa only [hsum] using hasSum_fintype ρ + +run_cmd Lean.modifyEnv fun env => Lean.Meta.auxLemmasExt.setState env {} + +lemma empiricalSpectralWeight_sum {N : ℕ} (hN : 0 < N) : + ∑ _i : Fin N, (1 : ℝ)/N=1 := by + simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] + field_simp + +def empiricalSpectralLaw {N : ℕ} (hN : 0 < N) (eig : Fin N → ℝ) : ProbabilityMeasure ℝ := + ⟨finiteSpectralMeasure (fun _ => (1 : ℝ)/N) eig, + finiteSpectralMeasure_probability _ _ (fun _ => by positivity) (empiricalSpectralWeight_sum hN)⟩ + +def spectralMinimum {n : ℕ} (eig : Fin (n+1) → ℝ) : ℝ := + (Finset.univ.image eig).min' (Finset.image_nonempty.mpr Finset.univ_nonempty) + +def spectralMaximum {n : ℕ} (eig : Fin (n+1) → ℝ) : ℝ := + (Finset.univ.image eig).max' (Finset.image_nonempty.mpr Finset.univ_nonempty) + +def magneticBiasObjective (h : FieldStep) (s b : ℝ) : ℝ := fieldValue h b - b * s + +def constrainedFieldValue (h : FieldStep) (s : ℝ) : ℝ := + sInf (range (magneticBiasObjective h s)) + +def magneticGroupValue {A : Type*} [Fintype A] (γ m : A → ℝ) (h : FieldStep) : ℝ := + ∑ a, γ a * constrainedFieldValue h (m a) + +run_cmd Lean.modifyEnv fun env => Lean.Meta.auxLemmasExt.setState env {} + +def magneticEntropyFunctional {A : Type*} [Fintype A] (γ m : A → ℝ) + (p : OverlapPath) : EReal := + ⨆ h : FieldStep, ((magneticGroupValue γ m h + fieldPairing p h / 2 : ℝ) : EReal) + +def magneticVariationalFunctional {A : Type*} [Fintype A] (R : ℝ → ℝ) (γ m : A → ℝ) : EReal := + ⨅ p : OverlapPath, magneticEntropyFunctional γ m p + (spectralFunctional R p : EReal) + +def RationalMagnetization (A : Type*) := {m : A → ℚ // ∀ a, |(m a : ℝ)| < 1} + +def finiteMagneticFunctional {A : Type*} [Fintype A] (R : ℝ → ℝ) (γ c : A → ℝ) : EReal := + ⨆ m : RationalMagnetization A, + ((∑ a, γ a * c a * (m.val a : ℝ) : ℝ) : EReal) + + magneticVariationalFunctional R γ (fun a => (m.val a : ℝ)) + +def finiteIndexWeight {Ω A : Type*} [MeasurableSpace Ω] + (P : Measure Ω) (g : Ω → A) (a : A) : ℝ := P.real (g ⁻¹' {a}) + +def simpleFieldIndex {Ω : Type*} [MeasurableSpace Ω] (s : SimpleFunc Ω ℝ) (x : Ω) : s.range := + ⟨s x,s.mem_range_self x⟩ + +def simpleFieldWeight {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) (s : SimpleFunc Ω ℝ) := + finiteIndexWeight P (simpleFieldIndex s) + +abbrev SimpleFieldPositive {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) (s : SimpleFunc Ω ℝ) := + {i : s.range // 0 < simpleFieldWeight P s i} + +def simpleFieldValue {Ω : Type*} [MeasurableSpace Ω] + (P : Measure Ω) [IsProbabilityMeasure P] (s : SimpleFunc Ω ℝ) (R : ℝ → ℝ) : ℝ := + (finiteMagneticFunctional R (fun i : SimpleFieldPositive P s => simpleFieldWeight P s i) + (fun i => i.val.val)).toReal + +def fieldSimpleApproximation (n : ℕ) : SimpleFunc ℝ ℝ := + SimpleFunc.approxOn id measurable_id (range (id : ℝ → ℝ) ∪ {0}) 0 (by simp) n + +def magneticFieldFunctional (spectral : Measure ℝ) (edge : ℝ) (field : ProbabilityMeasure ℝ) : ℝ := + limUnder atTop (fun n => simpleFieldValue (field : Measure ℝ) (fieldSimpleApproximation n) + (measureR spectral edge)) + +structure FieldLawCoupling (μ ν : ProbabilityMeasure ℝ) where + law : ProbabilityMeasure (ℝ × ℝ) + fst : (law : Measure (ℝ × ℝ)).map Prod.fst = (μ : Measure ℝ) + snd : (law : Measure (ℝ × ℝ)).map Prod.snd = (ν : Measure ℝ) + +def FieldLawCoupling.cost {μ ν : ProbabilityMeasure ℝ} (p : FieldLawCoupling μ ν) : ℝ≥0∞ := + ∫⁻ xy, ENNReal.ofReal |xy.1-xy.2| ∂(p.law : Measure (ℝ × ℝ)) + +def fieldWassersteinOne (μ ν : ProbabilityMeasure ℝ) : ℝ≥0∞ := + ⨅ p : FieldLawCoupling μ ν, p.cost + +def scaledSpectralLaw (ν : ProbabilityMeasure ℝ) (β : ℝ) : ProbabilityMeasure ℝ := + ν.map (fun x => β*x) + +def groundStateEnergy {N : ℕ} (eig : Fin N → ℝ) (U : Rotation N) : ℝ := + (N : ℝ)⁻¹ * Finset.univ.sup' Finset.univ_nonempty (rotatedEnergy eig U) + +def thermalVariationalValue (ν : ProbabilityMeasure ℝ) (b β : ℝ) : ℝ := + (variationalFunctional (measureR (scaledSpectralLaw ν β : Measure ℝ) (β*b))).toReal/β + +abbrev FieldSpectralData (N : ℕ) := (Fin N → ℝ) × (Fin N → ℝ) + +def dataPhysicalPressure {N : ℕ} (d : FieldSpectralData N) (U : Orthogonal N) : ℝ := + rotatedPressure d.1 (matrixRotation U⁻¹) d.2 + +def ConditionalFieldOrbitLaw {Ω : Type*} [MeasurableSpace Ω] {N : ℕ} + (P : Measure Ω) (d : Ω → FieldSpectralData N) (pressure : Ω → ℝ) + (H : Measure (Orthogonal N)) : Prop := + P.map (fun ω => (d ω,pressure ω)) = + ((P.map d).prod H).map (fun z => (z.1,dataPhysicalPressure z.1 z.2)) + +def spectralExcess {N : ℕ} (eig : Fin N → ℝ) (a b : ℝ) : ℝ := + (insert 0 (Finset.univ.image (fun i => max (a-eig i) (eig i-b)))).max' + (Finset.insert_nonempty 0 _) + +run_cmd Lean.modifyEnv fun env => Lean.Meta.auxLemmasExt.setState env {} + +@[irreducible] def gaussianPatternCount (α : ℝ) (N : ℕ) : ℕ := ⌊α*N⌋₊ + +def marchenkoPasturA (α : ℝ) : ℝ := (1-Real.sqrt α)^2 + +def marchenkoPasturB (α : ℝ) : ℝ := (1+Real.sqrt α)^2 + +def marchenkoPasturLower (α : ℝ) : ℝ := if α ≤ 1 then 0 else marchenkoPasturA α + +def marchenkoPasturMeasure (α : ℝ) : Measure ℝ := + ENNReal.ofReal (max (1-α) 0) • Measure.dirac 0 + + volume.withDensity ((Icc (marchenkoPasturA α) (marchenkoPasturB α)).indicator + (fun x => ENNReal.ofReal + (Real.sqrt ((marchenkoPasturB α-x)*(x-marchenkoPasturA α))/(2*Real.pi*x)))) + +def gaussianPatternLimit (α c : ℝ) : ℝ := + (variationalFunctional (measureR ((marchenkoPasturMeasure α).map (fun x => c*x)) + (max (c*marchenkoPasturLower α) (c*marchenkoPasturB α)))).toReal + +run_cmd Lean.modifyEnv fun env => Lean.Meta.auxLemmasExt.setState env {} + +def gaussianPatternArray {N m : ℕ} (z : EuclideanSpace ℝ (Fin N × Fin m)) : + Matrix (Fin N) (Fin m) ℝ := fun i j => z (i,j) + +def gaussianPatternSum {N m : ℕ} (z : EuclideanSpace ℝ (Fin N × Fin m)) (σ : Spin N) : + EuclideanSpace ℝ (Fin m) := + WithLp.toLp 2 ((gaussianPatternArray z)ᵀ *ᵥ (fun i => spinValue (σ i))) + +def gaussianPatternPressure {N m : ℕ} (c : ℝ) + (z : EuclideanSpace ℝ (Fin N × Fin m)) : ℝ := + (N : ℝ)⁻¹*logPartition (fun σ : Spin N => c/(2*N)*‖gaussianPatternSum z σ‖^2) + +run_cmd Lean.modifyEnv fun env => Lean.Meta.auxLemmasExt.setState env {} + +def gaussianPatternGroundEnergy {N m : ℕ} (ε : ℝ) + (z : EuclideanSpace ℝ (Fin N × Fin m)) : ℝ := + (N : ℝ)⁻¹*Finset.univ.sup' Finset.univ_nonempty + (fun σ : Spin N => ε/(2*N)*‖gaussianPatternSum z σ‖^2) + +run_cmd Lean.modifyEnv fun env => Lean.Meta.auxLemmasExt.setState env {} + +def gaussianPatternColumn {N m : ℕ} (z : EuclideanSpace ℝ (Fin N × Fin m)) + (i : Fin N) : EuclideanSpace ℝ (Fin m) := WithLp.toLp 2 (fun j => z (i,j)) + +def gaussianPatternOperator {N m : ℕ} (z : EuclideanSpace ℝ (Fin N × Fin m)) : + (Fin N → ℝ) →L[ℝ] EuclideanSpace ℝ (Fin m) := + (PiLp.continuousLinearEquiv 2 ℝ (fun _ : Fin m => ℝ)).symm.toContinuousLinearMap.comp + ((gaussianPatternArray z)ᵀ.mulVecLin.toContinuousLinearMap) + +theorem limiting_pressure_of_extreme_limits_unconditional : + ∀ {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (U : (N : ℕ) → Ω → Orthogonal N) (_hU : ∀ N, Measurable (U N)) + (_hHaar : ∀ N, (P.map (U N)).IsMulRightInvariant) + (eig : (N : ℕ) → Fin N → ℝ) (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (_hcompact : IsCompact (ν : Measure ℝ).support) + (_hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (_ha : a∈(ν : Measure ℝ).support) (_hb : b∈(ν : Measure ℝ).support) + (_hmin : Tendsto (fun k => spectralMinimum (eig (k+1))) atTop (𝓝 a)) + (_hmax : Tendsto (fun k => spectralMaximum (eig (k+1))) atTop (𝓝 b)) + (_hweak : Tendsto (fun k => empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1))) + atTop (𝓝 ν)), + Tendsto (fun N => ∫ ω, rotatedPressure (eig N) (matrixRotation (U N ω)⁻¹) (fun _ => 0) ∂P) + atTop (𝓝 (variationalFunctional (measureR (ν : Measure ℝ) b)).toReal) ∧ + ∀ᵐ ω ∂P, Tendsto (fun N => rotatedPressure (eig N) (matrixRotation (U N ω)⁻¹) (fun _ => 0)) + atTop (𝓝 (variationalFunctional (measureR (ν : Measure ℝ) b)).toReal) := by + sorry + +theorem limiting_wasserstein_field_pressure_of_extreme_limits_unconditional : + ∀ {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (U : (N : ℕ) → Ω → Orthogonal N) (_hU : ∀ N, Measurable (U N)) + (_hHaar : ∀ N, (P.map (U N)).IsMulRightInvariant) + (eig : (N : ℕ) → Fin N → ℝ) (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (_hcompact : IsCompact (ν : Measure ℝ).support) + (_hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (_ha : a∈(ν : Measure ℝ).support) (_hb : b∈(ν : Measure ℝ).support) + (_hmin : Tendsto (fun k => spectralMinimum (eig (k+1))) atTop (𝓝 a)) + (_hmax : Tendsto (fun k => spectralMaximum (eig (k+1))) atTop (𝓝 b)) + (_hweak : Tendsto (fun k => empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1))) + atTop (𝓝 ν)) + (field : (N : ℕ) → Fin N → ℝ) (ξ : ProbabilityMeasure ℝ) + (_hξ : Integrable (fun x : ℝ => x) (ξ : Measure ℝ)) + (_hw : Tendsto (fun k => fieldWassersteinOne (empiricalSpectralLaw (Nat.succ_pos k) (field (k+1))) ξ) + atTop (𝓝 0)), + Tendsto (fun N => ∫ ω, rotatedPressure (eig N) (matrixRotation (U N ω)⁻¹) (field N) ∂P) + atTop (𝓝 (magneticFieldFunctional (ν : Measure ℝ) b ξ)) ∧ + ∀ᵐ ω ∂P, Tendsto (fun N => rotatedPressure (eig N) (matrixRotation (U N ω)⁻¹) (field N)) + atTop (𝓝 (magneticFieldFunctional (ν : Measure ℝ) b ξ)) := by + sorry + +theorem positive_temperature_pressure_unconditional : + ∀ {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (U : (N : ℕ) → Ω → Orthogonal N) (_hU : ∀ N, Measurable (U N)) + (_hHaar : ∀ N, (P.map (U N)).IsMulRightInvariant) + (eig : (N : ℕ) → Fin N → ℝ) (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (_hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (_ha : a∈(ν : Measure ℝ).support) (_hb : b∈(ν : Measure ℝ).support) + (_hno : ∀ ε : ℝ, 0 < ε → ∀ᶠ N in atTop, ∀ i, a-ε ≤ eig N i ∧ eig N i ≤ b+ε) + (β : ℝ) (_hβ : 0 < β) + (_hweak : Tendsto (fun k => empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1))) + atTop (𝓝 ν)), + Tendsto (fun N => ∫ ω, rotatedPressure (fun i => β*eig N i) (matrixRotation (U N ω)⁻¹) (fun _ => 0) ∂P) + atTop (𝓝 (variationalFunctional (measureR (scaledSpectralLaw ν β : Measure ℝ) (β*b))).toReal) ∧ + ∀ᵐ ω ∂P, Tendsto (fun N => rotatedPressure (fun i => β*eig N i) (matrixRotation (U N ω)⁻¹) (fun _ => 0)) + atTop (𝓝 (variationalFunctional (measureR (scaledSpectralLaw ν β : Measure ℝ) (β*b))).toReal) := by + sorry + +theorem ground_state_limit_unconditional : + ∀ {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (U : (N : ℕ) → Ω → Orthogonal N) (_hU : ∀ N, Measurable (U N)) + (_hHaar : ∀ N, (P.map (U N)).IsMulRightInvariant) + (eig : (N : ℕ) → Fin N → ℝ) (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (_hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (_ha : a∈(ν : Measure ℝ).support) (_hb : b∈(ν : Measure ℝ).support) + (_hno : ∀ ε : ℝ, 0 < ε → ∀ᶠ N in atTop, ∀ i, a-ε ≤ eig N i ∧ eig N i ≤ b+ε) + (_hweak : Tendsto (fun k => empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1))) + atTop (𝓝 ν)), + ∃ M : ℝ, + Tendsto (fun N => ∫ ω, groundStateEnergy (eig N) (matrixRotation (U N ω)⁻¹) ∂P) + atTop (𝓝 M) ∧ + (∀ᵐ ω ∂P, Tendsto (fun N => groundStateEnergy (eig N) (matrixRotation (U N ω)⁻¹)) + atTop (𝓝 M)) ∧ + Tendsto (thermalVariationalValue ν b) atTop (𝓝 M) := by + sorry + +theorem random_pressure_tendsto_in_measure_unconditional + {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (eig : (N : ℕ) → Ω → Fin N → ℝ) (Y : ℕ → Ω → ℝ) + (heig : ∀ N, Measurable (eig N)) (hY : ∀ N, Measurable (Y N)) + (H : (N : ℕ) → Measure (Orthogonal N)) [∀ N, IsProbabilityMeasure (H N)] + [∀ N, (H N).IsMulRightInvariant] + (hlaw : ∀ N, ConditionalFieldOrbitLaw P (fun ω => (eig N ω,fun _ => 0)) (Y N) (H N)) + (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (hcompact : IsCompact (ν : Measure ℝ).support) + (hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (ha : a∈(ν : Measure ℝ).support) (hb : b∈(ν : Measure ℝ).support) + (hweak : TendstoInMeasure P (fun k ω => LevyProkhorov.ofMeasure + (empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1) ω))) atTop + (fun _ => LevyProkhorov.ofMeasure ν)) + (hexcess : TendstoInMeasure P (fun k ω => spectralExcess (eig (k+1) ω) a b) + atTop (fun _ => 0)) : + TendstoInMeasure P (fun k => Y (k+1)) atTop + (fun _ => (variationalFunctional (measureR (ν : Measure ℝ) b)).toReal) := by + sorry + +theorem random_pressure_limit_unconditional : + ∀ {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (eig : (N : ℕ) → Ω → Fin N → ℝ) (Y : ℕ → Ω → ℝ) + (_heig : ∀ N, Measurable (eig N)) (_hY : ∀ N, Measurable (Y N)) + (H : (N : ℕ) → Measure (Orthogonal N)) [∀ N, IsProbabilityMeasure (H N)] + [∀ N, (H N).IsMulRightInvariant] + (_hlaw : ∀ N, ConditionalFieldOrbitLaw P (fun ω => (eig N ω,fun _ => 0)) (Y N) (H N)) + (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (_hcompact : IsCompact (ν : Measure ℝ).support) + (_hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (_ha : a∈(ν : Measure ℝ).support) (_hb : b∈(ν : Measure ℝ).support) + (_hweak : TendstoInMeasure P (fun k ω => LevyProkhorov.ofMeasure + (empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1) ω))) atTop + (fun _ => LevyProkhorov.ofMeasure ν)) + (_hexcess : TendstoInMeasure P (fun k ω => spectralExcess (eig (k+1) ω) a b) + atTop (fun _ => 0)) + (_hUI : UniformIntegrable (fun k => Y (k+1)) 1 P), + TendstoInMeasure P (fun k => Y (k+1)) atTop + (fun _ => (variationalFunctional (measureR (ν : Measure ℝ) b)).toReal) ∧ + Tendsto (fun k => eLpNorm (fun ω => Y (k+1) ω- + (variationalFunctional (measureR (ν : Measure ℝ) b)).toReal) 1 P) atTop (𝓝 0) ∧ + Tendsto (fun k => ∫ ω, Y (k+1) ω ∂P) atTop + (𝓝 (variationalFunctional (measureR (ν : Measure ℝ) b)).toReal) := by + sorry + +theorem random_pressure_tendsto_ae_unconditional : + ∀ {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (eig : (N : ℕ) → Ω → Fin N → ℝ) (Y : ℕ → Ω → ℝ) + (_heig : ∀ N, Measurable (eig N)) (_hY : ∀ N, Measurable (Y N)) + (H : (N : ℕ) → Measure (Orthogonal N)) [∀ N, IsProbabilityMeasure (H N)] + [∀ N, (H N).IsMulRightInvariant] + (_hlaw : ∀ N, ConditionalFieldOrbitLaw P (fun ω => (eig N ω,fun _ => 0)) (Y N) (H N)) + (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (_hcompact : IsCompact (ν : Measure ℝ).support) + (_hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (_ha : a∈(ν : Measure ℝ).support) (_hb : b∈(ν : Measure ℝ).support) + (_hno : ∀ᵐ ω ∂P, ∀ ε : ℝ, 0 < ε → ∀ᶠ N in atTop, + ∀ i, a-ε ≤ eig N ω i ∧ eig N ω i ≤ b+ε) + (_hweak : ∀ᵐ ω ∂P, Tendsto (fun k => + empiricalSpectralLaw (Nat.succ_pos k) (eig (k+1) ω)) atTop (𝓝 ν)), + ∀ᵐ ω ∂P, Tendsto (fun N => Y N ω) atTop + (𝓝 (variationalFunctional (measureR (ν : Measure ℝ) b)).toReal) := by + sorry + +theorem random_field_pressure_tendsto_ae_unconditional : + ∀ {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (d : (N : ℕ) → Ω → FieldSpectralData N) (Y : ℕ → Ω → ℝ) + (_hd : ∀ N, Measurable (d N)) (_hY : ∀ N, Measurable (Y N)) + (H : (N : ℕ) → Measure (Orthogonal N)) [∀ N, IsProbabilityMeasure (H N)] + [∀ N, (H N).IsMulRightInvariant] + (_hlaw : ∀ N, ConditionalFieldOrbitLaw P (d N) (Y N) (H N)) + (ν : ProbabilityMeasure ℝ) (a b : ℝ) + (_hcompact : IsCompact (ν : Measure ℝ).support) + (_hbound : (ν : Measure ℝ).support ⊆ Icc a b) + (_ha : a∈(ν : Measure ℝ).support) (_hb : b∈(ν : Measure ℝ).support) + (_hno : ∀ᵐ ω ∂P, ∀ ε : ℝ, 0 < ε → ∀ᶠ N in atTop, + ∀ i, a-ε ≤ (d N ω).1 i ∧ (d N ω).1 i ≤ b+ε) + (_hweak : ∀ᵐ ω ∂P, Tendsto (fun k => + empiricalSpectralLaw (Nat.succ_pos k) (d (k+1) ω).1) atTop (𝓝 ν)) + (ξ : ProbabilityMeasure ℝ) (_hξ : Integrable (fun x : ℝ => x) (ξ : Measure ℝ)) + (_hw : ∀ᵐ ω ∂P, Tendsto (fun k => fieldWassersteinOne + (empiricalSpectralLaw (Nat.succ_pos k) (d (k+1) ω).2) ξ) atTop (𝓝 0)), + ∀ᵐ ω ∂P, Tendsto (fun N => Y N ω) atTop + (𝓝 (magneticFieldFunctional (ν : Measure ℝ) b ξ)) := by + sorry + +theorem gaussianPattern_pressure_limit_unconditional : + ∀ (α : ℝ) (_hα : 0 < α) + {Ω : Type u} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (Z : (N : ℕ) → Ω → EuclideanSpace ℝ (Fin N × Fin (gaussianPatternCount α N))) + (_hZ : ∀ N, Measurable (Z N)) (_hlaw : ∀ N, HasLaw (Z N) (stdGaussian _) P) + (c : ℝ), + TendstoInMeasure P (fun k ω => gaussianPatternPressure (N := k+1) (m := gaussianPatternCount α (k+1)) c (Z (k+1) ω)) atTop + (fun _ => gaussianPatternLimit α c) ∧ + Tendsto (fun k => eLpNorm (fun ω => gaussianPatternPressure (N := k+1) (m := gaussianPatternCount α (k+1)) c (Z (k+1) ω)- + gaussianPatternLimit α c) 1 P) atTop (𝓝 0) ∧ + Tendsto (fun k => ∫ ω, gaussianPatternPressure (N := k+1) (m := gaussianPatternCount α (k+1)) c (Z (k+1) ω) ∂P) atTop + (𝓝 (gaussianPatternLimit α c)) := by + sorry + +theorem gaussianPattern_ground_limit_unconditional : + ∀ (α : ℝ) (_hα : 0 < α) + {Ω : Type u} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (Z : (N : ℕ) → Ω → EuclideanSpace ℝ (Fin N × Fin (gaussianPatternCount α N))) + (_hZ : ∀ N, Measurable (Z N)) (_hlaw : ∀ N, HasLaw (Z N) (stdGaussian _) P) + (ε : ℝ), + ∃ e : ℝ, + TendstoInMeasure P (fun k ω => gaussianPatternGroundEnergy ε (Z (k+1) ω)) atTop (fun _ => e) ∧ + Tendsto (fun k => eLpNorm (fun ω => gaussianPatternGroundEnergy ε (Z (k+1) ω)-e) 1 P) + atTop (𝓝 0) ∧ + Tendsto (fun k => ∫ ω, gaussianPatternGroundEnergy ε (Z (k+1) ω) ∂P) atTop (𝓝 e) ∧ + Tendsto (fun β => gaussianPatternLimit α (ε*β)/β) atTop (𝓝 e) := by + sorry + +theorem gaussianPattern_norm_limits_unconditional : + ∀ (α : ℝ) (_hα : 0 < α) + {Ω : Type u} [MeasurableSpace Ω] (P : Measure Ω) [IsProbabilityMeasure P] + (Z : (N : ℕ) → Ω → EuclideanSpace ℝ (Fin N × Fin (gaussianPatternCount α N))) + (_hZ : ∀ N, Measurable (Z N)) (_hlaw : ∀ N, HasLaw (Z N) (stdGaussian _) P), + ∃ eplus eminus : ℝ, 0 ≤ eplus ∧ eminus ≤ 0 ∧ + Tendsto (fun β => gaussianPatternLimit α β/β) atTop (𝓝 eplus) ∧ + Tendsto (fun β => gaussianPatternLimit α (-β)/β) atTop (𝓝 eminus) ∧ + (TendstoInMeasure P (fun k ω => ‖gaussianPatternOperator (Z (k+1) ω)‖/(k+1)) atTop + (fun _ => Real.sqrt (2*eplus)) ∧ + Tendsto (fun k => eLpNorm (fun ω => ‖gaussianPatternOperator (Z (k+1) ω)‖/(k+1)- + Real.sqrt (2*eplus)) 1 P) atTop (𝓝 0)) ∧ + (TendstoInMeasure P (fun k ω => + (Finset.univ.inf' Finset.univ_nonempty (fun σ : Spin (k+1) => ‖gaussianPatternSum (Z (k+1) ω) σ‖))/(k+1)) + atTop (fun _ => Real.sqrt (-2*eminus)) ∧ + Tendsto (fun k => eLpNorm (fun ω => + (Finset.univ.inf' Finset.univ_nonempty (fun σ : Spin (k+1) => ‖gaussianPatternSum (Z (k+1) ω) σ‖))/(k+1)- + Real.sqrt (-2*eminus)) 1 P) atTop (𝓝 0)) := by + sorry + +end InvariantIsing + +end + +end OAI diff --git a/lean/ComparatorChallenges/IrrationalRotation.json b/lean/ComparatorChallenges/IrrationalRotation.json new file mode 100644 index 0000000000000000000000000000000000000000..3be451b6c4a7f8970760b03569c5b757cd3e611f --- /dev/null +++ b/lean/ComparatorChallenges/IrrationalRotation.json @@ -0,0 +1,15 @@ +{ + "challenge_module": "ComparatorChallenges.IrrationalRotation", + "solution_module": "OAI.Analysis.IrrationalRotation.Main", + "theorem_names": [ + "OAI.Invariant233.Results.prescribed_irrational_counterexample", + "OAI.Invariant233.Results.product_realization" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/IrrationalRotation.lean b/lean/ComparatorChallenges/IrrationalRotation.lean new file mode 100644 index 0000000000000000000000000000000000000000..000d6f0765e02c85a8646c1df0e14fc862d217e4 --- /dev/null +++ b/lean/ComparatorChallenges/IrrationalRotation.lean @@ -0,0 +1,849 @@ +import Mathlib + +namespace OAI + +section +noncomputable section +open Filter MeasureTheory +open scoped ENNReal Topology + +namespace Invariant233 + +abbrev Circle := AddCircle (1 : ℝ) + +def circleMeasure : Measure Circle := volume + +def negLogCost (t : ℝ) : ℝ≥0∞ := + if t = 0 then ∞ else ENNReal.ofReal (-Real.log |t|) + +def HasNegInfiniteLogIntegral {X : Type*} [MeasurableSpace X] + (μ : Measure X) (f : X → ℝ) : Prop := + (∫⁻ x, negLogCost (f x) ∂μ) = ∞ + +def scalarWeightDeterminant {X : Type*} [MeasurableSpace X] + (μ : Measure X) (f : X → ℝ) : ℝ≥0∞ := + EReal.exp (-((∫⁻ x, negLogCost (f x) ∂μ) : EReal)) + +def NormQuasinilpotent {A : Type*} [NormedRing A] (T : A) : Prop := + Tendsto (fun n : ℕ => ‖T ^ n‖ ^ (1 / (n : ℝ))) atTop (𝓝 0) + +def IsContinuousCircleWeight (f : Circle → ℝ) : Prop := + Continuous f ∧ (∀ x, 0 ≤ f x ∧ f x ≤ 1) ∧ + (∀ x, f x = 0 ↔ x = 0) ∧ HasNegInfiniteLogIntegral circleMeasure f + +end Invariant233 + +end +end + +section +noncomputable section +open scoped ENNReal +namespace Invariant233.WeightedShift + +abbrev Hilbert := lp (fun _ : ℤ => ℂ) 2 +abbrev Weight := lp (fun _ : ℤ => ℂ) ∞ + +def reindex (e : Equiv.Perm ℤ) : Hilbert ≃ₗᵢ[ℂ] Hilbert where + toFun ξ := ⟨fun k => ξ (e k), memℓp_gen <| + (e.summable_iff).2 ((lp.memℓp ξ).summable (by norm_num))⟩ + invFun ξ := ⟨fun k => ξ (e.symm k), memℓp_gen <| + (e.symm.summable_iff).2 ((lp.memℓp ξ).summable (by norm_num))⟩ + left_inv ξ := by ext k; simp + right_inv ξ := by ext k; simp + map_add' ξ η := by ext k; rfl + map_smul' c ξ := by ext k; rfl + norm_map' ξ := by + rw [lp.norm_eq_tsum_rpow (by norm_num), lp.norm_eq_tsum_rpow (by norm_num)] + congr 1 + exact e.tsum_eq (fun k => ‖ξ k‖ ^ (2 : ENNReal).toReal) + +def shift (m : ℤ) : Hilbert ≃ₗᵢ[ℂ] Hilbert := reindex (Equiv.addRight (-m)) + +def diagonal (w : Weight) : Hilbert →L[ℂ] Hilbert := + lp.mapCLM 2 (fun k => w k • ContinuousLinearMap.id ℂ ℂ) (norm_nonneg w) + (fun k => by + let : T0Space ℂ := @MetricSpace.instT0Space ℂ Complex.instNormedAddCommGroup.toMetricSpace + simpa [norm_smul] using lp.norm_apply_le_norm (by simp) w k) + +def diagonalAlgHom : Weight →ₐ[ℂ] (Hilbert →L[ℂ] Hilbert) where + toFun := diagonal + map_one' := by + ext ξ k + change (1 : ℂ) * ξ k = ξ k + exact one_mul _ + map_mul' w v := by + ext ξ k + change (w k * v k) * ξ k = w k * (v k * ξ k) + exact mul_assoc _ _ _ + map_zero' := by + ext ξ k + change (0 : ℂ) * ξ k = 0 + exact zero_mul _ + map_add' w v := by + ext ξ k + change (w k + v k) * ξ k = w k * ξ k + v k * ξ k + exact add_mul _ _ _ + commutes' c := by + ext ξ k + change c * ξ k = c * ξ k + rfl + +def translate (w : Weight) (m : ℤ) : Weight := + ⟨fun k => w (k + m), memℓp_infty <| by + refine ⟨‖w‖, ?_⟩ + rintro r ⟨k, rfl⟩ + exact lp.norm_apply_le_norm (by simp) w (k + m)⟩ + +def operator (w : Weight) : Hilbert →L[ℂ] Hilbert := + (shift 1).toLinearIsometry.toContinuousLinearMap.comp (diagonal w) + +def orbitProduct (w : Weight) (n : ℕ) : Weight := + ⟨fun k => ∏ j ∈ Finset.range n, w (k + j), memℓp_infty <| by + refine ⟨‖w‖ ^ n, ?_⟩ + rintro r ⟨k, rfl⟩ + calc + ‖∏ j ∈ Finset.range n, w (k + j)‖ ≤ + ∏ j ∈ Finset.range n, ‖w (k + j)‖ := le_of_eq (norm_prod _ _) + _ ≤ ∏ _j ∈ Finset.range n, ‖w‖ := by + apply Finset.prod_le_prod₀ + · intro j hj; exact norm_nonneg _ + · intro j hj; exact lp.norm_apply_le_norm (by simp) w _ + _ = ‖w‖ ^ n := by simp⟩ + +def tailWeight (m : ℤ) : Weight := + ⟨fun k => if m ≤ k then 1 else 0, memℓp_infty <| by + refine ⟨1, ?_⟩ + rintro r ⟨k, rfl⟩ + by_cases h : m ≤ k <;> simp [h]⟩ + +def tailProjection (m : ℤ) : Hilbert →L[ℂ] Hilbert := diagonal (tailWeight m) + +end Invariant233.WeightedShift + +end +end + +section +open scoped Pointwise + +namespace Invariant233 + +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] + [CompleteSpace H] + +local instance instStarModuleGenerated : StarModule ℂ (H →L[ℂ] H) := + ContinuousLinearMap.instStarModuleId + +noncomputable def vonNeumannGenerated (s : Set (H →L[ℂ] H)) : VonNeumannAlgebra H where + toStarSubalgebra := + StarSubalgebra.centralizer ℂ (StarSubalgebra.centralizer ℂ s : Set (H →L[ℂ] H)) + centralizer_centralizer' := by + change Set.centralizer (Set.centralizer + (StarSubalgebra.centralizer ℂ (StarSubalgebra.centralizer ℂ s : Set (H →L[ℂ] H)) : + Set (H →L[ℂ] H))) = _ + rw [StarSubalgebra.coe_centralizer_centralizer] + rw [Set.centralizer_centralizer_centralizer] + exact (StarSubalgebra.coe_centralizer_centralizer ℂ s).symm + +end Invariant233 + +end + +section +noncomputable section +open MeasureTheory Filter +open scoped ENNReal lp Topology + +run_cmd Lean.modifyEnv fun env => Lean.Meta.auxLemmasExt.setState env {} + +namespace Invariant233.WeightedShift +variable {X : Type*} [MeasurableSpace X] {μ : Measure X} + +theorem diagonal_value (w : Weight) (v : Hilbert) (i : ℤ) : + diagonal w v i = w i * v i := rfl + +theorem diagonal_bound (w : Weight) (C : ℝ) (hw : ‖w‖ ≤ C) (v : Hilbert) : + ‖diagonal w v‖ ≤ C * ‖v‖ := by + apply (diagonal w).le_of_opNorm_le + exact (lp.norm_mapCLM_le 2 _ (norm_nonneg w) _).trans hw + +theorem diagonal_aestronglyMeasurable (a : X → Weight) (C : ℝ) (_hC : 0 ≤ C) + (_ha : ∀ x, ‖a x‖ ≤ C) + (hm : ∀ i, AEStronglyMeasurable (fun x => a x i) μ) + {f : X → Hilbert} (hf : AEStronglyMeasurable f μ) : + AEStronglyMeasurable (fun x => diagonal (a x) (f x)) μ := by + classical + let : Nonempty (Finset ℤ) := ⟨∅⟩ + let F : Finset ℤ → X → Hilbert := + fun s => ∑ i ∈ s, fun x => lp.single 2 i (a x i * f x i) + apply aestronglyMeasurable_of_tendsto_ae (atTop : Filter (Finset ℤ)) + (f := F) + · intro s + apply Finset.aestronglyMeasurable_sum + intro i hi + exact (lp.singleContinuousLinearMap ℂ (fun _ : ℤ => ℂ) 2 i).continuous.comp_aestronglyMeasurable + ((hm i).mul ((lp.evalCLM ℂ (fun _ : ℤ => ℂ) 2 i).continuous.comp_aestronglyMeasurable hf)) + · apply Filter.Eventually.of_forall + intro x + simpa only [F, Finset.sum_apply, diagonal_value, HasSum, SummationFilter.unconditional] using + lp.hasSum_single (by norm_num) (diagonal (a x) (f x)) + +def fieldDiagonalVec (a : X → Weight) (C : ℝ) (hC : 0 ≤ C) + (ha : ∀ x, ‖a x‖ ≤ C) + (hm : ∀ i, AEStronglyMeasurable (fun x => a x i) μ) + (f : Lp (Hilbert) 2 μ) : Lp (Hilbert) 2 μ := + ((Lp.memLp f).of_le_mul + (diagonal_aestronglyMeasurable a C hC ha hm (Lp.aestronglyMeasurable f)) + (Filter.Eventually.of_forall fun x => diagonal_bound (a x) C (ha x) (f x))).toLp _ + +theorem fieldDiagonalVec_ae (a : X → Weight) (C : ℝ) (hC : 0 ≤ C) + (ha : ∀ x, ‖a x‖ ≤ C) + (hm : ∀ i, AEStronglyMeasurable (fun x => a x i) μ) + (f : Lp (Hilbert) 2 μ) : + fieldDiagonalVec a C hC ha hm f =ᵐ[μ] + fun x => diagonal (a x) (f x) := + MemLp.coeFn_toLp _ + +def fieldDiagonalLinear (a : X → Weight) (C : ℝ) (hC : 0 ≤ C) + (ha : ∀ x, ‖a x‖ ≤ C) + (hm : ∀ i, AEStronglyMeasurable (fun x => a x i) μ) : + Lp (Hilbert) 2 μ →ₗ[ℂ] Lp (Hilbert) 2 μ where + toFun := fieldDiagonalVec a C hC ha hm + map_add' f g := by + apply Lp.ext + filter_upwards [fieldDiagonalVec_ae a C hC ha hm (f + g), + fieldDiagonalVec_ae a C hC ha hm f, fieldDiagonalVec_ae a C hC ha hm g, + Lp.coeFn_add f g, Lp.coeFn_add + (fieldDiagonalVec a C hC ha hm f) (fieldDiagonalVec a C hC ha hm g)] + with x hfg hf hg hsum hout + simp only [Pi.add_apply] at hsum hout + rw [hfg, hout, hf, hg, hsum, map_add] + map_smul' c f := by + change fieldDiagonalVec a C hC ha hm (c • f) = c • fieldDiagonalVec a C hC ha hm f + apply Lp.ext + filter_upwards [fieldDiagonalVec_ae a C hC ha hm (c • f), + fieldDiagonalVec_ae a C hC ha hm f, Lp.coeFn_smul c f, + Lp.coeFn_smul c (fieldDiagonalVec a C hC ha hm f)] with x hcf hf hsmul hout + simp only [Pi.smul_apply] at hsmul hout + rw [hcf, hout, hf, hsmul, map_smul] + +def fieldDiagonal (a : X → Weight) (C : ℝ) (hC : 0 ≤ C) + (ha : ∀ x, ‖a x‖ ≤ C) + (hm : ∀ i, AEStronglyMeasurable (fun x => a x i) μ) : + Lp (Hilbert) 2 μ →L[ℂ] Lp (Hilbert) 2 μ := + (fieldDiagonalLinear a C hC ha hm).mkContinuous C (by + intro f + apply Lp.norm_le_mul_norm_of_ae_le_mul + change ∀ᵐ x ∂μ, ‖fieldDiagonalVec a C hC ha hm f x‖ ≤ C * ‖f x‖ + filter_upwards [fieldDiagonalVec_ae a C hC ha hm f] with x hx + rw [hx] + exact diagonal_bound (a x) C (ha x) (f x)) + +end Invariant233.WeightedShift + +end +end + +section +noncomputable section +open MeasureTheory +open scoped ENNReal + +namespace Invariant233.Rotation + +run_cmd Lean.modifyEnv fun env => Lean.Meta.auxLemmasExt.setState env {} + +instance circleMeasure_probability : IsProbabilityMeasure circleMeasure := by + constructor + change volume (Set.univ : Set Circle) = 1 + exact UnitAddCircle.measure_univ + +abbrev Fiber := WeightedShift.Hilbert +abbrev Hilbert := MeasureTheory.Lp Fiber 2 circleMeasure + +def action (θ : ℝ) (k : ℤ) (x : Circle) : Circle := + x + k • (θ : Circle) + +def U : Hilbert →L[ℂ] Hilbert := + (WeightedShift.shift 1).toLinearIsometry.toContinuousLinearMap.compLpL 2 circleMeasure + +def orbitWeight (θ : ℝ) (a : C(Circle, ℂ)) (x : Circle) : WeightedShift.Weight := + ⟨fun k => a (action θ k x), memℓp_infty <| by + refine ⟨‖a‖, ?_⟩ + rintro r ⟨k, rfl⟩ + exact a.norm_coe_le_norm _⟩ + +def character : C(Circle, ℂ) := fourier 1 + +def representation (θ : ℝ) (a : C(Circle, ℂ)) : Hilbert →L[ℂ] Hilbert := + WeightedShift.fieldDiagonal (orbitWeight θ a) ‖a‖ (norm_nonneg a) + (fun x => lp.norm_le_of_forall_le (norm_nonneg a) (fun k => a.norm_coe_le_norm _)) + (fun k => by + let : T0Space ℝ := @MetricSpace.instT0Space ℝ Real.metricSpace + let : T0Space ℂ := @MetricSpace.instT0Space ℂ Complex.instNormedAddCommGroup.toMetricSpace + change AEStronglyMeasurable (fun x : Circle => a (x + k • (θ : Circle))) circleMeasure + exact (a.continuous.comp (continuous_id.add continuous_const)).aestronglyMeasurable) + +def V (θ : ℝ) : Hilbert →L[ℂ] Hilbert := representation θ character + +def algebra (θ : ℝ) : VonNeumannAlgebra Hilbert := + vonNeumannGenerated ({U, V θ} : Set (Hilbert →L[ℂ] Hilbert)) + +def weighted (θ : ℝ) (a : C(Circle, ℂ)) : Hilbert →L[ℂ] Hilbert := + U * representation θ a + +def complexWeight (f : C(Circle, ℝ)) : C(Circle, ℂ) := + ⟨fun x => (f x : ℂ), Complex.continuous_ofReal.comp f.continuous⟩ + +def weightedReal (θ : ℝ) (f : C(Circle, ℝ)) : Hilbert →L[ℂ] Hilbert := + weighted θ (complexWeight f) + +def vacuum : Hilbert := Lp.const 2 circleMeasure (lp.single 2 (0 : ℤ) (1 : ℂ)) + +def vacuumFunctional (T : Hilbert →L[ℂ] Hilbert) : ℂ := inner ℂ vacuum (T vacuum) + +end Invariant233.Rotation + +end +end + +section +noncomputable section +namespace Invariant233 + +run_cmd Lean.modifyEnv fun env => Lean.Meta.auxLemmasExt.setState env {} + +universe u + +variable {H : Type u} [NormedAddCommGroup H] [InnerProductSpace ℂ H] + [CompleteSpace H] + +def HasOnlyTrivialInvariantProjections (M : VonNeumannAlgebra H) + (T : H →L[ℂ] H) : Prop := + ∀ p : H →L[ℂ] H, p ∈ M → IsStarProjection p → + (1 - p) * T * p = 0 → p = 0 ∨ p = 1 + +def IsProjectionAtom (M : VonNeumannAlgebra H) (p : H →L[ℂ] H) : Prop := + p ∈ M ∧ IsStarProjection p ∧ p ≠ 0 ∧ + ∀ q : H →L[ℂ] H, q ∈ M → IsStarProjection q → q * p = q → + q = 0 ∨ q = p + +def IsAtomicVonNeumannAlgebra (M : VonNeumannAlgebra H) : Prop := + ∀ p : H →L[ℂ] H, p ∈ M → IsStarProjection p → p ≠ 0 → + ∃ q : H →L[ℂ] H, IsProjectionAtom M q ∧ q * p = q + +def IsAbelianVonNeumannAlgebra (M : VonNeumannAlgebra H) : Prop := + ∀ A B : H →L[ℂ] H, A ∈ M → B ∈ M → Commute A B + +def IsDiffuseVonNeumannAlgebra (M : VonNeumannAlgebra H) : Prop := + ∀ p : H →L[ℂ] H, ¬ IsProjectionAtom M p + +def IsFactor (M : VonNeumannAlgebra H) : Prop := + Nontrivial H ∧ ∀ A : H →L[ℂ] H, A ∈ M → + (∀ B : H →L[ℂ] H, B ∈ M → Commute A B) → + ∃ c : ℂ, A = c • (1 : H →L[ℂ] H) + +def vectorTrace (ξ : H) (A : H →L[ℂ] H) : ℂ := + @inner ℂ H InnerProductSpace.toInner ξ (A ξ) + +def IsFaithfulTracialVector (M : VonNeumannAlgebra H) (ξ : H) : Prop := + ‖ξ‖ = 1 ∧ + (∀ A B : H →L[ℂ] H, A ∈ M → B ∈ M → + vectorTrace ξ (A * B) = vectorTrace ξ (B * A)) ∧ + (∀ A : H →L[ℂ] H, A ∈ M → A.IsPositive → + vectorTrace ξ A = 0 → A = 0) + +def IsTypeII1FactorWithVector (M : VonNeumannAlgebra H) (ξ : H) : Prop := + IsFactor M ∧ IsDiffuseVonNeumannAlgebra M ∧ IsFaithfulTracialVector M ξ + +local instance instNormedAlgebraPredual : NormedAlgebra ℂ (H →L[ℂ] H) := + ContinuousLinearMap.toNormedAlgebra + +def HasSeparablePredual (M : VonNeumannAlgebra H) : Prop := + ∃ (X : Type u) (_ : NormedAddCommGroup X) (_ : NormedSpace ℂ X) + (_ : CompleteSpace X) (_ : TopologicalSpace.SeparableSpace X), + Nonempty (StrongDual ℂ X ≃ₗᵢ[ℂ] M.toStarSubalgebra) + +end Invariant233 + +end +end + +section +noncomputable section + +open MeasureTheory +open scoped ENNReal + +namespace Invariant233 + +run_cmd Lean.modifyEnv fun env => Lean.Meta.auxLemmasExt.setState env {} + +structure TracialState (A : Type*) [CStarAlgebra A] where + toContinuousLinearMap : A →L[ℂ] ℂ + map_one : toContinuousLinearMap 1 = 1 + map_star : ∀ a, toContinuousLinearMap (star a) = star (toContinuousLinearMap a) + positive : ∀ a, 0 ≤ (toContinuousLinearMap (star a * a)).re + tracial : ∀ a b, toContinuousLinearMap (a * b) = toContinuousLinearMap (b * a) + +namespace TracialState + +variable {A : Type*} [CStarAlgebra A] + +instance : CoeFun (TracialState A) (fun _ => A → ℂ) := + ⟨fun τ => τ.toContinuousLinearMap⟩ + +end TracialState + +def fugledeKadisonDeterminant {A : Type*} [CStarAlgebra A] + (τ : TracialState A) (a : A) : ℝ≥0∞ := + ⨅ ε : {r : ℝ // 0 < r}, + ENNReal.ofReal (Real.exp ((τ (CFC.log (star a * a + (ε.val : ℝ) • (1 : A)))).re / 2)) + +def logarithmicPotentialDeterminant (μ : Measure ℂ) (z : ℂ) : ℝ≥0∞ := + ⨅ ε : {r : ℝ // 0 < r}, + ENNReal.ofReal (Real.exp ((∫ w, Real.log (‖w - z‖ ^ 2 + ε.val) ∂μ) / 2)) + +def IsBrownMeasure {A : Type*} [CStarAlgebra A] + (τ : TracialState A) (a : A) (μ : Measure ℂ) : Prop := + IsProbabilityMeasure μ ∧ IsCompact μ.support ∧ + ∀ z : ℂ, fugledeKadisonDeterminant τ (a - algebraMap ℂ A z) = + logarithmicPotentialDeterminant μ z + +end Invariant233 + +end +end + +section +noncomputable section +open MeasureTheory +open scoped ENNReal +namespace Invariant233 +variable {H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +run_cmd Lean.modifyEnv fun env => Lean.Meta.auxLemmasExt.setState env {} + +def vectorFugledeKadisonDeterminant (ξ : H) (T : H →L[ℂ] H) : ℝ≥0∞ := + ⨅ ε : {r : ℝ // 0 < r}, ENNReal.ofReal + (Real.exp ((vectorTrace ξ (CFC.log (star T * T + ε.val • (1 : H →L[ℂ] H)))).re / 2)) + +def IsVectorBrownMeasure (ξ : H) (T : H →L[ℂ] H) (μ : Measure ℂ) : Prop := + IsProbabilityMeasure μ ∧ IsCompact μ.support ∧ ∀ z : ℂ, + vectorFugledeKadisonDeterminant ξ (T - z • (1 : H →L[ℂ] H)) = + logarithmicPotentialDeterminant μ z + +def operatorModulus (T : H →L[ℂ] H) : H →L[ℂ] H := CFC.sqrt (star T * T) + +def HasCountablyAtomicSpectralType (B : H →L[ℂ] H) : Prop := + ∃ S : Set ℂ, S.Countable ∧ + (⨆ z : S, Module.End.eigenspace B.toLinearMap z.val).topologicalClosure = ⊤ + +def polarConjugate (U B : H →L[ℂ] H) (n : ℤ) : H →L[ℂ] H := + if 0 ≤ n then U ^ n.toNat * B * star U ^ n.toNat + else star U ^ (-n).toNat * B * U ^ (-n).toNat + +def finitePolarAlgebra (U B : H →L[ℂ] H) (F : Finset ℤ) : VonNeumannAlgebra H := + vonNeumannGenerated {A | ∃ n ∈ F, A = polarConjugate U B n} + +def fullPolarAlgebra (U B : H →L[ℂ] H) : VonNeumannAlgebra H := + vonNeumannGenerated (Set.range (polarConjugate U B)) + +def ProductPolarStructure (U T : H →L[ℂ] H) : Prop := + star U * U = 1 ∧ U * star U = 1 ∧ T = U * operatorModulus T ∧ + Function.Injective (operatorModulus T) ∧ HasCountablyAtomicSpectralType (operatorModulus T) ∧ + (∀ F : Finset ℤ, + IsAbelianVonNeumannAlgebra (finitePolarAlgebra U (operatorModulus T) F) ∧ + IsAtomicVonNeumannAlgebra (finitePolarAlgebra U (operatorModulus T) F)) ∧ + IsAbelianVonNeumannAlgebra (fullPolarAlgebra U (operatorModulus T)) ∧ + IsDiffuseVonNeumannAlgebra (fullPolarAlgebra U (operatorModulus T)) + +end Invariant233 + +end +end + +section +noncomputable section +open MeasureTheory +open scoped ENNReal +namespace Invariant233 + +run_cmd Lean.modifyEnv fun env => Lean.Meta.auxLemmasExt.setState env {} + +def circleRepresentative (x : Circle) : ℝ := + (AddCircle.equivIco (1 : ℝ) 0 x).val + +instance circleMeasure_probability : IsProbabilityMeasure circleMeasure := by + constructor + simp [circleMeasure, Circle, AddCircle.measure_univ] + +namespace ProductModel + +abbrev Base := ℕ → Circle + +def baseMeasure : Measure Base := Measure.infinitePi (fun _ : ℕ => circleMeasure) + +instance baseMeasure_probability : IsProbabilityMeasure baseMeasure := by + unfold baseMeasure + infer_instance + +def Ordered (x y : Base) : Prop := + ∀ i, circleRepresentative (x i) ≤ circleRepresentative (y i) + +def rotation (θ : ℕ → ℝ) (x : Base) : Base := + fun i => x i + (θ i : Circle) + +def rotationIterate (θ : ℕ → ℝ) (k : ℤ) (x : Base) : Base := + fun i => x i + ((k : ℝ) * θ i : ℝ) + +def logarithmicCost (θ c : ℕ → ℝ) (x : Base) : ℝ≥0∞ := + ∑' i, ENNReal.ofReal (c i * (⌊circleRepresentative (x i) + θ i⌋ : ℤ)) + +def weight (θ c : ℕ → ℝ) (x : Base) : ℝ := + (EReal.exp (-(logarithmicCost θ c x : EReal))).toReal + +def JointlyRationallyIndependent (θ : ℕ → ℝ) : Prop := + LinearIndependent ℚ (fun i : Option ℕ => i.elim 1 θ) + +def AdmissibleAnglesAndCosts (θ c : ℕ → ℝ) : Prop := + (∀ i, 0 < θ i ∧ θ i < 1 ∧ 0 < c i) ∧ + Summable θ ∧ JointlyRationallyIndependent θ + +abbrev Fiber := @lp ℤ (fun _ => ℂ) (fun _ => Complex.instNormedAddCommGroup) 2 +abbrev Hilbert := + @MeasureTheory.Lp Base Fiber MeasurableSpace.pi + (@lp.normedAddCommGroup ℤ (fun _ => ℂ) 2 + (fun _ => Complex.instNormedAddCommGroup) fact_one_le_two_ennreal) + 2 baseMeasure + +end ProductModel +end Invariant233 + +end +end + +section +noncomputable section +open MeasureTheory +open scoped ENNReal +namespace Invariant233.ProductModel + +run_cmd Lean.modifyEnv fun env => Lean.Meta.auxLemmasExt.setState env {} + +theorem measurable_rep : Measurable circleRepresentative := + measurable_subtype_coe.comp (AddCircle.measurableEquivIco (T := (1 : ℝ)) 0).measurable + +theorem measurable_iterate (θ : ℕ → ℝ) (k : ℤ) : + Measurable (rotationIterate θ k) := by + let : T0Space ℝ := @MetricSpace.instT0Space ℝ Real.metricSpace + let : BorelSpace Circle := QuotientAddGroup.borelSpace + let : ContinuousAdd Circle := + (QuotientAddGroup.instIsTopologicalAddGroup (AddSubgroup.zmultiples (1 : ℝ))).toContinuousAdd + let : MeasurableAdd Circle := ContinuousAdd.measurableAdd + apply Measurable.of_eval + intro i + exact (measurable_pi_apply i).add_const _ + +theorem measurable_cost (θ c : ℕ → ℝ) : Measurable (logarithmicCost θ c) := by + apply Measurable.tsum + intro i + have hm : Measurable (fun x : Base => circleRepresentative (x i) + θ i) := + (measurable_rep.comp (measurable_pi_apply i)).add_const (θ i) + have hc : Measurable (fun x : Base => (⌊circleRepresentative (x i) + θ i⌋ : ℝ)) := + (measurable_of_countable (fun z : ℤ => (z : ℝ))).comp hm.floor + exact (measurable_const.mul hc).ennreal_ofReal + +theorem weight_measurable (θ c : ℕ → ℝ) : Measurable (weight θ c) := by + exact (measurable_cost θ c).coe_ereal_ennreal.neg.ereal_exp.ennreal_toReal + +theorem weight_nonneg (θ c : ℕ → ℝ) (x : Base) : 0 ≤ weight θ c x := + ENNReal.toReal_nonneg + +theorem weight_le_one (θ c : ℕ → ℝ) (x : Base) : weight θ c x ≤ 1 := by + have h : EReal.exp (-(logarithmicCost θ c x : EReal)) ≤ 1 := by + rw [← EReal.exp_zero] + apply EReal.exp_le_exp_iff.mpr + exact EReal.neg_le_zero.mpr (EReal.coe_ennreal_nonneg (logarithmicCost θ c x)) + exact (ENNReal.toReal_mono (by simp) h).trans (by simp) + +def shiftOperator : Hilbert →L[ℂ] Hilbert := + (WeightedShift.shift 1).toLinearIsometry.toContinuousLinearMap.compLpL 2 baseMeasure + +def multiplierField (θ : ℕ → ℝ) (g : Base → ℂ) (C : ℝ) + (hb : ∀ x, ‖g x‖ ≤ C) (x : Base) : WeightedShift.Weight := + ⟨fun k => g (rotationIterate θ k x), memℓp_infty <| by + refine ⟨C, ?_⟩ + rintro r ⟨k, rfl⟩ + exact hb _⟩ + +def multiplier (θ : ℕ → ℝ) (g : Base → ℂ) (C : ℝ) (hC : 0 ≤ C) + (hg : Measurable g) (hb : ∀ x, ‖g x‖ ≤ C) : Hilbert →L[ℂ] Hilbert := + WeightedShift.fieldDiagonal (multiplierField θ g C hb) C hC + (fun _x => lp.norm_le_of_forall_le hC (fun _k => hb _)) + (fun k => (hg.comp (measurable_iterate θ k)).aestronglyMeasurable) + +def multiplierGenerators (θ : ℕ → ℝ) : Set (Hilbert →L[ℂ] Hilbert) := + {A | ∃ (g : Base → ℂ) (C : ℝ) (hC : 0 ≤ C) (hg : Measurable g) + (hb : ∀ x, ‖g x‖ ≤ C), A = multiplier θ g C hC hg hb} + +def factor (θ : ℕ → ℝ) : VonNeumannAlgebra Hilbert := + vonNeumannGenerated ({shiftOperator} ∪ multiplierGenerators θ) + +def traceVector : Hilbert := Lp.const 2 baseMeasure (lp.single 2 0 (1 : ℂ)) + +theorem measurable_complexWeight (θ c : ℕ → ℝ) : + Measurable (fun x => (weight θ c x : ℂ)) := + (weight_measurable θ c).complex_ofReal + +theorem norm_complexWeight_le_one (θ c : ℕ → ℝ) (x : Base) : + ‖(weight θ c x : ℂ)‖ ≤ 1 := by + simpa only [Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (weight_nonneg θ c x)] + using weight_le_one θ c x + +local instance instNormedAddCommGroupProductWeightedOperator : NormedAddCommGroup Hilbert := + @MeasureTheory.Lp.instNormedAddCommGroup Base Fiber MeasurableSpace.pi 2 baseMeasure + (@lp.normedAddCommGroup ℤ (fun _ => ℂ) 2 + (fun _ => Complex.instNormedAddCommGroup) fact_one_le_two_ennreal) + fact_one_le_two_ennreal + +local instance instInnerProductSpaceProductWeightedOperator : + @InnerProductSpace ℂ Hilbert Complex.instRCLike + instNormedAddCommGroupProductWeightedOperator.toSeminormedAddCommGroup := + @MeasureTheory.L2.innerProductSpace Base Fiber ℂ Complex.instRCLike MeasurableSpace.pi + baseMeasure + (@lp.normedAddCommGroup ℤ (fun _ => ℂ) 2 + (fun _ => Complex.instNormedAddCommGroup) fact_one_le_two_ennreal) + (@lp.instInnerProductSpace ℤ ℂ Complex.instRCLike (fun _ => ℂ) + (fun _ => Complex.instNormedAddCommGroup) + (fun _ => @RCLike.innerProductSpace ℂ Complex.instRCLike)) + +local instance instTopologicalSpaceProductWeightedOperator : TopologicalSpace Hilbert := + instNormedAddCommGroupProductWeightedOperator.toUniformSpace.toTopologicalSpace + +local instance instAddCommMonoidProductWeightedOperator : AddCommMonoid Hilbert := + instNormedAddCommGroupProductWeightedOperator.toAddCommGroup.toAddCommMonoid + +local instance instModuleProductWeightedOperator : Module ℂ Hilbert := + instInnerProductSpaceProductWeightedOperator.toNormedSpace.toModule + +local notation "weightedOperatorSemiring" => + Complex.instNormedField.toField.toCommRing.toRing.toSemiring + +local notation "weightedOperatorScalarIdentity" => + @RingHom.id ℂ (@Semiring.toNonAssocSemiring ℂ weightedOperatorSemiring) + +run_cmd Lean.modifyEnv fun env => Lean.Meta.auxLemmasExt.setState env {} + +def weightedOperator (θ c : ℕ → ℝ) : + @ContinuousLinearMap ℂ ℂ weightedOperatorSemiring weightedOperatorSemiring + weightedOperatorScalarIdentity + Hilbert instTopologicalSpaceProductWeightedOperator instAddCommMonoidProductWeightedOperator + Hilbert instTopologicalSpaceProductWeightedOperator instAddCommMonoidProductWeightedOperator + instModuleProductWeightedOperator instModuleProductWeightedOperator := + let compose := fun (Scalar : Type) [Semiring Scalar] (Space : Type) + [TopologicalSpace Space] [AddCommMonoid Space] [Module Scalar Space] + (left right : Space →L[Scalar] Space) => left ∘L right + @compose ℂ weightedOperatorSemiring Hilbert instTopologicalSpaceProductWeightedOperator + instAddCommMonoidProductWeightedOperator instModuleProductWeightedOperator + shiftOperator (multiplier θ (fun x => (weight θ c x : ℂ)) 1 zero_le_one + (measurable_complexWeight θ c) (norm_complexWeight_le_one θ c)) + +end Invariant233.ProductModel + +end +end + +section +noncomputable section +open Filter MeasureTheory +open scoped ENNReal Topology BigOperators + +namespace Invariant233.ProductModel + +run_cmd Lean.modifyEnv fun env => Lean.Meta.auxLemmasExt.setState env {} + +abbrev EndpointPair := Base × Base + +def selectedEndpoint (I : Finset ℕ) (x z : Base) : Base := + fun i => if i ∈ I then z i else x i + +def triangularEvent (I : Finset ℕ) : Set EndpointPair := + {xz | ∀ i ∈ I, circleRepresentative (xz.1 i) < circleRepresentative (xz.2 i)} + +def triangularLaw (I : Finset ℕ) : Measure EndpointPair := + Measure.map (fun xz : EndpointPair => (xz.1, selectedEndpoint I xz.1 xz.2)) + ((baseMeasure.prod baseMeasure).restrict (triangularEvent I)) + +def triangularFirstDensity (I : Finset ℕ) (x : Base) : ℝ := + ∏ i ∈ I, (1 - circleRepresentative (x i)) + +def triangularSecondDensity (I : Finset ℕ) (y : Base) : ℝ := + ∏ i ∈ I, circleRepresentative (y i) + +def TriangularLawProperties (I : Finset ℕ) : Prop := + IsFiniteMeasure (triangularLaw I) ∧ + triangularLaw I Set.univ = (1 / 2 : ℝ≥0∞) ^ I.card ∧ + (triangularLaw I).map Prod.fst = + baseMeasure.withDensity (fun x => ENNReal.ofReal (triangularFirstDensity I x)) ∧ + (triangularLaw I).map Prod.snd = + baseMeasure.withDensity (fun y => ENNReal.ofReal (triangularSecondDensity I y)) ∧ + (∀ᵐ xy ∂triangularLaw I, Ordered xy.1 xy.2) ∧ + (∀ x, 0 ≤ triangularFirstDensity I x ∧ triangularFirstDensity I x ≤ 1) ∧ + (∀ y, 0 ≤ triangularSecondDensity I y ∧ triangularSecondDensity I y ≤ 1) + +def WeaklyConverges (η : ℕ → Measure EndpointPair) (ν : Measure EndpointPair) : Prop := + ∀ φ : C(EndpointPair, ℝ), + Tendsto (fun l => ∫ xy, φ xy ∂η l) atTop (𝓝 (∫ xy, φ xy ∂ν)) + +def SupportedOnPositiveOrderedOrbitPairs (θ : ℕ → ℝ) (η : Measure EndpointPair) : Prop := + ∃ N : Finset ℕ, (∀ n ∈ N, 0 < n) ∧ + ∀ᵐ xy ∂η, Ordered xy.1 xy.2 ∧ + ∃ n ∈ N, xy.2 = rotationIterate θ (n : ℤ) xy.1 + +def HasUniformL2Marginals (η : ℕ → Measure EndpointPair) : Prop := + ∃ H : ℝ, 0 ≤ H ∧ ∀ l, ∃ f g : Lp ℝ 2 baseMeasure, + (∀ᵐ x ∂baseMeasure, 0 ≤ f x) ∧ (∀ᵐ y ∂baseMeasure, 0 ≤ g y) ∧ + (η l).map Prod.fst = baseMeasure.withDensity (fun x => ENNReal.ofReal (f x)) ∧ + (η l).map Prod.snd = baseMeasure.withDensity (fun y => ENNReal.ofReal (g y)) ∧ + ‖f‖ ≤ H ∧ ‖g‖ ≤ H + +def OrderedOrbitSampling (θ : ℕ → ℝ) (I : Finset ℕ) : Prop := + ∃ η : ℕ → Measure EndpointPair, + (∀ l, IsFiniteMeasure (η l)) ∧ + (∀ l, SupportedOnPositiveOrderedOrbitPairs θ (η l)) ∧ + HasUniformL2Marginals η ∧ WeaklyConverges η (triangularLaw I) + +def HasAllFiniteCoordinateSampling (θ : ℕ → ℝ) : Prop := + ∀ I : Finset ℕ, OrderedOrbitSampling θ I + +end Invariant233.ProductModel + +end +end + +section +noncomputable section +open MeasureTheory +namespace Invariant233.ProductModel + +def IsCovariantFieldRepresentation (θ : ℕ → ℝ) (A : Hilbert →L[ℂ] Hilbert) + (F : Base → Fiber →L[ℂ] Fiber) (B : ℝ) : Prop := + 0 ≤ B ∧ (∀ x, ‖F x‖ ≤ B) ∧ + (∀ v : Fiber, StronglyMeasurable (fun x => F x v)) ∧ + (∀ f : Hilbert, A f =ᵐ[baseMeasure] fun x => F x (f x)) ∧ + (∀ᵐ x ∂baseMeasure, + F (rotation θ x) = + (WeightedShift.shift (-1)).toLinearIsometry.toContinuousLinearMap * F x * + (WeightedShift.shift 1).toLinearIsometry.toContinuousLinearMap) + +def centralDiagonalIntegral (F : Base → Fiber →L[ℂ] Fiber) : ℂ := + ∫ x, inner ℂ (lp.single 2 0 (1 : ℂ) : Fiber) + (F x (lp.single 2 0 (1 : ℂ) : Fiber)) ∂baseMeasure + +end Invariant233.ProductModel + +end +end + +namespace Invariant233 + +run_cmd Lean.modifyEnv fun env => Lean.Meta.auxLemmasExt.setState env {} + +def Rotation.IsContinuousCounterexample (θ : ℝ) (f : C(Circle, ℝ)) : Prop := + IsContinuousCircleWeight f ∧ + let operator : Rotation.Hilbert →L[ℂ] Rotation.Hilbert := Rotation.weightedReal θ f + let factor : VonNeumannAlgebra Rotation.Hilbert := Rotation.algebra θ + operator ∈ factor ∧ + HasOnlyTrivialInvariantProjections (H := Rotation.Hilbert) factor operator ∧ + operator ≠ 0 ∧ + NormQuasinilpotent (A := Rotation.Hilbert →L[ℂ] Rotation.Hilbert) operator ∧ + vectorFugledeKadisonDeterminant (H := Rotation.Hilbert) Rotation.vacuum operator = 0 + +run_cmd Lean.modifyEnv fun env => Lean.Meta.auxLemmasExt.setState env {} + +local instance ProductModel.instFactOneLeTwoCounterexample : + Fact (1 ≤ (2 : ENNReal)) := ⟨by norm_num⟩ + +abbrev ProductModel.CounterexampleFiber : Type := + @lp ℤ (fun _ => ℂ) (fun _ => Complex.instNormedAddCommGroup) 2 + +abbrev ProductModel.CounterexampleHilbert : Type := + @MeasureTheory.Lp ProductModel.Base ProductModel.CounterexampleFiber MeasurableSpace.pi + (@lp.normedAddCommGroup ℤ (fun _ => ℂ) 2 + (fun _ => Complex.instNormedAddCommGroup) ProductModel.instFactOneLeTwoCounterexample) + 2 ProductModel.baseMeasure + +instance ProductModel.instCompleteSpaceHilbertCounterexample : + CompleteSpace ProductModel.CounterexampleHilbert := inferInstance + +def ProductOperatorProperties {H : Type*} [NormedAddCommGroup H] + [InnerProductSpace ℂ H] [CompleteSpace H] (factor : VonNeumannAlgebra H) + (traceVector : H) (shift operator : H →L[ℂ] H) : Prop := + IsTypeII1FactorWithVector factor traceVector ∧ + HasSeparablePredual factor ∧ + operator ∈ factor ∧ operator ≠ 0 ∧ + NormQuasinilpotent operator ∧ + vectorFugledeKadisonDeterminant traceVector operator = 0 ∧ + spectrum ℂ operator = {0} ∧ + IsVectorBrownMeasure traceVector operator (MeasureTheory.Measure.dirac 0) ∧ + HasOnlyTrivialInvariantProjections factor operator ∧ + ProductPolarStructure shift operator + +@[instance_reducible] +noncomputable def ProductModel.counterexampleHilbertNormedAddCommGroup : + NormedAddCommGroup ProductModel.CounterexampleHilbert := + @MeasureTheory.Lp.instNormedAddCommGroup ProductModel.Base ProductModel.CounterexampleFiber + MeasurableSpace.pi 2 ProductModel.baseMeasure + (@lp.normedAddCommGroup ℤ (fun _ => ℂ) 2 + (fun _ => Complex.instNormedAddCommGroup) ProductModel.instFactOneLeTwoCounterexample) + ProductModel.instFactOneLeTwoCounterexample + +@[instance_reducible] +noncomputable def ProductModel.counterexampleHilbertInnerProductSpace : + @InnerProductSpace ℂ ProductModel.CounterexampleHilbert Complex.instRCLike + ProductModel.counterexampleHilbertNormedAddCommGroup.toSeminormedAddCommGroup := + @MeasureTheory.L2.innerProductSpace ProductModel.Base ProductModel.CounterexampleFiber ℂ + Complex.instRCLike MeasurableSpace.pi ProductModel.baseMeasure + (@lp.normedAddCommGroup ℤ (fun _ => ℂ) 2 + (fun _ => Complex.instNormedAddCommGroup) ProductModel.instFactOneLeTwoCounterexample) + (@lp.instInnerProductSpace ℤ ℂ Complex.instRCLike (fun _ => ℂ) + (fun _ => Complex.instNormedAddCommGroup) + (fun _ => @RCLike.innerProductSpace ℂ Complex.instRCLike)) + +def ProductModel.HasCounterexampleOperator (θ c : ℕ → ℝ) : Prop := + @ProductOperatorProperties ProductModel.CounterexampleHilbert + ProductModel.counterexampleHilbertNormedAddCommGroup + ProductModel.counterexampleHilbertInnerProductSpace + ProductModel.instCompleteSpaceHilbertCounterexample (ProductModel.factor θ) + ProductModel.traceVector ProductModel.shiftOperator (ProductModel.weightedOperator θ c) + +def ProductModel.IsCounterexampleRealization (θ c : ℕ → ℝ) : Prop := + ProductModel.AdmissibleAnglesAndCosts θ c ∧ + ProductModel.HasAllFiniteCoordinateSampling θ ∧ + Filter.Eventually (fun x : ProductModel.Base => 0 < ProductModel.weight θ c x) + (@MeasureTheory.ae ProductModel.Base + (@MeasureTheory.Measure ProductModel.Base MeasurableSpace.pi) + MeasureTheory.Measure.instFunLike MeasureTheory.Measure.instOuterMeasureClass + ProductModel.baseMeasure) ∧ + @HasNegInfiniteLogIntegral ProductModel.Base MeasurableSpace.pi + ProductModel.baseMeasure (ProductModel.weight θ c) ∧ + ProductModel.HasCounterexampleOperator θ c + +end Invariant233 + +namespace Invariant233.Results + +theorem prescribed_irrational_counterexample (θ : ℝ) + (hθ0 : 0 < θ) (hθ1 : θ < 1) (hθ : Irrational θ) : + ∃ f : C(Circle, ℝ), Rotation.IsContinuousCounterexample θ f := by + sorry + +theorem product_realization : + ∃ θ c : ℕ → ℝ, ProductModel.IsCounterexampleRealization θ c := by + sorry + +end Invariant233.Results + +end OAI diff --git a/lean/ComparatorChallenges/IrrationalTriangleBilliard.json b/lean/ComparatorChallenges/IrrationalTriangleBilliard.json new file mode 100644 index 0000000000000000000000000000000000000000..ae782fc475a947e29457ceffa71feb2a3bef198a --- /dev/null +++ b/lean/ComparatorChallenges/IrrationalTriangleBilliard.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.IrrationalTriangleBilliard", + "solution_module": "OAI.Dynamics.TriangleBilliards.Main", + "theorem_names": [ + "OAI.TriangularBilliards.irrational_triangle_billiard" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/IrrationalTriangleBilliard.lean b/lean/ComparatorChallenges/IrrationalTriangleBilliard.lean new file mode 100644 index 0000000000000000000000000000000000000000..c6a31c100effc9528ebb602b3c401d2176aee0c8 --- /dev/null +++ b/lean/ComparatorChallenges/IrrationalTriangleBilliard.lean @@ -0,0 +1,126 @@ +import Mathlib + +namespace OAI + +/-! +The phase space is represented in the ambient plane × circle, with measure +supported on the interior of the triangle. Values on side-collision states +at a fixed time are immaterial to the modulo-null-set conclusion. The +trajectories themselves include the collisions and impose specular reflection. +-/ + +open MeasureTheory Set +open scoped ENNReal symmDiff + +noncomputable section + +namespace TriangularBilliards + +/-- Three affinely independent vertices in the Euclidean plane. -/ +structure Triangle where + vertex : Fin 3 → ℂ + nondegenerate : AffineIndependent ℝ vertex + +namespace Triangle + +/-- The open table; the complex plane carries its ordinary real Euclidean metric. -/ +def table (Q : Triangle) : Set ℂ := interior (convexHull ℝ (range Q.vertex)) + +/-- The open side from vertex `i` to the next vertex, indexed cyclically. -/ +def side (Q : Triangle) (i : Fin 3) : Set ℂ := + openSegment ℝ (Q.vertex i) (Q.vertex (i + 1)) + +/-- A tangent vector to side `i`, with no choice of inward or outward normal. -/ +def tangent (Q : Triangle) (i : Fin 3) : ℂ := Q.vertex (i + 1) - Q.vertex i + +/-- Interior angle at vertex `i`. -/ +def angle (Q : Triangle) (i : Fin 3) : ℝ := + InnerProductGeometry.angle (Q.vertex (i + 1) - Q.vertex i) + (Q.vertex (i + 2) - Q.vertex i) + +def HasIrrationalAngle (Q : Triangle) : Prop := + ∃ i : Fin 3, Irrational (Q.angle i / Real.pi) + +end Triangle + +/-- Reflection in the real line spanned by the nonzero tangent `e`. +In coordinates with `e` real this is complex conjugation, preserving the +tangential component and reversing the normal component. -/ +def reflect (e v : ℂ) : ℂ := (e / star e) * star v + +instance circleMeasurableSpace : MeasurableSpace Circle := borel Circle + +instance circleBorelSpace : BorelSpace Circle := ⟨rfl⟩ + +abbrev Phase := ℂ × Circle + +/-- A complete nonsingular billiard trajectory, indexed by its collisions. +Flight zero contains the initial time strictly. Both ends of the collision +time sequence are unbounded; collisions occur only in open sides, never +vertices. These are geometric conditions, not ergodicity/analytic assumptions. -/ +structure FlightChain (Q : Triangle) (z : Phase) where + time : ℤ → ℝ + point : ℤ → ℂ + direction : ℤ → Circle + wall : ℤ → Fin 3 + increasing : StrictMono time + unbounded_below : ∀ t : ℝ, ∃ n : ℤ, time n < t + unbounded_above : ∀ t : ℝ, ∃ n : ℤ, t < time n + zero_before : time 0 < 0 + zero_after : 0 < time 1 + on_side : ∀ n : ℤ, point n ∈ Q.side (wall n) + flight : ∀ n : ℤ, + point (n + 1) = point n + (time (n + 1) - time n) • (direction n : ℂ) + inside : ∀ (n : ℤ) (t : ℝ), time n < t → t < time (n + 1) → + point n + (t - time n) • (direction n : ℂ) ∈ Q.table + start_point : z.1 = point 0 + (-time 0) • (direction 0 : ℂ) + start_direction : z.2 = direction 0 + specular : ∀ n : ℤ, + (direction n : ℂ) = reflect (Q.tangent (wall n)) (direction (n - 1) : ℂ) + +/-- The geometric state on a chain, using outgoing velocity at a collision. -/ +def FlightChain.at {Q : Triangle} {z : Phase} (c : FlightChain Q z) (t : ℝ) : Phase := by + classical + exact if h : ∃ n : ℤ, c.time n ≤ t ∧ t < c.time (n + 1) then + let n := Classical.choose h + (c.point n + (t - c.time n) • (c.direction n : ℂ), c.direction n) + else z + +/-- The actual specular flow on complete regular chains. Singular initial +states are assigned their initial state; the theorem must prove these form +a null set. No nonemptiness of the regular set is postulated. -/ +def billiardFlow (Q : Triangle) (t : ℝ) (z : Phase) : Phase := by + classical + exact if h : Nonempty (FlightChain Q z) then (Classical.choice h).at t else z + +/-- Uniform angular probability, parameterized by [0,2π). -/ +def angularMeasure : Measure Circle := + Measure.map Circle.exp + ((ENNReal.ofReal (2 * Real.pi))⁻¹ • volume.restrict (Ico 0 (2 * Real.pi))) + +/-- Exactly normalized area in the open table times uniform angular measure. -/ +def phaseMeasure (Q : Triangle) : Measure Phase := + ((volume Q.table)⁻¹ • volume.restrict Q.table).prod angularMeasure + +/-- The main conclusion, together with the geometric/nonvacuity guarantees +needed by the concrete definition of the actual two-sided billiard. -/ + +def MainConclusion (Q : Triangle) : Prop := + phaseMeasure Q univ = 1 ∧ + (∀ᵐ z ∂phaseMeasure Q, Nonempty (FlightChain Q z)) ∧ + (∀ (z : Phase) (c d : FlightChain Q z), c = d) ∧ + (∀ t : ℝ, MeasurePreserving (billiardFlow Q t) (phaseMeasure Q) (phaseMeasure Q)) ∧ + (∀ s t : ℝ, billiardFlow Q (s + t) =ᵐ[phaseMeasure Q] + (billiardFlow Q s ∘ billiardFlow Q t)) ∧ + (∀ A : Set Phase, MeasurableSet A → + (∀ t : ℝ, phaseMeasure Q (((billiardFlow Q t) ⁻¹' A) ∆ A) = 0) → + phaseMeasure Q A = 0 ∨ phaseMeasure Q A = 1) + +theorem irrational_triangle_billiard (Q : Triangle) (hQ : Q.HasIrrationalAngle) : + MainConclusion Q := by + sorry + +end TriangularBilliards +end + +end OAI diff --git a/lean/ComparatorChallenges/IsingFiniteness.json b/lean/ComparatorChallenges/IsingFiniteness.json new file mode 100644 index 0000000000000000000000000000000000000000..e92b742c2f00e0287193aedd9f31457706ed6f8c --- /dev/null +++ b/lean/ComparatorChallenges/IsingFiniteness.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.IsingFiniteness", + "solution_module": "OAI.Probability.IsingPerceptron.VariationalFiniteness", + "theorem_names": [ + "OAI.IsingPerceptron.variationalValue_real_of_continuous" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/IsingFiniteness.lean b/lean/ComparatorChallenges/IsingFiniteness.lean new file mode 100644 index 0000000000000000000000000000000000000000..0374f095bb59fa18877420d08d5696c2c9cb256a --- /dev/null +++ b/lean/ComparatorChallenges/IsingFiniteness.lean @@ -0,0 +1,94 @@ +import Mathlib + +namespace OAI + +open MeasureTheory ProbabilityTheory Filter +open scoped BigOperators Topology ENNReal + +noncomputable section +namespace IsingPerceptron + +def gaussianTransform (s d : ℝ) (U : ℝ → ℝ) (x : ℝ) : ℝ := + if d = 0 then ∫ z, U (x + Real.sqrt s * z) ∂gaussianReal 0 1 + else (Real.log (∫ z, Real.exp (d * U (x + Real.sqrt s * z)) + ∂gaussianReal 0 1)) / d + +structure Partition where + levels : ℕ + positive : 0 < levels + cut : Fin (levels + 1) → ℝ + ordered : StrictMono cut + first : cut ⟨0, Nat.zero_lt_succ levels⟩ = 0 + last : cut ⟨levels, Nat.lt_succ_self levels⟩ = 1 + +structure FieldStep where + partition : Partition + value : Fin partition.levels → ℝ + nonneg : ∀ i, 0 ≤ value i + ordered : Monotone value + + +def stepAt (h : FieldStep) (i : ℕ) : ℝ := + if hi : i < h.partition.levels then h.value ⟨i, hi⟩ else 0 + + + +def stepFunction (h : FieldStep) (u : ℝ) : ℝ := + ∑ i : Fin h.partition.levels, + if h.partition.cut i.castSucc < u ∧ u < h.partition.cut i.succ then h.value i else 0 + + +def fieldRecursion (h : FieldStep) : ℝ := + let k := h.partition.levels + let increments := List.ofFn (fun i : Fin k => + (stepAt h i - (if i.val = 0 then 0 else stepAt h (i.val - 1)), + h.partition.cut i.castSucc)) + increments.foldr (fun sd U => gaussianTransform sd.1 sd.2 U) + (fun x => Real.log (Real.cosh x) - stepAt h (k - 1) / 2) 0 + +def pathMeasure : Measure ℝ := volume.restrict (Set.Ioo (0 : ℝ) 1) + + +structure OverlapPath where + val : ℝ →ₘ[pathMeasure] ℝ + admissible : ∃ q : ℝ → ℝ, + (q =ᵐ[pathMeasure] val) ∧ MonotoneOn q (Set.Ioo 0 1) ∧ + ∀ u ∈ Set.Ioo (0 : ℝ) 1, q u ∈ Set.Icc (0 : ℝ) 1 + + +def cellAverage (q : OverlapPath) (k i : ℕ) : ℝ := + (k : ℝ) * ∫ u in Set.Ioo ((i : ℝ) / k) (((i : ℝ) + 1) / k), + q.val u ∂pathMeasure + + + +def uniformPattern (f : ℝ → ℝ) (q : OverlapPath) (n : ℕ) : ℝ := + let k := n + 1 + let levelVal := fun i => if i < k then cellAverage q k i else 1 + let increments := List.ofFn (fun i : Fin (k + 1) => + (levelVal i - (if i.val = 0 then 0 else levelVal (i.val - 1)), (i : ℝ) / k)) + increments.foldr (fun sd U => gaussianTransform sd.1 sd.2 U) f 0 + + + +def patternFunctional (f : ℝ → ℝ) (q : OverlapPath) : ℝ := + Filter.limUnder atTop (uniformPattern f q) + + + +def isingEntropy (q : OverlapPath) : EReal := + ⨆ h : FieldStep, + ((fieldRecursion h + (∫ u, stepFunction h u * q.val u ∂pathMeasure) / 2 : ℝ) : EReal) + +def variationalValue (α : ℝ) (f : ℝ → ℝ) : EReal := + ⨅ q : OverlapPath, (α * patternFunctional f q : ℝ) + isingEntropy q + +theorem variationalValue_real_of_continuous {α : ℝ} (hα : 0 ≤ α) + {f : ℝ → ℝ} (hf : Continuous f) (hbounded : ∃ K : ℝ, ∀ x, |f x| ≤ K) : + ∃ p : ℝ, variationalValue α f = (p : EReal) := by + sorry + +end IsingPerceptron +end + +end OAI diff --git a/lean/ComparatorChallenges/IsometricImmersion.json b/lean/ComparatorChallenges/IsometricImmersion.json new file mode 100644 index 0000000000000000000000000000000000000000..a18a75d25f5c27d3120b00bd90b30f285c45e422 --- /dev/null +++ b/lean/ComparatorChallenges/IsometricImmersion.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.IsometricImmersion", + "solution_module": "OAI.Geometry.IsometricImmersion.Main", + "theorem_names": [ + "OAI.SmoothLocal.Geometry.exists_local_metric_without_local_immersion" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/IsometricImmersion.lean b/lean/ComparatorChallenges/IsometricImmersion.lean new file mode 100644 index 0000000000000000000000000000000000000000..9b41ea032ce83b10a0df6e06f30c23cde9dde2e3 --- /dev/null +++ b/lean/ComparatorChallenges/IsometricImmersion.lean @@ -0,0 +1,62 @@ +import Mathlib.Analysis.InnerProductSpace.Calculus +import Mathlib.LinearAlgebra.Matrix.PosDef +import Mathlib.LinearAlgebra.Matrix.NonsingularInverse +import Mathlib.Geometry.Manifold.ContMDiff.NormedSpace +import Mathlib.Geometry.Manifold.MFDeriv.FDeriv + +namespace OAI + +noncomputable section +open Set TopologicalSpace +open scoped ContDiff Topology Manifold Matrix + +namespace SmoothLocal.Geometry + +abbrev Coord := Fin 2 → ℝ + +abbrev Ambient := EuclideanSpace ℝ (Fin 3) + +def square : Set Coord := {p | ∀ i, p i ∈ Set.Ioo (-1 : ℝ) 1} + +def LocalSmoothPositive (U : Opens Coord) + (g : U → Matrix (Fin 2) (Fin 2) ℝ) : Prop := + (∀ i j, ContMDiff 𝓘(ℝ, Coord) 𝓘(ℝ, ℝ) ∞ (fun p => g p i j)) ∧ + ∀ p, (g p).PosDef + +end SmoothLocal.Geometry + +namespace SmoothLocal.ODE +open SmoothLocal.Geometry + +theorem coordinate_square_isOpen : IsOpen square := by + have heq : square = ⋂ i : Fin 2, + (fun p : Coord => p i) ⁻¹' Ioo (-1 : ℝ) 1 := by + ext p + simp [square] + rw [heq] + exact isOpen_iInter_of_finite (fun i => isOpen_Ioo.preimage (continuous_apply i)) + +end SmoothLocal.ODE + +namespace SmoothLocal.Geometry + +def coordinateSquareOpen : Opens Coord := + ⟨square, SmoothLocal.ODE.coordinate_square_isOpen⟩ + +theorem exists_local_metric_without_local_immersion : + ∃ g : coordinateSquareOpen → Matrix (Fin 2) (Fin 2) ℝ, + LocalSmoothPositive coordinateSquareOpen g ∧ + ∀ U : Opens Coord, ∀ hUS : (U : Set Coord) ⊆ square, + (0 : Coord) ∈ U → ∀ F : U → Ambient, + ¬ (ContMDiff 𝓘(ℝ, Coord) 𝓘(ℝ, Ambient) ∞ F ∧ + ∀ p : U, ∀ v w : Coord, + (inner ℝ : Ambient → Ambient → ℝ) (mfderiv 𝓘(ℝ, Coord) 𝓘(ℝ, Ambient) F p v) + (mfderiv 𝓘(ℝ, Coord) 𝓘(ℝ, Ambient) F p w) = + v ⬝ᵥ (g ⟨p, hUS p.property⟩ *ᵥ w)) := by + sorry + +end SmoothLocal.Geometry + +end + +end OAI diff --git a/lean/ComparatorChallenges/Jacobsthal.json b/lean/ComparatorChallenges/Jacobsthal.json new file mode 100644 index 0000000000000000000000000000000000000000..54fe1a43894db11e59ee505c3a04361ac0e9a0f3 --- /dev/null +++ b/lean/ComparatorChallenges/Jacobsthal.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.Jacobsthal", + "solution_module": "OAI.NumberTheory.Jacobsthal.Main", + "theorem_names": [ + "OAI.Erdos970.Erdos970Final.erdos_970_quadratic" + ], + "definition_names": [], + "enable_nanoda": false, + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ] +} diff --git a/lean/ComparatorChallenges/Jacobsthal.lean b/lean/ComparatorChallenges/Jacobsthal.lean new file mode 100644 index 0000000000000000000000000000000000000000..f647dedd8b5c4b9ee24394ee5ebbe9acef1d98d9 --- /dev/null +++ b/lean/ComparatorChallenges/Jacobsthal.lean @@ -0,0 +1,31 @@ +import Mathlib + +namespace OAI + +namespace Erdos970 + +namespace NumberTheoryLean.Targets + +open Filter +open scoped Topology + +def IsJacobsthalBound (k m : ℕ) : Prop := + ∀ n : ℕ, 0 < n → n.primeFactors.card ≤ k → + ∀ a : ℤ, ∃ i : ℕ, i < m ∧ (a + i).natAbs.Coprime n + +def JacobsthalQuadratic : Prop := + ∃ C : ℝ, 0 < C ∧ ∀ k : ℕ, 0 < k → + ∃ m : ℕ, IsJacobsthalBound k m ∧ (m : ℝ) ≤ C * (k : ℝ) ^ 2 + +end NumberTheoryLean.Targets + +namespace Erdos970Final + +theorem erdos_970_quadratic : NumberTheoryLean.Targets.JacobsthalQuadratic := by + sorry + +end Erdos970Final + +end Erdos970 + +end OAI diff --git a/lean/ComparatorChallenges/JacobsthalImproved.json b/lean/ComparatorChallenges/JacobsthalImproved.json new file mode 100644 index 0000000000000000000000000000000000000000..b1a407541356714335e8c5c199cd28f6dffe8537 --- /dev/null +++ b/lean/ComparatorChallenges/JacobsthalImproved.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.JacobsthalImproved", + "solution_module": "OAI.NumberTheory.Jacobsthal.Main", + "theorem_names": [ + "OAI.Erdos970.Erdos970Final.erdos_970_iterated_log" + ], + "definition_names": [], + "enable_nanoda": false, + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ] +} diff --git a/lean/ComparatorChallenges/JacobsthalImproved.lean b/lean/ComparatorChallenges/JacobsthalImproved.lean new file mode 100644 index 0000000000000000000000000000000000000000..19d9476651c3265d80c76d56051e957a1a5f2ad0 --- /dev/null +++ b/lean/ComparatorChallenges/JacobsthalImproved.lean @@ -0,0 +1,29 @@ +import Mathlib + +namespace OAI + +namespace Erdos970 + +namespace NumberTheoryLean.Targets + +def IsJacobsthalBound (k m : ℕ) : Prop := + ∀ n : ℕ, 0 < n → n.primeFactors.card ≤ k → + ∀ a : ℤ, ∃ i : ℕ, i < m ∧ (a + i).natAbs.Coprime n + +def JacobsthalIteratedLog : Prop := + ∃ C : ℝ, 0 < C ∧ ∀ k : ℕ, 0 < k → + ∃ m : ℕ, IsJacobsthalBound k m ∧ + (m : ℝ) ≤ C * (k : ℝ) ^ 2 / (Real.log (Real.log (3 * (k : ℝ)))) ^ 2 + +end NumberTheoryLean.Targets + +namespace Erdos970Final + +theorem erdos_970_iterated_log : NumberTheoryLean.Targets.JacobsthalIteratedLog := by + sorry + +end Erdos970Final + +end Erdos970 + +end OAI diff --git a/lean/ComparatorChallenges/JointDickman.json b/lean/ComparatorChallenges/JointDickman.json new file mode 100644 index 0000000000000000000000000000000000000000..7267219acc9f42d882a8704c66c94435235d5b9c --- /dev/null +++ b/lean/ComparatorChallenges/JointDickman.json @@ -0,0 +1,16 @@ +{ + "challenge_module": "ComparatorChallenges.JointDickman", + "solution_module": "OAI.NumberTheory.JointDickman.PaperMain", + "theorem_names": [ + "OAI.JointDickmanPaper.joint_law", + "OAI.JointDickmanPaper.increasing_order", + "OAI.JointDickmanPaper.decreasing_order" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/JointDickman.lean b/lean/ComparatorChallenges/JointDickman.lean new file mode 100644 index 0000000000000000000000000000000000000000..df9a8e2616a7485c59f8fc9c50291eb7601cb1ce --- /dev/null +++ b/lean/ComparatorChallenges/JointDickman.lean @@ -0,0 +1,65 @@ +import Mathlib + +namespace OAI + +/-! # The joint Dickman law for consecutive integers -/ + +namespace Erdos970.NumberTheoryLean.DelayConstruction + +noncomputable def kernel (f : ℝ → ℝ) (t : ℝ) : ℝ := f (t - 1) / max 1 t + +noncomputable def stepApprox (σ : ℝ) : ℕ → ℝ → ℝ + | 0 => fun _ => 1 + | n + 1 => fun u => 1 + σ * ∫ t in (1 : ℝ)..max 1 u, kernel (stepApprox σ n) t + +noncomputable def delay (σ u : ℝ) : ℝ := stepApprox σ ⌈u⌉₊ u + +end Erdos970.NumberTheoryLean.DelayConstruction + +namespace Erdos970.NumberTheoryLean.Dickman + +/-- The continuous delay-equation construction of the Dickman function. -/ +noncomputable def rho : ℝ → ℝ := DelayConstruction.delay (-1) + +end Erdos970.NumberTheoryLean.Dickman + +namespace JointDickman + +noncomputable def empiricalCount (P : ℕ → Prop) (N : ℕ) : ℕ := by + classical + exact ((Finset.Icc 2 N).filter P).card + +/-- Ordinary natural density over `2 ≤ n ≤ X`, normalized by the real endpoint. -/ +noncomputable def realDensity (P : ℕ → Prop) (X : ℝ) : ℝ := + (empiricalCount P ⌊X⌋₊ : ℝ) / X + +end JointDickman + +namespace JointDickmanPaper + +open Filter JointDickman +open scoped Topology + +/-- Theorem 1: ordinary natural density, with both thresholds based at `n`. -/ +theorem joint_law (a b : ℝ) (ha : 0 < a) (ha1 : a < 1) (hb : 0 < b) (hb1 : b < 1) : + Tendsto (realDensity (fun n => + (n.maxPrimeFac : ℝ) ≤ (n : ℝ) ^ a ∧ ((n + 1).maxPrimeFac : ℝ) ≤ (n : ℝ) ^ b)) + atTop (𝓝 (Erdos970.NumberTheoryLean.Dickman.rho (1 / a) * + Erdos970.NumberTheoryLean.Dickman.rho (1 / b))) := by + sorry + +/-- Corollary 2: the increasing strict ordering has natural density one half. -/ +theorem increasing_order : + Tendsto (realDensity (fun n => n.maxPrimeFac < (n + 1).maxPrimeFac)) + atTop (𝓝 (1 / 2)) := by + sorry + +/-- The reverse strict ordering also has natural density one half. -/ +theorem decreasing_order : + Tendsto (realDensity (fun n => (n + 1).maxPrimeFac < n.maxPrimeFac)) + atTop (𝓝 (1 / 2)) := by + sorry + +end JointDickmanPaper + +end OAI diff --git a/lean/ComparatorChallenges/KLInvariance.json b/lean/ComparatorChallenges/KLInvariance.json new file mode 100644 index 0000000000000000000000000000000000000000..df72989d64d2308bb22f1864155de357276a131b --- /dev/null +++ b/lean/ComparatorChallenges/KLInvariance.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.KLInvariance", + "solution_module": "OAI.RepresentationTheory.KazhdanLusztig.Invariance", + "theorem_names": [ + "OAI.KLInvariance.combinatorial_invariance" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/KLInvariance.lean b/lean/ComparatorChallenges/KLInvariance.lean new file mode 100644 index 0000000000000000000000000000000000000000..b95edb136e81b3885e2febde719356b4d0adee2d --- /dev/null +++ b/lean/ComparatorChallenges/KLInvariance.lean @@ -0,0 +1,99 @@ +import Mathlib + +namespace OAI + +namespace KLInvariance + +open Polynomial + +universe u v u' v' + +variable {B : Type u} {W : Type v} [Group W] {M : CoxeterMatrix B} + +/-- An upward edge in the *strong* Bruhat graph, with left reflection labels. -/ +def BruhatStep (cs : CoxeterSystem M W) (x y : W) : Prop := + cs.length x < cs.length y ∧ ∃ t : W, cs.IsReflection t ∧ y = t * x + +/-- The actual strong Bruhat order, not the weak order. -/ +def BruhatLE (cs : CoxeterSystem M W) : W → W → Prop := + Relation.ReflTransGen (BruhatStep cs) + +/-- The unlabelled interval, including both endpoints. -/ +def Interval (cs : CoxeterSystem M W) (u b : W) := + {x : W // BruhatLE cs u x ∧ BruhatLE cs x b} + +instance intervalOrder (cs : CoxeterSystem M W) (u b : W) : + PartialOrder (Interval cs u b) where + le left right := BruhatLE cs left.val right.val + le_refl _ := Relation.ReflTransGen.refl + le_trans _ _ _ forward backward := forward.trans backward + le_antisymm left right forward backward := by + apply Subtype.ext + have length_mono : ∀ {lower upper : W}, BruhatLE cs lower upper → + cs.length lower ≤ cs.length upper := by + intro lower upper relation + induction relation using Relation.ReflTransGen.head_induction_on with + | refl => exact le_rfl + | head step _ rest => exact le_trans step.1.le rest + by_contra distinct + rcases forward.cases_head with same | ⟨middle, step, rest⟩ + · exact distinct same + · exact (not_lt_of_ge (length_mono backward)) + (lt_of_lt_of_le step.1 (length_mono rest)) + +/-- `d(x,y)` in the manuscript, used only for comparable endpoints. -/ +noncomputable def rankDifference (cs : CoxeterSystem M W) (x y : W) : ℕ := + cs.length y - cs.length x + +abbrev PolynomialFamilies (W : Type v) := (W → W → ℤ[X]) × (W → W → ℤ[X]) + +/-- Exact equal-parameter normalization in the introduction. +The first family is R and the second is P. `reflect d p` is `q^d p(q⁻¹)` +when `p.natDegree ≤ d`, which follows here from the degree bound (or the +diagonal normalization). The sum is over the real Bruhat interval; +its finiteness is a separate theorem, not a different definition of order. -/ +structure NormalizedKL (cs : CoxeterSystem M W) (RP : PolynomialFamilies W) : Prop where + R_diagonal : ∀ x, RP.1 x x = 1 + R_zero : ∀ x y, ¬ BruhatLE cs x y → RP.1 x y = 0 + R_recursion : ∀ x y i, cs.length (cs.simple i * y) < cs.length y → + RP.1 x y = + if cs.length (cs.simple i * x) < cs.length x then + RP.1 (cs.simple i * x) (cs.simple i * y) + else + (X - 1) * RP.1 x (cs.simple i * y) + + X * RP.1 (cs.simple i * x) (cs.simple i * y) + P_diagonal : ∀ x, RP.2 x x = 1 + P_zero : ∀ x y, ¬ BruhatLE cs x y → RP.2 x y = 0 + P_degree : ∀ x y, BruhatLE cs x y → x ≠ y → + 2 * (RP.2 x y).natDegree < rankDifference cs x y + reciprocity : ∀ x y, BruhatLE cs x y → + reflect (rankDifference cs x y) (RP.2 x y) = + ∑ᶠ z : Interval cs x y, RP.1 x z.val * RP.2 z.val y + +/-- The polynomial families selected by their equal-parameter normalization. -/ +noncomputable def klFamilies (cs : CoxeterSystem M W) : PolynomialFamilies W := + Classical.epsilon (NormalizedKL cs) + +noncomputable def klPolynomial (cs : CoxeterSystem M W) (x y : W) : ℤ[X] := + (klFamilies cs).2 x y + +end KLInvariance + +namespace KLInvariance + +universe u v u' v' + +variable {B : Type u} {W : Type v} [Group W] {M : CoxeterMatrix B} + +theorem combinatorial_invariance + {B' : Type u'} {W' : Type v'} [Group W'] {M' : CoxeterMatrix B'} + (cs : CoxeterSystem M W) (cs' : CoxeterSystem M' W') + {u b : W} {u' b' : W'} + (hub : BruhatLE cs u b) (hub' : BruhatLE cs' u' b') + (ι : Interval cs u b ≃o Interval cs' u' b') : + klPolynomial cs u b = klPolynomial cs' u' b' := by + sorry + +end KLInvariance + +end OAI diff --git a/lean/ComparatorChallenges/KMedianRecovery.json b/lean/ComparatorChallenges/KMedianRecovery.json new file mode 100644 index 0000000000000000000000000000000000000000..ab8b736b382dbc7c76f34b96f417bd293568bfba --- /dev/null +++ b/lean/ComparatorChallenges/KMedianRecovery.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.KMedianRecovery", + "definition_names": [], + "enable_nanoda": false, + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "solution_module": "OAI.Combinatorics.KMedianRecovery.Main", + "theorem_names": [ + "OAI.MetricKMedianRecovery.global_application" + ] +} diff --git a/lean/ComparatorChallenges/KMedianRecovery.lean b/lean/ComparatorChallenges/KMedianRecovery.lean new file mode 100644 index 0000000000000000000000000000000000000000..05a0f2df5a0661399fd3499ec7bd0d217f87a4f7 --- /dev/null +++ b/lean/ComparatorChallenges/KMedianRecovery.lean @@ -0,0 +1,107 @@ +import Mathlib + +namespace OAI + +namespace MetricKMedianRecovery + +structure RationalMetricInput where + pointCount : ℕ + distance : Fin pointCount → Fin pointCount → ℚ + clients : Finset (Fin pointCount) + facilities : Finset (Fin pointCount) + budget : ℕ + facilities_nonempty : facilities.Nonempty + budget_pos : 0 < budget + covered : clients ∪ facilities = Finset.univ + distance_nonneg : ∀ x y, 0 ≤ distance x y + distance_self : ∀ x, distance x x = 0 + distance_symm : ∀ x y, distance x y = distance y x + distance_triangle : ∀ x y z, distance x z ≤ distance x y + distance y z + +namespace RationalMetricInput + +def size (I : RationalMetricInput) : ℕ := I.clients.card + I.facilities.card + +def Feasible (I : RationalMetricInput) (S : Finset (Fin I.pointCount)) : Prop := + S ⊆ I.facilities ∧ S.card ≤ I.budget ∧ (I.clients.Nonempty → S.Nonempty) + +def cost (I : RationalMetricInput) (S : Finset (Fin I.pointCount)) : ℚ := + if hS : S.Nonempty then ∑ p ∈ I.clients, S.inf' hS (I.distance p) else 0 + +def comparisonSets (I : RationalMetricInput) : Finset (Finset (Fin I.pointCount)) := + I.facilities.powerset.filter (fun S => S.Nonempty ∧ S.card ≤ I.budget) + +lemma comparisonSets_nonempty (I : RationalMetricInput) : I.comparisonSets.Nonempty := by + obtain ⟨i, hi⟩ := I.facilities_nonempty + refine ⟨{i}, ?_⟩ + simp only [comparisonSets, Finset.mem_filter, Finset.mem_powerset, + Finset.singleton_subset_iff, Finset.singleton_nonempty, Finset.card_singleton, true_and] + exact ⟨hi, I.budget_pos⟩ + +def optimum (I : RationalMetricInput) : ℚ := + I.comparisonSets.inf' I.comparisonSets_nonempty I.cost + +def natBits (n : ℕ) : List Bool := + List.replicate (Nat.bits n).length true ++ [false] ++ Nat.bits n + +def rationalBits (r : ℚ) : List Bool := + [decide (r < 0)] ++ natBits r.num.natAbs ++ natBits r.den + +def bits (I : RationalMetricInput) : List Bool := + natBits I.pointCount ++ natBits I.budget ++ + List.ofFn (fun i : Fin I.pointCount => decide (i ∈ I.clients)) ++ + List.ofFn (fun i : Fin I.pointCount => decide (i ∈ I.facilities)) ++ + (List.ofFn (fun i : Fin I.pointCount => + (List.ofFn (fun j : Fin I.pointCount => rationalBits (I.distance i j))).flatten)).flatten + +def decodeOutput (I : RationalMetricInput) (out : List Bool) : Finset (Fin I.pointCount) := + I.facilities.filter (fun i => out[i.val]?.getD false = true) + +end RationalMetricInput + +def pairBits (p : List Bool × List Bool) : List Bool := + p.1.flatMap (fun b => [true, b]) ++ [false] ++ p.2 + +structure BinaryRandomizedAlgorithm where + randomBits : Polynomial ℕ + run : List Bool × List Bool → List Bool + computation : Turing.TM2ComputableInPolyTime pairBits id run + finiteWorkAlphabet : ∀ k : computation.tm.K, Finite (computation.tm.Γ k) + +namespace BinaryRandomizedAlgorithm + +def bitCount (A : BinaryRandomizedAlgorithm) (I : RationalMetricInput) : ℕ := + A.randomBits.eval I.bits.length + +abbrev Seed (A : BinaryRandomizedAlgorithm) (I : RationalMetricInput) := + Fin (A.bitCount I) → Bool + +def output (A : BinaryRandomizedAlgorithm) (I : RationalMetricInput) (s : A.Seed I) : + Finset (Fin I.pointCount) := + I.decodeOutput (A.run (I.bits, List.ofFn s)) + +noncomputable def successProbability (A : BinaryRandomizedAlgorithm) (I : RationalMetricInput) + (bound : ℝ) : ℝ := by + classical + exact ((Finset.univ.filter (fun s : A.Seed I => (I.cost (A.output I s) : ℝ) ≤ bound)).card : ℝ) / + 2 ^ (A.bitCount I) + +noncomputable def expectedCost (A : BinaryRandomizedAlgorithm) (I : RationalMetricInput) : ℝ := + (∑ s : A.Seed I, (I.cost (A.output I s) : ℝ)) / 2 ^ (A.bitCount I) + +end BinaryRandomizedAlgorithm + +def globalApplicationClaim : Prop := + ∃ σ : ℝ, 0 < σ ∧ ∀ a : ℝ, 0 < a → ∃ A : BinaryRandomizedAlgorithm, + (∀ (I : RationalMetricInput) (s : A.Seed I), I.Feasible (A.output I s)) ∧ + (∀ I : RationalMetricInput, + 1 - Real.rpow ((I.size : ℝ) + 2) (-a) ≤ + A.successProbability I ((2 - σ) * (I.optimum : ℝ))) ∧ + (∀ I : RationalMetricInput, A.expectedCost I ≤ (2 - σ) * (I.optimum : ℝ)) + +theorem global_application : globalApplicationClaim := by + sorry + +end MetricKMedianRecovery + +end OAI diff --git a/lean/ComparatorChallenges/KMedianRefinedRecovery.json b/lean/ComparatorChallenges/KMedianRefinedRecovery.json new file mode 100644 index 0000000000000000000000000000000000000000..c4b0c6aca94615c53e89f6bcd1bb3745f92a5dd9 --- /dev/null +++ b/lean/ComparatorChallenges/KMedianRefinedRecovery.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.KMedianRefinedRecovery", + "solution_module": "OAI.Combinatorics.KMedianRecovery.Refined.Recovery", + "theorem_names": [ + "OAI.MetricKMedianRecovery.RefinedRecovery.refined_recovery" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/KMedianRefinedRecovery.lean b/lean/ComparatorChallenges/KMedianRefinedRecovery.lean new file mode 100644 index 0000000000000000000000000000000000000000..24a108afa2d33ba0f54926a51e5de42f05beb1c0 --- /dev/null +++ b/lean/ComparatorChallenges/KMedianRefinedRecovery.lean @@ -0,0 +1,167 @@ +import Mathlib + +namespace OAI + +namespace MetricKMedianRecovery + +structure RationalMetricInput where + pointCount : ℕ + distance : Fin pointCount → Fin pointCount → ℚ + clients : Finset (Fin pointCount) + facilities : Finset (Fin pointCount) + budget : ℕ + facilities_nonempty : facilities.Nonempty + budget_pos : 0 < budget + covered : clients ∪ facilities = Finset.univ + distance_nonneg : ∀ x y, 0 ≤ distance x y + distance_self : ∀ x, distance x x = 0 + distance_symm : ∀ x y, distance x y = distance y x + distance_triangle : ∀ x y z, distance x z ≤ distance x y + distance y z + +namespace RationalMetricInput + +def size (I : RationalMetricInput) : ℕ := I.clients.card + I.facilities.card + +def Feasible (I : RationalMetricInput) (S : Finset (Fin I.pointCount)) : Prop := + S ⊆ I.facilities ∧ S.card ≤ I.budget ∧ (I.clients.Nonempty → S.Nonempty) + +def cost (I : RationalMetricInput) (S : Finset (Fin I.pointCount)) : ℚ := + if hS : S.Nonempty then ∑ p ∈ I.clients, S.inf' hS (I.distance p) else 0 + +def natBits (n : ℕ) : List Bool := + List.replicate (Nat.bits n).length true ++ [false] ++ Nat.bits n + +def rationalBits (r : ℚ) : List Bool := + [decide (r < 0)] ++ natBits r.num.natAbs ++ natBits r.den + +def bits (I : RationalMetricInput) : List Bool := + natBits I.pointCount ++ natBits I.budget ++ + List.ofFn (fun i : Fin I.pointCount => decide (i ∈ I.clients)) ++ + List.ofFn (fun i : Fin I.pointCount => decide (i ∈ I.facilities)) ++ + (List.ofFn (fun i : Fin I.pointCount => + (List.ofFn (fun j : Fin I.pointCount => rationalBits (I.distance i j))).flatten)).flatten + +def decodeOutput (I : RationalMetricInput) (out : List Bool) : Finset (Fin I.pointCount) := + I.facilities.filter (fun i => out[i.val]?.getD false = true) + +end RationalMetricInput + +def pairBits (p : List Bool × List Bool) : List Bool := + p.1.flatMap (fun b => [true, b]) ++ [false] ++ p.2 + +structure BinaryRandomizedAlgorithm where + randomBits : Polynomial ℕ + run : List Bool × List Bool → List Bool + computation : Turing.TM2ComputableInPolyTime pairBits id run + finiteWorkAlphabet : ∀ k : computation.tm.K, Finite (computation.tm.Γ k) + + +end MetricKMedianRecovery + +run_elab Lean.modifyEnv fun environment => Lean.Meta.auxLemmasExt.setState environment {} + +namespace MetricKMedianRecovery.RefinedRecovery + +structure Input where + metric : RationalMetricInput + disjoint : Disjoint metric.clients metric.facilities + integral : ∀ x y, ∃ z : ℕ, metric.distance x y = (z : ℚ) + positive : ∀ x y, x ≠ y → 0 < metric.distance x y + anchor : Finset (Fin metric.pointCount) + anchor_subset : anchor ⊆ metric.facilities + anchor_card : anchor.card = metric.budget + +namespace Input +abbrev Point (I : Input) := Fin I.metric.pointCount + +def size (I : Input) : ℕ := I.metric.size + +def Bounded (I : Input) (bound : Polynomial ℕ) : Prop := + ∀ x y, I.metric.distance x y ≤ ((bound.eval I.size : ℕ) : ℚ) + +noncomputable def assign (I : Input) (O : Finset I.Point) (p : I.Point) : I.Point := + if h : O.Nonempty then + Classical.choose (Finset.exists_min_image O + (fun i => toLex (I.metric.distance p i, i)) h) + else p + +noncomputable def cluster (I : Input) (O : Finset I.Point) (i : I.Point) : Finset I.Point := + I.metric.clients.filter (fun p => I.assign O p = i) + +noncomputable def clusterCost (I : Input) (O : Finset I.Point) (i : I.Point) : ℝ := + ∑ p ∈ I.cluster O i, (I.metric.distance p i : ℝ) + +def anchorBits (I : Input) : List Bool := + List.ofFn (fun i : I.Point => decide (i ∈ I.anchor)) + +end Input + +structure Certificate (I : Input) (μ : ℚ) (L₀ : ℝ) where + centers : Finset I.Point + centers_subset : centers ⊆ I.metric.facilities + same_card : centers.card = I.anchor.card + positive_cost : 0 < (I.metric.cost centers : ℝ) + good : Finset I.Point + good_subset : good ⊆ centers + proxy : I.Point → I.Point + proxy_mem : ∀ i ∈ good, proxy i ∈ I.anchor + proxy_inj : Set.InjOn proxy (↑good) + proxy_cost : (∑ i ∈ good, ∑ p ∈ I.cluster centers i, + (I.metric.distance p (proxy i) : ℝ)) ≤ + (∑ i ∈ good, I.clusterCost centers i) + (μ : ℝ) * (I.metric.cost centers : ℝ) + few_bad : (((centers \ good).card : ℕ) : ℝ) ≤ L₀ * Real.log (I.size : ℝ) + +noncomputable def precision (ζ : ℝ) : ℕ := + ⌈Real.log (1 / ζ) / Real.log 2⌉₊ + +noncomputable def queryBits (I : Input) (ζ : ℝ) : List Bool := + pairBits (I.metric.bits, I.anchorBits ++ List.replicate (precision ζ) true) + +noncomputable def seedLength (A : BinaryRandomizedAlgorithm) (I : Input) (ζ : ℝ) : ℕ := + A.randomBits.eval (queryBits I ζ).length + +abbrev Seed (A : BinaryRandomizedAlgorithm) (I : Input) (ζ : ℝ) := + Fin (seedLength A I ζ) → Bool + +noncomputable def output (A : BinaryRandomizedAlgorithm) (I : Input) (ζ : ℝ) + (s : Seed A I ζ) : Finset I.Point := + I.metric.decodeOutput (A.run (queryBits I ζ, List.ofFn s)) + +noncomputable def successProbability (A : BinaryRandomizedAlgorithm) (I : Input) + (ζ target : ℝ) : ℝ := by + classical + exact ((Finset.univ.filter (fun s : Seed A I ζ => + (I.metric.cost (output A I ζ s) : ℝ) ≤ target)).card : ℝ) / + 2 ^ seedLength A I ζ + +noncomputable def workBound (A : BinaryRandomizedAlgorithm) (I : Input) (ζ : ℝ) : ℕ := + (queryBits I ζ).length + seedLength A I ζ + + A.computation.time.eval (pairBits + (queryBits I ζ, List.replicate (seedLength A I ζ) false)).length + +def PolynomialWork (A : BinaryRandomizedAlgorithm) (bound : Polynomial ℕ) : Prop := + ∃ c : ℝ, 0 < c ∧ ∃ d : ℕ, + ∀ I : Input, I.Bounded bound → ∀ ζ : ℝ, 0 < ζ → ζ < 1 → + (workBound A I ζ : ℝ) ≤ + c * ((I.size : ℝ) + 1) ^ d * (1 + Real.log (1 / ζ)) ^ d + + +end MetricKMedianRecovery.RefinedRecovery + +namespace MetricKMedianRecovery.RefinedRecovery + +theorem refined_recovery : + ∀ (bound : Polynomial ℕ) (ε L₀ : ℝ) (μ : ℚ), + 0 < ε → 0 < L₀ → 0 < μ → μ ≤ 1/4 → (μ : ℝ) ≤ ε/12 → + ∃ A : BinaryRandomizedAlgorithm, + PolynomialWork A bound ∧ + ∀ I : Input, I.Bounded bound → ∀ ζ : ℝ, 0 < ζ → ζ < 1 → + (∀ s : Seed A I ζ, I.metric.Feasible (output A I ζ s)) ∧ + (∀ C : Certificate I μ L₀, + 1 - ζ ≤ successProbability A I ζ + ((1 + 2 / Real.exp 1 + ε) * (I.metric.cost C.centers : ℝ))) := by + sorry + +end MetricKMedianRecovery.RefinedRecovery + +end OAI diff --git a/lean/ComparatorChallenges/KMedianThreshold.json b/lean/ComparatorChallenges/KMedianThreshold.json new file mode 100644 index 0000000000000000000000000000000000000000..4456ac9069e5572beb41f0a63d571ffcaa8154e7 --- /dev/null +++ b/lean/ComparatorChallenges/KMedianThreshold.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.KMedianThreshold", + "solution_module": "OAI.Combinatorics.KMedian.Threshold", + "theorem_names": [ + "OAI.MetricKMedian.threshold" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Classical.choice", + "Quot.sound" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/KMedianThreshold.lean b/lean/ComparatorChallenges/KMedianThreshold.lean new file mode 100644 index 0000000000000000000000000000000000000000..d01bc34ac725698ac0bd8a5a9ca167c00ec1ced9 --- /dev/null +++ b/lean/ComparatorChallenges/KMedianThreshold.lean @@ -0,0 +1,107 @@ +import Mathlib + +namespace OAI + +section +section +namespace MetricKMedian + +structure Instance where + n : ℕ + distance : Fin n → Fin n → ℚ + clients : Finset (Fin n) + facilities : Finset (Fin n) + k : ℕ + distance_nonneg : ∀ i j, 0 ≤ distance i j + distance_eq_zero : ∀ i j, distance i j = 0 ↔ i = j + distance_symm : ∀ i j, distance i j = distance j i + distance_triangle : ∀ i j h, distance i h ≤ distance i j + distance j h + k_pos : 1 ≤ k + k_le : k ≤ facilities.card + +def encodeNat (n : ℕ) : List Bool := + List.replicate n.bits.length true ++ [false] ++ n.bits + +def encodeRat (q : ℚ) : List Bool := + [decide (q.num < 0)] ++ encodeNat q.num.natAbs ++ encodeNat q.den + +def encodeInstance (I : Instance) : List Bool := + encodeNat I.n ++ encodeNat I.k ++ + List.ofFn (fun i : Fin I.n => decide (i ∈ I.clients)) ++ + List.ofFn (fun i : Fin I.n => decide (i ∈ I.facilities)) ++ + (List.ofFn (fun i : Fin I.n => + (List.ofFn (fun j : Fin I.n => encodeRat (I.distance i j))).flatten)).flatten + +noncomputable def nearest (I : Instance) (j : Fin I.n) (S : Finset (Fin I.n)) : ℝ := + if h : S.Nonempty then + (S.image (fun i => (I.distance j i : ℝ))).min' (h.image _) + else 0 + +noncomputable def cost (I : Instance) (S : Finset (Fin I.n)) : ℝ := + ∑ j ∈ I.clients, nearest I j S + +def feasibleSets (I : Instance) : Finset (Finset (Fin I.n)) := + I.facilities.powerset.filter (fun S => S.Nonempty ∧ S.card ≤ I.k) + +noncomputable def optimum (I : Instance) : ℝ := + if h : (feasibleSets I).Nonempty then + ((feasibleSets I).image (cost I)).min' (h.image _) + else 0 + +def Correct (epsilon : ℝ) (I : Instance) (output : List Bool) : Prop := + ∃ S : Finset (Fin I.n), S ⊆ I.facilities ∧ S.Nonempty ∧ S.card ≤ I.k ∧ + output = List.ofFn (fun i : Fin I.n => decide (i ∈ S)) ∧ + cost I S ≤ (1 + 2 / Real.exp 1 + epsilon) * optimum I + +end MetricKMedian +end +end + +namespace MetricKMedian +namespace Complexity +/-- Polynomial-time computation with every physical work alphabet finite. -/ +def FinitePolyTime {α β : Type} (ea : α → List Bool) (eb : β → List Bool) + (f : α → β) : Prop := + ∃ p : Turing.TM2ComputableInPolyTime ea eb f, + ∀ k : p.tm.K, Finite (p.tm.Γ k) + +abbrev Word := List Bool +abbrev Language := Set Word + +def encodeBit (b : Bool) : Word := [b] + +def encodePair (x : Word × Word) : Word := + encodeNat x.1.length ++ x.1 ++ x.2 + +def P : Set Language := {L | ∃ decideL : Word → Bool, + FinitePolyTime id encodeBit decideL ∧ ∀ x, decideL x = true ↔ x ∈ L} + +def NP : Set Language := {L | ∃ (verify : Word × Word → Bool) (p : Polynomial ℕ), + FinitePolyTime encodePair encodeBit verify ∧ + ∀ x, x ∈ L ↔ ∃ w : Word, w.length ≤ p.eval x.length ∧ verify (x, w) = true} + +/-- Separation of deterministic polynomial time from finite-verifier nondeterministic polynomial time. -/ +def PNeNP : Prop := P ≠ NP + +end Complexity +/-- An actual nonempty feasible facility set, encoded by its membership mask. -/ +def FactorCorrect (α : ℝ) (I : Instance) (output : List Bool) : Prop := + ∃ S : Finset (Fin I.n), S ⊆ I.facilities ∧ S.Nonempty ∧ S.card ≤ I.k ∧ + output = List.ofFn (fun i : Fin I.n => decide (i ∈ S)) ∧ + cost I S ≤ α * optimum I + +/-- Deterministic polynomial-time approximation factors for arbitrary specified clients and facilities. -/ +def approximationFactors : Set ℝ := {α | ∃ algorithm : Instance → List Bool, + Complexity.FinitePolyTime encodeInstance id algorithm ∧ + ∀ I, FactorCorrect α I (algorithm I)} + +end MetricKMedian + +namespace MetricKMedian +/-- The deterministic approximation threshold is an infimum; its attainment is not asserted. -/ +theorem threshold (h : Complexity.PNeNP) : + sInf approximationFactors=1+2/Real.exp 1 := by + sorry +end MetricKMedian + +end OAI diff --git a/lean/ComparatorChallenges/KServer.json b/lean/ComparatorChallenges/KServer.json new file mode 100644 index 0000000000000000000000000000000000000000..c42e99b29b91015d3618536e4b01484e9c02bf71 --- /dev/null +++ b/lean/ComparatorChallenges/KServer.json @@ -0,0 +1,24 @@ +{ + "solution_module": "OAI.Combinatorics.KServer.Main", + "challenge_module": "ComparatorChallenges.KServer", + "theorem_names": [ + "OAI.KServer.main_theorem" + ], + "definition_names": [ + "OAI.KServer.Configuration", + "OAI.KServer.LabelDistribution", + "OAI.KServer.Policy", + "OAI.KServer.serve", + "OAI.KServer.serviceCost", + "OAI.KServer.pathProbability", + "OAI.KServer.expectedCost", + "OAI.KServer.optimalCost", + "OAI.KServer.MainStatement" + ], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/KServer.lean b/lean/ComparatorChallenges/KServer.lean new file mode 100644 index 0000000000000000000000000000000000000000..9c7d0901a84441ba64d4e09f480f92049c35de2c --- /dev/null +++ b/lean/ComparatorChallenges/KServer.lean @@ -0,0 +1,69 @@ +import Mathlib + +namespace OAI + +noncomputable section + +open scoped BigOperators + +namespace KServer + +universe u + +abbrev Configuration (k : ℕ) (X : Type u) := Fin k → X + +def LabelDistribution (k : ℕ) := + {probability : Fin k → ℝ // + (∀ label, 0 ≤ probability label) ∧ ∑ label, probability label = 1} + +abbrev Policy (k : ℕ) (X : Type u) := + List (X × Fin k) → X → LabelDistribution k + +def serve {k : ℕ} {X : Type u} (s : Configuration k X) + (label : Fin k) (request : X) : Configuration k X := + Function.update s label request + +def serviceCost {k : ℕ} {X : Type u} [MetricSpace X] + (s : Configuration k X) : (requests : List X) → (Fin requests.length → Fin k) → ℝ + | [], _ => 0 + | request :: requests, labels => + dist (s (labels 0)) request + + serviceCost (serve s (labels 0) request) requests (fun index => labels index.succ) + +def pathProbability {k : ℕ} {X : Type u} (A : Policy k X) + (history : List (X × Fin k)) : + (requests : List X) → (Fin requests.length → Fin k) → ℝ + | [], _ => 1 + | request :: requests, labels => + (A history request).val (labels 0) * + pathProbability A (history ++ [(request, labels 0)]) requests + (fun index => labels index.succ) + +def expectedCost {k : ℕ} {X : Type u} [MetricSpace X] + (A : Policy k X) (s : Configuration k X) (requests : List X) : ℝ := + ∑ labels : Fin requests.length → Fin k, + pathProbability A [] requests labels * serviceCost s requests labels + +def optimalCost {k : ℕ} {X : Type u} [MetricSpace X] + (s : Configuration k X) (requests : List X) : ℝ := + sInf (Set.range (serviceCost s requests)) + +def MainStatement : Prop := + ∃ C : ℝ, 0 < C ∧ ∀ (k : ℕ), 2 ≤ k → + ∀ (X : Type u) (_ : MetricSpace X), + (∃ embedding : Fin (k + 1) → X, Function.Injective embedding) → + ∀ s : Configuration k X, + ∃ A : Policy k X, ∃ B : ℝ, + 0 ≤ B ∧ (Function.Injective s → B = 0) ∧ + ∀ requests : List X, + expectedCost A s requests ≤ + C * (Real.log (k + 1)) ^ 2 * optimalCost s requests + B + +theorem main_theorem : MainStatement.{u} := by + sorry + +end KServer + +end + +end OAI diff --git a/lean/ComparatorChallenges/KadisonRingrose.json b/lean/ComparatorChallenges/KadisonRingrose.json new file mode 100644 index 0000000000000000000000000000000000000000..9f495b39e6b0167217495661f2cb1cb5944cece2 --- /dev/null +++ b/lean/ComparatorChallenges/KadisonRingrose.json @@ -0,0 +1,13 @@ +{ + "challenge_module": "ComparatorChallenges.KadisonRingrose", + "solution_module": "OAI.Analysis.BoundedHochschild.MainResult", + "theorem_names": [ + "OAI.BoundedHochschild.KadisonRingrose.main_result" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ] +} diff --git a/lean/ComparatorChallenges/KadisonRingrose.lean b/lean/ComparatorChallenges/KadisonRingrose.lean new file mode 100644 index 0000000000000000000000000000000000000000..d962126578d6a04bd6220fa45a4c1a6aac35e3f2 --- /dev/null +++ b/lean/ComparatorChallenges/KadisonRingrose.lean @@ -0,0 +1,43 @@ +import Mathlib + +namespace OAI + +/-! Every ordinary bounded higher Hochschild cocycle of a complex von Neumann +algebra is the coboundary of a bounded cochain with values in the same algebra. -/ + +noncomputable section + +namespace BoundedHochschild + +abbrev Cochain (M : Type*) [NormedAddCommGroup M] [NormedSpace ℂ M] (n : ℕ) := + ContinuousMultilinearMap ℂ (fun _ : Fin n => M) M + +def mergeInputs {M : Type*} [Mul M] {n : ℕ} + (v : Fin (n + 1) → M) (j : Fin n) : Fin n → M := + fun i => if i < j then v i.castSucc + else if i = j then v i.castSucc * v i.succ else v i.succ + +noncomputable def differentialValue {M : Type*} [NormedRing M] [NormedAlgebra ℂ M] + {n : ℕ} (f : Cochain M n) (v : Fin (n + 1) → M) : M := + v 0 * f (fun i => v i.succ) + + ∑ j : Fin n, ((-1 : ℂ) ^ (j.val + 1)) • f (mergeInputs v j) + + ((-1 : ℂ) ^ (n + 1)) • (f (fun i => v i.castSucc) * v (Fin.last n)) + +namespace KadisonRingrose + +universe u + +theorem main_result + {M : Type u} [CStarAlgebra M] [PartialOrder M] [StarOrderedRing M] [WStarAlgebra M] + (n : ℕ) (f : Cochain M (n + 2)) + (hf : ∀ x : Fin (n + 3) → M, differentialValue f x = 0) : + ∃ g : Cochain M (n + 1), ∀ x : Fin (n + 2) → M, + differentialValue g x = f x := by + sorry + +end KadisonRingrose +end BoundedHochschild + +end + +end OAI diff --git a/lean/ComparatorChallenges/KadisonSimilarity.json b/lean/ComparatorChallenges/KadisonSimilarity.json new file mode 100644 index 0000000000000000000000000000000000000000..df4775ee0d608b0920e5f7aed31a22f81b90571f --- /dev/null +++ b/lean/ComparatorChallenges/KadisonSimilarity.json @@ -0,0 +1,16 @@ +{ + "challenge_module": "ComparatorChallenges.KadisonSimilarity", + "solution_module": "OAI.Analysis.KadisonSimilarity.UnconditionalSimilarity", + "theorem_names": [ + "OAI.KadisonSimilarity.universalCommutatorTheorem", + "OAI.KadisonSimilarity.universalHyperreflexivity", + "OAI.KadisonSimilarity.similarityTheorem" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/KadisonSimilarity.lean b/lean/ComparatorChallenges/KadisonSimilarity.lean new file mode 100644 index 0000000000000000000000000000000000000000..62538591f6e231a1babb1bc8bdda23720135e367 --- /dev/null +++ b/lean/ComparatorChallenges/KadisonSimilarity.lean @@ -0,0 +1,122 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace KadisonSimilarity + +universe u v + +section Homomorphisms + +variable (A H : Type*) [CStarAlgebra A] + [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +abbrev BoundedUnitalHom := + {π : A →ₐ[ℂ] (H →L[ℂ] H) // Continuous π} + +def SimilarToStar (π : BoundedUnitalHom A H) : Prop := + ∃ S : (H →L[ℂ] H)ˣ, ∀ a : A, + (S : H →L[ℂ] H) * π.1 (star a) * (↑S⁻¹ : H →L[ℂ] H) = + star ((S : H →L[ℂ] H) * π.1 a * (↑S⁻¹ : H →L[ℂ] H)) + +end Homomorphisms + +section Commutators + +variable {R : Type*} [NormedRing R] + +def commutator (S T : R) : R := S * T - T * S + +end Commutators + +variable {H : Type u} [NormedAddCommGroup H] [InnerProductSpace ℂ H] + +section + +attribute [-instance] NonUnitalCStarAlgebra.toNormedSpace + +run_cmd Lean.modifyEnv fun env => Lean.Meta.auxLemmasExt.setState env {} + +abbrev HilbertCopies (H : Type u) (n : ℕ) := PiLp 2 (fun _ : Fin n => H) + +def matrixOperator {n : ℕ} (X : Matrix (Fin n) (Fin n) (H →L[ℂ] H)) : + HilbertCopies H n →L[ℂ] HilbertCopies H n := + (PiLp.continuousLinearEquiv 2 ℂ (fun _ : Fin n => H)).symm.toContinuousLinearMap.comp + (ContinuousLinearMap.pi fun i => + ∑ j : Fin n, (X i j).comp (PiLp.proj 2 (fun _ : Fin n => H) j)) + +def amplify (Y : H →L[ℂ] H) (n : ℕ) : + HilbertCopies H n →L[ℂ] HilbertCopies H n := + (PiLp.continuousLinearEquiv 2 ℂ (fun _ : Fin n => H)).symm.toContinuousLinearMap.comp + (ContinuousLinearMap.pi fun i => Y.comp (PiLp.proj 2 (fun _ : Fin n => H) i)) + +def innerDerivation (Y : H →L[ℂ] H) : + (H →L[ℂ] H) →L[ℂ] (H →L[ℂ] H) := + ContinuousLinearMap.mul ℂ (H →L[ℂ] H) Y - + (ContinuousLinearMap.mul ℂ (H →L[ℂ] H)).flip Y + +variable [CompleteSpace H] + +def scalarCommutatorNorm (P : VonNeumannAlgebra H) (Y : H →L[ℂ] H) : ℝ := by + let : SeminormedAddCommGroup P.toStarSubalgebra.toSubalgebra.toSubmodule := inferInstance + let : NormedSpace ℂ P.toStarSubalgebra.toSubalgebra.toSubmodule := inferInstance + exact ‖(innerDerivation Y).comp P.toStarSubalgebra.toSubalgebra.toSubmodule.subtypeL‖ + +def CommutatorEstimate (P : VonNeumannAlgebra H) (C : ℝ) : Prop := + ∀ (Y : H →L[ℂ] H) (n : ℕ) (X : Matrix (Fin n) (Fin n) (H →L[ℂ] H)), + (∀ i j, X i j ∈ P) → + ‖commutator (amplify Y n) (matrixOperator X)‖ ≤ + C * scalarCommutatorNorm P Y * ‖matrixOperator X‖ + +def UniformCommutatorEstimate (C : ℝ) : Prop := + ∀ (K : Type u) [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K] + (P : VonNeumannAlgebra K), CommutatorEstimate P C + +def UniversalCommutatorTheorem : Prop := ∃ C : ℝ, 0 ≤ C ∧ UniformCommutatorEstimate.{u} C + +def SimilarityTheorem : Prop := + ∀ (A : Type u) [CStarAlgebra A] (K : Type v) [NormedAddCommGroup K] + [InnerProductSpace ℂ K] [CompleteSpace K] (π : BoundedUnitalHom A K), + SimilarToStar A K π + +abbrev CommutantProjection (M : VonNeumannAlgebra H) := + {e : H →L[ℂ] H // e ∈ M.commutant ∧ star e = e ∧ e * e = e} + +def offDiagonalSeminorm (M : VonNeumannAlgebra H) (T : H →L[ℂ] H) : ℝ := + sSup (Set.range fun e : CommutantProjection M => + ‖(1 - (e : H →L[ℂ] H)) * T * (e : H →L[ℂ] H)‖) + +def UniversalHyperreflexivity (C : ℝ) : Prop := + ∀ (K : Type u) [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K] + (M : VonNeumannAlgebra K) (T : K →L[ℂ] K), + Metric.infDist T (M : Set (K →L[ℂ] K)) ≤ 2 * C * offDiagonalSeminorm M T + +end + +run_cmd Lean.modifyEnv fun env => Lean.Meta.auxLemmasExt.setState env {} + +def rowConstant : ℝ := 4 * Real.sqrt 2 +def cyclicConstant : ℝ := (1 + 4 * rowConstant) ^ 2 +def cornerConstant : ℝ := 6 * Real.pi ^ 2 * (1 + 4 * cyclicConstant) +def factorConstant : ℝ := max (max (3 * cornerConstant + 2) (1 + 2 * rowConstant)) 2 +def universalConstant : ℝ := 3 * factorConstant + 2 + +/-- One absolute constant controls every finite matrix commutator. -/ +theorem universalCommutatorTheorem : UniversalCommutatorTheorem.{u} := by + sorry + +/-- Every von Neumann algebra has hyperreflexivity constant at most `2 * universalConstant`. -/ +theorem universalHyperreflexivity : UniversalHyperreflexivity.{u} universalConstant := by + sorry + +/-- Every bounded unital representation is similar to a star representation. -/ +theorem similarityTheorem : SimilarityTheorem.{u,v} := by + sorry + +end KadisonSimilarity + +end + +end OAI diff --git a/lean/ComparatorChallenges/KahlerSplitting.json b/lean/ComparatorChallenges/KahlerSplitting.json new file mode 100644 index 0000000000000000000000000000000000000000..60a69e89e1977b3a473525a79d876bba39f82532 --- /dev/null +++ b/lean/ComparatorChallenges/KahlerSplitting.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.KahlerSplitting", + "solution_module": "OAI.Geometry.KahlerSplitting.Main", + "theorem_names": [ + "OAI.UniversalCoverSplitting.main" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/KahlerSplitting.lean b/lean/ComparatorChallenges/KahlerSplitting.lean new file mode 100644 index 0000000000000000000000000000000000000000..b2a65c1ad6815602906d6c2ce11af6200942fba5 --- /dev/null +++ b/lean/ComparatorChallenges/KahlerSplitting.lean @@ -0,0 +1,139 @@ +import Mathlib + +namespace OAI + +noncomputable section + +open scoped Manifold ContDiff +open Set + +namespace UniversalCoverSplitting + +universe u v + +abbrev Model (n : ℕ) := Fin n → ℂ +abbrev model (n : ℕ) := 𝓘(ℂ, Model n) + +structure ComplexManifold (n : ℕ) where + Carrier : Type u + [topology : TopologicalSpace Carrier] + [charted : ChartedSpace (Model n) Carrier] + [hausdorff : T2Space Carrier] + [secondCountable : SecondCountableTopology Carrier] + [complexSmooth : IsManifold (model n) ∞ Carrier] + +attribute [instance] ComplexManifold.topology ComplexManifold.charted + ComplexManifold.hausdorff ComplexManifold.secondCountable ComplexManifold.complexSmooth + +variable {n r₁ r₂ : ℕ} + +abbrev Tangent (X : ComplexManifold.{u} n) (x : X.Carrier) := TangentSpace (model n) x +abbrev RealMetricField (X : ComplexManifold.{u} n) := + ∀ x : X.Carrier, Tangent X x →ₗ[ℝ] Tangent X x →ₗ[ℝ] ℝ + +def metricInChart {X : ComplexManifold.{u} n} (g : RealMetricField X) + (c : X.Carrier) (z u v : Model n) : ℝ := + let e := extChartAt (model n) c + let q := mfderiv (model n) (model n) e.symm z + g (e.symm z) (q u) (q v) + +def fundamentalInChart {X : ComplexManifold.{u} n} (g : RealMetricField X) + (c : X.Carrier) (z u v : Model n) : ℝ := + metricInChart g c z (Complex.I • u) v + +structure KahlerMetric (X : ComplexManifold.{u} n) where + metric : RealMetricField X + symmetric : ∀ x u v, metric x u v = metric x v u + positive : ∀ x u, u ≠ 0 → 0 < metric x u u + hermitian : ∀ x u v, metric x (Complex.I • u) (Complex.I • v) = metric x u v + smooth : ∀ c u v, ContDiffOn ℝ ∞ (fun z ↦ metricInChart metric c z u v) + (extChartAt (model n) c).target + closed : ∀ c z, z ∈ (extChartAt (model n) c).target → ∀ u v w : Model n, + fderiv ℝ (fun y ↦ fundamentalInChart metric c y v w) z u + + fderiv ℝ (fun y ↦ fundamentalInChart metric c y w u) z v + + fderiv ℝ (fun y ↦ fundamentalInChart metric c y u v) z w = 0 + +abbrev ProjectionField (X : ComplexManifold.{u} n) := + ∀ x : X.Carrier, Tangent X x →L[ℂ] Tangent X x + +def projectionInChart {X : ComplexManifold.{u} n} (P : ProjectionField X) + (c : X.Carrier) (z : Model n) : Model n →L[ℂ] Model n := + let e := extChartAt (model n) c + (mfderiv (model n) (model n) e (e.symm z)).comp + ((P (e.symm z)).comp (mfderiv (model n) (model n) e.symm z)) + +def HolomorphicProjection {X : ComplexManifold.{u} n} (P : ProjectionField X) : Prop := + ∀ c, DifferentiableOn ℂ (projectionInChart P c) (extChartAt (model n) c).target + +def Integrable {X : ComplexManifold.{u} n} (P : ProjectionField X) : Prop := + ∀ c U, IsOpen U → U ⊆ (extChartAt (model n) c).target → + ∀ V W : Model n → Model n, + DifferentiableOn ℂ V U → DifferentiableOn ℂ W U → + (∀ z ∈ U, projectionInChart P c z (V z) = V z) → + (∀ z ∈ U, projectionInChart P c z (W z) = W z) → + ∀ z ∈ U, projectionInChart P c z (VectorField.lieBracket ℂ V W z) = + VectorField.lieBracket ℂ V W z + +structure HolomorphicSplitting (X : ComplexManifold.{u} n) (r₁ r₂ : ℕ) where + projection : ProjectionField X + idempotent : ∀ x v, projection x (projection x v) = projection x v + holomorphic : HolomorphicProjection projection + first_rank : ∀ x, Module.finrank ℂ (LinearMap.range (projection x).toLinearMap) = r₁ + second_rank : ∀ x, Module.finrank ℂ (LinearMap.ker (projection x).toLinearMap) = r₂ + +def complementaryProjection {X : ComplexManifold.{u} n} + (S : HolomorphicSplitting X r₁ r₂) : ProjectionField X := + fun x ↦ ContinuousLinearMap.id ℂ (Tangent X x) - S.projection x + +def LocalBiholomorphism {X : ComplexManifold.{u} n} {Z : ComplexManifold.{v} n} + (π : Z.Carrier → X.Carrier) : Prop := + ∀ z, ∃ e : OpenPartialHomeomorph Z.Carrier X.Carrier, + z ∈ e.source ∧ (∀ w ∈ e.source, e w = π w) ∧ + MDifferentiableOn (model n) (model n) e e.source ∧ + MDifferentiableOn (model n) (model n) e.symm e.target + +structure OrdinaryUniversalCover (X : ComplexManifold.{u} n) + (Z : ComplexManifold.{v} n) where + projection : Z.Carrier → X.Carrier + covering : IsCoveringMap projection + [connected : ConnectedSpace Z.Carrier] + [simplyConnected : SimplyConnectedSpace Z.Carrier] + liftedComplexStructure : LocalBiholomorphism projection + +def CompatibleProduct {X : ComplexManifold.{u} n} {Z : ComplexManifold.{v} n} + (S : HolomorphicSplitting X r₁ r₂) (π : OrdinaryUniversalCover X Z) + (Y₁ : ComplexManifold.{v} r₁) (Y₂ : ComplexManifold.{v} r₂) : Prop := + ∃ Φ : Z.Carrier ≃ₜ (Y₁.Carrier × Y₂.Carrier), + MDifferentiable (model n) ((model r₁).prod (model r₂)) Φ ∧ + MDifferentiable ((model r₁).prod (model r₂)) (model n) Φ.symm ∧ + (∀ z, Submodule.map + (mfderiv (model n) ((model r₁).prod (model r₂)) Φ z).toLinearMap + (Submodule.comap (mfderiv (model n) (model n) π.projection z).toLinearMap + (LinearMap.range (S.projection (π.projection z)).toLinearMap)) = + LinearMap.ker (ContinuousLinearMap.snd ℂ (Model r₁) (Model r₂)).toLinearMap) ∧ + (∀ z, Submodule.map + (mfderiv (model n) ((model r₁).prod (model r₂)) Φ z).toLinearMap + (Submodule.comap (mfderiv (model n) (model n) π.projection z).toLinearMap + (LinearMap.ker (S.projection (π.projection z)).toLinearMap)) = + LinearMap.ker (ContinuousLinearMap.fst ℂ (Model r₁) (Model r₂)).toLinearMap) + +open Set +open scoped Manifold ContDiff +variable {n r₁ r₂ : ℕ} + +theorem main (X : ComplexManifold.{u} n) [CompactSpace X.Carrier] + [ConnectedSpace X.Carrier] (hn : 2 ≤ n) (hr₁ : 0 < r₁) (hr₂ : 0 < r₂) + (g : KahlerMetric X) (S : HolomorphicSplitting X r₁ r₂) + (h₁ : Integrable S.projection) (h₂ : Integrable (complementaryProjection S)) + (Z : ComplexManifold.{v} n) (π : OrdinaryUniversalCover X Z) : + ∃ (Y₁ : ComplexManifold.{v} r₁) (Y₂ : ComplexManifold.{v} r₂), + ConnectedSpace Y₁.Carrier ∧ ConnectedSpace Y₂.Carrier ∧ + SimplyConnectedSpace Y₁.Carrier ∧ SimplyConnectedSpace Y₂.Carrier ∧ + CompatibleProduct S π Y₁ Y₂ := by + sorry + +end UniversalCoverSplitting + +end + +end OAI diff --git a/lean/ComparatorChallenges/KaplanskyDirectFiniteness.json b/lean/ComparatorChallenges/KaplanskyDirectFiniteness.json new file mode 100644 index 0000000000000000000000000000000000000000..62b606d4571e59d0a677987277a0152797ee5d5e --- /dev/null +++ b/lean/ComparatorChallenges/KaplanskyDirectFiniteness.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.KaplanskyDirectFiniteness", + "solution_module": "OAI.RingTheory.DirectFiniteness.Main", + "theorem_names": [ + "OAI.KaplanskyCounterexample.main_theorem" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/KaplanskyDirectFiniteness.lean b/lean/ComparatorChallenges/KaplanskyDirectFiniteness.lean new file mode 100644 index 0000000000000000000000000000000000000000..3c79842accde59474d4b5a873bf23ef70f89238d --- /dev/null +++ b/lean/ComparatorChallenges/KaplanskyDirectFiniteness.lean @@ -0,0 +1,17 @@ +import Mathlib + +namespace OAI + +namespace KaplanskyCounterexample + +def MainClaim : Prop := + ∃ (K : Type) (_ : Field K) (_ : Fintype K) (_ : CharP K 2), + ∃ (G : Type) (_ : Group G) (_ : Group.FG G), + ∃ a b : MonoidAlgebra K G, a * b = 1 ∧ b * a ≠ 1 + +theorem main_theorem : MainClaim := by + sorry + +end KaplanskyCounterexample + +end OAI diff --git a/lean/ComparatorChallenges/KaplanskyFinitelyPresented.json b/lean/ComparatorChallenges/KaplanskyFinitelyPresented.json new file mode 100644 index 0000000000000000000000000000000000000000..24d978aa6f9357ca3be7f5e52091760c77e98e07 --- /dev/null +++ b/lean/ComparatorChallenges/KaplanskyFinitelyPresented.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.KaplanskyFinitelyPresented", + "solution_module": "OAI.RingTheory.DirectFiniteness.FinitelyPresented", + "theorem_names": [ + "OAI.KaplanskyCounterexample.finitelyPresented_counterexample" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/KaplanskyFinitelyPresented.lean b/lean/ComparatorChallenges/KaplanskyFinitelyPresented.lean new file mode 100644 index 0000000000000000000000000000000000000000..5eb5f9cacc7b82fa773f498285cd0c2b9806d972 --- /dev/null +++ b/lean/ComparatorChallenges/KaplanskyFinitelyPresented.lean @@ -0,0 +1,14 @@ +import Mathlib + +namespace OAI.KaplanskyCounterexample + +/-- A finite characteristic-two field and a finitely presented group with odd-prime +order torsion give a counterexample to direct finiteness (paper, Theorem 1.1). -/ +theorem finitelyPresented_counterexample : + ∃ (K : Type) (_ : Field K) (_ : Fintype K) (_ : CharP K 2), + ∃ (G : Type) (_ : Group G) (_ : Group.IsFinitelyPresented G), + (∃ (ℓ : ℕ) (_ : ℓ.Prime) (_ : Odd ℓ) (g : G), orderOf g = ℓ) ∧ + ∃ a_out b_out : MonoidAlgebra K G, a_out * b_out = 1 ∧ b_out * a_out ≠ 1 := by + sorry + +end OAI.KaplanskyCounterexample diff --git a/lean/ComparatorChallenges/KaplanskyQuasitrace.json b/lean/ComparatorChallenges/KaplanskyQuasitrace.json new file mode 100644 index 0000000000000000000000000000000000000000..1799a3b039d6fa47d476b5c9701ef26908e39770 --- /dev/null +++ b/lean/ComparatorChallenges/KaplanskyQuasitrace.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.KaplanskyQuasitrace", + "solution_module": "OAI.Analysis.Kaplansky.Main", + "theorem_names": [ + "OAI.Kaplansky.kaplansky_quasitrace_counterexample" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/KaplanskyQuasitrace.lean b/lean/ComparatorChallenges/KaplanskyQuasitrace.lean new file mode 100644 index 0000000000000000000000000000000000000000..00e9ac6caf61bb945684394040ecafa76ce9574d --- /dev/null +++ b/lean/ComparatorChallenges/KaplanskyQuasitrace.lean @@ -0,0 +1,55 @@ +import Mathlib.Algebra.Order.Star.Basic +import Mathlib.Analysis.CStarAlgebra.Classes +import Mathlib.Analysis.CStarAlgebra.CStarMatrix + +namespace OAI + +noncomputable section + +open scoped ComplexOrder + +namespace Kaplansky + +variable {A : Type*} [CStarAlgebra A] + +structure OneQuasitrace (A : Type*) [CStarAlgebra A] where + toFun : A → ℂ + square_nonneg : ∀ x, 0 ≤ toFun (star x * x) + square_swap : ∀ x, toFun (star x * x) = toFun (x * star x) + real_imag : ∀ h k, IsSelfAdjoint h → IsSelfAdjoint k → + toFun (h + Complex.I • k) = toFun h + Complex.I * toFun k + abelian_linear : ∀ S : NonUnitalStarSubalgebra ℂ A, + IsClosed (S : Set A) → (∀ x y : S, x * y = y * x) → + ∃ f : S →ₗ[ℂ] ℂ, ∀ x : S, f x = toFun x + +instance : CoeFun (OneQuasitrace A) (fun _ => A → ℂ) := ⟨OneQuasitrace.toFun⟩ + +def OneQuasitrace.Normalized (τ : OneQuasitrace A) : Prop := τ 1 = 1 + +attribute [local instance] CStarAlgebra.spectralOrder CStarAlgebra.spectralOrderedRing + +def upperLeft (a : A) : CStarMatrix (Fin 2) (Fin 2) A := + CStarMatrix.ofMatrix fun i j => if i = 0 ∧ j = 0 then a else 0 + +def OneQuasitrace.IsTwo (τ : OneQuasitrace A) : Prop := + ∃ σ : OneQuasitrace (CStarMatrix (Fin 2) (Fin 2) A), ∀ a, σ (upperLeft a) = τ a + +def PositiveContraction (a : A) : Prop := (∃ x, a = star x * x) ∧ ‖a‖ ≤ 1 + +def MainTarget : Prop := + ∃ (A : Type) (inst : CStarAlgebra A), + letI := inst + TopologicalSpace.SeparableSpace A ∧ + (∃ τ : OneQuasitrace A, τ.Normalized ∧ τ.IsTwo) ∧ + ∃ a b : A, PositiveContraction a ∧ PositiveContraction b ∧ + ∀ τ : OneQuasitrace A, τ.Normalized → τ.IsTwo → + (1 : ℝ) / 144 ≤ (τ (a+b) - τ a - τ b).re + +theorem kaplansky_quasitrace_counterexample : MainTarget := by + sorry + +end Kaplansky + +end + +end OAI diff --git a/lean/ComparatorChallenges/KaplanskyStableFiniteness.json b/lean/ComparatorChallenges/KaplanskyStableFiniteness.json new file mode 100644 index 0000000000000000000000000000000000000000..7eeca66ec46aa09c244c7e0b802d8e372d3d40a9 --- /dev/null +++ b/lean/ComparatorChallenges/KaplanskyStableFiniteness.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.KaplanskyStableFiniteness", + "solution_module": "OAI.Analysis.Kaplansky.StableFiniteness", + "theorem_names": [ + "OAI.KaplanskyConsequences.stable_finiteness_bundle" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/KaplanskyStableFiniteness.lean b/lean/ComparatorChallenges/KaplanskyStableFiniteness.lean new file mode 100644 index 0000000000000000000000000000000000000000..58e769b5bf6b6ace29fe6252a4778a70f8643630 --- /dev/null +++ b/lean/ComparatorChallenges/KaplanskyStableFiniteness.lean @@ -0,0 +1,247 @@ +import Mathlib + +namespace OAI + +noncomputable section + + +namespace KaplanskyConsequences +open scoped ComplexOrder InnerProductSpace BigOperators ENNReal +namespace Regular +variable {ι : Type*} {H : Type*} [NormedAddCommGroup H] + +abbrev HilbertSum (ι H : Type*) [NormedAddCommGroup H] := lp (fun _ : ι => H) 2 + +lemma reindex_mem (e : ι ≃ ι) (x : HilbertSum ι H) : + Memℓp (fun i => x (e i)) 2 := by + apply memℓp_gen + exact e.summable_iff.2 ((memℓp_gen_iff (by norm_num)).1 (lp.memℓp x)) + +variable [InnerProductSpace ℂ H] + +def reindex (e : ι ≃ ι) : HilbertSum ι H ≃ₗᵢ[ℂ] HilbertSum ι H where + toFun x := ⟨fun i => x (e.symm i), reindex_mem e.symm x⟩ + invFun x := ⟨fun i => x (e i), reindex_mem e x⟩ + left_inv x := by ext; simp + right_inv x := by ext; simp + map_add' x y := by ext; rfl + map_smul' r x := by ext; rfl + norm_map' x := by + rw [lp.norm_eq_tsum_rpow (by norm_num),lp.norm_eq_tsum_rpow (by norm_num)] + congr 1 + exact e.symm.tsum_eq (fun i => ‖x i‖ ^ (2 : ℝ≥0∞).toReal) + +@[simp] lemma reindex_apply (e : ι ≃ ι) (x : HilbertSum ι H) (i : ι) : + reindex e x i = x (e.symm i) := rfl + +variable {G : Type*} [Group G] + +def left (g : G) : HilbertSum G H →L[ℂ] HilbertSum G H := + (reindex (Equiv.mulLeft g)).toLinearIsometry.toContinuousLinearMap + +@[simp] lemma left_apply (g h : G) (x : HilbertSum G H) : left g x h = x (g⁻¹*h) := rfl + +lemma left_one : left (H := H) (1 : G) = 1 := by ext x h; simp +lemma left_mul (g h : G) : left (H := H) (g*h) = left g * left h := by + ext x k + simp [mul_assoc] + +variable [CompleteSpace H] + +lemma left_star (g : G) : star (left (H := H) g) = left g⁻¹ := by + symm + apply (ContinuousLinearMap.eq_adjoint_iff _ _).2 + intro x y + change inner ℂ (left g⁻¹ x) y = inner ℂ x (left g y) + rw [lp.inner_eq_tsum,lp.inner_eq_tsum] + simpa [left_apply,mul_assoc] using + (Equiv.mulLeft g).tsum_eq (fun i => inner ℂ (x i) (y (g⁻¹*i))) + +def Algebra (G : Type*) [Group G] : StarSubalgebra ℂ (HilbertSum G ℂ →L[ℂ] HilbertSum G ℂ) := + (StarAlgebra.adjoin ℂ (Set.range (left (H := ℂ) (G := G)))).topologicalClosure + +instance : IsClosed (Algebra G : Set (HilbertSum G ℂ →L[ℂ] HilbertSum G ℂ)) := + StarSubalgebra.isClosed_topologicalClosure _ + +instance : CStarAlgebra (Algebra G) := inferInstance + +def generator (g : G) : Algebra G := + ⟨left g,StarSubalgebra.le_topologicalClosure _ + (StarAlgebra.subset_adjoin ℂ _ ⟨g,rfl⟩)⟩ + +end Regular +end KaplanskyConsequences + + +namespace KaplanskyConsequences.Regular +abbrev F2 := FreeGroup (Fin 2) + + +open scoped ComplexOrder InnerProductSpace BigOperators ENNReal +attribute [local instance] Classical.propDecidable +variable {G H : Type*} [Group G] [NormedAddCommGroup H] + [InnerProductSpace ℂ H] [CompleteSpace H] + +def diagonal (T : H →L[ℂ] H) : HilbertSum G H →L[ℂ] HilbertSum G H := + lp.mapCLM 2 (fun _ => T) (norm_nonneg T) (fun _ => le_rfl) + +end KaplanskyConsequences.Regular + + +namespace Kaplansky + +section + +section +open scoped ComplexOrder IsMulCommutative + + +variable {A : Type*} [CStarAlgebra A] + +structure OneQuasitrace (A : Type*) [CStarAlgebra A] where + toFun : A → ℂ + square_nonneg : ∀ x, 0 ≤ toFun (star x * x) + square_swap : ∀ x, toFun (star x * x) = toFun (x * star x) + real_imag : ∀ h k, IsSelfAdjoint h → IsSelfAdjoint k → + toFun (h + Complex.I • k) = toFun h + Complex.I * toFun k + abelian_linear : ∀ S : NonUnitalStarSubalgebra ℂ A, + IsClosed (S : Set A) → (∀ x y : S, x * y = y * x) → + ∃ f : S →ₗ[ℂ] ℂ, ∀ x : S, f x = toFun x + +instance : CoeFun (OneQuasitrace A) (fun _ => A → ℂ) := ⟨OneQuasitrace.toFun⟩ + +def OneQuasitrace.Normalized (τ : OneQuasitrace A) : Prop := τ 1 = 1 + +end + + +open scoped ComplexOrder CStarAlgebra +attribute [local instance] CStarAlgebra.spectralOrder CStarAlgebra.spectralOrderedRing +variable {A : Type*} [CStarAlgebra A] + +def ProperlyInfinite (A : Type*) [CStarAlgebra A] : Prop := + ∃ s t : A, star s*s = 1 ∧ star t*t = 1 ∧ star s*t = 0 + +end + + +attribute [local instance] CStarAlgebra.spectralOrder CStarAlgebra.spectralOrderedRing +variable {A : Type*} [CStarAlgebra A] + +def upperLeft (a : A) : CStarMatrix (Fin 2) (Fin 2) A := + CStarMatrix.ofMatrix fun i j => if i = 0 ∧ j = 0 then a else 0 + +def OneQuasitrace.IsTwo (τ : OneQuasitrace A) : Prop := + ∃ σ : OneQuasitrace (CStarMatrix (Fin 2) (Fin 2) A), ∀ a, σ (upperLeft a) = τ a + +end Kaplansky + + +namespace KaplanskyConsequences + +section +open scoped ComplexOrder +open Metric Topology +attribute [local instance] CStarAlgebra.spectralOrder CStarAlgebra.spectralOrderedRing + +structure ClosedStarIdeal (A : Type*) [CStarAlgebra A] extends NonUnitalStarSubalgebra ℂ A where + mul_mem_left : ∀ (a b : A), b ∈ toNonUnitalStarSubalgebra → a * b ∈ toNonUnitalStarSubalgebra + mul_mem_right : ∀ (a b : A), a ∈ toNonUnitalStarSubalgebra → a * b ∈ toNonUnitalStarSubalgebra + closed : IsClosed (toNonUnitalStarSubalgebra : Set A) + +end + + +open scoped ComplexOrder +attribute [local instance] CStarAlgebra.spectralOrder CStarAlgebra.spectralOrderedRing + +def StablyFinite (A : Type*) [CStarAlgebra A] : Prop := + ∀ n : ℕ, 0 < n → ∀ v : CStarMatrix (Fin n) (Fin n) A, + star v * v = 1 → v * star v = 1 + +structure TracialState (A : Type*) [CStarAlgebra A] where + functional : A →ₚ[ℂ] ℂ + normalized : functional 1 = 1 + tracial : ∀ a b, functional (a * b) = functional (b * a) + +def TraceFreeStablyFinite : Prop := + ∃ (A : Type) (inst : CStarAlgebra A), + letI := inst + Nontrivial A ∧ TopologicalSpace.SeparableSpace A ∧ StablyFinite A ∧ + IsEmpty (TracialState A) + +end KaplanskyConsequences + +namespace KaplanskyConsequences.Regular +open scoped ComplexOrder InnerProductSpace BigOperators ENNReal +attribute [local instance] Classical.propDecidable +attribute [local instance] CStarAlgebra.spectralOrder CStarAlgebra.spectralOrderedRing +variable {A : Type*} [CStarAlgebra A] +variable {G H : Type*} [Group G] [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + +def tensorAlgebra (ρ : A →⋆ₐ[ℂ] (H →L[ℂ] H)) : + StarSubalgebra ℂ (HilbertSum G H →L[ℂ] HilbertSum G H) := + (StarAlgebra.adjoin ℂ (Set.range (fun a => diagonal (G:=G) (ρ a)) ∪ Set.range (left (G:=G) (H:=H)))).topologicalClosure + +instance (ρ : A →⋆ₐ[ℂ] (H →L[ℂ] H)) : + IsClosed (tensorAlgebra (G:=G) ρ : Set (HilbertSum G H →L[ℂ] HilbertSum G H)) := + StarSubalgebra.isClosed_topologicalClosure _ +instance (ρ : A →⋆ₐ[ℂ] (H →L[ℂ] H)) : CStarAlgebra (tensorAlgebra (G:=G) ρ) := inferInstance + +end KaplanskyConsequences.Regular + +namespace KaplanskyConsequences + +section + +section +open Kaplansky Regular + +def ReducedQuasitraceLoss : Prop := + ∃ (B : Type) (instB : CStarAlgebra B), + letI := instB + Nontrivial B ∧ TopologicalSpace.SeparableSpace B ∧ + (∃ τ : OneQuasitrace B, τ.Normalized ∧ τ.IsTwo) ∧ + ∃ (H : Type) (instH : NormedAddCommGroup H) (innerH : InnerProductSpace ℂ H), + letI := instH + letI := innerH + ∃ (completeH : CompleteSpace H), + letI := completeH + ∃ ρ : B →⋆ₐ[ℂ] (H →L[ℂ] H), Function.Injective ρ ∧ + ProperlyInfinite (tensorAlgebra (G:=F2) ρ) ∧ + ¬ ∃ τ : OneQuasitrace (tensorAlgebra (G:=F2) ρ), τ.Normalized ∧ τ.IsTwo +end + +open Kaplansky Regular + +def CStarSimple (A : Type*) [CStarAlgebra A] : Prop := + ∀ I : ClosedStarIdeal A, + (∀ a : A, a ∈ I.toNonUnitalStarSubalgebra → a = 0) ∨ + (∀ a : A, a ∈ I.toNonUnitalStarSubalgebra) + +def SimpleStableTensorCounterexample : Prop := + CStarSimple (Algebra F2) ∧ StablyFinite (Algebra F2) ∧ + ∃ (M : Type) (instM : CStarAlgebra M), + letI := instM + Nontrivial M ∧ CStarSimple M ∧ StablyFinite M ∧ + ∃ (H : Type) (instH : NormedAddCommGroup H) (innerH : InnerProductSpace ℂ H), + letI := instH + letI := innerH + ∃ (completeH : CompleteSpace H), + letI := completeH + ∃ ρ : M →⋆ₐ[ℂ] (H →L[ℂ] H), Function.Injective ρ ∧ + ProperlyInfinite (tensorAlgebra (G:=F2) ρ) +end + + +def StableFinitenessBundle : Prop := + SimpleStableTensorCounterexample ∧ ReducedQuasitraceLoss ∧ TraceFreeStablyFinite + +theorem stable_finiteness_bundle : StableFinitenessBundle := by + sorry + +end KaplanskyConsequences + +end + +end OAI diff --git a/lean/ComparatorChallenges/Kervaire.json b/lean/ComparatorChallenges/Kervaire.json new file mode 100644 index 0000000000000000000000000000000000000000..26c9bb1351e63e805cc7c67cbd71f451b530218e --- /dev/null +++ b/lean/ComparatorChallenges/Kervaire.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.Kervaire", + "solution_module": "OAI.GroupTheory.Kervaire.Main", + "theorem_names": [ + "OAI.Kervaire.coefficient_injective" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/Kervaire.lean b/lean/ComparatorChallenges/Kervaire.lean new file mode 100644 index 0000000000000000000000000000000000000000..faf3e5c7338cd5d4d9ed496aa39d5699301f5704 --- /dev/null +++ b/lean/ComparatorChallenges/Kervaire.lean @@ -0,0 +1,39 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace Kervaire + +universe u + +abbrev WordGroup (A : Type u) [Group A] := Monoid.Coprod A (Multiplicative ℤ) + +def exponentSum {A : Type u} [Group A] (w : WordGroup A) : ℤ := + Multiplicative.toAdd (Monoid.Coprod.snd w) + +def Unimodular {A : Type u} [Group A] (w : WordGroup A) : Prop := + exponentSum w = 1 ∨ exponentSum w = -1 + +def relatorClosure {A : Type u} [Group A] (w : WordGroup A) : Subgroup (WordGroup A) := + Subgroup.normalClosure ({w} : Set (WordGroup A)) + +instance {A : Type u} [Group A] (w : WordGroup A) : (relatorClosure w).Normal := + inferInstanceAs (Subgroup.normalClosure ({w} : Set (WordGroup A))).Normal + +abbrev RelatorQuotient {A : Type u} [Group A] (w : WordGroup A) := + WordGroup A ⧸ relatorClosure w + +def coefficientMap {A : Type u} [Group A] (w : WordGroup A) : A →* RelatorQuotient w := + (QuotientGroup.mk' (relatorClosure w)).comp Monoid.Coprod.inl + +theorem coefficient_injective (A : Type u) [Group A] (w : WordGroup A) + (hw : Unimodular w) : Function.Injective (coefficientMap w) := by + sorry + +end Kervaire + +end + +end OAI diff --git a/lean/ComparatorChallenges/KoebeCircleDomains.json b/lean/ComparatorChallenges/KoebeCircleDomains.json new file mode 100644 index 0000000000000000000000000000000000000000..83ccafbf5f8430ae9a9b6561e38fb8de570b89bb --- /dev/null +++ b/lean/ComparatorChallenges/KoebeCircleDomains.json @@ -0,0 +1,15 @@ +{ + "challenge_module": "ComparatorChallenges.KoebeCircleDomains", + "solution_module": "OAI.Analysis.CircleDomains.Main", + "theorem_names": [ + "OAI.Problem047.koebe_circle_domain", + "OAI.Problem047.removability_implies_rigidity" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/KoebeCircleDomains.lean b/lean/ComparatorChallenges/KoebeCircleDomains.lean new file mode 100644 index 0000000000000000000000000000000000000000..9bdcfa4cc65ca9c5364d29dcb769346a1c0fc764 --- /dev/null +++ b/lean/ComparatorChallenges/KoebeCircleDomains.lean @@ -0,0 +1,79 @@ +import Mathlib + +namespace OAI + +/-! Circle-domain uniformization and rigidity under conformal removability. -/ + +noncomputable section +open Set Classical +open scoped OnePoint + +namespace CircleDomainRigidity + +abbrev Sphere := OnePoint ℂ +abbrev Mobius := Matrix.GeneralLinearGroup (Fin 2) ℂ + +def sphereInv (p : Sphere) : Sphere := + p.elim (0 : ℂ) (fun z ↦ if z = 0 then ∞ else (z⁻¹ : ℂ)) + +def finiteCoord (p : Sphere) : ℂ := p.elim 0 id + +def chart (p q : Sphere) : ℂ := + if p = ∞ then finiteCoord (sphereInv q) else finiteCoord q + +def chartSymm (p : Sphere) (z : ℂ) : Sphere := + if p = ∞ then sphereInv (z : Sphere) else (z : Sphere) + +def IsConformalAt (f : Sphere → Sphere) (p : Sphere) : Prop := + ContinuousAt f p ∧ ∃ d : ℂ, d ≠ 0 ∧ + HasDerivAt (fun z ↦ chart (f p) (f (chartSymm p z))) d (chart p p) + +def IsConformalOn (f : Sphere → Sphere) (U : Set Sphere) : Prop := + ∀ p ∈ U, IsConformalAt f p + +def IsConformalEquivalence (f : Sphere → Sphere) (U V : Set Sphere) : Prop := + IsConformalOn f U ∧ MapsTo f U V ∧ ∃ g : Sphere → Sphere, + IsConformalOn g V ∧ MapsTo g V U ∧ + (∀ z ∈ U, g (f z) = z) ∧ (∀ w ∈ V, f (g w) = w) + +def IsRoundClosedDisk (K : Set Sphere) : Prop := + ∃ M : Mobius, + K = (fun p : Sphere ↦ M • p) '' + (((↑) : ℂ → Sphere) '' Metric.closedBall (0 : ℂ) 1) + +def IsCircleDomain (U : Set Sphere) : Prop := + IsOpen U ∧ IsConnected U ∧ + ∀ p ∈ Uᶜ, (∃ q : Sphere, connectedComponentIn Uᶜ p = {q}) ∨ + IsRoundClosedDisk (connectedComponentIn Uᶜ p) + +def OrientationPreserving (h : Sphere ≃ₜ Sphere) : Prop := + ContinuousMap.Homotopic (⟨h, h.continuous⟩ : C(Sphere, Sphere)) (ContinuousMap.id Sphere) + +def IsConformallyRemovable (E : Set Sphere) : Prop := + IsCompact E ∧ ∀ h : Sphere ≃ₜ Sphere, OrientationPreserving h → + IsConformalOn h Eᶜ → ∃ M : Mobius, ∀ p : Sphere, h p = M • p + +end CircleDomainRigidity + +open CircleDomainRigidity + +namespace Problem047 + +theorem koebe_circle_domain : + ∀ U : Set Sphere, IsOpen U → IsConnected U → + ∃ (V : Set Sphere) (f : Sphere → Sphere), + IsCircleDomain V ∧ IsConformalEquivalence f U V := by + sorry + +theorem removability_implies_rigidity : + ∀ (U V : Set Sphere) (f : Sphere → Sphere), + IsCircleDomain U → IsCircleDomain V → + IsConformallyRemovable (frontier U) → IsConformalEquivalence f U V → + ∃ M : Mobius, ∀ p ∈ U, f p = M • p := by + sorry + +end Problem047 + +end + +end OAI diff --git a/lean/ComparatorChallenges/Laughlin.json b/lean/ComparatorChallenges/Laughlin.json new file mode 100644 index 0000000000000000000000000000000000000000..4a7e97904317538cc5b882a01c0531262c1a2672 --- /dev/null +++ b/lean/ComparatorChallenges/Laughlin.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.Laughlin", + "solution_module": "OAI.Analysis.Laughlin.Main", + "theorem_names": [ + "OAI.Laughlin.mainTarget_proved" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/Laughlin.lean b/lean/ComparatorChallenges/Laughlin.lean new file mode 100644 index 0000000000000000000000000000000000000000..ca7d6f7f749474da08c81e28d874eb00b3e96bb4 --- /dev/null +++ b/lean/ComparatorChallenges/Laughlin.lean @@ -0,0 +1,66 @@ +import Mathlib + +namespace OAI + +namespace Laughlin +open scoped BigOperators + +abbrev Configuration (N Q : ℕ) := Fin N → Fin (Q+1) +abbrev State (N Q : ℕ) := Configuration N Q → ℂ + +def Antisymmetric {N Q : ℕ} (ψ : State N Q) : Prop := + ∀ (i j : Fin N), i ≠ j → ∀ a, ψ (a ∘ Equiv.swap i j) = -ψ a + +noncomputable def pairCoefficient (Q p : ℕ) (x y : Fin (Q+1)) : ℝ := + if x.val + y.val = p+1 then + ((x.val : ℝ) - (y.val : ℝ)) * + Real.sqrt (((Q.descFactorial x.val : ℝ) * (Q.descFactorial y.val : ℝ) * + (p.factorial : ℝ)) / + ((Q : ℝ) * ((2*Q-2).descFactorial p : ℝ) * + (x.val.factorial : ℝ) * (y.val.factorial : ℝ))) / Real.sqrt 2 + else 0 + +noncomputable def pairAmplitude {N Q : ℕ} (ψ : State N Q) + (i j : Fin N) (p : ℕ) (a : Configuration N Q) : ℂ := + ∑ x : Fin (Q+1), ∑ y : Fin (Q+1), + (pairCoefficient Q p x y : ℂ) * ψ (Function.update (Function.update a i x) j y) + +noncomputable def energy {N Q : ℕ} (ψ : State N Q) : ℝ := + ∑ i : Fin N, ∑ j : Fin N, if i < j then + ∑ p ∈ Finset.range (2*Q-1), ∑ a : Configuration N Q, + if a i = 0 ∧ a j = 0 then ‖pairAmplitude ψ i j p a‖ ^ 2 else 0 + else 0 + +abbrev SpinorVariables (N : ℕ) := Fin N × Bool + +noncomputable def bracket {N : ℕ} (i j : Fin N) : MvPolynomial (SpinorVariables N) ℂ := + MvPolynomial.X (i,false) * MvPolynomial.X (j,true) - + MvPolynomial.X (j,false) * MvPolynomial.X (i,true) + +noncomputable def laughlinPolynomial (N : ℕ) : MvPolynomial (SpinorVariables N) ℂ := + ∏ i : Fin N, ∏ j : Fin N, if i < j then bracket i j ^ 3 else 1 + +noncomputable def monomialExponent {N Q : ℕ} (a : Configuration N Q) : SpinorVariables N →₀ ℕ := + Finsupp.onFinset Finset.univ + (fun ib => if ib.2 then (a ib.1).val else Q - (a ib.1).val) + (by intro; simp) + +noncomputable def laughlinVector (N Q : ℕ) : State N Q := fun a => + (laughlinPolynomial N).coeff (monomialExponent a) / + ((∏ i : Fin N, Real.sqrt (Nat.choose Q (a i).val : ℝ) : ℝ) : ℂ) + +noncomputable def distanceToLaughlinSq {N Q : ℕ} (ψ : State N Q) : ℝ := + sInf (Set.range (fun c : ℂ => ∑ a : Configuration N Q, + ‖ψ a - c * laughlinVector N Q a‖ ^ 2)) + +def MainTarget : Prop := + ∃ N₀ : ℕ, 2 ≤ N₀ ∧ ∀ N : ℕ, N₀ ≤ N → + ∀ ψ : State N (3*(N-1)), Antisymmetric ψ → + (1/100 : ℝ) * distanceToLaughlinSq ψ ≤ energy ψ + +theorem mainTarget_proved : MainTarget := by + sorry + +end Laughlin + +end OAI diff --git a/lean/ComparatorChallenges/LaughlinFock.json b/lean/ComparatorChallenges/LaughlinFock.json new file mode 100644 index 0000000000000000000000000000000000000000..6211041d309797059106e63a072d280f8d96e70d --- /dev/null +++ b/lean/ComparatorChallenges/LaughlinFock.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.LaughlinFock", + "solution_module": "OAI.Analysis.LaughlinFock.Main", + "theorem_names": [ + "OAI.LaughlinFock.thm_fock" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/LaughlinFock.lean b/lean/ComparatorChallenges/LaughlinFock.lean new file mode 100644 index 0000000000000000000000000000000000000000..de3481d7be603f60000e70a9fc36050a44574b46 --- /dev/null +++ b/lean/ComparatorChallenges/LaughlinFock.lean @@ -0,0 +1,66 @@ +import Mathlib + +namespace OAI + +/-! The spherical V₁ Hamiltonian inequality on the full fermionic Fock space. -/ + +noncomputable section + +namespace Laughlin + +noncomputable def pairCoefficient (Q p : ℕ) (x y : Fin (Q+1)) : ℝ := + if x.val + y.val = p+1 then + ((x.val : ℝ) - (y.val : ℝ)) * + Real.sqrt (((Q.descFactorial x.val : ℝ) * (Q.descFactorial y.val : ℝ) * + (p.factorial : ℝ)) / + ((Q : ℝ) * ((2*Q-2).descFactorial p : ℝ) * + (x.val.factorial : ℝ) * (y.val.factorial : ℝ))) / Real.sqrt 2 + else 0 + +end Laughlin + +run_cmd Lean.modifyEnv fun environment => Lean.Meta.auxLemmasExt.setState environment {} + +namespace LaughlinFock + +open scoped BigOperators Matrix ComplexConjugate ComplexOrder + +abbrev Orbital (Q : ℕ) := Fin (Q + 1) +abbrev Occupation (Q : ℕ) := Finset (Orbital Q) +abbrev FockMatrix (Q : ℕ) := Matrix (Occupation Q) (Occupation Q) ℂ + +def tensorPairCoefficient (Q p : ℕ) (i j : Orbital Q) : ℝ := + _root_.OAI.Laughlin.pairCoefficient Q p i j + +def pairCoefficient (Q p : ℕ) (i j : Orbital Q) : ℝ := + Real.sqrt 2 * tensorPairCoefficient Q p i j + +def annihilator (Q : ℕ) (j : Orbital Q) : FockMatrix Q := fun A B => + if j ∈ B ∧ A = B.erase j then + (-1 : ℂ) ^ (B.filter (fun i => i < j)).card + else 0 + +def pairAnnihilator (Q p : ℕ) : FockMatrix Q := + ∑ i : Orbital Q, ∑ j : Orbital Q, + if i < j then + (pairCoefficient Q p i j : ℂ) • (annihilator Q j * annihilator Q i) + else 0 + +def hamiltonian (Q : ℕ) : FockMatrix Q := + ∑ p ∈ Finset.range (2 * Q - 1), + (pairAnnihilator Q p)ᴴ * pairAnnihilator Q p + +def gammaStar : ℝ := 4616733319001 / 10 ^ 14 + +def FockInequality (Q : ℕ) (γ : ℝ) : Prop := + (hamiltonian Q * hamiltonian Q - γ • hamiltonian Q).PosSemidef + +theorem thm_fock (γ : ℝ) (hγ : 0 < γ) (hγStar : γ < gammaStar) : + ∃ Qγ : ℤ, 1 ≤ Qγ ∧ ∀ Q : ℤ, Qγ ≤ Q → FockInequality Q.toNat γ := by + sorry + +end LaughlinFock + +end + +end OAI diff --git a/lean/ComparatorChallenges/LaughlinGap.json b/lean/ComparatorChallenges/LaughlinGap.json new file mode 100644 index 0000000000000000000000000000000000000000..0d084b8c12cfe9eebf3325616ac4bb2ec50d7707 --- /dev/null +++ b/lean/ComparatorChallenges/LaughlinGap.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.LaughlinGap", + "solution_module": "OAI.Analysis.LaughlinGap.Main", + "theorem_names": [ + "OAI.LaughlinGap.thm_main" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/LaughlinGap.lean b/lean/ComparatorChallenges/LaughlinGap.lean new file mode 100644 index 0000000000000000000000000000000000000000..4512a852b1f35ec8055a31d3e18ed7b615ee772f --- /dev/null +++ b/lean/ComparatorChallenges/LaughlinGap.lean @@ -0,0 +1,83 @@ +import Mathlib + +namespace OAI + +namespace Laughlin +open scoped BigOperators + +abbrev Configuration (N Q : ℕ) := Fin N → Fin (Q+1) +abbrev State (N Q : ℕ) := Configuration N Q → ℂ + + +def Antisymmetric {N Q : ℕ} (ψ : State N Q) : Prop := + ∀ (i j : Fin N), i ≠ j → ∀ a, ψ (a ∘ Equiv.swap i j) = -ψ a + + +noncomputable def pairCoefficient (Q p : ℕ) (x y : Fin (Q+1)) : ℝ := + if x.val + y.val = p+1 then + ((x.val : ℝ) - (y.val : ℝ)) * + Real.sqrt (((Q.descFactorial x.val : ℝ) * (Q.descFactorial y.val : ℝ) * + (p.factorial : ℝ)) / + ((Q : ℝ) * ((2*Q-2).descFactorial p : ℝ) * + (x.val.factorial : ℝ) * (y.val.factorial : ℝ))) / Real.sqrt 2 + else 0 + + + +noncomputable def pairAmplitude {N Q : ℕ} (ψ : State N Q) + (i j : Fin N) (p : ℕ) (a : Configuration N Q) : ℂ := + ∑ x : Fin (Q+1), ∑ y : Fin (Q+1), + (pairCoefficient Q p x y : ℂ) * ψ (Function.update (Function.update a i x) j y) + + + +noncomputable def energy {N Q : ℕ} (ψ : State N Q) : ℝ := + ∑ i : Fin N, ∑ j : Fin N, if i < j then + ∑ p ∈ Finset.range (2*Q-1), ∑ a : Configuration N Q, + if a i = 0 ∧ a j = 0 then ‖pairAmplitude ψ i j p a‖ ^ 2 else 0 + else 0 + +abbrev SpinorVariables (N : ℕ) := Fin N × Bool + + +noncomputable def bracket {N : ℕ} (i j : Fin N) : MvPolynomial (SpinorVariables N) ℂ := + MvPolynomial.X (i,false) * MvPolynomial.X (j,true) - + MvPolynomial.X (j,false) * MvPolynomial.X (i,true) + + +noncomputable def laughlinPolynomial (N : ℕ) : MvPolynomial (SpinorVariables N) ℂ := + ∏ i : Fin N, ∏ j : Fin N, if i < j then bracket i j ^ 3 else 1 + + +noncomputable def monomialExponent {N Q : ℕ} (a : Configuration N Q) : SpinorVariables N →₀ ℕ := + Finsupp.onFinset Finset.univ + (fun ib => if ib.2 then (a ib.1).val else Q - (a ib.1).val) + (by intro; simp) + + + +noncomputable def laughlinVector (N Q : ℕ) : State N Q := fun a => + (laughlinPolynomial N).coeff (monomialExponent a) / + ((∏ i : Fin N, Real.sqrt (Nat.choose Q (a i).val : ℝ) : ℝ) : ℂ) + + + +noncomputable def distanceToLaughlinSq {N Q : ℕ} (ψ : State N Q) : ℝ := + sInf (Set.range (fun c : ℂ => ∑ a : Configuration N Q, + ‖ψ a - c * laughlinVector N Q a‖ ^ 2)) +end Laughlin + +namespace LaughlinGap +export _root_.OAI.Laughlin (Configuration State Antisymmetric pairCoefficient pairAmplitude energy SpinorVariables bracket laughlinPolynomial monomialExponent laughlinVector distanceToLaughlinSq) + +def MainTarget : Prop := + ∃ N₀ : ℕ, 2 ≤ N₀ ∧ ∀ N : ℕ, N₀ ≤ N → + ∀ ψ : State N (3*(N-1)), Antisymmetric ψ → + (1/25 : ℝ) * distanceToLaughlinSq ψ ≤ energy ψ + +theorem thm_main : MainTarget := by + sorry + +end LaughlinGap + +end OAI diff --git a/lean/ComparatorChallenges/LaughlinPlanar.json b/lean/ComparatorChallenges/LaughlinPlanar.json new file mode 100644 index 0000000000000000000000000000000000000000..a7600f4f7f8aebfeb1ddeaaa10fff1e67fa893fe --- /dev/null +++ b/lean/ComparatorChallenges/LaughlinPlanar.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.LaughlinPlanar", + "solution_module": "OAI.Analysis.Laughlin.UniformGap", + "theorem_names": [ + "OAI.Laughlin.planar_gap" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/LaughlinPlanar.lean b/lean/ComparatorChallenges/LaughlinPlanar.lean new file mode 100644 index 0000000000000000000000000000000000000000..37ba51305eee1df7b49f98a1689513cef42f7ca2 --- /dev/null +++ b/lean/ComparatorChallenges/LaughlinPlanar.lean @@ -0,0 +1,82 @@ +import Mathlib + +namespace OAI + +namespace Laughlin +open scoped BigOperators Matrix ENNReal + +noncomputable def gammaStar : ℝ := 4616733319001 / 10^14 + +noncomputable def pairLimitCoefficient (p x y : ℕ) : ℝ := + if x+y = p+1 then + ((x : ℝ)-(y : ℝ)) * Real.sqrt ((p.factorial : ℝ) / + (((2 : ℕ) : ℝ)^p * (x.factorial : ℝ) * (y.factorial : ℝ))) / Real.sqrt (2 : ℕ) + else 0 + +namespace Fock + +abbrev Orbital (Q : ℕ) := Fin (Q+1) → ℂ +abbrev Space (Q : ℕ) := ExteriorAlgebra ℂ (Orbital Q) + +noncomputable def annihilate {Q : ℕ} (i : Fin (Q+1)) : Module.End ℂ (Space Q) := + CliffordAlgebra.contractLeft (Q := (0 : QuadraticForm ℂ (Orbital Q))) (LinearMap.proj i) + +noncomputable def occupationBasis (Q : ℕ) : + Module.Basis (Finset (Fin (Q+1))) ℂ (Space Q) := + (Pi.basisFun ℂ (Fin (Q+1))).ExteriorAlgebra + +def OccupationBidegree (Q n w : ℕ) (x : Space Q) : Prop := + ∀ A : Finset (Fin (Q+1)), (A.card ≠ n ∨ (∑ i ∈ A, i.val) ≠ w) → + (occupationBasis Q).repr x A = 0 + +end Fock + +namespace Planar +open Fock + +abbrev Occupations (L : ℕ) := Finset (Fin (L+1)) + +noncomputable def pairMatrix (L : ℕ) (c : Fin (L+1) → Fin (L+1) → ℂ) : + Matrix (Occupations L) (Occupations L) ℂ := fun A B => + ∑ i, ∑ j, c i j * (occupationBasis L).repr + (annihilate j (annihilate i (occupationBasis L B))) A + +noncomputable def planarCoefficient (p i j : ℕ) : ℂ := + ((pairLimitCoefficient p i j / Real.sqrt (2 : ℕ) : ℝ) : ℂ) + +noncomputable def planarPairMatrix (L p : ℕ) : Matrix (Occupations L) (Occupations L) ℂ := + pairMatrix L (fun i j => planarCoefficient p i.val j.val) + +noncomputable def planarHamiltonian (L : ℕ) : Matrix (Occupations L) (Occupations L) ℂ := + ∑ p ∈ Finset.range (2*L+1), (planarPairMatrix L p)ᴴ * planarPairMatrix L p + +noncomputable def pairEnergy (L : ℕ) + (P : ℕ → Matrix (Occupations L) (Occupations L) ℂ) (x : Occupations L → ℂ) : ℝ := + ∑ p ∈ Finset.range (2*L+1), ∑ A, ‖(P p *ᵥ x) A‖^2 + +noncomputable def squareNorm (L : ℕ) (H : Matrix (Occupations L) (Occupations L) ℂ) + (x : Occupations L → ℂ) : ℝ := ∑ A, ‖(H *ᵥ x) A‖^2 + +/-- Occupation coefficients with fixed particle number in every homogeneous degree. -/ +structure HomogeneousState (N : ℕ) where + block : (L : ℕ) → Space L + homogeneous : ∀ L, OccupationBidegree L N L (block L) + +noncomputable def fullEnergy {N : ℕ} (ψ : HomogeneousState N) : ℝ≥0∞ := + ∑' L, ENNReal.ofReal (pairEnergy L (planarPairMatrix L) + (fun A => (occupationBasis L).repr (ψ.block L) A)) + +noncomputable def fullSquareNorm {N : ℕ} (ψ : HomogeneousState N) : ℝ≥0∞ := + ∑' L, ENNReal.ofReal (squareNorm L (planarHamiltonian L) + (fun A => (occupationBasis L).repr (ψ.block L) A)) + +end Planar + +/-- The planar endpoint inequality in the homogeneous occupation representation. -/ +theorem planar_gap {N : ℕ} (ψ : Planar.HomogeneousState N) : + ENNReal.ofReal gammaStar * Planar.fullEnergy ψ ≤ Planar.fullSquareNorm ψ := by + sorry + +end Laughlin + +end OAI diff --git a/lean/ComparatorChallenges/LiebThirring.json b/lean/ComparatorChallenges/LiebThirring.json new file mode 100644 index 0000000000000000000000000000000000000000..413868acb91c394cf9d6d3ebefe19bbd25167ac1 --- /dev/null +++ b/lean/ComparatorChallenges/LiebThirring.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.LiebThirring", + "solution_module": "OAI.Analysis.LiebThirring.Main", + "theorem_names": [ + "OAI.SharpLiebThirring.sharp_lieb_thirring" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/LiebThirring.lean b/lean/ComparatorChallenges/LiebThirring.lean new file mode 100644 index 0000000000000000000000000000000000000000..dce59855cb6b3554256c2a6b0eb45dc113047015 --- /dev/null +++ b/lean/ComparatorChallenges/LiebThirring.lean @@ -0,0 +1,100 @@ +import Mathlib + +namespace OAI + + +/-! +The form domain is H¹(R;C), represented by an L² function together with its L² +weak derivative. Null-set changes do not affect any definition below. +`negativeMoment` is the extended nonnegative sum over negative eigenvalues, +counting multiplicities: equivalently the supremum over all finite orthonormal +families of weak eigenfunctions of the form. This does not assume in advance +finiteness of the moment or a finite number of eigenvalues. +-/ + + +noncomputable section +open MeasureTheory +open scoped ENNReal Matrix.Norms.L2Operator +open Matrix + +namespace SharpLiebThirring + +structure H1 where + val : ℝ → ℂ + grad : ℝ → ℂ + val_memLp : MemLp val 2 volume + grad_memLp : MemLp grad 2 volume + weak_derivative : ∀ φ : ℝ → ℂ, ContDiff ℝ (↑(⊤ : ℕ∞) : WithTop ℕ∞) φ → HasCompactSupport φ → + (∫ x : ℝ, val x * deriv φ x) = -(∫ x : ℝ, grad x * φ x) + +def l2Pairing (u v : H1) : ℂ := ∫ x : ℝ, star (u.val x) * v.val x + +/-- The polarized form of -d²/dx² - W, on exactly H¹. -/ +def schrodingerForm (W : ℝ → ℝ) (u v : H1) : ℂ := + (∫ x : ℝ, star (u.grad x) * v.grad x) - + ∫ x : ℝ, (W x : ℂ) * star (u.val x) * v.val x + +/-- Weak eigenfunction at the negative energy -k². -/ +def IsNegativeEigenfunction (W : ℝ → ℝ) (k : ℝ) (u : H1) : Prop := + 0 < k ∧ ∀ v : H1, schrodingerForm W v u = -(k ^ 2 : ℝ) * l2Pairing v u + +def IsOrthonormalFamily {N : ℕ} (u : Fin N → H1) : Prop := + ∀ i j, l2Pairing (u i) (u j) = if i = j then 1 else 0 + +/-- An unlimited finite-family-size supremum, in ℝ≥0∞, includes the entire sum. -/ +def negativeMoment (γ : ℝ) (W : ℝ → ℝ) : ℝ≥0∞ := + ⨆ (N : ℕ) (u : Fin N → H1) (k : Fin N → ℝ) + (_ : IsOrthonormalFamily u) (_ : ∀ i, IsNegativeEigenfunction W (k i) (u i)), + ∑ i, (ENNReal.ofReal (k i)) ^ (2 * γ) + +/-- The moment retaining at most one negative eigenvalue. -/ +def oneStateMoment (γ : ℝ) (W : ℝ → ℝ) : ℝ≥0∞ := + ⨆ (u : H1) (k : ℝ) (_ : l2Pairing u u = 1) + (_ : IsNegativeEigenfunction W k u), (ENNReal.ofReal k) ^ (2 * γ) + +def Admissible (γ : ℝ) (W : ℝ → ℝ) : Prop := + (∀ᵐ x : ℝ, 0 ≤ W x) ∧ MemLp W (ENNReal.ofReal (γ + 1 / 2)) volume + +def potentialMass (γ : ℝ) (W : ℝ → ℝ) : ℝ≥0∞ := + ∫⁻ x : ℝ, (ENNReal.ofReal (W x)) ^ (γ + 1 / 2) + +def semiclassicalConstant (γ : ℝ) : ℝ := + Real.Gamma (γ + 1) / (2 * Real.sqrt Real.pi * Real.Gamma (γ + 3 / 2)) + +def sharpConstant (γ : ℝ) : ℝ := + 2 * ((γ - 1 / 2) / (γ + 1 / 2)) ^ (γ - 1 / 2) * semiclassicalConstant γ + +def optimalConstant (γ : ℝ) : ℝ≥0∞ := + ⨆ (W : ℝ → ℝ) (_ : Admissible γ W) (_ : 0 < potentialMass γ W), + negativeMoment γ W / potentialMass γ W + +def oneStateConstant (γ : ℝ) : ℝ≥0∞ := + ⨆ (W : ℝ → ℝ) (_ : Admissible γ W) (_ : 0 < potentialMass γ W), + oneStateMoment γ W / potentialMass γ W + +def equalityPotential (γ : ℝ) (x : ℝ) : ℝ := + let r := (γ - 1 / 2)⁻¹ + (r + 1) * (Real.cosh (r * x))⁻¹ ^ 2 + +/-- The full spectral bound, optimal constants, and attainment at the explicit potential. -/ +def MainClaim : Prop := + ∀ γ : ℝ, 1 / 2 < γ → γ < 3 / 2 → + (∀ W : ℝ → ℝ, Admissible γ W → + negativeMoment γ W ≤ ENNReal.ofReal (sharpConstant γ) * potentialMass γ W) ∧ + optimalConstant γ = ENNReal.ofReal (sharpConstant γ) ∧ + oneStateConstant γ = ENNReal.ofReal (sharpConstant γ) ∧ + Admissible γ (equalityPotential γ) ∧ + 0 < potentialMass γ (equalityPotential γ) ∧ + negativeMoment γ (equalityPotential γ) = + ENNReal.ofReal (sharpConstant γ) * potentialMass γ (equalityPotential γ) + +/-- Full sharp Lieb–Thirring bound, both optimal constants, and equality at the +explicit potential; no finite spectral cutoff is imposed. -/ +theorem sharp_lieb_thirring : MainClaim := by + sorry + +end SharpLiebThirring +end + +end OAI diff --git a/lean/ComparatorChallenges/LipschitzEquivalence.json b/lean/ComparatorChallenges/LipschitzEquivalence.json new file mode 100644 index 0000000000000000000000000000000000000000..f9688c4b33b229462d16796eb79877f385f6b477 --- /dev/null +++ b/lean/ComparatorChallenges/LipschitzEquivalence.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.LipschitzEquivalence", + "solution_module": "OAI.Analysis.LipschitzEquivalence.Main", + "theorem_names": [ + "OAI.LipschitzCounterexample.main" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/LipschitzEquivalence.lean b/lean/ComparatorChallenges/LipschitzEquivalence.lean new file mode 100644 index 0000000000000000000000000000000000000000..5e039fab26d766460d46663f2cedb0310630c17a --- /dev/null +++ b/lean/ComparatorChallenges/LipschitzEquivalence.lean @@ -0,0 +1,44 @@ +import Mathlib + +namespace OAI + +universe uE uF + +noncomputable section +namespace LipschitzCounterexample + +abbrev RealL2 := lp (fun _ : ℕ => ℝ) 2 +abbrev C0L2 := ZeroAtInftyContinuousMap ℕ RealL2 + +structure SeparableRealBanach where + Carrier : Type + [normedAddCommGroup : NormedAddCommGroup Carrier] + [normedSpace : NormedSpace ℝ Carrier] + [completeSpace : CompleteSpace Carrier] + [separableSpace : TopologicalSpace.SeparableSpace Carrier] + +attribute [instance] SeparableRealBanach.normedAddCommGroup + SeparableRealBanach.normedSpace SeparableRealBanach.completeSpace + SeparableRealBanach.separableSpace + +def ContainsLinearCopy (E : Type uE) (F : Type uF) [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] : Prop := + ∃ (T : E →L[ℝ] F) (a : ℝ), 0 < a ∧ ∀ x : E, a * ‖x‖ ≤ ‖T x‖ + +def MainClaim : Prop := + ∃ X Y : SeparableRealBanach, + ∃ Ψ : X.Carrier ≃ Y.Carrier, + (∀ s t : X.Carrier, + (4 / 21 : ℝ) * ‖s - t‖ ≤ ‖Ψ s - Ψ t‖ ∧ + ‖Ψ s - Ψ t‖ ≤ (76 / 25 : ℝ) * ‖s - t‖) ∧ + IsEmpty (X.Carrier ≃L[ℝ] Y.Carrier) ∧ + Nonempty (C0L2 →ₗᵢ[ℝ] X.Carrier) ∧ + ¬ ContainsLinearCopy C0L2 Y.Carrier + +theorem main : MainClaim := by + sorry + +end LipschitzCounterexample +end + +end OAI diff --git a/lean/ComparatorChallenges/LipschitzHilbert.json b/lean/ComparatorChallenges/LipschitzHilbert.json new file mode 100644 index 0000000000000000000000000000000000000000..7008b29d81a93e01ea82821cce93bd8973ce7efb --- /dev/null +++ b/lean/ComparatorChallenges/LipschitzHilbert.json @@ -0,0 +1,15 @@ +{ + "challenge_module": "ComparatorChallenges.LipschitzHilbert", + "solution_module": "OAI.Analysis.LipschitzHilbert.Main", + "theorem_names": [ + "OAI.LipschitzHilbert.main", + "OAI.LipschitzHilbert.uniform_truncation" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Classical.choice", + "Quot.sound" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/LipschitzHilbert.lean b/lean/ComparatorChallenges/LipschitzHilbert.lean new file mode 100644 index 0000000000000000000000000000000000000000..0104a3198408ffd2a33a8fee86e35dc2e65882b0 --- /dev/null +++ b/lean/ComparatorChallenges/LipschitzHilbert.lean @@ -0,0 +1,80 @@ +import Mathlib + +namespace OAI + +noncomputable section + +/- Use the normed-field structure on ℂ for real scalar multiplication. -/ +attribute [-instance] instCommCStarAlgebraComplex + +open MeasureTheory Set +open scoped ENNReal NNReal + +namespace LipschitzHilbert + +abbrev Plane := EuclideanSpace ℝ (Fin 2) +abbrev DirectionPlane := EuclideanSpace ℝ (Fin 2) + +def sample (v : DirectionPlane → DirectionPlane) (t : ℝ) (x : DirectionPlane) : + DirectionPlane := x - t • v x + +/-- The symmetrized form of the hard-truncated directional integral. -/ +def shortTransform (v : DirectionPlane → DirectionPlane) (ε a : ℝ) + (f : DirectionPlane → ℂ) (x : DirectionPlane) : ℂ := + ∫ t in ε..a, t⁻¹ • (f (sample v t x) - f (sample v (-t) x)) + +def directionalKernel (v : DirectionPlane → DirectionPlane) + (f : DirectionPlane → ℂ) (x : DirectionPlane) (t : ℝ) : ℂ := + t⁻¹ • f (sample v t x) + +/-- The two hard-cutoff intervals in the directional Hilbert transform. -/ +def twoSidedTruncation (v : DirectionPlane → DirectionPlane) (ε a : ℝ) + (f : DirectionPlane → ℂ) (x : DirectionPlane) : ℂ := + (∫ t in -a..-ε, directionalKernel v f x t) + + ∫ t in ε..a, directionalKernel v f x t + +/-- The symmetric quotient extended continuously at zero for smooth inputs. -/ +def smoothPrincipalValue (v : DirectionPlane → DirectionPlane) (a : ℝ) + (f : DirectionPlane → ℂ) (x : DirectionPlane) : ℂ := + let g := fun t : ℝ => f (sample v t x)-f (sample v (-t) x) + ∫ t in (0:ℝ)..a, Function.update (fun t => t⁻¹ • g t) 0 (deriv g 0) t + +attribute [instance] instCommCStarAlgebraComplex + +def ShortHilbertConclusion (a : ℝ) (C : ℝ≥0) : Prop := + ∀ v : Plane → Plane, LipschitzWith 1 v → (∀ x, ‖v x‖=1) → + (∀ epsilon : ℝ, 0 + ∫ t : UnitAddCircle, + Real.rpow + |‖littlewoodValue (ε N) (fourier (1 : ℤ) t)‖ / + Real.sqrt (N : ℝ) - 1| + p + ∂AddCircle.haarAddCircle) + Filter.atTop (𝓝 (0 : ℝ)) + +/-- One all-length real-sign family for every finite positive real exponent. -/ +theorem main : MainStatement := by + sorry + +end AsymptoticallyMinimalLittlewoodFiniteFlatness + +end + +end OAI diff --git a/lean/ComparatorChallenges/LogBrunnMinkowski.json b/lean/ComparatorChallenges/LogBrunnMinkowski.json new file mode 100644 index 0000000000000000000000000000000000000000..882a9ff957097cdf6d76150a79b53d7ecb678610 --- /dev/null +++ b/lean/ComparatorChallenges/LogBrunnMinkowski.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.LogBrunnMinkowski", + "solution_module": "OAI.Geometry.LogVolume.BrunnMinkowski", + "theorem_names": [ + "OAI.LogBrunnMinkowski.main" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/LogBrunnMinkowski.lean b/lean/ComparatorChallenges/LogBrunnMinkowski.lean new file mode 100644 index 0000000000000000000000000000000000000000..a40e4c0e7c1cd07231a2335927d8c3588a9115cd --- /dev/null +++ b/lean/ComparatorChallenges/LogBrunnMinkowski.lean @@ -0,0 +1,41 @@ +import Mathlib + +namespace OAI + +noncomputable section + +open Set MeasureTheory +open scoped ENNReal InnerProductSpace + +namespace LogBrunnMinkowski + +abbrev Space (n : ℕ) := EuclideanSpace ℝ (Fin n) + +def IsConvexBody {n : ℕ} (K : Set (Space n)) : Prop := + IsCompact K ∧ Convex ℝ K ∧ (interior K).Nonempty + +def OriginSymmetric {n : ℕ} (K : Set (Space n)) : Prop := + ∀ x, x ∈ K ↔ -x ∈ K + +def support {n : ℕ} (K : Set (Space n)) (u : Space n) : ℝ := + sSup ((fun x : Space n => ⟪x, u⟫_ℝ) '' K) + +def wulff {n : ℕ} (f : Space n → ℝ) : Set (Space n) := + {x | ∀ u, ‖u‖ = 1 → ⟪x, u⟫_ℝ ≤ f u} + +def logCombination {n : ℕ} (K L : Set (Space n)) (t : ℝ) : + Set (Space n) := + wulff (fun u => (support K u) ^ (1 - t) * (support L u) ^ t) + +theorem main (n : ℕ) (hn : 1 ≤ n) (K L : Set (Space n)) + (hK : IsConvexBody K) (hL : IsConvexBody L) + (hsK : OriginSymmetric K) (hsL : OriginSymmetric L) + (t : ℝ) (ht0 : 0 ≤ t) (ht1 : t ≤ 1) : + (volume K) ^ (1 - t) * (volume L) ^ t ≤ volume (logCombination K L t) := by + sorry + +end LogBrunnMinkowski + +end + +end OAI diff --git a/lean/ComparatorChallenges/LogConcaveQuery.json b/lean/ComparatorChallenges/LogConcaveQuery.json new file mode 100644 index 0000000000000000000000000000000000000000..9a80391ad8226fdbdfd6db1ebca617821b571a2a --- /dev/null +++ b/lean/ComparatorChallenges/LogConcaveQuery.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.LogConcaveQuery", + "solution_module": "OAI.Probability.LogConcave.Main", + "theorem_names": [ + "OAI.LogConcaveSampling.exact_source_main" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/LogConcaveQuery.lean b/lean/ComparatorChallenges/LogConcaveQuery.lean new file mode 100644 index 0000000000000000000000000000000000000000..bb5e705b7f6a62aee93a071473d7a06d9dc735d3 --- /dev/null +++ b/lean/ComparatorChallenges/LogConcaveQuery.lean @@ -0,0 +1,93 @@ +import Mathlib + +namespace OAI + +noncomputable section + +open MeasureTheory Filter +open scoped ENNReal NNReal Topology + +namespace LogConcaveSampling + +abbrev Point (d : ℕ) := EuclideanSpace ℝ (Fin d) +abbrev Reply (d : ℕ) := ℝ × Point d +abbrev Transcript (d q : ℕ) := Fin q → Reply d + +/-- Normalized twice continuously differentiable potentials with Hessian between the identity and twice the identity. -/ +structure Admissible {d : ℕ} (V : Point d → ℝ) : Prop where + smooth : ContDiff ℝ 2 V + value_zero : V 0 = 0 + gradient_zero : gradient V 0 = 0 + hessian_bounds : ∀ x v : Point d, + ‖v‖ ^ 2 ≤ inner ℝ v (fderiv ℝ (gradient V) x v) ∧ + inner ℝ v (fderiv ℝ (gradient V) x v) ≤ 2 * ‖v‖ ^ 2 + +/-- The unnormalized Gibbs density relative to Euclidean volume. -/ +def gibbsDensity {d : ℕ} (V : Point d → ℝ) (x : Point d) : ℝ≥0∞ := + ENNReal.ofReal (Real.exp (-V x)) + +def partition {d : ℕ} (V : Point d → ℝ) : ℝ≥0∞ := + ∫⁻ x, gibbsDensity V x ∂volume + +/-- The Gibbs probability law, normalized by its partition function. -/ +def gibbs {d : ℕ} (V : Point d → ℝ) : Measure (Point d) := + (partition V)⁻¹ • volume.withDensity (gibbsDensity V) + +def TVAtMost {E : Type*} [MeasurableSpace E] + (μ ν : Measure E) (ε : ℝ) : Prop := + ∀ s : Set E, MeasurableSet s → |μ.real s - ν.real s| ≤ ε + +def firstOrderReply {d : ℕ} (V : Point d → ℝ) (x : Point d) : Reply d := + (V x, gradient V x) + +/-- Measurable adaptive queries and output, parametrized by private randomness. -/ +structure OracleAlgorithm (Ω : Type*) [MeasurableSpace Ω] (d q : ℕ) where + query : Fin q → Ω × Transcript d q → Point d + query_measurable : ∀ i, Measurable (query i) + output : Ω × Transcript d q → Point d + output_measurable : Measurable output + +def OracleAlgorithm.history {Ω : Type*} [MeasurableSpace Ω] {d q : ℕ} + (A : OracleAlgorithm Ω d q) (V : Point d → ℝ) (ω : Ω) : ℕ → Transcript d q + | 0 => 0 + | n + 1 => + let h := A.history V ω n + if hn : n < q then + Function.update h ⟨n, hn⟩ (firstOrderReply V (A.query ⟨n, hn⟩ (ω, h))) + else h + +def OracleAlgorithm.run {Ω : Type*} [MeasurableSpace Ω] {d q : ℕ} + (A : OracleAlgorithm Ω d q) (V : Point d → ℝ) (ω : Ω) : Point d := + A.output (ω, A.history V ω q) + +/-- A uniform sampler with a deterministic query budget on every execution and total-variation error at most one tenth. -/ +def CanSample (d q : ℕ) : Prop := + ∃ (Ω : Type) (_ : MeasurableSpace Ω) (μ : Measure Ω) + (_ : IsProbabilityMeasure μ) (A : OracleAlgorithm Ω d q), + ∀ V : Point d → ℝ, Admissible V → + Measurable (A.run V) ∧ TVAtMost (μ.map (A.run V)) (gibbs V) (1 / 10) + +/-- The smallest feasible integer query budget, or infinity when no budget is feasible. -/ +def queryComplexity (d : ℕ) : ℕ∞ := + sInf ((fun q : ℕ => (q : ℕ∞)) '' {q | CanSample d q}) + +/-- The quantified dimension-exponent upper bound with every positive exponent slack. -/ +def ExponentBound (γ : ℝ) : Prop := + 0 ≤ γ ∧ ∀ ε : ℝ, 0 < ε → ∃ d₀ : ℕ, ∀ d : ℕ, d₀ ≤ d → + (queryComplexity d).toENNReal ≤ ENNReal.ofReal ((d : ℝ) ^ (γ + ε)) + +def gammaStar : ℝ := sInf {γ : ℝ | ExponentBound γ} + +theorem exact_source_main : + (∀ ε : ℝ, 0 < ε → ∃ C : ℝ, ∀ d : ℕ, 2 ≤ d → + (queryComplexity d).toENNReal ≤ ENNReal.ofReal (C * (d : ℝ) ^ ε)) ∧ + (∃ c : ℝ, 0 < c ∧ ∃ d₀ : ℕ, 2 ≤ d₀ ∧ ∀ d : ℕ, d₀ ≤ d → + ENNReal.ofReal (c * Real.log (d : ℝ)) ≤ (queryComplexity d).toENNReal) ∧ + gammaStar = 0 := by + sorry + +end LogConcaveSampling + +end + +end OAI diff --git a/lean/ComparatorChallenges/LogKodairaFiberNegative.json b/lean/ComparatorChallenges/LogKodairaFiberNegative.json new file mode 100644 index 0000000000000000000000000000000000000000..ce98b6e80190efca2332a2bccb8c9f5383c43d99 --- /dev/null +++ b/lean/ComparatorChallenges/LogKodairaFiberNegative.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.LogKodairaFiberNegative", + "solution_module": "OAI.AlgebraicGeometry.LogKodaira.FiberNegative", + "theorem_names": [ + "OAI.ReverseLogKodaira.SmoothProjectiveVariety.veryGenerally_fiber_negative_branch" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/LogKodairaFiberNegative.lean b/lean/ComparatorChallenges/LogKodairaFiberNegative.lean new file mode 100644 index 0000000000000000000000000000000000000000..399a9de26676b0fcf9e7e89ae6b5e31474109111 --- /dev/null +++ b/lean/ComparatorChallenges/LogKodairaFiberNegative.lean @@ -0,0 +1,245 @@ +import Mathlib + +namespace OAI + + + +noncomputable section + +open CategoryTheory AlgebraicGeometry +open scoped TensorProduct + +namespace ReverseLogKodaira + +attribute [local instance] MvPolynomial.gradedAlgebra + +abbrev complexBase : Scheme := Spec (CommRingCat.of ℂ) + +abbrev projectiveGrading (N : ℕ) := MvPolynomial.homogeneousSubmodule (Fin (N + 1)) ℂ + +abbrev complexProjectiveSpace (N : ℕ) : Scheme := Proj (projectiveGrading N) + +def projectiveConstants (N : ℕ) : ℂ →+* projectiveGrading N 0 where + toFun r := ⟨MvPolynomial.C r, MvPolynomial.isHomogeneous_C (Fin (N + 1)) r⟩ + map_zero' := Subtype.ext (map_zero MvPolynomial.C) + map_one' := Subtype.ext (map_one MvPolynomial.C) + map_add' x y := Subtype.ext (map_add MvPolynomial.C x y) + map_mul' x y := Subtype.ext (map_mul MvPolynomial.C x y) + +def complexProjectiveStructure (N : ℕ) : complexProjectiveSpace N ⟶ complexBase := + Proj.toSpecZero (projectiveGrading N) ≫ Spec.map (CommRingCat.ofHom (projectiveConstants N)) + + +structure SmoothProjectiveVariety where + scheme : Scheme + structural : scheme ⟶ complexBase + dimension : ℕ + integral : IsIntegral scheme + smooth : SmoothOfRelativeDimension dimension structural + projective : ∃ (N : ℕ) (i : scheme ⟶ complexProjectiveSpace N), + IsClosedImmersion i ∧ i ≫ complexProjectiveStructure N = structural + +attribute [instance] SmoothProjectiveVariety.integral SmoothProjectiveVariety.smooth + +namespace SmoothProjectiveVariety + +instance (X : SmoothProjectiveVariety) : Smooth X.structural := + SmoothOfRelativeDimension.smooth X.dimension X.structural + + +def globalConstants (X : SmoothProjectiveVariety) : ℂ →+* Γ(X.scheme, ⊤) := + X.structural.appTop.hom.comp (Scheme.ΓSpecIso (CommRingCat.of ℂ)).inv.hom + + +def constants (X : SmoothProjectiveVariety) (U : X.scheme.Opens) : ℂ →+* Γ(X.scheme, U) := + (X.scheme.presheaf.map (homOfLE (le_top (a := U))).op).hom.comp X.globalConstants + +instance (X : SmoothProjectiveVariety) (U : X.scheme.Opens) : Algebra ℂ Γ(X.scheme, U) := + (X.constants U).toAlgebra + +instance (X : SmoothProjectiveVariety) : Nonempty (⊤ : X.scheme.Opens) := + ⟨⟨genericPoint X.scheme, by trivial⟩⟩ + + +def functionFieldConstants (X : SmoothProjectiveVariety) : ℂ →+* X.scheme.functionField := + (X.scheme.germToFunctionField ⊤).hom.comp X.globalConstants + +instance (X : SmoothProjectiveVariety) : Algebra ℂ X.scheme.functionField := + X.functionFieldConstants.toAlgebra + +lemma germ_constants (X : SmoothProjectiveVariety) (U : X.scheme.Opens) [Nonempty U] (c : ℂ) : + algebraMap Γ(X.scheme, U) X.scheme.functionField (algebraMap ℂ Γ(X.scheme, U) c) = + algebraMap ℂ X.scheme.functionField c := by + change X.scheme.presheaf.germ U (genericPoint X.scheme) _ + (X.scheme.presheaf.map (homOfLE (le_top (a := U))).op (X.globalConstants c)) = + X.scheme.presheaf.germ ⊤ (genericPoint X.scheme) _ (X.globalConstants c) + exact X.scheme.presheaf.germ_res_apply (homOfLE le_top) (genericPoint X.scheme) _ _ + +instance (X : SmoothProjectiveVariety) (U : X.scheme.Opens) [Nonempty U] : + IsScalarTower ℂ Γ(X.scheme, U) X.scheme.functionField := + IsScalarTower.of_algebraMap_eq fun c => (X.germ_constants U c).symm + +abbrev RationalCanonical (X : SmoothProjectiveVariety) := + ⋀[X.scheme.functionField]^X.dimension (KaehlerDifferential ℂ X.scheme.functionField) + +abbrev RationalPluriform (X : SmoothProjectiveVariety) (m : ℕ) := + ⨂[X.scheme.functionField]^m X.RationalCanonical + +instance (X : SmoothProjectiveVariety) (m : ℕ) : AddCommGroup (X.RationalPluriform m) := + Module.addCommMonoidToAddCommGroup X.scheme.functionField + +def regularPluriformLattice (X : SmoothProjectiveVariety) (U : X.scheme.affineOpens) + [Nonempty U.1] (m : ℕ) : Submodule Γ(X.scheme, U.1) (X.RationalPluriform m) := + Submodule.span Γ(X.scheme, U.1) <| Set.range fun a : Fin m → Fin X.dimension → Γ(X.scheme, U.1) => + PiTensorProduct.tprod X.scheme.functionField fun j => + exteriorPower.ιMulti X.scheme.functionField X.dimension fun i => + KaehlerDifferential.D ℂ X.scheme.functionField (algebraMap _ _ (a j i)) + + + +def IsCartierIdeal (X : SmoothProjectiveVariety) (I : X.scheme.IdealSheafData) : Prop := + ∀ x : X.scheme, ∃ (U : X.scheme.affineOpens), x ∈ U.1 ∧ + ∃ t : Γ(X.scheme, U.1), t ≠ 0 ∧ I.ideal U = Ideal.span {t} + +structure ReducedSNCBoundary (X : SmoothProjectiveVariety) where + count : ℕ + components : Fin count → X.scheme.IdealSheafData + cartier : ∀ i, X.IsCartierIdeal (components i) + transverse : ∀ S : Finset (Fin count), S.Nonempty → + IsEmpty ((S.sup components).subscheme) ∨ + (S.card ≤ X.dimension ∧ SmoothOfRelativeDimension (X.dimension - S.card) + ((S.sup components).subschemeι ≫ X.structural)) + union_cartier : X.IsCartierIdeal (∏ i, components i) + +namespace ReducedSNCBoundary + +def ideal {X : SmoothProjectiveVariety} (E : X.ReducedSNCBoundary) : X.scheme.IdealSheafData := + ∏ i, E.components i + + +def support {X : SmoothProjectiveVariety} (E : X.ReducedSNCBoundary) : Set X.scheme := + E.ideal.support + +def IsLogPluriform {X : SmoothProjectiveVariety} (E : X.ReducedSNCBoundary) + (m : ℕ) (s : X.RationalPluriform m) : Prop := + ∀ (U : X.scheme.affineOpens) (_ : Nonempty U.1) (t : Γ(X.scheme, U.1)), + t ≠ 0 → E.ideal.ideal U = Ideal.span {t} → + (algebraMap Γ(X.scheme, U.1) X.scheme.functionField t)^m • s ∈ + X.regularPluriformLattice U m + +lemma isLogPluriform_zero {X : SmoothProjectiveVariety} (E : X.ReducedSNCBoundary) (m : ℕ) : + E.IsLogPluriform m 0 := by + intro U hU t ht hI + simp only [smul_zero, Submodule.zero_mem] + +lemma isLogPluriform_add {X : SmoothProjectiveVariety} (E : X.ReducedSNCBoundary) (m : ℕ) + {s r : X.RationalPluriform m} (hs : E.IsLogPluriform m s) (hr : E.IsLogPluriform m r) : + E.IsLogPluriform m (s + r) := by + intro U hU t ht hI + simpa only [smul_add] using (X.regularPluriformLattice U m).add_mem + (hs U hU t ht hI) (hr U hU t ht hI) + +lemma isLogPluriform_smul {X : SmoothProjectiveVariety} (E : X.ReducedSNCBoundary) (m : ℕ) + (c : ℂ) {s : X.RationalPluriform m} (hs : E.IsLogPluriform m s) : + E.IsLogPluriform m (c • s) := by + intro U hU t ht hI + have h := (X.regularPluriformLattice U m).smul_mem + (algebraMap ℂ Γ(X.scheme, U.1) c) (hs U hU t ht hI) + rw [IsScalarTower.algebraMap_smul Γ(X.scheme, U.1)] at h + rwa [smul_comm c] at h + + + +def sections {X : SmoothProjectiveVariety} (E : X.ReducedSNCBoundary) (m : ℕ) : + Submodule ℂ (X.RationalPluriform m) where + carrier := E.IsLogPluriform m + zero_mem' := E.isLogPluriform_zero m + add_mem' := E.isLogPluriform_add m + smul_mem' := E.isLogPluriform_smul m + + + +def HasImageDimensionAtLeast {X : SmoothProjectiveVariety} + (E : X.ReducedSNCBoundary) (k : ℕ) : Prop := + ∃ (m : ℕ), 0 < m ∧ ∃ s : X.RationalPluriform m, + s ∈ E.sections m ∧ s ≠ 0 ∧ ∃ r : Fin k → X.scheme.functionField, + AlgebraicIndependent ℂ r ∧ ∀ i, r i • s ∈ E.sections m + + + +def kodaira {X : SmoothProjectiveVariety} (E : X.ReducedSNCBoundary) : WithBot ℕ∞ := + ⨆ (k : ℕ) (_ : E.HasImageDimensionAtLeast k), ((k : ℕ∞) : WithBot ℕ∞) + +end ReducedSNCBoundary + + +structure ComplexPoint (X : SmoothProjectiveVariety) where + hom : complexBase ⟶ X.scheme + over_base : hom ≫ X.structural = 𝟙 complexBase + + +def complexBasePoint : complexBase := ⟨⊥, Ideal.isPrime_bot⟩ + + +def ComplexPoint.point {X : SmoothProjectiveVariety} (y : X.ComplexPoint) : X.scheme := + y.hom complexBasePoint + + +def ReducedSNCBoundary.complement {X : SmoothProjectiveVariety} (E : X.ReducedSNCBoundary) : + X.scheme.Opens := E.ideal.support.compl + + + +structure BoundaryFibration (X Y : SmoothProjectiveVariety) + (E : X.ReducedSNCBoundary) (D : Y.ReducedSNCBoundary) where + hom : X.scheme ⟶ Y.scheme + over_base : hom ≫ Y.structural = X.structural + surjective : Surjective hom + connected : ∀ y : Y.ComplexPoint, ConnectedSpace ↥(CategoryTheory.Limits.pullback hom y.hom) + support : hom ⁻¹' D.support ⊆ E.support + + + +structure StratumSmoothFibration (X Y : SmoothProjectiveVariety) + (E : X.ReducedSNCBoundary) (D : Y.ReducedSNCBoundary) + extends BoundaryFibration X Y E D where + smooth : Smooth (hom.resLE D.complement (hom ⁻¹ᵁ D.complement) le_rfl) + strata : ∀ (S : Finset (Fin E.count)), S.Nonempty → + Smooth (((S.sup E.components).subschemeι ≫ hom).resLE D.complement + (((S.sup E.components).subschemeι ≫ hom) ⁻¹ᵁ D.complement) le_rfl) + + + +structure FiberModel {X Y : SmoothProjectiveVariety} {E : X.ReducedSNCBoundary} + {D : Y.ReducedSNCBoundary} (f : BoundaryFibration X Y E D) (y : Y.ComplexPoint) where + variety : SmoothProjectiveVariety + inclusion : variety.scheme ⟶ X.scheme + square : IsPullback inclusion variety.structural f.hom y.hom + boundary : variety.ReducedSNCBoundary + boundary_pullback : boundary.ideal = E.ideal.comap inclusion + + + +def VeryGenerally (Y : SmoothProjectiveVariety) (P : Y.ComplexPoint → Prop) : Prop := + ∃ Z : ℕ → TopologicalSpace.Closeds Y.scheme, + (∀ n, Z n ≠ ⊤) ∧ ∀ y : Y.ComplexPoint, (∀ n, y.point ∉ Z n) → P y + +end SmoothProjectiveVariety + +end ReverseLogKodaira + +namespace ReverseLogKodaira.SmoothProjectiveVariety + +theorem veryGenerally_fiber_negative_branch + {X Y : SmoothProjectiveVariety} {E : X.ReducedSNCBoundary} {D : Y.ReducedSNCBoundary} + (f : StratumSmoothFibration X Y E D) : + VeryGenerally Y fun y => y.point ∈ D.complement ∧ + ∀ F : FiberModel f.toBoundaryFibration y, F.boundary.kodaira = ⊥ → + E.kodaira = D.kodaira + F.boundary.kodaira ∧ + ∀ (m : ℕ), 0 < m → ∀ s : X.RationalPluriform m, s ∈ E.sections m → s = 0 := by sorry + +end ReverseLogKodaira.SmoothProjectiveVariety + +end + +end OAI diff --git a/lean/ComparatorChallenges/MUBSix.json b/lean/ComparatorChallenges/MUBSix.json new file mode 100644 index 0000000000000000000000000000000000000000..e7ca6af996cfe93e34d55bba7a9c78e42bd01769 --- /dev/null +++ b/lean/ComparatorChallenges/MUBSix.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.MUBSix", + "solution_module": "OAI.Analysis.MutuallyUnbiased.Main", + "theorem_names": [ + "OAI.MUB6.fourier_and_family_bound" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/MUBSix.lean b/lean/ComparatorChallenges/MUBSix.lean new file mode 100644 index 0000000000000000000000000000000000000000..c4175d7e59389fdc09abcff6935902c4df73122e --- /dev/null +++ b/lean/ComparatorChallenges/MUBSix.lean @@ -0,0 +1,66 @@ +import Mathlib + +namespace OAI + +noncomputable section +open scoped BigOperators ComplexConjugate + +namespace MUB6 + +abbrev Coord := Fin 6 +abbrev CMatrix := Matrix Coord Coord ℂ +abbrev Charge := Coord → ℤ + +def IsHadamard (H : CMatrix) : Prop := + (∀ i j, Complex.normSq (H i j) = 1) ∧ + H.conjTranspose * H = (6 : ℂ) • (1 : CMatrix) + +def character (x : Coord → ℂ) (a : Charge) : ℂ := ∏ i, x i ^ a i + +def g (H : CMatrix) (a : Charge) : ℂ := + (6 : ℂ)⁻¹ * ∑ k, character (fun i => H i k) a + +def alpha : Charge := ![1, 1, 1, -1, -1, -1] + +def permuteCharge (π : Equiv.Perm Coord) (a : Charge) : Charge := a ∘ π + +/-- Full Hadamard equivalence, with arbitrary unit complex phases. -/ +def Equivalent (H K : CMatrix) : Prop := + ∃ (r c : Equiv.Perm Coord) (u v : Coord → ℂ), + (∀ i, Complex.normSq (u i) = 1) ∧ (∀ j, Complex.normSq (v j) = 1) ∧ + ∀ i j, K i j = u i * H (r i) (c j) * v j + +def omega : ℂ := Complex.exp (2 * Real.pi * Complex.I / 3) + +/-- The five-cycle exponent matrix in equation (cubic-matrix). +The entries 2 represent the exponents -1 modulo three. -/ +def taoExponent : Matrix Coord Coord ℕ := + !![0, 0, 0, 0, 0, 0; + 0, 0, 1, 2, 2, 1; + 0, 1, 0, 1, 2, 2; + 0, 2, 1, 0, 1, 2; + 0, 2, 2, 1, 0, 1; + 0, 1, 2, 2, 1, 0] + +def tao : CMatrix := fun i j => omega ^ taoExponent i j + +abbrev Space := EuclideanSpace ℂ Coord +abbrev Basis := OrthonormalBasis Coord ℂ Space + +def IsMUBFamily {n : ℕ} (B : Fin n → Basis) : Prop := + ∀ r s, r ≠ s → ∀ i j, + Complex.normSq (inner ℂ (B r i) (B s j)) = (1 : ℝ) / 6 + +def Attainable (n : ℕ) : Prop := ∃ B : Fin n → Basis, IsMUBFamily B + +theorem fourier_and_family_bound : + (∀ H : CMatrix, IsHadamard H → ¬Equivalent H tao → + ∀ π : Equiv.Perm Coord, g H (permuteCharge π alpha) = 0) ∧ + (∀ n : ℕ, Attainable n → n ≤ 5) := by + sorry + +end MUB6 + +end + +end OAI diff --git a/lean/ComparatorChallenges/MahlerConjecture.json b/lean/ComparatorChallenges/MahlerConjecture.json new file mode 100644 index 0000000000000000000000000000000000000000..410a7c012b122da7d8a7f78e6214e1f9856e9d9b --- /dev/null +++ b/lean/ComparatorChallenges/MahlerConjecture.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.MahlerConjecture", + "solution_module": "OAI.Analysis.Mahler.MainTheorem", + "theorem_names": [ + "OAI.SymmetricMahler.symmetric_mahler" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/MahlerConjecture.lean b/lean/ComparatorChallenges/MahlerConjecture.lean new file mode 100644 index 0000000000000000000000000000000000000000..bb8fd407424ca2e0a71dc34fa6d60cf8ce84bd8d --- /dev/null +++ b/lean/ComparatorChallenges/MahlerConjecture.lean @@ -0,0 +1,26 @@ +import Mathlib + +namespace OAI + +namespace SymmetricMahler + +variable {I : Type*} [Fintype I] + +def coordinatePolar (K : Set (I → ℝ)) : Set (I → ℝ) := + {p | ∀ v ∈ K, (∑ i, p i*v i) ≤ 1} + +noncomputable section +open Set MeasureTheory + +theorem symmetric_mahler {n : ℕ} (hn : 1 ≤ n) + {K : Set (Fin n → ℝ)} (hK : IsCompact K) (hconv : Convex ℝ K) + (hsym : ∀ x ∈ K, -x ∈ K) (hint : (interior K).Nonempty) : + (4:ℝ)^n/(Nat.factorial n:ℝ) ≤ + (volume K).toReal*(volume (coordinatePolar K)).toReal := by + sorry + +end + +end SymmetricMahler + +end OAI diff --git a/lean/ComparatorChallenges/MarkovType.json b/lean/ComparatorChallenges/MarkovType.json new file mode 100644 index 0000000000000000000000000000000000000000..35f10fca9eafdab3c99979464ceed4b964325a6c --- /dev/null +++ b/lean/ComparatorChallenges/MarkovType.json @@ -0,0 +1,14 @@ +{ + "solution_module": "OAI.Analysis.MarkovType.Main", + "challenge_module": "ComparatorChallenges.MarkovType", + "theorem_names": [ + "OAI.MarkovSuperreflexivity.hasNontrivialMarkovType_iff_hasEquivalentUCNorm" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/MarkovType.lean b/lean/ComparatorChallenges/MarkovType.lean new file mode 100644 index 0000000000000000000000000000000000000000..5fcf3818f09073764b6be28ecaf25acb2a432d30 --- /dev/null +++ b/lean/ComparatorChallenges/MarkovType.lean @@ -0,0 +1,79 @@ +import Mathlib + +namespace OAI + +noncomputable section + +open scoped BigOperators + +namespace MarkovSuperreflexivity + +structure FiniteReversibleChain (S : Type*) [Fintype S] where + π : S → ℝ + P : S → S → ℝ + π_nonneg : ∀ s, 0 ≤ π s + sum_π : ∑ s, π s = 1 + P_nonneg : ∀ s t, 0 ≤ P s t + sum_P : ∀ s, ∑ t, P s t = 1 + balance : ∀ s t, π s * P s t = π t * P t s + +abbrev StatePath (S : Type*) (n : ℕ) := Fin (n + 1) → S + +def pathWeight {S : Type*} [Fintype S] + (C : FiniteReversibleChain S) (n : ℕ) (ω : StatePath S n) : ℝ := + C.π (ω 0) * ∏ i : Fin n, C.P (ω i.castSucc) (ω i.succ) + +def stateCost {S X : Type*} [Fintype S] [NormedAddCommGroup X] + (C : FiniteReversibleChain S) (f : S → X) (p : ℝ) (n : ℕ) : ℝ := + ∑ ω : StatePath S n, + pathWeight C n ω * Real.rpow (‖f (ω (Fin.last n)) - f (ω 0)‖) p + +def MarkovTypeWith (p K : ℝ) (X : Type*) [NormedAddCommGroup X] : Prop := + 0 < p ∧ 0 < K ∧ + ∀ (m : ℕ) (C : FiniteReversibleChain (Fin m)) (f : Fin m → X) (n : ℕ), + 1 ≤ n → stateCost C f p n ≤ Real.rpow K p * (n : ℝ) * stateCost C f p 1 + +def HasMarkovType (p : ℝ) (X : Type*) [NormedAddCommGroup X] : Prop := + ∃ K : ℝ, MarkovTypeWith p K X + +def HasNontrivialMarkovType (X : Type*) [NormedAddCommGroup X] : Prop := + ∃ p : ℝ, 1 < p ∧ HasMarkovType p X + +section + +universe u + +variable (X : Type u) [NormedAddCommGroup X] [NormedSpace ℝ X] + +structure EquivalentNorm where + p : Seminorm ℝ X + lower : ℝ + upper : ℝ + lower_pos : 0 < lower + upper_pos : 0 < upper + lower_bound : ∀ x, lower * ‖x‖ ≤ p x + upper_bound : ∀ x, p x ≤ upper * ‖x‖ + +variable {X} + +def UniformConvex (p : Seminorm ℝ X) : Prop := + ∀ ε : ℝ, 0 < ε → ε ≤ 2 → ∃ δ : ℝ, 0 < δ ∧ + ∀ x y : X, p x ≤ 1 → p y ≤ 1 → ε ≤ p (x - y) → + p ((1 / 2 : ℝ) • (x + y)) ≤ 1 - δ + +def HasEquivalentUCNorm (X : Type u) [NormedAddCommGroup X] [NormedSpace ℝ X] : Prop := + ∃ N : EquivalentNorm X, UniformConvex N.p + +end + +variable {X : Type*} [NormedAddCommGroup X] [NormedSpace ℝ X] + +theorem hasNontrivialMarkovType_iff_hasEquivalentUCNorm [CompleteSpace X] : + HasNontrivialMarkovType X ↔ HasEquivalentUCNorm X := by + sorry + +end MarkovSuperreflexivity + +end + +end OAI diff --git a/lean/ComparatorChallenges/MassAction.json b/lean/ComparatorChallenges/MassAction.json new file mode 100644 index 0000000000000000000000000000000000000000..1b5a55ee481e3cadb778d820ab604549f3f387e7 --- /dev/null +++ b/lean/ComparatorChallenges/MassAction.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.MassAction", + "solution_module": "OAI.Analysis.MassAction.Main", + "theorem_names": [ + "OAI.Problem326.global_bounded_persistent_solution" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/MassAction.lean b/lean/ComparatorChallenges/MassAction.lean new file mode 100644 index 0000000000000000000000000000000000000000..838d6cd67700dc8f843c67cd5cb334a5ec4b7d86 --- /dev/null +++ b/lean/ComparatorChallenges/MassAction.lean @@ -0,0 +1,60 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace Problem326 + +structure ReactionNetwork (d : ℕ) where + complexes : Finset (Fin d → ℕ) + reactions : Finset ((Fin d → ℕ) × (Fin d → ℕ)) + source_mem : ∀ e ∈ reactions, e.1 ∈ complexes + target_mem : ∀ e ∈ reactions, e.2 ∈ complexes + source_ne_target : ∀ e ∈ reactions, e.1 ≠ e.2 + +abbrev Reaction {d : ℕ} (N : ReactionNetwork d) := + {e : (Fin d → ℕ) × (Fin d → ℕ) // e ∈ N.reactions} + +def HasReaction {d : ℕ} (N : ReactionNetwork d) + (y z : Fin d → ℕ) : Prop := + (y, z) ∈ N.reactions + +def WeaklyReversible {d : ℕ} (N : ReactionNetwork d) : Prop := + ∀ e : Reaction N, + Relation.TransGen (HasReaction N) e.val.2 e.val.1 + +def monomial {d : ℕ} (x : Fin d → ℝ) (y : Fin d → ℕ) : ℝ := + Finset.univ.prod (fun i => x i ^ y i) + +def massAction {d : ℕ} (N : ReactionNetwork d) + (κ : Reaction N → ℝ) (x : Fin d → ℝ) : Fin d → ℝ := + fun i => Finset.univ.sum (fun e : Reaction N => + κ e * monomial x e.val.1 * + ((e.val.2 i : ℝ) - (e.val.1 i : ℝ))) + +def PositiveState {d : ℕ} (x : Fin d → ℝ) : Prop := + ∀ i, 0 < x i + +def IsGlobalForwardSolution {d : ℕ} (N : ReactionNetwork d) + (κ : Reaction N → ℝ) (x0 : Fin d → ℝ) + (x : ℝ → (Fin d → ℝ)) : Prop := + x 0 = x0 ∧ + ∀ t : ℝ, 0 ≤ t → + HasDerivAt x (massAction N κ (x t)) t + +theorem global_bounded_persistent_solution : + ∀ (d : ℕ) (N : ReactionNetwork d) (κ : Reaction N → ℝ), + 0 < d → WeaklyReversible N → (∀ e, 0 < κ e) → + ∀ x0 : Fin d → ℝ, PositiveState x0 → + ∃ ε : ℝ, 0 < ε ∧ ε < 1 ∧ + (∃ x : ℝ → (Fin d → ℝ), IsGlobalForwardSolution N κ x0 x) ∧ + ∀ x : ℝ → (Fin d → ℝ), IsGlobalForwardSolution N κ x0 x → + ∀ t : ℝ, 0 ≤ t → ∀ i : Fin d, ε ≤ x t i ∧ x t i ≤ ε⁻¹ := by + sorry + +end Problem326 + +end + +end OAI diff --git a/lean/ComparatorChallenges/MatchingAffineLift.json b/lean/ComparatorChallenges/MatchingAffineLift.json new file mode 100644 index 0000000000000000000000000000000000000000..4f0f9c95d56f339ea60b0093adf1ce9df00fc2c9 --- /dev/null +++ b/lean/ComparatorChallenges/MatchingAffineLift.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.MatchingAffineLift", + "solution_module": "OAI.Combinatorics.MatchingPSD.AffineLift", + "theorem_names": [ + "OAI.PerfectMatchingPSD.affine_lift_lower_bound" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Classical.choice", + "Quot.sound" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/MatchingAffineLift.lean b/lean/ComparatorChallenges/MatchingAffineLift.lean new file mode 100644 index 0000000000000000000000000000000000000000..0b79e0344201a5c668b1046424c5fcad5ee6ac5b --- /dev/null +++ b/lean/ComparatorChallenges/MatchingAffineLift.lean @@ -0,0 +1,35 @@ +import Mathlib + +namespace OAI + +namespace PerfectMatchingPSD + +abbrev Edge (n : ℕ) := {p : Fin n × Fin n // p.1 < p.2} + +def IsPerfectMatching {n : ℕ} (M : Finset (Edge n)) : Prop := + ∀ v : Fin n, (M.filter fun e => e.1.1 = v ∨ e.1.2 = v).card = 1 + +abbrev PerfectMatching (n : ℕ) := + {M : Finset (Edge n) // IsPerfectMatching M} + +noncomputable def matchingPoint {n : ℕ} (M : PerfectMatching n) : Edge n → ℝ := by + classical + exact fun e => if e ∈ M.1 then 1 else 0 + +noncomputable def matchingPolytope (n : ℕ) : Set (Edge n → ℝ) := + convexHull ℝ (Set.range (matchingPoint (n := n))) + +def HasAffineLift (n r : ℕ) : Prop := + ∃ (L : AffineSubspace ℝ (Matrix (Fin r) (Fin r) ℝ)) + (T : Matrix (Fin r) (Fin r) ℝ →ᵃ[ℝ] (Edge n → ℝ)), + T '' {X | X ∈ L ∧ X.PosSemidef} = matchingPolytope n + +theorem affine_lift_lower_bound : + ∀ C : ℝ, 0 < C → ∃ n₀ : ℕ, 4 ≤ n₀ ∧ + ∀ n : ℕ, n₀ ≤ n → Even n → ∀ r : ℕ, + HasAffineLift n r → (n : ℝ) ^ C < (r : ℝ) := by + sorry + +end PerfectMatchingPSD + +end OAI diff --git a/lean/ComparatorChallenges/MatchingEntropy.json b/lean/ComparatorChallenges/MatchingEntropy.json new file mode 100644 index 0000000000000000000000000000000000000000..1d0587a822eb8044dccaf0e28c9c5b7417c4da99 --- /dev/null +++ b/lean/ComparatorChallenges/MatchingEntropy.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.MatchingEntropy", + "solution_module": "OAI.Combinatorics.PerfectMatching.Main", + "theorem_names": [ + "OAI.MatchingEntropy.entropy_main" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/MatchingEntropy.lean b/lean/ComparatorChallenges/MatchingEntropy.lean new file mode 100644 index 0000000000000000000000000000000000000000..5a182adf8a965dfe19480688fd98783720db86e6 --- /dev/null +++ b/lean/ComparatorChallenges/MatchingEntropy.lean @@ -0,0 +1,69 @@ +import Mathlib + +namespace OAI + +noncomputable section + +open scoped BigOperators + +namespace MatchingEntropy + +/-- Nonnegative real weights with total mass one. -/ +def probabilitySimplex (Index : Type*) [Fintype Index] : Set (Index → ℝ) := + {weights | (∀ index, 0 ≤ weights index) ∧ ∑ index, weights index = 1} + +structure LooplessGraph (V E : Type*) where + left : E → V + right : E → V + loopless : ∀ e, left e ≠ right e + +variable {V E : Type*} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + +namespace LooplessGraph + +def Incident (G : LooplessGraph V E) (v : V) (e : E) : Prop := + G.left e = v ∨ G.right e = v + +def IsPerfectMatching (G : LooplessGraph V E) (M : Finset E) : Prop := + ∀ v, ∃! e, e ∈ M ∧ G.Incident v e + +abbrev Matching (G : LooplessGraph V E) := {M : Finset E // G.IsPerfectMatching M} + +instance matchingFintype (G : LooplessGraph V E) : Fintype G.Matching := + Fintype.ofFinite _ + +def indicator (G : LooplessGraph V E) (M : G.Matching) (e : E) : ℝ := + if e ∈ M.val then 1 else 0 + +def polytope (G : LooplessGraph V E) : Set (E → ℝ) := + convexHull ℝ (Set.range G.indicator) + +def mean (G : LooplessGraph V E) (p : G.Matching → ℝ) (e : E) : ℝ := + ∑ M, p M * G.indicator M e + +def feasibleLaws (G : LooplessGraph V E) (y : E → ℝ) : Set (G.Matching → ℝ) := + {p | p ∈ probabilitySimplex G.Matching ∧ G.mean p = y} + +end LooplessGraph + +def entropy {ι : Type*} [Fintype ι] (p : ι → ℝ) : ℝ := + ∑ i, Real.negMulLog (p i) + +def marginalEntropy (y : E → ℝ) : ℝ := entropy y + +def maxMatchingEntropy (G : LooplessGraph V E) (y : E → ℝ) : ℝ := + sSup (entropy '' G.feasibleLaws y) + +/-- Main entropy comparison, for every marginal in the actual matching polytope. -/ +theorem entropy_main (G : LooplessGraph V E) (m : ℕ) + (hm : 0 < m) (hV : Fintype.card V = 2 * m) + (hPM : Nonempty G.Matching) (y : E → ℝ) (hy : y ∈ G.polytope) : + marginalEntropy y - maxMatchingEntropy G y ≤ + 8 * (m : ℝ) * (1 - Real.exp (-marginalEntropy y / (m : ℝ))) := by + sorry + +end MatchingEntropy + +end + +end OAI diff --git a/lean/ComparatorChallenges/MatchingEntropyBounds.json b/lean/ComparatorChallenges/MatchingEntropyBounds.json new file mode 100644 index 0000000000000000000000000000000000000000..8fd1cd5705944e3b6c3b10191840da295d1b29d1 --- /dev/null +++ b/lean/ComparatorChallenges/MatchingEntropyBounds.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.MatchingEntropyBounds", + "solution_module": "OAI.Combinatorics.MatchingEntropy.Main", + "theorem_names": [ + "OAI.MatchingEntropyBounds.Refined.pointwise_entropy" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/MatchingEntropyBounds.lean b/lean/ComparatorChallenges/MatchingEntropyBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..872b7b216a1290086b3cf2adb965cdb3b6210b30 --- /dev/null +++ b/lean/ComparatorChallenges/MatchingEntropyBounds.lean @@ -0,0 +1,84 @@ +import Mathlib + +namespace OAI + +noncomputable section + +open scoped BigOperators Topology +open Filter + +universe uV uE uIndex uι + +namespace MatchingEntropyBounds + +structure LooplessGraph (V : Type uV) (E : Type uE) where + left : E → V + right : E → V + loopless : ∀ e, left e ≠ right e + +variable {V : Type uV} {E : Type uE} + [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + +namespace LooplessGraph + +def Incident (G : LooplessGraph V E) (v : V) (e : E) : Prop := + G.left e = v ∨ G.right e = v + +instance incidentDecidable (G : LooplessGraph V E) (v : V) (e : E) : + Decidable (G.Incident v e) := inferInstanceAs (Decidable (G.left e = v ∨ G.right e = v)) + +def IsPerfectMatching (G : LooplessGraph V E) (M : Finset E) : Prop := + ∀ v, ∃! e, e ∈ M ∧ G.Incident v e + +abbrev Matching (G : LooplessGraph V E) := {M : Finset E // G.IsPerfectMatching M} + +instance matchingFintype (G : LooplessGraph V E) : Fintype G.Matching := + Fintype.ofFinite _ + +def indicator (G : LooplessGraph V E) (M : G.Matching) (e : E) : ℝ := + if e ∈ M.val then 1 else 0 + +def polytope (G : LooplessGraph V E) : Set (E → ℝ) := + convexHull ℝ (Set.range G.indicator) + +def mean (G : LooplessGraph V E) (p : G.Matching → ℝ) (e : E) : ℝ := + ∑ M, p M * G.indicator M e + +end LooplessGraph + +def probabilitySimplex (Index : Type uIndex) [Fintype Index] : Set (Index → ℝ) := + {weights | (∀ index, 0 ≤ weights index) ∧ ∑ index, weights index = 1} + +def LooplessGraph.feasibleLaws (G : LooplessGraph V E) (y : E → ℝ) : Set (G.Matching → ℝ) := + {p | p ∈ probabilitySimplex G.Matching ∧ G.mean p = y} + +def entropy {ι : Type uι} [Fintype ι] (p : ι → ℝ) : ℝ := + ∑ i, Real.negMulLog (p i) + +def maxMatchingEntropy (G : LooplessGraph V E) (y : E → ℝ) : ℝ := + sSup (entropy '' G.feasibleLaws y) + +namespace Refined + +def complementEntropy (x : E → ℝ) : ℝ := entropy (fun e => 1 - x e) + +end Refined + +open Module Matrix + +variable {V : Type uV} {E : Type uE} [Fintype V] [Fintype E] [DecidableEq V] [DecidableEq E] + +open LooplessGraph + +theorem Refined.pointwise_entropy (G : LooplessGraph V E) (m : ℕ) + (hm : 0 < m) (hV : Fintype.card V = 2 * m) (hPM : Nonempty G.Matching) + (x : E → ℝ) (hx : x ∈ G.polytope) : + entropy x - (2 - 2 / (m : ℝ)) * complementEntropy x ≤ maxMatchingEntropy G x ∧ + maxMatchingEntropy G x ≤ entropy x := by + sorry + +end MatchingEntropyBounds + +end + +end OAI diff --git a/lean/ComparatorChallenges/MatchingFPRAS.json b/lean/ComparatorChallenges/MatchingFPRAS.json new file mode 100644 index 0000000000000000000000000000000000000000..dc11f2402194fa03b0f4ba9637c45b8a2cd927c1 --- /dev/null +++ b/lean/ComparatorChallenges/MatchingFPRAS.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.MatchingFPRAS", + "solution_module": "OAI.Combinatorics.MatchingCount.Main", + "theorem_names": [ + "OAI.MatchingFPRAS.thm_main" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/MatchingFPRAS.lean b/lean/ComparatorChallenges/MatchingFPRAS.lean new file mode 100644 index 0000000000000000000000000000000000000000..453b4a578bff8914eac4b180ab9901d570b4fc03 --- /dev/null +++ b/lean/ComparatorChallenges/MatchingFPRAS.lean @@ -0,0 +1,110 @@ +import Mathlib + +namespace OAI + +namespace MatchingFPRAS + +/-- Each unordered edge is represented once, by increasing endpoints. -/ +structure GraphInput where + n : ℕ + edges : Finset (Fin n × Fin n) + increasing : ∀ e ∈ edges, e.1 < e.2 + +/-- Exactly one selected edge is incident to every vertex. -/ +def Perfect (G : GraphInput) (M : Finset (Fin G.n × Fin G.n)) : Prop := + M ⊆ G.edges ∧ ∀ v : Fin G.n, ∃! e, e ∈ M ∧ (e.1 = v ∨ e.2 = v) + +noncomputable def perfectMatchings (G : GraphInput) : Finset (Finset (Fin G.n × Fin G.n)) := + by + classical + exact G.edges.powerset.filter (Perfect G) + +/-- The exact unweighted count, including the empty graph. -/ +noncomputable def Z (G : GraphInput) : ℕ := (perfectMatchings G).card + +abbrev Symbol := Fin 8 + +/-- Binary numeral followed by a delimiter. Tape blank is 0; bits use 1 and 2. -/ +def encodeNat (n : ℕ) : List Symbol := + (Nat.bits n).map (fun b => if b then 2 else 1) ++ [3] + +def encodeInt (z : ℤ) : List Symbol := + (if z < 0 then [5] else [4]) ++ encodeNat z.natAbs + +/-- A rational encoded by its reduced numerator and positive denominator. -/ +def encodeRat (q : ℚ) : List Symbol := encodeInt q.num ++ encodeNat q.den + +/-- Explicit sparse graph encoding, then the two rational parameters. -/ +def encodeInput (G : GraphInput) (ε δ : ℚ) : List Symbol := + encodeNat G.n ++ encodeNat G.edges.card ++ + (((G.edges.map toLex.toEmbedding).sort (· ≤ ·)).flatMap fun e => + encodeNat (ofLex e).1.val ++ encodeNat (ofLex e).2.val) ++ + encodeRat ε ++ encodeRat δ + +/-- A uniform randomized Post-Turing machine: a single finite transition table. -/ +structure RandomMachine where + states : ℕ + transition : Fin (states + 1) → Symbol → Bool → + Option (Fin (states + 1) × Turing.TM0.Stmt Symbol) + +structure Configuration (A : RandomMachine) where + state : Option (Fin (A.states + 1)) + tape : Turing.Tape Symbol + +/-- A halted configuration is absorbing. Each nonhalting tick is exactly one +write or one move, or the detection of halt. -/ +def tick (A : RandomMachine) (c : Configuration A) (bit : Bool) : Configuration A := + match c.state with + | none => c + | some s => match A.transition s c.tape.head bit with + | none => ⟨none, c.tape⟩ + | some (s', action) => + ⟨some s', match action with + | .move d => c.tape.move d + | .write a => c.tape.write a⟩ + +def initial (A : RandomMachine) (input : List Symbol) : Configuration A := + ⟨some 0, Turing.Tape.mk₁ input⟩ + +/-- Bounded execution on a finite prefix of the random tape. -/ +def run (A : RandomMachine) (input : List Symbol) {t : ℕ} + (bits : Fin t → Bool) : Configuration A := + (List.ofFn bits).foldl (tick A) (initial A input) + +def Outputs (A : RandomMachine) (input : List Symbol) {t : ℕ} + (bits : Fin t → Bool) (q : ℚ) : Prop := + (run A input bits).state = none ∧ + (run A input bits).tape.right₀ = Turing.ListBlank.mk (encodeRat q) + +/-- A fixed-degree polynomial in input bits, ε⁻¹, and log δ⁻¹. +Natural ceilings and binary ceiling-log change this bound only by constants. -/ +def timeBound (C d : ℕ) (G : GraphInput) (ε δ : ℚ) : ℕ := + C * ((encodeInput G ε δ).length + ⌈ε⁻¹⌉₊ + Nat.clog 2 ⌈δ⁻¹⌉₊ + 1) ^ d + +noncomputable def goodTapes (A : RandomMachine) (G : GraphInput) (ε δ : ℚ) + (t : ℕ) : Finset (Fin t → Bool) := by + classical + exact Finset.univ.filter fun bits => ∃ q : ℚ, + Outputs A (encodeInput G ε δ) bits q ∧ + (1 - ε) * (Z G : ℚ) ≤ q ∧ q ≤ (1 + ε) * (Z G : ℚ) + +/-- A uniform approximation scheme using independent fair bits. All tapes halt +within the fixed polynomial bound and return a nonnegative rational. +A zero count always produces encoded zero. -/ +def MainStatement : Prop := + ∃ (A : RandomMachine) (C d : ℕ), 0 < C ∧ + ∀ (G : GraphInput) (ε δ : ℚ), 0 < ε → ε < 1 → 0 < δ → δ < 1 / 2 → + let t := timeBound C d G ε δ + (∀ bits : Fin t → Bool, ∃ q : ℚ, 0 ≤ q ∧ Outputs A (encodeInput G ε δ) bits q) ∧ + (Z G = 0 → ∀ bits : Fin t → Bool, Outputs A (encodeInput G ε δ) bits 0) ∧ + ((goodTapes A G ε δ t).card : ℚ) / (2 : ℚ) ^ t ≥ 1 - δ + + +/-- A fully polynomial randomized approximation scheme for perfect matchings +in every finite simple undirected graph. -/ +theorem thm_main : MainStatement := by + sorry + +end MatchingFPRAS + +end OAI diff --git a/lean/ComparatorChallenges/MatchingPSD.json b/lean/ComparatorChallenges/MatchingPSD.json new file mode 100644 index 0000000000000000000000000000000000000000..aa54a75ea5d7ddec813e1d8d941142015605ca41 --- /dev/null +++ b/lean/ComparatorChallenges/MatchingPSD.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.MatchingPSD", + "solution_module": "OAI.Combinatorics.MatchingPSD.Main", + "theorem_names": [ + "OAI.PerfectMatchingPSD.main" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/MatchingPSD.lean b/lean/ComparatorChallenges/MatchingPSD.lean new file mode 100644 index 0000000000000000000000000000000000000000..ee2c4baa6d65e22c04da68186f6afb2e59953baa --- /dev/null +++ b/lean/ComparatorChallenges/MatchingPSD.lean @@ -0,0 +1,55 @@ +import Mathlib + +namespace OAI + +namespace PerfectMatchingPSD + +abbrev Edge (n : ℕ) := {p : Fin n × Fin n // p.1 < p.2} + +def IsPerfectMatching {n : ℕ} (M : Finset (Edge n)) : Prop := + ∀ v : Fin n, (M.filter fun e => e.1.1 = v ∨ e.1.2 = v).card = 1 + +abbrev PerfectMatching (n : ℕ) := + {M : Finset (Edge n) // IsPerfectMatching M} + +abbrev OddCut (n : ℕ) := {U : Finset (Fin n) // Odd U.card} + +abbrev Row (n : ℕ) := Edge n ⊕ OddCut n + +def Crosses {n : ℕ} (U : Finset (Fin n)) (e : Edge n) : Prop := + (e.1.1 ∈ U ∧ e.1.2 ∉ U) ∨ (e.1.1 ∉ U ∧ e.1.2 ∈ U) + +noncomputable def crossingCount {n : ℕ} (U : Finset (Fin n)) + (M : PerfectMatching n) : ℕ := by + classical + exact (M.1.filter (Crosses U)).card + +noncomputable def slack {n : ℕ} (i : Row n) (M : PerfectMatching n) : ℝ := by + classical + exact match i with + | Sum.inl e => if e ∈ M.1 then 1 else 0 + | Sum.inr U => (crossingCount U.1 M : ℝ) - 1 + +/-- Real PSD factors of order `r`, without equivariance or rank-one restrictions. -/ +def HasFactorization (n r : ℕ) : Prop := + ∃ (A : Row n → Matrix (Fin r) (Fin r) ℝ) + (B : PerfectMatching n → Matrix (Fin r) (Fin r) ℝ), + (∀ i, (A i).PosSemidef) ∧ (∀ M, (B M).PosSemidef) ∧ + ∀ i M, slack i M = Matrix.trace (A i * B M) + +/-- The least positive order of a real PSD factorization. -/ +noncomputable def psdRank (n : ℕ) : ℕ := + sInf {r : ℕ | 0 < r ∧ HasFactorization n r} + +/-- Every positive real power is eventually smaller than the PSD rank, +uniformly over all even vertex counts. The exponentiation is real `rpow`. -/ +def MainClaim : Prop := + ∀ C : ℝ, 0 < C → ∃ n₀ : ℕ, 4 ≤ n₀ ∧ + ∀ n : ℕ, n₀ ≤ n → Even n → (n : ℝ) ^ C < (psdRank n : ℝ) + +theorem main : MainClaim := by + sorry + +end PerfectMatchingPSD + +end OAI diff --git a/lean/ComparatorChallenges/MatrixFields.json b/lean/ComparatorChallenges/MatrixFields.json new file mode 100644 index 0000000000000000000000000000000000000000..ea0bc98d111a6298b8a786a17b024d9597eb1a2a --- /dev/null +++ b/lean/ComparatorChallenges/MatrixFields.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.MatrixFields", + "solution_module": "OAI.LinearAlgebra.MatrixFields.Main", + "theorem_names": [ + "OAI.MatrixAllFields.MatrixMultiplication.AllFieldMain.omega_lt_source_constant" + ], + "definition_names": [], + "enable_nanoda": false, + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ] +} diff --git a/lean/ComparatorChallenges/MatrixFields.lean b/lean/ComparatorChallenges/MatrixFields.lean new file mode 100644 index 0000000000000000000000000000000000000000..e11c17d138ef17d88bda99570ca2cc2d5825d551 --- /dev/null +++ b/lean/ComparatorChallenges/MatrixFields.lean @@ -0,0 +1,116 @@ +import Mathlib + +namespace OAI + +open scoped BigOperators Topology Polynomial + +namespace MatrixAllFields + +noncomputable section + +open scoped BigOperators + +namespace MatrixMultiplication.Arithmetic + +inductive Gate (F Input Register : Type*) where + | constant : F → Gate F Input Register + | input : Input → Gate F Input Register + | add : Register → Register → Gate F Input Register + | sub : Register → Register → Gate F Input Register + | mul : Register → Register → Gate F Input Register + +namespace Gate + +variable {F Input Register : Type*} + +def eval [Field F] (inputs : Input → F) (registers : Register → F) : + Gate F Input Register → F + | .constant z => z + | .input i => inputs i + | .add i j => registers i + registers j + | .sub i j => registers i - registers j + | .mul i j => registers i * registers j + +def cost : Gate F Input Register → ℕ + | .constant _ => 0 + | .input _ => 0 + | .add _ _ => 1 + | .sub _ _ => 1 + | .mul _ _ => 1 + +end Gate + +inductive Program (F Input : Type*) : ℕ → Type _ where + | nil : Program F Input 0 + | step {r : ℕ} : Program F Input r → Gate F Input (Fin r) → Program F Input (r + 1) + +namespace Program + +variable {F Input : Type*} + +def eval [Field F] : {r : ℕ} → Program F Input r → (Input → F) → Fin r → F + | 0, .nil, _ => Fin.elim0 + | _ + 1, .step p g, inputs => + Fin.cases (g.eval inputs (p.eval inputs)) (p.eval inputs) + +def cost : {r : ℕ} → Program F Input r → ℕ + | 0, .nil => 0 + | _ + 1, .step p g => p.cost + g.cost + +end Program + +abbrev MatrixInput (a b c : ℕ) := (Fin a × Fin b) ⊕ (Fin b × Fin c) + +def matrixInputs {F : Type*} {a b c : ℕ} + (A : Matrix (Fin a) (Fin b) F) (B : Matrix (Fin b) (Fin c) F) : + MatrixInput a b c → F + | .inl (i, j) => A i j + | .inr (j, k) => B j k + +structure MatrixAlgorithm (F : Type*) (a b c : ℕ) where + registers : ℕ + program : Program F (MatrixInput a b c) registers + output : Fin a → Fin c → Fin registers + +namespace MatrixAlgorithm + +variable {F : Type*} [Field F] {a b c : ℕ} + +def eval (P : MatrixAlgorithm F a b c) + (A : Matrix (Fin a) (Fin b) F) (B : Matrix (Fin b) (Fin c) F) : + Matrix (Fin a) (Fin c) F := + fun i k => P.program.eval (matrixInputs A B) (P.output i k) + +def Correct (P : MatrixAlgorithm F a b c) : Prop := + ∀ (A : Matrix (Fin a) (Fin b) F) (B : Matrix (Fin b) (Fin c) F), P.eval A B = A * B + +def cost (P : MatrixAlgorithm F a b c) : ℕ := P.program.cost + +end MatrixAlgorithm + +/-- Positive slack, one uniform constant, and a correct program at every size. -/ +def AdmissibleExponent (F : Type*) [Field F] (τ : ℝ) : Prop := + ∀ ε : ℝ, 0 < ε → ∃ C : ℝ, 0 < C ∧ + ∀ n : ℕ, 1 ≤ n → ∃ P : MatrixAlgorithm F n n n, + P.Correct ∧ (P.cost : ℝ) ≤ C * (n : ℝ) ^ (τ + ε) + +def omega (F : Type*) [Field F] : ℝ := sInf {τ : ℝ | AdmissibleExponent F τ} + +end MatrixMultiplication.Arithmetic + +end + +end MatrixAllFields + +namespace MatrixAllFields.MatrixMultiplication.AllFieldMain + +universe u + +theorem omega_lt_source_constant (F : Type u) [Field F] : + Arithmetic.omega F < (2371054886006746 : ℝ) / 10 ^ 15 ∧ + (2371054886006746 : ℝ) / 10 ^ 15 < (2371056 : ℝ) / 10 ^ 6 := by + sorry + +end MatrixAllFields.MatrixMultiplication.AllFieldMain + +end OAI diff --git a/lean/ComparatorChallenges/MatrixMultiplication.json b/lean/ComparatorChallenges/MatrixMultiplication.json new file mode 100644 index 0000000000000000000000000000000000000000..05b80f27b970063376d5b76b83cdc9558f3aeef9 --- /dev/null +++ b/lean/ComparatorChallenges/MatrixMultiplication.json @@ -0,0 +1,16 @@ +{ + "challenge_module": "ComparatorChallenges.MatrixMultiplication", + "solution_module": "OAI.LinearAlgebra.MatrixMultiplication.Main", + "theorem_names": [ + "OAI.MatrixMultiplication.complex_omega_le_nine_quarters", + "OAI.MatrixMultiplication.complex_alpha_gt_93_div_200", + "OAI.MatrixMultiplication.complex_rectangular_omega_lt_523_div_250" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/MatrixMultiplication.lean b/lean/ComparatorChallenges/MatrixMultiplication.lean new file mode 100644 index 0000000000000000000000000000000000000000..877d7ee3901c51382cf5bcb059a50d8dbb3cde77 --- /dev/null +++ b/lean/ComparatorChallenges/MatrixMultiplication.lean @@ -0,0 +1,132 @@ +import Mathlib + +namespace OAI + +/-! The three main complex matrix multiplication bounds, checked independently. -/ + +noncomputable section + +open scoped BigOperators + +namespace MatrixMultiplication.Arithmetic + +inductive Gate (F Input Register : Type*) where + | constant : F → Gate F Input Register + | input : Input → Gate F Input Register + | add : Register → Register → Gate F Input Register + | sub : Register → Register → Gate F Input Register + | mul : Register → Register → Gate F Input Register + +namespace Gate + +variable {F Input Register : Type*} + +def eval [Field F] (inputs : Input → F) (registers : Register → F) : + Gate F Input Register → F + | .constant z => z + | .input i => inputs i + | .add i j => registers i + registers j + | .sub i j => registers i - registers j + | .mul i j => registers i * registers j + +def cost : Gate F Input Register → ℕ + | .constant _ => 0 + | .input _ => 0 + | .add _ _ => 1 + | .sub _ _ => 1 + | .mul _ _ => 1 + +end Gate + +inductive Program (F Input : Type*) : ℕ → Type _ where + | nil : Program F Input 0 + | step {r : ℕ} : Program F Input r → Gate F Input (Fin r) → Program F Input (r + 1) + +namespace Program + +variable {F Input : Type*} + +def eval [Field F] : {r : ℕ} → Program F Input r → (Input → F) → Fin r → F + | 0, .nil, _ => Fin.elim0 + | _ + 1, .step p g, inputs => + Fin.cases (g.eval inputs (p.eval inputs)) (p.eval inputs) + +def cost : {r : ℕ} → Program F Input r → ℕ + | 0, .nil => 0 + | _ + 1, .step p g => p.cost + g.cost + +end Program + +abbrev MatrixInput (a b c : ℕ) := (Fin a × Fin b) ⊕ (Fin b × Fin c) + +def matrixInputs {F : Type*} {a b c : ℕ} + (A : Matrix (Fin a) (Fin b) F) (B : Matrix (Fin b) (Fin c) F) : + MatrixInput a b c → F + | .inl (i, j) => A i j + | .inr (j, k) => B j k + +structure MatrixAlgorithm (F : Type*) (a b c : ℕ) where + registers : ℕ + program : Program F (MatrixInput a b c) registers + output : Fin a → Fin c → Fin registers + +namespace MatrixAlgorithm + +variable {F : Type*} [Field F] {a b c : ℕ} + +def eval (P : MatrixAlgorithm F a b c) + (A : Matrix (Fin a) (Fin b) F) (B : Matrix (Fin b) (Fin c) F) : + Matrix (Fin a) (Fin c) F := + fun i k => P.program.eval (matrixInputs A B) (P.output i k) + +def Correct (P : MatrixAlgorithm F a b c) : Prop := + ∀ (A : Matrix (Fin a) (Fin b) F) (B : Matrix (Fin b) (Fin c) F), P.eval A B = A * B + +def cost (P : MatrixAlgorithm F a b c) : ℕ := P.program.cost + +end MatrixAlgorithm + +/-- Positive slack, one uniform constant, and a correct program at every size. -/ +def AdmissibleExponent (F : Type*) [Field F] (τ : ℝ) : Prop := + ∀ ε : ℝ, 0 < ε → ∃ C : ℝ, 0 < C ∧ + ∀ n : ℕ, 1 ≤ n → ∃ P : MatrixAlgorithm F n n n, + P.Correct ∧ (P.cost : ℝ) ≤ C * (n : ℝ) ^ (τ + ε) + +def omega (F : Type*) [Field F] : ℝ := sInf {τ : ℝ | AdmissibleExponent F τ} + +/-- The inner dimension of an `n × n^k` by `n^k × n` multiplication. -/ +def innerSize (n : ℕ) (k : ℝ) : ℕ := ⌈(n : ℝ) ^ k⌉₊ + +def RectangularAdmissibleExponent (F : Type*) [Field F] (k τ : ℝ) : Prop := + ∀ ε : ℝ, 0 < ε → ∃ C : ℝ, 0 < C ∧ + ∀ n : ℕ, 1 ≤ n → ∃ P : MatrixAlgorithm F n (innerSize n k) n, + P.Correct ∧ (P.cost : ℝ) ≤ C * (n : ℝ) ^ (τ + ε) + +def rectangularOmega (F : Type*) [Field F] (k : ℝ) : ℝ := + sInf {τ : ℝ | RectangularAdmissibleExponent F k τ} + +/-- The dual exponent is a supremum of exact exponent-two rectangular shapes. -/ +def complexAlpha : ℝ := + sSup {k : ℝ | k ∈ Set.Icc 0 1 ∧ rectangularOmega ℂ k = 2} + +end MatrixMultiplication.Arithmetic + +end + +namespace MatrixMultiplication + +theorem complex_omega_le_nine_quarters : + Arithmetic.omega ℂ ≤ (9 : ℝ) / 4 := by + sorry + +theorem complex_alpha_gt_93_div_200 : + (93 : ℝ) / 200 < Arithmetic.complexAlpha := by + sorry + +theorem complex_rectangular_omega_lt_523_div_250 : + Arithmetic.rectangularOmega ℂ ((709 : ℝ) / 1000) < (523 : ℝ) / 250 := by + sorry + +end MatrixMultiplication + +end OAI diff --git a/lean/ComparatorChallenges/MatrixRemoval.json b/lean/ComparatorChallenges/MatrixRemoval.json new file mode 100644 index 0000000000000000000000000000000000000000..cbeed060e341f3dfa440dc63afa2bd5057f11438 --- /dev/null +++ b/lean/ComparatorChallenges/MatrixRemoval.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.MatrixRemoval", + "solution_module": "OAI.Combinatorics.MatrixRemoval.Main", + "theorem_names": [ + "OAI.Problem348.no_polynomial_removal_bound" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/MatrixRemoval.lean b/lean/ComparatorChallenges/MatrixRemoval.lean new file mode 100644 index 0000000000000000000000000000000000000000..74a1ea5e9ffa8f194d1b4dc16b95569db25dcf62 --- /dev/null +++ b/lean/ComparatorChallenges/MatrixRemoval.lean @@ -0,0 +1,77 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace Problem348 + +abbrev BinaryMatrix (n : ℕ) := Fin n → Fin n → Bool + +abbrev IncreasingMap (k n : ℕ) := {f : Fin k → Fin n // StrictMono f} + +def orderedCopies {k n : ℕ} (H : BinaryMatrix k) (A : BinaryMatrix n) : + Finset (IncreasingMap k n × IncreasingMap k n) := by + classical + exact Finset.univ.filter (fun rc => + ∀ i j, A ((rc.1).val i) ((rc.2).val j) = H i j) + +def copyCount {k n : ℕ} (H : BinaryMatrix k) (A : BinaryMatrix n) : ℕ := + (orderedCopies H A).card + +def HFree {k n : ℕ} (H : BinaryMatrix k) (A : BinaryMatrix n) : Prop := + copyCount H A = 0 + +def hammingDistance {n : ℕ} (A B : BinaryMatrix n) : ℕ := by + classical + exact (Finset.univ.filter (fun rc : Fin n × Fin n => + A rc.1 rc.2 ≠ B rc.1 rc.2)).card + +def etaBit (a b : ℕ) : Bool := + decide (((a / (2 ^ (5 - b))) % 2) = 1) + +def anchor64 (u v : Fin 64) : Bool := + if 32 ≤ u.val ∧ 59 ≤ v.val then + etaBit (u.val - 32) (v.val - 58) + else + decide (u.val ≠ v.val) + +def fixedH : BinaryMatrix 66 := fun u v => + if hu : u.val < 64 then + if hv : v.val < 64 then + anchor64 ⟨u.val, hu⟩ ⟨v.val, hv⟩ + else + decide ((v.val = 64 ∧ u.val = 0) ∨ + (v.val = 65 ∧ u.val = 1)) + else + if v.val < 64 then + decide ((u.val = 64 ∧ v.val = 0) ∨ + (u.val = 65 ∧ v.val = 1)) + else + decide (u.val = 65 ∨ v.val = 64) + +def fixedMinEdits {n : ℕ} (A : BinaryMatrix n) : ℕ := by + classical + exact + (Finset.univ.image (fun B : BinaryMatrix n => + if HFree fixedH B then hammingDistance A B else n * n + 1)).min' + (by simp) + +def fixedDistance {n : ℕ} (A : BinaryMatrix n) : ℝ := + (fixedMinEdits A : ℝ) / ((n : ℝ) ^ 2) + +theorem no_polynomial_removal_bound : + ∀ c C : ℝ, 0 < c → 0 < C → + ∃ n : ℕ, 1 ≤ n ∧ + ∃ ε : ℝ, 0 < ε ∧ ε < 1 ∧ + ∃ A : BinaryMatrix n, + fixedDistance A ≥ ε ∧ + (copyCount fixedH A : ℝ) < + c * Real.rpow ε C * ((n : ℝ) ^ 132) := by + sorry + +end Problem348 + +end + +end OAI diff --git a/lean/ComparatorChallenges/MatroidProphet.json b/lean/ComparatorChallenges/MatroidProphet.json new file mode 100644 index 0000000000000000000000000000000000000000..d27382576042c61c2964d5c2e0003e3325394abd --- /dev/null +++ b/lean/ComparatorChallenges/MatroidProphet.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.MatroidProphet", + "solution_module": "OAI.Probability.MatroidProphet.Main", + "theorem_names": [ + "OAI.MatroidProphet.one_sample" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/MatroidProphet.lean b/lean/ComparatorChallenges/MatroidProphet.lean new file mode 100644 index 0000000000000000000000000000000000000000..412ad5b86840403f95d28ee4643fb2556aaa4deb --- /dev/null +++ b/lean/ComparatorChallenges/MatroidProphet.lean @@ -0,0 +1,94 @@ +import Mathlib + +namespace OAI + +/-! +# One-sample matroid selection + +The rule and its finite seed law depend only on the known labeled matroid. +A decision sees the initial sample vector, the entire seed, and the arriving +label/value prefix. Every prefix is feasible, and decisions are irrevocable. +The arrival permutation may depend on all samples, values, and seed bits. +Only the actual offline optimum is required to be integrable. +-/ + +open MeasureTheory ProbabilityTheory +open scoped BigOperators + +namespace MatroidProphet + +abbrev Weights (n : ℕ) := Fin n → ℝ +abbrev Seed (bits : ℕ) := Fin bits → Bool +abbrev ArrivalOrder (n : ℕ) := Equiv.Perm (Fin n) +instance arrivalOrderMeasurableSpace (n : ℕ) : MeasurableSpace (ArrivalOrder n) := ⊤ + +abbrev History (n : ℕ) (k : Fin n) := Fin (k.val + 1) → Fin n × ℝ + +structure OnlineRule (n bits : ℕ) where + decide : (k : Fin n) → Seed bits → Weights n → History n k → Bool + measurable_decide : ∀ k, Measurable + (fun x : Seed bits × (Weights n × History n k) => decide k x.1 x.2.1 x.2.2) + +def prefixIndex {n : ℕ} (k : Fin n) (j : Fin (k.val + 1)) : Fin n := + ⟨j.val, Nat.lt_of_lt_of_le j.isLt (Nat.succ_le_of_lt k.isLt)⟩ + +def history {n : ℕ} (v : Weights n) (π : ArrivalOrder n) (k : Fin n) : History n k := + fun j => let e := π (prefixIndex k j); (e, v e) + +def decisionAt {n bits : ℕ} (A : OnlineRule n bits) (r : Seed bits) + (s v : Weights n) (π : ArrivalOrder n) (k : Fin n) : Bool := + A.decide k r s (history v π k) + +noncomputable def acceptedThrough {n bits : ℕ} (A : OnlineRule n bits) (r : Seed bits) + (s v : Weights n) (π : ArrivalOrder n) (t : ℕ) : Finset (Fin n) := by + classical + exact Finset.univ.filter fun e => + (π.symm e).val < t ∧ decisionAt A r s v π (π.symm e) = true + +noncomputable def accepted {n bits : ℕ} (A : OnlineRule n bits) (r : Seed bits) + (s v : Weights n) (π : ArrivalOrder n) : Finset (Fin n) := + acceptedThrough A r s v π n + +noncomputable def reward {n bits : ℕ} (A : OnlineRule n bits) (r : Seed bits) + (s v : Weights n) (π : ArrivalOrder n) : ℝ := + ∑ e ∈ accepted A r s v π, v e + +noncomputable def optimum {n : ℕ} (M : Matroid (Fin n)) (v : Weights n) : ℝ := by + classical + exact Finset.univ.sup' Finset.univ_nonempty + (fun I : Finset (Fin n) => if M.Indep (I : Set (Fin n)) then ∑ e ∈ I, v e else 0) + +def Feasible {n bits : ℕ} (M : Matroid (Fin n)) (A : OnlineRule n bits) : Prop := + ∀ (r : Seed bits) (s v : Weights n) (π : ArrivalOrder n) (t : ℕ), + (∀ e, 0 ≤ s e) → (∀ e, 0 ≤ v e) → + M.Indep (acceptedThrough A r s v π t : Set (Fin n)) + +def pairedCoordinates.{u} {n : ℕ} {Ω : Type u} (S V : Ω → Weights n) + (i : Fin n × Bool) : Ω → ℝ := + if i.2 then fun ω => S ω i.1 else fun ω => V ω i.1 + +def OneSampleChallenge.{u} : Prop := + ∀ (n : ℕ) (M : Matroid (Fin n)), M.E = Set.univ → + ∃ (bits : ℕ) (ν : Measure (Seed bits)), IsProbabilityMeasure ν ∧ + ∃ (A : OnlineRule n bits), Feasible M A ∧ + ∀ {Ω : Type u} [MeasurableSpace Ω] (μ : Measure Ω) [IsProbabilityMeasure μ] + (S V : Ω → Weights n) (R : Ω → Seed bits), + Measurable S → Measurable V → Measurable R → + (∀ᵐ ω ∂μ, ∀ e, 0 ≤ S ω e) → + (∀ᵐ ω ∂μ, ∀ e, 0 ≤ V ω e) → + iIndepFun (pairedCoordinates S V) μ → + (∀ e, Measure.map (fun ω => S ω e) μ = Measure.map (fun ω => V ω e) μ) → + IndepFun (fun ω => (S ω, V ω)) R μ → + Measure.map R μ = ν → + Integrable (fun ω => optimum M (V ω)) μ → + ∀ (π : Ω → ArrivalOrder n), Measurable π → + Integrable (fun ω => reward A (R ω) (S ω) (V ω) (π ω)) μ ∧ + ((2 : ℝ) ^ 310)⁻¹ * (∫ ω, optimum M (V ω) ∂μ) ≤ + ∫ ω, reward A (R ω) (S ω) (V ω) (π ω) ∂μ + +theorem one_sample.{u} : OneSampleChallenge.{u} := by + sorry + +end MatroidProphet + +end OAI diff --git a/lean/ComparatorChallenges/MatroidSecretary.json b/lean/ComparatorChallenges/MatroidSecretary.json new file mode 100644 index 0000000000000000000000000000000000000000..98368c520f56958fe2807b3f6c47f240910ff71a --- /dev/null +++ b/lean/ComparatorChallenges/MatroidSecretary.json @@ -0,0 +1,16 @@ +{ + "challenge_module": "ComparatorChallenges.MatroidSecretary", + "solution_module": "OAI.Probability.MatroidSecretary.Main", + "theorem_names": [ + "OAI.MatroidProphet.Assigned.one_sample", + "OAI.MatroidProphet.Assigned.hidden_vector", + "OAI.MatroidProphet.Assigned.secretary" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Classical.choice", + "Quot.sound" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/MatroidSecretary.lean b/lean/ComparatorChallenges/MatroidSecretary.lean new file mode 100644 index 0000000000000000000000000000000000000000..eeab143368162042ac9405e437cca64f18b24a89 --- /dev/null +++ b/lean/ComparatorChallenges/MatroidSecretary.lean @@ -0,0 +1,246 @@ +import Mathlib + +namespace OAI + +/-! +# Matroid selection against an almighty adversary + +The three guarantees concern one independent sample per label, a hidden fixed +weight vector, and a uniformly sampled observation prefix. The rule and its +finite seed law are fixed before the input weights or value distributions. +-/ + +open scoped BigOperators + +section + +open MeasureTheory ProbabilityTheory +open scoped BigOperators + +namespace MatroidProphet + +abbrev Weights (n : ℕ) := Fin n → ℝ +abbrev Seed (bits : ℕ) := Fin bits → Bool +abbrev ArrivalOrder (n : ℕ) := Equiv.Perm (Fin n) +instance arrivalOrderMeasurableSpace (n : ℕ) : MeasurableSpace (ArrivalOrder n) := ⊤ + +abbrev History (n : ℕ) (k : Fin n) := Fin (k.val + 1) → Fin n × ℝ + +structure OnlineRule (n bits : ℕ) where + decide : (k : Fin n) → Seed bits → Weights n → History n k → Bool + measurable_decide : ∀ k, Measurable + (fun x : Seed bits × (Weights n × History n k) => decide k x.1 x.2.1 x.2.2) + +def prefixIndex {n : ℕ} (k : Fin n) (j : Fin (k.val + 1)) : Fin n := + ⟨j.val, Nat.lt_of_lt_of_le j.isLt (Nat.succ_le_of_lt k.isLt)⟩ + +def history {n : ℕ} (v : Weights n) (π : ArrivalOrder n) (k : Fin n) : History n k := + fun j => let e := π (prefixIndex k j); (e, v e) + +def decisionAt {n bits : ℕ} (A : OnlineRule n bits) (r : Seed bits) + (s v : Weights n) (π : ArrivalOrder n) (k : Fin n) : Bool := + A.decide k r s (history v π k) + +noncomputable def acceptedThrough {n bits : ℕ} (A : OnlineRule n bits) (r : Seed bits) + (s v : Weights n) (π : ArrivalOrder n) (t : ℕ) : Finset (Fin n) := by + classical + exact Finset.univ.filter fun e => + (π.symm e).val < t ∧ decisionAt A r s v π (π.symm e) = true + +noncomputable def accepted {n bits : ℕ} (A : OnlineRule n bits) (r : Seed bits) + (s v : Weights n) (π : ArrivalOrder n) : Finset (Fin n) := + acceptedThrough A r s v π n + +noncomputable def reward {n bits : ℕ} (A : OnlineRule n bits) (r : Seed bits) + (s v : Weights n) (π : ArrivalOrder n) : ℝ := + ∑ e ∈ accepted A r s v π, v e + +noncomputable def optimum {n : ℕ} (M : Matroid (Fin n)) (v : Weights n) : ℝ := by + classical + exact Finset.univ.sup' Finset.univ_nonempty + (fun I : Finset (Fin n) => if M.Indep (I : Set (Fin n)) then ∑ e ∈ I, v e else 0) + +def Feasible {n bits : ℕ} (M : Matroid (Fin n)) (A : OnlineRule n bits) : Prop := + ∀ (r : Seed bits) (s v : Weights n) (π : ArrivalOrder n) (t : ℕ), + (∀ e, 0 ≤ s e) → (∀ e, 0 ≤ v e) → + M.Indep (acceptedThrough A r s v π t : Set (Fin n)) + +def pairedCoordinates.{u} {n : ℕ} {Ω : Type u} (S V : Ω → Weights n) + (i : Fin n × Bool) : Ω → ℝ := + if i.2 then fun ω => S ω i.1 else fun ω => V ω i.1 + +def OneSampleChallenge.{u} : Prop := + ∀ (n : ℕ) (M : Matroid (Fin n)), M.E = Set.univ → + ∃ (bits : ℕ) (ν : Measure (Seed bits)), IsProbabilityMeasure ν ∧ + ∃ (A : OnlineRule n bits), Feasible M A ∧ + ∀ {Ω : Type u} [MeasurableSpace Ω] (μ : Measure Ω) [IsProbabilityMeasure μ] + (S V : Ω → Weights n) (R : Ω → Seed bits), + Measurable S → Measurable V → Measurable R → + (∀ᵐ ω ∂μ, ∀ e, 0 ≤ S ω e) → + (∀ᵐ ω ∂μ, ∀ e, 0 ≤ V ω e) → + iIndepFun (pairedCoordinates S V) μ → + (∀ e, Measure.map (fun ω => S ω e) μ = Measure.map (fun ω => V ω e) μ) → + IndepFun (fun ω => (S ω, V ω)) R μ → + Measure.map R μ = ν → + Integrable (fun ω => optimum M (V ω)) μ → + ∀ (π : Ω → ArrivalOrder n), Measurable π → + Integrable (fun ω => reward A (R ω) (S ω) (V ω) (π ω)) μ ∧ + ((2 : ℝ) ^ 310)⁻¹ * (∫ ω, optimum M (V ω) ∂μ) ≤ + ∫ ω, reward A (R ω) (S ω) (V ω) (π ω) ∂μ + +end MatroidProphet + +end + +section + +open MeasureTheory +open scoped BigOperators + +namespace MatroidProphet + +instance arrivalOrderMeasurableSingletonClass (n : ℕ) : + MeasurableSingletonClass (ArrivalOrder n) := ⟨fun _ => trivial⟩ + +structure HiddenRule (n bits : ℕ) where + mask : Seed bits → Finset (Fin n) + core : OnlineRule n bits + +noncomputable def observed {n bits : ℕ} (A : HiddenRule n bits) (r : Seed bits) + (w : Weights n) : Weights n := by + classical + exact fun e => if e ∈ A.mask r then w e else 0 + +noncomputable def hiddenAcceptedThrough {n bits : ℕ} (A : HiddenRule n bits) + (r : Seed bits) (w : Weights n) (π : ArrivalOrder n) (t : ℕ) : Finset (Fin n) := + acceptedThrough A.core r (observed A r w) w π t \ A.mask r + +noncomputable def hiddenReward {n bits : ℕ} (A : HiddenRule n bits) + (r : Seed bits) (w : Weights n) (π : ArrivalOrder n) : ℝ := + ∑ e ∈ hiddenAcceptedThrough A r w π n, w e + +noncomputable def hiddenWorstReward {n bits : ℕ} (A : HiddenRule n bits) + (w : Weights n) (r : Seed bits) : ℝ := by + classical + exact Finset.univ.inf' Finset.univ_nonempty (hiddenReward A r w) + +end MatroidProphet + +end + +section + +open MeasureTheory ProbabilityTheory + +namespace MatroidProphet + +def HiddenVectorChallenge : Prop := + ∀ (n : ℕ) (M : Matroid (Fin n)), M.E = Set.univ → + ∃ (bits : ℕ) (ν : Measure (Seed bits)), IsProbabilityMeasure ν ∧ + ∃ (A : HiddenRule n bits), + (∀ (w : Weights n), (∀ e, 0 ≤ w e) → + ∀ (r : Seed bits) (π : ArrivalOrder n) (t : ℕ), + M.Indep (hiddenAcceptedThrough A r w π t : Set (Fin n))) ∧ + ∀ (w : Weights n), (∀ e, 0 ≤ w e) → + ((2 : ℝ) ^ 293)⁻¹ * optimum M w ≤ + ∫ r, hiddenWorstReward A w r ∂ν + +end MatroidProphet + +end + +section + +open MeasureTheory + +namespace MatroidProphet + +structure SecretaryRule (n : ℕ) (Q : Type*) [MeasurableSpace Q] where + prefixLength : Q → Fin (n + 1) + measurable_prefixLength : Measurable prefixLength + decide : (k : Fin n) → Q → History n k → Bool + measurable_decide : ∀ k, Measurable + (fun x : Q × History n k => decide k x.1 x.2) + +def SamePrefix {n : ℕ} (K : ℕ) (σ π : ArrivalOrder n) : Prop := + ∀ k : Fin n, k.val < K → σ k = π k + +def secretaryDecisionAt {n : ℕ} {Q : Type*} [MeasurableSpace Q] + (A : SecretaryRule n Q) (q : Q) (w : Weights n) (π : ArrivalOrder n) + (k : Fin n) : Bool := + if k.val < (A.prefixLength q).val then false else A.decide k q (history w π k) + +noncomputable def secretaryAcceptedThrough {n : ℕ} {Q : Type*} [MeasurableSpace Q] + (A : SecretaryRule n Q) (q : Q) (w : Weights n) (π : ArrivalOrder n) + (t : ℕ) : Finset (Fin n) := by + classical + exact Finset.univ.filter fun e => + (π.symm e).val < t ∧ secretaryDecisionAt A q w π (π.symm e) = true + +noncomputable def secretaryReward {n : ℕ} {Q : Type*} [MeasurableSpace Q] + (A : SecretaryRule n Q) (q : Q) (w : Weights n) (π : ArrivalOrder n) : ℝ := + ∑ e ∈ secretaryAcceptedThrough A q w π n, w e + +def SecretaryFeasible {n : ℕ} {Q : Type*} [MeasurableSpace Q] + (M : Matroid (Fin n)) (A : SecretaryRule n Q) : Prop := + ∀ (q : Q) (w : Weights n), (∀ e, 0 ≤ w e) → + ∀ (π : ArrivalOrder n) (t : ℕ), + M.Indep (secretaryAcceptedThrough A q w π t : Set (Fin n)) + +end MatroidProphet + +end + +section + +namespace MatroidProphet.Secretary + +open MeasureTheory + +noncomputable def uniformArrivalLaw (n : ℕ) : Measure (ArrivalOrder n) := + (PMF.uniformOfFintype (ArrivalOrder n)).toMeasure + +end MatroidProphet.Secretary + +end + +section + +open MeasureTheory ProbabilityTheory + +namespace MatroidProphet + +def SecretaryChallenge.{u} : Prop := + ∀ (n : ℕ) (M : Matroid (Fin n)), M.E = Set.univ → + ∃ (q : ℕ) (ν : Measure (Fin q)), IsProbabilityMeasure ν ∧ + ∃ (A : SecretaryRule n (Fin q)), SecretaryFeasible M A ∧ + ∀ (w : Weights n), (∀ e, 0 ≤ w e) → + ∀ {Ω : Type u} [MeasurableSpace Ω] (μ : Measure Ω) [IsProbabilityMeasure μ] + (Q : Ω → Fin q) (σ π : Ω → ArrivalOrder n), + Measurable Q → Measurable σ → Measurable π → + Measure.map Q μ = ν → + Measure.map σ μ = Secretary.uniformArrivalLaw n → + IndepFun Q σ μ → + (∀ᵐ ω ∂μ, SamePrefix (A.prefixLength (Q ω)).val (σ ω) (π ω)) → + Integrable (fun ω => secretaryReward A (Q ω) w (π ω)) μ ∧ + ((2 : ℝ) ^ 293)⁻¹ * optimum M w ≤ + ∫ ω, secretaryReward A (Q ω) w (π ω) ∂μ + +end MatroidProphet + +end + +namespace MatroidProphet.Assigned + +theorem one_sample.{u} : MatroidProphet.OneSampleChallenge.{u} := by + sorry + +theorem hidden_vector : MatroidProphet.HiddenVectorChallenge := by + sorry + +theorem secretary.{u} : MatroidProphet.SecretaryChallenge.{u} := by + sorry + +end MatroidProphet.Assigned + +end OAI diff --git a/lean/ComparatorChallenges/MaximalSeshadriConstants.json b/lean/ComparatorChallenges/MaximalSeshadriConstants.json new file mode 100644 index 0000000000000000000000000000000000000000..965f87b11e2f2f3400fdfbbdf2799685dbdd7925 --- /dev/null +++ b/lean/ComparatorChallenges/MaximalSeshadriConstants.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.MaximalSeshadriConstants", + "solution_module": "OAI.AlgebraicGeometry.Seshadri.Main", + "theorem_names": [ + "OAI.MaximalSeshadri.Geometry.maximalSeshadriConstants" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/MaximalSeshadriConstants.lean b/lean/ComparatorChallenges/MaximalSeshadriConstants.lean new file mode 100644 index 0000000000000000000000000000000000000000..6e7879e23dd19a40bcdd5b488c3c4a23f3afaa4c --- /dev/null +++ b/lean/ComparatorChallenges/MaximalSeshadriConstants.lean @@ -0,0 +1,414 @@ +import Mathlib + +namespace OAI + + + + + + +namespace MaximalSeshadri.Geometry +noncomputable section +open CategoryTheory AlgebraicGeometry TopologicalSpace +open scoped AlgebraicGeometry + +attribute [local instance] MvPolynomial.gradedAlgebra + + +def complexProjectiveSpace (N : ℕ) : Scheme := + Proj (MvPolynomial.homogeneousSubmodule (Fin (N + 1)) ℂ) + + +def constantsInDegreeZero (N : ℕ) : + ℂ →+* (MvPolynomial.homogeneousSubmodule (Fin (N + 1)) ℂ 0) := + { toFun := fun c => ⟨MvPolynomial.C c, MvPolynomial.isHomogeneous_C _ c⟩ + map_one' := Subtype.ext MvPolynomial.C_1 + map_mul' := fun a b => Subtype.ext (MvPolynomial.C_mul (a := a) (a' := b)) + map_zero' := Subtype.ext MvPolynomial.C_0 + map_add' := fun a b => Subtype.ext (MvPolynomial.C_add (a := a) (a' := b)) } + + +def projectiveSpaceToSpec (N : ℕ) : + complexProjectiveSpace N ⟶ Spec (CommRingCat.of ℂ) := + Proj.toSpecZero _ ≫ Spec.map (CommRingCat.ofHom (constantsInDegreeZero N)) + + + + +structure Surface where + scheme : Scheme + structureMap : scheme ⟶ Spec (CommRingCat.of ℂ) + integral : IsIntegral scheme + smooth : SmoothOfRelativeDimension 2 structureMap + embeddingDimension : ℕ + embedding : scheme ⟶ complexProjectiveSpace embeddingDimension + closedImmersion : IsClosedImmersion embedding + overComplex : embedding ≫ projectiveSpaceToSpec embeddingDimension = structureMap + +attribute [instance] Surface.integral Surface.smooth Surface.closedImmersion + +variable (X : Scheme) + + +structure LineBundle where + sheaf : X.Modules + locallyRankOne : ∀ x : X, ∃ U : X.Opens, x ∈ U ∧ + Nonempty (sheaf.restrict U.ι ≅ SheafOfModules.unit U.toScheme.ringCatSheaf) + + + +def moduleTensor (M N : X.Modules) : X.Modules := + (PresheafOfModules.sheafification (𝟙 X.ringCatSheaf.obj)).obj + (PresheafOfModulesOfCommRing.Monoidal.tensorObj (R := X.presheaf) M.val N.val) + + +def modulePow (M : X.Modules) : ℕ → X.Modules + | 0 => SheafOfModules.unit X.ringCatSheaf + | n + 1 => moduleTensor X M (modulePow M n) + + +def structureSheaf : X.Modules := SheafOfModules.unit X.ringCatSheaf + + +abbrev GlobalSections (M : X.Modules) := structureSheaf X ⟶ M + + + +def sectionOpen {M : X.Modules} (s : GlobalSections X M) : X.Opens := + ⨆ (U : X.Opens) (_ : IsIso ((Scheme.Modules.restrictFunctor U.ι).map s)), U + + +def LineBundle.IsAmple (L : LineBundle X) : Prop := + ∀ (x : X) (V : X.Opens), x ∈ V → ∃ n : ℕ, 0 < n ∧ + ∃ s : GlobalSections X (modulePow X L.sheaf n), + x ∈ sectionOpen X s ∧ sectionOpen X s ≤ V ∧ IsAffineOpen (sectionOpen X s) + +end +end MaximalSeshadri.Geometry + +namespace MaximalSeshadri.Geometry +noncomputable section +open CategoryTheory AlgebraicGeometry TopologicalSpace +open scoped AlgebraicGeometry + +variable (X : Scheme) + + +def restrictScalar (U : X.Opens) : Γ(X, ⊤) →+* Γ(X, U) := + (X.presheaf.map (homOfLE le_top).op).hom + +lemma restrictScalar_naturality {U V : X.Opens} (i : U ⟶ V) (r : Γ(X, ⊤)) : + X.presheaf.map i.op (restrictScalar X V r) = restrictScalar X U r := by + change (X.presheaf.map (homOfLE le_top).op ≫ X.presheaf.map i.op) r = _ + rw [← X.presheaf.map_comp] + rfl + + +def sheafHomSMul {M N : X.Modules} (r : Γ(X, ⊤)) (f : M ⟶ N) : M ⟶ N where + val := { + app U := by + letI : Module Γ(X, U.unop) (M.val.obj U) := (M.val.obj U).isModule + letI : Module Γ(X, U.unop) (N.val.obj U) := (N.val.obj U).isModule + let g : M.val.obj U →ₗ[Γ(X, U.unop)] N.val.obj U := (f.val.app U).hom + exact ModuleCat.ofHom ((restrictScalar X U.unop r) • g) + naturality {U V} g := by + let : Module (X.presheaf.obj V) (N.presheaf.obj V) := (N.val.obj V).isModule + ext m + change restrictScalar X V.unop r • f.app V.unop (M.presheaf.map g m) = + N.presheaf.map g (restrictScalar X U.unop r • f.app U.unop m) + have hn := CategoryTheory.congr_fun (f.mapPresheaf.naturality g) m + change f.app V.unop (M.presheaf.map g m) = + N.presheaf.map g (f.app U.unop m) at hn + rw [hn] + calc + _ = X.presheaf.map g (restrictScalar X U.unop r) • + N.presheaf.map g (f.app U.unop m) := by + exact congrArg (fun a : X.presheaf.obj V => + a • N.presheaf.map g (f.app U.unop m)) + (restrictScalar_naturality X g.unop r).symm + _ = _ := (N.map_smul g.unop (restrictScalar X U.unop r) (f.app U.unop m)).symm } + + +instance sheafHomModule (M N : X.Modules) : Module Γ(X, ⊤) (M ⟶ N) where + smul := sheafHomSMul X + one_smul f := by + ext U m + change restrictScalar X U 1 • f.app U m = f.app U m + simp + mul_smul r s f := by + ext U m + change restrictScalar X U (r * s) • f.app U m = + restrictScalar X U r • (restrictScalar X U s • f.app U m) + simp [mul_smul] + smul_zero r := by + ext U m + change restrictScalar X U r • (0 : Γ(N, U)) = 0 + exact smul_zero _ + smul_add r f g := by + ext U m + change restrictScalar X U r • (f.app U m + g.app U m) = + restrictScalar X U r • f.app U m + restrictScalar X U r • g.app U m + exact smul_add _ _ _ + zero_smul f := by + ext U m + change restrictScalar X U 0 • f.app U m = 0 + simp + add_smul r s f := by + ext U m + change restrictScalar X U (r + s) • f.app U m = + restrictScalar X U r • f.app U m + restrictScalar X U s • f.app U m + simp [add_smul] + +instance sheafLinear : Linear Γ(X, ⊤) X.Modules where + smul_comp M N P r f g := by + ext U m + change g.app U (restrictScalar X U r • f.app U m) = + restrictScalar X U r • g.app U (f.app U m) + exact g.app_smul _ _ + comp_smul M N P f r g := by + ext U m + rfl + +end +end MaximalSeshadri.Geometry + +namespace MaximalSeshadri.Geometry +noncomputable section +open CategoryTheory AlgebraicGeometry TopologicalSpace +open scoped AlgebraicGeometry + +variable {X : Scheme.{0}} + +instance schemeHasExt : HasExt.{1} X.Modules := HasExt.standard X.Modules + + + +def baseScalars (f : X ⟶ Spec (CommRingCat.of ℂ)) : ℂ →+* Γ(X, ⊤) := + f.appTop.hom.comp (Scheme.ΓSpecIso (CommRingCat.of ℂ)).inv.hom + + + + + + + +abbrev cohomology (M : X.Modules) (n : ℕ) : Type 1 := + Abelian.Ext.{1} (C := X.Modules) (structureSheaf X) M n + + + + +def cohomologyDimension (f : X ⟶ Spec (CommRingCat.of ℂ)) + (M : X.Modules) (n : ℕ) : ℕ := + letI : Module ℂ (cohomology M n) := + Module.compHom (cohomology M n) (baseScalars f) + Module.finrank ℂ (cohomology M n) + + + +def eulerCharacteristic (f : X ⟶ Spec (CommRingCat.of ℂ)) (d : ℕ) + (M : X.Modules) : ℤ := + ∑ n ∈ Finset.range (d + 1), (-1 : ℤ) ^ n * (cohomologyDimension f M n : ℤ) + + + +def selfIntersection (S : Surface) (L : LineBundle S.scheme) : ℤ := + eulerCharacteristic S.structureMap 2 (modulePow S.scheme L.sheaf 2) - + 2 * eulerCharacteristic S.structureMap 2 L.sheaf + + eulerCharacteristic S.structureMap 2 (SheafOfModules.unit S.scheme.ringCatSheaf) + + + +structure IntegralCurve (S : Surface) where + scheme : Scheme + embedding : scheme ⟶ S.scheme + closedImmersion : IsClosedImmersion embedding + integral : IsIntegral scheme + dimension : topologicalKrullDim scheme = 1 + +attribute [instance] IntegralCurve.closedImmersion IntegralCurve.integral + + + +def curveDegree (S : Surface) (L : LineBundle S.scheme) (C : IntegralCurve S) : ℤ := + eulerCharacteristic (C.embedding ≫ S.structureMap) 1 + ((Scheme.Modules.pullback C.embedding).obj L.sheaf) - + eulerCharacteristic (C.embedding ≫ S.structureMap) 1 + (SheafOfModules.unit C.scheme.ringCatSheaf) + +end +end MaximalSeshadri.Geometry + +namespace MaximalSeshadri.Geometry +noncomputable section +open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace +open scoped AlgebraicGeometry + + +abbrev complexBase : Scheme := Spec (CommRingCat.of ℂ) + + +abbrev ComplexPoint (S : Surface) := + Over.mk (𝟙 complexBase) ⟶ Over.mk S.structureMap + + +def ComplexPoint.image {S : Surface} (p : ComplexPoint S) : S.scheme := + p.left (⟨⊥, Ideal.isPrime_bot⟩ : PrimeSpectrum ℂ) + + +def surfacePower (S : Surface) (r : ℕ) : Over complexBase := + ∏ᶜ (fun _ : Fin r => Over.mk S.structureMap) + + +def tupleImage (S : Surface) (r : ℕ) (p : Fin r → ComplexPoint S) : + (surfacePower S r).left := + (Limits.Pi.lift p).left (⟨⊥, Ideal.isPrime_bot⟩ : PrimeSpectrum ℂ) + + + +@[instance_reducible] def tupleZariskiTopology (S : Surface) (r : ℕ) : + TopologicalSpace (Fin r → ComplexPoint S) := + TopologicalSpace.induced (tupleImage S r) inferInstance + + +def Configuration (S : Surface) (r : ℕ) := + {p : Fin r → ComplexPoint S // Function.Injective (fun i => (p i).image)} + +instance configurationTopology (S : Surface) (r : ℕ) : + TopologicalSpace (Configuration S r) := + letI := tupleZariskiTopology S r + inferInstanceAs (TopologicalSpace {p : Fin r → ComplexPoint S // + Function.Injective (fun i => (p i).image)}) + + + + + +def idealOrder {R : Type} [CommRing R] [IsLocalRing R] (I : Ideal R) : ℕ := + sInf {n : ℕ | ¬ I ≤ IsLocalRing.maximalIdeal R ^ (n + 1)} + + + + +def curveMultiplicity (S : Surface) (C : IntegralCurve S) (p : ComplexPoint S) : ℕ := by + classical + exact if h : ∃ q : C.scheme, C.embedding q = p.image then + idealOrder (RingHom.ker (C.embedding.stalkMap h.choose).hom) + else 0 + + +def totalMultiplicity (S : Surface) (r : ℕ) (C : IntegralCurve S) + (p : Configuration S r) : ℕ := + ∑ i : Fin r, curveMultiplicity S C (p.val i) + + +def seshadriConstant (S : Surface) (L : LineBundle S.scheme) (r : ℕ) + (p : Configuration S r) : ℝ := + sInf {a : ℝ | ∃ C : IntegralCurve S, 0 < totalMultiplicity S r C p ∧ + a = (curveDegree S L C : ℝ) / (totalMultiplicity S r C p : ℝ)} + + + + + + +end +end MaximalSeshadri.Geometry + +namespace MaximalSeshadri.Geometry +noncomputable section +open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace +open scoped AlgebraicGeometry + + + + +def moduleCurveDegree (S : Surface) (M : S.scheme.Modules) (C : IntegralCurve S) : ℤ := + eulerCharacteristic (C.embedding ≫ S.structureMap) 1 + ((Scheme.Modules.pullback C.embedding).obj M) - + eulerCharacteristic (C.embedding ≫ S.structureMap) 1 + (structureSheaf C.scheme) + + + +def sectionImageIdeal {X : Scheme} (J : LineBundle X) + (ι : J.sheaf ⟶ structureSheaf X) (U : X.Opens) : Ideal Γ(X, U) := by + letI : Module Γ(X, U) (J.sheaf.val.obj (Opposite.op U)) := + (J.sheaf.val.obj (Opposite.op U)).isModule + let φ : J.sheaf.val.obj (Opposite.op U) →ₗ[Γ(X, U)] Γ(X, U) := + (ι.val.app (Opposite.op U)).hom + exact φ.range + + + + +def PresentsPullbackIdeal {X Y : Scheme} (I : X.IdealSheafData) (f : Y ⟶ X) + (J : LineBundle Y) (ι : J.sheaf ⟶ structureSheaf Y) : Prop := + Mono ι ∧ ∀ (U : Y.affineOpens) (V : X.affineOpens) + (e : U.1 ≤ f ⁻¹ᵁ V.1), + sectionImageIdeal J ι U.1 = (I.ideal V).map (f.appLE V.1 U.1 e).hom + + +def InvertiblePullbackIdeal {X Y : Scheme} (I : X.IdealSheafData) (f : Y ⟶ X) : Prop := + ∃ (J : LineBundle Y) (ι : J.sheaf ⟶ structureSheaf Y), PresentsPullbackIdeal I f J ι + + + + +def centreIdeal (S : Surface) (r : ℕ) (p : Configuration S r) : S.scheme.IdealSheafData := + ∏ i : Fin r, (p.val i).left.ker + + + + +def IsBlowup {X B : Scheme} (I : X.IdealSheafData) (π : B ⟶ X) : Prop := + InvertiblePullbackIdeal I π ∧ ∀ (Y : Scheme) (f : Y ⟶ X), + InvertiblePullbackIdeal I f → ∃! h : Y ⟶ B, h ≫ π = f + + + + +structure PointBlowup (S : Surface) (r : ℕ) (p : Configuration S r) where + surface : Surface + projection : surface.scheme ⟶ S.scheme + overComplex : projection ≫ S.structureMap = surface.structureMap + isBlowup : IsBlowup (centreIdeal S r p) projection + exceptionalIdeal : Fin r → LineBundle surface.scheme + exceptionalInclusion : ∀ i, (exceptionalIdeal i).sheaf ⟶ structureSheaf surface.scheme + exceptionalPullback : ∀ i, PresentsPullbackIdeal (p.val i).left.ker projection + (exceptionalIdeal i) (exceptionalInclusion i) + + + + +def PointBlowup.BoundaryNef {S : Surface} {r : ℕ} {p : Configuration S r} + (B : PointBlowup S r p) (L : LineBundle S.scheme) : Prop := + ∀ C : IntegralCurve B.surface, + 0 ≤ (moduleCurveDegree B.surface + ((Scheme.Modules.pullback B.projection).obj L.sheaf) C : ℝ) + + Real.sqrt ((selfIntersection S L : ℝ) / r) * + ∑ i : Fin r, (curveDegree B.surface (B.exceptionalIdeal i) C : ℝ) + + + +def EventualMaximalSeshadri (S : Surface) (L : LineBundle S.scheme) : Prop := + ∃ r₀ : ℕ, 0 < r₀ ∧ ∀ r : ℕ, r₀ ≤ r → + ∃ Z : ℕ → Set (Configuration S r), + (∀ n, IsClosed (Z n) ∧ Z n ≠ Set.univ) ∧ + (∃ p : Configuration S r, ∀ n, p ∉ Z n) ∧ + ∀ p : Configuration S r, (∀ n, p ∉ Z n) → + (∃ B : PointBlowup S r p, B.BoundaryNef L) ∧ + seshadriConstant S L r p = Real.sqrt ((selfIntersection S L : ℝ) / r) + +end +end MaximalSeshadri.Geometry + +namespace MaximalSeshadri.Geometry + +theorem maximalSeshadriConstants (S : Surface) (L : LineBundle S.scheme) + (hL : LineBundle.IsAmple S.scheme L) : EventualMaximalSeshadri S L := by + sorry + +end MaximalSeshadri.Geometry + +end OAI diff --git a/lean/ComparatorChallenges/MemoryPrecision.json b/lean/ComparatorChallenges/MemoryPrecision.json new file mode 100644 index 0000000000000000000000000000000000000000..abbfdeb419e4312f8215ea961a34c689aacba5f4 --- /dev/null +++ b/lean/ComparatorChallenges/MemoryPrecision.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.MemoryPrecision", + "solution_module": "OAI.Probability.MemoryPrecision.Main", + "theorem_names": [ + "OAI.MemoryPrecision.main" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Classical.choice", + "Quot.sound" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/MemoryPrecision.lean b/lean/ComparatorChallenges/MemoryPrecision.lean new file mode 100644 index 0000000000000000000000000000000000000000..9cc787bf862637dcc784ce66cb1efd68f5a85ceb --- /dev/null +++ b/lean/ComparatorChallenges/MemoryPrecision.lean @@ -0,0 +1,812 @@ +import Mathlib + +namespace OAI + +open MeasureTheory ProbabilityTheory Set Filter EuclideanGeometry +open scoped ENNReal NNReal RealInnerProductSpace Topology Pointwise + +noncomputable section +universe u v + +namespace MemoryPrecision.Kernel + +abbrev Vector (d : ℕ) := EuclideanSpace ℝ (Fin d) + +abbrev Sphere (d : ℕ) := Metric.sphere (0 : Vector d) 1 + +abbrev State (M : ℕ) := Fin (2^M) + +abbrev Action (M : ℕ) := Bool × State M + +abbrev Observations (d k : ℕ) := Fin k → (Vector d × ℝ) + +abbrev Rows (d k : ℕ) := Fin k → Vector d + +def UniformSphere (d : ℕ) : Measure (Sphere d) := + let euclideanGroup : NormedAddCommGroup (Vector d) := + PiLp.normedAddCommGroup + (@OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast inferInstance)) + (fun _ : Fin d => ℝ) + let euclideanInner := PiLp.innerProductSpace (𝕜 := ℝ) (fun _ : Fin d => ℝ) + let σ := @Measure.toSphere (Vector d) euclideanGroup + (@InnerProductSpace.toNormedSpace ℝ (Vector d) _ + euclideanGroup.toSeminormedAddCommGroup euclideanInner) inferInstance + (@volume (Vector d) (@measureSpaceOfInnerProductSpace (Vector d) + euclideanGroup euclideanInner inferInstance inferInstance inferInstance)) + (σ Set.univ)⁻¹ • σ + +def RowLaw (d k : ℕ) : @Measure (Rows d k) + (@MeasurableSpace.pi (Fin k) (fun _ => Vector d) + (fun _ => @WithLp.measurableSpace + (@OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast inferInstance)) + (Fin d → ℝ) inferInstance)) := + let euclideanMeasurable := @WithLp.measurableSpace + (@OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast inferInstance)) + (Fin d → ℝ) inferInstance + @Measure.pi (Fin k) (fun _ => Vector d) inferInstance (fun _ => euclideanMeasurable) + (fun _ => @stdGaussian (Vector d) + (PiLp.normedAddCommGroup + (@OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast inferInstance)) + (fun _ : Fin d => ℝ)) + (PiLp.innerProductSpace (𝕜 := ℝ) (fun _ : Fin d => ℝ)) inferInstance euclideanMeasurable) + +def ObservationReference (d : ℕ) : Measure (Vector d × ℝ) := + (stdGaussian (Vector d)).prod volume + +structure Policy (d M T : ℕ) where + initial : Action M → ℝ≥0∞ + initial_sum : ∑ a, initial a = 1 + transition : ℕ → State M → (Vector d × ℝ) → Action M → ℝ≥0∞ + transition_sum : ∀ t j obs, ∑ a, transition t j obs a = 1 + output : ℕ → State M → Measure (Sphere d) + output_probability : ∀ t j, IsProbabilityMeasure (output t j) + +namespace Policy + +def Completed {d M T : ℕ} (K : Policy d M T) : Prop := + ∀ t j a, AEMeasurable (fun obs => K.transition t j obs a) (ObservationReference d) + +def eval {d M T : ℕ} {X : Type*} (K : Policy d M T) + (w : ℕ → State M → X → ℝ≥0∞) (n : ℕ) : + (k : ℕ) → State M → X → Observations d k → ℝ≥0∞ + | 0, j, s, _ => w n j s + | k+1, j, s, obs => ∑ a : Action M, K.transition (n+1) j (obs 0) a * + if a.1 then w (n+1) a.2 s else K.eval w (n+1) k a.2 s (Fin.tail obs) + +def pathValue {d M T : ℕ} {X : Type*} (K : Policy d M T) + (w : ℕ → State M → X → ℝ≥0∞) (s : X) (obs : Observations d T) : ℝ≥0∞ := + ∑ a : Action M, K.initial a * if a.1 then w 0 a.2 s else K.eval w 0 T a.2 s obs + +def records {d T : ℕ} (s : Sphere d) (A : Rows d T) : Observations d T := + fun index => (A index, @inner ℝ (EuclideanSpace ℝ (Fin d)) + (@InnerProductSpace.toInner ℝ (EuclideanSpace ℝ (Fin d)) _ + (PiLp.seminormedAddCommGroup + (@OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast inferInstance)) + (fun _ : Fin d => ℝ)) + (PiLp.innerProductSpace (𝕜 := ℝ) (fun _ : Fin d => ℝ))) s.val (A index)) + +def outputTest {d M T : ℕ} (K : Policy d M T) (f : Sphere d × Sphere d → ℝ≥0∞) + (t : ℕ) (j : State M) (s : Sphere d) : ℝ≥0∞ := + ∫⁻ v, f (s,v) ∂K.output t j + +def angleTest {d : ℕ} (ε : ℝ) + (point : MemoryPrecision.Kernel.Sphere d × MemoryPrecision.Kernel.Sphere d) : ℝ≥0∞ := + @ite ℝ≥0∞ (Real.arccos (@inner ℝ (EuclideanSpace ℝ (Fin d)) + (@InnerProductSpace.toInner ℝ (EuclideanSpace ℝ (Fin d)) _ + (PiLp.seminormedAddCommGroup + (@OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast inferInstance)) + (fun _ : Fin d => ℝ)) + (PiLp.innerProductSpace (𝕜 := ℝ) (fun _ : Fin d => ℝ))) + point.2.val point.1.val) ≤ ε) (Classical.propDecidable _) 1 0 + +def chordTest {d : ℕ} (ε : ℝ) (x : Sphere d × Sphere d) : ℝ≥0∞ := + {x : Sphere d × Sphere d | dist x.2.val x.1.val ≤ ε}.indicator (fun _ => 1) x + +def experiment {d M T : ℕ} {Ω : Type u} (K : Ω → Policy d M T) + (f : Sphere d × Sphere d → ℝ≥0∞) (z : Sphere d × (Ω × Rows d T)) : ℝ≥0∞ := + (K z.2.1).pathValue ((K z.2.1).outputTest f) z.1 (records z.1 z.2.2) + +structure Admissible {d M T : ℕ} {Ω : Type u} [MeasurableSpace Ω] + (K : Ω → Policy d M T) (ρ : Measure Ω) (π : Measure (Sphere d)) : Prop where + completed : ∀ᵐ ω ∂ρ, (K ω).Completed + experiment : ∀ f : Sphere d × Sphere d → ℝ≥0∞, Measurable f → + (∀ x, f x ≤ 1) → AEMeasurable (experiment K f) (π.prod (ρ.prod (RowLaw d T))) + +def Success {d M T : ℕ} {Ω : Type u} [MeasurableSpace Ω] + (K : Ω → Policy d M T) (ρ : Measure Ω) (π : Measure (Sphere d)) (ε : ℝ) : ℝ≥0∞ := + ∫⁻ z, experiment K (angleTest ε) z ∂π.prod (ρ.prod (RowLaw d T)) + +def ChordSuccess {d M T : ℕ} {Ω : Type u} [MeasurableSpace Ω] + (K : Ω → Policy d M T) (ρ : Measure Ω) (π : Measure (Sphere d)) (ε : ℝ) : ℝ≥0∞ := + ∫⁻ z, experiment K (chordTest ε) z ∂π.prod (ρ.prod (RowLaw d T)) + +end Policy +end MemoryPrecision.Kernel + +namespace NoiselessRegression +abbrev Vector (d : ℕ) := EuclideanSpace ℝ (Fin d) +abbrev UnitSphere (d : ℕ) := Metric.sphere (0 : Vector d) 1 +end NoiselessRegression + +namespace MemoryPrecision +open NoiselessRegression + +abbrev Space (d : ℕ) := EuclideanSpace ℝ (Fin d) + +def J (β : ℝ) (m j : ℕ) : ℝ := + let two : ℝ := @OfNat.ofNat ℝ 2 (@instOfNatAtLeastTwo ℝ 2 Real.commRing.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0))) + let three : ℝ := @OfNat.ofNat ℝ 3 (@instOfNatAtLeastTwo ℝ 3 Real.commRing.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 1))) + 1 + three^j * two^β * (m : ℝ) / (β - (j : ℝ) - (m : ℝ)) + +def AmbientBallBound {d : ℕ} (μ : Measure (Space d)) (H β : ℝ) : Prop := + ∀ x : Space d, ∀ r : ℝ, 0 < r → + μ (Metric.closedBall x r) ≤ ENNReal.ofReal (H * r^β) + +def InverseGram {d p : ℕ} (m : ℕ) (v : Space d × (Fin (p-1) → Space d)) : ℝ≥0∞ := + let exponent : ℝ≥0∞ := @OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0))) + letI : AddCommGroup (Space d) := WithLp.instAddCommGroup exponent (Fin d → ℝ) + letI : Inner ℝ (Space d) := @InnerProductSpace.toInner ℝ (Space d) _ + (PiLp.seminormedAddCommGroup exponent (fun _ : Fin d => ℝ)) + (PiLp.innerProductSpace (𝕜 := ℝ) (fun _ : Fin d => ℝ)) + ENNReal.ofReal ((Real.sqrt (Matrix.gram ℝ (fun i => v.2 i - v.1)).det)⁻¹ ^ m) + +def MatrixLabelReference (d m : ℕ) : @Measure ((Fin m → Space d) × (Fin m → ℝ)) + (@MeasurableSpace.prod (Fin m → Space d) (Fin m → ℝ) + (@MeasurableSpace.pi (Fin m) (fun _ => Space d) + (fun _ => WithLp.measurableSpace + (@OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0)))) (Fin d → ℝ))) + inferInstance) := + let exponent : ℝ≥0∞ := @OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0))) + let euclideanMeasurable := WithLp.measurableSpace exponent (Fin d → ℝ) + let rowMeasurable := @MeasurableSpace.pi (Fin m) (fun _ => Space d) + (fun _ => euclideanMeasurable) + let rowLaw := @Measure.pi (Fin m) (fun _ => Space d) inferInstance + (fun _ => euclideanMeasurable) + (fun _ => @stdGaussian (Space d) + (PiLp.normedAddCommGroup exponent (fun _ : Fin d => ℝ)) + (PiLp.innerProductSpace (𝕜 := ℝ) (fun _ : Fin d => ℝ)) + inferInstance euclideanMeasurable) + @Measure.prod _ _ rowMeasurable inferInstance rowLaw volume + +def ProjectionLaw {d : ℕ} + (μ : @Measure (Space d) + (WithLp.measurableSpace + (@OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0)))) (Fin d → ℝ))) + (m : ℕ) : @Measure ((Fin m → Space d) × (Fin m → ℝ)) + (@MeasurableSpace.prod (Fin m → Space d) (Fin m → ℝ) + (@MeasurableSpace.pi (Fin m) (fun _ => Space d) + (fun _ => WithLp.measurableSpace + (@OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0)))) (Fin d → ℝ))) + inferInstance) := + let exponent : ℝ≥0∞ := @OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0))) + let euclideanMeasurable := WithLp.measurableSpace exponent (Fin d → ℝ) + let rowMeasurable := @MeasurableSpace.pi (Fin m) (fun _ => Space d) + (fun _ => euclideanMeasurable) + let rowLaw := @Measure.pi (Fin m) (fun _ => Space d) inferInstance + (fun _ => euclideanMeasurable) + (fun _ => @stdGaussian (Space d) + (PiLp.normedAddCommGroup exponent (fun _ : Fin d => ℝ)) + (PiLp.innerProductSpace (𝕜 := ℝ) (fun _ : Fin d => ℝ)) + inferInstance euclideanMeasurable) + @Measure.map ((Fin m → Space d) × Space d) ((Fin m → Space d) × (Fin m → ℝ)) + (@MeasurableSpace.prod _ _ rowMeasurable euclideanMeasurable) + (@MeasurableSpace.prod _ _ rowMeasurable inferInstance) + (fun pair => (pair.1, fun index => @inner ℝ (Space d) + (@InnerProductSpace.toInner ℝ (Space d) _ + (PiLp.seminormedAddCommGroup exponent (fun _ : Fin d => ℝ)) + (PiLp.innerProductSpace (𝕜 := ℝ) (fun _ : Fin d => ℝ))) + pair.2 (pair.1 index))) + (@Measure.prod _ _ rowMeasurable euclideanMeasurable rowLaw μ) + +def ProjectedEllipsoid {d m : ℕ} (z : Space d) (R : ℝ) : + Set ((Fin m → Space d) × (Fin m → ℝ)) := + let exponent : ℝ≥0∞ := @OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0))) + let euclideanInner := @InnerProductSpace.toInner ℝ (Space d) _ + (PiLp.seminormedAddCommGroup exponent (fun _ : Fin d => ℝ)) + (PiLp.innerProductSpace (𝕜 := ℝ) (fun _ : Fin d => ℝ)) + {pair | ∃ displacement ∈ @Metric.closedBall (Space d) + (PiLp.instPseudoMetricSpace (p := exponent) (β := fun _ : Fin d => ℝ)) + (WithLp.toLp exponent (fun _ => (0 : ℝ))) R, + pair.2 = fun index => @inner ℝ (Space d) euclideanInner z (pair.1 index) + + @inner ℝ (Space d) euclideanInner displacement (pair.1 index)} + +def ProjectionNormScale (m p : ℕ) (H β R : ℝ) : ℝ := + let two : ℝ := @OfNat.ofNat ℝ 2 (@instOfNatAtLeastTwo ℝ 2 Real.commRing.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0))) + (two * Real.pi) ^ (-(m : ℝ) * ((p : ℝ)-1) / (two*(p : ℝ))) * H * + R ^ (β - (m : ℝ)*(1-1/(p : ℝ))) * + (∏ j ∈ Finset.range (p-1), J β m j) ^ (1/(p : ℝ)) + +def UniformSphere (d : ℕ) : @Measure (Space d) + (WithLp.measurableSpace + (@OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0)))) (Fin d → ℝ)) := + let euclideanMeasurable := WithLp.measurableSpace + (@OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0)))) (Fin d → ℝ) + @Measure.map (Kernel.Sphere d) (Space d) + (MeasurableSpace.comap Subtype.val euclideanMeasurable) euclideanMeasurable + Subtype.val (Kernel.UniformSphere d) + +def GaussianRegularization {d : ℕ} + (μ : @Measure (Space d) + (WithLp.measurableSpace + (@OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0)))) (Fin d → ℝ))) + (m : ℕ) (δ : ℝ) + (Ay : (Fin m → Space d) × (Fin m → ℝ)) : ℝ := + let exponent : ℝ≥0∞ := @OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0))) + letI : MeasurableSpace (Space d) := WithLp.measurableSpace exponent (Fin d → ℝ) + ∫ signal, ∏ index, gaussianPDFReal 0 ⟨δ^2, sq_nonneg δ⟩ + (Ay.2 index - @inner ℝ (Space d) + (@InnerProductSpace.toInner ℝ (Space d) _ + (PiLp.seminormedAddCommGroup exponent (fun _ : Fin d => ℝ)) + (PiLp.innerProductSpace (𝕜 := ℝ) (fun _ : Fin d => ℝ))) + signal (Ay.1 index)) ∂μ + +def PointwiseDensity {d : ℕ} (μ : Measure (Space d)) (m : ℕ) + (x : (Fin m → Space d) × (Fin m → ℝ)) : ℝ := by + classical + exact if h : ∃ l : ℝ, Tendsto (fun i : ℕ => GaussianRegularization μ m (1/(i:ℝ)) x) + atTop (𝓝 l) then Classical.choose h else 0 + +lemma space_finiteDimensional (d : ℕ) : FiniteDimensional ℝ (Space d) := by + infer_instance + +def UnitBallVolume (m : ℕ) : ℝ := + let exponent : ℝ≥0∞ := @OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0))) + let euclideanGroup := PiLp.normedAddCommGroup exponent (fun _ : Fin m => ℝ) + letI : MeasurableSpace (Space m) := WithLp.measurableSpace exponent (Fin m → ℝ) + let euclideanVolume := @volume (Space m) (@measureSpaceOfInnerProductSpace (Space m) + euclideanGroup (PiLp.innerProductSpace (𝕜 := ℝ) (fun _ : Fin m => ℝ)) + (space_finiteDimensional m) inferInstance inferInstance) + (euclideanVolume (@Metric.ball (Space m) + (PiLp.instPseudoMetricSpace (p := exponent) (β := fun _ : Fin m => ℝ)) + (WithLp.toLp exponent (fun _ : Fin m => (0 : ℝ))) 1)).toReal + +def CoordinateUnit (m : ℕ) : Space m := + let exponent : ℝ≥0∞ := @OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0))) + WithLp.toLp exponent (fun j : Fin m => if (j:ℕ) = 0 then (1:ℝ) else 0) + +lemma gaussianVariance_nonneg (δ : ℝ) : 0 ≤ δ^2 := sq_nonneg δ + +def GaussianKernel (m : ℕ) (δ : ℝ) (y : Space m) : ℝ := + let exponent : ℝ≥0∞ := @OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0))) + ∏ index, gaussianPDFReal 0 ⟨δ^2, gaussianVariance_nonneg δ⟩ + (@WithLp.ofLp exponent (Fin m → ℝ) y index) + +def RadialMixture (m : ℕ) (δ r : ℝ) : ℝ := + UnitBallVolume m * r^m * (r / δ^2) * GaussianKernel m δ (r • CoordinateUnit m) + +abbrev Sphere (d : ℕ) := Metric.sphere (0 : Space d) 1 + +def SpherePrior (d : ℕ) : Measure (Sphere d) := + MemoryPrecision.Kernel.UniformSphere d + +def SphereBallBound {d : ℕ} (h : Sphere d → ℝ≥0∞) (H α : ℝ) : Prop := + ∀ z : Space d, ∀ r : ℝ, 0 < r → + (∫⁻ s in {s : Sphere d | dist s.val z ≤ r}, h s ∂SpherePrior d) ≤ + ENNReal.ofReal (H * r^α) + +section WeightedImage +variable {X : Type*} [MeasurableSpace X] {d m N : ℕ} + +def WeightedBlock (ι : X → Space d) (h : Fin N → X → ℝ≥0∞) + (g : Fin N → ((Fin m → Space d) × (Fin m → ℝ)) → ℝ≥0∞) (x : X) : ℝ≥0∞ := + let exponent : ℝ≥0∞ := @OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0))) + let euclideanMeasurable := @WithLp.measurableSpace exponent (Fin d → ℝ) inferInstance + let rowMeasurable := @MeasurableSpace.pi (Fin m) (fun _ => Space d) + (fun _ => euclideanMeasurable) + @MeasureTheory.lintegral (Fin m → Space d) rowMeasurable + (@Measure.pi (Fin m) (fun _ => Space d) inferInstance (fun _ => euclideanMeasurable) + (fun _ => @stdGaussian (Space d) + (PiLp.normedAddCommGroup exponent (fun _ : Fin d => ℝ)) + (PiLp.innerProductSpace (𝕜 := ℝ) (fun _ : Fin d => ℝ)) + (space_finiteDimensional d) euclideanMeasurable)) + (fun rows => ∑ state, g state (rows, fun index => @inner ℝ (Space d) + (@InnerProductSpace.toInner ℝ (Space d) _ + (PiLp.seminormedAddCommGroup exponent (fun _ : Fin d => ℝ)) + (PiLp.innerProductSpace (𝕜 := ℝ) (fun _ : Fin d => ℝ))) + (ι x) (rows index)) * h state x) + +end WeightedImage + +def SphereBlock {d m N : ℕ} (h : Fin N → Sphere d → ℝ≥0∞) + (g : Fin N → ((Fin m → Space d) × (Fin m → ℝ)) → ℝ≥0∞) + (s : Sphere d) : ℝ≥0∞ := + WeightedBlock Subtype.val h g s + +abbrev CubeSet (n : ℕ) : Set (EuclideanSpace ℝ (Fin n)) := + fun (point : EuclideanSpace ℝ (Fin n)) => ∀ index : Fin n, + @LE.le ℝ Real.instLE + (@abs ℝ Real.lattice Real.instAddGroup + (@WithLp.ofLp + (@OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0)))) + (Fin n → ℝ) point index)) + (@HDiv.hDiv ℝ ℝ ℝ (@instHDiv ℝ Real.instDivInvMonoid.toDiv) + (@OfNat.ofNat ℝ 1 (@One.toOfNat1 ℝ Real.instOne)) + (@OfNat.ofNat ℝ 2 (@instOfNatAtLeastTwo ℝ 2 Real.commRing.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0))))) + +abbrev Cube (d : ℕ) := CubeSet (d/2) + +def CubeLaw (d : ℕ) : Measure (Cube d) := + (volume : Measure (Space (d/2))).comap Subtype.val + +lemma cube_second_coordinate_lt (d : ℕ) (index : Fin d) + (lower : ¬index.val < d/2) (upper : index.val < 2*(d/2)) : + index.val - d/2 < d/2 := by omega + +def cubeRaw (d : ℕ) (u : Space (d/2)) : Space d := + let exponent : ℝ≥0∞ := @OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0))) + @HSMul.hSMul ℝ (Space d) (Space d) + (@instHSMul ℝ (Space d) (WithLp.instSMul exponent ℝ (Fin d → ℝ))) + (Real.sqrt (d/2:ℕ))⁻¹ (WithLp.toLp exponent (fun index : Fin d => + if lower : index.val < d/2 then + @WithLp.ofLp exponent (Fin (d/2) → ℝ) u ⟨index.val, lower⟩ + else if upper : index.val < 2*(d/2) then + Real.sqrt (1-(@WithLp.ofLp exponent (Fin (d/2) → ℝ) u + ⟨index.val-d/2, cube_second_coordinate_lt d index lower upper⟩)^2) + else 0)) + +def CubeEmbedding (d : ℕ) (u : Cube d) : Space d := cubeRaw d u.val + +def CubeBall (d : ℕ) (z : Space (d/2)) (r : ℝ) : Set (Cube d) := + {u | dist u.val z ≤ Real.sqrt (d/2:ℕ) * r} + +def CubeLocal {d : ℕ} (f : Cube d → ℝ≥0∞) (L : ℝ) : Prop := + let exponent : ℝ≥0∞ := @OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0))) + let cubeMeasurable := @Subtype.instMeasurableSpace (Space (d/2)) (CubeSet (d/2)) + (@WithLp.measurableSpace exponent (Fin (d/2) → ℝ) inferInstance) + ∀ z : Space (d/2), ∀ r : ℝ, 0 < r → + @MeasureTheory.lintegral (Cube d) cubeMeasurable + (@Measure.restrict (Cube d) cubeMeasurable (CubeLaw d) (CubeBall d z r)) f ≤ + ENNReal.ofReal (L * r^( + (@OfNat.ofNat ℝ 3 (@instOfNatAtLeastTwo ℝ 3 Real.commRing.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 1)))) * (d/2:ℕ) / + (@OfNat.ofNat ℝ 4 (@instOfNatAtLeastTwo ℝ 4 Real.commRing.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 2)))) : ℝ)) + +/-- Every coordinate of the paired cube has square at most one quarter. -/ + +lemma cube_coordinate_square_le {d : ℕ} (u : Cube d) (i : Fin (d/2)) : u.val i^2 ≤ 1/4 := by + have hu : -(1/2 : ℝ) ≤ u.val i ∧ u.val i ≤ 1/2 := abs_le.mp (u.property i) + nlinarith [sq_nonneg (u.val i-1/2), sq_nonneg (u.val i+1/2)] + +lemma sum_fin_split {n d : ℕ} (hn : n ≤ d) (f : Fin d → ℝ) : + (∑ i, f i) = (∑ i : Fin n, f ⟨i.val,by omega⟩) + + ∑ i : Fin (d-n), f ⟨n+i.val,by omega⟩ := by + let e : Fin (n+(d-n)) ≃ Fin d := finCongr (Nat.add_sub_of_le hn) + calc + _ = ∑ i : Fin (n+(d-n)), f (e i) := (Equiv.sum_comp e f).symm + _ = _ := by rw [Fin.sum_univ_add]; rfl + +def cubeCoords (d : ℕ) (u : Space (d/2)) : Space d := + let exponent : ℝ≥0∞ := @OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0))) + WithLp.toLp exponent (fun index : Fin d => + if lower : index.val < d/2 then + @WithLp.ofLp exponent (Fin (d/2) → ℝ) u ⟨index.val, lower⟩ + else if upper : index.val < 2*(d/2) then + Real.sqrt (1-(@WithLp.ofLp exponent (Fin (d/2) → ℝ) u + ⟨index.val-d/2, cube_second_coordinate_lt d index lower upper⟩)^2) + else 0) + +lemma cubeCoords_first (d : ℕ) (u : Space (d/2)) (i : Fin (d/2)) : + cubeCoords d u ⟨i.val,by omega⟩ = u i := by + simp [cubeCoords, i.isLt] + +lemma cubeCoords_second (d : ℕ) (u : Space (d/2)) (i : Fin (d/2)) : + cubeCoords d u ⟨d/2+i.val,by omega⟩ = Real.sqrt (1-u i^2) := by + simp [cubeCoords, show ¬d/2+i.val < d/2 by omega, show d/2+i.val < 2*(d/2) by omega] + +lemma cubeCoords_tail (d : ℕ) (u : Space (d/2)) (i : Fin d) (hi : 2*(d/2) ≤ i.val) : + cubeCoords d u i = 0 := by + simp [cubeCoords, show ¬i.val < d/2 by omega, show ¬i.val < 2*(d/2) by omega] + +lemma cubeCoords_sum (d : ℕ) (u : Space (d/2)) (f : ℝ → ℝ) (hf : f 0 = 0) : + (∑ i : Fin d, f (cubeCoords d u i)) = + (∑ i : Fin (d/2), f (u i)) + ∑ i : Fin (d/2), f (Real.sqrt (1-u i^2)) := by + rw [sum_fin_split (show d/2 ≤ d by omega)] + simp_rw [cubeCoords_first] + rw [sum_fin_split (show d/2 ≤ d-d/2 by omega)] + congr 1 + have h1 : (∑ i : Fin (d/2), f (cubeCoords d u ⟨d/2+i.val,by omega⟩)) = + ∑ i : Fin (d/2), f (Real.sqrt (1-u i^2)) := by simp_rw [cubeCoords_second] + rw [h1] + have h0 : (∑ i : Fin (d-d/2-d/2), f (cubeCoords d u ⟨d/2+(d/2+i.val),by omega⟩)) = 0 := by + apply Finset.sum_eq_zero + intro i _ + rw [cubeCoords_tail d u _ (show 2*(d/2) ≤ d/2+(d/2+i.val) by omega), hf] + rw [h0, add_zero] + +lemma cubeEmbedding_norm {d : ℕ} (hd : 2 ≤ d) (u : Cube d) : + @Norm.norm (Space d) (PiLp.instNorm + (p := @OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0)))) (β := fun _ : Fin d => ℝ)) + (CubeEmbedding d u) = (1 : ℝ) := by + have hs : ‖cubeCoords d u.val‖^2 = (d/2:ℕ) := by + rw [EuclideanSpace.real_norm_sq_eq, cubeCoords_sum d u.val (fun x => x^2) (by norm_num)] + have he (i : Fin (d/2)) : Real.sqrt (1-u.val i^2)^2 = 1-u.val i^2 := + Real.sq_sqrt (by have := cube_coordinate_square_le u i; linarith) + simp_rw [he] + rw [← Finset.sum_add_distrib] + simp + have hn : 0 < (d/2:ℕ) := by omega + have hr : 0 < Real.sqrt (d/2:ℕ) := Real.sqrt_pos.2 (by exact_mod_cast hn) + have hnorm : ‖cubeCoords d u.val‖ = Real.sqrt (d/2:ℕ) := by + rw [← Real.sqrt_sq (norm_nonneg _), hs] + change ‖(Real.sqrt (d/2:ℕ))⁻¹ • cubeCoords d u.val‖ = 1 + rw [norm_smul, Real.norm_eq_abs, abs_inv, abs_of_pos hr, hnorm, inv_mul_cancel₀ hr.ne'] + +def CubeSphere {d : ℕ} (hd : 2 ≤ d) (u : Cube d) : UnitSphere d := + ⟨CubeEmbedding d u, by simpa [Metric.mem_sphere, dist_zero_right] using cubeEmbedding_norm hd u⟩ + +def AmbientGramStatement : Prop := + let two : ℝ := @OfNat.ofNat ℝ 2 (@instOfNatAtLeastTwo ℝ 2 Real.commRing.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0))) + let three : ℝ := @OfNat.ofNat ℝ 3 (@instOfNatAtLeastTwo ℝ 3 Real.commRing.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 1))) + let four : ℝ := @OfNat.ofNat ℝ 4 (@instOfNatAtLeastTwo ℝ 4 Real.commRing.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 2))) + let exponent : ℝ≥0∞ := @OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0))) + (∀ (d m p : ℕ), + letI : MeasurableSpace (Space d) := WithLp.measurableSpace exponent (Fin d → ℝ) + letI : PseudoMetricSpace (Space d) := + PiLp.instPseudoMetricSpace (p := exponent) (β := fun _ : Fin d => ℝ) + letI : AddCommGroup (Space d) := WithLp.instAddCommGroup exponent (Fin d → ℝ) + letI : Module ℝ (Space d) := WithLp.instModule (p := exponent) (K := ℝ) (V := Fin d → ℝ) + 1 ≤ d → 1 ≤ m → 2 ≤ p → + ∀ β R H : ℝ, (m : ℝ) + (p : ℝ) - two < β → 0 < R → 0 < H → + ∀ (μ : Measure (Space d)), IsFiniteMeasure μ → + ∀ z : Space d, μ.support ⊆ Metric.closedBall z R → + AmbientBallBound μ H β → + (∀ (j : ℕ), j ≤ p-2 → ∀ L : AffineSubspace ℝ (Space d), + Nonempty L → Module.finrank ℝ L.direction = j → + (∀ t : ℝ, 0 < t → t ≤ R → + μ {s | Metric.infDist s L ≤ t} ≤ + ENNReal.ofReal (three^j * two^β * H * R^j * t^(β-(j:ℝ)))) ∧ + (∫⁻ s, (ENNReal.ofReal (Metric.infDist s L)) ^ (-(m:ℝ)) ∂μ) ≤ + ENNReal.ofReal (J β m j * H * R^(β-(m:ℝ)))) ∧ + (∀ᵐ v : Space d × (Fin (p-1) → Space d) + ∂μ.prod (Measure.pi (fun _ : Fin (p-1) => μ)), + LinearIndependent ℝ (fun i => v.2 i - v.1)) ∧ + (∫⁻ v : Space d × (Fin (p-1) → Space d), InverseGram m v + ∂μ.prod (Measure.pi (fun _ : Fin (p-1) => μ))) ≤ + ENNReal.ofReal (H^p * R^(β*(p:ℝ)-(m:ℝ)*(p-1:ℕ)) * + ∏ j : Fin (p-1), J β m j)) ∧ + (∃ C : ℝ, 1 ≤ C ∧ ∀ (d m p : ℕ), 16 ≤ d → p = d/8 → + 1 ≤ m → m ≤ p → ∀ β : ℝ, ((d:ℝ)-1)/two ≤ β → β ≤ (d:ℝ)/two → + (∀ j : ℕ, j ≤ p-2 → + ((d:ℝ)-1)/two - two*(p:ℝ) + two ≤ β-(j:ℝ)-(m:ℝ) ∧ + (d:ℝ)/four + three/two ≤ ((d:ℝ)-1)/two - two*(p:ℝ) + two ∧ + J β m j ≤ C^d) ∧ + (∀ H R : ℝ, 0 < H → 0 < R → + H^p * R^(β*(p:ℝ)-(m:ℝ)*(p-1:ℕ)) * (∏ j : Fin (p-1), J β m j) ≤ + C^(d*(p-1)) * H^p * R^(β*(p:ℝ)-(m:ℝ)*(p-1:ℕ)))) + +def FiniteDensityStatement : Prop := + let two : ℝ := @OfNat.ofNat ℝ 2 (@instOfNatAtLeastTwo ℝ 2 Real.commRing.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0))) + let exponent : ℝ≥0∞ := @OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0))) + ∀ d m p : ℕ, + letI : MeasurableSpace (Space d) := WithLp.measurableSpace exponent (Fin d → ℝ) + 1 ≤ d → 1 ≤ m → 2 ≤ p → + ∀ β H R : ℝ, (m : ℝ)+(p : ℝ)-two < β → 0 < H → 0 < R → + ∀ z : Space d, ∀ μ : Measure (Space d), IsFiniteMeasure μ → + @Measure.support (Space d) + (PiLp.topologicalSpace (p := exponent) (β := fun _ : Fin d => ℝ)) + (WithLp.measurableSpace exponent (Fin d → ℝ)) μ ⊆ + @Metric.closedBall (Space d) + (PiLp.instPseudoMetricSpace (p := exponent) (β := fun _ : Fin d => ℝ)) z R → + AmbientBallBound μ H β → + ∃ F : ((Fin m → Space d) × (Fin m → ℝ)) → ℝ, + Measurable F ∧ (∀ x, 0 ≤ F x) ∧ + (MatrixLabelReference d m).withDensity (fun x => ENNReal.ofReal (F x)) = + ProjectionLaw μ m ∧ + (∀ᵐ x ∂MatrixLabelReference d m, x ∉ ProjectedEllipsoid z R → F x = 0) ∧ + eLpNorm F (p : ℝ≥0∞) (MatrixLabelReference d m) ≤ + ENNReal.ofReal (ProjectionNormScale m p H β R) + +def MeasurableTestStatement : Prop := + let two : ℝ := @OfNat.ofNat ℝ 2 (@instOfNatAtLeastTwo ℝ 2 Real.commRing.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0))) + let exponent : ℝ≥0∞ := @OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0))) + ∀ d m p : ℕ, + letI : MeasurableSpace (Space d) := WithLp.measurableSpace exponent (Fin d → ℝ) + 1 ≤ d → 1 ≤ m → 2 ≤ p → + ∀ β H R : ℝ, (m : ℝ)+(p : ℝ)-two < β → 0 < H → 0 < R → + ∀ z : Space d, ∀ μ : Measure (Space d), IsFiniteMeasure μ → + @Measure.support (Space d) + (PiLp.topologicalSpace (p := exponent) (β := fun _ : Fin d => ℝ)) + (WithLp.measurableSpace exponent (Fin d → ℝ)) μ ⊆ + @Metric.closedBall (Space d) + (PiLp.instPseudoMetricSpace (p := exponent) (β := fun _ : Fin d => ℝ)) z R → + AmbientBallBound μ H β → + let ν := MatrixLabelReference d m + let η := ProjectionLaw μ m + let B := ENNReal.ofReal (ProjectionNormScale m p H β R) + let α := 1-1/(p:ℝ) + (∀ E, MeasurableSet E → ν E ≠ ∞ → η E ≤ B * (ν E)^α) ∧ + η ≪ ν ∧ + ∃ ηc : Measure (NullMeasurableSpace ((Fin m → Space d) × (Fin m → ℝ)) ν), + (∀ E, NullMeasurableSet E ν → ηc E = η E) ∧ + (∀ E, NullMeasurableSet E ν → ν.completion E ≠ ∞ → + ηc E ≤ B * (ν.completion E)^α) ∧ + (∀ φ : NullMeasurableSpace ((Fin m → Space d) × (Fin m → ℝ)) ν → ℝ≥0∞, + Measurable φ → (∀ x, φ x ≤ 1) → + (∫⁻ x, φ x ∂ηc) ≤ B * (∫⁻ x in ProjectedEllipsoid z R, φ x ∂ν.completion)^α) + +def JointL1Statement : Prop := + let two : ℝ := @OfNat.ofNat ℝ 2 (@instOfNatAtLeastTwo ℝ 2 Real.commRing.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0))) + let exponent : ℝ≥0∞ := @OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0))) + ∀ d m p : ℕ, + letI : MeasurableSpace (Space d) := WithLp.measurableSpace exponent (Fin d → ℝ) + 2 ≤ d → 1 ≤ m → m < d → 2 ≤ p → + ∀ β H R : ℝ, (m : ℝ)+(p : ℝ)-two < β → 0 < H → 0 < R → + ∀ z : Space d, ∀ μ : Measure (Space d), IsFiniteMeasure μ → + @Measure.support (Space d) + (PiLp.topologicalSpace (p := exponent) (β := fun _ : Fin d => ℝ)) + (WithLp.measurableSpace exponent (Fin d → ℝ)) μ ⊆ + @Metric.closedBall (Space d) + (PiLp.instPseudoMetricSpace (p := exponent) (β := fun _ : Fin d => ℝ)) z R → + AmbientBallBound μ H β → + μ ≪ UniformSphere d → + ∀ F : ((Fin m → Space d) × (Fin m → ℝ)) → ℝ, + Measurable F → (∀ x, 0 ≤ F x) → + (MatrixLabelReference d m).withDensity (fun x => ENNReal.ofReal (F x)) = + ProjectionLaw μ m → + Tendsto (fun δ => eLpNorm (fun Ay => GaussianRegularization μ m δ Ay - F Ay) + 1 (MatrixLabelReference d m)) (𝓝[Set.Ioi 0] 0) (𝓝 0) ∧ + eLpNorm F (p : ℝ≥0∞) (MatrixLabelReference d m) ≤ + ENNReal.ofReal (ProjectionNormScale m p H β R) + +def RadialMixtureRepresentation (m : ℕ) : Prop := + ∀ δ : ℝ, 0 < δ → + (∀ r : ℝ, 0 < r → 0 ≤ RadialMixture m δ r) ∧ + Measurable (RadialMixture m δ) ∧ + (∫ r in Set.Ioi 0, RadialMixture m δ r) = 1 ∧ + (∀ y : Space m, GaussianKernel m δ y = + ∫ r in Set.Ioi ‖y‖, RadialMixture m δ r / (UnitBallVolume m * r^m)) + +def FullRankDensityFormula {d : ℕ} + (μ : @Measure (Space d) + (WithLp.measurableSpace + (@OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0)))) (Fin d → ℝ))) + (m : ℕ) : Prop := + let exponent : ℝ≥0∞ := @OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0))) + ∀ A : Fin m → Space d, + @LinearIndependent (Fin m) ℝ (Space d) A Real.commRing.toSemiring + (WithLp.instAddCommGroup exponent (Fin d → ℝ)).toAddCommMonoid + (WithLp.instModule (p := exponent) (K := ℝ) (V := Fin d → ℝ)) → + (volume : Measure (Fin m → ℝ)).withDensity + (fun y => ENNReal.ofReal (PointwiseDensity μ m (A,y))) = + @Measure.map (Space d) (Fin m → ℝ) + (WithLp.measurableSpace exponent (Fin d → ℝ)) inferInstance + (fun signal => fun index => @inner ℝ (Space d) + (@InnerProductSpace.toInner ℝ (Space d) _ + (PiLp.seminormedAddCommGroup exponent (fun _ : Fin d => ℝ)) + (PiLp.innerProductSpace (𝕜 := ℝ) (fun _ : Fin d => ℝ))) + signal (A index)) μ + +def PointwiseDensityProperties {d : ℕ} + (μ : @Measure (Space d) + (WithLp.measurableSpace + (@OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0)))) (Fin d → ℝ))) + (m p : ℕ) (H β R : ℝ) : Prop := + letI : MeasurableSpace (Space d) := WithLp.measurableSpace + (@OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0)))) (Fin d → ℝ) + let reference : Measure ((Fin m → Space d) × (Fin m → ℝ)) := MatrixLabelReference d m + RadialMixtureRepresentation m ∧ + (∀ x, 0 ≤ PointwiseDensity μ m x) ∧ + Measurable (PointwiseDensity μ m) ∧ + FullRankDensityFormula μ m ∧ + reference.withDensity (fun x => ENNReal.ofReal (PointwiseDensity μ m x)) = + ProjectionLaw μ m ∧ + (∀ F : ((Fin m → Space d) × (Fin m → ℝ)) → ℝ, + Measurable F → (∀ x, 0 ≤ F x) → + reference.withDensity (fun x => ENNReal.ofReal (F x)) = + ProjectionLaw μ m → PointwiseDensity μ m =ᵐ[reference] F) ∧ + (∫⁻ x, ENNReal.ofReal (PointwiseDensity μ m x)^p ∂reference) ≤ + ENNReal.ofReal (ProjectionNormScale m p H β R)^p + +def PointwiseDensityStatement : Prop := + let two : ℝ := @OfNat.ofNat ℝ 2 (@instOfNatAtLeastTwo ℝ 2 Real.commRing.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0))) + let exponent : ℝ≥0∞ := @OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0))) + ∀ d m p : ℕ, 2 ≤ d → 1 ≤ m → m < d → 2 ≤ p → + ∀ β H R : ℝ, (m : ℝ)+(p : ℝ)-two < β → 0 < H → 0 < R → + ∀ z : Space d, + ∀ μ : @Measure (Space d) (WithLp.measurableSpace exponent (Fin d → ℝ)), + IsFiniteMeasure μ → + @Measure.support (Space d) + (PiLp.topologicalSpace (p := exponent) (β := fun _ : Fin d => ℝ)) + (WithLp.measurableSpace exponent (Fin d → ℝ)) μ ⊆ + @Metric.closedBall (Space d) + (PiLp.instPseudoMetricSpace (p := exponent) (β := fun _ : Fin d => ℝ)) z R → + AmbientBallBound μ H β → + μ ≪ UniformSphere d → PointwiseDensityProperties μ m p H β R + +def CoefficientStepStatement : Prop := + let two : ℝ := @OfNat.ofNat ℝ 2 (@instOfNatAtLeastTwo ℝ 2 Real.commRing.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0))) + ∃ C : ℝ, 1 ≤ C ∧ ∀ d m N : ℕ, 16 ≤ d → + 1 ≤ m → m ≤ d/8 → 1 ≤ N → + ∀ α H : ℝ, ((d:ℝ)-1)/two ≤ α → α ≤ (d:ℝ)/two → 0 < H → + ∀ h : Fin N → Sphere d → ℝ≥0∞, + (∀ w, Measurable (h w)) → (∀ w s, h w s ≤ 1) → + (∀ w, SphereBallBound (h w) H α) → + ∀ g : Fin N → ((Fin m → Space d) × (Fin m → ℝ)) → ℝ≥0∞, + (∀ w, Measurable (g w)) → (∀ x, ∑ w, g w x ≤ 1) → + SphereBallBound (SphereBlock h g) (C^d * (N:ℝ)^(1/((d/8:ℕ):ℝ)) * H) α + +def CubeBlockStatement : Prop := + ∃ C : ℝ, 1 ≤ C ∧ ∀ d k N : ℕ, 16 ≤ d → 1 ≤ k → k ≤ (d/2)/4 → 1 ≤ N → + ∀ L : ℝ, 0 ≤ L → ∀ f : Fin N → Cube d → ℝ≥0∞, + (∀ v, Measurable (f v)) → (∀ v u, f v u ≤ 1) → (∀ v, CubeLocal (f v) L) → + ∀ g : Fin N → ((Fin k → Space d) × (Fin k → ℝ)) → ℝ≥0∞, + (∀ v, Measurable (g v)) → (∀ x, ∑ v, g v x ≤ 1) → + CubeLocal (WeightedBlock (CubeEmbedding d) f g) + (C^(d/2) * (N:ℝ)^(1/(((d/2)/4:ℕ):ℝ)) * L) + +end MemoryPrecision + +namespace MemoryPrecision.Kernel +namespace Policy + +def ModelAdmissible {d M T : ℕ} {Ω : Type u} [MeasurableSpace Ω] + (K : Ω → Policy d M T) (ρ : Measure Ω) : Prop := + ∀ π : Measure (Sphere d), IsProbabilityMeasure π → Admissible K ρ π + +end Policy + +open MemoryPrecision NoiselessRegression Policy + +def CubePrior {d : ℕ} (hd : 2 ≤ d) : Measure (MemoryPrecision.Kernel.Sphere d) := + (CubeLaw d).map (CubeSphere hd) + +def BlockCount (T p : ℕ) : ℕ := ⌈(T:ℝ)/(p:ℝ)⌉₊ + +def SourceEllipsoidStatement : Prop := + let two : ℝ := @OfNat.ofNat ℝ 2 (@instOfNatAtLeastTwo ℝ 2 Real.commRing.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0))) + let four : ℝ := @OfNat.ofNat ℝ 4 (@instOfNatAtLeastTwo ℝ 4 Real.commRing.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 2))) + let ten : ℝ := @OfNat.ofNat ℝ 10 (@instOfNatAtLeastTwo ℝ 10 Real.commRing.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 8))) + ∃ C C₀ : ℝ, 1 ≤ C ∧ 1 ≤ C₀ ∧ + ∀ d M T : ℕ, 16 ≤ d → ∀ ε : ℝ, 0 < ε → ε ≤ 1/ten → + ∀ (Ω : Type u) [MeasurableSpace Ω] (ρ : Measure Ω), IsProbabilityMeasure ρ → + ∀ K : Ω → Policy d M T, Policy.Admissible K ρ (UniformSphere d) → + Policy.Success K ρ (UniformSphere d) ε ≤ min 1 (ENNReal.ofReal + (four^d * ε^(((d:ℝ)-1)/two) * + (C^d * (((d/8+2)*2^M : ℕ):ℝ)^(1/((d/8:ℕ):ℝ)))^(BlockCount T (d/8)))) ∧ + Policy.ChordSuccess K ρ (UniformSphere d) ε ≤ min 1 (ENNReal.ofReal + (C₀^d * ε^((d:ℝ)/two-1) * + (C^d * (((2*(d/8)+4)*2^M : ℕ):ℝ)^(1/((d/8:ℕ):ℝ)))^(BlockCount T (d/8)))) ∧ + {x : Sphere d × Sphere d | Real.arccos (@inner ℝ (Vector d) + (@InnerProductSpace.toInner ℝ (Vector d) _ + (PiLp.seminormedAddCommGroup + (@OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0)))) + (fun _ : Fin d => ℝ)) + (PiLp.innerProductSpace (𝕜 := ℝ) (fun _ : Fin d => ℝ))) + x.2.val x.1.val) ≤ ε} ⊆ + {x | @Dist.dist (Vector d) + (PiLp.instDist (p := @OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast + (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0)))) + (α := fun _ : Fin d => ℝ)) x.2.val x.1.val ≤ ε} + +lemma cubePrior_dimension {d₀ d : ℕ} (hd₀ : 16 ≤ d₀) (hd : d₀ ≤ d) : 2 ≤ d := + Nat.le_trans (by decide : 2 ≤ 16) (Nat.le_trans hd₀ hd) + +end MemoryPrecision.Kernel + +namespace MemoryPrecision + +theorem main : + AmbientGramStatement ∧ + FiniteDensityStatement ∧ + MeasurableTestStatement ∧ + JointL1Statement ∧ + PointwiseDensityStatement ∧ + CoefficientStepStatement ∧ + Kernel.SourceEllipsoidStatement.{u} ∧ + CubeBlockStatement ∧ + (∃ D : ℝ, Real.exp 1 ≤ D ∧ ∃ d₀ : ℕ, ∃ hd₀ : 16 ≤ d₀, ∃ c : ℝ, 0 < c ∧ + ∀ d M T : ℕ, ∀ hd : d₀ ≤ d, M ≤ d^2 → ∀ ε : ℝ, 0 < ε → ε ≤ 1/10 → + ∀ (Ω : Type u) [MeasurableSpace Ω] (ρ : Measure Ω), IsProbabilityMeasure ρ → + ∀ K : Ω → MemoryPrecision.Kernel.Policy d M T, + MemoryPrecision.Kernel.Policy.ModelAdmissible.{u} K ρ → + MemoryPrecision.Kernel.Policy.Success K ρ + (MemoryPrecision.Kernel.CubePrior (MemoryPrecision.Kernel.cubePrior_dimension hd₀ hd)) ε ≤ + min 1 (ENNReal.ofReal + (D^((d/2)*(MemoryPrecision.Kernel.BlockCount T ((d/2)/4)+1)) * ε^((d/2:ℕ)/4:ℝ))) ∧ + ((∀ signal : MemoryPrecision.Kernel.Sphere d, + (@OfNat.ofNat ℝ≥0∞ 2 + (@instOfNatAtLeastTwo ℝ≥0∞ 2 ENNReal.instAddCommMonoidWithOne.toNatCast inferInstance)) / + (@OfNat.ofNat ℝ≥0∞ 3 + (@instOfNatAtLeastTwo ℝ≥0∞ 3 ENNReal.instAddCommMonoidWithOne.toNatCast inferInstance)) ≤ + (∫⁻ observation, + MemoryPrecision.Kernel.Policy.experiment K + (MemoryPrecision.Kernel.Policy.angleTest ε) (signal, observation) + ∂ρ.prod (MemoryPrecision.Kernel.RowLaw d T))) → + c*(d:ℝ)*Real.log (1/ε) ≤ (T:ℝ))) ∧ + (∃ C : ℝ, 0 < C ∧ ∃ d₀ : ℕ, 0 < d₀ ∧ + ∀ d M T : ℕ, d₀ ≤ d → ∀ ε : ℝ, 0 < ε → ε ≤ 1/10 → + ∀ (Ω : Type u) [MeasurableSpace Ω] (ρ : Measure Ω), IsProbabilityMeasure ρ → + ∀ L : Ω → MemoryPrecision.Kernel.Policy d M T, + MemoryPrecision.Kernel.Policy.Admissible L ρ (MemoryPrecision.Kernel.UniformSphere d) → + MemoryPrecision.Kernel.Policy.Success L ρ (MemoryPrecision.Kernel.UniformSphere d) ε ≤ min 1 (ENNReal.ofReal + ((2*ε*Real.exp (C*(1+(M:ℝ)/(d:ℝ)^2)*(MemoryPrecision.Kernel.BlockCount T ((d-1)/8):ℝ)))^(((d:ℝ)-1)/2)))) := by + sorry + +end MemoryPrecision + +end + +end OAI diff --git a/lean/ComparatorChallenges/MetricEntropyDuality.json b/lean/ComparatorChallenges/MetricEntropyDuality.json new file mode 100644 index 0000000000000000000000000000000000000000..66597fb02cd9eace9491154ccfcc20bc3267a0ef --- /dev/null +++ b/lean/ComparatorChallenges/MetricEntropyDuality.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.MetricEntropyDuality", + "solution_module": "OAI.Analysis.MetricEntropy.Main", + "theorem_names": [ + "OAI.MetricEntropyDuality.exists_entropy_duality_counterexample_with_covers" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/MetricEntropyDuality.lean b/lean/ComparatorChallenges/MetricEntropyDuality.lean new file mode 100644 index 0000000000000000000000000000000000000000..f05676fe1c06c40e0be9197d054f4d646f463b96 --- /dev/null +++ b/lean/ComparatorChallenges/MetricEntropyDuality.lean @@ -0,0 +1,59 @@ +import Mathlib.Analysis.Convex.Topology +import Mathlib.Analysis.Normed.Group.Constructions +import Mathlib.Order.Lattice.Nat +import Mathlib.Analysis.SpecialFunctions.Log.Basic + +namespace OAI + +universe u + +noncomputable section + +namespace MetricEntropyDuality + +open Filter Topology +open scoped BigOperators Pointwise + +abbrev RealSpace (ι : Type u) := ι → ℝ + +def pairing {ι : Type u} [Fintype ι] (x y : RealSpace ι) : ℝ := + ∑ i, x i * y i + +def cube (ι : Type u) : Set (RealSpace ι) := + {x | ∀ i, |x i| ≤ 1} + +def polar {ι : Type u} [Fintype ι] (K : Set (RealSpace ι)) : Set (RealSpace ι) := + {y | ∀ x ∈ K, pairing x y ≤ 1} + +def Covers {ι : Type u} {M : ℕ} (A B : Set (RealSpace ι)) + (centers : Fin M → RealSpace ι) : Prop := + ∀ x ∈ A, ∃ j, x - centers j ∈ B + +def Coverable {ι : Type u} (A B : Set (RealSpace ι)) : Prop := + ∃ M : ℕ, ∃ centers : Fin M → RealSpace ι, Covers A B centers + +def coveringNumber {ι : Type u} (A B : Set (RealSpace ι)) : ℕ := + sInf {M : ℕ | ∃ centers : Fin M → RealSpace ι, Covers A B centers} + +structure IsSymmetricConvexBody {ι : Type u} [Fintype ι] + (K : Set (RealSpace ι)) : Prop where + isCompact : IsCompact K + convex : Convex ℝ K + symmetric : ∀ x, x ∈ K ↔ -x ∈ K + interior_nonempty : (interior K).Nonempty + +theorem exists_entropy_duality_counterexample_with_covers + (a b : ℝ) (ha : 1 ≤ a) (hb : 1 ≤ b) : + ∃ n : ℕ, 0 < n ∧ ∃ K : Set (RealSpace (Fin n)), + IsSymmetricConvexBody K ∧ + Coverable K (cube (Fin n)) ∧ + Coverable (polar (cube (Fin n))) (a⁻¹ • polar K) ∧ + b * Real.log (coveringNumber (polar (cube (Fin n))) (a⁻¹ • polar K) : ℝ) < + Real.log (coveringNumber K (cube (Fin n)) : ℝ) := by + sorry + +end MetricEntropyDuality + +end + +end OAI diff --git a/lean/ComparatorChallenges/MetricKMedian.json b/lean/ComparatorChallenges/MetricKMedian.json new file mode 100644 index 0000000000000000000000000000000000000000..af42dfc4e4ee30a99ef1074e5e6766656d1a082a --- /dev/null +++ b/lean/ComparatorChallenges/MetricKMedian.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.MetricKMedian", + "solution_module": "OAI.Combinatorics.KMedian.Main", + "theorem_names": [ + "OAI.MetricKMedian.main_finite_work" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/MetricKMedian.lean b/lean/ComparatorChallenges/MetricKMedian.lean new file mode 100644 index 0000000000000000000000000000000000000000..4a85012c9074cf8b86c1250c43db398e6812d798 --- /dev/null +++ b/lean/ComparatorChallenges/MetricKMedian.lean @@ -0,0 +1,68 @@ +import Mathlib + +namespace OAI + + + + +section +section +namespace MetricKMedian + +structure Instance where + n : ℕ + distance : Fin n → Fin n → ℚ + clients : Finset (Fin n) + facilities : Finset (Fin n) + k : ℕ + distance_nonneg : ∀ i j, 0 ≤ distance i j + distance_eq_zero : ∀ i j, distance i j = 0 ↔ i = j + distance_symm : ∀ i j, distance i j = distance j i + distance_triangle : ∀ i j h, distance i h ≤ distance i j + distance j h + k_pos : 1 ≤ k + k_le : k ≤ facilities.card + +def encodeNat (n : ℕ) : List Bool := + List.replicate n.bits.length true ++ [false] ++ n.bits + +def encodeRat (q : ℚ) : List Bool := + [decide (q.num < 0)] ++ encodeNat q.num.natAbs ++ encodeNat q.den + +def encodeInstance (I : Instance) : List Bool := + encodeNat I.n ++ encodeNat I.k ++ + List.ofFn (fun i : Fin I.n => decide (i ∈ I.clients)) ++ + List.ofFn (fun i : Fin I.n => decide (i ∈ I.facilities)) ++ + (List.ofFn (fun i : Fin I.n => + (List.ofFn (fun j : Fin I.n => encodeRat (I.distance i j))).flatten)).flatten + +noncomputable def nearest (I : Instance) (j : Fin I.n) (S : Finset (Fin I.n)) : ℝ := + if h : S.Nonempty then + (S.image (fun i => (I.distance j i : ℝ))).min' (h.image _) + else 0 + +noncomputable def cost (I : Instance) (S : Finset (Fin I.n)) : ℝ := + ∑ j ∈ I.clients, nearest I j S + +def feasibleSets (I : Instance) : Finset (Finset (Fin I.n)) := + I.facilities.powerset.filter (fun S => S.Nonempty ∧ S.card ≤ I.k) + +noncomputable def optimum (I : Instance) : ℝ := + if h : (feasibleSets I).Nonempty then + ((feasibleSets I).image (cost I)).min' (h.image _) + else 0 + +def Correct (epsilon : ℝ) (I : Instance) (output : List Bool) : Prop := + ∃ S : Finset (Fin I.n), S ⊆ I.facilities ∧ S.Nonempty ∧ S.card ≤ I.k ∧ + output = List.ofFn (fun i : Fin I.n => decide (i ∈ S)) ∧ + cost I S ≤ (1 + 2 / Real.exp 1 + epsilon) * optimum I + +theorem main_finite_work : ∀ ε : ℝ, 0 < ε → + ∃ (algorithm : Instance → List Bool) (P : Turing.TM2ComputableInPolyTime encodeInstance id algorithm), + (∀ k : P.tm.K, Finite (P.tm.Γ k)) ∧ ∀ I, Correct ε I (algorithm I) := by + sorry + +end MetricKMedian +end +end + +end OAI diff --git a/lean/ComparatorChallenges/MidpointLenses.json b/lean/ComparatorChallenges/MidpointLenses.json new file mode 100644 index 0000000000000000000000000000000000000000..d7fe960eb6f3b484c08476acc51b7d3ee4de05bd --- /dev/null +++ b/lean/ComparatorChallenges/MidpointLenses.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.MidpointLenses", + "solution_module": "OAI.Analysis.SegmentLenses.Main", + "theorem_names": [ + "OAI.SegmentLenses.midpoint_lens_main" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/MidpointLenses.lean b/lean/ComparatorChallenges/MidpointLenses.lean new file mode 100644 index 0000000000000000000000000000000000000000..bca57d7af8242f487c540dc429477e629bd464f1 --- /dev/null +++ b/lean/ComparatorChallenges/MidpointLenses.lean @@ -0,0 +1,343 @@ +import Mathlib + +namespace OAI + +noncomputable section + +/-! +# Segment tests, their completion, and coordinate functionals +-/ + + + +open scoped BigOperators +open Finset + +namespace SegmentLenses + +abbrev InfiniteVertex := List ℕ + +def ForestVertex := {p : ℕ × List ℕ // 1 ≤ p.1 ∧ p.2.length ≤ p.1} + +def ForestAncestor (a b : ForestVertex) : Prop := + a.val.1 = b.val.1 ∧ a.val.2.IsPrefix b.val.2 + +def IsInterval {V : Type*} (ancestor : V → V → Prop) (S : Finset V) : Prop := + ∃ a b, ancestor a b ∧ ∀ v, v ∈ S ↔ ancestor a v ∧ ancestor v b + +def Ancestral {V : Type*} (ancestor : V → V → Prop) (H : Finset V) : Prop := + ∀ ⦃a b⦄, b ∈ H → ancestor a b → a ∈ H + +class SegmentSystem (V : Type*) where + isSegment : Finset V → Prop + singleton : ∀ v, isSegment {v} + +structure SegmentFamily (V : Type*) [SegmentSystem V] where + sets : Finset (Finset V) + segment : ∀ S ∈ sets, SegmentSystem.isSegment S + disjoint : (sets : Set (Finset V)).PairwiseDisjoint id + +namespace SegmentFamily + +variable {V : Type*} [SegmentSystem V] + +def column (F : SegmentFamily V) (v : V) : EuclideanSpace ℝ F.sets := + by classical exact WithLp.toLp 2 (fun S => if v ∈ S.val then 1 else 0) + +def test (F : SegmentFamily V) : (V →₀ ℝ) →ₗ[ℝ] EuclideanSpace ℝ F.sets := + Finsupp.linearCombination ℝ F.column + +def seminorm (F : SegmentFamily V) : Seminorm ℝ (V →₀ ℝ) := + (normSeminorm ℝ (EuclideanSpace ℝ F.sets)).comp F.test + +def singleton (v : V) : SegmentFamily V where + sets := {{v}} + segment := by + intro S h + have he : S = {v} := Finset.mem_singleton.mp h + rw [he] + exact SegmentSystem.singleton v + disjoint := by + intro S hS T hT hne + simp only [Finset.mem_coe, Finset.mem_singleton] at hS hT + exact False.elim (hne (hS.trans hT.symm)) + +end SegmentFamily + +def segmentSeminorm (V : Type*) [SegmentSystem V] : Seminorm ℝ (V →₀ ℝ) := + ⨆ F : SegmentFamily V, F.seminorm + +def Test (V : Type*) := V →₀ ℝ + +namespace Test + +variable {V : Type*} +instance : AddCommGroup (Test V) := inferInstanceAs (AddCommGroup (V →₀ ℝ)) +instance : Module ℝ (Test V) := inferInstanceAs (Module ℝ (V →₀ ℝ)) + +def coeff (u : Test V) : V →₀ ℝ := u + +def ofFinsupp (u : V →₀ ℝ) : Test V := u + +variable [SegmentSystem V] +instance : Norm (Test V) where norm u := segmentSeminorm V u.coeff + +instance : NormedAddCommGroup (Test V) := by + have norm_column_le {V : Type _} [SegmentSystem V] (F : SegmentFamily V) (v : V) : ‖F.column v‖ ≤ 1 := by + classical + by_cases hv : ∃ S ∈ F.sets, v ∈ S + · obtain ⟨S, hS, hvS⟩ := hv + have he : F.column v = PiLp.single 2 (⟨S, hS⟩ : F.sets) (1 : ℝ) := by + ext T + change (if v ∈ T.val then (1 : ℝ) else 0) = _ + by_cases hTS : T = ⟨S, hS⟩ + · subst T + simp [hvS] + · have hn : v ∉ T.val := by + intro hvT + have hne : T.val ≠ S := fun h => hTS (Subtype.ext h) + exact Finset.disjoint_left.mp (F.disjoint T.property hS hne) hvT hvS + simp [hTS, hn] + rw [he, PiLp.norm_single] + norm_num + · have he : F.column v = 0 := by + ext S + have hn : v ∉ S.val := fun h => hv ⟨S.val, S.property, h⟩ + simp [SegmentFamily.column, hn] + rw [he, norm_zero] + norm_num + have test_apply {V : Type _} [SegmentSystem V] (F : SegmentFamily V) (u : V →₀ ℝ) (S : F.sets) : + F.test u S = ∑ v ∈ S.val, u v := by + classical + simp only [SegmentFamily.test, Finsupp.linearCombination_apply, Finsupp.sum, + WithLp.ofLp_sum, Finset.sum_apply, PiLp.smul_apply, SegmentFamily.column, + smul_eq_mul] + simp only [mul_ite, mul_one, mul_zero] + rw [← Finset.sum_filter] + apply Finset.sum_subset + · intro v hv + exact (Finset.mem_filter.mp hv).2 + · intro v hv hnv + have hnot : v ∉ u.support := by + intro hvs + exact hnv (Finset.mem_filter.mpr ⟨hvs, hv⟩) + exact Finsupp.notMem_support_iff.mp hnot + have norm_test_le {V : Type _} [SegmentSystem V] (F : SegmentFamily V) (u : V →₀ ℝ) : + ‖F.test u‖ ≤ ∑ v ∈ u.support, |u v| := by + classical + rw [SegmentFamily.test, Finsupp.linearCombination_apply, Finsupp.sum] + calc + ‖∑ v ∈ u.support, u v • F.column v‖ ≤ + ∑ v ∈ u.support, ‖u v • F.column v‖ := norm_sum_le _ _ + _ ≤ ∑ v ∈ u.support, |u v| := by + apply Finset.sum_le_sum + intro v hv + rw [norm_smul, Real.norm_eq_abs] + exact mul_le_of_le_one_right (abs_nonneg _) (norm_column_le F v) + have seminorm_sq {V : Type _} [SegmentSystem V] (F : SegmentFamily V) (u : V →₀ ℝ) : + F.seminorm u ^ 2 = ∑ S : F.sets, (∑ v ∈ S.val, u v) ^ 2 := by + change ‖F.test u‖ ^ 2 = _ + rw [EuclideanSpace.real_norm_sq_eq] + apply Finset.sum_congr rfl + intro S _ + rw [test_apply] + have singleton_seminorm {V : Type _} [SegmentSystem V] (v : V) (u : V →₀ ℝ) : + (SegmentFamily.singleton v).seminorm u = |u v| := by + have h := seminorm_sq (SegmentFamily.singleton v) u + have hh : (∑ S : (SegmentFamily.singleton v).sets, (∑ w ∈ S.val, u w) ^ 2) = u v ^ 2 := by + exact (Finset.sum_coe_sort (SegmentFamily.singleton v).sets + (fun S : Finset V => (∑ w ∈ S, u w) ^ 2)).trans (by simp [SegmentFamily.singleton]) + rw [hh] at h + have hn := apply_nonneg (SegmentFamily.singleton v).seminorm u + nlinarith [sq_abs (u v), abs_nonneg (u v)] + have segmentTests_bdd (V : Type _) [SegmentSystem V] : + BddAbove (Set.range (SegmentFamily.seminorm (V := V))) := by + rw [Seminorm.bddAbove_iff] + refine ⟨fun u => ∑ v ∈ u.support, |u v|, ?_⟩ + rintro _ ⟨p, ⟨F, rfl⟩, rfl⟩ u + exact norm_test_le F u + have le_segmentSeminorm {V : Type _} [SegmentSystem V] + (F : SegmentFamily V) (u : V →₀ ℝ) : F.seminorm u ≤ segmentSeminorm V u := by + have h := le_ciSup (f := fun G : SegmentFamily V => G.seminorm) (segmentTests_bdd V) F + exact Seminorm.le_def.mp h u + have abs_coord_le {V : Type _} [SegmentSystem V] (u : V →₀ ℝ) (v : V) : + |u v| ≤ segmentSeminorm V u := by + rw [← singleton_seminorm v u] + exact le_segmentSeminorm _ _ + have segmentSeminorm_eq_zero {V : Type _} [SegmentSystem V] (u : V →₀ ℝ) : + segmentSeminorm V u = 0 ↔ u = 0 := by + constructor + · intro h + ext v + have hh := abs_coord_le u v + rw [h] at hh + simpa using hh + · rintro rfl + exact map_zero _ + exact NormedAddCommGroup.ofCore (𝕜 := ℝ) { + norm_nonneg u := apply_nonneg (segmentSeminorm V) u.coeff + norm_smul c u := map_smul_eq_mul (segmentSeminorm V) c u.coeff + norm_triangle u v := map_add_le_add (segmentSeminorm V) u.coeff v.coeff + norm_eq_zero_iff u := segmentSeminorm_eq_zero u.coeff } +instance : NormedSpace ℝ (Test V) where + norm_smul_le c u := le_of_eq (map_smul_eq_mul (segmentSeminorm V) c u.coeff) + +def evaluation (v : V) : Test V →L[ℝ] ℝ := by + have norm_column_le {V : Type _} [SegmentSystem V] (F : SegmentFamily V) (v : V) : ‖F.column v‖ ≤ 1 := by + classical + by_cases hv : ∃ S ∈ F.sets, v ∈ S + · obtain ⟨S, hS, hvS⟩ := hv + have he : F.column v = PiLp.single 2 (⟨S, hS⟩ : F.sets) (1 : ℝ) := by + ext T + change (if v ∈ T.val then (1 : ℝ) else 0) = _ + by_cases hTS : T = ⟨S, hS⟩ + · subst T + simp [hvS] + · have hn : v ∉ T.val := by + intro hvT + have hne : T.val ≠ S := fun h => hTS (Subtype.ext h) + exact Finset.disjoint_left.mp (F.disjoint T.property hS hne) hvT hvS + simp [hTS, hn] + rw [he, PiLp.norm_single] + norm_num + · have he : F.column v = 0 := by + ext S + have hn : v ∉ S.val := fun h => hv ⟨S.val, S.property, h⟩ + simp [SegmentFamily.column, hn] + rw [he, norm_zero] + norm_num + have test_apply {V : Type _} [SegmentSystem V] (F : SegmentFamily V) (u : V →₀ ℝ) (S : F.sets) : + F.test u S = ∑ v ∈ S.val, u v := by + classical + simp only [SegmentFamily.test, Finsupp.linearCombination_apply, Finsupp.sum, + WithLp.ofLp_sum, Finset.sum_apply, PiLp.smul_apply, SegmentFamily.column, + smul_eq_mul] + simp only [mul_ite, mul_one, mul_zero] + rw [← Finset.sum_filter] + apply Finset.sum_subset + · intro v hv + exact (Finset.mem_filter.mp hv).2 + · intro v hv hnv + have hnot : v ∉ u.support := by + intro hvs + exact hnv (Finset.mem_filter.mpr ⟨hvs, hv⟩) + exact Finsupp.notMem_support_iff.mp hnot + have norm_test_le {V : Type _} [SegmentSystem V] (F : SegmentFamily V) (u : V →₀ ℝ) : + ‖F.test u‖ ≤ ∑ v ∈ u.support, |u v| := by + classical + rw [SegmentFamily.test, Finsupp.linearCombination_apply, Finsupp.sum] + calc + ‖∑ v ∈ u.support, u v • F.column v‖ ≤ + ∑ v ∈ u.support, ‖u v • F.column v‖ := norm_sum_le _ _ + _ ≤ ∑ v ∈ u.support, |u v| := by + apply Finset.sum_le_sum + intro v hv + rw [norm_smul, Real.norm_eq_abs] + exact mul_le_of_le_one_right (abs_nonneg _) (norm_column_le F v) + have seminorm_sq {V : Type _} [SegmentSystem V] (F : SegmentFamily V) (u : V →₀ ℝ) : + F.seminorm u ^ 2 = ∑ S : F.sets, (∑ v ∈ S.val, u v) ^ 2 := by + change ‖F.test u‖ ^ 2 = _ + rw [EuclideanSpace.real_norm_sq_eq] + apply Finset.sum_congr rfl + intro S _ + rw [test_apply] + have singleton_seminorm {V : Type _} [SegmentSystem V] (v : V) (u : V →₀ ℝ) : + (SegmentFamily.singleton v).seminorm u = |u v| := by + have h := seminorm_sq (SegmentFamily.singleton v) u + have hh : (∑ S : (SegmentFamily.singleton v).sets, (∑ w ∈ S.val, u w) ^ 2) = u v ^ 2 := by + exact (Finset.sum_coe_sort (SegmentFamily.singleton v).sets + (fun S : Finset V => (∑ w ∈ S, u w) ^ 2)).trans (by simp [SegmentFamily.singleton]) + rw [hh] at h + have hn := apply_nonneg (SegmentFamily.singleton v).seminorm u + nlinarith [sq_abs (u v), abs_nonneg (u v)] + have segmentTests_bdd (V : Type _) [SegmentSystem V] : + BddAbove (Set.range (SegmentFamily.seminorm (V := V))) := by + rw [Seminorm.bddAbove_iff] + refine ⟨fun u => ∑ v ∈ u.support, |u v|, ?_⟩ + rintro _ ⟨p, ⟨F, rfl⟩, rfl⟩ u + exact norm_test_le F u + have le_segmentSeminorm {V : Type _} [SegmentSystem V] + (F : SegmentFamily V) (u : V →₀ ℝ) : F.seminorm u ≤ segmentSeminorm V u := by + have h := le_ciSup (f := fun G : SegmentFamily V => G.seminorm) (segmentTests_bdd V) F + exact Seminorm.le_def.mp h u + have abs_coord_le {V : Type _} [SegmentSystem V] (u : V →₀ ℝ) (v : V) : + |u v| ≤ segmentSeminorm V u := by + rw [← singleton_seminorm v u] + exact le_segmentSeminorm _ _ + exact let f : Test V →ₗ[ℝ] ℝ := + { toFun := fun u => u.coeff v + map_add' := fun _ _ => rfl + map_smul' := fun _ _ => rfl } + f.mkContinuous 1 (fun u => by + change |u.coeff v| ≤ 1 * segmentSeminorm V u.coeff + simpa only [one_mul] using abs_coord_le u.coeff v) + +end Test + +abbrev Primal (V : Type*) [SegmentSystem V] := UniformSpace.Completion (Test V) + +abbrev FullDual (V : Type*) [SegmentSystem V] := StrongDual ℝ (Primal V) + +def unitVector {V : Type*} [SegmentSystem V] (v : V) : Primal V := + (Test.ofFinsupp (Finsupp.single v 1) : Test V) + +def coordinate {V : Type*} [SegmentSystem V] (v : V) : FullDual V := + (Test.evaluation v).extend UniformSpace.Completion.toComplL + +def coordinateSpan (V : Type*) [SegmentSystem V] : Submodule ℝ (FullDual V) := + (Submodule.span ℝ (Set.range (coordinate (V := V)))).topologicalClosure + +abbrev CoordinatePredual (V : Type*) [SegmentSystem V] : Type _ := ↥(coordinateSpan V) + +def head {V : Type*} [SegmentSystem V] (H : Finset V) (x : FullDual V) : FullDual V := + ∑ v ∈ H, x (unitVector v) • coordinate v + +def tail {V : Type*} [SegmentSystem V] (H : Finset V) (x : FullDual V) : FullDual V := + x - head H x + +instance infiniteSegments : SegmentSystem InfiniteVertex where + isSegment := IsInterval List.IsPrefix + singleton v := by + refine ⟨v, v, List.prefix_rfl, ?_⟩ + intro w + simp only [Finset.mem_singleton] + constructor + · rintro rfl; exact ⟨List.prefix_rfl, List.prefix_rfl⟩ + · rintro ⟨hvw, hwv⟩ + exact hwv.eq_of_length (Nat.le_antisymm hwv.length_le hvw.length_le) + +instance forestSegments : SegmentSystem ForestVertex where + isSegment := IsInterval ForestAncestor + singleton v := by + refine ⟨v, v, ⟨rfl, List.prefix_rfl⟩, ?_⟩ + intro w + simp only [Finset.mem_singleton] + constructor + · rintro rfl; exact ⟨⟨rfl, List.prefix_rfl⟩, ⟨rfl, List.prefix_rfl⟩⟩ + · rintro ⟨hvw, hwv⟩ + exact Subtype.ext (Prod.ext hwv.1 (hwv.2.eq_of_length (Nat.le_antisymm hwv.2.length_le hvw.2.length_le))) + +abbrev J := Primal ForestVertex + +abbrev X := FullDual ForestVertex + +abbrev JInfinite := Primal InfiniteVertex + +abbrev BInfinite := CoordinatePredual InfiniteVertex + +theorem midpoint_lens_main : + (∀ (H : Finset ForestVertex) (_ : Ancestral ForestAncestor H) + (x y : X) (_ : x = head H x) (R : ℝ) (_ : 0 ≤ R) + (_ : ‖x + y‖ ≤ R) (_ : ‖x - y‖ ≤ R), + ‖tail H y‖ ≤ 2 * Real.sqrt (R ^ 2 - ‖x‖ ^ 2)) ∧ + (∀ (H : Finset InfiniteVertex) (_ : Ancestral List.IsPrefix H) + (x y : BInfinite) (_ : x.val = head H x.val) (R : ℝ) (_ : 0 ≤ R) + (_ : ‖x + y‖ ≤ R) (_ : ‖x - y‖ ≤ R), + ‖tail H y.val‖ ≤ 2 * Real.sqrt (R ^ 2 - ‖x‖ ^ 2)) := + sorry + +end SegmentLenses + +end + +end OAI diff --git a/lean/ComparatorChallenges/MinUncut.json b/lean/ComparatorChallenges/MinUncut.json new file mode 100644 index 0000000000000000000000000000000000000000..212f6a5434499d004c7cf59c162cb7bdea2bfb25 --- /dev/null +++ b/lean/ComparatorChallenges/MinUncut.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.MinUncut", + "solution_module": "OAI.Computability.MinUncut.Main", + "theorem_names": [ + "OAI.MinUncut.main" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/MinUncut.lean b/lean/ComparatorChallenges/MinUncut.lean new file mode 100644 index 0000000000000000000000000000000000000000..f4631616d289df94cdec11e3f010fb5b8669623c --- /dev/null +++ b/lean/ComparatorChallenges/MinUncut.lean @@ -0,0 +1,130 @@ +import Mathlib + +namespace OAI + + + + + + + + + + +namespace MinUncutGames.BinaryFormula + +structure Literal where + name : Nat + positive : Bool + deriving DecidableEq + +def Literal.eval (literal : Literal) (assignment : Nat → Bool) : Bool := + if literal.positive then assignment literal.name else !(assignment literal.name) + +abbrev Clause := Vector Literal 3 + +def Clause.eval (clause : Clause) (assignment : Nat → Bool) : Bool := + (clause[0].eval assignment || clause[1].eval assignment) || clause[2].eval assignment + +structure Formula where + clauses : List Clause + +def Formula.Satisfiable (F : Formula) : Prop := + ∃ assignment : Nat → Bool, ∀ clause ∈ F.clauses, clause.eval assignment = true + +end MinUncutGames.BinaryFormula + +namespace MinUncutGames.BinaryEncoding +open BinaryFormula + +def frame : List Bool → List Bool + | [] => [false] + | b :: bits => true :: b :: frame bits + +def nameBits (name : Nat) : List Bool := frame name.bits + +def literalBits (literal : Literal) : List Bool := + literal.positive :: nameBits literal.name + +def clauseBits (clause : Clause) : List Bool := + literalBits clause[0] ++ literalBits clause[1] ++ literalBits clause[2] + +def clausesBits : List Clause → List Bool + | [] => [false] + | clause :: clauses => true :: (clauseBits clause ++ clausesBits clauses) + +def formulaBits (formula : Formula) : List Bool := clausesBits formula.clauses + +end MinUncutGames.BinaryEncoding + +namespace MinUncut +open MinUncutGames.BinaryFormula MinUncutGames.BinaryEncoding + + + +structure Output where + vertices : ℕ + adjacent : Fin vertices → Fin vertices → Bool + symmetric : ∀ u v, adjacent u v = adjacent v u + loopless : ∀ u, adjacent u u = false + threshold : ℕ + threshold_pos : 1 ≤ threshold + + + +def Output.uncut (G : Output) (cut : Fin G.vertices → Bool) : ℕ := + (Finset.univ.filter fun uv : Fin G.vertices × Fin G.vertices => + uv.1 < uv.2 ∧ G.adjacent uv.1 uv.2 = true ∧ cut uv.1 = cut uv.2).card + + + +noncomputable def Output.opt (G : Output) : ℕ := + (Finset.univ.image G.uncut).min' (by + exact Finset.image_nonempty.mpr Finset.univ_nonempty) + + + +def Output.bits (G : Output) : List Bool := + nameBits G.vertices ++ + ((List.finRange G.vertices).flatMap fun u => + (List.finRange G.vertices).map fun v => G.adjacent u v) ++ + nameBits G.threshold + + + +def inputBits (input : ℕ × Formula) : List Bool := + nameBits input.1 ++ formulaBits input.2 + + + + + +structure Reduction where + reduce : ℕ → Formula → Output + machine : Turing.TM2Computable inputBits Output.bits (fun p => reduce p.1 p.2) + finiteAlphabet : ∀ k : machine.tm.K, Finite (machine.tm.Γ k) + time : ℕ → Polynomial ℕ + runtime : ∀ K φ, + Turing.TM2OutputsInTime machine.tm + ((inputBits (K, φ)).map machine.inputAlphabet.symm) + (some (((reduce K φ).bits).map machine.outputAlphabet.symm)) + ((time K).eval (formulaBits φ).length) + size : ℕ → Polynomial ℕ + output_size : ∀ K φ, + (reduce K φ).vertices + (reduce K φ).bits.length ≤ + (size K).eval (formulaBits φ).length + yes : ∀ K, 2 ≤ K → ∀ φ, φ.Satisfiable → + (reduce K φ).opt ≤ (reduce K φ).threshold + no : ∀ K, 2 ≤ K → ∀ φ, ¬ φ.Satisfiable → + K * (reduce K φ).threshold < (reduce K φ).opt + +end MinUncut + +namespace MinUncut + +theorem main : Nonempty Reduction := by + sorry + +end MinUncut + +end OAI diff --git a/lean/ComparatorChallenges/Nagata.json b/lean/ComparatorChallenges/Nagata.json new file mode 100644 index 0000000000000000000000000000000000000000..954096c84dd43363642bb7fcb48d778c63af7714 --- /dev/null +++ b/lean/ComparatorChallenges/Nagata.json @@ -0,0 +1,16 @@ +{ + "challenge_module": "ComparatorChallenges.Nagata", + "solution_module": "OAI.AlgebraicGeometry.PlaneCurves.Nagata", + "theorem_names": [ + "OAI.Nagata.Workers.W30.exists_positive_degree_equation_of_homogeneous_cycle", + "OAI.Nagata.nagata_conjecture", + "OAI.Nagata.nagata_conjecture_coordinates" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/Nagata.lean b/lean/ComparatorChallenges/Nagata.lean new file mode 100644 index 0000000000000000000000000000000000000000..b2b453fbdef76a33643c0cf77ee62f4a39bd6f24 --- /dev/null +++ b/lean/ComparatorChallenges/Nagata.lean @@ -0,0 +1,372 @@ +import Mathlib.Algebra.CharZero.Infinite +import Mathlib.Algebra.Group.Irreducible.Defs +import Mathlib.Algebra.MvPolynomial.Eval +import Mathlib.Algebra.MvPolynomial.NoZeroDivisors +import Mathlib.Algebra.MvPolynomial.Rename +import Mathlib.Analysis.Real.Sqrt +import Mathlib.Basic.Complex.Basic +import Mathlib.Data.Fin.SuccPred +import Mathlib.Data.Fin.Tuple.Basic +import Mathlib.Data.Fintype.BigOperators +import Mathlib.LinearAlgebra.Projectivization.Basic +import Mathlib.RingTheory.GradedAlgebra.Homogeneous.Ideal +import Mathlib.RingTheory.Ideal.Height +import Mathlib.RingTheory.Ideal.IsPrincipal +import Mathlib.RingTheory.Ideal.Maps +import Mathlib.RingTheory.Ideal.Maximal +import Mathlib.RingTheory.Localization.AtPrime.Basic +import Mathlib.RingTheory.MvPolynomial.Homogeneous +import Mathlib.RingTheory.MvPolynomial.Ideal +import Mathlib.RingTheory.Polynomial.UniqueFactorization +import Mathlib.RingTheory.UniqueFactorizationDomain.Basic +import Mathlib.RingTheory.UniqueFactorizationDomain.Finsupp + +namespace OAI + +/-! +# Nagata's strict inequality for very general complex plane configurations + +The exceptional family is chosen before every curve and multiplicity vector. +Closedness means common multihomogeneous zero loci on the product of projective +planes, restricted to the open set of ordered distinct configurations. +-/ + +noncomputable section + +open scoped BigOperators + +namespace Nagata.AffineMultiplicity + +variable {σ K : Type*} [CommRing K] + +def pointIdeal (point : σ → K) : Ideal (MvPolynomial σ K) := + RingHom.ker (MvPolynomial.eval point) + +def orderAtLeast (point : σ → K) (multiplicity : ℕ) + (polynomial : MvPolynomial σ K) : Prop := + polynomial ∈ pointIdeal point ^ multiplicity + +def translateHom (point : σ → K) : MvPolynomial σ K →+* MvPolynomial σ K := + MvPolynomial.eval₂Hom MvPolynomial.C + (fun index => MvPolynomial.X index + MvPolynomial.C (point index)) + +@[simp] theorem translateHom_C (point : σ → K) (coefficient : K) : + translateHom point (MvPolynomial.C coefficient) = MvPolynomial.C coefficient := by + simp [translateHom] + +@[simp] theorem translateHom_X (point : σ → K) (index : σ) : + translateHom point (MvPolynomial.X index) = MvPolynomial.X index + MvPolynomial.C (point index) := by + simp [translateHom] + +theorem translateHom_neg_comp (point : σ → K) : + (translateHom (-point)).comp (translateHom point) = RingHom.id _ := by + apply MvPolynomial.ringHom_ext + · intro coefficient; simp + · intro index; simp [add_assoc] + +theorem translateHom_comp_neg (point : σ → K) : + (translateHom point).comp (translateHom (-point)) = RingHom.id _ := by + simpa only [neg_neg] using translateHom_neg_comp (-point) + +def translateEquiv (point : σ → K) : MvPolynomial σ K ≃+* MvPolynomial σ K := + { translateHom point with + invFun := translateHom (-point) + left_inv := fun polynomial => RingHom.congr_fun (translateHom_neg_comp point) polynomial + right_inv := fun polynomial => RingHom.congr_fun (translateHom_comp_neg point) polynomial } + +@[simp] theorem translateEquiv_apply (point : σ → K) (polynomial : MvPolynomial σ K) : + translateEquiv point polynomial = translateHom point polynomial := rfl + +theorem translate_ne_zero (point : σ → K) (polynomial : MvPolynomial σ K) + (nonzero : polynomial ≠ 0) : translateHom point polynomial ≠ 0 := by + intro translated_zero + apply nonzero + apply (translateEquiv point).injective + simpa only [translateEquiv_apply, map_zero] using translated_zero + +theorem translated_support_nonempty (point : σ → K) (polynomial : MvPolynomial σ K) + (nonzero : polynomial ≠ 0) : (translateHom point polynomial).support.Nonempty := + MvPolynomial.support_nonempty.mpr (translate_ne_zero point polynomial nonzero) + +/-- The least total degree of a nonzero Taylor coefficient. -/ +def ordinaryMultiplicity (point : σ → K) (polynomial : MvPolynomial σ K) + (nonzero : polynomial ≠ 0) : ℕ := + (translateHom point polynomial).support.inf' + (translated_support_nonempty point polynomial nonzero) Finsupp.degree + +end Nagata.AffineMultiplicity + +namespace Nagata.ProjectiveGeometry + +abbrev PlanePoint := Projectivization ℂ (Fin 3 → ℂ) + +abbrev OrderedDistinctPoints (count : ℕ) := + {points : Fin count → PlanePoint // Function.Injective points} + +structure MultihomogeneousEquation (count : ℕ) where + polynomial : MvPolynomial (Fin count × Fin 3) ℂ + multidegree : Fin count → ℕ + homogeneous : ∀ exponent ∈ polynomial.support, ∀ index, + (∑ coordinate : Fin 3, exponent (index, coordinate)) = multidegree index + +def equationVanishes {count : ℕ} (equation : MultihomogeneousEquation count) + (points : Fin count → PlanePoint) : Prop := + ∀ (vectors : Fin count → Fin 3 → ℂ) (nonzero : ∀ index, vectors index ≠ 0), + (∀ index, Projectivization.mk ℂ (vectors index) (nonzero index) = points index) → + MvPolynomial.eval (fun index => vectors index.1 index.2) equation.polynomial = 0 + +def IsProductZariskiClosed {count : ℕ} (locus : Set (Fin count → PlanePoint)) : Prop := + ∃ equations : Set (MultihomogeneousEquation count), + ∀ points, points ∈ locus ↔ ∀ equation ∈ equations, equationVanishes equation points + +def IsConfigurationZariskiClosed {count : ℕ} + (locus : Set (OrderedDistinctPoints count)) : Prop := + ∃ ambient : Set (Fin count → PlanePoint), IsProductZariskiClosed ambient ∧ + ∀ points, points ∈ locus ↔ points.val ∈ ambient + +abbrev ChartVariables (chart : Fin 3) := {coordinate : Fin 3 // coordinate ≠ chart} + +def dehomogenize (chart : Fin 3) (polynomial : MvPolynomial (Fin 3) ℂ) : + MvPolynomial (ChartVariables chart) ℂ := + MvPolynomial.eval₂ MvPolynomial.C + (fun coordinate => if equal : coordinate = chart then 1 + else MvPolynomial.X ⟨coordinate, equal⟩) polynomial + +def chartCoordinates (chart : Fin 3) (point : PlanePoint) : ChartVariables chart → ℂ := + fun coordinate => point.rep coordinate.val / point.rep chart + +/-- Local multiplicity lower bounds are membership in powers of the point ideal. -/ +def multiplicityAtLeast (polynomial : MvPolynomial (Fin 3) ℂ) + (point : PlanePoint) (multiplicity : ℕ) : Prop := + ∀ chart : Fin 3, point.rep chart ≠ 0 → + AffineMultiplicity.orderAtLeast (chartCoordinates chart point) multiplicity + (dehomogenize chart polynomial) + +theorem chart_exists (point : PlanePoint) : ∃ chart : Fin 3, point.rep chart ≠ 0 := by + by_contra absent + apply point.rep_nonzero + funext chart + exact Classical.not_not.mp (fun nonzero => absent ⟨chart, nonzero⟩) + +end Nagata.ProjectiveGeometry + +namespace Nagata.Workers.W30 + +open UniqueFactorizationMonoid + +abbrev TernaryPolynomial := MvPolynomial (Fin 3) ℂ + +local instance : DecidableEq (Associates TernaryPolynomial) := Classical.decEq _ + +def equationMultiplicity (polynomial : TernaryPolynomial) : + Associates TernaryPolynomial →₀ ℕ := + factorization (Associates.mk polynomial) + +def associatePrincipalIdeal (associate : Associates TernaryPolynomial) : + Ideal TernaryPolynomial := + (Ideal.associatesEquivIsPrincipal TernaryPolynomial associate).val + +def equationIdealCycle (polynomial : TernaryPolynomial) : Ideal TernaryPolynomial →₀ ℕ := + (equationMultiplicity polynomial).mapDomain associatePrincipalIdeal + +attribute [local instance] MvPolynomial.gradedAlgebra + +theorem exists_positive_degree_equation_of_homogeneous_cycle + (cycle : Ideal TernaryPolynomial →₀ ℕ) (nonzero : cycle ≠ 0) + (homogeneous : ∀ ideal ∈ cycle.support, + ideal.IsPrime ∧ ideal ≠ ⊥ ∧ ideal.IsPrincipal ∧ + ideal.IsHomogeneous (MvPolynomial.homogeneousSubmodule (Fin 3) ℂ)) : + ∃ polynomial : TernaryPolynomial, + polynomial ≠ 0 ∧ polynomial.IsHomogeneous polynomial.totalDegree ∧ + 0 < polynomial.totalDegree ∧ equationIdealCycle polynomial = cycle := by + sorry + +end Nagata.Workers.W30 + +namespace Nagata.W16 + +abbrev PlanePolynomial := MvPolynomial (Fin 3) ℂ + +structure NonzeroHomogeneousForm (degree : ℕ) where + polynomial : PlanePolynomial + homogeneous : polynomial.IsHomogeneous degree + nonzero : polynomial ≠ 0 + +theorem homogeneous_eval_scale {Variables Coefficient : Type*} [CommSemiring Coefficient] + {polynomial : MvPolynomial Variables Coefficient} {degree : ℕ} + (homogeneous : polynomial.IsHomogeneous degree) + (coordinates : Variables → Coefficient) (scalar : Coefficient) : + MvPolynomial.eval (fun index => scalar * coordinates index) polynomial = + scalar ^ degree * MvPolynomial.eval coordinates polynomial := by + classical + simp only [MvPolynomial.eval_eq, Finset.mul_sum] + apply Finset.sum_congr rfl + intro exponent supported + simp only [mul_pow, Finset.prod_mul_distrib, Finset.prod_pow_eq_pow_sum] + rw [← homogeneous.degree_eq_sum_deg_support supported] + ac_rfl + +open Nagata.ProjectiveGeometry + +theorem eval_dehomogenize (chart : Fin 3) (polynomial : PlanePolynomial) + (coordinates : ChartVariables chart → ℂ) : + MvPolynomial.eval coordinates (dehomogenize chart polynomial) = + MvPolynomial.eval + (fun index => if equal : index = chart then 1 else coordinates ⟨index, equal⟩) + polynomial := by + classical + unfold dehomogenize + rw [← MvPolynomial.eval_assoc] + apply congrArg (fun values : Fin 3 → ℂ => MvPolynomial.eval values polynomial) + funext index + by_cases equal : index = chart <;> simp [equal, Function.comp_apply] + +theorem eval_dehomogenize_normalized {degree : ℕ} {polynomial : PlanePolynomial} + (homogeneous : polynomial.IsHomogeneous degree) (chart : Fin 3) + (coordinates : Fin 3 → ℂ) (chart_nonzero : coordinates chart ≠ 0) : + MvPolynomial.eval (fun index : ChartVariables chart => coordinates index.val / coordinates chart) + (dehomogenize chart polynomial) = + (coordinates chart)⁻¹ ^ degree * MvPolynomial.eval coordinates polynomial := by + classical + rw [eval_dehomogenize] + have normalized : + (fun index : Fin 3 => if equal : index = chart then (1 : ℂ) + else coordinates index / coordinates chart) = + fun index => (coordinates chart)⁻¹ * coordinates index := by + funext index + by_cases equal : index = chart + · subst index + simp [chart_nonzero] + · simp [equal, div_eq_mul_inv, mul_comm] + rw [normalized] + exact homogeneous_eval_scale homogeneous coordinates (coordinates chart)⁻¹ + +theorem eval_eq_zero_of_dehomogenize_eq_zero {degree : ℕ} {polynomial : PlanePolynomial} + (homogeneous : polynomial.IsHomogeneous degree) (chart : Fin 3) + (chart_zero : dehomogenize chart polynomial = 0) + (coordinates : Fin 3 → ℂ) (chart_nonzero : coordinates chart ≠ 0) : + MvPolynomial.eval coordinates polynomial = 0 := by + have evaluated := congrArg + (MvPolynomial.eval (fun index : ChartVariables chart => coordinates index.val / coordinates chart)) + chart_zero + rw [eval_dehomogenize_normalized homogeneous chart coordinates chart_nonzero, map_zero] at evaluated + exact (mul_eq_zero.mp evaluated).resolve_left (pow_ne_zero degree (inv_ne_zero chart_nonzero)) + +theorem eq_zero_of_dehomogenize_eq_zero {degree : ℕ} {polynomial : PlanePolynomial} + (homogeneous : polynomial.IsHomogeneous degree) (chart : Fin 3) + (chart_zero : dehomogenize chart polynomial = 0) : polynomial = 0 := by + have multiplied : MvPolynomial.X chart * polynomial = 0 := by + apply ((MvPolynomial.isHomogeneous_X ℂ chart).mul homogeneous).eq_zero_of_forall_eval_eq_zero + intro coordinates + rw [MvPolynomial.eval_mul, MvPolynomial.eval_X] + by_cases chart_nonzero : coordinates chart = 0 + · simp [chart_nonzero] + · rw [eval_eq_zero_of_dehomogenize_eq_zero homogeneous chart chart_zero coordinates chart_nonzero, + mul_zero] + exact (mul_eq_zero.mp multiplied).resolve_left (MvPolynomial.X_ne_zero chart) + +theorem dehomogenize_ne_zero {degree : ℕ} {polynomial : PlanePolynomial} + (homogeneous : polynomial.IsHomogeneous degree) (nonzero : polynomial ≠ 0) + (chart : Fin 3) : ProjectiveGeometry.dehomogenize chart polynomial ≠ 0 := by + intro chart_zero + exact nonzero (eq_zero_of_dehomogenize_eq_zero homogeneous chart chart_zero) + +end Nagata.W16 + +namespace Nagata.Workers.W10 + +open Nagata.Workers.W30 Nagata.W16 + +attribute [local instance] MvPolynomial.gradedAlgebra + +/-- Nonzero finite cycles of homogeneous prime plane ideals, with natural weights. -/ +def EffectivePlaneCurve := {cycle : Ideal TernaryPolynomial →₀ ℕ // + cycle ≠ 0 ∧ ∀ ideal ∈ cycle.support, + ideal.IsPrime ∧ ideal ≠ ⊥ ∧ ideal.IsPrincipal ∧ + ideal.IsHomogeneous (MvPolynomial.homogeneousSubmodule (Fin 3) ℂ)} + +/-- An equation realizing the entire cycle, including repeated components. -/ +def curveEquation (curve : EffectivePlaneCurve) : TernaryPolynomial := + Classical.choose (exists_positive_degree_equation_of_homogeneous_cycle + curve.val curve.property.1 curve.property.2) + +theorem curveEquation_spec (curve : EffectivePlaneCurve) : + curveEquation curve ≠ 0 ∧ + (curveEquation curve).IsHomogeneous (curveEquation curve).totalDegree ∧ + 0 < (curveEquation curve).totalDegree ∧ equationIdealCycle (curveEquation curve) = curve.val := + Classical.choose_spec (exists_positive_degree_equation_of_homogeneous_cycle + curve.val curve.property.1 curve.property.2) + +theorem curveEquation_nonzero (curve : EffectivePlaneCurve) : curveEquation curve ≠ 0 := + (curveEquation_spec curve).1 + +def curveDegree (curve : EffectivePlaneCurve) : ℕ := (curveEquation curve).totalDegree + +theorem curveEquation_homogeneous (curve : EffectivePlaneCurve) : + (curveEquation curve).IsHomogeneous (curveDegree curve) := + (curveEquation_spec curve).2.1 + +def curveForm (curve : EffectivePlaneCurve) : NonzeroHomogeneousForm (curveDegree curve) := + ⟨curveEquation curve, curveEquation_homogeneous curve, curveEquation_nonzero curve⟩ + +end Nagata.Workers.W10 + +namespace Nagata.ProjectiveGeometry + +def formOrdinaryMultiplicity {degree : ℕ} (form : W16.NonzeroHomogeneousForm degree) + (point : PlanePoint) : ℕ := + let chart := Classical.choose (chart_exists point) + AffineMultiplicity.ordinaryMultiplicity (chartCoordinates chart point) + (dehomogenize chart form.polynomial) + (W16.dehomogenize_ne_zero form.homogeneous form.nonzero chart) + +end Nagata.ProjectiveGeometry + +namespace Nagata.W15 + +open Nagata.Workers.W10 Nagata.ProjectiveGeometry + +def curveOrdinaryMultiplicity (curve : EffectivePlaneCurve) (point : PlanePoint) : ℕ := + formOrdinaryMultiplicity (curveForm curve) point + +end Nagata.W15 + +namespace Nagata + +open ProjectiveGeometry + +def FullNagata : Prop := + ∀ count : ℕ, 10 ≤ count → + ∃ exceptional : ℕ → Set (OrderedDistinctPoints count), + (∀ index, IsConfigurationZariskiClosed (exceptional index) ∧ + exceptional index ≠ Set.univ) ∧ + (∃ points : OrderedDistinctPoints count, ∀ index, points ∉ exceptional index) ∧ + ∀ points : OrderedDistinctPoints count, (∀ index, points ∉ exceptional index) → + ∀ degree : ℕ, 1 ≤ degree → + ∀ polynomial : MvPolynomial (Fin 3) ℂ, + polynomial ≠ 0 → polynomial.IsHomogeneous degree → + ∀ multiplicities : Fin count → ℕ, + (∀ index, multiplicityAtLeast polynomial (points.val index) (multiplicities index)) → + (∑ index, (multiplicities index : ℝ)) < (degree : ℝ) * Real.sqrt (count : ℝ) + +theorem nagata_conjecture : + ∀ count : ℕ, 10 ≤ count → + ∃ exceptional : ℕ → Set (OrderedDistinctPoints count), + (∀ index, IsConfigurationZariskiClosed (exceptional index) ∧ + exceptional index ≠ Set.univ) ∧ + (∃ points : OrderedDistinctPoints count, ∀ index, points ∉ exceptional index) ∧ + ∀ points : OrderedDistinctPoints count, (∀ index, points ∉ exceptional index) → + ∀ curve : Workers.W10.EffectivePlaneCurve, ∀ multiplicities : Fin count → ℕ, + (∀ index, multiplicities index ≤ W15.curveOrdinaryMultiplicity curve (points.val index)) → + (∑ index, (multiplicities index : ℝ)) < + (Workers.W10.curveDegree curve : ℝ) * Real.sqrt (count : ℝ) := by + sorry + +theorem nagata_conjecture_coordinates : FullNagata := by + sorry + +end Nagata + +end + +end OAI diff --git a/lean/ComparatorChallenges/Naimark.json b/lean/ComparatorChallenges/Naimark.json new file mode 100644 index 0000000000000000000000000000000000000000..eece821a90af81f467ffe5d6f9c53d709fb20696 --- /dev/null +++ b/lean/ComparatorChallenges/Naimark.json @@ -0,0 +1,22 @@ +{ + "challenge_module": "ComparatorChallenges.Naimark", + "solution_module": "OAI.Analysis.Naimark.Tracial", + "theorem_names": [ + "OAI.NaimarkZFC.main" + ], + "definition_names": [ + "OAI.NaimarkZFC.IsSimpleCStar", + "OAI.NaimarkZFC.IsState", + "OAI.NaimarkZFC.IsFaithfulTracialState", + "OAI.NaimarkZFC.IsIrreducible", + "OAI.NaimarkZFC.UnitarilyEquivalent", + "OAI.NaimarkZFC.HasUniqueIrreducibleRepresentation", + "OAI.NaimarkZFC.IsIsomorphicToCompacts" + ], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/Naimark.lean b/lean/ComparatorChallenges/Naimark.lean new file mode 100644 index 0000000000000000000000000000000000000000..702192c1f36cc75b8ca889b3d93c4a3b26a30f86 --- /dev/null +++ b/lean/ComparatorChallenges/Naimark.lean @@ -0,0 +1,57 @@ +import Mathlib + +namespace OAI + +noncomputable section + +universe u v w + +namespace NaimarkZFC + +def IsSimpleCStar (A : Type u) [CStarAlgebra A] : Prop := + Nontrivial A ∧ ∀ I : TwoSidedIdeal A, IsClosed (I : Set A) → I = ⊥ ∨ I = ⊤ + +def IsState {A : Type u} [CStarAlgebra A] (f : A →L[ℂ] ℂ) : Prop := + ‖f‖ = 1 ∧ ∀ a : A, (f (star a * a)).im = 0 ∧ 0 ≤ (f (star a * a)).re + +def IsFaithfulTracialState {A : Type u} [CStarAlgebra A] (f : A →L[ℂ] ℂ) : Prop := + IsState f ∧ (∀ a b : A, f (a * b) = f (b * a)) ∧ + ∀ a : A, a ≠ 0 → 0 < (f (star a * a)).re + +def IsIrreducible {A : Type u} [CStarAlgebra A] + {H : Type v} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + (π : A →⋆ₙₐ[ℂ] (H →L[ℂ] H)) : Prop := + π ≠ 0 ∧ ∀ M : Submodule ℂ H, IsClosed (M : Set H) → + (∀ a : A, ∀ x ∈ M, π a x ∈ M) → M = ⊥ ∨ M = ⊤ + +def UnitarilyEquivalent {A : Type u} [CStarAlgebra A] + {H : Type v} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + {K : Type w} [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K] + (π : A →⋆ₙₐ[ℂ] (H →L[ℂ] H)) (ρ : A →⋆ₙₐ[ℂ] (K →L[ℂ] K)) : Prop := + ∃ U : H ≃ₗᵢ[ℂ] K, ∀ a : A, ∀ x : H, U (π a x) = ρ a (U x) + +def HasUniqueIrreducibleRepresentation (A : Type u) [CStarAlgebra A] : Prop := + ∀ (H : Type v) [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] + (K : Type w) [NormedAddCommGroup K] [InnerProductSpace ℂ K] [CompleteSpace K] + (π : A →⋆ₙₐ[ℂ] (H →L[ℂ] H)) (ρ : A →⋆ₙₐ[ℂ] (K →L[ℂ] K)), + IsIrreducible π → IsIrreducible ρ → UnitarilyEquivalent π ρ + +def IsIsomorphicToCompacts (A : Type u) [CStarAlgebra A] + (H : Type v) [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H] : Prop := + ∃ φ : A →⋆ₙₐ[ℂ] (H →L[ℂ] H), Function.Injective φ ∧ + ∀ T : H →L[ℂ] H, (∃ a : A, φ a = T) ↔ IsCompactOperator T + +theorem main : + ∃ (A : Type u) (_ : CStarAlgebra A), + IsSimpleCStar A ∧ ¬ FiniteDimensional ℂ A ∧ + (∃ τ : A →L[ℂ] ℂ, IsFaithfulTracialState τ) ∧ + HasUniqueIrreducibleRepresentation.{u, v, w} A ∧ + ∀ (H : Type v) [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H], + ¬ IsIsomorphicToCompacts A H := by + sorry + +end NaimarkZFC + +end + +end OAI diff --git a/lean/ComparatorChallenges/NavierStokesAlternating.json b/lean/ComparatorChallenges/NavierStokesAlternating.json new file mode 100644 index 0000000000000000000000000000000000000000..0e72bc176e287e454e0d9b50ab529348c0bd95b0 --- /dev/null +++ b/lean/ComparatorChallenges/NavierStokesAlternating.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.NavierStokesAlternating", + "solution_module": "OAI.MathematicalPhysics.AlternatingFlow.Development", + "theorem_names": [ + "OAI.AlternatingNS.alternating" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/NavierStokesAlternating.lean b/lean/ComparatorChallenges/NavierStokesAlternating.lean new file mode 100644 index 0000000000000000000000000000000000000000..0260ba9ba848f8a8b9869a46cf99242b4e9f7232 --- /dev/null +++ b/lean/ComparatorChallenges/NavierStokesAlternating.lean @@ -0,0 +1,245 @@ +import Mathlib + +namespace OAI + +open scoped BigOperators ENNReal Topology ContDiff +open MeasureTheory + +namespace AlternatingNS + +abbrev Rule := ℕ × ℕ × Fin 3 + +abbrev Machine := ℕ × ℕ × ℕ × List ℕ × List (Option Rule) + +namespace Machine + +def states (M : Machine) : ℕ := M.1 + 1 + +def alphabet (M : Machine) : ℕ := M.2.1 + 1 + +def initialState (M : Machine) : ℕ := M.2.2.1 + +def haltingStates (M : Machine) : List ℕ := M.2.2.2.1 + +def table (M : Machine) : List (Option Rule) := M.2.2.2.2 + +def instruction (M : Machine) (q a : ℕ) : Option Rule := + (M.table[q * M.alphabet + a]?).join + +def WellFormed (M : Machine) : Prop := + M.initialState < M.states ∧ + (∀ q ∈ M.haltingStates, q < M.states) ∧ + ∀ q a r, q < M.states → a < M.alphabet → M.instruction q a = some r → + r.1 < M.states ∧ r.2.1 < M.alphabet + +def ValidInput (M : Machine) (w : List ℕ) : Prop := + ∀ a ∈ w, a < M.alphabet + +structure Configuration where + state : ℕ + head : ℤ + tape : ℤ → ℕ + +def isHalting (M : Machine) (c : Configuration) : Bool := + decide (c.state = M.states ∨ c.state ∈ M.haltingStates) + +def initial (M : Machine) (w : List ℕ) : Configuration where + state := M.initialState + head := 0 + tape := fun i => if 0 ≤ i then w[i.toNat]?.getD 0 else 0 + +def step (M : Machine) (c : Configuration) : Configuration := + if M.isHalting c then c else + match M.instruction c.state (c.tape c.head) with + | none => { c with state := M.states } + | some r => + { state := r.1 + head := c.head + ((r.2.2.val : ℤ) - 1) + tape := Function.update c.tape c.head r.2.1 } + +def run (M : Machine) (w : List ℕ) (n : ℕ) : Configuration := + (M.step)^[n] (M.initial w) + +def Halts (M : Machine) (w : List ℕ) : Prop := + ∃ n : ℕ, M.isHalting (M.run w n) = true + +end Machine + +abbrev Space := EuclideanSpace ℝ (Fin 3) +abbrev Field (E : Type*) := ℝ → Space → E +abbrev Velocity := Field Space +abbrev Pressure := Field ℝ +abbrev MultiIndex := Fin 3 → ℕ + +noncomputable section + +def e (i : Fin 3) : Space := EuclideanSpace.single i 1 + +def dx {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + (i : Fin 3) (F : Field E) : Field E := + fun t x => fderiv ℝ (F t) x (e i) + +def dt {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + (F : Field E) : Field E := + fun t x => fderivWithin ℝ (fun s => F s x) (Set.Ici 0) t 1 + +def spatial {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + (α : MultiIndex) (F : Field E) : Field E := + (dx 0)^[α 0] ((dx 1)^[α 1] ((dx 2)^[α 2] F)) + +def mixed {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + (l : ℕ) (α : MultiIndex) (F : Field E) : Field E := + dt^[l] (spatial α F) + +def div (u : Velocity) (t : ℝ) (x : Space) : ℝ := + ∑ i : Fin 3, dx i u t x i + +def grad (p : Pressure) (t : ℝ) (x : Space) : Space := + (EuclideanSpace.equiv (Fin 3) ℝ).symm (fun i => dx i p t x) + +def laplacian (u : Velocity) (t : ℝ) (x : Space) : Space := + ∑ i : Fin 3, dx i (dx i u) t x + +def advection (u : Velocity) (t : ℝ) (x : Space) : Space := + fderiv ℝ (u t) x (u t x) + +def residual (ν : ℝ) (u : Velocity) : Velocity := + fun t x => dt u t x + advection u t x - ν • laplacian u t x + +def timeCylinder (T : ℝ) : Set (ℝ × Space) := Set.Icc 0 T ×ˢ Set.univ + +def Smooth {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + (F : Field E) : Prop := + ContDiffOn ℝ (∞) (Function.uncurry F) (Set.Ici 0 ×ˢ Set.univ) + +def ClassicalRegularity (u : Velocity) (p : Pressure) : Prop := + (∀ x, DifferentiableOn ℝ (fun t => u t x) (Set.Ici 0)) ∧ + (∀ t, 0 ≤ t → Differentiable ℝ (u t)) ∧ + (∀ t, 0 ≤ t → ∀ i, Differentiable ℝ (dx i u t)) ∧ + (∀ t, 0 ≤ t → Differentiable ℝ (p t)) ∧ + ∀ T, 0 ≤ T → + ContinuousOn (Function.uncurry u) (timeCylinder T) ∧ + ContinuousOn (Function.uncurry (dt u)) (timeCylinder T) ∧ + (∀ i, ContinuousOn (Function.uncurry (dx i u)) (timeCylinder T)) ∧ + (∀ i j, ContinuousOn (Function.uncurry (dx i (dx j u))) (timeCylinder T)) ∧ + ContinuousOn (Function.uncurry p) (timeCylinder T) ∧ + (∀ i, ContinuousOn (Function.uncurry (dx i p)) (timeCylinder T)) + +def ContinuousInH {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + (k : ℕ) (F : Field E) (T : ℝ) : Prop := + ∀ α : MultiIndex, (∑ i, α i) ≤ k → + ∃ g : ℝ → Lp E 2 (volume : Measure Space), + ContinuousOn g (Set.Icc 0 T) ∧ + ∀ t ∈ Set.Icc 0 T, + ∀ᵐ x ∂(volume : Measure Space), (g t) x = spatial α F t x + +def C1InL2 (u : Velocity) (T : ℝ) : Prop := + ∃ g g' : ℝ → Lp Space 2 (volume : Measure Space), + ContinuousOn g (Set.Icc 0 T) ∧ + ContinuousOn g' (Set.Icc 0 T) ∧ + (∀ t ∈ Set.Icc 0 T, HasDerivWithinAt g (g' t) (Set.Icc 0 T) t) ∧ + (∀ t ∈ Set.Icc 0 T, ∀ᵐ x ∂(volume : Measure Space), (g t) x = u t x) ∧ + (∀ t ∈ Set.Icc 0 T, ∀ᵐ x ∂(volume : Measure Space), (g' t) x = dt u t x) + +def CompetitorEnergyClass (u : Velocity) (p : Pressure) : Prop := + ∀ T, 0 ≤ T → + ContinuousInH 2 u T ∧ C1InL2 u T ∧ ContinuousInH 1 p T ∧ + ∃ C : ℝ, ∀ t ∈ Set.Icc 0 T, ∀ x, ‖u t x‖ ≤ C + +def EnergyClass (u : Velocity) (p : Pressure) : Prop := + CompetitorEnergyClass u p ∧ + ∀ T, 0 ≤ T → ∃ C : ℝ, ∀ t ∈ Set.Icc 0 T, ∀ x, + ‖u t x‖ + ‖fderiv ℝ (u t) x‖ ≤ C + +def NavierStokes (ν : ℝ) (f u : Velocity) (p : Pressure) : Prop := + ClassicalRegularity u p ∧ + (∀ x, u 0 x = 0) ∧ + ∀ t, 0 ≤ t → ∀ x, + div u t x = 0 ∧ + dt u t x + advection u t x = -grad p t x + ν • laplacian u t x + f t x + +def Rapid (F : Velocity) : Prop := + ∀ J l : ℕ, ∀ α : MultiIndex, ∃ C : ℝ, 0 ≤ C ∧ + ∀ t, 0 ≤ t → ∀ x, + (1 + t + ‖x‖) ^ J * ‖mixed l α F t x‖ ≤ C + +def SupportedIn (F : Velocity) (K : Set Space) : Prop := + ∀ t, 0 ≤ t → Function.support (F t) ⊆ K + +def IsTrajectory (u : Velocity) (a : Space) (γ : ℝ → Space) : Prop := + γ 0 = a ∧ ∀ t, 0 ≤ t → HasDerivWithinAt γ (u t (γ t)) (Set.Ici 0) t + +def observedParticle : Space := (EuclideanSpace.equiv (Fin 3) ℝ).symm ![-1, 0, 0] + +abbrev RationalPoint := ℚ × ℚ × ℚ × ℚ +abbrev RationalVector := ℚ × ℚ × ℚ +abbrev IndexCode := ℕ × ℕ × ℕ +abbrev Program := Nat.Partrec.Code +abbrev FieldProgram := Program × Program × Program + +def Returns {A B : Type*} [Encodable A] [Encodable B] + (c : Program) (a : A) (b : B) : Prop := + Encodable.encode b ∈ c.eval (Encodable.encode a) + +def index (α : IndexCode) : MultiIndex := ![α.1, α.2.1, α.2.2] + +def rationalVector (q : RationalVector) : Space := + (EuclideanSpace.equiv (Fin 3) ℝ).symm ![(q.1 : ℝ), (q.2.1 : ℝ), (q.2.2 : ℝ)] + +def rationalPoint (q : RationalPoint) : ℝ × Space := + ((q.1 : ℝ), rationalVector q.2) + +def dyadicError (n : ℕ) : ℝ := (1 / 2 : ℝ) ^ n + +def ComputableReal (r : ℝ) : Prop := + ∃ a : ℕ → ℚ, Computable (fun n => ((a n).num, (a n).den)) ∧ + ∀ n, |r - (a n : ℝ)| ≤ dyadicError n + +def ProgramFor (c : FieldProgram) (F : Velocity) : Prop := + (∀ (l : ℕ) (α : IndexCode) (q : RationalPoint) (k : ℕ), + ∃ v : RationalVector, Returns c.1 (l, α, q, k) v ∧ + (0 ≤ q.1 → + ‖rationalVector v - mixed l (index α) F (rationalPoint q).1 (rationalPoint q).2‖ + ≤ dyadicError k)) ∧ + (∀ (l : ℕ) (α : IndexCode) (R k : ℕ), + ∃ m : ℕ, Returns c.2.1 (l, α, R, k) m ∧ + ∀ z z' : ℝ × Space, + 0 ≤ z.1 → 0 ≤ z'.1 → ‖z‖ ≤ R → ‖z'‖ ≤ R → + ‖z - z'‖ ≤ dyadicError m → + ‖mixed l (index α) F z.1 z.2 - mixed l (index α) F z'.1 z'.2‖ ≤ dyadicError k) ∧ + (∀ (J l : ℕ) (α : IndexCode), + ∃ B : ℕ, Returns c.2.2 (J, l, α) B ∧ + ∀ t, 0 ≤ t → ∀ x, + (1 + t + ‖x‖) ^ J * ‖mixed l (index α) F t x‖ ≤ B) + +def AlternatingConclusion (ν : ℝ) : Prop := + ∃ (compileForce compileVelocity : Machine × List ℕ → FieldProgram), + Computable compileForce ∧ Computable compileVelocity ∧ + ∃ K : Set Space, IsCompact K ∧ + ∀ (M : Machine) (w : List ℕ), M.WellFormed → M.ValidInput w → + ∃ (f U : Velocity) (X : Space → ℝ → Space), + ProgramFor (compileForce (M, w)) f ∧ + ProgramFor (compileVelocity (M, w)) U ∧ + Smooth f ∧ Smooth U ∧ + SupportedIn f K ∧ SupportedIn U K ∧ Rapid f ∧ Rapid U ∧ + f = residual ν U ∧ + NavierStokes ν f U (fun _ _ => 0) ∧ EnergyClass U (fun _ _ => 0) ∧ + (∀ (v : Velocity) (p : Pressure), + NavierStokes ν f v p → CompetitorEnergyClass v p → + ∀ t, 0 ≤ t → ∀ x, v t x = U t x ∧ p t x = 0) ∧ + (∀ a, IsTrajectory U a (X a)) ∧ + (∀ a γ, IsTrajectory U a γ → ∀ t, 0 ≤ t → γ t = X a t) ∧ + ((∃ t : ℝ, 0 ≤ t ∧ 0 < X observedParticle t 0) ↔ M.Halts w) + +end +end AlternatingNS + +namespace AlternatingNS + +theorem alternating (ν : ℝ) (hν : 0 < ν) (hc : ComputableReal ν) : + AlternatingConclusion ν := by + sorry + +end AlternatingNS + +end OAI diff --git a/lean/ComparatorChallenges/NavierStokesVelocity.json b/lean/ComparatorChallenges/NavierStokesVelocity.json new file mode 100644 index 0000000000000000000000000000000000000000..cf70e7845fceba83b2c74bee7821eb0f382da8b4 --- /dev/null +++ b/lean/ComparatorChallenges/NavierStokesVelocity.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.NavierStokesVelocity", + "solution_module": "OAI.MathematicalPhysics.NavierStokes.VelocityDetection.Main", + "theorem_names": [ + "OAI.VelocityDetection.main_result" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/NavierStokesVelocity.lean b/lean/ComparatorChallenges/NavierStokesVelocity.lean new file mode 100644 index 0000000000000000000000000000000000000000..72e7fd1e6d366ce7c4bc36014127cafc184c3a9b --- /dev/null +++ b/lean/ComparatorChallenges/NavierStokesVelocity.lean @@ -0,0 +1,1275 @@ +import Mathlib + +namespace OAI + +noncomputable section +namespace VelocityDetection +open scoped BigOperators Topology ContDiff +open Set Function Filter + +abbrev Coord (n : ℕ) := Fin n → ℝ + +abbrev ScalarField (n : ℕ) := ℝ → Coord n → ℝ + +abbrev VectorField (n : ℕ) := ℝ → Coord n → Coord n + +theorem neZeroTwo : NeZero 2 := ⟨Nat.succ_ne_zero 1⟩ + +theorem neZeroThree : NeZero 3 := ⟨Nat.succ_ne_zero 2⟩ + +theorem neZeroFive : NeZero 5 := ⟨Nat.succ_ne_zero 4⟩ + +def spatialD {n : ℕ} (i : Fin n) (q : ScalarField n) : ScalarField n := + fun t x => deriv (fun s => q t (Function.update x i s)) (x i) + +def timeD {n : ℕ} (q : ScalarField n) : ScalarField n := + fun t x => derivWithin (fun s => q s x) (Ici 0) t + +def laplacian {n : ℕ} (q : ScalarField n) : ScalarField n := + fun t x => ∑ i : Fin n, spatialD i (spatialD i q) t x + +def advection {n : ℕ} (a : VectorField n) (q : ScalarField n) : ScalarField n := + fun t x => ∑ i : Fin n, a t x i * spatialD i q t x + +def divergence {n : ℕ} (a : VectorField n) : ScalarField n := + fun t x => ∑ i : Fin n, spatialD i (fun s y => a s y i) t x + +def NavierStokes (ν : ℝ) (u : VectorField 3) (p : ScalarField 3) + (f : VectorField 3) : Prop := + (∀ (t : ℝ), 0 ≤ t → ∀ x : Coord 3, ∀ i : Fin 3, + timeD (fun s y => u s y i) t x + advection u (fun s y => u s y i) t x = + -spatialD i p t x + ν * laplacian (fun s y => u s y i) t x + f t x i) ∧ + (∀ (t : ℝ), 0 ≤ t → ∀ x, divergence u t x = 0) ∧ + (∀ x, u 0 x = 0) + +def horizontal (x : Coord 3) : Coord 2 := ![x 0, x 1] + +end VelocityDetection +end + +noncomputable section +namespace VelocityDetection.Stacks +open scoped BigOperators Topology ContDiff +open Set Function Filter + +inductive Move + | right + | stay + | left + deriving DecidableEq, Repr + +def update (b : ℕ) (m : Move) (β x y : ℕ) : ℕ × ℕ := + match m with + | .right => (b * x + β, y / b) + | .stay => (x, y - y % b + β) + | .left => (x / b, x % b + b * β + b ^ 2 * (y / b)) + +structure Rule (σ : Type*) (b : ℕ) where + target : σ + written : Fin b + move : Move + +structure Configuration (σ : Type*) where + state : σ + leftStack : ℕ + rightStack : ℕ + deriving DecidableEq + +def applyRule {σ : Type*} {b : ℕ} (r : Rule σ b) (c : Configuration σ) : Configuration σ := + let st := update b r.move r.written c.leftStack c.rightStack + ⟨r.target, st.1, st.2⟩ + +def address (B i x y : ℕ) : ℕ := 1 + x + B * y + B ^ 2 * i + +def capacity (b m n : ℕ) : ℕ := b ^ (m + n) + +end VelocityDetection.Stacks +end + +noncomputable section +namespace VelocityDetection.Expanding +open scoped BigOperators Topology ContDiff +open Set Function Filter + +def lambda (D : ℝ) : ℝ := 4 * D + +def initialRadius (ν K D : ℝ) : ℝ := + 1024 * 3000 * (1 + ν) * lambda D * (K * D + 2) + +def radius (ν K D : ℝ) (n : ℕ) : ℝ := initialRadius ν K D * lambda D ^ n + +end VelocityDetection.Expanding +end + +noncomputable section +namespace VelocityDetection.Observation +open scoped BigOperators Topology ContDiff +open Set Function Filter +open MeasureTheory + +def join (X : Coord 2) (z : ℝ) : Coord 3 := ![X 0, X 1, z] + +def torusEvent (u : VectorField 3) : Prop := + letI := neZeroThree + ∃ t : ℝ, 0 ≤ t ∧ ∃ x : Coord 3, + 1 / ((32 : ℕ) : ℝ) < x 1 ∧ x 1 < 1 / ((8 : ℕ) : ℝ) ∧ (1 / ((2 : ℕ) : ℝ) : ℝ) < u t x 2 + +def upperHalfPlane : Set (Coord 2) := {X | 0 < X 1} + +def planeMass (u : VectorField 3) (t : ℝ) : ℝ := + letI := neZeroThree + ∫ q in upperHalfPlane ×ˢ Ioc (0 : ℝ) 1, + u t (join q.1 q.2) 2 ∂(volume.prod volume) + +def planeEvent (u : VectorField 3) : Prop := + ∃ t : ℝ, 0 ≤ t ∧ (1 / ((2 : ℕ) : ℝ) : ℝ) < planeMass u t + +end VelocityDetection.Observation +end + +noncomputable section +namespace VelocityDetection.SmoothProfiles +open scoped BigOperators Topology ContDiff +open Set Function Filter +open Set Function Filter MeasureTheory +open scoped Topology BigOperators ContDiff + +abbrev step := Real.smoothTransition + +end VelocityDetection.SmoothProfiles +end + +noncomputable section +namespace VelocityDetection.TranslationGates +open scoped BigOperators Topology ContDiff +open Set Function Filter +open Set Function Filter MeasureTheory +open scoped Topology BigOperators ContDiff +open SmoothProfiles + +def window (s : ℝ) : ℝ := step (s + 3) * step (3 - s) + +end VelocityDetection.TranslationGates +end + +noncomputable section +namespace VelocityDetection.CenterPaths +open scoped BigOperators Topology ContDiff +open Set Function Filter +open Set Function Filter MeasureTheory +open scoped Topology BigOperators ContDiff +open scoped Topology ContDiff BigOperators +open SmoothProfiles + +def ramp (r : ℝ) : ℝ := step (2 * r - 1 / 2) + +def theta (a T : ℝ) (j : ℕ) (t : ℝ) : ℝ := ramp (3 * (t - a) / T - j) + +def privateRow (S : ℝ) (k : ℕ) : ℝ := -((k : ℝ) + 2) * S + +def center (a T S S' σ : ℝ) (k l : ℕ) (t : ℝ) : Coord 2 := + ![(1 - theta a T 1 t) * S * k + theta a T 1 t * S' * l, + -(1 - theta a T 0 t) * S + + (theta a T 0 t - theta a T 2 t) * privateRow S k + theta a T 2 t * σ * S'] + +end VelocityDetection.CenterPaths +end + +noncomputable section +namespace VelocityDetection.UniformDerivatives +open scoped BigOperators Topology ContDiff +open Set Function Filter +open Set Function Filter MeasureTheory +open scoped Topology BigOperators ContDiff +open scoped Topology ContDiff BigOperators +variable {I E F G : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] + [NormedAddCommGroup F] [NormedSpace ℝ F] [NormedAddCommGroup G] [NormedSpace ℝ G] + +def Bounded (f : I → E → F) : Prop := + ∀ n : ℕ, ∃ C : ℝ, 0 ≤ C ∧ ∀ a x, ‖iteratedFDeriv ℝ n (f a) x‖ ≤ C + +end VelocityDetection.UniformDerivatives +end + +noncomputable section +namespace VelocityDetection.Stacks +open scoped BigOperators Topology ContDiff +open Set Function Filter +open Set Function Filter MeasureTheory +open scoped Topology BigOperators ContDiff +open scoped Topology ContDiff BigOperators +variable {N b : ℕ} (hb : 0 < b) (table : Fin N → Fin b → Option (Rule (Fin N) b)) + +def lookup (c : Configuration (Fin N)) : Option (Rule (Fin N) b) := + table c.state ⟨c.rightStack % b, Nat.mod_lt _ hb⟩ + +end VelocityDetection.Stacks +end + +noncomputable section +namespace VelocityDetection.TailSpace +open scoped BigOperators Topology ContDiff +open Set Function Filter +open Set Function Filter MeasureTheory +open scoped Topology BigOperators ContDiff +open scoped Topology ContDiff BigOperators +open scoped Topology ContDiff ZeroAtInfty + +def compatible (n : ℕ) : Submodule ℝ + (C₀(Coord n, ℝ) × Lp ℝ 1 (volume : Measure (Coord n))) where + carrier := {v | (fun X => v.2 X) =ᵐ[volume] (fun X => v.1 X)} + zero_mem' := by exact Lp.coeFn_zero .. + add_mem' := by + intro v w hv hw + change (fun X => (v.2 + w.2) X) =ᵐ[volume] (fun X => v.1 X + w.1 X) + change (fun X => v.2 X) =ᵐ[volume] (fun X => v.1 X) at hv + change (fun X => w.2 X) =ᵐ[volume] (fun X => w.1 X) at hw + filter_upwards [Lp.coeFn_add v.2 w.2, hv, hw] with X hadd hvx hwx + simpa [hvx, hwx] using hadd + smul_mem' := by + intro c v hv + change (fun X => (c • v.2) X) =ᵐ[volume] (fun X => c * v.1 X) + change (fun X => v.2 X) =ᵐ[volume] (fun X => v.1 X) at hv + filter_upwards [Lp.coeFn_smul c v.2, hv] with X hsmul hvx + simpa [hvx] using hsmul + +end VelocityDetection.TailSpace +end + +noncomputable section +namespace VelocityDetection.Cylinder +open scoped BigOperators Topology ContDiff +open Set Function Filter +open Set Function Filter MeasureTheory +open scoped Topology BigOperators ContDiff +open scoped Topology ContDiff BigOperators +open scoped Topology ContDiff ZeroAtInfty + +abbrev Space := Coord 2 × ℝ + +abbrev Vect := Fin 3 → ℝ + +def measure : Measure Space := volume.prod (volume.restrict (Ioc (0 : ℝ) 1)) + +def periodic (f : Space → ℝ) : Prop := ∀ X z, f (X, z + 1) = f (X, z) + +def frame (i : Fin 3) : Space := ![(![1, 0], 0), (![0, 1], 0), (0, 1)] i + +def D (i : Fin 3) (f : Space → ℝ) (x : Space) : ℝ := fderiv ℝ f x (frame i) + +structure SliceH2 (v : Space → Vect) : Prop where + smooth : ∀ i, ContDiff ℝ 2 (fun x => v x i) + per : ∀ i, periodic (fun x => v x i) + square_integrable : ∀ i, MemLp (fun x => v x i) 2 measure + derivative_square_integrable : ∀ i k, MemLp (D k (fun x => v x i)) 2 measure + second_square_integrable : ∀ i k l, MemLp (D l (D k (fun x => v x i))) 2 measure + +structure PressureH1 (q : Space → ℝ) : Prop where + smooth : ContDiff ℝ 1 q + per : periodic q + square_integrable : MemLp q 2 measure + derivative_square_integrable : ∀ k, MemLp (D k q) 2 measure + +theorem twoAtLeastTwo : Nat.AtLeastTwo 2 := ⟨Nat.le_refl 2⟩ + +abbrev LpSpace {α : Type*} [MeasurableSpace α] (E : Type*) [NormedAddCommGroup E] + (p : ENNReal) (μ : Measure α) : Type _ := Lp E p μ + +abbrev L2Space : Type := + letI := twoAtLeastTwo + LpSpace ℝ 2 measure + +def dt (u : ℝ → Space → Vect) (t : ℝ) (x : Space) (i : Fin 3) : ℝ := + derivWithin (fun s => u s x i) (Ici 0) t + +theorem spaceOuterMeasureClass : OuterMeasureClass (Measure Space) Space := + Measure.instOuterMeasureClass + +def continuousL2On (g : ℝ → Space → ℝ) (T : ℝ) : Prop := + letI : IsTopologicalAddGroup ℝ := instIsTopologicalAddGroupReal + letI := spaceOuterMeasureClass + ∃ G : ℝ → L2Space, ContinuousOn G (Icc 0 T) ∧ + ∀ t ∈ Icc 0 T, (fun x => G t x) =ᵐ[measure] g t + +def continuousH2On (u : ℝ → Space → Vect) (T : ℝ) : Prop := + (∀ t ∈ Icc 0 T, SliceH2 (u t)) ∧ + (∀ i, continuousL2On (fun t x => u t x i) T) ∧ + (∀ i k, continuousL2On (fun t => D k (fun x => u t x i)) T) ∧ + (∀ i k l, continuousL2On (fun t => D l (D k (fun x => u t x i))) T) + +def continuousH1On (p : ℝ → Space → ℝ) (T : ℝ) : Prop := + (∀ t ∈ Icc 0 T, PressureH1 (p t)) ∧ continuousL2On p T ∧ + (∀ i, continuousL2On (fun t => D i (p t)) T) + +def C1L2On (u : ℝ → Space → Vect) (T : ℝ) : Prop := + letI : IsTopologicalAddGroup ℝ := instIsTopologicalAddGroupReal + letI := spaceOuterMeasureClass + ∃ U dU : ℝ → Fin 3 → L2Space, + (∀ i, ContinuousOn (fun t => U t i) (Icc 0 T)) ∧ + (∀ i, ContinuousOn (fun t => dU t i) (Icc 0 T)) ∧ + (∀ t ∈ Icc 0 T, ∀ i, (fun x => U t i x) =ᵐ[measure] (fun x => u t x i)) ∧ + (∀ t ∈ Icc 0 T, ∀ i, (fun x => dU t i x) =ᵐ[measure] (fun x => dt u t x i)) ∧ + (∀ t ∈ Icc 0 T, ∀ i, + HasDerivWithinAt (fun s => U s i) (dU t i) (Icc 0 T) t) + +structure ComparisonClass (u : ℝ → Space → Vect) (p : ℝ → Space → ℝ) : Prop where + velocity_H2 : ∀ T > 0, continuousH2On u T + velocity_C1L2 : ∀ T > 0, C1L2On u T + pressure_H1 : ∀ T > 0, continuousH1On p T + time_derivative : ∀ t ≥ 0, ∀ x i, + HasDerivWithinAt (fun s => u s x i) (dt u t x i) (Ici 0) t + velocity_continuous : ∀ T > 0, ∀ i, + ContinuousOn (fun y : ℝ × Space => u y.1 y.2 i) (Icc 0 T ×ˢ univ) + time_continuous : ∀ T > 0, ∀ i, + ContinuousOn (fun y : ℝ × Space => dt u y.1 y.2 i) (Icc 0 T ×ˢ univ) + gradient_continuous : ∀ T > 0, ∀ i k, + ContinuousOn (fun y : ℝ × Space => D k (fun x => u y.1 x i) y.2) (Icc 0 T ×ˢ univ) + second_continuous : ∀ T > 0, ∀ i k l, + ContinuousOn (fun y : ℝ × Space => D l (D k (fun x => u y.1 x i)) y.2) (Icc 0 T ×ˢ univ) + pressure_continuous : ∀ T > 0, + ContinuousOn (fun y : ℝ × Space => p y.1 y.2) (Icc 0 T ×ˢ univ) + pressure_gradient_continuous : ∀ T > 0, ∀ i, + ContinuousOn (fun y : ℝ × Space => D i (p y.1) y.2) (Icc 0 T ×ˢ univ) + bounds : ∀ T > 0, ∃ B : ℝ, 0 ≤ B ∧ + (∀ t ∈ Icc 0 T, ∀ x i, |u t x i| ≤ B) ∧ + (∀ t ∈ Icc 0 T, ∀ x i k, |D k (fun y => u t y i) x| ≤ B) + +def join (x : Space) : Coord 3 := + letI := neZeroTwo + ![x.1 0, x.1 1, x.2] + +end VelocityDetection.Cylinder +end + +noncomputable section +namespace VelocityDetection.TailSpace +open scoped BigOperators Topology ContDiff +open Set Function Filter +open Set Function Filter MeasureTheory +open scoped Topology BigOperators ContDiff +open scoped Topology ContDiff BigOperators +open scoped Topology ContDiff ZeroAtInfty + +def evalLinear (X : Coord 2) : compatible 2 →ₗ[ℝ] ℝ where + toFun f := f.val.1 X + map_add' _ _ := rfl + map_smul' _ _ := rfl + +def eval (X : Coord 2) : compatible 2 →L[ℝ] ℝ where + toLinearMap := evalLinear X + cont := AddMonoidHomClass.continuous_of_bound (evalLinear X) 1 (fun f => by + change ‖f.val.1 X‖ ≤ 1 * ‖f.val‖ + rw [one_mul] + exact (BoundedContinuousFunction.norm_coe_le_norm f.val.1.toBCF X).trans (norm_fst_le f.val)) + +end VelocityDetection.TailSpace +end + +noncomputable section +namespace VelocityDetection.History +open scoped BigOperators Topology ContDiff +open Set Function Filter +open Set Function Filter MeasureTheory +open scoped Topology BigOperators ContDiff +open scoped Topology ContDiff BigOperators +open scoped Topology ContDiff ZeroAtInfty +open scoped Topology ContDiff ZeroAtInfty BigOperators +open scoped Topology +open Stacks + +structure Configuration (N : ℕ) where + tape : Stacks.Configuration (Fin N) + history : ℕ + deriving DecidableEq + +end VelocityDetection.History +end + +noncomputable section +namespace VelocityDetection.History +open scoped BigOperators Topology ContDiff +open Set Function Filter +open Set Function Filter MeasureTheory +open scoped Topology BigOperators ContDiff +open scoped Topology ContDiff BigOperators +open scoped Topology ContDiff ZeroAtInfty +open scoped Topology ContDiff ZeroAtInfty BigOperators +open scoped Topology +open Stacks +variable {N b : ℕ} (hb : 0 < b) + (table : Fin N → Fin b → Option (Rule (Fin N) b)) + +def radix (N b : ℕ) : ℕ := N * b + +def tag (c : Stacks.Configuration (Fin N)) : ℕ := b * c.state.val + c.rightStack % b + +include hb in + +def applyRule (r : Rule (Fin N) b) (c : Configuration N) : Configuration N := + ⟨Stacks.applyRule r c.tape, radix N b * c.history + tag (b := b) c.tape⟩ + +include hb in + +def packedState (c : Configuration N) : ℕ := N * c.history + c.tape.state.val + +def address (B : ℕ) (c : Configuration N) : ℕ := + Stacks.address B (packedState c) c.tape.leftStack c.tape.rightStack + +abbrev Box (N B H : ℕ) := Fin N × Fin B × Fin B × Fin H + +def config {B H : ℕ} (c : Box N B H) : Configuration N := + ⟨⟨c.1, c.2.1, c.2.2.1⟩, c.2.2.2⟩ + +def Active (B H : ℕ) := {c : Box N B H // (Stacks.lookup hb table (config c).tape).isSome} + +def rule {B H : ℕ} (c : Active hb table B H) : Rule (Fin N) b := + (Stacks.lookup hb table (config c.val).tape).get c.property + +def target {B H : ℕ} (c : Active hb table B H) : Configuration N := + applyRule (rule hb table c) (config c.val) + +def sourceAddress {B H : ℕ} (c : Active hb table B H) : ℕ := address B (config c.val) + +def targetAddress {B H : ℕ} (c : Active hb table B H) : ℕ := address (b * B) (target hb table c) + +end VelocityDetection.History +end + +noncomputable section +namespace VelocityDetection.TapeCodes +open scoped BigOperators Topology ContDiff +open Set Function Filter +open Set Function Filter MeasureTheory +open scoped Topology BigOperators ContDiff +open scoped Topology ContDiff BigOperators +open scoped Topology ContDiff ZeroAtInfty +open scoped Topology ContDiff ZeroAtInfty BigOperators +open scoped Topology +open Turing Stacks +variable {b N : ℕ} [NeZero b] [NeZero N] + +def word (w : List (Fin b)) : ℕ := Nat.ofDigits b (w.map Fin.val) + +def half (w : ListBlank (Fin b)) : ℕ := + w.liftOn word (by sorry) + +def tape (q : Fin N) (T : Tape (Fin b)) : Stacks.Configuration (Fin N) := + ⟨q, half T.left, half T.right₀⟩ + +def rule (a : Fin b) (q : Fin N) : TM0.Stmt (Fin b) → Rule (Fin N) b + | .move .left => ⟨q, a, .left⟩ + | .move .right => ⟨q, a, .right⟩ + | .write β => ⟨q, β, .stay⟩ + +def table (M : TM0.Machine (Fin b) (Fin N)) : Fin N → Fin b → Option (Rule (Fin N) b) := + fun q a => (M q a).map (fun p => rule a p.1 p.2) + +end VelocityDetection.TapeCodes +end + +noncomputable section +namespace VelocityDetection.Prelude +open scoped BigOperators Topology ContDiff +open Set Function Filter +open Set Function Filter MeasureTheory +open scoped Topology BigOperators ContDiff +open scoped Topology ContDiff BigOperators +open scoped Topology ContDiff ZeroAtInfty +open scoped Topology ContDiff ZeroAtInfty BigOperators +open scoped Topology +open Stacks +variable {N b : ℕ} (hb : 0 < b) + (table : Fin N → Fin b → Option (Rule (Fin N) b)) (q₀ : Fin N) + +def rule (r : Rule (Fin N) b) : Rule (Fin (N + 1)) b := + ⟨r.target.castSucc, r.written, r.move⟩ + +def table' : Fin (N + 1) → Fin b → Option (Rule (Fin (N + 1)) b) := + Fin.lastCases (fun a => some ⟨q₀.castSucc, a, .stay⟩) + (fun q a => (table q a).map rule) + +def initial (x y : ℕ) : Configuration (Fin (N + 1)) := ⟨Fin.last N, x, y⟩ + +end VelocityDetection.Prelude +end + +noncomputable section +namespace VelocityDetection.MachineHistory +open scoped BigOperators Topology ContDiff +open Set Function Filter +open Set Function Filter MeasureTheory +open scoped Topology BigOperators ContDiff +open scoped Topology ContDiff BigOperators +open scoped Topology ContDiff ZeroAtInfty +open scoped Topology ContDiff ZeroAtInfty BigOperators +open scoped Topology +open Turing Stacks +variable {b N : ℕ} [NeZero b] [NeZero N] + +def table (M : TM0.Machine (Fin b) (Fin N)) : + Fin (N + 1) → Fin b → Option (Rule (Fin (N + 1)) b) := + Prelude.table' (TapeCodes.table M) 0 + +def initial (w : List (Fin b)) : Stacks.Configuration (Fin (N + 1)) := + Prelude.initial 0 (TapeCodes.word w) + +end VelocityDetection.MachineHistory +end + +noncomputable section +namespace VelocityDetection.Effective +open Polynomial Set Function Filter +open scoped BigOperators Topology ContDiff + +abbrev Poly := List (ℕ × ℚ) + +noncomputable def poly : Poly → Polynomial ℝ + | [] => 0 + | (k,q)::ps => Polynomial.C (q:ℝ)*Polynomial.X^k + poly ps + +def nextPoly : Poly → Poly + | [] => [] + | (k,q)::ps => (k+2,q)::(k+1,-q*k)::nextPoly ps + +noncomputable def flat (p : Poly) (x : ℝ) : ℝ := + (poly p).eval x⁻¹ * expNegInvGlue x + +def polyBound : Poly → ℚ + | [] => 0 + | (k,q)::ps => |q| *k.factorial + polyBound ps + +inductive Expr (n : ℕ) where + | rat : ℚ → Expr n + | var : Fin n → Expr n + | add : Expr n → Expr n → Expr n + | neg : Expr n → Expr n + | mul : Expr n → Expr n → Expr n + | inv : Expr n → Expr n + | flat : Poly → Expr n → Expr n + deriving Inhabited + +end VelocityDetection.Effective +end + +noncomputable section +namespace VelocityDetection.Effective.Expr +open Polynomial Set Function Filter +open scoped BigOperators Topology ContDiff +variable {n : ℕ} + +noncomputable def eval (x : Fin n → ℝ) : Expr n → ℝ + | .rat q => q + | .var i => x i + | .add a b => a.eval x + b.eval x + | .neg a => -a.eval x + | .mul a b => a.eval x * b.eval x + | .inv a => (a.eval x)⁻¹ + | .flat p a => Effective.flat p (a.eval x) + +def diff (i : Fin n) : Expr n → Expr n + | .rat _ => .rat 0 + | .var j => .rat (if i=j then 1 else 0) + | .add a b => .add (a.diff i) (b.diff i) + | .neg a => .neg (a.diff i) + | .mul a b => .add (.mul (a.diff i) b) (.mul a (b.diff i)) + | .inv a => .neg (.mul (a.diff i) (.mul (.inv a) (.inv a))) + | .flat p a => .mul (.flat (nextPoly p) a) (a.diff i) + +def jet : List (Fin n) → Expr n → Expr n + | [], e => e + | i::is, e => jet is (e.diff i) + +end VelocityDetection.Effective.Expr +end + +noncomputable section +namespace VelocityDetection.Effective +open Set Filter Function +open scoped BigOperators Topology + +structure Ball where + center : ℚ + radius : ℚ + deriving Inhabited + +def polyEval : Poly → ℚ → ℚ + | [], _ => 0 + | (k,q)::ps, x => q*x^k+polyEval ps x + +def expSum (q : ℚ) (n : ℕ) : ℚ := ∑ k ∈ Finset.range n, q^k / k.factorial + +def expError (q : ℚ) (n : ℕ) : ℚ := |q|^n / n.factorial * 2 + +def flatRound (p : Poly) (q : ℚ) (n : ℕ) : Ball := + if q ≤ 0 then ⟨0,0⟩ else + if |q⁻¹|/(n+1) ≤ (1/2:ℚ) ∧ + |polyEval p q⁻¹| *expError (-q⁻¹) n ≤ polyBound (nextPoly p)*|q| then + ⟨polyEval p q⁻¹*expSum (-q⁻¹) n,|polyEval p q⁻¹| *expError (-q⁻¹) n⟩ + else ⟨0,polyBound (nextPoly p)*|q|⟩ + +end VelocityDetection.Effective +end + +noncomputable section +namespace VelocityDetection.Effective.Ball +open Set Filter Function +open scoped Topology + +def atom (q : ℚ) : Ball := ⟨q,0⟩ + +def add (a b : Ball) : Ball := ⟨a.center+b.center,a.radius+b.radius⟩ + +def neg (a : Ball) : Ball := ⟨-a.center,a.radius⟩ + +def mul (a b : Ball) : Ball := + ⟨a.center*b.center,|a.center| *b.radius+|b.center| *a.radius+a.radius*b.radius⟩ + +def inv (a : Ball) : Ball := + ⟨a.center⁻¹,a.radius/(|a.center| *(|a.center|-a.radius))⟩ + +def invSafe (a : Ball) : Bool := decide (a.radius < |a.center|) + +def flat (p : Poly) (a : Ball) (k : ℕ) : Ball := + let b := flatRound p a.center k + ⟨b.center,b.radius+polyBound (nextPoly p)*a.radius⟩ + +end VelocityDetection.Effective.Ball +end + +noncomputable section +namespace VelocityDetection.Effective.Expr +open Set Filter Function +open scoped Topology +variable {n : ℕ} + +def round (a : Fin n → Ball) (k : ℕ) : Expr n → Ball := + Expr.rec (motive := fun _ => Ball) + Ball.atom a + (fun _ _ e f => e.add f) + (fun _ e => e.neg) + (fun _ _ e f => e.mul f) + (fun _ e => e.inv) + (fun p _ e => e.flat p k) + +def safe (a : Fin n → Ball) (k : ℕ) : Expr n → Bool := + Expr.rec (motive := fun _ => Bool) + (fun _ => true) (fun _ => true) + (fun _ _ e f => e && f) + (fun _ e => e) + (fun _ _ e f => e && f) + (fun e safe_e => safe_e && (e.round a k).invSafe) + (fun _ _ e => e) + +end VelocityDetection.Effective.Expr +end + +noncomputable section +namespace VelocityDetection.Effective +open Set Filter Function +open scoped Topology + +noncomputable def coordinateD {n : ℕ} (i : Fin n) (f : (Fin n → ℝ) → ℝ) (x : Fin n → ℝ) : ℝ := + deriv (fun s => f (update x i s)) (x i) + +noncomputable def mixedD {n : ℕ} : List (Fin n) → ((Fin n → ℝ) → ℝ) → (Fin n → ℝ) → ℝ + | [], f => f + | i::is, f => mixedD is (coordinateD i f) + +def accuracy (k : ℕ) : ℚ := (1/2)^k + +def Names {n : ℕ} (q : Fin n → ℕ → ℚ) (x : Fin n → ℝ) : Prop := + ∀ i k, |x i-(q i k:ℝ)| ≤ (accuracy k:ℝ) + +def inputBall {n : ℕ} (q : Fin n → ℕ → ℚ) (k : ℕ) (i : Fin n) : Ball := + ⟨q i k,accuracy k⟩ + +def trial {n : ℕ} (e : Expr n) (is : List (Fin n)) (q : Fin n → ℕ → ℚ) + (ε : ℚ) (k : ℕ) : Option ℚ := + let d := e.jet is + let a := inputBall q k + if d.safe a k && decide ((d.round a k).radius ≤ ε) then some (d.round a k).center else none + +end VelocityDetection.Effective +end + +noncomputable section +namespace VelocityDetection.PeriodicSpace +open Set Function Filter MeasureTheory +open scoped Topology ContDiff BigOperators BoundedContinuousFunction + +abbrev Torus (n : ℕ) := Fin n → AddCircle (1 : ℝ) + +def cover {n : ℕ} (X : Coord n) : Torus n := fun i => (X i : AddCircle (1 : ℝ)) + +end VelocityDetection.PeriodicSpace +end + +noncomputable section +namespace VelocityDetection.SmoothBump +open Set Function Filter MeasureTheory +open scoped Topology ContDiff BigOperators +open TranslationGates + +def profile (s : ℝ) : ℝ := window (((3 : ℕ) : ℝ)*s) + +end VelocityDetection.SmoothBump +end + +noncomputable section +namespace VelocityDetection.TorusClass +open Set Function Filter MeasureTheory +open scoped Topology ContDiff BigOperators + +abbrev Space := Coord 3 + +def measure : Measure Space := volume.restrict (Icc (0 : Space) 1) + +def periodic (f : Space → ℝ) : Prop := FactorsThrough f PeriodicSpace.cover + +def frame (i : Fin 3) : Space := Pi.single i 1 + +def D (i : Fin 3) (f : Space → ℝ) (x : Space) : ℝ := fderiv ℝ f x (frame i) + +def dt (u : VectorField 3) (t : ℝ) (x : Space) (i : Fin 3) : ℝ := + derivWithin (fun s => u s x i) (Ici 0) t + +structure ComparisonClass (u : VectorField 3) (p : ScalarField 3) : Prop where + velocity_slices : ∀ t ≥ 0, ∀ i, ContDiff ℝ 2 (fun x => u t x i) + pressure_slices : ∀ t ≥ 0, ContDiff ℝ 1 (p t) + velocity_periodic : ∀ t ≥ 0, FactorsThrough (u t) PeriodicSpace.cover + pressure_periodic : ∀ t ≥ 0, periodic (p t) + pressure_mean : ∀ t ≥ 0, (∫ x, p t x ∂measure) = 0 + time_derivative : ∀ t ≥ 0, ∀ x i, + HasDerivWithinAt (fun s => u s x i) (dt u t x i) (Ici 0) t + velocity_continuous : ∀ T > 0, ∀ i, + ContinuousOn (fun y : ℝ × Space => u y.1 y.2 i) (Icc 0 T ×ˢ univ) + time_continuous : ∀ T > 0, ∀ i, + ContinuousOn (fun y : ℝ × Space => dt u y.1 y.2 i) (Icc 0 T ×ˢ univ) + gradient_continuous : ∀ T > 0, ∀ i k, + ContinuousOn (fun y : ℝ × Space => D k (fun x => u y.1 x i) y.2) (Icc 0 T ×ˢ univ) + second_continuous : ∀ T > 0, ∀ i k l, + ContinuousOn (fun y : ℝ × Space => D l (D k (fun x => u y.1 x i)) y.2) (Icc 0 T ×ˢ univ) + pressure_continuous : ∀ T > 0, + ContinuousOn (fun y : ℝ × Space => p y.1 y.2) (Icc 0 T ×ˢ univ) + pressure_gradient_continuous : ∀ T > 0, ∀ i, + ContinuousOn (fun y : ℝ × Space => D i (p y.1) y.2) (Icc 0 T ×ˢ univ) + +end VelocityDetection.TorusClass +end + +noncomputable section +namespace VelocityDetection.MachineTorus +open Set Function MeasureTheory +open scoped Topology ContDiff BigOperators +open Turing Stacks +variable {b N : ℕ} [NeZero b] [NeZero N] + +def initialAddress (w : List (Fin b)) : ℕ := + History.address (capacity b (w.length+1) 0) ⟨MachineHistory.initial (N := N) w,0⟩ + +end VelocityDetection.MachineTorus +end + +noncomputable section +namespace VelocityDetection.Effective.Expr +open Set Function Filter +open scoped Topology BigOperators +variable {n m : ℕ} + +instance : Add (Expr n) := ⟨Expr.add⟩ + +instance : Neg (Expr n) := ⟨Expr.neg⟩ + +instance : Sub (Expr n) := ⟨fun a b => .add a (.neg b)⟩ + +instance : Mul (Expr n) := ⟨Expr.mul⟩ + +instance : Inv (Expr n) := ⟨Expr.inv⟩ + +instance : Div (Expr n) := ⟨fun a b => .mul a (.inv b)⟩ + +instance (k : ℕ) : OfNat (Expr n) k := ⟨.rat k⟩ + +def subst (v : Fin m → Expr n) : Expr m → Expr n := + Expr.rec (motive := fun _ => Expr n) + Expr.rat v + (fun _ _ a b => .add a b) + (fun _ a => .neg a) + (fun _ _ a b => .mul a b) + (fun _ a => .inv a) + (fun p _ a => .flat p a) + +def sumList : List (Expr n) → Expr n + | [] => 0 + | e::es => e + sumList es + +def sumFin (k : ℕ) (f : Fin k → Expr n) : Expr n := sumList (List.ofFn f) + +def unaryD (e : Expr 1) (a : Expr n) : Expr n := (e.diff 0).subst (fun _ => a) + +end VelocityDetection.Effective.Expr +end + +noncomputable section +namespace VelocityDetection.Effective.Recipe +open Set Function Filter +open scoped Topology BigOperators +open _root_.OAI.VelocityDetection.Effective.Expr +variable {n : ℕ} + +def glue (a : Expr n) : Expr n := .flat [(0,1)] a + +def step (a : Expr n) : Expr n := glue a/(glue a+glue (1-a)) + +def pulse (a : Expr n) : Expr n := (step (.var 0 : Expr 1)).unaryD a + +def window (a : Expr n) : Expr n := step (a+3)*step (3-a) + +def windowD (a : Expr n) : Expr n := pulse (a+3)*step (3-a)-step (a+3)*pulse (3-a) + +def theta (a T : Expr n) (j : ℕ) (t : Expr n) : Expr n := + step (2*(3*(t-a)/T-.rat j)-.rat (1/2)) + +def center (a T S S' σ : Expr n) (k l : ℕ) (t : Expr n) : Fin 2 → Expr n := + ![(1-theta a T 1 t)*S*.rat k+theta a T 1 t*S'*.rat l, + -(1-theta a T 0 t)*S+(theta a T 0 t-theta a T 2 t)*(-(.rat k+2)*S)+ + theta a T 2 t*σ*S'] + +def gate (R : Expr n) (c G X : Fin 2 → Expr n) : Fin 2 → Expr n := + letI := neZeroTwo + ![window ((X 0-c 0)/R)*(windowD ((X 1-c 1)/R)/R)* + (G 0*(X 1-c 1)-G 1*(X 0-c 0))+ + window ((X 0-c 0)/R)*window ((X 1-c 1)/R)*G 0, + window ((X 0-c 0)/R)*window ((X 1-c 1)/R)*G 1- + (windowD ((X 0-c 0)/R)/R*window ((X 1-c 1)/R))* + (G 0*(X 1-c 1)-G 1*(X 0-c 0))] + +def impulse (t : Expr n) (p X : Fin 2 → Expr n) : Expr n := + letI := neZeroTwo + pulse t*pulse (X 0-p 0+.rat (1/2))*pulse (X 1-p 1+.rat (1/2)) + +def packet (R : Expr n) (X : Fin 2 → Expr n) : Expr n := + letI := neZeroTwo + window (3*(X 0/R))*window (3*(X 1/R)) + +end VelocityDetection.Effective.Recipe +end + +noncomputable section +namespace VelocityDetection.Effective.Expr +open Set Function +open scoped BigOperators Topology +variable {n : ℕ} + +def activeSum {N b B H : ℕ} (hb : 0 < b) + (table : Fin N → Fin b → Option (Stacks.Rule (Fin N) b)) + (f : History.Active hb table B H → Expr n) : Expr n := + sumFin N (fun s => sumFin B (fun l => sumFin B (fun r => sumFin H (fun h => + if hp : (Stacks.lookup hb table (History.config (s,l,r,h)).tape).isSome then + f ⟨(s,l,r,h),hp⟩ else 0)))) + +end VelocityDetection.Effective.Expr +end + +noncomputable section +namespace VelocityDetection.Effective.ArrayRecipe +open Set Function +open scoped BigOperators Topology +open _root_.OAI.VelocityDetection.Effective.Expr Stacks +variable {N b : ℕ} (hN : 0 < N) (hb : 0 < b) + (table : Fin N → Fin b → Option (Rule (Fin N) b)) (m : ℕ) + +abbrev Code := Expr 5 + +def K (N b m : ℕ) : ℕ := N * capacity b (m+1) 0 ^ 2 + +def D (N b : ℕ) : ℕ := b^2 * History.radix N b + +def radius (N b m n : ℕ) : Code := + .rat (1024*3000*(4*(D N b))*(K N b m*D N b+2)*(4*D N b)^n) * (1+.var 0) + +def spacing (N b m n : ℕ) : Code := 16*radius N b m n + +def duration (N b m n : ℕ) : Code := + spacing N b m (n+1) * .rat (K N b m*D N b^(n+1)+2) + +def start (N b m : ℕ) : ℕ → Code + | 0 => 1 + | n+1 => start N b m n+duration N b m n + +def sign (c : History.Configuration N) : ℚ := + if (lookup hb table c.tape).isNone then 1 else -1 + +abbrev Instruction (n : ℕ) := History.Active hb table (capacity b (m+1) n) (History.radix N b^n) + +def path (n : ℕ) (c : Instruction hb table m n) : Fin 2 → Code := + Recipe.center (start N b m n) (duration N b m n) (spacing N b m n) + (spacing N b m (n+1)) (.rat (sign hb table (History.target hb table c))) + (History.sourceAddress hb table c) (History.targetAddress hb table c) (.var 1) + +def gate (n : ℕ) (c : Instruction hb table m n) : Fin 2 → Code := + Recipe.gate (radius N b m n) (path hb table m n c) + (fun i => (path hb table m n c i).diff 1) ![.var 2,.var 3] + +def stage (n : ℕ) (i : Fin 2) : Code := + activeSum hb table (fun c : Instruction hb table m n => gate hb table m n c i) + +def field (L : ℕ) (i : Fin 2) : Code := sumFin L (fun n => stage hb table m n i) + +end VelocityDetection.Effective.ArrayRecipe +end + +noncomputable section +namespace VelocityDetection.Effective.ChartRecipe +open Set Function ArrayRecipe +open scoped BigOperators Topology +open VelocityDetection.Effective.Expr +variable {N b : ℕ} (hN : 0 < N) (hb : 0 < b) + (table : Fin N → Fin b → Option (Stacks.Rule (Fin N) b)) (m : ℕ) + +def scale (N b m P : ℕ) : ℚ := (1024*((K N b m:ℚ)*(D N b:ℚ)^(P+1)+4))⁻¹ + +def radius (N b m P : ℕ) : ℚ := scale N b m P/16 + +def targetHeight (P n : ℕ) (c : Instruction hb table m n) : ℚ := + if ArrayRecipe.sign hb table (History.target hb table c) = 1 then -(7/16) else -scale N b m P + +def path (P n : ℕ) (c : Instruction hb table m n) : Fin 2 → Code := + letI := neZeroFive + fun i => + .rat (![1/4,1/2] i) + Recipe.center (.rat n) 1 (.rat (scale N b m P)) (.rat (scale N b m P)) + (.rat (targetHeight hb table m P n c/scale N b m P)) + (History.sourceAddress hb table c) (History.targetAddress hb table c) (.var 1) i + +def gate (P n : ℕ) (c : Instruction hb table m n) : Fin 2 → Code := + letI := neZeroFive + Recipe.gate (.rat (radius N b m P)) (path hb table m P n c) + (fun i => (path hb table m P n c i).diff 1) ![.var 2,.var 3] + +def stage (P n : ℕ) (i : Fin 2) : Code := + activeSum hb table (fun c : Instruction hb table m n => gate hb table m P n c i) + +def prefixCode (P : ℕ) (i : Fin 2) : Code := sumFin P (fun n => stage hb table m P n i) + +def duration (N b m B k : ℕ) : Code := + letI := neZeroFive + .rat ((1/16)*(1/2:ℚ)^k) / + (3*(1+.var 0*.rat (2*(B:ℚ)/(radius N b m (k+1))^2))) + +def localTime (N b m B k : ℕ) : Code := + letI := neZeroFive + (.var 1-.rat (k+1))/duration N b m B k + +def weight (N b m B k : ℕ) : Code := + Recipe.step (8*localTime N b m B k)-Recipe.step (8*localTime N b m B k-.rat 7) + +def clock (N b m B k : ℕ) : Code := .rat (k+1)* + (Recipe.step (8*localTime N b m B k-1)-Recipe.step (8*localTime N b m B k-.rat 5)) + +def rawField (B k : ℕ) (i : Fin 2) : Code := + letI := neZeroFive + (clock N b m B k).diff 1 * (prefixCode hb table m (k+1) i).subst + ![.var 0,clock N b m B k,.var 2,.var 3,.var 4] + +def initial (N b m P q : ℕ) : Fin 2 → Code := + ![.rat (1/4+scale N b m P*q),.rat (1/2-scale N b m P)] + +def rawSource (B q k : ℕ) : Code := + letI := neZeroFive + (weight N b m B k).diff 1 * + Recipe.packet (.rat (radius N b m (k+1))) + (fun i => (![.var 2,.var 3] i)-initial N b m (k+1) q i) + +end VelocityDetection.Effective.ChartRecipe +end + +noncomputable section +namespace VelocityDetection.Effective +open Set Function +open scoped Topology BigOperators +open _root_.OAI.VelocityDetection.Effective.Expr ArrayRecipe + +def periodize (R : ℕ) (e : Code) : Code := + letI := neZeroFive + sumFin (2*R+1) (fun i => sumFin (2*R+1) (fun j => + e.subst ![.var 0,.var 1,.var 2-.rat ((i:ℚ)-R),.var 3-.rat ((j:ℚ)-R),.var 4])) + +end VelocityDetection.Effective +end + +noncomputable section +namespace VelocityDetection.Effective.ChartRecipe +open Set Function +open scoped Topology BigOperators +open _root_.OAI.VelocityDetection.Effective.Expr ArrayRecipe +variable {N b : ℕ} (hN : 0 < N) (hb : 0 < b) + (table : Fin N → Fin b → Option (Stacks.Rule (Fin N) b)) (m : ℕ) + +def fieldBlock (B R k : ℕ) (i : Fin 2) : Code := periodize R (rawField hb table m B k i) + +def sourceBlock (N b m B q R k : ℕ) : Code := periodize R (rawSource (N:=N) (b:=b) m B q k) + +def field (B R L : ℕ) (i : Fin 2) : Code := sumFin L (fun k => fieldBlock hb table m B R k i) + +def source (N b m B q R L : ℕ) : Code := sumFin L (fun k => sourceBlock N b m B q R k) + +end VelocityDetection.Effective.ChartRecipe +end + +noncomputable section +namespace VelocityDetection.Effective +open Set Filter Function +open scoped Topology BigOperators ContDiff +open VelocityDetection.Effective.Expr ArrayRecipe + +def residualCode (a : Fin 2 → Code) (i : Fin 2) : Code := + letI := neZeroTwo + letI := neZeroFive + (a i).diff 1 + a 0*(a i).diff 2 + a 1*(a i).diff 3 - + .var 0*((((a i).diff 2).diff 2)+(((a i).diff 3).diff 3)) + +end VelocityDetection.Effective +end + +noncomputable section +namespace VelocityDetection.Effective.ArrayRecipe +open Set Filter Function Turing +open scoped Topology BigOperators ContDiff +open VelocityDetection.Effective.Expr ArrayRecipe + +def initialCode (N b m q : ℕ) : Fin 2 → Code := + ![spacing N b m 0 * .rat q,-spacing N b m 0] + +def source (N b m q : ℕ) : Code := + letI := neZeroFive + Recipe.impulse (.var 1) (initialCode N b m q) ![.var 2,.var 3] + +end VelocityDetection.Effective.ArrayRecipe +end + +noncomputable section +namespace VelocityDetection.Effective +open Set Filter Function Turing +open scoped Topology BigOperators ContDiff +open VelocityDetection.Effective.Expr ArrayRecipe + +noncomputable def forceFunction (f : ℝ → VectorField 3) (i : Fin 3) (x : Fin 5 → ℝ) : ℝ := + letI := neZeroFive + f (x 0) (x 1) ![x 2,x 3,x 4] i + +end VelocityDetection.Effective +end + +noncomputable section +namespace VelocityDetection.Effective.MachineRecipe +open Set Filter Function Turing +open scoped Topology BigOperators ContDiff +open VelocityDetection.Effective.Expr ArrayRecipe +variable {b N : ℕ} [NeZero b] [NeZero N] + +inductive Domain where | torus | cylinder + deriving DecidableEq, Repr + +def field (d : Domain) (B R L : ℕ) (M : TM0.Machine (Fin b) (Fin N)) + (w : List (Fin b)) (i : Fin 2) : Code := match d with + | .torus => ChartRecipe.field (NeZero.pos b) (MachineHistory.table M) w.length B R L i + | .cylinder => ArrayRecipe.field (NeZero.pos b) (MachineHistory.table M) w.length L i + +def source (d : Domain) (B R L : ℕ) (w : List (Fin b)) : Code := match d with + | .torus => ChartRecipe.source (N+1) b w.length B (MachineTorus.initialAddress (N:=N) w) R L + | .cylinder => ArrayRecipe.source (N+1) b w.length (MachineTorus.initialAddress (N:=N) w) + +def force (d : Domain) (B R L : ℕ) (M : TM0.Machine (Fin b) (Fin N)) + (w : List (Fin b)) (i : Fin 3) : Code := + letI := neZeroTwo + ![residualCode (field d B R L M w) 0,residualCode (field d B R L M w) 1, + source (N:=N) d B R L w] i + +end VelocityDetection.Effective.MachineRecipe +end + +noncomputable section +namespace VelocityDetection.Effective.MachineRecipe +open Set Filter Function Turing +open scoped Topology ContDiff BigOperators +variable {b N : ℕ} [NeZero b] [NeZero N] + +def timeCutoff (q : Fin 5 → ℕ → ℚ) : ℕ := + letI := neZeroFive + ⌈q 1 0+2⌉₊ + +def spaceCutoff (q : Fin 5 → ℕ → ℚ) : ℕ := + letI := neZeroFive + ⌈|q 2 0|+|q 3 0|+3⌉₊ + +def runTrial (d : Domain) (B : ℕ) (M : TM0.Machine (Fin b) (Fin N)) + (w : List (Fin b)) (i : Fin 3) (is : List (Fin 5)) (q : Fin 5 → ℕ → ℚ) + (ε : ℚ) (k : ℕ) : Option ℚ := + trial (force d B (spaceCutoff q) (timeCutoff q) M w i) is q ε k + +end VelocityDetection.Effective.MachineRecipe +end + +noncomputable section +namespace VelocityDetection.Effective +open Set Filter Function +open scoped Topology BigOperators + +structure RationalBox (n : ℕ) where + lower : Fin n → ℚ + upper : Fin n → ℚ + ordered : ∀ i, lower i ≤ upper i + +end VelocityDetection.Effective +end + +noncomputable section +namespace VelocityDetection.Effective.RationalBox +open Set Filter Function +open scoped Topology BigOperators +variable {n : ℕ} (Q : RationalBox n) + +def carrier : Set (Fin n → ℝ) := Icc (fun i => (Q.lower i:ℝ)) (fun i => (Q.upper i:ℝ)) + +def cell (k : ℕ) (j : Fin n → Fin (k+2)) (i : Fin n) : Ball := + ⟨Q.lower i+(Q.upper i-Q.lower i)*((j i:ℕ):ℚ)/(k+1), + (Q.upper i-Q.lower i)/(k+1)⟩ + +def boundTrial (e : Expr n) (is : List (Fin n)) (k : ℕ) : Option ℚ := + if ∀ j : Fin n → Fin (k+2), (e.jet is).safe (Q.cell k j) k = true then + some (∑ j : Fin n → Fin (k+2), + (|((e.jet is).round (Q.cell k j) k).center| + |((e.jet is).round (Q.cell k j) k).radius|)) + else none + +end VelocityDetection.Effective.RationalBox +end + +noncomputable section +namespace VelocityDetection.Effective.MachineRecipe +open Set Function Turing +variable {b N : ℕ} [NeZero b] [NeZero N] + +def boxTimeCutoff (Q : RationalBox 5) : ℕ := + letI := neZeroFive + ⌈Q.upper 1+1⌉₊ + +def boxSpaceCutoff (Q : RationalBox 5) : ℕ := + letI := neZeroFive + ⌈|Q.lower 2|+|Q.upper 2|+|Q.lower 3|+|Q.upper 3|+2⌉₊ + +def runBoundTrial (d : Domain) (B : ℕ) (M : TM0.Machine (Fin b) (Fin N)) + (w : List (Fin b)) (i : Fin 3) (is : List (Fin 5)) (Q : RationalBox 5) (k : ℕ) : Option ℚ := + Q.boundTrial (force d B (boxSpaceCutoff Q) (boxTimeCutoff Q) M w i) is k + +end VelocityDetection.Effective.MachineRecipe +end + +noncomputable section +namespace VelocityDetection.Effective.MachineRecipe +open Turing + +structure Program (b N : ℕ) [NeZero b] [NeZero N] where + derivativeBound : ℕ + table : TM0.Machine (Fin b) (Fin N) + input : List (Fin b) + +def compile {b N : ℕ} [NeZero b] [NeZero N] (B : ℕ) (M : TM0.Machine (Fin b) (Fin N)) (w : List (Fin b)) : + Program b N := ⟨B,M,w⟩ + +end VelocityDetection.Effective.MachineRecipe +end + +noncomputable section +namespace VelocityDetection.Effective.MachineRecipe.Program +open Turing +variable {b N : ℕ} [NeZero b] [NeZero N] + +def valueTrial (P : Program b N) (d : Domain) (i : Fin 3) (is : List (Fin 5)) + (q : Fin 5 → ℕ → ℚ) (ε : ℚ) (k : ℕ) : Option ℚ := + runTrial d P.derivativeBound P.table P.input i is q ε k + +def boundTrial (P : Program b N) (d : Domain) (i : Fin 3) (is : List (Fin 5)) + (Q : RationalBox 5) (k : ℕ) : Option ℚ := + runBoundTrial d P.derivativeBound P.table P.input i is Q k + +noncomputable def evaluate (P : Program b N) (d : Domain) (i : Fin 3) (is : List (Fin 5)) + (q : Fin 5 → ℕ → ℚ) (ε : ℚ) : Part ℚ := Nat.rfindOpt (P.valueTrial d i is q ε) + +noncomputable def derivativeBounds (P : Program b N) (d : Domain) (i : Fin 3) + (is : List (Fin 5)) (Q : RationalBox 5) : Part ℚ := Nat.rfindOpt (P.boundTrial d i is Q) + +def Represents (P : Program b N) (d : Domain) (F : ℝ → VectorField 3) : Prop := + letI := neZeroFive + (∀ (i : Fin 3) (is : List (Fin 5)) (q : Fin 5 → ℕ → ℚ) (x : Fin 5 → ℝ), + Names q x → 0 < x 0 → ∀ ε : ℚ, 0 < ε → + (P.evaluate d i is q ε).Dom ∧ + ∀ r ∈ P.evaluate d i is q ε, + |mixedD is (forceFunction F i) x-(r:ℝ)| ≤ (ε:ℝ)) ∧ + (∀ (i : Fin 3) (is : List (Fin 5)) (Q : RationalBox 5), 0 < Q.lower 0 → + (P.derivativeBounds d i is Q).Dom ∧ + ∀ C ∈ P.derivativeBounds d i is Q, 0 ≤ C ∧ + ∀ x ∈ Q.carrier, |mixedD is (forceFunction F i) x| ≤ (C:ℝ)) + +end VelocityDetection.Effective.MachineRecipe.Program +end + +noncomputable section +namespace VelocityDetection.Effective +open Turing + +def ComputableReal (x : ℝ) : Prop := + ∃ q : ℕ → ℚ, Computable q ∧ ∀ k, |x-(q k:ℝ)| ≤ (accuracy k:ℝ) + +end VelocityDetection.Effective +end + +noncomputable section +namespace VelocityDetection +open Set Function MeasureTheory Turing +open scoped ContDiff +open Effective Effective.MachineRecipe + +theorem main_result : + ∃ B : ℕ, 0 < B ∧ + (∀ s : ℝ, |deriv (deriv SmoothBump.profile) s| ≤ (B:ℝ)) ∧ + ∀ (ν : ℝ), 0 < ν → ComputableReal ν → + ∀ (b N : ℕ) [NeZero b] [NeZero N] + (M : TM0.Machine (Fin b) (Fin N)) (w : List (Fin b)), + ∃ (Ftor Fcyl : ℝ → VectorField 3), + (compile B M w).Represents .torus Ftor ∧ + (compile B M w).Represents .cylinder Fcyl ∧ + (ContDiff ℝ ∞ (uncurry (Ftor ν)) ∧ + (∀ t, FactorsThrough (Ftor ν t) PeriodicSpace.cover) ∧ + (∃ K : Set (Coord 2), IsCompact K ∧ (∀ X ∈ K, ∀ i, X i ∈ Ioo (0:ℝ) 1) ∧ + ∀ t X, PeriodicSpace.cover (horizontal X) ∉ PeriodicSpace.cover '' K → Ftor ν t X = 0) ∧ + (∀ T d, ∃ C : ℝ, 0 ≤ C ∧ ∀ t ∈ Icc (0:ℝ) T, ∀ X, + ‖iteratedFDeriv ℝ d (uncurry (Ftor ν)) (t,X)‖ ≤ C) ∧ + ∃ u : VectorField 3, + ContDiff ℝ ∞ (uncurry u) ∧ TorusClass.ComparisonClass u (fun _ _ => 0) ∧ + NavierStokes ν u (fun _ _ => 0) (Ftor ν) ∧ + (Observation.torusEvent u ↔ (TM0.eval M w).Dom) ∧ + ∀ (v : VectorField 3) (p : ScalarField 3), TorusClass.ComparisonClass v p → + NavierStokes ν v p (Ftor ν) → + ∀ t ≥ 0, (∀ X, v t X = u t X) ∧ (∀ X, p t X = 0)) ∧ + (ContDiff ℝ ∞ (uncurry (Fcyl ν)) ∧ + UniformDerivatives.Bounded (fun _ : Unit => uncurry (Fcyl ν)) ∧ + (∀ t X z, Fcyl ν t (update X 2 z) = Fcyl ν t X) ∧ + (∀ T : ℝ, ∃ K : Set (Coord 2), IsCompact K ∧ ∀ t ∈ Icc (0:ℝ) T, + ∀ X : Coord 3, horizontal X ∉ K → Fcyl ν t X = 0) ∧ + ∃ u : VectorField 3, + ContDiff ℝ ∞ (uncurry u) ∧ + Cylinder.ComparisonClass (fun t x => u t (Cylinder.join x)) (fun _ _ => 0) ∧ + NavierStokes ν u (fun _ _ => 0) (Fcyl ν) ∧ + (∀ t ≥ 0, (∀ x, 0 ≤ u t (Cylinder.join x) 2) ∧ + Integrable (fun x => u t (Cylinder.join x) 2) Cylinder.measure) ∧ + (Observation.planeEvent u ↔ (TM0.eval M w).Dom) ∧ + ∀ (v : VectorField 3) (p : ScalarField 3), + Cylinder.ComparisonClass (fun t x => v t (Cylinder.join x)) + (fun t x => p t (Cylinder.join x)) → + NavierStokes ν v p (Fcyl ν) → + ∀ t ≥ 0, (∀ X, v t X = u t X) ∧ (∀ X, p t X = 0)) := by sorry + +end VelocityDetection +end + +end OAI diff --git a/lean/ComparatorChallenges/NodalLength.json b/lean/ComparatorChallenges/NodalLength.json new file mode 100644 index 0000000000000000000000000000000000000000..89208a2ad593de9819d55aab0141511fe39d9e93 --- /dev/null +++ b/lean/ComparatorChallenges/NodalLength.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.NodalLength", + "solution_module": "OAI.Analysis.NodalLength.Main", + "theorem_names": [ + "OAI.SharpNodal.Main" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/NodalLength.lean b/lean/ComparatorChallenges/NodalLength.lean new file mode 100644 index 0000000000000000000000000000000000000000..03ace4ffdc61e09751adb681344ec766029b2f06 --- /dev/null +++ b/lean/ComparatorChallenges/NodalLength.lean @@ -0,0 +1,62 @@ +import Mathlib + +namespace OAI + +noncomputable section + +open scoped ContDiff Bundle ENNReal +open Bundle Manifold MeasureTheory + +namespace SharpNodal + +abbrev Plane := EuclideanSpace ℝ (Fin 2) + +variable {M : Type*} [MetricSpace M] [ChartedSpace Plane M] + [IsManifold 𝓘(ℝ, Plane) ∞ M] + [RiemannianBundle (fun x : M => TangentSpace 𝓘(ℝ, Plane) x)] + +def coordinateMetric (x : M) (y : Plane) : Matrix (Fin 2) (Fin 2) ℝ := + fun i j => inner ℝ + (mfderiv 𝓘(ℝ, Plane) 𝓘(ℝ, Plane) (chartAt Plane x).symm y + (EuclideanSpace.single i 1)) + (mfderiv 𝓘(ℝ, Plane) 𝓘(ℝ, Plane) (chartAt Plane x).symm y + (EuclideanSpace.single j 1)) + +def coordinateDensity (x : M) (y : Plane) : ℝ := + Real.sqrt (coordinateMetric x y).det + +def coordPartial (f : Plane → ℝ) (i : Fin 2) (y : Plane) : ℝ := + fderiv ℝ f y (EuclideanSpace.single i 1) + +def laplaceBeltrami (u : M → ℝ) (x : M) : ℝ := + (coordinateDensity x (chartAt Plane x x))⁻¹ * + ∑ i : Fin 2, coordPartial (fun y => coordinateDensity x y * + ∑ j : Fin 2, ((coordinateMetric x y)⁻¹ i j) * + coordPartial (u ∘ (chartAt Plane x).symm) j y) i (chartAt Plane x x) + +def nodalSet (u : M → ℝ) : Set M := {x | u x = 0} + +def nodalLength (u : M → ℝ) : ℝ≥0∞ := + letI : MeasurableSpace M := borel M + letI : BorelSpace M := ⟨rfl⟩ + Measure.hausdorffMeasure 1 (nodalSet u) + +def MainStatement (M : Type*) [MetricSpace M] [ChartedSpace Plane M] + [IsManifold 𝓘(ℝ, Plane) ∞ M] + [RiemannianBundle (fun x : M => TangentSpace 𝓘(ℝ, Plane) x)] : Prop := + ∃ C : ℝ, 0 ≤ C ∧ ∀ (lam : ℝ), 0 < lam → ∀ (u : M → ℝ), + ContMDiff 𝓘(ℝ, Plane) 𝓘(ℝ) ∞ u → u ≠ 0 → + (∀ x, -laplaceBeltrami u x = lam * u x) → + nodalLength u ≤ ENNReal.ofReal (C * Real.sqrt lam) + +theorem Main [CompactSpace M] [ConnectedSpace M] + [IsContMDiffRiemannianBundle 𝓘(ℝ,Plane) ∞ Plane + (fun x:M=>TangentSpace 𝓘(ℝ,Plane) x)] + [IsRiemannianManifold 𝓘(ℝ,Plane) M] : MainStatement M := by + sorry + +end SharpNodal + +end + +end OAI diff --git a/lean/ComparatorChallenges/NoiselessRegression.json b/lean/ComparatorChallenges/NoiselessRegression.json new file mode 100644 index 0000000000000000000000000000000000000000..769b0f6da6be79d456ff47315a215ee018235a09 --- /dev/null +++ b/lean/ComparatorChallenges/NoiselessRegression.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.NoiselessRegression", + "solution_module": "OAI.Probability.GaussianRegression.Main", + "theorem_names": [ + "OAI.NoiselessRegression.main" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/NoiselessRegression.lean b/lean/ComparatorChallenges/NoiselessRegression.lean new file mode 100644 index 0000000000000000000000000000000000000000..a9643741f0fee5bf2cb1c2caffc63a9a4d36a6ef --- /dev/null +++ b/lean/ComparatorChallenges/NoiselessRegression.lean @@ -0,0 +1,125 @@ +import Mathlib + +namespace OAI + +/-! +Finite-state Gaussian regression with noiseless labels and angular accuracy. +-/ + +open MeasureTheory ProbabilityTheory Set Filter +open scoped ENNReal NNReal RealInnerProductSpace + +noncomputable section + +universe u + +namespace NoiselessRegression + +abbrev Vector (d : ℕ) := EuclideanSpace ℝ (Fin d) +abbrev UnitSphere (d : ℕ) := Metric.sphere (0 : Vector d) 1 +abbrev State (M : ℕ) := Fin (2 ^ M) +abbrev Samples (d T : ℕ) := Fin T → Vector d + +def uniformSphere (d : ℕ) : Measure (UnitSphere d) := + let σ := (volume : Measure (Vector d)).toSphere + (σ Set.univ)⁻¹ • σ + +def sampleLaw (d T : ℕ) : Measure (Samples d T) := + Measure.pi fun _ => stdGaussian (Vector d) + +def observationReference (d : ℕ) : Measure (Vector d × ℝ) := + (stdGaussian (Vector d)).prod volume + +structure Learner (d M T : ℕ) (Ω : Type u) where + initialChoice : Ω → Bool × State M + transition : ℕ → Ω → State M → (Vector d × ℝ) → Bool × State M + output : ℕ → Ω → State M → UnitSphere d + +namespace Learner + +abbrev RunStatus (M : ℕ) := Sum (State M) (ℕ × State M) + +def start {d M T : ℕ} {Ω : Type u} (L : Learner d M T Ω) (ω : Ω) : + RunStatus M := + let a := L.initialChoice ω + if a.1 then .inr (0, a.2) else .inl a.2 + +def run {d M T : ℕ} {Ω : Type u} (L : Learner d M T Ω) + (s : UnitSphere d) (ω : Ω) (x : Samples d T) : ℕ → RunStatus M + | 0 => L.start ω + | n + 1 => + match L.run s ω x n with + | .inr done => .inr done + | .inl state => + if hn : n < T then + let row := x ⟨n, hn⟩ + let a := L.transition (n + 1) ω state (row, ⟪row, s.val⟫) + if a.1 then .inr (n + 1, a.2) else .inl a.2 + else .inl state + +def terminal {d M T : ℕ} {Ω : Type u} (L : Learner d M T Ω) + (s : UnitSphere d) (ω : Ω) (x : Samples d T) : ℕ × State M := + match L.run s ω x T with + | .inl state => (T, state) + | .inr done => done + +def estimate {d M T : ℕ} {Ω : Type u} (L : Learner d M T Ω) + (s : UnitSphere d) (ω : Ω) (x : Samples d T) : UnitSphere d := + let a := L.terminal s ω x + L.output a.1 ω a.2 + +structure Admissible {d M T : ℕ} {Ω : Type u} [MeasurableSpace Ω] + (L : Learner d M T Ω) (ρ : Measure Ω) : Prop where + initialChoice : AEMeasurable L.initialChoice ρ + transition : ∀ t a, AEMeasurable (fun z : Ω × (Vector d × ℝ) => + L.transition t z.1 a z.2) (ρ.prod (observationReference d)) + output : ∀ t a, AEMeasurable (fun ω => L.output t ω a) ρ + fixed_experiment : ∀ s, AEMeasurable (fun z : Ω × Samples d T => + L.estimate s z.1 z.2) (ρ.prod (sampleLaw d T)) + uniform_experiment : AEMeasurable + (fun z : UnitSphere d × (Ω × Samples d T) => L.estimate z.1 z.2.1 z.2.2) + ((uniformSphere d).prod (ρ.prod (sampleLaw d T))) + +def angularError {d : ℕ} (s ŝ : UnitSphere d) : ℝ := + Real.arccos ⟪ŝ.val, s.val⟫ + +def success {d M T : ℕ} {Ω : Type u} [MeasurableSpace Ω] + (L : Learner d M T Ω) (ρ : Measure Ω) (ε : ℝ) (s : UnitSphere d) : ℝ≥0∞ := + (ρ.prod (sampleLaw d T)) + {z | angularError s (L.estimate s z.1 z.2) ≤ ε} + +def uniformSuccess {d M T : ℕ} {Ω : Type u} [MeasurableSpace Ω] + (L : Learner d M T Ω) (ρ : Measure Ω) (ε : ℝ) : ℝ≥0∞ := + ((uniformSphere d).prod (ρ.prod (sampleLaw d T))) + {z | angularError z.1 (L.estimate z.1 z.2.1 z.2.2) ≤ ε} + +end Learner + +def SubquadraticMemory : Prop := + ∃ c : ℝ, 0 < c ∧ ∀ M : ℕ → ℕ, + Asymptotics.IsLittleO atTop (fun d => (M d : ℝ)) (fun d => (d : ℝ) ^ 2) → + ∃ d₀ : ℕ, ∀ d : ℕ, d₀ ≤ d → ∀ T : ℕ, ∀ ε : ℝ, + 0 < ε → ε ≤ 1 / 10 → + ∀ (Ω : Type u) [MeasurableSpace Ω] (ρ : Measure Ω), IsProbabilityMeasure ρ → + ∀ L : Learner d (M d) T Ω, L.Admissible ρ → + (((2 : ℕ) / (3 : ℕ) : ℝ≥0∞) ≤ L.uniformSuccess ρ ε ∨ + ∀ s, ((2 : ℕ) / (3 : ℕ) : ℝ≥0∞) ≤ L.success ρ ε s) → + c * (d : ℝ) * Real.log (1 / ε) ≤ (T : ℝ) + +def FixedQuadraticMemory : Prop := + ∀ A₀ : ℝ, 0 < A₀ → ∃ c : ℝ, 0 < c ∧ ∃ d₀ : ℕ, + ∀ d : ℕ, d₀ ≤ d → ∀ M T : ℕ, (M : ℝ) ≤ A₀ * (d : ℝ) ^ 2 → + ∀ ε : ℝ, 0 < ε → ε ≤ 1 / 10 → + ∀ (Ω : Type u) [MeasurableSpace Ω] (ρ : Measure Ω), IsProbabilityMeasure ρ → + ∀ L : Learner d M T Ω, L.Admissible ρ → + ((2 : ℕ) / (3 : ℕ) : ℝ≥0∞) ≤ L.uniformSuccess ρ ε → + c * (d : ℝ) * Real.log (1 / ε) ≤ (T : ℝ) + +theorem main : SubquadraticMemory.{u} ∧ FixedQuadraticMemory.{u} := by + sorry + +end NoiselessRegression + +end + +end OAI diff --git a/lean/ComparatorChallenges/NuclearUltrapower.json b/lean/ComparatorChallenges/NuclearUltrapower.json new file mode 100644 index 0000000000000000000000000000000000000000..372362a34f307138b94aec8abf0d621028e80c74 --- /dev/null +++ b/lean/ComparatorChallenges/NuclearUltrapower.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.NuclearUltrapower", + "solution_module": "OAI.Analysis.NuclearUltrapower.Main", + "theorem_names": [ + "OAI.NuclearUltrapower.main_no_embedding" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/NuclearUltrapower.lean b/lean/ComparatorChallenges/NuclearUltrapower.lean new file mode 100644 index 0000000000000000000000000000000000000000..2bf8cc14aef3be796a94f1bfa6861b6cafa17c6c --- /dev/null +++ b/lean/ComparatorChallenges/NuclearUltrapower.lean @@ -0,0 +1,213 @@ +import Mathlib + +namespace OAI + +noncomputable section +universe u v w +open Filter +open scoped TensorProduct Topology +namespace NuclearUltrapower + +/- The dyadic coefficient ring is exactly Z[1/2]. -/ +abbrev Dyadic := Localization.Away (2 : ℤ) +abbrev Vector3 := Fin 3 → Dyadic +abbrev SL3Z := Matrix.SpecialLinearGroup (Fin 3) ℤ + +noncomputable def dyadicTwo : Dyadicˣ := + (IsLocalization.Away.isUnit_of_dvd (S := Dyadic) (2 : ℤ) (dvd_refl _)).unit + +noncomputable def matrixAction (M : SL3Z) : Vector3 ≃ₗ[Dyadic] Vector3 := + Matrix.SpecialLinearGroup.toLin' + (Matrix.SpecialLinearGroup.map (Int.castRingHom Dyadic) M) + +noncomputable def dilationAction (g : SL3Z × Multiplicative ℤ) : + Vector3 ≃ₗ[Dyadic] Vector3 := + (matrixAction g.1).trans (LinearEquiv.smulOfUnit (dyadicTwo ^ g.2.toAdd)) + +noncomputable def groupAction : + (SL3Z × Multiplicative ℤ) →* MulAut (Multiplicative Vector3) where + toFun g := AddEquiv.toMultiplicative (dilationAction g).toAddEquiv + map_one' := by + ext v i + simp [dilationAction, matrixAction, LinearEquiv.smulOfUnit] + map_mul' g h := by + ext v i + simp [dilationAction, matrixAction, LinearEquiv.smulOfUnit, zpow_add, + map_mul, mul_smul, Units.smul_def, mul_left_comm] + +/-- The exact group of the semidirect-product construction. -/ +abbrev G := SemidirectProduct (Multiplicative Vector3) + (SL3Z × Multiplicative ℤ) groupAction + +section UltrapowerDefinition +variable (B : Type u) [CStarAlgebra B] (ω : Ultrafilter ℕ) + +/-- Bounded sequences, with their supremum norm. N is discrete. -/ +abbrev BoundedSeq := BoundedContinuousFunction ℕ B + +/-- Equality modulo I_omega(B). This is equivalent to norm-null difference. -/ +def ultraRel (x y : BoundedSeq B) : Prop := + Tendsto (fun n => x n - y n) (ω : Filter ℕ) (𝓝 0) + +/-- The ring congruence defining the norm (not algebraic) ultrapower. -/ +def ultraCon : RingCon (BoundedSeq B) where + r := ultraRel B ω + iseqv := { + refl := fun x => by simp [ultraRel] + symm := fun {x y} h => by + simpa only [ultraRel, neg_sub, neg_zero] using h.neg + trans := fun {x y z} hxy hyz => by + simpa only [ultraRel, sub_add_sub_cancel, zero_add] using hxy.add hyz } + add' := by + intro x y z t hxy hzt + simpa only [ultraRel, BoundedContinuousFunction.add_apply, ← add_sub_add_comm, zero_add] + using hxy.add hzt + mul' := by + intro x y z t hxy hzt + have h₁ := hxy.zero_mul_isBoundedUnder_le (Filter.isBoundedUnder_of ⟨‖z‖, fun index => z.norm_coe_le_norm index⟩) + have h₂ := Filter.isBoundedUnder_le_mul_tendsto_zero (Filter.isBoundedUnder_of ⟨‖y‖, fun index => y.norm_coe_le_norm index⟩) hzt + simpa only [ultraRel, BoundedContinuousFunction.mul_apply, sub_mul, mul_sub, + sub_add_sub_cancel, zero_add] using h₁.add h₂ + +/-- The exact quotient l-infinity(N,B)/I_omega(B) as a complex star algebra. +The quotient identifies sequences whose difference tends to zero along the ultrafilter. -/ +abbrev NormUltrapower := (ultraCon B ω).Quotient + +instance : Star (NormUltrapower B ω) where + star := Quotient.map' star (fun first second hypothesis => by + change ultraRel B ω (star first) (star second) + simpa only [ultraRel, star_sub, star_zero, BoundedContinuousFunction.star_apply] using hypothesis.star) + +instance : StarRing (NormUltrapower B ω) where + star_involutive := by + intro x + induction x using Quotient.inductionOn with | h x => + exact congrArg Quotient.mk'' (star_star x) + star_mul := by + intro x y + induction x using Quotient.inductionOn with | h x => + induction y using Quotient.inductionOn with | h y => + exact congrArg Quotient.mk'' (star_mul x y) + star_add := by + intro x y + induction x using Quotient.inductionOn with | h x => + induction y using Quotient.inductionOn with | h y => + exact congrArg Quotient.mk'' (star_add x y) + +instance : StarModule ℂ (NormUltrapower B ω) where + star_smul := by + intro c x + induction x using Quotient.inductionOn with | h x => + exact congrArg Quotient.mk'' (star_smul c x) + +/-- Freeness: no finite subset of N belongs to the ultrafilter. -/ +def IsFree (ω : Ultrafilter ℕ) : Prop := + ∀ F : Finset ℕ, (F : Set ℕ) ∉ (ω : Filter ℕ) + +end UltrapowerDefinition + +/-- A bundled complex Hilbert space, without any separability assumption. -/ +structure ComplexHilbert where + carrier : Type u + [normed : NormedAddCommGroup carrier] + [inner : InnerProductSpace ℂ carrier] + [complete : CompleteSpace carrier] + +attribute [instance] ComplexHilbert.normed ComplexHilbert.inner ComplexHilbert.complete +instance : CoeSort ComplexHilbert (Type u) := ⟨ComplexHilbert.carrier⟩ + +section TensorNormDefinitions +variable {B : Type u} {C : Type v} [NonUnitalCStarAlgebra B] [NonUnitalCStarAlgebra C] + +/-- Spatial evaluation of the algebraic tensor product on separate Hilbert spaces. +Its operator norm is unchanged on the Hilbert completion. -/ +def spatialEval (H K : ComplexHilbert.{w}) + (ρ : B →⋆ₙₐ[ℂ] (H →L[ℂ] H)) (σ : C →⋆ₙₐ[ℂ] (K →L[ℂ] K)) : + B ⊗[ℂ] C →ₗ[ℂ] ((H ⊗[ℂ] K) →L[ℂ] (H ⊗[ℂ] K)) := + TensorProduct.lift (LinearMap.mk₂ ℂ (fun b c => TensorProduct.mapL (ρ b) (σ c)) + (by intros; simp [TensorProduct.mapL_add_left]) + (by intros; simp [TensorProduct.mapL_smul_left]) + (by intros; simp [TensorProduct.mapL_add_right]) + (by intros; simp [TensorProduct.mapL_smul_right])) + +/-- Evaluation on one Hilbert space; used only when the two ranges commute. -/ +def commutingEval (H : ComplexHilbert.{w}) + (ρ : B →⋆ₙₐ[ℂ] (H →L[ℂ] H)) (σ : C →⋆ₙₐ[ℂ] (H →L[ℂ] H)) : + B ⊗[ℂ] C →ₗ[ℂ] (H →L[ℂ] H) := + (LinearMap.mul' ℂ (H →L[ℂ] H)).comp + (TensorProduct.map + (show B →ₗ[ℂ] (H →L[ℂ] H) from + { toFun := ρ, map_add' := map_add ρ, map_smul' := map_smul ρ }) + (show C →ₗ[ℂ] (H →L[ℂ] H) from + { toFun := σ, map_add' := map_add σ, map_smul' := map_smul σ })) + +/-- The minimal C*-tensor norm: supremum over spatial representations. -/ +def minTensorNorm (x : B ⊗[ℂ] C) : ℝ := + sSup {r | ∃ (H K : ComplexHilbert.{w}) + (ρ : B →⋆ₙₐ[ℂ] (H →L[ℂ] H)) (σ : C →⋆ₙₐ[ℂ] (K →L[ℂ] K)), + r = ‖spatialEval H K ρ σ x‖} + +/-- The maximal C*-tensor norm: supremum over commuting representations. -/ +def maxTensorNorm (x : B ⊗[ℂ] C) : ℝ := + sSup {r | ∃ (H : ComplexHilbert.{w}) + (ρ : B →⋆ₙₐ[ℂ] (H →L[ℂ] H)) (σ : C →⋆ₙₐ[ℂ] (H →L[ℂ] H)), + (∀ b c, Commute (ρ b) (σ c)) ∧ r = ‖commutingEval H ρ σ x‖} + +/-- Nuclearity in the tensor-norm convention of the tensor-norm formulation. +The second C*-algebra need not be unital, nonzero, or separable. -/ +def IsNuclear (B : Type u) [NonUnitalCStarAlgebra B] : Prop := + ∀ (C : Type v) [NonUnitalCStarAlgebra C] (x : B ⊗[ℂ] C), + minTensorNorm.{u, v, max u v} x = maxTensorNorm.{u, v, max u v} x +end TensorNormDefinitions + +/-- A nonzero unital complex C*-algebra. -/ +structure UnitalCStar where + carrier : Type u + [cstar : CStarAlgebra carrier] + [nontrivial : Nontrivial carrier] +attribute [instance] UnitalCStar.cstar UnitalCStar.nontrivial +instance : CoeSort UnitalCStar (Type u) := ⟨UnitalCStar.carrier⟩ + +/-- The universal property defining the full, not the reduced, group C*-algebra. +The dense generation clause makes the intended completion explicit. +This is definition data, not a hypothesis silently supplied to the main claim. -/ +def IsFullGroupAlgebra (A : UnitalCStar.{u}) (ι : G →* unitary A) : Prop := + Dense (Submodule.span ℂ (Set.range (fun g => (ι g : A))) : Set A) ∧ + ∀ (D : UnitalCStar.{u}) (ρ : G →* unitary D), + ∃! φ : A →⋆ₐ[ℂ] D, ∀ g, φ (ι g) = (ρ g : D) + +/-- The two Cuntz relations, including unit preservation explicitly. -/ +def CuntzTwoRelations {D : Type u} [CStarAlgebra D] (s : Fin 2 → D) : Prop := + (∀ i, star (s i) * s i = 1) ∧ ∑ i, s i * star (s i) = 1 + +/-- The universal nonzero unital C*-algebra on the two Cuntz isometries. -/ +def IsCuntzTwoAlgebra (O : UnitalCStar.{u}) (s : Fin 2 → O) : Prop := + CuntzTwoRelations s ∧ + ∀ (D : UnitalCStar.{u}) (r : Fin 2 → D), CuntzTwoRelations r → + ∃! φ : O →⋆ₐ[ℂ] D, ∀ i, φ (s i) = r i + +/-- The manuscript's main statement including its explicitly stated O_2 +corollary. Both universal C*-algebras must be constructed to prove this. -/ +def MainStatementWithCuntzCorollary : Prop := + ∃ (A : UnitalCStar.{u}) (ι : G →* unitary A), + IsFullGroupAlgebra A ι ∧ TopologicalSpace.SeparableSpace A ∧ + (∀ (B : UnitalCStar.{u}), IsNuclear.{u, u} B → + ∀ (ω : Ultrafilter ℕ), IsFree ω → + ¬ ∃ φ : A →⋆ₐ[ℂ] NormUltrapower B ω, Function.Injective φ) ∧ + ∃ (O : UnitalCStar.{u}) (s : Fin 2 → O), IsCuntzTwoAlgebra O s ∧ + ∀ (ω : Ultrafilter ℕ), IsFree ω → + ¬ ∃ φ : A →⋆ₐ[ℂ] NormUltrapower O ω, Function.Injective φ + +end NuclearUltrapower +end + +namespace NuclearUltrapower + +/-- The full dyadic group C*-algebra has no nuclear norm-ultrapower embedding, +including the corollary for the universal Cuntz algebra on two isometries. -/ +theorem main_no_embedding : MainStatementWithCuntzCorollary.{0} := by + sorry + +end NuclearUltrapower + +end OAI diff --git a/lean/ComparatorChallenges/OccupiedOverlap.json b/lean/ComparatorChallenges/OccupiedOverlap.json new file mode 100644 index 0000000000000000000000000000000000000000..cdfa3b6abaf6bc27138e92ab541a58f4dafcfc91 --- /dev/null +++ b/lean/ComparatorChallenges/OccupiedOverlap.json @@ -0,0 +1,21 @@ +{ + "challenge_module": "ComparatorChallenges.OccupiedOverlap", + "solution_module": "OAI.RepresentationTheory.RowColumn.Occupied", + "theorem_names": [ + "OAI.RowColumn.occupied_overlap_endpoint", + "OAI.RowColumn.occupied_overlap" + ], + "definition_names": [ + "OAI.CubeShuffle.UnitaryFinite.IsUnitary", + "OAI.CubeShuffle.Specht.hilbertSpace", + "OAI.CubeShuffle.Specht.unitaryRepresentation", + "OAI.CubeShuffle.Specht.relabelledUnitary", + "OAI.RowColumn.OccupiedOverlapEndpoint" + ], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/OccupiedOverlap.lean b/lean/ComparatorChallenges/OccupiedOverlap.lean new file mode 100644 index 0000000000000000000000000000000000000000..32ec457c2e676c6a0be32d5b96c7222ea095a27b --- /dev/null +++ b/lean/ComparatorChallenges/OccupiedOverlap.lean @@ -0,0 +1,266 @@ +import Mathlib + +namespace OAI + +namespace CubeShuffle.Specht + +open scoped BigOperators Classical + +abbrev Cell (μ : YoungDiagram) := {x : ℕ × ℕ // x ∈ μ.cells} +def row {μ : YoungDiagram} (x : Cell μ) : ℕ := x.1.1 +def col {μ : YoungDiagram} (x : Cell μ) : ℕ := x.1.2 + +lemma row_lt_colLen {μ : YoungDiagram} (x : Cell μ) : row x < μ.colLen (col x) := + YoungDiagram.mem_iff_lt_colLen.mp x.2 +noncomputable def rowIndex {μ : YoungDiagram} (x : Cell μ) : Fin (μ.colLen 0) := + ⟨row x, (row_lt_colLen x).trans_le (μ.colLen_anti 0 (col x) (Nat.zero_le _))⟩ + +abbrev Tabloid (μ : YoungDiagram) := + {f : Cell μ → Fin (μ.colLen 0) // ∃ p : Equiv.Perm (Cell μ), f = rowIndex ∘ p} + +noncomputable instance (μ : YoungDiagram) : Fintype (Tabloid μ) := Fintype.ofFinite _ + +noncomputable def baseTabloid (μ : YoungDiagram) : Tabloid μ := ⟨rowIndex, 1, rfl⟩ + +noncomputable def tabloidAct {μ : YoungDiagram} (p : Equiv.Perm (Cell μ)) : + Equiv.Perm (Tabloid μ) where + toFun f := ⟨fun x => f.1 (p⁻¹ x), by + obtain ⟨q,hq⟩ := f.2 + refine ⟨q*p⁻¹, ?_⟩ + funext x + simp only [hq,Function.comp_apply,Equiv.Perm.mul_apply]⟩ + invFun f := ⟨fun x => f.1 (p x), by + obtain ⟨q,hq⟩ := f.2 + refine ⟨q*p, ?_⟩ + funext x + simp only [hq,Function.comp_apply,Equiv.Perm.mul_apply]⟩ + left_inv f := by apply Subtype.ext; funext x; simp + right_inv f := by apply Subtype.ext; funext x; simp + +@[simp] lemma tabloidAct_apply {μ : YoungDiagram} (p : Equiv.Perm (Cell μ)) + (f : Tabloid μ) (x : Cell μ) : (tabloidAct p f).1 x = f.1 (p⁻¹ x) := rfl + +@[simp] lemma tabloidAct_one (μ : YoungDiagram) : tabloidAct (1 : Equiv.Perm (Cell μ)) = 1 := by + ext f x + rfl + +@[simp] lemma tabloidAct_mul {μ : YoungDiagram} (p q : Equiv.Perm (Cell μ)) : + tabloidAct (p*q) = tabloidAct p * tabloidAct q := by + ext f x + simp only [tabloidAct_apply, mul_inv_rev,Equiv.Perm.mul_apply] + +@[simp] lemma tabloidAct_inv {μ : YoungDiagram} (p : Equiv.Perm (Cell μ)) : + tabloidAct p⁻¹ = (tabloidAct p)⁻¹ := by + ext f x + simp [tabloidAct,Equiv.Perm.inv_def] + +noncomputable def tabloidRep (μ : YoungDiagram) : + Representation ℂ (Equiv.Perm (Cell μ)) (Tabloid μ → ℂ) where + toFun p := + { toFun := fun v f => v (tabloidAct p⁻¹ f) + map_add' := by intros; rfl + map_smul' := by intros; rfl } + map_one' := by ext v f; simp + map_mul' p q := by + ext v f + simp only [mul_inv_rev,tabloidAct_mul,Equiv.Perm.mul_apply] + rfl + +@[simp] lemma tabloidRep_apply {μ : YoungDiagram} (p : Equiv.Perm (Cell μ)) + (v : Tabloid μ → ℂ) (f : Tabloid μ) : tabloidRep μ p v f = v (tabloidAct p⁻¹ f) := rfl + +noncomputable def delta {μ : YoungDiagram} (f : Tabloid μ) : Tabloid μ → ℂ := + fun g => if g=f then 1 else 0 + +noncomputable def colGroup (μ : YoungDiagram) : Subgroup (Equiv.Perm (Cell μ)) where + carrier := {p | ∀ x, col (p x) = col x} + one_mem' := by intro x; rfl + mul_mem' := by intro p q hp hq x; exact (hp (q x)).trans (hq x) + inv_mem' := by intro p hp x; simpa using (hp (p⁻¹ x)).symm + +noncomputable def permSign {α : Type*} [Fintype α] [DecidableEq α] (p : Equiv.Perm α) : ℂ := + ((Equiv.Perm.sign p : ℤ) : ℂ) +section Alternator +variable {α V : Type*} [Fintype α] [DecidableEq α] [AddCommGroup V] [Module ℂ V] + +noncomputable def alternator (C : Subgroup (Equiv.Perm α)) + (ρ : Representation ℂ (Equiv.Perm α) V) : Module.End ℂ V := by + classical + exact ∑ c : C, permSign (c : Equiv.Perm α) • ρ c + +end Alternator + +noncomputable def polytabloid (μ : YoungDiagram) : Tabloid μ → ℂ := + alternator (colGroup μ) (tabloidRep μ) (delta (baseTabloid μ)) + +noncomputable def space (μ : YoungDiagram) : Submodule ℂ (Tabloid μ → ℂ) := + Submodule.span ℂ (Set.range (fun p : Equiv.Perm (Cell μ) => tabloidRep μ p (polytabloid μ))) + +lemma orbit_mem_space (μ : YoungDiagram) (p : Equiv.Perm (Cell μ)) : + tabloidRep μ p (polytabloid μ) ∈ space μ := Submodule.subset_span ⟨p,rfl⟩ + +lemma action_mem_space (μ : YoungDiagram) (p : Equiv.Perm (Cell μ)) + (v : Tabloid μ → ℂ) (hv : v ∈ space μ) : tabloidRep μ p v ∈ space μ := by + induction hv using Submodule.span_induction with + | mem v hv => + obtain ⟨q,rfl⟩ := hv + change ((tabloidRep μ p)*(tabloidRep μ q)) (polytabloid μ) ∈ space μ + rw [←map_mul] + exact orbit_mem_space μ (p*q) + | zero => simp + | add v w hv hw ihv ihw => simpa using (space μ).add_mem ihv ihw + | smul a v hv ih => simpa using (space μ).smul_mem a ih + +noncomputable def subrepresentation (μ : YoungDiagram) : Subrepresentation (tabloidRep μ) := + ⟨space μ, fun p v hv => action_mem_space μ p v hv⟩ + +noncomputable def representation (μ : YoungDiagram) : + Representation ℂ (Equiv.Perm (Cell μ)) (space μ) := + (subrepresentation μ).toRepresentation + +end CubeShuffle.Specht + +namespace CubeShuffle.PermutationHilbert + +open scoped BigOperators ComplexConjugate Classical +open Complex + +variable {X : Type*} [Fintype X] + +abbrev H (X : Type*) [Fintype X] := EuclideanSpace ℂ X + +end CubeShuffle.PermutationHilbert + +namespace CubeShuffle.Specht + +open scoped BigOperators Classical + +noncomputable def hilbertEquiv (μ : YoungDiagram) : + (Tabloid μ → ℂ) ≃ₗ[ℂ] PermutationHilbert.H (Tabloid μ) := + (WithLp.linearEquiv 2 ℂ (Tabloid μ → ℂ)).symm + +noncomputable def hilbertSpace (μ : YoungDiagram) : + Submodule ℂ (PermutationHilbert.H (Tabloid μ)) := (space μ).map (hilbertEquiv μ).toLinearMap + +noncomputable def spaceHilbertEquiv (μ : YoungDiagram) : space μ ≃ₗ[ℂ] hilbertSpace μ := + (hilbertEquiv μ).submoduleMap (space μ) + +noncomputable def unitaryRepresentation (μ : YoungDiagram) : + Representation ℂ (Equiv.Perm (Cell μ)) (hilbertSpace μ) := + ((spaceHilbertEquiv μ).conjAlgEquiv ℂ).toMonoidHom.comp (representation μ) + +variable {α ι : Type*} [Fintype α] [Fintype ι] + +noncomputable def relabelledUnitary (μ : YoungDiagram) (e : α ≃ Cell μ) : + Representation ℂ (Equiv.Perm α) (hilbertSpace μ) := + (unitaryRepresentation μ).comp e.permCongrHom.toMonoidHom + +end CubeShuffle.Specht + +namespace CubeShuffle.UnitaryFinite + +open scoped BigOperators ComplexConjugate Classical + +variable {G : Type*} [Group G] [Fintype G] +variable {V W : Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] + [FiniteDimensional ℂ V] [NormedAddCommGroup W] [InnerProductSpace ℂ W] + [FiniteDimensional ℂ W] + +def IsUnitary (ρ : Representation ℂ G V) : Prop := + ∀ g v w, inner ℂ (ρ g v) (ρ g w) = inner ℂ v w + +end CubeShuffle.UnitaryFinite + +noncomputable section + +open scoped BigOperators Classical + +namespace RowColumn +open CubeShuffle CubeShuffle.Specht CubeShuffle.UnitaryFinite + +/-- Permutations preserving each fibre of a given line map. -/ +def lineGroup {α β : Type*} (f : α → β) : Subgroup (Equiv.Perm α) where + carrier := {g | ∀ x, f (g x) = f x} + one_mem' := by intro x; rfl + mul_mem' := by + intro a b ha hb x + exact (ha (b x)).trans (hb x) + inv_mem' := by + intro a ha x + simpa using (ha (a⁻¹ x)).symm + +abbrev Board (m n : ℕ) := Fin m × Fin n +abbrev rowGroup {m n : ℕ} (Ω : Finset (Board m n)) := + lineGroup (fun x : Ω => x.1.1) +abbrev columnGroup {m n : ℕ} (Ω : Finset (Board m n)) := + lineGroup (fun x : Ω => x.1.2) + +/-- Zero-based form of the manuscript's (h,h)-hook. -/ +def InHook (a : YoungDiagram) (h : ℕ) : Prop := + ∀ c ∈ a.cells, c.1 < h ∨ c.2 < h + +section Copies +variable {G V W : Type*} [Group G] + [NormedAddCommGroup V] [InnerProductSpace ℂ V] [FiniteDimensional ℂ V] + [NormedAddCommGroup W] [InnerProductSpace ℂ W] [FiniteDimensional ℂ W] + +/-- An actual equivariant inclusion, not an unspecified overlap matrix. -/ +def Intertwines (ρ : Representation ℂ G V) (τ : Representation ℂ G W) + (I : V →ₗ[ℂ] W) : Prop := + ∀ g v, I (ρ g v) = τ g (I v) + +/-- All orthogonal multiplicity copies of one irreducible type. The completeness +condition quantifies over genuine intertwiners, i.e. it is exactly the isotypic +space condition. -/ +def CompleteCopies (ρ : Representation ℂ G V) (τ : Representation ℂ G W) + {u : ℕ} (I : Fin u → V →ₗᵢ[ℂ] W) : Prop := + (∀ i, Intertwines ρ τ (I i).toLinearMap) ∧ + (∀ i j, i ≠ j → ∀ v w, inner ℂ (I i v) (I j w) = 0) ∧ + ∀ J : V →ₗ[ℂ] W, Intertwines ρ τ J → + LinearMap.range J ≤ ⨆ i, LinearMap.range (I i).toLinearMap + +end Copies + +/-- The all-copy operator-overlap sum, with each squared operator norm. -/ +def allCopyOverlap {V W X : Type*} + [NormedAddCommGroup V] [InnerProductSpace ℂ V] [FiniteDimensional ℂ V] + [NormedAddCommGroup W] [InnerProductSpace ℂ W] [FiniteDimensional ℂ W] + [NormedAddCommGroup X] [InnerProductSpace ℂ X] [FiniteDimensional ℂ X] + {u v : ℕ} (I : Fin u → V →ₗᵢ[ℂ] X) (J : Fin v → W →ₗᵢ[ℂ] X) : ℝ := + ∑ i, ∑ j, ‖((I i).toContinuousLinearMap.adjoint).comp + (J j).toContinuousLinearMap‖ ^ 2 + +/-- Exact occupied-board main. Carriers are in orthonormal coordinates; arbitrary +unitary irreducibles of the two actual line groups are quantified over (equivalently, +the tuples of line partitions in the manuscript). Labelling `e` chooses the action +of the Specht module on the occupied cells and forces |a| = |Ω|. -/ +abbrev OccupiedOverlapEndpoint : Prop := + ∃ C : ℝ, 0 < C ∧ ∀ (m n : ℕ) (Ω : Finset (Board m n)) + (a : YoungDiagram) (e : Ω ≃ Cell a) (h : ℕ), + 1 ≤ h → h ≤ m * n → InHook a h → + ∀ (r c u v : ℕ) + (ρ : Representation ℂ (rowGroup Ω) (EuclideanSpace ℂ (Fin r))) + (τ : Representation ℂ (columnGroup Ω) (EuclideanSpace ℂ (Fin c))), + Representation.IsIrreducible ρ → Representation.IsIrreducible τ → + IsUnitary ρ → IsUnitary τ → + ∀ (I : Fin u → EuclideanSpace ℂ (Fin r) →ₗᵢ[ℂ] hilbertSpace a) + (J : Fin v → EuclideanSpace ℂ (Fin c) →ₗᵢ[ℂ] hilbertSpace a), + CompleteCopies (V := EuclideanSpace ℂ (Fin r)) (W := hilbertSpace a) ρ ((relabelledUnitary a e).comp (rowGroup Ω).subtype) I → + CompleteCopies (V := EuclideanSpace ℂ (Fin c)) (W := hilbertSpace a) τ ((relabelledUnitary a e).comp (columnGroup Ω).subtype) J → + allCopyOverlap (V := EuclideanSpace ℂ (Fin r)) (W := EuclideanSpace ℂ (Fin c)) + (X := hilbertSpace a) I J ≤ + Real.exp (C * (((m + n + 1 : ℕ) : ℝ) * (h : ℝ)^2 * + Real.log ((m * n : ℕ) + 2) + (m * n - Ω.card : ℕ))) * + min 1 ((r : ℝ) * c / Module.finrank ℂ (space a)) + +end RowColumn + +end + +theorem RowColumn.occupied_overlap_endpoint : RowColumn.OccupiedOverlapEndpoint := by + sorry + +theorem RowColumn.occupied_overlap : RowColumn.OccupiedOverlapEndpoint := by + sorry + +end OAI diff --git a/lean/ComparatorChallenges/OddKaplansky.json b/lean/ComparatorChallenges/OddKaplansky.json new file mode 100644 index 0000000000000000000000000000000000000000..9b0b049b08448c310984913e8cf0af637f19f3d4 --- /dev/null +++ b/lean/ComparatorChallenges/OddKaplansky.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.OddKaplansky", + "solution_module": "OAI.Algebra.OddKaplansky.Main", + "theorem_names": [ + "OAI.OddKaplansky.main_theorem" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/OddKaplansky.lean b/lean/ComparatorChallenges/OddKaplansky.lean new file mode 100644 index 0000000000000000000000000000000000000000..6599090468963d820e62f8313fb66233f6d55bfa --- /dev/null +++ b/lean/ComparatorChallenges/OddKaplansky.lean @@ -0,0 +1,33 @@ +import Mathlib + +namespace OAI + +namespace OddKaplansky + +@[irreducible] def sourceM : ℕ := Nat.choose 1200 600 +@[irreducible] def sourcePrime : ℕ := Nat.minFac ((Nat.factorial sourceM)^2 + 1) + +noncomputable section + +def cellular {K G : Type} [Field K] [Group G] + (d : MonoidAlgebra K G) (x : G → K) (g : G) : K := + d.coeff.sum fun u c => c * x (g * u) + +def MainClaim : Prop := + sourcePrime.Prime ∧ Odd sourcePrime ∧ + ∃ (K : Type) (_ : Field K) (_ : Fintype K) (_ : CharP K sourcePrime), + Fintype.card K = sourcePrime^4 ∧ + ∃ (G : Type) (_ : Group G) (_ : Group.FG G), + (∃ g : G, g ≠ 1 ∧ IsOfFinOrder g) ∧ + ∃ a b : MonoidAlgebra K G, + a * b = 1 ∧ b * a ≠ 1 ∧ + Function.Injective (cellular b) ∧ ¬ Function.Surjective (cellular b) + +theorem main_theorem : MainClaim := by + sorry + +end + +end OddKaplansky + +end OAI diff --git a/lean/ComparatorChallenges/OneWayLiveness.json b/lean/ComparatorChallenges/OneWayLiveness.json new file mode 100644 index 0000000000000000000000000000000000000000..e3fe278de13820ccc5e916115e9426aff2b8fb5d --- /dev/null +++ b/lean/ComparatorChallenges/OneWayLiveness.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.OneWayLiveness", + "solution_module": "OAI.Combinatorics.Automata.Main", + "theorem_names": [ + "OAI.OneWayLiveness.main_theorem" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/OneWayLiveness.lean b/lean/ComparatorChallenges/OneWayLiveness.lean new file mode 100644 index 0000000000000000000000000000000000000000..b1895c1f64b7284fe7f920d9967bd236bd49ea67 --- /dev/null +++ b/lean/ComparatorChallenges/OneWayLiveness.lean @@ -0,0 +1,105 @@ +import Mathlib + +namespace OAI + +namespace OneWayLiveness + +@[ext] structure BRel (H : Type*) where + holds : H → H → Prop + +namespace BRel +variable {H : Type*} +instance : One (BRel H) := ⟨⟨Eq⟩⟩ +instance : Mul (BRel H) := ⟨fun a b => ⟨fun x z => ∃ y, a.holds x y ∧ b.holds y z⟩⟩ +instance : Monoid (BRel H) where + mul_assoc a b c := by + ext x z + change (∃ y, (∃ w, a.holds x w ∧ b.holds w y) ∧ c.holds y z) ↔ + ∃ w, a.holds x w ∧ ∃ y, b.holds w y ∧ c.holds y z + aesop + one_mul a := by ext x z; change (∃ y, x = y ∧ a.holds y z) ↔ a.holds x z; simp + mul_one a := by ext x z; change (∃ y, a.holds x y ∧ y = z) ↔ a.holds x z; simp + +/-- Nonemptiness is the existence of a path through the word's ordered product. -/ +def live (w : List (BRel H)) : Prop := ∃ x y, w.prod.holds x y +end BRel + +abbrev Alphabet (h : ℕ) := BRel (Fin h) +def OWL (h : ℕ) : Set (List (Alphabet h)) := {w | BRel.live w} + +inductive Symbol (Alpha : Type*) where + | left : Symbol Alpha + | letter : Alpha → Symbol Alpha + | right : Symbol Alpha + +inductive Move where + | left | stay | right + deriving DecidableEq + +def Move.Rel : Move → ℕ → ℕ → Prop + | .left, i, j => j + 1 = i + | .stay, i, j => j = i + | .right, i, j => j = i + 1 + +/-- The finite word including both endmarkers. -/ +def scanned {Alpha : Type*} (w : List Alpha) (i : Fin (w.length + 2)) : Symbol Alpha := + if h0 : i.val = 0 then .left + else if hi : i.val < w.length + 1 then .letter (w[i.val - 1]'(by omega)) + else .right + +abbrev Configuration {Alpha : Type*} (w : List Alpha) (n : ℕ) := Fin (w.length + 2) × Fin n + +structure DMachine (Alpha : Type*) (s : ℕ) where + initial : Fin s + accepting : Set (Fin s) + transition : Fin s → Symbol Alpha → Option (Fin s × Move) + left_boundary : ∀ q q', transition q .left ≠ some (q', .left) + right_boundary : ∀ q q', transition q .right ≠ some (q', .right) + +structure NMachine (Alpha : Type*) (n : ℕ) where + initial : Fin n + accepting : Set (Fin n) + transition : Fin n → Symbol Alpha → Set (Fin n × Move) + left_boundary : ∀ q q', (q', .left) ∉ transition q .left + right_boundary : ∀ q q', (q', .right) ∉ transition q .right + +def DMachine.Step {Alpha : Type*} {s : ℕ} (M : DMachine Alpha s) (w : List Alpha) + (c c' : Configuration w s) : Prop := + ∃ d, M.transition c.2 (scanned w c.1) = some (c'.2, d) ∧ d.Rel c.1.val c'.1.val + +def NMachine.Step {Alpha : Type*} {n : ℕ} (M : NMachine Alpha n) (w : List Alpha) + (c c' : Configuration w n) : Prop := + ∃ d, (c'.2, d) ∈ M.transition c.2 (scanned w c.1) ∧ d.Rel c.1.val c'.1.val + +/-- The positive convention explicitly excludes a length-zero computation. -/ +def FiniteRun {C : Type*} (positive : Bool) (step : C → C → Prop) (c c' : C) : Prop := + if positive then Relation.TransGen step c c' else Relation.ReflTransGen step c c' + +def DMachine.Accepts {Alpha : Type*} {s : ℕ} (M : DMachine Alpha s) + (positive : Bool) (w : List Alpha) : Prop := + ∃ c, FiniteRun positive (M.Step w) (⟨0, by omega⟩, M.initial) c ∧ c.2 ∈ M.accepting + +def NMachine.Accepts {Alpha : Type*} {n : ℕ} (M : NMachine Alpha n) + (positive : Bool) (w : List Alpha) : Prop := + ∃ c, FiniteRun positive (M.Step w) (⟨0, by omega⟩, M.initial) c ∧ c.2 ∈ M.accepting + +def NMachine.NoLeft {Alpha : Type*} {n : ℕ} (M : NMachine Alpha n) : Prop := + ∀ q a q', (q', Move.left) ∉ M.transition q a + +def NMachine.Recognizes {Alpha : Type*} {n : ℕ} (M : NMachine Alpha n) + (positive : Bool) (L : Set (List Alpha)) : Prop := ∀ w, M.Accepts positive w ↔ w ∈ L + +def DMachine.Recognizes {Alpha : Type*} {s : ℕ} (M : DMachine Alpha s) + (positive : Bool) (L : Set (List Alpha)) : Prop := ∀ w, M.Accepts positive w ↔ w ∈ L + +theorem main_theorem (h : ℕ) (hh : 2 ≤ h) : + (∃ N : NMachine (Alphabet h) (h + 3), N.NoLeft ∧ + ∀ positive : Bool, N.Recognizes positive (OWL h)) ∧ + (∀ (positive : Bool) (s : ℕ) (D : DMachine (Alphabet h) s), + D.Recognizes positive (OWL h) → + 2 ^ ((h - 2) / 31) ≤ 4 * (s + if positive then 2 else 1) ^ 2) := by + sorry + +end OneWayLiveness + +end OAI diff --git a/lean/ComparatorChallenges/OptimalMaxCut.json b/lean/ComparatorChallenges/OptimalMaxCut.json new file mode 100644 index 0000000000000000000000000000000000000000..f33d3ea92b14827b02eb4653bb74187eb108b8d0 --- /dev/null +++ b/lean/ComparatorChallenges/OptimalMaxCut.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.OptimalMaxCut", + "solution_module": "OAI.Computability.MaxCut.Main", + "theorem_names": [ + "OAI.OptimalMaxCut.main" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/OptimalMaxCut.lean b/lean/ComparatorChallenges/OptimalMaxCut.lean new file mode 100644 index 0000000000000000000000000000000000000000..0e200abdca45813740899ec408377a275e9141e5 --- /dev/null +++ b/lean/ComparatorChallenges/OptimalMaxCut.lean @@ -0,0 +1,156 @@ +import Mathlib + +namespace OAI + +namespace MaxCutGames.BinaryFormula + +structure Literal where + name : Nat + positive : Bool + deriving DecidableEq + +def Literal.eval (literal : Literal) (assignment : Nat → Bool) : Bool := + if literal.positive then assignment literal.name else !(assignment literal.name) + +abbrev Clause := Vector Literal 3 + +def Clause.eval (clause : Clause) (assignment : Nat → Bool) : Bool := + (clause[0].eval assignment || clause[1].eval assignment) || clause[2].eval assignment + +/-- An ordinary conjunction of three-slot clauses with sparse variable names. +Repeated names and repeated literals are permitted in every clause. -/ +structure Formula where + clauses : List Clause + +def Formula.Satisfiable (F : Formula) : Prop := + ∃ assignment : Nat → Bool, ∀ clause ∈ F.clauses, clause.eval assignment = true + +end MaxCutGames.BinaryFormula + +namespace MaxCutGames.BinaryEncoding + +open BinaryFormula + +def bitsValue : List Bool → Nat + | [] => 0 + | b :: bits => Nat.bit b (bitsValue bits) + +/-- Prefix-free framing on the two-symbol input alphabet. -/ +def frame : List Bool → List Bool + | [] => [false] + | b :: bits => true :: b :: frame bits + +def parseFrame : List Bool → Option (List Bool × List Bool) + | false :: rest => some ([], rest) + | true :: b :: rest => do + let (bits, trailing) ← parseFrame rest + return (b :: bits, trailing) + | _ => none + +def nameBits (name : Nat) : List Bool := frame name.bits + +/-- Equality with the canonical digits rejects alternate padded encodings. -/ +def parseName (input : List Bool) : Option (Nat × List Bool) := do + let (digits, rest) ← parseFrame input + let name := bitsValue digits + if digits = name.bits then some (name, rest) else none + +def parseLiteral : List Bool → Option (Literal × List Bool) + | sign :: input => do + let (name, rest) ← parseName input + return (⟨name, sign⟩, rest) + | [] => none + +def parseClause (input : List Bool) : Option (Clause × List Bool) := do + let (a, input) ← parseLiteral input + let (b, input) ← parseLiteral input + let (c, rest) ← parseLiteral input + return (#v[a, b, c], rest) + +/-- Fuel bounds the number of clause iterations, not the size of any name. -/ +def parseClauses : Nat → List Bool → Option (List Clause × List Bool) + | 0, _ => none + | _ + 1, false :: rest => some ([], rest) + | fuel + 1, true :: input => do + let (clause, input) ← parseClause input + let (clauses, rest) ← parseClauses fuel input + return (clause :: clauses, rest) + | _ + 1, [] => none + +def decodeFormula (input : List Bool) : Option Formula := do + let (clauses, rest) ← parseClauses (input.length + 1) input + if rest = [] then some ⟨clauses⟩ else none + +end MaxCutGames.BinaryEncoding + +namespace OptimalMaxCut + +open scoped BigOperators + +/-- The exact Goemans–Williamson ratio, as an infimum over -1 ≤ ρ < 1. -/ +noncomputable def alphaGW : ℝ := + sInf ((fun ρ : ℝ => 2 * Real.arccos ρ / (Real.pi * (1 - ρ))) '' + Set.Ico (-1 : ℝ) 1) + +/-- The ordinary binary 3SAT language, including rejection of malformed words. -/ +def binary3SAT (input : List Bool) : Prop := + ∃ formula, MaxCutGames.BinaryEncoding.decodeFormula input = some formula ∧ + formula.Satisfiable + +/-- A finite simple unweighted graph with its full Boolean adjacency table. -/ +structure Graph where + vertices : ℕ + adj : Fin vertices → Fin vertices → Bool + symmetric : ∀ u v, adj u v = adj v u + loopless : ∀ u, adj u u = false + +/-- Each unordered distinct edge crossing the cut is counted exactly once. -/ +def Graph.cutSize (G : Graph) (cut : Fin G.vertices → Bool) : ℕ := + ∑ u : Fin G.vertices, ∑ v : Fin G.vertices, + if u < v ∧ G.adj u v = true ∧ cut u ≠ cut v then 1 else 0 + +/-- The maximum over all Boolean cuts of the finite vertex set. -/ +def Graph.maxCut (G : Graph) : ℕ := + (Finset.univ.image G.cutSize).sup id + +/-- The positive integer scale Q is part of the output. It need not equal the +number of graph edges. -/ +structure ScaledGraph where + graph : Graph + scale : ℕ + scale_pos : 0 < scale + +/-- Canonical delimited binary vertex count and scale, followed by the full +adjacency table in lexicographic order. -/ +def ScaledGraph.bits (G : ScaledGraph) : List Bool := + MaxCutGames.BinaryEncoding.nameBits G.graph.vertices ++ + MaxCutGames.BinaryEncoding.nameBits G.scale ++ + (List.finRange G.graph.vertices).flatMap (fun u => + (List.finRange G.graph.vertices).map (fun v => G.graph.adj u v)) + +/-- The rational gap bounds and the finite machine are fixed before the input. +The bounds compare the maximum cut divided by the positive output scale. -/ +structure GapReduction (α : ℝ) where + yesBound : ℚ + noBound : ℚ + yes_pos : 0 < yesBound + no_nonneg : 0 ≤ noBound + gap : (noBound : ℝ) < α * (yesBound : ℝ) + construct : List Bool → ScaledGraph + computation : Turing.TM2ComputableInPolyTime (id : List Bool → List Bool) + ScaledGraph.bits construct + finiteAlphabet : ∀ k, Finite (computation.tm.Γ k) + completeness : ∀ input, binary3SAT input → + (yesBound : ℝ) ≤ ((construct input).graph.maxCut : ℝ) / (construct input).scale + soundness : ∀ input, ¬ binary3SAT input → + ((construct input).graph.maxCut : ℝ) / (construct input).scale ≤ (noBound : ℝ) + +def MainStatement : Prop := + ∀ α : ℝ, alphaGW < α → α ≤ 1 → Nonempty (GapReduction α) + +end OptimalMaxCut + +theorem OptimalMaxCut.main : OptimalMaxCut.MainStatement := by + sorry + +end OAI diff --git a/lean/ComparatorChallenges/OrdinaryElliott.json b/lean/ComparatorChallenges/OrdinaryElliott.json new file mode 100644 index 0000000000000000000000000000000000000000..cb4de1493992994f9b031eae8ab081fe02218964 --- /dev/null +++ b/lean/ComparatorChallenges/OrdinaryElliott.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.OrdinaryElliott", + "solution_module": "OAI.NumberTheory.OrdinaryCorrelations.Elliott.Main", + "theorem_names": [ + "OAI.OrdinaryCorrelations.binary_corrected_elliott" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/OrdinaryElliott.lean b/lean/ComparatorChallenges/OrdinaryElliott.lean new file mode 100644 index 0000000000000000000000000000000000000000..914f601065031ff59b509058cb3d9d709fd0b23e --- /dev/null +++ b/lean/ComparatorChallenges/OrdinaryElliott.lean @@ -0,0 +1,44 @@ +import Mathlib + +namespace OAI + +noncomputable section +open scoped BigOperators +open Filter + +namespace OrdinaryCorrelations + +def OneBounded (f : ℕ → ℂ) : Prop := ∀ n, ‖f n‖ ≤ 1 + +def Multiplicative (f : ℕ → ℂ) : Prop := + ∀ m n : ℕ, 0 < m → 0 < n → m.Coprime n → f (m * n) = f m * f n + +def distanceSq (f : ℕ → ℂ) {q : ℕ} (χ : DirichletCharacter ℂ q) + (t X : ℝ) : ℝ := + ∑ p ∈ (Finset.Icc 2 ⌊X⌋₊).filter Nat.Prime, + (1 - (f p * star (χ (p : ZMod q) * + Complex.exp ((t * Real.log (p : ℝ) : ℝ) * Complex.I))).re) / (p : ℝ) + +def distance (f : ℕ → ℂ) {q : ℕ} (χ : DirichletCharacter ℂ q) + (t X : ℝ) : ℝ := Real.sqrt (distanceSq f χ t X) + +def UniformlyNonpretentious (f : ℕ → ℂ) : Prop := + ∀ (q : ℕ), 0 < q → ∀ χ : DirichletCharacter ℂ q, + Tendsto (fun N : ℕ => sInf ((fun t : ℝ => distance f χ t (N : ℝ)) '' + Set.Icc (-(N : ℝ)) (N : ℝ))) atTop atTop + +def shiftAverage (f₁ f₂ : ℕ → ℂ) (h₁ h₂ N : ℕ) : ℂ := + (N : ℂ)⁻¹ * ∑ n ∈ Finset.Icc 1 N, f₁ (n + h₁) * f₂ (n + h₂) + +theorem binary_corrected_elliott + (f₁ f₂ : ℕ → ℂ) (hf₁ : OneBounded f₁) (hf₂ : OneBounded f₂) + (hm₁ : Multiplicative f₁) (hm₂ : Multiplicative f₂) + (hNP : UniformlyNonpretentious f₁ ∨ UniformlyNonpretentious f₂) + (h₁ h₂ : ℕ) (hne : h₁ ≠ h₂) : + Tendsto (shiftAverage f₁ f₂ h₁ h₂) atTop (nhds 0) := by + sorry + +end OrdinaryCorrelations +end + +end OAI diff --git a/lean/ComparatorChallenges/OrdinaryTwoPointCorrelations.json b/lean/ComparatorChallenges/OrdinaryTwoPointCorrelations.json new file mode 100644 index 0000000000000000000000000000000000000000..96dbfcd015da7bb0d32f30e17a3b8a6743bf1fe5 --- /dev/null +++ b/lean/ComparatorChallenges/OrdinaryTwoPointCorrelations.json @@ -0,0 +1,16 @@ +{ + "challenge_module": "ComparatorChallenges.OrdinaryTwoPointCorrelations", + "solution_module": "OAI.NumberTheory.TwoPointCorrelations.FinalMain", + "theorem_names": [ + "OAI.OrdinaryTwoPointCorrelations.liouville_log_saving", + "OAI.OrdinaryTwoPointCorrelations.binary_corrected_elliott", + "OAI.OrdinaryTwoPointCorrelations.affine_corrected_elliott" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/OrdinaryTwoPointCorrelations.lean b/lean/ComparatorChallenges/OrdinaryTwoPointCorrelations.lean new file mode 100644 index 0000000000000000000000000000000000000000..8764f91cc16967f765b4f19c4378ff8fb5f29cd0 --- /dev/null +++ b/lean/ComparatorChallenges/OrdinaryTwoPointCorrelations.lean @@ -0,0 +1,71 @@ +import Mathlib + +namespace OAI + +noncomputable section +open scoped BigOperators ComplexConjugate +open Filter + +namespace TwoPointCorrelations + +def liouville (n : ℕ) : ℂ := ArithmeticFunction.liouville n + +def correlationSum (f g : ℕ → ℂ) (h₁ h₂ N : ℕ) : ℂ := + ∑ n ∈ Finset.Icc 1 N, f (n + h₁) * g (n + h₂) + +def affineSum (f g : ℕ → ℂ) (a₁ a₂ b₁ b₂ N : ℕ) : ℂ := + ∑ n ∈ Finset.Icc 1 N, f (a₁ * n + b₁) * g (a₂ * n + b₂) + +def Multiplicative (f : ℕ → ℂ) : Prop := + ∀ m n : ℕ, 0 < m → 0 < n → m.Coprime n → f (m * n) = f m * f n + +def OneBounded (f : ℕ → ℂ) : Prop := ∀ n : ℕ, 0 < n → ‖f n‖ ≤ 1 + +def primesUpTo (N : ℕ) : Finset ℕ := (Finset.range (N + 1)).filter Nat.Prime + +def squaredDistance (f g : ℕ → ℂ) (N : ℕ) : ℝ := + ∑ p ∈ primesUpTo N, (1 - (f p * conj (g p)).re) / (p : ℝ) + +def characterTwist {q : ℕ} (χ : DirichletCharacter ℂ q) + (t : ℝ) (n : ℕ) : ℂ := + χ (n : ZMod q) * Complex.exp (((t * Real.log (n : ℝ) : ℝ) : ℂ) * Complex.I) + +def UniformlyNonpretentious (f : ℕ → ℂ) : Prop := + ∀ (q : ℕ), 0 < q → ∀ (χ : DirichletCharacter ℂ q) (K : ℝ), + ∀ᶠ N : ℕ in atTop, ∀ t : ℝ, |t| ≤ (N : ℝ) → + K ≤ squaredDistance f (characterTwist χ t) N + +end TwoPointCorrelations + +namespace OrdinaryTwoPointCorrelations +open TwoPointCorrelations + +theorem liouville_log_saving : + ∃ c : ℝ, 0 < c ∧ ∀ a₁ a₂ b₁ b₂ : ℕ, + 0 < a₁ → 0 < a₂ → a₁ * b₂ ≠ a₂ * b₁ → + ∃ C : ℝ, 0 < C ∧ ∀ X : ℝ, 3 ≤ X → + ‖affineSum liouville liouville a₁ a₂ b₁ b₂ ⌊X⌋₊‖ ≤ + C * X / Real.rpow (Real.log X) c := by + sorry + +theorem binary_corrected_elliott : + ∀ f₁ f₂ : ℕ → ℂ, Multiplicative f₁ → Multiplicative f₂ → + OneBounded f₁ → OneBounded f₂ → + (UniformlyNonpretentious f₁ ∨ UniformlyNonpretentious f₂) → + ∀ h₁ h₂ : ℕ, h₁ ≠ h₂ → + Tendsto (fun N : ℕ => correlationSum f₁ f₂ h₁ h₂ N / (N : ℂ)) atTop (nhds 0) := by + sorry + +theorem affine_corrected_elliott : + ∀ f₁ f₂ : ℕ → ℂ, Multiplicative f₁ → Multiplicative f₂ → + OneBounded f₁ → OneBounded f₂ → + (UniformlyNonpretentious f₁ ∨ UniformlyNonpretentious f₂) → + ∀ a₁ a₂ b₁ b₂ : ℕ, 0 < a₁ → 0 < a₂ → a₁ * b₂ ≠ a₂ * b₁ → + Tendsto (fun N : ℕ => affineSum f₁ f₂ a₁ a₂ b₁ b₂ N / (N : ℂ)) atTop (nhds 0) := by + sorry + +end OrdinaryTwoPointCorrelations + +end + +end OAI diff --git a/lean/ComparatorChallenges/OstmannComplete.json b/lean/ComparatorChallenges/OstmannComplete.json new file mode 100644 index 0000000000000000000000000000000000000000..928cf04c8547c3735c80a77a840593f19da7e995 --- /dev/null +++ b/lean/ComparatorChallenges/OstmannComplete.json @@ -0,0 +1,15 @@ +{ + "challenge_module": "ComparatorChallenges.OstmannComplete", + "solution_module": "OAI.NumberTheory.Ostmann.Complete", + "theorem_names": [ + "OAI.Ostmann.inverseGoldbach", + "OAI.Ostmann.twoInfiniteSummandsImpossible" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/OstmannComplete.lean b/lean/ComparatorChallenges/OstmannComplete.lean new file mode 100644 index 0000000000000000000000000000000000000000..2ce3996246081109689092abdf75e91c1e473490 --- /dev/null +++ b/lean/ComparatorChallenges/OstmannComplete.lean @@ -0,0 +1,38 @@ +import Mathlib + +namespace OAI + +open scoped Pointwise symmDiff + +namespace Ostmann + +def primes : Set ℕ := {n | Nat.Prime n} + +abbrev sumset (A B : Set ℕ) : Set ℕ := A + B + +def EventuallyPrimeSumset (A B : Set ℕ) : Prop := + ∃ N : ℕ, ∀ n, N ≤ n → (n ∈ sumset A B ↔ n.Prime) + +def TwoInfiniteSummandsImpossible : Prop := + ∀ A B : Set ℕ, A.Infinite → B.Infinite → ¬ EventuallyPrimeSumset A B + +def InverseGoldbach : Prop := + ∀ A B : Set ℕ, A.Nontrivial → B.Nontrivial → + Set.Infinite (@symmDiff (Set ℕ) + (@SemilatticeSup.toMax (Set ℕ) + (@Lattice.toSemilatticeSup (Set ℕ) + (@CompleteLattice.toLattice (Set ℕ) + (@CompleteBooleanAlgebra.toCompleteLattice (Set ℕ) + (@CompleteAtomicBooleanAlgebra.toCompleteBooleanAlgebra (Set ℕ) + (@Set.instCompleteAtomicBooleanAlgebra ℕ)))))) + Set.instSDiff (sumset A B) primes) + +theorem inverseGoldbach : InverseGoldbach := by + sorry + +theorem twoInfiniteSummandsImpossible : TwoInfiniteSummandsImpossible := by + sorry + +end Ostmann + +end OAI diff --git a/lean/ComparatorChallenges/OstmannPrimes.json b/lean/ComparatorChallenges/OstmannPrimes.json new file mode 100644 index 0000000000000000000000000000000000000000..dc91ea228dcb7e4b2547ada49ad868dd27589fa6 --- /dev/null +++ b/lean/ComparatorChallenges/OstmannPrimes.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.OstmannPrimes", + "solution_module": "OAI.NumberTheory.Ostmann.Main", + "theorem_names": [ + "OAI.Ostmann.main" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/OstmannPrimes.lean b/lean/ComparatorChallenges/OstmannPrimes.lean new file mode 100644 index 0000000000000000000000000000000000000000..d012ff3a0fda6063b9dcc14ec9e5e3b2c83c290c --- /dev/null +++ b/lean/ComparatorChallenges/OstmannPrimes.lean @@ -0,0 +1,15 @@ +import Mathlib + +namespace OAI + +open scoped Pointwise symmDiff + +namespace Ostmann + +theorem main : ∀ A B : Set ℕ, A.Nontrivial → B.Nontrivial → + Set.Infinite ((A + B) ∆ {n : ℕ | Nat.Prime n}) := by + sorry + +end Ostmann + +end OAI diff --git a/lean/ComparatorChallenges/ParityLifts.json b/lean/ComparatorChallenges/ParityLifts.json new file mode 100644 index 0000000000000000000000000000000000000000..43b61fa49cb141ef49e5cd6172d5a03d8b77a9c7 --- /dev/null +++ b/lean/ComparatorChallenges/ParityLifts.json @@ -0,0 +1,13 @@ +{ + "challenge_module": "ComparatorChallenges.ParityLifts", + "solution_module": "OAI.Combinatorics.ParityLifts.Main", + "theorem_names": [ + "OAI.ParityWL.parity_reduction" + ], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/ParityLifts.lean b/lean/ComparatorChallenges/ParityLifts.lean new file mode 100644 index 0000000000000000000000000000000000000000..2ddf367a6965bf8e7bf4de999b50531ecf83545c --- /dev/null +++ b/lean/ComparatorChallenges/ParityLifts.lean @@ -0,0 +1,209 @@ +import Mathlib + +namespace OAI + + + +namespace ParityWL + +open scoped BigOperators + +abbrev Bit := ZMod 2 +abbrev MainPair (t : ℕ) := {p : Fin t × Fin t // p.1 < p.2} +abbrev Helper (t : ℕ) := + {q : MainPair t × Fin t // q.2 ≠ q.1.1.1 ∧ q.2 ≠ q.1.1.2} +abbrev TemplateVertex (t : ℕ) := Fin t ⊕ Helper t + +structure ChoiceSystem (t : ℕ) where + Domain : Fin t → Type + domainFintype : ∀ i, Fintype (Domain i) + Label : MainPair t → Type + labelFintype : ∀ p, Fintype (Label p) + leftLabel : (p : MainPair t) → Domain p.1.1 → Label p + rightLabel : (p : MainPair t) → Domain p.1.2 → Label p + +attribute [instance] ChoiceSystem.domainFintype ChoiceSystem.labelFintype + +def ChoiceSystem.Successful {t : ℕ} (C : ChoiceSystem t) : Prop := + ∃ d : (i : Fin t) → C.Domain i, + ∀ p : MainPair t, C.leftLabel p (d p.1.1) = C.rightLabel p (d p.1.2) + +def ChoiceSystem.SizeAtMost {t : ℕ} (C : ChoiceSystem t) (A : ℕ) : Prop := + (∀ i, Fintype.card (C.Domain i) ≤ A) ∧ (∀ p, Fintype.card (C.Label p) ≤ A) + +def helperIncident {t : ℕ} (h : Helper t) (i : Fin t) : Prop := + i = h.1.1.1.1 ∨ i = h.1.1.1.2 ∨ i = h.1.2 + +def templateAdj {t : ℕ} : TemplateVertex t → TemplateVertex t → Prop + | .inl i, .inl j => i ≠ j + | .inl i, .inr h => helperIncident h i + | .inr h, .inl i => helperIncident h i + | .inr _, .inr _ => False + +def template (t : ℕ) : SimpleGraph (TemplateVertex t) where + Adj := templateAdj + symm := ⟨by + intro x y h + cases x <;> cases y <;> simp_all [templateAdj, ne_comm]⟩ + loopless := ⟨by + intro x + cases x <;> simp [templateAdj]⟩ + +abbrev BaseVertex {t : ℕ} (C : ChoiceSystem t) := + ((i : Fin t) × C.Domain i) ⊕ ((h : Helper t) × C.Label h.1.1) + +def baseType {t : ℕ} {C : ChoiceSystem t} : BaseVertex C → TemplateVertex t + | .inl x => .inl x.1 + | .inr x => .inr x.1 + +inductive BaseArc {t : ℕ} (C : ChoiceSystem t) : BaseVertex C → BaseVertex C → Prop + | main (p : MainPair t) (d : C.Domain p.1.1) (e : C.Domain p.1.2) + (h : C.leftLabel p d = C.rightLabel p e) : + BaseArc C (.inl ⟨p.1.1, d⟩) (.inl ⟨p.1.2, e⟩) + | left (h : Helper t) (d : C.Domain h.1.1.1.1) : + BaseArc C (.inr ⟨h, C.leftLabel h.1.1 d⟩) (.inl ⟨h.1.1.1.1, d⟩) + | right (h : Helper t) (e : C.Domain h.1.1.1.2) : + BaseArc C (.inr ⟨h, C.rightLabel h.1.1 e⟩) (.inl ⟨h.1.1.1.2, e⟩) + | third (h : Helper t) (q : C.Label h.1.1) (f : C.Domain h.1.2) : + BaseArc C (.inr ⟨h, q⟩) (.inl ⟨h.1.2, f⟩) + +def baseGraph {t : ℕ} (C : ChoiceSystem t) : SimpleGraph (BaseVertex C) := + SimpleGraph.fromRel (BaseArc C) + +def baseProjection {t : ℕ} (C : ChoiceSystem t) : baseGraph C →g template t where + toFun := baseType + map_rel' := by + intro x y h + have arc : ∀ u v, BaseArc C u v → (template t).Adj (baseType u) (baseType v) := by + intro u v huv + cases huv with + | main p d e he => exact ne_of_lt p.property + | left h d => exact Or.inl rfl + | right h e => exact Or.inr (Or.inl rfl) + | third h q f => exact Or.inr (Or.inr rfl) + rcases h.2 with hxy | hyx + · exact arc x y hxy + · exact (arc y x hyx).symm + +section Lifts + +variable {A V : Type} [Fintype A] (T : SimpleGraph A) (G : SimpleGraph V) + +noncomputable def Tag (b : A → Bit) (a : A) := by + classical + exact {z : T.neighborSet a → Bit // ∑ v, z v = b a} + +noncomputable instance tagFintype (b : A → Bit) (a : A) : Fintype (Tag T b a) := by + classical + unfold Tag + infer_instance + +abbrev LiftVertex (τ : G →g T) (b : A → Bit) := (u : V) × Tag T b (τ u) + +noncomputable def liftGraph (τ : G →g T) (b : A → Bit) : + SimpleGraph (LiftVertex T G τ b) where + Adj u v := ∃ h : G.Adj u.1 v.1, + u.2.1 ⟨τ v.1, τ.map_adj h⟩ = v.2.1 ⟨τ u.1, τ.map_adj h.symm⟩ + symm := ⟨by + intro u v h + rcases h with ⟨h, e⟩ + exact ⟨h.symm, e.symm⟩⟩ + loopless := ⟨by + intro u h + exact G.irrefl h.1⟩ + +end Lifts + +noncomputable def starParity (t : ℕ) : TemplateVertex t → Bit := + fun a => if ∃ i : Fin t, i.val = 0 ∧ a = .inl i then 1 else 0 + +noncomputable def zeroLift {t : ℕ} (C : ChoiceSystem t) := + liftGraph (template t) (baseGraph C) (baseProjection C) (fun _ => 0) + +noncomputable def starLift {t : ℕ} (C : ChoiceSystem t) := + liftGraph (template t) (baseGraph C) (baseProjection C) (starParity t) + +inductive Convention | joint | separate + deriving DecidableEq + +def bagParameter (c : Convention) (k : ℕ) : ℕ := + match c with | .joint => k + 1 | .separate => k + +def detectionRound : Convention → ℕ | .joint => 2 | .separate => 1 + +def orderFactor (t : ℕ) : ℕ := + t * 2 ^ (t - 2 + 3 * (t - 1).choose 2) + 12 * t.choose 3 + +abbrev AtomicType (k : ℕ) := Fin k → Fin k → Bool × Bool + +def JointColor (k : ℕ) : ℕ → Type + | 0 => AtomicType k + | r + 1 => JointColor k r × Multiset (Fin k → JointColor k r) + +def SeparateColor (k : ℕ) : ℕ → Type + | 0 => AtomicType k + | r + 1 => SeparateColor k r × (Fin k → Multiset (SeparateColor k r)) + +noncomputable def atomicType {V : Type} (G : SimpleGraph V) {k : ℕ} + (x : Fin k → V) : AtomicType k := by + classical + exact fun i j => (decide (x i = x j), decide (G.Adj (x i) (x j))) + +noncomputable def jointColor {V : Type} [Fintype V] (G : SimpleGraph V) (k : ℕ) : + (r : ℕ) → (Fin k → V) → JointColor k r + | 0, x => atomicType G x + | r + 1, x => (jointColor G k r x, + Finset.univ.val.map (fun y => fun i => jointColor G k r (Function.update x i y))) + +noncomputable def separateColor {V : Type} [Fintype V] (G : SimpleGraph V) (k : ℕ) : + (r : ℕ) → (Fin k → V) → SeparateColor k r + | 0, x => atomicType G x + | r + 1, x => (separateColor G k r x, + fun i => Finset.univ.val.map (fun y => separateColor G k r (Function.update x i y))) + +noncomputable def sameHistogram {V W : Type} [Fintype V] [Fintype W] + (G : SimpleGraph V) (H : SimpleGraph W) (c : Convention) (k r : ℕ) : Prop := + match c with + | .joint => Finset.univ.val.map (jointColor G k r) = + Finset.univ.val.map (jointColor H k r) + | .separate => Finset.univ.val.map (separateColor G k r) = + Finset.univ.val.map (separateColor H k r) + +noncomputable def samePureHistogram {V W : Type} [Fintype V] [Fintype W] + (G : SimpleGraph V) (H : SimpleGraph W) (c : Convention) (k r : ℕ) : Prop := + match c with + | .joint => + Finset.univ.val.map (fun x : Fin k → V => jointColor (G.sum H) k r (Sum.inl ∘ x)) = + Finset.univ.val.map (fun x : Fin k → W => jointColor (G.sum H) k r (Sum.inr ∘ x)) + | .separate => + Finset.univ.val.map (fun x : Fin k → V => separateColor (G.sum H) k r (Sum.inl ∘ x)) = + Finset.univ.val.map (fun x : Fin k → W => separateColor (G.sum H) k r (Sum.inr ∘ x)) + +noncomputable def WLEquivalent {V W : Type} [Fintype V] [Fintype W] + (G : SimpleGraph V) (H : SimpleGraph W) (c : Convention) (k : ℕ) : Prop := + ∀ r, sameHistogram G H c k r + +noncomputable def PureWLEquivalent {V W : Type} [Fintype V] [Fintype W] + (G : SimpleGraph V) (H : SimpleGraph W) (c : Convention) (k : ℕ) : Prop := + ∀ r, samePureHistogram G H c k r + +noncomputable def ParityReductionStatement : Prop := + ∀ (k : ℕ), 4 ≤ k → ∀ c : Convention, ∀ C : ChoiceSystem (bagParameter c k), + let T := template (bagParameter c k) + let G := baseGraph C + let τ := baseProjection C + let V₀ := LiftVertex T G τ (fun _ => 0) + let V₁ := LiftVertex T G τ (starParity (bagParameter c k)) + Fintype.card V₀ = Fintype.card V₁ ∧ + (∀ A : ℕ, 1 ≤ A → C.SizeAtMost A → Fintype.card V₀ ≤ A * orderFactor (bagParameter c k)) ∧ + (WLEquivalent (zeroLift C) (starLift C) c k ↔ ¬ C.Successful) ∧ + (PureWLEquivalent (zeroLift C) (starLift C) c k ↔ ¬ C.Successful) ∧ + (C.Successful → ¬ sameHistogram (zeroLift C) (starLift C) c k (detectionRound c) ∧ + ¬ samePureHistogram (zeroLift C) (starLift C) c k (detectionRound c)) + +theorem parity_reduction : ParityReductionStatement := by + sorry + +end ParityWL + +end OAI diff --git a/lean/ComparatorChallenges/PartialPermutation.json b/lean/ComparatorChallenges/PartialPermutation.json new file mode 100644 index 0000000000000000000000000000000000000000..2fef8ad6bba41d6f0106329d57025a8ad7438c44 --- /dev/null +++ b/lean/ComparatorChallenges/PartialPermutation.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.PartialPermutation", + "solution_module": "OAI.RepresentationTheory.PartialPermutation.Main", + "theorem_names": [ + "OAI.PartialPermutation.complementaryCosets_finite" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Classical.choice", + "Quot.sound" + ], + "enable_nanoda": false +} diff --git a/lean/ComparatorChallenges/PartialPermutation.lean b/lean/ComparatorChallenges/PartialPermutation.lean new file mode 100644 index 0000000000000000000000000000000000000000..f52ccf0e636961d1d322176bab620b0a1170dd2e --- /dev/null +++ b/lean/ComparatorChallenges/PartialPermutation.lean @@ -0,0 +1,116 @@ +import Mathlib + +namespace OAI + +open scoped Classical BigOperators ComplexConjugate MonoidAlgebra +namespace PartialPermutation +noncomputable section + +def IsUnitary {G V : Type*} [Group G] [NormedAddCommGroup V] + [InnerProductSpace ℂ V] (ρ : Representation ℂ G V) : Prop := + ∀ g x y, inner ℂ (ρ g x) (ρ g y) = inner ℂ x y + +section +variable {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℂ V] + [FiniteDimensional ℂ V] +def hsNormSq (A : Module.End ℂ V) : ℝ := + (LinearMap.trace ℂ V (LinearMap.adjoint A * A)).re + +end + +def complexFourier {G V : Type*} [Group G] [Fintype G] [AddCommGroup V] [Module ℂ V] + (ρ : Representation ℂ G V) (f : G → ℂ) : Module.End ℂ V := ∑ g, f g • ρ g + +section +variable {G V : Type*} [Group G] [Fintype G] [AddCommGroup V] [Module ℂ V] + [FiniteDimensional ℂ V] (ρ : Representation ℂ G V) +noncomputable def componentSimple (c : isotypicComponents ℂ[G] ρ.asModule) : + Submodule ℂ[G] ρ.asModule := c.property.choose + +instance components_finite : Finite (isotypicComponents ℂ[G] ρ.asModule) := by + let : IsNoetherian ℂ[G] ρ.asModule := isNoetherian_of_tower ℂ inferInstance + infer_instance + +end + +section +variable (G : Type*) [Group G] [Fintype G] +def regularRep : Representation ℂ G (EuclideanSpace ℂ G) where + toFun g := + { toFun := fun f => WithLp.toLp 2 (fun h => f (g⁻¹ * h)) + map_add' := by intros; rfl + map_smul' := by intros; rfl } + map_one' := by ext f h; simp + map_mul' := by + intro x y + ext f h + change f ((x * y)⁻¹ * h) = f (y⁻¹ * (x⁻¹ * h)) + simp [mul_assoc] + +end + +section +variable {G : Type*} [Group G] [Fintype G] +abbrev IrreducibleIndex (G : Type*) [Group G] [Fintype G] := + isotypicComponents ℂ[G] (regularRep G).asModule + +noncomputable instance irreducibleIndex_fintype : Fintype (IrreducibleIndex G) := + Fintype.ofFinite _ + +abbrev irreducibleSpace (c : IrreducibleIndex G) := + (Subrepresentation.ofSubmodule' (componentSimple (regularRep G) c)).toSubmodule + +abbrev irreducibleDegree (c : IrreducibleIndex G) := Module.finrank ℂ (irreducibleSpace c) + +end + +def mass {G : Type*} [Fintype G] (f : G → ℝ) : ℝ := ∑ g, f g + +def LeftCosetCap {G : Type*} [Group G] [Fintype G] + (f : G → ℝ) (H : Subgroup G) (B : ℝ) : Prop := + by classical exact ∀ g, ∑ h : H, f (g * h) ≤ B / H.index + +def blockSubgroup {X : Type*} (M : Set X) : Subgroup (Equiv.Perm X) where + carrier := {g | ∀ x, x ∉ M → g x = x} + one_mem' := by simp + mul_mem' := by + intro g h hg hh x hx + simp only [Set.mem_ofPred_eq] at hg hh ⊢ + simp [Equiv.Perm.mul_apply, hh x hx, hg x hx] + inv_mem' := by + intro g hg x hx + exact ((Equiv.eq_symm_apply g).mpr (hg x hx)).symm + +def inverseDegreeSum (G : Type*) [Group G] [Fintype G] (u : ℝ) : ℝ := + ∑ c : IrreducibleIndex G, (irreducibleDegree c : ℝ)^(-u) + +def symmetricInverseDegreeSum (n : ℕ) (u : ℝ) : ℝ := + inverseDegreeSum (Equiv.Perm (Fin n)) u + +def symmetricDegreeConstant (u : ℝ) : ℝ := + sSup {x : ℝ | ∃ n : ℕ, 1 ≤ n ∧ x = symmetricInverseDegreeSum n u} + +def ComplementaryCosetsFiniteStatement : Prop := + ∀ (X : Type*) [Fintype X] [DecidableEq X] (b : ℕ) (_ : 0 < b) (M : Fin b → Set X), + (∀ i, (M i).Nonempty) → + Pairwise (fun i j => Disjoint (M i) (M j)) → (⋃ i, M i) = Set.univ → + ∀ (V : Type) [NormedAddCommGroup V] [InnerProductSpace ℂ V] + [FiniteDimensional ℂ V] (ρ : Representation ℂ (Equiv.Perm X) V), + Representation.IsIrreducible ρ → IsUnitary ρ → + ∀ (f : Equiv.Perm X → ℝ) (B u : ℝ), + (∀ g, 0 ≤ f g) → mass f ≤ 1 → 0 < u → + (∀ i, LeftCosetCap f (blockSubgroup (M i)) B) → + (hsNormSq (complexFourier ρ (fun g => f g)) ≤ + b * B * symmetricDegreeConstant u * + (Module.finrank ℂ V : ℝ)^(-1+(u+2)/(b : ℝ))) ∧ + (‖LinearMap.toContinuousLinearMap (complexFourier ρ (fun g => f g))‖^2 ≤ + b * B * symmetricDegreeConstant u * + (Module.finrank ℂ V : ℝ)^(-1+(u+2)/(b : ℝ))) + +theorem complementaryCosets_finite : ComplementaryCosetsFiniteStatement := by + sorry + +end +end PartialPermutation + +end OAI diff --git a/lean/ComparatorChallenges/PartitionConsistency.json b/lean/ComparatorChallenges/PartitionConsistency.json new file mode 100644 index 0000000000000000000000000000000000000000..bc91a9b945b93ae26c17b37f614cabf4115ed516 --- /dev/null +++ b/lean/ComparatorChallenges/PartitionConsistency.json @@ -0,0 +1,14 @@ +{ + "challenge_module": "ComparatorChallenges.PartitionConsistency", + "solution_module": "OAI.SetTheory.PartitionConsistency.Main", + "theorem_names": [ + "OAI.PartitionConsistency.main_consistency" + ], + "definition_names": [], + "permitted_axioms": [ + "propext", + "Quot.sound", + "Classical.choice" + ], + "enable_nanoda": false +}