diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFirstDerivedRetraction.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFirstDerivedRetraction.lean new file mode 100644 index 0000000000000000000000000000000000000000..9917b2e1c67a586215de8247005b2c506693da5d --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFirstDerivedRetraction.lean @@ -0,0 +1,66 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryFirstDerivedCompatibility +import OAI.Algebra.Finitistic.Ordinary.OrdinaryFirstComponentExact + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.BlockModule +universe u +variable (L R : Type u) [Ring L] [Ring R] +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} L)] +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} (L × R))] + +/-- The exact derived first-component functor on the whole product-ring derived category. -/ +abbrev derivedFirstComponent := (ProductModules.firstFunctor.{u,u} L R).mapDerivedCategory + +def firstComplexComponentIso : firstComplexFunctor L R ⋙ + (ProductModules.firstFunctor L R).mapHomologicalComplex (.up ℤ) ≅ + 𝟭 (CochainComplex (ModuleCat.{u} L) ℤ) := + Functor.mapHomologicalComplexCompIso (ProductModules.firstInflationComponentIso L R) (.up ℤ) ≪≫ + Functor.mapHomologicalComplexIdIso (ModuleCat.{u} L) (.up ℤ) + +/-- On chain representatives, the composite is the identity localization. -/ +def derivedFirstComponentFactors : DerivedCategory.Q ⋙ derivedFirst L R ⋙ + derivedFirstComponent L R ≅ (DerivedCategory.Q : CochainComplex (ModuleCat.{u} L) ℤ ⥤ _) := + (Functor.associator ..).symm ≪≫ + Functor.isoWhiskerRight (derivedFirstComparison L R) _ ≪≫ + Functor.associator .. ≪≫ + Functor.isoWhiskerLeft _ (ProductModules.firstFunctor L R).mapDerivedCategoryFactors ≪≫ + (Functor.associator ..).symm ≪≫ + Functor.isoWhiskerRight (firstComplexComponentIso L R) _ ≪≫ Functor.leftUnitor _ + +/-- Taking the first component recovers every derived object, naturally. -/ +def derivedFirstRetraction : derivedFirst L R ⋙ derivedFirstComponent L R ≅ + 𝟭 (DerivedCategory (ModuleCat.{u} L)) := by + letI : Localization.Lifting DerivedCategory.Q + (HomologicalComplex.quasiIso (ModuleCat.{u} L) (.up ℤ)) DerivedCategory.Q + (derivedFirst L R ⋙ derivedFirstComponent L R) := ⟨derivedFirstComponentFactors L R⟩ + exact Localization.liftNatIso DerivedCategory.Q + (HomologicalComplex.quasiIso (ModuleCat.{u} L) (.up ℤ)) + DerivedCategory.Q DerivedCategory.Q _ _ (Iso.refl _) + +/-- The same retraction for mathlib's exact derived inflation. -/ +def exactFirstRetraction : (ProductModules.firstInflation L R).mapDerivedCategory ⋙ + derivedFirstComponent L R ≅ 𝟭 (DerivedCategory (ModuleCat.{u} L)) := + Functor.isoWhiskerRight (derivedFirstIso L R).symm _ ≪≫ derivedFirstRetraction L R + +instance derivedFirst_additive : (derivedFirst L R).Additive := + Functor.additive_of_iso (derivedFirstIso L R).symm + +/-- No derived object becomes zero merely by putting it in the first block. -/ +theorem derivedFirst_isZero_iff (Y : DerivedCategory (ModuleCat.{u} L)) : + IsZero ((derivedFirst L R).obj Y) ↔ IsZero Y := by + constructor + · intro h + exact ((derivedFirstRetraction L R).app Y).isZero_iff.mp + ((derivedFirstComponent L R).map_isZero h) + · exact (derivedFirst L R).map_isZero + +theorem exactFirst_isZero_iff (Y : DerivedCategory (ModuleCat.{u} L)) : + IsZero ((ProductModules.firstInflation L R).mapDerivedCategory.obj Y) ↔ IsZero Y := + ((derivedFirstIso L R).app Y).isZero_iff.symm.trans (derivedFirst_isZero_iff L R Y) +end LittleFinitistic.BlockModule + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFixedTensorFunctor.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFixedTensorFunctor.lean new file mode 100644 index 0000000000000000000000000000000000000000..517db7837d075923e0059e5402cf0b8e831d7e87 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFixedTensorFunctor.lean @@ -0,0 +1,86 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorExactness +import Mathlib.Algebra.Category.ModuleCat.ChangeOfRings +import Mathlib.Algebra.Homology.ShortComplex.ModuleCat +import Mathlib.CategoryTheory.Abelian.Exact +import Mathlib.Algebra.Homology.QuasiIso + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.BalancedTensor +universe u +variable (k A : Type u) [Field k] [Ring A] [Algebra k A] + +abbrev ScalarLeftModule (N : ModuleCat.{u} A) := + (ModuleCat.restrictScalars (algebraMap k A)).obj N + +instance scalarLeftTower (N : ModuleCat.{u} A) : IsScalarTower k A (ScalarLeftModule k A N) where + smul_assoc r a n := by + change (r • a) • (n : N) = algebraMap k A r • (a • (n : N)) + rw [Algebra.smul_def,mul_smul] + +variable (M : Type u) [AddCommGroup M] [Module k M] [Module Aᵐᵒᵖ M] + +/-- Tensor by a fixed actual right module on every left module. -/ +def fixedTensorFunctor : ModuleCat.{u} A ⥤ ModuleCat.{u} k where + obj N := ModuleCat.of k (Tensor k A M (ScalarLeftModule k A N)) + map {N N'} f := ModuleCat.ofHom + (mapRightTo (k := k) (M := M) (N := ScalarLeftModule k A N) (N' := ScalarLeftModule k A N') f.hom) + map_id N := by + apply ModuleCat.hom_ext + apply BalancedTensor.ext + intro m n + rfl + map_comp f g := by + apply ModuleCat.hom_ext + apply BalancedTensor.ext + intro m n + rfl + +instance fixedTensorFunctor_additive : (fixedTensorFunctor k A M).Additive where + map_add {N N'} {f g} := by + apply ModuleCat.hom_ext + apply BalancedTensor.ext + intro m n + exact (mk k A M (ScalarLeftModule k A N') m).map_add (f.hom n) (g.hom n) + +variable (e : A) (he : e*e=e) + +include he in +theorem idempotentTensor_mapsExact (S : ShortComplex (ModuleCat.{u} A)) (hS : S.Exact) : + (S.map (fixedTensorFunctor k A (IdempotentTensor.rightIdeal e))).Exact := by + rw [ShortComplex.moduleCat_exact_iff] + have h : Function.Exact + (S.f.hom : ScalarLeftModule k A S.X₁ →ₗ[A] ScalarLeftModule k A S.X₂) + (S.g.hom : ScalarLeftModule k A S.X₂ →ₗ[A] ScalarLeftModule k A S.X₃) := by + intro n + constructor + · exact (ShortComplex.moduleCat_exact_iff S).mp hS n + · rintro ⟨m,rfl⟩ + exact congrArg (fun f => f.hom m) S.zero + have ht := @IdempotentTensor.tensor_exact k A + (ScalarLeftModule k A S.X₁) (ScalarLeftModule k A S.X₂) (ScalarLeftModule k A S.X₃) + _ _ _ _ _ _ (scalarLeftTower k A S.X₁) + _ _ _ (scalarLeftTower k A S.X₂) _ _ _ (scalarLeftTower k A S.X₃) + e he S.f.hom S.g.hom h + intro z hz + exact (ht z).mp hz + +include he in +/-- Derived input complexes remain arbitrary: this functor preserves homology. -/ +theorem idempotentTensor_preservesHomology : + (fixedTensorFunctor k A (IdempotentTensor.rightIdeal e)).PreservesHomology := + Functor.preservesHomology_of_map_exact _ (idempotentTensor_mapsExact k A e he) + +include he in +/-- No boundedness, dimension, projectivity, or flatness hypothesis on either input complex. -/ +theorem idempotentTensor_quasiIso + {Z Z' : CochainComplex (ModuleCat.{u} A) ℤ} (f : Z ⟶ Z') [QuasiIso f] : + QuasiIso (((fixedTensorFunctor k A (IdempotentTensor.rightIdeal e)).mapHomologicalComplex (.up ℤ)).map f) := by + let := idempotentTensor_preservesHomology k A e he + infer_instance +end LittleFinitistic.BalancedTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFreeTensor.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFreeTensor.lean new file mode 100644 index 0000000000000000000000000000000000000000..c1bbbdaefdf0e20079868acdbedcb8fd09f11cc8 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFreeTensor.lean @@ -0,0 +1,80 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorExactness +import Mathlib.LinearAlgebra.Finsupp.LSum +import Mathlib.Algebra.Algebra.Opposite + +namespace OAI +noncomputable section +namespace LittleFinitistic.BalancedTensor.Free +universe u +variable {k A : Type u} [Field k] [Ring A] [Algebra k A] +variable (I N : Type u) [AddCommGroup N] [Module k N] [Module A N] [IsScalarTower k A N] + +/-- A right-regular coefficient acts on the left tensor factor by its unop. -/ +def coefficientAction : Aᵐᵒᵖ →ₗ[k] N →ₗ[k] N := + (Algebra.lsmul k k N).toLinearMap.comp (MulOpposite.opLinearEquiv k).symm.toLinearMap + +/-- Coordinate evaluation of a free right module tensor N. -/ +def evaluateBilinear : (I →₀ Aᵐᵒᵖ) →ₗ[k] N →ₗ[k] (I →₀ N) := + Finsupp.lsum k (fun i => (coefficientAction (k := k) (A := A) N).compr₂ (Finsupp.lsingle i)) + +@[simp] theorem evaluateBilinear_single (i : I) (x : Aᵐᵒᵖ) (n : N) : + evaluateBilinear (k := k) I N (Finsupp.single i x) n = Finsupp.single i (x.unop • n) := by + simp only [evaluateBilinear,Finsupp.lsum_single] + rfl + +def evaluation : Tensor k A (I →₀ Aᵐᵒᵖ) N →ₗ[k] (I →₀ N) := + lift (evaluateBilinear (k := k) I N) (by + intro a m n + induction m using Finsupp.induction_linear with + | zero => simp only [smul_zero,map_zero,LinearMap.zero_apply] + | add x y hx hy => simp only [smul_add,map_add,LinearMap.add_apply,hx,hy] + | single i x => + rw [Finsupp.smul_single,evaluateBilinear_single,evaluateBilinear_single] + change Finsupp.single i ((x.unop*a) • n) = Finsupp.single i (x.unop • (a • n)) + rw [mul_smul]) + +@[simp] theorem evaluation_single (i : I) (x : Aᵐᵒᵖ) (n : N) : + evaluation (k := k) I N (mk k A (I →₀ Aᵐᵒᵖ) N (Finsupp.single i x) n) = + Finsupp.single i (x.unop • n) := evaluateBilinear_single I N i x n + +def insertion : (I →₀ N) →ₗ[k] Tensor k A (I →₀ Aᵐᵒᵖ) N := + Finsupp.lsum k (fun i => mk k A (I →₀ Aᵐᵒᵖ) N (Finsupp.single i 1)) + +omit [IsScalarTower k A N] in +@[simp] theorem insertion_single (i : I) (n : N) : + insertion (k := k) (A := A) I N (Finsupp.single i n) = + mk k A (I →₀ Aᵐᵒᵖ) N (Finsupp.single i 1) n := by + simp only [insertion,Finsupp.lsum_single] + +theorem evaluation_insertion (z : I →₀ N) : + evaluation (k := k) (A := A) I N (insertion I N z) = z := by + induction z using Finsupp.induction_linear with + | zero => simp only [map_zero] + | add x y hx hy => simp only [map_add,hx,hy] + | single i n => rw [insertion_single,evaluation_single,MulOpposite.unop_one,one_smul] + +theorem insertion_evaluation (z : Tensor k A (I →₀ Aᵐᵒᵖ) N) : + insertion I N (evaluation (k := k) I N z) = z := by + induction z using BalancedTensor.induction_on with + | hz => simp only [map_zero] + | ht m n => + induction m using Finsupp.induction_linear with + | zero => simp only [map_zero,LinearMap.zero_apply] + | add x y hx hy => simp only [map_add,LinearMap.add_apply,hx,hy] + | single i x => + rw [evaluation_single,insertion_single,← balance] + congr 1 + rw [MulOpposite.op_unop,Finsupp.smul_single,smul_eq_mul,mul_one] + | ha x y hx hy => simp only [map_add,hx,hy] + +/-- The actual free balanced tensor, for arbitrary index sets and arbitrary modules N. -/ +def equivalence : Tensor k A (I →₀ Aᵐᵒᵖ) N ≃ₗ[k] (I →₀ N) where + __ := evaluation (k := k) I N + invFun := insertion I N + left_inv := insertion_evaluation I N + right_inv := evaluation_insertion I N +end LittleFinitistic.BalancedTensor.Free + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFreeTensorExactness.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFreeTensorExactness.lean new file mode 100644 index 0000000000000000000000000000000000000000..b4427d77da83ddcf41e04f5a5e71bf348f0c6bb1 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFreeTensorExactness.lean @@ -0,0 +1,83 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryFreeTensor +import Mathlib.LinearAlgebra.Finsupp.Defs + +namespace OAI +noncomputable section +namespace LittleFinitistic.BalancedTensor.Free +universe u +variable {k A : Type u} [Field k] [Ring A] [Algebra k A] +variable (I : Type u) +variable {N N' N'' : Type u} +variable [AddCommGroup N] [Module k N] [Module A N] [IsScalarTower k A N] +variable [AddCommGroup N'] [Module k N'] [Module A N'] [IsScalarTower k A N'] +variable [AddCommGroup N''] [Module k N''] [Module A N''] [IsScalarTower k A N''] + +theorem evaluation_naturality (f : N →ₗ[A] N') (z : Tensor k A (I →₀ Aᵐᵒᵖ) N) : + evaluation (k := k) I N' (mapRightTo f z) = + Finsupp.mapRange.linearMap (f.restrictScalars k) (evaluation (k := k) I N z) := by + induction z using BalancedTensor.induction_on with + | hz => simp only [map_zero] + | ht m n => + induction m using Finsupp.induction_linear with + | zero => simp only [map_zero,LinearMap.zero_apply] + | add x y hx hy => simp only [map_add,LinearMap.add_apply,hx,hy] + | single i x => + simp only [mapRightTo_mk,evaluation_single] + change Finsupp.single i (MulOpposite.unop x • f n) = + Finsupp.mapRange f f.map_zero (Finsupp.single i (MulOpposite.unop x • n)) + rw [Finsupp.mapRange_single, f.map_smul] + | ha x y hx hy => simp only [map_add,hx,hy] + +/-- Direct sums preserve exactness, with a preimage supported on the given finite support. -/ +theorem finsupp_exact (f : N →ₗ[A] N') (g : N' →ₗ[A] N'') (h : Function.Exact f g) : + Function.Exact (Finsupp.mapRange.linearMap (f.restrictScalars k) : (I →₀ N) →ₗ[k] (I →₀ N')) + (Finsupp.mapRange.linearMap (g.restrictScalars k)) := by + classical + intro z + constructor + · intro hz + have hg (i : I) : g (z i) = 0 := congrArg (fun x : I →₀ N'' => x i) hz + let y : I →₀ N := Finsupp.onFinset z.support + (fun i => if hi : z i = 0 then 0 else Classical.choose ((h (z i)).mp (hg i))) (by + intro i hi + by_contra hn + have hz0 : z i = 0 := by simpa only [Finsupp.mem_support_iff,not_not] using hn + exact hi (by simp [hz0])) + refine ⟨y, ?_⟩ + ext i + change f (if hi : z i = 0 then 0 else Classical.choose ((h (z i)).mp (hg i))) = z i + split_ifs with hi + · rw [map_zero,hi] + · exact Classical.choose_spec ((h (z i)).mp (hg i)) + · rintro ⟨y,rfl⟩ + ext i + exact (h (f (y i))).mpr ⟨y i,rfl⟩ + +/-- Tensor by an arbitrary free right module preserves every exact module sequence. -/ +theorem tensor_exact (f : N →ₗ[A] N') (g : N' →ₗ[A] N'') (h : Function.Exact f g) : + Function.Exact (mapRightTo (k := k) (M := I →₀ Aᵐᵒᵖ) f) + (mapRightTo (k := k) (M := I →₀ Aᵐᵒᵖ) g) := by + intro z + constructor + · intro hz + have hz' : Finsupp.mapRange.linearMap (g.restrictScalars k) (evaluation (k := k) I N' z) = 0 := by + rw [← evaluation_naturality,hz,map_zero] + obtain ⟨y,hy⟩ := (finsupp_exact (k := k) I f g h _).mp hz' + refine ⟨(equivalence (k := k) (A := A) I N).symm y, ?_⟩ + apply (equivalence (k := k) (A := A) I N').injective + change evaluation (k := k) I N' (mapRightTo f ((equivalence (k := k) (A := A) I N).symm y)) = _ + rw [evaluation_naturality] + change Finsupp.mapRange.linearMap (f.restrictScalars k) + ((equivalence (k := k) (A := A) I N) ((equivalence (k := k) (A := A) I N).symm y)) = _ + rw [LinearEquiv.apply_symm_apply] + exact hy + · rintro ⟨y,rfl⟩ + induction y using BalancedTensor.induction_on with + | hz => simp only [map_zero] + | ht m n => rw [mapRightTo_mk,mapRightTo_mk,(h (f n)).mpr ⟨n,rfl⟩,map_zero] + | ha x y hx hy => simp only [map_add,hx,hy,add_zero] +end LittleFinitistic.BalancedTensor.Free + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFullTensorComplex.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFullTensorComplex.lean new file mode 100644 index 0000000000000000000000000000000000000000..ce73fc5435c7d4cdd2754c199931996f0939868f --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFullTensorComplex.lean @@ -0,0 +1,89 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryFullTensorTerms +import Mathlib.Algebra.Homology.Embedding.Restriction + +namespace OAI +noncomputable section +open CategoryTheory Limits +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation.FullTensorTerm +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +variable (P : CochainComplex (ModuleCat.{u} (Enveloping k B)) ℤ) (a : ℤ) (l : ℕ) +attribute [local instance] VertexTensor.termScalar VertexTensor.termTower + +def differential (n : ℕ) : FullTensorTerm P a l n →ₗ[Enveloping k B] FullTensorTerm P a l (n+1) := + TwoSidedTensor.map (T := Bᵐᵒᵖ) (N := BimoduleO P a l) + (TensorResolution.differential k B l n) (TensorResolution.differential_left k B l n) + +theorem differential_square (n : ℕ) : (differential P a l (n+1)).comp (differential P a l n) = 0 := by + apply LinearMap.restrictScalars_injective k + apply BalancedTensor.ext + intro m v + change BalancedTensor.mk k (B ⊗[k] ChainAlgebra k l) (TensorResolution.term k B l (n+2)) + (BimoduleO P a l) (TensorResolution.differential k B l (n+1) + (TensorResolution.differential k B l n m)) v = 0 + have h := congrArg (fun f => f m) (TensorResolution.differential_square k B l n) + change TensorResolution.differential k B l (n+1) (TensorResolution.differential k B l n m) = 0 at h + rw [h,map_zero,LinearMap.zero_apply] + +/-- Actual tensor complex, with both B-actions and the actual extended arrow maps. -/ +def complex : CochainComplex (ModuleCat.{u} (Enveloping k B)) ℕ := + CochainComplex.of (fun n => ModuleCat.of _ (FullTensorTerm P a l n)) + (fun n => ModuleCat.ofHom (differential P a l n)) + (fun n => ModuleCat.hom_ext (differential_square P a l n)) + +/-- Supported evaluation is the product action followed by the source coordinate projection. -/ +theorem supportedEquiv_mk (n : ℕ) (hn : n ≤ l) (m : TensorResolution.term k B l n) (v : BimoduleO P a l) : + supportedEquiv P a l n hn + (TwoSidedTensor.mk k (B ⊗[k] ChainAlgebra k l) B Bᵐᵒᵖ (TensorResolution.term k B l n) (BimoduleO P a l) m v) = + (m.val • v : BimoduleO P a l) ⟨n,by omega⟩ := rfl + +theorem supported_differential (n : ℕ) (hn : n+1 ≤ l) (z : FullTensorTerm P a l n) : + supportedEquiv P a l (n+1) hn (differential P a l n z) = + (P.d (a+(n:ℤ)) (a+((n+1:ℕ):ℤ))).hom (supportedEquiv P a l n (by omega) z) := by + have h : (supportedEquiv P a l (n+1) hn).toLinearMap.comp (differential P a l n) = + (P.d (a+(n:ℤ)) (a+((n+1:ℕ):ℤ))).hom.comp + (supportedEquiv P a l n (by omega)).toLinearMap := by + apply LinearMap.restrictScalars_injective k + apply BalancedTensor.ext + intro m v + change ((((1:B) ⊗ₜ[k] ChainAlgebra.extendedArrow k l n) * m.val) • v : BimoduleO P a l) ⟨n+1,by omega⟩ = + (P.d (a+(n:ℤ)) (a+((n+1:ℕ):ℤ))).hom ((m.val • v : BimoduleO P a l) ⟨n,by omega⟩) + have hv : (((1:B) ⊗ₜ[k] ChainAlgebra.extendedArrow k l n) * m.val) • v = + ChainAlgebra.arrow k l ⟨n,by omega⟩ • (m.val • v) := by + rw [mul_smul,BimoduleO.tensor_smul,one_smul,ChainAlgebra.extendedArrow,dite_eq_left (by omega)] + exact (congrArg (fun w : BimoduleO P a l => w ⟨n+1,by omega⟩) hv).trans + (VertexTensor.arrow_coordinate P a l ⟨n,by omega⟩ (m.val • v)) + exact congrArg (fun f => f z) h + +variable (hP : ∀ n : ℕ, l < n → IsZero (P.X (a+(n:ℤ)))) + +theorem termEquiv_differential (n : ℕ) (z : FullTensorTerm P a l n) : + termEquiv P a l hP (n+1) (differential P a l n z) = + (P.d (a+(n:ℤ)) (a+((n+1:ℕ):ℤ))).hom (termEquiv P a l hP n z) := by + by_cases hn : n+1 ≤ l + · simp only [termEquiv,dite_eq_left hn,dite_eq_left (show n ≤ l by omega)] + exact supported_differential P a l n hn z + · let : Subsingleton (P.X (a+((n+1:ℕ):ℤ))) := + ModuleCat.isZero_iff_subsingleton.mp (hP (n+1) (by omega)) + exact Subsingleton.elim _ _ + +/-- The entire actual tensor complex identifies with P on degrees a,a+1,... . -/ +def complexIso : complex P a l ≅ P.restriction (ComplexShape.embeddingUpIntGE a) := + HomologicalComplex.Hom.isoOfComponents (fun n => (termEquiv P a l hP n).toModuleIso) (by + intro n m hnm + change n+1=m at hnm + subst m + change (termEquiv P a l hP n).toModuleIso.hom ≫ P.d (a+(n:ℤ)) (a+((n+1:ℕ):ℤ)) = + CochainComplex.of.d (fun j => ModuleCat.of (Enveloping k B) (FullTensorTerm P a l j)) + (fun j => ModuleCat.ofHom (differential P a l j)) n (n+1) ≫ (termEquiv P a l hP (n+1)).toModuleIso.hom + rw [CochainComplex.of_d] + apply ModuleCat.hom_ext + apply LinearMap.ext + intro z + exact (termEquiv_differential P a l hP n z).symm) +end LittleFinitistic.OrdinarySimulation.FullTensorTerm + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFullTensorTerms.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFullTensorTerms.lean new file mode 100644 index 0000000000000000000000000000000000000000..b4c251a3622f5a099b46c62a925c58a495ced211 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFullTensorTerms.lean @@ -0,0 +1,86 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTwoSidedTensor +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorDifferential +import OAI.Algebra.Finitistic.Ordinary.OrdinaryIntegerResolution + +namespace OAI +noncomputable section +open CategoryTheory Limits +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +variable (P : CochainComplex (ModuleCat.{u} (Enveloping k B)) ℤ) (a : ℤ) (l : ℕ) + +instance BimoduleO.commuteRightTensor : SMulCommClass Bᵐᵒᵖ (B ⊗[k] ChainAlgebra k l) (BimoduleO P a l) := + ⟨fun r x v => (smul_comm x r v).symm⟩ + +/-- Every degree of Q_T tensor_BC O, carrying the actual outside B-actions. -/ +abbrev FullTensorTerm (n : ℕ) := TwoSidedTensor k (B ⊗[k] ChainAlgebra k l) B Bᵐᵒᵖ + (TensorResolution.term k B l n) (BimoduleO P a l) + +namespace FullTensorTerm +open ChainAlgebra + +/-- Supported extended ideals are the same right ideals as the finite vertex terms. -/ +def supportedIdealEquiv (n : ℕ) (hn : n ≤ l) : + TensorResolution.term k B l n ≃ₗ[(B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ] + IdempotentTensor.rightIdeal (TensorIdeal.vertex (k := k) (B := B) (vertex k l ⟨n,by omega⟩)) where + toFun x := ⟨x.val, by + have hx := x.property + change TensorIdeal.vertex (k := k) (B := B) (extendedVertex k l n) * x.val = x.val at hx + rw [extendedVertex,dite_eq_left hn] at hx + exact hx⟩ + invFun x := ⟨x.val, by + change TensorIdeal.vertex (k := k) (B := B) (extendedVertex k l n) * x.val = x.val + rw [extendedVertex,dite_eq_left hn] + exact x.property⟩ + left_inv _ := rfl + right_inv _ := rfl + map_add' _ _ := rfl + map_smul' _ _ := rfl + +def finiteModel (i : Fin (l+1)) : + TwoSidedTensor k (B ⊗[k] ChainAlgebra k l) B Bᵐᵒᵖ + (IdempotentTensor.rightIdeal (TensorIdeal.vertex (k := k) (B := B) (vertex k l i))) + (BimoduleO P a l) ≃ₗ[Enveloping k B] VertexTensor P a l i where + toFun z := z + invFun z := z + left_inv _ := rfl + right_inv _ := rfl + map_add' _ _ := rfl + map_smul' _ _ := rfl + +/-- Actual degreewise B-bimodule comparison throughout the supported range. -/ +def supportedEquiv (n : ℕ) (hn : n ≤ l) : FullTensorTerm P a l n ≃ₗ[Enveloping k B] P.X (a+(n:ℤ)) := + (TwoSidedTensor.congrLeft (k := k) (S := B) (T := Bᵐᵒᵖ) (N := BimoduleO P a l) + (supportedIdealEquiv (k := k) (B := B) l n hn) (fun _ _ => rfl)).trans + ((finiteModel P a l ⟨n,by omega⟩).trans (VertexTensor.bimoduleEquiv P a l ⟨n,by omega⟩)) + +theorem subsingleton_above (n : ℕ) (hn : l < n) : Subsingleton (FullTensorTerm P a l n) := by + let : Subsingleton (TensorResolution.term k B l n) := + (ModuleCat.isZero_iff_subsingleton).mp (TensorResolution.term_vanishes k B l n hn) + exact inferInstanceAs (Subsingleton (BalancedTensor.Tensor k (B ⊗[k] ChainAlgebra k l) + (TensorResolution.term k B l n) (BimoduleO P a l))) + +/-- Use precisely the source's upper support bound for all remaining degrees. -/ +def outsideEquiv (n : ℕ) (hn : l < n) (hP : IsZero (P.X (a+(n:ℤ)))) : + FullTensorTerm P a l n ≃ₗ[Enveloping k B] P.X (a+(n:ℤ)) := by + letI := subsingleton_above P a l n hn + letI : Subsingleton (P.X (a+(n:ℤ))) := ModuleCat.isZero_iff_subsingleton.mp hP + exact { toFun := fun _ => 0 + invFun := fun _ => 0 + left_inv := fun _ => Subsingleton.elim _ _ + right_inv := fun _ => Subsingleton.elim _ _ + map_add' := fun _ _ => Subsingleton.elim _ _ + map_smul' := fun _ _ => Subsingleton.elim _ _ } + +/-- No extra support assumptions: P is required to vanish only above a+l here. -/ +def termEquiv (hP : ∀ n : ℕ, l < n → IsZero (P.X (a+(n:ℤ)))) (n : ℕ) : + FullTensorTerm P a l n ≃ₗ[Enveloping k B] P.X (a+(n:ℤ)) := + if hn : n ≤ l then supportedEquiv P a l n hn else outsideEquiv P a l n (by omega) (hP n (by omega)) +end FullTensorTerm +end LittleFinitistic.OrdinarySimulation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFunctorExtension.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFunctorExtension.lean new file mode 100644 index 0000000000000000000000000000000000000000..d836a2745ed3785d0cbad095e6d1109d3689dd2d --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryFunctorExtension.lean @@ -0,0 +1,42 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinarySupportedExtension +import Mathlib.Algebra.Homology.Additive + +namespace OAI +noncomputable section +open CategoryTheory Limits +namespace LittleFinitistic.FunctorExtension +universe u v u' v' w w' +variable {C : Type u} [Category.{v} C] [HasZeroMorphisms C] [HasZeroObject C] +variable {D : Type u'} [Category.{v'} D] [HasZeroMorphisms D] [HasZeroObject D] +variable (F : C ⥤ D) [F.PreservesZeroMorphisms] +variable {I : Type w} {J : Type w'} {c : ComplexShape I} {c' : ComplexShape J} +variable (K : HomologicalComplex C c) (e : c.Embedding c') [e.IsRelIff] + +omit [HasZeroObject D] [e.IsRelIff] in +/-- Mapping an extended complex retains its proved zero terms outside the embedded degrees. -/ +theorem mappedSupport : ((F.mapHomologicalComplex c').obj (K.extend e)).IsStrictlySupported e where + isZero j hj := F.map_isZero (K.isZero_extend_X e j hj) + +/-- On the actual supported degrees, mapping and extension have the same original terms. -/ +def restrictionIso : ((F.mapHomologicalComplex c').obj (K.extend e)).restriction e ≅ + (F.mapHomologicalComplex c).obj K := + HomologicalComplex.Hom.isoOfComponents (fun i => F.mapIso (K.extendXIso e (i := i) rfl)) (by + intro i j _ + change F.map (K.extendXIso e (i := i) rfl).hom ≫ F.map (K.d i j) = + F.map ((K.extend e).d (e.f i) (e.f j)) ≫ F.map (K.extendXIso e (i := j) rfl).hom + rw [← F.map_comp,← F.map_comp] + congr 1 + rw [HomologicalComplex.extend_d_eq _ _ rfl rfl] + simp only [Category.assoc,Iso.inv_hom_id,Category.comp_id]) + +/-- An actual chain isomorphism commuting a zero-preserving functor with extension by zero. -/ +def iso : (F.mapHomologicalComplex c').obj (K.extend e) ≅ + ((F.mapHomologicalComplex c).obj K).extend e := by + letI := mappedSupport F K e + exact (OrdinarySimulation.SupportedExtension.iso ((F.mapHomologicalComplex c').obj (K.extend e)) e).symm ≪≫ + (e.extendFunctor D).mapIso (restrictionIso F K e) +end LittleFinitistic.FunctorExtension + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryGenuineBimoduleComparison.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryGenuineBimoduleComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..2ce1ffc0b6a5219c0e8658dc0b5a0e120b958efa --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryGenuineBimoduleComparison.lean @@ -0,0 +1,78 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleTensorFunctor +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorBimoduleResolution +import OAI.Algebra.Finitistic.Ordinary.OrdinarySimulationComparison + +namespace OAI +noncomputable section +open CategoryTheory Limits +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +variable (P : CochainComplex (ModuleCat.{u} (Enveloping k B)) ℤ) (a : ℤ) (l : ℕ) + +abbrev genuineTensorFunctor := + bimoduleTensorFunctor k B (B ⊗[k] ChainAlgebra k l) Bᵐᵒᵖ (BimoduleO P a l) + +def genuineFiniteTermIso (n : ℕ) : + (genuineTensorFunctor P a l).obj ((TensorResolution.bimoduleComplex k B l).X n) ≅ + (FullTensorTerm.complex P a l).X n := by + let e : BimoduleCoefficients k B (B ⊗[k] ChainAlgebra k l) + ((TensorResolution.bimoduleComplex k B l).X n) ≃ₗ[(B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ] + TensorResolution.term k B l n := (TensorResolution.forgetBimoduleTerm k B l n).toLinearEquiv + have he (b : B) (x : BimoduleCoefficients k B (B ⊗[k] ChainAlgebra k l) + ((TensorResolution.bimoduleComplex k B l).X n)) : e (b • x) = b • e x := by + apply Subtype.ext + change TensorIdeal.coefficient b * (x.val * 1) = TensorIdeal.coefficient b * x.val + rw [mul_one] + exact (TwoSidedTensor.congrLeft (k := k) (S := B) (T := Bᵐᵒᵖ) (N := BimoduleO P a l) e he).toModuleIso + +/-- The actual finite bimodule tensor agrees with the existing full computation, preserving both B-actions. -/ +def genuineFiniteComplexIso : + ((genuineTensorFunctor P a l).mapHomologicalComplex (.up ℕ)).obj + (TensorResolution.bimoduleComplex k B l) ≅ FullTensorTerm.complex P a l := + HomologicalComplex.Hom.isoOfComponents (genuineFiniteTermIso P a l) (by + intro n m h + change n+1=m at h + subst m + change (genuineFiniteTermIso P a l n).hom ≫ (FullTensorTerm.complex P a l).d n (n+1) = + (genuineTensorFunctor P a l).map ((TensorResolution.bimoduleComplex k B l).d n (n+1)) ≫ + (genuineFiniteTermIso P a l (n+1)).hom + have h₁ : (FullTensorTerm.complex P a l).d n (n+1) = ModuleCat.ofHom (FullTensorTerm.differential P a l n) := + CochainComplex.of_d (fun n => ModuleCat.of (Enveloping k B) (FullTensorTerm P a l n)) + (fun n => ModuleCat.ofHom (FullTensorTerm.differential P a l n)) n + have h₂ : (TensorResolution.bimoduleComplex k B l).d n (n+1) = + ModuleCat.ofHom (TensorResolution.bimoduleDifferential k B l n) := + CochainComplex.of_d (fun n => ModuleCat.of (B ⊗[k] (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ) + (TensorResolution.bimoduleTerm k B l n)) + (fun n => ModuleCat.ofHom (TensorResolution.bimoduleDifferential k B l n)) n + rw [h₁,h₂] + apply ModuleCat.hom_ext + dsimp only [genuineTensorFunctor, bimoduleTensorFunctor, FullTensorTerm.complex] + apply LinearMap.restrictScalars_injective k + apply BalancedTensor.ext + intro q o + rfl) + +/-- The actual all-integer tensor of genuine Q_T with O, retaining both outside B-actions. -/ +def genuineComputedTensor : CochainComplex (ModuleCat.{u} (Enveloping k B)) ℤ := + ((genuineTensorFunctor P a l).mapHomologicalComplex (.up ℤ)).obj + (TensorResolution.integerBimoduleComplex k B l) + +/-- Agreement with the preserved full signed-comparison input in every integer degree. -/ +def genuineComputedTensorIso : genuineComputedTensor P a l ≅ computedTensorComplex P a l := + FunctorExtension.iso (genuineTensorFunctor P a l) (TensorResolution.bimoduleComplex k B l) + (TensorResolution.degreeEmbedding l) ≪≫ + ((TensorResolution.degreeEmbedding l).extendFunctor _).mapIso (genuineFiniteComplexIso P a l) + +/-- The actual ordinary tensor Q_T tensor O is isomorphic to P[b] as B-bimodule complexes. +Only the manuscript support and indexing hypotheses are used. -/ +def genuineSourceShiftComparison (b : ℤ) (hb : a+(l:ℤ)=b) + (hP : ∀ n : ℤ, n < a ∨ b < n → IsZero (P.X n)) : + genuineComputedTensor P a l ≅ P⟦b⟧ := + genuineComputedTensorIso P a l ≪≫ sourceShiftComparison P a l b hb hP +end LittleFinitistic.OrdinarySimulation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryGlobalDimension.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryGlobalDimension.lean new file mode 100644 index 0000000000000000000000000000000000000000..6dd71dcff3cd645820c6de6a5c6d3ab47669eb72 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryGlobalDimension.lean @@ -0,0 +1,41 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryProductOpposite +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorGlobalDimension + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation +universe u v +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] + +/-- The manuscript's exact bound for D, on both sides and for arbitrary modules. -/ +theorem ordinary_globalDimension_bound (DB : DirectedBound.DirectedSystem k B 3) (l : ℕ) : + (⨆ M : ModuleCat.{max u v} (AlgebraD k l B), projectiveDimension M) ≤ (3*l+2 : ℕ) ∧ + (⨆ M : ModuleCat.{max u v} (AlgebraD k l B)ᵐᵒᵖ, projectiveDimension M) ≤ (3*l+2 : ℕ) := by + have hB := DirectedBound.DirectedSystem.both_sides_projectiveDimension_le.{u,v} DB + have hBC := tensor_projectiveDimension_bound.{u,v} DB l + have hL (M : ModuleCat.{max u v} B) : projectiveDimension M ≤ (3*l+2 : ℕ) := by + apply (hB.1 M).trans + exact_mod_cast (show 3-1 ≤ 3*l+2 by omega) + have hR (M : ModuleCat.{max u v} Bᵐᵒᵖ) : projectiveDimension M ≤ (3*l+2 : ℕ) := by + apply (hB.2 M).trans + exact_mod_cast (show 3-1 ≤ 3*l+2 by omega) + exact ⟨iSup_le (fun M => ProductModules.product_module_bound B (B ⊗[k] ChainAlgebra k l) + (3*l+2) hL hBC.1 M), + iSup_le (fun M => ProductModules.opposite_product_module_bound B (B ⊗[k] ChainAlgebra k l) + (3*l+2) hR hBC.2 M)⟩ + +variable {V W U : Type u} [AddCommGroup V] [Module k V] [AddCommGroup W] [Module k W] + [AddCommGroup U] [Module k U] + +/-- The bound for the actual three-vertex coefficient algebra and the actual Section 5 product D. -/ +theorem source_ordinary_globalDimension_bound (μ : W →ₗ[k] V →ₗ[k] U) (l : ℕ) : + (⨆ M : ModuleCat.{max u v} (AlgebraD k l (ThreeVertexAlgebra μ)), projectiveDimension M) ≤ (3*l+2 : ℕ) ∧ + (⨆ M : ModuleCat.{max u v} (AlgebraD k l (ThreeVertexAlgebra μ))ᵐᵒᵖ, projectiveDimension M) ≤ (3*l+2 : ℕ) := + ordinary_globalDimension_bound (ThreeVertexAlgebra.directedSystem μ) l +end LittleFinitistic.OrdinarySimulation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryIntegerResolution.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryIntegerResolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..beb66de87daa04ffe39ddb2c775b9b2d996a849b --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryIntegerResolution.lean @@ -0,0 +1,74 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorResolutionComplex +import Mathlib.Algebra.Homology.Embedding.ExtendHomology + +namespace OAI +noncomputable section +open CategoryTheory Limits +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation.TensorResolution +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] (l : ℕ) + +def degreeEmbedding : (ComplexShape.up ℕ).Embedding (ComplexShape.up ℤ) := + ComplexShape.embeddingUpIntGE (-(l:ℤ)) + +instance degreeEmbedding_rel : (degreeEmbedding l).IsRelIff := + inferInstanceAs ((ComplexShape.embeddingUpIntGE (-(l:ℤ))).IsRelIff) + +@[simp] theorem degreeEmbedding_apply (n : ℕ) : (degreeEmbedding l).f n = -(l:ℤ)+n := rfl + +/-- Q_T in the manuscript's cohomological degrees -l,...,0. -/ +def integerComplex : CochainComplex (ModuleCat.{u} (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ) ℤ := + (complex k B l).extend (degreeEmbedding l) + +def integerTermIso (n : ℕ) : (integerComplex k B l).X (-(l:ℤ)+n) ≅ termObject k B l n := + (complex k B l).extendXIso (degreeEmbedding l) rfl + +/-- The terminal simple is in degree zero after the actual reindexing. -/ +def integerAugmentation : integerComplex k B l ⟶ + (HomologicalComplex.single _ (.up ℤ) 0).obj + (ModuleCat.of (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ (TerminalTensor B)) := + HomologicalComplex.extendMap (augmentationMap k B l) (degreeEmbedding l) ≫ + (HomologicalComplex.extendSingleIso (e := degreeEmbedding l) + (X := ModuleCat.of (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ (TerminalTensor B)) l 0 (by simp)).hom + +theorem integerAugmentation_quasiIso : QuasiIso (integerAugmentation k B l) := by + have := augmentationMap_quasiIso k B l + exact inferInstanceAs (QuasiIso + (HomologicalComplex.extendMap (augmentationMap k B l) (degreeEmbedding l) ≫ + (HomologicalComplex.extendSingleIso (e := degreeEmbedding l) + (X := ModuleCat.of (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ (TerminalTensor B)) l 0 (by simp)).hom)) + +theorem integerTerm_lower (n : ℤ) (h : n < -(l:ℤ)) : IsZero ((integerComplex k B l).X n) := by + apply (complex k B l).isZero_extend_X (degreeEmbedding l) n + intro j hj + simp only [degreeEmbedding_apply] at hj + omega + +theorem integerTerm_upper (n : ℤ) (h : 0 < n) : IsZero ((integerComplex k B l).X n) := by + let j := (n+(l:ℤ)).toNat + have hj : (degreeEmbedding l).f j = n := by + simp only [degreeEmbedding_apply] + dsimp [j] + rw [Int.toNat_of_nonneg (by omega)] + omega + have hjl : l < j := by + have hc : (j:ℤ) = n+(l:ℤ) := Int.toNat_of_nonneg (by omega) + omega + exact (term_vanishes k B l j hjl).of_iso ((complex k B l).extendXIso (degreeEmbedding l) hj) + +theorem integerTerm_projective (n : ℤ) : Projective ((integerComplex k B l).X n) := by + by_cases h : n < -(l:ℤ) + · exact (integerTerm_lower k B l n h).projective + let j := (n+(l:ℤ)).toNat + have hj : (degreeEmbedding l).f j = n := by + simp only [degreeEmbedding_apply] + dsimp [j] + rw [Int.toNat_of_nonneg (by omega)] + omega + exact Projective.of_iso ((complex k B l).extendXIso (degreeEmbedding l) hj).symm (projectiveTerm k B l j) +end LittleFinitistic.OrdinarySimulation.TensorResolution + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryLeftTensorCongruence.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryLeftTensorCongruence.lean new file mode 100644 index 0000000000000000000000000000000000000000..d24a14ba01ac4e11ca6efd2014056654ab6c6b2d --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryLeftTensorCongruence.lean @@ -0,0 +1,27 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryLeftTensorMaps +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBalancedCongruence + +namespace OAI +noncomputable section +namespace LittleFinitistic.LeftTensor +universe u +variable {k A S M M' N N' : Type u} [Field k] [Ring A] [Ring S] [Algebra k A] [Algebra k S] +variable [AddCommGroup M] [Module k M] [Module Aᵐᵒᵖ M] [IsScalarTower k Aᵐᵒᵖ M] + [Module S M] [IsScalarTower k S M] [SMulCommClass S Aᵐᵒᵖ M] +variable [AddCommGroup M'] [Module k M'] [Module Aᵐᵒᵖ M'] [IsScalarTower k Aᵐᵒᵖ M'] + [Module S M'] [IsScalarTower k S M'] [SMulCommClass S Aᵐᵒᵖ M'] +variable [AddCommGroup N] [Module k N] [Module A N] [IsScalarTower k A N] +variable [AddCommGroup N'] [Module k N'] [Module A N'] [IsScalarTower k A N'] + +/-- Actual balanced tensor congruence retaining the outside left action. -/ +def congr (f : M ≃ₗ[Aᵐᵒᵖ] M') (hf : ∀ (s : S) m, f (s • m) = s • f m) + (g : N ≃ₗ[A] N') : LeftTensor k A S M N ≃ₗ[S] LeftTensor k A S M' N' where + __ := bimap f.toLinearMap hf g.toLinearMap + invFun := (BalancedTensor.congr (k := k) f g).symm + left_inv := (BalancedTensor.congr (k := k) f g).left_inv + right_inv := (BalancedTensor.congr (k := k) f g).right_inv +end LittleFinitistic.LeftTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryLeftTensorMaps.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryLeftTensorMaps.lean new file mode 100644 index 0000000000000000000000000000000000000000..d393c7afc5023fe9e7a711cfd70725bd2870fea6 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryLeftTensorMaps.lean @@ -0,0 +1,43 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryAssociativeTensorModules +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorBimap + +namespace OAI +noncomputable section +namespace LittleFinitistic.LeftTensor +universe u +variable {k A S M M' N N' : Type u} [Field k] [Ring A] [Ring S] [Algebra k A] [Algebra k S] +variable [AddCommGroup M] [Module k M] [Module Aᵐᵒᵖ M] [IsScalarTower k Aᵐᵒᵖ M] + [Module S M] [IsScalarTower k S M] [SMulCommClass S Aᵐᵒᵖ M] +variable [AddCommGroup M'] [Module k M'] [Module Aᵐᵒᵖ M'] [IsScalarTower k Aᵐᵒᵖ M'] + [Module S M'] [IsScalarTower k S M'] [SMulCommClass S Aᵐᵒᵖ M'] +variable [AddCommGroup N] [Module k N] [Module A N] [IsScalarTower k A N] +variable [AddCommGroup N'] [Module k N'] [Module A N'] [IsScalarTower k A N'] + +/-- The actual balanced bimap retains the outside left action. -/ +def bimap (f : M →ₗ[Aᵐᵒᵖ] M') (hf : ∀ (s : S) m, f (s • m) = s • f m) + (g : N →ₗ[A] N') : LeftTensor k A S M N →ₗ[S] LeftTensor k A S M' N' where + __ := (BalancedTensor.bimap (k := k) f g).toAddHom + map_smul' s z := by + change BalancedTensor.bimap (k := k) f g (action k S A M N s z) = + action k S A M' N' s (BalancedTensor.bimap (k := k) f g z) + induction z using BalancedTensor.induction_on with + | hz => + exact ((BalancedTensor.bimap (k := k) f g).comp (action k S A M N s)).map_zero.trans + (((action k S A M' N' s).comp (BalancedTensor.bimap (k := k) f g)).map_zero).symm + | ht m n => + change BalancedTensor.mk k A M' N' (f (s • m)) (g n) = + BalancedTensor.mk k A M' N' (s • f m) (g n) + rw [hf] + | ha x y hx hy => + exact (((BalancedTensor.bimap (k := k) f g).comp (action k S A M N s)).map_add x y).trans + ((congrArg₂ (· + ·) hx hy).trans + (((action k S A M' N' s).comp (BalancedTensor.bimap (k := k) f g)).map_add x y).symm) + +@[simp] theorem bimap_mk (f : M →ₗ[Aᵐᵒᵖ] M') (hf : ∀ (s : S) m, f (s • m) = s • f m) + (g : N →ₗ[A] N') (m : M) (n : N) : + bimap f hf g (mk k S A M N m n) = mk k S A M' N' (f m) (g n) := rfl +end LittleFinitistic.LeftTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryMiddleTensorFunctors.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryMiddleTensorFunctors.lean new file mode 100644 index 0000000000000000000000000000000000000000..9458f64d817983b655eb33d81c4e05ac3e67b289 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryMiddleTensorFunctors.lean @@ -0,0 +1,83 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryAssociativityNaturality +import OAI.Algebra.Finitistic.Ordinary.OrdinaryFixedTensorFunctor + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic +universe u +variable (k A B N : Type u) [Field k] [Ring A] [Ring B] [Algebra k A] [Algebra k B] +variable [AddCommGroup N] [Module k N] [Module A N] [Module Bᵐᵒᵖ N] + [IsScalarTower k A N] [IsScalarTower k Bᵐᵒᵖ N] [SMulCommClass A Bᵐᵒᵖ N] + +/-- Tensor by the fixed middle bimodule, retaining its actual left action. -/ +def middleLeftFunctor : ModuleCat.{u} B ⥤ ModuleCat.{u} A where + obj Z := ModuleCat.of A (LeftTensor k B A N (BalancedTensor.ScalarLeftModule k B Z)) + map {Z Z'} g := ModuleCat.ofHom + (LeftTensor.mapLast (k := k) (A := A) (N := N) + (Z := BalancedTensor.ScalarLeftModule k B Z) (Z' := BalancedTensor.ScalarLeftModule k B Z') g.hom) + map_id Z := by + apply ModuleCat.hom_ext + apply LinearMap.restrictScalars_injective k + apply BalancedTensor.ext + intro n z + rfl + map_comp f g := by + apply ModuleCat.hom_ext + apply LinearMap.restrictScalars_injective k + apply BalancedTensor.ext + intro n z + rfl + +instance middleLeftFunctor_additive : (middleLeftFunctor k A B N).Additive where + map_add {Z Z'} {f g} := by + dsimp only [middleLeftFunctor] + apply ModuleCat.hom_ext + apply LinearMap.restrictScalars_injective k + apply BalancedTensor.ext + intro n z + exact (BalancedTensor.mk k B N (BalancedTensor.ScalarLeftModule k B Z') n).map_add (f.hom z) (g.hom z) + +/-- Tensor a right module by the middle bimodule, retaining its actual right action. -/ +def middleRightFunctor : ModuleCat.{u} Aᵐᵒᵖ ⥤ ModuleCat.{u} Bᵐᵒᵖ where + obj M := ModuleCat.of Bᵐᵒᵖ (RightTensor k A B (BalancedTensor.ScalarLeftModule k Aᵐᵒᵖ M) N) + map {M M'} f := ModuleCat.ofHom + (RightTensor.mapFirst (k := k) (B := B) (N := N) + (M := BalancedTensor.ScalarLeftModule k Aᵐᵒᵖ M) (M' := BalancedTensor.ScalarLeftModule k Aᵐᵒᵖ M') f.hom) + map_id M := by + apply ModuleCat.hom_ext + apply LinearMap.restrictScalars_injective k + apply BalancedTensor.ext + intro m n + rfl + map_comp f g := by + apply ModuleCat.hom_ext + apply LinearMap.restrictScalars_injective k + apply BalancedTensor.ext + intro m n + rfl + +instance middleRightFunctor_additive : (middleRightFunctor k A B N).Additive where + map_add {M M'} {f g} := by + dsimp only [middleRightFunctor] + apply ModuleCat.hom_ext + apply LinearMap.restrictScalars_injective k + apply BalancedTensor.ext + intro m n + exact congrArg (fun h => h n) + ((BalancedTensor.mk k A (BalancedTensor.ScalarLeftModule k Aᵐᵒᵖ M') N).map_add (f.hom m) (g.hom m)) + +/-- The genuine right tensor complex, with its right B-action. -/ +def middleRightComplex (Q : CochainComplex (ModuleCat.{u} Aᵐᵒᵖ) ℤ) : + CochainComplex (ModuleCat.{u} Bᵐᵒᵖ) ℤ := + ((middleRightFunctor k A B N).mapHomologicalComplex (.up ℤ)).obj Q + +/-- The genuine left tensor complex, with its left A-action. -/ +def middleLeftComplex (Z : CochainComplex (ModuleCat.{u} B) ℤ) : + CochainComplex (ModuleCat.{u} A) ℤ := + ((middleLeftFunctor k A B N).mapHomologicalComplex (.up ℤ)).obj Z +end LittleFinitistic + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryOffDiagonalComplex.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryOffDiagonalComplex.lean new file mode 100644 index 0000000000000000000000000000000000000000..1ec5f107c65e8d42edd79b3ec9759568e03708ee --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryOffDiagonalComplex.lean @@ -0,0 +1,44 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryOffDiagonalMaps +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleCoefficients +import Mathlib.Algebra.Homology.Additive + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation.OffDiagonal +universe u +variable (k L R : Type u) [Field k] [Ring L] [Ring R] [Algebra k L] [Algebra k R] +variable (O : CochainComplex (ModuleCat.{u} (R ⊗[k] Lᵐᵒᵖ)) ℤ) +variable (T : CochainComplex (ModuleCat.{u} (L ⊗[k] Rᵐᵒᵖ)) ℤ) + +abbrev complexTerm (n : ℤ) := RetainedBimodule k (L × R) (L × R) + (OffDiagonal (BimoduleCoefficients k R L (O.X n)) (BimoduleCoefficients k L R (T.X n))) + +def complexDifferential (n : ℤ) := + RetainedBimodule.map (k := k) (S := L × R) (A := L × R) + (map (BimoduleCoefficients.map k R L (O.d n (n+1))) + (BimoduleCoefficients.map k L R (T.d n (n+1)))) + (map_left (BimoduleCoefficients.map k R L (O.d n (n+1))) + (BimoduleCoefficients.map_left k R L (O.d n (n+1))) + (BimoduleCoefficients.map k L R (T.d n (n+1))) + (BimoduleCoefficients.map_left k L R (T.d n (n+1)))) + +theorem complexDifferential_square (n : ℤ) : + (complexDifferential k L R O T (n+1)).comp (complexDifferential k L R O T n) = 0 := by + apply LinearMap.ext + intro x + apply Prod.ext + · exact congrArg (fun f => f.hom x.1) (O.d_comp_d n (n+1) ((n+1)+1)) + · exact congrArg (fun f => f.hom x.2) (T.d_comp_d n (n+1) ((n+1)+1)) + +/-- Actual off-diagonal complex with both actions of the product algebra retained. -/ +def complex : CochainComplex (ModuleCat.{u} ((L × R) ⊗[k] (L × R)ᵐᵒᵖ)) ℤ := + CochainComplex.of (fun n => ModuleCat.of _ (complexTerm k L R O T n)) + (fun n => ModuleCat.ofHom (complexDifferential k L R O T n)) + (fun n => ModuleCat.hom_ext (complexDifferential_square k L R O T n)) +end LittleFinitistic.OrdinarySimulation.OffDiagonal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryOffDiagonalComplexMaps.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryOffDiagonalComplexMaps.lean new file mode 100644 index 0000000000000000000000000000000000000000..47299e0dfb4d7f9c7e7130924b0351ca5d90fa0d --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryOffDiagonalComplexMaps.lean @@ -0,0 +1,43 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryOffDiagonalComplex + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation.OffDiagonal +universe u +variable (k L R : Type u) [Field k] [Ring L] [Ring R] [Algebra k L] [Algebra k R] +variable {O O' : CochainComplex (ModuleCat.{u} (R ⊗[k] Lᵐᵒᵖ)) ℤ} +variable {T T' : CochainComplex (ModuleCat.{u} (L ⊗[k] Rᵐᵒᵖ)) ℤ} + +def complexTermMap (f : O ⟶ O') (g : T ⟶ T') (n : ℤ) := + RetainedBimodule.map (k := k) (S := L × R) (A := L × R) + (map (BimoduleCoefficients.map k R L (f.f n)) (BimoduleCoefficients.map k L R (g.f n))) + (map_left (BimoduleCoefficients.map k R L (f.f n)) + (BimoduleCoefficients.map_left k R L (f.f n)) + (BimoduleCoefficients.map k L R (g.f n)) + (BimoduleCoefficients.map_left k L R (g.f n))) + +theorem complex_d (n : ℤ) : (complex k L R O T).d n (n+1) = + ModuleCat.ofHom (complexDifferential k L R O T n) := + CochainComplex.of_d (fun n => ModuleCat.of _ (complexTerm k L R O T n)) + (fun n => ModuleCat.ofHom (complexDifferential k L R O T n)) n + +/-- An actual map of off-diagonal complexes retaining both product-ring actions. -/ +def complexMap (f : O ⟶ O') (g : T ⟶ T') : complex k L R O T ⟶ complex k L R O' T' where + f n := ModuleCat.ofHom (complexTermMap k L R f g n) + comm' n m h := by + change n+1=m at h + subst m + rw [complex_d,complex_d] + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + apply Prod.ext + · exact congrArg (fun h => h.hom x.1) (f.comm n (n+1)) + · exact congrArg (fun h => h.hom x.2) (g.comm n (n+1)) +end LittleFinitistic.OrdinarySimulation.OffDiagonal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryOffDiagonalForget.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryOffDiagonalForget.lean new file mode 100644 index 0000000000000000000000000000000000000000..84ca1a34e6fd1b039ce05bccf0f56b8a5b841ecc --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryOffDiagonalForget.lean @@ -0,0 +1,66 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryOffDiagonalComplexMaps +import OAI.Algebra.Finitistic.Ordinary.OrdinaryRetainedRestriction +import OAI.Algebra.Finitistic.Ordinary.OrdinaryPairQuasiIso +import OAI.Algebra.Finitistic.Ordinary.OrdinaryRestrictionHomology + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation.OffDiagonal +universe u +variable (k L R : Type u) [Field k] [Ring L] [Ring R] [Algebra k L] [Algebra k R] +variable (O : CochainComplex (ModuleCat.{u} (R ⊗[k] Lᵐᵒᵖ)) ℤ) +variable (T : CochainComplex (ModuleCat.{u} (L ⊗[k] Rᵐᵒᵖ)) ℤ) + +def forgetTermIso (n : ℤ) : (underlyingComplex (k := k) (complex k L R O T)).X n ≅ + (PairComplex.complex (underlyingComplex (k := k) O) (underlyingComplex (k := k) T)).X n := + (RetainedBimodule.scalarEquiv k (L × R) (L × R) + (OffDiagonal (BimoduleCoefficients k R L (O.X n)) (BimoduleCoefficients k L R (T.X n)))).toModuleIso + +/-- Forgetting the two outside actions gives the actual coordinate direct-sum complex. -/ +def forgetIso : underlyingComplex (k := k) (complex k L R O T) ≅ + PairComplex.complex (underlyingComplex (k := k) O) (underlyingComplex (k := k) T) := + HomologicalComplex.Hom.isoOfComponents (forgetTermIso k L R O T) (by + intro n m h + change n+1=m at h + subst m + change (forgetTermIso k L R O T n).hom ≫ _ = + (ModuleCat.restrictScalars (algebraMap k ((L × R) ⊗[k] (L × R)ᵐᵒᵖ))).map + ((complex k L R O T).d n (n+1)) ≫ (forgetTermIso k L R O T (n+1)).hom + rw [complex_d,PairComplex.complex_d] + rfl) + +variable {O T} {O' : CochainComplex (ModuleCat.{u} (R ⊗[k] Lᵐᵒᵖ)) ℤ} +variable {T' : CochainComplex (ModuleCat.{u} (L ⊗[k] Rᵐᵒᵖ)) ℤ} + +theorem forgetIso_natural (f : O ⟶ O') (g : T ⟶ T') : + ((ModuleCat.restrictScalars (algebraMap k ((L × R) ⊗[k] (L × R)ᵐᵒᵖ))).mapHomologicalComplex (.up ℤ)).map + (complexMap k L R f g) ≫ (forgetIso k L R O' T').hom = + (forgetIso k L R O T).hom ≫ PairComplex.map + (((ModuleCat.restrictScalars (algebraMap k (R ⊗[k] Lᵐᵒᵖ))).mapHomologicalComplex (.up ℤ)).map f) + (((ModuleCat.restrictScalars (algebraMap k (L ⊗[k] Rᵐᵒᵖ))).mapHomologicalComplex (.up ℤ)).map g) := by + ext n x + rfl + +/-- The actual off-diagonal map is a quasi-isomorphism when its two components are. -/ +theorem complexMap_quasiIso (f : O ⟶ O') (g : T ⟶ T') [QuasiIso f] [QuasiIso g] : + QuasiIso (complexMap k L R f g) := by + apply (RestrictionHomology.quasiIso_iff (algebraMap k ((L × R) ⊗[k] (L × R)ᵐᵒᵖ)) _).mp + let f' := ((ModuleCat.restrictScalars (algebraMap k (R ⊗[k] Lᵐᵒᵖ))).mapHomologicalComplex (.up ℤ)).map f + let g' := ((ModuleCat.restrictScalars (algebraMap k (L ⊗[k] Rᵐᵒᵖ))).mapHomologicalComplex (.up ℤ)).map g + have : QuasiIso f' := (RestrictionHomology.quasiIso_iff (algebraMap k (R ⊗[k] Lᵐᵒᵖ)) f).mpr inferInstance + have : QuasiIso g' := (RestrictionHomology.quasiIso_iff (algebraMap k (L ⊗[k] Rᵐᵒᵖ)) g).mpr inferInstance + have := PairComplex.map_quasiIso f' g' + let h := ((ModuleCat.restrictScalars (algebraMap k ((L × R) ⊗[k] (L × R)ᵐᵒᵖ))).mapHomologicalComplex (.up ℤ)).map + (complexMap k L R f g) + have hh : QuasiIso (h ≫ (forgetIso k L R O' T').hom) := by + dsimp only [h] + rw [forgetIso_natural] + exact inferInstanceAs (QuasiIso ((forgetIso k L R O T).hom ≫ PairComplex.map f' g')) + exact (quasiIso_iff_comp_right h (forgetIso k L R O' T').hom).mp hh +end LittleFinitistic.OrdinarySimulation.OffDiagonal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryOffDiagonalMaps.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryOffDiagonalMaps.lean new file mode 100644 index 0000000000000000000000000000000000000000..e6e61f023c4aff47034e39e18d6d708797696575 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryOffDiagonalMaps.lean @@ -0,0 +1,31 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBlockBimodule +import OAI.Algebra.Finitistic.Ordinary.OrdinaryRetainedBimodule + +namespace OAI +noncomputable section +namespace LittleFinitistic.OrdinarySimulation.OffDiagonal +universe u +variable {L R O O' T T' : Type u} [Ring L] [Ring R] +variable [AddCommGroup O] [AddCommGroup O'] [AddCommGroup T] [AddCommGroup T'] +variable [Module R O] [Module R O'] [Module L T] [Module L T'] +variable [Module Lᵐᵒᵖ O] [Module Lᵐᵒᵖ O'] [Module Rᵐᵒᵖ T] [Module Rᵐᵒᵖ T'] + +/-- Actual component maps of the off-diagonal right product-ring module. -/ +def map (f : O →ₗ[Lᵐᵒᵖ] O') (g : T →ₗ[Rᵐᵒᵖ] T') : + OffDiagonal O T →ₗ[(L × R)ᵐᵒᵖ] OffDiagonal O' T' where + toFun x := (f x.1,g x.2) + map_add' left right := Prod.ext (f.map_add left.1 right.1) (g.map_add left.2 right.2) + map_smul' d x := Prod.ext (f.map_smul (MulOpposite.op d.unop.1) x.1) + (g.map_smul (MulOpposite.op d.unop.2) x.2) + +/-- The same map retains the two prescribed left product-ring actions. -/ +theorem map_left (f : O →ₗ[Lᵐᵒᵖ] O') (hf : ∀ (r : R) x, f (r • x) = r • f x) + (g : T →ₗ[Rᵐᵒᵖ] T') (hg : ∀ (s : L) x, g (s • x) = s • g x) + (d : L × R) (x : OffDiagonal O T) : + map f g (d • x) = d • map f g x := + Prod.ext (hf d.2 x.1) (hg d.1 x.2) +end LittleFinitistic.OrdinarySimulation.OffDiagonal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryOffDiagonalObjects.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryOffDiagonalObjects.lean new file mode 100644 index 0000000000000000000000000000000000000000..9ee5f6738e15258f6b67fd8b43393f3a534aa05c --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryOffDiagonalObjects.lean @@ -0,0 +1,50 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryOffDiagonalComplexMaps +import OAI.Algebra.Finitistic.Ordinary.OrdinaryRetainedRestriction + +namespace OAI +noncomputable section +open CategoryTheory Limits +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation.OffDiagonal +universe u +variable (k L R : Type u) [Field k] [Ring L] [Ring R] [Algebra k L] [Algebra k R] +variable (O : ModuleCat.{u} (R ⊗[k] Lᵐᵒᵖ)) (T : ModuleCat.{u} (L ⊗[k] Rᵐᵒᵖ)) + +abbrev object : ModuleCat.{u} ((L × R) ⊗[k] (L × R)ᵐᵒᵖ) := + RetainedBimodule.object k (L × R) (L × R) + (OffDiagonal (BimoduleCoefficients k R L O) (BimoduleCoefficients k L R T)) + +variable {O T} {O' : ModuleCat.{u} (R ⊗[k] Lᵐᵒᵖ)} {T' : ModuleCat.{u} (L ⊗[k] Rᵐᵒᵖ)} + +def objectMap (f : O ⟶ O') (g : T ⟶ T') : object k L R O T ⟶ object k L R O' T' := + ModuleCat.ofHom (RetainedBimodule.map (k := k) (S := L × R) (A := L × R) + (map (BimoduleCoefficients.map k R L f) (BimoduleCoefficients.map k L R g)) + (map_left (BimoduleCoefficients.map k R L f) (BimoduleCoefficients.map_left k R L f) + (BimoduleCoefficients.map k L R g) (BimoduleCoefficients.map_left k L R g))) + +def objectIso (f : O ≅ O') (g : T ≅ T') : object k L R O T ≅ object k L R O' T' where + hom := objectMap k L R f.hom g.hom + inv := objectMap k L R f.inv g.inv + hom_inv_id := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + exact Prod.ext (congrArg (fun h => h.hom x.1) f.hom_inv_id) + (congrArg (fun h => h.hom x.2) g.hom_inv_id) + inv_hom_id := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + exact Prod.ext (congrArg (fun h => h.hom x.1) f.inv_hom_id) + (congrArg (fun h => h.hom x.2) g.inv_hom_id) + +theorem object_isZero (hO : IsZero O) (hT : IsZero T) : IsZero (object k L R O T) := by + have := ModuleCat.isZero_iff_subsingleton.mp hO + have := ModuleCat.isZero_iff_subsingleton.mp hT + apply ModuleCat.isZero_iff_subsingleton.mpr + exact inferInstanceAs (Subsingleton (O × T)) +end LittleFinitistic.OrdinarySimulation.OffDiagonal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryOffDiagonalProjective.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryOffDiagonalProjective.lean new file mode 100644 index 0000000000000000000000000000000000000000..89aab37d05d9faba0be8bf898e07f773e2067a46 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryOffDiagonalProjective.lean @@ -0,0 +1,52 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryOffDiagonalMaps +import OAI.Algebra.Finitistic.Ordinary.OrdinaryProductOpposite + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.OrdinarySimulation.OffDiagonal +universe u +variable (L R O T : Type u) [Ring L] [Ring R] +variable [AddCommGroup O] [AddCommGroup T] [Module Lᵐᵒᵖ O] [Module Rᵐᵒᵖ T] +open ProductModules + +abbrev inflatedPair : ModuleCat.{u} (Lᵐᵒᵖ × Rᵐᵒᵖ) := ModuleCat.of _ + (((firstInflation Lᵐᵒᵖ Rᵐᵒᵖ).obj (ModuleCat.of Lᵐᵒᵖ O)) × + ((secondInflation Lᵐᵒᵖ Rᵐᵒᵖ).obj (ModuleCat.of Rᵐᵒᵖ T))) + +attribute [local instance] RingHomInvPair.of_ringEquiv + +def rightPairEquiv : OffDiagonal O T ≃ₛₗ[RingHomClass.toRingHom (oppositeEquiv L R)] + inflatedPair L R O T where + toFun x := x + invFun x := x + left_inv _ := rfl + right_inv _ := rfl + map_add' _ _ := rfl + map_smul' _ _ := rfl + +/-- Off-diagonal right projectivity follows from the actual two product-factor modules. -/ +theorem right_projective [Module.Projective Lᵐᵒᵖ O] [Module.Projective Rᵐᵒᵖ T] : + Module.Projective (L × R)ᵐᵒᵖ (OffDiagonal O T) := by + let P := ModuleCat.of Lᵐᵒᵖ O + let Q := ModuleCat.of Rᵐᵒᵖ T + have : Projective P := ModuleCat.projective_of_categoryTheory_projective P + have : Projective Q := ModuleCat.projective_of_categoryTheory_projective Q + have : HasProjectiveDimensionLE P 0 := (projective_iff_hasProjectiveDimensionLT_one (X := P)).mp inferInstance + have : HasProjectiveDimensionLE Q 0 := (projective_iff_hasProjectiveDimensionLT_one (X := Q)).mp inferInstance + have := firstInflation_dimensionLE Lᵐᵒᵖ Rᵐᵒᵖ 0 P + have := secondInflation_dimensionLE Lᵐᵒᵖ Rᵐᵒᵖ 0 Q + let e := ModuleCat.biprodIsoProd ((firstInflation Lᵐᵒᵖ Rᵐᵒᵖ).obj P) + ((secondInflation Lᵐᵒᵖ Rᵐᵒᵖ).obj Q) + have : HasProjectiveDimensionLT (inflatedPair L R O T) 1 := hasProjectiveDimensionLT_of_iso e 1 + have : HasProjectiveDimensionLE (ModuleCat.of (L × R)ᵐᵒᵖ (OffDiagonal O T)) 0 := + ModuleCat.hasProjectiveDimensionLE_of_semiLinearEquiv (oppositeEquiv L R).symm + (rightPairEquiv L R O T).symm 0 + have : Projective (ModuleCat.of (L × R)ᵐᵒᵖ (OffDiagonal O T)) := + (projective_iff_hasProjectiveDimensionLT_one (X := ModuleCat.of (L × R)ᵐᵒᵖ (OffDiagonal O T))).mpr inferInstance + exact ModuleCat.projective_of_module_projective (ModuleCat.of (L × R)ᵐᵒᵖ (OffDiagonal O T)) +end LittleFinitistic.OrdinarySimulation.OffDiagonal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryOffDiagonalSingle.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryOffDiagonalSingle.lean new file mode 100644 index 0000000000000000000000000000000000000000..8e85cfd45ffc167d0446636ea8da60e4aec328f0 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryOffDiagonalSingle.lean @@ -0,0 +1,45 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryOffDiagonalObjects +import Mathlib.Algebra.Homology.Single + +namespace OAI +noncomputable section +open CategoryTheory Limits +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation.OffDiagonal +universe u +variable (k L R : Type u) [Field k] [Ring L] [Ring R] [Algebra k L] [Algebra k R] +variable (O : ModuleCat.{u} (R ⊗[k] Lᵐᵒᵖ)) (T : ModuleCat.{u} (L ⊗[k] Rᵐᵒᵖ)) + +abbrev singles : CochainComplex (ModuleCat.{u} ((L × R) ⊗[k] (L × R)ᵐᵒᵖ)) ℤ := + complex k L R ((HomologicalComplex.single _ (.up ℤ) 0).obj O) + ((HomologicalComplex.single _ (.up ℤ) 0).obj T) + +theorem singles_isZero (n : ℤ) (hn : n ≠ 0) : IsZero ((singles k L R O T).X n) := + object_isZero k L R (HomologicalComplex.isZero_single_obj_X (.up ℤ) 0 O n hn) + (HomologicalComplex.isZero_single_obj_X (.up ℤ) 0 T n hn) + +def singleTermIso (n : ℤ) : (singles k L R O T).X n ≅ + ((HomologicalComplex.single _ (.up ℤ) 0).obj (object k L R O T)).X n := by + by_cases hn : n = 0 + · subst n + exact objectIso k L R (HomologicalComplex.singleObjXSelf (.up ℤ) 0 O) + (HomologicalComplex.singleObjXSelf (.up ℤ) 0 T) ≪≫ + (HomologicalComplex.singleObjXSelf (.up ℤ) 0 (object k L R O T)).symm + · exact (singles_isZero k L R O T n hn).iso + (HomologicalComplex.isZero_single_obj_X (.up ℤ) 0 (object k L R O T) n hn) + +/-- The off-diagonal direct sum of two ordinary modules is their ordinary bimodule in degree zero. -/ +def singleIso : singles k L R O T ≅ + (HomologicalComplex.single _ (.up ℤ) 0).obj (object k L R O T) := + HomologicalComplex.Hom.isoOfComponents (singleTermIso k L R O T) (by + intro n m h + change n+1=m at h + by_cases hn : n = 0 + · have hm : m ≠ 0 := by omega + exact (HomologicalComplex.isZero_single_obj_X (.up ℤ) 0 (object k L R O T) m hm).eq_of_tgt _ _ + · exact (singles_isZero k L R O T n hn).eq_of_src _ _) +end LittleFinitistic.OrdinarySimulation.OffDiagonal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryPairComplex.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryPairComplex.lean new file mode 100644 index 0000000000000000000000000000000000000000..f93a0558835aa023cb381c3327e6ff1a9c713605 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryPairComplex.lean @@ -0,0 +1,86 @@ +import Mathlib.Algebra.Homology.Additive +import Mathlib.Algebra.Homology.QuasiIso +import Mathlib.Algebra.Homology.HomologicalComplexBiprod +import Mathlib.Algebra.Category.ModuleCat.Biproducts + +namespace OAI +noncomputable section +open CategoryTheory Limits +namespace LittleFinitistic.PairComplex +universe u +variable {k : Type u} [Ring k] +variable (O T : CochainComplex (ModuleCat.{u} k) ℤ) + +def complex : CochainComplex (ModuleCat.{u} k) ℤ := + CochainComplex.of (fun n => ModuleCat.of k (O.X n × T.X n)) + (fun n => ModuleCat.ofHom ((O.d n (n+1)).hom.prodMap (T.d n (n+1)).hom)) (by + intro n + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + exact Prod.ext (congrArg (fun h => h.hom x.1) (O.d_comp_d n (n+1) ((n+1)+1))) + (congrArg (fun h => h.hom x.2) (T.d_comp_d n (n+1) ((n+1)+1)))) + +theorem complex_d (n : ℤ) : (complex O T).d n (n+1) = + ModuleCat.ofHom ((O.d n (n+1)).hom.prodMap (T.d n (n+1)).hom) := + CochainComplex.of_d (fun n => ModuleCat.of k (O.X n × T.X n)) + (fun n => ModuleCat.ofHom ((O.d n (n+1)).hom.prodMap (T.d n (n+1)).hom)) n + +def fst : complex O T ⟶ O where + f n := ModuleCat.ofHom (LinearMap.fst k (O.X n) (T.X n)) + comm' n m h := by + change n+1=m at h + subst m + rw [complex_d] + rfl + +def snd : complex O T ⟶ T where + f n := ModuleCat.ofHom (LinearMap.snd k (O.X n) (T.X n)) + comm' n m h := by + change n+1=m at h + subst m + rw [complex_d] + rfl + +def inl : O ⟶ complex O T where + f n := ModuleCat.ofHom (LinearMap.inl k (O.X n) (T.X n)) + comm' n m h := by + change n+1=m at h + subst m + rw [complex_d] + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + exact Prod.ext rfl ((T.d n (n+1)).hom.map_zero) + +def inr : T ⟶ complex O T where + f n := ModuleCat.ofHom (LinearMap.inr k (O.X n) (T.X n)) + comm' n m h := by + change n+1=m at h + subst m + rw [complex_d] + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + exact Prod.ext ((O.d n (n+1)).hom.map_zero) rfl + +@[simp] theorem inl_fst : inl O T ≫ fst O T = 𝟙 O := by ext degree element; rfl +@[simp] theorem inl_snd : inl O T ≫ snd O T = 0 := by ext degree element; rfl +@[simp] theorem inr_fst : inr O T ≫ fst O T = 0 := by ext degree element; rfl +@[simp] theorem inr_snd : inr O T ≫ snd O T = 𝟙 T := by ext degree element; rfl + +/-- The actual coordinate complex is the native binary biproduct. -/ +def biprodIso : complex O T ≅ O ⊞ T where + hom := biprod.lift (fst O T) (snd O T) + inv := biprod.desc (inl O T) (inr O T) + hom_inv_id := by + rw [biprod.lift_desc] + ext n x + exact Prod.ext (add_zero _) (zero_add _) + inv_hom_id := by + apply biprod.hom_ext <;> apply biprod.hom_ext' <;> simp [Category.assoc] +end LittleFinitistic.PairComplex + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryPairQuasiIso.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryPairQuasiIso.lean new file mode 100644 index 0000000000000000000000000000000000000000..49fd8029749aada90f92d17f29e4243352f5b1f7 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryPairQuasiIso.lean @@ -0,0 +1,74 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryPairComplex +import Mathlib.Algebra.Homology.HomologicalComplexAbelian +import Mathlib.CategoryTheory.Preadditive.AdditiveFunctor + +namespace OAI +noncomputable section +open CategoryTheory Limits +namespace LittleFinitistic.PairComplex +universe u +variable {k : Type u} [Ring k] +variable {O O' T T' : CochainComplex (ModuleCat.{u} k) ℤ} + +def map (f : O ⟶ O') (g : T ⟶ T') : complex O T ⟶ complex O' T' where + f n := ModuleCat.ofHom ((f.f n).hom.prodMap (g.f n).hom) + comm' n m h := by + change n+1=m at h + subst m + rw [complex_d,complex_d] + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + exact Prod.ext (congrArg (fun h => h.hom x.1) (f.comm n (n+1))) + (congrArg (fun h => h.hom x.2) (g.comm n (n+1))) + +theorem biprodIso_natural (f : O ⟶ O') (g : T ⟶ T') : + map f g ≫ (biprodIso O' T').hom = (biprodIso O T).hom ≫ biprod.map f g := by + apply biprod.hom_ext + · simp only [biprodIso,Category.assoc,biprod.lift_fst,biprod.map_fst,biprod.lift_fst_assoc] + ext n x + rfl + · simp only [biprodIso,Category.assoc,biprod.lift_snd,biprod.map_snd,biprod.lift_snd_assoc] + ext n x + rfl + +/-- Native binary biproducts preserve actual quasi-isomorphisms. -/ +theorem biprodMap_quasiIso (f : O ⟶ O') (g : T ⟶ T') [QuasiIso f] [QuasiIso g] : + QuasiIso (biprod.map f g) := by + constructor + intro i + apply (quasiIsoAt_iff_isIso_homologyMap _ i).mpr + let H := HomologicalComplex.homologyFunctor (ModuleCat.{u} k) (.up ℤ) i + let : H.Additive := inferInstanceAs ((HomologicalComplex.homologyFunctor (ModuleCat.{u} k) (.up ℤ) i).Additive) + let : PreservesFiniteBiproducts H := Functor.preservesFiniteBiproductsOfAdditive H + let : PreservesBinaryBiproducts H := preservesBinaryBiproducts_of_preservesBiproducts H + have : IsIso (H.map f) := (quasiIsoAt_iff_isIso_homologyMap f i).mp inferInstance + have : IsIso (H.map g) := (quasiIsoAt_iff_isIso_homologyMap g i).mp inferInstance + change IsIso (H.map (biprod.map f g)) + have he : H.map (biprod.map f g) ≫ (H.mapBiprod O' T').hom = + (H.mapBiprod O T).hom ≫ biprod.map (H.map f) (H.map g) := by + apply biprod.hom_ext + · simp only [Functor.mapBiprod_hom,Category.assoc,biprod.lift_fst,biprod.map_fst,biprod.lift_fst_assoc,← H.map_comp] + · simp only [Functor.mapBiprod_hom,Category.assoc,biprod.lift_snd,biprod.map_snd,biprod.lift_snd_assoc,← H.map_comp] + have : IsIso (biprod.map (H.map f) (H.map g)) := by + refine ⟨⟨biprod.map (inv (H.map f)) (inv (H.map g)), ?_, ?_⟩⟩ + · apply biprod.hom_ext <;> simp [Category.assoc] + · apply biprod.hom_ext <;> simp [Category.assoc] + have h : IsIso (H.map (biprod.map f g) ≫ (H.mapBiprod O' T').hom) := by + rw [he] + infer_instance + exact (isIso_comp_right_iff _ (H.mapBiprod O' T').hom).mp h + +/-- Coordinatewise quasi-isomorphisms give a quasi-isomorphism of the actual direct sum. -/ +theorem map_quasiIso (f : O ⟶ O') (g : T ⟶ T') [QuasiIso f] [QuasiIso g] : + QuasiIso (map f g) := by + have := biprodMap_quasiIso f g + have h : QuasiIso (map f g ≫ (biprodIso O' T').hom) := by + rw [biprodIso_natural] + infer_instance + exact (quasiIso_iff_comp_right (map f g) (biprodIso O' T').hom).mp h +end LittleFinitistic.PairComplex + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryProductComponent.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryProductComponent.lean new file mode 100644 index 0000000000000000000000000000000000000000..f61b64550642e26f04b55d8afe328cb1b7f78bcb --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryProductComponent.lean @@ -0,0 +1,101 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryRestrictionHomology +import Mathlib.Algebra.Category.ModuleCat.Projective + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.ProductModules +universe u v +variable (L R : Type u) [Ring L] [Ring R] +variable (M : ModuleCat.{v} (L × R)) + +/-- The actual first central-idempotent summand of an arbitrary product-ring module. -/ +def firstSpace : Submodule (L × R) M where + carrier := {m | ((1,0) : L × R) • m = m} + zero_mem' := smul_zero _ + add_mem' {x y} hx hy := by + change ((1,0) : L × R) • (x+y) = x+y + rw [smul_add,hx,hy] + smul_mem' d x hx := by + change ((1,0) : L × R) • (d • x) = d • x + have he : ((1,0) : L × R) * d = d * (1,0) := by ext <;> simp + rw [← mul_smul,he,mul_smul,hx] + +def firstScalar (r : L) : firstSpace L R M →ₗ[ℤ] firstSpace L R M where + toFun x := ⟨(r,(0:R)) • x.val, by + change ((1,0) : L × R) • ((r,(0:R)) • x.val) = (r,(0:R)) • x.val + rw [← mul_smul] + have h : ((1,0) : L × R) * (r,(0:R)) = (r,(0:R)) := by ext <;> simp + rw [h]⟩ + map_add' x y := Subtype.ext (smul_add _ _ _) + map_smul' n x := by + apply Subtype.ext + exact smul_comm ((r,(0:R)) : L × R) n x.val + +def firstAction : L →+* Module.End ℤ (firstSpace L R M) where + toFun := firstScalar L R M + map_one' := by + apply LinearMap.ext + intro x + apply Subtype.ext + change ((1,0) : L × R) • x.val = x.val + exact x.property + map_zero' := by + apply LinearMap.ext + intro x + apply Subtype.ext + change (0 : L × R) • x.val = 0 + exact zero_smul (L × R) x.val + map_add' r s := by + apply LinearMap.ext + intro x + apply Subtype.ext + change ((r+s,(0:R)) : L × R) • x.val = (r,(0:R)) • x.val + (s,(0:R)) • x.val + simpa only [Prod.mk_add_mk,add_zero] using add_smul ((r,(0:R)) : L × R) (s,(0:R)) x.val + map_mul' r s := by + apply LinearMap.ext + intro x + apply Subtype.ext + change ((r*s,(0:R)) : L × R) • x.val = (r,(0:R)) • ((s,(0:R)) • x.val) + rw [← mul_smul] + have h : ((r,(0:R)) : L × R) * (s,0) = (r*s,0) := by ext <;> simp + rw [h] + +instance firstModule : Module L (firstSpace L R M) := Module.compHom _ (firstAction L R M) + +abbrev firstObject : ModuleCat.{v} L := ModuleCat.of L (firstSpace L R M) + +variable {M} {N : ModuleCat.{v} (L × R)} + +def firstMap (f : M ⟶ N) : firstSpace L R M →ₗ[L] firstSpace L R N where + toFun x := ⟨f.hom x.val, by + change ((1,0) : L × R) • f.hom x.val = f.hom x.val + rw [← f.hom.map_smul,x.property]⟩ + map_add' x y := Subtype.ext (f.hom.map_add _ _) + map_smul' r x := Subtype.ext (f.hom.map_smul ((r,(0:R)) : L × R) x.val) + +/-- The actual component functor, constructed on every module and map. -/ +def firstFunctor : ModuleCat.{v} (L × R) ⥤ ModuleCat.{v} L where + obj M := firstObject L R M + map f := ModuleCat.ofHom (firstMap L R f) + map_id M := by rfl + map_comp f g := by rfl + +/-- Surjections remain surjections on the selected component, by projecting a preimage. -/ +theorem firstMap_surjective (f : M ⟶ N) (hf : Function.Surjective f.hom) : + Function.Surjective (firstMap L R f) := by + intro y + obtain ⟨x,hx⟩ := hf y.val + refine ⟨⟨((1,0) : L × R) • x,?_⟩,?_⟩ + · change ((1,0) : L × R) • (((1,0) : L × R) • x) = ((1,0) : L × R) • x + rw [← mul_smul] + have h : ((1,0) : L × R) * (1,0) = (1,0) := by ext <;> simp + rw [h] + · apply Subtype.ext + change f.hom (((1,0) : L × R) • x) = y.val + rw [f.hom.map_smul,hx,y.property] +end LittleFinitistic.ProductModules + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryProductDimension.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryProductDimension.lean new file mode 100644 index 0000000000000000000000000000000000000000..fcf18953204e01ea764a0c1b22b5fe8450db5d76 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryProductDimension.lean @@ -0,0 +1,46 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryProductProjective +import Mathlib.Algebra.Category.ModuleCat.ProjectiveDimension + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.ProductModules +universe u v +variable (L R : Type u) [Ring L] [Ring R] [Small.{v} L] [Small.{v} R] + +omit [Small.{v} L] [Small.{v} R] in +/-- Exactness of actual inflation, with the module universe independent of the ring universe. -/ +theorem firstInflation_preservesHomology : + (firstInflation.{u,v} L R).PreservesHomology := + CategoryTheory.Functor.preservesHomology_of_map_exact _ (fun K hK => by + rw [ShortComplex.moduleCat_exact_iff] at hK ⊢ + exact hK) + +omit [Small.{v} R] in +/-- Inflation from a factor preserves finite projective-dimension bounds, via actual projective covers. -/ +theorem firstInflation_dimensionLE (n : ℕ) (M : ModuleCat.{v} L) [HasProjectiveDimensionLE M n] : + HasProjectiveDimensionLE ((firstInflation L R).obj M) n := by + induction n generalizing M with + | zero => + have : Projective M := (projective_iff_hasProjectiveDimensionLT_one (X := M)).mpr inferInstance + have := firstInflation_projective L R M + infer_instance + | succ n ih => + let S := M.projectiveShortComplex + have hS := M.shortExact_projectiveShortComplex + have : HasProjectiveDimensionLT S.X₁ (n+1) := + (hS.hasProjectiveDimensionLT_X₃_iff n inferInstance).mp inferInstance + have hk := ih S.X₁ + have hp := firstInflation_projective L R S.X₂ + have := firstInflation_preservesHomology.{u,v} L R + have : Mono ((firstInflation L R).map S.f) := + (ModuleCat.mono_iff_injective _).mpr ((ModuleCat.mono_iff_injective S.f).mp hS.mono_f) + have : Epi ((firstInflation L R).map S.g) := + (ModuleCat.epi_iff_surjective _).mpr ((ModuleCat.epi_iff_surjective S.g).mp hS.epi_g) + have hs : (S.map (firstInflation L R)).ShortExact := hS.map (firstInflation L R) + exact (hs.hasProjectiveDimensionLT_X₃_iff n hp).mpr hk +end LittleFinitistic.ProductModules + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryProductOpposite.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryProductOpposite.lean new file mode 100644 index 0000000000000000000000000000000000000000..3a0dc4e7a1a5737f52bf6de1431d9c9cfa030929 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryProductOpposite.lean @@ -0,0 +1,49 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryProductSecondDimension +import Mathlib.Algebra.Algebra.Opposite + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.ProductModules +universe u v +variable (L R : Type u) [Ring L] [Ring R] + +/-- The opposite of the actual product ring is the product of the two opposite rings. -/ +def oppositeEquiv : (L × R)ᵐᵒᵖ ≃+* Lᵐᵒᵖ × Rᵐᵒᵖ where + toFun x := (MulOpposite.op x.unop.1,MulOpposite.op x.unop.2) + invFun x := MulOpposite.op (x.1.unop,x.2.unop) + left_inv _ := rfl + right_inv _ := rfl + map_add' _ _ := rfl + map_mul' _ _ := rfl + +abbrev oppositeModule (M : ModuleCat.{v} (L × R)ᵐᵒᵖ) : ModuleCat.{v} (Lᵐᵒᵖ × Rᵐᵒᵖ) := + (ModuleCat.restrictScalars (oppositeEquiv L R).symm.toRingHom).obj M + +attribute [local instance] RingHomInvPair.of_ringEquiv + +def oppositeModuleEquiv (M : ModuleCat.{v} (L × R)ᵐᵒᵖ) : + M ≃ₛₗ[RingHomClass.toRingHom (oppositeEquiv L R)] oppositeModule L R M where + toFun x := x + invFun x := x + left_inv _ := rfl + right_inv _ := rfl + map_add' _ _ := rfl + map_smul' _ _ := rfl + +variable [Small.{v} L] [Small.{v} R] + +theorem opposite_product_module_bound (n : ℕ) + (hL : ∀ M : ModuleCat.{v} Lᵐᵒᵖ, projectiveDimension M ≤ (n : ℕ)) + (hR : ∀ M : ModuleCat.{v} Rᵐᵒᵖ, projectiveDimension M ≤ (n : ℕ)) + (M : ModuleCat.{v} (L × R)ᵐᵒᵖ) : projectiveDimension M ≤ (n : ℕ) := by + let : Small.{v} Lᵐᵒᵖ := small_of_injective (@MulOpposite.unop_injective L) + let : Small.{v} Rᵐᵒᵖ := small_of_injective (@MulOpposite.unop_injective R) + let : Small.{v} (L × R)ᵐᵒᵖ := small_of_injective (@MulOpposite.unop_injective (L × R)) + rw [ModuleCat.projectiveDimension_eq_of_semiLinearEquiv (oppositeEquiv L R) (oppositeModuleEquiv L R M)] + exact product_module_bound Lᵐᵒᵖ Rᵐᵒᵖ n hL hR (oppositeModule L R M) +end LittleFinitistic.ProductModules + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryProductProjective.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryProductProjective.lean new file mode 100644 index 0000000000000000000000000000000000000000..b2d90e9d5fe78cda06ae93c63c21b86b0e2afcaf --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryProductProjective.lean @@ -0,0 +1,61 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryProductComponent + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.ProductModules +universe u v +variable (L R : Type u) [Ring L] [Ring R] + +abbrev firstInflation : ModuleCat.{v} L ⥤ ModuleCat.{v} (L × R) := + ModuleCat.restrictScalars (RingHom.fst L R) + +variable {P : ModuleCat.{v} L} {M : ModuleCat.{v} (L × R)} + +def intoFirst (g : (firstInflation L R).obj P ⟶ M) : P ⟶ firstObject L R M := + ModuleCat.ofHom + { toFun := fun x => ⟨g.hom x, by + have h := g.hom.map_smul ((1,0) : L × R) x + change g.hom ((1:L) • x) = ((1,0) : L × R) • g.hom x at h + rw [one_smul] at h + exact h.symm⟩ + map_add' := fun x y => Subtype.ext (g.hom.map_add x y) + map_smul' := fun r x => Subtype.ext (g.hom.map_smul ((r,0) : L × R) x) } + +theorem firstSpace_product_smul (d : L × R) (x : firstSpace L R M) : + d • x.val = ((d.1,0) : L × R) • x.val := by + have he : d * ((1,0) : L × R) = (d.1,0) := by ext <;> simp + calc + d • x.val = d • (((1,0) : L × R) • x.val) := by rw [x.property] + _ = (d * ((1,0) : L × R)) • x.val := (mul_smul _ _ _).symm + _ = _ := by rw [he] + +def outOfFirst (g : P ⟶ firstObject L R M) : (firstInflation L R).obj P ⟶ M := by + letI : Module (L × R) P := Module.compHom P (RingHom.fst L R) + exact ModuleCat.ofHom (show (firstInflation L R).obj P →ₗ[L × R] M from + { toFun := fun x => (g.hom x).val + map_add' := fun x y => congrArg Subtype.val (g.hom.map_add x y) + map_smul' := fun d x => by + have h := congrArg Subtype.val (g.hom.map_smul d.1 x) + exact h.trans (firstSpace_product_smul L R d (g.hom x)).symm }) + +/-- Inflation from one factor preserves actual projective objects. -/ +theorem firstInflation_projective (P : ModuleCat.{v} L) [Projective P] : + Projective ((firstInflation L R).obj P) := by + refine ⟨fun g E he => ?_⟩ + let e : firstObject L R _ ⟶ firstObject L R _ := (firstFunctor L R).map E + let g' := intoFirst L R g + let : Epi e := (ModuleCat.epi_iff_surjective e).mpr + (firstMap_surjective L R E ((ModuleCat.epi_iff_surjective E).mp he)) + let h := Projective.factorThru g' e + refine ⟨outOfFirst L R h,?_⟩ + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + have hh := congrArg (fun f => f.hom x) (Projective.factorThru_comp g' e) + exact congrArg Subtype.val hh +end LittleFinitistic.ProductModules + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryProductSecondDimension.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryProductSecondDimension.lean new file mode 100644 index 0000000000000000000000000000000000000000..5417ee7150cf7974f6b4a416d9024feedf8fa3d8 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryProductSecondDimension.lean @@ -0,0 +1,52 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryProductDimension +import OAI.Algebra.Finitistic.Ordinary.OrdinaryProductSplitting +import Mathlib.Algebra.Category.ModuleCat.Biproducts + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.ProductModules +universe u v +variable (L R : Type u) [Ring L] [Ring R] + +attribute [local instance] RingHomInvPair.of_ringEquiv + +/-- Swapping product factors identifies the two actual inflation constructions. -/ +def swapInflationEquiv (P : ModuleCat.{v} R) : + (firstInflation R L).obj P ≃ₛₗ[RingHomClass.toRingHom (RingEquiv.prodComm : R × L ≃+* L × R)] + (secondInflation L R).obj P where + toFun x := x + invFun x := x + left_inv _ := rfl + right_inv _ := rfl + map_add' _ _ := rfl + map_smul' _ _ := rfl + +variable [Small.{v} L] [Small.{v} R] + +theorem secondInflation_dimensionLE (n : ℕ) (P : ModuleCat.{v} R) [HasProjectiveDimensionLE P n] : + HasProjectiveDimensionLE ((secondInflation L R).obj P) n := by + have := firstInflation_dimensionLE R L n P + exact ModuleCat.hasProjectiveDimensionLE_of_semiLinearEquiv + (RingEquiv.prodComm : R × L ≃+* L × R) (swapInflationEquiv L R P) n + +/-- Each module over the product has the same finite bound as its two factors. -/ +theorem product_module_bound (n : ℕ) + (hL : ∀ M : ModuleCat.{v} L, projectiveDimension M ≤ (n : ℕ)) + (hR : ∀ M : ModuleCat.{v} R, projectiveDimension M ≤ (n : ℕ)) + (M : ModuleCat.{v} (L × R)) : projectiveDimension M ≤ (n : ℕ) := by + have : HasProjectiveDimensionLE (firstObject L R M) n := (projectiveDimension_le_iff _ n).mp (hL _) + have : HasProjectiveDimensionLE (secondObject L R M) n := (projectiveDimension_le_iff _ n).mp (hR _) + have := firstInflation_dimensionLE L R n (firstObject L R M) + have := secondInflation_dimensionLE L R n (secondObject L R M) + let e := ModuleCat.biprodIsoProd ((firstInflation L R).obj (firstObject L R M)) + ((secondInflation L R).obj (secondObject L R M)) + have : HasProjectiveDimensionLT (pairObject L R M) (n+1) := hasProjectiveDimensionLT_of_iso e (n+1) + have : HasProjectiveDimensionLT M (n+1) := + hasProjectiveDimensionLT_of_iso (splitting L R M).toModuleIso.symm (n+1) + exact (projectiveDimension_le_iff _ n).mpr inferInstance +end LittleFinitistic.ProductModules + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryProductSplitting.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryProductSplitting.lean new file mode 100644 index 0000000000000000000000000000000000000000..f8b6cd1e19180fd0ed2c53775521f561543865df --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryProductSplitting.lean @@ -0,0 +1,101 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryProductProjective +import Mathlib.Algebra.Ring.Prod +import Mathlib.Algebra.Category.ModuleCat.Limits +import Mathlib.Tactic.Abel + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.ProductModules +universe u v +variable (L R : Type u) [Ring L] [Ring R] + +abbrev secondInflation : ModuleCat.{v} R ⥤ ModuleCat.{v} (L × R) := + ModuleCat.restrictScalars (RingHom.snd L R) + +abbrev swapModule (M : ModuleCat.{v} (L × R)) : ModuleCat.{v} (R × L) := + (ModuleCat.restrictScalars (RingEquiv.prodComm : R × L ≃+* L × R).toRingHom).obj M + +abbrev secondObject (M : ModuleCat.{v} (L × R)) : ModuleCat.{v} R := + firstObject R L (swapModule L R M) + +abbrev pairObject (M : ModuleCat.{v} (L × R)) : ModuleCat.{v} (L × R) := ModuleCat.of (L × R) + (((firstInflation L R).obj (firstObject L R M)) × ((secondInflation L R).obj (secondObject L R M))) + +variable (M : ModuleCat.{v} (L × R)) + +def splitTo : M →ₗ[L × R] pairObject L R M where + toFun m := (⟨((1,0) : L × R) • m, by + change ((1,0) : L × R) • (((1,0) : L × R) • m) = ((1,0) : L × R) • m + rw [← mul_smul] + have h : ((1,0) : L × R) * (1,0) = (1,0) := by ext <;> simp + rw [h]⟩, ⟨((0,1) : L × R) • m, by + change ((0,1) : L × R) • (((0,1) : L × R) • m) = ((0,1) : L × R) • m + rw [← mul_smul] + have h : ((0,1) : L × R) * (0,1) = (0,1) := by ext <;> simp + rw [h]⟩) + map_add' x y := Prod.ext (Subtype.ext (smul_add _ _ _)) (Subtype.ext (smul_add _ _ _)) + map_smul' d m := by + apply Prod.ext + · apply Subtype.ext + change ((1,0) : L × R) • (d • m) = ((d.1,0) : L × R) • (((1,0) : L × R) • m) + rw [← mul_smul,← mul_smul] + congr 1 + ext <;> simp + · apply Subtype.ext + change ((0,1) : L × R) • (d • m) = ((0,d.2) : L × R) • (((0,1) : L × R) • m) + rw [← mul_smul,← mul_smul] + congr 1 + ext <;> simp + +def joinTo : pairObject L R M →ₗ[L × R] M where + toFun x := x.1.val + (show M from x.2.val) + map_add' x y := by + change (x.1.val+y.1.val) + ((show M from x.2.val)+(show M from y.2.val)) = + (x.1.val+(show M from x.2.val)) + (y.1.val+(show M from y.2.val)) + abel + map_smul' d x := by + have h₁ := firstSpace_product_smul L R d x.1 + have h₂ := firstSpace_product_smul R L (M := swapModule L R M) (d.2,d.1) x.2 + change ((d.1,0) : L × R) • x.1.val + ((0,d.2) : L × R) • (show M from x.2.val) = d • (x.1.val + (show M from x.2.val)) + rw [smul_add,← h₁] + exact congrArg (fun y : swapModule L R M => d • x.1.val + (show M from y)) h₂.symm + +/-- Every module over a product ring splits into its two actual central-idempotent components. -/ +def splitting : M ≃ₗ[L × R] pairObject L R M where + __ := splitTo L R M + invFun := joinTo L R M + left_inv m := by + change ((1,0) : L × R) • m + ((0,1) : L × R) • m = m + rw [← add_smul] + have h : ((1,0) : L × R) + (0,1) = 1 := by ext <;> simp + rw [h,one_smul] + right_inv x := by + have h₁ : ((1,0) : L × R) • x.1.val = x.1.val := x.1.property + have h₂ : ((0,1) : L × R) • (show M from x.2.val) = (show M from x.2.val) := x.2.property + have hz₁ : ((0,1) : L × R) • x.1.val = 0 := by + calc + _ = ((0,1) : L × R) • (((1,0) : L × R) • x.1.val) := by rw [h₁] + _ = 0 := by + rw [← mul_smul] + have h : ((0,1) : L × R) * (1,0) = 0 := by ext <;> simp + rw [h,zero_smul] + have hz₂ : ((1,0) : L × R) • (show M from x.2.val) = 0 := by + calc + _ = ((1,0) : L × R) • (((0,1) : L × R) • (show M from x.2.val)) := by rw [h₂] + _ = 0 := by + rw [← mul_smul] + have h : ((1,0) : L × R) * (0,1) = 0 := by ext <;> simp + rw [h,zero_smul] + apply Prod.ext + · apply Subtype.ext + change ((1,0) : L × R) • (x.1.val + (show M from x.2.val)) = x.1.val + rw [smul_add,h₁,hz₂,add_zero] + · apply Subtype.ext + change ((0,1) : L × R) • (x.1.val + (show M from x.2.val)) = (show M from x.2.val) + rw [smul_add,hz₁,h₂,zero_add] +end LittleFinitistic.ProductModules + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryProjectiveTensor.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryProjectiveTensor.lean new file mode 100644 index 0000000000000000000000000000000000000000..fd25757e78343caff41f7a8a5d89cf61752a741f --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryProjectiveTensor.lean @@ -0,0 +1,98 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryFreeTensorExactness +import OAI.Algebra.Finitistic.Ordinary.OrdinaryFixedTensorFunctor +import OAI.Algebra.Finitistic.Tensor.BalancedTensorMaps +import Mathlib.Algebra.Module.Projective + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.BalancedTensor +universe u +variable {k A M M' : Type u} [Field k] [Ring A] [Algebra k A] +variable [AddCommGroup M] [Module k M] [Module Aᵐᵒᵖ M] [IsScalarTower k Aᵐᵒᵖ M] +variable [AddCommGroup M'] [Module k M'] [Module Aᵐᵒᵖ M'] [IsScalarTower k Aᵐᵒᵖ M'] +variable {N N' N'' : Type u} +variable [AddCommGroup N] [Module k N] [Module A N] [IsScalarTower k A N] +variable [AddCommGroup N'] [Module k N'] [Module A N'] [IsScalarTower k A N'] +variable [AddCommGroup N''] [Module k N''] [Module A N''] [IsScalarTower k A N''] + +theorem mapLeft_mapRightTo (i : M →ₗ[Aᵐᵒᵖ] M') (f : N →ₗ[A] N') (z : Tensor k A M N) : + mapLeft N' i (mapRightTo f z) = mapRightTo f (mapLeft N i z) := by + induction z using BalancedTensor.induction_on with + | hz => simp only [map_zero] + | ht m n => rfl + | ha x y hx hy => simp only [map_add,hx,hy] + +omit [IsScalarTower k A N] in +theorem mapLeft_split (i : M →ₗ[Aᵐᵒᵖ] M') (p : M' →ₗ[Aᵐᵒᵖ] M) + (hp : p.comp i = LinearMap.id) (z : Tensor k A M N) : + mapLeft N p (mapLeft N i z) = z := by + have hm := congrArg (fun f : Tensor k A M N →ₗ[k] Tensor k A M N => f z) + (mapLeft_comp (k := k) N i p).symm + simpa only [hp,mapLeft_id,LinearMap.id_apply,LinearMap.comp_apply] using hm + +/-- Exactness descends through an actual split right-module retract. -/ +theorem tensor_exact_of_split (i : M →ₗ[Aᵐᵒᵖ] M') (p : M' →ₗ[Aᵐᵒᵖ] M) + (hp : p.comp i = LinearMap.id) (f : N →ₗ[A] N') (g : N' →ₗ[A] N'') + (h : Function.Exact f g) + (h' : Function.Exact (mapRightTo (k := k) (M := M') f) (mapRightTo (k := k) (M := M') g)) : + Function.Exact (mapRightTo (k := k) (M := M) f) (mapRightTo (k := k) (M := M) g) := by + intro z + constructor + · intro hz + have hi : mapRightTo g (mapLeft N' i z) = 0 := by + rw [← mapLeft_mapRightTo,hz,map_zero] + obtain ⟨y,hy⟩ := (h' _).mp hi + refine ⟨mapLeft N p y, ?_⟩ + rw [← mapLeft_mapRightTo,hy,mapLeft_split i p hp] + · rintro ⟨y,rfl⟩ + induction y using BalancedTensor.induction_on with + | hz => simp only [map_zero] + | ht m n => rw [mapRightTo_mk,mapRightTo_mk,(h (f n)).mpr ⟨n,rfl⟩,map_zero] + | ha x y hx hy => simp only [map_add,hx,hy,add_zero] + +/-- Projectivity of the actual right module suffices, with no hypothesis on the left modules. -/ +theorem projectiveTensor_exact [Module.Projective Aᵐᵒᵖ M] + (f : N →ₗ[A] N') (g : N' →ₗ[A] N'') (h : Function.Exact f g) : + Function.Exact (mapRightTo (k := k) (M := M) f) (mapRightTo (k := k) (M := M) g) := by + obtain ⟨i,hi⟩ := (Module.projective_def' (R := Aᵐᵒᵖ) (P := M)).mp inferInstance + exact tensor_exact_of_split i (Finsupp.linearCombination Aᵐᵒᵖ id) hi f g h + (Free.tensor_exact (k := k) M f g h) + +variable (k A M) + +theorem projectiveTensor_mapsExact [Module.Projective Aᵐᵒᵖ M] + (S : ShortComplex (ModuleCat.{u} A)) (hS : S.Exact) : + (S.map (fixedTensorFunctor k A M)).Exact := by + rw [ShortComplex.moduleCat_exact_iff] + have h : Function.Exact + (S.f.hom : ScalarLeftModule k A S.X₁ →ₗ[A] ScalarLeftModule k A S.X₂) + (S.g.hom : ScalarLeftModule k A S.X₂ →ₗ[A] ScalarLeftModule k A S.X₃) := by + intro n + constructor + · exact (ShortComplex.moduleCat_exact_iff S).mp hS n + · rintro ⟨m,rfl⟩ + exact congrArg (fun f => f.hom m) S.zero + have ht := @projectiveTensor_exact k A M _ _ _ _ _ _ _ + (ScalarLeftModule k A S.X₁) (ScalarLeftModule k A S.X₂) (ScalarLeftModule k A S.X₃) + _ _ _ (scalarLeftTower k A S.X₁) + _ _ _ (scalarLeftTower k A S.X₂) _ _ _ (scalarLeftTower k A S.X₃) + _ S.f.hom S.g.hom h + intro z hz + exact (ht z).mp hz + +theorem projectiveTensor_preservesHomology [Module.Projective Aᵐᵒᵖ M] : + (fixedTensorFunctor k A M).PreservesHomology := + Functor.preservesHomology_of_map_exact _ (projectiveTensor_mapsExact k A M) + +/-- Degree-zero projective tensor preserves quasi-isomorphisms of arbitrary complexes. -/ +theorem projectiveTensor_quasiIso [Module.Projective Aᵐᵒᵖ M] + {Z Z' : CochainComplex (ModuleCat.{u} A) ℤ} (f : Z ⟶ Z') [QuasiIso f] : + QuasiIso (((fixedTensorFunctor k A M).mapHomologicalComplex (.up ℤ)).map f) := by + let := projectiveTensor_preservesHomology k A M + infer_instance +end LittleFinitistic.BalancedTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryResolutionComplex.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryResolutionComplex.lean new file mode 100644 index 0000000000000000000000000000000000000000..f6ecae24959b46b9236aad564f0faedd5d1eecfc --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryResolutionComplex.lean @@ -0,0 +1,85 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTerminalResolution +import Mathlib.Algebra.Homology.HomologicalComplex +import Mathlib.Algebra.Category.ModuleCat.Projective +import Mathlib.Algebra.Category.ModuleCat.Abelian + +namespace OAI +noncomputable section +open CategoryTheory Limits +namespace LittleFinitistic.OrdinarySimulation.ChainAlgebra +universe u +variable (k : Type u) [Field k] (l : ℕ) + +/-- Extending the source idempotents by zero keeps all right ideals in the same C. -/ +def extendedVertex (n : ℕ) : ChainAlgebra k l := + if h : n ≤ l then vertex k l ⟨n,by omega⟩ else 0 + +def extendedArrow (n : ℕ) : ChainAlgebra k l := + if h : n < l then arrow k l ⟨n,h⟩ else 0 + +theorem extendedVertex_idempotent (n : ℕ) : + extendedVertex k l n * extendedVertex k l n = extendedVertex k l n := by + unfold extendedVertex + split + · exact vertex_idempotent k l _ + · exact zero_mul _ + +theorem extendedArrow_target (n : ℕ) : + extendedVertex k l (n+1) * extendedArrow k l n = extendedArrow k l n := by + by_cases h : n < l + · have h1 : n+1 ≤ l := by omega + simp only [extendedVertex, extendedArrow, dite_eq_left h, dite_eq_left h1] + exact vertex_target_arrow k l ⟨n,h⟩ + · rw [extendedArrow, dite_eq_right h, mul_zero] + +theorem extendedArrow_square (n : ℕ) : extendedArrow k l (n+1) * extendedArrow k l n = 0 := by + by_cases h1 : n+1 < l + · have h0 : n < l := by omega + simp only [extendedArrow, dite_eq_left h1, dite_eq_left h0, arrow_mul_arrow] + · rw [extendedArrow, dite_eq_right h1, zero_mul] + +abbrev resolutionIdeal (n : ℕ) := IdempotentTensor.rightIdeal (extendedVertex k l n) +abbrev resolutionTerm (n : ℕ) : ModuleCat.{u} (ChainAlgebra k l)ᵐᵒᵖ := + ModuleCat.of _ (resolutionIdeal k l n) + +/-- Actual left-arrow differentials, with no transport of module types. -/ +def resolutionDifferential (n : ℕ) : resolutionTerm k l n ⟶ resolutionTerm k l (n+1) := + ModuleCat.ofHom (((leftMultiply (extendedArrow k l n)).comp (resolutionIdeal k l n).subtype).codRestrict _ + (fun x => by + change extendedVertex k l (n+1) * (extendedArrow k l n * x.val) = extendedArrow k l n * x.val + rw [← mul_assoc, extendedArrow_target])) + +theorem resolutionDifferential_square (n : ℕ) : + resolutionDifferential k l n ≫ resolutionDifferential k l (n+1) = 0 := by + ext x + change extendedArrow k l (n+1) * (extendedArrow k l n * x.val) = 0 + rw [← mul_assoc, extendedArrow_square, zero_mul] + +/-- The source's projective complex, extended by zero after degree l. -/ +def terminalProjectiveComplex : CochainComplex (ModuleCat.{u} (ChainAlgebra k l)ᵐᵒᵖ) ℕ := + CochainComplex.of (resolutionTerm k l) (resolutionDifferential k l) (resolutionDifferential_square k l) + +theorem resolutionTerm_projective (n : ℕ) : Projective (resolutionTerm k l n) := by + let : Module.Projective (ChainAlgebra k l)ᵐᵒᵖ (ChainAlgebra k l) := Module.Projective.of_equiv rightRegularEquiv + let r : ChainAlgebra k l →ₗ[(ChainAlgebra k l)ᵐᵒᵖ] resolutionIdeal k l n := + (leftMultiply (extendedVertex k l n)).codRestrict _ (fun x => by + change extendedVertex k l n * (extendedVertex k l n * x) = extendedVertex k l n * x + rw [← mul_assoc, extendedVertex_idempotent]) + have : Module.Projective (ChainAlgebra k l)ᵐᵒᵖ (resolutionIdeal k l n) := + Module.Projective.of_split (resolutionIdeal k l n).subtype r (by ext x; exact x.property) + infer_instance + +theorem resolutionTerm_vanishes (n : ℕ) (h : l < n) : IsZero (resolutionTerm k l n) := by + apply ModuleCat.isZero_iff_subsingleton.mpr + have hz (x : resolutionIdeal k l n) : x = 0 := by + apply Subtype.ext + have hp := x.property + change extendedVertex k l n * x.val = x.val at hp + rw [extendedVertex, dite_eq_right (Nat.not_le.mpr h), zero_mul] at hp + exact hp.symm + exact ⟨fun x y => (hz x).trans (hz y).symm⟩ +end LittleFinitistic.OrdinarySimulation.ChainAlgebra + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryResolutionExact.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryResolutionExact.lean new file mode 100644 index 0000000000000000000000000000000000000000..e4eeb7958c958c44e2c948e03b5e9c6b786936af --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryResolutionExact.lean @@ -0,0 +1,69 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryResolutionComplex +import Mathlib.Algebra.Homology.ShortComplex.ModuleCat +import Mathlib.Algebra.Homology.Single + +namespace OAI +noncomputable section +open CategoryTheory Limits +namespace LittleFinitistic.OrdinarySimulation.ChainAlgebra +universe u +variable (k : Type u) [Field k] (l : ℕ) + +/-- In the supported range, the extended ideal is the source's actual right projective. -/ +def supportedIdealEquiv (n : ℕ) (h : n ≤ l) : + resolutionIdeal k l n ≃ₗ[(ChainAlgebra k l)ᵐᵒᵖ] rightTerm (k := k) (⟨n,by omega⟩ : Fin (l+1)) where + toFun x := ⟨x.val, by + have hp := x.property + change extendedVertex k l n * x.val = x.val at hp + change vertex k l ⟨n,by omega⟩ * x.val = x.val + simpa only [extendedVertex, dite_eq_left h] using hp⟩ + invFun x := ⟨x.val, by + change extendedVertex k l n * x.val = x.val + rw [extendedVertex, dite_eq_left h] + exact x.property⟩ + left_inv _ := rfl + right_inv _ := rfl + map_add' _ _ := rfl + map_smul' _ _ := rfl + +@[simp] theorem supportedIdealEquiv_d (n : ℕ) (h : n < l) (x : resolutionIdeal k l n) : + supportedIdealEquiv k l (n+1) (by omega) ((resolutionDifferential k l n).hom x) = + resolutionMap (k := k) ⟨n,h⟩ (supportedIdealEquiv k l n (by omega) x) := by + apply Subtype.ext + change extendedArrow k l n * x.val = arrow k l ⟨n,h⟩ * x.val + rw [extendedArrow, dite_eq_left h] + +/-- The actual bundled complex is exact at every interior degree. -/ +theorem supported_complex_exact (n : ℕ) (h : n+1 < l) : + (ShortComplex.mk (resolutionDifferential k l n) (resolutionDifferential k l (n+1)) + (resolutionDifferential_square k l n)).Exact := by + rw [ShortComplex.moduleCat_exact_iff] + intro x hx + have hx' := congrArg (supportedIdealEquiv k l (n+2) (by omega)) hx + rw [supportedIdealEquiv_d k l (n+1) h, map_zero] at hx' + obtain ⟨y,hy⟩ := (resolution_exact (k := k) n h (supportedIdealEquiv k l (n+1) (by omega) x)).mp hx' + refine ⟨(supportedIdealEquiv k l n (by omega)).symm y, ?_⟩ + apply (supportedIdealEquiv k l (n+1) (by omega)).injective + rw [supportedIdealEquiv_d k l n (by omega), LinearEquiv.apply_symm_apply, hy] + +/-- The actual augmentation of the bundled complex in its last degree. -/ +def resolutionAugmentation : resolutionTerm k l l ⟶ ModuleCat.of (ChainAlgebra k l)ᵐᵒᵖ (TerminalSimple k) := + ModuleCat.ofHom ((augmentation k l).comp (supportedIdealEquiv k l l le_rfl).toLinearMap) + +/-- A genuine chain map to the terminal simple placed in degree l. -/ +def terminalAugmentationMap : terminalProjectiveComplex k l ⟶ + (HomologicalComplex.single _ (.up ℕ) l).obj (ModuleCat.of (ChainAlgebra k l)ᵐᵒᵖ (TerminalSimple k)) := + HomologicalComplex.mkHomToSingle (resolutionAugmentation k l) (by + intro i hi + change i+1=l at hi + subst l + change CochainComplex.of.d _ _ i (i+1) ≫ resolutionAugmentation k (i+1) = 0 + rw [CochainComplex.of_d] + ext x + change (extendedArrow k (i+1) i * x.val).1 (Fin.last (i+1)) = (0:k) + rw [extendedArrow, dite_eq_left (by omega), mul_diagonal, arrow_diagonal, zero_mul]) +end LittleFinitistic.OrdinarySimulation.ChainAlgebra + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryResolutionModels.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryResolutionModels.lean new file mode 100644 index 0000000000000000000000000000000000000000..8039a3bfaad4bc152a22219dbdfb5eab10b63dfc --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryResolutionModels.lean @@ -0,0 +1,68 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleDerivedTensor +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleTensorFunctor + +namespace OAI +noncomputable section +open CategoryTheory Limits +open scoped TensorProduct +namespace LittleFinitistic +universe u + +/-- A finite model for tensoring a genuine bimodule complex, with its support and right projectivity proved. -/ +structure FiniteProjectiveBimoduleComplex (k S A : Type u) [Field k] [Ring S] [Ring A] + [Algebra k S] [Algebra k A] where + complex : CochainComplex (ModuleCat.{u} (S ⊗[k] Aᵐᵒᵖ)) ℤ + size : ℕ + degrees : Fin size → ℤ + strictMono : StrictMono degrees + support : ∀ n, n ∉ Set.range degrees → IsZero (complex.X n) + rightProjective : ∀ n, Module.Projective Aᵐᵒᵖ (BimoduleCoefficients k S A (complex.X n)) + +namespace FiniteProjectiveBimoduleComplex +variable {k S A : Type u} [Field k] [Ring S] [Ring A] [Algebra k S] [Algebra k A] +variable (Q : FiniteProjectiveBimoduleComplex k S A) + +instance rightTerm_projective (n : ℤ) : Module.Projective Aᵐᵒᵖ + (ComplexTensor.rightTerm k A (BimoduleComplexTensor.rightComplex k S A Q.complex) n) := Q.rightProjective n + +abbrev tensorFunctor := BimoduleComplexTensor.totalFunctor k S A Q.complex Q.degrees Q.strictMono + +/-- The certified model inverts every input quasi-isomorphism; no condition is placed on the input complex. -/ +theorem tensorFunctor_quasiIso {Z Z' : CochainComplex (ModuleCat.{u} A) ℤ} (f : Z ⟶ Z') [QuasiIso f] : + QuasiIso (Q.tensorFunctor.map f) := + BimoduleComplexTensor.totalFunctor_quasiIso k S A Q.complex Q.degrees Q.strictMono f + +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} A)] [HasDerivedCategory.{u+1} (ModuleCat.{u} S)] + +def derivedTensor : DerivedCategory (ModuleCat.{u} A) ⥤ DerivedCategory (ModuleCat.{u} S) := + BimoduleComplexTensor.derivedTotal k S A Q.complex Q.degrees Q.strictMono + +def comparison : DerivedCategory.Q ⋙ Q.derivedTensor ≅ Q.tensorFunctor ⋙ DerivedCategory.Q := + BimoduleComplexTensor.derivedTotalComparison k S A Q.complex Q.degrees Q.strictMono +end FiniteProjectiveBimoduleComplex + +/-- A genuine ordinary bimodule supplied with an actual bounded right-projective resolution. -/ +structure BoundedBimoduleResolution (k S A : Type u) [Field k] [Ring S] [Ring A] + [Algebra k S] [Algebra k A] (M : ModuleCat.{u} (S ⊗[k] Aᵐᵒᵖ)) extends FiniteProjectiveBimoduleComplex k S A where + augmentation : complex ⟶ (HomologicalComplex.single _ (.up ℤ) 0).obj M + augmentation_quasiIso : QuasiIso augmentation + +namespace BoundedBimoduleResolution +variable {k S A : Type u} [Field k] [Ring S] [Ring A] [Algebra k S] [Algebra k A] +variable {M : ModuleCat.{u} (S ⊗[k] Aᵐᵒᵖ)} (Q : BoundedBimoduleResolution k S A M) +variable (B N : Type u) [Ring B] [Algebra k B] +variable [AddCommGroup N] [Module k N] [Module A N] [Module Bᵐᵒᵖ N] + [IsScalarTower k A N] [IsScalarTower k Bᵐᵒᵖ N] [SMulCommClass A Bᵐᵒᵖ N] +local instance : SMulCommClass Bᵐᵒᵖ A N := ⟨fun b a n => (smul_comm a b n).symm⟩ +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} (S ⊗[k] Bᵐᵒᵖ))] + +/-- The resolved ordinary tensor object, in the native derived category retaining both outside actions. +The resolution, its quasi-isomorphism, finite support and right projectivity are fields of Q. -/ +def tensorOrdinary : DerivedCategory (ModuleCat.{u} (S ⊗[k] Bᵐᵒᵖ)) := + DerivedCategory.Q.obj (((bimoduleTensorFunctor k S A Bᵐᵒᵖ N).mapHomologicalComplex (.up ℤ)).obj Q.complex) +end BoundedBimoduleResolution +end LittleFinitistic + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryResolutionQuasiIso.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryResolutionQuasiIso.lean new file mode 100644 index 0000000000000000000000000000000000000000..f3fe2fb33319532b76fa2df1da4771b2f820b0f1 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryResolutionQuasiIso.lean @@ -0,0 +1,155 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryResolutionExact +import Mathlib.Algebra.Homology.QuasiIso + +namespace OAI +noncomputable section +open CategoryTheory Limits +namespace LittleFinitistic.OrdinarySimulation.ChainAlgebra +universe u +variable (k : Type u) [Field k] (l : ℕ) + +theorem resolutionInitial_injective (h : 0 < l) : + Function.Injective (resolutionDifferential k l 0).hom := by + intro x y hxy + apply (supportedIdealEquiv k l 0 (by omega)).injective + apply resolution_first_injective (k := k) h + rw [← supportedIdealEquiv_d k l 0 h, ← supportedIdealEquiv_d k l 0 h, hxy] + +/-- Exactness in every degree except the terminal homology degree. -/ +theorem terminalProjectiveComplex_exactAt (n : ℕ) (hn : n ≠ l) : + (terminalProjectiveComplex k l).ExactAt n := by + by_cases h : l < n + · exact HomologicalComplex.ExactAt.of_isZero (resolutionTerm_vanishes k l n h) + have hnl : n < l := by omega + cases n with + | zero => + rw [HomologicalComplex.exactAt_iff, ShortComplex.moduleCat_exact_iff] + intro x hx + have hx' : (resolutionDifferential k l 0).hom x = 0 := by + change ((terminalProjectiveComplex k l).d 0 ((ComplexShape.up ℕ).next 0)).hom x = 0 at hx + rw [show (ComplexShape.up ℕ).next 0 = 1 by simp] at hx + change (CochainComplex.of.d (resolutionTerm k l) (resolutionDifferential k l) 0 (0+1)).hom x = 0 at hx + rw [CochainComplex.of_d] at hx + exact hx + have hx0 : x = 0 := resolutionInitial_injective k l hnl (hx'.trans (map_zero _).symm) + refine ⟨0, ?_⟩ + simp only [hx0, map_zero] + | succ n => + apply (HomologicalComplex.exactAt_iff' _ n (n+1) (n+2) (by simp) (by simp)).2 + change (ShortComplex.mk (CochainComplex.of.d _ _ n (n+1)) (CochainComplex.of.d _ _ (n+1) ((n+1)+1)) _).Exact + simpa only [CochainComplex.of_d] using supported_complex_exact k l n hnl + +theorem resolutionAugmentation_surjective : Function.Surjective (resolutionAugmentation k l).hom := + (augmentation_surjective k l).comp (supportedIdealEquiv k l l le_rfl).surjective + +instance resolutionAugmentation_epi : Epi (resolutionAugmentation k l) := + (ModuleCat.epi_iff_surjective _).mpr (resolutionAugmentation_surjective k l) + +theorem resolutionAugmentation_comp (n : ℕ) : + resolutionDifferential k (n+1) n ≫ resolutionAugmentation k (n+1) = 0 := by + ext x + change (extendedArrow k (n+1) n * x.val).1 (Fin.last (n+1)) = (0:k) + rw [extendedArrow, dite_eq_left (by omega), mul_diagonal, arrow_diagonal, zero_mul] + +theorem resolutionAugmentation_exact (n : ℕ) : + (ShortComplex.mk (resolutionDifferential k (n+1) n) (resolutionAugmentation k (n+1)) + (resolutionAugmentation_comp k n)).Exact := by + rw [ShortComplex.moduleCat_exact_iff] + intro x hx + have hx' : augmentation k (n+1) (supportedIdealEquiv k (n+1) (n+1) le_rfl x) = 0 := hx + obtain ⟨y,hy⟩ := (augmentation_exact k n _).mp hx' + refine ⟨(supportedIdealEquiv k (n+1) n (by omega)).symm y, ?_⟩ + apply (supportedIdealEquiv k (n+1) (n+1) le_rfl).injective + rw [supportedIdealEquiv_d k (n+1) n (by omega), LinearEquiv.apply_symm_apply] + exact hy + +theorem resolutionAugmentation_zero_injective : + Function.Injective (resolutionAugmentation k 0).hom := + (augmentation_zero_injective k).comp (supportedIdealEquiv k 0 0 le_rfl).injective + +theorem resolutionDifferential_last_zero : resolutionDifferential k l l = 0 := by + ext x + change extendedArrow k l l * x.val = 0 + rw [extendedArrow, dite_eq_right (lt_irrefl l), zero_mul] + +/-- Postcomposing a short complex's second map by an isomorphism preserves exactness. -/ +theorem exact_post_iso {R : Type u} [Ring R] {X Y Z Z' : ModuleCat.{u} R} + (f : X ⟶ Y) (g : Y ⟶ Z) (hfg : f ≫ g = 0) (e : Z ≅ Z') + (h : (ShortComplex.mk f g hfg).Exact) : + (ShortComplex.mk f (g ≫ e.hom) (by rw [← Category.assoc, hfg, zero_comp])).Exact := by + rw [ShortComplex.moduleCat_exact_iff] at h ⊢ + intro x hx + apply h x + apply (ModuleCat.mono_iff_injective e.hom).mp inferInstance + exact hx.trans (map_zero _).symm + +/-- The augmentation is a quasi-isomorphism at the terminal degree. -/ +theorem terminalAugmentationMap_quasiIsoAt_last : + QuasiIsoAt (terminalAugmentationMap k l) l := by + rw [quasiIsoAt_iff] + refine (ShortComplex.quasiIso_iff_of_zeros' _ ?_ ?_ ?_).2 ?_ + · change (terminalProjectiveComplex k l).d l ((ComplexShape.up ℕ).next l) = 0 + rw [show (ComplexShape.up ℕ).next l = l+1 by simp] + change CochainComplex.of.d (resolutionTerm k l) (resolutionDifferential k l) l (l+1) = 0 + rw [CochainComplex.of_d] + exact resolutionDifferential_last_zero k l + · exact HomologicalComplex.single_obj_d (.up ℕ) l (ModuleCat.of (ChainAlgebra k l)ᵐᵒᵖ (TerminalSimple k)) ((ComplexShape.up ℕ).prev l) l + · exact HomologicalComplex.single_obj_d (.up ℕ) l (ModuleCat.of (ChainAlgebra k l)ᵐᵒᵖ (TerminalSimple k)) l ((ComplexShape.up ℕ).next l) + · change (ShortComplex.mk ((terminalProjectiveComplex k l).d ((ComplexShape.up ℕ).prev l) l) + ((terminalAugmentationMap k l).f l) _).Exact ∧ Epi ((terminalAugmentationMap k l).f l) + have hf : (terminalAugmentationMap k l).f l = resolutionAugmentation k l ≫ + (HomologicalComplex.singleObjXSelf (.up ℕ) l + (ModuleCat.of (ChainAlgebra k l)ᵐᵒᵖ (TerminalSimple k))).inv := by + unfold terminalAugmentationMap + apply HomologicalComplex.mkHomToSingle_f + simp only [hf] + constructor + · refine exact_post_iso _ _ ?_ + (HomologicalComplex.singleObjXSelf (.up ℕ) l + (ModuleCat.of (ChainAlgebra k l)ᵐᵒᵖ (TerminalSimple k))).symm ?_ + · cases l with + | zero => + have hz := (terminalProjectiveComplex k 0).shape ((ComplexShape.up ℕ).prev 0) 0 (by simp) + erw [hz, zero_comp] + | succ n => + rw [show (ComplexShape.up ℕ).prev (n+1) = n by simp] + simp only [terminalProjectiveComplex, CochainComplex.of_d] + convert resolutionAugmentation_comp k n using 1 + rfl + cases l with + | zero => + rw [ShortComplex.moduleCat_exact_iff] + intro x hx + have hx' : (resolutionAugmentation k 0).hom x = 0 := hx + have hx0 : x = 0 := resolutionAugmentation_zero_injective k (hx'.trans (map_zero _).symm) + refine ⟨0, ?_⟩ + simp only [hx0, map_zero] + | succ n => + rw [ShortComplex.moduleCat_exact_iff] + intro x hx + obtain ⟨y, hy⟩ := (ShortComplex.moduleCat_exact_iff _).mp + (resolutionAugmentation_exact k n) x hx + change ∃ z : resolutionTerm k (n+1) ((ComplexShape.up ℕ).prev (n+1)), + (CochainComplex.of.d (resolutionTerm k (n+1)) (resolutionDifferential k (n+1)) + ((ComplexShape.up ℕ).prev (n+1)) (n+1)).hom z = x + rw [show (ComplexShape.up ℕ).prev (n+1) = n by simp] + exact ⟨y, by simpa only [CochainComplex.of_d] using hy⟩ + · erw [ModuleCat.epi_iff_surjective] + exact ((ModuleCat.epi_iff_surjective _).mp (inferInstance : Epi + (HomologicalComplex.singleObjXSelf (.up ℕ) l + (ModuleCat.of (ChainAlgebra k l)ᵐᵒᵖ (TerminalSimple k))).inv)).comp + (resolutionAugmentation_surjective k l) + +/-- The source's finite projective resolution now has its actual augmentation quasi-isomorphism. -/ +theorem terminalAugmentationMap_quasiIso : QuasiIso (terminalAugmentationMap k l) := by + constructor + intro n + by_cases hn : n = l + · subst n; exact terminalAugmentationMap_quasiIsoAt_last k l + · apply (quasiIsoAt_iff_exactAt' _ n ?_).2 (terminalProjectiveComplex_exactAt k l n hn) + exact HomologicalComplex.ExactAt.of_isZero (HomologicalComplex.isZero_single_obj_X _ _ _ _ hn) +end LittleFinitistic.OrdinarySimulation.ChainAlgebra + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryRestrictionHomology.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryRestrictionHomology.lean new file mode 100644 index 0000000000000000000000000000000000000000..6eb5a8d2c74de5e1bd0dfda79fe2046c122a2451 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryRestrictionHomology.lean @@ -0,0 +1,30 @@ +import Mathlib.Algebra.Category.ModuleCat.ChangeOfRings +import Mathlib.Algebra.Homology.ShortComplex.ModuleCat +import Mathlib.Algebra.Homology.ShortComplex.PreservesHomology +import Mathlib.Algebra.Homology.QuasiIso + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.RestrictionHomology +universe u v +variable {R S : Type u} [Ring R] [Ring S] (f : R →+* S) + +theorem mapsExact (K : ShortComplex (ModuleCat.{u} S)) (hK : K.Exact) : + (K.map (ModuleCat.restrictScalars f)).Exact := by + rw [ShortComplex.moduleCat_exact_iff] at hK ⊢ + exact hK + +theorem preservesHomology : (ModuleCat.restrictScalars.{u} f).PreservesHomology := + CategoryTheory.Functor.preservesHomology_of_map_exact _ (mapsExact f) + +theorem quasiIso_iff {I : Type v} {c : ComplexShape I} + {K L : HomologicalComplex (ModuleCat.{u} S) c} (g : K ⟶ L) : + QuasiIso (((ModuleCat.restrictScalars f).mapHomologicalComplex c).map g) ↔ QuasiIso g := by + let := preservesHomology f + exact HomologicalComplex.quasiIso_map_iff_of_preservesHomology g (ModuleCat.restrictScalars f) +end LittleFinitistic.RestrictionHomology + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryRetainedBimodule.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryRetainedBimodule.lean new file mode 100644 index 0000000000000000000000000000000000000000..ec4d9ab7a105dc54a6eece0f062e7c90b26cf132 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryRetainedBimodule.lean @@ -0,0 +1,57 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleCoefficients + +namespace OAI +noncomputable section +open scoped TensorProduct +namespace LittleFinitistic +universe u +/-- An ordinary bimodule packaged as a module over its actual tensor algebra. -/ +def RetainedBimodule (_k _S _A M : Type u) := M +namespace RetainedBimodule +variable (k S A M : Type u) [Field k] [Ring S] [Ring A] [Algebra k S] [Algebra k A] +variable [AddCommGroup M] [Module k M] [Module S M] [Module Aᵐᵒᵖ M] + [IsScalarTower k S M] [IsScalarTower k Aᵐᵒᵖ M] [SMulCommClass S Aᵐᵒᵖ M] +instance : AddCommGroup (RetainedBimodule k S A M) := inferInstanceAs (AddCommGroup M) +instance : Module k (RetainedBimodule k S A M) := inferInstanceAs (Module k M) +instance : Module S (RetainedBimodule k S A M) := inferInstanceAs (Module S M) +instance : Module Aᵐᵒᵖ (RetainedBimodule k S A M) := inferInstanceAs (Module Aᵐᵒᵖ M) +instance : IsScalarTower k S (RetainedBimodule k S A M) := inferInstanceAs (IsScalarTower k S M) +instance : IsScalarTower k Aᵐᵒᵖ (RetainedBimodule k S A M) := inferInstanceAs (IsScalarTower k Aᵐᵒᵖ M) +instance : SMulCommClass S Aᵐᵒᵖ (RetainedBimodule k S A M) := inferInstanceAs (SMulCommClass S Aᵐᵒᵖ M) + + +def action : (S ⊗[k] Aᵐᵒᵖ) →ₐ[k] Module.End k (RetainedBimodule k S A M) := + show (S ⊗[k] Aᵐᵒᵖ) →ₐ[k] Module.End k M from + Algebra.TensorProduct.lift (Algebra.lsmul k k M) (Algebra.lsmul k k M) (by + intro s a + ext m + exact smul_comm s a (m : M)) +instance : Module (S ⊗[k] Aᵐᵒᵖ) (RetainedBimodule k S A M) := Module.compHom _ (action k S A M).toRingHom +instance tower : IsScalarTower k (S ⊗[k] Aᵐᵒᵖ) (RetainedBimodule k S A M) where + smul_assoc r x m := by + change action k S A M (r • x) m = r • action k S A M x m + rw [map_smul] + rfl + +variable {k S A M} {M' : Type u} +variable [AddCommGroup M'] [Module k M'] [Module S M'] [Module Aᵐᵒᵖ M'] + [IsScalarTower k S M'] [IsScalarTower k Aᵐᵒᵖ M'] [SMulCommClass S Aᵐᵒᵖ M'] + +def map (f : M →ₗ[Aᵐᵒᵖ] M') (hf : ∀ (s : S) m, f (s • m) = s • f m) : + RetainedBimodule k S A M →ₗ[S ⊗[k] Aᵐᵒᵖ] RetainedBimodule k S A M' where + __ := f.toAddHom + map_smul' x m := by + change f (action k S A M x m) = action k S A M' x (f m) + induction x using TensorProduct.inductionOn with + | tmul s a => + change f (s • (a • (m : M))) = s • (a • f (m : M)) + exact (hf s (a • (m : M))).trans (congrArg (s • ·) (f.map_smul a (m : M))) + | add x y hx hy => + rw [map_add, map_add] + exact (f.map_add _ _).trans (congrArg₂ (· + ·) hx hy) +end RetainedBimodule +end LittleFinitistic + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryRetainedCongruence.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryRetainedCongruence.lean new file mode 100644 index 0000000000000000000000000000000000000000..6d3af8c5227242580e9d8a1ff7eb001fadac7bdb --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryRetainedCongruence.lean @@ -0,0 +1,42 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryRetainedRestriction +import OAI.Algebra.Finitistic.Ordinary.OrdinaryOffDiagonalMaps + +namespace OAI +noncomputable section +open scoped TensorProduct +namespace LittleFinitistic.RetainedBimodule +universe u +variable {k S A M N : Type u} [Field k] [Ring S] [Ring A] [Algebra k S] [Algebra k A] +variable [AddCommGroup M] [Module k M] [Module S M] [Module Aᵐᵒᵖ M] + [IsScalarTower k S M] [IsScalarTower k Aᵐᵒᵖ M] [SMulCommClass S Aᵐᵒᵖ M] +variable [AddCommGroup N] [Module k N] [Module S N] [Module Aᵐᵒᵖ N] + [IsScalarTower k S N] [IsScalarTower k Aᵐᵒᵖ N] [SMulCommClass S Aᵐᵒᵖ N] + +/-- An actual right-linear, left-equivariant equivalence retains both actions. -/ +def congr (f : M ≃ₗ[Aᵐᵒᵖ] N) (hf : ∀ (s : S) x, f (s • x) = s • f x) : + RetainedBimodule k S A M ≃ₗ[S ⊗[k] Aᵐᵒᵖ] RetainedBimodule k S A N where + __ := map (k := k) f.toLinearMap hf + invFun := f.symm + left_inv := f.left_inv + right_inv := f.right_inv +end LittleFinitistic.RetainedBimodule +namespace LittleFinitistic.OrdinarySimulation.OffDiagonal +universe u +variable {L R O O' T T' : Type u} [Ring L] [Ring R] +variable [AddCommGroup O] [AddCommGroup O'] [AddCommGroup T] [AddCommGroup T'] +variable [Module Lᵐᵒᵖ O] [Module Lᵐᵒᵖ O'] [Module Rᵐᵒᵖ T] [Module Rᵐᵒᵖ T'] + +def congr (f : O ≃ₗ[Lᵐᵒᵖ] O') (g : T ≃ₗ[Rᵐᵒᵖ] T') : + OffDiagonal O T ≃ₗ[(L × R)ᵐᵒᵖ] OffDiagonal O' T' where + toFun x := (f x.1,g x.2) + invFun x := (f.symm x.1,g.symm x.2) + left_inv x := Prod.ext (f.left_inv x.1) (g.left_inv x.2) + right_inv x := Prod.ext (f.right_inv x.1) (g.right_inv x.2) + map_add' left right := Prod.ext (f.map_add left.1 right.1) (g.map_add left.2 right.2) + map_smul' d x := Prod.ext (f.map_smul (MulOpposite.op d.unop.1) x.1) + (g.map_smul (MulOpposite.op d.unop.2) x.2) +end LittleFinitistic.OrdinarySimulation.OffDiagonal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryRetainedRestriction.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryRetainedRestriction.lean new file mode 100644 index 0000000000000000000000000000000000000000..3c9d4639c683d4e0e919d968e7836e0a683612f1 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryRetainedRestriction.lean @@ -0,0 +1,54 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryRetainedBimodule +import Mathlib.Algebra.Category.ModuleCat.ChangeOfRings + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.RetainedBimodule +universe u +variable (k S A M : Type u) [Field k] [Ring S] [Ring A] [Algebra k S] [Algebra k A] +variable [AddCommGroup M] [Module k M] [Module S M] [Module Aᵐᵒᵖ M] + [IsScalarTower k S M] [IsScalarTower k Aᵐᵒᵖ M] [SMulCommClass S Aᵐᵒᵖ M] + +abbrev object : ModuleCat.{u} (S ⊗[k] Aᵐᵒᵖ) := ModuleCat.of _ (RetainedBimodule k S A M) + +/-- Recover the exact original right action after packaging the ordinary bimodule. -/ +def rightEquiv : BimoduleCoefficients k S A (object k S A M) ≃ₗ[Aᵐᵒᵖ] M where + toFun x := x + invFun x := x + left_inv _ := rfl + right_inv _ := rfl + map_add' _ _ := rfl + map_smul' r x := by + change action k S A M ((1:S) ⊗ₜ[k] r) x = _ + unfold action + erw [Algebra.TensorProduct.lift_tmul] + change (1:S) • (r • (show M from x)) = r • (show M from x) + exact one_smul _ _ + +theorem rightEquiv_left (s : S) (x : BimoduleCoefficients k S A (object k S A M)) : + rightEquiv k S A M (s • x) = s • rightEquiv k S A M x := by + change action k S A M (s ⊗ₜ[k] (1:Aᵐᵒᵖ)) x = _ + unfold action + erw [Algebra.TensorProduct.lift_tmul] + change s • ((1:Aᵐᵒᵖ) • (show M from x)) = s • (show M from x) + rw [one_smul] + +/-- Recover the exact original scalar module after retaining both actions. -/ +def scalarEquiv : (ModuleCat.restrictScalars (algebraMap k (S ⊗[k] Aᵐᵒᵖ))).obj + (object k S A M) ≃ₗ[k] M where + toFun x := x + invFun x := x + left_inv _ := rfl + right_inv _ := rfl + map_add' _ _ := rfl + map_smul' r x := by + have h (y : RetainedBimodule k S A M) : + (algebraMap k (S ⊗[k] Aᵐᵒᵖ) r) • y = r • y := algebraMap_smul _ r y + exact h x +end LittleFinitistic.RetainedBimodule + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryRightProjective.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryRightProjective.lean new file mode 100644 index 0000000000000000000000000000000000000000..88da1bb04e7a12a8aa0e6f308b46714d452e4821 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryRightProjective.lean @@ -0,0 +1,36 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimodule +import Mathlib.Algebra.Module.Projective +import Mathlib.LinearAlgebra.DFinsupp + +namespace OAI +noncomputable section +namespace LittleFinitistic.OrdinarySimulation +universe u v w + +/-- The finite direct sum of actual projective terms is projective. -/ +theorem finitePi_projective {R : Type u} [Ring R] {ι : Type v} [Fintype ι] + (V : ι → Type w) [∀ i, AddCommGroup (V i)] [∀ i, Module R (V i)] + [∀ i, Module.Projective R (V i)] : Module.Projective R (∀ i, V i) := + Module.Projective.of_equiv (DFinsupp.linearEquivFunOnFintype (R := R) (M := V)) + +open CategoryTheory +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] + +/-- The actual underlying right-B complex of the genuine dg bimodule. -/ +abbrev underlyingRightComplex (P : CochainComplex (ModuleCat.{u} (Enveloping k B)) ℤ) : + CochainComplex (ModuleCat.{u} Bᵐᵒᵖ) ℤ := + ((ModuleCat.restrictScalars + (Algebra.TensorProduct.includeRight (R := k) (A := B) (B := Bᵐᵒᵖ)).toRingHom).mapHomologicalComplex (.up ℤ)).obj P + +theorem ordinaryO_right_projective (P : CochainComplex (ModuleCat.{u} (Enveloping k B)) ℤ) + (a : ℤ) (l : ℕ) + [∀ n, Module.Projective Bᵐᵒᵖ ((underlyingRightComplex P).X n)] : + Module.Projective Bᵐᵒᵖ (BimoduleO P a l) := by + let V : Fin (l+1) → Type u := fun i => (underlyingRightComplex P).X (a+(i.val:ℤ)) + have : Module.Projective Bᵐᵒᵖ (∀ i, V i) := finitePi_projective V + exact Module.Projective.of_equiv (show (∀ i, V i) ≃ₗ[Bᵐᵒᵖ] BimoduleO P a l from LinearEquiv.refl _ _) +end LittleFinitistic.OrdinarySimulation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinarySecondBlockTensor.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinarySecondBlockTensor.lean new file mode 100644 index 0000000000000000000000000000000000000000..2a24c5ffa6e1cd9a189b20a7e5936033d793c94e --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinarySecondBlockTensor.lean @@ -0,0 +1,102 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBlockModules +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBalancedCongruence + +namespace OAI +noncomputable section +namespace LittleFinitistic.OrdinarySimulation.SecondBlockTensor +universe u +variable (k L R O T Z : Type u) [Field k] [Ring L] [Ring R] [Algebra k L] [Algebra k R] +variable [AddCommGroup O] [Module k O] [Module R O] [Module Lᵐᵒᵖ O] + [IsScalarTower k R O] [IsScalarTower k Lᵐᵒᵖ O] [SMulCommClass R Lᵐᵒᵖ O] +variable [AddCommGroup T] [Module k T] [Module L T] [Module Rᵐᵒᵖ T] + [IsScalarTower k L T] [IsScalarTower k Rᵐᵒᵖ T] [SMulCommClass L Rᵐᵒᵖ T] +variable [AddCommGroup Z] [Module k Z] [Module R Z] [IsScalarTower k R Z] + +abbrev source := LeftTensor k (L × R) (L × R) (OffDiagonal O T) (BlockModule.Second k L R Z) +abbrev target := BlockModule.First k L R (LeftTensor k R L T Z) + +def forward : source k L R O T Z →ₗ[k] target k L R T Z := + BalancedTensor.lift ((BalancedTensor.mk k R T Z).compl₁₂ + (show OffDiagonal O T →ₗ[k] T from LinearMap.snd k O T) + (show BlockModule.Second k L R Z →ₗ[k] Z from LinearMap.id)) (by + intro d x z + exact BalancedTensor.balance (k := k) (A := R) (M := T) (N := Z) d.2 x.2 (show Z from z)) + +def inverse : target k L R T Z →ₗ[k] source k L R O T Z := + BalancedTensor.lift ((BalancedTensor.mk k (L × R) (OffDiagonal O T) (BlockModule.Second k L R Z)).compl₁₂ + (show T →ₗ[k] OffDiagonal O T from LinearMap.inr k O T) + (show Z →ₗ[k] BlockModule.Second k L R Z from LinearMap.id)) (by + intro a t z + have h := BalancedTensor.balance (k := k) (A := L × R) (M := OffDiagonal O T) + (N := BlockModule.Second k L R Z) (0,a) (0,t) z + change BalancedTensor.mk k (L × R) (OffDiagonal O T) (BlockModule.Second k L R Z) + ((0:Lᵐᵒᵖ) • (0:O),MulOpposite.op a • t) (show BlockModule.Second k L R Z from z) = + BalancedTensor.mk k (L × R) (OffDiagonal O T) (BlockModule.Second k L R Z) (0,t) + (show BlockModule.Second k L R Z from a • z) at h + rw [smul_zero] at h + exact h) + +omit [Algebra k L] [Algebra k R] [Module R O] [IsScalarTower k R O] + [IsScalarTower k Lᵐᵒᵖ O] [SMulCommClass R Lᵐᵒᵖ O] [Module L T] + [IsScalarTower k L T] [IsScalarTower k Rᵐᵒᵖ T] [SMulCommClass L Rᵐᵒᵖ T] + [IsScalarTower k R Z] in +theorem other_block_zero (o : O) (z : BlockModule.Second k L R Z) : + BalancedTensor.mk k (L × R) (OffDiagonal O T) (BlockModule.Second k L R Z) (o,0) z = 0 := by + have h := BalancedTensor.balance (k := k) (A := L × R) (M := OffDiagonal O T) + (N := BlockModule.Second k L R Z) (1,0) (o,0) z + change BalancedTensor.mk k (L × R) (OffDiagonal O T) (BlockModule.Second k L R Z) + ((1:Lᵐᵒᵖ) • o,(0:Rᵐᵒᵖ) • (0:T)) z = + BalancedTensor.mk k (L × R) (OffDiagonal O T) (BlockModule.Second k L R Z) (o,0) ((0:R) • (show Z from z)) at h + erw [one_smul, zero_smul, zero_smul, map_zero] at h + exact h + +omit [Module R O] [IsScalarTower k R O] [IsScalarTower k Lᵐᵒᵖ O] + [SMulCommClass R Lᵐᵒᵖ O] [Module L T] [IsScalarTower k L T] + [IsScalarTower k Rᵐᵒᵖ T] [SMulCommClass L Rᵐᵒᵖ T] [IsScalarTower k R Z] in +theorem inverse_forward (x : source k L R O T Z) : + inverse k L R O T Z (forward k L R O T Z x) = x := by + let F := (inverse k L R O T Z).comp (forward k L R O T Z) + have h : F = LinearMap.id := by + apply BalancedTensor.ext + intro x z + change BalancedTensor.mk k (L × R) (OffDiagonal O T) (BlockModule.Second k L R Z) (0,x.2) z = + BalancedTensor.mk k (L × R) (OffDiagonal O T) (BlockModule.Second k L R Z) x z + let q := (BalancedTensor.mk k (L × R) (OffDiagonal O T) (BlockModule.Second k L R Z)).flip z + have hx : x = (x.1,0) + (0,x.2) := Prod.ext (add_zero _).symm (zero_add _).symm + exact ((congrArg q hx).trans ((q.map_add _ _).trans + ((congrArg (· + q (0,x.2)) (other_block_zero k L R O T Z x.1 z)).trans (zero_add _)))).symm + exact congrArg (fun f => f x) h + +omit [Module R O] [IsScalarTower k R O] [IsScalarTower k Lᵐᵒᵖ O] + [SMulCommClass R Lᵐᵒᵖ O] [Module L T] [IsScalarTower k L T] + [IsScalarTower k Rᵐᵒᵖ T] [SMulCommClass L Rᵐᵒᵖ T] [IsScalarTower k R Z] in +theorem forward_inverse (x : target k L R T Z) : + forward k L R O T Z (inverse k L R O T Z x) = x := by + have h : (forward k L R O T Z).comp (inverse k L R O T Z) = LinearMap.id := by + apply BalancedTensor.ext + intro t z + rfl + exact congrArg (fun f => f x) h + +/-- Tensor on the second block selects T and has its actual output on the first block. -/ +def equivalence : source k L R O T Z ≃ₗ[L × R] target k L R T Z where + toFun := forward k L R O T Z + invFun := inverse k L R O T Z + left_inv := inverse_forward k L R O T Z + right_inv := forward_inverse k L R O T Z + map_add' := (forward k L R O T Z).map_add + map_smul' d x := by + let F := forward k L R O T Z + have h : F.comp (LeftTensor.action k (L × R) (L × R) (OffDiagonal O T) + (BlockModule.Second k L R Z) d) = + (Algebra.lsmul k k (target k L R T Z) d).comp F := by + apply BalancedTensor.ext + intro x z + rfl + exact congrArg (fun f => f x) h + +end LittleFinitistic.OrdinarySimulation.SecondBlockTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinarySecondBlockTotal.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinarySecondBlockTotal.lean new file mode 100644 index 0000000000000000000000000000000000000000..05b052a6e3f098d7ed4185e9fbe75a9de28f4292 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinarySecondBlockTotal.lean @@ -0,0 +1,113 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBlockTensorTerms +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleTensorTotal + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation.BlockTensor +universe u +variable (k L R : Type u) [Field k] [Ring L] [Ring R] [Algebra k L] [Algebra k R] +variable (O : CochainComplex (ModuleCat.{u} (R ⊗[k] Lᵐᵒᵖ)) ℤ) +variable (T : CochainComplex (ModuleCat.{u} (L ⊗[k] Rᵐᵒᵖ)) ℤ) +variable (Z : CochainComplex (ModuleCat.{u} R) ℤ) +variable {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) +open BimoduleComplexTensor + +def secondTotalEquiv (n : ℤ) : + totalTerm k (L × R) (L × R) (OffDiagonal.complex k L R O T) (BlockModule.secondComplex L R Z) p n ≃ₗ[L × R] + BlockModule.First k L R (totalTerm k L R T Z p n) := + (LinearEquiv.piCongrRight (fun i => secondTermEquiv k L R O T Z (p i) (n + -(p i)))).trans + (show (∀ i : Fin l, BlockModule.First k L R (term k L R T Z (p i) (n + -(p i)))) ≃ₗ[L × R] + BlockModule.First k L R (totalTerm k L R T Z p n) from LinearEquiv.refl _ _) + +@[simp] theorem secondTotalEquiv_apply (n : ℤ) + (z : totalTerm k (L × R) (L × R) (OffDiagonal.complex k L R O T) (BlockModule.secondComplex L R Z) p n) + (i : Fin l) : secondTotalEquiv k L R O T Z p n z i = + secondTermEquiv k L R O T Z (p i) (n + -(p i)) (z i) := rfl + +theorem second_entry (n : ℤ) (i j : Fin l) : + (secondTermEquiv k L R O T Z (p j) ((n+1) + -(p j))).toLinearMap.comp + (entry k (L × R) (L × R) (OffDiagonal.complex k L R O T) (BlockModule.secondComplex L R Z) p n i j) = + (BlockModule.firstMap k L R (entry k L R T Z p n i j)).comp + (secondTermEquiv k L R O T Z (p i) (n + -(p i))).toLinearMap := by + unfold entry + split_ifs with h + · have he : n + -(p i) = (n+1) + -(p j) := by omega + have ht : (ProductModules.secondInflation L R).map (eqToHom (congrArg Z.X he)) = + eqToHom (congrArg (BlockModule.secondComplex L R Z).X he) := by + generalize n + -(p i) = q at he ⊢ + generalize (n+1) + -(p j) = q' at he ⊢ + subst q' + simp only [eqToHom_refl,CategoryTheory.Functor.map_id] + rfl + have hh := secondTermEquiv_map k L R O T Z (O.d (p i) (p j)) (T.d (p i) (p j)) (eqToHom (congrArg Z.X he)) + rw [ht,← OffDiagonal.complex_d_all] at hh + exact hh + · apply LinearMap.ext + intro x + change secondTermEquiv k L R O T Z (p j) ((n+1) + -(p j)) 0 = 0 + exact (secondTermEquiv k L R O T Z (p j) ((n+1) + -(p j))).map_zero + +theorem second_vertical (n : ℤ) (i : Fin l) : + (secondTermEquiv k L R O T Z (p i) ((n+1) + -(p i))).toLinearMap.comp + (map k (L × R) (L × R) (OffDiagonal.complex k L R O T) (BlockModule.secondComplex L R Z) (𝟙 _) + ((BlockModule.secondComplex L R Z).d (n + -(p i)) ((n+1) + -(p i)))) = + (BlockModule.firstMap k L R (map k L R T Z (𝟙 _) (Z.d (n + -(p i)) ((n+1) + -(p i))))).comp + (secondTermEquiv k L R O T Z (p i) (n + -(p i))).toLinearMap := by + exact secondTermEquiv_map k L R O T Z (𝟙 (O.X (p i))) (𝟙 (T.X (p i))) (Z.d _ _) + +theorem second_differential (n : ℤ) + (z : totalTerm k (L × R) (L × R) (OffDiagonal.complex k L R O T) (BlockModule.secondComplex L R Z) p n) : + secondTotalEquiv k L R O T Z p (n+1) + (differential k (L × R) (L × R) (OffDiagonal.complex k L R O T) (BlockModule.secondComplex L R Z) p n z) = + differential k L R T Z p n (secondTotalEquiv k L R O T Z p n z) := by + funext j + change secondTermEquiv k L R O T Z (p j) ((n+1) + -(p j)) + (differential k (L × R) (L × R) (OffDiagonal.complex k L R O T) (BlockModule.secondComplex L R Z) p n z j) = + differential k L R T Z p n (secondTotalEquiv k L R O T Z p n z) j + simp only [differential, + LinearMap.pi_apply,LinearMap.add_apply,LinearMap.comp_apply,LinearMap.proj_apply, + LinearMap.sum_apply,map_add,map_sum] + apply congrArg₂ (· + ·) + · change secondTermEquiv k L R O T Z (p j) ((n+1) + -(p j)) + ((((-(p j)).negOnePow : ℤ)) • + (map k (L × R) (L × R) (OffDiagonal.complex k L R O T) (BlockModule.secondComplex L R Z) (𝟙 _) + ((BlockModule.secondComplex L R Z).d (n + -(p j)) ((n+1) + -(p j))) (z j))) = + (((-(p j)).negOnePow : ℤ)) • + (map k L R T Z (𝟙 _) (Z.d (n + -(p j)) ((n+1) + -(p j)))) + (secondTermEquiv k L R O T Z (p j) (n + -(p j)) (z j)) + rw [map_zsmul] + congr 1 + exact congrArg (fun f => f (z j)) (second_vertical k L R O T Z p n j) + · erw [LinearMap.sum_apply] + apply Finset.sum_congr rfl + intro i _ + exact congrArg (fun f => f (z i)) (second_entry k L R O T Z p n i j) + +/-- Actual tensor with the off-diagonal complex on a second-block input is the first-block T-total. -/ +def secondTotalIso : + total k (L × R) (L × R) (OffDiagonal.complex k L R O T) (BlockModule.secondComplex L R Z) p hp ≅ + BlockModule.firstComplex L R (total k L R T Z p hp) := + HomologicalComplex.Hom.isoOfComponents (fun n => (secondTotalEquiv k L R O T Z p n).toModuleIso) (by + intro n m h + change n+1=m at h + subst m + have h₁ : (total k (L × R) (L × R) (OffDiagonal.complex k L R O T) (BlockModule.secondComplex L R Z) p hp).d n (n+1) = + ModuleCat.ofHom (differential k (L × R) (L × R) (OffDiagonal.complex k L R O T) (BlockModule.secondComplex L R Z) p n) := + CochainComplex.of_d (fun n => ModuleCat.of (L × R) (totalTerm k (L × R) (L × R) (OffDiagonal.complex k L R O T) (BlockModule.secondComplex L R Z) p n)) + (fun n => ModuleCat.ofHom (differential k (L × R) (L × R) (OffDiagonal.complex k L R O T) (BlockModule.secondComplex L R Z) p n)) n + have h₂ : (total k L R T Z p hp).d n (n+1) = ModuleCat.ofHom (differential k L R T Z p n) := + CochainComplex.of_d (fun n => ModuleCat.of L (totalTerm k L R T Z p n)) + (fun n => ModuleCat.ofHom (differential k L R T Z p n)) n + change _ ≫ (ProductModules.firstInflation L R).map ((total k L R T Z p hp).d n (n+1)) = _ + rw [h₁,h₂] + apply ModuleCat.hom_ext + apply LinearMap.ext + intro z + exact (second_differential k L R O T Z p n z).symm) +end LittleFinitistic.OrdinarySimulation.BlockTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryShiftDerivedTensor.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryShiftDerivedTensor.lean new file mode 100644 index 0000000000000000000000000000000000000000..d30cd2ada11f799b275965cb0f964db514b4dad3 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryShiftDerivedTensor.lean @@ -0,0 +1,44 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleDerivedTensor +import OAI.Algebra.Finitistic.Ordinary.OrdinaryRightProjective +import OAI.Algebra.Finitistic.Ordinary.OrdinaryShiftSign + +namespace OAI +noncomputable section +open CategoryTheory Limits +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +variable (P : CochainComplex (ModuleCat.{u} (Enveloping k B)) ℤ) (b : ℤ) (l : ℕ) +variable [∀ n, Module.Projective Bᵐᵒᵖ ((underlyingRightComplex P).X n)] + +instance shifted_right_projective (n : ℤ) : Module.Projective Bᵐᵒᵖ + (ComplexTensor.rightTerm k B (BimoduleComplexTensor.rightComplex k B B (P⟦b⟧)) n) := + inferInstanceAs (Module.Projective Bᵐᵒᵖ ((underlyingRightComplex P).X (n+b))) + +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} B)] + +/-- The native derived tensor functor computed by the source's actual bounded P[b]. -/ +def shiftedDerivedTensor : DerivedCategory (ModuleCat.{u} B) ⥤ DerivedCategory (ModuleCat.{u} B) := + BimoduleComplexTensor.derivedTotal k B B (P⟦b⟧) + (TensorResolution.finiteDegrees l) (TensorResolution.finiteDegrees_strictMono l) + +def shiftedDerivedTensorComparison : DerivedCategory.Q ⋙ shiftedDerivedTensor P b l ≅ + BimoduleComplexTensor.totalFunctor k B B (P⟦b⟧) + (TensorResolution.finiteDegrees l) (TensorResolution.finiteDegrees_strictMono l) ⋙ DerivedCategory.Q := + BimoduleComplexTensor.derivedTotalComparison k B B (P⟦b⟧) + (TensorResolution.finiteDegrees l) (TensorResolution.finiteDegrees_strictMono l) + +omit [∀ n, Module.Projective Bᵐᵒᵖ ((underlyingRightComplex P).X n)] + [HasDerivedCategory.{u+1} (ModuleCat.{u} B)] in +theorem shifted_support (a : ℤ) (hb : a+(l:ℤ)=b) + (hP : ∀ n : ℤ, n < a ∨ b < n → IsZero (P.X n)) (n : ℤ) (hn : n < -(l:ℤ) ∨ 0 < n) : + IsZero ((P⟦b⟧).X n) := by + change IsZero (P.X (n+b)) + apply hP + omega +end LittleFinitistic.OrdinarySimulation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryShiftSign.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryShiftSign.lean new file mode 100644 index 0000000000000000000000000000000000000000..291955567b6df37085c8e37a99061febf4667534 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryShiftSign.lean @@ -0,0 +1,49 @@ +import Mathlib.Algebra.Homology.HomotopyCategory.Shift + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.OrdinarySimulation +universe u v +variable {C : Type u} [Category.{v} C] [Preadditive C] + +/-- Reindex P by b, retaining the original differential. This is what the resolution computes. -/ +def unsignedShift (P : CochainComplex C ℤ) (b : ℤ) : CochainComplex C ℤ where + X n := P.X (n+b) + d n m := P.d (n+b) (m+b) + shape n m h := P.shape _ _ (by + change ¬ (n+b)+1 = m+b + change ¬ n+1=m at h + omega) + d_comp_d' n m q _ _ := P.d_comp_d _ _ _ + +/-- Multiplication by an integer unit is an actual isomorphism in any additive category. -/ +def integerUnitIso (X : C) (u : ℤˣ) : X ≅ X where + hom := u • 𝟙 X + inv := u⁻¹ • 𝟙 X + hom_inv_id := by + simp only [Linear.units_smul_comp, Linear.comp_units_smul, Category.id_comp, + smul_smul, inv_mul_cancel, one_smul] + inv_hom_id := by + simp only [Linear.units_smul_comp, Linear.comp_units_smul, Category.id_comp, + smul_smul, mul_inv_cancel, one_smul] + +/-- The source's degree-n sign (-1)^(b*n), for all integers b and n. -/ +def shiftSignIso (P : CochainComplex C ℤ) (b : ℤ) : unsignedShift P b ≅ P⟦b⟧ := + HomologicalComplex.Hom.isoOfComponents + (fun n => integerUnitIso (P.X (n+b)) (b*n).negOnePow) (by + intro n m h + change n+1=m at h + subst m + change ((b*n).negOnePow • 𝟙 _) ≫ (b.negOnePow • P.d (n+b) (n+1+b)) = + P.d (n+b) (n+1+b) ≫ ((b*(n+1)).negOnePow • 𝟙 _) + simp only [Linear.units_smul_comp, Linear.comp_units_smul, Category.id_comp, + Category.comp_id, smul_smul] + rw [← Int.negOnePow_add] + congr 2 + simp [mul_add, add_comm]) +end LittleFinitistic.OrdinarySimulation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinarySignedExactness.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinarySignedExactness.lean new file mode 100644 index 0000000000000000000000000000000000000000..a16c095575086061a1b36d37d96c3a63d1013a6e --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinarySignedExactness.lean @@ -0,0 +1,35 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorExactness + +namespace OAI +noncomputable section +namespace LittleFinitistic +universe u +variable {R E F G : Type u} [Ring R] +variable [AddCommGroup E] [Module R E] +variable [AddCommGroup F] [Module R F] +variable [AddCommGroup G] [Module R G] + +/-- Multiplying both differentials by an integer unit preserves exactness. -/ +theorem exact_units_smul (u : ℤˣ) (f : E →ₗ[R] F) (g : F →ₗ[R] G) + (h : Function.Exact f g) : Function.Exact (u • f) (u • g) := by + intro z + constructor + · intro hz + have hg : g z = 0 := by + have hh := congrArg (fun x : G => u⁻¹ • x) hz + simpa only [LinearMap.smul_apply,smul_smul,inv_mul_cancel,one_smul,smul_zero] using hh + obtain ⟨y,hy⟩ := (h z).mp hg + refine ⟨u⁻¹ • y, ?_⟩ + change u • f ((↑(u⁻¹) : ℤ) • y) = z + rw [map_zsmul] + change u • (u⁻¹ • f y) = z + rw [smul_smul,mul_inv_cancel,one_smul,hy] + · rintro ⟨y,rfl⟩ + have hg : g (f y) = 0 := (h (f y)).mpr ⟨y,rfl⟩ + change u • g ((↑u : ℤ) • f y) = 0 + rw [map_zsmul,hg,smul_zero,smul_zero] +end LittleFinitistic + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinarySimulationComparison.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinarySimulationComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..b46d2629ecc1ee1c4ff0b2a517bdf5d5a706cf51 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinarySimulationComparison.lean @@ -0,0 +1,75 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryFullTensorComplex +import OAI.Algebra.Finitistic.Ordinary.OrdinarySupportedExtension +import OAI.Algebra.Finitistic.Ordinary.OrdinaryShiftSign + +namespace OAI +noncomputable section +open CategoryTheory Limits +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +variable (P : CochainComplex (ModuleCat.{u} (Enveloping k B)) ℤ) (a : ℤ) (l : ℕ) + +theorem differential_transport {n n' m m' : ℤ} (hn : n = n') (hm : m = m') : + eqToHom (congrArg P.X hn) ≫ P.d n' m' = P.d n m ≫ eqToHom (congrArg P.X hm) := by + subst n' + subst m' + simp only [eqToHom_refl,Category.id_comp,Category.comp_id] + +/-- Align the finite resolution's degree n with the source's degree a+n. -/ +def restrictedShiftIso : P.restriction (ComplexShape.embeddingUpIntGE a) ≅ + (unsignedShift P (a+(l:ℤ))).restriction (TensorResolution.degreeEmbedding l) := + HomologicalComplex.Hom.isoOfComponents (fun n => eqToIso (by + change P.X (a+(n:ℤ)) = P.X ((-(l:ℤ)+n)+(a+l)) + congr 1 + omega)) (by + intro n m _ + have hn : (-(l:ℤ)+(n:ℤ))+(a+l) = a+n := by omega + have hm : (-(l:ℤ)+(m:ℤ))+(a+l) = a+m := by omega + change eqToHom (congrArg P.X hn.symm) ≫ P.d ((-(l:ℤ)+n)+(a+l)) ((-(l:ℤ)+m)+(a+l)) = + P.d (a+n) (a+m) ≫ eqToHom (congrArg P.X hm.symm) + exact differential_transport P hn.symm hm.symm) + +/-- The lower support condition of the manuscript supplies strict support after reindexing. -/ +theorem unsignedSupport (hP : ∀ n : ℤ, n < a → IsZero (P.X n)) : + (unsignedShift P (a+(l:ℤ))).IsStrictlySupported (TensorResolution.degreeEmbedding l) := + ⟨fun n hn => by + have hlt : n < -(l:ℤ) := by + by_contra h + let j := (n+(l:ℤ)).toNat + have hj : (TensorResolution.degreeEmbedding l).f j = n := by + simp only [TensorResolution.degreeEmbedding_apply] + dsimp [j] + rw [Int.toNat_of_nonneg (by omega)] + omega + exact hn j hj + exact hP (n+(a+l)) (by omega)⟩ + +/-- The computed BC-balanced tensor complex in degrees -l,...,0 with both B-actions. -/ +def computedTensorComplex : CochainComplex (ModuleCat.{u} (Enveloping k B)) ℤ := + (FullTensorTerm.complex P a l).extend (TensorResolution.degreeEmbedding l) + +/-- Full bimodule chain comparison, including all zero terms and the genuine integer shift sign. -/ +def computedTensorIso + (hLower : ∀ n : ℤ, n < a → IsZero (P.X n)) + (hUpper : ∀ n : ℕ, l < n → IsZero (P.X (a+(n:ℤ)))) : + computedTensorComplex P a l ≅ P⟦a+(l:ℤ)⟧ := by + letI := unsignedSupport P a l hLower + exact ((TensorResolution.degreeEmbedding l).extendFunctor (ModuleCat.{u} (Enveloping k B))).mapIso + (FullTensorTerm.complexIso P a l hUpper ≪≫ restrictedShiftIso P a l) ≪≫ + SupportedExtension.iso (unsignedShift P (a+(l:ℤ))) (TensorResolution.degreeEmbedding l) ≪≫ + shiftSignIso P (a+(l:ℤ)) + +/-- Exact source indexing: b=a+l, with only the manuscript's support hypothesis. -/ +def sourceShiftComparison (b : ℤ) (hb : a+(l:ℤ)=b) + (hP : ∀ n : ℤ, n < a ∨ b < n → IsZero (P.X n)) : + computedTensorComplex P a l ≅ P⟦b⟧ := by + subst b + exact computedTensorIso P a l (fun n hn => hP n (Or.inl hn)) + (fun n hn => hP (a+(n:ℤ)) (Or.inr (by omega))) +end LittleFinitistic.OrdinarySimulation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinarySingleTensorTerms.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinarySingleTensorTerms.lean new file mode 100644 index 0000000000000000000000000000000000000000..d3061a5841dab0c29a6ebba004b7131d526406ea --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinarySingleTensorTerms.lean @@ -0,0 +1,99 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleCoefficientEquiv +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleTensorTotal +import OAI.Algebra.Finitistic.Ordinary.OrdinaryRetainedRestriction +import OAI.Algebra.Finitistic.Ordinary.OrdinaryFinitePiSupport +import OAI.Algebra.Finitistic.Ordinary.OrdinaryMiddleTensorFunctors +import OAI.Algebra.Finitistic.Ordinary.OrdinaryShiftSign + +namespace OAI +noncomputable section +open CategoryTheory Limits +open scoped TensorProduct +namespace LittleFinitistic.SingleBimoduleTensor +universe u +variable (k S A N : Type u) [Field k] [Ring S] [Ring A] [Algebra k S] [Algebra k A] +variable [AddCommGroup N] [Module k N] [Module S N] [Module Aᵐᵒᵖ N] + [IsScalarTower k S N] [IsScalarTower k Aᵐᵒᵖ N] [SMulCommClass S Aᵐᵒᵖ N] + +abbrev complex : CochainComplex (ModuleCat.{u} (S ⊗[k] Aᵐᵒᵖ)) ℤ := + (HomologicalComplex.single _ (.up ℤ) 0).obj (RetainedBimodule.object k S A N) + +variable (Z : CochainComplex (ModuleCat.{u} A) ℤ) +open BimoduleComplexTensor + +def zeroCoefficientEquiv : BimoduleCoefficients k S A ((complex k S A N).X 0) ≃ₗ[Aᵐᵒᵖ] N := + (BimoduleCoefficients.equiv k S A (HomologicalComplex.singleObjXSelf (.up ℤ) 0 (RetainedBimodule.object k S A N))).trans + (RetainedBimodule.rightEquiv k S A N) + +theorem zeroCoefficientEquiv_left (s : S) (x : BimoduleCoefficients k S A ((complex k S A N).X 0)) : + zeroCoefficientEquiv k S A N (s • x) = s • zeroCoefficientEquiv k S A N x := by + simp only [zeroCoefficientEquiv,LinearEquiv.trans_apply,BimoduleCoefficients.equiv_left,RetainedBimodule.rightEquiv_left] + +def zeroTermEquiv (n : ℤ) : term k S A (complex k S A N) Z 0 n ≃ₗ[S] (middleLeftComplex k S A N Z).X n := + LeftTensor.congr (zeroCoefficientEquiv k S A N) (zeroCoefficientEquiv_left k S A N) + (LinearEquiv.refl A (ComplexTensor.leftTerm k A Z n)) + +theorem zeroTermEquiv_map {n m : ℤ} (g : Z.X n ⟶ Z.X m) : + (zeroTermEquiv k S A N Z m).toLinearMap.comp (map k S A (complex k S A N) Z (𝟙 _) g) = + ((middleLeftFunctor k S A N).map g).hom.comp (zeroTermEquiv k S A N Z n).toLinearMap := by + let : Module k ((middleLeftComplex k S A N Z).X m) := inferInstanceAs (Module k (LeftTensor k A S N (ComplexTensor.leftTerm k A Z m))) + let : IsScalarTower k S ((middleLeftComplex k S A N Z).X m) := inferInstanceAs (IsScalarTower k S (LeftTensor k A S N (ComplexTensor.leftTerm k A Z m))) + apply LinearMap.restrictScalars_injective k + apply BalancedTensor.ext + intro x z + rfl + +variable {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) (i₀ : Fin l) (h₀ : p i₀ = 0) + +include hp h₀ in +theorem otherTerm_subsingleton (n : ℤ) (i : Fin l) (hi : i ≠ i₀) : + Subsingleton (term k S A (complex k S A N) Z (p i) (n + -(p i))) := by + have hz : p i ≠ 0 := by + intro h + exact hi (hp.injective (h.trans h₀.symm)) + have : Subsingleton (BimoduleCoefficients k S A ((complex k S A N).X (p i))) := + ModuleCat.isZero_iff_subsingleton.mp + (HomologicalComplex.isZero_single_obj_X (.up ℤ) 0 (RetainedBimodule.object k S A N) (p i) hz) + exact inferInstanceAs (Subsingleton (BalancedTensor.Tensor k A + (BimoduleCoefficients k S A ((complex k S A N).X (p i))) (ComplexTensor.leftTerm k A Z (n + -(p i))))) + +def coefficientEquivAt (q : ℤ) (hq : q = 0) : + BimoduleCoefficients k S A ((complex k S A N).X q) ≃ₗ[Aᵐᵒᵖ] N := by + subst q + exact zeroCoefficientEquiv k S A N + +theorem coefficientEquivAt_left (q : ℤ) (hq : q = 0) (s : S) + (x : BimoduleCoefficients k S A ((complex k S A N).X q)) : + coefficientEquivAt k S A N q hq (s • x) = s • coefficientEquivAt k S A N q hq x := by + subst q + exact zeroCoefficientEquiv_left k S A N s x + +def termEquivAt (q : ℤ) (hq : q = 0) (n : ℤ) : + term k S A (complex k S A N) Z q (n + -q) ≃ₗ[S] ((middleLeftComplex k S A N Z)⟦-q⟧).X n := + LeftTensor.congr (coefficientEquivAt k S A N q hq) (coefficientEquivAt_left k S A N q hq) + (LinearEquiv.refl A (ComplexTensor.leftTerm k A Z (n + -q))) + +theorem termEquivAt_map (q : ℤ) (hq : q = 0) (n m : ℤ) (g : Z.X (n + -q) ⟶ Z.X (m + -q)) : + (termEquivAt k S A N Z q hq m).toLinearMap.comp (map k S A (complex k S A N) Z (𝟙 _) g) = + ((middleLeftFunctor k S A N).map g).hom.comp (termEquivAt k S A N Z q hq n).toLinearMap := by + let : Module k (((middleLeftComplex k S A N Z)⟦-q⟧).X m) := + inferInstanceAs (Module k (LeftTensor k A S N (ComplexTensor.leftTerm k A Z (m + -q)))) + let : IsScalarTower k S (((middleLeftComplex k S A N Z)⟦-q⟧).X m) := + inferInstanceAs (IsScalarTower k S (LeftTensor k A S N (ComplexTensor.leftTerm k A Z (m + -q)))) + apply LinearMap.restrictScalars_injective k + apply BalancedTensor.ext + intro x z + rfl + +abbrev selectedTermEquiv (n : ℤ) := termEquivAt k S A N Z (p i₀) h₀ n + +def totalTermEquiv (n : ℤ) : totalTerm k S A (complex k S A N) Z p n ≃ₗ[S] + ((middleLeftComplex k S A N Z)⟦-(p i₀)⟧).X n := + (FinitePiSupport.equivalence (fun i => term k S A (complex k S A N) Z (p i) (n + -(p i))) + i₀ (otherTerm_subsingleton k S A N Z p hp i₀ h₀ n)).trans + (selectedTermEquiv k S A N Z p i₀ h₀ n) +end LittleFinitistic.SingleBimoduleTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinarySingleTensorTotal.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinarySingleTensorTotal.lean new file mode 100644 index 0000000000000000000000000000000000000000..367886aad0e420e33a213c2664b4b0fc35c2a883 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinarySingleTensorTotal.lean @@ -0,0 +1,84 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinarySingleTensorTerms + +namespace OAI +noncomputable section +open CategoryTheory Limits +open scoped TensorProduct +namespace LittleFinitistic.SingleBimoduleTensor +universe u +variable (k S A N : Type u) [Field k] [Ring S] [Ring A] [Algebra k S] [Algebra k A] +variable [AddCommGroup N] [Module k N] [Module S N] [Module Aᵐᵒᵖ N] + [IsScalarTower k S N] [IsScalarTower k Aᵐᵒᵖ N] [SMulCommClass S Aᵐᵒᵖ N] +variable (Z : CochainComplex (ModuleCat.{u} A) ℤ) +variable {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) (i₀ : Fin l) (h₀ : p i₀ = 0) +open BimoduleComplexTensor + +include hp h₀ in +theorem entry_selected_zero (n : ℤ) (z : totalTerm k S A (complex k S A N) Z p n) (i : Fin l) : + entry k S A (complex k S A N) Z p n i i₀ (z i) = 0 := by + by_cases hi : i = i₀ + · subst i + unfold entry + rw [dite_eq_right (show ¬ p i₀ + 1 = p i₀ by omega)] + rfl + · have hs := otherTerm_subsingleton k S A N Z p hp i₀ h₀ n i hi + rw [hs.elim (z i) 0,map_zero] + +include hp h₀ in +theorem differential_selected (n : ℤ) (z : totalTerm k S A (complex k S A N) Z p n) : + differential k S A (complex k S A N) Z p n z i₀ = + ((-(p i₀)).negOnePow • map k S A (complex k S A N) Z (𝟙 _) + (Z.d (n + -(p i₀)) ((n+1) + -(p i₀)))) (z i₀) := by + simp only [differential,LinearMap.pi_apply,LinearMap.add_apply,LinearMap.comp_apply,LinearMap.proj_apply, + LinearMap.sum_apply] + rw [Finset.sum_eq_zero (fun i _ => entry_selected_zero k S A N Z p hp i₀ h₀ n z i),add_zero] + +theorem termEquivAt_vertical (q : ℤ) (hq : q = 0) (n : ℤ) + (y : term k S A (complex k S A N) Z q (n + -q)) : + termEquivAt k S A N Z q hq (n+1) + (((-q).negOnePow • map k S A (complex k S A N) Z (𝟙 _) + (Z.d (n + -q) ((n+1) + -q))) y) = + (((middleLeftComplex k S A N Z)⟦-q⟧).d n (n+1)).hom (termEquivAt k S A N Z q hq n y) := by + change termEquivAt k S A N Z q hq (n+1) + ((((-q).negOnePow : ℤ)) • (map k S A (complex k S A N) Z (𝟙 _) + (Z.d (n + -q) ((n+1) + -q))) y) = + (((-q).negOnePow : ℤ)) • (((middleLeftFunctor k S A N).map (Z.d (n + -q) ((n+1) + -q))).hom + (termEquivAt k S A N Z q hq n y)) + rw [map_zsmul] + congr 1 + exact congrArg (fun f => f y) (termEquivAt_map k S A N Z q hq n (n+1) (Z.d _ _)) + +theorem totalTermEquiv_differential (n : ℤ) (z : totalTerm k S A (complex k S A N) Z p n) : + totalTermEquiv k S A N Z p hp i₀ h₀ (n+1) (differential k S A (complex k S A N) Z p n z) = + (((middleLeftComplex k S A N Z)⟦-(p i₀)⟧).d n (n+1)).hom (totalTermEquiv k S A N Z p hp i₀ h₀ n z) := by + change termEquivAt k S A N Z (p i₀) h₀ (n+1) + (differential k S A (complex k S A N) Z p n z i₀) = + (((middleLeftComplex k S A N Z)⟦-(p i₀)⟧).d n (n+1)).hom (termEquivAt k S A N Z (p i₀) h₀ n (z i₀)) + rw [differential_selected k S A N Z p hp i₀ h₀] + exact termEquivAt_vertical k S A N Z (p i₀) h₀ n (z i₀) + +/-- A genuine ordinary bimodule in degree zero has exactly its ordinary tensor complex as total. -/ +def shiftedTotalIso : total k S A (complex k S A N) Z p hp ≅ (middleLeftComplex k S A N Z)⟦-(p i₀)⟧ := + HomologicalComplex.Hom.isoOfComponents (fun n => (totalTermEquiv k S A N Z p hp i₀ h₀ n).toModuleIso) (by + intro n m h + change n+1=m at h + subst m + have hd : (total k S A (complex k S A N) Z p hp).d n (n+1) = ModuleCat.ofHom (differential k S A (complex k S A N) Z p n) := + CochainComplex.of_d (fun n => ModuleCat.of S (totalTerm k S A (complex k S A N) Z p n)) + (fun n => ModuleCat.ofHom (differential k S A (complex k S A N) Z p n)) n + rw [hd] + apply ModuleCat.hom_ext + apply LinearMap.ext + intro z + exact (totalTermEquiv_differential k S A N Z p hp i₀ h₀ n z).symm) + +/-- Removing the proved zero shift identifies the ordinary tensor complex exactly. -/ +def totalIso : total k S A (complex k S A N) Z p hp ≅ middleLeftComplex k S A N Z := + shiftedTotalIso k S A N Z p hp i₀ h₀ ≪≫ + (eqToIso (congrArg (fun q : ℤ => (middleLeftComplex k S A N Z)⟦q⟧) (show -(p i₀) = 0 by omega))) ≪≫ + (shiftFunctorZero (CochainComplex (ModuleCat.{u} S) ℤ) ℤ).app (middleLeftComplex k S A N Z) +end LittleFinitistic.SingleBimoduleTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinarySourceBimoduleTotal.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinarySourceBimoduleTotal.lean new file mode 100644 index 0000000000000000000000000000000000000000..d9f31b8c839c0a06e03b3da238270031aa37ef43 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinarySourceBimoduleTotal.lean @@ -0,0 +1,35 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryGenuineBimoduleComparison +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleTotalAssociativity +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleTotalCongruence +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorTotalAcyclic + +namespace OAI +noncomputable section +open CategoryTheory Limits +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +variable (P : CochainComplex (ModuleCat.{u} (Enveloping k B)) ℤ) (a : ℤ) (l : ℕ) +variable (b : ℤ) (hb : a+(l:ℤ)=b) +variable (hP : ∀ n : ℤ, n < a ∨ b < n → IsZero (P.X n)) +variable (Z : CochainComplex (ModuleCat.{u} B) ℤ) + +/-- The source signed total comparison for every Z, with the actual outside B-action retained. -/ +def sourceBimoduleTotalComparison : + BimoduleComplexTensor.total k B (B ⊗[k] ChainAlgebra k l) + (TensorResolution.integerBimoduleComplex k B l) + (middleLeftComplex k (B ⊗[k] ChainAlgebra k l) B (BimoduleO P a l) Z) + (TensorResolution.finiteDegrees l) (TensorResolution.finiteDegrees_strictMono l) ≅ + BimoduleComplexTensor.total k B B (P⟦b⟧) Z + (TensorResolution.finiteDegrees l) (TensorResolution.finiteDegrees_strictMono l) := + (BimoduleComplexTensor.totalAssociativityIso k B (B ⊗[k] ChainAlgebra k l) B (BimoduleO P a l) + (TensorResolution.integerBimoduleComplex k B l) Z + (TensorResolution.finiteDegrees l) (TensorResolution.finiteDegrees_strictMono l)).symm ≪≫ + BimoduleComplexTensor.totalRightIso k B B (genuineSourceShiftComparison P a l b hb hP) Z + (TensorResolution.finiteDegrees l) (TensorResolution.finiteDegrees_strictMono l) +end LittleFinitistic.OrdinarySimulation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinarySourceDerivedComparison.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinarySourceDerivedComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..04fb44336d9d4f5b755396100c2562ad77e7fa96 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinarySourceDerivedComparison.lean @@ -0,0 +1,42 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinarySourceResolutionModels +import OAI.Algebra.Finitistic.Ordinary.OrdinaryDerivedSquareComparison + +namespace OAI +noncomputable section +open CategoryTheory Limits +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +variable (P : CochainComplex (ModuleCat.{u} (Enveloping k B)) ℤ) (a : ℤ) (l : ℕ) +variable (b : ℤ) (hb : a+(l:ℤ)=b) +variable (hP : ∀ n : ℤ, n < a ∨ b < n → IsZero (P.X n)) + +section Bimodule +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} (Enveloping k B))] + +/-- The source's resolved T tensor O comparison in the native derived category of genuine B-bimodules. +Its left operand includes the actual bounded right-BC-projective resolution and augmentation to T. -/ +def resolvedBimoduleComparison : + (TensorResolution.resolutionModel k B l).tensorOrdinary B (BimoduleO P a l) ≅ + DerivedCategory.Q.obj (P⟦b⟧) := + DerivedCategory.Q.mapIso (genuineSourceShiftComparison P a l b hb hP) +end Bimodule + +variable [∀ n, Module.Projective Bᵐᵒᵖ ((underlyingRightComplex P).X n)] +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} B)] +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} (AlgebraD k l B))] + +/-- The source's native derived square with both tensor functors tied to their certified full-support models. -/ +def resolvedSquareComparison (Z : CochainComplex (ModuleCat.{u} B) ℤ) : + (XResolution.resolutionModel P a l).toFiniteProjectiveBimoduleComplex.derivedTensor.obj + ((XResolution.resolutionModel P a l).toFiniteProjectiveBimoduleComplex.derivedTensor.obj + ((BlockModule.derivedFirst B (B ⊗[k] ChainAlgebra k l)).obj (DerivedCategory.Q.obj Z))) ≅ + (BlockModule.derivedFirst B (B ⊗[k] ChainAlgebra k l)).obj + ((shiftedResolutionModel P a l b hb hP).derivedTensor.obj (DerivedCategory.Q.obj Z)) := + XResolution.derivedSquareComparison P a l b hb hP Z +end LittleFinitistic.OrdinarySimulation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinarySourceResolutionModels.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinarySourceResolutionModels.lean new file mode 100644 index 0000000000000000000000000000000000000000..69522e229ae5f3347bfe4fd1f62056ef12454948 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinarySourceResolutionModels.lean @@ -0,0 +1,80 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryResolutionModels +import OAI.Algebra.Finitistic.Ordinary.OrdinaryXAugmentation +import OAI.Algebra.Finitistic.Ordinary.OrdinaryShiftDerivedTensor + +namespace OAI +noncomputable section +open CategoryTheory Limits +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] + +namespace TensorResolution + +theorem finiteDegrees_range (l : ℕ) (n : ℤ) : n ∈ Set.range (finiteDegrees l) ↔ -(l:ℤ) ≤ n ∧ n ≤ 0 := by + constructor + · rintro ⟨i,rfl⟩ + dsimp [finiteDegrees] + have hi := i.isLt + omega + · rintro ⟨hlo,hhi⟩ + let j := (n+(l:ℤ)).toNat + have hj : (j:ℤ) = n+(l:ℤ) := Int.toNat_of_nonneg (by omega) + refine ⟨⟨j,by omega⟩,?_⟩ + dsimp [finiteDegrees] + omega + +/-- The actual Q_T augmentation with all source resolution obligations proved. -/ +def resolutionModel (k B : Type u) [Field k] [Ring B] [Algebra k B] (l : ℕ) : + BoundedBimoduleResolution k B (B ⊗[k] ChainAlgebra k l) (bimoduleTerminalObject k B l) where + complex := integerBimoduleComplex k B l + size := l+1 + degrees := finiteDegrees l + strictMono := finiteDegrees_strictMono l + support n hn := by + have h : n < -(l:ℤ) ∨ 0 < n := by + have := (finiteDegrees_range l n).not.mp hn + omega + exact h.elim (integerBimodule_lower k B l n) (integerBimodule_upper k B l n) + rightProjective n := integerBimoduleRight_projective k B l n + augmentation := integerBimoduleAugmentation k B l + augmentation_quasiIso := integerBimoduleAugmentation_quasiIso k B l +end TensorResolution + +variable (P : CochainComplex (ModuleCat.{u} (Enveloping k B)) ℤ) (a : ℤ) (l : ℕ) +variable [∀ n, Module.Projective Bᵐᵒᵖ ((underlyingRightComplex P).X n)] + +/-- The actual Q_X resolution with no assumed augmentation, projectivity, or support theorem. -/ +def XResolution.resolutionModel : + BoundedBimoduleResolution k (AlgebraD k l B) (AlgebraD k l B) (XResolution.ordinaryXObject P a l) where + complex := XResolution.complex P a l + size := l+1 + degrees := TensorResolution.finiteDegrees l + strictMono := TensorResolution.finiteDegrees_strictMono l + support n hn := by + apply XResolution.vanishes P a l n + have := (TensorResolution.finiteDegrees_range l n).not.mp hn + omega + rightProjective n := XResolution.right_projective P a l n + augmentation := XResolution.augmentationToX P a l + augmentation_quasiIso := XResolution.augmentationToX_quasiIso P a l + +/-- The actual P[b] itself is a finite right-projective tensor model with exactly the source support. -/ +def shiftedResolutionModel (b : ℤ) (hb : a+(l:ℤ)=b) + (hP : ∀ n : ℤ, n < a ∨ b < n → IsZero (P.X n)) : FiniteProjectiveBimoduleComplex k B B where + complex := P⟦b⟧ + size := l+1 + degrees := TensorResolution.finiteDegrees l + strictMono := TensorResolution.finiteDegrees_strictMono l + support n hn := by + change IsZero (P.X (n+b)) + apply hP + have := (TensorResolution.finiteDegrees_range l n).not.mp hn + omega + rightProjective n := shifted_right_projective P b n +end LittleFinitistic.OrdinarySimulation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinarySupportedExtension.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinarySupportedExtension.lean new file mode 100644 index 0000000000000000000000000000000000000000..b5ce362be0adb76599e68c19977eea48fe1f0515 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinarySupportedExtension.lean @@ -0,0 +1,53 @@ +import Mathlib.Algebra.Homology.Embedding.StupidTrunc + +namespace OAI +noncomputable section +attribute [local instance] Classical.propDecidable +open CategoryTheory Limits +namespace LittleFinitistic.OrdinarySimulation.SupportedExtension +universe u v w w' +variable {C : Type u} [Category.{v} C] [HasZeroMorphisms C] [HasZeroObject C] +variable {I : Type w} {J : Type w'} {c : ComplexShape I} {c' : ComplexShape J} +variable (K : HomologicalComplex C c') (e : c.Embedding c') [e.IsRelIff] [K.IsStrictlySupported e] + +/-- The supported complex's restriction and extension have its actual components. -/ +def component (j : J) : (K.stupidTrunc e).X j ≅ K.X j := + if hj : ∃ i, e.f i = j then K.stupidTruncXIso e hj.choose_spec + else (K.isZero_stupidTrunc_X e j (by simpa using hj)).iso + (K.isZero_X_of_isStrictlySupported e j (by simpa using hj)) + +omit [K.IsStrictlySupported e] in +theorem component_iso_unique {i j : I} {n : J} (hi : e.f i = n) (hj : e.f j = n) : + K.stupidTruncXIso e hi = K.stupidTruncXIso e hj := by + have h : i = j := e.injective_f (hi.trans hj.symm) + subst j + rfl + +theorem component_at (i : I) : component K e (e.f i) = K.stupidTruncXIso e rfl := by + unfold component + rw [dite_eq_left (show ∃ j, e.f j = e.f i from ⟨i,rfl⟩)] + exact component_iso_unique K e _ _ + +/-- An actual chain isomorphism, with support supplied by proved zero objects. -/ +def iso : K.stupidTrunc e ≅ K := + HomologicalComplex.Hom.isoOfComponents (component K e) (by + intro i' j' _ + by_cases hi : ∃ i, e.f i = i' + · obtain ⟨i,rfl⟩ := hi + by_cases hj : ∃ j, e.f j = j' + · obtain ⟨j,rfl⟩ := hj + rw [component_at,component_at] + change (((K.restriction e).extendXIso e rfl).hom ≫ 𝟙 _) ≫ K.d (e.f i) (e.f j) = + ((K.restriction e).extend e).d (e.f i) (e.f j) ≫ + (((K.restriction e).extendXIso e rfl).hom ≫ 𝟙 _) + rw [Category.comp_id, Category.comp_id] + rw [HomologicalComplex.extend_d_eq _ _ rfl rfl] + simp only [Category.assoc,Iso.inv_hom_id,Category.comp_id] + rfl + · exact IsZero.eq_of_tgt (K.isZero_X_of_isStrictlySupported e j' (by simpa using hj)) _ _ + · exact IsZero.eq_of_src (K.isZero_stupidTrunc_X e i' (by simpa using hi)) _ _) +end LittleFinitistic.OrdinarySimulation.SupportedExtension + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorAugmentation.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorAugmentation.lean new file mode 100644 index 0000000000000000000000000000000000000000..a08f88a0e32b58d497c04306dbca4fd28539e9c7 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorAugmentation.lean @@ -0,0 +1,127 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorResolution +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTerminal + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] (l : ℕ) + +instance TerminalSimple.tower : IsScalarTower k (ChainAlgebra k l)ᵐᵒᵖ (TerminalSimple k) where + smul_assoc r x w := by + change (show k from w) * (r * (ChainAlgebra.terminalCharacter k l x.unop)) = + r * ((show k from w) * ChainAlgebra.terminalCharacter k l x.unop) + ring + +namespace TensorResolution +open ChainAlgebra + +def simpleCoordinates : TerminalSimple k ≃ₗ[k] k where + toFun w := w + invFun w := w + left_inv _ := rfl + right_inv _ := rfl + map_add' _ _ := rfl + map_smul' _ _ := rfl + +def terminalEquiv : B ⊗[k] TerminalSimple k ≃ₗ[k] TerminalTensor B := + (TensorProduct.congr (LinearEquiv.refl k B) (simpleCoordinates k)).trans (TerminalTensor.tensorModel k B) + +/-- The augmentation retains the actual right BC-action. -/ +def augmentation : term k B l l →ₗ[(B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ] TerminalTensor B where + toFun x := terminalAugmentation k B l x.val + map_add' x y := map_add _ x.val y.val + map_smul' r x := map_mul (terminalAugmentation k B l) x.val r.unop + +/-- The ordinary augmentation is exactly B tensor the terminal C-augmentation. -/ +theorem augmentation_tensor (z : B ⊗[k] resolutionIdeal k l l) : + augmentation k B l (termEquiv k B l l z) = + terminalEquiv k B (((resolutionAugmentation k l).hom.restrictScalars k).lTensor B z) := by + induction z using TensorProduct.inductionOn with + | tmul b c => + change b * algebraMap k B (c.val.1 (Fin.last l)) = (c.val.1 (Fin.last l)) • b + rw [Algebra.smul_def,Algebra.commutes] + | add x y hx hy => simp only [map_add,hx,hy] + +/-- The augmentation preserves the regular left B-action as well. -/ +theorem augmentation_left (b : B) (x : term k B l l) : + augmentation k B l (b • x) = b • augmentation k B l x := by + change terminalAugmentation k B l (TensorIdeal.coefficient b * x.val) = + b * terminalAugmentation k B l x.val + rw [map_mul] + congr 1 + change b * algebraMap k B (ChainAlgebra.terminalCharacter k l 1) = b + rw [map_one,map_one,mul_one] + +theorem augmentation_comp (n : ℕ) : + (augmentation k B (n+1)).comp (differential k B (n+1) n) = 0 := by + ext x + change terminalAugmentation k B (n+1) (((1:B) ⊗ₜ[k] extendedArrow k (n+1) n) * x.val) = 0 + rw [map_mul] + have hz : terminalAugmentation k B (n+1) ((1:B) ⊗ₜ[k] extendedArrow k (n+1) n) = 0 := by + rw [extendedArrow,dite_eq_left (by omega)] + change 1 * algebraMap k B ((arrow k (n+1) ⟨n,by omega⟩).1 (Fin.last (n+1))) = 0 + rw [arrow_diagonal,map_zero,mul_zero] + rw [hz,zero_mul] + +theorem augmentation_exact (n : ℕ) : + Function.Exact (differential k B (n+1) n) (augmentation k B (n+1)) := by + have hc : Function.Exact ((resolutionDifferential k (n+1) n).hom.restrictScalars k) + ((resolutionAugmentation k (n+1)).hom.restrictScalars k) := by + intro x + constructor + · intro hx + exact (ShortComplex.moduleCat_exact_iff _).mp (resolutionAugmentation_exact k n) x hx + · rintro ⟨y,rfl⟩ + exact congrArg (fun f => f.hom y) (resolutionAugmentation_comp k n) + have ht := Module.Flat.lTensor_exact B hc + intro x + constructor + · intro hx + have hz : (((resolutionAugmentation k (n+1)).hom.restrictScalars k).lTensor B) + ((termEquiv k B (n+1) (n+1)).symm x) = 0 := by + apply (terminalEquiv k B).injective + rw [← augmentation_tensor,LinearEquiv.apply_symm_apply,hx,map_zero] + obtain ⟨y,hy⟩ := (ht _).mp hz + refine ⟨termEquiv k B (n+1) n y, ?_⟩ + rw [← termEquiv_d,hy,LinearEquiv.apply_symm_apply] + · rintro ⟨y,rfl⟩ + exact congrArg (fun f => f y) (augmentation_comp k B n) + +/-- Surjectivity is explicit: the terminal vertex lifts every coefficient b. -/ +theorem augmentation_surjective : Function.Surjective (augmentation k B l) := by + intro b + let x : term k B l l := ⟨(show B from b) ⊗ₜ[k] vertex k l (Fin.last l), by + change ((1:B) ⊗ₜ[k] extendedVertex k l l) * _ = _ + rw [extendedVertex,dite_eq_left le_rfl] + have hi : (⟨l,by omega⟩ : Fin (l+1)) = Fin.last l := rfl + rw [hi,Algebra.TensorProduct.tmul_mul_tmul,one_mul,vertex_idempotent]⟩ + refine ⟨x, ?_⟩ + change (show B from b) * algebraMap k B ((vertex k l (Fin.last l)).1 (Fin.last l)) = (show B from b) + rw [vertex_diagonal,Pi.single_eq_same,map_one,mul_one] + +theorem initial_injective (h : 0 < l) : Function.Injective (differential k B l 0) := by + have hi := Module.Flat.lTensor_preserves_injective_linearMap + ((resolutionDifferential k l 0).hom.restrictScalars k) (resolutionInitial_injective k l h) (M := B) + intro x y hxy + apply (termEquiv k B l 0).symm.injective + apply hi + apply (termEquiv k B l 1).injective + rw [termEquiv_d,termEquiv_d,LinearEquiv.apply_symm_apply,LinearEquiv.apply_symm_apply,hxy] + +theorem augmentation_zero_injective : Function.Injective (augmentation k B 0) := by + have hi := Module.Flat.lTensor_preserves_injective_linearMap + ((resolutionAugmentation k 0).hom.restrictScalars k) (resolutionAugmentation_zero_injective k) (M := B) + intro x y hxy + apply (termEquiv k B 0 0).symm.injective + apply hi + apply (terminalEquiv k B).injective + rw [← augmentation_tensor,← augmentation_tensor,LinearEquiv.apply_symm_apply,LinearEquiv.apply_symm_apply,hxy] +end TensorResolution +end LittleFinitistic.OrdinarySimulation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorBimap.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorBimap.lean new file mode 100644 index 0000000000000000000000000000000000000000..a1dcde68dfd9937a38572ee7058f3aa6470f7a09 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorBimap.lean @@ -0,0 +1,44 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryProjectiveTensor + +namespace OAI +noncomputable section +namespace LittleFinitistic.BalancedTensor +universe u +variable {k A M M' M'' N N' N'' : Type u} [Field k] [Ring A] [Algebra k A] +variable [AddCommGroup M] [Module k M] [Module Aᵐᵒᵖ M] [IsScalarTower k Aᵐᵒᵖ M] +variable [AddCommGroup M'] [Module k M'] [Module Aᵐᵒᵖ M'] [IsScalarTower k Aᵐᵒᵖ M'] +variable [AddCommGroup M''] [Module k M''] [Module Aᵐᵒᵖ M''] [IsScalarTower k Aᵐᵒᵖ M''] +variable [AddCommGroup N] [Module k N] [Module A N] [IsScalarTower k A N] +variable [AddCommGroup N'] [Module k N'] [Module A N'] [IsScalarTower k A N'] +variable [AddCommGroup N''] [Module k N''] [Module A N''] [IsScalarTower k A N''] + +/-- The actual balanced tensor map in both variables. -/ +def bimap (f : M →ₗ[Aᵐᵒᵖ] M') (g : N →ₗ[A] N') : Tensor k A M N →ₗ[k] Tensor k A M' N' := + (mapRightTo g).comp (mapLeft N f) + +@[simp] theorem bimap_mk (f : M →ₗ[Aᵐᵒᵖ] M') (g : N →ₗ[A] N') (m : M) (n : N) : + bimap (k := k) f g (mk k A M N m n) = mk k A M' N' (f m) (g n) := rfl + +@[simp] theorem bimap_comp (f : M →ₗ[Aᵐᵒᵖ] M') (f' : M' →ₗ[Aᵐᵒᵖ] M'') + (g : N →ₗ[A] N') (g' : N' →ₗ[A] N'') : + (bimap (k := k) f' g').comp (bimap f g) = bimap (f'.comp f) (g'.comp g) := by + apply ext + intro m n + rfl + +@[simp] theorem bimap_zero_left (g : N →ₗ[A] N') : + bimap (k := k) (0 : M →ₗ[Aᵐᵒᵖ] M') g = 0 := by + apply ext + intro m n + simp only [bimap_mk,LinearMap.zero_apply,map_zero,LinearMap.zero_apply] + +@[simp] theorem bimap_zero_right (f : M →ₗ[Aᵐᵒᵖ] M') : + bimap (k := k) f (0 : N →ₗ[A] N') = 0 := by + apply ext + intro m n + simp only [bimap_mk,LinearMap.zero_apply,map_zero] +end LittleFinitistic.BalancedTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorBimoduleComparison.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorBimoduleComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..2d6db78101247127cf3dd84cde45a29c95b1105e --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorBimoduleComparison.lean @@ -0,0 +1,102 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorVertex +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBalancedActions + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +variable (P : CochainComplex (ModuleCat.{u} (Enveloping k B)) ℤ) (a : ℤ) (l : ℕ) + +def VertexTensor (i : Fin (l+1)) := + BalancedTensor.Tensor k (B ⊗[k] ChainAlgebra k l) + (IdempotentTensor.rightIdeal (TensorIdeal.vertex (k := k) (B := B) (ChainAlgebra.vertex k l i))) + (BimoduleO P a l) + +namespace VertexTensor +variable (i : Fin (l+1)) +instance : AddCommGroup (VertexTensor P a l i) := inferInstanceAs (AddCommGroup (BalancedTensor.Tensor k (B ⊗[k] ChainAlgebra k l) _ (BimoduleO P a l))) +instance : Module k (VertexTensor P a l i) := inferInstanceAs (Module k (BalancedTensor.Tensor k (B ⊗[k] ChainAlgebra k l) _ (BimoduleO P a l))) + +def action : Enveloping k B →ₐ[k] Module.End k (VertexTensor P a l i) := + by + have : SMulCommClass Bᵐᵒᵖ (B ⊗[k] ChainAlgebra k l) (BimoduleO P a l) := + ⟨fun r x v => (smul_comm x r v).symm⟩ + exact BalancedTensor.bimoduleAction + +instance : Module (Enveloping k B) (VertexTensor P a l i) := Module.compHom _ (action P a l i).toRingHom +instance : IsScalarTower k (Enveloping k B) (VertexTensor P a l i) where + smul_assoc r x z := by + change action P a l i (r • x) z = r • action P a l i x z + rw [map_smul] + rfl + +def mk : IdempotentTensor.rightIdeal (TensorIdeal.vertex (k := k) (B := B) (ChainAlgebra.vertex k l i)) →ₗ[k] + BimoduleO P a l →ₗ[k] VertexTensor P a l i := BalancedTensor.mk k (B ⊗[k] ChainAlgebra k l) + (IdempotentTensor.rightIdeal (TensorIdeal.vertex (k := k) (B := B) (ChainAlgebra.vertex k l i))) + (BimoduleO P a l) + +@[simp] theorem action_tmul_mk (b : B) (r : Bᵐᵒᵖ) + (m : IdempotentTensor.rightIdeal (TensorIdeal.vertex (k := k) (B := B) (ChainAlgebra.vertex k l i))) + (v : BimoduleO P a l) : + (b ⊗ₜ[k] r) • mk P a l i m v = mk P a l i (b • m) (r • v) := rfl + +local instance termScalar (n : ℤ) : Module k (P.X n) := Module.compHom _ (algebraMap k (Enveloping k B)) +local instance termTower (n : ℤ) : IsScalarTower k (Enveloping k B) (P.X n) := + IsScalarTower.of_compHom k (Enveloping k B) (P.X n) + +/-- Evaluation of the actual BC-balanced tensor. -/ +def evaluation : VertexTensor P a l i ≃ₗ[k] P.X (a+(i.val:ℤ)) := + BimoduleO.tensorVertexEquiv P a l i + +@[simp] theorem evaluation_mk + (m : IdempotentTensor.rightIdeal (TensorIdeal.vertex (k := k) (B := B) (ChainAlgebra.vertex k l i))) + (v : BimoduleO P a l) : + evaluation P a l i (mk P a l i m v) = (m.val • v : BimoduleO P a l) i := rfl + +/-- The original enveloping-algebra action is the two original B-actions. -/ +theorem enveloping_smul (b : B) (r : Bᵐᵒᵖ) (v : BimoduleO P a l) : + (b ⊗ₜ[k] r : Enveloping k B) • v = b • (r • v) := by + change (b ⊗ₜ[k] r : Enveloping k B) • (v : Compression P a l) = + (b ⊗ₜ[k] (1:Bᵐᵒᵖ)) • (((1:B) ⊗ₜ[k] r) • (v : Compression P a l)) + rw [← mul_smul] + simp only [Algebra.TensorProduct.tmul_mul_tmul,mul_one,one_mul] + +theorem evaluation_tmul_smul (b : B) (r : Bᵐᵒᵖ) (z : VertexTensor P a l i) : + evaluation P a l i ((b ⊗ₜ[k] r) • z) = + (b ⊗ₜ[k] r : Enveloping k B) • (evaluation P a l i z : P.X (a+(i.val:ℤ))) := by + have h : (evaluation P a l i).toLinearMap.comp (action P a l i (b ⊗ₜ[k] r)) = + (Algebra.lsmul k k (P.X (a+(i.val:ℤ))) (b ⊗ₜ[k] r : Enveloping k B)).comp + (evaluation P a l i).toLinearMap := by + apply BalancedTensor.ext + intro m v + change evaluation P a l i ((b ⊗ₜ[k] r) • mk P a l i m v) = + (b ⊗ₜ[k] r : Enveloping k B) • evaluation P a l i (mk P a l i m v) + rw [action_tmul_mk, evaluation_mk, evaluation_mk] + change (((TensorIdeal.coefficient b * m.val) • (r • v)) : BimoduleO P a l) i = _ + have hv : (TensorIdeal.coefficient b * m.val) • (r • v) = + (b ⊗ₜ[k] r : Enveloping k B) • (m.val • v) := by + rw [mul_smul, smul_comm m.val r] + change (b ⊗ₜ[k] (1:ChainAlgebra k l)) • (r • (m.val • v)) = _ + rw [BimoduleO.tensor_smul, one_smul, ← enveloping_smul] + exact congrArg (fun w : BimoduleO P a l => w i) hv + exact congrArg (fun f => f z) h + +theorem evaluation_smul (x : Enveloping k B) (z : VertexTensor P a l i) : + evaluation P a l i (x • z) = x • (evaluation P a l i z : P.X (a+(i.val:ℤ))) := by + induction x using TensorProduct.inductionOn with + | tmul b r => exact evaluation_tmul_smul P a l i b r z + | add x y hx hy => simp only [add_smul,map_add,hx,hy] + +/-- Degreewise comparison as a genuine B-bimodule equivalence. -/ +def bimoduleEquiv : VertexTensor P a l i ≃ₗ[Enveloping k B] P.X (a+(i.val:ℤ)) where + __ := (evaluation P a l i).toAddEquiv + map_smul' x z := evaluation_smul P a l i x z +end VertexTensor +end LittleFinitistic.OrdinarySimulation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorBimoduleResolution.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorBimoduleResolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..eb8d279ece8e4aa0cdec5411a455ce2920ed3da0 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorBimoduleResolution.lean @@ -0,0 +1,81 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryRetainedBimodule +import OAI.Algebra.Finitistic.Ordinary.OrdinaryIntegerResolution +import OAI.Algebra.Finitistic.Ordinary.OrdinaryFunctorExtension + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation.TensorResolution +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] (l : ℕ) + +abbrev bimoduleTerm (n : ℕ) := RetainedBimodule k B (B ⊗[k] ChainAlgebra k l) (term k B l n) + +def bimoduleDifferential (n : ℕ) := + RetainedBimodule.map (k := k) (S := B) (A := B ⊗[k] ChainAlgebra k l) (differential k B l n) (differential_left k B l n) + +theorem bimoduleDifferential_square (n : ℕ) : + (bimoduleDifferential k B l (n+1)).comp (bimoduleDifferential k B l n) = 0 := by + apply LinearMap.ext + intro x + exact congrArg (fun f => f x) (differential_square k B l n) + +/-- The actual finite resolution retains the left B-action as a genuine tensor-algebra complex. -/ +def bimoduleComplex : CochainComplex (ModuleCat.{u} (B ⊗[k] (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ)) ℕ := + CochainComplex.of (fun n => ModuleCat.of _ (bimoduleTerm k B l n)) + (fun n => ModuleCat.ofHom (bimoduleDifferential k B l n)) + (fun n => ModuleCat.hom_ext (bimoduleDifferential_square k B l n)) + +/-- The genuine bimodule resolution in exactly the source interval [-l,0]. -/ +def integerBimoduleComplex : CochainComplex (ModuleCat.{u} (B ⊗[k] (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ)) ℤ := + (bimoduleComplex k B l).extend (degreeEmbedding l) + +abbrev forgetBimodule : ModuleCat.{u} (B ⊗[k] (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ) ⥤ + ModuleCat.{u} (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ := + ModuleCat.restrictScalars + (Algebra.TensorProduct.includeRight (R := k) (A := B) (B := (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ)).toRingHom + +def forgetBimoduleTerm (n : ℕ) : + (forgetBimodule k B l).obj (ModuleCat.of _ (bimoduleTerm k B l n)) ≅ termObject k B l n := by + let e : (forgetBimodule k B l).obj (ModuleCat.of _ (bimoduleTerm k B l n)) ≃ₗ[(B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ] + term k B l n := + { toFun := fun x => x + invFun := fun x => x + left_inv := fun _ => rfl + right_inv := fun _ => rfl + map_add' := fun _ _ => rfl + map_smul' := fun r x => by + apply Subtype.ext + change TensorIdeal.coefficient (1:B) * (x.val * r.unop) = x.val * r.unop + rw [map_one,one_mul] } + exact e.toModuleIso + +/-- Forgetting the retained left action recovers the verified ordinary finite resolution. -/ +def forgetBimoduleComplex : + ((forgetBimodule k B l).mapHomologicalComplex (.up ℕ)).obj (bimoduleComplex k B l) ≅ complex k B l := + HomologicalComplex.Hom.isoOfComponents (forgetBimoduleTerm k B l) (by + intro n m h + change n+1=m at h + subst m + change (forgetBimoduleTerm k B l n).hom ≫ (complex k B l).d n (n+1) = + (forgetBimodule k B l).map ((bimoduleComplex k B l).d n (n+1)) ≫ (forgetBimoduleTerm k B l (n+1)).hom + have h₁ : (complex k B l).d n (n+1) = ModuleCat.ofHom (differential k B l n) := + CochainComplex.of_d (termObject k B l) (fun n => ModuleCat.ofHom (differential k B l n)) n + have h₂ : (bimoduleComplex k B l).d n (n+1) = ModuleCat.ofHom (bimoduleDifferential k B l n) := + CochainComplex.of_d (fun n => ModuleCat.of (B ⊗[k] (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ) (bimoduleTerm k B l n)) + (fun n => ModuleCat.ofHom (bimoduleDifferential k B l n)) n + rw [h₁,h₂] + rfl) + +/-- Every integer term and differential agrees after forgetting the left action. -/ +def forgetIntegerBimoduleComplex : + ((forgetBimodule k B l).mapHomologicalComplex (.up ℤ)).obj (integerBimoduleComplex k B l) ≅ + integerComplex k B l := + FunctorExtension.iso (forgetBimodule k B l) (bimoduleComplex k B l) (degreeEmbedding l) ≪≫ + ((degreeEmbedding l).extendFunctor _).mapIso (forgetBimoduleComplex k B l) +end LittleFinitistic.OrdinarySimulation.TensorResolution + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorColumnAcyclic.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorColumnAcyclic.lean new file mode 100644 index 0000000000000000000000000000000000000000..00313d54a2413114f91cc04d2ec3a271efbcc8d1 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorColumnAcyclic.lean @@ -0,0 +1,52 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryComplexTensorMaps +import OAI.Algebra.Finitistic.Ordinary.OrdinarySignedExactness + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.ComplexTensor +open BalancedTensor +universe u +variable (k A : Type u) [Field k] [Ring A] [Algebra k A] +variable (Q : CochainComplex (ModuleCat.{u} Aᵐᵒᵖ) ℤ) +variable (Z : CochainComplex (ModuleCat.{u} A) ℤ) + +@[simp] theorem map_id_left {p q q' : ℤ} (g : Z.X q ⟶ Z.X q') : + map k A Q Z (𝟙 (Q.X p)) g = + @mapRightTo k A (rightTerm k A Q p) (leftTerm k A Z q) (leftTerm k A Z q') + _ _ _ _ _ _ _ _ _ (scalarLeftTower k A (Z.X q)) + _ _ _ (scalarLeftTower k A (Z.X q')) g.hom := by + apply BalancedTensor.ext + intro x y + rfl + +/-- A signed tensor column for an actual projective right term preserves acyclicity. -/ +theorem column_acyclic (p : ℤ) [Module.Projective Aᵐᵒᵖ (rightTerm k A Q p)] + (hZ : Z.Acyclic) : (column k A Q Z p).Acyclic := by + intro n + have hh := (HomologicalComplex.exactAt_iff' Z ((n-1) + -p) (n + -p) ((n+1) + -p) + (by simp; omega) + (by simp; omega)).mp (hZ (n + -p)) + have hex : Function.Exact + ((Z.d ((n-1) + -p) (n + -p)).hom : leftTerm k A Z ((n-1) + -p) →ₗ[A] leftTerm k A Z (n + -p)) + ((Z.d (n + -p) ((n+1) + -p)).hom : leftTerm k A Z (n + -p) →ₗ[A] leftTerm k A Z ((n+1) + -p)) := + (ShortComplex.ShortExact.moduleCat_exact_iff_function_exact _).mp hh + have ht := @projectiveTensor_exact k A (rightTerm k A Q p) _ _ _ _ _ _ _ + (leftTerm k A Z ((n-1) + -p)) (leftTerm k A Z (n + -p)) (leftTerm k A Z ((n+1) + -p)) + _ _ _ (scalarLeftTower k A (Z.X ((n-1) + -p))) + _ _ _ (scalarLeftTower k A (Z.X (n + -p))) + _ _ _ (scalarLeftTower k A (Z.X ((n+1) + -p))) _ + (Z.d ((n-1) + -p) (n + -p)).hom (Z.d (n + -p) ((n+1) + -p)).hom hex + have hs := exact_units_smul (-p).negOnePow _ _ ht + apply (HomologicalComplex.exactAt_iff' _ (n-1) n (n+1) (by simp) (by simp)).2 + rw [ShortComplex.moduleCat_exact_iff] + change ∀ (z : term k A Q Z p (n + -p)), + ((column k A Q Z p).d n (n+1)).hom z = 0 → + ∃ w : term k A Q Z p ((n-1) + -p), ((column k A Q Z p).d (n-1) n).hom w = z + simp only [column_d,map_id_left] + exact fun z hz => (hs z).mp hz +end LittleFinitistic.ComplexTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorDerivedFunctor.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorDerivedFunctor.lean new file mode 100644 index 0000000000000000000000000000000000000000..9d2045d863d4a044487aa30570302c602ccb7984 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorDerivedFunctor.lean @@ -0,0 +1,39 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorTotalQuasiIso +import Mathlib.Algebra.Homology.DerivedCategory.Basic + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.ComplexTensor +universe u +variable (k A : Type u) [Field k] [Ring A] [Algebra k A] +variable (Q : CochainComplex (ModuleCat.{u} Aᵐᵒᵖ) ℤ) +variable {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} A)] +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} k)] +variable [∀ i, Module.Projective Aᵐᵒᵖ (rightTerm k A Q (p i))] + +omit [HasDerivedCategory.{u+1} (ModuleCat.{u} A)] in +/-- The proved actual total functor sends every quasi-isomorphism to an isomorphism after localization. -/ +theorem finiteTotal_inverts : (HomologicalComplex.quasiIso (ModuleCat.{u} A) (.up ℤ)).IsInvertedBy + (finiteTotalFunctor k A Q p hp ⋙ DerivedCategory.Q) := by + intro Z Z' f hf + let : QuasiIso f := hf + let := finiteTotalMap_quasiIso k A Q f p hp + exact (inferInstance : IsIso (DerivedCategory.Q.map (finiteTotalMap k A Q p hp f))) + +/-- Localization of the actual signed total tensor functor, justified by the proved preservation theorem. -/ +def derivedFiniteTotal : DerivedCategory (ModuleCat.{u} A) ⥤ DerivedCategory (ModuleCat.{u} k) := + Localization.lift (finiteTotalFunctor k A Q p hp ⋙ DerivedCategory.Q) + (finiteTotal_inverts k A Q p hp) DerivedCategory.Q + +/-- The explicit natural comparison with the actual chain-level total on every input complex. -/ +def derivedFiniteTotalComparison : + DerivedCategory.Q ⋙ derivedFiniteTotal k A Q p hp ≅ finiteTotalFunctor k A Q p hp ⋙ DerivedCategory.Q := + Localization.fac (finiteTotalFunctor k A Q p hp ⋙ DerivedCategory.Q) + (finiteTotal_inverts k A Q p hp) DerivedCategory.Q +end LittleFinitistic.ComplexTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorDifferential.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorDifferential.lean new file mode 100644 index 0000000000000000000000000000000000000000..8754fb127ef09ea1e516e004dd6550de0ce4b576 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorDifferential.lean @@ -0,0 +1,82 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorBimoduleComparison + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +variable (P : CochainComplex (ModuleCat.{u} (Enveloping k B)) ℤ) (a : ℤ) (l : ℕ) +namespace VertexTensor + +attribute [local instance] termScalar termTower + +/-- The actual arrow between BC vertex projectives. -/ +def arrowMap (i : Fin l) : + IdempotentTensor.rightIdeal (TensorIdeal.vertex (k := k) (B := B) (ChainAlgebra.vertex k l i.castSucc)) →ₗ[(B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ] + IdempotentTensor.rightIdeal (TensorIdeal.vertex (k := k) (B := B) (ChainAlgebra.vertex k l i.succ)) where + toFun x := ⟨((1:B) ⊗ₜ[k] ChainAlgebra.arrow k l i) * x.val, by + change ((1:B) ⊗ₜ[k] ChainAlgebra.vertex k l i.succ) * + (((1:B) ⊗ₜ[k] ChainAlgebra.arrow k l i) * x.val) = _ + rw [← mul_assoc,Algebra.TensorProduct.tmul_mul_tmul,one_mul,ChainAlgebra.vertex_target_arrow]⟩ + map_add' x y := Subtype.ext (mul_add _ _ _) + map_smul' r x := Subtype.ext (mul_assoc _ _ r.unop).symm + +/-- Tensor the actual arrow with O; no differential is assumed. -/ +def rawDifferential (i : Fin l) : VertexTensor P a l i.castSucc →ₗ[k] VertexTensor P a l i.succ := + BalancedTensor.mapLeft (BimoduleO P a l) (arrowMap (k := k) (B := B) l i) + +theorem arrow_coordinate (i : Fin l) (v : BimoduleO P a l) : + (ChainAlgebra.arrow k l i • v : BimoduleO P a l) i.succ = + (P.d (a+(i.castSucc.val:ℤ)) (a+(i.succ.val:ℤ))).hom (v i.castSucc) := by + have h := OrdinaryTerms.action_arrow + (intervalTerms (underlyingComplex (k := k) P) a l) + (intervalDifferential (underlyingComplex (k := k) P) a l) i v + have h' := congrArg (fun w => w i.succ) h + change OrdinaryTerms.action (intervalTerms (underlyingComplex (k := k) P) a l) + (intervalDifferential (underlyingComplex (k := k) P) a l) (ChainAlgebra.arrow k l i) v i.succ = + intervalDifferential (underlyingComplex (k := k) P) a l i.castSucc i.succ (v i.castSucc) + simpa only [Pi.single_eq_same] using h' + +/-- Evaluation identifies the computed arrow differential with the genuine d_P. -/ +theorem evaluation_differential (i : Fin l) (z : VertexTensor P a l i.castSucc) : + evaluation P a l i.succ (rawDifferential P a l i z) = + (P.d (a+(i.castSucc.val:ℤ)) (a+(i.succ.val:ℤ))).hom (evaluation P a l i.castSucc z) := by + have h : (evaluation P a l i.succ).toLinearMap.comp (rawDifferential P a l i) = + ((P.d (a+(i.castSucc.val:ℤ)) (a+(i.succ.val:ℤ))).hom.restrictScalars k).comp + (evaluation P a l i.castSucc).toLinearMap := by + apply BalancedTensor.ext + intro m v + change ((((1:B) ⊗ₜ[k] ChainAlgebra.arrow k l i) * m.val) • v : BimoduleO P a l) i.succ = + (P.d (a+(i.castSucc.val:ℤ)) (a+(i.succ.val:ℤ))).hom ((m.val • v : BimoduleO P a l) i.castSucc) + have h : (((1:B) ⊗ₜ[k] ChainAlgebra.arrow k l i) * m.val) • v = + ChainAlgebra.arrow k l i • (m.val • v) := by + rw [mul_smul, BimoduleO.tensor_smul, one_smul] + exact (congrArg (fun w : BimoduleO P a l => w i.succ) h).trans + (arrow_coordinate P a l i (m.val • v)) + exact congrArg (fun f => f z) h + +/-- The actual tensor differential retains both B-actions. -/ +def differential (i : Fin l) : VertexTensor P a l i.castSucc →ₗ[Enveloping k B] VertexTensor P a l i.succ where + __ := (rawDifferential P a l i).toAddHom + map_smul' r z := by + apply (evaluation P a l i.succ).injective + change evaluation P a l i.succ (rawDifferential P a l i (r • z)) = + evaluation P a l i.succ (r • rawDifferential P a l i z) + rw [evaluation_differential, evaluation_smul, evaluation_smul, evaluation_differential] + exact (P.d _ _).hom.map_smul r _ + +/-- Equality of bimodule maps, with the source's actual differential. -/ +theorem bimodule_differential_comparison (i : Fin l) : + (bimoduleEquiv P a l i.succ).toLinearMap.comp (differential P a l i) = + (P.d (a+(i.castSucc.val:ℤ)) (a+(i.succ.val:ℤ))).hom.comp + (bimoduleEquiv P a l i.castSucc).toLinearMap := by + ext z + exact evaluation_differential P a l i z +end VertexTensor +end LittleFinitistic.OrdinarySimulation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorDirected.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorDirected.lean new file mode 100644 index 0000000000000000000000000000000000000000..456f5625300d550289c136035320d70d53c9ab7d --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorDirected.lean @@ -0,0 +1,94 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryChainDirected +import Mathlib.Logic.Equiv.Fin.Basic + +namespace OAI +noncomputable section +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation.TensorDirected +universe u +variable {k B C : Type u} [Field k] [Ring B] [Ring C] [Algebra k B] [Algebra k C] +variable {n : ℕ} (DB : DirectedBound.DirectedSystem k B 3) (DC : DirectedBound.DirectedSystem k C n) + +def bIndex (i : Fin (n*3)) : Fin 3 := (finProdFinEquiv.symm i).2 +def cIndex (i : Fin (n*3)) : Fin n := (finProdFinEquiv.symm i).1 + +theorem index_value (i : Fin (n*3)) : (bIndex i).val + 3 * (cIndex i).val = i.val := + congrArg Fin.val (finProdFinEquiv.apply_symm_apply i) + +def vertex (i : Fin (n*3)) : B ⊗[k] C := DB.e (bIndex i) ⊗ₜ[k] DC.e (cIndex i) + +theorem vertex_idempotent (i : Fin (n*3)) : vertex DB DC i * vertex DB DC i = vertex DB DC i := by + simp only [vertex,Algebra.TensorProduct.tmul_mul_tmul,DB.idem,DC.idem] + +theorem vertex_orthogonal (i j : Fin (n*3)) (hij : i ≠ j) : vertex DB DC i * vertex DB DC j = 0 := by + simp only [vertex,Algebra.TensorProduct.tmul_mul_tmul] + by_cases hb : bIndex i = bIndex j + · have hc : cIndex i ≠ cIndex j := by + intro h + apply hij + apply Fin.ext + have hi := index_value i + have hj := index_value j + rw [hb,h] at hi + omega + rw [DC.orthogonal _ _ hc,TensorProduct.tmul_zero] + · rw [DB.orthogonal _ _ hb,TensorProduct.zero_tmul] + +theorem vertex_complete : ∑ i : Fin (n*3), vertex DB DC i = 1 := by + have h := Equiv.sum_comp (finProdFinEquiv : Fin n × Fin 3 ≃ Fin (n*3)) (vertex DB DC) + rw [← h] + simp only [vertex,bIndex,cIndex,Equiv.symm_apply_apply,Fintype.sum_prod_type] + have ht (x : Fin n) : (∑ j : Fin 3, DB.e j ⊗ₜ[k] DC.e x) = (1:B) ⊗ₜ[k] DC.e x := by + rw [← TensorProduct.sum_tmul,DB.complete] + simp_rw [ht] + rw [← TensorProduct.tmul_sum,DC.complete] + rfl + +theorem vertex_diagonal (i : Fin (n*3)) (x : B ⊗[k] C) : + ∃ r : k, vertex DB DC i * x * vertex DB DC i = r • vertex DB DC i := by + induction x using TensorProduct.inductionOn with + | tmul b c => + obtain ⟨r,hr⟩ := DB.diagonal (bIndex i) b + obtain ⟨s,hs⟩ := DC.diagonal (cIndex i) c + refine ⟨r*s,?_⟩ + simp only [vertex,Algebra.TensorProduct.tmul_mul_tmul,hr,hs, + TensorProduct.smul_tmul,TensorProduct.tmul_smul,smul_smul,mul_comm s r] + | add x y hx hy => + obtain ⟨r,hr⟩ := hx + obtain ⟨s,hs⟩ := hy + exact ⟨r+s,by rw [mul_add,add_mul,hr,hs,add_smul]⟩ + +theorem vertex_directed (i j : Fin (n*3)) (hij : j < i) (x : B ⊗[k] C) : + vertex DB DC j * x * vertex DB DC i = 0 := by + have hi := index_value i + have hj := index_value j + have hbi := (bIndex i).isLt + have hbj := (bIndex j).isLt + change j.val < i.val at hij + have hc : cIndex j < cIndex i ∨ (cIndex j = cIndex i ∧ bIndex j < bIndex i) := by + by_cases h : cIndex j < cIndex i + · exact Or.inl h + · right + have he : cIndex j = cIndex i := Fin.ext (by change ¬(cIndex j).val < (cIndex i).val at h; omega) + exact ⟨he,by change (bIndex j).val < (bIndex i).val; rw [he] at hj; omega⟩ + induction x using TensorProduct.inductionOn with + | tmul b c => + simp only [vertex,Algebra.TensorProduct.tmul_mul_tmul] + rcases hc with h | ⟨h,hb⟩ + · rw [DC.directed _ _ h,TensorProduct.tmul_zero] + · rw [DB.directed _ _ hb,TensorProduct.zero_tmul] + | add x y hx hy => rw [mul_add,add_mul,hx,hy,add_zero] + +/-- A concrete linear extension of the source's product order, with exactly 3n vertices. -/ +def directedSystem : DirectedBound.DirectedSystem k (B ⊗[k] C) (n*3) where + e := vertex DB DC + idem := vertex_idempotent DB DC + orthogonal := vertex_orthogonal DB DC + complete := vertex_complete DB DC + diagonal := vertex_diagonal DB DC + directed := vertex_directed DB DC +end LittleFinitistic.OrdinarySimulation.TensorDirected + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorExactness.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorExactness.lean new file mode 100644 index 0000000000000000000000000000000000000000..728dee06a1bd1d4f4bae12ae97cda744b79702de --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorExactness.lean @@ -0,0 +1,98 @@ +import OAI.Algebra.Finitistic.Tensor.IdempotentTensor +import Mathlib.Algebra.Exact.Basic + +namespace OAI +noncomputable section +namespace LittleFinitistic +namespace BalancedTensor +universe u +variable {k A M N N' N'' : Type u} [Field k] [Ring A] [Algebra k A] +variable [AddCommGroup M] [Module k M] [Module Aᵐᵒᵖ M] +variable [AddCommGroup N] [Module k N] [Module A N] [IsScalarTower k A N] +variable [AddCommGroup N'] [Module k N'] [Module A N'] [IsScalarTower k A N'] +variable [AddCommGroup N''] [Module k N''] [Module A N''] [IsScalarTower k A N''] + +/-- The actual covariant map in the left-module factor of a balanced tensor. -/ +def mapRightTo (f : N →ₗ[A] N') : Tensor k A M N →ₗ[k] Tensor k A M N' := + lift ((mk k A M N').compl₁₂ LinearMap.id (f.restrictScalars k)) (by + intro a m n + change mk k A M N' (MulOpposite.op a • m) (f n) = mk k A M N' m (f (a • n)) + rw [f.map_smul,balance]) + +@[simp] theorem mapRightTo_mk (f : N →ₗ[A] N') (m : M) (n : N) : + mapRightTo (k := k) (M := M) f (mk k A M N m n) = mk k A M N' m (f n) := rfl + +end BalancedTensor + +namespace IdempotentTensor +universe u +variable {k A N N' N'' : Type u} [Field k] [Ring A] [Algebra k A] +variable [AddCommGroup N] [Module k N] [Module A N] [IsScalarTower k A N] +variable [AddCommGroup N'] [Module k N'] [Module A N'] [IsScalarTower k A N'] +variable [AddCommGroup N''] [Module k N''] [Module A N''] [IsScalarTower k A N''] +variable (e : A) + +def spaceMap (f : N →ₗ[A] N') : leftSpace (k := k) e N →ₗ[k] leftSpace (k := k) e N' where + toFun x := ⟨f x.val, by + change e • f x.val = f x.val + rw [← f.map_smul,x.property]⟩ + map_add' x y := Subtype.ext (f.map_add x.val y.val) + map_smul' r x := Subtype.ext ((f.restrictScalars k).map_smul r x.val) + +theorem tensorEval_naturality (f : N →ₗ[A] N') (z : BalancedTensor.Tensor k A (rightIdeal e) N) : + tensorEval (k := k) e N' (BalancedTensor.mapRightTo f z) = + spaceMap (k := k) e f (tensorEval (k := k) e N z) := by + induction z using BalancedTensor.induction_on with + | hz => simp only [map_zero] + | ht m n => + apply Subtype.ext + exact (f.map_smul m.val n).symm + | ha x y hx hy => simp only [map_add,hx,hy] + +/-- Taking an idempotent part preserves exactness, with an explicit projected preimage. -/ +theorem spaceMap_exact (he : e*e=e) (f : N →ₗ[A] N') (g : N' →ₗ[A] N'') + (h : Function.Exact f g) : Function.Exact (spaceMap (k := k) e f) (spaceMap (k := k) e g) := by + intro x + constructor + · intro hx + have hx' : g x.val = 0 := congrArg Subtype.val hx + obtain ⟨y,hy⟩ := (h x.val).mp hx' + refine ⟨⟨e • y, by change e • (e • y) = e • y; rw [← mul_smul,he]⟩, ?_⟩ + apply Subtype.ext + change f (e • y) = x.val + rw [f.map_smul,hy,x.property] + · rintro ⟨y,rfl⟩ + apply Subtype.ext + exact (h (f y.val)).mpr ⟨y.val,rfl⟩ + +/-- Tensor with the actual projective eA preserves every exact module sequence. -/ +theorem tensor_exact (he : e*e=e) (f : N →ₗ[A] N') (g : N' →ₗ[A] N'') + (h : Function.Exact f g) : + Function.Exact (BalancedTensor.mapRightTo (k := k) (M := rightIdeal e) f) + (BalancedTensor.mapRightTo (k := k) (M := rightIdeal e) g) := by + intro z + constructor + · intro hz + have hx : spaceMap (k := k) e g (tensorEquiv (k := k) e N' he z) = 0 := by + change spaceMap (k := k) e g (tensorEval (k := k) e N' z) = 0 + rw [← tensorEval_naturality,hz,map_zero] + obtain ⟨y,hy⟩ := (spaceMap_exact (k := k) e he f g h _).mp hx + refine ⟨(tensorEquiv (k := k) e N he).symm y, ?_⟩ + apply (tensorEquiv (k := k) e N' he).injective + change tensorEval (k := k) e N' (BalancedTensor.mapRightTo f ((tensorEquiv (k := k) e N he).symm y)) = + tensorEquiv (k := k) e N' he z + rw [tensorEval_naturality] + change spaceMap (k := k) e f ((tensorEquiv (k := k) e N he) ((tensorEquiv (k := k) e N he).symm y)) = _ + rw [LinearEquiv.apply_symm_apply,hy] + · rintro ⟨y,rfl⟩ + induction y using BalancedTensor.induction_on with + | hz => simp only [map_zero] + | ht m n => + rw [BalancedTensor.mapRightTo_mk,BalancedTensor.mapRightTo_mk,(h (f n)).mpr ⟨n,rfl⟩,map_zero] + | ha x y hx hy => simp only [map_add,hx,hy,add_zero] +end IdempotentTensor +end LittleFinitistic + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorFiniteMatrix.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorFiniteMatrix.lean new file mode 100644 index 0000000000000000000000000000000000000000..8decea0fc4f1ed2e7aaad012daed2448adc9d3b7 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorFiniteMatrix.lean @@ -0,0 +1,108 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorMixedSign +import OAI.Algebra.Finitistic.Ordinary.OrdinaryFiniteTotal + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.ComplexTensor +universe u +variable (k A : Type u) [Field k] [Ring A] [Algebra k A] +variable (Q : CochainComplex (ModuleCat.{u} Aᵐᵒᵖ) ℤ) +variable (Z : CochainComplex (ModuleCat.{u} A) ℤ) +variable {l : ℕ} (p : Fin l → ℤ) + +abbrev columns := fun i : Fin l => column k A Q Z (p i) + +/-- The actual horizontal matrix entry, zero unless the right degrees are consecutive. -/ +def entry (n : ℤ) (i j : Fin l) : + term k A Q Z (p i) (n + -(p i)) →ₗ[k] term k A Q Z (p j) ((n+1) + -(p j)) := + if h : p i + 1 = p j then horizontal k A Q Z n (p i) (p j) h else 0 + +theorem entry_square (n : ℤ) (i j t : Fin l) : + (entry k A Q Z p (n+1) j t).comp (entry k A Q Z p n i j) = 0 := by + unfold entry + split_ifs with h₁ h₂ h₂ + · exact horizontal_square k A Q Z n (p i) (p j) (p t) h₂ h₁ + · simp only [LinearMap.comp_zero] + · simp only [LinearMap.zero_comp] + · simp only [LinearMap.zero_comp] + +theorem entry_mixed (n : ℤ) (i j : Fin l) : + (vertical k A Q Z (n+1) (p j)).comp (entry k A Q Z p n i j) + + (entry k A Q Z p (n+1) i j).comp (vertical k A Q Z n (p i)) = 0 := by + unfold entry + split_ifs with h + · exact horizontal_mixed k A Q Z n (p i) (p j) h + · simp only [LinearMap.comp_zero,LinearMap.zero_comp,add_zero] + +/-- The actual finite horizontal tensor differential, on the sum of all selected columns. -/ +def matrix (n : ℤ) : FiniteColumnComplex.term (columns k A Q Z p) n →ₗ[k] + FiniteColumnComplex.term (columns k A Q Z p) (n+1) := + LinearMap.pi (fun j => ∑ i : Fin l, (entry k A Q Z p n i j).comp (LinearMap.proj i)) + +@[simp] theorem matrix_apply (n : ℤ) + (z : FiniteColumnComplex.term (columns k A Q Z p) n) (j : Fin l) : + matrix k A Q Z p n z j = ∑ i : Fin l, entry k A Q Z p n i j (z i) := by + change ((∑ i : Fin l, (entry k A Q Z p n i j).comp + (LinearMap.proj i) : (∀ t : Fin l, term k A Q Z (p t) (n + -(p t))) →ₗ[k] + term k A Q Z (p j) ((n+1) + -(p j))) z) = _ + exact LinearMap.sum_apply _ _ _ + +theorem matrix_square (n : ℤ) : + (matrix k A Q Z p (n+1)).comp (matrix k A Q Z p n) = 0 := by + apply LinearMap.ext + intro z + funext j + change matrix k A Q Z p (n+1) (matrix k A Q Z p n z) j = 0 + simp only [matrix_apply,map_sum] + apply Finset.sum_eq_zero + intro i _ + apply Finset.sum_eq_zero + intro t _ + exact congrArg (fun f => f (z t)) (entry_square k A Q Z p n t i j) + +theorem matrix_mixed (n : ℤ) : + (FiniteColumnComplex.diagonal (columns k A Q Z p) (n+1)).comp (matrix k A Q Z p n) + + (matrix k A Q Z p (n+1)).comp (FiniteColumnComplex.diagonal (columns k A Q Z p) n) = 0 := by + apply LinearMap.ext + intro z + funext j + change ((column k A Q Z (p j)).d (n+1) ((n+1)+1)).hom (matrix k A Q Z p n z j) + + matrix k A Q Z p (n+1) (FiniteColumnComplex.diagonal (columns k A Q Z p) n z) j = 0 + simp only [matrix_apply,FiniteColumnComplex.diagonal_apply] + erw [map_sum, ← Finset.sum_add_distrib] + apply Finset.sum_eq_zero + intro i _ + have h := congrArg (fun f => f (z i)) (entry_mixed k A Q Z p n i j) + simp only [vertical] at h + simp only [column_d] + exact h + +theorem matrix_upper (hp : StrictMono p) (n : ℤ) (j : Fin l) + (z : FiniteColumnComplex.term (columns k A Q Z p) n) + (hz : ∀ i : Fin l, i.val < j.val → z i = 0) : matrix k A Q Z p n z j = 0 := by + rw [matrix_apply] + apply Finset.sum_eq_zero + intro i _ + unfold entry + split_ifs with h + · have hij : i < j := hp.lt_iff_lt.mp (by omega) + erw [hz i hij,map_zero] + rfl + · rfl + +/-- Actual tensor horizontal maps satisfy every requirement of the finite total construction. -/ +def tensorHorizontal (hp : StrictMono p) : FiniteColumnComplex.Horizontal (columns k A Q Z p) where + d := matrix k A Q Z p + square := matrix_square k A Q Z p + mixed := matrix_mixed k A Q Z p + strictUpper := matrix_upper k A Q Z p hp + +/-- The signed total tensor complex on a finite interval of the right complex. -/ +def finiteTotal (hp : StrictMono p) : CochainComplex (ModuleCat.{u} k) ℤ := + FiniteColumnComplex.total (columns k A Q Z p) (tensorHorizontal k A Q Z p hp) +end LittleFinitistic.ComplexTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorGlobalDimension.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorGlobalDimension.lean new file mode 100644 index 0000000000000000000000000000000000000000..0621fb78f7bf57f6d9f41cfcf63352ea63875ec1 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorGlobalDimension.lean @@ -0,0 +1,42 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorDirected +import OAI.Algebra.Finitistic.Encoding.ThreeVertexAlgebra + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation +universe u v +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] + +/-- The source tensor algebra bound uses exactly 3(l+1) directed vertices, on both sides. -/ +theorem tensor_globalDimension_bound (DB : DirectedBound.DirectedSystem k B 3) (l : ℕ) : + (⨆ M : ModuleCat.{max u v} (B ⊗[k] ChainAlgebra k l), projectiveDimension M) ≤ (3*l+2 : ℕ) ∧ + (⨆ M : ModuleCat.{max u v} (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ, projectiveDimension M) ≤ (3*l+2 : ℕ) := by + have h := DirectedBound.DirectedSystem.both_sides_globalDimension_le.{u,v} + (TensorDirected.directedSystem DB (ChainAlgebra.directedSystem k l)) + have hn : (l+1)*3-1 = 3*l+2 := by omega + simpa only [hn] using h + +/-- The corresponding bound holds for each arbitrary left or right module. -/ +theorem tensor_projectiveDimension_bound (DB : DirectedBound.DirectedSystem k B 3) (l : ℕ) : + (∀ M : ModuleCat.{max u v} (B ⊗[k] ChainAlgebra k l), projectiveDimension M ≤ (3*l+2 : ℕ)) ∧ + (∀ M : ModuleCat.{max u v} (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ, projectiveDimension M ≤ (3*l+2 : ℕ)) := by + have h := DirectedBound.DirectedSystem.both_sides_projectiveDimension_le.{u,v} + (TensorDirected.directedSystem DB (ChainAlgebra.directedSystem k l)) + have hn : (l+1)*3-1 = 3*l+2 := by omega + simpa only [hn] using h + +variable {V W U : Type u} [AddCommGroup V] [Module k V] [AddCommGroup W] [Module k W] + [AddCommGroup U] [Module k U] + +/-- The bound for the actual three-vertex coefficient algebra used by the manuscript. -/ +theorem source_tensor_globalDimension_bound (μ : W →ₗ[k] V →ₗ[k] U) (l : ℕ) : + (⨆ M : ModuleCat.{max u v} (ThreeVertexAlgebra μ ⊗[k] ChainAlgebra k l), projectiveDimension M) ≤ (3*l+2 : ℕ) ∧ + (⨆ M : ModuleCat.{max u v} (ThreeVertexAlgebra μ ⊗[k] ChainAlgebra k l)ᵐᵒᵖ, projectiveDimension M) ≤ (3*l+2 : ℕ) := + tensor_globalDimension_bound (ThreeVertexAlgebra.directedSystem μ) l +end LittleFinitistic.OrdinarySimulation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorIdeal.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorIdeal.lean new file mode 100644 index 0000000000000000000000000000000000000000..c9c36003bab9a9a2c2b164e381ee6a8569831421 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorIdeal.lean @@ -0,0 +1,68 @@ +import OAI.Algebra.Finitistic.Tensor.IdempotentTensor +import Mathlib.RingTheory.TensorProduct.Maps + +namespace OAI +noncomputable section +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation.TensorIdeal +universe u +variable {k B C : Type u} [Field k] [Ring B] [Ring C] [Algebra k B] [Algebra k C] +variable (e : C) (he : e*e=e) + +def vertex : B ⊗[k] C := (1:B) ⊗ₜ[k] e + +include he in +theorem vertex_idempotent : vertex (k := k) (B := B) e * vertex e = vertex e := by + simp only [vertex, Algebra.TensorProduct.tmul_mul_tmul, one_mul, he] + +def project : C →ₗ[k] IdempotentTensor.rightIdeal e where + toFun c := ⟨e*c, by change e*(e*c)=e*c; rw [← mul_assoc,he]⟩ + map_add' x y := Subtype.ext (mul_add e x y) + map_smul' r x := Subtype.ext (mul_smul_comm r e x) + +def inclusion : B ⊗[k] IdempotentTensor.rightIdeal e →ₗ[k] B ⊗[k] C := + TensorProduct.map (LinearMap.id) ((IdempotentTensor.rightIdeal e).subtype.restrictScalars k) + +def retraction : B ⊗[k] C →ₗ[k] B ⊗[k] IdempotentTensor.rightIdeal e := + TensorProduct.map (LinearMap.id) (project e he) + +theorem inclusion_retraction (z : B ⊗[k] C) : + inclusion e (retraction e he z) = vertex e * z := by + induction z using TensorProduct.inductionOn with + | tmul b c => + simp only [inclusion,retraction,TensorProduct.map_tmul,LinearMap.id_apply, + LinearMap.restrictScalars_apply,Submodule.subtype_apply,project,LinearMap.coe_mk, + AddHom.coe_mk,vertex,Algebra.TensorProduct.tmul_mul_tmul,one_mul] + | add x y hx hy => simp only [map_add,mul_add,hx,hy] + +theorem retraction_inclusion (z : B ⊗[k] IdempotentTensor.rightIdeal e) : + retraction e he (inclusion e z) = z := by + induction z using TensorProduct.inductionOn with + | tmul b c => + change b ⊗ₜ[k] (⟨e*c.val, _⟩ : IdempotentTensor.rightIdeal e) = b ⊗ₜ[k] c + congr 1 + exact Subtype.ext c.property + | add x y hx hy => simp only [map_add,hx,hy] + +include he in +theorem inclusion_fixed (z : B ⊗[k] IdempotentTensor.rightIdeal e) : + vertex e * inclusion e z = inclusion e z := by + rw [← inclusion_retraction e he, retraction_inclusion e he] + +/-- The source term B tensor eC is the actual right ideal (1 tensor e)(B tensor C). -/ +def equivalence : B ⊗[k] IdempotentTensor.rightIdeal e ≃ₗ[k] + IdempotentTensor.rightIdeal (vertex (k := k) (B := B) e) where + toFun z := ⟨inclusion e z, inclusion_fixed e he z⟩ + invFun z := retraction e he z.val + left_inv := retraction_inclusion e he + right_inv z := Subtype.ext ((inclusion_retraction e he z.val).trans z.property) + map_add' x y := Subtype.ext (map_add _ x y) + map_smul' r x := Subtype.ext (map_smul _ r x) + +@[simp] theorem equivalence_tmul (b : B) (c : IdempotentTensor.rightIdeal e) : + (equivalence (B := B) e he (b ⊗ₜ[k] c)).val = b ⊗ₜ[k] c.val := rfl +end LittleFinitistic.OrdinarySimulation.TensorIdeal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorIdealActions.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorIdealActions.lean new file mode 100644 index 0000000000000000000000000000000000000000..e84e81a2c4e7744db518b8356f85826a120cd3c6 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorIdealActions.lean @@ -0,0 +1,67 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorIdeal + +namespace OAI +noncomputable section +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation.TensorIdeal +universe u +variable {k B C : Type u} [Field k] [Ring B] [Ring C] [Algebra k B] [Algebra k C] +variable (e : C) + +abbrev coefficient : B →ₐ[k] B ⊗[k] C := Algebra.TensorProduct.includeLeft + +theorem coefficient_commute (b : B) : + vertex (k := k) e * coefficient b = coefficient b * vertex e := by + simp only [vertex,coefficient,Algebra.TensorProduct.includeLeft_apply, + Algebra.TensorProduct.tmul_mul_tmul,one_mul,mul_one] + +def leftMultiply (b : B) : IdempotentTensor.rightIdeal (vertex (k := k) (B := B) e) →ₗ[(B ⊗[k] C)ᵐᵒᵖ] + IdempotentTensor.rightIdeal (vertex (k := k) (B := B) e) where + toFun x := ⟨coefficient b * x.val, by + change vertex e * (coefficient b * x.val) = coefficient b * x.val + rw [← mul_assoc, coefficient_commute, mul_assoc, x.property]⟩ + map_add' x y := Subtype.ext (mul_add _ _ _) + map_smul' r x := Subtype.ext (mul_assoc _ _ r.unop).symm + +def leftAction : B →ₐ[k] Module.End (B ⊗[k] C)ᵐᵒᵖ + (IdempotentTensor.rightIdeal (vertex (k := k) (B := B) e)) where + toFun := leftMultiply e + map_one' := by ext x; exact one_mul x.val + map_mul' b c := by + ext x + change coefficient (b*c) * x.val = coefficient b * (coefficient c * x.val) + rw [map_mul,mul_assoc] + map_zero' := by + ext x + change coefficient (0:B) * x.val = 0 + rw [map_zero,zero_mul] + map_add' b c := by + ext x + change coefficient (b+c) * x.val = coefficient b * x.val + coefficient c * x.val + rw [map_add,add_mul] + commutes' r := by + ext x + change coefficient (algebraMap k B r) * x.val = r • x.val + rw [AlgHom.commutes, Algebra.smul_def] + +instance leftModule : Module B (IdempotentTensor.rightIdeal (vertex (k := k) (B := B) e)) := + Module.compHom _ (leftAction (k := k) (B := B) e).toRingHom + +instance towerLeft : IsScalarTower k B (IdempotentTensor.rightIdeal (vertex (k := k) (B := B) e)) where + smul_assoc r b x := by + change leftAction e (r • b) x = r • leftAction e b x + rw [map_smul] + rfl + +instance commute : SMulCommClass B (B ⊗[k] C)ᵐᵒᵖ + (IdempotentTensor.rightIdeal (vertex (k := k) (B := B) e)) where + smul_comm b r x := (leftAction e b).map_smul r x + +@[simp] theorem left_smul_value (b : B) + (x : IdempotentTensor.rightIdeal (vertex (k := k) (B := B) e)) : + (b • x).val = coefficient b * x.val := rfl +end LittleFinitistic.OrdinarySimulation.TensorIdeal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorInputMaps.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorInputMaps.lean new file mode 100644 index 0000000000000000000000000000000000000000..4bd9f4ce71737ed383014fab0fd0baab9016c293 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorInputMaps.lean @@ -0,0 +1,78 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorFiniteMatrix +import OAI.Algebra.Finitistic.Ordinary.OrdinaryFiniteTotalMaps + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.ComplexTensor +open BalancedTensor +universe u +variable (k A : Type u) [Field k] [Ring A] [Algebra k A] +variable (Q : CochainComplex (ModuleCat.{u} Aᵐᵒᵖ) ℤ) +variable {Z Z' : CochainComplex (ModuleCat.{u} A) ℤ} (f : Z ⟶ Z') + +/-- The actual map induced by an input chain map in a single balanced tensor term. -/ +def inputMap (p q : ℤ) : term k A Q Z p q →ₗ[k] term k A Q Z' p q := + bimap (k := k) (M := rightTerm k A Q p) (M' := rightTerm k A Q p) + (N := leftTerm k A Z q) (N' := leftTerm k A Z' q) LinearMap.id (f.f q).hom + +/-- Input chain maps act on the signed columns by the actual shifted tensor functor. -/ +def columnMap (p : ℤ) : column k A Q Z p ⟶ column k A Q Z' p := + (shiftFunctor _ (-p)).map + (((fixedTensorFunctor k A (rightTerm k A Q p)).mapHomologicalComplex (.up ℤ)).map f) + +@[simp] theorem columnMap_f (p n : ℤ) : + ((columnMap k A Q f p).f n).hom = inputMap k A Q f p (n + -p) := by + apply BalancedTensor.ext + intro x y + rfl + +theorem inputMap_transport {q q' : ℤ} (h : q=q') : + eqToHom (congrArg Z.X h) ≫ f.f q' = f.f q ≫ eqToHom (congrArg Z'.X h) := by + subst q' + simp only [eqToHom_refl,Category.id_comp,Category.comp_id] + +/-- The horizontal tensor differential is natural in the arbitrary input complex. -/ +theorem horizontal_inputMap (n p p' : ℤ) (h : p+1=p') : + (horizontal k A Q Z' n p p' h).comp (inputMap k A Q f p (n + -p)) = + (inputMap k A Q f p' ((n+1) + -p')).comp (horizontal k A Q Z n p p' h) := by + unfold horizontal inputMap map + erw [bimap_comp,bimap_comp,LinearMap.comp_id] + congr 1 + have hn := inputMap_transport A f (show n + -p = (n+1) + -p' by omega) + exact congrArg ModuleCat.Hom.hom hn.symm + +variable {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) + +theorem entry_inputMap (n : ℤ) (i j : Fin l) : + (entry k A Q Z' p n i j).comp (inputMap k A Q f (p i) (n + -(p i))) = + (inputMap k A Q f (p j) ((n+1) + -(p j))).comp (entry k A Q Z p n i j) := by + unfold entry + split_ifs with h + · exact horizontal_inputMap k A Q f n (p i) (p j) h + · simp only [LinearMap.zero_comp,LinearMap.comp_zero] + +/-- The full horizontal matrix commutes with the actual input map. -/ +theorem matrix_inputMap (n : ℤ) : + (matrix k A Q Z' p n).comp + (FiniteColumnComplex.componentMap (columns k A Q Z p) (columns k A Q Z' p) + (fun i => columnMap k A Q f (p i)) n) = + (FiniteColumnComplex.componentMap (columns k A Q Z p) (columns k A Q Z' p) + (fun i => columnMap k A Q f (p i)) (n+1)).comp (matrix k A Q Z p n) := by + apply LinearMap.ext + intro z + funext j + change matrix k A Q Z' p n + (FiniteColumnComplex.componentMap (columns k A Q Z p) (columns k A Q Z' p) + (fun i => columnMap k A Q f (p i)) n z) j = + ((columnMap k A Q f (p j)).f (n+1)).hom (matrix k A Q Z p n z j) + simp only [matrix_apply,FiniteColumnComplex.componentMap_apply,columnMap_f] + erw [map_sum] + apply Finset.sum_congr rfl + intro i _ + exact congrArg (fun g => g (z i)) (entry_inputMap k A Q f p n i j) +end LittleFinitistic.ComplexTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorMixedSign.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorMixedSign.lean new file mode 100644 index 0000000000000000000000000000000000000000..9498ffa9ba9fa50a15de835797abf37ccc7c8284 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorMixedSign.lean @@ -0,0 +1,42 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryComplexTensorMaps + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.ComplexTensor +universe u +variable (k A : Type u) [Field k] [Ring A] [Algebra k A] +variable (Q : CochainComplex (ModuleCat.{u} Aᵐᵒᵖ) ℤ) +variable (Z : CochainComplex (ModuleCat.{u} A) ℤ) + +theorem transport_d {q q' r r' : ℤ} (hq : q=q') (hr : r=r') : + eqToHom (congrArg Z.X hq) ≫ Z.d q' r' = Z.d q r ≫ eqToHom (congrArg Z.X hr) := by + subst q' + subst r' + simp only [eqToHom_refl,Category.id_comp,Category.comp_id] + +/-- Signed vertical tensor differential on the concrete balanced tensor term. -/ +def vertical (n p : ℤ) : term k A Q Z p (n + -p) →ₗ[k] term k A Q Z p ((n+1) + -p) := + (-p).negOnePow • map k A Q Z (𝟙 (Q.X p)) (Z.d (n + -p) ((n+1) + -p)) + +/-- The two mixed terms cancel with the actual integer total-complex signs. -/ +theorem horizontal_mixed (n p p' : ℤ) (h : p+1=p') : + (vertical k A Q Z (n+1) p').comp (horizontal k A Q Z n p p' h) + + (horizontal k A Q Z (n+1) p p' h).comp (vertical k A Q Z n p) = 0 := by + unfold vertical horizontal + rw [LinearMap.smul_comp,LinearMap.comp_smul,map_comp,map_comp,Category.comp_id,Category.id_comp] + have hd := transport_d A Z + (show n + -p = (n+1) + -p' by omega) + (show (n+1) + -p = ((n+1)+1) + -p' by omega) + rw [hd] + have hs : (-p').negOnePow = -(-p).negOnePow := by + subst p' + simp only [Int.negOnePow_neg,Int.negOnePow_succ] + rw [hs] + change (-(↑((-p).negOnePow) : ℤ)) • _ + (↑((-p).negOnePow) : ℤ) • _ = (0 : term k A Q Z p (n + -p) →ₗ[k] term k A Q Z p' (((n+1)+1) + -p')) + rw [neg_smul,neg_add_cancel] +end LittleFinitistic.ComplexTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorResolution.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorResolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..82d5fd135da9420c78195b000b8732d494a6bc9e --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorResolution.lean @@ -0,0 +1,103 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryResolutionQuasiIso +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorIdealActions +import Mathlib.RingTheory.Flat.Basic + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] (l : ℕ) +namespace TensorResolution +open ChainAlgebra + +abbrev term (n : ℕ) := IdempotentTensor.rightIdeal + (TensorIdeal.vertex (k := k) (B := B) (extendedVertex k l n)) + +def termEquiv (n : ℕ) : B ⊗[k] resolutionIdeal k l n ≃ₗ[k] term k B l n := + TensorIdeal.equivalence _ (extendedVertex_idempotent k l n) + +def regularEquiv : (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ ≃ₗ[(B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ] + B ⊗[k] ChainAlgebra k l where + toFun := MulOpposite.unop + invFun := MulOpposite.op + left_inv _ := rfl + right_inv _ := rfl + map_add' _ _ := rfl + map_smul' _ _ := rfl + +def leftMultiply (x : B ⊗[k] ChainAlgebra k l) : + B ⊗[k] ChainAlgebra k l →ₗ[(B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ] B ⊗[k] ChainAlgebra k l where + toFun y := x*y + map_add' := mul_add x + map_smul' r y := (mul_assoc x y r.unop).symm + +def retract (n : ℕ) : B ⊗[k] ChainAlgebra k l →ₗ[(B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ] term k B l n := + (leftMultiply k B l (TensorIdeal.vertex (k := k) (B := B) (extendedVertex k l n))).codRestrict _ (fun x => by + change _ * (_ * x) = _ * x + rw [← mul_assoc, TensorIdeal.vertex_idempotent _ (extendedVertex_idempotent k l n)]) + +instance term_projective (n : ℕ) : Module.Projective (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ (term k B l n) := by + let : Module.Projective (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ (B ⊗[k] ChainAlgebra k l) := + Module.Projective.of_equiv (regularEquiv k B l) + apply Module.Projective.of_split (term k B l n).subtype (retract k B l n) + ext x + exact x.property + +/-- The B-extended resolution differential is left multiplication by 1 tensor c. -/ +def differential (n : ℕ) : term k B l n →ₗ[(B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ] term k B l (n+1) := + ((leftMultiply k B l ((1:B) ⊗ₜ[k] extendedArrow k l n)).comp (term k B l n).subtype).codRestrict _ (fun x => by + change TensorIdeal.vertex (k := k) (B := B) (extendedVertex k l (n+1)) * + (((1:B) ⊗ₜ[k] extendedArrow k l n) * x.val) = ((1:B) ⊗ₜ[k] extendedArrow k l n) * x.val + rw [← mul_assoc] + congr 1 + simp only [TensorIdeal.vertex,Algebra.TensorProduct.tmul_mul_tmul,one_mul,extendedArrow_target]) + +theorem differential_square (n : ℕ) : (differential k B l (n+1)).comp (differential k B l n) = 0 := by + ext x + change ((1:B) ⊗ₜ[k] extendedArrow k l (n+1)) * (((1:B) ⊗ₜ[k] extendedArrow k l n) * x.val) = 0 + rw [← mul_assoc,Algebra.TensorProduct.tmul_mul_tmul,extendedArrow_square,TensorProduct.tmul_zero,zero_mul] + +theorem termEquiv_d (n : ℕ) (z : B ⊗[k] resolutionIdeal k l n) : + termEquiv k B l (n+1) (((resolutionDifferential k l n).hom.restrictScalars k).lTensor B z) = + differential k B l n (termEquiv k B l n z) := by + induction z using TensorProduct.inductionOn with + | tmul b c => + apply Subtype.ext + change b ⊗ₜ[k] (extendedArrow k l n * c.val) = + ((1:B) ⊗ₜ[k] extendedArrow k l n) * (b ⊗ₜ[k] c.val) + rw [Algebra.TensorProduct.tmul_mul_tmul,one_mul] + | add x y hx hy => simp only [map_add,hx,hy] + +/-- Every interior exact sequence stays exact after the actual B-extension over k. -/ +theorem differential_exact (n : ℕ) (hn : n+1 < l) : + Function.Exact (differential k B l n) (differential k B l (n+1)) := by + have hc : Function.Exact ((resolutionDifferential k l n).hom.restrictScalars k) + ((resolutionDifferential k l (n+1)).hom.restrictScalars k) := by + intro x + constructor + · intro hx + exact (ShortComplex.moduleCat_exact_iff _).mp (supported_complex_exact k l n hn) x hx + · rintro ⟨y,rfl⟩ + have h := congrArg (fun f => f.hom y) (resolutionDifferential_square k l n) + exact h + have ht := Module.Flat.lTensor_exact B hc + intro x + constructor + · intro hx + have hzero : (((resolutionDifferential k l (n+1)).hom.restrictScalars k).lTensor B) + ((termEquiv k B l (n+1)).symm x) = 0 := by + apply (termEquiv k B l (n+2)).injective + rw [termEquiv_d,LinearEquiv.apply_symm_apply,hx,map_zero] + obtain ⟨y,hy⟩ := (ht _).mp hzero + refine ⟨termEquiv k B l n y, ?_⟩ + rw [← termEquiv_d,hy,LinearEquiv.apply_symm_apply] + · rintro ⟨y,rfl⟩ + exact congrArg (fun f => f y) (differential_square k B l n) +end TensorResolution +end LittleFinitistic.OrdinarySimulation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorResolutionComplex.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorResolutionComplex.lean new file mode 100644 index 0000000000000000000000000000000000000000..7e9f1d842be923cd43a7bb343c67bdb9ec11d477 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorResolutionComplex.lean @@ -0,0 +1,161 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorAugmentation + +namespace OAI +noncomputable section +open CategoryTheory Limits +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation.TensorResolution +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] (l : ℕ) + +abbrev termObject (n : ℕ) : ModuleCat.{u} (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ := ModuleCat.of _ (term k B l n) + +def complex : CochainComplex (ModuleCat.{u} (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ) ℕ := + CochainComplex.of (termObject k B l) (fun n => ModuleCat.ofHom (differential k B l n)) + (fun n => by apply ModuleCat.hom_ext; exact differential_square k B l n) + +instance projectiveTerm (n : ℕ) : Projective (termObject k B l n) := inferInstance + +theorem term_vanishes (n : ℕ) (h : l < n) : IsZero (termObject k B l n) := by + apply ModuleCat.isZero_iff_subsingleton.mpr + have hz (x : term k B l n) : x = 0 := by + apply Subtype.ext + have hp := x.property + change ((1:B) ⊗ₜ[k] ChainAlgebra.extendedVertex k l n) * x.val = x.val at hp + rw [ChainAlgebra.extendedVertex,dite_eq_right (Nat.not_le.mpr h),TensorProduct.tmul_zero,zero_mul] at hp + exact hp.symm + exact ⟨fun x y => (hz x).trans (hz y).symm⟩ + +/-- Every differential preserves the regular left B-action. -/ +theorem differential_left (n : ℕ) (b : B) (x : term k B l n) : + differential k B l n (b • x) = b • differential k B l n x := by + apply Subtype.ext + change ((1:B) ⊗ₜ[k] ChainAlgebra.extendedArrow k l n) * (TensorIdeal.coefficient b * x.val) = + TensorIdeal.coefficient b * (((1:B) ⊗ₜ[k] ChainAlgebra.extendedArrow k l n) * x.val) + rw [← mul_assoc,← mul_assoc] + congr 1 + simp only [TensorIdeal.coefficient,Algebra.TensorProduct.includeLeft_apply, + Algebra.TensorProduct.tmul_mul_tmul,one_mul,mul_one] + +theorem complex_exactAt (n : ℕ) (hn : n ≠ l) : (complex k B l).ExactAt n := by + by_cases h : l < n + · exact HomologicalComplex.ExactAt.of_isZero (term_vanishes k B l n h) + have hnl : n < l := by omega + cases n with + | zero => + rw [HomologicalComplex.exactAt_iff, ShortComplex.moduleCat_exact_iff] + intro x hx + have hx' : differential k B l 0 x = 0 := by + change ((complex k B l).d 0 ((ComplexShape.up ℕ).next 0)).hom x = 0 at hx + rw [show (ComplexShape.up ℕ).next 0 = 1 by simp] at hx + change (CochainComplex.of.d (termObject k B l) (fun n => ModuleCat.ofHom (differential k B l n)) 0 (0+1)).hom x = 0 at hx + rw [CochainComplex.of_d] at hx + exact hx + have hx0 : x = 0 := initial_injective k B l hnl (hx'.trans (map_zero _).symm) + exact ⟨0, by simp only [hx0,map_zero]⟩ + | succ n => + apply (HomologicalComplex.exactAt_iff' _ n (n+1) (n+2) (by simp) (by simp)).2 + rw [ShortComplex.moduleCat_exact_iff] + intro x hx + have hx' : differential k B l (n+1) x = 0 := by + change (CochainComplex.of.d (termObject k B l) (fun n => ModuleCat.ofHom (differential k B l n)) (n+1) ((n+1)+1)).hom x = 0 at hx + rw [CochainComplex.of_d] at hx + exact hx + obtain ⟨y,hy⟩ := (differential_exact k B l n hnl x).mp hx' + refine ⟨y, ?_⟩ + change (CochainComplex.of.d (termObject k B l) + (fun j => ModuleCat.ofHom (differential k B l j)) n (n+1)).hom y = x + rw [CochainComplex.of_d] + exact hy + +abbrev augmentationHom : termObject k B l l ⟶ ModuleCat.of (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ (TerminalTensor B) := + ModuleCat.ofHom (augmentation k B l) + +instance augmentation_epi : Epi (augmentationHom k B l) := + (ModuleCat.epi_iff_surjective _).mpr (augmentation_surjective k B l) + +/-- The actual B-extended resolution augmentation as a chain map. -/ +def augmentationMap : complex k B l ⟶ + (HomologicalComplex.single _ (.up ℕ) l).obj (ModuleCat.of (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ (TerminalTensor B)) := + HomologicalComplex.mkHomToSingle (augmentationHom k B l) (by + intro i hi + change i+1=l at hi + subst l + change CochainComplex.of.d _ _ i (i+1) ≫ augmentationHom k B (i+1) = 0 + rw [CochainComplex.of_d] + ext x + exact congrArg (fun f => f x) (augmentation_comp k B i)) + +theorem differential_last_zero : differential k B l l = 0 := by + ext x + change ((1:B) ⊗ₜ[k] ChainAlgebra.extendedArrow k l l) * x.val = 0 + rw [ChainAlgebra.extendedArrow,dite_eq_right (lt_irrefl l),TensorProduct.tmul_zero,zero_mul] + +theorem augmentationMap_quasiIsoAt_last : QuasiIsoAt (augmentationMap k B l) l := by + rw [quasiIsoAt_iff] + refine (ShortComplex.quasiIso_iff_of_zeros' _ ?_ ?_ ?_).2 ?_ + · change (complex k B l).d l ((ComplexShape.up ℕ).next l) = 0 + rw [show (ComplexShape.up ℕ).next l = l+1 by simp] + change CochainComplex.of.d (termObject k B l) (fun n => ModuleCat.ofHom (differential k B l n)) l (l+1) = 0 + rw [CochainComplex.of_d] + apply ModuleCat.hom_ext + exact differential_last_zero k B l + · exact HomologicalComplex.single_obj_d (.up ℕ) l (ModuleCat.of (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ (TerminalTensor B)) ((ComplexShape.up ℕ).prev l) l + · exact HomologicalComplex.single_obj_d (.up ℕ) l (ModuleCat.of (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ (TerminalTensor B)) l ((ComplexShape.up ℕ).next l) + · change (ShortComplex.mk ((complex k B l).d ((ComplexShape.up ℕ).prev l) l) + ((augmentationMap k B l).f l) _).Exact ∧ Epi ((augmentationMap k B l).f l) + have hf : (augmentationMap k B l).f l = augmentationHom k B l ≫ + (HomologicalComplex.singleObjXSelf (.up ℕ) l + (ModuleCat.of (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ (TerminalTensor B))).inv := by + unfold augmentationMap + apply HomologicalComplex.mkHomToSingle_f + simp only [hf] + constructor + · refine ChainAlgebra.exact_post_iso _ _ ?_ + (HomologicalComplex.singleObjXSelf (.up ℕ) l + (ModuleCat.of (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ (TerminalTensor B))).symm ?_ + · cases l with + | zero => + have hz := (complex k B 0).shape ((ComplexShape.up ℕ).prev 0) 0 (by simp) + erw [hz,zero_comp] + | succ n => + rw [show (ComplexShape.up ℕ).prev (n+1) = n by simp] + change CochainComplex.of.d _ _ n (n+1) ≫ augmentationHom k B (n+1) = 0 + rw [CochainComplex.of_d] + ext x + exact congrArg (fun f => f x) (augmentation_comp k B n) + cases l with + | zero => + rw [ShortComplex.moduleCat_exact_iff] + intro x hx + have hx0 : x = 0 := augmentation_zero_injective k B (hx.trans (map_zero _).symm) + exact ⟨0, by simp only [hx0,map_zero]⟩ + | succ n => + rw [ShortComplex.moduleCat_exact_iff] + intro x hx + obtain ⟨y,hy⟩ := (augmentation_exact k B n x).mp hx + change ∃ z : termObject k B (n+1) ((ComplexShape.up ℕ).prev (n+1)), + (CochainComplex.of.d (termObject k B (n+1)) + (fun j => ModuleCat.ofHom (differential k B (n+1) j)) + ((ComplexShape.up ℕ).prev (n+1)) (n+1)).hom z = x + rw [show (ComplexShape.up ℕ).prev (n+1) = n by simp] + exact ⟨y, by rw [CochainComplex.of_d]; exact hy⟩ + · erw [ModuleCat.epi_iff_surjective] + exact ((ModuleCat.epi_iff_surjective _).mp (inferInstance : Epi + (HomologicalComplex.singleObjXSelf (.up ℕ) l + (ModuleCat.of (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ (TerminalTensor B))).inv)).comp + (augmentation_surjective k B l) + +/-- Actual augmentation quasi-isomorphism for the finite right-BC-projective resolution. -/ +theorem augmentationMap_quasiIso : QuasiIso (augmentationMap k B l) := by + constructor + intro n + by_cases hn : n = l + · subst n; exact augmentationMap_quasiIsoAt_last k B l + · apply (quasiIsoAt_iff_exactAt' _ n ?_).2 (complex_exactAt k B l n hn) + exact HomologicalComplex.ExactAt.of_isZero (HomologicalComplex.isZero_single_obj_X _ _ _ _ hn) +end LittleFinitistic.OrdinarySimulation.TensorResolution + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorRightRestriction.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorRightRestriction.lean new file mode 100644 index 0000000000000000000000000000000000000000..7b9eaa541aa07f0805b15ba05bf9495d24f2ab18 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorRightRestriction.lean @@ -0,0 +1,48 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTwoSidedTensor +import OAI.Algebra.Finitistic.Ordinary.OrdinaryAssociativeTensorModules +import Mathlib.Algebra.Category.ModuleCat.ChangeOfRings + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.TwoSidedTensor +universe u +variable (k A B S M N : Type u) [Field k] [Ring A] [Ring B] [Ring S] + [Algebra k A] [Algebra k B] [Algebra k S] +variable [AddCommGroup M] [Module k M] [Module Aᵐᵒᵖ M] [IsScalarTower k Aᵐᵒᵖ M] + [Module S M] [IsScalarTower k S M] [SMulCommClass S Aᵐᵒᵖ M] +variable [AddCommGroup N] [Module k N] [Module A N] [Module Bᵐᵒᵖ N] + [IsScalarTower k A N] [IsScalarTower k Bᵐᵒᵖ N] [SMulCommClass A Bᵐᵒᵖ N] + +local instance : SMulCommClass Bᵐᵒᵖ A N := ⟨fun b a n => (smul_comm a b n).symm⟩ + +/-- The actual outside right action obtained by restricting the enveloping action. -/ +abbrev rightRestriction : ModuleCat.{u} Bᵐᵒᵖ := + (ModuleCat.restrictScalars (Algebra.TensorProduct.includeRight (R := k) (A := S) (B := Bᵐᵒᵖ)).toRingHom).obj + (ModuleCat.of (S ⊗[k] Bᵐᵒᵖ) (TwoSidedTensor k A S Bᵐᵒᵖ M N)) + +/-- The one-sided right tensor action equals the restriction of the genuine two-sided action. -/ +def rightActionEquiv : RightTensor k A B M N ≃ₗ[Bᵐᵒᵖ] rightRestriction k A B S M N where + toFun x := x + invFun x := x + left_inv x := rfl + right_inv x := rfl + map_add' x y := rfl + map_smul' r x := by + let F : BalancedTensor.Tensor k A M N →ₗ[k] BalancedTensor.Tensor k A M N := + RightTensor.action k A B M N r + let G : BalancedTensor.Tensor k A M N →ₗ[k] BalancedTensor.Tensor k A M N := + TwoSidedTensor.action k A S Bᵐᵒᵖ M N ((1:S) ⊗ₜ[k] r) + have h : F = G := by + apply BalancedTensor.ext + intro m n + change BalancedTensor.mk k A M N m (r • n) = BalancedTensor.mk k A M N ((1:S) • m) (r • n) + rw [one_smul] + exact congrArg (fun f => f x) h + +end LittleFinitistic.TwoSidedTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorTotalAcyclic.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorTotalAcyclic.lean new file mode 100644 index 0000000000000000000000000000000000000000..93c5e827c38f9b115cf9bbd5c441733b9cac2d10 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorTotalAcyclic.lean @@ -0,0 +1,60 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorFiniteMatrix +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorColumnAcyclic +import OAI.Algebra.Finitistic.Ordinary.OrdinaryIntegerResolution + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic +namespace ComplexTensor +universe u +variable (k A : Type u) [Field k] [Ring A] [Algebra k A] +variable (Q : CochainComplex (ModuleCat.{u} Aᵐᵒᵖ) ℤ) +variable (Z : CochainComplex (ModuleCat.{u} A) ℤ) +variable {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) + +/-- The actual signed finite tensor total of projective right terms preserves acyclicity. +No bound, finiteness, dimension or projectivity condition is imposed on Z. -/ +theorem finiteTotal_acyclic [∀ i, Module.Projective Aᵐᵒᵖ (rightTerm k A Q (p i))] + (hZ : Z.Acyclic) : (finiteTotal k A Q Z p hp).Acyclic := + FiniteColumnComplex.total_acyclic (columns k A Q Z p) (tensorHorizontal k A Q Z p hp) + (fun i => column_acyclic k A Q Z (p i) hZ) + +end ComplexTensor +namespace OrdinarySimulation.TensorResolution +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] (l : ℕ) + +/-- Exactly the manuscript's finite interval [-l,0] of Q_T. -/ +def finiteDegrees (i : Fin (l+1)) : ℤ := -(l:ℤ) + i.val + +theorem finiteDegrees_strictMono : StrictMono (finiteDegrees l) := by + intro i j hij + change -(l:ℤ) + (i.val:ℤ) < -(l:ℤ) + (j.val:ℤ) + change i.val < j.val at hij + omega + +instance integerTerm_moduleProjective (n : ℤ) : + Module.Projective (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ + (ComplexTensor.rightTerm k (B ⊗[k] ChainAlgebra k l) (integerComplex k B l) n) := by + let := integerTerm_projective k B l n + exact (inferInstance : Module.Projective (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ ((integerComplex k B l).X n)) + +/-- Actual signed tensor with the manuscript's Q_T on an arbitrary complex of BC-modules. -/ +def tensorTotal (Z : CochainComplex (ModuleCat.{u} (B ⊗[k] ChainAlgebra k l)) ℤ) : + CochainComplex (ModuleCat.{u} k) ℤ := + ComplexTensor.finiteTotal k (B ⊗[k] ChainAlgebra k l) (integerComplex k B l) Z + (finiteDegrees l) (finiteDegrees_strictMono l) + +/-- Q_T is K-flat in the acyclic-input characterization, for its actual signed tensor total. -/ +theorem tensorTotal_acyclic (Z : CochainComplex (ModuleCat.{u} (B ⊗[k] ChainAlgebra k l)) ℤ) + (hZ : Z.Acyclic) : (tensorTotal k B l Z).Acyclic := + ComplexTensor.finiteTotal_acyclic k (B ⊗[k] ChainAlgebra k l) (integerComplex k B l) Z + (finiteDegrees l) (finiteDegrees_strictMono l) hZ +end OrdinarySimulation.TensorResolution +end LittleFinitistic + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorTotalFunctor.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorTotalFunctor.lean new file mode 100644 index 0000000000000000000000000000000000000000..75aa776839e9dc69116ca475c9ed526200372ffd --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorTotalFunctor.lean @@ -0,0 +1,88 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorInputMaps + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic +namespace FiniteColumnComplex +universe u +variable {R : Type u} [Ring R] {l : ℕ} +variable (K L : Fin l → CochainComplex (ModuleCat.{u} R) ℤ) (f : ∀ i, K i ⟶ L i) + +theorem diagonal_componentMap (n : ℤ) : + (diagonal L n).comp (componentMap K L f n) = (componentMap K L f (n+1)).comp (diagonal K n) := by + apply LinearMap.ext + intro z + funext i + exact congrArg (fun g => g.hom (z i)) ((f i).comm n (n+1)) + +end FiniteColumnComplex +namespace ComplexTensor +open BalancedTensor +universe u +variable (k A : Type u) [Field k] [Ring A] [Algebra k A] +variable (Q : CochainComplex (ModuleCat.{u} Aᵐᵒᵖ) ℤ) +variable {Z Z' Z'' : CochainComplex (ModuleCat.{u} A) ℤ} +variable {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) + +/-- Actual tensor total applied to an arbitrary chain map of input complexes. -/ +def finiteTotalMap (f : Z ⟶ Z') : finiteTotal k A Q Z p hp ⟶ finiteTotal k A Q Z' p hp := + FiniteColumnComplex.complexMap (columns k A Q Z p) (columns k A Q Z' p) + (FiniteColumnComplex.totalDifferential _ (tensorHorizontal k A Q Z p hp)) + (FiniteColumnComplex.totalDifferential _ (tensorHorizontal k A Q Z' p hp)) + (fun i => columnMap k A Q f (p i)) (by + intro n + change (FiniteColumnComplex.diagonal (columns k A Q Z' p) n + matrix k A Q Z' p n).comp _ = + (FiniteColumnComplex.componentMap _ _ (fun i => columnMap k A Q f (p i)) (n+1)).comp + (FiniteColumnComplex.diagonal (columns k A Q Z p) n + matrix k A Q Z p n) + rw [LinearMap.add_comp,LinearMap.comp_add, + FiniteColumnComplex.diagonal_componentMap,matrix_inputMap]) + +@[simp] theorem finiteTotalMap_apply (f : Z ⟶ Z') (n : ℤ) + (z : FiniteColumnComplex.term (columns k A Q Z p) n) (i : Fin l) : + ((finiteTotalMap k A Q p hp f).f n).hom z i = inputMap k A Q f (p i) (n + -(p i)) (z i) := by + change ((columnMap k A Q f (p i)).f n).hom (z i) = _ + rw [columnMap_f] + rfl + +@[simp] theorem inputMap_id (p q : ℤ) : inputMap k A Q (𝟙 Z) p q = LinearMap.id := by + apply BalancedTensor.ext + intro x y + rfl + +@[simp] theorem inputMap_comp (f : Z ⟶ Z') (g : Z' ⟶ Z'') (p q : ℤ) : + (inputMap k A Q g p q).comp (inputMap k A Q f p q) = inputMap k A Q (f ≫ g) p q := by + apply BalancedTensor.ext + intro x y + rfl + +/-- The actual signed finite tensor total is a functor on all input complexes. -/ +def finiteTotalFunctor : CochainComplex (ModuleCat.{u} A) ℤ ⥤ CochainComplex (ModuleCat.{u} k) ℤ where + obj Z := finiteTotal k A Q Z p hp + map f := finiteTotalMap k A Q p hp f + map_id Z := by + apply HomologicalComplex.Hom.ext + funext n + apply ModuleCat.hom_ext + apply LinearMap.ext + intro z + funext i + change ((finiteTotalMap k A Q p hp (𝟙 Z)).f n).hom z i = z i + erw [finiteTotalMap_apply,inputMap_id,LinearMap.id_apply] + map_comp f g := by + apply HomologicalComplex.Hom.ext + funext n + apply ModuleCat.hom_ext + apply LinearMap.ext + intro z + funext i + change ((finiteTotalMap k A Q p hp (f ≫ g)).f n).hom z i = + ((finiteTotalMap k A Q p hp g).f n).hom (((finiteTotalMap k A Q p hp f).f n).hom z) i + erw [finiteTotalMap_apply,finiteTotalMap_apply,finiteTotalMap_apply] + exact (congrArg (fun h => h (z i)) (inputMap_comp k A Q f g (p i) (n + -(p i)))).symm +end ComplexTensor +end LittleFinitistic + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorTotalQuasiIso.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorTotalQuasiIso.lean new file mode 100644 index 0000000000000000000000000000000000000000..d5cc64f17b6d4d3ef67db9f81bb97512de3d92f3 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorTotalQuasiIso.lean @@ -0,0 +1,56 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorTotalFunctor +import OAI.Algebra.Finitistic.Ordinary.OrdinaryFiniteConeTriangular +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorTotalAcyclic +import Mathlib.Algebra.Homology.HomotopyCategory.ShiftSequence + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic +namespace ComplexTensor +universe u +variable (k A : Type u) [Field k] [Ring A] [Algebra k A] +variable (Q : CochainComplex (ModuleCat.{u} Aᵐᵒᵖ) ℤ) +variable {Z Z' : CochainComplex (ModuleCat.{u} A) ℤ} (f : Z ⟶ Z') + +/-- Every shifted projective tensor column preserves arbitrary quasi-isomorphisms. -/ +theorem columnMap_quasiIso (p : ℤ) [Module.Projective Aᵐᵒᵖ (rightTerm k A Q p)] [QuasiIso f] : + QuasiIso (columnMap k A Q f p) := by + have ht := BalancedTensor.projectiveTensor_quasiIso k A (rightTerm k A Q p) f + let := ht + exact inferInstanceAs (QuasiIso ((shiftFunctor _ (-p)).map + (((BalancedTensor.fixedTensorFunctor k A (rightTerm k A Q p)).mapHomologicalComplex + (.up ℤ)).map f))) + +variable {l : ℕ} (p : Fin l → ℤ) (hp : StrictMono p) + +/-- The actual signed finite tensor functor preserves quasi-isomorphisms of arbitrary complexes. -/ +theorem finiteTotalMap_quasiIso [∀ i, Module.Projective Aᵐᵒᵖ (rightTerm k A Q (p i))] [QuasiIso f] : + QuasiIso (finiteTotalMap k A Q p hp f) := by + let (i : Fin l) := columnMap_quasiIso k A Q f (p i) + unfold finiteTotalMap + exact FiniteColumnComplex.complexMap_quasiIso _ _ _ _ _ _ + +end ComplexTensor +namespace OrdinarySimulation.TensorResolution +open scoped TensorProduct +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] (l : ℕ) + +def tensorTotalFunctor : CochainComplex (ModuleCat.{u} (B ⊗[k] ChainAlgebra k l)) ℤ ⥤ + CochainComplex (ModuleCat.{u} k) ℤ := + ComplexTensor.finiteTotalFunctor k (B ⊗[k] ChainAlgebra k l) (integerComplex k B l) + (finiteDegrees l) (finiteDegrees_strictMono l) + +/-- The actual bounded projective Q_T computes a homotopy-invariant tensor on every input complex. -/ +theorem tensorTotalFunctor_quasiIso + {Z Z' : CochainComplex (ModuleCat.{u} (B ⊗[k] ChainAlgebra k l)) ℤ} (f : Z ⟶ Z') [QuasiIso f] : + QuasiIso ((tensorTotalFunctor k B l).map f) := + ComplexTensor.finiteTotalMap_quasiIso k (B ⊗[k] ChainAlgebra k l) (integerComplex k B l) f + (finiteDegrees l) (finiteDegrees_strictMono l) +end OrdinarySimulation.TensorResolution +end LittleFinitistic + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorVertex.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorVertex.lean new file mode 100644 index 0000000000000000000000000000000000000000..067e66cdacf9e6727f676a1759501106e7eea0d8 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTensorVertex.lean @@ -0,0 +1,55 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimodule +import OAI.Algebra.Finitistic.Ordinary.OrdinaryVertexCompression +import OAI.Algebra.Finitistic.Ordinary.OrdinaryTensorIdealActions + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation.BimoduleO +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +variable (P : CochainComplex (ModuleCat.{u} (Enveloping k B)) ℤ) (a : ℤ) (l : ℕ) + +@[simp] theorem tensor_smul (b : B) (c : ChainAlgebra k l) (v : BimoduleO P a l) : + (b ⊗ₜ[k] c) • v = b • (c • v) := rfl + +@[simp] theorem tensor_vertex_smul (i : Fin (l+1)) (v : BimoduleO P a l) : + TensorIdeal.vertex (k := k) (B := B) (ChainAlgebra.vertex k l i) • v = + ChainAlgebra.vertex k l i • v := by + change (1:B) • (ChainAlgebra.vertex k l i • v) = _ + exact one_smul _ _ + +/-- The BC vertex space is the same actual subspace of O as the C vertex space. -/ +def tensorVertexSpaceEquiv (i : Fin (l+1)) : + IdempotentTensor.leftSpace (k := k) (TensorIdeal.vertex (k := k) (B := B) (ChainAlgebra.vertex k l i)) + (BimoduleO P a l) ≃ₗ[k] Compression.vertexSpace (k := k) P a l i where + toFun x := ⟨x.val, by + have h := x.property + change TensorIdeal.vertex (k := k) (B := B) (ChainAlgebra.vertex k l i) • x.val = x.val at h + rw [tensor_vertex_smul] at h + exact h⟩ + invFun x := ⟨x.val, by + exact (tensor_vertex_smul P a l i (show BimoduleO P a l from x.val)).trans x.property⟩ + left_inv _ := rfl + right_inv _ := rfl + map_add' _ _ := rfl + map_smul' _ _ := rfl + +/-- Evaluation uses the actual balanced tensor over BC, not only over C. -/ +def tensorVertexEquiv (i : Fin (l+1)) : + BalancedTensor.Tensor k (B ⊗[k] ChainAlgebra k l) + (IdempotentTensor.rightIdeal (TensorIdeal.vertex (k := k) (B := B) (ChainAlgebra.vertex k l i))) + (BimoduleO P a l) ≃ₗ[k] (underlyingComplex (k := k) P).X (a+(i.val:ℤ)) := by + letI (n : ℤ) : Module k (P.X n) := Module.compHom _ (algebraMap k (Enveloping k B)) + have (n : ℤ) : IsScalarTower k (Enveloping k B) (P.X n) := IsScalarTower.of_compHom k (Enveloping k B) (P.X n) + exact (IdempotentTensor.tensorEquiv (k := k) + (TensorIdeal.vertex (k := k) (B := B) (ChainAlgebra.vertex k l i)) (BimoduleO P a l) + (TensorIdeal.vertex_idempotent _ (ChainAlgebra.vertex_idempotent k l i))).trans + ((tensorVertexSpaceEquiv P a l i).trans + ((Compression.vertexEquiv (k := k) P a l i).restrictScalars k)) +end LittleFinitistic.OrdinarySimulation.BimoduleO + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTerminal.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTerminal.lean new file mode 100644 index 0000000000000000000000000000000000000000..7f29e3b0e451633c9e8911c9c910000cd51f0846 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTerminal.lean @@ -0,0 +1,72 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimodule + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] (l : ℕ) + +/-- The terminal character extended along the B-factor. -/ +def terminalAugmentation : (B ⊗[k] ChainAlgebra k l) →ₐ[k] B := + Algebra.TensorProduct.lift (AlgHom.id k B) + ((Algebra.ofId k B).comp (ChainAlgebra.terminalCharacter k l)) (by + intro b c + change b * algebraMap k B (ChainAlgebra.terminalCharacter k l c) = + algebraMap k B (ChainAlgebra.terminalCharacter k l c) * b + exact (Algebra.commutes _ _).symm) + +/-- Coordinate model for B tensor_k W, with its specified terminal right action. -/ +def TerminalTensor := B +namespace TerminalTensor +instance : AddCommGroup (TerminalTensor B) := inferInstanceAs (AddCommGroup B) +instance : Module k (TerminalTensor B) := inferInstanceAs (Module k B) +instance : Module B (TerminalTensor B) := inferInstanceAs (Module B B) +instance : Module (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ (TerminalTensor B) := + Module.compHom B (terminalAugmentation k B l).toRingHom.op + +def value (t : TerminalTensor B) : B := t + +@[simp] theorem right_action (x : (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ) (t : TerminalTensor B) : + value B (x • t) = value B t * terminalAugmentation k B l x.unop := rfl + +instance towerLeft : IsScalarTower k B (TerminalTensor B) := inferInstanceAs (IsScalarTower k B B) + +instance towerRight : IsScalarTower k (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ (TerminalTensor B) where + smul_assoc c x v := by + change value B v * terminalAugmentation k B l (c • x.unop) = c • (value B v * terminalAugmentation k B l x.unop) + rw [map_smul, mul_smul_comm] + +instance commuteActions : SMulCommClass B (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ (TerminalTensor B) where + smul_comm b x t := by + change b * (value B t * terminalAugmentation k B l x.unop) = + (b*value B t) * terminalAugmentation k B l x.unop + exact (mul_assoc _ _ _).symm + +/-- Explicit identification of this coordinate model with the source tensor product. -/ +def tensorModel : (B ⊗[k] k) ≃ₗ[k] TerminalTensor B := TensorProduct.rid k B + +@[simp] theorem tensorModel_tmul (b : B) (c : k) : + tensorModel k B (b ⊗ₜ[k] c) = c • b := rfl + +/-- The coordinate right action has exactly the regular-B/terminal-W tensor formula. -/ +theorem tensor_right_formula (b b' : B) (w : k) (c : ChainAlgebra k l) : + MulOpposite.op (b' ⊗ₜ[k] c) • tensorModel k B (b ⊗ₜ[k] w) = + tensorModel k B ((b*b') ⊗ₜ[k] (w * ChainAlgebra.terminalCharacter k l c)) := by + change (w • b) * (b' * algebraMap k B (ChainAlgebra.terminalCharacter k l c)) = + (w * ChainAlgebra.terminalCharacter k l c) • (b*b') + rw [Algebra.smul_def, Algebra.smul_def, map_mul] + have hc := Algebra.commutes (R := k) (A := B) (ChainAlgebra.terminalCharacter k l c) (b*b') + calc + _ = algebraMap k B w * ((b*b') * algebraMap k B (ChainAlgebra.terminalCharacter k l c)) := by simp only [mul_assoc] + _ = _ := by rw [← hc]; simp only [mul_assoc] + +instance finiteDimensional [FiniteDimensional k B] : FiniteDimensional k (TerminalTensor B) := + inferInstanceAs (FiniteDimensional k B) +end TerminalTensor +end LittleFinitistic.OrdinarySimulation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTerminalResolution.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTerminalResolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..ced43cc70913fd03911e47ba5c34cdadc4c0819b --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTerminalResolution.lean @@ -0,0 +1,65 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryChainResolution + +namespace OAI +noncomputable section +namespace LittleFinitistic.OrdinarySimulation +universe u +variable (k : Type u) [Field k] (l : ℕ) + +/-- W is the genuine terminal right simple, via the terminal character. -/ +def TerminalSimple := k +namespace TerminalSimple +instance : AddCommGroup (TerminalSimple k) := inferInstanceAs (AddCommGroup k) +instance : Module k (TerminalSimple k) := inferInstanceAs (Module k k) +instance : Module (ChainAlgebra k l)ᵐᵒᵖ (TerminalSimple k) := + Module.compHom k (ChainAlgebra.terminalCharacter k l).toRingHom.op +end TerminalSimple + +namespace ChainAlgebra +/-- The augmentation of the terminal right projective. -/ +def augmentation : rightTerm (k := k) (Fin.last l) →ₗ[(ChainAlgebra k l)ᵐᵒᵖ] TerminalSimple k where + toFun x := x.val.1 (Fin.last l) + map_add' _ _ := rfl + map_smul' _ _ := rfl + +@[simp] theorem augmentation_zero_iff (x : rightTerm (k := k) (Fin.last l)) : + augmentation k l x = 0 ↔ x.val.1 (Fin.last l) = 0 := Iff.rfl + +theorem augmentation_surjective : Function.Surjective (augmentation k l) := by + intro w + let x : rightTerm (k := k) (Fin.last l) := ⟨(show k from w) • vertex k l (Fin.last l), by + change vertex k l (Fin.last l) * ((show k from w) • vertex k l (Fin.last l)) = + (show k from w) • vertex k l (Fin.last l) + rw [mul_smul_comm, vertex_idempotent]⟩ + refine ⟨x, ?_⟩ + change ((show k from w) • vertex k l (Fin.last l)).1 (Fin.last l) = (show k from w) + rw [smul_diagonal, vertex_diagonal] + simp only [Pi.single_eq_same] + exact @mul_one k _ w + +/-- Exactness at the augmentation for every positive chain length. -/ +theorem augmentation_exact (x : rightTerm (k := k) (Fin.last (l+1))) : + augmentation k (l+1) x = 0 ↔ + ∃ y, resolutionMap (k := k) (Fin.last l) y = x := by + rw [augmentation_zero_iff, resolutionMap_range] + rfl + +theorem augmentation_zero_injective : Function.Injective (augmentation k 0) := by + intro x y hxy + have hz : (x-y).val.1 0 = 0 := by + have hz : augmentation k 0 (x-y) = 0 := by rw [map_sub, hxy, sub_self] + exact (augmentation_zero_iff k 0 _).mp hz + have he := vertex_zero_mul (x-y).val + have hp : vertex k 0 0 * (x-y).val = (x-y).val := (x-y).property + rw [hp, hz, zero_smul] at he + exact sub_eq_zero.mp (show x-y = 0 from Subtype.ext he) + +/-- For l=0, the source resolution is the actual isomorphism e₀C ≅ W. -/ +def zeroLengthResolution : rightTerm (k := k) (Fin.last 0) ≃ₗ[(ChainAlgebra k 0)ᵐᵒᵖ] TerminalSimple k := + LinearEquiv.ofBijective (augmentation k 0) ⟨augmentation_zero_injective k, augmentation_surjective k 0⟩ +end ChainAlgebra +end LittleFinitistic.OrdinarySimulation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTriangularExactness.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTriangularExactness.lean new file mode 100644 index 0000000000000000000000000000000000000000..58a7103264d291c1784da5ddbd087908de9f9c34 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTriangularExactness.lean @@ -0,0 +1,68 @@ +import Mathlib.Algebra.Exact.Basic +import Mathlib.LinearAlgebra.Pi +import Mathlib.Tactic.Abel + +namespace OAI +noncomputable section +namespace LittleFinitistic.TriangularExactness +universe u v +variable {R : Type u} [Ring R] {l : ℕ} +variable (E F G : Fin l → Type v) +variable [∀ i, AddCommGroup (E i)] [∀ i, Module R (E i)] +variable [∀ i, AddCommGroup (F i)] [∀ i, Module R (F i)] +variable [∀ i, AddCommGroup (G i)] [∀ i, Module R (G i)] + +/-- A finite upper triangular differential with exact diagonal complexes is exact. +The argument eliminates one coordinate at a time; the modules may be arbitrary. -/ +theorem exact_of_diagonal + (d : (∀ i, E i) →ₗ[R] (∀ i, F i)) (e : (∀ i, F i) →ₗ[R] (∀ i, G i)) + (d₀ : ∀ i, E i →ₗ[R] F i) (e₀ : ∀ i, F i →ₗ[R] G i) + (hzero : e.comp d = 0) + (hd : ∀ (i : Fin l) (x : E i) (j : Fin l), j.val < i.val → d (Pi.single i x) j = 0) + (hdi : ∀ (i : Fin l) (x : E i), d (Pi.single i x) i = d₀ i x) + (he : ∀ (i : Fin l) (z : ∀ j, F j), (∀ j : Fin l, j.val < i.val → z j = 0) → + e z i = e₀ i (z i)) + (hex : ∀ i, Function.Exact (d₀ i) (e₀ i)) : Function.Exact d e := by + classical + intro z + constructor + · intro hz + have step (n : ℕ) (hn : n ≤ l) : + ∃ w : ∀ i, E i, ∀ j : Fin l, j.val < n → (z-d w) j = 0 := by + induction n with + | zero => exact ⟨0,fun j hj => by omega⟩ + | succ n ih => + obtain ⟨w,hw⟩ := ih (by omega) + let i : Fin l := ⟨n,by omega⟩ + have hclosed : e (z-d w) = 0 := by + rw [map_sub,hz] + have hed : e (d w) = 0 := congrArg (fun f : (∀ i, E i) →ₗ[R] (∀ i, G i) => f w) hzero + rw [hed,sub_self] + have hei : e₀ i ((z-d w) i) = 0 := by + rw [← he i (z-d w) (fun j hj => hw j hj)] + exact congrArg (fun x => x i) hclosed + obtain ⟨y,hy⟩ := (hex i _).mp hei + refine ⟨w + Pi.single i y, ?_⟩ + intro j hj + by_cases hji : j.val < n + · have hj0 := hd i y j hji + change z j - d (w + Pi.single i y) j = 0 + rw [map_add,Pi.add_apply,hj0,add_zero] + exact hw j hji + · have hij : j = i := Fin.ext (by dsimp [i]; omega) + subst j + change z i - d (w + Pi.single i y) i = 0 + rw [map_add,Pi.add_apply,hdi,hy] + change z i - (d w i + (z i - d w i)) = 0 + abel + obtain ⟨w,hw⟩ := step l (by rfl) + refine ⟨w, ?_⟩ + ext i + exact (sub_eq_zero.mp (hw i i.isLt)).symm + · rintro ⟨w,rfl⟩ + exact congrArg (fun f : (∀ i, E i) →ₗ[R] (∀ i, G i) => f w) hzero +end LittleFinitistic.TriangularExactness + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTwoSidedTensor.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTwoSidedTensor.lean new file mode 100644 index 0000000000000000000000000000000000000000..25beda4245d88ef4b92e4c7e1729551acada5510 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryTwoSidedTensor.lean @@ -0,0 +1,95 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBalancedActions + +namespace OAI +noncomputable section +open scoped TensorProduct +namespace LittleFinitistic +universe u +/-- Balanced tensor with its two outside coefficient algebras recorded in the type. -/ +def TwoSidedTensor (k A _S _T M N : Type u) [Field k] [Ring A] [Algebra k A] + [AddCommGroup M] [Module k M] [Module Aᵐᵒᵖ M] + [AddCommGroup N] [Module k N] [Module A N] := BalancedTensor.Tensor k A M N + +variable (k A S T M N : Type u) [Field k] [Ring A] [Algebra k A] [Ring S] [Algebra k S] + [Ring T] [Algebra k T] + [AddCommGroup M] [Module k M] [Module Aᵐᵒᵖ M] [IsScalarTower k Aᵐᵒᵖ M] + [Module S M] [IsScalarTower k S M] [SMulCommClass S Aᵐᵒᵖ M] + [AddCommGroup N] [Module k N] [Module A N] [IsScalarTower k A N] + [Module T N] [IsScalarTower k T N] [SMulCommClass T A N] + +namespace TwoSidedTensor +instance : AddCommGroup (TwoSidedTensor k A S T M N) := inferInstanceAs (AddCommGroup (BalancedTensor.Tensor k A M N)) +instance : Module k (TwoSidedTensor k A S T M N) := inferInstanceAs (Module k (BalancedTensor.Tensor k A M N)) + +def action : (S ⊗[k] T) →ₐ[k] Module.End k (TwoSidedTensor k A S T M N) := + BalancedTensor.bimoduleAction +instance : Module (S ⊗[k] T) (TwoSidedTensor k A S T M N) := Module.compHom _ (action k A S T M N).toRingHom +instance : IsScalarTower k (S ⊗[k] T) (TwoSidedTensor k A S T M N) where + smul_assoc r x z := by + change action k A S T M N (r • x) z = r • action k A S T M N x z + rw [map_smul] + rfl + +def mk : M →ₗ[k] N →ₗ[k] TwoSidedTensor k A S T M N := BalancedTensor.mk k A M N + +@[simp] theorem tmul_smul_mk (s : S) (t : T) (m : M) (n : N) : + (s ⊗ₜ[k] t) • mk k A S T M N m n = mk k A S T M N (s • m) (t • n) := rfl + +variable {k A S T M N} +variable {M' : Type u} [AddCommGroup M'] [Module k M'] [Module Aᵐᵒᵖ M'] [IsScalarTower k Aᵐᵒᵖ M'] + [Module S M'] [IsScalarTower k S M'] [SMulCommClass S Aᵐᵒᵖ M'] + +/-- Functoriality of the actual tensor with both outside actions retained. -/ +def map (f : M →ₗ[Aᵐᵒᵖ] M') (hf : ∀ (s : S) m, f (s • m) = s • f m) : + TwoSidedTensor k A S T M N →ₗ[S ⊗[k] T] TwoSidedTensor k A S T M' N where + __ := (BalancedTensor.mapLeft (k := k) N f).toAddHom + map_smul' x z := by + let F : TwoSidedTensor k A S T M N →ₗ[k] TwoSidedTensor k A S T M' N := + BalancedTensor.mapLeft (k := k) N f + have h : F.comp (action k A S T M N x) = (action k A S T M' N x).comp F := by + induction x using TensorProduct.inductionOn with + | tmul s t => + apply BalancedTensor.ext + intro m n + change BalancedTensor.mk k A M' N (f (s • m)) (t • n) = + BalancedTensor.mk k A M' N (s • f m) (t • n) + rw [hf] + | add x y hx hy => + simp only [map_add, LinearMap.comp_add, LinearMap.add_comp, hx, hy] + exact congrArg (fun g => g z) h + +@[simp] theorem map_mk (f : M →ₗ[Aᵐᵒᵖ] M') (hf : ∀ (s : S) m, f (s • m) = s • f m) (m : M) (n : N) : + map (T := T) (N := N) f hf (mk k A S T M N m n) = mk k A S T M' N (f m) n := rfl + +/-- Actual equivalences of the right factor on the left preserve the outside bimodule. -/ +def congrLeft (e : M ≃ₗ[Aᵐᵒᵖ] M') (he : ∀ (s : S) m, e (s • m) = s • e m) : + TwoSidedTensor k A S T M N ≃ₗ[S ⊗[k] T] TwoSidedTensor k A S T M' N where + __ := map (T := T) (N := N) e.toLinearMap he + invFun := map (T := T) (N := N) e.symm.toLinearMap (fun s m => by + apply e.injective + change e (e.symm (s • m)) = e (s • e.symm m) + rw [LinearEquiv.apply_symm_apply,he,LinearEquiv.apply_symm_apply]) + left_inv z := by + change BalancedTensor.mapLeft (k := k) N e.symm.toLinearMap + (BalancedTensor.mapLeft (k := k) N e.toLinearMap z) = z + induction z using BalancedTensor.induction_on with + | hz => simp only [map_zero] + | ht m n => + change mk k A S T M N (e.symm (e m)) n = mk k A S T M N m n + rw [LinearEquiv.symm_apply_apply] + | ha x y hx hy => simp only [map_add,hx,hy] + right_inv z := by + change BalancedTensor.mapLeft (k := k) N e.toLinearMap + (BalancedTensor.mapLeft (k := k) N e.symm.toLinearMap z) = z + induction z using BalancedTensor.induction_on with + | hz => simp only [map_zero] + | ht m n => + change mk k A S T M' N (e (e.symm m)) n = mk k A S T M' N m n + rw [LinearEquiv.apply_symm_apply] + | ha x y hx hy => simp only [map_add,hx,hy] +end TwoSidedTensor +end LittleFinitistic + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryVertexCompression.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryVertexCompression.lean new file mode 100644 index 0000000000000000000000000000000000000000..1abdb213c0ac914b24f0c1ca17ad52c068d5e5da --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryVertexCompression.lean @@ -0,0 +1,80 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryCompression +import OAI.Algebra.Finitistic.Tensor.IdempotentTensor + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.OrdinarySimulation.Compression +universe u +variable {k A : Type u} [Field k] [Ring A] [Algebra k A] +variable (P : CochainComplex (ModuleCat.{u} A) ℤ) (a : ℤ) (l : ℕ) + +/-- Coordinate insertion is linear over the full coefficient algebra A. -/ +def insert (i : Fin (l+1)) : P.X (a+(i.val:ℤ)) →ₗ[A] Compression P a l := + LinearMap.single A (fun i : Fin (l+1) => P.X (a+(i.val:ℤ))) i + +def project (i : Fin (l+1)) : Compression P a l →ₗ[A] P.X (a+(i.val:ℤ)) := LinearMap.proj i + +theorem vertex_action (i : Fin (l+1)) (v : Compression P a l) : + ChainAlgebra.vertex k l i • v = insert P a l i (project P a l i v) := by + exact OrdinaryTerms.action_vertex (intervalTerms (underlyingComplex (k := k) P) a l) + (intervalDifferential (underlyingComplex (k := k) P) a l) i v + +/-- The vertex part is a submodule over A, hence retains both B-actions when A=B tensor B-op. -/ +def vertexSpace (i : Fin (l+1)) : Submodule A (Compression P a l) where + carrier := {v | ChainAlgebra.vertex k l i • v = v} + zero_mem' := smul_zero _ + add_mem' := by + intro x y hx hy + change ChainAlgebra.vertex k l i • (x+y) = x+y + rw [smul_add, hx, hy] + smul_mem' r v hv := by + change ChainAlgebra.vertex k l i • (r • v) = r • v + rw [smul_comm, hv] + +def vertexInsert (i : Fin (l+1)) : P.X (a+(i.val:ℤ)) →ₗ[A] vertexSpace (k := k) P a l i := + (insert P a l i).codRestrict _ (fun v => by + change ChainAlgebra.vertex k l i • insert P a l i v = insert P a l i v + rw [vertex_action] + congr 1 + change (Pi.single i v : ∀ j : Fin (l+1), P.X (a+(j.val:ℤ))) i = v + simp) + +/-- Actual A-linear identification of the compressed vertex with its original term. -/ +def vertexEquiv (i : Fin (l+1)) : vertexSpace (k := k) P a l i ≃ₗ[A] P.X (a+(i.val:ℤ)) where + __ := (project P a l i).comp (vertexSpace (k := k) P a l i).subtype + invFun := vertexInsert (k := k) P a l i + left_inv x := by + apply Subtype.ext + exact (vertex_action (k := k) P a l i x.val).symm.trans x.property + right_inv v := by + change (Pi.single i v : ∀ j : Fin (l+1), P.X (a+(j.val:ℤ))) i = v + simp + +/-- Change only the scalar description of the same actual vertex subspace. -/ +def vertexSpaceScalarEquiv (i : Fin (l+1)) : + IdempotentTensor.leftSpace (k := k) (ChainAlgebra.vertex k l i) (Compression P a l) ≃ₗ[k] + vertexSpace (k := k) P a l i where + toFun x := ⟨x.val,x.property⟩ + invFun x := ⟨x.val,x.property⟩ + left_inv _ := rfl + right_inv _ := rfl + map_add' _ _ := rfl + map_smul' _ _ := rfl + +/-- The genuine balanced tensor on a vertex projective evaluates to the original term. -/ +def vertexTensorEquiv (i : Fin (l+1)) : + BalancedTensor.Tensor k (ChainAlgebra k l) + (IdempotentTensor.rightIdeal (ChainAlgebra.vertex k l i)) (Compression P a l) ≃ₗ[k] + (underlyingComplex (k := k) P).X (a+(i.val:ℤ)) := by + letI (n : ℤ) : Module k (P.X n) := Module.compHom _ (algebraMap k A) + letI (n : ℤ) : IsScalarTower k A (P.X n) := IsScalarTower.of_compHom k A (P.X n) + exact (IdempotentTensor.tensorEquiv (k := k) (ChainAlgebra.vertex k l i) (Compression P a l) + (ChainAlgebra.vertex_idempotent k l i)).trans + ((vertexSpaceScalarEquiv (k := k) P a l i).trans + ((vertexEquiv (k := k) P a l i).restrictScalars k)) +end LittleFinitistic.OrdinarySimulation.Compression + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryXAugmentation.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryXAugmentation.lean new file mode 100644 index 0000000000000000000000000000000000000000..bbb7cdc982d9dd6cd326edb0aabeeadb42cead37 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryXAugmentation.lean @@ -0,0 +1,51 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryXResolution +import OAI.Algebra.Finitistic.Ordinary.OrdinaryOffDiagonalForget +import OAI.Algebra.Finitistic.Ordinary.OrdinaryOffDiagonalSingle +import OAI.Algebra.Finitistic.Ordinary.OrdinaryRetainedCongruence + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation.XResolution +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +variable (P : CochainComplex (ModuleCat.{u} (Enveloping k B)) ℤ) (a : ℤ) (l : ℕ) + +/-- The actual ordinary X, represented as a genuine D-bimodule. -/ +abbrev ordinaryXObject : ModuleCat.{u} ((AlgebraD k l B) ⊗[k] (AlgebraD k l B)ᵐᵒᵖ) := + RetainedBimodule.object k (AlgebraD k l B) (AlgebraD k l B) (BimoduleX P a l) + +def recoveredObjectIso : OffDiagonal.object k B (B ⊗[k] ChainAlgebra k l) + (ordinaryOObject P a l) (TensorResolution.bimoduleTerminalObject k B l) ≅ ordinaryXObject P a l := by + let eO := RetainedBimodule.rightEquiv k (B ⊗[k] ChainAlgebra k l) B (BimoduleO P a l) + let eT := RetainedBimodule.rightEquiv k B (B ⊗[k] ChainAlgebra k l) (TerminalTensor B) + let e := OffDiagonal.congr eO eT + have he (d : AlgebraD k l B) x : e (d • x) = d • e x := by + apply Prod.ext + · exact RetainedBimodule.rightEquiv_left k (B ⊗[k] ChainAlgebra k l) B (BimoduleO P a l) d.2 x.1 + · exact RetainedBimodule.rightEquiv_left k B (B ⊗[k] ChainAlgebra k l) (TerminalTensor B) d.1 x.2 + exact (RetainedBimodule.congr (k := k) e he).toModuleIso + +/-- The previous component target is exactly X in degree zero, with both D-actions. -/ +def targetIso : target P a l ≅ (HomologicalComplex.single _ (.up ℤ) 0).obj (ordinaryXObject P a l) := + OffDiagonal.singleIso k B (B ⊗[k] ChainAlgebra k l) (ordinaryOObject P a l) + (TensorResolution.bimoduleTerminalObject k B l) ≪≫ + (HomologicalComplex.single _ (.up ℤ) 0).mapIso (recoveredObjectIso P a l) + +def augmentationToX : complex P a l ⟶ + (HomologicalComplex.single _ (.up ℤ) 0).obj (ordinaryXObject P a l) := + augmentation P a l ≫ (targetIso P a l).hom + +/-- The actual bounded right-projective complex augments quasi-isomorphically to X. -/ +theorem augmentationToX_quasiIso : QuasiIso (augmentationToX P a l) := by + have := TensorResolution.integerBimoduleAugmentation_quasiIso k B l + have : QuasiIso (augmentation P a l) := OffDiagonal.complexMap_quasiIso k B (B ⊗[k] ChainAlgebra k l) + (𝟙 (ordinaryOComplex P a l)) (TensorResolution.integerBimoduleAugmentation k B l) + unfold augmentationToX + infer_instance +end LittleFinitistic.OrdinarySimulation.XResolution + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryXBlockComparison.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryXBlockComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..7b0376f8b7a4facf44f1a7ddbe658897cc9b0363 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryXBlockComparison.lean @@ -0,0 +1,55 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryXDerivedTensor +import OAI.Algebra.Finitistic.Ordinary.OrdinaryFirstBlockTotal +import OAI.Algebra.Finitistic.Ordinary.OrdinarySecondBlockTotal +import OAI.Algebra.Finitistic.Ordinary.OrdinarySingleTensorTotal +import OAI.Algebra.Finitistic.Ordinary.OrdinarySourceBimoduleTotal + +namespace OAI +noncomputable section +open CategoryTheory Limits +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation.XResolution +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +variable (P : CochainComplex (ModuleCat.{u} (Enveloping k B)) ℤ) (a : ℤ) (l : ℕ) + +/-- The first actual tensor application is exactly ordinary O tensor Z on the second block. -/ +def firstBlockComparison (Z : CochainComplex (ModuleCat.{u} B) ℤ) : + (tensorFunctor P a l).obj (BlockModule.firstComplex B (B ⊗[k] ChainAlgebra k l) Z) ≅ + BlockModule.secondComplex B (B ⊗[k] ChainAlgebra k l) + (middleLeftComplex k (B ⊗[k] ChainAlgebra k l) B (BimoduleO P a l) Z) := + BlockTensor.firstTotalIso k B (B ⊗[k] ChainAlgebra k l) (ordinaryOComplex P a l) + (TensorResolution.integerBimoduleComplex k B l) Z + (TensorResolution.finiteDegrees l) (TensorResolution.finiteDegrees_strictMono l) ≪≫ + ((ProductModules.secondInflation B (B ⊗[k] ChainAlgebra k l)).mapHomologicalComplex (.up ℤ)).mapIso + (SingleBimoduleTensor.totalIso k (B ⊗[k] ChainAlgebra k l) B (BimoduleO P a l) Z + (TensorResolution.finiteDegrees l) (TensorResolution.finiteDegrees_strictMono l) (Fin.last l) + (by simp [TensorResolution.finiteDegrees])) + +/-- The second actual tensor application selects Q_T and retains first-block support. -/ +def secondBlockComparison (Y : CochainComplex (ModuleCat.{u} (B ⊗[k] ChainAlgebra k l)) ℤ) : + (tensorFunctor P a l).obj (BlockModule.secondComplex B (B ⊗[k] ChainAlgebra k l) Y) ≅ + BlockModule.firstComplex B (B ⊗[k] ChainAlgebra k l) + (BimoduleComplexTensor.total k B (B ⊗[k] ChainAlgebra k l) (TensorResolution.integerBimoduleComplex k B l) Y + (TensorResolution.finiteDegrees l) (TensorResolution.finiteDegrees_strictMono l)) := + BlockTensor.secondTotalIso k B (B ⊗[k] ChainAlgebra k l) (ordinaryOComplex P a l) + (TensorResolution.integerBimoduleComplex k B l) Y + (TensorResolution.finiteDegrees l) (TensorResolution.finiteDegrees_strictMono l) + +/-- The complete actual chain-level square calculation, with the source support and outside action. -/ +def squareComparison (b : ℤ) (hb : a+(l:ℤ)=b) + (hP : ∀ n : ℤ, n < a ∨ b < n → IsZero (P.X n)) + (Z : CochainComplex (ModuleCat.{u} B) ℤ) : + (tensorFunctor P a l).obj ((tensorFunctor P a l).obj (BlockModule.firstComplex B (B ⊗[k] ChainAlgebra k l) Z)) ≅ + BlockModule.firstComplex B (B ⊗[k] ChainAlgebra k l) + (BimoduleComplexTensor.total k B B (P⟦b⟧) Z + (TensorResolution.finiteDegrees l) (TensorResolution.finiteDegrees_strictMono l)) := + (tensorFunctor P a l).mapIso (firstBlockComparison P a l Z) ≪≫ + secondBlockComparison P a l (middleLeftComplex k (B ⊗[k] ChainAlgebra k l) B (BimoduleO P a l) Z) ≪≫ + ((ProductModules.firstInflation B (B ⊗[k] ChainAlgebra k l)).mapHomologicalComplex (.up ℤ)).mapIso + (sourceBimoduleTotalComparison P a l b hb hP Z) +end LittleFinitistic.OrdinarySimulation.XResolution + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryXDerivedTensor.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryXDerivedTensor.lean new file mode 100644 index 0000000000000000000000000000000000000000..e868ab7d7a8295ff90b27bcb2fc166b5fd4212c0 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryXDerivedTensor.lean @@ -0,0 +1,43 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryXAugmentation +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleDerivedTensor + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.OrdinarySimulation.XResolution +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +variable (P : CochainComplex (ModuleCat.{u} (Enveloping k B)) ℤ) (a : ℤ) (l : ℕ) +variable [∀ n, Module.Projective Bᵐᵒᵖ ((underlyingRightComplex P).X n)] + +instance rightTerm_projective (n : ℤ) : Module.Projective (AlgebraD k l B)ᵐᵒᵖ + (ComplexTensor.rightTerm k (AlgebraD k l B) + (BimoduleComplexTensor.rightComplex k (AlgebraD k l B) (AlgebraD k l B) (complex P a l)) n) := + right_projective P a l n + +/-- Tensor with the actual right-projective Q_X on arbitrary input complexes of D-modules. -/ +abbrev tensorFunctor := BimoduleComplexTensor.totalFunctor k (AlgebraD k l B) (AlgebraD k l B) + (complex P a l) (TensorResolution.finiteDegrees l) (TensorResolution.finiteDegrees_strictMono l) + +theorem tensorFunctor_quasiIso {Z Z' : CochainComplex (ModuleCat.{u} (AlgebraD k l B)) ℤ} + (f : Z ⟶ Z') [QuasiIso f] : QuasiIso ((tensorFunctor P a l).map f) := + BimoduleComplexTensor.totalFunctor_quasiIso k (AlgebraD k l B) (AlgebraD k l B) + (complex P a l) (TensorResolution.finiteDegrees l) (TensorResolution.finiteDegrees_strictMono l) f + +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} (AlgebraD k l B))] + +/-- The derived endofunctor obtained from the actual bounded resolution of X. -/ +def derivedTensor : DerivedCategory (ModuleCat.{u} (AlgebraD k l B)) ⥤ + DerivedCategory (ModuleCat.{u} (AlgebraD k l B)) := + BimoduleComplexTensor.derivedTotal k (AlgebraD k l B) (AlgebraD k l B) (complex P a l) + (TensorResolution.finiteDegrees l) (TensorResolution.finiteDegrees_strictMono l) + +def derivedTensorComparison : DerivedCategory.Q ⋙ derivedTensor P a l ≅ + tensorFunctor P a l ⋙ DerivedCategory.Q := + BimoduleComplexTensor.derivedTotalComparison k (AlgebraD k l B) (AlgebraD k l B) (complex P a l) + (TensorResolution.finiteDegrees l) (TensorResolution.finiteDegrees_strictMono l) +end LittleFinitistic.OrdinarySimulation.XResolution + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryXResolution.lean b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryXResolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..528fb81633e48143292de0e4181377c863042c8d --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Ordinary/OrdinaryXResolution.lean @@ -0,0 +1,85 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryOffDiagonalComplexMaps +import OAI.Algebra.Finitistic.Ordinary.OrdinaryOffDiagonalProjective +import OAI.Algebra.Finitistic.Ordinary.OrdinaryRetainedRestriction +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleAugmentationQuasiIso +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBimoduleResolutionProjective +import OAI.Algebra.Finitistic.Ordinary.OrdinaryRightProjective + +namespace OAI +noncomputable section +open CategoryTheory Limits +open scoped TensorProduct +namespace LittleFinitistic.OrdinarySimulation.XResolution +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +variable (P : CochainComplex (ModuleCat.{u} (Enveloping k B)) ℤ) (a : ℤ) (l : ℕ) + +abbrev ordinaryOObject : ModuleCat.{u} ((B ⊗[k] ChainAlgebra k l) ⊗[k] Bᵐᵒᵖ) := + RetainedBimodule.object k (B ⊗[k] ChainAlgebra k l) B (BimoduleO P a l) + +abbrev ordinaryOComplex : CochainComplex (ModuleCat.{u} ((B ⊗[k] ChainAlgebra k l) ⊗[k] Bᵐᵒᵖ)) ℤ := + (HomologicalComplex.single _ (.up ℤ) 0).obj (ordinaryOObject P a l) + +/-- The manuscript's actual Q_X = O[0] ⊕ Q_T, with both D-actions retained. -/ +def complex := OffDiagonal.complex k B (B ⊗[k] ChainAlgebra k l) + (ordinaryOComplex P a l) (TensorResolution.integerBimoduleComplex k B l) + +abbrev target := OffDiagonal.complex k B (B ⊗[k] ChainAlgebra k l) + (ordinaryOComplex P a l) + ((HomologicalComplex.single _ (.up ℤ) 0).obj (TensorResolution.bimoduleTerminalObject k B l)) + +/-- The identity on O and the genuine terminal augmentation give a D-bimodule chain map. -/ +def augmentation : complex P a l ⟶ target P a l := + OffDiagonal.complexMap k B (B ⊗[k] ChainAlgebra k l) (𝟙 _) + (TensorResolution.integerBimoduleAugmentation k B l) + +theorem ordinaryOComplex_right_projective + [∀ n, Module.Projective Bᵐᵒᵖ ((underlyingRightComplex P).X n)] (n : ℤ) : + Module.Projective Bᵐᵒᵖ (BimoduleCoefficients k (B ⊗[k] ChainAlgebra k l) B + ((ordinaryOComplex P a l).X n)) := by + let F : ModuleCat.{u} ((B ⊗[k] ChainAlgebra k l) ⊗[k] Bᵐᵒᵖ) ⥤ ModuleCat.{u} Bᵐᵒᵖ := ModuleCat.restrictScalars + (Algebra.TensorProduct.includeRight (R := k) (A := B ⊗[k] ChainAlgebra k l) (B := Bᵐᵒᵖ)).toRingHom + by_cases hn : n = 0 + · subst n + have := ordinaryO_right_projective P a l + have : Module.Projective Bᵐᵒᵖ (F.obj (ordinaryOObject P a l)) := + Module.Projective.of_equiv (RetainedBimodule.rightEquiv k (B ⊗[k] ChainAlgebra k l) B (BimoduleO P a l)).symm + have : Projective (F.obj (ordinaryOObject P a l)) := ModuleCat.projective_of_categoryTheory_projective _ + have : Projective (F.obj ((ordinaryOComplex P a l).X 0)) := Projective.of_iso + (F.mapIso (HomologicalComplex.singleObjXSelf (.up ℤ) 0 (ordinaryOObject P a l))).symm inferInstance + exact ModuleCat.projective_of_module_projective (F.obj ((ordinaryOComplex P a l).X 0)) + · have hz := HomologicalComplex.isZero_single_obj_X (.up ℤ) 0 (ordinaryOObject P a l) n hn + have : Projective (F.obj ((ordinaryOComplex P a l).X n)) := (F.map_isZero hz).projective + exact ModuleCat.projective_of_module_projective (F.obj ((ordinaryOComplex P a l).X n)) + +/-- Every actual term of Q_X is right-D-projective; no left projectivity is assumed. -/ +theorem right_projective + [∀ n, Module.Projective Bᵐᵒᵖ ((underlyingRightComplex P).X n)] (n : ℤ) : + Module.Projective (AlgebraD k l B)ᵐᵒᵖ + (BimoduleCoefficients k (AlgebraD k l B) (AlgebraD k l B) ((complex P a l).X n)) := by + have := ordinaryOComplex_right_projective P a l n + have : Module.Projective (B ⊗[k] ChainAlgebra k l)ᵐᵒᵖ + (BimoduleCoefficients k B (B ⊗[k] ChainAlgebra k l) + ((TensorResolution.integerBimoduleComplex k B l).X n)) := + TensorResolution.integerBimoduleRight_projective k B l n + have := OffDiagonal.right_projective B (B ⊗[k] ChainAlgebra k l) + (BimoduleCoefficients k (B ⊗[k] ChainAlgebra k l) B ((ordinaryOComplex P a l).X n)) + (BimoduleCoefficients k B (B ⊗[k] ChainAlgebra k l) ((TensorResolution.integerBimoduleComplex k B l).X n)) + exact Module.Projective.of_equiv (RetainedBimodule.rightEquiv k (AlgebraD k l B) (AlgebraD k l B) _).symm + +/-- The support of the genuine resolution is exactly bounded by [-l,0]. -/ +theorem vanishes (n : ℤ) (hn : n < -(l:ℤ) ∨ 0 < n) : IsZero ((complex P a l).X n) := by + have hn0 : n ≠ 0 := by omega + have hO := HomologicalComplex.isZero_single_obj_X (.up ℤ) 0 (ordinaryOObject P a l) n hn0 + have hT : IsZero ((TensorResolution.integerBimoduleComplex k B l).X n) := hn.elim + (TensorResolution.integerBimodule_lower k B l n) (TensorResolution.integerBimodule_upper k B l n) + have := ModuleCat.isZero_iff_subsingleton.mp hO + have := ModuleCat.isZero_iff_subsingleton.mp hT + apply ModuleCat.isZero_iff_subsingleton.mpr + exact inferInstanceAs (Subsingleton (((ordinaryOComplex P a l).X n) × + ((TensorResolution.integerBimoduleComplex k B l).X n))) +end LittleFinitistic.OrdinarySimulation.XResolution + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/AdjacentArrowSum.lean b/lean/OAI/Algebra/Finitistic/Rectification/AdjacentArrowSum.lean new file mode 100644 index 0000000000000000000000000000000000000000..7022742a79592af83de83461e215d543cbfd96cb --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/AdjacentArrowSum.lean @@ -0,0 +1,86 @@ +import OAI.Algebra.Finitistic.Rectification.CornerArrowCoordinates +import OAI.Algebra.Finitistic.Rectification.TensorArrowSum + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +open scoped TensorProduct ModuleCat.Algebra +namespace LittleFinitistic.AdjacentArrowSum +universe u +variable {k V W U : Type u} [Field k] [AddCommGroup V] [Module k V] + [AddCommGroup W] [Module k W] [AddCommGroup U] [Module k U] +variable (μ : W →ₗ[k] V →ₗ[k] U) +variable (D : CochainComplex (ModuleCat.{u} (ThreeVertexAlgebra μ)ᵐᵒᵖ) ℤ) +local notation "T" => ThreeVertexAlgebra μ +local instance : HasFiniteBiproducts (CochainComplex (ModuleCat.{u} Tᵐᵒᵖ) ℤ) := + HasFiniteBiproducts.of_hasFiniteProducts +abbrev vertexComplex (v : Fin 3) := + (BimoduleVertex.functor k T (ThreeVertexAlgebra.vertex μ v)).mapHomologicalComplex (.up ℤ) + +def sourceIso (v : Fin 3) : + (vertexComplex μ v).obj ((ExternalTensor.Section4.columnComplex k T + (ThreeVertexAlgebra.vertex μ v)).obj D) ≅ + (TensorComplex.tensorFunctor (k := k) D).obj (ModuleCat.of k k) := + (CornerColumnComplex.complexIso μ v v D).symm ≪≫ + (TensorComplex.tensorFunctor (k := k) D).mapIso (CornerSpaces.diagonalEquiv μ v).toModuleIso + +def targetIso (v i : Fin 3) (d : ℕ) + (ξ : CornerSpaces.corner μ v i ≃ₗ[k] QuadraticEncoding.Arrows k d) : + (vertexComplex μ v).obj ((ExternalTensor.Section4.columnComplex k T + (ThreeVertexAlgebra.vertex μ i)).obj D) ≅ + (TensorComplex.tensorFunctor (k := k) D).obj (ModuleCat.of k (QuadraticEncoding.Arrows k d)) := + (CornerColumnComplex.complexIso μ v i D).symm ≪≫ + (TensorComplex.tensorFunctor (k := k) D).mapIso ξ.toModuleIso + +/-- An actual adjacent path family becomes the full arrow basis under corner coordinates. -/ +theorem desc_isIso (v i : Fin 3) (d : ℕ) + (ξ : CornerSpaces.corner μ v i ≃ₗ[k] QuadraticEncoding.Arrows k d) + (a : Fin (d+1) → ThreeVertexAlgebra μ) + (ha : ∀ j, a j * ThreeVertexAlgebra.vertex μ i = a j) + (hc : ∀ j c, ξ (CornerColumnPaths.cornerMap μ v i v (a j) (ha j) + ((CornerSpaces.diagonalEquiv μ v).symm c)) = c • QuadraticEncoding.basis j) : + IsIso (biproduct.desc (fun j => (vertexComplex μ v).map + (ExternalTensor.Section4.path k T (ThreeVertexAlgebra.vertex μ i) + (ThreeVertexAlgebra.vertex μ v) (a j) (ha j) D))) := by + let F := TensorComplex.tensorFunctor (k := k) D + apply TensorArrowSum.desc_isIso_of_coordinates k d F _ _ + (fun _ => sourceIso μ D v) (targetIso μ D v i d ξ) + intro j + have hm : ModuleCat.ofHom (CornerSpaces.diagonalEquiv μ v).toLinearMap ≫ + TensorArrowSum.insertion k d j = + ModuleCat.ofHom (CornerColumnPaths.cornerMap μ v i v (a j) (ha j)) ≫ + ModuleCat.ofHom ξ.toLinearMap := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + change (TensorArrowSum.insertion k d j).hom ((CornerSpaces.diagonalEquiv μ v) x) = + ξ (CornerColumnPaths.cornerMap μ v i v (a j) (ha j) x) + rw [TensorArrowSum.insertion_apply] + simpa only [LinearEquiv.symm_apply_apply] + using (hc j ((CornerSpaces.diagonalEquiv μ v) x)).symm + have hF := congrArg F.map hm + simp only [Functor.map_comp] at hF + apply (cancel_epi (CornerColumnComplex.complexIso μ v v D).hom).1 + calc + _ = F.map (ModuleCat.ofHom (CornerSpaces.diagonalEquiv μ v).toLinearMap) ≫ + F.map (TensorArrowSum.insertion k d j) := by + change (CornerColumnComplex.complexIso μ v v D).hom ≫ + ((CornerColumnComplex.complexIso μ v v D).inv ≫ + F.map (ModuleCat.ofHom (CornerSpaces.diagonalEquiv μ v).toLinearMap)) ≫ + F.map (TensorArrowSum.insertion k d j) = _ + erw [Category.assoc] + exact (CornerColumnComplex.complexIso μ v v D).hom_inv_id_assoc _ + _ = F.map (ModuleCat.ofHom (CornerColumnPaths.cornerMap μ v i v (a j) (ha j))) ≫ + F.map (ModuleCat.ofHom ξ.toLinearMap) := hF + _ = (F.map (ModuleCat.ofHom + (CornerColumnPaths.cornerMap μ v i v (a j) (ha j))) ≫ + (CornerColumnComplex.complexIso μ v i D).hom) ≫ + (targetIso μ D v i d ξ).hom := by simp [targetIso,F,TensorComplex.tensorFunctor] + _ = _ := by + erw [CornerColumnPaths.path_naturality] + exact Category.assoc _ _ _ +end LittleFinitistic.AdjacentArrowSum + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/ArrowCompatibility.lean b/lean/OAI/Algebra/Finitistic/Rectification/ArrowCompatibility.lean new file mode 100644 index 0000000000000000000000000000000000000000..7a4aeceae5a60831f3b46c815e23e1d37c7b4a37 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/ArrowCompatibility.lean @@ -0,0 +1,112 @@ +import OAI.Algebra.Finitistic.Rectification.ArrowVertex +import OAI.Algebra.Finitistic.Rectification.RectificationTotal +import Mathlib.Algebra.Category.ModuleCat.Biproducts + +namespace OAI +open CategoryTheory CategoryTheory.Limits HomologicalComplex +open scoped TensorProduct ModuleCat.Algebra +noncomputable section +namespace ExternalTensor.Section4.ArrowVertex +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] + +/-- Original insertion through the zero-column inclusion of the actual total. -/ +def iota {L₀ L₁ L₂ : BiComplex k B} (p : L₁ ⟶ L₀) (q : L₂ ⟶ L₁) + (h : Homotopy (q ≫ p) 0) (e : B) (he : e * e = e) + (D : RightComplex B) (t : (columnComplex k B e).obj D ⟶ L₀) : + D ⟶ (vertexComplex k B e).obj (LittleFinitistic.RectificationTotal.total p q h) := + diagonalComplex k B e he D ≫ (vertexComplex k B e).map + (t ≫ LittleFinitistic.RectificationTotal.inclusion p q h) + +/-- The insertion has exactly the manuscript's diagonal tensor, before any coordinates. -/ +@[simp] theorem iota_original {L₀ L₁ L₂ : BiComplex k B} + (p : L₁ ⟶ L₀) (q : L₂ ⟶ L₁) (h : Homotopy (q ≫ p) 0) + (e : B) (he : e * e = e) (D : RightComplex B) + (t : (columnComplex k B e).obj D ⟶ L₀) (n : ℤ) (x : D.X n) : + (((iota p q h e he D t).f n) x).val = + ((t ≫ LittleFinitistic.RectificationTotal.inclusion p q h).f n) + (generator B e ⊗ₜ[k] x) := rfl + +/-- The original p-boundary produces compatibility in the actual target vertex. -/ +def compatibility {L₀ L₁ L₂ : BiComplex k B} (p : L₁ ⟶ L₀) (q : L₂ ⟶ L₁) + (h : Homotopy (q ≫ p) 0) (ei ej a : B) (hei : ei * ei = ei) + (hej : ej * ej = ej) (hai : a * ei = a) (hja : ej * a = a) + {D E : RightComplex B} (f : D ⟶ E) + (t : (columnComplex k B ei).obj D ⟶ L₀) + (u : (columnComplex k B ej).obj E ⟶ L₀) + (w : (columnComplex k B ej).obj D ⟶ L₁) + (hw : w ≫ p = path k B ei ej a hai D ≫ t - (columnComplex k B ej).map f ≫ u) : + Homotopy + (iota p q h ei hei D t ≫ arrowComplex k B ei ej a hja + (LittleFinitistic.RectificationTotal.total p q h)) + (f ≫ iota p q h ej hej E u) := by + let inc := LittleFinitistic.RectificationTotal.inclusion p q h + let F := vertexComplex k B ej + have hb := (LittleFinitistic.RectificationTotal.boundaryHomotopy p q h).compLeft w + have hh := ((vertex k B ej).mapHomotopy hb).compLeft (diagonalComplex k B ej hej D) + have heq : diagonalComplex k B ej hej D ≫ F.map (w ≫ p ≫ inc) = + iota p q h ei hei D t ≫ arrowComplex k B ei ej a hja + (LittleFinitistic.RectificationTotal.total p q h) - + f ≫ iota p q h ej hej E u := by + rw [← Category.assoc w p inc, hw, Preadditive.sub_comp, Functor.map_sub, + Preadditive.comp_sub] + apply congrArg₂ (fun x y => x - y) + · change diagonalComplex k B ej hej D ≫ + (vertexComplex k B ej).map ((path k B ei ej a hai D ≫ t) ≫ inc) = _ + rw [Category.assoc, Functor.map_comp, ← Category.assoc, + diagonal_path k B ei ej a hei hej hai hja D, Category.assoc, + ← arrow_naturality] + rfl + · change diagonalComplex k B ej hej D ≫ + (vertexComplex k B ej).map (((columnComplex k B ej).map f ≫ u) ≫ inc) = _ + rw [Category.assoc, Functor.map_comp, ← Category.assoc, ← diagonal_naturality] + rfl + refine Homotopy.equivSubZero.symm ?_ + change Homotopy (diagonalComplex k B ej hej D ≫ F.map (w ≫ p ≫ inc)) + (diagonalComplex k B ej hej D ≫ F.map (w ≫ 0)) at hh + rw [comp_zero, Functor.map_zero, comp_zero, heq] at hh + exact hh + +variable {A J R : Type} [Fintype A] [Fintype J] [Fintype R] +variable (s : Quadratic k B (A := A) (J := J) (R := R)) +variable (D₀ D₁ D₂ : RightComplex B) +variable (f : A → (D₀ ⟶ D₁)) (g : J → (D₁ ⟶ D₂)) +variable (H : ∀ r, Homotopy (relationMap s D₀ D₁ D₂ f g r) 0) + +abbrev actualP : BiComplex k B := LittleFinitistic.RectificationTotal.total + (p s D₀ D₁ D₂ f g) (q s D₀ D₁ D₂ f g) (nullHomotopy s D₀ D₁ D₂ f g H) + +abbrev iota0 (he : s.e₀ * s.e₀ = s.e₀) := + iota (p s D₀ D₁ D₂ f g) (q s D₀ D₁ D₂ f g) (nullHomotopy s D₀ D₁ D₂ f g H) + s.e₀ he D₀ (inducedData s D₀ D₁ D₂ f g).in₀ +abbrev iota1 (he : s.e₁ * s.e₁ = s.e₁) := + iota (p s D₀ D₁ D₂ f g) (q s D₀ D₁ D₂ f g) (nullHomotopy s D₀ D₁ D₂ f g H) + s.e₁ he D₁ (inducedData s D₀ D₁ D₂ f g).in₁ +abbrev iota2 (he : s.e₂ * s.e₂ = s.e₂) := + iota (p s D₀ D₁ D₂ f g) (q s D₀ D₁ D₂ f g) (nullHomotopy s D₀ D₁ D₂ f g H) + s.e₂ he D₂ (inducedData s D₀ D₁ D₂ f g).in₂ + +/-- Compatibility of the actual original vertex-zero insertion with every 0-to-1 arrow. -/ +def compatibility01 (h₀ : s.e₀ * s.e₀ = s.e₀) (h₁ : s.e₁ * s.e₁ = s.e₁) + (a : A) (ha : s.e₁ * s.a a = s.a a) : + Homotopy (iota0 s D₀ D₁ D₂ f g H h₀ ≫ + arrowComplex k B s.e₀ s.e₁ (s.a a) ha (actualP s D₀ D₁ D₂ f g H)) + (f a ≫ iota1 s D₀ D₁ D₂ f g H h₁) := + compatibility _ _ _ _ _ _ h₀ h₁ (s.ha a) ha (f a) _ _ + (biproduct.ι (inducedData s D₀ D₁ D₂ f g).U a ≫ biprod.inl) + (p_arrow01 s D₀ D₁ D₂ f g a) + +/-- Compatibility of the actual original vertex-one insertion with every 1-to-2 arrow. -/ +def compatibility12 (h₁ : s.e₁ * s.e₁ = s.e₁) (h₂ : s.e₂ * s.e₂ = s.e₂) + (b : J) (hb : s.e₂ * s.b b = s.b b) : + Homotopy (iota1 s D₀ D₁ D₂ f g H h₁ ≫ + arrowComplex k B s.e₁ s.e₂ (s.b b) hb (actualP s D₀ D₁ D₂ f g H)) + (g b ≫ iota2 s D₀ D₁ D₂ f g H h₂) := + compatibility _ _ _ _ _ _ h₁ h₂ (s.hb b) hb (g b) _ _ + (biproduct.ι (inducedData s D₀ D₁ D₂ f g).V b ≫ biprod.inr) + (p_arrow12 s D₀ D₁ D₂ f g b) +end ExternalTensor.Section4.ArrowVertex + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/ArrowVertex.lean b/lean/OAI/Algebra/Finitistic/Rectification/ArrowVertex.lean new file mode 100644 index 0000000000000000000000000000000000000000..48a4987391518d37b66d007a0271c0447c6083b8 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/ArrowVertex.lean @@ -0,0 +1,162 @@ +import OAI.Algebra.Finitistic.Rectification.ColumnProperties + +namespace OAI +open CategoryTheory CategoryTheory.Limits HomologicalComplex +open scoped TensorProduct ModuleCat.Algebra +noncomputable section +namespace ExternalTensor.Section4.ArrowVertex +attribute [local instance] ExternalTensor.bimodule ExternalTensor.rightModule +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] + +/-- Left multiplication on a bimodule, regarded as a right-linear map. -/ +def left (a : B) (N : ModuleCat.{u} (Enveloping k B)) : + (forgetRight k B).obj N →ₗ[Bᵐᵒᵖ] (forgetRight k B).obj N where + toFun x := (a ⊗ₜ[k] (1 : Bᵐᵒᵖ)) • (show N from x) + map_add' x y := smul_add (a ⊗ₜ[k] (1 : Bᵐᵒᵖ)) (show N from x) (show N from y) + map_smul' c x := by + change (a ⊗ₜ[k] (1 : Bᵐᵒᵖ)) • ((1 ⊗ₜ[k] c : Enveloping k B) • (show N from x)) = + (1 ⊗ₜ[k] c : Enveloping k B) • ((a ⊗ₜ[k] (1 : Bᵐᵒᵖ)) • (show N from x)) + erw [← mul_smul, ← mul_smul] + simp only [Algebra.TensorProduct.tmul_mul_tmul, mul_one, one_mul] + +@[simp] theorem left_mul (a b : B) (N : ModuleCat.{u} (Enveloping k B)) + (x : (forgetRight k B).obj N) : left k B (a * b) N x = left k B a N (left k B b N x) := by + change ((a * b) ⊗ₜ[k] (1 : Bᵐᵒᵖ)) • (show N from x) = + (a ⊗ₜ[k] (1 : Bᵐᵒᵖ)) • ((b ⊗ₜ[k] (1 : Bᵐᵒᵖ)) • (show N from x)) + erw [← mul_smul] + simp only [Algebra.TensorProduct.tmul_mul_tmul, mul_one] + +@[simp] theorem map_left {N N' : ModuleCat.{u} (Enveloping k B)} + (f : N ⟶ N') (a : B) (x : (forgetRight k B).obj N) : + (forgetRight k B).map f (left k B a N x) = + left k B a N' ((forgetRight k B).map f x) := f.hom.map_smul _ _ + +/-- The actual fixed submodule eN, for an idempotent e. -/ +def space (e : B) (N : ModuleCat.{u} (Enveloping k B)) : + Submodule Bᵐᵒᵖ ((forgetRight k B).obj N) := + LinearMap.ker (left k B e N - LinearMap.id) + +@[simp] theorem mem_space (e : B) (N : ModuleCat.{u} (Enveloping k B)) + (x : (forgetRight k B).obj N) : x ∈ space k B e N ↔ left k B e N x = x := by + simp [space, LinearMap.mem_ker, sub_eq_zero] + +/-- For idempotents the fixed submodule is exactly the image eN. -/ +theorem space_eq_range (e : B) (he : e * e = e) + (N : ModuleCat.{u} (Enveloping k B)) : + space k B e N = (left k B e N).range := by + ext x + rw [mem_space, LinearMap.mem_range] + constructor + · intro hx + exact ⟨x, hx⟩ + · rintro ⟨y, rfl⟩ + rw [← left_mul, he] + +/-- Vertex restriction retains the original elements, rather than chosen coordinates. -/ +def vertex (e : B) : ModuleCat.{u} (Enveloping k B) ⥤ ModuleCat.{u} Bᵐᵒᵖ where + obj N := ModuleCat.of _ (space k B e N) + map f := ModuleCat.ofHom + { toFun x := ⟨(forgetRight k B).map f x.val, by + rw [mem_space, ← map_left, (mem_space k B e _ _).1 x.property]⟩ + map_add' x y := Subtype.ext (map_add _ _ _) + map_smul' c x := Subtype.ext (map_smul _ _ _) } + map_id N := by ext x; rfl + map_comp f g := by ext x; rfl +instance vertex_additive (e : B) : (vertex k B e).Additive where + map_add := by intros; ext x; rfl + +abbrev vertexComplex (e : B) : BiComplex k B ⥤ RightComplex B := + (vertex k B e).mapHomologicalComplex (ComplexShape.up ℤ) + +/-- The intervertex map is precisely left multiplication by a. -/ +def arrow (ei ej a : B) (hja : ej * a = a) : vertex k B ei ⟶ vertex k B ej where + app N := ModuleCat.ofHom + { toFun x := ⟨left k B a N x.val, by + rw [mem_space, ← left_mul, hja]⟩ + map_add' x y := Subtype.ext (map_add _ _ _) + map_smul' c x := Subtype.ext (map_smul _ _ _) } + naturality {N N'} f := by ext x; apply Subtype.ext; exact (map_left k B f a x.val).symm + +abbrev arrowComplex (ei ej a : B) (hja : ej * a = a) (P : BiComplex k B) : + (vertexComplex k B ei).obj P ⟶ (vertexComplex k B ej).obj P := + ((arrow k B ei ej a hja).mapHomologicalComplex (ComplexShape.up ℤ)).app P + +@[simp] theorem arrow_original (ei ej a : B) (hja : ej * a = a) + (P : BiComplex k B) (n : ℤ) (x : ((vertexComplex k B ei).obj P).X n) : + (((arrowComplex k B ei ej a hja P).f n) x).val = + (a ⊗ₜ[k] (1 : Bᵐᵒᵖ)) • (show P.X n from x.val) := rfl + +/-- Composition uses multiplication in B in the original arrow order. -/ +@[reassoc] theorem arrow_comp (ei ej el a b : B) (hja : ej * a = a) + (hlb : el * b = b) (hlba : el * (b * a) = b * a) (P : BiComplex k B) : + arrowComplex k B ei ej a hja P ≫ arrowComplex k B ej el b hlb P = + arrowComplex k B ei el (b * a) hlba P := by + ext n x + apply Subtype.ext + exact (left_mul k B b a (P.X n) x.val).symm + +/-- The trivial path acts as the identity on its vertex. -/ +@[simp] theorem arrow_id (e : B) (he : e * e = e) (P : BiComplex k B) : + arrowComplex k B e e e he P = 𝟙 ((vertexComplex k B e).obj P) := by + ext n x + apply Subtype.ext + exact (mem_space k B e (P.X n) x.val).1 x.property + +/-- The original diagonal tensor e tensor n in its actual fixed submodule. -/ +def diagonal (e : B) (he : e * e = e) : + 𝟭 (ModuleCat.{u} Bᵐᵒᵖ) ⟶ columnFunctor k B e ⋙ vertex k B e where + app N := ModuleCat.ofHom + { toFun n := ⟨generator B e ⊗ₜ[k] n, by + erw [mem_space] + change (e • generator B e) ⊗ₜ[k] ((1 : Bᵐᵒᵖ) • n) = generator B e ⊗ₜ[k] n + rw [one_smul] + congr 1 + exact Subtype.ext he⟩ + map_add' x y := Subtype.ext (TensorProduct.tmul_add _ _ _) + map_smul' c x := by + apply Subtype.ext + change generator B e ⊗ₜ[k] (c • x) = + (1 ⊗ₜ[k] c : Enveloping k B) • (generator B e ⊗ₜ[k] x) + rw [ExternalTensor.smul_tmul, one_smul] } + naturality {N N'} f := by ext x; rfl + +/-- Original insertion into a single induced column, degree by degree. -/ +def diagonalComplex (e : B) (he : e * e = e) (D : RightComplex B) : + D ⟶ (vertexComplex k B e).obj ((columnComplex k B e).obj D) where + f n := (diagonal k B e he).app (D.X n) + comm' i j _hij := (diagonal k B e he).naturality (D.d i j) + +@[reassoc] theorem diagonal_naturality (e : B) (he : e * e = e) + {D E : RightComplex B} (f : D ⟶ E) : + f ≫ diagonalComplex k B e he E = diagonalComplex k B e he D ≫ + (vertexComplex k B e).map ((columnComplex k B e).map f) := by + ext n x + rfl + +/-- Right multiplication in p at e_j agrees with left arrow action at e_i. -/ +@[reassoc] theorem diagonal_path (ei ej a : B) (hei : ei * ei = ei) + (hej : ej * ej = ej) (hai : a * ei = a) (hja : ej * a = a) + (D : RightComplex B) : + diagonalComplex k B ej hej D ≫ (vertexComplex k B ej).map (path k B ei ej a hai D) = + diagonalComplex k B ei hei D ≫ + arrowComplex k B ei ej a hja ((columnComplex k B ei).obj D) := by + ext n x + apply Subtype.ext + change (pathMap ei ej a hai (generator B ej)) ⊗ₜ[k] x = + (a • generator B ei) ⊗ₜ[k] ((1 : Bᵐᵒᵖ) • x) + rw [one_smul] + congr 1 + apply Subtype.ext + exact hja.trans hai.symm + +@[reassoc] theorem arrow_naturality (ei ej a : B) (hja : ej * a = a) + {P Q : BiComplex k B} (f : P ⟶ Q) : + (vertexComplex k B ei).map f ≫ arrowComplex k B ei ej a hja Q = + arrowComplex k B ei ej a hja P ≫ (vertexComplex k B ej).map f := + ((arrow k B ei ej a hja).mapHomologicalComplex (ComplexShape.up ℤ)).naturality f +end ExternalTensor.Section4.ArrowVertex + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/BiprodEvaluationSquare.lean b/lean/OAI/Algebra/Finitistic/Rectification/BiprodEvaluationSquare.lean new file mode 100644 index 0000000000000000000000000000000000000000..7b7548b9489b1b729e38ccb2dcf4dda0977bb4ef --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/BiprodEvaluationSquare.lean @@ -0,0 +1,45 @@ +import OAI.Algebra.Finitistic.Localization.FormalSummandAction +import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Biproducts + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits CategoryTheory.Idempotents +namespace LittleFinitistic.BiprodEvaluationSquare +universe u v w z +variable {C : Type u} [Category.{v} C] [Preadditive C] [HasBinaryBiproducts C] +variable {D : Type w} [Category.{z} D] [Preadditive D] [HasBinaryBiproducts D] +variable (F : C ⥤ D) [F.Additive] [PreservesBinaryBiproducts F] + +/-- Transport both diagonal actions through additive evaluation and given summand isomorphisms. -/ +theorem square {A B : C} {A' B' : D} (f : A ⟶ A) (g : B ⟶ B) + (i : F.obj A ≅ A') (j : F.obj B ≅ B') (f' : A' ⟶ A') (g' : B' ⟶ B') + (hf : F.map f ≫ i.hom = i.hom ≫ f') (hg : F.map g ≫ j.hom = j.hom ≫ g') : + F.map (biprod.map f g) ≫ (F.mapBiprod A B ≪≫ biprod.mapIso i j).hom = + (F.mapBiprod A B ≪≫ biprod.mapIso i j).hom ≫ biprod.map f' g' := by + apply biprod.hom_ext + · simp only [Iso.trans_hom,Functor.mapBiprod_hom,biprod.mapIso_hom, + Category.assoc,biprod.map_fst,biprod.map_fst_assoc,biprod.lift_fst_assoc] + rw [← Category.assoc,← Functor.map_comp,biprod.map_fst,Functor.map_comp,Category.assoc,hf] + · simp only [Iso.trans_hom,Functor.mapBiprod_hom,biprod.mapIso_hom, + Category.assoc,biprod.map_snd,biprod.map_snd_assoc,biprod.lift_snd_assoc] + rw [← Category.assoc,← Functor.map_comp,biprod.map_snd,Functor.map_comp,Category.assoc,hg] + +variable {k R : Type*} [CommRing k] [Ring R] [Algebra k R] +variable [Linear k C] [HasShift C ℤ] [HasZeroObject C] + [∀ n : ℤ,(shiftFunctor C n).Additive] [Pretriangulated C] + [∀ n : ℤ,(shiftFunctor C n).Linear k] +variable {L : C} (theta : R →ₐ[k] End L) (e : R) (he : e*e=e) + (hc : ∀ r : R,e*r=r*e) (alpha : R →ₐ[k] R) +local instance : HasFiniteBiproducts (Karoubi C) := Karoubi.karoubi_hasFiniteBiproducts +local instance : HasBinaryBiproducts (Karoubi C) := hasBinaryBiproducts_of_finite_biproducts _ + +omit [HasBinaryBiproducts C] in +theorem action_formula (r : R) : + FormalSummandAction.oddDoubleAction theta e he hc alpha r = + biprod.map (FormalSummandAction.action theta e he hc alpha r) + ((OddDouble.formalShiftFunctor 3).map (FormalSummandAction.action theta e he hc alpha r)) := rfl +end LittleFinitistic.BiprodEvaluationSquare + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/CanonicalArrowCompatibility.lean b/lean/OAI/Algebra/Finitistic/Rectification/CanonicalArrowCompatibility.lean new file mode 100644 index 0000000000000000000000000000000000000000..b6b87a74cd00ea00e9955126267cf01b487d313d --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/CanonicalArrowCompatibility.lean @@ -0,0 +1,71 @@ +import OAI.Algebra.Finitistic.Localization.NativeArrowBridge +import OAI.Algebra.Finitistic.Rectification.VertexHomotopyEquivalence + +namespace OAI +noncomputable section +open CategoryTheory HomologicalComplex +open scoped TensorProduct +namespace LittleFinitistic.CanonicalArrowCompatibility +open ExternalTensor.Section4 ExternalTensor.Section4.ArrowVertex +open QuadraticEncoding +universe u +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) + +lemma diagonal_original (i : Fin 3) (D : RightComplex (B P)) : + (VertexColumnComplex.diagonalComplexIso (composition P) i D).hom = + diagonalComplex k (B P) (ThreeVertexAlgebra.vertex (composition P) i) + ((ThreeVertexAlgebra.directedSystem (composition P)).idem i) D := by + apply NativeBridge.diagonal_eq_of_original + intro n x + exact VertexColumnModels.diagonal_symm_val (composition P) (D.X n) i x + +variable (D₀ D₁ D₂ : RightComplex (B P)) +variable (f : Fin (d+1) → (D₀ ⟶ D₁)) (g : Fin (d+1) → (D₁ ⟶ D₂)) +variable (H : ∀ r, Homotopy (relationMap (ConcreteQuadraticDiagram.quadratic P) D₀ D₁ D₂ f g r) 0) + +lemma arrow01_target (a : Fin (d+1)) : + ThreeVertexAlgebra.vertex (composition P) 1 * arrow01 P a = arrow01 P a := by + change ThreeVertexAlgebra.mul (composition P) (0,1,0,0,0,0) (0,0,0,basis a,0,0) = _ + simp [ThreeVertexAlgebra.mul, arrow01] + +lemma arrow12_target (b : Fin (d+1)) : + ThreeVertexAlgebra.vertex (composition P) 2 * arrow12 P b = arrow12 P b := by + change ThreeVertexAlgebra.mul (composition P) (0,0,1,0,0,0) (0,0,0,0,basis b,0) = _ + simp [ThreeVertexAlgebra.mul, arrow12] + +/-- Left multiplication by the original first arrow on the actual vertex complexes. -/ +def arrow01Map (a : Fin (d+1)) := + arrowComplex k (B P) (ThreeVertexAlgebra.vertex (composition P) 0) + (ThreeVertexAlgebra.vertex (composition P) 1) (arrow01 P a) (arrow01_target P a) + (InducedRectification.total (ConcreteQuadraticDiagram.quadratic P) D₀ D₁ D₂ f g H) + +/-- Left multiplication by the original second arrow on the actual vertex complexes. -/ +def arrow12Map (b : Fin (d+1)) := + arrowComplex k (B P) (ThreeVertexAlgebra.vertex (composition P) 1) + (ThreeVertexAlgebra.vertex (composition P) 2) (arrow12 P b) (arrow12_target P b) + (InducedRectification.total (ConcreteQuadraticDiagram.quadratic P) D₀ D₁ D₂ f g H) + +/-- The homotopy uses exactly the original first and second vertex equivalences. -/ +def compatibility01 (a : Fin (d+1)) : Homotopy + (FirstVertex.iota P D₀ D₁ D₂ f g H ≫ arrow01Map P D₀ D₁ D₂ f g H a) + (f a ≫ SecondVertex.iota P D₀ D₁ D₂ f g H) := by + rw [FirstVertex.iota, SecondVertex.iota_original, + diagonal_original, diagonal_original] + exact NativeBridge.nativeCompatibility01 (ConcreteQuadraticDiagram.quadratic P) + D₀ D₁ D₂ f g H ((ThreeVertexAlgebra.directedSystem (composition P)).idem 0) + ((ThreeVertexAlgebra.directedSystem (composition P)).idem 1) a (arrow01_target P a) + +/-- The homotopy uses exactly the original second and third vertex equivalences. -/ +def compatibility12 (b : Fin (d+1)) : Homotopy + (SecondVertex.iota P D₀ D₁ D₂ f g H ≫ arrow12Map P D₀ D₁ D₂ f g H b) + (g b ≫ ThirdVertex.iota P D₀ D₁ D₂ f g H) := by + rw [SecondVertex.iota_original, ThirdVertex.iota_original, + diagonal_original, diagonal_original] + exact NativeBridge.nativeCompatibility12 (ConcreteQuadraticDiagram.quadratic P) + D₀ D₁ D₂ f g H ((ThreeVertexAlgebra.directedSystem (composition P)).idem 1) + ((ThreeVertexAlgebra.directedSystem (composition P)).idem 2) b (arrow12_target P b) +end LittleFinitistic.CanonicalArrowCompatibility + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/ColumnComplex.lean b/lean/OAI/Algebra/Finitistic/Rectification/ColumnComplex.lean new file mode 100644 index 0000000000000000000000000000000000000000..ea5780b27ce3255ac41f3a5928842f788ba65e44 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/ColumnComplex.lean @@ -0,0 +1,132 @@ +import OAI.Algebra.Finitistic.Rectification.InducedColumns +import Mathlib.Algebra.Category.ModuleCat.Limits +import Mathlib.Algebra.Homology.Homotopy +import Mathlib.Algebra.Homology.HomologicalComplexLimits + +namespace OAI +open CategoryTheory CategoryTheory.Limits HomologicalComplex +open scoped TensorProduct ModuleCat.Algebra +noncomputable section +namespace ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] + +instance rightModuleK (N : ModuleCat.{u} Bᵐᵒᵖ) : Module k N := + Module.compHom N (algebraMap k Bᵐᵒᵖ) +instance rightModuleTower (N : ModuleCat.{u} Bᵐᵒᵖ) : IsScalarTower k Bᵐᵒᵖ N where + smul_assoc r b n := by + change (r • b) • n = (algebraMap k Bᵐᵒᵖ r) • (b • n) + rw [Algebra.smul_def, mul_smul] +attribute [local instance] ExternalTensor.bimodule ExternalTensor.rightModule + +abbrev Enveloping := B ⊗[k] Bᵐᵒᵖ +abbrev RightComplex := CochainComplex (ModuleCat.{u} Bᵐᵒᵖ) ℤ +abbrev BiComplex := CochainComplex (ModuleCat.{u} (Enveloping k B)) ℤ + +/-- Induction by the actual left ideal Be, on right modules and maps. -/ +def columnFunctor (e : B) : ModuleCat.{u} Bᵐᵒᵖ ⥤ ModuleCat.{u} (Enveloping k B) where + obj N := ModuleCat.of _ (Column k B N e) + map f := ModuleCat.ofHom (columnMap k e f.hom) + map_id N := by apply ModuleCat.hom_ext; exact map_id + map_comp f g := by + apply ModuleCat.hom_ext + simpa [columnMap] using (map_comp (k := k) (LinearMap.id) (LinearMap.id) f.hom g.hom) +instance columnFunctor_additive (e : B) : (columnFunctor k B e).Additive where + map_add := by intros; apply ModuleCat.hom_ext; exact map_add_right _ _ _ + +instance columnFunctor_linear (e : B) : (columnFunctor k B e).Linear k where + map_smul f r := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + change ExternalTensor.map (k := k) LinearMap.id (r • f.hom) x = + (algebraMap k (Enveloping k B) r) • (columnMap k e f.hom x) + rw [map_smul_right] + exact (IsScalarTower.algebraMap_smul (Enveloping k B) r _).symm + +abbrev columnComplex (e : B) : RightComplex B ⥤ BiComplex k B := + (columnFunctor k B e).mapHomologicalComplex (ComplexShape.up ℤ) + +/-- Right multiplication on the left tensor factor, natural in the right module. -/ +def pathNat (ei ej a : B) (ha : a * ei = a) : + columnFunctor k B ej ⟶ columnFunctor k B ei where + app N := ModuleCat.ofHom (columnPath k ei ej a ha) + naturality {N N'} f := by + apply ModuleCat.hom_ext + ext x + induction x using TensorProduct.inductionOn with + | tmul c n => rfl + | add x y hx hy => + exact (map_add _ _ _).trans ((congrArg₂ (· + ·) hx hy).trans (map_add _ _ _).symm) + +abbrev path (ei ej a : B) (ha : a * ei = a) (D : RightComplex B) : + (columnComplex k B ej).obj D ⟶ (columnComplex k B ei).obj D := + ((pathNat k B ei ej a ha).mapHomologicalComplex (ComplexShape.up ℤ)).app D + +@[reassoc] theorem path_naturality (ei ej a : B) (ha : a * ei = a) + {D E : RightComplex B} (f : D ⟶ E) : + (columnComplex k B ej).map f ≫ path k B ei ej a ha E = + path k B ei ej a ha D ≫ (columnComplex k B ei).map f := + ((pathNat k B ei ej a ha).mapHomologicalComplex (ComplexShape.up ℤ)).naturality f + +@[simp] theorem sum_f {C D : BiComplex k B} {I : Type} (s : Finset I) + (f : I → (C ⟶ D)) (n : ℤ) : (∑ i ∈ s, f i).f n = ∑ i ∈ s, (f i).f n := + map_sum (Hom.fAddMonoidHom n) f s + +@[simp] theorem sum_hom {S : Type*} [Ring S] {X Y : ModuleCat S} + {I : Type} (s : Finset I) (f : I → (X ⟶ Y)) : + (∑ i ∈ s, f i).hom = ∑ i ∈ s, (f i).hom := + map_sum ModuleCat.homAddEquiv f s + +private theorem sum_smul_component_apply {R : Type u} [Ring R] [Algebra k R] + {K L : CochainComplex (ModuleCat.{u} R) ℤ} {I J : Type} [Fintype I] [Fintype J] + (r : I → J → k) (f : I → J → (K ⟶ L)) (n : ℤ) (x : K.X n) : + ((∑ i, ∑ j, r i j • f i j).f n).hom x = + ∑ i, ∑ j, algebraMap k R (r i j) • ((f i j).f n).hom x := by + have eval_sum {I : Type} (s : Finset I) (g : I → (K ⟶ L)) : + (∑ i ∈ s, g i).f n = ∑ i ∈ s, (g i).f n := + map_sum (Hom.fAddMonoidHom n) g s + simp only [eval_sum, smul_f_apply, ModuleCat.hom_sum, + ModuleCat.hom_smul, LinearMap.sum_apply, LinearMap.smul_apply] + rfl + +/-- The vertex-zero component vanishes by the actual quadratic relation in B. -/ +theorem paths_relation {A J : Type} [Fintype A] [Fintype J] + (e₀ e₁ e₂ : B) (a : A → B) (b : J → B) + (ha : ∀ i, a i * e₀ = a i) (hb : ∀ j, b j * e₁ = b j) + (r : A → J → k) (hr : ∑ i, ∑ j, r i j • (b j * a i) = 0) + (D : RightComplex B) : + ∑ i, ∑ j, r i j • (path k B e₁ e₂ (b j) (hb j) D ≫ + path k B e₀ e₁ (a i) (ha i) D) = 0 := by + apply Hom.ext + funext n + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + induction x using TensorProduct.inductionOn with + | add x y hx hy => + exact (map_add _ _ _).trans ((congrArg₂ (· + ·) hx hy).trans (map_add _ _ _).symm) + | tmul c v => + erw [sum_smul_component_apply] + change (∑ i, ∑ j, (algebraMap k (Enveloping k B) (r i j)) • + ((pathMap e₀ e₁ (a i) (ha i) (pathMap e₁ e₂ (b j) (hb j) c)) ⊗ₜ[k] v)) = 0 + simp only [IsScalarTower.algebraMap_smul, TensorProduct.smul_tmul', + ← TensorProduct.sum_tmul] + have hz : (∑ i, ∑ j, r i j • + pathMap e₀ e₁ (a i) (ha i) (pathMap e₁ e₂ (b j) (hb j) c)) = 0 := by + apply Subtype.ext + change ((leftIdeal B e₀).subtype.restrictScalars k) + (∑ i, ∑ j, r i j • pathMap e₀ e₁ (a i) (ha i) + (pathMap e₁ e₂ (b j) (hb j) c)) = 0 + simp only [map_sum, map_smul, LinearMap.restrictScalars_apply, + Submodule.subtype_apply, pathMap_apply] + calc + _ = (c : B) * (∑ i, ∑ j, r i j • (b j * a i)) := by + simp only [Finset.mul_sum, Algebra.mul_smul_comm, mul_assoc] + _ = 0 := by rw [hr, mul_zero] + rw [hz, TensorProduct.zero_tmul] +end ExternalTensor.Section4 + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/ColumnFinite.lean b/lean/OAI/Algebra/Finitistic/Rectification/ColumnFinite.lean new file mode 100644 index 0000000000000000000000000000000000000000..79cd5c8bb94831bf3b71cc0f356e02b1615ff38e --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/ColumnFinite.lean @@ -0,0 +1,109 @@ +import OAI.Algebra.Finitistic.Rectification.ColumnProperties +import Mathlib.Algebra.Category.ModuleCat.Biproducts + +namespace OAI +open CategoryTheory CategoryTheory.Limits HomologicalComplex +open scoped TensorProduct ModuleCat.Algebra +noncomputable section +namespace ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] +attribute [local instance] ExternalTensor.bimodule ExternalTensor.rightModule + +def forgetK : ModuleCat.{u} (Enveloping k B) ⥤ ModuleCat.{u} k := + ModuleCat.restrictScalars (algebraMap k (Enveloping k B)) +instance forgetK_additive : (forgetK k B).Additive := by + dsimp [forgetK] + infer_instance + +def columnKIso (e : B) (N : ModuleCat.{u} Bᵐᵒᵖ) : + (forgetK k B).obj ((columnFunctor k B e).obj N) ≅ + ModuleCat.of k (Column k B N e) := + (show ((forgetK k B).obj ((columnFunctor k B e).obj N)) ≃ₗ[k] + (ModuleCat.of k (Column k B N e)) from + { toFun := id + invFun := id + left_inv := fun _ => rfl + right_inv := fun _ => rfl + map_add' := fun _ _ => rfl + map_smul' := fun c x => by + change (algebraMap k (Enveloping k B) c) • + (show Column k B N e from x) = c • (show Column k B N e from x) + exact IsScalarTower.algebraMap_smul (Enveloping k B) c (show Column k B N e from x) }).toModuleIso + +theorem finite_of_iso {X Y : ModuleCat.{u} k} (e : X ≅ Y) + (hY : FiniteDimensional k Y) : FiniteDimensional k X := by + let := hY + exact FiniteDimensional.of_injective e.hom.hom e.toLinearEquiv.injective + +theorem column_finite [FiniteDimensional k B] (e : B) + (N : ModuleCat.{u} Bᵐᵒᵖ) [Module.Finite Bᵐᵒᵖ N] : + FiniteDimensional k ((forgetK k B).obj ((columnFunctor k B e).obj N)) := + finite_of_iso k (columnKIso k B e N) (column_finiteDimensional k B N e) + +abbrev termK (n : ℤ) : BiComplex k B ⥤ ModuleCat.{u} k := + eval _ _ n ⋙ forgetK k B + +theorem sum_finite {I : Type} [Fintype I] (K : I → BiComplex k B) + (n : ℤ) (hK : ∀ i, FiniteDimensional k ((termK k B n).obj (K i))) : + FiniteDimensional k ((termK k B n).obj (⨁ K)) := by + let (i : I) : FiniteDimensional k ((termK k B n).obj (K i)) := hK i + apply finite_of_iso k ((termK k B n).mapBiproduct K ≪≫ ModuleCat.biproductIsoPi _) + change Module.Finite k (∀ i, ((termK k B n).obj (K i))) + infer_instance + +theorem biprod_finite {X Y : ModuleCat.{u} k} + (hX : FiniteDimensional k X) (hY : FiniteDimensional k Y) : + FiniteDimensional k (X ⊞ Y : ModuleCat.{u} k) := by + let := hX + let := hY + apply finite_of_iso k (ModuleCat.biprodIsoProd X Y) + change Module.Finite k (X × Y) + infer_instance + +theorem biprod_term_finite (K L : BiComplex k B) (n : ℤ) + (hK : FiniteDimensional k ((termK k B n).obj K)) + (hL : FiniteDimensional k ((termK k B n).obj L)) : + FiniteDimensional k ((termK k B n).obj (K ⊞ L)) := by + let := preservesBinaryBiproducts_of_preservesBiproducts (termK k B n) + exact finite_of_iso k ((termK k B n).mapBiprod K L) (biprod_finite k hK hL) + +variable {k B} +variable {A J R : Type} [Fintype A] [Fintype J] [Fintype R] +variable (s : Quadratic k B (A := A) (J := J) (R := R)) +variable (D₀ D₁ D₂ : RightComplex B) +variable (f : A → (D₀ ⟶ D₁)) (g : J → (D₁ ⟶ D₂)) + +/-- Finite-dimensionality of the actual three induced columns, from exactly +finite-dimensional B and finite generation of the right-module input terms. -/ +theorem columns_finite [FiniteDimensional k B] + (h₀ : ∀ n, Module.Finite Bᵐᵒᵖ (D₀.X n)) + (h₁ : ∀ n, Module.Finite Bᵐᵒᵖ (D₁.X n)) + (h₂ : ∀ n, Module.Finite Bᵐᵒᵖ (D₂.X n)) (n : ℤ) : + FiniteDimensional k ((forgetK k B).obj ((L0Prime s D₀ D₁ D₂ f g).X n)) ∧ + FiniteDimensional k ((forgetK k B).obj ((L1Prime s D₀ D₁ D₂ f g).X n)) ∧ + FiniteDimensional k ((forgetK k B).obj ((L2Prime s D₀ D₁ D₂ f g).X n)) := by + let := h₀ n + let := h₁ n + let := h₂ n + refine ⟨?_, ?_, ?_⟩ + · apply biprod_term_finite + · exact column_finite k B s.e₀ (D₀.X n) + · apply biprod_term_finite + · exact column_finite k B s.e₁ (D₁.X n) + · exact column_finite k B s.e₂ (D₂.X n) + · apply biprod_term_finite + · apply sum_finite + intro a + exact column_finite k B s.e₁ (D₀.X n) + · apply sum_finite + intro b + exact column_finite k B s.e₂ (D₁.X n) + · apply sum_finite + intro r + exact column_finite k B s.e₂ (D₀.X n) +end ExternalTensor.Section4 + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/ColumnProperties.lean b/lean/OAI/Algebra/Finitistic/Rectification/ColumnProperties.lean new file mode 100644 index 0000000000000000000000000000000000000000..44a9c167a1825ea07609830bf18fbe3736e5022e --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/ColumnProperties.lean @@ -0,0 +1,171 @@ +import OAI.Algebra.Finitistic.Rectification.InducedDiagram +import Mathlib.Algebra.Category.ModuleCat.Projective +import Mathlib.Algebra.Category.ModuleCat.ChangeOfRings +import Mathlib.Algebra.Homology.HomologicalComplexBiprod + +namespace OAI +open CategoryTheory CategoryTheory.Limits HomologicalComplex +open scoped TensorProduct ModuleCat.Algebra +noncomputable section +namespace ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] +attribute [local instance] ExternalTensor.bimodule ExternalTensor.rightModule + +/-- Restrict genuine bimodules to right B-modules. -/ +def forgetRight : ModuleCat.{u} (Enveloping k B) ⥤ ModuleCat.{u} Bᵐᵒᵖ := + ModuleCat.restrictScalars (Algebra.TensorProduct.includeRight : + Bᵐᵒᵖ →ₐ[k] Enveloping k B).toRingHom + +instance forgetRight_additive : (forgetRight k B).Additive := by + dsimp [forgetRight] + infer_instance + +/-- The restricted action is the right action already verified for the actual tensor. -/ +def columnRightIso (e : B) (N : ModuleCat.{u} Bᵐᵒᵖ) : + (forgetRight k B).obj ((columnFunctor k B e).obj N) ≅ + ModuleCat.of Bᵐᵒᵖ (Column k B N e) := + (show ((forgetRight k B).obj ((columnFunctor k B e).obj N)) ≃ₗ[Bᵐᵒᵖ] + (ModuleCat.of Bᵐᵒᵖ (Column k B N e)) from + { toFun := id + invFun := id + left_inv := fun _ => rfl + right_inv := fun _ => rfl + map_add' := fun _ _ => rfl + map_smul' := fun c x => by + change ((1 ⊗ₜ[k] c : Enveloping k B) • (show Column k B N e from x)) = + c • (show Column k B N e from x) + exact (right_eq_enveloping k B (leftIdeal B e) N c x).symm }).toModuleIso + +theorem column_right_projective (e : B) (N : ModuleCat.{u} Bᵐᵒᵖ) + [Module.Projective Bᵐᵒᵖ N] : + Projective ((forgetRight k B).obj ((columnFunctor k B e).obj N)) := by + let := column_projective k B N e + exact Projective.of_iso (columnRightIso k B e N).symm (by infer_instance) + +/-- Exact boundedness transfer for each induced column. -/ +theorem column_isZero (e : B) (D : RightComplex B) (i : ℤ) + (hi : IsZero (D.X i)) : IsZero (((columnComplex k B e).obj D).X i) := + (columnFunctor k B e).map_isZero hi + +instance rightFiniteBiproducts : HasFiniteBiproducts (ModuleCat.{u} Bᵐᵒᵖ) := + HasFiniteBiproducts.of_hasFiniteProducts +instance rightBinaryBiproducts : HasBinaryBiproducts (ModuleCat.{u} Bᵐᵒᵖ) := + HasBinaryBiproducts.of_hasBinaryProducts + +abbrev termRight (n : ℤ) : BiComplex k B ⥤ ModuleCat.{u} Bᵐᵒᵖ := + eval _ _ n ⋙ forgetRight k B + +theorem sum_right_projective {I : Type} [Fintype I] (K : I → BiComplex k B) + (n : ℤ) (hK : ∀ i, Projective ((termRight k B n).obj (K i))) : + Projective ((termRight k B n).obj (⨁ K)) := by + let (i : I) : Projective ((termRight k B n).obj (K i)) := hK i + apply Projective.of_iso ((termRight k B n).mapBiproduct K).symm + refine ⟨fun f e _ => ⟨biproduct.desc (fun i => by + letI : Projective (((termRight k B n).obj ∘ K) i) := hK i + exact Projective.factorThru (biproduct.ι ((termRight k B n).obj ∘ K) i ≫ f) e), ?_⟩⟩ + apply biproduct.hom_ext' + intro i + let : Projective (((termRight k B n).obj ∘ K) i) := hK i + simp only [biproduct.ι_desc_assoc, Projective.factorThru_comp] + +theorem biprod_right_projective (K L : BiComplex k B) (n : ℤ) + (hK : Projective ((termRight k B n).obj K)) + (hL : Projective ((termRight k B n).obj L)) : + Projective ((termRight k B n).obj (K ⊞ L)) := by + let := hK + let := hL + let := preservesBinaryBiproducts_of_preservesBiproducts (termRight k B n) + exact Projective.of_iso ((termRight k B n).mapBiprod K L).symm (by infer_instance) + +theorem sum_isZero {C : Type*} [Category C] [HasZeroMorphisms C] + {I : Type} (K : I → C) [HasBiproduct K] (hK : ∀ i, IsZero (K i)) : + IsZero (⨁ K) := by + apply (IsZero.iff_id_eq_zero _).2 + apply biproduct.hom_ext + intro i + simp only [Category.id_comp, zero_comp] + exact (hK i).eq_zero_of_tgt _ + +theorem sum_term_isZero {I : Type} [Fintype I] (K : I → BiComplex k B) + (n : ℤ) (hK : ∀ i, IsZero ((K i).X n)) : IsZero ((⨁ K).X n) := by + apply ((eval _ _ n).mapBiproduct K).isZero_iff.mpr + exact sum_isZero _ hK + +theorem biprod_term_isZero (K L : BiComplex k B) (n : ℤ) + (hK : IsZero (K.X n)) (hL : IsZero (L.X n)) : IsZero ((K ⊞ L).X n) := by + let := preservesBinaryBiproducts_of_preservesBiproducts (eval (ModuleCat (Enveloping k B)) (ComplexShape.up ℤ) n) + apply ((eval _ _ n).mapBiprod K L).isZero_iff.mpr + exact (biprod_isZero_iff _ _).mpr ⟨hK, hL⟩ + +variable {k B} +variable {A J R : Type} [Fintype A] [Fintype J] [Fintype R] +variable (s : Quadratic k B (A := A) (J := J) (R := R)) +variable (D₀ D₁ D₂ : RightComplex B) +variable (f : A → (D₀ ⟶ D₁)) (g : J → (D₁ ⟶ D₂)) + +/-- Exactly the three right-projectivity inputs to RectificationTotal.total_projective_after. -/ +theorem columns_right_projective + (h₀ : ∀ n, Module.Projective Bᵐᵒᵖ (D₀.X n)) + (h₁ : ∀ n, Module.Projective Bᵐᵒᵖ (D₁.X n)) + (h₂ : ∀ n, Module.Projective Bᵐᵒᵖ (D₂.X n)) (n : ℤ) : + Projective ((forgetRight k B).obj ((L0Prime s D₀ D₁ D₂ f g).X n)) ∧ + Projective ((forgetRight k B).obj ((L1Prime s D₀ D₁ D₂ f g).X n)) ∧ + Projective ((forgetRight k B).obj ((L2Prime s D₀ D₁ D₂ f g).X n)) := by + let := h₀ n + let := h₁ n + let := h₂ n + refine ⟨?_, ?_, ?_⟩ + · apply biprod_right_projective + · exact column_right_projective k B s.e₀ (D₀.X n) + · apply biprod_right_projective + · exact column_right_projective k B s.e₁ (D₁.X n) + · exact column_right_projective k B s.e₂ (D₂.X n) + · apply biprod_right_projective + · apply sum_right_projective + intro a + exact column_right_projective k B s.e₁ (D₀.X n) + · apply sum_right_projective + intro b + exact column_right_projective k B s.e₂ (D₁.X n) + · apply sum_right_projective + intro r + exact column_right_projective k B s.e₂ (D₀.X n) + +theorem columns_isZero (n : ℤ) (h₀ : IsZero (D₀.X n)) + (h₁ : IsZero (D₁.X n)) (h₂ : IsZero (D₂.X n)) : + IsZero ((L0Prime s D₀ D₁ D₂ f g).X n) ∧ + IsZero ((L1Prime s D₀ D₁ D₂ f g).X n) ∧ + IsZero ((L2Prime s D₀ D₁ D₂ f g).X n) := by + refine ⟨?_, ?_, ?_⟩ + · apply biprod_term_isZero + · exact column_isZero k B s.e₀ D₀ n h₀ + · apply biprod_term_isZero + · exact column_isZero k B s.e₁ D₁ n h₁ + · exact column_isZero k B s.e₂ D₂ n h₂ + · apply biprod_term_isZero + · apply sum_term_isZero + intro a + exact column_isZero k B s.e₁ D₀ n h₀ + · apply sum_term_isZero + intro b + exact column_isZero k B s.e₂ D₁ n h₁ + · apply sum_term_isZero + intro r + exact column_isZero k B s.e₂ D₀ n h₀ + +/-- Uniform bounds on the input complexes give the same bounds on all three columns. -/ +theorem columns_bounded (lo hi : ℤ) + (h₀ : ∀ n, n < lo ∨ hi < n → IsZero (D₀.X n)) + (h₁ : ∀ n, n < lo ∨ hi < n → IsZero (D₁.X n)) + (h₂ : ∀ n, n < lo ∨ hi < n → IsZero (D₂.X n)) : + ∀ n, n < lo ∨ hi < n → + IsZero ((L0Prime s D₀ D₁ D₂ f g).X n) ∧ + IsZero ((L1Prime s D₀ D₁ D₂ f g).X n) ∧ + IsZero ((L2Prime s D₀ D₁ D₂ f g).X n) := + fun n hn => columns_isZero s D₀ D₁ D₂ f g n (h₀ n hn) (h₁ n hn) (h₂ n hn) +end ExternalTensor.Section4 + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/ConcreteAdjacentGraded.lean b/lean/OAI/Algebra/Finitistic/Rectification/ConcreteAdjacentGraded.lean new file mode 100644 index 0000000000000000000000000000000000000000..a6ada6c1f258483e2027fbbb477f32169b463b01 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/ConcreteAdjacentGraded.lean @@ -0,0 +1,64 @@ +import OAI.Algebra.Finitistic.Rectification.AdjacentArrowSum +import OAI.Algebra.Finitistic.Rectification.RectificationAcyclic + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.ConcreteAdjacentGraded +open ExternalTensor.Section4 QuadraticEncoding +universe u +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) +variable (D : RightComplex (QuadraticEncoding.B P)) +local notation "T" => QuadraticEncoding.B P +local notation "s" => ConcreteQuadraticDiagram.quadratic P + +def arrow01Sum : (⨁ fun _ : Fin (d+1) => (columnComplex k T (s).e₁).obj D) ⟶ + (columnComplex k T (s).e₀).obj D := + biproduct.desc (fun a => path k T (s).e₀ (s).e₁ (arrow01 P a) ((s).ha a) D) + +def arrow12Sum : (⨁ fun _ : Fin (d+1) => (columnComplex k T (s).e₂).obj D) ⟶ + (columnComplex k T (s).e₁).obj D := + biproduct.desc (fun b => path k T (s).e₁ (s).e₂ (arrow12 P b) ((s).hb b) D) + +theorem vertex1_arrow01_isIso : + IsIso ((AdjacentArrowSum.vertexComplex (composition P) 1).map (arrow01Sum P D)) := by + let F := AdjacentArrowSum.vertexComplex (composition P) 1 + have hdesc := AdjacentArrowSum.desc_isIso (composition P) D 1 0 d + (CornerSpaces.corner10Equiv (composition P)) (arrow01 P) ((s).ha) + (CornerArrowCoordinates.arrow01_coordinate P) + let : IsIso (biproduct.desc (fun a => F.map + (path k T (s).e₀ (s).e₁ (arrow01 P a) ((s).ha a) D))) := hdesc + change IsIso (F.map (biproduct.desc _)) + rw [← biproduct.mapBiproduct_hom_desc,isIso_comp_left_iff] + exact hdesc + +theorem vertex2_arrow12_isIso : + IsIso ((AdjacentArrowSum.vertexComplex (composition P) 2).map (arrow12Sum P D)) := by + let F := AdjacentArrowSum.vertexComplex (composition P) 2 + have hdesc := AdjacentArrowSum.desc_isIso (composition P) D 2 1 d + (CornerSpaces.corner21Equiv (composition P)) (arrow12 P) ((s).hb) + (CornerArrowCoordinates.arrow12_coordinate P) + let : IsIso (biproduct.desc (fun b => F.map + (path k T (s).e₁ (s).e₂ (arrow12 P b) ((s).hb b) D))) := hdesc + change IsIso (F.map (biproduct.desc _)) + rw [← biproduct.mapBiproduct_hom_desc,isIso_comp_left_iff] + exact hdesc + +/-- The first adjacent graded cone is acyclic for the actual arrow map. -/ +theorem vertex1_cone_acyclic : + (CochainComplex.mappingCone + ((AdjacentArrowSum.vertexComplex (composition P) 1).map (arrow01Sum P D))).Acyclic := by + let := vertex1_arrow01_isIso P D + exact RectificationAcyclic.cone_acyclic _ + +/-- The second adjacent graded cone is acyclic for the actual arrow map. -/ +theorem vertex2_cone_acyclic : + (CochainComplex.mappingCone + ((AdjacentArrowSum.vertexComplex (composition P) 2).map (arrow12Sum P D))).Acyclic := by + let := vertex2_arrow12_isIso P D + exact RectificationAcyclic.cone_acyclic _ +end LittleFinitistic.ConcreteAdjacentGraded + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/CornerArrowCoordinates.lean b/lean/OAI/Algebra/Finitistic/Rectification/CornerArrowCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..8b54ef419f9a84cbca6fc3823ff2be04006ae29a --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/CornerArrowCoordinates.lean @@ -0,0 +1,45 @@ +import OAI.Algebra.Finitistic.Rectification.CornerColumnPaths +import OAI.Algebra.Finitistic.Localization.ConcreteQuadraticDiagram + +namespace OAI +noncomputable section +open scoped TensorProduct +namespace LittleFinitistic.CornerArrowCoordinates +open QuadraticEncoding CornerColumnPaths +universe u +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) + +/-- On the adjacent 1,0 corner, the original a-arrow inserts its actual basis vector. -/ +theorem arrow01_coordinate (a : Fin (d+1)) (c : k) : + CornerSpaces.corner10Equiv (composition P) + (cornerMap (composition P) 1 0 1 (arrow01 P a) + ((ConcreteQuadraticDiagram.quadratic P).ha a) + ((CornerSpaces.diagonalEquiv (composition P) 1).symm c)) = c • basis a := by + simp [CornerSpaces.corner10Equiv,cornerMap,CornerSpaces.diagonalEquiv, + arrow01,ThreeVertexAlgebra.mul,ThreeVertexAlgebra.vertex] + +/-- On the adjacent 2,1 corner, the original b-arrow inserts its actual basis vector. -/ +theorem arrow12_coordinate (b : Fin (d+1)) (c : k) : + CornerSpaces.corner21Equiv (composition P) + (cornerMap (composition P) 2 1 2 (arrow12 P b) + ((ConcreteQuadraticDiagram.quadratic P).hb b) + ((CornerSpaces.diagonalEquiv (composition P) 2).symm c)) = c • basis b := by + simp [CornerSpaces.corner21Equiv,cornerMap,CornerSpaces.diagonalEquiv, + arrow12,ThreeVertexAlgebra.mul,ThreeVertexAlgebra.vertex] + +/-- Length-two multiplication is exactly the quotient of the original tensor path. -/ +theorem lengthTwo_coordinate (a : Fin (d+1)) (w : Arrows k d) : + CornerSpaces.corner20Equiv (composition P) + (cornerMap (composition P) 2 0 1 (arrow01 P a) + ((ConcreteQuadraticDiagram.quadratic P).ha a) + ((CornerSpaces.corner21Equiv (composition P)).symm w)) = + (relationSpace P).mkQ (w ⊗ₜ[k] basis a) := by + change (0 : k) • (0 : Paths k d ⧸ relationSpace P) + + (relationSpace P).mkQ (w ⊗ₜ[k] basis a) + (0 : k) • 0 = _ + simp only [zero_smul, zero_add, add_zero] + +end LittleFinitistic.CornerArrowCoordinates + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/CornerColumnComplex.lean b/lean/OAI/Algebra/Finitistic/Rectification/CornerColumnComplex.lean new file mode 100644 index 0000000000000000000000000000000000000000..f229d50c49ca274be639fd8bedbcb9e7320a3756 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/CornerColumnComplex.lean @@ -0,0 +1,50 @@ +import OAI.Algebra.Finitistic.Rectification.VertexColumnComplex +import OAI.Algebra.Finitistic.Rectification.TensorComplex + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +open scoped TensorProduct ModuleCat.Algebra +namespace LittleFinitistic.CornerColumnComplex +universe u +variable {k V W U : Type u} [Field k] [AddCommGroup V] [Module k V] + [AddCommGroup W] [Module k W] [AddCommGroup U] [Module k U] +variable (μ : W →ₗ[k] V →ₗ[k] U) +local notation "T" => ThreeVertexAlgebra μ +attribute [local instance] ExternalTensor.rightModule ExternalTensor.bimodule + +/-- Embed an actual corner into the principal left ideal of its source vertex. -/ +def cornerToIdeal (i j : Fin 3) : CornerSpaces.corner μ i j →ₗ[k] + ExternalTensor.leftIdeal T (ThreeVertexAlgebra.vertex μ j) where + toFun x := ⟨x.val,⟨x.val,CornerProjection.corner_right_fixed μ i j x⟩⟩ + map_add' _ _ := rfl + map_smul' _ _ := rfl + +/-- The corner equivalence retains the actual tensor insertion on pure tensors. -/ +theorem corner_symm_tmul_val (N : ModuleCat.{u} (ThreeVertexAlgebra μ)ᵐᵒᵖ) + (i j : Fin 3) (x : CornerSpaces.corner μ i j) (n : N) : + ((VertexColumnModels.cornerEquiv μ N i j).symm (x ⊗ₜ[k] n)).val = + cornerToIdeal μ i j x ⊗ₜ[k] n := by + rfl + +/-- Every actual vertex column is its concrete corner-tensor complex. -/ +def complexIso (i j : Fin 3) + (D : CochainComplex (ModuleCat.{u} (ThreeVertexAlgebra μ)ᵐᵒᵖ) ℤ) : + TensorComplex.complex D (ModuleCat.of k (CornerSpaces.corner μ i j)) ≅ + ((VertexColumnComplex.vertexColumn μ i j).mapHomologicalComplex (.up ℤ)).obj D := + HomologicalComplex.Hom.isoOfComponents + (fun n => (VertexColumnModels.cornerEquiv μ (D.X n) i j).symm.toModuleIso) (by + intro n m hnm + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + induction x using TensorProduct.inductionOn with + | tmul c v => rfl + | add x y hx hy => + exact (map_add _ _ _).trans + ((congrArg₂ (· + ·) hx hy).trans (map_add _ _ _).symm)) +end LittleFinitistic.CornerColumnComplex + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/CornerColumnPaths.lean b/lean/OAI/Algebra/Finitistic/Rectification/CornerColumnPaths.lean new file mode 100644 index 0000000000000000000000000000000000000000..acd44d4a0a1c69724e904846fb3f32198dde669f --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/CornerColumnPaths.lean @@ -0,0 +1,53 @@ +import OAI.Algebra.Finitistic.Rectification.CornerColumnComplex + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +open scoped TensorProduct ModuleCat.Algebra +namespace LittleFinitistic.CornerColumnPaths +universe u +variable {k V W U : Type u} [Field k] [AddCommGroup V] [Module k V] + [AddCommGroup W] [Module k W] [AddCommGroup U] [Module k U] +variable (μ : W →ₗ[k] V →ₗ[k] U) +local notation "T" => ThreeVertexAlgebra μ +attribute [local instance] ExternalTensor.rightModule ExternalTensor.bimodule + +/-- Right multiplication by the original path on the actual vertex corner. -/ +def cornerMap (v i j : Fin 3) (a : ThreeVertexAlgebra μ) + (ha : a * ThreeVertexAlgebra.vertex μ i = a) : + CornerSpaces.corner μ v j →ₗ[k] CornerSpaces.corner μ v i where + toFun x := ⟨x.val*a,by + change ThreeVertexAlgebra.vertex μ v * (x.val*a) * ThreeVertexAlgebra.vertex μ i = x.val*a + calc + _ = (ThreeVertexAlgebra.vertex μ v * x.val) * + (a * ThreeVertexAlgebra.vertex μ i) := by simp only [mul_assoc] + _ = x.val*a := by rw [CornerProjection.corner_left_fixed,ha]⟩ + map_add' x y := Subtype.ext (add_mul _ _ _) + map_smul' c x := Subtype.ext (smul_mul_assoc _ _ _) + +/-- The corner-tensor identification carries the actual induced path map to right multiplication. -/ +theorem path_naturality (v i j : Fin 3) (a : ThreeVertexAlgebra μ) + (ha : a * ThreeVertexAlgebra.vertex μ i = a) + (D : CochainComplex (ModuleCat.{u} (ThreeVertexAlgebra μ)ᵐᵒᵖ) ℤ) : + TensorComplex.complexMap D (ModuleCat.ofHom (cornerMap μ v i j a ha)) ≫ + (CornerColumnComplex.complexIso μ v i D).hom = + (CornerColumnComplex.complexIso μ v j D).hom ≫ + ((BimoduleVertex.functor k T (ThreeVertexAlgebra.vertex μ v)).mapHomologicalComplex (.up ℤ)).map + (ExternalTensor.Section4.path k T (ThreeVertexAlgebra.vertex μ i) + (ThreeVertexAlgebra.vertex μ j) a ha D) := by + apply HomologicalComplex.Hom.ext + funext n + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + induction x using TensorProduct.inductionOn with + | tmul c z => rfl + | add x y hx hy => + exact (map_add _ _ _).trans + ((congrArg₂ (· + ·) hx hy).trans (map_add _ _ _).symm) + +end LittleFinitistic.CornerColumnPaths + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/CornerPathTransport.lean b/lean/OAI/Algebra/Finitistic/Rectification/CornerPathTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..f9893eddf8512b344c184ef2d5b53db4806ee1f4 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/CornerPathTransport.lean @@ -0,0 +1,65 @@ +import OAI.Algebra.Finitistic.Rectification.AdjacentArrowSum +import OAI.Algebra.Finitistic.Encoding.RelationMatrixSequence + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.CornerPathTransport +universe u +variable {k V W U : Type u} [Field k] [AddCommGroup V] [Module k V] + [AddCommGroup W] [Module k W] [AddCommGroup U] [Module k U] +variable (μ : W →ₗ[k] V →ₗ[k] U) +variable (D : CochainComplex (ModuleCat.{u} (ThreeVertexAlgebra μ)ᵐᵒᵖ) ℤ) +local notation "T" => ThreeVertexAlgebra μ + +def coordinateIso (v i : Fin 3) {M : Type u} [AddCommGroup M] [Module k M] + (ξ : CornerSpaces.corner μ v i ≃ₗ[k] M) : + (AdjacentArrowSum.vertexComplex μ v).obj ((ExternalTensor.Section4.columnComplex k T + (ThreeVertexAlgebra.vertex μ i)).obj D) ≅ + (TensorComplex.tensorFunctor (k := k) D).obj (ModuleCat.of k M) := + (CornerColumnComplex.complexIso μ v i D).symm ≪≫ + (TensorComplex.tensorFunctor (k := k) D).mapIso ξ.toModuleIso + +/-- Coordinate transport preserves each actual path map, before taking any finite sum. -/ +theorem path_square (v i j : Fin 3) {M N : Type u} + [AddCommGroup M] [Module k M] [AddCommGroup N] [Module k N] + (ξ : CornerSpaces.corner μ v j ≃ₗ[k] M) + (η : CornerSpaces.corner μ v i ≃ₗ[k] N) + (a : T) (ha : a * ThreeVertexAlgebra.vertex μ i = a) + (f : M →ₗ[k] N) + (hc : ∀ x, η (CornerColumnPaths.cornerMap μ v i j a ha x) = f (ξ x)) : + (coordinateIso μ D v j ξ).hom ≫ (TensorComplex.tensorFunctor (k := k) D).map + (ModuleCat.ofHom f) = + (AdjacentArrowSum.vertexComplex μ v).map + (ExternalTensor.Section4.path k T (ThreeVertexAlgebra.vertex μ i) + (ThreeVertexAlgebra.vertex μ j) a ha D) ≫ (coordinateIso μ D v i η).hom := by + let F := TensorComplex.tensorFunctor (k := k) D + have hm : ModuleCat.ofHom ξ.toLinearMap ≫ ModuleCat.ofHom f = + ModuleCat.ofHom (CornerColumnPaths.cornerMap μ v i j a ha) ≫ + ModuleCat.ofHom η.toLinearMap := by + apply ModuleCat.hom_ext + exact LinearMap.ext (fun x => (hc x).symm) + have hF := congrArg F.map hm + simp only [Functor.map_comp] at hF + apply (cancel_epi (CornerColumnComplex.complexIso μ v j D).hom).1 + calc + _ = F.map (ModuleCat.ofHom ξ.toLinearMap) ≫ F.map (ModuleCat.ofHom f) := by + change (CornerColumnComplex.complexIso μ v j D).hom ≫ + ((CornerColumnComplex.complexIso μ v j D).inv ≫ + F.map (ModuleCat.ofHom ξ.toLinearMap)) ≫ F.map (ModuleCat.ofHom f) = _ + erw [Category.assoc] + exact (CornerColumnComplex.complexIso μ v j D).hom_inv_id_assoc _ + _ = F.map (ModuleCat.ofHom (CornerColumnPaths.cornerMap μ v i j a ha)) ≫ + F.map (ModuleCat.ofHom η.toLinearMap) := hF + _ = (F.map (ModuleCat.ofHom + (CornerColumnPaths.cornerMap μ v i j a ha)) ≫ + (CornerColumnComplex.complexIso μ v i D).hom) ≫ + (coordinateIso μ D v i η).hom := by simp [coordinateIso,F,TensorComplex.tensorFunctor] + _ = _ := by + erw [CornerColumnPaths.path_naturality] + exact Category.assoc _ _ _ +end LittleFinitistic.CornerPathTransport + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/CornerProjection.lean b/lean/OAI/Algebra/Finitistic/Rectification/CornerProjection.lean new file mode 100644 index 0000000000000000000000000000000000000000..0bc665f0619d38053c02d5442b379484da0fd708 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/CornerProjection.lean @@ -0,0 +1,82 @@ +import OAI.Algebra.Finitistic.Rectification.CornerSpaces +import OAI.Algebra.Finitistic.Rectification.InducedColumns + +namespace OAI +noncomputable section + +namespace LittleFinitistic.CornerProjection +open ThreeVertexAlgebra CornerSpaces +universe u +variable {k V W U : Type u} [Field k] + [AddCommGroup V] [Module k V] [AddCommGroup W] [Module k W] + [AddCommGroup U] [Module k U] +variable (μ : W →ₗ[k] V →ₗ[k] U) + +private theorem videm (i : Fin 3) : vertex μ i * vertex μ i = vertex μ i := + (directedSystem μ).idem i + +theorem corner_left_fixed (i j : Fin 3) (x : corner μ i j) : vertex μ i * x.val = x.val := by + have hx := x.property + change vertex μ i * x.val * vertex μ j = x.val at hx + calc + vertex μ i * x.val = vertex μ i * (vertex μ i * x.val * vertex μ j) := congrArg (fun a : ThreeVertexAlgebra μ => vertex μ i * a) hx.symm + _ = vertex μ i * x.val * vertex μ j := by simp only [← mul_assoc,videm] + _ = x.val := hx + +theorem corner_right_fixed (i j : Fin 3) (x : corner μ i j) : x.val * vertex μ j = x.val := by + have hx := x.property + change vertex μ i * x.val * vertex μ j = x.val at hx + calc + x.val * vertex μ j = (vertex μ i * x.val * vertex μ j) * vertex μ j := congrArg (fun a : ThreeVertexAlgebra μ => a * vertex μ j) hx.symm + _ = vertex μ i * x.val * vertex μ j := by rw [mul_assoc,videm] + _ = x.val := hx + +theorem ideal_right_fixed (j : Fin 3) + (x : ExternalTensor.leftIdeal (ThreeVertexAlgebra μ) (vertex μ j)) : + x.val * vertex μ j = x.val := by + obtain ⟨b,hb⟩ := x.property + change b * vertex μ j = x.val at hb + rw [← hb,mul_assoc,videm] + +/-- Left multiplication by e_i on the actual induced-column first factor B e_j. -/ +def projection (i j : Fin 3) : + ExternalTensor.leftIdeal (ThreeVertexAlgebra μ) (vertex μ j) →ₗ[k] + ExternalTensor.leftIdeal (ThreeVertexAlgebra μ) (vertex μ j) where + toFun x := ⟨vertex μ i * x.val,⟨vertex μ i * x.val,by + change (vertex μ i * x.val) * vertex μ j = vertex μ i * x.val + rw [mul_assoc,ideal_right_fixed]⟩⟩ + map_add' x y := Subtype.ext (mul_add _ _ _) + map_smul' c x := Subtype.ext (mul_smul_comm _ _ _) + +@[simp] theorem projection_apply (i j : Fin 3) (x) : + ((projection μ i j) x).val = vertex μ i * x.val := rfl + +theorem projection_idempotent (i j : Fin 3) : + (projection μ i j).comp (projection μ i j) = projection μ i j := by + apply LinearMap.ext + intro x + apply Subtype.ext + change vertex μ i * (vertex μ i * x.val) = vertex μ i * x.val + rw [← mul_assoc,videm] + +/-- The image of the actual column projector is the concrete two-sided path corner. -/ +def rangeEquiv (i j : Fin 3) : (projection μ i j).range ≃ₗ[k] corner μ i j where + toFun x := ⟨x.val.val,by + obtain ⟨y,hy⟩ := x.property + have h := congrArg Subtype.val hy + change vertex μ i * y.val = x.val.val at h + change vertex μ i * x.val.val * vertex μ j = x.val.val + rw [← h,← mul_assoc,videm,mul_assoc,ideal_right_fixed]⟩ + invFun x := ⟨⟨x.val,⟨x.val,corner_right_fixed μ i j x⟩⟩,by + refine ⟨⟨x.val,⟨x.val,corner_right_fixed μ i j x⟩⟩,?_⟩ + apply Subtype.ext + exact corner_left_fixed μ i j x⟩ + left_inv x := by apply Subtype.ext; apply Subtype.ext; rfl + right_inv x := rfl + map_add' x y := rfl + map_smul' c x := rfl +end LittleFinitistic.CornerProjection + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/CornerSpaces.lean b/lean/OAI/Algebra/Finitistic/Rectification/CornerSpaces.lean new file mode 100644 index 0000000000000000000000000000000000000000..bb78b884b80c823784e0c35bc7a8912574c7c047 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/CornerSpaces.lean @@ -0,0 +1,103 @@ +import Mathlib.LinearAlgebra.Prod +import Mathlib.Tactic.FinCases +import OAI.Algebra.Finitistic.Encoding.QuadraticEncoding + +namespace OAI + +namespace LittleFinitistic.CornerSpaces +open ThreeVertexAlgebra + +universe u +variable {k V W U : Type u} [Field k] + [AddCommGroup V] [Module k V] [AddCommGroup W] [Module k W] + [AddCommGroup U] [Module k U] +variable (μ : W →ₗ[k] V →ₗ[k] U) + +/-- The actual two-sided corner e_i B e_j as a vector subspace. -/ +def corner (i j : Fin 3) : Submodule k (ThreeVertexAlgebra μ) where + carrier := {x | vertex μ i * x * vertex μ j = x} + zero_mem' := by + change vertex μ i * (0 : ThreeVertexAlgebra μ) * vertex μ j = 0 + rw [mul_zero,zero_mul] + add_mem' := by + intro x y hx hy + change vertex μ i * x * vertex μ j = x at hx + change vertex μ i * y * vertex μ j = y at hy + change vertex μ i * (x+y) * vertex μ j = x+y + rw [mul_add,add_mul,hx,hy] + smul_mem' := by + intro r x hx + change vertex μ i * x * vertex μ j = x at hx + change vertex μ i * (r • x) * vertex μ j = r • x + rw [mul_smul_comm,smul_mul_assoc,hx] + +noncomputable def corner10Equiv : corner μ 1 0 ≃ₗ[k] V where + toFun x := x.val.2.2.2.1 + invFun v := ⟨(0,0,0,v,0,0),by + change mul μ (mul μ (vertex μ 1) (0,0,0,v,0,0)) (vertex μ 0) = _ + simp [vertex,mul]⟩ + left_inv x := by + apply Subtype.ext + have hx := x.property + change mul μ (mul μ (vertex μ 1) x.val) (vertex μ 0) = x.val at hx + simpa [vertex,mul] using hx + right_inv _ := rfl + map_add' _ _ := rfl + map_smul' _ _ := rfl + +noncomputable def corner21Equiv : corner μ 2 1 ≃ₗ[k] W where + toFun x := x.val.2.2.2.2.1 + invFun w := ⟨(0,0,0,0,w,0),by + change mul μ (mul μ (vertex μ 2) (0,0,0,0,w,0)) (vertex μ 1) = _ + simp [vertex,mul]⟩ + left_inv x := by + apply Subtype.ext + have hx := x.property + change mul μ (mul μ (vertex μ 2) x.val) (vertex μ 1) = x.val at hx + simpa [vertex,mul] using hx + right_inv _ := rfl + map_add' _ _ := rfl + map_smul' _ _ := rfl + +noncomputable def corner20Equiv : corner μ 2 0 ≃ₗ[k] U where + toFun x := x.val.2.2.2.2.2 + invFun u := ⟨(0,0,0,0,0,u),by + change mul μ (mul μ (vertex μ 2) (0,0,0,0,0,u)) (vertex μ 0) = _ + simp [vertex,mul]⟩ + left_inv x := by + apply Subtype.ext + have hx := x.property + change mul μ (mul μ (vertex μ 2) x.val) (vertex μ 0) = x.val at hx + simpa [vertex,mul] using hx + right_inv _ := rfl + map_add' _ _ := rfl + map_smul' _ _ := rfl + +/-- A diagonal corner has only its scalar trivial path. -/ +noncomputable def diagonalEquiv (i : Fin 3) : corner μ i i ≃ₗ[k] k where + toFun x := if i = 0 then x.val.1 else if i = 1 then x.val.2.1 else x.val.2.2.1 + invFun c := ⟨c • vertex μ i,by + change vertex μ i * (c • vertex μ i) * vertex μ i = c • vertex μ i + rw [mul_smul_comm,smul_mul_assoc] + have hi := (directedSystem μ).idem i + change vertex μ i * vertex μ i = vertex μ i at hi + rw [hi,hi]⟩ + left_inv x := by + apply Subtype.ext + have hx := x.property + change mul μ (mul μ (vertex μ i) x.val) (vertex μ i) = x.val at hx + fin_cases i <;> simpa [vertex,mul,smul_eq μ] using hx + right_inv c := by fin_cases i <;> simp [vertex,smul_eq μ] + map_add' x y := by fin_cases i <;> rfl + map_smul' c x := by fin_cases i <;> rfl + +/-- No path points backwards in the actual algebra. -/ +theorem corner_zero_of_lt (i j : Fin 3) (hij : i < j) (x : corner μ i j) : x = 0 := by + apply Subtype.ext + have hx := x.property + change (directedSystem μ).e i * x.val * (directedSystem μ).e j = x.val at hx + rw [(directedSystem μ).directed j i hij x.val] at hx + exact hx.symm +end LittleFinitistic.CornerSpaces + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/CornerTensor.lean b/lean/OAI/Algebra/Finitistic/Rectification/CornerTensor.lean new file mode 100644 index 0000000000000000000000000000000000000000..7e825ce12954d7ceb4536336454654e0201907ca --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/CornerTensor.lean @@ -0,0 +1,60 @@ +import OAI.Algebra.Finitistic.Rectification.CornerProjection +import OAI.Algebra.Finitistic.Rectification.TensorProjection + +namespace OAI +noncomputable section +open scoped TensorProduct + +namespace LittleFinitistic.CornerTensor +open ThreeVertexAlgebra CornerSpaces CornerProjection TensorProjection +attribute [local instance] ExternalTensor.rightModule ExternalTensor.bimodule +universe u v +variable {k V W U : Type u} [Field k] + [AddCommGroup V] [Module k V] [AddCommGroup W] [Module k W] + [AddCommGroup U] [Module k U] +variable (μ : W →ₗ[k] V →ₗ[k] U) +variable (N : Type v) [AddCommGroup N] [Module k N] + [Module (ThreeVertexAlgebra μ)ᵐᵒᵖ N] [IsScalarTower k (ThreeVertexAlgebra μ)ᵐᵒᵖ N] + +/-- The concrete corner tensor is the fixed submodule of the induced column. -/ +def cornerTensorEquiv (i j : Fin 3) : + (corner μ i j ⊗[k] N) ≃ₗ[(ThreeVertexAlgebra μ)ᵐᵒᵖ] + TensorProjection.fixed (B := ThreeVertexAlgebra μ) (N := N) (projection μ i j) := + (rightCongr (B := ThreeVertexAlgebra μ) (N := N) (rangeEquiv μ i j).symm).trans + (imageTensorEquiv (B := ThreeVertexAlgebra μ) (N := N) + (projection μ i j) (projection_idempotent μ i j)) + +/-- This fixed-space definition uses the original left vertex action on the column. -/ +theorem fixed_iff_left_action (i j : Fin 3) + (x : ExternalTensor.Column k (ThreeVertexAlgebra μ) N (vertex μ j)) : + x ∈ TensorProjection.fixed (B := ThreeVertexAlgebra μ) (projection μ i j) ↔ + vertex μ i • x = x := by + rw [TensorProjection.mem_fixed] + have h : rightMap (B := ThreeVertexAlgebra μ) (projection μ i j) x = vertex μ i • x := by + induction x using TensorProduct.inductionOn with + | tmul m n => rfl + | add x y hx hy => simp_all [smul_add] + rw [h] + +/-- Scalar tensor multiplication is right B-linear with the actual external action. -/ +def scalarTensorEquiv : (k ⊗[k] N) ≃ₗ[(ThreeVertexAlgebra μ)ᵐᵒᵖ] N where + __ := (TensorProduct.lid k N).toAddEquiv + map_smul' c x := by + induction x using TensorProduct.inductionOn with + | tmul r n => + change r • (c • n) = c • (r • n) + exact smul_comm r c n + | add x y hx hy => simp_all [smul_add] + +/-- The diagonal vertex component of its own induced column is exactly N. -/ +def diagonalColumnEquiv (i : Fin 3) : + TensorProjection.fixed (B := ThreeVertexAlgebra μ) (N := N) (projection μ i i) + ≃ₗ[(ThreeVertexAlgebra μ)ᵐᵒᵖ] N := + (cornerTensorEquiv μ N i i).symm.trans + ((rightCongr (B := ThreeVertexAlgebra μ) (N := N) (diagonalEquiv μ i)).trans + (scalarTensorEquiv μ N)) +end LittleFinitistic.CornerTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/DiagramAssembly.lean b/lean/OAI/Algebra/Finitistic/Rectification/DiagramAssembly.lean new file mode 100644 index 0000000000000000000000000000000000000000..efc9f593e045315cef24e9742caeac1ffdbac280 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/DiagramAssembly.lean @@ -0,0 +1,97 @@ +import OAI.Algebra.Finitistic.Rectification.ColumnComplex + +namespace OAI +open CategoryTheory CategoryTheory.Limits HomologicalComplex +noncomputable section +namespace ExternalTensor.Section4 +universe u +variable {k : Type u} [Field k] +variable {C : Type u} [Category C] [Preadditive C] [Linear k C] [HasFiniteBiproducts C] [HasBinaryBiproducts C] +variable {A J R : Type} [Fintype A] [Fintype J] [Fintype R] + +/-- The concrete column/map interface. No composite or null-homotopy is assumed. +The three equations are path naturality, the algebra relations, and the chosen +relation homotopies after column induction. -/ +structure AssemblyData where + V₀ : C + V₁ : C + V₂ : C + U : A → C + V : J → C + W : R → C + pa₀ : ∀ a, U a ⟶ V₀ + pa₁ : ∀ a, U a ⟶ V₁ + pb₁ : ∀ b, V b ⟶ V₁ + pb₂ : ∀ b, V b ⟶ V₂ + qa : ∀ relation arrow, J → (W relation ⟶ U arrow) + qb : ∀ relation, A → ∀ arrow, W relation ⟶ V arrow + rel : ∀ r, W r ⟶ V₂ + middle : ∀ r a b, qa r a b ≫ pa₁ a = qb r a b ≫ pb₁ b + first : ∀ r, ∑ a, ∑ b, qa r a b ≫ pa₀ a = 0 + last : ∀ r, ∑ a, ∑ b, qb r a b ≫ pb₂ b = rel r + +namespace AssemblyData +variable (s : AssemblyData (C := C) (A := A) (J := J) (R := R)) +abbrev L₀ := s.V₀ ⊞ (s.V₁ ⊞ s.V₂) +abbrev L₁ := (⨁ s.U) ⊞ (⨁ s.V) +abbrev L₂ := ⨁ s.W +abbrev in₀ : s.V₀ ⟶ s.L₀ := biprod.inl +abbrev in₁ : s.V₁ ⟶ s.L₀ := biprod.inl ≫ biprod.inr +abbrev in₂ : s.V₂ ⟶ s.L₀ := biprod.inr ≫ biprod.inr + +def p : s.L₁ ⟶ s.L₀ := + biprod.desc + (biproduct.desc fun a => s.pa₀ a ≫ s.in₀ - s.pa₁ a ≫ s.in₁) + (biproduct.desc fun b => s.pb₁ b ≫ s.in₁ - s.pb₂ b ≫ s.in₂) + +def q : s.L₂ ⟶ s.L₁ := + biproduct.desc fun r => ∑ a, ∑ b, + (s.qa r a b ≫ biproduct.ι s.U a ≫ biprod.inl + + s.qb r a b ≫ biproduct.ι s.V b ≫ biprod.inr) + +/-- The complete cancellation in Section 4, including the minus sign. -/ +theorem composite : s.q ≫ s.p = + -(biproduct.desc fun r => s.rel r ≫ s.in₂) := by + apply biproduct.hom_ext' + intro r + simp only [q, biproduct.ι_desc_assoc, Preadditive.comp_neg, + biproduct.ι_desc] + simp only [Preadditive.sum_comp, Preadditive.add_comp, Category.assoc, p, + biprod.inl_desc, biprod.inr_desc, biproduct.ι_desc, Preadditive.comp_sub, + ] + simp only [← Category.assoc, s.middle] + simp only [Category.assoc] + have cancel (a : A) (b : J) : + s.qa r a b ≫ s.pa₀ a ≫ s.in₀ - s.qb r a b ≫ s.pb₁ b ≫ s.in₁ + + (s.qb r a b ≫ s.pb₁ b ≫ s.in₁ - s.qb r a b ≫ s.pb₂ b ≫ s.in₂) = + s.qa r a b ≫ s.pa₀ a ≫ s.in₀ - s.qb r a b ≫ s.pb₂ b ≫ s.in₂ := by abel + simp_rw [cancel, Finset.sum_sub_distrib] + have hf := congrArg (fun z => z ≫ s.in₀) (s.first r) + have hl := congrArg (fun z => z ≫ s.in₂) (s.last r) + simp only [Preadditive.sum_comp, Category.assoc, zero_comp] at hf hl + rw [hf, hl] + simp + +/-- A componentwise specified finite sum of homotopies. -/ +def sumHomotopy {E : Type*} [Category E] [Preadditive E] + {X Y : CochainComplex E ℤ} {I : Type} [Fintype I] + (f : I → (X ⟶ Y)) (H : ∀ i, Homotopy (f i) 0) : + Homotopy (∑ i, f i) 0 where + hom n m := ∑ i, (H i).hom n m + zero n m h := by simp [fun i => (H i).zero n m h] + comm n := by + change Hom.fAddMonoidHom n (∑ i, f i) = _ + rw [map_sum] + change (∑ i, (f i).f n) = _ + calc + _ = ∑ i, (dNext n (H i).hom + prevD n (H i).hom + (0 : X ⟶ Y).f n) := + Finset.sum_congr rfl (fun i _ => (H i).comm n) + _ = _ := by + simp [dNext, prevD, Preadditive.comp_sum, Preadditive.sum_comp, + Finset.sum_add_distrib] +end AssemblyData +end ExternalTensor.Section4 + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/ExactProducts.lean b/lean/OAI/Algebra/Finitistic/Rectification/ExactProducts.lean new file mode 100644 index 0000000000000000000000000000000000000000..2e14b986c1b705fe7e4f72b4912d84cd13e7aade --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/ExactProducts.lean @@ -0,0 +1,72 @@ +import Mathlib.Algebra.Exact.Basic + +namespace OAI +noncomputable section +namespace LittleFinitistic.RectificationTotal +variable {A B C A' B' C' : Type*} [Zero C] [Zero C'] +variable {f : A → B} {g : B → C} {f' : A' → B'} {g' : B' → C'} + +/-- Exact pairs remain exact under the concrete binary product of maps. -/ +theorem exact_prod (h : Function.Exact f g) (h' : Function.Exact f' g') : + Function.Exact (Prod.map f f') (Prod.map g g') := by + rintro ⟨x, x'⟩ + constructor + · intro hx + obtain ⟨y, hy⟩ := (h x).mp (congrArg Prod.fst hx) + obtain ⟨y', hy'⟩ := (h' x').mp (congrArg Prod.snd hx) + exact ⟨(y,y'), Prod.ext hy hy'⟩ + · rintro ⟨⟨y,y'⟩, hy⟩ + rw [← hy] + exact Prod.ext (h.apply_apply_eq_zero y) (h'.apply_apply_eq_zero y') + +/-- Short exactness is also preserved by the concrete binary product. -/ +theorem shortExact_prod (h : Function.Exact f g) (h' : Function.Exact f' g') + (hf : Function.Injective f) (hf' : Function.Injective f') + (hg : Function.Surjective g) (hg' : Function.Surjective g') : + Function.Injective (Prod.map f f') ∧ + Function.Exact (Prod.map f f') (Prod.map g g') ∧ + Function.Surjective (Prod.map g g') := by + refine ⟨?_, exact_prod h h', ?_⟩ + · intro x y hxy + exact Prod.ext (hf (congrArg Prod.fst hxy)) (hf' (congrArg Prod.snd hxy)) + · rintro ⟨z,z'⟩ + obtain ⟨x,hx⟩ := hg z + obtain ⟨x',hx'⟩ := hg' z' + exact ⟨(x,x'),Prod.ext hx hx'⟩ + +variable {X Y Z X' Y' Z' : Type*} [Zero Z] [Zero Z'] +variable (eX : X ≃ X') (eY : Y ≃ Y') (eZ : Z ≃ Z') (eZzero : eZ 0 = 0) +variable {f : X → Y} {g : Y → Z} {f' : X' → Y'} {g' : Y' → Z'} +variable (commF : ∀ x, eY (f x) = f' (eX x)) +variable (commG : ∀ y, eZ (g y) = g' (eY y)) + +include eX eY eZ eZzero commF commG + +theorem exact_transport (h : Function.Exact f' g') : Function.Exact f g := by + intro y + constructor + · intro hy + obtain ⟨x',hx'⟩ := (h (eY y)).mp (by rw [← commG, hy, eZzero]) + refine ⟨eX.symm x', eY.injective ?_⟩ + rw [commF, eX.apply_symm_apply, hx'] + · rintro ⟨x,rfl⟩ + apply eZ.injective + rw [commG, commF, h.apply_apply_eq_zero, eZzero] + +theorem shortExact_transport (hf : Function.Injective f') (h : Function.Exact f' g') + (hg : Function.Surjective g') : + Function.Injective f ∧ Function.Exact f g ∧ Function.Surjective g := by + refine ⟨?_, exact_transport eX eY eZ eZzero commF commG h, ?_⟩ + · intro x y hxy + apply eX.injective + apply hf + rw [← commF, ← commF, hxy] + · intro z + obtain ⟨y',hy'⟩ := hg (eZ z) + refine ⟨eY.symm y',eZ.injective ?_⟩ + rw [commG, eY.apply_symm_apply, hy'] +end LittleFinitistic.RectificationTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/ExternalTensor.lean b/lean/OAI/Algebra/Finitistic/Rectification/ExternalTensor.lean new file mode 100644 index 0000000000000000000000000000000000000000..b98e79060652074d1496e2d1b170e8d63ebe8179 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/ExternalTensor.lean @@ -0,0 +1,221 @@ +import Mathlib.RingTheory.TensorProduct.Maps +import Mathlib.LinearAlgebra.TensorProduct.Basis +import Mathlib.Algebra.Module.Projective +import Mathlib.LinearAlgebra.FiniteDimensional.Basic + +namespace OAI +open scoped TensorProduct + + +noncomputable section +namespace ExternalTensor + +variable (k B M N : Type*) [Field k] [Ring B] [Algebra k B] + [AddCommGroup M] [Module k M] [Module B M] [IsScalarTower k B M] + [AddCommGroup N] [Module k N] [Module Bᵐᵒᵖ N] [IsScalarTower k Bᵐᵒᵖ N] + +def leftAction : B →ₐ[k] Module.End k (M ⊗[k] N) := + (Module.End.rTensorAlgHom k M N).comp (Algebra.lsmul k k M) + +def rightAction : Bᵐᵒᵖ →ₐ[k] Module.End k (M ⊗[k] N) := + (Module.End.lTensorAlgHom k N M).comp (Algebra.lsmul k k N) + +omit [Module Bᵐᵒᵖ N] [IsScalarTower k Bᵐᵒᵖ N] in +@[simp] theorem leftAction_tmul (b : B) (m : M) (n : N) : + leftAction k B M N b (m ⊗ₜ[k] n) = (b • m) ⊗ₜ[k] n := rfl + +omit [Module B M] [IsScalarTower k B M] in +@[simp] theorem rightAction_tmul (b : Bᵐᵒᵖ) (m : M) (n : N) : + rightAction k B M N b (m ⊗ₜ[k] n) = m ⊗ₜ[k] (b • n) := rfl + +theorem actions_commute (b : B) (c : Bᵐᵒᵖ) : + Commute (leftAction k B M N b) (rightAction k B M N c) := by + apply TensorProduct.ext + ext m n + rfl + +/-- The genuine enveloping algebra representation; the right action is encoded by Bᵐᵒᵖ. -/ +def action : (B ⊗[k] Bᵐᵒᵖ) →ₐ[k] Module.End k (M ⊗[k] N) := + Algebra.TensorProduct.lift (leftAction k B M N) (rightAction k B M N) + (actions_commute k B M N) + +@[instance_reducible] def bimodule : Module (B ⊗[k] Bᵐᵒᵖ) (M ⊗[k] N) := + Module.compHom (M ⊗[k] N) (action k B M N).toRingHom + +@[instance_reducible] def rightModule : Module Bᵐᵒᵖ (M ⊗[k] N) := + Module.compHom (M ⊗[k] N) (rightAction k B M N).toRingHom + +attribute [local instance] bimodule rightModule + +@[simp] theorem smul_tmul (b : B) (c : Bᵐᵒᵖ) (m : M) (n : N) : + (b ⊗ₜ[k] c) • (m ⊗ₜ[k] n) = (b • m) ⊗ₜ[k] (c • n) := rfl + +omit [Module B M] [IsScalarTower k B M] in +@[simp] theorem right_smul_tmul (c : Bᵐᵒᵖ) (m : M) (n : N) : + c • (m ⊗ₜ[k] n) = m ⊗ₜ[k] (c • n) := rfl + + +/-- Factor swap, with the external right action on the source. -/ +def rightSwap : (M ⊗[k] N) ≃ₗ[Bᵐᵒᵖ] (N ⊗[k] M) where + __ := (TensorProduct.comm k M N).toAddEquiv + map_smul' c x := by + induction x using TensorProduct.inductionOn with + | tmul m n => simp [right_smul_tmul, TensorProduct.smul_tmul'] + | add x y hx hy => simp_all [smul_add] + +omit [Module B M] [IsScalarTower k B M] in +/-- In fact no dimension restriction on M is needed for right projectivity. -/ +theorem projective_right [Module.Projective Bᵐᵒᵖ N] : + Module.Projective Bᵐᵒᵖ (M ⊗[k] N) := + Module.Projective.of_equiv (rightSwap k B M N).symm + +theorem finiteDimensional [FiniteDimensional k M] [FiniteDimensional k N] : + FiniteDimensional k (M ⊗[k] N) := + Module.Finite.equiv + (TensorProduct.equivFinsuppOfBasisLeft (Module.finBasis k M)).symm + + +/-- A k-basis of the left factor gives an actual right-module direct-sum decomposition. -/ +def rightBasisEquiv {ι : Type*} [DecidableEq ι] (v : Module.Basis ι k M) : + (M ⊗[k] N) ≃ₗ[Bᵐᵒᵖ] (ι →₀ N) where + __ := (TensorProduct.equivFinsuppOfBasisLeft v).toAddEquiv + map_smul' c x := by + induction x using TensorProduct.inductionOn with + | tmul m n => + ext i + change (TensorProduct.equivFinsuppOfBasisLeft v) + (c • (m ⊗ₜ[k] n)) i = c • (TensorProduct.equivFinsuppOfBasisLeft v) (m ⊗ₜ[k] n) i + rw [right_smul_tmul, TensorProduct.equivFinsuppOfBasisLeft_apply_tmul_apply, + TensorProduct.equivFinsuppOfBasisLeft_apply_tmul_apply] + exact smul_comm (v.repr m i) c n + | add x y hx hy => simp_all [smul_add] + +omit [Module B M] [IsScalarTower k B M] in +@[simp] theorem rightBasisEquiv_tmul {ι : Type*} [DecidableEq ι] + (v : Module.Basis ι k M) (m : M) (n : N) (i : ι) : + rightBasisEquiv k B M N v (m ⊗ₜ[k] n) i = v.repr m i • n := + TensorProduct.equivFinsuppOfBasisLeft_apply_tmul_apply v m n i + +omit [Module B M] [IsScalarTower k B M] in +theorem finite_right [FiniteDimensional k M] [Module.Finite Bᵐᵒᵖ N] : + Module.Finite Bᵐᵒᵖ (M ⊗[k] N) := + Module.Finite.equiv (rightBasisEquiv k B M N (Module.finBasis k M)).symm + + +/-- The chosen right action is the restriction of the enveloping action. -/ +theorem right_eq_enveloping (c : Bᵐᵒᵖ) (x : M ⊗[k] N) : + c • x = (1 ⊗ₜ[k] c : B ⊗[k] Bᵐᵒᵖ) • x := by + induction x using TensorProduct.inductionOn with + | tmul m n => simp + | add x y hx hy => simp_all [smul_add] + +/-- The usual left action on the first tensor factor is the other restriction. -/ +theorem left_eq_enveloping (b : B) (x : M ⊗[k] N) : + b • x = (b ⊗ₜ[k] (1 : Bᵐᵒᵖ)) • x := by + induction x using TensorProduct.inductionOn with + | tmul m n => simp [TensorProduct.smul_tmul'] + | add x y hx hy => simp_all [smul_add] + +instance commutingActions : SMulCommClass B Bᵐᵒᵖ (M ⊗[k] N) where + smul_comm b c x := by + induction x using TensorProduct.inductionOn with + | tmul m n => simp [TensorProduct.smul_tmul'] + | add x y hx hy => simp_all [smul_add] + +instance rightScalarTower : IsScalarTower k Bᵐᵒᵖ (M ⊗[k] N) where + smul_assoc r c x := by + change rightAction k B M N (r • c) x = r • rightAction k B M N c x + rw [map_smul] + rfl + +instance envelopingScalarTower : IsScalarTower k (B ⊗[k] Bᵐᵒᵖ) (M ⊗[k] N) where + smul_assoc r a x := by + change action k B M N (r • a) x = r • action k B M N a x + rw [map_smul] + rfl + +variable {k B M N} +variable {M' N' : Type*} + [AddCommGroup M'] [Module k M'] [Module B M'] [IsScalarTower k B M'] + [AddCommGroup N'] [Module k N'] [Module Bᵐᵒᵖ N'] [IsScalarTower k Bᵐᵒᵖ N'] + +/-- Tensor of a left-module map and a right-module map is enveloping-linear. -/ +def map (f : M →ₗ[B] M') (g : N →ₗ[Bᵐᵒᵖ] N') : + (M ⊗[k] N) →ₗ[B ⊗[k] Bᵐᵒᵖ] (M' ⊗[k] N') where + __ := (TensorProduct.map (f.restrictScalars k) (g.restrictScalars k)).toAddMonoidHom + map_smul' a x := by + induction a using TensorProduct.inductionOn with + | tmul b c => + induction x using TensorProduct.inductionOn with + | tmul m n => simp [smul_tmul] + | add x y hx hy => simp_all [smul_add] + | add a b ha hb => simp_all [add_smul] + +@[simp] theorem map_tmul (f : M →ₗ[B] M') (g : N →ₗ[Bᵐᵒᵖ] N') (m : M) (n : N) : + map (k := k) f g (m ⊗ₜ[k] n) = f m ⊗ₜ[k] g n := rfl + +@[simp] theorem map_id : + map (k := k) (LinearMap.id : M →ₗ[B] M) (LinearMap.id : N →ₗ[Bᵐᵒᵖ] N) = + LinearMap.id := by + ext x + induction x using TensorProduct.inductionOn with + | tmul m n => rfl + | add x y hx hy => simp_all + +variable {M'' N'' : Type*} + [AddCommGroup M''] [Module k M''] [Module B M''] [IsScalarTower k B M''] + [AddCommGroup N''] [Module k N''] [Module Bᵐᵒᵖ N''] [IsScalarTower k Bᵐᵒᵖ N''] + +theorem map_comp (f : M →ₗ[B] M') (f' : M' →ₗ[B] M'') + (g : N →ₗ[Bᵐᵒᵖ] N') (g' : N' →ₗ[Bᵐᵒᵖ] N'') : + map (k := k) (f'.comp f) (g'.comp g) = (map (k := k) f' g').comp (map (k := k) f g) := by + ext x + induction x using TensorProduct.inductionOn with + | tmul m n => rfl + | add x y hx hy => simp_all + + +theorem map_add_left (f f' : M →ₗ[B] M') (g : N →ₗ[Bᵐᵒᵖ] N') : + map (k := k) (f + f') g = map (k := k) f g + map (k := k) f' g := by + ext x + induction x using TensorProduct.inductionOn with + | tmul m n => simp [TensorProduct.add_tmul] + | add x y hx hy => simp_all [add_add_add_comm] + +theorem map_add_right (f : M →ₗ[B] M') (g g' : N →ₗ[Bᵐᵒᵖ] N') : + map (k := k) f (g + g') = map (k := k) f g + map (k := k) f g' := by + ext x + induction x using TensorProduct.inductionOn with + | tmul m n => simp [TensorProduct.tmul_add] + | add x y hx hy => simp_all [add_add_add_comm] + + +theorem map_smul_left (r : k) (f : M →ₗ[B] M') (g : N →ₗ[Bᵐᵒᵖ] N') : + map (k := k) (r • f) g = r • map (k := k) f g := by + ext x + induction x using TensorProduct.inductionOn with + | tmul m n => simp [TensorProduct.smul_tmul'] + | add x y hx hy => simp_all [smul_add] + +theorem map_smul_right (r : k) (f : M →ₗ[B] M') (g : N →ₗ[Bᵐᵒᵖ] N') : + map (k := k) f (r • g) = r • map (k := k) f g := by + ext x + induction x using TensorProduct.inductionOn with + | tmul m n => simp [TensorProduct.tmul_smul] + | add x y hx hy => simp_all [smul_add] + +/-- The same tensor map as a map of right B-modules. -/ +def rightMap (f : M →ₗ[B] M') (g : N →ₗ[Bᵐᵒᵖ] N') : + (M ⊗[k] N) →ₗ[Bᵐᵒᵖ] (M' ⊗[k] N') where + __ := (map (k := k) f g).toAddMonoidHom + map_smul' c x := by + change map (k := k) f g (c • x) = c • map (k := k) f g x + rw [right_eq_enveloping, right_eq_enveloping, LinearMap.map_smul] + +@[simp] theorem rightMap_tmul (f : M →ₗ[B] M') (g : N →ₗ[Bᵐᵒᵖ] N') (m : M) (n : N) : + rightMap (k := k) f g (m ⊗ₜ[k] n) = f m ⊗ₜ[k] g n := rfl +end ExternalTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/FiltrationExactness.lean b/lean/OAI/Algebra/Finitistic/Rectification/FiltrationExactness.lean new file mode 100644 index 0000000000000000000000000000000000000000..c6283255791c0c56d9175731828f24ee15a683be --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/FiltrationExactness.lean @@ -0,0 +1,70 @@ +import OAI.Algebra.Finitistic.Rectification.SourceFiltrationCone + +namespace OAI +open CategoryTheory CategoryTheory.Limits HomologicalComplex CochainComplex +open LittleFinitistic.RectificationTotal +open scoped TensorProduct ModuleCat.Algebra +noncomputable section +namespace ExternalTensor.Section4.SourceFiltration.Exactness +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +variable {A J R : Type} [Fintype A] [Fintype J] [Fintype R] +variable (s : Quadratic k B (A := A) (J := J) (R := R)) +variable (D₀ D₁ D₂ : RightComplex B) +variable (f : A → (D₀ ⟶ D₁)) (g : J → (D₁ ⟶ D₂)) +variable (H : ∀ r, Homotopy (relationMap s D₀ D₁ D₂ f g r) 0) + +abbrev data := inducedData s D₀ D₁ D₂ f g +abbrev P := total (p s D₀ D₁ D₂ f g) (q s D₀ D₁ D₂ f g) + (nullHomotopy s D₀ D₁ D₂ f g H) +abbrev F1 := total (p1 (data s D₀ D₁ D₂ f g)) 0 (h1 (data s D₀ D₁ D₂ f g)) +abbrev G0 := total (p0 (data s D₀ D₁ D₂ f g)) (q0 (data s D₀ D₁ D₂ f g)) + (h0 (data s D₀ D₁ D₂ f g)) +abbrev G1 := total (pGrade1 (data s D₀ D₁ D₂ f g)) 0 + (hGrade1 (data s D₀ D₁ D₂ f g)) + +abbrev i1 : F1 s D₀ D₁ D₂ f g ⟶ P s D₀ D₁ D₂ f g H := + (inducedInclude1 s D₀ D₁ D₂ f g H).totalMap +abbrev pi0 : P s D₀ D₁ D₂ f g H ⟶ G0 s D₀ D₁ D₂ f g := + (inducedQuotient0 s D₀ D₁ D₂ f g H).totalMap +abbrev i2 : (columnComplex k B s.e₂).obj D₂ ⟶ F1 s D₀ D₁ D₂ f g := + v2Inclusion (data s D₀ D₁ D₂ f g) +abbrev pi1 : F1 s D₀ D₁ D₂ f g ⟶ G1 s D₀ D₁ D₂ f g := + (quotient1 (data s D₀ D₁ D₂ f g)).totalMap + +/-- Section 4's actual two nontrivial source-filtration steps. No decomposition, +exactness, extra coherence, vertex equivalence, or main theorem is an input. -/ +theorem exact_source_filtration (n : ℤ) : + (Function.Injective ((i1 s D₀ D₁ D₂ f g H).f n) ∧ + Function.Exact ((i1 s D₀ D₁ D₂ f g H).f n) ((pi0 s D₀ D₁ D₂ f g H).f n) ∧ + Function.Surjective ((pi0 s D₀ D₁ D₂ f g H).f n)) ∧ + (Function.Injective ((i2 s D₀ D₁ D₂ f g).f n) ∧ + Function.Exact ((i2 s D₀ D₁ D₂ f g).f n) ((pi1 s D₀ D₁ D₂ f g).f n) ∧ + Function.Surjective ((pi1 s D₀ D₁ D₂ f g).f n)) ∧ + i2 s D₀ D₁ D₂ f g ≫ i1 s D₀ D₁ D₂ f g H = + (data s D₀ D₁ D₂ f g).in₂ ≫ + inclusion (p s D₀ D₁ D₂ f g) (q s D₀ D₁ D₂ f g) + (nullHomotopy s D₀ D₁ D₂ f g H) := + ⟨induced_source0_shortExact s D₀ D₁ D₂ f g H n, + v2_shortExact (data s D₀ D₁ D₂ f g) n, + v2_nested (data s D₀ D₁ D₂ f g) (nullHomotopy s D₀ D₁ D₂ f g H)⟩ + +theorem categorical_source0 (n : ℤ) : + let E := (exact_source_filtration s D₀ D₁ D₂ f g H n).1 + (ModuleCat.shortComplexOfCompEqZero ((i1 s D₀ D₁ D₂ f g H).f n).hom + ((pi0 s D₀ D₁ D₂ f g H).f n).hom E.2.1.linearMap_comp_eq_zero).ShortExact := by + let E := (exact_source_filtration s D₀ D₁ D₂ f g H n).1 + exact ModuleCat.shortComplex_shortExact _ E.2.1 E.1 E.2.2 + +omit [Fintype R] in +theorem categorical_source1 (n : ℤ) : + let E := v2_shortExact (data s D₀ D₁ D₂ f g) n + (ModuleCat.shortComplexOfCompEqZero ((i2 s D₀ D₁ D₂ f g).f n).hom + ((pi1 s D₀ D₁ D₂ f g).f n).hom E.2.1.linearMap_comp_eq_zero).ShortExact := by + let E := v2_shortExact (data s D₀ D₁ D₂ f g) n + exact ModuleCat.shortComplex_shortExact _ E.2.1 E.1 E.2.2 +end ExternalTensor.Section4.SourceFiltration.Exactness + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/FinalGradedAcyclic.lean b/lean/OAI/Algebra/Finitistic/Rectification/FinalGradedAcyclic.lean new file mode 100644 index 0000000000000000000000000000000000000000..d09ae96606275a22987534aae87034927e42027e --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/FinalGradedAcyclic.lean @@ -0,0 +1,38 @@ +import OAI.Algebra.Finitistic.Encoding.RelationVertexSequence +import OAI.Algebra.Finitistic.Rectification.TotalInterchange +import OAI.Algebra.Finitistic.Rectification.GradedVertexAcyclic + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits HomologicalComplex CochainComplex +namespace LittleFinitistic.FinalGradedAcyclic +open QuadraticEncoding ExternalTensor.Section4 ExternalTensor.Section4.SourceFiltration +open RectificationTotal +universe u +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) +variable (D₀ D₁ D₂ : RightComplex (QuadraticEncoding.B P)) +variable (f : Fin (d+1) → (D₀ ⟶ D₁)) (g : Fin (d+1) → (D₁ ⟶ D₂)) +local notation "T" => QuadraticEncoding.B P +local notation "s" => ConcreteQuadraticDiagram.quadratic P +local notation "data" => Exactness.data s D₀ D₁ D₂ f g + +/-- The original source-zero quotient at vertex two is acyclic, with every relation column retained. -/ +theorem grade0_vertex2_acyclic : + ((RelationVertexCoordinates.vertex P).obj (Exactness.G0 s D₀ D₁ D₂ f g)).Acyclic := by + let F := BimoduleVertex.functor k T (ThreeVertexAlgebra.vertex (composition P) 2) + let S := (RelationVertexSequence.originalSequence P D₀ D₁ D₂ f g).map + (RelationVertexCoordinates.vertex P) + have he : mapNullHomotopy F (p0 data) (q0 data) (h0 data) = Homotopy.ofEq S.zero := by + ext i j + simp [mapNullHomotopy_hom,h0,Homotopy.ofEq] + rfl + apply GradedVertexAcyclic.acyclic_of_iso + (totalInterchange F (p0 data) (q0 data) (h0 data)) + rw [he] + exact RectificationAcyclic.short_exact_total_acyclic S + (RelationVertexSequence.shortExact P D₀ D₁ D₂ f g) +end LittleFinitistic.FinalGradedAcyclic + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/FirstVertex.lean b/lean/OAI/Algebra/Finitistic/Rectification/FirstVertex.lean new file mode 100644 index 0000000000000000000000000000000000000000..4773638edaff2ab8eb1f719f887f0a5a92cff814 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/FirstVertex.lean @@ -0,0 +1,75 @@ +import OAI.Algebra.Finitistic.Rectification.VertexZeroTotal + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits HomologicalComplex +open scoped TensorProduct ModuleCat.Algebra +namespace LittleFinitistic.FirstVertex +open ExternalTensor.Section4 +section General +variable {C D : Type*} [Category C] [Category D] [Preadditive C] [Preadditive D] + [HasBinaryBiproducts C] [HasBinaryBiproducts D] +def biprodInlIso {X Y : D} (hY : IsZero Y) : X ≅ X ⊞ Y where + hom := biprod.inl + inv := biprod.fst + hom_inv_id := by simp + inv_hom_id := by + apply biprod.hom_ext + · simp + · exact hY.eq_of_tgt _ _ + +theorem mapped_inl_isIso (F : C ⥤ D) [F.Additive] (X Y : C) (hY : IsZero (F.obj Y)) : + IsIso (F.map (biprod.inl : X ⟶ X ⊞ Y)) := by + have := preservesBinaryBiproducts_of_preservesBiproducts F + rw [← isIso_comp_right_iff _ (F.mapBiprod X Y).hom] + have he : F.map (biprod.inl : X ⟶ X ⊞ Y) ≫ (F.mapBiprod X Y).hom = biprod.inl := by + apply biprod.hom_ext + · erw [Functor.mapBiprod_hom, Category.assoc, biprod.lift_fst, + ← Functor.map_comp, biprod.inl_fst, F.map_id, biprod.inl_fst] + · erw [Functor.mapBiprod_hom, Category.assoc, biprod.lift_snd, + ← Functor.map_comp, biprod.inl_snd, F.map_zero, biprod.inl_snd] + rw [he] + exact (biprodInlIso hY).isIso_hom +end General + +universe u +variable {k : Type u} [Field k] {d t : ℕ} (P : QuadraticEncoding.Relations k d t) +local notation "B" => QuadraticEncoding.B P +local notation "s" => ConcreteQuadraticDiagram.quadratic P +abbrev vertexComplex := (VertexZeroTotal.vertexFunctor P).mapHomologicalComplex (.up ℤ) +variable (D₀ D₁ D₂ : RightComplex (QuadraticEncoding.B P)) +variable (f : Fin (d+1) → (D₀ ⟶ D₁)) (g : Fin (d+1) → (D₁ ⟶ D₂)) +variable (H : ∀ r, Homotopy (relationMap (ConcreteQuadraticDiagram.quadratic P) D₀ D₁ D₂ f g r) 0) + +/-- The original first induced column includes into the actual zero column. -/ +def columnInclusion : (columnComplex k B (s).e₀).obj D₀ ⟶ L0Prime s D₀ D₁ D₂ f g := biprod.inl + +theorem columnInclusion_isIso : + IsIso ((vertexComplex P).map (columnInclusion P D₀ D₁ D₂ f g)) := by + have := preservesBinaryBiproducts_of_preservesBiproducts (vertexComplex P) + apply mapped_inl_isIso + apply ((vertexComplex P).mapBiprod _ _).isZero_iff.mpr + rw [biprod_isZero_iff] + exact ⟨VertexColumnComplex.reverse_isZero (QuadraticEncoding.composition P) 0 1 (by decide) D₁, + VertexColumnComplex.reverse_isZero (QuadraticEncoding.composition P) 0 2 (by decide) D₂⟩ + +/-- The manuscript's original first-vertex insertion into the constructed total. -/ +def iota : D₀ ⟶ (vertexComplex P).obj (InducedRectification.total s D₀ D₁ D₂ f g H) := + (VertexColumnComplex.diagonalComplexIso (QuadraticEncoding.composition P) 0 D₀).hom ≫ + (vertexComplex P).map (columnInclusion P D₀ D₁ D₂ f g) ≫ + (vertexComplex P).map (InducedRectification.inclusion s D₀ D₁ D₂ f g H) + +/-- At the first vertex the original insertion is already a chain isomorphism. -/ +theorem iota_isIso : IsIso (iota P D₀ D₁ D₂ f g H) := by + have := columnInclusion_isIso P D₀ D₁ D₂ f g + have := VertexZeroTotal.inclusion_isIso P D₀ D₁ D₂ f g H + let e : D₀ ≅ (vertexComplex P).obj ((columnComplex k B (s).e₀).obj D₀) := + VertexColumnComplex.diagonalComplexIso (QuadraticEncoding.composition P) 0 D₀ + change IsIso (e.hom ≫ (vertexComplex P).map (columnInclusion P D₀ D₁ D₂ f g) ≫ + (vertexComplex P).map (InducedRectification.inclusion s D₀ D₁ D₂ f g H)) + infer_instance +end LittleFinitistic.FirstVertex + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/FullTensorProperties.lean b/lean/OAI/Algebra/Finitistic/Rectification/FullTensorProperties.lean new file mode 100644 index 0000000000000000000000000000000000000000..511896df128174ec027895cd5dacab26076dc8be --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/FullTensorProperties.lean @@ -0,0 +1,53 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleTensorUnderlying +import OAI.Algebra.Finitistic.Rectification.TotalFinite +import OAI.Algebra.Finitistic.Rectification.InducedRectification + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +open scoped TensorProduct ModuleCat.Algebra +namespace LittleFinitistic.FullTensorProperties +open ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] + +/-- The tensor input's scalar structure agrees with the original bimodule's +scalar restriction through the two algebra homomorphisms. -/ +def inputEquiv (M : ModuleCat.{u} (Enveloping k B)) : + (forgetK k B).obj M ≃ₗ[k] BimoduleBalancedTensor.Input k B M where + toFun := id + invFun := id + left_inv _ := rfl + right_inv _ := rfl + map_add' _ _ := rfl + map_smul' c x := by + change (algebraMap k (Enveloping k B) c) • (show M from x) = + (BimoduleVertex.restriction k B (algebraMap k Bᵐᵒᵖ c)) • (show M from x) + have h : BimoduleVertex.restriction k B (algebraMap k Bᵐᵒᵖ c) = + algebraMap k (Enveloping k B) c := Algebra.TensorProduct.includeRight.commutes c + rw [h] + +variable (N : Type u) [AddCommGroup N] [Module k N] [Module B N] + +theorem finite (M : ModuleCat.{u} (Enveloping k B)) + [FiniteDimensional k ((forgetK k B).obj M)] [FiniteDimensional k N] : + FiniteDimensional k ((ModuleCat.restrictScalars (algebraMap k B)).obj + ((BimoduleBalancedTensor.functor k B N).obj M)) := by + have : FiniteDimensional k (BimoduleBalancedTensor.Input k B M) := + Module.Finite.of_surjective (inputEquiv k B M).toLinearMap (inputEquiv k B M).surjective + have : FiniteDimensional k ((BalancedTensor.tensorFunctor k B N).obj ((forgetRight k B).obj M)) := + inferInstanceAs (FiniteDimensional k (BimoduleBalancedTensor.Tensor k B M N)) + apply Module.Finite.of_surjective (BimoduleBalancedTensor.underlyingEquiv k B N M).symm.toLinearMap + (BimoduleBalancedTensor.underlyingEquiv k B N M).symm.surjective + +theorem bounded (P : BiComplex k B) (lo hi : ℤ) + (h : ∀ n, n < lo ∨ hi < n → IsZero (P.X n)) : + ∀ n, n < lo ∨ hi < n → IsZero + ((((BimoduleBalancedTensor.functor k B N).mapHomologicalComplex (.up ℤ)).obj P).X n) := by + intro n hn + exact (BimoduleBalancedTensor.functor k B N).map_isZero (h n hn) +end LittleFinitistic.FullTensorProperties + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/FullTensorRectification.lean b/lean/OAI/Algebra/Finitistic/Rectification/FullTensorRectification.lean new file mode 100644 index 0000000000000000000000000000000000000000..7cfc1e10f9477ae1e17cdabbd8b4e0ad00056a38 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/FullTensorRectification.lean @@ -0,0 +1,125 @@ +import OAI.Algebra.Finitistic.Rectification.TensorArrowComparison +import OAI.Algebra.Finitistic.Rectification.CanonicalArrowCompatibility + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits HomologicalComplex +namespace LittleFinitistic.FullTensorRectification +open ExternalTensor.Section4 QuadraticEncoding +universe u +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) +variable (D₀ D₁ D₂ : RightComplex (B P)) +variable (f : Fin (d+1) → (D₀ ⟶ D₁)) (g : Fin (d+1) → (D₁ ⟶ D₂)) +variable (H : ∀ r, Homotopy (relationMap (ConcreteQuadraticDiagram.quadratic P) D₀ D₁ D₂ f g r) 0) +variable (N : Type u) [AddCommGroup N] [Module k N] [Module (B P) N] + +/-- The actual left B-module complex P tensor_B N. -/ +abbrev tensor := ((BimoduleBalancedTensor.functor k (B P) N).mapHomologicalComplex (.up ℤ)).obj + (InducedRectification.total (ConcreteQuadraticDiagram.quadratic P) D₀ D₁ D₂ f g H) + +abbrev source (v : Fin 3) := + ((BalancedTensor.tensorFunctor k (B P) N).mapHomologicalComplex (.up ℤ)).obj + (VertexHomotopyEquivalence.source P D₀ D₁ D₂ v) +abbrev target (v : Fin 3) := + ((LeftVertexHomology.vertex k (B P) (ThreeVertexAlgebra.vertex (composition P) v)).mapHomologicalComplex + (.up ℤ)).obj (tensor P D₀ D₁ D₂ f g H N) + +/-- The original vertex insertion after balanced tensoring and the canonical comparison. -/ +def iota (v : Fin 3) : source P D₀ D₁ D₂ N v ⟶ target P D₀ D₁ D₂ f g H N v := + ((BalancedTensor.tensorFunctor k (B P) N).mapHomologicalComplex (.up ℤ)).map + (VertexHomotopyEquivalence.iota P D₀ D₁ D₂ f g H v) ≫ + (TensorArrowComparison.complexIso k (B P) N (ThreeVertexAlgebra.vertex (composition P) v) + ((ThreeVertexAlgebra.directedSystem (composition P)).idem v) + (InducedRectification.total (ConcreteQuadraticDiagram.quadratic P) D₀ D₁ D₂ f g H)).hom + +/-- The equivalences retain the full left B-valued tensor target and the exact original maps. -/ +theorem equivalence (v : Fin 3) (lo hi : ℤ) + (b₀ : ∀ n, n < lo ∨ hi < n → IsZero (D₀.X n)) + (b₁ : ∀ n, n < lo ∨ hi < n → IsZero (D₁.X n)) + (b₂ : ∀ n, n < lo ∨ hi < n → IsZero (D₂.X n)) + (p₀ : ∀ n, Module.Projective (B P)ᵐᵒᵖ (D₀.X n)) + (p₁ : ∀ n, Module.Projective (B P)ᵐᵒᵖ (D₁.X n)) + (p₂ : ∀ n, Module.Projective (B P)ᵐᵒᵖ (D₂.X n)) : + ∃ E : HomotopyEquiv (source P D₀ D₁ D₂ N v) (target P D₀ D₁ D₂ f g H N v), + E.hom = iota P D₀ D₁ D₂ f g H N v := by + obtain ⟨j,⟨h₁⟩,⟨h₂⟩⟩ := VertexHomotopyEquivalence.homotopy_inverse P D₀ D₁ D₂ f g H + v lo hi b₀ b₁ b₂ p₀ p₁ p₂ + let E : HomotopyEquiv (VertexHomotopyEquivalence.source P D₀ D₁ D₂ v) + (VertexHomotopyEquivalence.target P D₀ D₁ D₂ f g H v) := + ⟨VertexHomotopyEquivalence.iota P D₀ D₁ D₂ f g H v,j,h₁,h₂⟩ + exact ⟨((BalancedTensor.tensorFunctor k (B P) N).mapHomotopyEquiv E).trans + (HomotopyEquiv.ofIso (TensorArrowComparison.complexIso k (B P) N + (ThreeVertexAlgebra.vertex (composition P) v) + ((ThreeVertexAlgebra.directedSystem (composition P)).idem v) + (InducedRectification.total (ConcreteQuadraticDiagram.quadratic P) D₀ D₁ D₂ f g H))),rfl⟩ + +abbrev arrow01Map (a : Fin (d+1)) := + ((LeftVertexHomology.arrow k (B P) (ThreeVertexAlgebra.vertex (composition P) 0) + (ThreeVertexAlgebra.vertex (composition P) 1) (arrow01 P a) + (CanonicalArrowCompatibility.arrow01_target P a)).mapHomologicalComplex (.up ℤ)).app + (tensor P D₀ D₁ D₂ f g H N) +abbrev arrow12Map (b : Fin (d+1)) := + ((LeftVertexHomology.arrow k (B P) (ThreeVertexAlgebra.vertex (composition P) 1) + (ThreeVertexAlgebra.vertex (composition P) 2) (arrow12 P b) + (CanonicalArrowCompatibility.arrow12_target P b)).mapHomologicalComplex (.up ℤ)).app + (tensor P D₀ D₁ D₂ f g H N) + +lemma original_iota0 : VertexHomotopyEquivalence.iota P D₀ D₁ D₂ f g H 0 = + FirstVertex.iota P D₀ D₁ D₂ f g H := by rfl +lemma original_iota1 : VertexHomotopyEquivalence.iota P D₀ D₁ D₂ f g H 1 = + SecondVertex.iota P D₀ D₁ D₂ f g H := by rfl +lemma original_iota2 : VertexHomotopyEquivalence.iota P D₀ D₁ D₂ f g H 2 = + ThirdVertex.iota P D₀ D₁ D₂ f g H := by rfl + +/-- Actual arrow compatibility on the vertex diagram of the full B-valued tensor. -/ +def compatibility01 (a : Fin (d+1)) : Homotopy + (iota P D₀ D₁ D₂ f g H N 0 ≫ arrow01Map P D₀ D₁ D₂ f g H N a) + (((BalancedTensor.tensorFunctor k (B P) N).mapHomologicalComplex (.up ℤ)).map (f a) ≫ + iota P D₀ D₁ D₂ f g H N 1) := by + have h := ((BalancedTensor.tensorFunctor k (B P) N).mapHomotopy + (CanonicalArrowCompatibility.compatibility01 P D₀ D₁ D₂ f g H a)).compRight + (TensorArrowComparison.complexIso k (B P) N (ThreeVertexAlgebra.vertex (composition P) 1) + ((ThreeVertexAlgebra.directedSystem (composition P)).idem 1) + (InducedRectification.total (ConcreteQuadraticDiagram.quadratic P) D₀ D₁ D₂ f g H)).hom + erw [Functor.map_comp_assoc _ (FirstVertex.iota P D₀ D₁ D₂ f g H) + (CanonicalArrowCompatibility.arrow01Map P D₀ D₁ D₂ f g H a), + Functor.map_comp_assoc _ (f a) (SecondVertex.iota P D₀ D₁ D₂ f g H)] at h + have hs := TensorArrowComparison.complex_arrow_square k (B P) N + (ThreeVertexAlgebra.vertex (composition P) 0) (ThreeVertexAlgebra.vertex (composition P) 1) + (arrow01 P a) ((ThreeVertexAlgebra.directedSystem (composition P)).idem 0) + ((ThreeVertexAlgebra.directedSystem (composition P)).idem 1) + (CanonicalArrowCompatibility.arrow01_target P a) + (InducedRectification.total (ConcreteQuadraticDiagram.quadratic P) D₀ D₁ D₂ f g H) + erw [hs] at h + dsimp only [iota] + erw [original_iota0, original_iota1, Category.assoc] + exact h + +/-- The second arrow family retains its original maps as well. -/ +def compatibility12 (b : Fin (d+1)) : Homotopy + (iota P D₀ D₁ D₂ f g H N 1 ≫ arrow12Map P D₀ D₁ D₂ f g H N b) + (((BalancedTensor.tensorFunctor k (B P) N).mapHomologicalComplex (.up ℤ)).map (g b) ≫ + iota P D₀ D₁ D₂ f g H N 2) := by + have h := ((BalancedTensor.tensorFunctor k (B P) N).mapHomotopy + (CanonicalArrowCompatibility.compatibility12 P D₀ D₁ D₂ f g H b)).compRight + (TensorArrowComparison.complexIso k (B P) N (ThreeVertexAlgebra.vertex (composition P) 2) + ((ThreeVertexAlgebra.directedSystem (composition P)).idem 2) + (InducedRectification.total (ConcreteQuadraticDiagram.quadratic P) D₀ D₁ D₂ f g H)).hom + erw [Functor.map_comp_assoc _ (SecondVertex.iota P D₀ D₁ D₂ f g H) + (CanonicalArrowCompatibility.arrow12Map P D₀ D₁ D₂ f g H b), + Functor.map_comp_assoc _ (g b) (ThirdVertex.iota P D₀ D₁ D₂ f g H)] at h + have hs := TensorArrowComparison.complex_arrow_square k (B P) N + (ThreeVertexAlgebra.vertex (composition P) 1) (ThreeVertexAlgebra.vertex (composition P) 2) + (arrow12 P b) ((ThreeVertexAlgebra.directedSystem (composition P)).idem 1) + ((ThreeVertexAlgebra.directedSystem (composition P)).idem 2) + (CanonicalArrowCompatibility.arrow12_target P b) + (InducedRectification.total (ConcreteQuadraticDiagram.quadratic P) D₀ D₁ D₂ f g H) + erw [hs] at h + dsimp only [iota] + erw [original_iota1, original_iota2, Category.assoc] + exact h +end LittleFinitistic.FullTensorRectification + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/GradedVertexAcyclic.lean b/lean/OAI/Algebra/Finitistic/Rectification/GradedVertexAcyclic.lean new file mode 100644 index 0000000000000000000000000000000000000000..b615dea8100180eb87e1d4f163ad6c1dff9406dc --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/GradedVertexAcyclic.lean @@ -0,0 +1,73 @@ +import OAI.Algebra.Finitistic.Rectification.SourceFiltrationComplex +import OAI.Algebra.Finitistic.Rectification.ConcreteAdjacentGraded +import OAI.Algebra.Finitistic.Rectification.ZeroLastColumn +import OAI.Algebra.Finitistic.Rectification.ColumnProperties + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits HomologicalComplex CochainComplex +namespace LittleFinitistic.GradedVertexAcyclic + +theorem acyclic_of_iso {C : Type*} [Category C] [Abelian C] + {X Y : CochainComplex C ℤ} (e : X ≅ Y) (hY : Y.Acyclic) : X.Acyclic := by + intro n + rw [exactAt_iff_isZero_homology] + exact ((homologyFunctor C (.up ℤ) n).mapIso e).isZero_iff.mpr (hY n).isZero_homology + +open ExternalTensor.Section4 ExternalTensor.Section4.SourceFiltration +universe u +variable {k : Type u} [Field k] {d t : ℕ} (P : QuadraticEncoding.Relations k d t) +variable (D₀ D₁ D₂ : RightComplex (QuadraticEncoding.B P)) +variable (f : Fin (d+1) → (D₀ ⟶ D₁)) (g : Fin (d+1) → (D₁ ⟶ D₂)) +local notation "T" => QuadraticEncoding.B P +local notation "s" => ConcreteQuadraticDiagram.quadratic P + +/-- The actual source-one quotient is the adjacent-arrow cone after taking vertex two. -/ +def grade1VertexIso : + (AdjacentArrowSum.vertexComplex (QuadraticEncoding.composition P) 2).obj + (Exactness.G1 s D₀ D₁ D₂ f g) ≅ + mappingCone ((AdjacentArrowSum.vertexComplex (QuadraticEncoding.composition P) 2).map + (ConcreteAdjacentGraded.arrow12Sum P D₁)) := + (AdjacentArrowSum.vertexComplex (QuadraticEncoding.composition P) 2).mapIso + (grade1ConeIso (Exactness.data s D₀ D₁ D₂ f g)).symm ≪≫ + mappingCone.mapHomologicalComplexIso (pGrade1 (Exactness.data s D₀ D₁ D₂ f g)) + (BimoduleVertex.functor k T (ThreeVertexAlgebra.vertex (QuadraticEncoding.composition P) 2)) + +theorem grade1_vertex2_acyclic : + ((AdjacentArrowSum.vertexComplex (QuadraticEncoding.composition P) 2).obj + (Exactness.G1 s D₀ D₁ D₂ f g)).Acyclic := + acyclic_of_iso (grade1VertexIso P D₀ D₁ D₂ f g) + (ConcreteAdjacentGraded.vertex2_cone_acyclic P D₁) + +/-- The relation column of the actual source-zero quotient vanishes at vertex one. -/ +theorem relationColumn_vertex1_zero : + IsZero ((AdjacentArrowSum.vertexComplex (QuadraticEncoding.composition P) 1).obj + (Exactness.data s D₀ D₁ D₂ f g).L₂) := by + let F := AdjacentArrowSum.vertexComplex (QuadraticEncoding.composition P) 1 + change IsZero (F.obj (⨁ fun _ : RelationBasisCoefficients.RelationIndex P => + (columnComplex k T (s).e₂).obj D₀)) + apply (F.mapBiproduct _).isZero_iff.mpr + exact sum_isZero _ (fun _ => + VertexColumnComplex.reverse_isZero (QuadraticEncoding.composition P) 1 2 (by decide) D₀) + +/-- The actual source-zero quotient at vertex one is the first adjacent-arrow cone. -/ +def grade0Vertex1Iso : + (AdjacentArrowSum.vertexComplex (QuadraticEncoding.composition P) 1).obj + (Exactness.G0 s D₀ D₁ D₂ f g) ≅ + mappingCone ((AdjacentArrowSum.vertexComplex (QuadraticEncoding.composition P) 1).map + (ConcreteAdjacentGraded.arrow01Sum P D₀)) := + ZeroLastColumn.mappedTotalIso (p0 (Exactness.data s D₀ D₁ D₂ f g)) + (q0 (Exactness.data s D₀ D₁ D₂ f g)) (h0 (Exactness.data s D₀ D₁ D₂ f g)) + (BimoduleVertex.functor k T (ThreeVertexAlgebra.vertex (QuadraticEncoding.composition P) 1)) + (relationColumn_vertex1_zero P D₀ D₁ D₂ f g) + +theorem grade0_vertex1_acyclic : + ((AdjacentArrowSum.vertexComplex (QuadraticEncoding.composition P) 1).obj + (Exactness.G0 s D₀ D₁ D₂ f g)).Acyclic := + acyclic_of_iso (grade0Vertex1Iso P D₀ D₁ D₂ f g) + (ConcreteAdjacentGraded.vertex1_cone_acyclic P D₀) +end LittleFinitistic.GradedVertexAcyclic + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/InducedColumns.lean b/lean/OAI/Algebra/Finitistic/Rectification/InducedColumns.lean new file mode 100644 index 0000000000000000000000000000000000000000..e61159fb3ea43dfb462d1364f239f35460e44ac5 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/InducedColumns.lean @@ -0,0 +1,104 @@ +import OAI.Algebra.Finitistic.Rectification.ExternalTensor + +namespace OAI +open scoped TensorProduct +noncomputable section + +namespace ExternalTensor + +attribute [local instance] bimodule rightModule + +variable (k B : Type*) [Field k] [Ring B] [Algebra k B] + +/-- The actual principal left ideal B e, the image of right multiplication by e. -/ +def leftIdeal (e : B) : Submodule B B := (LinearMap.mulRight B e).range + +@[simp] theorem mem_leftIdeal (e x : B) : x ∈ leftIdeal B e ↔ ∃ b : B, b * e = x := + Iff.rfl + +theorem leftIdeal_finiteDimensional [FiniteDimensional k B] (e : B) : + FiniteDimensional k (leftIdeal B e) := + FiniteDimensional.of_injective ((leftIdeal B e).subtype.restrictScalars k) + Subtype.val_injective + +attribute [local instance] leftIdeal_finiteDimensional + +variable (N : Type*) [AddCommGroup N] [Module k N] + [Module Bᵐᵒᵖ N] [IsScalarTower k Bᵐᵒᵖ N] + +/-- The induced column in Section 4, with its external actions. -/ +abbrev Column (e : B) := (leftIdeal B e) ⊗[k] N + +theorem column_projective (e : B) [Module.Projective Bᵐᵒᵖ N] : + Module.Projective Bᵐᵒᵖ (Column k B N e) := + projective_right k B (leftIdeal B e) N + +theorem column_finite_right [FiniteDimensional k B] (e : B) + [Module.Finite Bᵐᵒᵖ N] : Module.Finite Bᵐᵒᵖ (Column k B N e) := + finite_right k B (leftIdeal B e) N + +theorem column_finiteDimensional [FiniteDimensional k B] (e : B) + [Module.Finite Bᵐᵒᵖ N] : FiniteDimensional k (Column k B N e) := by + let : Module.Finite k N := Module.Finite.trans Bᵐᵒᵖ N + exact finiteDimensional k (leftIdeal B e) N + +/-- The full induced-column assertion required for each summand of L'_0,L'_1,L'_2. -/ +theorem induced_column [FiniteDimensional k B] (e : B) + [Module.Finite Bᵐᵒᵖ N] [Module.Projective Bᵐᵒᵖ N] : + FiniteDimensional k (Column k B N e) ∧ + Module.Finite Bᵐᵒᵖ (Column k B N e) ∧ + Module.Projective Bᵐᵒᵖ (Column k B N e) := + ⟨column_finiteDimensional k B N e, column_finite_right k B N e, + column_projective k B N e⟩ + + +/-- The distinguished generator e of the principal left ideal. -/ +def generator (e : B) : leftIdeal B e := ⟨e, ⟨1, one_mul e⟩⟩ + +/-- The right-linear insertion used in the vertex maps iota_i. -/ +def columnInclusion (e : B) : N →ₗ[Bᵐᵒᵖ] Column k B N e where + toFun n := generator B e ⊗ₜ[k] n + map_add' first second := TensorProduct.tmul_add _ first second + map_smul' c n := (right_smul_tmul k B (leftIdeal B e) N c (generator B e) n).symm + +@[simp] theorem columnInclusion_apply (e : B) (n : N) : + columnInclusion k B N e n = generator B e ⊗ₜ[k] n := rfl + +variable {B} +/-- Right multiplication by a path a: i→j maps B e_j to B e_i. +Only the relation a e_i = a is needed for membership in the target ideal. -/ +def pathMap (ei ej a : B) (ha : a * ei = a) : + leftIdeal B ej →ₗ[B] leftIdeal B ei where + toFun c := ⟨c.val * a, ⟨c.val * a, by simp [LinearMap.mulRight_apply, mul_assoc, ha]⟩⟩ + map_add' c d := Subtype.ext (add_mul c.val d.val a) + map_smul' b c := Subtype.ext (mul_assoc b c.val a) + +@[simp] theorem pathMap_apply (ei ej a : B) (ha : a * ei = a) (c : leftIdeal B ej) : + (pathMap ei ej a ha c : B) = (c : B) * a := rfl + +variable {N} +/-- The path-multiplication component c tensor n ↦ ca tensor n of the rectification maps. -/ +def columnPath (ei ej a : B) (ha : a * ei = a) : + Column k B N ej →ₗ[B ⊗[k] Bᵐᵒᵖ] Column k B N ei := + map (k := k) (pathMap ei ej a ha) LinearMap.id + +@[simp] theorem columnPath_tmul (ei ej a : B) (ha : a * ei = a) + (c : leftIdeal B ej) (n : N) : + columnPath k ei ej a ha (c ⊗ₜ[k] n) = (pathMap ei ej a ha c) ⊗ₜ[k] n := rfl + +variable {N' : Type*} [AddCommGroup N'] [Module k N'] + [Module Bᵐᵒᵖ N'] [IsScalarTower k Bᵐᵒᵖ N'] + +/-- The differential or relation-homotopy component c tensor n ↦ c tensor f(n). -/ +def columnMap (e : B) (f : N →ₗ[Bᵐᵒᵖ] N') : + Column k B N e →ₗ[B ⊗[k] Bᵐᵒᵖ] Column k B N' e := + map (k := k) LinearMap.id f + +@[simp] theorem columnMap_tmul (e : B) (f : N →ₗ[Bᵐᵒᵖ] N') + (c : leftIdeal B e) (n : N) : + columnMap k e f (c ⊗ₜ[k] n) = c ⊗ₜ[k] f n := rfl +end ExternalTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/InducedDerivedFunctor.lean b/lean/OAI/Algebra/Finitistic/Rectification/InducedDerivedFunctor.lean new file mode 100644 index 0000000000000000000000000000000000000000..eb8d119d770f8311d71dc9c3f78b8970960012f0 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/InducedDerivedFunctor.lean @@ -0,0 +1,52 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleDerivedInterval + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.BimoduleTotal +open ExternalTensor.Section4 +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +variable {A J R : Type} [Fintype A] [Fintype J] [Fintype R] +variable (s : Quadratic k B (A := A) (J := J) (R := R)) +variable (D₀ D₁ D₂ : RightComplex B) +variable (f : A → (D₀ ⟶ D₁)) (g : J → (D₁ ⟶ D₂)) +variable (H : ∀ r, Homotopy (relationMap s D₀ D₁ D₂ f g r) 0) +variable (h₀ : ∀ n, Module.Projective Bᵐᵒᵖ (D₀.X n)) +variable (h₁ : ∀ n, Module.Projective Bᵐᵒᵖ (D₁.X n)) +variable (h₂ : ∀ n, Module.Projective Bᵐᵒᵖ (D₂.X n)) + +include h₀ h₁ h₂ in +/-- The fixed native rectification supplies the precise projectivity required by the frozen total theorem. -/ +theorem induced_term_projective (n : ℤ) : Module.Projective Bᵐᵒᵖ + (ComplexTensor.rightTerm k B (right k B + (InducedRectification.total s D₀ D₁ D₂ f g H)) n) := by + let := InducedRectification.rightTotal_projective s D₀ D₁ D₂ f g H h₀ h₁ h₂ n + exact inferInstanceAs (Module.Projective Bᵐᵒᵖ + ((InducedRectification.rightTotal s D₀ D₁ D₂ f g H).X n)) + +variable [HasDerivedCategory.{u+1} (ModuleCat.{u} B)] + +/-- Native P is fixed before the arbitrary derived input is supplied. -/ +def inducedDerived (lo hi : ℤ) : + DerivedCategory (ModuleCat.{u} B) ⥤ DerivedCategory (ModuleCat.{u} B) := by + letI : ∀ n, Module.Projective Bᵐᵒᵖ + (ComplexTensor.rightTerm k B (right k B (InducedRectification.total s D₀ D₁ D₂ f g H)) n) := + fun n => induced_term_projective s D₀ D₁ D₂ f g H h₀ h₁ h₂ n + exact derivedInterval k B (InducedRectification.total s D₀ D₁ D₂ f g H) (lo-2) hi + +omit [HasDerivedCategory.{u+1} (ModuleCat.{u} B)] in +/-- The selected interval contains the complete actual native P whenever the source complexes have these bounds. -/ +theorem induced_complete (lo hi : ℤ) + (b₀ : ∀ n, n < lo ∨ hi < n → IsZero (D₀.X n)) + (b₁ : ∀ n, n < lo ∨ hi < n → IsZero (D₁.X n)) + (b₂ : ∀ n, n < lo ∨ hi < n → IsZero (D₂.X n)) + (n : ℤ) (hn : ∀ i, intervalDegrees (lo-2) hi i ≠ n) : + IsZero ((InducedRectification.total s D₀ D₁ D₂ f g H).X n) := + outside_interval_isZero k B _ (lo-2) hi + (InducedRectification.total_bounded s D₀ D₁ D₂ f g H lo hi b₀ b₁ b₂) n hn +end LittleFinitistic.BimoduleTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/InducedDiagram.lean b/lean/OAI/Algebra/Finitistic/Rectification/InducedDiagram.lean new file mode 100644 index 0000000000000000000000000000000000000000..c73c54f88f8c6efe5eb261b63d535785687a43d1 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/InducedDiagram.lean @@ -0,0 +1,185 @@ +import OAI.Algebra.Finitistic.Rectification.DiagramAssembly +import Mathlib.CategoryTheory.Preadditive.Biproducts + +namespace OAI +open CategoryTheory CategoryTheory.Limits HomologicalComplex +open scoped TensorProduct ModuleCat.Algebra +noncomputable section +namespace ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] +instance biFiniteBiproducts : HasFiniteBiproducts (BiComplex k B) := + HasFiniteBiproducts.of_hasFiniteProducts +instance biBinaryBiproducts : HasBinaryBiproducts (BiComplex k B) := + HasBinaryBiproducts.of_hasBinaryProducts + +private theorem smul_comp_add {C : Type*} [Category C] [Preadditive C] [Linear k C] + {X Y₁ Y₂ Z : C} (c : k) (f₁ : X ⟶ Y₁) (f₂ : Y₁ ⟶ Z) + (g₁ : X ⟶ Y₂) (g₂ : Y₂ ⟶ Z) : + (c • f₁) ≫ f₂ + (c • g₁) ≫ g₂ = c • (f₁ ≫ f₂ + g₁ ≫ g₂) := by + simp only [Linear.smul_comp, smul_add] + +private def framedMapHomotopy {C E : Type*} [Category C] [Preadditive C] + [Category E] [Preadditive E] (G : C ⥤ E) [G.Additive] + {X Y : CochainComplex C ℤ} {P Q : CochainComplex E ℤ} + (f : X ⟶ Y) (H : Homotopy f 0) + (a : P ⟶ (G.mapHomologicalComplex (.up ℤ)).obj X) + (b : (G.mapHomologicalComplex (.up ℤ)).obj Y ⟶ Q) : + Homotopy (a ≫ (G.mapHomologicalComplex (.up ℤ)).map f ≫ b) 0 where + hom i j := a.f i ≫ G.map (H.hom i j) ≫ b.f j + zero i j hij := by rw [H.zero i j hij, G.map_zero, zero_comp, comp_zero] + comm i := by + let h := ((G.mapHomotopy H).compLeft a).compRight b + simpa [h, Category.assoc, dNext, prevD] using h.comm i + +variable {A J R : Type} [Fintype A] [Fintype J] [Fintype R] + +/-- Only the finite quadratic diagram data used in the column calculation. +These equations hold for Section 3's arrows in e_j B e_i and relation basis. +No independence of relations is needed for the stronger assembly statement. -/ +structure Quadratic where + e₀ : B + e₁ : B + e₂ : B + a : A → B + b : J → B + ha : ∀ i, a i * e₀ = a i + hb : ∀ j, b j * e₁ = b j + coeff : R → A → J → k + relation : ∀ r, ∑ i, ∑ j, coeff r i j • (b j * a i) = 0 + +variable {k B} +variable (s : Quadratic k B (A := A) (J := J) (R := R)) +variable (D₀ D₁ D₂ : RightComplex B) +variable (f : A → (D₀ ⟶ D₁)) (g : J → (D₁ ⟶ D₂)) + +/-- The actual finite relation evaluated on the chosen chain maps. -/ +def relationMap (r : R) : D₀ ⟶ D₂ := ∑ a, ∑ b, s.coeff r a b • (f a ≫ g b) + +/-- All columns and components are induced from actual modules, paths and maps. -/ +def inducedData : AssemblyData (C := BiComplex k B) (A := A) (J := J) (R := R) where + V₀ := (columnComplex k B s.e₀).obj D₀ + V₁ := (columnComplex k B s.e₁).obj D₁ + V₂ := (columnComplex k B s.e₂).obj D₂ + U _ := (columnComplex k B s.e₁).obj D₀ + V _ := (columnComplex k B s.e₂).obj D₁ + W _ := (columnComplex k B s.e₂).obj D₀ + pa₀ a := path k B s.e₀ s.e₁ (s.a a) (s.ha a) D₀ + pa₁ a := (columnComplex k B s.e₁).map (f a) + pb₁ b := path k B s.e₁ s.e₂ (s.b b) (s.hb b) D₁ + pb₂ b := (columnComplex k B s.e₂).map (g b) + qa r a b := s.coeff r a b • path k B s.e₁ s.e₂ (s.b b) (s.hb b) D₀ + qb r a b := s.coeff r a b • (columnComplex k B s.e₂).map (f a) + rel r := (columnComplex k B s.e₂).map (relationMap s D₀ D₁ D₂ f g r) + middle r a b := by simp [Linear.smul_comp] + first r := by + simpa only [Linear.smul_comp] using + paths_relation k B s.e₀ s.e₁ s.e₂ s.a s.b s.ha s.hb (s.coeff r) (s.relation r) D₀ + last r := by + simp only [Linear.smul_comp, relationMap, Functor.map_sum, Functor.map_smul, + Functor.map_comp] + +abbrev L0Prime := (inducedData s D₀ D₁ D₂ f g).L₀ +abbrev L1Prime := (inducedData s D₀ D₁ D₂ f g).L₁ +abbrev L2Prime := (inducedData s D₀ D₁ D₂ f g).L₂ +abbrev p := (inducedData s D₀ D₁ D₂ f g).p +abbrev q := (inducedData s D₀ D₁ D₂ f g).q + +omit [Fintype R] in +@[reassoc] theorem p_arrow01 (a : A) : + biproduct.ι (inducedData s D₀ D₁ D₂ f g).U a ≫ biprod.inl ≫ + p s D₀ D₁ D₂ f g = + path k B s.e₀ s.e₁ (s.a a) (s.ha a) D₀ ≫ (inducedData s D₀ D₁ D₂ f g).in₀ - + (columnComplex k B s.e₁).map (f a) ≫ (inducedData s D₀ D₁ D₂ f g).in₁ := by + simp only [p, AssemblyData.p, biprod.inl_desc, biproduct.ι_desc] + rfl + +omit [Fintype R] in +@[reassoc] theorem p_arrow12 (b : J) : + biproduct.ι (inducedData s D₀ D₁ D₂ f g).V b ≫ biprod.inr ≫ + p s D₀ D₁ D₂ f g = + path k B s.e₁ s.e₂ (s.b b) (s.hb b) D₁ ≫ (inducedData s D₀ D₁ D₂ f g).in₁ - + (columnComplex k B s.e₂).map (g b) ≫ (inducedData s D₀ D₁ D₂ f g).in₂ := by + simp only [p, AssemblyData.p, biprod.inr_desc, biproduct.ι_desc] + rfl + +theorem q_relation (r : R) : + biproduct.ι (inducedData s D₀ D₁ D₂ f g).W r ≫ q s D₀ D₁ D₂ f g = + ∑ a, ∑ b, s.coeff r a b • + (path k B s.e₁ s.e₂ (s.b b) (s.hb b) D₀ ≫ + biproduct.ι (inducedData s D₀ D₁ D₂ f g).U a ≫ biprod.inl + + (columnComplex k B s.e₂).map (f a) ≫ + biproduct.ι (inducedData s D₀ D₁ D₂ f g).V b ≫ biprod.inr) := by + simp only [q, AssemblyData.q, biproduct.ι_desc] + apply Finset.sum_congr rfl + intro a _ + apply Finset.sum_congr rfl + intro b _ + exact smul_comp_add k (s.coeff r a b) _ _ _ _ + +variable (H : ∀ r, Homotopy (relationMap s D₀ D₁ D₂ f g r) 0) + +/-- Positive degree-minus-one h of the manuscript, packaged with its equation. -/ +def positiveHomotopy : + Homotopy (biproduct.desc fun r => + (inducedData s D₀ D₁ D₂ f g).rel r ≫ (inducedData s D₀ D₁ D₂ f g).in₂) 0 := by + classical + let t := inducedData s D₀ D₁ D₂ f g + let F (r : R) := biproduct.π t.W r ≫ t.rel r ≫ t.in₂ + let hh (r : R) : Homotopy (F r) 0 := + framedMapHomotopy (columnFunctor k B s.e₂) (relationMap s D₀ D₁ D₂ f g r) + (H r) (biproduct.π t.W r) t.in₂ + have hs := AssemblyData.sumHomotopy F hh + have heq : (∑ r, F r) = biproduct.desc (fun r => t.rel r ≫ t.in₂) := by + exact biproduct.desc_eq.symm + refine { hom := hs.hom, zero := hs.zero, comm := ?_ } + intro i + rw [← heq] + exact hs.comm i + +/-- The sign-correct null-homotopy required by RectificationTotal.total. -/ +def nullHomotopy : Homotopy (q s D₀ D₁ D₂ f g ≫ p s D₀ D₁ D₂ f g) 0 := by + rw [AssemblyData.composite] + simpa using (positiveHomotopy s D₀ D₁ D₂ f g H).smul (-1 : k) + +/-- The manuscript h, with zero components away from degree minus one. -/ +def h (i j : ℤ) := (positiveHomotopy s D₀ D₁ D₂ f g H).hom i j + +theorem h_formula (i j : ℤ) : h s D₀ D₁ D₂ f g H i j = + ∑ r, (biproduct.π (inducedData s D₀ D₁ D₂ f g).W r).f i ≫ + (columnFunctor k B s.e₂).map ((H r).hom i j) ≫ + (inducedData s D₀ D₁ D₂ f g).in₂.f j := rfl + +theorem h_relation (r : R) (i j : ℤ) : + (biproduct.ι (inducedData s D₀ D₁ D₂ f g).W r).f i ≫ h s D₀ D₁ D₂ f g H i j = + (columnFunctor k B s.e₂).map ((H r).hom i j) ≫ + (inducedData s D₀ D₁ D₂ f g).in₂.f j := by + classical + simp only [h_formula, Preadditive.comp_sum, ← Category.assoc, ← comp_f] + simp only [biproduct.ι_π] + rw [Finset.sum_eq_single r] + · simp + rfl + · intro x _ hxr + simp [Ne.symm hxr] + · simp + +theorem h_shape (i j : ℤ) (hij : j + 1 ≠ i) : h s D₀ D₁ D₂ f g H i j = 0 := + (positiveHomotopy s D₀ D₁ D₂ f g H).zero i j hij + +/-- Precisely the remaining off-diagonal entry in the manuscript's d_P squared. -/ +theorem square (n : ℤ) : + h s D₀ D₁ D₂ f g H n (n-1) ≫ (L0Prime s D₀ D₁ D₂ f g).d (n-1) n + + (q s D₀ D₁ D₂ f g ≫ p s D₀ D₁ D₂ f g).f n + + (L2Prime s D₀ D₁ D₂ f g).d n (n+1) ≫ h s D₀ D₁ D₂ f g H (n+1) n = 0 := by + have hh := (positiveHomotopy s D₀ D₁ D₂ f g H).comm n + rw [dNext_eq _ (show (ComplexShape.up ℤ).Rel n (n+1) by simp), + prevD_eq _ (show (ComplexShape.up ℤ).Rel (n-1) n by simp)] at hh + rw [AssemblyData.composite, neg_f_apply, hh] + dsimp [h, L0Prime, L2Prime] + abel +end ExternalTensor.Section4 + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/InducedRectification.lean b/lean/OAI/Algebra/Finitistic/Rectification/InducedRectification.lean new file mode 100644 index 0000000000000000000000000000000000000000..2653a25d1ebc7e16e18d5dcf28e1917ce429336f --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/InducedRectification.lean @@ -0,0 +1,60 @@ +import Mathlib.Algebra.Category.ModuleCat.Biproducts +import OAI.Algebra.Finitistic.Rectification.InducedDiagram +import OAI.Algebra.Finitistic.Rectification.ColumnProperties +import OAI.Algebra.Finitistic.Rectification.RectificationTotal + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.InducedRectification +open ExternalTensor.Section4 +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +variable {A J R : Type} [Fintype A] [Fintype J] [Fintype R] +variable (s : Quadratic k B (A := A) (J := J) (R := R)) +variable (D₀ D₁ D₂ : RightComplex B) +variable (f : A → (D₀ ⟶ D₁)) (g : J → (D₁ ⟶ D₂)) +variable (H : ∀ r, Homotopy (relationMap s D₀ D₁ D₂ f g r) 0) + +/-- The actual three-column induced bimodule complex of Section 4. -/ +def total : BiComplex k B := + RectificationTotal.total (p s D₀ D₁ D₂ f g) (q s D₀ D₁ D₂ f g) + (nullHomotopy s D₀ D₁ D₂ f g H) + +/-- Its right-module restriction, retaining the original bimodule construction. -/ +def rightTotal : RightComplex B := + ((forgetRight k B).mapHomologicalComplex (.up ℤ)).obj (total s D₀ D₁ D₂ f g H) + +theorem total_bounded (lo hi : ℤ) + (h₀ : ∀ n, n < lo ∨ hi < n → IsZero (D₀.X n)) + (h₁ : ∀ n, n < lo ∨ hi < n → IsZero (D₁.X n)) + (h₂ : ∀ n, n < lo ∨ hi < n → IsZero (D₂.X n)) : + ∀ n, n < lo-2 ∨ hi < n → IsZero ((total s D₀ D₁ D₂ f g H).X n) := by + have hc := columns_bounded s D₀ D₁ D₂ f g lo hi h₀ h₁ h₂ + exact RectificationTotal.total_bounded _ _ _ lo hi + (fun n hn => (hc n hn).1) (fun n hn => (hc n hn).2.1) + (fun n hn => (hc n hn).2.2) + +/-- Termwise projectivity holds for the actual right restriction of the total. -/ +theorem rightTotal_projective + (h₀ : ∀ n, Module.Projective Bᵐᵒᵖ (D₀.X n)) + (h₁ : ∀ n, Module.Projective Bᵐᵒᵖ (D₁.X n)) + (h₂ : ∀ n, Module.Projective Bᵐᵒᵖ (D₂.X n)) : + ∀ n, Projective ((rightTotal s D₀ D₁ D₂ f g H).X n) := by + have hc := columns_right_projective s D₀ D₁ D₂ f g h₀ h₁ h₂ + exact RectificationTotal.total_projective_after _ _ _ (forgetRight k B) + (fun n => (hc n).1) (fun n => (hc n).2.1) (fun n => (hc n).2.2) + +/-- The entire zero column has its original chain inclusion. -/ +def inclusion : L0Prime s D₀ D₁ D₂ f g ⟶ total s D₀ D₁ D₂ f g H := + RectificationTotal.inclusion _ _ _ + +/-- The prescribed first boundary becomes null-homotopic in the actual total. -/ +def boundaryHomotopy : Homotopy + (p s D₀ D₁ D₂ f g ≫ inclusion s D₀ D₁ D₂ f g H) 0 := + RectificationTotal.boundaryHomotopy _ _ _ +end LittleFinitistic.InducedRectification + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/LeftVertexHomology.lean b/lean/OAI/Algebra/Finitistic/Rectification/LeftVertexHomology.lean new file mode 100644 index 0000000000000000000000000000000000000000..baa129b63ef135ab0698e581603110d76cd8d1d2 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/LeftVertexHomology.lean @@ -0,0 +1,74 @@ +import OAI.Algebra.Finitistic.Rectification.VertexHomology +import OAI.Algebra.Finitistic.Rectification.VertexDecomposition + +namespace OAI +noncomputable section +open CategoryTheory HomologicalComplex +namespace LittleFinitistic.LeftVertexHomology +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] + +lemma scalar_commute (e : B) (c : k) : e * algebraMap k B c = algebraMap k B c * e := + (Algebra.commutes c e).symm + +/-- The actual left vertex functor from B-modules to k-vector spaces. -/ +abbrev vertex (e : B) : ModuleCat.{u} B ⥤ ModuleCat.{u} k := + VertexFunctor.functor (algebraMap k B) e (scalar_commute k B e) + +/-- Arrow action is a natural transformation between the actual vertex functors. -/ +def arrow (ei ej a : B) (ha : ej*a=a) : vertex k B ei ⟶ vertex k B ej where + app M := ModuleCat.ofHom { + toFun := fun x => ⟨a • (x.val : M), by + rw [VertexFunctor.mem_fixed] + rw [← mul_smul, ha]⟩ + map_add' := fun x y => Subtype.ext (smul_add _ _ _) + map_smul' := fun c x => by + apply Subtype.ext + change a • (algebraMap k B c • (x.val : M)) = + algebraMap k B c • (a • (x.val : M)) + rw [← mul_smul, ← mul_smul, scalar_commute] } + naturality M M' f := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + apply Subtype.ext + exact (f.hom.map_smul a x.val).symm + +instance scalarTower (M : ModuleCat.{u} B) : + IsScalarTower k B ((ModuleCat.restrictScalars (algebraMap k B)).obj M) := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) + +/-- Identify the vertex functor with the actual fixed subspace of scalar restriction. -/ +def spaceEquiv (e : B) (M : ModuleCat.{u} B) : + (vertex k B e).obj M ≃ₗ[k] + IdempotentTensor.leftSpace (k := k) e ((ModuleCat.restrictScalars (algebraMap k B)).obj M) where + toFun x := ⟨x.val, (VertexFunctor.mem_fixed _ _ _ M x.val).1 x.property⟩ + invFun x := ⟨x.val, (VertexFunctor.mem_fixed _ _ _ M x.val).2 x.property⟩ + left_inv _ := rfl + right_inv _ := rfl + map_add' _ _ := rfl + map_smul' _ _ := rfl + +/-- Actual vertex homology, identified with the actual subspace of module homology. -/ +def homologyEquiv (e : B) (he : e*e=e) + (X : CochainComplex (ModuleCat.{u} B) ℤ) (n : ℤ) : + (((vertex k B e).mapHomologicalComplex (.up ℤ)).obj X).homology n ≃ₗ[k] + IdempotentTensor.leftSpace (k := k) e + ((ModuleCat.restrictScalars (algebraMap k B)).obj (X.homology n)) := + (VertexHomology.iso (algebraMap k B) e he (scalar_commute k B e) X n).toLinearEquiv.trans + (spaceEquiv k B e (X.homology n)) + +/-- Cohomology comparison retains the original arrow action, not only dimensions. -/ +theorem arrow_homology (ei ej a : B) (hi : ei*ei=ei) (hj : ej*ej=ej) (ha : ej*a=a) + (X : CochainComplex (ModuleCat.{u} B) ℤ) (n : ℤ) : + homologyMap ((NatTrans.mapHomologicalComplex (arrow k B ei ej a ha) (.up ℤ)).app X) n ≫ + (VertexHomology.iso (algebraMap k B) ej hj (scalar_commute k B ej) X n).hom = + (VertexHomology.iso (algebraMap k B) ei hi (scalar_commute k B ei) X n).hom ≫ + (arrow k B ei ej a ha).app (X.homology n) := + VertexHomology.natural (algebraMap k B) ei hi (scalar_commute k B ei) + ej hj (scalar_commute k B ej) _ X n +end LittleFinitistic.LeftVertexHomology + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/RectificationAcyclic.lean b/lean/OAI/Algebra/Finitistic/Rectification/RectificationAcyclic.lean new file mode 100644 index 0000000000000000000000000000000000000000..9e8ba35ddd387e79ffb0b0d2564fa0f2b5d7e4e0 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/RectificationAcyclic.lean @@ -0,0 +1,115 @@ +import Mathlib.Algebra.Homology.DerivedCategory.KProjective +import Mathlib.Algebra.Homology.HomotopyCategory.ShortExact +import OAI.Algebra.Finitistic.Rectification.RectificationTotal + +namespace OAI + +namespace LittleFinitistic.RectificationAcyclic +open CategoryTheory CategoryTheory.Limits HomologicalComplex CochainComplex + +variable {C : Type*} [Category C] [Abelian C] + +/-- The ordinary cone of a quasi-isomorphism is acyclic. -/ +theorem cone_acyclic {K L : CochainComplex C ℤ} (f : K ⟶ L) [QuasiIso f] : + (mappingCone f).Acyclic := by + let P := HomotopyCategory.subcategoryAcyclic C + have hf : P.trW ((HomotopyCategory.quotient C (.up ℤ)).map f) := by + rw [← HomotopyCategory.quasiIso_eq_trW_subcategoryAcyclic, + HomotopyCategory.quotient_map_mem_quasiIso_iff,HomologicalComplex.mem_quasiIso_iff] + infer_instance + have hT := HomotopyCategory.mappingCone_triangleh_distinguished f + have hz := (P.trW_iff_of_distinguished (mappingCone.triangleh f) hT).1 hf + exact (HomotopyCategory.quotient_obj_mem_subcategoryAcyclic_iff_acyclic _).1 hz + +/-- The total of a strict short exact sequence of complexes is acyclic. This is +applied to the associated graded source-index pieces in rectification. -/ +theorem short_exact_total_acyclic (S : ShortComplex (CochainComplex C ℤ)) + (hS : S.ShortExact) : + (RectificationTotal.total S.g S.f (Homotopy.ofEq S.zero)).Acyclic := by + have he : RectificationTotal.rectifyingMap S.g S.f (Homotopy.ofEq S.zero) = + mappingCone.descShortComplex S := by + simp only [RectificationTotal.rectifyingMap,CochainComplex.HomComplex.Cochain.ofHomotopy_ofEq, + mappingCone.descShortComplex] + change (mappingCone (RectificationTotal.rectifyingMap S.g S.f (Homotopy.ofEq S.zero))).Acyclic + rw [he] + let := mappingCone.quasiIso_descShortComplex hS + exact cone_acyclic _ + +/-- Bounded-above acyclic complexes of projectives admit an actual contraction. -/ +noncomputable def contractBoundedProjective (K : CochainComplex C ℤ) (hi : ℤ) + [K.IsStrictlyLE hi] [∀ i, Projective (K.X i)] (hK : K.Acyclic) : + Homotopy (𝟙 K) 0 := by + letI := CochainComplex.isKProjective_of_projective K hi + exact CochainComplex.IsKProjective.homotopyZero (𝟙 K) hK + +/-- A quasi-isomorphism between bounded-above projective complexes has an actual +chain-map inverse up to specified homotopies, retaining the given forward map. -/ +theorem bounded_projective_homotopy_inverse {K L : CochainComplex C ℤ} + (f : K ⟶ L) [QuasiIso f] (hi : ℤ) [K.IsStrictlyLE hi] [L.IsStrictlyLE hi] + [∀ i, Projective (K.X i)] [∀ i, Projective (L.X i)] : + ∃ g : L ⟶ K, Nonempty (Homotopy (f ≫ g) (𝟙 K)) ∧ + Nonempty (Homotopy (g ≫ f) (𝟙 L)) := by + classical + have : (mappingCone f).IsStrictlyLE hi := by + rw [isStrictlyLE_iff] + intro i hi' + rw [mappingCone.isZero_X_iff] + exact ⟨K.isZero_of_isStrictlyLE hi _ (by omega),L.isZero_of_isStrictlyLE hi _ hi'⟩ + have (degree : ℤ) : Projective ((mappingCone f).X degree) := by + apply Projective.of_iso (homotopyCofiber.XIsoBiprod f degree (degree+1) (by simp)).symm + infer_instance + let q := HomotopyCategory.quotient C (.up ℤ) + have hzero : IsZero (q.obj (mappingCone f)) := + (HomotopyCategory.isZero_quotient_obj_iff _).2 + ⟨contractBoundedProjective _ hi (cone_acyclic f)⟩ + have : IsIso (q.map f) := + ((mappingCone.triangleh f).isZero₃_iff_isIso₁ + (HomotopyCategory.mappingCone_triangleh_distinguished f)).1 hzero + let g := q.preimage (inv (q.map f)) + have hg : q.map g = inv (q.map f) := q.map_preimage _ + refine ⟨g,⟨HomotopyCategory.homotopyOfEq _ _ ?_⟩, + ⟨HomotopyCategory.homotopyOfEq _ _ ?_⟩⟩ + · change q.map (f ≫ g) = q.map (𝟙 K) + rw [Functor.map_comp,hg,IsIso.hom_inv_id,q.map_id] + · change q.map (g ≫ f) = q.map (𝟙 L) + rw [Functor.map_comp,hg,IsIso.inv_hom_id,q.map_id] + +/-- A finite decreasing filtration with acyclic successive quotients is acyclic. +The hypotheses are actual short exact sequences of complexes. -/ +theorem finite_exact_filtration_acyclic (n : ℕ) + (F G : ℕ → CochainComplex C ℤ) + (u : ∀ i, F (i+1) ⟶ F i) (v : ∀ i, F i ⟶ G i) + (huv : ∀ i, u i ≫ v i = 0) + (hseq : ∀ i, i < n → (ShortComplex.mk (u i) (v i) (huv i)).ShortExact) + (hG : ∀ i, i < n → (G i).Acyclic) (hn : (F n).Acyclic) : + (F 0).Acyclic := by + apply Nat.decreasingInduction (motive := fun i _ => (F i).Acyclic) ?_ hn (Nat.zero_le n) + intro i hi hnext + exact (hseq i hi).acyclic_X₂ hnext (hG i hi) + +/-- A short exact inclusion with acyclic quotient is a quasi-isomorphism. -/ +theorem quasiIso_of_acyclic_quotient (S : ShortComplex (CochainComplex C ℤ)) + (hS : S.ShortExact) (hQ : S.X₃.Acyclic) : QuasiIso S.f := by + rw [quasiIso_iff] + intro i + rw [quasiIsoAt_iff_isIso_homologyMap] + have : Mono (HomologicalComplex.homologyMap S.f i) := + (hS.homology_exact₁ (i-1) i (by change i-1+1=i; omega)).mono_g + ((hQ (i-1)).isZero_homology.eq_of_src _ _) + have : Epi (HomologicalComplex.homologyMap S.f i) := + (hS.homology_exact₂ i).epi_f ((hQ i).isZero_homology.eq_of_tgt _ _) + exact isIso_of_mono_of_epi _ + +/-- The given inclusion, rather than an unspecified replacement, has an actual +homotopy inverse once its quotient is proved acyclic by the finite filtration. -/ +theorem inclusion_homotopy_inverse (S : ShortComplex (CochainComplex C ℤ)) + (hS : S.ShortExact) (hQ : S.X₃.Acyclic) (hi : ℤ) + [S.X₁.IsStrictlyLE hi] [S.X₂.IsStrictlyLE hi] + [∀ i, Projective (S.X₁.X i)] [∀ i, Projective (S.X₂.X i)] : + ∃ g : S.X₂ ⟶ S.X₁, Nonempty (Homotopy (S.f ≫ g) (𝟙 S.X₁)) ∧ + Nonempty (Homotopy (g ≫ S.f) (𝟙 S.X₂)) := by + let := quasiIso_of_acyclic_quotient S hS hQ + exact bounded_projective_homotopy_inverse S.f hi +end LittleFinitistic.RectificationAcyclic + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/RectificationLemma.lean b/lean/OAI/Algebra/Finitistic/Rectification/RectificationLemma.lean new file mode 100644 index 0000000000000000000000000000000000000000..0596b82d89780d6ad9d8a565006605f5511648d0 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/RectificationLemma.lean @@ -0,0 +1,63 @@ +import OAI.Algebra.Finitistic.Rectification.CanonicalArrowCompatibility +import OAI.Algebra.Finitistic.Rectification.TotalFinite + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits HomologicalComplex +namespace LittleFinitistic.RectificationLemma +open ExternalTensor.Section4 QuadraticEncoding CanonicalArrowCompatibility +universe u +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) +variable (D₀ D₁ D₂ : RightComplex (B P)) +variable (f : Fin (d+1) → (D₀ ⟶ D₁)) (g : Fin (d+1) → (D₁ ⟶ D₂)) +variable (H : ∀ r, Homotopy (relationMap (ConcreteQuadraticDiagram.quadratic P) D₀ D₁ D₂ f g r) 0) + +/-- The conclusions of the paper's rectification lemma for the explicitly constructed +bimodule complex and original vertex insertion maps. -/ +structure Verified (lo hi : ℤ) : Prop where + bounded : ∀ n, n < lo-2 ∨ hi < n → IsZero + ((InducedRectification.total (ConcreteQuadraticDiagram.quadratic P) D₀ D₁ D₂ f g H).X n) + projective : ∀ n, Projective + ((InducedRectification.rightTotal (ConcreteQuadraticDiagram.quadratic P) D₀ D₁ D₂ f g H).X n) + finite : ∀ n, FiniteDimensional k ((forgetK k (B P)).obj + ((InducedRectification.total (ConcreteQuadraticDiagram.quadratic P) D₀ D₁ D₂ f g H).X n)) + vertices : ∀ v : Fin 3, ∃ j : + VertexHomotopyEquivalence.target P D₀ D₁ D₂ f g H v ⟶ + VertexHomotopyEquivalence.source P D₀ D₁ D₂ v, + Nonempty (Homotopy (VertexHomotopyEquivalence.iota P D₀ D₁ D₂ f g H v ≫ j) (𝟙 _)) ∧ + Nonempty (Homotopy (j ≫ VertexHomotopyEquivalence.iota P D₀ D₁ D₂ f g H v) (𝟙 _)) + arrows01 : ∀ a, Nonempty (Homotopy + (FirstVertex.iota P D₀ D₁ D₂ f g H ≫ arrow01Map P D₀ D₁ D₂ f g H a) + (f a ≫ SecondVertex.iota P D₀ D₁ D₂ f g H)) + arrows12 : ∀ b, Nonempty (Homotopy + (SecondVertex.iota P D₀ D₁ D₂ f g H ≫ arrow12Map P D₀ D₁ D₂ f g H b) + (g b ≫ ThirdVertex.iota P D₀ D₁ D₂ f g H)) + +/-- Full rectification for arbitrary bounded finite projective input complexes, +using only the assigned relation homotopies. No conclusion about the constructed +P, its vertices, or its arrow homotopies is assumed. -/ +theorem rectification (lo hi : ℤ) + (b₀ : ∀ n, n < lo ∨ hi < n → IsZero (D₀.X n)) + (b₁ : ∀ n, n < lo ∨ hi < n → IsZero (D₁.X n)) + (b₂ : ∀ n, n < lo ∨ hi < n → IsZero (D₂.X n)) + (p₀ : ∀ n, Module.Projective (B P)ᵐᵒᵖ (D₀.X n)) + (p₁ : ∀ n, Module.Projective (B P)ᵐᵒᵖ (D₁.X n)) + (p₂ : ∀ n, Module.Projective (B P)ᵐᵒᵖ (D₂.X n)) + (f₀ : ∀ n, Module.Finite (B P)ᵐᵒᵖ (D₀.X n)) + (f₁ : ∀ n, Module.Finite (B P)ᵐᵒᵖ (D₁.X n)) + (f₂ : ∀ n, Module.Finite (B P)ᵐᵒᵖ (D₂.X n)) : + Verified P D₀ D₁ D₂ f g H lo hi := by + have := QuadraticEncoding.finiteDimensional P + exact { + bounded := InducedRectification.total_bounded _ _ _ _ _ _ _ lo hi b₀ b₁ b₂ + projective := InducedRectification.rightTotal_projective _ _ _ _ _ _ _ p₀ p₁ p₂ + finite := induced_total_finite _ _ _ _ _ _ _ f₀ f₁ f₂ + vertices := fun v => VertexHomotopyEquivalence.homotopy_inverse P D₀ D₁ D₂ f g H + v lo hi b₀ b₁ b₂ p₀ p₁ p₂ + arrows01 := fun a => ⟨CanonicalArrowCompatibility.compatibility01 P D₀ D₁ D₂ f g H a⟩ + arrows12 := fun b => ⟨CanonicalArrowCompatibility.compatibility12 P D₀ D₁ D₂ f g H b⟩ } +end LittleFinitistic.RectificationLemma + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/RectificationTotal.lean b/lean/OAI/Algebra/Finitistic/Rectification/RectificationTotal.lean new file mode 100644 index 0000000000000000000000000000000000000000..d0b38eef027a3c09983178d91a5e4aeef067a1cc --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/RectificationTotal.lean @@ -0,0 +1,87 @@ +import OAI.Algebra.Finitistic.Localization.ChainRepresentatives + +namespace OAI + +namespace LittleFinitistic.RectificationTotal +open CategoryTheory CategoryTheory.Limits HomologicalComplex CochainComplex HomComplex + +variable {C : Type*} [Category C] [Preadditive C] [HasBinaryBiproducts C] +variable {L₀ L₁ L₂ : CochainComplex C ℤ} (p : L₁ ⟶ L₀) (q : L₂ ⟶ L₁) + (h : Homotopy (q ≫ p) 0) + +/-- The relation null-homotopy extends p over the first cone. -/ +noncomputable def rectifyingMap : mappingCone q ⟶ L₀ := + mappingCone.desc q (Cochain.ofHomotopy h) p (by simp [δ_ofHomotopy]) + +/-- A genuine cochain complex rectifying a three-column homotopy diagram. +The cone convention fixes all differential signs; the three-column term +isomorphism is given below. -/ +noncomputable def total : CochainComplex C ℤ := mappingCone (rectifyingMap p q h) + +/-- The total complex has exactly the three finite columns. -/ +noncomputable def termIso (i : ℤ) : + (total p q h).X i ≅ (L₂.X (i+2) ⊞ L₁.X (i+1)) ⊞ L₀.X i := + homotopyCofiber.XIsoBiprod (rectifyingMap p q h) i (i+1) (by simp) ≪≫ + biprod.mapIso (homotopyCofiber.XIsoBiprod q (i+1) (i+2) (by simp; omega)) (Iso.refl _) + +@[simp] theorem total_isZero (i : ℤ) : + IsZero ((total p q h).X i) ↔ + (IsZero (L₂.X (i+2)) ∧ IsZero (L₁.X (i+1))) ∧ IsZero (L₀.X i) := by + rw [(termIso p q h i).isZero_iff,biprod_isZero_iff,biprod_isZero_iff] + +/-- Bounded columns give a bounded actual total complex. -/ +theorem total_bounded (lo hi : ℤ) + (h₀ : ∀ i, i < lo ∨ hi < i → IsZero (L₀.X i)) + (h₁ : ∀ i, i < lo ∨ hi < i → IsZero (L₁.X i)) + (h₂ : ∀ i, i < lo ∨ hi < i → IsZero (L₂.X i)) : + ∀ i, i < lo-2 ∨ hi < i → IsZero ((total p q h).X i) := by + intro i hi' + rw [total_isZero] + exact ⟨⟨h₂ _ (by omega),h₁ _ (by omega)⟩,h₀ _ (by omega)⟩ + +/-- Termwise projectivity is preserved by the concrete three-column construction. -/ +theorem total_projective (h₀ : ∀ i, Projective (L₀.X i)) + (h₁ : ∀ i, Projective (L₁.X i)) (h₂ : ∀ i, Projective (L₂.X i)) : + ∀ i, Projective ((total p q h).X i) := by + intro i + let := h₀ i + let := h₁ (i+1) + let := h₂ (i+2) + apply Projective.of_iso (termIso p q h i).symm + infer_instance + +/-- The original zero column includes by an actual chain map. -/ +noncomputable def inclusion : L₀ ⟶ total p q h := mappingCone.inr (rectifyingMap p q h) + +/-- The first-column boundary vanishes by a specified chain homotopy in the total. +For the induced B-arrow columns this is exactly the arrow compatibility homotopy. -/ +noncomputable def boundaryHomotopy : Homotopy (p ≫ inclusion p q h) 0 := by + let f := rectifyingMap p q h + let H : Homotopy (f ≫ mappingCone.inr f) 0 := + (Cochain.equivHomotopy _ _).symm ⟨mappingCone.inl f,by simp⟩ + have H' := H.compLeft (mappingCone.inr q) + have heq : mappingCone.inr q ≫ f = p := mappingCone.inr_desc _ _ _ _ + rw [← Category.assoc,heq,CategoryTheory.Limits.comp_zero] at H' + exact H' + +variable {D : Type*} [Category D] [Preadditive D] [HasBinaryBiproducts D] + +/-- Projectivity after an additive forgetful functor, needed for right projectivity +of a total built in the category of bimodules. -/ +theorem total_projective_after (F : C ⥤ D) [F.Additive] + (h₀ : ∀ i, Projective (F.obj (L₀.X i))) + (h₁ : ∀ i, Projective (F.obj (L₁.X i))) + (h₂ : ∀ i, Projective (F.obj (L₂.X i))) : + ∀ i, Projective (F.obj ((total p q h).X i)) := by + intro i + let := h₀ i + let := h₁ (i+1) + let := h₂ (i+2) + let := preservesBinaryBiproducts_of_preservesBiproducts F + let e := F.mapIso (termIso p q h i) ≪≫ F.mapBiprod _ _ ≪≫ + biprod.mapIso (F.mapBiprod _ _) (Iso.refl _) + apply Projective.of_iso e.symm + infer_instance +end LittleFinitistic.RectificationTotal + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/SecondVertex.lean b/lean/OAI/Algebra/Finitistic/Rectification/SecondVertex.lean new file mode 100644 index 0000000000000000000000000000000000000000..613e359d8d3a3a8fcdbf3a7dc0f0dc5da3c4ae19 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/SecondVertex.lean @@ -0,0 +1,101 @@ +import OAI.Algebra.Finitistic.Rectification.GradedVertexAcyclic +import OAI.Algebra.Finitistic.Rectification.FirstVertex + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits HomologicalComplex +namespace LittleFinitistic.SecondVertex +open ExternalTensor.Section4 ExternalTensor.Section4.SourceFiltration +universe u +variable {k : Type u} [Field k] {d t : ℕ} (P : QuadraticEncoding.Relations k d t) +variable (D₀ D₁ D₂ : RightComplex (QuadraticEncoding.B P)) +variable (f : Fin (d+1) → (D₀ ⟶ D₁)) (g : Fin (d+1) → (D₁ ⟶ D₂)) +local notation "T" => QuadraticEncoding.B P +local notation "s" => ConcreteQuadraticDiagram.quadratic P +abbrev vertex := BimoduleVertex.functor k (QuadraticEncoding.B P) + (ThreeVertexAlgebra.vertex (QuadraticEncoding.composition P) 1) +abbrev vertexComplex := (vertex P).mapHomologicalComplex (.up ℤ) + +def intoF1 : (columnComplex k T (s).e₁).obj D₁ ⟶ Exactness.F1 s D₀ D₁ D₂ f g := + biprod.inl ≫ RectificationTotal.inclusion (p1 (Exactness.data s D₀ D₁ D₂ f g)) 0 + (h1 (Exactness.data s D₀ D₁ D₂ f g)) + +theorem intoF1_isIso : IsIso ((vertexComplex P).map (intoF1 P D₀ D₁ D₂ f g)) := by + let F := vertex P + let G := vertexComplex P + have hz : IsZero (G.obj (Z (k := k) (B := T))) := by + apply G.map_isZero + apply ZeroColumnTotal.complex_zero + intro n + exact ModuleCat.isZero_iff_subsingleton.mpr inferInstance + have hv : IsZero (G.obj ((columnComplex k T (s).e₂).obj D₂)) := + VertexColumnComplex.reverse_isZero (QuadraticEncoding.composition P) 1 2 (by decide) D₂ + have hs : IsZero (G.obj (F1₁ (Exactness.data s D₀ D₁ D₂ f g))) := by + apply (G.mapBiproduct _).isZero_iff.mpr + exact sum_isZero _ (fun _ => + VertexColumnComplex.reverse_isZero (QuadraticEncoding.composition P) 1 2 (by decide) D₁) + have hi := ZeroColumnTotal.mapped_inclusion_isIso + (p1 (Exactness.data s D₀ D₁ D₂ f g)) 0 (h1 (Exactness.data s D₀ D₁ D₂ f g)) F + (fun n => (HomologicalComplex.eval _ _ n).map_isZero hs) + (fun n => (HomologicalComplex.eval _ _ n).map_isZero hz) + have hj := FirstVertex.mapped_inl_isIso G + ((columnComplex k T (s).e₁).obj D₁) ((columnComplex k T (s).e₂).obj D₂) hv + let := hi + let := hj + dsimp [intoF1] + erw [Functor.map_comp] + exact (show IsIso (G.map (biprod.inl : + (columnComplex k T (s).e₁).obj D₁ ⟶ F1₀ (Exactness.data s D₀ D₁ D₂ f g)) ≫ + G.map (RectificationTotal.inclusion (p1 (Exactness.data s D₀ D₁ D₂ f g)) 0 + (h1 (Exactness.data s D₀ D₁ D₂ f g)))) from by + have : IsIso (G.map (biprod.inl : + (columnComplex k T (s).e₁).obj D₁ ⟶ F1₀ (Exactness.data s D₀ D₁ D₂ f g))) := hj + rw [isIso_comp_left_iff] + exact hi) + +variable (H : ∀ r, Homotopy (relationMap (ConcreteQuadraticDiagram.quadratic P) D₀ D₁ D₂ f g r) 0) + +theorem filtration_inclusion_quasiIso : + QuasiIso ((vertexComplex P).map (Exactness.i1 s D₀ D₁ D₂ f g H)) := by + let S := Complex.source0 s D₀ D₁ D₂ f g H + exact RectificationAcyclic.quasiIso_of_acyclic_quotient (S.map (vertexComplex P)) + (Complex.vertex_shortExact ((s).e₁) ((ThreeVertexAlgebra.directedSystem (QuadraticEncoding.composition P)).idem 1) S + (Complex.source0_shortExact s D₀ D₁ D₂ f g H)) + (GradedVertexAcyclic.grade0_vertex1_acyclic P D₀ D₁ D₂ f g) + +def iota : D₁ ⟶ (vertexComplex P).obj (Exactness.P s D₀ D₁ D₂ f g H) := + (VertexColumnComplex.diagonalComplexIso (QuadraticEncoding.composition P) 1 D₁).hom ≫ + (vertexComplex P).map (intoF1 P D₀ D₁ D₂ f g) ≫ + (vertexComplex P).map (Exactness.i1 s D₀ D₁ D₂ f g H) + +theorem iota_quasiIso : QuasiIso (iota P D₀ D₁ D₂ f g H) := by + let := intoF1_isIso P D₀ D₁ D₂ f g + let := filtration_inclusion_quasiIso P D₀ D₁ D₂ f g H + let e : D₁ ≅ (vertexComplex P).obj ((columnComplex k T (s).e₁).obj D₁) := + VertexColumnComplex.diagonalComplexIso (QuadraticEncoding.composition P) 1 D₁ + change QuasiIso (e.hom ≫ (vertexComplex P).map (intoF1 P D₀ D₁ D₂ f g) ≫ + (vertexComplex P).map (Exactness.i1 s D₀ D₁ D₂ f g H)) + infer_instance + +/-- The filtration route retains the original vertex-one summand insertion. -/ +theorem intoF1_nested : intoF1 P D₀ D₁ D₂ f g ≫ Exactness.i1 s D₀ D₁ D₂ f g H = + (Exactness.data s D₀ D₁ D₂ f g).in₁ ≫ + InducedRectification.inclusion s D₀ D₁ D₂ f g H := by + exact (Category.assoc _ _ _).trans (congrArg + (fun h => (biprod.inl : (columnComplex k T (s).e₁).obj D₁ ⟶ + F1₀ (Exactness.data s D₀ D₁ D₂ f g)) ≫ h) + ((include1 (inducedData s D₀ D₁ D₂ f g) (nullHomotopy s D₀ D₁ D₂ f g H)).inclusion_totalMap)) + +theorem iota_original : iota P D₀ D₁ D₂ f g H = + (VertexColumnComplex.diagonalComplexIso (QuadraticEncoding.composition P) 1 D₁).hom ≫ + (vertexComplex P).map ((Exactness.data s D₀ D₁ D₂ f g).in₁) ≫ + (vertexComplex P).map (InducedRectification.inclusion s D₀ D₁ D₂ f g H) := by + dsimp only [iota] + erw [← (vertexComplex P).map_comp (intoF1 P D₀ D₁ D₂ f g) + (Exactness.i1 s D₀ D₁ D₂ f g H), intoF1_nested, Functor.map_comp] + rfl +end LittleFinitistic.SecondVertex + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/SourceFiltration.lean b/lean/OAI/Algebra/Finitistic/Rectification/SourceFiltration.lean new file mode 100644 index 0000000000000000000000000000000000000000..fa466275938c6051f1d5e8fb703ab601f3ad9a53 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/SourceFiltration.lean @@ -0,0 +1,171 @@ +import OAI.Algebra.Finitistic.Rectification.InducedDiagram +import OAI.Algebra.Finitistic.Rectification.TotalFunctorial + +namespace OAI +open CategoryTheory CategoryTheory.Limits HomologicalComplex CochainComplex +open LittleFinitistic.RectificationTotal +open scoped TensorProduct ModuleCat.Algebra +noncomputable section +namespace ExternalTensor.Section4.SourceFiltration +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +variable {A J R : Type} [Fintype A] [Fintype J] [Fintype R] +variable (t : AssemblyData (C := BiComplex k B) (A := A) (J := J) (R := R)) + +/-- Source at least one: the actual D1 and D2 vertex terms and D1 arrow terms. -/ +abbrev F1₀ := t.V₁ ⊞ t.V₂ +abbrev F1₁ := ⨁ t.V +def Z : BiComplex k B where + X _ := ModuleCat.of _ PUnit + d _ _ := 0 + shape _ _ _ := rfl + d_comp_d' _ _ _ _ _ := by simp + +def p1 : F1₁ t ⟶ F1₀ t := + biproduct.desc fun b => t.pb₁ b ≫ biprod.inl - t.pb₂ b ≫ biprod.inr + +def h1 : Homotopy ((0 : Z ⟶ F1₁ t) ≫ p1 t) 0 where + hom _ _ := 0 + zero _ _ _ := rfl + comm _ := by simp [dNext, prevD] + +/-- Source zero quotient: retain precisely the path-multiplication terms. -/ +def p0 : (⨁ t.U) ⟶ t.V₀ := biproduct.desc t.pa₀ + +def q0 : t.L₂ ⟶ (⨁ t.U) := + biproduct.desc fun r => ∑ a, ∑ b, t.qa r a b ≫ biproduct.ι t.U a + +theorem q0_p0 : q0 t ≫ p0 t = 0 := by + apply biproduct.hom_ext' + intro r + simpa [q0, p0, Preadditive.sum_comp] using t.first r + +def h0 : Homotopy (q0 t ≫ p0 t) 0 where + hom _ _ := 0 + zero _ _ _ := rfl + comm n := by rw [q0_p0]; simp [dNext, prevD] + +omit [Fintype R] in +@[reassoc] theorem in_p : (biprod.inr : F1₁ t ⟶ t.L₁) ≫ t.p = + p1 t ≫ (biprod.inr : F1₀ t ⟶ t.L₀) := by + apply biproduct.hom_ext' + intro b + simp [AssemblyData.p, p1, AssemblyData.in₁, AssemblyData.in₂, + Preadditive.sub_comp] + +omit [Fintype R] in +@[reassoc] theorem p_out : t.p ≫ (biprod.fst : t.L₀ ⟶ t.V₀) = + (biprod.fst : t.L₁ ⟶ ⨁ t.U) ≫ p0 t := by + apply biprod.hom_ext' <;> apply biproduct.hom_ext' <;> intro a <;> + simp [AssemblyData.p, p0, AssemblyData.in₀, AssemblyData.in₁, + AssemblyData.in₂, Preadditive.sub_comp] + +@[reassoc] theorem q_out : t.q ≫ (biprod.fst : t.L₁ ⟶ ⨁ t.U) = q0 t := by + apply biproduct.hom_ext' + intro r + simp [AssemblyData.q, q0, Preadditive.sum_comp, Preadditive.add_comp] + +variable (h : Homotopy (t.q ≫ t.p) 0) +/-- The original summand inclusion, as a triple preserving the specified homotopy. -/ +def include1 : MapData (p1 t) 0 (h1 t) t.p t.q h where + f₀ := biprod.inr + f₁ := biprod.inr + f₂ := 0 + commP := in_p t + commQ := by simp + commH i j := by simp [h1] + +/-- Projection onto the actual source-zero quotient. The condition only records +that the supplied homotopy increases source index; it is proved for Section4 inputs below. -/ +def quotient0 (hh : ∀ i j, h.hom i j ≫ (biprod.fst : t.L₀ ⟶ t.V₀).f j = 0) : + MapData t.p t.q h (p0 t) (q0 t) (h0 t) where + f₀ := biprod.fst + f₁ := biprod.fst + f₂ := 𝟙 _ + commP := (p_out t).symm + commQ := by simpa using (q_out t).symm + commH i j := by simpa [h0] using (hh i j).symm + +/-- The second filtration step and its source-one quotient. -/ +def p2 : Z (k := k) (B := B) ⟶ t.V₂ := 0 + +def h2 : Homotopy ((0 : Z ⟶ Z) ≫ p2 t) 0 where + hom _ _ := 0 + zero _ _ _ := rfl + comm _ := by simp [p2, dNext, prevD] + +def pGrade1 : F1₁ t ⟶ t.V₁ := biproduct.desc t.pb₁ + +def hGrade1 : Homotopy ((0 : Z ⟶ F1₁ t) ≫ pGrade1 t) 0 where + hom _ _ := 0 + zero _ _ _ := rfl + comm _ := by simp [dNext, prevD] + +def include2 : MapData (p2 t) 0 (h2 t) (p1 t) 0 (h1 t) where + f₀ := biprod.inr + f₁ := 0 + f₂ := 𝟙 _ + commP := by simp [p2] + commQ := by simp + commH i j := by simp [h1, h2] + +def quotient1 : MapData (p1 t) 0 (h1 t) (pGrade1 t) 0 (hGrade1 t) where + f₀ := biprod.fst + f₁ := 𝟙 _ + f₂ := 𝟙 _ + commP := by + rw [Category.id_comp] + apply biproduct.hom_ext' + intro b + simp [p1, pGrade1, Preadditive.sub_comp] + commQ := by simp + commH i j := by simp [h1, hGrade1] + +/-- Changing the endpoint proofs does not change a homotopy's components. -/ +theorem cast_hom {X Y : BiComplex k B} {a b a' b' : X ⟶ Y} + (ha : a = a') (hb : b = b') (e : Homotopy a b = Homotopy a' b') + (v : Homotopy a b) : (cast e v).hom = v.hom := by + subst a' + subst b' + rfl + +variable (s : Quadratic k B (A := A) (J := J) (R := R)) +variable (D₀ D₁ D₂ : RightComplex B) +variable (f : A → (D₀ ⟶ D₁)) (g : J → (D₁ ⟶ D₂)) +variable (H : ∀ r, Homotopy (relationMap s D₀ D₁ D₂ f g r) 0) + +theorem induced_h_out (i j : ℤ) : + (nullHomotopy s D₀ D₁ D₂ f g H).hom i j ≫ + (biprod.fst : L0Prime s D₀ D₁ D₂ f g ⟶ + (inducedData s D₀ D₁ D₂ f g).V₀).f j = 0 := by + classical + unfold nullHomotopy + simp only [eq_mpr_eq_cast, eq_mp_eq_cast] + rw [cast_hom (by simp [AssemblyData.composite]) (by simp)] + rw [cast_hom (ha := ?_) (hb := ?_)] + rotate_left + · simp + · simp + change ((-1 : k) • h s D₀ D₁ D₂ f g H i j) ≫ _ = 0 + rw [Linear.smul_comp] + suffices h s D₀ D₁ D₂ f g H i j ≫ + (biprod.fst : L0Prime s D₀ D₁ D₂ f g ⟶ + (inducedData s D₀ D₁ D₂ f g).V₀).f j = 0 by rw [this, smul_zero] + rw [h_formula, Preadditive.sum_comp] + apply Finset.sum_eq_zero + intro r _ + dsimp only [AssemblyData.in₂] + erw [Category.assoc, Category.assoc, ← comp_f, Category.assoc, biprod.inr_fst, + CategoryTheory.Limits.comp_zero] + +/-- Actual Section 4 source filtration inclusion; no decomposition is assumed. -/ +abbrev inducedInclude1 := include1 (inducedData s D₀ D₁ D₂ f g) + (nullHomotopy s D₀ D₁ D₂ f g H) +/-- Actual Section 4 source quotient; homotopy compatibility is proved above. -/ +abbrev inducedQuotient0 := quotient0 (inducedData s D₀ D₁ D₂ f g) + (nullHomotopy s D₀ D₁ D₂ f g H) (induced_h_out s D₀ D₁ D₂ f g H) +end ExternalTensor.Section4.SourceFiltration + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/SourceFiltrationComplex.lean b/lean/OAI/Algebra/Finitistic/Rectification/SourceFiltrationComplex.lean new file mode 100644 index 0000000000000000000000000000000000000000..ce086d7e61a2598a3ac932dcc97457af4d796f3a --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/SourceFiltrationComplex.lean @@ -0,0 +1,66 @@ +import OAI.Algebra.Finitistic.Rectification.FiltrationExactness +import OAI.Algebra.Finitistic.Bimodule.BimoduleVertex + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits HomologicalComplex +namespace LittleFinitistic.ModuleComplexExact +universe u +variable {S : Type u} [Ring S] +variable {X Y Z : CochainComplex (ModuleCat.{u} S) ℤ} (f : X ⟶ Y) (g : Y ⟶ Z) + +theorem comp_zero (h : ∀ n, Function.Exact (f.f n) (g.f n)) : f ≫ g = 0 := by + ext n x + exact (h n).apply_apply_eq_zero x + +def sequence (h : ∀ n, Function.Exact (f.f n) (g.f n)) : + ShortComplex (CochainComplex (ModuleCat.{u} S) ℤ) := .mk f g (comp_zero f g h) + +theorem shortExact (h : ∀ n, Function.Injective (f.f n) ∧ + Function.Exact (f.f n) (g.f n) ∧ Function.Surjective (g.f n)) : + (sequence f g (fun n => (h n).2.1)).ShortExact := by + apply HomologicalComplex.shortExact_of_degreewise_shortExact + intro n + exact ModuleCat.shortComplex_shortExact _ (h n).2.1 (h n).1 (h n).2.2 +end LittleFinitistic.ModuleComplexExact + +namespace ExternalTensor.Section4.SourceFiltration.Complex +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +variable {A J R : Type} [Fintype A] [Fintype J] [Fintype R] +variable (s : Quadratic k B (A := A) (J := J) (R := R)) +variable (D₀ D₁ D₂ : RightComplex B) +variable (f : A → (D₀ ⟶ D₁)) (g : J → (D₁ ⟶ D₂)) +variable (H : ∀ r, Homotopy (relationMap s D₀ D₁ D₂ f g r) 0) +open Exactness LittleFinitistic + +def source0 := ModuleComplexExact.sequence (i1 s D₀ D₁ D₂ f g H) + (pi0 s D₀ D₁ D₂ f g H) + (fun n => (exact_source_filtration s D₀ D₁ D₂ f g H n).1.2.1) + +def source1 := ModuleComplexExact.sequence (i2 s D₀ D₁ D₂ f g) + (pi1 s D₀ D₁ D₂ f g) + (fun n => (v2_shortExact (data s D₀ D₁ D₂ f g) n).2.1) + +theorem source0_shortExact : (source0 s D₀ D₁ D₂ f g H).ShortExact := + ModuleComplexExact.shortExact _ _ + (fun n => (exact_source_filtration s D₀ D₁ D₂ f g H n).1) + +omit [Fintype R] in +theorem source1_shortExact : (source1 s D₀ D₁ D₂ f g).ShortExact := + ModuleComplexExact.shortExact _ _ (v2_shortExact (data s D₀ D₁ D₂ f g)) + +/-- Every original source filtration remains short exact after taking a left vertex. -/ +theorem vertex_shortExact (e : B) (he : e*e=e) + (S : ShortComplex (BiComplex k B)) (hS : S.ShortExact) : + (S.map ((BimoduleVertex.functor k B e).mapHomologicalComplex (.up ℤ))).ShortExact := by + apply HomologicalComplex.shortExact_of_degreewise_shortExact + intro n + exact BimoduleVertex.map_shortExact k B e he + (S.map (HomologicalComplex.eval _ _ n)) + ((HomologicalComplex.shortExact_iff_degreewise_shortExact S).1 hS n) +end ExternalTensor.Section4.SourceFiltration.Complex + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/SourceFiltrationCone.lean b/lean/OAI/Algebra/Finitistic/Rectification/SourceFiltrationCone.lean new file mode 100644 index 0000000000000000000000000000000000000000..690f8b1dd1ae8093e6cb08b5aa9c903f803ec7f9 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/SourceFiltrationCone.lean @@ -0,0 +1,81 @@ +import OAI.Algebra.Finitistic.Rectification.SourceFiltrationReal + +namespace OAI +open CategoryTheory CategoryTheory.Limits HomologicalComplex CochainComplex +open LittleFinitistic.RectificationTotal +noncomputable section +namespace ExternalTensor.Section4.SourceFiltration +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] + +/-- An isomorphism of the two input columns gives an isomorphism of actual cones. -/ +def coneIso {X Y X' Y' : BiComplex k B} (p : X ⟶ Y) (p' : X' ⟶ Y') + (a : X ≅ X') (b : Y ≅ Y') (w : a.hom ≫ p' = p ≫ b.hom) : + mappingCone p ≅ mappingCone p' where + hom := coneMap p p' a.hom b.hom w + inv := coneMap p' p a.inv b.inv (by + apply (cancel_epi a.hom).1 + simp only [← Category.assoc, Iso.hom_inv_id, Category.id_comp] + rw [w, Category.assoc, Iso.hom_inv_id, Category.comp_id]) + hom_inv_id := by rw [← coneMap_comp]; simp + inv_hom_id := by rw [← coneMap_comp]; simp + +variable (X : BiComplex k B) + +theorem zeroCone_inclusion_product (n : ℤ) : + (mappingCone.inr (0 : Z ⟶ X)).f n ≫ + ((homotopyCofiber.XIsoBiprod (0 : Z ⟶ X) n (n+1) rfl) ≪≫ + ModuleCat.biprodIsoProd _ _).hom = + ModuleCat.ofHom (LinearMap.inr (Enveloping k B) (Z.X (n+1)) (X.X n)) := by + erw [Iso.trans_hom, ← Category.assoc, cone_inr_termIso] + exact inr_prod _ _ + +theorem zeroCone_inclusion_bijective (n : ℤ) : + Function.Bijective ((mappingCone.inr (0 : Z ⟶ X)).f n) := by + let e := ((homotopyCofiber.XIsoBiprod (0 : Z ⟶ X) n (n+1) rfl) ≪≫ + ModuleCat.biprodIsoProd _ _).toLinearEquiv + have he (x : X.X n) : e ((mappingCone.inr (0 : Z ⟶ X)).f n x) = (0,x) := + congrArg (fun a => a x) (zeroCone_inclusion_product X n) + refine ⟨?_, ?_⟩ + · intro x y hxy + have := congrArg e hxy + simpa only [he] using congrArg Prod.snd this + · intro y + refine ⟨(e y).2, e.injective ?_⟩ + rw [he] + exact Prod.ext (Subsingleton.elim _ _) rfl + +instance zeroCone_inclusion_isIso : IsIso (mappingCone.inr (0 : Z ⟶ X)) := by + have (n : ℤ) : IsIso ((mappingCone.inr (0 : Z ⟶ X)).f n) := + (ConcreteCategory.isIso_iff_bijective _).2 (zeroCone_inclusion_bijective X n) + exact HomologicalComplex.Hom.isIso_of_components _ + +/-- The ordinary two-column total identifies with the three-column API having +zero relation column; its zero-column inclusion is unchanged. -/ +def twoColumnIso {Y : BiComplex k B} (p : X ⟶ Y) + (h : Homotopy ((0 : Z ⟶ X) ≫ p) 0) : mappingCone p ≅ total p 0 h := + coneIso p (rectifyingMap p 0 h) (asIso (mappingCone.inr (0 : Z ⟶ X))) + (Iso.refl _) (by simp [rectifyingMap]) + +theorem twoColumnIso_inclusion {Y : BiComplex k B} (p : X ⟶ Y) + (h : Homotopy ((0 : Z ⟶ X) ≫ p) 0) : + mappingCone.inr p ≫ (twoColumnIso X p h).hom = inclusion p 0 h := by + apply HomologicalComplex.hom_ext + intro n + change (mappingCone.inr p).f n ≫ + (coneMap p (rectifyingMap p 0 h) (mappingCone.inr (0 : Z ⟶ X)) (𝟙 Y) _).f n = + (mappingCone.inr (rectifyingMap p 0 h)).f n + erw [coneMap_inr, id_f, Category.id_comp] + +variable {A J R : Type} [Fintype A] [Fintype J] [Fintype R] +variable (t : AssemblyData (C := BiComplex k B) (A := A) (J := J) (R := R)) + +def f1ConeIso : mappingCone (p1 t) ≅ total (p1 t) 0 (h1 t) := + twoColumnIso _ _ _ +def grade1ConeIso : mappingCone (pGrade1 t) ≅ total (pGrade1 t) 0 (hGrade1 t) := + twoColumnIso _ _ _ +end ExternalTensor.Section4.SourceFiltration + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/SourceFiltrationExact.lean b/lean/OAI/Algebra/Finitistic/Rectification/SourceFiltrationExact.lean new file mode 100644 index 0000000000000000000000000000000000000000..6326b6734a6d144d30cfde56f3ccd914b1d040db --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/SourceFiltrationExact.lean @@ -0,0 +1,111 @@ +import OAI.Algebra.Finitistic.Rectification.SourceFiltration +import OAI.Algebra.Finitistic.Localization.SplitComponentExact + +namespace OAI +open CategoryTheory CategoryTheory.Limits HomologicalComplex CochainComplex +open LittleFinitistic.RectificationTotal +noncomputable section +namespace ExternalTensor.Section4.SourceFiltration +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +variable {A J R : Type} [Fintype A] [Fintype J] [Fintype R] +instance zeroTermSubsingleton (n : ℤ) : Subsingleton ((Z (k := k) (B := B)).X n) := by + change Subsingleton PUnit + infer_instance + +variable (t : AssemblyData (C := BiComplex k B) (A := A) (J := J) (R := R)) +variable (h : Homotopy (t.q ≫ t.p) 0) +variable (hh : ∀ i j, h.hom i j ≫ (biprod.fst : t.L₀ ⟶ t.V₀).f j = 0) + +theorem source0_component0 (n : ℤ) : + Function.Injective ((include1 t h).f₀.f n) ∧ + Function.Exact ((include1 t h).f₀.f n) ((quotient0 t h hh).f₀.f n) ∧ + Function.Surjective ((quotient0 t h hh).f₀.f n) := + inr_fst_shortExact t.V₀ (t.V₁ ⊞ t.V₂) n + +theorem source0_component1 (n : ℤ) : + Function.Injective ((include1 t h).f₁.f n) ∧ + Function.Exact ((include1 t h).f₁.f n) ((quotient0 t h hh).f₁.f n) ∧ + Function.Surjective ((quotient0 t h hh).f₁.f n) := + inr_fst_shortExact (⨁ t.U) (⨁ t.V) n + +theorem source0_component2 (n : ℤ) : + Function.Injective ((include1 t h).f₂.f n) ∧ + Function.Exact ((include1 t h).f₂.f n) ((quotient0 t h hh).f₂.f n) ∧ + Function.Surjective ((quotient0 t h hh).f₂.f n) := + zero_id_shortExact t.L₂ Z (fun _ => inferInstance) n + +/-- The actual F>=1 inclusion and source-zero quotient are termwise short exact. -/ +theorem source0_shortExact (n : ℤ) : + Function.Injective ((include1 t h).totalMap.f n) ∧ + Function.Exact ((include1 t h).totalMap.f n) ((quotient0 t h hh).totalMap.f n) ∧ + Function.Surjective ((quotient0 t h hh).totalMap.f n) := by + exact (include1 t h).totalMap_shortExact (quotient0 t h hh) + (fun n => (source0_component0 t h hh n).2.1) + (fun n => (source0_component1 t h hh n).2.1) + (fun n => (source0_component2 t h hh n).2.1) + (fun n => (source0_component0 t h hh n).1) + (fun n => (source0_component1 t h hh n).1) + (fun n => (source0_component2 t h hh n).1) + (fun n => (source0_component0 t h hh n).2.2) + (fun n => (source0_component1 t h hh n).2.2) + (fun n => (source0_component2 t h hh n).2.2) n + +omit [Fintype R] in +theorem source1_component0 (n : ℤ) : + Function.Injective ((include2 t).f₀.f n) ∧ + Function.Exact ((include2 t).f₀.f n) ((quotient1 t).f₀.f n) ∧ + Function.Surjective ((quotient1 t).f₀.f n) := + inr_fst_shortExact t.V₁ t.V₂ n + +omit [Fintype R] in +theorem source1_component1 (n : ℤ) : + Function.Injective ((include2 t).f₁.f n) ∧ + Function.Exact ((include2 t).f₁.f n) ((quotient1 t).f₁.f n) ∧ + Function.Surjective ((quotient1 t).f₁.f n) := + zero_id_shortExact (⨁ t.V) Z (fun _ => inferInstance) n + +omit [Fintype R] in +theorem source1_component2 (n : ℤ) : + Function.Injective ((include2 t).f₂.f n) ∧ + Function.Exact ((include2 t).f₂.f n) ((quotient1 t).f₂.f n) ∧ + Function.Surjective ((quotient1 t).f₂.f n) := by + refine ⟨fun _ _ _ => Subsingleton.elim _ _, ?_, fun x => ⟨x, rfl⟩⟩ + intro x + exact ⟨fun _ => ⟨x, rfl⟩, fun _ => Subsingleton.elim _ _⟩ + +omit [Fintype R] in +/-- The actual F>=2 inclusion and source-one quotient are termwise short exact. -/ +theorem source1_shortExact (n : ℤ) : + Function.Injective ((include2 t).totalMap.f n) ∧ + Function.Exact ((include2 t).totalMap.f n) ((quotient1 t).totalMap.f n) ∧ + Function.Surjective ((quotient1 t).totalMap.f n) := by + exact (include2 t).totalMap_shortExact (quotient1 t) + (fun n => (source1_component0 t n).2.1) + (fun n => (source1_component1 t n).2.1) + (fun n => (source1_component2 t n).2.1) + (fun n => (source1_component0 t n).1) + (fun n => (source1_component1 t n).1) + (fun n => (source1_component2 t n).1) + (fun n => (source1_component0 t n).2.2) + (fun n => (source1_component1 t n).2.2) + (fun n => (source1_component2 t n).2.2) n + +variable (s : Quadratic k B (A := A) (J := J) (R := R)) +variable (D₀ D₁ D₂ : RightComplex B) +variable (f : A → (D₀ ⟶ D₁)) (g : J → (D₁ ⟶ D₂)) +variable (H : ∀ r, Homotopy (relationMap s D₀ D₁ D₂ f g r) 0) + +/-- No short-exactness or filtration assumption: all component properties are +proved from the actual induced Section 4 sources. -/ +theorem induced_source0_shortExact (n : ℤ) : + Function.Injective ((inducedInclude1 s D₀ D₁ D₂ f g H).totalMap.f n) ∧ + Function.Exact ((inducedInclude1 s D₀ D₁ D₂ f g H).totalMap.f n) + ((inducedQuotient0 s D₀ D₁ D₂ f g H).totalMap.f n) ∧ + Function.Surjective ((inducedQuotient0 s D₀ D₁ D₂ f g H).totalMap.f n) := + source0_shortExact _ _ _ n +end ExternalTensor.Section4.SourceFiltration + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/SourceFiltrationReal.lean b/lean/OAI/Algebra/Finitistic/Rectification/SourceFiltrationReal.lean new file mode 100644 index 0000000000000000000000000000000000000000..04e72b5d65d4fb7cb5cf0f9442b142d4f280f534 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/SourceFiltrationReal.lean @@ -0,0 +1,100 @@ +import OAI.Algebra.Finitistic.Rectification.SourceFiltrationExact + +namespace OAI +open CategoryTheory CategoryTheory.Limits HomologicalComplex CochainComplex +open LittleFinitistic.RectificationTotal +noncomputable section +namespace ExternalTensor.Section4.SourceFiltration +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +variable {A J R : Type} [Fintype A] [Fintype J] [Fintype R] +variable (t : AssemblyData (C := BiComplex k B) (A := A) (J := J) (R := R)) + +@[reassoc (attr := simp)] +theorem inr_prod {S : Type u} [Ring S] (X Y : ModuleCat.{u} S) : + (biprod.inr : Y ⟶ X ⊞ Y) ≫ (ModuleCat.biprodIsoProd X Y).hom = + ModuleCat.ofHom (LinearMap.inr S X Y) := by + apply (cancel_mono (ModuleCat.biprodIsoProd X Y).inv).1 + simp only [Category.assoc, Iso.hom_inv_id, Category.comp_id] + apply biprod.hom_ext + · simp only [Category.assoc, ModuleCat.biprodIsoProd_inv_comp_fst, biprod.inr_fst] + rfl + · simp only [Category.assoc, ModuleCat.biprodIsoProd_inv_comp_snd, biprod.inr_snd] + rfl + +omit [Fintype R] in +/-- The canonical zero-column inclusion has exactly its original term coordinate. -/ +theorem inclusion_product (n : ℤ) : + (inclusion (p2 t) 0 (h2 t)).f n ≫ (totalTermIso (p2 t) 0 (h2 t) n).hom = + ModuleCat.ofHom (LinearMap.inr (Enveloping k B) + (Z.X (n+2) × Z.X (n+1)) (t.V₂.X n)) := by + dsimp only [totalTermIso, termIso, LittleFinitistic.RectificationTotal.inclusion] + erw [Iso.trans_hom, Iso.trans_hom, Iso.trans_hom, + biprod.mapIso_hom, Iso.refl_hom, biprod.mapIso_hom, Iso.refl_hom] + erw [← Category.assoc, ← Category.assoc, ← Category.assoc, + cone_inr_termIso, biprod.inr_map, Category.id_comp, biprod.inr_map, Category.id_comp] + exact inr_prod _ _ + +omit [Fintype R] in +/-- Removing the two zero columns preserves the actual V2 inclusion. -/ +theorem inclusion2_bijective (n : ℤ) : + Function.Bijective ((inclusion (p2 t) 0 (h2 t)).f n) := by + let e := (totalTermIso (p2 t) 0 (h2 t) n).toLinearEquiv + have he (x : t.V₂.X n) : e ((inclusion (p2 t) 0 (h2 t)).f n x) = ((0,0),x) := + congrArg (fun a => a x) (inclusion_product t n) + refine ⟨?_, ?_⟩ + · intro x y hxy + have := congrArg e hxy + simpa only [he] using congrArg Prod.snd this + · intro y + refine ⟨(e y).2, e.injective ?_⟩ + rw [he] + exact Prod.ext (Subsingleton.elim _ _) rfl + +instance inclusion2_isIso : IsIso (inclusion (p2 t) 0 (h2 t)) := by + have (n : ℤ) : IsIso ((inclusion (p2 t) 0 (h2 t)).f n) := + (ConcreteCategory.isIso_iff_bijective _).2 (inclusion2_bijective t n) + exact HomologicalComplex.Hom.isIso_of_components _ + +def v2Iso : t.V₂ ≅ total (p2 t) 0 (h2 t) := asIso (inclusion (p2 t) 0 (h2 t)) + +/-- F>=2 really is V2, embedded by its original vertex summand inclusion. -/ +def v2Inclusion : t.V₂ ⟶ total (p1 t) 0 (h1 t) := + biprod.inr ≫ inclusion (p1 t) 0 (h1 t) + +omit [Fintype R] in +theorem v2Inclusion_eq : v2Inclusion t = (v2Iso t).hom ≫ (include2 t).totalMap := by + symm + exact (include2 t).inclusion_totalMap + +omit [Fintype R] in +/-- The source-one sequence with V2 itself as its first term. -/ +theorem v2_shortExact (n : ℤ) : + Function.Injective ((v2Inclusion t).f n) ∧ + Function.Exact ((v2Inclusion t).f n) ((quotient1 t).totalMap.f n) ∧ + Function.Surjective ((quotient1 t).totalMap.f n) := by + have E := source1_shortExact t n + have I := inclusion2_bijective t n + rw [v2Inclusion_eq] + refine ⟨E.1.comp I.1, ?_, E.2.2⟩ + intro y + constructor + · intro hy + obtain ⟨x, hx⟩ := (E.2.1 y).mp hy + obtain ⟨z, rfl⟩ := I.2 x + exact ⟨z, hx⟩ + · rintro ⟨x, rfl⟩ + exact E.2.1.apply_apply_eq_zero _ + +variable (h : Homotopy (t.q ≫ t.p) 0) +/-- The composite filtration inclusion is the original V2-to-total map. -/ +theorem v2_nested : v2Inclusion t ≫ (include1 t h).totalMap = + t.in₂ ≫ inclusion t.p t.q h := by + dsimp only [v2Inclusion] + rw [Category.assoc, (include1 t h).inclusion_totalMap] + rfl +end ExternalTensor.Section4.SourceFiltration + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/TensorArrowComparison.lean b/lean/OAI/Algebra/Finitistic/Rectification/TensorArrowComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..dd1b81fc938535335aad3482dc1c26c7c641b605 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/TensorArrowComparison.lean @@ -0,0 +1,74 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleTensorVertexBridge +import OAI.Algebra.Finitistic.Localization.NativeArrowBridge + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.TensorArrowComparison +open ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] +variable (N : Type u) [AddCommGroup N] [Module k N] [Module B N] + +/-- Tensor the actual right vertex, then identify it with the vertex of the full +left B-module tensor, preserving the original balanced tensor classes. -/ +def component (e : B) (he : e*e=e) (M : ModuleCat.{u} (Enveloping k B)) : + (BalancedTensor.tensorFunctor k B N).obj ((BimoduleVertex.functor k B e).obj M) ≅ + (LeftVertexHomology.vertex k B e).obj ((BimoduleBalancedTensor.functor k B N).obj M) := + (BalancedVertexImage.equiv k B M e he N).toModuleIso ≪≫ + (BimoduleTensorVertexBridge.equiv k B N e M).symm.toModuleIso + +/-- The tensor/vertex comparison retains left multiplication by every original +supported arrow, and does not require the evaluation module to be flat. -/ +theorem arrow_square (ei ej a : B) (hi : ei*ei=ei) (hj : ej*ej=ej) (ha : ej*a=a) + (M : ModuleCat.{u} (Enveloping k B)) : + (BalancedTensor.tensorFunctor k B N).map + ((ArrowVertex.arrow k B ei ej a ha).app M) ≫ (component k B N ej hj M).hom = + (component k B N ei hi M).hom ≫ + (LeftVertexHomology.arrow k B ei ej a ha).app ((BimoduleBalancedTensor.functor k B N).obj M) := by + let l := ((BalancedTensor.tensorFunctor k B N).map + ((ArrowVertex.arrow k B ei ej a ha).app M) ≫ (component k B N ej hj M).hom).hom + let r := ((component k B N ei hi M).hom ≫ + (LeftVertexHomology.arrow k B ei ej a ha).app + ((BimoduleBalancedTensor.functor k B N).obj M)).hom + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + change l x = r x + induction x using BalancedTensor.induction_on with + | hz => exact l.map_zero.trans r.map_zero.symm + | ht m n => rfl + | ha x y hx hy => + exact (l.map_add x y).trans ((congrArg₂ (· + ·) hx hy).trans (r.map_add x y).symm) + +/-- Natural comparison for the full B-valued tensor functor. -/ +def comparison (e : B) (he : e*e=e) : + BimoduleVertex.functor k B e ⋙ BalancedTensor.tensorFunctor k B N ≅ + BimoduleBalancedTensor.functor k B N ⋙ LeftVertexHomology.vertex k B e := + BalancedVertexFunctor.comparison k B e he N ≪≫ + (BimoduleTensorVertexBridge.comparison k B N e).symm + +def complexIso (e : B) (he : e*e=e) (P : BiComplex k B) : + (((BalancedTensor.tensorFunctor k B N).mapHomologicalComplex (.up ℤ)).obj + (((BimoduleVertex.functor k B e).mapHomologicalComplex (.up ℤ)).obj P)) ≅ + (((LeftVertexHomology.vertex k B e).mapHomologicalComplex (.up ℤ)).obj + (((BimoduleBalancedTensor.functor k B N).mapHomologicalComplex (.up ℤ)).obj P)) := + HomologicalComplex.Hom.isoOfComponents (fun n => component k B N e he (P.X n)) + (fun n m _ => ((comparison k B N e he).hom.naturality (P.d n m)).symm) + +/-- The full chain comparison respects the original left multiplication arrows. -/ +theorem complex_arrow_square (ei ej a : B) (hi : ei*ei=ei) (hj : ej*ej=ej) (ha : ej*a=a) + (P : BiComplex k B) : + ((BalancedTensor.tensorFunctor k B N).mapHomologicalComplex (.up ℤ)).map + (ArrowVertex.arrowComplex k B ei ej a ha P) ≫ (complexIso k B N ej hj P).hom = + (complexIso k B N ei hi P).hom ≫ + ((LeftVertexHomology.arrow k B ei ej a ha).mapHomologicalComplex (.up ℤ)).app + (((BimoduleBalancedTensor.functor k B N).mapHomologicalComplex (.up ℤ)).obj P) := by + apply HomologicalComplex.Hom.ext + funext n + exact arrow_square k B N ei ej a hi hj ha (P.X n) +end LittleFinitistic.TensorArrowComparison + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/TensorArrowSum.lean b/lean/OAI/Algebra/Finitistic/Rectification/TensorArrowSum.lean new file mode 100644 index 0000000000000000000000000000000000000000..0344b1943db17e98c3402d0de90074e54fd3a1d1 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/TensorArrowSum.lean @@ -0,0 +1,51 @@ +import OAI.Algebra.Finitistic.Encoding.ArrowBasisIso + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.TensorArrowSum +universe u +variable (k : Type u) [Field k] (d : ℕ) + +def insertion (a : Fin (d+1)) : ModuleCat.of k k ⟶ ModuleCat.of k (QuadraticEncoding.Arrows k d) := + biproduct.ι (ArrowBasisIso.family k d) a ≫ (ArrowBasisIso.iso k d).hom + +@[simp] theorem insertion_apply (a : Fin (d+1)) (c : k) : + (insertion k d a).hom c = c • QuadraticEncoding.basis a := + ArrowBasisIso.injection_apply k d a c + +/-- An additive realization of the actual arrow-basis sum is an isomorphism. -/ +theorem desc_isIso {C : Type*} [Category C] [Preadditive C] [HasFiniteBiproducts C] + (F : ModuleCat.{u} k ⥤ C) [F.Additive] : + IsIso (biproduct.desc (fun a : Fin (d+1) => F.map (insertion k d a))) := by + have he : biproduct.desc (fun a : Fin (d+1) => F.map (insertion k d a)) = + (F.mapBiproduct (ArrowBasisIso.family k d)).inv ≫ F.map (ArrowBasisIso.iso k d).hom := by + apply biproduct.hom_ext' + intro a + simp only [insertion, Functor.map_comp, Functor.mapBiproduct_inv] + erw [biproduct.ι_desc, biproduct.ι_desc_assoc] + rw [he] + infer_instance + +/-- Coordinate isomorphisms identify an actual arrow family with the realized basis. -/ +theorem desc_isIso_of_coordinates {C : Type*} [Category C] [Preadditive C] + [HasFiniteBiproducts C] (F : ModuleCat.{u} k ⥤ C) [F.Additive] + (X : Fin (d+1) → C) (Y : C) (α : ∀ a, X a ≅ F.obj (ModuleCat.of k k)) + (β : Y ≅ F.obj (ModuleCat.of k (QuadraticEncoding.Arrows k d))) + (f : ∀ a, X a ⟶ Y) + (hf : ∀ a, (α a).hom ≫ F.map (insertion k d a) = f a ≫ β.hom) : + IsIso (biproduct.desc f) := by + have he : biproduct.desc f ≫ β.hom = + (biproduct.mapIso α).hom ≫ biproduct.desc (fun a => F.map (insertion k d a)) := by + apply biproduct.hom_ext' + intro a + simp only [biproduct.mapIso_hom,biproduct.ι_desc_assoc,biproduct.ι_map_assoc,biproduct.ι_desc] + exact (hf a).symm + let := desc_isIso k d F + rw [← isIso_comp_right_iff _ β.hom,he] + infer_instance +end LittleFinitistic.TensorArrowSum + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/TensorComplex.lean b/lean/OAI/Algebra/Finitistic/Rectification/TensorComplex.lean new file mode 100644 index 0000000000000000000000000000000000000000..f562fb7325662d4705a7ec7a624bc90d8c9d3259 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/TensorComplex.lean @@ -0,0 +1,143 @@ +import Mathlib.Algebra.Category.ModuleCat.ChangeOfRings +import OAI.Algebra.Finitistic.Rectification.TensorProjection +import OAI.Algebra.Finitistic.Encoding.RelationSequence + +namespace OAI +noncomputable section +open scoped TensorProduct +open CategoryTheory +namespace LittleFinitistic.TensorComplex +attribute [local instance] ExternalTensor.rightModule +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] + +abbrev ScalarModule (N : ModuleCat.{u} Bᵐᵒᵖ) := + (ModuleCat.restrictScalars (algebraMap k Bᵐᵒᵖ)).obj N + +instance scalarTower (N : ModuleCat.{u} Bᵐᵒᵖ) : + IsScalarTower k Bᵐᵒᵖ (ScalarModule k B N) where + smul_assoc c b n := by + change (c • b) • (n : N) = algebraMap k Bᵐᵒᵖ c • (b • (n : N)) + rw [Algebra.smul_def,mul_smul] + +variable {k B} +/-- The actual tensor differential, with the original right B-action. -/ +def mapRight (M : ModuleCat.{u} k) {N N' : ModuleCat.{u} Bᵐᵒᵖ} (g : N ⟶ N') : + (M ⊗[k] ScalarModule k B N) →ₗ[Bᵐᵒᵖ] (M ⊗[k] ScalarModule k B N') where + __ := (TensorProduct.map LinearMap.id + ((ModuleCat.restrictScalars (algebraMap k Bᵐᵒᵖ)).map g).hom).toAddMonoidHom + map_smul' c x := by + induction x using TensorProduct.inductionOn with + | tmul m n => + change TensorProduct.mk k M (ScalarModule k B N') m (g.hom (c • (n : N))) = TensorProduct.mk k M (ScalarModule k B N') m (c • g.hom n) + exact congrArg (TensorProduct.mk k M (ScalarModule k B N') m) (g.hom.map_smul c (n : N)) + | add x y hx hy => simp_all [smul_add] + +@[simp] theorem mapRight_tmul (M : ModuleCat.{u} k) {N N' : ModuleCat.{u} Bᵐᵒᵖ} + (g : N ⟶ N') (m : M) (n : ScalarModule k B N) : + mapRight M g (m ⊗ₜ[k] n) = TensorProduct.mk k M (ScalarModule k B N') m (g.hom n) := rfl + +variable (D : CochainComplex (ModuleCat.{u} Bᵐᵒᵖ) ℤ) +/-- Tensor a vector space with every term and differential of the given right-module complex. -/ +def complex (M : ModuleCat.{u} k) : CochainComplex (ModuleCat.{u} Bᵐᵒᵖ) ℤ where + X i := ModuleCat.of Bᵐᵒᵖ (M ⊗[k] ScalarModule k B (D.X i)) + d i j := ModuleCat.ofHom (mapRight M (D.d i j)) + shape i j hij := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + induction x using TensorProduct.inductionOn with + | tmul m n => + have h : (D.d i j).hom (n : D.X i) = 0 := by rw [D.shape i j hij]; rfl + exact (congrArg (TensorProduct.mk k M (ScalarModule k B (D.X j)) m) h).trans + (map_zero (TensorProduct.mk k M (ScalarModule k B (D.X j)) m)) + | add x y hx hy => + exact (map_add _ _ _).trans ((congrArg₂ (· + ·) hx hy).trans (map_add _ _ _).symm) + d_comp_d' i j l hij hjl := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + induction x using TensorProduct.inductionOn with + | tmul m n => + change TensorProduct.mk k M (ScalarModule k B (D.X l)) m ((D.d j l).hom ((D.d i j).hom n)) = 0 + have h := congrArg (fun f : D.X i ⟶ D.X l => f.hom n) (D.d_comp_d i j l) + change (D.d j l).hom ((D.d i j).hom n) = 0 at h + exact (congrArg (TensorProduct.mk k M (ScalarModule k B (D.X l)) m) h).trans + (map_zero (TensorProduct.mk k M (ScalarModule k B (D.X l)) m)) + | add x y hx hy => + exact (map_add _ _ _).trans ((congrArg₂ (· + ·) hx hy).trans (map_add _ _ _).symm) + +/-- The first-factor tensor map is a chain map. -/ +def complexMap {M M' : ModuleCat.{u} k} (f : M ⟶ M') : complex D M ⟶ complex D M' where + f i := ModuleCat.ofHom (TensorProjection.rightMap (B := B) + (N := ScalarModule k B (D.X i)) f.hom) + comm' i j hij := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + induction x using TensorProduct.inductionOn with + | tmul m n => rfl + | add x y hx hy => + exact (map_add _ _ _).trans ((congrArg₂ (· + ·) hx hy).trans (map_add _ _ _).symm) + +/-- The genuine additive tensor-with-D functor required by the path exact sequence. -/ +def tensorFunctor : ModuleCat.{u} k ⥤ CochainComplex (ModuleCat.{u} Bᵐᵒᵖ) ℤ where + obj := complex D + map := complexMap D + map_id M := by + apply HomologicalComplex.Hom.ext + funext i + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + induction x using TensorProduct.inductionOn with + | tmul m n => rfl + | add x y hx hy => + exact (map_add _ _ _).trans ((congrArg₂ (· + ·) hx hy).trans (map_add _ _ _).symm) + map_comp f g := by + apply HomologicalComplex.Hom.ext + funext i + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + induction x using TensorProduct.inductionOn with + | tmul m n => rfl + | add x y hx hy => + exact (map_add _ _ _).trans ((congrArg₂ (· + ·) hx hy).trans (map_add _ _ _).symm) + +instance tensorFunctor_additive : (tensorFunctor (k := k) D).Additive where + map_add {M M'} {f g} := by + apply HomologicalComplex.Hom.ext + funext i + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + induction x using TensorProduct.inductionOn with + | tmul m n => exact TensorProduct.add_tmul _ _ _ + | add x y hx hy => + change TensorProjection.rightMap (B := B) (f.hom + g.hom) (x+y) = + TensorProjection.rightMap (B := B) f.hom (x+y) + TensorProjection.rightMap (B := B) g.hom (x+y) + simp only [map_add] + change TensorProjection.rightMap (B := B) (f.hom + g.hom) x = + TensorProjection.rightMap (B := B) f.hom x + TensorProjection.rightMap (B := B) g.hom x at hx + change TensorProjection.rightMap (B := B) (f.hom + g.hom) y = + TensorProjection.rightMap (B := B) f.hom y + TensorProjection.rightMap (B := B) g.hom y at hy + rw [hx,hy] + abel + +/-- The adjacent-vertex graded piece is the cone of the path-space identity. -/ +theorem adjacent_total_acyclic (M : ModuleCat.{u} k) : + (CochainComplex.mappingCone (𝟙 (complex D M))).Acyclic := + RectificationAcyclic.cone_acyclic _ + +/-- The source-0 path-relation graded piece is acyclic for the actual tensor functor. -/ +theorem relation_total_acyclic {d t : ℕ} (P : QuadraticEncoding.Relations k d t) : + (RectificationTotal.total ((RelationSequence.sequence P).map (tensorFunctor (k := k) D)).g + ((RelationSequence.sequence P).map (tensorFunctor (k := k) D)).f + (Homotopy.ofEq ((RelationSequence.sequence P).map (tensorFunctor (k := k) D)).zero)).Acyclic := + RelationSequence.realized_sequence_total_acyclic P (tensorFunctor (k := k) D) +end LittleFinitistic.TensorComplex + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/TensorProjection.lean b/lean/OAI/Algebra/Finitistic/Rectification/TensorProjection.lean new file mode 100644 index 0000000000000000000000000000000000000000..9c8189a247d7ab5efc503f0f4f9abad3dd4f5b21 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/TensorProjection.lean @@ -0,0 +1,82 @@ +import Mathlib.LinearAlgebra.TensorProduct.Tower +import OAI.Algebra.Finitistic.Rectification.ExternalTensor + +namespace OAI + +noncomputable section +open scoped TensorProduct +namespace LittleFinitistic.TensorProjection +attribute [local instance] ExternalTensor.rightModule +variable {k B M M' N : Type*} [Field k] [Ring B] [Algebra k B] + [AddCommGroup M] [Module k M] [AddCommGroup M'] [Module k M'] + [AddCommGroup N] [Module k N] [Module Bᵐᵒᵖ N] [IsScalarTower k Bᵐᵒᵖ N] + +/-- Tensor a k-linear map with the identity while retaining the actual right B-action. -/ +def rightMap (f : M →ₗ[k] M') : (M ⊗[k] N) →ₗ[Bᵐᵒᵖ] (M' ⊗[k] N) where + __ := (TensorProduct.map f LinearMap.id).toAddMonoidHom + map_smul' c x := by + induction x using TensorProduct.inductionOn with + | tmul m n => simp [ExternalTensor.right_smul_tmul] + | add x y hx hy => simp_all [smul_add] + +@[simp] theorem rightMap_tmul (f : M →ₗ[k] M') (m : M) (n : N) : + rightMap (B := B) f (m ⊗ₜ[k] n) = f m ⊗ₜ[k] n := rfl + +/-- Transport a first-factor vector-space equivalence as an actual right-module equivalence. -/ +def rightCongr (e : M ≃ₗ[k] M') : (M ⊗[k] N) ≃ₗ[Bᵐᵒᵖ] (M' ⊗[k] N) where + __ := rightMap (B := B) (N := N) e.toLinearMap + invFun := rightMap (B := B) (N := N) e.symm.toLinearMap + left_inv x := by + induction x using TensorProduct.inductionOn with + | tmul m n => simp + | add x y hx hy => simp_all + right_inv x := by + induction x using TensorProduct.inductionOn with + | tmul m n => simp + | add x y hx hy => simp_all + +variable (p : M →ₗ[k] M) + +/-- The actual fixed submodule for a projector on the first tensor factor. -/ +def fixed : Submodule Bᵐᵒᵖ (M ⊗[k] N) := (rightMap (B := B) p - LinearMap.id).ker + +@[simp] theorem mem_fixed (x : M ⊗[k] N) : x ∈ fixed (B := B) p ↔ rightMap (B := B) p x = x := by + simp [fixed,sub_eq_zero] + +theorem range_fixed (hp : p.comp p = p) (x : p.range) : p x.val = x.val := by + obtain ⟨m,hm⟩ := x.property + have h := LinearMap.congr_fun hp m + simpa only [LinearMap.comp_apply,hm] using h + +/-- The eigenspace e(M tensor N) is exactly (eM) tensor N as a right module. -/ +def imageTensorEquiv (hp : p.comp p = p) : (p.range ⊗[k] N) ≃ₗ[Bᵐᵒᵖ] fixed (B := B) (N := N) p where + toFun x := ⟨rightMap (B := B) (N := N) p.range.subtype x,by + rw [mem_fixed] + induction x using TensorProduct.inductionOn with + | tmul m n => simp [range_fixed p hp m] + | add x y hx hy => simp_all⟩ + invFun x := rightMap (B := B) (N := N) p.rangeRestrict x.val + left_inv x := by + induction x using TensorProduct.inductionOn with + | tmul m n => + simp only [rightMap_tmul] + congr 1 + apply Subtype.ext + exact range_fixed p hp m + | add x y hx hy => simp_all + right_inv x := by + apply Subtype.ext + have h : rightMap (B := B) p.range.subtype (rightMap (B := B) (N := N) p.rangeRestrict x.val) = + rightMap (B := B) p x.val := by + generalize x.val = y + induction y using TensorProduct.inductionOn with + | tmul m n => rfl + | add a b ha hb => simp_all + exact h.trans ((mem_fixed p x.val).1 x.property) + map_add' x y := Subtype.ext (map_add _ x y) + map_smul' c x := Subtype.ext (map_smul _ c x) +end LittleFinitistic.TensorProjection + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/ThirdVertex.lean b/lean/OAI/Algebra/Finitistic/Rectification/ThirdVertex.lean new file mode 100644 index 0000000000000000000000000000000000000000..b13f6362b7a697293ad5ebb1855d543d6a04f181 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/ThirdVertex.lean @@ -0,0 +1,55 @@ +import OAI.Algebra.Finitistic.Rectification.ThirdVertexFiltration +import OAI.Algebra.Finitistic.Rectification.InducedRectification +import OAI.Algebra.Finitistic.Rectification.FinalGradedAcyclic + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits HomologicalComplex +namespace LittleFinitistic.ThirdVertex +open ExternalTensor.Section4 ExternalTensor.Section4.SourceFiltration +universe u +variable {k : Type u} [Field k] {d t : ℕ} (P : QuadraticEncoding.Relations k d t) +variable (D₀ D₁ D₂ : RightComplex (QuadraticEncoding.B P)) +variable (f : Fin (d+1) → (D₀ ⟶ D₁)) (g : Fin (d+1) → (D₁ ⟶ D₂)) +variable (H : ∀ r, Homotopy (relationMap (ConcreteQuadraticDiagram.quadratic P) D₀ D₁ D₂ f g r) 0) +local notation "s" => ConcreteQuadraticDiagram.quadratic P +abbrev vertexComplex := AdjacentArrowSum.vertexComplex (QuadraticEncoding.composition P) 2 + +theorem filtration_inclusion_quasiIso : + QuasiIso ((vertexComplex P).map (Exactness.i1 s D₀ D₁ D₂ f g H)) := by + let S := Complex.source0 s D₀ D₁ D₂ f g H + exact RectificationAcyclic.quasiIso_of_acyclic_quotient (S.map (vertexComplex P)) + (Complex.vertex_shortExact ((s).e₂) + ((ThreeVertexAlgebra.directedSystem (QuadraticEncoding.composition P)).idem 2) S + (Complex.source0_shortExact s D₀ D₁ D₂ f g H)) + (FinalGradedAcyclic.grade0_vertex2_acyclic P D₀ D₁ D₂ f g) + +def iota : D₂ ⟶ (vertexComplex P).obj (Exactness.P s D₀ D₁ D₂ f g H) := + (VertexColumnComplex.diagonalComplexIso (QuadraticEncoding.composition P) 2 D₂).hom ≫ + (vertexComplex P).map (Exactness.i2 s D₀ D₁ D₂ f g) ≫ + (vertexComplex P).map (Exactness.i1 s D₀ D₁ D₂ f g H) + +theorem iota_quasiIso : QuasiIso (iota P D₀ D₁ D₂ f g H) := by + let := ThirdVertexFiltration.inclusion_quasiIso P D₀ D₁ D₂ f g + let := filtration_inclusion_quasiIso P D₀ D₁ D₂ f g H + let e : D₂ ≅ (vertexComplex P).obj ((columnComplex k (QuadraticEncoding.B P) (s).e₂).obj D₂) := + VertexColumnComplex.diagonalComplexIso (QuadraticEncoding.composition P) 2 D₂ + change QuasiIso (e.hom ≫ (vertexComplex P).map (Exactness.i2 s D₀ D₁ D₂ f g) ≫ + (vertexComplex P).map (Exactness.i1 s D₀ D₁ D₂ f g H)) + infer_instance + +/-- The final-vertex map is the original e2 tensor insertion followed by the original total inclusion. -/ +theorem iota_original : iota P D₀ D₁ D₂ f g H = + (VertexColumnComplex.diagonalComplexIso (QuadraticEncoding.composition P) 2 D₂).hom ≫ + (vertexComplex P).map ((Exactness.data s D₀ D₁ D₂ f g).in₂) ≫ + (vertexComplex P).map (InducedRectification.inclusion s D₀ D₁ D₂ f g H) := by + dsimp only [iota] + erw [← (vertexComplex P).map_comp (Exactness.i2 s D₀ D₁ D₂ f g) + (Exactness.i1 s D₀ D₁ D₂ f g H), + (Exactness.exact_source_filtration s D₀ D₁ D₂ f g H 0).2.2, Functor.map_comp] + rfl +end LittleFinitistic.ThirdVertex + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/ThirdVertexFiltration.lean b/lean/OAI/Algebra/Finitistic/Rectification/ThirdVertexFiltration.lean new file mode 100644 index 0000000000000000000000000000000000000000..bc99ceac0f21403f9b08c5ffdab1e88864a6bce4 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/ThirdVertexFiltration.lean @@ -0,0 +1,28 @@ +import OAI.Algebra.Finitistic.Rectification.GradedVertexAcyclic + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits HomologicalComplex +namespace LittleFinitistic.ThirdVertexFiltration +open ExternalTensor.Section4 ExternalTensor.Section4.SourceFiltration +universe u +variable {k : Type u} [Field k] {d t : ℕ} (P : QuadraticEncoding.Relations k d t) +variable (D₀ D₁ D₂ : RightComplex (QuadraticEncoding.B P)) +variable (f : Fin (d+1) → (D₀ ⟶ D₁)) (g : Fin (d+1) → (D₁ ⟶ D₂)) +local notation "s" => ConcreteQuadraticDiagram.quadratic P +abbrev vertexComplex := AdjacentArrowSum.vertexComplex (QuadraticEncoding.composition P) 2 + +/-- The original deepest source-filtration inclusion is a quasi-isomorphism at vertex two. -/ +theorem inclusion_quasiIso : + QuasiIso ((vertexComplex P).map (Exactness.i2 s D₀ D₁ D₂ f g)) := by + let S := Complex.source1 s D₀ D₁ D₂ f g + exact RectificationAcyclic.quasiIso_of_acyclic_quotient (S.map (vertexComplex P)) + (Complex.vertex_shortExact ((s).e₂) + ((ThreeVertexAlgebra.directedSystem (QuadraticEncoding.composition P)).idem 2) S + (Complex.source1_shortExact s D₀ D₁ D₂ f g)) + (GradedVertexAcyclic.grade1_vertex2_acyclic P D₀ D₁ D₂ f g) +end LittleFinitistic.ThirdVertexFiltration + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/TotalExact.lean b/lean/OAI/Algebra/Finitistic/Rectification/TotalExact.lean new file mode 100644 index 0000000000000000000000000000000000000000..8e81abf7e973e19c9a84771754cc300be84eff29 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/TotalExact.lean @@ -0,0 +1,89 @@ +import OAI.Algebra.Finitistic.Rectification.TotalFunctorial +import OAI.Algebra.Finitistic.Rectification.ExactProducts +import Mathlib.Algebra.Category.ModuleCat.Biproducts + +namespace OAI +open CategoryTheory CategoryTheory.Limits HomologicalComplex CochainComplex +noncomputable section +namespace LittleFinitistic.RectificationTotal +universe u +variable {S : Type u} [Ring S] + +/-- The canonical binary sum/product identification respects the supplied maps. -/ +theorem prodIso_naturality {X Y X' Y' : ModuleCat.{u} S} (f : X ⟶ X') (g : Y ⟶ Y') : + biprod.map f g ≫ (ModuleCat.biprodIsoProd X' Y').hom = + (ModuleCat.biprodIsoProd X Y).hom ≫ ModuleCat.ofHom (f.hom.prodMap g.hom) := by + apply (cancel_epi (ModuleCat.biprodIsoProd X Y).inv).1 + apply (cancel_mono (ModuleCat.biprodIsoProd X' Y').inv).1 + simp only [Category.assoc, Iso.hom_inv_id, Category.comp_id, Iso.inv_hom_id_assoc] + apply biprod.hom_ext + · simp only [Category.assoc, biprod.map_fst, ModuleCat.biprodIsoProd_inv_comp_fst] + rw [← Category.assoc, ModuleCat.biprodIsoProd_inv_comp_fst] + rfl + · simp only [Category.assoc, biprod.map_snd, ModuleCat.biprodIsoProd_inv_comp_snd] + rw [← Category.assoc, ModuleCat.biprodIsoProd_inv_comp_snd] + rfl + +variable {L₀ L₁ L₂ M₀ M₁ M₂ N₀ N₁ N₂ : CochainComplex (ModuleCat.{u} S) ℤ} +variable {p : L₁ ⟶ L₀} {q : L₂ ⟶ L₁} {h : Homotopy (q ≫ p) 0} +variable {p' : M₁ ⟶ M₀} {q' : M₂ ⟶ M₁} {h' : Homotopy (q' ≫ p') 0} +variable {p'' : N₁ ⟶ N₀} {q'' : N₂ ⟶ N₁} {h'' : Homotopy (q'' ≫ p'') 0} + +/-- The native total's term as the actual product of the three input modules. -/ +def totalTermIso (p : L₁ ⟶ L₀) (q : L₂ ⟶ L₁) (h : Homotopy (q ≫ p) 0) (n : ℤ) : + (total p q h).X n ≅ ModuleCat.of S ((L₂.X (n+2) × L₁.X (n+1)) × L₀.X n) := + termIso p q h n ≪≫ + biprod.mapIso (ModuleCat.biprodIsoProd _ _) (Iso.refl _) ≪≫ + ModuleCat.biprodIsoProd _ _ + +namespace MapData +variable (a : MapData p q h p' q' h') + +/-- The explicit total map acts componentwise in the concrete term product. -/ +theorem totalMap_product (n : ℤ) : + a.totalMap.f n ≫ (totalTermIso p' q' h' n).hom = + (totalTermIso p q h n).hom ≫ ModuleCat.ofHom + (((a.f₂.f (n+2)).hom.prodMap (a.f₁.f (n+1)).hom).prodMap (a.f₀.f n).hom) := by + have hb : + biprod.map (biprod.map (a.f₂.f (n+2)) (a.f₁.f (n+1))) (a.f₀.f n) ≫ + biprod.map (ModuleCat.biprodIsoProd (M₂.X (n+2)) (M₁.X (n+1))).hom (𝟙 (M₀.X n)) = + biprod.map (ModuleCat.biprodIsoProd (L₂.X (n+2)) (L₁.X (n+1))).hom (𝟙 (L₀.X n)) ≫ + biprod.map (ModuleCat.ofHom ((a.f₂.f (n+2)).hom.prodMap (a.f₁.f (n+1)).hom)) (a.f₀.f n) := by + rw [biprodMap_comp, biprodMap_comp, Category.comp_id, Category.id_comp, + prodIso_naturality] + dsimp only [totalTermIso, Iso.trans_hom, biprod.mapIso_hom, Iso.refl_hom] + rw [← Category.assoc, a.totalMap_term] + simp only [Category.assoc] + erw [biprod.mapIso_hom, biprod.mapIso_hom, Iso.refl_hom, Iso.refl_hom] + rw [reassoc_of% hb] + rw [prodIso_naturality] + +/-- A short exact triple of column maps induces short exactness of the actual +supplied total maps, retaining the inclusion and quotient maps themselves. -/ +theorem totalMap_shortExact (b : MapData p' q' h' p'' q'' h'') + (ex₀ : ∀ n, Function.Exact (a.f₀.f n) (b.f₀.f n)) + (ex₁ : ∀ n, Function.Exact (a.f₁.f n) (b.f₁.f n)) + (ex₂ : ∀ n, Function.Exact (a.f₂.f n) (b.f₂.f n)) + (inj₀ : ∀ n, Function.Injective (a.f₀.f n)) + (inj₁ : ∀ n, Function.Injective (a.f₁.f n)) + (inj₂ : ∀ n, Function.Injective (a.f₂.f n)) + (surj₀ : ∀ n, Function.Surjective (b.f₀.f n)) + (surj₁ : ∀ n, Function.Surjective (b.f₁.f n)) + (surj₂ : ∀ n, Function.Surjective (b.f₂.f n)) (n : ℤ) : + Function.Injective (a.totalMap.f n) ∧ + Function.Exact (a.totalMap.f n) (b.totalMap.f n) ∧ + Function.Surjective (b.totalMap.f n) := by + let inner := shortExact_prod (ex₂ (n+2)) (ex₁ (n+1)) + (inj₂ (n+2)) (inj₁ (n+1)) (surj₂ (n+2)) (surj₁ (n+1)) + let all := shortExact_prod inner.2.1 (ex₀ n) inner.1 (inj₀ n) inner.2.2 (surj₀ n) + apply shortExact_transport (totalTermIso p q h n).toLinearEquiv.toEquiv + (totalTermIso p' q' h' n).toLinearEquiv.toEquiv + (totalTermIso p'' q'' h'' n).toLinearEquiv.toEquiv (by simp) + (fun x => congrArg (fun f => f x) (a.totalMap_product n)) + (fun x => congrArg (fun f => f x) (b.totalMap_product n)) all.1 all.2.1 all.2.2 +end MapData +end LittleFinitistic.RectificationTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/TotalFinite.lean b/lean/OAI/Algebra/Finitistic/Rectification/TotalFinite.lean new file mode 100644 index 0000000000000000000000000000000000000000..f74bfc63ccba198548927cbbac60de42f861d3be --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/TotalFinite.lean @@ -0,0 +1,53 @@ +import OAI.Algebra.Finitistic.Rectification.RectificationTotal +import OAI.Algebra.Finitistic.Rectification.ColumnFinite + +namespace OAI +open CategoryTheory CategoryTheory.Limits HomologicalComplex CochainComplex +noncomputable section +namespace ExternalTensor.Section4 +universe u +variable {k : Type u} [Field k] +section General +variable {C : Type*} [Category C] [Preadditive C] [HasBinaryBiproducts C] +variable {L₀ L₁ L₂ : CochainComplex C ℤ} (p : L₁ ⟶ L₀) (q : L₂ ⟶ L₁) + (h : Homotopy (q ≫ p) 0) + +/-- The rectification total has finite-dimensional terms whenever +an additive scalar restriction makes all three columns finite-dimensional. -/ +theorem total_finite_after (F : C ⥤ ModuleCat.{u} k) [F.Additive] + (h₀ : ∀ i, FiniteDimensional k (F.obj (L₀.X i))) + (h₁ : ∀ i, FiniteDimensional k (F.obj (L₁.X i))) + (h₂ : ∀ i, FiniteDimensional k (F.obj (L₂.X i))) (i : ℤ) : + FiniteDimensional k (F.obj ((LittleFinitistic.RectificationTotal.total p q h).X i)) := by + let := preservesBinaryBiproducts_of_preservesBiproducts F + apply finite_of_iso k (F.mapIso (LittleFinitistic.RectificationTotal.termIso p q h i) ≪≫ + F.mapBiprod _ _ ≪≫ biprod.mapIso (F.mapBiprod _ _) (Iso.refl _)) + exact biprod_finite k (biprod_finite k (h₂ (i+2)) (h₁ (i+1))) (h₀ i) + +end General + +variable {B : Type u} [Ring B] [Algebra k B] +variable {A J R : Type} [Fintype A] [Fintype J] [Fintype R] +variable (s : Quadratic k B (A := A) (J := J) (R := R)) +variable (D₀ D₁ D₂ : RightComplex B) +variable (f : A → (D₀ ⟶ D₁)) (g : J → (D₁ ⟶ D₂)) +variable (H : ∀ r, Homotopy (relationMap s D₀ D₁ D₂ f g r) 0) + +/-- The finite-dimensionality conclusion for the manuscript's constructed P, +with no projectivity or finite-dimensionality assumption on P or its columns. -/ +theorem induced_total_finite [FiniteDimensional k B] + (h₀ : ∀ i, Module.Finite Bᵐᵒᵖ (D₀.X i)) + (h₁ : ∀ i, Module.Finite Bᵐᵒᵖ (D₁.X i)) + (h₂ : ∀ i, Module.Finite Bᵐᵒᵖ (D₂.X i)) (i : ℤ) : + FiniteDimensional k ((forgetK k B).obj + ((LittleFinitistic.RectificationTotal.total (p s D₀ D₁ D₂ f g) + (q s D₀ D₁ D₂ f g) (nullHomotopy s D₀ D₁ D₂ f g H)).X i)) := by + exact total_finite_after _ _ _ (forgetK k B) + (fun n => (columns_finite s D₀ D₁ D₂ f g h₀ h₁ h₂ n).1) + (fun n => (columns_finite s D₀ D₁ D₂ f g h₀ h₁ h₂ n).2.1) + (fun n => (columns_finite s D₀ D₁ D₂ f g h₀ h₁ h₂ n).2.2) i +end ExternalTensor.Section4 + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/TotalFunctorial.lean b/lean/OAI/Algebra/Finitistic/Rectification/TotalFunctorial.lean new file mode 100644 index 0000000000000000000000000000000000000000..3a3c903ee300cd03dccf6dca54990602debe250a --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/TotalFunctorial.lean @@ -0,0 +1,169 @@ +import OAI.Algebra.Finitistic.Rectification.RectificationTotal + +namespace OAI +open CategoryTheory CategoryTheory.Limits HomologicalComplex CochainComplex +open CochainComplex.HomComplex +noncomputable section +namespace LittleFinitistic.RectificationTotal +variable {C : Type*} [Category C] [Preadditive C] [HasBinaryBiproducts C] +theorem biprodMap_comp {U V W X Y Z : C} (f : U ⟶ W) (g : V ⟶ X) + (f' : W ⟶ Y) (g' : X ⟶ Z) : + biprod.map f g ≫ biprod.map f' g' = biprod.map (f ≫ f') (g ≫ g') := by + apply biprod.hom_ext <;> simp + +variable {A B A' B' A'' B'' : CochainComplex C ℤ} + +/-- A strictly commuting square induces the ordinary diagonal map of cones. -/ +def coneMap (q : A ⟶ B) (q' : A' ⟶ B') (u : A ⟶ A') (v : B ⟶ B') + (w : u ≫ q' = q ≫ v) : mappingCone q ⟶ mappingCone q' := + homotopyCofiber.mapArrowHom q q' (fun j => ⟨j-1, by simp⟩) + (Arrow.homMk u v w) + +@[reassoc (attr := simp)] +theorem coneMap_inl (q : A ⟶ B) (q' : A' ⟶ B') (u : A ⟶ A') (v : B ⟶ B') + (w : u ≫ q' = q ≫ v) (i j : ℤ) (hij : i + (-1) = j) : + (mappingCone.inl q).v i j hij ≫ (coneMap q q' u v w).f j = + u.f i ≫ (mappingCone.inl q').v i j hij := by + dsimp [coneMap, homotopyCofiber.mapArrowHom, mappingCone.inl] + erw [homotopyCofiber.inlX_desc_f] + simp + congr 1 + exact homotopyCofiber.inrCompHomotopy_hom q' _ i j (by change j+1=i; omega) + +@[reassoc (attr := simp)] +theorem coneMap_inr (q : A ⟶ B) (q' : A' ⟶ B') (u : A ⟶ A') (v : B ⟶ B') + (w : u ≫ q' = q ≫ v) (i : ℤ) : + (mappingCone.inr q).f i ≫ (coneMap q q' u v w).f i = + v.f i ≫ (mappingCone.inr q').f i := by + dsimp [coneMap, homotopyCofiber.mapArrowHom, mappingCone.inr] + exact homotopyCofiber.inrX_desc_f _ _ _ _ + +@[reassoc (attr := simp)] +theorem cone_inl_termIso (q : A ⟶ B) (i j : ℤ) (hij : i+1=j) : + (mappingCone.inl q).v j i (by omega) ≫ (homotopyCofiber.XIsoBiprod q i j hij).hom = + biprod.inl := + homotopyCofiber.inlX_XIsoBiprod_hom _ _ _ _ + +@[reassoc (attr := simp)] +theorem cone_inr_termIso (q : A ⟶ B) (i j : ℤ) (hij : i+1=j) : + (mappingCone.inr q).f i ≫ (homotopyCofiber.XIsoBiprod q i j hij).hom = + biprod.inr := + homotopyCofiber.inrX_XIsoBiprod_hom _ _ _ _ + +/-- On terms the cone map is exactly the sum of the two supplied maps. -/ +theorem coneMap_term (q : A ⟶ B) (q' : A' ⟶ B') (u : A ⟶ A') (v : B ⟶ B') + (w : u ≫ q' = q ≫ v) (i j : ℤ) (hij : i+1=j) : + (coneMap q q' u v w).f i ≫ (homotopyCofiber.XIsoBiprod q' i j hij).hom = + (homotopyCofiber.XIsoBiprod q i j hij).hom ≫ biprod.map (u.f j) (v.f i) := by + apply mappingCone.ext_from q j i hij + · erw [coneMap_inl_assoc, cone_inl_termIso, ← Category.assoc, cone_inl_termIso, + biprod.inl_map] + · erw [coneMap_inr_assoc, cone_inr_termIso, ← Category.assoc, cone_inr_termIso, + biprod.inr_map] + +@[simp] +theorem coneMap_id (q : A ⟶ B) : coneMap q q (𝟙 A) (𝟙 B) (by simp) = 𝟙 _ := by + change homotopyCofiber.mapArrowHom q q _ (𝟙 _) = 𝟙 _ + exact homotopyCofiber.mapArrowHom_id _ _ + +theorem coneMap_comp (q : A ⟶ B) (q' : A' ⟶ B') (q'' : A'' ⟶ B'') + (u : A ⟶ A') (v : B ⟶ B') (w : u ≫ q' = q ≫ v) + (u' : A' ⟶ A'') (v' : B' ⟶ B'') (w' : u' ≫ q'' = q' ≫ v') : + coneMap q q'' (u ≫ u') (v ≫ v') (by rw [Category.assoc, w', ← Category.assoc, w, Category.assoc]) = + coneMap q q' u v w ≫ coneMap q' q'' u' v' w' := by + exact homotopyCofiber.mapArrowHom_comp _ _ _ _ (Arrow.homMk u v w) (Arrow.homMk u' v' w') + +variable {L₀ L₁ L₂ M₀ M₁ M₂ N₀ N₁ N₂ : CochainComplex C ℤ} +variable {p : L₁ ⟶ L₀} {q : L₂ ⟶ L₁} {h : Homotopy (q ≫ p) 0} +variable {p' : M₁ ⟶ M₀} {q' : M₂ ⟶ M₁} {h' : Homotopy (q' ≫ p') 0} + +/-- Morphisms preserve both degree-zero maps and the specified relation +homotopy, which is part of the three-column input data. -/ +structure MapData (p : L₁ ⟶ L₀) (q : L₂ ⟶ L₁) (h : Homotopy (q ≫ p) 0) + (p' : M₁ ⟶ M₀) (q' : M₂ ⟶ M₁) (h' : Homotopy (q' ≫ p') 0) where + f₀ : L₀ ⟶ M₀ + f₁ : L₁ ⟶ M₁ + f₂ : L₂ ⟶ M₂ + commP : f₁ ≫ p' = p ≫ f₀ + commQ : f₂ ≫ q' = q ≫ f₁ + commH : ∀ i j, f₂.f i ≫ h'.hom i j = h.hom i j ≫ f₀.f j + +namespace MapData +variable (a : MapData p q h p' q' h') + +def inner : mappingCone q ⟶ mappingCone q' := coneMap q q' a.f₂ a.f₁ a.commQ + +theorem rectifyingMap_naturality : a.inner ≫ rectifyingMap p' q' h' = + rectifyingMap p q h ≫ a.f₀ := by + ext n + apply mappingCone.ext_from q (n+1) n rfl + · simp only [comp_f, inner, coneMap_inl_assoc, rectifyingMap, mappingCone.inl_v_desc_f_assoc, + mappingCone.inl_v_desc_f] + exact a.commH (n+1) n + · simp only [comp_f, inner, coneMap_inr_assoc, rectifyingMap, + mappingCone.inr_f_desc_f_assoc, mappingCone.inr_f_desc_f] + exact congrArg (fun f => f.f n) a.commP + +/-- The induced chain map of the native primary's actual iterated-cone total. -/ +def totalMap : total p q h ⟶ total p' q' h' := + coneMap (rectifyingMap p q h) (rectifyingMap p' q' h') a.inner a.f₀ + a.rectifyingMap_naturality + +/-- The zero-column inclusion is preserved by the actual induced total map. -/ +@[reassoc] +theorem inclusion_totalMap : inclusion p q h ≫ a.totalMap = + a.f₀ ≫ inclusion p' q' h' := by + ext n + exact coneMap_inr _ _ _ _ _ n + +/-- The induced total map is the actual diagonal triple under the native +term decomposition, including both cohomological shifts. -/ +theorem totalMap_term (n : ℤ) : + a.totalMap.f n ≫ (termIso p' q' h' n).hom = + (termIso p q h n).hom ≫ + biprod.map (biprod.map (a.f₂.f (n+2)) (a.f₁.f (n+1))) (a.f₀.f n) := by + unfold totalMap termIso + erw [Iso.trans_hom, Iso.trans_hom, biprod.mapIso_hom, biprod.mapIso_hom, Iso.refl_hom, Iso.refl_hom] + erw [← Category.assoc, coneMap_term] + erw [Category.assoc, Category.assoc, biprodMap_comp, biprodMap_comp, + Category.comp_id, Category.id_comp] + congr 2 + exact coneMap_term q q' a.f₂ a.f₁ a.commQ (n+1) (n+2) (by omega) + +def id (p : L₁ ⟶ L₀) (q : L₂ ⟶ L₁) (h : Homotopy (q ≫ p) 0) : + MapData p q h p q h where + f₀ := 𝟙 _ + f₁ := 𝟙 _ + f₂ := 𝟙 _ + commP := by simp + commQ := by simp + commH := by intros; simp + +variable {p'' : N₁ ⟶ N₀} {q'' : N₂ ⟶ N₁} {h'' : Homotopy (q'' ≫ p'') 0} +def comp (b : MapData p' q' h' p'' q'' h'') : MapData p q h p'' q'' h'' where + f₀ := a.f₀ ≫ b.f₀ + f₁ := a.f₁ ≫ b.f₁ + f₂ := a.f₂ ≫ b.f₂ + commP := by rw [Category.assoc, b.commP, ← Category.assoc, a.commP, Category.assoc] + commQ := by rw [Category.assoc, b.commQ, ← Category.assoc, a.commQ, Category.assoc] + commH i j := by + simp only [comp_f] + rw [Category.assoc, b.commH, ← Category.assoc, a.commH, Category.assoc] + +@[simp] theorem totalMap_id : (id p q h).totalMap = 𝟙 _ := by + simp [totalMap, inner, id, coneMap_id, total] + +theorem totalMap_comp (b : MapData p' q' h' p'' q'' h'') : + (a.comp b).totalMap = a.totalMap ≫ b.totalMap := by + have hi : (a.comp b).inner = a.inner ≫ b.inner := coneMap_comp _ _ _ _ _ _ _ _ _ + refine Eq.trans ?_ (coneMap_comp _ _ _ a.inner a.f₀ a.rectifyingMap_naturality + b.inner b.f₀ b.rectifyingMap_naturality) + change coneMap _ _ (a.comp b).inner (a.f₀ ≫ b.f₀) _ = _ + congr 1 + +end MapData +end LittleFinitistic.RectificationTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/TotalInterchange.lean b/lean/OAI/Algebra/Finitistic/Rectification/TotalInterchange.lean new file mode 100644 index 0000000000000000000000000000000000000000..8c74d18366121d5fc4fcf4b38c4549d2e0dc4f06 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/TotalInterchange.lean @@ -0,0 +1,107 @@ +import OAI.Algebra.Finitistic.Rectification.TotalFunctorial + +namespace OAI +open CategoryTheory CategoryTheory.Limits HomologicalComplex CochainComplex +open CochainComplex.HomComplex +noncomputable section +namespace LittleFinitistic.RectificationTotal +variable {C D : Type*} [Category C] [Preadditive C] [HasBinaryBiproducts C] + [Category D] [Preadditive D] [HasBinaryBiproducts D] +variable (F : C ⥤ D) [F.Additive] + +abbrev mapComplex := F.mapHomologicalComplex (ComplexShape.up ℤ) + +variable {A B A' B' : CochainComplex C ℤ} + +/-- The canonical additive comparison for one cone. -/ +def coneInterchange (q : A ⟶ B) : + (mapComplex F).obj (mappingCone q) ≅ mappingCone ((mapComplex F).map q) := + homotopyCofiber.mapHomologicalComplexObjIso q F + +@[reassoc (attr := simp)] +theorem coneInterchange_inv_inl (q : A ⟶ B) (i j : ℤ) (hij : i + (-1) = j) : + (mappingCone.inl ((mapComplex F).map q)).v i j hij ≫ + (coneInterchange F q).inv.f j = F.map ((mappingCone.inl q).v i j hij) := by + exact homotopyCofiber.inlX_mapHomologicalComplexObjXIso_inv q F i j (by change j+1=i; omega) + +@[reassoc (attr := simp)] +theorem coneInterchange_inv_inr (q : A ⟶ B) (i : ℤ) : + (mappingCone.inr ((mapComplex F).map q)).f i ≫ + (coneInterchange F q).inv.f i = F.map ((mappingCone.inr q).f i) := by + exact homotopyCofiber.inrX_mapHomologicalComplexObjXIso_inv q F i + +@[reassoc (attr := simp)] +theorem coneInterchange_hom_inl (q : A ⟶ B) (i j : ℤ) (hij : i + (-1) = j) : + F.map ((mappingCone.inl q).v i j hij) ≫ (coneInterchange F q).hom.f j = + (mappingCone.inl ((mapComplex F).map q)).v i j hij := by + rw [← coneInterchange_inv_inl F q i j hij, Category.assoc] + rw [← comp_f, Iso.inv_hom_id, id_f, Category.comp_id] + +@[reassoc (attr := simp)] +theorem coneInterchange_hom_inr (q : A ⟶ B) (i : ℤ) : + F.map ((mappingCone.inr q).f i) ≫ (coneInterchange F q).hom.f i = + (mappingCone.inr ((mapComplex F).map q)).f i := by + rw [← coneInterchange_inv_inr F q i, Category.assoc] + rw [← comp_f, Iso.inv_hom_id, id_f, Category.comp_id] + +variable {L₀ L₁ L₂ : CochainComplex C ℤ} +variable (p : L₁ ⟶ L₀) (q : L₂ ⟶ L₁) (h : Homotopy (q ≫ p) 0) + +/-- Apply the functor to the supplied null-homotopy, transporting only +functorial composition and zero equalities. -/ +def mapNullHomotopy : Homotopy ((mapComplex F).map q ≫ (mapComplex F).map p) 0 := + (Homotopy.ofEq (by simp)).trans ((F.mapHomotopy h).trans (Homotopy.ofEq (by simp))) + +omit [HasBinaryBiproducts C] [HasBinaryBiproducts D] in +@[simp] theorem mapNullHomotopy_hom (i j : ℤ) : + (mapNullHomotopy F p q h).hom i j = F.map (h.hom i j) := by + simp [mapNullHomotopy, Homotopy.trans, Homotopy.ofEq] + +/-- Mapping the rectifying map agrees with rectifying the mapped data. -/ +theorem rectifyingMap_interchange_inv : + (coneInterchange F q).inv ≫ (mapComplex F).map (rectifyingMap p q h) = + rectifyingMap ((mapComplex F).map p) ((mapComplex F).map q) + (mapNullHomotopy F p q h) := by + ext n + apply mappingCone.ext_from ((mapComplex F).map q) (n+1) n rfl + · simp only [comp_f, coneInterchange_inv_inl_assoc] + dsimp only [mapComplex, Functor.mapHomologicalComplex_map_f] + rw [← F.map_comp] + simp [rectifyingMap, Cochain.ofHomotopy] + · simp only [comp_f, coneInterchange_inv_inr_assoc] + dsimp only [mapComplex, Functor.mapHomologicalComplex_map_f] + rw [← F.map_comp] + simp [rectifyingMap] + +theorem rectifyingMap_interchange : + (coneInterchange F q).hom ≫ + rectifyingMap ((mapComplex F).map p) ((mapComplex F).map q) + (mapNullHomotopy F p q h) = (mapComplex F).map (rectifyingMap p q h) := by + rw [← rectifyingMap_interchange_inv F p q h, ← Category.assoc] + simp + +/-- Arbitrary additive functors commute with the actual iterated-cone total. -/ +def totalInterchange : (mapComplex F).obj (total p q h) ≅ + total ((mapComplex F).map p) ((mapComplex F).map q) (mapNullHomotopy F p q h) := + coneInterchange F (rectifyingMap p q h) ≪≫ + homotopyCofiber.mapArrowIso _ _ (fun j => ⟨j-1, by simp⟩) + (Arrow.isoMk (coneInterchange F q) (Iso.refl _) + (by simpa using rectifyingMap_interchange F p q h)) + +/-- The original zero-column inclusion is carried to the original inclusion. -/ +@[reassoc] +theorem inclusion_totalInterchange : + (mapComplex F).map (inclusion p q h) ≫ (totalInterchange F p q h).hom = + inclusion ((mapComplex F).map p) ((mapComplex F).map q) (mapNullHomotopy F p q h) := by + ext n + change F.map ((mappingCone.inr (rectifyingMap p q h)).f n) ≫ + ((coneInterchange F (rectifyingMap p q h)).hom.f n ≫ _) = _ + rw [coneInterchange_hom_inr_assoc] + change (mappingCone.inr _).f n ≫ (coneMap _ _ _ _ _).f n = _ + rw [coneMap_inr] + simp [inclusion] +end LittleFinitistic.RectificationTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/VertexCategoricalAssembly.lean b/lean/OAI/Algebra/Finitistic/Rectification/VertexCategoricalAssembly.lean new file mode 100644 index 0000000000000000000000000000000000000000..6ebbc4c045cb5140f7c04bca7b07d57b62d360fe --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/VertexCategoricalAssembly.lean @@ -0,0 +1,59 @@ +import OAI.Algebra.Finitistic.Encoding.EncodingModuleAssembly +import OAI.Algebra.Finitistic.Rectification.LeftVertexHomology + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.VertexCategoricalAssembly +open QuadraticEncoding +universe u +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) +variable (M N : ModuleCat.{u} (B P)) +variable (E : ∀ i : Fin 3, + (LeftVertexHomology.vertex k (B P) (ThreeVertexAlgebra.vertex (composition P) i)).obj M ≅ + (LeftVertexHomology.vertex k (B P) (ThreeVertexAlgebra.vertex (composition P) i)).obj N) + +abbrev scalar (M : ModuleCat.{u} (B P)) := (ModuleCat.restrictScalars (algebraMap k (B P))).obj M + +def vertexEquiv (i : Fin 3) : + VertexDecomposition.Space (EncodingModuleAssembly.system P) (scalar P M) i ≃ₗ[k] + VertexDecomposition.Space (EncodingModuleAssembly.system P) (scalar P N) i := + (LeftVertexHomology.spaceEquiv k (B P) (ThreeVertexAlgebra.vertex (composition P) i) M).symm.trans + ((E i).toLinearEquiv.trans + (LeftVertexHomology.spaceEquiv k (B P) (ThreeVertexAlgebra.vertex (composition P) i) N)) + +/-- Compatible categorical vertex isomorphisms determine a full B-module isomorphism. +The hypotheses are exactly the two finite arrow squares; length-two actions follow. -/ +def iso + (h01 : ∀ a, + (LeftVertexHomology.arrow k (B P) (ThreeVertexAlgebra.vertex (composition P) 0) + (ThreeVertexAlgebra.vertex (composition P) 1) (arrow01 P a) + (CanonicalArrowCompatibility.arrow01_target P a)).app M ≫ (E 1).hom = + (E 0).hom ≫ (LeftVertexHomology.arrow k (B P) (ThreeVertexAlgebra.vertex (composition P) 0) + (ThreeVertexAlgebra.vertex (composition P) 1) (arrow01 P a) + (CanonicalArrowCompatibility.arrow01_target P a)).app N) + (h12 : ∀ b, + (LeftVertexHomology.arrow k (B P) (ThreeVertexAlgebra.vertex (composition P) 1) + (ThreeVertexAlgebra.vertex (composition P) 2) (arrow12 P b) + (CanonicalArrowCompatibility.arrow12_target P b)).app M ≫ (E 2).hom = + (E 1).hom ≫ (LeftVertexHomology.arrow k (B P) (ThreeVertexAlgebra.vertex (composition P) 1) + (ThreeVertexAlgebra.vertex (composition P) 2) (arrow12 P b) + (CanonicalArrowCompatibility.arrow12_target P b)).app N) : M ≅ N := by + let e := EncodingModuleAssembly.equiv P (vertexEquiv P M N E) + (fun a x => ?_) (fun b x => ?_) + · exact e.toModuleIso + · apply Subtype.ext + have hh := congrArg (fun f => ModuleCat.Hom.hom f + ((LeftVertexHomology.spaceEquiv k (B P) (ThreeVertexAlgebra.vertex (composition P) 0) M).symm x)) (h01 a) + have hh' := congrArg Subtype.val hh + exact hh' + · apply Subtype.ext + have hh := congrArg (fun f => ModuleCat.Hom.hom f + ((LeftVertexHomology.spaceEquiv k (B P) (ThreeVertexAlgebra.vertex (composition P) 1) M).symm x)) (h12 b) + have hh' := congrArg Subtype.val hh + exact hh' +end LittleFinitistic.VertexCategoricalAssembly + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/VertexColumnComplex.lean b/lean/OAI/Algebra/Finitistic/Rectification/VertexColumnComplex.lean new file mode 100644 index 0000000000000000000000000000000000000000..bc28b3bfc99d7870e0e6ce9312b7dae42d9d6170 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/VertexColumnComplex.lean @@ -0,0 +1,54 @@ +import OAI.Algebra.Finitistic.Rectification.VertexColumnModels + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +open scoped TensorProduct ModuleCat.Algebra +namespace LittleFinitistic.VertexColumnComplex +universe u +variable {k V W U : Type u} [Field k] [AddCommGroup V] [Module k V] + [AddCommGroup W] [Module k W] [AddCommGroup U] [Module k U] +variable (μ : W →ₗ[k] V →ₗ[k] U) +local notation "T" => ThreeVertexAlgebra μ +attribute [local instance] ExternalTensor.rightModule ExternalTensor.bimodule + +abbrev vertexColumn (i j : Fin 3) : ModuleCat.{u} Tᵐᵒᵖ ⥤ ModuleCat.{u} Tᵐᵒᵖ := + ExternalTensor.Section4.columnFunctor k T (ThreeVertexAlgebra.vertex μ j) ⋙ + BimoduleVertex.functor k T (ThreeVertexAlgebra.vertex μ i) + +/-- The diagonal insertion is natural in the original right module. -/ +def diagonalNatIso (i : Fin 3) : 𝟭 (ModuleCat.{u} Tᵐᵒᵖ) ≅ vertexColumn μ i i := + NatIso.ofComponents (fun N => (BimoduleVertex.diagonalEquiv μ N i).symm.toModuleIso) (by + intro M N f + apply ModuleCat.hom_ext + apply LinearMap.ext + intro n + apply Subtype.ext + change ((BimoduleVertex.diagonalEquiv μ N i).symm (f.hom n)).val = + ExternalTensor.columnMap k (ThreeVertexAlgebra.vertex μ i) f.hom + (((BimoduleVertex.diagonalEquiv μ M i).symm n).val) + rw [VertexColumnModels.diagonal_symm_val,VertexColumnModels.diagonal_symm_val] + rfl) + +/-- On actual complexes, the diagonal vertex is the original complex via its specified insertion. -/ +def diagonalComplexIso (i : Fin 3) (D : CochainComplex (ModuleCat.{u} Tᵐᵒᵖ) ℤ) : + D ≅ ((vertexColumn μ i i).mapHomologicalComplex (.up ℤ)).obj D := + HomologicalComplex.Hom.isoOfComponents (fun n => (diagonalNatIso μ i).app (D.X n)) + (fun n m _ => ((diagonalNatIso μ i).hom.naturality (D.d n m)).symm) + +/-- Every term of a reverse vertex column is zero, hence the actual complex is zero. -/ +theorem reverse_isZero (i j : Fin 3) (hij : i < j) + (D : CochainComplex (ModuleCat.{u} Tᵐᵒᵖ) ℤ) : + IsZero (((vertexColumn μ i j).mapHomologicalComplex (.up ℤ)).obj D) := by + apply (IsZero.iff_id_eq_zero _).2 + apply HomologicalComplex.Hom.ext + funext n + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + exact (VertexColumnModels.reverse_zero μ (D.X n) i j hij).elim _ _ +end LittleFinitistic.VertexColumnComplex + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/VertexColumnModels.lean b/lean/OAI/Algebra/Finitistic/Rectification/VertexColumnModels.lean new file mode 100644 index 0000000000000000000000000000000000000000..20050ea6af5466410ec701f7c72ae82decaaed10 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/VertexColumnModels.lean @@ -0,0 +1,52 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleVertex + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +open scoped TensorProduct ModuleCat.Algebra +namespace LittleFinitistic.VertexColumnModels +universe u +variable {k V W U : Type u} [Field k] [AddCommGroup V] [Module k V] + [AddCommGroup W] [Module k W] [AddCommGroup U] [Module k U] +variable (μ : W →ₗ[k] V →ₗ[k] U) +variable (N : ModuleCat.{u} (ThreeVertexAlgebra μ)ᵐᵒᵖ) +local notation "T" => ThreeVertexAlgebra μ +attribute [local instance] ExternalTensor.rightModule ExternalTensor.bimodule + +/-- The actual vertex of an induced column is its path-corner tensor. -/ +def cornerEquiv (i j : Fin 3) : + BimoduleVertex.columnFixed μ N i j ≃ₗ[Tᵐᵒᵖ] (CornerSpaces.corner μ i j ⊗[k] N) := + (BimoduleVertex.columnFixedEquiv μ N i j).trans + (CornerTensor.cornerTensorEquiv μ N i j).symm + +/-- Vertices below the directed support have zero actual column component. -/ +theorem reverse_zero (i j : Fin 3) (hij : i < j) : + Subsingleton (BimoduleVertex.columnFixed μ N i j) := by + have hc : Subsingleton (CornerSpaces.corner μ i j) := + ⟨fun x y => (CornerSpaces.corner_zero_of_lt μ i j hij x).trans + (CornerSpaces.corner_zero_of_lt μ i j hij y).symm⟩ + let := hc + have ht : ∀ x : CornerSpaces.corner μ i j ⊗[k] N, x = 0 := by + intro x + induction x using TensorProduct.inductionOn with + | tmul x n => simp [Subsingleton.elim x 0] + | add x y hx hy => simp [hx,hy] + refine ⟨fun x y => (cornerEquiv μ N i j).injective ?_⟩ + exact (ht _).trans (ht _).symm + +/-- The inverse diagonal equivalence is the manuscript's original insertion e_i tensor n. -/ +theorem diagonal_symm_val (i : Fin 3) (n : N) : + ((BimoduleVertex.diagonalEquiv μ N i).symm n).val = + ExternalTensor.columnInclusion k T N (ThreeVertexAlgebra.vertex μ i) n := by + change (⟨(1 : k) • ThreeVertexAlgebra.vertex μ i, _⟩ : + ExternalTensor.leftIdeal T (ThreeVertexAlgebra.vertex μ i)) ⊗ₜ[k] n = + ExternalTensor.generator T (ThreeVertexAlgebra.vertex μ i) ⊗ₜ[k] n + congr 1 + apply Subtype.ext + exact one_smul k _ + +end LittleFinitistic.VertexColumnModels + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/VertexDecomposition.lean b/lean/OAI/Algebra/Finitistic/Rectification/VertexDecomposition.lean new file mode 100644 index 0000000000000000000000000000000000000000..904b8b4090178ed9f00484bbd73ecfcf25d748e9 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/VertexDecomposition.lean @@ -0,0 +1,62 @@ +import OAI.Algebra.Finitistic.Tensor.IdempotentTensor +import OAI.Algebra.Finitistic.Encoding.DirectedBound + +namespace OAI +noncomputable section +namespace LittleFinitistic.VertexDecomposition +universe u v +variable {k A : Type u} [Field k] [Ring A] [Algebra k A] {n : ℕ} +variable (D : DirectedBound.DirectedSystem k A n) +variable (M : Type v) [AddCommGroup M] [Module k M] [Module A M] + [IsScalarTower k A M] + +abbrev Space (i : Fin n) := IdempotentTensor.leftSpace (k := k) (D.e i) M + +/-- Projection onto an actual vertex subspace. -/ +def project (i : Fin n) : M →ₗ[k] Space D M i where + toFun x := ⟨D.e i • x, by + change D.e i • (D.e i • x) = D.e i • x + rw [← mul_smul, D.idem]⟩ + map_add' x y := Subtype.ext (smul_add _ _ _) + map_smul' c x := Subtype.ext (smul_comm _ _ _) + +/-- A module decomposes into its actual vertex subspaces. This is a vector-space +isomorphism; off-diagonal arrows act between its factors. -/ +def equiv : M ≃ₗ[k] ((i : Fin n) → Space D M i) where + toFun x i := project D M i x + invFun x := ∑ i, (x i).val + map_add' x y := by funext i; exact (project D M i).map_add x y + map_smul' c x := by funext i; exact (project D M i).map_smul c x + left_inv x := by + change ∑ i, D.e i • x = x + rw [← Finset.sum_smul, D.complete, one_smul] + right_inv x := by + funext i + apply Subtype.ext + change D.e i • (∑ j, (x j).val) = (x i).val + rw [Finset.smul_sum] + rw [Finset.sum_eq_single i] + · exact (x i).property + · intro j _ hji + rw [← (x j).property, ← mul_smul, D.orthogonal i j (Ne.symm hji), zero_smul] + · simp + +@[simp] theorem equiv_apply (x : M) (i : Fin n) : + equiv D M x i = project D M i x := rfl + +@[simp] theorem equiv_symm_apply (x : (i : Fin n) → Space D M i) : + (equiv D M).symm x = ∑ i, (x i).val := rfl + +lemma project_self (i : Fin n) (x : Space D M i) : project D M i x.val = x := + Subtype.ext x.property + +lemma project_other (i j : Fin n) (hij : i ≠ j) (x : Space D M j) : + project D M i x.val = 0 := by + apply Subtype.ext + change D.e i • x.val = 0 + rw [← x.property, ← mul_smul, D.orthogonal i j hij, zero_smul] +end LittleFinitistic.VertexDecomposition + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/VertexFunctor.lean b/lean/OAI/Algebra/Finitistic/Rectification/VertexFunctor.lean new file mode 100644 index 0000000000000000000000000000000000000000..54d9fcaeaec7bd04bb85130f8b0298c35d6b9a83 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/VertexFunctor.lean @@ -0,0 +1,125 @@ +import Mathlib.Algebra.Category.ModuleCat.ChangeOfRings +import Mathlib.Algebra.Homology.ShortComplex.ModuleCat +import Mathlib.Algebra.Module.Projective +import Mathlib.CategoryTheory.Preadditive.AdditiveFunctor + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.VertexFunctor +universe u +variable {A B : Type u} [Ring A] [Ring B] +variable (β : B →+* A) (e : A) (he : e*e=e) (hc : ∀ b, e*β b=β b*e) + +abbrev restricted (M : ModuleCat.{u} A) := (ModuleCat.restrictScalars β).obj M + +/-- The original vertex action is linear for the commuting right restriction. -/ +def action (M : ModuleCat.{u} A) : restricted β M →ₗ[B] restricted β M where + toFun m := e • (m : M) + map_add' x y := smul_add _ _ _ + map_smul' b m := by + change e • (β b • (m : M)) = β b • (e • (m : M)) + rw [← mul_smul,← mul_smul,hc] + +def fixed (M : ModuleCat.{u} A) : Submodule B (restricted β M) := + (action β e hc M - LinearMap.id).ker + +@[simp] theorem mem_fixed (M : ModuleCat.{u} A) (m : restricted β M) : + m ∈ fixed β e hc M ↔ e • (m : M) = m := by + simp [fixed,action,sub_eq_zero] + +/-- The genuine projection onto the vertex component. -/ +def projection (M : ModuleCat.{u} A) : restricted β M →ₗ[B] fixed β e hc M := + (action β e hc M).codRestrict _ (by + intro m + rw [mem_fixed] + change e • (e • (m : M)) = e • (m : M) + rw [← mul_smul,he]) + +def inclusion (M : ModuleCat.{u} A) : fixed β e hc M →ₗ[B] restricted β M := + (fixed β e hc M).subtype + +theorem projection_inclusion (M : ModuleCat.{u} A) : + (projection β e he hc M).comp (inclusion β e hc M) = LinearMap.id := by + apply LinearMap.ext + intro m + apply Subtype.ext + exact (mem_fixed β e hc M m.val).1 m.property + +/-- Module maps restrict to the actual vertex fixed submodules. -/ +def map {M N : ModuleCat.{u} A} (f : M ⟶ N) : + fixed β e hc M →ₗ[B] fixed β e hc N where + toFun m := ⟨f.hom m.val,by + apply (mem_fixed β e hc N _).2 + have hm := (mem_fixed β e hc M m.val).1 m.property + exact (f.hom.map_smul e (m.val : M)).symm.trans (congrArg f.hom hm)⟩ + map_add' x y := Subtype.ext (map_add _ _ _) + map_smul' b x := by + apply Subtype.ext + change f.hom (β b • (x.val : M)) = β b • f.hom x.val + exact f.hom.map_smul _ _ + +/-- The actual vertex-component functor; it retains the original right action. -/ +def functor : ModuleCat.{u} A ⥤ ModuleCat.{u} B where + obj M := ModuleCat.of B (fixed β e hc M) + map f := ModuleCat.ofHom (map β e hc f) + map_id M := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro m + rfl + map_comp f g := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro m + rfl + +instance additive : (functor β e hc).Additive where + map_add := by + intros + apply ModuleCat.hom_ext + apply LinearMap.ext + intro m + rfl + +include he in +/-- Vertex components of right-projective modules are right-projective. -/ +theorem projective (M : ModuleCat.{u} A) [Module.Projective B (restricted β M)] : + Module.Projective B (fixed β e hc M) := by + exact Module.Projective.of_split (inclusion β e hc M) (projection β e he hc M) + (projection_inclusion β e he hc M) + +include he in +/-- Applying a vertex component preserves actual short exact sequences. -/ +theorem map_shortExact (S : ShortComplex (ModuleCat.{u} A)) (hS : S.ShortExact) : + (S.map (functor β e hc)).ShortExact := by + apply ModuleCat.shortComplex_shortExact + · intro x + constructor + · intro hx + have hx' : S.g.hom x.val = 0 := congrArg Subtype.val hx + obtain ⟨y,hy⟩ := (ShortComplex.moduleCat_exact_iff S).1 hS.exact x.val hx' + refine ⟨projection β e he hc S.X₁ y,?_⟩ + apply Subtype.ext + change S.f.hom (e • y) = x.val + rw [S.f.hom.map_smul,hy] + exact (mem_fixed β e hc S.X₂ x.val).1 x.property + · rintro ⟨y,rfl⟩ + apply Subtype.ext + exact S.moduleCat_zero_apply y.val + · intro x y h + apply Subtype.ext + apply hS.moduleCat_injective_f + exact congrArg Subtype.val h + · intro z + obtain ⟨y,hy⟩ := hS.moduleCat_surjective_g z.val + refine ⟨projection β e he hc S.X₂ y,?_⟩ + apply Subtype.ext + change S.g.hom (e • y) = z.val + rw [S.g.hom.map_smul,hy] + exact (mem_fixed β e hc S.X₃ z.val).1 z.property +end LittleFinitistic.VertexFunctor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/VertexHomology.lean b/lean/OAI/Algebra/Finitistic/Rectification/VertexHomology.lean new file mode 100644 index 0000000000000000000000000000000000000000..b3be332dd6274974f66f85aed12dcb45c7136e07 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/VertexHomology.lean @@ -0,0 +1,49 @@ +import Mathlib.Algebra.Homology.ShortComplex.HomologicalComplex +import Mathlib.Algebra.Homology.HomologicalComplexAbelian +import OAI.Algebra.Finitistic.Rectification.VertexFunctor +import Mathlib.Algebra.Homology.ShortComplex.ExactFunctor + +namespace OAI +noncomputable section +open CategoryTheory HomologicalComplex +namespace LittleFinitistic.VertexHomology +universe u +variable {A B : Type u} [Ring A] [Ring B] +variable (β : B →+* A) (e : A) (he : e*e=e) (hc : ∀ b, e*β b=β b*e) + +include he + +/-- Actual vertex projection preserves homology, because it preserves the +short exact sequences already proved in VertexFunctor. -/ +theorem preservesHomology : (VertexFunctor.functor β e hc).PreservesHomology := + ((Functor.exact_tfae (VertexFunctor.functor β e hc)).out 1 3).1 + (VertexFunctor.map_shortExact β e he hc) + +/-- Homology of the actual vertex complex is the actual vertex of module homology. -/ +def iso (X : CochainComplex (ModuleCat.{u} A) ℤ) (n : ℤ) : + (((VertexFunctor.functor β e hc).mapHomologicalComplex (.up ℤ)).obj X).homology n ≅ + (VertexFunctor.functor β e hc).obj (X.homology n) := by + letI := preservesHomology β e he hc + exact (X.sc n).mapHomologyIso (VertexFunctor.functor β e hc) + +/-- This comparison respects every natural transformation of the vertex functors, +so it retains the algebra arrow actions as well as the vertex vector spaces. -/ +theorem natural (e' : A) (he' : e'*e'=e') (hc' : ∀ b, e'*β b=β b*e') + (τ : VertexFunctor.functor β e hc ⟶ VertexFunctor.functor β e' hc') + (X : CochainComplex (ModuleCat.{u} A) ℤ) (n : ℤ) : + homologyMap ((NatTrans.mapHomologicalComplex τ (.up ℤ)).app X) n ≫ + (iso β e' he' hc' X n).hom = + (iso β e he hc X n).hom ≫ τ.app (X.homology n) := by + let := preservesHomology β e he hc + let := preservesHomology β e' he' hc' + have h := ShortComplex.homologyMap_mapNatTrans (X.sc n) τ + change homologyMap ((NatTrans.mapHomologicalComplex τ (.up ℤ)).app X) n = + (iso β e he hc X n).hom ≫ τ.app (X.homology n) ≫ + (iso β e' he' hc' X n).inv at h + rw [h] + simp +end LittleFinitistic.VertexHomology + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/VertexHomotopyEquivalence.lean b/lean/OAI/Algebra/Finitistic/Rectification/VertexHomotopyEquivalence.lean new file mode 100644 index 0000000000000000000000000000000000000000..b8115fa29a308cfa879c43a5d0c2b9e16c4115cd --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/VertexHomotopyEquivalence.lean @@ -0,0 +1,81 @@ +import OAI.Algebra.Finitistic.Rectification.ThirdVertex +import OAI.Algebra.Finitistic.Rectification.VertexTotalProperties + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits HomologicalComplex +namespace LittleFinitistic.VertexHomotopyEquivalence +open ExternalTensor.Section4 +universe u +variable {k : Type u} [Field k] {d t : ℕ} (P : QuadraticEncoding.Relations k d t) +variable (D₀ D₁ D₂ : RightComplex (QuadraticEncoding.B P)) +variable (f : Fin (d+1) → (D₀ ⟶ D₁)) (g : Fin (d+1) → (D₁ ⟶ D₂)) +variable (H : ∀ r, Homotopy (relationMap (ConcreteQuadraticDiagram.quadratic P) D₀ D₁ D₂ f g r) 0) + +abbrev source (v : Fin 3) : RightComplex (QuadraticEncoding.B P) := + Fin.cases D₀ (Fin.cases D₁ (fun _ => D₂)) v +abbrev target (v : Fin 3) : RightComplex (QuadraticEncoding.B P) := + (AdjacentArrowSum.vertexComplex (QuadraticEncoding.composition P) v).obj + (InducedRectification.total (ConcreteQuadraticDiagram.quadratic P) D₀ D₁ D₂ f g H) + +def iota (v : Fin 3) : source P D₀ D₁ D₂ v ⟶ target P D₀ D₁ D₂ f g H v := by + refine Fin.cases (FirstVertex.iota P D₀ D₁ D₂ f g H) + (Fin.cases (SecondVertex.iota P D₀ D₁ D₂ f g H) ?_) v + intro j + have hj : j = 0 := Subsingleton.elim _ _ + subst j + exact ThirdVertex.iota P D₀ D₁ D₂ f g H + +/-- All three original vertex insertions are quasi-isomorphisms. -/ +theorem iota_quasiIso (v : Fin 3) : QuasiIso (iota P D₀ D₁ D₂ f g H v) := by + fin_cases v + · let := FirstVertex.iota_isIso P D₀ D₁ D₂ f g H + change QuasiIso (FirstVertex.iota P D₀ D₁ D₂ f g H) + infer_instance + · exact SecondVertex.iota_quasiIso P D₀ D₁ D₂ f g H + · exact ThirdVertex.iota_quasiIso P D₀ D₁ D₂ f g H + +/-- The actual vertex insertions have chain-map inverses and both homotopies. +Only the boundedness and projectivity of the chosen chain representatives are inputs. -/ +theorem homotopy_inverse (v : Fin 3) (lo hi : ℤ) + (b₀ : ∀ n, n < lo ∨ hi < n → IsZero (D₀.X n)) + (b₁ : ∀ n, n < lo ∨ hi < n → IsZero (D₁.X n)) + (b₂ : ∀ n, n < lo ∨ hi < n → IsZero (D₂.X n)) + (p₀ : ∀ n, Module.Projective (QuadraticEncoding.B P)ᵐᵒᵖ (D₀.X n)) + (p₁ : ∀ n, Module.Projective (QuadraticEncoding.B P)ᵐᵒᵖ (D₁.X n)) + (p₂ : ∀ n, Module.Projective (QuadraticEncoding.B P)ᵐᵒᵖ (D₂.X n)) : + ∃ j : target P D₀ D₁ D₂ f g H v ⟶ source P D₀ D₁ D₂ v, + Nonempty (Homotopy (iota P D₀ D₁ D₂ f g H v ≫ j) (𝟙 _)) ∧ + Nonempty (Homotopy (j ≫ iota P D₀ D₁ D₂ f g H v) (𝟙 _)) := by + have : (source P D₀ D₁ D₂ v).IsStrictlyLE hi := by + rw [CochainComplex.isStrictlyLE_iff] + intro n hn + fin_cases v + · exact b₀ n (Or.inr hn) + · exact b₁ n (Or.inr hn) + · exact b₂ n (Or.inr hn) + have : (target P D₀ D₁ D₂ f g H v).IsStrictlyLE hi := by + rw [CochainComplex.isStrictlyLE_iff] + intro n hn + exact VertexTotalProperties.total_bounded P D₀ D₁ D₂ f g H v lo hi b₀ b₁ b₂ n (Or.inr hn) + have (n : ℤ) : Projective ((source P D₀ D₁ D₂ v).X n) := by + fin_cases v + · change Projective (D₀.X n) + let := p₀ n + exact ModuleCat.projective_of_categoryTheory_projective (D₀.X n) + · change Projective (D₁.X n) + let := p₁ n + exact ModuleCat.projective_of_categoryTheory_projective (D₁.X n) + · change Projective (D₂.X n) + let := p₂ n + exact ModuleCat.projective_of_categoryTheory_projective (D₂.X n) + have (n : ℤ) : Projective ((target P D₀ D₁ D₂ f g H v).X n) := + VertexTotalProperties.total_projective P D₀ D₁ D₂ f g H v p₀ p₁ p₂ n + let := iota_quasiIso P D₀ D₁ D₂ f g H v + exact RectificationAcyclic.bounded_projective_homotopy_inverse + (iota P D₀ D₁ D₂ f g H v) hi +end LittleFinitistic.VertexHomotopyEquivalence + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/VertexModuleAssembly.lean b/lean/OAI/Algebra/Finitistic/Rectification/VertexModuleAssembly.lean new file mode 100644 index 0000000000000000000000000000000000000000..df6f23c79ffba811951ff2b74b711c7cff2877d3 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/VertexModuleAssembly.lean @@ -0,0 +1,72 @@ +import OAI.Algebra.Finitistic.Rectification.VertexDecomposition +import Mathlib.LinearAlgebra.Pi + +namespace OAI +noncomputable section +namespace LittleFinitistic.VertexModuleAssembly +open VertexDecomposition +universe u v w +variable {k A : Type u} [Field k] [Ring A] [Algebra k A] {n : ℕ} +variable (D : DirectedBound.DirectedSystem k A n) +variable {M : Type v} {N : Type w} [AddCommGroup M] [AddCommGroup N] + [Module k M] [Module k N] [Module A M] [Module A N] + [IsScalarTower k A M] [IsScalarTower k A N] +variable (E : ∀ i, Space D M i ≃ₗ[k] Space D N i) + +/-- Assemble specified vertex isomorphisms into a vector-space isomorphism. -/ +def assembled : M ≃ₗ[k] N := + (equiv D M).trans ((LinearEquiv.piCongrRight E).trans (equiv D N).symm) + +lemma project_assembled (i : Fin n) (x : M) : + project D N i (assembled D E x) = E i (project D M i x) := by + exact congrFun ((equiv D N).apply_symm_apply + ((LinearEquiv.piCongrRight E) (equiv D M x))) i + +lemma assembled_vertex (i : Fin n) (x : Space D M i) : + assembled D E x.val = (E i x).val := by + apply (equiv D N).injective + funext j + rw [equiv_apply, project_assembled, equiv_apply] + by_cases h : j = i + · subst j + rw [project_self, project_self] + · rw [project_other D M j i h, project_other D N j i h, map_zero] + +/-- The assembled map commutes with every vertex idempotent. -/ +theorem vertex_smul (i : Fin n) (x : M) : + assembled D E (D.e i • x) = D.e i • assembled D E x := by + have h := assembled_vertex D E i (project D M i x) + have hp := congrArg Subtype.val (project_assembled D E i x) + exact h.trans hp.symm + +/-- A supported arrow acts between its actual source and target subspaces. -/ +def arrow {i j : Fin n} (a : A) (ha : D.e j * a = a) : + Space D M i →ₗ[k] Space D M j where + toFun x := ⟨a • x.val, by + change D.e j • (a • x.val) = a • x.val + rw [← mul_smul, ha]⟩ + map_add' x y := Subtype.ext (smul_add _ _ _) + map_smul' c x := Subtype.ext (smul_comm _ _ _) + +/-- Vertexwise compatibility with an actual arrow gives compatibility of the +assembled map on every element of the full module. -/ +theorem arrow_smul {i j : Fin n} (a : A) (hl : D.e j * a = a) (hr : a * D.e i = a) + (hE : ∀ x : Space D M i, E j (arrow D a hl x) = arrow D a hl (E i x)) + (x : M) : assembled D E (a • x) = a • assembled D E x := by + have hax : a • (project D M i x).val = a • x := by + change a • (D.e i • x) = a • x + rw [← mul_smul, hr] + have h := assembled_vertex D E j (arrow D a hl (project D M i x)) + change assembled D E (a • (project D M i x).val) = + (E j (arrow D a hl (project D M i x))).val at h + rw [hax, hE] at h + have hp := congrArg Subtype.val (project_assembled D E i x) + change D.e i • assembled D E x = (E i (project D M i x)).val at hp + change assembled D E (a • x) = a • (E i (project D M i x)).val at h + rw [← hp, ← mul_smul, hr] at h + exact h +end LittleFinitistic.VertexModuleAssembly + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/VertexProjectives.lean b/lean/OAI/Algebra/Finitistic/Rectification/VertexProjectives.lean new file mode 100644 index 0000000000000000000000000000000000000000..06c99475ae6948195716841f9d2ebd4b0c1ca9ef --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/VertexProjectives.lean @@ -0,0 +1,63 @@ +import OAI.Algebra.Finitistic.Localization.ProjectiveComplexes + +namespace OAI +noncomputable section +open CategoryTheory Limits +namespace LittleFinitistic.VertexProjectives +universe u +variable {B : Type u} [Ring B] + +/-- eB, represented in the opposite regular module to encode right linearity. -/ +def ideal (e : B) : Submodule Bᵐᵒᵖ Bᵐᵒᵖ := + (LinearMap.mulRight Bᵐᵒᵖ (MulOpposite.op e)).range + +theorem fixed (e : B) (he : e * e = e) (x : ideal e) : + x.val * MulOpposite.op e = x.val := by + obtain ⟨y,hy⟩ := x.property + change y * MulOpposite.op e = x.val at hy + rw [← hy, mul_assoc, ← MulOpposite.op_mul, he] + +instance finite (e : B) : Module.Finite Bᵐᵒᵖ (ideal e) := + inferInstanceAs (Module.Finite Bᵐᵒᵖ (LinearMap.mulRight Bᵐᵒᵖ (MulOpposite.op e)).range) + +theorem projective (e : B) (he : e * e = e) : Module.Projective Bᵐᵒᵖ (ideal e) := by + apply Module.Projective.of_split (ideal e).subtype + (LinearMap.mulRight Bᵐᵒᵖ (MulOpposite.op e)).rangeRestrict + ext x + exact fixed e he x + +/-- The actual finitely generated projective right module eB. -/ +def object (e : B) (he : e * e = e) : ProjectiveComplexes.Proj B := + ⟨ModuleCat.of Bᵐᵒᵖ (ideal e), finite e, projective e he⟩ + +/-- Left multiplication by an arrow a with target idempotent e'. -/ +def arrow {e e' : B} (he : e * e = e) (he' : e' * e' = e') + (a : B) (ha : e' * a = a) : object e he ⟶ object e' he' := + ObjectProperty.homMk (ModuleCat.ofHom + (((LinearMap.mulRight Bᵐᵒᵖ (MulOpposite.op a)).comp (ideal e).subtype).codRestrict + (ideal e') (fun x => ⟨x.val * MulOpposite.op a, by + change (x.val * MulOpposite.op a) * MulOpposite.op e' = x.val * MulOpposite.op a + rw [mul_assoc, ← MulOpposite.op_mul, ha]⟩))) + +@[simp] theorem arrow_apply {e e' : B} (he : e * e = e) (he' : e' * e' = e') + (a : B) (ha : e' * a = a) (x : ideal e) : + ((arrow he he' a ha).hom.hom x).val = x.val * MulOpposite.op a := rfl + +theorem arrow_comp {e₀ e₁ e₂ : B} + (h₀ : e₀*e₀=e₀) (h₁ : e₁*e₁=e₁) (h₂ : e₂*e₂=e₂) + (a b : B) (ha : e₁*a=a) (hb : e₂*b=b) : + arrow h₀ h₁ a ha ≫ arrow h₁ h₂ b hb = + arrow h₀ h₂ (b*a) (by rw [← mul_assoc, hb]) := by + apply ObjectProperty.hom_ext + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + apply Subtype.ext + change (x.val * MulOpposite.op a) * MulOpposite.op b = x.val * MulOpposite.op (b*a) + simp only [MulOpposite.op_mul, mul_assoc] + +end LittleFinitistic.VertexProjectives + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/VertexTensorEvaluation.lean b/lean/OAI/Algebra/Finitistic/Rectification/VertexTensorEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..67ea129cfd83c64b373555940f1e3cb254af00ac --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/VertexTensorEvaluation.lean @@ -0,0 +1,88 @@ +import OAI.Algebra.Finitistic.Localization.EvaluationModule +import OAI.Algebra.Finitistic.Tensor.IdempotentTensorMaps + +namespace OAI +noncomputable section +namespace LittleFinitistic.QuadraticEncoding.Representation +open IdempotentTensor BalancedTensor +universe u v +variable {k : Type u} [Field k] {d t : ℕ} {P : Relations k d t} +variable {Y : Type v} [AddCommGroup Y] [Module k Y] +variable (X : Representation P Y) + +abbrev vertexId (i : Fin 3) : B P := ThreeVertexAlgebra.vertex (composition P) i + +/-- Identify the actual fixed-point vertex part of M(Y) with Y. -/ +def vertexFixedEquiv (i : Fin 3) : leftSpace (k := k) (vertexId (P := P) i) X.Evaluation ≃ₗ[k] Y where + __ := (X.projection i).comp (leftSpace (k := k) (vertexId (P := P) i) X.Evaluation).subtype + invFun y := ⟨X.inclusion i y, by + change vertexId (P := P) i • X.inclusion i y = X.inclusion i y + rw [X.vertex_smul, X.projection_inclusion]⟩ + left_inv m := by + apply Subtype.ext + exact (X.vertex_smul i m.val).symm.trans m.property + right_inv y := X.projection_inclusion i y + +/-- The manuscript's E_i tensor_B M(Y) ≃ Y, for the actual right ideal E_i=e_iB. -/ +def vertexTensorEquiv (i : Fin 3) : + Tensor k (B P) (rightIdeal (vertexId (P := P) i)) X.Evaluation ≃ₗ[k] Y := + (tensorEquiv (k := k) (vertexId (P := P) i) X.Evaluation + ((ThreeVertexAlgebra.directedSystem (composition P)).idem i)).trans (X.vertexFixedEquiv i) + +@[simp] theorem vertexTensorEquiv_mk (i : Fin 3) + (m : rightIdeal (vertexId (P := P) i)) (y : X.Evaluation) : + X.vertexTensorEquiv i (BalancedTensor.mk k (B P) (rightIdeal (vertexId (P := P) i)) X.Evaluation m y) = + X.projection i (m.val • y) := rfl + +@[simp] theorem vertexTensorEquiv_symm (i : Fin 3) (y : Y) : + (X.vertexTensorEquiv i).symm y = + BalancedTensor.mk k (B P) (rightIdeal (vertexId (P := P) i)) X.Evaluation + ⟨vertexId (P := P) i,(ThreeVertexAlgebra.directedSystem (composition P)).idem i⟩ + (X.inclusion i y) := rfl + +/-- Under the natural tensor identifications, an arrow map evaluates to its module action. -/ +theorem tensor_leftMultiply (i j : Fin 3) (b : B P) + (ht : vertexId (P := P) j*b=b) (hs : b*vertexId (P := P) i=b) (y : Y) : + X.vertexTensorEquiv j + (mapLeft (k := k) X.Evaluation (leftMultiply (e := vertexId (P := P) i) b ht) + ((X.vertexTensorEquiv i).symm y)) = X.projection j (b • X.inclusion i y) := by + rw [vertexTensorEquiv_symm, mapLeft_mk, vertexTensorEquiv_mk] + simp only [leftMultiply_apply, hs] + +lemma arrow01_target (h : Fin (d+1)) : vertexId (P := P) 1 * arrow01 P h = arrow01 P h := by + change ThreeVertexAlgebra.mul (composition P) _ _ = _ + simp [vertexId,ThreeVertexAlgebra.vertex,ThreeVertexAlgebra.mul,arrow01] +lemma arrow01_source (h : Fin (d+1)) : arrow01 P h * vertexId (P := P) 0 = arrow01 P h := by + change ThreeVertexAlgebra.mul (composition P) _ _ = _ + simp [vertexId,ThreeVertexAlgebra.vertex,ThreeVertexAlgebra.mul,arrow01] +lemma arrow12_target (h : Fin (d+1)) : vertexId (P := P) 2 * arrow12 P h = arrow12 P h := by + change ThreeVertexAlgebra.mul (composition P) _ _ = _ + simp [vertexId,ThreeVertexAlgebra.vertex,ThreeVertexAlgebra.mul,arrow12] +lemma arrow12_source (h : Fin (d+1)) : arrow12 P h * vertexId (P := P) 1 = arrow12 P h := by + change ThreeVertexAlgebra.mul (composition P) _ _ = _ + simp [vertexId,ThreeVertexAlgebra.vertex,ThreeVertexAlgebra.mul,arrow12] + +theorem tensor_arrow01 (h : Fin (d+1)) (y : Y) : + X.vertexTensorEquiv 1 + (mapLeft (k := k) X.Evaluation + (leftMultiply (e := vertexId (P := P) 0) (arrow01 P h) (arrow01_target h)) + ((X.vertexTensorEquiv 0).symm y)) = + (Fin.cases (motive := fun _ => Module.End k Y) 1 X.generator h) y := by + rw [tensor_leftMultiply X 0 1 _ _ (arrow01_source h)] + erw [X.arrow01_smul] + rfl + +theorem tensor_arrow12 (h : Fin (d+1)) (y : Y) : + X.vertexTensorEquiv 2 + (mapLeft (k := k) X.Evaluation + (leftMultiply (e := vertexId (P := P) 1) (arrow12 P h) (arrow12_target h)) + ((X.vertexTensorEquiv 1).symm y)) = + (Fin.cases (motive := fun _ => Module.End k Y) 1 X.generator h) y := by + rw [tensor_leftMultiply X 1 2 _ _ (arrow12_source h)] + erw [X.arrow12_smul] + rfl +end LittleFinitistic.QuadraticEncoding.Representation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/VertexTensorLinear.lean b/lean/OAI/Algebra/Finitistic/Rectification/VertexTensorLinear.lean new file mode 100644 index 0000000000000000000000000000000000000000..ea545ea732895833b6efbe97c97c2c65ffc2469b --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/VertexTensorLinear.lean @@ -0,0 +1,49 @@ +import OAI.Algebra.Finitistic.Rectification.CornerPathTransport + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct ModuleCat.Algebra +namespace LittleFinitistic.BimoduleVertex +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] + +instance linear (e : B) : (functor k B e).Linear k where + map_smul := by + intro M N f c + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + apply Subtype.ext + change algebraMap k (B ⊗[k] Bᵐᵒᵖ) c • (f.hom x.val) = + restriction k B (algebraMap k Bᵐᵒᵖ c) • (f.hom x.val) + rw [show restriction k B (algebraMap k Bᵐᵒᵖ c) = + algebraMap k (B ⊗[k] Bᵐᵒᵖ) c from + (Algebra.TensorProduct.includeRight : Bᵐᵒᵖ →ₐ[k] B ⊗[k] Bᵐᵒᵖ).commutes c] +end LittleFinitistic.BimoduleVertex + +namespace LittleFinitistic.TensorComplex +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] +variable (D : CochainComplex (ModuleCat.{u} Bᵐᵒᵖ) ℤ) +instance linear : (tensorFunctor (k := k) D).Linear k where + map_smul := by + intro M N f c + apply HomologicalComplex.Hom.ext + funext n + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + induction x using TensorProduct.inductionOn with + | tmul m y => + change (c • f.hom m) ⊗ₜ[k] y = f.hom m ⊗ₜ[k] + ((algebraMap k Bᵐᵒᵖ c) • (y : D.X n)) + exact TensorProduct.smul_tmul (R := k) c (f.hom m) (y : ScalarModule k B (D.X n)) + | add x y hx hy => + exact (map_add _ _ _).trans + ((congrArg₂ (· + ·) hx hy).trans (map_add _ _ _).symm) +end LittleFinitistic.TensorComplex + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/VertexTotalProperties.lean b/lean/OAI/Algebra/Finitistic/Rectification/VertexTotalProperties.lean new file mode 100644 index 0000000000000000000000000000000000000000..b0a46a83ddfea0a26db2c213dc02ae450880dce3 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/VertexTotalProperties.lean @@ -0,0 +1,59 @@ +import OAI.Algebra.Finitistic.Rectification.SecondVertex + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits HomologicalComplex +namespace LittleFinitistic.VertexTotalProperties +open ExternalTensor.Section4 +universe u +variable {k B : Type u} [Field k] [Ring B] [Algebra k B] + +/-- The actual vertex of a right-projective bimodule remains right-projective. -/ +theorem projective (e : B) (he : e*e=e) (M : ModuleCat.{u} (Enveloping k B)) + (hM : Projective ((forgetRight k B).obj M)) : + Projective ((BimoduleVertex.functor k B e).obj M) := by + let := hM + have : Module.Projective Bᵐᵒᵖ (VertexFunctor.restricted (BimoduleVertex.restriction k B) M) := + inferInstanceAs (Module.Projective Bᵐᵒᵖ ((forgetRight k B).obj M)) + have := VertexFunctor.projective (BimoduleVertex.restriction k B) (BimoduleVertex.vertex k B e) + (BimoduleVertex.vertex_idempotent k B e he) (BimoduleVertex.vertex_commute k B e) M + change Projective (ModuleCat.of Bᵐᵒᵖ + (VertexFunctor.fixed (BimoduleVertex.restriction k B) (BimoduleVertex.vertex k B e) + (BimoduleVertex.vertex_commute k B e) M)) + exact ModuleCat.projective_of_categoryTheory_projective (R := Bᵐᵒᵖ) _ + +variable {d t : ℕ} (P : QuadraticEncoding.Relations k d t) +variable (D₀ D₁ D₂ : RightComplex (QuadraticEncoding.B P)) +variable (f : Fin (d+1) → (D₀ ⟶ D₁)) (g : Fin (d+1) → (D₁ ⟶ D₂)) +variable (H : ∀ r, Homotopy + (relationMap (ConcreteQuadraticDiagram.quadratic P) D₀ D₁ D₂ f g r) 0) + +/-- Every actual vertex of the constructed total has projective right-module terms. -/ +theorem total_projective (v : Fin 3) + (h₀ : ∀ n, Module.Projective (QuadraticEncoding.B P)ᵐᵒᵖ (D₀.X n)) + (h₁ : ∀ n, Module.Projective (QuadraticEncoding.B P)ᵐᵒᵖ (D₁.X n)) + (h₂ : ∀ n, Module.Projective (QuadraticEncoding.B P)ᵐᵒᵖ (D₂.X n)) (n : ℤ) : + Projective (((AdjacentArrowSum.vertexComplex (QuadraticEncoding.composition P) v).obj + (InducedRectification.total (ConcreteQuadraticDiagram.quadratic P) D₀ D₁ D₂ f g H)).X n) := + projective (ThreeVertexAlgebra.vertex (QuadraticEncoding.composition P) v) + ((ThreeVertexAlgebra.directedSystem (QuadraticEncoding.composition P)).idem v) _ + (InducedRectification.rightTotal_projective (ConcreteQuadraticDiagram.quadratic P) + D₀ D₁ D₂ f g H h₀ h₁ h₂ n) + +theorem total_bounded (v : Fin 3) (lo hi : ℤ) + (h₀ : ∀ n, n < lo ∨ hi < n → IsZero (D₀.X n)) + (h₁ : ∀ n, n < lo ∨ hi < n → IsZero (D₁.X n)) + (h₂ : ∀ n, n < lo ∨ hi < n → IsZero (D₂.X n)) : + ∀ n, n < lo-2 ∨ hi < n → IsZero + (((AdjacentArrowSum.vertexComplex (QuadraticEncoding.composition P) v).obj + (InducedRectification.total (ConcreteQuadraticDiagram.quadratic P) D₀ D₁ D₂ f g H)).X n) := by + intro n hn + exact (BimoduleVertex.functor k (QuadraticEncoding.B P) + (ThreeVertexAlgebra.vertex (QuadraticEncoding.composition P) v)).map_isZero + (InducedRectification.total_bounded (ConcreteQuadraticDiagram.quadratic P) + D₀ D₁ D₂ f g H lo hi h₀ h₁ h₂ n hn) +end LittleFinitistic.VertexTotalProperties + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/VertexZeroTotal.lean b/lean/OAI/Algebra/Finitistic/Rectification/VertexZeroTotal.lean new file mode 100644 index 0000000000000000000000000000000000000000..684b0953107999a61146cc50cdcf6130a5aa46e5 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/VertexZeroTotal.lean @@ -0,0 +1,62 @@ +import OAI.Algebra.Finitistic.Rectification.VertexColumnComplex +import OAI.Algebra.Finitistic.Rectification.ZeroColumnTotal +import OAI.Algebra.Finitistic.Rectification.InducedRectification +import OAI.Algebra.Finitistic.Localization.ConcreteQuadraticDiagram + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits HomologicalComplex +open scoped TensorProduct ModuleCat.Algebra +namespace LittleFinitistic.VertexZeroTotal +open ExternalTensor.Section4 +universe u +variable {k : Type u} [Field k] {d t : ℕ} (P : QuadraticEncoding.Relations k d t) +local notation "B" => QuadraticEncoding.B P +local notation "s" => ConcreteQuadraticDiagram.quadratic P +abbrev vertexFunctor := BimoduleVertex.functor k (QuadraticEncoding.B P) + (ThreeVertexAlgebra.vertex (QuadraticEncoding.composition P) 0) + +/-- Actual column terms vanish at vertex zero when their supporting vertex is positive. -/ +theorem column_zero (j : Fin 3) (hj : 0 < j) (D : RightComplex (QuadraticEncoding.B P)) (n : ℤ) : + IsZero ((vertexFunctor P).obj + (((columnComplex k B (ThreeVertexAlgebra.vertex (QuadraticEncoding.composition P) j)).obj D).X n)) := by + exact (HomologicalComplex.eval _ _ n).map_isZero + (VertexColumnComplex.reverse_isZero (QuadraticEncoding.composition P) 0 j hj D) + +variable (D₀ D₁ D₂ : RightComplex (QuadraticEncoding.B P)) +variable (f : Fin (d+1) → (D₀ ⟶ D₁)) (g : Fin (d+1) → (D₁ ⟶ D₂)) + +/-- Both higher columns of the constructed total vanish at the first vertex. -/ +theorem higher_zero (n : ℤ) : + IsZero ((vertexFunctor P).obj ((L1Prime s D₀ D₁ D₂ f g).X n)) ∧ + IsZero ((vertexFunctor P).obj ((L2Prime s D₀ D₁ D₂ f g).X n)) := by + let G := HomologicalComplex.eval (ModuleCat.{u} (Enveloping k B)) (.up ℤ) n ⋙ vertexFunctor P + let := preservesBinaryBiproducts_of_preservesBiproducts G + constructor + · change IsZero (G.obj ((⨁ fun _ : Fin (d+1) => + (columnComplex k B (s).e₁).obj D₀) ⊞ (⨁ fun _ : Fin (d+1) => + (columnComplex k B (s).e₂).obj D₁))) + apply (G.mapBiprod _ _).isZero_iff.mpr + rw [biprod_isZero_iff] + constructor + · apply (G.mapBiproduct _).isZero_iff.mpr + exact sum_isZero _ (fun _ => column_zero P 1 (by decide) D₀ n) + · apply (G.mapBiproduct _).isZero_iff.mpr + exact sum_isZero _ (fun _ => column_zero P 2 (by decide) D₁ n) + · change IsZero (G.obj (⨁ fun _ : RelationBasisCoefficients.RelationIndex P => + (columnComplex k B (s).e₂).obj D₀)) + apply (G.mapBiproduct _).isZero_iff.mpr + exact sum_isZero _ (fun _ => column_zero P 2 (by decide) D₀ n) + +/-- At vertex zero, the original zero-column inclusion in the actual total is an isomorphism. -/ +theorem inclusion_isIso (H : ∀ r, Homotopy (relationMap s D₀ D₁ D₂ f g r) 0) : + IsIso (((vertexFunctor P).mapHomologicalComplex (.up ℤ)).map + (InducedRectification.inclusion s D₀ D₁ D₂ f g H)) := + ZeroColumnTotal.mapped_inclusion_isIso _ _ _ (vertexFunctor P) + (fun n => (higher_zero P D₀ D₁ D₂ f g n).1) + (fun n => (higher_zero P D₀ D₁ D₂ f g n).2) +end LittleFinitistic.VertexZeroTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/ZeroColumnTotal.lean b/lean/OAI/Algebra/Finitistic/Rectification/ZeroColumnTotal.lean new file mode 100644 index 0000000000000000000000000000000000000000..b41d5c21c802278c69fe37bb11225a47b5a77f10 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/ZeroColumnTotal.lean @@ -0,0 +1,67 @@ +import OAI.Algebra.Finitistic.Rectification.RectificationTotal + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits CochainComplex HomologicalComplex +namespace LittleFinitistic.ZeroColumnTotal +variable {C D : Type*} [Category C] [Category D] [Preadditive C] [Preadditive D] + [HasBinaryBiproducts C] [HasBinaryBiproducts D] + +def biprodInrIso {X Y : D} (hX : IsZero X) : Y ≅ X ⊞ Y where + hom := biprod.inr + inv := biprod.snd + hom_inv_id := by simp + inv_hom_id := by + apply biprod.hom_ext + · exact hX.eq_of_tgt _ _ + · simp + +omit [HasBinaryBiproducts D] in +theorem complex_zero {X : CochainComplex D ℤ} (hX : ∀ i, IsZero (X.X i)) : IsZero X := by + apply (IsZero.iff_id_eq_zero _).2 + apply HomologicalComplex.Hom.ext + funext i + exact (hX i).eq_of_src _ _ + +/-- If the cone source is zero, its original inclusion is an isomorphism. -/ +theorem cone_inr_isIso {X Y : CochainComplex D ℤ} (f : X ⟶ Y) (hX : IsZero X) : + IsIso (mappingCone.inr f) := by + have hi : ∀ i, IsIso ((mappingCone.inr f).f i) := by + intro i + let e : (mappingCone f).X i ≅ X.X (i+1) ⊞ Y.X i := + homotopyCofiber.XIsoBiprod f i (i+1) (by simp) + rw [← isIso_comp_right_iff ((mappingCone.inr f).f i) e.hom] + have he : (mappingCone.inr f).f i ≫ e.hom = biprod.inr := + homotopyCofiber.inrX_XIsoBiprod_hom f (i+1) i (by simp) + rw [he] + exact (biprodInrIso ((HomologicalComplex.eval D (.up ℤ) (i+1)).map_isZero hX)).isIso_hom + let := hi + exact HomologicalComplex.Hom.isIso_of_components _ + +/-- A mapped cone whose two columns vanish is actually zero. -/ +theorem mappedCone_zero {X Y : CochainComplex C ℤ} (f : X ⟶ Y) + (F : C ⥤ D) [F.Additive] + (hX : ∀ i, IsZero (F.obj (X.X i))) (hY : ∀ i, IsZero (F.obj (Y.X i))) : + IsZero ((F.mapHomologicalComplex (.up ℤ)).obj (mappingCone f)) := by + apply (mappingCone.mapHomologicalComplexIso f F).isZero_iff.mpr + apply complex_zero + intro i + rw [mappingCone.isZero_X_iff] + exact ⟨hX (i+1),hY i⟩ + +/-- Vanishing higher columns make the original zero-column inclusion an isomorphism. -/ +theorem mapped_inclusion_isIso {L₀ L₁ L₂ : CochainComplex C ℤ} + (p : L₁ ⟶ L₀) (q : L₂ ⟶ L₁) (h : Homotopy (q ≫ p) 0) + (F : C ⥤ D) [F.Additive] + (h₁ : ∀ i, IsZero (F.obj (L₁.X i))) (h₂ : ∀ i, IsZero (F.obj (L₂.X i))) : + IsIso ((F.mapHomologicalComplex (.up ℤ)).map (RectificationTotal.inclusion p q h)) := by + let t := RectificationTotal.rectifyingMap p q h + change IsIso ((F.mapHomologicalComplex (.up ℤ)).map (mappingCone.inr t)) + rw [← isIso_comp_right_iff _ (mappingCone.mapHomologicalComplexIso t F).hom, + mappingCone.map_inr] + exact cone_inr_isIso _ (mappedCone_zero q F h₂ h₁) +end LittleFinitistic.ZeroColumnTotal + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Rectification/ZeroLastColumn.lean b/lean/OAI/Algebra/Finitistic/Rectification/ZeroLastColumn.lean new file mode 100644 index 0000000000000000000000000000000000000000..3fe80cb825d3040c0510d162ba2ef3cc0dd5c2ff --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Rectification/ZeroLastColumn.lean @@ -0,0 +1,47 @@ +import OAI.Algebra.Finitistic.Rectification.TotalFunctorial +import OAI.Algebra.Finitistic.Rectification.ZeroColumnTotal + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits HomologicalComplex CochainComplex +namespace LittleFinitistic.ZeroLastColumn +open RectificationTotal +variable {C D : Type*} [Category C] [Category D] [Preadditive C] [Preadditive D] + [HasBinaryBiproducts C] [HasBinaryBiproducts D] + +def coneIso {X Y X' Y' : CochainComplex D ℤ} (p : X ⟶ Y) (p' : X' ⟶ Y') + (a : X ≅ X') (b : Y ≅ Y') (w : a.hom ≫ p' = p ≫ b.hom) : + mappingCone p ≅ mappingCone p' where + hom := coneMap p p' a.hom b.hom w + inv := coneMap p' p a.inv b.inv (by + apply (cancel_epi a.hom).1 + simp only [← Category.assoc, Iso.hom_inv_id, Category.id_comp] + rw [w, Category.assoc, Iso.hom_inv_id, Category.comp_id]) + hom_inv_id := by rw [← coneMap_comp]; simp + inv_hom_id := by rw [← coneMap_comp]; simp + +variable {L₀ L₁ L₂ : CochainComplex C ℤ} +variable (p : L₁ ⟶ L₀) (q : L₂ ⟶ L₁) (h : Homotopy (q ≫ p) 0) +variable (F : C ⥤ D) [F.Additive] + +/-- Taking an additive image that kills the relation column leaves precisely the ordinary cone. -/ +def mappedTotalIso (h₂ : IsZero ((F.mapHomologicalComplex (.up ℤ)).obj L₂)) : + (F.mapHomologicalComplex (.up ℤ)).obj (total p q h) ≅ + mappingCone ((F.mapHomologicalComplex (.up ℤ)).map p) := by + let G := F.mapHomologicalComplex (.up ℤ) + have hi : IsIso (G.map (mappingCone.inr q)) := by + rw [← isIso_comp_right_iff _ (mappingCone.mapHomologicalComplexIso q F).hom, + mappingCone.map_inr] + exact ZeroColumnTotal.cone_inr_isIso _ h₂ + letI := hi + refine mappingCone.mapHomologicalComplexIso (rectifyingMap p q h) F ≪≫ + (coneIso (G.map p) (G.map (rectifyingMap p q h)) + (asIso (G.map (mappingCone.inr q))) (Iso.refl _) ?_).symm + simp only [asIso_hom,Iso.refl_hom,Category.comp_id,← Functor.map_comp] + congr 1 + simp [rectifyingMap] +end LittleFinitistic.ZeroLastColumn + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedBarBimodule.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedBarBimodule.lean new file mode 100644 index 0000000000000000000000000000000000000000..503b388383e1486ba27b19419b38315c2ce3d68d --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedBarBimodule.lean @@ -0,0 +1,35 @@ +import OAI.Algebra.Finitistic.Selected.SelectedOrdinaryResolution +import OAI.Algebra.Finitistic.Bimodule.BimoduleBarTensorComparison + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.SelectedBarBimodule +open SelectedOrdinaryAlgebra + +/-- The action presentation of X used by the generic native/bar comparison. -/ +abbrev comparisonX := BimoduleBarComparison.Actions ℂ D SelectedOrdinaryResolution.target + +/-- Recover exactly the original right action of the constructed ordinary X. -/ +def rightEquiv : comparisonX ≃ₗ[Dᵐᵒᵖ] X := + RetainedBimodule.rightEquiv ℂ D D X + +/-- The same identification preserves the original outside left D-action. -/ +theorem left_action (d : D) (x : comparisonX) : rightEquiv (d • x) = d • rightEquiv x := + RetainedBimodule.rightEquiv_left ℂ D D X d x + +def leftEquiv : comparisonX ≃ₗ[D] X where + toFun := rightEquiv + invFun := rightEquiv.symm + left_inv := rightEquiv.left_inv + right_inv := rightEquiv.right_inv + map_add' := rightEquiv.map_add + map_smul' := left_action + +theorem right_action (d : Dᵐᵒᵖ) (x : comparisonX) : + leftEquiv (d • x) = d • leftEquiv x := rightEquiv.map_smul d x +end LittleFinitistic.SelectedBarBimodule + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedBarComparison.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedBarComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..c22df3d063410c72b87fbf994e947ae993015d15 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedBarComparison.lean @@ -0,0 +1,51 @@ +import OAI.Algebra.Finitistic.Selected.SelectedBarBimodule +import OAI.Algebra.Finitistic.Bar.BarBimoduleCongruence +import OAI.Algebra.Finitistic.Bimodule.BimoduleResolutionBarAPI +import OAI.Algebra.Finitistic.Selected.SelectedBarStart + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Functor +namespace LittleFinitistic.SelectedBarComparison +open SelectedOrdinaryAlgebra SelectedBarBimodule +local instance : HasDerivedCategory.{1} (ModuleCat.{0} D) := + HasDerivedCategory.standard (ModuleCat.{0} D) + +/-- The actual fixed resolution supplies every generic native/bar premise. -/ +def resolution := BimoduleTotal.ofNonpositiveResolution + SelectedOrdinaryResolution.complex SelectedOrdinaryResolution.target length + SelectedOrdinaryResolution.augmentation SelectedOrdinaryResolution.augmentation_quasiIso + (fun n => SelectedOrdinaryResolution.right_projective n) SelectedOrdinaryResolution.bounded + +/-- The native finite-interval presentation of tensor by the actual Q_X. Its +comparison to the ordinary total presentation is proved separately. -/ +abbrev native := resolution.data.derived + +/-- The native tensor of the actual Q_X agrees naturally with bar-derived + tensor by the ORIGINAL X, with no remaining augmentation or action premise. -/ +def naturalIso : DerivedBar.chainToIntegerDerived D ⋙ native ≅ + DerivedBar.derivedTensor ℂ D X ⋙ DerivedBar.chainToIntegerDerived D := + BimoduleTotal.nonpositiveResolutionBarIso + SelectedOrdinaryResolution.complex SelectedOrdinaryResolution.target length + SelectedOrdinaryResolution.augmentation SelectedOrdinaryResolution.augmentation_quasiIso + (fun n => SelectedOrdinaryResolution.right_projective n) SelectedOrdinaryResolution.bounded ≪≫ + isoWhiskerRight (DerivedBar.BimoduleTensor.derivedTensorCongr ℂ D leftEquiv right_action) + (DerivedBar.chainToIntegerDerived D) + +/-- Every actual native iterate on a stalk is the original-X bar-derived iterate. -/ +def powerIso (N : ModuleCat.{0} D) (r : ℕ) : + (native.obj^[r]) (DerivedCategory.Q.obj (BimoduleTotal.singleInput D N)) ≅ + DerivedBar.IterateSupport.object ℂ D X N r := + BimoduleTotal.nonpositiveResolutionPowerIso + SelectedOrdinaryResolution.complex SelectedOrdinaryResolution.target length + SelectedOrdinaryResolution.augmentation SelectedOrdinaryResolution.augmentation_quasiIso + (fun n => SelectedOrdinaryResolution.right_projective n) SelectedOrdinaryResolution.bounded N r ≪≫ + (DerivedBar.integerDerivedIterateIndexedIso D ℂ comparisonX N r).symm ≪≫ + (DerivedBar.chainToIntegerDerived D).mapIso + ((DerivedBar.BimoduleTensor.derivedIterateCongr ℂ D leftEquiv right_action r).app + ((DerivedBar.chainQ D).obj ((ChainComplex.single₀ (ModuleCat D)).obj N))) +end LittleFinitistic.SelectedBarComparison + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedBarPowers.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedBarPowers.lean new file mode 100644 index 0000000000000000000000000000000000000000..3e9a38e76620b276ca95b4fb5f152cb0bccd24d0 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedBarPowers.lean @@ -0,0 +1,29 @@ +import OAI.Algebra.Finitistic.Selected.SelectedBarComparison + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.SelectedBarPowers +open SelectedOrdinaryAlgebra SelectedBarComparison +local instance : HasDerivedCategory.{1} (ModuleCat.{0} D) := + HasDerivedCategory.standard (ModuleCat.{0} D) + +/-- All powers on the exact selected first-block derived family are the original +bar-derived powers; every resolution, scalar, action and stalk bridge is discharged. -/ +def comparison (Y : FiniteSelectionFamily.S.{0}) (r : ℕ) : + (native.obj^[r]) (SelectedFirstBlockFamily.derived Y) ≅ SelectedBaseIterates.object Y r := + (eqToIso (BimoduleTotal.nativeIterate_obj resolution r (SelectedFirstBlockFamily.derived Y))).symm ≪≫ + (BimoduleTotal.nativeIterate resolution r).mapIso + ((DerivedCategory.singleFunctorIsoCompQ (ModuleCat D) 0).app (SelectedBaseIterates.input Y)) ≪≫ + eqToIso (BimoduleTotal.nativeIterate_obj resolution r + (DerivedCategory.Q.obj (BimoduleTotal.singleInput D (SelectedBaseIterates.input Y)))) ≪≫ + powerIso (SelectedBaseIterates.input Y) r + +theorem isZero_iff (Y : FiniteSelectionFamily.S.{0}) (r : ℕ) : + IsZero ((native.obj^[r]) (SelectedFirstBlockFamily.derived Y)) ↔ + IsZero (SelectedBaseIterates.object Y r) := (comparison Y r).isZero_iff +end LittleFinitistic.SelectedBarPowers + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedBarResolution.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedBarResolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..2afb89ff084ac44d52ff274a75187d3f22f0f7e8 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedBarResolution.lean @@ -0,0 +1,24 @@ +import OAI.Algebra.Finitistic.Selected.SelectedOrdinaryModules +import OAI.Algebra.Finitistic.Bar.FiniteBarResolution + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.SelectedBarResolution +open SelectedOrdinaryAlgebra SelectedOrdinaryModules + +/-- The genuine absolute bar projective resolution of each actual inflated +module. It can have infinitely many nonzero degrees. -/ +def resolution (Y : FiniteSelectionFamily.S.{0}) : ProjectiveResolution (module Y) := + DerivedBar.projectiveResolution ℂ A (Inflated Y) + +theorem finite_free (Y : FiniteSelectionFamily.S.{0}) (n : ℕ) : + Module.Finite A ((resolution Y).complex.X n) ∧ + Module.Free A ((resolution Y).complex.X n) := + ⟨DerivedBar.projectiveResolution_finite ℂ A (Inflated Y) n, + DerivedBar.projectiveResolution_free ℂ A (Inflated Y) n⟩ +end LittleFinitistic.SelectedBarResolution + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedBarStart.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedBarStart.lean new file mode 100644 index 0000000000000000000000000000000000000000..6d357a727d533a6ed9be8ddd35ba941dead1e1dd --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedBarStart.lean @@ -0,0 +1,35 @@ +import OAI.Algebra.Finitistic.Selected.SelectedFirstBlockFamily +import OAI.Algebra.Finitistic.Bar.IntegerStalk + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.SelectedBarStart +open SelectedOrdinaryAlgebra SelectedBaseIterates +local instance : HasDerivedCategory.{1} (ModuleCat.{0} D) := + HasDerivedCategory.standard (ModuleCat.{0} D) + +/-- Bar iteration starts at exactly the same first-block derived stalk as the +ordinary simulation, through the actual extension and localization isomorphisms. -/ +def startIso (Y : FiniteSelectionFamily.S.{0}) : + object Y 0 ≅ SelectedFirstBlockFamily.derived Y := + DerivedBar.IterateSupport.resolvedModelIso ℂ D X (input Y) 0 ≪≫ + DerivedBar.integerStalkIso D (input Y) + +theorem start_zero (Y : FiniteSelectionFamily.S.{0}) : + IsZero (object Y 0) ↔ Subsingleton Y.val := + (startIso Y).isZero_iff.trans (SelectedFirstBlockFamily.derived_zero Y) + +/-- The selected first-block stalk family has the exact original H-extinction. -/ +theorem firstBlock_extinction (m : ℕ) [NeZero m] : + (∀ j < m, ¬ IsZero (SelectedFirstBlockFamily.derived + ((FiniteSelectionFamily.H^[j]) (FiniteSelectionFamily.test m)))) ∧ + IsZero (SelectedFirstBlockFamily.derived + ((FiniteSelectionFamily.H^[m]) (FiniteSelectionFamily.test m))) := by + simpa only [SelectedFirstBlockFamily.derived_zero, FiniteSelectionFamily.derived_zero] using + FiniteSelectionFamily.extinction m +end LittleFinitistic.SelectedBarStart + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedBaseIterates.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedBaseIterates.lean new file mode 100644 index 0000000000000000000000000000000000000000..42f58879f6681def1ce387aeb7bbab9640360d71 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedBaseIterates.lean @@ -0,0 +1,55 @@ +import OAI.Algebra.Finitistic.Selected.SelectedOrdinaryModules +import OAI.Algebra.Finitistic.Iteration.AdditiveIterateAmplitude + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.SelectedBaseIterates +open SelectedOrdinaryAlgebra SelectedOrdinaryModules + +/-- The actual first-block D-module underlying the inflated A-module. -/ +abbrev input (Y : FiniteSelectionFamily.S.{0}) := ModuleCat.of D (Inflated Y) + +local instance (N : ModuleCat.{0} D) : Module ℂ N := DerivedBar.BimoduleTensor.scalarModule ℂ D N +local instance (N : ModuleCat.{0} D) : IsScalarTower ℂ D N where + smul_assoc c d n := by + change (c • d) • n = (algebraMap ℂ D c) • (d • n) + have hd : c • d = (algebraMap ℂ D c) * d := by + exact Algebra.smul_def c d + rw [hd, mul_smul] + +instance input_finiteD (Y : FiniteSelectionFamily.S.{0}) : Module.Finite D (input Y) := + Module.Finite.of_restrictScalars_finite ℂ D (Inflated Y) + +instance input_finite (Y : FiniteSelectionFamily.S.{0}) : FiniteDimensional ℂ (input Y) := + Module.Finite.trans D (input Y) + +local instance : HasDerivedCategory.{1} (ModuleCat.{0} D) := + HasDerivedCategory.standard (ModuleCat.{0} D) + +/-- Genuine bar-derived iteration of the actual X over the actual D. -/ +abbrev object (Y : FiniteSelectionFamily.S.{0}) (r : ℕ) := + DerivedBar.IterateSupport.object ℂ D X (input Y) r + +theorem cohomology_finite (Y : FiniteSelectionFamily.S.{0}) (r : ℕ) (i : ℤ) : + FiniteDimensional ℂ ((ModuleCat.restrictScalars (algebraMap ℂ D)).obj + ((DerivedCategory.homologyFunctor (ModuleCat D) i).obj (object Y r))) := by + let : Module ℂ (input Y) := DerivedBar.BimoduleTensor.scalarModule ℂ D (input Y) + have : IsScalarTower ℂ D (input Y) := by + refine ⟨fun c d n => ?_⟩ + change (c • d) • n = (algebraMap ℂ D c) • (d • n) + have hd : c • d = (algebraMap ℂ D c) * d := by exact Algebra.smul_def c d + rw [hd, mul_smul] + have : FiniteDimensional ℂ (input Y) := Module.Finite.trans D (input Y) + exact DerivedBar.IterateSupport.cohomology_finite ℂ D X (input Y) r i + +/-- A global-dimension bound on D bounds the amplitude of every derived iterate. -/ +theorem bounded (g : ℕ) (hg : ∀ M : ModuleCat.{0} D, HasProjectiveDimensionLE M g) + (Y : FiniteSelectionFamily.S.{0}) (r : ℕ) : + (object Y r).IsGE (-((r*(g+2) : ℕ) : ℤ)) ∧ (object Y r).IsLE 0 := + DerivedBar.IterateSupport.bounded_amplitude ℂ D X g hg (input Y) r +end LittleFinitistic.SelectedBaseIterates + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedChainAction.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedChainAction.lean new file mode 100644 index 0000000000000000000000000000000000000000..054fdfb176e23cfc01b5195eef1ae16902dab717 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedChainAction.lean @@ -0,0 +1,76 @@ +import OAI.Algebra.Finitistic.Selected.SelectedUnderlyingHomology + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +attribute [local instance] HasDerivedCategory.standard +namespace LittleFinitistic.SelectedChainAction +open QuadraticEncoding SelectedFixedDiagram SelectedNativeEvaluation SelectedChainHomology +universe v +variable {Y : Type v} [AddCommGroup Y] [Module ℂ Y] + [Module SelectionRing Y] [IsScalarTower ℂ SelectionRing Y] + +lemma HAction_one : HAction (Y := Y) 1 = 𝟙 _ := by + apply ModuleCat.hom_ext + ext x + rw [HAction_apply] + apply Subtype.ext + change selectionAutomorphism 1 (1 : SelectionRing) • x.val = x.val + rw [map_one,one_smul] + +/-- In the underlying Y, the selected action is exactly restriction of alpha(r). -/ +lemma HAction_val (r : SelectionRing) (x : H (Y := Y)) : + ((HAction (Y := Y) r).hom x).val = alpha r • x.val := by + rw [HAction_apply] + rfl + +variable [FiniteDimensional ℂ Y] + +lemma distinguished01 (n : ℤ) (hn : n = 0 ∨ n = -3) : + HomologicalComplex.homologyMap + (SelectedTensorComparison.tensorMap (representation (Y := Y)) (SelectedChainDiagram.fixedChain.f 0)) n ≫ + (SelectedChainHomology.D1Iso n hn).hom = (SelectedChainHomology.D0Iso n hn).hom := by + simpa only [RelationBasisAction.arrow,Fin.cases_zero,HAction_one,Category.comp_id] using + (fixed_arrow01 (Y := Y) 0 n hn) +lemma distinguished12 (n : ℤ) (hn : n = 0 ∨ n = -3) : + HomologicalComplex.homologyMap + (SelectedTensorComparison.tensorMap (representation (Y := Y)) (SelectedChainDiagram.fixedChain.g 0)) n ≫ + (SelectedChainHomology.D2Iso n hn).hom = (SelectedChainHomology.D1Iso n hn).hom := by + simpa only [RelationBasisAction.arrow,Fin.cases_zero,HAction_one,Category.comp_id] using + (fixed_arrow12 (Y := Y) 0 n hn) + +/-- Every actual first arrow, on every homology class in either selected degree. -/ +lemma arrow01_val (a : Fin (encoding.generators+1)) + (f : UnderlyingRepresentatives.complex P fixed.D0 ⟶ UnderlyingRepresentatives.complex P fixed.D1) + (hf : (HomotopyCategory.quotient _ _).map f = (SourceModelBridge.ambient P).map (fixed.f a)) + (n : ℤ) (hn : n = 0 ∨ n = -3) (x : (complex (Y := Y) fixed.D0).homology n) : + ((SelectedChainHomology.D1Iso n hn).hom.hom + ((HomologicalComplex.homologyMap (SelectedUnderlyingHomology.tensorMap (Y := Y) f) n).hom x)).val = + alpha (RelationBasisAction.arrow (SelectionEncoding.generator encoding) a) • + ((SelectedChainHomology.D0Iso n hn).hom.hom x).val := by + have h := congrArg (fun q => q.hom x) (SelectedUnderlyingHomology.arrow01 (Y := Y) a f hf n hn) + change (SelectedChainHomology.D1Iso n hn).hom.hom + ((HomologicalComplex.homologyMap (SelectedUnderlyingHomology.tensorMap (Y := Y) f) n).hom x) = + (HAction (Y := Y) (RelationBasisAction.arrow (SelectionEncoding.generator encoding) a)).hom + ((SelectedChainHomology.D0Iso n hn).hom.hom x) at h + exact (congrArg Subtype.val h).trans (HAction_val _ _) + +lemma arrow12_val (a : Fin (encoding.generators+1)) + (g : UnderlyingRepresentatives.complex P fixed.D1 ⟶ UnderlyingRepresentatives.complex P fixed.D2) + (hg : (HomotopyCategory.quotient _ _).map g = (SourceModelBridge.ambient P).map (fixed.g a)) + (n : ℤ) (hn : n = 0 ∨ n = -3) (x : (complex (Y := Y) fixed.D1).homology n) : + ((SelectedChainHomology.D2Iso n hn).hom.hom + ((HomologicalComplex.homologyMap (SelectedUnderlyingHomology.tensorMap (Y := Y) g) n).hom x)).val = + alpha (RelationBasisAction.arrow (SelectionEncoding.generator encoding) a) • + ((SelectedChainHomology.D1Iso n hn).hom.hom x).val := by + have h := congrArg (fun q => q.hom x) (SelectedUnderlyingHomology.arrow12 (Y := Y) a g hg n hn) + change (SelectedChainHomology.D2Iso n hn).hom.hom + ((HomologicalComplex.homologyMap (SelectedUnderlyingHomology.tensorMap (Y := Y) g) n).hom x) = + (HAction (Y := Y) (RelationBasisAction.arrow (SelectionEncoding.generator encoding) a)).hom + ((SelectedChainHomology.D1Iso n hn).hom.hom x) at h + exact (congrArg Subtype.val h).trans (HAction_val _ _) +end LittleFinitistic.SelectedChainAction + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedChainDiagram.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedChainDiagram.lean new file mode 100644 index 0000000000000000000000000000000000000000..afc207b1bfda702b7010af07debf962947ce7956 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedChainDiagram.lean @@ -0,0 +1,70 @@ +import OAI.Algebra.Finitistic.Localization.ConcreteChainRepresentatives +import OAI.Algebra.Finitistic.Selected.SelectedNativeAction + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.SelectedChainDiagram +open SelectedFixedDiagram RelationBasisCoefficients ConcreteChainRepresentatives + +abbrev D0 := representative P fixed.D0 +abbrev D1 := representative P fixed.D1 +abbrev D2 := representative P fixed.D2 + +/-- Chain representatives and all specified relation homotopies for the one fixed diagram. -/ +structure Data where + f : Fin (encoding.generators+1) → (D0 ⟶ D1) + g : Fin (encoding.generators+1) → (D1 ⟶ D2) + f_quotient : ∀ a, (HomotopyCategory.quotient (SourceVerdier.Proj P) (.up ℤ)).map (f a) = (fixed.f a).hom + g_quotient : ∀ b, (HomotopyCategory.quotient (SourceVerdier.Proj P) (.up ℤ)).map (g b) = (fixed.g b).hom + homotopy : ∀ r : RelationIndex P, + Homotopy (∑ a, ∑ b, basisCoefficient P r a b • (f a ≫ g b)) 0 + +/-- These choices, too, are made once before any evaluation module Y. -/ +def fixedChain : Data := Classical.choice (by + obtain ⟨f,g,hf,hg,⟨h⟩⟩ := quadratic_representatives P _ _ _ + fixed.D0 fixed.D1 fixed.D2 fixed.f fixed.g (basisCoefficient P) fixed.relations + exact ⟨⟨f,g,hf,hg,h⟩⟩) + +theorem bounded : BoundedHomotopy.boundedComplex (SourceVerdier.Proj P) D0 ∧ + BoundedHomotopy.boundedComplex (SourceVerdier.Proj P) D1 ∧ + BoundedHomotopy.boundedComplex (SourceVerdier.Proj P) D2 := + ⟨representative_bounded P fixed.D0,representative_bounded P fixed.D1,representative_bounded P fixed.D2⟩ + +def fK (a : Fin (encoding.generators+1)) : fixed.D0 ⟶ fixed.D1 := + ObjectProperty.homMk ((HomotopyCategory.quotient (SourceVerdier.Proj P) (.up ℤ)).map (fixedChain.f a)) +def gK (b : Fin (encoding.generators+1)) : fixed.D1 ⟶ fixed.D2 := + ObjectProperty.homMk ((HomotopyCategory.quotient (SourceVerdier.Proj P) (.up ℤ)).map (fixedChain.g b)) + +theorem fK_eq (a : Fin (encoding.generators+1)) : fK a = fixed.f a := by + apply ObjectProperty.hom_ext + exact fixedChain.f_quotient a + +theorem gK_eq (b : Fin (encoding.generators+1)) : gK b = fixed.g b := by + apply ObjectProperty.hom_ext + exact fixedChain.g_quotient b + +universe v +variable {Y : Type v} [AddCommGroup Y] [Module ℂ Y] [FiniteDimensional ℂ Y] + [Module SelectionRing Y] [IsScalarTower ℂ SelectionRing Y] + +theorem evaluated_f (a : Fin (encoding.generators+1)) : + (SelectedDiagramEvaluation.sourceEvaluation (Y := Y)).map (fK a) ≫ + (SelectedNativeEvaluation.D1Iso (Y := Y)).hom = + (SelectedNativeEvaluation.D0Iso (Y := Y)).hom ≫ SelectedNativeEvaluation.targetAction (Y := Y) + (RelationBasisAction.arrow (SelectionEncoding.generator encoding) a) := by + rw [fK_eq] + exact SelectedNativeEvaluation.D_arrow01 a + +theorem evaluated_g (b : Fin (encoding.generators+1)) : + (SelectedDiagramEvaluation.sourceEvaluation (Y := Y)).map (gK b) ≫ + (SelectedNativeEvaluation.D2Iso (Y := Y)).hom = + (SelectedNativeEvaluation.D1Iso (Y := Y)).hom ≫ SelectedNativeEvaluation.targetAction (Y := Y) + (RelationBasisAction.arrow (SelectionEncoding.generator encoding) b) := by + rw [gK_eq] + exact SelectedNativeEvaluation.D_arrow12 b +end LittleFinitistic.SelectedChainDiagram + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedChainHomology.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedChainHomology.lean new file mode 100644 index 0000000000000000000000000000000000000000..0f013f644cd183f2d14985b2decee7d447574d5b --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedChainHomology.lean @@ -0,0 +1,165 @@ +import OAI.Algebra.Finitistic.Selected.SelectedTargetHomology + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +attribute [local instance] HasDerivedCategory.standard +namespace LittleFinitistic.SelectedChainHomology +open QuadraticEncoding SelectedFixedDiagram SelectedNativeEvaluation SelectedTensorComparison +open SelectedTargetHomology +universe v +variable {Y : Type v} [AddCommGroup Y] [Module ℂ Y] [FiniteDimensional ℂ Y] + [Module SelectionRing Y] [IsScalarTower ℂ SelectionRing Y] +abbrev representation := SourceActionEvaluation.representation (Y := Y) encoding +abbrev complex (D : SourceVerdier.K P) := tensor (representation (Y := Y)) D +abbrev source := SelectedDiagramEvaluation.sourceEvaluation (Y := Y) + +def derivedIso (D : SourceVerdier.K P) : + DerivedCategory.Q.obj (complex (Y := Y) D) ≅ I.obj ((source (Y := Y)).obj D) := + (DerivedCategory.quotientCompQhIso C).symm.app _ ≪≫ + DerivedCategory.Qh.mapIso (finiteIso (representation (Y := Y)) D) + +def comparison (D : SourceVerdier.K P) (n : ℤ) : + (complex (Y := Y) D).homology n ≅ (cohomology n).obj ((source (Y := Y)).obj D) := + (DerivedCategory.homologyFunctorFactors C n).symm.app _ ≪≫ + (DerivedCategory.homologyFunctor C n).mapIso (derivedIso (Y := Y) D) + +lemma derived_map {D E : SourceVerdier.K P} + (f : ConcreteChainRepresentatives.representative P D ⟶ + ConcreteChainRepresentatives.representative P E) (a : D ⟶ E) + (ha : (HomotopyCategory.quotient _ _).map f = a.hom) : + DerivedCategory.Q.map (tensorMap (representation (Y := Y)) f) ≫ + (derivedIso (Y := Y) E).hom = + (derivedIso (Y := Y) D).hom ≫ I.map ((source (Y := Y)).map a) := by + have h := congrArg DerivedCategory.Qh.map (map_comparison (representation (Y := Y)) f a ha) + simp only [Functor.map_comp] at h + have hn := (DerivedCategory.quotientCompQhIso C).inv.naturality + (tensorMap (representation (Y := Y)) f) + exact DiagramEvaluationSquares.compose _ _ _ + ((DerivedCategory.quotientCompQhIso C).symm.app (complex (Y := Y) D)) + ((DerivedCategory.quotientCompQhIso C).symm.app (complex (Y := Y) E)) + (DerivedCategory.Qh.mapIso (finiteIso (representation (Y := Y)) D)) + (DerivedCategory.Qh.mapIso (finiteIso (representation (Y := Y)) E)) hn h + +lemma comparison_map {D E : SourceVerdier.K P} + (f : ConcreteChainRepresentatives.representative P D ⟶ + ConcreteChainRepresentatives.representative P E) (a : D ⟶ E) + (ha : (HomotopyCategory.quotient _ _).map f = a.hom) (n : ℤ) : + HomologicalComplex.homologyMap (tensorMap (representation (Y := Y)) f) n ≫ + (comparison (Y := Y) E n).hom = + (comparison (Y := Y) D n).hom ≫ (cohomology n).map ((source (Y := Y)).map a) := by + have h := congrArg (DerivedCategory.homologyFunctor C n).map (derived_map (Y := Y) f a ha) + simp only [Functor.map_comp] at h + have hn := (DerivedCategory.homologyFunctorFactors C n).inv.naturality + (tensorMap (representation (Y := Y)) f) + exact DiagramEvaluationSquares.compose _ _ _ + ((DerivedCategory.homologyFunctorFactors C n).symm.app (complex (Y := Y) D)) + ((DerivedCategory.homologyFunctorFactors C n).symm.app (complex (Y := Y) E)) + ((DerivedCategory.homologyFunctor C n).mapIso (derivedIso (Y := Y) D)) + ((DerivedCategory.homologyFunctor C n).mapIso (derivedIso (Y := Y) E)) hn h + +def modelIso (n : ℤ) (hn : n = 0 ∨ n = -3) : + (cohomology n).obj (target (Y := Y)) ≅ H (Y := Y) := by + by_cases h : n = 0 + · subst n; exact targetH0 + · have hm : n = -3 := hn.resolve_left h + subst n; exact targetHm3 + +lemma model_action (n : ℤ) (hn : n = 0 ∨ n = -3) (r : SelectionRing) : + (cohomology n).map (targetAction (Y := Y) r) ≫ (modelIso (Y := Y) n hn).hom = + (modelIso (Y := Y) n hn).hom ≫ HAction (Y := Y) r := by + rcases hn with rfl | rfl + · exact targetH0_action r + · exact targetHm3_action r + +/-- Actual homology of a selected chain tensor, with its chosen target identification. -/ +def homologyIso (D : SourceVerdier.K P) + (e : (source (Y := Y)).obj D ≅ target (Y := Y)) + (n : ℤ) (hn : n = 0 ∨ n = -3) : (complex (Y := Y) D).homology n ≅ H (Y := Y) := + comparison D n ≪≫ (cohomology n).mapIso e ≪≫ modelIso n hn + +lemma homology_zero (D : SourceVerdier.K P) + (e : (source (Y := Y)).obj D ≅ target (Y := Y)) + (n : ℤ) (h0 : n ≠ 0) (hm : n ≠ -3) : IsZero ((complex (Y := Y) D).homology n) := + (comparison D n ≪≫ (cohomology n).mapIso e).isZero_iff.mpr (target_zero n h0 hm) + +lemma homology_arrow {D E : SourceVerdier.K P} + (f : ConcreteChainRepresentatives.representative P D ⟶ + ConcreteChainRepresentatives.representative P E) (a : D ⟶ E) + (ha : (HomotopyCategory.quotient _ _).map f = a.hom) + (eD : (source (Y := Y)).obj D ≅ target (Y := Y)) + (eE : (source (Y := Y)).obj E ≅ target (Y := Y)) (r : SelectionRing) + (hs : (source (Y := Y)).map a ≫ eE.hom = eD.hom ≫ targetAction (Y := Y) r) + (n : ℤ) (hn : n = 0 ∨ n = -3) : + HomologicalComplex.homologyMap (tensorMap (representation (Y := Y)) f) n ≫ + (homologyIso E eE n hn).hom = + (homologyIso D eD n hn).hom ≫ HAction (Y := Y) r := by + have h := congrArg (cohomology n).map hs + simp only [Functor.map_comp] at h + exact DiagramEvaluationSquares.compose _ _ _ + (comparison D n) (comparison E n) + ((cohomology n).mapIso eD ≪≫ modelIso n hn) + ((cohomology n).mapIso eE ≪≫ modelIso n hn) + (comparison_map f a ha n) + (DiagramEvaluationSquares.compose _ _ _ ((cohomology n).mapIso eD) + ((cohomology n).mapIso eE) (modelIso n hn) (modelIso n hn) h (model_action n hn r)) + +/-- All three actual tensors have the primary H(Y) as homology in both selected degrees. -/ +def D0Iso (n : ℤ) (hn : n = 0 ∨ n = -3) : + (complex (Y := Y) fixed.D0).homology n ≅ H (Y := Y) := + homologyIso _ SelectedNativeEvaluation.D0Iso n hn +def D1Iso (n : ℤ) (hn : n = 0 ∨ n = -3) : + (complex (Y := Y) fixed.D1).homology n ≅ H (Y := Y) := + homologyIso _ SelectedNativeEvaluation.D1Iso n hn +def D2Iso (n : ℤ) (hn : n = 0 ∨ n = -3) : + (complex (Y := Y) fixed.D2).homology n ≅ H (Y := Y) := + homologyIso _ SelectedNativeEvaluation.D2Iso n hn + +lemma D0_zero (n : ℤ) (h0 : n ≠ 0) (hm : n ≠ -3) : + IsZero ((complex (Y := Y) fixed.D0).homology n) := + homology_zero _ SelectedNativeEvaluation.D0Iso n h0 hm +lemma D1_zero (n : ℤ) (h0 : n ≠ 0) (hm : n ≠ -3) : + IsZero ((complex (Y := Y) fixed.D1).homology n) := + homology_zero _ SelectedNativeEvaluation.D1Iso n h0 hm +lemma D2_zero (n : ℤ) (h0 : n ≠ 0) (hm : n ≠ -3) : + IsZero ((complex (Y := Y) fixed.D2).homology n) := + homology_zero _ SelectedNativeEvaluation.D2Iso n h0 hm + +/-- This applies to any chain representative of the same fixed first arrow. -/ +lemma arrow01 (a : Fin (encoding.generators+1)) + (f : SelectedChainDiagram.D0 ⟶ SelectedChainDiagram.D1) + (hf : (HomotopyCategory.quotient _ _).map f = (fixed.f a).hom) + (n : ℤ) (hn : n = 0 ∨ n = -3) : + HomologicalComplex.homologyMap (tensorMap (representation (Y := Y)) f) n ≫ (D1Iso n hn).hom = + (D0Iso n hn).hom ≫ HAction (Y := Y) + (RelationBasisAction.arrow (SelectionEncoding.generator encoding) a) := + homology_arrow f (fixed.f a) hf SelectedNativeEvaluation.D0Iso SelectedNativeEvaluation.D1Iso _ + (SelectedNativeEvaluation.D_arrow01 a) n hn + +lemma arrow12 (a : Fin (encoding.generators+1)) + (g : SelectedChainDiagram.D1 ⟶ SelectedChainDiagram.D2) + (hg : (HomotopyCategory.quotient _ _).map g = (fixed.g a).hom) + (n : ℤ) (hn : n = 0 ∨ n = -3) : + HomologicalComplex.homologyMap (tensorMap (representation (Y := Y)) g) n ≫ (D2Iso n hn).hom = + (D1Iso n hn).hom ≫ HAction (Y := Y) + (RelationBasisAction.arrow (SelectionEncoding.generator encoding) a) := + homology_arrow g (fixed.g a) hg SelectedNativeEvaluation.D1Iso SelectedNativeEvaluation.D2Iso _ + (SelectedNativeEvaluation.D_arrow12 a) n hn + +lemma fixed_arrow01 (a : Fin (encoding.generators+1)) (n : ℤ) (hn : n = 0 ∨ n = -3) : + HomologicalComplex.homologyMap + (tensorMap (representation (Y := Y)) (SelectedChainDiagram.fixedChain.f a)) n ≫ (D1Iso n hn).hom = + (D0Iso n hn).hom ≫ HAction (Y := Y) + (RelationBasisAction.arrow (SelectionEncoding.generator encoding) a) := + arrow01 a _ (SelectedChainDiagram.fixedChain.f_quotient a) n hn +lemma fixed_arrow12 (a : Fin (encoding.generators+1)) (n : ℤ) (hn : n = 0 ∨ n = -3) : + HomologicalComplex.homologyMap + (tensorMap (representation (Y := Y)) (SelectedChainDiagram.fixedChain.g a)) n ≫ (D2Iso n hn).hom = + (D1Iso n hn).hom ≫ HAction (Y := Y) + (RelationBasisAction.arrow (SelectionEncoding.generator encoding) a) := + arrow12 a _ (SelectedChainDiagram.fixedChain.g_quotient a) n hn +end LittleFinitistic.SelectedChainHomology + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedCohomologyAssembly.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedCohomologyAssembly.lean new file mode 100644 index 0000000000000000000000000000000000000000..a87ff0f8907af973404981c890469e569e0dcddb --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedCohomologyAssembly.lean @@ -0,0 +1,60 @@ +import OAI.Algebra.Finitistic.Selected.SelectedTensor +import OAI.Algebra.Finitistic.Rectification.VertexCategoricalAssembly + +namespace OAI +noncomputable section +open CategoryTheory HomologicalComplex +namespace LittleFinitistic.SelectedCohomologyAssembly +open SelectedFixedDiagram SelectedRectification QuadraticEncoding +section General +variable {C : Type*} [Category C] +variable {X0 X1 M0 M1 N0 N1 : C} +lemma transfer_square (f : X0 ⟶ X1) (m : M0 ⟶ M1) (n : N0 ⟶ N1) + (c0 : X0 ≅ M0) (c1 : X1 ≅ M1) (e0 : X0 ≅ N0) (e1 : X1 ≅ N1) + (hc : f ≫ c1.hom = c0.hom ≫ m) (he : f ≫ e1.hom = e0.hom ≫ n) : + m ≫ (c1.symm ≪≫ e1).hom = (c0.symm ≪≫ e0).hom ≫ n := by + apply (cancel_epi c0.hom).1 + dsimp only [Iso.trans_hom, Iso.symm_hom] + calc + c0.hom ≫ m ≫ c1.inv ≫ e1.hom = (c0.hom ≫ m) ≫ c1.inv ≫ e1.hom := by simp only [Category.assoc] + _ = (f ≫ c1.hom) ≫ c1.inv ≫ e1.hom := by rw [← hc] + _ = f ≫ e1.hom := by simp + _ = e0.hom ≫ n := he + _ = c0.hom ≫ (c0.inv ≫ e0.hom) ≫ n := by simp +end General + +variable (N : Type) [AddCommGroup N] [Module ℂ N] [Module (B P) N] +variable (n : ℤ) (R : ModuleCat (B P)) +variable (E : ∀ v : Fin 3, (SelectedTensor.source N v).homology n ≅ + (LeftVertexHomology.vertex ℂ (B P) (ThreeVertexAlgebra.vertex (composition P) v)).obj R) + +/-- Convert an identified evaluated-representative cohomology diagram into the +full cohomology B-module of the one fixed selecting tensor. Only the reference +diagram identification is an input; the tensor vertex comparisons are proved. -/ +def iso + (h01 : ∀ a, + homologyMap (((BalancedTensor.tensorFunctor ℂ (B P) N).mapHomologicalComplex (.up ℤ)).map (f a)) n ≫ + (E 1).hom = (E 0).hom ≫ + (LeftVertexHomology.arrow ℂ (B P) (ThreeVertexAlgebra.vertex (composition P) 0) + (ThreeVertexAlgebra.vertex (composition P) 1) (arrow01 P a) + (CanonicalArrowCompatibility.arrow01_target P a)).app R) + (h12 : ∀ b, + homologyMap (((BalancedTensor.tensorFunctor ℂ (B P) N).mapHomologicalComplex (.up ℤ)).map (g b)) n ≫ + (E 2).hom = (E 1).hom ≫ + (LeftVertexHomology.arrow ℂ (B P) (ThreeVertexAlgebra.vertex (composition P) 1) + (ThreeVertexAlgebra.vertex (composition P) 2) (arrow12 P b) + (CanonicalArrowCompatibility.arrow12_target P b)).app R) : + (SelectedTensor.complex N).homology n ≅ R := + VertexCategoricalAssembly.iso P _ R + (fun v => (SelectedTensor.comparisonIso N v n).symm ≪≫ E v) + (fun a => transfer_square _ _ _ (SelectedTensor.comparisonIso N 0 n) + (SelectedTensor.comparisonIso N 1 n) (E 0) (E 1) + (TensorCohomologyDiagram.arrow01_square P D0 D1 D2 f g relations N a n) (h01 a)) + (fun b => transfer_square _ _ _ (SelectedTensor.comparisonIso N 1 n) + (SelectedTensor.comparisonIso N 2 n) (E 1) (E 2) + (TensorCohomologyDiagram.arrow12_square P D0 D1 D2 f g relations N b n) (h12 b)) +end LittleFinitistic.SelectedCohomologyAssembly + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedCohomologyVanishing.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedCohomologyVanishing.lean new file mode 100644 index 0000000000000000000000000000000000000000..7ddff94e59f7287c6deb6417458f6192e25d0f93 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedCohomologyVanishing.lean @@ -0,0 +1,42 @@ +import OAI.Algebra.Finitistic.Selected.SelectedCohomologyAssembly + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.SelectedCohomologyVanishing +open QuadraticEncoding +section General +universe u +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) + +/-- The three actual vertex functors jointly detect a zero module. -/ +theorem module_isZero (M : ModuleCat.{u} (B P)) + (h : ∀ i : Fin 3, IsZero + ((LeftVertexHomology.vertex k (B P) (ThreeVertexAlgebra.vertex (composition P) i)).obj M)) : + IsZero M := by + let M' := (ModuleCat.restrictScalars (algebraMap k (B P))).obj M + have (i : Fin 3) : Subsingleton + (VertexDecomposition.Space (EncodingModuleAssembly.system P) M' i) := by + let := ModuleCat.subsingleton_of_isZero (h i) + exact (LeftVertexHomology.spaceEquiv k (B P) (ThreeVertexAlgebra.vertex (composition P) i) M).symm.injective.subsingleton + have : Subsingleton M' := (VertexDecomposition.equiv (EncodingModuleAssembly.system P) M').injective.subsingleton + have : Subsingleton M := inferInstanceAs (Subsingleton M') + exact ModuleCat.isZero_of_subsingleton M +end General + +open SelectedFixedDiagram +variable (N : Type) [AddCommGroup N] [Module ℂ N] [Module (B P) N] + +/-- Vanishing on all three evaluated representatives gives actual cohomology +vanishing of the fixed selecting tensor as a B-module. -/ +theorem cohomology_isZero (n : ℤ) + (h : ∀ v : Fin 3, IsZero ((SelectedTensor.source N v).homology n)) : + IsZero ((SelectedTensor.complex N).homology n) := by + apply module_isZero P + intro v + exact (SelectedTensor.comparisonIso N v n).isZero_iff.mp (h v) +end LittleFinitistic.SelectedCohomologyVanishing + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedCountCohomology.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedCountCohomology.lean new file mode 100644 index 0000000000000000000000000000000000000000..6a3d6f04442c1739d02b20ad11467cf259aed754 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedCountCohomology.lean @@ -0,0 +1,73 @@ +import OAI.Algebra.Finitistic.Selected.SelectedFiniteAmplitude +import OAI.Algebra.Finitistic.Bar.IntegerCountObject +import OAI.Algebra.Finitistic.Iteration.BinomialVanishing + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.SelectedCountCohomology +open SelectedOrdinaryAlgebra SelectedBaseIterates +local instance : HasDerivedCategory.{1} (ModuleCat.{0} D) := + HasDerivedCategory.standard (ModuleCat.{0} D) + +/-- The original summand with exactly r square-zero factors in the actual bar complex. -/ +abbrev count (Y : FiniteSelectionFamily.S.{0}) (r : ℕ) := + DerivedBar.ParityBridge.countObject ℂ D X (input Y) r + +/-- Its exact standard integer-shift identification with the genuine derived iterate. -/ +def comparison (Y : FiniteSelectionFamily.S.{0}) (r : ℕ) : + (object Y r)⟦(r : ℤ)⟧ ≅ count Y r := + DerivedBar.ParityBridge.countObjectComparison ℂ D X (input Y) r + +theorem isZero_iff (Y : FiniteSelectionFamily.S.{0}) (r : ℕ) : + IsZero (count Y r) ↔ IsZero (object Y r) := + (comparison Y r).isZero_iff.symm.trans + (ExternalTensor.Binomial.isZero_shift_iff (object Y r) (r : ℤ)) + +theorem bounded (Y : FiniteSelectionFamily.S.{0}) (r : ℕ) : + (count Y r).IsGE (-((r * (3 * length + 5) : ℕ) : ℤ)) ∧ + (count Y r).IsLE (-(r : ℤ)) := by + have := (SelectedFiniteAmplitude.bounded Y r).1 + have := (SelectedFiniteAmplitude.bounded Y r).2 + have : ((object Y r)⟦(r : ℤ)⟧).IsGE (-((r * (3 * length + 5) : ℕ) : ℤ)) := by + apply DerivedCategory.TStructure.t.isGE_shift (object Y r) + (-((r * (3 * length + 4) : ℕ) : ℤ)) (r : ℤ) + (-((r * (3 * length + 5) : ℕ) : ℤ)) ?_ + push_cast + ring + have : ((object Y r)⟦(r : ℤ)⟧).IsLE (-(r : ℤ)) := + DerivedCategory.TStructure.t.isLE_shift (object Y r) 0 (r : ℤ) (-(r : ℤ)) (by omega) + exact ⟨DerivedCategory.TStructure.t.isGE_of_iso (comparison Y r) _, + DerivedCategory.TStructure.t.isLE_of_iso (comparison Y r) _⟩ + +/-- Every surviving iterate contributes a nonzero original count class in a +homological degree at least r, with an explicit finite upper bound. -/ +theorem nonzero_degree (Y : FiniteSelectionFamily.S.{0}) (r : ℕ) + (h : ¬ IsZero (object Y r)) : + ∃ n : ℕ, r ≤ n ∧ n ≤ r * (3 * length + 5) ∧ + ¬ IsZero ((DerivedCategory.homologyFunctor (ModuleCat D) (-(n : ℤ))).obj (count Y r)) := by + have := (bounded Y r).1 + have := (bounded Y r).2 + by_contra hn + push Not at hn + have hz (i : ℤ) : IsZero ((DerivedCategory.homologyFunctor (ModuleCat D) i).obj (count Y r)) := by + by_cases hi : i ≤ 0 + · obtain ⟨n,rfl⟩ := Int.exists_eq_neg_ofNat hi + by_cases hlo : r ≤ n + · by_cases hhi : n ≤ r * (3 * length + 5) + · exact hn n hlo hhi + · exact DerivedCategory.isZero_of_isGE _ (-((r * (3 * length + 5) : ℕ) : ℤ)) + (-(n : ℤ)) (by omega) + · exact DerivedCategory.isZero_of_isLE _ (-(r : ℤ)) (-(n : ℤ)) (by omega) + · exact DerivedCategory.isZero_of_isLE _ (-(r : ℤ)) i (by omega) + have : (count Y r).IsLE (-1) := (DerivedCategory.isLE_iff _ _).mpr (fun i _ => hz i) + have : (count Y r).IsGE 0 := (DerivedCategory.isGE_iff _ _).mpr (fun i _ => hz i) + apply h + apply (isZero_iff Y r).mp + apply (IsZero.iff_id_eq_zero _).mpr + exact DerivedCategory.TStructure.t.zero (𝟙 _) (-1) 0 (by omega) +end LittleFinitistic.SelectedCountCohomology + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedCountExtinction.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedCountExtinction.lean new file mode 100644 index 0000000000000000000000000000000000000000..797facc3243885468c0bca9197d9bdd2d323444d --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedCountExtinction.lean @@ -0,0 +1,49 @@ +import OAI.Algebra.Finitistic.Selected.SelectedCountCohomology +import OAI.Algebra.Finitistic.Iteration.IntegerIterateExtinction + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.SelectedCountExtinction +open SelectedOrdinaryAlgebra SelectedBaseIterates SelectedCountCohomology +local instance : HasDerivedCategory.{1} (ModuleCat.{0} D) := + HasDerivedCategory.standard (ModuleCat.{0} D) + +/-- After actual tensor extinction, all later original count summands vanish. -/ +theorem tail_zero (Y : FiniteSelectionFamily.S.{0}) (t r : ℕ) (htr : t ≤ r) + (h : IsZero (object Y t)) : IsZero (count Y r) := + (SelectedCountCohomology.isZero_iff Y r).mpr + (DerivedBar.IterateSupport.zero_of_le ℂ D X (input Y) t r htr h) + +/-- A zero iterate gives one finite cohomological window for the entire original +count family, including the infinitely many counts that have already vanished. -/ +theorem uniform_bounded (Y : FiniteSelectionFamily.S.{0}) (t : ℕ) + (h : IsZero (object Y t)) (r : ℕ) : + (count Y r).IsGE (-((t * (3 * length + 5) : ℕ) : ℤ)) ∧ (count Y r).IsLE 0 := by + have := (SelectedCountCohomology.bounded Y r).1 + have := (SelectedCountCohomology.bounded Y r).2 + constructor + · by_cases htr : t ≤ r + · apply (DerivedCategory.isGE_iff _ _).mpr + intro i _ + exact (DerivedCategory.homologyFunctor (ModuleCat D) i).map_isZero (tail_zero Y t r htr h) + · apply DerivedCategory.TStructure.t.isGE_of_ge (count Y r) + (-((t * (3 * length + 5) : ℕ) : ℤ)) (-((r * (3 * length + 5) : ℕ) : ℤ)) ?_ + have hm := Nat.mul_le_mul_right (3 * length + 5) (show r ≤ t by omega) + exact neg_le_neg (by exact_mod_cast hm) + · exact DerivedCategory.TStructure.t.isLE_of_le (count Y r) (-(r : ℤ)) 0 (by omega) + +/-- Every original count has zero cohomology outside that single finite window. -/ +theorem uniform_homology_zero (Y : FiniteSelectionFamily.S.{0}) (t : ℕ) + (h : IsZero (object Y t)) (r : ℕ) (i : ℤ) + (hi : i < -((t * (3 * length + 5) : ℕ) : ℤ) ∨ 0 < i) : + IsZero ((DerivedCategory.homologyFunctor (ModuleCat D) i).obj (count Y r)) := by + have := (uniform_bounded Y t h r).1 + have := (uniform_bounded Y t h r).2 + exact hi.elim (fun h => DerivedCategory.isZero_of_isGE _ _ i h) + (fun h => DerivedCategory.isZero_of_isLE _ 0 i h) +end LittleFinitistic.SelectedCountExtinction + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedCountPDConsumer.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedCountPDConsumer.lean new file mode 100644 index 0000000000000000000000000000000000000000..8815de5726ba4b153bc5d3ebf8d8a3c8cfb5c851 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedCountPDConsumer.lean @@ -0,0 +1,28 @@ +import OAI.Algebra.Finitistic.Selected.SelectedPDBarConsumer +import OAI.Algebra.Finitistic.Selected.SelectedPDResidueProjection +import OAI.Algebra.Finitistic.Selected.SelectedCountCohomology + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.SelectedPDDetection +open SelectedOrdinaryAlgebra SelectedOrdinaryModules +local instance : HasDerivedCategory.{1} (ModuleCat.{0} D) := + HasDerivedCategory.standard (ModuleCat.{0} D) + +/-- A supplied inclusion/retraction of the original count summand into the +actual full bar converts native iterate survival directly into the pd bound. +Native supplies the proved nonzero degree; no shift/amplitude proof is duplicated. -/ +theorem lower_bound_of_surviving_count (Y : FiniteSelectionFamily.S.{0}) (r : ℕ) + (h : ¬ IsZero (SelectedBaseIterates.object Y r)) + (i : SelectedCountCohomology.count Y r ⟶ PDBarQuotient.baseDerived augmentation (Inflated Y)) + (p : PDBarQuotient.baseDerived augmentation (Inflated Y) ⟶ SelectedCountCohomology.count Y r) + (hip : i ≫ p = 𝟙 (SelectedCountCohomology.count Y r)) : + r ≤ projectiveDimension (module Y) := by + obtain ⟨n,hrn,_,hn⟩ := SelectedCountCohomology.nonzero_degree Y r h + exact lower_bound_of_base_derived_bar Y _ _ (Iso.refl _) i p hip r n hrn hn +end LittleFinitistic.SelectedPDDetection + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedDerivedFunctor.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedDerivedFunctor.lean new file mode 100644 index 0000000000000000000000000000000000000000..a8e94adce87f0ffe186ac04f99325ba106326c5d --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedDerivedFunctor.lean @@ -0,0 +1,45 @@ +import OAI.Algebra.Finitistic.Localization.NativeSingleEvaluation +import OAI.Algebra.Finitistic.Selected.SelectedWindow +import OAI.Algebra.Finitistic.Selected.SelectedIteration + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +attribute [local instance] HasDerivedCategory.standard HasExt.standard +namespace LittleFinitistic.SelectedDerivedFunctor +open SelectedFixedDiagram QuadraticEncoding FiniteSelectionFamily + +/-- One fixed genuine derived tensor functor, chosen before any test module. -/ +def model : BimoduleTotal.BoundedProjective ℂ (B P) SelectedRectification.bimodule := + BimoduleTotal.nativeProjectiveModel SelectedRectification.bimodule + (SelectedWindow.lo-2) SelectedWindow.hi SelectedWindow.bounded SelectedWindow.verified.projective + +abbrev Phi := model.derived + +/-- The previously explicit stalk-comparison premise is now discharged for the +actual fixed selecting bimodule and its actual derived tensor endofunctor. -/ +def comparison (Y : S.{0}) : Phi.obj (derived Y) ≅ + SelectedTensorSplitting.object (representation Y).Evaluation := + model.nativeSingleEvaluation (representation Y).Evaluation + +/-- The actual full B-linear binomial formula for the genuine tensor functor. -/ +def iteration (j : ℕ) (Y : S.{0}) : + (Phi.obj^[j]) (derived Y) ≅ + ⨁ fun q : Fin (j+1) => ⨁ fun _ : Fin (Nat.choose j q.val) => + (derived ((H^[j]) Y))⟦(3 : ℤ)*(q.val : ℤ)⟧ := + SelectedIteration.iteration Phi comparison j Y + +theorem isZero_iff (j : ℕ) (Y : S.{0}) : + IsZero ((Phi.obj^[j]) (derived Y)) ↔ Subsingleton (selectionIterate Y.val j) := + SelectedIteration.isZero_iff Phi comparison j Y + +/-- Exact arbitrarily long finite extinction for one fixed actual tensor functor. -/ +theorem extinction (m : ℕ) [NeZero m] : + (∀ j < m, ¬ IsZero ((Phi.obj^[j]) (derived (test m)))) ∧ + IsZero ((Phi.obj^[m]) (derived (test m))) := + SelectedIteration.extinction Phi comparison m +end LittleFinitistic.SelectedDerivedFunctor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedDiagramEvaluation.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedDiagramEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..7979b0e2ce838aacb03bd749185831f6faba1c10 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedDiagramEvaluation.lean @@ -0,0 +1,127 @@ +import OAI.Algebra.Finitistic.Selected.SelectedFixedDiagram +import OAI.Algebra.Finitistic.Localization.SourceOddDoubleEvaluation +import OAI.Algebra.Finitistic.Localization.DiagramEvaluationSquares + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits CategoryTheory.Idempotents +attribute [local instance] HasDerivedCategory.standard +namespace LittleFinitistic.SelectedDiagramEvaluation +open QuadraticEncoding SelectedFixedDiagram SourceImageEvaluation +universe v +variable {Y : Type v} [AddCommGroup Y] [Module ℂ Y] [FiniteDimensional ℂ Y] + [Module SelectionRing Y] [IsScalarTower ℂ SelectionRing Y] + +abbrev F := SourceImageEvaluation.evaluation (Y := Y) encoding +abbrev G := completed (Y := Y) encoding +abbrev target := imageDerived (k := ℂ) (Y := Y) e ⊞ (imageDerived (k := ℂ) (Y := Y) e)⟦(3 : ℤ)⟧ +def targetAction (r : SelectionRing) : target (Y := Y) ⟶ target (Y := Y) := + biprod.map (imageCorner (k := ℂ) (Y := Y) e (alpha r)) ((imageCorner (k := ℂ) (Y := Y) e (alpha r))⟦(3 : ℤ)⟧') + +/-- Evaluation of the one fixed actual V0 is precisely eY direct-sum eY[3]. -/ +def V0Iso : (F (Y := Y)).obj fixed.V0 ≅ target (Y := Y) := + (factors (Y := Y) encoding).symm.app fixed.V0 ≪≫ + ((G (Y := Y)).mapIso fixed.iso ≪≫ oddDoubleImageIso (Y := Y) encoding e idem) + +/-- The V0 identification intertwines every selected algebra element on both summands. -/ +theorem V0_action (r : SelectionRing) : + (F (Y := Y)).map (fixed.rho r) ≫ (V0Iso (Y := Y)).hom = + (V0Iso (Y := Y)).hom ≫ targetAction (Y := Y) r := by + have hf := (factors (Y := Y) encoding).inv.naturality (fixed.rho r) + have hi := congrArg (fun f => (G (Y := Y)).map f) (fixed.equivariant r) + simp only [Functor.map_comp] at hi + have ho := oddDouble_selecting_square (Y := Y) encoding e idem central alpha r + exact DiagramEvaluationSquares.compose _ _ _ + ((factors (Y := Y) encoding).symm.app fixed.V0) + ((factors (Y := Y) encoding).symm.app fixed.V0) + ((G (Y := Y)).mapIso fixed.iso ≪≫ oddDoubleImageIso (Y := Y) encoding e idem) + ((G (Y := Y)).mapIso fixed.iso ≪≫ oddDoubleImageIso (Y := Y) encoding e idem) + hf (DiagramEvaluationSquares.compose _ _ _ + ((G (Y := Y)).mapIso fixed.iso) ((G (Y := Y)).mapIso fixed.iso) + (oddDoubleImageIso (Y := Y) encoding e idem) (oddDoubleImageIso (Y := Y) encoding e idem) + hi ho) + +abbrev sourceEvaluation := SourceEvaluation.finite + (SourceActionEvaluation.representation (Y := Y) encoding) ⋙ (FiniteProjectiveHomotopy.derivedEmbedding ℂ).toEssImage + +def sourceFactors : SourceVerdier.q P ⋙ F (Y := Y) ≅ sourceEvaluation (Y := Y) := + (Functor.associator _ _ _).symm ≪≫ Functor.isoWhiskerRight + (SourceEvaluation.finiteFactors (SourceActionEvaluation.representation (Y := Y) encoding)) + (FiniteProjectiveHomotopy.derivedEmbedding ℂ).toEssImage + +def D0Iso : (sourceEvaluation (Y := Y)).obj fixed.D0 ≅ target (Y := Y) := + (sourceFactors (Y := Y)).symm.app fixed.D0 ≪≫ ((F (Y := Y)).mapIso fixed.phi0 ≪≫ V0Iso (Y := Y)) +def D1Iso : (sourceEvaluation (Y := Y)).obj fixed.D1 ≅ target (Y := Y) := + (sourceFactors (Y := Y)).symm.app fixed.D1 ≪≫ ((F (Y := Y)).mapIso fixed.phi1 ≪≫ V0Iso (Y := Y)) +def D2Iso : (sourceEvaluation (Y := Y)).obj fixed.D2 ≅ target (Y := Y) := + (sourceFactors (Y := Y)).symm.app fixed.D2 ≪≫ ((F (Y := Y)).mapIso fixed.phi2 ≪≫ V0Iso (Y := Y)) + +/-- Every first-family arrow of the same fixed K diagram has its selected action. -/ +theorem D_arrow01 (a : Fin (encoding.generators+1)) : + (sourceEvaluation (Y := Y)).map (fixed.f a) ≫ (D1Iso (Y := Y)).hom = + (D0Iso (Y := Y)).hom ≫ targetAction (Y := Y) + (RelationBasisAction.arrow (SelectionEncoding.generator encoding) a) := by + have hn := (sourceFactors (Y := Y)).inv.naturality (fixed.f a) + have hp := congrArg (fun f => (F (Y := Y)).map f) (fixed.arrow01 a) + simp only [Functor.map_comp] at hp + exact DiagramEvaluationSquares.compose _ _ _ + ((sourceFactors (Y := Y)).symm.app fixed.D0) ((sourceFactors (Y := Y)).symm.app fixed.D1) + ((F (Y := Y)).mapIso fixed.phi0 ≪≫ V0Iso (Y := Y)) + ((F (Y := Y)).mapIso fixed.phi1 ≪≫ V0Iso (Y := Y)) hn + (DiagramEvaluationSquares.compose _ _ _ + ((F (Y := Y)).mapIso fixed.phi0) ((F (Y := Y)).mapIso fixed.phi1) + (V0Iso (Y := Y)) (V0Iso (Y := Y)) hp (V0_action _)) + +theorem D_arrow12 (a : Fin (encoding.generators+1)) : + (sourceEvaluation (Y := Y)).map (fixed.g a) ≫ (D2Iso (Y := Y)).hom = + (D1Iso (Y := Y)).hom ≫ targetAction (Y := Y) + (RelationBasisAction.arrow (SelectionEncoding.generator encoding) a) := by + have hn := (sourceFactors (Y := Y)).inv.naturality (fixed.g a) + have hp := congrArg (fun f => (F (Y := Y)).map f) (fixed.arrow12 a) + simp only [Functor.map_comp] at hp + exact DiagramEvaluationSquares.compose _ _ _ + ((sourceFactors (Y := Y)).symm.app fixed.D1) ((sourceFactors (Y := Y)).symm.app fixed.D2) + ((F (Y := Y)).mapIso fixed.phi1 ≪≫ V0Iso (Y := Y)) + ((F (Y := Y)).mapIso fixed.phi2 ≪≫ V0Iso (Y := Y)) hn + (DiagramEvaluationSquares.compose _ _ _ + ((F (Y := Y)).mapIso fixed.phi1) ((F (Y := Y)).mapIso fixed.phi2) + (V0Iso (Y := Y)) (V0Iso (Y := Y)) hp (V0_action _)) + +theorem targetAction_one : targetAction (Y := Y) (1 : SelectionRing) = 𝟙 _ := by + apply (cancel_epi (V0Iso (Y := Y)).hom).mp + rw [← V0_action,map_one] + change (F (Y := Y)).map (𝟙 fixed.V0) ≫ _ = _ + rw [CategoryTheory.Functor.map_id,Category.id_comp,Category.comp_id] + +theorem distinguished_arrow01 : + (sourceEvaluation (Y := Y)).map (fixed.f 0) ≫ (D1Iso (Y := Y)).hom = (D0Iso (Y := Y)).hom := by + have h := D_arrow01 (Y := Y) 0 + simpa only [RelationBasisAction.arrow,Fin.cases_zero,targetAction_one,Category.comp_id] using h + +theorem distinguished_arrow12 : + (sourceEvaluation (Y := Y)).map (fixed.g 0) ≫ (D2Iso (Y := Y)).hom = (D1Iso (Y := Y)).hom := by + have h := D_arrow12 (Y := Y) 0 + simpa only [RelationBasisAction.arrow,Fin.cases_zero,targetAction_one,Category.comp_id] using h + +/-- The same globally chosen K diagram evaluates correctly for every finite module. -/ +theorem fixed_diagram_evaluates : + ∃ (i0 : (sourceEvaluation (Y := Y)).obj fixed.D0 ≅ target (Y := Y)) + (i1 : (sourceEvaluation (Y := Y)).obj fixed.D1 ≅ target (Y := Y)) + (i2 : (sourceEvaluation (Y := Y)).obj fixed.D2 ≅ target (Y := Y)), + (∀ a, (sourceEvaluation (Y := Y)).map (fixed.f a) ≫ i1.hom = + i0.hom ≫ targetAction (Y := Y) (RelationBasisAction.arrow (SelectionEncoding.generator encoding) a)) ∧ + (∀ b, (sourceEvaluation (Y := Y)).map (fixed.g b) ≫ i2.hom = + i1.hom ≫ targetAction (Y := Y) (RelationBasisAction.arrow (SelectionEncoding.generator encoding) b)) := + ⟨D0Iso,D1Iso,D2Iso,D_arrow01,D_arrow12⟩ + +omit [FiniteDimensional ℂ Y] in +/-- Exact vector formula for the selected action, including the alpha restriction. -/ +theorem targetAction_on_image (r : SelectionRing) (y : imageSpace (k := ℂ) (Y := Y) e) : + ((imageCornerEnd (action (k := ℂ) (Y := Y) e).hom (action (k := ℂ) (Y := Y) (alpha r)).hom) y).val = + (action (k := ℂ) (Y := Y) (alpha r)).hom y.val := + imageCorner_restriction e (alpha r) idem (central (alpha r)) y +end LittleFinitistic.SelectedDiagramEvaluation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedFiniteAmplitude.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedFiniteAmplitude.lean new file mode 100644 index 0000000000000000000000000000000000000000..30773eaf87282814da30d31a42a443e437e880c3 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedFiniteAmplitude.lean @@ -0,0 +1,46 @@ +import OAI.Algebra.Finitistic.Selected.SelectedBaseIterates +import OAI.Algebra.Finitistic.Selected.SelectedOrdinaryDimension + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.SelectedFiniteAmplitude +open SelectedOrdinaryAlgebra SelectedBaseIterates +local instance : HasDerivedCategory.{1} (ModuleCat.{0} D) := + HasDerivedCategory.standard (ModuleCat.{0} D) + +/-- Every genuine X-derived iterate of each actual test input has finite amplitude. +The extra two degrees per iteration are harmless for the finite-dimension argument. -/ +theorem bounded (Y : FiniteSelectionFamily.S.{0}) (r : ℕ) : + (object Y r).IsGE (-((r * (3 * length + 4) : ℕ) : ℤ)) ∧ + (object Y r).IsLE 0 := by + simpa only [SelectedOrdinaryDimension.bound, Nat.add_assoc] using + SelectedBaseIterates.bounded SelectedOrdinaryDimension.bound + SelectedOrdinaryDimension.left_module Y r + +/-- A nonzero actual iterate is detected in a finite, explicit cohomological window. -/ +theorem nonzero_in_window (Y : FiniteSelectionFamily.S.{0}) (r : ℕ) + (h : ¬ Limits.IsZero (object Y r)) : + ∃ n : ℕ, n ≤ r * (3 * length + 4) ∧ + ¬ Limits.IsZero ((DerivedCategory.homologyFunctor (ModuleCat D) (-(n : ℤ))).obj + (object Y r)) := by + simpa only [SelectedOrdinaryDimension.bound, Nat.add_assoc] using + DerivedBar.IterateSupport.nonzero_in_finite_window ℂ D + SelectedOrdinaryDimension.bound SelectedOrdinaryDimension.left_module X (input Y) r h + +/-- Any additive terminal tensor applied to a resolved actual iterate has a +uniform finite homological bound. This supplies the later residue/simple tests. -/ +theorem terminal_exact {E : Type*} [Category E] [Abelian E] + (F : ModuleCat.{0} D ⥤ E) [F.Additive] + (Y : FiniteSelectionFamily.S.{0}) (r n : ℕ) + (hn : (r+1) * (3 * length + 4) < n) : + ((F.mapHomologicalComplex (.down ℕ)).obj + (DerivedBar.barTotal ℂ D (DerivedBar.IterateSupport.resolvedModel ℂ D X (input Y) r))).ExactAt n := by + apply DerivedBar.IterateSupport.iterated_additive_exact_above ℂ D F + SelectedOrdinaryDimension.bound SelectedOrdinaryDimension.left_module X (input Y) r n + simpa only [SelectedOrdinaryDimension.bound, Nat.add_assoc] using hn +end LittleFinitistic.SelectedFiniteAmplitude + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedFiniteTensorEvaluation.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedFiniteTensorEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..0765b17b80ccc6d3f7bfbc239ddbd1d805831ab0 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedFiniteTensorEvaluation.lean @@ -0,0 +1,41 @@ +import OAI.Algebra.Finitistic.Localization.HomotopyEvaluation +import Mathlib.RingTheory.TensorProduct.Finite +import Mathlib.LinearAlgebra.FiniteDimensional.Basic + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.BalancedTensor +universe u v w z +variable {k : Type u} [Field k] {A : Type v} [Ring A] [Algebra k A] +variable (N : Type z) [AddCommGroup N] [Module k N] [Module A N] + +instance tensorFinite (M : Type w) [AddCommGroup M] [Module k M] [Module Aᵐᵒᵖ M] + [FiniteDimensional k M] [FiniteDimensional k N] : FiniteDimensional k (Tensor k A M N) := by + unfold Tensor + infer_instance + +theorem tensorFunctor_finite [FiniteDimensional k Aᵐᵒᵖ] [FiniteDimensional k N] + (M : ModuleCat.{w} Aᵐᵒᵖ) [Module.Finite Aᵐᵒᵖ M] : + FiniteDimensional k ((tensorFunctor k A N).obj M) := by + let : Module.Finite Aᵐᵒᵖ (ScalarModule k A M) := inferInstanceAs (Module.Finite Aᵐᵒᵖ M) + let : Module.Finite k (ScalarModule k A M) := Module.Finite.trans Aᵐᵒᵖ (ScalarModule k A M) + exact inferInstanceAs (FiniteDimensional k (Tensor k A (ScalarModule k A M) N)) + +/-- The termwise evaluation preserves every actual zero term, hence bounded support. -/ +theorem complex_zero (K : CochainComplex (ModuleCat.{w} Aᵐᵒᵖ) ℤ) (i : ℤ) + (h : IsZero (K.X i)) : + IsZero (((tensorFunctor k A N).mapHomologicalComplex (ComplexShape.up ℤ)).obj K |>.X i) := + (tensorFunctor k A N).map_isZero h + +/-- A bounded input has a bounded output with the same interval of possible nonzero terms. -/ +theorem bounded_support (K : CochainComplex (ModuleCat.{w} Aᵐᵒᵖ) ℤ) (a b : ℤ) + (h : ∀ i, i < a ∨ b < i → IsZero (K.X i)) : + ∀ i, i < a ∨ b < i → + IsZero (((tensorFunctor k A N).mapHomologicalComplex (ComplexShape.up ℤ)).obj K |>.X i) := + fun i hi => complex_zero N K i (h i hi) +end LittleFinitistic.BalancedTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedFirstBlockFamily.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedFirstBlockFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..a895f4334d415129752d0ebe684821da213299f7 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedFirstBlockFamily.lean @@ -0,0 +1,80 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryRestrictionHomology +import Mathlib.Algebra.Homology.ShortComplex.ExactFunctor +import OAI.Algebra.Finitistic.Selected.SelectedBaseIterates +import OAI.Algebra.Finitistic.Selected.SelectedDerivedFunctor +import Mathlib.Algebra.Homology.DerivedCategory.ExactFunctor + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.SelectedFirstBlockFamily +attribute [local instance] preservesBinaryBiproducts_of_preservesBiproducts +open SelectedOrdinaryAlgebra SelectedFixedDiagram QuadraticEncoding +local instance : HasDerivedCategory.{1} (ModuleCat.{0} (B P)) := + HasDerivedCategory.standard (ModuleCat.{0} (B P)) +local instance : HasDerivedCategory.{1} (ModuleCat.{0} D) := + HasDerivedCategory.standard (ModuleCat.{0} D) + +/-- The actual exact inflation functor from B-modules to the first D-block. -/ +abbrev inflation : ModuleCat.{0} (B P) ⥤ ModuleCat.{0} D := ModuleCat.restrictScalars SelectedOrdinaryModules.firstProjection +instance inflation_preservesFiniteLimits : PreservesFiniteLimits inflation := by + have h : PreservesFiniteLimits inflation ∧ PreservesFiniteColimits inflation := + ((Functor.exact_tfae inflation).out 2 4).mp + (RestrictionHomology.mapsExact SelectedOrdinaryModules.firstProjection) + exact h.1 +instance inflation_preservesFiniteColimits : PreservesFiniteColimits inflation := by + have h : PreservesFiniteLimits inflation ∧ PreservesFiniteColimits inflation := + ((Functor.exact_tfae inflation).out 2 4).mp + (RestrictionHomology.mapsExact SelectedOrdinaryModules.firstProjection) + exact h.2 +abbrev derivedInflation := inflation.mapDerivedCategory + +instance derivedInflation_additive : derivedInflation.Additive := by + rw [Localization.functor_additive_iff DerivedCategory.Qh + (HomotopyCategory.subcategoryAcyclic (ModuleCat.{0} (B P))).trW] + exact Functor.additive_of_iso inflation.mapDerivedCategoryFactorsh.symm + +/-- This is the original selected input, with precisely its constructed D-action. -/ +def moduleIso (Y : FiniteSelectionFamily.S.{0}) : + inflation.obj (FiniteSelectionFamily.module Y) ≅ SelectedBaseIterates.input Y := + Iso.refl _ + +abbrev derived (Y : FiniteSelectionFamily.S.{0}) := + (DerivedCategory.singleFunctor (ModuleCat D) 0).obj (SelectedBaseIterates.input Y) + +/-- Exact inflation on derived categories agrees with the selected first-block stalk. -/ +def stalkIso (Y : FiniteSelectionFamily.S.{0}) : + derivedInflation.obj (FiniteSelectionFamily.derived Y) ≅ derived Y := + (inflation.mapDerivedCategorySingleFunctor 0).app (FiniteSelectionFamily.module Y) ≪≫ + (DerivedCategory.singleFunctor (ModuleCat D) 0).mapIso (moduleIso Y) + +theorem module_zero (Y : FiniteSelectionFamily.S.{0}) : + IsZero (SelectedBaseIterates.input Y) ↔ Subsingleton Y.val := by + rw [← FiniteSelectionFamily.module_zero Y] + rw [ModuleCat.isZero_iff_subsingleton, ModuleCat.isZero_iff_subsingleton] + rfl + +theorem derived_zero (Y : FiniteSelectionFamily.S.{0}) : + IsZero (derived Y) ↔ Subsingleton Y.val := by + rw [← module_zero Y] + constructor + · intro h + exact ((DerivedCategory.singleFunctorCompHomologyFunctorIso (ModuleCat D) 0).app + (SelectedBaseIterates.input Y)).isZero_iff.mp + ((DerivedCategory.homologyFunctor (ModuleCat D) 0).map_isZero h) + · exact (DerivedCategory.singleFunctor (ModuleCat D) 0).map_isZero + +/-- The already proved Phi realization, transported by the actual first-block +inflation, with no ordinary F² identity assumed or asserted. -/ +def inflated_realization (Y : FiniteSelectionFamily.S.{0}) : + derivedInflation.obj (SelectedDerivedFunctor.Phi.obj (FiniteSelectionFamily.derived Y)) ≅ + derived (FiniteSelectionFamily.H Y) ⊞ (derived (FiniteSelectionFamily.H Y))⟦(3 : ℤ)⟧ := + derivedInflation.mapIso (SelectedDerivedFunctor.comparison Y ≪≫ FiniteSelectionFamily.realization Y) ≪≫ + derivedInflation.mapBiprod _ _ ≪≫ + biprod.mapIso (stalkIso _) ((derivedInflation.commShiftIso (3 : ℤ)).app _ ≪≫ + (shiftFunctor _ (3 : ℤ)).mapIso (stalkIso _)) +end LittleFinitistic.SelectedFirstBlockFamily + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedFixedDiagram.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedFixedDiagram.lean new file mode 100644 index 0000000000000000000000000000000000000000..a1f28473badfd18051d621cfdb592cc1fc1ecc93 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedFixedDiagram.lean @@ -0,0 +1,66 @@ +import OAI.Algebra.Finitistic.Localization.SourceQuotientAction +import OAI.Algebra.Finitistic.Localization.ConcreteFixedDiagram + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits CategoryTheory.Idempotents +namespace LittleFinitistic.SelectedFixedDiagram +open SelectionEncoding RelationBasisCoefficients RelationBasisAction FormalSummandAction + +abbrev encoding := auxiliaryEncoding +abbrev P := encoding.relations +abbrev theta := SourceQuotientAction.theta encoding +abbrev e := selectionIdempotent 0 +abbrev alpha := (selectionAutomorphism 1).toAlgHom +lemma idem : e*e=e := selectionIdempotent_square 0 +lemma central (r : SelectionRing) : e*r=r*e := (selectionIdempotent_central 0 r).eq + +local instance : HasFiniteBiproducts (Karoubi (SourceVerdier.Q P)) := + Karoubi.karoubi_hasFiniteBiproducts +local instance : HasBinaryBiproducts (Karoubi (SourceVerdier.Q P)) := + hasBinaryBiproducts_of_finite_biproducts _ + +abbrev U := summand theta e idem +abbrev oddDouble := U ⊞ OddDouble.formalShift U 3 +abbrev selectedAction := oddDoubleAction theta e idem central alpha + +/-- All choices, arrows, relation-basis equations and equivariant identifications +for the actual selecting algebra. No evaluation module is a parameter. -/ +structure Data where + V0 : SourceVerdier.Q P + rho : SelectionRing →ₐ[ℂ] End V0 + iso : (toKaroubi (SourceVerdier.Q P)).obj V0 ≅ oddDouble + D0 : SourceVerdier.K P + D1 : SourceVerdier.K P + D2 : SourceVerdier.K P + phi0 : (SourceVerdier.q P).obj D0 ≅ V0 + phi1 : (SourceVerdier.q P).obj D1 ≅ V0 + phi2 : (SourceVerdier.q P).obj D2 ≅ V0 + f : Fin (encoding.generators+1) → (D0 ⟶ D1) + g : Fin (encoding.generators+1) → (D1 ⟶ D2) + equivariant : ∀ r : SelectionRing, + (toKaroubi (SourceVerdier.Q P)).map (rho r) ≫ iso.hom = iso.hom ≫ selectedAction r + arrow01 : ∀ a, (SourceVerdier.q P).map (f a) ≫ phi1.hom = + phi0.hom ≫ rho (arrow (generator encoding) a) + arrow12 : ∀ b, (SourceVerdier.q P).map (g b) ≫ phi2.hom = + phi1.hom ≫ rho (arrow (generator encoding) b) + relations : ∀ r : RelationIndex P, + ∑ a, ∑ b, basisCoefficient P r a b • (f a ≫ g b) = 0 + +/-- Choose once, using the proved native finite-diagram theorem and actual theta. -/ +def fixed : Data := Classical.choice (by + obtain ⟨V,rho,i,D0,D1,D2,p0,p1,p2,f,g,he,hf,hg,hr⟩ := + ConcreteFixedDiagram.fixed_diagram encoding theta e idem central alpha + exact ⟨⟨V,rho,i,D0,D1,D2,p0,p1,p2,f,g,he,hf,hg,hr⟩⟩) + +theorem fixed_relations (r : RelationIndex P) : + ∑ a, ∑ b, basisCoefficient P r a b • (fixed.f a ≫ fixed.g b) = 0 := fixed.relations r + +theorem fixed_equivariant (r : SelectionRing) : + (toKaroubi (SourceVerdier.Q P)).map (fixed.rho r) ≫ fixed.iso.hom = + fixed.iso.hom ≫ selectedAction r := fixed.equivariant r +end LittleFinitistic.SelectedFixedDiagram + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedImageComparison.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedImageComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..29b00a9725aa80f45156b97b5bdb36649be66de4 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedImageComparison.lean @@ -0,0 +1,61 @@ +import OAI.Algebra.Finitistic.Localization.SourceCornerEvaluation +import OAI.Algebra.Finitistic.Selection.SelectionIteration + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.SelectedImageComparison +open QuadraticEncoding SourceImageEvaluation +universe v +variable {Y : Type v} [AddCommGroup Y] [Module ℂ Y] + [Module SelectionRing Y] [IsScalarTower ℂ SelectionRing Y] + +/-- The evaluator's range is canonically the primary's actual H(Y), as a complex vector space. -/ +def equiv : imageSpace (k := ℂ) (Y := Y) (selectionIdempotent 0) ≃ₗ[ℂ] + complexObject (selectionStep (ModuleCat.of SelectionRing Y)) where + toFun x := ⟨x.val.down, by + obtain ⟨z,hz⟩ := x.property + have hz' : selectionIdempotent 0 • z.down = x.val.down := congrArg ULift.down hz + change selectionIdempotent 0 • x.val.down = x.val.down + rw [← hz',← mul_smul,selectionIdempotent_square]⟩ + invFun x := ⟨ULift.up x.val, ⟨ULift.up x.val, by + change ULift.up (selectionIdempotent 0 • x.val) = ULift.up x.val + exact congrArg ULift.up x.property⟩⟩ + left_inv x := by apply Subtype.ext; rfl + right_inv x := by rfl + map_add' x y := rfl + map_smul' c x := by + apply Subtype.ext + change c • x.val.down = selectionAutomorphism 1 (algebraMap ℂ SelectionRing c) • x.val.down + rw [AlgEquiv.commutes,algebraMap_smul] + +abbrev moduleAction (r : SelectionRing) (x : selectionStep (ModuleCat.of SelectionRing Y)) : + selectionStep (ModuleCat.of SelectionRing Y) := r • x + +/-- The evaluator's compressed alpha action is precisely the action on the primary's H(Y). -/ +theorem equiv_action (r : SelectionRing) + (x : imageSpace (k := ℂ) (Y := Y) (selectionIdempotent 0)) : + equiv (Y := Y) ((imageCornerEnd (action (k := ℂ) (Y := Y) (selectionIdempotent 0)).hom + (action (k := ℂ) (Y := Y) (selectionAutomorphism 1 r)).hom) x) = + moduleAction (Y := Y) r (equiv (Y := Y) x) := by + apply Subtype.ext + have h := imageCorner_restriction (k := ℂ) (Y := Y) (selectionIdempotent 0) + (selectionAutomorphism 1 r) (selectionIdempotent_square 0) + (selectionIdempotent_central 0 (selectionAutomorphism 1 r)).eq x + exact congrArg ULift.down h + +theorem image_nontrivial_of (h : Nontrivial (selectionStep (ModuleCat.of SelectionRing Y))) : + Nontrivial (imageSpace (k := ℂ) (Y := Y) (selectionIdempotent 0)) := by + let i := equiv (Y := Y) + obtain ⟨x,y,hxy⟩ := h.exists_pair_ne + exact ⟨⟨i.symm x,i.symm y,fun h => hxy (i.symm.injective h)⟩⟩ + +theorem image_subsingleton_of (h : Subsingleton (selectionStep (ModuleCat.of SelectionRing Y))) : + Subsingleton (imageSpace (k := ℂ) (Y := Y) (selectionIdempotent 0)) := + ⟨fun first second => (equiv (Y := Y)).injective + (h.elim (equiv (Y := Y) first) (equiv (Y := Y) second))⟩ +end LittleFinitistic.SelectedImageComparison + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedIteration.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedIteration.lean new file mode 100644 index 0000000000000000000000000000000000000000..bf261e62b05680c1bad18f31fd2d6d769cbf61bb --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedIteration.lean @@ -0,0 +1,53 @@ +import OAI.Algebra.Finitistic.Selection.FiniteSelectionFamily +import OAI.Algebra.Finitistic.Iteration.ObjectwiseSplitting + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +attribute [local instance] HasDerivedCategory.standard HasExt.standard +namespace LittleFinitistic.SelectedIteration +open SelectedFixedDiagram QuadraticEncoding FiniteSelectionFamily + +variable (Phi : DerivedCategory (ModuleCat (B P)) ⥤ DerivedCategory (ModuleCat (B P))) + [Phi.Additive] [Phi.CommShift ℤ] +/- This is solely the remaining derived-tensor/stalk comparison. The realization +and exact reference cohomology have already been proved independently. -/ +variable (comparison : ∀ Y : S, Phi.obj (derived Y) ≅ + SelectedTensorSplitting.object (representation Y).Evaluation) +include comparison + +def split (Y : S) : Phi.obj (derived Y) ≅ derived (H Y) ⊞ (derived (H Y))⟦(3 : ℤ)⟧ := + comparison Y ≪≫ FiniteSelectionFamily.realization Y + +/-- The exact binomial formula, instantiated with the actual finite module family. -/ +def iteration (j : ℕ) (Y : S) : + (Phi.obj^[j]) (derived Y) ≅ + ⨁ fun q : Fin (j+1) => ⨁ fun _ : Fin (Nat.choose j q.val) => + (derived ((H^[j]) Y))⟦(3 : ℤ)*(q.val : ℤ)⟧ := + ExternalTensor.Binomial.section4Iteration Phi derived H (split Phi comparison) j Y + +private def shiftedSplit (Y : S) : + Phi.obj (derived Y) ≅ (derived (H Y))⟦(0 : ℤ)⟧ ⊞ (derived (H Y))⟦(0+3 : ℤ)⟧ := + split Phi comparison Y ≪≫ biprod.mapIso (shiftZero ℤ (derived (H Y))).symm (Iso.refl _) + +theorem isZero_iff (j : ℕ) (Y : S) : + IsZero ((Phi.obj^[j]) (derived Y)) ↔ Subsingleton (selectionIterate Y.val j) := by + rw [ExternalTensor.Binomial.iteration_isZero_iff Phi derived H 0 3 (shiftedSplit Phi comparison)] + rw [derived_zero, iterate_val] + +/-- Actual Section 2 tests give arbitrarily long finite extinction for this tensor +functor, once its stated stalk comparison is instantiated. -/ +theorem extinction (m : ℕ) [NeZero m] : + (∀ j < m, ¬ IsZero ((Phi.obj^[j]) (derived (test m)))) ∧ + IsZero ((Phi.obj^[m]) (derived (test m))) := by + constructor + · intro j hj hz + have hs := (isZero_iff Phi comparison j (test m)).mp hz + have hn := selectionIterate_test_nontrivial m j hj + exact @not_subsingleton _ hn hs + · exact (isZero_iff Phi comparison m (test m)).mpr (selectionIterate_test_subsingleton m) +end LittleFinitistic.SelectedIteration + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedMinimalResolution.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedMinimalResolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..5a052498639c1e698ca0839290f17e62f638ca20 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedMinimalResolution.lean @@ -0,0 +1,31 @@ +import OAI.Algebra.Finitistic.Selected.SelectedOrdinaryModules +import OAI.Algebra.Finitistic.Dimension.PDDimension + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.SelectedMinimalResolution +open SelectedOrdinaryAlgebra SelectedOrdinaryModules + +abbrev finiteModule (Y : FiniteSelectionFamily.S.{0}) : PDMinimal.FiniteModule ℂ A := + PDMinimal.FiniteModule.of (Inflated Y) + +/-- A genuine minimal projective resolution of each actual constructed A-module. -/ +def resolution (Y : FiniteSelectionFamily.S.{0}) : ProjectiveResolution (SelectedOrdinaryModules.module Y) := + PDMinimal.resolution (finiteModule Y) + +/-- The constructed A-module has projective dimension at most n precisely when +its actual minimal projective resolution has zero term n+1. -/ +theorem dimension_iff (Y : FiniteSelectionFamily.S.{0}) (n : ℕ) : + HasProjectiveDimensionLE (SelectedOrdinaryModules.module Y) n ↔ + Subsingleton (PDMinimal.term (finiteModule Y) (n+1)) := + PDMinimal.pdLE_iff_term_zero (finiteModule Y) n + +/-- The actual minimal-resolution terms are projective. -/ +theorem projective (Y : FiniteSelectionFamily.S.{0}) (n : ℕ) : + Projective ((resolution Y).complex.X n) := inferInstance +end LittleFinitistic.SelectedMinimalResolution + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedNativeAction.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedNativeAction.lean new file mode 100644 index 0000000000000000000000000000000000000000..84e2f79b62629f96048e9ddf18cc85d5c27e2609 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedNativeAction.lean @@ -0,0 +1,104 @@ +import OAI.Algebra.Finitistic.Selected.SelectedNativeEvaluation + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +attribute [local instance] HasDerivedCategory.standard +namespace LittleFinitistic.SelectedNativeEvaluation +open QuadraticEncoding SourceImageEvaluation FiniteProjectiveHomotopy SelectedFixedDiagram +universe v +variable {Y : Type v} [AddCommGroup Y] [Module ℂ Y] + [Module SelectionRing Y] [IsScalarTower ℂ SelectionRing Y] + +abbrev imageEnd (r : SelectionRing) := imageCornerEnd + (action (k := ℂ) (Y := Y) e).hom (action (k := ℂ) (Y := Y) (alpha r)).hom +abbrev moduleIso := (SelectedImageComparison.equiv (Y := Y)).toModuleIso + +def HAction (r : SelectionRing) : End (H (Y := Y)) := + (moduleIso (Y := Y)).inv ≫ imageEnd (Y := Y) r ≫ (moduleIso (Y := Y)).hom + +/-- The conjugated map is the primary selectionStep module action, on every vector. -/ +theorem HAction_apply (r : SelectionRing) (x : H (Y := Y)) : + (HAction (Y := Y) r).hom x = SelectedImageComparison.moduleAction (Y := Y) r x := by + have h := SelectedImageComparison.equiv_action (Y := Y) r + ((SelectedImageComparison.equiv (Y := Y)).symm x) + dsimp only [HAction,moduleIso,LinearEquiv.toModuleIso] at * + simp only [LinearEquiv.apply_symm_apply] at h + exact h + +lemma module_square (r : SelectionRing) : + imageEnd (Y := Y) r ≫ (moduleIso (Y := Y)).hom = + (moduleIso (Y := Y)).hom ≫ HAction (Y := Y) r := by + simp only [HAction,Iso.hom_inv_id_assoc] + +variable [FiniteDimensional ℂ Y] + +def HKAction (r : SelectionRing) : End (HK (Y := Y)) := + (inclusion ℂ).preimage ((vectorStalk (k := ℂ)).map (HAction (Y := Y) r)) +def HDerivedAction (r : SelectionRing) : End (HDerived (Y := Y)) := + (derivedEmbedding ℂ).toEssImage.map (HKAction (Y := Y) r) + +lemma imageIsoK_hom : (inclusion ℂ).map (imageIsoK (Y := Y)).hom = + (vectorStalk (k := ℂ)).map (moduleIso (Y := Y)).hom := by + simp only [imageIsoK,Functor.preimageIso,Functor.mapIso_hom] + erw [Functor.map_preimage] + +lemma image_square (r : SelectionRing) : + imageCorner (k := ℂ) (Y := Y) e (alpha r) ≫ (imageIso (Y := Y)).hom = + (imageIso (Y := Y)).hom ≫ HDerivedAction (Y := Y) r := by + apply (derivedTargetInclusion (k := ℂ)).map_injective + rw [Functor.map_comp,Functor.map_comp] + dsimp only [imageCorner] + erw [Functor.map_preimage] + change DerivedCategory.Qh.map ((vectorStalk (k := ℂ)).map (imageEnd (Y := Y) r)) ≫ + DerivedCategory.Qh.map ((inclusion ℂ).map (imageIsoK (Y := Y)).hom) = + DerivedCategory.Qh.map ((inclusion ℂ).map (imageIsoK (Y := Y)).hom) ≫ + DerivedCategory.Qh.map ((inclusion ℂ).map (HKAction (Y := Y) r)) + rw [imageIsoK_hom] + dsimp only [HKAction] + erw [Functor.map_preimage] + erw [← Functor.map_comp,← Functor.map_comp,← Functor.map_comp,← Functor.map_comp,module_square] + rfl + +abbrev targetAction (r : SelectionRing) : End (target (Y := Y)) := + biprod.map (HDerivedAction (Y := Y) r) ((HDerivedAction (Y := Y) r)⟦(3 : ℤ)⟧') + +lemma target_square (r : SelectionRing) : + SelectedDiagramEvaluation.targetAction (Y := Y) r ≫ (targetIso (Y := Y)).hom = + (targetIso (Y := Y)).hom ≫ targetAction (Y := Y) r := by + have h := image_square (Y := Y) r + have hs := congrArg (shiftFunctor (FiniteVectorDerived.{0,v} (k := ℂ)) (3 : ℤ)).map h + simp only [Functor.map_comp] at hs + dsimp only [SelectedDiagramEvaluation.targetAction,targetIso,targetAction,biprod.mapIso] + apply biprod.hom_ext + · simp only [Category.assoc,biprod.map_fst,biprod.map_fst_assoc,h] + · simp only [Category.assoc,biprod.map_snd,biprod.map_snd_assoc,Functor.mapIso_hom,hs] + +/-- The fixed V0 evaluates equivariantly to the primary H(Y) plus H(Y)[3]. -/ +theorem V0_action (r : SelectionRing) : + (SelectedDiagramEvaluation.F (Y := Y)).map (fixed.rho r) ≫ (V0Iso (Y := Y)).hom = + (V0Iso (Y := Y)).hom ≫ targetAction (Y := Y) r := + DiagramEvaluationSquares.compose _ _ _ SelectedDiagramEvaluation.V0Iso + SelectedDiagramEvaluation.V0Iso targetIso targetIso + (SelectedDiagramEvaluation.V0_action r) (target_square r) + +theorem D_arrow01 (a : Fin (encoding.generators+1)) : + (SelectedDiagramEvaluation.sourceEvaluation (Y := Y)).map (fixed.f a) ≫ (D1Iso (Y := Y)).hom = + (D0Iso (Y := Y)).hom ≫ targetAction (Y := Y) + (RelationBasisAction.arrow (SelectionEncoding.generator encoding) a) := + DiagramEvaluationSquares.compose _ _ _ SelectedDiagramEvaluation.D0Iso + SelectedDiagramEvaluation.D1Iso targetIso targetIso + (SelectedDiagramEvaluation.D_arrow01 a) (target_square _) + +theorem D_arrow12 (a : Fin (encoding.generators+1)) : + (SelectedDiagramEvaluation.sourceEvaluation (Y := Y)).map (fixed.g a) ≫ (D2Iso (Y := Y)).hom = + (D1Iso (Y := Y)).hom ≫ targetAction (Y := Y) + (RelationBasisAction.arrow (SelectionEncoding.generator encoding) a) := + DiagramEvaluationSquares.compose _ _ _ SelectedDiagramEvaluation.D1Iso + SelectedDiagramEvaluation.D2Iso targetIso targetIso + (SelectedDiagramEvaluation.D_arrow12 a) (target_square _) +end LittleFinitistic.SelectedNativeEvaluation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedNativeEvaluation.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedNativeEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..de8c264adf9a302cbfd50ba0981a3dbcc0016c92 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedNativeEvaluation.lean @@ -0,0 +1,47 @@ +import OAI.Algebra.Finitistic.Selected.SelectedDiagramEvaluation +import OAI.Algebra.Finitistic.Selected.SelectedImageComparison + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +attribute [local instance] HasDerivedCategory.standard +namespace LittleFinitistic.SelectedNativeEvaluation +open QuadraticEncoding SourceImageEvaluation FiniteProjectiveHomotopy SelectedFixedDiagram +universe v +variable {Y : Type v} [AddCommGroup Y] [Module ℂ Y] [FiniteDimensional ℂ Y] + [Module SelectionRing Y] [IsScalarTower ℂ SelectionRing Y] + +abbrev H := complexObject (selectionStep (ModuleCat.of SelectionRing Y)) +instance : FiniteDimensional ℂ (H (Y := Y)) := + Module.Finite.of_surjective (SelectedImageComparison.equiv (Y := Y)).toLinearMap + (SelectedImageComparison.equiv (Y := Y)).surjective + +def HK : K.{0,v} ℂ := ⟨(vectorStalk (k := ℂ)).obj (H (Y := Y)), single_property _ 0⟩ +def HDerived : FiniteVectorDerived.{0,v} (k := ℂ) := + (derivedEmbedding ℂ).toEssImage.obj (HK (Y := Y)) +def imageIsoK : imageK (k := ℂ) (Y := Y) e ≅ HK (Y := Y) := + (inclusion ℂ).preimageIso ((vectorStalk (k := ℂ)).mapIso + (SelectedImageComparison.equiv (Y := Y)).toModuleIso) +def imageIso : imageDerived (k := ℂ) (Y := Y) e ≅ HDerived (Y := Y) := + (derivedEmbedding ℂ).toEssImage.mapIso (imageIsoK (Y := Y)) + +/-- The actual primary H(Y), concentrated in degree zero, and its shift by three. -/ +abbrev target := HDerived (Y := Y) ⊞ (HDerived (Y := Y))⟦(3 : ℤ)⟧ +def targetIso : SelectedDiagramEvaluation.target (Y := Y) ≅ target (Y := Y) := + biprod.mapIso (imageIso (Y := Y)) + ((shiftFunctor (FiniteVectorDerived.{0,v} (k := ℂ)) (3 : ℤ)).mapIso (imageIso (Y := Y))) + +def V0Iso : (SelectedDiagramEvaluation.F (Y := Y)).obj fixed.V0 ≅ target (Y := Y) := + SelectedDiagramEvaluation.V0Iso ≪≫ targetIso + +def D0Iso : (SelectedDiagramEvaluation.sourceEvaluation (Y := Y)).obj fixed.D0 ≅ target (Y := Y) := + SelectedDiagramEvaluation.D0Iso ≪≫ targetIso +def D1Iso : (SelectedDiagramEvaluation.sourceEvaluation (Y := Y)).obj fixed.D1 ≅ target (Y := Y) := + SelectedDiagramEvaluation.D1Iso ≪≫ targetIso +def D2Iso : (SelectedDiagramEvaluation.sourceEvaluation (Y := Y)).obj fixed.D2 ≅ target (Y := Y) := + SelectedDiagramEvaluation.D2Iso ≪≫ targetIso +end LittleFinitistic.SelectedNativeEvaluation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedOrdinaryAlgebra.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedOrdinaryAlgebra.lean new file mode 100644 index 0000000000000000000000000000000000000000..68f9d50fe4c3266719c1eccd73fece508835ceeb --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedOrdinaryAlgebra.lean @@ -0,0 +1,63 @@ +import OAI.Algebra.Finitistic.Selected.SelectedWindow +import OAI.Algebra.Finitistic.Ordinary.OrdinaryBlockBimodule +import OAI.Algebra.Finitistic.Ordinary.OrdinaryRightProjective +import Mathlib.Algebra.TrivSqZeroExt.Basic + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.SelectedOrdinaryAlgebra +open SelectedFixedDiagram QuadraticEncoding +open OrdinarySimulation + +/-- A fixed support interval containing degree zero, chosen before any test module. -/ +def a : ℤ := min (SelectedWindow.lo-2) 0 +def b : ℤ := max SelectedWindow.hi 0 +def length : ℕ := (b-a).toNat + +theorem a_le_zero : a ≤ 0 := min_le_right _ _ +theorem b_nonneg : 0 ≤ b := le_max_right _ _ +theorem endpoints : a + (length : ℤ) = b := by + have ha := a_le_zero + have hb := b_nonneg + dsimp [length] + omega + +theorem support (n : ℤ) (hn : n < a ∨ b < n) : + IsZero (SelectedRectification.bimodule.X n) := by + apply SelectedWindow.bounded n + dsimp [a,b] at hn + omega + +instance term_finite (n : ℤ) : + FiniteDimensional ℂ ((underlyingComplex (k := ℂ) SelectedRectification.bimodule).X n) := + SelectedWindow.verified.finite n +instance term_projective (n : ℤ) : + Module.Projective (B P)ᵐᵒᵖ ((underlyingRightComplex SelectedRectification.bimodule).X n) := by + let : Projective ((underlyingRightComplex SelectedRectification.bimodule).X n) := + SelectedWindow.verified.projective n + exact ModuleCat.projective_of_module_projective _ + +/-- The actual finite-dimensional ordinary algebra and off-diagonal bimodule. -/ +abbrev D := AlgebraD ℂ length (B P) +abbrev O := BimoduleO SelectedRectification.bimodule a length +abbrev X := BimoduleX SelectedRectification.bimodule a length +instance base_finite : FiniteDimensional ℂ (B P) := QuadraticEncoding.finiteDimensional P +instance D_finite : FiniteDimensional ℂ D := inferInstance +instance O_finite : FiniteDimensional ℂ O := inferInstance +instance X_finite : FiniteDimensional ℂ X := ordinary_finite _ _ _ +instance O_right_projective : Module.Projective (B P)ᵐᵒᵖ O := + ordinaryO_right_projective _ _ _ + +/-- The manuscript's one fixed square-zero algebra. No projective-dimension +conclusion is asserted here. -/ +abbrev A := TrivSqZeroExt D X +abbrev augmentation : A →ₐ[ℂ] D := TrivSqZeroExt.fstHom ℂ D X + +instance A_finite : FiniteDimensional ℂ A := + inferInstanceAs (FiniteDimensional ℂ (D × X)) +end LittleFinitistic.SelectedOrdinaryAlgebra + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedOrdinaryDimension.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedOrdinaryDimension.lean new file mode 100644 index 0000000000000000000000000000000000000000..4a6685512813052a2fc113820b5fe1a255fea1d6 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedOrdinaryDimension.lean @@ -0,0 +1,30 @@ +import OAI.Algebra.Finitistic.Selected.SelectedOrdinaryAlgebra +import OAI.Algebra.Finitistic.Ordinary.OrdinaryGlobalDimension + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.SelectedOrdinaryDimension +open SelectedOrdinaryAlgebra SelectedFixedDiagram + +/-- A fixed numerical bound determined solely by the fixed selecting bimodule. -/ +abbrev bound : ℕ := 3 * length + 2 + +/-- The actual D has the manuscript's global dimension bound on both sides. -/ +theorem both_sides : + (⨆ M : ModuleCat.{0} D, projectiveDimension M) ≤ bound ∧ + (⨆ M : ModuleCat.{0} Dᵐᵒᵖ, projectiveDimension M) ≤ bound := + OrdinarySimulation.source_ordinary_globalDimension_bound (QuadraticEncoding.composition P) length + +theorem left_module (M : ModuleCat.{0} D) : HasProjectiveDimensionLE M bound := by + apply (projectiveDimension_le_iff M bound).mp + exact (le_iSup (fun N : ModuleCat.{0} D => projectiveDimension N) M).trans both_sides.1 + +theorem right_module (M : ModuleCat.{0} Dᵐᵒᵖ) : HasProjectiveDimensionLE M bound := by + apply (projectiveDimension_le_iff M bound).mp + exact (le_iSup (fun N : ModuleCat.{0} Dᵐᵒᵖ => projectiveDimension N) M).trans both_sides.2 +end LittleFinitistic.SelectedOrdinaryDimension + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedOrdinaryModules.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedOrdinaryModules.lean new file mode 100644 index 0000000000000000000000000000000000000000..925d38147c81e896b6863f6faad4e75c5a6e9676 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedOrdinaryModules.lean @@ -0,0 +1,73 @@ +import OAI.Algebra.Finitistic.Selected.SelectedOrdinaryAlgebra +import OAI.Algebra.Finitistic.Selection.FiniteSelectionFamily + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.SelectedOrdinaryModules +open SelectedFixedDiagram QuadraticEncoding SelectedOrdinaryAlgebra +open FiniteSelectionFamily + +/-- The source module M(Y), supported on the first D-block and inflated to A. -/ +def Inflated (Y : S.{0}) := (representation Y).Evaluation +instance (Y : S.{0}) : AddCommGroup (Inflated Y) := + inferInstanceAs (AddCommGroup (representation Y).Evaluation) +instance (Y : S.{0}) : Module ℂ (Inflated Y) := + inferInstanceAs (Module ℂ (representation Y).Evaluation) +instance (Y : S.{0}) : Module (B P) (Inflated Y) := + inferInstanceAs (Module (B P) (representation Y).Evaluation) +instance (Y : S.{0}) : IsScalarTower ℂ (B P) (Inflated Y) := + inferInstanceAs (IsScalarTower ℂ (B P) (representation Y).Evaluation) + +abbrev firstProjection : D →+* B P := RingHom.fst _ _ +abbrev augmentationRing : A →+* D := SelectedOrdinaryAlgebra.augmentation.toRingHom +instance (Y : S.{0}) : Module D (Inflated Y) := Module.compHom (Inflated Y) firstProjection +instance (Y : S.{0}) : Module A (Inflated Y) := + Module.compHom (Inflated Y) (firstProjection.comp augmentationRing) +instance (Y : S.{0}) : IsScalarTower ℂ D (Inflated Y) where + smul_assoc c d x := by + change (c • d.1) • x = c • (d.1 • x) + exact smul_assoc c d.1 x +instance (Y : S.{0}) : IsScalarTower ℂ A (Inflated Y) where + smul_assoc c a x := by + change (c • a.fst.1) • x = c • (a.fst.1 • x) + exact smul_assoc c a.fst.1 x +instance (Y : S.{0}) : FiniteDimensional ℂ (Inflated Y) := + inferInstanceAs (FiniteDimensional ℂ (representation Y).Evaluation) + +instance (Y : S.{0}) : Module.Finite A (Inflated Y) := + Module.Finite.of_restrictScalars_finite ℂ A (Inflated Y) + +abbrev module (Y : S.{0}) := ModuleCat.of A (Inflated Y) + +/-- The actual D-action is exactly the original first B-block action. -/ +theorem first_action (Y : S.{0}) (d : D) (n : Inflated Y) : d • n = d.1 • n := rfl +/-- The square-zero ideal acts by zero, as required by the bar calculation. -/ +theorem ideal_annihilates (Y : S.{0}) (x : X) (n : Inflated Y) : + (TrivSqZeroExt.inr x : A) • n = 0 := by + change (0 : B P) • n = 0 + exact zero_smul _ _ +theorem base_action (Y : S.{0}) (d : D) (n : Inflated Y) : + (TrivSqZeroExt.inl d : A) • n = d • n := rfl + +/-- Inflation preserves exactly the original module's zero criterion. -/ +theorem isZero_iff (Y : S.{0}) : IsZero (module Y) ↔ Subsingleton Y.val := by + rw [← FiniteSelectionFamily.module_zero Y] + change IsZero (ModuleCat.of A (Inflated Y)) ↔ IsZero (FiniteSelectionFamily.module Y) + rw [ModuleCat.isZero_iff_subsingleton, ModuleCat.isZero_iff_subsingleton] + rfl + +/-- Actual finite-dimensional modules over the one fixed A; their projective + dimensions are the remaining homological conclusion. -/ +abbrev testModule (m : ℕ) [NeZero m] := module (test m) + +theorem test_nonzero (m : ℕ) [NeZero m] : ¬ IsZero (testModule m) := by + intro h + have hs := (isZero_iff (test m)).mp h + have hn := selectionIterate_test_nontrivial m 0 (NeZero.pos m) + exact @not_subsingleton _ hn hs +end LittleFinitistic.SelectedOrdinaryModules + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedOrdinaryOrbit.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedOrdinaryOrbit.lean new file mode 100644 index 0000000000000000000000000000000000000000..ff4b20d434e7c010cebef86e21039eb370f95b9c --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedOrdinaryOrbit.lean @@ -0,0 +1,83 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleShiftedPresentation +import OAI.Algebra.Finitistic.Ordinary.OrdinaryFirstDerivedRetraction +import OAI.Algebra.Finitistic.Ordinary.OrdinaryDerivedIterates +import OAI.Algebra.Finitistic.Selected.SelectedShiftedRealization +import OAI.Algebra.Finitistic.Selected.SelectedBarPowers +import OAI.Algebra.Finitistic.Iteration.FunctorObjectIteration + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +open scoped TensorProduct +namespace LittleFinitistic.SelectedOrdinaryOrbit +open SelectedOrdinaryAlgebra SelectedFixedDiagram QuadraticEncoding +local instance : HasDerivedCategory.{1} (ModuleCat.{0} D) := + HasDerivedCategory.standard (ModuleCat.{0} D) +local instance : HasDerivedCategory.{1} (ModuleCat.{0} (B P)) := + HasDerivedCategory.standard (ModuleCat.{0} (B P)) + +abbrev first := BlockModule.derivedFirst (B P) ((B P) ⊗[ℂ] OrdinarySimulation.ChainAlgebra ℂ length) +abbrev ordinary := SelectedOrdinaryResolution.derived + +/-- The source's first-block localization is the actual selected exact inflation. -/ +def firstIso : first ≅ SelectedFirstBlockFamily.derivedInflation := + BlockModule.derivedFirstIso (B P) ((B P) ⊗[ℂ] OrdinarySimulation.ChainAlgebra ℂ length) + +def firstStalk (Y : FiniteSelectionFamily.S.{0}) : + first.obj (FiniteSelectionFamily.derived Y) ≅ SelectedFirstBlockFamily.derived Y := + firstIso.app _ ≪≫ SelectedFirstBlockFamily.stalkIso Y + +local instance resolution_projective : ∀ n, Module.Projective Dᵐᵒᵖ + (ComplexTensor.rightTerm ℂ D (BimoduleTotal.right ℂ D SelectedOrdinaryResolution.complex) n) := + fun n => SelectedOrdinaryResolution.right_projective n + +/-- Both tensor presentations use the identical Q_X and signed finite total. -/ +def nativeIso : ordinary ≅ SelectedBarComparison.native := + BimoduleTotalPresentation.boundedNonpositiveDerivedIso ℂ D SelectedOrdinaryResolution.complex + SelectedBarComparison.resolution.data length rfl rfl + +/-- The source's shifted P[b] tensor is the concrete selecting shifted model. -/ +def shiftedIso : OrdinarySimulation.shiftedDerivedTensor SelectedRectification.bimodule b length ≅ + SelectedShiftedRealization.G := + BimoduleTotalPresentation.shiftedDerivedIso SelectedRectification.bimodule b length + SelectedShiftedRealization.model rfl rfl + +/-- Every ordinary iterate on the selected first-block stalk is the original bar iterate. -/ +def barPower (Y : FiniteSelectionFamily.S.{0}) (r : ℕ) : + (ordinary.obj^[r]) (SelectedFirstBlockFamily.derived Y) ≅ SelectedBaseIterates.object Y r := + functorObjectIteration nativeIso r _ ≪≫ SelectedBarPowers.comparison Y r + +/-- Exact Section 5 even-iteration formula, with both presentation distinctions discharged. -/ +def evenIteration (Y : FiniteSelectionFamily.S.{0}) (j : ℕ) : + SelectedBaseIterates.object Y (2*j) ≅ + first.obj ((SelectedShiftedRealization.G.obj^[j]) (FiniteSelectionFamily.derived Y)) := + (barPower Y (2*j)).symm ≪≫ mapObjectIteration ordinary (firstStalk Y).symm (2*j) ≪≫ + OrdinarySimulation.XResolution.derivedEvenIterate SelectedRectification.bimodule a length b + endpoints support j (FiniteSelectionFamily.derived Y) ≪≫ + first.mapIso (functorObjectIteration shiftedIso j _) + +/-- Every even original-X iterate is zero exactly at the original selection stopping time. -/ +theorem isZero_iff (Y : FiniteSelectionFamily.S.{0}) (j : ℕ) : + IsZero (SelectedBaseIterates.object Y (2*j)) ↔ Subsingleton (selectionIterate Y.val j) := + (evenIteration Y j).isZero_iff.trans + ((BlockModule.derivedFirst_isZero_iff (B P) + ((B P) ⊗[ℂ] OrdinarySimulation.ChainAlgebra ℂ length) _).trans + (SelectedShiftedRealization.isZero_iff j Y)) + +/-- Actual extinction/survival pair required by the main theorem, on one fixed A. -/ +theorem extinction (m : ℕ) [NeZero m] : + IsZero (SelectedBaseIterates.object (FiniteSelectionFamily.test m) (2*m)) ∧ + ¬ IsZero (SelectedBaseIterates.object (FiniteSelectionFamily.test m) (2*m-2)) := by + constructor + · exact (isZero_iff (FiniteSelectionFamily.test m) m).mpr (selectionIterate_test_subsingleton m) + · have hm := NeZero.pos m + have he : 2*m-2 = 2*(m-1) := by omega + rw [he] + intro hz + exact @not_subsingleton _ (selectionIterate_test_nontrivial m (m-1) (by omega)) + ((isZero_iff (FiniteSelectionFamily.test m) (m-1)).mp hz) +end LittleFinitistic.SelectedOrdinaryOrbit + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedOrdinaryResolution.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedOrdinaryResolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..e33397c50a3a4b88e00d505be19f34db430bd82d --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedOrdinaryResolution.lean @@ -0,0 +1,37 @@ +import OAI.Algebra.Finitistic.Selected.SelectedOrdinaryAlgebra +import OAI.Algebra.Finitistic.Ordinary.OrdinaryXDerivedTensor + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.SelectedOrdinaryResolution +open SelectedOrdinaryAlgebra + +/-- The one fixed genuine D-bimodule resolution Q_X used by the source. -/ +abbrev complex := OrdinarySimulation.XResolution.complex SelectedRectification.bimodule a length +abbrev target := OrdinarySimulation.XResolution.ordinaryXObject SelectedRectification.bimodule a length +abbrev augmentation := OrdinarySimulation.XResolution.augmentationToX + SelectedRectification.bimodule a length + +theorem augmentation_quasiIso : QuasiIso augmentation := + OrdinarySimulation.XResolution.augmentationToX_quasiIso SelectedRectification.bimodule a length + +theorem right_projective (n : ℤ) : Module.Projective Dᵐᵒᵖ + (BimoduleCoefficients ℂ D D (complex.X n)) := + OrdinarySimulation.XResolution.right_projective SelectedRectification.bimodule a length n + +theorem bounded (n : ℤ) (hn : n < -(length : ℤ) ∨ 0 < n) : IsZero (complex.X n) := + OrdinarySimulation.XResolution.vanishes SelectedRectification.bimodule a length n hn + +local instance : HasDerivedCategory.{1} (ModuleCat.{0} D) := + HasDerivedCategory.standard (ModuleCat.{0} D) + +/-- Tensor via the actual bounded right-projective Q_X, with the left D-action retained. -/ +abbrev derived := OrdinarySimulation.XResolution.derivedTensor SelectedRectification.bimodule a length +abbrev comparison := OrdinarySimulation.XResolution.derivedTensorComparison + SelectedRectification.bimodule a length +end LittleFinitistic.SelectedOrdinaryResolution + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedPDBarConsumer.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedPDBarConsumer.lean new file mode 100644 index 0000000000000000000000000000000000000000..65f89923d4c818774cf29a6612a152c08412f0ba --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedPDBarConsumer.lean @@ -0,0 +1,44 @@ +import OAI.Algebra.Finitistic.Selected.SelectedPDDetection +import OAI.Algebra.Finitistic.Dimension.PDBaseBarConsumer + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.SelectedPDDetection +open SelectedOrdinaryAlgebra SelectedOrdinaryModules + +/-- The literal two-sided bar over the one fixed square-zero algebra. -/ +abbrev baseBar (Y : FiniteSelectionFamily.S.{0}) := + DerivedBar.twoSidedComplex ℂ A D (Inflated Y) augmentation + +/-- Actual Tor at the native bar model, using the canonical augmentation. -/ +def torIsoBaseBar (Y : FiniteSelectionFamily.S.{0}) (n : ℕ) : + PDTensor.Tor (k := ℂ) (PDBarQuotient.RightBase augmentation) (module Y) n ≅ + (((ModuleCat.restrictScalars (algebraMap ℂ D)).mapHomologicalComplex _).obj + (baseBar Y)).homology n := + PDBarQuotient.torIsoTwoSided augmentation (Inflated Y) n + +theorem lower_bound_of_base_bar (Y : FiniteSelectionFamily.S.{0}) + (r n : ℕ) (hrn : r ≤ n) (h : ¬ IsZero ((baseBar Y).homology n)) : + r ≤ projectiveDimension (module Y) := + PDBarQuotient.lower_bound_of_base_bar augmentation (Inflated Y) r n hrn h + +local instance : HasDerivedCategory.{1} (ModuleCat.{0} D) := + HasDerivedCategory.standard (ModuleCat.{0} D) + +/-- Native supplies its actual D-linear derived splitting and the surviving +summand's cohomology. The detector constructs the projective-dimension bound. -/ +theorem lower_bound_of_base_derived_bar (Y : FiniteSelectionFamily.S.{0}) + (Z T : DerivedCategory (ModuleCat.{0} D)) + (e : PDBarQuotient.baseDerived augmentation (Inflated Y) ≅ Z) + (i : T ⟶ Z) (p : Z ⟶ T) (hip : i ≫ p = 𝟙 T) + (r n : ℕ) (hrn : r ≤ n) + (h : ¬ IsZero ((DerivedCategory.homologyFunctor (ModuleCat D) (-(n : ℤ))).obj T)) : + r ≤ projectiveDimension (module Y) := + PDBarQuotient.lower_bound_of_base_derived_retract augmentation (Inflated Y) + Z T e i p hip r n hrn h +end LittleFinitistic.SelectedPDDetection + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedPDConclusion.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedPDConclusion.lean new file mode 100644 index 0000000000000000000000000000000000000000..8dd69355d0919b2590a4715c4a505136f20b3a83 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedPDConclusion.lean @@ -0,0 +1,58 @@ +import OAI.Algebra.Finitistic.Selected.SelectedPDUpperConsumer +import OAI.Algebra.Finitistic.Bar.CountTorBounds +import OAI.Algebra.Finitistic.Selected.SelectedCountExtinction + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.SelectedPDConclusion +open SelectedOrdinaryAlgebra SelectedOrdinaryModules +local instance : HasDerivedCategory.{1} (ModuleCat.{0} D) := + HasDerivedCategory.standard (ModuleCat.{0} D) + +/-- The canonical base-change Tor is computed by the actual selected bar, +independently of which compatible field-scalar instance presents that bar. -/ +def baseTorIso (Y : FiniteSelectionFamily.S.{0}) (n : ℕ) : + ((DerivedBar.Balanced.tensorFunctor augmentation).leftDerived n).obj (module Y) ≅ + (SelectedPDDetection.baseBar Y).homology n := + DerivedBar.Balanced.tensorBarHomologyIso augmentation (Inflated Y) n ≪≫ + (HomologicalComplex.homologyFunctor (ModuleCat D) (.down ℕ) n).mapIso + (DerivedBar.tensorBarIso ℂ A D (Inflated Y) augmentation) + +/-- Actual tensor extinction implies finite projective dimension over the +one fixed square-zero algebra A. The bar bounds and minimal detector are proved. -/ +theorem finite_pd_of_extinction (Y : FiniteSelectionFamily.S.{0}) (t : ℕ) + (h : IsZero (SelectedBaseIterates.object Y t)) : + projectiveDimension (module Y) < ⊤ := by + apply SelectedPDDetection.finite_pd_of_bounded_base_bar Y + refine ⟨t * (3 * length + 5), fun n hn => ?_⟩ + have hc := DerivedBar.ParityBridge.baseChangeTor_bounded_of_counts ℂ D X + (SelectedBaseIterates.input Y) (t * (3 * length + 5)) + (fun r n hn => SelectedCountExtinction.uniform_homology_zero Y t h r (-(n : ℤ)) + (Or.inl (by omega))) n hn + exact hc.of_iso (baseTorIso Y n).symm + +/-- A surviving actual derived iterate supplies a nonzero original count +class and hence the manuscript's projective-dimension lower bound. -/ +theorem lower_bound_of_survival (Y : FiniteSelectionFamily.S.{0}) (r : ℕ) + (h : ¬ IsZero (SelectedBaseIterates.object Y r)) : + (r : WithBot ℕ∞) ≤ projectiveDimension (module Y) := by + obtain ⟨n,hrn,_,hn⟩ := SelectedCountCohomology.nonzero_degree Y r h + have hc := DerivedBar.ParityBridge.baseChangeTor_nonzero_of_count ℂ D X + (SelectedBaseIterates.input Y) r n hn + apply SelectedPDDetection.lower_bound_of_base_bar Y r n hrn + intro hz + exact hc (hz.of_iso (baseTorIso Y n)) + +/-- Both conclusions of the manuscript's projective-dimension detector for +the actual finite selected family; no bar comparison or pd bound is a premise. -/ +theorem detection (Y : FiniteSelectionFamily.S.{0}) : + (∀ t, IsZero (SelectedBaseIterates.object Y t) → projectiveDimension (module Y) < ⊤) ∧ + (∀ r, ¬ IsZero (SelectedBaseIterates.object Y r) → + (r : WithBot ℕ∞) ≤ projectiveDimension (module Y)) := + ⟨finite_pd_of_extinction Y, lower_bound_of_survival Y⟩ +end LittleFinitistic.SelectedPDConclusion + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedPDDetection.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedPDDetection.lean new file mode 100644 index 0000000000000000000000000000000000000000..da7eefd9bd5c633b308de7606173950d28060f73 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedPDDetection.lean @@ -0,0 +1,77 @@ +import OAI.Algebra.Finitistic.Dimension.PDResidueScalar +import OAI.Algebra.Finitistic.Selected.SelectedBarResolution +import OAI.Algebra.Finitistic.Selected.SelectedMinimalResolution +import OAI.Algebra.Finitistic.Dimension.PDBarDetection +import OAI.Algebra.Finitistic.Dimension.PDDerivedBarConsumer +import OAI.Algebra.Finitistic.Dimension.PDSquareZeroResidue + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.SelectedPDDetection +open SelectedOrdinaryAlgebra SelectedOrdinaryModules + +instance residueModuleK : Module ℂ (PDTensor.Residue (A := A)) := PDResidueScalar.moduleK ℂ A +instance residueTowerK : IsScalarTower ℂ Aᵐᵒᵖ (PDTensor.Residue (A := A)) := PDResidueScalar.towerK ℂ A + +open SelectedMinimalResolution (finiteModule) + +abbrev barTensor (Y : FiniteSelectionFamily.S.{0}) + (U : Type) [AddCommGroup U] [Module ℂ U] [Module Aᵐᵒᵖ U] := + PDBar.tensorComplex (finiteModule Y) U (SelectedBarResolution.resolution Y) + +def torIsoBar (Y : FiniteSelectionFamily.S.{0}) + (U : Type) [AddCommGroup U] [Module ℂ U] [Module Aᵐᵒᵖ U] (n : ℕ) : + PDTensor.Tor (k := ℂ) U (module Y) n ≅ (barTensor Y U).homology n := + PDBar.torIsoResolution (finiteModule Y) U (SelectedBarResolution.resolution Y) n + +theorem pdLE_iff_residue_bar (Y : FiniteSelectionFamily.S.{0}) (n : ℕ) : + HasProjectiveDimensionLE (module Y) n ↔ + IsZero ((barTensor Y (PDTensor.Residue (A := A))).homology (n+1)) := + PDBar.pdLE_iff_residue_resolution (finiteModule Y) (SelectedBarResolution.resolution Y) n + +theorem pdLE_iff_simple_bar (Y : FiniteSelectionFamily.S.{0}) (n : ℕ) : + HasProjectiveDimensionLE (module Y) n ↔ + ∀ S : Submodule Aᵐᵒᵖ (PDTensor.Residue (A := A)), IsSimpleModule Aᵐᵒᵖ S → + IsZero ((barTensor Y S).homology (n+1)) := + PDBar.pdLE_iff_simple_resolution (finiteModule Y) (SelectedBarResolution.resolution Y) n + +theorem finite_pd_of_bar (Y : FiniteSelectionFamily.S.{0}) + (h : ∃ b : ℕ, ∀ n, b < n → + IsZero ((barTensor Y (PDTensor.Residue (A := A))).homology n)) : + projectiveDimension (module Y) < ⊤ := + PDTensor.finite_pd_of_resolution (finiteModule Y) (SelectedBarResolution.resolution Y) h + +theorem lower_bound_of_bar (Y : FiniteSelectionFamily.S.{0}) + (U : Type) [AddCommGroup U] [Module ℂ U] [Module Aᵐᵒᵖ U] + (r n : ℕ) (hrn : r ≤ n) (h : ¬ IsZero ((barTensor Y U).homology n)) : + r ≤ projectiveDimension (module Y) := + PDTensor.lower_bound_of_resolution (finiteModule Y) U + (SelectedBarResolution.resolution Y) r n hrn h + +local instance : HasDerivedCategory.{1} (ModuleCat.{0} ℂ) := + HasDerivedCategory.standard (ModuleCat.{0} ℂ) + +theorem finite_pd_of_derived_bar (Y : FiniteSelectionFamily.S.{0}) + (Z : DerivedCategory (ModuleCat.{0} ℂ)) + (e : PDBar.derivedObject (barTensor Y (PDTensor.Residue (A := A))) ≅ Z) + (h : ∃ b : ℕ, ∀ n, b < n → IsZero + ((DerivedCategory.homologyFunctor (ModuleCat ℂ) (-(n : ℤ))).obj Z)) : + projectiveDimension (module Y) < ⊤ := + PDBar.finite_pd_of_derived_iso (finiteModule Y) (SelectedBarResolution.resolution Y) Z e h + +theorem lower_bound_of_derived_bar (Y : FiniteSelectionFamily.S.{0}) + (U : Type) [AddCommGroup U] [Module ℂ U] [Module Aᵐᵒᵖ U] + (Z T : DerivedCategory (ModuleCat.{0} ℂ)) + (e : PDBar.derivedObject (barTensor Y U) ≅ Z) + (i : T ⟶ Z) (p : Z ⟶ T) (hip : i ≫ p = 𝟙 T) + (r n : ℕ) (hrn : r ≤ n) + (h : ¬ IsZero ((DerivedCategory.homologyFunctor (ModuleCat ℂ) (-(n : ℤ))).obj T)) : + r ≤ projectiveDimension (module Y) := + PDBar.lower_bound_of_derived_retract (finiteModule Y) (SelectedBarResolution.resolution Y) + U Z T e i p hip r n hrn h +end LittleFinitistic.SelectedPDDetection + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedPDResidueProjection.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedPDResidueProjection.lean new file mode 100644 index 0000000000000000000000000000000000000000..3633b993ca539ecc7f9b5f646ccb4cd4a6fd4ac9 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedPDResidueProjection.lean @@ -0,0 +1,37 @@ +import OAI.Algebra.Finitistic.Selected.SelectedPDDetection +import OAI.Algebra.Finitistic.Dimension.PDResidueProjection + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.SelectedPDDetection +open SelectedOrdinaryAlgebra SelectedOrdinaryModules + +theorem augmentation_surjective : Function.Surjective augmentation := + fun d => ⟨TrivSqZeroExt.inl d, rfl⟩ + +theorem augmentation_kernel_square_zero : + ∀ a ∈ RingHom.ker augmentation.toRingHom, ∀ b ∈ RingHom.ker augmentation.toRingHom, a*b=0 := + fun a ha b hb => PDSquareZero.kernel_square_zero X a b ha hb + +/-- The detector's canonical residue is the right D-residue inflated along A → D. -/ +def rightResidueEquiv : PDTensor.Residue (A := A) ≃ₗ[Aᵐᵒᵖ] + PDResidueProjection.InflatedResidue augmentation := + PDResidueProjection.rightEquiv augmentation augmentation_surjective augmentation_kernel_square_zero + +def residueTorIso (Y : FiniteSelectionFamily.S.{0}) (n : ℕ) : + PDTensor.Tor (k := ℂ) (PDTensor.Residue (A := A)) (module Y) n ≅ + PDTensor.Tor (k := ℂ) (PDResidueProjection.InflatedResidue augmentation) (module Y) n := + PDResidueProjection.torIso augmentation augmentation_surjective augmentation_kernel_square_zero + (module Y) (SelectedBarResolution.resolution Y) n + +theorem pdLE_iff_inflated_D_residueTor (Y : FiniteSelectionFamily.S.{0}) (n : ℕ) : + HasProjectiveDimensionLE (module Y) n ↔ IsZero + (PDTensor.Tor (k := ℂ) (PDResidueProjection.InflatedResidue augmentation) (module Y) (n+1)) := + (PDTensor.pdLE_iff_residueTor_zero (SelectedMinimalResolution.finiteModule Y) n).trans + (residueTorIso Y (n+1)).isZero_iff +end LittleFinitistic.SelectedPDDetection + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedPDUpperConsumer.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedPDUpperConsumer.lean new file mode 100644 index 0000000000000000000000000000000000000000..0ac9a16a215e994926d1c55b33c8ae622d38dc57 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedPDUpperConsumer.lean @@ -0,0 +1,69 @@ +import OAI.Algebra.Finitistic.Selected.SelectedPDResidueProjection +import OAI.Algebra.Finitistic.Selected.SelectedOrdinaryDimension +import OAI.Algebra.Finitistic.Dimension.PDResidueBaseBar +import OAI.Algebra.Finitistic.Selected.SelectedCountPDConsumer + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.SelectedPDDetection +open SelectedOrdinaryAlgebra SelectedOrdinaryModules +local instance : HasDerivedCategory.{1} (ModuleCat.{0} D) := + HasDerivedCategory.standard (ModuleCat.{0} D) + +/-- Exact scalar/action-preserving identification with the source of the +bar worker's actual derived splitting. -/ +def tensorBarDerivedIso (Y : FiniteSelectionFamily.S.{0}) : + (DerivedBar.integerQ D).obj + (DerivedBar.tensorBarComplex ℂ A D (Inflated Y) augmentation) ≅ + PDBarQuotient.baseDerived augmentation (Inflated Y) := + (DerivedBar.integerQ D).mapIso + (DerivedBar.tensorBarIso ℂ A D (Inflated Y) augmentation) + +/-- For the fixed actual A and Inflated Y, bounded actual D-bar homology +implies finite projective dimension, using the proved global dimension of D. -/ +theorem finite_pd_of_bounded_base_bar (Y : FiniteSelectionFamily.S.{0}) + (h : ∃ b : ℕ, ∀ n, b < n → IsZero + ((DerivedBar.twoSidedComplex ℂ A D (Inflated Y) augmentation).homology n)) : + projectiveDimension (module Y) < ⊤ := + PDResidueAssociativity.finite_pd_of_bounded_base_bar augmentation (Inflated Y) + augmentation_surjective augmentation_kernel_square_zero + SelectedOrdinaryDimension.bound SelectedOrdinaryDimension.left_module h + +/-- Consumer of a supplied actual D-derived bar splitting with bounded target. -/ +theorem finite_pd_of_base_derived_splitting (Y : FiniteSelectionFamily.S.{0}) + (Z : DerivedCategory (ModuleCat.{0} D)) + (e : PDBarQuotient.baseDerived augmentation (Inflated Y) ≅ Z) + (h : ∃ b : ℕ, ∀ n, b < n → IsZero + ((DerivedCategory.homologyFunctor (ModuleCat D) (-(n : ℤ))).obj Z)) : + projectiveDimension (module Y) < ⊤ := + PDResidueAssociativity.finite_pd_of_base_derived_iso augmentation (Inflated Y) + augmentation_surjective augmentation_kernel_square_zero + SelectedOrdinaryDimension.bound SelectedOrdinaryDimension.left_module Z e h + +/-- Direct consumer whose source is literally the bar worker's integerQ value. -/ +theorem finite_pd_of_tensor_bar_splitting (Y : FiniteSelectionFamily.S.{0}) + (Z : DerivedCategory (ModuleCat.{0} D)) + (e : (DerivedBar.integerQ D).obj + (DerivedBar.tensorBarComplex ℂ A D (Inflated Y) augmentation) ≅ Z) + (h : ∃ b : ℕ, ∀ n, b < n → IsZero + ((DerivedCategory.homologyFunctor (ModuleCat D) (-(n : ℤ))).obj Z)) : + projectiveDimension (module Y) < ⊤ := + finite_pd_of_base_derived_splitting Y Z ((tensorBarDerivedIso Y).symm ≪≫ e) h + +/-- The count retract can likewise be supplied at the bar worker's exact source. -/ +theorem lower_bound_of_tensor_bar_count (Y : FiniteSelectionFamily.S.{0}) (r : ℕ) + (h : ¬ IsZero (SelectedBaseIterates.object Y r)) + (i : SelectedCountCohomology.count Y r ⟶ (DerivedBar.integerQ D).obj + (DerivedBar.tensorBarComplex ℂ A D (Inflated Y) augmentation)) + (p : (DerivedBar.integerQ D).obj + (DerivedBar.tensorBarComplex ℂ A D (Inflated Y) augmentation) ⟶ SelectedCountCohomology.count Y r) + (hip : i ≫ p = 𝟙 _) : r ≤ projectiveDimension (module Y) := by + apply lower_bound_of_surviving_count Y r h (i ≫ (tensorBarDerivedIso Y).hom) + ((tensorBarDerivedIso Y).inv ≫ p) + simpa only [Category.assoc, Iso.hom_inv_id_assoc] using hip +end LittleFinitistic.SelectedPDDetection + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedRealization.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedRealization.lean new file mode 100644 index 0000000000000000000000000000000000000000..e4b091091058427ff2770aac48518ea493204fd7 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedRealization.lean @@ -0,0 +1,81 @@ +import OAI.Algebra.Finitistic.Selected.SelectedReferenceCohomology +import OAI.Algebra.Finitistic.Selected.SelectedTensorSplitting +import OAI.Algebra.Finitistic.Selected.SelectedChainAction + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits HomologicalComplex +attribute [local instance] HasDerivedCategory.standard HasExt.standard +namespace LittleFinitistic.SelectedRealization +open SelectedFixedDiagram QuadraticEncoding SelectedNativeEvaluation +variable {Y : Type} [AddCommGroup Y] [Module ℂ Y] [FiniteDimensional ℂ Y] + [Module SelectionRing Y] [IsScalarTower ℂ SelectionRing Y] + +local instance selectedModule : Module SelectionRing (H (Y := Y)) := + inferInstanceAs (Module SelectionRing (selectionStep (ModuleCat.of SelectionRing Y))) +local instance selectedTower : IsScalarTower ℂ SelectionRing (H (Y := Y)) := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) + +abbrev input := (SelectedChainHomology.representation (Y := Y)).Evaluation +abbrev selectedRepresentation := SourceActionEvaluation.representation (Y := H (Y := Y)) encoding +abbrev reference := EvaluationVertexDiagram.module (selectedRepresentation (Y := Y)) + +omit [FiniteDimensional ℂ Y] in +lemma selected_action (a : Fin (encoding.generators+1)) : + EvaluationVertexDiagram.action (Y := H (Y := Y)) (selectedRepresentation (Y := Y)) a = + HAction (Y := Y) (RelationBasisAction.arrow (SelectionEncoding.generator encoding) a) := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + rw [HAction_apply] + refine Fin.cases ?_ (fun j => ?_) a + · change x = (1 : SelectionRing) • x + rw [one_smul] + · rfl + +def coordinates (n : ℤ) (hn : n = 0 ∨ n = -3) : + ∀ v : Fin 3, (SelectedTensor.source (input (Y := Y)) v).homology n ≅ H (Y := Y) := + Fin.cases (SelectedChainHomology.D0Iso n hn) + (Fin.cases (SelectedChainHomology.D1Iso n hn) + (fun _ => SelectedChainHomology.D2Iso n hn)) + +lemma coordinates01 (a : Fin (encoding.generators+1)) (n : ℤ) (hn : n = 0 ∨ n = -3) : + homologyMap (((BalancedTensor.tensorFunctor ℂ (B P) (input (Y := Y))).mapHomologicalComplex (.up ℤ)).map + (SelectedRectification.f a)) n ≫ (coordinates (Y := Y) n hn 1).hom = + (coordinates (Y := Y) n hn 0).hom ≫ EvaluationVertexDiagram.action (Y := H (Y := Y)) (selectedRepresentation (Y := Y)) a := by + erw [selected_action (Y := Y)] + exact SelectedChainHomology.fixed_arrow01 a n hn + +lemma coordinates12 (a : Fin (encoding.generators+1)) (n : ℤ) (hn : n = 0 ∨ n = -3) : + homologyMap (((BalancedTensor.tensorFunctor ℂ (B P) (input (Y := Y))).mapHomologicalComplex (.up ℤ)).map + (SelectedRectification.g a)) n ≫ (coordinates (Y := Y) n hn 2).hom = + (coordinates (Y := Y) n hn 1).hom ≫ EvaluationVertexDiagram.action (Y := H (Y := Y)) (selectedRepresentation (Y := Y)) a := by + erw [selected_action (Y := Y)] + exact SelectedChainHomology.fixed_arrow12 a n hn + +/-- The entire cohomology B-module is the manuscript's M(H(Y)), in both degrees. -/ +def cohomology (n : ℤ) (hn : n = 0 ∨ n = -3) : + (SelectedTensor.complex (input (Y := Y))).homology n ≅ reference (Y := Y) := + SelectedReferenceCohomology.iso _ (selectedRepresentation (Y := Y)) n (coordinates (Y := Y) n hn) + (fun a => coordinates01 a n hn) (fun a => coordinates12 a n hn) + +lemma source_zero (n : ℤ) (hn0 : n ≠ 0) (hn3 : n ≠ -3) (v : Fin 3) : + IsZero ((SelectedTensor.source (input (Y := Y)) v).homology n) := by + fin_cases v + · exact SelectedChainHomology.D0_zero n hn0 hn3 + · exact SelectedChainHomology.D1_zero n hn0 hn3 + · exact SelectedChainHomology.D2_zero n hn0 hn3 + +/-- The one fixed selecting bimodule realizes H on every finite-dimensional Y. +This is an isomorphism in the full B-module derived category. -/ +def realization : + SelectedTensorSplitting.object (input (Y := Y)) ≅ + (DerivedCategory.singleFunctor (ModuleCat (B P)) 0).obj (reference (Y := Y)) ⊞ + ((DerivedCategory.singleFunctor (ModuleCat (B P)) 0).obj (reference (Y := Y)))⟦(3 : ℤ)⟧ := + SelectedTensorSplitting.split _ _ (cohomology 0 (Or.inl rfl)) + (cohomology (-3) (Or.inr rfl)) source_zero +end LittleFinitistic.SelectedRealization + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedRectification.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedRectification.lean new file mode 100644 index 0000000000000000000000000000000000000000..3d7f1e3e2745fb415a2abef5363a2583611ce7cc --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedRectification.lean @@ -0,0 +1,49 @@ +import OAI.Algebra.Finitistic.Selected.SelectedChainDiagram +import OAI.Algebra.Finitistic.Rectification.RectificationLemma +import OAI.Algebra.Finitistic.Localization.UnderlyingRepresentatives + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits HomologicalComplex +namespace LittleFinitistic.SelectedRectification +open SelectedFixedDiagram ExternalTensor.Section4 RelationBasisCoefficients + +abbrev D0 := UnderlyingRepresentatives.complex P fixed.D0 +abbrev D1 := UnderlyingRepresentatives.complex P fixed.D1 +abbrev D2 := UnderlyingRepresentatives.complex P fixed.D2 +abbrev F := (UnderlyingRepresentatives.forget P).mapHomologicalComplex (.up ℤ) +def f (a : Fin (encoding.generators+1)) : D0 ⟶ D1 := F.map (SelectedChainDiagram.fixedChain.f a) +def g (b : Fin (encoding.generators+1)) : D1 ⟶ D2 := F.map (SelectedChainDiagram.fixedChain.g b) +def relations (r : RelationIndex P) : + Homotopy (relationMap (ConcreteQuadraticDiagram.quadratic P) D0 D1 D2 f g r) 0 := + UnderlyingRepresentatives.relationHomotopy P (encoding.generators+1) (encoding.generators+1) + (Module.finrank ℂ (QuadraticEncoding.relationSpace P)) fixed.D0 fixed.D1 fixed.D2 + SelectedChainDiagram.fixedChain.f SelectedChainDiagram.fixedChain.g (basisCoefficient P) + SelectedChainDiagram.fixedChain.homotopy r + +/-- One explicit bimodule complex chosen before any evaluation module. -/ +def bimodule : BiComplex ℂ (QuadraticEncoding.B P) := + InducedRectification.total (ConcreteQuadraticDiagram.quadratic P) D0 D1 D2 f g relations + +/-- The single fixed selecting complex satisfies the full rectification lemma, +including all original vertex and arrow maps, independently of Y. -/ +theorem verified : ∃ lo hi : ℤ, RectificationLemma.Verified P D0 D1 D2 f g relations lo hi := by + obtain ⟨l₀,h₀,b₀⟩ := UnderlyingRepresentatives.bounded P fixed.D0 + obtain ⟨l₁,h₁,b₁⟩ := UnderlyingRepresentatives.bounded P fixed.D1 + obtain ⟨l₂,h₂,b₂⟩ := UnderlyingRepresentatives.bounded P fixed.D2 + let lo := min l₀ (min l₁ l₂) + let hi := max h₀ (max h₁ h₂) + refine ⟨lo,hi,RectificationLemma.rectification P D0 D1 D2 f g relations lo hi + (fun n hn => b₀ n ?_) (fun n hn => b₁ n ?_) (fun n hn => b₂ n ?_) + (UnderlyingRepresentatives.projective P fixed.D0) + (UnderlyingRepresentatives.projective P fixed.D1) + (UnderlyingRepresentatives.projective P fixed.D2) + (UnderlyingRepresentatives.finite P fixed.D0) + (UnderlyingRepresentatives.finite P fixed.D1) + (UnderlyingRepresentatives.finite P fixed.D2)⟩ + all_goals dsimp [lo,hi] at hn; omega +end LittleFinitistic.SelectedRectification + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedReferenceCohomology.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedReferenceCohomology.lean new file mode 100644 index 0000000000000000000000000000000000000000..56a31576aef69d9d39afcf6568ff2f49ff3c7181 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedReferenceCohomology.lean @@ -0,0 +1,50 @@ +import OAI.Algebra.Finitistic.Selected.SelectedCohomologyAssembly +import OAI.Algebra.Finitistic.Localization.EvaluationVertexDiagram + +namespace OAI +noncomputable section +open CategoryTheory HomologicalComplex +namespace LittleFinitistic.SelectedReferenceCohomology +open SelectedFixedDiagram SelectedRectification QuadraticEncoding + +private lemma transfer_to_vertices {C : Type*} [Category C] + {A₀ A₁ B₀ B₁ Y₀ Y₁ : C} (f : A₀ ⟶ A₁) (g : B₀ ⟶ B₁) (h : Y₀ ⟶ Y₁) + (e₀ : A₀ ≅ Y₀) (e₁ : A₁ ≅ Y₁) (v₀ : B₀ ≅ Y₀) (v₁ : B₁ ≅ Y₁) + (hf : f ≫ e₁.hom = e₀.hom ≫ h) (hg : g ≫ v₁.hom = v₀.hom ≫ h) : + f ≫ (e₁ ≪≫ v₁.symm).hom = (e₀ ≪≫ v₀.symm).hom ≫ g := by + apply (cancel_mono v₁.hom).1 + simp only [Iso.trans_hom, Iso.symm_hom, Category.assoc, Iso.inv_hom_id, + Category.comp_id] + rw [hg, Iso.inv_hom_id_assoc] + exact hf + +variable (N : Type) [AddCommGroup N] [Module ℂ N] [Module (B P) N] +variable {Y : Type} [AddCommGroup Y] [Module ℂ Y] (X : Representation P Y) +variable (n : ℤ) (E : ∀ v : Fin 3, + (SelectedTensor.source N v).homology n ≅ ModuleCat.of ℂ Y) + +/-- Identify the full tensor cohomology with the actual evaluation module from +three coordinate models and their generator actions. -/ +def iso + (h01 : ∀ a, + homologyMap (((BalancedTensor.tensorFunctor ℂ (B P) N).mapHomologicalComplex (.up ℤ)).map (f a)) n ≫ + (E 1).hom = (E 0).hom ≫ EvaluationVertexDiagram.action X a) + (h12 : ∀ b, + homologyMap (((BalancedTensor.tensorFunctor ℂ (B P) N).mapHomologicalComplex (.up ℤ)).map (g b)) n ≫ + (E 2).hom = (E 1).hom ≫ EvaluationVertexDiagram.action X b) : + (SelectedTensor.complex N).homology n ≅ EvaluationVertexDiagram.module X := by + apply SelectedCohomologyAssembly.iso N n (EvaluationVertexDiagram.module X) + (fun v => E v ≪≫ (EvaluationVertexDiagram.vertexIso X v).symm) + · intro a + exact transfer_to_vertices _ _ _ (E 0) (E 1) + (EvaluationVertexDiagram.vertexIso X 0) (EvaluationVertexDiagram.vertexIso X 1) + (h01 a) (EvaluationVertexDiagram.arrow01_square X a (CanonicalArrowCompatibility.arrow01_target P a)) + · intro b + exact transfer_to_vertices _ _ _ (E 1) (E 2) + (EvaluationVertexDiagram.vertexIso X 1) (EvaluationVertexDiagram.vertexIso X 2) + (h12 b) (EvaluationVertexDiagram.arrow12_square X b (CanonicalArrowCompatibility.arrow12_target P b)) +end LittleFinitistic.SelectedReferenceCohomology + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedShiftedRealization.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedShiftedRealization.lean new file mode 100644 index 0000000000000000000000000000000000000000..79617aa715d82b28047864bc2ac344dafded19d7 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedShiftedRealization.lean @@ -0,0 +1,80 @@ +import OAI.Algebra.Finitistic.Selected.SelectedOrdinaryAlgebra +import OAI.Algebra.Finitistic.Selected.SelectedDerivedFunctor +import OAI.Algebra.Finitistic.Ordinary.OrdinaryShiftDerivedTensor + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +attribute [local instance] HasDerivedCategory.standard HasExt.standard +namespace LittleFinitistic.SelectedShiftedRealization +open SelectedFixedDiagram QuadraticEncoding SelectedOrdinaryAlgebra +attribute [local instance] preservesBinaryBiproducts_of_preservesBiproducts + +/-- The actual shifted selecting bimodule, with its full B actions. -/ +abbrev shifted := SelectedRectification.bimodule⟦b⟧ + +def model : BimoduleTotal.BoundedProjective ℂ (B P) shifted where + lower := -(length : ℤ) + upper := 0 + bounded := OrdinarySimulation.shifted_support _ b length a endpoints support + projective n := by + exact SelectedOrdinaryAlgebra.term_projective (n+b) + +abbrev G := model.derived + +/-- Tensoring a selected stalk by the shifted fixed bimodule shifts the already +verified full B-linear tensor complex. -/ +def comparison (Y : FiniteSelectionFamily.S.{0}) : + G.obj (FiniteSelectionFamily.derived Y) ≅ + (SelectedTensorSplitting.object (FiniteSelectionFamily.representation Y).Evaluation)⟦b⟧ := + model.nativeSingleEvaluation (FiniteSelectionFamily.representation Y).Evaluation ≪≫ + DerivedCategory.Q.mapIso + ((((BimoduleBalancedTensor.functor ℂ (B P) + (FiniteSelectionFamily.representation Y).Evaluation).mapHomologicalComplex (.up ℤ)).commShiftIso b).app + SelectedRectification.bimodule) ≪≫ + (DerivedCategory.Q.commShiftIso b).app _ + +/-- The concrete two summands for one application of the actual shifted tensor. -/ +def realizationNested (Y : FiniteSelectionFamily.S.{0}) : + G.obj (FiniteSelectionFamily.derived Y) ≅ + (FiniteSelectionFamily.derived (FiniteSelectionFamily.H Y))⟦b⟧ ⊞ + ((FiniteSelectionFamily.derived (FiniteSelectionFamily.H Y))⟦(3 : ℤ)⟧)⟦b⟧ := + comparison Y ≪≫ (shiftFunctor _ b).mapIso (FiniteSelectionFamily.realization Y) ≪≫ + (shiftFunctor _ b).mapBiprod _ _ + +/-- The source convention places the two summands in shifts b and b+3. -/ +def realization (Y : FiniteSelectionFamily.S.{0}) : + G.obj (FiniteSelectionFamily.derived Y) ≅ + (FiniteSelectionFamily.derived (FiniteSelectionFamily.H Y))⟦b⟧ ⊞ + (FiniteSelectionFamily.derived (FiniteSelectionFamily.H Y))⟦b+3⟧ := + realizationNested Y ≪≫ biprod.mapIso (Iso.refl _) + ((shiftAdd _ (3 : ℤ) b).symm ≪≫ eqToIso (by rw [add_comm (3 : ℤ) b])) + +def iteration (j : ℕ) (Y : FiniteSelectionFamily.S.{0}) : + (G.obj^[j]) (FiniteSelectionFamily.derived Y) ≅ + ExternalTensor.Binomial.binomialObject b 3 j + (FiniteSelectionFamily.derived ((FiniteSelectionFamily.H^[j]) Y)) := + ExternalTensor.Binomial.binomialIteration G FiniteSelectionFamily.derived + FiniteSelectionFamily.H b 3 realization j Y + +theorem isZero_iff (j : ℕ) (Y : FiniteSelectionFamily.S.{0}) : + IsZero ((G.obj^[j]) (FiniteSelectionFamily.derived Y)) ↔ + Subsingleton (selectionIterate Y.val j) := + (ExternalTensor.Binomial.iteration_isZero_iff G FiniteSelectionFamily.derived + FiniteSelectionFamily.H b 3 realization j Y).trans + ((FiniteSelectionFamily.derived_zero _).trans + (by rw [FiniteSelectionFamily.iterate_val])) + +theorem extinction (m : ℕ) [NeZero m] : + (∀ j < m, ¬ IsZero ((G.obj^[j]) (FiniteSelectionFamily.derived (FiniteSelectionFamily.test m)))) ∧ + IsZero ((G.obj^[m]) (FiniteSelectionFamily.derived (FiniteSelectionFamily.test m))) := by + constructor + · intro j hj hz + have hs := (isZero_iff j (FiniteSelectionFamily.test m)).mp hz + exact @not_subsingleton _ (selectionIterate_test_nontrivial m j hj) hs + · exact (isZero_iff m (FiniteSelectionFamily.test m)).mpr (selectionIterate_test_subsingleton m) +end LittleFinitistic.SelectedShiftedRealization + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedTargetHomology.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedTargetHomology.lean new file mode 100644 index 0000000000000000000000000000000000000000..01d873622c5287690578597b0f2fd3e4ff14f8ba --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedTargetHomology.lean @@ -0,0 +1,145 @@ +import OAI.Algebra.Finitistic.Selected.SelectedTensorComparison +import Mathlib.CategoryTheory.Preadditive.AdditiveFunctor +import Mathlib.Algebra.Homology.DerivedCategory.TStructure +import Mathlib.Algebra.Homology.DerivedCategory.FullyFaithful + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +attribute [local instance] HasDerivedCategory.standard +namespace LittleFinitistic.SelectedTargetHomology +open QuadraticEncoding SelectedNativeEvaluation FiniteProjectiveHomotopy +universe v +variable {Y : Type v} [AddCommGroup Y] [Module ℂ Y] [FiniteDimensional ℂ Y] + [Module SelectionRing Y] [IsScalarTower ℂ SelectionRing Y] +abbrev C := ModuleCat.{v} ℂ +abbrev I := derivedTargetInclusion.{0,v} (k := ℂ) +abbrev cohomology (n : ℤ) := I ⋙ DerivedCategory.homologyFunctor C n +instance (n : ℤ) : (cohomology.{v} n).Additive := by dsimp [cohomology]; infer_instance +instance (n : ℤ) : PreservesBinaryBiproducts (cohomology.{v} n) := + preservesBinaryBiproducts_of_preservesBiproducts _ + +def stalkIso : I.obj (HDerived (Y := Y)) ≅ + (DerivedCategory.singleFunctor C 0).obj (H (Y := Y)) := Iso.refl _ +def shiftedIso : I.obj ((HDerived (Y := Y))⟦(3 : ℤ)⟧) ≅ + (DerivedCategory.singleFunctor C (-3)).obj (H (Y := Y)) := + (I.commShiftIso (3 : ℤ)).app _ ≪≫ + (shiftFunctor _ (3 : ℤ)).mapIso (stalkIso (Y := Y)) ≪≫ + ((DerivedCategory.singleFunctors C).shiftIso 3 (-3) 0 (by norm_num)).app _ + +def stalkHomologyIso : (cohomology 0).obj (HDerived (Y := Y)) ≅ H (Y := Y) := + (DerivedCategory.homologyFunctor C 0).mapIso stalkIso ≪≫ + (DerivedCategory.singleFunctorCompHomologyFunctorIso C 0).app _ +def shiftedHomologyIso : (cohomology (-3)).obj ((HDerived (Y := Y))⟦(3 : ℤ)⟧) ≅ H (Y := Y) := + (DerivedCategory.homologyFunctor C (-3)).mapIso shiftedIso ≪≫ + (DerivedCategory.singleFunctorCompHomologyFunctorIso C (-3)).app _ + +lemma single_zero (M : C) (i n : ℤ) (hn : n ≠ i) : + IsZero ((DerivedCategory.homologyFunctor C n).obj + ((DerivedCategory.singleFunctor C i).obj M)) := by + rcases lt_or_gt_of_ne hn with h | h + · exact DerivedCategory.isZero_of_isGE _ i n h + · exact DerivedCategory.isZero_of_isLE _ i n h +lemma stalk_zero (n : ℤ) (hn : n ≠ 0) : + IsZero ((cohomology n).obj (HDerived (Y := Y))) := + ((DerivedCategory.homologyFunctor C n).mapIso (stalkIso (Y := Y))).isZero_iff.mpr + (single_zero _ _ _ hn) +lemma shifted_zero (n : ℤ) (hn : n ≠ -3) : + IsZero ((cohomology n).obj ((HDerived (Y := Y))⟦(3 : ℤ)⟧)) := + ((DerivedCategory.homologyFunctor C n).mapIso (shiftedIso (Y := Y))).isZero_iff.mpr + (single_zero _ _ _ hn) + +def targetH0 : (cohomology 0).obj (target (Y := Y)) ≅ H (Y := Y) := + (cohomology 0).mapBiprod _ _ ≪≫ + (isoBiprodZero (shifted_zero (Y := Y) 0 (by norm_num))).symm ≪≫ stalkHomologyIso + +def targetHm3 : (cohomology (-3)).obj (target (Y := Y)) ≅ H (Y := Y) := + (cohomology (-3)).mapBiprod _ _ ≪≫ + (isoZeroBiprod (stalk_zero (Y := Y) (-3) (by norm_num))).symm ≪≫ shiftedHomologyIso + +lemma target_zero (n : ℤ) (h0 : n ≠ 0) (hm : n ≠ -3) : + IsZero ((cohomology n).obj (target (Y := Y))) := + ((cohomology n).mapBiprod _ _).isZero_iff.mpr + ((biprod_isZero_iff _ _).mpr ⟨stalk_zero n h0,shifted_zero n hm⟩) + +lemma stalkHomologyIso_hom : (stalkHomologyIso (Y := Y)).hom = + ((DerivedCategory.singleFunctorCompHomologyFunctorIso C 0).app (H (Y := Y))).hom := by + change (DerivedCategory.homologyFunctor C 0).map + (𝟙 ((DerivedCategory.singleFunctor C 0).obj (H (Y := Y)))) ≫ _ = _ + rw [CategoryTheory.Functor.map_id,Category.id_comp] + +lemma stalk_action (r : SelectionRing) : + (cohomology 0).map (HDerivedAction (Y := Y) r) ≫ (stalkHomologyIso (Y := Y)).hom = + (stalkHomologyIso (Y := Y)).hom ≫ HAction (Y := Y) r := by + rw [stalkHomologyIso_hom] + change (DerivedCategory.homologyFunctor C 0).map + (DerivedCategory.Qh.map ((inclusion ℂ).map (HKAction (Y := Y) r))) ≫ _ = _ + dsimp only [HKAction] + erw [Functor.map_preimage] + change (DerivedCategory.homologyFunctor C 0).map + ((DerivedCategory.singleFunctor C 0).map (HAction (Y := Y) r)) ≫ _ = _ + exact (DerivedCategory.singleFunctorCompHomologyFunctorIso C 0).hom.naturality + (HAction (Y := Y) r) + +lemma shifted_action (r : SelectionRing) : + (cohomology (-3)).map ((HDerivedAction (Y := Y) r)⟦(3 : ℤ)⟧') ≫ + (shiftedHomologyIso (Y := Y)).hom = + (shiftedHomologyIso (Y := Y)).hom ≫ HAction (Y := Y) r := by + have hst : I.map (HDerivedAction (Y := Y) r) = + (DerivedCategory.singleFunctor C 0).map (HAction (Y := Y) r) := by + change DerivedCategory.Qh.map ((inclusion ℂ).map (HKAction (Y := Y) r)) = _ + dsimp only [HKAction] + erw [Functor.map_preimage] + rfl + have hshift : I.map ((HDerivedAction (Y := Y) r)⟦(3 : ℤ)⟧') ≫ (shiftedIso (Y := Y)).hom = + (shiftedIso (Y := Y)).hom ≫ + (DerivedCategory.singleFunctor C (-3)).map (HAction (Y := Y) r) := by + have h1 := (I.commShiftIso (3 : ℤ)).hom.naturality (HDerivedAction (Y := Y) r) + have h2 := ((DerivedCategory.singleFunctors C).shiftIso 3 (-3) 0 (by norm_num)).hom.naturality + (HAction (Y := Y) r) + dsimp only [Functor.comp_map] at h1 h2 + rw [hst] at h1 + have hh := (congrArg (fun f => f ≫ + (((DerivedCategory.singleFunctors C).shiftIso 3 (-3) 0 (by norm_num)).app + (H (Y := Y))).hom) h1).trans + ((Category.assoc _ _ _).trans + (congrArg (fun g => (I.commShiftIso (3 : ℤ)).hom.app (HDerived (Y := Y)) ≫ g) h2)) + dsimp only [shiftedIso, stalkIso, Iso.trans_hom, Functor.mapIso_hom, Iso.refl_hom] + erw [CategoryTheory.Functor.mapIso_hom, Iso.refl_hom, + CategoryTheory.Functor.map_id, Category.id_comp] + exact (Category.assoc _ _ _).symm.trans (hh.trans (Category.assoc _ _ _).symm) + + have h := congrArg (DerivedCategory.homologyFunctor C (-3)).map hshift + simp only [Functor.map_comp] at h + have hn := (DerivedCategory.singleFunctorCompHomologyFunctorIso C (-3)).hom.naturality + (HAction (Y := Y) r) + dsimp only [Functor.comp_map,Functor.id_map] at hn + dsimp only [shiftedHomologyIso,Iso.trans_hom,Functor.mapIso_hom,cohomology,Functor.comp_map] + rw [← Category.assoc,h,Category.assoc] + exact (congrArg (fun g => (DerivedCategory.homologyFunctor C (-3)).map + (shiftedIso (Y := Y)).hom ≫ g) hn).trans (Category.assoc _ _ _).symm + +lemma targetH0_hom : (targetH0 (Y := Y)).hom = + (cohomology 0).map biprod.fst ≫ (stalkHomologyIso (Y := Y)).hom := by + simp [targetH0,isoBiprodZero] + erw [biprod.lift_fst_assoc] +lemma targetHm3_hom : (targetHm3 (Y := Y)).hom = + (cohomology (-3)).map biprod.snd ≫ (shiftedHomologyIso (Y := Y)).hom := by + simp [targetHm3,isoZeroBiprod] + erw [biprod.lift_snd_assoc] + +lemma targetH0_action (r : SelectionRing) : + (cohomology 0).map (targetAction (Y := Y) r) ≫ (targetH0 (Y := Y)).hom = + (targetH0 (Y := Y)).hom ≫ HAction (Y := Y) r := by + rw [targetH0_hom,← Category.assoc,← Functor.map_comp] + simp only [targetAction,biprod.map_fst,Functor.map_comp,Category.assoc,stalk_action] +lemma targetHm3_action (r : SelectionRing) : + (cohomology (-3)).map (targetAction (Y := Y) r) ≫ (targetHm3 (Y := Y)).hom = + (targetHm3 (Y := Y)).hom ≫ HAction (Y := Y) r := by + rw [targetHm3_hom,← Category.assoc,← Functor.map_comp] + simp only [targetAction,biprod.map_snd,Functor.map_comp,Category.assoc,shifted_action] +end LittleFinitistic.SelectedTargetHomology + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedTensor.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedTensor.lean new file mode 100644 index 0000000000000000000000000000000000000000..1fa0f01d45d038f3936875104d06a2f117a0e6a1 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedTensor.lean @@ -0,0 +1,49 @@ +import OAI.Algebra.Finitistic.Selected.SelectedRectification +import OAI.Algebra.Finitistic.Localization.TensorCohomologyDiagram +import OAI.Algebra.Finitistic.Rectification.FullTensorProperties + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits HomologicalComplex +namespace LittleFinitistic.SelectedTensor +open SelectedFixedDiagram SelectedRectification QuadraticEncoding +variable (N : Type) [AddCommGroup N] [Module ℂ N] [Module (B P) N] + +/-- Evaluate the one fixed selecting bimodule, retaining its full left action. -/ +abbrev complex := FullTensorRectification.tensor P D0 D1 D2 f g relations N +abbrev source (v : Fin 3) := FullTensorRectification.source P D0 D1 D2 N v +abbrev comparison (v : Fin 3) (n : ℤ) := + TensorCohomologyDiagram.comparison P D0 D1 D2 f g relations N v n + +/-- Every cohomology comparison is invertible for the fixed selected representatives. -/ +instance comparison_isIso (v : Fin 3) (n : ℤ) : IsIso (comparison N v n) := by + obtain ⟨l₀,h₀,b₀⟩ := UnderlyingRepresentatives.bounded P fixed.D0 + obtain ⟨l₁,h₁,b₁⟩ := UnderlyingRepresentatives.bounded P fixed.D1 + obtain ⟨l₂,h₂,b₂⟩ := UnderlyingRepresentatives.bounded P fixed.D2 + let lo := min l₀ (min l₁ l₂) + let hi := max h₀ (max h₁ h₂) + refine TensorCohomologyDiagram.comparison_isIso P D0 D1 D2 f g relations N v n lo hi + (fun n hn => b₀ n ?_) (fun n hn => b₁ n ?_) (fun n hn => b₂ n ?_) + (UnderlyingRepresentatives.projective P fixed.D0) + (UnderlyingRepresentatives.projective P fixed.D1) + (UnderlyingRepresentatives.projective P fixed.D2) + all_goals dsimp [lo,hi] at hn; omega + +def comparisonIso (v : Fin 3) (n : ℤ) := asIso (comparison N v n) + +/-- The actual tensor complex has bounded support. -/ +theorem bounded : ∃ lo hi : ℤ, ∀ n, n < lo ∨ hi < n → IsZero ((complex N).X n) := by + obtain ⟨lo,hi,h⟩ := SelectedRectification.verified + exact ⟨lo-2,hi,FullTensorProperties.bounded ℂ (B P) N bimodule (lo-2) hi h.bounded⟩ + +/-- Every actual evaluated term is finite-dimensional. -/ +theorem finite [FiniteDimensional ℂ N] (n : ℤ) : + FiniteDimensional ℂ ((ModuleCat.restrictScalars (algebraMap ℂ (B P))).obj ((complex N).X n)) := by + obtain ⟨lo,hi,h⟩ := SelectedRectification.verified + have : FiniteDimensional ℂ ((ExternalTensor.Section4.forgetK ℂ (B P)).obj (bimodule.X n)) := h.finite n + exact FullTensorProperties.finite ℂ (B P) N (bimodule.X n) +end LittleFinitistic.SelectedTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedTensorComparison.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedTensorComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..dc4d041c9ef5a12c48ca715b91937af78cb53fac --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedTensorComparison.lean @@ -0,0 +1,50 @@ +import OAI.Algebra.Finitistic.Localization.UnderlyingRepresentatives +import OAI.Algebra.Finitistic.Selected.SelectedChainDiagram + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +attribute [local instance] HasDerivedCategory.standard +namespace LittleFinitistic.SelectedTensorComparison +open QuadraticEncoding FiniteProjectiveHomotopy +universe u v +variable {k : Type u} [Field k] {d t : ℕ} {P : Relations k d t} +variable {Y : Type v} [AddCommGroup Y] [Module k Y] (X : Representation P Y) + +abbrev tensor (D : SourceVerdier.K P) := + ((BalancedTensor.tensorFunctor k (B P) X.Evaluation).mapHomologicalComplex (.up ℤ)).obj + (UnderlyingRepresentatives.complex P D) + +/-- The chosen representative's actual tensor is the source evaluation object. -/ +def homotopyIso (D : SourceVerdier.K P) : + (HomotopyCategory.quotient _ _).obj (tensor X D) ≅ (SourceEvaluation.evaluation X).obj D := + Iso.refl _ + +variable [FiniteDimensional k Y] +def finiteIso (D : SourceVerdier.K P) : + (HomotopyCategory.quotient _ _).obj (tensor X D) ≅ + (inclusion k).obj ((SourceEvaluation.finite X).obj D) := Iso.refl _ + +abbrev tensorMap {D E : SourceVerdier.K P} + (f : ConcreteChainRepresentatives.representative P D ⟶ + ConcreteChainRepresentatives.representative P E) := + ((BalancedTensor.tensorFunctor k (B P) X.Evaluation).mapHomologicalComplex (.up ℤ)).map + (((UnderlyingRepresentatives.forget P).mapHomologicalComplex (.up ℤ)).map f) + +lemma map_comparison {D E : SourceVerdier.K P} + (f : ConcreteChainRepresentatives.representative P D ⟶ + ConcreteChainRepresentatives.representative P E) + (a : D ⟶ E) + (ha : (HomotopyCategory.quotient _ _).map f = a.hom) : + (HomotopyCategory.quotient _ _).map (tensorMap X f) ≫ (finiteIso X E).hom = + (finiteIso X D).hom ≫ (inclusion k).map ((SourceEvaluation.finite X).map a) := by + dsimp only [finiteIso,Iso.refl_hom] + erw [Category.comp_id,Category.id_comp] + change _ = ((BalancedTensor.tensorFunctor k (B P) X.Evaluation).mapHomotopyCategory (.up ℤ)).map + (((UnderlyingRepresentatives.forget P).mapHomotopyCategory (.up ℤ)).map a.hom) + erw [← ha,Functor.mapHomotopyCategory_map,Functor.mapHomotopyCategory_map] +end LittleFinitistic.SelectedTensorComparison + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedTensorSplitting.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedTensorSplitting.lean new file mode 100644 index 0000000000000000000000000000000000000000..1fd6b1013c3f90961cdef821e7eefec05d70e2c4 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedTensorSplitting.lean @@ -0,0 +1,45 @@ +import OAI.Algebra.Finitistic.Selected.SelectedCohomologyVanishing +import OAI.Algebra.Finitistic.Localization.TwoDegreeFormalityNaturality + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +attribute [local instance] HasDerivedCategory.standard HasExt.standard +namespace LittleFinitistic.SelectedTensorSplitting +open SelectedFixedDiagram QuadraticEncoding +variable (N : Type) [AddCommGroup N] [Module ℂ N] [Module (B P) N] + +/-- The actual derived object represented by the full B-valued fixed tensor complex. -/ +abbrev object : DerivedCategory (ModuleCat (B P)) := DerivedCategory.Q.obj (SelectedTensor.complex N) + +def homologyIso (n : ℤ) : + (DerivedCategory.homologyFunctor (ModuleCat (B P)) n).obj (object N) ≅ + (SelectedTensor.complex N).homology n := + (DerivedCategory.homologyFunctorFactors (ModuleCat (B P)) n).app (SelectedTensor.complex N) + +/-- Support of the evaluated representative diagram implies actual derived +cohomological support of the full tensor object. -/ +theorem twoDegrees + (h : ∀ n : ℤ, n ≠ 0 → n ≠ -3 → ∀ v : Fin 3, + IsZero ((SelectedTensor.source N v).homology n)) : + DerivedTruncation.TwoDegrees (object N) := by + intro n hn0 hn3 + exact (homologyIso N n).isZero_iff.mpr + (SelectedCohomologyVanishing.cohomology_isZero N n (h n hn0 hn3)) + +/-- Apply the proved B-linear truncation splitting to the actual fixed tensor, +using full module cohomology models and source-diagram support. -/ +def split (R : ModuleCat (B P)) + (h0 : (SelectedTensor.complex N).homology 0 ≅ R) + (h3 : (SelectedTensor.complex N).homology (-3) ≅ R) + (hz : ∀ n : ℤ, n ≠ 0 → n ≠ -3 → ∀ v : Fin 3, + IsZero ((SelectedTensor.source N v).homology n)) : + object N ≅ (DerivedCategory.singleFunctor (ModuleCat (B P)) 0).obj R ⊞ + ((DerivedCategory.singleFunctor (ModuleCat (B P)) 0).obj R)⟦(3 : ℤ)⟧ := + TwoDegreeFormality.splitIsoWithModels P (object N) (twoDegrees N hz) R R + (homologyIso N 0 ≪≫ h0) (homologyIso N (-3) ≪≫ h3) +end LittleFinitistic.SelectedTensorSplitting + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedUnderlyingHomology.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedUnderlyingHomology.lean new file mode 100644 index 0000000000000000000000000000000000000000..4a339ead1b40fd989ef1a60d227a4bc03dfe2bef --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedUnderlyingHomology.lean @@ -0,0 +1,104 @@ +import OAI.Algebra.Finitistic.Selected.SelectedChainHomology + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +attribute [local instance] HasDerivedCategory.standard +namespace LittleFinitistic.SelectedUnderlyingHomology +open QuadraticEncoding SelectedFixedDiagram SelectedNativeEvaluation SelectedTargetHomology +open SelectedChainHomology +universe v +variable {Y : Type v} [AddCommGroup Y] [Module ℂ Y] [FiniteDimensional ℂ Y] + [Module SelectionRing Y] [IsScalarTower ℂ SelectionRing Y] + +/-- Tensor an actual map of the underlying right-module complexes. -/ +abbrev tensorMap {D E : SourceVerdier.K P} + (f : UnderlyingRepresentatives.complex P D ⟶ UnderlyingRepresentatives.complex P E) := + ((BalancedTensor.tensorFunctor ℂ (B P) (representation (Y := Y)).Evaluation).mapHomologicalComplex + (.up ℤ)).map f + +lemma derived_map {D E : SourceVerdier.K P} + (f : UnderlyingRepresentatives.complex P D ⟶ UnderlyingRepresentatives.complex P E) + (a : D ⟶ E) + (ha : (HomotopyCategory.quotient _ _).map f = (SourceModelBridge.ambient P).map a) : + DerivedCategory.Q.map (tensorMap (Y := Y) f) ≫ (derivedIso (Y := Y) E).hom = + (derivedIso (Y := Y) D).hom ≫ I.map ((source (Y := Y)).map a) := by + have hq : (HomotopyCategory.quotient _ _).map (tensorMap (Y := Y) f) = + (FiniteProjectiveHomotopy.inclusion ℂ).map + ((SourceEvaluation.finite (representation (Y := Y))).map a) := by + change _ = ((BalancedTensor.tensorFunctor ℂ (B P) + (representation (Y := Y)).Evaluation).mapHomotopyCategory (.up ℤ)).map + ((SourceModelBridge.ambient P).map a) + rw [← ha,Functor.mapHomotopyCategory_map] + have h : DerivedCategory.Qh.map ((HomotopyCategory.quotient _ _).map (tensorMap (Y := Y) f)) ≫ + DerivedCategory.Qh.map (SelectedTensorComparison.finiteIso (representation (Y := Y)) E).hom = + DerivedCategory.Qh.map (SelectedTensorComparison.finiteIso (representation (Y := Y)) D).hom ≫ + I.map ((source (Y := Y)).map a) := by + dsimp only [SelectedTensorComparison.finiteIso,Iso.refl_hom] + erw [CategoryTheory.Functor.map_id,CategoryTheory.Functor.map_id,Category.comp_id,Category.id_comp,hq] + rfl + exact DiagramEvaluationSquares.compose _ _ _ + ((DerivedCategory.quotientCompQhIso C).symm.app (complex (Y := Y) D)) + ((DerivedCategory.quotientCompQhIso C).symm.app (complex (Y := Y) E)) + (DerivedCategory.Qh.mapIso (SelectedTensorComparison.finiteIso (representation (Y := Y)) D)) + (DerivedCategory.Qh.mapIso (SelectedTensorComparison.finiteIso (representation (Y := Y)) E)) + ((DerivedCategory.quotientCompQhIso C).inv.naturality (tensorMap (Y := Y) f)) h + +lemma comparison_map {D E : SourceVerdier.K P} + (f : UnderlyingRepresentatives.complex P D ⟶ UnderlyingRepresentatives.complex P E) + (a : D ⟶ E) + (ha : (HomotopyCategory.quotient _ _).map f = (SourceModelBridge.ambient P).map a) (n : ℤ) : + HomologicalComplex.homologyMap (tensorMap (Y := Y) f) n ≫ (comparison (Y := Y) E n).hom = + (comparison (Y := Y) D n).hom ≫ (cohomology n).map ((source (Y := Y)).map a) := by + have h := congrArg (DerivedCategory.homologyFunctor C n).map (derived_map (Y := Y) f a ha) + simp only [Functor.map_comp] at h + exact DiagramEvaluationSquares.compose _ _ _ + ((DerivedCategory.homologyFunctorFactors C n).symm.app (complex (Y := Y) D)) + ((DerivedCategory.homologyFunctorFactors C n).symm.app (complex (Y := Y) E)) + ((DerivedCategory.homologyFunctor C n).mapIso (derivedIso (Y := Y) D)) + ((DerivedCategory.homologyFunctor C n).mapIso (derivedIso (Y := Y) E)) + ((DerivedCategory.homologyFunctorFactors C n).inv.naturality (tensorMap (Y := Y) f)) h + +lemma homology_arrow {D E : SourceVerdier.K P} + (f : UnderlyingRepresentatives.complex P D ⟶ UnderlyingRepresentatives.complex P E) + (a : D ⟶ E) + (ha : (HomotopyCategory.quotient _ _).map f = (SourceModelBridge.ambient P).map a) + (eD : (source (Y := Y)).obj D ≅ target (Y := Y)) + (eE : (source (Y := Y)).obj E ≅ target (Y := Y)) (r : SelectionRing) + (hs : (source (Y := Y)).map a ≫ eE.hom = eD.hom ≫ targetAction (Y := Y) r) + (n : ℤ) (hn : n = 0 ∨ n = -3) : + HomologicalComplex.homologyMap (tensorMap (Y := Y) f) n ≫ (homologyIso E eE n hn).hom = + (homologyIso D eD n hn).hom ≫ HAction (Y := Y) r := by + have h := congrArg (cohomology n).map hs + simp only [Functor.map_comp] at h + exact DiagramEvaluationSquares.compose _ _ _ + (comparison D n) (comparison E n) + ((cohomology n).mapIso eD ≪≫ modelIso n hn) + ((cohomology n).mapIso eE ≪≫ modelIso n hn) + (comparison_map f a ha n) + (DiagramEvaluationSquares.compose _ _ _ ((cohomology n).mapIso eD) + ((cohomology n).mapIso eE) (modelIso n hn) (modelIso n hn) h (model_action n hn r)) + +lemma arrow01 (a : Fin (encoding.generators+1)) + (f : UnderlyingRepresentatives.complex P fixed.D0 ⟶ UnderlyingRepresentatives.complex P fixed.D1) + (hf : (HomotopyCategory.quotient _ _).map f = (SourceModelBridge.ambient P).map (fixed.f a)) + (n : ℤ) (hn : n = 0 ∨ n = -3) : + HomologicalComplex.homologyMap (tensorMap (Y := Y) f) n ≫ (SelectedChainHomology.D1Iso n hn).hom = + (SelectedChainHomology.D0Iso n hn).hom ≫ HAction (Y := Y) + (RelationBasisAction.arrow (SelectionEncoding.generator encoding) a) := + homology_arrow f (fixed.f a) hf SelectedNativeEvaluation.D0Iso SelectedNativeEvaluation.D1Iso _ + (SelectedNativeEvaluation.D_arrow01 a) n hn +lemma arrow12 (a : Fin (encoding.generators+1)) + (g : UnderlyingRepresentatives.complex P fixed.D1 ⟶ UnderlyingRepresentatives.complex P fixed.D2) + (hg : (HomotopyCategory.quotient _ _).map g = (SourceModelBridge.ambient P).map (fixed.g a)) + (n : ℤ) (hn : n = 0 ∨ n = -3) : + HomologicalComplex.homologyMap (tensorMap (Y := Y) g) n ≫ (SelectedChainHomology.D2Iso n hn).hom = + (SelectedChainHomology.D1Iso n hn).hom ≫ HAction (Y := Y) + (RelationBasisAction.arrow (SelectionEncoding.generator encoding) a) := + homology_arrow g (fixed.g a) hg SelectedNativeEvaluation.D1Iso SelectedNativeEvaluation.D2Iso _ + (SelectedNativeEvaluation.D_arrow12 a) n hn +end LittleFinitistic.SelectedUnderlyingHomology + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedVertexTensorEvaluation.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedVertexTensorEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..464dac57806b45499ec3e2ce558fad5656508914 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedVertexTensorEvaluation.lean @@ -0,0 +1,72 @@ +import OAI.Algebra.Finitistic.Rectification.VertexTensorEvaluation +import OAI.Algebra.Finitistic.Localization.TensorEvaluationComparison + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.QuadraticEncoding +open IdempotentTensor BalancedTensor Representation +universe u v +variable {k : Type u} [Field k] {d t : ℕ} (P : Relations k d t) + +/-- The manuscript's actual right vertex projectives. -/ +def vertexModule (i : Fin 3) : ModuleCat.{u} (B P)ᵐᵒᵖ := + ModuleCat.of (B P)ᵐᵒᵖ (rightIdeal (vertexId (P := P) i)) + +def arrowModule01 (h : Fin (d+1)) : vertexModule P 0 ⟶ vertexModule P 1 := + ModuleCat.ofHom (leftMultiply (arrow01 P h) (arrow01_target h)) +def arrowModule12 (h : Fin (d+1)) : vertexModule P 1 ⟶ vertexModule P 2 := + ModuleCat.ofHom (leftMultiply (arrow12 P h) (arrow12_target h)) + +variable {P} {Y : Type v} [AddCommGroup Y] [Module k Y] (X : Representation P Y) + +/-- The natural identifications for the actual tensor functor. -/ +def evaluationVertexEquiv (i : Fin 3) : + (tensorFunctor k (B P) X.Evaluation).obj (vertexModule P i) ≃ₗ[k] Y := + (tensorFunctorEquiv (rightIdeal (vertexId (P := P) i)) X.Evaluation).trans (X.vertexTensorEquiv i) + +theorem evaluation_arrow01 (h : Fin (d+1)) (y : Y) : + evaluationVertexEquiv X 1 + ((tensorFunctor k (B P) X.Evaluation).map (arrowModule01 P h) + ((evaluationVertexEquiv X 0).symm y)) = + (Fin.cases (motive := fun _ => Module.End k Y) 1 X.generator h) y := by + change X.projection 1 ((arrow01 P h * vertexId (P := P) 0) • X.inclusion 0 y) = _ + rw [arrow01_source] + erw [X.arrow01_smul] + rfl + +theorem evaluation_arrow12 (h : Fin (d+1)) (y : Y) : + evaluationVertexEquiv X 2 + ((tensorFunctor k (B P) X.Evaluation).map (arrowModule12 P h) + ((evaluationVertexEquiv X 1).symm y)) = + (Fin.cases (motive := fun _ => Module.End k Y) 1 X.generator h) y := by + change X.projection 2 ((arrow12 P h * vertexId (P := P) 1) • X.inclusion 1 y) = _ + rw [arrow12_source] + erw [X.arrow12_smul] + rfl + +/-- Tensor evaluation sends s to an actual isomorphism, conjugate to id_Y. -/ +theorem evaluation_s_isIso : IsIso ((tensorFunctor k (B P) X.Evaluation).map (arrowModule01 P 0)) := by + let e := (evaluationVertexEquiv X 0).trans (evaluationVertexEquiv X 1).symm + have he : (tensorFunctor k (B P) X.Evaluation).map (arrowModule01 P 0) = e.toModuleIso.hom := by + ext z + apply (evaluationVertexEquiv X 1).injective + have h := evaluation_arrow01 X 0 (evaluationVertexEquiv X 0 z) + simpa [e] using h + rw [he] + infer_instance + +theorem evaluation_s'_isIso : IsIso ((tensorFunctor k (B P) X.Evaluation).map (arrowModule12 P 0)) := by + let e := (evaluationVertexEquiv X 1).trans (evaluationVertexEquiv X 2).symm + have he : (tensorFunctor k (B P) X.Evaluation).map (arrowModule12 P 0) = e.toModuleIso.hom := by + ext z + apply (evaluationVertexEquiv X 2).injective + have h := evaluation_arrow12 X 0 (evaluationVertexEquiv X 1 z) + simpa [e] using h + rw [he] + infer_instance +end LittleFinitistic.QuadraticEncoding + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selected/SelectedWindow.lean b/lean/OAI/Algebra/Finitistic/Selected/SelectedWindow.lean new file mode 100644 index 0000000000000000000000000000000000000000..b45c20769d2db1344878526913d543a55af5faab --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selected/SelectedWindow.lean @@ -0,0 +1,49 @@ +import OAI.Algebra.Finitistic.Selected.SelectedRectification + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.SelectedWindow +open SelectedFixedDiagram SelectedRectification + +/-- A common finite support window chosen from the fixed representatives alone. -/ +structure Window where + lo : ℤ + hi : ℤ + bound0 : ∀ n, n < lo ∨ hi < n → IsZero (D0.X n) + bound1 : ∀ n, n < lo ∨ hi < n → IsZero (D1.X n) + bound2 : ∀ n, n < lo ∨ hi < n → IsZero (D2.X n) + +instance : Nonempty Window := by + obtain ⟨l₀,h₀,b₀⟩ := UnderlyingRepresentatives.bounded P fixed.D0 + obtain ⟨l₁,h₁,b₁⟩ := UnderlyingRepresentatives.bounded P fixed.D1 + obtain ⟨l₂,h₂,b₂⟩ := UnderlyingRepresentatives.bounded P fixed.D2 + refine ⟨⟨min l₀ (min l₁ l₂), max h₀ (max h₁ h₂), ?_, ?_, ?_⟩⟩ + · intro n hn; apply b₀ n; omega + · intro n hn; apply b₁ n; omega + · intro n hn; apply b₂ n; omega + +def window : Window := Classical.choice inferInstance +abbrev lo := window.lo +abbrev hi := window.hi + +/-- Every term outside the fixed total's resulting support window is zero. -/ +theorem bounded (n : ℤ) (hn : n < lo - 2 ∨ hi < n) : IsZero (bimodule.X n) := + InducedRectification.total_bounded (ConcreteQuadraticDiagram.quadratic P) + D0 D1 D2 f g relations lo hi window.bound0 window.bound1 window.bound2 n hn + +/-- The support choices retain the complete proved rectification certificate. -/ +theorem verified : RectificationLemma.Verified P D0 D1 D2 f g relations lo hi := + RectificationLemma.rectification P D0 D1 D2 f g relations lo hi + window.bound0 window.bound1 window.bound2 + (UnderlyingRepresentatives.projective P fixed.D0) + (UnderlyingRepresentatives.projective P fixed.D1) + (UnderlyingRepresentatives.projective P fixed.D2) + (UnderlyingRepresentatives.finite P fixed.D0) + (UnderlyingRepresentatives.finite P fixed.D1) + (UnderlyingRepresentatives.finite P fixed.D2) +end LittleFinitistic.SelectedWindow + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selection/AuxiliaryGroupAlgebraPresentation.lean b/lean/OAI/Algebra/Finitistic/Selection/AuxiliaryGroupAlgebraPresentation.lean new file mode 100644 index 0000000000000000000000000000000000000000..001af2e3da9aa29425e60067956497b6433ccd9f --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selection/AuxiliaryGroupAlgebraPresentation.lean @@ -0,0 +1,39 @@ +import OAI.Algebra.Finitistic.Selection.GroupAlgebraPresentation +import OAI.Algebra.Finitistic.Selection.FinitePresentation + +namespace OAI +noncomputable section +namespace LittleFinitistic.GroupAlgebraPresentation + +/-- Section 2's complex group algebra, for the exact auxiliary group supplied +by the manuscript. The stable finite model has 18 generators, including the +three redundant diagonal W generators killed by its relations. -/ +def auxiliaryGroupAlgebraEquiv : + PresentedAlgebra ℂ FinitePresentation.SeedGenerator FinitePresentation.finiteRelators ≃ₐ[ℂ] + MonoidAlgebra ℂ Presentation.AuxiliaryGroup := + (quotientEquiv ℂ FinitePresentation.SeedGenerator FinitePresentation.finiteRelators).trans + (MonoidAlgebra.domCongr ℂ ℂ FinitePresentation.presentationEquiv) + +/-- Same explicit presentation expressed as polynomial zero relations. -/ +def auxiliaryGroupAlgebraZeroEquiv : + (zeroRelations ℂ FinitePresentation.SeedGenerator FinitePresentation.finiteRelators).Quotient ≃ₐ[ℂ] + MonoidAlgebra ℂ Presentation.AuxiliaryGroup := + (zeroQuotientEquiv ℂ FinitePresentation.SeedGenerator FinitePresentation.finiteRelators).trans + (MonoidAlgebra.domCongr ℂ ℂ FinitePresentation.presentationEquiv) + +/-- The finite-presentation assertion for R = ℂ[G] in Section 2's proof of +Proposition selection. This is a NONCOMMUTATIVE unital algebra presentation. -/ +theorem auxiliaryGroupAlgebra_hasFinitePresentation : + HasFinitePresentation ℂ (MonoidAlgebra ℂ Presentation.AuxiliaryGroup) := by + let := FinitePresentation.auxiliaryGroup_isFinitelyPresented + exact groupAlgebra_hasFinitePresentation ℂ Presentation.AuxiliaryGroup + +/-- Positive and negative letters for the stable finite model: 36 algebra generators. -/ +theorem auxiliary_algebra_generator_count : + Fintype.card (Letter FinitePresentation.SeedGenerator) = 36 := by + simp [Letter, Fintype.card_prod, FinitePresentation.seedGenerator_card] +end LittleFinitistic.GroupAlgebraPresentation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selection/CharacterModule.lean b/lean/OAI/Algebra/Finitistic/Selection/CharacterModule.lean new file mode 100644 index 0000000000000000000000000000000000000000..a77d1be48384a6f0b3855650bb9b197b0a913553 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selection/CharacterModule.lean @@ -0,0 +1,89 @@ +import Mathlib.Algebra.MonoidAlgebra.Basic +import Mathlib.Basic.Complex.Basic +import Mathlib.Tactic.FieldSimp +import Mathlib.LinearAlgebra.FiniteDimensional.Basic +import OAI.Algebra.Finitistic.Selection.MatrixModel + +namespace OAI +open scoped BigOperators + +namespace LittleFinitistic +namespace CharacterModule + +open MonoidAlgebra + +variable {H F : Type*} [Group H] [Group F] [Fintype H] +variable (ψ : H →* F) (χ : H →* ℂˣ) + +/-- The unnormalized character projector. Its identity coefficient is one, +so normalization is unnecessary for constructing the nonzero test module. -/ +noncomputable def projector : MonoidAlgebra ℂ F := + ∑ h : H, single (ψ h) ((χ h : ℂ)⁻¹) + +theorem projector_coeff_one (hψ : Function.Injective ψ) : + (projector ψ χ).coeff 1 = 1 := by + classical + have hp (h : H) : ψ h = 1 ↔ h = 1 := by + rw [← map_one ψ] + exact hψ.eq_iff + simp [projector, coeff_sum, coeff_single, Finsupp.single_apply, hp] + +theorem projector_ne_zero (hψ : Function.Injective ψ) : projector ψ χ ≠ 0 := by + intro h + have := projector_coeff_one ψ χ hψ + rw [h] at this + simp at this + +theorem projector_eigen (h : H) : + single (ψ h) (1 : ℂ) * projector ψ χ = (χ h : ℂ) • projector ψ χ := by + classical + unfold projector + rw [Finset.mul_sum, Finset.smul_sum] + have he := Equiv.sum_comp (Equiv.mulLeft h) (fun k : H => + (χ h : ℂ) • single (ψ k) ((χ k : ℂ)⁻¹)) + rw [← he] + apply Finset.sum_congr rfl + intro k _ + change single (ψ h) (1 : ℂ) * single (ψ k) ((χ k : ℂ)⁻¹) = + (χ h : ℂ) • single (ψ (h*k)) ((χ (h*k) : ℂ)⁻¹) + simp only [map_mul,Units.val_mul,single_mul_single,one_mul, + smul_single,smul_eq_mul] + congr 1 + field_simp + +variable (hc : ∀ h g, Commute (ψ h) g) + +/-- All vectors on which the central subgroup acts by the selected character. -/ +noncomputable def eigenspace : Submodule (MonoidAlgebra ℂ F) (MonoidAlgebra ℂ F) where + carrier := {x | ∀ h, single (ψ h) (1 : ℂ) * x = (χ h : ℂ) • x} + zero_mem' := by simp + add_mem' := by + intro a b ha hb h + simp [mul_add,ha h,hb h,smul_add] + smul_mem' := by + intro a x hx h + change single (ψ h) (1 : ℂ) * (a*x) = (χ h : ℂ) • (a*x) + rw [← mul_assoc, (MonoidAlgebra.single_commute (hc h) Commute.one_left a).eq, + mul_assoc,hx h,mul_smul_comm] + +theorem projector_mem : projector ψ χ ∈ eigenspace ψ χ hc := + projector_eigen ψ χ + +theorem eigenspace_nontrivial (hψ : Function.Injective ψ) : + Nontrivial (eigenspace ψ χ hc) := by + refine ⟨⟨⟨projector ψ χ,projector_mem ψ χ hc⟩,0,?_⟩⟩ + intro h + exact projector_ne_zero ψ χ hψ (congrArg Subtype.val h) + +omit [Fintype H] in +theorem eigenspace_finiteDimensional [Finite F] : + FiniteDimensional ℂ (eigenspace ψ χ hc) := by + have : FiniteDimensional ℂ (MonoidAlgebra ℂ F) := + Module.Finite.equiv (MonoidAlgebra.coeffLinearEquiv ℂ : MonoidAlgebra ℂ F ≃ₗ[ℂ] (F →₀ ℂ)).symm + exact FiniteDimensional.of_injective ((eigenspace ψ χ hc).restrictScalars ℂ).subtype + Subtype.val_injective + +end CharacterModule +end LittleFinitistic + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selection/FinitePresentation.lean b/lean/OAI/Algebra/Finitistic/Selection/FinitePresentation.lean new file mode 100644 index 0000000000000000000000000000000000000000..6760fe723221524bea9ce5ae9371bf3b59bc1967 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selection/FinitePresentation.lean @@ -0,0 +1,600 @@ +import OAI.Algebra.Finitistic.Selection.GroupSelection +import Mathlib.GroupTheory.FinitelyPresentedGroup +import Mathlib.Tactic.DeriveFintype + +namespace OAI +open scoped commutatorElement +namespace LittleFinitistic.FinitePresentation + +/-! Target: Group.IsFinitelyPresented Presentation.AuxiliaryGroup. +Section 2, Lemma group-finite-presentation. No finite-presentation hypothesis +is permitted on the target group. Diagonal W generators are redundant. +-/ + +section Orbit +variable {G : Type*} [Group G] + +def orbit (t x : G) (r : ℤ) : G := t ^ r * x * (t ^ r)⁻¹ + +@[simp] theorem orbit_zero (t x : G) : orbit t x 0 = x := by simp [orbit] + +theorem orbit_add (t x : G) (a b : ℤ) : + orbit t (orbit t x b) a = orbit t x (a+b) := by + simp only [orbit, zpow_add, mul_inv_rev] + group + +theorem orbit_commute (t q x : G) (h : Commute t q) (a : ℤ) : + t * orbit q x a * t⁻¹ = orbit q (t*x*t⁻¹) a := by + have hc := h.zpow_right a + simp only [orbit] + calc + t * (q^a*x*(q^a)⁻¹) * t⁻¹ = (t*q^a)*x*(q^a)⁻¹*t⁻¹ := by group + _ = (q^a*t)*x*(q^a)⁻¹*t⁻¹ := by rw [hc.eq] + _ = q^a*(t*x)*((q^a)⁻¹*t⁻¹) := by group + _ = q^a*(t*x)*(t⁻¹*(q^a)⁻¹) := by rw [hc.inv_inv.eq] + _ = q^a*(t*x*t⁻¹)*(q^a)⁻¹ := by group + +theorem orbit_covariance (t q x : G) (h : Commute t q) (d : ℤ) + (hx : t*x*t⁻¹ = orbit q x d) (a : ℤ) : + t * orbit q x a * t⁻¹ = orbit q x (a+d) := by + rw [orbit_commute t q x h a, hx, orbit_add] + +theorem family_zpow (t : G) (f : ℤ → G) (d : ℤ) + (h : ∀ r, t*f r*t⁻¹ = f (r+d)) (n r : ℤ) : + orbit t (f r) n = f (r+n*d) := by + induction n using Int.induction_on with + | zero => simp + | succ n ih => + have he : (↑n + 1 : ℤ) = 1 + ↑n := by omega + rw [he, ← orbit_add, ih] + change t^ (1:ℤ) * _ * (t^(1:ℤ))⁻¹ = _ + simp only [zpow_one, h] + congr 1 + ring + | pred n ih => + have hi := h (r + (-↑n - 1)*d) + have he : r + (-↑n - 1)*d+d = r+(-↑n)*d := by ring + rw [he] at hi + have he' : (-↑n - 1 : ℤ) = -1 + -↑n := by omega + rw [he', ← orbit_add, ih, ← hi] + simp only [orbit, zpow_neg_one, inv_inv] + group + +end Orbit + +abbrev Lattice := Fin 3 → ℤ + +def coord (i : Fin 3) (r : ℤ) : Lattice := fun h => if h=i then r else 0 + +def wtU (i : Fin 3) (n : Lattice) := -n i + +def wtV (i : Fin 3) (n : Lattice) := n i + +def wtW (i j : Fin 3) (n : Lattice) := n i-n j + +/- Each theorem supplies the integral preimage in the corresponding table row. -/ +theorem table_UU (i j : Fin 3) (hij : i ≠ j) (r s : ℤ) : + ∃ n : Lattice, wtU i n = r ∧ wtU j n = s := by + refine ⟨coord i (-r) + coord j (-s), ?_⟩ + simp [wtU, coord, hij, hij.symm] + +theorem table_VV (i j : Fin 3) (hij : i ≠ j) (r s : ℤ) : + ∃ n : Lattice, wtV i n = r ∧ wtV j n = s := by + refine ⟨coord i r + coord j s, ?_⟩ + simp [wtV, coord, hij, hij.symm] + +theorem table_UV (i j : Fin 3) (hij : i ≠ j) (r s : ℤ) : + ∃ n : Lattice, wtU i n = r ∧ wtV j n = s := by + refine ⟨coord i (-r) + coord j s, ?_⟩ + simp [wtU, wtV, coord, hij, hij.symm] + +theorem table_WU (i j h : Fin 3) (hij : i ≠ j) (hhi : h ≠ i) (r s : ℤ) : + ∃ n : Lattice, wtW i j n = r ∧ wtU h n = s := by + by_cases hhj : h=j + · subst h + refine ⟨coord i (r-s) + coord j (-s), ?_⟩ + simp [wtW, wtU, coord, hij, hij.symm] + · refine ⟨coord i r + coord h (-s), ?_⟩ + simp [wtW, wtU, coord, hij.symm, hhi, (Ne.symm hhi), (Ne.symm hhj)] + +theorem table_WV (i j h : Fin 3) (hij : i ≠ j) (hhj : h ≠ j) (r s : ℤ) : + ∃ n : Lattice, wtW i j n = r ∧ wtV h n = s := by + by_cases hhi : h=i + · subst h + refine ⟨coord i s + coord j (s-r), ?_⟩ + simp [wtW, wtV, coord, hij, hij.symm] + · refine ⟨coord i r + coord h s, ?_⟩ + simp [wtW, wtV, coord, hij.symm, hhi, (Ne.symm hhi), (Ne.symm hhj)] + +theorem table_UW (i j : Fin 3) (hij : i ≠ j) (r s : ℤ) : + ∃ n : Lattice, wtU i n = r ∧ wtW i j n = s := by + refine ⟨coord i (-r) + coord j (-r-s), ?_⟩ + simp [wtU, wtW, coord, hij, hij.symm] + +theorem table_WV_output (i j : Fin 3) (hij : i ≠ j) (r s : ℤ) : + ∃ n : Lattice, wtW i j n = r ∧ wtV j n = s := by + refine ⟨coord i (r+s) + coord j s, ?_⟩ + simp [wtW, wtV, coord, hij, hij.symm] + + +section Torus +variable {G : Type*} [Group G] + +def torus (T : Fin 3 → G) (n : Lattice) : G := T 0 ^ n 0 * T 1 ^ n 1 * T 2 ^ n 2 + +theorem family_torus (T : Fin 3 → G) (f : ℤ → G) (d : Fin 3 → ℤ) + (hf : ∀ l r, T l * f r * (T l)⁻¹ = f (r+d l)) (n : Lattice) (r : ℤ) : + torus T n * f r * (torus T n)⁻¹ = + f (r + n 0*d 0 + n 1*d 1 + n 2*d 2) := by + have he : torus T n * f r * (torus T n)⁻¹ = + orbit (T 0) (orbit (T 1) (orbit (T 2) (f r) (n 2)) (n 1)) (n 0) := by + simp only [torus, orbit] + group + rw [he, family_zpow _ _ _ (hf 2), family_zpow _ _ _ (hf 1), + family_zpow _ _ _ (hf 0)] + congr 1 + ring + +theorem torus_U (T : Fin 3 → G) (U : Fin 3 → ℤ → G) + (hf : ∀ l i r, T l * U i r * (T l)⁻¹ = U i (r-if l=i then 1 else 0)) + (n : Lattice) (i : Fin 3) (r : ℤ) : + torus T n * U i r * (torus T n)⁻¹ = U i (r+wtU i n) := by + have h := family_torus T (U i) (fun l => -(if l=i then 1 else 0)) + (fun l r => by simpa only [sub_eq_add_neg] using hf l i r) n r + convert h using 2; fin_cases i <;> simp [wtU] + +theorem torus_V (T : Fin 3 → G) (V : Fin 3 → ℤ → G) + (hf : ∀ l i r, T l * V i r * (T l)⁻¹ = V i (r+if l=i then 1 else 0)) + (n : Lattice) (i : Fin 3) (r : ℤ) : + torus T n * V i r * (torus T n)⁻¹ = V i (r+wtV i n) := by + have h := family_torus T (V i) (fun l => if l=i then 1 else 0) + (fun l r => hf l i r) n r + convert h using 2; fin_cases i <;> simp [wtV] + +theorem torus_W (T : Fin 3 → G) (W : Fin 3 → Fin 3 → ℤ → G) + (hf : ∀ l i j r, T l * W i j r * (T l)⁻¹ = + W i j (r+(if l=i then 1 else 0)-if l=j then 1 else 0)) + (n : Lattice) (i j : Fin 3) (r : ℤ) : + torus T n * W i j r * (torus T n)⁻¹ = W i j (r+wtW i j n) := by + have h := family_torus T (W i j) (fun l => (if l=i then 1 else 0)-(if l=j then 1 else 0)) + (fun l r => by simpa only [add_sub_assoc] using hf l i j r) n r + convert h using 2; fin_cases i <;> fin_cases j <;> simp [wtW] <;> ring +end Torus + + +/-- Intermediate data: covariance plus only zero-argument algebraic relations. +This is constructed below from a finite presented group, not postulated for it. -/ +structure CovariantData (G : Type*) [Group G] where + T : Fin 3 → G + U : Fin 3 → ℤ → G + V : Fin 3 → ℤ → G + W : Fin 3 → Fin 3 → ℤ → G + TT : ∀ i j, Commute (T i) (T j) + TU : ∀ l i a, T l * U i a * (T l)⁻¹ = U i (a-if l=i then 1 else 0) + TV : ∀ l i a, T l * V i a * (T l)⁻¹ = V i (a+if l=i then 1 else 0) + TW : ∀ l i j a, T l * W i j a * (T l)⁻¹ = + W i j (a+(if l=i then 1 else 0)-if l=j then 1 else 0) + diagonal : ∀ i a, W i i a = 1 + square : ∀ i, U i 0 * U i 0 = 1 + UU : ∀ i j, i ≠ j → Commute (U i 0) (U j 0) + VV : ∀ i j, i ≠ j → Commute (V i 0) (V j 0) + UV : ∀ i j, i ≠ j → Commute (U i 0) (V j 0) + WU : ∀ i j h, h ≠ i → Commute (W i j 0) (U h 0) + WV : ∀ i j h, h ≠ j → Commute (W i j 0) (V h 0) + UWout : ∀ i j, i ≠ j → ⁅U i 0,W i j 0⁆ = U j 0 + WVout : ∀ i j, i ≠ j → ⁅W i j 0,V j 0⁆ = V i 0 + +namespace CovariantData +variable {G : Type*} [Group G] (D : CovariantData G) + +def act (n : Lattice) : G ≃* G := MulAut.conj (torus D.T n) + +@[simp] theorem act_U (n : Lattice) (i : Fin 3) (a : ℤ) : + D.act n (D.U i a) = D.U i (a+wtU i n) := torus_U D.T D.U D.TU n i a +@[simp] theorem act_V (n : Lattice) (i : Fin 3) (a : ℤ) : + D.act n (D.V i a) = D.V i (a+wtV i n) := torus_V D.T D.V D.TV n i a +@[simp] theorem act_W (n : Lattice) (i j : Fin 3) (a : ℤ) : + D.act n (D.W i j a) = D.W i j (a+wtW i j n) := torus_W D.T D.W D.TW n i j a + +/-- All infinite relators follow from the finite zero-argument patterns. -/ +def toSelection : SelectionGroupData G where + T := D.T + U := D.U + V := D.V + W := D.W + commute_TT := D.TT + conj_TU := D.TU + conj_TV := D.TV + conj_TW := D.TW + diagonal_W := D.diagonal + square_U i a := by + have ha : wtU i (coord i (-a)) = a := by simp [wtU, coord] + have h := congrArg (D.act (coord i (-a))) (D.square i) + simpa only [map_mul, map_one, act_U, zero_add, ha] using h + commute_UU i j a b hij := by + obtain ⟨n, ha, hb⟩ := table_UU i j hij a b + have h := (D.UU i j hij).map (D.act n) + simpa only [act_U, zero_add, ha, hb] using h + commute_VV i j a b hij := by + obtain ⟨n, ha, hb⟩ := table_VV i j hij a b + have h := (D.VV i j hij).map (D.act n) + simpa only [act_V, zero_add, ha, hb] using h + commute_UV i j a b hij := by + obtain ⟨n, ha, hb⟩ := table_UV i j hij a b + have h := (D.UV i j hij).map (D.act n) + simpa only [act_U, act_V, zero_add, ha, hb] using h + commute_WU i j h a b hhi := by + by_cases hij : i=j + · subst j + rw [D.diagonal] + exact Commute.one_left _ + · obtain ⟨n, ha, hb⟩ := table_WU i j h hij hhi a b + have hh := (D.WU i j h hhi).map (D.act n) + simpa only [act_U, act_W, zero_add, ha, hb] using hh + commute_WV i j h a b hhj := by + by_cases hij : i=j + · subst j + rw [D.diagonal] + exact Commute.one_left _ + · obtain ⟨n, ha, hb⟩ := table_WV i j h hij hhj a b + have hh := (D.WV i j h hhj).map (D.act n) + simpa only [act_V, act_W, zero_add, ha, hb] using hh + commutator_UW i j a b hij := by + obtain ⟨n, ha, hb⟩ := table_UW i j hij a b + have hout : wtU j n = a+b := by dsimp [wtU, wtW] at *; omega + have h := congrArg (D.act n) (D.UWout i j hij) + simpa only [map_commutatorElement, act_U, act_W, zero_add, ha, hb, hout] using h + commutator_WV i j a b hij := by + obtain ⟨n, ha, hb⟩ := table_WV_output i j hij a b + have hout : wtV i n = a+b := by dsimp [wtV, wtW] at *; omega + have h := congrArg (D.act n) (D.WVout i j hij) + simpa only [map_commutatorElement, act_V, act_W, zero_add, ha, hb, hout] using h +end CovariantData + +/-- Finitely many seed values. Diagonal W seeds will be killed. -/ +structure SeedValues (G : Type*) where + T : Fin 3 → G + u : Fin 3 → G + v : Fin 3 → G + w : Fin 3 → Fin 3 → G + +structure SeedData (G : Type*) [Group G] extends SeedValues G where + TT : ∀ i j, Commute (T i) (T j) + Tu : ∀ l i, T l*u i*(T l)⁻¹ = orbit (T i) (u i) (if l=i then 1 else 0) + Tv : ∀ l i, T l*v i*(T l)⁻¹ = orbit (T i) (v i) (if l=i then 1 else 0) + Tw : ∀ l i j, T l*w i j*(T l)⁻¹ = + orbit (T i) (w i j) ((if l=i then 1 else 0)-(if l=j then 1 else 0)) + diagonal : ∀ i, w i i = 1 + square : ∀ i, u i*u i = 1 + UU : ∀ i j, i ≠ j → Commute (u i) (u j) + VV : ∀ i j, i ≠ j → Commute (v i) (v j) + UV : ∀ i j, i ≠ j → Commute (u i) (v j) + WU : ∀ i j h, h ≠ i → Commute (w i j) (u h) + WV : ∀ i j h, h ≠ j → Commute (w i j) (v h) + UWout : ∀ i j, i ≠ j → ⁅u i,w i j⁆ = u j + WVout : ∀ i j, i ≠ j → ⁅w i j,v j⁆ = v i + +namespace SeedData +variable {G : Type*} [Group G] (D : SeedData G) + +def toCovariant : CovariantData G where + T := D.T + U i r := orbit (D.T i) (D.u i) (-r) + V i r := orbit (D.T i) (D.v i) r + W i j r := orbit (D.T i) (D.w i j) r + TT := D.TT + TU l i a := by + rw [orbit_covariance _ _ _ (D.TT l i) _ (D.Tu l i)] + congr 1 + omega + TV l i a := orbit_covariance _ _ _ (D.TT l i) _ (D.Tv l i) a + TW l i j a := by + rw [orbit_covariance _ _ _ (D.TT l i) _ (D.Tw l i j)] + congr 1 + omega + diagonal i a := by simp [orbit, D.diagonal] + square i := by simpa using D.square i + UU i j h := by simpa using D.UU i j h + VV i j h := by simpa using D.VV i j h + UV i j h := by simpa using D.UV i j h + WU i j h hh := by simpa using D.WU i j h hh + WV i j h hh := by simpa using D.WV i j h hh + UWout i j h := by simpa using D.UWout i j h + WVout i j h := by simpa using D.WVout i j h + +def toSelection : SelectionGroupData G := D.toCovariant.toSelection +end SeedData + + +inductive SeedGenerator where + | T : Fin 3 → SeedGenerator + | U : Fin 3 → SeedGenerator + | V : Fin 3 → SeedGenerator + | W : Fin 3 → Fin 3 → SeedGenerator + deriving DecidableEq, Fintype + +inductive Rule where + | TT : Fin 3 → Fin 3 → Rule + | Tu : Fin 3 → Fin 3 → Rule + | Tv : Fin 3 → Fin 3 → Rule + | Tw : Fin 3 → Fin 3 → Fin 3 → Rule + | diagonal : Fin 3 → Rule + | square : Fin 3 → Rule + | UU : Fin 3 → Fin 3 → Rule + | VV : Fin 3 → Fin 3 → Rule + | UV : Fin 3 → Fin 3 → Rule + | WU : Fin 3 → Fin 3 → Fin 3 → Rule + | WV : Fin 3 → Fin 3 → Fin 3 → Rule + | UWout : Fin 3 → Fin 3 → Rule + | WVout : Fin 3 → Fin 3 → Rule + deriving DecidableEq, Fintype + +/-- Finite seed equation patterns. Vacuous index combinations give 1=1. -/ +def equation {G : Type*} [Group G] (D : SeedValues G) : Rule → G × G + | .TT i j => (D.T i*D.T j, D.T j*D.T i) + | .Tu l i => (D.T l*D.u i*(D.T l)⁻¹, orbit (D.T i) (D.u i) (if l=i then 1 else 0)) + | .Tv l i => (D.T l*D.v i*(D.T l)⁻¹, orbit (D.T i) (D.v i) (if l=i then 1 else 0)) + | .Tw l i j => (D.T l*D.w i j*(D.T l)⁻¹, + orbit (D.T i) (D.w i j) ((if l=i then 1 else 0)-(if l=j then 1 else 0))) + | .diagonal i => (D.w i i, 1) + | .square i => (D.u i*D.u i, 1) + | .UU i j => if i≠j then (D.u i*D.u j, D.u j*D.u i) else (1,1) + | .VV i j => if i≠j then (D.v i*D.v j, D.v j*D.v i) else (1,1) + | .UV i j => if i≠j then (D.u i*D.v j, D.v j*D.u i) else (1,1) + | .WU i j h => if h≠i then (D.w i j*D.u h, D.u h*D.w i j) else (1,1) + | .WV i j h => if h≠j then (D.w i j*D.v h, D.v h*D.w i j) else (1,1) + | .UWout i j => if i≠j then (⁅D.u i,D.w i j⁆, D.u j) else (1,1) + | .WVout i j => if i≠j then (⁅D.w i j,D.v j⁆, D.v i) else (1,1) + +def freeSeeds : SeedValues (FreeGroup SeedGenerator) where + T i := FreeGroup.of (.T i) + u i := FreeGroup.of (.U i) + v i := FreeGroup.of (.V i) + w i j := FreeGroup.of (.W i j) + +def evalSeeds {G : Type*} (D : SeedValues G) : SeedGenerator → G + | .T i => D.T i + | .U i => D.u i + | .V i => D.v i + | .W i j => D.w i j + +theorem equation_evaluate {G : Type*} [Group G] (D : SeedValues G) (r : Rule) : + FreeGroup.lift (evalSeeds D) (equation freeSeeds r).1 = (equation D r).1 ∧ + FreeGroup.lift (evalSeeds D) (equation freeSeeds r).2 = (equation D r).2 := by + cases r <;> dsimp only [equation] <;> (try split_ifs) <;> simp [orbit, freeSeeds, evalSeeds] + +def relator (r : Rule) : FreeGroup SeedGenerator := + (equation freeSeeds r).1 * (equation freeSeeds r).2⁻¹ + +def finiteRelators : Set (FreeGroup SeedGenerator) := Set.range relator +abbrev Model := PresentedGroup finiteRelators + +instance : Finite finiteRelators := Set.finite_range relator +instance : Group.IsFinitelyPresented Model := inferInstance + +def modelValues : SeedValues Model where + T i := PresentedGroup.of (.T i) + u i := PresentedGroup.of (.U i) + v i := PresentedGroup.of (.V i) + w i j := PresentedGroup.of (.W i j) + +theorem model_equation (r : Rule) : + (equation modelValues r).1 = (equation modelValues r).2 := by + have hm : FreeGroup.lift (evalSeeds modelValues) = PresentedGroup.mk finiteRelators := by + apply FreeGroup.ext_hom + intro s + cases s <;> rfl + have h := PresentedGroup.mk_eq_mk_of_mul_inv_mem (rels := finiteRelators) + (x := (equation freeSeeds r).1) (y := (equation freeSeeds r).2) ⟨r,rfl⟩ + obtain ⟨h₁,h₂⟩ := equation_evaluate modelValues r + rw [hm] at h₁ h₂ + exact h₁.symm.trans (h.trans h₂) + +def modelSeedData : SeedData Model where + toSeedValues := modelValues + TT i j := by simpa [equation, Commute, SemiconjBy] using model_equation (.TT i j) + Tu l i := model_equation (.Tu l i) + Tv l i := model_equation (.Tv l i) + Tw l i j := model_equation (.Tw l i j) + diagonal i := model_equation (.diagonal i) + square i := model_equation (.square i) + UU i j h := by simpa [equation, h, Commute, SemiconjBy] using model_equation (.UU i j) + VV i j h := by simpa [equation, h, Commute, SemiconjBy] using model_equation (.VV i j) + UV i j h := by simpa [equation, h, Commute, SemiconjBy] using model_equation (.UV i j) + WU i j h hh := by simpa [equation, hh, Commute, SemiconjBy] using model_equation (.WU i j h) + WV i j h hh := by simpa [equation, hh, Commute, SemiconjBy] using model_equation (.WV i j h) + UWout i j h := by simpa [equation, h] using model_equation (.UWout i j) + WVout i j h := by simpa [equation, h] using model_equation (.WVout i j) + +/-- The homomorphism from the supplied infinite presentation to the finite model. -/ +def toModel : Presentation.AuxiliaryGroup →* Model := + Presentation.ofData modelSeedData.toSelection + + +section OriginalSeeds +variable {G : Type*} [Group G] (D : SelectionGroupData G) + +@[simp] theorem selection_U_orbit (i : Fin 3) (a : ℤ) : + orbit (D.T i) (D.U i 0) (-a) = D.U i a := by + have h := family_zpow (D.T i) (D.U i) (-1) + (fun r => by simpa only [ite_true, sub_eq_add_neg] using D.conj_TU i i r) (-a) 0 + simpa using h + +@[simp] theorem selection_V_orbit (i : Fin 3) (a : ℤ) : + orbit (D.T i) (D.V i 0) a = D.V i a := by + have h := family_zpow (D.T i) (D.V i) 1 + (fun r => by simpa only [ite_true] using D.conj_TV i i r) a 0 + simpa using h + +@[simp] theorem selection_W_orbit (i j : Fin 3) (a : ℤ) : + orbit (D.T i) (D.W i j 0) a = D.W i j a := by + by_cases hij : i=j + · subst j + simp [orbit, D.diagonal_W] + · have h := family_zpow (D.T i) (D.W i j) 1 + (fun r => by simpa [hij] using D.conj_TW i i j r) a 0 + simpa using h + +/-- The original presentation satisfies each of the finite seed equations. -/ +def originalSeeds : SeedData G where + T := D.T + u i := D.U i 0 + v i := D.V i 0 + w i j := D.W i j 0 + TT := D.commute_TT + Tu l i := by + have h := D.conj_TU l i 0 + have hh := selection_U_orbit D i (-(if l=i then 1 else 0)) + simp only [neg_neg] at hh + rw [hh] + simpa using h + Tv l i := by + rw [selection_V_orbit] + simpa using D.conj_TV l i 0 + Tw l i j := by + rw [selection_W_orbit] + simpa using D.conj_TW l i j 0 + diagonal i := D.diagonal_W i 0 + square i := D.square_U i 0 + UU i j h := D.commute_UU i j 0 0 h + VV i j h := D.commute_VV i j 0 0 h + UV i j h := D.commute_UV i j 0 0 h + WU i j h hh := D.commute_WU i j h 0 0 hh + WV i j h hh := D.commute_WV i j h 0 0 hh + UWout i j h := by simpa using D.commutator_UW i j 0 0 h + WVout i j h := by simpa using D.commutator_WV i j 0 0 h +end OriginalSeeds + +theorem seed_equation {G : Type*} [Group G] (D : SeedData G) (r : Rule) : + (equation D.toSeedValues r).1 = (equation D.toSeedValues r).2 := by + cases r with + | TT i j => exact (D.TT i j).eq + | Tu l i => exact D.Tu l i + | Tv l i => exact D.Tv l i + | Tw l i j => exact D.Tw l i j + | diagonal i => exact D.diagonal i + | square i => exact D.square i + | UU i j => + by_cases h : i≠j + · simpa only [equation, ite_eq_left h] using (D.UU i j h).eq + · simp [equation, h] + | VV i j => + by_cases h : i≠j + · simpa only [equation, ite_eq_left h] using (D.VV i j h).eq + · simp [equation, h] + | UV i j => + by_cases h : i≠j + · simpa only [equation, ite_eq_left h] using (D.UV i j h).eq + · simp [equation, h] + | WU i j k => + by_cases h : k≠i + · simpa only [equation, ite_eq_left h] using (D.WU i j k h).eq + · simp [equation, h] + | WV i j k => + by_cases h : k≠j + · simpa only [equation, ite_eq_left h] using (D.WV i j k h).eq + · simp [equation, h] + | UWout i j => by_cases h : i≠j <;> simp [equation, h, (D.UWout i j)] + | WVout i j => by_cases h : i≠j <;> simp [equation, h, (D.WVout i j)] + +/-- Universal evaluation of the finite presentation in any proved seed data. -/ +def modelLift {G : Type*} [Group G] (D : SeedData G) : Model →* G := + PresentedGroup.toGroup (f := evalSeeds D.toSeedValues) (by + intro r hr + obtain ⟨s,rfl⟩ := hr + dsimp only [relator] + rw [map_mul, map_inv, (equation_evaluate D.toSeedValues s).1, + (equation_evaluate D.toSeedValues s).2, seed_equation D s, mul_inv_cancel]) + +@[simp] theorem modelLift_of {G : Type*} [Group G] (D : SeedData G) (s : SeedGenerator) : + modelLift D (PresentedGroup.of s) = evalSeeds D.toSeedValues s := PresentedGroup.toGroup.of _ + +def fromModel : Model →* Presentation.AuxiliaryGroup := + modelLift (originalSeeds Presentation.data) + + +@[simp] theorem map_orbit {G H : Type*} [Group G] [Group H] (f : G →* H) + (t x : G) (a : ℤ) : f (orbit t x a) = orbit (f t) (f x) a := by simp [orbit] + +@[simp] theorem toModel_T (i : Fin 3) : + toModel (Presentation.data.T i) = modelValues.T i := + Presentation.ofData_of modelSeedData.toSelection (.T i) +@[simp] theorem toModel_U (i : Fin 3) (a : ℤ) : + toModel (Presentation.data.U i a) = orbit (modelValues.T i) (modelValues.u i) (-a) := + Presentation.ofData_of modelSeedData.toSelection (.U i a) +@[simp] theorem toModel_V (i : Fin 3) (a : ℤ) : + toModel (Presentation.data.V i a) = orbit (modelValues.T i) (modelValues.v i) a := + Presentation.ofData_of modelSeedData.toSelection (.V i a) +@[simp] theorem toModel_W (i j : Fin 3) (a : ℤ) : + toModel (Presentation.data.W i j a) = orbit (modelValues.T i) (modelValues.w i j) a := + Presentation.ofData_of modelSeedData.toSelection (.W i j a) + +@[simp] theorem fromModel_T (i : Fin 3) : + fromModel (modelValues.T i) = Presentation.data.T i := + modelLift_of (originalSeeds Presentation.data) (.T i) +@[simp] theorem fromModel_u (i : Fin 3) : + fromModel (modelValues.u i) = Presentation.data.U i 0 := + modelLift_of (originalSeeds Presentation.data) (.U i) +@[simp] theorem fromModel_v (i : Fin 3) : + fromModel (modelValues.v i) = Presentation.data.V i 0 := + modelLift_of (originalSeeds Presentation.data) (.V i) +@[simp] theorem fromModel_w (i j : Fin 3) : + fromModel (modelValues.w i j) = Presentation.data.W i j 0 := + modelLift_of (originalSeeds Presentation.data) (.W i j) + +theorem fromModel_toModel : fromModel.comp toModel = MonoidHom.id Presentation.AuxiliaryGroup := by + apply PresentedGroup.ext + intro s + cases s with + | T i => + change fromModel (toModel (Presentation.data.T i)) = Presentation.data.T i + simp + | U i a => + change fromModel (toModel (Presentation.data.U i a)) = Presentation.data.U i a + simp + | V i a => + change fromModel (toModel (Presentation.data.V i a)) = Presentation.data.V i a + simp + | W i j a => + change fromModel (toModel (Presentation.data.W i j a)) = Presentation.data.W i j a + simp + +theorem toModel_fromModel : toModel.comp fromModel = MonoidHom.id Model := by + apply PresentedGroup.ext + intro s + cases s with + | T i => + change toModel (fromModel (modelValues.T i)) = modelValues.T i + simp + | U i => + change toModel (fromModel (modelValues.u i)) = modelValues.u i + simp + | V i => + change toModel (fromModel (modelValues.v i)) = modelValues.v i + simp + | W i j => + change toModel (fromModel (modelValues.w i j)) = modelValues.w i j + simp + +/-- Equivalence of the explicit finite presentation and the supplied infinite presentation. -/ +def presentationEquiv : Model ≃* Presentation.AuxiliaryGroup where + toFun := fromModel + invFun := toModel + left_inv x := DFunLike.congr_fun toModel_fromModel x + right_inv x := DFunLike.congr_fun fromModel_toModel x + map_mul' := fromModel.map_mul + +/-- Section 2, Lemma group-finite-presentation, for the exact supplied AuxiliaryGroup. -/ +theorem auxiliaryGroup_isFinitelyPresented : + Group.IsFinitelyPresented Presentation.AuxiliaryGroup := + Group.IsFinitelyPresented.equiv presentationEquiv + +/-- The finite model retains the three redundant diagonal W generators. -/ +theorem seedGenerator_card : Fintype.card SeedGenerator = 18 := by decide +/-- Number of indexed finite equation patterns, including tautological cases. -/ +theorem rule_card : Fintype.card Rule = 159 := by decide +kernel + +theorem model_isFinitelyPresented : Group.IsFinitelyPresented Model := inferInstance +end LittleFinitistic.FinitePresentation + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selection/FiniteQuotient.lean b/lean/OAI/Algebra/Finitistic/Selection/FiniteQuotient.lean new file mode 100644 index 0000000000000000000000000000000000000000..87c767fdbe4289ab891eb17ea176d07f034e0941 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selection/FiniteQuotient.lean @@ -0,0 +1,245 @@ +import Mathlib.LinearAlgebra.Matrix.Diagonal +import Mathlib.RingTheory.AdjoinRoot +import Mathlib.Data.ZMod.Basic +import Mathlib.GroupTheory.Commutator.Basic +import Mathlib.Tactic.NoncommRing +import Mathlib.Tactic.Abel + +namespace OAI +/-! +Exact prerequisites for Section 2 of v5s9.15. + +These are the variable-coefficient elementary-matrix calculations in the +finite-quotient construction, over the actual rings F₂[t]/(t^m - 1). +They do not establish the paper's main homological theorem. +-/ + +open Matrix Polynomial + +namespace LittleFinitistic + +section ElementaryMatrices + +variable {R : Type*} [CommRing R] +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +def transvection (i j : ι) (a : R) : Matrix ι ι R := 1 + Matrix.single i j a + +theorem single_square_zero (i j : ι) (hij : i ≠ j) (a : R) : + (Matrix.single i j a : Matrix ι ι R) * Matrix.single i j a = 0 := by + exact Matrix.single_mul_single_of_ne a i j i (Ne.symm hij) a + +theorem transvection_mul_neg (i j : ι) (hij : i ≠ j) (a : R) : + transvection i j a * transvection i j (-a) = 1 := by + simp only [transvection, ← Matrix.single_neg, mul_add, add_mul, mul_one, one_mul, + mul_neg, single_square_zero i j hij] + abel + +def transvectionUnit (i j : ι) (hij : i ≠ j) (a : R) : (Matrix ι ι R)ˣ where + val := transvection i j a + inv := transvection i j (-a) + val_inv := transvection_mul_neg i j hij a + inv_val := by simpa using transvection_mul_neg i j hij (-a) + +theorem transvection_same (i j : ι) (hij : i ≠ j) (a b : R) : + transvection i j a * transvection i j b = transvection i j (a + b) := by + simp only [transvection, mul_add, add_mul, mul_one, one_mul, + Matrix.single_mul_single_of_ne a i j i (Ne.symm hij) b, Matrix.single_add] + abel + +theorem nilpotent_commutator {A : Type*} [Ring A] (a b : A) + (haa : a * a = 0) (hbb : b * b = 0) (hba : b * a = 0) : + (1+a)*(1+b)*(1-a)*(1-b) = 1+a*b := by + calc + (1+a)*(1+b)*(1-a)*(1-b) = + 1 + a*b - a*a - b*a - a*b*a - b*b - a*b*b + a*a*b + b*a*b + a*b*a*b := by + noncomm_ring + _ = 1 + a*b := by + simp [haa, hbb, hba, mul_assoc] + +theorem transvection_commutator (i j k : ι) + (hij : i ≠ j) (hjk : j ≠ k) (hik : i ≠ k) (a b : R) : + transvection i j a * transvection j k b * + transvection i j (-a) * transvection j k (-b) = + transvection i k (a*b) := by + have haa := single_square_zero i j hij a + have hbb := single_square_zero j k hjk b + have hba : (Matrix.single j k b : Matrix ι ι R) * Matrix.single i j a = 0 := + Matrix.single_mul_single_of_ne b j k i (Ne.symm hik) a + simpa [transvection, ← Matrix.single_neg, sub_eq_add_neg] using + nilpotent_commutator (Matrix.single i j a) (Matrix.single j k b) haa hbb hba + +theorem transvection_commute (i j k l : ι) + (hjk : j ≠ k) (hli : l ≠ i) (a b : R) : + Commute (transvection i j a) (transvection k l b) := by + show transvection i j a * transvection k l b = + transvection k l b * transvection i j a + simp only [transvection, mul_add, add_mul, mul_one, one_mul, + Matrix.single_mul_single_of_ne a i j k hjk b, + Matrix.single_mul_single_of_ne b k l i hli a] + abel + +omit [Fintype ι] in +theorem transvection_injective (i j : ι) (hij : i ≠ j) : + Function.Injective (transvection (R := R) i j) := by + intro a b h + have := congrArg (fun M : Matrix ι ι R => M i j) h + simpa [transvection, Matrix.single, Matrix.one_apply, hij] using this + +def diagonalUnit (d : ι → Rˣ) : (Matrix ι ι R)ˣ where + val := Matrix.diagonal (fun i => (d i : R)) + inv := Matrix.diagonal (fun i => ((d i)⁻¹ : Rˣ)) + val_inv := by + rw [Matrix.diagonal_mul_diagonal] + simp + inv_val := by + rw [Matrix.diagonal_mul_diagonal] + simp + +theorem diagonal_single_conjugation (d : ι → Rˣ) (i j : ι) (a : R) : + (diagonalUnit d : Matrix ι ι R) * Matrix.single i j a * + ((diagonalUnit d)⁻¹ : (Matrix ι ι R)ˣ) = + Matrix.single i j ((d i : R) * a * ((d j)⁻¹ : Rˣ)) := by + ext k l + change (Matrix.diagonal (fun s => (d s : R)) * Matrix.single i j a * + Matrix.diagonal (fun s => (((d s)⁻¹ : Rˣ) : R))) k l = _ + rw [Matrix.mul_diagonal,Matrix.diagonal_mul] + by_cases hi : i=k <;> by_cases hj : j=l <;> + simp [hi, hj] + +theorem diagonal_transvection_conjugation (d : ι → Rˣ) (i j : ι) (a : R) : + (diagonalUnit d : Matrix ι ι R) * transvection i j a * + ((diagonalUnit d)⁻¹ : (Matrix ι ι R)ˣ) = + transvection i j ((d i : R) * a * ((d j)⁻¹ : Rˣ)) := by + simp only [transvection,mul_add,add_mul,mul_one,Units.mul_inv,diagonal_single_conjugation] + +theorem diagonalUnit_commute (d e : ι → Rˣ) : Commute (diagonalUnit d) (diagonalUnit e) := by + apply Units.ext + exact (Matrix.commute_diagonal (d₁ := fun i => (d i : R)) + (d₂ := fun i => (e i : R))).eq + +theorem transvectionUnit_commute (i j k l : ι) (hij : i≠j) (hkl : k≠l) + (hjk : j≠k) (hli : l≠i) (a b : R) : + Commute (transvectionUnit i j hij a) (transvectionUnit k l hkl b) := by + apply Units.ext + exact (transvection_commute i j k l hjk hli a b).eq + +open scoped commutatorElement in +theorem transvectionUnit_commutator (i j k : ι) + (hij : i≠j) (hjk : j≠k) (hik : i≠k) (a b : R) : + ⁅transvectionUnit i j hij a,transvectionUnit j k hjk b⁆ = + transvectionUnit i k hik (a*b) := by + apply Units.ext + exact transvection_commutator i j k hij hjk hik a b + +theorem transvectionUnit_conjugation (d : ι → Rˣ) (i j : ι) (hij : i≠j) (a : R) : + diagonalUnit d * transvectionUnit i j hij a * (diagonalUnit d)⁻¹ = + transvectionUnit i j hij ((d i : R) * a * ((d j)⁻¹ : Rˣ)) := by + apply Units.ext + exact diagonal_transvection_conjugation d i j a + +end ElementaryMatrices + +noncomputable def cyclicPolynomial (m : ℕ) : Polynomial (ZMod 2) := X^m - C 1 +abbrev CyclicRing (m : ℕ) := AdjoinRoot (cyclicPolynomial m) + +theorem cyclicPolynomial_monic (m : ℕ) (hm : m ≠ 0) : + (cyclicPolynomial m).Monic := Polynomial.monic_X_pow_sub_C 1 hm + +theorem cyclicPolynomial_degree (m : ℕ) : + (cyclicPolynomial m).natDegree = m := Polynomial.natDegree_X_pow_sub_C + +noncomputable def cyclicBasis (m : ℕ) (hm : m ≠ 0) : + Module.Basis (Fin m) (ZMod 2) (CyclicRing m) := + ((AdjoinRoot.powerBasis' (cyclicPolynomial_monic m hm)).basis).reindex + (finCongr (cyclicPolynomial_degree m)) + +theorem cyclicRing_finite (m : ℕ) (hm : m ≠ 0) : Finite (CyclicRing m) := by + exact Finite.of_injective (cyclicBasis m hm).repr (cyclicBasis m hm).repr.injective + +theorem cyclic_root_pow (m : ℕ) : + AdjoinRoot.root (cyclicPolynomial m) ^ m = (1 : CyclicRing m) := by + have h : AdjoinRoot.mk (cyclicPolynomial m) (X^m - C 1) = 0 := + AdjoinRoot.mk_eq_zero.mpr (dvd_refl _) + rw [map_sub, map_pow, AdjoinRoot.mk_X, Polynomial.C_1, map_one] at h + exact sub_eq_zero.mp h + +theorem cyclic_root_isUnit (m : ℕ) (hm : 0 < m) : + IsUnit (AdjoinRoot.root (cyclicPolynomial m)) := by + exact IsUnit.of_pow_eq_one (cyclic_root_pow m) (Nat.ne_of_gt hm) + +theorem cyclicBasis_apply (m : ℕ) (hm : m ≠ 0) (i : Fin m) : + cyclicBasis m hm i = AdjoinRoot.root (cyclicPolynomial m) ^ (i : ℕ) := by + simp only [cyclicBasis, Module.Basis.reindex_apply, PowerBasis.basis_eq_pow, + AdjoinRoot.powerBasis'_gen] + rfl + +theorem cyclic_powers_independent (m : ℕ) (hm : m ≠ 0) : + LinearIndependent (ZMod 2) + (fun i : Fin m => AdjoinRoot.root (cyclicPolynomial m) ^ (i : ℕ)) := by + have h : (fun i : Fin m => cyclicBasis m hm i) = + (fun i : Fin m => AdjoinRoot.root (cyclicPolynomial m) ^ (i : ℕ)) := + funext (cyclicBasis_apply m hm) + rw [← h] + exact (cyclicBasis m hm).linearIndependent + +/-- The central coefficient embedding in the displayed 5-by-5 matrix model. -/ +noncomputable def centralMatrix (m : ℕ) (c : Fin m → ZMod 2) : + Matrix (Fin 5) (Fin 5) (CyclicRing m) := + transvection 0 4 (∑ i, c i • AdjoinRoot.root (cyclicPolynomial m) ^ (i : ℕ)) + +theorem centralMatrix_zero (m : ℕ) : centralMatrix m 0 = 1 := by + simp [centralMatrix, transvection] + +theorem centralMatrix_add (m : ℕ) (c d : Fin m → ZMod 2) : + centralMatrix m (c + d) = centralMatrix m c * centralMatrix m d := by + rw [centralMatrix, centralMatrix, centralMatrix, + transvection_same 0 4 (by decide)] + congr 1 + simp only [Pi.add_apply, add_smul, Finset.sum_add_distrib] + +theorem centralMatrix_injective (m : ℕ) (hm : m ≠ 0) : + Function.Injective (centralMatrix m) := by + intro c d h + have hs := transvection_injective (R := CyclicRing m) (0 : Fin 5) 4 (by decide) h + have hz : ∑ i : Fin m, (c i - d i) • + AdjoinRoot.root (cyclicPolynomial m) ^ (i : ℕ) = 0 := by + simp only [sub_smul, Finset.sum_sub_distrib, hs, sub_self] + have hc := (linearIndependent_iff'.mp (cyclic_powers_independent m hm)) + Finset.univ (fun i => c i - d i) (by simpa using hz) + funext i + exact sub_eq_zero.mp (hc i (Finset.mem_univ i)) + +theorem centralMatrix_involution (m : ℕ) (c : Fin m → ZMod 2) : + centralMatrix m c * centralMatrix m c = 1 := by + rw [← centralMatrix_add] + have h : c + c = 0 := by + funext i + exact CharTwo.add_self_eq_zero (c i) + rw [h, centralMatrix_zero] + +/-- This is the concrete copy of the elementary abelian 2-group used by the +paper's finite matrix quotient. Its realization as a quotient of the presented +group remains separate from the verified embedding below. -/ +noncomputable def centralEmbedding (m : ℕ) : + Multiplicative (Fin m → ZMod 2) →* (Matrix (Fin 5) (Fin 5) (CyclicRing m))ˣ where + toFun c := + { val := centralMatrix m c.toAdd + inv := centralMatrix m c.toAdd + val_inv := centralMatrix_involution m c.toAdd + inv_val := centralMatrix_involution m c.toAdd } + map_one' := by + apply Units.ext + exact centralMatrix_zero m + map_mul' c d := by + apply Units.ext + exact centralMatrix_add m c.toAdd d.toAdd + +theorem centralEmbedding_injective (m : ℕ) (hm : m ≠ 0) : + Function.Injective (centralEmbedding m) := by + intro c d h + exact (centralMatrix_injective m hm) (congrArg Units.val h) + +end LittleFinitistic + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selection/FiniteSelectionFamily.lean b/lean/OAI/Algebra/Finitistic/Selection/FiniteSelectionFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..0694c56fc80e90b57f8891c1de6e838f50fdd9a0 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selection/FiniteSelectionFamily.lean @@ -0,0 +1,87 @@ +import OAI.Algebra.Finitistic.Selected.SelectedRealization + +namespace OAI +noncomputable section +open CategoryTheory CategoryTheory.Limits +attribute [local instance] HasDerivedCategory.standard HasExt.standard +namespace LittleFinitistic.FiniteSelectionFamily +open SelectedFixedDiagram QuadraticEncoding + +/-- Actual finite-dimensional modules over the fixed selecting algebra. -/ +def S := {M : ModuleCat SelectionRing // FiniteDimensional ℂ (complexObject M)} +abbrev vector (Y : S) := complexObject Y.val +instance (Y : S) : FiniteDimensional ℂ (vector Y) := Y.property +instance ringModule (Y : S) : Module SelectionRing (vector Y) := + inferInstanceAs (Module SelectionRing Y.val) +instance tower (Y : S) : IsScalarTower ℂ SelectionRing (vector Y) := + IsScalarTower.of_algebraMap_smul (fun _ _ => rfl) + +/-- H preserves this actual finite-dimensional family. -/ +def H (Y : S) : S := ⟨selectionStep Y.val, by + let : FiniteDimensional ℂ (complexObject Y.val) := Y.property + exact selectionStep_finiteDimensional Y.val⟩ + +abbrev representation (Y : S) := SourceActionEvaluation.representation (Y := vector Y) encoding +abbrev module (Y : S) := EvaluationVertexDiagram.module (representation Y) +abbrev derived (Y : S) := (DerivedCategory.singleFunctor (ModuleCat (B P)) 0).obj (module Y) + +/-- The proved one-step realization uses the actual endomap of the finite family. -/ +def realization (Y : S) : + SelectedTensorSplitting.object (representation Y).Evaluation ≅ + derived (H Y) ⊞ (derived (H Y))⟦(3 : ℤ)⟧ := + SelectedRealization.realization (Y := vector Y) + +/-- Evaluation on three copies preserves and reflects the zero module. -/ +theorem module_zero (Y : S) : IsZero (module Y) ↔ Subsingleton Y.val := by + constructor + · intro h + let := ModuleCat.subsingleton_of_isZero h + have inj : Function.Injective ((representation Y).inclusion 0) := by + intro x y hxy + have := congrArg ((representation Y).projection 0) hxy + simpa only [Representation.projection_inclusion] using this + exact inj.subsingleton + · intro h + let := h + have : Subsingleton (representation Y).Evaluation := + inferInstanceAs (Subsingleton (Y.val × Y.val × Y.val)) + exact ModuleCat.isZero_of_subsingleton _ + +/-- The same exact zero criterion after embedding in the actual derived category. -/ +theorem derived_zero (Y : S) : IsZero (derived Y) ↔ Subsingleton Y.val := by + rw [← module_zero Y] + constructor + · intro h + exact ((DerivedCategory.singleFunctorCompHomologyFunctorIso (ModuleCat (B P)) 0).app + (module Y)).isZero_iff.mp ((DerivedCategory.homologyFunctor (ModuleCat (B P)) 0).map_isZero h) + · exact (DerivedCategory.singleFunctor (ModuleCat (B P)) 0).map_isZero + +/-- Iteration is literally the Section 2 selection operation. -/ +theorem iterate_val (j : ℕ) (Y : S) : ((H^[j]) Y).val = selectionIterate Y.val j := by + induction j with + | zero => rfl + | succ j ih => + rw [Function.iterate_succ_apply'] + change selectionStep ((H^[j]) Y).val = selectionStep (selectionIterate Y.val j) + exact congrArg selectionStep ih + +def test (m : ℕ) [NeZero m] : S := ⟨testObject m, testObject_finiteDimensional m⟩ + +/-- Exact finite extinction is retained by the actual derived evaluation family. -/ +theorem extinction (m : ℕ) [NeZero m] : + (∀ j < m, ¬ IsZero (derived ((H^[j]) (test m)))) ∧ + IsZero (derived ((H^[m]) (test m))) := by + constructor + · intro j hj hz + have hs := (derived_zero _).mp hz + rw [iterate_val] at hs + have hn := selectionIterate_test_nontrivial m j hj + exact @not_subsingleton _ hn hs + · apply (derived_zero _).mpr + rw [iterate_val] + exact selectionIterate_test_subsingleton m +end LittleFinitistic.FiniteSelectionFamily + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selection/GroupAlgebraPresentation.lean b/lean/OAI/Algebra/Finitistic/Selection/GroupAlgebraPresentation.lean new file mode 100644 index 0000000000000000000000000000000000000000..3824ebb19545165c96cc0b629a64680035c0c0df --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selection/GroupAlgebraPresentation.lean @@ -0,0 +1,245 @@ +import Mathlib.Algebra.FreeAlgebra +import Mathlib.RingTheory.Congruence.Hom +import Mathlib.GroupTheory.FinitelyPresentedGroup +import Mathlib.Basic.Complex.Basic + +namespace OAI +/-! Section 2 bridge. All algebras here are associative, unital, and may be +noncommutative. The defining congruence is generated by finitely many equations +in a free associative algebra; no commutative finite-presentation API is used. -/ +noncomputable section +namespace LittleFinitistic.GroupAlgebraPresentation + +variable (R : Type*) [CommRing R] (α : Type*) + +/-- A representative word, chosen only to turn a group relator into a polynomial. -/ +def word (g : FreeGroup α) : List (α × Bool) := + Classical.choose (Quot.exists_rep g) + +theorem word_spec (g : FreeGroup α) : FreeGroup.mk (word α g) = g := + Classical.choose_spec (Quot.exists_rep g) + +def polynomial (g : FreeGroup α) : FreeAlgebra R (α × Bool) := + ((word α g).map (FreeAlgebra.ι R)).prod + +variable {α R} + +theorem eval_polynomial {A : Type*} [Ring A] [Algebra R A] + (f : α → Aˣ) (F : FreeAlgebra R (α × Bool) →ₐ[R] A) + (hf : ∀ a b, F (FreeAlgebra.ι R (a,b)) = + ↑(if b then f a else (f a)⁻¹)) (g : FreeGroup α) : + F (polynomial R α g) = ↑(FreeGroup.lift f g) := by + conv_rhs => rw [← word_spec α g] + simp only [polynomial, map_list_prod, List.map_map, FreeGroup.lift_mk] + induction word α g with + | nil => simp + | cons a l ih => + rcases a with ⟨a,b⟩ + simp only [List.map_cons, List.prod_cons, Function.comp_apply, Units.val_mul] + rw [hf, ih] + cases b <;> rfl + +variable (R α) (rels : Set (FreeGroup α)) + +abbrev Letter := α × Bool +abbrev EquationIndex := (α × Bool) ⊕ rels + +/-- Two inverse equations per generator, and one polynomial per group relator. -/ +def equation : EquationIndex α rels → FreeAlgebra R (Letter α) + | .inl (a,b) => FreeAlgebra.ι R (a,b) * FreeAlgebra.ι R (a,!b) + | .inr r => polynomial R α r + +def relations : RingCon (FreeAlgebra R (Letter α)) := + ringConGen (fun x y => ∃ i : EquationIndex α rels, x = equation R α rels i ∧ y = 1) + +abbrev PresentedAlgebra := (relations R α rels).Quotient + +def quotientMap : FreeAlgebra R (Letter α) →ₐ[R] PresentedAlgebra R α rels := + (relations R α rels).mkₐ R + +theorem equation_holds (i : EquationIndex α rels) : + quotientMap R α rels (equation R α rels i) = 1 := by + exact (relations R α rels).eq.mpr (RingConGen.Rel.of _ _ ⟨i,rfl,rfl⟩) + +def generatorUnit (a : α) : (PresentedAlgebra R α rels)ˣ where + val := quotientMap R α rels (FreeAlgebra.ι R (a,true)) + inv := quotientMap R α rels (FreeAlgebra.ι R (a,false)) + val_inv := by simpa [equation, map_mul] using equation_holds R α rels (.inl (a,true)) + inv_val := by simpa [equation, map_mul] using equation_holds R α rels (.inl (a,false)) + +theorem quotient_letter (a : α) (b : Bool) : + quotientMap R α rels (FreeAlgebra.ι R (a,b)) = + ↑(if b then generatorUnit R α rels a else (generatorUnit R α rels a)⁻¹) := by + cases b <;> rfl + +theorem unit_relator (r : FreeGroup α) (hr : r ∈ rels) : + FreeGroup.lift (generatorUnit R α rels) r = 1 := by + apply Units.ext + rw [← eval_polynomial _ _ (quotient_letter R α rels)] + exact equation_holds R α rels (.inr ⟨r,hr⟩) + +def groupToUnits : PresentedGroup rels →* (PresentedAlgebra R α rels)ˣ := + PresentedGroup.toGroup (unit_relator R α rels) + +def fromGroupAlgebra : MonoidAlgebra R (PresentedGroup rels) →ₐ[R] PresentedAlgebra R α rels := + MonoidAlgebra.lift R _ _ ((Units.coeHom _).comp (groupToUnits R α rels)) + +def groupAlgebraUnit (a : α) : (MonoidAlgebra R (PresentedGroup rels))ˣ := + (MonoidAlgebra.of R (PresentedGroup rels)).toHomUnits (PresentedGroup.of a) + +def evaluation : FreeAlgebra R (Letter α) →ₐ[R] MonoidAlgebra R (PresentedGroup rels) := + FreeAlgebra.lift R (fun (a,b) => + ↑(if b then groupAlgebraUnit R α rels a else (groupAlgebraUnit R α rels a)⁻¹)) + +theorem evaluation_polynomial (r : FreeGroup α) : + evaluation R α rels (polynomial R α r) = + MonoidAlgebra.of R _ (PresentedGroup.mk rels r) := by + rw [eval_polynomial (groupAlgebraUnit R α rels) _ (by intros; simp [evaluation])] + have h : FreeGroup.lift (groupAlgebraUnit R α rels) = + (MonoidAlgebra.of R (PresentedGroup rels)).toHomUnits.comp (PresentedGroup.mk rels) := by + apply FreeGroup.ext_hom + intro a + simp [groupAlgebraUnit, PresentedGroup.of] + rw [h] + rfl + +theorem evaluation_equation (i : EquationIndex α rels) : + evaluation R α rels (equation R α rels i) = 1 := by + rcases i with ⟨a,b⟩ | ⟨r,hr⟩ + · cases b <;> simp [equation, evaluation] + · rw [equation, evaluation_polynomial] + have h : PresentedGroup.mk rels r = 1 := by + exact PresentedGroup.one_of_mem hr + rw [h, map_one] + +def toGroupAlgebra : PresentedAlgebra R α rels →ₐ[R] MonoidAlgebra R (PresentedGroup rels) := + (relations R α rels).liftₐ (evaluation R α rels) + (RingCon.ringConGen_le.mpr (by + rintro x y ⟨i,rfl,rfl⟩ + exact (evaluation_equation R α rels i).trans (map_one _).symm)) + +@[simp] theorem toGroupAlgebra_quotient (x : FreeAlgebra R (Letter α)) : + toGroupAlgebra R α rels (quotientMap R α rels x) = evaluation R α rels x := rfl + +@[simp] theorem fromGroupAlgebra_of (a : α) : + fromGroupAlgebra R α rels (MonoidAlgebra.of R _ (PresentedGroup.of a)) = + quotientMap R α rels (FreeAlgebra.ι R (a,true)) := by + simp [fromGroupAlgebra, groupToUnits, generatorUnit] + +@[simp] theorem fromGroupAlgebra_inv_of (a : α) : + fromGroupAlgebra R α rels (MonoidAlgebra.of R _ (PresentedGroup.of a)⁻¹) = + quotientMap R α rels (FreeAlgebra.ι R (a,false)) := by + simp [fromGroupAlgebra, groupToUnits, generatorUnit] + +@[simp] theorem from_to_letter (a : α) (b : Bool) : + fromGroupAlgebra R α rels (evaluation R α rels (FreeAlgebra.ι R (a,b))) = + quotientMap R α rels (FreeAlgebra.ι R (a,b)) := by + cases b + · simpa only [evaluation, FreeAlgebra.lift_ι_apply, Bool.false_eq_true, ite_false, groupAlgebraUnit, ← map_inv, MonoidHom.coe_toHomUnits] + using fromGroupAlgebra_inv_of R α rels a + · simpa only [evaluation, FreeAlgebra.lift_ι_apply, ite_true, groupAlgebraUnit, MonoidHom.coe_toHomUnits] + using fromGroupAlgebra_of R α rels a + +theorem from_to : (fromGroupAlgebra R α rels).comp (toGroupAlgebra R α rels) = + AlgHom.id R (PresentedAlgebra R α rels) := by + have h : ((fromGroupAlgebra R α rels).comp (toGroupAlgebra R α rels)).comp + (quotientMap R α rels) = quotientMap R α rels := by + apply FreeAlgebra.hom_ext + funext ⟨a,b⟩ + exact from_to_letter R α rels a b + apply AlgHom.ext + intro x + obtain ⟨p,rfl⟩ := (relations R α rels).mkₐ_surjective (α := R) x + exact DFunLike.congr_fun h p + +theorem to_from : (toGroupAlgebra R α rels).comp (fromGroupAlgebra R α rels) = + AlgHom.id R (MonoidAlgebra R (PresentedGroup rels)) := by + apply (MonoidAlgebra.lift R _ _).symm.injective + have hext (f g : PresentedGroup rels →* MonoidAlgebra R (PresentedGroup rels)) + (h : ∀ a, f (PresentedGroup.of a) = g (PresentedGroup.of a)) : f = g := by + have hh : f.comp (PresentedGroup.mk rels) = g.comp (PresentedGroup.mk rels) := + FreeGroup.ext_hom _ _ h + apply MonoidHom.ext + intro x + obtain ⟨r,rfl⟩ := PresentedGroup.mk_surjective rels x + exact DFunLike.congr_fun hh r + apply hext + intro a + change toGroupAlgebra R α rels + (fromGroupAlgebra R α rels (MonoidAlgebra.of R _ (PresentedGroup.of a))) = _ + rw [fromGroupAlgebra_of, toGroupAlgebra_quotient] + simp [evaluation, groupAlgebraUnit] + +/-- Explicit free associative algebra quotient presenting the group algebra. -/ +def quotientEquiv : PresentedAlgebra R α rels ≃ₐ[R] MonoidAlgebra R (PresentedGroup rels) := + AlgEquiv.ofAlgHom (toGroupAlgebra R α rels) (fromGroupAlgebra R α rels) + (to_from R α rels) (from_to R α rels) + + +/-- A finite presentation in the category of associative unital R-algebras. +The finite generating set is not required to commute. A ring congruence is +closed under multiplication on either side; these are two-sided equations. -/ +def HasFinitePresentation (A : Type*) [Ring A] [Algebra R A] : Prop := + ∃ (ι κ : Type) (_ : Finite ι) (_ : Finite κ) + (lhs rhs : κ → FreeAlgebra R ι), + Nonempty ((ringConGen (fun x y => ∃ i, x = lhs i ∧ y = rhs i)).Quotient ≃ₐ[R] A) + +variable {R} in +/-- Transport of a finite noncommutative presentation along an algebra equivalence. -/ +theorem HasFinitePresentation.of_equiv {A B : Type*} [Ring A] [Ring B] + [Algebra R A] [Algebra R B] (h : HasFinitePresentation R A) (e : A ≃ₐ[R] B) : + HasFinitePresentation R B := by + obtain ⟨ι,κ,hι,hκ,lhs,rhs,⟨q⟩⟩ := h + exact ⟨ι,κ,hι,hκ,lhs,rhs,⟨q.trans e⟩⟩ + +/-- Finitely many group generators and relators give finitely many algebra +letters and equations, and the explicit quotient is the group algebra. -/ +theorem presentedGroup_hasFinitePresentation (ι : Type) [Finite ι] + (s : Set (FreeGroup ι)) [Finite s] : + HasFinitePresentation R (MonoidAlgebra R (PresentedGroup s)) := by + exact ⟨Letter ι, EquationIndex ι s, inferInstance, inferInstance, + equation R ι s, fun _ => 1, ⟨quotientEquiv R ι s⟩⟩ + +/-- General Section 2 bridge, with no commutativity assumption on the group +or its group algebra and no finite-presentation assumption on the algebra. -/ +theorem groupAlgebra_hasFinitePresentation (G : Type*) [Group G] + [Group.IsFinitelyPresented G] : HasFinitePresentation R (MonoidAlgebra R G) := by + obtain ⟨n,s,hs,⟨e⟩⟩ := Group.IsFinitelyPresented.exists_mulEquiv_presentedGroup (G := G) + let : Finite s := hs + exact (presentedGroup_hasFinitePresentation R (Fin n) s).of_equiv + (MonoidAlgebra.domCongr R R e.symm) + + +/-- Polynomial zero relations for the same explicit presentation. -/ +def zeroRelations : RingCon (FreeAlgebra R (Letter α)) := + ringConGen (fun x y => ∃ i : EquationIndex α rels, + x = equation R α rels i - 1 ∧ y = 0) + +/-- Writing each equation p = 1 as p - 1 = 0 does not change the quotient. +This matches the manuscript notation k⟨x₁,...,x_d⟩/(p₁,...,p_t). -/ +theorem relations_eq_zeroRelations : relations R α rels = zeroRelations R α rels := by + apply le_antisymm + · apply RingCon.ringConGen_le.mpr + rintro x y ⟨i,rfl,rfl⟩ + have h : zeroRelations R α rels (equation R α rels i - 1) 0 := + RingConGen.Rel.of _ _ ⟨i,rfl,rfl⟩ + have hh := (zeroRelations R α rels).add h ((zeroRelations R α rels).refl 1) + simpa only [sub_add_cancel, zero_add] using hh + · apply RingCon.ringConGen_le.mpr + rintro x y ⟨i,rfl,rfl⟩ + have h : relations R α rels (equation R α rels i) 1 := + RingConGen.Rel.of _ _ ⟨i,rfl,rfl⟩ + have hh := (relations R α rels).add h ((relations R α rels).refl (-1)) + simpa only [← sub_eq_add_neg, sub_self] using hh + +/-- The explicit presentation is also a quotient by finitely many polynomial +zero relations, in the exact form used by Section 3 of the manuscript. -/ +def zeroQuotientEquiv : (zeroRelations R α rels).Quotient ≃ₐ[R] + MonoidAlgebra R (PresentedGroup rels) := + relations_eq_zeroRelations R α rels ▸ quotientEquiv R α rels + +end LittleFinitistic.GroupAlgebraPresentation + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selection/GroupSelection.lean b/lean/OAI/Algebra/Finitistic/Selection/GroupSelection.lean new file mode 100644 index 0000000000000000000000000000000000000000..131e632955eba21a9f19d35e66914d5440cd6529 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selection/GroupSelection.lean @@ -0,0 +1,354 @@ +import Mathlib.GroupTheory.Commutator.Basic +import Mathlib.GroupTheory.PresentedGroup +import Mathlib.Tactic.Group +import Mathlib.Tactic.FinCases +import Lean.Elab.Tactic.Omega + +namespace OAI +/-! Group identities used in Section 2 of v5s9.15. -/ + +open scoped commutatorElement + +namespace LittleFinitistic + +section GroupTransfer + +variable {G : Type*} [Group G] + +/-- The commutator transfer identity establishing independence of the +internal index in the paper's central involutions. -/ +theorem commutator_transfer (x y v u w : G) + (hu : x*y = u*y*x) (hw : y*v = w*v*y) + (hxv : Commute x v) (hwu : Commute w u) (hwv : Commute w v) : + ⁅x,w⁆ = ⁅u,v⁆ := by + have hconj : y*x*y⁻¹ = u⁻¹*x := by + apply (mul_left_cancel_iff (a := u)).mp + calc + u*(y*x*y⁻¹) = (u*y*x)*y⁻¹ := by group + _ = (x*y)*y⁻¹ := by rw [← hu] + _ = u*(u⁻¹*x) := by group + have hmove : x*w*v*y = u*w*v*y*x := by + calc + x*w*v*y = x*(y*v) := by rw [hw]; group + _ = (x*y)*v := by group + _ = (u*y*x)*v := by rw [hu] + _ = u*y*(v*x) := by simp only [mul_assoc, hxv.eq] + _ = u*(y*v)*x := by group + _ = u*w*v*y*x := by rw [hw]; group + have hxw : x*w = u*w*v*u⁻¹*v⁻¹*x := by + calc + x*w = (x*w*v*y)*y⁻¹*v⁻¹ := by group + _ = (u*w*v*y*x)*y⁻¹*v⁻¹ := by rw [hmove] + _ = u*w*v*(y*x*y⁻¹)*v⁻¹ := by group + _ = u*w*v*(u⁻¹*x)*v⁻¹ := by rw [hconj] + _ = u*w*v*u⁻¹*(v⁻¹*x) := by simp only [mul_assoc]; rw [hxv.inv_right.eq] + _ = u*w*v*u⁻¹*v⁻¹*x := by group + have hwc : Commute w (v*u⁻¹*v⁻¹) := by + simpa only [mul_assoc] using hwv.mul_right (hwu.inv_right.mul_right hwv.inv_right) + calc + ⁅x,w⁆ = x*w*x⁻¹*w⁻¹ := rfl + _ = u*w*v*u⁻¹*v⁻¹*w⁻¹ := by rw [hxw]; group + _ = u*(w*(v*u⁻¹*v⁻¹))*w⁻¹ := by group + _ = u*((v*u⁻¹*v⁻¹)*w)*w⁻¹ := by rw [hwc.eq] + _ = ⁅u,v⁆ := by simp only [commutatorElement_def]; group + +/-- A central commutator of an involution has order dividing two. -/ +theorem central_commutator_involution (x y : G) (hx : x*x = 1) + (hc : Commute x ⁅x,y⁆) : ⁅x,y⁆ * ⁅x,y⁆ = 1 := by + calc + ⁅x,y⁆ * ⁅x,y⁆ = x * ⁅x,y⁆ * x⁻¹ * ⁅x,y⁆ := by rw [hc.eq]; group + _ = ⁅x*x,y⁆ := (commutatorElement_mul_left_eq_conj_mul x x y).symm + _ = 1 := by rw [hx]; exact commutatorElement_one_left y + +end GroupTransfer + +/-- The relators used for the off-diagonal generators in Section 2. The +presentation and its finite-presentation reduction are separate obligations. -/ +structure SelectionGroupData (G : Type*) [Group G] where + T : Fin 3 → G + U : Fin 3 → ℤ → G + V : Fin 3 → ℤ → G + W : Fin 3 → Fin 3 → ℤ → G + square_U : ∀ i a, U i a * U i a = 1 + commute_UU : ∀ i j a b, i ≠ j → Commute (U i a) (U j b) + commute_VV : ∀ i j a b, i ≠ j → Commute (V i a) (V j b) + commute_UV : ∀ i j a b, i ≠ j → Commute (U i a) (V j b) + commute_WU : ∀ i j h a b, h ≠ i → Commute (W i j a) (U h b) + commute_WV : ∀ i j h a b, h ≠ j → Commute (W i j a) (V h b) + commutator_UW : ∀ i j a b, i ≠ j → ⁅U i a, W i j b⁆ = U j (a+b) + commutator_WV : ∀ i j a b, i ≠ j → ⁅W i j a, V j b⁆ = V i (a+b) + commute_TT : ∀ i j, Commute (T i) (T j) + conj_TU : ∀ l i a, T l * U i a * (T l)⁻¹ = U i (a - if l=i then 1 else 0) + conj_TV : ∀ l i a, T l * V i a * (T l)⁻¹ = V i (a + if l=i then 1 else 0) + conj_TW : ∀ l i j a, T l * W i j a * (T l)⁻¹ = + W i j (a + (if l=i then 1 else 0) - if l=j then 1 else 0) + diagonal_W : ∀ i a, W i i a = 1 + +namespace SelectionGroupData + +variable {G : Type*} [Group G] (D : SelectionGroupData G) + +theorem split_transfer (i j : Fin 3) (a b c d : ℤ) + (hij : i ≠ j) (hsum : a+b = c+d) : + ⁅D.U i a, D.V i b⁆ = ⁅D.U j c, D.V j d⁆ := by + have hU : D.U i a * D.W i j (c-a) = + D.U j c * D.W i j (c-a) * D.U i a := by + have h := D.commutator_UW i j a (c-a) hij + have hc : a + (c-a) = c := by omega + rw [hc] at h + rw [← h] + simp [commutatorElement_def, mul_assoc] + have hV : D.W i j (c-a) * D.V j d = + D.V i b * D.V j d * D.W i j (c-a) := by + have h := D.commutator_WV i j (c-a) d hij + have hb : c-a+d = b := by omega + rw [hb] at h + rw [← h] + simp [commutatorElement_def, mul_assoc] + exact commutator_transfer (D.U i a) (D.W i j (c-a)) (D.V j d) + (D.U j c) (D.V i b) hU hV (D.commute_UV i j a d hij) + (D.commute_UV j i c b hij.symm).symm (D.commute_VV i j b d hij) + +theorem splitting_independent (i j : Fin 3) (a b c d : ℤ) + (hsum : a+b = c+d) : ⁅D.U i a,D.V i b⁆ = ⁅D.U j c,D.V j d⁆ := by + obtain ⟨k, hki, hkj⟩ := Fin.exists_ne_and_ne_of_two_lt i j (by decide) + calc + ⁅D.U i a,D.V i b⁆ = ⁅D.U k 0,D.V k (a+b)⁆ := + D.split_transfer i k a b 0 (a+b) hki.symm (by omega) + _ = ⁅D.U j c,D.V j d⁆ := + D.split_transfer k j 0 (a+b) c d hkj (by omega) + +def centralZ (N : ℤ) : G := ⁅D.U 0 0,D.V 0 N⁆ + +theorem centralZ_eq (N : ℤ) (i : Fin 3) (a b : ℤ) (h : a+b=N) : + D.centralZ N = ⁅D.U i a,D.V i b⁆ := by + exact D.splitting_independent 0 i 0 N a b (by omega) + +theorem centralZ_commute_U (N : ℤ) (h : Fin 3) (a : ℤ) : + Commute (D.centralZ N) (D.U h a) := by + obtain ⟨i, hih, _⟩ := Fin.exists_ne_and_ne_of_two_lt h h (by decide) + rw [D.centralZ_eq N i 0 N (by omega), commutatorElement_def] + have hU := D.commute_UU i h 0 a hih + have hV := (D.commute_UV h i a N hih.symm).symm + exact ((hU.mul_left hV).mul_left hU.inv_left).mul_left hV.inv_left + +theorem centralZ_commute_V (N : ℤ) (h : Fin 3) (a : ℤ) : + Commute (D.centralZ N) (D.V h a) := by + obtain ⟨i, hih, _⟩ := Fin.exists_ne_and_ne_of_two_lt h h (by decide) + rw [D.centralZ_eq N i 0 N (by omega), commutatorElement_def] + have hU := D.commute_UV i h 0 a hih + have hV := D.commute_VV i h N a hih + exact ((hU.mul_left hV).mul_left hU.inv_left).mul_left hV.inv_left + +theorem centralZ_commute_W (N : ℤ) (i j : Fin 3) (a : ℤ) : + Commute (D.centralZ N) (D.W i j a) := by + obtain ⟨h, hhi, hhj⟩ := Fin.exists_ne_and_ne_of_two_lt i j (by decide) + rw [D.centralZ_eq N h 0 N (by omega), commutatorElement_def] + have hU := (D.commute_WU i j h a 0 hhi).symm + have hV := (D.commute_WV i j h a N hhj).symm + exact ((hU.mul_left hV).mul_left hU.inv_left).mul_left hV.inv_left + +theorem centralZ_involution (N : ℤ) : D.centralZ N * D.centralZ N = 1 := by + apply central_commutator_involution (D.U 0 0) (D.V 0 N) (D.square_U 0 0) + exact (D.centralZ_commute_U N 0 0).symm + +theorem centralZ_commute_T (N : ℤ) (l : Fin 3) : Commute (D.centralZ N) (D.T l) := by + have hconj : D.T l * D.centralZ N * (D.T l)⁻¹ = D.centralZ N := by + rw [centralZ, conjugate_commutatorElement, D.conj_TU, D.conj_TV] + exact (D.centralZ_eq N 0 _ _ (by omega)).symm + show D.centralZ N * D.T l = D.T l * D.centralZ N + calc + D.centralZ N * D.T l = (D.T l * D.centralZ N * (D.T l)⁻¹) * D.T l := by rw [hconj] + _ = D.T l * D.centralZ N := by group + +end SelectionGroupData + +namespace Presentation + +inductive Generator where + | T : Fin 3 → Generator + | U : Fin 3 → ℤ → Generator + | V : Fin 3 → ℤ → Generator + | W : Fin 3 → Fin 3 → ℤ → Generator + +private abbrev t (i : Fin 3) := FreeGroup.of (Generator.T i) +private abbrev u (i : Fin 3) (a : ℤ) := FreeGroup.of (Generator.U i a) +private abbrev v (i : Fin 3) (a : ℤ) := FreeGroup.of (Generator.V i a) +private abbrev w (i j : Fin 3) (a : ℤ) := FreeGroup.of (Generator.W i j a) + +/-- Explicit equation patterns of the paper's infinite presentation. +Diagonal W generators are set to one, so the total-index notation introduces +no additional group generators compared with the manuscript. -/ +inductive Equation : FreeGroup Generator → FreeGroup Generator → Prop where + | squareU (i a) : Equation (u i a * u i a) 1 + | commuteUU (i j a b) (h : i ≠ j) : Equation (u i a * u j b) (u j b * u i a) + | commuteVV (i j a b) (h : i ≠ j) : Equation (v i a * v j b) (v j b * v i a) + | commuteUV (i j a b) (h : i ≠ j) : Equation (u i a * v j b) (v j b * u i a) + | commuteWU (i j h a b) (hhi : h ≠ i) : Equation (w i j a * u h b) (u h b * w i j a) + | commuteWV (i j h a b) (hhj : h ≠ j) : Equation (w i j a * v h b) (v h b * w i j a) + | commutatorUW (i j a b) (h : i ≠ j) : Equation ⁅u i a,w i j b⁆ (u j (a+b)) + | commutatorWV (i j a b) (h : i ≠ j) : Equation ⁅w i j a,v j b⁆ (v i (a+b)) + | commuteTT (i j) : Equation (t i * t j) (t j * t i) + | conjTU (l i a) : Equation (t l * u i a * (t l)⁻¹) (u i (a-if l=i then 1 else 0)) + | conjTV (l i a) : Equation (t l * v i a * (t l)⁻¹) (v i (a+if l=i then 1 else 0)) + | conjTW (l i j a) : Equation (t l * w i j a * (t l)⁻¹) + (w i j (a+(if l=i then 1 else 0)-if l=j then 1 else 0)) + | diagonalW (i a) : Equation (w i i a) 1 + +def relators : Set (FreeGroup Generator) := {r | ∃ a b, Equation a b ∧ r=a*b⁻¹} +abbrev AuxiliaryGroup := PresentedGroup relators + +private theorem equation_holds {a b : FreeGroup Generator} (h : Equation a b) : + PresentedGroup.mk relators a = PresentedGroup.mk relators b := + PresentedGroup.mk_eq_mk_of_mul_inv_mem ⟨a,b,h,rfl⟩ + +def data : SelectionGroupData AuxiliaryGroup where + T i := PresentedGroup.of (.T i) + U i a := PresentedGroup.of (.U i a) + V i a := PresentedGroup.of (.V i a) + W i j a := PresentedGroup.of (.W i j a) + square_U i a := by simpa [u, PresentedGroup.of] using equation_holds (.squareU i a) + commute_UU i j a b h := by + simpa [u, PresentedGroup.of, Commute, SemiconjBy] using equation_holds (.commuteUU i j a b h) + commute_VV i j a b h := by + simpa [v, PresentedGroup.of, Commute, SemiconjBy] using equation_holds (.commuteVV i j a b h) + commute_UV i j a b h := by + simpa [u,v, PresentedGroup.of, Commute, SemiconjBy] using equation_holds (.commuteUV i j a b h) + commute_WU i j h a b hhi := by + simpa [w,u, PresentedGroup.of, Commute, SemiconjBy] using equation_holds (.commuteWU i j h a b hhi) + commute_WV i j h a b hhj := by + simpa [w,v, PresentedGroup.of, Commute, SemiconjBy] using equation_holds (.commuteWV i j h a b hhj) + commutator_UW i j a b h := by + simpa [u,w, PresentedGroup.of] using equation_holds (.commutatorUW i j a b h) + commutator_WV i j a b h := by + simpa [w,v, PresentedGroup.of] using equation_holds (.commutatorWV i j a b h) + commute_TT i j := by + simpa [t, PresentedGroup.of, Commute, SemiconjBy] using equation_holds (.commuteTT i j) + conj_TU l i a := by simpa [t,u,PresentedGroup.of] using equation_holds (.conjTU l i a) + conj_TV l i a := by simpa [t,v,PresentedGroup.of] using equation_holds (.conjTV l i a) + conj_TW l i j a := by simpa [t,w,PresentedGroup.of] using equation_holds (.conjTW l i j a) + diagonal_W i a := by simpa [w,PresentedGroup.of] using equation_holds (.diagonalW i a) + +def z (N : ℤ) : AuxiliaryGroup := data.centralZ N + +theorem z_involution (N : ℤ) : z N * z N = 1 := data.centralZ_involution N + +theorem z_central (N : ℤ) (g : AuxiliaryGroup) : Commute (z N) g := by + have hg : g ∈ Subgroup.closure (Set.range (PresentedGroup.of : Generator → AuxiliaryGroup)) := by + rw [PresentedGroup.closure_range_of] + trivial + induction hg using Subgroup.closure_induction with + | mem g hg => + obtain ⟨s,rfl⟩ := hg + cases s with + | T i => exact data.centralZ_commute_T N i + | U i a => exact data.centralZ_commute_U N i a + | V i a => exact data.centralZ_commute_V N i a + | W i j a => exact data.centralZ_commute_W N i j a + | one => exact Commute.one_right _ + | mul a b ha hb ia ib => exact ia.mul_right ib + | inv a ha ia => exact ia.inv_right + +def evaluate {G : Type*} [Group G] (D : SelectionGroupData G) : Generator → G + | .T i => D.T i + | .U i a => D.U i a + | .V i a => D.V i a + | .W i j a => D.W i j a + +theorem evaluate_equation {G : Type*} [Group G] (D : SelectionGroupData G) + {a b : FreeGroup Generator} (h : Equation a b) : + FreeGroup.lift (evaluate D) a = FreeGroup.lift (evaluate D) b := by + cases h with + | squareU i a => simpa [u,evaluate] using D.square_U i a + | commuteUU i j a b h => simpa [u,evaluate] using (D.commute_UU i j a b h).eq + | commuteVV i j a b h => simpa [v,evaluate] using (D.commute_VV i j a b h).eq + | commuteUV i j a b h => simpa [u,v,evaluate] using (D.commute_UV i j a b h).eq + | commuteWU i j h a b hh => simpa [w,u,evaluate] using (D.commute_WU i j h a b hh).eq + | commuteWV i j h a b hh => simpa [w,v,evaluate] using (D.commute_WV i j h a b hh).eq + | commutatorUW i j a b h => simpa [u,w,evaluate] using D.commutator_UW i j a b h + | commutatorWV i j a b h => simpa [w,v,evaluate] using D.commutator_WV i j a b h + | commuteTT i j => simpa [t,evaluate] using (D.commute_TT i j).eq + | conjTU l i a => simpa [t,u,evaluate] using D.conj_TU l i a + | conjTV l i a => simpa [t,v,evaluate] using D.conj_TV l i a + | conjTW l i j a => simpa [t,w,evaluate] using D.conj_TW l i j a + | diagonalW i a => simpa [w,evaluate] using D.diagonal_W i a + +def ofData {G : Type*} [Group G] (D : SelectionGroupData G) : AuxiliaryGroup →* G := + PresentedGroup.toGroup (f := evaluate D) (by + intro r hr + obtain ⟨a,b,h,rfl⟩ := hr + rw [map_mul,map_inv,evaluate_equation D h,mul_inv_cancel]) + +@[simp] theorem ofData_of {G : Type*} [Group G] (D : SelectionGroupData G) (s : Generator) : + ofData D (PresentedGroup.of s) = evaluate D s := PresentedGroup.toGroup.of _ + +def shiftData {G : Type*} [Group G] (D : SelectionGroupData G) (k : ℤ) : + SelectionGroupData G where + T := D.T + U i a := D.U i (a+k) + V := D.V + W := D.W + square_U i a := D.square_U i (a+k) + commute_UU i j a b h := D.commute_UU i j (a+k) (b+k) h + commute_VV := D.commute_VV + commute_UV i j a b h := D.commute_UV i j (a+k) b h + commute_WU i j h a b hh := D.commute_WU i j h a (b+k) hh + commute_WV := D.commute_WV + commutator_UW i j a b h := by + simpa only [add_assoc,add_comm k b] using D.commutator_UW i j (a+k) b h + commutator_WV := D.commutator_WV + commute_TT := D.commute_TT + conj_TU l i a := by + simpa only [add_sub_assoc,sub_add_eq_add_sub] using D.conj_TU l i (a+k) + conj_TV := D.conj_TV + conj_TW := D.conj_TW + diagonal_W := D.diagonal_W + +def shiftHom (k : ℤ) : AuxiliaryGroup →* AuxiliaryGroup := ofData (shiftData data k) + +@[simp] theorem shiftHom_T (k : ℤ) (i : Fin 3) : shiftHom k (data.T i) = data.T i := by + simp [shiftHom,data,shiftData,evaluate] + +@[simp] theorem shiftHom_U (k : ℤ) (i : Fin 3) (a : ℤ) : + shiftHom k (data.U i a) = data.U i (a+k) := by + simp [shiftHom,data,shiftData,evaluate] + +@[simp] theorem shiftHom_V (k : ℤ) (i : Fin 3) (a : ℤ) : + shiftHom k (data.V i a) = data.V i a := by + simp [shiftHom,data,shiftData,evaluate] + +@[simp] theorem shiftHom_W (k : ℤ) (i j : Fin 3) (a : ℤ) : + shiftHom k (data.W i j a) = data.W i j a := by + simp [shiftHom,data,shiftData,evaluate] + +theorem shiftHom_comp (k l : ℤ) : (shiftHom k).comp (shiftHom l) = shiftHom (l+k) := by + apply PresentedGroup.ext + intro s + cases s <;> simp [MonoidHom.comp_apply,shiftHom,shiftData,data,evaluate,add_assoc] + +theorem shiftHom_zero : shiftHom 0 = MonoidHom.id AuxiliaryGroup := by + apply PresentedGroup.ext + intro s + cases s <;> simp [shiftHom,shiftData,data,evaluate] + +def shiftAut (k : ℤ) : AuxiliaryGroup ≃* AuxiliaryGroup where + toFun := shiftHom k + invFun := shiftHom (-k) + left_inv a := by + have h := DFunLike.congr_fun (shiftHom_comp (-k) k) a + simpa only [add_neg_cancel,shiftHom_zero,MonoidHom.id_apply,MonoidHom.comp_apply] using h + right_inv a := by + have h := DFunLike.congr_fun (shiftHom_comp k (-k)) a + simpa only [neg_add_cancel,shiftHom_zero,MonoidHom.id_apply,MonoidHom.comp_apply] using h + map_mul' := (shiftHom k).map_mul + +theorem shiftAut_z (k N : ℤ) : shiftAut k (z N) = z (N+k) := by + change shiftHom k ⁅data.U 0 0,data.V 0 N⁆ = data.centralZ (N+k) + rw [map_commutatorElement,shiftHom_U,shiftHom_V,zero_add] + exact (data.centralZ_eq (N+k) 0 k N (by omega)).symm + +end Presentation + +end LittleFinitistic + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selection/MatrixModel.lean b/lean/OAI/Algebra/Finitistic/Selection/MatrixModel.lean new file mode 100644 index 0000000000000000000000000000000000000000..a219a3653a0fe6cf022d4a42709eed680c5cd111 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selection/MatrixModel.lean @@ -0,0 +1,307 @@ +import Mathlib.Algebra.Field.ZMod +import Mathlib.RingTheory.SimpleRing.Basic +import Mathlib.Algebra.CharP.Algebra +import OAI.Algebra.Finitistic.Selection.FiniteQuotient +import OAI.Algebra.Finitistic.Selection.GroupSelection + +namespace OAI +open scoped commutatorElement + +namespace LittleFinitistic + +def internalIndex (i : Fin 3) : Fin 5 := ⟨i.val+1,by omega⟩ + +@[simp] theorem internalIndex_ne_zero (i : Fin 3) : internalIndex i ≠ 0 := by + intro h + have hv := congrArg Fin.val h + change i.val+1=0 at hv + omega +@[simp] theorem internalIndex_ne_four (i : Fin 3) : internalIndex i ≠ 4 := by + intro h + have hv := congrArg Fin.val h + change i.val+1=4 at hv + omega +@[simp] theorem internalIndex_inj (i j : Fin 3) : internalIndex i = internalIndex j ↔ i=j := by + constructor + · intro h + apply Fin.ext + have hv := congrArg Fin.val h + change i.val+1=j.val+1 at hv + omega + · rintro rfl + rfl + +section MatrixRepresentation + +variable {R : Type*} [CommRing R] + + +def matrixU (r : Rˣ) (i : Fin 3) (a : ℤ) : (Matrix (Fin 5) (Fin 5) R)ˣ := + transvectionUnit 0 (internalIndex i) (Ne.symm (internalIndex_ne_zero i)) (↑(r^a) : R) + +def matrixV (r : Rˣ) (i : Fin 3) (a : ℤ) : (Matrix (Fin 5) (Fin 5) R)ˣ := + transvectionUnit (internalIndex i) 4 (internalIndex_ne_four i) (↑(r^a) : R) + +def matrixW (r : Rˣ) (i j : Fin 3) (a : ℤ) : (Matrix (Fin 5) (Fin 5) R)ˣ := + if h : i=j then 1 else + transvectionUnit (internalIndex i) (internalIndex j) (by simpa using h) (↑(r^a) : R) + +def matrixT (r : Rˣ) (i : Fin 3) : (Matrix (Fin 5) (Fin 5) R)ˣ := + diagonalUnit (fun j => if j=internalIndex i then r else 1) + +theorem matrixU_square [CharP R 2] (r : Rˣ) (i : Fin 3) (a : ℤ) : matrixU r i a * matrixU r i a = 1 := by + apply Units.ext + change transvection 0 (internalIndex i) (↑(r^a) : R) * + transvection 0 (internalIndex i) (↑(r^a) : R) = 1 + rw [transvection_same 0 (internalIndex i) (Ne.symm (internalIndex_ne_zero i))] + simp [CharTwo.add_self_eq_zero,transvection] + +theorem matrix_UU_commute (r : Rˣ) (i j : Fin 3) (a b : ℤ) : + Commute (matrixU r i a) (matrixU r j b) := by + exact transvectionUnit_commute _ _ _ _ _ _ + (internalIndex_ne_zero i) (internalIndex_ne_zero j) _ _ + +theorem matrix_VV_commute (r : Rˣ) (i j : Fin 3) (a b : ℤ) : + Commute (matrixV r i a) (matrixV r j b) := by + exact transvectionUnit_commute _ _ _ _ _ _ + (Ne.symm (internalIndex_ne_four j)) (Ne.symm (internalIndex_ne_four i)) _ _ + +theorem matrix_UV_commute (r : Rˣ) (i j : Fin 3) (a b : ℤ) (hij : i≠j) : + Commute (matrixU r i a) (matrixV r j b) := by + exact transvectionUnit_commute _ _ _ _ _ _ (by simpa using hij) (by decide) _ _ + +theorem matrix_WU_commute (r : Rˣ) (i j h : Fin 3) (a b : ℤ) (hhi : h≠i) : + Commute (matrixW r i j a) (matrixU r h b) := by + unfold matrixW + split_ifs with hij + · exact Commute.one_left _ + · exact transvectionUnit_commute _ _ _ _ _ _ + (internalIndex_ne_zero j) (by simpa using hhi) _ _ + +theorem matrix_WV_commute (r : Rˣ) (i j h : Fin 3) (a b : ℤ) (hhj : h≠j) : + Commute (matrixW r i j a) (matrixV r h b) := by + unfold matrixW + split_ifs with hij + · exact Commute.one_left _ + · exact transvectionUnit_commute _ _ _ _ _ _ + (by simpa using hhj.symm) (Ne.symm (internalIndex_ne_four i)) _ _ + +theorem matrix_UW_commutator (r : Rˣ) (i j : Fin 3) (a b : ℤ) (hij : i≠j) : + ⁅matrixU r i a,matrixW r i j b⁆ = matrixU r j (a+b) := by + unfold matrixW matrixU + rw [dite_eq_right hij] + simpa only [zpow_add,Units.val_mul] using + transvectionUnit_commutator (R := R) 0 (internalIndex i) (internalIndex j) + (Ne.symm (internalIndex_ne_zero i)) (by simpa using hij) + (Ne.symm (internalIndex_ne_zero j)) (↑(r^a) : R) (↑(r^b) : R) + +theorem matrix_WV_commutator (r : Rˣ) (i j : Fin 3) (a b : ℤ) (hij : i≠j) : + ⁅matrixW r i j a,matrixV r j b⁆ = matrixV r i (a+b) := by + unfold matrixW matrixV + rw [dite_eq_right hij] + simpa only [zpow_add,Units.val_mul] using + transvectionUnit_commutator (R := R) (internalIndex i) (internalIndex j) 4 + (by simpa using hij) (internalIndex_ne_four j) + (internalIndex_ne_four i) (↑(r^a) : R) (↑(r^b) : R) + +theorem matrix_TT_commute (r : Rˣ) (i j : Fin 3) : Commute (matrixT r i) (matrixT r j) := + diagonalUnit_commute _ _ + +theorem matrix_W_diagonal (r : Rˣ) (i : Fin 3) (a : ℤ) : matrixW r i i a = 1 := by + simp [matrixW] + +theorem matrix_TU_conjugation (r : Rˣ) (l i : Fin 3) (a : ℤ) : + matrixT r l * matrixU r i a * (matrixT r l)⁻¹ = + matrixU r i (a-if l=i then 1 else 0) := by + unfold matrixT matrixU + rw [transvectionUnit_conjugation] + have h0 : (0 : Fin 5) ≠ internalIndex l := (internalIndex_ne_zero l).symm + by_cases h : l=i + · subst l + simp [h0,zpow_sub] + · have hi : internalIndex i ≠ internalIndex l := by simpa using Ne.symm h + simp [h0,hi,h] + +theorem matrix_TV_conjugation (r : Rˣ) (l i : Fin 3) (a : ℤ) : + matrixT r l * matrixV r i a * (matrixT r l)⁻¹ = + matrixV r i (a+if l=i then 1 else 0) := by + unfold matrixT matrixV + rw [transvectionUnit_conjugation] + have h4 : (4 : Fin 5) ≠ internalIndex l := (internalIndex_ne_four l).symm + by_cases h : l=i + · subst l + simp [h4,zpow_add,mul_comm] + · have hi : internalIndex i ≠ internalIndex l := by simpa using Ne.symm h + simp [h4,hi,h] + +theorem matrix_TW_conjugation (r : Rˣ) (l i j : Fin 3) (a : ℤ) : + matrixT r l * matrixW r i j a * (matrixT r l)⁻¹ = + matrixW r i j (a+(if l=i then 1 else 0)-if l=j then 1 else 0) := by + by_cases hij : i=j + · subst j + simp [matrix_W_diagonal] + · simp only [matrixW,dite_eq_right hij,matrixT] + rw [transvectionUnit_conjugation] + by_cases hli : l=i <;> by_cases hlj : l=j + · exact False.elim (hij (hli.symm.trans hlj)) + · subst l + have hji : internalIndex j ≠ internalIndex i := by simpa using Ne.symm hij + simp [hji,hlj,zpow_add,mul_comm] + · subst l + have hij' : internalIndex i ≠ internalIndex j := by simpa using hij + simp [hij',hli,zpow_sub] + · have hi : internalIndex i ≠ internalIndex l := by simpa using Ne.symm hli + have hj : internalIndex j ≠ internalIndex l := by simpa using Ne.symm hlj + simp [hi,hj,hli,hlj] + +def matrixData [CharP R 2] (r : Rˣ) : SelectionGroupData (Matrix (Fin 5) (Fin 5) R)ˣ where + T := matrixT r + U := matrixU r + V := matrixV r + W := matrixW r + square_U := matrixU_square r + commute_UU i j a b _ := matrix_UU_commute r i j a b + commute_VV i j a b _ := matrix_VV_commute r i j a b + commute_UV := matrix_UV_commute r + commute_WU := matrix_WU_commute r + commute_WV := matrix_WV_commute r + commutator_UW := matrix_UW_commutator r + commutator_WV := matrix_WV_commutator r + commute_TT := matrix_TT_commute r + conj_TU := matrix_TU_conjugation r + conj_TV := matrix_TV_conjugation r + conj_TW := matrix_TW_conjugation r + diagonal_W := matrix_W_diagonal r + +def matrixRepresentation [CharP R 2] (r : Rˣ) : Presentation.AuxiliaryGroup →* + (Matrix (Fin 5) (Fin 5) R)ˣ := Presentation.ofData (matrixData r) + +theorem matrixRepresentation_z [CharP R 2] (r : Rˣ) (N : ℤ) : + matrixRepresentation r (Presentation.z N) = transvectionUnit 0 4 (by decide) (↑(r^N) : R) := by + change Presentation.ofData (matrixData r) + ⁅PresentedGroup.of (Presentation.Generator.U 0 0),PresentedGroup.of (Presentation.Generator.V 0 N)⁆ = _ + rw [map_commutatorElement,Presentation.ofData_of,Presentation.ofData_of] + change ⁅matrixU r 0 0,matrixV r 0 N⁆ = _ + unfold matrixU matrixV + rw [transvectionUnit_commutator 0 (internalIndex 0) 4 _ _ (by decide)] + simp only [zpow_zero,Units.val_one,one_mul] + + +end MatrixRepresentation + +instance cyclicRing_nontrivial (m : ℕ) [NeZero m] : Nontrivial (CyclicRing m) := by + let i : Fin m := ⟨0,Nat.pos_of_ne_zero (NeZero.ne m)⟩ + exact ⟨⟨cyclicBasis m (NeZero.ne m) i,0,(cyclicBasis m (NeZero.ne m)).ne_zero i⟩⟩ + +instance cyclicRing_finiteInst (m : ℕ) [NeZero m] : Finite (CyclicRing m) := + cyclicRing_finite m (NeZero.ne m) + +instance cyclicRing_charTwo (m : ℕ) [NeZero m] : CharP (CyclicRing m) 2 := + charP_of_injective_algebraMap (algebraMap (ZMod 2) (CyclicRing m)).injective 2 + +noncomputable def cyclicUnit (m : ℕ) [NeZero m] : (CyclicRing m)ˣ := + (cyclic_root_isUnit m (Nat.pos_of_ne_zero (NeZero.ne m))).unit + +@[simp] theorem cyclicUnit_val (m : ℕ) [NeZero m] : + (cyclicUnit m : CyclicRing m) = AdjoinRoot.root (cyclicPolynomial m) := + IsUnit.unit_spec _ + +noncomputable def cyclicRepresentation (m : ℕ) [NeZero m] : Presentation.AuxiliaryGroup →* + (Matrix (Fin 5) (Fin 5) (CyclicRing m))ˣ := matrixRepresentation (cyclicUnit m) + +theorem cyclicRepresentation_z (m : ℕ) [NeZero m] (i : ℕ) : + cyclicRepresentation m (Presentation.z i) = transvectionUnit 0 4 (by decide) + (AdjoinRoot.root (cyclicPolynomial m)^i) := by + unfold cyclicRepresentation + rw [matrixRepresentation_z] + simp only [zpow_natCast,Units.val_pow_eq_pow_val,cyclicUnit_val] + +theorem centralEmbedding_basis (m : ℕ) [NeZero m] (i : Fin m) : + centralEmbedding m (Multiplicative.ofAdd (Pi.single i 1)) = + cyclicRepresentation m (Presentation.z i.val) := by + rw [cyclicRepresentation_z] + apply Units.ext + change transvection (R := CyclicRing m) (0 : Fin 5) 4 (∑ j : Fin m, (Pi.single i (1 : ZMod 2) : Fin m → ZMod 2) j • + AdjoinRoot.root (cyclicPolynomial m) ^ (j : ℕ)) = _ + simp [Pi.single_apply, transvectionUnit] + +noncomputable abbrev FiniteQuotientGroup (m : ℕ) [NeZero m] := (cyclicRepresentation m).range + +instance finiteQuotientGroup_finite (m : ℕ) [NeZero m] : Finite (FiniteQuotientGroup m) := + inferInstance + +noncomputable def finiteQuotientMap (m : ℕ) [NeZero m] : + Presentation.AuxiliaryGroup →* FiniteQuotientGroup m := (cyclicRepresentation m).rangeRestrict + +theorem finiteQuotientMap_surjective (m : ℕ) [NeZero m] : + Function.Surjective (finiteQuotientMap m) := (cyclicRepresentation m).rangeRestrict_surjective + +theorem centralEmbedding_mem_center_map (m : ℕ) [NeZero m] + (c : Fin m → ZMod 2) : centralEmbedding m (Multiplicative.ofAdd c) ∈ + (Subgroup.center Presentation.AuxiliaryGroup).map (cyclicRepresentation m) := by + classical + let S := (Subgroup.center Presentation.AuxiliaryGroup).map (cyclicRepresentation m) + apply Pi.single_induction (fun c => centralEmbedding m (Multiplicative.ofAdd c) ∈ S) c + · simp + · intro f g hf hg + change centralEmbedding m (Multiplicative.ofAdd f * Multiplicative.ofAdd g) ∈ S + rw [map_mul] + exact S.mul_mem hf hg + · intro i a + fin_cases a + · change centralEmbedding m (Multiplicative.ofAdd (Pi.single i (0 : ZMod 2))) ∈ S + simpa only [Pi.single_zero,ofAdd_zero,map_one] using S.one_mem + · change centralEmbedding m (Multiplicative.ofAdd (Pi.single i (1 : ZMod 2))) ∈ S + rw [centralEmbedding_basis] + apply Subgroup.mem_map_of_mem + exact Subgroup.mem_center_iff.mpr (fun g => (Presentation.z_central i.val g).eq.symm) + +theorem centralEmbedding_mem_range (m : ℕ) [NeZero m] + (c : Multiplicative (Fin m → ZMod 2)) : + centralEmbedding m c ∈ (cyclicRepresentation m).range := by + obtain ⟨g, _, hg⟩ := centralEmbedding_mem_center_map m c.toAdd + exact ⟨g,hg⟩ + +noncomputable def quotientCentralEmbedding (m : ℕ) [NeZero m] : + Multiplicative (Fin m → ZMod 2) →* FiniteQuotientGroup m where + toFun c := ⟨centralEmbedding m c, centralEmbedding_mem_range m c⟩ + map_one' := Subtype.ext (map_one _) + map_mul' a b := Subtype.ext (map_mul _ a b) + +theorem quotientCentralEmbedding_injective (m : ℕ) [NeZero m] : + Function.Injective (quotientCentralEmbedding m) := by + intro a b h + exact centralEmbedding_injective m (NeZero.ne m) (congrArg Subtype.val h) + +theorem quotientCentralEmbedding_basis (m : ℕ) [NeZero m] (i : Fin m) : + quotientCentralEmbedding m (Multiplicative.ofAdd (Pi.single i 1)) = + finiteQuotientMap m (Presentation.z i.val) := + Subtype.ext (centralEmbedding_basis m i) + +theorem quotientCentralEmbedding_central (m : ℕ) [NeZero m] + (c : Multiplicative (Fin m → ZMod 2)) (g : FiniteQuotientGroup m) : + Commute (quotientCentralEmbedding m c) g := by + obtain ⟨x, hx, hxval⟩ := centralEmbedding_mem_center_map m c.toAdd + obtain ⟨y, hy⟩ := finiteQuotientMap_surjective m g + subst g + apply Subtype.ext + change centralEmbedding m c * cyclicRepresentation m y = + cyclicRepresentation m y * centralEmbedding m c + change cyclicRepresentation m x = centralEmbedding m c at hxval + rw [← hxval, ← map_mul, ← map_mul] + exact congrArg (cyclicRepresentation m) (Subgroup.mem_center_iff.mp hx y).symm + +/-- The actual finite quotient in the manuscript, including the embedded elementary +abelian central subgroup and the prescribed images of all its basis elements. -/ +theorem finite_central_quotient (m : ℕ) [NeZero m] : + Function.Surjective (finiteQuotientMap m) ∧ + Function.Injective (quotientCentralEmbedding m) ∧ + (∀ c g, Commute (quotientCentralEmbedding m c) g) ∧ + (∀ i : Fin m, quotientCentralEmbedding m (Multiplicative.ofAdd (Pi.single i 1)) = + finiteQuotientMap m (Presentation.z i.val)) := + ⟨finiteQuotientMap_surjective m,quotientCentralEmbedding_injective m, + quotientCentralEmbedding_central m,quotientCentralEmbedding_basis m⟩ + +end LittleFinitistic + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selection/SelectionAlgebra.lean b/lean/OAI/Algebra/Finitistic/Selection/SelectionAlgebra.lean new file mode 100644 index 0000000000000000000000000000000000000000..c07ad383fb9573ecb26f23606f0acd8f581811ae --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selection/SelectionAlgebra.lean @@ -0,0 +1,57 @@ +import Mathlib.Algebra.MonoidAlgebra.Basic +import Mathlib.Tactic.Abel +import Mathlib.Algebra.MonoidAlgebra.MapDomain +import Mathlib.Basic.Complex.Basic +import Mathlib.Tactic.NormNum +import OAI.Algebra.Finitistic.Selection.GroupSelection + +namespace OAI +namespace LittleFinitistic + +open MonoidAlgebra + +abbrev SelectionRing := MonoidAlgebra ℂ Presentation.AuxiliaryGroup + +noncomputable def algebraZ (q : ℤ) : SelectionRing := single (Presentation.z q) 1 + +@[simp] theorem algebraZ_square (q : ℤ) : algebraZ q * algebraZ q = 1 := by + simp [algebraZ,single_mul_single,Presentation.z_involution] + rfl + +theorem algebraZ_central (q : ℤ) (a : SelectionRing) : Commute (algebraZ q) a := + MonoidAlgebra.single_commute (Presentation.z_central q) Commute.one_left a + +noncomputable def selectionIdempotent (q : ℤ) : SelectionRing := + (1/2 : ℂ) • (1 + algebraZ q) + +theorem selectionIdempotent_square (q : ℤ) : + selectionIdempotent q * selectionIdempotent q = selectionIdempotent q := by + have hz : (1 + algebraZ q)*(1 + algebraZ q) = (1+algebraZ q)+(1+algebraZ q) := by + simp only [mul_add,add_mul,one_mul,mul_one,algebraZ_square] + abel + unfold selectionIdempotent + rw [smul_mul_smul,hz,smul_add,← add_smul] + norm_num + +theorem selectionIdempotent_central (q : ℤ) (a : SelectionRing) : + Commute (selectionIdempotent q) a := by + show selectionIdempotent q * a = a * selectionIdempotent q + unfold selectionIdempotent + rw [smul_mul_assoc,mul_smul_comm] + congr 1 + simp only [add_mul,mul_add,one_mul,mul_one,(algebraZ_central q a).eq] + +noncomputable def selectionAutomorphism (k : ℤ) : SelectionRing ≃ₐ[ℂ] SelectionRing := + MonoidAlgebra.domCongr ℂ ℂ (Presentation.shiftAut k) + +@[simp] theorem selectionAutomorphism_z (k q : ℤ) : + selectionAutomorphism k (algebraZ q) = algebraZ (q+k) := by + simp [selectionAutomorphism,algebraZ,Presentation.shiftAut_z] + +@[simp] theorem selectionAutomorphism_idempotent (k q : ℤ) : + selectionAutomorphism k (selectionIdempotent q) = selectionIdempotent (q+k) := by + simp [selectionIdempotent] + +end LittleFinitistic + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selection/SelectionCharacter.lean b/lean/OAI/Algebra/Finitistic/Selection/SelectionCharacter.lean new file mode 100644 index 0000000000000000000000000000000000000000..5e5bf7e37831919872f940e5aea3340037239724 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selection/SelectionCharacter.lean @@ -0,0 +1,42 @@ +import Mathlib.Basic.Complex.Basic +import OAI.Algebra.Finitistic.Selection.MatrixModel + +namespace OAI +namespace LittleFinitistic + +noncomputable def parityValue (a : ZMod 2) : ℂˣ := if a = 0 then 1 else -1 + +@[simp] theorem parityValue_zero : parityValue 0 = 1 := by simp [parityValue] +@[simp] theorem parityValue_one : parityValue 1 = -1 := by norm_num [parityValue] + +theorem parityValue_add (a b : ZMod 2) : parityValue (a+b) = parityValue a * parityValue b := by + have hc : ∀ a : ZMod 2, a = 0 ∨ a = 1 := by decide + rcases hc a with rfl | rfl <;> rcases hc b with rfl | rfl + · simp + · simp + · simp + · rw [show (1 : ZMod 2) + 1 = 0 from rfl,parityValue_zero,parityValue_one] + simp + +def lastIndex (m : ℕ) [NeZero m] : Fin m := ⟨m-1,by have := NeZero.ne m; omega⟩ + +noncomputable def selectionCharacter (m : ℕ) [NeZero m] : + Multiplicative (Fin m → ZMod 2) →* ℂˣ where + toFun c := parityValue (c.toAdd (lastIndex m)) + map_one' := parityValue_zero + map_mul' first second := parityValue_add (first.toAdd (lastIndex m)) + (second.toAdd (lastIndex m)) + +@[simp] theorem selectionCharacter_basis (m : ℕ) [NeZero m] (i : Fin m) : + selectionCharacter m (Multiplicative.ofAdd (Pi.single i 1)) = + if i = lastIndex m then -1 else 1 := by + classical + change parityValue ((Pi.single i (1 : ZMod 2) : Fin m → ZMod 2) (lastIndex m)) = _ + by_cases h : i = lastIndex m + · subst i + simp + · simp [h,Ne.symm h] + +end LittleFinitistic + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selection/SelectionEncoding.lean b/lean/OAI/Algebra/Finitistic/Selection/SelectionEncoding.lean new file mode 100644 index 0000000000000000000000000000000000000000..859b54752d1c180c2a765e0ad6c8b6e2635f5017 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selection/SelectionEncoding.lean @@ -0,0 +1,53 @@ +import OAI.Algebra.Finitistic.Encoding.PresentationReindex +import OAI.Algebra.Finitistic.Selection.SelectionAlgebra + +namespace OAI + +namespace LittleFinitistic.SelectionEncoding +open QuadraticPresentation QuadraticEncoding + +/-- Concrete finite coefficient data, with an exact presentation equivalence. -/ +structure Encoding (k R : Type*) [Field k] [Ring R] [Algebra k R] where + generators : ℕ + equations : ℕ + relations : Relations k generators equations + equiv : Original k (Fin generators) (QuotientAction.polynomial relations) ≃ₐ[k] R + +universe u v w +variable {k : Type u} {R : Type v} [Field k] [Ring R] [Algebra k R] (E : Encoding k R) + +noncomputable def generator (h : Fin E.generators) : R := + E.equiv (originalMap k (Fin E.generators) (QuotientAction.polynomial E.relations) + (FreeAlgebra.ι k h)) + +/-- These concrete elements of R satisfy every coefficient equation. -/ +theorem generator_relations (j : Fin E.equations) : + (∑ h, ∑ l, E.relations.quadratic j h l • (generator E h * generator E l)) + + (∑ h, E.relations.linear j h • generator E h) + E.relations.constant j • (1 : R) = 0 := by + have h := congrArg E.equiv (original_relation k (Fin E.generators) + (QuotientAction.polynomial E.relations) j) + simpa only [QuotientAction.polynomial,map_add,map_sum,map_smul,map_mul,map_one,map_zero,generator] + using h + +abbrev directedAlgebra := B E.relations + +noncomputable instance : Ring (directedAlgebra E) := + ThreeVertexAlgebra.instRing (composition E.relations) + +theorem directedAlgebra_finiteDimensional : FiniteDimensional k (directedAlgebra E) := + QuadraticEncoding.finiteDimensional E.relations + +open CategoryTheory in +theorem directedAlgebra_globalDimension_le_two : + (⨆ N : ModuleCat.{max u w} (directedAlgebra E), projectiveDimension N) ≤ (2 : ℕ) ∧ + (⨆ N : ModuleCat.{max u w} (directedAlgebra E)ᵐᵒᵖ, projectiveDimension N) ≤ (2 : ℕ) := + QuadraticEncoding.globalDimension_le_two E.relations + +/-- The actual Section 2 selecting algebra has one fixed concrete finite encoding. -/ +noncomputable def auxiliaryEncoding : Encoding ℂ SelectionRing := + Classical.choice (by + obtain ⟨d,t,P,⟨E⟩⟩ := PresentationReindex.auxiliaryGroupAlgebra_has_encoding + exact ⟨⟨d,t,P,E⟩⟩) +end LittleFinitistic.SelectionEncoding + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selection/SelectionIteration.lean b/lean/OAI/Algebra/Finitistic/Selection/SelectionIteration.lean new file mode 100644 index 0000000000000000000000000000000000000000..a5be1101239861696370e9cffa96d8b4a78804a9 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selection/SelectionIteration.lean @@ -0,0 +1,173 @@ +import Mathlib.Algebra.Category.ModuleCat.ChangeOfRings +import OAI.Algebra.Finitistic.Selection.TestModules + +namespace OAI +namespace LittleFinitistic +open CategoryTheory + +/-- The image of the central idempotent, expressed by its fixed vectors. -/ +noncomputable def selectedSubmodule (M : ModuleCat SelectionRing) : Submodule SelectionRing M where + carrier := {x | selectionIdempotent 0 • x = x} + zero_mem' := by simp + add_mem' := by + intro x y hx hy + change selectionIdempotent 0 • x = x at hx + change selectionIdempotent 0 • y = y at hy + change selectionIdempotent 0 • (x+y) = x+y + rw [smul_add,hx,hy] + smul_mem' := by + intro r x hx + change selectionIdempotent 0 • (r • x) = r • x + rw [← mul_smul,(selectionIdempotent_central 0 r).eq,mul_smul,hx] + +theorem selectedSubmodule_eq_image (M : ModuleCat SelectionRing) (x : M) : + x ∈ selectedSubmodule M ↔ ∃ y : M, selectionIdempotent 0 • y = x := by + constructor + · intro hx; exact ⟨x,hx⟩ + · rintro ⟨y,rfl⟩ + change selectionIdempotent 0 • (selectionIdempotent 0 • y) = _ + rw [← mul_smul,selectionIdempotent_square] + +/-- Exactly H(Y) = restriction along alpha of eY from the manuscript. -/ +noncomputable def selectionStep (M : ModuleCat SelectionRing) : ModuleCat SelectionRing := + (ModuleCat.restrictScalars (selectionAutomorphism 1).toRingHom).obj + (ModuleCat.of SelectionRing (selectedSubmodule M)) + +noncomputable def selectionIterate (M : ModuleCat SelectionRing) : ℕ → ModuleCat SelectionRing + | 0 => M + | n+1 => selectionStep (selectionIterate M n) + +def IdentityAt (M : ModuleCat SelectionRing) (q : ℕ) : Prop := + ∀ x : M, selectionIdempotent q • x = x + +def ZeroAt (M : ModuleCat SelectionRing) (q : ℕ) : Prop := + ∀ x : M, selectionIdempotent q • x = 0 + +theorem identityAt_step (M : ModuleCat SelectionRing) (q : ℕ) + (h : IdentityAt M (q+1)) : IdentityAt (selectionStep M) q := by + intro x + apply Subtype.ext + change selectionAutomorphism 1 (selectionIdempotent q) • x.val = x.val + rw [selectionAutomorphism_idempotent] + exact_mod_cast h x.val + +theorem zeroAt_step (M : ModuleCat SelectionRing) (q : ℕ) + (h : ZeroAt M (q+1)) : ZeroAt (selectionStep M) q := by + intro x + apply Subtype.ext + change selectionAutomorphism 1 (selectionIdempotent q) • x.val = 0 + rw [selectionAutomorphism_idempotent] + exact_mod_cast h x.val + +theorem selectionStep_nontrivial (M : ModuleCat SelectionRing) [Nontrivial M] + (h : IdentityAt M 0) : Nontrivial (selectionStep M) := by + obtain ⟨x,y,hxy⟩ := exists_pair_ne M + exact ⟨⟨⟨x,h x⟩,⟨y,h y⟩,fun he => hxy (congrArg Subtype.val he)⟩⟩ + +theorem selectionStep_subsingleton (M : ModuleCat SelectionRing) + (h : ZeroAt M 0) : Subsingleton (selectionStep M) := by + refine ⟨fun x y => Subtype.ext ?_⟩ + have hx : x.val = 0 := (x.property).symm.trans (h x.val) + have hy : y.val = 0 := (y.property).symm.trans (h y.val) + exact hx.trans hy.symm + +theorem identityAt_iterate (M : ModuleCat SelectionRing) (n q : ℕ) + (h : IdentityAt M (q+n)) : IdentityAt (selectionIterate M n) q := by + induction n generalizing q with + | zero => simpa [selectionIterate] using h + | succ n ih => + apply identityAt_step + apply ih + simpa [Nat.add_assoc,Nat.add_comm,Nat.add_left_comm] using h + +theorem zeroAt_iterate (M : ModuleCat SelectionRing) (n q : ℕ) + (h : ZeroAt M (q+n)) : ZeroAt (selectionIterate M n) q := by + induction n generalizing q with + | zero => simpa [selectionIterate] using h + | succ n ih => + apply zeroAt_step + apply ih + simpa [Nat.add_assoc,Nat.add_comm,Nat.add_left_comm] using h + +noncomputable def testObject (m : ℕ) [NeZero m] : ModuleCat SelectionRing := + ModuleCat.of SelectionRing (TestModule m) + +theorem testObject_identityAt (m : ℕ) [NeZero m] (q : ℕ) (hq : q < m-1) : + IdentityAt (testObject m) q := by + intro x + let i : Fin m := ⟨q,by omega⟩ + have hi : i ≠ lastIndex m := by + intro h + have hv := congrArg Fin.val h + change q = m-1 at hv + omega + exact (testModule_idempotent_action m i x).trans (ite_eq_right hi) + +theorem testObject_zeroAt (m : ℕ) [NeZero m] : ZeroAt (testObject m) (m-1) := by + intro x + exact (testModule_idempotent_action m (lastIndex m) x).trans (ite_eq_left rfl) + +theorem selectionIterate_test_nontrivial (m : ℕ) [NeZero m] (n : ℕ) (hn : n < m) : + Nontrivial (selectionIterate (testObject m) n) := by + induction n with + | zero => exact testModule_nontrivial m + | succ n ih => + have := ih (by omega) + apply selectionStep_nontrivial + apply identityAt_iterate + simpa only [Nat.zero_add] using testObject_identityAt m n (by omega) + +theorem selectionIterate_test_subsingleton (m : ℕ) [NeZero m] : + Subsingleton (selectionIterate (testObject m) m) := by + have hm : m = (m-1)+1 := by have := NeZero.ne m; omega + have hzero : ZeroAt (selectionIterate (testObject m) (m-1)) 0 := + zeroAt_iterate (testObject m) (m-1) 0 (by simpa using testObject_zeroAt m) + have h := selectionStep_subsingleton _ hzero + change Subsingleton (selectionIterate (testObject m) ((m-1)+1)) at h + rwa [← hm] at h + +/-- Exact extinction under the manuscript's actual selection operation H: +every earlier iterate is nonzero and the m-th iterate is zero. -/ +theorem selection_extinction (m : ℕ) [NeZero m] : + (∀ n < m, Nontrivial (selectionIterate (testObject m) n)) ∧ + Subsingleton (selectionIterate (testObject m) m) := + ⟨selectionIterate_test_nontrivial m,selectionIterate_test_subsingleton m⟩ + +noncomputable def complexObject (M : ModuleCat SelectionRing) : ModuleCat ℂ := + (ModuleCat.restrictScalars (algebraMap ℂ SelectionRing)).obj M + +noncomputable def selectionStep_inclusion (M : ModuleCat SelectionRing) : + complexObject (selectionStep M) →ₗ[ℂ] complexObject M where + toFun x := x.val + map_add' _ _ := rfl + map_smul' c x := by + change selectionAutomorphism 1 (algebraMap ℂ SelectionRing c) • x.val = + algebraMap ℂ SelectionRing c • x.val + rw [AlgEquiv.commutes] + +theorem selectionStep_finiteDimensional (M : ModuleCat SelectionRing) + [FiniteDimensional ℂ (complexObject M)] : + FiniteDimensional ℂ (complexObject (selectionStep M)) := + FiniteDimensional.of_injective (selectionStep_inclusion M) Subtype.val_injective + +theorem testObject_finiteDimensional (m : ℕ) [NeZero m] : + FiniteDimensional ℂ (complexObject (testObject m)) := by + let f : complexObject (testObject m) →ₗ[ℂ] TestModule m := + { toFun := fun x => x + map_add' := fun _ _ => rfl + map_smul' := fun c x => by + have h : ∀ y : TestModule m, algebraMap ℂ SelectionRing c • y = c • y := + fun y => algebraMap_smul SelectionRing c y + exact h x } + exact FiniteDimensional.of_injective f (fun _ _ h => h) + +theorem selectionIterate_test_finiteDimensional (m : ℕ) [NeZero m] (n : ℕ) : + FiniteDimensional ℂ (complexObject (selectionIterate (testObject m) n)) := by + induction n with + | zero => exact testObject_finiteDimensional m + | succ n ih => + have := ih + exact selectionStep_finiteDimensional _ +end LittleFinitistic + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Selection/TestModules.lean b/lean/OAI/Algebra/Finitistic/Selection/TestModules.lean new file mode 100644 index 0000000000000000000000000000000000000000..9cc7de5a7bd156f44f48661530d0c697b9a67b49 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Selection/TestModules.lean @@ -0,0 +1,67 @@ +import OAI.Algebra.Finitistic.Selection.CharacterModule +import OAI.Algebra.Finitistic.Selection.SelectionCharacter +import OAI.Algebra.Finitistic.Selection.SelectionAlgebra + +namespace OAI +namespace LittleFinitistic +open MonoidAlgebra + +noncomputable abbrev TestModule (m : ℕ) [NeZero m] := + CharacterModule.eigenspace (quotientCentralEmbedding m) (selectionCharacter m) + (quotientCentralEmbedding_central m) + +noncomputable instance testModule_nontrivial (m : ℕ) [NeZero m] : Nontrivial (TestModule m) := + CharacterModule.eigenspace_nontrivial _ _ _ (quotientCentralEmbedding_injective m) + +noncomputable instance testModule_finiteDimensional (m : ℕ) [NeZero m] : + FiniteDimensional ℂ (TestModule m) := + CharacterModule.eigenspace_finiteDimensional _ _ _ + +noncomputable def testRingMap (m : ℕ) [NeZero m] : + SelectionRing →ₐ[ℂ] MonoidAlgebra ℂ (FiniteQuotientGroup m) := + MonoidAlgebra.mapDomainAlgHom ℂ ℂ (finiteQuotientMap m) + +noncomputable instance testModule_module (m : ℕ) [NeZero m] : + Module SelectionRing (TestModule m) := + Module.compHom (TestModule m) (testRingMap m).toRingHom + +@[simp] theorem testModule_smul_val (m : ℕ) [NeZero m] + (r : SelectionRing) (x : TestModule m) : + ((r • x : TestModule m) : MonoidAlgebra ℂ (FiniteQuotientGroup m)) = testRingMap m r * x := rfl + +instance testModule_scalarTower (m : ℕ) [NeZero m] : IsScalarTower ℂ SelectionRing (TestModule m) where + smul_assoc c r x := by + apply Subtype.ext + change testRingMap m (c • r) * x.val = c • (testRingMap m r * x.val) + rw [map_smul,smul_mul_assoc] + +@[simp] theorem testRingMap_algebraZ (m : ℕ) [NeZero m] (q : ℤ) : + testRingMap m (algebraZ q) = single (finiteQuotientMap m (Presentation.z q)) 1 := by + simp [testRingMap,algebraZ] + +theorem testModule_basis_action (m : ℕ) [NeZero m] (i : Fin m) (x : TestModule m) : + algebraZ i.val • x = (if i = lastIndex m then (-1 : ℂ) else 1) • x := by + apply Subtype.ext + change testRingMap m (algebraZ i.val) * x.val = _ + rw [testRingMap_algebraZ,← quotientCentralEmbedding_basis] + have hx := x.property (Multiplicative.ofAdd (Pi.single i 1)) + rw [selectionCharacter_basis] at hx + by_cases h : i = lastIndex m + · simp only [h,ite_true,Units.val_neg,Units.val_one] at hx ⊢ + exact hx + · simp only [h,ite_false,Units.val_one] at hx ⊢ + exact hx + +/-- The first m−1 selecting idempotents act as identity; the next acts as zero. -/ +theorem testModule_idempotent_action (m : ℕ) [NeZero m] (i : Fin m) (x : TestModule m) : + selectionIdempotent i.val • x = if i = lastIndex m then 0 else x := by + classical + unfold selectionIdempotent + rw [smul_assoc,add_smul,one_smul,testModule_basis_action] + split_ifs + · rw [show (-1 : ℂ) • x = -x from neg_one_smul ℂ x,add_neg_cancel,smul_zero] + · rw [one_smul,← two_smul ℂ x,smul_smul] + norm_num +end LittleFinitistic + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Tensor/BalancedFreeLeft.lean b/lean/OAI/Algebra/Finitistic/Tensor/BalancedFreeLeft.lean new file mode 100644 index 0000000000000000000000000000000000000000..b927c729326628c5e169776f44c66f62db300a0c --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Tensor/BalancedFreeLeft.lean @@ -0,0 +1,128 @@ +import OAI.Algebra.Finitistic.Ordinary.OrdinaryFreeTensorExactness + +namespace OAI +noncomputable section +namespace LittleFinitistic.BalancedTensor.FreeLeft +universe u +variable {k A : Type u} [Field k] [Ring A] [Algebra k A] +variable (I M : Type u) [AddCommGroup M] [Module k M] [Module Aᵐᵒᵖ M] + [IsScalarTower k Aᵐᵒᵖ M] + +/-- A coefficient of a free left module acts on the right tensor factor. -/ +def coefficientAction : A →ₗ[k] M →ₗ[k] M := + (Algebra.lsmul k k M).toLinearMap.comp (MulOpposite.opLinearEquiv k).toLinearMap + +def evaluateBilinear : M →ₗ[k] (I →₀ A) →ₗ[k] (I →₀ M) := + (Finsupp.lsum k (fun i => + (coefficientAction (k := k) (A := A) M).compr₂ (Finsupp.lsingle i))).flip + +@[simp] theorem evaluateBilinear_single (i : I) (a : A) (m : M) : + evaluateBilinear (k := k) I M m (Finsupp.single i a) = + Finsupp.single i (MulOpposite.op a • m) := by + simp only [evaluateBilinear,LinearMap.flip_apply,Finsupp.lsum_single] + rfl + +def evaluation : Tensor k A M (I →₀ A) →ₗ[k] (I →₀ M) := + lift (evaluateBilinear (k := k) I M) (by + intro a m n + induction n using Finsupp.induction_linear with + | zero => simp only [smul_zero,map_zero] + | add x y hx hy => simp only [smul_add,map_add,hx,hy] + | single i x => + rw [Finsupp.smul_single,evaluateBilinear_single,evaluateBilinear_single] + change Finsupp.single i (MulOpposite.op x • (MulOpposite.op a • m)) = + Finsupp.single i (MulOpposite.op (a*x) • m) + rw [← mul_smul,MulOpposite.op_mul]) + +@[simp] theorem evaluation_single (i : I) (a : A) (m : M) : + evaluation (k := k) I M (mk k A M (I →₀ A) m (Finsupp.single i a)) = + Finsupp.single i (MulOpposite.op a • m) := evaluateBilinear_single I M i a m + +def insertion : (I →₀ M) →ₗ[k] Tensor k A M (I →₀ A) := + Finsupp.lsum k (fun i => (mk k A M (I →₀ A)).flip (Finsupp.single i 1)) + +omit [IsScalarTower k Aᵐᵒᵖ M] in +@[simp] theorem insertion_single (i : I) (m : M) : + insertion (k := k) (A := A) I M (Finsupp.single i m) = + mk k A M (I →₀ A) m (Finsupp.single i 1) := by + simp only [insertion,Finsupp.lsum_single,LinearMap.flip_apply] + +theorem evaluation_insertion (z : I →₀ M) : + evaluation (k := k) (A := A) I M (insertion I M z) = z := by + induction z using Finsupp.induction_linear with + | zero => simp only [map_zero] + | add x y hx hy => simp only [map_add,hx,hy] + | single i m => rw [insertion_single,evaluation_single,MulOpposite.op_one,one_smul] + +theorem insertion_evaluation (z : Tensor k A M (I →₀ A)) : + insertion I M (evaluation (k := k) I M z) = z := by + induction z using BalancedTensor.induction_on with + | hz => simp only [map_zero] + | ht m n => + induction n using Finsupp.induction_linear with + | zero => simp only [map_zero] + | add x y hx hy => simp only [map_add,hx,hy] + | single i a => + rw [evaluation_single,insertion_single,balance] + congr 1 + rw [Finsupp.smul_single,smul_eq_mul,mul_one] + | ha x y hx hy => simp only [map_add,hx,hy] + +/-- Tensor with an arbitrary free left module is the direct sum of the right module. -/ +def equivalence : Tensor k A M (I →₀ A) ≃ₗ[k] (I →₀ M) where + __ := evaluation (k := k) I M + invFun := insertion I M + left_inv := insertion_evaluation I M + right_inv := evaluation_insertion I M + +variable {M} {M' M'' : Type u} +variable [AddCommGroup M'] [Module k M'] [Module Aᵐᵒᵖ M'] [IsScalarTower k Aᵐᵒᵖ M'] +variable [AddCommGroup M''] [Module k M''] [Module Aᵐᵒᵖ M''] [IsScalarTower k Aᵐᵒᵖ M''] + +theorem evaluation_naturality (f : M →ₗ[Aᵐᵒᵖ] M') (z : Tensor k A M (I →₀ A)) : + evaluation (k := k) I M' (mapLeft (I →₀ A) f z) = + Finsupp.mapRange.linearMap (f.restrictScalars k) (evaluation (k := k) I M z) := by + induction z using BalancedTensor.induction_on with + | hz => simp only [map_zero] + | ht m n => + induction n using Finsupp.induction_linear with + | zero => simp only [map_zero] + | add x y hx hy => simp only [map_add,hx,hy] + | single i a => + simp only [mapLeft_mk,evaluation_single] + ext j + change (Finsupp.single i (MulOpposite.op a • f m)) j = + (Finsupp.mapRange f f.map_zero (Finsupp.single i (MulOpposite.op a • m))) j + rw [Finsupp.mapRange_single, f.map_smul] + | ha x y hx hy => simp only [map_add,hx,hy] + +/-- Free left tensor preserves exact sequences of right modules. -/ +theorem tensor_exact (f : M →ₗ[Aᵐᵒᵖ] M') (g : M' →ₗ[Aᵐᵒᵖ] M'') + (h : Function.Exact f g) : + Function.Exact (mapLeft (k := k) (I →₀ A) f) (mapLeft (k := k) (I →₀ A) g) := by + intro z + constructor + · intro hz + have hz' : Finsupp.mapRange.linearMap (g.restrictScalars k) (evaluation (k := k) I M' z) = 0 := by + rw [← evaluation_naturality,hz,map_zero] + obtain ⟨y,hy⟩ := (Free.finsupp_exact (k := k) I f g h _).mp hz' + refine ⟨(equivalence (k := k) (A := A) I M).symm y, ?_⟩ + apply (equivalence (k := k) (A := A) I M').injective + change evaluation (k := k) I M' (mapLeft (I →₀ A) f + ((equivalence (k := k) (A := A) I M).symm y)) = _ + rw [evaluation_naturality] + change Finsupp.mapRange.linearMap (f.restrictScalars k) + ((equivalence (k := k) (A := A) I M) ((equivalence (k := k) (A := A) I M).symm y)) = _ + rw [LinearEquiv.apply_symm_apply] + exact hy + · rintro ⟨y,rfl⟩ + induction y using BalancedTensor.induction_on with + | hz => simp only [map_zero] + | ht m n => + rw [mapLeft_mk,mapLeft_mk,(h (f m)).mpr ⟨m,rfl⟩,map_zero,LinearMap.zero_apply] + | ha x y hx hy => simp only [map_add,hx,hy,add_zero] +end LittleFinitistic.BalancedTensor.FreeLeft + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Tensor/BalancedProjectiveLeft.lean b/lean/OAI/Algebra/Finitistic/Tensor/BalancedProjectiveLeft.lean new file mode 100644 index 0000000000000000000000000000000000000000..8da5a8a1d11255b5888ceb3d00345f6e2f0760ce --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Tensor/BalancedProjectiveLeft.lean @@ -0,0 +1,94 @@ +import OAI.Algebra.Finitistic.Tensor.BalancedFreeLeft +import OAI.Algebra.Finitistic.Ordinary.OrdinaryProjectiveTensor +import OAI.Algebra.Finitistic.Bimodule.BimoduleTensorFunctor + +namespace OAI +noncomputable section +open CategoryTheory +namespace LittleFinitistic.BalancedTensor +universe u +variable {k A M M' M'' N N' : Type u} [Field k] [Ring A] [Algebra k A] +variable [AddCommGroup M] [Module k M] [Module Aᵐᵒᵖ M] [IsScalarTower k Aᵐᵒᵖ M] +variable [AddCommGroup M'] [Module k M'] [Module Aᵐᵒᵖ M'] [IsScalarTower k Aᵐᵒᵖ M'] +variable [AddCommGroup M''] [Module k M''] [Module Aᵐᵒᵖ M''] [IsScalarTower k Aᵐᵒᵖ M''] +variable [AddCommGroup N] [Module k N] [Module A N] [IsScalarTower k A N] +variable [AddCommGroup N'] [Module k N'] [Module A N'] [IsScalarTower k A N'] + +omit [IsScalarTower k Aᵐᵒᵖ M] in +theorem mapRightTo_split (i : N →ₗ[A] N') (p : N' →ₗ[A] N) + (hp : p.comp i = LinearMap.id) (z : Tensor k A M N) : + mapRightTo p (mapRightTo i z) = z := by + induction z using BalancedTensor.induction_on with + | hz => simp + | ht m n => + rw [mapRightTo_mk,mapRightTo_mk] + exact congrArg (mk k A M N m) (LinearMap.congr_fun hp n) + | ha x y hx hy => simp only [map_add,hx,hy] + +theorem leftTensor_exact_of_split (i : N →ₗ[A] N') (p : N' →ₗ[A] N) + (hp : p.comp i = LinearMap.id) (f : M →ₗ[Aᵐᵒᵖ] M') (g : M' →ₗ[Aᵐᵒᵖ] M'') + (h : Function.Exact f g) + (h' : Function.Exact (mapLeft (k := k) N' f) (mapLeft (k := k) N' g)) : + Function.Exact (mapLeft (k := k) N f) (mapLeft (k := k) N g) := by + intro z + constructor + · intro hz + have hi : mapLeft N' g (mapRightTo i z) = 0 := by + rw [mapLeft_mapRightTo,hz,map_zero] + obtain ⟨y,hy⟩ := (h' _).mp hi + refine ⟨mapRightTo p y, ?_⟩ + rw [mapLeft_mapRightTo,hy,mapRightTo_split i p hp] + · rintro ⟨y,rfl⟩ + induction y using BalancedTensor.induction_on with + | hz => simp + | ht m n => rw [mapLeft_mk,mapLeft_mk,(h (f m)).mpr ⟨m,rfl⟩,map_zero,LinearMap.zero_apply] + | ha x y hx hy => simp only [map_add,hx,hy,add_zero] + +/-- Projectivity of the left input preserves every exact sequence in the right variable. -/ +theorem projectiveLeftTensor_exact [Module.Projective A N] + (f : M →ₗ[Aᵐᵒᵖ] M') (g : M' →ₗ[Aᵐᵒᵖ] M'') (h : Function.Exact f g) : + Function.Exact (mapLeft (k := k) N f) (mapLeft (k := k) N g) := by + obtain ⟨i,hi⟩ := (Module.projective_def' (R := A) (P := N)).mp inferInstance + exact leftTensor_exact_of_split i (Finsupp.linearCombination A id) hi f g h + (FreeLeft.tensor_exact (k := k) N f g h) +end LittleFinitistic.BalancedTensor + +namespace LittleFinitistic.BimoduleBalancedTensor +open ExternalTensor.Section4 +universe u +variable (k B N : Type u) [Field k] [Ring B] [Algebra k B] +variable [AddCommGroup N] [Module k N] [Module B N] [IsScalarTower k B N] +variable [Module.Projective B N] + +/-- Exactness of tensoring genuine bimodules with a projective left module, +with the result still in B-Mod. -/ +theorem projectiveInput_mapsExact + (S : ShortComplex (ModuleCat.{u} (Enveloping k B))) (hS : S.Exact) : + (S.map (functor k B N)).Exact := by + rw [ShortComplex.moduleCat_exact_iff] + have h : Function.Exact + (((forgetRight k B).map S.f).hom : Input k B S.X₁ →ₗ[Bᵐᵒᵖ] Input k B S.X₂) + (((forgetRight k B).map S.g).hom : Input k B S.X₂ →ₗ[Bᵐᵒᵖ] Input k B S.X₃) := by + intro x + constructor + · exact (ShortComplex.moduleCat_exact_iff S).mp hS x + · rintro ⟨y,rfl⟩ + exact congrArg (fun t => t.hom y) S.zero + intro z hz + exact ((BalancedTensor.projectiveLeftTensor_exact (k := k) (N := N) + (((forgetRight k B).map S.f).hom : Input k B S.X₁ →ₗ[Bᵐᵒᵖ] Input k B S.X₂) + (((forgetRight k B).map S.g).hom : Input k B S.X₂ →ₗ[Bᵐᵒᵖ] Input k B S.X₃) h) z).mp hz + +theorem projectiveInput_preservesHomology : (functor k B N).PreservesHomology := + Functor.preservesHomology_of_map_exact _ (projectiveInput_mapsExact k B N) + +/-- An actual bimodule augmentation quasi-isomorphism remains one on each projective input row. -/ +theorem projectiveInput_quasiIso {P Q : BiComplex k B} (ε : P ⟶ Q) [QuasiIso ε] : + QuasiIso (((functor k B N).mapHomologicalComplex (.up ℤ)).map ε) := by + have := projectiveInput_preservesHomology k B N + infer_instance +end LittleFinitistic.BimoduleBalancedTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Tensor/BalancedTensor.lean b/lean/OAI/Algebra/Finitistic/Tensor/BalancedTensor.lean new file mode 100644 index 0000000000000000000000000000000000000000..35eb2b29f458eeda4bc01c7bb17cbc07ad6f75ef --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Tensor/BalancedTensor.lean @@ -0,0 +1,76 @@ +import Mathlib.LinearAlgebra.TensorProduct.Basic +import Mathlib.LinearAlgebra.Quotient.Basic +import Mathlib.Algebra.Algebra.Tower + +namespace OAI +noncomputable section +open scoped TensorProduct +namespace LittleFinitistic.BalancedTensor +universe u v w w' z +variable (k : Type u) [Field k] (A : Type v) [Ring A] +variable (M : Type w) [AddCommGroup M] [Module k M] [Module Aᵐᵒᵖ M] +variable (N : Type w') [AddCommGroup N] [Module k N] [Module A N] + +/-- Balancing relations for a right A-module and a left A-module, over k. -/ +def relations : Submodule k (M ⊗[k] N) := Submodule.span k + (Set.range fun q : A × M × N => + (MulOpposite.op q.1 • q.2.1) ⊗ₜ[k] q.2.2 - q.2.1 ⊗ₜ[k] (q.1 • q.2.2)) + +/-- Tensor over the possibly noncommutative algebra A. -/ +abbrev Tensor := (M ⊗[k] N) ⧸ relations k A M N + +def mk : M →ₗ[k] N →ₗ[k] Tensor k A M N := + (TensorProduct.mk k M N).compr₂ (relations k A M N).mkQ + +variable {k A M N} + +theorem balance (a : A) (m : M) (n : N) : + mk k A M N (MulOpposite.op a • m) n = mk k A M N m (a • n) := by + apply sub_eq_zero.mp + change (relations k A M N).mkQ ((MulOpposite.op a • m) ⊗ₜ[k] n) - + (relations k A M N).mkQ (m ⊗ₜ[k] (a • n)) = 0 + rw [← map_sub] + exact (Submodule.Quotient.mk_eq_zero _).mpr + (Submodule.subset_span ⟨(a,m,n),rfl⟩) + +variable {V : Type z} [AddCommGroup V] [Module k V] + +/-- Universal property for k-bilinear maps satisfying the actual A-balancing equation. -/ +def lift (f : M →ₗ[k] N →ₗ[k] V) + (hf : ∀ (a : A) m n, f (MulOpposite.op a • m) n = f m (a • n)) : Tensor k A M N →ₗ[k] V := + (relations k A M N).liftQ (TensorProduct.lift f) (by + rw [relations, Submodule.span_le] + rintro _ ⟨⟨a,m,n⟩,rfl⟩ + change TensorProduct.lift f ((MulOpposite.op a • m) ⊗ₜ[k] n - m ⊗ₜ[k] (a • n)) = 0 + simp only [map_sub, TensorProduct.lift.tmul, hf, sub_self]) + +@[simp] theorem lift_mk (f : M →ₗ[k] N →ₗ[k] V) + (hf : ∀ (a : A) m n, f (MulOpposite.op a • m) n = f m (a • n)) (m : M) (n : N) : + lift f hf (mk k A M N m n) = f m n := rfl + +@[elab_as_elim] theorem induction_on {C : Tensor k A M N → Prop} (x : Tensor k A M N) + (hz : C 0) (ht : ∀ m n, C (mk k A M N m n)) + (ha : ∀ a b, C a → C b → C (a+b)) : C x := by + classical + by_cases zero_tensor : x = 0 + · simpa [zero_tensor] using hz + clear zero_tensor + induction x using Submodule.Quotient.induction_on with + | _ x => + induction x using TensorProduct.inductionOn with + | tmul m n => exact ht m n + | add a b h₁ h₂ => exact ha _ _ h₁ h₂ + +@[ext] theorem ext {f g : Tensor k A M N →ₗ[k] V} + (h : ∀ m n, f (mk k A M N m n) = g (mk k A M N m n)) : f = g := by + apply LinearMap.ext + intro x + induction x using induction_on with + | hz => simp + | ht m n => exact h m n + | ha a b h₁ h₂ => simp [h₁,h₂] +end LittleFinitistic.BalancedTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Tensor/BalancedTensorMaps.lean b/lean/OAI/Algebra/Finitistic/Tensor/BalancedTensorMaps.lean new file mode 100644 index 0000000000000000000000000000000000000000..11fa74532587a67dda7d3d0c04abc999a2e459fd --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Tensor/BalancedTensorMaps.lean @@ -0,0 +1,46 @@ +import OAI.Algebra.Finitistic.Tensor.BalancedTensor + +namespace OAI +noncomputable section +namespace LittleFinitistic.BalancedTensor +universe u v w w' w'' z +variable {k : Type u} [Field k] {A : Type v} [Ring A] [Algebra k A] +variable {M : Type w} [AddCommGroup M] [Module k M] [Module Aᵐᵒᵖ M] +variable {M' : Type w'} [AddCommGroup M'] [Module k M'] [Module Aᵐᵒᵖ M'] +variable {M'' : Type w''} [AddCommGroup M''] [Module k M''] [Module Aᵐᵒᵖ M''] +variable (N : Type z) [AddCommGroup N] [Module k N] [Module A N] +variable [IsScalarTower k Aᵐᵒᵖ M] [IsScalarTower k Aᵐᵒᵖ M'] + [IsScalarTower k Aᵐᵒᵖ M''] + +/-- Tensor an actual right-module homomorphism with the identity. -/ +def mapLeft (f : M →ₗ[Aᵐᵒᵖ] M') : Tensor k A M N →ₗ[k] Tensor k A M' N := + lift ((mk k A M' N).compl₁₂ (f.restrictScalars k) LinearMap.id) (by + intro a m n + change mk k A M' N (f (MulOpposite.op a • m)) n = mk k A M' N (f m) (a • n) + rw [map_smul] + exact balance a (f m) n) + +@[simp] theorem mapLeft_mk (f : M →ₗ[Aᵐᵒᵖ] M') (m : M) (n : N) : + mapLeft (k := k) N f (mk k A M N m n) = mk k A M' N (f m) n := rfl + +@[simp] theorem mapLeft_id : mapLeft (k := k) N (LinearMap.id : M →ₗ[Aᵐᵒᵖ] M) = LinearMap.id := by + apply ext + intro m n + rfl + +@[simp] theorem mapLeft_comp (f : M →ₗ[Aᵐᵒᵖ] M') (g : M' →ₗ[Aᵐᵒᵖ] M'') : + mapLeft (k := k) N (g.comp f) = (mapLeft (k := k) N g).comp (mapLeft (k := k) N f) := by + apply ext + intro m n + rfl + +@[simp] theorem mapLeft_add (f g : M →ₗ[Aᵐᵒᵖ] M') : + mapLeft (k := k) N (f+g) = mapLeft (k := k) N f + mapLeft (k := k) N g := by + apply ext + intro m n + simp +end LittleFinitistic.BalancedTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Tensor/BalancedVertexFunctor.lean b/lean/OAI/Algebra/Finitistic/Tensor/BalancedVertexFunctor.lean new file mode 100644 index 0000000000000000000000000000000000000000..495a8c535a61df0b14316d4255544fc75738f7d8 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Tensor/BalancedVertexFunctor.lean @@ -0,0 +1,86 @@ +import OAI.Algebra.Finitistic.Tensor.BalancedVertexImage + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct ModuleCat.Algebra +namespace LittleFinitistic.BalancedVertexFunctor +open ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] +variable (e : B) (he : e*e=e) +variable (N : Type u) [AddCommGroup N] [Module k N] [Module B N] + +abbrev Space (M : ModuleCat.{u} (Enveloping k B)) := + IdempotentTensor.leftSpace (k := k) e (BimoduleBalancedTensor.Tensor k B M N) + +def spaceMap {M M' : ModuleCat.{u} (Enveloping k B)} (f : M ⟶ M') : + Space k B e N M →ₗ[k] Space k B e N M' := + (((BimoduleBalancedTensor.map k B N f).restrictScalars k).comp + (Space k B e N M).subtype).codRestrict _ (by + intro x + change e • (BimoduleBalancedTensor.map k B N f x.val) = + BimoduleBalancedTensor.map k B N f x.val + rw [← (BimoduleBalancedTensor.map k B N f).map_smul,x.property]) + +/-- The actual left vertex of the balanced tensor, with its original induced maps. -/ +def functor : ModuleCat.{u} (Enveloping k B) ⥤ ModuleCat.{u} k where + obj M := ModuleCat.of k (Space k B e N M) + map f := ModuleCat.ofHom (spaceMap k B e N f) + map_id M := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + apply Subtype.ext + exact congrArg (fun f : (BimoduleBalancedTensor.functor k B N).obj M ⟶ + (BimoduleBalancedTensor.functor k B N).obj M => f.hom x.val) + ((BimoduleBalancedTensor.functor k B N).map_id M) + map_comp f g := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + apply Subtype.ext + exact congrArg (fun f => ModuleCat.Hom.hom f x.val) + ((BimoduleBalancedTensor.functor k B N).map_comp f g) + +instance additive : (functor k B e N).Additive where + map_add := by + intros M M' f g + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + apply Subtype.ext + exact congrArg (fun a : (BimoduleBalancedTensor.functor k B N).obj M ⟶ + (BimoduleBalancedTensor.functor k B N).obj M' => a.hom x.val) + ((BimoduleBalancedTensor.functor k B N).map_add (f := f) (g := g)) + +/-- Vertex extraction commutes naturally with the original balanced tensor functor. -/ +def comparison : BimoduleVertex.functor k B e ⋙ BalancedTensor.tensorFunctor k B N ≅ + functor k B e N := + NatIso.ofComponents (fun M => (BalancedVertexImage.equiv k B M e he N).toModuleIso) (by + intro M M' f + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + apply Subtype.ext + have hn : (BimoduleVertex.functor k B e).map f ≫ BalancedVertexImage.inclusion k B M' e = + BalancedVertexImage.inclusion k B M e ≫ (forgetRight k B).map f := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro y + rfl + have hF := congrArg (fun a => (BalancedTensor.tensorFunctor k B N).map a) hn + simp only [Functor.map_comp] at hF + exact congrArg (fun a => ModuleCat.Hom.hom a x) hF) + +/-- The natural comparison gives an actual chain isomorphism on every bimodule complex. -/ +def complexIso (P : BiComplex k B) : + ((BimoduleVertex.functor k B e ⋙ BalancedTensor.tensorFunctor k B N).mapHomologicalComplex (.up ℤ)).obj P ≅ + ((functor k B e N).mapHomologicalComplex (.up ℤ)).obj P := + HomologicalComplex.Hom.isoOfComponents (fun n => (comparison k B e he N).app (P.X n)) + (fun n m _ => ((comparison k B e he N).hom.naturality (P.d n m)).symm) +end LittleFinitistic.BalancedVertexFunctor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Tensor/BalancedVertexImage.lean b/lean/OAI/Algebra/Finitistic/Tensor/BalancedVertexImage.lean new file mode 100644 index 0000000000000000000000000000000000000000..57546dcbf2bcd518dd4c5055a2eaca562294e3b2 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Tensor/BalancedVertexImage.lean @@ -0,0 +1,70 @@ +import OAI.Algebra.Finitistic.Bimodule.BimoduleTensorFunctor +import OAI.Algebra.Finitistic.Localization.AdditiveSplitImage +import OAI.Algebra.Finitistic.Tensor.IdempotentTensor + +namespace OAI +noncomputable section +open CategoryTheory +open scoped TensorProduct ModuleCat.Algebra +namespace LittleFinitistic.BalancedVertexImage +open ExternalTensor.Section4 +universe u +variable (k B : Type u) [Field k] [Ring B] [Algebra k B] +variable (M : ModuleCat.{u} (Enveloping k B)) (e : B) (he : e*e=e) +variable (N : Type u) [AddCommGroup N] [Module k N] [Module B N] + +local instance originalRightModule : Module Bᵐᵒᵖ M := + Module.compHom M (BimoduleVertex.restriction k B) + +abbrev V := (BimoduleVertex.functor k B e).obj M +abbrev W := (forgetRight k B).obj M +abbrev F := BalancedTensor.tensorFunctor k B N + +def inclusion : V k B M e ⟶ W k B M := ModuleCat.ofHom + (VertexFunctor.inclusion (BimoduleVertex.restriction k B) (BimoduleVertex.vertex k B e) + (BimoduleVertex.vertex_commute k B e) M) +def projection : W k B M ⟶ V k B M e := ModuleCat.ofHom + (VertexFunctor.projection (BimoduleVertex.restriction k B) (BimoduleVertex.vertex k B e) + (BimoduleVertex.vertex_idempotent k B e he) (BimoduleVertex.vertex_commute k B e) M) + +theorem split : inclusion k B M e ≫ projection k B M e he = 𝟙 _ := + ModuleCat.hom_ext (VertexFunctor.projection_inclusion (BimoduleVertex.restriction k B) + (BimoduleVertex.vertex k B e) (BimoduleVertex.vertex_idempotent k B e he) + (BimoduleVertex.vertex_commute k B e) M) + +theorem projector : ((F k B N).map (projection k B M e he ≫ inclusion k B M e)).hom = + BimoduleBalancedTensor.action k B M N e := by + apply BalancedTensor.ext + intro m n + rfl + +/-- The image of the original vertex projector after tensoring is the actual left vertex. -/ +def fixedEquiv : + AdditiveSplitImage.fixed (F k B N) (inclusion k B M e) (projection k B M e he) ≃ₗ[k] + IdempotentTensor.leftSpace (k := k) e (BimoduleBalancedTensor.Tensor k B M N) where + toFun x := ⟨x.val,by + change BimoduleBalancedTensor.action k B M N e x.val = x.val + rw [← projector k B M e he N] + exact (AdditiveSplitImage.mem_fixed _ _ _ x.val).1 x.property⟩ + invFun x := ⟨x.val,by + exact (AdditiveSplitImage.mem_fixed (F k B N) (inclusion k B M e) + (projection k B M e he) x.val).2 + ((LinearMap.congr_fun (projector k B M e he N) x.val).trans x.property)⟩ + left_inv _ := rfl + right_inv _ := rfl + map_add' _ _ := rfl + map_smul' _ _ := rfl + +/-- Vertex extraction commutes with actual balanced tensoring, without a flatness assumption. -/ +def equiv : (F k B N).obj (V k B M e) ≃ₗ[k] + IdempotentTensor.leftSpace (k := k) e (BimoduleBalancedTensor.Tensor k B M N) := + (AdditiveSplitImage.equiv (F k B N) (inclusion k B M e) (projection k B M e he) + (split k B M e he)).trans (fixedEquiv k B M e he N) + +@[simp] theorem equiv_apply_val (x : (F k B N).obj (V k B M e)) : + (equiv k B M e he N x).val = ((F k B N).map (inclusion k B M e)).hom x := rfl +end LittleFinitistic.BalancedVertexImage + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Tensor/IdempotentTensor.lean b/lean/OAI/Algebra/Finitistic/Tensor/IdempotentTensor.lean new file mode 100644 index 0000000000000000000000000000000000000000..fc20067e9236b0fcb347a77247452d60a3307e16 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Tensor/IdempotentTensor.lean @@ -0,0 +1,81 @@ +import OAI.Algebra.Finitistic.Tensor.BalancedTensorMaps + +namespace OAI +noncomputable section +namespace LittleFinitistic.IdempotentTensor +universe u v w +variable {k : Type u} [Field k] {A : Type v} [Ring A] [Algebra k A] +variable (e : A) + +/-- The actual projective right ideal eA, presented as the fixed points of left multiplication. -/ +def rightIdeal : Submodule Aᵐᵒᵖ A where + carrier := {a | e*a=a} + zero_mem' := mul_zero e + add_mem' ha hb := by change e*(_+_)=_+_; rw [mul_add,ha,hb] + smul_mem' b a ha := by + change e*(a*b.unop)=a*b.unop + rw [← mul_assoc,ha] + +variable (N : Type w) [AddCommGroup N] [Module k N] [Module A N] + [IsScalarTower k A N] + +/-- The vertex part eN, without assuming e is central. -/ +def leftSpace : Submodule k N where + carrier := {n | e • n = n} + zero_mem' := smul_zero e + add_mem' ha hb := by change e • (_+_) = _+_; rw [smul_add,ha,hb] + smul_mem' c n hn := by change e • (c • n) = c • n; rw [smul_comm e c,hn] + +def productEval : rightIdeal e →ₗ[k] N →ₗ[k] leftSpace (k := k) e N where + toFun a := + { toFun := fun n => ⟨a.val • n, by change e • (a.val • n) = a.val • n; rw [← mul_smul,a.property]⟩ + map_add' n m := Subtype.ext (smul_add a.val n m) + map_smul' c n := Subtype.ext (smul_comm a.val c n) } + map_add' a b := by ext n; exact add_smul a.val b.val n + map_smul' c a := by ext n; exact smul_assoc c a.val n + +/-- The natural map eA tensor_A N → eN. -/ +def tensorEval : BalancedTensor.Tensor k A (rightIdeal e) N →ₗ[k] leftSpace (k := k) e N := + BalancedTensor.lift (productEval (k := k) e N) (by + intro a m n + apply Subtype.ext + exact mul_smul m.val a n) + +@[simp] theorem tensorEval_mk (m : rightIdeal e) (n : N) : + (tensorEval (k := k) e N (BalancedTensor.mk k A (rightIdeal e) N m n)).val = m.val • n := rfl + +variable (he : e*e=e) + +def tensorInv : leftSpace (k := k) e N →ₗ[k] BalancedTensor.Tensor k A (rightIdeal e) N := + (BalancedTensor.mk k A (rightIdeal e) N ⟨e,he⟩).comp (leftSpace (k := k) e N).subtype + +@[simp] theorem tensorEval_tensorInv (n : leftSpace (k := k) e N) : + tensorEval (k := k) e N (tensorInv (k := k) e N he n) = n := by + apply Subtype.ext + exact n.property + +@[simp] theorem tensorInv_tensorEval (z : BalancedTensor.Tensor k A (rightIdeal e) N) : + tensorInv (k := k) e N he (tensorEval (k := k) e N z) = z := by + induction z using BalancedTensor.induction_on with + | hz => simp + | ht m n => + change BalancedTensor.mk k A (rightIdeal e) N ⟨e,he⟩ (m.val • n) = + BalancedTensor.mk k A (rightIdeal e) N m n + rw [← BalancedTensor.balance] + have hm : MulOpposite.op m.val • (⟨e,he⟩ : rightIdeal e) = m := by + apply Subtype.ext + exact m.property + rw [hm] + | ha a b h₁ h₂ => simp [h₁,h₂] + +/-- Evaluation on a vertex projective is its actual vertex space. -/ +def tensorEquiv : BalancedTensor.Tensor k A (rightIdeal e) N ≃ₗ[k] leftSpace (k := k) e N where + __ := tensorEval (k := k) e N + invFun := tensorInv (k := k) e N he + left_inv := tensorInv_tensorEval (k := k) e N he + right_inv := tensorEval_tensorInv (k := k) e N he +end LittleFinitistic.IdempotentTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/Finitistic/Tensor/IdempotentTensorMaps.lean b/lean/OAI/Algebra/Finitistic/Tensor/IdempotentTensorMaps.lean new file mode 100644 index 0000000000000000000000000000000000000000..96e8b64804eede87d7f0ead8e1b9de875aea25a8 --- /dev/null +++ b/lean/OAI/Algebra/Finitistic/Tensor/IdempotentTensorMaps.lean @@ -0,0 +1,38 @@ +import OAI.Algebra.Finitistic.Tensor.IdempotentTensor +import Mathlib.Algebra.Module.Projective + +namespace OAI +noncomputable section +namespace LittleFinitistic.IdempotentTensor +universe u v w +variable {A : Type v} [Ring A] {e e' : A} + +/-- An element of e'Ae acts by left multiplication on the right projectives. -/ +def leftMultiply (b : A) (hb : e'*b=b) : rightIdeal e →ₗ[Aᵐᵒᵖ] rightIdeal e' where + toFun m := ⟨b*m.val, by change e'*(b*m.val)=b*m.val; rw [← mul_assoc,hb]⟩ + map_add' m n := Subtype.ext (mul_add b m.val n.val) + map_smul' a m := by apply Subtype.ext; exact (mul_assoc b m.val a.unop).symm + +@[simp] theorem leftMultiply_apply (b : A) (hb : e'*b=b) (m : rightIdeal e) : + (leftMultiply b hb m).val = b*m.val := rfl + +/-- eA is a retract of the rank-one free right A-module. -/ +def splitProjection (he : e*e=e) : Aᵐᵒᵖ →ₗ[Aᵐᵒᵖ] rightIdeal e where + toFun a := ⟨e*a.unop, by change e*(e*a.unop)=e*a.unop; rw [← mul_assoc,he]⟩ + map_add' a b := Subtype.ext (mul_add e a.unop b.unop) + map_smul' a b := by apply Subtype.ext; exact (mul_assoc e b.unop a.unop).symm + +def splitInclusion : rightIdeal e →ₗ[Aᵐᵒᵖ] Aᵐᵒᵖ where + toFun a := MulOpposite.op a.val + map_add' _ _ := rfl + map_smul' _ _ := rfl + +theorem rightIdeal_projective (he : e*e=e) : Module.Projective Aᵐᵒᵖ (rightIdeal e) := by + apply Module.Projective.of_split splitInclusion (splitProjection he) + ext a + exact a.property +end LittleFinitistic.IdempotentTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Asymmetry.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Asymmetry.lean new file mode 100644 index 0000000000000000000000000000000000000000..15150c9ffe03434392759653137689b520ae0cdb --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Asymmetry.lean @@ -0,0 +1,52 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Transport.InjectiveGeneration +import OAI.Algebra.FinitisticAsymmetry.Triangular.Generation +import OAI.Algebra.FinitisticAsymmetry.Rickard.NonGeneration + +namespace OAI + +section +noncomputable section +open CategoryTheory +namespace LittleFinitistic.AsymmetryConstruction +universe u +variable {k A ι : Type u} [Field k] [Ring A] [Algebra k A] + [FiniteDimensional k A] [Nontrivial A] [Fintype ι] +variable (χ : Aᵐᵒᵖ →ₐ[k] (ι → k)) +abbrev Lambda := (CummingsConstruction.T χ)ᵐᵒᵖ + +lemma all_clauses + (hχ : Function.Surjective χ) + (hnil : ∃ n : ℕ, (RingHom.ker χ.toRingHom)^n = ⊥) + (hA : littleFinitisticDimension A = ⊤) : + FiniteDimensional k (Lambda χ) ∧ + littleFinitisticDimension (Lambda χ) = ⊤ ∧ + bigFinitisticDimension (Lambda χ) = ⊤ ∧ + littleFinitisticDimension (Lambda χ)ᵐᵒᵖ = 0 ∧ + bigFinitisticDimension (Lambda χ)ᵐᵒᵖ = 0 ∧ + ¬ InjectivesGenerate (Lambda χ) ∧ InjectivesGenerate (Lambda χ)ᵐᵒᵖ := by + classical + let eA := ModuleCat.restrictScalarsEquivalenceOfRingEquiv (RingEquiv.opOp A) + have hinf : littleFinitisticDimension (Lambda χ) = ⊤ := by + apply top_unique + rw [← hA, ← littleFinitisticDimension_equivalence eA] + exact TriangularConstruction.right_little_lower_bound _ _ _ + have hbig : bigFinitisticDimension (Lambda χ) = ⊤ := + top_unique (hinf ▸ littleFinitisticDimension_le_big (Lambda χ)) + let eT := ModuleCat.restrictScalarsEquivalenceOfRingEquiv + (RingEquiv.opOp (CummingsConstruction.T χ)) + obtain ⟨hlz, hbz⟩ := CummingsConstruction.left_dimensions_zero χ hχ hnil + have hlz' : littleFinitisticDimension (Lambda χ)ᵐᵒᵖ = 0 := + (littleFinitisticDimension_equivalence eT).trans hlz + have hbz' : bigFinitisticDimension (Lambda χ)ᵐᵒᵖ = 0 := + (bigFinitisticDimension_equivalence eT).trans hbz + refine ⟨inferInstance, hinf, hbig, hlz', hbz', ?_, ?_⟩ + · exact Rickard.not_injectivesGenerate_of_little_eq_top k hinf + · exact (injectivesGenerate_equivalence eT).mpr + (CummingsConstruction.injectivesGenerate χ hχ hnil) +end LittleFinitistic.AsymmetryConstruction + +end +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Augmentation/Directed.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Augmentation/Directed.lean new file mode 100644 index 0000000000000000000000000000000000000000..792ae1c81c4d3cc0df9713440b4b1eca69ff51c5 --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Augmentation/Directed.lean @@ -0,0 +1,135 @@ +import Mathlib +import OAI.Algebra.Finitistic.Encoding.DirectedBound +import OAI.Algebra.FinitisticAsymmetry.Model + +namespace OAI + +section +noncomputable section +open scoped BigOperators +namespace LittleFinitistic.DirectedBound +universe u + +namespace DirectedSystem +variable {k A : Type u} [Field k] [Ring A] [Algebra k A] {n : ℕ} +variable (D : DirectedSystem k A n) +abbrev Vertices := {i : Fin n // D.e i ≠ 0} +def coefficient (a : A) (i : D.Vertices) : k := (D.diagonal i a).choose +lemma coefficient_spec (a : A) (i : D.Vertices) : + D.e i * a * D.e i = D.coefficient a i • D.e i := (D.diagonal i a).choose_spec +lemma coefficient_eq_iff (a : A) (i : D.Vertices) (c : k) : + D.coefficient a i = c ↔ D.e i * a * D.e i = c • D.e i := by + rw [D.coefficient_spec] + exact (smul_left_injective k i.property).eq_iff.symm + +lemma corner_mul (a b : A) (i j : Fin n) : + D.e i * (a * b) * D.e j = ∑ l, (D.e i * a * D.e l) * (D.e l * b * D.e j) := by + conv_rhs => arg 2; ext l; rw [mul_assoc, ← mul_assoc (D.e l), ← mul_assoc (D.e l), D.idem] + simp only [← mul_assoc] + rw [← Finset.sum_mul, ← Finset.sum_mul, ← Finset.mul_sum, D.complete] + simp [mul_assoc] + +lemma diagonal_mul (a b : A) (i : Fin n) : + D.e i * (a * b) * D.e i = (D.e i * a * D.e i) * (D.e i * b * D.e i) := by + rw [D.corner_mul, Finset.sum_eq_single i] + · intro j _ hji + rcases lt_or_gt_of_ne hji with hji | hij + · rw [D.directed i j hji b, mul_zero] + · rw [D.directed j i hij a, zero_mul] + · simp + +def augmentation : A →ₐ[k] (D.Vertices → k) where + toFun := D.coefficient + map_zero' := by ext i; apply (D.coefficient_eq_iff _ _ _).mpr; simp + map_one' := by ext i; apply (D.coefficient_eq_iff _ _ _).mpr; simp [D.idem] + map_add' a b := by + ext i + apply (D.coefficient_eq_iff _ _ _).mpr + simp [mul_add, add_mul, D.coefficient_spec, add_smul] + map_mul' a b := by + ext i + apply (D.coefficient_eq_iff _ _ _).mpr + rw [D.diagonal_mul, D.coefficient_spec, D.coefficient_spec, smul_mul_smul_comm, D.idem] + rfl + commutes' c := by + ext i + apply (D.coefficient_eq_iff _ _ _).mpr + rw [← (Algebra.commutes c (D.e i)), ← Algebra.smul_def, smul_mul_assoc, D.idem] + rfl + +lemma coefficient_vertex (i j : D.Vertices) : + D.coefficient (D.e i) j = if j = i then 1 else 0 := by + classical + apply (D.coefficient_eq_iff _ _ _).mpr + split_ifs with h + · subst j; simp [D.idem] + · rw [D.orthogonal j i (fun hji => h (Subtype.ext hji))] + simp + +lemma augmentation_surjective : Function.Surjective D.augmentation := by + classical + intro s + refine ⟨∑ i : D.Vertices, s i • D.e i, ?_⟩ + ext j + simp [map_sum, map_smul, augmentation, coefficient_vertex] + +lemma mem_augmentation_ker_iff (a : A) : + a ∈ RingHom.ker D.augmentation.toRingHom ↔ ∀ i : Fin n, D.e i * a * D.e i = 0 := by + constructor + · intro ha i + by_cases hi : D.e i = 0 + · simp [hi] + · rw [D.coefficient_spec a ⟨i, hi⟩] + have := congrFun ha ⟨i, hi⟩ + change D.coefficient a ⟨i, hi⟩ = 0 at this + rw [this, zero_smul] + · intro ha + change D.augmentation a = 0 + ext i + apply (D.coefficient_eq_iff _ _ _).mpr + simpa using ha i + +lemma ker_corner_vanish {a : A} (ha : a ∈ RingHom.ker D.augmentation.toRingHom) + (i j : Fin n) (hij : i.val < j.val + 1) : D.e i * a * D.e j = 0 := by + by_cases h : i = j + · subst j; exact (D.mem_augmentation_ker_iff a).mp ha i + · exact D.directed j i (by have hne : i.val ≠ j.val := fun hval => h (Fin.ext hval); omega) a + +lemma pow_ker_corner_vanish (m : ℕ) {a : A} + (ha : a ∈ (RingHom.ker D.augmentation.toRingHom) ^ m) + (i j : Fin n) (hij : i.val < j.val + m) : D.e i * a * D.e j = 0 := by + induction m generalizing a i j with + | zero => exact D.directed j i (by simpa using hij) a + | succ m ih => + rw [Submodule.pow_succ] at ha + refine Submodule.mul_induction_on ha ?_ ?_ + · intro x hx y hy + rw [D.corner_mul] + apply Finset.sum_eq_zero + intro l _ + by_cases hil : i.val < l.val + m + · rw [ih hx i l hil, zero_mul] + · rw [D.ker_corner_vanish hy l j (by omega), mul_zero] + · intro x y hx hy + simp [mul_add, add_mul, hx, hy] + +lemma augmentation_ker_nilpotent : + ∃ m : ℕ, (RingHom.ker D.augmentation.toRingHom) ^ m = ⊥ := by + refine ⟨n, le_bot_iff.mp ?_⟩ + intro a ha + change a = 0 + have he : (∑ i, D.e i) * a * (∑ j, D.e j) = 0 := by + simp only [Finset.sum_mul, Finset.mul_sum] + apply Finset.sum_eq_zero + intro j _ + apply Finset.sum_eq_zero + intro i _ + exact D.pow_ker_corner_vanish n ha i j (by omega) + simpa [D.complete] using he +end DirectedSystem +end LittleFinitistic.DirectedBound + +end +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Augmentation/SplitBasic.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Augmentation/SplitBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..fa04e1f657c522d82c1fe1a473c1a5733949917e --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Augmentation/SplitBasic.lean @@ -0,0 +1,138 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Model + +namespace OAI + +section +noncomputable section +open scoped BigOperators +namespace LittleFinitistic.SplitBasic +universe v +variable {k : Type v} [Field k] +lemma pow_le_comap_pow {R S : Type*} [Ring R] [Ring S] (f : R →+* S) + (I : Ideal R) (J : Ideal S) (h : I ≤ J.comap f) (n : ℕ) : I ^ n ≤ (J ^ n).comap f := by + induction n with + | zero => simp [Submodule.pow_zero, Ideal.one_eq_top] + | succ n ih => + rw [Submodule.pow_succ, Submodule.pow_succ] + apply Ideal.mul_le.mpr + intro x hx y hy + change f (x * y) ∈ J ^ n * J + rw [map_mul] + exact Ideal.mul_mem_mul (ih hx) (h hy) + +section SquareZero +variable {R M : Type v} [Ring R] [Algebra k R] [AddCommGroup M] + [Module R M] [Module Rᵐᵒᵖ M] [SMulCommClass R Rᵐᵒᵖ M] + [Module k M] [IsScalarTower k R M] [IsScalarTower k Rᵐᵒᵖ M] +variable {ι : Type v} (χ : R →ₐ[k] (ι → k)) +def squareZeroAugmentation : TrivSqZeroExt R M →ₐ[k] (ι → k) := + χ.comp (TrivSqZeroExt.fstHom k R M) +lemma squareZero_surjective (hχ : Function.Surjective χ) : + Function.Surjective (squareZeroAugmentation (M := M) χ) := by + intro s + obtain ⟨r, hr⟩ := hχ s + exact ⟨TrivSqZeroExt.inl r, hr⟩ +lemma squareZero_ker_nilpotent (hJ : ∃ n : ℕ, (RingHom.ker χ.toRingHom) ^ n = ⊥) : + ∃ n : ℕ, (RingHom.ker (squareZeroAugmentation (M := M) χ).toRingHom) ^ n = ⊥ := by + obtain ⟨n, hn⟩ := hJ + let f := (TrivSqZeroExt.fstHom k R M).toRingHom + let K := RingHom.ker (squareZeroAugmentation (M := M) χ).toRingHom + let J := RingHom.ker χ.toRingHom + let L := RingHom.ker f + have h : K ^ n ≤ L := by + have hp := pow_le_comap_pow f K J (by intro x hx; exact hx) n + rw [hn] at hp + exact hp + have hL : L * L = ⊥ := by + apply le_bot_iff.mp + apply Ideal.mul_le.mpr + intro x hx y hy + change x.fst = 0 at hx + change y.fst = 0 at hy + change x * y = 0 + apply TrivSqZeroExt.ext <;> simp [TrivSqZeroExt.fst_mul, TrivSqZeroExt.snd_mul, hx, hy] + refine ⟨n + n, le_bot_iff.mp ?_⟩ + rw [Ideal.IsTwoSided.pow_add] + exact (Ideal.mul_mono h h).trans hL.le +end SquareZero + +section Product +variable {R S ι κ : Type v} [Ring R] [Ring S] [Algebra k R] [Algebra k S] +variable (χ : R →ₐ[k] (ι → k)) (ψ : S →ₐ[k] (κ → k)) +def productAugmentation : R × S →ₐ[k] (Sum ι κ → k) where + toFun x := Sum.elim (χ x.1) (ψ x.2) + map_one' := by ext i; cases i <;> simp + map_zero' := by ext i; cases i <;> simp + map_add' x y := by ext i; cases i <;> simp + map_mul' x y := by ext i; cases i <;> simp + commutes' r := by ext i; cases i <;> simp +lemma product_surjective (hχ : Function.Surjective χ) (hψ : Function.Surjective ψ) : + Function.Surjective (productAugmentation χ ψ) := by + intro s + obtain ⟨r, hr⟩ := hχ (s ∘ Sum.inl) + obtain ⟨t, ht⟩ := hψ (s ∘ Sum.inr) + refine ⟨(r,t), ?_⟩ + ext i + cases i <;> simp [productAugmentation, hr, ht] +lemma product_ker_nilpotent + (hχ : ∃ n : ℕ, (RingHom.ker χ.toRingHom) ^ n = ⊥) + (hψ : ∃ n : ℕ, (RingHom.ker ψ.toRingHom) ^ n = ⊥) : + ∃ n : ℕ, (RingHom.ker (productAugmentation χ ψ).toRingHom) ^ n = ⊥ := by + obtain ⟨m, hm⟩ := hχ + obtain ⟨n, hn⟩ := hψ + let K := RingHom.ker (productAugmentation χ ψ).toRingHom + have h₁ := pow_le_comap_pow (RingHom.fst R S) K (RingHom.ker χ.toRingHom) + (by intro x hx; exact funext (fun i => congrFun hx (Sum.inl i))) m + have h₂ := pow_le_comap_pow (RingHom.snd R S) K (RingHom.ker ψ.toRingHom) + (by intro x hx; exact funext (fun i => congrFun hx (Sum.inr i))) n + rw [hm] at h₁ + rw [hn] at h₂ + refine ⟨m + n, le_bot_iff.mp ?_⟩ + intro x hx + exact Prod.ext (h₁ (Ideal.pow_le_pow_right (by omega) hx)) + (h₂ (Ideal.pow_le_pow_right (by omega) hx)) +end Product + +section Opposite +variable {R ι : Type v} [Ring R] [Algebra k R] (χ : R →ₐ[k] (ι → k)) +def oppositeAugmentation : Rᵐᵒᵖ →ₐ[k] (ι → k) where + toFun x := χ x.unop + map_one' := χ.map_one + map_zero' := χ.map_zero + map_add' x y := χ.map_add _ _ + map_mul' x y := by simp [map_mul, mul_comm] + commutes' r := χ.commutes r +lemma opposite_surjective (hχ : Function.Surjective χ) : + Function.Surjective (oppositeAugmentation χ) := by + intro s + obtain ⟨r, hr⟩ := hχ s + exact ⟨MulOpposite.op r, hr⟩ +lemma unop_mem_pow_ker (n : ℕ) {x : Rᵐᵒᵖ} + (hx : x ∈ (RingHom.ker (oppositeAugmentation χ).toRingHom) ^ n) : + x.unop ∈ (RingHom.ker χ.toRingHom) ^ n := by + induction n generalizing x with + | zero => simp [Submodule.pow_zero, Ideal.one_eq_top] + | succ n ih => + rw [Submodule.pow_succ] at hx + rw [Ideal.IsTwoSided.pow_succ] + refine Submodule.mul_induction_on hx ?_ ?_ + · intro y hy z hz + exact Ideal.mul_mem_mul hz (ih hy) + · intro y z hy hz + exact add_mem hy hz +lemma opposite_ker_nilpotent (hχ : ∃ n : ℕ, (RingHom.ker χ.toRingHom) ^ n = ⊥) : + ∃ n : ℕ, (RingHom.ker (oppositeAugmentation χ).toRingHom) ^ n = ⊥ := by + obtain ⟨n, hn⟩ := hχ + refine ⟨n, le_bot_iff.mp ?_⟩ + intro x hx + have h := unop_mem_pow_ker χ n hx + rw [hn] at h + exact MulOpposite.unop_injective h +end Opposite +end LittleFinitistic.SplitBasic + +end +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Derived/BoundedGeneration.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Derived/BoundedGeneration.lean new file mode 100644 index 0000000000000000000000000000000000000000..7a7115fbf63b552aa0e092ef6372c11ec830c8e0 --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Derived/BoundedGeneration.lean @@ -0,0 +1,138 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Derived.Telescopes +import OAI.Algebra.FinitisticAsymmetry.Derived.Truncations + +namespace OAI + +noncomputable section + +open CategoryTheory CategoryTheory.Limits +open HomologicalComplex + +open CategoryTheory CategoryTheory.Limits HomologicalComplex +namespace LittleFinitistic.DerivedSupport + +section +universe v w +variable {C : Type v} [Category.{w} C] + +def eventuallyIsoCoconeIsColimit {F : ℕ ⥤ C} (c : Cocone F) (N : ℕ) + (h : ∀ n, N ≤ n → IsIso (c.ι.app n)) : IsColimit c := by + have := h N le_rfl + refine { desc := fun s => inv (c.ι.app N) ≫ s.ι.app N, fac := ?_, uniq := ?_ } + · intro s n + let m := max n N + have hm : N ≤ m := le_max_right _ _ + have := h m hm + have he : inv (c.ι.app N) ≫ s.ι.app N = inv (c.ι.app m) ≫ s.ι.app m := by + apply (cancel_epi (c.ι.app N)).1 + rw [IsIso.hom_inv_id_assoc, ← c.w (homOfLE hm)] + simp only [Category.assoc, IsIso.hom_inv_id_assoc, s.w] + rw [he, ← c.w (homOfLE (le_max_left n N))] + simp only [m, Category.assoc, IsIso.hom_inv_id_assoc, s.w] + · intro s m hm + apply (cancel_epi (c.ι.app N)).1 + rw [IsIso.hom_inv_id_assoc, hm] + +end + +section +universe u +variable {R : Type u} [Ring R] +variable (K : CochainComplex (ModuleCat.{u} R) ℤ) + +def cutSequenceMap (n : ℕ) : cut K (-(n : ℤ)) ⟶ cut K (-(n+1 : ℤ)) := + cutMap K (by omega) + +def cutSequenceCocone : Cocone (Functor.ofSequence (cutSequenceMap K)) where + pt := K + ι := NatTrans.ofSequence (fun n => cutι K (-(n : ℤ))) (fun n => by + simp [cutSequenceMap] + exact (cutMap_ι K _).trans (Category.comp_id _).symm) + +def cutSequenceIsColimit : IsColimit (cutSequenceCocone K) := by + apply HomologicalComplex.isColimitOfEval + intro j + apply eventuallyIsoCoconeIsColimit _ (-j).toNat + intro n hn + change IsIso ((cutι K (-(n : ℤ))).f j) + exact cutι_f_isIso K _ _ (by omega) + +end + +section +universe u w +variable {R : Type u} [Ring R] +variable (K : CochainComplex (ModuleCat.{u} R) ℤ) (b : ℤ) + (hK : ∀ j, b < j → IsZero (K.X j)) + +include hK in +lemma cut_isZero_of_upperBound (a : ℤ) (ha : b < a) : IsZero (cut K a) := by + rw [IsZero.iff_id_eq_zero] + apply HomologicalComplex.Hom.ext + funext j + have hz : IsZero ((cut K a).X j) := by + by_cases h : a ≤ j + · have := cutι_f_isIso K a j h + exact (hK j (lt_of_lt_of_le ha h)).of_iso (asIso ((cutι K a).f j)) + · exact cut_isZero_X K a j (by omega) + exact hz.eq_of_src _ _ + +variable [HasDerivedCategory.{w} (ModuleCat.{u} R)] + +include b hK in +lemma prop_cut_of_terms (P : ObjectProperty (DerivedCategory (ModuleCat.{u} R))) + [P.IsTriangulated] [P.IsClosedUnderIsomorphisms] + (hterms : ∀ j, P (DerivedCategory.Q.obj + ((HomologicalComplex.single (ModuleCat R) (ComplexShape.up ℤ) j).obj (K.X j)))) + (a : ℤ) : P (DerivedCategory.Q.obj (cut K a)) := by + have step (a : ℤ) (ha : P (DerivedCategory.Q.obj (cut K (a+1)))) : + P (DerivedCategory.Q.obj (cut K a)) := + P.ext_of_isTriangulatedClosed₂ _ + (DerivedCategory.triangleOfSES_distinguished (cut_shortExact K a)) ha (hterms a) + have h (n : ℕ) : P (DerivedCategory.Q.obj (cut K (b+1-(n : ℤ)))) := by + induction n with + | zero => + exact P.prop_of_isZero (DerivedCategory.Q.map_isZero + (cut_isZero_of_upperBound K b hK _ (by omega))) + | succ n ih => + apply step + convert ih using 1 + congr 2 + omega + by_cases ha : a ≤ b+1 + · have he : b+1-((b+1-a).toNat : ℤ) = a := by omega + simpa only [he] using h ((b+1-a).toNat) + · exact P.prop_of_isZero (DerivedCategory.Q.map_isZero + (cut_isZero_of_upperBound K b hK a (by omega))) + +end + +universe u w +variable {R : Type u} [Ring R] [HasDerivedCategory.{w} (ModuleCat.{u} R)] +variable (P : ObjectProperty (DerivedCategory (ModuleCat.{u} R))) + [P.IsTriangulated] [P.IsClosedUnderIsomorphisms] + [P.IsClosedUnderColimitsOfShape (Discrete ℕ)] + +omit [P.IsClosedUnderColimitsOfShape (Discrete ℕ)] in +lemma prop_single_of_zero (M : ModuleCat R) + (hM : P ((DerivedCategory.singleFunctor (ModuleCat R) 0).obj M)) (j : ℤ) : + P (DerivedCategory.Q.obj + ((HomologicalComplex.single (ModuleCat R) (ComplexShape.up ℤ) j).obj M)) := by + apply P.prop_of_iso ((DerivedCategory.singleFunctorIsoCompQ (ModuleCat R) j).app M) + apply P.prop_of_iso (((DerivedCategory.singleFunctors (ModuleCat R)).shiftIso (-j) j 0 (by omega)).app M) + exact P.le_shift (-j) _ hM + +lemma prop_of_boundedAbove_terms (K : CochainComplex (ModuleCat R) ℤ) + (b : ℤ) (hb : ∀ j, b < j → IsZero (K.X j)) + (hterms : ∀ j, P ((DerivedCategory.singleFunctor (ModuleCat R) 0).obj (K.X j))) : + P (DerivedCategory.Q.obj K) := by + exact localizing_sequence_colimit (fun n => cut K (-(n : ℤ))) (cutSequenceMap K) + (cutSequenceCocone K) (cutSequenceIsColimit K) P + (fun n => prop_cut_of_terms K b hb P (fun j => prop_single_of_zero P _ (hterms j) j) _) + +end LittleFinitistic.DerivedSupport + +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Derived/ComplexSums.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Derived/ComplexSums.lean new file mode 100644 index 0000000000000000000000000000000000000000..4c4b48b8aac943d592b4ff291edb28a98c865bf6 --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Derived/ComplexSums.lean @@ -0,0 +1,110 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Derived.Coproducts + +namespace OAI + +noncomputable section + +open CategoryTheory CategoryTheory.Limits +open HomologicalComplex +namespace LittleFinitistic.DerivedSupport +universe u v w t +variable {C : Type u} [Category.{v} C] [Abelian C] +variable {ι : Type t} {c : ComplexShape ι} {I : Type w} +variable [HasColimitsOfShape (Discrete I) C] + +def bundleComplex (K : I → HomologicalComplex C c) : + HomologicalComplex (Discrete I ⥤ C) c where + X j := Discrete.functor (fun i => (K i).X j) + d j l := Discrete.natTrans (fun i => (K i.as).d j l) + shape j l hjl := by ext i; exact (K i.as).shape _ _ hjl + d_comp_d' i j l _ _ := by ext a; exact (K a.as).d_comp_d i j l + +def bundleComplexMap {K L : I → HomologicalComplex C c} (f : ∀ i, K i ⟶ L i) : + bundleComplex K ⟶ bundleComplex L where + f j := Discrete.natTrans (fun i => (f i.as).f j) + comm' j l _ := by ext i; exact (f i.as).comm _ _ + +def sumComplex (K : I → HomologicalComplex C c) : HomologicalComplex C c := + (colim.mapHomologicalComplex c).obj (bundleComplex K) + +def sumComplexMap {K L : I → HomologicalComplex C c} (f : ∀ i, K i ⟶ L i) : + sumComplex K ⟶ sumComplex L := (colim.mapHomologicalComplex c).map (bundleComplexMap f) + +def sumComplexInj (K : I → HomologicalComplex C c) (i : I) : K i ⟶ sumComplex K where + f j := Sigma.ι (fun i => (K i).X j) i + comm' j l _ := by + exact colimit.ι_map ((bundleComplex K).d j l) (Discrete.mk i) + +@[reassoc] lemma sumComplexInj_map {K L : I → HomologicalComplex C c} + (f : ∀ i, K i ⟶ L i) (i : I) : + sumComplexInj K i ≫ sumComplexMap f = f i ≫ sumComplexInj L i := by + ext j + exact colimit.ι_map ((bundleComplexMap f).f j) (Discrete.mk i) + +def sumComplexCofan (K : I → HomologicalComplex C c) : Cofan K := + Cofan.mk (sumComplex K) (sumComplexInj K) + +def sumComplexIsColimit (K : I → HomologicalComplex C c) : IsColimit (sumComplexCofan K) := + HomologicalComplex.isColimitOfEval _ _ (fun j => + (Cofan.isColimitMapCoconeEquiv (eval C c j) K (sumComplexCofan K)).symm + (colimit.isColimit (Discrete.functor (fun i => (K i).X j)))) + +lemma sumComplexMap_quasiIso [HasExactColimitsOfShape (Discrete I) C] + {K L : I → HomologicalComplex C c} (f : ∀ i, K i ⟶ L i) [∀ i, QuasiIso (f i)] : + QuasiIso (sumComplexMap f) := by + have : QuasiIso (bundleComplexMap f) := by + rw [HomologicalComplex.quasiIso_iff_evaluation] + intro i + change QuasiIso (f i.as) + infer_instance + exact inferInstanceAs (QuasiIso ((colim.mapHomologicalComplex c).map (bundleComplexMap f))) + +def homotopySumCofan (X : I → HomotopyCategory C c) : Cofan X := + Cofan.mk ((HomotopyCategory.quotient C c).obj (sumComplex (fun i => (X i).as))) + (fun i => (HomotopyCategory.quotient C c).map (sumComplexInj (fun j => (X j).as) i)) + +def homotopySumIsColimit (X : I → HomotopyCategory C c) : + IsColimit (homotopySumCofan X) := + quotientCofanIsColimit _ (sumComplexIsColimit (fun i => (X i).as)) + +instance homotopyHasCoproducts : HasColimitsOfShape (Discrete I) (HomotopyCategory C c) where + has_colimit F := by + let X (i : I) := F.obj ⟨i⟩ + let : HasColimit (Discrete.functor X) := ⟨_, homotopySumIsColimit X⟩ + exact hasColimit_of_iso (F := Discrete.functor X) + (Discrete.natIso (fun i => Iso.refl (F.obj i))) + +instance homotopyQuasiIsoCoproducts [HasExactColimitsOfShape (Discrete I) C] : + (HomotopyCategory.quasiIso C c).IsStableUnderCoproductsOfShape I := by + apply MorphismProperty.IsStableUnderCoproductsOfShape.mk + intro X Y _ _ f hf + let Q := HomotopyCategory.quotient C c + let a := (colimit.isColimit (Discrete.functor X)).coconePointUniqueUpToIso (homotopySumIsColimit X) + let b := (colimit.isColimit (Discrete.functor Y)).coconePointUniqueUpToIso (homotopySumIsColimit Y) + have hq (i : I) : QuasiIso (f i).out := by + rw [← HomologicalComplex.mem_quasiIso_iff, ← HomotopyCategory.quotient_map_mem_quasiIso_iff, + HomotopyCategory.quotient_map_out] + exact hf i + have h : HomotopyCategory.quasiIso C c (Q.map (sumComplexMap (fun i => (f i).out))) := by + rw [HomotopyCategory.quotient_map_mem_quasiIso_iff] + exact sumComplexMap_quasiIso _ + refine ((HomotopyCategory.quasiIso C c).arrow_mk_iso_iff ?_).2 h + refine Arrow.isoMk a b ?_ + apply Sigma.hom_ext + intro i + have ha : Sigma.ι X i ≫ a.hom = Q.map (sumComplexInj (fun j => (X j).as) i) := + IsColimit.comp_coconePointUniqueUpToIso_hom _ _ (Discrete.mk i) + have hb : Sigma.ι Y i ≫ b.hom = Q.map (sumComplexInj (fun j => (Y j).as) i) := + IsColimit.comp_coconePointUniqueUpToIso_hom _ _ (Discrete.mk i) + change Sigma.ι X i ≫ a.hom ≫ Q.map (sumComplexMap (fun i => (f i).out)) = + Sigma.ι X i ≫ Limits.Sigma.map f ≫ b.hom + erw [Sigma.ι_map_assoc, hb, ← Category.assoc, ha, ← Q.map_comp, sumComplexInj_map, + Q.map_comp, HomotopyCategory.quotient_map_out] + rfl + +end LittleFinitistic.DerivedSupport + +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Derived/Coproducts.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Derived/Coproducts.lean new file mode 100644 index 0000000000000000000000000000000000000000..438308c2d8bc96345e53ff33af46a80029be3ac6 --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Derived/Coproducts.lean @@ -0,0 +1,183 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Model + +namespace OAI + +noncomputable section + +open CategoryTheory CategoryTheory.Limits +open HomologicalComplex +namespace LittleFinitistic.DerivedSupport + +section +universe u v w t +variable {C : Type u} [Category.{v} C] [Preadditive C] +variable {ι : Type t} {c : ComplexShape ι} {I : Type w} +variable {K : I → HomologicalComplex C c} + +def cofanEvalIsColimit (s : Cofan K) (hs : IsColimit s) + [HasColimitsOfShape (Discrete I) C] (j : ι) : + IsColimit (Cofan.mk (s.pt.X j) (fun i => (s.inj i).f j)) := + (Cofan.isColimitMapCoconeEquiv (eval C c j) K s) + (isColimitOfPreserves (eval C c j) hs) + +def homotopyCofanDesc (s : Cofan K) (hs : IsColimit s) + [HasColimitsOfShape (Discrete I) C] {Y : HomologicalComplex C c} + (f g : s.pt ⟶ Y) (h : ∀ i, Homotopy (s.inj i ≫ f) (s.inj i ≫ g)) : Homotopy f g where + hom j l := (cofanEvalIsColimit s hs j).desc (Cofan.mk _ fun i => (h i).hom j l) + zero j l hrel := by + apply (cofanEvalIsColimit s hs j).hom_ext + intro i + simp only [comp_zero] + change (s.inj i.as).f j ≫ _ = 0 + rw [show (s.inj i.as).f j ≫ (cofanEvalIsColimit s hs j).desc + (Cofan.mk _ fun i => (h i).hom j l) = (h i.as).hom j l from + (cofanEvalIsColimit s hs j).fac _ i] + exact (h i.as).zero j l hrel + comm j := by + apply (cofanEvalIsColimit s hs j).hom_ext + intro i + have hh := (h i.as).comm j + dsimp only [HomologicalComplex.comp_f] at hh + have fac (a b : ι) : (s.inj i.as).f a ≫ + (cofanEvalIsColimit s hs a).desc (Cofan.mk _ fun i => (h i).hom a b) = + (h i.as).hom a b := (cofanEvalIsColimit s hs a).fac _ i + let a : s.pt.X (c.next j) ⟶ Y.X j := + (cofanEvalIsColimit s hs (c.next j)).desc (Cofan.mk _ fun i => (h i).hom (c.next j) j) + let b : s.pt.X j ⟶ Y.X (c.prev j) := + (cofanEvalIsColimit s hs j).desc (Cofan.mk _ fun i => (h i).hom j (c.prev j)) + change (s.inj i.as).f j ≫ f.f j = (s.inj i.as).f j ≫ + (s.pt.d j (c.next j) ≫ a + b ≫ Y.d (c.prev j) j + g.f j) + dsimp only [a, b] + rw [Preadditive.comp_add, Preadditive.comp_add, + (s.inj i.as).comm_assoc, fac, ← Category.assoc, fac] + exact hh + +def quotientCofanIsColimit (s : Cofan K) (hs : IsColimit s) + [HasColimitsOfShape (Discrete I) C] : + IsColimit (Cofan.mk ((HomotopyCategory.quotient C c).obj s.pt) + (fun i => (HomotopyCategory.quotient C c).map (s.inj i))) := by + let Q := HomotopyCategory.quotient C c + refine Cofan.IsColimit.mk _ + (fun t => Q.map (hs.desc (Cofan.mk t.pt.as (fun i => (t.inj i).out)))) ?_ ?_ + · intro t i + change Q.map (s.inj i) ≫ Q.map _ = _ + rw [← Q.map_comp, Cofan.IsColimit.inj_desc] + exact HomotopyCategory.quotient_map_out _ + · intro t m hm + obtain ⟨m, rfl⟩ := Q.map_surjective m + apply HomotopyCategory.eq_of_homotopy + apply homotopyCofanDesc s hs + intro i + apply HomotopyCategory.homotopyOfEq + change ∀ i, Q.map (s.inj i) ≫ Q.map m = t.inj i at hm + rw [Q.map_comp, hm, Cofan.IsColimit.inj_desc] + exact (HomotopyCategory.quotient_map_out _).symm + +end + +open CategoryTheory.MorphismProperty +universe u₁ u₂ v₁ v₂ w +variable {C : Type u₁} [Category.{v₁} C] [Preadditive C] + {D : Type u₂} [Category.{v₂} D] [Preadditive D] +variable (W : MorphismProperty C) (F : C ⥤ D) [F.IsLocalization W] [F.Additive] +variable [W.HasRightCalculusOfFractions] {I : Type w} + [HasColimitsOfShape (Discrete I) C] [W.IsStableUnderCoproductsOfShape I] + +omit [Preadditive C] [W.HasRightCalculusOfFractions] in +lemma cofan_desc_mem {X Y : I → C} (s : Cofan Y) (hs : IsColimit s) + (f : ∀ i, X i ⟶ Y i) (hf : ∀ i, W (f i)) : + W (Sigma.desc (fun i => f i ≫ s.inj i)) := by + exact IsStableUnderColimitsOfShape.condition _ _ _ _ + (colimit.isColimit (Discrete.functor X)) hs + (Discrete.natTrans fun i => f i.as) (fun i => hf i.as) _ + (fun i => by + change Sigma.ι X i.as ≫ _ = f i.as ≫ s.inj i.as + exact Sigma.ι_comp_desc _ _) + +include W + +lemma localizationCofan_zero {X : I → C} (s : Cofan X) (hs : IsColimit s) + {Y : C} (d : F.obj s.pt ⟶ F.obj Y) + (hd : ∀ i, F.map (s.inj i) ≫ d = 0) : d = 0 := by + obtain ⟨φ, hφ⟩ := Localization.exists_rightFraction F W d + let ρ (i : I) : W.RightFraction (X i) φ.X' := + (LeftFraction.mk (s.inj i) φ.s φ.hs).rightFraction + have hρ (i : I) : (ρ i).s ≫ s.inj i = (ρ i).f ≫ φ.s := + (LeftFraction.mk (s.inj i) φ.s φ.hs).rightFraction_fac + have hz (i : I) : F.map ((ρ i).f ≫ φ.f) = F.map (0 : (ρ i).X' ⟶ Y) := by + have hr := congrArg (fun f => F.map (ρ i).s ≫ f) (hd i) + rw [hφ] at hr + simpa only [RightFraction.map, comp_zero, ← F.map_comp_assoc, hρ, + F.map_comp, Category.assoc, IsIso.hom_inv_id_assoc, F.map_zero] using hr + have hex (i : I) := (W.map_eq_iff_precomp F ((ρ i).f ≫ φ.f) 0).mp (hz i) + choose Z t ht htf using hex + let q : (∐ Z) ⟶ φ.X' := Sigma.desc (fun i => t i ≫ (ρ i).f) + have hq : W (q ≫ φ.s) := by + have eq : q ≫ φ.s = Sigma.desc (fun i => (t i ≫ (ρ i).s) ≫ s.inj i) := by + apply Sigma.hom_ext + intro i + simp only [q, Sigma.ι_comp_desc_assoc, Sigma.ι_comp_desc, Category.assoc, hρ] + rw [eq] + exact cofan_desc_mem W s hs _ (fun i => W.comp_mem _ _ (ht i) (ρ i).hs) + have hqf : q ≫ φ.f = 0 := by + apply Sigma.hom_ext + intro i + simpa only [q, Sigma.ι_comp_desc_assoc, comp_zero, Category.assoc] using htf i + let : IsIso (F.map (q ≫ φ.s)) := Localization.inverts F W _ hq + apply (cancel_epi (F.map (q ≫ φ.s))).mp + rw [comp_zero, F.map_comp, hφ] + let : IsIso (F.map φ.s) := Localization.inverts F W _ φ.hs + simp only [RightFraction.map, Category.assoc] + rw [IsIso.hom_inv_id_assoc, ← F.map_comp, hqf, F.map_zero] + +lemma localizationCofan_hom_ext {X : I → C} (s : Cofan X) (hs : IsColimit s) + {Y : C} (f g : F.obj s.pt ⟶ F.obj Y) + (h : ∀ i, F.map (s.inj i) ≫ f = F.map (s.inj i) ≫ g) : f = g := by + apply sub_eq_zero.mp + exact localizationCofan_zero W F s hs (f - g) (fun i => by simp [Preadditive.comp_sub, h i]) + +omit [Preadditive C] [Preadditive D] [F.Additive] in +lemma localizationCofan_lift {X : I → C} (s : Cofan X) (hs : IsColimit s) + {Y : C} (f : ∀ i, F.obj (X i) ⟶ F.obj Y) : + ∃ g : F.obj s.pt ⟶ F.obj Y, ∀ i, F.map (s.inj i) ≫ g = f i := by + choose φ hφ using fun i => Localization.exists_rightFraction F W (f i) + let q : (∐ fun i => (φ i).X') ⟶ s.pt := Sigma.desc (fun i => (φ i).s ≫ s.inj i) + have hq : W q := cofan_desc_mem W s hs _ (fun i => (φ i).hs) + let : IsIso (F.map q) := Localization.inverts F W _ hq + let p : (∐ fun i => (φ i).X') ⟶ Y := Sigma.desc (fun i => (φ i).f) + refine ⟨inv (F.map q) ≫ F.map p, ?_⟩ + intro i + apply (cancel_epi (F.map (φ i).s)).mp + have he : F.map (φ i).s ≫ F.map (s.inj i) = + F.map (Sigma.ι (fun i => (φ i).X') i) ≫ F.map q := by + simp only [← F.map_comp, q, Sigma.ι_comp_desc] + rw [← Category.assoc, he, Category.assoc, IsIso.hom_inv_id_assoc, + ← F.map_comp, + show Sigma.ι (fun i => (φ i).X') i ≫ p = (φ i).f from Sigma.ι_comp_desc _ _, hφ] + simp only [RightFraction.map, IsIso.hom_inv_id_assoc] + +def localizationCofanIsColimit {X : I → C} (s : Cofan X) (hs : IsColimit s) : + IsColimit (Cofan.mk (F.obj s.pt) (fun i => F.map (s.inj i))) := by + letI : F.EssSurj := Localization.essSurj F W + let lift (t : Cofan (fun i => F.obj (X i))) : F.obj s.pt ⟶ t.pt := + (localizationCofan_lift W F s hs (fun i => t.inj i ≫ (F.objObjPreimageIso t.pt).inv)).choose ≫ + (F.objObjPreimageIso t.pt).hom + have fac (t : Cofan (fun i => F.obj (X i))) (i : I) : + F.map (s.inj i) ≫ lift t = t.inj i := by + dsimp only [lift] + rw [← Category.assoc, (localizationCofan_lift W F s hs _).choose_spec i] + simp + refine Cofan.IsColimit.mk _ lift fac ?_ + intro t m hm + apply (cancel_mono (F.objObjPreimageIso t.pt).inv).mp + apply localizationCofan_hom_ext W F s hs + intro i + rw [← Category.assoc, ← Category.assoc, fac] + exact congrArg (fun f => f ≫ (F.objObjPreimageIso t.pt).inv) (hm i) + +end LittleFinitistic.DerivedSupport + +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Derived/DerivedSums.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Derived/DerivedSums.lean new file mode 100644 index 0000000000000000000000000000000000000000..23af0ccd75773fa5f91f94dcf37053fe00d19e95 --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Derived/DerivedSums.lean @@ -0,0 +1,102 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Derived.ComplexSums + +namespace OAI + +noncomputable section + +open CategoryTheory CategoryTheory.Limits +open HomologicalComplex +namespace LittleFinitistic.DerivedSupport +universe u v w z +variable {C : Type u} [Category.{v} C] [Abelian C] [HasDerivedCategory.{z} C] +variable {I : Type w} [HasColimitsOfShape (Discrete I) C] + [HasExactColimitsOfShape (Discrete I) C] + +def derivedHomotopyCofanIsColimit {X : I → HomotopyCategory C (ComplexShape.up ℤ)} + (s : Cofan X) (hs : IsColimit s) : + IsColimit (Cofan.mk (DerivedCategory.Qh.obj s.pt) + (fun i => DerivedCategory.Qh.map (s.inj i))) := + localizationCofanIsColimit (HomotopyCategory.quasiIso C (ComplexShape.up ℤ)) + DerivedCategory.Qh s hs + +def derivedCofanIsColimit {X : I → CochainComplex C ℤ} (s : Cofan X) (hs : IsColimit s) : + IsColimit (Cofan.mk (DerivedCategory.Q.obj s.pt) + (fun i => DerivedCategory.Q.map (s.inj i))) := by + let h := derivedHomotopyCofanIsColimit _ (quotientCofanIsColimit s hs) + let e := DerivedCategory.quotientCompQhIso C + refine Cofan.IsColimit.mk _ (fun t => + (e.app s.pt).inv ≫ h.desc (Cofan.mk t.pt (fun i => (e.app (X i)).hom ≫ t.inj i))) ?_ ?_ + · intro t i + change DerivedCategory.Q.map (s.inj i) ≫ (e.app s.pt).inv ≫ + h.desc (Cofan.mk t.pt (fun i => (e.app (X i)).hom ≫ t.inj i)) = t.inj i + have hn : DerivedCategory.Q.map (s.inj i) ≫ (e.app s.pt).inv = + (e.app (X i)).inv ≫ DerivedCategory.Qh.map + ((HomotopyCategory.quotient C (ComplexShape.up ℤ)).map (s.inj i)) := + e.inv.naturality (s.inj i) + have hf : DerivedCategory.Qh.map + ((HomotopyCategory.quotient C (ComplexShape.up ℤ)).map (s.inj i)) ≫ + h.desc (Cofan.mk t.pt (fun j => (e.app (X j)).hom ≫ t.inj j)) = + (e.app (X i)).hom ≫ t.inj i := h.fac _ (Discrete.mk i) + rw [← Category.assoc, hn, Category.assoc, hf] + exact Iso.inv_hom_id_assoc _ _ + · intro t m hm + apply (cancel_epi (e.app s.pt).hom).mp + simp only [Iso.hom_inv_id_assoc] + apply h.hom_ext + intro i + change DerivedCategory.Qh.map ((HomotopyCategory.quotient C (ComplexShape.up ℤ)).map + (s.inj i.as)) ≫ _ = _ + rw [IsColimit.fac] + change DerivedCategory.Qh.map ((HomotopyCategory.quotient C (ComplexShape.up ℤ)).map + (s.inj i.as)) ≫ (e.app s.pt).hom ≫ m = (e.app (X i.as)).hom ≫ t.inj i.as + have hn : DerivedCategory.Qh.map ((HomotopyCategory.quotient C (ComplexShape.up ℤ)).map + (s.inj i.as)) ≫ (e.app s.pt).hom = + (e.app (X i.as)).hom ≫ DerivedCategory.Q.map (s.inj i.as) := + e.hom.naturality (s.inj i.as) + change ∀ i, DerivedCategory.Q.map (s.inj i) ≫ m = t.inj i at hm + rw [← Category.assoc, hn, Category.assoc, hm] + +def derivedSumIsColimit (X : I → CochainComplex C ℤ) := + derivedCofanIsColimit _ (sumComplexIsColimit X) + +lemma prop_derived_sum (P : ObjectProperty (DerivedCategory C)) + [P.IsClosedUnderColimitsOfShape (Discrete I)] (X : I → CochainComplex C ℤ) + (hX : ∀ i, P (DerivedCategory.Q.obj (X i))) : P (DerivedCategory.Q.obj (sumComplex X)) := + P.prop_of_isColimit (derivedSumIsColimit X) (fun i => hX i.as) + +instance derivedHasCoproducts : HasColimitsOfShape (Discrete I) (DerivedCategory C) where + has_colimit G := by + let F := DerivedCategory.Qh (C := C) + let : F.EssSurj := Localization.essSurj F (HomotopyCategory.quasiIso C (ComplexShape.up ℤ)) + let X (i : I) := F.objPreimage (G.obj ⟨i⟩) + let e (i : I) := F.objObjPreimageIso (G.obj ⟨i⟩) + let s : Cofan (fun i => F.obj (X i)) := + Cofan.mk (F.obj (∐ X)) (fun i => F.map (Sigma.ι X i)) + let h : IsColimit s := derivedHomotopyCofanIsColimit _ (colimit.isColimit _) + let t : Cofan (fun i => G.obj ⟨i⟩) := + Cofan.mk s.pt (fun i => (e i).inv ≫ s.inj i) + have ht : IsColimit t := by + refine Cofan.IsColimit.mk _ (fun z => h.desc (Cofan.mk z.pt + (fun i => (e i).hom ≫ z.inj i))) ?_ ?_ + · intro z i + change ((e i).inv ≫ s.inj i) ≫ _ = _ + rw [Category.assoc, Cofan.IsColimit.inj_desc] + exact Iso.inv_hom_id_assoc _ _ + · intro z m hm + apply h.hom_ext + intro i + rw [IsColimit.fac] + change s.inj i.as ≫ m = (e i.as).hom ≫ z.inj i.as + rw [← hm i.as] + change s.inj i.as ≫ m = (e i.as).hom ≫ ((e i.as).inv ≫ s.inj i.as) ≫ m + simp only [Category.assoc, Iso.hom_inv_id_assoc] + let : HasColimit (Discrete.functor (fun i : I => G.obj ⟨i⟩)) := ⟨_, ht⟩ + exact hasColimit_of_iso (F := Discrete.functor (fun i : I => G.obj ⟨i⟩)) + (Discrete.natIso (fun i => Iso.refl (G.obj i))) + +end LittleFinitistic.DerivedSupport + +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Derived/ExactExtension.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Derived/ExactExtension.lean new file mode 100644 index 0000000000000000000000000000000000000000..ce5899b84915c1b2116467c0c496aa2a459a29f9 --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Derived/ExactExtension.lean @@ -0,0 +1,53 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Model + +namespace OAI + +noncomputable section + +open CategoryTheory CategoryTheory.Limits HomologicalComplex +namespace LittleFinitistic.DerivedSupport +universe u v t t' +variable {C : Type u} [Category.{v} C] [Abelian C] +variable {ι : Type t} {ι' : Type t'} {c : ComplexShape ι} {c' : ComplexShape ι'} +variable (e : c.Embedding c') (S : ShortComplex (HomologicalComplex C c)) + +def extendEvalIso {j : ι} {j' : ι'} (hj : e.f j = j') : + (S.map (e.extendFunctor C)).map (HomologicalComplex.eval C c' j') ≅ + S.map (HomologicalComplex.eval C c j) := + ShortComplex.isoMk (S.X₁.extendXIso e hj) (S.X₂.extendXIso e hj) (S.X₃.extendXIso e hj) + (by + change (S.X₁.extendXIso e hj).hom ≫ S.f.f j = + (extendMap S.f e).f j' ≫ (S.X₂.extendXIso e hj).hom + rw [extendMap_f _ e hj] + simp) + (by + change (S.X₂.extendXIso e hj).hom ≫ S.g.f j = + (extendMap S.g e).f j' ≫ (S.X₃.extendXIso e hj).hom + rw [extendMap_f _ e hj] + simp) + +lemma extend_shortExact (hS : S.ShortExact) : (S.map (e.extendFunctor C)).ShortExact := by + have h (j' : ι') : ((S.map (e.extendFunctor C)).map + (HomologicalComplex.eval C c' j')).ShortExact := by + by_cases hj' : ∃ j, e.f j = j' + · obtain ⟨j, hj⟩ := hj' + let := hS.mono_f + let := hS.epi_g + exact ShortComplex.shortExact_of_iso (extendEvalIso e S hj).symm + (hS.map (HomologicalComplex.eval C c j)) + · have h₁ := S.X₁.isZero_extend_X e j' (fun j h => hj' ⟨j,h⟩) + have h₂ := S.X₂.isZero_extend_X e j' (fun j h => hj' ⟨j,h⟩) + have h₃ := S.X₃.isZero_extend_X e j' (fun j h => hj' ⟨j,h⟩) + exact { exact := ShortComplex.exact_of_isZero_X₂ _ h₂ + mono_f := h₁.mono _ + epi_g := h₃.epi _ } + exact { exact := HomologicalComplex.exact_of_degreewise_exact _ (fun j => (h j).exact) + mono_f := HomologicalComplex.mono_of_mono_f _ (fun j => (h j).mono_f) + epi_g := HomologicalComplex.epi_of_epi_f _ (fun j => (h j).epi_g) } + +end LittleFinitistic.DerivedSupport + +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Derived/LocalizingRetracts.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Derived/LocalizingRetracts.lean new file mode 100644 index 0000000000000000000000000000000000000000..7c7d9ed538e7fd76e2c88f3d907343680f1f73db --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Derived/LocalizingRetracts.lean @@ -0,0 +1,93 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Model + +namespace OAI + +noncomputable section + +open CategoryTheory CategoryTheory.Limits CategoryTheory.Pretriangulated +namespace LittleFinitistic.DerivedSupport +universe u v +variable {C : Type u} [Category.{v} C] [Preadditive C] + [HasColimitsOfShape (Discrete ℕ) C] +variable {X Y : C} (i : X ⟶ Y) (p : Y ⟶ X) (hip : i ≫ p = 𝟙 X) + +private def swindleA : (∐ fun _ : ℕ => Y) ⟶ (∐ fun _ : ℕ => Y) := + Sigma.desc fun n => (𝟙 Y - p ≫ i) ≫ Sigma.ι (fun _ : ℕ => Y) n + + (p ≫ i) ≫ Sigma.ι (fun _ : ℕ => Y) (n+1) +private def swindleC : (∐ fun _ : ℕ => Y) ⟶ (∐ fun _ : ℕ => Y) := + Sigma.desc fun n => match n with + | 0 => (𝟙 Y - p ≫ i) ≫ Sigma.ι (fun _ : ℕ => Y) 0 + | n+1 => (p ≫ i) ≫ Sigma.ι (fun _ : ℕ => Y) n + + (𝟙 Y - p ≫ i) ≫ Sigma.ι (fun _ : ℕ => Y) (n+1) +private def swindleB : (∐ fun _ : ℕ => Y) ⟶ X := + Sigma.desc fun n => match n with + | 0 => p + | _+1 => 0 +private def swindleI : X ⟶ (∐ fun _ : ℕ => Y) := i ≫ Sigma.ι (fun _ : ℕ => Y) 0 + +include hip + +private lemma swindleAC : swindleA i p ≫ swindleC i p = 𝟙 _ := by + apply Sigma.hom_ext + intro n + cases n <;> + simp only [swindleA, swindleC, Sigma.ι_comp_desc_assoc, Sigma.ι_comp_desc, + Preadditive.add_comp, Preadditive.comp_add, Preadditive.sub_comp, + Preadditive.comp_sub, Category.assoc, reassoc_of% hip, + Category.id_comp, Category.comp_id] <;> abel + +private lemma swindleAB : swindleA i p ≫ swindleB p = 0 := by + apply Sigma.hom_ext + intro n + cases n <;> simp [swindleA, swindleB, Preadditive.add_comp, Preadditive.sub_comp, + Category.assoc, hip] + +private lemma swindleIB : swindleI i ≫ swindleB p = 𝟙 _ := by + simp [swindleI, swindleB, Category.assoc, hip] + +private lemma swindleIC : swindleI i ≫ swindleC i p = 0 := by + simp [swindleI, swindleC, Category.assoc, Preadditive.comp_sub, reassoc_of% hip] + +private lemma swindleTotal : swindleC i p ≫ swindleA i p + swindleB p ≫ swindleI i = 𝟙 _ := by + apply Sigma.hom_ext + intro n + cases n <;> + simp only [swindleA, swindleC, swindleB, swindleI, Sigma.ι_comp_desc_assoc, + Sigma.ι_comp_desc, Preadditive.add_comp, Preadditive.comp_add, + Preadditive.sub_comp, Preadditive.comp_sub, Category.assoc, + reassoc_of% hip, Category.id_comp, Category.comp_id, zero_comp] <;> abel + +variable [HasZeroObject C] [HasShift C ℤ] + [∀ degree : ℤ, (shiftFunctor C degree).Additive] [Pretriangulated C] + +def swindleIso : (∐ fun _ : ℕ => Y) ≅ (∐ fun _ : ℕ => Y) ⊞ X where + hom := biprod.lift (swindleC i p) (swindleB p) + inv := biprod.desc (swindleA i p) (swindleI i) + hom_inv_id := by simpa using swindleTotal i p hip + inv_hom_id := by + apply biprod.hom_ext <;> apply biprod.hom_ext' <;> simp [swindleAC i p hip, swindleAB i p hip, + swindleIB i p hip, swindleIC i p hip] + +lemma swindle_distinguished : Triangle.mk (swindleA i p) (swindleB p) 0 ∈ distTriang C := by + apply isomorphic_distinguished _ (binaryBiproductTriangle_distinguished (∐ fun _ : ℕ => Y) X) + refine Triangle.isoMk _ _ (Iso.refl _) (swindleIso i p hip) (Iso.refl _) ?_ ?_ ?_ + · simp only [Triangle.mk, Iso.refl_hom, binaryBiproductTriangle, Category.id_comp] + change swindleA i p ≫ (swindleIso i p hip).hom = biprod.inl + apply biprod.hom_ext <;> simp [swindleIso, swindleAC i p hip, swindleAB i p hip] + · simp only [Triangle.mk, Iso.refl_hom, binaryBiproductTriangle, Category.comp_id] + change swindleB p = (swindleIso i p hip).hom ≫ biprod.snd + exact (biprod.lift_snd _ _).symm + · simp + exact (Category.id_comp _).symm + +lemma localizing_of_retract (P : ObjectProperty C) [P.IsClosedUnderIsomorphisms] + [P.IsTriangulated] [P.IsClosedUnderColimitsOfShape (Discrete ℕ)] (hY : P Y) : P X := by + have h : P (∐ fun _ : ℕ => Y) := P.prop_colimit (Discrete.functor (fun _ : ℕ => Y)) (fun _ => hY) + exact P.ext_of_isTriangulatedClosed₃ _ (swindle_distinguished i p hip) h h + +end LittleFinitistic.DerivedSupport + +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Derived/ModuleGeneration.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Derived/ModuleGeneration.lean new file mode 100644 index 0000000000000000000000000000000000000000..a7772d2af4c636f9347bb7d39e106e54af890cef --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Derived/ModuleGeneration.lean @@ -0,0 +1,210 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Derived.DerivedSums +import OAI.Algebra.FinitisticAsymmetry.Derived.LocalizingRetracts + +namespace OAI + +noncomputable section + +open CategoryTheory CategoryTheory.Limits HomologicalComplex +namespace LittleFinitistic.DerivedSupport +universe u w +variable {R : Type u} [Ring R] [HasDerivedCategory.{w} (ModuleCat.{u} R)] +variable (P : ObjectProperty (DerivedCategory (ModuleCat.{u} R))) + [P.IsClosedUnderIsomorphisms] [P.IsTriangulated] + [P.IsClosedUnderColimitsOfShape (Discrete ℕ)] + +omit [P.IsClosedUnderColimitsOfShape (Discrete ℕ)] in +lemma prop_single_shortExact₁ (S : ShortComplex (ModuleCat R)) (hS : S.ShortExact) + (h₂ : P ((DerivedCategory.singleFunctor _ 0).obj S.X₂)) + (h₃ : P ((DerivedCategory.singleFunctor _ 0).obj S.X₃)) : + P ((DerivedCategory.singleFunctor _ 0).obj S.X₁) := by + let := hS.mono_f + let := hS.epi_g + let F := HomologicalComplex.single (ModuleCat R) (.up ℤ) 0 + let e := DerivedCategory.singleFunctorIsoCompQ (ModuleCat R) 0 + apply P.prop_of_iso (e.app S.X₁).symm + exact P.ext_of_isTriangulatedClosed₁ _ + (DerivedCategory.triangleOfSES_distinguished (hS.map F)) + (P.prop_of_iso (e.app S.X₂) h₂) (P.prop_of_iso (e.app S.X₃) h₃) + +omit [P.IsClosedUnderColimitsOfShape (Discrete ℕ)] in +lemma prop_single_shortExact₂ (S : ShortComplex (ModuleCat R)) (hS : S.ShortExact) + (h₁ : P ((DerivedCategory.singleFunctor _ 0).obj S.X₁)) + (h₃ : P ((DerivedCategory.singleFunctor _ 0).obj S.X₃)) : + P ((DerivedCategory.singleFunctor _ 0).obj S.X₂) := by + let := hS.mono_f + let := hS.epi_g + let F := HomologicalComplex.single (ModuleCat R) (.up ℤ) 0 + let e := DerivedCategory.singleFunctorIsoCompQ (ModuleCat R) 0 + apply P.prop_of_iso (e.app S.X₂).symm + exact P.ext_of_isTriangulatedClosed₂ _ + (DerivedCategory.triangleOfSES_distinguished (hS.map F)) + (P.prop_of_iso (e.app S.X₁) h₁) (P.prop_of_iso (e.app S.X₃) h₃) + +omit [P.IsTriangulated] [P.IsClosedUnderColimitsOfShape (Discrete ℕ)] in +lemma prop_single_of_cofan {I : Type u} [P.IsClosedUnderColimitsOfShape (Discrete I)] + {M : I → ModuleCat R} (s : Cofan M) (hs : IsColimit s) + (hM : ∀ i, P ((DerivedCategory.singleFunctor _ 0).obj (M i))) : + P ((DerivedCategory.singleFunctor _ 0).obj s.pt) := by + let F := HomologicalComplex.single (ModuleCat R) (.up ℤ) 0 + let e := DerivedCategory.singleFunctorIsoCompQ (ModuleCat R) 0 + have hs' := isColimitCofanMkObjOfIsColimit F M s.inj hs + apply P.prop_of_iso (e.app s.pt).symm + exact P.prop_of_isColimit (derivedCofanIsColimit _ hs') + (fun i => P.prop_of_iso (e.app (M i.as)) (hM i.as)) + +variable {S : Type u} [Ring S] (χ : R →+* S) +variable (hcop : ∀ I : Type u, P.IsClosedUnderColimitsOfShape (Discrete I)) +include hcop + +lemma prop_restricted_projective (M : ModuleCat.{u} S) [Module.Projective S M] + (hS : P ((DerivedCategory.singleFunctor _ 0).obj + ((ModuleCat.restrictScalars χ).obj (ModuleCat.of S S)))) : + P ((DerivedCategory.singleFunctor _ 0).obj ((ModuleCat.restrictScalars χ).obj M)) := by + classical + let F := ModuleCat.restrictScalars χ ⋙ DerivedCategory.singleFunctor (ModuleCat R) 0 + let := hcop M + obtain ⟨s, hs⟩ := (Module.projective_def' (R := S) (P := M)).mp inferInstance + let q : ModuleCat.of S (M →₀ S) ⟶ M := ModuleCat.ofHom (Finsupp.linearCombination S id) + let j : M ⟶ ModuleCat.of S (M →₀ S) := ModuleCat.ofHom s + have hjq : j ≫ q = 𝟙 _ := by ext x; exact congrFun (congrArg DFunLike.coe hs) x + apply localizing_of_retract (F.map j) (F.map q) (by rw [← F.map_comp, hjq, F.map_id]) P + let cs : Cofan (fun _ : M => ModuleCat.of S S) := + Cofan.mk (ModuleCat.of S (M →₀ S)) (fun x => ModuleCat.ofHom (Finsupp.lsingle x)) + have hc : IsColimit cs := by + refine Cofan.IsColimit.mk _ + (fun t => ModuleCat.ofHom (Finsupp.lsum ℤ (fun x => (t.inj x).hom))) ?_ ?_ + · intro t x + ext + simp [cs] + · intro t f hf + apply ModuleCat.hom_ext + apply Finsupp.lhom_ext' + intro x + simpa [cs] using congrArg ModuleCat.Hom.hom (hf x) + let G := ModuleCat.restrictScalars χ + exact prop_single_of_cofan P (Cofan.mk (G.obj cs.pt) (fun x => G.map (cs.inj x))) + (isColimitCofanMkObjOfIsColimit G _ cs.inj hc) (fun _ => hS) + +omit hcop [HasDerivedCategory.{w} (ModuleCat.{u} R)] in +lemma submodule_shortExact (M : ModuleCat.{u} R) (N : Submodule R M) : + (ShortComplex.mk (ModuleCat.ofHom N.subtype) (ModuleCat.ofHom N.mkQ) + (by ext x; exact (Submodule.Quotient.mk_eq_zero N).mpr x.property)).ShortExact where + mono_f := (ModuleCat.mono_iff_injective _).mpr N.injective_subtype + epi_g := (ModuleCat.epi_iff_surjective _).mpr N.mkQ_surjective + exact := by + rw [ShortComplex.moduleCat_exact_iff] + intro x hx + exact ⟨⟨x, (Submodule.Quotient.mk_eq_zero N).mp hx⟩, rfl⟩ + +variable (J : Ideal R) [J.IsTwoSided] [IsSemisimpleRing (R ⧸ J)] + +lemma prop_annihilated_module + (hQ : P ((DerivedCategory.singleFunctor _ 0).obj + ((ModuleCat.restrictScalars (Ideal.Quotient.mk J)).obj (ModuleCat.of (R ⧸ J) (R ⧸ J))))) + (M : ModuleCat.{u} R) (hM : Module.IsTorsionBySet R M J) : + P ((DerivedCategory.singleFunctor _ 0).obj M) := by + let := hM.module + let M' := ModuleCat.of (R ⧸ J) M + let : Module.Projective (R ⧸ J) M' := Module.projective_of_isSemisimpleRing _ _ + have h := prop_restricted_projective P (Ideal.Quotient.mk J) hcop M' hQ + let e : ((ModuleCat.restrictScalars (Ideal.Quotient.mk J)).obj M') ≅ M := + LinearEquiv.toModuleIso { + toFun := id + invFun := id + left_inv := fun _ => rfl + right_inv := fun _ => rfl + map_add' := fun _ _ => rfl + map_smul' := fun r x => hM.mk_smul r x } + exact P.prop_of_iso ((DerivedCategory.singleFunctor _ 0).mapIso e) h + +lemma prop_of_nilpotent_kernel + (hQ : P ((DerivedCategory.singleFunctor _ 0).obj + ((ModuleCat.restrictScalars (Ideal.Quotient.mk J)).obj (ModuleCat.of (R ⧸ J) (R ⧸ J))))) + (hJ : ∃ n : ℕ, J ^ n = ⊥) (M : ModuleCat.{u} R) : + P ((DerivedCategory.singleFunctor _ 0).obj M) := by + have aux (n : ℕ) (M : ModuleCat.{u} R) (hn : J^n • (⊤ : Submodule R M) = ⊥) : + P ((DerivedCategory.singleFunctor _ 0).obj M) := by + induction n generalizing M with + | zero => + have hm : (⊤ : Submodule R M) = ⊥ := by + simpa only [Submodule.pow_zero, Ideal.one_eq_top, Submodule.top_smul] using hn + apply P.prop_of_isZero + apply (DerivedCategory.singleFunctor _ 0).map_isZero + rw [ModuleCat.isZero_iff_subsingleton] + exact (Submodule.subsingleton_iff R).mp (subsingleton_of_bot_eq_top hm.symm) + | succ n ih => + let N : Submodule R M := J • ⊤ + have hn' : J^n • (⊤ : Submodule R N) = ⊥ := by + apply Submodule.map_injective_of_injective N.injective_subtype + rw [Submodule.map_bot, Submodule.map_smul'', Submodule.map_subtype_top] + change J^n • (J • (⊤ : Submodule R M)) = ⊥ + rw [← Submodule.mul_smul, ← Submodule.pow_succ] + exact hn + apply prop_single_shortExact₂ P _ (submodule_shortExact M N) + · exact ih (ModuleCat.of R N) hn' + · exact prop_annihilated_module P hcop J hQ (ModuleCat.of R (M ⧸ N)) + (Module.isTorsionBySet_quotient_ideal_smul M J) + obtain ⟨n, hn⟩ := hJ + exact aux n M (by simp [hn]) + +variable {k ι : Type u} [Field k] [Fintype ι] (ψ : R →+* (ι → k)) + +abbrev coordinateModule (j : ι) : ModuleCat R := + (ModuleCat.restrictScalars ((Pi.evalRingHom (fun _ : ι => k) j).comp ψ)).obj + (ModuleCat.of k k) + +omit [P.IsTriangulated] [P.IsClosedUnderColimitsOfShape (Discrete ℕ)] in +lemma prop_restricted_pi + (hcoord : ∀ j, P ((DerivedCategory.singleFunctor _ 0).obj (coordinateModule ψ j))) : + P ((DerivedCategory.singleFunctor _ 0).obj + ((ModuleCat.restrictScalars ψ).obj (ModuleCat.of (ι → k) (ι → k)))) := by + classical + let := hcop ι + let Z := coordinateModule ψ + have h := prop_single_of_cofan P (ModuleCat.coproductCocone Z) + (ModuleCat.coproductCoconeIsColimit Z) hcoord + let e₁ : (Π₀ i, Z i) ≃ₗ[R] (∀ i, Z i) := DFinsupp.linearEquivFunOnFintype + let e₂ : (∀ i, Z i) ≃ₗ[R] + ((ModuleCat.restrictScalars ψ).obj (ModuleCat.of (ι → k) (ι → k))) := { + toFun := fun x i => x i + invFun := fun x i => x i + left_inv := fun _ => rfl + right_inv := fun _ => rfl + map_add' := fun _ _ => rfl + map_smul' := fun _ _ => rfl } + exact P.prop_of_iso ((DerivedCategory.singleFunctor _ 0).mapIso + ((e₁.trans e₂).toModuleIso)) h + +lemma prop_all_of_product_augmentation (hψ : Function.Surjective ψ) + (hnil : ∃ n : ℕ, (RingHom.ker ψ)^n = ⊥) + (hcoord : ∀ j, P ((DerivedCategory.singleFunctor _ 0).obj (coordinateModule ψ j))) + (M : ModuleCat.{u} R) : P ((DerivedCategory.singleFunctor _ 0).obj M) := by + let e := RingHom.quotientKerEquivOfSurjective hψ + let : IsSemisimpleRing (R ⧸ RingHom.ker ψ) := e.isSemisimpleRing_iff.mpr inferInstance + apply prop_of_nilpotent_kernel P hcop (RingHom.ker ψ) _ hnil M + let e' : ((ModuleCat.restrictScalars (Ideal.Quotient.mk (RingHom.ker ψ))).obj + (ModuleCat.of (R ⧸ RingHom.ker ψ) (R ⧸ RingHom.ker ψ))) ≅ + ((ModuleCat.restrictScalars ψ).obj (ModuleCat.of (ι → k) (ι → k))) := + LinearEquiv.toModuleIso (show + ((ModuleCat.restrictScalars (Ideal.Quotient.mk (RingHom.ker ψ))).obj + (ModuleCat.of (R ⧸ RingHom.ker ψ) (R ⧸ RingHom.ker ψ))) ≃ₗ[R] + ((ModuleCat.restrictScalars ψ).obj (ModuleCat.of (ι → k) (ι → k))) from { + toFun := e + invFun := e.symm + left_inv := e.left_inv + right_inv := e.right_inv + map_add' := e.map_add + map_smul' := fun r x => by + change e (Ideal.Quotient.mk (RingHom.ker ψ) r * (show R ⧸ RingHom.ker ψ from x)) = ψ r * e x + rw [e.map_mul] + rfl }) + exact P.prop_of_iso ((DerivedCategory.singleFunctor _ 0).mapIso e'.symm) + (prop_restricted_pi P hcop ψ hcoord) + +end LittleFinitistic.DerivedSupport + +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Derived/ModuleSums.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Derived/ModuleSums.lean new file mode 100644 index 0000000000000000000000000000000000000000..5379ea4ee5afcbf5287be09e1fb02e4289da4741 --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Derived/ModuleSums.lean @@ -0,0 +1,99 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Model + +namespace OAI + +noncomputable section + +open CategoryTheory CategoryTheory.Limits +open HomologicalComplex +namespace LittleFinitistic.DerivedSupport +universe u v +open HomologicalComplex +variable {R : Type u} [Ring R] {I : Type v} + +def moduleSumCofan (X : I → ModuleCat.{max u v} R) : Cofan X := by + classical + exact Cofan.mk (ModuleCat.of R (Π₀ i, X i)) (fun i => ModuleCat.ofHom (DFinsupp.lsingle (R := R) (M := fun j => X j) i)) + +def moduleSumIsColimit (X : I → ModuleCat.{max u v} R) : + IsColimit (moduleSumCofan X) := by + classical + refine Cofan.IsColimit.mk _ (fun s => ModuleCat.ofHom (DFinsupp.lsum ℤ + (fun i => (s.inj i).hom))) ?_ ?_ + · intro s i + ext x + change DFinsupp.lsum ℤ (fun j => (s.inj j).hom) (DFinsupp.single i x) = _ + simp only [DFinsupp.lsum_single] + · intro s m hm + apply ModuleCat.hom_ext + apply DFinsupp.lhom_ext + intro i x + change m (DFinsupp.single i x) = DFinsupp.lsum ℤ (fun j => (s.inj j).hom) (DFinsupp.single i x) + rw [DFinsupp.lsum_single] + exact ConcreteCategory.congr_hom (hm i) x + +def moduleSumComplex (K : I → CochainComplex (ModuleCat.{max u v} R) ℤ) : + CochainComplex (ModuleCat R) ℤ where + X j := ModuleCat.of R (Π₀ i, (K i).X j) + d j k := ModuleCat.ofHom (DFinsupp.mapRange.linearMap (fun i => ((K i).d j k).hom)) + shape j k hjk := by + ext x i + change (K i).d j k (x i) = 0 + rw [(K i).shape j k hjk] + rfl + d_comp_d' j k l hjk hkl := by + ext x i + change ((K i).d k l) (((K i).d j k) (x i)) = 0 + exact ConcreteCategory.congr_hom ((K i).d_comp_d j k l) (x i) + +def moduleSumComplexInj (K : I → CochainComplex (ModuleCat.{max u v} R) ℤ) (i : I) : + K i ⟶ moduleSumComplex K := by + classical + refine { f := fun j => ModuleCat.ofHom (DFinsupp.lsingle (R := R) + (M := fun n => (K n).X j) i), comm' := ?_ } + intro j k hjk + ext x + change DFinsupp.mapRange (fun i => ((K i).d j k).hom) (fun i => map_zero _) (DFinsupp.single i x) = + DFinsupp.single i ((K i).d j k x) + rw [DFinsupp.mapRange_single] + +def moduleSumComplexCofan (K : I → CochainComplex (ModuleCat.{max u v} R) ℤ) : Cofan K := + Cofan.mk _ (moduleSumComplexInj K) + +def moduleSumComplexIsColimit (K : I → CochainComplex (ModuleCat.{max u v} R) ℤ) : + IsColimit (moduleSumComplexCofan K) := by + classical + refine Cofan.IsColimit.mk _ (fun s => + { f := fun j => ModuleCat.ofHom (DFinsupp.lsum ℤ (fun i => ((s.inj i).f j).hom)) + comm' := ?_ }) ?_ ?_ + · intro j k hjk + apply ModuleCat.hom_ext + apply DFinsupp.lhom_ext + intro i x + change s.pt.d j k (DFinsupp.lsum ℤ (fun i => ((s.inj i).f j).hom) + (DFinsupp.single i x)) = + DFinsupp.lsum ℤ (fun i => ((s.inj i).f k).hom) + (DFinsupp.mapRange (fun i => ((K i).d j k).hom) (fun i => map_zero _) (DFinsupp.single i x)) + simp only [DFinsupp.mapRange_single, DFinsupp.lsum_single] + exact ConcreteCategory.congr_hom ((s.inj i).comm j k) x + · intro s i + ext j x + change DFinsupp.lsum ℤ (fun i => ((s.inj i).f j).hom) (DFinsupp.single i x) = _ + simp only [DFinsupp.lsum_single] + · intro s m hm + apply HomologicalComplex.Hom.ext + funext j + apply ModuleCat.hom_ext + apply DFinsupp.lhom_ext + intro i x + change m.f j (DFinsupp.single i x) = + DFinsupp.lsum ℤ (fun i => ((s.inj i).f j).hom) (DFinsupp.single i x) + rw [DFinsupp.lsum_single] + exact ConcreteCategory.congr_hom (congrArg (fun f => f.f j) (hm i)) x + +end LittleFinitistic.DerivedSupport + +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Derived/Telescopes.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Derived/Telescopes.lean new file mode 100644 index 0000000000000000000000000000000000000000..70d57566f5bff7d006183b865af2060c927d1162 --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Derived/Telescopes.lean @@ -0,0 +1,177 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Derived.DerivedSums +import OAI.Algebra.FinitisticAsymmetry.Derived.ModuleSums + +namespace OAI + +noncomputable section + +open CategoryTheory CategoryTheory.Limits +open HomologicalComplex +namespace LittleFinitistic.DerivedSupport + +section +universe u v +variable {C : Type u} [Category.{v} C] [Preadditive C] +variable {X : ℕ → C} (f : ∀ n, X n ⟶ X (n+1)) (s : Cofan X) (hs : IsColimit s) + +def telescopeMap : s.pt ⟶ s.pt := + hs.desc (Cofan.mk s.pt (fun n => s.inj n - f n ≫ s.inj (n+1))) + +@[reassoc (attr := simp)] +lemma telescopeMap_inj (n : ℕ) : + s.inj n ≫ telescopeMap f s hs = s.inj n - f n ≫ s.inj (n+1) := + hs.fac _ (Discrete.mk n) + +def telescopeπ (c : Cocone (Functor.ofSequence f)) : s.pt ⟶ c.pt := + hs.desc (Cofan.mk c.pt c.ι.app) + +omit [Preadditive C] in +@[reassoc (attr := simp)] +lemma telescopeπ_inj (c : Cocone (Functor.ofSequence f)) (n : ℕ) : + s.inj n ≫ telescopeπ f s hs c = c.ι.app n := hs.fac _ (Discrete.mk n) + +lemma telescope_zero (c : Cocone (Functor.ofSequence f)) : + telescopeMap f s hs ≫ telescopeπ f s hs c = 0 := by + apply hs.hom_ext + intro n + change s.inj n.as ≫ _ = _ + rw [telescopeMap_inj_assoc, Preadditive.sub_comp, telescopeπ_inj, + Category.assoc, telescopeπ_inj, comp_zero] + have h := c.w (homOfLE (Nat.le_add_right n.as 1)) + simpa using! sub_eq_zero.mpr h.symm + +def telescopeCokernel (c : Cocone (Functor.ofSequence f)) (hc : IsColimit c) : + IsColimit (CokernelCofork.ofπ (telescopeπ f s hs c) (telescope_zero f s hs c)) := by + let d {Y : C} (g : s.pt ⟶ Y) (hg : telescopeMap f s hs ≫ g = 0) : + Cocone (Functor.ofSequence f) := + { pt := Y + ι := NatTrans.ofSequence (F := Functor.ofSequence f) (G := (Functor.const ℕ).obj Y) (fun n => s.inj n ≫ g) (fun n => by + have h := congrArg (fun t => s.inj n ≫ t) hg + rw [telescopeMap_inj_assoc, Preadditive.sub_comp, comp_zero] at h + dsimp only [Functor.const_obj_map] + rw [Functor.ofSequence_map_homOfLE_succ] + change f n ≫ (s.inj (n+1) ≫ g) = (s.inj n ≫ g) ≫ 𝟙 Y + simpa only [Category.comp_id, Category.assoc] using (sub_eq_zero.mp h).symm) } + refine CokernelCofork.IsColimit.ofπ _ _ (fun g hg => hc.desc (d g hg)) ?_ ?_ + · intro Y g hg + apply hs.hom_ext + intro n + change s.inj n.as ≫ _ = _ + erw [telescopeπ_inj_assoc, hc.fac] + rfl + · intro Y g hg m hm + apply hc.hom_ext + intro n + rw [hc.fac] + change c.ι.app n ≫ m = s.inj n ≫ g + rw [← hm, telescopeπ_inj_assoc] + rfl + +end + +section +universe u +variable {R : Type u} [Ring R] +variable (K : ℕ → CochainComplex (ModuleCat.{u} R) ℤ) (f : ∀ n, K n ⟶ K (n+1)) + +abbrev moduleTelescopeMap := telescopeMap f _ (moduleSumComplexIsColimit K) + +def moduleTelescopeLinear (j : ℤ) : (Π₀ n, (K n).X j) →ₗ[R] (Π₀ n, (K n).X j) := + ((moduleTelescopeMap K f).f j).hom + +lemma moduleTelescope_at_zero (j : ℤ) (x : Π₀ n, (K n).X j) : + (moduleTelescopeLinear K f j x) 0 = x 0 := by + classical + let : DecidableEq ℕ := Classical.typeDecidableEq ℕ + have h : (DFinsupp.lapply 0).comp (moduleTelescopeLinear K f j) = + (DFinsupp.lapply 0 : (Π₀ n, (K n).X j) →ₗ[R] (K 0).X j) := by + apply DFinsupp.lhom_ext + intro n y + have hlin := congrArg (fun t => (t.f j).hom) (telescopeMap_inj f _ (moduleSumComplexIsColimit K) n) + simp only [HomologicalComplex.comp_f, HomologicalComplex.sub_f_apply, ModuleCat.hom_sub, ModuleCat.hom_comp] at hlin + have hfun := LinearMap.congr_fun hlin y + simp only [moduleSumComplexCofan, cofan_mk_inj, moduleSumComplexInj] at hfun + have hsing : moduleTelescopeLinear K f j (DFinsupp.single n y) = + (DFinsupp.single n y : Π₀ n, (K n).X j) - DFinsupp.single (n+1) ((f n).f j y) := by + simpa [moduleTelescopeLinear, moduleTelescopeMap, moduleSumComplexCofan, moduleSumComplexInj, moduleSumComplex] using! hfun + change (moduleTelescopeLinear K f j (DFinsupp.single n y)) 0 = _ + rw [hsing, DFinsupp.sub_apply] + simp [DFinsupp.lapply_apply] + exact LinearMap.congr_fun h x + +lemma moduleTelescope_at_succ (j : ℤ) (x : Π₀ n, (K n).X j) (n : ℕ) : + (moduleTelescopeLinear K f j x) (n+1) = x (n+1) - (f n).f j (x n) := by + classical + let : DecidableEq ℕ := Classical.typeDecidableEq ℕ + have h : (DFinsupp.lapply (n+1)).comp (moduleTelescopeLinear K f j) = + (DFinsupp.lapply (n+1) : (Π₀ n, (K n).X j) →ₗ[R] (K (n+1)).X j) - + ((f n).f j).hom.comp (DFinsupp.lapply n) := by + apply DFinsupp.lhom_ext + intro m y + have hlin := congrArg (fun t => (t.f j).hom) (telescopeMap_inj f _ (moduleSumComplexIsColimit K) m) + simp only [HomologicalComplex.comp_f, HomologicalComplex.sub_f_apply, ModuleCat.hom_sub, ModuleCat.hom_comp] at hlin + have hfun := LinearMap.congr_fun hlin y + simp only [moduleSumComplexCofan, cofan_mk_inj, moduleSumComplexInj] at hfun + have hsing : moduleTelescopeLinear K f j (DFinsupp.single m y) = + (DFinsupp.single m y : Π₀ n, (K n).X j) - DFinsupp.single (m+1) ((f m).f j y) := by + simpa [moduleTelescopeLinear, moduleTelescopeMap, moduleSumComplexCofan, moduleSumComplexInj, moduleSumComplex] using! hfun + change (moduleTelescopeLinear K f j (DFinsupp.single m y)) (n+1) = _ + rw [hsing, DFinsupp.sub_apply] + by_cases hmn : m = n + · subst m + simp + · simp [hmn] + exact LinearMap.congr_fun h x + +instance moduleTelescopeMap_mono : Mono (moduleTelescopeMap K f) := by + apply HomologicalComplex.mono_of_mono_f + intro j + rw [ModuleCat.mono_iff_injective] + apply (injective_iff_map_eq_zero _).2 + change ∀ (x : Π₀ n, (K n).X j), moduleTelescopeLinear K f j x = 0 → x = 0 + intro x hx + have he (n : ℕ) : x n = 0 := by + induction n with + | zero => simpa [hx] using (moduleTelescope_at_zero K f j x).symm + | succ n ih => + have h := moduleTelescope_at_succ K f j x n + rw [hx, ih, map_zero, sub_zero] at h + exact h.symm + exact DFinsupp.ext he + +end + +universe u w +variable {R : Type u} [Ring R] +variable (K : ℕ → CochainComplex (ModuleCat.{u} R) ℤ) (f : ∀ n, K n ⟶ K (n+1)) +variable (c : Cocone (Functor.ofSequence f)) (hc : IsColimit c) + +def moduleTelescopeShortComplex : ShortComplex (CochainComplex (ModuleCat R) ℤ) := + ShortComplex.mk (moduleTelescopeMap K f) + (telescopeπ f _ (moduleSumComplexIsColimit K) c) + (telescope_zero f _ (moduleSumComplexIsColimit K) c) + +lemma moduleTelescope_shortExact (hc : IsColimit c) : (moduleTelescopeShortComplex K f c).ShortExact where + mono_f := by change Mono (moduleTelescopeMap K f); infer_instance + epi_g := epi_of_isColimit_cofork (telescopeCokernel f _ (moduleSumComplexIsColimit K) c hc) + exact := (moduleTelescopeShortComplex K f c).exact_of_g_is_cokernel + (telescopeCokernel f _ (moduleSumComplexIsColimit K) c hc) + +variable [HasDerivedCategory.{w} (ModuleCat.{u} R)] + +lemma localizing_sequence_colimit (hc : IsColimit c) (P : ObjectProperty (DerivedCategory (ModuleCat.{u} R))) + [P.IsTriangulated] [P.IsClosedUnderIsomorphisms] + [P.IsClosedUnderColimitsOfShape (Discrete ℕ)] + (hK : ∀ n, P (DerivedCategory.Q.obj (K n))) : P (DerivedCategory.Q.obj c.pt) := by + have hs : P (DerivedCategory.Q.obj (moduleSumComplex K)) := + P.prop_of_isColimit (derivedCofanIsColimit _ (moduleSumComplexIsColimit K)) + (fun n => hK n.as) + exact P.ext_of_isTriangulatedClosed₃ _ + (DerivedCategory.triangleOfSES_distinguished (moduleTelescope_shortExact K f c hc)) hs hs + +end LittleFinitistic.DerivedSupport + +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Derived/Truncations.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Derived/Truncations.lean new file mode 100644 index 0000000000000000000000000000000000000000..5294e3d9a637623c510e7f63d724c28ffb9b8e41 --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Derived/Truncations.lean @@ -0,0 +1,151 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Model + +namespace OAI + +noncomputable section + +open CategoryTheory CategoryTheory.Limits +open HomologicalComplex + +open CategoryTheory CategoryTheory.Limits HomologicalComplex +namespace LittleFinitistic.DerivedSupport +universe u +variable {R : Type u} [Ring R] + +def cutSub (K : CochainComplex (ModuleCat.{u} R) ℤ) (a j : ℤ) : Submodule R (K.X j) := + if a ≤ j then ⊤ else ⊥ + +lemma mem_cutSub {K : CochainComplex (ModuleCat.{u} R) ℤ} {a j : ℤ} {x : K.X j} : + x ∈ cutSub K a j ↔ a ≤ j ∨ x = 0 := by + by_cases h : a ≤ j <;> simp [cutSub, h] + +lemma cutSub_d {K : CochainComplex (ModuleCat.{u} R) ℤ} {a j k : ℤ} + {x : K.X j} (hx : x ∈ cutSub K a j) : K.d j k x ∈ cutSub K a k := by + rw [mem_cutSub] at hx ⊢ + by_cases h : (ComplexShape.up ℤ).Rel j k + · change j + 1 = k at h + rcases hx with hx | rfl + · exact Or.inl (by omega) + · exact Or.inr (map_zero _) + · rw [K.shape j k h] + exact Or.inr rfl + +def cut (K : CochainComplex (ModuleCat.{u} R) ℤ) (a : ℤ) : + CochainComplex (ModuleCat R) ℤ where + X j := ModuleCat.of R (cutSub K a j) + d j k := ModuleCat.ofHom + { toFun := fun x => ⟨K.d j k x, cutSub_d x.property⟩ + map_add' := fun x y => Subtype.ext (map_add _ _ _) + map_smul' := fun r x => Subtype.ext (map_smul _ _ _) } + shape j k hjk := by + ext x + change K.d j k x = 0 + rw [K.shape j k hjk] + rfl + d_comp_d' j k l hjk hkl := by + ext x + exact ConcreteCategory.congr_hom (K.d_comp_d j k l) x + +def cutι (K : CochainComplex (ModuleCat.{u} R) ℤ) (a : ℤ) : cut K a ⟶ K where + f j := ModuleCat.ofHom (cutSub K a j).subtype + comm' _ _ _ := rfl + +instance cutι_mono (K : CochainComplex (ModuleCat.{u} R) ℤ) (a : ℤ) : Mono (cutι K a) := by + apply HomologicalComplex.mono_of_mono_f + intro j + exact (ModuleCat.mono_iff_injective _).2 Subtype.val_injective + +lemma cutSub_le (K : CochainComplex (ModuleCat.{u} R) ℤ) {a b : ℤ} (h : b ≤ a) (j : ℤ) : + cutSub K a j ≤ cutSub K b j := by + intro x hx + rw [mem_cutSub] at hx ⊢ + exact hx.imp (le_trans h) id + +def cutMap (K : CochainComplex (ModuleCat.{u} R) ℤ) {a b : ℤ} (h : b ≤ a) : + cut K a ⟶ cut K b where + f j := ModuleCat.ofHom (Submodule.inclusion (cutSub_le K h j)) + comm' _ _ _ := rfl + +@[reassoc (attr := simp)] +lemma cutMap_ι (K : CochainComplex (ModuleCat.{u} R) ℤ) {a b : ℤ} (h : b ≤ a) : + cutMap K h ≫ cutι K b = cutι K a := rfl + +lemma cut_isZero_X (K : CochainComplex (ModuleCat.{u} R) ℤ) (a j : ℤ) (h : j < a) : + IsZero ((cut K a).X j) := by + apply ModuleCat.isZero_iff_subsingleton.2 + have : cutSub K a j = ⊥ := ite_eq_right (by omega) + change Subsingleton (cutSub K a j) + rw [this] + infer_instance + +lemma cutι_f_isIso (K : CochainComplex (ModuleCat.{u} R) ℤ) (a j : ℤ) (h : a ≤ j) : + IsIso ((cutι K a).f j) := by + rw [ConcreteCategory.isIso_iff_bijective] + refine ⟨Subtype.val_injective, fun x => ?_⟩ + exact ⟨⟨x, mem_cutSub.mpr (Or.inl h)⟩, rfl⟩ + +def cutπ (K : CochainComplex (ModuleCat.{u} R) ℤ) (a : ℤ) : + cut K a ⟶ (HomologicalComplex.single (ModuleCat R) (ComplexShape.up ℤ) a).obj (K.X a) := + mkHomToSingle ((cutι K a).f a) (fun i hi => by + have h : i < a := by change i + 1 = a at hi; omega + exact (cut_isZero_X K a i h).eq_of_src _ _) + +lemma cutMap_π (K : CochainComplex (ModuleCat.{u} R) ℤ) (a : ℤ) : + cutMap K (show a ≤ a+1 by omega) ≫ cutπ K a = 0 := by + apply to_single_hom_ext + apply (cut_isZero_X K (a+1) a (by omega)).eq_of_src + +instance cutMap_mono (K : CochainComplex (ModuleCat.{u} R) ℤ) {a b : ℤ} (h : b ≤ a) : + Mono (cutMap K h) := by + have : Mono (cutMap K h ≫ cutι K b) := by + rw [cutMap_ι] + infer_instance + exact mono_of_mono _ (cutι K b) + +instance cutπ_f_self_isIso (K : CochainComplex (ModuleCat.{u} R) ℤ) (a : ℤ) : + IsIso ((cutπ K a).f a) := by + dsimp only [cutπ] + rw [mkHomToSingle_f] + have := cutι_f_isIso K a a (le_refl a) + infer_instance + +instance cutπ_epi (K : CochainComplex (ModuleCat.{u} R) ℤ) (a : ℤ) : Epi (cutπ K a) := by + apply HomologicalComplex.epi_of_epi_f + intro j + by_cases h : j = a + · subst j; infer_instance + · exact (isZero_single_obj_X (ComplexShape.up ℤ) a (K.X a) j h).epi _ + +def cutShortComplex (K : CochainComplex (ModuleCat.{u} R) ℤ) (a : ℤ) : + ShortComplex (CochainComplex (ModuleCat R) ℤ) := + ShortComplex.mk (cutMap K (show a ≤ a+1 by omega)) (cutπ K a) (cutMap_π K a) + +lemma cut_shortExact (K : CochainComplex (ModuleCat.{u} R) ℤ) (a : ℤ) : + (cutShortComplex K a).ShortExact where + exact := by + apply HomologicalComplex.exact_of_degreewise_exact + intro j + rw [ShortComplex.moduleCat_exact_iff] + intro x hx + change ↥(cutSub K a j) at x + change (cutπ K a).f j x = 0 at hx + by_cases h : j = a + · subst j + have hi : Function.Injective ((cutπ K a).f a) := + (ModuleCat.mono_iff_injective _).1 inferInstance + have hx' : x = 0 := hi (hx.trans (map_zero _).symm) + exact ⟨0, by rw [hx']; rfl⟩ + · refine ⟨⟨(x : K.X j), ?_⟩, ?_⟩ + · have hx' := x.property + rw [mem_cutSub] at hx' ⊢ + exact hx'.imp (fun h' => by omega) id + · rfl + mono_f := by change Mono (cutMap K (show a ≤ a+1 by omega)); infer_instance + epi_g := by change Epi (cutπ K a); infer_instance + +end LittleFinitistic.DerivedSupport + +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Derived/UpperTruncation.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Derived/UpperTruncation.lean new file mode 100644 index 0000000000000000000000000000000000000000..d5b2620bc72d2fae9c93524b79ec510e7de5dbaf --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Derived/UpperTruncation.lean @@ -0,0 +1,144 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Derived.BoundedGeneration + +namespace OAI + +noncomputable section + +open CategoryTheory CategoryTheory.Limits +open HomologicalComplex + +open CategoryTheory CategoryTheory.Limits HomologicalComplex + +open CategoryTheory CategoryTheory.Limits HomologicalComplex +namespace LittleFinitistic.DerivedSupport + +section +universe u +variable {R : Type u} [Ring R] + +def upperSub (K : CochainComplex (ModuleCat.{u} R) ℤ) (a j : ℤ) : Submodule R (K.X j) := + if j < a then ⊤ else if j = a then LinearMap.ker (K.d j (j+1)).hom else ⊥ + +lemma mem_upperSub {K : CochainComplex (ModuleCat.{u} R) ℤ} {a j : ℤ} {x : K.X j} : + x ∈ upperSub K a j ↔ j < a ∨ (j = a ∧ K.d j (j+1) x = 0) ∨ x = 0 := by + by_cases h : j < a + · simp [upperSub, h] + · by_cases he : j = a + · simp [upperSub, he, LinearMap.mem_ker] + intro hx; subst x; exact map_zero _ + · simp [upperSub, h, he] + +lemma upperSub_d {K : CochainComplex (ModuleCat.{u} R) ℤ} {a j k : ℤ} + {x : K.X j} (hx : x ∈ upperSub K a j) : K.d j k x ∈ upperSub K a k := by + rw [mem_upperSub] at hx ⊢ + by_cases h : (ComplexShape.up ℤ).Rel j k + · change j + 1 = k at h + rcases hx with hx | ⟨rfl, hx⟩ | rfl + · by_cases hk : k < a + · exact Or.inl hk + · exact Or.inr (Or.inl ⟨by omega, + ConcreteCategory.congr_hom (K.d_comp_d j k (k+1)) x⟩) + · exact Or.inr (Or.inr (by rw [← h]; exact hx)) + · exact Or.inr (Or.inr (map_zero _)) + · rw [K.shape j k h] + exact Or.inr (Or.inr rfl) + +def upper (K : CochainComplex (ModuleCat.{u} R) ℤ) (a : ℤ) : + CochainComplex (ModuleCat R) ℤ where + X j := ModuleCat.of R (upperSub K a j) + d j k := ModuleCat.ofHom + { toFun := fun x => ⟨K.d j k x, upperSub_d x.property⟩ + map_add' := fun x y => Subtype.ext (map_add _ _ _) + map_smul' := fun r x => Subtype.ext (map_smul _ _ _) } + shape j k hjk := by + ext x + change K.d j k x = 0 + rw [K.shape j k hjk] + rfl + d_comp_d' j k l hjk hkl := by + ext x + exact ConcreteCategory.congr_hom (K.d_comp_d j k l) x + +def upperι (K : CochainComplex (ModuleCat.{u} R) ℤ) (a : ℤ) : upper K a ⟶ K where + f j := ModuleCat.ofHom (upperSub K a j).subtype + comm' _ _ _ := rfl + +lemma upper_le (K : CochainComplex (ModuleCat.{u} R) ℤ) {a b : ℤ} (h : a ≤ b) (j : ℤ) : + upperSub K a j ≤ upperSub K b j := by + intro x hx + rw [mem_upperSub] at hx ⊢ + rcases hx with hx | ⟨rfl, hx⟩ | rfl + · exact Or.inl (lt_of_lt_of_le hx h) + · rcases lt_or_eq_of_le h with hh | rfl + · exact Or.inl hh + · exact Or.inr (Or.inl ⟨rfl, hx⟩) + · exact Or.inr (Or.inr rfl) + +def upperMap (K : CochainComplex (ModuleCat.{u} R) ℤ) {a b : ℤ} (h : a ≤ b) : + upper K a ⟶ upper K b where + f j := ModuleCat.ofHom (Submodule.inclusion (upper_le K h j)) + comm' _ _ _ := by ext; rfl + +@[reassoc (attr := simp)] +lemma upperMap_ι (K : CochainComplex (ModuleCat.{u} R) ℤ) {a b : ℤ} (h : a ≤ b) : + upperMap K h ≫ upperι K b = upperι K a := by ext; rfl + +lemma upperι_f_isIso (K : CochainComplex (ModuleCat.{u} R) ℤ) (a j : ℤ) (hj : j < a) : + IsIso ((upperι K a).f j) := by + rw [ConcreteCategory.isIso_iff_bijective] + exact ⟨Subtype.val_injective, fun x => ⟨⟨x, by simp [upperSub, hj]⟩, rfl⟩⟩ + +lemma upper_isZero_X (K : CochainComplex (ModuleCat.{u} R) ℤ) (a j : ℤ) (hj : a < j) : + IsZero ((upper K a).X j) := by + apply ModuleCat.isZero_iff_subsingleton.2 + change Subsingleton (upperSub K a j) + simp only [upperSub, show ¬ j < a by omega, ↓reduceIte, show ¬ j = a by omega] + infer_instance + +end + +universe u w +variable {R : Type u} [Ring R] +variable (K : CochainComplex (ModuleCat.{u} R) ℤ) + +def upperSequenceMap (n : ℕ) : upper K (n : ℤ) ⟶ upper K ((n+1 : ℕ) : ℤ) := + upperMap K (by omega) + +def upperSequenceCocone : Cocone (Functor.ofSequence (upperSequenceMap K)) where + pt := K + ι := NatTrans.ofSequence (fun n => upperι K (n : ℤ)) (fun n => by + simp [upperSequenceMap] + exact (upperMap_ι K _).trans (Category.comp_id _).symm) + +def upperSequenceIsColimit : IsColimit (upperSequenceCocone K) := by + apply HomologicalComplex.isColimitOfEval + intro j + apply eventuallyIsoCoconeIsColimit _ (j.toNat + 1) + intro n hn + change IsIso ((upperι K (n : ℤ)).f j) + exact upperι_f_isIso K _ _ (by omega) + +variable [HasDerivedCategory.{w} (ModuleCat.{u} R)] +variable (P : ObjectProperty (DerivedCategory (ModuleCat.{u} R))) + [P.IsTriangulated] [P.IsClosedUnderIsomorphisms] + [P.IsClosedUnderColimitsOfShape (Discrete ℕ)] + +lemma prop_of_all_modules + (hM : ∀ (M : ModuleCat R), P ((DerivedCategory.singleFunctor (ModuleCat R) 0).obj M)) : + P (DerivedCategory.Q.obj K) := by + exact localizing_sequence_colimit (fun n => upper K (n : ℤ)) (upperSequenceMap K) + (upperSequenceCocone K) (upperSequenceIsColimit K) P (fun n => + prop_of_boundedAbove_terms P (upper K _) n (upper_isZero_X K _) (fun j => hM _)) + +lemma localizing_eq_top_of_all_modules + (hM : ∀ (M : ModuleCat R), P ((DerivedCategory.singleFunctor (ModuleCat R) 0).obj M)) + (X : DerivedCategory (ModuleCat R)) : P X := by + exact P.prop_of_iso (DerivedCategory.Q.objObjPreimageIso X) + (prop_of_all_modules (DerivedCategory.Q.objPreimage X) P hM) + +end LittleFinitistic.DerivedSupport + +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Kasch/FiniteDimension.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Kasch/FiniteDimension.lean new file mode 100644 index 0000000000000000000000000000000000000000..d23b393b905e2666b0924e20ceca3560b94e76ab --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Kasch/FiniteDimension.lean @@ -0,0 +1,61 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Kasch.ProjectiveSplitting + +namespace OAI + +section +section +noncomputable section +open CategoryTheory +namespace LittleFinitistic +universe u +variable (A : Type u) [Ring A] +namespace Kasch +universe v w +variable {R : Type u} [Ring R] +section SplitBasic +variable {k : Type u} [Field k] [Algebra k R] +variable {ι : Type u} (χ : R →ₐ[k] (ι → k)) +variable (a : ι → R) (ha : ∀ i, a i ≠ 0) + (hmul : ∀ i r, a i * r = χ r i • a i) +include ha hmul in +lemma projective_of_hasFiniteBound [Finite ι] + (hχ : Function.Surjective χ) (hJ : ∃ n : ℕ, (RingHom.ker χ.toRingHom) ^ n = ⊥) + (M : ModuleCat.{u} R) (n : ℕ) [HasProjectiveDimensionLT M n] : Projective M := by + induction n generalizing M with + | zero => + exact (CategoryTheory.isZero_of_hasProjectiveDimensionLT_zero M).projective + | succ n ih => + cases n with + | zero => exact projective_iff_hasProjectiveDimensionLT_one.mpr inferInstance + | succ n => + let S := ShortComplex.mk (Limits.kernel.ι (Projective.π M)) (Projective.π M) + (Limits.kernel.condition (Projective.π M)) + have hs : S.ShortExact := { exact := ShortComplex.exact_kernel (Projective.π M) } + let : HasProjectiveDimensionLT S.X₁ (n + 1) := + (hs.hasProjectiveDimensionLT_X₃_iff n inferInstance).mp inferInstance + let : Projective S.X₁ := ih S.X₁ + obtain ⟨r, hr⟩ := projective_mono_splits χ a ha hmul hχ hJ S.f.hom + ((ModuleCat.mono_iff_injective S.f).mp hs.mono_f) + let spl := ShortComplex.Splitting.ofExactOfRetraction S hs.exact + (ModuleCat.ofHom r) (ModuleCat.hom_ext hr) hs.epi_g + exact (show Retract M S.X₂ from + { i := spl.s, r := S.g, retract := spl.s_g }).projective + +include ha hmul in +lemma projective_of_finiteDimension [Finite ι] + (hχ : Function.Surjective χ) (hJ : ∃ n : ℕ, (RingHom.ker χ.toRingHom) ^ n = ⊥) + (M : ModuleCat.{u} R) (hM : projectiveDimension M < ⊤) : Projective M := by + obtain ⟨n, hn⟩ := (projectiveDimension_ne_top_iff M).mp hM.ne + let := hn + exact projective_of_hasFiniteBound χ a ha hmul hχ hJ M (n + 1) + +end SplitBasic +end Kasch + +end LittleFinitistic +end +end +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Kasch/ProjectiveSplitting.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Kasch/ProjectiveSplitting.lean new file mode 100644 index 0000000000000000000000000000000000000000..b9cd8afddf17c109e5f7c707ef4d26d1f23d54c0 --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Kasch/ProjectiveSplitting.lean @@ -0,0 +1,126 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Kasch.Radical + +namespace OAI + +section +section +noncomputable section +open CategoryTheory +namespace LittleFinitistic +universe u +variable (A : Type u) [Ring A] +namespace Kasch +universe v w +variable {R : Type u} [Ring R] +section SplitBasic +variable {k : Type u} [Field k] [Algebra k R] +variable {ι : Type u} (χ : R →ₐ[k] (ι → k)) +variable (a : ι → R) (ha : ∀ i, a i ≠ 0) + (hmul : ∀ i r, a i * r = χ r i • a i) + +include hmul in +lemma annihilates_radical {P : Type v} [AddCommGroup P] [Module R P] + {x : P} (hx : x ∈ radicalPart (RingHom.ker χ.toRingHom) P) (i : ι) : a i • x = 0 := by + refine Submodule.smul_induction_on hx ?_ ?_ + · intro r hr y hy + rw [← mul_smul, hmul] + have h : χ r = 0 := hr + simp [h] + · intro x y hx hy + simp only [smul_add, hx, hy, add_zero] + +include ha hmul in +lemma finsupp_mem_radical_of_annihilated {σ : Type v} (x : σ →₀ R) + (hx : ∀ i, a i • x = 0) : x ∈ radicalPart (RingHom.ker χ.toRingHom) (σ →₀ R) := by + classical + have hcoef (s : σ) : χ (x s) = 0 := by + ext i + have hi : a i * x s = 0 := congrArg (fun y : σ →₀ R => y s) (hx i) + rw [hmul] at hi + exact (smul_eq_zero.mp hi).resolve_right (ha i) + rw [← Finsupp.sum_single x] + apply Submodule.sum_mem + intro s hs + have heq : Finsupp.single s (x s) = x s • Finsupp.single s (1 : R) := by simp + rw [heq] + exact Submodule.smul_mem_smul (hcoef s) (Submodule.mem_top) + +include ha hmul in +lemma projective_mem_radical_iff {P : Type v} [AddCommGroup P] [Module R P] + [Module.Projective R P] (x : P) : + x ∈ radicalPart (RingHom.ker χ.toRingHom) P ↔ ∀ i, a i • x = 0 := by + constructor + · exact fun hx i => annihilates_radical χ a hmul hx i + · intro hx + obtain ⟨s, hs⟩ := (Module.projective_def' (R := R) (P := P)).mp inferInstance + have hx' : s x ∈ radicalPart (RingHom.ker χ.toRingHom) (P →₀ R) := + finsupp_mem_radical_of_annihilated χ a ha hmul (s x) (fun i => by + rw [← s.map_smul, hx i, map_zero]) + have he : (Finsupp.linearCombination R id) (s x) = x := DFunLike.congr_fun hs x + rw [← he] + exact map_radical_le (RingHom.ker χ.toRingHom) (Finsupp.linearCombination R id) + (Submodule.mem_map_of_mem hx') + +include ha hmul in +lemma projective_mono_reflects_radical {P : Type v} {Q : Type w} + [AddCommGroup P] [Module R P] [Module.Projective R P] + [AddCommGroup Q] [Module R Q] + (f : P →ₗ[R] Q) (hf : Function.Injective f) {x : P} + (hx : f x ∈ radicalPart (RingHom.ker χ.toRingHom) Q) : + x ∈ radicalPart (RingHom.ker χ.toRingHom) P := by + rw [projective_mem_radical_iff χ a ha hmul] + intro i + apply hf + rw [map_smul, map_zero] + exact annihilates_radical χ a hmul hx i + +include ha hmul in +lemma projective_mono_splits [Finite ι] + (hχ : Function.Surjective χ) (hJ : ∃ n : ℕ, (RingHom.ker χ.toRingHom) ^ n = ⊥) + {P : Type v} {Q : Type w} [AddCommGroup P] [Module R P] [Module.Projective R P] + [AddCommGroup Q] [Module R Q] [Module.Projective R Q] + (f : P →ₗ[R] Q) (hf : Function.Injective f) : + ∃ g : Q →ₗ[R] P, g.comp f = LinearMap.id := by + let J := RingHom.ker χ.toRingHom + let p := radicalPart J P + let q := radicalPart J Q + let fbar : P ⧸ p →ₗ[R] Q ⧸ q := p.mapQ q f + (Submodule.map_le_iff_le_comap.mp (map_radical_le J f)) + have hfbar : Function.Injective fbar := by + apply LinearMap.ker_eq_bot.mp + apply le_bot_iff.mp + intro x hx + obtain ⟨x, rfl⟩ := p.mkQ_surjective x + have hx' : f x ∈ q := (Submodule.Quotient.mk_eq_zero q).mp hx + exact (Submodule.Quotient.mk_eq_zero p).mpr + (projective_mono_reflects_radical χ a ha hmul f hf hx') + let : IsSemisimpleModule R (Q ⧸ q) := top_semisimple χ.toRingHom hχ Q + obtain ⟨gbar, hgbar⟩ := IsSemisimpleModule.extension_property fbar hfbar + (LinearMap.id : P ⧸ p →ₗ[R] P ⧸ p) + obtain ⟨g, hg⟩ := Module.projective_lifting_property p.mkQ (gbar.comp q.mkQ) + p.mkQ_surjective + have hnil : IsNilpotent (1 - g.comp f : Module.End R P) := by + apply isNilpotent_of_range_le_radical J hJ + rintro _ ⟨x, rfl⟩ + apply (Submodule.Quotient.mk_eq_zero p).mp + change p.mkQ (x - g (f x)) = 0 + rw [map_sub] + have hg' := DFunLike.congr_fun hg (f x) + have hgbar' := DFunLike.congr_fun hgbar (p.mkQ x) + change p.mkQ (g (f x)) = gbar (q.mkQ (f x)) at hg' + change gbar (q.mkQ (f x)) = p.mkQ x at hgbar' + rw [hg', hgbar', sub_self] + have hu : IsUnit (g.comp f) := by simpa using hnil.isUnit_one_sub + obtain ⟨u, hu⟩ := hu.exists_left_inv + refine ⟨u.comp g, ?_⟩ + simpa only [Module.End.mul_eq_comp, Module.End.one_eq_id, LinearMap.comp_assoc] using hu + +end SplitBasic +end Kasch +end LittleFinitistic +end +end +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Kasch/Radical.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Kasch/Radical.lean new file mode 100644 index 0000000000000000000000000000000000000000..3c153fd826747cff9ef723aecd0ebad1e2855000 --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Kasch/Radical.lean @@ -0,0 +1,60 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Model + +namespace OAI + +section +section +noncomputable section +open CategoryTheory +namespace LittleFinitistic +universe u +variable (A : Type u) [Ring A] +namespace Kasch + +universe v w +variable {R : Type u} [Ring R] + +abbrev radicalPart (J : Ideal R) (M : Type v) [AddCommGroup M] [Module R M] : + Submodule R M := J • (⊤ : Submodule R M) + +lemma map_radical_le (J : Ideal R) {P : Type v} {Q : Type w} + [AddCommGroup P] [Module R P] [AddCommGroup Q] [Module R Q] + (f : P →ₗ[R] Q) : (radicalPart J P).map f ≤ radicalPart J Q := by + rw [radicalPart, Submodule.map_smul''] + exact Submodule.smul_mono le_rfl le_top + +lemma isNilpotent_of_range_le_radical {P : Type v} [AddCommGroup P] [Module R P] + (J : Ideal R) [J.IsTwoSided] (hJ : ∃ n : ℕ, J ^ n = ⊥) + (f : P →ₗ[R] P) (hf : LinearMap.range f ≤ radicalPart J P) : IsNilpotent f := by + have hn (n : ℕ) : LinearMap.range (f ^ n) ≤ J ^ n • (⊤ : Submodule R P) := by + induction n with + | zero => simp [Submodule.pow_zero, Ideal.one_eq_top] + | succ n ih => + rw [pow_succ, Module.End.mul_eq_comp, LinearMap.range_comp] + apply le_trans (Submodule.map_mono hf) + rw [radicalPart, Submodule.map_smul'', Submodule.map_top] + apply le_trans (Submodule.smul_mono le_rfl ih) + rw [← Submodule.mul_smul, Ideal.IsTwoSided.pow_succ] + obtain ⟨n, hnil⟩ := hJ + refine ⟨n, ?_⟩ + apply LinearMap.range_eq_bot.mp + apply le_bot_iff.mp + simpa [hnil] using hn n + +lemma top_semisimple {S : Type v} [Ring S] [IsSemisimpleRing S] + (χ : R →+* S) (hχ : Function.Surjective χ) + (M : Type w) [AddCommGroup M] [Module R M] : + IsSemisimpleModule R (M ⧸ radicalPart (RingHom.ker χ) M) := by + let : IsSemisimpleRing (R ⧸ (RingHom.ker χ)) := + (χ.quotientKerEquivOfSurjective hχ).symm.isSemisimpleRing + exact (Module.isTorsionBySet_quotient_ideal_smul M (RingHom.ker χ)).isSemisimpleModule_iff.mp + inferInstance + +end Kasch +end LittleFinitistic +end +end +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Main.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Main.lean new file mode 100644 index 0000000000000000000000000000000000000000..80f71b7aaf2147e953e01e13b5119990296f9f5f --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Main.lean @@ -0,0 +1,65 @@ +import Mathlib +import OAI.Algebra.Finitistic.Main +import OAI.Algebra.FinitisticAsymmetry.Transport.DiagramMaps +import OAI.Algebra.FinitisticAsymmetry.Asymmetry +import OAI.Algebra.FinitisticAsymmetry.Augmentation.Directed +import OAI.Algebra.FinitisticAsymmetry.Augmentation.SplitBasic + +namespace OAI + +section +noncomputable section +open scoped TensorProduct +namespace LittleFinitistic.SelectedBasic +open SelectedOrdinaryAlgebra SelectedFixedDiagram QuadraticEncoding +open OrdinarySimulation SplitBasic + +def baseSystem := ThreeVertexAlgebra.directedSystem (composition P) +def chainSystem := ChainAlgebra.directedSystem ℂ length +def tensorSystem := TensorDirected.directedSystem baseSystem chainSystem +abbrev Vertices := Sum baseSystem.Vertices tensorSystem.Vertices + +def diagonalAugmentation : D →ₐ[ℂ] (Vertices → ℂ) := + productAugmentation baseSystem.augmentation tensorSystem.augmentation +lemma diagonal_surjective : Function.Surjective diagonalAugmentation := + product_surjective _ _ baseSystem.augmentation_surjective tensorSystem.augmentation_surjective +lemma diagonal_ker_nilpotent : + ∃ n : ℕ, (RingHom.ker diagonalAugmentation.toRingHom)^n = ⊥ := + product_ker_nilpotent _ _ baseSystem.augmentation_ker_nilpotent tensorSystem.augmentation_ker_nilpotent + +def augmentationA : A →ₐ[ℂ] (Vertices → ℂ) := + squareZeroAugmentation (M := X) diagonalAugmentation +lemma augmentationA_surjective : Function.Surjective augmentationA := + squareZero_surjective _ diagonal_surjective +lemma augmentationA_ker_nilpotent : + ∃ n : ℕ, (RingHom.ker augmentationA.toRingHom)^n = ⊥ := + squareZero_ker_nilpotent _ diagonal_ker_nilpotent + +def augmentationC : Aᵐᵒᵖ →ₐ[ℂ] (Vertices → ℂ) := oppositeAugmentation augmentationA +lemma augmentationC_surjective : Function.Surjective augmentationC := + opposite_surjective _ augmentationA_surjective +lemma augmentationC_ker_nilpotent : + ∃ n : ℕ, (RingHom.ker augmentationC.toRingHom)^n = ⊥ := + opposite_ker_nilpotent _ augmentationA_ker_nilpotent +end LittleFinitistic.SelectedBasic + +namespace LittleFinitistic + +theorem extreme_left_right_asymmetry : + ∃ (Λ : Type) (_ : Ring Λ) (_ : Algebra ℂ Λ), + FiniteDimensional ℂ Λ ∧ + littleFinitisticDimension Λ = ⊤ ∧ bigFinitisticDimension Λ = ⊤ ∧ + littleFinitisticDimension Λᵐᵒᵖ = 0 ∧ bigFinitisticDimension Λᵐᵒᵖ = 0 ∧ + ¬ InjectivesGenerate Λ ∧ InjectivesGenerate Λᵐᵒᵖ := by + classical + let Λ := AsymmetryConstruction.Lambda SelectedBasic.augmentationC + refine ⟨Λ, inferInstance, inferInstance, ?_⟩ + exact AsymmetryConstruction.all_clauses SelectedBasic.augmentationC + SelectedBasic.augmentationC_surjective SelectedBasic.augmentationC_ker_nilpotent + Main.infinite_littleFinitisticDimension +end LittleFinitistic + +end +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Model.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Model.lean new file mode 100644 index 0000000000000000000000000000000000000000..f73a7f0c006a27e8abe422a1d7cfbcd78cd86a98 --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Model.lean @@ -0,0 +1,27 @@ +import Mathlib +import OAI.Algebra.Finitistic.Basic + +namespace OAI + +noncomputable section +open CategoryTheory +namespace LittleFinitistic +universe u +variable (A : Type u) [Ring A] + +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 + +end LittleFinitistic +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Nakayama/Coinduction.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Nakayama/Coinduction.lean new file mode 100644 index 0000000000000000000000000000000000000000..48913a23f953fbb51732a512dfa052425d43e97f --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Nakayama/Coinduction.lean @@ -0,0 +1,134 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Nakayama.Modules +import OAI.Algebra.FinitisticAsymmetry.Rickard.InjectiveSums + +namespace OAI + +noncomputable section + +open CategoryTheory CategoryTheory.Limits Module +namespace LittleFinitistic.Nakayama +universe u +variable (k R : Type u) [Field k] [Ring R] [Algebra k R] [FiniteDimensional k R] + +lemma da_finite : Module.Finite R (DA k R) := by + let : Module.Finite k (DA k R) := Module.Finite.equiv (daEquiv k R).symm + exact Module.Finite.of_restrictScalars_finite k R _ + +variable {k R} +def coindLine (V : ModuleCat.{u} k) (v : V) : DA k R →ₗ[R] coind k R V := + ((ModuleCat.coextendScalars (algebraMap k R)).map + (ModuleCat.ofHom ((LinearMap.id : k →ₗ[k] k).smulRight v))).hom + +omit [FiniteDimensional k R] in +@[simp] lemma coindLine_apply (V : ModuleCat.{u} k) (v : V) (φ : DA k R) (r : R) : + coindLine V v φ r = φ r • v := rfl + +omit [FiniteDimensional k R] in +@[simp] private lemma coind_zero_eval (V : ModuleCat.{u} k) (r : R) : + (0 : coind k R V) r = 0 := rfl + +omit [FiniteDimensional k R] in +private lemma coind_sum_eval {J : Type*} (s : Finset J) (V : ModuleCat.{u} k) + (f : J → coind k R V) (r : R) : + (∑ j ∈ s, f j) r = ∑ j ∈ s, f j r := by + change (ModuleCat.CoextendScalars.equiv (algebraMap k R) V (∑ j ∈ s, f j)) r = _ + rw [map_sum] + exact LinearMap.sum_apply _ _ _ + +variable {ι : Type u} +def coindBasisMap (V : ModuleCat.{u} k) (b : Basis ι k V) : + (Π₀ _ : ι, DA k R) →ₗ[R] coind k R V := by + classical + exact DFinsupp.lsum ℤ (fun i => coindLine V (b i)) + +omit [FiniteDimensional k R] in +lemma coindBasisMap_injective (V : ModuleCat.{u} k) (b : Basis ι k V) : + Function.Injective (coindBasisMap (R := R) V b) := by + classical + apply LinearMap.ker_eq_bot.mp + apply bot_unique + intro φ hφ + change φ = 0 + apply DFinsupp.ext + intro i + apply ModuleCat.CoextendScalars.ext + apply LinearMap.ext + intro r + change R at r + change φ i r = 0 + have h := congrArg (fun g : coind k R V => b.repr (g r) i) hφ + rw [coind_zero_eval, map_zero, Finsupp.zero_apply] at h + change coindBasisMap V b φ = 0 at hφ + have he : coindBasisMap V b φ r = ∑ j ∈ φ.support, φ j r • b j := by + have hexp : coindBasisMap V b φ = ∑ j ∈ φ.support, coindLine V (b j) (φ j) := by + simp [coindBasisMap, DFinsupp.lsum_apply_apply, DFinsupp.sumAddHom_apply, DFinsupp.sum] + rw [hexp, coind_sum_eval] + simp only [coindLine_apply] + rw [he] at h + simp only [map_sum, map_smul, b.repr_self, Finsupp.finsetSum_apply, Finsupp.smul_apply, + Finsupp.single_apply, smul_eq_mul, mul_ite, mul_one, mul_zero] at h + by_cases hi : i ∈ φ.support + · simpa [hi] using h + · have hh := DFinsupp.notMem_support_iff.mp hi + rw [hh] + rfl + +lemma coindBasisMap_surjective + (V : ModuleCat.{u} k) (b : Basis ι k V) : + Function.Surjective (coindBasisMap (R := R) V b) := by + classical + intro φ + let φ' : R →ₗ[k] V := { + toFun := φ + map_add' := φ.map_add + map_smul' := coind_smul_eval k R V φ } + let g : R →ₗ[k] Π₀ _ : ι, k := (finsuppLequivDFinsupp k).toLinearMap.comp + (b.repr.toLinearMap.comp φ') + obtain ⟨s, hs⟩ := Rickard.finite_support_map (R := k) (fun _ : ι => k) R g + let c (i : ι) : DA k R := (daEquiv k R).symm ((Finsupp.lapply i).comp + (b.repr.toLinearMap.comp φ')) + let x : Π₀ _ : ι, DA k R := ∑ i ∈ s, DFinsupp.single i (c i) + refine ⟨x, ?_⟩ + apply LinearMap.ext + intro r + change R at r + change coindBasisMap V b x r = φ r + have he : coindBasisMap V b x r = ∑ i ∈ s, b.repr (φ r) i • b i := by + have hx : coindBasisMap V b x = ∑ i ∈ s, coindLine V (b i) (c i) := by + simp only [x, map_sum, coindBasisMap, DFinsupp.lsum_single] + rw [hx, coind_sum_eval] + apply Finset.sum_congr rfl + intro i hi + rfl + rw [he] + apply b.repr.injective + ext i + by_cases hi : i ∈ s + · simp [Finsupp.finsetSum_apply, Finsupp.single_apply, hi] + · have hh := hs r i hi + change b.repr (φ r) i = 0 at hh + simp [Finsupp.finsetSum_apply, Finsupp.single_apply, hi, hh] + +variable (k R) +lemma coindBasisMap_bijective (V : ModuleCat.{u} k) (b : Basis ι k V) : + Function.Bijective (coindBasisMap (R := R) V b) := + ⟨coindBasisMap_injective V b, coindBasisMap_surjective V b⟩ + +def moduleCoindInclusion (M : ModuleCat.{u} R) : + M ⟶ coind k R ((ModuleCat.restrictScalars (algebraMap k R)).obj M) := + (ModuleCat.restrictCoextendScalarsAdj (algebraMap k R)).unit.app M + +omit [FiniteDimensional k R] in +lemma moduleCoindInclusion_mono (M : ModuleCat.{u} R) : Mono (moduleCoindInclusion k R M) := by + apply (ModuleCat.mono_iff_injective _).mpr + intro x y h + have hh := congrArg (fun g : coind k R ((ModuleCat.restrictScalars (algebraMap k R)).obj M) => g (1 : R)) h + change (1 : R) • x = (1 : R) • y at hh + simpa using hh + +end LittleFinitistic.Nakayama + +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Nakayama/Minimality.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Nakayama/Minimality.lean new file mode 100644 index 0000000000000000000000000000000000000000..fa5ad1bc44120ff8336aa9b8227a4fe6ede55e5a --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Nakayama/Minimality.lean @@ -0,0 +1,81 @@ +import Mathlib +import OAI.Algebra.Finitistic.Dimension.PDMinimalData +import OAI.Algebra.FinitisticAsymmetry.Nakayama.Modules + +namespace OAI + +noncomputable section + +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.Nakayama +universe u +variable {k R : Type u} [Field k] [Ring R] [Algebra k R] + +lemma split_of_dual_surjective {P Q : ModuleCat.{u} R} (F : Frame R P) + (d : P ⟶ Q) (h : Function.Surjective (LinearMap.lcomp k R d.hom)) : + ∃ s : Q ⟶ P, d ≫ s = 𝟙 P := by + classical + choose c hc using fun i => h (F.c i) + let s : Q →ₗ[R] P := ∑ i, (c i).smulRight (F.b i) + refine ⟨ModuleCat.ofHom s, ?_⟩ + apply ModuleCat.hom_ext + ext x + change s (d x) = x + simp only [s, LinearMap.sum_apply, LinearMap.smulRight_apply] + have hh (i : Fin F.n) : c i (d x) = F.c i x := LinearMap.congr_fun (hc i) x + simp only [hh] + exact F.expand x + +lemma nakayama_map_not_injective {P Q : ModuleCat.{u} R} + [Module.Finite R P] [Module.Projective R P] [Nontrivial P] + (d : P ⟶ Q) (h : ¬ ∃ s : Q ⟶ P, d ≫ s = 𝟙 P) : + ¬ Function.Injective (map (k := k) d) := by + intro hd + apply h + obtain ⟨F⟩ := frame_nonempty R P + apply split_of_dual_surjective (k := k) F d + apply LinearMap.dualMap_injective_iff.mp + exact hd + +variable [FiniteDimensional k R] + +lemma minimal_differential_not_split (M : PDMinimal.FiniteModule k R) (n : ℕ) + [Nontrivial (PDMinimal.term M (n+1))] : + ¬ ∃ s : (PDMinimal.term M n).cat ⟶ (PDMinimal.term M (n+1)).cat, + ModuleCat.ofHom (PDMinimal.differential M n) ≫ s = 𝟙 _ := by + rintro ⟨s, hs⟩ + let d := PDMinimal.differential M n + let e : PDMinimal.term M n →ₗ[R] PDMinimal.term M n := LinearMap.id - d.comp s.hom + have he : (PDMinimal.augment M n).comp e = PDMinimal.augment M n := by + ext x + change PDMinimal.augment M n (x - d (s x)) = PDMinimal.augment M n x + rw [map_sub] + have hh := LinearMap.congr_fun (PDMinimal.augment_differential M n) (s x) + change PDMinimal.augment M n (d (s x)) = 0 at hh + rw [hh, sub_zero] + have hes : Function.Surjective e := (PDMinimal.cover _).minimal e he + have hei : Function.Injective e := + (LinearMap.injective_iff_surjective_of_finrank_eq_finrank (f := e.restrictScalars k) rfl).mpr hes + have hd (x : PDMinimal.term M (n+1)) : d x = 0 := by + have hh : s (d x) = x := ConcreteCategory.congr_hom hs x + apply hei + change d x - d (s (d x)) = 0 - d (s 0) + erw [hh, sub_self, map_zero, map_zero, sub_self] + have hz (x : PDMinimal.term M (n+1)) : x=0 := by + have hh : s (d x) = x := ConcreteCategory.congr_hom hs x + erw [hd, map_zero] at hh + exact hh.symm + obtain ⟨x,y,hxy⟩ := exists_pair_ne (PDMinimal.term M (n+1)) + exact hxy ((hz x).trans (hz y).symm) + +lemma minimal_nakayama_differential_noninjective (M : PDMinimal.FiniteModule k R) (n : ℕ) + [Nontrivial (PDMinimal.term M (n+1))] : + ¬ Function.Injective (map (k := k) (ModuleCat.ofHom (PDMinimal.differential M n))) := by + apply nakayama_map_not_injective + exact minimal_differential_not_split M n + +end LittleFinitistic.Nakayama + +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Nakayama/Modules.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Nakayama/Modules.lean new file mode 100644 index 0000000000000000000000000000000000000000..fd7ef3bc2972b631300750cdbc1da3194214c00a --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Nakayama/Modules.lean @@ -0,0 +1,325 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Model + +namespace OAI + +noncomputable section + +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.Nakayama +universe u +variable (k R : Type u) [Field k] [Ring R] [Algebra k R] + +abbrev rightMult (M : ModuleCat.{u} R) (r : R) : (M →ₗ[R] R) →ₗ[k] (M →ₗ[R] R) := + LinearMap.compRight k (LinearMap.mulRight R r) + +@[simp] lemma rightMult_apply (M : ModuleCat.{u} R) (r : R) (f : M →ₗ[R] R) (x : M) : + rightMult k R M r f x = f x * r := rfl + +def Object (M : ModuleCat.{u} R) := Module.Dual k (M →ₗ[R] R) + +namespace Object +variable {k R} +def value {M : ModuleCat.{u} R} (x : Object k R M) : Module.Dual k (M →ₗ[R] R) := x +instance (M : ModuleCat.{u} R) : AddCommGroup (Object k R M) := inferInstanceAs (AddCommGroup (Module.Dual k (M →ₗ[R] R))) +instance (M : ModuleCat.{u} R) : Module k (Object k R M) := inferInstanceAs (Module k (Module.Dual k (M →ₗ[R] R))) +@[ext] lemma ext {M : ModuleCat.{u} R} {x y : Object k R M} (h : ∀ f, value x f = value y f) : x = y := LinearMap.ext h +instance (M : ModuleCat.{u} R) : Module R (Object k R M) where + smul r f := (value f).comp (rightMult k R M r) + one_smul f := by + ext g + change (value f) (rightMult k R M 1 g) = (value f) g + congr 1 + ext x + exact mul_one _ + mul_smul r s f := by + ext g + change (value f) ((rightMult k R M (r*s)) g) = + (value f) (rightMult k R M s (rightMult k R M r g)) + congr 1 + ext x + simp [mul_assoc] + smul_zero r := by ext g; rfl + smul_add r f g := by ext h; rfl + zero_smul f := by + ext g + change (value f) (rightMult k R M 0 g) = 0 + have : rightMult k R M 0 g = 0 := by ext x; exact mul_zero _ + rw [this, map_zero] + add_smul r s f := by + ext g + change (value f) (rightMult k R M (r+s) g) = + (value f) (rightMult k R M r g) + (value f) (rightMult k R M s g) + rw [← map_add] + congr 1 + ext x + simp [mul_add] + +instance (M : ModuleCat.{u} R) : SMulCommClass R k (Object k R M) where + smul_comm r a f := by ext g; rfl +instance (M : ModuleCat.{u} R) : IsScalarTower k R (Object k R M) where + smul_assoc a r f := by + ext g + change (value f) (rightMult k R M (a • r) g) = a • (value f) (rightMult k R M r g) + rw [← map_smul] + congr 1 + ext x + exact mul_smul_comm _ _ _ +end Object + +variable {k R} +def map {M N : ModuleCat.{u} R} (f : M ⟶ N) : Object k R M →ₗ[R] Object k R N where + toFun h := (Object.value h).comp (LinearMap.lcomp k R f.hom) + map_add' _ _ := rfl + map_smul' r h := by + ext g + change (Object.value h) (rightMult k R M r ((LinearMap.lcomp k R f.hom) g)) = + (Object.value h) ((LinearMap.lcomp k R f.hom) (rightMult k R N r g)) + rfl + +variable (k R) +def functor : ModuleCat.{u} R ⥤ ModuleCat.{u} R where + obj M := ModuleCat.of R (Object k R M) + map f := ModuleCat.ofHom (map f) + map_id M := by ext h g; rfl + map_comp f g := by ext h φ; rfl +instance : (functor k R).Additive where + map_add := by + intro M N f g + apply ModuleCat.hom_ext + apply LinearMap.ext + intro h + apply Object.ext + intro φ + change (Object.value h) ((LinearMap.lcomp k R (f+g).hom) φ) = + (Object.value h) ((LinearMap.lcomp k R f.hom) φ) + + (Object.value h) ((LinearMap.lcomp k R g.hom) φ) + rw [← map_add] + congr 1 + ext x + exact map_add φ _ _ + +abbrev coind (V : ModuleCat.{u} k) := + (ModuleCat.coextendScalars (algebraMap k R)).obj V + +instance coind_modulek (V : ModuleCat.{u} k) : Module k (coind k R V) := + inferInstanceAs (Module k ((ModuleCat.restrictScalars (algebraMap k R)).obj + (ModuleCat.of R R) →ₗ[k] V)) + +instance coind_tower (V : ModuleCat.{u} k) : IsScalarTower k R (coind k R V) where + smul_assoc a r h := by + apply ModuleCat.CoextendScalars.ext + apply LinearMap.ext + intro x + change R at x + change h (x * (a • r)) = a • h (x*r) + rw [mul_smul_comm] + rw [Algebra.smul_def] + exact h.map_smul a (x*r) + +instance coind_comm (V : ModuleCat.{u} k) : SMulCommClass R k (coind k R V) where + smul_comm _ _ _ := rfl + +lemma field_injective (V : ModuleCat.{u} k) : Injective V where + factors {X Y} g f hf := by + obtain ⟨s, hs⟩ := f.hom.exists_leftInverse_of_injective + (LinearMap.ker_eq_bot.mpr ((ModuleCat.mono_iff_injective f).mp hf)) + refine ⟨ModuleCat.ofHom (g.hom.comp s), ?_⟩ + apply ModuleCat.hom_ext + change g.hom.comp (s.comp f.hom) = g.hom + rw [hs, LinearMap.comp_id] + +instance coind_injective (V : ModuleCat.{u} k) : Injective (coind k R V) := + (ModuleCat.restrictCoextendScalarsAdj (algebraMap k R)).map_injective _ + (field_injective k V) + +abbrev DA := coind k R (ModuleCat.of k k) + +def daEquiv : DA k R ≃ₗ[k] Module.Dual k R where + toFun h := { + toFun := h + map_add' := h.map_add + map_smul' a r := by + rw [Algebra.smul_def] + exact h.map_smul a r } + invFun h := { + toFun := h + map_add' := h.map_add + map_smul' a r := by + change R at r + change h (algebraMap k R a * r) = a • h r + rw [← Algebra.smul_def] + exact h.map_smul a r } + left_inv h := rfl + right_inv h := rfl + map_add' f g := rfl + map_smul' a h := rfl + +def etaMap (M : ModuleCat.{u} R) (p : M) : DA k R →ₗ[R] Object k R M where + toFun h := (daEquiv k R h).comp (LinearMap.applyₗ' k p) + map_add' h g := rfl + map_smul' r h := by + apply Object.ext + intro φ + change h (φ p * r) = h (φ p * r) + rfl + +@[simp] lemma etaMap_apply (M : ModuleCat.{u} R) (p : M) (h : DA k R) + (φ : M →ₗ[R] R) : Object.value (etaMap k R M p h) φ = h (φ p) := rfl + +lemma eta_natural {M N : ModuleCat.{u} R} (f : M ⟶ N) (p : M) : + (map f).comp (etaMap k R M p) = etaMap k R N (f p) := by rfl + +structure Frame (M : ModuleCat.{u} R) where + n : ℕ + b : Fin n → M + c : Fin n → (M →ₗ[R] R) + expand : ∀ x, ∑ i, c i x • b i = x + +lemma frame_nonempty (M : ModuleCat.{u} R) [Module.Finite R M] [Module.Projective R M] : + Nonempty (Frame R M) := by + classical + obtain ⟨n, f, g, _, _, hfg⟩ := Module.Finite.exists_comp_eq_id_of_projective R M + refine ⟨⟨n, fun i => f (Pi.single i 1), fun i => (LinearMap.proj i).comp g, ?_⟩⟩ + intro x + simp only [LinearMap.comp_apply, LinearMap.proj_apply, ← map_smul, ← map_sum] + have he : ∑ i : Fin n, g x i • Pi.single i (1 : R) = g x := by + ext j + simp [Pi.single_apply, smul_eq_mul] + rw [he] + exact LinearMap.congr_fun hfg x + +variable {k R} +lemma Frame.dual_expand {M : ModuleCat.{u} R} (F : Frame R M) (φ : M →ₗ[R] R) : + ∑ i, rightMult k R M (φ (F.b i)) (F.c i) = φ := by + apply LinearMap.ext + intro x + simpa only [LinearMap.sum_apply, rightMult_apply, map_sum, map_smul, + smul_eq_mul] using congrArg φ (F.expand x) + +variable (k R) +lemma eta_injective [FiniteDimensional k R] (M : ModuleCat.{u} R) + (F : Frame R M) : Function.Injective (etaMap k R M) := by + intro x y h + have hxy (i : Fin F.n) : F.c i x = F.c i y := by + apply (Module.evalEquiv k R).injective + apply LinearMap.ext + intro φ + exact congrArg (fun f : DA k R →ₗ[R] Object k R M => + Object.value (f ((daEquiv k R).symm φ)) (F.c i)) h + rw [← F.expand x, ← F.expand y] + simp only [hxy] + +lemma eta_surjective [FiniteDimensional k R] (M : ModuleCat.{u} R) + (F : Frame R M) : Function.Surjective (etaMap k R M) := by + classical + intro f + let p : Fin F.n → R := fun i => (Module.evalEquiv k R).symm ( + (LinearMap.applyₗ' k (F.c i)).comp + ((f.restrictScalars k).comp (daEquiv k R).symm.toLinearMap)) + have hp (i : Fin F.n) (h : DA k R) : h (p i) = Object.value (f h) (F.c i) := by + change (daEquiv k R h) (p i) = _ + dsimp only [p] + rw [Module.apply_evalEquiv_symm_apply] + change Object.value (f ((daEquiv k R).symm (daEquiv k R h))) (F.c i) = _ + rw [LinearEquiv.symm_apply_apply] + + refine ⟨∑ i, p i • F.b i, ?_⟩ + apply LinearMap.ext + intro h + apply Object.ext + intro φ + change h (φ (∑ i, p i • F.b i)) = Object.value (f h) φ + calc + h (φ (∑ i, p i • F.b i)) = ∑ i, h (p i * φ (F.b i)) := by + change (daEquiv k R h) (φ (∑ i, p i • F.b i)) = _ + simp only [map_sum, map_smul, smul_eq_mul] + rfl + _ = ∑ i, Object.value (f h) (rightMult k R M (φ (F.b i)) (F.c i)) := by + apply Finset.sum_congr rfl + intro i _ + rw [show h (p i * φ (F.b i)) = + (φ (F.b i) • h : DA k R) (p i) from rfl, hp] + rw [map_smul] + rfl + _ = Object.value (f h) φ := by rw [← map_sum, F.dual_expand] + +lemma coind_smul_eval (V : ModuleCat.{u} k) (g : coind k R V) (a : k) (r : R) : + g (a • r) = a • g r := by + rw [Algebra.smul_def] + exact g.map_smul a r + +lemma coind_add_eval (V : ModuleCat.{u} k) (g : coind k R V) (r s : R) : + g (r+s) = g r + g s := g.map_add r s + +def coindInclusion (M : ModuleCat.{u} R) : + (functor k R).obj M ⟶ coind k R (ModuleCat.of k (Object k R M)) := + ModuleCat.ofHom { + toFun := fun h => { + toFun := fun r => (show R from r) • h + map_add' := fun r s => add_smul _ _ _ + map_smul' := fun a r => by + change R at r + change (algebraMap k R a * r) • h = a • (r • h) + rw [← Algebra.smul_def, smul_assoc] } + map_add' := fun h g => by + apply LinearMap.ext + intro r + exact smul_add _ _ _ + map_smul' := fun r h => by + apply LinearMap.ext + intro s + exact (mul_smul (show R from s) r h).symm } + +def coindRetraction (M : ModuleCat.{u} R) (F : Frame R M) : + coind k R (ModuleCat.of k (Object k R M)) ⟶ (functor k R).obj M := + ModuleCat.ofHom { + toFun := fun g => { + toFun := fun φ => ∑ i, Object.value (g (φ (F.b i))) (F.c i) + map_add' := fun φ ψ => by + change ∑ i, Object.value (g ((φ+ψ) (F.b i))) (F.c i) = _ + have hg (r s : R) : g (r+s) = g r + g s := g.map_add r s + simp only [LinearMap.add_apply, hg] + change ∑ i, (Object.value (g (φ (F.b i))) (F.c i) + + Object.value (g (ψ (F.b i))) (F.c i)) = _ + exact Finset.sum_add_distrib + map_smul' := fun a φ => by + change ∑ i, Object.value (g ((a • φ) (F.b i))) (F.c i) = + a • (∑ i, Object.value (g (φ (F.b i))) (F.c i)) + rw [Finset.smul_sum] + apply Finset.sum_congr rfl + intro i _ + exact congrArg (fun x : Object k R M => Object.value x (F.c i)) + (coind_smul_eval k R (ModuleCat.of k (Object k R M)) g a (φ (F.b i))) } + map_add' := fun g h => by + apply Object.ext + intro φ + change ∑ i, (Object.value (g (φ (F.b i))) (F.c i) + + Object.value (h (φ (F.b i))) (F.c i)) = _ + exact Finset.sum_add_distrib + map_smul' := fun r g => by + apply Object.ext + intro φ + rfl } + +lemma coindInclusion_retraction (M : ModuleCat.{u} R) (F : Frame R M) : + coindInclusion k R M ≫ coindRetraction k R M F = 𝟙 _ := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro h + apply Object.ext + intro φ + change ∑ i, Object.value h (rightMult k R M (φ (F.b i)) (F.c i)) = Object.value h φ + rw [← map_sum, F.dual_expand] + +lemma object_injective (M : ModuleCat.{u} R) [Module.Finite R M] [Module.Projective R M] : + Injective ((functor k R).obj M) := by + obtain ⟨F⟩ := frame_nonempty R M + exact (show Retract ((functor k R).obj M) (coind k R (ModuleCat.of k (Object k R M))) from + ⟨coindInclusion k R M, coindRetraction k R M F, coindInclusion_retraction k R M F⟩).injective + +end LittleFinitistic.Nakayama + +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Rickard/FiniteFamilies.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Rickard/FiniteFamilies.lean new file mode 100644 index 0000000000000000000000000000000000000000..2b75855caa9e199037abc709fc7ccbe8d60410ba --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Rickard/FiniteFamilies.lean @@ -0,0 +1,57 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Model +import OAI.Algebra.Finitistic.Dimension.PDDimension + +namespace OAI + +noncomputable section + +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.Rickard +universe u +variable {k R : Type u} [Field k] [Ring R] [Algebra k R] [FiniteDimensional k R] + +lemma exists_finite_module_high_pd (h : littleFinitisticDimension R = ⊤) (i : ℕ) : + ∃ M : PDMinimal.FiniteModule k R, + (i : WithBot ℕ∞) < projectiveDimension M.cat ∧ projectiveDimension M.cat < ⊤ := by + have hi : (i : WithBot ℕ∞) < littleFinitisticDimension R := by + rw [h] + exact WithBot.coe_lt_coe.mpr (ENat.natCast_lt_top i) + simp only [littleFinitisticDimension, lt_iSup_iff] at hi + obtain ⟨M, hfg, hpd, hgt⟩ := hi + let := hfg + let : Module k M := Module.compHom M (algebraMap k R) + let : IsScalarTower k R M := IsScalarTower.of_compHom k R M + let : FiniteDimensional k M := Module.Finite.trans R M + exact ⟨PDMinimal.FiniteModule.of (k := k) (A := R) M, hgt, hpd⟩ + +lemma exists_minimal_family (h : littleFinitisticDimension R = ⊤) : + ∃ (M : ℕ → PDMinimal.FiniteModule k R) (d : ℕ → ℕ), + (∀ i, i < d i) ∧ + (∀ i, HasProjectiveDimensionLE (M i).cat (d i)) ∧ + (∀ i, ¬ Subsingleton (PDMinimal.term (M i) (d i))) := by + classical + choose M hgt hfin using exists_finite_module_high_pd (k := k) h + have hb (i : ℕ) : ∃ d, HasProjectiveDimensionLE (M i).cat d := + (projectiveDimension_ne_top_iff _).mp (hfin i).ne + let d := fun i => Nat.find (hb i) + have hd (i : ℕ) : HasProjectiveDimensionLE (M i).cat (d i) := Nat.find_spec (hb i) + have hdi (i : ℕ) : i < d i := by + have hp := (projectiveDimension_le_iff _ _).mpr (hd i) + have hlt := (hgt i).trans_le hp + exact_mod_cast hlt + refine ⟨M, d, hdi, hd, ?_⟩ + intro i hz + have hpos := hdi i + obtain ⟨n, hn⟩ := Nat.exists_eq_succ_of_ne_zero (by omega : d i ≠ 0) + have hh : HasProjectiveDimensionLE (M i).cat n := + (PDMinimal.pdLE_iff_term_zero (M i) n).mpr (by simpa [hn] using hz) + have hm := Nat.find_min' (hb i) hh + change d i ≤ n at hm + omega + +end LittleFinitistic.Rickard + +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Rickard/InjectiveSums.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Rickard/InjectiveSums.lean new file mode 100644 index 0000000000000000000000000000000000000000..02573c08af2f9d8e6f925bd3476361ba62f48db2 --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Rickard/InjectiveSums.lean @@ -0,0 +1,76 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Model + +namespace OAI + +noncomputable section + +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.Rickard +universe u v +variable {R : Type u} [Ring R] {ι : Type v} +variable (Q : ι → Type u) [∀ i, AddCommGroup (Q i)] [∀ i, Module R (Q i)] + +lemma finite_support_map (M : Type u) [AddCommGroup M] [Module R M] [Module.Finite R M] + (g : M →ₗ[R] Π₀ i, Q i) : ∃ s : Finset ι, ∀ x i, i ∉ s → g x i = 0 := by + classical + obtain ⟨n, f, hf⟩ := Module.Finite.exists_fin' R M + let s := Finset.univ.biUnion (fun j : Fin n => (g (f (Pi.single j 1))).support) + refine ⟨s, ?_⟩ + intro x i hi + obtain ⟨v, rfl⟩ := hf x + have hv : ∑ j : Fin n, v j • Pi.single j (1 : R) = v := by + ext j + simp [Pi.single_apply, smul_eq_mul] + have hz (j : Fin n) : (g (f (Pi.single j 1))) i = 0 := by + apply DFinsupp.notMem_support_iff.mp + intro h + apply hi + exact Finset.mem_biUnion.mpr ⟨j, Finset.mem_univ _, h⟩ + rw [← hv, map_sum, map_sum] + change (DFinsupp.lapply (R := R) i) (∑ j, g (f (v j • Pi.single j 1))) = 0 + rw [map_sum] + simp only [map_smul, DFinsupp.lapply_apply, hz, smul_zero, Finset.sum_const_zero] + +lemma dfinsupp_injective [IsNoetherianRing R] [∀ i, Module.Injective R (Q i)] : + Module.Injective R (Π₀ i, Q i) := by + classical + apply Module.Baer.injective + intro I g + obtain ⟨s, hs⟩ := finite_support_map Q I g + have he (i : ι) : ∃ f : R →ₗ[R] Q i, ∀ (x : R) (hx : x ∈ I), + f x = g ⟨x,hx⟩ i := + Module.Baer.of_injective (inferInstance : Module.Injective R (Q i)) I + ((DFinsupp.lapply i).comp g) + choose f hf using he + refine ⟨∑ i ∈ s, (DFinsupp.lsingle i).comp (f i), ?_⟩ + intro x hx + apply DFinsupp.ext + intro j + simp only [LinearMap.sum_apply, LinearMap.comp_apply, DFinsupp.lsingle_apply] + by_cases hj : j ∈ s + · simpa [DFinsupp.single_apply, hj] using hf j x hx + · simp [DFinsupp.single_apply, hj, hs _ _ hj] + +lemma dfinsupp_injective_object [IsNoetherianRing R] + (hQ : ∀ i, Injective (ModuleCat.of R (Q i))) : + Injective (ModuleCat.of R (Π₀ i, Q i)) := by + let (index : ι) : Module.Injective R (Q index) := + (Module.injective_iff_injective_object R (Q index)).mpr (hQ index) + let := dfinsupp_injective (R := R) Q + exact Module.injective_object_of_injective_module R _ + +lemma prod_injective (M N : Type u) [AddCommGroup M] [AddCommGroup N] + [Module R M] [Module R N] [Module.Injective R M] [Module.Injective R N] : + Module.Injective R (M × N) := by + constructor + intro X Y _ _ _ _ f hf g + obtain ⟨a, ha⟩ := Module.Injective.out f hf ((LinearMap.fst R M N).comp g) + obtain ⟨b, hb⟩ := Module.Injective.out f hf ((LinearMap.snd R M N).comp g) + exact ⟨a.prod b, fun x => Prod.ext (ha x) (hb x)⟩ + +end LittleFinitistic.Rickard + +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Rickard/NonGeneration.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Rickard/NonGeneration.lean new file mode 100644 index 0000000000000000000000000000000000000000..45d66f67a399a782f2bbb62975a720592280636e --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Rickard/NonGeneration.lean @@ -0,0 +1,129 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Derived.ModuleGeneration +import OAI.Algebra.FinitisticAsymmetry.Rickard.Orthogonal +import OAI.Algebra.FinitisticAsymmetry.Rickard.ResolutionFamily +import OAI.Algebra.FinitisticAsymmetry.Nakayama.Coinduction +import OAI.Algebra.FinitisticAsymmetry.Rickard.ReducedProducts +import OAI.Algebra.FinitisticAsymmetry.Rickard.OrthogonalStalks +import OAI.Algebra.FinitisticAsymmetry.Rickard.FiniteFamilies + +namespace OAI + +noncomputable section + +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.Rickard +universe u +variable {k R : Type u} [Field k] [Ring R] [Algebra k R] [FiniteDimensional k R] +local instance nonGenerationHasDerivedCategory : HasDerivedCategory (ModuleCat.{u} R) := + HasDerivedCategory.standard _ + +lemma prop_injective_of_da + (P : ObjectProperty (DerivedCategory (ModuleCat.{u} R))) + [P.IsClosedUnderIsomorphisms] [P.IsTriangulated] + (hcop : ∀ I : Type u, P.IsClosedUnderColimitsOfShape (Discrete I)) + (hD : P ((DerivedCategory.singleFunctor _ 0).obj (Nakayama.DA k R))) + (M : ModuleCat.{u} R) [Injective M] : + P ((DerivedCategory.singleFunctor _ 0).obj M) := by + classical + let V := (ModuleCat.restrictScalars (algebraMap k R)).obj M + let b := Module.Free.chooseBasis k V + let S := ModuleCat.of R (Π₀ _ : Module.Free.ChooseBasisIndex k V, Nakayama.DA k R) + let cs : Cofan (fun _ : Module.Free.ChooseBasisIndex k V => Nakayama.DA k R) := + Cofan.mk S (fun i => ModuleCat.ofHom (DFinsupp.lsingle (R := R) (M := fun _ : Module.Free.ChooseBasisIndex k V => Nakayama.DA k R) i)) + have hc : IsColimit cs := by + refine Cofan.IsColimit.mk _ + (fun t => ModuleCat.ofHom (DFinsupp.lsum ℤ (fun i => (t.inj i).hom))) ?_ ?_ + · intro t i + ext x + change (DFinsupp.lsum ℤ (fun i => (t.inj i).hom)) (DFinsupp.single i x) = (t.inj i).hom x + simp only [DFinsupp.lsum_single] + · intro t f hf + apply ModuleCat.hom_ext + apply DFinsupp.lhom_ext' + intro i + apply LinearMap.ext + intro x + have hh := ConcreteCategory.congr_hom (hf i) x + change f.hom (DFinsupp.single i x) = + (DFinsupp.lsum ℤ (fun i => (t.inj i).hom)) (DFinsupp.single i x) + rw [DFinsupp.lsum_single] + exact hh + let := hcop (ULift.{u} ℕ) + let : P.IsClosedUnderColimitsOfShape (Discrete ℕ) := + ObjectProperty.IsClosedUnderColimitsOfShape.of_equivalence + (Discrete.equivalence (Equiv.ulift : ULift.{u} ℕ ≃ ℕ)) + let := hcop (Module.Free.ChooseBasisIndex k V) + have hS : P ((DerivedCategory.singleFunctor _ 0).obj S) := + DerivedSupport.prop_single_of_cofan P cs hc (fun _ => hD) + let e : S ≅ Nakayama.coind k R V := + (LinearEquiv.ofBijective (Nakayama.coindBasisMap V b) + (Nakayama.coindBasisMap_bijective k R V b)).toModuleIso + have hC : P ((DerivedCategory.singleFunctor _ 0).obj (Nakayama.coind k R V)) := + P.prop_of_iso ((DerivedCategory.singleFunctor _ 0).mapIso e) hS + let j := Nakayama.moduleCoindInclusion k R M + let : Mono j := Nakayama.moduleCoindInclusion_mono k R M + let p := Injective.factorThru (𝟙 M) j + have hjp : j ≫ p = 𝟙 M := Injective.comp_factorThru (𝟙 M) j + let F := DerivedCategory.singleFunctor (ModuleCat R) 0 + exact DerivedSupport.localizing_of_retract (F.map j) (F.map p) + (by rw [← F.map_comp, hjp, F.map_id]) P hC + +lemma not_generate_of_minimal_family (M : ℕ → PDMinimal.FiniteModule k R) + (d : ℕ → ℕ) (hd : ∀ i, i < d i) + (hpd : ∀ i, HasProjectiveDimensionLE (M i).cat (d i)) + (hlast : ∀ i, ¬ Subsingleton (PDMinimal.term (M i) (d i))) : + ¬ InjectivesGenerate R := by + classical + let K := fun i => nakayamaComplex k (translatedResolution (M i) (d i)) + let L := reducedComplex K + have hkzero : ∀ i j, j < 0 → IsZero ((K i).X j) := fun i j hj => + nakayamaComplex_zero k _ j (translatedResolution_zero_negative (M i) (d i) (hpd i) j hj) + have hknon : ∀ i, ∃ x : (K i).X 0, x ≠ 0 ∧ (K i).d 0 1 x = 0 := fun i => + translated_nakayama_zero_cycle k (M i) (d i) (by have := hd i; omega) (hlast i) + have hkinj : ∀ i j, Injective ((K i).X j) := fun i j => + nakayamaComplex_injective k _ (translatedResolution_finite (M i) (d i)) + (translatedResolution_projective (M i) (d i)) j + let : IsNoetherianRing R := IsNoetherianRing.of_finite k R + let (j : ℤ) : Injective (L.X j) := reducedComplex_injective K hkinj j + let : L.IsStrictlyGE (-1) := reduced_isStrictlyGE K hkzero + let : L.IsKInjective := CochainComplex.isKInjective_of_injective L (-1) + have hnon : ¬ IsZero (DerivedCategory.Q.obj L) := + not_isZero_Q_of_not_exact_zero L (reduced_not_exact_zero K hkzero hknon) + let : Module.Finite R (Nakayama.DA k R) := Nakayama.da_finite k R + have hex (j : ℤ) (f : Nakayama.DA k R ⟶ L.X j) (hf : f ≫ L.d j (j+1) = 0) : + ∃ g : Nakayama.DA k R ⟶ L.X (j-1), g ≫ L.d (j-1) j = f := by + have he : ∃ s : Finset ℕ, ∀ i ∉ s, ∀ f : Nakayama.DA k R ⟶ (K i).X (j-1+1), + f ≫ (K i).d (j-1+1) (j-1+1+1) = 0 → + ∃ g : Nakayama.DA k R ⟶ (K i).X (j-1), g ≫ (K i).d (j-1) (j-1+1) = f := by + refine ⟨Finset.range (j.toNat+1), ?_⟩ + intro i hi f hf + apply nakayamaComplex_hom_exact k _ (translatedResolution_finite (M i) (d i)) + (translatedResolution_projective (M i) (d i)) (j-1) _ f hf + apply translatedResolution_exact + have hdi := hd i + simp only [Finset.mem_range, not_lt] at hi + omega + have hh := reduced_hom_exact K (Nakayama.DA k R) (j-1) he + rw [sub_add_cancel] at hh + exact hh f hf + apply not_generate_of_orthogonal (DerivedCategory.Q.obj L) hnon + intro N hN + let := hN + apply (perpendicular_iff (DerivedCategory.Q.obj L) _).mp + apply prop_injective_of_da (k := k) (perpendicular (DerivedCategory.Q.obj L)) + (fun I => inferInstance) _ N + apply (perpendicular_iff _ _).mpr + exact orthogonal_single_of_hom_exact _ L hex + +lemma not_injectivesGenerate_of_little_eq_top (k : Type u) [Field k] [Algebra k R] + [FiniteDimensional k R] + (h : littleFinitisticDimension R = ⊤) : ¬ InjectivesGenerate R := by + obtain ⟨M, d, hd, hpd, hterm⟩ := exists_minimal_family (k := k) h + exact not_generate_of_minimal_family M d hd hpd hterm + +end LittleFinitistic.Rickard + +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Rickard/Orthogonal.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Rickard/Orthogonal.lean new file mode 100644 index 0000000000000000000000000000000000000000..a67b1808895df51275a751e307417da6c3f0c961 --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Rickard/Orthogonal.lean @@ -0,0 +1,79 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Model + +namespace OAI + +noncomputable section + +open CategoryTheory CategoryTheory.Limits CategoryTheory.Pretriangulated +namespace LittleFinitistic.Rickard +universe u v t +variable {C : Type u} [Category.{v} C] + +lemma leftOrthogonal_closed [HasZeroMorphisms C] (P : ObjectProperty C) (J : Type t) [Category J] : + P.leftOrthogonal.IsClosedUnderColimitsOfShape J := by + apply ObjectProperty.IsClosedUnderColimitsOfShape.mk' + rintro _ ⟨F, hF⟩ Y f hY + apply colimit.hom_ext + intro j + simpa using hF j (colimit.ι F j ≫ f) hY + +section +variable [HasZeroObject C] [Preadditive C] [HasShift C ℤ] + [∀ n : ℤ, (shiftFunctor C n).Additive] [Pretriangulated C] + +def perpendicular (X : C) : ObjectProperty C := + ((ObjectProperty.singleton X).shiftClosure ℤ).leftOrthogonal + +instance perpendicular_isClosedUnderIsomorphisms (X : C) : + (perpendicular X).IsClosedUnderIsomorphisms := inferInstanceAs + (((ObjectProperty.singleton X).shiftClosure ℤ).leftOrthogonal.IsClosedUnderIsomorphisms) + +instance perpendicular_isTriangulated (X : C) : (perpendicular X).IsTriangulated := + inferInstanceAs (((ObjectProperty.singleton X).shiftClosure ℤ).leftOrthogonal.IsTriangulated) + +instance perpendicular_closed (X : C) (J : Type t) [Category J] : + (perpendicular X).IsClosedUnderColimitsOfShape J := leftOrthogonal_closed _ J + +omit [HasZeroObject C] [∀ n : ℤ, (shiftFunctor C n).Additive] [Pretriangulated C] in +lemma perpendicular_iff (X Y : C) : perpendicular X Y ↔ + ∀ (n : ℤ) (f : Y ⟶ X⟦n⟧), f = 0 := by + constructor + · intro h n f + exact h f ⟨X,n,Iso.refl _, by simp⟩ + · intro h Z f hZ + obtain ⟨X', n, e, he⟩ := hZ + have he' : X = X' := by simpa using he + subst X' + apply (cancel_mono e.hom).mp + simpa using h n (f ≫ e.hom) + +omit [HasZeroObject C] [∀ n : ℤ, (shiftFunctor C n).Additive] [Pretriangulated C] in +lemma isZero_of_perpendicular_self (X : C) (hX : perpendicular X X) : IsZero X := by + apply (IsZero.iff_id_eq_zero _).mpr + exact hX (𝟙 X) ((ObjectProperty.singleton X).le_shiftClosure X (by simp)) +end + +variable {R : Type u} [Ring R] +local instance orthogonalHasDerivedCategory : HasDerivedCategory (ModuleCat.{u} R) := + HasDerivedCategory.standard _ + +lemma not_generate_of_orthogonal + (X : @DerivedCategory (ModuleCat.{u} R) _ _ (HasDerivedCategory.standard _)) + (hX : ¬ IsZero X) + (hI : ∀ (M : ModuleCat.{u} R), Injective M → + ∀ (n : ℤ) (f : (DerivedCategory.singleFunctor _ 0).obj M ⟶ X⟦n⟧), f = 0) : + ¬ InjectivesGenerate R := by + let := HasDerivedCategory.standard (ModuleCat.{u} R) + intro h + apply hX + apply isZero_of_perpendicular_self + apply h (perpendicular X) inferInstance inferInstance (fun I => inferInstance) + intro M hM + exact (perpendicular_iff X _).mpr (hI M hM) + +end LittleFinitistic.Rickard + +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Rickard/OrthogonalStalks.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Rickard/OrthogonalStalks.lean new file mode 100644 index 0000000000000000000000000000000000000000..1f755cae23290156a4171fd51d52395566c21841 --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Rickard/OrthogonalStalks.lean @@ -0,0 +1,57 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Model + +namespace OAI + +noncomputable section + +open CategoryTheory CategoryTheory.Limits CochainComplex CochainComplex.HomComplex +namespace LittleFinitistic.Rickard +universe u +variable {R : Type u} [Ring R] +local instance orthogonalStalksHasDerivedCategory : HasDerivedCategory (ModuleCat.{u} R) := + HasDerivedCategory.standard _ + +lemma class_eq_zero_of_hom_exact (D : ModuleCat.{u} R) + (L : CochainComplex (ModuleCat.{u} R) ℤ) + (hex : ∀ j, ∀ f : D ⟶ L.X j, f ≫ L.d j (j+1) = 0 → + ∃ g : D ⟶ L.X (j-1), g ≫ L.d (j-1) j = f) + (n : ℤ) (x : CohomologyClass ((singleFunctor _ 0).obj D) L n) : x=0 := by + obtain ⟨x, rfl⟩ := CohomologyClass.mk_surjective x + obtain ⟨f, hf, rfl⟩ := Cocycle.fromSingleMk_surjective x n (by simp) (n+1) rfl + rw [CohomologyClass.mk_eq_zero_iff, + Cocycle.fromSingleMk_mem_coboundaries_iff f (by simp) (n+1) rfl hf (n-1) (by omega)] + exact hex n f hf + +lemma orthogonal_single_of_hom_exact (D : ModuleCat.{u} R) + (L : CochainComplex (ModuleCat.{u} R) ℤ) [L.IsKInjective] + (hex : ∀ j, ∀ f : D ⟶ L.X j, f ≫ L.d j (j+1) = 0 → + ∃ g : D ⟶ L.X (j-1), g ≫ L.d (j-1) j = f) + (n : ℤ) (f : (DerivedCategory.singleFunctor _ 0).obj D ⟶ (DerivedCategory.Q.obj L)⟦n⟧) : + f=0 := by + let S := (singleFunctor (ModuleCat R) 0).obj D + have hz (g : (HomotopyCategory.quotient _ _).obj S ⟶ + (HomotopyCategory.quotient _ _).obj (L⟦n⟧)) : g=0 := by + obtain ⟨x, rfl⟩ := (CohomologyClass.toHom_bijective S L n).surjective g + rw [class_eq_zero_of_hom_exact D L hex n x, map_zero] + have hz' (g : DerivedCategory.Qh.obj ((HomotopyCategory.quotient _ _).obj S) ⟶ + DerivedCategory.Qh.obj ((HomotopyCategory.quotient _ _).obj (L⟦n⟧))) : g=0 := by + obtain ⟨g, rfl⟩ := (CochainComplex.IsKInjective.Qh_map_bijective + ((HomotopyCategory.quotient _ _).obj S) (L⟦n⟧)).surjective g + rw [hz g, Functor.map_zero] + let es := (DerivedCategory.singleFunctorIsoCompQ (ModuleCat R) 0).app D + let eqs := (DerivedCategory.quotientCompQhIso (ModuleCat R)).app S + let eql := (DerivedCategory.quotientCompQhIso (ModuleCat R)).app (L⟦n⟧) + let en := (DerivedCategory.Q.commShiftIso n).app L + apply (cancel_epi es.inv).mp + apply (cancel_epi eqs.hom).mp + apply (cancel_mono en.inv).mp + apply (cancel_mono eql.inv).mp + simpa only [Category.assoc, comp_zero, zero_comp] using + hz' (eqs.hom ≫ es.inv ≫ f ≫ en.inv ≫ eql.inv) + +end LittleFinitistic.Rickard + +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Rickard/ReducedProducts.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Rickard/ReducedProducts.lean new file mode 100644 index 0000000000000000000000000000000000000000..e5f604dfa5b40e417d4d8680dd1efa232a68967b --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Rickard/ReducedProducts.lean @@ -0,0 +1,211 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Rickard.InjectiveSums + +namespace OAI + +section +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.Rickard +universe u +variable {R : Type u} [Ring R] +variable (K : ℕ → CochainComplex (ModuleCat.{u} R) ℤ) + +abbrev productTerm (j : ℤ) := ∀ i, (K i).X j +abbrev sumTerm (j : ℤ) := Π₀ i, (K i).X j +abbrev reducedTerm (j : ℤ) := productTerm K j × sumTerm K (j+1) + +def productD (j : ℤ) : productTerm K j →ₗ[R] productTerm K (j+1) := + LinearMap.pi (fun i => ((K i).d j (j+1)).hom.comp (LinearMap.proj i)) + +def sumD (j : ℤ) : sumTerm K j →ₗ[R] sumTerm K (j+1) := + DFinsupp.mapRange.linearMap (fun i => ((K i).d j (j+1)).hom) + +@[simp] lemma productD_apply (j : ℤ) (p : productTerm K j) (i : ℕ) : + productD K j p i = (K i).d j (j+1) (p i) := rfl +@[simp] lemma sumD_apply (j : ℤ) (s : sumTerm K j) (i : ℕ) : + sumD K j s i = (K i).d j (j+1) (s i) := rfl + +def sumInclusion (j : ℤ) : sumTerm K j →ₗ[R] productTerm K j := + LinearMap.pi (fun i => DFinsupp.lapply i) + +@[simp] lemma sumInclusion_apply (j : ℤ) (s : sumTerm K j) (i : ℕ) : + sumInclusion K j s i = s i := rfl + +lemma d_d_apply (i : ℕ) (j : ℤ) (p : (K i).X j) : + (K i).d (j+1) (j+1+1) ((K i).d j (j+1) p) = 0 := by + exact ConcreteCategory.congr_hom ((K i).d_comp_d j (j+1) (j+1+1)) p + +def reducedD (j : ℤ) : reducedTerm K j →ₗ[R] reducedTerm K (j+1) := + ((productD K j).comp (LinearMap.fst R _ _) + + (sumInclusion K (j+1)).comp (LinearMap.snd R _ _)).prod + (-(sumD K (j+1)).comp (LinearMap.snd R _ _)) + +@[simp] lemma reducedD_fst (j : ℤ) (x : reducedTerm K j) (i : ℕ) : + (reducedD K j x).1 i = (K i).d j (j+1) (x.1 i) + x.2 i := rfl +@[simp] lemma reducedD_snd (j : ℤ) (x : reducedTerm K j) (i : ℕ) : + (reducedD K j x).2 i = -(K i).d (j+1) (j+1+1) (x.2 i) := rfl + +lemma reducedD_sq (j : ℤ) : + (reducedD K (j+1)).comp (reducedD K j) = 0 := by + apply LinearMap.ext + intro x + apply Prod.ext + · ext i + simp only [LinearMap.comp_apply, reducedD_fst, reducedD_snd, map_add, + d_d_apply, zero_add, add_neg_cancel, LinearMap.zero_apply, Prod.fst_zero, Pi.zero_apply] + · apply DFinsupp.ext + intro i + simp only [LinearMap.comp_apply, reducedD_snd, map_neg, d_d_apply, neg_zero, + LinearMap.zero_apply, Prod.snd_zero, DFinsupp.zero_apply] + +def reducedComplex : CochainComplex (ModuleCat.{u} R) ℤ := + CochainComplex.of (fun j => ModuleCat.of R (reducedTerm K j)) + (fun j => ModuleCat.ofHom (reducedD K j)) (fun j => by + apply ModuleCat.hom_ext + exact reducedD_sq K j) + +@[simp] lemma reducedComplex_d (j : ℤ) : + (reducedComplex K).d j (j+1) = ModuleCat.ofHom (reducedD K j) := by + simp [reducedComplex, CochainComplex.of] + +lemma reducedComplex_injective [IsNoetherianRing R] + (hK : ∀ i j, Injective ((K i).X j)) (j : ℤ) : + Injective ((reducedComplex K).X j) := by + let (i : ℕ) : Module.Injective R ((K i).X j) := + (Module.injective_iff_injective_object R _).mpr (hK i j) + let (i : ℕ) : Module.Injective R ((K i).X (j+1)) := + (Module.injective_iff_injective_object R _).mpr (hK i (j+1)) + let := dfinsupp_injective (R := R) (fun i => (K i).X (j+1)) + let := prod_injective (R := R) (productTerm K j) (sumTerm K (j+1)) + apply Module.injective_object_of_injective_module + +lemma reduced_hom_exact (D : ModuleCat.{u} R) [Module.Finite R D] + (j : ℤ) (hex : ∃ s : Finset ℕ, ∀ i ∉ s, ∀ f : D ⟶ (K i).X (j+1), + f ≫ (K i).d (j+1) (j+1+1) = 0 → ∃ g : D ⟶ (K i).X j, + g ≫ (K i).d j (j+1) = f) + (f : D ⟶ (reducedComplex K).X (j+1)) + (hf : f ≫ (reducedComplex K).d (j+1) (j+1+1) = 0) : + ∃ g : D ⟶ (reducedComplex K).X j, + g ≫ (reducedComplex K).d j (j+1) = f := by + classical + let a : ∀ i, D →ₗ[R] (K i).X (j+1) := fun i => + (LinearMap.proj i).comp ((LinearMap.fst R _ _).comp f.hom) + let b : D →ₗ[R] sumTerm K (j+1+1) := (LinearMap.snd R _ _).comp f.hom + obtain ⟨s, hs⟩ := finite_support_map (R := R) _ D b + obtain ⟨t, ht⟩ := hex + have hcycle (i : ℕ) (x : D) : + (K i).d (j+1) (j+1+1) (a i x) + b x i = 0 := by + have h := congrArg (fun z : reducedTerm K (j+1+1) => z.1 i) + (ConcreteCategory.congr_hom hf x) + rw [reducedComplex_d] at h + change (reducedD K (j+1) (f x)).1 i = 0 at h + exact h + have he (i : ℕ) : ∃ c : D →ₗ[R] (K i).X j, + i ∉ s ∪ t → ((K i).d j (j+1)).hom.comp c = a i := by + by_cases hi : i ∈ s ∪ t + · exact ⟨0, fun h => (h hi).elim⟩ + · have his : i ∉ s := fun h => hi (Finset.mem_union_left _ h) + have hit : i ∉ t := fun h => hi (Finset.mem_union_right _ h) + obtain ⟨c, hc⟩ := ht i hit (ModuleCat.ofHom (a i)) (by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + simpa only [ModuleCat.hom_comp, LinearMap.comp_apply, ModuleCat.hom_ofHom, + ModuleCat.hom_zero, LinearMap.zero_apply, hs x i his, add_zero] using hcycle i x) + exact ⟨c.hom, fun _ => congrArg ModuleCat.Hom.hom hc⟩ + choose c hc using he + let q : D →ₗ[R] productTerm K j := LinearMap.pi c + let v : ∀ i, D →ₗ[R] (K i).X (j+1) := fun i => a i - ((K i).d j (j+1)).hom.comp (c i) + let w : D →ₗ[R] sumTerm K (j+1) := ∑ i ∈ s ∪ t, (DFinsupp.lsingle i).comp (v i) + have hw (x : D) (i : ℕ) : w x i = a i x - (K i).d j (j+1) (c i x) := by + by_cases hi : i ∈ s ∪ t + · simp [w, LinearMap.sum_apply, DFinsupp.single_apply, hi, v] + · have hci : (K i).d j (j+1) (c i x) = a i x := LinearMap.congr_fun (hc i hi) x + simp [w, LinearMap.sum_apply, DFinsupp.single_apply, hi, hci, v] + let g : D →ₗ[R] reducedTerm K j := q.prod w + refine ⟨ModuleCat.ofHom g, ?_⟩ + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + apply Prod.ext + · ext i + rw [reducedComplex_d] + change (reducedD K j (g x)).1 i = a i x + rw [reducedD_fst] + change (K i).d j (j+1) (c i x) + w x i = a i x + rw [hw] + abel + · apply DFinsupp.ext + intro i + rw [reducedComplex_d] + change (reducedD K j (g x)).2 i = b x i + rw [reducedD_snd] + change -(K i).d (j+1) (j+1+1) (w x i) = b x i + rw [hw, map_sub, d_d_apply, sub_zero] + exact neg_eq_of_add_eq_zero_right (hcycle i x) + +lemma reduced_isStrictlyGE + (hK : ∀ i j, j < 0 → IsZero ((K i).X j)) : + (reducedComplex K).IsStrictlyGE (-1) := by + apply (CochainComplex.isStrictlyGE_iff _ _).mpr + intro j hj + apply ModuleCat.isZero_iff_subsingleton.mpr + let (i : ℕ) : Subsingleton ((K i).X j) := + ModuleCat.isZero_iff_subsingleton.mp (hK i j (by omega)) + let (i : ℕ) : Subsingleton ((K i).X (j+1)) := + ModuleCat.isZero_iff_subsingleton.mp (hK i (j+1) (by omega)) + change Subsingleton (reducedTerm K j) + infer_instance + +lemma reduced_not_exact_zero + (hK : ∀ i j, j < 0 → IsZero ((K i).X j)) + (hnon : ∀ i, ∃ x : (K i).X 0, x ≠ 0 ∧ (K i).d 0 1 x = 0) : + ¬ (reducedComplex K).ExactAt 0 := by + classical + choose x hxne hxd using hnon + let p : reducedTerm K 0 := (x, 0) + have hp : (reducedComplex K).d 0 1 p = 0 := by + rw [show (1 : ℤ)=0+1 from rfl, reducedComplex_d] + apply Prod.ext + · ext i + change (K i).d 0 1 (x i) + 0 = 0 + simpa only [add_zero] using hxd i + · apply DFinsupp.ext + intro i + change -(K i).d 1 2 0 = 0 + rw [map_zero, neg_zero] + intro hex + obtain ⟨y, hy⟩ := (ShortComplex.moduleCat_exact_iff ((reducedComplex K).sc' (-1) 0 1)).mp + ((HomologicalComplex.exactAt_iff' _ _ _ _ (by simp) (by simp)).mp hex) p hp + change (reducedComplex K).d (-1) 0 y = p at hy + have hd : (reducedComplex K).d (-1) 0 = ModuleCat.ofHom (reducedD K (-1)) := + reducedComplex_d K (-1) + rw [hd] at hy + change reducedTerm K (-1) at y + obtain ⟨i, hi⟩ := Infinite.exists_notMem_finset y.2.support + have hy0 : y.2 i = 0 := DFinsupp.notMem_support_iff.mp hi + have hy1 : y.1 i = 0 := + (ModuleCat.isZero_iff_subsingleton.mp (hK i (-1) (by omega))).elim _ _ + have h := congrArg (fun z : reducedTerm K 0 => z.1 i) hy + change (reducedD K (-1) y).1 i = x i at h + rw [reducedD_fst, hy0, hy1, map_zero, zero_add] at h + exact hxne i h.symm + +local instance reducedProductsHasDerivedCategory : HasDerivedCategory (ModuleCat.{u} R) := + HasDerivedCategory.standard _ + +lemma not_isZero_Q_of_not_exact_zero (L : CochainComplex (ModuleCat.{u} R) ℤ) + (h : ¬ L.ExactAt 0) : ¬ IsZero (DerivedCategory.Q.obj L) := by + intro hz + apply h + apply (HomologicalComplex.exactAt_iff_isZero_homology L 0).mpr + exact ((DerivedCategory.homologyFunctor (ModuleCat R) 0).map_isZero hz).of_iso + ((DerivedCategory.homologyFunctorFactors (ModuleCat R) 0).app L).symm + +end LittleFinitistic.Rickard + +end +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Rickard/ResolutionFamily.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Rickard/ResolutionFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..0e1060b96d39820a6bc753a93200757207e05fd1 --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Rickard/ResolutionFamily.lean @@ -0,0 +1,164 @@ +import Mathlib +import OAI.Algebra.Finitistic.Dimension.PDDimension +import OAI.Algebra.FinitisticAsymmetry.Nakayama.Minimality + +namespace OAI + +noncomputable section + +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.Rickard +private theorem mono_map_of_conjugate {C D : Type*} [Category C] [Category D] + (F : C ⥤ D) {X₀ X₁ Y₀ Y₁ : C} (e₀ : X₀ ≅ Y₀) (e₁ : X₁ ≅ Y₁) + (f : X₀ ⟶ X₁) (g : Y₀ ⟶ Y₁) (h : f = e₀.hom ≫ g ≫ e₁.inv) + (hf : Mono (F.map f)) : Mono (F.map g) := by + let := hf + have hg : F.map g = F.map e₀.inv ≫ F.map f ≫ F.map e₁.hom := by + rw [h, F.map_comp, F.map_comp] + simp + rw [hg] + infer_instance + +universe u +variable {k R : Type u} [Field k] [Ring R] [Algebra k R] [FiniteDimensional k R] +open PDMinimal + +def translatedResolution (M : FiniteModule k R) (d : ℕ) : + CochainComplex (ModuleCat.{u} R) ℤ := + (complex M).extend (ComplexShape.embeddingUpIntLE d) + +lemma translatedResolution_finite (M : FiniteModule k R) (d : ℕ) (j : ℤ) : + Module.Finite R ((translatedResolution M d).X j) := by + by_cases h : ∃ n : ℕ, (ComplexShape.embeddingUpIntLE d).f n = j + · obtain ⟨n, hn⟩ := h + let : Module.Finite R ((complex M).X n) := (inferInstance : Module.Finite R (term M n)) + exact Module.Finite.equiv ((complex M).extendXIso _ hn).symm.toLinearEquiv + · have hz := (complex M).isZero_extend_X (ComplexShape.embeddingUpIntLE d) j (by simpa using h) + let : Subsingleton ((translatedResolution M d).X j) := ModuleCat.isZero_iff_subsingleton.mp hz + infer_instance + +lemma translatedResolution_projective (M : FiniteModule k R) (d : ℕ) (j : ℤ) : + Module.Projective R ((translatedResolution M d).X j) := by + by_cases h : ∃ n : ℕ, (ComplexShape.embeddingUpIntLE d).f n = j + · obtain ⟨n, hn⟩ := h + let : Module.Projective R ((complex M).X n) := + (inferInstance : Module.Projective R (term M n)) + exact Module.Projective.of_equiv ((complex M).extendXIso _ hn).symm.toLinearEquiv + · have hz := (complex M).isZero_extend_X (ComplexShape.embeddingUpIntLE d) j (by simpa using h) + let : Subsingleton ((translatedResolution M d).X j) := ModuleCat.isZero_iff_subsingleton.mp hz + infer_instance + +lemma term_zero_above (M : FiniteModule k R) (d n : ℕ) + (hd : HasProjectiveDimensionLE M.cat d) (hn : d < n) : Subsingleton (term M n) := by + obtain ⟨m, rfl⟩ := Nat.exists_eq_succ_of_ne_zero (by omega : n ≠ 0) + apply term_zero_of_pdLE M m + rw [← projectiveDimension_le_iff] at hd ⊢ + exact hd.trans (by exact_mod_cast (by omega : d ≤ m)) + +lemma translatedResolution_zero_negative (M : FiniteModule k R) (d : ℕ) + (hd : HasProjectiveDimensionLE M.cat d) (j : ℤ) (hj : j < 0) : + IsZero ((translatedResolution M d).X j) := by + let n := (d - j).toNat + have hn : (ComplexShape.embeddingUpIntLE d).f n = j := by + rw [ComplexShape.embeddingUpIntLE_f] + dsimp [n] + omega + have := term_zero_above M d n hd (by dsimp [n]; omega) + exact ((complex M).extendXIso _ hn).isZero_iff.mpr + (ModuleCat.isZero_iff_subsingleton.mpr (show Subsingleton (term M n) from inferInstance)) + +lemma translatedResolution_exact (M : FiniteModule k R) (d : ℕ) (j : ℤ) (hj : j ≠ d) : + (translatedResolution M d).ExactAt j := by + by_cases h : ∃ n : ℕ, (ComplexShape.embeddingUpIntLE d).f n = j + · obtain ⟨n, hn⟩ := h + have hn0 : n ≠ 0 := by + intro he + subst n + simp only [ComplexShape.embeddingUpIntLE_f, Nat.cast_zero, sub_zero] at hn + exact hj hn.symm + obtain ⟨m, rfl⟩ := Nat.exists_eq_succ_of_ne_zero hn0 + exact ((complex M).extend_exactAt_iff _ hn).mpr (complex_exactAt M m) + · exact (complex M).extend_exactAt _ j (by simpa using h) + +variable (k) +def nakayamaComplex (P : CochainComplex (ModuleCat.{u} R) ℤ) := + (Nakayama.functor k R).mapHomologicalComplex (.up ℤ) |>.obj P + +lemma nakayamaComplex_hom_exact (P : CochainComplex (ModuleCat.{u} R) ℤ) + (hfin : ∀ j, Module.Finite R (P.X j)) (hproj : ∀ j, Module.Projective R (P.X j)) + (j : ℤ) (hex : P.ExactAt (j+1)) (f : Nakayama.DA k R ⟶ (nakayamaComplex k P).X (j+1)) + (hf : f ≫ (nakayamaComplex k P).d (j+1) (j+1+1) = 0) : + ∃ g : Nakayama.DA k R ⟶ (nakayamaComplex k P).X j, + g ≫ (nakayamaComplex k P).d j (j+1) = f := by + let (i : ℤ) := hfin i + let (i : ℤ) := hproj i + obtain ⟨F⟩ := Nakayama.frame_nonempty R (P.X (j+1)) + obtain ⟨G⟩ := Nakayama.frame_nonempty R (P.X (j+1+1)) + obtain ⟨p, hp⟩ := Nakayama.eta_surjective k R _ F f.hom + have hz : P.d (j+1) (j+1+1) p = 0 := by + apply Nakayama.eta_injective k R _ G + rw [← Nakayama.eta_natural, hp] + have hf' := congrArg ModuleCat.Hom.hom hf + change (Nakayama.map (P.d (j+1) (j+1+1))).comp f.hom = 0 at hf' + rw [hf'] + ext h φ + simp [Nakayama.etaMap] + rfl + have hx := (ShortComplex.moduleCat_exact_iff_range_eq_ker _).mp + ((HomologicalComplex.exactAt_iff' P j (j+1) (j+1+1) (by simp) (by simp)).mp hex) + change LinearMap.range (P.d j (j+1)).hom = LinearMap.ker (P.d (j+1) (j+1+1)).hom at hx + have hpker : p ∈ LinearMap.ker (P.d (j+1) (j+1+1)).hom := hz + rw [← hx] at hpker + obtain ⟨q, hq⟩ := hpker + refine ⟨ModuleCat.ofHom (Nakayama.etaMap k R _ q), ?_⟩ + apply ModuleCat.hom_ext + change (Nakayama.map (P.d j (j+1))).comp (Nakayama.etaMap k R _ q) = f.hom + rw [Nakayama.eta_natural, hq, hp] + +omit [FiniteDimensional k R] in +lemma nakayamaComplex_injective (P : CochainComplex (ModuleCat.{u} R) ℤ) + (hfin : ∀ j, Module.Finite R (P.X j)) (hproj : ∀ j, Module.Projective R (P.X j)) + (j : ℤ) : Injective ((nakayamaComplex k P).X j) := by + let := hfin j + let := hproj j + exact Nakayama.object_injective k R (P.X j) + +omit [FiniteDimensional k R] in +lemma nakayamaComplex_zero (P : CochainComplex (ModuleCat.{u} R) ℤ) + (j : ℤ) (h : IsZero (P.X j)) : IsZero ((nakayamaComplex k P).X j) := by + exact (Nakayama.functor k R).map_isZero h + +lemma translated_nakayama_zero_cycle (M : FiniteModule k R) (d : ℕ) + (hd : 0 < d) (hterm : ¬ Subsingleton (term M d)) : + ∃ x : (nakayamaComplex k (translatedResolution M d)).X 0, + x ≠ 0 ∧ (nakayamaComplex k (translatedResolution M d)).d 0 1 x = 0 := by + obtain ⟨n, rfl⟩ := Nat.exists_eq_succ_of_ne_zero (by omega : d ≠ 0) + let : Nontrivial (term M (n+1)) := not_subsingleton_iff_nontrivial.mp hterm + let e := ComplexShape.embeddingUpIntLE ((n+1 : ℕ) : ℤ) + have h₀ : e.f (n+1) = 0 := by simp [e] + have h₁ : e.f n = 1 := by simp [e] + let P := translatedResolution M (n+1) + let F := Nakayama.functor k R + have he : P.d 0 1 = ((complex M).extendXIso e h₀).hom ≫ + ModuleCat.ofHom (differential M n) ≫ ((complex M).extendXIso e h₁).inv := by + simpa only [P, translatedResolution, e, complex_d] using! (complex M).extend_d_eq e h₀ h₁ + have hn : ¬ Function.Injective ((nakayamaComplex k P).d 0 1).hom := by + intro hi + have hmono : Mono (F.map (P.d 0 1)) := (ModuleCat.mono_iff_injective _).mpr hi + have hh : Mono (F.map (ModuleCat.ofHom (differential M n))) := + mono_map_of_conjugate F ((complex M).extendXIso e h₀) ((complex M).extendXIso e h₁) + (P.d 0 1) (ModuleCat.ofHom (differential M n)) he hmono + exact Nakayama.minimal_nakayama_differential_noninjective M n + ((ModuleCat.mono_iff_injective _).mp hh) + rw [Function.Injective] at hn + push Not at hn + obtain ⟨x, y, hxy, hne⟩ := hn + refine ⟨x-y, sub_ne_zero.mpr hne, ?_⟩ + change ((nakayamaComplex k P).d 0 1).hom (x-y) = 0 + rw [map_sub, hxy, sub_self] + +end LittleFinitistic.Rickard + +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Transport/DerivedEquivalence.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Transport/DerivedEquivalence.lean new file mode 100644 index 0000000000000000000000000000000000000000..1e692d94bcb44f1ac5e97682fae0287786f681cf --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Transport/DerivedEquivalence.lean @@ -0,0 +1,50 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Model + +namespace OAI + +section +section +noncomputable section +open CategoryTheory +namespace LittleFinitistic +universe u +variable (A : Type u) [Ring A] +section DerivedTransport +universe w₁ w₂ v₁ v₂ u₁ u₂ +variable {C : Type u₁} [Category.{v₁} C] [Abelian C] [HasDerivedCategory.{w₁} C] + {D : Type u₂} [Category.{v₂} D] [Abelian D] [HasDerivedCategory.{w₂} D] +open CategoryTheory.Limits CategoryTheory.Functor + +lemma mapDerivedCategory_isEquivalence (e : C ≌ D) + [e.functor.Additive] [e.inverse.Additive] : + e.functor.mapDerivedCategory.IsEquivalence := by + let f := e.functor.mapHomologicalComplex (ComplexShape.up ℤ) + let g := e.inverse.mapHomologicalComplex (ComplexShape.up ℤ) + let qC := DerivedCategory.Q (C := C) + let qD := DerivedCategory.Q (C := D) + let α : (f ⋙ qD) ⋙ e.inverse.mapDerivedCategory ≅ qC := + Functor.associator _ _ _ ≪≫ + isoWhiskerLeft f e.inverse.mapDerivedCategoryFactors ≪≫ + (Functor.associator _ _ _).symm ≪≫ + isoWhiskerRight (e.mapHomologicalComplex (ComplexShape.up ℤ)).unitIso.symm qC ≪≫ + Functor.leftUnitor qC + let β : (g ⋙ qC) ⋙ e.functor.mapDerivedCategory ≅ qD := + Functor.associator _ _ _ ≪≫ + isoWhiskerLeft g e.functor.mapDerivedCategoryFactors ≪≫ + (Functor.associator _ _ _).symm ≪≫ + isoWhiskerRight (e.mapHomologicalComplex (ComplexShape.up ℤ)).counitIso qD ≪≫ + Functor.leftUnitor qD + exact Localization.isEquivalence qC (HomologicalComplex.quasiIso C (ComplexShape.up ℤ)) + qD (HomologicalComplex.quasiIso D (ComplexShape.up ℤ)) + (f ⋙ qD) e.functor.mapDerivedCategory + (g ⋙ qC) e.inverse.mapDerivedCategory α β + +end DerivedTransport + +end LittleFinitistic +end +end +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Transport/DiagramMaps.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Transport/DiagramMaps.lean new file mode 100644 index 0000000000000000000000000000000000000000..14e6ffe61b14218dca543bfc06a3bb850792d160 --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Transport/DiagramMaps.lean @@ -0,0 +1,73 @@ +import Mathlib + +namespace OAI + +section +section +noncomputable section +open CategoryTheory CategoryTheory.Limits +namespace LittleFinitistic.DefaultSupport +universe v₁ v₂ v₃ u₁ u₂ u₃ +variable {C : Type u₁} [Category.{v₁} C] {D : Type u₂} [Category.{v₂} D] + {E : Type u₃} [Category.{v₃} E] +lemma mapped_retract (F : C ⥤ D) (G : D ⥤ E) {X Y : C} {Z : E} + (i : X ⟶ Y) (p : Y ⟶ X) (h : i ≫ p = 𝟙 X) (e : G.obj (F.obj Y) ≅ Z) : + (G.map (F.map i) ≫ e.hom) ≫ (e.inv ≫ G.map (F.map p)) = 𝟙 _ := by + simp only [Category.assoc, Iso.hom_inv_id_assoc] + rw [← G.map_comp, ← F.map_comp, h, F.map_id, G.map_id] +lemma mapped_conjugate (F : C ⥤ D) (G : D ⥤ E) {X Y : C} {W : E} + (p : X ⟶ Y) (i : Y ⟶ X) (a : X ⟶ X) (h : p ≫ i = a) + (e : W ≅ G.obj (F.obj X)) (c : W ⟶ W) + (hc : c ≫ e.hom = e.hom ≫ G.map (F.map a)) : + (e.hom ≫ G.map (F.map p)) ≫ (G.map (F.map i) ≫ e.inv) = c := by + apply (cancel_mono e.hom).mp + simp only [Category.assoc, Iso.inv_hom_id, Category.comp_id] + rw [← G.map_comp, ← F.map_comp, h] + exact hc.symm +lemma mapped_square (F : C ⥤ D) (G : D ⥤ E) {X Y : C} {W : E} + (a : X ⟶ X) (p : X ⟶ Y) (b : Y ⟶ Y) (h : a ≫ p = p ≫ b) + (e : W ≅ G.obj (F.obj X)) (c : W ⟶ W) + (hc : c ≫ e.hom = e.hom ≫ G.map (F.map a)) : + c ≫ (e.hom ≫ G.map (F.map p)) = + (e.hom ≫ G.map (F.map p)) ≫ G.map (F.map b) := by + rw [← Category.assoc, hc, Category.assoc, ← G.map_comp, ← F.map_comp, h] + simp only [F.map_comp, G.map_comp, Category.assoc] +lemma natural_square (F : C ⥤ D) (S : C ⥤ C) (T : D ⥤ D) (n : S ⋙ F ≅ F ⋙ T) + {X : C} {Y : D} (e : F.obj X ≅ Y) (a : X ⟶ X) (b : Y ⟶ Y) + (h : F.map a ≫ e.hom = e.hom ≫ b) : + F.map (S.map a) ≫ ((n.app X ≪≫ T.mapIso e).hom) = + (n.app X ≪≫ T.mapIso e).hom ≫ T.map b := by + have hn := n.hom.naturality a + have hm := congrArg T.map h + simp only [Functor.map_comp] at hm + change _ ≫ (n.hom.app X ≫ T.map e.hom) = (n.hom.app X ≫ T.map e.hom) ≫ _ + rw [← Category.assoc] + change ((S ⋙ F).map a ≫ n.hom.app X) ≫ T.map e.hom = _ + rw [hn, Category.assoc] + change _ ≫ (T.map (F.map a) ≫ T.map e.hom) = _ + rw [hm, ← Category.assoc] +lemma biprod_square [HasZeroMorphisms C] [HasZeroMorphisms D] + [HasBinaryBiproducts C] [HasBinaryBiproducts D] + (F : C ⥤ D) [F.PreservesZeroMorphisms] [PreservesBinaryBiproducts F] + {X₁ X₂ : C} {Y₁ Y₂ : D} (e₁ : F.obj X₁ ≅ Y₁) (e₂ : F.obj X₂ ≅ Y₂) + (a₁ : X₁ ⟶ X₁) (a₂ : X₂ ⟶ X₂) (b₁ : Y₁ ⟶ Y₁) (b₂ : Y₂ ⟶ Y₂) + (h₁ : F.map a₁ ≫ e₁.hom = e₁.hom ≫ b₁) + (h₂ : F.map a₂ ≫ e₂.hom = e₂.hom ≫ b₂) : + F.map (biprod.map a₁ a₂) ≫ (F.mapBiprod _ _ ≪≫ biprod.mapIso e₁ e₂).hom = + (F.mapBiprod _ _ ≪≫ biprod.mapIso e₁ e₂).hom ≫ biprod.map b₁ b₂ := by + apply biprod.hom_ext + · simp only [Iso.trans_hom, Functor.mapBiprod_hom, biprod.mapIso_hom, Category.assoc, + biprod.map_fst, biprod.map_fst_assoc, biprod.lift_fst_assoc] + rw [← Category.assoc, ← Functor.map_comp, biprod.map_fst, Functor.map_comp, + Category.assoc, h₁] + · simp only [Iso.trans_hom, Functor.mapBiprod_hom, biprod.mapIso_hom, Category.assoc, + biprod.map_snd, biprod.map_snd_assoc, biprod.lift_snd_assoc] + rw [← Category.assoc, ← Functor.map_comp, biprod.map_snd, Functor.map_comp, + Category.assoc, h₂] +end LittleFinitistic.DefaultSupport + +end +end +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Transport/FiniteModules.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Transport/FiniteModules.lean new file mode 100644 index 0000000000000000000000000000000000000000..03f9fa20126a7df4a41bb5c61f0511365df07a96 --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Transport/FiniteModules.lean @@ -0,0 +1,86 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Transport.ProjectiveDimension + +namespace OAI + +section +section +noncomputable section +open CategoryTheory +namespace LittleFinitistic +universe u +variable (A : Type u) [Ring A] +section FiniteTransport +universe v +variable {R S : Type v} [Ring R] [Ring S] + +lemma compactElement_orderIso {α β : Type*} [CompleteLattice α] [CompleteLattice β] + (e : α ≃o β) {a : α} (h : IsCompactElement a) : IsCompactElement (e a) := by + rw [isCompactElement_iff_exists_le_iSup_of_le_iSup] + intro ι f hf + have hf' : a ≤ ⨆ i, e.symm (f i) := by + rw [← e.symm.map_iSup] + exact (e.le_symm_apply).mpr hf + obtain ⟨s, hs⟩ := h.exists_finset_of_le_iSup (fun i => e.symm (f i)) hf' + refine ⟨s, ?_⟩ + simpa only [e.map_iSup, e.apply_symm_apply, Finset.sup_eq_iSup] using e.monotone hs + +lemma moduleFinite_equivalence_iff (e : ModuleCat.{v} R ≌ ModuleCat.{v} S) + (M : ModuleCat.{v} R) : Module.Finite S (e.functor.obj M) ↔ Module.Finite R M := by + let o : Submodule R M ≃o Submodule S (e.functor.obj M) := + (ModuleCat.subobjectModule M).symm.trans + ((Subobject.lowerEquivalence (MonoOver.congr M e)).toOrderIso.trans + (ModuleCat.subobjectModule (e.functor.obj M))) + rw [Module.finite_def, Module.finite_def, Submodule.fg_iff_compact, + Submodule.fg_iff_compact] + constructor + · intro h + simpa using compactElement_orderIso o.symm h + · intro h + simpa using compactElement_orderIso o h + +lemma littleFinitisticDimension_le_big (R : Type v) [Ring R] : + littleFinitisticDimension R ≤ bigFinitisticDimension R := by + refine iSup_le fun M => iSup_le fun _ => iSup_le fun h => ?_ + exact le_iSup_of_le M (le_iSup_of_le h le_rfl) + +lemma littleFinitisticDimension_le_of_equivalence + (e : ModuleCat.{v} R ≌ ModuleCat.{v} S) : + littleFinitisticDimension R ≤ littleFinitisticDimension S := by + refine iSup_le fun M => iSup_le fun hM => iSup_le fun hpd => ?_ + have hf : Module.Finite S (e.functor.obj M) := + (moduleFinite_equivalence_iff e M).mpr hM + have hd : projectiveDimension (e.functor.obj M) < ⊤ := by + rwa [projectiveDimension_equivalence e M] + exact le_iSup_of_le (e.functor.obj M) (le_iSup_of_le hf + (le_iSup_of_le hd (le_of_eq (projectiveDimension_equivalence e M).symm))) + +lemma littleFinitisticDimension_equivalence + (e : ModuleCat.{v} R ≌ ModuleCat.{v} S) : + littleFinitisticDimension R = littleFinitisticDimension S := + le_antisymm (littleFinitisticDimension_le_of_equivalence e) + (littleFinitisticDimension_le_of_equivalence e.symm) + +lemma bigFinitisticDimension_le_of_equivalence + (e : ModuleCat.{v} R ≌ ModuleCat.{v} S) : + bigFinitisticDimension R ≤ bigFinitisticDimension S := by + refine iSup_le fun M => iSup_le fun hpd => ?_ + have hd : projectiveDimension (e.functor.obj M) < ⊤ := by + rwa [projectiveDimension_equivalence e M] + exact le_iSup_of_le (e.functor.obj M) + (le_iSup_of_le hd (le_of_eq (projectiveDimension_equivalence e M).symm)) + +lemma bigFinitisticDimension_equivalence + (e : ModuleCat.{v} R ≌ ModuleCat.{v} S) : + bigFinitisticDimension R = bigFinitisticDimension S := + le_antisymm (bigFinitisticDimension_le_of_equivalence e) + (bigFinitisticDimension_le_of_equivalence e.symm) + +end FiniteTransport + +end LittleFinitistic +end +end +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Transport/InjectiveGeneration.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Transport/InjectiveGeneration.lean new file mode 100644 index 0000000000000000000000000000000000000000..ddd457fb67ec4c4b81dee20e1a86ab652144e5e2 --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Transport/InjectiveGeneration.lean @@ -0,0 +1,51 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Transport.DerivedEquivalence + +namespace OAI + +section +section +noncomputable section +open CategoryTheory +namespace LittleFinitistic +universe u +variable (A : Type u) [Ring A] +section InjectiveGenerationTransport +universe v +variable {R S : Type v} [Ring R] [Ring S] +open CategoryTheory.Limits + +lemma injectivesGenerate_of_equivalence + (e : ModuleCat.{v} R ≌ ModuleCat.{v} S) (hR : InjectivesGenerate R) : + InjectivesGenerate S := by + let := HasDerivedCategory.standard (ModuleCat.{v} R) + let := HasDerivedCategory.standard (ModuleCat.{v} S) + let : e.functor.Additive := e.functor.additive_of_preserves_binary_products + let : e.inverse.Additive := e.inverse.additive_of_preserves_binary_products + let F := e.functor.mapDerivedCategory + let : F.IsEquivalence := mapDerivedCategory_isEquivalence e + intro P hP hT hCol hI X + let := hP + let := hT + let (index : Type v) := hCol index + have h : ∀ Y, (P.inverseImage F) Y := by + apply hR (P.inverseImage F) inferInstance inferInstance (fun I => inferInstance) + intro M hM + let := hM + exact P.prop_of_iso ((e.functor.mapDerivedCategorySingleFunctor 0).app M).symm + (hI (e.functor.obj M) inferInstance) + exact P.prop_of_iso (F.asEquivalence.counitIso.app X) (h (F.asEquivalence.inverse.obj X)) + +lemma injectivesGenerate_equivalence + (e : ModuleCat.{v} R ≌ ModuleCat.{v} S) : + InjectivesGenerate R ↔ InjectivesGenerate S := + ⟨injectivesGenerate_of_equivalence e, injectivesGenerate_of_equivalence e.symm⟩ + +end InjectiveGenerationTransport + +end LittleFinitistic +end +end +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Transport/ProjectiveDimension.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Transport/ProjectiveDimension.lean new file mode 100644 index 0000000000000000000000000000000000000000..79023e7acbb378c021187044aec9e583b71f1890 --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Transport/ProjectiveDimension.lean @@ -0,0 +1,96 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Model + +namespace OAI + +section +section +noncomputable section +open CategoryTheory + +namespace LittleFinitistic +universe u +variable (A : Type u) [Ring A] + +section ProjectiveTransport +universe v₁ v₂ u₁ u₂ +variable {C : Type u₁} [Category.{v₁} C] [Abelian C] [EnoughProjectives C] + {D : Type u₂} [Category.{v₂} D] [Abelian D] [EnoughProjectives D] +open CategoryTheory.Limits + +omit [EnoughProjectives D] in +lemma hasProjectiveDimensionLT_of_fullyFaithful + (F : C ⥤ D) [F.Additive] [PreservesFiniteLimits F] [PreservesFiniteColimits F] + [F.Full] [F.Faithful] [F.PreservesProjectiveObjects] + (X : C) (n : ℕ) [HasProjectiveDimensionLT (F.obj X) n] : + HasProjectiveDimensionLT X n := by + let := HasExt.standard C + let := HasExt.standard D + apply HasProjectiveDimensionLT.mk + intro i hi Y e + apply (F.mapExt_bijective_of_preservesProjectiveObjects X Y i).injective + rw [map_zero] + exact (F.mapExtAddHom X Y i e).eq_zero_of_hasProjectiveDimensionLT n hi + +omit [EnoughProjectives D] in +lemma hasProjectiveDimensionLT_map + (F : C ⥤ D) [F.Additive] [PreservesFiniteLimits F] [PreservesFiniteColimits F] + [F.PreservesProjectiveObjects] (X : C) (n : ℕ) [HasProjectiveDimensionLT X n] : + HasProjectiveDimensionLT (F.obj X) n := by + induction n generalizing X with + | zero => + exact (F.map_isZero (isZero_of_hasProjectiveDimensionLT_zero X)).hasProjectiveDimensionLT_zero + | succ n ih => + cases n with + | zero => + let : Projective X := projective_iff_hasProjectiveDimensionLT_one.mpr (by assumption) + exact inferInstance + | succ n => + let S := ShortComplex.mk (kernel.ι (Projective.π X)) (Projective.π X) + (kernel.condition (Projective.π X)) + have hs : S.ShortExact := { exact := ShortComplex.exact_kernel (Projective.π X) } + have hk : HasProjectiveDimensionLT S.X₁ (n + 1) := + (hs.hasProjectiveDimensionLT_X₃_iff n inferInstance).mp inferInstance + let := hk + exact (hs.map_of_exact F).hasProjectiveDimensionLT_X₃ (n + 1) + (ih S.X₁) (by + change HasProjectiveDimensionLT (F.obj (Projective.over X)) (n + 1 + 1) + exact hasProjectiveDimensionLT_of_ge _ 1 _ (by omega)) + +omit [EnoughProjectives D] in +lemma projectiveDimension_fullyFaithful + (F : C ⥤ D) [F.Additive] [PreservesFiniteLimits F] [PreservesFiniteColimits F] + [F.PreservesProjectiveObjects] [F.Full] [F.Faithful] (X : C) : + projectiveDimension (F.obj X) = projectiveDimension X := by + have h (n : ℕ) : HasProjectiveDimensionLT (F.obj X) n ↔ HasProjectiveDimensionLT X n := + ⟨fun h => @hasProjectiveDimensionLT_of_fullyFaithful _ _ _ _ _ _ _ F _ _ _ _ _ _ X n h, + fun h => @hasProjectiveDimensionLT_map _ _ _ _ _ _ _ F _ _ _ _ X n h⟩ + simp only [projectiveDimension, h] + +lemma hasProjectiveDimensionLT_equivalence_iff (e : C ≌ D) (X : C) (n : ℕ) : + HasProjectiveDimensionLT (e.functor.obj X) n ↔ HasProjectiveDimensionLT X n := by + let : e.functor.Additive := e.functor.additive_of_preserves_binary_products + let : e.inverse.Additive := e.inverse.additive_of_preserves_binary_products + constructor + · intro h + let : HasProjectiveDimensionLT (e.functor.obj X) n := h + exact hasProjectiveDimensionLT_of_fullyFaithful e.functor X n + · intro h + let : HasProjectiveDimensionLT X n := h + let : HasProjectiveDimensionLT (e.inverse.obj (e.functor.obj X)) n := + hasProjectiveDimensionLT_of_iso (show X ≅ e.inverse.obj (e.functor.obj X) from + e.unitIso.app X) n + exact hasProjectiveDimensionLT_of_fullyFaithful e.inverse (e.functor.obj X) n + +lemma projectiveDimension_equivalence (e : C ≌ D) (X : C) : + projectiveDimension (e.functor.obj X) = projectiveDimension X := by + simp only [projectiveDimension, hasProjectiveDimensionLT_equivalence_iff e X] + +end ProjectiveTransport + +end LittleFinitistic +end +end +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Transport/ScalarRestriction.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Transport/ScalarRestriction.lean new file mode 100644 index 0000000000000000000000000000000000000000..dc689f3df76af72fabe966dd2d29d20bb0be24d2 --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Transport/ScalarRestriction.lean @@ -0,0 +1,107 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Transport.ProjectiveDimension + +namespace OAI + +section +section +noncomputable section +open CategoryTheory +namespace LittleFinitistic +universe u +variable (A : Type u) [Ring A] + +section RestrictionAlongSurjection +universe v +variable {R S : Type v} [Ring R] [Ring S] + +open CategoryTheory.Limits + +instance restrictScalars_preservesFiniteLimits (f : R →+* S) : + PreservesFiniteLimits (ModuleCat.restrictScalars.{v} f) where + preservesFiniteLimits _ _ _ := { preservesLimit := fun {_} => inferInstance } + +instance restrictScalars_preservesFiniteColimits (f : R →+* S) : + PreservesFiniteColimits (ModuleCat.restrictScalars.{v} f) where + preservesFiniteColimits _ _ _ := { preservesColimit := fun {_} => inferInstance } + +lemma restrictScalars_full (f : R →+* S) (hf : Function.Surjective f) : + (ModuleCat.restrictScalars.{v} f).Full where + map_surjective {M N} g := by + refine ⟨ModuleCat.ofHom { g.hom with map_smul' := ?_ }, ?_⟩ + · intro s m + obtain ⟨r, rfl⟩ := hf s + exact g.hom.map_smul r m + · rfl + +lemma restrictScalars_preservesProjectives (f : R →+* S) + [Module.Projective R ((ModuleCat.restrictScalars f).obj (ModuleCat.of S S))] : + (ModuleCat.restrictScalars.{v} f).PreservesProjectiveObjects where + projective_obj {P} hP := by + classical + let := hP + let F := ModuleCat.restrictScalars.{v} f + let Q := F.obj (ModuleCat.of S S) + obtain ⟨i, hi⟩ := Module.projective_def'.mp (inferInstance : Module.Projective S P) + let : Module.Projective R (F.obj (ModuleCat.of S (P →₀ S))) := by + change Module.Projective R (P →₀ Q) + exact Module.Projective.of_equiv (finsuppLequivDFinsupp R).symm + let : Module.Projective R (F.obj P) := Module.Projective.of_split + (F.map (ModuleCat.ofHom i)).hom + (F.map (ModuleCat.ofHom (Finsupp.linearCombination S id))).hom (by + ext x + exact DFunLike.congr_fun hi x) + exact inferInstance + +lemma finite_restrictScalars (f : R →+* S) (hf : Function.Surjective f) + (M : ModuleCat.{v} S) [Module.Finite S M] : + Module.Finite R ((ModuleCat.restrictScalars f).obj M) := by + let N := (ModuleCat.restrictScalars f).obj M + obtain ⟨s, hs⟩ := Module.Finite.fg_top (R := S) (M := M) + refine ⟨s, ?_⟩ + apply top_unique + intro x hx + have hx' : (x : M) ∈ Submodule.span S (s : Set M) := by rw [hs]; trivial + clear hx + induction hx' using Submodule.span_induction with + | mem x hx => exact Submodule.subset_span hx + | zero => exact Submodule.zero_mem _ + | add x y hx hy ihx ihy => exact Submodule.add_mem _ ihx ihy + | smul a x hx ih => + obtain ⟨r, rfl⟩ := hf a + exact Submodule.smul_mem (Submodule.span R (show Set N from (s : Set M))) r ih + +lemma littleFinitisticDimension_le_restrictScalars (f : R →+* S) + (hf : Function.Surjective f) + [Module.Projective R ((ModuleCat.restrictScalars f).obj (ModuleCat.of S S))] : + littleFinitisticDimension S ≤ littleFinitisticDimension R := by + let := restrictScalars_full f hf + let := restrictScalars_preservesProjectives f + refine iSup_le fun M => iSup_le fun hfg => iSup_le fun hpd => ?_ + let := hfg + have heq := projectiveDimension_fullyFaithful (ModuleCat.restrictScalars f) M + rw [← heq] + exact le_iSup_of_le ((ModuleCat.restrictScalars f).obj M) + (le_iSup_of_le (finite_restrictScalars f hf M) + (le_iSup_of_le (by rwa [heq]) le_rfl)) + +lemma bigFinitisticDimension_le_restrictScalars (f : R →+* S) + (hf : Function.Surjective f) + [Module.Projective R ((ModuleCat.restrictScalars f).obj (ModuleCat.of S S))] : + bigFinitisticDimension S ≤ bigFinitisticDimension R := by + let := restrictScalars_full f hf + let := restrictScalars_preservesProjectives f + refine iSup_le fun M => iSup_le fun hpd => ?_ + have heq := projectiveDimension_fullyFaithful (ModuleCat.restrictScalars f) M + rw [← heq] + exact le_iSup_of_le ((ModuleCat.restrictScalars f).obj M) + (le_iSup_of_le (by rwa [heq]) le_rfl) + +end RestrictionAlongSurjection + +end LittleFinitistic +end +end +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Triangular/Algebra.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Triangular/Algebra.lean new file mode 100644 index 0000000000000000000000000000000000000000..c011c9bb0742a13f2883936826c37a2910ad08b3 --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Triangular/Algebra.lean @@ -0,0 +1,142 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Transport.ScalarRestriction + +namespace OAI + +section +section +noncomputable section +open CategoryTheory +namespace LittleFinitistic +universe u +variable (A : Type u) [Ring A] +namespace TriangularConstruction +universe v +variable (C E U : Type v) + +def OffDiagonal (_C _E U : Type v) := U + +def offValue {C E U : Type v} (x : OffDiagonal C E U) : U := x + +namespace OffDiagonal +variable [Ring C] [Ring E] [AddCommGroup U] + +instance : AddCommGroup (OffDiagonal C E U) := inferInstanceAs (AddCommGroup U) + +instance [Module E U] : Module (C × E) (OffDiagonal C E U) := + Module.compHom U (RingHom.snd C E) + +instance [Module Cᵐᵒᵖ U] : Module (C × E)ᵐᵒᵖ (OffDiagonal C E U) := + Module.compHom U (RingHom.fst C E).op + +instance [Module E U] [Module Cᵐᵒᵖ U] [SMulCommClass E Cᵐᵒᵖ U] : + SMulCommClass (C × E) (C × E)ᵐᵒᵖ (OffDiagonal C E U) where + smul_comm p q x := by + change p.2 • (MulOpposite.op q.unop.1 • (offValue x)) = + MulOpposite.op q.unop.1 • (p.2 • (offValue x)) + exact smul_comm _ _ _ + +variable (k : Type v) [Field k] [_root_.Algebra k C] [_root_.Algebra k E] [Module k U] + +instance : Module k (OffDiagonal C E U) := inferInstanceAs (Module k U) + +instance [Module E U] [IsScalarTower k E U] : + IsScalarTower k (C × E) (OffDiagonal C E U) where + smul_assoc r p x := by + change (r • p.2) • (offValue x) = r • (p.2 • (offValue x)) + exact smul_assoc _ _ _ + +instance [Module Cᵐᵒᵖ U] [IsScalarTower k Cᵐᵒᵖ U] : + IsScalarTower k (C × E)ᵐᵒᵖ (OffDiagonal C E U) where + smul_assoc r p x := by + change (r • MulOpposite.op p.unop.1) • (offValue x) = + r • (MulOpposite.op p.unop.1 • (offValue x)) + exact smul_assoc _ _ _ + +instance [FiniteDimensional k U] : FiniteDimensional k (OffDiagonal C E U) := + inferInstanceAs (FiniteDimensional k U) + +end OffDiagonal + +abbrev Algebra := TrivSqZeroExt (C × E) (OffDiagonal C E U) + +variable [Ring C] [Ring E] [AddCommGroup U] [Module E U] [Module Cᵐᵒᵖ U] + [SMulCommClass E Cᵐᵒᵖ U] + +omit [SMulCommClass E Cᵐᵒᵖ U] in +lemma mul_formula (x y : Algebra C E U) : + x * y = ((x.fst.1 * y.fst.1, x.fst.2 * y.fst.2), + x.fst.2 • (offValue y.snd) + MulOpposite.op y.fst.1 • (offValue x.snd)) := rfl + +def toC : Algebra C E U →+* C where + toFun x := x.fst.1 + map_zero' := rfl + map_one' := rfl + map_add' _ _ := rfl + map_mul' _ _ := rfl + +omit [SMulCommClass E Cᵐᵒᵖ U] in +lemma toC_surjective : Function.Surjective (toC C E U) := + fun c => ⟨((c, 0), 0), rfl⟩ + +def rightCornerSection : + ((ModuleCat.restrictScalars (toC C E U).op).obj (ModuleCat.of Cᵐᵒᵖ Cᵐᵒᵖ)) →ₗ[ + (Algebra C E U)ᵐᵒᵖ] (Algebra C E U)ᵐᵒᵖ where + toFun c := MulOpposite.op ((c.unop, 0), 0) + map_add' c d := by + apply MulOpposite.unop_injective + apply TrivSqZeroExt.ext + · apply Prod.ext + · rfl + · exact (zero_add (0 : E)).symm + · exact (zero_add (0 : U)).symm + map_smul' r c := by + apply MulOpposite.unop_injective + apply TrivSqZeroExt.ext + · apply Prod.ext + · rfl + · exact (zero_mul _).symm + · change 0 = (0 : E) • (offValue r.unop.snd) + MulOpposite.op r.unop.fst.1 • (0 : U) + simp + +lemma rightCorner_projective : + Module.Projective (Algebra C E U)ᵐᵒᵖ + ((ModuleCat.restrictScalars (toC C E U).op).obj (ModuleCat.of Cᵐᵒᵖ Cᵐᵒᵖ)) := by + apply Module.Projective.of_split (rightCornerSection C E U) + (Module.compHom.toLinearMap (toC C E U).op) + ext x + rfl + +lemma right_little_lower_bound : + littleFinitisticDimension Cᵐᵒᵖ ≤ littleFinitisticDimension (Algebra C E U)ᵐᵒᵖ := by + let := rightCorner_projective C E U + apply littleFinitisticDimension_le_restrictScalars (toC C E U).op + intro c + obtain ⟨t, ht⟩ := toC_surjective C E U c.unop + exact ⟨MulOpposite.op t, congrArg MulOpposite.op ht⟩ + +lemma right_big_lower_bound : + bigFinitisticDimension Cᵐᵒᵖ ≤ bigFinitisticDimension (Algebra C E U)ᵐᵒᵖ := by + let := rightCorner_projective C E U + apply bigFinitisticDimension_le_restrictScalars (toC C E U).op + intro c + obtain ⟨t, ht⟩ := toC_surjective C E U c.unop + exact ⟨MulOpposite.op t, congrArg MulOpposite.op ht⟩ + +variable (k : Type v) [Field k] [_root_.Algebra k C] [_root_.Algebra k E] [Module k U] + [IsScalarTower k E U] [IsScalarTower k Cᵐᵒᵖ U] + [FiniteDimensional k C] [FiniteDimensional k E] [FiniteDimensional k U] + +omit [Module E U] [Module Cᵐᵒᵖ U] [SMulCommClass E Cᵐᵒᵖ U] + [IsScalarTower k E U] [IsScalarTower k Cᵐᵒᵖ U] in +lemma finiteDimensional : FiniteDimensional k (Algebra C E U) := + inferInstanceAs (FiniteDimensional k ((C × E) × OffDiagonal C E U)) + +end TriangularConstruction + +end LittleFinitistic +end +end +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Triangular/Augmentation.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Triangular/Augmentation.lean new file mode 100644 index 0000000000000000000000000000000000000000..f2359f44589fe310ac6489e9e1df8d3dcea464c5 --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Triangular/Augmentation.lean @@ -0,0 +1,110 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.ZeroDimensions +import OAI.Algebra.FinitisticAsymmetry.Triangular.Socle + +namespace OAI + +section +section +noncomputable section +open CategoryTheory +namespace LittleFinitistic +universe u +variable (A : Type u) [Ring A] +namespace CummingsConstruction +variable {k C ι : Type u} [Field k] [Ring C] [Algebra k C] +variable (χ : C →ₐ[k] (ι → k)) +lemma mem_ker_augmentation (x : T χ) : + x ∈ RingHom.ker (augmentation χ).toRingHom ↔ χ x.fst.1 = 0 ∧ newAugmentation x.fst.2 = 0 := by + change (Sum.elim (χ x.fst.1) (newAugmentation x.fst.2) : Sum ι ι → k) = 0 ↔ _ + constructor + · intro h + exact ⟨funext fun i => congrFun h (.inl i), funext fun i => congrFun h (.inr i)⟩ + · rintro ⟨h₁, h₂⟩ + ext i + cases i <;> simp [h₁, h₂] + +def pureOldRadical : Ideal (T χ) where + carrier := {x | x.fst.2 = 0 ∧ (SimpleSum.value (TriangularConstruction.offValue x.snd)) = 0 ∧ χ x.fst.1 = 0} + zero_mem' := ⟨rfl, rfl, map_zero χ⟩ + add_mem' := by + rintro x y ⟨hxe, hxu, hxc⟩ ⟨hye, hyu, hyc⟩ + change x.fst.2 + y.fst.2 = 0 ∧ + SimpleSum.value (TriangularConstruction.offValue x.snd) + SimpleSum.value (TriangularConstruction.offValue y.snd) = 0 ∧ χ (x.fst.1 + y.fst.1) = 0 + simp [hxe, hye, hxu, hyu, hxc, hyc, map_add] + smul_mem' := by + rintro r x ⟨hxe, hxu, hxc⟩ + change r.fst.2 * x.fst.2 = 0 ∧ + newAugmentation r.fst.2 * SimpleSum.value (TriangularConstruction.offValue x.snd) + + χ x.fst.1 * SimpleSum.value (TriangularConstruction.offValue r.snd) = 0 ∧ χ (r.fst.1 * x.fst.1) = 0 + simp [hxe, hxu, hxc, map_mul] + +lemma ker_square_pureOldRadical : + (RingHom.ker (augmentation χ).toRingHom) ^ 2 ≤ pureOldRadical χ := by + rw [Submodule.pow_succ, Submodule.pow_one] + apply Ideal.mul_le.mpr + intro x hx y hy + obtain ⟨hxc, hxe⟩ := (mem_ker_augmentation χ x).mp hx + obtain ⟨hyc, hye⟩ := (mem_ker_augmentation χ y).mp hy + change x.fst.2 * y.fst.2 = 0 ∧ + newAugmentation x.fst.2 * SimpleSum.value (TriangularConstruction.offValue y.snd) + + χ y.fst.1 * SimpleSum.value (TriangularConstruction.offValue x.snd) = 0 ∧ χ (x.fst.1 * y.fst.1) = 0 + refine ⟨?_, by simp [hxe, hyc], by simp [map_mul, hxc]⟩ + ext i : 1 + have hx0 : (x.fst.2 i).fst = 0 := congrFun hxe i + have hy0 : (y.fst.2 i).fst = 0 := congrFun hye i + apply TrivSqZeroExt.ext <;> simp [hx0, hy0] + +lemma pow_le_comap_pow_noncomm {R S : Type*} [Ring R] [Ring S] (f : R →+* S) + (I : Ideal R) (J : Ideal S) (h : I ≤ J.comap f) (n : ℕ) : I ^ n ≤ (J ^ n).comap f := by + induction n with + | zero => simp [Submodule.pow_zero, Ideal.one_eq_top] + | succ n ih => + rw [Submodule.pow_succ, Submodule.pow_succ] + apply Ideal.mul_le.mpr + intro x hx y hy + change f (x * y) ∈ J ^ n * J + rw [map_mul] + exact Ideal.mul_mem_mul (ih hx) (h hy) + +lemma augmentation_ker_nilpotent (hJ : ∃ n : ℕ, (RingHom.ker χ.toRingHom) ^ n = ⊥) : + ∃ n : ℕ, (RingHom.ker (augmentation χ).toRingHom) ^ n = ⊥ := by + obtain ⟨n, hn⟩ := hJ + let K := RingHom.ker (augmentation χ).toRingHom + let J := RingHom.ker χ.toRingHom + have hcomap : K ≤ J.comap (TriangularConstruction.toC C (NewCorner k ι) (SimpleSum χ)) := by + intro x hx + exact ((mem_ker_augmentation χ x).mp hx).1 + have hpow := pow_le_comap_pow_noncomm _ K J hcomap (n + 2) + have hjn : J ^ (n + 2) = ⊥ := by + apply le_bot_iff.mp + exact (Ideal.pow_le_pow_right (I := J) (Nat.le_add_right n 2)).trans hn.le + rw [hjn] at hpow + refine ⟨n + 2, le_bot_iff.mp ?_⟩ + intro x hx + have hc : x.fst.1 = 0 := hpow hx + have hp := ker_square_pureOldRadical χ ((Ideal.pow_le_pow_right (I := K) (by omega : 2 ≤ n + 2)) hx) + change x = 0 + apply TrivSqZeroExt.ext + · exact Prod.ext hc hp.1 + · exact hp.2.1 + +variable [DecidableEq ι] + +lemma left_dimensions_zero [Finite ι] [Nontrivial C] + (hχ : Function.Surjective χ) (hJ : ∃ n : ℕ, (RingHom.ker χ.toRingHom) ^ n = ⊥) : + littleFinitisticDimension (T χ) = 0 ∧ bigFinitisticDimension (T χ) = 0 := by + let : Nontrivial (T χ) := inferInstanceAs (Nontrivial ((C × NewCorner k ι) × + TriangularConstruction.OffDiagonal C (NewCorner k ι) (SimpleSum χ))) + exact dimensions_zero_of_splitBasic_rightSocle (augmentation χ) + (augmentation_surjective χ hχ) (augmentation_ker_nilpotent χ hJ) + (socle χ) (socle_ne_zero χ) (socle_mul χ) + +end CummingsConstruction +end LittleFinitistic + +end +end +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Triangular/Generation.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Triangular/Generation.lean new file mode 100644 index 0000000000000000000000000000000000000000..262b6bfeecd4662fd5d437711b66fa57d5f99769 --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Triangular/Generation.lean @@ -0,0 +1,164 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Triangular.Augmentation +import OAI.Algebra.FinitisticAsymmetry.Derived.UpperTruncation +import OAI.Algebra.FinitisticAsymmetry.Derived.ExactExtension +import OAI.Algebra.FinitisticAsymmetry.Derived.ModuleGeneration +import OAI.Algebra.FinitisticAsymmetry.Triangular.InjectiveResolution + +namespace OAI + +noncomputable section + +open CategoryTheory CategoryTheory.Limits CategoryTheory.Pretriangulated HomologicalComplex +namespace LittleFinitistic.CummingsConstruction +universe u w +variable {k C ι : Type u} [Field k] [Ring C] [Algebra k C] +variable (χ : C →ₐ[k] (ι → k)) (i : ι) + +lemma periodicOld_d (m n : ℕ) : (periodicOld χ i).d m n = 0 := by + by_cases h : m = n+1 + · subst m + simp [periodicOld] + rfl + · exact (periodicOld χ i).shape m n (by simpa [ComplexShape.down_Rel, eq_comm] using h) + +def oldSingleι (n : ℕ) : (HomologicalComplex.single (ModuleCat (T χ)) (.down ℕ) n).obj + (oldSimple χ i) ⟶ periodicOld χ i := + mkHomFromSingle (𝟙 _) (fun j hj => by simp [periodicOld_d]; exact Category.id_comp _) + +def oldSingleπ (n : ℕ) : periodicOld χ i ⟶ + (HomologicalComplex.single (ModuleCat (T χ)) (.down ℕ) n).obj (oldSimple χ i) := + mkHomToSingle (𝟙 _) (fun j hj => by simp [periodicOld_d]; exact Category.comp_id _) + +lemma oldSingleι_π (n : ℕ) : oldSingleι χ i n ≫ oldSingleπ χ i n = 𝟙 _ := by + apply from_single_hom_ext + simp [oldSingleι, oldSingleπ] + erw [mkHomFromSingle_f, mkHomToSingle_f, Category.comp_id, Category.id_comp, + Iso.hom_inv_id] + +abbrev extendedInjective := (periodicInjective χ i).extend ComplexShape.embeddingDownNat +abbrev extendedRegular := (periodicRegular χ i).extend ComplexShape.embeddingDownNat +abbrev extendedOld := (periodicOld χ i).extend ComplexShape.embeddingDownNat + +variable [HasDerivedCategory.{w} (ModuleCat.{u} (T χ))] + +def regularDerivedIso : DerivedCategory.Q.obj (extendedRegular χ i) ≅ + (DerivedCategory.singleFunctor (ModuleCat (T χ)) 0).obj (newSimple χ i) := + asIso (DerivedCategory.Q.map (extendMap (periodicAug χ i) ComplexShape.embeddingDownNat)) ≪≫ + DerivedCategory.Q.mapIso (extendSingleIso ComplexShape.embeddingDownNat (newSimple χ i) 0 0 rfl) ≪≫ + ((DerivedCategory.singleFunctorIsoCompQ (ModuleCat (T χ)) 0).app (newSimple χ i)).symm + +def oldSingleDerivedIso (n : ℕ) : + DerivedCategory.Q.obj (((HomologicalComplex.single (ModuleCat (T χ)) (.down ℕ) n).obj + (oldSimple χ i)).extend ComplexShape.embeddingDownNat) ≅ + (DerivedCategory.singleFunctor (ModuleCat (T χ)) (-(n : ℤ))).obj (oldSimple χ i) := + DerivedCategory.Q.mapIso (extendSingleIso ComplexShape.embeddingDownNat (oldSimple χ i) n (-(n : ℤ)) rfl) ≪≫ + ((DerivedCategory.singleFunctorIsoCompQ (ModuleCat (T χ)) (-n)).app (oldSimple χ i)).symm + +omit [HasDerivedCategory (ModuleCat (T χ))] in +lemma extended_shortExact : + ((ShortComplex.mk (periodicι χ i) (periodicπ χ i) (periodicι_π χ i)).map + (ComplexShape.embeddingDownNat.extendFunctor (ModuleCat (T χ)))).ShortExact := + DerivedSupport.extend_shortExact _ _ (periodic_shortExact χ i) + +variable (P : ObjectProperty (DerivedCategory (ModuleCat.{u} (T χ)))) + [P.IsClosedUnderIsomorphisms] [P.IsTriangulated] + [P.IsClosedUnderColimitsOfShape (Discrete ℕ)] + (hI : ∀ M : ModuleCat.{u} (T χ), Injective M → + P ((DerivedCategory.singleFunctor (ModuleCat (T χ)) 0).obj M)) + +include hI + +lemma extendedInjective_mem [DecidableEq ι] : P (DerivedCategory.Q.obj (extendedInjective χ i)) := by + apply DerivedSupport.prop_of_boundedAbove_terms P _ 0 + · intro j hj + exact CochainComplex.isZero_of_isStrictlyLE _ 0 j hj + · intro j + apply hI + by_cases hj : ∃ n : ℕ, ComplexShape.embeddingDownNat.f n = j + · obtain ⟨n, hn⟩ := hj + exact Injective.of_iso ((periodicInjective χ i).extendXIso _ hn).symm + (newInjective_injective χ i) + · exact (isZero_extend_X _ _ j (fun n hn => hj ⟨n,hn⟩)).injective + +lemma oldSimple_shifted_retract [DecidableEq ι] : + P ((DerivedCategory.singleFunctor (ModuleCat (T χ)) (-2)).obj (oldSimple χ i)) := by + let S := (ShortComplex.mk (periodicι χ i) (periodicπ χ i) (periodicι_π χ i)).map + (ComplexShape.embeddingDownNat.extendFunctor (ModuleCat (T χ))) + let hS := extended_shortExact χ i + let Δ := DerivedCategory.triangleOfSES hS + have hΔ : Δ ∈ distTriang _ := DerivedCategory.triangleOfSES_distinguished hS + let F := ComplexShape.embeddingDownNat.extendFunctor (ModuleCat (T χ)) ⋙ DerivedCategory.Q + let j := F.map (oldSingleι χ i 2) + let p := F.map (oldSingleπ χ i 2) + have hjp : j ≫ p = 𝟙 _ := by + dsimp [j,p] + rw [← F.map_comp, oldSingleι_π, F.map_id] + have hzero : j ≫ Δ.mor₃ = 0 := by + have hle : (DerivedCategory.TStructure.t (C := ModuleCat (T χ))).IsLE (F.obj _) (-2) := + DerivedCategory.TStructure.t.isLE_of_iso (oldSingleDerivedIso χ i 2).symm (-2) + have hge : (DerivedCategory.TStructure.t (C := ModuleCat (T χ))).IsGE Δ.obj₁ 0 := + DerivedCategory.TStructure.t.isGE_of_iso (regularDerivedIso χ i).symm 0 + have hges := DerivedCategory.TStructure.t.isGE_shift Δ.obj₁ 0 1 (-1) (by omega) + exact DerivedCategory.TStructure.t.zero (j ≫ Δ.mor₃) (-2) (-1) (by omega) + obtain ⟨l, hl⟩ := Triangle.coyoneda_exact₃ Δ hΔ j hzero + have hlp : l ≫ (Δ.mor₂ ≫ p) = 𝟙 _ := by erw [← Category.assoc, ← hl, hjp] + apply P.prop_of_iso (oldSingleDerivedIso χ i 2) + exact DerivedSupport.localizing_of_retract l (Δ.mor₂ ≫ p) hlp P + (extendedInjective_mem χ i P hI) + +lemma oldSimple_mem [DecidableEq ι] : + P ((DerivedCategory.singleFunctor (ModuleCat (T χ)) 0).obj (oldSimple χ i)) := by + apply P.prop_of_iso (((DerivedCategory.singleFunctors (ModuleCat (T χ))).shiftIso + (-2) 0 (-2) (by omega)).app (oldSimple χ i)) + exact P.le_shift (-2) _ (oldSimple_shifted_retract χ i P hI) + +lemma newRegular_mem [DecidableEq ι] : + P ((DerivedCategory.singleFunctor (ModuleCat (T χ)) 0).obj (newRegular χ i)) := by + exact DerivedSupport.prop_single_shortExact₁ P _ (newRegular_exact χ i) + (hI _ (newInjective_injective χ i)) (oldSimple_mem χ i P hI) + +lemma newSimple_mem [DecidableEq ι] : + P ((DerivedCategory.singleFunctor (ModuleCat (T χ)) 0).obj (newSimple χ i)) := by + apply P.prop_of_iso (regularDerivedIso χ i) + apply DerivedSupport.prop_of_boundedAbove_terms P _ 0 + · intro j hj + exact CochainComplex.isZero_of_isStrictlyLE _ 0 j hj + · intro j + by_cases hj : ∃ n : ℕ, ComplexShape.embeddingDownNat.f n = j + · obtain ⟨n, hn⟩ := hj + apply P.prop_of_iso ((DerivedCategory.singleFunctor (ModuleCat (T χ)) 0).mapIso + ((periodicRegular χ i).extendXIso _ hn).symm) + exact newRegular_mem χ i P hI + · apply P.prop_of_isZero + apply (DerivedCategory.singleFunctor (ModuleCat (T χ)) 0).map_isZero + exact isZero_extend_X _ _ j (fun n hn => hj ⟨n,hn⟩) + +omit hI [HasDerivedCategory.{w} (ModuleCat.{u} (T χ))] in +lemma injectivesGenerate [Fintype ι] (hχ : Function.Surjective χ) + (hnil : ∃ n : ℕ, (RingHom.ker χ.toRingHom)^n = ⊥) : + InjectivesGenerate (T χ) := by + classical + let := HasDerivedCategory.standard (ModuleCat.{u} (T χ)) + intro P hP hT hcop hI X + let := hP + let := hT + let (I : Type u) := hcop I + let : P.IsClosedUnderColimitsOfShape (Discrete ℕ) := + ObjectProperty.IsClosedUnderColimitsOfShape.of_equivalence + (Discrete.equivalence (Equiv.ulift : ULift.{u} ℕ ≃ ℕ)) + apply DerivedSupport.localizing_eq_top_of_all_modules P + · intro M + apply DerivedSupport.prop_all_of_product_augmentation P hcop + (augmentation χ).toRingHom (augmentation_surjective χ hχ) + (augmentation_ker_nilpotent χ hnil) _ M + intro j + cases j with + | inl i => exact oldSimple_mem χ i P hI + | inr i => exact newSimple_mem χ i P hI + +end LittleFinitistic.CummingsConstruction + +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Triangular/InjectiveCorners.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Triangular/InjectiveCorners.lean new file mode 100644 index 0000000000000000000000000000000000000000..fcb42efa143a80d99bec06d5d754ab6fc75e22c1 --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Triangular/InjectiveCorners.lean @@ -0,0 +1,248 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Triangular.Socle + +namespace OAI + +noncomputable section + +open CategoryTheory +namespace LittleFinitistic.CummingsConstruction + +section +universe u +variable {k C ι : Type u} [Field k] [Ring C] [Algebra k C] +variable (χ : C →ₐ[k] (ι → k)) (i : ι) + +def cval (r : T χ) : k := χ r.fst.1 i +def ehead (r : T χ) : k := (r.fst.2 i).fst +def etail (r : T χ) : k := (r.fst.2 i).snd +def oval (r : T χ) : k := (SimpleSum.value (TriangularConstruction.offValue r.snd)) i + +@[simp] lemma cval_mul (r s : T χ) : cval χ i (r*s) = cval χ i r * cval χ i s := by + change χ (r.fst.1 * s.fst.1) i = _ + simp [cval] +@[simp] lemma ehead_mul (r s : T χ) : ehead χ i (r*s) = ehead χ i r * ehead χ i s := rfl +@[simp] lemma etail_mul (r s : T χ) : etail χ i (r*s) = ehead χ i r * etail χ i s + ehead χ i s * etail χ i r := by + change _ * _ + _ * _ = _ + change (r.fst.2 i).fst * (s.fst.2 i).snd + (r.fst.2 i).snd * (s.fst.2 i).fst = _ + dsimp only [ehead, etail] + ring +@[simp] lemma oval_mul (r s : T χ) : oval χ i (r*s) = ehead χ i r * oval χ i s + cval χ i s * oval χ i r := rfl + +def NewInjective (_χ : C →ₐ[k] (ι → k)) (_i : ι) := k × (k × k) +namespace NewInjective + +def value (x : NewInjective χ i) : k × (k × k) := x + +@[ext] lemma ext {x y : NewInjective χ i} + (h₁ : (value χ i x).1 = (value χ i y).1) + (h₂ : (value χ i x).2.1 = (value χ i y).2.1) + (h₃ : (value χ i x).2.2 = (value χ i y).2.2) : x = y := + Prod.ext h₁ (Prod.ext h₂ h₃) +instance : AddCommGroup (NewInjective χ i) := inferInstanceAs (AddCommGroup (k × (k × k))) + +def act (r : T χ) (x : NewInjective χ i) : NewInjective χ i := + (cval χ i r * (value χ i x).1, + ehead χ i r * (value χ i x).2.1, + oval χ i r * (value χ i x).1 + etail χ i r * (value χ i x).2.1 + ehead χ i r * (value χ i x).2.2) + +instance : SMul (T χ) (NewInjective χ i) := ⟨act χ i⟩ + +instance : Module (T χ) (NewInjective χ i) where + one_smul x := by + change (χ 1 i * _, (1 * _, 0 * _ + 0 * _ + 1 * _)) = value χ i x + simp + mul_smul r s x := by + change act χ i (r*s) x = act χ i r (act χ i s x) + simp only [act, value, cval_mul, ehead_mul, etail_mul, oval_mul] + apply ext <;> dsimp [value, NewInjective] <;> ring + smul_zero r := by + change act χ i r (0,0,0) = (0,0,0) + simp only [act, value, mul_zero, add_zero] + rfl + smul_add r x y := by + apply ext + · change cval χ i r * (x.1 + y.1) = cval χ i r*x.1 + cval χ i r*y.1 + ring + · change ehead χ i r * (x.2.1 + y.2.1) = ehead χ i r*x.2.1 + ehead χ i r*y.2.1 + ring + · change oval χ i r * (x.1+y.1) + etail χ i r * (x.2.1+y.2.1) + + ehead χ i r * (x.2.2+y.2.2) = + (oval χ i r*x.1 + etail χ i r*x.2.1 + ehead χ i r*x.2.2) + + (oval χ i r*y.1 + etail χ i r*y.2.1 + ehead χ i r*y.2.2) + ring + add_smul r s x := by + apply ext + · change χ (r.fst.1+s.fst.1) i * x.1 = χ r.fst.1 i*x.1 + χ s.fst.1 i*x.1 + simp [map_add, add_mul] + · change ((r.fst.2 i).fst + (s.fst.2 i).fst)*x.2.1 = + (r.fst.2 i).fst*x.2.1 + (s.fst.2 i).fst*x.2.1 + ring + · change (oval χ i r + oval χ i s)*x.1 + + (etail χ i r + etail χ i s)*x.2.1 + + (ehead χ i r + ehead χ i s)*x.2.2 = + (oval χ i r*x.1 + etail χ i r*x.2.1 + ehead χ i r*x.2.2) + + (oval χ i s*x.1 + etail χ i s*x.2.1 + ehead χ i s*x.2.2) + ring + zero_smul x := by + change (χ 0 i * _, (0 * _, 0 * _ + 0 * _ + 0 * _)) = (0,0,0) + simp + +end NewInjective +end + +section +open CategoryTheory +universe u +variable {k C ι : Type u} [Field k] [Ring C] [Algebra k C] +variable (χ : C →ₐ[k] (ι → k)) (i : ι) [DecidableEq ι] + +def newIdem : T χ := ((0, Pi.single i 1), 0) + +lemma newIdem_mul (r : T χ) : newIdem χ i * r = + oval χ i r • socle χ (.inl i) + etail χ i r • socle χ (.inr i) + + ehead χ i r • newIdem χ i := by + apply TrivSqZeroExt.ext + · apply Prod.ext + · change (0 : C) * r.fst.1 = _ + change 0 * r.fst.1 = (oval χ i r) • (0 : C) + (etail χ i r) • 0 + (ehead χ i r) • 0 + simp + · change (Pi.single i 1 : ι → DualNumber k) * r.fst.2 = + (oval χ i r) • (0 : ι → DualNumber k) + + (etail χ i r) • (Pi.single i (DualNumber.eps : DualNumber k) : ι → DualNumber k) + + (ehead χ i r) • (Pi.single i (1 : DualNumber k) : ι → DualNumber k) + ext j : 1 + by_cases hj : j = i + · subst j + apply TrivSqZeroExt.ext <;> + simp [etail, ehead] + · apply TrivSqZeroExt.ext <;> + simp [hj] + · change (newAugmentation (Pi.single i 1 : ι → DualNumber k) * + SimpleSum.value (TriangularConstruction.offValue r.snd) + + SimpleSum.rightCharacter χ (MulOpposite.op r.fst.1) * 0) = _ + change (newAugmentation (Pi.single i 1 : ι → DualNumber k) * + SimpleSum.value (TriangularConstruction.offValue r.snd) + + SimpleSum.rightCharacter χ (MulOpposite.op r.fst.1) * 0) = + (oval χ i r) • (Pi.single i (1 : k) : ι → k) + (etail χ i r) • 0 + (ehead χ i r) • 0 + ext j + by_cases hj : j = i + · subst j + simp [oval, newAugmentation] + · simp [oval, newAugmentation, hj] + +lemma field_module_injective (V : ModuleCat.{u} k) : Injective V where + factors {X Y} g f hf := by + obtain ⟨s, hs⟩ := f.hom.exists_leftInverse_of_injective + (LinearMap.ker_eq_bot.mpr ((ModuleCat.mono_iff_injective f).mp hf)) + refine ⟨ModuleCat.ofHom (g.hom.comp s), ?_⟩ + apply ModuleCat.hom_ext + change g.hom.comp (s.comp f.hom) = g.hom + rw [hs, LinearMap.comp_id] + +abbrev coindField := (ModuleCat.coextendScalars (algebraMap k (T χ))).obj (ModuleCat.of k k) + +instance coindField_injective : Injective (coindField χ) := + (ModuleCat.restrictCoextendScalarsAdj (algebraMap k (T χ))).map_injective _ + (field_module_injective (ModuleCat.of k k)) + +omit [DecidableEq ι] in +lemma coindField_smul_eval + (h : (ModuleCat.restrictScalars (algebraMap k (T χ))).obj + (ModuleCat.of (T χ) (T χ)) →ₗ[k] k) (a : k) (r : T χ) : + h (a • r) = a • h r := by + have scalar_eq := h.map_smul a r + change h (algebraMap k (T χ) a * r) = a • h r at scalar_eq + calc + h (a • r) = h (algebraMap k (T χ) a * r) := congrArg h (Algebra.smul_def a r) + _ = a • h r := scalar_eq + +omit [DecidableEq ι] in +lemma coindField_add_eval + (h : (ModuleCat.restrictScalars (algebraMap k (T χ))).obj + (ModuleCat.of (T χ) (T χ)) →ₗ[k] k) (r s : T χ) : + h (r+s) = h r + h s := h.map_add r s + +def newInjectiveRetraction : coindField χ ⟶ ModuleCat.of (T χ) (NewInjective χ i) := + ModuleCat.ofHom { + toFun := fun h => (h (socle χ (.inl i)), h (socle χ (.inr i)), h (newIdem χ i)) + map_add' := fun _ _ => rfl + map_smul' := fun r h => by + apply NewInjective.ext + · change h (socle χ (.inl i) * r) = cval χ i r * h (socle χ (.inl i)) + rw [socle_mul, coindField_smul_eval] + rfl + · change h (socle χ (.inr i) * r) = ehead χ i r * h (socle χ (.inr i)) + rw [socle_mul, coindField_smul_eval] + rfl + · change h (newIdem χ i * r) = oval χ i r * h (socle χ (.inl i)) + + etail χ i r * h (socle χ (.inr i)) + ehead χ i r * h (newIdem χ i) + rw [newIdem_mul, coindField_add_eval, coindField_add_eval, coindField_smul_eval, + coindField_smul_eval, coindField_smul_eval] + rfl } + +end + +open CategoryTheory +universe u +variable {k C ι : Type u} [Field k] [Ring C] [Algebra k C] +variable (χ : C →ₐ[k] (ι → k)) (i : ι) [DecidableEq ι] + +def lastCoordinate : (ModuleCat.restrictScalars (algebraMap k (T χ))).obj + (ModuleCat.of (T χ) (NewInjective χ i)) ⟶ ModuleCat.of k k := ModuleCat.ofHom + (X := (ModuleCat.restrictScalars (algebraMap k (T χ))).obj + (ModuleCat.of (T χ) (NewInjective χ i))) (Y := ModuleCat.of k k) + (show (ModuleCat.restrictScalars (algebraMap k (T χ))).obj + (ModuleCat.of (T χ) (NewInjective χ i)) →ₗ[k] k from { + toFun := fun x => (NewInjective.value χ i x).2.2 + map_add' := fun _ _ => rfl + map_smul' := fun a x => by + change (NewInjective.act χ i ((algebraMap k (T χ)) a) x).2.2 = a * x.2.2 + change (0 * x.1 + 0 * x.2.1 + a * x.2.2) = a * x.2.2 + simp }) + +def newInjectiveInclusion : ModuleCat.of (T χ) (NewInjective χ i) ⟶ coindField χ := + ModuleCat.RestrictionCoextensionAdj.HomEquiv.fromRestriction _ (lastCoordinate χ i) + +omit [DecidableEq ι] in +lemma newInjectiveInclusion_apply (x : NewInjective χ i) (r : T χ) : + (newInjectiveInclusion χ i x) r = (NewInjective.act χ i r x).2.2 := by + change (ModuleCat.RestrictionCoextensionAdj.HomEquiv.fromRestriction _ + (lastCoordinate χ i)).hom x r = _ + rw [ModuleCat.RestrictionCoextensionAdj.HomEquiv.fromRestriction_hom_apply_apply] + change (r • x : NewInjective χ i).2.2 = _ + rfl + +lemma newInjectiveInclusion_retraction : + newInjectiveInclusion χ i ≫ newInjectiveRetraction χ i = 𝟙 _ := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + change (newInjectiveRetraction χ i (newInjectiveInclusion χ i x)) = x + apply NewInjective.ext (χ := χ) (i := i) + · change (newInjectiveInclusion χ i x) (socle χ (.inl i)) = x.1 + rw [newInjectiveInclusion_apply] + change (NewInjective.act χ i (socle χ (.inl i)) x).2.2 = x.1 + change (Pi.single (M := fun _ : ι => k) i 1) i * x.1 + 0 * x.2.1 + 0 * x.2.2 = x.1 + simp + · change (newInjectiveInclusion χ i x) (socle χ (.inr i)) = x.2.1 + rw [newInjectiveInclusion_apply] + change (NewInjective.act χ i (socle χ (.inr i)) x).2.2 = x.2.1 + simp [NewInjective.act, NewInjective.value, oval, etail, ehead, socle, TriangularConstruction.offValue, SimpleSum.value] + try exact Or.inl rfl + · change (newInjectiveInclusion χ i x) (newIdem χ i) = x.2.2 + rw [newInjectiveInclusion_apply] + change (NewInjective.act χ i (newIdem χ i) x).2.2 = x.2.2 + simp [NewInjective.act, NewInjective.value, oval, etail, ehead, newIdem, TriangularConstruction.offValue, SimpleSum.value] + exact Or.inl rfl + +lemma newInjective_injective : Injective (ModuleCat.of (T χ) (NewInjective χ i)) := by + exact (show CategoryTheory.Retract (ModuleCat.of (T χ) (NewInjective χ i)) + (coindField χ) from ⟨newInjectiveInclusion χ i, newInjectiveRetraction χ i, + newInjectiveInclusion_retraction χ i⟩).injective + +end LittleFinitistic.CummingsConstruction + +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Triangular/InjectiveResolution.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Triangular/InjectiveResolution.lean new file mode 100644 index 0000000000000000000000000000000000000000..5b6c272538203c3f39ddc9efd3c4f2d91a0b8708 --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Triangular/InjectiveResolution.lean @@ -0,0 +1,238 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Triangular.InjectiveCorners + +namespace OAI + +noncomputable section + +open CategoryTheory +namespace LittleFinitistic.CummingsConstruction +open CategoryTheory CategoryTheory.Limits HomologicalComplex +universe u +variable {k C ι : Type u} [Field k] [Ring C] [Algebra k C] +variable (χ : C →ₐ[k] (ι → k)) (i : ι) + +def oldCharacter : T χ →+* k := + (Pi.evalRingHom (fun _ : Sum ι ι => k) (.inl i)).comp (augmentation χ).toRingHom + +def newCharacter : T χ →+* k := + (Pi.evalRingHom (fun _ : Sum ι ι => k) (.inr i)).comp (augmentation χ).toRingHom + +def newProjection : T χ →+* DualNumber k where + toFun r := r.fst.2 i + map_one' := rfl + map_zero' := rfl + map_add' _ _ := rfl + map_mul' _ _ := rfl + +abbrev oldSimple := (ModuleCat.restrictScalars (oldCharacter χ i)).obj (ModuleCat.of k k) +abbrev newSimple := (ModuleCat.restrictScalars (newCharacter χ i)).obj (ModuleCat.of k k) +abbrev newRegular := (ModuleCat.restrictScalars (newProjection χ i)).obj (ModuleCat.of (DualNumber k) (DualNumber k)) +abbrev newInjectiveObj := ModuleCat.of (T χ) (NewInjective χ i) + +def newRegularι : newRegular χ i ⟶ newInjectiveObj χ i := ModuleCat.ofHom + (X := newRegular χ i) (Y := newInjectiveObj χ i) (show + newRegular χ i →ₗ[T χ] newInjectiveObj χ i from { + toFun := fun x => (0,x.fst,x.snd) + map_add' := fun x y => by + apply NewInjective.ext (χ := χ) (i := i) + · exact (zero_add (0 : k)).symm + · rfl + · rfl + map_smul' := fun r x => by + apply NewInjective.ext (χ := χ) (i := i) + · change (0 : k) = cval χ i r * 0 + simp + · rfl + · change ehead χ i r*x.snd + etail χ i r*x.fst = + oval χ i r*0 + etail χ i r*x.fst + ehead χ i r*x.snd + ring }) + +def newInjectiveπ : newInjectiveObj χ i ⟶ oldSimple χ i := ModuleCat.ofHom + (X := newInjectiveObj χ i) (Y := oldSimple χ i) (show + newInjectiveObj χ i →ₗ[T χ] oldSimple χ i from { + toFun := fun x => x.1 + map_add' := fun _ _ => rfl + map_smul' := fun _ _ => rfl }) + +def newRegularπ : newRegular χ i ⟶ newSimple χ i := ModuleCat.ofHom + (X := newRegular χ i) (Y := newSimple χ i) (show + newRegular χ i →ₗ[T χ] newSimple χ i from { + toFun := fun x => x.fst + map_add' := fun _ _ => rfl + map_smul' := fun _ _ => rfl }) + +def newSimpleι : newSimple χ i ⟶ newRegular χ i := ModuleCat.ofHom + (X := newSimple χ i) (Y := newRegular χ i) (show + newSimple χ i →ₗ[T χ] newRegular χ i from { + toFun := fun a => (0,a) + map_add' := fun a b => by + apply TrivSqZeroExt.ext + · exact (zero_add (0 : k)).symm + · rfl + map_smul' := fun r a => by + apply TrivSqZeroExt.ext + · change (0 : k) = ehead χ i r * 0 + simp + · change ehead χ i r*(show k from a) = ehead χ i r*(show k from a) + etail χ i r*0 + simp }) + +def newDifferential : newInjectiveObj χ i ⟶ newInjectiveObj χ i := ModuleCat.ofHom + (X := newInjectiveObj χ i) (Y := newInjectiveObj χ i) (show + newInjectiveObj χ i →ₗ[T χ] newInjectiveObj χ i from { + toFun := fun x => (0,0,x.2.1) + map_add' := fun x y => by + apply NewInjective.ext (χ := χ) (i := i) + · exact (zero_add (0 : k)).symm + · exact (zero_add (0 : k)).symm + · rfl + map_smul' := fun r x => by + apply NewInjective.ext (χ := χ) (i := i) + · change (0 : k) = cval χ i r * 0 + simp + · change (0 : k) = ehead χ i r * 0 + simp + · change ehead χ i r*x.2.1 = oval χ i r*0 + etail χ i r*0 + ehead χ i r*x.2.1 + simp }) + +def epsDifferential : newRegular χ i ⟶ newRegular χ i := newRegularπ χ i ≫ newSimpleι χ i + +@[simp] lemma newDifferential_sq : newDifferential χ i ≫ newDifferential χ i = 0 := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + rfl + +@[simp] lemma epsDifferential_sq : epsDifferential χ i ≫ epsDifferential χ i = 0 := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + rfl + +lemma newRegularι_comm : newRegularι χ i ≫ newDifferential χ i = + epsDifferential χ i ≫ newRegularι χ i := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + rfl + +lemma newInjectiveπ_comm : newDifferential χ i ≫ newInjectiveπ χ i = 0 := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + rfl + +lemma newRegularι_π : newRegularι χ i ≫ newInjectiveπ χ i = 0 := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + rfl + +lemma newRegular_exact : + (ShortComplex.mk (newRegularι χ i) (newInjectiveπ χ i) (newRegularι_π χ i)).ShortExact where + mono_f := by + rw [ModuleCat.mono_iff_injective] + intro x y h + apply TrivSqZeroExt.ext + · exact congrArg (fun z : NewInjective χ i => z.2.1) h + · exact congrArg (fun z : NewInjective χ i => z.2.2) h + epi_g := by + rw [ModuleCat.epi_iff_surjective] + intro a + exact ⟨(a,0,0), rfl⟩ + exact := by + rw [ShortComplex.moduleCat_exact_iff] + intro x hx + refine ⟨(x.2.1,x.2.2), ?_⟩ + apply NewInjective.ext (χ := χ) (i := i) + · exact hx.symm + · rfl + · rfl + +def periodicInjective : ChainComplex (ModuleCat (T χ)) ℕ := + ChainComplex.of (fun _ => newInjectiveObj χ i) (fun _ => newDifferential χ i) + (fun _ => newDifferential_sq χ i) + +def periodicRegular : ChainComplex (ModuleCat (T χ)) ℕ := + ChainComplex.of (fun _ => newRegular χ i) (fun _ => epsDifferential χ i) + (fun _ => epsDifferential_sq χ i) + +def periodicOld : ChainComplex (ModuleCat (T χ)) ℕ := + ChainComplex.of (fun _ => oldSimple χ i) (fun _ => 0) (fun _ => by simp) + +def periodicι : periodicRegular χ i ⟶ periodicInjective χ i := + ChainComplex.ofHom (fun _ => newRegularι χ i) (fun n => by + simpa [periodicInjective, periodicRegular] using newRegularι_comm χ i) + +def periodicπ : periodicInjective χ i ⟶ periodicOld χ i := + ChainComplex.ofHom (fun _ => newInjectiveπ χ i) (fun n => by + simpa [periodicInjective, periodicOld] using (newInjectiveπ_comm χ i).symm) + +lemma periodicι_π : periodicι χ i ≫ periodicπ χ i = 0 := by + apply HomologicalComplex.hom_ext + intro n + exact newRegularι_π χ i + +lemma periodic_shortExact : + (ShortComplex.mk (periodicι χ i) (periodicπ χ i) (periodicι_π χ i)).ShortExact where + mono_f := HomologicalComplex.mono_of_mono_f _ (fun _ => (newRegular_exact χ i).mono_f) + epi_g := HomologicalComplex.epi_of_epi_f _ (fun _ => (newRegular_exact χ i).epi_g) + exact := HomologicalComplex.exact_of_degreewise_exact _ (fun _ => (newRegular_exact χ i).exact) + +lemma epsDifferential_π : epsDifferential χ i ≫ newRegularπ χ i = 0 := by + apply ModuleCat.hom_ext + apply LinearMap.ext + intro x + rfl + +lemma epsDifferential_exact : + (ShortComplex.mk (epsDifferential χ i) (epsDifferential χ i) + (epsDifferential_sq χ i)).Exact := by + rw [ShortComplex.moduleCat_exact_iff] + intro x hx + have hx' : x.fst = 0 := congrArg TrivSqZeroExt.snd hx + refine ⟨(x.snd,0), ?_⟩ + apply TrivSqZeroExt.ext + · exact hx'.symm + · rfl + +lemma epsDifferential_π_exact : + (ShortComplex.mk (epsDifferential χ i) (newRegularπ χ i) + (epsDifferential_π χ i)).Exact := by + rw [ShortComplex.moduleCat_exact_iff] + intro x hx + refine ⟨(x.snd,0), ?_⟩ + apply TrivSqZeroExt.ext + · exact hx.symm + · rfl + +instance newRegularπ_epi : Epi (newRegularπ χ i) := by + rw [ModuleCat.epi_iff_surjective] + intro a + exact ⟨(a,0), rfl⟩ + +def periodicAug : periodicRegular χ i ⟶ (ChainComplex.single₀ (ModuleCat (T χ))).obj + (newSimple χ i) := + (ChainComplex.toSingle₀Equiv _ _).symm ⟨newRegularπ χ i, epsDifferential_π χ i⟩ + +instance periodicAug_quasiIso : QuasiIso (periodicAug χ i) := ⟨fun n => by + cases n with + | zero => + rw [ChainComplex.quasiIsoAt₀_iff, ShortComplex.quasiIso_iff_of_zeros'] + · exact ⟨epsDifferential_π_exact χ i, newRegularπ_epi χ i⟩ + all_goals rfl + | succ n => + rw [quasiIsoAt_iff_exactAt'] + · rw [HomologicalComplex.exactAt_iff' _ (n+2) (n+1) n (by simp) (by simp)] + have hd : ChainComplex.of.d (fun _ : ℕ => newRegular χ i) + (fun _ : ℕ => epsDifferential χ i) (n+2) (n+1) = epsDifferential χ i := + ChainComplex.of_d _ _ (n+1) + simpa only [HomologicalComplex.sc', HomologicalComplex.shortComplexFunctor', + periodicRegular, hd, ChainComplex.of_d] using epsDifferential_exact χ i + · apply ChainComplex.exactAt_succ_single_obj⟩ + +end LittleFinitistic.CummingsConstruction + +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/Triangular/Socle.lean b/lean/OAI/Algebra/FinitisticAsymmetry/Triangular/Socle.lean new file mode 100644 index 0000000000000000000000000000000000000000..5c0f162a7c6f0849072c37a9daf021eb89bbe96d --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/Triangular/Socle.lean @@ -0,0 +1,148 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Triangular.Algebra + +namespace OAI + +section +section +noncomputable section +open CategoryTheory +namespace LittleFinitistic +universe u +variable (A : Type u) [Ring A] +namespace CummingsConstruction +variable {k C ι : Type u} [Field k] [Ring C] [Algebra k C] + +abbrev NewCorner (k ι : Type u) := ι → DualNumber k + +instance [Finite ι] : FiniteDimensional k (NewCorner k ι) := by + let : FiniteDimensional k (DualNumber k) := inferInstanceAs (FiniteDimensional k (k × k)) + exact inferInstanceAs (FiniteDimensional k (ι → DualNumber k)) + +def newAugmentation : NewCorner k ι →ₐ[k] (ι → k) := + AlgHom.pi fun i => (TrivSqZeroExt.fstHom k k k).comp (Pi.evalAlgHom k (fun _ : ι => DualNumber k) i) + +def SimpleSum (_χ : C →ₐ[k] (ι → k)) := ι → k + +namespace SimpleSum +def value {χ : C →ₐ[k] (ι → k)} (x : SimpleSum χ) : ι → k := x +variable (χ : C →ₐ[k] (ι → k)) +instance : AddCommGroup (SimpleSum χ) := inferInstanceAs (AddCommGroup (ι → k)) +instance : Module k (SimpleSum χ) := inferInstanceAs (Module k (ι → k)) +instance [Finite ι] : FiniteDimensional k (SimpleSum χ) := inferInstanceAs (FiniteDimensional k (ι → k)) +instance : Module (NewCorner k ι) (SimpleSum χ) := + Module.compHom (ι → k) (newAugmentation (k := k) (ι := ι)).toRingHom + +def rightCharacter : Cᵐᵒᵖ →+* (ι → k) where + toFun c := χ c.unop + map_one' := map_one χ + map_zero' := map_zero χ + map_add' x y := map_add χ x.unop y.unop + map_mul' x y := by simp [map_mul, mul_comm] + +instance : Module Cᵐᵒᵖ (SimpleSum χ) := Module.compHom (ι → k) (rightCharacter χ) + +instance : SMulCommClass (NewCorner k ι) Cᵐᵒᵖ (SimpleSum χ) where + smul_comm e c x := by + change newAugmentation e * (rightCharacter χ c * value x) = + rightCharacter χ c * (newAugmentation e * value x) + exact mul_left_comm _ _ _ + +instance : IsScalarTower k (NewCorner k ι) (SimpleSum χ) where + smul_assoc r e x := by + change newAugmentation (r • e) * value x = r • (newAugmentation e * value x) + rw [map_smul, smul_mul_assoc] + +instance : IsScalarTower k Cᵐᵒᵖ (SimpleSum χ) where + smul_assoc r c x := by + change χ (r • c.unop) * value x = r • (χ c.unop * value x) + rw [map_smul, smul_mul_assoc] +end SimpleSum + +variable (χ : C →ₐ[k] (ι → k)) +abbrev T := TriangularConstruction.Algebra C (NewCorner k ι) (SimpleSum χ) + +instance : Algebra k (T χ) := inferInstance +instance [Finite ι] [FiniteDimensional k C] : FiniteDimensional k (T χ) := + TriangularConstruction.finiteDimensional C (NewCorner k ι) (SimpleSum χ) k + +def augmentation : T χ →ₐ[k] (Sum ι ι → k) where + toFun x := Sum.elim (χ x.fst.1) (newAugmentation x.fst.2) + map_one' := by ext i; cases i <;> simp [newAugmentation] + map_zero' := by ext i; cases i <;> simp [newAugmentation] + map_add' x y := by ext i; cases i <;> simp [newAugmentation, map_add] + map_mul' x y := by ext i; cases i <;> simp [newAugmentation, map_mul] + commutes' r := by ext i; cases i <;> simp [newAugmentation, Algebra.algebraMap_eq_smul_one] + +lemma augmentation_surjective (hχ : Function.Surjective χ) : Function.Surjective (augmentation χ) := by + intro v + obtain ⟨c, hc⟩ := hχ (v ∘ Sum.inl) + refine ⟨((c, fun i => TrivSqZeroExt.inl (v (.inr i))), 0), ?_⟩ + ext i + cases i with + | inl i => exact congrFun hc i + | inr i => rfl + +variable [DecidableEq ι] + +def socle : Sum ι ι → T χ + | .inl i => (0, Pi.single i 1) + | .inr i => ((0, Pi.single i DualNumber.eps), 0) + +lemma socle_ne_zero (i : Sum ι ι) : socle χ i ≠ 0 := by + intro h + cases i with + | inl i => + have := congrArg (fun x : T χ => (TriangularConstruction.offValue x.snd : ι → k) i) h + change (Pi.single i (1 : k) : ι → k) i = 0 at this + simp at this + | inr i => + have := congrArg (fun x : T χ => (x.fst.2 i).snd) h + simp [socle] at this + +lemma socle_mul (i : Sum ι ι) (x : T χ) : + socle χ i * x = augmentation χ x i • socle χ i := by + cases i with + | inl i => + apply TrivSqZeroExt.ext + · change (0 : C × NewCorner k ι) * x.fst = _ • 0 + simp + · change newAugmentation (0 : NewCorner k ι) * (SimpleSum.value (TriangularConstruction.offValue x.snd)) + + SimpleSum.rightCharacter χ (MulOpposite.op x.fst.1) * (Pi.single i 1 : ι → k) = + χ x.fst.1 i • (Pi.single i 1 : ι → k) + ext j + by_cases h : j = i + · subst j; simp [SimpleSum.rightCharacter] + · simp [h] + | inr i => + apply TrivSqZeroExt.ext + · apply Prod.ext + · change (0 : C) * x.fst.1 = _ • 0 + simp + · change (Pi.single i DualNumber.eps : ι → DualNumber k) * x.fst.2 = + (x.fst.2 i).fst • (Pi.single i DualNumber.eps : ι → DualNumber k) + ext j : 1 + by_cases h : j = i + · subst j + simp only [Pi.mul_apply, Pi.smul_apply, Pi.single_eq_same] + apply TrivSqZeroExt.ext <;> simp + · simp [h] + · apply funext + intro j + change (newAugmentation (Pi.single i (DualNumber.eps : DualNumber k))) j * + (SimpleSum.value (TriangularConstruction.offValue x.snd)) j + χ x.fst.1 j * 0 = + (x.fst.2 i).fst * 0 + have he : newAugmentation (Pi.single i (DualNumber.eps : DualNumber k)) = (0 : ι → k) := by + ext j + by_cases h : j = i + · subst j; simp [newAugmentation] + · simp [newAugmentation, h] + simp [he] + +end CummingsConstruction +end LittleFinitistic +end +end +end + +end OAI diff --git a/lean/OAI/Algebra/FinitisticAsymmetry/ZeroDimensions.lean b/lean/OAI/Algebra/FinitisticAsymmetry/ZeroDimensions.lean new file mode 100644 index 0000000000000000000000000000000000000000..507072abe8fe5fe9838024b037f69b7b078207fc --- /dev/null +++ b/lean/OAI/Algebra/FinitisticAsymmetry/ZeroDimensions.lean @@ -0,0 +1,46 @@ +import Mathlib +import OAI.Algebra.FinitisticAsymmetry.Transport.FiniteModules +import OAI.Algebra.FinitisticAsymmetry.Kasch.FiniteDimension + +namespace OAI + +section +section +noncomputable section +open CategoryTheory +namespace LittleFinitistic +universe u +variable (A : Type u) [Ring A] +section ZeroDimensions +variable {R k : Type u} [Ring R] [Nontrivial R] [Field k] [Algebra k R] + +lemma littleFinitisticDimension_nonneg : 0 ≤ littleFinitisticDimension R := by + have hpd : projectiveDimension (ModuleCat.of R R) = 0 := + (projectiveDimension_eq_zero_iff _).mpr ⟨inferInstance, fun h => by + let := ModuleCat.isZero_iff_subsingleton.mp h + exact (one_ne_zero : (1 : R) ≠ 0) (Subsingleton.elim _ _)⟩ + exact le_iSup_of_le (ModuleCat.of R R) (le_iSup_of_le (inferInstance : Module.Finite R R) + (le_iSup_of_le (by rw [hpd]; norm_cast) hpd.ge)) + +lemma dimensions_zero_of_splitBasic_rightSocle {ι : Type u} [Finite ι] + (χ : R →ₐ[k] (ι → k)) (hχ : Function.Surjective χ) + (hJ : ∃ n : ℕ, (RingHom.ker χ.toRingHom) ^ n = ⊥) + (a : ι → R) (ha : ∀ i, a i ≠ 0) + (hmul : ∀ i r, a i * r = χ r i • a i) : + littleFinitisticDimension R = 0 ∧ bigFinitisticDimension R = 0 := by + have hb : bigFinitisticDimension R ≤ 0 := by + refine iSup_le fun M => iSup_le fun hpd => ?_ + let : Projective M := Kasch.projective_of_finiteDimension χ a ha hmul hχ hJ M hpd + exact (projectiveDimension_le_iff M 0).mpr inferInstance + have hl : 0 ≤ littleFinitisticDimension R := littleFinitisticDimension_nonneg + have hlb := littleFinitisticDimension_le_big R + exact ⟨le_antisymm (hlb.trans hb) hl, le_antisymm hb (hl.trans hlb)⟩ + +end ZeroDimensions + +end LittleFinitistic +end +end +end + +end OAI diff --git a/lean/OAI/Algebra/FormalGroup/Honda/ArtinianRigidity.lean b/lean/OAI/Algebra/FormalGroup/Honda/ArtinianRigidity.lean new file mode 100644 index 0000000000000000000000000000000000000000..45deb6edb73cf11ee7b8af26923e90bf0f02d77a --- /dev/null +++ b/lean/OAI/Algebra/FormalGroup/Honda/ArtinianRigidity.lean @@ -0,0 +1,46 @@ +import OAI.Algebra.FormalGroup.Honda.NilpotentTower +import OAI.Algebra.FormalGroup.Honda.Transport + +namespace OAI + +noncomputable section + +universe uK uR + +namespace HeightThree.ArtinianRigidity +open HondaTarget DeformationRigidity CoordinateTransport NilpotentTower + +lemma automorphism_rigid {K : Type uK} [Field K] (p : ℕ) [Fact p.Prime] [CharP K p] + (n : ℕ) (R : Type uR) [CommRing R] [Algebra K R] (ρ : R →ₐ[K] K) + (hn : (RingHom.ker ρ)^(n+1)=⊥) (F : FormalGroup R) (e : CoordinateIso F F) + (he : e.series.map ρ.toRingHom=PowerSeries.X) + (hF : (multiplicationSeries F p).map ρ.toRingHom=PowerSeries.X^(p^3)) : + e.series=PowerSeries.X := by + induction n generalizing R with + | zero => + have hi : Function.Injective ρ.toRingHom := (RingHom.injective_iff_ker_eq_bot ρ).mpr (by simpa using hn) + apply PowerSeries.map_injective ρ.toRingHom hi + rw [he,PowerSeries.map_X] + | succ n ih => + let S := quotient ρ n + let π : R →ₐ[K] S := projection ρ n + let σ : S →ₐ[K] K := augmentation ρ n + have fac : σ.toRingHom.comp π.toRingHom=ρ.toRingHom := rfl + have : Nontrivial R := ρ.toRingHom.domain_nontrivial + have : CharP R p := (Algebra.charP_iff K R p).mp inferInstance + have hsmall : SmallExtension.IsSmall π.toRingHom ρ.toRingHom := + ⟨projection_ker_le ρ n,projection_annihilate ρ n hn⟩ + let d := CoordinateTransport.CoordinateIso.map e π.toRingHom + have hd : d.series.map σ.toRingHom=PowerSeries.X := by + change (e.series.map π.toRingHom).map σ.toRingHom=PowerSeries.X + rw [unimap_comp,fac,he] + have hF' : (multiplicationSeries (F.map π.toRingHom) p).map σ.toRingHom=PowerSeries.X^(p^3) := by + rw [multiplication_map,unimap_comp,fac,hF] + have hd' := ih S σ (augmentation_nilpotent ρ n) (F.map π.toRingHom) d hd hF' + exact SmallExtension.small_automorphism_rigid p π.toRingHom ρ.toRingHom hsmall F e hd' hF + +end HeightThree.ArtinianRigidity + +end + +end OAI diff --git a/lean/OAI/Algebra/FormalGroup/Honda/Canonical.lean b/lean/OAI/Algebra/FormalGroup/Honda/Canonical.lean new file mode 100644 index 0000000000000000000000000000000000000000..515bc4a2564928d2c319f72ac3433f240f9d9c75 --- /dev/null +++ b/lean/OAI/Algebra/FormalGroup/Honda/Canonical.lean @@ -0,0 +1,58 @@ +import OAI.Algebra.FormalGroup.Honda.Universality + +namespace OAI + +noncomputable section + +namespace HeightThree.CanonicalUniversality +open MvPowerSeries HondaTarget HondaConstruction HondaCoordinates HondaSpecialFiber HondaDifferentials + +lemma honda_frobenius (p : ℕ) [hp : Fact p.Prime] + (K : Type*) [Field K] [CharP K p] : + (hondaLaw p K).toPowerSeries^p = + expand p hp.out.ne_zero (hondaLaw p K).toPowerSeries := by + have hm : (hondaLaw p K).toPowerSeries.map (frobenius K p) = + (hondaLaw p K).toPowerSeries := by + change ((integralSpecial p).toPowerSeries.map (Int.castRingHom K)).map _ = _ + rw [MvPowerSeries.map_map] + have hh : (frobenius K p).comp (Int.castRingHom K) = Int.castRingHom K := by ext z; simp + rw [hh] + rfl + rw [← map_frobenius_expand p hp.out.ne_zero, map_expand, hm] + +noncomputable def data (p : ℕ) [hp : Fact p.Prime] + (K : Type*) [Field K] [CharP K p] : ArtinianUniversality.Data p K := by + let H := (honda_nonlinear_expand p K).choose + have hH := (honda_nonlinear_expand p K).choose_spec + have hc := reducedHonda_heightCoordinates p K + let g := (Ideal.mem_span_singleton.mp hc.2.2.2).choose + have hg := (Ideal.mem_span_singleton.mp hc.2.2.2).choose_spec + exact { + gamma := hondaLaw p K + family := reducedHonda p K + family_comm := inferInstance + special := reducedHonda_specialFiber p K + honda := integralSpecial_honda p K + nonlinear := H + nonlinear_eq := hH + frobenius := honda_frobenius p K + first := hc.2.1 + remainder := g + second := by linear_combination hg } + +theorem reducedHonda_isUniversal (p : ℕ) [hp : Fact p.Prime] + (K : Type*) [Field K] [CharP K p] : + IsUniversal (hondaLaw p K) (reducedHonda p K) := by + exact (data p K).isUniversal p + +theorem canonical_hasUniversalHeightCoordinates (p : ℕ) [hp : Fact p.Prime] + (K : Type*) [Field K] [CharP K p] : + HasUniversalHeightCoordinates p (hondaLaw p K) := by + exact ⟨reducedHonda p K, inferInstance, reducedHonda_specialFiber p K, + reducedHonda_isUniversal p K, reducedHonda_heightCoordinates p K⟩ + +end HeightThree.CanonicalUniversality + +end + +end OAI diff --git a/lean/OAI/Algebra/FormalGroup/Honda/ChainRule.lean b/lean/OAI/Algebra/FormalGroup/Honda/ChainRule.lean new file mode 100644 index 0000000000000000000000000000000000000000..2605983f90cf674518498ef52056772c7082f2b7 --- /dev/null +++ b/lean/OAI/Algebra/FormalGroup/Honda/ChainRule.lean @@ -0,0 +1,126 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace HeightThree.OriginalDifferentialSupport +open MvPowerSeries.WithPiTopology +section ChainRule +variable {R σ τ : Type*} [CommRing R] [Fintype σ] + +omit [Fintype σ] in + +theorem continuous_pderiv [TopologicalSpace R] [IsTopologicalRing R] + (i : σ) : Continuous (MvPowerSeries.pderiv (R := R) i) := by + apply continuous_pi + intro n + exact (MvPowerSeries.WithPiTopology.continuous_coeff R (n + Finsupp.single i 1)).mul_const _ + +theorem pderiv_subst_polynomial (g : σ → MvPowerSeries τ R) + (hg : MvPowerSeries.HasSubst g) (i : τ) (f : MvPolynomial σ R) : + MvPowerSeries.pderiv i (MvPowerSeries.subst g (f : MvPowerSeries σ R)) = + ∑ j, MvPowerSeries.subst g (MvPowerSeries.pderiv j (f : MvPowerSeries σ R)) * + MvPowerSeries.pderiv i (g j) := by + classical + have hz : MvPowerSeries.subst g (0 : MvPowerSeries σ R) = 0 := by + rw [← MvPowerSeries.coe_substAlgHom hg] + exact map_zero _ + have ho : MvPowerSeries.subst g (1 : MvPowerSeries σ R) = 1 := by + rw [← MvPowerSeries.coe_substAlgHom hg] + exact map_one _ + induction f using MvPolynomial.induction_on with + | C r => simp [hz] + | add f h hf hh => + simp only [MvPolynomial.coe_add, MvPowerSeries.subst_add hg, map_add, + hf, hh, add_mul, Finset.sum_add_distrib] + | mul_X f j hf => + simp only [MvPolynomial.coe_mul, MvPolynomial.coe_X, + MvPowerSeries.subst_X hg, + Derivation.leibniz, smul_eq_mul, hf, + MvPowerSeries.subst_add hg, MvPowerSeries.subst_mul hg, add_mul] + rw [Finset.sum_add_distrib] + have h1 : (∑ j_1, (MvPowerSeries.subst g (f : MvPowerSeries σ R) * + MvPowerSeries.subst g (MvPowerSeries.pderiv (R := R) j_1 (MvPowerSeries.X j))) * + MvPowerSeries.pderiv i (g j_1)) = + MvPowerSeries.subst g (f : MvPowerSeries σ R) * MvPowerSeries.pderiv i (g j) := by + simp [MvPowerSeries.pderiv_X, Pi.single_apply, apply_ite, + hz, ho] + rw [h1] + congr 1 + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro k hk + ring + +theorem pderiv_subst (g : σ → MvPowerSeries τ R) + (hg : MvPowerSeries.HasSubst g) (i : τ) (f : MvPowerSeries σ R) : + MvPowerSeries.pderiv i (MvPowerSeries.subst g f) = + ∑ j, MvPowerSeries.subst g (MvPowerSeries.pderiv j f) * + MvPowerSeries.pderiv i (g j) := by + let : UniformSpace R := ⊥ + let : DiscreteUniformity R := ⟨rfl⟩ + have hc₁ : Continuous (fun f : MvPowerSeries σ R => + MvPowerSeries.pderiv i (MvPowerSeries.subst g f)) := + (continuous_pderiv i).comp (MvPowerSeries.continuous_subst hg) + have hc₂ : Continuous (fun f : MvPowerSeries σ R => + ∑ j, MvPowerSeries.subst g (MvPowerSeries.pderiv j f) * + MvPowerSeries.pderiv i (g j)) := by + exact continuous_finsetSum _ fun j _ => + ((MvPowerSeries.continuous_subst hg).comp (continuous_pderiv j)).mul_const _ + exact congrFun (MvPowerSeries.WithPiTopology.denseRange_toMvPowerSeries.equalizer + hc₁ hc₂ (by funext f; exact pderiv_subst_polynomial g hg i f)) f + +end ChainRule + +variable {R : Type*} [CommRing R] +theorem constantCoeff_subst_zero_axis {σ τ : Type*} (a : σ → MvPowerSeries τ R) + (ha : MvPowerSeries.HasSubst a) (h0 : ∀ i, MvPowerSeries.constantCoeff (a i) = 0) + (f : MvPowerSeries σ R) : + MvPowerSeries.constantCoeff (MvPowerSeries.subst a f) = MvPowerSeries.constantCoeff f := by + have hz := MvPowerSeries.constantCoeff_subst_eq_zero ha h0 + (f := f - MvPowerSeries.C (MvPowerSeries.constantCoeff f)) (by simp) + have hs : MvPowerSeries.subst a (f - MvPowerSeries.C (MvPowerSeries.constantCoeff f)) = + MvPowerSeries.subst a f - MvPowerSeries.C (MvPowerSeries.constantCoeff f) := by + rw [← MvPowerSeries.coe_substAlgHom ha, map_sub] + rw [MvPowerSeries.substAlgHom_apply, MvPowerSeries.substAlgHom_apply, + MvPowerSeries.subst_C] + rw [hs, map_sub, MvPowerSeries.constantCoeff_C, sub_eq_zero] at hz + exact hz + +theorem constantCoeff_derivative_eq (f : PowerSeries R) : + PowerSeries.constantCoeff (PowerSeries.derivative f) = PowerSeries.coeff 1 f := by + rw [← PowerSeries.coeff_zero_eq_constantCoeff, PowerSeries.coeff_derivative] + simp + +theorem coeff_one_formal_add (F : FormalGroup R) (a b : PowerSeries R) + (ha : PowerSeries.constantCoeff a = 0) (hb : PowerSeries.constantCoeff b = 0) : + PowerSeries.coeff 1 (MvPowerSeries.subst ![a,b] F.toPowerSeries) = + PowerSeries.coeff 1 a + PowerSeries.coeff 1 b := by + have hs : MvPowerSeries.HasSubst (![a,b] : Fin 2 → PowerSeries R) := by + apply MvPowerSeries.hasSubst_of_constantCoeff_nilpotent + intro i + fin_cases i + · exact PowerSeries.HasSubst.of_constantCoeff_zero' ha + · exact PowerSeries.HasSubst.of_constantCoeff_zero' hb + have h := congrArg (PowerSeries.constantCoeff (R := R)) (pderiv_subst _ hs () F.toPowerSeries) + change PowerSeries.constantCoeff (PowerSeries.derivative _) = _ at h + rw [constantCoeff_derivative_eq] at h + simp only [Fin.sum_univ_two, map_add, map_mul] at h + have hc (i : Fin 2) : + PowerSeries.constantCoeff (MvPowerSeries.subst ![a,b] (MvPowerSeries.pderiv i F.toPowerSeries)) = 1 := by + change MvPowerSeries.constantCoeff (MvPowerSeries.subst ![a,b] (MvPowerSeries.pderiv i F.toPowerSeries)) = 1 + rw [constantCoeff_subst_zero_axis _ hs (by intro j; fin_cases j; exact ha; exact hb), + ← MvPowerSeries.coeff_zero_eq_constantCoeff, MvPowerSeries.coeff_pderiv] + fin_cases i <;> simp [F.lin_coeff_X, F.lin_coeff_Y] + rw [hc, hc] at h + simp only [one_mul, Matrix.cons_val_zero, Matrix.cons_val_one] at h + change _ = PowerSeries.constantCoeff (PowerSeries.derivative a) + + PowerSeries.constantCoeff (PowerSeries.derivative b) at h + simpa only [constantCoeff_derivative_eq] using h + +end HeightThree.OriginalDifferentialSupport + +end + +end OAI diff --git a/lean/OAI/Algebra/FormalGroup/Honda/Classification.lean b/lean/OAI/Algebra/FormalGroup/Honda/Classification.lean new file mode 100644 index 0000000000000000000000000000000000000000..378a620b7bf5cae19fe450d692429137b2721687 --- /dev/null +++ b/lean/OAI/Algebra/FormalGroup/Honda/Classification.lean @@ -0,0 +1,178 @@ +import OAI.Algebra.FormalGroup.Honda.Correction + +namespace OAI + +noncomputable section + +namespace HeightThree.HondaClassification +open MvPowerSeries HeightThree.HondaJets HeightThree.HondaLeading +open HeightThree.HondaTarget HeightThree.HondaFrobenius HeightThree.HomogeneousCocycle +open HeightThree.CoordinateTransport HeightThree.HondaCorrection +variable {K : Type*} [Field K] + +lemma all_laws_jet2 (F G : FormalGroup K) : EqJet 2 F.toPowerSeries G.toPowerSeries := by + have hf := pair_linear F (X 0 : MvPowerSeries (Fin 2) K) (X 1) (by simp) (by simp) + have hg := pair_linear G (X 0 : MvPowerSeries (Fin 2) K) (X 1) (by simp) (by simp) + simp only [pair,pair_subst_self] at hf hg + exact hf.trans hg.symm + +structure Approximation (p h : ℕ) (F G : FormalGroup K) (n : ℕ) where + law : FormalGroup K + comm : law.IsComm + coordinate : CoordinateIso G law + match_law : EqJet (n+2) F.toPowerSeries law.toPowerSeries + honda : multiplicationSeries law p=PowerSeries.X^(p^h) + strict : EqJet 2 coordinate.series PowerSeries.X + +variable (p : ℕ) [hp : Fact p.Prime] [CharP K p] (h : ℕ) + (F G : FormalGroup K) [F.IsComm] [G.IsComm] + (hF : multiplicationSeries F p=PowerSeries.X^(p^h)) + (hG : multiplicationSeries G p=PowerSeries.X^(p^h)) + +noncomputable def start : Approximation p h F G 0 where + law := G + comm := inferInstance + coordinate := { + series := PowerSeries.X + inverse := PowerSeries.X + zero_series := PowerSeries.constantCoeff_X + zero_inverse := PowerSeries.constantCoeff_X + left_inv := PowerSeries.X_subst _ + right_inv := PowerSeries.X_subst _ + preserves_addition := by + simp only [PowerSeries.subst_X (.of_constantCoeff_zero G.zero_constantCoeff), + PowerSeries.subst_X (PowerSeries.HasSubst.X _),pair_subst_self] } + match_law := all_laws_jet2 F G + honda := hG + strict := by exact EqJet.refl 2 (PowerSeries.X : PowerSeries K) + +omit [G.IsComm] in +include hF in +lemma advance_exists (n : ℕ) (s : Approximation p h F G n) : + ∃t : Approximation p h F G (n+1), EqJet (n+2) t.coordinate.series s.coordinate.series := by + let : s.law.IsComm := s.comm + have hc := leading_isCocycle F s.law (n+2) p s.match_law (hF.trans s.honda.symm) + have hfixed := map_leading F s.law (n+2) (iterateFrobenius K p h) + (honda_coefficients_fixed p h F hF) (honda_coefficients_fixed p h s.law s.honda) + obtain ⟨a,ha,hD⟩ := fixed_coboundary_scalar p _ (n+2) (by omega) hc + (leading_homogeneous F s.law (n+2)) (iterateFrobenius K p h) hfixed + let c := step (n+2) (by omega) a + have he : EqJet (n+2) ((CoordinateIso.trans s.coordinate (c.iso s.law)).series) s.coordinate.series := by + exact step_jet (n+2) a _ s.coordinate.zero_series + let t : Approximation p h F G (n+1) := { + law := c.transport s.law + comm := inferInstance + coordinate := CoordinateIso.trans s.coordinate (c.iso s.law) + match_law := by simpa only [Nat.add_right_comm] using + (step_improves F s.law (n+2) (by omega) s.match_law a hD).symm + honda := honda_transport p h (n+2) (by omega) a ha s.law s.honda + strict := (he.mono (by omega)).trans s.strict } + exact ⟨t,he⟩ + +noncomputable def advance (n : ℕ) (s : Approximation p h F G n) : + {t : Approximation p h F G (n+1) // EqJet (n+2) t.coordinate.series s.coordinate.series} := + ⟨(advance_exists p h F G hF n s).choose,(advance_exists p h F G hF n s).choose_spec⟩ + +noncomputable def tower : (n : ℕ) → Approximation p h F G n + | 0 => start p h F G hG + | n+1 => (advance p h F G hF n (tower n)).val + +lemma tower_step (n : ℕ) : + EqJet (n+2) (tower p h F G hF hG (n+1)).coordinate.series + (tower p h F G hF hG n).coordinate.series := + (advance p h F G hF n (tower p h F G hF hG n)).prop + +end HeightThree.HondaClassification + +namespace HeightThree.HondaJetLimit +open MvPowerSeries HeightThree.HondaJets +variable {K : Type*} [Field K] + +def limit (s : ℕ → PowerSeries K) : PowerSeries K := PowerSeries.mk (fun m=>(s m).coeff m) + +lemma later_jet (s : ℕ → PowerSeries K) (hs : ∀n,EqJet (n+2) (s (n+1)) (s n)) + (n m : ℕ) (hm : n ≤ m) : EqJet (n+2) (s m) (s n) := by + induction m,hm using Nat.le_induction with + | base => exact EqJet.refl _ _ + | succ m hm ih => exact ((hs m).mono (by omega)).trans ih + +lemma stable_coeff (s : ℕ → PowerSeries K) (hs : ∀n,EqJet (n+2) (s (n+1)) (s n)) + (m i j : ℕ) (hi : m < i+2) (hj : m < j+2) : (s i).coeff m=(s j).coeff m := by + have hi' := later_jet s hs i (max i j) (le_max_left _ _) + have hj' := later_jet s hs j (max i j) (le_max_right _ _) + have hi'' := hi' (Finsupp.single () m) (by simpa using hi) + have hj'' := hj' (Finsupp.single () m) (by simpa using hj) + exact hi''.symm.trans hj'' + +lemma limit_jet (s : ℕ → PowerSeries K) (hs : ∀n,EqJet (n+2) (s (n+1)) (s n)) + (n : ℕ) : EqJet (n+2) (limit s) (s n) := by + intro d hd + have he : d=Finsupp.single () (d ()) := Finsupp.unique_single d + rw [he] at hd ⊢ + simp only [Finsupp.degree_single] at hd + change PowerSeries.coeff (d ()) (limit s)=PowerSeries.coeff (d ()) (s n) + rw [limit,PowerSeries.coeff_mk] + exact stable_coeff s hs (d ()) (d ()) n (by omega) hd + +end HeightThree.HondaJetLimit + +namespace HeightThree.HondaClassification +open MvPowerSeries HeightThree.HondaJets HeightThree.HondaLeading +open HeightThree.HondaTarget HeightThree.HondaFrobenius HeightThree.HomogeneousCocycle +open HeightThree.CoordinateTransport HeightThree.HondaCorrection HeightThree.HondaJetLimit +variable {K : Type*} [Field K] +variable (p : ℕ) [hp : Fact p.Prime] [CharP K p] (h : ℕ) + (F G : FormalGroup K) [F.IsComm] [G.IsComm] + (hF : multiplicationSeries F p=PowerSeries.X^(p^h)) + (hG : multiplicationSeries G p=PowerSeries.X^(p^h)) + +include hF hG in + +theorem strict_honda_isomorphic : ∃ e : CoordinateIso G F, e.series.coeff 1=1 := by + let T := tower p h F G hF hG + let s : ℕ → PowerSeries K := fun n=>(T n).coordinate.series + have hs : ∀n,EqJet (n+2) (s (n+1)) (s n) := tower_step p h F G hF hG + let u := HondaJetLimit.limit s + have hu (n : ℕ) : EqJet (n+2) u (s n) := limit_jet s hs n + have hstrict : EqJet 2 u PowerSeries.X := (hu 0).trans (T 0).strict + have hz : u.constantCoeff=0 := by + have hh := hstrict 0 (by simp) + change MvPowerSeries.constantCoeff u=0 + simpa [PowerSeries.X] using hh + have hlin : u.coeff 1=1 := by + have hh := hstrict (Finsupp.single () 1) (by simp) + simpa [PowerSeries.coeff,PowerSeries.X] using hh + have hadd : u.subst G.toPowerSeries=F.toPowerSeries.subst ![u.subst (X 0),u.subst (X 1)] := by + apply MvPowerSeries.ext + intro d + let n := d.degree + let v := (T n).coordinate.series + have hv0 : v.constantCoeff=0 := (T n).coordinate.zero_series + have hL : EqJet (n+2) (u.subst G.toPowerSeries) (v.subst G.toPowerSeries) := + (hu n).subst_left (fun _ : Unit=>G.toPowerSeries) + (PowerSeries.HasSubst.of_constantCoeff_zero G.zero_constantCoeff).const + (fun _=>G.zero_constantCoeff) + rw [(T n).coordinate.preserves_addition] at hL + let a : Fin 2 → MvPowerSeries (Fin 2) K := ![v.subst (X 0),v.subst (X 1)] + let b : Fin 2 → MvPowerSeries (Fin 2) K := ![u.subst (X 0),u.subst (X 1)] + have ha0 : ∀i,(a i).constantCoeff=0 := by + intro i; fin_cases i <;> exact PowerSeries.constantCoeff_subst_eq_zero (by simp) _ hv0 + have hb0 : ∀i,(b i).constantCoeff=0 := by + intro i; fin_cases i <;> exact PowerSeries.constantCoeff_subst_eq_zero (by simp) _ hz + have hM := (T n).match_law.symm.subst_left a (hasSubst_of_constantCoeff_zero ha0) ha0 + have hR : EqJet (n+2) (F.toPowerSeries.subst a) (F.toPowerSeries.subst b) := by + apply EqJet.subst_right _ _ _ (hasSubst_of_constantCoeff_zero ha0) (hasSubst_of_constantCoeff_zero hb0) + intro i; fin_cases i + · exact (hu n).symm.subst_left (fun _ : Unit=>(X 0 : MvPowerSeries (Fin 2) K)) + (PowerSeries.HasSubst.X 0).const (by simp) + · exact (hu n).symm.subst_left (fun _ : Unit=>(X 1 : MvPowerSeries (Fin 2) K)) + (PowerSeries.HasSubst.X 1).const (by simp) + exact ((hL.trans hM).trans hR) d (by dsimp [n]; omega) + let c := Coordinate.ofSeries u hz (by rw [hlin]; exact isUnit_one) + exact ⟨{ __ := c, preserves_addition := hadd },hlin⟩ + +end HeightThree.HondaClassification + +end + +end OAI diff --git a/lean/OAI/Algebra/FormalGroup/Honda/Cocycle.lean b/lean/OAI/Algebra/FormalGroup/Honda/Cocycle.lean new file mode 100644 index 0000000000000000000000000000000000000000..cb3ffebb2143df82492f37e8d1b17bfc3c1214a6 --- /dev/null +++ b/lean/OAI/Algebra/FormalGroup/Honda/Cocycle.lean @@ -0,0 +1,617 @@ +import OAI.Algebra.FormalGroup.Honda.ChainRule + +namespace OAI + +noncomputable section + +namespace HeightThree.HomogeneousCocycle +open MvPowerSeries +variable {K σ τ : Type*} [Field K] + +lemma degree_pair (d : Fin 2 →₀ ℕ) : d.degree=d 0+d 1 := by + rw [Finsupp.degree_eq_sum] + simp + +lemma pair_exp (d : Fin 2 →₀ ℕ) : + d=Finsupp.single 0 (d 0)+Finsupp.single 1 (d 1) := by + ext i; fin_cases i <;> simp + +lemma monomial_pair (i j : ℕ) (a : K) : + monomial (Finsupp.single 0 i+Finsupp.single 1 j) a = + C a * (X (0 : Fin 2))^i * X 1^j := by + rw [←monomial_zero_eq_C_apply,X_pow_eq,X_pow_eq, + monomial_mul_monomial,monomial_mul_monomial] + simp + +lemma homogeneous_sum (D : MvPowerSeries (Fin 2) K) (n : ℕ) (hD : D.IsHomogeneous n) : + D=∑ i ∈ Finset.range (n+1), C (coeff (Finsupp.single 0 i+Finsupp.single 1 (n-i)) D) * + X 0^i * X 1^(n-i) := by + classical + simp_rw [←monomial_pair] + ext d + rw [map_sum] + by_cases hd : d.degree=n + · have he : n-d 0=d 1 := by rw [←hd,degree_pair]; omega + have hi : d 0∈Finset.range (n+1) := by simp only [Finset.mem_range]; rw [←hd,degree_pair]; omega + rw [Finset.sum_eq_single (d 0)] + · rw [he,←pair_exp d,coeff_monomial_same] + · intro i hi hne + rw [coeff_monomial,ite_eq_right] + intro h + have hh := congrArg (fun e : Fin 2 →₀ ℕ => e 0) h + simp at hh + exact hne hh.symm + · exact fun h => (h hi).elim + · rw [hD.coeff_eq_zero hd] + symm + apply Finset.sum_eq_zero + intro i hi + rw [coeff_monomial,ite_eq_right] + intro h + apply hd + rw [h,degree_pair] + simp + have : i≤n := by simpa only [Finset.mem_range,Nat.lt_succ_iff] using hi + omega + +structure IsCocycle (p : ℕ) (D : MvPowerSeries (Fin 2) K) : Prop where + zero_left : D.subst ![(0 : MvPowerSeries (Fin 1) K), X 0]=0 + zero_right : D.subst ![(X 0 : MvPowerSeries (Fin 1) K),0]=0 + symmetric : D.subst ![(X 1 : MvPowerSeries (Fin 2) K),X 0]=D + associative : + (D.subst ![(X 0 : MvPowerSeries (Fin 3) K),X 1]) + D.subst ![(X 0+X 1 : MvPowerSeries (Fin 3) K),X 2] = + (D.subst ![(X 1 : MvPowerSeries (Fin 3) K),X 2]) + D.subst ![(X 0 : MvPowerSeries (Fin 3) K),X 1+X 2] + trace_zero : ∑ i ∈ Finset.range p, D.subst ![C (i:K)*PowerSeries.X,PowerSeries.X]=0 + +lemma pair_subst_self (D : MvPowerSeries (Fin 2) K) : D.subst ![X 0,X 1]=D := by + rw [show (![X 0,X 1] : Fin 2 → MvPowerSeries (Fin 2) K)=X by ext i; fin_cases i <;> rfl] + exact congrFun MvPowerSeries.subst_self D + +lemma derivative_cocycle (p : ℕ) (D : MvPowerSeries (Fin 2) K) (hD : IsCocycle p D) : + pderiv (R := K) 1 D = (pderiv (R := K) 1 D).subst ![X 0+X 1,0] - + (pderiv (R := K) 1 D).subst ![X 1,0] := by + let a : Fin 2 → MvPowerSeries (Fin 3) K := ![X 0,X 1] + let b : Fin 2 → MvPowerSeries (Fin 3) K := ![X 0+X 1,X 2] + let c : Fin 2 → MvPowerSeries (Fin 3) K := ![X 1,X 2] + let d : Fin 2 → MvPowerSeries (Fin 3) K := ![X 0,X 1+X 2] + have ha : HasSubst a := hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> simp [a]) + have hb : HasSubst b := hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> simp [b]) + have hc : HasSubst c := hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> simp [c]) + have hd : HasSubst d := hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> simp [d]) + have hh := congrArg (pderiv (R := K) (2 : Fin 3)) hD.associative + change pderiv (R := K) 2 (D.subst a+D.subst b)=pderiv (R := K) 2 (D.subst c+D.subst d) at hh + simp only [map_add, OriginalDifferentialSupport.pderiv_subst a ha, + OriginalDifferentialSupport.pderiv_subst b hb, OriginalDifferentialSupport.pderiv_subst c hc, + OriginalDifferentialSupport.pderiv_subst d hd, Fin.sum_univ_two] at hh + simp [a,b,c,d] at hh + let e : Fin 3 → MvPowerSeries (Fin 2) K := ![X 0,X 1,0] + have he : HasSubst e := hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> simp [e]) + have hh' := congrArg (substAlgHom he) hh + simp only [map_add,substAlgHom_apply] at hh' + rw [subst_comp_subst_apply hb he,subst_comp_subst_apply hc he,subst_comp_subst_apply hd he] at hh' + have eb : (fun i => (b i).subst e)=![X 0+X 1,0] := by + ext i; fin_cases i <;> simp [b,e,subst_add he,subst_X he] + have ec : (fun i => (c i).subst e)=![X 1,0] := by + ext i; fin_cases i <;> simp [c,e,subst_X he] + have ed : (fun i => (d i).subst e)=![X 0,X 1] := by + ext i; fin_cases i <;> simp [d,e,subst_add he,subst_X he] + rw [eb,ec,ed,pair_subst_self] at hh' + exact eq_sub_iff_add_eq.mpr (by simpa only [add_comm] using hh'.symm) + +lemma derivative_monomial (a : K) (i j : ℕ) : + pderiv (R := K) 1 (C a*(X (0 : Fin 2))^i*X 1^j)= + C (a*(j:K))*X 0^i*X 1^(j-1) := by + simp [Derivation.leibniz_pow,smul_eq_mul] + ring + +lemma subst_monomial_pair (c : K) (i j : ℕ) (a b : MvPowerSeries σ K) + (ha : a.constantCoeff=0) (hb : b.constantCoeff=0) : + (C c*(X (0 : Fin 2))^i*X 1^j).subst ![a,b] = C c*a^i*b^j := by + have hs : HasSubst (![a,b] : Fin 2 → MvPowerSeries σ K) := + hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> simp [ha,hb]) + simp only [←coe_substAlgHom hs,map_mul,map_pow,substAlgHom_X, + Matrix.cons_val_zero,Matrix.cons_val_one] + rw [show (substAlgHom hs) (C c)=C c from (substAlgHom hs).commutes c] + +lemma homogeneous_derivative_axis (D : MvPowerSeries (Fin 2) K) (n : ℕ) (hn : 0 simp [ha]) + conv_lhs => rw [homogeneous_sum D n hD] + simp only [map_sum,derivative_monomial] + rw [←coe_substAlgHom hs,map_sum] + simp only [coe_substAlgHom,subst_monomial_pair _ _ _ a 0 ha (map_zero _)] + rw [Finset.sum_eq_single (n-1)] + · have h1 : n-(n-1)=1 := by omega + simp [h1] + · intro i hi hne + have hn1 : n-i≠1 := by omega + by_cases hh : n-i=0 + · simp [hh] + · have hn2 : n-i-1≠0 := by omega + simp [hn2] + · intro h + exact (h (by simp only [Finset.mem_range]; omega)).elim + +lemma derivative_shape (p : ℕ) (D : MvPowerSeries (Fin 2) K) (n : ℕ) (hn : 0 + rw [pow_zero,Nat.mul_zero] + exact homogeneous_one + | succ n ih => + rw [pow_succ,Nat.mul_succ] + exact ih.mul hf + +def coboundary (n : ℕ) : MvPowerSeries (Fin 2) K := (X 0+X 1)^n-X 0^n-X 1^n + +lemma homogeneous_coboundary (n : ℕ) : (coboundary (K := K) n).IsHomogeneous n := by + have hx (i : Fin 2) : (X i : MvPowerSeries (Fin 2) K).IsHomogeneous 1 := by + exact homogeneous_X i + have hxpow (i : Fin 2) : ((X i : MvPowerSeries (Fin 2) K)^n).IsHomogeneous n := by + have hh : ((X i : MvPowerSeries (Fin 2) K)^n).IsHomogeneous (1*n) := by + exact homogeneous_pow (hx i) n + rw [one_mul] at hh + exact @hh + have h01 : ((X (0 : Fin 2)+X 1 : MvPowerSeries (Fin 2) K)^n).IsHomogeneous n := by + have hsum : (X (0 : Fin 2)+X 1 : MvPowerSeries (Fin 2) K).IsHomogeneous 1 := + IsHomogeneous.add (hx 0) (hx 1) + have hh : ((X (0 : Fin 2)+X 1 : MvPowerSeries (Fin 2) K)^n).IsHomogeneous (1*n) := by + exact homogeneous_pow hsum n + rw [one_mul] at hh + exact @hh + unfold coboundary + have hh : ((X (0 : Fin 2)+X 1 : MvPowerSeries (Fin 2) K)^n-X 0^n).IsHomogeneous n := + fun {_} h => homogeneous_sub h01 (hxpow 0) h + exact fun {_} h => homogeneous_sub hh (hxpow 1) h + +lemma derivative_coboundary (n : ℕ) : + pderiv (R := K) 1 (coboundary (K := K) n) = + C (n:K)*((X 0+X 1)^(n-1)-X 1^(n-1)) := by + simp [coboundary,Derivation.leibniz_pow,smul_eq_mul] + ring + +lemma coeff_add_pow (n i j : ℕ) (hij : i+j=n) : + coeff (Finsupp.single 0 i+Finsupp.single 1 j) ((X (0 : Fin 2)+X 1 : MvPowerSeries (Fin 2) K)^n)= + (n.choose i : K) := by + classical + rw [add_pow,map_sum,Finset.sum_eq_single i] + · have he : n-i=j := by omega + rw [he] + have hm : (X (0 : Fin 2) : MvPowerSeries (Fin 2) K)^i*X 1^j*(n.choose i : MvPowerSeries (Fin 2) K)= + monomial (Finsupp.single 0 i+Finsupp.single 1 j) (n.choose i : K) := by + rw [monomial_pair,map_natCast] + ring + rw [hm,coeff_monomial_same] + · intro k hk hki + have hm : (X (0 : Fin 2) : MvPowerSeries (Fin 2) K)^k*X 1^(n-k)*(n.choose k : MvPowerSeries (Fin 2) K)= + monomial (Finsupp.single 0 k+Finsupp.single 1 (n-k)) (n.choose k : K) := by + rw [monomial_pair,map_natCast] + ring + rw [hm,coeff_monomial,ite_eq_right] + intro he + have hh := congrArg (fun e : Fin 2 →₀ ℕ => e 0) he + simp only [Finsupp.add_apply,Finsupp.single_eq_same,Finsupp.single_eq_of_ne (show (0:Fin 2)≠1 by decide),add_zero] at hh + exact hki hh.symm + · intro hi + exact (hi (by simp only [Finset.mem_range]; omega)).elim + +lemma derivative_zero_support (p : ℕ) [Fact p.Prime] [CharP K p] + (f : MvPowerSeries σ K) (hf : ∀ i, pderiv (R := K) i f=0) + (d : σ →₀ ℕ) (hd : coeff d f≠0) : ∀ i, p∣d i := by + classical + intro i + by_cases hi : d i=0 + · rw [hi]; exact dvd_zero p + let e := d.erase i+Finsupp.single i (d i-1) + have he : e+Finsupp.single i 1=d := by + ext j + by_cases hj : j=i + · subst j; simp [e,Nat.sub_add_cancel (by omega : 1≤d i)] + · simp [e,hj] + have hei : (e i : K)+1=(d i : K) := by + have hh := congrArg (fun d : σ →₀ ℕ => d i) he + simp only [Finsupp.add_apply,Finsupp.single_eq_same] at hh + simpa only [Nat.cast_add,Nat.cast_one] using congrArg (fun m : ℕ => (m : K)) hh + have hh := congrArg (coeff e) (hf i) + rw [coeff_pderiv,he,hei,map_zero] at hh + exact (CharP.cast_eq_zero_iff K p (d i)).mp ((mul_eq_zero.mp hh).resolve_left hd) + +lemma derivative_symmetry (D : MvPowerSeries (Fin 2) K) + (hD : D.subst ![X 1,X 0]=D) : + pderiv (R := K) 0 D=(pderiv (R := K) 1 D).subst ![X 1,X 0] := by + have hs : HasSubst (![X 1,X 0] : Fin 2 → MvPowerSeries (Fin 2) K) := + hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> simp) + have hh := congrArg (pderiv (R := K) (0 : Fin 2)) hD + rw [OriginalDifferentialSupport.pderiv_subst _ hs] at hh + simpa [Fin.sum_univ_two] using hh.symm + +lemma coboundary_symmetric (n : ℕ) : + (coboundary (K := K) n).subst ![X 1,X 0]=coboundary (K := K) n := by + have hs : HasSubst (![X 1,X 0] : Fin 2 → MvPowerSeries (Fin 2) K) := + hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> simp) + simp only [coboundary,←coe_substAlgHom hs,map_sub,map_add,map_pow,substAlgHom_X, + Matrix.cons_val_zero,Matrix.cons_val_one] + rw [add_comm (X 1) (X 0)] + ring + +lemma homogeneous_derivative_zero (p : ℕ) [hp : Fact p.Prime] [CharP K p] + (f : MvPowerSeries (Fin 2) K) (n : ℕ) (hn : ¬p∣n) + (hH : f.IsHomogeneous n) (hf : ∀ i, pderiv (R := K) i f=0) : f=0 := by + ext d + rw [map_zero] + by_contra hd + have he := derivative_zero_support p f hf d hd + apply hn + have hdn : d.degree=n := by + by_contra h + exact hd (hH.coeff_eq_zero h) + rw [←hdn,degree_pair] + exact dvd_add (he 0) (he 1) + +lemma coboundary_of_prime_not_dvd (p : ℕ) [hp : Fact p.Prime] [CharP K p] + (D : MvPowerSeries (Fin 2) K) (n : ℕ) (hn : ¬p∣n) + (hD : IsCocycle p D) (hH : D.IsHomogeneous n) : + ∃ a : K, D=a • coboundary n := by + let a := coeff (Finsupp.single 0 (n-1)+Finsupp.single 1 1) D/(n:K) + have hn0 : (n:K)≠0 := (CharP.cast_eq_zero_iff K p n).not.mpr hn + have hnat : 0 simp) + rw [subst_sub hs,subst_smul hs,hD.symmetric,coboundary_symmetric] + have hd1 : pderiv (R := K) 1 (D-a • coboundary n)=0 := by + rw [map_sub,Derivation.map_smul,derivative_shape p D n hnat hD hH,derivative_coboundary] + simp only [smul_eq_C_mul,←mul_assoc,←map_mul,div_mul_cancel₀ _ hn0,sub_self,a] + have he : D-a • coboundary n=0 := homogeneous_derivative_zero p _ n hn + (homogeneous_sub hH (homogeneous_smul a (homogeneous_coboundary n))) (by + intro i; fin_cases i + · change pderiv (R := K) 0 (D-a • coboundary n)=0 + rw [derivative_symmetry _ hsym,hd1] + rw [←coe_substAlgHom (hasSubst_of_constantCoeff_zero (by intro j; fin_cases j <;> simp)),map_zero] + · exact hd1) + exact ⟨a,sub_eq_zero.mp he⟩ + +lemma choose_pred_cast (p n : ℕ) [hp : Fact p.Prime] [CharP K p] + (hn : 0 (m : K)) (Nat.sub_add_cancel hp1) + simpa only [Nat.cast_add,Nat.cast_one,CharP.cast_eq_zero K p] using hh + have hcho : ((n-1).choose (n-p) : K)=1 := by + have heq : n-p=(n-1)-(p-1) := by omega + rw [heq,Nat.choose_symm (by omega)] + exact choose_pred_cast p n hn0 hpn + rw [coeff_pderiv] at he + simp only [Finsupp.add_apply,Finsupp.single_eq_same,Finsupp.single_eq_of_ne (show (1:Fin 2)≠0 by decide),zero_add,hfac,mul_zero] at he + rw [coeff_C_mul,map_sub,coeff_add_pow _ _ _ (by omega),hcho] at he + have hz : coeff (Finsupp.single 0 (n-p)+Finsupp.single 1 (p-1)) (X (1 : Fin 2)^(n-1) : MvPowerSeries (Fin 2) K)=0 := by + rw [X_pow_eq,coeff_monomial,ite_eq_right] + intro h + have hh := congrArg (fun d : Fin 2 →₀ ℕ => d 0) h + simp at hh + omega + rw [hz,sub_zero,mul_one] at he + exact he.symm + rw [derivative_shape p D n hn0 hD hH,show coeff _ D=c from rfl,hc,map_zero,zero_mul] + +lemma prime_power_sum (p j : ℕ) [hp : Fact p.Prime] [CharP K p] (hj : j exact (hp.out.ne_zero rfl).elim + | succ p => + apply Fin.ext + change i.val = i.val % (p+1) + exact (Nat.mod_eq_of_lt i.isLt).symm + have hh := (ZMod.finEquiv p).toEquiv.sum_comp (fun x => x^j) + change (∑ i : Fin p, (ZMod.finEquiv p i)^j)=_ at hh + simpa only [heq] using hh + have hh := congrArg (ZMod.castHom (dvd_refl p) K) (hs.trans hz) + simpa only [map_sum,map_pow,map_natCast,apply_ite,map_neg,map_one,map_zero] using hh + +lemma homogeneous_trace (p n : ℕ) (D : MvPowerSeries (Fin 2) K) (hH : D.IsHomogeneous n) : + ∑ i ∈ Finset.range p, D.subst ![C (i:K)*PowerSeries.X,PowerSeries.X] = + C (∑ j ∈ Finset.range (n+1), coeff (Finsupp.single 0 j+Finsupp.single 1 (n-j)) D * + (∑ i ∈ Finset.range p, (i:K)^j)) * PowerSeries.X^n := by + classical + have hs (i : ℕ) : HasSubst (![C (i:K)*PowerSeries.X,PowerSeries.X] : Fin 2 → PowerSeries K) := + hasSubst_of_constantCoeff_zero (by intro a; fin_cases a <;> simp [PowerSeries.X]) + have hx : (PowerSeries.X : PowerSeries K).constantCoeff=0 := PowerSeries.constantCoeff_X + have heach (i : ℕ) : D.subst ![C (i:K)*PowerSeries.X,PowerSeries.X]= + ∑ j ∈ Finset.range (n+1), C (coeff (Finsupp.single 0 j+Finsupp.single 1 (n-j)) D) * + (C (i:K)*PowerSeries.X)^j * PowerSeries.X^(n-j) := by + conv_lhs => rw [homogeneous_sum D n hH] + rw [←coe_substAlgHom (hs i),map_sum] + simp only [coe_substAlgHom,subst_monomial_pair (K := K) _ _ _ (C (i:K)*PowerSeries.X) PowerSeries.X (by simp [PowerSeries.X]) hx] + simp_rw [heach] + simp_rw [mul_pow,←mul_assoc] + have hterm (i j : ℕ) (hj : j∈Finset.range (n+1)) : + C (coeff (Finsupp.single 0 j+Finsupp.single 1 (n-j)) D) * C (i:K)^j * + PowerSeries.X^j * PowerSeries.X^(n-j)= + C (coeff (Finsupp.single 0 j+Finsupp.single 1 (n-j)) D * (i:K)^j)*PowerSeries.X^n := by + rw [←map_pow,←map_mul,mul_assoc,←pow_add,Nat.add_sub_of_le] + simpa only [Finset.mem_range,Nat.lt_succ_iff] using hj + have ht (i : ℕ) : (∑ j ∈ Finset.range (n+1), C (coeff (Finsupp.single 0 j+Finsupp.single 1 (n-j)) D) * C (i:K)^j * + PowerSeries.X^j * PowerSeries.X^(n-j))= + ∑ j ∈ Finset.range (n+1), C (coeff (Finsupp.single 0 j+Finsupp.single 1 (n-j)) D * (i:K)^j)*PowerSeries.X^n := + Finset.sum_congr rfl (fun j hj => hterm i j hj) + simp_rw [ht] + rw [Finset.sum_comm] + simp only [←Finset.sum_mul,←map_sum,←Finset.mul_sum] + +lemma derivative_vanish_at_prime (p : ℕ) [hp : Fact p.Prime] [CharP K p] + (D : MvPowerSeries (Fin 2) K) (hD : IsCocycle p D) (hH : D.IsHomogeneous p) : + pderiv (R := K) 1 D=0 := by + classical + have htop : coeff (Finsupp.single 0 p+Finsupp.single 1 0) D=0 := by + have hs : HasSubst (![(X (0 : Fin 1) : MvPowerSeries (Fin 1) K),0] : Fin 2 → MvPowerSeries (Fin 1) K) := + hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> simp) + have hh := hD.zero_right + rw [homogeneous_sum D p hH,←coe_substAlgHom hs,map_sum] at hh + simp only [coe_substAlgHom,subst_monomial_pair (K := K) _ _ _ (X (0 : Fin 1)) 0 (constantCoeff_X _) (map_zero _)] at hh + have hz (j : ℕ) (hj : j∈Finset.range (p+1)) (hjp : j≠p) : + C (coeff (Finsupp.single 0 j+Finsupp.single 1 (p-j)) D) * (X (0 : Fin 1))^j * (0 : MvPowerSeries (Fin 1) K)^(p-j)=0 := by + have he : p-j≠0 := by simp only [Finset.mem_range] at hj; omega + rw [zero_pow he,mul_zero] + rw [Finset.sum_eq_single p (fun j hj hne => hz j hj hne) (by simp)] at hh + simp only [Nat.sub_self,pow_zero,mul_one] at hh + have hc := congrArg (coeff (Finsupp.single (0 : Fin 1) p)) hh + simpa only [coeff_C_mul,X_pow_eq,coeff_monomial_same,mul_one,map_zero] using hc + have ht := hD.trace_zero + rw [homogeneous_trace p p D hH] at ht + have hsum : ∑ j ∈ Finset.range (p+1), coeff (Finsupp.single 0 j+Finsupp.single 1 (p-j)) D * + (∑ i ∈ Finset.range p, (i:K)^j) = -coeff (Finsupp.single 0 (p-1)+Finsupp.single 1 1) D := by + rw [Finset.sum_range_succ,Nat.sub_self,htop,zero_mul,add_zero] + have ht : (∑ j ∈ Finset.range p, coeff (Finsupp.single 0 j+Finsupp.single 1 (p-j)) D * (∑ i ∈ Finset.range p, (i:K)^j))= + ∑ j ∈ Finset.range p, coeff (Finsupp.single 0 j+Finsupp.single 1 (p-j)) D * (if j=p-1 then -1 else 0) := by + apply Finset.sum_congr rfl + intro j hj + rw [prime_power_sum p j (Finset.mem_range.mp hj)] + rw [ht] + rw [Finset.sum_eq_single (p-1)] + · simp [Nat.sub_sub_self (show 1≤p from hp.out.one_le)] + · intro b hb hne; rw [ite_eq_right hne,mul_zero] + · intro h; exact (h (Finset.mem_range.mpr (Nat.sub_lt hp.out.pos (by decide)))).elim + rw [hsum] at ht + change PowerSeries.C (-coeff (Finsupp.single 0 (p-1)+Finsupp.single 1 1) D)*PowerSeries.X^p=0 at ht + have hc := congrArg (PowerSeries.coeff p) ht + simp only [PowerSeries.coeff_C_mul_X_pow,map_zero,ite_true,neg_eq_zero] at hc + rw [derivative_shape p D p hp.out.pos hD hH,hc,map_zero,zero_mul] + +lemma exists_expand_of_support {σ R : Type*} [CommRing R] (f : MvPowerSeries σ R) + (q : ℕ) (hq : q ≠ 0) (h : ∀ d, coeff d f ≠ 0 → ∀ i, q ∣ d i) : + ∃ g, expand q hq g = f := by + classical + let g : MvPowerSeries σ R := fun d => coeff (q • d) f + refine ⟨g, ?_⟩ + ext d + by_cases hd : ∀ i, q ∣ d i + · let e := d.mapRange (fun n => n/q) (Nat.zero_div q) + have he : q • e = d := by + ext i + simp only [Finsupp.smul_apply, smul_eq_mul, e, Finsupp.mapRange_apply] + exact Nat.mul_div_cancel' (hd i) + rw [← he, coeff_expand_smul] + rfl + · obtain ⟨i, hi⟩ := not_forall.mp hd + rw [coeff_expand_of_not_dvd _ _ _ hi] + by_contra hf + exact hi (h d (Ne.symm hf) i) + +lemma expand_injective {R : Type*} [CommRing R] (q : ℕ) (hq : q ≠ 0) : + Function.Injective (MvPowerSeries.expand (R := R) (σ := σ) q hq) := by + intro f g h + ext d + simpa only [coeff_expand_smul] using congrArg (coeff (q • d)) h + +lemma subst_expand (p : ℕ) (hp : p≠0) (D : MvPowerSeries σ K) + (a : σ → MvPowerSeries τ K) (ha : HasSubst a) : + (expand p hp D).subst a = D.subst (fun i => a i^p) := by + rw [expand,substAlgHom_apply,subst_comp_subst_apply (HasSubst.X_pow hp) ha] + congr 1 + funext i + rw [subst_pow ha,subst_X ha] + +lemma expand_subst_comm (p : ℕ) (hp : p≠0) (D : MvPowerSeries σ K) + (a : σ → MvPowerSeries τ K) (ha : HasSubst a) + (hpow : ∀ i, expand p hp (a i)=a i^p) : + expand p hp (D.subst a)=(expand p hp D).subst a := by + rw [expand_subst p hp ha,subst_expand p hp D a ha] + congr 1 + funext i + exact hpow i + +local instance seriesCharP (p : ℕ) [CharP K p] : CharP (MvPowerSeries σ K) p := + charP_of_injective_ringHom MvPowerSeries.C_injective p + +lemma isCocycle_of_expand (p : ℕ) [hp : Fact p.Prime] [CharP K p] + (D : MvPowerSeries (Fin 2) K) (hD : IsCocycle p (expand p hp.out.ne_zero D)) : + IsCocycle p D := by + have h0 (a : Fin 2 → MvPowerSeries (Fin 1) K) (ha : HasSubst a) + (hpow : ∀ i, expand p hp.out.ne_zero (a i)=a i^p) : + expand p hp.out.ne_zero (D.subst a)=(expand p hp.out.ne_zero D).subst a := + expand_subst_comm p hp.out.ne_zero D a ha hpow + have h3 (a : Fin 2 → MvPowerSeries (Fin 3) K) (ha : HasSubst a) + (hpow : ∀ i, expand p hp.out.ne_zero (a i)=a i^p) : + expand p hp.out.ne_zero (D.subst a)=(expand p hp.out.ne_zero D).subst a := + expand_subst_comm p hp.out.ne_zero D a ha hpow + have hpos : p≠0 := hp.out.ne_zero + refine ⟨?_,?_,?_,?_,?_⟩ + · apply expand_injective p hpos + rw [map_zero,h0 _ (hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> simp)) + (by intro i; fin_cases i <;> simp [zero_pow hpos])] + exact hD.zero_left + · apply expand_injective p hpos + rw [map_zero,h0 _ (hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> simp)) + (by intro i; fin_cases i <;> simp [zero_pow hpos])] + exact hD.zero_right + · apply expand_injective p hpos + rw [expand_subst_comm p hpos D _ (hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> simp)) + (by intro i; fin_cases i <;> simp)] + exact hD.symmetric + · apply expand_injective p hpos + rw [map_add,map_add] + rw [h3 _ (hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> simp)) + (by intro i; fin_cases i <;> simp)] + rw [h3 _ (hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> simp)) + (by intro i; fin_cases i <;> simp [add_pow_char])] + rw [h3 _ (hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> simp)) + (by intro i; fin_cases i <;> simp)] + rw [h3 _ (hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> simp)) + (by intro i; fin_cases i <;> simp [add_pow_char])] + exact hD.associative + · apply expand_injective p hpos + rw [map_zero,map_sum] + have hterm (i : ℕ) : expand p hpos (D.subst ![C (i:K)*PowerSeries.X,PowerSeries.X])= + (expand p hpos D).subst ![C (i:K)*PowerSeries.X,PowerSeries.X] := by + apply expand_subst_comm p hpos D + · apply hasSubst_of_constantCoeff_zero + intro j; fin_cases j <;> simp [PowerSeries.X] + · have hh : (i:PowerSeries K)^p=(i:PowerSeries K) := (map_natCast (frobenius (PowerSeries K) p) i) + intro j; fin_cases j <;> simp [PowerSeries.X,map_mul,mul_pow,hh] + simp_rw [hterm] + exact hD.trace_zero + +lemma homogeneous_of_expand (p : ℕ) (hp : p≠0) (D : MvPowerSeries (Fin 2) K) + (n : ℕ) (hD : (expand p hp D).IsHomogeneous n) : D.IsHomogeneous (n/p) := by + apply homogeneous_of_coeff + intro d hd + by_contra hn + have hz : coeff (p • d) (expand p hp D)≠0 := by rwa [coeff_expand_smul] + have he : (p • d).degree=n := by + by_contra hne + exact hz (hD.coeff_eq_zero hne) + have hdeg : (p • d).degree=p*d.degree := by rw [map_nsmul,smul_eq_mul] + apply hd + rw [←he,hdeg,Nat.mul_div_cancel_left _ (Nat.pos_of_ne_zero hp)] + +lemma expand_coboundary (p : ℕ) [hp : Fact p.Prime] [CharP K p] (n : ℕ) : + expand p hp.out.ne_zero (coboundary (K := K) n)=coboundary (p*n) := by + simp only [coboundary,map_sub,map_pow,map_add,expand_X] + rw [←add_pow_char,←pow_mul,←pow_mul,←pow_mul] + +theorem cocycle_is_coboundary (p : ℕ) [hp : Fact p.Prime] [CharP K p] + (n : ℕ) (hn : 0 + by_cases hpn : p∣n + · have hple : p≤n := Nat.le_of_dvd hn hpn + have hd1 : pderiv (R := K) 1 D=0 := by + rcases hple.eq_or_lt with he | hl + · subst n + exact derivative_vanish_at_prime p D hD hH + · exact derivative_vanish_of_large_divisible p D n hl hpn hD hH + have hd : ∀ i, pderiv (R := K) i D=0 := by + intro i; fin_cases i + · change pderiv (R := K) 0 D=0 + rw [derivative_symmetry D hD.symmetric,hd1, + ←coe_substAlgHom (hasSubst_of_constantCoeff_zero (by intro j; fin_cases j <;> simp)),map_zero] + · exact hd1 + obtain ⟨E,hE⟩ := exists_expand_of_support D p hp.out.ne_zero (derivative_zero_support p D hd) + have hEH : E.IsHomogeneous (n/p) := by + apply homogeneous_of_expand p hp.out.ne_zero + rwa [hE] + have hEC : IsCocycle p E := isCocycle_of_expand p E (by rwa [hE]) + obtain ⟨a,ha⟩ := ih (n/p) (Nat.div_lt_self hn hp.out.one_lt) + (Nat.div_pos hple hp.out.pos) E hEC hEH + refine ⟨a,?_⟩ + rw [←hE,ha,map_smul,expand_coboundary,Nat.mul_div_cancel' hpn] + · exact coboundary_of_prime_not_dvd p D n hpn hD hH + +end HeightThree.HomogeneousCocycle + +end + +end OAI diff --git a/lean/OAI/Algebra/FormalGroup/Honda/Coordinates.lean b/lean/OAI/Algebra/FormalGroup/Honda/Coordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..95553db216ba0da87a6aab2fdebb89f312f052f6 --- /dev/null +++ b/lean/OAI/Algebra/FormalGroup/Honda/Coordinates.lean @@ -0,0 +1,353 @@ +import OAI.Algebra.FormalGroup.Honda.Recurrence + +namespace OAI + +noncomputable section + +namespace HeightThree.HondaCoordinates +open MvPowerSeries HondaConstruction HondaTarget LogarithmicConstruction +variable {A B : Type*} [CommRing A] [CommRing B] + +@[simp] lemma multiplication_zero (F : FormalGroup A) : multiplicationSeries F 0 = 0 := rfl + +lemma multiplication_succ (F : FormalGroup A) (n : ℕ) : + multiplicationSeries F (n+1) = + F.toPowerSeries.subst ![multiplicationSeries F n, PowerSeries.X] := by + change ((n+1) • variablePoint F).val = _ + rw [succ_nsmul] + rfl + +@[simp] lemma multiplication_constant (F : FormalGroup A) (n : ℕ) : + (multiplicationSeries F n).constantCoeff = 0 := by + induction n with + | zero => simp + | succ n ih => + rw [multiplication_succ] + apply MvPowerSeries.constantCoeff_subst_eq_zero + (hasSubst_of_constantCoeff_zero (by intro i; fin_cases i; exact ih; exact PowerSeries.constantCoeff_X)) + (by intro i; fin_cases i; exact ih; exact PowerSeries.constantCoeff_X) F.zero_constantCoeff + +lemma multiplication_map (F : FormalGroup A) (φ : A →+* B) (n : ℕ) : + multiplicationSeries (F.map φ) n = (multiplicationSeries F n).map φ := by + induction n with + | zero => simp + | succ n ih => + rw [multiplication_succ, multiplication_succ] + change _ = MvPowerSeries.map φ (F.toPowerSeries.subst ![multiplicationSeries F n, PowerSeries.X]) + have hs : MvPowerSeries.HasSubst ![multiplicationSeries F n, PowerSeries.X] := + hasSubst_of_constantCoeff_zero (by + intro i; fin_cases i; exact multiplication_constant F n; exact PowerSeries.constantCoeff_X) + rw [map_subst hs, ih] + congr 1 + funext i + fin_cases i + · rfl + · exact (MvPowerSeries.map_X φ ()).symm + +lemma log_multiplication (l : StrictLog (R := A)) (n : ℕ) : + l.series.subst (multiplicationSeries l.formalGroup n) = n • l.series := by + induction n with + | zero => + simp only [multiplication_zero, zero_nsmul] + exact PowerSeries.subst_zero_of_constantCoeff_zero l.constant_zero + | succ n ih => + rw [multiplication_succ] + change l.series.subst (l.law.subst ![_, PowerSeries.X]) = _ + rw [l.log_law_pair _ _ (multiplication_constant _ _) PowerSeries.constantCoeff_X, ih, + PowerSeries.X_subst, succ_nsmul] + +lemma multiplication_linear (l : StrictLog (R := A)) (n : ℕ) : + (multiplicationSeries l.formalGroup n).coeff 1 = (n : A) := by + have h := congrArg (PowerSeries.coeff 1) (log_multiplication l n) + rw [show (PowerSeries.coeff 1 : PowerSeries A →ₗ[A] A) = + MvPowerSeries.coeff (Finsupp.single () 1) from rfl, + StrictLog.coeff_subst_linear _ _ (multiplication_constant _ _) (), l.linear_one, + one_mul] at h + change (multiplicationSeries l.formalGroup n).coeff 1 = n • l.series.coeff 1 at h + simpa only [l.linear_one, nsmul_one] using h + +end HeightThree.HondaCoordinates + +namespace HeightThree.HondaCoordinates +open MvPowerSeries HondaConstruction HondaTarget LogarithmicConstruction +variable {R : Type*} [CommRing R] + +lemma coeff_pow_below (g : PowerSeries R) (hg : g.constantCoeff = 0) + (n j : ℕ) (hjn : j < n) : (g^n).coeff j = 0 := by + exact PowerSeries.coeff_of_lt_order j (lt_of_lt_of_le + (by exact_mod_cast hjn) (PowerSeries.le_order_pow_of_constantCoeff_eq_zero n hg)) + +lemma coeff_pow_leading (g : PowerSeries R) (hg : g.constantCoeff = 0) (n : ℕ) : + (g^n).coeff n = (g.coeff 1)^n := by + obtain ⟨h, rfl⟩ := PowerSeries.X_dvd_iff.mpr hg + rw [mul_pow] + have hc (h : PowerSeries R) (n : ℕ) : (PowerSeries.X^n * h).coeff n = h.constantCoeff := by + simpa only [zero_add, PowerSeries.coeff_zero_eq_constantCoeff] using + PowerSeries.coeff_X_pow_mul h n 0 + rw [hc] + rw [show PowerSeries.X * h = PowerSeries.X^1 * h by simp, hc, map_pow] + +lemma coeff_subst_before (l : StrictLog (R := R)) (q : ℕ) + (hl : ∀ j, 1 < j → j < q → l.series.coeff j = 0) + (g : PowerSeries R) (hg : g.constantCoeff = 0) (j : ℕ) (hj : j < q) : + PowerSeries.coeff j (l.series.subst g) = g.coeff j := by + rw [PowerSeries.coeff_subst' (PowerSeries.HasSubst.of_constantCoeff_zero hg), + finsum_eq_single _ 1, l.linear_one, one_smul, pow_one] + intro n hn + by_cases hn0 : n = 0 + · subst n + rw [PowerSeries.coeff_zero_eq_constantCoeff, l.constant_zero, zero_smul] + by_cases hnq : n < q + · rw [hl n (by omega) hnq, zero_smul] + · rw [coeff_pow_below g hg n j (by omega), smul_zero] + +lemma coeff_subst_first (l : StrictLog (R := R)) (q : ℕ) (hq : 1 < q) + (hl : ∀ j, 1 < j → j < q → l.series.coeff j = 0) + (g : PowerSeries R) (hg : g.constantCoeff = 0) : + PowerSeries.coeff q (l.series.subst g) = g.coeff q + l.series.coeff q * (g.coeff 1)^q := by + classical + rw [PowerSeries.coeff_subst' (PowerSeries.HasSubst.of_constantCoeff_zero hg)] + rw [finsum_eq_sum_of_support_subset _ (s := {1, q})] + · rw [Finset.sum_insert (by simpa only [Finset.mem_singleton] using (ne_of_lt hq)), Finset.sum_singleton] + dsimp + simp only [l.linear_one, one_mul, pow_one, coeff_pow_leading g hg q] + · intro n hn + by_contra hn' + have hh : n ≠ 1 ∧ n ≠ q := by simpa using hn' + obtain ⟨hn1, hnq⟩ := hh + apply hn + change l.series.coeff n • (g^n).coeff q = 0 + by_cases hn0 : n = 0 + · subst n + rw [PowerSeries.coeff_zero_eq_constantCoeff, l.constant_zero, zero_smul] + by_cases hnlt : n < q + · rw [hl n (by omega) hnlt, zero_smul] + · rw [coeff_pow_below g hg n q (by omega), smul_zero] + +theorem multiplication_first_coeff (l : StrictLog (R := R)) (q : ℕ) (hq : 1 < q) + (hl : ∀ j, 1 < j → j < q → l.series.coeff j = 0) (n : ℕ) : + (∀ j < q, (multiplicationSeries l.formalGroup n).coeff j = + (n : R) * (PowerSeries.X : PowerSeries R).coeff j) ∧ + (multiplicationSeries l.formalGroup n).coeff q = + l.series.coeff q * ((n : R) - (n : R)^q) := by + have hg := multiplication_constant l.formalGroup n + constructor + · intro j hj + have h := congrArg (PowerSeries.coeff j) (log_multiplication l n) + rw [coeff_subst_before l q hl _ hg j hj, map_nsmul] at h + by_cases hj1 : j = 1 + · subst j + simpa [l.linear_one] using h + by_cases hj0 : j = 0 + · subst j + simp + · rw [hl j (by omega) hj, smul_zero] at h + simpa [PowerSeries.coeff_X, hj1] using h + · have h := congrArg (PowerSeries.coeff q) (log_multiplication l n) + rw [coeff_subst_first l q hq hl _ hg, multiplication_linear, map_nsmul, + nsmul_eq_mul] at h + linear_combination h + +end HeightThree.HondaCoordinates + +namespace HeightThree.HondaCoordinates +open MvPowerSeries HondaConstruction HondaTarget LogarithmicConstruction PTypical +variable {A B : Type*} [CommRing A] [CommRing B] + +lemma numerator_one (p : ℕ) (ψ : A →+* A) (v : Fin 3 → A) : + numerator p ψ v 1 = v 0 := by + simp [numerator] + +lemma numerator_two (p : ℕ) (ψ : A →+* A) (v : Fin 3 → A) (hv : v 0 = 0) : + numerator p ψ v 2 = (p : A) * v 1 := by + simp [numerator, Fin.sum_univ_three, hv] + +lemma logarithm_coeff_below [Algebra ℚ B] (ι : A →+* B) (p : ℕ) (hp : 2 ≤ p) + (ψ : A →+* A) (v : Fin 3 → A) (m : ℕ) + (hm : ∀ n, 0 < n → n < m → numerator p ψ v n = 0) + (j : ℕ) (hj1 : 1 < j) (hj : j < p^m) : + (logarithm ι p ψ v).coeff j = 0 := by + by_cases hn : ∃ n : ℕ, p^n = j + · obtain ⟨n, rfl⟩ := hn + rw [logarithm, coeff_series_power p hp] + have hnpos : 0 < n := by by_contra h; simp [show n = 0 by omega] at hj1 + rw [hm n hnpos ((Nat.pow_lt_pow_iff_right (by omega : 1 < p)).mp hj), + map_zero, smul_zero] + · exact coeff_series_outside p j _ hn + +lemma rational_first_cancel [Algebra ℚ B] (p : ℕ) (hp : p ≠ 0) + (q : ℕ) (hq : 0 < q) (v : B) : + ((p : ℚ)⁻¹ • v) * ((p : B) - (p : B)^q) = v * (1 - (p : B)^(q-1)) := by + have hc : algebraMap ℚ B (p : ℚ)⁻¹ * (p : B) = 1 := by + rw [← map_natCast (algebraMap ℚ B), ← map_mul, inv_mul_cancel₀ (by exact_mod_cast hp), map_one] + rw [Algebra.smul_def, show q = (q-1)+1 by omega, pow_succ] + calc + _ = (algebraMap ℚ B (p : ℚ)⁻¹ * (p : B)) * v * (1-(p : B)^(q-1)) := by ring + _ = _ := by simp only [hc, one_mul, Nat.add_sub_cancel] + +theorem multiplication_first_integral [Algebra ℚ B] (ι : A →+* B) + (hinj : Function.Injective ι) (F : FormalGroup A) (l : StrictLog (R := B)) + (hF : F.map ι = l.formalGroup) (p : ℕ) (hp : p ≠ 0) + (q : ℕ) (hq : 1 < q) (v : A) + (hl : ∀ j, 1 < j → j < q → l.series.coeff j = 0) + (hlq : l.series.coeff q = (p : ℚ)⁻¹ • ι v) : + (∀ j < q, (multiplicationSeries F p).coeff j = (p : A) * + (PowerSeries.X : PowerSeries A).coeff j) ∧ + (multiplicationSeries F p).coeff q = v * (1-(p : A)^(q-1)) := by + have hmap : (multiplicationSeries F p).map ι = multiplicationSeries l.formalGroup p := by + rw [← multiplication_map, hF] + have h := multiplication_first_coeff l q hq hl p + constructor + · intro j hj + apply hinj + have he := congrArg (PowerSeries.coeff j) hmap + rw [PowerSeries.coeff_map, h.1 j hj] at he + simpa only [map_mul, map_natCast, PowerSeries.coeff_X, apply_ite ι, + map_one, map_zero] using he + · apply hinj + have he := congrArg (PowerSeries.coeff q) hmap + rw [PowerSeries.coeff_map, h.2, hlq, rational_first_cancel p hp q (by omega)] at he + simpa only [map_mul, map_sub, map_one, map_pow, map_natCast] using he + +lemma integralFormalGroup_map [Algebra ℚ B] (ι : A →+* B) (hinj : Function.Injective ι) + (p : ℕ) [hp : Fact p.Prime] + (ψ : A →+* A) (χ : B →ₐ[ℚ] B) (hc : χ.toRingHom.comp ι = ι.comp ψ) + (hψ : ∀ a : A, (p : A) ∣ ψ a - a^p) (v : Fin 3 → A) : + (integralFormalGroup ι hinj p ψ χ hc hψ v).map ι = + (heightThreeLog ι p hp.out.two_le ψ v).formalGroup := map_descendFormalGroup .. + +theorem integralFormalGroup_height_one [Algebra ℚ B] + (ι : A →+* B) (hinj : Function.Injective ι) (p : ℕ) [hp : Fact p.Prime] + (ψ : A →+* A) (χ : B →ₐ[ℚ] B) (hc : χ.toRingHom.comp ι = ι.comp ψ) + (hψ : ∀ a : A, (p : A) ∣ ψ a - a^p) (v : Fin 3 → A) : + (∀ j < p, (multiplicationSeries (integralFormalGroup ι hinj p ψ χ hc hψ v) p).coeff j = + (p : A) * (PowerSeries.X : PowerSeries A).coeff j) ∧ + (multiplicationSeries (integralFormalGroup ι hinj p ψ χ hc hψ v) p).coeff p = + v 0 * (1 - (p : A)^(p-1)) := by + apply multiplication_first_integral ι hinj _ (heightThreeLog ι p hp.out.two_le ψ v) + (integralFormalGroup_map ..) p hp.out.ne_zero p hp.out.one_lt (v 0) + · intro j hj1 hj + exact logarithm_coeff_below ι p hp.out.two_le ψ v 1 (by intro n hn hn'; omega) + j hj1 (by simpa using hj) + · change (logarithm ι p ψ v).coeff p = _ + have he := coeff_series_power p hp.out.two_le + (fun n => ((p : ℚ)⁻¹)^n • ι (numerator p ψ v n)) 1 + simpa only [logarithm, pow_one, numerator_one] using he + +end HeightThree.HondaCoordinates + +namespace HeightThree.HondaCoordinates +open MvPowerSeries HondaConstruction HondaTarget LogarithmicConstruction PTypical +variable {A B C D : Type*} [CommRing A] [CommRing B] [CommRing C] [CommRing D] + +theorem integralFormalGroup_height_two [Algebra ℚ B] + (ι : A →+* B) (hinj : Function.Injective ι) (p : ℕ) [hp : Fact p.Prime] + (ψ : A →+* A) (χ : B →ₐ[ℚ] B) (hc : χ.toRingHom.comp ι = ι.comp ψ) + (hψ : ∀ a : A, (p : A) ∣ ψ a - a^p) (v : Fin 3 → A) (hv : v 0 = 0) : + (∀ j < p^2, (multiplicationSeries (integralFormalGroup ι hinj p ψ χ hc hψ v) p).coeff j = + (p : A) * (PowerSeries.X : PowerSeries A).coeff j) ∧ + (multiplicationSeries (integralFormalGroup ι hinj p ψ χ hc hψ v) p).coeff (p^2) = + v 1 * (1 - (p : A)^(p^2-1)) := by + have hp2 : 1 < p^2 := one_lt_pow₀ hp.out.one_lt (by decide) + apply multiplication_first_integral ι hinj _ (heightThreeLog ι p hp.out.two_le ψ v) + (integralFormalGroup_map ..) p hp.out.ne_zero (p^2) hp2 (v 1) + · intro j hj1 hj + apply logarithm_coeff_below ι p hp.out.two_le ψ v 2 _ j hj1 hj + intro n hn hn' + have : n = 1 := by omega + simp [this, numerator_one, hv] + · change (logarithm ι p ψ v).coeff (p^2) = _ + rw [logarithm, coeff_series_power p hp.out.two_le, numerator_two p ψ v hv, + map_mul, map_natCast] + have hs : ((p : ℚ)⁻¹)^2 • ((p : B) * ι (v 1)) = (p : ℚ)⁻¹ • ι (v 1) := by + rw [Algebra.smul_def, Algebra.smul_def, ← map_natCast (algebraMap ℚ B), + ← mul_assoc, ← map_mul] + congr 2 + field_simp + exact hs + +lemma numerator_map (α : A →+* B) (p : ℕ) (ψ : A →+* A) (χ : B →+* B) + (hc : χ.comp α = α.comp ψ) (v : Fin 3 → A) (n : ℕ) : + α (numerator p ψ v n) = numerator p χ (α ∘ v) n := by + induction n using Nat.strong_induction_on with + | h n ih => + cases n with + | zero => simp [numerator] + | succ n => + rw [numerator, numerator, map_sum] + apply Finset.sum_congr rfl + intro i hi + split_ifs with hn + · rw [map_mul, map_mul, map_pow, map_natCast, ← iterate_comp α ψ χ hc, + ih (n-i.val) (by omega)] + rfl + · exact map_zero α + +end HeightThree.HondaCoordinates + +namespace HeightThree.LogarithmicConstruction.StrictLog +open MvPowerSeries +variable {A B : Type*} [CommRing A] [CommRing B] + +def map (l : StrictLog (R := A)) (φ : A →+* B) : StrictLog (R := B) where + series := l.series.map φ + constant_zero := by + change φ l.series.constantCoeff = 0 + rw [l.constant_zero, map_zero] + linear_one := by simp only [PowerSeries.coeff_map, l.linear_one, map_one] + +lemma formalGroup_map (l : StrictLog (R := A)) (φ : A →+* B) : + l.formalGroup.map φ = (l.map φ).formalGroup := by + apply FormalGroup.ext + apply (l.map φ).subst_injective + (PowerSeries.HasSubst.of_constantCoeff_zero (l.formalGroup.map φ).zero_constantCoeff) + (PowerSeries.HasSubst.of_constantCoeff_zero (l.map φ).law_constant) + change (l.series.map φ).subst (l.law.map φ) = (l.map φ).series.subst (l.map φ).law + rw [(l.map φ).log_law, ← PowerSeries.map_subst + (PowerSeries.HasSubst.of_constantCoeff_zero l.law_constant), l.log_law] + simp only [StrictLog.sumSeries, map_add, PowerSeries.map_subst (PowerSeries.HasSubst.X _), + map_X, map] + +@[ext] lemma ext {l m : StrictLog (R := A)} (h : l.series = m.series) : l = m := by + cases l + cases m + congr + +end HeightThree.LogarithmicConstruction.StrictLog + +namespace HeightThree.HondaCoordinates +open MvPowerSeries HondaConstruction HondaTarget LogarithmicConstruction PTypical +variable {A B C D : Type*} [CommRing A] [CommRing B] [CommRing C] [CommRing D] + +lemma logarithm_map [Algebra ℚ B] [Algebra ℚ D] + (ι : A →+* B) (κ : C →+* D) (α : A →+* C) (β : B →ₐ[ℚ] D) + (hi : β.toRingHom.comp ι = κ.comp α) (p : ℕ) (hp : 2 ≤ p) + (ψ : A →+* A) (χ : C →+* C) (hc : χ.comp α = α.comp ψ) (v : Fin 3 → A) : + (logarithm ι p ψ v).map β.toRingHom = logarithm κ p χ (α ∘ v) := by + ext j + rw [PowerSeries.coeff_map] + by_cases hj : ∃ n : ℕ, p^n = j + · obtain ⟨n, rfl⟩ := hj + simp only [logarithm, coeff_series_power p hp] + change β (((p : ℚ)⁻¹)^n • ι (numerator p ψ v n)) = _ + rw [β.map_smul_of_tower] + congr 1 + change (β.toRingHom.comp ι) _ = _ + rw [hi] + change κ (α _) = _ + rw [numerator_map α p ψ χ hc] + · simp only [logarithm, coeff_series_outside p j _ hj, map_zero] + +lemma heightThreeLog_map [Algebra ℚ B] [Algebra ℚ D] + (ι : A →+* B) (κ : C →+* D) (α : A →+* C) (β : B →ₐ[ℚ] D) + (hi : β.toRingHom.comp ι = κ.comp α) (p : ℕ) (hp : 2 ≤ p) + (ψ : A →+* A) (χ : C →+* C) (hc : χ.comp α = α.comp ψ) (v : Fin 3 → A) : + (heightThreeLog ι p hp ψ v).map β.toRingHom = heightThreeLog κ p hp χ (α ∘ v) := by + apply StrictLog.ext + exact logarithm_map ι κ α β hi p hp ψ χ hc v + +end HeightThree.HondaCoordinates + +end + +end OAI diff --git a/lean/OAI/Algebra/FormalGroup/Honda/Correction.lean b/lean/OAI/Algebra/FormalGroup/Honda/Correction.lean new file mode 100644 index 0000000000000000000000000000000000000000..23a6bbc9ee09a4ff895a306aaa4d7dd34043cf7c --- /dev/null +++ b/lean/OAI/Algebra/FormalGroup/Honda/Correction.lean @@ -0,0 +1,141 @@ +import OAI.Algebra.FormalGroup.Honda.Frobenius + +namespace OAI + +noncomputable section + +namespace HeightThree.HondaCorrection +open MvPowerSeries HeightThree.HondaJets HeightThree.HondaLeading +open HeightThree.HondaTarget HeightThree.HondaFrobenius HeightThree.HomogeneousCocycle +open HeightThree.CoordinateTransport HeightThree.DeformationRigidity +variable {K σ : Type*} [Field K] + +def stepSeries (n : ℕ) (a : K) : PowerSeries K := PowerSeries.X+PowerSeries.C a*PowerSeries.X^n + +lemma step_zero (n : ℕ) (hn : 0 exact c.inverse_const _ (by simp) + have hb := hasSubst_of_constantCoeff_zero hb0 + have ha : HasSubst ![c.series.subst (X 0 : MvPowerSeries (Fin 2) K),c.series.subst (X 1)] := + hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> exact c.series_const _ (by simp)) + have hh := h.subst_left b hb hb0 + rw [subst_after_mv _ _ (.of_constantCoeff_zero G.zero_constantCoeff) _ hb, + MvPowerSeries.subst_comp_subst_apply ha hb] at hh + have he : (fun i : Fin 2=> + (![c.series.subst (X 0 : MvPowerSeries (Fin 2) K),c.series.subst (X 1)] i).subst b)=X := by + funext i; fin_cases i + · change (c.series.subst (X 0 : MvPowerSeries (Fin 2) K)).subst b=X 0 + rw [subst_after_mv _ _ (PowerSeries.HasSubst.X _) _ hb,subst_X hb] + exact c.series_inverse _ (PowerSeries.HasSubst.X _) + · change (c.series.subst (X 1 : MvPowerSeries (Fin 2) K)).subst b=X 1 + rw [subst_after_mv _ _ (PowerSeries.HasSubst.X _) _ hb,subst_X hb] + exact c.series_inverse _ (PowerSeries.HasSubst.X _) + rw [he,subst_self] at hh + exact hh + +lemma step_improves (F G : FormalGroup K) (n : ℕ) (hn : 2≤n) + (h : EqJet n F.toPowerSeries G.toPowerSeries) (a : K) + (ha : leading F G n=a • coboundary n) : + EqJet (n+1) ((step n hn a).transport G).toPowerSeries F.toPowerSeries := by + apply pullback_step_jet + change EqJet _ ((stepSeries n a).subst G.toPowerSeries) + (F.toPowerSeries.subst ![(stepSeries n a).subst (X 0),(stepSeries n a).subst (X 1)]) + let b : Fin 2 → MvPowerSeries (Fin 2) K := ![(stepSeries n a).subst (X 0),(stepSeries n a).subst (X 1)] + have hb0 : ∀i,(b i).constantCoeff=0 := by + intro i; fin_cases i <;> exact (step n hn a).series_const _ (by simp) + have hbx : ∀i,EqJet n (b i) (X i) := by + intro i; fin_cases i <;> exact step_jet n a _ (by simp) + have hinner := law_first_order F n b X hb0 (by simp) hbx + rw [subst_self] at hinner + have hlin : EqJet 2 G.toPowerSeries (X 0+X 1) := by + simpa only [pair_subst_self] using pair_linear G (X 0 : MvPowerSeries (Fin 2) K) (X 1) (by simp) (by simp) + have hpow := (hlin.pow_leading G.zero_constantCoeff (by simp) n).mul_left (C a) + have hout := (EqJet.refl (n+1) G.toPowerSeries).add hpow + rw [←step_subst n a _ G.zero_constantCoeff] at hout + have hlead := leading_approx F G n h + rw [ha] at hlead + intro d hd + have hi := hinner d hd + have ho := hout d hd + have hl := hlead d hd + simp only [b,Matrix.cons_val_zero,Matrix.cons_val_one,step_subst n a _ (constantCoeff_X _), + add_sub_cancel_left,map_add,map_sub] at hi + simp only [coboundary,smul_eq_C_mul,mul_sub,map_sub] at hl + simp only [map_add] at ho + change coeff d ((stepSeries n a).subst G.toPowerSeries)=coeff d (F.toPowerSeries.subst b) + simp only [id_eq] at hi + simp only [b,step_subst n a _ (constantCoeff_X _)] + linear_combination ho-hi-hl + +end HeightThree.HondaCorrection + +namespace HeightThree.HondaCorrection +open MvPowerSeries HeightThree.HondaJets HeightThree.HondaLeading +open HeightThree.HondaTarget HeightThree.HondaFrobenius HeightThree.HomogeneousCocycle +open HeightThree.CoordinateTransport HeightThree.DeformationRigidity +variable {K : Type*} [Field K] + +lemma step_commutes (p : ℕ) [hp : Fact p.Prime] [CharP K p] + (h n : ℕ) (hn : 0f.subst c.inverse) hh + rw [PowerSeries.subst_comp_subst_apply c.hasSubst c.inv_hasSubst, + PowerSeries.subst_comp_subst_apply c.hasSubst c.inv_hasSubst,c.left_inv, + PowerSeries.X_subst,PowerSeries.X_subst] at hz + exact hz.symm + +end HeightThree.HondaCorrection + +end + +end OAI diff --git a/lean/OAI/Algebra/FormalGroup/Honda/Differential.lean b/lean/OAI/Algebra/FormalGroup/Honda/Differential.lean new file mode 100644 index 0000000000000000000000000000000000000000..705c4fde2a839cc36b65727188bb275f4c9ecd9c --- /dev/null +++ b/lean/OAI/Algebra/FormalGroup/Honda/Differential.lean @@ -0,0 +1,76 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace HeightThree.PowerSeriesDifferential +open MvPowerSeries +variable {R σ : Type*} [CommRing R] + +lemma coeff_pow_zero_of_degree_lt (a : MvPowerSeries σ R) (ha : a.constantCoeff = 0) + (d : σ →₀ ℕ) (n : ℕ) (hn : d.degree < n) : coeff d (a^n) = 0 := by + apply coeff_of_lt_order + exact lt_of_lt_of_le (by exact_mod_cast hn) (le_order_pow_of_constantCoeff_eq_zero n ha) + +lemma coeff_subst_eq_of_coeff_le (f g : PowerSeries R) (a : MvPowerSeries σ R) + (ha : a.constantCoeff = 0) (d : σ →₀ ℕ) + (h : ∀ n ≤ d.degree, f.coeff n = g.coeff n) : + coeff d (f.subst a) = coeff d (g.subst a) := by + rw [PowerSeries.coeff_subst (PowerSeries.HasSubst.of_constantCoeff_zero ha), + PowerSeries.coeff_subst (PowerSeries.HasSubst.of_constantCoeff_zero ha)] + apply finsum_congr + intro n + by_cases hn : n ≤ d.degree + · rw [h n hn] + · rw [coeff_pow_zero_of_degree_lt a ha d n (by omega), smul_zero, smul_zero] + +lemma pderiv_subst_coe (f : Polynomial R) (a : MvPowerSeries σ R) + (ha : PowerSeries.HasSubst a) (i : σ) : + pderiv i ((f : PowerSeries R).subst a) = + ((PowerSeries.derivative (f : PowerSeries R)).subst a) * pderiv i a := by + simp [PowerSeries.subst_coe ha, PowerSeries.derivative_coe, + Derivation.comp_aeval_eq (a := a) (pderiv i) f, smul_eq_mul] + +lemma pderiv_subst (f : PowerSeries R) (a : MvPowerSeries σ R) + (ha : a.constantCoeff = 0) (i : σ) : + pderiv i (f.subst a) = (PowerSeries.derivative f).subst a * pderiv i a := by + classical + ext d + let N := d.degree + 2 + let g : Polynomial R := PowerSeries.trunc N f + have he (e : σ →₀ ℕ) (he : e.degree < N) : + coeff e (f.subst a) = coeff e ((g : PowerSeries R).subst a) := by + apply coeff_subst_eq_of_coeff_le _ _ _ ha + intro n hn + exact (PowerSeries.coeff_coe_trunc_of_lt (by omega : n < N)).symm + have he' (e : σ →₀ ℕ) (he : e.degree ≤ d.degree) : + coeff e ((PowerSeries.derivative f).subst a) = + coeff e ((PowerSeries.derivative (g : PowerSeries R)).subst a) := by + apply coeff_subst_eq_of_coeff_le _ _ _ ha + intro n hn + rw [PowerSeries.coeff_derivative, PowerSeries.coeff_derivative] + congr 1 + exact (PowerSeries.coeff_coe_trunc_of_lt (by omega : n+1 < N)).symm + rw [coeff_pderiv, he _ (by simp [N, map_add, Finsupp.degree_single]), + ← coeff_pderiv, pderiv_subst_coe g a (PowerSeries.HasSubst.of_constantCoeff_zero ha), + coeff_mul, coeff_mul] + apply Finset.sum_congr rfl + intro ef hef + rw [he' ef.1] + have heq := Finset.HasAntidiagonal.mem_antidiagonal.mp hef + have := congrArg Finsupp.degree heq + rw [map_add] at this + omega + +lemma pderiv_map {S : Type*} [CommRing S] (ρ : R →+* S) + (f : MvPowerSeries σ R) (i : σ) : + pderiv i (f.map ρ) = (pderiv i f).map ρ := by + ext d + simp only [coeff_pderiv, coeff_map, map_mul, map_add, map_natCast, map_one] + +end HeightThree.PowerSeriesDifferential + +end + +end OAI diff --git a/lean/OAI/Algebra/FormalGroup/Honda/Evaluation.lean b/lean/OAI/Algebra/FormalGroup/Honda/Evaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..b894d1711af3376a57c1f41ab12e8bb15e02178b --- /dev/null +++ b/lean/OAI/Algebra/FormalGroup/Honda/Evaluation.lean @@ -0,0 +1,257 @@ +import OAI.Algebra.FormalGroup.Honda.ArtinianRigidity + +namespace OAI + +noncomputable section + +namespace HeightThree.NilpotentEvaluation +open MvPowerSeries +variable {K R S : Type*} [CommRing K] [CommRing R] [CommRing S] + +def constantHom [Algebra K R] : PowerSeries R →ₐ[K] R where + __ := (MvPowerSeries.constantCoeff : PowerSeries R →+* R) + commutes' r := by simp [MvPowerSeries.algebraMap_apply] + +lemma constantsHasSubst (a : Fin 2 → R) (h : ∀ i, IsNilpotent (a i)) : + HasSubst (fun i => (C (a i) : PowerSeries R)) := + hasSubst_of_constantCoeff_nilpotent (fun i => by simpa only [constantCoeff_C] using h i) + +def eval [Algebra K R] (a : Fin 2 → R) (h : ∀ i, IsNilpotent (a i)) : + MvPowerSeries (Fin 2) K →ₐ[K] R := + constantHom.comp (substAlgHom (constantsHasSubst a h)) + +@[simp] lemma eval_X [Algebra K R] (a : Fin 2 → R) (h : ∀ i, IsNilpotent (a i)) (i : Fin 2) : + eval (K := K) a h (X i) = a i := by + change constantCoeff (substAlgHom (constantsHasSubst a h) (X i)) = a i + rw [substAlgHom_X,constantCoeff_C] + +@[simp] lemma eval_C [Algebra K R] (a : Fin 2 → R) (h : ∀ i, IsNilpotent (a i)) (c : K) : + eval a h (C c) = algebraMap K R c := by + change eval a h (algebraMap K (MvPowerSeries (Fin 2) K) c) = _ + exact AlgHom.commutes _ c + +lemma degree_two (d : Fin 2 →₀ ℕ) : d.degree = d 0+d 1 := by + classical + change d.sum (fun _ n => n) = _ + rw [Finsupp.sum_fintype] + · exact Fin.sum_univ_two _ + · simp + +lemma tail_rect (f : MvPowerSeries (Fin 2) K) (N : ℕ) : + ∃ g h : MvPowerSeries (Fin 2) K, + f-(↑(f.truncTotal (2*N)) : MvPowerSeries (Fin 2) K) = X 0^N*g+X 1^N*h := by + classical + let t := f-(↑(f.truncTotal (2*N)) : MvPowerSeries (Fin 2) K) + let t₀ : MvPowerSeries (Fin 2) K := fun d => if N ≤ d 0 then coeff d t else 0 + let t₁ := t-t₀ + have h₀ : X 0^N ∣ t₀ := by + apply X_pow_dvd_iff.mpr + intro d hd + change (if N ≤ d 0 then coeff d t else 0) = 0 + simp [not_le.mpr hd] + have h₁ : X 1^N ∣ t₁ := by + apply X_pow_dvd_iff.mpr + intro d hd + change coeff d t-(if N ≤ d 0 then coeff d t else 0) = 0 + by_cases hN : N ≤ d 0 + · simp [hN] + · have ht : d.degree < 2*N := by rw [degree_two]; omega + simp only [ite_eq_right hN,t,map_sub,MvPolynomial.coeff_coe,coeff_truncTotal _ ht,sub_self] + obtain ⟨g,hg⟩ := h₀ + obtain ⟨h,hh⟩ := h₁ + refine ⟨g,h,?_⟩ + rw [←hg,←hh] + dsimp [t₁,t] + ring + +lemma hom_apply_eq_trunc [Algebra K R] (φ : MvPowerSeries (Fin 2) K →ₐ[K] R) + (N : ℕ) (hN : ∀ i : Fin 2, φ (X i)^N = 0) (f : MvPowerSeries (Fin 2) K) : + φ f = φ (↑(f.truncTotal (2*N)) : MvPowerSeries (Fin 2) K) := by + obtain ⟨g,h,he⟩ := tail_rect f N + have hh := congrArg φ he + simp only [map_sub,map_add,map_mul,map_pow,hN,zero_mul,add_zero] at hh + exact sub_eq_zero.mp hh + +lemma hom_ext_nilpotent [Algebra K R] (φ ψ : MvPowerSeries (Fin 2) K →ₐ[K] R) + (hφ : ∀ i : Fin 2, IsNilpotent (φ (X i))) (he : ∀ i : Fin 2, φ (X i)=ψ (X i)) : φ=ψ := by + obtain ⟨a,ha⟩ := hφ 0 + obtain ⟨b,hb⟩ := hφ 1 + let N := max a b + have hN : ∀ i : Fin 2, φ (X i)^N=0 := by + intro i; fin_cases i + · exact pow_eq_zero_of_le (le_max_left _ _) ha + · exact pow_eq_zero_of_le (le_max_right _ _) hb + have hN' : ∀ i : Fin 2, ψ (X i)^N=0 := by simpa only [he] using hN + have hpoly : ∀ f : MvPolynomial (Fin 2) K, + φ (f : MvPowerSeries (Fin 2) K) = ψ (f : MvPowerSeries (Fin 2) K) := by + intro f + induction f using MvPolynomial.induction_on with + | C c => simpa only [MvPolynomial.coe_C,MvPowerSeries.c_eq_algebraMap] using + (φ.commutes c).trans (ψ.commutes c).symm + | add f g hf hg => simp only [MvPolynomial.coe_add,map_add,hf,hg] + | mul_X f i hf => simp only [MvPolynomial.coe_mul,MvPolynomial.coe_X,map_mul,hf,he] + ext f + rw [hom_apply_eq_trunc φ N hN f, hom_apply_eq_trunc ψ N hN' f] + exact hpoly _ + +lemma eval_natural [Algebra K R] [Algebra K S] (π : R →ₐ[K] S) + (a : Fin 2 → R) (h : ∀ i, IsNilpotent (a i)) : + π.comp (eval a h) = eval (fun i => π (a i)) (fun i => (h i).map π.toRingHom) := by + apply hom_ext_nilpotent + · intro i; simpa using (h i).map π.toRingHom + · intro i; simp + +lemma eval_zero [Algebra K R] (h : ∀ _ : Fin 2, IsNilpotent (0 : R)) (f : MvPowerSeries (Fin 2) K) : + eval (fun _ => (0 : R)) h f = algebraMap K R (constantCoeff f) := by + let ψ : MvPowerSeries (Fin 2) K →ₐ[K] R := + { __ := (algebraMap K R).comp constantCoeff + commutes' := by intro r; simp [MvPowerSeries.algebraMap_apply] } + have he : eval (fun _ => (0 : R)) h = ψ := by + apply hom_ext_nilpotent + · intro i; simp + · intro i; simp [ψ] + exact congrArg (fun φ : MvPowerSeries (Fin 2) K →ₐ[K] R => φ f) he + +lemma linear_coeff_mul_X (f : MvPowerSeries (Fin 2) K) (i j : Fin 2) : + coeff (Finsupp.single j 1) (f * X i) = if i=j then constantCoeff f else 0 := by + classical + by_cases hij : i=j + · subst j; simp [X,coeff_mul_monomial] + · have hn : ¬Finsupp.single i 1 ≤ (Finsupp.single j 1 : Fin 2 →₀ ℕ) := by + intro h + have hi := h i + simp [hij] at hi + simp [X,coeff_mul_monomial,hn,hij] + +theorem hom_difference_small [Algebra K R] (π : R →+* S) (ρ : R →ₐ[K] K) + (ann : ∀ a b, π a=0 → ρ b=0 → a*b=0) + (φ ψ : MvPowerSeries (Fin 2) K →ₐ[K] R) + (hπ : ∀ f, π (φ f)=π (ψ f)) + (hφ : ∀ f, ρ (φ f)=constantCoeff f) + (hψ : ∀ f, ρ (ψ f)=constantCoeff f) + (hnil : ∀ i : Fin 2, IsNilpotent (φ (X i))) + (f : MvPowerSeries (Fin 2) K) : + φ f-ψ f = (φ (X 0)-ψ (X 0))*algebraMap K R (coeff (Finsupp.single 0 1) f) + + (φ (X 1)-ψ (X 1))*algebraMap K R (coeff (Finsupp.single 1 1) f) := by + classical + have poly : ∀ f : MvPolynomial (Fin 2) K, + φ (f : MvPowerSeries (Fin 2) K)-ψ (f : MvPowerSeries (Fin 2) K) = + (φ (X 0)-ψ (X 0))*algebraMap K R (coeff (Finsupp.single 0 1) (f : MvPowerSeries (Fin 2) K)) + + (φ (X 1)-ψ (X 1))*algebraMap K R (coeff (Finsupp.single 1 1) (f : MvPowerSeries (Fin 2) K)) := by + intro f + induction f using MvPolynomial.induction_on with + | C c => + simp only [MvPolynomial.coe_C] + rw [show φ (C c)=algebraMap K R c from φ.commutes c, + show ψ (C c)=algebraMap K R c from ψ.commutes c] + simp [coeff_C] + | add f g hf hg => + simp only [MvPolynomial.coe_add,map_add] at * + linear_combination hf+hg + | mul_X f i hf => + let F : MvPowerSeries (Fin 2) K := f + have hz₁ : (φ F-ψ F)*φ (X i)=0 := + ann _ _ (by simp only [map_sub,hπ,sub_self]) (by rw [hφ,constantCoeff_X]) + have hz₂ : (φ (X i)-ψ (X i))*(ψ F-algebraMap K R (constantCoeff F))=0 := + ann _ _ (by simp only [map_sub,hπ,sub_self]) (by simp [hψ]) + have he : φ (F*X i)-ψ (F*X i) = + (φ (X i)-ψ (X i))*algebraMap K R (constantCoeff F) := by + simp only [map_mul] + linear_combination hz₁+hz₂ + simp only [MvPolynomial.coe_mul,MvPolynomial.coe_X] + change φ (F*X i)-ψ (F*X i) = _ + rw [he] + change _ = (φ (X 0)-ψ (X 0))*algebraMap K R (coeff (Finsupp.single 0 1) (F*X i)) + + (φ (X 1)-ψ (X 1))*algebraMap K R (coeff (Finsupp.single 1 1) (F*X i)) + rw [linear_coeff_mul_X,linear_coeff_mul_X] + fin_cases i <;> simp + + have hnil' : ∀ i : Fin 2, IsNilpotent (ψ (X i)) := by + intro i + have hd : π (φ (X i)-ψ (X i))=0 := by simp only [map_sub,hπ,sub_self] + have hz : (φ (X i)-ψ (X i))^2=0 := by + rw [pow_two]; exact ann _ _ hd (by rw [map_sub,hφ,hψ,sub_self]) + have hh := (Commute.all _ _).isNilpotent_sub (hnil i) (show IsNilpotent (φ (X i)-ψ (X i)) from ⟨2,hz⟩) + simpa only [sub_sub_cancel] using hh + obtain ⟨a,ha⟩ := hnil 0 + obtain ⟨b,hb⟩ := hnil 1 + obtain ⟨c,hc⟩ := hnil' 0 + obtain ⟨d,hd⟩ := hnil' 1 + let N := max (max a b) (max c d)+1 + have hN : ∀ i : Fin 2, φ (X i)^N=0 := by + intro i; fin_cases i + · exact pow_eq_zero_of_le (by dsimp [N]; omega) ha + · exact pow_eq_zero_of_le (by dsimp [N]; omega) hb + have hN' : ∀ i : Fin 2, ψ (X i)^N=0 := by + intro i; fin_cases i + · exact pow_eq_zero_of_le (by dsimp [N]; omega) hc + · exact pow_eq_zero_of_le (by dsimp [N]; omega) hd + rw [hom_apply_eq_trunc φ N hN f,hom_apply_eq_trunc ψ N hN' f,poly] + simp only [MvPolynomial.coeff_coe,coeff_truncTotal _ (show (Finsupp.single (0 : Fin 2) 1).degree < 2*N by simp; dsimp [N]; omega), + coeff_truncTotal _ (show (Finsupp.single (1 : Fin 2) 1).degree < 2*N by simp; dsimp [N]; omega)] + +lemma eval_augmentation [Algebra K R] (ρ : R →ₐ[K] K) + (a : Fin 2 → R) (h : ∀ i, IsNilpotent (a i)) (ha : ∀ i, ρ (a i)=0) + (f : MvPowerSeries (Fin 2) K) : ρ (eval a h f)=constantCoeff f := by + let ε : MvPowerSeries (Fin 2) K →ₐ[K] K := + { __ := constantCoeff + commutes' := by intro r; simp [MvPowerSeries.algebraMap_apply] } + have he : ρ.comp (eval a h)=ε := by + apply hom_ext_nilpotent + · intro i; simpa using (h i).map ρ.toRingHom + · intro i; simp [ε,ha] + exact congrArg (fun φ : MvPowerSeries (Fin 2) K →ₐ[K] K => φ f) he + +theorem correct_parameters [Algebra K R] [Algebra K S] + (π : R →ₐ[K] S) (ρ : R →ₐ[K] K) + (kle : ∀ a, π a=0 → ρ a=0) + (ann : ∀ a b, π a=0 → ρ b=0 → a*b=0) + (φ : MvPowerSeries (Fin 2) K →ₐ[K] R) + (hφ : ∀ f, ρ (φ f)=constantCoeff f) + (hnil : ∀ i : Fin 2, IsNilpotent (φ (X i))) + (c g : MvPowerSeries (Fin 2) K) (hc : c=X 1+X 0*g) + (b₀ b₁ : R) (hb₀ : π b₀=π (φ (X 0))) (hb₁ : π b₁=π (φ c)) : + ∃ ψ : MvPowerSeries (Fin 2) K →ₐ[K] R, + π.comp ψ=π.comp φ ∧ (∀ f, ρ (ψ f)=constantCoeff f) ∧ ψ (X 0)=b₀ ∧ ψ c=b₁ := by + let d₀ := b₀-φ (X 0) + let d₁ := b₁-φ c-d₀*algebraMap K R (constantCoeff g) + have hd₀ : π d₀=0 := by simp [d₀,hb₀] + have hd₁ : π d₁=0 := by simp [d₁,hb₁,hd₀] + have hdnil₀ : IsNilpotent d₀ := ⟨2,by rw [pow_two]; exact ann _ _ hd₀ (kle _ hd₀)⟩ + have hdnil₁ : IsNilpotent d₁ := ⟨2,by rw [pow_two]; exact ann _ _ hd₁ (kle _ hd₁)⟩ + let a : Fin 2 → R := ![φ (X 0)+d₀,φ (X 1)+d₁] + have hanil : ∀ i, IsNilpotent (a i) := by + intro i; fin_cases i + · exact (Commute.all _ _).isNilpotent_add (hnil 0) hdnil₀ + · exact (Commute.all _ _).isNilpotent_add (hnil 1) hdnil₁ + let ψ : MvPowerSeries (Fin 2) K →ₐ[K] R := eval a hanil + have hψπ : π.comp ψ=π.comp φ := by + apply hom_ext_nilpotent + · intro i; simpa [ψ] using (hanil i).map π.toRingHom + · intro i; fin_cases i <;> simp [ψ,a,hd₀,hd₁] + have hψρ : ∀ f, ρ (ψ f)=constantCoeff f := by + apply eval_augmentation ρ a hanil + intro i; fin_cases i <;> simp [a,hφ,kle _ hd₀,kle _ hd₁] + have hlin₀ : coeff (Finsupp.single 0 1) c=constantCoeff g := by + rw [hc,mul_comm (X 0) g,map_add,linear_coeff_mul_X] + simp [coeff_index_single_X] + have hlin₁ : coeff (Finsupp.single 1 1) c=1 := by + rw [hc,mul_comm (X 0) g,map_add,linear_coeff_mul_X] + simp + have he := hom_difference_small π.toRingHom ρ ann ψ φ + (fun f => congrArg (fun η : MvPowerSeries (Fin 2) K →ₐ[K] S => η f) hψπ) + hψρ hφ (by intro i; simpa [ψ] using hanil i) c + rw [hlin₀,hlin₁,map_one,mul_one] at he + have hx₀ : ψ (X 0)-φ (X 0)=d₀ := by simp [ψ,a] + have hx₁ : ψ (X 1)-φ (X 1)=d₁ := by simp [ψ,a] + rw [hx₀,hx₁] at he + refine ⟨ψ,hψπ,hψρ,?_,?_⟩ + · simp [ψ,a,d₀] + · dsimp [d₁] at he + linear_combination he + +end HeightThree.NilpotentEvaluation + +end + +end OAI diff --git a/lean/OAI/Algebra/FormalGroup/Honda/Frobenius.lean b/lean/OAI/Algebra/FormalGroup/Honda/Frobenius.lean new file mode 100644 index 0000000000000000000000000000000000000000..ee132366d231333d3c24d14134eff39d6830703e --- /dev/null +++ b/lean/OAI/Algebra/FormalGroup/Honda/Frobenius.lean @@ -0,0 +1,112 @@ +import OAI.Algebra.FormalGroup.Honda.Leading + +namespace OAI + +noncomputable section + +namespace HeightThree.HondaFrobenius +open MvPowerSeries HeightThree.HondaLeading HeightThree.HondaTarget +open HeightThree.HondaJets HeightThree.HomogeneousCocycle +variable {K σ : Type*} [Field K] + +lemma law_pair_subst (F : FormalGroup K) (a b : PowerSeries K) (c : MvPowerSeries σ K) + (ha : a.constantCoeff=0) (hb : b.constantCoeff=0) (hc : PowerSeries.HasSubst c) : + PowerSeries.subst c (pair F a b) = pair F (a.subst c) (b.subst c) := by + have hab : MvPowerSeries.HasSubst ![a,b] := + hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> assumption) + change (F.toPowerSeries.subst ![a,b]).subst (fun _ : Unit => c) = _ + rw [MvPowerSeries.subst_comp_subst_apply hab hc.const] + congr 1 + funext i; fin_cases i <;> rfl + +lemma point_multiplication (F : FormalGroup K) (a : F.Point σ) (ha : a.val.constantCoeff=0) (n : ℕ) : + (n • a).val = (multiplicationSeries F n).subst a.val := by + induction n with + | zero => + change 0=PowerSeries.subst a.val 0 + rw [←PowerSeries.coe_substAlgHom (PowerSeries.HasSubst.of_constantCoeff_zero ha),map_zero] + | succ n ih => + rw [succ_nsmul,FormalGroup.add_apply,ih,multiplication_succ, + law_pair_subst F _ _ _ (multiplication_constant F n) PowerSeries.constantCoeff_X a.prop, + PowerSeries.subst_X a.prop] + +lemma multiplication_add (F : FormalGroup K) [F.IsComm] (n : ℕ) : + (multiplicationSeries F n).subst F.toPowerSeries = + F.toPowerSeries.subst ![(multiplicationSeries F n).subst (X 0), + (multiplicationSeries F n).subst (X 1)] := by + let a : F.Point (Fin 2) := ⟨X 0,PowerSeries.HasSubst.X 0⟩ + let b : F.Point (Fin 2) := ⟨X 1,PowerSeries.HasSubst.X 1⟩ + have ha : a.val.constantCoeff=0 := by simp [a] + have hb : b.val.constantCoeff=0 := by simp [b] + have he : (a+b).val=F.toPowerSeries := by + change F.toPowerSeries.subst ![X 0,X 1]=_ + exact pair_subst_self _ + have hh := congrArg Subtype.val (nsmul_add a b n) + rw [point_multiplication F (a+b) (pair_const F _ _ ha hb) n,he] at hh + rw [FormalGroup.add_apply,point_multiplication F a ha n,point_multiplication F b hb n] at hh + exact hh + +lemma Xpow_subst (q : ℕ) (a : MvPowerSeries σ K) (ha : a.constantCoeff=0) : + (PowerSeries.X^q : PowerSeries K).subst a=a^q := by + rw [PowerSeries.subst_pow (.of_constantCoeff_zero ha), + PowerSeries.subst_X (.of_constantCoeff_zero ha)] + +lemma honda_expand (p q : ℕ) (hq : q≠0) (F : FormalGroup K) [F.IsComm] + (hF : multiplicationSeries F p=PowerSeries.X^q) : + F.toPowerSeries^q=F.toPowerSeries.expand q hq := by + have hh := multiplication_add F p + rw [hF,Xpow_subst q _ F.zero_constantCoeff,Xpow_subst q _ (constantCoeff_X 0), + Xpow_subst q _ (constantCoeff_X 1)] at hh + rw [MvPowerSeries.expand,MvPowerSeries.coe_substAlgHom] + convert hh using 2 + funext i; fin_cases i <;> rfl + +theorem honda_coefficients_fixed (p : ℕ) [hp : Fact p.Prime] [CharP K p] + (h : ℕ) (F : FormalGroup K) [F.IsComm] + (hF : multiplicationSeries F p=PowerSeries.X^(p^h)) : + F.toPowerSeries.map (iterateFrobenius K p h)=F.toPowerSeries := by + have hq : p^h≠0 := pow_ne_zero _ hp.out.ne_zero + apply expand_injective (p^h) hq + rw [←map_expand,MvPowerSeries.map_iterateFrobenius_expand p hp.out.ne_zero] + exact honda_expand p (p^h) hq F hF + +lemma map_leading (F G : FormalGroup K) (n : ℕ) (φ : K →+* K) + (hF : F.toPowerSeries.map φ=F.toPowerSeries) (hG : G.toPowerSeries.map φ=G.toPowerSeries) : + (leading F G n).map φ=leading F G n := by + have he : (F.toPowerSeries-G.toPowerSeries).map φ=F.toPowerSeries-G.toPowerSeries := by + rw [map_sub,hF,hG] + ext d + rw [coeff_map,coeff_homogeneousComponent] + split_ifs with hd + · exact congrArg (coeff d) he + · exact map_zero _ + +lemma coboundary_fixed (n : ℕ) (φ : K →+* K) : + (coboundary (K:=K) n).map φ=coboundary n := by + simp [coboundary] + +lemma fixed_coboundary_scalar (p : ℕ) [hp : Fact p.Prime] [CharP K p] + (D : MvPowerSeries (Fin 2) K) (n : ℕ) (hn : 0u) + (PowerSeries.HasSubst.of_constantCoeff_zero hu0).const (fun _=>hu0) + change EqJet (n+1) (P.subst u) ((PowerSeries.C (P.coeff n)*PowerSeries.X^n).subst u) at hs + rw [PowerSeries.subst_mul (.of_constantCoeff_zero hu0), + PowerSeries.subst_C, + PowerSeries.subst_pow (.of_constantCoeff_zero hu0), + PowerSeries.subst_X (.of_constantCoeff_zero hu0)] at hs + have hp := (strict_jet u hu0 hu1).pow_leading hu0 (by simp [PowerSeries.X]) n + have hh := hp.mul_left (PowerSeries.C (P.coeff n)) + exact (hs.trans hh).trans hlead.symm + +lemma strict_outer_leading (P u : PowerSeries R) (n : ℕ) + (hP : EqJet n P 0) (hP0 : P.constantCoeff=0) + (hu0 : u.constantCoeff=0) (hu1 : u.coeff 1=1) : + EqJet (n+1) (u.subst P) P := by + have hh := subst_first_order u n (fun _ : Unit=>P) (fun _ : Unit=>(0 : PowerSeries R)) + (fun _=>hP0) (by simp) (fun _=>hP) + have hzero : u.subst (0 : PowerSeries R)=0 := by + exact PowerSeries.subst_zero_of_constantCoeff_zero hu0 + change EqJet (n+1) (u.subst P-u.subst (0 : PowerSeries R)) + (∑i : Unit, C (coeff (Finsupp.single i 1) u)*(P-0)) at hh + simpa only [hzero,sub_zero,Fintype.sum_unique,show coeff (Finsupp.single () 1) u=1 from hu1, + map_one,one_mul] using hh + +lemma multiplication_transport (c : Coordinate R) (F : FormalGroup R) (n : ℕ) : + multiplicationSeries (c.transport F) n= + c.series.subst ((multiplicationSeries F n).subst c.inverse) := by + have hh := coordinate_multiplication F (c.transport F) (c.iso F) n + change c.series.subst (multiplicationSeries F n)= + (multiplicationSeries (c.transport F) n).subst c.series at hh + have hh' := congrArg (fun z : PowerSeries R=>z.subst c.inverse) hh + rw [PowerSeries.subst_comp_subst_apply (.of_constantCoeff_zero (multiplication_constant F n)) c.inv_hasSubst, + PowerSeries.subst_comp_subst_apply c.hasSubst c.inv_hasSubst,c.left_inv, + PowerSeries.X_subst] at hh' + exact hh'.symm + +lemma conjugate_leading (c : Coordinate R) (hc : c.series.coeff 1=1) + (P : PowerSeries R) (n : ℕ) (hP0 : P.constantCoeff=0) (hP : EqJet n P 0) : + EqJet (n+1) (c.series.subst (P.subst c.inverse)) P := by + have he := strict_subst_leading P c.inverse n hP c.zero_inverse (strict_inverse c hc) + have hz : (P.subst c.inverse).constantCoeff=0 := + PowerSeries.constantCoeff_subst_eq_zero c.zero_inverse P hP0 + have hh := strict_outer_leading (P.subst c.inverse) c.series n + ((he.mono (by omega)).trans hP) hz c.zero_series hc + exact hh.trans he + +end HeightThree.HeightTransport + +namespace HeightThree.HeightTransport +open MvPowerSeries HeightThree.HondaTarget HeightThree.CoordinateTransport +open HeightThree.HondaJets HeightThree.DeformationRigidity +variable {R S : Type*} [CommRing R] [CommRing S] + +lemma jet_zero_of_coeff (P : PowerSeries R) (n : ℕ) (hP : ∀j if d 0 = 0 then coeff d f else 0 + +@[simp] lemma coeff_killFirstFun (f : MvPowerSeries (Fin 2) R) (d : Fin 2 →₀ ℕ) : + coeff d (killFirstFun f) = if d 0 = 0 then coeff d f else 0 := rfl + +def killFirst : MvPowerSeries (Fin 2) R →ₐ[R] MvPowerSeries (Fin 2) R where + toFun := killFirstFun + map_one' := by + ext d + change (if d 0 = 0 then coeff d (1 : MvPowerSeries (Fin 2) R) else 0) = _ + by_cases h : d 0 = 0 + · simp [h] + · have hd : d ≠ 0 := by intro he; simp [he] at h + simp [h, hd, coeff_one] + map_mul' f g := by + let : DecidableEq (Fin 2) := Classical.decEq _ + ext d + change (if d 0 = 0 then coeff d (f*g) else 0) = _ + rw [coeff_mul] + by_cases hd : d 0 = 0 + · rw [ite_eq_left hd, coeff_mul] + apply Finset.sum_congr rfl + rintro ⟨a,b⟩ hab + have hab' := congrArg (fun x : Fin 2 →₀ ℕ => x 0) (Finset.HasAntidiagonal.mem_antidiagonal.mp hab) + have ha : a 0 = 0 := by simp only [Finsupp.add_apply] at hab'; omega + have hb : b 0 = 0 := by simp only [Finsupp.add_apply] at hab'; omega + simp only [coeff_killFirstFun, ha, hb, ite_true] + · rw [ite_eq_right hd] + symm + apply Finset.sum_eq_zero + rintro ⟨a,b⟩ hab + have hab' := congrArg (fun x : Fin 2 →₀ ℕ => x 0) (Finset.HasAntidiagonal.mem_antidiagonal.mp hab) + change (if a 0 = 0 then coeff a f else 0) * + (if b 0 = 0 then coeff b g else 0) = 0 + by_cases ha : a 0 = 0 + · have hb : b 0 ≠ 0 := by simp only [Finsupp.add_apply] at hab'; omega + simp [hb] + · simp [ha] + map_zero' := by ext d; simp + map_add' f g := by + ext d + change (if d 0 = 0 then coeff d (f+g) else 0) = _ + rw [map_add] + by_cases h : d 0 = 0 <;> simp [h] + commutes' r := by + ext d + change (if d 0 = 0 then coeff d (C r : MvPowerSeries (Fin 2) R) else 0) = coeff d (C r) + by_cases h : d 0 = 0 + · simp [h] + · have hd : d ≠ 0 := by intro he; simp [he] at h + simp [h, hd, coeff_C] + +@[simp] lemma coeff_killFirst (f : MvPowerSeries (Fin 2) R) (d : Fin 2 →₀ ℕ) : + coeff d (killFirst f) = if d 0 = 0 then coeff d f else 0 := rfl + +@[simp] lemma killFirst_X_zero : killFirst (X 0 : MvPowerSeries (Fin 2) R) = 0 := by + ext d + rw [coeff_killFirst] + by_cases h : d 0 = 0 + · have hd : d ≠ Finsupp.single 0 1 := by intro he; simp [he] at h + simp [h, coeff_X, hd] + · simp [h] + +@[simp] lemma killFirst_X_one : killFirst (X 1 : MvPowerSeries (Fin 2) R) = X 1 := by + ext d + rw [coeff_killFirst] + by_cases h : d 0 = 0 + · simp [h] + · have hd : d ≠ Finsupp.single 1 1 := by intro he; simp [he] at h + simp [h, coeff_X, hd] + +lemma killFirst_eq_zero_iff (f : MvPowerSeries (Fin 2) R) : + killFirst f = 0 ↔ f ∈ Ideal.span ({X 0} : Set (MvPowerSeries (Fin 2) R)) := by + rw [Ideal.mem_span_singleton, X_dvd_iff] + constructor + · intro h d hd + have hc := congrArg (coeff d) h + simpa [hd] using hc + · intro h + ext d + by_cases hd : d 0 = 0 <;> simp [hd, h] + +lemma map_killFirst (φ : R →+* S) (f : MvPowerSeries (Fin 2) R) : + (killFirst f).map φ = killFirst (f.map φ) := by + ext d + simp only [coeff_map, coeff_killFirst] + split_ifs <;> simp + +lemma expand_killFirst (p : ℕ) (hp : p ≠ 0) (f : MvPowerSeries (Fin 2) R) : + expand p hp (killFirst f) = killFirst (expand p hp f) := by + ext d + by_cases hd : ∃ e : Fin 2 →₀ ℕ, p • e = d + · obtain ⟨e, rfl⟩ := hd + rw [coeff_expand_smul, coeff_killFirst, coeff_killFirst, coeff_expand_smul] + congr 1 + simp [Finsupp.smul_apply, smul_eq_mul, hp] + · have hz (g : MvPowerSeries (Fin 2) R) : coeff d (expand p hp g) = 0 := by + by_contra h + have hh := support_expand_subset p hp g h + exact hd ⟨hh.choose, hh.choose_spec.2⟩ + rw [hz, coeff_killFirst, hz] + split_ifs <;> rfl + +end HeightThree.HondaCoordinates + +namespace HeightThree.HondaCoordinates +open MvPowerSeries HondaConstruction HondaTarget LogarithmicConstruction PTypical +variable {A B C D : Type*} [CommRing A] [CommRing B] [CommRing C] [CommRing D] + +lemma formalGroup_map_map (F : FormalGroup A) (α : A →+* B) (β : B →+* C) : + (F.map α).map β = F.map (β.comp α) := by + apply FormalGroup.ext + rfl + +lemma formalGroup_map_injective (α : A →+* B) (hα : Function.Injective α) : + Function.Injective (FormalGroup.map · α) := by + intro F G h + apply FormalGroup.ext + apply map_injective α hα + exact congrArg FormalGroup.toPowerSeries h + +lemma integralFormalGroup_natural [Algebra ℚ B] [Algebra ℚ D] + (ι : A →+* B) (hι : Function.Injective ι) (κ : C →+* D) (hκ : Function.Injective κ) + (α : A →+* C) (β : B →ₐ[ℚ] D) (hi : β.toRingHom.comp ι = κ.comp α) + (p : ℕ) [hp : Fact p.Prime] + (ψ : A →+* A) (χ : B →ₐ[ℚ] B) (hc : χ.toRingHom.comp ι = ι.comp ψ) + (hψ : ∀ a : A, (p : A) ∣ ψ a - a^p) + (ψ' : C →+* C) (χ' : D →ₐ[ℚ] D) (hc' : χ'.toRingHom.comp κ = κ.comp ψ') + (hψ' : ∀ a : C, (p : C) ∣ ψ' a - a^p) + (hα : ψ'.comp α = α.comp ψ) (v : Fin 3 → A) : + (integralFormalGroup ι hι p ψ χ hc hψ v).map α = + integralFormalGroup κ hκ p ψ' χ' hc' hψ' (α ∘ v) := by + apply formalGroup_map_injective κ hκ + dsimp only + rw [formalGroup_map_map, ← hi, ← formalGroup_map_map, integralFormalGroup_map, + integralFormalGroup_map, StrictLog.formalGroup_map, + heightThreeLog_map ι κ α β hi p hp.out.two_le ψ ψ' hα v] + +lemma killFirst_inclusion : + (killFirst (R := ℚ)).toRingHom.comp coefficientInclusion = + coefficientInclusion.comp (killFirst (R := ℤ)).toRingHom := by + ext f d + exact congrArg (coeff d) (map_killFirst (Int.castRingHom ℚ) f).symm + +lemma killFirst_commute_integralFrobenius (p : ℕ) (hp : p ≠ 0) : + (integralFrobenius p hp).comp (killFirst (R := ℤ)).toRingHom = + (killFirst (R := ℤ)).toRingHom.comp (integralFrobenius p hp) := by + ext f d + exact congrArg (coeff d) (expand_killFirst p hp f) + +lemma integralHonda_killFirst (p : ℕ) [hp : Fact p.Prime] : + (integralHonda p).map (killFirst (R := ℤ)).toRingHom = + integralFormalGroup coefficientInclusion coefficientInclusion_injective p + (integralFrobenius p hp.out.ne_zero) (rationalFrobenius p hp.out.ne_zero) + (frobenius_compatible p hp.out.ne_zero) (integralFrobenius_congr p) + (killFirst ∘ parameters) := by + exact integralFormalGroup_natural _ _ _ _ _ _ killFirst_inclusion p _ _ _ _ _ _ _ _ + (killFirst_commute_integralFrobenius p hp.out.ne_zero) parameters + +lemma integralHonda_height_two (p : ℕ) [hp : Fact p.Prime] : + (∀ j < p^2, killFirst ((multiplicationSeries (integralHonda p) p).coeff j) = + (p : IntegralBase) * (PowerSeries.X : PowerSeries IntegralBase).coeff j) ∧ + killFirst ((multiplicationSeries (integralHonda p) p).coeff (p^2)) = + X 1 * (1-(p : IntegralBase)^(p^2-1)) := by + have h := integralFormalGroup_height_two coefficientInclusion coefficientInclusion_injective p + (integralFrobenius p hp.out.ne_zero) (rationalFrobenius p hp.out.ne_zero) + (frobenius_compatible p hp.out.ne_zero) (integralFrobenius_congr p) + (killFirst ∘ parameters) (by simp [parameters]) + rw [← integralHonda_killFirst, multiplication_map] at h + constructor + · intro j hj + exact h.1 j hj + · convert h.2 using 1 <;> simp [parameters] + +theorem reducedHonda_height_one (p : ℕ) [hp : Fact p.Prime] + (K : Type*) [CommRing K] [CharP K p] : + (∀ j < p, (multiplicationSeries (reducedHonda p K) p).coeff j = 0) ∧ + (multiplicationSeries (reducedHonda p K) p).coeff p = X 0 := by + have h := integralFormalGroup_height_one coefficientInclusion coefficientInclusion_injective p + (integralFrobenius p hp.out.ne_zero) (rationalFrobenius p hp.out.ne_zero) + (frobenius_compatible p hp.out.ne_zero) (integralFrobenius_congr p) parameters + change (∀ j < p, (multiplicationSeries (integralHonda p) p).coeff j = _) ∧ + (multiplicationSeries (integralHonda p) p).coeff p = parameters 0 * (1-(p : IntegralBase)^(p-1)) at h + have hpc : (p : MvPowerSeries (Fin 2) K) = 0 := by + simpa only [map_natCast, map_zero] using congrArg + (MvPowerSeries.C (σ := Fin 2)) (CharP.cast_eq_zero K p) + simp only [reducedHonda, multiplication_map, PowerSeries.coeff_map] + constructor + · intro j hj + rw [h.1 j hj, map_mul, map_natCast, hpc, zero_mul] + · rw [h.2] + simp only [map_mul, map_sub, map_one, map_pow, map_natCast, hpc, + parameters, Matrix.cons_val_zero, map_X, zero_pow (by have := hp.out.two_le; omega : p-1 ≠ 0), sub_zero, + mul_one] + +theorem reducedHonda_heightCoordinates (p : ℕ) [hp : Fact p.Prime] + (K : Type*) [CommRing K] [CharP K p] : + HeightCoordinates p (reducedHonda p K) := by + have h1 := reducedHonda_height_one p K + have hpc : (p : MvPowerSeries (Fin 2) K) = 0 := by + simpa only [map_natCast, map_zero] using congrArg + (MvPowerSeries.C (σ := Fin 2)) (CharP.cast_eq_zero K p) + refine ⟨h1.1, h1.2, ?_, ?_⟩ + · intro j hj + rw [← killFirst_eq_zero_iff] + simp only [reducedHonda, multiplication_map, PowerSeries.coeff_map] + rw [← map_killFirst, (integralHonda_height_two p).1 j hj, + map_mul, map_natCast, hpc, zero_mul] + · rw [← killFirst_eq_zero_iff, map_sub, killFirst_X_one] + simp only [reducedHonda, multiplication_map, PowerSeries.coeff_map] + rw [← map_killFirst, (integralHonda_height_two p).2] + simp only [map_mul, map_sub, map_one, map_pow, map_natCast, hpc, + map_X, zero_pow (by have : 1 < p^2 := one_lt_pow₀ hp.out.one_lt (by decide); omega : p^2-1 ≠ 0), + sub_zero, mul_one, sub_self] + +end HeightThree.HondaCoordinates + +end + +end OAI diff --git a/lean/OAI/Algebra/FormalGroup/Honda/HondaDifferential.lean b/lean/OAI/Algebra/FormalGroup/Honda/HondaDifferential.lean new file mode 100644 index 0000000000000000000000000000000000000000..0b8e470d19cb0f702a0b8ee40c5873d7e86b56ea --- /dev/null +++ b/lean/OAI/Algebra/FormalGroup/Honda/HondaDifferential.lean @@ -0,0 +1,191 @@ +import OAI.Algebra.FormalGroup.Honda.Differential +import OAI.Algebra.FormalGroup.Honda.SpecialFiber + +namespace OAI + +noncomputable section + +namespace HeightThree.HondaDifferentials +open MvPowerSeries PTypical HondaConstruction HondaCoordinates HondaSpecialFiber +open PowerSeriesDifferential LogarithmicConstruction + +lemma special_numerator_dvd (p : ℕ) (n : ℕ) (hn : 0 < n) : + (p : ℤ)^2 ∣ numerator p (RingHom.id ℤ) specialParameters n := by + obtain ⟨n, rfl⟩ := Nat.exists_eq_succ_of_ne_zero (by omega : n ≠ 0) + simp only [numerator, Fin.sum_univ_three, specialParameters, Matrix.cons_val_zero, + Matrix.cons_val_one, Matrix.cons_val_two, Fin.val_zero, Fin.val_one, + Fin.val_two, mul_zero, zero_mul, ite_self, zero_add] + split_ifs <;> simp + +lemma special_derivative_coeff_power (p : ℕ) [hp : Fact p.Prime] + (n j : ℕ) (hj : n+1 = p^j) : + (PowerSeries.derivative (specialLog p).series).coeff n = + ((numerator p (RingHom.id ℤ) specialParameters j : ℤ) : ℚ) := by + have hpq : (p : ℚ) ≠ 0 := by exact_mod_cast hp.out.ne_zero + have he : (n : ℚ)+1 = (p : ℚ)^j := by exact_mod_cast hj + rw [PowerSeries.coeff_derivative, he] + change (logarithm (Int.castRingHom ℚ) p (RingHom.id ℤ) specialParameters).coeff (n+1) * + (p : ℚ)^j = _ + rw [hj] + simp only [logarithm, coeff_series_power p hp.out.two_le, smul_eq_mul, + inv_pow] + change ((p : ℚ)^j)⁻¹ * ((numerator p (RingHom.id ℤ) specialParameters j : ℤ) : ℚ) * (p : ℚ)^j = _ + field_simp + +lemma special_derivative_integral (p : ℕ) [hp : Fact p.Prime] : + ∃ b : PowerSeries ℤ, + PowerSeries.derivative (specialLog p).series = + (1 + (p : PowerSeries ℚ)^2 * b.map (Int.castRingHom ℚ)) := by + have hc (n : ℕ) : ∃ b : ℤ, + (PowerSeries.derivative (specialLog p).series).coeff n = + (if n=0 then 1 else 0) + (p : ℚ)^2 * b := by + by_cases hn : n=0 + · subst n + refine ⟨0, ?_⟩ + simp [PowerSeries.coeff_derivative, (specialLog p).linear_one] + · by_cases hj : ∃ j, p^j = n+1 + · obtain ⟨j, hj⟩ := hj + have hjpos : 0 < j := by + by_contra h + have hj0 : j=0 := by omega + rw [hj0, pow_zero] at hj + omega + obtain ⟨b, hb⟩ := special_numerator_dvd p j hjpos + refine ⟨b, ?_⟩ + rw [special_derivative_coeff_power p n j hj.symm, hb, ite_eq_right hn, zero_add, + Int.cast_mul, Int.cast_pow, Int.cast_natCast] + · refine ⟨0, ?_⟩ + rw [PowerSeries.coeff_derivative] + dsimp [specialLog, heightThreeLog, logarithm] + simp only [coeff_series_outside p (n+1) _ hj, zero_mul, ite_eq_right hn, + mul_zero, add_zero] + choose b hb using hc + refine ⟨PowerSeries.mk b, ?_⟩ + ext n + rw [hb] + rw [show (p : PowerSeries ℚ)^2 = PowerSeries.C ((p : ℚ)^2) by simp, + map_add, PowerSeries.coeff_one, PowerSeries.coeff_C_mul, + PowerSeries.coeff_map, PowerSeries.coeff_mk] + rfl + +lemma law_map_special (p : ℕ) [hp : Fact p.Prime] : + (integralSpecial p).toPowerSeries.map (Int.castRingHom ℚ) = (specialLog p).law := by + exact congrArg FormalGroup.toPowerSeries (integralSpecial_map p) + +lemma map_unisubst {R S σ : Type*} [CommRing R] [CommRing S] + (ρ : R →+* S) (f : PowerSeries R) (a : MvPowerSeries σ R) + (ha : PowerSeries.HasSubst a) : + (f.subst a).map ρ = (f.map ρ).subst (a.map ρ) := + MvPowerSeries.map_subst ha.const f + +lemma special_partial_integral (p : ℕ) [hp : Fact p.Prime] (i : Fin 2) : + ∃ b : MvPowerSeries (Fin 2) ℤ, + pderiv i (integralSpecial p).toPowerSeries = 1 + (p : MvPowerSeries (Fin 2) ℤ)^2*b := by + obtain ⟨b, hb⟩ := special_derivative_integral p + let F := (integralSpecial p).toPowerSeries + let l := specialLog p + have hlog := congrArg (pderiv i) l.log_law + have hr : pderiv i l.sumSeries = (PowerSeries.derivative l.series).subst (X i) := by + dsimp [StrictLog.sumSeries] + rw [map_add, pderiv_subst l.series (X 0) (by simp) i, + pderiv_subst l.series (X 1) (by simp) i] + fin_cases i <;> simp + rw [pderiv_subst _ _ l.law_constant, hr, hb] at hlog + have hbF : PowerSeries.HasSubst F := + PowerSeries.HasSubst.of_constantCoeff_zero (integralSpecial p).zero_constantCoeff + have hf : (1 + (p : MvPowerSeries (Fin 2) ℤ)^2 * b.subst F) * pderiv i F = + 1 + (p : MvPowerSeries (Fin 2) ℤ)^2 * b.subst (X i) := by + apply HeightThree.HondaConstruction.map_injective (Int.castRingHom ℚ) Int.cast_injective + have hF : F.map (Int.castRingHom ℚ) = l.law := law_map_special p + simp only [map_mul, map_add, map_one, map_pow, map_natCast, map_unisubst _ _ _ hbF, + map_unisubst _ _ _ (PowerSeries.HasSubst.X i), map_X, ← pderiv_map, hF] + simpa only [← PowerSeries.coe_substAlgHom + (PowerSeries.HasSubst.of_constantCoeff_zero l.law_constant), + ← PowerSeries.coe_substAlgHom (PowerSeries.HasSubst.X i), + map_add, map_one, map_mul, map_pow, map_natCast] using hlog + refine ⟨b.subst (X i) - b.subst F * pderiv i F, ?_⟩ + calc + pderiv i F = ((1 + (p : MvPowerSeries (Fin 2) ℤ)^2 * b.subst F) * pderiv i F) - + (p : MvPowerSeries (Fin 2) ℤ)^2 * b.subst F * pderiv i F := by ring + _ = _ := by rw [hf]; ring + +lemma coeff_mul_index_dvd {σ : Type*} (f : MvPowerSeries σ ℤ) + (q : ℤ) (h : ∀ i, ∃ b, pderiv i f = C q * b) + (d : σ →₀ ℕ) (i : σ) : q ∣ coeff d f * (d i : ℤ) := by + classical + by_cases hi : d i = 0 + · simp [hi] + let e := d.erase i + Finsupp.single i (d i - 1) + have he : e + Finsupp.single i 1 = d := by + ext j + by_cases hj : j = i + · subst j; simp [e, Nat.sub_add_cancel (by omega : 1 ≤ d i)] + · simp [e, hj] + have hei : (e i : ℤ) + 1 = (d i : ℤ) := by + have hh := congrArg (fun d : σ →₀ ℕ => d i) he + simp only [Finsupp.add_apply, Finsupp.single_eq_same] at hh + exact_mod_cast hh + obtain ⟨b, hb⟩ := h i + have hh := congrArg (coeff e) hb + rw [coeff_pderiv, he, hei, coeff_C_mul] at hh + exact ⟨coeff e b, hh⟩ + +lemma special_nonlinear_support (p : ℕ) [hp : Fact p.Prime] + (K : Type*) [CommRing K] [CharP K p] (d : Fin 2 →₀ ℕ) + (hd : coeff d ((hondaLaw p K).toPowerSeries - X 0 - X 1) ≠ 0) : + ∀ i, p^2 ∣ d i := by + let D := (integralSpecial p).toPowerSeries - X 0 - X 1 + have hD (i : Fin 2) : ∃ b, pderiv i D = C ((p : ℤ)^2) * b := by + obtain ⟨b, hb⟩ := special_partial_integral p i + refine ⟨b, ?_⟩ + dsimp [D] + rw [map_sub, map_sub, hb] + fin_cases i <;> simp + have hn : ¬(p : ℤ) ∣ coeff d D := by + intro hn + apply hd + have hz := (CharP.intCast_eq_zero_iff K p (coeff d D)).mpr hn + have hDm : D.map (Int.castRingHom K) = (hondaLaw p K).toPowerSeries - X 0 - X 1 := by + simp [D, hondaLaw] + rw [← hDm, coeff_map] + exact hz + have hc : IsCoprime (p : ℤ) (coeff d D) := + (Prime.coprime_iff_not_dvd (Int.prime_iff_natAbs_prime.mpr (by simpa using hp.out))).mpr hn + intro i + have hh := hc.pow_left.dvd_of_dvd_mul_left (coeff_mul_index_dvd D ((p:ℤ)^2) hD d i) + exact Int.natCast_dvd_natCast.mp (by simpa only [Nat.cast_pow] using hh) + +lemma exists_expand_of_support {σ R : Type*} [CommRing R] (f : MvPowerSeries σ R) + (q : ℕ) (hq : q ≠ 0) (h : ∀ d, coeff d f ≠ 0 → ∀ i, q ∣ d i) : + ∃ g, expand q hq g = f := by + classical + let g : MvPowerSeries σ R := fun d => coeff (q • d) f + refine ⟨g, ?_⟩ + ext d + by_cases hd : ∀ i, q ∣ d i + · let e := d.mapRange (fun n => n/q) (Nat.zero_div q) + have he : q • e = d := by + ext i + simp only [Finsupp.smul_apply, smul_eq_mul, e, Finsupp.mapRange_apply] + exact Nat.mul_div_cancel' (hd i) + rw [← he, coeff_expand_smul] + rfl + · obtain ⟨i, hi⟩ := not_forall.mp hd + rw [coeff_expand_of_not_dvd _ _ _ hi] + by_contra hf + exact hi (h d (Ne.symm hf) i) + +theorem honda_nonlinear_expand (p : ℕ) [hp : Fact p.Prime] + (K : Type*) [CommRing K] [CharP K p] : + ∃ H : MvPowerSeries (Fin 2) K, + (hondaLaw p K).toPowerSeries = X 0 + X 1 + expand (p^2) (pow_ne_zero _ hp.out.ne_zero) H := by + obtain ⟨H, hH⟩ := exists_expand_of_support + ((hondaLaw p K).toPowerSeries - X 0 - X 1) (p^2) (pow_ne_zero _ hp.out.ne_zero) + (special_nonlinear_support p K) + exact ⟨H, by rw [hH]; ring⟩ + +end HeightThree.HondaDifferentials + +end + +end OAI diff --git a/lean/OAI/Algebra/FormalGroup/Honda/IntegralLaw.lean b/lean/OAI/Algebra/FormalGroup/Honda/IntegralLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..c90c1cc7992c1be67cf9948a9d600b9a84358c5c --- /dev/null +++ b/lean/OAI/Algebra/FormalGroup/Honda/IntegralLaw.lean @@ -0,0 +1,184 @@ +import OAI.Algebra.FormalGroup.Honda.Logarithm + +namespace OAI + +noncomputable section + +namespace HeightThree.HondaConstruction +open MvPowerSeries PTypical LogarithmicConstruction + +variable {A B : Type*} [CommRing A] [CommRing B] + +theorem law_integral [Algebra ℚ B] (ι : A →+* B) (p : ℕ) [hp : Fact p.Prime] + (ψ : A →+* A) (χ : B →ₐ[ℚ] B) (hc : χ.toRingHom.comp ι = ι.comp ψ) + (hψ : ∀ a : A, (p : A) ∣ ψ a - a^p) (v : Fin 3 → A) + (l : StrictLog (R := B)) (hf : HasIntegralNumerators ι p l.series) + (he : defect p hp.out.ne_zero χ.toRingHom (ι ∘ v) l.series = PowerSeries.X) : + IntegralSeries ι l.law := by + apply integral_of_defect_log ι p ψ χ hc hψ v l.series hf he l.linear_one _ l.law_constant + rw [l.log_law, StrictLog.sumSeries, defect_add] + have hi (i : Fin 2) : IntegralSeries ι + (defect p hp.out.ne_zero χ.toRingHom (ι ∘ v) (l.series.subst (X i))) := by + simpa only [map_X] using + defect_log_integral ι p ψ χ hc hψ v l.series hf he (X i) (by simp) + exact (hi 0).add ι (hi 1) + +lemma map_injective (ι : A →+* B) (hinj : Function.Injective ι) {σ : Type*} : + Function.Injective (MvPowerSeries.map (σ := σ) ι) := by + intro f g hfg + ext d + apply hinj + simpa only [coeff_map] using congrArg (coeff d) hfg + +def descendFormalGroup (ι : A →+* B) (hinj : Function.Injective ι) + (F : FormalGroup B) (hF : IntegralSeries ι F.toPowerSeries) : FormalGroup A := by + let f := integralLift ι F.toPowerSeries hF + have hf : f.map ι = F.toPowerSeries := map_integralLift ι _ hF + have hc : f.constantCoeff = 0 := by + apply hinj + simpa only [← constantCoeff_map, hf, map_zero] using F.zero_constantCoeff + refine ⟨f, hc, ?_, ?_, ?_⟩ + · apply hinj + rw [map_one, ← coeff_map, hf, F.lin_coeff_X] + · apply hinj + rw [map_one, ← coeff_map, hf, F.lin_coeff_Y] + · apply map_injective ι hinj + have hj (g₁ g₂ : MvPowerSeries (Fin 3) A) : + ![g₁.map ι, g₂.map ι] = fun i => (![g₁, g₂] i).map ι := by + ext i; fin_cases i <;> rfl + rw [map_subst (HasSubst.cons_subst_zero_left (0 : Fin 3) 1 2 hc), + map_subst (HasSubst.cons_subst_zero_right (0 : Fin 3) 1 2 hc)] + simp_rw [← hj, map_subst HasSubst.X_X, ← hj, map_X, hf] + exact F.assoc + +@[simp] theorem map_descendFormalGroup (ι : A →+* B) (hinj : Function.Injective ι) + (F : FormalGroup B) (hF : IntegralSeries ι F.toPowerSeries) : + (descendFormalGroup ι hinj F hF).map ι = F := by + apply FormalGroup.ext + exact map_integralLift ι _ hF + +instance descendFormalGroup_isComm (ι : A →+* B) (hinj : Function.Injective ι) + (F : FormalGroup B) [F.IsComm] (hF : IntegralSeries ι F.toPowerSeries) : + (descendFormalGroup ι hinj F hF).IsComm where + comm := by + apply map_injective ι hinj + have hf : (descendFormalGroup ι hinj F hF).toPowerSeries.map ι = F.toPowerSeries := + map_integralLift ι _ hF + rw [hf, map_subst HasSubst.X_X, hf] + calc + F.toPowerSeries = F.toPowerSeries.subst ![X 1, X 0] := FormalGroup.IsComm.comm + _ = _ := by congr 1; funext i; fin_cases i <;> simp + +end HeightThree.HondaConstruction + +namespace HeightThree.HondaConstruction +open MvPowerSeries PTypical LogarithmicConstruction +variable {A B : Type*} [CommRing A] [CommRing B] + +def numerator (p : ℕ) (ψ : A →+* A) (v : Fin 3 → A) : ℕ → A + | 0 => 1 + | n+1 => ∑ i : Fin 3, if i.val ≤ n then + (p : A)^i.val * v i * (ψ^(i.val+1)) (numerator p ψ v (n-i.val)) else 0 +termination_by n => n + +def logarithm [Algebra ℚ B] (ι : A →+* B) (p : ℕ) (ψ : A →+* A) + (v : Fin 3 → A) : PowerSeries B := + series p (fun n => ((p : ℚ)⁻¹)^n • ι (numerator p ψ v n)) + +lemma logarithm_constant [Algebra ℚ B] (ι : A →+* B) (p : ℕ) (hp : 2 ≤ p) + (ψ : A →+* A) (v : Fin 3 → A) : + (logarithm ι p ψ v).constantCoeff = 0 := series_constant p hp _ + +lemma logarithm_linear [Algebra ℚ B] (ι : A →+* B) (p : ℕ) (hp : 2 ≤ p) + (ψ : A →+* A) (v : Fin 3 → A) : + (logarithm ι p ψ v).coeff 1 = 1 := by + simp [logarithm, series_linear p hp, numerator] + +lemma twisted_series_coeff (p : ℕ) (hp : 2 ≤ p) (χ : B →+* B) + (c : ℕ → B) (k n : ℕ) : + PowerSeries.coeff (p^n) ((twist p (by omega) χ ^ k) (series p c)) = + if k ≤ n then (χ^k) (c (n-k)) else 0 := by + rw [twist_iterate] + change PowerSeries.coeff (p^n) (((series p c).map (χ^k)).expand (p^k) _) = _ + rw [PowerSeries.coeff_expand] + simp only [Nat.pow_dvd_pow_iff_le_right (by omega : 1 < p)] + split_ifs with h + · rw [Nat.pow_div h (by omega : 0 < p), PowerSeries.coeff_map, + coeff_series_power p hp] + · rfl + +lemma twisted_series_coeff_outside (p : ℕ) (hp : 2 ≤ p) (χ : B →+* B) + (c : ℕ → B) (k j : ℕ) (hj : ¬ ∃ n : ℕ, p^n = j) : + PowerSeries.coeff j ((twist p (by omega) χ ^ k) (series p c)) = 0 := by + rw [twist_iterate] + change PowerSeries.coeff j (((series p c).map (χ^k)).expand (p^k) _) = _ + rw [PowerSeries.coeff_expand] + split_ifs with h + · rw [PowerSeries.coeff_map, coeff_series_outside p (j / p^k) c, map_zero] + rintro ⟨n, hn⟩ + exact hj ⟨k+n, by rw [pow_add, hn, Nat.mul_div_cancel' h]⟩ + · rfl + +end HeightThree.HondaConstruction + +namespace HeightThree.HondaConstruction +open MvPowerSeries PTypical LogarithmicConstruction +variable {A B : Type*} [CommRing A] [CommRing B] + +lemma iterate_smul [Algebra ℚ B] (χ : B →ₐ[ℚ] B) (n : ℕ) (q : ℚ) (b : B) : + (χ.toRingHom^n) (q • b) = q • ((χ.toRingHom^n) b) := by + induction n with + | zero => rfl + | succ n ih => + rw [pow_succ'] + change χ ((χ.toRingHom^n) (q • b)) = q • χ ((χ.toRingHom^n) b) + rw [ih, χ.map_smul_of_tower] + +lemma iterate_comp (ι : A →+* B) (ψ : A →+* A) (χ : B →+* B) + (hc : χ.comp ι = ι.comp ψ) (n : ℕ) (a : A) : + (χ^n) (ι a) = ι ((ψ^n) a) := by + induction n with + | zero => rfl + | succ n ih => + rw [pow_succ' χ, pow_succ' ψ] + change χ ((χ^n) (ι a)) = ι (ψ ((ψ^n) a)) + rw [ih] + exact DFunLike.congr_fun hc _ + +lemma scalar_denominator [Algebra ℚ B] (p : ℕ) (hp : p ≠ 0) + (n i : ℕ) (hi : i ≤ n) (b : B) : + ((p : ℚ)⁻¹)^(n+1) • ((p : B)^i * b) = + (p : ℚ)⁻¹ • (((p : ℚ)⁻¹)^(n-i) • b) := by + have hpQ : (p : ℚ) ≠ 0 := by exact_mod_cast hp + have he : ((p : ℚ)⁻¹)^(n+1) * (p : ℚ)^i = + (p : ℚ)⁻¹ * ((p : ℚ)⁻¹)^(n-i) := by + rw [show n+1 = i + (n-i+1) by omega, pow_add] + calc + _ = (((p : ℚ)⁻¹) * p)^i * ((p : ℚ)⁻¹)^(n-i+1) := by ring + _ = _ := by simp [hpQ, pow_succ, mul_comm] + have hb : ((p : B)^i * b) = (p : ℚ)^i • b := by + simp [Algebra.smul_def] + rw [hb, smul_smul, he, smul_smul] + +lemma logarithm_recurrence [Algebra ℚ B] (ι : A →+* B) (p : ℕ) (hp : p ≠ 0) + (ψ : A →+* A) (χ : B →ₐ[ℚ] B) (hc : χ.toRingHom.comp ι = ι.comp ψ) + (v : Fin 3 → A) (n : ℕ) : + ((p : ℚ)⁻¹)^(n+1) • ι (numerator p ψ v (n+1)) = + ∑ i : Fin 3, (p : ℚ)⁻¹ • (ι (v i) * + (if i.val ≤ n then (χ.toRingHom^(i.val+1)) + (((p : ℚ)⁻¹)^(n-i.val) • ι (numerator p ψ v (n-i.val))) else 0)) := by + rw [numerator, map_sum, Finset.smul_sum] + apply Finset.sum_congr rfl + intro i _ + split_ifs with hi + · rw [map_mul, map_mul, map_pow, map_natCast, mul_assoc, + scalar_denominator p hp n i.val hi, + iterate_smul, iterate_comp ι ψ χ.toRingHom hc, + mul_smul_comm] + · simp + +end HeightThree.HondaConstruction + +end + +end OAI diff --git a/lean/OAI/Algebra/FormalGroup/Honda/Jets.lean b/lean/OAI/Algebra/FormalGroup/Honda/Jets.lean new file mode 100644 index 0000000000000000000000000000000000000000..9b0102124b4846795e568ebf1dcd686c99b784e2 --- /dev/null +++ b/lean/OAI/Algebra/FormalGroup/Honda/Jets.lean @@ -0,0 +1,284 @@ +import OAI.Algebra.FormalGroup.Honda.Cocycle +import OAI.Algebra.FormalGroup.Honda.Canonical + +namespace OAI + +noncomputable section + +namespace HeightThree.HondaJets +open MvPowerSeries +variable {K σ τ : Type*} [CommRing K] + +def EqJet (n : ℕ) (f g : MvPowerSeries σ K) : Prop := + ∀ d, d.degree < n → coeff d f = coeff d g + +lemma eqJet_iff_order (n : ℕ) (f g : MvPowerSeries σ K) : + EqJet n f g ↔ (n : ℕ∞) ≤ (f-g).order := by + constructor + · intro h; apply nat_le_order; intro d hd; rw [map_sub,h d hd,sub_self] + · intro h d hd + have hh := coeff_of_lt_order ((show (d.degree : ℕ∞) < n by exact_mod_cast hd).trans_le h) + exact sub_eq_zero.mp (by simpa using hh) + +lemma eqJet_iff_trunc [Finite σ] (n : ℕ) (f g : MvPowerSeries σ K) : + EqJet n f g ↔ f.truncTotal n = g.truncTotal n := by + constructor + · intro h; ext d + by_cases hd : d.degree polynomial.coeff d) h + +lemma EqJet.refl (n : ℕ) (f : MvPowerSeries σ K) : EqJet n f f := fun _ _ => rfl +lemma EqJet.symm {n : ℕ} {f g : MvPowerSeries σ K} (h : EqJet n f g) : EqJet n g f := + fun d hd => (h d hd).symm +lemma EqJet.trans {n : ℕ} {f g h : MvPowerSeries σ K} (h₁ : EqJet n f g) + (h₂ : EqJet n g h) : EqJet n f h := fun d hd => (h₁ d hd).trans (h₂ d hd) +lemma EqJet.mono {n m : ℕ} {f g : MvPowerSeries σ K} (h : EqJet n f g) (hm : m≤n) : + EqJet m f g := fun d hd => h d (hd.trans_le hm) +lemma EqJet.add {n : ℕ} {f g a b : MvPowerSeries σ K} + (h : EqJet n f g) (h' : EqJet n a b) : EqJet n (f+a) (g+b) := by + intro d hd; simp only [map_add,h d hd,h' d hd] +lemma EqJet.sub {n : ℕ} {f g a b : MvPowerSeries σ K} + (h : EqJet n f g) (h' : EqJet n a b) : EqJet n (f-a) (g-b) := by + intro d hd; simp only [map_sub,h d hd,h' d hd] +lemma EqJet.neg {n : ℕ} {f g : MvPowerSeries σ K} (h : EqJet n f g) : EqJet n (-f) (-g) := by + intro d hd; simp only [map_neg,h d hd] +lemma EqJet.mul_left {n : ℕ} {f g : MvPowerSeries σ K} (h : EqJet n f g) (a : MvPowerSeries σ K) : + EqJet n (a*f) (a*g) := by + rw [eqJet_iff_order] at h ⊢ + rw [←mul_sub] + exact le_trans (le_trans h (le_add_left le_rfl)) le_order_mul +lemma EqJet.mul_right {n : ℕ} {f g : MvPowerSeries σ K} (h : EqJet n f g) (a : MvPowerSeries σ K) : + EqJet n (f*a) (g*a) := by simpa only [mul_comm] using h.mul_left a +lemma EqJet.mul {n : ℕ} {f g a b : MvPowerSeries σ K} + (h : EqJet n f g) (h' : EqJet n a b) : EqJet n (f*a) (g*b) := + (h.mul_right a).trans (h'.mul_left g) +lemma EqJet.sum {ι : Type*} {n : ℕ} (s : Finset ι) (f g : ι → MvPowerSeries σ K) + (h : ∀ i∈s, EqJet n (f i) (g i)) : EqJet n (∑i∈s,f i) (∑i∈s,g i) := by + intro d hd; simp only [map_sum]; exact Finset.sum_congr rfl fun i hi => h i hi d hd + +lemma EqJet.subst_left {n : ℕ} {f g : MvPowerSeries σ K} (h : EqJet n f g) + (a : σ → MvPowerSeries τ K) (ha : HasSubst a) (ha0 : ∀i,(a i).constantCoeff=0) : + EqJet n (f.subst a) (g.subst a) := by + rw [eqJet_iff_order] at h ⊢ + rw [←subst_sub ha] + have ho : (1 : ℕ∞) ≤ ⨅ i, (a i).order := le_iInf fun i => + one_le_order_iff_constCoeff_eq_zero.mpr (ha0 i) + exact (h.trans (by simpa [mul_comm] using mul_le_mul_right ho (f-g).order)).trans + (le_order_subst ha (f-g)) + +lemma EqJet.subst_right [Finite τ] {n : ℕ} (f : MvPowerSeries σ K) + (a b : σ → MvPowerSeries τ K) (ha : HasSubst a) (hb : HasSubst b) + (h : ∀i,EqJet n (a i) (b i)) : EqJet n (f.subst a) (f.subst b) := by + rw [eqJet_iff_trunc, + truncTotal_subst_eq_truncTotal_subst_truncTotal_of_le ha (x:=fun _=>n) (fun _=>le_rfl), + truncTotal_subst_eq_truncTotal_subst_truncTotal_of_le hb (x:=fun _=>n) (fun _=>le_rfl)] + congr 2 + funext i + exact congrArg MvPolynomial.toMvPowerSeries ((eqJet_iff_trunc n _ _).mp (h i)) + +lemma eqJet_zero_mul {n m : ℕ} {f g : MvPowerSeries σ K} + (hf : EqJet n f 0) (hg : EqJet m g 0) : EqJet (n+m) (f*g) 0 := by + rw [eqJet_iff_order,sub_zero] at hf hg ⊢ + exact (show ((n+m : ℕ) : ℕ∞) ≤ f.order+g.order by simpa using add_le_add hf hg).trans le_order_mul + +lemma eqJet_one_zero (f : MvPowerSeries σ K) (hf : f.constantCoeff=0) : EqJet 1 f 0 := by + rw [eqJet_iff_order,sub_zero] + exact one_le_order_iff_constCoeff_eq_zero.mpr hf + +lemma eqJet_sub_zero {n : ℕ} {f g : MvPowerSeries σ K} : EqJet n (f-g) 0 ↔ EqJet n f g := by + constructor <;> intro h d hd + · exact sub_eq_zero.mp (by simpa only [map_sub,map_zero] using h d hd) + · simp only [map_sub,map_zero,h d hd,sub_self] + +lemma eqJet_subst_constant (f : MvPowerSeries σ K) (a : σ → MvPowerSeries τ K) + (ha : HasSubst a) (ha0 : ∀i,(a i).constantCoeff=0) : + EqJet 1 (f.subst a) (C f.constantCoeff) := by + rw [←eqJet_sub_zero] + apply eqJet_one_zero + simp only [map_sub,constantCoeff_C] + exact sub_eq_zero.mpr (HeightThree.OriginalDifferentialSupport.constantCoeff_subst_zero_axis a ha ha0 f) + +lemma coeff_linear_mul (f g : MvPowerSeries σ K) (i : σ) : + coeff (Finsupp.single i 1) (f*g)= + f.constantCoeff*coeff (Finsupp.single i 1) g+ + g.constantCoeff*coeff (Finsupp.single i 1) f := by + have h (a : MvPowerSeries σ K) : constantCoeff (pderiv i a)=coeff (Finsupp.single i 1) a := by + rw [←coeff_zero_eq_constantCoeff,coeff_pderiv]; simp + rw [←h,Derivation.leibniz,smul_eq_mul,smul_eq_mul,map_add,map_mul,map_mul,h,h] + +lemma subst_first_order_polynomial [Fintype σ] [Finite τ] + (f : MvPolynomial σ K) (n : ℕ) + (a b : σ → MvPowerSeries τ K) (ha0 : ∀i,(a i).constantCoeff=0) + (hb0 : ∀i,(b i).constantCoeff=0) (hab : ∀i,EqJet n (a i) (b i)) : + EqJet (n+1) ((f : MvPowerSeries σ K).subst a - (f : MvPowerSeries σ K).subst b) + (∑i, C (coeff (Finsupp.single i 1) (f : MvPowerSeries σ K))*(a i-b i)) := by + classical + have ha : HasSubst a := hasSubst_of_constantCoeff_zero ha0 + have hb : HasSubst b := hasSubst_of_constantCoeff_zero hb0 + induction f using MvPolynomial.induction_on with + | C c => + simp only [MvPolynomial.coe_C,subst_C,coeff_C,Finsupp.single_eq_zero,one_ne_zero, + ite_false,map_zero,zero_mul,Finset.sum_const_zero,sub_self] + exact EqJet.refl _ _ + | add f g hf hg => + convert hf.add hg using 1 + · simp only [MvPolynomial.coe_add,subst_add ha,subst_add hb]; ring + · simp only [MvPolynomial.coe_add,map_add,add_mul,Finset.sum_add_distrib] + | mul_X f j hf => + have h1 : EqJet (n+1) (((f : MvPowerSeries σ K).subst a-C (f : MvPowerSeries σ K).constantCoeff)*(a j-b j)) 0 := by + simpa only [add_comm] using eqJet_zero_mul + (eqJet_sub_zero.mpr (eqJet_subst_constant _ a ha ha0)) (eqJet_sub_zero.mpr (hab j)) + have h2 : EqJet (n+1) (((f : MvPowerSeries σ K).subst a-(f : MvPowerSeries σ K).subst b)*b j) 0 := + eqJet_zero_mul (eqJet_sub_zero.mpr (EqJet.subst_right _ a b ha hb hab)) + (eqJet_one_zero _ (hb0 j)) + have he : ((f : MvPowerSeries σ K).subst a*a j-(f : MvPowerSeries σ K).subst b*b j) - + C (f : MvPowerSeries σ K).constantCoeff*(a j-b j)= + (((f : MvPowerSeries σ K).subst a-C (f : MvPowerSeries σ K).constantCoeff)*(a j-b j))+ + (((f : MvPowerSeries σ K).subst a-(f : MvPowerSeries σ K).subst b)*b j) := by ring + have hh₀ : EqJet (n+1) + (((f : MvPowerSeries σ K).subst a*a j-(f : MvPowerSeries σ K).subst b*b j) - + C (f : MvPowerSeries σ K).constantCoeff*(a j-b j)) 0 := by + rw [he]; simpa using h1.add h2 + have hh := eqJet_sub_zero.mp hh₀ + convert hh using 1 + · simp only [MvPolynomial.coe_mul,MvPolynomial.coe_X,subst_mul ha,subst_mul hb, + subst_X ha,subst_X hb] + · simp only [MvPolynomial.coe_mul,MvPolynomial.coe_X] + simp [coeff_linear_mul, coeff_index_single_X,apply_ite] + +lemma subst_first_order [Fintype σ] [Finite τ] + (f : MvPowerSeries σ K) (n : ℕ) + (a b : σ → MvPowerSeries τ K) (ha0 : ∀i,(a i).constantCoeff=0) + (hb0 : ∀i,(b i).constantCoeff=0) (hab : ∀i,EqJet n (a i) (b i)) : + EqJet (n+1) (f.subst a - f.subst b) + (∑i, C (coeff (Finsupp.single i 1) f)*(a i-b i)) := by + classical + let : UniformSpace K := ⊥ + let : DiscreteUniformity K := ⟨rfl⟩ + open MvPowerSeries.WithPiTopology in + have hc₁ : Continuous (fun f : MvPowerSeries σ K => f.subst a - f.subst b) := + (continuous_subst (hasSubst_of_constantCoeff_zero ha0)).sub + (continuous_subst (hasSubst_of_constantCoeff_zero hb0)) + intro d hd + have hc₂ : Continuous (fun f : MvPowerSeries σ K => + ∑i, C (coeff (Finsupp.single i 1) f)*(a i-b i)) := by + apply continuous_finsetSum + intro i hi + exact ((MvPowerSeries.WithPiTopology.continuous_C).comp + (MvPowerSeries.WithPiTopology.continuous_coeff K _)).mul_const _ + have hh := MvPowerSeries.WithPiTopology.denseRange_toMvPowerSeries.equalizer + ((MvPowerSeries.WithPiTopology.continuous_coeff K d).comp hc₁) + ((MvPowerSeries.WithPiTopology.continuous_coeff K d).comp hc₂) + (by funext g; exact subst_first_order_polynomial g n a b ha0 hb0 hab d hd) + exact congrFun hh f + +lemma law_first_order [Finite τ] (F : FormalGroup K) (n : ℕ) + (a b : Fin 2 → MvPowerSeries τ K) (ha0 : ∀i,(a i).constantCoeff=0) + (hb0 : ∀i,(b i).constantCoeff=0) (hab : ∀i,EqJet n (a i) (b i)) : + EqJet (n+1) (F.toPowerSeries.subst a - F.toPowerSeries.subst b) + ((a 0-b 0)+(a 1-b 1)) := by + simpa only [Fin.sum_univ_two,F.lin_coeff_X,F.lin_coeff_Y,map_one,one_mul] + using subst_first_order F.toPowerSeries n a b ha0 hb0 hab + +lemma EqJet.mul_leading {m n : ℕ} {f g a b : MvPowerSeries σ K} + (hfg : EqJet (m+1) f g) (hab : EqJet (n+1) a b) + (hg : EqJet m g 0) (ha : EqJet n a 0) : EqJet (m+n+1) (f*a) (g*b) := by + rw [←eqJet_sub_zero] + have he : f*a-g*b=(f-g)*a+g*(a-b) := by ring + rw [he] + have h₁ := eqJet_zero_mul (eqJet_sub_zero.mpr hfg) ha + have h₂ := eqJet_zero_mul hg (eqJet_sub_zero.mpr hab) + have h₁' : EqJet (m+n+1) ((f-g)*a) 0 := by convert h₁ using 1; omega + have h₂' : EqJet (m+n+1) (g*(a-b)) 0 := h₂ + simpa only [add_zero] using h₁'.add h₂' + +lemma eqJet_pow_zero (f : MvPowerSeries σ K) (hf : f.constantCoeff=0) (n : ℕ) : + EqJet n (f^n) 0 := by + rw [eqJet_iff_order,sub_zero] + exact le_order_pow_of_constantCoeff_eq_zero n hf + +lemma EqJet.pow_leading {f g : MvPowerSeries σ K} (h : EqJet 2 f g) + (hf : f.constantCoeff=0) (hg : g.constantCoeff=0) (n : ℕ) : + EqJet (n+1) (f^n) (g^n) := by + induction n with + | zero => exact EqJet.refl _ _ + | succ n ih => + simpa only [pow_succ] using ih.mul_leading h + (eqJet_pow_zero g hg n) (eqJet_one_zero f hf) + +lemma leading_part (f : MvPowerSeries σ K) (n : ℕ) (h : EqJet n f 0) : + EqJet (n+1) f (f.homogeneousComponent n) := by + intro d hd + rw [coeff_homogeneousComponent] + split_ifs with he + · rfl + · have hh : d.degree rfl + have eb : b=![b 0,b 1] := by ext i; fin_cases i <;> rfl + rw [homogeneous_sum D n hD,←coe_substAlgHom ha',←coe_substAlgHom hb',map_sum,map_sum] + apply EqJet.sum + intro i hi + simp only [coe_substAlgHom] + rw [ea,eb,subst_monomial_pair _ _ _ _ _ (ha 0) (ha 1), + subst_monomial_pair _ _ _ _ _ (hb 0) (hb 1)] + have hh := ((hab 0).pow_leading (ha 0) (hb 0) i).mul_leading + ((hab 1).pow_leading (ha 1) (hb 1) (n-i)) + (eqJet_pow_zero (b 0) (hb 0) i) (eqJet_pow_zero (a 1) (ha 1) (n-i)) + have hi' : i≤n := by simpa only [Finset.mem_range,Nat.lt_succ_iff] using hi + simpa only [Nat.add_sub_of_le hi',mul_assoc] using hh.mul_left (C _) + +lemma homogeneous_subst_linear (D : MvPowerSeries (Fin 2) K) (n : ℕ) + (hD : D.IsHomogeneous n) (a : Fin 2 → MvPowerSeries σ K) + (ha : ∀i,(a i).constantCoeff=0) (haH : ∀i,(a i).IsHomogeneous 1) : + (D.subst a).IsHomogeneous n := by + classical + have ha' := hasSubst_of_constantCoeff_zero ha + have ea : a=![a 0,a 1] := by ext i; fin_cases i <;> rfl + apply homogeneous_of_coeff + intro d hd + rw [homogeneous_sum D n hD,←coe_substAlgHom ha',map_sum,map_sum] + apply Finset.sum_eq_zero + intro i hi + simp only [coe_substAlgHom] + rw [ea,subst_monomial_pair _ _ _ _ _ (ha 0) (ha 1),mul_assoc] + have hi' : i≤n := by simpa only [Finset.mem_range,Nat.lt_succ_iff] using hi + have h₁ : ((a 0)^i).IsHomogeneous i := by + have hh : ((a 0)^i).IsHomogeneous (1*i) := by exact homogeneous_pow (haH 0) i + rw [one_mul] at hh; exact @hh + have h₂ : ((a 1)^(n-i)).IsHomogeneous (n-i) := by + have hh : ((a 1)^(n-i)).IsHomogeneous (1*(n-i)) := by exact homogeneous_pow (haH 1) (n-i) + rw [one_mul] at hh; exact @hh + have h₃ : ((a 0)^i*(a 1)^(n-i)).IsHomogeneous n := by + have hh : ((a 0)^i*(a 1)^(n-i)).IsHomogeneous (i+(n-i)) := by exact h₁.mul h₂ + rw [Nat.add_sub_of_le hi'] at hh; exact @hh + rw [coeff_C_mul,h₃.coeff_eq_zero hd,mul_zero] + +end Field +end HeightThree.HondaJets + +end + +end OAI diff --git a/lean/OAI/Algebra/FormalGroup/Honda/Leading.lean b/lean/OAI/Algebra/FormalGroup/Honda/Leading.lean new file mode 100644 index 0000000000000000000000000000000000000000..df822922e0b0120f38dde93b6e5b187d08f2aa02 --- /dev/null +++ b/lean/OAI/Algebra/FormalGroup/Honda/Leading.lean @@ -0,0 +1,292 @@ +import OAI.Algebra.FormalGroup.Honda.Jets + +namespace OAI + +noncomputable section + +namespace HeightThree.HondaLeading +open MvPowerSeries HeightThree.HondaJets HeightThree.HomogeneousCocycle +variable {K σ : Type*} [Field K] + +abbrev pair (F : FormalGroup K) (a b : MvPowerSeries σ K) := F.toPowerSeries.subst ![a,b] +lemma pair_const (F : FormalGroup K) (a b : MvPowerSeries σ K) + (ha : a.constantCoeff=0) (hb : b.constantCoeff=0) : (pair F a b).constantCoeff=0 := by + exact constantCoeff_subst_eq_zero (hasSubst_of_constantCoeff_zero (by + intro i; fin_cases i <;> simp [ha,hb])) (by intro i; fin_cases i <;> simp [ha,hb]) F.zero_constantCoeff + +lemma pair_linear [Finite σ] (F : FormalGroup K) (a b : MvPowerSeries σ K) + (ha : a.constantCoeff=0) (hb : b.constantCoeff=0) : EqJet 2 (pair F a b) (a+b) := by + have hh := law_first_order F 1 ![a,b] ![0,0] + (by intro i; fin_cases i <;> simp [ha,hb]) (by intro i; fin_cases i <;> simp) + (by intro i; fin_cases i + · exact eqJet_one_zero a ha + · exact eqJet_one_zero b hb) + have h0 : F.toPowerSeries.subst (![0,0] : Fin 2 → MvPowerSeries σ K)=0 := by + rw [show (![0,0] : Fin 2 → MvPowerSeries σ K)=0 by ext i; fin_cases i <;> rfl] + exact subst_zero_of_constantCoeff_zero F.zero_constantCoeff + simpa only [h0,sub_zero,Matrix.cons_val_zero,Matrix.cons_val_one] using hh + +abbrev leading (F G : FormalGroup K) (n : ℕ) := (F.toPowerSeries-G.toPowerSeries).homogeneousComponent n + +lemma leading_approx (F G : FormalGroup K) (n : ℕ) + (h : EqJet n F.toPowerSeries G.toPowerSeries) : + EqJet (n+1) (F.toPowerSeries-G.toPowerSeries) (leading F G n) := + leading_part _ n (eqJet_sub_zero.mpr h) + +lemma leading_homogeneous (F G : FormalGroup K) (n : ℕ) : (leading F G n).IsHomogeneous n := + isHomogeneous_homogeneousComponent _ _ + +lemma homogeneous_zero (n : ℕ) : (0 : MvPowerSeries σ K).IsHomogeneous n := by + apply homogeneous_of_coeff; intro d hd; simp + +lemma homogeneous_C_mul (a : K) {f : MvPowerSeries σ K} {n : ℕ} + (hf : f.IsHomogeneous n) : (C a*f).IsHomogeneous n := by + apply homogeneous_of_coeff; intro d hd; rw [coeff_C_mul,hf.coeff_eq_zero hd,mul_zero] + +lemma linear_pair_homogeneous (D : MvPowerSeries (Fin 2) K) (n : ℕ) + (hD : D.IsHomogeneous n) (a b : MvPowerSeries σ K) + (ha : a.constantCoeff=0) (hb : b.constantCoeff=0) + (hHa : a.IsHomogeneous 1) (hHb : b.IsHomogeneous 1) : + (D.subst ![a,b]).IsHomogeneous n := by + apply homogeneous_subst_linear D n hD + · intro i; fin_cases i <;> simp [ha,hb] + · intro i; fin_cases i + · exact @hHa + · exact @hHb + +lemma leading_axis (F G : FormalGroup K) (n : ℕ) + (h : EqJet n F.toPowerSeries G.toPowerSeries) : + (leading F G n).subst ![(0 : MvPowerSeries (Fin 1) K),X 0]=0 ∧ + (leading F G n).subst ![(X 0 : MvPowerSeries (Fin 1) K),0]=0 := by + have hh := leading_approx F G n h + have h0 : PowerSeries.HasSubst (X (0 : Fin 1) : MvPowerSeries (Fin 1) K) := .of_constantCoeff_zero (by simp) + constructor + · have hs : HasSubst (![0,X 0] : Fin 2 → MvPowerSeries (Fin 1) K) := + hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> simp) + have he := hh.subst_left _ hs (by intro i; fin_cases i <;> simp) + rw [subst_sub hs,F.zero_add h0,G.zero_add h0,sub_self] at he + exact homogeneous_eq_of_jet + (linear_pair_homogeneous _ n (leading_homogeneous F G n) _ _ (by simp) (by simp) + (homogeneous_zero 1) (homogeneous_X 0)) (homogeneous_zero n) he.symm + · have hs : HasSubst (![X 0,0] : Fin 2 → MvPowerSeries (Fin 1) K) := + hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> simp) + have he := hh.subst_left _ hs (by intro i; fin_cases i <;> simp) + rw [subst_sub hs,F.add_zero h0,G.add_zero h0,sub_self] at he + exact homogeneous_eq_of_jet + (linear_pair_homogeneous _ n (leading_homogeneous F G n) _ _ (by simp) (by simp) + (homogeneous_X 0) (homogeneous_zero 1)) (homogeneous_zero n) he.symm + +lemma leading_symmetric (F G : FormalGroup K) [F.IsComm] [G.IsComm] (n : ℕ) + (h : EqJet n F.toPowerSeries G.toPowerSeries) : + (leading F G n).subst ![(X 1 : MvPowerSeries (Fin 2) K),X 0]=leading F G n := by + have hs : HasSubst (![X 1,X 0] : Fin 2 → MvPowerSeries (Fin 2) K) := + hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> simp) + have he := (leading_approx F G n h).subst_left _ hs (by intro i; fin_cases i <;> simp) + rw [subst_sub hs,←FormalGroup.IsComm.comm,←FormalGroup.IsComm.comm] at he + exact homogeneous_eq_of_jet + (linear_pair_homogeneous _ n (leading_homogeneous F G n) _ _ (by simp) (by simp) + (homogeneous_X 1) (homogeneous_X 0)) (leading_homogeneous F G n) + (he.symm.trans (leading_approx F G n h)) + +lemma leading_evaluate (F G : FormalGroup K) (n : ℕ) + (h : EqJet n F.toPowerSeries G.toPowerSeries) + (a b u v : MvPowerSeries σ K) + (ha : a.constantCoeff=0) (hb : b.constantCoeff=0) + (hu : u.constantCoeff=0) (hv : v.constantCoeff=0) + (hau : EqJet 2 a u) (hbv : EqJet 2 b v) : + EqJet (n+1) (pair F a b-pair G a b) ((leading F G n).subst ![u,v]) := by + have hs : HasSubst (![a,b] : Fin 2 → MvPowerSeries σ K) := + hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> simp [ha,hb]) + have he := (leading_approx F G n h).subst_left _ hs (by intro i; fin_cases i <;> simp [ha,hb]) + rw [subst_sub hs] at he + apply he.trans + apply subst_homogeneous_leading _ n (leading_homogeneous F G n) + · intro i; fin_cases i <;> simp [ha,hb] + · intro i; fin_cases i <;> simp [hu,hv] + · intro i; fin_cases i + · exact hau + · exact hbv + +lemma leading_variation [Finite σ] (F G : FormalGroup K) (n : ℕ) + (h : EqJet n F.toPowerSeries G.toPowerSeries) + (a b c d u v : MvPowerSeries σ K) + (ha : a.constantCoeff=0) (hb : b.constantCoeff=0) + (hc : c.constantCoeff=0) (hd : d.constantCoeff=0) + (hu : u.constantCoeff=0) (hv : v.constantCoeff=0) + (hau : EqJet 2 a u) (hbv : EqJet 2 b v) + (hac : EqJet n a c) (hbd : EqJet n b d) : + EqJet (n+1) (pair F a b-pair G c d) + ((leading F G n).subst ![u,v]+((a-c)+(b-d))) := by + have h₁ := leading_evaluate F G n h a b u v ha hb hu hv hau hbv + have h₂ := law_first_order G n ![a,b] ![c,d] + (by intro i; fin_cases i <;> simp [ha,hb]) (by intro i; fin_cases i <;> simp [hc,hd]) + (by intro i; fin_cases i; exact hac; exact hbd) + convert h₁.add h₂ using 1 + · dsimp only [pair]; ring + · rfl + +lemma leading_associative (F G : FormalGroup K) (n : ℕ) + (h : EqJet n F.toPowerSeries G.toPowerSeries) : + (leading F G n).subst ![(X 0 : MvPowerSeries (Fin 3) K),X 1] + + (leading F G n).subst ![(X 0+X 1 : MvPowerSeries (Fin 3) K),X 2] = + (leading F G n).subst ![(X 1 : MvPowerSeries (Fin 3) K),X 2] + + (leading F G n).subst ![(X 0 : MvPowerSeries (Fin 3) K),X 1+X 2] := by + let x : MvPowerSeries (Fin 3) K := X 0 + let y : MvPowerSeries (Fin 3) K := X 1 + let z : MvPowerSeries (Fin 3) K := X 2 + have hx : x.constantCoeff=0 := by simp [x] + have hy : y.constantCoeff=0 := by simp [y] + have hz : z.constantCoeff=0 := by simp [z] + have hxy : EqJet n (pair F x y) (pair G x y) := + h.subst_left _ (hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> simp [hx,hy])) + (by intro i; fin_cases i <;> simp [hx,hy]) + have hyz : EqJet n (pair F y z) (pair G y z) := + h.subst_left _ (hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> simp [hy,hz])) + (by intro i; fin_cases i <;> simp [hy,hz]) + have hL := leading_variation F G n h (pair F x y) z (pair G x y) z (x+y) z + (pair_const F x y hx hy) hz (pair_const G x y hx hy) hz (by simp [hx,hy]) hz + (pair_linear F x y hx hy) (EqJet.refl 2 z) hxy (EqJet.refl n z) + have hE₁ := leading_evaluate F G n h x y x y hx hy hx hy (EqJet.refl 2 x) (EqJet.refl 2 y) + have hL' : EqJet (n+1) (pair F (pair F x y) z-pair G (pair G x y) z) + ((leading F G n).subst ![x+y,z]+(leading F G n).subst ![x,y]) := by + refine EqJet.trans ?_ ((EqJet.refl _ _).add hE₁) + simpa only [sub_self,add_zero] using hL + have hR := leading_variation F G n h x (pair F y z) x (pair G y z) x (y+z) + hx (pair_const F y z hy hz) hx (pair_const G y z hy hz) hx (by simp [hy,hz]) + (EqJet.refl 2 x) (pair_linear F y z hy hz) (EqJet.refl n x) hyz + have hE₂ := leading_evaluate F G n h y z y z hy hz hy hz (EqJet.refl 2 y) (EqJet.refl 2 z) + have hR' : EqJet (n+1) (pair F x (pair F y z)-pair G x (pair G y z)) + ((leading F G n).subst ![x,y+z]+(leading F G n).subst ![y,z]) := by + refine EqJet.trans ?_ ((EqJet.refl _ _).add hE₂) + simpa only [sub_self,zero_add] using hR + have heq : pair F (pair F x y) z-pair G (pair G x y) z= + pair F x (pair F y z)-pair G x (pair G y z) := by + rw [pair,F.assoc' (.of_constantCoeff_zero hx) (.of_constantCoeff_zero hy) (.of_constantCoeff_zero hz)] + rw [pair,G.assoc' (.of_constantCoeff_zero hx) (.of_constantCoeff_zero hy) (.of_constantCoeff_zero hz)] + rw [heq] at hL' + have hlin (a b : MvPowerSeries (Fin 3) K) (ha : a.constantCoeff=0) (hb : b.constantCoeff=0) + (haH : a.IsHomogeneous 1) (hbH : b.IsHomogeneous 1) : + ((leading F G n).subst ![a,b]).IsHomogeneous n := by + exact linear_pair_homogeneous _ n (leading_homogeneous F G n) a b ha hb haH hbH + have hxH : x.IsHomogeneous 1 := by exact homogeneous_X 0 + have hyH : y.IsHomogeneous 1 := by exact homogeneous_X 1 + have hzH : z.IsHomogeneous 1 := by exact homogeneous_X 2 + have hsumxy : (x+y).IsHomogeneous 1 := by exact hxH.add hyH + have hsumyz : (y+z).IsHomogeneous 1 := by exact hyH.add hzH + have hleft : ((leading F G n).subst ![x+y,z]+(leading F G n).subst ![x,y]).IsHomogeneous n := by + apply MvPowerSeries.IsHomogeneous.add + · exact hlin _ _ (by simp [hx,hy]) hz hsumxy hzH + · exact hlin _ _ hx hy hxH hyH + have hright : ((leading F G n).subst ![x,y+z]+(leading F G n).subst ![y,z]).IsHomogeneous n := by + apply MvPowerSeries.IsHomogeneous.add + · exact hlin _ _ hx (by simp [hy,hz]) hxH hsumyz + · exact hlin _ _ hy hz hyH hzH + simpa only [add_comm] using homogeneous_eq_of_jet hleft hright (hL'.symm.trans hR') + +end HeightThree.HondaLeading + +namespace HeightThree.HondaLeading +open MvPowerSeries HeightThree.HondaJets HeightThree.HomogeneousCocycle HeightThree.HondaTarget +variable {K : Type*} [Field K] + +@[simp] lemma multiplication_zero (F : FormalGroup K) : multiplicationSeries F 0=0 := rfl +lemma multiplication_succ (F : FormalGroup K) (n : ℕ) : + multiplicationSeries F (n+1) = pair F (multiplicationSeries F n) PowerSeries.X := by + change ((n+1) • variablePoint F).val = _ + rw [succ_nsmul] + rfl +@[simp] lemma multiplication_constant (F : FormalGroup K) (n : ℕ) : + MvPowerSeries.constantCoeff (multiplicationSeries F n)=0 := by + induction n with + | zero => simp + | succ n ih => + rw [multiplication_succ] + exact pair_const F _ _ ih (by simp [PowerSeries.X]) + +lemma multiplication_linear (F : FormalGroup K) (i : ℕ) : + EqJet 2 (multiplicationSeries F i) (C (i:K)*PowerSeries.X) := by + induction i with + | zero => simpa using (EqJet.refl 2 (0 : PowerSeries K)) + | succ i ih => + rw [multiplication_succ] + have hh := pair_linear F (multiplicationSeries F i) PowerSeries.X + (by exact multiplication_constant F i) (by simp [PowerSeries.X]) + have hh' := hh.trans (ih.add (EqJet.refl _ PowerSeries.X)) + convert hh' using 1 + simp only [Nat.cast_add,Nat.cast_one,map_add,map_one,add_mul,one_mul] + +lemma multiplication_match (F G : FormalGroup K) (n : ℕ) + (h : EqJet n F.toPowerSeries G.toPowerSeries) (i : ℕ) : + EqJet n (multiplicationSeries F i) (multiplicationSeries G i) := by + induction i with + | zero => exact EqJet.refl _ _ + | succ i ih => + rw [multiplication_succ,multiplication_succ] + have h₁ := h.subst_left ![multiplicationSeries F i,PowerSeries.X] + (hasSubst_of_constantCoeff_zero (by intro j; fin_cases j <;> simp [multiplication_constant,PowerSeries.X])) + (by intro j; fin_cases j <;> simp [multiplication_constant,PowerSeries.X]) + apply h₁.trans + apply EqJet.subst_right G.toPowerSeries + · exact hasSubst_of_constantCoeff_zero (by intro j; fin_cases j <;> simp [multiplication_constant,PowerSeries.X]) + · exact hasSubst_of_constantCoeff_zero (by intro j; fin_cases j <;> simp [multiplication_constant,PowerSeries.X]) + · intro j; fin_cases j + · exact ih + · exact EqJet.refl _ _ + +lemma multiplication_leading_trace (F G : FormalGroup K) (n : ℕ) + (h : EqJet n F.toPowerSeries G.toPowerSeries) (i : ℕ) : + EqJet (n+1) (multiplicationSeries F i-multiplicationSeries G i) + (∑j∈Finset.range i, (leading F G n).subst ![C (j:K)*PowerSeries.X,PowerSeries.X]) := by + induction i with + | zero => simpa using (EqJet.refl (n+1) (0 : PowerSeries K)) + | succ i ih => + rw [multiplication_succ,multiplication_succ,Finset.sum_range_succ] + have hh := leading_variation F G n h (multiplicationSeries F i) PowerSeries.X + (multiplicationSeries G i) PowerSeries.X (C (i:K)*PowerSeries.X) PowerSeries.X + (multiplication_constant F i) (by simp [PowerSeries.X]) + (multiplication_constant G i) (by simp [PowerSeries.X]) + (by simp [PowerSeries.X]) (by simp [PowerSeries.X]) + (multiplication_linear F i) (EqJet.refl _ _) (multiplication_match F G n h i) (EqJet.refl _ _) + have hh₁ : EqJet (n+1) + (pair F (multiplicationSeries F i) PowerSeries.X-pair G (multiplicationSeries G i) PowerSeries.X) + ((leading F G n).subst ![C (i:K)*PowerSeries.X,PowerSeries.X]+ + (multiplicationSeries F i-multiplicationSeries G i)) := by + simpa only [sub_self,add_zero] using hh + have hh₂ := hh₁.trans ((EqJet.refl _ _).add ih) + simpa only [add_comm] using hh₂ + +lemma homogeneous_sum {σ ι : Type*} (s : Finset ι) (f : ι → MvPowerSeries σ K) (n : ℕ) + (hf : ∀ i∈s,(f i).IsHomogeneous n) : (∑i∈s,f i).IsHomogeneous n := by + apply homogeneous_of_coeff + intro d hd; rw [map_sum]; apply Finset.sum_eq_zero + intro i hi + have hh : (f i).IsHomogeneous n := by exact hf i hi + exact hh.coeff_eq_zero hd + +lemma leading_trace_zero (F G : FormalGroup K) (n p : ℕ) + (h : EqJet n F.toPowerSeries G.toPowerSeries) + (hp : multiplicationSeries F p=multiplicationSeries G p) : + (∑i∈Finset.range p, (leading F G n).subst ![C (i:K)*PowerSeries.X,PowerSeries.X])=0 := by + have hh := multiplication_leading_trace F G n h p + rw [hp,sub_self] at hh + apply homogeneous_eq_of_jet _ (homogeneous_zero n) hh.symm + apply homogeneous_sum + intro i hi + apply linear_pair_homogeneous _ n (leading_homogeneous F G n) + · simp [PowerSeries.X] + · simp [PowerSeries.X] + · exact homogeneous_C_mul _ (homogeneous_X ()) + · exact homogeneous_X () + +theorem leading_isCocycle (F G : FormalGroup K) [F.IsComm] [G.IsComm] (n p : ℕ) + (h : EqJet n F.toPowerSeries G.toPowerSeries) + (hp : multiplicationSeries F p=multiplicationSeries G p) : + IsCocycle p (leading F G n) := + ⟨(leading_axis F G n h).1,(leading_axis F G n h).2,leading_symmetric F G n h, + leading_associative F G n h,leading_trace_zero F G n p h hp⟩ + +end HeightThree.HondaLeading + +end + +end OAI diff --git a/lean/OAI/Algebra/FormalGroup/Honda/Logarithm.lean b/lean/OAI/Algebra/FormalGroup/Honda/Logarithm.lean new file mode 100644 index 0000000000000000000000000000000000000000..54a164e233863d7fe0c22244e6ae92e3cb1a17d5 --- /dev/null +++ b/lean/OAI/Algebra/FormalGroup/Honda/Logarithm.lean @@ -0,0 +1,175 @@ +import OAI.Algebra.FormalGroup.Honda.PTypical +import OAI.Algebra.FormalGroup.Honda.Target + +namespace OAI + +noncomputable section + +namespace HeightThree.LogarithmicConstruction + +open MvPowerSeries + +variable {R : Type*} [CommRing R] + +structure StrictLog where + series : PowerSeries R + constant_zero : series.constantCoeff = 0 + linear_one : series.coeff 1 = 1 + +namespace StrictLog + +variable (l : StrictLog (R := R)) + +lemma hasSubst : PowerSeries.HasSubst l.series := + PowerSeries.HasSubst.of_constantCoeff_zero l.constant_zero + +lemma linear_unit : IsUnit (l.series.coeff 1) := l.linear_one ▸ isUnit_one + +def inv : PowerSeries R := l.series.substInvOfIsUnit l.linear_unit + +@[simp] lemma inv_constant : l.inv.constantCoeff = 0 := + PowerSeries.constantCoeff_substInvOfIsUnit _ _ + +lemma inv_hasSubst : PowerSeries.HasSubst l.inv := + PowerSeries.HasSubst.of_constantCoeff_zero l.inv_constant + +@[simp] lemma subst_inv : l.series.subst l.inv = PowerSeries.X := + PowerSeries.subst_substInvOfIsUnit_right _ l.constant_zero l.linear_unit + +@[simp] lemma inv_subst : l.inv.subst l.series = PowerSeries.X := + PowerSeries.subst_substInvOfIsUnit_left _ l.constant_zero l.linear_unit + +@[simp] lemma inv_linear : l.inv.coeff 1 = 1 := by + rw [inv, PowerSeries.coeff_one_substInvOfIsUnit] + have h : l.linear_unit.unit = 1 := by + apply Units.ext + simpa using l.linear_one + rw [h] + rfl + +lemma log_exp {σ : Type*} (a : MvPowerSeries σ R) (ha : PowerSeries.HasSubst a) : + l.series.subst (l.inv.subst a) = a := by + rw [← PowerSeries.subst_comp_subst_apply l.inv_hasSubst ha, l.subst_inv, + PowerSeries.subst_X ha] + +lemma exp_log {σ : Type*} (a : MvPowerSeries σ R) (ha : PowerSeries.HasSubst a) : + l.inv.subst (l.series.subst a) = a := by + rw [← PowerSeries.subst_comp_subst_apply l.hasSubst ha, l.inv_subst, + PowerSeries.subst_X ha] + +lemma subst_injective {σ : Type*} {a b : MvPowerSeries σ R} + (ha : PowerSeries.HasSubst a) (hb : PowerSeries.HasSubst b) + (h : l.series.subst a = l.series.subst b) : a = b := by + have := congrArg (fun x : MvPowerSeries σ R => l.inv.subst x) h + simpa only [l.exp_log a ha, l.exp_log b hb] using this + +def sumSeries : MvPowerSeries (Fin 2) R := + l.series.subst (X 0) + l.series.subst (X 1) + +@[simp] lemma sumSeries_constant : l.sumSeries.constantCoeff = 0 := by + simp only [sumSeries, map_add] + rw [PowerSeries.constantCoeff_subst_eq_zero (by simp) l.series l.constant_zero, + PowerSeries.constantCoeff_subst_eq_zero (by simp) l.series l.constant_zero, add_zero] + +lemma sumSeries_hasSubst : PowerSeries.HasSubst l.sumSeries := + PowerSeries.HasSubst.of_constantCoeff_zero l.sumSeries_constant + +def law : MvPowerSeries (Fin 2) R := l.inv.subst l.sumSeries + +@[simp] lemma law_constant : l.law.constantCoeff = 0 := + PowerSeries.constantCoeff_subst_eq_zero l.sumSeries_constant l.inv l.inv_constant + +@[simp] lemma log_law : l.series.subst l.law = l.sumSeries := + l.log_exp _ l.sumSeries_hasSubst + +lemma coeff_subst_linear {σ : Type*} (f : PowerSeries R) + (a : MvPowerSeries σ R) (ha : a.constantCoeff = 0) (i : σ) : + coeff (Finsupp.single i 1) (f.subst a) = + f.coeff 1 * coeff (Finsupp.single i 1) a := by + classical + rw [PowerSeries.coeff_subst (PowerSeries.HasSubst.of_constantCoeff_zero ha), + finsum_eq_single _ 1] + · simp + · intro n hn + by_cases hn0 : n = 0 + · subst n + simp [MvPowerSeries.coeff_one] + · have hlt : ((Finsupp.degree (Finsupp.single i 1 : σ →₀ ℕ) : ℕ) : ℕ∞) < (n : ℕ∞) := by + simpa using (show (1 : ℕ∞) < (n : ℕ∞) by exact_mod_cast (by omega : 1 < n)) + rw [coeff_of_lt_order (lt_of_lt_of_le hlt + (le_order_pow_of_constantCoeff_eq_zero n ha)), smul_zero] + +@[simp] lemma sumSeries_linear (i : Fin 2) : + coeff (Finsupp.single i 1) l.sumSeries = 1 := by + simp only [sumSeries, map_add] + rw [coeff_subst_linear _ _ (by simp), coeff_subst_linear _ _ (by simp), + l.linear_one, one_mul, one_mul] + fin_cases i <;> simp [coeff_index_single_X] + +@[simp] lemma law_linear (i : Fin 2) : + coeff (Finsupp.single i 1) l.law = 1 := by + rw [law, coeff_subst_linear _ _ l.sumSeries_constant, l.inv_linear, + l.sumSeries_linear, one_mul] + +lemma subst_after_mv {σ τ : Type*} (f : PowerSeries R) + (a : MvPowerSeries σ R) (ha : PowerSeries.HasSubst a) + (b : σ → MvPowerSeries τ R) (hb : MvPowerSeries.HasSubst b) : + (f.subst a).subst b = f.subst (a.subst b) := by + exact MvPowerSeries.subst_comp_subst_apply ha.const hb f + +lemma law_pair {σ : Type*} (a b : MvPowerSeries σ R) + (ha : a.constantCoeff = 0) (hb : b.constantCoeff = 0) : + l.law.subst ![a, b] = l.inv.subst (l.series.subst a + l.series.subst b) := by + have hab : MvPowerSeries.HasSubst ![a, b] := + hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> assumption) + rw [law, subst_after_mv _ _ l.sumSeries_hasSubst _ hab] + congr 1 + rw [sumSeries, MvPowerSeries.subst_add hab, + subst_after_mv _ _ (PowerSeries.HasSubst.X 0) _ hab, + subst_after_mv _ _ (PowerSeries.HasSubst.X 1) _ hab, + MvPowerSeries.subst_X hab, MvPowerSeries.subst_X hab] + rfl + +lemma law_pair_constant {σ : Type*} (a b : MvPowerSeries σ R) + (ha : a.constantCoeff = 0) (hb : b.constantCoeff = 0) : + (l.law.subst ![a, b]).constantCoeff = 0 := by + apply MvPowerSeries.constantCoeff_subst_eq_zero + (hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> assumption)) + (by intro i; fin_cases i <;> assumption) l.law_constant + +lemma log_law_pair {σ : Type*} (a b : MvPowerSeries σ R) + (ha : a.constantCoeff = 0) (hb : b.constantCoeff = 0) : + l.series.subst (l.law.subst ![a, b]) = l.series.subst a + l.series.subst b := by + rw [l.law_pair a b ha hb] + exact l.log_exp _ (PowerSeries.HasSubst.of_constantCoeff_zero (by + rw [map_add, PowerSeries.constantCoeff_subst_eq_zero ha _ l.constant_zero, + PowerSeries.constantCoeff_subst_eq_zero hb _ l.constant_zero, add_zero])) + +def formalGroup : FormalGroup R where + toPowerSeries := l.law + zero_constantCoeff := l.law_constant + lin_coeff_X := l.law_linear 0 + lin_coeff_Y := l.law_linear 1 + assoc := by + have hX (i : Fin 3) : (X i : MvPowerSeries (Fin 3) R).constantCoeff = 0 := by simp + apply l.subst_injective + (PowerSeries.HasSubst.of_constantCoeff_zero + (l.law_pair_constant _ _ (l.law_pair_constant _ _ (hX 0) (hX 1)) (hX 2))) + (PowerSeries.HasSubst.of_constantCoeff_zero + (l.law_pair_constant _ _ (hX 0) (l.law_pair_constant _ _ (hX 1) (hX 2)))) + rw [l.log_law_pair _ _ (l.law_pair_constant _ _ (hX 0) (hX 1)) (hX 2), + l.log_law_pair _ _ (hX 0) (l.law_pair_constant _ _ (hX 1) (hX 2)), + l.log_law_pair _ _ (hX 0) (hX 1), l.log_law_pair _ _ (hX 1) (hX 2), add_assoc] + +instance formalGroup_isComm : l.formalGroup.IsComm where + comm := by + change l.law = l.law.subst ![X 1, X 0] + rw [l.law_pair _ _ (by simp) (by simp)] + exact congrArg (PowerSeries.subst · l.inv) (add_comm _ _) + +end StrictLog +end HeightThree.LogarithmicConstruction + +end + +end OAI diff --git a/lean/OAI/Algebra/FormalGroup/Honda/Main.lean b/lean/OAI/Algebra/FormalGroup/Honda/Main.lean new file mode 100644 index 0000000000000000000000000000000000000000..6d6bbb31f14919139907f035f00c0873719f4ec2 --- /dev/null +++ b/lean/OAI/Algebra/FormalGroup/Honda/Main.lean @@ -0,0 +1,43 @@ +import OAI.Algebra.FormalGroup.Honda.HeightTransport + +namespace OAI + +universe uK + +noncomputable section + +namespace HeightThree.HondaTarget +open HeightThree.HondaConstruction HeightThree.HondaCoordinates HeightThree.HondaSpecialFiber +open HeightThree.CanonicalUniversality HeightThree.HondaClassification +open HeightThree.CoordinateTransport HeightThree.UniversalTransport HeightThree.HeightTransport + +theorem universal_framed_honda_height_coordinates + (p : ℕ) [Fact p.Prime] (_ : 5 ≤ p) + (K : Type uK) [Field K] [Finite K] [CharP K p] + (_ : Nonempty (GaloisField p 6 →+* K)) + (Γ : FormalGroup K) [Γ.IsComm] + (hΓ : multiplicationSeries Γ p = PowerSeries.X ^ (p^3)) : + HasUniversalHeightCoordinates p Γ := by + obtain ⟨e,he⟩ := strict_honda_isomorphic p 3 Γ (hondaLaw p K) hΓ (integralSpecial_honda p K) + let c := Coordinate.ofIso e + let cB := c.map (algebraMap K (Base K)) + have hc : c.transport (hondaLaw p K)=Γ := Coordinate.transport_ofIso e + have hcB : cB.map MvPowerSeries.constantCoeff=c := by + rw [show cB=c.map (algebraMap K (Base K)) from rfl,coordinate_map_map] + have hh : MvPowerSeries.constantCoeff.comp (algebraMap K (Base K))=RingHom.id K := by + ext a + simp [MvPowerSeries.algebraMap_apply] + rw [hh,coordinate_map_id] + have hs : cB.series.coeff 1=1 := strict_map c he _ + refine ⟨cB.transport (reducedHonda p K),inferInstance,?_,?_,?_⟩ + · rw [cB.transport_map,hcB,reducedHonda_specialFiber,hc] + · have hh := isUniversal_transport (hondaLaw p K) (reducedHonda p K) + (reducedHonda_isUniversal p K) c + rwa [hc] at hh + · exact heightCoordinates_transport p _ (reducedHonda_heightCoordinates p K) cB hs + +end HeightThree.HondaTarget + +end + +end OAI diff --git a/lean/OAI/Algebra/FormalGroup/Honda/NilpotentTower.lean b/lean/OAI/Algebra/FormalGroup/Honda/NilpotentTower.lean new file mode 100644 index 0000000000000000000000000000000000000000..f46b60e831bc9eb6d873f0e1cce9206b151d1c55 --- /dev/null +++ b/lean/OAI/Algebra/FormalGroup/Honda/NilpotentTower.lean @@ -0,0 +1,85 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace HeightThree.NilpotentTower +variable {K R : Type*} [Field K] [CommRing R] [Algebra K R] + +def quotient (ρ : R →ₐ[K] K) (n : ℕ) := R ⧸ (RingHom.ker ρ)^(n+1) + +instance (ρ : R →ₐ[K] K) (n : ℕ) : CommRing (quotient ρ n) := inferInstanceAs (CommRing (R ⧸ _)) +instance (ρ : R →ₐ[K] K) (n : ℕ) : Algebra K (quotient ρ n) := inferInstanceAs (Algebra K (R ⧸ _)) + +def projection (ρ : R →ₐ[K] K) (n : ℕ) : R →ₐ[K] quotient ρ n := + Ideal.Quotient.mkₐ K _ + +def augmentation (ρ : R →ₐ[K] K) (n : ℕ) : quotient ρ n →ₐ[K] K := + Ideal.Quotient.liftₐ _ ρ (fun _ ha => Ideal.pow_le_self (Nat.succ_ne_zero _) ha) + +@[simp] lemma augmentation_projection (ρ : R →ₐ[K] K) (n : ℕ) (a : R) : + augmentation ρ n (projection ρ n a)=ρ a := rfl + +lemma projection_surjective (ρ : R →ₐ[K] K) (n : ℕ) : + Function.Surjective (projection ρ n) := Ideal.Quotient.mkₐ_surjective K _ + +lemma projection_eq_zero (ρ : R →ₐ[K] K) (n : ℕ) (a : R) : + projection ρ n a=0 ↔ a∈(RingHom.ker ρ)^(n+1) := Ideal.Quotient.eq_zero_iff_mem + +lemma augmentation_ker (ρ : R →ₐ[K] K) (n : ℕ) : + RingHom.ker (augmentation ρ n)=Ideal.map (projection ρ n) (RingHom.ker ρ) := by + ext a + rw [Ideal.mem_map_iff_of_surjective _ (projection_surjective ρ n)] + constructor + · intro ha + obtain ⟨b,rfl⟩ := projection_surjective ρ n a + exact ⟨b,ha,rfl⟩ + · rintro ⟨b,hb,rfl⟩ + exact hb + +lemma augmentation_nilpotent (ρ : R →ₐ[K] K) (n : ℕ) : + (RingHom.ker (augmentation ρ n))^(n+1)=⊥ := by + rw [augmentation_ker,←Ideal.map_pow,Ideal.map_eq_bot_iff_le_ker] + intro a ha + exact (projection_eq_zero ρ n a).mpr ha + +lemma projection_ker_le (ρ : R →ₐ[K] K) (n : ℕ) (a : R) + (ha : projection ρ n a=0) : ρ a=0 := by + exact Ideal.pow_le_self (Nat.succ_ne_zero n) ((projection_eq_zero ρ n a).mp ha) + +lemma projection_annihilate (ρ : R →ₐ[K] K) (n : ℕ) + (h : (RingHom.ker ρ)^(n+2)=⊥) (a b : R) + (ha : projection ρ n a=0) (hb : ρ b=0) : a*b=0 := by + have hh := Ideal.mul_mem_mul ((projection_eq_zero ρ n a).mp ha) (show b∈RingHom.ker ρ from hb) + rw [←pow_succ,show n+1+1=n+2 by omega,h] at hh + exact hh + +lemma nilpotent_of_mem_ker (ρ : R →ₐ[K] K) {n : ℕ} + (h : (RingHom.ker ρ)^n=⊥) {a : R} (ha : ρ a=0) : IsNilpotent a := by + refine ⟨n,?_⟩ + have hh := Ideal.pow_mem_pow (show a∈RingHom.ker ρ from ha) n + rw [h] at hh + exact hh + +lemma augmentation_surjective (ρ : R →ₐ[K] K) : Function.Surjective ρ := by + intro a; refine ⟨algebraMap K R a,?_⟩ + simp + +lemma finite_local_nilpotent [IsLocalRing R] [FiniteDimensional K R] (ρ : R →ₐ[K] K) : + ∃ n, (RingHom.ker ρ)^(n+1)=⊥ := by + have : IsArtinianRing R := IsArtinianRing.of_finite K R + have hj := IsArtinianRing.isNilpotent_jacobson_bot (R := R) + rw [IsLocalRing.jacobson_eq_maximalIdeal _ bot_ne_top, + ←IsLocalRing.ker_eq_maximalIdeal ρ.toRingHom (augmentation_surjective ρ)] at hj + obtain ⟨n,hn⟩ := hj + change (RingHom.ker ρ)^n=0 at hn + refine ⟨n,?_⟩ + rw [pow_succ,hn,zero_mul] + rfl + +end HeightThree.NilpotentTower + +end + +end OAI diff --git a/lean/OAI/Algebra/FormalGroup/Honda/PTypical.lean b/lean/OAI/Algebra/FormalGroup/Honda/PTypical.lean new file mode 100644 index 0000000000000000000000000000000000000000..a8af648038efdd91a68c16f928c816f446fb9bbd --- /dev/null +++ b/lean/OAI/Algebra/FormalGroup/Honda/PTypical.lean @@ -0,0 +1,513 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace HeightThree.PTypical + +variable {A B : Type*} [CommRing A] [CommRing B] + +def series (p : ℕ) (c : ℕ → B) : PowerSeries B := + PowerSeries.mk (Function.extend (fun n : ℕ => p^n) c (fun _ => 0)) + +@[simp] theorem coeff_series_power (p : ℕ) (hp : 2 ≤ p) (c : ℕ → B) (n : ℕ) : + (series p c).coeff (p^n) = c n := by + simp only [series, PowerSeries.coeff_mk, (Nat.pow_right_injective hp).extend_apply] + +@[simp] theorem coeff_series_outside (p j : ℕ) (c : ℕ → B) + (hj : ¬ ∃ n : ℕ, p^n = j) : (series p c).coeff j = 0 := by + simp only [series, PowerSeries.coeff_mk, Function.extend_apply' c (fun _ => 0) j hj] + +@[simp] theorem series_constant (p : ℕ) (hp : 2 ≤ p) (c : ℕ → B) : + (series p c).constantCoeff = 0 := by + rw [← PowerSeries.coeff_zero_eq_constantCoeff] + exact coeff_series_outside p 0 c (by + rintro ⟨n, hn⟩ + exact pow_ne_zero n (by omega : p ≠ 0) hn) + +@[simp] theorem series_linear (p : ℕ) (hp : 2 ≤ p) (c : ℕ → B) : + (series p c).coeff 1 = c 0 := by + simpa only [pow_zero] using coeff_series_power p hp c 0 + +def HasIntegralNumerators [Algebra ℚ B] (ι : A →+* B) (p : ℕ) + (f : PowerSeries B) : Prop := + ∀ j, (f.coeff j = 0) ∨ + ∃ n : ℕ, j = p^n ∧ ∃ a : A, f.coeff j = ((p : ℚ)⁻¹)^n • ι a + +theorem series_integralNumerators [Algebra ℚ B] (ι : A →+* B) + (p : ℕ) (hp : 2 ≤ p) (a : ℕ → A) : + HasIntegralNumerators ι p (series p (fun n => ((p : ℚ)⁻¹)^n • ι (a n))) := by + intro j + by_cases hj : ∃ n : ℕ, p^n = j + · obtain ⟨n, rfl⟩ := hj + right + exact ⟨n, rfl, a n, coeff_series_power p hp _ n⟩ + · exact Or.inl (coeff_series_outside p j _ hj) + +def IntegralSeries (ι : A →+* B) {σ : Type*} (f : MvPowerSeries σ B) : Prop := + ∀ d, ∃ a : A, ι a = MvPowerSeries.coeff d f + +def integralLift (ι : A →+* B) {σ : Type*} (f : MvPowerSeries σ B) + (hf : IntegralSeries ι f) : MvPowerSeries σ A := + fun d => (hf d).choose + +theorem map_integralLift (ι : A →+* B) {σ : Type*} (f : MvPowerSeries σ B) + (hf : IntegralSeries ι f) : MvPowerSeries.map ι (integralLift ι f hf) = f := by + ext d + exact (hf d).choose_spec + +theorem integral_iff_range (ι : A →+* B) {σ : Type*} (f : MvPowerSeries σ B) : + IntegralSeries ι f ↔ f ∈ (MvPowerSeries.map ι : MvPowerSeries σ A →+* + MvPowerSeries σ B).range := by + constructor + · intro hf + exact ⟨integralLift ι f hf, map_integralLift ι f hf⟩ + · rintro ⟨a, rfl⟩ d + exact ⟨MvPowerSeries.coeff d a, by simp⟩ + +theorem power_difference (p n : ℕ) {σ : Type*} + {a b : MvPowerSeries σ A} (h : (p : MvPowerSeries σ A) ∣ a - b) : + ∃ v : MvPowerSeries σ A, + a^(p^n) - b^(p^n) = (p : MvPowerSeries σ A)^(n+1) * v := + dvd_sub_pow_of_dvd_sub h n + +theorem rational_cancel (p : ℕ) (hp : p ≠ 0) (n : ℕ) [Algebra ℚ B] (x : B) : + (((p : ℚ)⁻¹)^n) • ((p : B)^(n+1) * x) = (p : B) * x := by + have hpQ : (p : ℚ) ≠ 0 := by exact_mod_cast hp + have hc : (((p : ℚ)⁻¹)^n) • ((p : B)^n) = 1 := by + rw [Algebra.smul_def] + calc + _ = algebraMap ℚ B ((((p : ℚ)⁻¹)^n) * (p : ℚ)^n) := by simp + _ = 1 := by simp [hpQ] + rw [pow_succ, mul_assoc, ← smul_mul_assoc, hc, one_mul] + +theorem logarithm_difference [Algebra ℚ B] (ι : A →+* B) (p : ℕ) + (hp : p ≠ 0) (f : PowerSeries B) (hf : HasIntegralNumerators ι p f) + {σ : Type*} (a b : MvPowerSeries σ A) + (ha : a.constantCoeff = 0) (hb : b.constantCoeff = 0) + (hab : (p : MvPowerSeries σ A) ∣ a - b) : + ∃ v : MvPowerSeries σ A, + f.subst (a.map ι) - f.subst (b.map ι) = + (p : MvPowerSeries σ B) * v.map ι := by + classical + let θ : A →+ B := (AddMonoidHom.mulLeft (p : B)).comp ι.toAddMonoidHom + have ha' : PowerSeries.HasSubst (a.map ι) := + PowerSeries.HasSubst.of_constantCoeff_zero (by simp [ha]) + have hb' : PowerSeries.HasSubst (b.map ι) := + PowerSeries.HasSubst.of_constantCoeff_zero (by simp [hb]) + have hc (d : σ →₀ ℕ) : + MvPowerSeries.coeff d (f.subst (a.map ι) - f.subst (b.map ι)) ∈ θ.range := by + rw [map_sub, PowerSeries.coeff_subst ha', PowerSeries.coeff_subst hb', + ← finsum_sub_distrib (PowerSeries.coeff_subst_finite ha' f d) + (PowerSeries.coeff_subst_finite hb' f d)] + refine finsum_induction (fun z => z ∈ θ.range) θ.range.zero_mem + (fun _ _ => θ.range.add_mem) ?_ + intro j + rcases hf j with hzero | ⟨n, rfl, u, hu⟩ + · simp [hzero] + obtain ⟨w, hw⟩ := power_difference p n hab + have hwc : ι (MvPowerSeries.coeff d (a^(p^n))) - + ι (MvPowerSeries.coeff d (b^(p^n))) = + (p : B)^(n+1) * ι (MvPowerSeries.coeff d w) := by + have hh := congrArg (fun z => ι (MvPowerSeries.coeff d z)) hw + rw [map_sub, map_sub] at hh + rw [← map_natCast (MvPowerSeries.C (σ := σ) (R := A)), ← map_pow, + MvPowerSeries.coeff_C_mul] at hh + simpa using hh + refine ⟨u * MvPowerSeries.coeff d w, ?_⟩ + change (p : B) * ι (u * MvPowerSeries.coeff d w) = _ + simp only [hu, ← map_pow, MvPowerSeries.coeff_map, smul_eq_mul, + ← mul_sub, hwc] + rw [smul_mul_assoc] + calc + (p : B) * ι (u * MvPowerSeries.coeff d w) = + ((p : ℚ)⁻¹)^n • ((p : B)^(n+1) * (ι u * ι (MvPowerSeries.coeff d w))) := by + rw [rational_cancel p hp, map_mul] + _ = ((p : ℚ)⁻¹)^n • (ι u * ((p : B)^(n+1) * ι (MvPowerSeries.coeff d w))) := by + congr 1 + ring + choose v hv using hc + refine ⟨fun d => v d, ?_⟩ + ext d + have hh := hv d + change (p : B) * ι (v d) = _ at hh + rw [← map_natCast (MvPowerSeries.C (σ := σ) (R := B)), MvPowerSeries.coeff_C_mul] + change _ = (p : B) * ι (v d) + exact hh.symm + +lemma constant_dvd_iff {σ : Type*} (r : A) (a : MvPowerSeries σ A) : + MvPowerSeries.C r ∣ a ↔ ∀ d, r ∣ MvPowerSeries.coeff d a := by + constructor + · rintro ⟨b, rfl⟩ d + exact ⟨MvPowerSeries.coeff d b, MvPowerSeries.coeff_C_mul d b r⟩ + · intro h + choose b hb using h + let c : MvPowerSeries σ A := fun d => b d + refine ⟨c, ?_⟩ + ext d + exact (hb d).trans (MvPowerSeries.coeff_C_mul d c r).symm + +theorem frobenius_lift_series (p : ℕ) [hp : Fact p.Prime] + (ψ : A →+* A) (hψ : ∀ a : A, (p : A) ∣ ψ a - a^p) + {σ : Type*} (a : MvPowerSeries σ A) : + (p : MvPowerSeries σ A) ∣ + (a.map ψ).expand p hp.out.ne_zero - a^p := by + by_cases hu : IsUnit (p : A) + · have hu' : IsUnit (p : MvPowerSeries σ A) := by + simpa using hu.map (MvPowerSeries.C (σ := σ) (R := A)) + exact hu'.dvd + let I : Ideal A := Ideal.span {(p : A)} + let π : A →+* A ⧸ I := Ideal.Quotient.mk I + let : CharP (A ⧸ I) p := CharP.quotient A p hu + have hπ : π.comp ψ = (frobenius (A ⧸ I) p).comp π := by + ext x + change π (ψ x) = (π x)^p + rw [← map_pow, Ideal.Quotient.eq, Ideal.mem_span_singleton] + exact hψ x + have heq : (((a.map ψ).expand p hp.out.ne_zero) - a^p).map π = 0 := by + rw [map_sub, MvPowerSeries.map_expand, MvPowerSeries.map_map, hπ, + ← MvPowerSeries.map_map, ← MvPowerSeries.map_expand, + MvPowerSeries.map_frobenius_expand, map_pow, sub_self] + rw [← map_natCast (MvPowerSeries.C (σ := σ) (R := A)), constant_dvd_iff] + intro d + have hd := congrArg (MvPowerSeries.coeff d) heq + rw [MvPowerSeries.coeff_map, map_zero] at hd + exact Ideal.mem_span_singleton.mp (Ideal.Quotient.eq_zero_iff_mem.mp hd) + +def twist {σ : Type*} (p : ℕ) (hp : p ≠ 0) (ψ : A →+* A) : + MvPowerSeries σ A →+* MvPowerSeries σ A := + (MvPowerSeries.expand p hp).toRingHom.comp (MvPowerSeries.map ψ) + +@[simp] lemma twist_coe {σ : Type*} (p : ℕ) (hp : p ≠ 0) (ψ : A →+* A) + (a : MvPowerSeries σ A) : twist p hp ψ a = (a.map ψ).expand p hp := rfl + +theorem twist_iterate_congr (p : ℕ) [hp : Fact p.Prime] + (ψ : A →+* A) (hψ : ∀ a : A, (p : A) ∣ ψ a - a^p) + {σ : Type*} (a : MvPowerSeries σ A) (n : ℕ) : + (p : MvPowerSeries σ A) ∣ + (twist p hp.out.ne_zero ψ ^ n) a - a^(p^n) := by + induction n with + | zero => simp + | succ n ih => + rw [pow_succ', pow_succ, pow_mul] + change (p : MvPowerSeries σ A) ∣ + twist p hp.out.ne_zero ψ ((twist p hp.out.ne_zero ψ ^ n) a) - (a^(p^n))^p + have h₁ := frobenius_lift_series p ψ hψ ((twist p hp.out.ne_zero ψ ^ n) a) + have h₂ := ih.trans (sub_dvd_pow_sub_pow _ _ p) + simpa only [twist_coe, sub_add_sub_cancel] using dvd_add h₁ h₂ + +theorem twist_iterate {σ : Type*} (p : ℕ) (hp : p ≠ 0) (ψ : A →+* A) + (a : MvPowerSeries σ A) (n : ℕ) : + (twist p hp ψ ^ n) a = (a.map (ψ^n)).expand (p^n) (pow_ne_zero n hp) := by + induction n with + | zero => + change a = (a.map (RingHom.id A)).expand 1 _ + simp [MvPowerSeries.map_id] + | succ n ih => + rw [pow_succ'] + change twist p hp ψ ((twist p hp ψ ^ n) a) = _ + rw [ih, twist_coe, MvPowerSeries.map_expand, MvPowerSeries.map_map, + ← MvPowerSeries.expand_mul] + simp only [pow_succ', RingHom.mul_def] + +@[simp] theorem twist_iterate_constant {σ : Type*} (p : ℕ) (hp : p ≠ 0) (ψ : A →+* A) + (a : MvPowerSeries σ A) (n : ℕ) : + ((twist p hp ψ ^ n) a).constantCoeff = (ψ^n) a.constantCoeff := by + simp [twist_iterate] + +theorem map_twist_iterate {σ : Type*} (p : ℕ) (hp : p ≠ 0) + (ι : A →+* B) (ψ : A →+* A) (χ : B →+* B) (hc : χ.comp ι = ι.comp ψ) + (a : MvPowerSeries σ A) (n : ℕ) : + (MvPowerSeries.map ι) ((twist p hp ψ ^ n) a) = + (twist p hp χ ^ n) (a.map ι) := by + induction n with + | zero => rfl + | succ n ih => + rw [pow_succ' (twist p hp ψ), pow_succ' (twist p hp χ)] + change (twist p hp ψ ((twist p hp ψ ^ n) a)).map ι = + twist p hp χ ((twist p hp χ ^ n) (a.map ι)) + rw [twist_coe, twist_coe, MvPowerSeries.map_expand, ← ih, + MvPowerSeries.map_map, MvPowerSeries.map_map, hc] + +theorem twist_iterate_subst {σ : Type*} (p : ℕ) (hp : p ≠ 0) (ψ : A →+* A) + (f : PowerSeries A) (a : MvPowerSeries σ A) (ha : PowerSeries.HasSubst a) (n : ℕ) : + (twist p hp ψ ^ n) (f.subst a) = + (f.map (ψ^n)).subst ((twist p hp ψ ^ n) a) := by + rw [twist_iterate, twist_iterate, PowerSeries.map_subst ha, + PowerSeries.expand_subst _ _ (show PowerSeries.HasSubst (a.map (ψ^n)) from by + simpa only [PowerSeries.HasSubst, MvPowerSeries.constantCoeff_map] using ha.map (ψ^n))] + +theorem integralNumerators_map [Algebra ℚ B] (ι : A →+* B) + (ψ : A →+* A) (χ : B →ₐ[ℚ] B) (hc : χ.toRingHom.comp ι = ι.comp ψ) + (p : ℕ) (f : PowerSeries B) (hf : HasIntegralNumerators ι p f) : + HasIntegralNumerators ι p (f.map χ.toRingHom) := by + intro j + rw [PowerSeries.coeff_map] + rcases hf j with h | ⟨n, hn, a, ha⟩ + · left; simp [h] + · right + refine ⟨n, hn, ψ a, ?_⟩ + rw [ha] + change χ (((p : ℚ)⁻¹)^n • ι a) = _ + rw [χ.map_smul_of_tower] + congr 1 + exact DFunLike.congr_fun hc a + +theorem integralNumerators_map_iterate [Algebra ℚ B] (ι : A →+* B) + (ψ : A →+* A) (χ : B →ₐ[ℚ] B) (hc : χ.toRingHom.comp ι = ι.comp ψ) + (p : ℕ) (f : PowerSeries B) (hf : HasIntegralNumerators ι p f) (n : ℕ) : + HasIntegralNumerators ι p (f.map (χ.toRingHom^n)) := by + induction n with + | zero => exact hf + | succ n ih => + rw [pow_succ'] + exact integralNumerators_map ι ψ χ hc p _ ih + +theorem order_difference_powers {σ : Type*} (a b : MvPowerSeries σ A) + (ha : a.constantCoeff = 0) (hb : b.constantCoeff = 0) (n : ℕ) + (hab : (n : ℕ∞) ≤ (a - b).order) (k : ℕ) : + ((n+k : ℕ) : ℕ∞) ≤ (a^(k+1) - b^(k+1)).order := by + induction k with + | zero => simpa using hab + | succ k ih => + have heq : a^(k+1+1) - b^(k+1+1) = + a * (a^(k+1) - b^(k+1)) + (a-b) * b^(k+1) := by ring + rw [heq] + apply le_trans _ MvPowerSeries.min_order_le_add + apply le_min + · apply le_trans _ MvPowerSeries.le_order_mul + calc + ((n+(k+1) : ℕ) : ℕ∞) = 1 + ((n+k : ℕ) : ℕ∞) := by push_cast; ac_rfl + _ ≤ a.order + (a^(k+1) - b^(k+1)).order := add_le_add + (MvPowerSeries.one_le_order_iff_constCoeff_eq_zero.mpr ha) ih + · apply le_trans _ MvPowerSeries.le_order_mul + calc + ((n+(k+1) : ℕ) : ℕ∞) = (n : ℕ∞) + ((k+1 : ℕ) : ℕ∞) := by simp + _ ≤ (a-b).order + (b^(k+1)).order := add_le_add hab + (MvPowerSeries.le_order_pow_of_constantCoeff_eq_zero (k+1) hb) + +theorem coeff_log_difference {σ : Type*} (f : PowerSeries A) (hf : f.coeff 1 = 1) + (a b : MvPowerSeries σ A) (ha : a.constantCoeff = 0) (hb : b.constantCoeff = 0) + (n : ℕ) (hab : (n : ℕ∞) ≤ (a-b).order) (d : σ →₀ ℕ) (hd : d.degree ≤ n) : + MvPowerSeries.coeff d (f.subst a - f.subst b) = MvPowerSeries.coeff d (a-b) := by + have ha' := PowerSeries.HasSubst.of_constantCoeff_zero ha + have hb' := PowerSeries.HasSubst.of_constantCoeff_zero hb + rw [map_sub, PowerSeries.coeff_subst ha', PowerSeries.coeff_subst hb', + ← finsum_sub_distrib (PowerSeries.coeff_subst_finite ha' f d) + (PowerSeries.coeff_subst_finite hb' f d), finsum_eq_single _ 1] + · simp [hf] + · intro j hj + rw [← smul_sub, ← map_sub] + by_cases hj0 : j = 0 + · simp [hj0] + · obtain ⟨k, rfl⟩ := Nat.exists_eq_succ_of_ne_zero hj0 + have hk : 0 < k := by omega + have hlt : (d.degree : ℕ∞) < ((n+k : ℕ) : ℕ∞) := by exact_mod_cast (by omega : d.degree < n+k) + rw [MvPowerSeries.coeff_of_lt_order (hlt.trans_le + (order_difference_powers a b ha hb n hab k)), smul_zero] + +theorem order_log_difference {σ : Type*} (f : PowerSeries A) (hf : f.coeff 1 = 1) + (a b : MvPowerSeries σ A) (ha : a.constantCoeff = 0) (hb : b.constantCoeff = 0) + (n : ℕ) (hab : (n : ℕ∞) ≤ (a-b).order) : + (n : ℕ∞) ≤ (f.subst a - f.subst b).order := by + apply MvPowerSeries.nat_le_order + intro d hd + rw [coeff_log_difference f hf a b ha hb n hab d hd.le] + exact MvPowerSeries.coeff_of_lt_order (lt_of_lt_of_le (by exact_mod_cast hd) hab) + +theorem coeff_twist_iterate_zero {σ : Type*} (p : ℕ) (hp : 2 ≤ p) + (ψ : A →+* A) (a : MvPowerSeries σ A) (k : ℕ) (hk : 0 < k) + (n : ℕ) (hn : 0 < n) (ha : (n : ℕ∞) ≤ a.order) + (d : σ →₀ ℕ) (hd : d.degree ≤ n) : + MvPowerSeries.coeff d ((twist p (by omega) ψ ^ k) a) = 0 := by + rw [twist_iterate] + apply MvPowerSeries.coeff_of_lt_order + rw [MvPowerSeries.order_expand, nsmul_eq_mul] + have hpk : 1 < p^k := one_lt_pow₀ (by omega) (by omega) + have hlt : d.degree < p^k * n := lt_of_le_of_lt hd (by nlinarith) + calc + (d.degree : ℕ∞) < ((p^k * n : ℕ) : ℕ∞) := by exact_mod_cast hlt + _ = (p^k : ℕ) * (n : ℕ∞) := by simp + _ ≤ (p^k : ℕ) * (a.map (ψ^k)).order := by + gcongr + exact ha.trans (MvPowerSeries.le_order_map _) + +theorem subst_twist_iterate {σ : Type*} (p : ℕ) (hp : p ≠ 0) (ψ : A →+* A) + (f : PowerSeries A) (a : MvPowerSeries σ A) (ha : PowerSeries.HasSubst a) (n : ℕ) : + PowerSeries.subst a ((twist p hp ψ ^ n) f) = (f.map (ψ^n)).subst (a^(p^n)) := by + rw [twist_iterate] + change ((f.map (ψ^n)).expand (p^n) (pow_ne_zero n hp)).subst a = _ + rw [PowerSeries.expand_apply, PowerSeries.subst_comp_subst_apply + (PowerSeries.HasSubst.X_pow (pow_ne_zero n hp)) ha, + PowerSeries.subst_pow ha, PowerSeries.subst_X ha] + +lemma divide_p_mul [Algebra ℚ B] (p : ℕ) (hp : p ≠ 0) (x : B) : + (p : ℚ)⁻¹ • ((p : B) * x) = x := by + have h : (p : B) * x = (p : ℚ) • x := by simp [Algebra.smul_def] + rw [h, inv_smul_smul₀ (by exact_mod_cast hp : (p : ℚ) ≠ 0)] + +def defect [Algebra ℚ B] {σ : Type*} (p : ℕ) (hp : p ≠ 0) + (χ : B →+* B) (v : Fin 3 → B) (f : MvPowerSeries σ B) : MvPowerSeries σ B := + f - ∑ i : Fin 3, (p : ℚ)⁻¹ • (v i • ((twist p hp χ ^ (i.val+1)) f)) + +lemma defect_add [Algebra ℚ B] {σ : Type*} (p : ℕ) (hp : p ≠ 0) + (χ : B →+* B) (v : Fin 3 → B) (f g : MvPowerSeries σ B) : + defect p hp χ v (f+g) = defect p hp χ v f + defect p hp χ v g := by + simp only [defect, map_add, smul_add, Finset.sum_add_distrib] + abel + +lemma defect_sub [Algebra ℚ B] {σ : Type*} (p : ℕ) (hp : p ≠ 0) + (χ : B →+* B) (v : Fin 3 → B) (f g : MvPowerSeries σ B) : + defect p hp χ v (f-g) = defect p hp χ v f - defect p hp χ v g := by + simp only [defect, map_sub, smul_sub, Finset.sum_sub_distrib] + abel + +theorem coeff_defect_le [Algebra ℚ B] {σ : Type*} (p : ℕ) (hp : 2 ≤ p) + (χ : B →+* B) (v : Fin 3 → B) (f : MvPowerSeries σ B) + (n : ℕ) (hn : 0 < n) (hf : (n : ℕ∞) ≤ f.order) + (d : σ →₀ ℕ) (hd : d.degree ≤ n) : + MvPowerSeries.coeff d (defect p (by omega) χ v f) = MvPowerSeries.coeff d f := by + simp only [defect, map_sub, map_sum] + have hz (i : Fin 3) : MvPowerSeries.coeff d + ((p : ℚ)⁻¹ • (v i • ((twist p (by omega) χ ^ (i.val+1)) f))) = 0 := by + rw [(MvPowerSeries.coeff d).map_smul_of_tower, MvPowerSeries.coeff_smul, + coeff_twist_iterate_zero p hp χ f (i.val+1) (by omega) n hn hf d hd, + mul_zero, smul_zero] + simp only [hz, Finset.sum_const_zero, sub_zero] + +theorem defect_subst_eq [Algebra ℚ B] {σ : Type*} (p : ℕ) (hp : p ≠ 0) + (χ : B →+* B) (v : Fin 3 → B) (f : PowerSeries B) + (hf : defect p hp χ v f = PowerSeries.X) + (a : MvPowerSeries σ B) (ha : PowerSeries.HasSubst a) : + defect p hp χ v (f.subst a) = a + ∑ i : Fin 3, + (p : ℚ)⁻¹ • (v i • ((f.map (χ^(i.val+1))).subst (a^(p^(i.val+1))) - + (f.map (χ^(i.val+1))).subst ((twist p hp χ ^ (i.val+1)) a))) := by + have hsum : PowerSeries.subst a (∑ i : Fin 3, + (p : ℚ)⁻¹ • (v i • ((twist p hp χ ^ (i.val+1)) f))) = + ∑ i : Fin 3, (p : ℚ)⁻¹ • (v i • + (f.map (χ^(i.val+1))).subst (a^(p^(i.val+1)))) := by + rw [← PowerSeries.coe_substAlgHom ha, map_sum] + apply Finset.sum_congr rfl + intro i _ + rw [AlgHom.map_smul_of_tower, AlgHom.map_smul_of_tower, + PowerSeries.coe_substAlgHom, subst_twist_iterate p hp χ f a ha] + have he := congrArg (PowerSeries.subst a) hf + rw [defect, PowerSeries.subst_sub ha, hsum, PowerSeries.subst_X ha] at he + have he' := sub_eq_iff_eq_add.mp he + simp only [defect, twist_iterate_subst p hp χ f a ha] + rw [he'] + simp only [smul_sub, Finset.sum_sub_distrib] + abel + +lemma IntegralSeries.add (ι : A →+* B) {σ : Type*} {f g : MvPowerSeries σ B} + (hf : IntegralSeries ι f) (hg : IntegralSeries ι g) : IntegralSeries ι (f+g) := by + rw [integral_iff_range] at hf hg ⊢ + exact Subring.add_mem _ hf hg + +lemma IntegralSeries.sub (ι : A →+* B) {σ : Type*} {f g : MvPowerSeries σ B} + (hf : IntegralSeries ι f) (hg : IntegralSeries ι g) : IntegralSeries ι (f-g) := by + rw [integral_iff_range] at hf hg ⊢ + exact Subring.sub_mem _ hf hg + +lemma integral_map (ι : A →+* B) {σ : Type*} (a : MvPowerSeries σ A) : + IntegralSeries ι (a.map ι) := by + rw [integral_iff_range] + exact ⟨a, rfl⟩ + +lemma IntegralSeries.sum (ι : A →+* B) {σ τ : Type*} (s : Finset τ) + (f : τ → MvPowerSeries σ B) (hf : ∀ i ∈ s, IntegralSeries ι (f i)) : + IntegralSeries ι (∑ i ∈ s, f i) := by + apply (integral_iff_range ι _).mpr + exact Subring.sum_mem _ fun i hi => (integral_iff_range ι _).mp (hf i hi) + +theorem defect_log_integral [Algebra ℚ B] (ι : A →+* B) (p : ℕ) [hp : Fact p.Prime] + (ψ : A →+* A) (χ : B →ₐ[ℚ] B) (hc : χ.toRingHom.comp ι = ι.comp ψ) + (hψ : ∀ a : A, (p : A) ∣ ψ a - a^p) + (v : Fin 3 → A) (f : PowerSeries B) (hf : HasIntegralNumerators ι p f) + (he : defect p hp.out.ne_zero χ.toRingHom (ι ∘ v) f = PowerSeries.X) + {σ : Type*} (a : MvPowerSeries σ A) (ha : a.constantCoeff = 0) : + IntegralSeries ι (defect p hp.out.ne_zero χ.toRingHom (ι ∘ v) (f.subst (a.map ι))) := by + have ha' : PowerSeries.HasSubst (a.map ι) := + PowerSeries.HasSubst.of_constantCoeff_zero (by simp [ha]) + rw [defect_subst_eq p hp.out.ne_zero χ.toRingHom (ι ∘ v) f he _ ha'] + apply (integral_map ι a).add + apply IntegralSeries.sum + intro i _ + have hi0 : p^(i.val+1) ≠ 0 := pow_ne_zero _ hp.out.ne_zero + have haPow : (a^(p^(i.val+1))).constantCoeff = 0 := by + rw [map_pow, ha, zero_pow hi0] + have haTw : ((twist p hp.out.ne_zero ψ ^ (i.val+1)) a).constantCoeff = 0 := by + rw [twist_iterate_constant, ha, map_zero] + obtain ⟨w, hw⟩ := logarithm_difference ι p hp.out.ne_zero + (f.map (χ.toRingHom^(i.val+1))) + (integralNumerators_map_iterate ι ψ χ hc p f hf (i.val+1)) + (a^(p^(i.val+1))) ((twist p hp.out.ne_zero ψ ^ (i.val+1)) a) + haPow haTw ((dvd_sub_comm).mp (twist_iterate_congr p ψ hψ a (i.val+1))) + rw [map_pow, map_twist_iterate p hp.out.ne_zero ι ψ χ.toRingHom hc] at hw + rw [hw, smul_comm, divide_p_mul p hp.out.ne_zero] + have hm : (ι (v i)) • w.map ι = (v i • w).map ι := by + simp only [MvPowerSeries.smul_eq_C_mul, map_mul, MvPowerSeries.map_C] + change IntegralSeries ι (ι (v i) • w.map ι) + rw [hm] + exact integral_map ι _ + +theorem integral_of_defect_log [Algebra ℚ B] (ι : A →+* B) (p : ℕ) [hp : Fact p.Prime] + (ψ : A →+* A) (χ : B →ₐ[ℚ] B) (hc : χ.toRingHom.comp ι = ι.comp ψ) + (hψ : ∀ a : A, (p : A) ∣ ψ a - a^p) + (v : Fin 3 → A) (f : PowerSeries B) (hf : HasIntegralNumerators ι p f) + (he : defect p hp.out.ne_zero χ.toRingHom (ι ∘ v) f = PowerSeries.X) + (hf1 : f.coeff 1 = 1) + {σ : Type*} (g : MvPowerSeries σ B) (hg : g.constantCoeff = 0) + (hint : IntegralSeries ι (defect p hp.out.ne_zero χ.toRingHom (ι ∘ v) (f.subst g))) : + IntegralSeries ι g := by + classical + have main : ∀ n : ℕ, ∀ d : σ →₀ ℕ, d.degree = n → ∃ u : A, ι u = MvPowerSeries.coeff d g := by + intro n + induction n using Nat.strong_induction_on with + | h n ih => + intro d hd + by_cases hn : n = 0 + · have hd0 : d = 0 := Finsupp.degree_eq_zero_iff d |>.mp (hd.trans hn) + subst d + exact ⟨0, by simpa using hg.symm⟩ + have hnpos : 0 < n := Nat.pos_of_ne_zero hn + let a : MvPowerSeries σ A := fun e => + if e = 0 then 0 else if he : e.degree < n then (ih e.degree he e rfl).choose else 0 + have haC (e : σ →₀ ℕ) : MvPowerSeries.coeff e a = + if e = 0 then 0 else if he : e.degree < n then (ih e.degree he e rfl).choose else 0 := rfl + have ha0 : a.constantCoeff = 0 := by + rw [← MvPowerSeries.coeff_zero_eq_constantCoeff_apply, haC, ite_eq_left rfl] + have hao : (n : ℕ∞) ≤ (g - a.map ι).order := by + apply MvPowerSeries.nat_le_order + intro e he + rw [map_sub, MvPowerSeries.coeff_map, haC] + by_cases he0 : e = 0 + · subst e + simpa using hg + · rw [ite_eq_right he0, dite_eq_left he, (ih e.degree he e rfl).choose_spec, sub_self] + have ham0 : (a.map ι).constantCoeff = 0 := by simp [ha0] + have hia := defect_log_integral ι p ψ χ hc hψ v f hf he a ha0 + have hid := hint.sub ι hia + obtain ⟨u, hu⟩ := hid d + have heq : MvPowerSeries.coeff d + (defect p hp.out.ne_zero χ.toRingHom (ι ∘ v) (f.subst g) - + defect p hp.out.ne_zero χ.toRingHom (ι ∘ v) (f.subst (a.map ι))) = + MvPowerSeries.coeff d (g - a.map ι) := by + rw [← defect_sub, coeff_defect_le p hp.out.two_le χ.toRingHom (ι ∘ v) _ n hnpos + (order_log_difference f hf1 g (a.map ι) hg ham0 n hao) d hd.le, + coeff_log_difference f hf1 g (a.map ι) hg ham0 n hao d hd.le] + change ι u = MvPowerSeries.coeff d + (defect p hp.out.ne_zero χ.toRingHom (ι ∘ v) (f.subst g) - + defect p hp.out.ne_zero χ.toRingHom (ι ∘ v) (f.subst (a.map ι))) at hu + rw [heq, map_sub, MvPowerSeries.coeff_map] at hu + refine ⟨u + MvPowerSeries.coeff d a, ?_⟩ + rw [map_add, hu, sub_add_cancel] + intro d + exact main d.degree d rfl + +end HeightThree.PTypical + +end + +end OAI diff --git a/lean/OAI/Algebra/FormalGroup/Honda/Recurrence.lean b/lean/OAI/Algebra/FormalGroup/Honda/Recurrence.lean new file mode 100644 index 0000000000000000000000000000000000000000..5f26a7205b9b0806cfe90b599d121967b06765fd --- /dev/null +++ b/lean/OAI/Algebra/FormalGroup/Honda/Recurrence.lean @@ -0,0 +1,139 @@ +import OAI.Algebra.FormalGroup.Honda.IntegralLaw + +namespace OAI + +noncomputable section + +namespace HeightThree.HondaConstruction +open MvPowerSeries PTypical LogarithmicConstruction +variable {A B : Type*} [CommRing A] [CommRing B] + +theorem logarithm_functional_equation [Algebra ℚ B] + (ι : A →+* B) (p : ℕ) (hp : 2 ≤ p) + (ψ : A →+* A) (χ : B →ₐ[ℚ] B) (hc : χ.toRingHom.comp ι = ι.comp ψ) + (v : Fin 3 → A) : + defect p (by omega) χ.toRingHom (ι ∘ v) (logarithm ι p ψ v) = PowerSeries.X := by + apply PowerSeries.ext + intro j + simp only [defect, map_sub, map_sum, (PowerSeries.coeff j).map_smul_of_tower, + Function.comp_apply] + by_cases hj : ∃ n : ℕ, p^n = j + · obtain ⟨n, rfl⟩ := hj + simp only [logarithm, twisted_series_coeff p hp, coeff_series_power p hp] + cases n with + | zero => simp [numerator, PowerSeries.coeff_X] + | succ n => + have hpn : p^(n+1) ≠ 1 := by + have : 1 < p^(n+1) := one_lt_pow₀ (by omega : 1 < p) (by omega) + omega + rw [PowerSeries.coeff_X, ite_eq_right hpn, logarithm_recurrence ι p (by omega) ψ χ hc] + apply sub_eq_zero.mpr + apply Finset.sum_congr rfl + intro i _ + simp only [Nat.add_le_add_iff_right, Nat.add_sub_add_right, smul_eq_mul] + · rw [logarithm, coeff_series_outside p j _ hj] + have ht (i : Fin 3) : PowerSeries.coeff j + ((twist p (by omega) χ.toRingHom ^ (i.val+1)) + (series p (fun n => ((p : ℚ)⁻¹)^n • ι (numerator p ψ v n)))) = 0 := + twisted_series_coeff_outside p hp χ.toRingHom _ (i.val+1) j hj + simp only [ht, smul_zero, Finset.sum_const_zero, sub_zero] + rw [PowerSeries.coeff_X, ite_eq_right] + intro h + exact hj ⟨0, by simpa using h.symm⟩ + +def heightThreeLog [Algebra ℚ B] (ι : A →+* B) (p : ℕ) (hp : 2 ≤ p) + (ψ : A →+* A) (v : Fin 3 → A) : StrictLog (R := B) where + series := logarithm ι p ψ v + constant_zero := logarithm_constant ι p hp ψ v + linear_one := logarithm_linear ι p hp ψ v + +def integralFormalGroup [Algebra ℚ B] (ι : A →+* B) (hinj : Function.Injective ι) + (p : ℕ) [hp : Fact p.Prime] + (ψ : A →+* A) (χ : B →ₐ[ℚ] B) (hc : χ.toRingHom.comp ι = ι.comp ψ) + (hψ : ∀ a : A, (p : A) ∣ ψ a - a^p) (v : Fin 3 → A) : FormalGroup A := + descendFormalGroup ι hinj (heightThreeLog ι p hp.out.two_le ψ v).formalGroup + (law_integral ι p ψ χ hc hψ v (heightThreeLog ι p hp.out.two_le ψ v) + (series_integralNumerators ι p hp.out.two_le _) + (logarithm_functional_equation ι p hp.out.two_le ψ χ hc v)) + +instance integralFormalGroup_isComm [Algebra ℚ B] (ι : A →+* B) (hinj : Function.Injective ι) + (p : ℕ) [hp : Fact p.Prime] + (ψ : A →+* A) (χ : B →ₐ[ℚ] B) (hc : χ.toRingHom.comp ι = ι.comp ψ) + (hψ : ∀ a : A, (p : A) ∣ ψ a - a^p) (v : Fin 3 → A) : + (integralFormalGroup ι hinj p ψ χ hc hψ v).IsComm := + by + apply descendFormalGroup_isComm + +end HeightThree.HondaConstruction + +namespace HeightThree.HondaConstruction +open MvPowerSeries PTypical LogarithmicConstruction + +abbrev IntegralBase := MvPowerSeries (Fin 2) ℤ +abbrev RationalBase := MvPowerSeries (Fin 2) ℚ + +def coefficientInclusion : IntegralBase →+* RationalBase := + MvPowerSeries.map (Int.castRingHom ℚ) + +lemma coefficientInclusion_injective : Function.Injective coefficientInclusion := + map_injective (Int.castRingHom ℚ) Int.cast_injective + +def integralFrobenius (p : ℕ) (hp : p ≠ 0) : IntegralBase →+* IntegralBase := + (MvPowerSeries.expand p hp).toRingHom + +def rationalFrobenius (p : ℕ) (hp : p ≠ 0) : RationalBase →ₐ[ℚ] RationalBase := + MvPowerSeries.expand p hp + +lemma frobenius_compatible (p : ℕ) (hp : p ≠ 0) : + (rationalFrobenius p hp).toRingHom.comp coefficientInclusion = + coefficientInclusion.comp (integralFrobenius p hp) := by + ext f d + exact congrArg (coeff d) (MvPowerSeries.map_expand p hp (Int.castRingHom ℚ) f).symm + +lemma integralFrobenius_congr (p : ℕ) [hp : Fact p.Prime] (a : IntegralBase) : + (p : IntegralBase) ∣ integralFrobenius p hp.out.ne_zero a - a^p := by + have hInt (a : ℤ) : (p : ℤ) ∣ (RingHom.id ℤ) a - a^p := + dvd_sub_comm.mp (Int.prime_dvd_pow_self_sub hp.out a) + simpa [MvPowerSeries.map_id, integralFrobenius] using + frobenius_lift_series p (RingHom.id ℤ) hInt a + +def parameters : Fin 3 → IntegralBase := ![X 0, X 1, 1] + +def integralHonda (p : ℕ) [hp : Fact p.Prime] : FormalGroup IntegralBase := + integralFormalGroup coefficientInclusion coefficientInclusion_injective p + (integralFrobenius p hp.out.ne_zero) (rationalFrobenius p hp.out.ne_zero) + (frobenius_compatible p hp.out.ne_zero) (integralFrobenius_congr p) parameters + +instance integralHonda_isComm (p : ℕ) [hp : Fact p.Prime] : (integralHonda p).IsComm := by + unfold integralHonda + exact integralFormalGroup_isComm .. + +def reducedHonda (p : ℕ) [Fact p.Prime] (K : Type*) [CommRing K] : + FormalGroup (MvPowerSeries (Fin 2) K) := + (integralHonda p).map (MvPowerSeries.map (Int.castRingHom K)) + +end HeightThree.HondaConstruction + +namespace HeightThree.HondaConstruction +open MvPowerSeries +variable {A B : Type*} [CommRing A] [CommRing B] + +instance mapFormalGroup_isComm (F : FormalGroup A) [F.IsComm] (f : A →+* B) : + (F.map f).IsComm where + comm := by + change F.toPowerSeries.map f = (F.toPowerSeries.map f).subst ![X 1, X 0] + have hc := congrArg (MvPowerSeries.map f) (FormalGroup.IsComm.comm (F := F)) + rw [map_subst HasSubst.X_X] at hc + rw [hc] + congr 1 + funext i + fin_cases i <;> simp + +instance reducedHonda_isComm (p : ℕ) [Fact p.Prime] (K : Type*) [CommRing K] : + (reducedHonda p K).IsComm := mapFormalGroup_isComm .. + +end HeightThree.HondaConstruction + +end + +end OAI diff --git a/lean/OAI/Algebra/FormalGroup/Honda/Rigidity.lean b/lean/OAI/Algebra/FormalGroup/Honda/Rigidity.lean new file mode 100644 index 0000000000000000000000000000000000000000..6a4ef70404dbfad5252c937ef4789f5e6fb6eda9 --- /dev/null +++ b/lean/OAI/Algebra/FormalGroup/Honda/Rigidity.lean @@ -0,0 +1,223 @@ +import OAI.Algebra.FormalGroup.Honda.HondaDifferential + +namespace OAI + +noncomputable section + +namespace HeightThree.DeformationRigidity +open MvPowerSeries HondaTarget +variable {A B : Type*} [CommRing A] [CommRing B] +@[simp] lemma multiplication_zero (F : FormalGroup A) : + multiplicationSeries F 0 = 0 := rfl + +lemma multiplication_succ (F : FormalGroup A) (n : ℕ) : + multiplicationSeries F (n+1) = + F.toPowerSeries.subst ![multiplicationSeries F n, PowerSeries.X] := by + change ((n+1) • variablePoint F).val = _ + rw [succ_nsmul] + rfl + +@[simp] lemma multiplication_constant (F : FormalGroup A) (n : ℕ) : + (multiplicationSeries F n).constantCoeff = 0 := by + induction n with + | zero => simp + | succ n ih => + rw [multiplication_succ] + apply MvPowerSeries.constantCoeff_subst_eq_zero + (hasSubst_of_constantCoeff_zero (by intro i; fin_cases i; exact ih; exact PowerSeries.constantCoeff_X)) + (by intro i; fin_cases i; exact ih; exact PowerSeries.constantCoeff_X) F.zero_constantCoeff + +lemma multiplication_map (F : FormalGroup A) (φ : A →+* B) (n : ℕ) : + multiplicationSeries (F.map φ) n = (multiplicationSeries F n).map φ := by + induction n with + | zero => simp + | succ n ih => + rw [multiplication_succ, multiplication_succ] + change _ = MvPowerSeries.map φ (F.toPowerSeries.subst ![multiplicationSeries F n, PowerSeries.X]) + have hs : MvPowerSeries.HasSubst ![multiplicationSeries F n, PowerSeries.X] := + hasSubst_of_constantCoeff_zero (by + intro i; fin_cases i; exact multiplication_constant F n; exact PowerSeries.constantCoeff_X) + rw [map_subst hs, ih] + congr 1 + funext i + fin_cases i + · rfl + · exact (MvPowerSeries.map_X φ ()).symm + +end HeightThree.DeformationRigidity + +namespace HeightThree.DeformationRigidity +open MvPowerSeries HondaTarget +variable {R S : Type*} [CommRing R] [CommRing S] + +def SquareZeroKernel (ρ : R →+* S) : Prop := + ∀ a b : R, ρ a = 0 → ρ b = 0 → a * b = 0 + +lemma subst_eq_of_squareZero (ρ : R →+* S) (hρ : SquareZeroKernel ρ) + (f : PowerSeries R) (hf : f.map ρ = 0) + {σ : Type*} (a b : MvPowerSeries σ R) + (ha : PowerSeries.HasSubst a) (hb : PowerSeries.HasSubst b) + (hab : a.map ρ = b.map ρ) : f.subst a = f.subst b := by + ext d + rw [PowerSeries.coeff_subst ha, PowerSeries.coeff_subst hb] + apply finsum_congr + intro j + have hfj : ρ (PowerSeries.coeff j f) = 0 := by + have hh := congrArg (PowerSeries.coeff j) hf + simpa only [PowerSeries.coeff_map, map_zero] using hh + have hpw : (a^j).map ρ = (b^j).map ρ := by simp only [map_pow, hab] + have hc : ρ (coeff d (a^j) - coeff d (b^j)) = 0 := by + rw [map_sub] + exact sub_eq_zero.mpr (by simpa only [coeff_map] using congrArg (coeff d) hpw) + rw [smul_eq_mul, smul_eq_mul, ← sub_eq_zero, ← mul_sub] + exact hρ _ _ hfj hc + +lemma mul_eq_zero_of_map_zero (ρ : R →+* S) (hρ : SquareZeroKernel ρ) + (a b : PowerSeries R) (ha : a.map ρ = 0) (hb : b.map ρ = 0) : a*b = 0 := by + ext n + rw [PowerSeries.coeff_mul, map_zero] + apply Finset.sum_eq_zero + intro ij _ + apply hρ + · simpa only [PowerSeries.coeff_map, map_zero] using congrArg (PowerSeries.coeff ij.1) ha + · simpa only [PowerSeries.coeff_map, map_zero] using congrArg (PowerSeries.coeff ij.2) hb + +lemma highPower_unchanged (p : ℕ) [hp : Fact p.Prime] [CharP R p] + (h : ℕ) (hh : 0 < h) (ρ : R →+* S) (hρ : SquareZeroKernel ρ) + (u : PowerSeries R) (hu : u.map ρ = PowerSeries.X) : + u^(p^h) = PowerSeries.X^(p^h) := by + have : CharP (PowerSeries R) p := charP_of_injective_ringHom PowerSeries.C_injective p + let d := u - PowerSeries.X + have hd : d.map ρ = 0 := by simp [d, hu] + have hd2 : d^2 = 0 := by simpa only [pow_two] using mul_eq_zero_of_map_zero ρ hρ d d hd hd + have hdq : d^(p^h) = 0 := pow_eq_zero_of_le + (by exact le_trans hp.out.two_le (Nat.le_pow hh)) hd2 + have hu' : u = PowerSeries.X + d := by dsimp [d]; ring + rw [hu', add_pow_char_pow, hdq, add_zero] + +lemma subst_after_mv {σ τ : Type*} (f : PowerSeries R) + (a : MvPowerSeries σ R) (ha : PowerSeries.HasSubst a) + (b : σ → MvPowerSeries τ R) (hb : MvPowerSeries.HasSubst b) : + (f.subst a).subst b = f.subst (a.subst b) := + MvPowerSeries.subst_comp_subst_apply ha.const hb f + +lemma coordinate_add (F G : FormalGroup R) (e : CoordinateIso F G) + {σ : Type*} (a b : MvPowerSeries σ R) + (ha : a.constantCoeff = 0) (hb : b.constantCoeff = 0) : + e.series.subst (F.toPowerSeries.subst ![a,b]) = + G.toPowerSeries.subst ![e.series.subst a, e.series.subst b] := by + have hab : MvPowerSeries.HasSubst ![a,b] := + hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> assumption) + have hes (i : Fin 2) : (e.series.subst (X i : MvPowerSeries (Fin 2) R)).constantCoeff = 0 := + PowerSeries.constantCoeff_subst_eq_zero (by simp) _ e.zero_series + have hepair : MvPowerSeries.HasSubst + ![e.series.subst (X 0 : MvPowerSeries (Fin 2) R), + e.series.subst (X 1 : MvPowerSeries (Fin 2) R)] := + hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> exact hes _) + have he := congrArg (fun z : MvPowerSeries (Fin 2) R => z.subst ![a,b]) + e.preserves_addition + rw [subst_after_mv _ _ (PowerSeries.HasSubst.of_constantCoeff_zero F.zero_constantCoeff) + _ hab, MvPowerSeries.subst_comp_subst_apply hepair hab] at he + convert he using 1 + congr 1 + funext i; fin_cases i + · change e.series.subst a = (e.series.subst (X 0 : MvPowerSeries (Fin 2) R)).subst ![a,b] + rw [subst_after_mv _ _ (PowerSeries.HasSubst.X _) _ hab, MvPowerSeries.subst_X hab] + rfl + · change e.series.subst b = (e.series.subst (X 1 : MvPowerSeries (Fin 2) R)).subst ![a,b] + rw [subst_after_mv _ _ (PowerSeries.HasSubst.X _) _ hab, MvPowerSeries.subst_X hab] + rfl + +lemma law_pair_subst (F : FormalGroup R) (a b c : PowerSeries R) + (ha : a.constantCoeff = 0) (hb : b.constantCoeff = 0) + (hc : PowerSeries.HasSubst c) : + PowerSeries.subst c (F.toPowerSeries.subst ![a,b]) = + F.toPowerSeries.subst ![a.subst c, b.subst c] := by + have hab : MvPowerSeries.HasSubst ![a,b] := + hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> assumption) + change (F.toPowerSeries.subst ![a,b]).subst (fun _ : Unit => c) = _ + rw [MvPowerSeries.subst_comp_subst_apply hab hc.const] + congr 1 + funext i; fin_cases i <;> rfl + +lemma coordinate_multiplication (F G : FormalGroup R) (e : CoordinateIso F G) (n : ℕ) : + e.series.subst (multiplicationSeries F n) = + (multiplicationSeries G n).subst e.series := by + have he : PowerSeries.HasSubst e.series := PowerSeries.HasSubst.of_constantCoeff_zero e.zero_series + induction n with + | zero => + simp only [multiplication_zero, PowerSeries.subst_zero_of_constantCoeff_zero e.zero_series] + rw [← PowerSeries.coe_substAlgHom he, map_zero] + | succ n ih => + rw [multiplication_succ, coordinate_add F G e _ _ (multiplication_constant F n) + (by exact PowerSeries.constantCoeff_X), multiplication_succ, + law_pair_subst G _ _ _ (multiplication_constant G n) PowerSeries.constantCoeff_X he, + ih, PowerSeries.X_subst, PowerSeries.subst_X he] + +lemma subst_near_X_highPower (p : ℕ) [hp : Fact p.Prime] [CharP R p] + (h : ℕ) (hh : 0 < h) (ρ : R →+* S) (hρ : SquareZeroKernel ρ) + (u f : PowerSeries R) (hu0 : u.constantCoeff = 0) + (hu : u.map ρ = PowerSeries.X) (hf : f.map ρ = PowerSeries.X^(p^h)) : + f.subst u = f := by + let v := f - PowerSeries.X^(p^h) + have hv : v.map ρ = 0 := by simp only [v, map_sub, map_pow, PowerSeries.map_X, hf, sub_self] + have huS : PowerSeries.HasSubst u := PowerSeries.HasSubst.of_constantCoeff_zero hu0 + have hvu : v.subst u = v := by + have he := subst_eq_of_squareZero ρ hρ v hv u PowerSeries.X huS + PowerSeries.HasSubst.X' (by change u.map ρ = (PowerSeries.X : PowerSeries R).map ρ; simpa only [PowerSeries.map_X] using hu) + simpa only [PowerSeries.X_subst] using he + have he : f = PowerSeries.X^(p^h) + v := by dsimp [v]; ring + conv_lhs => rw [he] + rw [PowerSeries.subst_add huS, PowerSeries.subst_pow huS, PowerSeries.subst_X huS, + highPower_unchanged p h hh ρ hρ u hu, hvu] + exact he.symm + +lemma infinitesimal_pseries (p : ℕ) [hp : Fact p.Prime] [CharP R p] + (h : ℕ) (hh : 0 < h) (ρ : R →+* S) (hρ : SquareZeroKernel ρ) + (F G : FormalGroup R) (e : CoordinateIso F G) + (he : e.series.map ρ = PowerSeries.X) + (hF : (multiplicationSeries F p).map ρ = PowerSeries.X^(p^h)) + (hG : (multiplicationSeries G p).map ρ = PowerSeries.X^(p^h)) : + multiplicationSeries F p + + (e.series - PowerSeries.X).subst (PowerSeries.X^(p^h)) = + multiplicationSeries G p := by + let d := e.series - PowerSeries.X + have hd : d.map ρ = 0 := by simp [d, he] + have hpq : (p^h) ≠ 0 := pow_ne_zero _ hp.out.ne_zero + have hq : PowerSeries.HasSubst (PowerSeries.X^(p^h) : PowerSeries R) := + PowerSeries.HasSubst.X_pow hpq + have hdf : d.subst (multiplicationSeries F p) = d.subst (PowerSeries.X^(p^h)) := + subst_eq_of_squareZero ρ hρ d hd _ _ + (PowerSeries.HasSubst.of_constantCoeff_zero (multiplication_constant F p)) hq + (by change (multiplicationSeries F p).map ρ = (PowerSeries.X^(p^h)).map ρ; simpa only [map_pow, PowerSeries.map_X] using hF) + have hcentral := coordinate_multiplication F G e p + have hes : e.series = PowerSeries.X + d := by dsimp [d]; ring + rw [subst_near_X_highPower p h hh ρ hρ _ _ e.zero_series he hG] at hcentral + conv_lhs at hcentral => rw [hes, PowerSeries.subst_add + (PowerSeries.HasSubst.of_constantCoeff_zero (multiplication_constant F p)), + PowerSeries.subst_X (PowerSeries.HasSubst.of_constantCoeff_zero (multiplication_constant F p)), hdf] + exact hcentral + +theorem infinitesimal_automorphism_rigid (p : ℕ) [hp : Fact p.Prime] [CharP R p] + (h : ℕ) (hh : 0 < h) (ρ : R →+* S) (hρ : SquareZeroKernel ρ) + (F : FormalGroup R) (e : CoordinateIso F F) + (he : e.series.map ρ = PowerSeries.X) + (hF : (multiplicationSeries F p).map ρ = PowerSeries.X^(p^h)) : + e.series = PowerSeries.X := by + have hz := infinitesimal_pseries p h hh ρ hρ F F e he hF hF + have hd : (e.series - PowerSeries.X).subst (PowerSeries.X^(p^h)) = 0 := + (add_eq_left.mp hz) + have hpq : (p^h) ≠ 0 := pow_ne_zero _ hp.out.ne_zero + have heq : e.series - PowerSeries.X = 0 := by + ext n + have hn := congrArg (PowerSeries.coeff (p^h*n)) hd + rw [← PowerSeries.expand_apply (p^h) hpq, + PowerSeries.coeff_expand_mul, map_zero] at hn + simpa only [map_zero] using hn + exact sub_eq_zero.mp heq + +end HeightThree.DeformationRigidity + +end + +end OAI diff --git a/lean/OAI/Algebra/FormalGroup/Honda/SmallExtension.lean b/lean/OAI/Algebra/FormalGroup/Honda/SmallExtension.lean new file mode 100644 index 0000000000000000000000000000000000000000..dbc7c82f4de830f67fd0a2d122459def7e163c41 --- /dev/null +++ b/lean/OAI/Algebra/FormalGroup/Honda/SmallExtension.lean @@ -0,0 +1,444 @@ +import OAI.Algebra.FormalGroup.Honda.ChainRule +import OAI.Algebra.FormalGroup.Honda.Tangent + +namespace OAI + +noncomputable section + +namespace HeightThree.SmallExtension +open MvPowerSeries HondaTarget DeformationRigidity TangentClassification +variable {R S K σ τ : Type*} [CommRing R] [CommRing S] [CommRing K] + +structure IsSmall (π : R →+* S) (ρ : R →+* K) : Prop where + ker_le : ∀ a, π a = 0 → ρ a = 0 + annihilate : ∀ a b, π a = 0 → ρ b = 0 → a*b = 0 + +lemma IsSmall.squareZero {π : R →+* S} {ρ : R →+* K} (h : IsSmall π ρ) : + SquareZeroKernel π := fun a b ha hb => h.annihilate a b ha (h.ker_le b hb) + +lemma subst_eq_of_annihilate (π : R →+* S) (ρ : R →+* K) + (h : ∀ c e, π c = 0 → ρ e = 0 → c*e = 0) + (f : MvPowerSeries σ R) (hf : f.map π = 0) + (a b : σ → MvPowerSeries τ R) (ha : HasSubst a) (hb : HasSubst b) + (hab : ∀ i, (a i).map ρ = (b i).map ρ) : f.subst a = f.subst b := by + ext d + rw [coeff_subst ha, coeff_subst hb] + apply finsum_congr + intro e + have hf' : π (coeff e f) = 0 := by + simpa only [coeff_map, map_zero] using congrArg (coeff e) hf + have he : (e.prod fun i n => (a i)^n).map ρ = (e.prod fun i n => (b i)^n).map ρ := by + simp only [Finsupp.prod, map_prod, map_pow, hab] + have hd : ρ (coeff d (e.prod fun i n => (a i)^n) - coeff d (e.prod fun i n => (b i)^n)) = 0 := by + rw [map_sub] + exact sub_eq_zero.mpr (by simpa only [coeff_map] using congrArg (coeff d) he) + rw [smul_eq_mul, smul_eq_mul, ← sub_eq_zero, ← mul_sub] + exact h _ _ hf' hd + +lemma unisubst_eq_of_annihilate (π : R →+* S) (ρ : R →+* K) + (h : ∀ c e, π c = 0 → ρ e = 0 → c*e = 0) + (f : PowerSeries R) (hf : f.map π = 0) + (a b : MvPowerSeries τ R) (ha : PowerSeries.HasSubst a) (hb : PowerSeries.HasSubst b) + (hab : a.map ρ = b.map ρ) : f.subst a = f.subst b := + subst_eq_of_annihilate π ρ h f hf _ _ ha.const hb.const (fun _ => hab) + +lemma series_mul_zero (π : R →+* S) (ρ : R →+* K) + (h : ∀ c e, π c = 0 → ρ e = 0 → c*e = 0) + (a b : MvPowerSeries σ R) (ha : a.map π = 0) (hb : b.map ρ = 0) : a*b = 0 := by + classical + ext d + rw [coeff_mul, map_zero] + apply Finset.sum_eq_zero + intro ij hij + apply h + · simpa only [coeff_map, map_zero] using congrArg (coeff ij.1) ha + · simpa only [coeff_map, map_zero] using congrArg (coeff ij.2) hb + +lemma highPower_eq (p : ℕ) [hp : Fact p.Prime] [CharP R p] + (n : ℕ) (hn : 0 < n) (π : R →+* S) (hπ : SquareZeroKernel π) + (a b : MvPowerSeries σ R) (hab : a.map π = b.map π) : a^(p^n) = b^(p^n) := by + let : CharP (MvPowerSeries σ R) p := charP_of_injective_ringHom MvPowerSeries.C_injective p + let d := a-b + have hd : d.map π = 0 := by simp [d, hab] + have hd2 : d^2 = 0 := by simpa only [pow_two] using series_mul_zero π π hπ d d hd hd + have hdq : d^(p^n) = 0 := pow_eq_zero_of_le (le_trans hp.out.two_le (Nat.le_pow hn)) hd2 + have he : a = b+d := by dsimp [d]; ring + rw [he, add_pow_char_pow, hdq, add_zero] + +lemma subst_expand_inner (q : ℕ) (hq : q ≠ 0) (f : MvPowerSeries σ R) + (a : σ → MvPowerSeries τ R) (ha : HasSubst a) : + (expand q hq f).subst a = f.subst (fun i => (a i)^q) := by + rw [expand, substAlgHom_apply, subst_comp_subst_apply (HasSubst.X_pow hq) ha] + congr 1 + funext i + rw [← coe_substAlgHom ha, map_pow, substAlgHom_X] + +lemma law_perturbation (p : ℕ) [hp : Fact p.Prime] [CharP R p] + (π : R →+* S) (ρ : R →+* K) (h : IsSmall π ρ) + (F Γ : FormalGroup R) (hF : F.toPowerSeries.map ρ = Γ.toPowerSeries.map ρ) + (H : MvPowerSeries (Fin 2) R) + (hΓ : Γ.toPowerSeries = X 0 + X 1 + expand (p^2) (pow_ne_zero _ hp.out.ne_zero) H) + (a b : Fin 2 → MvPowerSeries σ R) (ha : HasSubst a) (hb : HasSubst b) + (hab : ∀ i, (a i).map π = (b i).map π) : + F.toPowerSeries.subst a - F.toPowerSeries.subst b = (a 0-b 0)+(a 1-b 1) := by + have he : (F.toPowerSeries-Γ.toPowerSeries).subst a = + (F.toPowerSeries-Γ.toPowerSeries).subst b := by + apply subst_eq_of_annihilate ρ π (fun c e hc he => by rw [mul_comm]; exact h.annihilate e c he hc) + · simpa only [map_sub] using sub_eq_zero.mpr hF + · exact ha + · exact hb + · exact hab + rw [← coe_substAlgHom ha, ← coe_substAlgHom hb, map_sub, map_sub] at he + have hΓab : Γ.toPowerSeries.subst a - Γ.toPowerSeries.subst b = (a 0-b 0)+(a 1-b 1) := by + rw [hΓ] + simp only [← coe_substAlgHom ha, ← coe_substAlgHom hb, map_add, substAlgHom_X] + have hpowers : (fun i => (a i)^(p^2)) = (fun i => (b i)^(p^2)) := by + funext i; exact highPower_eq p 2 (by omega) π h.squareZero _ _ (hab i) + rw [coe_substAlgHom ha, coe_substAlgHom hb, + subst_expand_inner _ _ _ a ha, subst_expand_inner _ _ _ b hb, hpowers] + ring + simp only [coe_substAlgHom] at he + linear_combination he + hΓab + +lemma series_perturbation (p : ℕ) [hp : Fact p.Prime] [CharP R p] + (n : ℕ) (hn : 0 < n) (π : R →+* S) (ρ : R →+* K) (h : IsSmall π ρ) + (f : PowerSeries R) (hf : f.map ρ = PowerSeries.X^(p^n)) + (a b : MvPowerSeries σ R) (ha : PowerSeries.HasSubst a) (hb : PowerSeries.HasSubst b) + (hab : a.map π = b.map π) : f.subst a = f.subst b := by + have he : (f-PowerSeries.X^(p^n)).subst a = (f-PowerSeries.X^(p^n)).subst b := by + apply unisubst_eq_of_annihilate ρ π (fun c e hc he => by rw [mul_comm]; exact h.annihilate e c he hc) + · change MvPowerSeries.map ρ (f-PowerSeries.X^(p^n)) = 0 + rw [map_sub, map_pow, show MvPowerSeries.map ρ f = PowerSeries.X^(p^n) from hf] + simp [PowerSeries.X] + · exact ha + · exact hb + · exact hab + rw [PowerSeries.subst_sub ha, PowerSeries.subst_sub hb, PowerSeries.subst_pow ha, + PowerSeries.subst_pow hb, PowerSeries.subst_X ha, PowerSeries.subst_X hb, + highPower_eq p n hn π h.squareZero a b hab] at he + have hh := congrArg (fun z => z+b^(p^n)) he + simpa only [sub_add_cancel] using hh + +def point (F : FormalGroup R) (a : MvPowerSeries σ R) (ha : PowerSeries.HasSubst a) : F.Point σ := ⟨a,ha⟩ + +lemma multiplication_at_point (F : FormalGroup R) (n : ℕ) + (a : MvPowerSeries σ R) (ha : PowerSeries.HasSubst a) : + (multiplicationSeries F n).subst a = (n • point F a ha).val := by + induction n with + | zero => + rw [multiplication_zero, ← PowerSeries.coe_substAlgHom ha, map_zero] + rfl + | succ n ih => + rw [multiplication_succ, succ_nsmul] + have hn : HasSubst ![multiplicationSeries F n, PowerSeries.X] := + hasSubst_of_constantCoeff_zero (by intro i; fin_cases i; exact multiplication_constant F n; exact PowerSeries.constantCoeff_X) + change MvPowerSeries.subst (fun _ : Unit => a) + (F.toPowerSeries.subst ![multiplicationSeries F n, PowerSeries.X]) = + F.toPowerSeries.subst ![(n • point F a ha).val,a] + rw [subst_comp_subst_apply hn ha.const] + congr 1 + funext i; fin_cases i + · exact ih + · exact PowerSeries.subst_X ha + +lemma multiplication_preserves_addition (F : FormalGroup R) [F.IsComm] (n : ℕ) : + (multiplicationSeries F n).subst F.toPowerSeries = + F.toPowerSeries.subst ![(multiplicationSeries F n).subst (X 0), + (multiplicationSeries F n).subst (X 1)] := by + let x : F.Point (Fin 2) := ⟨X 0, PowerSeries.HasSubst.X 0⟩ + let y : F.Point (Fin 2) := ⟨X 1, PowerSeries.HasSubst.X 1⟩ + have hxy : (x+y).val = F.toPowerSeries := by + change F.toPowerSeries.subst ![X 0, X 1] = F.toPowerSeries + rw [show (![X 0, X 1] : Fin 2 → MvPowerSeries (Fin 2) R) = X by funext i; fin_cases i <;> rfl] + exact congrFun MvPowerSeries.subst_self F.toPowerSeries + have hh := congrArg (fun a : F.Point (Fin 2) => a.val) (nsmul_add x y n) + change (n • (x+y)).val = F.toPowerSeries.subst ![(n•x).val,(n•y).val] at hh + have hv (a : F.Point (Fin 2)) : (n•a).val = (multiplicationSeries F n).subst a.val := by + have hp : point F a.val a.prop = a := rfl + have hh := (multiplication_at_point F n a.val a.prop).symm + rw [hp] at hh + exact hh + rw [hv (x+y), hv x, hv y, hxy] at hh + exact hh + +lemma multiplication_reduction (F Γ : FormalGroup R) (ρ : R →+* K) + (hF : F.map ρ = Γ.map ρ) (p q : ℕ) + (hΓ : multiplicationSeries Γ p = PowerSeries.X^q) : + (multiplicationSeries F p).map ρ = PowerSeries.X^q := by + rw [← multiplication_map, hF, multiplication_map, hΓ] + change MvPowerSeries.map ρ (PowerSeries.X^q) = _ + rw [map_pow] + simp [PowerSeries.X] + +theorem linearized_p_hom (p : ℕ) [hp : Fact p.Prime] [CharP R p] + (π : R →+* S) (ρ : R →+* K) (h : IsSmall π ρ) + (F G Γ : FormalGroup R) [F.IsComm] [G.IsComm] + (hπ : F.map π = G.map π) (hF : F.map ρ = Γ.map ρ) (hG : G.map ρ = Γ.map ρ) + (H : MvPowerSeries (Fin 2) R) + (hΓ : Γ.toPowerSeries = X 0 + X 1 + expand (p^2) (pow_ne_zero _ hp.out.ne_zero) H) + (hΓp : multiplicationSeries Γ p = PowerSeries.X^(p^3)) : + delta Γ (multiplicationSeries F p - multiplicationSeries G p) = + expand (p^3) (pow_ne_zero _ hp.out.ne_zero) (F.toPowerSeries-G.toPowerSeries) := by + let P := multiplicationSeries F p + let Q := multiplicationSeries G p + let v := P-Q + let D := F.toPowerSeries-G.toPowerSeries + have hPπ : P.map π = Q.map π := by + dsimp [P,Q]; rw [← multiplication_map, ← multiplication_map, hπ] + have hvπ : v.map π = 0 := by + change MvPowerSeries.map π (P-Q) = 0 + rw [map_sub]; exact sub_eq_zero.mpr hPπ + have hDπ : D.map π = 0 := by + dsimp [D] + rw [map_sub] + exact sub_eq_zero.mpr (congrArg FormalGroup.toPowerSeries hπ) + have hPρ : P.map ρ = PowerSeries.X^(p^3) := multiplication_reduction F Γ ρ hF p _ hΓp + have hQρ : Q.map ρ = PowerSeries.X^(p^3) := multiplication_reduction G Γ ρ hG p _ hΓp + have hFs : PowerSeries.HasSubst F.toPowerSeries := .of_constantCoeff_zero F.zero_constantCoeff + have hGs : PowerSeries.HasSubst G.toPowerSeries := .of_constantCoeff_zero G.zero_constantCoeff + have hΓs : PowerSeries.HasSubst Γ.toPowerSeries := .of_constantCoeff_zero Γ.zero_constantCoeff + have hFGπ : F.toPowerSeries.map π = G.toPowerSeries.map π := congrArg FormalGroup.toPowerSeries hπ + have hFΓρ : F.toPowerSeries.map ρ = Γ.toPowerSeries.map ρ := congrArg FormalGroup.toPowerSeries hF + have hGΓρ : G.toPowerSeries.map ρ = Γ.toPowerSeries.map ρ := congrArg FormalGroup.toPowerSeries hG + have heQ : Q.subst F.toPowerSeries = Q.subst G.toPowerSeries := + series_perturbation p 3 (by omega) π ρ h Q hQρ _ _ hFs hGs hFGπ + have hev : v.subst F.toPowerSeries = v.subst Γ.toPowerSeries := + unisubst_eq_of_annihilate π ρ h.annihilate v hvπ _ _ hFs hΓs hFΓρ + have hleft : P.subst F.toPowerSeries - Q.subst G.toPowerSeries = v.subst Γ.toPowerSeries := by + rw [← hev, PowerSeries.subst_sub hFs] + exact congrArg (fun z => P.subst F.toPowerSeries-z) heQ.symm + let A : Fin 2 → MvPowerSeries (Fin 2) R := fun i => P.subst (X i) + let B : Fin 2 → MvPowerSeries (Fin 2) R := fun i => Q.subst (X i) + have hAz (i : Fin 2) : (A i).constantCoeff = 0 := + PowerSeries.constantCoeff_subst_eq_zero (constantCoeff_X i) P (multiplication_constant F p) + have hBz (i : Fin 2) : (B i).constantCoeff = 0 := + PowerSeries.constantCoeff_subst_eq_zero (constantCoeff_X i) Q (multiplication_constant G p) + have hAs : HasSubst A := hasSubst_of_constantCoeff_zero hAz + have hBs : HasSubst B := hasSubst_of_constantCoeff_zero hBz + have hABπ : ∀ i, (A i).map π = (B i).map π := by + intro i; dsimp [A,B] + rw [PowerSeries.map_subst (PowerSeries.HasSubst.X i), PowerSeries.map_subst (PowerSeries.HasSubst.X i), hPπ] + have hAXρ : ∀ i, (A i).map ρ = ((X i : MvPowerSeries (Fin 2) R)^(p^3)).map ρ := by + intro i; dsimp [A] + rw [PowerSeries.map_subst (PowerSeries.HasSubst.X i), hPρ, map_X, + PowerSeries.subst_pow (PowerSeries.HasSubst.X i), PowerSeries.subst_X (PowerSeries.HasSubst.X i), map_pow, map_X] + have hDD : D.subst A = expand (p^3) (pow_ne_zero _ hp.out.ne_zero) D := by + rw [expand, substAlgHom_apply] + exact subst_eq_of_annihilate π ρ h.annihilate D hDπ A _ hAs (HasSubst.X_pow (pow_ne_zero _ hp.out.ne_zero)) hAXρ + have hGG := law_perturbation p π ρ h G Γ hGΓρ H hΓ A B hAs hBs hABπ + have hright : F.toPowerSeries.subst A - G.toPowerSeries.subst B = + expand (p^3) (pow_ne_zero _ hp.out.ne_zero) D + v.subst (X 0) + v.subst (X 1) := by + change (F.toPowerSeries-G.toPowerSeries).subst A = _ at hDD + rw [MvPowerSeries.subst_sub hAs] at hDD + simp only [v, PowerSeries.subst_sub (PowerSeries.HasSubst.X (0 : Fin 2)), + PowerSeries.subst_sub (PowerSeries.HasSubst.X (1 : Fin 2))] + dsimp [A,B] at hGG + linear_combination hDD+hGG + have heF := multiplication_preserves_addition F p + have heG := multiplication_preserves_addition G p + have hAF : A = ![P.subst (X 0),P.subst (X 1)] := by funext i; fin_cases i <;> rfl + have hBG : B = ![Q.subst (X 0),Q.subst (X 1)] := by funext i; fin_cases i <;> rfl + change P.subst F.toPowerSeries = F.toPowerSeries.subst _ at heF + change Q.subst G.toPowerSeries = G.toPowerSeries.subst _ at heG + rw [← hAF] at heF + rw [← hBG] at heG + change v.subst Γ.toPowerSeries-v.subst (X 0)-v.subst (X 1) = _ + linear_combination -hleft + hright + heF - heG + +lemma series_map_zero_of_ker_le (π : R →+* S) (ρ : R →+* K) + (h : ∀ a, π a = 0 → ρ a = 0) (f : MvPowerSeries σ R) (hf : f.map π = 0) : + f.map ρ = 0 := by + ext d + rw [coeff_map, map_zero] + apply h + simpa only [coeff_map, map_zero] using congrArg (coeff d) hf + +lemma coordinate_of_coboundary (p : ℕ) [hp : Fact p.Prime] [CharP R p] + (π : R →+* S) (ρ : R →+* K) (h : IsSmall π ρ) + (F G Γ : FormalGroup R) (hF : F.map ρ = Γ.map ρ) (hG : G.map ρ = Γ.map ρ) + (H : MvPowerSeries (Fin 2) R) + (hΓ : Γ.toPowerSeries = X 0 + X 1 + expand (p^2) (pow_ne_zero _ hp.out.ne_zero) H) + (w : PowerSeries R) (hw0 : w.constantCoeff = 0) (hwπ : w.map π = 0) + (hd : delta Γ w = F.toPowerSeries-G.toPowerSeries) : + ∃ e : CoordinateIso F G, e.series = PowerSeries.X-w ∧ e.series.map π = PowerSeries.X := by + have hwρ : w.map ρ = 0 := series_map_zero_of_ker_le π ρ h.ker_le w hwπ + let u := PowerSeries.X-w + let z := PowerSeries.X+w + have hu0 : u.constantCoeff = 0 := by simp [u, hw0] + have hz0 : z.constantCoeff = 0 := by simp [z, hw0] + have hu : PowerSeries.HasSubst u := .of_constantCoeff_zero hu0 + have hz : PowerSeries.HasSubst z := .of_constantCoeff_zero hz0 + have huπ : u.map π = PowerSeries.X := by simp [u,hwπ] + have hzπ : z.map π = PowerSeries.X := by simp [z,hwπ] + have hwu : w.subst u = w := by + have hh := subst_eq_of_squareZero π h.squareZero w hwπ u PowerSeries.X hu PowerSeries.HasSubst.X' (by simpa only [PowerSeries.X, map_X] using (show MvPowerSeries.map π u = PowerSeries.X from huπ)) + simpa only [PowerSeries.X_subst] using hh + have hwz : w.subst z = w := by + have hh := subst_eq_of_squareZero π h.squareZero w hwπ z PowerSeries.X hz PowerSeries.HasSubst.X' (by simpa only [PowerSeries.X, map_X] using (show MvPowerSeries.map π z = PowerSeries.X from hzπ)) + simpa only [PowerSeries.X_subst] using hh + have huz : u.subst z = PowerSeries.X := by + dsimp [u]; rw [PowerSeries.subst_sub hz, PowerSeries.subst_X hz, hwz] + dsimp [z]; ring + have hzu : z.subst u = PowerSeries.X := by + change (PowerSeries.X+w).subst u = _ + rw [PowerSeries.subst_add hu, PowerSeries.subst_X hu, hwu] + dsimp [u]; ring + have hFs : PowerSeries.HasSubst F.toPowerSeries := .of_constantCoeff_zero F.zero_constantCoeff + have hΓs : PowerSeries.HasSubst Γ.toPowerSeries := .of_constantCoeff_zero Γ.zero_constantCoeff + have hwF : w.subst F.toPowerSeries = w.subst Γ.toPowerSeries := + unisubst_eq_of_annihilate π ρ h.annihilate w hwπ _ _ hFs hΓs (congrArg FormalGroup.toPowerSeries hF) + let A : Fin 2 → MvPowerSeries (Fin 2) R := fun i => u.subst (X i) + have hAs : HasSubst A := hasSubst_of_constantCoeff_zero (fun i => + PowerSeries.constantCoeff_subst_eq_zero (constantCoeff_X i) u hu0) + have hAX : ∀ i, (A i).map π = (X i).map π := by + intro i; dsimp [A] + rw [PowerSeries.map_subst (PowerSeries.HasSubst.X i), huπ, map_X, + PowerSeries.subst_X (PowerSeries.HasSubst.X i)] + have hh := law_perturbation p π ρ h G Γ (congrArg FormalGroup.toPowerSeries hG) H hΓ A X hAs HasSubst.X hAX + rw [congrFun subst_self G.toPowerSeries] at hh + have hA (i : Fin 2) : A i = X i-w.subst (X i) := by + dsimp [A,u]; rw [PowerSeries.subst_sub (PowerSeries.HasSubst.X i), PowerSeries.subst_X (PowerSeries.HasSubst.X i)] + rw [hA 0,hA 1] at hh + dsimp only [id] at hh + have he : u.subst F.toPowerSeries = G.toPowerSeries.subst ![u.subst (X 0),u.subst (X 1)] := by + change (PowerSeries.X-w).subst F.toPowerSeries = _ + rw [PowerSeries.subst_sub hFs, PowerSeries.subst_X hFs,hwF] + rw [show (![u.subst (X 0),u.subst (X 1)] : Fin 2 → MvPowerSeries (Fin 2) R) = A by + funext i; fin_cases i <;> rfl] + dsimp [delta] at hd + linear_combination -hh-hd + refine ⟨⟨u,z,hu0,hz0,huz,hzu,he⟩,rfl,huπ⟩ + +lemma multiplication_linear (F : FormalGroup R) (n : ℕ) : + (multiplicationSeries F n).coeff 1 = (n : R) := by + induction n with + | zero => simp + | succ n ih => + rw [multiplication_succ, OriginalDifferentialSupport.coeff_one_formal_add _ _ _ + (multiplication_constant F n) PowerSeries.constantCoeff_X, ih] + simp + +lemma power_expand_iterate (p : ℕ) [hp : Fact p.Prime] (f : MvPowerSeries σ R) + (hf : f^p = expand p hp.out.ne_zero f) (n : ℕ) : + f^(p^n) = expand (p^n) (pow_ne_zero _ hp.out.ne_zero) f := by + induction n with + | zero => simp [MvPowerSeries.expand_one] + | succ n ih => + calc + f^(p^(n+1)) = (f^(p^n))^p := by rw [pow_succ,pow_mul] + _ = expand (p^n) (pow_ne_zero _ hp.out.ne_zero) (expand p hp.out.ne_zero f) := by + rw [ih, ← map_pow, hf] + _ = expand (p^(n+1)) (pow_ne_zero _ hp.out.ne_zero) f := by + simpa only [pow_succ] using (expand_mul (p^n) (pow_ne_zero _ hp.out.ne_zero) p hp.out.ne_zero f).symm + +theorem small_equivalence_of_matching_parameters [Nontrivial R] + (p : ℕ) [hp : Fact p.Prime] [CharP R p] + (π : R →+* S) (ρ : R →+* K) (h : IsSmall π ρ) + (F G Γ : FormalGroup R) [F.IsComm] [G.IsComm] + (hπ : F.map π = G.map π) (hF : F.map ρ = Γ.map ρ) (hG : G.map ρ = Γ.map ρ) + (H : MvPowerSeries (Fin 2) R) + (hΓ : Γ.toPowerSeries = X 0 + X 1 + expand (p^2) (pow_ne_zero _ hp.out.ne_zero) H) + (hΓp : multiplicationSeries Γ p = PowerSeries.X^(p^3)) + (hΓFr : Γ.toPowerSeries^p = expand p hp.out.ne_zero Γ.toPowerSeries) + (h₁ : (multiplicationSeries F p).coeff p = (multiplicationSeries G p).coeff p) + (h₂ : (multiplicationSeries F p).coeff (p^2) = (multiplicationSeries G p).coeff (p^2)) : + ∃ e : CoordinateIso F G, e.series.map π = PowerSeries.X := by + let v := multiplicationSeries F p-multiplicationSeries G p + let D := F.toPowerSeries-G.toPowerSeries + have hv : delta Γ v = expand (p^3) (pow_ne_zero _ hp.out.ne_zero) D := + linearized_p_hom p π ρ h F G Γ hπ hF hG H hΓ hΓp + have hv0 : v.constantCoeff = 0 := by simp [v] + have hv1 : v.coeff 1 = 0 := by simp [v, multiplication_linear] + have hH : Γ.toPowerSeries-X 0-X 1 = expand (p^2) (pow_ne_zero _ hp.out.ne_zero) H := by rw [hΓ]; ring + obtain ⟨a,b,w,hw0,he⟩ := tangent_decomposition p Γ H hΓFr hH v hv0 hv1 D hv + have hpp : p < p^2 := by nlinarith [hp.out.one_lt] + have hppq : p^2 < p^3 := by exact pow_lt_pow_right₀ hp.out.one_lt (by omega) + have hq1 : ¬p^3 ∣ p := Nat.not_dvd_of_pos_of_lt hp.out.pos (lt_trans hpp hppq) + have hq2 : ¬p^3 ∣ p^2 := Nat.not_dvd_of_pos_of_lt (pow_pos hp.out.pos _) hppq + have hvp : v.coeff p = 0 := by simp only [v,map_sub,h₁,sub_self] + have hvp2 : v.coeff (p^2) = 0 := by simp only [v,map_sub,h₂,sub_self] + have ha : a = 0 := by + have hh := congrArg (PowerSeries.coeff p) he + simpa [hvp, PowerSeries.coeff_expand_of_not_dvd _ _ _ hq1, PowerSeries.coeff_X_pow, + ne_of_lt hpp, ne_of_gt hpp] using hh.symm + have hb : b = 0 := by + have hh := congrArg (PowerSeries.coeff (p^2)) he + simpa [hvp2, ha, PowerSeries.coeff_expand_of_not_dvd _ _ _ hq2, PowerSeries.coeff_X_pow] using hh.symm + have he' : v = PowerSeries.expand (p^3) (pow_ne_zero _ hp.out.ne_zero) w := by simpa [ha,hb] using he + have hd : delta Γ w = D := by + apply expand_injective (p^3) (pow_ne_zero _ hp.out.ne_zero) + rw [← delta_expand (p^3) (pow_ne_zero _ hp.out.ne_zero) Γ + (power_expand_iterate p Γ.toPowerSeries hΓFr 3), ← he', hv] + have hvπ : v.map π = 0 := by + change MvPowerSeries.map π (multiplicationSeries F p-multiplicationSeries G p) = 0 + rw [map_sub, show MvPowerSeries.map π (multiplicationSeries F p) = multiplicationSeries (F.map π) p from (multiplication_map F π p).symm, + show MvPowerSeries.map π (multiplicationSeries G p) = multiplicationSeries (G.map π) p from (multiplication_map G π p).symm, hπ,sub_self] + have hwπ : w.map π = 0 := by + have hh := hvπ + rw [he',PowerSeries.map_expand] at hh + ext n + have hhc := congrArg (PowerSeries.coeff ((p^3)*n)) hh + simpa only [PowerSeries.coeff_expand_mul, map_zero] using hhc + obtain ⟨e, _, heπ⟩ := coordinate_of_coboundary p π ρ h F G Γ hF hG H hΓ w hw0 hwπ hd + exact ⟨e,heπ⟩ + +lemma small_isomorphism_pseries (p : ℕ) [hp : Fact p.Prime] [CharP R p] + (π : R →+* S) (ρ : R →+* K) (h : IsSmall π ρ) + (F G : FormalGroup R) (e : CoordinateIso F G) + (he : e.series.map π = PowerSeries.X) + (hF : (multiplicationSeries F p).map ρ = PowerSeries.X^(p^3)) + (hG : (multiplicationSeries G p).map ρ = PowerSeries.X^(p^3)) : + multiplicationSeries F p + PowerSeries.expand (p^3) (pow_ne_zero _ hp.out.ne_zero) + (e.series-PowerSeries.X) = multiplicationSeries G p := by + let d := e.series-PowerSeries.X + have hd : d.map π = 0 := by simp [d,he] + have hpq : p^3 ≠ 0 := pow_ne_zero _ hp.out.ne_zero + have hq : PowerSeries.HasSubst (PowerSeries.X^(p^3) : PowerSeries R) := .X_pow hpq + have hdf : d.subst (multiplicationSeries F p) = d.subst (PowerSeries.X^(p^3)) := + unisubst_eq_of_annihilate π ρ h.annihilate d hd _ _ + (.of_constantCoeff_zero (multiplication_constant F p)) hq + (by simpa only [PowerSeries.X,map_pow,map_X] using + (show MvPowerSeries.map ρ (multiplicationSeries F p) = PowerSeries.X^(p^3) from hF)) + have hes : PowerSeries.HasSubst e.series := .of_constantCoeff_zero e.zero_series + have hQg : (multiplicationSeries G p).subst e.series = multiplicationSeries G p := by + have HH := series_perturbation p 3 (by omega) π ρ h (multiplicationSeries G p) hG + e.series PowerSeries.X hes PowerSeries.HasSubst.X' + (by simpa only [PowerSeries.X,map_X] using + (show MvPowerSeries.map π e.series = PowerSeries.X from he)) + simpa only [PowerSeries.X_subst] using HH + have hc := coordinate_multiplication F G e p + rw [hQg] at hc + have he' : e.series = PowerSeries.X+d := by dsimp [d]; ring + conv_lhs at hc => rw [he',PowerSeries.subst_add (.of_constantCoeff_zero (multiplication_constant F p)), + PowerSeries.subst_X (.of_constantCoeff_zero (multiplication_constant F p)),hdf] + simpa only [PowerSeries.expand_apply] using hc + +lemma small_isomorphism_lowcoeff (p : ℕ) [hp : Fact p.Prime] [CharP R p] + (π : R →+* S) (ρ : R →+* K) (h : IsSmall π ρ) + (F G : FormalGroup R) (e : CoordinateIso F G) + (he : e.series.map π = PowerSeries.X) + (hF : (multiplicationSeries F p).map ρ = PowerSeries.X^(p^3)) + (hG : (multiplicationSeries G p).map ρ = PowerSeries.X^(p^3)) + (n : ℕ) (hn : 0 < n) (hnq : n < p^3) : + (multiplicationSeries F p).coeff n = (multiplicationSeries G p).coeff n := by + have HH := congrArg (PowerSeries.coeff n) (small_isomorphism_pseries p π ρ h F G e he hF hG) + simpa only [map_add,PowerSeries.coeff_expand_of_not_dvd _ _ _ (Nat.not_dvd_of_pos_of_lt hn hnq),add_zero] using HH + +lemma small_automorphism_rigid (p : ℕ) [hp : Fact p.Prime] [CharP R p] + (π : R →+* S) (ρ : R →+* K) (h : IsSmall π ρ) + (F : FormalGroup R) (e : CoordinateIso F F) + (he : e.series.map π = PowerSeries.X) + (hF : (multiplicationSeries F p).map ρ = PowerSeries.X^(p^3)) : + e.series = PowerSeries.X := by + have hh := small_isomorphism_pseries p π ρ h F F e he hF hF + have hz : PowerSeries.expand (p^3) (pow_ne_zero _ hp.out.ne_zero) (e.series-PowerSeries.X) = 0 := add_eq_left.mp hh + apply sub_eq_zero.mp + ext n + have hc := congrArg (PowerSeries.coeff ((p^3)*n)) hz + simpa only [PowerSeries.coeff_expand_mul,map_zero] using hc + +end HeightThree.SmallExtension + +end + +end OAI diff --git a/lean/OAI/Algebra/FormalGroup/Honda/SpecialFiber.lean b/lean/OAI/Algebra/FormalGroup/Honda/SpecialFiber.lean new file mode 100644 index 0000000000000000000000000000000000000000..362f21316c01caa52730eea390c77a951d55562c --- /dev/null +++ b/lean/OAI/Algebra/FormalGroup/Honda/SpecialFiber.lean @@ -0,0 +1,230 @@ +import OAI.Algebra.FormalGroup.Honda.HeightTwo + +namespace OAI + +noncomputable section + +namespace HeightThree.HondaSpecialFiber +open MvPowerSeries HondaConstruction HondaTarget HondaCoordinates LogarithmicConstruction PTypical + +def augmentation (R : Type*) [CommRing R] : MvPowerSeries (Fin 2) R →ₐ[R] R where + __ := MvPowerSeries.constantCoeff + commutes' _ := rfl + +lemma integerFrobenius (p : ℕ) [hp : Fact p.Prime] (a : ℤ) : + (p : ℤ) ∣ (RingHom.id ℤ) a - a^p := + dvd_sub_comm.mp (Int.prime_dvd_pow_self_sub hp.out a) + +def specialParameters : Fin 3 → ℤ := ![0,0,1] + +def integralSpecial (p : ℕ) [hp : Fact p.Prime] : FormalGroup ℤ := + integralFormalGroup (Int.castRingHom ℚ) Int.cast_injective p (RingHom.id ℤ) + (AlgHom.id ℚ ℚ) (by rfl) (integerFrobenius p) specialParameters + +def specialLog (p : ℕ) [hp : Fact p.Prime] : StrictLog (R := ℚ) := + heightThreeLog (Int.castRingHom ℚ) p hp.out.two_le (RingHom.id ℤ) specialParameters + +lemma integralSpecial_map (p : ℕ) [hp : Fact p.Prime] : + (integralSpecial p).map (Int.castRingHom ℚ) = (specialLog p).formalGroup := + integralFormalGroup_map .. + +lemma integralHonda_specialize (p : ℕ) [hp : Fact p.Prime] : + (integralHonda p).map MvPowerSeries.constantCoeff = integralSpecial p := by + have hi : (augmentation ℚ).toRingHom.comp coefficientInclusion = + (Int.castRingHom ℚ).comp MvPowerSeries.constantCoeff := by + ext f + rfl + have hψ : (RingHom.id ℤ).comp (MvPowerSeries.constantCoeff (σ := Fin 2)) = + MvPowerSeries.constantCoeff.comp (integralFrobenius p hp.out.ne_zero) := by + ext f + exact (constantCoeff_expand p hp.out.ne_zero f).symm + have hv : MvPowerSeries.constantCoeff ∘ parameters = specialParameters := by + funext i; fin_cases i <;> simp [parameters, specialParameters] + have hh := integralFormalGroup_natural coefficientInclusion coefficientInclusion_injective + (Int.castRingHom ℚ) Int.cast_injective MvPowerSeries.constantCoeff + (augmentation ℚ) hi p + (integralFrobenius p hp.out.ne_zero) (rationalFrobenius p hp.out.ne_zero) + (frobenius_compatible p hp.out.ne_zero) (integralFrobenius_congr p) + (RingHom.id ℤ) (AlgHom.id ℚ ℚ) (by rfl) (integerFrobenius p) hψ parameters + rw [hv] at hh + exact hh + +lemma specialLog_functional (p : ℕ) [hp : Fact p.Prime] : + (p : ℚ) • (specialLog p).series = + (p : ℚ) • PowerSeries.X + (specialLog p).series.subst (PowerSeries.X^(p^3)) := by + have he := logarithm_functional_equation (Int.castRingHom ℚ) p hp.out.two_le + (RingHom.id ℤ) (AlgHom.id ℚ ℚ) (by rfl) specialParameters + simp [defect, Fin.sum_univ_three, specialParameters] at he + have he' := congrArg (fun x : PowerSeries ℚ => (p : ℚ) • x) he + simp only [smul_sub, smul_smul, mul_inv_cancel₀ (by exact_mod_cast hp.out.ne_zero : (p : ℚ) ≠ 0), + one_smul] at he' + have ht : ((twist p hp.out.ne_zero (RingHom.id ℚ))^3) (specialLog p).series = + (specialLog p).series.subst (PowerSeries.X^(p^3)) := by + rw [twist_iterate] + simp only [show (RingHom.id ℚ)^3 = RingHom.id ℚ by rfl, MvPowerSeries.map_id] + exact PowerSeries.expand_apply .. + change (p : ℚ) • (specialLog p).series - + ((twist p hp.out.ne_zero (RingHom.id ℚ))^3) (specialLog p).series = _ at he' + rw [ht] at he' + exact sub_eq_iff_eq_add.mp he' + +lemma specialLog_divided (p : ℕ) [hp : Fact p.Prime] : + ∃ v : StrictLog (R := ℤ), + (specialLog p).series.subst ((p : PowerSeries ℚ) * PowerSeries.X) = + (p : PowerSeries ℚ) * v.series.map (Int.castRingHom ℚ) := by + have hpq : (p : ℚ) ≠ 0 := by exact_mod_cast hp.out.ne_zero + have hnum : HasIntegralNumerators (Int.castRingHom ℚ) p (specialLog p).series := + series_integralNumerators _ p hp.out.two_le _ + obtain ⟨v, hv⟩ := logarithm_difference (Int.castRingHom ℚ) p hp.out.ne_zero + (specialLog p).series hnum ((p : PowerSeries ℤ) * PowerSeries.X) 0 + (by simp [PowerSeries.X]) (by simp) (by simp) + simp only [map_mul, map_natCast, PowerSeries.X, map_X, map_zero, + PowerSeries.subst_zero_of_constantCoeff_zero (specialLog p).constant_zero, sub_zero] at hv + have hc : v.constantCoeff = 0 := by + have hh := congrArg (MvPowerSeries.constantCoeff (σ := Unit)) hv + rw [PowerSeries.constantCoeff_subst_eq_zero (by simp) _ (specialLog p).constant_zero] at hh + simp only [map_mul, map_natCast, MvPowerSeries.constantCoeff_map] at hh + have hh' : (v.constantCoeff : ℚ) = 0 := (mul_eq_zero.mp hh.symm).resolve_left hpq + exact_mod_cast hh' + have hl : PowerSeries.coeff 1 v = 1 := by + have hh := congrArg (PowerSeries.coeff 1) hv + change MvPowerSeries.coeff (Finsupp.single () 1) _ = _ at hh + rw [StrictLog.coeff_subst_linear _ _ (by simp), (specialLog p).linear_one, + one_mul] at hh + change PowerSeries.coeff 1 ((p : PowerSeries ℚ) * PowerSeries.X) = + PowerSeries.coeff 1 ((p : PowerSeries ℚ) * PowerSeries.map (Int.castRingHom ℚ) v) at hh + simp only [← map_natCast (PowerSeries.C (R := ℚ)), PowerSeries.coeff_C_mul, + PowerSeries.coeff_X, PowerSeries.coeff_map] at hh + have hh' : ((PowerSeries.coeff 1 v : ℤ) : ℚ) = 1 := (mul_left_cancel₀ hpq (by simpa using hh.symm)) + exact_mod_cast hh' + exact ⟨⟨v,hc,hl⟩,hv⟩ + +lemma specialLog_p_error (p : ℕ) [hp : Fact p.Prime] : + ∃ a : PowerSeries ℤ, a.constantCoeff = 0 ∧ (p : PowerSeries ℤ) ∣ a ∧ + (specialLog p).series.subst (a.map (Int.castRingHom ℚ)) = + (p : PowerSeries ℚ) * PowerSeries.X := by + obtain ⟨v,hv⟩ := specialLog_divided p + let b : PowerSeries ℚ := v.inv.map (Int.castRingHom ℚ) + have hb : PowerSeries.HasSubst b := PowerSeries.HasSubst.of_constantCoeff_zero + (by + change (Int.castRingHom ℚ) v.inv.constantCoeff = 0 + rw [v.inv_constant, map_zero]) + refine ⟨(p : PowerSeries ℤ) * v.inv, by simp, dvd_mul_right _ _, ?_⟩ + have hh := congrArg (PowerSeries.subst b) hv + rw [PowerSeries.subst_comp_subst_apply + (PowerSeries.HasSubst.of_constantCoeff_zero (by simp [PowerSeries.X])) hb] at hh + have hx : PowerSeries.subst b ((p : PowerSeries ℚ) * PowerSeries.X) = p * b := by + rw [← PowerSeries.coe_substAlgHom hb, map_mul, map_natCast, + PowerSeries.substAlgHom_X] + have hvb : (v.series.map (Int.castRingHom ℚ)).subst b = PowerSeries.X := by + rw [show b = MvPowerSeries.map (Int.castRingHom ℚ) v.inv from rfl, + ← PowerSeries.map_subst v.inv_hasSubst, v.subst_inv] + exact PowerSeries.map_X _ + rw [hx, PowerSeries.subst_mul hb] at hh + have hnat : PowerSeries.subst b (p : PowerSeries ℚ) = p := by + rw [← PowerSeries.coe_substAlgHom hb, map_natCast] + rw [hnat, hvb] at hh + simpa only [map_mul, map_natCast] using hh + +lemma integralSpecial_p_split (p : ℕ) [hp : Fact p.Prime] : + ∃ a : PowerSeries ℤ, a.constantCoeff = 0 ∧ (p : PowerSeries ℤ) ∣ a ∧ + multiplicationSeries (integralSpecial p) p = + (integralSpecial p).toPowerSeries.subst ![a, PowerSeries.X^(p^3)] := by + obtain ⟨a,ha,had,hal⟩ := specialLog_p_error p + have ham : (MvPowerSeries.map (Int.castRingHom ℚ) a).constantCoeff = 0 := by + rw [constantCoeff_map] + change (Int.castRingHom ℚ) a.constantCoeff = 0 + rw [ha, map_zero] + have hx : (PowerSeries.X^(p^3) : PowerSeries ℚ).constantCoeff = 0 := by + simp [PowerSeries.constantCoeff, PowerSeries.X, hp.out.ne_zero] + change (specialLog p).series.subst (MvPowerSeries.map (Int.castRingHom ℚ) a) = _ at hal + have hQ : multiplicationSeries (specialLog p).formalGroup p = + (specialLog p).law.subst ![a.map (Int.castRingHom ℚ), PowerSeries.X^(p^3)] := by + apply (specialLog p).subst_injective + (PowerSeries.HasSubst.of_constantCoeff_zero (multiplication_constant _ _)) + (PowerSeries.HasSubst.of_constantCoeff_zero ((specialLog p).law_pair_constant _ _ ham hx)) + rw [log_multiplication, (specialLog p).log_law_pair _ _ ham hx, hal] + convert specialLog_functional p using 1 <;> + simp only [smul_eq_C_mul, map_natCast, nsmul_eq_mul] + refine ⟨a,ha,had,?_⟩ + apply map_injective (Int.castRingHom ℚ) Int.cast_injective + change PowerSeries.map (Int.castRingHom ℚ) (multiplicationSeries (integralSpecial p) p) = _ + rw [← multiplication_map, integralSpecial_map] + have hpairs : MvPowerSeries.HasSubst ![a, (PowerSeries.X : PowerSeries ℤ)^(p^3)] := + hasSubst_of_constantCoeff_zero (by + intro i; fin_cases i; exact ha + simp [PowerSeries.X, hp.out.ne_zero]) + rw [map_subst hpairs] + change multiplicationSeries (specialLog p).formalGroup p = + ((integralSpecial p).map (Int.castRingHom ℚ)).toPowerSeries.subst _ + rw [integralSpecial_map] + convert hQ using 1 + congr 2 + funext i; fin_cases i <;> simp [PowerSeries.X, PowerSeries.map] + +theorem integralSpecial_honda (p : ℕ) [hp : Fact p.Prime] + (K : Type*) [CommRing K] [CharP K p] : + multiplicationSeries ((integralSpecial p).map (Int.castRingHom K)) p = + PowerSeries.X^(p^3) := by + obtain ⟨a,ha,⟨b,hb⟩,hs⟩ := integralSpecial_p_split p + have hap : a.map (Int.castRingHom K) = 0 := by + rw [hb, map_mul, map_natCast] + have hpK : (p : PowerSeries K) = 0 := by + simpa only [map_natCast, map_zero] using congrArg + (PowerSeries.C (R := K)) (CharP.cast_eq_zero K p) + rw [hpK, zero_mul] + rw [multiplication_map, hs] + have hpairs : MvPowerSeries.HasSubst ![a, (PowerSeries.X : PowerSeries ℤ)^(p^3)] := + hasSubst_of_constantCoeff_zero (by + intro i; fin_cases i; exact ha + simp [PowerSeries.X, hp.out.ne_zero]) + change MvPowerSeries.map (Int.castRingHom K) _ = _ + rw [map_subst hpairs] + have hpair : (fun i => MvPowerSeries.map (Int.castRingHom K) + (![a, (PowerSeries.X : PowerSeries ℤ)^(p^3)] i)) = + ![0, (PowerSeries.X : PowerSeries K)^(p^3)] := by + funext i; fin_cases i + · exact hap + · simp [PowerSeries.X] + rw [hpair] + change ((integralSpecial p).map (Int.castRingHom K)).toPowerSeries.subst + ![0, (PowerSeries.X : PowerSeries K)^(p^3)] = _ + exact FormalGroup.zero_add ((integralSpecial p).map (Int.castRingHom K)) + (PowerSeries.HasSubst.of_constantCoeff_zero + (by simp [PowerSeries.X, hp.out.ne_zero])) + +def hondaLaw (p : ℕ) [Fact p.Prime] (K : Type*) [CommRing K] : FormalGroup K := + (integralSpecial p).map (Int.castRingHom K) + +instance hondaLaw_comm (p : ℕ) [hp : Fact p.Prime] (K : Type*) [CommRing K] : + (hondaLaw p K).IsComm := by + have : (integralSpecial p).IsComm := integralFormalGroup_isComm .. + change ((integralSpecial p).map (Int.castRingHom K)).IsComm + infer_instance + +lemma reducedHonda_specialFiber (p : ℕ) [hp : Fact p.Prime] + (K : Type*) [CommRing K] : + (reducedHonda p K).map MvPowerSeries.constantCoeff = hondaLaw p K := by + have hc : MvPowerSeries.constantCoeff.comp + (MvPowerSeries.map (σ := Fin 2) (Int.castRingHom K)) = + (Int.castRingHom K).comp MvPowerSeries.constantCoeff := by + ext f + rfl + change ((integralHonda p).map (MvPowerSeries.map (Int.castRingHom K))).map _ = _ + rw [formalGroup_map_map, hc, ← formalGroup_map_map, integralHonda_specialize] + rfl + +theorem constructed_honda_deformation (p : ℕ) [hp : Fact p.Prime] + (K : Type*) [CommRing K] [CharP K p] : + (reducedHonda p K).IsComm ∧ + (reducedHonda p K).map MvPowerSeries.constantCoeff = hondaLaw p K ∧ + multiplicationSeries (hondaLaw p K) p = PowerSeries.X^(p^3) ∧ + HeightCoordinates p (reducedHonda p K) := + ⟨inferInstance, reducedHonda_specialFiber p K, integralSpecial_honda p K, + reducedHonda_heightCoordinates p K⟩ + +end HeightThree.HondaSpecialFiber + +end + +end OAI diff --git a/lean/OAI/Algebra/FormalGroup/Honda/Tangent.lean b/lean/OAI/Algebra/FormalGroup/Honda/Tangent.lean new file mode 100644 index 0000000000000000000000000000000000000000..79a7b1acbe1bd33a048eaa0e573d12c4d8a3972b --- /dev/null +++ b/lean/OAI/Algebra/FormalGroup/Honda/Tangent.lean @@ -0,0 +1,209 @@ +import OAI.Algebra.FormalGroup.Honda.Rigidity + +namespace OAI + +noncomputable section + +namespace HeightThree.TangentClassification +open MvPowerSeries PowerSeriesDifferential +variable {R σ : Type*} [CommRing R] + +lemma expand_injective (q : ℕ) (hq : q ≠ 0) : + Function.Injective (MvPowerSeries.expand (R := R) (σ := σ) q hq) := by + intro f g h + ext d + simpa only [coeff_expand_smul] using congrArg (coeff (q • d)) h + +lemma pderiv_expand_zero (p : ℕ) [hp : Fact p.Prime] [CharP R p] + (f : MvPowerSeries σ R) (i : σ) : + pderiv i (expand p hp.out.ne_zero f) = 0 := by + ext d + rw [coeff_pderiv, map_zero] + by_cases h : p ∣ d i + 1 + · have hn : (d i : R) + 1 = 0 := by + simpa only [Nat.cast_add, Nat.cast_one] using (CharP.cast_eq_zero_iff R p (d i+1)).mpr h + rw [hn, mul_zero] + · rw [coeff_expand_of_not_dvd p hp.out.ne_zero f (i := i) (by simpa using h), zero_mul] + +lemma exists_expand_derivative_zero [Nontrivial R] (p : ℕ) + [hp : Fact p.Prime] [CharP R p] (f : PowerSeries R) + (hf : PowerSeries.derivative f = 0) : + ∃ g, PowerSeries.expand p hp.out.ne_zero g = f := by + refine ⟨PowerSeries.mk (fun n => f.coeff (p*n)), ?_⟩ + ext n + by_cases hn : p ∣ n + · obtain ⟨n, rfl⟩ := hn + rw [PowerSeries.coeff_expand_mul, PowerSeries.coeff_mk] + · rw [PowerSeries.coeff_expand_of_not_dvd _ _ _ hn] + have hn0 : n ≠ 0 := by intro h; exact hn (h ▸ dvd_zero p) + have hh := congrArg (PowerSeries.coeff (n-1)) hf + rw [PowerSeries.coeff_derivative, Nat.sub_add_cancel (by omega : 1 ≤ n), map_zero] at hh + have hunit : IsUnit (n : R) := (CharP.isUnit_natCast_iff hp.out).mpr hn + have he : (n-1 : ℕ) + 1 = n := Nat.sub_add_cancel (by omega) + have he' : ((n-1 : ℕ) : R)+1 = (n : R) := by simpa only [Nat.cast_add, Nat.cast_one] using congrArg (Nat.cast : ℕ → R) he + rw [he'] at hh + exact (hunit.mul_left_eq_zero.mp hh).symm + +lemma exists_linear_add_expand [Nontrivial R] (p : ℕ) + [hp : Fact p.Prime] [CharP R p] (f : PowerSeries R) + (hf0 : f.constantCoeff = 0) + (hf : PowerSeries.derivative f = PowerSeries.C (f.coeff 1)) : + ∃ g : PowerSeries R, g.constantCoeff = 0 ∧ + f = PowerSeries.C (f.coeff 1) * PowerSeries.X + PowerSeries.expand p hp.out.ne_zero g := by + have hzero : PowerSeries.derivative (f - PowerSeries.C (f.coeff 1) * PowerSeries.X) = 0 := by + simp [hf] + obtain ⟨g, hg⟩ := exists_expand_derivative_zero p _ hzero + refine ⟨g, ?_, ?_⟩ + · have hh := congrArg PowerSeries.constantCoeff hg + simpa [hf0] using hh + · rw [hg]; ring + +def delta (F : FormalGroup R) (f : PowerSeries R) : MvPowerSeries (Fin 2) R := + f.subst F.toPowerSeries - f.subst (X 0) - f.subst (X 1) + +lemma delta_sub (F : FormalGroup R) (f g : PowerSeries R) : + delta F (f-g) = delta F f - delta F g := by + simp only [delta, PowerSeries.subst_sub (PowerSeries.HasSubst.of_constantCoeff_zero F.zero_constantCoeff), + PowerSeries.subst_sub (PowerSeries.HasSubst.X (0 : Fin 2)), PowerSeries.subst_sub (PowerSeries.HasSubst.X (1 : Fin 2))] + ring + +lemma delta_add (F : FormalGroup R) (f g : PowerSeries R) : + delta F (f+g) = delta F f + delta F g := by + simp only [delta, PowerSeries.subst_add (PowerSeries.HasSubst.of_constantCoeff_zero F.zero_constantCoeff), + PowerSeries.subst_add (PowerSeries.HasSubst.X (0 : Fin 2)), PowerSeries.subst_add (PowerSeries.HasSubst.X (1 : Fin 2))] + ring + +lemma delta_smul (F : FormalGroup R) (a : R) (f : PowerSeries R) : + delta F (a • f) = a • delta F f := by + simp only [delta, PowerSeries.subst_smul (PowerSeries.HasSubst.of_constantCoeff_zero F.zero_constantCoeff), + PowerSeries.subst_smul (PowerSeries.HasSubst.X (0 : Fin 2)), PowerSeries.subst_smul (PowerSeries.HasSubst.X (1 : Fin 2)), smul_sub] + +lemma delta_X (F : FormalGroup R) : delta F PowerSeries.X = F.toPowerSeries - X 0 - X 1 := by + simp only [delta, PowerSeries.subst_X (PowerSeries.HasSubst.of_constantCoeff_zero F.zero_constantCoeff), + PowerSeries.subst_X (PowerSeries.HasSubst.X (0 : Fin 2)), PowerSeries.subst_X (PowerSeries.HasSubst.X (1 : Fin 2))] + +lemma pderiv_delta (F : FormalGroup R) (hF : pderiv 0 F.toPowerSeries = 1) + (f : PowerSeries R) : + pderiv 0 (delta F f) = + (PowerSeries.derivative f).subst F.toPowerSeries - + (PowerSeries.derivative f).subst (X 0) := by + simp only [delta, map_sub, pderiv_subst _ _ F.zero_constantCoeff, + pderiv_subst _ _ (constantCoeff_X (R := R) (s := (0 : Fin 2))), pderiv_subst _ _ (constantCoeff_X (R := R) (s := (1 : Fin 2))), + hF, pderiv_X] + simp + +lemma derivative_constant_of_delta_expand (p : ℕ) [hp : Fact p.Prime] [CharP R p] + (F : FormalGroup R) (hF : pderiv 0 F.toPowerSeries = 1) + (f : PowerSeries R) (D : MvPowerSeries (Fin 2) R) + (h : delta F f = expand p hp.out.ne_zero D) : + PowerSeries.derivative f = PowerSeries.C (f.coeff 1) := by + have hh := congrArg (pderiv 0) h + rw [pderiv_delta F hF, pderiv_expand_zero] at hh + have he : (PowerSeries.derivative f).subst F.toPowerSeries = + (PowerSeries.derivative f).subst (X 0) := sub_eq_zero.mp hh + let a : Fin 2 → PowerSeries R := ![0, PowerSeries.X] + have ha : MvPowerSeries.HasSubst a := hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> simp [a, PowerSeries.X]) + have he' := congrArg (MvPowerSeries.subst a) he + change MvPowerSeries.subst a (MvPowerSeries.subst (fun _ : Unit => F.toPowerSeries) _) = + MvPowerSeries.subst a (MvPowerSeries.subst (fun _ : Unit => X 0) _) at he' + rw [MvPowerSeries.subst_comp_subst_apply + (PowerSeries.HasSubst.of_constantCoeff_zero F.zero_constantCoeff).const ha, + MvPowerSeries.subst_comp_subst_apply (PowerSeries.HasSubst.X (0 : Fin 2)).const ha] at he' + have hleft : F.toPowerSeries.subst a = PowerSeries.X := by + exact F.zero_add PowerSeries.HasSubst.X' + simp only [hleft, subst_X ha] at he' + change (PowerSeries.derivative f).subst PowerSeries.X = + (PowerSeries.derivative f).subst 0 at he' + have hc : (PowerSeries.derivative f).constantCoeff = f.coeff 1 := by + rw [← PowerSeries.coeff_zero_eq_constantCoeff, PowerSeries.coeff_derivative] + simp + simpa [PowerSeries.subst_zero_eq_C_constantCoeff, PowerSeries.C, hc] using he' + +lemma subst_expand_outer (q : ℕ) (hq : q ≠ 0) (f : PowerSeries R) + (a : MvPowerSeries σ R) (ha : PowerSeries.HasSubst a) : + (PowerSeries.expand q hq f).subst a = f.subst (a^q) := by + rw [PowerSeries.expand_apply, PowerSeries.subst_comp_subst_apply + (PowerSeries.HasSubst.X_pow hq) ha, PowerSeries.subst_pow ha, + PowerSeries.subst_X ha] + +lemma delta_expand (q : ℕ) (hq : q ≠ 0) (F : FormalGroup R) + (hF : F.toPowerSeries^q = expand q hq F.toPowerSeries) (f : PowerSeries R) : + delta F (PowerSeries.expand q hq f) = expand q hq (delta F f) := by + rw [delta, subst_expand_outer q hq f _ (PowerSeries.HasSubst.of_constantCoeff_zero F.zero_constantCoeff), + subst_expand_outer q hq f _ (PowerSeries.HasSubst.X (0 : Fin 2)), + subst_expand_outer q hq f _ (PowerSeries.HasSubst.X (1 : Fin 2)), hF] + simp only [delta, map_sub, PowerSeries.expand_subst q hq + (PowerSeries.HasSubst.of_constantCoeff_zero F.zero_constantCoeff), + PowerSeries.expand_subst q hq (PowerSeries.HasSubst.X (0 : Fin 2)), + PowerSeries.expand_subst q hq (PowerSeries.HasSubst.X (1 : Fin 2)), expand_X] + +lemma partial_of_nonlinear_expand (p : ℕ) [hp : Fact p.Prime] [CharP R p] + (F : FormalGroup R) (H : MvPowerSeries (Fin 2) R) + (hF : F.toPowerSeries - X 0 - X 1 = expand (p^2) (pow_ne_zero _ hp.out.ne_zero) H) : + pderiv 0 F.toPowerSeries = 1 := by + have hfac : expand (p^2) (pow_ne_zero _ hp.out.ne_zero) H = + expand p hp.out.ne_zero (expand p hp.out.ne_zero H) := by + simpa only [pow_two] using expand_mul p hp.out.ne_zero p hp.out.ne_zero H + have he : F.toPowerSeries = X 0 + X 1 + expand p hp.out.ne_zero (expand p hp.out.ne_zero H) := by + rw [← hfac, ← hF]; ring + rw [he, map_add, map_add, pderiv_expand_zero] + simp + +theorem tangent_decomposition [Nontrivial R] (p : ℕ) [hp : Fact p.Prime] [CharP R p] + (F : FormalGroup R) (H : MvPowerSeries (Fin 2) R) + (hF : F.toPowerSeries^p = expand p hp.out.ne_zero F.toPowerSeries) + (hH : F.toPowerSeries - X 0 - X 1 = expand (p^2) (pow_ne_zero _ hp.out.ne_zero) H) + (v : PowerSeries R) (hv0 : v.constantCoeff = 0) (hv1 : v.coeff 1 = 0) + (D : MvPowerSeries (Fin 2) R) + (hv : delta F v = expand (p^3) (pow_ne_zero _ hp.out.ne_zero) D) : + ∃ (a b : R) (w : PowerSeries R), w.constantCoeff = 0 ∧ + v = a • PowerSeries.X^p + b • PowerSeries.X^(p^2) + + PowerSeries.expand (p^3) (pow_ne_zero _ hp.out.ne_zero) w := by + have hpartial := partial_of_nonlinear_expand p F H hH + have hfac3 (D : MvPowerSeries (Fin 2) R) : + expand (p^3) (pow_ne_zero _ hp.out.ne_zero) D = + expand p hp.out.ne_zero (expand (p^2) (pow_ne_zero _ hp.out.ne_zero) D) := by + simpa only [show p^3 = p*(p^2) by ring] using + expand_mul p hp.out.ne_zero (p^2) (pow_ne_zero _ hp.out.ne_zero) D + have hfac2 (D : MvPowerSeries (Fin 2) R) : + expand (p^2) (pow_ne_zero _ hp.out.ne_zero) D = + expand p hp.out.ne_zero (expand p hp.out.ne_zero D) := by + simpa only [pow_two] using expand_mul p hp.out.ne_zero p hp.out.ne_zero D + have hdv : PowerSeries.derivative v = 0 := by + rw [derivative_constant_of_delta_expand p F hpartial v _ (by rw [← hfac3]; exact hv), hv1, map_zero] + obtain ⟨v₁, hv₁⟩ := exists_expand_derivative_zero p v hdv + have hv₁0 : v₁.constantCoeff = 0 := by + simpa only [PowerSeries.constantCoeff_expand, hv0] using congrArg PowerSeries.constantCoeff hv₁ + have hdv₁ : delta F v₁ = expand (p^2) (pow_ne_zero _ hp.out.ne_zero) D := by + apply expand_injective p hp.out.ne_zero + rw [← delta_expand p hp.out.ne_zero F hF, hv₁, ← hfac3, hv] + have hh₁ := derivative_constant_of_delta_expand p F hpartial v₁ _ (by rw [← hfac2]; exact hdv₁) + obtain ⟨v₂, hv₂0, hv₂⟩ := exists_linear_add_expand p v₁ hv₁0 hh₁ + let a := v₁.coeff 1 + have he₁ : v₁ = a • PowerSeries.X + PowerSeries.expand p hp.out.ne_zero v₂ := by + simpa only [smul_eq_mul, ← PowerSeries.smul_eq_C_mul] using hv₂ + have hdv₂ : delta F v₂ = expand p hp.out.ne_zero (D - a • H) := by + have he := hdv₁ + rw [he₁, delta_add, delta_smul, delta_X, hH, delta_expand p hp.out.ne_zero F hF] at he + apply expand_injective p hp.out.ne_zero + rw [← hfac2, map_sub, map_smul] + apply eq_sub_iff_add_eq.mpr + simpa only [add_comm] using he + have hh₂ := derivative_constant_of_delta_expand p F hpartial v₂ _ hdv₂ + obtain ⟨w, hw0, hw⟩ := exists_linear_add_expand p v₂ hv₂0 hh₂ + let b := v₂.coeff 1 + have he₂ : v₂ = b • PowerSeries.X + PowerSeries.expand p hp.out.ne_zero w := by + simpa only [smul_eq_mul, ← PowerSeries.smul_eq_C_mul] using hw + refine ⟨a, b, w, hw0, ?_⟩ + rw [← hv₁, he₁, he₂] + simp only [map_add, map_smul, map_pow, PowerSeries.expand_X] + rw [← PowerSeries.expand_mul, ← PowerSeries.expand_mul, ← pow_mul] + have he2 : p*p = p^2 := by ring + have he3 : p^2*p = p^3 := by ring + simp only [he2, he3, add_assoc] + +end HeightThree.TangentClassification + +end + +end OAI diff --git a/lean/OAI/Algebra/FormalGroup/Honda/Target.lean b/lean/OAI/Algebra/FormalGroup/Honda/Target.lean new file mode 100644 index 0000000000000000000000000000000000000000..fda18a737bd9c58bda98d7ff1eb011340140daa0 --- /dev/null +++ b/lean/OAI/Algebra/FormalGroup/Honda/Target.lean @@ -0,0 +1,63 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace HeightThree.HondaTarget + +universe u + +abbrev Base (K : Type*) [CommRing K] := MvPowerSeries (Fin 2) K + +def variablePoint {R : Type*} [CommRing R] (F : FormalGroup R) : F.Point Unit := + ⟨PowerSeries.X, PowerSeries.HasSubst.X'⟩ + +def multiplicationSeries {R : Type*} [CommRing R] (F : FormalGroup R) (n : ℕ) : + PowerSeries R := (n • variablePoint F).val + +structure CoordinateIso {R : Type*} [CommRing R] (F G : FormalGroup R) where + series : PowerSeries R + inverse : PowerSeries R + zero_series : series.constantCoeff = 0 + zero_inverse : inverse.constantCoeff = 0 + left_inv : series.subst inverse = PowerSeries.X + right_inv : inverse.subst series = PowerSeries.X + preserves_addition : + series.subst F.toPowerSeries = + G.toPowerSeries.subst + ![series.subst (MvPowerSeries.X 0), series.subst (MvPowerSeries.X 1)] + +def FramedEquivalent {K R : Type*} [CommRing K] [CommRing R] + (ρ : R →+* K) (F G : FormalGroup R) : Prop := + ∃ e : CoordinateIso F G, PowerSeries.map ρ e.series = PowerSeries.X + +def HeightCoordinates {K : Type*} [CommRing K] (p : ℕ) + (G : FormalGroup (Base K)) : Prop := + (∀ j < p, (multiplicationSeries G p).coeff j = 0) ∧ + (multiplicationSeries G p).coeff p = MvPowerSeries.X 0 ∧ + (∀ j < p^2, (multiplicationSeries G p).coeff j ∈ + Ideal.span ({MvPowerSeries.X 0} : Set (Base K))) ∧ + (multiplicationSeries G p).coeff (p^2) - MvPowerSeries.X 1 ∈ + Ideal.span ({MvPowerSeries.X 0} : Set (Base K)) + +def IsUniversal {K : Type u} [Field K] (Γ : FormalGroup K) + (G : FormalGroup (Base K)) : Prop := + ∀ (R : Type u) [CommRing R] [Algebra K R] [IsLocalRing R] + [FiniteDimensional K R] (ρ : R →ₐ[K] K) (F : FormalGroup R), + F.IsComm → F.map ρ.toRingHom = Γ → + ∃! f : Base K →ₐ[K] R, + ρ.toRingHom.comp f.toRingHom = MvPowerSeries.constantCoeff ∧ + FramedEquivalent ρ.toRingHom (G.map f.toRingHom) F + +def HasUniversalHeightCoordinates {K : Type u} [Field K] (p : ℕ) + (Γ : FormalGroup K) : Prop := + ∃ G : FormalGroup (Base K), + G.IsComm ∧ G.map MvPowerSeries.constantCoeff = Γ ∧ + IsUniversal Γ G ∧ HeightCoordinates p G + +end HeightThree.HondaTarget + +end + +end OAI diff --git a/lean/OAI/Algebra/FormalGroup/Honda/Transport.lean b/lean/OAI/Algebra/FormalGroup/Honda/Transport.lean new file mode 100644 index 0000000000000000000000000000000000000000..db567fe485304b6b80ddc2274e5bb030f3f35016 --- /dev/null +++ b/lean/OAI/Algebra/FormalGroup/Honda/Transport.lean @@ -0,0 +1,382 @@ +import OAI.Algebra.FormalGroup.Honda.SmallExtension + +namespace OAI + +noncomputable section + +namespace HeightThree.CoordinateTransport +open MvPowerSeries HondaTarget DeformationRigidity OriginalDifferentialSupport +variable {R S : Type*} [CommRing R] [CommRing S] + +lemma constantCoeff_pderiv {σ : Type*} (f : MvPowerSeries σ R) (i : σ) : + constantCoeff (pderiv i f) = coeff (Finsupp.single i 1) f := by + rw [←coeff_zero_eq_constantCoeff,coeff_pderiv]; simp + +lemma linear_subst {σ τ : Type*} [Fintype σ] (f : MvPowerSeries σ R) + (a : σ → MvPowerSeries τ R) (ha : ∀ i, (a i).constantCoeff = 0) (j : τ) : + coeff (Finsupp.single j 1) (f.subst a) = + ∑ i, coeff (Finsupp.single i 1) f * coeff (Finsupp.single j 1) (a i) := by + rw [←constantCoeff_pderiv, pderiv_subst a (hasSubst_of_constantCoeff_zero ha)] + simp only [map_sum,map_mul,constantCoeff_subst_zero_axis _ (hasSubst_of_constantCoeff_zero ha) ha, + constantCoeff_pderiv] + +lemma unilinear_subst {σ : Type*} (f : PowerSeries R) (a : MvPowerSeries σ R) + (ha : a.constantCoeff = 0) (i : σ) : + coeff (Finsupp.single i 1) (f.subst a) = f.coeff 1*coeff (Finsupp.single i 1) a := by + simpa [PowerSeries.subst,PowerSeries.coeff] using linear_subst f (fun _ : Unit => a) (fun _ => ha) i + +structure Coordinate (R : Type*) [CommRing R] where + series : PowerSeries R + inverse : PowerSeries R + zero_series : series.constantCoeff = 0 + zero_inverse : inverse.constantCoeff = 0 + left_inv : series.subst inverse = PowerSeries.X + right_inv : inverse.subst series = PowerSeries.X + +namespace Coordinate +variable (c : Coordinate R) +def ofSeries (u : PowerSeries R) (hu : u.constantCoeff=0) (hunit : IsUnit (u.coeff 1)) : Coordinate R where + series := u + inverse := u.substInvOfIsUnit hunit + zero_series := hu + zero_inverse := PowerSeries.constantCoeff_substInvOfIsUnit _ _ + left_inv := PowerSeries.subst_substInvOfIsUnit_right _ hu hunit + right_inv := PowerSeries.subst_substInvOfIsUnit_left _ hu hunit + +def symm : Coordinate R := ⟨c.inverse,c.series,c.zero_inverse,c.zero_series,c.right_inv,c.left_inv⟩ + +lemma hasSubst : PowerSeries.HasSubst c.series := .of_constantCoeff_zero c.zero_series +lemma inv_hasSubst : PowerSeries.HasSubst c.inverse := .of_constantCoeff_zero c.zero_inverse +lemma series_const {σ} (a : MvPowerSeries σ R) (ha : a.constantCoeff=0) : + (c.series.subst a).constantCoeff=0 := PowerSeries.constantCoeff_subst_eq_zero ha _ c.zero_series +lemma inverse_const {σ} (a : MvPowerSeries σ R) (ha : a.constantCoeff=0) : + (c.inverse.subst a).constantCoeff=0 := PowerSeries.constantCoeff_subst_eq_zero ha _ c.zero_inverse + +lemma series_inverse {σ} (a : MvPowerSeries σ R) (ha : PowerSeries.HasSubst a) : + c.series.subst (c.inverse.subst a)=a := by + rw [←PowerSeries.subst_comp_subst_apply c.inv_hasSubst ha,c.left_inv,PowerSeries.subst_X ha] +lemma inverse_series {σ} (a : MvPowerSeries σ R) (ha : PowerSeries.HasSubst a) : + c.inverse.subst (c.series.subst a)=a := by + rw [←PowerSeries.subst_comp_subst_apply c.hasSubst ha,c.right_inv,PowerSeries.subst_X ha] +lemma inverse_injective {σ} (a b : MvPowerSeries σ R) + (ha : PowerSeries.HasSubst a) (hb : PowerSeries.HasSubst b) + (he : c.inverse.subst a=c.inverse.subst b) : a=b := by + have hh := congrArg (fun z => c.series.subst z) he + simpa only [c.series_inverse _ ha,c.series_inverse _ hb] using hh + +lemma linear_inverse : c.series.coeff 1*c.inverse.coeff 1=1 := by + have hh := congrArg (PowerSeries.coeff 1) c.left_inv + rw [show PowerSeries.coeff 1 (c.series.subst c.inverse) = c.series.coeff 1*c.inverse.coeff 1 from + unilinear_subst _ _ c.zero_inverse (), PowerSeries.coeff_one_X] at hh + exact hh + +def law (F : FormalGroup R) : MvPowerSeries (Fin 2) R := + c.series.subst (F.toPowerSeries.subst ![c.inverse.subst (X 0), c.inverse.subst (X 1)]) + +lemma formal_pair_const (F : FormalGroup R) {σ} (a b : MvPowerSeries σ R) + (ha : a.constantCoeff=0) (hb : b.constantCoeff=0) : + (F.toPowerSeries.subst ![a,b]).constantCoeff=0 := + constantCoeff_subst_eq_zero (hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> assumption)) + (by intro i; fin_cases i <;> assumption) F.zero_constantCoeff + +lemma law_const (F : FormalGroup R) : (c.law F).constantCoeff=0 := + c.series_const _ (formal_pair_const F _ _ (c.inverse_const _ (by simp)) (c.inverse_const _ (by simp))) + +lemma law_pair (F : FormalGroup R) {σ} (a b : MvPowerSeries σ R) + (ha : a.constantCoeff=0) (hb : b.constantCoeff=0) : + (c.law F).subst ![a,b] = + c.series.subst (F.toPowerSeries.subst ![c.inverse.subst a,c.inverse.subst b]) := by + have hab : HasSubst ![a,b] := hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> assumption) + have hi (i : Fin 2) : (c.inverse.subst (X i : MvPowerSeries (Fin 2) R)).constantCoeff=0 := c.inverse_const _ (by simp) + have his : HasSubst ![c.inverse.subst (X 0 : MvPowerSeries (Fin 2) R),c.inverse.subst (X 1)] := + hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> exact hi _) + rw [law,subst_after_mv _ _ (.of_constantCoeff_zero (formal_pair_const F _ _ (hi _) (hi _))) _ hab, + MvPowerSeries.subst_comp_subst_apply his hab] + congr 2 + funext i; fin_cases i + · change (c.inverse.subst (X 0 : MvPowerSeries (Fin 2) R)).subst ![a,b] = c.inverse.subst a + rw [subst_after_mv _ _ (PowerSeries.HasSubst.X _) _ hab,subst_X hab]; rfl + · change (c.inverse.subst (X 1 : MvPowerSeries (Fin 2) R)).subst ![a,b] = c.inverse.subst b + rw [subst_after_mv _ _ (PowerSeries.HasSubst.X _) _ hab,subst_X hab]; rfl + +lemma law_pair_const (F : FormalGroup R) {σ} (a b : MvPowerSeries σ R) + (ha : a.constantCoeff=0) (hb : b.constantCoeff=0) : + ((c.law F).subst ![a,b]).constantCoeff=0 := by + rw [c.law_pair F a b ha hb] + exact c.series_const _ (formal_pair_const F _ _ (c.inverse_const _ ha) (c.inverse_const _ hb)) + +lemma inverse_law_pair (F : FormalGroup R) {σ} (a b : MvPowerSeries σ R) + (ha : a.constantCoeff=0) (hb : b.constantCoeff=0) : + c.inverse.subst ((c.law F).subst ![a,b]) = + F.toPowerSeries.subst ![c.inverse.subst a,c.inverse.subst b] := by + rw [c.law_pair F a b ha hb] + exact c.inverse_series _ (.of_constantCoeff_zero + (formal_pair_const F _ _ (c.inverse_const _ ha) (c.inverse_const _ hb))) + +lemma law_linear (F : FormalGroup R) (i : Fin 2) : + coeff (Finsupp.single i 1) (c.law F)=1 := by + rw [law,unilinear_subst _ _ (formal_pair_const F _ _ (c.inverse_const _ (by simp)) (c.inverse_const _ (by simp)))] + rw [linear_subst _ _ (by intro j; fin_cases j <;> exact c.inverse_const _ (by simp))] + simp only [Fin.sum_univ_two,Matrix.cons_val_zero,Matrix.cons_val_one,F.lin_coeff_X,F.lin_coeff_Y,one_mul] + change c.series.coeff 1*(coeff (Finsupp.single i 1) (c.inverse.subst (X 0)) + + coeff (Finsupp.single i 1) (c.inverse.subst (X 1)))=1 + rw [unilinear_subst _ _ (constantCoeff_X 0),unilinear_subst _ _ (constantCoeff_X 1)] + fin_cases i <;> simpa [coeff_index_single_X] using c.linear_inverse + +def transport (F : FormalGroup R) : FormalGroup R where + toPowerSeries := c.law F + zero_constantCoeff := c.law_const F + lin_coeff_X := c.law_linear F 0 + lin_coeff_Y := c.law_linear F 1 + assoc := by + have hx (i : Fin 3) : (X i : MvPowerSeries (Fin 3) R).constantCoeff=0 := by simp + apply c.inverse_injective _ _ + (.of_constantCoeff_zero (c.law_pair_const F _ _ (c.law_pair_const F _ _ (hx 0) (hx 1)) (hx 2))) + (.of_constantCoeff_zero (c.law_pair_const F _ _ (hx 0) (c.law_pair_const F _ _ (hx 1) (hx 2)))) + rw [c.inverse_law_pair F _ _ (c.law_pair_const F _ _ (hx 0) (hx 1)) (hx 2), + c.inverse_law_pair F _ _ (hx 0) (c.law_pair_const F _ _ (hx 1) (hx 2)), + c.inverse_law_pair F _ _ (hx 0) (hx 1),c.inverse_law_pair F _ _ (hx 1) (hx 2)] + exact F.assoc' (.of_constantCoeff_zero (c.inverse_const _ (hx 0))) + (.of_constantCoeff_zero (c.inverse_const _ (hx 1))) (.of_constantCoeff_zero (c.inverse_const _ (hx 2))) + +instance transport_isComm (F : FormalGroup R) [F.IsComm] : (c.transport F).IsComm where + comm := by + change c.law F = (c.law F).subst ![X 1,X 0] + rw [c.law_pair F _ _ (by simp) (by simp)] + exact congrArg (fun z => c.series.subst z) (F.comm' + (.of_constantCoeff_zero (c.inverse_const _ (by simp))) (.of_constantCoeff_zero (c.inverse_const _ (by simp)))) + +def iso (F : FormalGroup R) : CoordinateIso F (c.transport F) where + series := c.series + inverse := c.inverse + zero_series := c.zero_series + zero_inverse := c.zero_inverse + left_inv := c.left_inv + right_inv := c.right_inv + preserves_addition := by + change c.series.subst F.toPowerSeries = (c.law F).subst ![c.series.subst (X 0),c.series.subst (X 1)] + rw [c.law_pair F _ _ (c.series_const _ (by simp)) (c.series_const _ (by simp)), + c.inverse_series _ (PowerSeries.HasSubst.X _),c.inverse_series _ (PowerSeries.HasSubst.X _)] + have hX : ![X 0,X 1] = (X : Fin 2 → MvPowerSeries (Fin 2) R) := by + funext i; fin_cases i <;> rfl + rw [hX,MvPowerSeries.subst_self] + rfl + +def map (π : R →+* S) : Coordinate S where + series := c.series.map π + inverse := c.inverse.map π + zero_series := by + change π (PowerSeries.constantCoeff c.series)=0 + rw [c.zero_series,map_zero] + zero_inverse := by + change π (PowerSeries.constantCoeff c.inverse)=0 + rw [c.zero_inverse,map_zero] + left_inv := by + change (c.series.map π).subst (MvPowerSeries.map π c.inverse)=PowerSeries.X + rw [←PowerSeries.map_subst c.inv_hasSubst,c.left_inv] + exact PowerSeries.map_X π + right_inv := by + change (c.inverse.map π).subst (MvPowerSeries.map π c.series)=PowerSeries.X + rw [←PowerSeries.map_subst c.hasSubst,c.right_inv] + exact PowerSeries.map_X π + +lemma transport_map (F : FormalGroup R) (π : R →+* S) : + (c.transport F).map π = (c.map π).transport (F.map π) := by + apply FormalGroup.ext + change MvPowerSeries.map π (c.law F) = (c.map π).law (F.map π) + have hi (i : Fin 2) : (c.inverse.subst (X i : MvPowerSeries (Fin 2) R)).constantCoeff=0 := c.inverse_const _ (by simp) + rw [law,PowerSeries.map_subst (.of_constantCoeff_zero (formal_pair_const F _ _ (hi _) (hi _))), + MvPowerSeries.map_subst (hasSubst_of_constantCoeff_zero (by intro i; fin_cases i <;> exact hi _))] + change (c.series.map π).subst _ = (c.series.map π).subst ((F.map π).toPowerSeries.subst _) + congr 2 + funext i; fin_cases i + · change (c.inverse.subst (X 0 : MvPowerSeries (Fin 2) R)).map π = (c.inverse.map π).subst (X 0) + rw [PowerSeries.map_subst (PowerSeries.HasSubst.X _),MvPowerSeries.map_X] + · change (c.inverse.subst (X 1 : MvPowerSeries (Fin 2) R)).map π = (c.inverse.map π).subst (X 1) + rw [PowerSeries.map_subst (PowerSeries.HasSubst.X _),MvPowerSeries.map_X] + +def ofIso {F G : FormalGroup R} (e : CoordinateIso F G) : Coordinate R := + ⟨e.series,e.inverse,e.zero_series,e.zero_inverse,e.left_inv,e.right_inv⟩ + +lemma transport_ofIso {F G : FormalGroup R} (e : CoordinateIso F G) : + (ofIso e).transport F=G := by + apply FormalGroup.ext + change e.series.subst (F.toPowerSeries.subst ![e.inverse.subst (X 0),e.inverse.subst (X 1)])=G.toPowerSeries + rw [coordinate_add F G e (e.inverse.subst (X 0 : MvPowerSeries (Fin 2) R)) + (e.inverse.subst (X 1)) ((ofIso e).inverse_const _ (by simp)) ((ofIso e).inverse_const _ (by simp))] + change G.toPowerSeries.subst ![(ofIso e).series.subst ((ofIso e).inverse.subst (X 0)), + (ofIso e).series.subst ((ofIso e).inverse.subst (X 1))]=G.toPowerSeries + rw [(ofIso e).series_inverse _ (PowerSeries.HasSubst.X _), + (ofIso e).series_inverse _ (PowerSeries.HasSubst.X _)] + have hX : ![X 0,X 1] = (X : Fin 2 → MvPowerSeries (Fin 2) R) := by + funext i; fin_cases i <;> rfl + rw [hX,MvPowerSeries.subst_self]; rfl + +lemma map_eq_of_series_eq (π : R →+* S) (d : Coordinate S) + (he : c.series.map π=d.series) : c.map π=d := by + have hi : c.inverse.map π=d.inverse := by + have hh := congrArg (fun z => d.inverse.subst z) (c.map π).left_inv + rw [show (c.map π).series=d.series from he,d.inverse_series _ (c.map π).inv_hasSubst, + PowerSeries.X_subst] at hh + exact hh + cases c; cases d + cases he; cases hi + rfl + +def ident : Coordinate R := + ⟨PowerSeries.X,PowerSeries.X,by simp,by simp,PowerSeries.X_subst _,PowerSeries.X_subst _⟩ + +lemma transport_ident (F : FormalGroup R) : (ident (R := R)).transport F=F := by + apply FormalGroup.ext + change PowerSeries.X.subst (F.toPowerSeries.subst ![PowerSeries.X.subst (X 0),PowerSeries.X.subst (X 1)])=F.toPowerSeries + rw [PowerSeries.subst_X (PowerSeries.HasSubst.X _),PowerSeries.subst_X (PowerSeries.HasSubst.X _)] + have hX : ![X 0,X 1] = (X : Fin 2 → MvPowerSeries (Fin 2) R) := by + funext i; fin_cases i <;> rfl + rw [hX,MvPowerSeries.subst_self] + exact PowerSeries.subst_X (.of_constantCoeff_zero F.zero_constantCoeff) + +lemma transport_map_eq_self (F : FormalGroup R) (π : R →+* S) + (he : c.series.map π=PowerSeries.X) : (c.transport F).map π=F.map π := by + rw [c.transport_map, c.map_eq_of_series_eq π ident he, transport_ident] + +def comp (d : Coordinate R) : Coordinate R where + series := d.series.subst c.series + inverse := c.inverse.subst d.inverse + zero_series := d.series_const _ c.zero_series + zero_inverse := c.inverse_const _ d.zero_inverse + left_inv := by + rw [PowerSeries.subst_comp_subst_apply c.hasSubst + (.of_constantCoeff_zero (c.inverse_const _ d.zero_inverse)), + c.series_inverse _ d.inv_hasSubst,d.left_inv] + right_inv := by + rw [PowerSeries.subst_comp_subst_apply d.inv_hasSubst + (.of_constantCoeff_zero (d.series_const _ c.zero_series)), + d.inverse_series _ c.hasSubst,c.right_inv] + +end Coordinate + +namespace CoordinateIso +open Coordinate + +def refl (F : FormalGroup R) : CoordinateIso F F := by + have e := (Coordinate.ident (R := R)).iso F + rw [Coordinate.transport_ident] at e + exact e + +def symm {F G : FormalGroup R} (e : CoordinateIso F G) : CoordinateIso G F where + __ := (Coordinate.ofIso e).symm + preserves_addition := by + have hh := coordinate_add F G e (e.inverse.subst (X 0 : MvPowerSeries (Fin 2) R)) (e.inverse.subst (X 1)) + ((Coordinate.ofIso e).inverse_const _ (by simp)) ((Coordinate.ofIso e).inverse_const _ (by simp)) + have hX : ![X 0,X 1] = (X : Fin 2 → MvPowerSeries (Fin 2) R) := by + funext i; fin_cases i <;> rfl + have hi0 := (Coordinate.ofIso e).series_inverse (X 0 : MvPowerSeries (Fin 2) R) (PowerSeries.HasSubst.X _) + have hi1 := (Coordinate.ofIso e).series_inverse (X 1 : MvPowerSeries (Fin 2) R) (PowerSeries.HasSubst.X _) + change e.series.subst (e.inverse.subst (X 0))=X 0 at hi0 + change e.series.subst (e.inverse.subst (X 1))=X 1 at hi1 + rw [hi0,hi1,hX,MvPowerSeries.subst_self] at hh + have hh' := congrArg (fun z : MvPowerSeries (Fin 2) R => e.inverse.subst z) hh + have hc : (F.toPowerSeries.subst ![e.inverse.subst (X 0 : MvPowerSeries (Fin 2) R), + e.inverse.subst (X 1)]).constantCoeff=0 := + Coordinate.formal_pair_const F _ _ ((Coordinate.ofIso e).inverse_const _ (by simp)) + ((Coordinate.ofIso e).inverse_const _ (by simp)) + have hi := (Coordinate.ofIso e).inverse_series _ (PowerSeries.HasSubst.of_constantCoeff_zero hc) + change e.inverse.subst (e.series.subst _) = _ at hi + rw [hi] at hh' + exact hh'.symm + +lemma trans_add {F G H : FormalGroup R} (e : CoordinateIso F G) (d : CoordinateIso G H) : + PowerSeries.subst F.toPowerSeries (d.series.subst e.series) = + H.toPowerSeries.subst ![PowerSeries.subst (X 0 : MvPowerSeries (Fin 2) R) (d.series.subst e.series), + PowerSeries.subst (X 1 : MvPowerSeries (Fin 2) R) (d.series.subst e.series)] := by + have h₁ := PowerSeries.subst_comp_subst_apply (.of_constantCoeff_zero e.zero_series) + (.of_constantCoeff_zero F.zero_constantCoeff) d.series + rw [h₁,e.preserves_addition] + have h₂ := coordinate_add G H d (e.series.subst (X 0 : MvPowerSeries (Fin 2) R)) + (e.series.subst (X 1)) ((Coordinate.ofIso e).series_const _ (by simp)) + ((Coordinate.ofIso e).series_const _ (by simp)) + rw [h₂] + apply congrArg (fun z : Fin 2 → MvPowerSeries (Fin 2) R => H.toPowerSeries.subst z) + funext i; fin_cases i <;> + exact (PowerSeries.subst_comp_subst_apply (.of_constantCoeff_zero e.zero_series) + (PowerSeries.HasSubst.X _) d.series).symm + +def trans {F G H : FormalGroup R} (e : CoordinateIso F G) (d : CoordinateIso G H) : CoordinateIso F H where + series := d.series.subst e.series + inverse := e.inverse.subst d.inverse + zero_series := ((Coordinate.ofIso e).comp (Coordinate.ofIso d)).zero_series + zero_inverse := ((Coordinate.ofIso e).comp (Coordinate.ofIso d)).zero_inverse + left_inv := ((Coordinate.ofIso e).comp (Coordinate.ofIso d)).left_inv + right_inv := ((Coordinate.ofIso e).comp (Coordinate.ofIso d)).right_inv + preserves_addition := trans_add e d + +def map {F G : FormalGroup R} (e : CoordinateIso F G) (π : R →+* S) : CoordinateIso (F.map π) (G.map π) where + __ := (Coordinate.ofIso e).map π + preserves_addition := by + have hh := congrArg (MvPowerSeries.map π) e.preserves_addition + rw [PowerSeries.map_subst (.of_constantCoeff_zero F.zero_constantCoeff), + MvPowerSeries.map_subst (hasSubst_of_constantCoeff_zero (by + intro i; fin_cases i <;> exact (Coordinate.ofIso e).series_const _ (by simp)))] at hh + have he : (fun i : Fin 2 => MvPowerSeries.map π + (![e.series.subst (X 0),e.series.subst (X 1)] i)) = + ![(e.series.map π).subst (X 0 : MvPowerSeries (Fin 2) S), + (e.series.map π).subst (X 1)] := by + funext i; fin_cases i <;> + simp [PowerSeries.map_subst (PowerSeries.HasSubst.X _)] + rw [he] at hh + exact hh + +end CoordinateIso +end HeightThree.CoordinateTransport + +namespace HeightThree.CoordinateTransport +open MvPowerSeries HondaTarget +variable {R S K : Type*} [CommRing R] [CommRing S] [CommRing K] + +lemma unimap_comp (π : R →+* S) (ρ : S →+* K) (f : PowerSeries R) : + (f.map π).map ρ=f.map (ρ.comp π) := MvPowerSeries.map_map _ _ _ + +lemma Coordinate.lift (π : R →+* S) (surj : Function.Surjective π) + (ρ : R →+* K) (σ : S →+* K) (fac : σ.comp π=ρ) + (hnil : ∀ a, ρ a=0 → IsNilpotent a) (d : Coordinate S) + (hd : d.series.map σ=PowerSeries.X) : + ∃ c : Coordinate R, c.map π=d ∧ c.series.map ρ=PowerSeries.X := by + classical + let u : PowerSeries R := PowerSeries.mk (fun n => if n=0 then 0 else (surj (d.series.coeff n)).choose) + have hu0 : u.constantCoeff=0 := by simp [u,PowerSeries.constantCoeff_mk] + have huπ : u.map π=d.series := by + ext n + rw [PowerSeries.coeff_map] + simp only [u,PowerSeries.coeff_mk] + split_ifs with hn + · subst n; simpa using d.zero_series.symm + · exact (surj _).choose_spec + have huρ : u.map ρ=PowerSeries.X := by + rw [←fac,←unimap_comp,huπ,hd] + have hu1 : IsUnit (u.coeff 1) := by + have hh := congrArg (PowerSeries.coeff 1) huρ + simp only [PowerSeries.coeff_map,PowerSeries.coeff_one_X] at hh + have hn := hnil (u.coeff 1-1) (by simp [hh]) + simpa using hn.isUnit_add_one + let c := Coordinate.ofSeries u hu0 hu1 + refine ⟨c,?_,huρ⟩ + exact c.map_eq_of_series_eq π d huπ + +lemma formal_map_comp (F : FormalGroup R) (π : R →+* S) (ρ : S →+* K) : + (F.map π).map ρ=F.map (ρ.comp π) := by + apply FormalGroup.ext + exact MvPowerSeries.map_map _ _ _ + +lemma formal_map_injective (π : R →+* S) (hi : Function.Injective π) : + Function.Injective (fun F : FormalGroup R => F.map π) := by + intro F G he + apply FormalGroup.ext + ext d + apply hi + exact congrArg (MvPowerSeries.coeff d ∘ FormalGroup.toPowerSeries) he + +end HeightThree.CoordinateTransport + +end + +end OAI diff --git a/lean/OAI/Algebra/FormalGroup/Honda/UniversalTransport.lean b/lean/OAI/Algebra/FormalGroup/Honda/UniversalTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..4165b9922c20e16f56323576794d8e6bf6b18708 --- /dev/null +++ b/lean/OAI/Algebra/FormalGroup/Honda/UniversalTransport.lean @@ -0,0 +1,116 @@ +import OAI.Algebra.FormalGroup.Honda.Classification + +namespace OAI + +universe uK + +noncomputable section + +namespace HeightThree.UniversalTransport +open MvPowerSeries HeightThree.HondaTarget HeightThree.CoordinateTransport +open HeightThree.ArtinianUniversality HeightThree.NilpotentTower +variable {K R S : Type*} [CommRing K] [CommRing R] [CommRing S] + +lemma transport_symm (c : Coordinate R) (F : FormalGroup R) : + c.symm.transport (c.transport F)=F := by + exact Coordinate.transport_ofIso (CoordinateIso.symm (c.iso F)) + +lemma symm_transport (c : Coordinate R) (F : FormalGroup R) : + c.transport (c.symm.transport F)=F := by + exact transport_symm c.symm F + +lemma coordinate_map_map (c : Coordinate R) (π : R →+* S) (ρ : S →+* K) : + (c.map π).map ρ=c.map (ρ.comp π) := by + apply Coordinate.map_eq_of_series_eq + exact HeightThree.CoordinateTransport.unimap_comp π ρ c.series + +lemma coordinate_map_id (c : Coordinate R) : c.map (RingHom.id R)=c := by + apply Coordinate.map_eq_of_series_eq + exact congrFun PowerSeries.map_id c.series + +lemma coordinate_map_symm (c : Coordinate R) (π : R →+* S) : + c.symm.map π=(c.map π).symm := rfl + +lemma unimap_subst (π : R →+* S) (f g : PowerSeries R) (hg : g.constantCoeff=0) : + PowerSeries.map π (f.subst g)=(PowerSeries.map π f).subst (PowerSeries.map π g) := + PowerSeries.map_subst (.of_constantCoeff_zero hg) f + +lemma iso_trans_series {F G H : FormalGroup R} (e : CoordinateIso F G) (d : CoordinateIso G H) : + (CoordinateIso.trans e d).series=d.series.subst e.series := rfl +lemma iso_symm_series {F G : FormalGroup R} (e : CoordinateIso F G) : + (CoordinateIso.symm e).series=e.inverse := rfl +lemma iso_series (c : Coordinate R) (F : FormalGroup R) : (c.iso F).series=c.series := rfl +lemma iso_inverse (c : Coordinate R) (F : FormalGroup R) : (c.iso F).inverse=c.inverse := rfl + +lemma framed_transport (ρ : R →+* K) (c : Coordinate R) {F G : FormalGroup R} + (he : FramedEquivalent ρ F G) : + FramedEquivalent ρ (c.transport F) (c.transport G) := by + obtain ⟨e,he⟩ := he + refine ⟨CoordinateIso.trans (CoordinateIso.symm (c.iso F)) + (CoordinateIso.trans e (c.iso G)),?_⟩ + rw [iso_trans_series,iso_trans_series,iso_symm_series,iso_series,iso_inverse] + rw [unimap_subst ρ _ c.inverse c.zero_inverse, + unimap_subst ρ c.series e.series e.zero_series,he,PowerSeries.X_subst] + exact (c.map ρ).left_inv + +lemma framed_transport_iff (ρ : R →+* K) (c : Coordinate R) (F G : FormalGroup R) : + FramedEquivalent ρ (c.transport F) (c.transport G) ↔ FramedEquivalent ρ F G := by + constructor + · intro h + have hh := framed_transport ρ c.symm h + rwa [transport_symm,transport_symm] at hh + · exact framed_transport ρ c + +lemma scalar_coordinate_map [Algebra K R] [Algebra K S] (c : Coordinate K) (f : R →ₐ[K] S) : + (c.map (algebraMap K R)).map f.toRingHom=c.map (algebraMap K S) := by + rw [coordinate_map_map] + congr 1 + ext z + exact f.commutes z + +lemma scalar_coordinate_reduce [Algebra K R] (c : Coordinate K) (ρ : R →ₐ[K] K) : + (c.map (algebraMap K R)).map ρ.toRingHom=c := by + rw [scalar_coordinate_map] + exact coordinate_map_id c + +end HeightThree.UniversalTransport + +namespace HeightThree.UniversalTransport +open MvPowerSeries HeightThree.HondaTarget HeightThree.CoordinateTransport +open HeightThree.ArtinianUniversality HeightThree.NilpotentTower +variable {K : Type uK} [Field K] + +theorem isUniversal_transport (Γ : FormalGroup K) (G : FormalGroup (Base K)) + (hG : IsUniversal Γ G) (c : Coordinate K) : + IsUniversal (c.transport Γ) ((c.map (algebraMap K (Base K))).transport G) := by + intro R _ _ _ _ ρ F hF hred + let cR := c.map (algebraMap K R) + let F' := cR.symm.transport F + have hcR : cR.map ρ.toRingHom=c := scalar_coordinate_reduce c ρ + have hF' : F'.IsComm := by + have := hF + exact inferInstance + have hr : F'.map ρ.toRingHom=Γ := by + rw [show F'=cR.symm.transport F from rfl,Coordinate.transport_map, + coordinate_map_symm,hcR,hred,transport_symm] + obtain ⟨f,hf,huniq⟩ := hG R ρ F' hF' hr + refine ⟨f,⟨hf.1,?_⟩,?_⟩ + · have he := framed_transport ρ.toRingHom cR hf.2 + change FramedEquivalent _ _ (cR.transport (cR.symm.transport F)) at he + rw [symm_transport] at he + rw [Coordinate.transport_map,scalar_coordinate_map] + exact he + · intro g hg + apply huniq g + refine ⟨hg.1,?_⟩ + have he := hg.2 + rw [Coordinate.transport_map,scalar_coordinate_map] at he + have he' := framed_transport ρ.toRingHom cR.symm he + rw [transport_symm] at he' + exact he' + +end HeightThree.UniversalTransport + +end + +end OAI diff --git a/lean/OAI/Algebra/FormalGroup/Honda/Universality.lean b/lean/OAI/Algebra/FormalGroup/Honda/Universality.lean new file mode 100644 index 0000000000000000000000000000000000000000..423f67c43ffa87df833b30e4ef3d22e8d79edb78 --- /dev/null +++ b/lean/OAI/Algebra/FormalGroup/Honda/Universality.lean @@ -0,0 +1,335 @@ +import OAI.Algebra.FormalGroup.Honda.Evaluation + +namespace OAI + +universe uK uR + +noncomputable section + +namespace HeightThree.ArtinianUniversality +open MvPowerSeries HondaTarget DeformationRigidity CoordinateTransport NilpotentTower NilpotentEvaluation +variable {K R S : Type*} [Field K] [CommRing R] [CommRing S] + +instance mapFormalGroup_isComm (F : FormalGroup R) [F.IsComm] (f : R →+* S) : + (F.map f).IsComm where + comm := by + change F.toPowerSeries.map f = (F.toPowerSeries.map f).subst ![X 1, X 0] + have hc := congrArg (MvPowerSeries.map f) (FormalGroup.IsComm.comm (F := F)) + rw [map_subst HasSubst.X_X] at hc + rw [hc] + congr 1 + funext i + fin_cases i <;> simp + +lemma framed_refl (ρ : R →+* K) (F : FormalGroup R) : FramedEquivalent ρ F F := by + refine ⟨{ + series := PowerSeries.X + inverse := PowerSeries.X + zero_series := by simp + zero_inverse := by simp + left_inv := PowerSeries.X_subst _ + right_inv := PowerSeries.X_subst _ + preserves_addition := ?_ },PowerSeries.map_X ρ⟩ + rw [PowerSeries.subst_X (.of_constantCoeff_zero F.zero_constantCoeff), + PowerSeries.subst_X (PowerSeries.HasSubst.X _),PowerSeries.subst_X (PowerSeries.HasSubst.X _)] + have hX : ![X 0,X 1]=(X : Fin 2 → MvPowerSeries (Fin 2) R) := by funext i; fin_cases i <;> rfl + rw [hX,MvPowerSeries.subst_self]; rfl + +lemma framed_symm (ρ : R →+* K) {F G : FormalGroup R} (h : FramedEquivalent ρ F G) : + FramedEquivalent ρ G F := by + obtain ⟨e,he⟩ := h + refine ⟨CoordinateTransport.CoordinateIso.symm e,?_⟩ + have hh := (Coordinate.ofIso e).map_eq_of_series_eq ρ Coordinate.ident he + exact congrArg Coordinate.inverse hh + +lemma framed_trans (ρ : R →+* K) {F G H : FormalGroup R} + (he : FramedEquivalent ρ F G) (hd : FramedEquivalent ρ G H) : FramedEquivalent ρ F H := by + obtain ⟨e,he⟩ := he + obtain ⟨d,hd⟩ := hd + refine ⟨CoordinateTransport.CoordinateIso.trans e d,?_⟩ + change (d.series.subst e.series).map ρ=PowerSeries.X + have hh : (d.series.subst e.series).map ρ = (d.series.map ρ).subst (e.series.map ρ) := + PowerSeries.map_subst (PowerSeries.HasSubst.of_constantCoeff_zero e.zero_series) d.series + rw [hh,hd,he,PowerSeries.X_subst] + +lemma framed_map (π : R →+* S) (ρ : R →+* K) (σ : S →+* K) (fac : σ.comp π=ρ) + {F G : FormalGroup R} (he : FramedEquivalent ρ F G) : + FramedEquivalent σ (F.map π) (G.map π) := by + obtain ⟨e,he⟩ := he + refine ⟨CoordinateTransport.CoordinateIso.map e π,?_⟩ + change (e.series.map π).map σ=PowerSeries.X + rw [unimap_comp,fac,he] + +lemma augmentation_of_base_map [Algebra K R] (G : FormalGroup (Base K)) (Γ : FormalGroup K) + (hG : G.map constantCoeff=Γ) (ρ : R →ₐ[K] K) (f : Base K →ₐ[K] R) + (hf : ∀ z, ρ (f z)=constantCoeff z) : (G.map f.toRingHom).map ρ.toRingHom=Γ := by + rw [formal_map_comp,show ρ.toRingHom.comp f.toRingHom=constantCoeff by ext z; exact hf z,hG] + +lemma lift_base_map [Algebra K R] [Algebra K S] + (π : R →ₐ[K] S) (surj : Function.Surjective π) (ρ : R →ₐ[K] K) (σ : S →ₐ[K] K) + (fac : σ.comp π=ρ) (hnil : ∀ a, ρ a=0 → IsNilpotent a) + (f : Base K →ₐ[K] S) (hf : ∀ z, σ (f z)=constantCoeff z) : + ∃ g : Base K →ₐ[K] R, π.comp g=f ∧ (∀ z, ρ (g z)=constantCoeff z) := by + classical + let a : Fin 2 → R := fun i => (surj (f (X i))).choose + have ha (i : Fin 2) : π (a i)=f (X i) := (surj _).choose_spec + have hρa (i : Fin 2) : ρ (a i)=0 := by + rw [←fac]; change σ (π (a i))=0 + rw [ha,hf,constantCoeff_X] + let g : Base K →ₐ[K] R := eval a (fun i => hnil _ (hρa i)) + refine ⟨g,?_,eval_augmentation ρ a _ hρa⟩ + apply hom_ext_nilpotent + · intro i; simpa [g] using (hnil _ (hρa i)).map π.toRingHom + · intro i; simp [g,ha] + +end HeightThree.ArtinianUniversality + +namespace HeightThree.ArtinianUniversality +open MvPowerSeries HondaTarget DeformationRigidity CoordinateTransport NilpotentTower NilpotentEvaluation +variable {K R S : Type*} [Field K] [CommRing R] [CommRing S] + +structure Data (p : ℕ) [hp : Fact p.Prime] (K : Type*) [Field K] where + gamma : FormalGroup K + family : FormalGroup (Base K) + family_comm : family.IsComm + special : family.map constantCoeff=gamma + honda : multiplicationSeries gamma p=PowerSeries.X^(p^3) + nonlinear : MvPowerSeries (Fin 2) K + nonlinear_eq : gamma.toPowerSeries=X 0+X 1+expand (p^2) (pow_ne_zero _ hp.out.ne_zero) nonlinear + frobenius : gamma.toPowerSeries^p=expand p hp.out.ne_zero gamma.toPowerSeries + first : (multiplicationSeries family p).coeff p=X 0 + remainder : Base K + second : (multiplicationSeries family p).coeff (p^2)=X 1+X 0*remainder + +namespace Data +variable (p : ℕ) [hp : Fact p.Prime] (D : Data p K) +instance family_isComm : D.family.IsComm := D.family_comm + +lemma multiply_coeff_map (F : FormalGroup R) (π : R →+* S) (n j : ℕ) : + (multiplicationSeries (F.map π) n).coeff j=π ((multiplicationSeries F n).coeff j) := by + rw [multiplication_map,PowerSeries.coeff_map] + +lemma base_gamma [Algebra K R] (ρ : R →ₐ[K] K) : + (D.gamma.map (algebraMap K R)).map ρ.toRingHom=D.gamma := by + rw [formal_map_comp] + apply FormalGroup.ext + ext d + change ρ (algebraMap K R (coeff d D.gamma.toPowerSeries))=coeff d D.gamma.toPowerSeries + simp + +lemma gamma_honda [Algebra K R] : + multiplicationSeries (D.gamma.map (algebraMap K R)) p=PowerSeries.X^(p^3) := by + rw [multiplication_map,D.honda,map_pow,PowerSeries.map_X] + +lemma gamma_nonlinear [Algebra K R] : + (D.gamma.map (algebraMap K R)).toPowerSeries=X 0+X 1+ + expand (p^2) (pow_ne_zero _ hp.out.ne_zero) (D.nonlinear.map (algebraMap K R)) := by + change D.gamma.toPowerSeries.map _=_ + rw [D.nonlinear_eq,map_add,map_add,map_X,map_X,map_expand] + +lemma gamma_frobenius [Algebra K R] : + (D.gamma.map (algebraMap K R)).toPowerSeries^p= + expand p hp.out.ne_zero (D.gamma.map (algebraMap K R)).toPowerSeries := by + change (D.gamma.toPowerSeries.map _)^p=_ + rw [←map_pow,D.frobenius,map_expand] + rfl + +variable [CharP K p] + +lemma lift_step [Algebra K R] [Algebra K S] + (π : R →ₐ[K] S) (surj : Function.Surjective π) (ρ : R →ₐ[K] K) (σ : S →ₐ[K] K) + (fac : σ.comp π=ρ) (hsmall : SmallExtension.IsSmall π.toRingHom ρ.toRingHom) + (hnil : ∀ a, ρ a=0 → IsNilpotent a) + (F : FormalGroup R) [F.IsComm] (hF : F.map ρ.toRingHom=D.gamma) + (f : Base K →ₐ[K] S) (hf : ∀ z, σ (f z)=constantCoeff z) + (he : FramedEquivalent σ.toRingHom (D.family.map f.toRingHom) (F.map π.toRingHom)) : + ∃ g : Base K →ₐ[K] R, π.comp g=f ∧ (∀ z, ρ (g z)=constantCoeff z) ∧ + FramedEquivalent ρ.toRingHom (D.family.map g.toRingHom) F := by + have fac' : σ.toRingHom.comp π.toRingHom=ρ.toRingHom := congrArg AlgHom.toRingHom fac + have : Nontrivial R := ρ.toRingHom.domain_nontrivial + have : CharP R p := (Algebra.charP_iff K R p).mp inferInstance + obtain ⟨e,heσ⟩ := framed_symm σ.toRingHom he + obtain ⟨c,hcπ,hcρ⟩ := Coordinate.lift π.toRingHom surj ρ.toRingHom σ.toRingHom fac' hnil + (Coordinate.ofIso e) heσ + let H := c.transport F + have hHπ : H.map π.toRingHom=D.family.map f.toRingHom := by + rw [show H=c.transport F from rfl,c.transport_map,hcπ,Coordinate.transport_ofIso] + have hHρ : H.map ρ.toRingHom=D.gamma := by + rw [show H=c.transport F from rfl,c.transport_map_eq_self F ρ.toRingHom hcρ,hF] + obtain ⟨f₀,hf₀π,hf₀ρ⟩ := lift_base_map π surj ρ σ fac hnil f hf + have hH₀ : H.map π.toRingHom=(D.family.map f₀.toRingHom).map π.toRingHom := by + rw [formal_map_comp] + change H.map π.toRingHom=D.family.map (π.comp f₀).toRingHom + rw [hf₀π,hHπ] + have hcoeff (j : ℕ) : π ((multiplicationSeries H p).coeff j)=π (f₀ ((multiplicationSeries D.family p).coeff j)) := by + have hh := congrArg (fun J : FormalGroup S => (multiplicationSeries J p).coeff j) hH₀ + simp only [multiply_coeff_map] at hh + exact hh + obtain ⟨g,hgπ,hgρ,hgp,hgpp⟩ := correct_parameters π ρ hsmall.ker_le hsmall.annihilate f₀ hf₀ρ + (fun i => hnil _ (by rw [hf₀ρ,constantCoeff_X])) + ((multiplicationSeries D.family p).coeff (p^2)) D.remainder D.second + ((multiplicationSeries H p).coeff p) ((multiplicationSeries H p).coeff (p^2)) + (by simpa only [D.first] using hcoeff p) (hcoeff (p^2)) + have hgπf : π.comp g=f := hgπ.trans hf₀π + have hGπ : (D.family.map g.toRingHom).map π.toRingHom=H.map π.toRingHom := by + rw [formal_map_comp] + change D.family.map (π.comp g).toRingHom=H.map π.toRingHom + rw [hgπf,hHπ] + have hGρ := augmentation_of_base_map D.family D.gamma D.special ρ g hgρ + obtain ⟨a,haπ⟩ := SmallExtension.small_equivalence_of_matching_parameters p π.toRingHom ρ.toRingHom + hsmall (D.family.map g.toRingHom) H (D.gamma.map (algebraMap K R)) hGπ + (hGρ.trans (D.base_gamma p ρ).symm) (hHρ.trans (D.base_gamma p ρ).symm) + (D.nonlinear.map (algebraMap K R)) (D.gamma_nonlinear p) (D.gamma_honda p) (D.gamma_frobenius p) + (by rw [multiply_coeff_map,D.first]; exact hgp) + (by rw [multiply_coeff_map]; exact hgpp) + have haρ : a.series.map ρ.toRingHom=PowerSeries.X := by + rw [←fac',←unimap_comp,haπ,PowerSeries.map_X] + refine ⟨g,hgπf,hgρ,?_⟩ + exact framed_trans ρ.toRingHom ⟨a,haρ⟩ (framed_symm ρ.toRingHom ⟨c.iso F,hcρ⟩) + +end Data +end HeightThree.ArtinianUniversality + +namespace HeightThree.ArtinianUniversality.Data +open MvPowerSeries HondaTarget DeformationRigidity CoordinateTransport NilpotentTower NilpotentEvaluation +variable {K : Type uK} [Field K] (p : ℕ) [hp : Fact p.Prime] [CharP K p] (D : Data p K) + +lemma existence (n : ℕ) (R : Type uR) [CommRing R] [Algebra K R] (ρ : R →ₐ[K] K) + (hn : (RingHom.ker ρ)^(n+1)=⊥) (F : FormalGroup R) [F.IsComm] + (hF : F.map ρ.toRingHom=D.gamma) : + ∃ g : Base K →ₐ[K] R, (∀ z, ρ (g z)=constantCoeff z) ∧ + FramedEquivalent ρ.toRingHom (D.family.map g.toRingHom) F := by + induction n generalizing R with + | zero => + let g : Base K →ₐ[K] R := eval (fun _ => 0) (fun _ => IsNilpotent.zero) + have hg (z : Base K) : ρ (g z)=constantCoeff z := by simp [g,eval_zero] + have hi : Function.Injective ρ.toRingHom := (RingHom.injective_iff_ker_eq_bot ρ).mpr (by simpa using hn) + have he : D.family.map g.toRingHom=F := formal_map_injective ρ.toRingHom hi + ((augmentation_of_base_map D.family D.gamma D.special ρ g hg).trans hF.symm) + refine ⟨g,hg,?_⟩ + rw [he] + exact framed_refl ρ.toRingHom F + | succ n ih => + let S := quotient ρ n + let π : R →ₐ[K] S := projection ρ n + let σ : S →ₐ[K] K := augmentation ρ n + have fac : σ.comp π=ρ := rfl + have hFS : (F.map π.toRingHom).map σ.toRingHom=D.gamma := by + rw [formal_map_comp] + exact hF + obtain ⟨f,hf,he⟩ := ih S σ (augmentation_nilpotent ρ n) (F.map π.toRingHom) hFS + obtain ⟨g,_,hg,hge⟩ := D.lift_step p π (projection_surjective ρ n) ρ σ fac + ⟨projection_ker_le ρ n,projection_annihilate ρ n hn⟩ + (fun a ha => nilpotent_of_mem_ker ρ hn ha) F hF f hf he + exact ⟨g,hg,hge⟩ + +omit [CharP K p] in +lemma family_honda {R : Type*} [CommRing R] [Algebra K R] (ρ : R →ₐ[K] K) + (f : Base K →ₐ[K] R) (hf : ∀ z, ρ (f z)=constantCoeff z) : + (multiplicationSeries (D.family.map f.toRingHom) p).map ρ.toRingHom=PowerSeries.X^(p^3) := by + rw [←multiplication_map,augmentation_of_base_map D.family D.gamma D.special ρ f hf,D.honda] + +end HeightThree.ArtinianUniversality.Data + +namespace HeightThree.ArtinianRigidity +open HondaTarget DeformationRigidity CoordinateTransport NilpotentTower + +lemma equivalence_rigid {K : Type uK} [Field K] (p : ℕ) [Fact p.Prime] [CharP K p] + (n : ℕ) (R : Type uR) [CommRing R] [Algebra K R] (ρ : R →ₐ[K] K) + (hn : (RingHom.ker ρ)^(n+1)=⊥) (F G : FormalGroup R) (e : CoordinateIso F G) (hFG : F=G) + (he : e.series.map ρ.toRingHom=PowerSeries.X) + (hF : (multiplicationSeries F p).map ρ.toRingHom=PowerSeries.X^(p^3)) : + e.series=PowerSeries.X := by + subst G + exact automorphism_rigid p n R ρ hn F e he hF + +end HeightThree.ArtinianRigidity + +namespace HeightThree.ArtinianUniversality.Data +open MvPowerSeries HondaTarget DeformationRigidity CoordinateTransport NilpotentTower NilpotentEvaluation +variable {K : Type uK} [Field K] (p : ℕ) [hp : Fact p.Prime] [CharP K p] (D : Data p K) + +lemma base_map_unique (n : ℕ) (R : Type uR) [CommRing R] [Algebra K R] (ρ : R →ₐ[K] K) + (hn : (RingHom.ker ρ)^(n+1)=⊥) (f g : Base K →ₐ[K] R) + (hf : ∀ z, ρ (f z)=constantCoeff z) (hg : ∀ z, ρ (g z)=constantCoeff z) + (he : FramedEquivalent ρ.toRingHom (D.family.map f.toRingHom) (D.family.map g.toRingHom)) : f=g := by + induction n generalizing R with + | zero => + have hi : Function.Injective ρ := (RingHom.injective_iff_ker_eq_bot ρ).mpr (by simpa using hn) + ext z + apply hi + rw [hf,hg] + | succ n ih => + let S := quotient ρ n + let π : R →ₐ[K] S := projection ρ n + let σ : S →ₐ[K] K := augmentation ρ n + have fac : σ.toRingHom.comp π.toRingHom=ρ.toRingHom := rfl + have hfS (z : Base K) : σ ((π.comp f) z)=constantCoeff z := hf z + have hgS (z : Base K) : σ ((π.comp g) z)=constantCoeff z := hg z + have heS : FramedEquivalent σ.toRingHom (D.family.map (π.comp f).toRingHom) + (D.family.map (π.comp g).toRingHom) := by + have hh := framed_map π.toRingHom ρ.toRingHom σ.toRingHom fac he + rw [formal_map_comp,formal_map_comp] at hh + exact hh + have hfg : π.comp f=π.comp g := ih S σ (augmentation_nilpotent ρ n) (π.comp f) (π.comp g) hfS hgS heS + obtain ⟨e,heρ⟩ := he + have hFG : (D.family.map f.toRingHom).map π.toRingHom=(D.family.map g.toRingHom).map π.toRingHom := by + rw [formal_map_comp,formal_map_comp] + change D.family.map (π.comp f).toRingHom=D.family.map (π.comp g).toRingHom + rw [hfg] + let d := CoordinateTransport.CoordinateIso.map e π.toRingHom + have hd : d.series.map σ.toRingHom=PowerSeries.X := by + change (e.series.map π.toRingHom).map σ.toRingHom=PowerSeries.X + rw [unimap_comp,fac,heρ] + have hF' : (multiplicationSeries ((D.family.map f.toRingHom).map π.toRingHom) p).map σ.toRingHom=PowerSeries.X^(p^3) := by + rw [formal_map_comp] + exact D.family_honda p σ (π.comp f) hfS + have heπ : e.series.map π.toRingHom=PowerSeries.X := + ArtinianRigidity.equivalence_rigid p n S σ (augmentation_nilpotent ρ n) _ _ d hFG hd hF' + have : Nontrivial R := ρ.toRingHom.domain_nontrivial + have : CharP R p := (Algebra.charP_iff K R p).mp inferInstance + have hsmall : SmallExtension.IsSmall π.toRingHom ρ.toRingHom := + ⟨projection_ker_le ρ n,projection_annihilate ρ n hn⟩ + have hlo (j : ℕ) (hj : 0 φ D.remainder) hfg + have hr : ρ (g (X 0))=0 := by rw [hg,constantCoeff_X] + have hz := hsmall.annihilate (f D.remainder-g D.remainder) (g (X 0)) hk hr + linear_combination hh-hz + apply hom_ext_nilpotent + · intro i; exact nilpotent_of_mem_ker ρ hn (by rw [hf,constantCoeff_X]) + · intro i; fin_cases i + · exact hx + · exact hy + +theorem isUniversal : IsUniversal D.gamma D.family := by + intro R _ _ _ _ ρ F hFcomm hF + have := hFcomm + obtain ⟨n,hn⟩ := finite_local_nilpotent ρ + obtain ⟨f,hf,he⟩ := D.existence p n R ρ hn F hF + refine ⟨f,⟨?_,he⟩,?_⟩ + · ext z; exact hf z + · intro g hg + apply D.base_map_unique p n R ρ hn g f + · intro z; exact congrArg (fun φ : Base K →+* K => φ z) hg.1 + · exact hf + · exact framed_trans ρ.toRingHom hg.2 (framed_symm ρ.toRingHom he) + +end HeightThree.ArtinianUniversality.Data + +end + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/BitArithmetic.lean b/lean/OAI/Algebra/FormulaHitting/BitArithmetic.lean new file mode 100644 index 0000000000000000000000000000000000000000..0d48676de71b9d4c7d279f9a584c296597f7e15d --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/BitArithmetic.lean @@ -0,0 +1,530 @@ +import OAI.Algebra.FormulaHitting.BitModel +import Mathlib.Data.Nat.Size +import Lean.Elab.Tactic.Omega +import Mathlib.Tactic.Ring +import Mathlib.Tactic.NormNum +import Mathlib.Tactic.Linarith + +namespace OAI + +namespace NCHitting.BitArithmetic + +def value : List Bool → ℕ + | [] => 0 + | b :: bs => b.toNat + 2 * value bs + +def parity (a b c : Bool) : Bool := xor (xor a b) c +def carry (a b c : Bool) : Bool := (a && b) || (a && c) || (b && c) +def borrow (a b c : Bool) : Bool := ((!a) && b) || ((!a) && c) || (b && c) +def equalStep (a b c : Bool) : Bool := (a == b) && c + +theorem fullAdder_identity (a b c : Bool) : + (parity a b c).toNat + 2 * (carry a b c).toNat = a.toNat + b.toNat + c.toNat := by + cases a <;> cases b <;> cases c <;> decide + +theorem fullSubtractor_identity (a b c : Bool) : + (parity a b c).toNat + b.toNat + c.toNat = a.toNat + 2 * (borrow a b c).toNat := by + cases a <;> cases b <;> cases c <;> decide + +structure WordRun where + bits : List Bool + steps : ℕ + +def trim : List Bool → List Bool + | [] => [] + | b :: bs => + let t := trim bs + if t = [] ∧ b = false then [] else b :: t + +def trimSteps : List Bool → ℕ + | [] => 1 + | _ :: bs => trimSteps bs + 3 + +theorem trimSteps_eq (bs : List Bool) : trimSteps bs = 3 * bs.length + 1 := by + induction bs with + | nil => rfl + | cons b bs ih => simp only [trimSteps, List.length_cons, ih]; omega + +@[simp] theorem value_trim (bs : List Bool) : value (trim bs) = value bs := by + induction bs with + | nil => rfl + | cons b bs ih => + simp only [trim] + split_ifs with h + · rcases h with ⟨ht, rfl⟩ + simp only [ht, value] at ih + simp [value, ← ih] + · simp only [value, ih] + +theorem bits_value (bs : List Bool) : (value bs).bits = trim bs := by + induction bs with + | nil => rfl + | cons b bs ih => + by_cases hzero : value bs = 0 + · have ht : trim bs = [] := by rw [← ih, hzero]; rfl + cases b <;> simp [value, hzero, trim, ht] + · have ht : trim bs ≠ [] := by + intro h + have := value_trim bs + rw [h] at this + exact hzero this.symm + have hbit : b.toNat + 2 * value bs = Nat.bit b (value bs) := by + rw [Nat.bit_val] + omega + rw [value, hbit, Nat.bits_append_bit _ _ (fun h => (hzero h).elim), ih] + simp [trim, ht] + +theorem value_bits (n : ℕ) : value n.bits = n := by + induction n using Nat.binaryRec' with + | zero => rfl + | bit b n hn ih => + rw [Nat.bits_append_bit n b hn, value, ih, Nat.bit_val] + omega + +theorem trim_length (bs : List Bool) : (trim bs).length = (value bs).size := by + rw [← bits_value, Nat.size_eq_bits_len] + +def addRaw : List Bool → List Bool → Bool → WordRun + | [], [], c => ⟨if c then [true] else [], 3⟩ + | a :: xs, [], c => + let r := addRaw xs [] (carry a false c) + ⟨parity a false c :: r.bits, r.steps + 5⟩ + | [], b :: ys, c => + let r := addRaw [] ys (carry false b c) + ⟨parity false b c :: r.bits, r.steps + 5⟩ + | a :: xs, b :: ys, c => + let r := addRaw xs ys (carry a b c) + ⟨parity a b c :: r.bits, r.steps + 5⟩ + +theorem addRaw_value (xs ys : List Bool) (c : Bool) : + value (addRaw xs ys c).bits = value xs + value ys + c.toNat := by + induction xs generalizing ys c with + | nil => + induction ys generalizing c with + | nil => cases c <;> simp [addRaw, value] + | cons b ys ih => + have h := fullAdder_identity false b c + simp only [addRaw, value, ih] + simp only [Bool.toNat_false] at h + omega + | cons a xs ih => + cases ys with + | nil => + have h := fullAdder_identity a false c + simp only [addRaw, value, ih] + simp only [Bool.toNat_false] at h + omega + | cons b ys => + have h := fullAdder_identity a b c + simp only [addRaw, value, ih] + omega + +theorem addRaw_length (xs ys : List Bool) (c : Bool) : + (addRaw xs ys c).bits.length ≤ max xs.length ys.length + 1 := by + induction xs generalizing ys c with + | nil => + induction ys generalizing c with + | nil => cases c <;> simp [addRaw] + | cons b ys ih => + have h := ih (carry false b c) + simp only [addRaw, List.length_cons, List.length_nil, Nat.zero_max] at h ⊢ + omega + | cons a xs ih => + cases ys with + | nil => + have h := ih [] (carry a false c) + simp only [addRaw, List.length_cons, List.length_nil, Nat.max_zero] at h ⊢ + omega + | cons b ys => + have h := ih ys (carry a b c) + simp only [addRaw, List.length_cons] at h ⊢ + omega + +theorem addRaw_steps (xs ys : List Bool) (c : Bool) : + (addRaw xs ys c).steps ≤ 5 * (xs.length + ys.length) + 3 := by + induction xs generalizing ys c with + | nil => + induction ys generalizing c with + | nil => simp [addRaw] + | cons b ys ih => + have h := ih (carry false b c) + simp only [addRaw, List.length_cons, List.length_nil] at h ⊢ + omega + | cons a xs ih => + cases ys with + | nil => + have h := ih [] (carry a false c) + simp only [addRaw, List.length_cons, List.length_nil] at h ⊢ + omega + | cons b ys => + have h := ih ys (carry a b c) + simp only [addRaw, List.length_cons] at h ⊢ + omega + +def add (xs ys : List Bool) : WordRun := + let raw := addRaw xs ys false + ⟨trim raw.bits, raw.steps + trimSteps raw.bits⟩ + +theorem add_value (xs ys : List Bool) : value (add xs ys).bits = value xs + value ys := by + simp [add, addRaw_value] + +theorem add_steps (xs ys : List Bool) : + (add xs ys).steps ≤ 8 * (xs.length + ys.length) + 7 := by + have hs := addRaw_steps xs ys false + have hl := addRaw_length xs ys false + simp only [add, trimSteps_eq] + omega + +structure BoolRun where + bit : Bool + steps : ℕ + +def lessRaw : List Bool → List Bool → Bool → BoolRun + | [], [], c => ⟨c, 2⟩ + | a :: xs, [], c => + let r := lessRaw xs [] (borrow a false c) + ⟨r.bit, r.steps + 3⟩ + | [], b :: ys, c => + let r := lessRaw [] ys (borrow false b c) + ⟨r.bit, r.steps + 3⟩ + | a :: xs, b :: ys, c => + let r := lessRaw xs ys (borrow a b c) + ⟨r.bit, r.steps + 3⟩ + +theorem lessRaw_value (xs ys : List Bool) (c : Bool) : + (lessRaw xs ys c).bit = true ↔ value xs < value ys + c.toNat := by + induction xs generalizing ys c with + | nil => + induction ys generalizing c with + | nil => cases c <;> simp [lessRaw, value] + | cons b ys ih => + simp only [lessRaw, ih, value] + cases b <;> cases c <;> simp [borrow] + | cons a xs ih => + cases ys with + | nil => + simp only [lessRaw, ih, value] + cases a <;> cases c <;> simp [borrow] + | cons b ys => + simp only [lessRaw, ih, value] + cases a <;> cases b <;> cases c <;> simp [borrow] <;> omega + +theorem lessRaw_steps (xs ys : List Bool) (c : Bool) : + (lessRaw xs ys c).steps ≤ 3 * (xs.length + ys.length) + 2 := by + induction xs generalizing ys c with + | nil => + induction ys generalizing c with + | nil => simp [lessRaw] + | cons b ys ih => + have h := ih (borrow false b c) + simp only [lessRaw, List.length_cons, List.length_nil] at h ⊢ + omega + | cons a xs ih => + cases ys with + | nil => + have h := ih [] (borrow a false c) + simp only [lessRaw, List.length_cons, List.length_nil] at h ⊢ + omega + | cons b ys => + have h := ih ys (borrow a b c) + simp only [lessRaw, List.length_cons] at h ⊢ + omega + +def equalRaw : List Bool → List Bool → Bool → BoolRun + | [], [], c => ⟨c, 2⟩ + | a :: xs, [], c => + let r := equalRaw xs [] (equalStep a false c) + ⟨r.bit, r.steps + 3⟩ + | [], b :: ys, c => + let r := equalRaw [] ys (equalStep false b c) + ⟨r.bit, r.steps + 3⟩ + | a :: xs, b :: ys, c => + let r := equalRaw xs ys (equalStep a b c) + ⟨r.bit, r.steps + 3⟩ + +theorem equalRaw_value (xs ys : List Bool) (c : Bool) : + (equalRaw xs ys c).bit = true ↔ value xs = value ys ∧ c = true := by + induction xs generalizing ys c with + | nil => + induction ys generalizing c with + | nil => cases c <;> simp [equalRaw, value] + | cons b ys ih => + simp only [equalRaw, ih, value] + cases b <;> cases c <;> simp [equalStep] <;> omega + | cons a xs ih => + cases ys with + | nil => + simp only [equalRaw, ih, value] + cases a <;> cases c <;> simp [equalStep] + | cons b ys => + simp only [equalRaw, ih, value] + cases a <;> cases b <;> cases c <;> simp [equalStep] <;> omega + +theorem equalRaw_steps (xs ys : List Bool) (c : Bool) : + (equalRaw xs ys c).steps ≤ 3 * (xs.length + ys.length) + 2 := by + induction xs generalizing ys c with + | nil => + induction ys generalizing c with + | nil => simp [equalRaw] + | cons b ys ih => + have h := ih (equalStep false b c) + simp only [equalRaw, List.length_cons, List.length_nil] at h ⊢ + omega + | cons a xs ih => + cases ys with + | nil => + have h := ih [] (equalStep a false c) + simp only [equalRaw, List.length_cons, List.length_nil] at h ⊢ + omega + | cons b ys => + have h := ih ys (equalStep a b c) + simp only [equalRaw, List.length_cons] at h ⊢ + omega + +structure SubRun extends WordRun where + finalBorrow : Bool + +def subRaw : List Bool → List Bool → Bool → SubRun + | [], [], c => ⟨⟨[], 2⟩, c⟩ + | a :: xs, [], c => + let r := subRaw xs [] (borrow a false c) + ⟨⟨parity a false c :: r.bits, r.steps + 5⟩, r.finalBorrow⟩ + | [], b :: ys, c => + let r := subRaw [] ys (borrow false b c) + ⟨⟨parity false b c :: r.bits, r.steps + 5⟩, r.finalBorrow⟩ + | a :: xs, b :: ys, c => + let r := subRaw xs ys (borrow a b c) + ⟨⟨parity a b c :: r.bits, r.steps + 5⟩, r.finalBorrow⟩ + +theorem subRaw_borrow (xs ys : List Bool) (c : Bool) : + (subRaw xs ys c).finalBorrow = (lessRaw xs ys c).bit := by + induction xs generalizing ys c with + | nil => + induction ys generalizing c with + | nil => simp [subRaw, lessRaw] + | cons b ys ih => simp only [subRaw, lessRaw, ih] + | cons a xs ih => + cases ys <;> simp only [subRaw, lessRaw, ih] + +theorem subRaw_value (xs ys : List Bool) (c : Bool) : + value (subRaw xs ys c).bits + value ys + c.toNat = + value xs + 2 ^ (max xs.length ys.length) * (subRaw xs ys c).finalBorrow.toNat := by + induction xs generalizing ys c with + | nil => + induction ys generalizing c with + | nil => simp [subRaw, value] + | cons b ys ih => + have h := ih (borrow false b c) + have hb := fullSubtractor_identity false b c + simp only [subRaw, value, List.length_nil, List.length_cons, Nat.zero_max, + pow_succ, Bool.toNat_false, Nat.zero_add, Nat.mul_assoc] at h hb ⊢ + nlinarith + | cons a xs ih => + cases ys with + | nil => + have h := ih [] (borrow a false c) + have hb := fullSubtractor_identity a false c + simp only [subRaw, value, List.length_nil, List.length_cons, Nat.max_zero, + pow_succ, Bool.toNat_false, Nat.add_zero, Nat.mul_assoc] at h hb ⊢ + nlinarith + | cons b ys => + have h := ih ys (borrow a b c) + have hb := fullSubtractor_identity a b c + have hm : max (xs.length + 1) (ys.length + 1) = max xs.length ys.length + 1 := by omega + simp only [subRaw, value, List.length_cons, hm, + pow_succ, Nat.mul_assoc] at h hb ⊢ + nlinarith + +theorem subRaw_length (xs ys : List Bool) (c : Bool) : + (subRaw xs ys c).bits.length = max xs.length ys.length := by + induction xs generalizing ys c with + | nil => + induction ys generalizing c with + | nil => simp [subRaw] + | cons b ys ih => simp [subRaw, ih] + | cons a xs ih => cases ys <;> simp [subRaw, ih, max_add_add_right] + +theorem subRaw_steps (xs ys : List Bool) (c : Bool) : + (subRaw xs ys c).steps ≤ 5 * (xs.length + ys.length) + 2 := by + induction xs generalizing ys c with + | nil => + induction ys generalizing c with + | nil => simp [subRaw] + | cons b ys ih => + have h := ih (borrow false b c) + simp only [subRaw, List.length_cons, List.length_nil] at h ⊢ + omega + | cons a xs ih => + cases ys with + | nil => + have h := ih [] (borrow a false c) + simp only [subRaw, List.length_cons, List.length_nil] at h ⊢ + omega + | cons b ys => + have h := ih ys (borrow a b c) + simp only [subRaw, List.length_cons] at h ⊢ + omega + +def sub (xs ys : List Bool) : WordRun := + let raw := subRaw xs ys false + if raw.finalBorrow then ⟨[], raw.steps + 1⟩ + else ⟨trim raw.bits, raw.steps + 1 + trimSteps raw.bits⟩ + +theorem sub_value (xs ys : List Bool) : value (sub xs ys).bits = value xs - value ys := by + have h := subRaw_value xs ys false + have hb := lessRaw_value xs ys false + rw [← subRaw_borrow] at hb + cases hcase : (subRaw xs ys false).finalBorrow with + | false => + simp [sub, hcase, value_trim] + simp [hcase] at h + omega + | true => + have hlt : value xs < value ys := by simpa [hcase] using hb.mp hcase + simp [sub, hcase, value, Nat.sub_eq_zero_of_le (Nat.le_of_lt hlt)] + +theorem sub_steps (xs ys : List Bool) : + (sub xs ys).steps ≤ 8 * (xs.length + ys.length) + 4 := by + have hs := subRaw_steps xs ys false + have hl := subRaw_length xs ys false + unfold sub + dsimp only + split <;> simp only [trimSteps_eq] <;> omega + +def mulRaw : List Bool → List Bool → WordRun + | [], _ => ⟨[], 1⟩ + | b :: xs, ys => + let r := mulRaw xs ys + if b then + let a := addRaw ys (false :: r.bits) false + ⟨a.bits, r.steps + a.steps + 3⟩ + else ⟨false :: r.bits, r.steps + 3⟩ + +theorem mulRaw_value (xs ys : List Bool) : + value (mulRaw xs ys).bits = value xs * value ys := by + induction xs with + | nil => simp [mulRaw, value] + | cons b xs ih => + cases b <;> simp [mulRaw, value, addRaw_value, ih] <;> ring + +theorem mulRaw_length (xs ys : List Bool) : + (mulRaw xs ys).bits.length ≤ 2 * xs.length + ys.length := by + induction xs with + | nil => simp [mulRaw] + | cons b xs ih => + have ha := addRaw_length ys (false :: (mulRaw xs ys).bits) false + cases b <;> simp only [mulRaw, Bool.false_eq_true, ite_false, ite_true, + List.length_cons] at * <;> omega + +theorem mulRaw_steps (xs ys : List Bool) : + (mulRaw xs ys).steps ≤ 10 * xs.length * (xs.length + ys.length + 2) + 1 := by + induction xs with + | nil => simp [mulRaw] + | cons b xs ih => + have ha := addRaw_steps ys (false :: (mulRaw xs ys).bits) false + have hl := mulRaw_length xs ys + cases b <;> simp only [mulRaw, Bool.false_eq_true, ite_false, ite_true, + List.length_cons] at * <;> nlinarith + +def mul (xs ys : List Bool) : WordRun := + let raw := mulRaw xs ys + ⟨trim raw.bits, raw.steps + trimSteps raw.bits⟩ + +theorem mul_value (xs ys : List Bool) : value (mul xs ys).bits = value xs * value ys := by + simp [mul, mulRaw_value] + +theorem mul_steps (xs ys : List Bool) : + (mul xs ys).steps ≤ 10 * xs.length * (xs.length + ys.length + 2) + + 6 * xs.length + 3 * ys.length + 2 := by + have hs := mulRaw_steps xs ys + have hl := mulRaw_length xs ys + simp only [mul, trimSteps_eq] + omega + +def addNat (a b : ℕ) : WordRun := add a.bits b.bits +def subNat (a b : ℕ) : WordRun := sub a.bits b.bits +def mulNat (a b : ℕ) : WordRun := mul a.bits b.bits +def lessNat (a b : ℕ) : BoolRun := lessRaw a.bits b.bits false +def equalNat (a b : ℕ) : BoolRun := equalRaw a.bits b.bits true +def oddNat (a : ℕ) : BoolRun := ⟨a.bits.headD false, 2⟩ + +theorem oddNat_value (a : ℕ) : (oddNat a).bit.toNat = a % 2 := by + have hhead : a.bits.headD false = a.bits.headI := by cases a.bits <;> rfl + change (a.bits.headD false).toNat = a % 2 + rw [hhead, ← Nat.bodd_eq_bits_head] + exact (Nat.mod_two_of_bodd a).symm + +theorem oddNat_eq (a : ℕ) : (oddNat a).bit = decide (a % 2 = 1) := by + have h := oddNat_value a + cases hb : (oddNat a).bit <;> simp [hb] at h ⊢ <;> omega + +theorem addNat_value (a b : ℕ) : (addNat a b).bits = (a + b).bits := by + simp only [addNat, add, ← bits_value, addRaw_value, value_bits, Bool.toNat_false, Nat.add_zero] + +theorem mulNat_value (a b : ℕ) : (mulNat a b).bits = (a * b).bits := by + simp only [mulNat, mul, ← bits_value, mulRaw_value, value_bits] + +theorem subNat_value (a b : ℕ) : (subNat a b).bits = (a - b).bits := by + have hv := sub_value a.bits b.bits + simp only [value_bits] at hv + unfold subNat sub + dsimp only + split + · have hzero : a - b = 0 := by simpa [sub, value, *] using hv.symm + simp [hzero] + · have hraw : value (subRaw a.bits b.bits false).bits = a - b := by + simpa [sub, *] using hv + change trim (subRaw a.bits b.bits false).bits = (a - b).bits + rw [← bits_value, hraw] + +theorem lessNat_value (a b : ℕ) : (lessNat a b).bit = decide (a < b) := by + apply Bool.eq_iff_iff.mpr + simp [lessNat, lessRaw_value, value_bits] + +theorem equalNat_value (a b : ℕ) : (equalNat a b).bit = decide (a = b) := by + apply Bool.eq_iff_iff.mpr + simp [equalNat, equalRaw_value, value_bits] + +theorem addNat_steps (a b : ℕ) : (addNat a b).steps ≤ (BitModel.addCost a b) ^ 2 := by + have h := add_steps a.bits b.bits + simp only [Nat.size_eq_bits_len] at h + unfold addNat BitModel.addCost BitModel.width + nlinarith [sq_nonneg (a.size + b.size : ℤ)] + +theorem subNat_steps (a b : ℕ) : (subNat a b).steps ≤ (BitModel.addCost a b) ^ 2 := by + have h := sub_steps a.bits b.bits + simp only [Nat.size_eq_bits_len] at h + unfold subNat BitModel.addCost BitModel.width + nlinarith [sq_nonneg (a.size + b.size : ℤ)] + +theorem lessNat_steps (a b : ℕ) : (lessNat a b).steps ≤ (BitModel.compareCost a b) ^ 2 := by + have h := lessRaw_steps a.bits b.bits false + simp only [Nat.size_eq_bits_len] at h + unfold lessNat BitModel.compareCost BitModel.width + nlinarith [sq_nonneg (a.size + b.size : ℤ)] + +theorem equalNat_steps (a b : ℕ) : (equalNat a b).steps ≤ (BitModel.compareCost a b) ^ 2 := by + have h := equalRaw_steps a.bits b.bits true + simp only [Nat.size_eq_bits_len] at h + unfold equalNat BitModel.compareCost BitModel.width + nlinarith [sq_nonneg (a.size + b.size : ℤ)] + +theorem mulNat_steps (a b : ℕ) : (mulNat a b).steps ≤ (BitModel.mulCost a b) ^ 2 := by + have h := mul_steps a.bits b.bits + simp only [Nat.size_eq_bits_len] at h + let W := (a.size + 1) * (b.size + 1) + have hW : 1 ≤ W := by + exact Nat.mul_le_mul (show 1 ≤ a.size + 1 by omega) (show 1 ≤ b.size + 1 by omega) + have ha : a.size ≤ W := by dsimp [W]; nlinarith + have hb : b.size ≤ W := by dsimp [W]; nlinarith + have hs : a.size + b.size + 2 ≤ 2 * W := by dsimp [W]; nlinarith + have hp : a.size * (a.size + b.size + 2) ≤ W * (2 * W) := + Nat.mul_le_mul ha hs + change (mul a.bits b.bits).steps ≤ (8 * (a.size + 1) * (b.size + 1)) ^ 2 + have he : 8 * (a.size + 1) * (b.size + 1) = 8 * W := by dsimp [W]; ring + rw [he] + nlinarith + +end NCHitting.BitArithmetic + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/BitBounds.lean b/lean/OAI/Algebra/FormulaHitting/BitBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..dc45b89ab5df542c500b3f6d35339c64f245e97f --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/BitBounds.lean @@ -0,0 +1,36 @@ +import OAI.Algebra.FormulaHitting.Generator +import Mathlib.Data.Nat.Log + +namespace OAI + +namespace NCHitting + +theorem size_eq_clog (a : ℕ) : a.size = Nat.clog 2 (a+1) := by + apply eq_of_forall_ge_iff + intro k + rw [Nat.size_le, Nat.clog_le_iff_le_pow (by decide)] + omega + +theorem entryBitBound_eq_clog (n d : ℕ) : + entryBitBound n d = 3 + Nat.clog 2 (d+1) + d * Nat.clog 2 (n+1) := by + simp only [entryBitBound, size_eq_clog] + +theorem entryBitBound_in_parameters {n s : ℕ} (hn : 0 < n) (hs : 0 < s) : + entryBitBound n (2*n*s^2) ≤ + 6 + 3 * Nat.clog 2 (n*s+1) + 2*n*s^2 * Nat.clog 2 (n+1) := by + have hnle : n ≤ n*s := Nat.le_mul_of_pos_right n hs + have hsle : s ≤ n*s := Nat.le_mul_of_pos_left s hn + have hnb := Nat.size_le_size hnle + have hsb := Nat.size_le_size hsle + have hpow := size_pow_le s 2 + have hmul₁ := size_mul_le 2 n + have hmul₂ := size_mul_le (2*n) (s^2) + have htwo : Nat.size 2 = 2 := by decide + rw [htwo] at hmul₁ + rw [← size_eq_clog, ← size_eq_clog] + unfold entryBitBound + omega + +end NCHitting + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/BitCost.lean b/lean/OAI/Algebra/FormulaHitting/BitCost.lean new file mode 100644 index 0000000000000000000000000000000000000000..95f089fc53a18f3ad0af677954ac975eb7267a50 --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/BitCost.lean @@ -0,0 +1,29 @@ +import OAI.Algebra.FormulaHitting.GeneratorCost +import OAI.Algebra.FormulaHitting.BitRefinement + +namespace OAI + +namespace NCHitting + +def primitiveBitBound (n s : ℕ) : ℕ := 1024 * generatorCostBound n s ^ 3 + +def generatorBitTrace (n s : ℕ) : BitRefinement.Trace := + BitRefinement.Step.input [n, s] :: BitRefinement.programTrace [n, s] generatorProgram + +theorem generatorBitTrace_executes (n s : ℕ) : + BitRefinement.Exec generatorProgram [n, s] (generate n s).output + (BitRefinement.Trace.steps (generatorBitTrace n s)) := + ⟨BitRefinement.programTrace [n, s] generatorProgram, + BitRefinement.programTrace_correct [n, s] generatorProgram, rfl⟩ + +theorem generate_primitive_bit_bound (n s : ℕ) : + BitRefinement.Exec generatorProgram [n, s] (generate n s).output + (BitRefinement.executionSteps generatorProgram [n, s]) ∧ + BitRefinement.executionSteps generatorProgram [n, s] ≤ primitiveBitBound n s := by + refine ⟨BitRefinement.executionSteps_exec generatorProgram [n, s], + (BitRefinement.executionSteps_le generatorProgram [n, s]).trans ?_⟩ + exact Nat.mul_le_mul_left 1024 (Nat.pow_le_pow_left (generate_cost_le n s) 3) + +end NCHitting + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/BitModel.lean b/lean/OAI/Algebra/FormulaHitting/BitModel.lean new file mode 100644 index 0000000000000000000000000000000000000000..818491fbcbcc217b0c3555d4cbda0d6b8e2669b0 --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/BitModel.lean @@ -0,0 +1,137 @@ +import Mathlib.Data.Nat.Size +import Mathlib.Data.List.Range +import Mathlib.Algebra.BigOperators.Group.List.Basic + +namespace OAI + +namespace NCHitting.BitModel + +def width (n : ℕ) : ℕ := n.size + 1 + +def addCost (a b : ℕ) : ℕ := 4 * (width a + width b) +def mulCost (a b : ℕ) : ℕ := 8 * width a * width b +def compareCost (a b : ℕ) : ℕ := 2 * (width a + width b) + +def listBits (xs : List ℕ) : ℕ := (xs.map width).sum + +structure NatResult where + value : ℕ + cost : ℕ + deriving DecidableEq, Repr + +def powerRun (base : ℕ) : ℕ → NatResult + | 0 => ⟨1, width 1⟩ + | k + 1 => + let previous := powerRun base k + ⟨previous.value * base, + previous.cost + mulCost previous.value base + addCost k 1 + 1⟩ + +@[simp] theorem powerRun_value (base k : ℕ) : (powerRun base k).value = base ^ k := by + induction k with + | zero => rfl + | succ k ih => simp [powerRun, ih, pow_succ] + +inductive Expr where + | literal : ℕ → Expr + | read : ℕ → Expr + | add : Expr → Expr → Expr + | sub : Expr → Expr → Expr + | mul : Expr → Expr → Expr + | power : Expr → Expr → Expr + | less : Expr → Expr → Expr + | equal : Expr → Expr → Expr + | odd : Expr → Expr + deriving DecidableEq, Repr + +def Expr.run (environment : List ℕ) : Expr → NatResult + | .literal n => ⟨n, width n + 1⟩ + | .read index => + ⟨environment[index]?.getD 0, + width index + listBits (environment.take (index + 1)) + 1⟩ + | .add a b => + let x := a.run environment + let y := b.run environment + ⟨x.value + y.value, x.cost + y.cost + addCost x.value y.value + 1⟩ + | .sub a b => + let x := a.run environment + let y := b.run environment + ⟨x.value - y.value, x.cost + y.cost + addCost x.value y.value + 1⟩ + | .mul a b => + let x := a.run environment + let y := b.run environment + ⟨x.value * y.value, x.cost + y.cost + mulCost x.value y.value + 1⟩ + | .power a b => + let x := a.run environment + let y := b.run environment + let z := powerRun x.value y.value + ⟨z.value, x.cost + y.cost + z.cost + 1⟩ + | .less a b => + let x := a.run environment + let y := b.run environment + ⟨if x.value < y.value then 1 else 0, + x.cost + y.cost + compareCost x.value y.value + 1⟩ + | .equal a b => + let x := a.run environment + let y := b.run environment + ⟨if x.value = y.value then 1 else 0, + x.cost + y.cost + compareCost x.value y.value + 1⟩ + | .odd a => + let x := a.run environment + ⟨x.value % 2, x.cost + 2⟩ + +structure RationalCode where + negative : Bool + numerator : ℕ + denominator : ℕ + deriving DecidableEq, Repr + +def RationalCode.bits (entry : RationalCode) : ℕ := + 1 + width entry.numerator + width entry.denominator + +def outputBits (entries : List RationalCode) : ℕ := (entries.map RationalCode.bits).sum + +inductive Program where + | skip : Program + | emit : Expr → Expr → Expr → Program + | sequence : Program → Program → Program + | branch : Expr → Program → Program → Program + | loop : Expr → Program → Program + deriving DecidableEq, Repr + +structure ProgramResult where + output : List RationalCode + cost : ℕ + deriving DecidableEq, Repr + +def Program.run (environment : List ℕ) : Program → ProgramResult + | .skip => ⟨[], 1⟩ + | .emit sign numerator denominator => + let s := sign.run environment + let a := numerator.run environment + let b := denominator.run environment + let entry : RationalCode := ⟨decide (s.value % 2 = 1), a.value, b.value⟩ + ⟨[entry], s.cost + a.cost + b.cost + entry.bits + 2⟩ + | .sequence p q => + let x := p.run environment + let y := q.run environment + ⟨x.output ++ y.output, x.cost + y.cost + outputBits x.output + 1⟩ + | .branch test yes no => + let t := test.run environment + let result := if t.value = 0 then no.run environment else yes.run environment + ⟨result.output, t.cost + result.cost + 1⟩ + | .loop bound body => + let b := bound.run environment + let iterations := (List.range b.value).map fun index => + let result := body.run (index :: environment) + (result, width index + addCost index 1 + 1) + ⟨iterations.flatMap (fun result => result.1.output), + b.cost + 1 + (iterations.map fun result => + result.1.cost + result.2 + outputBits result.1.output).sum⟩ + +def execute (program : Program) (inputs : List ℕ) : ProgramResult := + let result := program.run inputs + ⟨result.output, listBits inputs + result.cost⟩ + +end NCHitting.BitModel + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/BitRefinement.lean b/lean/OAI/Algebra/FormulaHitting/BitRefinement.lean new file mode 100644 index 0000000000000000000000000000000000000000..1e5089eb9da8ef59a139feeb2c71e4ba58743132 --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/BitRefinement.lean @@ -0,0 +1,632 @@ +import OAI.Algebra.FormulaHitting.BitArithmetic +import OAI.Algebra.FormulaHitting.ProgramCost + +namespace OAI + +namespace NCHitting.BitRefinement + +open BitModel + +theorem width_pos (a : ℕ) : 0 < width a := by unfold width; omega + +theorem width_mono {a b : ℕ} (h : a ≤ b) : width a ≤ width b := + Nat.add_le_add_right (Nat.size_le_size h) 1 + +theorem width_add_le (a b : ℕ) : width (a+b) ≤ width a + width b := by + have ha := Nat.lt_size_self a + have hb := Nat.lt_size_self b + have hpa : 2^a.size ≤ 2^(a.size+b.size) := + Nat.pow_le_pow_right (by decide) (by omega) + have hpb : 2^b.size ≤ 2^(a.size+b.size) := + Nat.pow_le_pow_right (by decide) (by omega) + have hp : a+b < 2^(a.size+b.size+1) := by rw [pow_succ]; omega + have hs := Nat.size_le.mpr hp + unfold width + omega + +theorem addCost_ge_widths (a b : ℕ) : width a + width b ≤ addCost a b := by + unfold addCost + omega + +theorem mulCost_ge_widths (a b : ℕ) : width a + width b ≤ mulCost a b := by + have ha := width_pos a + have hb := width_pos b + unfold mulCost + nlinarith + +theorem powerRun_count_le (base k : ℕ) : k+2 ≤ (powerRun base k).cost := by + induction k with + | zero => simp [powerRun, width] + | succ k ih => simp only [powerRun]; omega + +theorem powerRun_width_le (base k : ℕ) : + width (base^k) ≤ (powerRun base k).cost := by + induction k with + | zero => simp [powerRun, width] + | succ k ih => + have hw := BitModel.width_mul_le (base^k) base + have hc := mulCost_ge_widths (base^k) base + simp only [powerRun, powerRun_value, pow_succ] + omega + +theorem listBits_mem_le {a : ℕ} {env : List ℕ} (h : a ∈ env) : + width a ≤ listBits env := by + induction env with + | nil => simp at h + | cons x xs ih => + simp only [List.mem_cons] at h + rcases h with rfl | h + · simp [listBits] + · have hi := ih h + change width a ≤ width x + listBits xs + omega + +theorem expr_width_le (env : List ℕ) (e : Expr) : + width (e.run env).value ≤ (e.run env).cost + listBits env := by + cases e with + | literal a => simp only [Expr.run]; omega + | read i => + cases h : env[i]? with + | none => simp only [Expr.run, h, Option.getD_none, width, Nat.size_zero]; omega + | some a => + have hw := listBits_mem_le (List.mem_of_getElem? h) + simp only [Expr.run, h, Option.getD_some] + omega + | add a b => + have hw := width_add_le (a.run env).value (b.run env).value + have hc := addCost_ge_widths (a.run env).value (b.run env).value + simp only [Expr.run] + omega + | sub a b => + have hw := width_mono (Nat.sub_le (a.run env).value (b.run env).value) + have hc := addCost_ge_widths (a.run env).value (b.run env).value + simp only [Expr.run] + omega + | mul a b => + have hw := BitModel.width_mul_le (a.run env).value (b.run env).value + have hc := mulCost_ge_widths (a.run env).value (b.run env).value + simp only [Expr.run] + omega + | power a b => + have hw := powerRun_width_le (a.run env).value (b.run env).value + simpa only [Expr.run, powerRun_value] using hw.trans + (by omega : (powerRun (a.run env).value (b.run env).value).cost ≤ + (a.run env).cost + (b.run env).cost + + (powerRun (a.run env).value (b.run env).value).cost + 1 + listBits env) + | less a b => + simp only [Expr.run] + split <;> simp [width, compareCost] <;> omega + | equal a b => + simp only [Expr.run] + split <;> simp [width, compareCost] <;> omega + | odd a => + have h : (a.run env).value % 2 ≤ 1 := by omega + have hw := width_mono h + simp only [Expr.run] + have : width 1 = 2 := rfl + omega + +inductive Step where + | writeNat : ℕ → Step + | read : List ℕ → ℕ → Step + | add : ℕ → ℕ → Step + | sub : ℕ → ℕ → Step + | mul : ℕ → ℕ → Step + | less : ℕ → ℕ → Step + | equal : ℕ → ℕ → Step + | odd : ℕ → Step + | emit : RationalCode → Step + | copy : List RationalCode → Step + | input : List ℕ → Step + | control : Step + deriving DecidableEq + +def Step.tariff : Step → ℕ + | .writeNat n => width n + | .read env i => width i + listBits (env.take (i+1)) + 1 + | .add a b | .sub a b => addCost a b + | .mul a b => mulCost a b + | .less a b | .equal a b => compareCost a b + | .odd _ => 2 + | .emit e => e.bits + 2 + | .copy es => outputBits es + | .input env => listBits env + | .control => 1 + +def Step.steps : Step → ℕ + | .add a b => (BitArithmetic.addNat a b).steps + | .sub a b => (BitArithmetic.subNat a b).steps + | .mul a b => (BitArithmetic.mulNat a b).steps + | .less a b => (BitArithmetic.lessNat a b).steps + | .equal a b => (BitArithmetic.equalNat a b).steps + | s => s.tariff + +theorem self_le_square (a : ℕ) : a ≤ a^2 := by + cases a with + | zero => simp + | succ a => nlinarith + +theorem Step.steps_le (s : Step) : s.steps ≤ s.tariff^2 := by + cases s with + | add a b => exact BitArithmetic.addNat_steps a b + | sub a b => exact BitArithmetic.subNat_steps a b + | mul a b => exact BitArithmetic.mulNat_steps a b + | less a b => exact BitArithmetic.lessNat_steps a b + | equal a b => exact BitArithmetic.equalNat_steps a b + | _ => exact self_le_square _ + +abbrev Trace := List Step +def Trace.steps (t : Trace) : ℕ := (t.map Step.steps).sum + +def powerTrace (base : ℕ) : ℕ → Trace + | 0 => [.equal 0 0, .control, .writeNat 1] + | k+1 => [.equal (k+1) 0, .control, .sub (k+1) 1] ++ powerTrace base k ++ + [.mul (base^k) base] + +def exprTrace (env : List ℕ) : Expr → Trace + | .literal n => [.writeNat n, .control] + | .read i => [.read env i] + | .add a b => exprTrace env a ++ exprTrace env b ++ + [.add (a.run env).value (b.run env).value, .control] + | .sub a b => exprTrace env a ++ exprTrace env b ++ + [.sub (a.run env).value (b.run env).value, .control] + | .mul a b => exprTrace env a ++ exprTrace env b ++ + [.mul (a.run env).value (b.run env).value, .control] + | .less a b => exprTrace env a ++ exprTrace env b ++ + [.less (a.run env).value (b.run env).value, .control] + | .equal a b => exprTrace env a ++ exprTrace env b ++ + [.equal (a.run env).value (b.run env).value, .control] + | .power a b => exprTrace env a ++ exprTrace env b ++ + powerTrace (a.run env).value (b.run env).value ++ [.control] + | .odd a => exprTrace env a ++ [.odd (a.run env).value] + +def programTrace (env : List ℕ) : Program → Trace + | .skip => [.control] + | .emit s a b => exprTrace env s ++ exprTrace env a ++ exprTrace env b ++ + [.emit ⟨decide ((s.run env).value % 2 = 1), (a.run env).value, (b.run env).value⟩] + | .sequence p q => programTrace env p ++ programTrace env q ++ + [.copy (p.run env).output, .control] + | .branch e p q => exprTrace env e ++ [.equal (e.run env).value 0, .control] ++ + (if (e.run env).value = 0 then programTrace env q else programTrace env p) + | .loop e p => exprTrace env e ++ + ((List.range (e.run env).value).flatMap fun i => + [.equal i (e.run env).value, .writeNat i] ++ programTrace (i::env) p ++ + [.add i 1, .copy (p.run (i::env)).output, .control]) ++ + [.equal (e.run env).value (e.run env).value, .control] + +inductive PowerExecution (base : ℕ) : ℕ → ℕ → Trace → Prop where + | zero : PowerExecution base 0 1 [.equal 0 0, .control, .writeNat 1] + | succ {k v t} (h : PowerExecution base k v t) + (hc : (BitArithmetic.equalNat (k+1) 0).bit = false) + (hd : (BitArithmetic.subNat (k+1) 1).bits = k.bits) : + PowerExecution base (k+1) (BitArithmetic.value (BitArithmetic.mulNat v base).bits) + ([.equal (k+1) 0, .control, .sub (k+1) 1] ++ t ++ [.mul v base]) + +inductive ExprExecution (env : List ℕ) : Expr → ℕ → Trace → Prop where + | literal (n) : ExprExecution env (.literal n) n [.writeNat n, .control] + | read (i) : ExprExecution env (.read i) (env[i]?.getD 0) [.read env i] + | add {a b x y tx ty} (ha : ExprExecution env a x tx) (hb : ExprExecution env b y ty) : + ExprExecution env (.add a b) (BitArithmetic.value (BitArithmetic.addNat x y).bits) + (tx ++ ty ++ [.add x y, .control]) + | sub {a b x y tx ty} (ha : ExprExecution env a x tx) (hb : ExprExecution env b y ty) : + ExprExecution env (.sub a b) (BitArithmetic.value (BitArithmetic.subNat x y).bits) + (tx ++ ty ++ [.sub x y, .control]) + | mul {a b x y tx ty} (ha : ExprExecution env a x tx) (hb : ExprExecution env b y ty) : + ExprExecution env (.mul a b) (BitArithmetic.value (BitArithmetic.mulNat x y).bits) + (tx ++ ty ++ [.mul x y, .control]) + | less {a b x y tx ty} (ha : ExprExecution env a x tx) (hb : ExprExecution env b y ty) : + ExprExecution env (.less a b) (BitArithmetic.lessNat x y).bit.toNat + (tx ++ ty ++ [.less x y, .control]) + | equal {a b x y tx ty} (ha : ExprExecution env a x tx) (hb : ExprExecution env b y ty) : + ExprExecution env (.equal a b) (BitArithmetic.equalNat x y).bit.toNat + (tx ++ ty ++ [.equal x y, .control]) + | power {a b x y v tx ty tp} (ha : ExprExecution env a x tx) (hb : ExprExecution env b y ty) + (hp : PowerExecution x y v tp) : + ExprExecution env (.power a b) v (tx ++ ty ++ tp ++ [.control]) + | odd {a x tx} (ha : ExprExecution env a x tx) : + ExprExecution env (.odd a) (BitArithmetic.oddNat x).bit.toNat (tx ++ [.odd x]) + +inductive ProgramExecution : List ℕ → Program → List RationalCode → Trace → Prop where + | skip (env) : ProgramExecution env .skip [] [.control] + | emit {env s a b x y z tx ty tz} + (hs : ExprExecution env s x tx) (ha : ExprExecution env a y ty) + (hb : ExprExecution env b z tz) : + ProgramExecution env (.emit s a b) [⟨(BitArithmetic.oddNat x).bit,y,z⟩] + (tx ++ ty ++ tz ++ [.emit ⟨(BitArithmetic.oddNat x).bit,y,z⟩]) + | sequence {env p q x y tx ty} + (hp : ProgramExecution env p x tx) (hq : ProgramExecution env q y ty) : + ProgramExecution env (.sequence p q) (x++y) (tx++ty++[.copy x,.control]) + | branch {env e p q x tx output tp} + (he : ExprExecution env e x tx) + (hp : ProgramExecution env (if x=0 then q else p) output tp) + (hc : (BitArithmetic.equalNat x 0).bit = decide (x=0)) : + ProgramExecution env (.branch e p q) output (tx++[.equal x 0,.control]++tp) + | loop {env e p b te} (he : ExprExecution env e b te) + (outputs : ℕ → List RationalCode) (traces : ℕ → Trace) + (hbody : ∀ i < b, ProgramExecution (i::env) p (outputs i) (traces i)) + (htest : ∀ i < b, (BitArithmetic.equalNat i b).bit = false) + (hstep : ∀ i < b, (BitArithmetic.addNat i 1).bits = (i+1).bits) + (hfinal : (BitArithmetic.equalNat b b).bit = true) : + ProgramExecution env (.loop e p) ((List.range b).flatMap outputs) + (te ++ ((List.range b).flatMap fun i => + [.equal i b,.writeNat i] ++ traces i ++ [.add i 1,.copy (outputs i),.control]) ++ + [.equal b b,.control]) + +def Exec (p : Program) (inputs : List ℕ) (output : List RationalCode) (steps : ℕ) : Prop := + ∃ t, ProgramExecution inputs p output t ∧ steps = Trace.steps (.input inputs :: t) + +theorem powerTrace_correct (base k : ℕ) : PowerExecution base k (base^k) (powerTrace base k) := by + induction k with + | zero => exact PowerExecution.zero + | succ k ih => + simpa [powerTrace, BitArithmetic.mulNat_value, BitArithmetic.value_bits, pow_succ] using + PowerExecution.succ ih (by simp [BitArithmetic.equalNat_value]) + (by simp [BitArithmetic.subNat_value]) + +theorem exprTrace_correct (env : List ℕ) (e : Expr) : + ExprExecution env e (e.run env).value (exprTrace env e) := by + induction e with + | literal n => exact ExprExecution.literal n + | read i => exact ExprExecution.read i + | add a b ha hb => + simpa [exprTrace, Expr.run, BitArithmetic.addNat_value, BitArithmetic.value_bits] using ExprExecution.add ha hb + | sub a b ha hb => + simpa [exprTrace, Expr.run, BitArithmetic.subNat_value, BitArithmetic.value_bits] using ExprExecution.sub ha hb + | mul a b ha hb => + simpa [exprTrace, Expr.run, BitArithmetic.mulNat_value, BitArithmetic.value_bits] using ExprExecution.mul ha hb + | less a b ha hb => + by_cases h : (a.run env).value < (b.run env).value <;> + simpa [exprTrace, Expr.run, BitArithmetic.lessNat_value, h] using ExprExecution.less ha hb + | equal a b ha hb => + by_cases h : (a.run env).value = (b.run env).value <;> + simpa [exprTrace, Expr.run, BitArithmetic.equalNat_value, h] using ExprExecution.equal ha hb + | power a b ha hb => + simpa [exprTrace, Expr.run] using ExprExecution.power ha hb + (powerTrace_correct (a.run env).value (b.run env).value) + | odd a ha => simpa [exprTrace, Expr.run, BitArithmetic.oddNat_value] using ExprExecution.odd ha + +theorem programTrace_correct (env : List ℕ) (p : Program) : + ProgramExecution env p (p.run env).output (programTrace env p) := by + induction p generalizing env with + | skip => exact ProgramExecution.skip env + | emit s a b => + simpa only [programTrace, Program.run, BitArithmetic.oddNat_eq] using + (ProgramExecution.emit (exprTrace_correct env s) + (exprTrace_correct env a) (exprTrace_correct env b)) + | sequence p q hp hq => exact ProgramExecution.sequence (hp env) (hq env) + | branch e p q hp hq => + have hchoice : ProgramExecution env (if (e.run env).value=0 then q else p) + (if (e.run env).value=0 then (q.run env).output else (p.run env).output) + (if (e.run env).value=0 then programTrace env q else programTrace env p) := by + split <;> [exact hq env; exact hp env] + simpa only [Program.run, programTrace, apply_ite] using + ProgramExecution.branch (exprTrace_correct env e) hchoice + (BitArithmetic.equalNat_value _ _) + | loop e p hp => + simpa only [Program.run, programTrace, List.flatMap_map] using + ProgramExecution.loop (exprTrace_correct env e) + (fun i => (p.run (i::env)).output) (fun i => programTrace (i::env) p) + (fun i _ => hp (i::env)) + (by intro i hi; simp [BitArithmetic.equalNat_value, Nat.ne_of_lt hi]) + (by intro i _; exact BitArithmetic.addNat_value i 1) + (by simp [BitArithmetic.equalNat_value]) + +structure Bounded (t : Trace) (cost cap : ℕ) : Prop where + length_le : t.length ≤ 2*cost + tariff_le : ∀ s ∈ t, s.tariff ≤ cap + +theorem Bounded.mono {t : Trace} {c b c' b' : ℕ} (h : Bounded t c b) + (hc : c ≤ c') (hb : b ≤ b') : Bounded t c' b' := + ⟨h.length_le.trans (Nat.mul_le_mul_left 2 hc), fun s hs => (h.tariff_le s hs).trans hb⟩ + +theorem Bounded.append {t u : Trace} {c d b : ℕ} + (ht : Bounded t c b) (hu : Bounded u d b) : Bounded (t++u) (c+d) b := by + refine ⟨?_, ?_⟩ + · simp only [List.length_append] + have h1 := ht.length_le + have h2 := hu.length_le + omega + · intro s hs + rcases List.mem_append.mp hs with h | h + · exact ht.tariff_le s h + · exact hu.tariff_le s h + +theorem bounded_flatMap {α : Type*} (xs : List α) (f : α → Trace) (c : α → ℕ) (B : ℕ) + (h : ∀ x ∈ xs, Bounded (f x) (c x) B) : + Bounded (xs.flatMap f) ((xs.map c).sum) B := by + induction xs with + | nil => exact ⟨by simp, by simp⟩ + | cons x xs ih => + exact (h x (by simp)).append (ih (fun y hy => h y (by simp [hy]))) + +theorem bounded_pair (s : Step) (c B : ℕ) (hs : s.tariff ≤ B) (hB : 1 ≤ B) : + Bounded [s,.control] (c+1) B := by + refine ⟨by simp, ?_⟩ + intro t ht + simp only [List.mem_cons, List.not_mem_nil, or_false] at ht + rcases ht with rfl | rfl + · exact hs + · exact hB + +theorem bounded_single (s : Step) (c B : ℕ) (hc : 0 < c) (hs : s.tariff ≤ B) : + Bounded [s] c B := by + refine ⟨by simp; omega, ?_⟩ + intro t ht + have ht' : t = s := by simpa using ht + subst t + exact hs + +theorem expr_cost_pos (env : List ℕ) (e : Expr) : 0 < (e.run env).cost := by + cases e <;> simp only [Expr.run] <;> omega + +theorem program_cost_pos (env : List ℕ) (p : Program) : 0 < (p.run env).cost := by + cases p <;> simp only [Program.run] <;> omega + +theorem powerTrace_bounded (base k : ℕ) : + Bounded (powerTrace base k) (powerRun base k).cost (16*(powerRun base k).cost) := by + induction k with + | zero => + constructor + · simp [powerTrace, powerRun, width] + · intro s hs + simp only [powerTrace, List.mem_cons, List.not_mem_nil, or_false] at hs + rcases hs with rfl | rfl | rfl <;> simp [Step.tariff, powerRun, compareCost, width] + | succ k ih => + have hc := powerRun_count_le base (k+1) + have hw := BitModel.width_le_of_le (le_refl (k+1)) + have hold : (powerRun base k).cost ≤ (powerRun base (k+1)).cost := by simp [powerRun]; omega + have hmul : mulCost (base^k) base ≤ (powerRun base (k+1)).cost := by + simp only [powerRun, powerRun_value]; omega + constructor + · have hl := ih.length_le + have hm := mulCost_ge_widths (base^k) base + have hp := width_pos base + simp only [powerTrace, List.length_append, List.length_cons, List.length_nil, + powerRun, powerRun_value] + omega + · intro s hs + simp only [powerTrace, List.mem_append, List.mem_cons, List.not_mem_nil, or_false] at hs + rcases hs with ((rfl | rfl | rfl) | hs) | rfl + · simp only [Step.tariff, compareCost] + have : width 0 = 1 := rfl + omega + · simp only [Step.tariff]; omega + · simp only [Step.tariff, addCost] + have : width 1 = 2 := rfl + omega + · exact (ih.tariff_le s hs).trans (by omega) + · exact hmul.trans (by omega) + +theorem binary_bounded (ta tb : Trace) (ca cb charge r : ℕ) (op : Step) + (ha : Bounded ta ca (16*(ca+r))) (hb : Bounded tb cb (16*(cb+r))) + (hop : op.tariff ≤ charge) : + Bounded (ta++tb++[op,.control]) (ca+cb+charge+1) (16*(ca+cb+charge+1+r)) := by + have h1 := ha.mono (le_refl _) (by omega : 16*(ca+r) ≤ 16*(ca+cb+charge+1+r)) + have h2 := hb.mono (le_refl _) (by omega : 16*(cb+r) ≤ 16*(ca+cb+charge+1+r)) + have h3 := bounded_pair op charge (16*(ca+cb+charge+1+r)) (by omega) (by omega) + simpa only [Nat.add_assoc] using (h1.append h2).append h3 + +theorem exprTrace_bounded (env : List ℕ) (e : Expr) : + Bounded (exprTrace env e) (e.run env).cost (16*((e.run env).cost+listBits env)) := by + induction e with + | literal n => + change Bounded _ (width n+1) (16*(width n+1+listBits env)) + exact bounded_pair (.writeNat n) (width n) _ (by simp [Step.tariff]; omega) (by omega) + | read i => + apply bounded_single _ _ _ (expr_cost_pos env (.read i)) + change (Expr.read i |>.run env).cost ≤ _ + omega + | add a b ha hb => exact binary_bounded _ _ _ _ _ _ _ ha hb (le_refl _) + | sub a b ha hb => exact binary_bounded _ _ _ _ _ _ _ ha hb (le_refl _) + | mul a b ha hb => exact binary_bounded _ _ _ _ _ _ _ ha hb (le_refl _) + | less a b ha hb => exact binary_bounded _ _ _ _ _ _ _ ha hb (le_refl _) + | equal a b ha hb => exact binary_bounded _ _ _ _ _ _ _ ha hb (le_refl _) + | power a b ha hb => + let ca := (a.run env).cost + let cb := (b.run env).cost + let cp := (powerRun (a.run env).value (b.run env).value).cost + let B := 16*(ca+cb+cp+1+listBits env) + have h1 : Bounded (exprTrace env a) ca B := ha.mono (le_refl _) (by dsimp [B,ca,cb,cp]; omega) + have h2 : Bounded (exprTrace env b) cb B := hb.mono (le_refl _) (by dsimp [B,ca,cb,cp]; omega) + have h3 : Bounded (powerTrace (a.run env).value (b.run env).value) cp B := + (powerTrace_bounded _ _).mono (le_refl _) (by dsimp [B,ca,cb,cp]; omega) + have h4 : Bounded [.control] 1 B := bounded_single _ _ _ (by decide) (by dsimp [Step.tariff,B]; omega) + exact ((h1.append h2).append h3).append h4 + | odd a ha => + have h1 := ha.mono (le_refl _) (by omega : + 16*((a.run env).cost+listBits env) ≤ 16*((a.run env).cost+2+listBits env)) + have h2 : Bounded [.odd (a.run env).value] 2 (16*((a.run env).cost+2+listBits env)) := + bounded_single _ _ _ (by decide) (by simp only [Step.tariff]; omega) + exact h1.append h2 + +theorem sum_map_mem_le {α : Type*} (xs : List α) (f : α → ℕ) {x : α} (hx : x ∈ xs) : + f x ≤ (xs.map f).sum := by + induction xs with + | nil => simp at hx + | cons y ys ih => + simp only [List.mem_cons] at hx + simp only [List.map_cons, List.sum_cons] + rcases hx with rfl | hx + · omega + · have h := ih hx + omega + +def iterationCost (env : List ℕ) (p : Program) (i : ℕ) : ℕ := + (p.run (i::env)).cost + (width i + addCost i 1 + 1) + outputBits (p.run (i::env)).output + +theorem loop_cost (env : List ℕ) (e : Expr) (p : Program) : + ((Program.loop e p).run env).cost = (e.run env).cost + 1 + + ((List.range (e.run env).value).map (iterationCost env p)).sum := by + simp only [Program.run, List.map_map, Function.comp_def] + rfl + +theorem programTrace_bounded (env : List ℕ) (p : Program) : + Bounded (programTrace env p) (p.run env).cost (16*((p.run env).cost+listBits env)) := by + induction p generalizing env with + | skip => + apply bounded_single _ _ _ (by simp [Program.run]) + change 1 ≤ 16*(1+listBits env) + omega + | emit s a b => + let cs := (s.run env).cost + let ca := (a.run env).cost + let cb := (b.run env).cost + let entry : RationalCode := ⟨decide ((s.run env).value%2=1), (a.run env).value, (b.run env).value⟩ + let B := 16*(cs+ca+cb+entry.bits+2+listBits env) + have hs : Bounded (exprTrace env s) cs B := (exprTrace_bounded env s).mono (le_refl _) + (by dsimp [B,cs,ca,cb]; omega) + have ha : Bounded (exprTrace env a) ca B := (exprTrace_bounded env a).mono (le_refl _) + (by dsimp [B,cs,ca,cb]; omega) + have hb : Bounded (exprTrace env b) cb B := (exprTrace_bounded env b).mono (le_refl _) + (by dsimp [B,cs,ca,cb]; omega) + have he : Bounded [.emit entry] (entry.bits+2) B := bounded_single _ _ _ (by omega) + (by dsimp [Step.tariff,B]; omega) + simpa [programTrace, Program.run, cs, ca, cb, entry, B, Nat.add_assoc] using + ((hs.append ha).append hb).append he + | sequence p q hp hq => + let cp := (p.run env).cost + let cq := (q.run env).cost + let co := outputBits (p.run env).output + let B := 16*(cp+cq+co+1+listBits env) + have h1 : Bounded (programTrace env p) cp B := (hp env).mono (le_refl _) + (by dsimp [B,cp,cq,co]; omega) + have h2 : Bounded (programTrace env q) cq B := (hq env).mono (le_refl _) + (by dsimp [B,cp,cq,co]; omega) + have h3 : Bounded [.copy (p.run env).output,.control] (co+1) B := bounded_pair _ _ _ + (by dsimp [B,cp,cq,co,Step.tariff]; omega) (by dsimp [B]; omega) + simpa [programTrace, Program.run, cp, cq, co, B, Nat.add_assoc] using (h1.append h2).append h3 + | branch e p q hp hq => + let selected := if (e.run env).value=0 then q else p + have hi : Bounded (programTrace env selected) (selected.run env).cost + (16*((selected.run env).cost+listBits env)) := by + dsimp [selected] + split <;> [exact hq env; exact hp env] + let ce := (e.run env).cost + let cp := (selected.run env).cost + let B := 16*(ce+cp+1+listBits env) + have he := exprTrace_bounded env e + have hw := expr_width_le env e + have hprefix : Bounded (exprTrace env e ++ [.equal (e.run env).value 0,.control]) + (ce+1) B := by + constructor + · have hl := he.length_le + simp only [List.length_append, List.length_cons, List.length_nil] + dsimp [ce] + omega + · intro s hs + simp only [List.mem_append, List.mem_cons, List.not_mem_nil, or_false] at hs + rcases hs with hs | rfl | rfl + · exact (he.tariff_le s hs).trans (by dsimp [B,ce,cp]; omega) + · dsimp [Step.tariff,compareCost,B,ce,cp] + have : width 0 = 1 := rfl + omega + · dsimp [Step.tariff,B]; omega + have hbody : Bounded (programTrace env selected) cp B := hi.mono (le_refl _) + (by dsimp [B,ce,cp]; omega) + have hboth := hprefix.append hbody + by_cases h : (e.run env).value=0 <;> + simpa [programTrace,Program.run,selected,h,B,ce,cp,Nat.add_assoc,Nat.add_comm,Nat.add_left_comm] using hboth + | loop e p hp => + let b := (e.run env).value + let ce := (e.run env).cost + let S := ((List.range b).map (iterationCost env p)).sum + let C := ce+1+S + let B := 16*(C+listBits env) + have hC : ((Program.loop e p).run env).cost = C := loop_cost env e p + have hCpos : 0 < C := by dsimp [C]; omega + have hw := expr_width_le env e + have hiter : ∀ i ∈ List.range b, + Bounded ([.equal i b,.writeNat i] ++ programTrace (i::env) p ++ + [.add i 1,.copy (p.run (i::env)).output,.control]) (iterationCost env p i) B := by + intro i hi + have hic : iterationCost env p i ≤ S := sum_map_mem_le (List.range b) (iterationCost env p) hi + have hil : i < b := List.mem_range.mp hi + have hwi : width i ≤ width b := width_mono (Nat.le_of_lt hil) + have hbody := hp (i::env) + constructor + · have hl := hbody.length_le + have hpw := width_pos i + simp only [List.length_append,List.length_cons,List.length_nil] + dsimp [iterationCost,addCost] + have : width 1 = 2 := rfl + omega + · intro s hs + simp only [List.mem_append,List.mem_cons,List.not_mem_nil,or_false] at hs + rcases hs with ((rfl | rfl) | hs) | rfl | rfl | rfl + · dsimp [Step.tariff,compareCost,B,C,ce,b] + dsimp [b] at hwi + omega + · dsimp [Step.tariff,B,C] + dsimp [iterationCost] at hic + omega + · have hh := hbody.tariff_le s hs + change s.tariff ≤ 16*(C+listBits env) + change s.tariff ≤ 16*((p.run (i::env)).cost+(width i+listBits env)) at hh + dsimp [iterationCost] at hic + dsimp [C] + omega + · dsimp [Step.tariff,B,C] + dsimp [iterationCost] at hic + omega + · dsimp [Step.tariff,B,C] + dsimp [iterationCost] at hic + omega + · dsimp [Step.tariff,B] + omega + have hflat := bounded_flatMap (List.range b) + (fun i => [.equal i b,.writeNat i] ++ programTrace (i::env) p ++ + [.add i 1,.copy (p.run (i::env)).output,.control]) (iterationCost env p) B hiter + have hbound : Bounded (exprTrace env e) ce B := (exprTrace_bounded env e).mono (le_refl _) + (by dsimp [B,C,ce]; omega) + have hlast : Bounded [.equal b b,.control] 1 B := by + apply bounded_pair (.equal b b) 0 B + · dsimp [Step.tariff,compareCost,B,C,b,ce] + omega + · dsimp [B] + omega + rw [hC] + simpa [programTrace,C,B,ce,S,b,Nat.add_assoc,Nat.add_comm,Nat.add_left_comm] using + (hbound.append hflat).append hlast + +def executionSteps (p : Program) (inputs : List ℕ) : ℕ := + Trace.steps (.input inputs :: programTrace inputs p) + +theorem executionSteps_exec (p : Program) (inputs : List ℕ) : + Exec p inputs (BitModel.execute p inputs).output (executionSteps p inputs) := + ⟨programTrace inputs p, programTrace_correct inputs p, rfl⟩ + +theorem executionSteps_le (p : Program) (inputs : List ℕ) : + executionSteps p inputs ≤ 1024 * (BitModel.execute p inputs).cost^3 := by + let t := Step.input inputs :: programTrace inputs p + let C := (BitModel.execute p inputs).cost + have hp := programTrace_bounded inputs p + have hpos := program_cost_pos inputs p + have hl : t.length ≤ 3*C := by + have h := hp.length_le + dsimp [t,C,BitModel.execute] + omega + have ht : ∀ s ∈ t, s.steps ≤ (16*C)^2 := by + intro s hs + apply (Step.steps_le s).trans + apply Nat.pow_le_pow_left + simp only [t,List.mem_cons] at hs + rcases hs with rfl | hs + · change listBits inputs ≤ 16*C + dsimp [C,BitModel.execute] + omega + · simpa [C,BitModel.execute,Nat.add_comm] using hp.tariff_le s hs + change Trace.steps t ≤ 1024*C^3 + calc + Trace.steps t ≤ t.length*(16*C)^2 := + BitModel.sum_map_le_length_mul t Step.steps ((16*C)^2) ht + _ ≤ (3*C)*(16*C)^2 := Nat.mul_le_mul_right _ hl + _ ≤ 1024*C^3 := by ring_nf; omega + +theorem execute_refines (p : Program) (inputs : List ℕ) : + ∃ steps, Exec p inputs (BitModel.execute p inputs).output steps ∧ + steps ≤ 1024 * (BitModel.execute p inputs).cost^3 := + ⟨executionSteps p inputs, executionSteps_exec p inputs, executionSteps_le p inputs⟩ + +end NCHitting.BitRefinement + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/DimensionBound.lean b/lean/OAI/Algebra/FormulaHitting/DimensionBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..faace53e96ce0be869324da2fd37448c10fdb024 --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/DimensionBound.lean @@ -0,0 +1,43 @@ +import Mathlib.Data.Nat.Choose.Basic +import Mathlib.Tactic.Ring +import Lean.Elab.Tactic.Omega + +namespace OAI + +namespace NCHitting + +theorem choose_twice_add {s : ℕ} (hs : 0 < s) : + (2*s).choose 2 + s = 2*s^2 := by + rw [Nat.choose_two_right] + have he : (2*s)*(2*s-1) = (s*(2*s-1))*2 := by ring + rw [he, Nat.mul_div_left _ (by decide)] + calc + s*(2*s-1)+s = s*((2*s-1)+1) := by ring + _ = s*(2*s) := by rw [Nat.sub_add_cancel (by omega : 1 ≤ 2*s)] + _ = 2*s^2 := by ring + +theorem multiplicity_dimension_bound {n s m : ℕ} + (hn : 0 < n) (hs : 0 < s) (hm : m ≤ 2*s) : + (n-1)*m.choose 2 + m ≤ 2*n*s^2 := by + by_cases h1 : n = 1 + · subst n + simp only [Nat.sub_self, zero_mul, zero_add, mul_one] + have hsq : s ≤ s*s := Nat.le_mul_of_pos_right s hs + calc + m ≤ 2*s := hm + _ ≤ 2*(s*s) := Nat.mul_le_mul_left 2 hsq + _ = 2*s^2 := by ring + · have hn2 : 2 ≤ n := by omega + have hc : m.choose 2 ≤ (2*s).choose 2 := Nat.choose_le_choose 2 hm + calc + (n-1)*m.choose 2 + m ≤ n*((2*s).choose 2)+2*s := + Nat.add_le_add (Nat.mul_le_mul (Nat.sub_le _ _) hc) hm + _ ≤ n*((2*s).choose 2)+n*s := + Nat.add_le_add_left (Nat.mul_le_mul_right s hn2) _ + _ = n*((2*s).choose 2+s) := by ring + _ = n*(2*s^2) := by rw [choose_twice_add hs] + _ = 2*n*s^2 := by ring + +end NCHitting + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/Evaluation.lean b/lean/OAI/Algebra/FormulaHitting/Evaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..37b05dce6284affbb4683ee95d11b01616e687ea --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/Evaluation.lean @@ -0,0 +1,168 @@ +import OAI.Algebra.FormulaHitting.Formula +import Mathlib.Algebra.FreeMonoid.Basic +import Mathlib.Algebra.MonoidAlgebra.Basic + +namespace OAI + +namespace NCHitting + +local instance {n : ℕ} : DecidableEq (FreeMonoid (Fin n)) := + inferInstanceAs (DecidableEq (List (Fin n))) + +private def wordCuts {n : ℕ} (w : Word n) : + Finset (FreeMonoid (Fin n) × FreeMonoid (Fin n)) := + (Finset.range (w.length + 1)).image fun k => + (FreeMonoid.ofList (w.take k), FreeMonoid.ofList (w.drop k)) + +private theorem mem_wordCuts {n : ℕ} (w : Word n) + (p : FreeMonoid (Fin n) × FreeMonoid (Fin n)) : + p ∈ wordCuts w ↔ p.1 * p.2 = FreeMonoid.ofList w := by + unfold wordCuts + constructor + · rintro h + obtain ⟨k, hk, rfl⟩ := Finset.mem_image.mp h + change w.take k ++ w.drop k = w + exact List.take_append_drop k w + · intro h + apply Finset.mem_image.mpr + have hp : p.1.toList ++ p.2.toList = w := h + refine ⟨p.1.toList.length, Finset.mem_range.mpr ?_, ?_⟩ + · rw [← hp, List.length_append] + omega + · apply Prod.ext <;> apply FreeMonoid.toList.injective + · simp [← hp] + · simp [← hp] + +private theorem cuts_injective {n : ℕ} (w : Word n) : + Set.InjOn (fun k => (FreeMonoid.ofList (w.take k), FreeMonoid.ofList (w.drop k))) + (Finset.range (w.length + 1)) := by + intro k hk l hl h + have he := congrArg (fun p : FreeMonoid (Fin n) × FreeMonoid (Fin n) => + p.1.toList.length) h + simp only [FreeMonoid.toList_ofList, List.length_take] at he + have hk' : k ≤ w.length := by simpa using Nat.le_of_lt_succ (Finset.mem_range.mp hk) + have hl' : l ≤ w.length := by simpa using Nat.le_of_lt_succ (Finset.mem_range.mp hl) + simpa [Nat.min_eq_left hk', Nat.min_eq_left hl'] using he + +theorem monoidAlgebra_coeff_mul {F : Type*} {n : ℕ} [Semiring F] + (f g : MonoidAlgebra F (FreeMonoid (Fin n))) (w : Word n) : + (f * g).coeff (FreeMonoid.ofList w) = + convolution (fun v => f.coeff (FreeMonoid.ofList v)) + (fun v => g.coeff (FreeMonoid.ofList v)) w := by + rw [MonoidAlgebra.coeff_mul_antidiag f g _ (wordCuts w) (fun {_} => mem_wordCuts w _), + convolution_eq_sum] + exact Finset.sum_image (cuts_injective w) + +theorem sum_eq_sum_wordsOfLength {F M : Type*} {n d : ℕ} + [Zero F] [AddCommMonoid M] (p : Word n →₀ F) + (hcut : ∀ w, d ≤ w.length → p w = 0) + (h : Word n → F → M) (hzero : ∀ w, h w 0 = 0) : + p.sum h = ∑ k ∈ Finset.range d, ∑ w ∈ wordsOfLength n k, h w (p w) := by + classical + let S := (Finset.range d).biUnion (wordsOfLength n) + have hsupport : p.support ⊆ S := by + intro w hw + have hne : p w ≠ 0 := Finsupp.mem_support_iff.mp hw + have hlen : w.length < d := by + by_contra hn + exact hne (hcut w (by omega)) + exact Finset.mem_biUnion.mpr ⟨w.length, Finset.mem_range.mpr hlen, + (mem_wordsOfLength w).mpr rfl⟩ + rw [Finsupp.sum_of_support_subset p hsupport h (fun w _ => hzero w)] + apply Finset.sum_biUnion + intro k hk l hl hkl + apply Finset.disjoint_left.mpr + intro w hwk hwl + exact hkl (((mem_wordsOfLength w).mp hwk).symm.trans ((mem_wordsOfLength w).mp hwl)) + +namespace Formula + +noncomputable def monoidPolynomial {F : Type*} {n : ℕ} [Semiring F] : + Formula F n → MonoidAlgebra F (FreeMonoid (Fin n)) + | scalar a => MonoidAlgebra.single 1 a + | var i => MonoidAlgebra.single (FreeMonoid.of i) 1 + | add f g => monoidPolynomial f + monoidPolynomial g + | mul f g => monoidPolynomial f * monoidPolynomial g + +@[simp] theorem monoidPolynomial_coeff {F : Type*} {n : ℕ} [Semiring F] + (f : Formula F n) (w : Word n) : + f.monoidPolynomial.coeff (FreeMonoid.ofList w) = f.coeff w := by + classical + induction f generalizing w with + | scalar a => + simp only [monoidPolynomial, coeff, MonoidAlgebra.coeff_single, Finsupp.single_apply] + change (if ([] : Word n) = w then a else 0) = (if w = [] then a else 0) + simp [eq_comm] + | var i => + simp only [monoidPolynomial, coeff, MonoidAlgebra.coeff_single, Finsupp.single_apply] + change (if [i] = w then 1 else 0) = (if w = [i] then 1 else (0 : F)) + simp [eq_comm] + | add f g ihf ihg => simp [monoidPolynomial, coeff, ihf, ihg] + | mul f g ihf ihg => + rw [monoidPolynomial, monoidAlgebra_coeff_mul] + simp only [ihf, ihg, coeff] + +theorem eval_eq_lift {F A : Type*} {n : ℕ} [CommSemiring F] [Semiring A] + [Algebra F A] (f : Formula F n) (T : Fin n → A) : + f.eval (algebraMap F A) T = + MonoidAlgebra.lift F A (FreeMonoid (Fin n)) (FreeMonoid.lift T) f.monoidPolynomial := by + induction f with + | scalar a => simp [eval, monoidPolynomial, Algebra.smul_def] + | var i => simp [eval, monoidPolynomial] + | add f g ihf ihg => simp [eval, monoidPolynomial, ihf, ihg] + | mul f g ihf ihg => simp [eval, monoidPolynomial, ihf, ihg] + +theorem eval_eq_sum {F A : Type*} {n : ℕ} [CommSemiring F] [Semiring A] + [Algebra F A] (f : Formula F n) (T : Fin n → A) : + f.eval (algebraMap F A) T = + f.polynomial.sum (fun w a => algebraMap F A a * (w.map T).prod) := by + rw [eval_eq_lift, MonoidAlgebra.lift_apply'] + have hcoeff : f.monoidPolynomial.coeff = f.polynomial := by + ext w + exact monoidPolynomial_coeff f w + rw [hcoeff] + apply Finset.sum_congr rfl + intro w hw + change algebraMap F A (f.coeff w) * FreeMonoid.lift T w = + algebraMap F A (f.coeff w) * (w.toList.map T).prod + rw [FreeMonoid.lift_apply] + +theorem eval_eq_sum_of_cutoff {F A : Type*} {n d : ℕ} + [CommSemiring F] [Semiring A] [Algebra F A] + (f : Formula F n) (T : Fin n → A) + (hcut : ∀ w, d ≤ w.length → f.coeff w = 0) : + f.eval (algebraMap F A) T = + ∑ k ∈ Finset.range d, ∑ w ∈ wordsOfLength n k, + algebraMap F A (f.coeff w) * (w.map T).prod := by + rw [eval_eq_sum] + exact sum_eq_sum_wordsOfLength f.polynomial hcut _ (by intro w; simp) + +theorem eval_eq_sum_wordsOfLength {F A : Type*} {n s : ℕ} + [CommSemiring F] [Semiring A] [Algebra F A] + (f : Formula F n) (T : Fin n → A) (hs : f.size ≤ s) : + f.eval (algebraMap F A) T = + ∑ k ∈ Finset.range (s + 1), ∑ w ∈ wordsOfLength n k, + algebraMap F A (f.coeff w) * (w.map T).prod := by + classical + rw [eval_eq_sum] + let S := (Finset.range (s + 1)).biUnion (wordsOfLength n) + have hsupport : f.polynomial.support ⊆ S := by + intro w hw + have hne : f.coeff w ≠ 0 := Finsupp.mem_support_iff.mp hw + have hlen : w.length ≤ s := by + by_contra h + exact hne (f.coeff_eq_zero_of_length_gt w (by omega)) + exact Finset.mem_biUnion.mpr ⟨w.length, Finset.mem_range.mpr (by omega), + (mem_wordsOfLength w).mpr rfl⟩ + rw [Finsupp.sum_of_support_subset f.polynomial hsupport _ (by intros; simp)] + change (∑ w ∈ S, algebraMap F A (f.coeff w) * (w.map T).prod) = _ + apply Finset.sum_biUnion + intro k hk l hl hkl + apply Finset.disjoint_left.mpr + intro w hwk hwl + exact hkl (((mem_wordsOfLength w).mp hwk).symm.trans ((mem_wordsOfLength w).mp hwl)) + +end Formula +end NCHitting + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/Formula.lean b/lean/OAI/Algebra/FormulaHitting/Formula.lean new file mode 100644 index 0000000000000000000000000000000000000000..1f0590d8c3e656d9abc829c5d55889691ad990c7 --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/Formula.lean @@ -0,0 +1,147 @@ +import OAI.Algebra.FormulaHitting.Model +import Mathlib.Data.Finsupp.Basic +import Mathlib.Algebra.BigOperators.Group.Finset.Basic +import Mathlib.Data.Finset.Lattice.Fold +import Lean.Elab.Tactic.Omega + +namespace OAI + +namespace NCHitting + +theorem convolution_eq_sum {F : Type*} {n : ℕ} [Semiring F] + (f g : WordSeries F n) (w : Word n) : + convolution f g w = + ∑ k ∈ Finset.range (w.length + 1), f (w.take k) * g (w.drop k) := by + induction w generalizing f with + | nil => simp [convolution] + | cons i w ih => + rw [List.length_cons, Finset.sum_range_succ'] + simp only [List.take_zero, List.drop_zero, List.take_succ_cons, + List.drop_succ_cons] + rw [convolution, ih] + exact add_comm _ _ + +namespace Formula + +theorem size_pos {F : Type*} {n : ℕ} (f : Formula F n) : 0 < f.size := by + cases f <;> simp [size] + +theorem size_le_one_iff {F : Type*} {n : ℕ} (f : Formula F n) : + f.size ≤ 1 ↔ (∃ a, f = scalar a) ∨ (∃ i, f = var i) := by + cases f with + | scalar a => simp [size] + | var i => simp [size] + | add f g => + have hf := size_pos f + have hg := size_pos g + constructor + · intro h + simp only [size] at h + omega + · rintro (⟨a, h⟩ | ⟨i, h⟩) <;> cases h + | mul f g => + have hf := size_pos f + have hg := size_pos g + constructor + · intro h + simp only [size] at h + omega + · rintro (⟨a, h⟩ | ⟨i, h⟩) <;> cases h + +theorem eval_one_ne_zero_of_size_le_one {F : Type*} {n : ℕ} + [Semiring F] [Nontrivial F] (f : Formula F n) (hs : f.size ≤ 1) + (hf : f.coeff ≠ 0) : f.eval id (fun _ => 1) ≠ 0 := by + rcases (size_le_one_iff f).mp hs with ⟨a, rfl⟩ | ⟨i, rfl⟩ + · intro ha + apply hf + funext w + simp only [eval, id_eq] at ha + simp [coeff, ha] + · simp [eval] + +theorem coeff_eq_zero_of_length_gt {F : Type*} {n : ℕ} [Semiring F] + (f : Formula F n) (w : Word n) (hw : f.size < w.length) : + f.coeff w = 0 := by + induction f generalizing w with + | scalar a => + simp only [size] at hw + have : w ≠ [] := by intro h; simp [h] at hw + simp [coeff, this] + | var i => + simp only [size] at hw + have : w ≠ [i] := by intro h; simp [h] at hw + simp [coeff, this] + | add f g ihf ihg => + simp only [size] at hw + have hf : f.size < w.length := by omega + have hg : g.size < w.length := by omega + simp [coeff, ihf w hf, ihg w hg] + | mul f g ihf ihg => + simp only [size] at hw + rw [coeff, convolution_eq_sum] + apply Finset.sum_eq_zero + intro k hk + have hk' : k ≤ w.length := by + have hk'' := Finset.mem_range.mp hk + omega + by_cases hf : f.size < (w.take k).length + · rw [ihf _ hf, zero_mul] + · have hg : g.size < (w.drop k).length := by + simp only [List.length_take, List.length_drop, Nat.min_eq_left hk'] at hf ⊢ + omega + rw [ihg _ hg, mul_zero] + +end Formula + +def wordsOfLength (n : ℕ) : ℕ → Finset (Word n) + | 0 => {[]} + | k + 1 => Finset.univ.biUnion fun i => (wordsOfLength n k).image (List.cons i) + +theorem mem_wordsOfLength {n k : ℕ} (w : Word n) : + w ∈ wordsOfLength n k ↔ w.length = k := by + induction k generalizing w with + | zero => simp [wordsOfLength] + | succ k ih => + cases w with + | nil => simp [wordsOfLength] + | cons i w => simp [wordsOfLength, ih] + +theorem sum_wordsOfLength_succ {M : Type*} [AddCommMonoid M] + {n : ℕ} (k : ℕ) (f : Word n → M) : + (∑ w ∈ wordsOfLength n (k + 1), f w) = + ∑ i : Fin n, ∑ w ∈ wordsOfLength n k, f (i :: w) := by + rw [wordsOfLength, Finset.sum_biUnion] + · apply Finset.sum_congr rfl + intro i _ + exact Finset.sum_image (by + intro a _ b _ h + exact (List.cons.inj h).2) + · intro i _ j _ hij + apply Finset.disjoint_left.mpr + intro w hi hj + rcases Finset.mem_image.mp hi with ⟨v, _, hv⟩ + rcases Finset.mem_image.mp hj with ⟨v', _, hv'⟩ + exact hij (List.cons.inj (hv.trans hv'.symm)).1 + +theorem Formula.coeff_support_finite {F : Type*} {n : ℕ} [Semiring F] + (f : Formula F n) : (Function.support f.coeff).Finite := by + classical + let bound := (Finset.range (f.size + 1)).biUnion (wordsOfLength n) + apply Set.Finite.subset bound.finite_toSet + intro w hw + have hlen : w.length ≤ f.size := by + by_contra h + exact hw (f.coeff_eq_zero_of_length_gt w (by omega)) + exact Finset.mem_biUnion.mpr ⟨w.length, Finset.mem_range.mpr (by omega), + (mem_wordsOfLength w).mpr rfl⟩ + +noncomputable def Formula.polynomial {F : Type*} {n : ℕ} [Semiring F] + (f : Formula F n) : Word n →₀ F := + Finsupp.ofSupportFinite f.coeff f.coeff_support_finite + +@[simp] theorem Formula.polynomial_apply {F : Type*} {n : ℕ} [Semiring F] + (f : Formula F n) (w : Word n) : f.polynomial w = f.coeff w := rfl + +end NCHitting + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/FormulaBridge.lean b/lean/OAI/Algebra/FormulaHitting/FormulaBridge.lean new file mode 100644 index 0000000000000000000000000000000000000000..02cdd9ebd5a77019cdf4489c9c39d898ad915180 --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/FormulaBridge.lean @@ -0,0 +1,40 @@ +import OAI.Algebra.FormulaHitting.Specification +import OAI.Algebra.FormulaHitting.Formula + +namespace OAI + +namespace NCHittingSpecification + +namespace Formula + +def toImplementation {F : Type*} {n : ℕ} : Formula F n → NCHitting.Formula F n + | .scalar a => .scalar a + | .variable i => .var i + | .add f g => .add (toImplementation f) (toImplementation g) + | .multiply f g => .mul (toImplementation f) (toImplementation g) + +@[simp] theorem toImplementation_size {F : Type*} {n : ℕ} (f : Formula F n) : + f.toImplementation.size = f.gates := by + induction f <;> simp_all [toImplementation, gates, NCHitting.Formula.size] + +@[simp] theorem toImplementation_coeff {F : Type*} {n : ℕ} [Semiring F] + (f : Formula F n) (w : List (Fin n)) : + f.toImplementation.coeff w = f.coefficient w := by + induction f generalizing w with + | scalar a => rfl + | «variable» i => rfl + | add f g hf hg => simp [toImplementation, NCHitting.Formula.coeff, coefficient, hf, hg] + | multiply f g hf hg => + simp [toImplementation, NCHitting.Formula.coeff, coefficient, + NCHitting.convolution_eq_sum, hf, hg] + +@[simp] theorem toImplementation_eval {F : Type*} {n d : ℕ} [Field F] + (f : Formula F n) (T : Fin n → Matrix (Fin d) (Fin d) F) : + f.toImplementation.eval (Matrix.scalar (Fin d)) T = f.evaluate T := by + induction f <;> simp_all [toImplementation, NCHitting.Formula.eval, evaluate] + +end Formula + +end NCHittingSpecification + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/FormulaSeries.lean b/lean/OAI/Algebra/FormulaHitting/FormulaSeries.lean new file mode 100644 index 0000000000000000000000000000000000000000..e6d1cf464d9637a1405c160d1b0a992f8b5fd710 --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/FormulaSeries.lean @@ -0,0 +1,37 @@ +import OAI.Algebra.FormulaHitting.Evaluation +import OAI.Algebra.FormulaHitting.Series + +namespace OAI + +noncomputable section +namespace NCHitting +namespace Formula + +variable {F : Type*} {n : ℕ} [Field F] + +def series (f : Formula F n) : PowerSeries F := + f.polynomial.sum (fun w a => PowerSeries.C a * wordSeries w) + +theorem series_eq_smul_sum (f : Formula F n) : + f.series = f.polynomial.sum (fun w a => a • wordSeries w) := by + simp only [series, PowerSeries.smul_eq_C_mul] + +theorem series_eq_sum_of_cutoff (f : Formula F n) (d : ℕ) + (hcut : ∀ w, d ≤ w.length → f.coeff w = 0) : + f.series = ∑ k ∈ Finset.range d, ∑ w ∈ wordsOfLength n k, + PowerSeries.C (f.coeff w) * wordSeries w := by + exact sum_eq_sum_wordsOfLength f.polynomial hcut _ (by intro w; simp) + +theorem series_eq_sum_wordsOfLength (f : Formula F n) {s : ℕ} (hs : f.size ≤ s) : + f.series = ∑ k ∈ Finset.range (s + 1), ∑ w ∈ wordsOfLength n k, + PowerSeries.C (f.coeff w) * wordSeries w := by + apply f.series_eq_sum_of_cutoff + intro w hw + exact f.coeff_eq_zero_of_length_gt w (by omega) + +end Formula +end NCHitting + +end + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/Generator.lean b/lean/OAI/Algebra/FormulaHitting/Generator.lean new file mode 100644 index 0000000000000000000000000000000000000000..7444aaf8daf4a4606ecbf82adfe15ff988ce9820 --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/Generator.lean @@ -0,0 +1,94 @@ +import OAI.Algebra.FormulaHitting.Model +import Mathlib.Data.Matrix.Basic +import Mathlib.Data.Rat.Defs +import Mathlib.Data.Nat.Size +import Mathlib.Tactic.NormNum +import Mathlib.Tactic.Positivity + +namespace OAI + +namespace NCHitting + +theorem dimension_pos {n s : ℕ} (hn : 0 < n) (hs : 0 < s) : + 0 < dimension n s := by + unfold dimension + split_ifs <;> positivity + +theorem dimension_le {n s : ℕ} (hn : 0 < n) (hs : 0 < s) : + dimension n s ≤ 2 * n * s ^ 2 := by + unfold dimension + split_ifs with h + · rcases h with ⟨rfl, rfl⟩ + norm_num + · exact le_rfl + +theorem dimension_eq {n s : ℕ} (hns : 2 ≤ n * s) : + dimension n s = 2 * n * s ^ 2 := by + unfold dimension + split_ifs with h + · rcases h with ⟨rfl, rfl⟩ + norm_num at hns + · rfl + +@[simp] theorem dimension_one : dimension 1 1 = 1 := by decide + +theorem generator_one (i : Fin 1) (r q : Fin (dimension 1 1)) : + generator 1 1 i r q = 1 := by simp [generator] + +theorem generator_entry {n s : ℕ} (hns : 2 ≤ n * s) + (i : Fin n) (r q : Fin (dimension n s)) : + generator n s i r q = matrixEntry (i.val + 1) r.val q.val := by + have h : ¬(n = 1 ∧ s = 1) := by rintro ⟨rfl, rfl⟩; norm_num at hns + simp [generator, h] + +theorem matrixEntry_of_lt {i r q : ℕ} (h : q < r) : + matrixEntry i r q = (-1 : ℚ) ^ (r - q - 1) / ((r : ℚ) * i ^ (r - q)) := by + simp [matrixEntry, h] + +theorem matrixEntry_of_le {i r q : ℕ} (h : r ≤ q) : + matrixEntry i r q = 0 := by simp [matrixEntry, Nat.not_lt.mpr h] + +def entryBitBound (n d : ℕ) : ℕ := 3 + d.size + d * n.size + +theorem size_mul_le (a b : ℕ) : (a * b).size ≤ a.size + b.size := by + apply Nat.size_le.mpr + rw [pow_add] + exact Nat.mul_lt_mul_of_lt_of_lt (Nat.lt_size_self a) (Nat.lt_size_self b) + +theorem size_pow_le (a k : ℕ) : (a ^ k).size ≤ 1 + k * a.size := by + induction k with + | zero => simp + | succ k ih => + calc + (a ^ (k + 1)).size = (a ^ k * a).size := by rw [pow_succ] + _ ≤ (a ^ k).size + a.size := size_mul_le _ _ + _ ≤ 1 + (k + 1) * a.size := by rw [Nat.add_mul]; omega + +theorem denominator_pos {i r q : ℕ} (hi : 0 < i) (hq : q < r) : + 0 < r * i ^ (r - q) := Nat.mul_pos (by omega) (pow_pos hi _) + +theorem denominator_size_le {n d i r q : ℕ} + (hi : i ≤ n) (hr : r < d) : + (r * i ^ (r - q)).size ≤ entryBitBound n d := by + have hs := Nat.size_le_size hi + have ht := Nat.size_le_size (Nat.le_of_lt hr) + have hk : r - q ≤ d := by omega + calc + (r * i ^ (r - q)).size ≤ r.size + (i ^ (r - q)).size := size_mul_le _ _ + _ ≤ r.size + (1 + (r - q) * i.size) := Nat.add_le_add_left (size_pow_le _ _) _ + _ ≤ entryBitBound n d := by + have hm := Nat.mul_le_mul hk hs + unfold entryBitBound + omega + +theorem size_le_self (a : ℕ) : a.size ≤ a := by + apply Nat.size_le.mpr + exact Nat.lt_two_pow_self + +theorem entryBitBound_le (n d : ℕ) : entryBitBound n d ≤ 3 + d + d * n := by + unfold entryBitBound + exact Nat.add_le_add (Nat.add_le_add_left (size_le_self _) _) (Nat.mul_le_mul_left _ (size_le_self _)) + +end NCHitting + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/GeneratorBridge.lean b/lean/OAI/Algebra/FormulaHitting/GeneratorBridge.lean new file mode 100644 index 0000000000000000000000000000000000000000..baefbc5f732a9eb3f52d99430cf8bd9794a7ceb7 --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/GeneratorBridge.lean @@ -0,0 +1,47 @@ +import OAI.Algebra.FormulaHitting.Specification +import OAI.Algebra.FormulaHitting.Program +import OAI.Algebra.FormulaHitting.GeneratorCost +import OAI.Algebra.FormulaHitting.OutputBounds +import OAI.Algebra.FormulaHitting.BitCost + +namespace OAI + +namespace NCHittingSpecification + +universe u + +theorem dimension_eq (n s : ℕ) : dimension n s = NCHitting.dimension n s := rfl + +theorem expectedEntry_eq (n s : ℕ) : expectedEntry n s = NCHitting.generator n s := rfl + +theorem expectedProgram_eq : expectedProgram = NCHitting.generatorProgram := rfl + +theorem execute_expectedProgram_eq (n s : ℕ) : + NCHitting.BitModel.execute expectedProgram [n, s] = NCHitting.generate n s := rfl + +theorem expectedOutput_eq (n s : ℕ) : expectedOutput n s = NCHitting.encodedOutput n s := rfl + +theorem decode_eq : decode = NCHitting.decode := rfl + +theorem entryBitBound_eq (n d : ℕ) : entryBitBound n d = NCHitting.entryBitBound n d := rfl + +theorem costBound_eq (n s : ℕ) : costBound n s = NCHitting.generatorCostBound n s := rfl + +theorem primitiveBitBound_eq (n s : ℕ) : + primitiveBitBound n s = NCHitting.primitiveBitBound n s := rfl + +theorem completeClaim_of_hitting {n s : ℕ} (hn : 1 ≤ n) (hs : 1 ≤ s) + (hitting : UniversalHitting.{u} n s (dimension n s) (expectedEntry n s)) : + CompleteClaim.{u} n s := by + refine ⟨NCHitting.dimension_pos hn hs, NCHitting.dimension_le hn hs, ?_, ?_, ?_, ?_, ?_, + ?_, hitting⟩ + · exact NCHitting.generate_output n s + · exact NCHitting.generate_output_length n s + · exact NCHitting.generate_entry_bounds + · exact NCHitting.generate_entry_decode n s + · exact NCHitting.generate_cost_le n s + · exact NCHitting.generate_primitive_bit_bound n s + +end NCHittingSpecification + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/GeneratorCost.lean b/lean/OAI/Algebra/FormulaHitting/GeneratorCost.lean new file mode 100644 index 0000000000000000000000000000000000000000..bebf9f47bed3f6944151a4877f17cfe5f4c79bd1 --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/GeneratorCost.lean @@ -0,0 +1,344 @@ +import OAI.Algebra.FormulaHitting.Program +import OAI.Algebra.FormulaHitting.ProgramCost + +namespace OAI + +namespace NCHitting + +open BitModel + +def generatorExpressionBudget (M : ℕ) : ℕ := + expressionBudget M (intermediateWidthBound M) (registerReadBound M) + +def entryCostBound (M : ℕ) : ℕ := + 20 * generatorExpressionBudget M + intermediateWidthBound M + 20 + +def entryOutputBound (M : ℕ) : ℕ := intermediateWidthBound M + 3 + +private theorem bounded_dimensionExpr {environment : List ℕ} {M nr sr n s : ℕ} + (hM : 2 ≤ M) (hlen : environment.length ≤ 5) + (henv : ∀ a ∈ environment, a ≤ M) (hnr : nr ≤ 4) (hsr : sr ≤ 4) + (hnread : environment[nr]?.getD 0 = n) (hsread : environment[sr]?.getD 0 = s) + (hn : n ≤ M) (hs : s ≤ M) : + (dimensionExpr nr sr).Bounded environment M + (intermediateWidthBound M) (registerReadBound M) := by + have htwo := Expr.bounded_literal (environment := environment) hM + have hnvar := Expr.bounded_read hlen hnr henv + have hsvar := Expr.bounded_read hlen hsr henv + have hsn : s.size ≤ M := (size_le_self s).trans hs + have hwn : width n ≤ M + 1 := width_le_of_le hn + have hws2 : width (s ^ 2) ≤ 2 + 2 * M := by + have h := width_pow_le s 2 + omega + have hw2n : width (2 * n) ≤ M + 4 := by + have h := width_mul_le 2 n + have ht : width 2 = 3 := rfl + omega + have hp : (Expr.power (.read sr) (.literal 2)).Bounded environment M + (intermediateWidthBound M) (registerReadBound M) := by + refine ⟨?_, hsvar, htwo, ?_, ?_⟩ + · simp only [Expr.run, powerRun_value, hsread] + unfold intermediateWidthBound + omega + · simpa only [Expr.run, hsread] using hs + · exact hM + have hleft : (Expr.mul (.literal 2) (.read nr)).Bounded environment M + (intermediateWidthBound M) (registerReadBound M) := by + refine ⟨?_, htwo, hnvar⟩ + simp only [Expr.run, hnread] + unfold intermediateWidthBound + omega + refine ⟨?_, hleft, hp⟩ + have hw := width_mul_le (2 * n) (s ^ 2) + simp only [Expr.run, powerRun_value, hnread, hsread] + unfold intermediateWidthBound + omega + +theorem dimensionExpr_cost_le {environment : List ℕ} {M nr sr n s : ℕ} + (hM : 2 ≤ M) (hlen : environment.length ≤ 5) + (henv : ∀ a ∈ environment, a ≤ M) (hnr : nr ≤ 4) (hsr : sr ≤ 4) + (hnread : environment[nr]?.getD 0 = n) (hsread : environment[sr]?.getD 0 = s) + (hn : n ≤ M) (hs : s ≤ M) : + ((dimensionExpr nr sr).run environment).cost ≤ 7 * generatorExpressionBudget M := by + have h := Expr.cost_le_nodes_budget environment M (intermediateWidthBound M) + (registerReadBound M) (dimensionExpr nr sr) + (bounded_dimensionExpr hM hlen henv hnr hsr hnread hsread hn hs) + simpa [dimensionExpr, Expr.nodes, generatorExpressionBudget] using h + +private theorem bounded_entryExpressions {M q r i n s : ℕ} + (hM : 2 ≤ M) (hq : q ≤ M) (hr : r ≤ M) (hi : i + 1 ≤ M) + (hn : n ≤ M) (hs : s ≤ M) : + let environment := [q, r, i, n, s] + let bounded := fun e : Expr => e.Bounded environment M + (intermediateWidthBound M) (registerReadBound M) + bounded (.less (.read 0) (.read 1)) ∧ + bounded (.odd (.sub (.sub (.read 1) (.read 0)) (.literal 1))) ∧ + bounded (.mul (.read 1) (.power (.add (.read 2) (.literal 1)) + (.sub (.read 1) (.read 0)))) := by + dsimp only + have henv : ∀ a ∈ [q, r, i, n, s], a ≤ M := by + intro a ha + simp only [List.mem_cons, List.not_mem_nil, or_false] at ha + rcases ha with rfl | rfl | rfl | rfl | rfl <;> omega + have hqv := Expr.bounded_read (environment := [q, r, i, n, s]) + (index := 0) (by simp) (by omega) henv + have hrv := Expr.bounded_read (environment := [q, r, i, n, s]) + (index := 1) (by simp) (by omega) henv + have hiv := Expr.bounded_read (environment := [q, r, i, n, s]) + (index := 2) (by simp) (by omega) henv + have hone := Expr.bounded_literal (environment := [q, r, i, n, s]) + (a := 1) (by omega : 1 ≤ M) + have hsub : (Expr.sub (.read 1) (.read 0)).Bounded [q, r, i, n, s] M + (intermediateWidthBound M) (registerReadBound M) := by + refine ⟨?_, hrv, hqv⟩ + simpa [Expr.run] using small_width (by omega : r - q ≤ M) + have hsubone : (Expr.sub (.sub (.read 1) (.read 0)) (.literal 1)).Bounded + [q, r, i, n, s] M (intermediateWidthBound M) (registerReadBound M) := by + refine ⟨?_, hsub, hone⟩ + simpa [Expr.run] using small_width (by omega : r - q - 1 ≤ M) + have hadd : (Expr.add (.read 2) (.literal 1)).Bounded [q, r, i, n, s] M + (intermediateWidthBound M) (registerReadBound M) := by + refine ⟨?_, hiv, hone⟩ + simpa [Expr.run] using small_width hi + have hpwidth : width ((i + 1) ^ (r - q)) ≤ 2 + M * M := by + have h := width_pow_le (i + 1) (r - q) + have hsiz : (i + 1).size ≤ M := (size_le_self (i + 1)).trans hi + have hm := Nat.mul_le_mul (by omega : r - q ≤ M) hsiz + omega + have hp : (Expr.power (.add (.read 2) (.literal 1)) + (.sub (.read 1) (.read 0))).Bounded [q, r, i, n, s] M + (intermediateWidthBound M) (registerReadBound M) := by + refine ⟨?_, hadd, hsub, ?_, ?_⟩ + · simp only [Expr.run, List.getElem?_cons_zero, List.getElem?_cons_succ, + Option.getD_some, powerRun_value] + unfold intermediateWidthBound + omega + · simpa [Expr.run] using hi + · simpa [Expr.run] using (by omega : r - q ≤ M) + refine ⟨?_, ?_, ?_⟩ + · refine ⟨?_, hqv, hrv⟩ + have hw : width (if q < r then (1 : ℕ) else 0) ≤ 2 := by + by_cases hqr : q < r <;> simp [hqr, width] + have hb : 2 ≤ intermediateWidthBound M := by unfold intermediateWidthBound; omega + simpa [Expr.run] using hw.trans hb + · refine ⟨?_, hsubone⟩ + simpa [Expr.run] using + small_width (by have := Nat.mod_lt (r - q - 1) (by decide : 0 < 2); omega : + (r - q - 1) % 2 ≤ M) + · refine ⟨?_, hrv, hp⟩ + have hw := width_mul_le r ((i + 1) ^ (r - q)) + have hrw := width_le_of_le hr + simp only [Expr.run, List.getElem?_cons_zero, List.getElem?_cons_succ, + Option.getD_some, powerRun_value] + unfold intermediateWidthBound + omega + +theorem entryProgram_bounds {M q r i n s : ℕ} + (hM : 2 ≤ M) (hq : q ≤ M) (hr : r ≤ M) (hi : i + 1 ≤ M) + (hn : n ≤ M) (hs : s ≤ M) : + (entryProgram.run [q, r, i, n, s]).cost ≤ entryCostBound M ∧ + outputBits (entryProgram.run [q, r, i, n, s]).output ≤ entryOutputBound M := by + let environment := [q, r, i, n, s] + let condition : Expr := .less (.read 0) (.read 1) + let sign : Expr := .odd (.sub (.sub (.read 1) (.read 0)) (.literal 1)) + let denominator : Expr := .mul (.read 1) (.power (.add (.read 2) (.literal 1)) + (.sub (.read 1) (.read 0))) + let positive : Program := .emit sign (.literal 1) denominator + let zero : Program := .emit (.literal 0) (.literal 0) (.literal 1) + let E := generatorExpressionBudget M + let B := intermediateWidthBound M + have hE : 10 ≤ E := by unfold E generatorExpressionBudget expressionBudget; omega + have hB : 1 ≤ B := by unfold B intermediateWidthBound; omega + obtain ⟨hcondition, hsign, hdenominator⟩ := bounded_entryExpressions hM hq hr hi hn hs + have hc : (condition.run environment).cost ≤ 3 * E := by + have h := Expr.cost_le_nodes_budget environment M B (registerReadBound M) condition hcondition + simpa [condition, Expr.nodes, E, B, generatorExpressionBudget] using h + have hsc : (sign.run environment).cost ≤ 6 * E := by + have h := Expr.cost_le_nodes_budget environment M B (registerReadBound M) sign hsign + simpa [sign, Expr.nodes, E, B, generatorExpressionBudget] using h + have hdc : (denominator.run environment).cost ≤ 9 * E := by + have h := Expr.cost_le_nodes_budget environment M B (registerReadBound M) denominator hdenominator + simpa [denominator, Expr.nodes, E, B, generatorExpressionBudget] using h + have hdw : width (denominator.run environment).value ≤ B := + Expr.bounded_width hdenominator + have hlc : ((Expr.literal 1).run environment).cost ≤ E := by + change 3 ≤ E + omega + have hlw : width ((Expr.literal 1).run environment).value ≤ 2 := by + simp [Expr.run, width] + have hpc : (positive.run environment).cost ≤ 17 * E + B + 10 := by + have h := emit_cost_le environment sign (.literal 1) denominator + (6 * E) E (9 * E) 2 B hsc hlc hdc hlw hdw + change (positive.run environment).cost ≤ _ at h + omega + have hpo : outputBits (positive.run environment).output ≤ B + 3 := by + have h := emit_outputBits_le environment sign (.literal 1) denominator 2 B hlw hdw + simpa [positive, Nat.add_comm, Nat.add_left_comm, Nat.add_assoc] using h + have hzc : (zero.run environment).cost ≤ 17 * E + B + 10 := by + simp only [zero, Program.run, Expr.run, RationalCode.bits, width, Nat.size_zero, Nat.size_one] + omega + have hzo : outputBits (zero.run environment).output ≤ B + 3 := by + simp only [zero, Program.run, Expr.run, outputBits, List.map_cons, List.map_nil, + List.sum_cons, List.sum_nil, RationalCode.bits, width, Nat.size_zero, Nat.size_one] + omega + have hcost := branch_cost_le environment condition positive zero (3 * E) + (17 * E + B + 10) hc hpc hzc + have houtput := branch_outputBits_le environment condition positive zero (B + 3) hpo hzo + change (entryProgram.run environment).cost ≤ _ at hcost + change outputBits (entryProgram.run environment).output ≤ _ at houtput + constructor + · unfold entryCostBound + change (entryProgram.run environment).cost ≤ 20 * E + B + 20 + omega + · exact houtput + +def rowCostBound (M d : ℕ) : ℕ := + 7 * generatorExpressionBudget M + 1 + + d * (entryCostBound M + loopControlBound M + entryOutputBound M) + +def rowOutputBound (M d : ℕ) : ℕ := d * entryOutputBound M + +def variableCostBound (M d : ℕ) : ℕ := + 7 * generatorExpressionBudget M + 1 + + d * (rowCostBound M d + loopControlBound M + rowOutputBound M d) + +def variableOutputBound (M d : ℕ) : ℕ := d * rowOutputBound M d + +theorem rowProgram_bounds {M r i n s : ℕ} + (hM : 2 ≤ M) (hr : r ≤ M) (hi : i + 1 ≤ M) + (hn : n ≤ M) (hs : s ≤ M) (hd : 2 * n * s ^ 2 ≤ M) : + (rowProgram.run [r, i, n, s]).cost ≤ rowCostBound M (2 * n * s ^ 2) ∧ + outputBits (rowProgram.run [r, i, n, s]).output ≤ + rowOutputBound M (2 * n * s ^ 2) := by + have henv : ∀ a ∈ [r, i, n, s], a ≤ M := by + intro a ha + simp only [List.mem_cons, List.not_mem_nil, or_false] at ha + rcases ha with rfl | rfl | rfl | rfl <;> omega + have hv : ((dimensionExpr 2 3).run [r, i, n, s]).value = 2 * n * s ^ 2 := by + simp [dimensionExpr, Expr.run] + have hc := dimensionExpr_cost_le (environment := [r, i, n, s]) + (nr := 2) (sr := 3) hM (by simp) henv (by omega) (by omega) rfl rfl hn hs + have hb : ∀ q < ((dimensionExpr 2 3).run [r, i, n, s]).value, + (entryProgram.run (q :: [r, i, n, s])).cost ≤ entryCostBound M ∧ + outputBits (entryProgram.run (q :: [r, i, n, s])).output ≤ entryOutputBound M := by + intro q hq + rw [hv] at hq + exact entryProgram_bounds hM (by omega) hr hi hn hs + constructor + · have h := loop_cost_le [r, i, n, s] (dimensionExpr 2 3) entryProgram M + (7 * generatorExpressionBudget M) (entryCostBound M) (entryOutputBound M) + (by rw [hv]; exact hd) hc hb + simpa only [rowProgram, rowCostBound, hv] using h + · have h := loop_outputBits_le [r, i, n, s] (dimensionExpr 2 3) entryProgram + (entryOutputBound M) (fun q hq => (hb q hq).2) + simpa only [rowProgram, rowOutputBound, hv] using h + +theorem variableProgram_bounds {M i n s : ℕ} + (hM : 2 ≤ M) (hi : i + 1 ≤ M) + (hn : n ≤ M) (hs : s ≤ M) (hd : 2 * n * s ^ 2 ≤ M) : + (variableProgram.run [i, n, s]).cost ≤ variableCostBound M (2 * n * s ^ 2) ∧ + outputBits (variableProgram.run [i, n, s]).output ≤ + variableOutputBound M (2 * n * s ^ 2) := by + have henv : ∀ a ∈ [i, n, s], a ≤ M := by + intro a ha + simp only [List.mem_cons, List.not_mem_nil, or_false] at ha + rcases ha with rfl | rfl | rfl <;> omega + have hv : ((dimensionExpr 1 2).run [i, n, s]).value = 2 * n * s ^ 2 := by + simp [dimensionExpr, Expr.run] + have hc := dimensionExpr_cost_le (environment := [i, n, s]) + (nr := 1) (sr := 2) hM (by simp) henv (by omega) (by omega) rfl rfl hn hs + have hb : ∀ r < ((dimensionExpr 1 2).run [i, n, s]).value, + (rowProgram.run (r :: [i, n, s])).cost ≤ rowCostBound M (2 * n * s ^ 2) ∧ + outputBits (rowProgram.run (r :: [i, n, s])).output ≤ + rowOutputBound M (2 * n * s ^ 2) := by + intro r hr + rw [hv] at hr + exact rowProgram_bounds hM (by omega) hi hn hs hd + constructor + · have h := loop_cost_le [i, n, s] (dimensionExpr 1 2) rowProgram M + (7 * generatorExpressionBudget M) (rowCostBound M (2 * n * s ^ 2)) + (rowOutputBound M (2 * n * s ^ 2)) (by rw [hv]; exact hd) hc hb + simpa only [variableProgram, variableCostBound, hv] using h + · have h := loop_outputBits_le [i, n, s] (dimensionExpr 1 2) rowProgram + (rowOutputBound M (2 * n * s ^ 2)) (fun r hr => (hb r hr).2) + simpa only [variableProgram, variableOutputBound, hv] using h + +def generatorCostBound (n s : ℕ) : ℕ := + let d := 2 * n * s ^ 2 + let M := n + s + d + 3 + 2 * (M + 1) + 7 * generatorExpressionBudget M + 15 + + (registerReadBound M + 1 + + n * (variableCostBound M d + loopControlBound M + variableOutputBound M d)) + 1 + +theorem generate_cost_le (n s : ℕ) : (generate n s).cost ≤ generatorCostBound n s := by + let d := 2 * n * s ^ 2 + let M := n + s + d + 3 + let E := generatorExpressionBudget M + let B := intermediateWidthBound M + let R := registerReadBound M + let C := R + 1 + n * (variableCostBound M d + loopControlBound M + variableOutputBound M d) + have hM : 2 ≤ M := by unfold M; omega + have hn : n ≤ M := by unfold M; omega + have hs : s ≤ M := by unfold M; omega + have hd : d ≤ M := by unfold M; omega + have hB : 4 ≤ B := by unfold B intermediateWidthBound; omega + have henv : ∀ a ∈ [n, s], a ≤ M := by + intro a ha + simp only [List.mem_cons, List.not_mem_nil, or_false] at ha + rcases ha with rfl | rfl <;> assumption + have hnr := Expr.bounded_read (environment := [n, s]) (index := 0) + (by simp) (by omega) henv + have hsr := Expr.bounded_read (environment := [n, s]) (index := 1) + (by simp) (by omega) henv + have h1 := Expr.bounded_literal (environment := [n, s]) (a := 1) (by omega : 1 ≤ M) + have hwif (a : ℕ) : width (if a = 1 then 1 else 0) ≤ 2 := by + split <;> decide + have hnt : (Expr.equal (.read 0) (.literal 1)).Bounded [n, s] M B R := by + refine ⟨?_, hnr, h1⟩ + have h := (hwif n).trans (by omega : 2 ≤ B) + simpa [Expr.run] using h + have hst : (Expr.equal (.read 1) (.literal 1)).Bounded [n, s] M B R := by + refine ⟨?_, hsr, h1⟩ + have h := (hwif s).trans (by omega : 2 ≤ B) + simpa [Expr.run] using h + let test : Expr := .mul (.equal (.read 0) (.literal 1)) (.equal (.read 1) (.literal 1)) + have ht : test.Bounded [n, s] M B R := by + refine ⟨?_, hnt, hst⟩ + have h := width_mul_le (if n = 1 then 1 else 0) (if s = 1 then 1 else 0) + have hnv := hwif n + have hsv := hwif s + have hw : width ((if n = 1 then 1 else 0) * (if s = 1 then 1 else 0)) ≤ B := by omega + simpa [test, Expr.run] using hw + have htc : (test.run [n, s]).cost ≤ 7 * E := by + have h := Expr.cost_le_nodes_budget [n, s] M B R test ht + simpa [test, Expr.nodes, E, B, R, generatorExpressionBudget] using h + have hloop : ((Program.loop (.read 0) variableProgram).run [n, s]).cost ≤ C := by + have hc : ((Expr.read 0).run [n, s]).cost ≤ R := hnr.2 + have hb : ∀ i < ((Expr.read 0).run [n, s]).value, + (variableProgram.run (i :: [n, s])).cost ≤ variableCostBound M d ∧ + outputBits (variableProgram.run (i :: [n, s])).output ≤ variableOutputBound M d := by + intro i hi + change i < n at hi + exact variableProgram_bounds hM (by omega) hn hs hd + have h := loop_cost_le [n, s] (.read 0) variableProgram M R + (variableCostBound M d) (variableOutputBound M d) hn hc hb + exact h + have hexception : ((Program.emit (.literal 0) (.literal 1) (.literal 1)).run [n, s]).cost ≤ 15 + C := by + simp only [Program.run, Expr.run, RationalCode.bits, width, Nat.size_zero, Nat.size_one] + omega + have hbranch := branch_cost_le [n, s] test + (.emit (.literal 0) (.literal 1) (.literal 1)) (.loop (.read 0) variableProgram) + (7 * E) (15 + C) htc hexception (by omega) + change (generatorProgram.run [n, s]).cost ≤ _ at hbranch + have hinput : listBits [n, s] ≤ 2 * (M + 1) := by + have hnw := width_le_of_le hn + have hsw := width_le_of_le hs + simp only [listBits, List.map_cons, List.map_nil, List.sum_cons, List.sum_nil, Nat.add_zero] + omega + change listBits [n, s] + (generatorProgram.run [n, s]).cost ≤ _ + change _ ≤ 2 * (M + 1) + 7 * E + 15 + C + 1 + omega + +end NCHitting + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/Hitting.lean b/lean/OAI/Algebra/FormulaHitting/Hitting.lean new file mode 100644 index 0000000000000000000000000000000000000000..e1edb8aac4b6401f5d845f1c25e2214d7e2ed7b5 --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/Hitting.lean @@ -0,0 +1,100 @@ +import OAI.Algebra.FormulaHitting.Multiplicity +import OAI.Algebra.FormulaHitting.DimensionBound +import OAI.Algebra.FormulaHitting.SystemOutput +import OAI.Algebra.FormulaHitting.SeriesFaithfulness +import OAI.Algebra.FormulaHitting.JetMatrix + +namespace OAI + +noncomputable section +namespace NCHitting + +open Matrix PowerSeries + +variable {F : Type*} [Field F] [CharZero F] + +omit [CharZero F] in +theorem AcyclicRepresentation.scalarOutput_eq_contract {n : ℕ} + (R : AcyclicRepresentation F n) : + systemScalarOutput R.u R.v R.fundamentalMatrix = + R.contract R.fundamentalMatrix := by + simp only [systemScalarOutput, AcyclicRepresentation.contract, + LinearMap.coe_mk, AddHom.coe_mk, dotProduct, Matrix.mulVec, + Finset.sum_mul, Finset.mul_sum] + rw [Finset.sum_comm] + simp only [mul_assoc] + +theorem Formula.series_order_lt {n : ℕ} (f : Formula F n) (hn : 0 < n) + (hf : f.coeff ≠ 0) : + f.series.order.toNat < + (n-1) * (Fintype.card f.representation.State).choose 2 + + Fintype.card f.representation.State := by + let R := f.representation + have hq : AcyclicRepresentation.denominator (F := F) n ≠ 0 := by + intro hz + have he := AcyclicRepresentation.denominator_eval_zero_ne (F := F) (n := n) + exact he (by rw [hz, Polynomial.eval_zero]) + have ho : systemScalarOutput R.u R.v R.fundamentalMatrix = f.series := + R.scalarOutput_eq_contract.trans f.system_output_eq_series + have hbound := system_multiplicity n hn + (AcyclicRepresentation.denominator (F := F) n) R.systemNumerator R.u R.v + R.fundamentalMatrix (AcyclicRepresentation.denominator_degree (F := F) (n := n)) + hq R.systemNumerator_degree + (R.fundamentalMatrix_isUnit f.representation_card_pos) + R.fundamentalMatrix_polynomial_system + (by rw [ho]; exact f.series_ne_zero hf) + rwa [ho] at hbound + +theorem Formula.eval_generator_one_ne_zero (f : Formula F 1) + (hs : f.size ≤ 1) (hf : f.coeff ≠ 0) : + f.eval (Matrix.scalar (Fin (dimension 1 1))) + (fun i r q => (generator 1 1 i r q : F)) ≠ 0 := by + let r : Fin (dimension 1 1) := ⟨0, by decide⟩ + rcases (Formula.size_le_one_iff f).mp hs with ⟨a, rfl⟩ | ⟨i, rfl⟩ + · intro hz + have ha : a = 0 := by + have he := congrFun (congrFun hz r) r + simpa [Formula.eval, Matrix.scalar_apply] using he + apply hf + funext w + simp [Formula.coeff, ha] + · intro hz + have he := congrFun (congrFun hz r) r + simp [Formula.eval, generator_one] at he + +theorem Formula.eval_generator_ne_zero {n s : ℕ} (f : Formula F n) + (hn : 0 < n) (hs : 0 < s) (hsize : f.size ≤ s) (hf : f.coeff ≠ 0) : + f.eval (Matrix.scalar (Fin (dimension n s))) + (fun i r q => (generator n s i r q : F)) ≠ 0 := by + by_cases he : n = 1 ∧ s = 1 + · rcases he with ⟨rfl, rfl⟩ + exact f.eval_generator_one_ne_zero hsize hf + · have hns : 2 ≤ n*s := by + have hnle : n ≤ n*s := by simpa using Nat.mul_le_mul_left n hs + have hsle : s ≤ n*s := by simpa using Nat.mul_le_mul_right s hn + omega + have hm : Fintype.card f.representation.State ≤ 2*s := + f.representation_card_le.trans (Nat.mul_le_mul_left 2 hsize) + have hbound : f.series.order.toNat < dimension n s := by + rw [dimension_eq hns] + exact (f.series_order_lt hn hf).trans_le (multiplicity_dimension_bound hn hs hm) + apply f.eval_generator_ne_zero_of_jet_series_ne_zero hns + apply jet_ne_zero_of_order_lt + rw [← PowerSeries.coe_toNat_order (f.series_ne_zero hf), ENat.natCast_lt_natCast] + exact hbound + +theorem universal_hitting (n s : ℕ) (hn : 1 ≤ n) (hs : 1 ≤ s) + (F : Type*) [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 + apply f.eval_generator_ne_zero hn hs hsize + intro hz + obtain ⟨w, hw⟩ := hf + exact hw (congrFun hz w) + +end NCHitting + +end + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/Independence.lean b/lean/OAI/Algebra/FormulaHitting/Independence.lean new file mode 100644 index 0000000000000000000000000000000000000000..25da5658e23b25bf5d5c78489732df617e88237a --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/Independence.lean @@ -0,0 +1,233 @@ +import Mathlib.RingTheory.PowerSeries.Derivative +import Mathlib.RingTheory.PowerSeries.Order +import Mathlib.RingTheory.Polynomial.Wronskian +import Mathlib.RingTheory.PrincipalIdealDomain +import Mathlib.Algebra.Polynomial.FieldDivision +import Mathlib.Tactic.Ring + +namespace OAI + +noncomputable section +open Polynomial +namespace NCHitting + +variable {F : Type*} [Field F] [CharZero F] + +omit [CharZero F] in +theorem wronskian_mul_common (g p q : F[X]) : + Polynomial.wronskian (g*p) (g*q) = g^2 * Polynomial.wronskian p q := by + simp only [Polynomial.wronskian, Polynomial.derivative_mul] + ring + +theorem eq_smul_of_wronskian_eq_zero (p q : F[X]) (hp : p ≠ 0) + (hw : Polynomial.wronskian p q = 0) : ∃ c : F, q = c • p := by + classical + let : GCDMonoid F[X] := IsBezout.toGCDDomain _ + obtain ⟨a, b, ha, hb, hab⟩ := extract_gcd p q + let g := gcd p q + change p = g * a at ha + change q = g * b at hb + have hg : g ≠ 0 := by + intro h + apply hp + simpa [h] using ha + have ha0 : a ≠ 0 := by + intro h + apply hp + simpa [h] using ha + have hwab : Polynomial.wronskian a b = 0 := by + have hfactor : Polynomial.wronskian p q = g^2 * Polynomial.wronskian a b := + (congrArg₂ Polynomial.wronskian ha hb).trans (wronskian_mul_common g a b) + rw [hfactor] at hw + exact (mul_eq_zero.mp hw).resolve_left (pow_ne_zero _ hg) + have hcop : IsCoprime a b := (gcd_isUnit_iff a b).mp hab + obtain ⟨had, hbd⟩ := hcop.wronskian_eq_zero_iff.mp hwab + have hac : a = C (a.coeff 0) := Polynomial.eq_C_of_derivative_eq_zero had + have hbc : b = C (b.coeff 0) := Polynomial.eq_C_of_derivative_eq_zero hbd + have hac0 : a.coeff 0 ≠ 0 := by + intro h + apply ha0 + simpa [h] using hac + refine ⟨b.coeff 0 / a.coeff 0, ?_⟩ + rw [Polynomial.smul_eq_C_mul] + calc + q = g * C (b.coeff 0) := hb.trans (congrArg (g * ·) hbc) + _ = C (b.coeff 0 / a.coeff 0) * (g * C (a.coeff 0)) := by + rw [mul_left_comm, ← C_mul, div_mul_cancel₀ _ hac0] + _ = C (b.coeff 0 / a.coeff 0) * p := + congrArg (C (b.coeff 0 / a.coeff 0) * ·) (ha.trans (congrArg (g * ·) hac)).symm + +section FormalResidue +open PowerSeries + +theorem coeff_X_mul_derivative (v : PowerSeries F) (k : ℕ) : + PowerSeries.coeff k (PowerSeries.X * PowerSeries.derivative (R := F) v) = + (k : F) * PowerSeries.coeff k v := by + cases k with + | zero => simp + | succ k => + have hs := PowerSeries.coeff_X_pow_mul (PowerSeries.derivative (R := F) v) 1 k + simp only [pow_one] at hs + rw [hs, PowerSeries.coeff_derivative] + simp only [Nat.cast_add, Nat.cast_one] + ring + +theorem X_mul_derivative_X_pow (k : ℕ) : + PowerSeries.X * PowerSeries.derivative (R := F) ((PowerSeries.X : PowerSeries F)^k) = + PowerSeries.C (k : F) * PowerSeries.X^k := by + ext r + rw [coeff_X_mul_derivative, PowerSeries.coeff_C_mul, PowerSeries.coeff_X_pow] + split_ifs with hr + · subst r; rfl + · simp + +private theorem formal_wronskian_factor (A v Q S : PowerSeries F) (k : ℕ) : + (PowerSeries.X * Q) * + ((PowerSeries.X^k * A) * PowerSeries.derivative (R := F) (A*v) - + PowerSeries.derivative (R := F) (PowerSeries.X^k * A) * (A*v)) + + (PowerSeries.X^k * A)^2 * S = + PowerSeries.X^k * A^2 * + (Q * (PowerSeries.X * PowerSeries.derivative (R := F) v - PowerSeries.C (k : F) * v) + + PowerSeries.X^k * S) := by + simp only [Derivation.leibniz, smul_eq_mul] + calc + _ = PowerSeries.X^k * A^2 * (Q * (PowerSeries.X * PowerSeries.derivative (R := F) v) + + PowerSeries.X^k * S) - + (PowerSeries.X * PowerSeries.derivative (R := F) (PowerSeries.X^k)) * A^2 * Q * v := by + ring + _ = _ := by rw [X_mul_derivative_X_pow]; ring + +theorem formal_residue_obstruction (p0 p Q S : PowerSeries F) + (hp0 : p0 ≠ 0) (hQ : PowerSeries.constantCoeff Q ≠ 0) + (h : (PowerSeries.X * Q) * + (p0 * PowerSeries.derivative (R := F) p - PowerSeries.derivative (R := F) p0 * p) + + p0^2 * S = 0) : PowerSeries.constantCoeff S = 0 := by + let k := p0.order.toNat + let A := p0.divXPowOrder + let v := A⁻¹ * p + have hA : PowerSeries.constantCoeff A ≠ 0 := by + exact mt PowerSeries.constantCoeff_divXPowOrder_eq_zero_iff.mp hp0 + have hA0 : A ≠ 0 := by + intro he + exact hA (by simp [he]) + have hpa : PowerSeries.X^k * A = p0 := PowerSeries.X_pow_order_mul_divXPowOrder + have hav : A*v = p := by + dsimp [v] + rw [← mul_assoc, MvPowerSeries.mul_inv_cancel A hA, one_mul] + have hf : PowerSeries.X^k * A^2 * + (Q * (PowerSeries.X * PowerSeries.derivative (R := F) v - PowerSeries.C (k : F) * v) + + PowerSeries.X^k * S) = 0 := by + rw [← formal_wronskian_factor] + simpa only [hpa, hav] using h + have hn : PowerSeries.X^k * A^2 ≠ 0 := + mul_ne_zero (pow_ne_zero _ PowerSeries.X_ne_zero) (pow_ne_zero _ hA0) + have he := (mul_eq_zero.mp hf).resolve_left hn + have he' : + (PowerSeries.X * PowerSeries.derivative (R := F) v - PowerSeries.C (k : F) * v) + + PowerSeries.X^k * (Q⁻¹*S) = 0 := by + calc + _ = Q⁻¹ * + (Q * (PowerSeries.X * PowerSeries.derivative (R := F) v - PowerSeries.C (k : F) * v) + + PowerSeries.X^k * S) := by + simp only [mul_add, ← mul_assoc, MvPowerSeries.inv_mul_cancel Q hQ, one_mul] + ring + _ = 0 := by rw [he, mul_zero] + have hk := congrArg (PowerSeries.coeff k) he' + have heuler : PowerSeries.coeff k + (PowerSeries.X * PowerSeries.derivative (R := F) v - PowerSeries.C (k : F) * v) = 0 := by + rw [map_sub, coeff_X_mul_derivative, PowerSeries.coeff_C_mul, sub_self] + have hshift : PowerSeries.coeff k (PowerSeries.X^k * (Q⁻¹*S)) = + PowerSeries.constantCoeff (Q⁻¹*S) := by + simpa only [zero_add, PowerSeries.coeff_zero_eq_constantCoeff] using + PowerSeries.coeff_X_pow_mul (Q⁻¹*S) k 0 + rw [map_add, heuler, zero_add, hshift, map_zero] at hk + rw [map_mul] at hk + change (MvPowerSeries.constantCoeff Q⁻¹) * PowerSeries.constantCoeff S = 0 at hk + rw [MvPowerSeries.constantCoeff_inv] at hk + exact (mul_eq_zero.mp hk).resolve_left (inv_ne_zero hQ) + +theorem polynomial_residue_obstruction (a : F) (p0 p Q S : F[X]) + (hp0 : p0 ≠ 0) (hQ : Q.eval a ≠ 0) + (h : ((Polynomial.X - Polynomial.C a) * Q) * + (p0 * p.derivative - p0.derivative * p) + p0^2 * S = 0) : S.eval a = 0 := by + let shift := Polynomial.X + Polynomial.C a + have hzero : (p0.comp shift : PowerSeries F) ≠ 0 := by + simpa [shift, Polynomial.comp_X_add_C_eq_zero_iff] using hp0 + have hQzero : PowerSeries.constantCoeff (Q.comp shift : PowerSeries F) ≠ 0 := by + simpa [Polynomial.constantCoeff_coe, Polynomial.coeff_zero_eq_eval_zero, + shift, Polynomial.eval_comp] using hQ + have heq : (PowerSeries.X * (Q.comp shift : PowerSeries F)) * + ((p0.comp shift : PowerSeries F) * PowerSeries.derivative (R := F) (p.comp shift : PowerSeries F) - + PowerSeries.derivative (R := F) (p0.comp shift : PowerSeries F) * (p.comp shift : PowerSeries F)) + + (p0.comp shift : PowerSeries F)^2 * (S.comp shift : PowerSeries F) = 0 := by + have hh := congrArg (fun r : F[X] => (r.comp shift : PowerSeries F)) h + simpa [Polynomial.add_comp, Polynomial.mul_comp, Polynomial.sub_comp, Polynomial.pow_comp, + PowerSeries.derivative_coe, Polynomial.derivative_comp, shift] using hh + have hs := formal_residue_obstruction _ _ _ _ hzero hQzero heq + simpa [Polynomial.constantCoeff_coe, Polynomial.coeff_zero_eq_eval_zero, + shift, Polynomial.eval_comp] using hs + +end FormalResidue + +section DistinctPoles +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +def poleProduct (a : ι → F) : F[X] := ∏ i, (Polynomial.X - Polynomial.C (a i)) + +def puncturedPoleProduct (a : ι → F) (i : ι) : F[X] := + ∏ j ∈ Finset.univ.erase i, (Polynomial.X - Polynomial.C (a j)) + +omit [CharZero F] in +theorem poleProduct_eq (a : ι → F) (i : ι) : + poleProduct a = (Polynomial.X - Polynomial.C (a i)) * puncturedPoleProduct a i := by + exact (Finset.mul_prod_erase Finset.univ (fun j => Polynomial.X - Polynomial.C (a j)) + (Finset.mem_univ i)).symm + +omit [CharZero F] in +theorem eval_puncturedPoleProduct_self_ne_zero (a : ι → F) (ha : Function.Injective a) (i : ι) : + (puncturedPoleProduct a i).eval (a i) ≠ 0 := by + simp only [puncturedPoleProduct, Polynomial.eval_prod, Polynomial.eval_sub, + Polynomial.eval_X, Polynomial.eval_C] + apply Finset.prod_ne_zero_iff.mpr + intro j hj + apply sub_ne_zero.mpr + intro he + have hji := (Finset.mem_erase.mp hj).1 + exact hji (ha he).symm + +omit [CharZero F] in +theorem eval_puncturedPoleProduct_other (a : ι → F) (i j : ι) (hij : i ≠ j) : + (puncturedPoleProduct a j).eval (a i) = 0 := by + simp only [puncturedPoleProduct, Polynomial.eval_prod, Polynomial.eval_sub, + Polynomial.eval_X, Polynomial.eval_C] + apply Finset.prod_eq_zero (i := i) + · simp [hij] + · simp + +theorem no_polynomial_log_primitive (a : ι → F) (ha : Function.Injective a) + (p0 p : F[X]) (hp0 : p0 ≠ 0) (c : ι → F) + (h : poleProduct a * (p0 * p.derivative - p0.derivative * p) + + p0^2 * (∑ i, Polynomial.C (c i) * puncturedPoleProduct a i) = 0) : + ∀ i, c i = 0 := by + intro i + have hr := polynomial_residue_obstruction (a i) p0 p (puncturedPoleProduct a i) + (∑ j, Polynomial.C (c j) * puncturedPoleProduct a j) hp0 + (eval_puncturedPoleProduct_self_ne_zero a ha i) (by simpa [poleProduct_eq a i] using h) + have heval : (∑ j, Polynomial.C (c j) * puncturedPoleProduct a j).eval (a i) = + c i * (puncturedPoleProduct a i).eval (a i) := by + rw [Polynomial.eval_finsetSum] + simp only [Polynomial.eval_mul, Polynomial.eval_C] + apply Finset.sum_eq_single i + · intro j hj hji + simp [eval_puncturedPoleProduct_other a i j (Ne.symm hji)] + · simp + rw [heval] at hr + exact (mul_eq_zero.mp hr).resolve_right (eval_puncturedPoleProduct_self_ne_zero a ha i) + +end DistinctPoles + +end NCHitting + +end + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/JetMatrix.lean b/lean/OAI/Algebra/FormulaHitting/JetMatrix.lean new file mode 100644 index 0000000000000000000000000000000000000000..95a1736d2e3d3b94d243e287909895d77b907f4f --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/JetMatrix.lean @@ -0,0 +1,132 @@ +import OAI.Algebra.FormulaHitting.Series +import OAI.Algebra.FormulaHitting.RationalTransfer +import OAI.Algebra.FormulaHitting.Generator +import OAI.Algebra.FormulaHitting.Evaluation +import OAI.Algebra.FormulaHitting.FormulaSeries +import Mathlib.Data.Rat.Cast.Lemmas + +namespace OAI + +noncomputable section +namespace NCHitting + +open Matrix + +variable {F : Type*} [Field F] [CharZero F] + +omit [CharZero F] in +theorem jet_eq_zero_iff (d : ℕ) (a : PowerSeries F) : + jet d a = 0 ↔ ∀ r < d, PowerSeries.coeff r a = 0 := by + constructor + · intro h r hr + exact congrFun h ⟨r, hr⟩ + · intro h + ext r + exact h r.val r.isLt + +omit [CharZero F] in +theorem jet_ne_zero_of_order_lt (d : ℕ) (a : PowerSeries F) + (horder : a.order < (d : ℕ∞)) : jet d a ≠ 0 := by + intro h + exact (not_le_of_gt horder) + (PowerSeries.nat_le_order a d ((jet_eq_zero_iff d a).mp h)) + +def integrationMatrix (d i : ℕ) : Matrix (Fin d) (Fin d) F := + fun r q => (matrixEntry i r.val q.val : F) + +theorem integrationMatrix_apply (d i : ℕ) (r q : Fin d) : + integrationMatrix (F := F) d i r q = + if q.val < r.val then + (-1 : F) ^ (r.val - q.val - 1) / + ((r.val : F) * (i : F) ^ (r.val - q.val)) + else 0 := by + by_cases h : q.val < r.val <;> simp [integrationMatrix, matrixEntry, h] + +theorem jet_J (d i : ℕ) (a : PowerSeries F) : + jet d (J i a) = integrationMatrix d i *ᵥ jet d a := by + ext r + rw [jet_apply, coeff_J] + simp only [Matrix.mulVec, dotProduct, integrationMatrix_apply, jet_apply] + let term := fun q => + (if q < r.val then (-1 : F) ^ (r.val - q - 1) / + ((r.val : F) * (i : F) ^ (r.val - q)) else 0) * PowerSeries.coeff q a + change _ = ∑ q : Fin d, term q.val + rw [Fin.sum_univ_eq_sum_range term d] + calc + _ = ∑ q ∈ Finset.range r.val, term q := by + apply Finset.sum_congr rfl + intro q hq + simp only [term, ite_eq_left (Finset.mem_range.mp hq)] + _ = ∑ q ∈ Finset.range d, term q := by + apply Finset.sum_subset (Finset.range_mono (Nat.le_of_lt r.isLt)) + intro q hqd hqr + have h : ¬q < r.val := by simpa using hqr + simp [term, h] + +theorem jet_wordSeries {n : ℕ} (d : ℕ) (w : Word n) : + jet d (wordSeries (F := F) w) = + (w.map (fun i => integrationMatrix (F := F) d (i.val + 1))).prod *ᵥ + jet d (1 : PowerSeries F) := by + induction w with + | nil => simp + | cons i w ih => + rw [wordSeries_cons, jet_J, ih] + simp only [List.map_cons, List.prod_cons, Matrix.mulVec_mulVec] + +omit [CharZero F] in +theorem generator_cast_eq_integrationMatrix {n s : ℕ} (hns : 2 ≤ n * s) + (i : Fin n) : + (fun r q => (generator n s i r q : F)) = + integrationMatrix (F := F) (dimension n s) (i.val + 1) := by + ext r q + simp only [integrationMatrix, generator_entry hns] + +theorem Formula.jet_wordSum_eq_eval_mulVec {n : ℕ} (f : Formula F n) (d : ℕ) : + jet d (f.polynomial.sum fun w a => a • wordSeries (F := F) w) = + f.eval (algebraMap F (Matrix (Fin d) (Fin d) F)) + (fun i => integrationMatrix (F := F) d (i.val + 1)) *ᵥ + jet d (1 : PowerSeries F) := by + rw [Formula.eval_eq_sum] + simp only [Finsupp.sum, map_sum, map_smul, Matrix.sum_mulVec, + ← Algebra.smul_def, Matrix.smul_mulVec, jet_wordSeries] + +theorem Formula.eval_ne_zero_of_jet_wordSum_ne_zero {n : ℕ} + (f : Formula F n) (d : ℕ) + (hjet : jet d (f.polynomial.sum fun w a => a • wordSeries (F := F) w) ≠ 0) : + f.eval (algebraMap F (Matrix (Fin d) (Fin d) F)) + (fun i => integrationMatrix (F := F) d (i.val + 1)) ≠ 0 := by + intro h + apply hjet + rw [f.jet_wordSum_eq_eval_mulVec d, h, Matrix.zero_mulVec] + +theorem Formula.jet_series_eq_eval_mulVec {n : ℕ} (f : Formula F n) (d : ℕ) : + jet d f.series = + f.eval (algebraMap F (Matrix (Fin d) (Fin d) F)) + (fun i => integrationMatrix (F := F) d (i.val + 1)) *ᵥ + jet d (1 : PowerSeries F) := by + rw [f.series_eq_smul_sum, f.jet_wordSum_eq_eval_mulVec] + +theorem Formula.eval_ne_zero_of_jet_series_ne_zero {n : ℕ} (f : Formula F n) (d : ℕ) + (hjet : jet d f.series ≠ 0) : + f.eval (algebraMap F (Matrix (Fin d) (Fin d) F)) + (fun i => integrationMatrix (F := F) d (i.val + 1)) ≠ 0 := by + apply f.eval_ne_zero_of_jet_wordSum_ne_zero d + rwa [← f.series_eq_smul_sum] + +theorem Formula.eval_generator_ne_zero_of_jet_series_ne_zero {n s : ℕ} + (f : Formula F n) (hns : 2 ≤ n * s) + (hjet : jet (dimension n s) f.series ≠ 0) : + f.eval (Matrix.scalar (Fin (dimension n s))) + (fun i r q => (generator n s i r q : F)) ≠ 0 := by + have hT : (fun (i : Fin n) r q => (generator n s i r q : F)) = + (fun i => integrationMatrix (F := F) (dimension n s) (i.val + 1)) := by + funext i + exact generator_cast_eq_integrationMatrix hns i + rw [hT] + exact f.eval_ne_zero_of_jet_series_ne_zero (dimension n s) hjet + +end NCHitting + +end + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/Main.lean b/lean/OAI/Algebra/FormulaHitting/Main.lean new file mode 100644 index 0000000000000000000000000000000000000000..a86025f611fd1de2944c193e922514bc41d192ef --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/Main.lean @@ -0,0 +1,4 @@ +import OAI.Algebra.FormulaHitting.Hitting +import OAI.Algebra.FormulaHitting.RationalMinor +import OAI.Algebra.FormulaHitting.BitBounds +import OAI.Algebra.FormulaHitting.Result diff --git a/lean/OAI/Algebra/FormulaHitting/MinorFactor.lean b/lean/OAI/Algebra/FormulaHitting/MinorFactor.lean new file mode 100644 index 0000000000000000000000000000000000000000..ed23b12e3a3858737025fab71a4297d8a8eaa368 --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/MinorFactor.lean @@ -0,0 +1,44 @@ +import OAI.Algebra.FormulaHitting.Minors +import Mathlib.LinearAlgebra.Matrix.NonsingularInverse + +namespace OAI + +noncomputable section + +namespace NCHitting + +open Matrix + +variable {R : Type*} [CommRing R] [IsDomain R] +variable {K I : Type*} [Fintype K] [DecidableEq K] [Fintype I] [DecidableEq I] + +theorem exists_nonzero_divisible_minor + (Z H : Matrix K I R) (G : Matrix I I R) (D W : Matrix K K R) + (C : Matrix K I R) (E : Matrix I K R) + (hG : IsUnit G) (hD : D.det ≠ 0) (hW : W.det ≠ 0) + (hZG : Z * G = D * H) (hHC : H = W * C) (hHE : W = H * E) : + ∃ f : K → I, (Z.submatrix id f).det ≠ 0 ∧ W.det ∣ (Z.submatrix id f).det := by + classical + have hprod : Z * (G * E) = D * W := by + rw [← Matrix.mul_assoc, hZG, Matrix.mul_assoc, ← hHE] + have hprod0 : (Z * (G * E)).det ≠ 0 := by + rw [hprod, Matrix.det_mul] + exact mul_ne_zero hD hW + obtain ⟨f, hf⟩ := exists_minor_ne_zero_of_mul_det_ne_zero Z (G * E) hprod0 + refine ⟨f, hf, ?_⟩ + have hGdet : IsUnit G.det := (Matrix.isUnit_iff_isUnit_det G).mp hG + have hZ : Z = (D * W) * (C * G⁻¹) := by + calc + Z = (Z * G) * G⁻¹ := (Matrix.mul_nonsing_inv_cancel_right G Z hGdet).symm + _ = (D * W) * (C * G⁻¹) := by rw [hZG, hHC]; simp only [Matrix.mul_assoc] + have hsub : Z.submatrix id f = (D * W) * ((C * G⁻¹).submatrix id f) := by + rw [hZ] + rfl + rw [hsub, Matrix.det_mul, Matrix.det_mul] + exact dvd_mul_of_dvd_left (dvd_mul_left _ _) _ + +end NCHitting + +end + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/Minors.lean b/lean/OAI/Algebra/FormulaHitting/Minors.lean new file mode 100644 index 0000000000000000000000000000000000000000..8e371ee734229dac0c9ccb9224e64d62a267a2cc --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/Minors.lean @@ -0,0 +1,75 @@ +import Mathlib.LinearAlgebra.Matrix.Determinant.Basic +import Mathlib.Algebra.Polynomial.BigOperators + +namespace OAI + +noncomputable section + +namespace NCHitting + +open Matrix Finset Polynomial + +variable {R : Type*} [CommRing R] +variable {I J : Type*} [Fintype I] [DecidableEq I] [Fintype J] + +theorem det_rectangular_mul (A : Matrix I J R) (B : Matrix J I R) : + (A * B).det = ∑ f : I → J, (A.submatrix id f).det * ∏ i, B (f i) i := by + classical + calc + (A * B).det = ∑ f : I → J, ∑ σ : Equiv.Perm I, + (Equiv.Perm.sign σ : R) * ∏ i, A (σ i) (f i) * B (f i) i := by + simp only [Matrix.det_apply', Matrix.mul_apply, Finset.prod_univ_sum, + Finset.mul_sum, Fintype.piFinset_univ] + rw [Finset.sum_comm] + _ = _ := by + apply Finset.sum_congr rfl + intro f _ + simp only [Matrix.det_apply', Matrix.submatrix_apply, id_eq, + Finset.prod_mul_distrib, Finset.sum_mul, mul_assoc] + +theorem dvd_det_rectangular_mul (A : Matrix I J R) (B : Matrix J I R) + (p : R) (h : ∀ f : I → J, p ∣ (A.submatrix id f).det) : + p ∣ (A * B).det := by + rw [det_rectangular_mul] + exact Finset.dvd_sum (fun f _ => dvd_mul_of_dvd_left (h f) _) + +theorem exists_minor_ne_zero_of_mul_det_ne_zero (A : Matrix I J R) + (B : Matrix J I R) (h : (A * B).det ≠ 0) : + ∃ f : I → J, (A.submatrix id f).det ≠ 0 := by + classical + by_contra hn + push Not at hn + apply h + simp [det_rectangular_mul, hn] + +theorem dvd_det_of_column_dvd (A : Matrix I I R) (c : I) (p : R) + (h : ∀ i, p ∣ A i c) : p ∣ A.det := by + classical + rw [Matrix.det_apply'] + apply Finset.dvd_sum + intro σ _ + apply dvd_mul_of_dvd_right + exact (h (σ c)).trans (Finset.dvd_prod_of_mem (fun i => A (σ i) i) (Finset.mem_univ c)) + +theorem natDegree_det_le_sum {F : Type*} [Field F] + (A : Matrix I I F[X]) (d : I → ℕ) + (h : ∀ i j, (A i j).natDegree ≤ d i) : + A.det.natDegree ≤ ∑ i, d i := by + classical + rw [Matrix.det_apply'] + apply Polynomial.natDegree_sum_le_of_forall_le + intro σ _ + apply (Polynomial.natDegree_mul_le).trans + have hsign : (↑(Equiv.Perm.sign σ) : F[X]).natDegree = 0 := by + exact Polynomial.natDegree_intCast _ + rw [hsign, zero_add] + calc + (∏ i, A (σ i) i).natDegree ≤ ∑ i, d (σ i) := + (Polynomial.natDegree_prod_le Finset.univ (fun i => A (σ i) i)).trans (Finset.sum_le_sum (fun i _ => h (σ i) i)) + _ = ∑ i, d i := Equiv.sum_comp σ d + +end NCHitting + +end + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/Model.lean b/lean/OAI/Algebra/FormulaHitting/Model.lean new file mode 100644 index 0000000000000000000000000000000000000000..3bfc473e9d7b79ecd3a8e0adefab9f8e3e5d4b51 --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/Model.lean @@ -0,0 +1,57 @@ +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 + +end NCHitting + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/Multiplicity.lean b/lean/OAI/Algebra/FormulaHitting/Multiplicity.lean new file mode 100644 index 0000000000000000000000000000000000000000..ec10a8cacf5d7b6b5ee9f6dad74fa274e160580a --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/Multiplicity.lean @@ -0,0 +1,176 @@ +import OAI.Algebra.FormulaHitting.ScaledDerivatives +import OAI.Algebra.FormulaHitting.WronskianBound +import OAI.Algebra.FormulaHitting.MinorFactor +import Mathlib.RingTheory.PowerSeries.NoZeroDivisors +import Mathlib.Data.Nat.Choose.Basic +import Mathlib.Algebra.BigOperators.Intervals + +namespace OAI + +noncomputable section + +namespace NCHitting + +open PowerSeries Polynomial Matrix Submodule + +variable {F : Type*} [Field F] [CharZero F] + +def derivativeMatrix {I : Type*} (k : ℕ) (h : I → PowerSeries F) : + Matrix (Fin k) I (PowerSeries F) := fun j t => derivativeIter j.val (h t) + +omit [CharZero F] in +theorem derivativeMatrix_combination {I J : Type*} [Fintype I] + (k : ℕ) (h : I → PowerSeries F) (C : Matrix I J F) : + derivativeMatrix k (fun l => ∑ t : I, C t l • h t) = + derivativeMatrix k h * C.map PowerSeries.C := by + classical + funext j l + change derivativeIter j.val (∑ t : I, C t l • h t) = + ∑ t : I, derivativeIter j.val (h t) * PowerSeries.C (C t l) + rw [derivativeIter_sum] + simp only [derivativeIter_smul] + simp only [PowerSeries.smul_eq_C_mul] + apply Finset.sum_congr rfl + intro t _ + exact mul_comm _ _ + +omit [CharZero F] in +theorem order_le_natDegree_of_dvd (f : PowerSeries F) (p : F[X]) + (hp : p ≠ 0) (h : f ∣ (p : PowerSeries F)) : f.order.toNat ≤ p.natDegree := by + by_contra hn + have hd : PowerSeries.X^f.order.toNat ∣ (p : PowerSeries F) := + PowerSeries.X_pow_order_dvd.trans h + have hz := (PowerSeries.X_pow_dvd_iff.mp hd) p.natDegree (by omega) + exact (Polynomial.leadingCoeff_ne_zero.mpr hp) (by simpa using hz) + +theorem sum_fin_eq_choose (k : ℕ) : (∑ j : Fin k, j.val) = k.choose 2 := by + calc + (∑ j : Fin k, j.val) = ∑ j ∈ Finset.range k, j := + Fin.sum_univ_eq_sum_range (fun j => j) k + _ = k.choose 2 := by rw [Finset.sum_range_id, Nat.choose_two_right] + +variable {I : Type*} [Fintype I] [DecidableEq I] + +def systemScalarOutput (u v : I → F) (G : Matrix I I (PowerSeries F)) : + PowerSeries F := ∑ l : I, (∑ t : I, PowerSeries.C (u t) * G t l) * PowerSeries.C (v l) + +theorem system_multiplicity (n : ℕ) (hn : 0 < n) + (q : F[X]) (P : Matrix I I F[X]) (u v : I → F) + (G : Matrix I I (PowerSeries F)) + (hq : q.natDegree ≤ n) (hqn : q ≠ 0) + (hP : ∀ t l, (P t l).natDegree ≤ n-1) (hG : IsUnit G) + (hD : ∀ t l, (q : PowerSeries F) * PowerSeries.derivative (R := F) (G t l) = + ∑ a : I, (P t a : PowerSeries F) * G a l) + (hy : systemScalarOutput u v G ≠ 0) : + (systemScalarOutput u v G).order.toNat < + (n-1) * (Fintype.card I).choose 2 + Fintype.card I := by + classical + let h : I → PowerSeries F := fun l => ∑ t : I, PowerSeries.C (u t) * G t l + let V := Submodule.span F (Set.range h) + let : FiniteDimensional F V := FiniteDimensional.span_of_finite F (Set.finite_range h) + obtain ⟨k, b, a, hbi, hspan, ha, hlead, hzero⟩ := hasOrderBasis V + have hbn : wronskian b ≠ 0 := (wronskian_order_sum b a ha hlead hzero).1 + have hk : k ≤ Fintype.card I := by + have hkdim : Module.finrank F (Submodule.span F (Set.range b)) = k := by + simpa using finrank_span_eq_card hbi + rw [hspan] at hkdim + rw [← hkdim] + exact finrank_range_le_card h + have hhmem : ∀ l, h l ∈ Submodule.span F (Set.range b) := by + intro l + rw [hspan] + exact Submodule.subset_span ⟨l, rfl⟩ + have hbmem : ∀ l, b l ∈ Submodule.span F (Set.range h) := by + intro l + change b l ∈ V + rw [← hspan] + exact Submodule.subset_span ⟨l, rfl⟩ + have hc : ∀ l : I, ∃ c : Fin k → F, ∑ j : Fin k, c j • b j = h l := by + intro l + exact (Submodule.mem_span_range_iff_exists_fun F).mp (hhmem l) + have he : ∀ l : Fin k, ∃ c : I → F, ∑ j : I, c j • h j = b l := by + intro l + exact (Submodule.mem_span_range_iff_exists_fun F).mp (hbmem l) + choose c hc using hc + choose e he using he + let H := derivativeMatrix k h + let W := wronskianMatrix b + let C : Matrix (Fin k) I (PowerSeries F) := + fun j l => PowerSeries.C (c l j) + let E : Matrix I (Fin k) (PowerSeries F) := + fun j l => PowerSeries.C (e l j) + let D : Matrix (Fin k) (Fin k) (PowerSeries F) := + Matrix.diagonal (fun j => (q : PowerSeries F)^j.val) + let Zp : Matrix (Fin k) I F[X] := fun j t => numeratorRow q P u j.val t + let Z : Matrix (Fin k) I (PowerSeries F) := + fun j t => (Zp j t : PowerSeries F) + have hHC : H = W * C := by + funext j l + change derivativeIter j.val (h l) = + ∑ t : Fin k, derivativeIter j.val (b t) * PowerSeries.C (c l t) + rw [← hc l, derivativeIter_sum] + simp only [derivativeIter_smul] + simp only [PowerSeries.smul_eq_C_mul] + apply Finset.sum_congr rfl + intro t _ + exact mul_comm _ _ + have hHE : W = H * E := by + funext j l + change derivativeIter j.val (b l) = + ∑ t : I, derivativeIter j.val (h t) * PowerSeries.C (e l t) + rw [← he l, derivativeIter_sum] + simp only [derivativeIter_smul] + simp only [PowerSeries.smul_eq_C_mul] + apply Finset.sum_congr rfl + intro t _ + exact mul_comm _ _ + have hZG : Z * G = D * H := by + funext j l + rw [Matrix.diagonal_mul] + exact (scaled_derivative_row q P u G hD j.val l).symm + have hDn : D.det ≠ 0 := by + rw [Matrix.det_diagonal] + apply Finset.prod_ne_zero_iff.mpr + intro j _ + exact pow_ne_zero _ (Polynomial.coe_eq_zero_iff.not.mpr hqn) + obtain ⟨f, hfn, hdiv⟩ := exists_nonzero_divisible_minor Z H G D W C E hG hDn hbn hZG hHC hHE + let p : F[X] := (Zp.submatrix id f).det + have hpcoe : (p : PowerSeries F) = (Z.submatrix id f).det := by + exact RingHom.map_det Polynomial.coeToPowerSeries.ringHom (Zp.submatrix id f) + have hpn : p ≠ 0 := by + intro hp + apply hfn + rw [← hpcoe, hp, Polynomial.coe_zero] + have hdegree : p.natDegree ≤ (n-1) * k.choose 2 := by + calc + p.natDegree ≤ ∑ j : Fin k, j.val * (n-1) := by + apply natDegree_det_le_sum + intro j l + exact numeratorRow_degree hn q P u hq hP j.val (f l) + _ = (n-1) * k.choose 2 := by + rw [← Finset.sum_mul, sum_fin_eq_choose, mul_comm] + have horder : (wronskian b).order.toNat ≤ (n-1) * k.choose 2 := by + apply (order_le_natDegree_of_dvd (wronskian b) p hpn ?_).trans hdegree + rwa [hpcoe] + have hymem : systemScalarOutput u v G ∈ Submodule.span F (Set.range b) := by + apply Submodule.sum_mem + intro l _ + change h l * PowerSeries.C (v l) ∈ _ + rw [mul_comm, ← PowerSeries.smul_eq_C_mul] + exact Submodule.smul_mem _ _ (hhmem l) + have hybound := order_le_wronskian_add b hbn (systemScalarOutput u v G) hy hymem + have hkpos : 0 < k := by + by_contra hn + have hk0 : k = 0 := by omega + subst k + have : systemScalarOutput u v G = 0 := by simpa using hymem + exact hy this + have hchoose : k.choose 2 ≤ (Fintype.card I).choose 2 := Nat.choose_le_choose 2 hk + have hmul := Nat.mul_le_mul_left (n-1) hchoose + omega + +end NCHitting + +end + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/NumeratorRows.lean b/lean/OAI/Algebra/FormulaHitting/NumeratorRows.lean new file mode 100644 index 0000000000000000000000000000000000000000..9211800e51c9908c3b31d6c108d66d93299ad5f4 --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/NumeratorRows.lean @@ -0,0 +1,69 @@ +import Mathlib.Algebra.Polynomial.Derivative +import Mathlib.Algebra.Polynomial.BigOperators +import Mathlib.Data.Matrix.Basic +import Lean.Elab.Tactic.Omega + +namespace OAI + +noncomputable section + +namespace NCHitting + +open Polynomial + +variable {F : Type*} [Field F] + +def numeratorRow {I : Type*} [Fintype I] (q : F[X]) (P : Matrix I I F[X]) + (u : I → F) : ℕ → I → F[X] + | 0, l => C (u l) + | j + 1, l => q * (numeratorRow q P u j l).derivative - + C (j : F) * q.derivative * numeratorRow q P u j l + + ∑ t : I, numeratorRow q P u j t * P t l + +private theorem degree_q_derivative {q p : F[X]} {n b : ℕ} + (hn : 0 < n) (hq : q.natDegree ≤ n) (hp : p.natDegree ≤ b) : + (q * p.derivative).natDegree ≤ b + (n-1) := by + by_cases hzero : p.natDegree = 0 + · simp [Polynomial.derivative_of_natDegree_zero hzero] + · have hb : 0 < b := by omega + have hd := p.natDegree_derivative_le + have hm : (q * p.derivative).natDegree ≤ q.natDegree + p.derivative.natDegree := + Polynomial.natDegree_mul_le + omega + +theorem numeratorRow_degree {I : Type*} [Fintype I] {n : ℕ} (hn : 0 < n) + (q : F[X]) (P : Matrix I I F[X]) (u : I → F) + (hq : q.natDegree ≤ n) (hP : ∀ t l, (P t l).natDegree ≤ n-1) + (j : ℕ) (l : I) : + (numeratorRow q P u j l).natDegree ≤ j * (n-1) := by + induction j generalizing l with + | zero => simp [numeratorRow] + | succ j ih => + have ihall : ∀ l, (numeratorRow q P u j l).natDegree ≤ j * (n-1) := by + intro l' + exact ih l' + have ha := degree_q_derivative hn hq (ihall l) + have hb : (C (j : F) * q.derivative * numeratorRow q P u j l).natDegree ≤ + j * (n-1) + (n-1) := by + have hq' : q.derivative.natDegree ≤ n-1 := + q.natDegree_derivative_le.trans (Nat.sub_le_sub_right hq 1) + have hC := Polynomial.natDegree_C_mul_le (j : F) q.derivative + have hmul : (C (j : F) * q.derivative * numeratorRow q P u j l).natDegree ≤ + (C (j : F) * q.derivative).natDegree + (numeratorRow q P u j l).natDegree := + Polynomial.natDegree_mul_le + have hp := ihall l + omega + have hc : (∑ t : I, numeratorRow q P u j t * P t l).natDegree ≤ + j * (n-1) + (n-1) := by + apply Polynomial.natDegree_sum_le_of_forall_le + intro t _ + exact Polynomial.natDegree_mul_le.trans (Nat.add_le_add (ihall t) (hP t l)) + rw [numeratorRow, Nat.add_mul, one_mul] + apply Polynomial.natDegree_add_le_of_degree_le _ hc + exact (Polynomial.natDegree_sub_le _ _).trans (max_le ha hb) + +end NCHitting + +end + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/OrderBasis.lean b/lean/OAI/Algebra/FormulaHitting/OrderBasis.lean new file mode 100644 index 0000000000000000000000000000000000000000..69bcda690c7bc59e4a08fdc4d54327a2dc088f41 --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/OrderBasis.lean @@ -0,0 +1,157 @@ +import OAI.Algebra.FormulaHitting.Wronskian +import Mathlib.LinearAlgebra.FiniteDimensional.Lemmas +import Mathlib.LinearAlgebra.LinearIndependent.Lemmas + +namespace OAI + +noncomputable section + +namespace NCHitting + +open PowerSeries Submodule + +variable {F : Type*} [Field F] [CharZero F] + +def HasOrderBasis (V : Submodule F (PowerSeries F)) : Prop := + ∃ (k : ℕ) (b : Fin k → PowerSeries F) (a : Fin k → ℕ), + LinearIndependent F b ∧ Submodule.span F (Set.range b) = V ∧ + Function.Injective a ∧ + (∀ i, PowerSeries.coeff (a i) (b i) ≠ 0) ∧ + (∀ i r, r < a i → PowerSeries.coeff r (b i) = 0) + +omit [CharZero F] in +theorem hasOrderBasis_bot : HasOrderBasis (⊥ : Submodule F (PowerSeries F)) := by + refine ⟨0, Fin.elim0, Fin.elim0, ?_, ?_, ?_, ?_, ?_⟩ + · exact linearIndependent_empty_type + · simp + · intro i; exact Fin.elim0 i + · intro i; exact Fin.elim0 i + · intro i; exact Fin.elim0 i + +omit [CharZero F] in +theorem hasOrderBasis_of_finrank_le (N : ℕ) : + ∀ (V : Submodule F (PowerSeries F)) [FiniteDimensional F V], + Module.finrank F V ≤ N → HasOrderBasis V := by + classical + induction N with + | zero => + intro V _ hV + have he : V = ⊥ := Submodule.finrank_eq_zero.mp (Nat.eq_zero_of_le_zero hV) + rw [he] + exact hasOrderBasis_bot + | succ N ih => + intro V _ hV + by_cases he : V = ⊥ + · rw [he]; exact hasOrderBasis_bot + have hex : ∃ a : ℕ, ∃ v : PowerSeries F, v ∈ V ∧ PowerSeries.coeff a v ≠ 0 := by + obtain ⟨v, hv, hv0⟩ := Submodule.exists_mem_ne_zero_of_ne_bot he + have hc : ∃ a, PowerSeries.coeff a v ≠ 0 := by + by_contra h + push Not at h + apply hv0 + ext a + simpa using h a + obtain ⟨a, ha⟩ := hc + exact ⟨a, v, hv, ha⟩ + let a := Nat.find hex + obtain ⟨v, hv, hva⟩ := Nat.find_spec hex + have hlow : ∀ x ∈ V, ∀ r < a, PowerSeries.coeff r x = 0 := by + intro x hx r hr + by_contra hc + have hh := Nat.find_min' hex ⟨x, hx, hc⟩ + omega + let W : Submodule F (PowerSeries F) := V ⊓ LinearMap.ker (PowerSeries.coeff a) + have hWlt : W < V := by + refine lt_of_le_of_ne inf_le_left ?_ + intro h + have hvW : v ∈ W := h.symm ▸ hv + exact hva ((LinearMap.mem_ker.mp hvW.2)) + have hdim : Module.finrank F W ≤ N := by + have hlt := Submodule.finrank_lt_finrank_of_lt hWlt + omega + obtain ⟨k, b, aa, hli, hspan, hinj, hlead, hzero⟩ := ih W hdim + have hbW : ∀ i, b i ∈ W := by + intro i + rw [← hspan] + exact Submodule.subset_span ⟨i, rfl⟩ + have hvnot : v ∉ Submodule.span F (Set.range b) := by + rw [hspan] + intro h + exact hva (LinearMap.mem_ker.mp h.2) + have hneq : ∀ i, a ≠ aa i := by + intro i hi + exact hlead i (hi ▸ LinearMap.mem_ker.mp (hbW i).2) + refine ⟨k+1, Fin.cons v b, Fin.cons a aa, hli.finCons hvnot, ?_, ?_, ?_, ?_⟩ + · apply le_antisymm + · apply Submodule.span_le.mpr + rintro x ⟨i, rfl⟩ + refine Fin.cases ?_ (fun j => ?_) i + · simpa using hv + · simpa using (hbW j).1 + · intro x hx + let c : F := PowerSeries.coeff a x / PowerSeries.coeff a v + have hy : x - c • v ∈ W := by + constructor + · exact V.sub_mem hx (V.smul_mem c hv) + · apply LinearMap.mem_ker.mpr + simp only [map_sub, map_smul, smul_eq_mul, c] + rw [div_mul_cancel₀ _ hva, sub_self] + have hvm : v ∈ Submodule.span F (Set.range (Fin.cons v b)) := + Submodule.subset_span ⟨0, rfl⟩ + have hym : x - c • v ∈ Submodule.span F (Set.range (Fin.cons v b)) := by + apply (Submodule.span_mono (s := Set.range b) ?_) + · rwa [hspan] + · rintro y ⟨j, rfl⟩ + exact ⟨j.succ, rfl⟩ + have := Submodule.add_mem (Submodule.span F (Set.range (Fin.cons v b))) + hym (Submodule.smul_mem _ c hvm) + simpa using this + · intro i j + refine Fin.cases ?_ (fun i' => ?_) i + · refine Fin.cases ?_ (fun j' => ?_) j + · intro _; rfl + · intro hij; exact (hneq j' (by simpa using hij)).elim + · refine Fin.cases ?_ (fun j' => ?_) j + · intro hij; exact (hneq i' (by simpa using hij.symm)).elim + · intro hij + have hij' : aa i' = aa j' := by simpa using hij + exact congrArg Fin.succ (hinj hij') + · intro i + exact Fin.cases hva hlead i + · intro i + exact Fin.cases (hlow v hv) hzero i + +omit [CharZero F] in +theorem hasOrderBasis (V : Submodule F (PowerSeries F)) [FiniteDimensional F V] : + HasOrderBasis V := hasOrderBasis_of_finrank_le (Module.finrank F V) V le_rfl + +theorem wronskian_ne_zero_of_linearIndependent {k : ℕ} + (f : Fin k → PowerSeries F) (hf : LinearIndependent F f) : wronskian f ≠ 0 := by + classical + let := FiniteDimensional.span_of_finite F (Set.finite_range f) + obtain ⟨l, b, a, hb, hspan, ha, hlead, hzero⟩ := hasOrderBasis (Submodule.span F (Set.range f)) + have hdimf : Module.finrank F (Submodule.span F (Set.range f)) = k := by + simpa using finrank_span_eq_card hf + have hdimb : Module.finrank F (Submodule.span F (Set.range b)) = l := by + simpa using finrank_span_eq_card hb + rw [hspan, hdimf] at hdimb + subst l + have hm : ∀ j, ∃ c : Fin k → F, ∑ i : Fin k, c i • f i = b j := by + intro j + apply (Submodule.mem_span_range_iff_exists_fun F).mp + rw [← hspan] + exact Submodule.subset_span ⟨j, rfl⟩ + choose c hc using hm + have hfn : (fun j => ∑ i : Fin k, c j i • f i) = b := funext hc + have he := wronskian_linearCombination f (fun i j => c j i) + rw [hfn] at he + have hbn := (wronskian_order_sum b a ha hlead hzero).1 + intro h + rw [h, zero_mul] at he + exact hbn he + +end NCHitting + +end + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/OutputBounds.lean b/lean/OAI/Algebra/FormulaHitting/OutputBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..6e422266758322e4ee64fde0c446fc0375156cd8 --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/OutputBounds.lean @@ -0,0 +1,154 @@ +import OAI.Algebra.FormulaHitting.Program + +namespace OAI + +namespace NCHitting + +open BitModel + +private theorem length_flatMap_uniform {α β : Type*} (xs : List α) (f : α → List β) + (k : ℕ) (h : ∀ x ∈ xs, (f x).length = k) : + (xs.flatMap f).length = xs.length * k := by + induction xs with + | nil => simp + | cons x xs ih => + have hx := h x (by simp) + have hxs : ∀ y ∈ xs, (f y).length = k := by + intro y hy + exact h y (by simp [hy]) + simp only [List.flatMap_cons, List.length_append, List.length_cons] + rw [hx, ih hxs, Nat.add_mul] + omega + +private theorem getElem?_flatMap_uniform {α β : Type*} (xs : List α) (f : α → List β) + (k : ℕ) (h : ∀ x ∈ xs, (f x).length = k) (i j : ℕ) (hj : j < k) : + (xs.flatMap f)[i * k + j]? = xs[i]?.bind (fun x => (f x)[j]?) := by + induction xs generalizing i with + | nil => simp + | cons x xs ih => + have hx := h x (by simp) + have hxs : ∀ y ∈ xs, (f y).length = k := by + intro y hy + exact h y (by simp [hy]) + cases i with + | zero => + simp only [Nat.zero_mul, Nat.zero_add, List.flatMap_cons, + List.getElem?_cons_zero, Option.bind_some] + exact List.getElem?_append_left (by omega) + | succ i => + have hlarge : (f x).length ≤ (i + 1) * k + j := by + rw [hx, Nat.add_mul] + omega + have hindex : (i + 1) * k + j - (f x).length = i * k + j := by + rw [hx, Nat.add_mul] + omega + simp only [List.flatMap_cons, List.getElem?_cons_succ] + rw [List.getElem?_append_right hlarge, hindex] + exact ih hxs i + +private theorem rows_length (d i : ℕ) : + ((List.range d).flatMap fun r => (List.range d).map fun q => encodedEntry i r q).length = d * d := by + apply (length_flatMap_uniform (List.range d) _ d ?_).trans + · simp + · intro r hr + simp + +theorem generate_output_length (n s : ℕ) : + (generate n s).output.length = n * dimension n s * dimension n s := by + rw [generate_output] + by_cases h : n = 1 ∧ s = 1 + · rcases h with ⟨rfl, rfl⟩ + simp [encodedOutput, dimension] + · simp only [encodedOutput, ite_eq_right h, dimension] + have hl := length_flatMap_uniform (List.range n) + (fun i => (List.range (2 * n * s ^ 2)).flatMap fun r => + (List.range (2 * n * s ^ 2)).map fun q => encodedEntry i r q) + ((2 * n * s ^ 2) * (2 * n * s ^ 2)) (fun i _ => rows_length _ i) + simp [Nat.mul_assoc] at hl ⊢ + +theorem encodedEntry_numerator_le (i r q : ℕ) : (encodedEntry i r q).numerator ≤ 1 := by + unfold encodedEntry + split_ifs <;> simp + +theorem encodedEntry_denominator_size_le {n d i r q : ℕ} (hi : i < n) (hr : r < d) : + (encodedEntry i r q).denominator.size ≤ entryBitBound n d := by + unfold encodedEntry + split_ifs with h + · exact denominator_size_le (q := q) (Nat.succ_le_of_lt hi) hr + · simp only [Nat.size_one] + unfold entryBitBound + omega + +theorem generate_entry_bounds {n s : ℕ} (entry : RationalCode) + (hentry : entry ∈ (generate n s).output) : + 0 < entry.denominator ∧ entry.numerator ≤ 1 ∧ + entry.denominator.size ≤ entryBitBound n (dimension n s) ∧ + entry.bits ≤ 4 + entryBitBound n (dimension n s) := by + rw [generate_output] at hentry + by_cases h : n = 1 ∧ s = 1 + · rcases h with ⟨rfl, rfl⟩ + simp only [encodedOutput, and_self, ite_true, List.mem_singleton] at hentry + subst entry + norm_num [dimension, entryBitBound, RationalCode.bits, width] + · simp only [encodedOutput, ite_eq_right h, List.mem_flatMap, List.mem_map, List.mem_range] at hentry + obtain ⟨i, hi, r, hr, q, hq, rfl⟩ := hentry + have hd : dimension n s = 2 * n * s ^ 2 := by simp [dimension, h] + rw [hd] + exact ⟨encodedEntry_denominator_pos i r q, encodedEntry_numerator_le i r q, + encodedEntry_denominator_size_le hi hr, encodedEntry_bits_le hi hr⟩ + +private theorem flattened_entry {n d i r q : ℕ} (hi : i < n) (hr : r < d) (hq : q < d) : + ((List.range n).flatMap fun i => (List.range d).flatMap fun r => + (List.range d).map fun q => encodedEntry i r q)[i * d * d + r * d + q]? = + some (encodedEntry i r q) := by + have hj : r * d + q < d * d := by + calc + r * d + q < r * d + d := Nat.add_lt_add_left hq _ + _ = (r + 1) * d := by rw [Nat.add_mul]; omega + _ ≤ d * d := Nat.mul_le_mul_right d (by omega) + have hout := getElem?_flatMap_uniform (List.range n) + (fun i => (List.range d).flatMap fun r => (List.range d).map fun q => encodedEntry i r q) + (d * d) (fun i _ => rows_length d i) i (r * d + q) hj + rw [List.getElem?_range hi] at hout + simp only [Option.bind_some] at hout + have hin := getElem?_flatMap_uniform (List.range d) + (fun r => (List.range d).map fun q => encodedEntry i r q) + d (by intro r _; simp) r q hq + rw [List.getElem?_range hr] at hin + simp only [Option.bind_some] at hin + rw [List.getElem?_map, List.getElem?_range hq] at hin + simp only [Option.map_some] at hin + simpa only [Nat.mul_assoc, Nat.add_assoc] using hout.trans hin + +theorem generate_entry_code {n s i r q : ℕ} (hi : i < n) + (hr : r < dimension n s) (hq : q < dimension n s) : + (generate n s).output[i * dimension n s * dimension n s + r * dimension n s + q]? = + some (if n = 1 ∧ s = 1 then ⟨false, 1, 1⟩ else encodedEntry i r q) := by + rw [generate_output] + by_cases h : n = 1 ∧ s = 1 + · rcases h with ⟨rfl, rfl⟩ + have hi0 : i = 0 := by omega + have hr0 : r = 0 := by simpa [dimension] using hr + have hq0 : q = 0 := by simpa [dimension] using hq + subst i + subst r + subst q + simp [encodedOutput, dimension] + · have hd : dimension n s = 2 * n * s ^ 2 := by simp [dimension, h] + rw [hd] at hr hq ⊢ + simp only [encodedOutput, ite_eq_right h] + exact flattened_entry hi hr hq + +theorem generate_entry_decode (n s : ℕ) (i : Fin n) (r q : Fin (dimension n s)) : + decode (((generate n s).output[i.val * dimension n s * dimension n s + + r.val * dimension n s + q.val]?).getD ⟨false, 0, 1⟩) = generator n s i r q := by + rw [generate_entry_code i.isLt r.isLt q.isLt] + simp only [Option.getD_some] + by_cases h : n = 1 ∧ s = 1 + · simp [h, generator, decode] + · simp only [generator, ite_eq_right h] + exact decode_encodedEntry i.val r.val q.val + +end NCHitting + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/Program.lean b/lean/OAI/Algebra/FormulaHitting/Program.lean new file mode 100644 index 0000000000000000000000000000000000000000..518311e8f4da76779d651f815d45a65ff9950e86 --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/Program.lean @@ -0,0 +1,101 @@ +import OAI.Algebra.FormulaHitting.Generator +import OAI.Algebra.FormulaHitting.BitModel + +namespace OAI + +namespace NCHitting + +open BitModel + +def dimensionExpr (nRegister sRegister : ℕ) : Expr := + .mul (.mul (.literal 2) (.read nRegister)) (.power (.read sRegister) (.literal 2)) + +def entryProgram : Program := + .branch (.less (.read 0) (.read 1)) + (.emit (.odd (.sub (.sub (.read 1) (.read 0)) (.literal 1))) + (.literal 1) + (.mul (.read 1) (.power (.add (.read 2) (.literal 1)) + (.sub (.read 1) (.read 0))))) + (.emit (.literal 0) (.literal 0) (.literal 1)) + +def rowProgram : Program := .loop (dimensionExpr 2 3) entryProgram + +def variableProgram : Program := .loop (dimensionExpr 1 2) rowProgram + +def generatorProgram : Program := + .branch (.mul (.equal (.read 0) (.literal 1)) (.equal (.read 1) (.literal 1))) + (.emit (.literal 0) (.literal 1) (.literal 1)) + (.loop (.read 0) variableProgram) + +def encodedEntry (i r q : ℕ) : BitModel.RationalCode := + if q < r then ⟨decide ((r-q-1) % 2 = 1), 1, r * (i+1)^(r-q)⟩ + else ⟨false, 0, 1⟩ + +def encodedOutput (n s : ℕ) : List BitModel.RationalCode := + if n = 1 ∧ s = 1 then [⟨false, 1, 1⟩] + else (List.range n).flatMap fun i => + (List.range (2*n*s^2)).flatMap fun r => + (List.range (2*n*s^2)).map fun q => encodedEntry i r q + +def generate (n s : ℕ) : ProgramResult := BitModel.execute generatorProgram [n, s] + +theorem entryProgram_output (n s i r q : ℕ) : + (entryProgram.run [q,r,i,n,s]).output = [encodedEntry i r q] := by + by_cases h : q < r <;> + simp [entryProgram, Program.run, Expr.run, encodedEntry, h] + +theorem rowProgram_output (n s i r : ℕ) : + (rowProgram.run [r,i,n,s]).output = + (List.range (2*n*s^2)).map (encodedEntry i r) := by + simp [rowProgram, Program.run, dimensionExpr, Expr.run, List.flatMap_map, + entryProgram_output, ← List.map_eq_flatMap] + +theorem variableProgram_output (n s i : ℕ) : + (variableProgram.run [i,n,s]).output = + (List.range (2*n*s^2)).flatMap fun r => + (List.range (2*n*s^2)).map (encodedEntry i r) := by + simp [variableProgram, Program.run, dimensionExpr, Expr.run, List.flatMap_map, + rowProgram_output] + +theorem generate_output (n s : ℕ) : (generate n s).output = encodedOutput n s := by + by_cases hn : n = 1 <;> by_cases hs : s = 1 <;> + simp [generate, BitModel.execute, generatorProgram, Program.run, Expr.run, + hn, hs, List.flatMap_map, variableProgram_output, encodedOutput] + +theorem encodedEntry_denominator_pos (i r q : ℕ) : + 0 < (encodedEntry i r q).denominator := by + unfold encodedEntry + split_ifs with h + · simp only + apply Nat.mul_pos (by omega) + exact pow_pos (by omega) _ + · decide + +def decode (entry : BitModel.RationalCode) : ℚ := + (if entry.negative then -(entry.numerator : ℚ) else entry.numerator) / entry.denominator + +theorem decode_encodedEntry (i r q : ℕ) : + decode (encodedEntry i r q) = matrixEntry (i+1) r q := by + by_cases h : q < r + · simp only [encodedEntry, ite_eq_left h, decode, matrixEntry] + rw [neg_one_pow_eq_pow_mod_two] + by_cases hm : (r-q-1) % 2 = 1 + · simp [hm, Nat.cast_mul, Nat.cast_pow] + · have hz : (r-q-1) % 2 = 0 := by omega + simp [hz, Nat.cast_mul, Nat.cast_pow] + · simp [encodedEntry, decode, matrixEntry, h] + +theorem encodedEntry_bits_le {n d i r q : ℕ} (hi : i < n) (hr : r < d) : + (encodedEntry i r q).bits ≤ 4 + entryBitBound n d := by + unfold encodedEntry + split_ifs with h + · have hb := denominator_size_le (i := i+1) (q := q) (show i+1 ≤ n by omega) hr + simp only [BitModel.RationalCode.bits, BitModel.width, Nat.size_one] + omega + · simp only [BitModel.RationalCode.bits, BitModel.width, Nat.size_one, Nat.size_zero] + unfold entryBitBound + omega + +end NCHitting + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/ProgramCost.lean b/lean/OAI/Algebra/FormulaHitting/ProgramCost.lean new file mode 100644 index 0000000000000000000000000000000000000000..b09213c9acd6be8fcc72ca96372ac0ddf81c8d44 --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/ProgramCost.lean @@ -0,0 +1,349 @@ +import Mathlib.Data.Nat.Size +import OAI.Algebra.FormulaHitting.BitModel +import Lean.Elab.Tactic.Omega + +namespace OAI + +namespace NCHitting.BitModel + +private theorem bitSize_le_self (a : ℕ) : a.size ≤ a := by + apply Nat.size_le.mpr + exact Nat.lt_two_pow_self + +private theorem bitSize_mul_le (a b : ℕ) : (a * b).size ≤ a.size + b.size := by + apply Nat.size_le.mpr + rw [pow_add] + exact Nat.mul_lt_mul_of_lt_of_lt (Nat.lt_size_self a) (Nat.lt_size_self b) + +private theorem bitSize_pow_le (a k : ℕ) : (a ^ k).size ≤ 1 + k * a.size := by + induction k with + | zero => simp + | succ k ih => + calc + (a ^ (k + 1)).size = (a ^ k * a).size := by rw [pow_succ] + _ ≤ (a ^ k).size + a.size := bitSize_mul_le _ _ + _ ≤ 1 + (k + 1) * a.size := by rw [Nat.add_mul]; omega + +def powerStepBound (M : ℕ) : ℕ := + 8 * (M * M + 2) * (M + 1) + 4 * (M + 3) + 1 + +theorem width_le_of_le {a M : ℕ} (ha : a ≤ M) : width a ≤ M + 1 := by + exact Nat.add_le_add_right (Nat.le_trans (bitSize_le_self a) ha) 1 + +theorem powerRun_cost_le {base k M : ℕ} (hb : base ≤ M) (hk : k ≤ M) : + (powerRun base k).cost ≤ 2 + k * powerStepBound M := by + induction k with + | zero => simp [powerRun, width] + | succ k ih => + have hk' : k ≤ M := by omega + have hbase : base.size ≤ M := (bitSize_le_self base).trans hb + have hpow : width (base ^ k) ≤ M * M + 2 := by + have h := bitSize_pow_le base k + have hm : k * base.size ≤ M * M := Nat.mul_le_mul hk' hbase + unfold width + omega + have hwbase : width base ≤ M + 1 := width_le_of_le hb + have hwk : width k ≤ M + 1 := width_le_of_le hk' + have hmul : mulCost (base ^ k) base ≤ 8 * (M * M + 2) * (M + 1) := by + unfold mulCost + exact Nat.mul_le_mul (Nat.mul_le_mul_left 8 hpow) hwbase + have hadd : addCost k 1 ≤ 4 * (M + 3) := by + unfold addCost + have : width 1 = 2 := rfl + rw [this] + exact Nat.mul_le_mul_left 4 (by omega) + have hstep : mulCost (base ^ k) base + addCost k 1 + 1 ≤ powerStepBound M := by + unfold powerStepBound + omega + simp only [powerRun, powerRun_value] + calc + (powerRun base k).cost + mulCost (base ^ k) base + addCost k 1 + 1 + ≤ (2 + k * powerStepBound M) + powerStepBound M := by + have hprevious := ih hk' + omega + _ = 2 + (k + 1) * powerStepBound M := by rw [Nat.add_mul]; omega + +theorem sum_map_le_length_mul {α : Type*} (xs : List α) (f : α → ℕ) (C : ℕ) + (h : ∀ x ∈ xs, f x ≤ C) : (xs.map f).sum ≤ xs.length * C := by + induction xs with + | nil => simp + | cons x xs ih => + have hx := h x (by simp) + have hxs : ∀ y ∈ xs, f y ≤ C := by + intro y hy + exact h y (by simp [hy]) + have ht := ih hxs + simp only [List.map_cons, List.sum_cons, List.length_cons, Nat.add_mul] + omega + +theorem outputBits_append (xs ys : List RationalCode) : + outputBits (xs ++ ys) = outputBits xs + outputBits ys := by + simp [outputBits] + +theorem outputBits_flatMap {α : Type*} (xs : List α) (f : α → List RationalCode) : + outputBits (xs.flatMap f) = (xs.map fun x => outputBits (f x)).sum := by + induction xs with + | nil => rfl + | cons x xs ih => simp [outputBits_append, ih] + +def loopControlBound (M : ℕ) : ℕ := M + 1 + 4 * (M + 3) + 1 + +theorem loop_control_le {index M : ℕ} (hi : index ≤ M) : + width index + addCost index 1 + 1 ≤ loopControlBound M := by + have hw := width_le_of_le hi + have h1 : width 1 = 2 := rfl + unfold addCost loopControlBound + rw [h1] + omega + +theorem loop_cost_le (environment : List ℕ) (bound : Expr) (body : Program) + (M B C O : ℕ) + (hvalue : (bound.run environment).value ≤ M) + (hbound : (bound.run environment).cost ≤ B) + (hbody : ∀ index < (bound.run environment).value, + (body.run (index :: environment)).cost ≤ C ∧ + outputBits (body.run (index :: environment)).output ≤ O) : + ((Program.loop bound body).run environment).cost ≤ + B + 1 + (bound.run environment).value * (C + loopControlBound M + O) := by + simp only [Program.run, List.map_map, Function.comp_def] + have hsum := sum_map_le_length_mul + (List.range (bound.run environment).value) + (fun index => (body.run (index :: environment)).cost + + (width index + addCost index 1 + 1) + + outputBits (body.run (index :: environment)).output) + (C + loopControlBound M + O) (by + intro index hindex + have hi : index < (bound.run environment).value := List.mem_range.mp hindex + obtain ⟨hc, ho⟩ := hbody index hi + have hcontrol := loop_control_le (M := M) (by omega : index ≤ M) + omega) + simp only [List.length_range] at hsum + omega + +theorem loop_outputBits_le (environment : List ℕ) (bound : Expr) (body : Program) + (O : ℕ) + (hbody : ∀ index < (bound.run environment).value, + outputBits (body.run (index :: environment)).output ≤ O) : + outputBits ((Program.loop bound body).run environment).output ≤ + (bound.run environment).value * O := by + simp only [Program.run, List.flatMap_map] + rw [outputBits_flatMap] + have hsum := sum_map_le_length_mul + (List.range (bound.run environment).value) + (fun index => outputBits (body.run (index :: environment)).output) O (by + intro index hindex + exact hbody index (List.mem_range.mp hindex)) + simpa only [List.length_range] using hsum + +def expressionBudget (M B R : ℕ) : ℕ := + R + 8 * B * B + 8 * B + (2 + M * powerStepBound M) + 10 + +def Expr.nodes : Expr → ℕ + | .literal _ | .read _ => 1 + | .add a b | .sub a b | .mul a b | .power a b | .less a b | .equal a b => + a.nodes + b.nodes + 1 + | .odd a => a.nodes + 1 + +def Expr.Bounded (environment : List ℕ) (M B R : ℕ) : Expr → Prop + | .literal n => width n ≤ B ∧ True + | .read index => + width ((Expr.read index).run environment).value ≤ B ∧ + ((Expr.read index).run environment).cost ≤ R + | .add a b => width ((Expr.add a b).run environment).value ≤ B ∧ + a.Bounded environment M B R ∧ b.Bounded environment M B R + | .sub a b => width ((Expr.sub a b).run environment).value ≤ B ∧ + a.Bounded environment M B R ∧ b.Bounded environment M B R + | .mul a b => width ((Expr.mul a b).run environment).value ≤ B ∧ + a.Bounded environment M B R ∧ b.Bounded environment M B R + | .less a b => width ((Expr.less a b).run environment).value ≤ B ∧ + a.Bounded environment M B R ∧ b.Bounded environment M B R + | .equal a b => width ((Expr.equal a b).run environment).value ≤ B ∧ + a.Bounded environment M B R ∧ b.Bounded environment M B R + | .power a b => width ((Expr.power a b).run environment).value ≤ B ∧ + a.Bounded environment M B R ∧ b.Bounded environment M B R ∧ + (a.run environment).value ≤ M ∧ (b.run environment).value ≤ M + | .odd a => width ((Expr.odd a).run environment).value ≤ B ∧ + a.Bounded environment M B R + +theorem Expr.bounded_width {environment : List ℕ} {M B R : ℕ} {e : Expr} + (h : e.Bounded environment M B R) : width (e.run environment).value ≤ B := by + cases e <;> exact h.1 + +private theorem addCost_le_budget {a b M B R : ℕ} + (ha : width a ≤ B) (hb : width b ≤ B) : + addCost a b + 1 ≤ expressionBudget M B R := by + unfold addCost expressionBudget + omega + +private theorem mulCost_le_budget {a b M B R : ℕ} + (ha : width a ≤ B) (hb : width b ≤ B) : + mulCost a b + 1 ≤ expressionBudget M B R := by + have hm : 8 * width a * width b ≤ 8 * B * B := + Nat.mul_le_mul (Nat.mul_le_mul_left 8 ha) hb + unfold mulCost expressionBudget + omega + +private theorem compareCost_le_budget {a b M B R : ℕ} + (ha : width a ≤ B) (hb : width b ≤ B) : + compareCost a b + 1 ≤ expressionBudget M B R := by + unfold compareCost expressionBudget + omega + +theorem Expr.cost_le_nodes_budget (environment : List ℕ) (M B R : ℕ) (e : Expr) : + e.Bounded environment M B R → + (e.run environment).cost ≤ e.nodes * expressionBudget M B R := by + induction e with + | literal n => + intro h + have hw := h.1 + simp only [Expr.run, Expr.nodes, Nat.one_mul] + unfold expressionBudget + omega + | read index => + intro h + have hr := h.2 + simp only [Expr.nodes, Nat.one_mul] + unfold expressionBudget + omega + | add a b iha ihb => + intro h + obtain ⟨ha, hb⟩ := h.2 + have hca := iha ha + have hcb := ihb hb + have hc := addCost_le_budget (M := M) (R := R) (Expr.bounded_width ha) (Expr.bounded_width hb) + simp only [Expr.run, Expr.nodes, Nat.add_mul, Nat.one_mul] + omega + | sub a b iha ihb => + intro h + obtain ⟨ha, hb⟩ := h.2 + have hca := iha ha + have hcb := ihb hb + have hc := addCost_le_budget (M := M) (R := R) (Expr.bounded_width ha) (Expr.bounded_width hb) + simp only [Expr.run, Expr.nodes, Nat.add_mul, Nat.one_mul] + omega + | mul a b iha ihb => + intro h + obtain ⟨ha, hb⟩ := h.2 + have hca := iha ha + have hcb := ihb hb + have hc := mulCost_le_budget (M := M) (R := R) (Expr.bounded_width ha) (Expr.bounded_width hb) + simp only [Expr.run, Expr.nodes, Nat.add_mul, Nat.one_mul] + omega + | power a b iha ihb => + intro h + obtain ⟨ha, hb, hav, hbv⟩ := h.2 + have hca := iha ha + have hcb := ihb hb + have hp := powerRun_cost_le hav hbv + have hm := Nat.mul_le_mul_right (powerStepBound M) hbv + have hc : (powerRun (a.run environment).value (b.run environment).value).cost + 1 ≤ + expressionBudget M B R := by unfold expressionBudget; omega + simp only [Expr.run, Expr.nodes, Nat.add_mul, Nat.one_mul] + omega + | less a b iha ihb => + intro h + obtain ⟨ha, hb⟩ := h.2 + have hca := iha ha + have hcb := ihb hb + have hc := compareCost_le_budget (M := M) (R := R) (Expr.bounded_width ha) (Expr.bounded_width hb) + simp only [Expr.run, Expr.nodes, Nat.add_mul, Nat.one_mul] + omega + | equal a b iha ihb => + intro h + obtain ⟨ha, hb⟩ := h.2 + have hca := iha ha + have hcb := ihb hb + have hc := compareCost_le_budget (M := M) (R := R) (Expr.bounded_width ha) (Expr.bounded_width hb) + simp only [Expr.run, Expr.nodes, Nat.add_mul, Nat.one_mul] + omega + | odd a iha => + intro h + have hca := iha h.2 + have hc : 2 ≤ expressionBudget M B R := by unfold expressionBudget; omega + simp only [Expr.run, Expr.nodes, Nat.add_mul, Nat.one_mul] + omega + +theorem width_mul_le (a b : ℕ) : width (a * b) ≤ width a + width b := by + have h := bitSize_mul_le a b + unfold width + omega + +theorem width_pow_le (a k : ℕ) : width (a ^ k) ≤ 2 + k * a.size := by + have h := bitSize_pow_le a k + unfold width + omega + +def registerReadBound (M : ℕ) : ℕ := 5 * (M + 1) + 6 + +def intermediateWidthBound (M : ℕ) : ℕ := M * M + 4 * M + 10 + +theorem small_width {a M : ℕ} (ha : a ≤ M) : width a ≤ intermediateWidthBound M := by + have h := width_le_of_le ha + unfold intermediateWidthBound + omega + +theorem Expr.bounded_literal {environment : List ℕ} {a M : ℕ} (ha : a ≤ M) : + (Expr.literal a).Bounded environment M (intermediateWidthBound M) (registerReadBound M) := by + exact ⟨small_width ha, trivial⟩ + +theorem Expr.bounded_read {environment : List ℕ} {M index : ℕ} + (hlen : environment.length ≤ 5) (hindex : index ≤ 4) + (henv : ∀ a ∈ environment, a ≤ M) : + (Expr.read index).Bounded environment M + (intermediateWidthBound M) (registerReadBound M) := by + have hvalue : environment[index]?.getD 0 ≤ M := by + cases h : environment[index]? with + | none => simp + | some a => simpa [h] using henv a (List.mem_of_getElem? h) + refine ⟨small_width hvalue, ?_⟩ + have hiwidth := width_le_of_le hindex + have hprefix : (environment.take (index + 1)).length ≤ 5 := by + simp only [List.length_take] + exact (Nat.min_le_right _ _).trans hlen + have hsum := sum_map_le_length_mul (environment.take (index + 1)) width (M + 1) (by + intro a ha + exact width_le_of_le (henv a (List.mem_of_mem_take ha))) + have hm := Nat.mul_le_mul_right (M + 1) hprefix + change width index + listBits (environment.take (index + 1)) + 1 ≤ registerReadBound M + unfold listBits registerReadBound + omega + +theorem emit_cost_le (environment : List ℕ) (sign numerator denominator : Expr) + (S N D A B : ℕ) + (hs : (sign.run environment).cost ≤ S) + (hn : (numerator.run environment).cost ≤ N) + (hd : (denominator.run environment).cost ≤ D) + (ha : width (numerator.run environment).value ≤ A) + (hb : width (denominator.run environment).value ≤ B) : + ((Program.emit sign numerator denominator).run environment).cost ≤ + S + N + D + (1 + A + B) + 2 := by + simp only [Program.run, RationalCode.bits] + omega + +theorem emit_outputBits_le (environment : List ℕ) (sign numerator denominator : Expr) + (A B : ℕ) + (ha : width (numerator.run environment).value ≤ A) + (hb : width (denominator.run environment).value ≤ B) : + outputBits ((Program.emit sign numerator denominator).run environment).output ≤ + 1 + A + B := by + simp only [Program.run, outputBits, List.map_cons, List.map_nil, List.sum_cons, + List.sum_nil, Nat.add_zero, RationalCode.bits] + omega + +theorem branch_cost_le (environment : List ℕ) (test : Expr) (yes no : Program) + (T C : ℕ) (ht : (test.run environment).cost ≤ T) + (hy : (yes.run environment).cost ≤ C) (hn : (no.run environment).cost ≤ C) : + ((Program.branch test yes no).run environment).cost ≤ T + C + 1 := by + simp only [Program.run] + split <;> omega + +theorem branch_outputBits_le (environment : List ℕ) (test : Expr) (yes no : Program) + (O : ℕ) (hy : outputBits (yes.run environment).output ≤ O) + (hn : outputBits (no.run environment).output ≤ O) : + outputBits ((Program.branch test yes no).run environment).output ≤ O := by + simp only [Program.run] + split <;> assumption + +end NCHitting.BitModel + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/RationalMinor.lean b/lean/OAI/Algebra/FormulaHitting/RationalMinor.lean new file mode 100644 index 0000000000000000000000000000000000000000..f8b0c68d0c74966be41b27955ea7f8b06c3ecf54 --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/RationalMinor.lean @@ -0,0 +1,50 @@ +import OAI.Algebra.FormulaHitting.RationalTransfer +import OAI.Algebra.FormulaHitting.Minors +import Mathlib.LinearAlgebra.Matrix.ToLin + +namespace OAI + +noncomputable section +namespace NCHitting + +open Matrix + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +theorem exists_rational_coefficient_minor (a : ι → PowerSeries ℚ) + (ha : LinearIndependent ℚ a) : + ∃ rows : ι → ℕ, + Matrix.det (fun r i => PowerSeries.coeff (rows r) (a i) : Matrix ι ι ℚ) ≠ 0 := by + obtain ⟨d, hd⟩ := exists_independent_jet a ha + let L := Fintype.linearCombination ℚ (fun i => jet d (a i)) + have hL : LinearMap.ker L = ⊥ := + LinearMap.ker_eq_bot.mpr hd.fintypeLinearCombination_injective + obtain ⟨K, hK⟩ := L.exists_leftInverse_of_injective hL + let A := LinearMap.toMatrix' L + let B := LinearMap.toMatrix' K + have hBA : B * A = 1 := by + rw [← LinearMap.toMatrix'_comp, hK, LinearMap.toMatrix'_id] + have hAB : A.transpose * B.transpose = 1 := by + rw [← Matrix.transpose_mul, hBA, Matrix.transpose_one] + obtain ⟨rows, hrows⟩ := exists_minor_ne_zero_of_mul_det_ne_zero A.transpose B.transpose + (by rw [hAB, Matrix.det_one]; exact one_ne_zero) + refine ⟨fun i => (rows i).val, ?_⟩ + have hm : (A.transpose.submatrix id rows).transpose = + (fun r i => PowerSeries.coeff (rows r).val (a i) : Matrix ι ι ℚ) := by + ext r i + simp [A, L, LinearMap.toMatrix'_apply, Matrix.transpose_apply, + Matrix.submatrix_apply] + rw [← hm, Matrix.det_transpose] + exact hrows + +theorem rational_minor_transfer {F : Type*} [Field F] [CharZero F] + (a : ι → PowerSeries ℚ) (ha : LinearIndependent ℚ a) : + LinearIndependent F (fun i => PowerSeries.map (algebraMap ℚ F) (a i)) := by + obtain ⟨rows, hrows⟩ := exists_rational_coefficient_minor a ha + exact independent_of_rational_minor a rows hrows + +end NCHitting + +end + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/RationalTransfer.lean b/lean/OAI/Algebra/FormulaHitting/RationalTransfer.lean new file mode 100644 index 0000000000000000000000000000000000000000..7ee4d127641555613f2ac6364d9509e549d05f1d --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/RationalTransfer.lean @@ -0,0 +1,112 @@ +import Mathlib.RingTheory.PowerSeries.Basic +import Mathlib.Algebra.Algebra.Rat +import Mathlib.LinearAlgebra.LinearIndependent.BaseChange +import Mathlib.RingTheory.Artinian.Module +import Mathlib.LinearAlgebra.FiniteDimensional.Basic +import Mathlib.LinearAlgebra.Matrix.NonsingularInverse +import Lean.Elab.Tactic.Omega + +namespace OAI + +noncomputable section +open PowerSeries +namespace NCHitting + +variable {F : Type*} [Field F] + +def jet (d : ℕ) : PowerSeries F →ₗ[F] (Fin d → F) where + toFun a r := PowerSeries.coeff r.val a + map_add' a b := by ext r; simp + map_smul' c a := by ext r; simp + +@[simp] theorem jet_apply (d : ℕ) (a : PowerSeries F) (r : Fin d) : + jet d a r = PowerSeries.coeff r.val a := rfl + +section FiniteFamily +variable {ι : Type*} [Fintype ι] + +def jetKernel (a : ι → PowerSeries F) (d : ℕ) : Submodule F (ι → F) := + LinearMap.ker ((jet d).comp (Fintype.linearCombination F a)) + +@[simp] theorem mem_jetKernel (a : ι → PowerSeries F) (d : ℕ) (c : ι → F) : + c ∈ jetKernel a d ↔ ∀ r < d, + PowerSeries.coeff r (Fintype.linearCombination F a c) = 0 := by + simp only [jetKernel, LinearMap.mem_ker, LinearMap.comp_apply] + constructor + · intro h r hr + exact congrFun h ⟨r, hr⟩ + · intro h + ext r + exact h r.val r.isLt + +theorem jetKernel_antitone (a : ι → PowerSeries F) : Antitone (jetKernel a) := by + intro d e hde c hc + rw [mem_jetKernel] at hc ⊢ + exact fun r hr => hc r (lt_of_lt_of_le hr hde) + +theorem exists_independent_jet (a : ι → PowerSeries F) (ha : LinearIndependent F a) : + ∃ d : ℕ, LinearIndependent F (fun i => jet d (a i)) := by + classical + obtain ⟨d, hd⟩ := IsArtinian.monotone_stabilizes + (R := F) (M := ι → F) ⟨jetKernel a, jetKernel_antitone a⟩ + refine ⟨d, Fintype.linearIndependent_iff.mpr ?_⟩ + intro c hc i + have hcd : c ∈ jetKernel a d := by + simp only [jetKernel, LinearMap.mem_ker, LinearMap.comp_apply, + Fintype.linearCombination_apply, map_sum, map_smul] + exact hc + have hcz : Fintype.linearCombination F a c = 0 := by + apply PowerSeries.ext + intro r + have hce : c ∈ jetKernel a (max d (r+1)) := by + have hstab := hd (max d (r+1)) (le_max_left _ _) + change jetKernel a d = jetKernel a (max d (r+1)) at hstab + rwa [← hstab] + exact (mem_jetKernel a _ c).mp hce r (by omega) + have he : c = 0 := ha.fintypeLinearCombination_injective (by simpa using hcz) + exact congrFun he i + +theorem rational_series_independent [CharZero F] (a : ι → PowerSeries ℚ) + (ha : LinearIndependent ℚ a) : + LinearIndependent F (fun i => PowerSeries.map (algebraMap ℚ F) (a i)) := by + classical + obtain ⟨d, hd⟩ := exists_independent_jet a ha + have ht : LinearIndependent F (fun i => + (algebraMap ℚ F) ∘ (jet d (a i))) := + linearIndependent_algebraMap_comp_iff.mpr hd + apply LinearIndependent.of_comp (jet d) + simpa [Function.comp_def, jet] using ht + +theorem rational_minor_ne_zero [DecidableEq ι] [CharZero F] + (A : Matrix ι ι ℚ) (hA : A.det ≠ 0) : + (A.map (algebraMap ℚ F)).det ≠ 0 := by + change ((algebraMap ℚ F).mapMatrix A).det ≠ 0 + rw [← RingHom.map_det] + exact (map_ne_zero (algebraMap ℚ F)).mpr hA + +theorem independent_of_rational_minor [DecidableEq ι] [CharZero F] + (a : ι → PowerSeries ℚ) (rows : ι → ℕ) + (hA : Matrix.det (fun r i => PowerSeries.coeff (rows r) (a i) : Matrix ι ι ℚ) ≠ 0) : + LinearIndependent F (fun i => PowerSeries.map (algebraMap ℚ F) (a i)) := by + classical + let A : Matrix ι ι ℚ := fun r i => PowerSeries.coeff (rows r) (a i) + have hunit : IsUnit (A.map (algebraMap ℚ F)) := by + apply (Matrix.isUnit_iff_isUnit_det _).mpr + exact isUnit_iff_ne_zero.mpr (rational_minor_ne_zero A hA) + have hinj := Matrix.mulVec_injective_iff_isUnit.mpr hunit + refine Fintype.linearIndependent_iff.mpr ?_ + intro c hc i + have he : (A.map (algebraMap ℚ F)).mulVec c = 0 := by + ext r + change (∑ i, (algebraMap ℚ F) (PowerSeries.coeff (rows r) (a i)) * c i) = 0 + have hr := congrArg (PowerSeries.coeff (rows r)) hc + simpa [mul_comm] using hr + have hz : c = 0 := hinj (by simpa using he) + exact congrFun hz i + +end FiniteFamily +end NCHitting + +end + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/Representation.lean b/lean/OAI/Algebra/FormulaHitting/Representation.lean new file mode 100644 index 0000000000000000000000000000000000000000..a06bd4d8e396a82ab82fa9e3e081dd38a05f3fe0 --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/Representation.lean @@ -0,0 +1,353 @@ +import OAI.Algebra.FormulaHitting.Formula +import Mathlib.Data.Matrix.Block +import Mathlib.Algebra.BigOperators.Fin +import Mathlib.Tactic.FinCases + +namespace OAI + +namespace NCHitting + +open Matrix + +def automatonValue {F I : Type*} {n : ℕ} [Semiring F] [Fintype I] + (B : Fin n → Matrix I I F) (u v : I → F) : Word n → F + | [] => u ⬝ᵥ v + | i :: w => automatonValue B (u ᵥ* B i) v w + +theorem automatonValue_add {F I : Type*} {n : ℕ} [Semiring F] [Fintype I] + (B : Fin n → Matrix I I F) (u u' v : I → F) (w : Word n) : + automatonValue B (u + u') v w = + automatonValue B u v w + automatonValue B u' v w := by + induction w generalizing u u' with + | nil => simp [automatonValue, add_dotProduct] + | cons i w ih => simp [automatonValue, add_vecMul, ih] + +theorem automatonValue_smul {F I : Type*} {n : ℕ} [CommSemiring F] [Fintype I] + (B : Fin n → Matrix I I F) (a : F) (u v : I → F) (w : Word n) : + automatonValue B (a • u) v w = a * automatonValue B u v w := by + induction w generalizing u with + | nil => simp [automatonValue, smul_dotProduct] + | cons i w ih => simp [automatonValue, smul_vecMul, ih] + +theorem automatonValue_zero {F I : Type*} {n : ℕ} [Semiring F] [Fintype I] + (B : Fin n → Matrix I I F) (v : I → F) (w : Word n) : + automatonValue B 0 v w = 0 := by + induction w with + | nil => simp [automatonValue] + | cons i w ih => simp [automatonValue, ih] + +def wordMatrix {F I : Type*} {n : ℕ} [Semiring F] [Fintype I] [DecidableEq I] + (B : Fin n → Matrix I I F) (w : Word n) : Matrix I I F := + (w.map B).prod + +theorem automatonValue_eq_matrix {F I : Type*} {n : ℕ} + [Semiring F] [Fintype I] [DecidableEq I] + (B : Fin n → Matrix I I F) (u v : I → F) (w : Word n) : + automatonValue B u v w = u ⬝ᵥ (wordMatrix B w *ᵥ v) := by + induction w generalizing u with + | nil => simp [automatonValue, wordMatrix] + | cons i w ih => + simp only [automatonValue, ih, wordMatrix, List.map_cons, List.prod_cons] + rw [← dotProduct_mulVec, mulVec_mulVec] + +theorem automatonValue_sumBlocks {F I J : Type*} {n : ℕ} + [Semiring F] [Fintype I] [Fintype J] + (A : Fin n → Matrix I I F) (B : Fin n → Matrix J J F) + (u v : I → F) (u' v' : J → F) (w : Word n) : + automatonValue (fun i => fromBlocks (A i) 0 0 (B i)) + (Sum.elim u u') (Sum.elim v v') w = + automatonValue A u v w + automatonValue B u' v' w := by + induction w generalizing u u' with + | nil => simp [automatonValue, sumElim_dotProduct_sumElim] + | cons i w ih => + simpa [automatonValue, vecMul_fromBlocks, Function.comp_def] using + ih (u ᵥ* A i) (u' ᵥ* B i) + +def productTransition {F I J : Type*} {n : ℕ} + [Semiring F] [Fintype J] + (A : Fin n → Matrix I I F) (B : Fin n → Matrix J J F) + (v : I → F) (u' : J → F) (i : Fin n) : Matrix (I ⊕ J) (I ⊕ J) F := + fromBlocks (A i) (vecMulVec v (u' ᵥ* B i)) 0 (B i) + +theorem automatonValue_productBlocks_general {F I J : Type*} {n : ℕ} + [CommSemiring F] [Fintype I] [Fintype J] + (A : Fin n → Matrix I I F) (B : Fin n → Matrix J J F) + (u v : I → F) (u' b v' : J → F) (w : Word n) : + automatonValue (productTransition A B v u') (Sum.elim u b) + (Sum.elim ((u' ⬝ᵥ v') • v) v') w = + convolution (automatonValue A u v) (automatonValue B u' v') w + + automatonValue B b v' w := by + induction w generalizing u b with + | nil => + simp [automatonValue, convolution, sumElim_dotProduct_sumElim, + dotProduct_smul, mul_comm] + | cons i w ih => + rw [automatonValue] + simp only [productTransition, vecMul_fromBlocks, Function.comp_def, + Sum.elim_inl, Sum.elim_inr, vecMul_zero, add_zero, vecMul_vecMulVec] + rw [ih, automatonValue_add, automatonValue_smul] + simp only [convolution, automatonValue] + ac_rfl + +theorem automatonValue_productBlocks {F I J : Type*} {n : ℕ} + [CommSemiring F] [Fintype I] [Fintype J] + (A : Fin n → Matrix I I F) (B : Fin n → Matrix J J F) + (u v : I → F) (u' v' : J → F) (w : Word n) : + automatonValue (productTransition A B v u') (Sum.elim u 0) + (Sum.elim ((u' ⬝ᵥ v') • v) v') w = + convolution (automatonValue A u v) (automatonValue B u' v') w := by + rw [automatonValue_productBlocks_general, automatonValue_zero, add_zero] + +structure AcyclicRepresentation (F : Type*) (n : ℕ) [CommSemiring F] where + State : Type + [fintype : Fintype State] + [decidableEq : DecidableEq State] + u : State → F + v : State → F + B : Fin n → Matrix State State F + rank : State → ℕ + rank_lt : ∀ a, rank a < Fintype.card State + upper : ∀ i a b, rank b ≤ rank a → B i a b = 0 + +attribute [instance] AcyclicRepresentation.fintype AcyclicRepresentation.decidableEq + +namespace AcyclicRepresentation + +variable {F : Type*} {n : ℕ} [CommSemiring F] + +def value (R : AcyclicRepresentation F n) : WordSeries F n := + automatonValue R.B R.u R.v + +theorem wordMatrix_entry_zero (R : AcyclicRepresentation F n) + (w : Word n) (a b : R.State) (h : R.rank b < R.rank a + w.length) : + wordMatrix R.B w a b = 0 := by + induction w generalizing a with + | nil => + have hne : a ≠ b := by intro he; subst b; simp at h + simp [wordMatrix, hne] + | cons i w ih => + simp only [wordMatrix, List.map_cons, List.prod_cons, Matrix.mul_apply] + apply Finset.sum_eq_zero + intro c _ + by_cases hc : R.rank c ≤ R.rank a + · rw [R.upper i a c hc, zero_mul] + · have hbc : R.rank b < R.rank c + w.length := by + simp only [List.length_cons] at h + omega + rw [show (List.map R.B w).prod c b = 0 from ih c hbc, mul_zero] + +theorem wordMatrix_eq_zero (R : AcyclicRepresentation F n) + (w : Word n) (h : Fintype.card R.State ≤ w.length) : wordMatrix R.B w = 0 := by + ext a b + apply R.wordMatrix_entry_zero w a b + have hb := R.rank_lt b + omega + +theorem value_eq_matrix (R : AcyclicRepresentation F n) (w : Word n) : + R.value w = R.u ⬝ᵥ (wordMatrix R.B w *ᵥ R.v) := + automatonValue_eq_matrix R.B R.u R.v w + +def sumRank (R S : AcyclicRepresentation F n) : R.State ⊕ S.State → ℕ := + Sum.elim R.rank (fun a => Fintype.card R.State + S.rank a) + +theorem sumRank_lt (R S : AcyclicRepresentation F n) (a : R.State ⊕ S.State) : + sumRank R S a < Fintype.card (R.State ⊕ S.State) := by + cases a with + | inl a => + have h := R.rank_lt a + simp only [sumRank, Sum.elim_inl, Fintype.card_sum] + omega + | inr a => + have h := S.rank_lt a + simp only [sumRank, Sum.elim_inr, Fintype.card_sum] + omega + +theorem block_upper (R S : AcyclicRepresentation F n) + (C : Fin n → Matrix R.State S.State F) (i : Fin n) + (a b : R.State ⊕ S.State) (h : sumRank R S b ≤ sumRank R S a) : + fromBlocks (R.B i) (C i) 0 (S.B i) a b = 0 := by + cases a with + | inl a => + cases b with + | inl b => exact R.upper i a b h + | inr b => + have ha := R.rank_lt a + simp only [sumRank, Sum.elim_inl, Sum.elim_inr] at h + omega + | inr a => + cases b with + | inl b => rfl + | inr b => + apply S.upper i a b + simp only [sumRank, Sum.elim_inr] at h + omega + +def add (R S : AcyclicRepresentation F n) : AcyclicRepresentation F n where + State := R.State ⊕ S.State + fintype := inferInstance + decidableEq := inferInstance + u := Sum.elim R.u S.u + v := Sum.elim R.v S.v + B i := fromBlocks (R.B i) 0 0 (S.B i) + rank := sumRank R S + rank_lt := sumRank_lt R S + upper := block_upper R S (fun _ => 0) + +theorem add_value (R S : AcyclicRepresentation F n) (w : Word n) : + (R.add S).value w = R.value w + S.value w := + automatonValue_sumBlocks R.B S.B R.u R.v S.u S.v w + +def mul (R S : AcyclicRepresentation F n) : AcyclicRepresentation F n where + State := R.State ⊕ S.State + fintype := inferInstance + decidableEq := inferInstance + u := Sum.elim R.u 0 + v := Sum.elim ((S.u ⬝ᵥ S.v) • R.v) S.v + B := productTransition R.B S.B R.v S.u + rank := sumRank R S + rank_lt := sumRank_lt R S + upper := block_upper R S (fun i => vecMulVec R.v (S.u ᵥ* S.B i)) + +theorem mul_value (R S : AcyclicRepresentation F n) (w : Word n) : + (R.mul S).value w = convolution R.value S.value w := + automatonValue_productBlocks R.B S.B R.u R.v S.u S.v w + +def scalar (a : F) : AcyclicRepresentation F n where + State := Unit + fintype := inferInstance + decidableEq := inferInstance + u _ := a + v _ := 1 + B _ := 0 + rank _ := 0 + rank_lt _ := by simp + upper _ _ _ _ := rfl + +theorem scalar_value (a : F) (w : Word n) : + (scalar (n := n) a).value w = if w = [] then a else 0 := by + cases w with + | nil => + change (∑ _ : Unit, a * 1) = a + simp + | cons i w => + change automatonValue (fun _ : Fin n => (0 : Matrix Unit Unit F)) + ((fun _ : Unit => a) ᵥ* 0) (fun _ => 1) w = 0 + rw [vecMul_zero, automatonValue_zero] + +def ofVariable (i : Fin n) : AcyclicRepresentation F n where + State := Fin 2 + fintype := inferInstance + decidableEq := inferInstance + u a := if a = 0 then 1 else 0 + v a := if a = 1 then 1 else 0 + B j a b := if a = 0 ∧ b = 1 ∧ j = i then 1 else 0 + rank a := a.val + rank_lt a := by simp + upper j a b h := by + by_cases hab : a = 0 ∧ b = 1 ∧ j = i + · rcases hab with ⟨rfl, rfl, _⟩ + simp at h + · simp [hab] + +theorem variable_value (i : Fin n) (w : Word n) : + (ofVariable (F := F) i).value w = if w = [i] then 1 else 0 := by + change automatonValue + (fun j (a b : Fin 2) => if a = 0 ∧ b = 1 ∧ j = i then (1 : F) else 0) + (fun a : Fin 2 => if a = 0 then 1 else 0) + (fun a : Fin 2 => if a = 1 then 1 else 0) w = _ + cases w with + | nil => simp [automatonValue, dotProduct] + | cons j w => + cases w with + | nil => + simp [automatonValue, vecMul, dotProduct, Fin.sum_univ_two] + | cons k w => + have hz : ((ofVariable (F := F) i).u ᵥ* (ofVariable i).B j) ᵥ* + (ofVariable i).B k = 0 := by + change ((fun a : Fin 2 => if a = 0 then (1 : F) else 0) ᵥ* + (fun a b : Fin 2 => if a = 0 ∧ b = 1 ∧ j = i then 1 else 0)) ᵥ* + (fun a b : Fin 2 => if a = 0 ∧ b = 1 ∧ k = i then 1 else 0) = 0 + ext a + change _ = (0 : F) + fin_cases a <;> + simp [vecMul, dotProduct, Fin.sum_univ_two] + rw [ite_eq_right (show (j :: k :: w : Word n) ≠ [i] by simp)] + change automatonValue (ofVariable (F := F) i).B + (((ofVariable i).u ᵥ* (ofVariable i).B j) ᵥ* (ofVariable i).B k) + (ofVariable i).v w = 0 + rw [hz, automatonValue_zero] + +@[simp] theorem scalar_card (a : F) : Fintype.card (scalar (n := n) a).State = 1 := rfl + +@[simp] theorem variable_card (i : Fin n) : + Fintype.card (ofVariable (F := F) i).State = 2 := rfl + +@[simp] theorem add_card (R S : AcyclicRepresentation F n) : + Fintype.card (R.add S).State = Fintype.card R.State + Fintype.card S.State := + Fintype.card_sum + +@[simp] theorem mul_card (R S : AcyclicRepresentation F n) : + Fintype.card (R.mul S).State = Fintype.card R.State + Fintype.card S.State := + Fintype.card_sum + +end AcyclicRepresentation + +noncomputable def Formula.representation {F : Type*} {n : ℕ} [CommSemiring F] : + Formula F n → AcyclicRepresentation F n + | .scalar a => .scalar a + | .var i => .ofVariable i + | .add f g => f.representation.add g.representation + | .mul f g => f.representation.mul g.representation + +theorem Formula.representation_card_le {F : Type*} {n : ℕ} [CommSemiring F] + (f : Formula F n) : Fintype.card f.representation.State ≤ 2 * f.size := by + induction f with + | scalar a => change 1 ≤ 2 * 1; decide + | var i => change 2 ≤ 2 * 1; decide + | add f g ihf ihg => + change Fintype.card (f.representation.State ⊕ g.representation.State) ≤ + 2 * (f.size + g.size + 1) + rw [Fintype.card_sum] + omega + | mul f g ihf ihg => + change Fintype.card (f.representation.State ⊕ g.representation.State) ≤ + 2 * (f.size + g.size + 1) + rw [Fintype.card_sum] + omega + +theorem Formula.representation_card_pos {F : Type*} {n : ℕ} [CommSemiring F] + (f : Formula F n) : 0 < Fintype.card f.representation.State := by + induction f with + | scalar a => change 0 < 1; decide + | var i => change 0 < 2; decide + | add f g ihf ihg => + change 0 < Fintype.card (f.representation.State ⊕ g.representation.State) + rw [Fintype.card_sum] + omega + | mul f g ihf ihg => + change 0 < Fintype.card (f.representation.State ⊕ g.representation.State) + rw [Fintype.card_sum] + omega + +theorem Formula.representation_correct {F : Type*} {n : ℕ} [CommSemiring F] + (f : Formula F n) (w : Word n) : f.representation.value w = f.coeff w := by + induction f generalizing w with + | scalar a => exact AcyclicRepresentation.scalar_value a w + | var i => exact AcyclicRepresentation.variable_value i w + | add f g ihf ihg => + simp only [Formula.representation, AcyclicRepresentation.add_value, + Formula.coeff, ihf, ihg] + | mul f g ihf ihg => + simp only [Formula.representation, AcyclicRepresentation.mul_value, Formula.coeff] + congr 1 <;> funext w <;> first | exact ihf w | exact ihg w + +theorem Formula.coeff_zero_of_representation_dimension_le + {F : Type*} {n : ℕ} [CommSemiring F] (f : Formula F n) (w : Word n) + (h : Fintype.card f.representation.State ≤ w.length) : f.coeff w = 0 := by + rw [← f.representation_correct w, f.representation.value_eq_matrix, + f.representation.wordMatrix_eq_zero w h] + simp + +end NCHitting + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/Result.lean b/lean/OAI/Algebra/FormulaHitting/Result.lean new file mode 100644 index 0000000000000000000000000000000000000000..f9eb86abe4ca73e3d11e1e9ed8b997c46c3d9146 --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/Result.lean @@ -0,0 +1,24 @@ +import OAI.Algebra.FormulaHitting.Hitting +import OAI.Algebra.FormulaHitting.FormulaBridge +import OAI.Algebra.FormulaHitting.GeneratorBridge + +namespace OAI + +namespace NCHitting + +universe u + +theorem complete_result : NCHittingSpecification.CompleteTheorem.{u} := by + intro n s hn hs + apply NCHittingSpecification.completeClaim_of_hitting hn hs + intro F instField instCharZero f hsize hf + have hi := NCHitting.universal_hitting n s hn hs F f.toImplementation + (by simpa using hsize) (by simpa using hf) + intro hz + apply hi + exact (f.toImplementation_eval (fun i => Matrix.of + (fun r q => (NCHittingSpecification.expectedEntry n s i r q : F)))).trans hz + +end NCHitting + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/ScaledDerivatives.lean b/lean/OAI/Algebra/FormulaHitting/ScaledDerivatives.lean new file mode 100644 index 0000000000000000000000000000000000000000..88954de7da910a0253aa7866b1e7371229a903fb --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/ScaledDerivatives.lean @@ -0,0 +1,97 @@ +import OAI.Algebra.FormulaHitting.Wronskian +import OAI.Algebra.FormulaHitting.NumeratorRows + +namespace OAI + +noncomputable section + +namespace NCHitting + +open PowerSeries Polynomial Matrix + +variable {F : Type*} [Field F] +variable {I : Type*} [Fintype I] + +theorem derivative_scaled_power (q f : PowerSeries F) (j : ℕ) : + q * PowerSeries.derivative (R := F) (q^j * f) = + (j : PowerSeries F) * PowerSeries.derivative (R := F) q * (q^j * f) + + q^(j+1) * PowerSeries.derivative (R := F) f := by + rw [Derivation.leibniz] + cases j with + | zero => simp + | succ j => + rw [PowerSeries.derivative_pow] + simp only [Nat.add_sub_cancel, smul_eq_mul, pow_succ] + ring + +theorem coePolynomial_sum (Z : I → F[X]) : + ((∑ t : I, Z t : F[X]) : PowerSeries F) = ∑ t : I, (Z t : PowerSeries F) := + map_sum Polynomial.coeToPowerSeries.ringHom Z Finset.univ + +theorem coePolynomial_sub (p q : F[X]) : + ((p - q : F[X]) : PowerSeries F) = (p : PowerSeries F) - (q : PowerSeries F) := + map_sub Polynomial.coeToPowerSeries.ringHom p q + +theorem coePolynomial_natCast (k : ℕ) : + ((k : F[X]) : PowerSeries F) = (k : PowerSeries F) := + map_natCast Polynomial.coeToPowerSeries.ringHom k + +theorem derivative_polynomial_row (q : F[X]) (P : Matrix I I F[X]) + (G : Matrix I I (PowerSeries F)) + (hG : ∀ t l, (q : PowerSeries F) * PowerSeries.derivative (R := F) (G t l) = + ∑ a : I, (P t a : PowerSeries F) * G a l) + (Z : I → F[X]) (l : I) : + (q : PowerSeries F) * PowerSeries.derivative (R := F) + (∑ t : I, (Z t : PowerSeries F) * G t l) = + ∑ t : I, ((q * (Z t).derivative + ∑ a : I, Z a * P a t : F[X]) : + PowerSeries F) * G t l := by + classical + calc + _ = ∑ t : I, (((q : PowerSeries F) * ((Z t).derivative : PowerSeries F)) * G t l + + (Z t : PowerSeries F) * ((q : PowerSeries F) * PowerSeries.derivative (R := F) (G t l))) := by + rw [map_sum, Finset.mul_sum] + apply Finset.sum_congr rfl + intro t _ + rw [Derivation.leibniz, PowerSeries.derivative_coe] + simp only [smul_eq_mul] + ring + _ = ∑ t : I, (((q : PowerSeries F) * ((Z t).derivative : PowerSeries F)) * G t l + + ∑ a : I, (Z t : PowerSeries F) * (P t a : PowerSeries F) * G a l) := by + simp_rw [hG, Finset.mul_sum, mul_assoc] + _ = _ := by + simp only [Polynomial.coe_add, Polynomial.coe_mul, coePolynomial_sum, + add_mul, Finset.sum_mul, Finset.sum_add_distrib] + congr 1 + rw [Finset.sum_comm] + +theorem scaled_derivative_row (q : F[X]) (P : Matrix I I F[X]) (u : I → F) + (G : Matrix I I (PowerSeries F)) + (hG : ∀ t l, (q : PowerSeries F) * PowerSeries.derivative (R := F) (G t l) = + ∑ a : I, (P t a : PowerSeries F) * G a l) + (j : ℕ) (l : I) : + (q : PowerSeries F)^j * derivativeIter j + (∑ t : I, PowerSeries.C (u t) * G t l) = + ∑ t : I, (numeratorRow q P u j t : PowerSeries F) * G t l := by + classical + induction j with + | zero => simp [derivativeIter, numeratorRow] + | succ j ih => + have hd := congrArg (fun f : PowerSeries F => + (q : PowerSeries F) * PowerSeries.derivative (R := F) f) ih + rw [derivative_scaled_power, derivative_polynomial_row q P G hG] at hd + have he := eq_sub_of_add_eq' hd + change (q : PowerSeries F)^(j+1) * PowerSeries.derivative (R := F) + (derivativeIter j (∑ t : I, PowerSeries.C (u t) * G t l)) = _ + rw [he, ih] + simp only [numeratorRow, Polynomial.coe_add, coePolynomial_sub, + Polynomial.coe_mul, coePolynomial_sum, + PowerSeries.derivative_coe, Finset.mul_sum, Finset.sum_sub_distrib, + Finset.sum_add_distrib, add_mul, sub_mul, map_natCast, coePolynomial_natCast] + simp only [mul_comm, mul_left_comm, mul_assoc] + ring + +end NCHitting + +end + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/Series.lean b/lean/OAI/Algebra/FormulaHitting/Series.lean new file mode 100644 index 0000000000000000000000000000000000000000..8857570e3355b3153cbc6053b620ab75e10405e6 --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/Series.lean @@ -0,0 +1,221 @@ +import Mathlib.RingTheory.PowerSeries.Derivative +import Mathlib.RingTheory.PowerSeries.Order +import Mathlib.Algebra.BigOperators.NatAntidiagonal +import Mathlib.Tactic.Ring +import Mathlib.Tactic.FieldSimp +import Lean.Elab.Tactic.Omega + +namespace OAI + +noncomputable section +open PowerSeries +namespace NCHitting + +variable {F : Type*} [Field F] [CharZero F] + +def integral (a : PowerSeries F) : PowerSeries F := + PowerSeries.mk fun r => match r with + | 0 => 0 + | r + 1 => PowerSeries.coeff r a / (r + 1 : F) + +omit [CharZero F] in +@[simp] theorem coeff_integral_zero (a : PowerSeries F) : + PowerSeries.coeff 0 (integral a) = 0 := by simp [integral] + +omit [CharZero F] in +@[simp] theorem coeff_integral_succ (a : PowerSeries F) (r : ℕ) : + PowerSeries.coeff (r+1) (integral a) = PowerSeries.coeff r a / (r+1 : F) := by + simp [integral] + +omit [CharZero F] in +@[simp] theorem constantCoeff_integral (a : PowerSeries F) : + PowerSeries.constantCoeff (integral a) = 0 := by + simpa only [PowerSeries.coeff_zero_eq_constantCoeff] using coeff_integral_zero a + +@[simp] theorem derivative_integral (a : PowerSeries F) : + PowerSeries.derivative (R := F) (integral a) = a := by + ext r + rw [PowerSeries.coeff_derivative, coeff_integral_succ] + exact div_mul_cancel₀ _ (by simpa using (Nat.cast_ne_zero.mpr (Nat.succ_ne_zero r) : ((r + 1 : ℕ) : F) ≠ 0)) + +theorem integral_unique (a b : PowerSeries F) + (hd : PowerSeries.derivative (R := F) b = a) (hc : PowerSeries.constantCoeff b = 0) : + b = integral a := by + apply PowerSeries.derivative.ext + · simpa using hd + · simpa using hc + +omit [CharZero F] in +@[simp] theorem integral_zero : integral (0 : PowerSeries F) = 0 := by + ext r + cases r <;> simp [integral] + +omit [CharZero F] in +@[simp] theorem integral_add (a b : PowerSeries F) : + integral (a+b) = integral a + integral b := by + ext r + cases r with + | zero => simp + | succ r => simp [add_div] + +omit [CharZero F] in +@[simp] theorem integral_smul (c : F) (a : PowerSeries F) : + integral (c • a) = c • integral a := by + ext r + cases r with + | zero => simp + | succ r => simp [smul_eq_mul, mul_div_assoc] + +def kernel (i : ℕ) : PowerSeries F := + PowerSeries.mk fun r => (-1 : F)^r / (i : F)^(r+1) + +omit [CharZero F] in +@[simp] theorem coeff_kernel (i r : ℕ) : + PowerSeries.coeff r (kernel (F := F) i) = (-1 : F)^r / (i : F)^(r+1) := by + simp [kernel] + +def J (i : ℕ) (a : PowerSeries F) : PowerSeries F := integral (a * kernel i) + +@[simp] theorem derivative_J (i : ℕ) (a : PowerSeries F) : + PowerSeries.derivative (R := F) (J i a) = a * kernel i := by simp [J] + +omit [CharZero F] in +@[simp] theorem constantCoeff_J (i : ℕ) (a : PowerSeries F) : + PowerSeries.constantCoeff (J i a) = 0 := by simp [J] + +omit [CharZero F] in +@[simp] theorem J_zero (i : ℕ) : J i (0 : PowerSeries F) = 0 := by simp [J] + +omit [CharZero F] in +@[simp] theorem J_add (i : ℕ) (a b : PowerSeries F) : + J i (a+b) = J i a + J i b := by simp [J, add_mul] + +omit [CharZero F] in +@[simp] theorem J_smul (i : ℕ) (c : F) (a : PowerSeries F) : + J i (c • a) = c • J i a := by simp [J] + +def JLinear (i : ℕ) : PowerSeries F →ₗ[F] PowerSeries F where + toFun := J i + map_add' := J_add i + map_smul' := J_smul i + +omit [CharZero F] in +@[simp] theorem J_sum {ι : Type*} (i : ℕ) (s : Finset ι) (a : ι → PowerSeries F) : + J i (∑ j ∈ s, a j) = ∑ j ∈ s, J i (a j) := + map_sum (JLinear i) a s + +omit [CharZero F] in +theorem coeff_J (i r : ℕ) (a : PowerSeries F) : + PowerSeries.coeff r (J i a) = + ∑ q ∈ Finset.range r, + ((-1 : F)^(r-q-1) / ((r : F) * (i : F)^(r-q))) * PowerSeries.coeff q a := by + cases r with + | zero => simp [J] + | succ r => + rw [J, coeff_integral_succ, PowerSeries.coeff_mul, + Finset.Nat.sum_antidiagonal_eq_sum_range_succ_mk, div_eq_mul_inv, Finset.sum_mul] + apply Finset.sum_congr rfl + intro q hq + have hqr : q ≤ r := Nat.lt_succ_iff.mp (Finset.mem_range.mp hq) + have hsub' : r+1-q = r-q+1 := by omega + simp only [coeff_kernel, hsub', Nat.add_sub_cancel, Nat.cast_add, Nat.cast_one] + simp only [div_eq_mul_inv, mul_inv_rev] + ring + +omit [CharZero F] in +theorem coeff_J_eq_zero (i r : ℕ) (a : PowerSeries F) + (h : ∀ q < r, PowerSeries.coeff q a = 0) : + PowerSeries.coeff r (J i a) = 0 := by + rw [coeff_J] + apply Finset.sum_eq_zero + intro q hq + rw [h q (Finset.mem_range.mp hq), mul_zero] + +theorem kernel_mul_linear (i : ℕ) (hi : i ≠ 0) : + kernel (F := F) i * (PowerSeries.X + PowerSeries.C (i : F)) = 1 := by + have hiF : (i : F) ≠ 0 := Nat.cast_ne_zero.mpr hi + ext r + cases r with + | zero => simp [mul_add, kernel, hiF] + | succ r => + rw [mul_add, map_add, PowerSeries.coeff_mul_C] + have hx : PowerSeries.coeff (r+1) (kernel (F := F) i * PowerSeries.X) = + PowerSeries.coeff r (kernel (F := F) i) := by + simp + rw [hx] + simp only [coeff_kernel, PowerSeries.coeff_one, Nat.succ_ne_zero, ite_false, + pow_succ] + field_simp + ring + +def wordSeries {n : ℕ} : List (Fin n) → PowerSeries F + | [] => 1 + | i :: w => J (i.val + 1) (wordSeries w) + +omit [CharZero F] in +@[simp] theorem wordSeries_nil {n : ℕ} : wordSeries (F := F) (n := n) [] = 1 := rfl +omit [CharZero F] in +@[simp] theorem wordSeries_cons {n : ℕ} (i : Fin n) (w : List (Fin n)) : + wordSeries (F := F) (i :: w) = J (i.val + 1) (wordSeries w) := rfl + +@[simp] theorem derivative_wordSeries_cons {n : ℕ} (i : Fin n) (w : List (Fin n)) : + PowerSeries.derivative (R := F) (wordSeries (i :: w)) = wordSeries w * kernel (i.val + 1) := by simp + +omit [CharZero F] in +@[simp] theorem constantCoeff_wordSeries_cons {n : ℕ} (i : Fin n) (w : List (Fin n)) : + PowerSeries.constantCoeff (wordSeries (F := F) (i :: w)) = 0 := by simp + +omit [CharZero F] in +theorem coeff_wordSeries_below {n : ℕ} (w : List (Fin n)) (r : ℕ) (hr : r < w.length) : + PowerSeries.coeff r (wordSeries (F := F) w) = 0 := by + induction w generalizing r with + | nil => simp at hr + | cons i w ih => + rw [wordSeries_cons] + apply coeff_J_eq_zero + intro q hq + apply ih q + simp only [List.length_cons] at hr + omega + +omit [CharZero F] in +theorem length_le_order_wordSeries {n : ℕ} (w : List (Fin n)) : + (w.length : ℕ∞) ≤ (wordSeries (F := F) w).order := + PowerSeries.nat_le_order _ _ (coeff_wordSeries_below w) + +section Map +variable {K : Type*} [Field K] [CharZero K] + +omit [CharZero F] [CharZero K] in +theorem map_integral (f : F →+* K) (a : PowerSeries F) : + PowerSeries.map f (integral a) = integral (PowerSeries.map f a) := by + ext r + cases r with + | zero => simp + | succ r => simp [map_div₀] + +omit [CharZero F] [CharZero K] in +theorem map_kernel (f : F →+* K) (i : ℕ) : + PowerSeries.map f (kernel (F := F) i) = kernel (F := K) i := by + ext r + simp [map_div₀] + +omit [CharZero F] [CharZero K] in +theorem map_J (f : F →+* K) (i : ℕ) (a : PowerSeries F) : + PowerSeries.map f (J i a) = J i (PowerSeries.map f a) := by + simp [J, map_integral, map_kernel] + +omit [CharZero F] [CharZero K] in +theorem map_wordSeries (f : F →+* K) {n : ℕ} (w : List (Fin n)) : + PowerSeries.map f (wordSeries (F := F) w) = wordSeries (F := K) w := by + induction w with + | nil => simp + | cons i w ih => simp [map_J, ih] + +end Map + +end NCHitting + +end + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/SeriesFaithfulness.lean b/lean/OAI/Algebra/FormulaHitting/SeriesFaithfulness.lean new file mode 100644 index 0000000000000000000000000000000000000000..7409ace51b34a1d7160da833c9422394f8161a1d --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/SeriesFaithfulness.lean @@ -0,0 +1,34 @@ +import OAI.Algebra.FormulaHitting.FormulaSeries +import OAI.Algebra.FormulaHitting.WordIndependence + +namespace OAI + +namespace NCHitting +namespace Formula + +variable {F : Type*} {n : ℕ} [Field F] [CharZero F] + +theorem series_eq_zero_iff (f : Formula F n) : f.series = 0 ↔ f.coeff = 0 := by + constructor + · intro h + have hc : Finsupp.linearCombination F (wordSeries (F := F) (n := n)) + f.polynomial = 0 := by + simpa only [Finsupp.linearCombination_apply] using + (f.series_eq_smul_sum.symm.trans h) + have hp : f.polynomial = 0 := + (linearIndependent_iff.mp (wordSeries_independent (F := F) (n := n))) f.polynomial hc + funext w + exact congrArg (fun p : Word n →₀ F => p w) hp + · intro h + have hp : f.polynomial = 0 := by + ext w + exact congrFun h w + simp [series, hp] + +theorem series_ne_zero (f : Formula F n) (hf : f.coeff ≠ 0) : f.series ≠ 0 := + mt f.series_eq_zero_iff.mp hf + +end Formula +end NCHitting + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/Specification.lean b/lean/OAI/Algebra/FormulaHitting/Specification.lean new file mode 100644 index 0000000000000000000000000000000000000000..d41795bbdf89f7e4ff441de4058c8e5321c1f894 --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/Specification.lean @@ -0,0 +1,135 @@ +import Mathlib.Data.Matrix.Basic +import Mathlib.Data.Rat.Cast.Order +import Mathlib.Algebra.BigOperators.Group.Finset.Basic +import OAI.Algebra.FormulaHitting.BitModel +import OAI.Algebra.FormulaHitting.BitRefinement + +namespace OAI + +namespace NCHittingSpecification + +universe u + +inductive Formula (F : Type*) (n : ℕ) where + | scalar : F → Formula F n + | variable : Fin n → Formula F n + | add : Formula F n → Formula F n → Formula F n + | multiply : Formula F n → Formula F n → Formula F n + +namespace Formula + +def gates {F : Type*} {n : ℕ} : Formula F n → ℕ + | .scalar _ => 1 + | .variable _ => 1 + | .add f g => gates f + gates g + 1 + | .multiply f g => gates f + gates g + 1 + +noncomputable def coefficient {F : Type*} {n : ℕ} [Semiring F] : + Formula F n → List (Fin n) → F + | .scalar a, w => if w = [] then a else 0 + | .variable i, w => if w = [i] then 1 else 0 + | .add f g, w => coefficient f w + coefficient g w + | .multiply f g, w => + ∑ k ∈ Finset.range (w.length + 1), + coefficient f (w.take k) * coefficient g (w.drop k) + +def evaluate {F : Type*} {n d : ℕ} [Field F] + (T : Fin n → Matrix (Fin d) (Fin d) F) : + Formula F n → Matrix (Fin d) (Fin d) F + | .scalar a => Matrix.scalar (Fin d) a + | .variable i => T i + | .add f g => evaluate T f + evaluate T g + | .multiply f g => evaluate T f * evaluate T g + +end Formula + +def dimension (n s : ℕ) : ℕ := + if n = 1 ∧ s = 1 then 1 else 2 * n * s ^ 2 + +def expectedEntry (n s : ℕ) (i : Fin n) + (r q : Fin (dimension n s)) : ℚ := + if n = 1 ∧ s = 1 then 1 + else if q.val < r.val then + (-1 : ℚ) ^ (r.val - q.val - 1) / + ((r.val : ℚ) * ((i.val + 1 : ℕ) : ℚ) ^ (r.val - q.val)) + else 0 + +def UniversalHitting (n s d : ℕ) + (T : Fin n → Matrix (Fin d) (Fin d) ℚ) : Prop := + ∀ (F : Type*) [Field F] [CharZero F], ∀ f : Formula F n, + f.gates ≤ s → (∃ w, f.coefficient w ≠ 0) → + f.evaluate (fun i r q => (T i r q : F)) ≠ 0 + +open NCHitting.BitModel + +def expectedProgram : Program := + .branch (.mul (.equal (.read 0) (.literal 1)) (.equal (.read 1) (.literal 1))) + (.emit (.literal 0) (.literal 1) (.literal 1)) + (.loop (.read 0) + (.loop (.mul (.mul (.literal 2) (.read 1)) (.power (.read 2) (.literal 2))) + (.loop (.mul (.mul (.literal 2) (.read 2)) (.power (.read 3) (.literal 2))) + (.branch (.less (.read 0) (.read 1)) + (.emit (.odd (.sub (.sub (.read 1) (.read 0)) (.literal 1))) + (.literal 1) + (.mul (.read 1) (.power (.add (.read 2) (.literal 1)) + (.sub (.read 1) (.read 0))))) + (.emit (.literal 0) (.literal 0) (.literal 1)))))) + +def expectedCode (i r q : ℕ) : NCHitting.BitModel.RationalCode := + if q < r then ⟨decide ((r - q - 1) % 2 = 1), 1, r * (i + 1) ^ (r - q)⟩ + else ⟨false, 0, 1⟩ + +def expectedOutput (n s : ℕ) : List NCHitting.BitModel.RationalCode := + if n = 1 ∧ s = 1 then [⟨false, 1, 1⟩] + else (List.range n).flatMap fun i => + (List.range (2 * n * s ^ 2)).flatMap fun r => + (List.range (2 * n * s ^ 2)).map fun q => expectedCode i r q + +def decode (entry : NCHitting.BitModel.RationalCode) : ℚ := + (if entry.negative then -(entry.numerator : ℚ) else entry.numerator) / entry.denominator + +def entryBitBound (n d : ℕ) : ℕ := 3 + d.size + d * n.size + +def costBound (n s : ℕ) : ℕ := + let d := 2 * n * s ^ 2 + let M := n + s + d + 3 + let B := M * M + 4 * M + 10 + let R := 5 * (M + 1) + 6 + let P := 8 * (M * M + 2) * (M + 1) + 4 * (M + 3) + 1 + let E := R + 8 * B * B + 8 * B + (2 + M * P) + 10 + let L := M + 1 + 4 * (M + 3) + 1 + let entryCost := 20 * E + B + 20 + let entryOutput := B + 3 + let rowCost := 7 * E + 1 + d * (entryCost + L + entryOutput) + let rowOutput := d * entryOutput + let variableCost := 7 * E + 1 + d * (rowCost + L + rowOutput) + let variableOutput := d * rowOutput + 2 * (M + 1) + 7 * E + 15 + (R + 1 + n * (variableCost + L + variableOutput)) + 1 + +def primitiveBitBound (n s : ℕ) : ℕ := 1024 * costBound n s ^ 3 + +def CompleteClaim (n s : ℕ) : Prop := + let d := dimension n s + let result := execute expectedProgram [n, s] + 0 < d ∧ d ≤ 2 * n * s ^ 2 ∧ + result.output = expectedOutput n s ∧ + result.output.length = n * d * d ∧ + (∀ entry ∈ result.output, + 0 < entry.denominator ∧ entry.numerator ≤ 1 ∧ + entry.denominator.size ≤ entryBitBound n d ∧ + entry.bits ≤ 4 + entryBitBound n d) ∧ + (∀ (i : Fin n) (r q : Fin d), + decode ((result.output[i.val * d * d + r.val * d + q.val]?).getD ⟨false, 0, 1⟩) = + expectedEntry n s i r q) ∧ + result.cost ≤ costBound n s ∧ + (NCHitting.BitRefinement.Exec expectedProgram [n, s] result.output + (NCHitting.BitRefinement.executionSteps expectedProgram [n, s]) ∧ + NCHitting.BitRefinement.executionSteps expectedProgram [n, s] ≤ primitiveBitBound n s) ∧ + UniversalHitting.{u} n s d (expectedEntry n s) + +def CompleteTheorem : Prop := + ∀ n s : ℕ, 1 ≤ n → 1 ≤ s → CompleteClaim.{u} n s + +end NCHittingSpecification + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/System.lean b/lean/OAI/Algebra/FormulaHitting/System.lean new file mode 100644 index 0000000000000000000000000000000000000000..5fb576f9da2bb6730347c6ca000057ece4047ab8 --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/System.lean @@ -0,0 +1,301 @@ +import OAI.Algebra.FormulaHitting.Representation +import OAI.Algebra.FormulaHitting.Series +import Mathlib.LinearAlgebra.Matrix.NonsingularInverse +import Mathlib.Algebra.Polynomial.BigOperators +import Mathlib.RingTheory.PowerSeries.Inverse + +namespace OAI + +noncomputable section +namespace NCHitting +namespace AcyclicRepresentation + +open Matrix +variable {F : Type*} {n : ℕ} [Field F] [CharZero F] + +omit [CharZero F] in +theorem J_sum {I : Type*} (i : ℕ) (s : Finset I) (f : I → PowerSeries F) : + J i (∑ a ∈ s, f a) = ∑ a ∈ s, J i (f a) := by + classical + induction s using Finset.induction_on with + | empty => simp + | @insert a s ha ih => simp [ha, J_add, ih] + +omit [CharZero F] in +theorem J_C_mul (i : ℕ) (c : F) (f : PowerSeries F) : + J i (PowerSeries.C c * f) = PowerSeries.C c * J i f := by + simpa only [PowerSeries.smul_eq_C_mul] using J_smul i c f + +def systemLevel (R : AcyclicRepresentation F n) : + ℕ → Matrix R.State R.State (PowerSeries F) + | 0 => 1 + | k + 1 => fun a b => ∑ i : Fin n, ∑ c : R.State, + PowerSeries.C (R.B i a c) * J (i.val + 1) (systemLevel R k c b) + +def systemMatrix (R : AcyclicRepresentation F n) : + Matrix R.State R.State (PowerSeries F) := + fun a b => ∑ i : Fin n, PowerSeries.C (R.B i a b) * kernel (i.val + 1) + +def fundamentalMatrix (R : AcyclicRepresentation F n) : + Matrix R.State R.State (PowerSeries F) := + fun a b => ∑ k ∈ Finset.range (Fintype.card R.State), R.systemLevel k a b + +def denominator (n : ℕ) : Polynomial F := + ∏ i : Fin n, (Polynomial.X + Polynomial.C ((i.val + 1 : ℕ) : F)) + +def cofactor (i : Fin n) : Polynomial F := + ∏ j ∈ Finset.univ.erase i, (Polynomial.X + Polynomial.C ((j.val + 1 : ℕ) : F)) + +def systemNumerator (R : AcyclicRepresentation F n) : + Matrix R.State R.State (Polynomial F) := + fun a b => ∑ i : Fin n, Polynomial.C (R.B i a b) * cofactor i + +omit [CharZero F] in +theorem denominator_eq (i : Fin n) : denominator (F := F) n = + (Polynomial.X + Polynomial.C ((i.val + 1 : ℕ) : F)) * cofactor i := by + exact (Finset.mul_prod_erase _ _ (Finset.mem_univ i)).symm + +omit [CharZero F] in +theorem denominator_degree : (denominator (F := F) n).natDegree ≤ n := by + apply (Polynomial.natDegree_prod_le _ _).trans + simp only [Polynomial.natDegree_X_add_C] + simp + +omit [CharZero F] in +theorem cofactor_degree (i : Fin n) : (cofactor (F := F) i).natDegree ≤ n - 1 := by + apply (Polynomial.natDegree_prod_le _ _).trans + simp only [Polynomial.natDegree_X_add_C] + simp + +omit [CharZero F] in +theorem systemNumerator_degree (R : AcyclicRepresentation F n) (a b : R.State) : + (R.systemNumerator a b).natDegree ≤ n - 1 := by + apply Polynomial.natDegree_sum_le_of_forall_le + intro i _ + exact (Polynomial.natDegree_C_mul_le _ _).trans (cofactor_degree i) + +theorem denominator_eval_zero_ne : (denominator (F := F) n).eval 0 ≠ 0 := by + simp only [denominator, Polynomial.eval_prod, Polynomial.eval_add, + Polynomial.eval_X, Polynomial.eval_C, zero_add] + apply Finset.prod_ne_zero_iff.mpr + intro i _ + exact Nat.cast_ne_zero.mpr (Nat.succ_ne_zero i.val) + +theorem denominator_mul_kernel (i : Fin n) : + (denominator (F := F) n : PowerSeries F) * kernel (i.val + 1) = + (cofactor (F := F) i : PowerSeries F) := by + rw [denominator_eq i] + simp only [Polynomial.coe_mul, Polynomial.coe_add, Polynomial.coe_X, Polynomial.coe_C] + calc + (PowerSeries.X + PowerSeries.C ((i.val + 1 : ℕ) : F)) * + (cofactor (F := F) i : PowerSeries F) * kernel (i.val + 1) = + (cofactor (F := F) i : PowerSeries F) * + (kernel (i.val + 1) * (PowerSeries.X + PowerSeries.C ((i.val + 1 : ℕ) : F))) := by ring + _ = _ := by rw [kernel_mul_linear _ (Nat.succ_ne_zero _)]; simp + +omit [CharZero F] in +theorem polynomial_coe_sum {I : Type*} [Fintype I] (p : I → Polynomial F) : + ((∑ i, p i : Polynomial F) : PowerSeries F) = ∑ i, (p i : PowerSeries F) := + map_sum Polynomial.coeToPowerSeries.ringHom p Finset.univ + +theorem denominator_mul_systemMatrix (R : AcyclicRepresentation F n) (a b : R.State) : + (denominator (F := F) n : PowerSeries F) * R.systemMatrix a b = + (R.systemNumerator a b : PowerSeries F) := by + simp only [systemMatrix, systemNumerator, polynomial_coe_sum, Polynomial.coe_mul, + Polynomial.coe_C, Finset.mul_sum] + apply Finset.sum_congr rfl + intro i _ + rw [mul_left_comm, denominator_mul_kernel] + +omit [CharZero F] in +theorem systemLevel_wordSum (R : AcyclicRepresentation F n) + (k : ℕ) (a b : R.State) : + R.systemLevel k a b = ∑ w ∈ wordsOfLength n k, + PowerSeries.C (wordMatrix R.B w a b) * wordSeries w := by + induction k generalizing a b with + | zero => + by_cases h : a = b <;> + simp [systemLevel, wordsOfLength, wordMatrix, Matrix.one_apply, h] + | succ k ih => + rw [sum_wordsOfLength_succ] + simp only [systemLevel, ih, J_sum, J_C_mul, wordSeries_cons, + wordMatrix, List.map_cons, List.prod_cons, Matrix.mul_apply, + map_sum, map_mul, Finset.mul_sum, Finset.sum_mul, mul_assoc] + apply Finset.sum_congr rfl + intro i _ + exact Finset.sum_comm + +def contract (R : AcyclicRepresentation F n) : + Matrix R.State R.State (PowerSeries F) →ₗ[PowerSeries F] PowerSeries F where + toFun M := (fun a => PowerSeries.C (R.u a)) ⬝ᵥ + (M *ᵥ (fun b => PowerSeries.C (R.v b))) + map_add' M N := by simp [add_mulVec, dotProduct_add] + map_smul' c M := by simp [smul_mulVec, dotProduct_smul] + +omit [CharZero F] in +theorem contract_eq_sum (R : AcyclicRepresentation F n) + (M : Matrix R.State R.State (PowerSeries F)) : + R.contract M = ∑ b : R.State, PowerSeries.C (R.v b) * + ∑ a : R.State, PowerSeries.C (R.u a) * M a b := by + simp only [contract, LinearMap.coe_mk, AddHom.coe_mk, dotProduct, Matrix.mulVec, + Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro b _ + apply Finset.sum_congr rfl + intro a _ + ring + +omit [CharZero F] in +theorem contract_wordMatrix (R : AcyclicRepresentation F n) (w : Word n) : + R.contract ((wordMatrix R.B w).map PowerSeries.C) = PowerSeries.C (R.value w) := by + rw [R.value_eq_matrix] + simp [contract, dotProduct, Matrix.mulVec, Matrix.map_apply, map_sum, map_mul] + +omit [CharZero F] in +theorem systemLevel_eq_sum (R : AcyclicRepresentation F n) (k : ℕ) : + R.systemLevel k = ∑ w ∈ wordsOfLength n k, + wordSeries (F := F) w • (wordMatrix R.B w).map PowerSeries.C := by + apply Matrix.ext + intro a b + simpa [Matrix.sum_apply, Matrix.map_apply, Pi.smul_apply, smul_eq_mul, mul_comm] using + R.systemLevel_wordSum k a b + +omit [CharZero F] in +theorem fundamentalMatrix_eq_sum (R : AcyclicRepresentation F n) : + R.fundamentalMatrix = + ∑ k ∈ Finset.range (Fintype.card R.State), R.systemLevel k := by + apply Matrix.ext + intro a b + simp [fundamentalMatrix, Matrix.sum_apply] + +omit [CharZero F] in +theorem contract_fundamentalMatrix (R : AcyclicRepresentation F n) : + R.contract R.fundamentalMatrix = + ∑ k ∈ Finset.range (Fintype.card R.State), ∑ w ∈ wordsOfLength n k, + PowerSeries.C (R.value w) * wordSeries w := by + rw [fundamentalMatrix_eq_sum] + simp [systemLevel_eq_sum, contract_wordMatrix, smul_eq_mul, mul_comm] + +omit [CharZero F] in +theorem systemLevel_constant_zero (R : AcyclicRepresentation F n) + (k : ℕ) (a b : R.State) : + PowerSeries.constantCoeff (R.systemLevel (k + 1) a b) = 0 := by + simp [systemLevel] + +omit [CharZero F] in +theorem systemLevel_entry_zero (R : AcyclicRepresentation F n) + (k : ℕ) (a b : R.State) (h : R.rank b < R.rank a + k) : + R.systemLevel k a b = 0 := by + induction k generalizing a with + | zero => + have hne : a ≠ b := by intro he; subst b; simp at h + simp [systemLevel, hne] + | succ k ih => + simp only [systemLevel] + apply Finset.sum_eq_zero + intro i _ + apply Finset.sum_eq_zero + intro c _ + by_cases hc : R.rank c ≤ R.rank a + · simp [R.upper i a c hc] + · have hbc : R.rank b < R.rank c + k := by omega + rw [ih c hbc] + simp + +omit [CharZero F] in +theorem systemLevel_eq_zero (R : AcyclicRepresentation F n) + (k : ℕ) (h : Fintype.card R.State ≤ k) : R.systemLevel k = 0 := by + apply Matrix.ext + intro a b + apply R.systemLevel_entry_zero k a b + have hb := R.rank_lt b + omega + +theorem derivative_systemLevel (R : AcyclicRepresentation F n) + (k : ℕ) (a b : R.State) : + PowerSeries.derivative (R := F) (R.systemLevel (k + 1) a b) = + (R.systemMatrix * R.systemLevel k) a b := by + simp only [systemLevel, map_sum, Derivation.leibniz, smul_eq_mul, derivative_J, + PowerSeries.derivative_C, systemMatrix, Matrix.mul_apply, + Finset.sum_mul] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro c _ + apply Finset.sum_congr rfl + intro i _ + ring + +omit [CharZero F] in +theorem fundamentalMatrix_constant (R : AcyclicRepresentation F n) + (hm : 0 < Fintype.card R.State) : + R.fundamentalMatrix.map PowerSeries.constantCoeff = 1 := by + apply Matrix.ext + intro a b + obtain ⟨k, hk⟩ := Nat.exists_eq_succ_of_ne_zero (Nat.ne_of_gt hm) + simp only [Matrix.map_apply, fundamentalMatrix, hk, + Finset.sum_range_succ'] + simp [systemLevel, Matrix.one_apply] + +omit [CharZero F] in +theorem fundamentalMatrix_isUnit (R : AcyclicRepresentation F n) + (hm : 0 < Fintype.card R.State) : IsUnit R.fundamentalMatrix := by + apply (Matrix.isUnit_iff_isUnit_det _).mpr + apply (PowerSeries.isUnit_iff_constantCoeff).mpr + have hc : PowerSeries.constantCoeff R.fundamentalMatrix.det = 1 := by + rw [RingHom.map_det] + change (R.fundamentalMatrix.map PowerSeries.constantCoeff).det = 1 + rw [R.fundamentalMatrix_constant hm, Matrix.det_one] + rw [hc] + exact isUnit_one + +theorem fundamentalMatrix_derivative (R : AcyclicRepresentation F n) : + R.fundamentalMatrix.map (PowerSeries.derivative (R := F)) = + R.systemMatrix * R.fundamentalMatrix := by + apply Matrix.ext + intro a b + let D : ℕ → PowerSeries F := fun k => PowerSeries.derivative (R := F) (R.systemLevel k a b) + have hD0 : D 0 = 0 := by + by_cases h : a = b <;> simp [D, systemLevel, h] + have hDm : D (Fintype.card R.State) = 0 := by + simp [D, R.systemLevel_eq_zero _ (le_refl _)] + have hshift : (∑ k ∈ Finset.range (Fintype.card R.State), D k) = + ∑ k ∈ Finset.range (Fintype.card R.State), D (k + 1) := by + have hleft := Finset.sum_range_succ D (Fintype.card R.State) + have hright := Finset.sum_range_succ' D (Fintype.card R.State) + simpa [hD0, hDm] using hleft.symm.trans hright + simp only [Matrix.map_apply, fundamentalMatrix, map_sum] + change (∑ k ∈ Finset.range (Fintype.card R.State), D k) = _ + rw [hshift] + simp only [D, derivative_systemLevel, Matrix.mul_apply, fundamentalMatrix, + Finset.mul_sum] + exact Finset.sum_comm + +theorem fundamentalMatrix_polynomial_system (R : AcyclicRepresentation F n) + (a b : R.State) : + (denominator (F := F) n : PowerSeries F) * + PowerSeries.derivative (R := F) (R.fundamentalMatrix a b) = + ∑ c : R.State, (R.systemNumerator a c : PowerSeries F) * + R.fundamentalMatrix c b := by + have hder := congrFun (congrFun R.fundamentalMatrix_derivative a) b + change PowerSeries.derivative (R := F) (R.fundamentalMatrix a b) = + ∑ c : R.State, R.systemMatrix a c * R.fundamentalMatrix c b at hder + rw [hder, Finset.mul_sum] + apply Finset.sum_congr rfl + intro c _ + rw [← mul_assoc, denominator_mul_systemMatrix] + +end AcyclicRepresentation + +theorem Formula.system_output {F : Type*} {n : ℕ} [Field F] [CharZero F] + (f : Formula F n) : + f.representation.contract f.representation.fundamentalMatrix = + ∑ k ∈ Finset.range (Fintype.card f.representation.State), + ∑ w ∈ wordsOfLength n k, PowerSeries.C (f.coeff w) * wordSeries w := by + simp only [AcyclicRepresentation.contract_fundamentalMatrix, Formula.representation_correct] + +end NCHitting + +end + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/SystemOutput.lean b/lean/OAI/Algebra/FormulaHitting/SystemOutput.lean new file mode 100644 index 0000000000000000000000000000000000000000..84910bd9381659a0a4aae20acd19cac5a7fa0fa7 --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/SystemOutput.lean @@ -0,0 +1,16 @@ +import OAI.Algebra.FormulaHitting.System +import OAI.Algebra.FormulaHitting.FormulaSeries + +namespace OAI + +namespace NCHitting + +theorem Formula.system_output_eq_series {F : Type*} {n : ℕ} + [Field F] [CharZero F] (f : Formula F n) : + f.representation.contract f.representation.fundamentalMatrix = f.series := by + rw [f.system_output, f.series_eq_sum_of_cutoff + (Fintype.card f.representation.State) f.coeff_zero_of_representation_dimension_le] + +end NCHitting + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/WordIndependence.lean b/lean/OAI/Algebra/FormulaHitting/WordIndependence.lean new file mode 100644 index 0000000000000000000000000000000000000000..94f75ab786c6cf7783cada88539f2a6e4504ffb2 --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/WordIndependence.lean @@ -0,0 +1,341 @@ +import OAI.Algebra.FormulaHitting.Series +import OAI.Algebra.FormulaHitting.Independence +import Mathlib.Data.Finsupp.Basic +import Mathlib.Algebra.BigOperators.Finsupp.Basic +import Mathlib.LinearAlgebra.Finsupp.LinearCombination + +namespace OAI + +noncomputable section +open Polynomial PowerSeries +namespace NCHitting + +variable {F : Type*} [Field F] [CharZero F] {n : ℕ} + +abbrev PolyWords (F : Type*) [Field F] (n : ℕ) := List (Fin n) →₀ F[X] + +def polynomialEncode : PolyWords F n →+ PowerSeries F := + Finsupp.liftAddHom fun w => + { toFun := fun p => (p : PowerSeries F) * wordSeries w + map_zero' := by simp + map_add' := by intro p q; simp [add_mul] } + +omit [CharZero F] in +@[simp] theorem polynomialEncode_single (w : List (Fin n)) (p : F[X]) : + polynomialEncode (Finsupp.single w p) = (p : PowerSeries F) * wordSeries w := by + simp [polynomialEncode] + +def stripLetter (i : Fin n) : PolyWords F n →+ PolyWords F n := + Finsupp.comapDomain.addMonoidHom (List.cons_injective (a := i)) + +omit [CharZero F] in +@[simp] theorem stripLetter_apply (i : Fin n) (c : PolyWords F n) (w : List (Fin n)) : + stripLetter i c w = c (i :: w) := rfl + +omit [CharZero F] in +@[simp] theorem stripLetter_single_nil (i : Fin n) (p : F[X]) : + stripLetter i (Finsupp.single [] p) = 0 := by + ext w + simp [stripLetter_apply] + +omit [CharZero F] in +@[simp] theorem stripLetter_single_cons (i j : Fin n) (w : List (Fin n)) (p : F[X]) : + stripLetter i (Finsupp.single (j :: w) p) = + if i = j then Finsupp.single w p else 0 := by + classical + by_cases h : i = j + · subst j + ext v + simp [stripLetter_apply, Finsupp.single_apply] + · ext v + simp [stripLetter_apply, h] + +def polynomialDifferential (q p0 : F[X]) : F[X] →+ F[X] where + toFun p := q * (p0 * p.derivative - p0.derivative * p) + map_zero' := by simp + map_add' p r := by simp [Polynomial.derivative_add]; ring + +def polynomialMul (q : F[X]) : F[X] →+ F[X] where + toFun p := q * p + map_zero' := mul_zero q + map_add' := mul_add q + +def polynomialTransform (q p0 : F[X]) (Q : Fin n → F[X]) : PolyWords F n →+ PolyWords F n := + Finsupp.mapRange.addMonoidHom (polynomialDifferential q p0) + + ∑ i, (Finsupp.mapRange.addMonoidHom (polynomialMul (p0 * Q i))).comp (stripLetter i) + +omit [CharZero F] in +@[simp] theorem polynomialTransform_apply (q p0 : F[X]) (Q : Fin n → F[X]) + (c : PolyWords F n) (w : List (Fin n)) : + polynomialTransform q p0 Q c w = + q * (p0 * (c w).derivative - p0.derivative * c w) + + ∑ i, (p0 * Q i) * c (i :: w) := by + classical + simp [polynomialTransform, polynomialDifferential, polynomialMul] + +omit [CharZero F] in +@[simp] theorem polynomialTransform_single_nil (q p0 : F[X]) (Q : Fin n → F[X]) + (p : F[X]) : + polynomialTransform q p0 Q (Finsupp.single [] p) = + Finsupp.single [] (q * (p0 * p.derivative - p0.derivative * p)) := by + classical + simp [polynomialTransform, polynomialDifferential, polynomialMul] + +omit [CharZero F] in +@[simp] theorem polynomialTransform_single_cons (q p0 : F[X]) (Q : Fin n → F[X]) + (i : Fin n) (w : List (Fin n)) (p : F[X]) : + polynomialTransform q p0 Q (Finsupp.single (i :: w) p) = + Finsupp.single (i :: w) (q * (p0 * p.derivative - p0.derivative * p)) + + Finsupp.single w ((p0 * Q i) * p) := by + classical + simp [polynomialTransform, polynomialDifferential, polynomialMul, apply_ite] + +omit [CharZero F] in +theorem polynomialEncode_transform (q p0 : F[X]) (Q : Fin n → F[X]) + (hq : ∀ (i : Fin n) (w : List (Fin n)), + (q : PowerSeries F) * PowerSeries.derivative (R := F) (wordSeries (i :: w)) = + (Q i : PowerSeries F) * wordSeries w) + (c : PolyWords F n) : + polynomialEncode (polynomialTransform q p0 Q c) = + (q : PowerSeries F) * ((p0 : PowerSeries F) * + PowerSeries.derivative (R := F) (polynomialEncode c) - + (p0.derivative : PowerSeries F) * polynomialEncode c) := by + classical + induction c using Finsupp.induction_linear with + | zero => simp + | add c d hc hd => + simp only [map_add, hc, hd] + ring + | single w p => + cases w with + | nil => simp [PowerSeries.derivative_coe] + | cons i w => + rw [polynomialTransform_single_cons, map_add, polynomialEncode_single, + polynomialEncode_single, polynomialEncode_single] + simp only [Polynomial.coe_mul, Polynomial.coe_sub] + symm + calc + _ = ((q : PowerSeries F) * ((p0 : PowerSeries F) * + (p.derivative : PowerSeries F) - (p0.derivative : PowerSeries F) * + (p : PowerSeries F))) * + wordSeries (i :: w) + + ((p0 : PowerSeries F) * (p : PowerSeries F)) * + ((q : PowerSeries F) * PowerSeries.derivative (R := F) (wordSeries (i :: w))) := by + rw [Derivation.leibniz, PowerSeries.derivative_coe] + simp only [smul_eq_mul] + ring + _ = _ := by rw [hq]; ring + +def naturalPoles (i : Fin n) : F := -((i.val + 1 : ℕ) : F) + +theorem naturalPoles_injective : Function.Injective (naturalPoles (F := F) (n := n)) := by + intro i j h + apply Fin.ext + have he : ((i.val + 1 : ℕ) : F) = ((j.val + 1 : ℕ) : F) := neg_injective h + have hn := Nat.cast_injective he + omega + +omit [CharZero F] in +theorem natural_poleProduct_ne_zero : poleProduct (naturalPoles (F := F) (n := n)) ≠ 0 := by + apply Finset.prod_ne_zero_iff.mpr + intro i hi + exact Polynomial.X_sub_C_ne_zero _ + +theorem natural_poleProduct_mul_kernel (i : Fin n) : + (poleProduct (naturalPoles (F := F) (n := n)) : PowerSeries F) * kernel (i.val + 1) = + (puncturedPoleProduct (naturalPoles (F := F)) i : PowerSeries F) := by + rw [poleProduct_eq _ i] + simp only [Polynomial.coe_mul, Polynomial.coe_add, + Polynomial.coe_X, Polynomial.coe_C, + naturalPoles, map_neg, sub_neg_eq_add] + calc + _ = (puncturedPoleProduct (naturalPoles (F := F)) i : PowerSeries F) * + (kernel (i.val + 1) * (PowerSeries.X + PowerSeries.C (((i.val + 1 : ℕ) : F)))) := by ring + _ = _ := by rw [kernel_mul_linear _ (Nat.succ_ne_zero _)]; simp + +theorem natural_poleProduct_derivative (i : Fin n) (w : List (Fin n)) : + (poleProduct (naturalPoles (F := F) (n := n)) : PowerSeries F) * + PowerSeries.derivative (R := F) (wordSeries (i :: w)) = + (puncturedPoleProduct (naturalPoles (F := F)) i : PowerSeries F) * wordSeries w := by + rw [derivative_wordSeries_cons] + rw [mul_left_comm, natural_poleProduct_mul_kernel, mul_comm] + +def LengthBound (D : ℕ) (c : PolyWords F n) : Prop := + ∀ w, c w ≠ 0 → w.length ≤ D + +def topSupport (D : ℕ) (c : PolyWords F n) : Finset (List (Fin n)) := + c.support.filter fun w => w.length = D + +omit [CharZero F] in +@[simp] theorem mem_topSupport (D : ℕ) (c : PolyWords F n) (w : List (Fin n)) : + w ∈ topSupport D c ↔ c w ≠ 0 ∧ w.length = D := by + simp [topSupport] + +omit [CharZero F] in +theorem transform_lengthBound (D : ℕ) (c : PolyWords F n) (hc : LengthBound D c) + (q p0 : F[X]) (Q : Fin n → F[X]) : LengthBound D (polynomialTransform q p0 Q c) := by + intro w hw + by_contra hlen + have hcw : c w = 0 := by + by_contra hne + exact hlen (hc w hne) + have hchild : ∀ i, c (i :: w) = 0 := by + intro i + by_contra hne + have hb := hc (i :: w) hne + simp only [List.length_cons] at hb + omega + apply hw + simp [hcw, hchild] + +omit [CharZero F] in +theorem transform_top_coefficient (D : ℕ) (c : PolyWords F n) (hc : LengthBound D c) + (q p0 : F[X]) (Q : Fin n → F[X]) (w : List (Fin n)) (hw : w.length = D) : + polynomialTransform q p0 Q c w = q * (p0 * (c w).derivative - p0.derivative * c w) := by + have hchild : ∀ i, c (i :: w) = 0 := by + intro i + by_contra hne + have hb := hc (i :: w) hne + simp only [List.length_cons, hw] at hb + omega + simp [hchild] + +omit [CharZero F] in +private theorem topSupport_transform_ssubset (D : ℕ) (c : PolyWords F n) + (hc : LengthBound D c) (q : F[X]) (Q : Fin n → F[X]) + (w0 : List (Fin n)) (hw0 : w0 ∈ topSupport D c) : + topSupport D (polynomialTransform q (c w0) Q c) ⊂ topSupport D c := by + have hsub : topSupport D (polynomialTransform q (c w0) Q c) ⊆ topSupport D c := by + intro w hw + obtain ⟨hne, hlen⟩ := (mem_topSupport _ _ _).mp hw + apply (mem_topSupport _ _ _).mpr + refine ⟨?_, hlen⟩ + intro hz + apply hne + rw [transform_top_coefficient D c hc q (c w0) Q w hlen, hz] + simp + apply Finset.ssubset_iff_subset_ne.mpr + refine ⟨hsub, ?_⟩ + intro heq + have hm : w0 ∈ topSupport D (polynomialTransform q (c w0) Q c) := by rwa [heq] + have hz : polynomialTransform q (c w0) Q c w0 = 0 := by + rw [transform_top_coefficient D c hc q (c w0) Q w0 + ((mem_topSupport _ _ _).mp hw0).2] + ring + exact ((mem_topSupport _ _ _).mp hm).1 hz + +theorem polynomialEncode_eq_zero (D : ℕ) (c : PolyWords F n) + (hc : LengthBound D c) (he : polynomialEncode c = 0) : c = 0 := by + classical + induction D generalizing c with + | zero => + have hs : c = Finsupp.single [] (c []) := by + ext w + cases w with + | nil => simp + | cons i w => + have hz : c (i :: w) = 0 := by + by_contra hne + have hh := hc (i :: w) hne + simp [List.length_cons] at hh + simp [hz] + have hz : c [] = 0 := by + have hh := he + rw [hs, polynomialEncode_single, wordSeries_nil, mul_one] at hh + exact Polynomial.coe_eq_zero_iff.mp hh + rw [hs, hz, Finsupp.single_zero] + | succ D ih => + by_contra hcne + have top_exists : ∀ b : PolyWords F n, LengthBound (D+1) b → + polynomialEncode b = 0 → b ≠ 0 → (topSupport (D+1) b).Nonempty := by + intro b hb hbe hbne + by_contra hn + apply hbne + apply ih b ?_ hbe + intro w hw + have hbnd := hb w hw + have hneq : w.length ≠ D+1 := by + intro hlen + exact hn ⟨w, (mem_topSupport _ _ _).mpr ⟨hw, hlen⟩⟩ + omega + let P : ℕ → Prop := fun k => ∃ b : PolyWords F n, + LengthBound (D+1) b ∧ polynomialEncode b = 0 ∧ b ≠ 0 ∧ + (topSupport (D+1) b).card = k + have hex : ∃ k, P k := ⟨(topSupport (D+1) c).card, c, hc, he, hcne, rfl⟩ + obtain ⟨b, hb, hbe, hbne, hbcard⟩ := Nat.find_spec hex + obtain ⟨w0, hw0⟩ := top_exists b hb hbe hbne + have hp0 : b w0 ≠ 0 := ((mem_topSupport _ _ _).mp hw0).1 + have hwlen : w0.length = D+1 := ((mem_topSupport _ _ _).mp hw0).2 + let q := poleProduct (naturalPoles (F := F) (n := n)) + let Q := puncturedPoleProduct (naturalPoles (F := F) (n := n)) + let p0 := b w0 + let b' := polynomialTransform q p0 Q b + have hb' : LengthBound (D+1) b' := transform_lengthBound _ b hb q p0 Q + have hb'e : polynomialEncode b' = 0 := by + rw [polynomialEncode_transform q p0 Q natural_poleProduct_derivative, hbe] + simp + have hcard : (topSupport (D+1) b').card < (topSupport (D+1) b).card := + Finset.card_lt_card (topSupport_transform_ssubset (D+1) b hb q Q w0 hw0) + have hb'zero : b' = 0 := by + by_contra hne + have hmin : Nat.find hex ≤ (topSupport (D+1) b').card := + Nat.find_min' hex ⟨b', hb', hb'e, hne, rfl⟩ + omega + have htop : ∀ w, w.length = D+1 → + Polynomial.wronskian p0 (b w) = 0 := by + intro w hw + have hh : polynomialTransform q p0 Q b w = 0 := by + exact DFunLike.congr_fun hb'zero w + rw [transform_top_coefficient (D+1) b hb q p0 Q w hw] at hh + have hq : q ≠ 0 := natural_poleProduct_ne_zero + exact (mul_eq_zero.mp hh).resolve_left hq + cases w0 with + | nil => simp at hwlen + | cons i v => + have hvl : v.length = D := by simpa using hwlen + have hprop : ∀ j : Fin n, ∃ a : F, b (j :: v) = a • p0 := by + intro j + apply eq_smul_of_wronskian_eq_zero p0 (b (j :: v)) hp0 + apply htop + simp [hvl] + choose a ha using hprop + have hraw : q * (p0 * (b v).derivative - p0.derivative * b v) + + ∑ j, (p0 * Q j) * b (j :: v) = 0 := by + rw [← polynomialTransform_apply] + exact DFunLike.congr_fun hb'zero v + have hsum : (∑ j, (p0 * Q j) * b (j :: v)) = + p0^2 * (∑ j, Polynomial.C (a j) * Q j) := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro j hj + rw [ha j, Polynomial.smul_eq_C_mul] + ring + rw [hsum] at hraw + have ha0 := no_polynomial_log_primitive (naturalPoles (F := F) (n := n)) + naturalPoles_injective p0 (b v) hp0 a hraw i + apply hp0 + rw [ha i, ha0, zero_smul] + +omit [CharZero F] in +private theorem linearCombination_eq_polynomialEncode (c : PolyWords F n) : + Finsupp.linearCombination F[X] (wordSeries (F := F) (n := n)) c = polynomialEncode c := by + simp [Finsupp.linearCombination_apply, polynomialEncode, Finsupp.liftAddHom_apply, + Algebra.smul_def, PowerSeries.algebraMap_apply'] + +theorem wordSeries_polynomial_independent : + LinearIndependent F[X] (wordSeries (F := F) (n := n)) := by + rw [linearIndependent_iff] + intro c hc + apply polynomialEncode_eq_zero (c.support.sup List.length) c + · intro w hw + exact Finset.le_sup (Finsupp.mem_support_iff.mpr hw) + · rwa [linearCombination_eq_polynomialEncode] at hc + +theorem wordSeries_independent : LinearIndependent F (wordSeries (F := F) (n := n)) := + wordSeries_polynomial_independent.restrict_scalars' F + +end NCHitting + +end + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/Wronskian.lean b/lean/OAI/Algebra/FormulaHitting/Wronskian.lean new file mode 100644 index 0000000000000000000000000000000000000000..b459cbcc3ce0a541975169139baaf1f6617519f3 --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/Wronskian.lean @@ -0,0 +1,196 @@ +import Mathlib.RingTheory.PowerSeries.Derivative +import Mathlib.RingTheory.PowerSeries.Order +import Mathlib.LinearAlgebra.Vandermonde +import Mathlib.Tactic.Ring +import Lean.Elab.Tactic.Omega + +namespace OAI + +noncomputable section + +namespace NCHitting + +open PowerSeries Matrix + +variable {F : Type*} [Field F] + +def derivativeIter : ℕ → PowerSeries F → PowerSeries F + | 0, f => f + | j + 1, f => PowerSeries.derivative (R := F) (derivativeIter j f) + +@[simp] theorem derivativeIter_zero (f : PowerSeries F) : derivativeIter 0 f = f := rfl + +@[simp] theorem derivativeIter_add (j : ℕ) (f g : PowerSeries F) : + derivativeIter j (f + g) = derivativeIter j f + derivativeIter j g := by + induction j with + | zero => rfl + | succ j ih => simp [derivativeIter, ih] + +@[simp] theorem derivativeIter_smul (j : ℕ) (c : F) (f : PowerSeries F) : + derivativeIter j (c • f) = c • derivativeIter j f := by + induction j with + | zero => rfl + | succ j ih => simp [derivativeIter, ih] + +theorem derivativeIter_sum {ι : Type*} (j : ℕ) (s : Finset ι) (f : ι → PowerSeries F) : + derivativeIter j (∑ i ∈ s, f i) = ∑ i ∈ s, derivativeIter j (f i) := by + induction j with + | zero => rfl + | succ j ih => simp [derivativeIter, ih] + +theorem coeff_derivativeIter (j r : ℕ) (f : PowerSeries F) : + PowerSeries.coeff r (derivativeIter j f) = + PowerSeries.coeff (r+j) f * ((r+j).descFactorial j : F) := by + induction j generalizing r with + | zero => simp [derivativeIter] + | succ j ih => + rw [derivativeIter, PowerSeries.coeff_derivative, ih] + have he : r + 1 + j = r + (j + 1) := by omega + have hs : r + (j + 1) - j = r + 1 := by omega + rw [he, Nat.descFactorial_succ, hs, Nat.cast_mul] + push_cast + ring + +theorem coeff_X_pow_derivativeIter (j r : ℕ) (f : PowerSeries F) : + PowerSeries.coeff r (PowerSeries.X ^ j * derivativeIter j f) = + PowerSeries.coeff r f * (r.descFactorial j : F) := by + rw [PowerSeries.coeff_X_pow_mul'] + split_ifs with h + · rw [coeff_derivativeIter, Nat.sub_add_cancel h] + · rw [Nat.descFactorial_of_lt (by omega), Nat.cast_zero, mul_zero] + +def derivativeTail (f : PowerSeries F) (a j : ℕ) : PowerSeries F := + PowerSeries.mk fun r => PowerSeries.coeff (r+a) f * ((r+a).descFactorial j : F) + +@[simp] theorem coeff_derivativeTail (f : PowerSeries F) (a j r : ℕ) : + PowerSeries.coeff r (derivativeTail f a j) = + PowerSeries.coeff (r+a) f * ((r+a).descFactorial j : F) := by + simp [derivativeTail] + +theorem X_pow_derivativeIter_eq (f : PowerSeries F) (a j : ℕ) + (h : ∀ r < a, PowerSeries.coeff r f = 0) : + PowerSeries.X ^ j * derivativeIter j f = + PowerSeries.X ^ a * derivativeTail f a j := by + ext r + rw [coeff_X_pow_derivativeIter, PowerSeries.coeff_X_pow_mul'] + split_ifs with ha + · rw [coeff_derivativeTail, Nat.sub_add_cancel ha] + · rw [h r (by omega), zero_mul] + +def wronskianMatrix {k : ℕ} (b : Fin k → PowerSeries F) : + Matrix (Fin k) (Fin k) (PowerSeries F) := + fun j l => derivativeIter j.val (b l) + +def wronskian {k : ℕ} (b : Fin k → PowerSeries F) : PowerSeries F := + (wronskianMatrix b).det + +theorem wronskian_linearCombination {k : ℕ} (b : Fin k → PowerSeries F) + (C : Matrix (Fin k) (Fin k) F) : + wronskian (fun l => ∑ i : Fin k, C i l • b i) = + wronskian b * PowerSeries.C C.det := by + have he : wronskianMatrix (fun l => ∑ i : Fin k, C i l • b i) = + wronskianMatrix b * (PowerSeries.C : F →+* PowerSeries F).mapMatrix C := by + funext j l + change derivativeIter j.val (∑ i : Fin k, C i l • b i) = + ∑ i : Fin k, derivativeIter j.val (b i) * PowerSeries.C (C i l) + rw [derivativeIter_sum] + simp only [derivativeIter_smul] + simp only [PowerSeries.smul_eq_C_mul] + apply Finset.sum_congr rfl + intro i _ + exact mul_comm _ _ + rw [wronskian, he, Matrix.det_mul, ← RingHom.map_det] + rfl + +def normalizedWronskianMatrix {k : ℕ} (b : Fin k → PowerSeries F) + (a : Fin k → ℕ) : Matrix (Fin k) (Fin k) (PowerSeries F) := + fun j l => derivativeTail (b l) (a l) j.val + +theorem wronskianMatrix_scaling {k : ℕ} (b : Fin k → PowerSeries F) + (a : Fin k → ℕ) (h : ∀ l r, r < a l → PowerSeries.coeff r (b l) = 0) : + Matrix.diagonal (fun j : Fin k => (PowerSeries.X : PowerSeries F)^j.val) * + wronskianMatrix b = + normalizedWronskianMatrix b a * + Matrix.diagonal (fun l => (PowerSeries.X : PowerSeries F)^(a l)) := by + ext j l + simp only [Matrix.diagonal_mul, Matrix.mul_diagonal, wronskianMatrix, + normalizedWronskianMatrix] + rw [X_pow_derivativeIter_eq (b l) (a l) j.val (h l), mul_comm] + +theorem wronskian_det_scaling {k : ℕ} (b : Fin k → PowerSeries F) + (a : Fin k → ℕ) (h : ∀ l r, r < a l → PowerSeries.coeff r (b l) = 0) : + ((∏ j : Fin k, (PowerSeries.X : PowerSeries F)^j.val) * wronskian b) = + (normalizedWronskianMatrix b a).det * + ∏ l : Fin k, (PowerSeries.X : PowerSeries F)^(a l) := by + have hd := congrArg Matrix.det (wronskianMatrix_scaling b a h) + simpa only [Matrix.det_mul, Matrix.det_diagonal, wronskian] using hd + +theorem det_descFactorial {k : ℕ} (a : Fin k → ℕ) : + (Matrix.of fun j l : Fin k => ((a l).descFactorial j.val : F)).det = + (Matrix.vandermonde fun l => (a l : F)).det := by + have hh := Matrix.det_eval_matrixOfPolynomials_eq_det_vandermonde + (fun l : Fin k => (a l : F)) (fun j : Fin k => descPochhammer F j.val) + (fun j => descPochhammer_natDegree F j.val) + (fun j => monic_descPochhammer F j.val) + rw [← Matrix.det_transpose] + change (Matrix.of fun i j : Fin k => ((a i).descFactorial j.val : F)).det = _ + simpa only [descPochhammer_eval_eq_descFactorial] using hh.symm + +theorem det_descFactorial_ne_zero [CharZero F] {k : ℕ} (a : Fin k → ℕ) + (ha : Function.Injective a) : + (Matrix.of fun j l : Fin k => ((a l).descFactorial j.val : F)).det ≠ 0 := by + rw [det_descFactorial] + apply Matrix.det_vandermonde_ne_zero_iff.mpr + exact (Nat.cast_injective (R := F)).comp ha + +theorem normalizedWronskian_constant_ne_zero [CharZero F] {k : ℕ} (b : Fin k → PowerSeries F) + (a : Fin k → ℕ) (ha : Function.Injective a) + (hb : ∀ l, PowerSeries.coeff (a l) (b l) ≠ 0) : + PowerSeries.constantCoeff (normalizedWronskianMatrix b a).det ≠ 0 := by + have he : (PowerSeries.constantCoeff : PowerSeries F →+* F).mapMatrix + (normalizedWronskianMatrix b a) = + (Matrix.of fun j l : Fin k => ((a l).descFactorial j.val : F)) * + Matrix.diagonal (fun l => PowerSeries.coeff (a l) (b l)) := by + funext j l + rw [Matrix.mul_diagonal] + change PowerSeries.constantCoeff (derivativeTail (b l) (a l) j.val) = + ((a l).descFactorial j.val : F) * PowerSeries.coeff (a l) (b l) + rw [← PowerSeries.coeff_zero_eq_constantCoeff, coeff_derivativeTail, Nat.zero_add] + exact mul_comm _ _ + rw [RingHom.map_det, he, Matrix.det_mul, Matrix.det_diagonal] + exact mul_ne_zero (det_descFactorial_ne_zero a ha) (Finset.prod_ne_zero_iff.mpr (fun l _ => hb l)) + +theorem wronskian_order_sum [CharZero F] {k : ℕ} (b : Fin k → PowerSeries F) + (a : Fin k → ℕ) (ha : Function.Injective a) + (hb : ∀ l, PowerSeries.coeff (a l) (b l) ≠ 0) + (hz : ∀ l r, r < a l → PowerSeries.coeff r (b l) = 0) : + wronskian b ≠ 0 ∧ + (wronskian b).order.toNat + (∑ j : Fin k, j.val) = ∑ l : Fin k, a l := by + have hc := normalizedWronskian_constant_ne_zero b a ha hb + have hn : (normalizedWronskianMatrix b a).det ≠ 0 := by + intro h + exact hc (by rw [h, map_zero]) + have ho : (normalizedWronskianMatrix b a).det.order = 0 := by + apply PowerSeries.order_eq_nat.mpr + exact ⟨by simpa only [PowerSeries.coeff_zero_eq_constantCoeff] using hc, + fun r hr => (Nat.not_lt_zero r hr).elim⟩ + have he := wronskian_det_scaling b a hz + simp only [Finset.prod_pow_eq_pow_sum] at he + have hw : wronskian b ≠ 0 := by + intro h + rw [h, mul_zero] at he + exact (mul_ne_zero hn (pow_ne_zero _ PowerSeries.X_ne_zero)) he.symm + refine ⟨hw, ?_⟩ + have hord := congrArg PowerSeries.order he + rw [PowerSeries.order_mul, PowerSeries.order_mul, ho, zero_add, + PowerSeries.order_X_pow, PowerSeries.order_X_pow, + ← PowerSeries.coe_toNat_order hw] at hord + have heq : (∑ j : Fin k, j.val) + (wronskian b).order.toNat = ∑ l : Fin k, a l := by + exact_mod_cast hord + omega + +end NCHitting + +end + +end OAI diff --git a/lean/OAI/Algebra/FormulaHitting/WronskianBound.lean b/lean/OAI/Algebra/FormulaHitting/WronskianBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..0892aafb65f156551f9b639ed0d2638f8ee7859d --- /dev/null +++ b/lean/OAI/Algebra/FormulaHitting/WronskianBound.lean @@ -0,0 +1,78 @@ +import OAI.Algebra.FormulaHitting.OrderBasis +import OAI.Algebra.FormulaHitting.Minors + +namespace OAI + +noncomputable section + +namespace NCHitting + +open PowerSeries Matrix Submodule + +variable {F : Type*} [Field F] [CharZero F] + +omit [CharZero F] in +theorem derivativeIter_X_dvd (f : PowerSeries F) {a j : ℕ} + (h : a+j ≤ f.order.toNat) : + PowerSeries.X^a ∣ derivativeIter j f := by + rw [PowerSeries.X_pow_dvd_iff] + intro r hr + rw [coeff_derivativeIter, PowerSeries.coeff_of_lt_order_toNat _ (by omega), zero_mul] + +omit [CharZero F] in +theorem derivativeIter_column_X_dvd (f : PowerSeries F) {k : ℕ} + (j : Fin k) : + PowerSeries.X^(f.order.toNat+1-k) ∣ derivativeIter j.val f := by + by_cases hk : k ≤ f.order.toNat+1 + · apply derivativeIter_X_dvd + have hj := j.isLt + omega + · have ha : f.order.toNat+1-k = 0 := by omega + simp [ha] + +omit [CharZero F] in +theorem order_le_wronskian_add {k : ℕ} (b : Fin k → PowerSeries F) + (hb : wronskian b ≠ 0) (y : PowerSeries F) (hy : y ≠ 0) + (hspan : y ∈ Submodule.span F (Set.range b)) : + y.order.toNat ≤ (wronskian b).order.toNat + k - 1 := by + classical + obtain ⟨c, hc⟩ := (Submodule.mem_span_range_iff_exists_fun F).mp hspan + have hex : ∃ l, c l ≠ 0 := by + by_contra h + push Not at h + apply hy + rw [← hc] + simp [h] + obtain ⟨l, hl⟩ := hex + let W := (wronskianMatrix b).updateCol l (fun j => derivativeIter j.val y) + have he : W.det = PowerSeries.C (c l) * wronskian b := by + have hcol : (fun j : Fin k => derivativeIter j.val y) = + fun j => ∑ i : Fin k, PowerSeries.C (c i) • wronskianMatrix b j i := by + funext j + rw [← hc, derivativeIter_sum] + simp only [derivativeIter_smul] + simp only [wronskianMatrix, PowerSeries.smul_eq_C_mul, smul_eq_mul] + change ((wronskianMatrix b).updateCol l _).det = _ + rw [hcol, Matrix.det_updateCol_sum] + rfl + have hd : PowerSeries.X^(y.order.toNat+1-k) ∣ W.det := by + apply dvd_det_of_column_dvd W l + intro j + simpa [W] using derivativeIter_column_X_dvd y j + have hco : (PowerSeries.C (c l)).order = 0 := by + apply PowerSeries.order_eq_nat.mpr + exact ⟨by simpa using hl, fun r hr => (Nat.not_lt_zero r hr).elim⟩ + have hlow : ((y.order.toNat+1-k : ℕ) : ℕ∞) ≤ (wronskian b).order := by + have hx := PowerSeries.nat_le_order W.det (y.order.toNat+1-k) + (PowerSeries.X_pow_dvd_iff.mp hd) + rwa [he, PowerSeries.order_mul, hco, zero_add] at hx + rw [← PowerSeries.coe_toNat_order hb] at hlow + have hn : y.order.toNat+1-k ≤ (wronskian b).order.toNat := by exact_mod_cast hlow + have hk := l.isLt + omega + +end NCHitting + +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/ActualBlocks.lean b/lean/OAI/Algebra/FrobeniusObstruction/ActualBlocks.lean new file mode 100644 index 0000000000000000000000000000000000000000..e602d2540668d4aad5fcc00cd3c1fb7b0d157bff --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/ActualBlocks.lean @@ -0,0 +1,246 @@ +import Mathlib +import OAI.Algebra.FrobeniusObstruction.BlockPairing +import OAI.Algebra.FrobeniusObstruction.ParameterLifts + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace BoundaryOnly.FormalObstruction.ActualBlocks +open Frobenius MixedForms FormsSplit GlobalForms SignedTensor +open scoped TensorProduct BigOperators +variable {k : Type*} [Field k] {d : ℕ} {n : Fin d → ℕ} + +abbrev Variables (n : Fin d → ℕ) (i : Fin d) := Bool × Fin (n i) + +def grouping : (Σ i, Variables n i) ≃ InternalVar n where + toFun x := (x.2.1, ⟨x.1,x.2.2⟩) + invFun x := ⟨x.2.1,(x.1,x.2.2)⟩ + left_inv := by rintro ⟨i,b,y⟩; rfl + right_inv := by rintro ⟨b,i,y⟩; rfl + +def coordinates : Coordinates d (Variables n) ≃ InternalVar n := + (coordinateEquiv d (Variables n)).trans grouping + +variable (ell : ℕ) [Fact ell.Prime] [CharP k ell] + +abbrev Scalar (i : Fin d) := Frobenius.Ring (ι := Variables n i) (k := k) ell +abbrev Block (i : Fin d) := GlobalForms.QForms (k := k) ell (Variables n i) +abbrev Ambient := GlobalForms.QForms (k := k) ell (InternalVar n) + +def includeScalar (i : Fin d) : Scalar (n := n) (k := k) ell i →ₐ[k] + Frobenius.Ring (ι := InternalVar n) (k := k) ell := + includeVariables ell (fun y => (y.1,⟨i,y.2⟩)) + +def includeBlock (i : Fin d) : Block (n := n) (k := k) ell i →ₐ[k] + Ambient (n := n) (k := k) ell := + (FormsReindex.equiv ell coordinates).toAlgHom.comp + (insertForms ell d (Variables n) i) + +omit [Fact ell.Prime] [CharP k ell] in +@[simp] theorem reindex_insertScalar (i : Fin d) (a : Scalar (n := n) (k := k) ell i) : + Frobenius.reindex ell coordinates (insertScalar ell d (Variables n) i a) = + includeScalar ell i a := by + have h : (Frobenius.reindex (k := k) ell (coordinates (n := n))).toAlgHom.comp + (insertScalar ell d (Variables n) i) = includeScalar ell i := by + apply algHom_ext + intro y + simp only [AlgHom.comp_apply, AlgEquiv.coe_toAlgHom, insertScalar_coordinate, reindex_coordinate, + includeScalar, includeVariables_coordinate] + congr 1 + change grouping (coordinateEquiv d (Variables n) ((coordinateEquiv d (Variables n)).symm ⟨i,y⟩)) = _ + rw [Equiv.apply_symm_apply] + rfl + exact AlgHom.congr_fun h a + +omit [Fact ell.Prime] [CharP k ell] in +@[simp] theorem includeBlock_coeff (i : Fin d) (a : Scalar (n := n) (k := k) ell i) : + includeBlock ell i (coeff a) = coeff (includeScalar ell i a) := by + simp only [includeBlock, AlgHom.comp_apply, AlgEquiv.coe_toAlgHom, insertForms_coeff, + FormsReindex.equiv_coeff, reindex_insertScalar] + +def wall (b : Bool) (i : Fin d) : + Frobenius.Ring (ι := WallVar n i) (k := k) ell →ₐ[k] Scalar (n := n) (k := k) ell i := + eval ell (Sum.elim (fun _ => 0) (fun y => coordinate ell (b,y))) (by + intro v + cases v with + | inl _ => exact zero_pow (Nat.Prime.ne_zero Fact.out) + | inr _ => exact coordinate_pow ell _) + +omit [CharP k ell] in +@[simp] theorem include_wall (b : Bool) (i : Fin d) + (x : Frobenius.Ring (ι := WallVar n i) (k := k) ell) : + includeScalar ell i (wall ell b i x) = wallSpecial ell b i x := by + have h : (includeScalar (n := n) (k := k) ell i).comp (wall ell b i) = wallSpecial ell b i := by + apply algHom_ext + intro y + simp only [AlgHom.comp_apply, wall, eval_coordinate] + cases y with + | inl j => simp only [Sum.elim_inl, map_zero, wallSpecial_slope] + | inr y => simp only [Sum.elim_inr, includeScalar, includeVariables_coordinate, + wallSpecial_internal] + exact AlgHom.congr_fun h x + +def blockPotential (D : FormalData (k := k) n) (i : Fin d) : Scalar (n := n) (k := k) ell i := + wall ell true i (Ideal.Quotient.mk _ (D.P i)) - + wall ell false i (Ideal.Quotient.mk _ (D.P i)) + +def blockSlope (D : FormalData (k := k) n) (i : Fin d) : Scalar (n := n) (k := k) ell i := + includeVariables ell (fun y => (true,y)) (Ideal.Quotient.mk _ (slopeDerivative n D.P i)) + +omit [Fact ell.Prime] [CharP k ell] in +@[simp] theorem include_blockSlope (D : FormalData (k := k) n) (i : Fin d) : + includeScalar ell i (blockSlope ell D i) = specialSlope ell D true i := by + have h : (includeScalar (k := k) ell i).comp (includeVariables ell (fun y : Fin (n i) => (true,y))) = + includeVariables ell (fun y : Fin (n i) => (true,⟨i,y⟩)) := by + apply algHom_ext + intro y + simp only [AlgHom.comp_apply, includeVariables_coordinate, includeScalar] + exact AlgHom.congr_fun h (Ideal.Quotient.mk _ (slopeDerivative n D.P i)) + +@[simp] theorem reindex_potential (D : FormalData (k := k) n) : + Frobenius.reindex ell coordinates + (GlobalForms.potential ell d (Variables n) (blockPotential ell D)) = + specialPotential ell D := by + rw [GlobalForms.potential_sum, map_sum, specialPotential_separated] + apply Finset.sum_congr rfl + intro i _ + rw [reindex_insertScalar] + simp only [blockPotential, map_sub, include_wall] + +variable (hell : 0 < ell) + +def tensorToForms : (⨂[k] i, Block (n := n) (k := k) ell i) ≃ₗ[k] + Ambient (n := n) (k := k) ell := + (blockEquiv (k := k) ell hell d (Variables n)).symm.trans + (FormsReindex.equiv ell coordinates).toLinearEquiv + +omit [Fact ell.Prime] [CharP k ell] in +@[simp] theorem tensorToForms_tprod (x : ∀ i, Block (n := n) (k := k) ell i) : + tensorToForms ell hell (PiTensorProduct.tprod k x) = + (List.ofFn fun i => includeBlock ell i (x i)).prod := by + change FormsReindex.equiv ell coordinates + ((blockEquiv ell hell d (Variables n)).symm (PiTensorProduct.tprod k x)) = _ + rw [blockEquiv_symm_tprod_prod, map_list_prod, List.map_ofFn] + rfl + +omit [Fact ell.Prime] in +@[simp] theorem tensorToForms_D (x : ⨂[k] i, Block (n := n) (k := k) ell i) : + tensorToForms ell hell (differential (Block (n := n) (k := k) ell) + (fun i => (parity (k := k) (A := Scalar (n := n) (k := k) ell i) (ι := Variables n i)).toLinearMap) + (fun i => MixedForms.d (partialDeriv (ι := Variables n i) (k := k) ell)) x) = + MixedForms.d (partialDeriv ell) (tensorToForms ell hell x) := by + change FormsReindex.equiv ell coordinates ((blockEquiv ell hell d (Variables n)).symm _) = _ + rw [← blockEquiv_symm_d, FormsReindex.equiv_d] + rfl + +@[simp] theorem tensorToForms_delta (D : FormalData (k := k) n) + (x : ⨂[k] i, Block (n := n) (k := k) ell i) : + tensorToForms ell hell (differential (Block (n := n) (k := k) ell) + (fun i => (parity (k := k) (A := Scalar (n := n) (k := k) ell i) (ι := Variables n i)).toLinearMap) + (fun i => delta (partialDeriv (ι := Variables n i) (k := k) ell) (blockPotential ell D i)) x) = + delta (partialDeriv ell) (specialPotential ell D) (tensorToForms ell hell x) := by + change FormsReindex.equiv ell coordinates ((blockEquiv ell hell d (Variables n)).symm _) = _ + rw [← blockEquiv_symm_delta, FormsReindex.equiv_delta, reindex_potential] + rfl + +omit [Fact ell.Prime] in + theorem d_includeBlock (i : Fin d) (x : Block (n := n) (k := k) ell i) : + MixedForms.d (partialDeriv ell) (includeBlock ell i x) = + includeBlock ell i (MixedForms.d (partialDeriv ell) x) := by + simp only [includeBlock, AlgHom.comp_apply, AlgEquiv.coe_toAlgHom, ← FormsReindex.equiv_d, d_insertForms] + +omit [Fact ell.Prime] in + theorem gradient_includeScalar (i : Fin d) (a : Scalar (n := n) (k := k) ell i) : + gradient (partialDeriv ell) (includeScalar ell i a) = + includeBlock ell i (gradient (partialDeriv ell) a) := by + rw [← d_coeff, ← includeBlock_coeff, d_includeBlock, d_coeff] + +omit [Fact ell.Prime] in + theorem delta_includeBlock (i : Fin d) (a : Scalar (n := n) (k := k) ell i) + (x : Block (n := n) (k := k) ell i) : + delta (partialDeriv ell) (includeScalar ell i a) (includeBlock ell i x) = + includeBlock ell i (delta (partialDeriv ell) a x) := by + rw [delta_apply, delta_apply, gradient_includeScalar, map_mul] + +end BoundaryOnly.FormalObstruction.ActualBlocks + +namespace BoundaryOnly.FormalObstruction.MixedForms +variable {k A ι t : Type*} [CommRing k] [CommRing A] [Algebra k A] +variable [Fintype ι] [DecidableEq ι] + +omit [Fintype ι] [DecidableEq ι] in +theorem list_prod_coeff_mul (l : List t) (a : t → A) + (x : t → Forms (k := k) (A := A) (ι := ι)) : + (l.map (fun i => coeff (a i) * x i)).prod = + coeff ((l.map a).prod) * (l.map x).prod := by + induction l with + | nil => simp only [List.map_nil, List.prod_nil, map_one, one_mul] + | cons i l ih => + simp only [List.map_cons, List.prod_cons, ih, map_mul] + rw [mul_assoc (coeff (a i)), ← mul_assoc (x i), ← coeff_commute, + mul_assoc, mul_assoc] + +theorem left_cycle_mul_delta (pd : ι → Derivation k A A) (F : A) + (x y : Forms (k := k) (A := A) (ι := ι)) (hx : delta pd F x = 0) : + x * delta pd F y = 0 := by + have hp : gradient pd F * parity x = 0 := by + have h := congrArg parity hx + simpa only [delta_apply, map_mul, parity_gradient, neg_mul, + map_zero, neg_eq_zero] using h + rw [gradient_supercommute, parity_sq] at hp + rw [delta_apply, ← mul_assoc, hp, zero_mul] + +end BoundaryOnly.FormalObstruction.MixedForms + +namespace BoundaryOnly.FormalObstruction.ActualBlocks +open Frobenius MixedForms FormsSplit GlobalForms SignedTensor +open scoped TensorProduct BigOperators +variable {k : Type*} [Field k] {d : ℕ} {n : Fin d → ℕ} +variable (ell : ℕ) [Fact ell.Prime] [CharP k ell] (hell : 0 < ell) + +omit [Fact ell.Prime] [CharP k ell] in + theorem tensorToForms_S (s : ∀ i, Scalar (n := n) (k := k) ell i) + (I : Finset (Fin d)) (z : ⨂[k] i, Block (n := n) (k := k) ell i) : + tensorToForms ell hell + (tensorAction (Block (n := n) (k := k) ell) (BlockTensor.S s) I z) = + coeff (∏ i ∈ I, includeScalar ell i (s i)) * tensorToForms ell hell z := by + induction z using PiTensorProduct.induction_on with + | add x y hx hy => simp only [map_add, hx, hy, mul_add] + | smul_tprod r x => + simp only [map_smul, mul_smul_comm] + congr 1 + rw [tensorAction, PiTensorProduct.map_tprod, tensorToForms_tprod, tensorToForms_tprod] + have h (i : Fin d) : + includeBlock ell i ((if i ∈ I then BlockTensor.S s i else LinearMap.id) (x i)) = + coeff (if i ∈ I then includeScalar ell i (s i) else 1) * includeBlock ell i (x i) := by + by_cases hi : i ∈ I + · simp only [ite_eq_left hi] + change includeBlock ell i (coeff (s i)*x i) = _ + rw [map_mul, includeBlock_coeff] + · simp only [ite_eq_right hi, LinearMap.id_apply, map_one, one_mul] + change (List.ofFn (fun i => includeBlock ell i + ((if i ∈ I then BlockTensor.S s i else LinearMap.id) (x i)))).prod = _ + have hh : (List.ofFn (fun i => includeBlock ell i + ((if i ∈ I then BlockTensor.S s i else LinearMap.id) (x i)))) = + List.ofFn (fun i => coeff (if i ∈ I then includeScalar ell i (s i) else 1) * + includeBlock ell i (x i)) := by + apply congrArg List.ofFn + funext i + exact h i + rw [hh] + have hp := list_prod_coeff_mul (k := k) (ι := InternalVar n) + (List.ofFn (fun i : Fin d => i)) + (fun i => if i ∈ I then includeScalar ell i (s i) else 1) + (fun i => includeBlock ell i (x i)) + simp only [List.map_ofFn, Function.comp_def] at hp + rw [hp] + congr 2 + rw [List.prod_ofFn, Finset.prod_ite_mem_eq] + +end BoundaryOnly.FormalObstruction.ActualBlocks + +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/BlockCohomology.lean b/lean/OAI/Algebra/FrobeniusObstruction/BlockCohomology.lean new file mode 100644 index 0000000000000000000000000000000000000000..9b74b166b20cf19c589b700446d0505ac7e47fe4 --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/BlockCohomology.lean @@ -0,0 +1,111 @@ +import Mathlib +import OAI.Algebra.FrobeniusObstruction.MixedForms +import OAI.Algebra.FrobeniusObstruction.Retractions + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace BoundaryOnly.FormalObstruction.BlockCohomology +open MixedForms SquareZero +variable {k A ι : Type*} [Field k] [CommRing A] [Algebra k A] + [Fintype ι] [DecidableEq ι] +variable (pd : ι → Derivation k A A) (q : A) +variable (hcomm : ∀ i j a, pd i (pd j a) = pd j (pd i a)) + +abbrev H := Cohomology (delta pd q) (delta_sq pd q) + +theorem delta_parity (x : Forms (k := k) (A := A) (ι := ι)) : + delta pd q (parity x) = -parity (delta pd q x) := by + simp only [delta_apply, map_mul, parity_gradient, neg_mul, neg_neg] + +include hcomm in +theorem delta_d (x : Forms (k := k) (A := A) (ι := ι)) : + delta pd q (d pd x) = -d pd (delta pd q x) := + eq_neg_of_add_eq_zero_right (d_delta pd hcomm q x) + +def P : Module.End k (H pd q) := + oddInduced (delta pd q) (delta_sq pd q) parity.toLinearMap (delta_parity pd q) + +def D : Module.End k (H pd q) := + oddInduced (delta pd q) (delta_sq pd q) (d pd) (delta_d pd q hcomm) + +def coefficient (s : A) : Module.End k (Forms (k := k) (A := A) (ι := ι)) := + (Algebra.lmul k _).toLinearMap (coeff s) + +omit [Fintype ι] [DecidableEq ι] in +@[simp] theorem coefficient_apply (s : A) (x : Forms (k := k) (A := A) (ι := ι)) : + coefficient s x = coeff s * x := rfl + +theorem delta_coefficient (s : A) (x : Forms (k := k) (A := A) (ι := ι)) : + delta pd q (coefficient s x) = coefficient s (delta pd q x) := by + simp only [coefficient_apply, delta_apply] + rw [← mul_assoc, ← coeff_commute, mul_assoc] + +def S (s : A) : Module.End k (H pd q) := + evenInduced (delta pd q) (delta_sq pd q) (coefficient s) (delta_coefficient pd q s) + +theorem P_sq (x : H pd q) : P pd q (P pd q x) = x := by + obtain ⟨z,rfl⟩ := classMap_surjective (delta pd q) (delta_sq pd q) x + change classMap _ _ (cycleMap _ _ _ _ (cycleMap _ _ _ _ z)) = classMap _ _ z + congr 1 + exact Subtype.ext (parity_sq (z : Forms (k := k) (A := A) (ι := ι))) + +theorem D_sq (x : H pd q) : D pd q hcomm (D pd q hcomm x) = 0 := + oddInduced_square_zero (delta pd q) (delta_sq pd q) (d pd) (delta_d pd q hcomm) + (d_sq pd hcomm) x + +theorem D_P (x : H pd q) : D pd q hcomm (P pd q x) = -P pd q (D pd q hcomm x) := by + obtain ⟨z,rfl⟩ := classMap_surjective (delta pd q) (delta_sq pd q) x + change classMap _ _ (cycleMap _ _ _ _ (cycleMap _ _ _ _ z)) = + -classMap _ _ (cycleMap _ _ _ _ (cycleMap _ _ _ _ z)) + rw [← map_neg] + congr 1 + exact Subtype.ext (d_parity pd (z : Forms (k := k) (A := A) (ι := ι))) + +theorem S_P (s : A) (x : H pd q) : S pd q s (P pd q x) = P pd q (S pd q s x) := by + obtain ⟨z,rfl⟩ := classMap_surjective (delta pd q) (delta_sq pd q) x + change classMap _ _ (cycleMap _ _ _ _ (cycleMap _ _ _ _ z)) = + classMap _ _ (cycleMap _ _ _ _ (cycleMap _ _ _ _ z)) + congr 1 + apply Subtype.ext + change coeff s * parity (z : Forms (k := k) (A := A) (ι := ι)) = parity (coeff s * (z : Forms (k := k) (A := A) (ι := ι))) + rw [map_mul, parity_coeff] + + + +theorem retraction (htwo : (2 : k) ≠ 0) (s : A) : + ∃ r h : Module.End k (H pd q), + (∀ x, D pd q hcomm (r x) = r (D pd q hcomm x)) ∧ + (∀ x, P pd q (r x) = r (P pd q x)) ∧ + (∀ x, P pd q (h x) = -h (P pd q x)) ∧ + (∀ x, x-r x = D pd q hcomm (h x) + h (D pd q hcomm x)) ∧ + (∀ x, S pd q s x = 0 → S pd q s (r x) = 0 ∧ S pd q s (D pd q hcomm (r x)) = 0) := + parity_retraction htwo (D pd q hcomm) (S pd q s) (P pd q) + (D_sq pd q hcomm) (P_sq pd q) (D_P pd q hcomm) (S_P pd q s) + + + +theorem correction (s : A) (x : Cycles (delta pd q)) + (hS : S pd q s (classMap _ (delta_sq pd q) x) = 0) + (hSD : S pd q s (D pd q hcomm (classMap _ (delta_sq pd q) x)) = 0) : + ∃ y, delta pd q y = -delta pd s x := by + apply correction_of_kernel (delta pd q) (delta_sq pd q) (d pd) + (coefficient s) (delta pd s) (delta_d pd q hcomm) + (delta_coefficient pd q s) _ _ x hS hSD + · intro z + simp only [delta_apply] + rw [← mul_assoc] + have hanti : MixedForms.gradient pd q * MixedForms.gradient pd s = + -(MixedForms.gradient pd s * MixedForms.gradient pd q) := by + rw [gradient_supercommute, parity_gradient, neg_mul] + rw [hanti, neg_mul, mul_assoc] + · intro z + exact d_commutator pd s z + +end BoundaryOnly.FormalObstruction.BlockCohomology + +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/BlockPairing.lean b/lean/OAI/Algebra/FrobeniusObstruction/BlockPairing.lean new file mode 100644 index 0000000000000000000000000000000000000000..3e54cfc6376293921ef027b61e80c36871a3123b --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/BlockPairing.lean @@ -0,0 +1,255 @@ +import Mathlib +import OAI.Algebra.FrobeniusObstruction.ChartPairing + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace BoundaryOnly.FormalObstruction +open Frobenius MixedForms +variable {k : Type*} [Field k] {d : ℕ} {n : Fin d → ℕ} +variable (ell : ℕ) (htwo : 1 < ell) [CharP k ell] [Fact ell.Prime] + + +def wallSpecial (b : Bool) (i : Fin d) : + Frobenius.Ring (ι := WallVar n i) (k := k) ell →ₐ[k] + Frobenius.Ring (ι := InternalVar n) (k := k) ell := + eval ell (Sum.elim (fun _ => 0) (fun y => coordinate ell (b,⟨i,y⟩))) (by + intro v + cases v with + | inl _ => exact zero_pow (Nat.Prime.ne_zero Fact.out) + | inr y => exact coordinate_pow ell _) + +omit [CharP k ell] in +@[simp] theorem wallSpecial_slope (b : Bool) (i : Fin d) (j : Fin 3) : + wallSpecial (n := n) (k := k) ell b i (coordinate ell (.inl j)) = 0 := + eval_coordinate ell _ _ _ + +omit [CharP k ell] in +@[simp] theorem wallSpecial_internal (b : Bool) (i : Fin d) (y : Fin (n i)) : + wallSpecial (k := k) ell b i (coordinate ell (.inr y)) = coordinate ell (b,⟨i,y⟩) := + eval_coordinate ell _ _ _ + + theorem plusCoordinates_constant_zero (i : Fin d) (v : WallVar n i) : + MvPowerSeries.constantCoeff (plusCoordinates (k := k) n i v) = 0 := by + cases v <;> simp [plusCoordinates] + + theorem minusCoordinates_constant_zero (i : Fin d) (v : WallVar n i) : + MvPowerSeries.constantCoeff (minusCoordinates (k := k) n i v) = 0 := by + cases v <;> simp [minusCoordinates] + + theorem specialAmbient_plus (i : Fin d) (p : MvPowerSeries (WallVar n i) k) : + specialAmbient (n := n) (k := k) ell (Ideal.Quotient.mk _ (MvPowerSeries.subst (plusCoordinates n i) p)) = + wallSpecial ell true i (Ideal.Quotient.mk _ p) := by + have hh : (specialAmbient (n := n) (k := k) ell).comp + (substitute ell (plusCoordinates n i) (plusCoordinates_constant_zero i)) = + wallSpecial ell true i := by + apply algHom_ext + intro v + simp only [AlgHom.comp_apply, substitute_coordinate] + cases v with + | inl j => + rw [wallSpecial_slope] + exact specialAmbient_slope ell (i,j) + | inr y => + rw [wallSpecial_internal] + exact specialAmbient_internal ell (true,⟨i,y⟩) + simpa only [AlgHom.comp_apply, substitute_mk] using + AlgHom.congr_fun hh (Ideal.Quotient.mk _ p) + + theorem specialAmbient_minus (i : Fin d) (p : MvPowerSeries (WallVar n i) k) : + specialAmbient (n := n) (k := k) ell (Ideal.Quotient.mk _ (MvPowerSeries.subst (minusCoordinates n i) p)) = + wallSpecial ell false i (Ideal.Quotient.mk _ p) := by + have hh : (specialAmbient (n := n) (k := k) ell).comp + (substitute ell (minusCoordinates n i) (minusCoordinates_constant_zero i)) = + wallSpecial ell false i := by + apply algHom_ext + intro v + simp only [AlgHom.comp_apply, substitute_coordinate] + cases v with + | inl j => simp only [minusCoordinates, map_zero, wallSpecial_slope] + | inr y => + rw [wallSpecial_internal] + exact specialAmbient_internal ell (false,⟨i,y⟩) + simpa only [AlgHom.comp_apply, substitute_mk] using + AlgHom.congr_fun hh (Ideal.Quotient.mk _ p) + + theorem specialPotential_separated (D : FormalData (k := k) n) : + specialPotential ell D = ∑ i, + (wallSpecial ell true i (Ideal.Quotient.mk _ (D.P i)) - + wallSpecial ell false i (Ideal.Quotient.mk _ (D.P i))) := by + simp only [specialPotential, potential, map_sum, map_sub, + specialAmbient_plus, specialAmbient_minus] + +omit [CharP k ell] in + theorem swap_wallSpecial (b : Bool) (i : Fin d) + (x : Frobenius.Ring (ι := WallVar n i) (k := k) ell) : + Frobenius.reindex ell swapEquiv (wallSpecial ell b i x) = wallSpecial ell (!b) i x := by + have hh : (Frobenius.reindex (k := k) ell (swapEquiv (n := n))).toAlgHom.comp + (wallSpecial (k := k) ell b i) = wallSpecial ell (!b) i := by + apply algHom_ext + intro v + cases v <;> simp only [AlgHom.comp_apply, AlgEquiv.coe_toAlgHom, + wallSpecial_slope, wallSpecial_internal, map_zero, + reindex_coordinate, swapEquiv_apply] + exact AlgHom.congr_fun hh x + + theorem specialPotential_swap (D : FormalData (k := k) n) : + Frobenius.reindex ell swapEquiv (specialPotential ell D) = -specialPotential ell D := by + rw [specialPotential_separated] + simp only [map_sum, map_sub, swap_wallSpecial, Bool.not_true, Bool.not_false] + rw [← Finset.sum_neg_distrib] + apply Finset.sum_congr rfl + intro i _ + abel + + theorem negativeNormal_d (D : FormalData (k := k) n) : + MixedForms.d (partialDeriv ell) (negativeNormal ell htwo D) = 0 := by + rw [negativeNormal, ← FormsReindex.equiv_d, specialNormal_d, map_zero] + +omit [Fact ell.Prime] in + theorem gradient_neg (x : Frobenius.Ring (ι := InternalVar n) (k := k) ell) : + MixedForms.gradient (partialDeriv ell) (-x) = -MixedForms.gradient (partialDeriv ell) x := by + change MixedForms.d (partialDeriv ell) (coeff (-x)) = -MixedForms.d (partialDeriv ell) (coeff x) + rw [map_neg, map_neg] + + theorem negativeNormal_delta (D : FormalData (k := k) n) : + delta (partialDeriv ell) (specialPotential ell D) (negativeNormal ell htwo D) = 0 := by + have hh := congrArg (FormsReindex.equiv ell swapEquiv) (specialNormal_delta ell htwo D) + rw [FormsReindex.equiv_delta, specialPotential_swap, map_zero, delta_apply, + gradient_neg, neg_mul, neg_eq_zero] at hh + exact hh + + +def specialSlope (D : FormalData (k := k) n) (b : Bool) (i : Fin d) : + Frobenius.Ring (ι := InternalVar n) (k := k) ell := + includeVariables ell (fun y => (b,⟨i,y⟩)) + (Ideal.Quotient.mk _ (slopeDerivative n D.P i)) + +omit [CharP k ell] [Fact ell.Prime] in + theorem specialSlope_swap (D : FormalData (k := k) n) (b : Bool) (i : Fin d) : + Frobenius.reindex ell swapEquiv (specialSlope ell D b i) = specialSlope ell D (!b) i := by + have hh : (Frobenius.reindex (k := k) ell (swapEquiv (n := n))).toAlgHom.comp + (includeVariables (k := k) ell (fun y : Fin (n i) => ((b,⟨i,y⟩) : InternalVar n))) = + includeVariables ell (fun y : Fin (n i) => ((!b,⟨i,y⟩) : InternalVar n)) := by + apply algHom_ext + intro y + simp only [AlgHom.comp_apply, AlgEquiv.coe_toAlgHom, + includeVariables_coordinate, reindex_coordinate, swapEquiv_apply] + exact AlgHom.congr_fun hh _ + +omit [CharP k ell] in + theorem specialPlane_graphSlot (x : Frobenius.Ring (ι := GraphVar n) (k := k) ell) : + planeRestriction ell (by omega) normalIndices (graphSlot ell false x) = graphSlot ell false x := by + have hh : (planeRestriction (k := k) ell (by omega) (normalIndices (n := n))).comp (graphSlot ell false) = + graphSlot ell false := by + apply algHom_ext + intro v + cases v <;> simp only [AlgHom.comp_apply, graphSlot_slope, graphSlot_tangent, + map_zero, planeRestriction_coordinate, mem_normalIndices, Bool.false_eq_true, ite_false] + exact AlgHom.congr_fun hh x + +omit [CharP k ell] [Fact ell.Prime] in + theorem specialPlane_fixedComplement (D : FormalData (k := k) n) (c : InternalVar n) : + planeRestriction ell (by omega) normalIndices (fixedComplement ell D c) = 0 := by + simp only [fixedComplement, map_sum, map_smul, planeRestriction_coordinate, + mem_normalIndices, ite_true, smul_zero, Finset.sum_const_zero] + + theorem specialSlope_restriction (D : FormalData (k := k) n) (i : Fin d) : + planeRestriction ell (by omega) normalIndices (specialChart ell D (specialSlope ell D false i)) = + graphSlot ell false (Ideal.Quotient.mk _ (negativeSlopeValue n D.P D.Y i)) := by + have ha (y : Fin (n i)) : MvPowerSeries.constantCoeff (D.Y (false,⟨i,y⟩)) = 0 := + graph_constant_zero D _ + have hh : ((planeRestriction ell (by omega) (normalIndices (n := n))).comp (specialChart ell D)).comp + (includeVariables ell (fun y : Fin (n i) => ((false,⟨i,y⟩) : InternalVar n))) = + (graphSlot ell false).comp (substitute ell (fun y : Fin (n i) => D.Y (false,⟨i,y⟩)) ha) := by + apply algHom_ext + intro y + simp only [AlgHom.comp_apply, includeVariables_coordinate, specialChart_coordinate, + specialChartCoordinate, map_add, specialPlane_fixedComplement ell htwo D, add_zero, + specialPlane_graphSlot ell htwo, substitute_coordinate] + simpa only [AlgHom.comp_apply, substitute_mk, specialSlope, negativeSlopeValue] using + AlgHom.congr_fun hh (Ideal.Quotient.mk _ (slopeDerivative n D.P i)) + + theorem specialSlope_mul_normal (D : FormalData (k := k) n) (i : Fin d) : + coeff (specialSlope ell D false i) * specialNormal ell htwo D = + coeff ((specialChartEquiv ell htwo D).symm + (graphSlot ell false (Ideal.Quotient.mk _ (negativeSlopeValue n D.P D.Y i)))) * + specialNormal ell htwo D := by + apply sub_eq_zero.mp + rw [← sub_mul, ← map_sub] + apply chartNormal_annihilate ell (by omega) + apply (chart_restriction_eq_zero_iff ell (by omega) (specialChartEquiv ell htwo D).symm + normalIndices _).mp + simp only [map_sub, AlgEquiv.symm_symm, AlgEquiv.apply_symm_apply, + specialPlane_graphSlot ell htwo] + exact sub_eq_zero.mpr (specialSlope_restriction ell htwo D i) + +omit [CharP k ell] [Fact ell.Prime] in + theorem specialPlane_idempotent (x : Frobenius.Ring (ι := InternalVar n) (k := k) ell) : + planeRestriction ell (show 0 < ell by omega) normalIndices + (planeRestriction ell (show 0 < ell by omega) normalIndices x) = + planeRestriction ell (show 0 < ell by omega) normalIndices x := by + have hh : (planeRestriction (ι := InternalVar n) (k := k) ell (by omega) normalIndices).comp + (planeRestriction ell (by omega) normalIndices) = + planeRestriction ell (by omega) normalIndices := by + apply algHom_ext + intro i + by_cases hi : i ∈ normalIndices + · simp only [AlgHom.comp_apply, planeRestriction_coordinate, ite_eq_left hi, map_zero] + · simp only [AlgHom.comp_apply, planeRestriction_coordinate, ite_eq_right hi] + exact AlgHom.congr_fun hh x + + theorem specialScalar_mul_normal (D : FormalData (k := k) n) + (x : Frobenius.Ring (ι := InternalVar n) (k := k) ell) : + coeff x * specialNormal ell htwo D = + coeff ((specialChartEquiv ell htwo D).symm + (planeRestriction ell (by omega) normalIndices (specialChart ell D x))) * + specialNormal ell htwo D := by + apply sub_eq_zero.mp + rw [← sub_mul, ← map_sub] + apply chartNormal_annihilate ell (by omega) + apply (chart_restriction_eq_zero_iff ell (by omega) (specialChartEquiv ell htwo D).symm + normalIndices _).mp + simp only [map_sub, AlgEquiv.symm_symm, AlgEquiv.apply_symm_apply, + specialPlane_idempotent ell htwo] + exact sub_self _ + + theorem specialNegativeTriple_boundary (D : FormalData (k := k) n) (i j l : Fin d) : + ∃ eta : Forms (k := k) (A := Frobenius.Ring (ι := InternalVar n) (k := k) ell) + (ι := InternalVar n), + delta (partialDeriv ell) (specialPotential ell D) eta = + coeff (specialSlope ell D false i * specialSlope ell D false j * specialSlope ell D false l) * + specialNormal ell htwo D := by + obtain ⟨eta,he⟩ := specialNormal_primitive ell htwo D _ (D.negative_cubic i j l) + refine ⟨eta, he.trans ?_⟩ + symm + calc + _ = coeff ((specialChartEquiv ell htwo D).symm + (planeRestriction ell (by omega) normalIndices + (specialChart ell D (specialSlope ell D false i * specialSlope ell D false j * specialSlope ell D false l)))) * + specialNormal ell htwo D := specialScalar_mul_normal ell htwo D _ + _ = _ := by simp only [map_mul, specialSlope_restriction ell htwo D] + + + theorem negativeNormal_triple (D : FormalData (k := k) n) (i j l : Fin d) : + ∃ eta : Forms (k := k) (A := Frobenius.Ring (ι := InternalVar n) (k := k) ell) + (ι := InternalVar n), + delta (partialDeriv ell) (specialPotential ell D) eta = + coeff (specialSlope ell D true i * specialSlope ell D true j * specialSlope ell D true l) * + negativeNormal ell htwo D := by + obtain ⟨eta,he⟩ := specialNegativeTriple_boundary ell htwo D i j l + refine ⟨-FormsReindex.equiv ell swapEquiv eta, ?_⟩ + have hh := congrArg (FormsReindex.equiv ell swapEquiv) he + rw [FormsReindex.equiv_delta, specialPotential_swap] at hh + simp only [map_mul, FormsReindex.equiv_coeff, specialSlope_swap] at hh + simp only [Bool.not_false] at hh + rw [delta_apply, gradient_neg, neg_mul] at hh + simpa only [delta_apply, mul_neg, map_mul, negativeNormal] using hh + +end BoundaryOnly.FormalObstruction + +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/BlockTensor.lean b/lean/OAI/Algebra/FrobeniusObstruction/BlockTensor.lean new file mode 100644 index 0000000000000000000000000000000000000000..da3fe59b1717c31f9089bc37e3e9673b97923294 --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/BlockTensor.lean @@ -0,0 +1,390 @@ +import Mathlib +import OAI.Algebra.FrobeniusObstruction.TensorKernels + +namespace OAI + +noncomputable section +open scoped BigOperators TensorProduct + +namespace BoundaryOnly.FormalObstruction.BlockCohomology +open SquareZero MixedForms +variable {k A ι : Type*} [Field k] [CommRing A] [Algebra k A] + [Fintype ι] [DecidableEq ι] +variable (pd : ι → Derivation k A A) (q : A) + + + +structure Contraction where + j : H pd q →ₗ[k] Forms (k := k) (A := A) (ι := ι) + p : Forms (k := k) (A := A) (ι := ι) →ₗ[k] H pd q + h : Module.End k (Forms (k := k) (A := A) (ι := ι)) + cycle_j : ∀ x, delta pd q (j x) = 0 + p_boundary : ∀ x, p (delta pd q x) = 0 + p_j : ∀ x, p (j x) = x + p_cycle : ∀ z : Cycles (delta pd q), p z = classMap _ (delta_sq pd q) z + j_parity : ∀ x, j (P pd q x) = parity (j x) + p_parity : ∀ x, p (parity x) = P pd q (p x) + h_parity : ∀ x, h (parity x) = -parity (h x) + homotopy : ∀ x, x - j (p x) = delta pd q (h x) + h (delta pd q x) + + theorem contraction_exists (htwo : (2 : k) ≠ 0) : Nonempty (Contraction pd q) := by + obtain ⟨j,p,h,hj,hp,hpj,hpc,hjP,hpP,hhP,hh⟩ := parity_cohomology_contraction + htwo (delta pd q) parity.toLinearMap (delta_sq pd q) parity_sq (delta_parity pd q) + exact ⟨⟨j,p,h,hj,hp,hpj,hpc,hjP,hpP,hhP,hh⟩⟩ + +def contraction (htwo : (2 : k) ≠ 0) : Contraction pd q := + Classical.choice (contraction_exists pd q htwo) + +namespace Contraction +variable {pd q} (c : Contraction pd q) + + theorem class_j (x : H pd q) : + classMap _ (delta_sq pd q) ⟨c.j x, c.cycle_j x⟩ = x := + (c.p_cycle ⟨c.j x, c.cycle_j x⟩).symm.trans (c.p_j x) + + theorem project_odd (f : Module.End k (Forms (k := k) (A := A) (ι := ι))) + (hf : ∀ x, delta pd q (f x) = -f (delta pd q x)) (x : H pd q) : + c.p (f (c.j x)) = oddInduced _ (delta_sq pd q) f hf x := by + conv_rhs => rw [← c.class_j x, oddInduced_class, ← c.p_cycle] + rfl + + theorem project_even (f : Module.End k (Forms (k := k) (A := A) (ι := ι))) + (hf : ∀ x, delta pd q (f x) = f (delta pd q x)) (x : H pd q) : + c.p (f (c.j x)) = evenInduced _ (delta_sq pd q) f hf x := by + conv_rhs => rw [← c.class_j x, evenInduced_class, ← c.p_cycle] + rfl + + theorem project_d (hc : ∀ i j a, pd i (pd j a) = pd j (pd i a)) (x : H pd q) : + c.p (d pd (c.j x)) = D pd q hc x := + c.project_odd (d pd) (delta_d pd q hc) x + + theorem project_coefficient (s : A) (x : H pd q) : + c.p (coefficient s (c.j x)) = S pd q s x := + c.project_even (coefficient s) (delta_coefficient pd q s) x + +end Contraction +end BoundaryOnly.FormalObstruction.BlockCohomology + +namespace BoundaryOnly.FormalObstruction.SignedTensor +variable {k ι : Type*} [Field k] [Fintype ι] [LinearOrder ι] +variable {V W : ι → Type*} [∀ i, AddCommGroup (V i)] [∀ i, Module k (V i)] + [∀ i, AddCommGroup (W i)] [∀ i, Module k (W i)] + +theorem differential_map (P D : EndFamily (k := k) V) (Q E : EndFamily (k := k) W) + (f : ∀ i, V i →ₗ[k] W i) + (hP : ∀ i, (f i).comp (P i) = (Q i).comp (f i)) + (hD : ∀ i, (f i).comp (D i) = (E i).comp (f i)) : + (PiTensorProduct.map f).comp (differential V P D) = + (differential W Q E).comp (PiTensorProduct.map f) := by + apply PiTensorProduct.ext + ext v + simp only [LinearMap.compMultilinearMap_apply, LinearMap.comp_apply, + differential, LinearMap.sum_apply, PiTensorProduct.map_tprod, map_sum] + apply Finset.sum_congr rfl + intro i _ + congr 1 + funext a + by_cases ha : a < i + · simp only [dSlot, ite_eq_left ha] + exact LinearMap.congr_fun (hP a) (v a) + · by_cases he : a = i + · simp only [dSlot, ite_eq_right ha, ite_eq_left he] + exact LinearMap.congr_fun (hD a) (v a) + · simp only [dSlot, ite_eq_right ha, ite_eq_right he, Module.End.one_apply] + +end BoundaryOnly.FormalObstruction.SignedTensor + +namespace BoundaryOnly.FormalObstruction.BlockTensor +open MixedForms SquareZero SignedTensor +variable {k t : Type*} [Field k] [Fintype t] [LinearOrder t] +variable (A K : t → Type*) [∀ i, CommRing (A i)] [∀ i, Algebra k (A i)] + [∀ i, Fintype (K i)] [∀ i, DecidableEq (K i)] +abbrev V (i : t) := Forms (k := k) (A := A i) (ι := K i) +variable {A K} +variable (pd : ∀ i, K i → Derivation k (A i) (A i)) (q : ∀ i, A i) +abbrev H (i : t) := BlockCohomology.H (pd i) (q i) +def P : EndFamily (k := k) (V (k := k) A K) := fun _ => parity.toLinearMap +local notation "PV" => (P (k := k) (A := A) (K := K)) +def D : EndFamily (k := k) (V (k := k) A K) := fun i => d (pd i) +def delta : EndFamily (k := k) (V (k := k) A K) := fun i => MixedForms.delta (pd i) (q i) +def S (s : ∀ i, A i) : EndFamily (k := k) (V (k := k) A K) := + fun i => BlockCohomology.coefficient (s i) +def HP : EndFamily (k := k) (H pd q) := fun i => BlockCohomology.P (pd i) (q i) +def HD (hc : ∀ a i j x, pd a i (pd a j x) = pd a j (pd a i x)) : + EndFamily (k := k) (H pd q) := fun i => BlockCohomology.D (pd i) (q i) (hc i) +def HS (s : ∀ i, A i) : EndFamily (k := k) (H pd q) := + fun i => BlockCohomology.S (pd i) (q i) (s i) +variable (c : ∀ i, BlockCohomology.Contraction (pd i) (q i)) +def j : (⨂[k] i, H pd q i) →ₗ[k] (⨂[k] i, V (k := k) A K i) := + PiTensorProduct.map (fun i => (c i).j) +def p : (⨂[k] i, V (k := k) A K i) →ₗ[k] (⨂[k] i, H pd q i) := + PiTensorProduct.map (fun i => (c i).p) + +theorem projection_boundary (x : ⨂[k] i, V (k := k) A K i) : + p pd q c (differential (V (k := k) A K) PV (delta pd q) x) = 0 := by + exact LinearMap.congr_fun (projection_boundaries PV (delta pd q) + (fun i => (c i).p) (fun i => by apply LinearMap.ext; intro z; exact (c i).p_boundary z)) x + +theorem representatives_cycle (x : ⨂[k] i, H pd q i) : + differential (V (k := k) A K) PV (delta pd q) (j pd q c x) = 0 := by + exact LinearMap.congr_fun (representatives_cycles PV (delta pd q) + (fun i => (c i).j) (fun i => by apply LinearMap.ext; intro z; exact (c i).cycle_j z)) x + +theorem cycle_decomposition (z : ⨂[k] i, V (k := k) A K i) + (hz : differential (V (k := k) A K) PV (delta pd q) z = 0) : + ∃ y, z - j pd q c (p pd q c z) = differential (V (k := k) A K) PV (delta pd q) y := by + apply tensor_cycle_decomposition PV (delta pd q) + (fun i => (c i).j) (fun i => (c i).p) (fun i => (c i).h) _ _ _ _ _ _ _ z hz + · intro i; apply LinearMap.ext; intro x; exact parity_sq x + · intro i; apply LinearMap.ext; intro x; exact BlockCohomology.delta_parity (pd i) (q i) x + · intro i; apply LinearMap.ext; intro x; exact (c i).cycle_j x + · intro i; apply LinearMap.ext; intro x; exact (c i).p_boundary x + · intro i; apply LinearMap.ext; intro x + change parity ((c i).j ((c i).p x)) = (c i).j ((c i).p (parity x)) + rw [(c i).p_parity, (c i).j_parity] + · intro i; apply LinearMap.ext; intro x + change parity ((c i).h x) = -(c i).h (parity x) + rw [(c i).h_parity, neg_neg] + · intro i; apply LinearMap.ext; intro x + exact ((c i).homotopy x).symm + +omit [Fintype t] [LinearOrder t] in +theorem project_parity (i : t) : + (c i).p.comp ((PV i).comp (c i).j) = HP pd q i := by + apply LinearMap.ext; intro x + change (c i).p (parity ((c i).j x)) = BlockCohomology.P (pd i) (q i) x + rw [(c i).p_parity, (c i).p_j] + +theorem project_D (hc : ∀ a i j x, pd a i (pd a j x) = pd a j (pd a i x)) : + (p pd q c).comp ((differential (V (k := k) A K) PV (D pd)).comp (j pd q c)) = + differential (H pd q) (HP pd q) (HD pd q hc) := by + apply project_differential + · intro i; apply LinearMap.ext; intro x; exact (c i).p_j x + · exact project_parity pd q c + · intro i; apply LinearMap.ext; intro x; exact (c i).project_d (hc i) x + +omit [Fintype t] in +theorem project_S (s : ∀ i, A i) (I : Finset t) : + (p pd q c).comp ((tensorAction (V (k := k) A K) (S s) I).comp (j pd q c)) = + tensorAction (H pd q) (HS pd q s) I := by + apply project_tensor_map + intro i + by_cases hi : i ∈ I + · apply LinearMap.ext; intro x + simpa only [tensorAction, ite_eq_left hi, LinearMap.comp_apply, S, HS] + using (c i).project_coefficient (s i) x + · apply LinearMap.ext; intro x + simpa only [tensorAction, ite_eq_right hi, LinearMap.comp_apply, LinearMap.id_apply] + using (c i).p_j x + +end BoundaryOnly.FormalObstruction.BlockTensor + +namespace BoundaryOnly.FormalObstruction.SignedTensor +variable {k t : Type*} [Field k] [Fintype t] [LinearOrder t] +variable (V : t → Type*) [∀ i, AddCommGroup (V i)] [∀ i, Module k (V i)] + +theorem differential_anticomm (P D E : EndFamily (k := k) V) + (hP : ∀ i, P i * P i = 1) + (hD : ∀ i, D i * P i = -(P i * D i)) + (hE : ∀ i, P i * E i = -(E i * P i)) + (hDE : ∀ i, D i * E i + E i * D i = 0) : + differential V P D * differential V P E + + differential V P E * differential V P D = 0 := by + have hh : homotopy V P (fun _ => 1) E = differential V P E := by + unfold homotopy differential + apply Finset.sum_congr rfl + intro i _ + congr 1 + have h := tensor_homotopy P D (fun _ => 1) E hP hD + (fun i => by simp only [mul_one, one_mul]) + (fun i => by simp only [mul_one, one_mul]) hE + (fun i => by rw [sub_self]; exact hDE i) + rw [hh] at h + have hi : PiTensorProduct.map (fun i : t => (1 : Module.End k (V i))) = 1 := + PiTensorProduct.map_id + rwa [hi, sub_self] at h + +end BoundaryOnly.FormalObstruction.SignedTensor + +namespace BoundaryOnly.FormalObstruction.BlockTensor +open MixedForms SquareZero SignedTensor +variable {k t : Type*} [Field k] [Fintype t] [LinearOrder t] +variable {A K : t → Type*} [∀ i, CommRing (A i)] [∀ i, Algebra k (A i)] + [∀ i, Fintype (K i)] [∀ i, DecidableEq (K i)] +variable (pd : ∀ i, K i → Derivation k (A i) (A i)) (q : ∀ i, A i) +local notation "PV" => (P (k := k) (A := A) (K := K)) + +theorem D_delta_anticomm (hc : ∀ a i j x, pd a i (pd a j x) = pd a j (pd a i x)) + (x : ⨂[k] i, V (k := k) A K i) : + differential (V (k := k) A K) PV (D pd) + (differential (V (k := k) A K) PV (delta pd q) x) = + -differential (V (k := k) A K) PV (delta pd q) + (differential (V (k := k) A K) PV (D pd) x) := by + have h := differential_anticomm (V (k := k) A K) PV (D pd) (delta pd q) + (fun i => by apply LinearMap.ext; intro y; exact parity_sq y) + (fun i => by apply LinearMap.ext; intro y; exact d_parity (pd i) y) + (fun i => by + apply LinearMap.ext; intro y + change parity (MixedForms.delta (pd i) (q i) y) = + -MixedForms.delta (pd i) (q i) (parity y) + rw [BlockCohomology.delta_parity, neg_neg]) + (fun i => by + apply LinearMap.ext; intro y + change d (pd i) (MixedForms.delta (pd i) (q i) y) + + MixedForms.delta (pd i) (q i) (d (pd i) y) = 0 + exact d_delta (pd i) (hc i) (q i) y) + exact eq_neg_of_add_eq_zero_left (LinearMap.congr_fun h x) + +theorem S_delta_comm (s : ∀ i, A i) (I : Finset t) + (x : ⨂[k] i, V (k := k) A K i) : + tensorAction (V (k := k) A K) (S s) I + (differential (V (k := k) A K) PV (delta pd q) x) = + differential (V (k := k) A K) PV (delta pd q) + (tensorAction (V (k := k) A K) (S s) I x) := by + apply LinearMap.congr_fun (differential_map PV (delta pd q) PV (delta pd q) + (fun i => if i ∈ I then S s i else LinearMap.id) ?_ ?_) x + · intro i + by_cases hi : i ∈ I + · simp only [ite_eq_left hi] + apply LinearMap.ext; intro y + change coeff (s i) * parity y = parity (coeff (s i) * y) + rw [map_mul, parity_coeff] + · simp only [ite_eq_right hi, LinearMap.id_comp, LinearMap.comp_id] + · intro i + by_cases hi : i ∈ I + · simp only [ite_eq_left hi] + apply LinearMap.ext; intro y + exact (BlockCohomology.delta_coefficient (pd i) (q i) (s i) y).symm + · simp only [ite_eq_right hi, LinearMap.id_comp, LinearMap.comp_id] + +end BoundaryOnly.FormalObstruction.BlockTensor + +namespace BoundaryOnly.FormalObstruction.BlockTensor +open MixedForms SquareZero SignedTensor +variable {k t : Type*} [Field k] [Fintype t] [LinearOrder t] +variable {A K : t → Type*} [∀ i, CommRing (A i)] [∀ i, Algebra k (A i)] + [∀ i, Fintype (K i)] [∀ i, DecidableEq (K i)] +variable (pd : ∀ i, K i → Derivation k (A i) (A i)) (q : ∀ i, A i) +local notation "PV" => (P (k := k) (A := A) (K := K)) +local notation "Ω" => (V (k := k) A K) +local notation "δt" => (differential Ω PV (delta pd q)) +local notation "Dt" => (differential Ω PV (D pd)) + +theorem project_D_cycle + (hc : ∀ a i j x, pd a i (pd a j x) = pd a j (pd a i x)) + (c : ∀ i, BlockCohomology.Contraction (pd i) (q i)) + (z : ⨂[k] i, Ω i) (hz : δt z = 0) : + differential (H pd q) (HP pd q) (HD pd q hc) (p pd q c z) = p pd q c (Dt z) := by + refine CycleTransfer.operator (H := ⨂[k] i, H pd q i) δt (j pd q c) (p pd q c) + (projection_boundary pd q c) (cycle_decomposition pd q c) Dt (-Dt) + (differential (H pd q) (HP pd q) (HD pd q hc)) ?_ ?_ z hz + · intro x + simpa only [LinearMap.neg_apply, map_neg] using D_delta_anticomm pd q hc x + · intro x + exact (LinearMap.congr_fun (project_D pd q c hc) x).symm + +theorem pairing_project_D + (hc : ∀ a i j x, pd a i (pd a j x) = pd a j (pd a i x)) + (c : ∀ i, BlockCohomology.Contraction (pd i) (q i)) + (Φ : (⨂[k] i, Ω i) →ₗ[k] k) + (hΦδ : ∀ x, Φ (δt x) = 0) (hΦD : ∀ x, Φ (Dt x) = 0) + (x : ⨂[k] i, H pd q i) : + Φ (j pd q c (differential (H pd q) (HP pd q) (HD pd q hc) x)) = 0 := by + refine CycleTransfer.pairing_operator (H := ⨂[k] i, H pd q i) δt (j pd q c) (p pd q c) + (cycle_decomposition pd q c) Dt (-Dt) + (differential (H pd q) (HP pd q) (HD pd q hc)) ?_ ?_ ?_ Φ hΦδ hΦD x + · intro z + change _ = -(Dt (δt z)) + rw [D_delta_anticomm pd q hc z, neg_neg] + · exact representatives_cycle pd q c + · intro z + exact (LinearMap.congr_fun (project_D pd q c hc) z).symm + +theorem project_S_cycle + (c : ∀ i, BlockCohomology.Contraction (pd i) (q i)) + (s : ∀ i, A i) (I : Finset t) + (z : ⨂[k] i, Ω i) (hz : δt z = 0) : + tensorAction (H pd q) (HS pd q s) I (p pd q c z) = + p pd q c (tensorAction Ω (S s) I z) := by + refine CycleTransfer.operator (H := ⨂[k] i, H pd q i) δt (j pd q c) (p pd q c) + (projection_boundary pd q c) (cycle_decomposition pd q c) + (tensorAction Ω (S s) I) (tensorAction Ω (S s) I) + (tensorAction (H pd q) (HS pd q s) I) ?_ ?_ z hz + · exact S_delta_comm pd q s I + · intro x + exact (LinearMap.congr_fun (project_S pd q c s I) x).symm + + + +theorem selected_classes (htwo : (2 : k) ≠ 0) + (hc : ∀ a i j x, pd a i (pd a j x) = pd a j (pd a i x)) + (s : ∀ i, A i) (active : Finset t) (hcard : 5 ≤ active.card) + (c : ∀ i, BlockCohomology.Contraction (pd i) (q i)) + (Φ : (⨂[k] i, Ω i) →ₗ[k] k) + (hΦδ : ∀ x, Φ (δt x) = 0) (hΦD : ∀ x, Φ (Dt x) = 0) + (z : ⨂[k] i, Ω i) (hz : δt z = 0) (hDz : Dt z = 0) (hΦz : Φ z ≠ 0) + (htriple : ∀ I : Finset t, I ⊆ active → I.card = 3 → + ∃ y, tensorAction Ω (S s) I z = δt y) : + ∃ (J : Finset t) (m : ∀ i, H pd q i), + J ⊆ active ∧ 3 ≤ J.card ∧ + (∀ i ∈ J, HS pd q s i (m i) = 0 ∧ + HS pd q s i (HD pd q hc i (m i)) = 0) ∧ + Φ (j pd q c (PiTensorProduct.tprod k m)) ≠ 0 := by + let φ := Φ.comp (j pd q c) + have hHD : differential (H pd q) (HP pd q) (HD pd q hc) (p pd q c z) = 0 := by + rw [project_D_cycle pd q hc c z hz, hDz, map_zero] + have hφD (x : ⨂[k] i, H pd q i) : + φ (differential (H pd q) (HP pd q) (HD pd q hc) x) = 0 := + pairing_project_D pd q hc c Φ hΦδ hΦD x + have hφz : φ (p pd q c z) ≠ 0 := by + change Φ (j pd q c (p pd q c z)) ≠ 0 + rw [CycleTransfer.pairing (H := ⨂[k] i, H pd q i) δt (j pd q c) (p pd q c) (cycle_decomposition pd q c) Φ hΦδ z hz] + exact hΦz + have hSz (I : Finset t) (hi : I ⊆ active) (hI : I.card = 3) : + tensorAction (H pd q) (HS pd q s) I (p pd q c z) = 0 := by + rw [project_S_cycle pd q c s I z hz] + obtain ⟨y,hy⟩ := htriple I hi hI + rw [hy, projection_boundary] + choose r h hrD hrP hhP hDh hNr using + (fun i => BlockCohomology.retraction (pd i) (q i) (hc i) htwo (s i)) + apply select_special_fiber_tensor (HS pd q s) (HP pd q) (HD pd q hc) r h + active hcard _ _ _ _ _ _ _ φ hφD (p pd q c z) hHD hφz hSz + · intro i; apply LinearMap.ext; intro x; exact BlockCohomology.P_sq (pd i) (q i) x + · intro i; apply LinearMap.ext; intro x; exact BlockCohomology.D_P (pd i) (q i) (hc i) x + · intro i; apply LinearMap.ext; intro x; exact hrD i x + · intro i; apply LinearMap.ext; intro x; exact hrP i x + · intro i; apply LinearMap.ext; intro x; exact hhP i x + · intro i; apply LinearMap.ext; intro x; exact (hDh i x).symm + · intro i _ x hx; exact hNr i x hx + + + +theorem selected_cycles (htwo : (2 : k) ≠ 0) + (hc : ∀ a i j x, pd a i (pd a j x) = pd a j (pd a i x)) + (s : ∀ i, A i) (active : Finset t) (hcard : 5 ≤ active.card) + (Φ : (⨂[k] i, Ω i) →ₗ[k] k) + (hΦδ : ∀ x, Φ (δt x) = 0) (hΦD : ∀ x, Φ (Dt x) = 0) + (z : ⨂[k] i, Ω i) (hz : δt z = 0) (hDz : Dt z = 0) (hΦz : Φ z ≠ 0) + (htriple : ∀ I : Finset t, I ⊆ active → I.card = 3 → + ∃ y, tensorAction Ω (S s) I z = δt y) : + ∃ (J : Finset t) (x : ∀ i, Ω i), + J ⊆ active ∧ 3 ≤ J.card ∧ (∀ i, delta pd q i (x i) = 0) ∧ + (∀ i ∈ J, ∃ y : Ω i, delta pd q i y = -MixedForms.delta (pd i) (s i) (x i)) ∧ + Φ (PiTensorProduct.tprod k x) ≠ 0 := by + let c := fun i => BlockCohomology.contraction (pd i) (q i) htwo + obtain ⟨J,m,hJ,hcardJ,hm,hpair⟩ := selected_classes pd q htwo hc s active hcard c + Φ hΦδ hΦD z hz hDz hΦz htriple + refine ⟨J,fun i => (c i).j (m i),hJ,hcardJ,?_,?_,?_⟩ + · intro i; exact (c i).cycle_j (m i) + · intro i hi + apply BlockCohomology.correction (pd i) (q i) (hc i) (s i) + ⟨(c i).j (m i), (c i).cycle_j (m i)⟩ + · rw [(c i).class_j]; exact (hm i hi).1 + · rw [(c i).class_j]; exact (hm i hi).2 + · simpa only [j, PiTensorProduct.map_tprod] using hpair + +end BoundaryOnly.FormalObstruction.BlockTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/ChartPairing.lean b/lean/OAI/Algebra/FrobeniusObstruction/ChartPairing.lean new file mode 100644 index 0000000000000000000000000000000000000000..724caa9986ec750ffa14903a7c3d195af8fc8c32 --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/ChartPairing.lean @@ -0,0 +1,350 @@ +import Mathlib +import OAI.Algebra.FrobeniusObstruction.ResiduePairing +import OAI.Algebra.FrobeniusObstruction.NormalPrimitives + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace BoundaryOnly.FormalObstruction.FormsReindex +open Frobenius MixedForms +variable {ι κ k : Type*} [Fintype ι] [Fintype κ] [DecidableEq ι] [DecidableEq κ] + [CommRing k] (ell : ℕ) [CharP k ell] + +@[simp] theorem equiv_cartier (e : ι ≃ κ) (a : Ring (ι := ι) (k := k) ell) (m : ℕ) : + equiv ell e (cartier (partialDeriv ell) m a) = + cartier (partialDeriv ell) m (Frobenius.reindex ell e a) := by + simp only [cartier, map_mul, equiv_coeff, map_pow, equiv_gradient] + +@[simp] theorem equiv_normal (e : ι ≃ κ) (us : List (Ring (ι := ι) (k := k) ell)) (m : ℕ) : + equiv ell e (normal (partialDeriv ell) m us) = + normal (partialDeriv ell) m (us.map (Frobenius.reindex ell e)) := by + simp only [normal, map_list_prod, List.map_map, Function.comp_def, equiv_cartier] + +end BoundaryOnly.FormalObstruction.FormsReindex + +namespace BoundaryOnly.FormalObstruction +open Frobenius MixedForms +variable {k : Type*} [Field k] {d : ℕ} {n : Fin d → ℕ} +variable (ell : ℕ) (htwo : 1 < ell) [CharP k ell] [Fact ell.Prime] + + +def swapEquiv : InternalVar n ≃ InternalVar n where + toFun := swapBlocks n + invFun := swapBlocks n + left_inv c := by simp [swapBlocks] + right_inv c := by simp [swapBlocks] + +@[simp] theorem swapEquiv_apply (c : InternalVar n) : + swapEquiv (n := n) c = (!c.1,c.2) := rfl + +@[simp] theorem swapEquiv_symm : (swapEquiv (n := n)).symm = swapEquiv := rfl + +@[simp] theorem complementaryMatrix_swap (Y : InternalVar n → MvPowerSeries (GraphVar n) k) : + (complementaryMatrix n Y).submatrix swapEquiv swapEquiv = complementaryMatrix n Y := by + ext i j + obtain ⟨b,t⟩ := j + cases b <;> simp [Matrix.submatrix_apply, complementaryMatrix, swapEquiv, swapBlocks] + + +theorem inverseChart_tangent (D : FormalData (k := k) n) : + tangentJacobian ell htwo (specialChartEquiv ell htwo D).symm.toAlgHom = + (complementaryMatrix n D.Y)⁻¹ := by + have he : (specialChartEquiv ell htwo D).symm.toAlgHom.comp + (specialChartEquiv ell htwo D).toAlgHom = AlgHom.id k _ := by + ext x + exact (specialChartEquiv ell htwo D).symm_apply_apply x + have h := tangentJacobian_comp ell htwo (specialChartEquiv ell htwo D).symm.toAlgHom + (specialChartEquiv ell htwo D).toAlgHom + rw [he, tangentJacobian_id] at h + have hM : tangentJacobian ell htwo (specialChartEquiv ell htwo D).toAlgHom = + complementaryMatrix n D.Y := specialChart_tangent_matrix ell htwo D + rw [hM] at h + exact (Matrix.inv_eq_right_inv h.symm).symm + +theorem inverseChart_tangent_swap (D : FormalData (k := k) n) (i j : InternalVar n) : + tangentCoeff ell htwo (swapEquiv j) + ((specialChartEquiv ell htwo D).symm (coordinate ell (swapEquiv i))) = + tangentCoeff ell htwo j ((specialChartEquiv ell htwo D).symm (coordinate ell i)) := by + have hs := congrArg (fun M : Matrix (InternalVar n) (InternalVar n) k => M⁻¹) + (complementaryMatrix_swap D.Y) + rw [Matrix.inv_submatrix_equiv] at hs + have h := congrArg (fun M : Matrix (InternalVar n) (InternalVar n) k => M i j) hs + rw [← inverseChart_tangent ell htwo D] at h + exact h + +omit [Fact ell.Prime] in +theorem tangentCoeff_swap (j : InternalVar n) + (x : Frobenius.Ring (ι := InternalVar n) (k := k) ell) : + tangentCoeff ell htwo j (Frobenius.reindex ell swapEquiv x) = + tangentCoeff ell htwo (swapEquiv j) x := by + calc + _ = augmentation ell (by omega) (partialDeriv ell j (Frobenius.reindex ell swapEquiv x)) := + tangentCoeff_eq_augmentation_partial ell htwo j _ + _ = augmentation ell (by omega) (Frobenius.reindex ell swapEquiv + (partialDeriv ell (swapEquiv j) x)) := by + congr 1 + simpa only [swapEquiv_apply, Bool.not_not, Prod.eta] using + partial_reindex ell (swapEquiv (n := n)) (swapEquiv j) x + _ = augmentation ell (by omega) (partialDeriv ell (swapEquiv j) x) := + AlgHom.congr_fun (augmentation_natural ell htwo + (Frobenius.reindex (k := k) ell (swapEquiv (n := n))).toAlgHom) _ + _ = _ := (tangentCoeff_eq_augmentation_partial ell htwo _ x).symm + +def jointNormalCoordinate (D : FormalData (k := k) n) (c : InternalVar n) : + Frobenius.Ring (ι := InternalVar n) (k := k) ell := + if c.1 then (specialChartEquiv ell htwo D).symm (coordinate ell c) + else Frobenius.reindex ell swapEquiv + ((specialChartEquiv ell htwo D).symm (coordinate ell (swapEquiv c))) + +theorem jointNormalCoordinate_pow (D : FormalData (k := k) n) (c : InternalVar n) : + jointNormalCoordinate ell htwo D c ^ ell = 0 := by + unfold jointNormalCoordinate + split <;> simp only [← map_pow, coordinate_pow, map_zero] + +def jointNormalChart (D : FormalData (k := k) n) : + Frobenius.Ring (ι := InternalVar n) (k := k) ell →ₐ[k] + Frobenius.Ring (ι := InternalVar n) (k := k) ell := + eval ell (jointNormalCoordinate ell htwo D) (jointNormalCoordinate_pow ell htwo D) + +@[simp] theorem jointNormalChart_coordinate (D : FormalData (k := k) n) (c : InternalVar n) : + jointNormalChart ell htwo D (coordinate ell c) = jointNormalCoordinate ell htwo D c := + eval_coordinate ell _ _ _ + + theorem jointNormalChart_tangent (D : FormalData (k := k) n) : + tangentJacobian ell htwo (jointNormalChart ell htwo D) = + tangentJacobian ell htwo (specialChartEquiv ell htwo D).symm.toAlgHom := by + ext i j + change tangentCoeff ell htwo j (jointNormalChart ell htwo D (coordinate ell i)) = _ + rw [jointNormalChart_coordinate, jointNormalCoordinate] + split + · rfl + · rw [tangentCoeff_swap] + exact inverseChart_tangent_swap ell htwo D i j + + theorem jointNormalChart_bijective (D : FormalData (k := k) n) : + Function.Bijective (jointNormalChart ell htwo D) := by + apply bijective_of_tangent_matrix ell htwo + change IsUnit (tangentJacobian ell htwo (jointNormalChart ell htwo D)).det + rw [jointNormalChart_tangent] + exact tangentJacobian_det_unit ell htwo (specialChartEquiv ell htwo D).symm + +end BoundaryOnly.FormalObstruction + +namespace BoundaryOnly.FormalObstruction.Frobenius +variable {ι κ k : Type*} [Fintype ι] [Fintype κ] [DecidableEq ι] [DecidableEq κ] + [Field k] (ell : ℕ) (htwo : 1 < ell) [CharP k ell] [Fact ell.Prime] + +theorem reindex_mk (e : ι ≃ κ) (p : MvPowerSeries ι k) : + reindex ell e (Ideal.Quotient.mk _ p) = Ideal.Quotient.mk _ (MvPowerSeries.rename e p) := by + let a : ι → MvPowerSeries κ k := fun i => MvPowerSeries.X (e i) + have ha : ∀ i, MvPowerSeries.constantCoeff (a i) = 0 := by intro i; simp [a] + have hh : (reindex (k := k) ell e).toAlgHom = substitute ell a ha := by + apply algHom_ext + intro i + rw [AlgEquiv.coe_toAlgHom, reindex_coordinate, + substitute_coordinate] + rfl + change (reindex ell e).toAlgHom (Ideal.Quotient.mk _ p) = _ + rw [hh, substitute_mk, MvPowerSeries.rename_eq_subst] + rfl + +omit [DecidableEq ι] [DecidableEq κ] [Fact ell.Prime] in +theorem embDomain_top (e : ι ≃ κ) : + Finsupp.embDomain e.toEmbedding (topExponent (ι := ι) ell) = topExponent (ι := κ) ell := by + ext i + obtain ⟨j,rfl⟩ := e.surjective i + exact (Finsupp.embDomain_apply_self e.toEmbedding (topExponent ell) j).trans + (topExponent_apply ell j) + + theorem topCoeff_reindex (e : ι ≃ κ) (x : Ring (ι := ι) (k := k) ell) : + quotientCoeff ell (topExponent ell) (topExponent_good (by omega)) (reindex ell e x) = + quotientCoeff ell (topExponent ell) (topExponent_good (by omega)) x := by + obtain ⟨p,rfl⟩ := Ideal.Quotient.mk_surjective x + rw [reindex_mk ell e p, quotientCoeff_mk, quotientCoeff_mk, ← embDomain_top ell e] + exact MvPowerSeries.coeff_embDomain_rename e.toEmbedding p (topExponent ell) + +end BoundaryOnly.FormalObstruction.Frobenius + +namespace BoundaryOnly.FormalObstruction.MixedForms +variable {k A ι : Type*} [CommRing k] [CommRing A] [Algebra k A] + [Fintype ι] [DecidableEq ι] + + +def fixedResidue (ρ : A →ₗ[k] k) (v : Ext (k := k) (ι := ι) →ₗ[k] k) : + Forms (k := k) (A := A) (ι := ι) →ₗ[k] k := + (LinearMap.mul' k k).comp (TensorProduct.map ρ v) + +omit [Fintype ι] [DecidableEq ι] in +@[simp] theorem fixedResidue_tmul (ρ : A →ₗ[k] k) (v : Ext (k := k) (ι := ι) →ₗ[k] k) + (a : A) (x : Ext (k := k) (ι := ι)) : + fixedResidue ρ v (a ⊗ₜ[k] x) = ρ a * v x := rfl + + theorem fixedResidue_d (pd : ι → Derivation k A A) (ρ : A →ₗ[k] k) + (v : Ext (k := k) (ι := ι) →ₗ[k] k) (hρ : ∀ i a, ρ (pd i a) = 0) + (x : Forms (k := k) (A := A) (ι := ι)) : fixedResidue ρ v (d pd x) = 0 := by + induction x using TensorProduct.inductionOn with + | add x y hx hy => simp only [map_add, hx, hy, add_zero] + | tmul a x => simp only [d_tmul, map_sum, fixedResidue_tmul, hρ, zero_mul, Finset.sum_const_zero] + + theorem fixedResidue_mul_d (pd : ι → Derivation k A A) (ρ : A →ₗ[k] k) + (v : Ext (k := k) (ι := ι) →ₗ[k] k) (hρ : ∀ i a, ρ (pd i a) = 0) + (x y : Forms (k := k) (A := A) (ι := ι)) (hx : d pd x = 0) : + fixedResidue ρ v (x * d pd y) = 0 := by + have h := fixedResidue_d pd ρ v hρ (parity x * y) + rw [d_mul, d_parity, hx, map_zero, neg_zero, zero_mul, parity_sq, zero_add] at h + exact h + +end BoundaryOnly.FormalObstruction.MixedForms + +namespace BoundaryOnly.FormalObstruction.FormsReindex +open Frobenius MixedForms +variable {ι k : Type*} [Fintype ι] [DecidableEq ι] [Field k] + (ell : ℕ) (htwo : 1 < ell) [CharP k ell] [Fact ell.Prime] {N : ℕ} + + theorem residue_equiv (e : ι ≃ Fin N) (x : QForms (k := k) ell ι) : + NormalPairing.res ell htwo (equiv ell e x) = + fixedResidue (quotientCoeff ell (topExponent ell) (topExponent_good (by omega))) + ((volumeCoeff (k := k)).comp (exterior e).toLinearMap) x := by + induction x using TensorProduct.inductionOn with + | add x y hx hy => simp only [map_add, hx, hy] + | tmul a x => + simp only [equiv_tmul, NormalPairing.res, residue_tmul, fixedResidue_tmul, + topCoeff_reindex ell htwo, LinearMap.comp_apply, AlgEquiv.toLinearMap_apply] + +end BoundaryOnly.FormalObstruction.FormsReindex + +namespace BoundaryOnly.FormalObstruction +open Frobenius MixedForms +variable {d : ℕ} {n : Fin d → ℕ} + +def fullNormalIndexList : List (InternalVar n) := + (normalIndices (n := n)).toList ++ (normalIndices (n := n)).toList.map swapEquiv + + theorem fullNormalIndexList_nodup : (fullNormalIndexList (n := n)).Nodup := by + apply List.nodup_append.mpr + refine ⟨Finset.nodup_toList _, (Finset.nodup_toList _).map swapEquiv.injective, ?_⟩ + intro c hc c' hc' hcc + subst c' + have hct : c.1 = true := mem_normalIndices c |>.mp (Finset.mem_toList.mp hc) + obtain ⟨j,hj,hjc⟩ := List.mem_map.mp hc' + have hjt : j.1 = true := mem_normalIndices j |>.mp (Finset.mem_toList.mp hj) + have hb := congrArg Prod.fst hjc + simp only [swapEquiv_apply, hjt, Bool.not_true, hct] at hb + cases hb + + theorem mem_fullNormalIndexList (c : InternalVar n) : c ∈ fullNormalIndexList (n := n) := by + obtain ⟨b,t⟩ := c + cases b + · apply List.mem_append_right + apply List.mem_map.mpr + exact ⟨(true,t), by simp [normalIndices], rfl⟩ + · apply List.mem_append_left + simp [normalIndices] + + +def normalEnumeration : Fin (fullNormalIndexList (n := n)).length ≃ InternalVar n := + Equiv.ofBijective (fullNormalIndexList (n := n)).get + ⟨fullNormalIndexList_nodup.injective_get, + fun x => List.mem_iff_get.mp (mem_fullNormalIndexList x)⟩ + + theorem normalEnumeration_list : + List.ofFn (normalEnumeration (n := n)) = fullNormalIndexList (n := n) := + List.ofFn_get _ + +end BoundaryOnly.FormalObstruction + +namespace BoundaryOnly.FormalObstruction +open Frobenius MixedForms +variable {k : Type*} [Field k] {d : ℕ} {n : Fin d → ℕ} +variable (ell : ℕ) (htwo : 1 < ell) [CharP k ell] [Fact ell.Prime] + + +def negativeNormal (D : FormalData (k := k) n) : + Forms (k := k) (A := Frobenius.Ring (ι := InternalVar n) (k := k) ell) (ι := InternalVar n) := + FormsReindex.equiv ell swapEquiv (specialNormal ell htwo D) + + theorem jointNormal_list (D : FormalData (k := k) n) : + (fullNormalIndexList (n := n)).map (jointNormalCoordinate ell htwo D) = + normalCoordinateList ell (specialChartEquiv ell htwo D).symm normalIndices ++ + (normalCoordinateList ell (specialChartEquiv ell htwo D).symm normalIndices).map + (Frobenius.reindex ell swapEquiv) := by + simp only [fullNormalIndexList, List.map_append, List.map_map, normalCoordinateList] + congr 1 + · apply List.map_congr_left + intro c hc + have hct := (mem_normalIndices c).mp (Finset.mem_toList.mp hc) + simp only [jointNormalCoordinate, hct, ite_true] + · apply List.map_congr_left + intro c hc + have hct := (mem_normalIndices c).mp (Finset.mem_toList.mp hc) + simp only [Function.comp_apply, jointNormalCoordinate, swapEquiv_apply, + hct, Bool.not_true, Bool.false_eq_true, ite_false, Bool.not_false] + congr 3 + exact Prod.ext hct.symm rfl + + theorem specialNormal_product (D : FormalData (k := k) n) : + specialNormal ell htwo D * negativeNormal ell htwo D = + normal (partialDeriv ell) (ell-1) + ((fullNormalIndexList (n := n)).map (jointNormalCoordinate ell htwo D)) := by + rw [jointNormal_list] + rw [negativeNormal, specialNormal, chartNormal, FormsReindex.equiv_normal] + simp only [normal, List.map_append, List.prod_append] + + def finiteNormalChart (D : FormalData (k := k) n) : + Frobenius.Ring (ι := Fin (fullNormalIndexList (n := n)).length) (k := k) ell ≃ₐ[k] + Frobenius.Ring (ι := Fin (fullNormalIndexList (n := n)).length) (k := k) ell := + ((Frobenius.reindex ell normalEnumeration).trans + (AlgEquiv.ofBijective (jointNormalChart ell htwo D) (jointNormalChart_bijective ell htwo D))).trans + (Frobenius.reindex ell normalEnumeration.symm) + +@[simp] theorem finiteNormalChart_coordinate (D : FormalData (k := k) n) + (i : Fin (fullNormalIndexList (n := n)).length) : + finiteNormalChart ell htwo D (coordinate ell i) = + Frobenius.reindex ell normalEnumeration.symm + (jointNormalCoordinate ell htwo D (normalEnumeration i)) := by + change Frobenius.reindex ell normalEnumeration.symm + (jointNormalChart ell htwo D (Frobenius.reindex ell normalEnumeration (coordinate ell i))) = _ + rw [reindex_coordinate, jointNormalChart_coordinate] + + theorem specialNormal_product_reindex (D : FormalData (k := k) n) : + FormsReindex.equiv ell normalEnumeration.symm + (specialNormal ell htwo D * negativeNormal ell htwo D) = + normal (partialDeriv ell) (ell-1) + (List.ofFn fun i => finiteNormalChart ell htwo D (coordinate ell i)) := by + rw [specialNormal_product, FormsReindex.equiv_normal] + congr 1 + calc + _ = ((List.ofFn (normalEnumeration (n := n))).map + (jointNormalCoordinate ell htwo D)).map + (Frobenius.reindex ell normalEnumeration.symm) := + congrArg (fun l : List (InternalVar n) => + (l.map (jointNormalCoordinate ell htwo D)).map + (Frobenius.reindex ell normalEnumeration.symm)) normalEnumeration_list.symm + _ = _ := by + simp only [List.map_ofFn] + congr 1 + funext i + exact (finiteNormalChart_coordinate ell htwo D i).symm + + + +theorem specialNormal_pairing (D : FormalData (k := k) n) : + ∃ v : Ext (k := k) (ι := InternalVar n) →ₗ[k] k, + fixedResidue (quotientCoeff ell (topExponent ell) (topExponent_good (by omega))) v + (specialNormal ell htwo D * negativeNormal ell htwo D) ≠ 0 := by + let v := (volumeCoeff (k := k)).comp + (FormsReindex.exterior (normalEnumeration (n := n)).symm).toLinearMap + refine ⟨v, ?_⟩ + rw [← FormsReindex.residue_equiv ell htwo normalEnumeration.symm, + specialNormal_product_reindex] + exact NormalPairing.coordinate_residue_ne_zero ell htwo + (finiteNormalChart ell htwo D).toAlgHom (finiteNormalChart ell htwo D).bijective + (tangentJacobian_det_unit ell htwo (finiteNormalChart ell htwo D)) + +end BoundaryOnly.FormalObstruction + +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/CoordinateMaps.lean b/lean/OAI/Algebra/FrobeniusObstruction/CoordinateMaps.lean new file mode 100644 index 0000000000000000000000000000000000000000..38aa77a8baebf46c0d3a761c96f6b54e359e569d --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/CoordinateMaps.lean @@ -0,0 +1,79 @@ +import Mathlib +import OAI.Algebra.FrobeniusObstruction.LinearChange + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace BoundaryOnly.FormalObstruction.Frobenius +variable {ι k l : Type*} [Fintype ι] [DecidableEq ι] [CommRing k] [CommRing l] +variable (ell : ℕ) + + +def mapCoefficients (f : k →+* l) : Ring (ι := ι) (k := k) ell →+* + Ring (ι := ι) (k := l) ell := + Ideal.Quotient.lift _ ((Ideal.Quotient.mk _).comp (MvPowerSeries.map f)) (by + intro p hp + obtain ⟨c, rfl⟩ := Ideal.mem_span_range_iff_exists_fun.mp hp + simp only [RingHom.comp_apply, map_sum, map_mul, map_pow, MvPowerSeries.map_X] + apply Finset.sum_eq_zero + intro i _ + change _ * coordinate (k := l) ell i ^ ell = 0 + rw [coordinate_pow, mul_zero]) + +omit [DecidableEq ι] in +@[simp] theorem mapCoefficients_mk (f : k →+* l) (p : Series (ι := ι) (k := k)) : + mapCoefficients ell f (Ideal.Quotient.mk _ p) = + Ideal.Quotient.mk _ (MvPowerSeries.map f p) := rfl + +omit [DecidableEq ι] in +@[simp] theorem mapCoefficients_coordinate (f : k →+* l) (i : ι) : + mapCoefficients ell f (coordinate ell i) = coordinate ell i := by + simp [coordinate] + +omit [DecidableEq ι] in +@[simp] theorem mapCoefficients_monomial (f : k →+* l) (v : Box (ι := ι) ell) : + mapCoefficients ell f (monomial ell v) = monomial ell v := by + simp [monomial] + +omit [DecidableEq ι] in +@[simp] theorem coefficients_mapCoefficients (f : k →+* l) (x : Ring (ι := ι) (k := k) ell) + (v : Box (ι := ι) ell) : + coefficients ell (mapCoefficients ell f x) v = f (coefficients ell x v) := by + obtain ⟨p, rfl⟩ := Ideal.Quotient.mk_surjective x + simp only [mapCoefficients_mk, coefficients_apply, quotientCoeff_mk, MvPowerSeries.coeff_map] + + +def monomialBasis : Module.Basis (Box (ι := ι) ell) k (Ring (ι := ι) (k := k) ell) := + (Pi.basisFun k (Box (ι := ι) ell)).map (coefficientEquiv ell).symm + +@[simp] theorem monomialBasis_apply (v : Box (ι := ι) ell) : + monomialBasis (k := k) ell v = monomial ell v := by + apply coefficients_injective ell + funext w + change (coefficientEquiv ell) ((coefficientEquiv ell).symm + ((Pi.basisFun k (Box (ι := ι) ell)) v)) w = _ + rw [LinearEquiv.apply_symm_apply] + simp [coefficients_apply, Pi.basisFun_apply, Pi.single_apply, eq_comm] + +@[simp] theorem monomialBasis_repr (x : Ring (ι := ι) (k := k) ell) (v : Box (ι := ι) ell) : + (monomialBasis ell).repr x v = coefficients ell x v := by + simp [monomialBasis, coefficientEquiv] + rfl + +end BoundaryOnly.FormalObstruction.Frobenius + + + + + + + +noncomputable section +open scoped BigOperators + +end +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/Coordinates.lean b/lean/OAI/Algebra/FrobeniusObstruction/Coordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..7cbf07606c4ffdd6a53ed98f4f7c8d1d9827619c --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/Coordinates.lean @@ -0,0 +1,108 @@ +import Mathlib +import OAI.Algebra.FrobeniusObstruction.FrobeniusRing + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace BoundaryOnly.FormalObstruction.Frobenius +open scoped TensorProduct +variable {ι κ k : Type*} [Fintype ι] [Fintype κ] [DecidableEq ι] [DecidableEq κ] + [CommRing k] +variable (ell : ℕ) + +noncomputable def includeVariables (f : ι → κ) : + Ring (ι := ι) (k := k) ell →ₐ[k] Ring (ι := κ) (k := k) ell := + eval ell (fun i => coordinate ell (f i)) (fun i => coordinate_pow ell (f i)) + +omit [Fintype κ] [DecidableEq ι] [DecidableEq κ] in +@[simp] theorem includeVariables_coordinate (f : ι → κ) (i : ι) : + includeVariables (k := k) ell f (coordinate ell i) = coordinate ell (f i) := + eval_coordinate _ _ _ _ + +noncomputable def merge : + Ring (ι := ι) (k := k) ell ⊗[k] Ring (ι := κ) (k := k) ell →ₐ[k] + Ring (ι := ι ⊕ κ) (k := k) ell := + Algebra.TensorProduct.lift (includeVariables ell Sum.inl) (includeVariables ell Sum.inr) + (fun _ _ => Commute.all _ _) + +omit [DecidableEq ι] [DecidableEq κ] in +@[simp] theorem merge_tmul (a : Ring (ι := ι) (k := k) ell) + (b : Ring (ι := κ) (k := k) ell) : merge (k := k) (ι := ι) (κ := κ) ell (a ⊗ₜ[k] b) = + includeVariables (k := k) ell (Sum.inl : ι → ι ⊕ κ) a * includeVariables (k := k) ell (Sum.inr : κ → ι ⊕ κ) b := by + exact Algebra.TensorProduct.lift_tmul _ _ _ a b + +noncomputable def splitCoordinates : ι ⊕ κ → + Ring (ι := ι) (k := k) ell ⊗[k] Ring (ι := κ) (k := k) ell + | .inl i => (Algebra.TensorProduct.includeLeft : Ring (ι := ι) (k := k) ell →ₐ[k] Ring (ι := ι) (k := k) ell ⊗[k] Ring (ι := κ) (k := k) ell) (coordinate ell i) + | .inr j => (Algebra.TensorProduct.includeRight : Ring (ι := κ) (k := k) ell →ₐ[k] Ring (ι := ι) (k := k) ell ⊗[k] Ring (ι := κ) (k := k) ell) (coordinate ell j) + +omit [Fintype ι] [Fintype κ] [DecidableEq ι] [DecidableEq κ] in +theorem splitCoordinates_pow (i : ι ⊕ κ) : + splitCoordinates (k := k) ell i ^ ell = 0 := by + cases i with + | inl i => change ((Algebra.TensorProduct.includeLeft : Ring (ι := ι) (k := k) ell →ₐ[k] Ring (ι := ι) (k := k) ell ⊗[k] Ring (ι := κ) (k := k) ell) (coordinate ell i))^ell = 0 + rw [← map_pow, coordinate_pow, map_zero] + | inr j => change ((Algebra.TensorProduct.includeRight : Ring (ι := κ) (k := k) ell →ₐ[k] Ring (ι := ι) (k := k) ell ⊗[k] Ring (ι := κ) (k := k) ell) (coordinate ell j))^ell = 0 + rw [← map_pow, coordinate_pow, map_zero] + +noncomputable def splitBlocks : Ring (ι := ι ⊕ κ) (k := k) ell →ₐ[k] + Ring (ι := ι) (k := k) ell ⊗[k] Ring (ι := κ) (k := k) ell := + eval ell (splitCoordinates (k := k) (ι := ι) (κ := κ) ell) (splitCoordinates_pow ell) + +omit [DecidableEq ι] [DecidableEq κ] in +@[simp] theorem split_coordinate (i : ι ⊕ κ) : + splitBlocks (k := k) ell (coordinate ell i) = splitCoordinates ell i := + eval_coordinate _ _ _ _ + +omit [DecidableEq κ] in +@[simp] theorem split_includeVariables_left : + (splitBlocks (k := k) (ι := ι) (κ := κ) ell).comp (includeVariables ell Sum.inl) = + Algebra.TensorProduct.includeLeft := by + refine algHom_ext (ι := ι) (k := k) (S := Ring (ι := ι) (k := k) ell ⊗[k] Ring (ι := κ) (k := k) ell) ell _ _ ?_ + intro i + simp only [AlgHom.comp_apply, includeVariables_coordinate, split_coordinate] + rfl + +omit [DecidableEq ι] in +@[simp] theorem split_includeVariables_right : + (splitBlocks (k := k) (ι := ι) (κ := κ) ell).comp (includeVariables ell Sum.inr) = + Algebra.TensorProduct.includeRight := by + refine algHom_ext (ι := κ) (k := k) (S := Ring (ι := ι) (k := k) ell ⊗[k] Ring (ι := κ) (k := k) ell) ell _ _ ?_ + intro i + simp only [AlgHom.comp_apply, includeVariables_coordinate, split_coordinate] + rfl + +theorem merge_split : + (merge (k := k) (ι := ι) (κ := κ) ell).comp (splitBlocks ell) = AlgHom.id k _ := by + refine algHom_ext (ι := ι ⊕ κ) (k := k) (S := Ring (ι := ι ⊕ κ) (k := k) ell) ell _ _ ?_ + intro i + cases i with + | inl i => simp [splitCoordinates, Algebra.TensorProduct.includeLeft_apply] + | inr j => simp [splitCoordinates, Algebra.TensorProduct.includeRight_apply] + +theorem split_merge : + (splitBlocks (k := k) (ι := ι) (κ := κ) ell).comp (merge (k := k) (ι := ι) (κ := κ) ell) = AlgHom.id k _ := by + apply AlgHom.ext + intro x + induction x using TensorProduct.inductionOn with + | add x y hx hy => simp only [map_add, hx, hy] + | tmul a b => + change splitBlocks (k := k) (ι := ι) (κ := κ) ell (merge (k := k) (ι := ι) (κ := κ) ell (a ⊗ₜ[k] b)) = a ⊗ₜ[k] b + rw [merge_tmul, map_mul] + have h1 := AlgHom.congr_fun (split_includeVariables_left (k := k) (ι := ι) (κ := κ) ell) a + have h2 := AlgHom.congr_fun (split_includeVariables_right (k := k) (ι := ι) (κ := κ) ell) b + rw [AlgHom.comp_apply] at h1 h2 + rw [h1, h2] + simp [Algebra.TensorProduct.includeLeft_apply, Algebra.TensorProduct.includeRight_apply] + +noncomputable def sumEquiv : Ring (ι := ι ⊕ κ) (k := k) ell ≃ₐ[k] + Ring (ι := ι) (k := k) ell ⊗[k] Ring (ι := κ) (k := k) ell := + AlgEquiv.ofAlgHom (splitBlocks ell) (merge (k := k) (ι := ι) (κ := κ) ell) (split_merge ell) (merge_split (k := k) (ι := ι) (κ := κ) ell) + +end BoundaryOnly.FormalObstruction.Frobenius + +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/CycleTransfer.lean b/lean/OAI/Algebra/FrobeniusObstruction/CycleTransfer.lean new file mode 100644 index 0000000000000000000000000000000000000000..b189f4eb08165195982de359b25d3150a24f5895 --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/CycleTransfer.lean @@ -0,0 +1,53 @@ +import Mathlib + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace BoundaryOnly.FormalObstruction.CycleTransfer +variable {k A H : Type*} [Field k] [AddCommGroup A] [Module k A] + [AddCommGroup H] [Module k H] +variable (δ : A →ₗ[k] A) (j : H →ₗ[k] A) (p : A →ₗ[k] H) +variable (hpδ : ∀ x, p (δ x) = 0) +variable (hdecomp : ∀ z, δ z = 0 → ∃ y, z - j (p z) = δ y) + + + +include hpδ hdecomp in +theorem operator (F G : A →ₗ[k] A) (T : H →ₗ[k] H) + (hF : ∀ x, F (δ x) = δ (G x)) + (hT : ∀ x, T x = p (F (j x))) (z : A) (hz : δ z = 0) : + T (p z) = p (F z) := by + obtain ⟨y,hy⟩ := hdecomp z hz + have h := congrArg (fun a => p (F a)) hy + simp only [map_sub, hF, hpδ] at h + rw [hT] + exact (sub_eq_zero.mp h).symm + + +include hdecomp in +theorem pairing (Φ : A →ₗ[k] k) (hΦδ : ∀ a, Φ (δ a) = 0) + (z : A) (hz : δ z = 0) : Φ (j (p z)) = Φ z := by + obtain ⟨y,hy⟩ := hdecomp z hz + have h := congrArg Φ hy + simp only [map_sub, hΦδ] at h + exact (sub_eq_zero.mp h).symm + + + +include hdecomp in +theorem pairing_operator (F G : A →ₗ[k] A) (T : H →ₗ[k] H) + (hδF : ∀ x, δ (F x) = G (δ x)) (hδj : ∀ x, δ (j x) = 0) + (hT : ∀ x, T x = p (F (j x))) + (Φ : A →ₗ[k] k) (hΦδ : ∀ a, Φ (δ a) = 0) (hΦF : ∀ a, Φ (F a) = 0) + (x : H) : Φ (j (T x)) = 0 := by + rw [hT, pairing δ j p hdecomp Φ hΦδ] + · exact hΦF _ + · rw [hδF, hδj, map_zero] + +end BoundaryOnly.FormalObstruction.CycleTransfer + +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/Derivations.lean b/lean/OAI/Algebra/FrobeniusObstruction/Derivations.lean new file mode 100644 index 0000000000000000000000000000000000000000..f673a5ddb7aa4e2051e814cd9c426dbd1c2c6ab9 --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/Derivations.lean @@ -0,0 +1,140 @@ +import Mathlib +import OAI.Algebra.FrobeniusObstruction.Coordinates + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace BoundaryOnly.FormalObstruction.Frobenius +variable {ι k S : Type*} [Fintype ι] [DecidableEq ι] [CommRing k] + [CommRing S] [Algebra k S] (ell : ℕ) + + + +theorem relativeDeriv_ext (f : Ring (ι := ι) (k := k) ell →ₐ[k] S) + (u v : Ring (ι := ι) (k := k) ell →ₗ[k] S) + (hu1 : u 1 = 0) (hv1 : v 1 = 0) + (hu : ∀ x y, u (x*y) = u x * f y + f x * u y) + (hv : ∀ x y, v (x*y) = v x * f y + f x * v y) + (h : ∀ i, u (coordinate ell i) = v (coordinate ell i)) : u = v := by + let X : ι → Ring (ι := ι) (k := k) ell := coordinate ell + have hp (i : ι) (r : ℕ) : u (X i ^ r) = v (X i ^ r) := by + induction r with + | zero => exact hu1.trans hv1.symm + | succ r hr => + rw [pow_succ, hu, hv, hr, h i] + have hm (s : Finset ι) (p : ι → ℕ) : + u (∏ i ∈ s, X i ^ p i) = v (∏ i ∈ s, X i ^ p i) := by + induction s using Finset.induction_on with + | empty => exact hu1.trans hv1.symm + | @insert i s hi ih => + rw [Finset.prod_insert hi, hu, hv, hp, ih] + apply LinearMap.ext + intro x + rw [monomial_expansion ell x, map_sum, map_sum] + apply Finset.sum_congr rfl + intro a _ + rw [map_smul, map_smul, monomial_eq_prod] + congr 1 + simpa only [monomial_eq_prod, Finsupp.prod, X] using hm _ (exponent ell a) + +variable {κ : Type*} [Fintype κ] [DecidableEq κ] [CharP k ell] + +@[simp] theorem partial_include_left (i : ι) (a : Ring (ι := ι) (k := k) ell) : + partialDeriv ell (Sum.inl i : ι ⊕ κ) + (includeVariables (k := k) ell Sum.inl a) = + includeVariables (k := k) ell Sum.inl (partialDeriv ell i a) := by + let f : Ring (ι := ι) (k := k) ell →ₐ[k] Ring (ι := ι ⊕ κ) (k := k) ell := + includeVariables ell Sum.inl + have H : (partialDeriv (k := k) ell (Sum.inl i : ι ⊕ κ)).toLinearMap.comp f.toLinearMap = + f.toLinearMap.comp (partialDeriv ell i).toLinearMap := by + apply relativeDeriv_ext ell f + · simp + · simp + · intro x y + simp only [LinearMap.comp_apply, Derivation.coeFn_coe, AlgHom.toLinearMap_apply, + map_mul, Derivation.leibniz, smul_eq_mul] + ring + · intro x y + simp only [LinearMap.comp_apply, Derivation.coeFn_coe, AlgHom.toLinearMap_apply, + Derivation.leibniz, smul_eq_mul, map_add, map_mul] + ring + · intro j + simp only [LinearMap.comp_apply, Derivation.coeFn_coe, AlgHom.toLinearMap_apply, + f, includeVariables_coordinate] + simp only [coordinate, partial_coordinate, Sum.inl.injEq] + split_ifs <;> simp + exact LinearMap.congr_fun H a + +@[simp] theorem partial_include_left_other (j : κ) (a : Ring (ι := ι) (k := k) ell) : + partialDeriv ell (Sum.inr j : ι ⊕ κ) + (includeVariables (k := k) ell Sum.inl a) = 0 := by + let f : Ring (ι := ι) (k := k) ell →ₐ[k] Ring (ι := ι ⊕ κ) (k := k) ell := + includeVariables ell Sum.inl + have H : (partialDeriv (k := k) ell (Sum.inr j : ι ⊕ κ)).toLinearMap.comp f.toLinearMap = 0 := by + apply relativeDeriv_ext ell f + · simp + · rfl + · intro x y + simp only [LinearMap.comp_apply, Derivation.coeFn_coe, AlgHom.toLinearMap_apply, + map_mul, Derivation.leibniz, smul_eq_mul] + ring + · intros; simp + · intro i + simp only [LinearMap.comp_apply, Derivation.coeFn_coe, AlgHom.toLinearMap_apply, + f, includeVariables_coordinate, LinearMap.zero_apply] + simp only [coordinate, partial_coordinate, Sum.inr_ne_inl, ↓reduceIte] + exact LinearMap.congr_fun H a + +@[simp] theorem partial_include_right (i : κ) (a : Ring (ι := κ) (k := k) ell) : + partialDeriv ell (Sum.inr i : ι ⊕ κ) + (includeVariables (k := k) ell Sum.inr a) = + includeVariables (k := k) ell Sum.inr (partialDeriv ell i a) := by + let f : Ring (ι := κ) (k := k) ell →ₐ[k] Ring (ι := ι ⊕ κ) (k := k) ell := + includeVariables ell Sum.inr + have H : (partialDeriv (k := k) ell (Sum.inr i : ι ⊕ κ)).toLinearMap.comp f.toLinearMap = + f.toLinearMap.comp (partialDeriv ell i).toLinearMap := by + apply relativeDeriv_ext ell f + · simp + · simp + · intro x y + simp only [LinearMap.comp_apply, Derivation.coeFn_coe, AlgHom.toLinearMap_apply, + map_mul, Derivation.leibniz, smul_eq_mul] + ring + · intro x y + simp only [LinearMap.comp_apply, Derivation.coeFn_coe, AlgHom.toLinearMap_apply, + Derivation.leibniz, smul_eq_mul, map_add, map_mul] + ring + · intro j + simp only [LinearMap.comp_apply, Derivation.coeFn_coe, AlgHom.toLinearMap_apply, + f, includeVariables_coordinate] + simp only [coordinate, partial_coordinate, Sum.inr.injEq] + split_ifs <;> simp + exact LinearMap.congr_fun H a + +@[simp] theorem partial_include_right_other (j : ι) (a : Ring (ι := κ) (k := k) ell) : + partialDeriv ell (Sum.inl j : ι ⊕ κ) + (includeVariables (k := k) ell Sum.inr a) = 0 := by + let f : Ring (ι := κ) (k := k) ell →ₐ[k] Ring (ι := ι ⊕ κ) (k := k) ell := + includeVariables ell Sum.inr + have H : (partialDeriv (k := k) ell (Sum.inl j : ι ⊕ κ)).toLinearMap.comp f.toLinearMap = 0 := by + apply relativeDeriv_ext ell f + · simp + · rfl + · intro x y + simp only [LinearMap.comp_apply, Derivation.coeFn_coe, AlgHom.toLinearMap_apply, + map_mul, Derivation.leibniz, smul_eq_mul] + ring + · intros; simp + · intro i + simp only [LinearMap.comp_apply, Derivation.coeFn_coe, AlgHom.toLinearMap_apply, + f, includeVariables_coordinate, LinearMap.zero_apply] + simp only [coordinate, partial_coordinate, Sum.inl_ne_inr, ↓reduceIte] + exact LinearMap.congr_fun H a + +end BoundaryOnly.FormalObstruction.Frobenius + +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/ExteriorSplit.lean b/lean/OAI/Algebra/FrobeniusObstruction/ExteriorSplit.lean new file mode 100644 index 0000000000000000000000000000000000000000..d264688feb0226d7268afc210f29b2e6635f09cb --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/ExteriorSplit.lean @@ -0,0 +1,63 @@ +import Mathlib + +namespace OAI + +noncomputable section +open scoped BigOperators + +noncomputable section +open scoped TensorProduct +namespace BoundaryOnly.FormalObstruction.ExteriorSplit +variable {k ι κ : Type*} [CommRing k] + +abbrev Ext (k ι : Type*) [CommRing k] := ExteriorAlgebra k (ι → k) + +def leftVec : (ι → k) →ₗ[k] (ι ⊕ κ → k) where + toFun v := Sum.elim v (fun _ => 0) + map_add' x y := by funext i; cases i <;> simp + map_smul' a x := by funext i; cases i <;> simp + +def rightVec : (κ → k) →ₗ[k] (ι ⊕ κ → k) where + toFun v := Sum.elim (fun _ => 0) v + map_add' x y := by funext i; cases i <;> simp + map_smul' a x := by funext i; cases i <;> simp + +def splitIsometry : (0 : QuadraticForm k (ι ⊕ κ → k)).IsometryEquiv + ((0 : QuadraticForm k (ι → k)).prod (0 : QuadraticForm k (κ → k))) := + { LinearEquiv.sumArrowLequivProdArrow ι κ k k with + map_app' := fun x => by simp } + +noncomputable def sumEquiv : Ext k (ι ⊕ κ) ≃ₗ[k] Ext k ι ⊗[k] Ext k κ := + ((CliffordAlgebra.equivOfIsometry (splitIsometry (k := k) (ι := ι) (κ := κ))).toLinearEquiv.trans + (CliffordAlgebra.prodEquiv (0 : QuadraticForm k (ι → k)) + (0 : QuadraticForm k (κ → k))).toLinearEquiv).trans + (GradedTensorProduct.of k _ _).symm + +@[simp] theorem sumEquiv_symm_tmul (x : Ext k ι) (y : Ext k κ) : + (sumEquiv (k := k) (ι := ι) (κ := κ)).symm (x ⊗ₜ[k] y) = + ExteriorAlgebra.map leftVec x * ExteriorAlgebra.map rightVec y := by + change (CliffordAlgebra.equivOfIsometry splitIsometry).symm + (CliffordAlgebra.toProd _ _ (GradedTensorProduct.of k _ _ (x ⊗ₜ[k] y))) = _ + rw [CliffordAlgebra.toProd, GradedTensorProduct.lift_tmul, map_mul] + congr 1 + · have h : ((CliffordAlgebra.equivOfIsometry + (splitIsometry (k := k) (ι := ι) (κ := κ))).symm.toAlgHom).comp + (CliffordAlgebra.map (QuadraticMap.Isometry.inl _ _)) = + ExteriorAlgebra.map leftVec := by + ext v + simp [CliffordAlgebra.equivOfIsometry, splitIsometry, leftVec]; rfl + exact AlgHom.congr_fun h x + · have h : ((CliffordAlgebra.equivOfIsometry + (splitIsometry (k := k) (ι := ι) (κ := κ))).symm.toAlgHom).comp + (CliffordAlgebra.map (QuadraticMap.Isometry.inr _ _)) = + ExteriorAlgebra.map rightVec := by + ext v + simp [CliffordAlgebra.equivOfIsometry, splitIsometry, rightVec]; rfl + exact AlgHom.congr_fun h y + +end BoundaryOnly.FormalObstruction.ExteriorSplit + +end +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/FixedResidue.lean b/lean/OAI/Algebra/FrobeniusObstruction/FixedResidue.lean new file mode 100644 index 0000000000000000000000000000000000000000..94564d1ef1f104c08ba332cbb8e68753b5ad08e7 --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/FixedResidue.lean @@ -0,0 +1,151 @@ +import Mathlib +import OAI.Algebra.FrobeniusObstruction.BlockTensor +import OAI.Algebra.FrobeniusObstruction.ResiduePairing +import OAI.Algebra.FrobeniusObstruction.NormalPrimitives + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace BoundaryOnly.FormalObstruction.MixedForms +open scoped TensorProduct +variable {k A ι : Type*} [CommRing k] [CommRing A] [Algebra k A] +theorem coeff_mul_tmul (a b : A) (x : Ext (k := k) (ι := ι)) : + coeff a * (b ⊗ₜ[k] x) = (a*b) ⊗ₜ[k] x := by + simp only [coeff_apply, Algebra.TensorProduct.tmul_mul_tmul, one_mul] +end BoundaryOnly.FormalObstruction.MixedForms + +namespace BoundaryOnly.FormalObstruction.FixedResidue +open Frobenius MixedForms +open scoped TensorProduct +variable {ι k : Type*} [Fintype ι] [DecidableEq ι] [Field k] +variable (ell : ℕ) (hell : 0 < ell) + +abbrev Scalar := Frobenius.Ring (ι := ι) (k := k) ell +abbrev BScalar := Frobenius.Ring (ι := ι) (k := ThreeParameters.Ring k) ell + + + +def scalar (v : Ext (k := k) (ι := ι) →ₗ[k] k) : + Forms (k := k) (A := Scalar (ι := ι) (k := k) ell) (ι := ι) →ₗ[k] k := + (TensorProduct.lid k k).toLinearMap.comp + (TensorProduct.map (quotientCoeff ell (topExponent ell) (topExponent_good hell)) v) + +def parameter (v : Ext (k := k) (ι := ι) →ₗ[k] k) : + Forms (k := k) (A := BScalar (ι := ι) (k := k) ell) (ι := ι) →ₗ[k] ThreeParameters.Ring k := + (TensorProduct.rid k (ThreeParameters.Ring k)).toLinearMap.comp + (TensorProduct.map + ((quotientCoeff (ι := ι) (k := ThreeParameters.Ring k) ell + (topExponent ell) (topExponent_good hell)).restrictScalars k) v) + +omit [DecidableEq ι] in +@[simp] theorem scalar_tmul (v : Ext (k := k) (ι := ι) →ₗ[k] k) + (a : Scalar (ι := ι) (k := k) ell) (x : Ext (k := k) (ι := ι)) : + scalar ell hell v (a ⊗ₜ[k] x) = + quotientCoeff ell (topExponent ell) (topExponent_good hell) a * v x := rfl + +omit [DecidableEq ι] in +@[simp] theorem parameter_tmul (v : Ext (k := k) (ι := ι) →ₗ[k] k) + (a : BScalar (ι := ι) (k := k) ell) (x : Ext (k := k) (ι := ι)) : + parameter ell hell v (a ⊗ₜ[k] x) = + (v x) • quotientCoeff ell (topExponent ell) (topExponent_good hell) a := rfl + +omit [DecidableEq ι] in +theorem parameter_coeff_mul (v : Ext (k := k) (ι := ι) →ₗ[k] k) + (b : ThreeParameters.Ring k) + (x : Forms (k := k) (A := BScalar (ι := ι) (k := k) ell) (ι := ι)) : + parameter ell hell v (coeff (@algebraMap (ThreeParameters.Ring k) + (BScalar (ι := ι) (k := k) ell) inferInstance inferInstance inferInstance b) * x) = b * parameter ell hell v x := by + induction x using TensorProduct.inductionOn with + | add x y hx hy => simp only [mul_add, map_add, hx, hy] + | tmul a x => + rw [coeff_mul_tmul, parameter_tmul, parameter_tmul] + rw [← Algebra.smul_def, map_smul] + exact smul_comm (v x) b _ + +omit [DecidableEq ι] in +theorem topCoeff_reduction (x : BScalar (ι := ι) (k := k) ell) : + ThreeParameters.augmentation k + (quotientCoeff ell (topExponent ell) (topExponent_good hell) x) = + quotientCoeff ell (topExponent ell) (topExponent_good hell) (reduction ell x) := by + induction x using Quotient.inductionOn with + | h f => + change ThreeParameters.augmentation k (MvPowerSeries.coeff (topExponent ell) f) = + MvPowerSeries.coeff (topExponent ell) + (MvPowerSeries.map (ThreeParameters.augmentation k) f) + simp only [MvPowerSeries.coeff_map] + +omit [DecidableEq ι] in +theorem reduction_parameter (v : Ext (k := k) (ι := ι) →ₗ[k] k) + (x : Forms (k := k) (A := BScalar (ι := ι) (k := k) ell) (ι := ι)) : + ThreeParameters.augmentation k (parameter ell hell v x) = + scalar ell hell v (coefficientMap (reduction ell) x) := by + induction x using TensorProduct.inductionOn with + | add x y hx hy => simp only [map_add, hx, hy] + | tmul a x => + rw [parameter_tmul, coefficientMap_tmul, scalar_tmul] + let f : ThreeParameters.Ring k →ₐ[k] k := + { ThreeParameters.augmentation k with + commutes' := ThreeParameters.augmentation_algebraMap k } + have hs := f.toLinearMap.map_smul (v x) + (quotientCoeff ell (topExponent ell) (topExponent_good hell) a) + change ThreeParameters.augmentation k (v x • _) = + v x • ThreeParameters.augmentation k (quotientCoeff ell (topExponent ell) + (topExponent_good hell) a) at hs + rw [hs, topCoeff_reduction ell hell] + exact mul_comm _ _ + + theorem mul_delta_of_cycle {A : Type*} [CommRing A] [Algebra k A] + (pd : ι → Derivation k A A) (F : A) + (x y : Forms (k := k) (A := A) (ι := ι)) (hy : delta pd F y = 0) : + delta pd F x * y = 0 := by + rw [delta_apply, gradient_supercommute, mul_assoc, ← delta_apply, hy, mul_zero] + +omit [DecidableEq ι] in +theorem parameter_pair_isUnit + (v : Ext (k := k) (ι := ι) →ₗ[k] k) + (x : Forms (k := k) (A := BScalar (ι := ι) (k := k) ell) (ι := ι)) + (hx : scalar ell hell v (coefficientMap (reduction ell) x) ≠ 0) : + IsUnit (parameter ell hell v x) := by + apply ThreeParameters.isUnit_of_augmentation_ne_zero k + rwa [reduction_parameter ell hell v] + +theorem residue_zero_of_w_boundary + (v : Ext (k := k) (ι := ι) →ₗ[k] k) + (pd : ι → Derivation k (BScalar (ι := ι) (k := k) ell) + (BScalar (ι := ι) (k := k) ell)) (F : BScalar (ι := ι) (k := k) ell) + (alpha beta eta : Forms (k := k) (A := BScalar (ι := ι) (k := k) ell) (ι := ι)) + (hbeta : delta pd F beta = 0) + (heta : delta pd F eta = + coeff (@algebraMap (ThreeParameters.Ring k) (BScalar (ι := ι) (k := k) ell) + inferInstance inferInstance inferInstance (ThreeParameters.w k)) * alpha) : + ThreeParameters.w k * parameter ell hell v (alpha * beta) = 0 := by + have hz : delta pd F eta * beta = 0 := by + rw [delta_apply, gradient_supercommute, mul_assoc, ← delta_apply, hbeta, mul_zero] + rw [heta, mul_assoc] at hz + have hr := congrArg (parameter ell hell v) hz + rw [parameter_coeff_mul ell hell v, map_zero] at hr + exact hr + + + +theorem unit_residue_contradiction + (v : Ext (k := k) (ι := ι) →ₗ[k] k) + (pd : ι → Derivation k (BScalar (ι := ι) (k := k) ell) + (BScalar (ι := ι) (k := k) ell)) (F : BScalar (ι := ι) (k := k) ell) + (alpha beta eta : Forms (k := k) (A := BScalar (ι := ι) (k := k) ell) (ι := ι)) + (hbeta : delta pd F beta = 0) + (heta : delta pd F eta = + coeff (@algebraMap (ThreeParameters.Ring k) (BScalar (ι := ι) (k := k) ell) + inferInstance inferInstance inferInstance (ThreeParameters.w k)) * alpha) + (hpair : scalar ell hell v (coefficientMap (reduction ell) (alpha * beta)) ≠ 0) : False := by + have hu := parameter_pair_isUnit ell hell v (alpha * beta) hpair + have hz := residue_zero_of_w_boundary ell hell v pd F alpha beta eta hbeta heta + exact ThreeParameters.w_ne_zero k ((hu.mul_left_eq_zero).mp hz) + +end BoundaryOnly.FormalObstruction.FixedResidue + +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/FormTensor.lean b/lean/OAI/Algebra/FrobeniusObstruction/FormTensor.lean new file mode 100644 index 0000000000000000000000000000000000000000..682bd35f0777c855d7d5c8077450e0daa4103708 --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/FormTensor.lean @@ -0,0 +1,266 @@ +import Mathlib +import OAI.Algebra.FrobeniusObstruction.MixedForms +import OAI.Algebra.FrobeniusObstruction.ExteriorSplit +import OAI.Algebra.FrobeniusObstruction.Derivations + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace BoundaryOnly.FormalObstruction.FormsSplit +open scoped TensorProduct +open Frobenius MixedForms +variable {ι κ k : Type*} [Fintype ι] [Fintype κ] [DecidableEq ι] [DecidableEq κ] + [CommRing k] (ell : ℕ) + +abbrev QForms (ι : Type*) [Fintype ι] [DecidableEq ι] := + MixedForms.Forms (k := k) (A := Frobenius.Ring (ι := ι) (k := k) ell) (ι := ι) + +noncomputable def includeLeft : QForms (k := k) ell ι →ₐ[k] QForms (k := k) ell (ι ⊕ κ) := + Algebra.TensorProduct.map (includeVariables ell Sum.inl) + (ExteriorAlgebra.map ExteriorSplit.leftVec) +noncomputable def includeRight : QForms (k := k) ell κ →ₐ[k] QForms (k := k) ell (ι ⊕ κ) := + Algebra.TensorProduct.map (includeVariables ell Sum.inr) + (ExteriorAlgebra.map ExteriorSplit.rightVec) + + + +noncomputable def sumEquiv : QForms (k := k) ell (ι ⊕ κ) ≃ₗ[k] + QForms (k := k) ell ι ⊗[k] QForms (k := k) ell κ := + (TensorProduct.congr (Frobenius.sumEquiv (k := k) (ι := ι) (κ := κ) ell).toLinearEquiv + (ExteriorSplit.sumEquiv (k := k) (ι := ι) (κ := κ))).trans + (TensorProduct.tensorTensorTensorComm k _ _ _ _) + +@[simp] theorem sumEquiv_symm_tmul (x : QForms (k := k) ell ι) + (y : QForms (k := k) ell κ) : + (sumEquiv (k := k) (ι := ι) (κ := κ) ell).symm (x ⊗ₜ[k] y) = + includeLeft ell x * includeRight ell y := by + induction x using TensorProduct.inductionOn with + | add x x' hx hx' => simp only [TensorProduct.add_tmul, map_add, add_mul, hx, hx'] + | tmul a e => + induction y using TensorProduct.inductionOn with + | add y y' hy hy' => simp only [TensorProduct.tmul_add, map_add, mul_add, hy, hy'] + | tmul b f => + change (TensorProduct.congr + (Frobenius.sumEquiv (k := k) (ι := ι) (κ := κ) ell).toLinearEquiv + (ExteriorSplit.sumEquiv (k := k) (ι := ι) (κ := κ))).symm + ((TensorProduct.tensorTensorTensorComm k _ _ _ _).symm + ((a ⊗ₜ[k] e) ⊗ₜ[k] (b ⊗ₜ[k] f))) = _ + rw [TensorProduct.tensorTensorTensorComm_symm, TensorProduct.tensorTensorTensorComm_tmul, TensorProduct.congr_symm, + TensorProduct.congr_tmul, ExteriorSplit.sumEquiv_symm_tmul] + change merge (k := k) (ι := ι) (κ := κ) ell (a ⊗ₜ[k] b) ⊗ₜ[k] + (ExteriorAlgebra.map ExteriorSplit.leftVec e * ExteriorAlgebra.map ExteriorSplit.rightVec f) = _ + rw [merge_tmul] + simp only [includeLeft, includeRight, Algebra.TensorProduct.map_tmul, + Algebra.TensorProduct.tmul_mul_tmul] + +omit [Fintype ι] [Fintype κ] in +@[simp] theorem exterior_left_gen (i : ι) : + ExteriorAlgebra.map (ExteriorSplit.leftVec (k := k) (κ := κ)) (gen i) = + gen (Sum.inl i : ι ⊕ κ) := by + rw [gen, ExteriorAlgebra.map_apply_ι] + congr 1 + funext j + cases j <;> simp [ExteriorSplit.leftVec, Pi.single_apply] + +omit [Fintype ι] [Fintype κ] in +@[simp] theorem exterior_right_gen (i : κ) : + ExteriorAlgebra.map (ExteriorSplit.rightVec (k := k) (ι := ι)) (gen i) = + gen (Sum.inr i : ι ⊕ κ) := by + rw [gen, ExteriorAlgebra.map_apply_ι] + congr 1 + funext j + cases j <;> simp [ExteriorSplit.rightVec, Pi.single_apply] + + theorem involute_map {V W : Type*} [AddCommGroup V] [AddCommGroup W] + [Module k V] [Module k W] (f : V →ₗ[k] W) (e : ExteriorAlgebra k V) : + CliffordAlgebra.involute (ExteriorAlgebra.map f e) = + ExteriorAlgebra.map f (CliffordAlgebra.involute e) := by + have h : (CliffordAlgebra.involute : ExteriorAlgebra k W →ₐ[k] _).comp + (ExteriorAlgebra.map f) = (ExteriorAlgebra.map f).comp CliffordAlgebra.involute := by + ext v + simp + exact AlgHom.congr_fun h e + +@[simp] theorem parity_includeLeft (x : QForms (k := k) ell ι) : + parity (includeLeft (κ := κ) ell x) = includeLeft ell (parity x) := by + induction x using TensorProduct.inductionOn with + | add x y hx hy => simp only [map_add, hx, hy] + | tmul a e => simp only [includeLeft, Algebra.TensorProduct.map_tmul, parity_tmul, + involute_map] + +@[simp] theorem parity_includeRight (x : QForms (k := k) ell κ) : + parity (includeRight (ι := ι) ell x) = includeRight ell (parity x) := by + induction x using TensorProduct.inductionOn with + | add x y hx hy => simp only [map_add, hx, hy] + | tmul a e => simp only [includeRight, Algebra.TensorProduct.map_tmul, parity_tmul, + involute_map] + +variable [CharP k ell] + +@[simp] theorem d_includeLeft (x : QForms (k := k) ell ι) : + d (partialDeriv ell) (includeLeft (κ := κ) ell x) = + includeLeft ell (d (partialDeriv ell) x) := by + induction x using TensorProduct.inductionOn with + | add x y hx hy => simp only [map_add, hx, hy] + | tmul a e => + simp only [includeLeft, Algebra.TensorProduct.map_tmul, d_tmul, + Fintype.sum_sum_type, partial_include_left, partial_include_left_other, + TensorProduct.zero_tmul, Finset.sum_const_zero, add_zero, map_sum, map_mul, + exterior_left_gen] + +@[simp] theorem d_includeRight (x : QForms (k := k) ell κ) : + d (partialDeriv ell) (includeRight (ι := ι) ell x) = + includeRight ell (d (partialDeriv ell) x) := by + induction x using TensorProduct.inductionOn with + | add x y hx hy => simp only [map_add, hx, hy] + | tmul a e => + simp only [includeRight, Algebra.TensorProduct.map_tmul, d_tmul, + Fintype.sum_sum_type, partial_include_right, partial_include_right_other, + TensorProduct.zero_tmul, Finset.sum_const_zero, zero_add, map_sum, map_mul, + exterior_right_gen] + +omit [CharP k ell] in +@[simp] theorem includeLeft_coeff (a : Ring (ι := ι) (k := k) ell) : + includeLeft (κ := κ) ell (coeff a) = coeff (includeVariables ell Sum.inl a) := by + simp only [includeLeft, coeff_apply, Algebra.TensorProduct.map_tmul, map_one] +omit [CharP k ell] in +@[simp] theorem includeRight_coeff (a : Ring (ι := κ) (k := k) ell) : + includeRight (ι := ι) ell (coeff a) = coeff (includeVariables ell Sum.inr a) := by + simp only [includeRight, coeff_apply, Algebra.TensorProduct.map_tmul, map_one] + +@[simp] theorem gradient_include_left (a : Ring (ι := ι) (k := k) ell) : + gradient (partialDeriv ell) (includeVariables ell (Sum.inl : ι → ι ⊕ κ) a) = + includeLeft ell (gradient (partialDeriv ell) a) := by + change d (partialDeriv ell) (coeff (includeVariables ell Sum.inl a)) = _ + rw [← includeLeft_coeff, d_includeLeft, d_coeff] + +@[simp] theorem gradient_include_right (a : Ring (ι := κ) (k := k) ell) : + gradient (partialDeriv ell) (includeVariables ell (Sum.inr : κ → ι ⊕ κ) a) = + includeRight ell (gradient (partialDeriv ell) a) := by + change d (partialDeriv ell) (coeff (includeVariables ell Sum.inr a)) = _ + rw [← includeRight_coeff, d_includeRight, d_coeff] + +theorem gradient_add {A : Type*} [CommRing A] [Algebra k A] + (pd : ι → Derivation k A A) (a b : A) : + gradient pd (a + b) = gradient pd a + gradient pd b := by + simp only [MixedForms.gradient, TensorProduct.add_tmul, map_add] + + + +theorem delta_product (Q : Ring (ι := ι) (k := k) ell) + (R : Ring (ι := κ) (k := k) ell) (x : QForms (k := k) ell ι) + (y : QForms (k := k) ell κ) : + delta (partialDeriv ell) (includeVariables ell Sum.inl Q + includeVariables ell Sum.inr R) + (includeLeft ell x * includeRight ell y) = + includeLeft ell (delta (partialDeriv ell) Q x) * includeRight ell y + + includeLeft ell (parity x) * includeRight ell (delta (partialDeriv ell) R y) := by + rw [delta_apply, gradient_add, gradient_include_left, gradient_include_right, add_mul] + congr 1 + · rw [delta_apply, map_mul, mul_assoc] + · rw [← gradient_include_right, ← mul_assoc, gradient_supercommute, parity_includeLeft, + mul_assoc, delta_apply, map_mul, gradient_include_right] + +end BoundaryOnly.FormalObstruction.FormsSplit + +namespace BoundaryOnly.FormalObstruction.GlobalForms +open Frobenius MixedForms +open scoped TensorProduct +variable {k : Type*} [CommRing k] + + +abbrev Coordinates : (n : ℕ) → (Fin n → Type) → Type + | 0, _ => PEmpty + | n + 1, V => V 0 ⊕ Coordinates n (fun i => V i.succ) + +instance coordinatesFintype : ∀ (n : ℕ) (V : Fin n → Type) [∀ i, Fintype (V i)], + Fintype (Coordinates n V) + | 0, _, _ => inferInstanceAs (Fintype PEmpty) + | n + 1, V, _ => by + letI := coordinatesFintype n (fun i => V i.succ) + exact inferInstanceAs (Fintype (V 0 ⊕ Coordinates n (fun i => V i.succ))) + +instance coordinatesDecidableEq : ∀ (n : ℕ) (V : Fin n → Type) [∀ i, DecidableEq (V i)], + DecidableEq (Coordinates n V) + | 0, _, _ => inferInstanceAs (DecidableEq PEmpty) + | n + 1, V, _ => by + letI := coordinatesDecidableEq n (fun i => V i.succ) + exact inferInstanceAs (DecidableEq (V 0 ⊕ Coordinates n (fun i => V i.succ))) + +abbrev consIndex (n : ℕ) : Unit ⊕ Fin n ≃ Fin (n + 1) where + toFun := Sum.elim (fun _ => 0) Fin.succ + invFun := Fin.cases (Sum.inl ()) Sum.inr + left_inv := by intro i; cases i with + | inl u => cases u; rfl + | inr i => rfl + right_inv := by intro i; refine Fin.cases ?_ (fun j => ?_) i <;> rfl + +@[simp] theorem consIndex_zero (n : ℕ) : consIndex n (.inl ()) = 0 := rfl +@[simp] theorem consIndex_succ (n : ℕ) (i : Fin n) : consIndex n (.inr i) = i.succ := rfl + + +def tensorCons {n : ℕ} (V : Fin (n + 1) → Type*) [∀ i, AddCommGroup (V i)] + [∀ i, Module k (V i)] : (⨂[k] i, V i) ≃ₗ[k] V 0 ⊗[k] (⨂[k] i : Fin n, V i.succ) := + ((PiTensorProduct.reindex k V (consIndex n).symm).trans + (PiTensorProduct.tmulEquivDep k (fun j => V (consIndex n j))).symm).trans + (TensorProduct.congr (PiTensorProduct.subsingletonEquiv ()) (LinearEquiv.refl _ _)) + +@[simp] theorem tensorCons_tprod {n : ℕ} (V : Fin (n + 1) → Type*) + [∀ i, AddCommGroup (V i)] [∀ i, Module k (V i)] (v : ∀ i, V i) : + tensorCons (k := k) V (PiTensorProduct.tprod k v) = + v 0 ⊗ₜ[k] PiTensorProduct.tprod k (fun i : Fin n => v i.succ) := by + simp only [tensorCons, LinearEquiv.trans_apply, PiTensorProduct.reindex_tprod, + PiTensorProduct.tmulEquivDep_symm_apply, Equiv.symm_symm] + change (TensorProduct.congr + (PiTensorProduct.subsingletonEquiv (R := k) (s := fun _ : Unit => V 0) ()) + (LinearEquiv.refl k (⨂[k] i : Fin n, V i.succ))) + ((PiTensorProduct.tprod k (fun _ : Unit => v 0)) ⊗ₜ[k] + PiTensorProduct.tprod k (fun i : Fin n => v i.succ)) = _ + rw [TensorProduct.congr_tmul, PiTensorProduct.subsingletonEquiv_apply_tprod] + rfl + +def emptyCoefficients (ell : ℕ) (hell : 0 < ell) : + Ring (ι := PEmpty) (k := k) ell ≃ₐ[k] k := + AlgEquiv.ofAlgHom + { constantHom ell hell with commutes' := constantHom_algebraMap ell hell } + (Algebra.ofId k _) + (by ext) + (by apply algHom_ext; intro i; exact PEmpty.elim i) + +def emptyExterior : ExteriorAlgebra k (PEmpty.{1} → k) ≃ₐ[k] k := + AlgEquiv.ofAlgHom (ExteriorAlgebra.lift k ⟨0, by simp⟩) (Algebra.ofId k _) + (by ext) + (by apply ExteriorAlgebra.hom_ext + apply LinearMap.ext + intro v + have hv : v = 0 := Subsingleton.elim _ _ + rw [hv] + simp only [LinearMap.comp_apply, AlgHom.toLinearMap_apply] + rw [show (ExteriorAlgebra.ι k) (0 : PEmpty.{1} → k) = 0 from + (ExteriorAlgebra.ι k).map_zero] + simp) + +abbrev QForms (ell : ℕ) (ι : Type) [Fintype ι] [DecidableEq ι] := + MixedForms.Forms (k := k) (A := Ring (ι := ι) (k := k) ell) (ι := ι) + +def emptyForms (ell : ℕ) (hell : 0 < ell) : QForms (k := k) ell PEmpty ≃ₗ[k] k := + (TensorProduct.congr (emptyCoefficients (k := k) ell hell).toLinearEquiv + (emptyExterior (k := k)).toLinearEquiv).trans (TensorProduct.lid k k) + + +noncomputable def blockEquiv (ell : ℕ) (hell : 0 < ell) : + ∀ (n : ℕ) (V : Fin n → Type) [∀ i, Fintype (V i)] [∀ i, DecidableEq (V i)], + QForms (k := k) ell (Coordinates n V) ≃ₗ[k] (⨂[k] i, QForms (k := k) ell (V i)) + | 0, _, _, _ => (emptyForms ell hell).trans (PiTensorProduct.isEmptyEquiv (Fin 0)).symm + | n + 1, V, _, _ => + ((FormsSplit.sumEquiv (k := k) (ι := V 0) (κ := Coordinates n (fun i => V i.succ)) ell).trans + (TensorProduct.congr (LinearEquiv.refl k (QForms (k := k) ell (V 0))) + (blockEquiv ell hell n (fun i => V i.succ)))).trans + (tensorCons (k := k) (fun i => QForms (k := k) ell (V i))).symm + +end BoundaryOnly.FormalObstruction.GlobalForms + +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/FormalData.lean b/lean/OAI/Algebra/FrobeniusObstruction/FormalData.lean new file mode 100644 index 0000000000000000000000000000000000000000..2022a190d13b9d2be6ce7c36f0a6762ea29b6d90 --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/FormalData.lean @@ -0,0 +1,98 @@ +import Mathlib +import OAI.Algebra.FrobeniusObstruction.LinearChange + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace BoundaryOnly.FormalObstruction + +abbrev SlopeVar (d : ℕ) := Fin d × Fin 3 +abbrev TangentVar {d : ℕ} (n : Fin d → ℕ) := (i : Fin d) × Fin (n i) +abbrev WallVar {d : ℕ} (n : Fin d → ℕ) (i : Fin d) := Fin 3 ⊕ Fin (n i) +abbrev InternalVar {d : ℕ} (n : Fin d → ℕ) := Bool × TangentVar n +abbrev GraphVar {d : ℕ} (n : Fin d → ℕ) := SlopeVar d ⊕ TangentVar n +abbrev AmbientVar {d : ℕ} (n : Fin d → ℕ) := SlopeVar d ⊕ InternalVar n + +def originIdeal (k : Type*) [CommRing k] (ι : Type*) : Ideal (MvPowerSeries ι k) := + Ideal.span (Set.range (MvPowerSeries.X : ι → MvPowerSeries ι k)) + +variable {k : Type*} [Field k] {d : ℕ} (n : Fin d → ℕ) + +def plusCoordinates (i : Fin d) : WallVar n i → MvPowerSeries (AmbientVar n) k + | .inl j => MvPowerSeries.X (.inl (i, j)) + | .inr y => MvPowerSeries.X (.inr (true, ⟨i, y⟩)) + +def minusCoordinates (i : Fin d) : WallVar n i → MvPowerSeries (AmbientVar n) k + | .inl _ => 0 + | .inr y => MvPowerSeries.X (.inr (false, ⟨i, y⟩)) + +def zeroSlopes (i : Fin d) : WallVar n i → MvPowerSeries (Fin (n i)) k + | .inl _ => 0 + | .inr y => MvPowerSeries.X y + +def potential (P : (i : Fin d) → MvPowerSeries (WallVar n i) k) : + MvPowerSeries (AmbientVar n) k := + ∑ i, (MvPowerSeries.subst (plusCoordinates n i) (P i) - + MvPowerSeries.subst (minusCoordinates n i) (P i)) + +def slopeDerivative (P : (i : Fin d) → MvPowerSeries (WallVar n i) k) + (i : Fin d) : MvPowerSeries (Fin (n i)) k := + MvPowerSeries.subst (zeroSlopes n i) (MvPowerSeries.pderiv (.inl 0) (P i)) + +def graphCoordinates (Y : InternalVar n → MvPowerSeries (GraphVar n) k) : + AmbientVar n → MvPowerSeries (GraphVar n) k + | .inl a => MvPowerSeries.X (.inl a) + | .inr c => Y c + +def restrictedGradient (P : (i : Fin d) → MvPowerSeries (WallVar n i) k) + (Y : InternalVar n → MvPowerSeries (GraphVar n) k) (c : InternalVar n) : + MvPowerSeries (GraphVar n) k := + MvPowerSeries.subst (graphCoordinates n Y) + (MvPowerSeries.pderiv (.inr c) (potential n P)) + +def gradientIdeal (P : (i : Fin d) → MvPowerSeries (WallVar n i) k) + (Y : InternalVar n → MvPowerSeries (GraphVar n) k) : + Ideal (MvPowerSeries (GraphVar n) k) := + Ideal.span (Set.range (restrictedGradient n P Y)) + +def negativeSlopeValue (P : (i : Fin d) → MvPowerSeries (WallVar n i) k) + (Y : InternalVar n → MvPowerSeries (GraphVar n) k) (i : Fin d) : + MvPowerSeries (GraphVar n) k := + MvPowerSeries.subst (fun j => Y (false, ⟨i, j⟩)) (slopeDerivative n P i) + +def slope (i : Fin d) : MvPowerSeries (GraphVar n) k := + MvPowerSeries.X (.inl (i, 0)) + +def swapBlocks (c : InternalVar n) : InternalVar n := (!c.1, c.2) + +def tangentMatrix (Y : InternalVar n → MvPowerSeries (GraphVar n) k) : + Matrix (InternalVar n) (TangentVar n) k := + fun c t => MvPowerSeries.constantCoeff (MvPowerSeries.pderiv (.inr t) (Y c)) + + +def complementaryMatrix (Y : InternalVar n → MvPowerSeries (GraphVar n) k) : + Matrix (InternalVar n) (InternalVar n) k := + fun c bt => if bt.1 then tangentMatrix n Y (swapBlocks n c) bt.2 + else tangentMatrix n Y c bt.2 + + +structure FormalData where + P : (i : Fin d) → MvPowerSeries (WallVar n i) k + Y : InternalVar n → MvPowerSeries (GraphVar n) k + order_three : ∀ i, P i ∈ (originIdeal k (WallVar n i)) ^ 3 + centered : ∀ c, Y c ∈ originIdeal k (GraphVar n) + complementary : (complementaryMatrix n Y).det ≠ 0 + graph_zero : MvPowerSeries.subst (graphCoordinates n Y) (potential n P) = 0 + positive_cubic : ∀ i j l : Fin d, + slope n i * slope n j * slope n l ∈ gradientIdeal n P Y + negative_cubic : ∀ i j l : Fin d, + negativeSlopeValue n P Y i * negativeSlopeValue n P Y j * + negativeSlopeValue n P Y l ∈ gradientIdeal n P Y + +end BoundaryOnly.FormalObstruction + +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/FrobeniusRing.lean b/lean/OAI/Algebra/FrobeniusObstruction/FrobeniusRing.lean new file mode 100644 index 0000000000000000000000000000000000000000..87cc159a0f6dd47ec253069ea9bc204d0ae7e103 --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/FrobeniusRing.lean @@ -0,0 +1,494 @@ +import Mathlib + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace BoundaryOnly.FormalObstruction +namespace Frobenius + +variable {ι k : Type*} [Fintype ι] [DecidableEq ι] [CommRing k] + +abbrev Series := MvPowerSeries ι k + +def powerIdeal (ell : ℕ) : Ideal (Series (ι := ι) (k := k)) := + Ideal.span (Set.range fun i : ι => (MvPowerSeries.X i : Series (ι := ι) (k := k))^ell) + +abbrev Ring (ell : ℕ) := Series (ι := ι) (k := k) ⧸ powerIdeal (ι := ι) (k := k) ell + +def Good (ell : ℕ) (e : ι →₀ ℕ) : Prop := ∀ i, e i < ell + +def cut (ell : ℕ) (s : Finset ι) (f : Series (ι := ι) (k := k)) : Series (ι := ι) (k := k) := + fun e => if ∀ i ∈ s, e i < ell then MvPowerSeries.coeff e f else 0 + +@[simp] theorem coeff_cut (ell : ℕ) (s : Finset ι) (f : Series (ι := ι) (k := k)) (e : ι →₀ ℕ) : + MvPowerSeries.coeff e (cut ell s f) = + if ∀ i ∈ s, e i < ell then MvPowerSeries.coeff e f else 0 := rfl + +@[simp] theorem cut_empty (ell : ℕ) (f : Series (ι := ι) (k := k)) : + cut ell ∅ f = f := by + ext e + simp + + +def tail (ell : ℕ) (i : ι) (f : Series (ι := ι) (k := k)) : Series (ι := ι) (k := k) := + fun e => MvPowerSeries.coeff (e + Finsupp.single i ell) f + +omit [Fintype ι] [DecidableEq ι] in +@[simp] theorem coeff_tail (ell : ℕ) (i : ι) (f : Series (ι := ι) (k := k)) (e : ι →₀ ℕ) : + MvPowerSeries.coeff e (tail ell i f) = + MvPowerSeries.coeff (e + Finsupp.single i ell) f := rfl + +theorem one_coordinate_decomposition (ell : ℕ) (i : ι) (f : Series (ι := ι) (k := k)) : + f - cut ell {i} f = (MvPowerSeries.X i)^ell * tail ell i f := by + ext e + simp only [map_sub, coeff_cut, Finset.mem_singleton, forall_eq, MvPowerSeries.X_pow_eq, + MvPowerSeries.coeff_monomial_mul, one_mul, coeff_tail] + by_cases hi : ell ≤ e i + · rw [ite_eq_right (by omega), ite_eq_left (Finsupp.single_le_iff.mpr hi), + tsub_add_cancel_of_le (Finsupp.single_le_iff.mpr hi), sub_zero] + · rw [ite_eq_left (by omega), ite_eq_right (by simpa only [Finsupp.single_le_iff] using hi), sub_self] + +theorem cut_insert (ell : ℕ) (s : Finset ι) (i : ι) (f : Series (ι := ι) (k := k)) : + cut ell (insert i s) f = cut ell {i} (cut ell s f) := by + ext e + simp only [coeff_cut, Finset.mem_insert, forall_eq_or_imp, Finset.mem_singleton, forall_eq] + by_cases hi : e i < ell <;> by_cases hs : ∀ j ∈ s, e j < ell <;> simp [hi, hs] + +theorem subtract_cut_mem (ell : ℕ) (s : Finset ι) (f : Series (ι := ι) (k := k)) : + f - cut ell s f ∈ powerIdeal (ι := ι) (k := k) ell := by + induction s using Finset.induction_on with + | empty => simp + | @insert i s his ih => + rw [cut_insert] + have htail : cut ell s f - cut ell {i} (cut ell s f) ∈ powerIdeal ell := by + rw [one_coordinate_decomposition] + exact Ideal.mul_mem_right _ _ (Ideal.subset_span ⟨i, rfl⟩) + convert (powerIdeal (ι := ι) (k := k) ell).add_mem ih htail using 1 + abel + +omit [DecidableEq ι] in +theorem coeff_ideal_eq_zero (ell : ℕ) (e : ι →₀ ℕ) (he : Good ell e) + (f : Series (ι := ι) (k := k)) (hf : f ∈ powerIdeal ell) : + MvPowerSeries.coeff e f = 0 := by + obtain ⟨c, rfl⟩ := Ideal.mem_span_range_iff_exists_fun.mp hf + rw [map_sum] + apply Finset.sum_eq_zero + intro i _ + rw [MvPowerSeries.X_pow_eq, MvPowerSeries.coeff_mul_monomial] + exact ite_eq_right (by simpa only [Finsupp.single_le_iff, not_le] using he i) + +theorem mem_powerIdeal_iff (ell : ℕ) (f : Series (ι := ι) (k := k)) : + f ∈ powerIdeal ell ↔ ∀ e, Good ell e → MvPowerSeries.coeff e f = 0 := by + constructor + · exact fun hf e he => coeff_ideal_eq_zero ell e he f hf + · intro hf + have hc : cut ell Finset.univ f = 0 := by + ext e + simp only [coeff_cut, Finset.mem_univ, forall_const, map_zero] + split_ifs with he + · exact hf e he + · rfl + simpa only [hc, sub_zero] using subtract_cut_mem ell Finset.univ f + + +def quotientCoeff (ell : ℕ) (e : ι →₀ ℕ) (he : Good ell e) : Ring (ι := ι) (k := k) ell →ₗ[k] k := + (powerIdeal (ι := ι) (k := k) ell).restrictScalars k |>.liftQ + (MvPowerSeries.coeff e) (by + intro f hf + exact coeff_ideal_eq_zero ell e he f hf) + +omit [DecidableEq ι] in +@[simp] theorem quotientCoeff_mk (ell : ℕ) (e : ι →₀ ℕ) (he : Good ell e) + (f : Series (ι := ι) (k := k)) : + quotientCoeff ell e he (Ideal.Quotient.mk _ f) = MvPowerSeries.coeff e f := rfl + +theorem quotient_ext (ell : ℕ) (x y : Ring (ι := ι) (k := k) ell) + (h : ∀ e (he : Good ell e), quotientCoeff ell e he x = quotientCoeff ell e he y) : x = y := by + obtain ⟨f, rfl⟩ := Ideal.Quotient.mk_surjective x + obtain ⟨g, rfl⟩ := Ideal.Quotient.mk_surjective y + apply sub_eq_zero.mp + rw [← map_sub, Ideal.Quotient.eq_zero_iff_mem, mem_powerIdeal_iff] + intro e he + simpa only [map_sub, sub_eq_zero, quotientCoeff_mk] using h e he + + +abbrev Box (ell : ℕ) := ι → Fin ell + +def exponent (ell : ℕ) (v : Box (ι := ι) ell) : ι →₀ ℕ := + Finsupp.equivFunOnFinite.symm (fun i => (v i).val) + +omit [DecidableEq ι] in +@[simp] theorem exponent_apply (ell : ℕ) (v : Box (ι := ι) ell) (i : ι) : + exponent ell v i = (v i).val := by simp [exponent] + +omit [DecidableEq ι] in +theorem exponent_good (ell : ℕ) (v : Box (ι := ι) ell) : Good ell (exponent ell v) := by + intro i + simpa only [exponent_apply] using (v i).isLt + +omit [DecidableEq ι] in +theorem exponent_injective (ell : ℕ) : Function.Injective (exponent (ι := ι) ell) := by + intro v w h + funext i + apply Fin.ext + have := DFunLike.congr_fun h i + simpa only [exponent_apply] using this + +def boxOfGood (ell : ℕ) (e : ι →₀ ℕ) (he : Good ell e) : Box (ι := ι) ell := + fun i => ⟨e i, he i⟩ + +omit [DecidableEq ι] in +@[simp] theorem exponent_boxOfGood (ell : ℕ) (e : ι →₀ ℕ) (he : Good ell e) : + exponent ell (boxOfGood ell e he) = e := by + ext i + simp [boxOfGood] + + +def monomial (ell : ℕ) (v : Box (ι := ι) ell) : Ring (ι := ι) (k := k) ell := + Ideal.Quotient.mk _ (MvPowerSeries.monomial (exponent ell v) 1) + +@[simp] theorem quotientCoeff_monomial (ell : ℕ) (v w : Box (ι := ι) ell) : + quotientCoeff ell (exponent ell v) (exponent_good ell v) (monomial (k := k) ell w) = + if v = w then 1 else 0 := by + rw [monomial, quotientCoeff_mk, MvPowerSeries.coeff_monomial] + simp only [(exponent_injective ell).eq_iff] + +def coefficients (ell : ℕ) : Ring (ι := ι) (k := k) ell →ₗ[k] (Box (ι := ι) ell → k) := + LinearMap.pi fun v => quotientCoeff ell (exponent ell v) (exponent_good ell v) + +omit [DecidableEq ι] in +@[simp] theorem coefficients_apply (ell : ℕ) (x : Ring (ι := ι) (k := k) ell) + (v : Box (ι := ι) ell) : coefficients ell x v = + quotientCoeff ell (exponent ell v) (exponent_good ell v) x := rfl + +theorem coefficients_injective (ell : ℕ) : + Function.Injective (coefficients (ι := ι) (k := k) ell) := by + intro x y h + apply quotient_ext + intro e he + have hh := congrFun h (boxOfGood ell e he) + simpa only [coefficients_apply, exponent_boxOfGood] using hh + +def fromCoefficients (ell : ℕ) (c : Box (ι := ι) ell → k) : Ring (ι := ι) (k := k) ell := + ∑ v, c v • monomial ell v + +@[simp] theorem coefficients_fromCoefficients (ell : ℕ) (c : Box (ι := ι) ell → k) : + coefficients ell (fromCoefficients ell c) = c := by + funext v + simp [fromCoefficients] + + +def coefficientEquiv (ell : ℕ) : + Ring (ι := ι) (k := k) ell ≃ₗ[k] (Box (ι := ι) ell → k) := + LinearEquiv.ofBijective (coefficients ell) + ⟨coefficients_injective ell, fun c => ⟨fromCoefficients ell c, coefficients_fromCoefficients ell c⟩⟩ + +instance moduleFinite_quotient (ell : ℕ) : Module.Finite k (Ring (ι := ι) (k := k) ell) := + Module.Finite.equiv (coefficientEquiv (ι := ι) (k := k) ell).symm + +instance moduleFree_quotient (ell : ℕ) : Module.Free k (Ring (ι := ι) (k := k) ell) := + Module.Free.of_equiv (coefficientEquiv (ι := ι) (k := k) ell).symm + +theorem monomial_expansion (ell : ℕ) (x : Ring (ι := ι) (k := k) ell) : + x = ∑ v, coefficients ell x v • monomial ell v := by + apply coefficients_injective ell + exact (coefficients_fromCoefficients ell _).symm + +def topExponent (ell : ℕ) : ι →₀ ℕ := + Finsupp.equivFunOnFinite.symm (fun _ => ell - 1) + +omit [DecidableEq ι] in +@[simp] theorem topExponent_apply (ell : ℕ) (i : ι) : + topExponent (ι := ι) ell i = ell - 1 := by simp [topExponent] + +omit [DecidableEq ι] in +theorem topExponent_good {ell : ℕ} (hell : 0 < ell) : Good ell (topExponent (ι := ι) ell) := by + intro i + simp only [topExponent_apply] + omega + +omit [DecidableEq ι] in +theorem good_le_top {ell : ℕ} (e : ι →₀ ℕ) (he : Good ell e) : e ≤ topExponent ell := by + intro i + simp only [topExponent_apply] + have := he i + omega + + +def topMonomial (ell : ℕ) : Ring (ι := ι) (k := k) ell := + Ideal.Quotient.mk _ (MvPowerSeries.monomial (topExponent ell) 1) + +omit [DecidableEq ι] in +@[simp] theorem topMonomial_coefficient {ell : ℕ} (hell : 0 < ell) : + quotientCoeff ell (topExponent ell) (topExponent_good hell) + (topMonomial (ι := ι) (k := k) ell) = 1 := by + simp [topMonomial] + +omit [DecidableEq ι] in +theorem topMonomial_ne_zero [Nontrivial k] {ell : ℕ} (hell : 0 < ell) : + topMonomial (ι := ι) (k := k) ell ≠ 0 := by + intro h + have hc := topMonomial_coefficient (ι := ι) (k := k) hell + rw [h, map_zero] at hc + exact zero_ne_one hc + +def constantHom (ell : ℕ) (hell : 0 < ell) : Ring (ι := ι) (k := k) ell →+* k := + Ideal.Quotient.lift _ MvPowerSeries.constantCoeff (by + intro f hf + exact coeff_ideal_eq_zero ell 0 (fun i => by simpa using hell) f hf) + +omit [DecidableEq ι] in +@[simp] theorem constantHom_mk (ell : ℕ) (hell : 0 < ell) (f : Series (ι := ι) (k := k)) : + constantHom ell hell (Ideal.Quotient.mk _ f) = MvPowerSeries.constantCoeff f := rfl + +theorem topMonomial_mul {ell : ℕ} (hell : 0 < ell) (x : Ring (ι := ι) (k := k) ell) : + topMonomial ell * x = constantHom ell hell x • topMonomial ell := by + obtain ⟨f, rfl⟩ := Ideal.Quotient.mk_surjective x + apply quotient_ext + intro e he + rw [map_smul, constantHom_mk] + change quotientCoeff ell e he + (Ideal.Quotient.mk _ (MvPowerSeries.monomial (topExponent ell) 1) * + Ideal.Quotient.mk _ f) = _ + rw [← map_mul, quotientCoeff_mk, MvPowerSeries.coeff_monomial_mul] + rw [topMonomial, quotientCoeff_mk, MvPowerSeries.coeff_monomial] + by_cases ht : e = topExponent ell + · subst e + simp only [le_refl, ite_true, tsub_self, one_mul, smul_eq_mul, mul_one] + rfl + · have hnot : ¬ topExponent ell ≤ e := fun h => ht (le_antisymm (good_le_top e he) h) + simp [hnot, ht] + +omit [DecidableEq ι] in +@[simp] theorem constantHom_algebraMap (ell : ℕ) (hell : 0 < ell) (a : k) : + constantHom (ι := ι) ell hell (algebraMap k (Ring (ι := ι) (k := k) ell) a) = a := by + rw [← Ideal.Quotient.mk_algebraMap k (powerIdeal (ι := ι) (k := k) ell), + constantHom_mk, ← MvPowerSeries.c_eq_algebraMap, MvPowerSeries.constantCoeff_C] + +omit [DecidableEq ι] in +theorem algebraMap_injective (ell : ℕ) (hell : 0 < ell) : + Function.Injective (algebraMap k (Ring (ι := ι) (k := k) ell)) := + Function.LeftInverse.injective (constantHom_algebraMap ell hell) + +omit [DecidableEq ι] in +theorem quotient_charP {ell : ℕ} (hell : 0 < ell) [CharP k ell] : + CharP (Ring (ι := ι) (k := k) ell) ell := + charP_of_injective_algebraMap (algebraMap_injective ell hell) ell + + +theorem monomial_power_zero {ell : ℕ} (e : ι →₀ ℕ) (he : e ≠ 0) : + (Ideal.Quotient.mk (powerIdeal (ι := ι) (k := k) ell) + (MvPowerSeries.monomial e (1 : k))) ^ ell = 0 := by + rw [← map_pow, MvPowerSeries.monomial_pow, one_pow, Ideal.Quotient.eq_zero_iff_mem, + mem_powerIdeal_iff] + intro a ha + rw [MvPowerSeries.coeff_monomial] + apply ite_eq_right + intro h + obtain ⟨i, hi⟩ : ∃ i, e i ≠ 0 := Function.ne_iff.mp (by + intro heq + exact he (DFunLike.ext _ _ (congrFun heq))) + have hh := ha i + rw [h, Finsupp.nsmul_apply, smul_eq_mul] at hh + have : ell ≤ ell * e i := by + nth_rw 1 [← mul_one ell] + exact Nat.mul_le_mul_left ell (by omega) + omega + + + +theorem frobenius_zero_of_constant {ell : ℕ} [CharP k ell] [Fact ell.Prime] + (x : Ring (ι := ι) (k := k) ell) + (hx : (constantHom ell (Nat.Prime.pos Fact.out) x)^ell = 0) : x^ell = 0 := by + let : CharP (Ring (ι := ι) (k := k) ell) ell := quotient_charP (Nat.Prime.pos Fact.out) + rw [monomial_expansion ell x, sum_pow_char] + apply Finset.sum_eq_zero + intro v _ + rw [smul_pow] + by_cases he : exponent ell v = 0 + · have hc : coefficients ell x v = constantHom ell (Nat.Prime.pos Fact.out) x := by + obtain ⟨f, rfl⟩ := Ideal.Quotient.mk_surjective x + change MvPowerSeries.coeff (exponent ell v) f = MvPowerSeries.constantCoeff f + rw [he, MvPowerSeries.coeff_zero_eq_constantCoeff] + rw [hc, hx, zero_smul] + · rw [monomial, monomial_power_zero _ he, smul_zero] + +theorem series_frobenius_mem {ell : ℕ} [CharP k ell] [Fact ell.Prime] + (f : Series (ι := ι) (k := k)) (hf : (MvPowerSeries.constantCoeff f)^ell = 0) : + f^ell ∈ powerIdeal ell := by + apply Ideal.Quotient.eq_zero_iff_mem.mp + rw [map_pow] + exact frobenius_zero_of_constant _ hf + +section Evaluation + +variable {S : Type*} [CommRing S] [Algebra k S] + + + +def nilpotentSubst (b : ι → S) : ι → MvPowerSeries Unit S := + fun i => MvPowerSeries.C (b i) + +omit [DecidableEq ι] in +theorem has_nilpotentSubst (b : ι → S) (hb : ∀ i, IsNilpotent (b i)) : + MvPowerSeries.HasSubst (nilpotentSubst b) := { + const_coeff := fun i => by simpa [nilpotentSubst] using hb i + coeff_zero := fun _ => Set.toFinite _ } + +def nilpotentEval (b : ι → S) (hb : ∀ i, IsNilpotent (b i)) : Series (ι := ι) (k := k) →ₐ[k] S := + { toRingHom := MvPowerSeries.constantCoeff.comp + (MvPowerSeries.substAlgHom (R := k) (has_nilpotentSubst b hb)).toRingHom + commutes' := fun r => by + change MvPowerSeries.constantCoeff + ((MvPowerSeries.substAlgHom (R := k) (has_nilpotentSubst b hb)) + (algebraMap k (Series (ι := ι) (k := k)) r)) = _ + rw [AlgHom.commutes, MvPowerSeries.algebraMap_apply, MvPowerSeries.constantCoeff_C] } + +omit [DecidableEq ι] in +@[simp] theorem nilpotentEval_X (b : ι → S) (hb : ∀ i, IsNilpotent (b i)) (i : ι) : + nilpotentEval (k := k) b hb (MvPowerSeries.X i) = b i := by + change MvPowerSeries.constantCoeff + ((MvPowerSeries.substAlgHom (R := k) (has_nilpotentSubst b hb)) (MvPowerSeries.X i)) = _ + rw [MvPowerSeries.substAlgHom_X] + exact MvPowerSeries.constantCoeff_C _ + +omit [Fintype ι] [DecidableEq ι] in +theorem isNilpotent_of_powers (ell : ℕ) (b : ι → S) (hb : ∀ i, b i ^ ell = 0) : + ∀ i, IsNilpotent (b i) := fun i => ⟨ell, hb i⟩ + +omit [DecidableEq ι] in +theorem nilpotentEval_zero_on_powerIdeal (ell : ℕ) (b : ι → S) (hb : ∀ i, b i ^ ell = 0) + (f : Series (ι := ι) (k := k)) (hf : f ∈ powerIdeal ell) : + nilpotentEval (k := k) b (isNilpotent_of_powers ell b hb) f = 0 := by + obtain ⟨c, rfl⟩ := Ideal.mem_span_range_iff_exists_fun.mp hf + rw [map_sum] + apply Finset.sum_eq_zero + intro i _ + rw [map_mul, map_pow, nilpotentEval_X, hb, mul_zero] + + +def eval (ell : ℕ) (b : ι → S) (hb : ∀ i, b i ^ ell = 0) : Ring (ι := ι) (k := k) ell →ₐ[k] S := + Ideal.Quotient.liftₐ (powerIdeal (ι := ι) (k := k) ell) + (nilpotentEval (k := k) b (isNilpotent_of_powers ell b hb)) + (nilpotentEval_zero_on_powerIdeal (k := k) ell b hb) + +def coordinate (ell : ℕ) (i : ι) : Ring (ι := ι) (k := k) ell := + Ideal.Quotient.mk _ (MvPowerSeries.X i) + +omit [Fintype ι] [DecidableEq ι] in +@[simp] theorem coordinate_pow (ell : ℕ) (i : ι) : + coordinate (k := k) ell i ^ ell = 0 := by + rw [coordinate, ← map_pow, Ideal.Quotient.eq_zero_iff_mem] + exact Ideal.subset_span ⟨i, rfl⟩ + +omit [DecidableEq ι] in +@[simp] theorem eval_coordinate (ell : ℕ) (b : ι → S) (hb : ∀ i, b i ^ ell = 0) (i : ι) : + eval (k := k) ell b hb (coordinate ell i) = b i := by + change nilpotentEval (k := k) b (isNilpotent_of_powers ell b hb) (MvPowerSeries.X i) = b i + exact nilpotentEval_X b (isNilpotent_of_powers ell b hb) i + +omit [DecidableEq ι] in +theorem monomial_eq_prod (ell : ℕ) (v : Box (ι := ι) ell) : + monomial (k := k) ell v = (exponent ell v).prod (fun i n => coordinate ell i ^ n) := by + rw [monomial, MvPowerSeries.monomial_one_eq] + simp only [Finsupp.prod, map_prod, map_pow, coordinate] + + +theorem algHom_ext (ell : ℕ) (f g : Ring (ι := ι) (k := k) ell →ₐ[k] S) + (h : ∀ i, f (coordinate ell i) = g (coordinate ell i)) : f = g := by + ext x + rw [monomial_expansion ell x, map_sum, map_sum] + apply Finset.sum_congr rfl + intro v _ + rw [map_smul, map_smul, monomial_eq_prod] + congr 1 + simp only [Finsupp.prod, map_prod, map_pow, h] + +@[simp] theorem eval_self (ell : ℕ) : + eval ell (coordinate (ι := ι) (k := k) ell) (coordinate_pow ell) = AlgHom.id k _ := by + apply algHom_ext + intro i + simp + +end Evaluation + +section Derivatives + +variable (ell : ℕ) [CharP k ell] + +omit [DecidableEq ι] in +theorem pderiv_powerIdeal (i : ι) (f : Series (ι := ι) (k := k)) (hf : f ∈ powerIdeal ell) : + MvPowerSeries.pderiv i f ∈ powerIdeal ell := by + obtain ⟨c, rfl⟩ := Ideal.mem_span_range_iff_exists_fun.mp hf + rw [map_sum] + apply Ideal.sum_mem + intro j _ + have hz : (ell : Series (ι := ι) (k := k)) = 0 := by + simpa only [map_natCast, map_zero] using + congrArg (MvPowerSeries.C : k →+* Series (ι := ι) (k := k)) (CharP.cast_eq_zero k ell) + rw [Derivation.leibniz, MvPowerSeries.pderiv_pow] + simp only [smul_eq_mul, hz, zero_mul, mul_zero, zero_add] + exact Ideal.mul_mem_right _ _ (Ideal.subset_span ⟨j, rfl⟩) + +def partialDeriv (i : ι) : Derivation k (Ring (ι := ι) (k := k) ell) (Ring (ι := ι) (k := k) ell) := + Derivation.liftOfSurjective (f := Ideal.Quotient.mkₐ k (powerIdeal ell)) + Ideal.Quotient.mk_surjective (d := MvPowerSeries.pderiv i) (by + intro f hf + apply Ideal.Quotient.eq_zero_iff_mem.mpr + exact pderiv_powerIdeal ell i f (Ideal.Quotient.eq_zero_iff_mem.mp hf)) + +omit [DecidableEq ι] in +@[simp] theorem partial_mk (i : ι) (f : Series (ι := ι) (k := k)) : + partialDeriv ell i (Ideal.Quotient.mk _ f) = + Ideal.Quotient.mk _ (MvPowerSeries.pderiv i f) := by + unfold partialDeriv + apply Derivation.liftOfSurjective_apply + +@[simp] theorem partial_coordinate (i j : ι) : + partialDeriv (k := k) ell i (Ideal.Quotient.mk _ (MvPowerSeries.X j)) = if i = j then 1 else 0 := by + rw [partial_mk] + by_cases h : i = j + · subst j; simp + · simp [MvPowerSeries.pderiv_X_of_ne (Ne.symm h), h] + +omit [Fintype ι] in +theorem series_pderiv_commute (i j : ι) (f : Series (ι := ι) (k := k)) : + MvPowerSeries.pderiv i (MvPowerSeries.pderiv j f) = + MvPowerSeries.pderiv j (MvPowerSeries.pderiv i f) := by + by_cases hij : i = j + · subst j; rfl + ext e + simp only [MvPowerSeries.coeff_pderiv, Finsupp.add_apply] + simp only [Finsupp.single_eq_of_ne hij, Finsupp.single_eq_of_ne (Ne.symm hij), add_zero] + rw [add_assoc, add_comm (Finsupp.single i 1) (Finsupp.single j 1), ← add_assoc] + ring + +theorem partial_commute (i j : ι) (x : Ring (ι := ι) (k := k) ell) : + partialDeriv ell i (partialDeriv ell j x) = partialDeriv ell j (partialDeriv ell i x) := by + obtain ⟨f, rfl⟩ := Ideal.Quotient.mk_surjective x + simp only [partial_mk, series_pderiv_commute i j] + + +omit [DecidableEq ι] in +theorem residue_partial_zero (hell : 0 < ell) (i : ι) + (x : Ring (ι := ι) (k := k) ell) : + quotientCoeff ell (topExponent ell) (topExponent_good hell) (partialDeriv ell i x) = 0 := by + obtain ⟨f, rfl⟩ := Ideal.Quotient.mk_surjective x + rw [partial_mk, quotientCoeff_mk, MvPowerSeries.coeff_pderiv, topExponent_apply] + have hn : (ell - 1 : ℕ) + 1 = ell := by omega + have hc : ((ell - 1 : ℕ) : k) + 1 = 0 := by + calc + ((ell - 1 : ℕ) : k) + 1 = ((ell - 1 + 1 : ℕ) : k) := by simp only [Nat.cast_add, Nat.cast_one] + _ = 0 := by rw [hn]; exact CharP.cast_eq_zero k ell + rw [hc, mul_zero] + +end Derivatives + +end Frobenius +end BoundaryOnly.FormalObstruction + +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/GlobalForms.lean b/lean/OAI/Algebra/FrobeniusObstruction/GlobalForms.lean new file mode 100644 index 0000000000000000000000000000000000000000..120817080d6aa72abb2d374672821d53ca33c2d5 --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/GlobalForms.lean @@ -0,0 +1,339 @@ +import Mathlib +import OAI.Algebra.FrobeniusObstruction.SignedTensor + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace BoundaryOnly.FormalObstruction.GlobalForms +open Frobenius MixedForms FormsSplit SignedTensor +open scoped TensorProduct BigOperators +variable {k : Type*} [Field k] (ell : ℕ) (hell : 0 < ell) + +@[simp] theorem blockEquiv_succ_symm_tensorCons {n : ℕ} (V : Fin (n + 1) → Type) + [∀ i, Fintype (V i)] [∀ i, DecidableEq (V i)] + (x : QForms (k := k) ell (V 0)) + (y : ⨂[k] i : Fin n, QForms (k := k) ell (V i.succ)) : + (blockEquiv (k := k) ell hell (n + 1) V).symm + ((tensorCons (k := k) (fun i => QForms (k := k) ell (V i))).symm (x ⊗ₜ[k] y)) = + includeLeft (κ := Coordinates n (fun i => V i.succ)) ell x * includeRight (ι := V 0) ell + ((blockEquiv ell hell n (fun i => V i.succ)).symm y) := by + simp only [blockEquiv, LinearEquiv.trans_symm, LinearEquiv.trans_apply, + LinearEquiv.symm_symm, LinearEquiv.apply_symm_apply, TensorProduct.congr_symm_tmul, + LinearEquiv.refl_symm, LinearEquiv.refl_apply, sumEquiv_symm_tmul] + +@[simp] theorem blockEquiv_succ_symm_tprod {n : ℕ} (V : Fin (n + 1) → Type) + [∀ i, Fintype (V i)] [∀ i, DecidableEq (V i)] + (v : ∀ i, QForms (k := k) ell (V i)) : + (blockEquiv (k := k) ell hell (n + 1) V).symm (PiTensorProduct.tprod k v) = + includeLeft (κ := Coordinates n (fun i => V i.succ)) ell (v 0) * includeRight (ι := V 0) ell + ((blockEquiv ell hell n (fun i => V i.succ)).symm + (PiTensorProduct.tprod k (fun i => v i.succ))) := by + have h := blockEquiv_succ_symm_tensorCons ell hell V (v 0) + (PiTensorProduct.tprod k (fun i : Fin n => v i.succ)) + rw [← tensorCons_tprod (k := k) (fun i => QForms (k := k) ell (V i)) v, + LinearEquiv.symm_apply_apply] at h + exact h + + +noncomputable def potential : ∀ (n : ℕ) (V : Fin n → Type) + [∀ i, Fintype (V i)] [∀ i, DecidableEq (V i)], + (∀ i, Ring (ι := V i) (k := k) ell) → Ring (ι := Coordinates n V) (k := k) ell + | 0, _, _, _, _ => 0 + | n + 1, V, _, _, q => includeVariables ell Sum.inl (q 0) + + includeVariables ell Sum.inr (potential n (fun i => V i.succ) (fun i => q i.succ)) + +end BoundaryOnly.FormalObstruction.GlobalForms + +namespace BoundaryOnly.FormalObstruction.GlobalForms +open Frobenius MixedForms FormsSplit SignedTensor +open scoped TensorProduct BigOperators +variable {k : Type*} [Field k] (ell : ℕ) (hell : 0 < ell) + +@[simp] theorem parity_empty (x : QForms (k := k) ell PEmpty) : parity x = x := by + induction x using TensorProduct.inductionOn with + | add x y hx hy => rw [map_add, hx, hy] + | tmul a e => + rw [parity_tmul] + congr 1 + induction e using ExteriorAlgebra.induction with + | algebraMap r => exact AlgHom.commutes _ _ + | ι v => + have hv : v = 0 := Subsingleton.elim _ _ + simp [hv] + | mul x y hx hy => simp only [map_mul, hx, hy] + | add x y hx hy => simp only [map_add, hx, hy] + + +theorem blockEquiv_symm_parity (n : ℕ) (V : Fin n → Type) + [∀ i, Fintype (V i)] [∀ i, DecidableEq (V i)] + (t : ⨂[k] i, QForms (k := k) ell (V i)) : + parity ((blockEquiv (k := k) ell hell n V).symm t) = + (blockEquiv (k := k) ell hell n V).symm + (PiTensorProduct.map (fun i => (parity (k := k) (A := Ring (ι := V i) (k := k) ell) + (ι := V i)).toLinearMap) t) := by + induction n with + | zero => + rw [parity_empty] + congr 1 + have h : (fun i : Fin 0 => (parity (k := k) (A := Ring (ι := V i) (k := k) ell) + (ι := V i)).toLinearMap) = (fun i => LinearMap.id (R := k) (M := QForms (k := k) ell (V i))) := by + funext i; exact Fin.elim0 i + rw [h, PiTensorProduct.map_id, LinearMap.id_apply] + | succ n ih => + induction t using PiTensorProduct.induction_on with + | add x y hx hy => simp only [map_add, hx, hy] + | smul_tprod r v => + simp only [map_smul, PiTensorProduct.map_tprod] + congr 1 + rw [blockEquiv_succ_symm_tprod, blockEquiv_succ_symm_tprod, + map_mul, parity_includeLeft, parity_includeRight, ih] + rw [PiTensorProduct.map_tprod] + rfl + + theorem blockEquiv_succ_symm_differential_tprod {n : ℕ} (V : Fin (n + 1) → Type) + [∀ i, Fintype (V i)] [∀ i, DecidableEq (V i)] + (P D : EndFamily (k := k) (fun i => QForms (k := k) ell (V i))) + (v : ∀ i, QForms (k := k) ell (V i)) : + (blockEquiv (k := k) ell hell (n + 1) V).symm + (differential (fun i => QForms (k := k) ell (V i)) P D (PiTensorProduct.tprod k v)) = + includeLeft (κ := Coordinates n (fun i => V i.succ)) ell (D 0 (v 0)) * + includeRight (ι := V 0) ell ((blockEquiv (k := k) ell hell n (fun i => V i.succ)).symm + (PiTensorProduct.tprod k (fun i => v i.succ))) + + includeLeft (κ := Coordinates n (fun i => V i.succ)) ell (P 0 (v 0)) * + includeRight (ι := V 0) ell ((blockEquiv (k := k) ell hell n (fun i => V i.succ)).symm + (differential (fun i : Fin n => QForms (k := k) ell (V i.succ)) + (fun i => P i.succ) (fun i => D i.succ) + (PiTensorProduct.tprod k (fun i => v i.succ)))) := by + have h := congrArg (fun z => (blockEquiv (k := k) ell hell (n + 1) V).symm + ((tensorCons (k := k) (fun i => QForms (k := k) ell (V i))).symm z)) + (differential_cons_tprod (fun i => QForms (k := k) ell (V i)) P D v) + simp only [LinearEquiv.symm_apply_apply, LinearEquiv.map_add] at h + rw [blockEquiv_succ_symm_tensorCons (k := k) ell hell V, + blockEquiv_succ_symm_tensorCons (k := k) ell hell V] at h + exact h + +variable [CharP k ell] + + +theorem blockEquiv_symm_d (n : ℕ) (V : Fin n → Type) + [∀ i, Fintype (V i)] [∀ i, DecidableEq (V i)] + (t : ⨂[k] i, QForms (k := k) ell (V i)) : + d (partialDeriv (k := k) ell) ((blockEquiv (k := k) ell hell n V).symm t) = + (blockEquiv (k := k) ell hell n V).symm + (differential (fun i => QForms (k := k) ell (V i)) + (fun i => (parity (k := k) (A := Ring (ι := V i) (k := k) ell) (ι := V i)).toLinearMap) + (fun i => d (partialDeriv (ι := V i) (k := k) ell)) t) := by + induction n with + | zero => + simp only [d, differential, Fin.sum_univ_zero, LinearMap.zero_apply, LinearEquiv.map_zero] + have h : (∑ i : Coordinates 0 V, TensorProduct.map + (partialDeriv (k := k) ell i).toLinearMap (wedge i)) = 0 := by + exact Finset.sum_eq_zero (fun i _ => PEmpty.elim i) + rw [h, LinearMap.zero_apply] + | succ n ih => + induction t using PiTensorProduct.induction_on with + | add x y hx hy => simp only [map_add, hx, hy] + | smul_tprod r v => + simp only [map_smul] + congr 1 + rw [blockEquiv_succ_symm_tprod, blockEquiv_succ_symm_differential_tprod, + d_mul, d_includeLeft, d_includeRight, parity_includeLeft, ih] + rfl + + + +theorem blockEquiv_symm_delta (n : ℕ) (V : Fin n → Type) + [∀ i, Fintype (V i)] [∀ i, DecidableEq (V i)] + (q : ∀ i, Ring (ι := V i) (k := k) ell) + (t : ⨂[k] i, QForms (k := k) ell (V i)) : + delta (partialDeriv (k := k) ell) (potential (k := k) ell n V q) + ((blockEquiv (k := k) ell hell n V).symm t) = + (blockEquiv (k := k) ell hell n V).symm + (differential (fun i => QForms (k := k) ell (V i)) + (fun i => (parity (k := k) (A := Ring (ι := V i) (k := k) ell) (ι := V i)).toLinearMap) + (fun i => delta (partialDeriv (ι := V i) (k := k) ell) (q i)) t) := by + induction n with + | zero => simp only [potential, delta_apply, MixedForms.gradient, TensorProduct.zero_tmul, + LinearMap.map_zero, LinearEquiv.map_zero, zero_mul, differential, + Fin.sum_univ_zero, LinearMap.zero_apply] + | succ n ih => + induction t using PiTensorProduct.induction_on with + | add x y hx hy => simp only [map_add, hx, hy] + | smul_tprod r v => + simp only [map_smul] + congr 1 + rw [blockEquiv_succ_symm_tprod, blockEquiv_succ_symm_differential_tprod] + change delta (partialDeriv (k := k) ell) + (includeVariables ell Sum.inl (q 0) + includeVariables ell Sum.inr + (potential (k := k) ell n (fun i => V i.succ) (fun i => q i.succ))) _ = _ + rw [delta_product, ih] + rfl + +end BoundaryOnly.FormalObstruction.GlobalForms + +namespace BoundaryOnly.FormalObstruction.GlobalForms +open Frobenius MixedForms FormsSplit SignedTensor +open scoped TensorProduct BigOperators +variable {k : Type*} [Field k] (ell : ℕ) (hell : 0 < ell) + + +def insertScalar : ∀ (n : ℕ) (V : Fin n → Type) + [∀ i, Fintype (V i)] [∀ i, DecidableEq (V i)], + (i : Fin n) → Ring (ι := V i) (k := k) ell →ₐ[k] + Ring (ι := Coordinates n V) (k := k) ell + | 0, _, _, _, i => Fin.elim0 i + | n+1, V, _, _, i => Fin.cases (includeVariables ell Sum.inl) + (fun i => (includeVariables ell Sum.inr).comp + (insertScalar n (fun j => V j.succ) i)) i + + +def insertForms : ∀ (n : ℕ) (V : Fin n → Type) + [∀ i, Fintype (V i)] [∀ i, DecidableEq (V i)], + (i : Fin n) → QForms (k := k) ell (V i) →ₐ[k] QForms (k := k) ell (Coordinates n V) + | 0, _, _, _, i => Fin.elim0 i + | n+1, V, _, _, i => Fin.cases (includeLeft ell) + (fun i => (includeRight ell).comp (insertForms n (fun j => V j.succ) i)) i + +@[simp] theorem includeLeft_coeff {ι κ : Type} [Fintype ι] [Fintype κ] + [DecidableEq ι] [DecidableEq κ] (a : Ring (ι := ι) (k := k) ell) : + includeLeft (κ := κ) ell (coeff a) = coeff (includeVariables ell Sum.inl a) := by + simp only [includeLeft, coeff_apply, Algebra.TensorProduct.map_tmul, map_one] + +@[simp] theorem includeRight_coeff {ι κ : Type} [Fintype ι] [Fintype κ] + [DecidableEq ι] [DecidableEq κ] (a : Ring (ι := κ) (k := k) ell) : + includeRight (ι := ι) ell (coeff a) = coeff (includeVariables ell Sum.inr a) := by + simp only [includeRight, coeff_apply, Algebra.TensorProduct.map_tmul, map_one] + +@[simp] theorem insertForms_coeff (n : ℕ) (V : Fin n → Type) + [∀ i, Fintype (V i)] [∀ i, DecidableEq (V i)] + (i : Fin n) (a : Ring (ι := V i) (k := k) ell) : + insertForms ell n V i (coeff a) = coeff (insertScalar ell n V i a) := by + induction n with + | zero => exact Fin.elim0 i + | succ n ih => + cases i using Fin.cases with + | zero => exact includeLeft_coeff ell a + | succ i => + change includeRight ell (insertForms ell n (fun j => V j.succ) i (coeff a)) = _ + rw [ih, includeRight_coeff] + rfl + + theorem potential_sum (n : ℕ) (V : Fin n → Type) + [∀ i, Fintype (V i)] [∀ i, DecidableEq (V i)] + (q : ∀ i, Ring (ι := V i) (k := k) ell) : + potential ell n V q = ∑ i, insertScalar ell n V i (q i) := by + induction n with + | zero => simp [potential] + | succ n ih => + rw [potential, ih, map_sum, Fin.sum_univ_succ] + rfl + + theorem blockEquiv_symm_tprod_prod (n : ℕ) (V : Fin n → Type) + [∀ i, Fintype (V i)] [∀ i, DecidableEq (V i)] + (x : ∀ i, QForms (k := k) ell (V i)) : + (blockEquiv (k := k) ell hell n V).symm (PiTensorProduct.tprod k x) = + (List.ofFn fun i => insertForms ell n V i (x i)).prod := by + induction n with + | zero => + apply (emptyForms (k := k) ell hell).injective + simp only [blockEquiv, LinearEquiv.trans_symm, LinearEquiv.trans_apply, + LinearEquiv.apply_symm_apply, List.ofFn_zero, List.prod_nil] + simp [emptyForms, emptyCoefficients, emptyExterior, Algebra.TensorProduct.one_def] + | succ n ih => + rw [blockEquiv_succ_symm_tprod, ih, List.ofFn_succ, List.prod_cons] + change _ = includeLeft ell (x 0) * + (List.ofFn fun i => includeRight ell (insertForms ell n (fun j => V j.succ) i (x i.succ))).prod + rw [map_list_prod, List.map_ofFn] + rfl + +variable [CharP k ell] + + theorem d_insertForms (n : ℕ) (V : Fin n → Type) + [∀ i, Fintype (V i)] [∀ i, DecidableEq (V i)] + (i : Fin n) (x : QForms (k := k) ell (V i)) : + d (partialDeriv ell) (insertForms ell n V i x) = + insertForms ell n V i (d (partialDeriv ell) x) := by + induction n with + | zero => exact Fin.elim0 i + | succ n ih => + cases i using Fin.cases with + | zero => exact d_includeLeft ell x + | succ i => + change d (partialDeriv ell) (includeRight ell (insertForms ell n (fun j => V j.succ) i x)) = _ + rw [d_includeRight, ih] + rfl + + theorem gradient_insertScalar (n : ℕ) (V : Fin n → Type) + [∀ i, Fintype (V i)] [∀ i, DecidableEq (V i)] + (i : Fin n) (q : Ring (ι := V i) (k := k) ell) : + gradient (partialDeriv ell) (insertScalar ell n V i q) = + insertForms ell n V i (gradient (partialDeriv ell) q) := by + rw [← d_coeff, ← insertForms_coeff, d_insertForms, d_coeff] + + theorem delta_insertForms (n : ℕ) (V : Fin n → Type) + [∀ i, Fintype (V i)] [∀ i, DecidableEq (V i)] + (i : Fin n) (q : Ring (ι := V i) (k := k) ell) (x : QForms (k := k) ell (V i)) : + delta (partialDeriv ell) (insertScalar ell n V i q) (insertForms ell n V i x) = + insertForms ell n V i (delta (partialDeriv ell) q x) := by + rw [delta_apply, gradient_insertScalar, delta_apply, map_mul] + +end BoundaryOnly.FormalObstruction.GlobalForms + +namespace BoundaryOnly.FormalObstruction.GlobalForms +open Frobenius MixedForms FormsSplit +open scoped BigOperators TensorProduct +variable {k : Type*} [Field k] + +def sigmaSucc {n : ℕ} (V : Fin (n+1) → Type) : + (Σ i, V i) ≃ V 0 ⊕ (Σ i : Fin n, V i.succ) where + toFun x := Fin.cases (fun y => Sum.inl y) (fun i y => Sum.inr ⟨i,y⟩) x.1 x.2 + invFun := Sum.elim (fun y => ⟨0,y⟩) (fun y => ⟨y.1.succ,y.2⟩) + left_inv := by rintro ⟨i,y⟩; cases i using Fin.cases <;> rfl + right_inv := by intro y; cases y <;> rfl + +def coordinateEquiv : ∀ (n : ℕ) (V : Fin n → Type), Coordinates n V ≃ (Σ i, V i) + | 0, _ => Equiv.equivOfIsEmpty _ _ + | n+1, V => (Equiv.sumCongr (Equiv.refl (V 0)) + (coordinateEquiv n (fun i => V i.succ))).trans (sigmaSucc V).symm + +@[simp] theorem coordinateEquiv_zero {n : ℕ} (V : Fin (n+1) → Type) (y : V 0) : + coordinateEquiv (n+1) V (Sum.inl y) = ⟨0,y⟩ := rfl + +@[simp] theorem coordinateEquiv_succ {n : ℕ} (V : Fin (n+1) → Type) + (y : Coordinates n (fun i => V i.succ)) : + coordinateEquiv (n+1) V (Sum.inr y) = + ⟨(coordinateEquiv n (fun i => V i.succ) y).1.succ, + (coordinateEquiv n (fun i => V i.succ) y).2⟩ := rfl + +@[simp] theorem coordinateEquiv_symm_zero {n : ℕ} (V : Fin (n+1) → Type) (y : V 0) : + (coordinateEquiv (n+1) V).symm ⟨0,y⟩ = Sum.inl y := rfl + +@[simp] theorem coordinateEquiv_symm_succ {n : ℕ} (V : Fin (n+1) → Type) + (i : Fin n) (y : V i.succ) : + (coordinateEquiv (n+1) V).symm ⟨i.succ,y⟩ = + Sum.inr ((coordinateEquiv n (fun i => V i.succ)).symm ⟨i,y⟩) := rfl + +variable (ell : ℕ) +@[simp] theorem insertScalar_coordinate (n : ℕ) (V : Fin n → Type) + [∀ i, Fintype (V i)] [∀ i, DecidableEq (V i)] + (i : Fin n) (y : V i) : + insertScalar (k := k) ell n V i (coordinate ell y) = + coordinate ell ((coordinateEquiv n V).symm ⟨i,y⟩) := by + induction n with + | zero => exact Fin.elim0 i + | succ n ih => + cases i using Fin.cases with + | zero => exact includeVariables_coordinate ell Sum.inl y + | succ i => + change includeVariables ell Sum.inr + (insertScalar ell n (fun i => V i.succ) i (coordinate ell y)) = _ + rw [ih, includeVariables_coordinate] + rfl + +end BoundaryOnly.FormalObstruction.GlobalForms + +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/GraphPotential.lean b/lean/OAI/Algebra/FrobeniusObstruction/GraphPotential.lean new file mode 100644 index 0000000000000000000000000000000000000000..2aa6d43c8252597457776797853ff0e0a93d7c00 --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/GraphPotential.lean @@ -0,0 +1,246 @@ +import Mathlib +import OAI.Algebra.FrobeniusObstruction.MovingCharts + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace BoundaryOnly.FormalObstruction +open Frobenius +variable {k : Type*} [Field k] {d : ℕ} {n : Fin d → ℕ} +variable (ell : ℕ) (htwo : 1 < ell) [CharP k ell] [Fact ell.Prime] + +abbrev ParameterScalar := Frobenius.Ring (ι := InternalVar n) (k := ThreeParameters.Ring k) ell + +def normalIndices : Finset (InternalVar n) := Finset.univ.filter fun c => c.1 = true + +@[simp] theorem mem_normalIndices (c : InternalVar n) : c ∈ normalIndices (n := n) ↔ c.1 = true := by + simp [normalIndices] + +def normalPlane : ParameterScalar (n := n) (k := k) ell →ₐ[ThreeParameters.Ring k] + ParameterScalar (n := n) (k := k) ell := + planeRestriction ell (Nat.Prime.pos Fact.out) normalIndices + +omit [CharP k ell] in +@[simp] theorem normalPlane_coordinate (b : Bool) (t : TangentVar n) : + normalPlane (k := k) ell (coordinate ell (b,t)) = + if b then 0 else coordinate ell (b,t) := by + simp only [normalPlane, planeRestriction_coordinate, mem_normalIndices] + +theorem normalPlane_movingGraphSlot (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) : + ((normalPlane (n := n) ell).restrictScalars k).comp (movingGraphSlot ell a ha false) = + movingGraphSlot ell a ha false := by + refine algHom_ext (ι := GraphVar n) (k := k) + (S := ParameterScalar (n := n) (k := k) ell) ell _ _ ?_ + intro v + simp only [AlgHom.comp_apply, AlgHom.restrictScalars_apply, movingGraphSlot_coordinate] + cases v with + | inl i => exact AlgHom.commutes (normalPlane (n := n) ell) _ + | inr t => simp [movingGraphCoordinates] + +omit [CharP k ell] in +theorem normalPlane_smul (r : k) (x : ParameterScalar (n := n) (k := k) ell) : + normalPlane ell (r • x) = r • normalPlane ell x := + map_smul ((normalPlane ell).restrictScalars k) r x + +omit [CharP k ell] in +theorem normalPlane_fixedComplement (D : FormalData (k := k) n) (c : InternalVar n) : + normalPlane ell (baseChange (l := ThreeParameters.Ring k) ell (fixedComplement ell D c)) = 0 := by + simp only [fixedComplement, map_sum, map_smul, baseChange_coordinate, + normalPlane_smul, normalPlane_coordinate, ite_true, smul_zero, Finset.sum_const_zero] + + +def ambientCoordinates (a : SlopeVar d → ThreeParameters.Ring k) : + AmbientVar n → ParameterScalar (n := n) (k := k) ell + | .inl i => @algebraMap (ThreeParameters.Ring k) (ParameterScalar (n := n) (k := k) ell) + inferInstance inferInstance inferInstance (a i) + | .inr c => coordinate ell c + +theorem ambientCoordinates_pow (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) (i : AmbientVar n) : + ambientCoordinates (n := n) ell a i ^ ell = 0 := by + cases i with + | inl i => + change (@algebraMap (ThreeParameters.Ring k) (ParameterScalar (n := n) (k := k) ell) + inferInstance inferInstance inferInstance (a i)) ^ ell = 0 + rw [← map_pow, ThreeParameters.augmentation_zero_pow k ell (a i) (ha i), map_zero] + | inr c => exact coordinate_pow ell c + +def ambientSlot (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) : + Frobenius.Ring (ι := AmbientVar n) (k := k) ell →ₐ[k] ParameterScalar (n := n) (k := k) ell := + eval ell (ambientCoordinates ell a) (ambientCoordinates_pow ell a ha) + +@[simp] theorem ambientSlot_coordinate (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) (v : AmbientVar n) : + ambientSlot ell a ha (coordinate ell v) = ambientCoordinates (n := n) ell a v := + eval_coordinate ell _ _ _ + +theorem graphCoordinates_constant_zero (D : FormalData (k := k) n) (v : AmbientVar n) : + MvPowerSeries.constantCoeff (graphCoordinates n D.Y v) = 0 := by + cases v with + | inl i => simp [graphCoordinates] + | inr c => exact graph_constant_zero D c + +def formalGraph (D : FormalData (k := k) n) : + Frobenius.Ring (ι := AmbientVar n) (k := k) ell →ₐ[k] + Frobenius.Ring (ι := GraphVar n) (k := k) ell := + substitute ell (graphCoordinates n D.Y) (graphCoordinates_constant_zero D) + +@[simp] theorem formalGraph_mk (D : FormalData (k := k) n) (p : MvPowerSeries (AmbientVar n) k) : + formalGraph ell D (Ideal.Quotient.mk _ p) = + Ideal.Quotient.mk _ (MvPowerSeries.subst (graphCoordinates n D.Y) p) := + substitute_mk ell _ _ _ + + +theorem graph_restriction_hom (D : FormalData (k := k) n) + (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) : + (((normalPlane (n := n) ell).comp (movingChart ell D a ha)).restrictScalars k).comp + (ambientSlot ell a ha) = (movingGraphSlot ell a ha false).comp (formalGraph ell D) := by + refine algHom_ext (ι := AmbientVar n) (k := k) + (S := ParameterScalar (n := n) (k := k) ell) ell _ _ ?_ + intro v + simp only [AlgHom.comp_apply, AlgHom.restrictScalars_apply, ambientSlot_coordinate, + formalGraph, substitute_coordinate] + cases v with + | inl i => + change normalPlane ell (movingChart ell D a ha + ((algebraMap (ThreeParameters.Ring k) (ParameterScalar (n := n) (k := k) ell)) (a i))) = _ + rw [AlgHom.commutes, AlgHom.commutes] + exact (movingGraphSlot_coordinate ell a ha false (.inl i)).symm + | inr c => + change normalPlane ell (movingChart ell D a ha (coordinate ell c)) = _ + rw [movingChart_coordinate, movingChartCoordinate, map_add, normalPlane_fixedComplement, add_zero] + exact AlgHom.congr_fun (normalPlane_movingGraphSlot ell a ha) + (Ideal.Quotient.mk _ (D.Y c)) + +def movingPotential (D : FormalData (k := k) n) (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) : ParameterScalar (n := n) (k := k) ell := + ambientSlot ell a ha (Ideal.Quotient.mk _ (potential n D.P)) + +theorem movingPotential_graph_zero (D : FormalData (k := k) n) + (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) : + normalPlane ell (movingChart ell D a ha (movingPotential ell D a ha)) = 0 := by + have h := AlgHom.congr_fun (graph_restriction_hom ell D a ha) + (Ideal.Quotient.mk _ (potential n D.P)) + change _ = 0 + simp only [AlgHom.comp_apply, formalGraph_mk, D.graph_zero, map_zero] at h + exact h + +end BoundaryOnly.FormalObstruction + +namespace BoundaryOnly.FormalObstruction +open Frobenius +variable {k : Type*} [Field k] {d : ℕ} {n : Fin d → ℕ} +variable (ell : ℕ) (htwo : 1 < ell) [CharP k ell] [Fact ell.Prime] + +omit [Fact (Nat.Prime ell)] in +theorem partial_ambientCoordinates (a : SlopeVar d → ThreeParameters.Ring k) + (i : InternalVar n) (v : AmbientVar n) : + partialDeriv ell i (ambientCoordinates ell a v) = + if v = .inr i then 1 else 0 := by + cases v with + | inl a => simp only [ambientCoordinates, Derivation.map_algebraMap, reduceCtorEq, ite_false] + | inr c => + simp only [ambientCoordinates, coordinate, partial_coordinate, Sum.inr.injEq] + by_cases h : i = c + · simp [h] + · simp [h, Ne.symm h] + + +omit [Fact (Nat.Prime ell)] in +theorem parameter_chain_rule + (f : Frobenius.Ring (ι := AmbientVar n) (k := k) ell →ₐ[k] + ParameterScalar (n := n) (k := k) ell) + (i : InternalVar n) (x : Frobenius.Ring (ι := AmbientVar n) (k := k) ell) : + partialDeriv ell i (f x) = + ∑ v : AmbientVar n, f (partialDeriv ell v x) * partialDeriv ell i (f (coordinate ell v)) := by + let : Module k (ParameterScalar (n := n) (k := k) ell) := + @Algebra.toModule k (ParameterScalar (n := n) (k := k) ell) inferInstance inferInstance inferInstance + exact derivation_chain_rule (S := ParameterScalar (n := n) (k := k) ell) + (k := k) (ι := AmbientVar n) ell f + ((partialDeriv (k := ThreeParameters.Ring k) ell i).restrictScalars k) x + +theorem sum_mul_single {J R : Type*} [Fintype J] [DecidableEq J] [Semiring R] + (u : J → R) (i : J) : (∑ v, u v * (if v = i then 1 else 0)) = u i := by + simp only [mul_ite, mul_one, mul_zero, Finset.sum_ite_eq', Finset.mem_univ, ite_true] + + +theorem partial_ambientSlot (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) + (i : InternalVar n) (x : Frobenius.Ring (ι := AmbientVar n) (k := k) ell) : + partialDeriv ell i (ambientSlot ell a ha x) = + ambientSlot ell a ha (partialDeriv ell (.inr i) x) := by + have h := parameter_chain_rule ell (ambientSlot ell a ha) i x + simp only [ambientSlot_coordinate, partial_ambientCoordinates] at h + exact h.trans (sum_mul_single (fun v => ambientSlot ell a ha (partialDeriv ell v x)) (.inr i)) + +theorem movingPotential_restricted_partial (D : FormalData (k := k) n) + (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) (c : InternalVar n) : + normalPlane ell (movingChart ell D a ha (partialDeriv ell c (movingPotential ell D a ha))) = + movingGraphSlot ell a ha false (Ideal.Quotient.mk _ (restrictedGradient n D.P D.Y c)) := by + rw [movingPotential, partial_ambientSlot, partial_mk] + have h := AlgHom.congr_fun (graph_restriction_hom ell D a ha) + (Ideal.Quotient.mk _ (MvPowerSeries.pderiv (.inr c) (potential n D.P))) + simp only [AlgHom.comp_apply, AlgHom.restrictScalars_apply, formalGraph_mk] at h + exact h + +end BoundaryOnly.FormalObstruction + +namespace BoundaryOnly.FormalObstruction +open Frobenius +variable {k : Type*} [Field k] {d : ℕ} {n : Fin d → ℕ} +variable (ell : ℕ) (htwo : 1 < ell) [CharP k ell] [Fact ell.Prime] + +@[simp] theorem normalPlane_slot_apply (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) + (x : Frobenius.Ring (ι := GraphVar n) (k := k) ell) : + normalPlane ell (movingGraphSlot ell a ha false x) = movingGraphSlot ell a ha false x := + AlgHom.congr_fun (normalPlane_movingGraphSlot ell a ha) x + +theorem movingPotential_mem_normalIdeal (D : FormalData (k := k) n) + (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) : + movingPotential ell D a ha ∈ + chartNormalIdeal ell (movingChartEquiv ell htwo D a ha).symm normalIndices := by + apply (chart_restriction_eq_zero_iff ell (Nat.Prime.pos Fact.out) + (movingChartEquiv ell htwo D a ha).symm normalIndices _).mp + exact movingPotential_graph_zero ell D a ha + + + +theorem graphIdeal_ambient_discrepancy (D : FormalData (k := k) n) + (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) + (g : MvPowerSeries (GraphVar n) k) (hg : g ∈ gradientIdeal n D.P D.Y) : + ∃ h : InternalVar n → ParameterScalar (n := n) (k := k) ell, + ((movingChartEquiv ell htwo D a ha).symm + (movingGraphSlot ell a ha false (Ideal.Quotient.mk _ g)) - + ∑ c, h c * partialDeriv ell c (movingPotential ell D a ha)) ∈ + chartNormalIdeal ell (movingChartEquiv ell htwo D a ha).symm normalIndices := by + obtain ⟨h, hh⟩ := Ideal.mem_span_range_iff_exists_fun.mp hg + let e := movingChartEquiv ell htwo D a ha + refine ⟨fun c => e.symm (movingGraphSlot ell a ha false (Ideal.Quotient.mk _ (h c))), ?_⟩ + apply (chart_restriction_eq_zero_iff ell (Nat.Prime.pos Fact.out) e.symm normalIndices _).mp + change normalPlane ell (e (e.symm (movingGraphSlot ell a ha false (Ideal.Quotient.mk _ g)) - + ∑ c, e.symm (movingGraphSlot ell a ha false (Ideal.Quotient.mk _ (h c))) * + partialDeriv ell c (movingPotential ell D a ha))) = 0 + simp only [map_sub, map_sum, map_mul, AlgEquiv.apply_symm_apply, normalPlane_slot_apply] + have he (x : ParameterScalar (n := n) (k := k) ell) : e x = movingChart ell D a ha x := rfl + simp only [he, movingPotential_restricted_partial] + apply sub_eq_zero.mpr + simp only [← map_mul, ← map_sum] + apply congrArg (movingGraphSlot ell a ha false) + apply congrArg (Ideal.Quotient.mk (powerIdeal (k := k) ell)) + exact hh.symm + +end BoundaryOnly.FormalObstruction + +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/LiftProducts.lean b/lean/OAI/Algebra/FrobeniusObstruction/LiftProducts.lean new file mode 100644 index 0000000000000000000000000000000000000000..1306973d659df5f625092d3d38691c76d8193e8b --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/LiftProducts.lean @@ -0,0 +1,197 @@ +import Mathlib +import OAI.Algebra.FrobeniusObstruction.SelectedCycles + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace BoundaryOnly.FormalObstruction.ThreeParameters +variable {k : Type*} [Field k] {d : ℕ} + + +def chosen (i j l : Fin d) (r : Fin d) : Ring k := + if r = i then s k 0 else if r = j then s k 1 else if r = l then s k 2 else 0 + + theorem chosen_augmentation (i j l r : Fin d) : + augmentation k (chosen (k := k) i j l r) = 0 := by + simp only [chosen] + split_ifs <;> simp only [augmentation_s, map_zero] + + theorem chosen_square (i j l r : Fin d) : + chosen (k := k) i j l r * chosen (k := k) i j l r = 0 := by + simp only [chosen] + split_ifs <;> simp only [← pow_two, s_sq, zero_pow (by decide : 2 ≠ 0)] + + theorem chosen_outside (J : Finset (Fin d)) (i j l : Fin d) + (hi : i ∈ J) (hj : j ∈ J) (hl : l ∈ J) (r : Fin d) (hr : r ∉ J) : + chosen (k := k) i j l r = 0 := by + have hri : r ≠ i := by rintro rfl; exact hr hi + have hrj : r ≠ j := by rintro rfl; exact hr hj + have hrl : r ≠ l := by rintro rfl; exact hr hl + simp only [chosen, ite_eq_right hri, ite_eq_right hrj, ite_eq_right hrl] + + theorem chosen_product (i j l : Fin d) (hij : i ≠ j) (hil : i ≠ l) (hjl : j ≠ l) : + chosen (k := k) i j l i * chosen (k := k) i j l j * chosen (k := k) i j l l = w k := by + simp [chosen, hij.symm, hil.symm, hjl.symm, w] + +end BoundaryOnly.FormalObstruction.ThreeParameters + +namespace BoundaryOnly.FormalObstruction.MixedForms +variable {k A ι : Type*} [CommRing k] [CommRing A] [Algebra k A] +variable [Fintype ι] [DecidableEq ι] + + + +theorem separated_parameter_lift_some {b : ℕ} + (pd : ι → Derivation k A A) (Q p s : Fin b → A) (J : Finset (Fin b)) + (hs : ∀ j i, pd i (s j) = 0) (hs2 : ∀ j, s j * s j = 0) + (hout : ∀ j ∉ J, s j = 0) + (x y : Fin b → Forms (k := k) (A := A) (ι := ι)) + (hx : ∀ j, gradient pd (Q j) * x j = 0) + (hy : ∀ j ∈ J, gradient pd (Q j) * y j = -(gradient pd (p j) * x j)) : + delta pd (∑ j, (Q j + s j * p j)) + (List.ofFn (fun j => x j + coeff (s j) * y j)).prod = 0 := by + change gradient pd (∑ j, (Q j + s j * p j)) * _ = 0 + have hg : gradient pd (∑ j, (Q j + s j * p j)) = + ∑ j, gradient pd (Q j + s j * p j) := by + change d pd (coeff (k := k) (ι := ι) (∑ j, (Q j + s j * p j))) = _ + rw [map_sum, map_sum] + rfl + rw [hg, Finset.sum_mul] + apply Finset.sum_eq_zero + intro j _ + apply gradient_mul_list_prod_zero pd (Q j + s j * p j) + _ (x j + coeff (s j) * y j) + · exact List.mem_ofFn.mpr ⟨j,rfl⟩ + · by_cases hj : j ∈ J + · exact perturbed_factor pd (Q j) (p j) (s j) (hs j) (hs2 j) (x j) (y j) (hx j) (hy j hj) + · rw [hout j hj, zero_mul, add_zero, map_zero, zero_mul, add_zero, hx] + +end BoundaryOnly.FormalObstruction.MixedForms + +namespace BoundaryOnly.FormalObstruction.ActualBlocks +open Frobenius MixedForms +open scoped TensorProduct BigOperators +variable {k : Type*} [Field k] {d : ℕ} {n : Fin d → ℕ} +variable (ell : ℕ) [Fact ell.Prime] [CharP k ell] + +def liftScalar (i : Fin d) : Scalar (n := n) (k := k) ell i →ₐ[k] + ParameterScalar (n := n) (k := k) ell := + (baseChange (l := ThreeParameters.Ring k) ell).comp (includeScalar ell i) + +def liftBlock (i : Fin d) : Block (n := n) (k := k) ell i →ₐ[k] + ParameterForms (n := n) (k := k) ell := + (coefficientMap (baseChange (l := ThreeParameters.Ring k) ell)).comp (includeBlock ell i) + +omit [Fact ell.Prime] in + theorem liftBlock_delta (i : Fin d) (F : Scalar (n := n) (k := k) ell i) + (x : Block (n := n) (k := k) ell i) : + liftBlock ell i (delta (partialDeriv ell) F x) = + delta (parameterPartial ell) (liftScalar ell i F) (liftBlock ell i x) := by + simp only [liftBlock, liftScalar, AlgHom.comp_apply] + rw [← delta_includeBlock] + exact coefficientMap_delta _ _ _ (baseChange_partial ell) _ _ + +omit [Fact ell.Prime] [CharP k ell] in + theorem reduce_liftBlock (i : Fin d) (x : Block (n := n) (k := k) ell i) : + coefficientMap (reduction ell) (liftBlock ell i x) = includeBlock ell i x := by + simp only [liftBlock, AlgHom.comp_apply] + generalize includeBlock ell i x = z + induction z using TensorProduct.inductionOn with + | add a b ha hb => simp only [map_add, ha, hb] + | tmul a e => simp only [coefficientMap_tmul, reduction_baseChange] + +omit [CharP k ell] in + theorem liftScalar_potential (D : FormalData (k := k) n) (i : Fin d) : + liftScalar ell i (blockPotential ell D i) = + baseChange (l := ThreeParameters.Ring k) ell + (wallSpecial ell true i (Ideal.Quotient.mk _ (D.P i)) - + wallSpecial ell false i (Ideal.Quotient.mk _ (D.P i))) := by + simp only [liftScalar, AlgHom.comp_apply, blockPotential, map_sub, include_wall] + +omit [Fact ell.Prime] [CharP k ell] in + theorem liftScalar_slope (D : FormalData (k := k) n) (i : Fin d) : + liftScalar ell i (blockSlope ell D i) = + baseChange (l := ThreeParameters.Ring k) ell (specialSlope ell D true i) := by + simp only [liftScalar, AlgHom.comp_apply, include_blockSlope] + +omit [Fact ell.Prime] [CharP k ell] in +theorem reduction_lifted_product + (v : Fin d → ParameterScalar (n := n) (k := k) ell) + (hv : ∀ i, reduction ell (v i) = 0) + (x y : ∀ i, Block (n := n) (k := k) ell i) : + coefficientMap (reduction ell) + (List.ofFn (fun i => liftBlock ell i (x i) + coeff (v i) * liftBlock ell i (y i))).prod = + (List.ofFn fun i => includeBlock ell i (x i)).prod := by + rw [map_list_prod, List.map_ofFn] + apply congrArg List.prod + apply congrArg List.ofFn + funext i + simp only [Function.comp_apply] + rw [map_add, reduce_liftBlock, map_mul, coefficientMap_coeff, hv, map_zero, zero_mul, add_zero] + + + +theorem parameter_cycle (D : FormalData (k := k) n) (J : Finset (Fin d)) + (s : Fin d → ThreeParameters.Ring k) + (hs : ∀ i, ThreeParameters.augmentation k (s i) = 0) + (hs2 : ∀ i, s i * s i = 0) (hout : ∀ i ∉ J, s i = 0) + (x : ∀ i, Block (n := n) (k := k) ell i) + (hx : ∀ i, delta (partialDeriv ell) (blockPotential ell D i) (x i) = 0) + (hy : ∀ i ∈ J, ∃ y : Block (n := n) (k := k) ell i, + delta (partialDeriv ell) (blockPotential ell D i) y = + -delta (partialDeriv ell) (blockSlope ell D i) (x i)) : + ∃ beta : ParameterForms (n := n) (k := k) ell, + delta (parameterPartial ell) + (movingPotential ell D (firstSlopes s) (firstSlopes_augmentation s hs)) beta = 0 ∧ + coefficientMap (reduction ell) beta = (List.ofFn fun i => includeBlock ell i (x i)).prod := by + classical + let y : ∀ i, Block (n := n) (k := k) ell i := fun i => + if hi : i ∈ J then Classical.choose (hy i hi) else 0 + have hy' (i : Fin d) (hi : i ∈ J) : + delta (partialDeriv ell) (blockPotential ell D i) (y i) = + -delta (partialDeriv ell) (blockSlope ell D i) (x i) := by + simp only [y, dite_eq_left hi] + exact Classical.choose_spec (hy i hi) + let v : Fin d → ParameterScalar (n := n) (k := k) ell := + fun i => @algebraMap (ThreeParameters.Ring k) (ParameterScalar (n := n) (k := k) ell) + inferInstance inferInstance inferInstance (s i) + let beta := (List.ofFn (fun i => liftBlock ell i (x i) + coeff (v i) * liftBlock ell i (y i))).prod + refine ⟨beta, ?_, ?_⟩ + · have hc := separated_parameter_lift_some (parameterPartial (n := n) (k := k) ell) + (fun i => liftScalar ell i (blockPotential ell D i)) + (fun i => liftScalar ell i (blockSlope ell D i)) v J + (by + intro i c + change partialDeriv (k := ThreeParameters.Ring k) ell c + (algebraMap (ThreeParameters.Ring k) _ (s i)) = 0 + exact Derivation.map_algebraMap _ _) + (by intro i; dsimp [v]; rw [← map_mul, hs2, map_zero]) + (by intro i hi; dsimp [v]; rw [hout i hi, map_zero]) + (fun i => liftBlock ell i (x i)) (fun i => liftBlock ell i (y i)) + (by + intro i + change delta (parameterPartial ell) (liftScalar ell i (blockPotential ell D i)) + (liftBlock ell i (x i)) = 0 + rw [← liftBlock_delta, hx, map_zero]) + (by + intro i hi + change delta (parameterPartial ell) (liftScalar ell i (blockPotential ell D i)) + (liftBlock ell i (y i)) = + -delta (parameterPartial ell) (liftScalar ell i (blockSlope ell D i)) + (liftBlock ell i (x i)) + rw [← liftBlock_delta, ← liftBlock_delta, hy' i hi, map_neg]) + change delta (parameterPartial ell) _ beta = 0 at hc + rw [movingPotential_first_order ell D s hs hs2] + simpa only [liftScalar_potential, liftScalar_slope] using hc + · apply reduction_lifted_product ell v _ x y + intro i + change reduction ell (algebraMap (ThreeParameters.Ring k) _ (s i)) = 0 + rw [reduction_base, hs, map_zero] + +end BoundaryOnly.FormalObstruction.ActualBlocks + +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/LinearChange.lean b/lean/OAI/Algebra/FrobeniusObstruction/LinearChange.lean new file mode 100644 index 0000000000000000000000000000000000000000..2c56c802a0a9ced8714768795dd20c0dfcdc59dc --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/LinearChange.lean @@ -0,0 +1,368 @@ +import Mathlib +import OAI.Algebra.FrobeniusObstruction.Derivations +import OAI.Algebra.FrobeniusObstruction.NilpotentInverse + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace BoundaryOnly.FormalObstruction.Frobenius +variable {ι k : Type*} [Fintype ι] [DecidableEq ι] [Field k] +variable (ell : ℕ) (hell : 0 < ell) + +def augmentation : Ring (ι := ι) (k := k) ell →ₐ[k] k := + { constantHom ell hell with commutes' := constantHom_algebraMap ell hell } + +omit [DecidableEq ι] in +@[simp] theorem augmentation_coordinate (i : ι) : + augmentation (k := k) ell hell (coordinate ell i) = 0 := by + change MvPowerSeries.constantCoeff (MvPowerSeries.X i : Series (k := k)) = 0 + simp + +def maximalIdeal : Ideal (Ring (ι := ι) (k := k) ell) := + RingHom.ker (augmentation ell hell) + +theorem maximalIdeal_nilpotent [CharP k ell] [Fact ell.Prime] : + IsNilpotent (maximalIdeal (ι := ι) (k := k) ell hell) := by + let : IsNoetherianRing (Ring (ι := ι) (k := k) ell) := + IsNoetherianRing.of_finite k _ + apply (Ideal.FG.isNilpotent_iff_le_nilradical + (IsNoetherian.noetherian (maximalIdeal (ι := ι) (k := k) ell hell))).mpr + intro x hx + apply mem_nilradical.mpr + refine ⟨ell, frobenius_zero_of_constant x ?_⟩ + have hx' : constantHom ell hell x = 0 := hx + rw [hx', zero_pow (by omega)] + + + +theorem augmentation_comp (f : Ring (ι := ι) (k := k) ell →ₐ[k] Ring (ι := ι) (k := k) ell) : + (augmentation ell hell).comp f = augmentation ell hell := by + apply algHom_ext + intro i + rw [AlgHom.comp_apply, augmentation_coordinate] + have hz : ((augmentation ell hell) (f (coordinate ell i)))^ell = 0 := by + rw [← map_pow, ← map_pow, coordinate_pow, map_zero, map_zero] + exact eq_zero_of_pow_eq_zero hz + +theorem endomorphism_difference_mem + (f : Ring (ι := ι) (k := k) ell →ₐ[k] Ring (ι := ι) (k := k) ell) (x) : + f x - x ∈ maximalIdeal ell hell := by + change augmentation ell hell (f x - x) = 0 + rw [map_sub, ← AlgHom.comp_apply, augmentation_comp, sub_self] + + + +theorem bijective_of_tangent_identity [CharP k ell] [Fact ell.Prime] + (f : Ring (ι := ι) (k := k) ell →ₐ[k] Ring (ι := ι) (k := k) ell) + (hfirst : ∀ x ∈ maximalIdeal ell hell, + f x - x ∈ (maximalIdeal ell hell)^2) : Function.Bijective f := + NilpotentInverse.bijective_of_first_jet _ (maximalIdeal_nilpotent ell hell) f + (endomorphism_difference_mem ell hell f) hfirst + + +omit [Fintype ι] [DecidableEq ι] in +theorem monomial_mem_coordinate_pow (e : ι →₀ ℕ) : + Ideal.Quotient.mk _ (MvPowerSeries.monomial e (1 : k)) ∈ + (Ideal.span (Set.range (coordinate (ι := ι) (k := k) ell)))^e.degree := by + induction e using Finsupp.induction with + | zero => simp + | single_add i b e hi hb ih => + rw [map_add, Finsupp.degree_single] + rw [pow_add (Ideal.span (Set.range (coordinate (ι := ι) (k := k) ell))) b e.degree] + rw [← one_mul (1 : k), ← MvPowerSeries.monomial_mul_monomial, + map_mul, ← MvPowerSeries.X_pow_eq, map_pow] + exact Ideal.mul_mem_mul + (Ideal.pow_mem_pow + (show coordinate (k := k) ell i ∈ Ideal.span (Set.range (coordinate (ι := ι) (k := k) ell)) from + Ideal.subset_span ⟨i, rfl⟩) b) ih + + + +theorem maximalIdeal_eq_span : maximalIdeal (ι := ι) (k := k) ell hell = + Ideal.span (Set.range (coordinate (ι := ι) (k := k) ell)) := by + apply le_antisymm + · intro x hx + rw [monomial_expansion ell x] + apply Submodule.sum_mem + intro v _ + by_cases he : exponent ell v = 0 + · have hc : coefficients ell x v = 0 := by + obtain ⟨f, rfl⟩ := Ideal.Quotient.mk_surjective x + change MvPowerSeries.coeff (exponent ell v) f = 0 + rw [he, MvPowerSeries.coeff_zero_eq_constantCoeff] + exact hx + rw [hc, zero_smul] + exact Submodule.zero_mem _ + · apply (Ideal.span (Set.range (coordinate (ι := ι) (k := k) ell))).restrictScalars k |>.smul_mem + have hd : 1 ≤ (exponent ell v).degree := by + have := (Finsupp.degree_eq_zero_iff (exponent ell v)).not.mpr he + omega + exact (show (Ideal.span (Set.range (coordinate (ι := ι) (k := k) ell)))^ + (exponent ell v).degree ≤ _ from + (Ideal.pow_le_pow_right hd).trans_eq (pow_one (Ideal.span (Set.range (coordinate (ι := ι) (k := k) ell))))) + (monomial_mem_coordinate_pow ell (exponent ell v)) + · apply Ideal.span_le.mpr + rintro _ ⟨i, rfl⟩ + exact augmentation_coordinate ell hell i + +theorem bijective_of_coordinate_first_jet [CharP k ell] [Fact ell.Prime] + (f : Ring (ι := ι) (k := k) ell →ₐ[k] Ring (ι := ι) (k := k) ell) + (hfirst : ∀ i, f (coordinate ell i) - coordinate ell i ∈ (maximalIdeal ell hell)^2) : + Function.Bijective f := by + apply bijective_of_tangent_identity ell hell f + rw [maximalIdeal_eq_span] at * + apply NilpotentInverse.first_jet_of_generators _ f + · intro x + rw [← maximalIdeal_eq_span ell hell] + exact endomorphism_difference_mem ell hell f x + · exact hfirst + + +theorem endomorphism_pow_mem + (f : Ring (ι := ι) (k := k) ell →ₐ[k] Ring (ι := ι) (k := k) ell) + (n : ℕ) {x} (hx : x ∈ (maximalIdeal ell hell)^n) : f x ∈ (maximalIdeal ell hell)^n := by + have hf : Ideal.map f.toRingHom (maximalIdeal (ι := ι) (k := k) ell hell) ≤ maximalIdeal ell hell := by + apply Ideal.map_le_iff_le_comap.mpr + intro y hy + change augmentation ell hell (f y) = 0 + rw [← AlgHom.comp_apply, augmentation_comp] + exact hy + have hfn : Ideal.map f.toRingHom ((maximalIdeal (ι := ι) (k := k) ell hell)^n) ≤ (maximalIdeal ell hell)^n := by + rw [Ideal.map_pow] + exact pow_le_pow_left' hf n + exact hfn (Ideal.mem_map_of_mem f.toRingHom hx) + +def linearCoordinates (M : Matrix ι ι k) (i : ι) : Ring (ι := ι) (k := k) ell := + ∑ j, M i j • coordinate ell j + +omit [DecidableEq ι] in +@[simp] theorem augmentation_linearCoordinates (M : Matrix ι ι k) (i : ι) : + augmentation ell hell (linearCoordinates ell M i) = 0 := by + simp [linearCoordinates] + +section Prime +variable [CharP k ell] [Fact ell.Prime] + +include hell in +theorem linearCoordinates_pow (M : Matrix ι ι k) (i : ι) : + (linearCoordinates ell M i)^ell = 0 := by + apply frobenius_zero_of_constant + change (augmentation ell hell (linearCoordinates ell M i))^ell = 0 + rw [augmentation_linearCoordinates, zero_pow (by omega)] + +def linearSubst (M : Matrix ι ι k) : Ring (ι := ι) (k := k) ell →ₐ[k] Ring (ι := ι) (k := k) ell := + eval ell (linearCoordinates ell M) (linearCoordinates_pow ell hell M) + +@[simp] theorem linearSubst_coordinate (M : Matrix ι ι k) (i : ι) : + linearSubst ell hell M (coordinate ell i) = linearCoordinates ell M i := + eval_coordinate ell _ _ i + +theorem linearSubst_comp (M N : Matrix ι ι k) : + (linearSubst ell hell M).comp (linearSubst ell hell N) = linearSubst ell hell (N*M) := by + apply algHom_ext + intro i + simp only [AlgHom.comp_apply, linearSubst_coordinate, linearCoordinates, + map_sum, map_smul, linearSubst_coordinate, Finset.smul_sum, smul_smul, + Matrix.mul_apply, Finset.sum_smul] + rw [Finset.sum_comm] + +@[simp] theorem linearSubst_one : + linearSubst (ι := ι) (k := k) ell hell 1 = AlgHom.id k _ := by + apply algHom_ext + intro i + simp [linearCoordinates, Matrix.one_apply] + +theorem linearSubst_injective (M : Matrix ι ι k) (hM : IsUnit M.det) : + Function.Injective (linearSubst ell hell M) := by + have hi : (linearSubst ell hell M⁻¹).comp (linearSubst ell hell M) = AlgHom.id k _ := by + rw [linearSubst_comp, Matrix.mul_nonsing_inv M hM, linearSubst_one] + intro x y h + have ht := congrArg (linearSubst ell hell M⁻¹) h + change ((linearSubst ell hell M⁻¹).comp (linearSubst ell hell M)) x = + ((linearSubst ell hell M⁻¹).comp (linearSubst ell hell M)) y at ht + simpa only [hi, AlgHom.id_apply] using ht + + + +theorem bijective_of_invertible_first_jet + (f : Ring (ι := ι) (k := k) ell →ₐ[k] Ring (ι := ι) (k := k) ell) + (M : Matrix ι ι k) (hM : IsUnit M.det) + (hfirst : ∀ i, f (coordinate ell i) - linearCoordinates ell M i ∈ (maximalIdeal ell hell)^2) : + Function.Bijective f := by + let g := linearSubst ell hell M⁻¹ + have hi : g.comp (linearSubst ell hell M) = AlgHom.id k _ := by + dsimp only [g] + rw [linearSubst_comp, Matrix.mul_nonsing_inv M hM, linearSubst_one] + have hgf : Function.Bijective (g.comp f) := by + apply bijective_of_coordinate_first_jet ell hell + intro i + have ht := endomorphism_pow_mem ell hell g 2 (hfirst i) + rw [map_sub, ← linearSubst_coordinate ell hell M i] at ht + have hic := AlgHom.congr_fun hi (coordinate ell i) + change g ((linearSubst ell hell M) (coordinate ell i)) = coordinate ell i at hic + rw [hic] at ht + exact ht + have hg : Function.Injective g := by + apply linearSubst_injective ell hell + simpa only [Matrix.det_nonsing_inv, Ring.inverse_eq_inv] using hM.inv + constructor + · intro x y h + apply hgf.1 + change g (f x) = g (f y) + rw [h] + · intro y + obtain ⟨x, hx⟩ := hgf.2 (g y) + exact ⟨x, hg hx⟩ + +end Prime +end BoundaryOnly.FormalObstruction.Frobenius + +namespace BoundaryOnly.FormalObstruction.Frobenius +variable {ι k : Type*} [Fintype ι] [DecidableEq ι] [Field k] +variable (ell : ℕ) (htwo : 1 < ell) + +def tangentCoeff (i : ι) : Ring (ι := ι) (k := k) ell →ₗ[k] k := + quotientCoeff ell (Finsupp.single i 1) (by + intro j + by_cases h : i = j + · subst j; simpa using htwo + · simp [Finsupp.single_eq_of_ne (Ne.symm h)]; omega) + +@[simp] theorem tangentCoeff_mk (i : ι) (f : Series (ι := ι) (k := k)) : + tangentCoeff ell htwo i (Ideal.Quotient.mk _ f) = + MvPowerSeries.coeff (Finsupp.single i 1) f := rfl + +@[simp] theorem tangentCoeff_coordinate (i j : ι) : + tangentCoeff (k := k) ell htwo i (coordinate ell j) = if i = j then 1 else 0 := by + simp [coordinate, MvPowerSeries.coeff_X, Finsupp.single_left_inj (one_ne_zero : (1 : ℕ) ≠ 0)] + +@[simp] theorem tangentCoeff_one (i : ι) : + tangentCoeff (k := k) ell htwo i 1 = 0 := by + change tangentCoeff (k := k) ell htwo i (Ideal.Quotient.mk _ (1 : Series (ι := ι) (k := k))) = 0 + rw [tangentCoeff_mk, MvPowerSeries.coeff_one] + simp + +def firstJetError : Ring (ι := ι) (k := k) ell →ₗ[k] Ring (ι := ι) (k := k) ell := + LinearMap.id - (augmentation (ι := ι) (k := k) ell (by omega)).toLinearMap.smulRight (1 : Ring (ι := ι) (k := k) ell) - + ∑ i, (tangentCoeff ell htwo i).smulRight (coordinate ell i) + +@[simp] theorem firstJetError_apply (x : Ring (ι := ι) (k := k) ell) : + firstJetError ell htwo x = x - augmentation ell (by omega) x • 1 - + ∑ i, tangentCoeff ell htwo i x • coordinate ell i := by + simp [firstJetError] + +@[simp] theorem firstJetError_one : firstJetError (ι := ι) (k := k) ell htwo 1 = 0 := by + simp + +@[simp] theorem firstJetError_coordinate (i : ι) : + firstJetError (k := k) ell htwo (coordinate ell i) = 0 := by + simp + + + +theorem firstJetError_mem_square (x : Ring (ι := ι) (k := k) ell) : + firstJetError ell htwo x ∈ (maximalIdeal ell (by omega))^2 := by + rw [monomial_expansion ell x, map_sum] + apply Submodule.sum_mem + intro v _ + rw [map_smul] + refine (((maximalIdeal (ι := ι) (k := k) ell (by omega))^2).restrictScalars k).smul_mem _ ?_ + by_cases hz : (exponent ell v).degree = 0 + · have he := (Finsupp.degree_eq_zero_iff _).mp hz + have hm : monomial (k := k) ell v = 1 := by simp [monomial, he] + rw [hm, firstJetError_one] + exact Submodule.zero_mem _ + by_cases ho : (exponent ell v).degree = 1 + · obtain ⟨i, hi⟩ : exponent ell v ∈ Set.range (fun i : ι => Finsupp.single i 1) := by + rw [Finsupp.range_single_one] + exact ho + have hm : monomial (k := k) ell v = coordinate ell i := by + simp [monomial, ← hi, coordinate, MvPowerSeries.X_def] + rw [hm, firstJetError_coordinate] + exact Submodule.zero_mem _ + · have he : exponent ell v ≠ 0 := (Finsupp.degree_eq_zero_iff _).not.mp hz + have hs (i : ι) : Finsupp.single i 1 ≠ exponent ell v := by + intro hi + apply ho + simp [← hi] + have ha : augmentation ell (by omega) (monomial (k := k) ell v) = 0 := by + change MvPowerSeries.constantCoeff (MvPowerSeries.monomial (exponent ell v) (1:k)) = 0 + rw [← MvPowerSeries.coeff_zero_eq_constantCoeff, MvPowerSeries.coeff_monomial] + simp [Ne.symm he] + have hc (i : ι) : tangentCoeff ell htwo i (monomial (k := k) ell v) = 0 := by + simp [monomial, MvPowerSeries.coeff_monomial, hs i] + rw [firstJetError_apply, ha, zero_smul, sub_zero] + simp only [hc, zero_smul, Finset.sum_const_zero, sub_zero] + rw [maximalIdeal_eq_span] + apply Ideal.pow_le_pow_right (show 2 ≤ (exponent ell v).degree by omega) + exact monomial_mem_coordinate_pow ell (exponent ell v) + + + +theorem bijective_of_tangent_matrix [CharP k ell] [Fact ell.Prime] + (f : Ring (ι := ι) (k := k) ell →ₐ[k] Ring (ι := ι) (k := k) ell) + (hM : IsUnit (Matrix.det (fun i j => tangentCoeff ell htwo j (f (coordinate ell i))))) : + Function.Bijective f := by + apply bijective_of_invertible_first_jet ell (by omega) f _ hM + intro i + have ha : augmentation ell (by omega) (f (coordinate ell i)) = 0 := by + rw [← AlgHom.comp_apply, augmentation_comp, augmentation_coordinate] + simpa only [firstJetError_apply, ha, zero_smul, sub_zero, linearCoordinates] + using firstJetError_mem_square ell htwo (f (coordinate ell i)) + +end BoundaryOnly.FormalObstruction.Frobenius + +namespace BoundaryOnly.FormalObstruction.Frobenius +variable {ι k S : Type*} [Fintype ι] [DecidableEq ι] [CommRing k] + [CommRing S] [Algebra k S] (ell : ℕ) [CharP k ell] + + +theorem derivation_chain_rule (f : Ring (ι := ι) (k := k) ell →ₐ[k] S) + (D : Derivation k S S) (x : Ring (ι := ι) (k := k) ell) : + D (f x) = ∑ i, f (partialDeriv ell i x) * D (f (coordinate ell i)) := by + let u := D.toLinearMap.comp f.toLinearMap + let v : Ring (ι := ι) (k := k) ell →ₗ[k] S := + ∑ i, D (f (coordinate ell i)) • (f.toLinearMap.comp (partialDeriv ell i).toLinearMap) + have hv (x) : v x = ∑ i, f (partialDeriv ell i x) * D (f (coordinate ell i)) := by + simp only [v, LinearMap.sum_apply, LinearMap.smul_apply, LinearMap.comp_apply, + Derivation.coeFn_coe, AlgHom.toLinearMap_apply, smul_eq_mul] + apply Finset.sum_congr rfl + intro i _ + exact mul_comm _ _ + have h : u = v := by + apply relativeDeriv_ext ell f + · simp [u] + · rw [hv]; simp + · intro x y + simp only [u, LinearMap.comp_apply, Derivation.coeFn_coe, + AlgHom.toLinearMap_apply, map_mul, Derivation.leibniz, smul_eq_mul] + ring + · intro x y + rw [hv, hv, hv, Finset.sum_mul, Finset.mul_sum, ← Finset.sum_add_distrib] + apply Finset.sum_congr rfl + intro i _ + simp only [Derivation.leibniz, smul_eq_mul, map_add, map_mul] + ring + · intro i + rw [hv] + simp only [coordinate, partial_coordinate, u, LinearMap.comp_apply, Derivation.coeFn_coe, + AlgHom.toLinearMap_apply, apply_ite f, map_one, map_zero, ite_mul, + one_mul, zero_mul, Finset.sum_ite_eq', Finset.mem_univ, ite_true] + exact (LinearMap.congr_fun h x).trans (hv x) + +variable {κ : Type*} [Fintype κ] [DecidableEq κ] + +omit [DecidableEq κ] in +theorem partial_chain_rule (f : Ring (ι := ι) (k := k) ell →ₐ[k] + Ring (ι := κ) (k := k) ell) (j : κ) (x : Ring (ι := ι) (k := k) ell) : + partialDeriv ell j (f x) = ∑ i, f (partialDeriv ell i x) * + partialDeriv ell j (f (coordinate ell i)) := + derivation_chain_rule ell f (partialDeriv ell j) x + +end BoundaryOnly.FormalObstruction.Frobenius + +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/MixedForms.lean b/lean/OAI/Algebra/FrobeniusObstruction/MixedForms.lean new file mode 100644 index 0000000000000000000000000000000000000000..ce478e65fc5bdeefea2c05c4acbc3b8eb86e9c2c --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/MixedForms.lean @@ -0,0 +1,399 @@ +import Mathlib + +namespace OAI + +noncomputable section +open scoped BigOperators + +noncomputable section +open scoped BigOperators TensorProduct + +namespace BoundaryOnly.FormalObstruction +namespace MixedForms + +variable {k A ι : Type*} [CommRing k] [CommRing A] [Algebra k A] + [DecidableEq ι] + +abbrev Ext := ExteriorAlgebra k (ι → k) +abbrev Forms := A ⊗[k] Ext (k := k) (ι := ι) + +def gen (i : ι) : Ext (k := k) (ι := ι) := ExteriorAlgebra.ι k (Pi.single i 1) + +def wedge (i : ι) : Module.End k (Ext (k := k) (ι := ι)) := + (Algebra.lmul k _).toLinearMap (gen i) + +@[simp] theorem wedge_apply (i : ι) (e : Ext (k := k) (ι := ι)) : + wedge i e = gen i * e := rfl + +theorem gen_anticommute (i j : ι) : + gen (k := k) i * gen j = -(gen j * gen i) := by + apply eq_neg_iff_add_eq_zero.mpr + exact ExteriorAlgebra.ι_add_mul_swap _ _ + +theorem gen_sq (i : ι) : gen (k := k) i * gen i = 0 := + ExteriorAlgebra.ι_sq_zero _ + + +omit [DecidableEq ι] in +theorem vector_supercommute (v : ι → k) (e : Ext (k := k) (ι := ι)) : + ExteriorAlgebra.ι k v * e = CliffordAlgebra.involute e * ExteriorAlgebra.ι k v := by + induction e using ExteriorAlgebra.induction with + | algebraMap r => + rw [AlgHom.commutes] + exact (Algebra.commutes r _).symm + | ι u => + rw [CliffordAlgebra.involute_ι, neg_mul] + exact eq_neg_iff_add_eq_zero.mpr (ExteriorAlgebra.ι_add_mul_swap _ _) + | mul a b ha hb => + rw [map_mul, ← mul_assoc, ha, mul_assoc, hb, ← mul_assoc] + | add a b ha hb => simp only [map_add, mul_add, add_mul, ha, hb] + +theorem gen_supercommute (i : ι) (e : Ext (k := k) (ι := ι)) : + gen i * e = CliffordAlgebra.involute e * gen i := + vector_supercommute (Pi.single i 1) e + +def parity : Forms (k := k) (A := A) (ι := ι) →ₐ[k] Forms (k := k) (A := A) (ι := ι) := + Algebra.TensorProduct.map (AlgHom.id k A) CliffordAlgebra.involute + +omit [DecidableEq ι] in +@[simp] theorem parity_tmul (a : A) (e : Ext (k := k) (ι := ι)) : + parity (a ⊗ₜ[k] e) = a ⊗ₜ[k] CliffordAlgebra.involute e := rfl + +omit [DecidableEq ι] in +theorem parity_sq (x : Forms (k := k) (A := A) (ι := ι)) : parity (parity x) = x := by + induction x using TensorProduct.inductionOn with + | tmul a e => simp [CliffordAlgebra.involute_involute] + | add x y hx hy => simp [hx, hy] + + +variable [Fintype ι] + +def d (pd : ι → Derivation k A A) : Module.End k (Forms (k := k) (A := A) (ι := ι)) := + ∑ i, TensorProduct.map (pd i).toLinearMap (wedge i) + +@[simp] theorem d_tmul (pd : ι → Derivation k A A) (a : A) + (e : Ext (k := k) (ι := ι)) : + d pd (a ⊗ₜ[k] e) = ∑ i, pd i a ⊗ₜ[k] (gen i * e) := by + simp [d] + +theorem d_mul (pd : ι → Derivation k A A) + (x y : Forms (k := k) (A := A) (ι := ι)) : + d pd (x * y) = d pd x * y + parity x * d pd y := by + induction x using TensorProduct.inductionOn with + | add x₁ x₂ hx₁ hx₂ => simp only [add_mul, map_add, hx₁, hx₂]; abel + | tmul a e => + induction y using TensorProduct.inductionOn with + | add y₁ y₂ hy₁ hy₂ => simp only [mul_add, map_add, hy₁, hy₂]; abel + | tmul b f => + simp only [Algebra.TensorProduct.tmul_mul_tmul, d_tmul, parity_tmul, + Derivation.leibniz, smul_eq_mul, TensorProduct.add_tmul, + Finset.sum_mul, Finset.mul_sum, Finset.sum_add_distrib] + rw [add_comm] + congr 1 <;> apply Finset.sum_congr rfl <;> intro i _ + · rw [mul_comm b, mul_assoc] + · rw [← mul_assoc, gen_supercommute i e, mul_assoc] + +theorem d_parity (pd : ι → Derivation k A A) + (x : Forms (k := k) (A := A) (ι := ι)) : + d pd (parity x) = -(parity (d pd x)) := by + induction x using TensorProduct.inductionOn with + | add x y hx hy => simp only [map_add, hx, hy, neg_add_rev]; abel + | tmul a e => + simp only [parity_tmul, d_tmul, map_sum, map_mul, + gen, CliffordAlgebra.involute_ι, neg_mul, TensorProduct.tmul_neg, + Finset.sum_neg_distrib, neg_neg] + + +def gradient (pd : ι → Derivation k A A) (F : A) : + Forms (k := k) (A := A) (ι := ι) := d pd (F ⊗ₜ[k] 1) + +def delta (pd : ι → Derivation k A A) (F : A) : + Module.End k (Forms (k := k) (A := A) (ι := ι)) := + (Algebra.lmul k _).toLinearMap (gradient pd F) + +@[simp] theorem delta_apply (pd : ι → Derivation k A A) (F : A) + (x : Forms (k := k) (A := A) (ι := ι)) : + delta pd F x = gradient pd F * x := rfl + + +omit [DecidableEq ι] in +theorem antisymmetric_sum {M : Type*} [AddCommGroup M] (f : ι → ι → M) + (hd : ∀ i, f i i = 0) (ha : ∀ i j, f i j + f j i = 0) : + ∑ i, ∑ j, f i j = 0 := by + rw [← Finset.sum_product'] + apply Finset.sum_involution (fun ij _ => (ij.2, ij.1)) + · intro ij _; exact ha _ _ + · intro ij _ hn he + have heq : ij.2 = ij.1 := congrArg Prod.fst he + exact hn (by simpa only [heq] using hd ij.1) + · intro ij _; simp + · intro ij _; rfl + + +theorem d_sq (pd : ι → Derivation k A A) + (hcomm : ∀ i j a, pd i (pd j a) = pd j (pd i a)) + (x : Forms (k := k) (A := A) (ι := ι)) : d pd (d pd x) = 0 := by + induction x using TensorProduct.inductionOn with + | add x y hx hy => simp only [map_add, hx, hy, add_zero] + | tmul a e => + simp only [d_tmul, map_sum] + apply antisymmetric_sum + · intro i + rw [← mul_assoc, gen_sq, zero_mul, TensorProduct.tmul_zero] + · intro i j + rw [hcomm j i, ← mul_assoc, gen_anticommute j i, neg_mul, + TensorProduct.tmul_neg, ← mul_assoc, neg_add_cancel] + + +theorem oneform_sq (v : ι → A) : + (∑ i, v i ⊗ₜ[k] gen (k := k) i) * (∑ i, v i ⊗ₜ[k] gen (k := k) i) = 0 := by + simp only [Finset.sum_mul, Finset.mul_sum, Algebra.TensorProduct.tmul_mul_tmul] + apply antisymmetric_sum + · intro i; rw [gen_sq, TensorProduct.tmul_zero] + · intro i j + rw [mul_comm (v j), gen_anticommute j i, TensorProduct.tmul_neg, neg_add_cancel] + +@[simp] theorem gradient_eq (pd : ι → Derivation k A A) (F : A) : + gradient pd F = ∑ i, pd i F ⊗ₜ[k] gen (k := k) i := by + simp only [gradient, d_tmul, mul_one] + +@[simp] theorem parity_gradient (pd : ι → Derivation k A A) (F : A) : + parity (gradient pd F) = -gradient pd F := by + simp only [gradient_eq, map_sum, parity_tmul, gen, CliffordAlgebra.involute_ι, + TensorProduct.tmul_neg, Finset.sum_neg_distrib] + +theorem delta_sq (pd : ι → Derivation k A A) (F : A) + (x : Forms (k := k) (A := A) (ι := ι)) : delta pd F (delta pd F x) = 0 := by + simp only [delta_apply, ← mul_assoc, gradient_eq, oneform_sq, zero_mul] + + +theorem d_delta (pd : ι → Derivation k A A) + (hcomm : ∀ i j a, pd i (pd j a) = pd j (pd i a)) + (F : A) (x : Forms (k := k) (A := A) (ι := ι)) : + d pd (delta pd F x) + delta pd F (d pd x) = 0 := by + rw [delta_apply, d_mul, parity_gradient] + have hz : d pd (gradient pd F) = 0 := d_sq pd hcomm _ + rw [hz, zero_mul, zero_add, neg_mul, delta_apply, neg_add_cancel] + + +omit [Fintype ι] [DecidableEq ι] in +theorem constant_commute (F : A) (x : Forms (k := k) (A := A) (ι := ι)) : + (F ⊗ₜ[k] (1 : Ext (k := k) (ι := ι))) * x = + x * (F ⊗ₜ[k] (1 : Ext (k := k) (ι := ι))) := by + induction x using TensorProduct.inductionOn with + | add x y hx hy => simp only [mul_add, add_mul, hx, hy] + | tmul a e => simp only [Algebra.TensorProduct.tmul_mul_tmul, one_mul, mul_one, mul_comm F a] + + +theorem d_commutator (pd : ι → Derivation k A A) (p : A) + (x : Forms (k := k) (A := A) (ι := ι)) : + d pd ((p ⊗ₜ[k] 1) * x) - (p ⊗ₜ[k] 1) * d pd x = delta pd p x := by + rw [d_mul, parity_tmul, map_one, add_sub_cancel_right] + rfl + + +theorem oneform_supercommute (v : ι → A) (x : Forms (k := k) (A := A) (ι := ι)) : + (∑ i, v i ⊗ₜ[k] gen (k := k) i) * x = + parity x * (∑ i, v i ⊗ₜ[k] gen (k := k) i) := by + induction x using TensorProduct.inductionOn with + | add x y hx hy => simp only [mul_add, map_add, add_mul, hx, hy] + | tmul a e => + simp only [Finset.sum_mul, parity_tmul, Finset.mul_sum, Algebra.TensorProduct.tmul_mul_tmul] + apply Finset.sum_congr rfl + intro i _ + rw [mul_comm (v i), gen_supercommute] + +theorem gradient_supercommute (pd : ι → Derivation k A A) (F : A) + (x : Forms (k := k) (A := A) (ι := ι)) : + gradient pd F * x = parity x * gradient pd F := by + rw [gradient_eq] + exact oneform_supercommute _ _ + +theorem gradient_sq (pd : ι → Derivation k A A) (F : A) : + gradient pd F * gradient pd F = 0 := by + rw [gradient_eq] + exact oneform_sq _ + + +def coeff : A →+* Forms (k := k) (A := A) (ι := ι) := + Algebra.TensorProduct.includeLeftRingHom + +omit [Fintype ι] [DecidableEq ι] in +@[simp] theorem coeff_apply (a : A) : coeff (k := k) (ι := ι) a = a ⊗ₜ[k] 1 := rfl + +omit [Fintype ι] [DecidableEq ι] in +@[simp] theorem parity_coeff (a : A) : parity (coeff (k := k) (ι := ι) a) = coeff a := by + simp only [coeff_apply, parity_tmul, map_one] + +omit [Fintype ι] [DecidableEq ι] in +theorem coeff_commute (a : A) (x : Forms (k := k) (A := A) (ι := ι)) : + coeff a * x = x * coeff a := constant_commute a x + +@[simp] theorem d_coeff (pd : ι → Derivation k A A) (a : A) : + d pd (coeff (k := k) (ι := ι) a) = gradient pd a := rfl + + +def cartier (pd : ι → Derivation k A A) (n : ℕ) (u : A) : + Forms (k := k) (A := A) (ι := ι) := coeff (u ^ n) * gradient pd u + +@[simp] theorem parity_cartier (pd : ι → Derivation k A A) (n : ℕ) (u : A) : + parity (cartier pd n u) = -cartier pd n u := by + simp only [cartier, map_mul, parity_coeff, parity_gradient, mul_neg] + +theorem gradient_mul_cartier (pd : ι → Derivation k A A) (n : ℕ) (u : A) : + gradient pd u * cartier pd n u = 0 := by + rw [cartier, ← mul_assoc, ← coeff_commute, mul_assoc, gradient_sq, mul_zero] + +theorem d_cartier (pd : ι → Derivation k A A) + (hcomm : ∀ i j a, pd i (pd j a) = pd j (pd i a)) (n : ℕ) (u : A) : + d pd (cartier pd n u) = 0 := by + induction n with + | zero => + simp only [cartier, pow_zero, map_one, one_mul, gradient] + exact d_sq pd hcomm _ + | succ n ih => + have hs : cartier pd (n+1) u = coeff u * cartier pd n u := by + simp only [cartier, pow_succ', map_mul, mul_assoc] + rw [hs, d_mul, d_coeff, gradient_mul_cartier, ih, mul_zero, add_zero] + + +def normal (pd : ι → Derivation k A A) (n : ℕ) (us : List A) : + Forms (k := k) (A := A) (ι := ι) := (us.map (cartier pd n)).prod + +@[simp] theorem normal_nil (pd : ι → Derivation k A A) (n : ℕ) : normal pd n [] = 1 := rfl +@[simp] theorem normal_cons (pd : ι → Derivation k A A) (n : ℕ) (u : A) (us : List A) : + normal pd n (u :: us) = cartier pd n u * normal pd n us := rfl + +theorem d_one (pd : ι → Derivation k A A) : + d pd (1 : Forms (k := k) (A := A) (ι := ι)) = 0 := by + change d pd ((1 : A) ⊗ₜ[k] (1 : Ext (k := k) (ι := ι))) = 0 + simp only [d_tmul, Derivation.map_one_eq_zero, TensorProduct.zero_tmul, Finset.sum_const_zero] + +theorem d_normal (pd : ι → Derivation k A A) + (hcomm : ∀ i j a, pd i (pd j a) = pd j (pd i a)) (n : ℕ) (us : List A) : + d pd (normal pd n us) = 0 := by + induction us with + | nil => exact d_one pd + | cons u us ih => rw [normal_cons, d_mul, d_cartier pd hcomm, ih, zero_mul, mul_zero, add_zero] + +theorem coeff_mul_normal (pd : ι → Derivation k A A) (n : ℕ) (us : List A) + (hpow : ∀ u ∈ us, u^(n+1) = 0) (u : A) (hu : u ∈ us) : + coeff u * normal pd n us = 0 := by + induction us with + | nil => simp at hu + | cons a us ih => + rw [List.mem_cons] at hu + rcases hu with rfl | hu + · have hz : coeff u * cartier pd n u = 0 := by + rw [cartier, ← mul_assoc, ← map_mul, ← pow_succ', hpow u (by simp), map_zero, zero_mul] + rw [normal_cons, ← mul_assoc, hz, zero_mul] + · rw [normal_cons, ← mul_assoc, coeff_commute u (cartier pd n a), mul_assoc, + ih (fun v hv => hpow v (List.mem_cons_of_mem a hv)) hu, mul_zero] + +theorem gradient_mul_normal (pd : ι → Derivation k A A) (n : ℕ) (us : List A) + (u : A) (hu : u ∈ us) : gradient pd u * normal pd n us = 0 := by + induction us with + | nil => simp at hu + | cons a us ih => + rw [List.mem_cons] at hu + rcases hu with rfl | hu + · rw [normal_cons, ← mul_assoc, gradient_mul_cartier, zero_mul] + · rw [normal_cons, ← mul_assoc, gradient_supercommute, parity_cartier] + simp only [neg_mul, mul_assoc, ih hu, mul_zero, neg_zero] + +theorem coeff_mul_normal_ideal (pd : ι → Derivation k A A) (n : ℕ) (us : List A) + (hpow : ∀ u ∈ us, u^(n+1) = 0) (F : A) + (hF : F ∈ Ideal.span {u | u ∈ us}) : coeff F * normal pd n us = 0 := by + induction hF using Submodule.span_induction with + | mem u hu => exact coeff_mul_normal pd n us hpow u hu + | zero => rw [map_zero, zero_mul] + | add a b ha hb hga hgb => rw [map_add, add_mul, hga, hgb, add_zero] + | smul a b hb hgb => + change coeff (a*b) * normal pd n us = 0 + rw [map_mul, mul_assoc, hgb, mul_zero] + + +theorem delta_normal (pd : ι → Derivation k A A) (n : ℕ) (us : List A) + (hpow : ∀ u ∈ us, u^(n+1) = 0) (F : A) + (hF : F ∈ Ideal.span {u | u ∈ us}) : delta pd F (normal pd n us) = 0 := by + change gradient pd F * normal pd n us = 0 + induction hF using Submodule.span_induction with + | mem u hu => exact gradient_mul_normal pd n us u hu + | zero => simp [gradient] + | add a b ha hb hga hgb => + simp only [gradient, map_add, TensorProduct.add_tmul, add_mul] at * + rw [hga, hgb, add_zero] + | smul a b hb hgb => + change gradient pd (a*b) * normal pd n us = 0 + have hgrad : gradient pd (a*b) = + gradient pd a * coeff b + coeff a * gradient pd b := by + change d pd (coeff (k := k) (ι := ι) (a*b)) = _ + rw [map_mul, d_mul, parity_coeff, d_coeff, d_coeff] + rw [hgrad, add_mul, mul_assoc, coeff_mul_normal_ideal pd n us hpow b hb, mul_zero, mul_assoc, hgb, + mul_zero, add_zero] + + +def contract (i : ι) : Module.End k (Forms (k := k) (A := A) (ι := ι)) := + TensorProduct.map LinearMap.id (CliffordAlgebra.contractLeft (LinearMap.proj i)) + +omit [Fintype ι] [DecidableEq ι] in +@[simp] theorem contract_tmul (i : ι) (a : A) (e : Ext (k := k) (ι := ι)) : + contract i (a ⊗ₜ[k] e) = a ⊗ₜ[k] CliffordAlgebra.contractLeft (LinearMap.proj i) e := rfl + +omit [Fintype ι] [DecidableEq ι] in +theorem contract_coeff (i : ι) (a : A) (x : Forms (k := k) (A := A) (ι := ι)) : + contract i (coeff a * x) = coeff a * contract i x := by + induction x using TensorProduct.inductionOn with + | add x y hx hy => simp only [mul_add, map_add, hx, hy] + | tmul b e => simp only [coeff_apply, Algebra.TensorProduct.tmul_mul_tmul, one_mul, + contract_tmul] + +theorem contraction_identity (pd : ι → Derivation k A A) (F : A) (i : ι) + (x : Forms (k := k) (A := A) (ι := ι)) : + delta pd F (contract i x) + contract i (delta pd F x) = coeff (pd i F) * x := by + induction x using TensorProduct.inductionOn with + | add x y hx hy => simp only [map_add, mul_add] at *; rw [add_add_add_comm, hx, hy] + | tmul a e => + simp only [delta_apply, gradient_eq, contract_tmul, Finset.sum_mul, + Algebra.TensorProduct.tmul_mul_tmul, map_sum, gen, + CliffordAlgebra.contractLeft_ι_mul, LinearMap.proj_apply, + TensorProduct.tmul_sub, TensorProduct.tmul_smul] + simp only [← Finset.sum_add_distrib] + try simp only [add_sub_cancel_left] + simp [Pi.single_apply, coeff_apply] + + +theorem ambient_primitive (pd : ι → Derivation k A A) (F : A) + (x : Forms (k := k) (A := A) (ι := ι)) (g : A) (h : ι → A) + (hcycle : delta pd F x = 0) + (herror : coeff (g - ∑ i, h i * pd i F) * x = 0) : + coeff g * x = delta pd F (∑ i, coeff (h i) * contract i x) := by + have hc (i : ι) : delta pd F (contract i x) = coeff (pd i F) * x := by + simpa only [hcycle, map_zero, add_zero] using contraction_identity pd F i x + have hx : coeff g * x = coeff (∑ i, h i * pd i F) * x := by + apply sub_eq_zero.mp + simpa only [map_sub, sub_mul] using herror + rw [hx, map_sum, map_sum, Finset.sum_mul] + apply Finset.sum_congr rfl + intro i _ + rw [map_mul, mul_assoc, ← hc i, delta_apply, delta_apply, ← mul_assoc, + coeff_commute (h i) (gradient pd F), mul_assoc] + + + +theorem normal_primitive (pd : ι → Derivation k A A) (n : ℕ) (us : List A) + (hpow : ∀ u ∈ us, u^(n+1) = 0) (F g : A) (h : ι → A) + (hF : F ∈ Ideal.span {u | u ∈ us}) + (hg : g - ∑ i, h i * pd i F ∈ Ideal.span {u | u ∈ us}) : + coeff g * normal pd n us = + delta pd F (∑ i, coeff (h i) * contract i (normal pd n us)) := + ambient_primitive pd F _ g h (delta_normal pd n us hpow F hF) + (coeff_mul_normal_ideal pd n us hpow _ hg) + +end MixedForms +end BoundaryOnly.FormalObstruction + +end +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/MovingCharts.lean b/lean/OAI/Algebra/FrobeniusObstruction/MovingCharts.lean new file mode 100644 index 0000000000000000000000000000000000000000..332138ba502ac49f7decf379559d8427b362246b --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/MovingCharts.lean @@ -0,0 +1,314 @@ +import Mathlib +import OAI.Algebra.FrobeniusObstruction.TangentCharts +import OAI.Algebra.FrobeniusObstruction.VanishingIdeals + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace BoundaryOnly.FormalObstruction +open Frobenius +variable {k : Type*} [Field k] {d : ℕ} {n : Fin d → ℕ} +variable (ell : ℕ) (htwo : 1 < ell) [CharP k ell] [Fact ell.Prime] + + +def movingGraphCoordinates (a : SlopeVar d → ThreeParameters.Ring k) (b : Bool) : + GraphVar n → Frobenius.Ring (ι := InternalVar n) (k := ThreeParameters.Ring k) ell + | .inl i => @algebraMap (ThreeParameters.Ring k) + (Frobenius.Ring (ι := InternalVar n) (k := ThreeParameters.Ring k) ell) inferInstance inferInstance inferInstance (a i) + | .inr t => coordinate ell (b,t) + +theorem movingGraphCoordinates_pow (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) (b : Bool) (v : GraphVar n) : + movingGraphCoordinates (n := n) ell a b v ^ ell = 0 := by + cases v with + | inl i => + change (@algebraMap (ThreeParameters.Ring k) + (Frobenius.Ring (ι := InternalVar n) (k := ThreeParameters.Ring k) ell) inferInstance inferInstance inferInstance (a i)) ^ ell = 0 + rw [← map_pow, ThreeParameters.augmentation_zero_pow k ell _ (ha i), map_zero] + | inr t => exact coordinate_pow ell (b,t) + +def movingGraphSlot (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) (b : Bool) : + Frobenius.Ring (ι := GraphVar n) (k := k) ell →ₐ[k] + Frobenius.Ring (ι := InternalVar n) (k := ThreeParameters.Ring k) ell := + eval ell (movingGraphCoordinates ell a b) (movingGraphCoordinates_pow ell a ha b) + +@[simp] theorem movingGraphSlot_coordinate (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) (b : Bool) (v : GraphVar n) : + movingGraphSlot ell a ha b (coordinate ell v) = movingGraphCoordinates ell a b v := + eval_coordinate ell _ _ _ + +theorem reduce_movingGraphSlot (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) (b : Bool) : + (reduction ell).comp (movingGraphSlot (n := n) ell a ha b) = graphSlot ell b := by + apply algHom_ext + intro v + simp only [AlgHom.comp_apply, movingGraphSlot_coordinate] + cases v with + | inl i => simp [movingGraphCoordinates, ha] + | inr t => simp [movingGraphCoordinates] + +def movingChartCoordinate (D : FormalData (k := k) n) + (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) (c : InternalVar n) : + Frobenius.Ring (ι := InternalVar n) (k := ThreeParameters.Ring k) ell := + movingGraphSlot ell a ha false (Ideal.Quotient.mk _ (D.Y c)) + + baseChange (l := ThreeParameters.Ring k) ell (fixedComplement ell D c) + +theorem movingChartCoordinate_pow (D : FormalData (k := k) n) + (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) (c : InternalVar n) : + movingChartCoordinate ell D a ha c ^ ell = 0 := by + let : CharP (Frobenius.Ring (ι := InternalVar n) (k := ThreeParameters.Ring k) ell) ell := + quotient_charP (Nat.Prime.pos Fact.out) + have h (c : InternalVar n) : + (Ideal.Quotient.mk (powerIdeal (k := k) ell) (D.Y c)) ^ ell = 0 := by + apply frobenius_zero_of_constant + rw [constantHom_mk, graph_constant_zero D c] + exact zero_pow (Nat.Prime.ne_zero Fact.out) + have hslot (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) (b : Bool) (c : InternalVar n) : + (movingGraphSlot ell a ha b (Ideal.Quotient.mk _ (D.Y c))) ^ ell = 0 := by + rw [← map_pow, h, map_zero] + have hL : (baseChange (l := ThreeParameters.Ring k) ell (fixedComplement ell D c)) ^ ell = 0 := by + rw [← map_pow, fixedComplement_pow, map_zero] + change (movingGraphSlot ell a ha false (Ideal.Quotient.mk _ (D.Y c)) + + baseChange (l := ThreeParameters.Ring k) ell (fixedComplement ell D c)) ^ ell = 0 + have hadd := add_pow_char + (movingGraphSlot ell a ha false (Ideal.Quotient.mk _ (D.Y c))) + (baseChange (l := ThreeParameters.Ring k) ell (fixedComplement ell D c)) ell + exact hadd.trans (by rw [hslot, hL, zero_add]) + +def movingChart (D : FormalData (k := k) n) + (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) : + Frobenius.Ring (ι := InternalVar n) (k := ThreeParameters.Ring k) ell →ₐ[ThreeParameters.Ring k] + Frobenius.Ring (ι := InternalVar n) (k := ThreeParameters.Ring k) ell := + eval ell (movingChartCoordinate ell D a ha) (movingChartCoordinate_pow ell D a ha) + +@[simp] theorem movingChart_coordinate (D : FormalData (k := k) n) + (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) (c : InternalVar n) : + movingChart ell D a ha (coordinate ell c) = movingChartCoordinate ell D a ha c := + eval_coordinate ell _ _ _ + +theorem movingChart_specialFiber (D : FormalData (k := k) n) + (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) + (x : Frobenius.Ring (ι := InternalVar n) (k := ThreeParameters.Ring k) ell) : + reduction ell (movingChart ell D a ha x) = specialChart ell D (reduction ell x) := by + apply specialFiber_of_coordinates + intro c + rw [movingChart_coordinate, specialChart_coordinate, movingChartCoordinate, map_add] + rw [reduction_baseChange] + have h := AlgHom.congr_fun (reduce_movingGraphSlot (n := n) ell a ha false) + (Ideal.Quotient.mk (powerIdeal (k := k) ell) (D.Y c)) + exact congrArg (fun x => x + fixedComplement ell D c) h + + + +include htwo in +theorem movingChart_bijective (D : FormalData (k := k) n) + (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) : + Function.Bijective (movingChart ell D a ha) := + bijective_of_specialFiber ell (movingChart ell D a ha) (specialChartEquiv ell htwo D) + (movingChart_specialFiber ell D a ha) + +def movingChartEquiv (D : FormalData (k := k) n) + (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) : + Frobenius.Ring (ι := InternalVar n) (k := ThreeParameters.Ring k) ell ≃ₐ[ThreeParameters.Ring k] + Frobenius.Ring (ι := InternalVar n) (k := ThreeParameters.Ring k) ell := + AlgEquiv.ofBijective (movingChart ell D a ha) (movingChart_bijective ell htwo D a ha) + +end BoundaryOnly.FormalObstruction + +namespace BoundaryOnly.FormalObstruction.Frobenius +variable {ι κ k : Type*} [Fintype ι] [DecidableEq ι] + [Fintype κ] [DecidableEq κ] [CommRing k] +variable (ell : ℕ) [CharP k ell] [Fact ell.Prime] + +theorem centered_mk_pow (a : Series (ι := κ) (k := k)) + (ha : MvPowerSeries.constantCoeff a = 0) : + (Ideal.Quotient.mk (powerIdeal (ι := κ) (k := k) ell) a) ^ ell = 0 := by + rw [← map_pow, Ideal.Quotient.eq_zero_iff_mem] + apply series_frobenius_mem + rw [ha] + exact zero_pow (Fact.out : ell.Prime).ne_zero + +omit [DecidableEq ι] in +private theorem substitute_kernel (a : ι → Series (ι := κ) (k := k)) + (ha : ∀ i, MvPowerSeries.constantCoeff (a i) = 0) + (p : Series (ι := ι) (k := k)) (hp : p ∈ powerIdeal ell) : + ((Ideal.Quotient.mkₐ k (powerIdeal (ι := κ) ell)).comp + (MvPowerSeries.substAlgHom (R := k) + (MvPowerSeries.hasSubst_of_constantCoeff_zero ha))) p = 0 := by + obtain ⟨c, rfl⟩ := Ideal.mem_span_range_iff_exists_fun.mp hp + simp only [map_sum, map_mul, map_pow, AlgHom.comp_apply, MvPowerSeries.substAlgHom_X] + apply Finset.sum_eq_zero + intro i _ + change _ * (Ideal.Quotient.mk (powerIdeal (ι := κ) (k := k) ell) (a i)) ^ ell = 0 + rw [centered_mk_pow ell (a i) (ha i), mul_zero] + + +def substitute (a : ι → Series (ι := κ) (k := k)) + (ha : ∀ i, MvPowerSeries.constantCoeff (a i) = 0) : + Ring (ι := ι) (k := k) ell →ₐ[k] Ring (ι := κ) (k := k) ell := + Ideal.Quotient.liftₐ (powerIdeal (ι := ι) (k := k) ell) + ((Ideal.Quotient.mkₐ k (powerIdeal (ι := κ) (k := k) ell)).comp + (MvPowerSeries.substAlgHom (MvPowerSeries.hasSubst_of_constantCoeff_zero ha))) + (substitute_kernel ell a ha) + +omit [DecidableEq ι] in +@[simp] theorem substitute_mk (a : ι → Series (ι := κ) (k := k)) + (ha : ∀ i, MvPowerSeries.constantCoeff (a i) = 0) (p : Series (ι := ι) (k := k)) : + substitute ell a ha (Ideal.Quotient.mk _ p) = + Ideal.Quotient.mk _ (MvPowerSeries.subst a p) := by + change Ideal.Quotient.mk _ (MvPowerSeries.substAlgHom + (MvPowerSeries.hasSubst_of_constantCoeff_zero ha) p) = _ + rw [MvPowerSeries.substAlgHom_apply] + +omit [DecidableEq ι] in +@[simp] theorem substitute_coordinate (a : ι → Series (ι := κ) (k := k)) + (ha : ∀ i, MvPowerSeries.constantCoeff (a i) = 0) (i : ι) : + substitute ell a ha (coordinate ell i) = Ideal.Quotient.mk _ (a i) := by + rw [coordinate, substitute_mk, MvPowerSeries.subst_X + (MvPowerSeries.hasSubst_of_constantCoeff_zero ha)] + + + +theorem substitute_eq_eval (a : ι → Series (ι := κ) (k := k)) + (ha : ∀ i, MvPowerSeries.constantCoeff (a i) = 0) : + substitute ell a ha = eval ell + (fun i => Ideal.Quotient.mk (powerIdeal (ι := κ) (k := k) ell) (a i)) + (fun i => centered_mk_pow ell (a i) (ha i)) := by + apply algHom_ext + intro i + rw [substitute_coordinate, eval_coordinate] + + + +theorem eval_substitute {S : Type*} [CommRing S] [Algebra k S] + (a : ι → Series (ι := κ) (k := k)) + (ha : ∀ i, MvPowerSeries.constantCoeff (a i) = 0) + (b : κ → S) (hb : ∀ j, b j ^ ell = 0) + (x : Ring (ι := ι) (k := k) ell) : + eval ell b hb (substitute ell a ha x) = + eval ell (fun i => eval ell b hb (Ideal.Quotient.mk _ (a i))) + (fun i => by + rw [← map_pow, centered_mk_pow ell (a i) (ha i), map_zero]) x := by + have h : (eval ell b hb).comp (substitute ell a ha) = + eval ell (fun i => eval ell b hb (Ideal.Quotient.mk _ (a i))) + (fun i => by rw [← map_pow, centered_mk_pow ell (a i) (ha i), map_zero]) := by + apply algHom_ext + intro i + simp only [AlgHom.comp_apply, substitute_coordinate, eval_coordinate] + exact AlgHom.congr_fun h x + +end BoundaryOnly.FormalObstruction.Frobenius + +namespace BoundaryOnly.FormalObstruction.Frobenius +variable {ι k : Type*} [Fintype ι] [DecidableEq ι] [CommRing k] +variable (ell : ℕ) (hell : 0 < ell) + +noncomputable def planeRestriction (s : Finset ι) : + Ring (ι := ι) (k := k) ell →ₐ[k] Ring (ι := ι) (k := k) ell := + eval ell (fun i => if i ∈ s then 0 else coordinate ell i) (by + intro i + split_ifs + · exact zero_pow (by omega) + · exact coordinate_pow ell i) + +@[simp] theorem planeRestriction_coordinate (s : Finset ι) (i : ι) : + planeRestriction ell hell s (coordinate (k := k) ell i) = + if i ∈ s then 0 else coordinate ell i := by + exact eval_coordinate _ _ _ _ + +noncomputable def coordinatePlaneIdeal (s : Finset ι) : Ideal (Ring (ι := ι) (k := k) ell) := + Ideal.span (coordinate ell '' (s : Set ι)) + +theorem coordinatePlaneIdeal_le_ker (s : Finset ι) : + coordinatePlaneIdeal (k := k) ell s ≤ RingHom.ker (planeRestriction (k := k) ell hell s) := by + apply Ideal.span_le.mpr + rintro _ ⟨i,hi,rfl⟩ + change planeRestriction (k := k) ell hell s (coordinate ell i) = 0 + change i ∈ s at hi + simp only [planeRestriction_coordinate, ite_eq_left hi] + +theorem planeRestriction_mod_ideal (s : Finset ι) : + (Ideal.Quotient.mkₐ k (coordinatePlaneIdeal (k := k) ell s)).comp + (planeRestriction ell hell s) = Ideal.Quotient.mkₐ k (coordinatePlaneIdeal (k := k) ell s) := by + refine algHom_ext (ι := ι) (k := k) + (S := Ring (ι := ι) (k := k) ell ⧸ coordinatePlaneIdeal (k := k) ell s) ell _ _ ?_ + intro i + simp only [AlgHom.comp_apply, planeRestriction_coordinate] + by_cases hi : i ∈ s + · rw [ite_eq_left hi, map_zero] + symm + exact Ideal.Quotient.eq_zero_iff_mem.mpr (Ideal.subset_span ⟨i,hi,rfl⟩) + · rw [ite_eq_right hi] + + +theorem planeRestriction_eq_zero_iff (s : Finset ι) (x : Ring (ι := ι) (k := k) ell) : + planeRestriction ell hell s x = 0 ↔ x ∈ coordinatePlaneIdeal ell s := by + constructor + · intro hx + apply Ideal.Quotient.eq_zero_iff_mem.mp + have h := AlgHom.congr_fun (planeRestriction_mod_ideal (k := k) ell hell s) x + simp only [AlgHom.comp_apply, hx, map_zero] at h + exact h.symm + · intro hx + exact coordinatePlaneIdeal_le_ker ell hell s hx + +def chartNormalIdeal (f : Ring (ι := ι) (k := k) ell ≃ₐ[k] Ring (ι := ι) (k := k) ell) + (s : Finset ι) : Ideal (Ring (ι := ι) (k := k) ell) := + Ideal.span ((fun i => f (coordinate ell i)) '' (s : Set ι)) + + +omit [Fintype ι] [DecidableEq ι] in +theorem chartNormalIdeal_mem_iff + (f : Ring (ι := ι) (k := k) ell ≃ₐ[k] Ring (ι := ι) (k := k) ell) + (s : Finset ι) (x : Ring (ι := ι) (k := k) ell) : + x ∈ chartNormalIdeal ell f s ↔ f.symm x ∈ coordinatePlaneIdeal ell s := by + constructor + · intro hx + induction hx using Submodule.span_induction with + | mem x hx => + obtain ⟨i,hi,rfl⟩ := hx + simp only [AlgEquiv.symm_apply_apply] + exact Ideal.subset_span ⟨i,hi,rfl⟩ + | zero => simpa only [map_zero] using (coordinatePlaneIdeal (k := k) ell s).zero_mem + | add a b ha hb hfa hfb => + rw [map_add]; exact (coordinatePlaneIdeal ell s).add_mem hfa hfb + | smul a b hb hfb => + change f.symm (a*b) ∈ _ + rw [map_mul]; exact Ideal.mul_mem_left _ _ hfb + · intro hx + have H : ∀ y ∈ coordinatePlaneIdeal (k := k) ell s, f y ∈ chartNormalIdeal ell f s := by + intro y hy + induction hy using Submodule.span_induction with + | mem y hy => + obtain ⟨i,hi,rfl⟩ := hy + exact Ideal.subset_span ⟨i,hi,rfl⟩ + | zero => simpa only [map_zero] using (chartNormalIdeal ell f s).zero_mem + | add a b ha hb hfa hfb => + rw [map_add]; exact (chartNormalIdeal ell f s).add_mem hfa hfb + | smul a b hb hfb => + change f (a*b) ∈ _ + rw [map_mul]; exact Ideal.mul_mem_left _ _ hfb + simpa only [AlgEquiv.apply_symm_apply] using H (f.symm x) hx + +theorem chart_restriction_eq_zero_iff + (f : Ring (ι := ι) (k := k) ell ≃ₐ[k] Ring (ι := ι) (k := k) ell) + (s : Finset ι) (x : Ring (ι := ι) (k := k) ell) : + planeRestriction ell hell s (f.symm x) = 0 ↔ x ∈ chartNormalIdeal ell f s := by + rw [planeRestriction_eq_zero_iff, chartNormalIdeal_mem_iff] + +end BoundaryOnly.FormalObstruction.Frobenius + +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/NilpotentInverse.lean b/lean/OAI/Algebra/FrobeniusObstruction/NilpotentInverse.lean new file mode 100644 index 0000000000000000000000000000000000000000..d747ab348f9387d544fd9ece4d05ae489c02b750 --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/NilpotentInverse.lean @@ -0,0 +1,94 @@ +import Mathlib + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace BoundaryOnly.FormalObstruction +namespace NilpotentInverse +variable {k A : Type*} [Field k] [CommRing A] [Algebra k A] + + + +theorem difference_pow (I : Ideal A) (f : A →ₐ[k] A) + (haf : ∀ x : A, f x - x ∈ I) + (hfirst : ∀ x ∈ I, f x - x ∈ I^2) (n : ℕ) : + ∀ x ∈ I^n, f x - x ∈ I^(n+1) := by + induction n with + | zero => intro x _; simpa only [zero_add, pow_one] using haf x + | succ n ih => + intro x hx + rw [pow_succ] at hx + refine Submodule.mul_induction_on hx ?_ ?_ + · intro a ha b hb + have hfb : f b ∈ I := by + simpa only [sub_add_cancel] using I.add_mem (haf b) hb + have h₁ : (f a - a) * f b ∈ I^(n+1+1) := by + rw [pow_succ] + exact Ideal.mul_mem_mul (ih a ha) hfb + have h₂ : a * (f b - b) ∈ I^(n+1+1) := by + rw [show n+1+1 = n+2 by omega, pow_add] + exact Ideal.mul_mem_mul ha (hfirst b hb) + convert (I^(n+1+1)).add_mem h₁ h₂ using 1 + simp only [map_mul] + ring + · intro a b ha hb + convert (I^(n+1+1)).add_mem ha hb using 1 + simp only [map_add] + ring + + +theorem injective_of_first_jet (I : Ideal A) (hI : IsNilpotent I) (f : A →ₐ[k] A) + (haf : ∀ x : A, f x - x ∈ I) + (hfirst : ∀ x ∈ I, f x - x ∈ I^2) : Function.Injective f := by + apply (injective_iff_map_eq_zero f).mpr + intro x hx + have hn (n : ℕ) : x ∈ I^n := by + induction n with + | zero => simp only [pow_zero, Ideal.one_eq_top, Submodule.mem_top] + | succ n ih => + have ht := difference_pow I f haf hfirst n x ih + rw [hx, zero_sub] at ht + exact (I^(n+1)).neg_mem_iff.mp ht + obtain ⟨n, hn₀⟩ := hI + have ht := hn n + rw [hn₀] at ht + exact ht + +theorem bijective_of_first_jet [Module.Finite k A] (I : Ideal A) (hI : IsNilpotent I) + (f : A →ₐ[k] A) + (haf : ∀ x : A, f x - x ∈ I) + (hfirst : ∀ x ∈ I, f x - x ∈ I^2) : Function.Bijective f := by + have hi := injective_of_first_jet I hI f haf hfirst + exact ⟨hi, (LinearMap.injective_iff_surjective (f := f.toLinearMap)).mp hi⟩ + + +theorem first_jet_of_generators {σ : Type*} (c : σ → A) (f : A →ₐ[k] A) + (haf : ∀ x : A, f x - x ∈ Ideal.span (Set.range c)) + (hgen : ∀ i, f (c i) - c i ∈ (Ideal.span (Set.range c))^2) : + ∀ x ∈ Ideal.span (Set.range c), f x - x ∈ (Ideal.span (Set.range c))^2 := by + intro x hx + induction hx using Submodule.span_induction with + | mem y hy => obtain ⟨i, rfl⟩ := hy; exact hgen i + | zero => simp + | add a b ha hb ha₁ hb₁ => + convert (Ideal.span (Set.range c)^2).add_mem ha₁ hb₁ using 1 + simp only [map_add] + ring + | smul a b hb hb₁ => + change f (a*b) - a*b ∈ _ + have ht : (f a - a)*b ∈ Ideal.span (Set.range c)^2 := by + rw [pow_two] + exact Ideal.mul_mem_mul (haf a) hb + have ht' := (Ideal.span (Set.range c)^2).mul_mem_left (f a) hb₁ + convert (Ideal.span (Set.range c)^2).add_mem ht' ht using 1 + simp only [map_mul] + ring + +end NilpotentInverse +end BoundaryOnly.FormalObstruction + +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/NormalPrimitives.lean b/lean/OAI/Algebra/FrobeniusObstruction/NormalPrimitives.lean new file mode 100644 index 0000000000000000000000000000000000000000..27be754ef2d2198831d2ceccc900afda73dfd895 --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/NormalPrimitives.lean @@ -0,0 +1,415 @@ +import Mathlib +import OAI.Algebra.FrobeniusObstruction.GraphPotential +import OAI.Algebra.FrobeniusObstruction.GlobalForms + +namespace OAI + +noncomputable section +open scoped BigOperators + +noncomputable section +open scoped BigOperators TensorProduct + +namespace BoundaryOnly.FormalObstruction.Frobenius +open MixedForms +variable {ι k : Type*} [Fintype ι] [DecidableEq ι] [CommRing k] +variable (ell : ℕ) [CharP k ell] + + +def normalCoordinateList + (e : Ring (ι := ι) (k := k) ell ≃ₐ[k] Ring (ι := ι) (k := k) ell) + (s : Finset ι) : List (Ring (ι := ι) (k := k) ell) := + s.toList.map (fun i => e (coordinate ell i)) + +omit [Fintype ι] [DecidableEq ι] [CharP k ell] in +theorem normalCoordinateList_span + (e : Ring (ι := ι) (k := k) ell ≃ₐ[k] Ring (ι := ι) (k := k) ell) + (s : Finset ι) : Ideal.span {u | u ∈ normalCoordinateList ell e s} = + chartNormalIdeal ell e s := by + congr 1 + ext u + simp only [normalCoordinateList, List.mem_map, Finset.mem_toList, + Set.mem_ofPred_eq, Set.mem_image, Finset.mem_coe] + +omit [Fintype ι] [DecidableEq ι] [CharP k ell] in +theorem normalCoordinateList_pow (hell : 0 < ell) + (e : Ring (ι := ι) (k := k) ell ≃ₐ[k] Ring (ι := ι) (k := k) ell) + (s : Finset ι) (u : Ring (ι := ι) (k := k) ell) + (hu : u ∈ normalCoordinateList ell e s) : u ^ (ell-1+1) = 0 := by + obtain ⟨i, _, rfl⟩ := List.mem_map.mp hu + rw [Nat.sub_add_cancel hell, ← map_pow, coordinate_pow, map_zero] + +def chartNormal + (e : Ring (ι := ι) (k := k) ell ≃ₐ[k] Ring (ι := ι) (k := k) ell) + (s : Finset ι) : Forms (k := k) (A := Ring (ι := ι) (k := k) ell) (ι := ι) := + normal (partialDeriv ell) (ell-1) (normalCoordinateList ell e s) + +theorem chartNormal_d + (e : Ring (ι := ι) (k := k) ell ≃ₐ[k] Ring (ι := ι) (k := k) ell) + (s : Finset ι) : d (partialDeriv ell) (chartNormal ell e s) = 0 := + d_normal _ (partial_commute ell) _ _ + +theorem chartNormal_annihilate (hell : 0 < ell) + (e : Ring (ι := ι) (k := k) ell ≃ₐ[k] Ring (ι := ι) (k := k) ell) + (s : Finset ι) (g : Ring (ι := ι) (k := k) ell) + (hg : g ∈ chartNormalIdeal ell e s) : coeff g * chartNormal ell e s = 0 := + coeff_mul_normal_ideal _ _ _ (normalCoordinateList_pow ell hell e s) g + (by rwa [normalCoordinateList_span]) + +theorem chartNormal_delta (hell : 0 < ell) + (e : Ring (ι := ι) (k := k) ell ≃ₐ[k] Ring (ι := ι) (k := k) ell) + (s : Finset ι) (F : Ring (ι := ι) (k := k) ell) + (hF : F ∈ chartNormalIdeal ell e s) : + delta (partialDeriv ell) F (chartNormal ell e s) = 0 := + delta_normal _ _ _ (normalCoordinateList_pow ell hell e s) F + (by rwa [normalCoordinateList_span]) + +theorem chartNormal_primitive (hell : 0 < ell) + (e : Ring (ι := ι) (k := k) ell ≃ₐ[k] Ring (ι := ι) (k := k) ell) + (s : Finset ι) (F g : Ring (ι := ι) (k := k) ell) + (h : ι → Ring (ι := ι) (k := k) ell) + (hF : F ∈ chartNormalIdeal ell e s) + (hg : g - ∑ i, h i * partialDeriv ell i F ∈ chartNormalIdeal ell e s) : + coeff g * chartNormal ell e s = delta (partialDeriv ell) F + (∑ i, coeff (h i) * contract i (chartNormal ell e s)) := + normal_primitive _ _ _ (normalCoordinateList_pow ell hell e s) F g h + (by rwa [normalCoordinateList_span]) (by rwa [normalCoordinateList_span]) + +end BoundaryOnly.FormalObstruction.Frobenius + +namespace BoundaryOnly.FormalObstruction +open Frobenius MixedForms +variable {k : Type*} [Field k] {d : ℕ} {n : Fin d → ℕ} +variable (ell : ℕ) (htwo : 1 < ell) [CharP k ell] [Fact ell.Prime] + + + +abbrev ParameterForms := Forms (k := k) + (A := ParameterScalar (n := n) (k := k) ell) (ι := InternalVar n) + +def parameterPartial (i : InternalVar n) : + Derivation k (ParameterScalar (n := n) (k := k) ell) + (ParameterScalar (n := n) (k := k) ell) := + (partialDeriv (k := ThreeParameters.Ring k) ell i).restrictScalars k + +omit [Fact ell.Prime] in +@[simp] theorem parameterPartial_apply (i : InternalVar n) + (x : ParameterScalar (n := n) (k := k) ell) : + parameterPartial ell i x = partialDeriv ell i x := rfl + +omit [Fact ell.Prime] in +theorem parameterPartial_commute (i j : InternalVar n) + (x : ParameterScalar (n := n) (k := k) ell) : + parameterPartial ell i (parameterPartial ell j x) = + parameterPartial ell j (parameterPartial ell i x) := partial_commute ell i j x + +def movingNormal (D : FormalData (k := k) n) + (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) : + ParameterForms (n := n) (k := k) ell := + normal (parameterPartial ell) (ell-1) + (normalCoordinateList ell (movingChartEquiv ell htwo D a ha).symm normalIndices) + +theorem movingNormal_d (D : FormalData (k := k) n) + (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) : + MixedForms.d (parameterPartial ell) (movingNormal ell htwo D a ha) = 0 := + d_normal _ (parameterPartial_commute ell) _ _ + +theorem movingNormal_delta (D : FormalData (k := k) n) + (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) : + delta (parameterPartial ell) (movingPotential ell D a ha) + (movingNormal ell htwo D a ha) = 0 := + delta_normal _ _ _ (normalCoordinateList_pow ell (Nat.Prime.pos Fact.out) _ _) + _ (by rw [normalCoordinateList_span]; exact movingPotential_mem_normalIdeal ell htwo D a ha) + +theorem movingNormal_annihilate (D : FormalData (k := k) n) + (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) + (g : ParameterScalar (n := n) (k := k) ell) + (hg : g ∈ chartNormalIdeal ell (movingChartEquiv ell htwo D a ha).symm normalIndices) : + coeff g * movingNormal ell htwo D a ha = 0 := + coeff_mul_normal_ideal _ _ _ (normalCoordinateList_pow ell (Nat.Prime.pos Fact.out) _ _) + g (by rwa [normalCoordinateList_span]) + + +theorem movingNormal_primitive (D : FormalData (k := k) n) + (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) + (g : MvPowerSeries (GraphVar n) k) (hg : g ∈ gradientIdeal n D.P D.Y) : + ∃ eta : ParameterForms (n := n) (k := k) ell, + delta (parameterPartial ell) (movingPotential ell D a ha) eta = + coeff ((movingChartEquiv ell htwo D a ha).symm + (movingGraphSlot ell a ha false (Ideal.Quotient.mk _ g))) * + movingNormal ell htwo D a ha := by + obtain ⟨h, hh⟩ := graphIdeal_ambient_discrepancy ell htwo D a ha g hg + refine ⟨∑ i, coeff (h i) * contract i (movingNormal ell htwo D a ha), ?_⟩ + apply Eq.symm + apply normal_primitive _ _ _ (normalCoordinateList_pow ell (Nat.Prime.pos Fact.out) _ _) _ _ h + · rw [normalCoordinateList_span]; exact movingPotential_mem_normalIdeal ell htwo D a ha + · rw [normalCoordinateList_span]; exact hh + + +theorem movingNormal_cubic_primitive (D : FormalData (k := k) n) + (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) (i j l : Fin d) : + ∃ eta : ParameterForms (n := n) (k := k) ell, + delta (parameterPartial ell) (movingPotential ell D a ha) eta = + coeff (@algebraMap (ThreeParameters.Ring k) (ParameterScalar (n := n) (k := k) ell) + inferInstance inferInstance inferInstance (a (i,0) * a (j,0) * a (l,0))) * + movingNormal ell htwo D a ha := by + obtain ⟨eta, he⟩ := movingNormal_primitive ell htwo D a ha + (slope n i * slope n j * slope n l) (D.positive_cubic i j l) + have hs : (movingChartEquiv ell htwo D a ha).symm + (movingGraphSlot ell a ha false + (Ideal.Quotient.mk _ (slope n i * slope n j * slope n l))) = + @algebraMap (ThreeParameters.Ring k) (ParameterScalar (n := n) (k := k) ell) + inferInstance inferInstance inferInstance (a (i,0) * a (j,0) * a (l,0)) := by + simp only [map_mul, slope] + change (movingChartEquiv ell htwo D a ha).symm + (movingGraphSlot ell a ha false (coordinate ell (.inl (i,0)))) * + (movingChartEquiv ell htwo D a ha).symm + (movingGraphSlot ell a ha false (coordinate ell (.inl (j,0)))) * + (movingChartEquiv ell htwo D a ha).symm + (movingGraphSlot ell a ha false (coordinate ell (.inl (l,0)))) = _ + simp only [movingGraphSlot_coordinate, movingGraphCoordinates, AlgEquiv.commutes] + rw [hs] at he + exact ⟨eta, he⟩ + +end BoundaryOnly.FormalObstruction + +namespace BoundaryOnly.FormalObstruction.Frobenius +variable {ι k l : Type*} [Fintype ι] [DecidableEq ι] [CommRing k] [CommRing l] +variable (ell : ℕ) [CharP k ell] [CharP l ell] + +omit [Fintype ι] [DecidableEq ι] [CharP k ell] [CharP l ell] in +theorem series_pderiv_map (f : k →+* l) (i : ι) (x : Series (ι := ι) (k := k)) : + MvPowerSeries.map f (MvPowerSeries.pderiv i x) = + MvPowerSeries.pderiv i (MvPowerSeries.map f x) := by + ext e + simp only [MvPowerSeries.coeff_map, MvPowerSeries.coeff_pderiv, map_mul, map_add, map_natCast, map_one] + +omit [DecidableEq ι] in +theorem mapCoefficients_partial (f : k →+* l) (i : ι) + (x : Ring (ι := ι) (k := k) ell) : + mapCoefficients ell f (partialDeriv ell i x) = + partialDeriv ell i (mapCoefficients ell f x) := by + obtain ⟨p,rfl⟩ := Ideal.Quotient.mk_surjective x + simp only [partial_mk, mapCoefficients_mk, series_pderiv_map] + +variable [Algebra k l] +omit [DecidableEq ι] in +theorem baseChange_partial (i : ι) + (x : Ring (ι := ι) (k := k) ell) : + baseChange (l := l) ell (partialDeriv ell i x) = + partialDeriv ell i (baseChange (l := l) ell x) := + mapCoefficients_partial ell (algebraMap k l) i x + +end BoundaryOnly.FormalObstruction.Frobenius + +namespace BoundaryOnly.FormalObstruction.MixedForms +open scoped TensorProduct +variable {k A B ι : Type*} [CommRing k] [CommRing A] [CommRing B] + [Algebra k A] [Algebra k B] [Fintype ι] [DecidableEq ι] + + +def coefficientMap (f : A →ₐ[k] B) : + Forms (k := k) (A := A) (ι := ι) →ₐ[k] Forms (k := k) (A := B) (ι := ι) := + Algebra.TensorProduct.map f (AlgHom.id k _) + +omit [Fintype ι] [DecidableEq ι] in +@[simp] theorem coefficientMap_tmul (f : A →ₐ[k] B) + (a : A) (e : Ext (k := k) (ι := ι)) : + coefficientMap f (a ⊗ₜ[k] e) = f a ⊗ₜ[k] e := rfl + +omit [Fintype ι] [DecidableEq ι] in +@[simp] theorem coefficientMap_coeff (f : A →ₐ[k] B) (a : A) : + coefficientMap (ι := ι) f (coeff a) = coeff (f a) := rfl + + theorem coefficientMap_d (f : A →ₐ[k] B) + (pA : ι → Derivation k A A) (pB : ι → Derivation k B B) + (hp : ∀ i a, f (pA i a) = pB i (f a)) + (x : Forms (k := k) (A := A) (ι := ι)) : + coefficientMap f (d pA x) = d pB (coefficientMap f x) := by + induction x using TensorProduct.inductionOn with + | add x y hx hy => simp only [map_add, hx, hy] + | tmul a e => simp only [d_tmul, coefficientMap_tmul, map_sum, hp] + + theorem coefficientMap_gradient (f : A →ₐ[k] B) + (pA : ι → Derivation k A A) (pB : ι → Derivation k B B) + (hp : ∀ i a, f (pA i a) = pB i (f a)) (F : A) : + coefficientMap f (gradient pA F) = gradient pB (f F) := by + exact coefficientMap_d f pA pB hp (coeff F) + + theorem coefficientMap_delta (f : A →ₐ[k] B) + (pA : ι → Derivation k A A) (pB : ι → Derivation k B B) + (hp : ∀ i a, f (pA i a) = pB i (f a)) (F : A) + (x : Forms (k := k) (A := A) (ι := ι)) : + coefficientMap f (delta pA F x) = delta pB (f F) (coefficientMap f x) := by + simp only [delta_apply, map_mul, coefficientMap_gradient f pA pB hp] + + theorem coefficientMap_cartier (f : A →ₐ[k] B) + (pA : ι → Derivation k A A) (pB : ι → Derivation k B B) + (hp : ∀ i a, f (pA i a) = pB i (f a)) (e : ℕ) (u : A) : + coefficientMap f (cartier pA e u) = cartier pB e (f u) := by + simp only [cartier, map_mul, coefficientMap_coeff, map_pow, + coefficientMap_gradient f pA pB hp] + + theorem coefficientMap_normal (f : A →ₐ[k] B) + (pA : ι → Derivation k A A) (pB : ι → Derivation k B B) + (hp : ∀ i a, f (pA i a) = pB i (f a)) (e : ℕ) (us : List A) : + coefficientMap f (normal pA e us) = normal pB e (us.map f) := by + induction us with + | nil => simp only [normal, List.map_nil, List.prod_nil, map_one] + | cons u us ih => + simpa only [normal, List.map_cons, List.prod_cons, map_mul, + coefficientMap_cartier f pA pB hp] using congrArg + (fun x => cartier pB e (f u) * x) ih + +end BoundaryOnly.FormalObstruction.MixedForms + +namespace BoundaryOnly.FormalObstruction +open Frobenius MixedForms +variable {k : Type*} [Field k] {d : ℕ} {n : Fin d → ℕ} +variable (ell : ℕ) (htwo : 1 < ell) [CharP k ell] [Fact ell.Prime] + +theorem movingChart_inverse_specialFiber (D : FormalData (k := k) n) + (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) + (x : ParameterScalar (n := n) (k := k) ell) : + reduction ell ((movingChartEquiv ell htwo D a ha).symm x) = + (specialChartEquiv ell htwo D).symm (reduction ell x) := by + apply (specialChartEquiv ell htwo D).injective + rw [AlgEquiv.apply_symm_apply] + change specialChart ell D (reduction ell ((movingChartEquiv ell htwo D a ha).symm x)) = _ + rw [← movingChart_specialFiber ell D a ha] + change reduction ell ((movingChartEquiv ell htwo D a ha) + ((movingChartEquiv ell htwo D a ha).symm x)) = _ + rw [AlgEquiv.apply_symm_apply] + +def specialNormal (D : FormalData (k := k) n) : + Forms (k := k) (A := Frobenius.Ring (ι := InternalVar n) (k := k) ell) + (ι := InternalVar n) := + chartNormal ell (specialChartEquiv ell htwo D).symm normalIndices + +theorem reduce_normalList (D : FormalData (k := k) n) + (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) : + (normalCoordinateList ell (movingChartEquiv ell htwo D a ha).symm normalIndices).map + (reduction ell) = normalCoordinateList ell (specialChartEquiv ell htwo D).symm normalIndices := by + simp only [normalCoordinateList, List.map_map] + apply List.map_congr_left + intro i hi + simp only [Function.comp_apply, movingChart_inverse_specialFiber, reduction_coordinate] + +theorem reduce_movingNormal (D : FormalData (k := k) n) + (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) : + coefficientMap (reduction ell) (movingNormal ell htwo D a ha) = + specialNormal ell htwo D := by + have hp (i : InternalVar n) (x : ParameterScalar (n := n) (k := k) ell) : + reduction ell (parameterPartial ell i x) = partialDeriv ell i (reduction ell x) := + mapCoefficients_partial ell (ThreeParameters.augmentation k) i x + have hn := coefficientMap_normal (reduction (ι := InternalVar n) (k := k) ell) + (parameterPartial ell) (partialDeriv ell) hp (ell-1) + (normalCoordinateList ell (movingChartEquiv ell htwo D a ha).symm normalIndices) + rw [reduce_normalList ell htwo D a ha] at hn + exact hn + +end BoundaryOnly.FormalObstruction + +namespace BoundaryOnly.FormalObstruction +open Frobenius MixedForms +variable {k : Type*} [Field k] {d : ℕ} {n : Fin d → ℕ} +variable (ell : ℕ) (htwo : 1 < ell) [CharP k ell] [Fact ell.Prime] + +def specialAmbient : Frobenius.Ring (ι := AmbientVar n) (k := k) ell →ₐ[k] + Frobenius.Ring (ι := InternalVar n) (k := k) ell := + eval ell (Sum.elim (fun _ => 0) (coordinate ell)) (by + intro v + cases v with + | inl _ => exact zero_pow (Nat.Prime.ne_zero Fact.out) + | inr c => exact coordinate_pow ell c) + +omit [CharP k ell] in +@[simp] theorem specialAmbient_slope (i : SlopeVar d) : + specialAmbient (n := n) (k := k) ell (coordinate ell (.inl i)) = 0 := + eval_coordinate _ _ _ _ + +omit [CharP k ell] in +@[simp] theorem specialAmbient_internal (i : InternalVar n) : + specialAmbient (n := n) (k := k) ell (coordinate ell (.inr i)) = coordinate ell i := + eval_coordinate _ _ _ _ + + theorem reduce_ambientSlot (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) + (x : Frobenius.Ring (ι := AmbientVar n) (k := k) ell) : + reduction ell (ambientSlot ell a ha x) = specialAmbient ell x := by + have h : (reduction ell).comp (ambientSlot ell a ha) = + specialAmbient (n := n) (k := k) ell := by + apply algHom_ext + intro v + simp only [AlgHom.comp_apply, ambientSlot_coordinate] + cases v with + | inl i => simp only [ambientCoordinates, reduction_base, ha, map_zero, specialAmbient_slope] + | inr c => simp only [ambientCoordinates, reduction_coordinate, specialAmbient_internal] + exact AlgHom.congr_fun h x + +def specialPotential (D : FormalData (k := k) n) : + Frobenius.Ring (ι := InternalVar n) (k := k) ell := + specialAmbient ell (Ideal.Quotient.mk _ (potential n D.P)) + + theorem reduce_movingPotential (D : FormalData (k := k) n) + (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) : + reduction ell (movingPotential ell D a ha) = specialPotential ell D := + reduce_ambientSlot ell a ha _ + + theorem specialNormal_d (D : FormalData (k := k) n) : + MixedForms.d (partialDeriv ell) (specialNormal ell htwo D) = 0 := + chartNormal_d ell _ _ + +omit [Fact ell.Prime] in +theorem parameter_reduction_partial (i : InternalVar n) + (x : ParameterScalar (n := n) (k := k) ell) : + reduction ell (parameterPartial ell i x) = partialDeriv ell i (reduction ell x) := + mapCoefficients_partial ell (ThreeParameters.augmentation k) i x + + theorem specialNormal_delta (D : FormalData (k := k) n) : + delta (partialDeriv ell) (specialPotential ell D) (specialNormal ell htwo D) = 0 := by + let a : SlopeVar d → ThreeParameters.Ring k := fun _ => 0 + have ha : ∀ i, ThreeParameters.augmentation k (a i) = 0 := fun _ => map_zero _ + have h := congrArg (coefficientMap (reduction ell)) (movingNormal_delta ell htwo D a ha) + rw [coefficientMap_delta _ _ _ (parameter_reduction_partial ell), + reduce_movingPotential, reduce_movingNormal, map_zero] at h + exact h + + +theorem specialNormal_primitive (D : FormalData (k := k) n) + (g : MvPowerSeries (GraphVar n) k) (hg : g ∈ gradientIdeal n D.P D.Y) : + ∃ eta : Forms (k := k) (A := Frobenius.Ring (ι := InternalVar n) (k := k) ell) + (ι := InternalVar n), + delta (partialDeriv ell) (specialPotential ell D) eta = + coeff ((specialChartEquiv ell htwo D).symm + (graphSlot ell false (Ideal.Quotient.mk _ g))) * specialNormal ell htwo D := by + let a : SlopeVar d → ThreeParameters.Ring k := fun _ => 0 + have ha : ∀ i, ThreeParameters.augmentation k (a i) = 0 := fun _ => map_zero _ + obtain ⟨eta, he⟩ := movingNormal_primitive ell htwo D a ha g hg + refine ⟨coefficientMap (reduction ell) eta, ?_⟩ + have h := congrArg (coefficientMap (reduction ell)) he + rw [coefficientMap_delta _ _ _ (parameter_reduction_partial ell), + reduce_movingPotential, map_mul, coefficientMap_coeff, + movingChart_inverse_specialFiber, reduce_movingNormal] at h + have hr := AlgHom.congr_fun (reduce_movingGraphSlot ell a ha false) + (Ideal.Quotient.mk _ g) + change reduction ell (movingGraphSlot ell a ha false (Ideal.Quotient.mk _ g)) = _ at hr + rw [hr] at h + exact h + +end BoundaryOnly.FormalObstruction + +end +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/Obstruction.lean b/lean/OAI/Algebra/FrobeniusObstruction/Obstruction.lean new file mode 100644 index 0000000000000000000000000000000000000000..3f62c483388749e22c4f7db304a957645c1afa10 --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/Obstruction.lean @@ -0,0 +1,67 @@ +import Mathlib +import OAI.Algebra.FrobeniusObstruction.LiftProducts + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace BoundaryOnly.FormalObstruction.FixedResidue +open Frobenius MixedForms +variable {ι k : Type*} [Fintype ι] [DecidableEq ι] [Field k] +variable (ell : ℕ) (hell : 0 < ell) + + omit [DecidableEq ι] in + theorem scalar_eq_fixedResidue (v : Ext (k := k) (ι := ι) →ₗ[k] k) : + scalar ell hell v = fixedResidue + (quotientCoeff ell (topExponent ell) (topExponent_good hell)) v := by + apply TensorProduct.ext + apply LinearMap.ext + intro a + apply LinearMap.ext + intro e + rfl + +end BoundaryOnly.FormalObstruction.FixedResidue + +namespace BoundaryOnly.FormalObstruction +open Frobenius MixedForms + + + + +theorem no_formal_data + (k : Type*) [Field k] (ell : ℕ) [CharP k ell] + (hprime : ell.Prime) (hchar : 2 < ell) + (d : ℕ) (hd : 5 ≤ d) (n : Fin d → ℕ) : + ¬ Nonempty (FormalData (k := k) n) := by + let : Fact ell.Prime := ⟨hprime⟩ + rintro ⟨D⟩ + let hell : 0 < ell := by omega + let htwo : 1 < ell := by omega + obtain ⟨v,J,x,hJ,hx,hy,hpair⟩ := ActualBlocks.selected_block_cycles ell hchar hd D + obtain ⟨i,j,l,hi,hj,hl,hij,hil,hjl⟩ := Finset.two_lt_card_iff.mp (by omega : 2 < J.card) + let s : Fin d → ThreeParameters.Ring k := ThreeParameters.chosen i j l + have hs (r : Fin d) : ThreeParameters.augmentation k (s r) = 0 := + ThreeParameters.chosen_augmentation i j l r + have hs2 (r : Fin d) : s r * s r = 0 := ThreeParameters.chosen_square i j l r + have hout (r : Fin d) (hr : r ∉ J) : s r = 0 := + ThreeParameters.chosen_outside J i j l hi hj hl r hr + obtain ⟨beta,hbeta,hbeta0⟩ := ActualBlocks.parameter_cycle ell D J s hs hs2 hout x hx hy + let a := firstSlopes s + have ha : ∀ r, ThreeParameters.augmentation k (a r) = 0 := firstSlopes_augmentation s hs + obtain ⟨eta,heta⟩ := movingNormal_cubic_primitive ell htwo D a ha i j l + have hw : a (i,0) * a (j,0) * a (l,0) = ThreeParameters.w k := by + simp only [a, firstSlopes, ite_true] + exact ThreeParameters.chosen_product i j l hij hil hjl + rw [hw] at heta + apply FixedResidue.unit_residue_contradiction ell hell v (parameterPartial ell) + (movingPotential ell D a ha) (movingNormal ell htwo D a ha) beta eta hbeta heta + rw [map_mul, reduce_movingNormal, hbeta0, FixedResidue.scalar_eq_fixedResidue] + exact hpair + +end BoundaryOnly.FormalObstruction + +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/ParameterLifts.lean b/lean/OAI/Algebra/FrobeniusObstruction/ParameterLifts.lean new file mode 100644 index 0000000000000000000000000000000000000000..f52c8a5f5e50ace27a88f6c6bea9a1cac2b5c4ab --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/ParameterLifts.lean @@ -0,0 +1,130 @@ +import Mathlib +import OAI.Algebra.FrobeniusObstruction.FixedResidue + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace BoundaryOnly.FormalObstruction.MixedForms +variable {k A ι : Type*} [CommRing k] [CommRing A] [Algebra k A] +variable [Fintype ι] [DecidableEq ι] +open scoped TensorProduct + + + +theorem gradient_mul_list_prod_zero (pd : ι → Derivation k A A) (q : A) + (xs : List (Forms (k := k) (A := A) (ι := ι))) + (x : Forms (k := k) (A := A) (ι := ι)) (hx : x ∈ xs) + (hq : gradient pd q * x = 0) : gradient pd q * xs.prod = 0 := by + induction xs with + | nil => simp at hx + | cons a xs ih => + rcases List.mem_cons.mp hx with h | h + · subst x + rw [List.prod_cons, ← mul_assoc, hq, zero_mul] + · rw [List.prod_cons, ← mul_assoc, gradient_supercommute, mul_assoc, + ih h, mul_zero] + +theorem gradient_constant (pd : ι → Derivation k A A) (s : A) + (hs : ∀ i, pd i s = 0) : gradient pd s = 0 := by + simp only [gradient_eq, hs, TensorProduct.zero_tmul, Finset.sum_const_zero] + +theorem gradient_mul_constant (pd : ι → Derivation k A A) (s p : A) + (hs : ∀ i, pd i s = 0) : gradient pd (s*p) = coeff s * gradient pd p := by + change d pd (coeff (k := k) (ι := ι) (s*p)) = _ + rw [map_mul, d_mul, d_coeff, gradient_constant pd s hs, zero_mul, parity_coeff, + d_coeff, zero_add] + +theorem perturbed_factor (pd : ι → Derivation k A A) (Q p s : A) + (hs : ∀ i, pd i s = 0) (hs2 : s*s = 0) + (x y : Forms (k := k) (A := A) (ι := ι)) + (hx : gradient pd Q * x = 0) + (hy : gradient pd Q * y = -(gradient pd p * x)) : + gradient pd (Q+s*p) * (x+coeff s*y) = 0 := by + have hg : gradient pd (Q+s*p) = gradient pd Q + coeff s * gradient pd p := by + change d pd (coeff (k := k) (ι := ι) (Q+s*p)) = _ + rw [map_add, map_add, d_coeff, d_coeff, gradient_mul_constant pd s p hs] + have hc (z : Forms (k := k) (A := A) (ι := ι)) : z * coeff s = coeff s * z := + (coeff_commute s z).symm + rw [hg, add_mul, mul_add, mul_add, hx, zero_add, + ← mul_assoc (gradient pd Q), hc, mul_assoc, hy, + ← mul_assoc (coeff s * gradient pd p), mul_assoc (coeff s) (gradient pd p) (coeff s), + hc, ← mul_assoc (coeff s) (coeff s), ← map_mul, hs2, map_zero, zero_mul, + mul_neg, mul_assoc, zero_mul, add_zero, neg_add_cancel] + + + + +theorem separated_parameter_lift {b : ℕ} + (pd : ι → Derivation k A A) (Q p s : Fin b → A) + (hs : ∀ j i, pd i (s j) = 0) (hs2 : ∀ j, s j * s j = 0) + (x y : Fin b → Forms (k := k) (A := A) (ι := ι)) + (hx : ∀ j, gradient pd (Q j) * x j = 0) + (hy : ∀ j, gradient pd (Q j) * y j = -(gradient pd (p j) * x j)) : + delta pd (∑ j, (Q j + s j * p j)) + (List.ofFn (fun j => x j + coeff (s j) * y j)).prod = 0 := by + change gradient pd (∑ j, (Q j + s j * p j)) * _ = 0 + have hg : gradient pd (∑ j, (Q j + s j * p j)) = + ∑ j, gradient pd (Q j + s j * p j) := by + change d pd (coeff (k := k) (ι := ι) (∑ j, (Q j + s j * p j))) = _ + rw [map_sum, map_sum] + rfl + rw [hg, Finset.sum_mul] + apply Finset.sum_eq_zero + intro j _ + apply gradient_mul_list_prod_zero pd (Q j + s j * p j) + _ (x j + coeff (s j) * y j) + · exact List.mem_ofFn.mpr ⟨j,rfl⟩ + · exact perturbed_factor pd (Q j) (p j) (s j) (hs j) (hs2 j) (x j) (y j) (hx j) (hy j) + +end BoundaryOnly.FormalObstruction.MixedForms + +namespace BoundaryOnly.FormalObstruction +variable {k A B : Type*} [CommRing k] [CommRing A] [CommRing B] +variable [Algebra k A] [Algebra k B] + + + + +def firstOrder (f : A →ₐ[k] B) (D : Derivation k A A) (s : B) (hs : s*s = 0) : A →ₐ[k] B where + toFun x := f x + s * f (D x) + map_one' := by simp only [map_one, Derivation.map_one_eq_zero, map_zero, mul_zero, add_zero] + map_mul' x y := by + simp only [map_mul, Derivation.leibniz, smul_eq_mul, map_add] + linear_combination -(f (D x) * f (D y)) * hs + map_zero' := by simp only [map_zero, mul_zero, add_zero] + map_add' x y := by simp only [map_add]; ring + commutes' r := by + simp only [AlgHom.commutes, Derivation.map_algebraMap, map_zero, mul_zero, add_zero] + +@[simp] theorem firstOrder_apply (f : A →ₐ[k] B) (D : Derivation k A A) + (s : B) (hs : s*s = 0) (x : A) : + firstOrder f D s hs x = f x + s*f (D x) := rfl +end BoundaryOnly.FormalObstruction + +namespace BoundaryOnly.FormalObstruction.Frobenius +variable {ι k S : Type*} [Fintype ι] [DecidableEq ι] [CommRing k] +variable [CommRing S] [Algebra k S] (ell : ℕ) [CharP k ell] + + + +theorem evaluation_first_order (f g : Ring (ι := ι) (k := k) ell →ₐ[k] S) + (j : ι) (s : S) (hs : s*s = 0) + (hg : ∀ i, g (coordinate ell i) = f (coordinate ell i) + if j = i then s else 0) + (x : Ring (ι := ι) (k := k) ell) : + g x = f x + s*f (partialDeriv ell j x) := by + have he : g = firstOrder f (partialDeriv ell j) s hs := by + apply algHom_ext + intro i + rw [firstOrder_apply, hg, show partialDeriv ell j (coordinate ell i) = + (if j = i then 1 else 0) from partial_coordinate ell j i] + by_cases hi : j = i + · simp only [ite_eq_left hi, map_one, mul_one] + · simp only [ite_eq_right hi, map_zero, mul_zero] + exact AlgHom.congr_fun he x +end BoundaryOnly.FormalObstruction.Frobenius + +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/ResiduePairing.lean b/lean/OAI/Algebra/FrobeniusObstruction/ResiduePairing.lean new file mode 100644 index 0000000000000000000000000000000000000000..1e362c4f48926cdd5af5fe55e1598f845c94770e --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/ResiduePairing.lean @@ -0,0 +1,280 @@ +import Mathlib +import OAI.Algebra.FrobeniusObstruction.TopResidue + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace BoundaryOnly.FormalObstruction.MixedForms +variable {k A : Type*} [CommRing k] [CommRing A] [Algebra k A] {n : ℕ} + + +def oneFormLinear : (Fin n → A) →ₗ[A] Forms (k := k) (A := A) (ι := Fin n) where + toFun v := ∑ i, v i ⊗ₜ[k] gen (k := k) i + map_add' v w := by simp [TensorProduct.add_tmul, Finset.sum_add_distrib] + map_smul' c v := by + simp only [Pi.smul_apply, smul_eq_mul, RingHom.id_apply, Finset.smul_sum] + apply Finset.sum_congr rfl + intro i _ + exact (TensorProduct.smul_tmul' c (v i) (gen (k := k) i)).symm + + + +def exteriorBase : ExteriorAlgebra A (Fin n → A) →ₐ[A] + Forms (k := k) (A := A) (ι := Fin n) := + ExteriorAlgebra.lift A ⟨oneFormLinear, fun v => oneform_sq v⟩ + +@[simp] theorem exteriorBase_ι (v : Fin n → A) : + exteriorBase (k := k) (ExteriorAlgebra.ι A v) = ∑ i, v i ⊗ₜ[k] gen i := by + exact ExteriorAlgebra.lift_ι_apply A (oneFormLinear (k := k)) (fun v => oneform_sq v) v + + +theorem alternating_det {M : Type*} [AddCommGroup M] [Module A M] + (f : (Fin n → A) [⋀^Fin n]→ₗ[A] M) (v : Fin n → Fin n → A) : + f v = Matrix.det v • f (Pi.basisFun A (Fin n)) := by + let b := Pi.basisFun A (Fin n) + let g : (Fin n → A) [⋀^Fin n]→ₗ[A] M := + (LinearMap.toSpanSingleton A M (f b)).compAlternatingMap Matrix.detRowAlternating + have hfg : f = g := by + apply b.ext_alternating + intro i hi + let σ := Equiv.ofBijective i (Finite.injective_iff_bijective.mp hi) + change f (b ∘ σ) = g (b ∘ σ) + simp only [AlternatingMap.map_perm] + congr 1 + change f b = Matrix.det (fun i => b i) • f b + have hb : (fun i => b i) = (1 : Matrix (Fin n) (Fin n) A) := by + funext i j + simp [b, Pi.basisFun_apply, Pi.single_apply, Matrix.one_apply, eq_comm] + rw [hb, Matrix.det_one, one_smul] + calc + f v = g v := congrArg (fun u => u v) hfg + _ = _ := rfl + + +theorem oneForms_product (v : Fin n → Fin n → A) : + (List.ofFn fun i => oneFormLinear (k := k) (v i)).prod = + Matrix.det v • (List.ofFn fun i => (1 : A) ⊗ₜ[k] gen (k := k) i).prod := by + have h := alternating_det + ((exteriorBase (k := k) (A := A)).toLinearMap.compAlternatingMap + (ExteriorAlgebra.ιMulti A n)) v + simpa only [LinearMap.compAlternatingMap_apply, AlgHom.toLinearMap_apply, + ExteriorAlgebra.ιMulti_apply, map_list_prod, List.map_ofFn, Function.comp_def, + exteriorBase_ι, oneFormLinear, Pi.basisFun_apply, Pi.single_apply, + LinearMap.coe_mk, AddHom.coe_mk, TensorProduct.ite_tmul, TensorProduct.zero_tmul, Finset.sum_ite_eq', Finset.mem_univ, ite_true] using h + +end BoundaryOnly.FormalObstruction.MixedForms + +namespace BoundaryOnly.FormalObstruction.MixedForms +variable {k A : Type*} [CommRing k] [CommRing A] [Algebra k A] {n : ℕ} + + + +def volumeCoeff : Ext (k := k) (ι := Fin n) →ₗ[k] k := + ExteriorAlgebra.liftAlternating fun m => + if h : m = n then h.symm ▸ Matrix.detRowAlternating else 0 + +@[simp] theorem volumeCoeff_volume : + volumeCoeff (k := k) ((List.ofFn fun i : Fin n => gen (k := k) i).prod) = 1 := by + have hm : ExteriorAlgebra.ιMulti k n (Pi.basisFun k (Fin n)) = + (List.ofFn fun i : Fin n => gen (k := k) i).prod := by + simp only [ExteriorAlgebra.ιMulti_apply, Pi.basisFun_apply, gen] + rw [← hm] + rw [volumeCoeff, ExteriorAlgebra.liftAlternating_apply_ιMulti] + rw [dite_eq_left rfl] + change Matrix.det (fun i => Pi.basisFun k (Fin n) i) = 1 + have hb : (fun i => Pi.basisFun k (Fin n) i) = (1 : Matrix (Fin n) (Fin n) k) := by + ext i j + simp [Pi.basisFun_apply, Pi.single_apply, Matrix.one_apply, eq_comm] + rw [hb, Matrix.det_one] + + + +def residue (ρ : A →ₗ[k] k) : Forms (k := k) (A := A) (ι := Fin n) →ₗ[k] k := + (LinearMap.mul' k k).comp (TensorProduct.map ρ volumeCoeff) + +@[simp] theorem residue_tmul (ρ : A →ₗ[k] k) (a : A) (e : Ext (k := k) (ι := Fin n)) : + residue ρ (a ⊗ₜ[k] e) = ρ a * volumeCoeff e := rfl + + + +theorem residue_d (pd : Fin n → Derivation k A A) (ρ : A →ₗ[k] k) + (hρ : ∀ i a, ρ (pd i a) = 0) (x : Forms (k := k) (A := A) (ι := Fin n)) : + residue ρ (d pd x) = 0 := by + induction x using TensorProduct.inductionOn with + | add x y hx hy => simp [hx, hy] + | tmul a e => simp [d_tmul, hρ] + + +theorem residue_mul_d (pd : Fin n → Derivation k A A) (ρ : A →ₗ[k] k) + (hρ : ∀ i a, ρ (pd i a) = 0) + (x y : Forms (k := k) (A := A) (ι := Fin n)) (hx : d pd x = 0) : + residue ρ (x * d pd y) = 0 := by + have h := residue_d pd ρ hρ (parity x * y) + rw [d_mul, d_parity, hx, map_zero, neg_zero, zero_mul, + parity_sq, zero_add] at h + exact h + + +theorem mul_delta_of_cycle (pd : Fin n → Derivation k A A) (F : A) + (x y : Forms (k := k) (A := A) (ι := Fin n)) (hx : delta pd F x = 0) : + x * delta pd F y = 0 := by + have hp : gradient pd F * parity x = 0 := by + have h := congrArg parity hx + simpa only [delta_apply, map_mul, parity_gradient, neg_mul, + map_zero, neg_eq_zero] using h + rw [gradient_supercommute, parity_sq] at hp + rw [delta_apply, ← mul_assoc, hp, zero_mul] + +theorem residue_mul_delta (pd : Fin n → Derivation k A A) (F : A) (ρ : A →ₗ[k] k) + (x y : Forms (k := k) (A := A) (ι := Fin n)) (hx : delta pd F x = 0) : + residue ρ (x * delta pd F y) = 0 := by + rw [mul_delta_of_cycle pd F x y hx, map_zero] + + + +theorem normal_factor (pd : Fin n → Derivation k A A) (e : ℕ) (us : List A) : + normal pd e us = coeff ((us.map (fun u => u^e)).prod) * + (us.map (gradient pd)).prod := by + induction us with + | nil => simp only [normal_nil, List.map_nil, List.prod_nil, map_one, mul_one] + | cons u us ih => + simp only [normal_cons, ih, cartier, List.map_cons, List.prod_cons, map_mul] + rw [mul_assoc, ← mul_assoc (gradient pd u), ← coeff_commute, + mul_assoc, ← mul_assoc] + +@[simp] theorem normal_append (pd : Fin n → Derivation k A A) (e : ℕ) (us vs : List A) : + normal pd e (us ++ vs) = normal pd e us * normal pd e vs := by + simp [normal, List.map_append, List.prod_append] + + +theorem normal_ofFn (pd : Fin n → Derivation k A A) (e : ℕ) (u : Fin n → A) : + normal pd e (List.ofFn u) = + ((∏ i, u i ^ e) * Matrix.det (fun i j => pd j (u i))) ⊗ₜ[k] + (List.ofFn fun i => gen (k := k) i).prod := by + rw [normal_factor] + simp only [List.map_ofFn, Function.comp_def, List.prod_ofFn] + have hg : (fun i => gradient pd (u i)) = (fun i => oneFormLinear (fun j => pd j (u i))) := by + funext i + exact gradient_eq pd (u i) + rw [hg] + have hw := oneForms_product (k := k) (fun i j => pd j (u i)) + rw [hw] + have hv : (List.ofFn fun i : Fin n => (1 : A) ⊗ₜ[k] gen (k := k) i).prod = + (1 : A) ⊗ₜ[k] (List.ofFn fun i => gen (k := k) i).prod := by + have h := map_list_prod (Algebra.TensorProduct.includeRight (R := k) (A := A)) + (List.ofFn fun i : Fin n => gen (k := k) i) + simpa only [List.map_ofFn, Function.comp_def, + Algebra.TensorProduct.includeRight_apply] using h.symm + rw [hv, TensorProduct.smul_tmul', smul_eq_mul, mul_one, coeff_apply, + Algebra.TensorProduct.tmul_mul_tmul, one_mul] + +end BoundaryOnly.FormalObstruction.MixedForms + +namespace BoundaryOnly.FormalObstruction.Frobenius +variable {ι k : Type*} [Fintype ι] [DecidableEq ι] [Field k] +variable (ell : ℕ) (hell : 0 < ell) + +omit [DecidableEq ι] in +theorem topMonomial_eq_prod : topMonomial (ι := ι) (k := k) ell = + ∏ i, coordinate ell i ^ (ell - 1) := by + rw [topMonomial, MvPowerSeries.monomial_one_eq] + simp only [Finsupp.prod, map_prod, map_pow, coordinate] + apply Finset.prod_subset (Finset.subset_univ _) + intro i _ hi + have hx : topExponent ell i = 0 := by simpa only [Finsupp.mem_support_iff, not_not] using hi + simpa only [topExponent_apply, pow_zero] using congrArg (fun e => + Ideal.Quotient.mk (powerIdeal (ι := ι) (k := k) ell) (MvPowerSeries.X i)^e) hx + +variable [CharP k ell] (htwo : 1 < ell) + +@[simp] theorem augmentation_partial (i : ι) (x : Ring (ι := ι) (k := k) ell) : + augmentation ell hell (partialDeriv ell i x) = tangentCoeff ell htwo i x := by + obtain ⟨f,rfl⟩ := Ideal.Quotient.mk_surjective x + rw [partial_mk, tangentCoeff_mk] + change MvPowerSeries.constantCoeff (MvPowerSeries.pderiv i f) = _ + rw [← MvPowerSeries.coeff_zero_eq_constantCoeff_apply, MvPowerSeries.coeff_pderiv] + simp + +end BoundaryOnly.FormalObstruction.Frobenius + +namespace BoundaryOnly.FormalObstruction.NormalPairing +open Frobenius MixedForms +variable {k : Type*} [Field k] {n : ℕ} (ell : ℕ) (htwo : 1 < ell) + [CharP k ell] + +abbrev Scalar := Frobenius.Ring (ι := Fin n) (k := k) ell +abbrev OriginalForms := Forms (k := k) (A := Scalar (n := n) (k := k) ell) (ι := Fin n) + +def res : OriginalForms (n := n) (k := k) ell →ₗ[k] k := + residue (quotientCoeff ell (topExponent ell) (topExponent_good (by omega))) + +theorem jacobian_augmentation + (f : Scalar (n := n) (k := k) ell →ₐ[k] Scalar (n := n) (k := k) ell) : + augmentation ell (by omega) + (Matrix.det (fun i j : Fin n => partialDeriv ell j (f (coordinate ell i)))) = + Matrix.det (fun i j : Fin n => tangentCoeff ell htwo j (f (coordinate ell i))) := by + change (augmentation (ι := Fin n) (k := k) ell (by omega)).toRingHom + (Matrix.det _) = _ + refine (RingHom.map_det (augmentation (ι := Fin n) (k := k) ell (by omega)).toRingHom + (fun i j : Fin n => partialDeriv ell j (f (coordinate ell i)))).trans ?_ + apply congrArg Matrix.det + ext i j + exact augmentation_partial ell (by omega) htwo j _ + +omit [CharP k ell] in +theorem chart_top_product + (f : Scalar (n := n) (k := k) ell →ₐ[k] Scalar (n := n) (k := k) ell) + (c : k) (hq : f (topMonomial ell) = c • topMonomial ell) : + (∏ i : Fin n, f (coordinate ell i) ^ (ell-1)) = c • topMonomial ell := by + rw [← hq, topMonomial_eq_prod, map_prod] + simp only [map_pow] + +theorem residue_chart_formula + (f : Scalar (n := n) (k := k) ell →ₐ[k] Scalar (n := n) (k := k) ell) + (c : k) (hq : f (topMonomial ell) = c • topMonomial ell) : + res ell htwo (normal (partialDeriv ell) (ell-1) + (List.ofFn fun i : Fin n => f (coordinate ell i))) = + c * Matrix.det (fun i j : Fin n => tangentCoeff ell htwo j (f (coordinate ell i))) := by + unfold res + rw [normal_ofFn, residue_tmul, volumeCoeff_volume, mul_one, + chart_top_product ell f c hq, smul_mul_assoc, + topMonomial_mul (ι := Fin n) (k := k) (ell := ell) (by omega)] + rw [map_smul, map_smul, + topMonomial_coefficient (ι := Fin n) (k := k) (ell := ell) (by omega)] + change c * (augmentation (ι := Fin n) (k := k) ell (by omega) + (Matrix.det (fun i j : Fin n => partialDeriv ell j (f (coordinate ell i)))) * 1) = _ + rw [mul_one, jacobian_augmentation ell htwo f] + + + + +theorem coordinate_residue_ne_zero + (f : Scalar (n := n) (k := k) ell →ₐ[k] Scalar (n := n) (k := k) ell) + (hf : Function.Bijective f) + (hM : IsUnit (Matrix.det (fun i j => tangentCoeff ell htwo j (f (coordinate ell i))))) : + res ell htwo (normal (partialDeriv ell) (ell-1) + (List.ofFn fun i : Fin n => f (coordinate ell i))) ≠ 0 := by + obtain ⟨c,hc,hq⟩ := automorphism_top ell (by omega) f hf + rw [residue_chart_formula ell htwo f c hq] + exact mul_ne_zero hc hM.ne_zero + + + +theorem normals_pair_ne_zero + (f : Scalar (n := n) (k := k) ell →ₐ[k] Scalar (n := n) (k := k) ell) + (hf : Function.Bijective f) + (hM : IsUnit (Matrix.det (fun i j => tangentCoeff ell htwo j (f (coordinate ell i))))) + (us vs : List (Scalar (n := n) (k := k) ell)) + (huv : us ++ vs = List.ofFn fun i : Fin n => f (coordinate ell i)) : + res ell htwo (normal (partialDeriv ell) (ell-1) us * + normal (partialDeriv ell) (ell-1) vs) ≠ 0 := by + rw [← normal_append, huv] + exact coordinate_residue_ne_zero ell htwo f hf hM + +end BoundaryOnly.FormalObstruction.NormalPairing + +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/Retractions.lean b/lean/OAI/Algebra/FrobeniusObstruction/Retractions.lean new file mode 100644 index 0000000000000000000000000000000000000000..71351f7c227b2c2510f9028acbfef2582134c9e2 --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/Retractions.lean @@ -0,0 +1,183 @@ +import Mathlib +import OAI.Algebra.FrobeniusObstruction.SquareZero + +namespace OAI + +noncomputable section +open scoped BigOperators + +noncomputable section +namespace BoundaryOnly.FormalObstruction + +variable {k V : Type*} [Field k] [AddCommGroup V] [Module k V] + + +theorem retraction_core (D : V →ₗ[k] V) (d2 : ∀ x, D (D x) = 0) + (N : Submodule k V) : + ∃ r h : V →ₗ[k] V, + (∀ x, D (r x) = r (D x)) ∧ + (∀ x, r (r x) = r x) ∧ + N.map r = N ⊓ N.comap D ∧ + (∀ x ∈ N ⊓ N.comap D, r x = x) ∧ + (∀ x, x - r x = D (h x) + h (D x)) := by + let K := N ⊓ N.comap D + obtain ⟨E, hKE, hsup⟩ := IsModularLattice.exists_disjoint_and_sup_eq (show K ≤ N from inf_le_left) + have hEN : E ≤ N := by + rw [← hsup] + exact le_sup_right + have hDz (e : E) (he : D e ∈ N) : (e : V) = 0 := + Submodule.disjoint_def.mp hKE _ ⟨hEN e.property, he⟩ e.property + let f : E × N →ₗ[k] V := (D.comp E.subtype).coprod N.subtype + have hf : LinearMap.ker f = ⊥ := by + apply LinearMap.ker_eq_bot'.mpr + rintro ⟨e, n⟩ hz + change D (e : V) + (n : V) = 0 at hz + have he : (e : V) = 0 := hDz e (by + have heq : D (e : V) = -(n : V) := eq_neg_of_add_eq_zero_left hz + rw [heq] + exact N.neg_mem n.property) + have hn : (n : V) = 0 := by simpa [he] using hz + exact Prod.ext (Subtype.ext he) (Subtype.ext hn) + obtain ⟨g, hg⟩ := f.exists_leftInverse_of_injective hf + let h : V →ₗ[k] V := E.subtype.comp ((LinearMap.fst k E N).comp g) + have hrange (x : V) : h x ∈ E := (g x).1.property + have hgval (e : E) (n : N) : g (D e + n) = (e,n) := + LinearMap.congr_fun hg (e,n) + have hN (x : V) (hx : x ∈ N) : h x = 0 := by + have hv := hgval 0 ⟨x,hx⟩ + simp only [ZeroMemClass.coe_zero, map_zero, zero_add] at hv + change ((g x).1 : V) = 0 + rw [hv] + rfl + have hDE (e : E) : h (D e) = e := by + have hv := hgval e 0 + simp only [ZeroMemClass.coe_zero, add_zero] at hv + change ((g (D e)).1 : V) = e + rw [hv] + let Q : V →ₗ[k] V := D.comp h + h.comp D + have hQE (e : E) : Q e = e := by + change D (h e) + h (D e) = e + rw [hN e (hEN e.property), map_zero, zero_add, hDE] + have hQDE (e : E) : Q (D e) = D e := by + change D (h (D e)) + h (D (D e)) = D e + rw [hDE, d2, map_zero, add_zero] + have hQK (x : V) (hx : x ∈ K) : Q x = 0 := by + change D (h x) + h (D x) = 0 + rw [hN x hx.1, map_zero, hN (D x) hx.2, add_zero] + have hQQ (x : V) : Q (Q x) = Q x := by + change Q (D (h x) + h (D x)) = D (h x) + h (D x) + rw [map_add, hQDE ⟨h x,hrange x⟩, hQE ⟨h (D x),hrange (D x)⟩] + have hDQ (x : V) : D (Q x) = Q (D x) := by + change D (D (h x) + h (D x)) = D (h (D x)) + h (D (D x)) + rw [map_add, d2, zero_add, d2, map_zero, add_zero] + let r : V →ₗ[k] V := LinearMap.id - Q + have hr (x : V) : r x = x - Q x := rfl + have hrK (x : V) (hx : x ∈ K) : r x = x := by rw [hr, hQK x hx, sub_zero] + have hrE (e : E) : r e = 0 := by rw [hr, hQE, sub_self] + have hrN (x : V) (hx : x ∈ N) : r x ∈ K := by + rw [← hsup, Submodule.mem_sup] at hx + obtain ⟨y, hy, z, hz, rfl⟩ := hx + rw [map_add, hrK y hy, hrE ⟨z,hz⟩, add_zero] + exact hy + refine ⟨r, h, ?_, ?_, ?_, hrK, ?_⟩ + · intro x + rw [hr, hr, map_sub, hDQ] + · intro x + simp only [hr, map_sub, hQQ, sub_self, sub_zero] + · apply le_antisymm + · rintro _ ⟨x,hx,rfl⟩ + exact hrN x hx + · intro x hx + exact ⟨x, hx.1, hrK x hx⟩ + · intro x + rw [hr, sub_sub_cancel] + rfl + + +theorem kernel_retraction_core [FiniteDimensional k V] + (D S : V →ₗ[k] V) (d2 : ∀ x, D (D x) = 0) : + ∃ r h : V →ₗ[k] V, + (∀ x, D (r x) = r (D x)) ∧ + (∀ x, r (r x) = r x) ∧ + (LinearMap.ker S).map r = LinearMap.ker S ⊓ (LinearMap.ker S).comap D ∧ + (∀ x ∈ LinearMap.ker S ⊓ (LinearMap.ker S).comap D, r x = x) ∧ + (∀ x, x - r x = D (h x) + h (D x)) := + retraction_core D d2 (LinearMap.ker S) + +end BoundaryOnly.FormalObstruction + +namespace BoundaryOnly.FormalObstruction +variable {k V : Type*} [Field k] [AddCommGroup V] [Module k V] + + + + +theorem parity_retraction (htwo : (2 : k) ≠ 0) + (D S P : V →ₗ[k] V) + (hDD : ∀ x, D (D x) = 0) (hPP : ∀ x, P (P x) = x) + (hDP : ∀ x, D (P x) = -P (D x)) + (hSP : ∀ x, S (P x) = P (S x)) : + ∃ r h : V →ₗ[k] V, + (∀ x, D (r x) = r (D x)) ∧ + (∀ x, P (r x) = r (P x)) ∧ + (∀ x, P (h x) = -h (P x)) ∧ + (∀ x, x - r x = D (h x) + h (D x)) ∧ + (∀ x, S x = 0 → S (r x) = 0 ∧ S (D (r x)) = 0) := by + obtain ⟨r,h,hrD,_,hrN,_,hrh⟩ := + retraction_core D hDD (LinearMap.ker S) + let c : k := (2 : k)⁻¹ + have hc : c+c = 1 := by dsimp [c]; field_simp; ring + let r' : V →ₗ[k] V := c • (r + P.comp (r.comp P)) + let h' : V →ₗ[k] V := c • (h - P.comp (h.comp P)) + have hr' (x : V) : r' x = c • (r x + P (r (P x))) := rfl + have hh' (x : V) : h' x = c • (h x - P (h (P x))) := rfl + have hPD (x : V) : P (D x) = -D (P x) := by rw [hDP, neg_neg] + have hrN' (x : V) (hx : S x = 0) : S (r x) = 0 ∧ S (D (r x)) = 0 := by + have hx' : r x ∈ (LinearMap.ker S).map r := ⟨x, hx, rfl⟩ + rw [hrN] at hx' + exact hx' + refine ⟨r',h',?_,?_,?_,?_,?_⟩ + · intro x + simp only [hr', map_smul, map_add, hDP, hrD, map_neg] + module + · intro x + simp only [hr', map_smul, map_add, hPP] + module + · intro x + simp only [hh', map_smul, map_sub, hPP] + module + · intro x + have h₁ := hrh x + have h₂ := congrArg P (hrh (P x)) + simp only [map_sub, map_add, hPP] at h₂ + rw [hPD (h (P x)), hDP x, map_neg, map_neg] at h₂ + rw [hr', hh', hh'] + simp only [map_smul, map_sub] + have hh : c • (D (h x) + h (D x)) = c • (x - r x) := congrArg (c • ·) h₁.symm + have hh₂ : c • (-D (P (h (P x))) - P (h (P (D x)))) = + c • (x - P (r (P x))) := by + apply congrArg (c • ·) + simpa only [sub_eq_add_neg] using h₂.symm + have hc' : c • x + c • x = x := by rw [← add_smul, hc, one_smul] + calc + x - c • (r x + P (r (P x))) = + (c • x + c • x) - c • (r x + P (r (P x))) := by rw [hc'] + _ = c • (x - r x) + c • (x - P (r (P x))) := by module + _ = c • (D (h x) + h (D x)) + + c • (-D (P (h (P x))) - P (h (P (D x)))) := by rw [hh, hh₂] + _ = _ := by module + · intro x hx + have hSx := hrN' x hx + have hSPx := hrN' (P x) (by rw [hSP, hx, map_zero]) + constructor + · simp only [hr', map_smul, map_add, hSP, hSx.1, hSPx.1, map_zero, add_zero, + smul_zero] + · simp only [hr', map_smul, map_add, hDP, hSP, map_neg, hSx.2, hSPx.2, + map_zero, neg_zero, add_zero, smul_zero] + +end BoundaryOnly.FormalObstruction + +end +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/SelectedCycles.lean b/lean/OAI/Algebra/FrobeniusObstruction/SelectedCycles.lean new file mode 100644 index 0000000000000000000000000000000000000000..aad31f158a4cac4719107dc6ba51cfd31627124e --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/SelectedCycles.lean @@ -0,0 +1,241 @@ +import Mathlib +import OAI.Algebra.FrobeniusObstruction.ActualBlocks + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace BoundaryOnly.FormalObstruction.ActualBlocks +open Frobenius MixedForms FormsSplit GlobalForms SignedTensor +open scoped TensorProduct BigOperators +variable {k : Type*} [Field k] {d : ℕ} {n : Fin d → ℕ} +variable (ell : ℕ) [Fact ell.Prime] [CharP k ell] (hchar : 2 < ell) + + theorem selected_block_cycles (hd : 5 ≤ d) (D : FormalData (k := k) n) : + ∃ (v : Ext (k := k) (ι := InternalVar n) →ₗ[k] k) + (J : Finset (Fin d)) (x : ∀ i, Block (n := n) (k := k) ell i), + 3 ≤ J.card ∧ + (∀ i, delta (partialDeriv ell) (blockPotential ell D i) (x i) = 0) ∧ + (∀ i ∈ J, ∃ y : Block (n := n) (k := k) ell i, + delta (partialDeriv ell) (blockPotential ell D i) y = + -delta (partialDeriv ell) (blockSlope ell D i) (x i)) ∧ + fixedResidue (quotientCoeff ell (topExponent ell) (topExponent_good (by omega))) v + (specialNormal ell (by omega) D * + (List.ofFn fun i => includeBlock ell i (x i)).prod) ≠ 0 := by + let hell : 0 < ell := by omega + let htwo : 1 < ell := by omega + have htwoK : (2 : k) ≠ 0 := by + intro h + have hv : ell ∣ 2 := (CharP.cast_eq_zero_iff k ell 2).mp (by simpa using h) + have := Nat.le_of_dvd (by omega : 0 < 2) hv + omega + obtain ⟨v,hpair⟩ := specialNormal_pairing ell htwo D + let alpha := specialNormal ell htwo D + let beta := negativeNormal ell htwo D + let e := tensorToForms (n := n) (k := k) ell hell + let pd := fun i : Fin d => partialDeriv (ι := Variables n i) (k := k) ell + let q := blockPotential ell D + let s := blockSlope ell D + let rho := quotientCoeff (ι := InternalVar n) (k := k) ell (topExponent ell) (topExponent_good hell) + let Φ : (⨂[k] i, Block (n := n) (k := k) ell i) →ₗ[k] k := + (fixedResidue rho v).comp (((Algebra.lmul k _).toLinearMap alpha).comp e.toLinearMap) + have heD (z : ⨂[k] i, Block (n := n) (k := k) ell i) : + e (differential (Block (n := n) (k := k) ell) BlockTensor.P (BlockTensor.D pd) z) = + MixedForms.d (partialDeriv ell) (e z) := tensorToForms_D ell hell z + have heδ (z : ⨂[k] i, Block (n := n) (k := k) ell i) : + e (differential (Block (n := n) (k := k) ell) BlockTensor.P (BlockTensor.delta pd q) z) = + delta (partialDeriv ell) (specialPotential ell D) (e z) := tensorToForms_delta ell hell D z + have hPhiD (z) : Φ (differential (Block (n := n) (k := k) ell) BlockTensor.P (BlockTensor.D pd) z) = 0 := by + change fixedResidue rho v (alpha * e _) = 0 + rw [heD] + exact fixedResidue_mul_d (partialDeriv ell) rho v (residue_partial_zero ell hell) + alpha (e z) (specialNormal_d ell htwo D) + have hPhiδ (z) : Φ (differential (Block (n := n) (k := k) ell) BlockTensor.P (BlockTensor.delta pd q) z) = 0 := by + change fixedResidue rho v (alpha * e _) = 0 + rw [heδ, left_cycle_mul_delta _ _ _ _ (specialNormal_delta ell htwo D), map_zero] + have hz : differential (Block (n := n) (k := k) ell) BlockTensor.P + (BlockTensor.delta pd q) (e.symm beta) = 0 := by + apply e.injective + rw [heδ, e.apply_symm_apply, LinearEquiv.map_zero] + exact negativeNormal_delta ell htwo D + have hDz : differential (Block (n := n) (k := k) ell) BlockTensor.P + (BlockTensor.D pd) (e.symm beta) = 0 := by + apply e.injective + rw [heD, e.apply_symm_apply, LinearEquiv.map_zero] + exact negativeNormal_d ell htwo D + have hPhiz : Φ (e.symm beta) ≠ 0 := by + change fixedResidue rho v (alpha * e (e.symm beta)) ≠ 0 + rw [e.apply_symm_apply] + exact hpair + have htriple (I : Finset (Fin d)) (_hi : I ⊆ Finset.univ) (hI : I.card = 3) : + ∃ y, tensorAction (Block (n := n) (k := k) ell) (BlockTensor.S s) I (e.symm beta) = + differential (Block (n := n) (k := k) ell) BlockTensor.P (BlockTensor.delta pd q) y := by + obtain ⟨i,j,l,hij,hil,hjl,rfl⟩ := Finset.card_eq_three.mp hI + obtain ⟨eta,heta⟩ := negativeNormal_triple ell htwo D i j l + refine ⟨e.symm eta, ?_⟩ + apply e.injective + rw [heδ, e.apply_symm_apply] + change tensorToForms ell hell (tensorAction _ _ _ _) = _ + rw [tensorToForms_S] + change coeff _ * e (e.symm beta) = _ + rw [e.apply_symm_apply] + dsimp only [s] + simpa [hij, hil, hjl, beta, mul_assoc] using heta.symm + obtain ⟨J,x,_hJ,hJcard,hx,hy,hΦx⟩ := BlockTensor.selected_cycles pd q htwoK + (fun i a b z => partial_commute ell a b z) s Finset.univ + (by simpa using hd) Φ hPhiδ hPhiD (e.symm beta) hz hDz hPhiz htriple + refine ⟨v,J,x,hJcard,hx,hy,?_⟩ + change fixedResidue rho v (alpha * e (PiTensorProduct.tprod k x)) ≠ 0 at hΦx + simpa only [e, tensorToForms_tprod] using hΦx + +end BoundaryOnly.FormalObstruction.ActualBlocks + +namespace BoundaryOnly.FormalObstruction +open Frobenius MixedForms +open scoped BigOperators +variable {k : Type*} [Field k] {d : ℕ} {n : Fin d → ℕ} +variable (ell : ℕ) [Fact ell.Prime] [CharP k ell] + + def firstSlopes (s : Fin d → ThreeParameters.Ring k) : SlopeVar d → ThreeParameters.Ring k := + fun ij => if ij.2 = 0 then s ij.1 else 0 + + theorem firstSlopes_augmentation (s : Fin d → ThreeParameters.Ring k) + (hs : ∀ i, ThreeParameters.augmentation k (s i) = 0) (ij : SlopeVar d) : + ThreeParameters.augmentation k (firstSlopes s ij) = 0 := by + dsimp [firstSlopes] + split_ifs <;> simp only [hs, map_zero] + + theorem zeroSlopes_constant_zero (i : Fin d) (j : WallVar n i) : + MvPowerSeries.constantCoeff (zeroSlopes (k := k) n i j) = 0 := by + cases j <;> simp [zeroSlopes] + + theorem wallSpecial_zeroSlopes (b : Bool) (i : Fin d) + (p : MvPowerSeries (WallVar n i) k) : + wallSpecial (n := n) (k := k) ell b i (Ideal.Quotient.mk _ p) = + includeVariables (k := k) ell (fun y => (b,⟨i,y⟩)) + (Ideal.Quotient.mk _ (MvPowerSeries.subst (zeroSlopes n i) p)) := by + have h : wallSpecial (n := n) (k := k) ell b i = + (includeVariables (k := k) ell (fun y : Fin (n i) => ((b,⟨i,y⟩) : InternalVar n))).comp + (substitute ell (zeroSlopes n i) (zeroSlopes_constant_zero i)) := by + apply Frobenius.algHom_ext (ι := WallVar n i) (k := k) ell + intro j + simp only [AlgHom.comp_apply, substitute_coordinate] + cases j with + | inl j => simp only [zeroSlopes, map_zero, wallSpecial_slope] + | inr y => + rw [wallSpecial_internal] + change coordinate ell (b,⟨i,y⟩) = + includeVariables (k := k) ell (fun y : Fin (n i) => ((b,⟨i,y⟩) : InternalVar n)) + (coordinate ell y) + exact (includeVariables_coordinate (k := k) ell + (fun y : Fin (n i) => ((b,⟨i,y⟩) : InternalVar n)) y).symm + rw [h, AlgHom.comp_apply, substitute_mk] + + theorem wallSpecial_slopePartial (D : FormalData (k := k) n) (b : Bool) (i : Fin d) : + wallSpecial ell b i (partialDeriv ell (.inl 0) (Ideal.Quotient.mk _ (D.P i))) = + specialSlope ell D b i := by + rw [partial_mk, wallSpecial_zeroSlopes] + rfl + + def movingWall (s : Fin d → ThreeParameters.Ring k) + (hs : ∀ i, ThreeParameters.augmentation k (s i) = 0) (i : Fin d) : + Frobenius.Ring (ι := WallVar n i) (k := k) ell →ₐ[k] + ParameterScalar (n := n) (k := k) ell := + (ambientSlot ell (firstSlopes s) (firstSlopes_augmentation s hs)).comp + (substitute ell (plusCoordinates n i) (plusCoordinates_constant_zero i)) + + @[simp] theorem movingWall_slope (s : Fin d → ThreeParameters.Ring k) + (hs : ∀ i, ThreeParameters.augmentation k (s i) = 0) (i : Fin d) (j : Fin 3) : + movingWall (n := n) ell s hs i (coordinate ell (.inl j)) = + if j = 0 then @algebraMap (ThreeParameters.Ring k) (ParameterScalar (n := n) (k := k) ell) + inferInstance inferInstance inferInstance (s i) else 0 := by + simp only [movingWall, AlgHom.comp_apply, substitute_coordinate, plusCoordinates] + change ambientSlot ell _ _ (coordinate ell (.inl (i,j))) = _ + rw [ambientSlot_coordinate] + change @algebraMap (ThreeParameters.Ring k) (ParameterScalar (n := n) (k := k) ell) + inferInstance inferInstance inferInstance (if j = 0 then s i else 0) = _ + split_ifs <;> simp only [map_zero] + + @[simp] theorem movingWall_internal (s : Fin d → ThreeParameters.Ring k) + (hs : ∀ i, ThreeParameters.augmentation k (s i) = 0) (i : Fin d) (y : Fin (n i)) : + movingWall (n := n) ell s hs i (coordinate ell (.inr y)) = coordinate ell (true,⟨i,y⟩) := by + simp only [movingWall, AlgHom.comp_apply, substitute_coordinate, plusCoordinates] + exact ambientSlot_coordinate ell _ _ _ + + theorem movingWall_first_order (s : Fin d → ThreeParameters.Ring k) + (hs : ∀ i, ThreeParameters.augmentation k (s i) = 0) + (hs2 : ∀ i, s i * s i = 0) (i : Fin d) + (x : Frobenius.Ring (ι := WallVar n i) (k := k) ell) : + movingWall ell s hs i x = + baseChange (k := k) (l := ThreeParameters.Ring k) ell (wallSpecial ell true i x) + + (@algebraMap (ThreeParameters.Ring k) (ParameterScalar (n := n) (k := k) ell) + inferInstance inferInstance inferInstance (s i)) * + baseChange (k := k) (l := ThreeParameters.Ring k) ell + (wallSpecial ell true i (partialDeriv ell (.inl 0) x)) := by + let f := (baseChange (ι := InternalVar n) (k := k) (l := ThreeParameters.Ring k) ell).comp + (wallSpecial ell true i) + refine evaluation_first_order ell f (movingWall ell s hs i) (.inl 0) + (@algebraMap (ThreeParameters.Ring k) (ParameterScalar (n := n) (k := k) ell) + inferInstance inferInstance inferInstance (s i)) ?_ ?_ x + · rw [← map_mul, hs2, map_zero] + · intro j + cases j with + | inl j => + simp only [movingWall_slope, f, AlgHom.comp_apply, wallSpecial_slope, map_zero, zero_add, + Sum.inl.injEq] + simp only [eq_comm] + | inr y => + simp only [movingWall_internal, f, AlgHom.comp_apply, wallSpecial_internal, + baseChange_coordinate, Sum.inl_ne_inr, ite_false, add_zero] + + theorem ambientSlot_minus (a : SlopeVar d → ThreeParameters.Ring k) + (ha : ∀ i, ThreeParameters.augmentation k (a i) = 0) + (i : Fin d) (p : MvPowerSeries (WallVar n i) k) : + ambientSlot (n := n) ell a ha + (Ideal.Quotient.mk _ (MvPowerSeries.subst (minusCoordinates n i) p)) = + baseChange (k := k) (l := ThreeParameters.Ring k) ell (wallSpecial ell false i (Ideal.Quotient.mk _ p)) := by + have h : (ambientSlot (n := n) ell a ha).comp + (substitute (k := k) ell (minusCoordinates n i) (minusCoordinates_constant_zero i)) = + (baseChange (ι := InternalVar n) (k := k) (l := ThreeParameters.Ring k) ell).comp + (wallSpecial (n := n) (k := k) ell false i) := by + refine Frobenius.algHom_ext (ι := WallVar n i) (k := k) + (S := ParameterScalar (n := n) (k := k) ell) ell _ _ ?_ + intro j + simp only [AlgHom.comp_apply, substitute_coordinate] + cases j with + | inl j => simp only [minusCoordinates, map_zero, wallSpecial_slope] + | inr y => + rw [wallSpecial_internal, baseChange_coordinate] + exact ambientSlot_coordinate ell _ _ _ + simpa only [AlgHom.comp_apply, substitute_mk] using AlgHom.congr_fun h (Ideal.Quotient.mk _ p) + + + + theorem movingPotential_first_order (D : FormalData (k := k) n) + (s : Fin d → ThreeParameters.Ring k) + (hs : ∀ i, ThreeParameters.augmentation k (s i) = 0) + (hs2 : ∀ i, s i * s i = 0) : + movingPotential ell D (firstSlopes s) (firstSlopes_augmentation s hs) = + ∑ i, (baseChange (k := k) (l := ThreeParameters.Ring k) ell + (wallSpecial ell true i (Ideal.Quotient.mk _ (D.P i)) - + wallSpecial ell false i (Ideal.Quotient.mk _ (D.P i))) + + @algebraMap (ThreeParameters.Ring k) (ParameterScalar (n := n) (k := k) ell) + inferInstance inferInstance inferInstance (s i) * + baseChange (k := k) (l := ThreeParameters.Ring k) ell (specialSlope ell D true i)) := by + simp only [movingPotential, potential, map_sum, map_sub, ambientSlot_minus] + apply Finset.sum_congr rfl + intro i _ + have hh := movingWall_first_order (n := n) ell s hs hs2 i (Ideal.Quotient.mk _ (D.P i)) + change ambientSlot ell (firstSlopes s) (firstSlopes_augmentation s hs) + (substitute ell (plusCoordinates n i) (plusCoordinates_constant_zero i) + (Ideal.Quotient.mk _ (D.P i))) = _ at hh + rw [substitute_mk, wallSpecial_slopePartial] at hh + rw [hh] + ring + +end BoundaryOnly.FormalObstruction + +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/SignedTensor.lean b/lean/OAI/Algebra/FrobeniusObstruction/SignedTensor.lean new file mode 100644 index 0000000000000000000000000000000000000000..6b35f3337c7022057084bf26ba4fcd45ae4f365c --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/SignedTensor.lean @@ -0,0 +1,219 @@ +import Mathlib +import OAI.Algebra.FrobeniusObstruction.FormTensor + +namespace OAI + +noncomputable section +open scoped BigOperators TensorProduct + +namespace BoundaryOnly.FormalObstruction +namespace SignedTensor + +variable {k ι : Type*} [Field k] [Fintype ι] [LinearOrder ι] +variable (V : ι → Type*) [∀ i, AddCommGroup (V i)] [∀ i, Module k (V i)] + +abbrev EndFamily := ∀ i, Module.End k (V i) +abbrev TensorEnd := Module.End k (⨂[k] i, V i) + +def dSlot (P D : EndFamily (k := k) V) (i : ι) : EndFamily (k := k) V := + fun j => if j < i then P j else if j = i then D j else 1 + +def hSlot (P r h : EndFamily (k := k) V) (i : ι) : EndFamily (k := k) V := + fun j => if j < i then r j * P j else if j = i then h j else 1 + +def diagSlot (r : EndFamily (k := k) V) (i : ι) : EndFamily (k := k) V := + fun j => if j < i then r j else if j = i then 1 - r j else 1 + +def differential (P D : EndFamily (k := k) V) : TensorEnd (k := k) V := + ∑ i, PiTensorProduct.map (dSlot V P D i) + +def homotopy (P r h : EndFamily (k := k) V) : TensorEnd (k := k) V := + ∑ i, PiTensorProduct.map (hSlot V P r h i) + +omit [Fintype ι] in +private theorem tensor_neg_at (f g : EndFamily (k := k) V) (i : ι) + (hii : f i = -g i) (hij : ∀ j, j ≠ i → f j = g j) : + PiTensorProduct.map f = -PiTensorProduct.map g := by + have heq : f = Function.update g i (-g i) := by + funext j + by_cases h : j = i + · subst j; simpa using hii + · simp only [Function.update_of_ne h, hij j h] + rw [heq] + exact (PiTensorProduct.mapMultilinear k V V).map_update_neg g i (g i) |>.trans + (by rw [Function.update_eq_self]; rfl) + +omit [Fintype ι] in +private theorem tensor_add_at (f g b : EndFamily (k := k) V) (i : ι) + (hf : ∀ j, j ≠ i → f j = b j) (hg : ∀ j, j ≠ i → g j = b j) : + PiTensorProduct.map f + PiTensorProduct.map g = + PiTensorProduct.map (Function.update b i (f i + g i)) := by + have hh (a : EndFamily (k := k) V) (ha : ∀ j, j ≠ i → a j = b j) : + a = Function.update b i (a i) := by + funext j + by_cases h : j = i + · subst j; simp + · simp only [Function.update_of_ne h, ha j h] + conv_lhs => rw [hh f hf, hh g hg] + exact ((PiTensorProduct.mapMultilinear k V V).map_update_add b i (f i) (g i)).symm + +variable {V} + + +omit [Fintype ι] in +theorem mixed_cancel (P D r h : EndFamily (k := k) V) + (hDP : ∀ i, D i * P i = -(P i * D i)) + (hDr : ∀ i, D i * r i = r i * D i) + (hPr : ∀ i, P i * r i = r i * P i) + (hPh : ∀ i, P i * h i = -(h i * P i)) + (i j : ι) (hij : i ≠ j) : + PiTensorProduct.map (dSlot V P D i) * PiTensorProduct.map (hSlot V P r h j) + + PiTensorProduct.map (hSlot V P r h j) * PiTensorProduct.map (dSlot V P D i) = 0 := by + rw [← PiTensorProduct.map_mul, ← PiTensorProduct.map_mul] + suffices hh : PiTensorProduct.map (dSlot V P D i * hSlot V P r h j) = + -PiTensorProduct.map (hSlot V P r h j * dSlot V P D i) by exact add_eq_zero_iff_eq_neg.mpr hh + rcases lt_or_gt_of_ne hij with hij | hji + · apply tensor_neg_at V _ _ i + · simp only [Pi.mul_apply, dSlot, hSlot, lt_irrefl, ite_false, ite_true, hij] + rw [← mul_assoc, hDr, mul_assoc, hDP, mul_neg, ← mul_assoc] + · intro a hai + by_cases haj : a = j + · subst a + simp [dSlot, hSlot, hai, not_lt_of_gt hij] + · by_cases hal : a < i + · have hajl : a < j := hal.trans hij + simp only [Pi.mul_apply, dSlot, hSlot, hal, hajl, ite_true] + rw [← mul_assoc, hPr, mul_assoc] + · by_cases hajl : a < j + · simp [dSlot, hSlot, hal, hajl, hai] + · simp [dSlot, hSlot, hal, hajl, hai, haj] + · apply tensor_neg_at V _ _ j + · simp only [Pi.mul_apply, dSlot, hSlot, lt_irrefl, ite_false, ite_true, hji] + exact hPh j + · intro a haj + by_cases hai : a = i + · subst a + simp [dSlot, hSlot, haj, not_lt_of_gt hji] + · by_cases hal : a < j + · have hail : a < i := hal.trans hji + simp only [Pi.mul_apply, dSlot, hSlot, hal, hail, ite_true] + rw [← mul_assoc, hPr, mul_assoc] + · by_cases hail : a < i + · simp [dSlot, hSlot, hal, hail, haj] + · simp [dSlot, hSlot, hal, hail, hai, haj] + + +omit [Fintype ι] in +theorem diagonal_term (P D r h : EndFamily (k := k) V) + (hP2 : ∀ i, P i * P i = 1) + (hPr : ∀ i, P i * r i = r i * P i) + (hDh : ∀ i, D i * h i + h i * D i = 1 - r i) + (i : ι) : + PiTensorProduct.map (dSlot V P D i) * PiTensorProduct.map (hSlot V P r h i) + + PiTensorProduct.map (hSlot V P r h i) * PiTensorProduct.map (dSlot V P D i) = + PiTensorProduct.map (diagSlot V r i) := by + rw [← PiTensorProduct.map_mul, ← PiTensorProduct.map_mul] + have hbefore (a : ι) : P a * (r a * P a) = r a := by + rw [← mul_assoc, hPr, mul_assoc, hP2, mul_one] + rw [tensor_add_at V _ _ (diagSlot V r i) i] + · congr 1 + funext a + by_cases hai : a = i + · subst a + simp only [Function.update_self, dSlot, hSlot, diagSlot, + lt_irrefl, ite_false, ite_true, hDh] + · rw [Function.update_of_ne hai] + · intro a hai + by_cases hal : a < i + · simp [dSlot, hSlot, diagSlot, hal, hbefore] + · simp [dSlot, hSlot, diagSlot, hal, hai] + · intro a hai + by_cases hal : a < i + · simp only [dSlot, hSlot, diagSlot, hal, ite_true] + rw [mul_assoc, hP2, mul_one] + · simp [dSlot, hSlot, diagSlot, hal, hai] + + +theorem diagonal_sum (r : EndFamily (k := k) V) : + ∑ i, PiTensorProduct.map (diagSlot V r i) = 1 - PiTensorProduct.map r := by + let m := PiTensorProduct.mapMultilinear k V V + have H := m.map_piecewise_sub_map_piecewise r (1 : EndFamily (k := k) V) (1 : EndFamily (k := k) V) Finset.univ + simp only [Finset.piecewise_univ, Finset.mem_univ, ↓reduceIte] at H + have hn (i : ι) : m (fun j => if j < i then r j else if j = i then r j - 1 else 1) = + -PiTensorProduct.map (diagSlot V r i) := by + apply tensor_neg_at V _ _ i + · simp [diagSlot] + · intro j hji + simp [diagSlot, hji] + change m r - m (1 : EndFamily (k := k) V) = + ∑ i, m (fun j => if j < i then r j else if j = i then r j - 1 else 1) at H + simp_rw [hn] at H + change PiTensorProduct.map r - PiTensorProduct.map (1 : EndFamily (k := k) V) = _ at H + have hone : PiTensorProduct.map (1 : EndFamily (k := k) V) = 1 := PiTensorProduct.map_one + rw [hone, Finset.sum_neg_distrib] at H + apply neg_injective + rw [← H] + abel + + +theorem tensor_homotopy (P D r h : EndFamily (k := k) V) + (hP2 : ∀ i, P i * P i = 1) + (hDP : ∀ i, D i * P i = -(P i * D i)) + (hDr : ∀ i, D i * r i = r i * D i) + (hPr : ∀ i, P i * r i = r i * P i) + (hPh : ∀ i, P i * h i = -(h i * P i)) + (hDh : ∀ i, D i * h i + h i * D i = 1 - r i) : + differential V P D * homotopy V P r h + homotopy V P r h * differential V P D = + 1 - PiTensorProduct.map r := by + simp only [differential, homotopy, Finset.sum_mul, Finset.mul_sum] + rw [Finset.sum_comm (f := fun i j => + PiTensorProduct.map (dSlot V P D j) * PiTensorProduct.map (hSlot V P r h i)), + ← Finset.sum_add_distrib] + simp_rw [← Finset.sum_add_distrib] + have hsum (i : ι) : ∑ j, + (PiTensorProduct.map (dSlot V P D i) * PiTensorProduct.map (hSlot V P r h j) + + PiTensorProduct.map (hSlot V P r h j) * PiTensorProduct.map (dSlot V P D i)) = + PiTensorProduct.map (diagSlot V r i) := by + rw [Finset.sum_eq_single i] + · exact diagonal_term P D r h hP2 hPr hDh i + · intro j _ hji + exact mixed_cancel P D r h hDP hDr hPr hPh i j hji.symm + · simp + simp_rw [hsum] + exact diagonal_sum r + +end SignedTensor +end BoundaryOnly.FormalObstruction + +namespace BoundaryOnly.FormalObstruction.SignedTensor +open GlobalForms +open scoped TensorProduct BigOperators +variable {k : Type*} [Field k] {n : ℕ} +variable (V : Fin (n + 1) → Type*) [∀ i, AddCommGroup (V i)] [∀ i, Module k (V i)] + + + +theorem differential_cons_tprod (P D : EndFamily (k := k) V) (v : ∀ i, V i) : + tensorCons V (differential V P D (PiTensorProduct.tprod k v)) = + D 0 (v 0) ⊗ₜ[k] PiTensorProduct.tprod k (fun i : Fin n => v i.succ) + + P 0 (v 0) ⊗ₜ[k] differential (fun i : Fin n => V i.succ) + (fun i => P i.succ) (fun i => D i.succ) + (PiTensorProduct.tprod k (fun i : Fin n => v i.succ)) := by + simp only [differential, LinearMap.sum_apply, PiTensorProduct.map_tprod, map_sum, + tensorCons_tprod] + rw [Fin.sum_univ_succ, TensorProduct.tmul_sum] + simp only [dSlot, Fin.lt_def, Fin.ext_iff, Fin.val_zero, Fin.val_succ, + Nat.not_lt_zero, Nat.succ_ne_zero, Nat.zero_lt_succ, Nat.add_lt_add_iff_right, + Nat.add_right_cancel_iff, ite_false, ite_true, Module.End.one_apply] + +@[simp] theorem parity_cons_tprod (P : EndFamily (k := k) V) (v : ∀ i, V i) : + tensorCons V (PiTensorProduct.map P (PiTensorProduct.tprod k v)) = + P 0 (v 0) ⊗ₜ[k] PiTensorProduct.map (fun i : Fin n => P i.succ) + (PiTensorProduct.tprod k (fun i : Fin n => v i.succ)) := by + simp only [PiTensorProduct.map_tprod, tensorCons_tprod] + +end BoundaryOnly.FormalObstruction.SignedTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/SquareZero.lean b/lean/OAI/Algebra/FrobeniusObstruction/SquareZero.lean new file mode 100644 index 0000000000000000000000000000000000000000..d4f329645d5243bd167518c5e04ca1c2b38452bc --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/SquareZero.lean @@ -0,0 +1,384 @@ +import Mathlib + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace BoundaryOnly.FormalObstruction +namespace SquareZero +variable {k V : Type*} [Field k] [AddCommGroup V] [Module k V] +variable (δ : V →ₗ[k] V) (hδ : ∀ x, δ (δ x) = 0) + +abbrev Cycles := LinearMap.ker δ + +def boundaryMap : V →ₗ[k] Cycles δ := + δ.codRestrict (Cycles δ) (fun x => hδ x) + +def boundaries : Submodule k (Cycles δ) := (boundaryMap δ hδ).range + +abbrev Cohomology := (Cycles δ) ⧸ boundaries δ hδ + +def classMap : Cycles δ →ₗ[k] Cohomology δ hδ := (boundaries δ hδ).mkQ + +@[simp] theorem class_boundary (x : V) : + classMap δ hδ (boundaryMap δ hδ x) = 0 := by + change (Submodule.Quotient.mk (boundaryMap δ hδ x) : Cohomology δ hδ) = 0 + exact (Submodule.Quotient.mk_eq_zero _).mpr ⟨x, rfl⟩ + +theorem class_eq_zero (x : Cycles δ) : classMap δ hδ x = 0 ↔ ∃ y, δ y = x := by + change (Submodule.Quotient.mk x : Cohomology δ hδ) = 0 ↔ _ + rw [Submodule.Quotient.mk_eq_zero] + constructor + · rintro ⟨y, hy⟩ + exact ⟨y, congrArg Subtype.val hy⟩ + · rintro ⟨y, hy⟩ + exact ⟨y, Subtype.ext hy⟩ + +theorem classMap_surjective : Function.Surjective (classMap δ hδ) := + Submodule.mkQ_surjective _ + + + +def cycleMap (f g : V →ₗ[k] V) (hfg : ∀ x, δ (f x) = g (δ x)) : + Cycles δ →ₗ[k] Cycles δ := + (f.comp (Cycles δ).subtype).codRestrict (Cycles δ) (fun x => by + change δ (f (x : V)) = 0 + rw [hfg, x.property, map_zero]) + +@[simp] theorem cycleMap_val (f g : V →ₗ[k] V) (hfg : ∀ x, δ (f x) = g (δ x)) + (x : Cycles δ) : (cycleMap δ f g hfg x : V) = f x := rfl + +def induced (f g j : V →ₗ[k] V) + (hfg : ∀ x, δ (f x) = g (δ x)) (hfj : ∀ x, f (δ x) = δ (j x)) : + Cohomology δ hδ →ₗ[k] Cohomology δ hδ := + (boundaries δ hδ).mapQ (boundaries δ hδ) (cycleMap δ f g hfg) (by + rintro _ ⟨x, rfl⟩ + exact ⟨j x, Subtype.ext (hfj x).symm⟩) + +@[simp] theorem induced_class (f g j : V →ₗ[k] V) + (hfg : ∀ x, δ (f x) = g (δ x)) (hfj : ∀ x, f (δ x) = δ (j x)) + (x : Cycles δ) : + induced δ hδ f g j hfg hfj (classMap δ hδ x) = + classMap δ hδ (cycleMap δ f g hfg x) := rfl + + +theorem induced_ext (f g : Cohomology δ hδ →ₗ[k] Cohomology δ hδ) + (h : ∀ z : Cycles δ, f (classMap δ hδ z) = g (classMap δ hδ z)) : f = g := by + apply LinearMap.ext + intro x + obtain ⟨z, rfl⟩ := classMap_surjective δ hδ x + exact h z + +theorem induced_square_zero (f g j : V →ₗ[k] V) + (hfg : ∀ x, δ (f x) = g (δ x)) (hfj : ∀ x, f (δ x) = δ (j x)) + (hf : ∀ x, f (f x) = 0) (x : Cohomology δ hδ) : + induced δ hδ f g j hfg hfj (induced δ hδ f g j hfg hfj x) = 0 := by + obtain ⟨z, rfl⟩ := classMap_surjective δ hδ x + rw [induced_class, induced_class] + have hz : cycleMap δ f g hfg (cycleMap δ f g hfg z) = 0 := Subtype.ext (hf z) + rw [hz, map_zero] + + + +def oddInduced (D : V →ₗ[k] V) (hD : ∀ x, δ (D x) = -D (δ x)) : + Cohomology δ hδ →ₗ[k] Cohomology δ hδ := + induced δ hδ D (-D) (-D) hD (fun x => by + change D (δ x) = δ (-D x) + rw [map_neg, hD, neg_neg]) + +@[simp] theorem oddInduced_class (D : V →ₗ[k] V) (hD : ∀ x, δ (D x) = -D (δ x)) + (z : Cycles δ) : + oddInduced δ hδ D hD (classMap δ hδ z) = + classMap δ hδ (cycleMap δ D (-D) hD z) := rfl + +theorem oddInduced_square_zero (D : V →ₗ[k] V) (hD : ∀ x, δ (D x) = -D (δ x)) + (hDD : ∀ x, D (D x) = 0) (x : Cohomology δ hδ) : + oddInduced δ hδ D hD (oddInduced δ hδ D hD x) = 0 := + induced_square_zero δ hδ _ _ _ _ _ hDD x + + +def evenInduced (S : V →ₗ[k] V) (hS : ∀ x, δ (S x) = S (δ x)) : + Cohomology δ hδ →ₗ[k] Cohomology δ hδ := + induced δ hδ S S S hS (fun x => (hS x).symm) + +@[simp] theorem evenInduced_class (S : V →ₗ[k] V) (hS : ∀ x, δ (S x) = S (δ x)) + (z : Cycles δ) : + evenInduced δ hδ S hS (classMap δ hδ z) = + classMap δ hδ (cycleMap δ S S hS z) := rfl + + + +theorem correction_of_kernel (D S T : V →ₗ[k] V) + (hD : ∀ x, δ (D x) = -D (δ x)) + (hS : ∀ x, δ (S x) = S (δ x)) + (_ : ∀ x, δ (T x) = -T (δ x)) + (hDS : ∀ x, D (S x) - S (D x) = T x) + (x : Cycles δ) + (hSx : evenInduced δ hδ S hS (classMap δ hδ x) = 0) + (hSDx : evenInduced δ hδ S hS + (oddInduced δ hδ D hD (classMap δ hδ x)) = 0) : + ∃ y : V, δ y = -T x := by + rw [evenInduced_class] at hSx + obtain ⟨u, hu⟩ := (class_eq_zero δ hδ _).mp hSx + rw [oddInduced_class, evenInduced_class] at hSDx + obtain ⟨v, hv⟩ := (class_eq_zero δ hδ _).mp hSDx + change δ u = S x at hu + change δ v = S (D x) at hv + refine ⟨D u + v, ?_⟩ + rw [map_add, hD, hu, hv, ← hDS] + abel + +end SquareZero +end BoundaryOnly.FormalObstruction + +namespace BoundaryOnly.FormalObstruction.SquareZero +variable {k V : Type*} [Field k] [AddCommGroup V] [Module k V] + +private theorem generalized_inverse (S : V →ₗ[k] V) : + ∃ L : V →ₗ[k] V, ∀ x, S (L (S x)) = S x := by + obtain ⟨g,hg⟩ := S.rangeRestrict.exists_rightInverse_of_surjective S.range_rangeRestrict + obtain ⟨h,hh⟩ := S.range.subtype.exists_leftInverse_of_injective S.range.ker_subtype + refine ⟨g.comp h, fun x => ?_⟩ + have hx : h (S x) = S.rangeRestrict x := LinearMap.congr_fun hh (S.rangeRestrict x) + change S (g (h (S x))) = S x + rw [hx] + exact congrArg Subtype.val (LinearMap.congr_fun hg (S.rangeRestrict x)) + + + +theorem cohomology_contraction (δ : V →ₗ[k] V) (hδ : ∀ x, δ (δ x) = 0) : + ∃ (i : Cohomology δ hδ →ₗ[k] V) (p : V →ₗ[k] Cohomology δ hδ) (h : V →ₗ[k] V), + (∀ x, δ (i x) = 0) ∧ (∀ x, p (δ x) = 0) ∧ + (∀ x, p (i x) = x) ∧ + (∀ z : Cycles δ, p z = classMap δ hδ z) ∧ + (∀ x, x - i (p x) = δ (h x) + h (δ x)) := by + obtain ⟨g, hg⟩ := generalized_inverse δ + let q := LinearMap.id - δ.comp g - g.comp δ + have hq (x : V) : q x = x - δ (g x) - g (δ x) := rfl + have hδq (x : V) : δ (q x) = 0 := by + rw [hq, map_sub, map_sub, hδ, sub_zero, hg, sub_self] + have hqδ (x : V) : q (δ x) = 0 := by + rw [hq, hg, sub_self, hδ, map_zero, sub_zero] + let qz := q.codRestrict (Cycles δ) hδq + have hqz (z : Cycles δ) : + qz z = z - boundaryMap δ hδ (g z) := by + apply Subtype.ext + change q z = (z : V) - δ (g z) + rw [hq, z.property, map_zero, sub_zero] + obtain ⟨j, hj⟩ := (classMap δ hδ).exists_rightInverse_of_surjective + (LinearMap.range_eq_top.mpr (classMap_surjective δ hδ)) + have hj' (x : Cohomology δ hδ) : classMap δ hδ (j x) = x := + LinearMap.congr_fun hj x + let i := (Cycles δ).subtype.comp j + let p := (classMap δ hδ).comp qz + have hpz (z : Cycles δ) : p z = classMap δ hδ z := by + change classMap δ hδ (qz z) = _ + rw [hqz, map_sub, class_boundary, sub_zero] + have hpδ (x : V) : p (δ x) = 0 := by + change classMap δ hδ (qz (δ x)) = 0 + have hz : qz (δ x) = 0 := Subtype.ext (hqδ x) + rw [hz, map_zero] + let K : V →ₗ[k] boundaries δ hδ := + (qz - j.comp p).codRestrict (boundaries δ hδ) (fun x => by + apply (Submodule.Quotient.mk_eq_zero _).mp + change classMap δ hδ (qz x - j (p x)) = 0 + rw [map_sub, hj'] + exact sub_self _) + obtain ⟨b, hb⟩ := (boundaryMap δ hδ).rangeRestrict.exists_rightInverse_of_surjective + (boundaryMap δ hδ).range_rangeRestrict + let b' : boundaries δ hδ →ₗ[k] V := b + let h₁ := b'.comp K + have hh₁ (x : V) : δ (h₁ x) = q x - i (p x) := + congrArg (fun z : boundaries δ hδ => ((z : Cycles δ) : V)) + (LinearMap.congr_fun hb (K x)) + have hKδ (x : V) : K (δ x) = 0 := by + apply Subtype.ext + apply Subtype.ext + change q (δ x) - i (p (δ x)) = 0 + rw [hqδ, hpδ, map_zero, sub_zero] + refine ⟨i, p, g + h₁, ?_, hpδ, ?_, hpz, ?_⟩ + · intro x; exact (j x).property + · intro x; exact (hpz (j x)).trans (hj' x) + · intro x + have hz : h₁ (δ x) = 0 := by change b' (K (δ x)) = 0; rw [hKδ, map_zero] + simp only [LinearMap.add_apply, map_add, hh₁, hz, add_zero] + rw [hq] + abel + +end BoundaryOnly.FormalObstruction.SquareZero + +namespace BoundaryOnly.FormalObstruction.SquareZero +variable {k V : Type*} [Field k] [AddCommGroup V] [Module k V] + + +theorem odd_generalized_inverse (htwo : (2 : k) ≠ 0) + (δ P : V →ₗ[k] V) (hPP : ∀ x, P (P x) = x) + (hDP : ∀ x, δ (P x) = -P (δ x)) : + ∃ g : V →ₗ[k] V, (∀ x, δ (g (δ x)) = δ x) ∧ + (∀ x, g (P x) = -P (g x)) := by + obtain ⟨g,hg⟩ := generalized_inverse δ + let c : k := (2 : k)⁻¹ + have hc : c+c = 1 := by dsimp [c]; field_simp; ring + let g' : V →ₗ[k] V := c • (g - P.comp (g.comp P)) + have hg' (x : V) : g' x = c • (g x - P (g (P x))) := rfl + refine ⟨g', ?_, ?_⟩ + · intro x + have hpd : P (δ x) = -δ (P x) := by rw [hDP, neg_neg] + rw [hg', map_smul, map_sub, hg, hDP (g (P (δ x))), hpd] + simp only [map_neg] + rw [hg, hDP] + simp only [map_neg, hPP, neg_neg, sub_neg_eq_add] + rw [smul_add, ← add_smul, hc, one_smul] + · intro x + simp only [hg', map_smul, map_sub, hPP] + module + + +theorem odd_homotopy (htwo : (2 : k) ≠ 0) + (δ P r h : V →ₗ[k] V) (hPP : ∀ x, P (P x) = x) + (hDP : ∀ x, δ (P x) = -P (δ x)) + (hrP : ∀ x, r (P x) = P (r x)) + (hrh : ∀ x, x - r x = δ (h x) + h (δ x)) : + ∃ h' : V →ₗ[k] V, + (∀ x, h' (P x) = -P (h' x)) ∧ + (∀ x, x - r x = δ (h' x) + h' (δ x)) := by + let c : k := (2 : k)⁻¹ + have hc : c+c = 1 := by dsimp [c]; field_simp; ring + let h' : V →ₗ[k] V := c • (h - P.comp (h.comp P)) + have hh' (x : V) : h' x = c • (h x - P (h (P x))) := rfl + have hPD (x : V) : P (δ x) = -δ (P x) := by rw [hDP, neg_neg] + refine ⟨h', ?_, ?_⟩ + · intro x + simp only [hh', map_smul, map_sub, hPP] + module + · intro x + have h₂ := congrArg P (hrh (P x)) + simp only [map_sub, map_add, hrP, hPP] at h₂ + rw [hPD (h (P x)), hDP x, map_neg, map_neg] at h₂ + rw [hh', hh'] + simp only [map_smul, map_sub] + calc + x - r x = c • (x - r x) + c • (x - r x) := by + rw [← add_smul, hc, one_smul] + _ = c • (δ (h x) + h (δ x)) + + c • (-δ (P (h (P x))) - P (h (P (δ x)))) := by + conv_lhs => arg 1; rw [hrh] + congr 1 + exact congrArg (c • ·) (by simpa only [sub_eq_add_neg] using h₂) + _ = _ := by module + +end BoundaryOnly.FormalObstruction.SquareZero + +namespace BoundaryOnly.FormalObstruction.SquareZero +variable {k V W : Type*} [Field k] [AddCommGroup V] [Module k V] + [AddCommGroup W] [Module k W] + +private theorem equivariant_section (htwo : (2 : k) ≠ 0) + (f : V →ₗ[k] W) (hf : Function.Surjective f) + (P : V →ₗ[k] V) (Q : W →ₗ[k] W) + (hPP : ∀ x, P (P x) = x) (hQQ : ∀ x, Q (Q x) = x) + (hfP : ∀ x, f (P x) = Q (f x)) : + ∃ j : W →ₗ[k] V, (∀ x, f (j x) = x) ∧ (∀ x, j (Q x) = P (j x)) := by + obtain ⟨j,hj⟩ := f.exists_rightInverse_of_surjective (LinearMap.range_eq_top.mpr hf) + have hj' (x : W) : f (j x) = x := LinearMap.congr_fun hj x + let c : k := (2 : k)⁻¹ + have hc : c+c = 1 := by dsimp [c]; field_simp; ring + let j' : W →ₗ[k] V := c • (j + P.comp (j.comp Q)) + have hj'val (x : W) : j' x = c • (j x + P (j (Q x))) := rfl + refine ⟨j', ?_, ?_⟩ + · intro x + simp only [hj'val, map_smul, map_add, hfP, hj', hQQ] + rw [smul_add, ← add_smul, hc, one_smul] + · intro x + simp only [hj'val, map_smul, map_add, hPP, hQQ] + module + + + +theorem parity_cohomology_contraction (htwo : (2 : k) ≠ 0) + (δ P : V →ₗ[k] V) (hδ : ∀ x, δ (δ x) = 0) + (hPP : ∀ x, P (P x) = x) (hDP : ∀ x, δ (P x) = -P (δ x)) : + ∃ (i : Cohomology δ hδ →ₗ[k] V) (p : V →ₗ[k] Cohomology δ hδ) + (h : V →ₗ[k] V), + (∀ x, δ (i x) = 0) ∧ (∀ x, p (δ x) = 0) ∧ + (∀ x, p (i x) = x) ∧ + (∀ z : Cycles δ, p z = classMap δ hδ z) ∧ + (∀ x, i (oddInduced δ hδ P hDP x) = P (i x)) ∧ + (∀ x, p (P x) = oddInduced δ hδ P hDP (p x)) ∧ + (∀ x, h (P x) = -P (h x)) ∧ + (∀ x, x - i (p x) = δ (h x) + h (δ x)) := by + let PZ := cycleMap δ P (-P) hDP + let PH := oddInduced δ hδ P hDP + have hPZ (x : Cycles δ) : PZ (PZ x) = x := Subtype.ext (hPP x) + have hclP (z : Cycles δ) : classMap δ hδ (PZ z) = PH (classMap δ hδ z) := rfl + have hPH (x : Cohomology δ hδ) : PH (PH x) = x := by + obtain ⟨z, rfl⟩ := classMap_surjective δ hδ x + rw [← hclP, ← hclP, hPZ] + obtain ⟨j,hj',hjP⟩ := equivariant_section htwo (classMap δ hδ) + (classMap_surjective δ hδ) PZ PH hPZ hPH hclP + obtain ⟨g,hg,hgP⟩ := odd_generalized_inverse htwo δ P hPP hDP + let q := LinearMap.id - δ.comp g - g.comp δ + have hq (x : V) : q x = x - δ (g x) - g (δ x) := rfl + have hδq (x : V) : δ (q x) = 0 := by + rw [hq, map_sub, map_sub, hδ, sub_zero, hg, sub_self] + have hqδ (x : V) : q (δ x) = 0 := by + rw [hq, hg, sub_self, hδ, map_zero, sub_zero] + have hqP (x : V) : q (P x) = P (q x) := by + simp only [hq, hgP, hDP, map_sub, map_neg, neg_neg] + let qz := q.codRestrict (Cycles δ) hδq + have hqz (z : Cycles δ) : qz z = z - boundaryMap δ hδ (g z) := by + apply Subtype.ext + change q z = (z : V) - δ (g z) + rw [hq, z.property, map_zero, sub_zero] + let i := (Cycles δ).subtype.comp j + let p := (classMap δ hδ).comp qz + have hpz (z : Cycles δ) : p z = classMap δ hδ z := by + change classMap δ hδ (qz z) = _ + rw [hqz, map_sub, class_boundary, sub_zero] + have hpδ (x : V) : p (δ x) = 0 := by + change classMap δ hδ (qz (δ x)) = 0 + have hz : qz (δ x) = 0 := Subtype.ext (hqδ x) + rw [hz, map_zero] + have hiP (x : Cohomology δ hδ) : i (PH x) = P (i x) := + congrArg Subtype.val (hjP x) + have hpP (x : V) : p (P x) = PH (p x) := by + change classMap δ hδ (qz (P x)) = PH (classMap δ hδ (qz x)) + rw [← hclP] + exact congrArg (classMap δ hδ) (Subtype.ext (hqP x)) + let K : V →ₗ[k] boundaries δ hδ := + (qz - j.comp p).codRestrict (boundaries δ hδ) (fun x => by + apply (Submodule.Quotient.mk_eq_zero _).mp + change classMap δ hδ (qz x - j (p x)) = 0 + rw [map_sub, hj'] + exact sub_self _) + obtain ⟨b, hb⟩ := (boundaryMap δ hδ).rangeRestrict.exists_rightInverse_of_surjective + (boundaryMap δ hδ).range_rangeRestrict + let b' : boundaries δ hδ →ₗ[k] V := b + let h₁ := b'.comp K + have hh₁ (x : V) : δ (h₁ x) = q x - i (p x) := + congrArg (fun z : boundaries δ hδ => ((z : Cycles δ) : V)) + (LinearMap.congr_fun hb (K x)) + have hKδ (x : V) : K (δ x) = 0 := by + apply Subtype.ext + apply Subtype.ext + change q (δ x) - i (p (δ x)) = 0 + rw [hqδ, hpδ, map_zero, sub_zero] + have hraw (x : V) : x - i (p x) = δ ((g+h₁) x) + (g+h₁) (δ x) := by + have hz : h₁ (δ x) = 0 := by change b' (K (δ x)) = 0; rw [hKδ, map_zero] + simp only [LinearMap.add_apply, map_add, hh₁, hz, add_zero] + rw [hq] + abel + have hrP (x : V) : (i.comp p) (P x) = P ((i.comp p) x) := by + change i (p (P x)) = P (i (p x)) + rw [hpP, hiP] + obtain ⟨h,hhP,hhh⟩ := odd_homotopy htwo δ P (i.comp p) (g+h₁) hPP hDP hrP hraw + refine ⟨i,p,h,?_,hpδ,?_,hpz,hiP,hpP,hhP,hhh⟩ + · intro x; exact (j x).property + · intro x; exact (hpz (j x)).trans (hj' x) + +end BoundaryOnly.FormalObstruction.SquareZero + +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/TangentCharts.lean b/lean/OAI/Algebra/FrobeniusObstruction/TangentCharts.lean new file mode 100644 index 0000000000000000000000000000000000000000..e9958239df8ea9e3d1f792e30c738a284ae3d5f8 --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/TangentCharts.lean @@ -0,0 +1,221 @@ +import Mathlib +import OAI.Algebra.FrobeniusObstruction.FormalData + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace BoundaryOnly.FormalObstruction.Frobenius +variable {ι κ k : Type*} [Fintype ι] [DecidableEq ι] + [Fintype κ] [DecidableEq κ] [Field k] +variable (ell : ℕ) (htwo : 1 < ell) [CharP k ell] + +theorem tangentCoeff_eq_augmentation_partial (i : ι) (x : Ring (ι := ι) (k := k) ell) : + tangentCoeff ell htwo i x = augmentation ell (by omega) (partialDeriv ell i x) := by + obtain ⟨p, rfl⟩ := Ideal.Quotient.mk_surjective x + rw [tangentCoeff_mk, partial_mk] + change _ = MvPowerSeries.constantCoeff (MvPowerSeries.pderiv i p) + rw [← MvPowerSeries.coeff_zero_eq_constantCoeff, MvPowerSeries.coeff_pderiv] + simp + +omit [DecidableEq κ] [CharP k ell] in +theorem augmentation_natural (f : Ring (ι := ι) (k := k) ell →ₐ[k] + Ring (ι := κ) (k := k) ell) : + (augmentation ell (by omega)).comp f = augmentation ell (by omega) := by + apply algHom_ext + intro i + rw [AlgHom.comp_apply, augmentation_coordinate] + apply eq_zero_of_pow_eq_zero (n := ell) + rw [← map_pow, ← map_pow, coordinate_pow, map_zero, map_zero] + +theorem tangentCoeff_chain_rule (f : Ring (ι := ι) (k := k) ell →ₐ[k] + Ring (ι := κ) (k := k) ell) (j : κ) (x : Ring (ι := ι) (k := k) ell) : + tangentCoeff ell htwo j (f x) = ∑ i, tangentCoeff ell htwo i x * + tangentCoeff ell htwo j (f (coordinate ell i)) := by + rw [tangentCoeff_eq_augmentation_partial, partial_chain_rule, map_sum] + apply Finset.sum_congr rfl + intro i _ + rw [map_mul, ← tangentCoeff_eq_augmentation_partial, + ← AlgHom.comp_apply, augmentation_natural ell htwo f, ← tangentCoeff_eq_augmentation_partial] + +end BoundaryOnly.FormalObstruction.Frobenius + +namespace BoundaryOnly.FormalObstruction +variable {k : Type*} [Field k] {d : ℕ} {n : Fin d → ℕ} +variable (ell : ℕ) (htwo : 1 < ell) [CharP k ell] [Fact ell.Prime] +open Frobenius + + +theorem graph_constant_zero (D : FormalData (k := k) n) (c : InternalVar n) : + MvPowerSeries.constantCoeff (D.Y c) = 0 := by + have h : originIdeal k (GraphVar n) ≤ RingHom.ker MvPowerSeries.constantCoeff := by + apply Ideal.span_le.mpr + rintro _ ⟨i, rfl⟩ + simp + exact h (D.centered c) + + + +def graphSlot (b : Bool) : Frobenius.Ring (ι := GraphVar n) (k := k) ell →ₐ[k] + Frobenius.Ring (ι := InternalVar n) (k := k) ell := + eval ell (fun v => match v with + | .inl _ => 0 + | .inr t => coordinate ell (b,t)) (by + intro v + cases v with + | inl a => exact zero_pow (Nat.Prime.ne_zero Fact.out) + | inr t => exact coordinate_pow ell (b,t)) + +omit [CharP k ell] in +@[simp] theorem graphSlot_slope (b : Bool) (a : SlopeVar d) : + graphSlot (n := n) (k := k) ell b (coordinate ell (.inl a)) = 0 := + eval_coordinate ell _ _ _ + +omit [CharP k ell] in +@[simp] theorem graphSlot_tangent (b : Bool) (t : TangentVar n) : + graphSlot (k := k) ell b (coordinate ell (.inr t)) = coordinate ell (b,t) := + eval_coordinate ell _ _ _ + + +def fixedComplement (D : FormalData (k := k) n) (c : InternalVar n) : + Frobenius.Ring (ι := InternalVar n) (k := k) ell := + ∑ t : TangentVar n, tangentMatrix n D.Y (swapBlocks n c) t • coordinate ell (true,t) + +omit [CharP k ell] in +@[simp] theorem fixedComplement_augmentation (D : FormalData (k := k) n) (c : InternalVar n) : + augmentation ell (Nat.Prime.pos Fact.out) (fixedComplement ell D c) = 0 := by + simp [fixedComplement] + +theorem fixedComplement_pow (D : FormalData (k := k) n) (c : InternalVar n) : + fixedComplement ell D c ^ ell = 0 := by + apply frobenius_zero_of_constant + change (augmentation ell (Nat.Prime.pos Fact.out) (fixedComplement ell D c)) ^ ell = 0 + rw [fixedComplement_augmentation, zero_pow (Nat.Prime.ne_zero Fact.out)] + +def specialChartCoordinate (D : FormalData (k := k) n) (c : InternalVar n) : + Frobenius.Ring (ι := InternalVar n) (k := k) ell := + graphSlot ell false (Ideal.Quotient.mk _ (D.Y c)) + fixedComplement ell D c + +theorem specialChartCoordinate_pow (D : FormalData (k := k) n) (c : InternalVar n) : + specialChartCoordinate ell D c ^ ell = 0 := by + have h (c : InternalVar n) : + (Ideal.Quotient.mk (powerIdeal (k := k) ell) (D.Y c)) ^ ell = 0 := by + apply frobenius_zero_of_constant + rw [constantHom_mk, graph_constant_zero D c] + exact zero_pow (Nat.Prime.ne_zero Fact.out) + let : CharP (Frobenius.Ring (ι := InternalVar n) (k := k) ell) ell := + quotient_charP (Nat.Prime.pos Fact.out) + have hslot : + (graphSlot ell false (Ideal.Quotient.mk _ (D.Y c))) ^ ell = 0 := by + rw [← map_pow, h, map_zero] + rw [specialChartCoordinate, add_pow_char, hslot, fixedComplement_pow, zero_add] + + +def specialChart (D : FormalData (k := k) n) : + Frobenius.Ring (ι := InternalVar n) (k := k) ell →ₐ[k] + Frobenius.Ring (ι := InternalVar n) (k := k) ell := + eval ell (specialChartCoordinate ell D) (specialChartCoordinate_pow ell D) + +@[simp] theorem specialChart_coordinate (D : FormalData (k := k) n) (c : InternalVar n) : + specialChart ell D (coordinate ell c) = specialChartCoordinate ell D c := + eval_coordinate ell _ _ _ + +theorem graphSlot_tangentCoeff (b : Bool) (j : InternalVar n) + (x : Frobenius.Ring (ι := GraphVar n) (k := k) ell) : + tangentCoeff ell htwo j (graphSlot ell b x) = + if j.1 = b then tangentCoeff ell htwo (.inr j.2) x else 0 := by + rw [tangentCoeff_chain_rule] + rw [Fintype.sum_sum_type] + simp only [graphSlot_slope, map_zero, mul_zero, Finset.sum_const_zero, zero_add, + graphSlot_tangent, tangentCoeff_coordinate] + obtain ⟨b', t⟩ := j + by_cases hb : b' = b + · subst b' + simp only [Prod.mk.injEq, true_and, mul_ite, mul_one, mul_zero, Finset.sum_ite_eq, + Finset.mem_univ, ite_true] + · simp only [Prod.mk.injEq, hb, false_and, ite_false, mul_zero, Finset.sum_const_zero] + +omit [CharP k ell] [Fact (Nat.Prime ell)] in +theorem fixedComplement_tangentCoeff (D : FormalData (k := k) n) + (c j : InternalVar n) : + tangentCoeff ell htwo j (fixedComplement ell D c) = + if j.1 then tangentMatrix n D.Y (swapBlocks n c) j.2 else 0 := by + unfold fixedComplement + simp only [map_sum, map_smul, tangentCoeff_coordinate, smul_eq_mul] + obtain ⟨b,t⟩ := j + cases b <;> simp + +theorem specialChart_tangent_matrix (D : FormalData (k := k) n) : + (fun i j => tangentCoeff ell htwo j (specialChart ell D (coordinate ell i))) = + complementaryMatrix n D.Y := by + funext i j + rw [specialChart_coordinate, specialChartCoordinate, map_add, + graphSlot_tangentCoeff, fixedComplement_tangentCoeff] + have h (c : InternalVar n) : tangentCoeff ell htwo (.inr j.2) + (Ideal.Quotient.mk (powerIdeal (k := k) ell) (D.Y c)) = tangentMatrix n D.Y c j.2 := by + rw [tangentCoeff_eq_augmentation_partial, partial_mk] + rfl + rw [h] + obtain ⟨b,t⟩ := j + cases b <;> simp [complementaryMatrix] + +include htwo in +theorem specialChart_bijective (D : FormalData (k := k) n) : + Function.Bijective (specialChart ell D) := by + apply bijective_of_tangent_matrix ell htwo + rw [specialChart_tangent_matrix] + exact isUnit_iff_ne_zero.mpr D.complementary + +def specialChartEquiv (D : FormalData (k := k) n) : + Frobenius.Ring (ι := InternalVar n) (k := k) ell ≃ₐ[k] + Frobenius.Ring (ι := InternalVar n) (k := k) ell := + AlgEquiv.ofBijective (specialChart ell D) (specialChart_bijective ell htwo D) + +end BoundaryOnly.FormalObstruction + +namespace BoundaryOnly.FormalObstruction.Frobenius +variable {ι k : Type*} [Fintype ι] [DecidableEq ι] [Field k] +variable (ell : ℕ) (htwo : 1 < ell) [CharP k ell] + +def tangentJacobian (f : Ring (ι := ι) (k := k) ell →ₐ[k] Ring (ι := ι) (k := k) ell) : + Matrix ι ι k := fun i j => tangentCoeff ell htwo j (f (coordinate ell i)) + +theorem tangentJacobian_comp + (f g : Ring (ι := ι) (k := k) ell →ₐ[k] Ring (ι := ι) (k := k) ell) : + tangentJacobian ell htwo (f.comp g) = + tangentJacobian ell htwo g * tangentJacobian ell htwo f := by + ext i j + exact tangentCoeff_chain_rule ell htwo f j (g (coordinate ell i)) + +omit [CharP k ell] in +@[simp] theorem tangentJacobian_id : + tangentJacobian (ι := ι) (k := k) ell htwo (AlgHom.id k _) = 1 := by + ext i j + simp only [tangentJacobian, AlgHom.id_apply, tangentCoeff_coordinate, Matrix.one_apply] + by_cases h : i = j + · subst j; simp only [ite_true] + · rw [ite_eq_right (Ne.symm h), ite_eq_right h] + + + +theorem tangentJacobian_det_unit + (f : Ring (ι := ι) (k := k) ell ≃ₐ[k] Ring (ι := ι) (k := k) ell) : + IsUnit (tangentJacobian ell htwo f.toAlgHom).det := by + have he : f.symm.toAlgHom.comp f.toAlgHom = AlgHom.id k _ := by + ext x + exact f.symm_apply_apply x + have hm := tangentJacobian_comp ell htwo f.symm.toAlgHom f.toAlgHom + rw [he, tangentJacobian_id] at hm + have hd := congrArg Matrix.det hm + rw [Matrix.det_one, Matrix.det_mul] at hd + apply isUnit_iff_ne_zero.mpr + intro h + rw [h, zero_mul] at hd + exact one_ne_zero hd + +end BoundaryOnly.FormalObstruction.Frobenius + +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/TensorCohomology.lean b/lean/OAI/Algebra/FrobeniusObstruction/TensorCohomology.lean new file mode 100644 index 0000000000000000000000000000000000000000..31695b5fe71509ea8340f078400aff1f5777dab6 --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/TensorCohomology.lean @@ -0,0 +1,149 @@ +import Mathlib +import OAI.Algebra.FrobeniusObstruction.SignedTensor +import OAI.Algebra.FrobeniusObstruction.BlockCohomology + +namespace OAI + +noncomputable section +open scoped BigOperators TensorProduct + +namespace BoundaryOnly.FormalObstruction.SignedTensor +variable {k ι : Type*} [Field k] [Fintype ι] [LinearOrder ι] +variable {V W : ι → Type*} [∀ i, AddCommGroup (V i)] [∀ i, Module k (V i)] + [∀ i, AddCommGroup (W i)] [∀ i, Module k (W i)] + + + +omit [Fintype ι] in +theorem tensor_map_zero_at (f : ∀ i, V i →ₗ[k] W i) (i : ι) (hi : f i = 0) : + PiTensorProduct.map f = 0 := by + have hf : f = Function.update f i 0 := (Function.update_eq_self_iff.mpr hi.symm).symm + rw [hf] + exact (PiTensorProduct.mapMultilinear k V W).map_update_zero f i + + +theorem representatives_cycles (P D : EndFamily (k := k) V) + (j : ∀ i, W i →ₗ[k] V i) (hj : ∀ i, (D i).comp (j i) = 0) : + (differential V P D).comp (PiTensorProduct.map j) = 0 := by + change (∑ i, PiTensorProduct.map (dSlot V P D i)).comp (PiTensorProduct.map j) = 0 + rw [show (∑ i, PiTensorProduct.map (dSlot V P D i)).comp (PiTensorProduct.map j) = + ∑ i, (PiTensorProduct.map (dSlot V P D i)).comp (PiTensorProduct.map j) from by + ext x; simp] + apply Finset.sum_eq_zero + intro i _ + rw [← PiTensorProduct.map_comp] + apply tensor_map_zero_at _ i + simpa [dSlot] using hj i + + +theorem projection_boundaries (P D : EndFamily (k := k) V) + (p : ∀ i, V i →ₗ[k] W i) (hp : ∀ i, (p i).comp (D i) = 0) : + (PiTensorProduct.map p).comp (differential V P D) = 0 := by + change (PiTensorProduct.map p).comp (∑ i, PiTensorProduct.map (dSlot V P D i)) = 0 + rw [show (PiTensorProduct.map p).comp (∑ i, PiTensorProduct.map (dSlot V P D i)) = + ∑ i, (PiTensorProduct.map p).comp (PiTensorProduct.map (dSlot V P D i)) from by + ext x; simp] + apply Finset.sum_eq_zero + intro i _ + rw [← PiTensorProduct.map_comp] + apply tensor_map_zero_at _ i + simpa [dSlot] using hp i + + + + +theorem tensor_cycle_decomposition (P D : EndFamily (k := k) V) + (j : ∀ i, W i →ₗ[k] V i) (p : ∀ i, V i →ₗ[k] W i) + (h : EndFamily (k := k) V) + (hP2 : ∀ i, P i * P i = 1) (hDP : ∀ i, D i * P i = -(P i * D i)) + (hDj : ∀ i, (D i).comp (j i) = 0) (hpD : ∀ i, (p i).comp (D i) = 0) + (hjP : ∀ i, P i * ((j i).comp (p i)) = ((j i).comp (p i)) * P i) + (hPh : ∀ i, P i * h i = -(h i * P i)) + (hDh : ∀ i, D i * h i + h i * D i = 1 - ((j i).comp (p i))) + (z : ⨂[k] i, V i) (hz : differential V P D z = 0) : + ∃ y : ⨂[k] i, V i, + z - PiTensorProduct.map j (PiTensorProduct.map p z) = differential V P D y := by + let r : EndFamily (k := k) V := fun i => (j i).comp (p i) + have hdr (i : ι) : D i * r i = r i * D i := by + change (D i).comp ((j i).comp (p i)) = ((j i).comp (p i)).comp (D i) + rw [← LinearMap.comp_assoc, hDj, LinearMap.zero_comp, + LinearMap.comp_assoc, hpD, LinearMap.comp_zero] + have H := tensor_homotopy P D r h hP2 hDP hdr hjP hPh hDh + have He := LinearMap.congr_fun H z + simp only [Module.End.mul_apply, LinearMap.add_apply, LinearMap.sub_apply, + Module.End.one_apply, hz, map_zero, add_zero] at He + refine ⟨homotopy V P r h z, ?_⟩ + change z - ((PiTensorProduct.map j).comp (PiTensorProduct.map p)) z = _ + rw [← PiTensorProduct.map_comp] + exact He.symm + + + +theorem tensor_representatives_injective_mod_boundaries (P D : EndFamily (k := k) V) + (j : ∀ i, W i →ₗ[k] V i) (p : ∀ i, V i →ₗ[k] W i) + (hpj : ∀ i, (p i).comp (j i) = LinearMap.id) + (hpD : ∀ i, (p i).comp (D i) = 0) + (w : ⨂[k] i, W i) (z : ⨂[k] i, V i) + (hwz : PiTensorProduct.map j w = differential V P D z) : w = 0 := by + have h := congrArg (PiTensorProduct.map p) hwz + have hpj' : (PiTensorProduct.map p).comp (PiTensorProduct.map j) = LinearMap.id := by + rw [← PiTensorProduct.map_comp] + simpa only [hpj] using (PiTensorProduct.map_id (R := k) (s := W)) + change ((PiTensorProduct.map p).comp (PiTensorProduct.map j)) w = + ((PiTensorProduct.map p).comp (differential V P D)) z at h + rw [hpj', projection_boundaries P D p hpD] at h + exact h + +end BoundaryOnly.FormalObstruction.SignedTensor + +namespace BoundaryOnly.FormalObstruction.SignedTensor +variable {k ι : Type*} [Field k] [Fintype ι] [LinearOrder ι] +variable {V W : ι → Type*} [∀ i, AddCommGroup (V i)] [∀ i, Module k (V i)] + [∀ i, AddCommGroup (W i)] [∀ i, Module k (W i)] + + + +theorem project_differential (P D : EndFamily (k := k) V) + (Q E : EndFamily (k := k) W) + (j : ∀ i, W i →ₗ[k] V i) (p : ∀ i, V i →ₗ[k] W i) + (hpj : ∀ i, (p i).comp (j i) = LinearMap.id) + (hP : ∀ i, (p i).comp ((P i).comp (j i)) = Q i) + (hD : ∀ i, (p i).comp ((D i).comp (j i)) = E i) : + (PiTensorProduct.map p).comp ((differential V P D).comp (PiTensorProduct.map j)) = + differential W Q E := by + apply PiTensorProduct.ext + ext v + simp only [LinearMap.compMultilinearMap_apply, LinearMap.comp_apply, + differential, LinearMap.sum_apply, PiTensorProduct.map_tprod, map_sum] + apply Finset.sum_congr rfl + intro i _ + congr 1 + funext a + change p a (dSlot V P D i a (j a (v a))) = dSlot W Q E i a (v a) + by_cases hlt : a < i + · simp only [dSlot, ite_eq_left hlt] + exact LinearMap.congr_fun (hP a) (v a) + · by_cases heq : a = i + · simp only [dSlot, ite_eq_right hlt, ite_eq_left heq] + exact LinearMap.congr_fun (hD a) (v a) + · simp only [dSlot, ite_eq_right hlt, ite_eq_right heq, Module.End.one_apply] + exact LinearMap.congr_fun (hpj a) (v a) + + + +omit [Fintype ι] [LinearOrder ι] in +theorem project_tensor_map (S : EndFamily (k := k) V) (T : EndFamily (k := k) W) + (j : ∀ i, W i →ₗ[k] V i) (p : ∀ i, V i →ₗ[k] W i) + (hS : ∀ i, (p i).comp ((S i).comp (j i)) = T i) : + (PiTensorProduct.map p).comp ((PiTensorProduct.map S).comp (PiTensorProduct.map j)) = + PiTensorProduct.map T := by + rw [← PiTensorProduct.map_comp, ← PiTensorProduct.map_comp] + congr 1 + funext i + exact hS i + +end BoundaryOnly.FormalObstruction.SignedTensor + +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/TensorKernels.lean b/lean/OAI/Algebra/FrobeniusObstruction/TensorKernels.lean new file mode 100644 index 0000000000000000000000000000000000000000..60ce69926887e64e7766dee8c64591e6f3c3ce3c --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/TensorKernels.lean @@ -0,0 +1,225 @@ +import Mathlib +import OAI.Algebra.FrobeniusObstruction.TensorCohomology +import OAI.Algebra.FrobeniusObstruction.CycleTransfer + +namespace OAI + +noncomputable section +open scoped BigOperators TensorProduct + +namespace BoundaryOnly.FormalObstruction + +variable {k : Type*} [Field k] + +private theorem generalized_inverse {V : Type*} [AddCommGroup V] [Module k V] + (S : V →ₗ[k] V) : ∃ L : V →ₗ[k] V, ∀ x, S (L (S x)) = S x := by + obtain ⟨g,hg⟩ := S.rangeRestrict.exists_rightInverse_of_surjective S.range_rangeRestrict + obtain ⟨h,hh⟩ := S.range.subtype.exists_leftInverse_of_injective S.range.ker_subtype + refine ⟨g.comp h, fun x => ?_⟩ + have hx : h (S x) = S.rangeRestrict x := + LinearMap.congr_fun hh (S.rangeRestrict x) + change S (g (h (S x))) = S x + rw [hx] + exact congrArg Subtype.val (LinearMap.congr_fun hg (S.rangeRestrict x)) + +variable {ι : Type*} [Fintype ι] [DecidableEq ι] +variable (V : ι → Type*) [∀ i, AddCommGroup (V i)] [∀ i, Module k (V i)] + + + +def kernelTensorSpace (S : ∀ i, V i →ₗ[k] V i) (J : Finset ι) : + Submodule k (⨂[k] i, V i) := + Submodule.span k {z | ∃ m : ∀ i, V i, + (∀ i ∈ J, S i (m i) = 0) ∧ PiTensorProduct.tprod k m = z} + + +def tensorAction (S : ∀ i, V i →ₗ[k] V i) (I : Finset ι) : + (⨂[k] i, V i) →ₗ[k] (⨂[k] i, V i) := + PiTensorProduct.map fun i => if i ∈ I then S i else LinearMap.id + + + + +theorem joint_tensor_kernel (S : ∀ i, V i →ₗ[k] V i) (active : Finset ι) : + (⨅ (I : Finset ι) (_ : I ⊆ active) (_ : I.card = 3), + LinearMap.ker (tensorAction V S I)) = + (⨆ (J : Finset ι) (_ : J ⊆ active) (_ : (active \ J).card ≤ 2), + kernelTensorSpace V S J) := by + classical + let R := ⨆ (J : Finset ι) (_ : J ⊆ active) (_ : (active \ J).card ≤ 2), + kernelTensorSpace V S J + have hR (J : Finset ι) (hJ : J ⊆ active) (hc : (active \ J).card ≤ 2) : + kernelTensorSpace V S J ≤ R := le_iSup_of_le J (le_iSup_of_le hJ (le_iSup_of_le hc le_rfl)) + apply le_antisymm + · intro x hx + have hz (I : Finset ι) (hI : I ⊆ active) (hcard : I.card = 3) : + tensorAction V S I x = 0 := by + exact ((Submodule.mem_iInf _).mp ((Submodule.mem_iInf _).mp ((Submodule.mem_iInf _).mp hx I) hI) hcard) + choose L hL using fun i => generalized_inverse (S i) + let Q (i : ι) := (L i).comp (S i) + let P (i : ι) := LinearMap.id - Q i + have hSP (i : ι) (v : V i) : S i (P i v) = 0 := by + change S i (v - L i (S i v)) = 0 + rw [map_sub, hL, sub_self] + let F (A : Finset ι) := PiTensorProduct.map fun i => if i ∈ A then Q i else P i + have hsum : ∑ A : Finset ι, F A = LinearMap.id := by + apply PiTensorProduct.ext + ext m + simp only [LinearMap.compMultilinearMap_apply, LinearMap.sum_apply, LinearMap.id_apply] + simp only [F, PiTensorProduct.map_tprod] + have hm : (fun i => Q i (m i)) + (fun i => P i (m i)) = m := by + funext i + change Q i (m i) + (m i - Q i (m i)) = m i + abel + conv_rhs => rw [← hm, (PiTensorProduct.tprod k).map_add_univ] + apply Finset.sum_congr rfl + intro A ha + congr 1 + funext i + simp only [Finset.piecewise] + split_ifs <;> rfl + have hFx (A : Finset ι) : F A x ∈ R := by + by_cases hc : (active ∩ A).card ≤ 2 + · let J := active \ A + have hJ : J ⊆ active := Finset.sdiff_subset + have hjc : (active \ J).card ≤ 2 := by + simpa only [J, Finset.sdiff_sdiff_self_left] using hc + apply hR J hJ hjc + clear hx hz + induction x using PiTensorProduct.induction_on with + | smul_tprod c m => + rw [map_smul] + apply Submodule.smul_mem + apply Submodule.subset_span + refine ⟨fun i => (if i ∈ A then Q i else P i) (m i), ?_, ?_⟩ + · intro i hi + have hiA : i ∉ A := (Finset.mem_sdiff.mp hi).2 + simpa only [ite_eq_right hiA] using hSP i (m i) + · exact (PiTensorProduct.map_tprod _ _).symm + | add x y hx hy => + rw [map_add] + exact Submodule.add_mem _ hx hy + · have hc' : 3 ≤ (active ∩ A).card := by omega + obtain ⟨I,hI,hcard⟩ := Finset.exists_subset_card_eq hc' + have hIa : I ⊆ active := fun i hi => (Finset.mem_inter.mp (hI hi)).1 + have hIA : I ⊆ A := fun i hi => (Finset.mem_inter.mp (hI hi)).2 + let H := PiTensorProduct.map fun i => + if i ∈ I then L i else if i ∈ A then Q i else P i + have hcomp : F A = H.comp (tensorAction V S I) := by + dsimp only [F, H, tensorAction] + rw [← PiTensorProduct.map_comp] + congr 1 + funext i + by_cases hi : i ∈ I + · simp only [ite_eq_left hi, ite_eq_left (hIA hi), Q] + · simp only [ite_eq_right hi, LinearMap.comp_id] + rw [hcomp, LinearMap.comp_apply, hz I hIa hcard, map_zero] + exact R.zero_mem + change x ∈ R + have hsx := LinearMap.congr_fun hsum x + simp only [LinearMap.sum_apply, LinearMap.id_apply] at hsx + rw [← hsx] + exact Submodule.sum_mem R (fun A _ => hFx A) + · refine iSup_le fun J => iSup_le fun hJ => iSup_le fun hc => ?_ + refine le_iInf fun I => le_iInf fun hI => le_iInf fun hcard => ?_ + apply Submodule.span_le.mpr + rintro z ⟨m,hm,rfl⟩ + have hex : ∃ i ∈ I, i ∈ J := by + by_contra hn + have hsub : I ⊆ active \ J := by + intro i hi + exact Finset.mem_sdiff.mpr ⟨hI hi, fun hij => hn ⟨i,hi,hij⟩⟩ + have := Finset.card_le_card hsub + omega + obtain ⟨i,hiI,hiJ⟩ := hex + change tensorAction V S I (PiTensorProduct.tprod k m) = 0 + rw [tensorAction, PiTensorProduct.map_tprod] + apply (PiTensorProduct.tprod k).map_coord_zero i + simpa only [ite_eq_left hiI] using hm i hiJ + +end BoundaryOnly.FormalObstruction + +namespace BoundaryOnly.FormalObstruction +open scoped BigOperators TensorProduct + +variable {k ι : Type*} [Field k] [Fintype ι] [LinearOrder ι] +variable {V : ι → Type*} [∀ i, AddCommGroup (V i)] [∀ i, Module k (V i)] + + + + +theorem select_special_fiber_tensor + (S P D r h : SignedTensor.EndFamily (k := k) V) + (active : Finset ι) (hcard : 5 ≤ active.card) + (hP2 : ∀ i, P i * P i = 1) + (hDP : ∀ i, D i * P i = -(P i * D i)) + (hDr : ∀ i, D i * r i = r i * D i) + (hPr : ∀ i, P i * r i = r i * P i) + (hPh : ∀ i, P i * h i = -(h i * P i)) + (hDh : ∀ i, D i * h i + h i * D i = 1 - r i) + (hNr : ∀ i ∈ active, ∀ x, S i x = 0 → + S i (r i x) = 0 ∧ S i (D i (r i x)) = 0) + (φ : (⨂[k] i, V i) →ₗ[k] k) + (hφD : ∀ x, φ (SignedTensor.differential V P D x) = 0) + (z : ⨂[k] i, V i) + (hDz : SignedTensor.differential V P D z = 0) + (hφz : φ z ≠ 0) + (hz : ∀ I : Finset ι, I ⊆ active → I.card = 3 → tensorAction V S I z = 0) : + ∃ (J : Finset ι) (m : ∀ i, V i), + J ⊆ active ∧ 3 ≤ J.card ∧ + (∀ i ∈ J, S i (m i) = 0 ∧ S i (D i (m i)) = 0) ∧ + φ (PiTensorProduct.tprod k m) ≠ 0 := by + classical + let Good : Set (⨂[k] i, V i) := {x | ∃ (J : Finset ι) (m : ∀ i, V i), + J ⊆ active ∧ (active \ J).card ≤ 2 ∧ + (∀ i ∈ J, S i (m i) = 0 ∧ S i (D i (m i)) = 0) ∧ + PiTensorProduct.tprod k m = x} + let T := Submodule.span k Good + have hm : (⨅ (I : Finset ι) (_ : I ⊆ active) (_ : I.card = 3), + LinearMap.ker (tensorAction V S I)) ≤ T.comap (PiTensorProduct.map r) := by + rw [joint_tensor_kernel] + refine iSup_le fun J => iSup_le fun hJ => iSup_le fun hJc => ?_ + apply Submodule.span_le.mpr + rintro _ ⟨m,hm,rfl⟩ + change PiTensorProduct.map r (PiTensorProduct.tprod k m) ∈ T + rw [PiTensorProduct.map_tprod] + apply Submodule.subset_span + refine ⟨J,fun i => r i (m i),hJ,hJc,?_,rfl⟩ + intro i hi + exact hNr i (hJ hi) (m i) (hm i hi) + have hzmem : z ∈ (⨅ (I : Finset ι) (_ : I ⊆ active) (_ : I.card = 3), + LinearMap.ker (tensorAction V S I)) := by + simp only [Submodule.mem_iInf, LinearMap.mem_ker] + exact hz + have hRz : PiTensorProduct.map r z ∈ T := hm hzmem + have hpair : φ (PiTensorProduct.map r z) = φ z := by + have H := LinearMap.congr_fun + (SignedTensor.tensor_homotopy P D r h hP2 hDP hDr hPr hPh hDh) z + change SignedTensor.differential V P D (SignedTensor.homotopy V P r h z) + + SignedTensor.homotopy V P r h (SignedTensor.differential V P D z) = + z - PiTensorProduct.map r z at H + have Hφ := congrArg φ H + rw [hDz, map_zero, add_zero, hφD, map_sub] at Hφ + exact (sub_eq_zero.mp Hφ.symm).symm + have hex : ∃ x ∈ Good, φ x ≠ 0 := by + by_contra hn + have hle : T ≤ LinearMap.ker φ := by + apply Submodule.span_le.mpr + intro x hx + change φ x = 0 + by_contra hnx + exact hn ⟨x,hx,hnx⟩ + apply hφz + rw [← hpair] + exact hle hRz + obtain ⟨_,⟨J,m,hJ,hJc,hm,rfl⟩,hp⟩ := hex + refine ⟨J,m,hJ,?_,hm,hp⟩ + have hc := Finset.card_sdiff_of_subset hJ + have hle := Finset.card_le_card hJ + omega + +end BoundaryOnly.FormalObstruction + +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/ThreeParameters.lean b/lean/OAI/Algebra/FrobeniusObstruction/ThreeParameters.lean new file mode 100644 index 0000000000000000000000000000000000000000..d5957ee478047a33a4d42f41aeac12ec75758565 --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/ThreeParameters.lean @@ -0,0 +1,158 @@ +import Mathlib + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace BoundaryOnly.FormalObstruction +namespace ThreeParameters + +variable (k : Type*) [Field k] + +abbrev Poly := MvPolynomial (Fin 3) k + +def squareIdeal : Ideal (Poly k) := + Ideal.span (Set.range fun i : Fin 3 => (MvPolynomial.X i : Poly k) ^ 2) + +abbrev Ring := Poly k ⧸ squareIdeal k + +def s (i : Fin 3) : Ring k := Ideal.Quotient.mk _ (MvPolynomial.X i) + +def w : Ring k := s k 0 * s k 1 * s k 2 + +@[simp] theorem s_sq (i : Fin 3) : s k i ^ 2 = 0 := by + rw [s, ← map_pow] + apply Ideal.Quotient.eq_zero_iff_mem.mpr + exact Ideal.subset_span ⟨i, rfl⟩ + +def topExponent : Fin 3 →₀ ℕ := Finsupp.equivFunOnFinite.symm (fun _ => 1) + +@[simp] theorem topExponent_apply (i : Fin 3) : topExponent i = 1 := by + simp [topExponent] + +theorem topCoeff_ideal (p : Poly k) (hp : p ∈ squareIdeal k) : + p.coeff topExponent = 0 := by + obtain ⟨c, rfl⟩ := Ideal.mem_span_range_iff_exists_fun.mp hp + rw [MvPolynomial.coeff_sum] + apply Finset.sum_eq_zero + intro i _ + rw [MvPolynomial.X_pow_eq_monomial, MvPolynomial.coeff_mul_monomial'] + have hi : ¬ Finsupp.single i 2 ≤ topExponent := by + intro h + have := h i + simp only [Finsupp.single_eq_same, topExponent_apply] at this + omega + rw [ite_eq_right hi] + +theorem w_ne_zero : w k ≠ 0 := by + intro hw + have hmem : (MvPolynomial.X 0 * MvPolynomial.X 1 * MvPolynomial.X 2 : Poly k) + ∈ squareIdeal k := by + apply Ideal.Quotient.eq_zero_iff_mem.mp + simpa only [map_mul, s, w] using hw + have hc := topCoeff_ideal k _ hmem + have he : Finsupp.single (0 : Fin 3) 1 + Finsupp.single 1 1 + + Finsupp.single 2 1 = topExponent := by + ext i + fin_cases i <;> norm_num [Finsupp.single_apply] + have hprod : (MvPolynomial.X 0 * MvPolynomial.X 1 * MvPolynomial.X 2 : Poly k) = + MvPolynomial.monomial topExponent 1 := by + simp only [MvPolynomial.X, MvPolynomial.monomial_mul_monomial, one_mul, he] + rw [hprod, MvPolynomial.coeff_monomial, ite_eq_left rfl] at hc + exact one_ne_zero hc + + +def augmentation : Ring k →+* k := + Ideal.Quotient.lift _ MvPolynomial.constantCoeff (by + intro p hp + obtain ⟨c, rfl⟩ := Ideal.mem_span_range_iff_exists_fun.mp hp + simp) + +@[simp] theorem augmentation_mk (p : Poly k) : + augmentation k (Ideal.Quotient.mk _ p) = MvPolynomial.constantCoeff p := rfl + +@[simp] theorem w_mul_s (i : Fin 3) : w k * s k i = 0 := by + fin_cases i + · calc + w k * s k 0 = s k 0 ^ 2 * s k 1 * s k 2 := by dsimp [w]; ring + _ = 0 := by simp + · calc + w k * s k 1 = s k 0 * s k 1 ^ 2 * s k 2 := by dsimp [w]; ring + _ = 0 := by simp + · calc + w k * s k 2 = s k 0 * s k 1 * s k 2 ^ 2 := by dsimp [w]; ring + _ = 0 := by simp + + +theorem w_mul (b : Ring k) : w k * b = augmentation k b • w k := by + obtain ⟨p, rfl⟩ := Ideal.Quotient.mk_surjective b + induction p using MvPolynomial.induction_on with + | C c => + simp only [augmentation_mk, MvPolynomial.constantCoeff_C] + change w k * algebraMap k (Ring k) c = c • w k + simpa only [mul_comm] using (Algebra.smul_def c (w k)).symm + | add p q hp hq => + simp only [map_add, mul_add, augmentation_mk, hp, hq, add_smul] + | mul_X p i hp => + simp only [map_mul, augmentation_mk, MvPolynomial.constantCoeff_X, mul_zero, zero_smul] + change w k * (Ideal.Quotient.mk _ p * s k i) = 0 + rw [← mul_assoc, mul_right_comm, w_mul_s, zero_mul] + + + +theorem residue_contradiction (b : Ring k) (hb : augmentation k b ≠ 0) + (hwb : w k * b = 0) : False := by + rw [w_mul] at hwb + exact w_ne_zero k ((smul_eq_zero.mp hwb).resolve_left hb) + +end ThreeParameters +end BoundaryOnly.FormalObstruction + +namespace BoundaryOnly.FormalObstruction.ThreeParameters +variable (k : Type*) [Field k] + +@[simp] theorem augmentation_s (i : Fin 3) : augmentation k (s k i) = 0 := by + simp [s] + +@[simp] theorem augmentation_algebraMap (a : k) : + augmentation k (algebraMap k (Ring k) a) = a := by + change MvPolynomial.constantCoeff (MvPolynomial.C a) = a + simp + + +theorem nilpotent_sub_augmentation (b : Ring k) : + IsNilpotent (b - algebraMap k (Ring k) (augmentation k b)) := by + obtain ⟨p, rfl⟩ := Ideal.Quotient.mk_surjective b + induction p using MvPolynomial.induction_on with + | C c => + rw [augmentation_mk, MvPolynomial.constantCoeff_C] + change IsNilpotent (algebraMap k (Ring k) c - algebraMap k (Ring k) c) + simp + | add p q hp hq => + simp only [map_add] + rw [show (Ideal.Quotient.mk _ p + Ideal.Quotient.mk _ q) - + (algebraMap k (Ring k) (augmentation k (Ideal.Quotient.mk _ p)) + + algebraMap k (Ring k) (augmentation k (Ideal.Quotient.mk _ q))) = + (Ideal.Quotient.mk _ p - algebraMap k (Ring k) (augmentation k (Ideal.Quotient.mk _ p))) + + (Ideal.Quotient.mk _ q - algebraMap k (Ring k) (augmentation k (Ideal.Quotient.mk _ q))) by ring] + exact (Commute.all _ _).isNilpotent_add hp hq + | mul_X p i hp => + simp only [map_mul, augmentation_mk, MvPolynomial.constantCoeff_X, mul_zero, map_zero, + sub_zero] + exact (Commute.all _ _).isNilpotent_mul_left ⟨2, s_sq k i⟩ + + +theorem isUnit_of_augmentation_ne_zero (b : Ring k) (hb : augmentation k b ≠ 0) : + IsUnit b := by + have hunit : IsUnit (algebraMap k (Ring k) (augmentation k b)) := + (isUnit_iff_ne_zero.mpr hb).map _ + have hnil := nilpotent_sub_augmentation k b + have h := hnil.isUnit_add_left_of_commute hunit (Commute.all _ _) + simpa only [add_sub_cancel] using h + +end BoundaryOnly.FormalObstruction.ThreeParameters + +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/TopResidue.lean b/lean/OAI/Algebra/FrobeniusObstruction/TopResidue.lean new file mode 100644 index 0000000000000000000000000000000000000000..0e8df9b060219249b7c97c89ac8b959ec4947ac9 --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/TopResidue.lean @@ -0,0 +1,195 @@ +import Mathlib +import OAI.Algebra.FrobeniusObstruction.LinearChange +import OAI.Algebra.FrobeniusObstruction.FormTensor + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace BoundaryOnly.FormalObstruction.Frobenius +variable {ι κ k : Type*} [Fintype ι] [Fintype κ] [DecidableEq ι] [DecidableEq κ] + [CommRing k] (ell : ℕ) + +def reindex (e : ι ≃ κ) : Ring (ι := ι) (k := k) ell ≃ₐ[k] Ring (ι := κ) (k := k) ell := + AlgEquiv.ofAlgHom (includeVariables ell e) (includeVariables ell e.symm) + (by apply algHom_ext; intro i; simp) + (by apply algHom_ext; intro i; simp) + +@[simp] theorem reindex_coordinate (e : ι ≃ κ) (i : ι) : + reindex (k := k) ell e (coordinate ell i) = coordinate ell (e i) := + includeVariables_coordinate ell e i + +@[simp] theorem partial_reindex [CharP k ell] (e : ι ≃ κ) (i : ι) + (a : Ring (ι := ι) (k := k) ell) : + partialDeriv ell (e i) (reindex ell e a) = reindex ell e (partialDeriv ell i a) := by + let f : Ring (ι := ι) (k := k) ell →ₐ[k] Ring (ι := κ) (k := k) ell := + (reindex ell e).toAlgHom + have H : (partialDeriv (k := k) ell (e i)).toLinearMap.comp f.toLinearMap = + f.toLinearMap.comp (partialDeriv ell i).toLinearMap := by + apply relativeDeriv_ext ell f + · simp + · simp + · intro x y; simp only [LinearMap.comp_apply, AlgHom.toLinearMap_apply, map_mul, + Derivation.coeFn_coe, Derivation.leibniz, smul_eq_mul]; ring + · intro x y; simp only [LinearMap.comp_apply, AlgHom.toLinearMap_apply, + Derivation.coeFn_coe, Derivation.leibniz, smul_eq_mul, map_add, map_mul] + ring + · intro j + change partialDeriv ell (e i) (reindex ell e (coordinate ell j)) = + reindex ell e (partialDeriv ell i (coordinate ell j)) + rw [reindex_coordinate] + simp only [coordinate, partial_coordinate] + by_cases hij : i = j + · subst j; simp + · simp [hij, e.injective.ne hij] + exact LinearMap.congr_fun H a + +end BoundaryOnly.FormalObstruction.Frobenius + +namespace BoundaryOnly.FormalObstruction.FormsReindex +open Frobenius MixedForms +open scoped TensorProduct +variable {ι κ k : Type*} [DecidableEq ι] [DecidableEq κ] + [CommRing k] (ell : ℕ) + +def vec (e : ι ≃ κ) : (ι → k) ≃ₗ[k] (κ → k) := + LinearEquiv.piCongrLeft' k (fun _ : ι => k) e + +def exterior (e : ι ≃ κ) : ExteriorAlgebra k (ι → k) ≃ₐ[k] ExteriorAlgebra k (κ → k) := + AlgEquiv.ofAlgHom (ExteriorAlgebra.map (vec (k := k) e).toLinearMap) + (ExteriorAlgebra.map (vec (k := k) e).symm.toLinearMap) + (by ext v; simp) + (by ext v; simp) + +@[simp] theorem exterior_gen (e : ι ≃ κ) (i : ι) : + exterior (k := k) e (gen i) = gen (e i) := by + change ExteriorAlgebra.map (vec e).toLinearMap (ExteriorAlgebra.ι k (Pi.single i 1)) = _ + rw [ExteriorAlgebra.map_apply_ι] + congr 1 + funext j + simp only [vec, Pi.single_apply] + by_cases h : j = e i + · subst j; simp + · have h' : e.symm j ≠ i := by intro he; exact h (by simpa using congrArg e he) + simp [h, h'] + +variable [Fintype ι] [Fintype κ] + +abbrev QForms (ι : Type*) [Fintype ι] [DecidableEq ι] := + MixedForms.Forms (k := k) (A := Ring (ι := ι) (k := k) ell) (ι := ι) + +def equiv (e : ι ≃ κ) : QForms (k := k) ell ι ≃ₐ[k] QForms (k := k) ell κ := + Algebra.TensorProduct.congr (Frobenius.reindex ell e) (exterior e) + +@[simp] theorem equiv_tmul (e : ι ≃ κ) (a : Ring (ι := ι) (k := k) ell) + (x : ExteriorAlgebra k (ι → k)) : equiv ell e (a ⊗ₜ[k] x) = + Frobenius.reindex ell e a ⊗ₜ[k] exterior e x := rfl + +@[simp] theorem equiv_d [CharP k ell] (e : ι ≃ κ) (x : QForms (k := k) ell ι) : + equiv ell e (d (partialDeriv ell) x) = d (partialDeriv ell) (equiv ell e x) := by + induction x using TensorProduct.inductionOn with + | add x y hx hy => simp only [map_add, hx, hy] + | tmul a x => + simp only [d_tmul, map_sum, equiv_tmul, map_mul, exterior_gen] + rw [← Equiv.sum_comp e] + apply Finset.sum_congr rfl + intro i _ + rw [partial_reindex] + +@[simp] theorem equiv_coeff (e : ι ≃ κ) (a : Ring (ι := ι) (k := k) ell) : + equiv ell e (coeff a) = coeff (Frobenius.reindex ell e a) := by + change equiv ell e (a ⊗ₜ[k] (1 : ExteriorAlgebra k (ι → k))) = + Frobenius.reindex ell e a ⊗ₜ[k] (1 : ExteriorAlgebra k (κ → k)) + rw [equiv_tmul, map_one] + +@[simp] theorem equiv_gradient [CharP k ell] (e : ι ≃ κ) + (a : Ring (ι := ι) (k := k) ell) : + equiv ell e (gradient (partialDeriv ell) a) = + gradient (partialDeriv ell) (Frobenius.reindex ell e a) := by + rw [← d_coeff, equiv_d, equiv_coeff, d_coeff] + +@[simp] theorem equiv_delta [CharP k ell] (e : ι ≃ κ) + (a : Ring (ι := ι) (k := k) ell) (x : QForms (k := k) ell ι) : + equiv ell e (delta (partialDeriv ell) a x) = + delta (partialDeriv ell) (Frobenius.reindex ell e a) (equiv ell e x) := by + simp only [delta_apply, map_mul, equiv_gradient] + +end BoundaryOnly.FormalObstruction.FormsReindex + +namespace BoundaryOnly.FormalObstruction.Frobenius +variable {ι k : Type*} [Fintype ι] [DecidableEq ι] [Field k] +variable (ell : ℕ) (hell : 0 < ell) + + +omit [DecidableEq ι] in +theorem quotientCoeff_coordinate_mul (i : ι) (e : ι →₀ ℕ) + (he : Good ell e) (hes : Good ell (Finsupp.single i 1 + e)) + (x : Ring (ι := ι) (k := k) ell) : + quotientCoeff ell (Finsupp.single i 1 + e) hes (coordinate ell i * x) = + quotientCoeff ell e he x := by + obtain ⟨f, rfl⟩ := Ideal.Quotient.mk_surjective x + change quotientCoeff ell (Finsupp.single i 1 + e) hes + (Ideal.Quotient.mk _ (MvPowerSeries.X i) * Ideal.Quotient.mk _ f) = _ + rw [← map_mul, quotientCoeff_mk, quotientCoeff_mk] + rw [MvPowerSeries.X_def, MvPowerSeries.coeff_monomial_mul] + simp + + +theorem eq_smul_top_of_coordinate_annihilate + (x : Ring (ι := ι) (k := k) ell) (hx : ∀ i, coordinate ell i * x = 0) : + x = quotientCoeff ell (topExponent ell) (topExponent_good hell) x • topMonomial ell := by + apply quotient_ext + intro e he + rw [map_smul] + change quotientCoeff ell e he x = _ * + quotientCoeff ell e he (Ideal.Quotient.mk _ (MvPowerSeries.monomial (topExponent ell) (1 : k))) + rw [quotientCoeff_mk, MvPowerSeries.coeff_monomial] + by_cases het : e = topExponent ell + · subst e + simp + · rw [ite_eq_right het, mul_zero] + have hlt : ∃ i, e i < ell - 1 := by + by_contra hn + push Not at hn + apply het + ext i + have hi := he i + simp only [topExponent_apply] + exact Nat.le_antisymm (by omega) (hn i) + obtain ⟨i, hi⟩ := hlt + have hs : Good ell (Finsupp.single i 1 + e) := by + intro j + by_cases hij : i = j + · subst j; simp only [Finsupp.add_apply, Finsupp.single_eq_same]; omega + · simpa only [Finsupp.add_apply, Finsupp.single_eq_of_ne (Ne.symm hij), zero_add] + using he j + have hshift := quotientCoeff_coordinate_mul ell i e he hs x + rw [hx, map_zero] at hshift + exact hshift.symm + +include hell in + + + +theorem automorphism_top (f : Ring (ι := ι) (k := k) ell →ₐ[k] Ring (ι := ι) (k := k) ell) + (hf : Function.Bijective f) : + ∃ c : k, c ≠ 0 ∧ f (topMonomial ell) = c • topMonomial ell := by + have hx (i : ι) : coordinate ell i * f (topMonomial ell) = 0 := by + obtain ⟨y, hy⟩ := hf.2 (coordinate ell i) + have ha : augmentation ell hell y = 0 := by + rw [← augmentation_comp ell hell f, AlgHom.comp_apply, hy, augmentation_coordinate] + rw [← hy, ← map_mul, mul_comm, topMonomial_mul hell] + change f ((augmentation ell hell y) • topMonomial ell) = 0 + rw [ha, zero_smul, map_zero] + refine ⟨_, ?_, eq_smul_top_of_coordinate_annihilate ell hell _ hx⟩ + intro hc + have hz := eq_smul_top_of_coordinate_annihilate ell hell _ hx + rw [hc, zero_smul, ← map_zero f] at hz + exact topMonomial_ne_zero hell (hf.1 hz) + +end BoundaryOnly.FormalObstruction.Frobenius + +end + +end OAI diff --git a/lean/OAI/Algebra/FrobeniusObstruction/VanishingIdeals.lean b/lean/OAI/Algebra/FrobeniusObstruction/VanishingIdeals.lean new file mode 100644 index 0000000000000000000000000000000000000000..399d3adcb17d8fb2d16e7557ef6250a69fc92739 --- /dev/null +++ b/lean/OAI/Algebra/FrobeniusObstruction/VanishingIdeals.lean @@ -0,0 +1,191 @@ +import Mathlib +import OAI.Algebra.FrobeniusObstruction.CoordinateMaps +import OAI.Algebra.FrobeniusObstruction.ThreeParameters + +namespace OAI + +noncomputable section +open scoped BigOperators + +namespace BoundaryOnly.FormalObstruction.Frobenius +variable {ι k : Type*} [Fintype ι] [DecidableEq ι] [Field k] (ell : ℕ) + + + + +theorem bijective_of_specialFiber + (f : Ring (ι := ι) (k := ThreeParameters.Ring k) ell →ₐ[ThreeParameters.Ring k] + Ring (ι := ι) (k := ThreeParameters.Ring k) ell) + (g : Ring (ι := ι) (k := k) ell ≃ₐ[k] Ring (ι := ι) (k := k) ell) + (h : ∀ x, mapCoefficients ell (ThreeParameters.augmentation k) (f x) = + g (mapCoefficients ell (ThreeParameters.augmentation k) x)) : + Function.Bijective f := by + let b := monomialBasis (ι := ι) (k := ThreeParameters.Ring k) ell + let b₀ := monomialBasis (ι := ι) (k := k) ell + let A := LinearMap.toMatrix b b f.toLinearMap + let A₀ := LinearMap.toMatrix b₀ b₀ g.toLinearEquiv.toLinearMap + have hm : (ThreeParameters.augmentation k).mapMatrix A = A₀ := by + ext v w + rw [RingHom.mapMatrix_apply, Matrix.map_apply] + dsimp only [A, A₀] + rw [LinearMap.toMatrix_apply, LinearMap.toMatrix_apply] + change ThreeParameters.augmentation k ((b.repr (f (b w))) v) = + (b₀.repr (g (b₀ w))) v + dsimp only [b, b₀] + simp only [monomialBasis_apply, monomialBasis_repr] + rw [← coefficients_mapCoefficients, h, mapCoefficients_monomial] + have hu₀ : IsUnit A₀.det := g.toLinearEquiv.isUnit_det b₀ b₀ + have hd : ThreeParameters.augmentation k A.det ≠ 0 := by + rw [RingHom.map_det, hm] + exact isUnit_iff_ne_zero.mp hu₀ + have hu : IsUnit A.det := ThreeParameters.isUnit_of_augmentation_ne_zero k _ hd + let e := Matrix.toLinearEquiv b A hu + have he : ∀ x, e x = f x := by + intro x + rw [Matrix.toLinearEquiv_apply] + change (Matrix.toLin b b (LinearMap.toMatrix b b f.toLinearMap)) x = _ + rw [Matrix.toLin_toMatrix] + rfl + exact ⟨fun x y hxy => e.injective (by rw [he, he, hxy]), fun y => + ⟨e.symm y, by rw [← he, e.apply_symm_apply]⟩⟩ + +noncomputable def liftInverse + (f : Ring (ι := ι) (k := ThreeParameters.Ring k) ell →ₐ[ThreeParameters.Ring k] + Ring (ι := ι) (k := ThreeParameters.Ring k) ell) + (g : Ring (ι := ι) (k := k) ell ≃ₐ[k] Ring (ι := ι) (k := k) ell) + (h : ∀ x, mapCoefficients ell (ThreeParameters.augmentation k) (f x) = + g (mapCoefficients ell (ThreeParameters.augmentation k) x)) : + Ring (ι := ι) (k := ThreeParameters.Ring k) ell ≃ₐ[ThreeParameters.Ring k] + Ring (ι := ι) (k := ThreeParameters.Ring k) ell := + AlgEquiv.ofBijective f (bijective_of_specialFiber ell f g h) + +end BoundaryOnly.FormalObstruction.Frobenius + +namespace BoundaryOnly.FormalObstruction.ThreeParameters +variable (k : Type*) [Field k] + +instance parameterNontrivial : Nontrivial (Ring k) := ⟨⟨w k, 0, w_ne_zero k⟩⟩ + +instance parameterCharP (ell : ℕ) [CharP k ell] : CharP (Ring k) ell := + (Algebra.charP_iff k (Ring k) ell).mp inferInstance + + + +theorem pow_eq_augmentation (ell : ℕ) [Fact ell.Prime] [CharP k ell] + (b : Ring k) : b ^ ell = (algebraMap k (Ring k) (augmentation k b)) ^ ell := by + obtain ⟨p, rfl⟩ := Ideal.Quotient.mk_surjective b + induction p using MvPolynomial.induction_on with + | C c => simp only [augmentation_mk, MvPolynomial.constantCoeff_C]; rfl + | add p q hp hq => + simp only [map_add, add_pow_char, hp, hq] + | mul_X p i hp => + have hs : s k i ^ ell = 0 := + pow_eq_zero_of_le (Fact.out : ell.Prime).two_le (s_sq k i) + simp only [map_mul, augmentation_mk, MvPolynomial.constantCoeff_X, + mul_zero, map_zero, mul_pow] + change _ * s k i ^ ell = (0 : Ring k) ^ ell + rw [hs, mul_zero, zero_pow (Fact.out : ell.Prime).ne_zero] + + theorem augmentation_zero_pow (ell : ℕ) [Fact ell.Prime] [CharP k ell] + (b : Ring k) (hb : augmentation k b = 0) : b ^ ell = 0 := by + rw [pow_eq_augmentation k ell, hb, map_zero, zero_pow (Fact.out : ell.Prime).ne_zero] + +end BoundaryOnly.FormalObstruction.ThreeParameters + +namespace BoundaryOnly.FormalObstruction.Frobenius +variable {ι κ k l S : Type*} [Fintype ι] [DecidableEq ι] + [Fintype κ] [DecidableEq κ] [CommRing k] [CommRing l] +variable (ell : ℕ) + +omit [DecidableEq ι] in +@[simp] theorem mapCoefficients_algebraMap (f : k →+* l) (a : k) : + mapCoefficients (ι := ι) ell f (algebraMap k _ a) = algebraMap l _ (f a) := by + change Ideal.Quotient.mk _ (MvPowerSeries.map f (MvPowerSeries.C a)) = _ + rw [MvPowerSeries.map_C] + rfl + +omit [DecidableEq ι] in +@[simp] theorem mapCoefficients_smul (f : k →+* l) (a : k) + (x : Ring (ι := ι) (k := k) ell) : + mapCoefficients ell f (a • x) = f a • mapCoefficients ell f x := by + rw [Algebra.smul_def a x, Algebra.smul_def (f a) (mapCoefficients ell f x), + map_mul, mapCoefficients_algebraMap] + +end BoundaryOnly.FormalObstruction.Frobenius + +namespace BoundaryOnly.FormalObstruction.Frobenius +variable {ι k l : Type*} [Fintype ι] [DecidableEq ι] [CommRing k] [CommRing l] +variable (ell : ℕ) +variable [Algebra k l] + +def baseChange : Ring (ι := ι) (k := k) ell →ₐ[k] Ring (ι := ι) (k := l) ell := + { mapCoefficients ell (algebraMap k l) with + commutes' := fun a => by + change mapCoefficients ell (algebraMap k l) (algebraMap k _ a) = _ + rw [mapCoefficients_algebraMap] + exact (IsScalarTower.algebraMap_apply k l (Ring (ι := ι) (k := l) ell) a).symm } + +omit [DecidableEq ι] in +@[simp] theorem baseChange_coordinate (i : ι) : + baseChange (k := k) (l := l) ell (coordinate ell i) = coordinate ell i := + mapCoefficients_coordinate ell _ i + +end BoundaryOnly.FormalObstruction.Frobenius + +namespace BoundaryOnly.FormalObstruction.Frobenius +variable {ι k : Type*} [Fintype ι] [DecidableEq ι] [Field k] (ell : ℕ) + + +def reduction : Ring (ι := ι) (k := ThreeParameters.Ring k) ell →ₐ[k] + Ring (ι := ι) (k := k) ell := + { mapCoefficients ell (ThreeParameters.augmentation k) with + commutes' := fun a => by + change mapCoefficients ell (ThreeParameters.augmentation k) + (algebraMap k (Ring (ι := ι) (k := ThreeParameters.Ring k) ell) a) = _ + rw [IsScalarTower.algebraMap_apply k (ThreeParameters.Ring k) (Ring (ι := ι) (k := ThreeParameters.Ring k) ell)] + change mapCoefficients ell (ThreeParameters.augmentation k) + (@algebraMap (ThreeParameters.Ring k) (Ring (ι := ι) (k := ThreeParameters.Ring k) ell) inferInstance inferInstance inferInstance (algebraMap k (ThreeParameters.Ring k) a)) = _ + rw [mapCoefficients_algebraMap, ThreeParameters.augmentation_algebraMap] } + +omit [DecidableEq ι] in +@[simp] theorem reduction_coordinate (i : ι) : + reduction (k := k) ell (coordinate ell i) = coordinate ell i := + mapCoefficients_coordinate ell _ i + +omit [DecidableEq ι] in +@[simp] theorem reduction_base (a : ThreeParameters.Ring k) : + reduction (ι := ι) (k := k) ell (@algebraMap (ThreeParameters.Ring k) (Ring (ι := ι) (k := ThreeParameters.Ring k) ell) inferInstance inferInstance inferInstance a) = + algebraMap k _ (ThreeParameters.augmentation k a) := + mapCoefficients_algebraMap ell _ a + +@[simp] theorem reduction_baseChange (x : Ring (ι := ι) (k := k) ell) : + reduction ell (baseChange (l := ThreeParameters.Ring k) ell x) = x := by + have h : (reduction (ι := ι) (k := k) ell).comp + (baseChange (l := ThreeParameters.Ring k) ell) = AlgHom.id k _ := by + apply algHom_ext + intro i + simp only [AlgHom.comp_apply, baseChange_coordinate, reduction_coordinate, AlgHom.id_apply] + exact AlgHom.congr_fun h x + +theorem specialFiber_of_coordinates + (f : Ring (ι := ι) (k := ThreeParameters.Ring k) ell →ₐ[ThreeParameters.Ring k] + Ring (ι := ι) (k := ThreeParameters.Ring k) ell) + (g : Ring (ι := ι) (k := k) ell →ₐ[k] Ring (ι := ι) (k := k) ell) + (h : ∀ i, reduction ell (f (coordinate ell i)) = g (coordinate ell i)) + (x : Ring (ι := ι) (k := ThreeParameters.Ring k) ell) : + reduction ell (f x) = g (reduction ell x) := by + have hm (v : Box (ι := ι) ell) : + reduction ell (f (monomial ell v)) = g (reduction ell (monomial ell v)) := by + rw [monomial_eq_prod] + simp only [Finsupp.prod, map_prod, map_pow, h, reduction_coordinate] + have hs (a : ThreeParameters.Ring k) (z : Ring (ι := ι) (k := ThreeParameters.Ring k) ell) : + reduction ell (a • z) = ThreeParameters.augmentation k a • reduction ell z := + mapCoefficients_smul ell _ a z + rw [monomial_expansion ell x] + simp only [map_sum, map_smul, hs, hm] + +end BoundaryOnly.FormalObstruction.Frobenius + +end + +end OAI diff --git a/lean/OAI/Algebra/GroupRing/AbsorbCells.lean b/lean/OAI/Algebra/GroupRing/AbsorbCells.lean new file mode 100644 index 0000000000000000000000000000000000000000..27ecea1c72adb0038c813295bee67ae8a83532c0 --- /dev/null +++ b/lean/OAI/Algebra/GroupRing/AbsorbCells.lean @@ -0,0 +1,74 @@ +import Mathlib +import OAI.Algebra.GroupRing.AbsorbTracks + +namespace OAI + + + +section +namespace TorsionFreeZeroDivisors.AbsorbCells +open Set GroupRingTopology GroupRingTopology.Attachment +open scoped unitInterval +noncomputable section +variable {G S Q Y : Type} [Group G] [TopologicalSpace G] [DiscreteTopology G] + [TopologicalSpace Y] [SimplyConnectedSpace Y] + (s : S→G) (w : Q→FreeGroup S) (hw : ∀i,FreeGroup.lift s (w i)=1) + (L : CellModule.Module G S→+CellModule.Module G Q) + (hL : ∀g i,L (CellModule.translate g (CellModule.fox (FreeGroup.lift s) (w i)))=Finsupp.single (g,i) 1) + (f : C(IndexedCells.Cover s w hw,Y)) (y : Y) + (hv : ∀g,f (IndexedCells.inclusion s w hw (Cayley.vertex s g))=y) +def graphHomotopy : (AbsorbTracks.graph s w hw f).Homotopy (.const _ y) := + (ContinuousMap.Homotopy.refl _).trans (AbsorbTracks.final s w hw L f y hv) +def diskHomotopy (e : G×Q) : (AbsorbTracks.cellMap s w hw f e.1 e.2).Homotopy (.const _ y) := + DiskTracks.extension (AbsorbTracks.cellMap s w hw f e.1 e.2) + (AbsorbTracks.cellMap_boundary s w hw f y hv e.1 e.2) + (AbsorbTracks.finalTrack s w hw L f y hv e.1 e.2) + (AbsorbTracks.homotopic s w hw L hL f y hv e.1 e.2).some +lemma diskHomotopy_boundary (e : G×Q) (t : unitInterval) (z : Sphere 2) : + diskHomotopy s w hw L hL f y hv e (t,boundary 2 z)= + graphHomotopy s w hw L f y hv (t,equivariantFamily (G:=G) (IndexedCells.attaching s w hw) e z) := by + change DiskTracks.extension _ _ _ _ (t,boundary 2 z)=_ + erw [DiskTracks.extension_boundary] + change _=((ContinuousMap.Homotopy.refl _).trans (AbsorbTracks.final s w hw L f y hv)) _ + rw [ContinuousMap.Homotopy.trans_apply,IndexedCells.attaching_translated] + split_ifs + · exact ContinuousMap.congr_fun (HomotopyTracks.natural_cast (f:=AbsorbTracks.graph s w hw f) (hv e.1) (IndexedCells.translated s w hw e.1 e.2)) z + · exact HomotopyTracks.track_boundary (f:=AbsorbTracks.graph s w hw f) (hv e.1) (AbsorbTracks.final s w hw L f y hv) + (fun t=>AbsorbTracks.final_vertex s w hw L f y hv t e.1) (IndexedCells.translated s w hw e.1 e.2) _ z + +def graphPaths : C(Cayley.Graph s,C(unitInterval,Y)) := + ((graphHomotopy s w hw L f y hv).toContinuousMap.comp ⟨Prod.swap,continuous_swap⟩).curry +def cellPaths (e : G×Q) : C(Disk 2,C(unitInterval,Y)) := + ((diskHomotopy s w hw L hL f y hv e).toContinuousMap.comp ⟨Prod.swap,continuous_swap⟩).curry +lemma paths_boundary (e : G×Q) (z : Sphere 2) : cellPaths s w hw L hL f y hv e (boundary 2 z)= + graphPaths s w hw L f y hv (equivariantFamily (G:=G) (IndexedCells.attaching s w hw) e z) := by + ext t + exact diskHomotopy_boundary s w hw L hL f y hv e t z +def paths : C(IndexedCells.Cover s w hw,C(unitInterval,Y)) := + lift (equivariantFamily (G:=G) (IndexedCells.attaching s w hw)) + (graphPaths s w hw L f y hv) (cellPaths s w hw L hL f y hv) (paths_boundary s w hw L hL f y hv) +lemma paths_zero (z : IndexedCells.Cover s w hw) : paths s w hw L hL f y hv z 0=f z := by + cases z with + | inl z => exact (graphHomotopy s w hw L f y hv).apply_zero z + | inr z => + change diskHomotopy s w hw L hL f y hv z.1 (0,interior 2 z.2)=_ + rw [ContinuousMap.Homotopy.apply_zero] + change f (cell _ z.1 (interior 2 z.2))=f (Sum.inr z) + rw [cell_interior] +lemma paths_one (z : IndexedCells.Cover s w hw) : paths s w hw L hL f y hv z 1=y := by + cases z with + | inl z=>exact (graphHomotopy s w hw L f y hv).apply_one z + | inr z=>exact (diskHomotopy s w hw L hL f y hv z.1).apply_one (interior 2 z.2) +def homotopy : f.Homotopy (.const _ y) where + toFun z:=paths s w hw L hL f y hv z.2 z.1 + continuous_toFun:=(paths s w hw L hL f y hv).uncurry.continuous.comp continuous_swap + map_zero_left:=paths_zero s w hw L hL f y hv + map_one_left:=paths_one s w hw L hL f y hv +end +end TorsionFreeZeroDivisors.AbsorbCells + +end + + + +end OAI diff --git a/lean/OAI/Algebra/GroupRing/AbsorbTracks.lean b/lean/OAI/Algebra/GroupRing/AbsorbTracks.lean new file mode 100644 index 0000000000000000000000000000000000000000..cd9a982a4c51fac8edd4adb0c4d7f89efe5ea02e --- /dev/null +++ b/lean/OAI/Algebra/GroupRing/AbsorbTracks.lean @@ -0,0 +1,114 @@ +import Mathlib +import OAI.Algebra.GroupRing.IndexedCells +import OAI.Algebra.GroupRing.FixedGraph +import OAI.Algebra.GroupRing.GraphLabels + +namespace OAI + + + +section +namespace TorsionFreeZeroDivisors.AbsorbTracks +open Set GroupRingTopology GroupRingTopology.Attachment GroupRingTopology.PathExtension +open scoped unitInterval +noncomputable section +variable {G S Q Y : Type} [Group G] [TopologicalSpace G] [DiscreteTopology G] + [TopologicalSpace Y] [SimplyConnectedSpace Y] + (s : S→G) (w : Q→FreeGroup S) (hw : ∀i,FreeGroup.lift s (w i)=1) + (L : CellModule.Module G S→+CellModule.Module G Q) + (hL : ∀g i,L (CellModule.translate g (CellModule.fox (FreeGroup.lift s) (w i)))=Finsupp.single (g,i) 1) + (f : C(IndexedCells.Cover s w hw,Y)) (y : Y) + (hv : ∀g,f (IndexedCells.inclusion s w hw (Cayley.vertex s g))=y) +def graph : C(Cayley.Graph s,Y) := f.comp (IndexedCells.inclusion s w hw) +def initial : (graph s w hw f).Homotopy (.const _ y) := FixedGraph.homotopy s (graph s w hw f) y hv +lemma initial_vertex (t : unitInterval) (g : G) : initial s w hw f y hv (t,Cayley.vertex s g)=y := + FixedGraph.homotopy_vertex s (graph s w hw f) y hv t g +def boundaryLoop (g : G) (i : Q) : Path y y := HomotopyTracks.mapped (f:=graph s w hw f) (hv g) (IndexedCells.translated s w hw g i) +def initialTrack (g : G) (i : Q) : Path (boundaryLoop s w hw f y hv g i) (Path.refl y) := + HomotopyTracks.track (f:=graph s w hw f) (hv g) (initial s w hw f y hv) (fun t=>initial_vertex s w hw f y hv t g) + (IndexedCells.translated s w hw g i) +def cellMap (g : G) (i : Q) : C(Disk 2,Y) := f.comp (cell (equivariantFamily (G:=G) (IndexedCells.attaching s w hw)) (g,i)) +include hv in +omit [SimplyConnectedSpace Y] in +lemma cellMap_boundary (g : G) (i : Q) (z : Sphere 2) : + cellMap s w hw f g i (boundary 2 z)=LoopSphere.map (boundaryLoop s w hw f y hv g i) z := by + change f (cell _ (g,i) (boundary 2 z))=_ + erw [cell_boundary] + rw [IndexedCells.attaching_translated] + exact (ContinuousMap.congr_fun (HomotopyTracks.natural_cast (f:=graph s w hw f) (hv g) (IndexedCells.translated s w hw g i)) z).symm +def physical (g : G) (i : Q) : Path (boundaryLoop s w hw f y hv g i) (Path.refl y) := + DiskTracks.physical (cellMap s w hw f g i) (cellMap_boundary s w hw f y hv g i) +local instance : CommGroup (FundamentalGroup (Path y y) (Path.refl y)) := + { (inferInstance : Group (FundamentalGroup (Path y y) (Path.refl y))) with + mul_comm:=LoopTracks.loopGroup_comm y } +abbrev Coef := Additive (FundamentalGroup (Path y y) (Path.refl y)) +def obstruction (g : G) (i : Q) : Coef y := Additive.ofMul + (Path.Homotopic.Quotient.mk ((initialTrack s w hw f y hv g i).symm.trans (physical s w hw f y hv g i))) +def obstructionMap : CellModule.Module G Q→+Coef y := + Finsupp.liftAddHom (fun e=>zmultiplesHom _ (obstruction s w hw f y hv e.1 e.2)) +lemma obstructionMap_single (g : G) (i : Q) : obstructionMap s w hw f y hv (Finsupp.single (g,i) 1)=obstruction s w hw f y hv g i := by + simp [obstructionMap] +def turnBack : Coef y→+Coef y where + toFun a := Additive.ofMul ((LoopTranspose.turn y).symm a.toMul) + map_zero' := (LoopTranspose.turn y).symm.map_one + map_add' a b := (LoopTranspose.turn y).symm.map_mul a.toMul b.toMul +def correction : CellModule.Module G S→+Coef y := (turnBack y).comp ((obstructionMap s w hw f y hv).comp L) +def labels : C(Cayley.Graph s,Path y y) := + GraphLabels.map s (Path.refl y) (fun e=>(correction s w hw L f y hv (Finsupp.single e 1)).toMul) +lemma labels_vertex (g : G) : labels s w hw L f y hv (Cayley.vertex s g)=Path.refl y := + GraphLabels.map_vertex _ _ _ g + +def final : (graph s w hw f).Homotopy (.const _ y) := + (initial s w hw f y hv).trans (HomotopyTracks.run (labels s w hw L f y hv)) +lemma final_vertex (t : unitInterval) (g : G) : final s w hw L f y hv (t,Cayley.vertex s g)=y := + HomotopyTracks.trans_base (initial s w hw f y hv) (fun t=>initial_vertex s w hw f y hv t g) + (labels s w hw L f y hv) (labels_vertex s w hw L f y hv g) t + +def finalTrack (g : G) (i : Q) : Path (boundaryLoop s w hw f y hv g i) (Path.refl y) := + HomotopyTracks.track (f:=graph s w hw f) (hv g) (final s w hw L f y hv) (fun t=>final_vertex s w hw L f y hv t g) + (IndexedCells.translated s w hw g i) +include hL in +lemma response (g : G) (i : Q) : + Path.Homotopic.Quotient.mk (LoopTranspose.turnPath y + (((IndexedCells.translated s w hw g i).map (labels s w hw L f y hv).continuous).cast + (labels_vertex s w hw L f y hv g).symm (labels_vertex s w hw L f y hv g).symm))= + (obstruction s w hw f y hv g i).toMul := by + rw [←LoopTranspose.turn_mk] + have he := WordResponse.basedClass_equal (IndexedCells.translated_equal s w hw g i) + (labels s w hw L f y hv) (Path.refl y) (labels_vertex s w hw L f y hv g) + (labels_vertex s w hw L f y hv g) + (WordResponse.source_eq s (labels s w hw L f y hv) (Path.refl y) (labels_vertex s w hw L f y hv) g) + (WordResponse.target_eq s (labels s w hw L f y hv) (Path.refl y) (labels_vertex s w hw L f y hv) g (w i)) + change Path.Homotopic.Quotient.mk (((IndexedCells.translated s w hw g i).map (labels s w hw L f y hv).continuous).cast _ _)= + (WordResponse.response s (labels s w hw L f y hv) (Path.refl y) (labels_vertex s w hw L f y hv) g (w i)).toMul at he + rw [he] + have hr:=GraphLabels.realizes s (Path.refl y) (correction s w hw L f y hv) g (w i) + change WordResponse.response s (labels s w hw L f y hv) (Path.refl y) (labels_vertex s w hw L f y hv) g (w i)=_ at hr + rw [hr] + change LoopTranspose.turn y ((LoopTranspose.turn y).symm + ((obstructionMap s w hw f y hv) (L (CellModule.translate g (CellModule.fox (FreeGroup.lift s) (w i))))).toMul)=_ + rw [hL,obstructionMap_single] + exact (LoopTranspose.turn y).apply_symm_apply _ +include hL in +lemma homotopic (g : G) (i : Q) : (physical s w hw f y hv g i).Homotopic (finalTrack s w hw L f y hv g i) := by + apply Path.Homotopic.Quotient.eq.mp + change Path.Homotopic.Quotient.mk (physical s w hw f y hv g i)=Path.Homotopic.Quotient.mk + (HomotopyTracks.track (f:=graph s w hw f) (hv g) ((initial s w hw f y hv).trans (HomotopyTracks.run (labels s w hw L f y hv))) _ _) + erw [HomotopyTracks.track_trans (f:=graph s w hw f) (hv g) (initial s w hw f y hv) + (fun t=>initial_vertex s w hw f y hv t g) (labels s w hw L f y hv) + (labels_vertex s w hw L f y hv g) (IndexedCells.translated s w hw g i)] + erw [Path.Homotopic.Quotient.mk_trans] + erw [response s w hw L hL f y hv g i] + change Path.Homotopic.Quotient.mk (physical s w hw f y hv g i)= + (Path.Homotopic.Quotient.mk (initialTrack s w hw f y hv g i)).trans + ((Path.Homotopic.Quotient.mk (initialTrack s w hw f y hv g i)).symm.trans + (Path.Homotopic.Quotient.mk (physical s w hw f y hv g i))) + rw [←Path.Homotopic.Quotient.trans_assoc,Path.Homotopic.Quotient.trans_symm,Path.Homotopic.Quotient.refl_trans] +end +end TorsionFreeZeroDivisors.AbsorbTracks + +end + + + +end OAI diff --git a/lean/OAI/Algebra/GroupRing/AffineIntervals.lean b/lean/OAI/Algebra/GroupRing/AffineIntervals.lean new file mode 100644 index 0000000000000000000000000000000000000000..ed41e85688fa437ba9185f264eb77f11a0fd1363 --- /dev/null +++ b/lean/OAI/Algebra/GroupRing/AffineIntervals.lean @@ -0,0 +1,476 @@ +import Mathlib +import OAI.Algebra.GroupRing.EntropyStages + +namespace OAI + +noncomputable section + +namespace TorsionFreeZeroDivisors.AffineIntervals +open scoped Classical +open BlockAlignment + +/-- Boundary action of a signed interval isometry. On half-integer centers it +agrees with the manuscript's letter-index affine action. -/ +def boundary (r : Bool) (a x : ℤ) : ℤ := if r then a-x else x+a + +def compOffset (r : Bool) (a b : ℤ) : ℤ := if r then a-b else a+b + +lemma affine_comp (r s : Bool) (a b x : ℤ) : + affine r a (affine s b x)=affine (r.xor s) (compOffset r a b) x := by + cases r <;> cases s <;> simp [affine,compOffset] <;> ring + +lemma boundary_comp (r s : Bool) (a b x : ℤ) : + boundary r a (boundary s b x)=boundary (r.xor s) (compOffset r a b) x := by + cases r <;> cases s <;> simp [boundary,compOffset] <;> ring + +lemma integer_positions (a b : ℤ) : positions a b=Finset.Ico a b := by + ext x + rw [mem_positions,Finset.mem_Ico] + constructor + · rintro ⟨h1,h2⟩ + constructor + · by_contra h + have : x+1≤a := by omega + have : (x:ℝ)+1≤a := by exact_mod_cast this + linarith + · by_contra h + have : b≤x := by omega + have : (b:ℝ)≤x := by exact_mod_cast this + linarith + · rintro ⟨h1,h2⟩ + have h1' : (a:ℝ)≤x := by exact_mod_cast h1 + have h2' : (x:ℝ)+1≤b := by exact_mod_cast (show x+1≤b by omega) + constructor <;> linarith + +lemma nat_positions (n : ℕ) : positions 0 (n : ℝ)=Finset.Ico (0:ℤ) (n:ℤ) := by + simpa only [Int.cast_zero,Int.cast_natCast] using integer_positions (0:ℤ) (n:ℤ) + +/-- Exact integer endpoints of the inverse image; reflection does not incur +any rounding loss on the source half-integer convention. -/ +def preLo (r : Bool) (a lo hi : ℤ) : ℤ := if r then a-hi else lo-a +def preHi (r : Bool) (a lo hi : ℤ) : ℤ := if r then a-lo else hi-a + +lemma mem_preimage (r : Bool) (a lo hi x : ℤ) : + affine r a x∈Finset.Ico lo hi ↔ x∈Finset.Ico (preLo r a lo hi) (preHi r a lo hi) := by + cases r <;> simp only [affine,preLo,preHi,Bool.false_eq_true,ite_false,ite_true,Finset.mem_Ico] <;> omega + +lemma preimage_bounds (r : Bool) (a lo hi l h : ℤ) + (hl : preLo r a lo hi≤l) (hh : h≤preHi r a lo hi) : + if r then lo≤a-h ∧ a-l≤hi else lo≤l+a ∧ h+a≤hi := by + cases r <;> simp only [preLo,preHi,Bool.false_eq_true,ite_false,ite_true] at * <;> omega + +/-- Empty comparison sides may be placed at the preimage of target boundary +zero; this has no occurrences and satisfies the global range condition. -/ +def anchor (r : Bool) (a : ℤ) : ℤ := if r then a else -a + +lemma anchor_bounds (r : Bool) (a : ℤ) (n : ℕ) : + if r then 0≤a-anchor r a ∧ a-anchor r a≤n + else 0≤anchor r a+a ∧ anchor r a+a≤n := by + cases r <;> simp [anchor] + +end TorsionFreeZeroDivisors.AffineIntervals +namespace TorsionFreeZeroDivisors.ChunkComparisons +open scoped Classical +open BlockAlignment ComparedBlocks AffineIntervals EntropyStages + +variable {P T E : Type*} {lp : P → ℕ} {lt : T → ℕ} + +/-- A literal partition into signed integer chunks, not a count of formal pieces. -/ +structure Chunking (lp : P → ℕ) (lt : T → ℕ) where + equiv : Position lt ≃ Position lp + path : T → P + reverse : T → Bool + offset : T → ℤ + source : ∀ x, (equiv x).1 = path x.1 + coordinate : ∀ x, (equiv x).2.val = affine (reverse x.1) (offset x.1) x.2.val + +lemma position_ext {x y : Position lp} (hs : x.1=y.1) (hc : x.2.val=y.2.val) : x=y := by + rcases x with ⟨x,q⟩; rcases y with ⟨y,r⟩ + dsimp at hs hc + subst y + congr 1 + exact Subtype.ext hc + +namespace Chunking +variable (K : Chunking lp lt) (C : Comparisons (E := E) lp) + +def pairing : Pairing (Position lt) where + partner x := K.equiv.symm (C.pairing.partner (K.equiv x)) + involutive x := by + dsimp + rw [K.equiv.apply_symm_apply,C.pairing.involutive (K.equiv x),K.equiv.symm_apply_apply] + +lemma partner_image (x : Position lt) : + K.equiv ((K.pairing C).partner x)=C.pairing.partner (K.equiv x) := by + simp [pairing] + +def rev (e : E) (t u : T) : Bool := + (K.reverse u).xor ((C.reverse e).xor (K.reverse t)) + +def off (e : E) (t u : T) : ℤ := + compOffset (K.reverse u) (inverseOffset (K.reverse u) (K.offset u)) + (compOffset (C.reverse e) (C.offset e) (K.offset t)) + +lemma new_affine (e : E) (t u : T) (q : ℤ) : + affine (K.rev C e t u) (K.off C e t u) q = + affine (K.reverse u) (inverseOffset (K.reverse u) (K.offset u)) + (affine (C.reverse e) (C.offset e) (affine (K.reverse t) (K.offset t) q)) := by + rw [affine_comp (C.reverse e) (K.reverse t),affine_comp] + rfl + +lemma new_affine_image (e : E) (t u : T) (q : ℤ) : + affine (K.reverse u) (K.offset u) (affine (K.rev C e t u) (K.off C e t u) q) = + affine (C.reverse e) (C.offset e) (affine (K.reverse t) (K.offset t) q) := by + rw [K.new_affine] + generalize affine (C.reverse e) (C.offset e) (affine (K.reverse t) (K.offset t) q) = z + cases K.reverse u <;> simp [affine,inverseOffset] + +lemma partner_coordinate {x : Position lt} {e : E} (he : C.side (K.equiv x)=some e) : + ((K.pairing C).partner x).2.val = + affine (K.rev C e x.1 ((K.pairing C).partner x).1) + (K.off C e x.1 ((K.pairing C).partner x).1) x.2.val := by + have h := C.partner_coordinate (K.equiv x) e he + rw [← K.partner_image, K.coordinate, K.coordinate] at h + apply affine_injective (K.reverse ((K.pairing C).partner x).1) + (K.offset ((K.pairing C).partner x).1) + rw [K.new_affine_image] + exact h + +/-- The image of an old partner is in a given chunk precisely when the +conjugate affine index is in that chunk. -/ +lemma partner_chunk_iff {x : Position lt} {e : E} {u : T} + (he : C.side (K.equiv x)=some e) (hu : K.path u=C.source (C.flip e)) : + ((K.pairing C).partner x).1=u ↔ + affine (K.rev C e x.1 u) (K.off C e x.1 u) x.2.val ∈ positions 0 (lt u) := by + constructor + · intro h + have hm := ((K.pairing C).partner x).2.property + rw [K.partner_coordinate C he,h] at hm + exact hm + · intro hm + let y : Position lt := ⟨u,⟨_,hm⟩⟩ + have hy : K.equiv y=C.pairing.partner (K.equiv x) := by + apply position_ext + · rw [K.source,C.partner_source _ _ he] + exact hu + · rw [K.coordinate,C.partner_coordinate _ _ he,K.coordinate] + exact K.new_affine_image C e x.1 u x.2.val + have : y=(K.pairing C).partner x := K.equiv.injective (hy.trans (K.partner_image C x).symm) + exact (congrArg Sigma.fst this).symm + +variable (lo hi : E → ℤ) + +def rawLo (e : E) (t u : T) : ℤ := + max 0 (max (preLo (K.reverse t) (K.offset t) (lo e) (hi e)) + (preLo (K.rev C e t u) (K.off C e t u) 0 (lt u))) +def rawHi (e : E) (t u : T) : ℤ := + min (lt t) (min (preHi (K.reverse t) (K.offset t) (lo e) (hi e)) + (preHi (K.rev C e t u) (K.off C e t u) 0 (lt u))) + +def valid (e : E) (t u : T) : Prop := + K.path t=C.source e ∧ K.path u=C.source (C.flip e) ∧ + K.rawLo C lo hi e t u ≤ K.rawHi C lo hi e t u + +def lower (e : E) (t u : T) : ℤ := + if K.valid C lo hi e t u then K.rawLo C lo hi e t u + else anchor (K.rev C e t u) (K.off C e t u) +def upper (e : E) (t u : T) : ℤ := + if K.valid C lo hi e t u then K.rawHi C lo hi e t u + else anchor (K.rev C e t u) (K.off C e t u) + +variable (hlo : ∀ e, C.lo e=(lo e : ℝ)) (hhi : ∀ e, C.hi e=(hi e : ℝ)) + +include hlo hhi in +lemma interval_iff (x : Position lt) (e : E) (u : T) : + x.2.val ∈ positions (K.lower C lo hi e x.1 u) (K.upper C lo hi e x.1 u) ↔ + C.side (K.equiv x)=some e ∧ ((K.pairing C).partner x).1=u := by + rw [integer_positions] + by_cases hv : K.valid C lo hi e x.1 u + · rw [lower,upper,ite_eq_left hv,ite_eq_left hv] + have hx := x.2.property + simp only [nat_positions] at hx + have hpart := hv.1 + have htarget := hv.2.1 + have hmem : x.2.val ∈ Finset.Ico (K.rawLo C lo hi e x.1 u) (K.rawHi C lo hi e x.1 u) ↔ + affine (K.reverse x.1) (K.offset x.1) x.2.val ∈ Finset.Ico (lo e) (hi e) ∧ + affine (K.rev C e x.1 u) (K.off C e x.1 u) x.2.val ∈ Finset.Ico (0:ℤ) (lt u:ℤ) := by + rw [mem_preimage,mem_preimage] + simp only [rawLo,rawHi,Finset.mem_Ico,max_le_iff,lt_min_iff] + simp only [Finset.mem_Ico] at hx + omega + rw [hmem] + have hside : C.side (K.equiv x)=some e ↔ + affine (K.reverse x.1) (K.offset x.1) x.2.val ∈ Finset.Ico (lo e) (hi e) := by + rw [C.side_iff,K.coordinate] + simp only [K.source,hlo,hhi,integer_positions] + exact and_iff_right hpart + rw [← hside] + apply and_congr_right + intro he + rw [K.partner_chunk_iff C he htarget] + simp only [nat_positions] + · rw [lower,upper,ite_eq_right hv,ite_eq_right hv,Finset.Ico_self] + simp only [Finset.notMem_empty,false_iff,not_and] + intro he hu + apply hv + have hp := (C.side_iff (K.equiv x) e).mp he + have ht := C.partner_source (K.equiv x) e he + rw [← K.partner_image,K.source,hu] at ht + refine ⟨(K.source x).symm.trans hp.1,ht,?_⟩ + have hq := hp.2 + rw [hlo,hhi,integer_positions,K.coordinate,mem_preimage] at hq + have hr := (K.partner_chunk_iff C he ht).mp hu + simp only [nat_positions] at hr + rw [mem_preimage] at hr + have hx := x.2.property + simp only [nat_positions] at hx + simp only [Finset.mem_Ico] at hx hq hr + simp only [rawLo,rawHi,max_le_iff,le_min_iff] + omega + +lemma range_bounds (e : E) (t u : T) : + if K.rev C e t u then + 0≤K.off C e t u-K.upper C lo hi e t u ∧ K.off C e t u-K.lower C lo hi e t u≤lt u + else 0≤K.lower C lo hi e t u+K.off C e t u ∧ K.upper C lo hi e t u+K.off C e t u≤lt u := by + by_cases hv : K.valid C lo hi e t u + · simp only [lower,upper,ite_eq_left hv] + apply preimage_bounds + · exact (le_max_right _ _).trans (le_max_right _ _) + · exact (min_le_right _ _).trans (min_le_right _ _) + · simp only [lower,upper,ite_eq_right hv] + exact anchor_bounds _ _ _ + +def side (x : Position lt) : Option (E×T×T) := + (C.side (K.equiv x)).map (fun e => (e,x.1,((K.pairing C).partner x).1)) + +lemma side_iff (x : Position lt) (e : E) (t u : T) : + K.side C x=some (e,t,u) ↔ + C.side (K.equiv x)=some e ∧ x.1=t ∧ ((K.pairing C).partner x).1=u := by + cases h : C.side (K.equiv x) <;> simp [side,h,Prod.mk.injEq] + +/-- Split every side at the boundaries of both chunks. Empty pieces carry no +positions; their chosen endpoint maintains the exact range convention. -/ +def comparisons : Comparisons (E := E×T×T) lt where + pairing := K.pairing C + side := K.side C + flip a := (C.flip a.1,a.2.2,a.2.1) + flip_inv a := by rcases a with ⟨e,t,u⟩; simp [C.flip_inv e] + flip_ne a := by + intro h + exact C.flip_ne a.1 (congrArg Prod.fst h) + side_partner x a ha := by + rcases a with ⟨e,t,u⟩ + obtain ⟨he,ht,hu⟩ := (K.side_iff C x e t u).mp ha + apply (K.side_iff C _ _ _ _).mpr + refine ⟨?_,hu,?_⟩ + · rw [K.partner_image] + exact C.side_partner (K.equiv x) e he + · rw [(K.pairing C).involutive x] + exact ht + none_iff x := by + simp only [side,Option.map_eq_none_iff,C.none_iff] + constructor + · intro h + apply K.equiv.injective + rw [K.partner_image,h] + · intro h + rw [← K.partner_image,h] + source a := a.2.1 + lo a := K.lower C lo hi a.1 a.2.1 a.2.2 + hi a := K.upper C lo hi a.1 a.2.1 a.2.2 + reverse a := K.rev C a.1 a.2.1 a.2.2 + offset a := K.off C a.1 a.2.1 a.2.2 + side_iff x a := by + rcases a with ⟨e,t,u⟩ + rw [K.side_iff] + constructor + · rintro ⟨he,ht,hu⟩ + refine ⟨ht,?_⟩ + subst t + exact (K.interval_iff C lo hi hlo hhi x e u).mpr ⟨he,hu⟩ + · rintro ⟨ht,hm⟩ + change x.1=t at ht + subst t + obtain ⟨he,hu⟩ := (K.interval_iff C lo hi hlo hhi x e u).mp hm + exact ⟨he,rfl,hu⟩ + partner_source x a ha := ((K.side_iff C x a.1 a.2.1 a.2.2).mp ha).2.2 + partner_coordinate x a ha := by + obtain ⟨he,ht,hu⟩ := (K.side_iff C x a.1 a.2.1 a.2.2).mp ha + simpa only [ht,hu] using K.partner_coordinate C he + target_range a := by + have h := K.range_bounds C lo hi a.1 a.2.1 a.2.2 + cases hr : K.rev C a.1 a.2.1 a.2.2 <;> simp only [hr,Bool.false_eq_true,ite_false,ite_true] at h ⊢ + · exact_mod_cast h + · exact_mod_cast h + +lemma fixed_iff (x : Position lt) : + (K.pairing C).partner x=x ↔ C.pairing.partner (K.equiv x)=K.equiv x := by + constructor + · intro h + rw [← K.partner_image,h] + · intro h + apply K.equiv.injective + rw [K.partner_image,h] + +def unpairedEquiv : {x : Position lt // (K.pairing C).partner x=x} ≃ + {x : Position lp // C.pairing.partner x=x} := + K.equiv.subtypeEquiv (K.fixed_iff C) + +/-- Splitting and orientation normalization neither deletes nor duplicates an +unpaired occurrence. -/ +theorem unpaired_card [Fintype P] [Fintype T] : + Fintype.card {x : Position lt // (K.comparisons C lo hi hlo hhi).pairing.partner x=x} = + Fintype.card {x : Position lp // C.pairing.partner x=x} := + Fintype.card_congr (K.unpairedEquiv C) + +lemma xor_labels {A : Type*} (bar : A → A) (hb : Function.Involutive bar) + (r s t : Bool) (x y : A) + (h : (if r then bar x else x) = if s then + bar (if t then bar y else y) else (if t then bar y else y)) : + x = if t.xor (s.xor r) then bar y else y := by + have hbb (z : A) : bar (bar z)=z := hb z + cases r <;> cases s <;> cases t <;> simp only [Bool.xor_false,Bool.xor_true, + Bool.not_false,Bool.not_true,Bool.false_eq_true,ite_false,ite_true,hbb] at h ⊢ + all_goals first | exact h | simpa only [hbb] using congrArg bar h + +/-- Every literal compatible labeling survives splitting with exactly the +xor of the path comparison and the two chain orientations. -/ +theorem compatible {A : Type*} (bar : A → A) (hb : Function.Involutive bar) + (old : Position lp → A) (word : Position lt → A) + (hn : ∀ x,old (K.equiv x)=if K.reverse x.1 then bar (word x) else word x) + (hc : ∀ x e,C.side x=some e → old x = if C.reverse e then + bar (old (C.pairing.partner x)) else old (C.pairing.partner x)) : + ∀ x a, (K.comparisons C lo hi hlo hhi).side x=some a → + word x=if (K.comparisons C lo hi hlo hhi).reverse a then + bar (word ((K.comparisons C lo hi hlo hhi).pairing.partner x)) + else word ((K.comparisons C lo hi hlo hhi).pairing.partner x) := by + intro x a ha + obtain ⟨he,ht,hu⟩ := (K.side_iff C x a.1 a.2.1 a.2.2).mp ha + have h := hc (K.equiv x) a.1 he + rw [← K.partner_image,hn,hn] at h + have h' := xor_labels bar hb (K.reverse x.1) (C.reverse a.1) + (K.reverse ((K.pairing C).partner x).1) (word x) (word ((K.pairing C).partner x)) h + change word x=(if K.rev C a.1 a.2.1 a.2.2 then + bar (word ((K.pairing C).partner x)) else word ((K.pairing C).partner x)) + dsimp only [rev] + exact h'.trans (by congr 1; simp only [ht,hu]) + +end Chunking +end TorsionFreeZeroDivisors.ChunkComparisons + +namespace TorsionFreeZeroDivisors.FiniteChunking +open scoped Classical BigOperators +open BlockAlignment ComparedBlocks AffineIntervals ChunkComparisons + +variable {n : ℕ} + +def before (i : Fin n) : Finset (Fin n) := Finset.univ.filter (fun j => j < i) +def start (f : Fin n → ℕ) (i : Fin n) : ℕ := ∑ j∈before i,f j + +lemma not_before (i : Fin n) : i∉before i := by simp [before] + +lemma start_next (f : Fin n → ℕ) {i j : Fin n} (h : i < j) : + start f i+f i ≤ start f j := by + rw [start,add_comm,← Finset.sum_insert (not_before i)] + apply Finset.sum_le_sum_of_subset + intro k hk + rcases Finset.mem_insert.mp hk with rfl|hk + · simpa [before] using h + · have hk' : k < i := by simpa [before] using hk + simpa [before] using hk'.trans h + +lemma start_end (f : Fin n → ℕ) (i : Fin n) : start f i+f i ≤ ∑ j,f j := by + rw [start,add_comm,← Finset.sum_insert (not_before i)] + exact Finset.sum_le_sum_of_subset (Finset.subset_univ _) + +def localIndex (r : Bool) (n : ℕ) (q : ℤ) : ℤ := affine r (if r then n else 0) q + +lemma local_bounds (r : Bool) (n : ℕ) {q : ℤ} (hq : q∈positions 0 n) : + 0≤localIndex r n q ∧ localIndex r n q simp only [localIndex,affine,Bool.false_eq_true,ite_false,ite_true] <;> omega + +lemma affine_offset (r : Bool) (pre len : ℕ) (q : ℤ) : + affine r (pre+(if r then (len:ℤ) else 0)) q = pre+localIndex r len q := by + cases r <;> simp [localIndex,affine] <;> omega + +lemma positions_card (n : ℕ) : (positions 0 n).card=n := by + rw [nat_positions,Int.card_Ico,sub_zero,Int.toNat_natCast] + +lemma position_card {T : Type*} [Fintype T] (len : T → ℕ) : + Fintype.card (Position len)=∑ t,len t := by + simp only [Position,Fintype.card_sigma,Fintype.card_coe,positions_card] + +variable {P : Type*} [Fintype P] (chunks : P → ℕ) + (len : (p : P) → Fin (chunks p) → ℕ) (rev : (p : P) → Fin (chunks p) → Bool) + +abbrev Traversal := (p : P) × Fin (chunks p) +abbrev traversalLength : Traversal chunks → ℕ := fun t => len t.1 t.2 +def pathLength (p : P) : ℕ := ∑ i,len p i + +def offset (t : Traversal chunks) : ℤ := start (len t.1) t.2 + if rev t.1 t.2 then (len t.1 t.2:ℤ) else 0 + +def image (x : Position (traversalLength chunks len)) : Position (pathLength chunks len) := + ⟨x.1.1,⟨affine (rev x.1.1 x.1.2) (offset chunks len rev x.1) x.2.val,by + simp only [nat_positions,Finset.mem_Ico] + have hq := local_bounds (rev x.1.1 x.1.2) (len x.1.1 x.1.2) x.2.property + have hp : (start (len x.1.1) x.1.2:ℤ)+len x.1.1 x.1.2 ≤ pathLength chunks len x.1.1 := by + exact_mod_cast start_end (len x.1.1) x.1.2 + rw [offset,affine_offset] + have hz : (0:ℤ)≤ start (len x.1.1) x.1.2 := Int.natCast_nonneg _ + omega⟩⟩ + +omit [Fintype P] in +lemma image_val (x : Position (traversalLength chunks len)) : + (image chunks len rev x).2.val = + start (len x.1.1) x.1.2+localIndex (rev x.1.1 x.1.2) (len x.1.1 x.1.2) x.2.val := + affine_offset _ _ _ _ + +omit [Fintype P] in +lemma image_injective : Function.Injective (image chunks len rev) := by + rintro ⟨⟨p,i⟩,q⟩ ⟨⟨r,j⟩,v⟩ hh + have hp : p=r := congrArg Sigma.fst hh + subst r + have hc := congrArg (fun x : Position (pathLength chunks len) => x.2.val) hh + rw [image_val,image_val] at hc + dsimp only at hc + have hq := local_bounds (rev p i) (len p i) q.property + have hv := local_bounds (rev p j) (len p j) v.property + have he : i=j := by + rcases lt_trichotomy i j with hij|hij|hji + · have hpre : (start (len p) i:ℤ)+len p i ≤ start (len p) j := by + exact_mod_cast start_next (len p) hij + omega + · exact hij + · have hpre : (start (len p) j:ℤ)+len p j ≤ start (len p) i := by + exact_mod_cast start_next (len p) hji + omega + subst j + have hqv : q=v := by + apply Subtype.ext + apply affine_injective (rev p i) (if rev p i then (len p i:ℤ) else 0) + unfold localIndex at hc + omega + subst v + rfl + +/-- The prescribed offsets define an actual equivalence. In particular, this +partition covers every old letter even when a path is empty. -/ +def equiv : Position (traversalLength chunks len) ≃ Position (pathLength chunks len) := + Equiv.ofBijective (image chunks len rev) <| + (Fintype.bijective_iff_injective_and_card _).mpr ⟨image_injective chunks len rev,by + simp only [position_card,Fintype.sum_sigma,traversalLength,pathLength]⟩ + +def chunking : Chunking (pathLength chunks len) (traversalLength chunks len) where + equiv := equiv chunks len rev + path t := t.1 + reverse t := rev t.1 t.2 + offset := offset chunks len rev + source _ := rfl + coordinate _ := rfl + +end TorsionFreeZeroDivisors.FiniteChunking + +end + +end OAI diff --git a/lean/OAI/Algebra/GroupRing/AlgebraicPictures.lean b/lean/OAI/Algebra/GroupRing/AlgebraicPictures.lean new file mode 100644 index 0000000000000000000000000000000000000000..fb376332806032407719fd9d52333615240bd2f1 --- /dev/null +++ b/lean/OAI/Algebra/GroupRing/AlgebraicPictures.lean @@ -0,0 +1,394 @@ +import Mathlib +import OAI.Algebra.GroupRing.WordBlocks + +namespace OAI + +noncomputable section + +namespace TorsionFreeZeroDivisors.WordBlocks +open scoped Classical +variable {A : Type*} +open FreeGroup +/-- Remove exactly the actual conjugating word, not a replacement reduced +representative. Each removal is the proved cap splice on the same boundary. -/ +def Matching.removeConjugator (c w : List (A×Bool)) (ws : List (List (A×Bool))) + (d : Matching WordPairing.inverseLetter ((c++w++invRev c)::ws)) : + Matching WordPairing.inverseLetter (w::ws) := by + induction c with + | nil=>simpa only [List.nil_append,invRev_empty,List.append_nil] using d + | cons a c ih=> + have he : (a::c)++w++invRev (a::c)=a::((c++w++invRev c)++[WordPairing.inverseLetter a]) := by + simp only [List.cons_append,invRev,WordPairing.inverseLetter, + List.reverse_cons,List.map_cons,List.append_assoc] + rw [he] at d + exact ih (d.removeCaps WordPairing.inverseLetter_involutive a (c++w++invRev c) ws) + +def Matching.removeConjugatorAt (c w : List (A×Bool)) (pre post : List (List (A×Bool))) + (d : Matching WordPairing.inverseLetter (pre++(c++w++invRev c)::post)) : + Matching WordPairing.inverseLetter (pre++w::post) := + (d.focus.removeConjugator c w (pre++post)).unfocus + +end TorsionFreeZeroDivisors.WordBlocks +namespace TorsionFreeZeroDivisors.AlgebraicPictures +open FreeGroup +variable {A I : Type*} (rel : I→List (A×Bool)) +def coreWords (ts : List (Term (A:=A) (I:=I))) : List (List (A×Bool)) := ts.map (Term.core rel) +def stripConjugators (ts : List (Term (A:=A) (I:=I))) + (pre : List (List (A×Bool))) + (d : WordBlocks.Matching WordPairing.inverseLetter (pre++ts.map (Term.word rel))) : + WordBlocks.Matching WordPairing.inverseLetter (pre++coreWords rel ts) := by + induction ts generalizing pre with + | nil=>exact d + | cons t ts ih=> + change WordBlocks.Matching WordPairing.inverseLetter + (pre++(t.connector++t.core rel++invRev t.connector)::ts.map (Term.word rel)) at d + have d' := d.removeConjugatorAt t.connector (t.core rel) pre (ts.map (Term.word rel)) + have d'' := ih (pre++[t.core rel]) (by simpa only [List.append_assoc,List.singleton_append] using d') + simpa only [List.append_assoc,List.singleton_append,coreWords,List.map_cons] using d'' +/-- A literal quotient-null word supplies actual planar inverse-letter matching +on the outer inverse word and signed relator cores, with all conjugating paths +removed by genuine genus-zero preserving surgery. This is still finite +permutation data, not an assumed topological surface or graph lift. -/ +theorem quotient_core_matching (outer : List (A×Bool)) + (h : PresentedGroup.mk (relations rel) (mk outer)=1) : + ∃ts : List (Term (A:=A) (I:=I)), + Nonempty (WordBlocks.Matching WordPairing.inverseLetter (invRev outer::coreWords rel ts)) := by + obtain ⟨ts,⟨d⟩⟩ := quotient_block_matching rel outer h + exact ⟨ts,⟨stripConjugators rel ts [invRev outer] d⟩⟩ + +end TorsionFreeZeroDivisors.AlgebraicPictures + +namespace TorsionFreeZeroDivisors.GraphPresentation +open PortSubdivision +open scoped Classical +variable {V D : Type} (Γ : PortGraph V D) + +/-- An ordinary port path; no reduction assumption, and loops and parallel +edges remain distinct. This is used for the exact graph relators. -/ +inductive Path : V→V→Type + | nil (v : V) : Path v v + | cons (d : D) {b : V} (p : Path (Γ.origin (Γ.reverse d)) b) : Path (Γ.origin d) b +namespace Path +variable {Γ} {a b c : V} +def append : {a b c : V} → Path Γ a b→Path Γ b c→Path Γ a c + | _,_,_,.nil _,q => q + | _,_,_,.cons d p,q => .cons d (p.append q) +def single (d : D) : Path Γ (Γ.origin d) (Γ.origin (Γ.reverse d)) := .cons d (.nil _) +def cast {a b a' b' : V} (ha : a=a') (hb : b=b') (p : Path Γ a b) : Path Γ a' b' := by + subst a'; subst b'; exact p +def reverse : Path Γ a b→Path Γ b a := by + intro p + induction p with + | nil v => exact .nil v + | cons d p ih => + exact (ih.append (single (Γ:=Γ) (Γ.reverse d))).cast rfl + (congrArg Γ.origin (PortGraph.reverse_reverse_apply Γ d)) + +def eval {G : Type*} [Group G] (label : D→G) : {a b : V} → Path Γ a b→G + | _,_,.nil _ => 1 + | _,_,.cons d p => label d*p.eval label +@[simp] lemma eval_nil {G : Type*} [Group G] (label : D→G) (v : V) : + (Path.nil (Γ:=Γ) v).eval label=1 := rfl +@[simp] lemma eval_cons {G : Type*} [Group G] (label : D→G) (d : D) + (p : Path Γ (Γ.origin (Γ.reverse d)) b) : + (Path.cons d p).eval label=label d*p.eval label := rfl +@[simp] lemma eval_append {G : Type*} [Group G] (label : D→G) + (p : Path Γ a b) (q : Path Γ b c) : + (p.append q).eval label=p.eval label*q.eval label := by + induction p with + | nil v => simp [append] + | cons d p ih => simp only [append,eval_cons,ih,mul_assoc] +@[simp] lemma eval_single {G : Type*} [Group G] (label : D→G) (d : D) : + (single (Γ:=Γ) d).eval label=label d := by simp [single] +@[simp] lemma eval_cast {G : Type*} [Group G] (label : D→G) + {a b a' b' : V} (ha : a=a') (hb : b=b') (p : Path Γ a b) : + (p.cast ha hb).eval label=p.eval label := by + subst a'; subst b'; rfl +lemma eval_reverse {G : Type*} [Group G] (label : D→G) + (hl : ∀ d,label (Γ.reverse d)=(label d)⁻¹) (p : Path Γ a b) : + p.reverse.eval label=(p.eval label)⁻¹ := by + induction p with + | nil v => simp [reverse] + | cons d p ih => + simp only [reverse] at ih + simp only [reverse, eval_cast, eval_append,eval_single,ih,hl,eval_cons,mul_inv_rev] + +lemma eval_map {G H : Type*} [Group G] [Group H] (f : G→*H) + (label : D→G) (p : Path Γ a b) : + p.eval (fun d => f (label d))=f (p.eval label) := by + induction p with + | nil v => simp + | cons d p ih => simp only [eval_cons,ih,map_mul] + +end Path +end TorsionFreeZeroDivisors.GraphPresentation +namespace TorsionFreeZeroDivisors.GraphPresentation.Path +open PortSubdivision +variable {V D : Type} {Γ : PortGraph V D} {a b c : V} +def darts : {a b : V}→Path Γ a b→List D + | _,_,.nil _=>[] + | _,_,.cons d p=>d::darts p +@[simp] lemma darts_nil (v : V) : darts (Path.nil (Γ:=Γ) v)=[] := rfl +@[simp] lemma darts_cons (d : D) (p : Path Γ (Γ.origin (Γ.reverse d)) b) : + darts (.cons d p)=d::darts p := rfl +@[simp] lemma darts_cast {a b a' b' : V} (ha : a=a') (hb : b=b') (p : Path Γ a b) : + darts (p.cast ha hb)=p.darts := by subst a';subst b';rfl +lemma darts_append (p : Path Γ a b) (q : Path Γ b c) : + (p.append q).darts=p.darts++q.darts := by + induction p with + | nil=>rfl + | cons d p ih=>simp only [append,darts_cons,ih,List.cons_append] +lemma darts_reverse (p : Path Γ a b) : p.reverse.darts=p.darts.reverse.map Γ.reverse := by + induction p with + | nil=>rfl + | cons d p ih=> + simp only [reverse] at ih + simp only [reverse,darts_cast,darts_append,single,darts_cons,darts_nil, + List.reverse_cons,List.map_append,List.map_cons,List.map_nil] + exact congrArg (fun l=>l++[Γ.reverse d]) ih +lemma empty_ends (p : Path Γ a b) (he : p.darts=[]) : a=b := by + cases p with + | nil=>rfl + | cons d p=>simp only [darts_cons,List.cons_ne_nil] at he +lemma first_origin (p : Path Γ a b) (hn : p.darts≠[]) : Γ.origin (p.darts.head hn)=a := by + cases p with + | nil=>exact False.elim (hn rfl) + | cons d p=>rfl +lemma last_origin (p : Path Γ a b) (hn : p.darts≠[]) : + Γ.origin (Γ.reverse (p.darts.getLast hn))=b := by + induction p with + | nil=>exact False.elim (hn rfl) + | cons d p ih=> + by_cases he : p.darts=[] + · simpa only [darts_cons,he,List.getLast_singleton] using p.empty_ends he + · simpa only [darts_cons,List.getLast_cons he] using ih he +lemma chain (p : Path Γ a b) : p.darts.IsChain (fun d e=>Γ.origin (Γ.reverse d)=Γ.origin e) := by + induction p with + | nil=>exact List.IsChain.nil + | cons d p ih=> + rw [darts_cons,List.isChain_cons] + refine ⟨?_,ih⟩ + intro e he + have hn : p.darts≠[] := by intro h;simp [h] at he + have hh : e=p.darts.head hn := by + exact (by simpa only [List.head?_eq_some_head hn,Option.mem_def,Option.some.injEq] using he : p.darts.head hn=e).symm + rw [hh] + exact (p.first_origin hn).symm +variable {A : Type*} (label : D→A×Bool) +def letters (p : Path Γ a b) : List (A×Bool) := p.darts.map label +lemma letters_mk (p : Path Γ a b) : + FreeGroup.mk (p.letters label)=p.eval (fun d=>FreeGroup.mk [label d]) := by + induction p with + | nil=>rfl + | cons d p ih=> + change FreeGroup.mk (label d::p.letters label)=_ + rw [show label d::p.letters label=[label d]++p.letters label from rfl,←FreeGroup.mul_mk,ih] + rfl +lemma letters_reverse (hl : ∀d,label (Γ.reverse d)=WordPairing.inverseLetter (label d)) + (p : Path Γ a b) : p.reverse.letters label=FreeGroup.invRev (p.letters label) := by + simp only [letters,darts_reverse,List.map_map,FreeGroup.invRev,List.map_reverse] + apply congrArg List.reverse + apply List.map_congr_left + intro d _ + exact hl d + +end TorsionFreeZeroDivisors.GraphPresentation.Path +namespace TorsionFreeZeroDivisors.WordBlocks +open scoped Classical +variable {D A : Type*} (label : D→A) +def mapCoordinates : (ws : List (List D))→Occ ws≃Occ (ws.map (List.map label)) + | []=>Equiv.refl _ + | w::ws=>Equiv.sumCongr (finCongr (List.length_map (f:=label) (as:=w)).symm) (mapCoordinates ws) +lemma mapCoordinates_letter (ws : List (List D)) (x : Occ ws) : + letter (ws.map (List.map label)) (mapCoordinates label ws x)=label (letter ws x) := by + induction ws with + | nil=>exact Empty.elim x + | cons w ws ih=> + cases x with + | inl i=>exact List.getElem_map _ + | inr i=>exact ih i +lemma rotate_cast {n m : ℕ} (h : n=m) (i : Fin n) : + finCongr h (finRotate n i)=finRotate m (finCongr h i) := by subst m;rfl +lemma mapCoordinates_rotation (ws : List (List D)) (x : Occ ws) : + mapCoordinates label ws (BlockBoundary.rotation (lengths ws) x)= + BlockBoundary.rotation (lengths (ws.map (List.map label))) (mapCoordinates label ws x) := by + induction ws with + | nil=>exact Empty.elim x + | cons w ws ih=> + cases x with + | inl i=>exact congrArg Sum.inl (rotate_cast (List.length_map (f:=label) (as:=w)).symm i) + | inr i=>exact congrArg Sum.inr (ih i) +/-- Actual boundary occurrences are graph darts; only their labels are inverse +matched. In particular, this does not silently require equal graph lifts. -/ +structure LiftedMatching (inv : A→A) (ws : List (List D)) where + partner : Equiv.Perm (Occ ws) + involutive : Function.Involutive partner + fixed_free : ∀x,partner x≠x + compatible : ∀x,label (letter ws (partner x))=inv (label (letter ws x)) + genusZero : MapEuler.GenusZero (BlockBoundary.rotation (lengths ws)) partner +def Matching.lift {inv : A→A} {ws : List (List D)} + (d : Matching inv (ws.map (List.map label))) : LiftedMatching label inv ws where + partner := (mapCoordinates label ws).symm.permCongr d.partner + involutive := PermutationTransport.involutive _ _ d.involutive + fixed_free := PermutationTransport.fixed_free _ _ d.fixed_free + compatible x := by + rw [←mapCoordinates_letter label ws,←mapCoordinates_letter label ws] + simp only [Equiv.permCongr_apply,Equiv.symm_symm,Equiv.apply_symm_apply] + exact d.compatible (mapCoordinates label ws x) + genusZero := by + have hh := MapConjugation.genusZero (mapCoordinates label ws).symm _ _ d.genusZero + have he : (mapCoordinates label ws).symm.permCongr + (BlockBoundary.rotation (lengths (ws.map (List.map label))))=BlockBoundary.rotation (lengths ws) := by + apply Equiv.ext + intro x + apply (mapCoordinates label ws).injective + simp only [Equiv.permCongr_apply,Equiv.symm_symm,Equiv.apply_symm_apply] + exact (mapCoordinates_rotation label ws x).symm + rwa [he] at hh + +end TorsionFreeZeroDivisors.WordBlocks +namespace TorsionFreeZeroDivisors.MapDeletion +open scoped Classical +open DeleteCycle MapEuler PermutationCycles +variable {O : Type} [Fintype O] (σ α : Equiv.Perm O) (p : O) (ha : α p=p) +lemma genusZero_iff_delete (hs : σ p≠p) : + GenusZero σ α ↔ GenusZero (rotation σ p) (partner α p ha) := by + refine ⟨genusZero_delete σ α p ha hs,fun hz=>?_⟩ + have hv := bypass_count σ p hs + have hf := bypass_count (α*σ) p (face_nonfixed σ α p ha hs) + rw [bypass_mul σ p α ha] at hf + have hc := Nat.card_congr (componentEquiv σ α p ha hs) + have he := support_count α p ha + simp only [←Nat.card_eq_fintype_card] at hv hf + dsimp only [GenusZero] at hz ⊢ + change Nat.card (Cycle (rotation σ p))=Nat.card (Cycle σ) at hv + change Nat.card (Cycle (partner α p ha*rotation σ p))=Nat.card (Cycle (α*σ)) at hf + rw [←hv,←hf,hc] + have hsup : ∀ (i j : Fintype (Rest p)) (d e : DecidableEq (Rest p)), + @Equiv.Perm.support (Rest p) d i (partner α p ha) = + @Equiv.Perm.support (Rest p) e j (partner α p ha) := by + intro i j d e + cases Subsingleton.elim i j + cases Subsingleton.elim d e + rfl + convert hz using 1 + rw [←he] + congr 1 + exact congrArg Finset.card (hsup _ _ _ _) +end TorsionFreeZeroDivisors.MapDeletion +namespace TorsionFreeZeroDivisors.MarkerInsertion +open scoped Classical +open DeleteCycle +variable {O : Type} (σ α : Equiv.Perm O) (p : O) +/-- Insert an unpaired marker immediately before p. -/ +def rotation : Equiv.Perm (Option O) := Equiv.swap none (some p)*Equiv.optionCongr σ +def partner : Equiv.Perm (Option O) := Equiv.optionCongr α +@[simp] lemma rotation_none : rotation σ p none=some p := by simp [rotation,Equiv.Perm.mul_apply] +@[simp] lemma partner_none : partner α none=none := rfl +lemma rotation_some (x : O) (hx : σ x≠p) : rotation σ p (some x)=some (σ x) := by + simp only [rotation,Equiv.Perm.mul_apply,Equiv.optionCongr_apply,Option.map_some] + exact Equiv.swap_apply_of_ne_of_ne (by simp) (by simpa using hx) +lemma rotation_predecessor : rotation σ p (some (σ.symm p))=none := by + simp [rotation,Equiv.Perm.mul_apply] +lemma rotation_nonfixed : rotation σ p none≠none := by rw [rotation_none];exact Option.some_ne_none p +lemma partner_involutive (hi : Function.Involutive α) : Function.Involutive (partner α) := by + intro x + cases x with + | none=>rfl + | some x=>exact congrArg some (hi x) +lemma fixed_only (hf : ∀ x,α x≠x) (x : Option O) (hx : partner α x=x) : x=none := by + cases x with + | none=>rfl + | some x=>exact False.elim (hf x (Option.some.inj hx)) +def coordinates : O≃Rest (none : Option O) where + toFun x := ⟨some x,Option.some_ne_none x⟩ + invFun x := x.val.get (Option.isSome_iff_ne_none.mpr x.property) + left_inv _ := rfl + right_inv _ := Subtype.ext (Option.some_get _) +variable [Fintype O] +lemma boundary_commutes (x : O) : bypass (rotation σ p) none (coordinates x)=coordinates (σ x) := by + apply Subtype.ext + rw [bypass_apply] + simp only [coordinates,Equiv.coe_fn_mk,rotation_none] + by_cases hx : σ x=p <;> simp [rotation,Equiv.Perm.mul_apply,Equiv.swap_apply_def,hx] +omit [Fintype O] in +lemma partner_commutes (x : O) : restrict (partner α) none (partner_none α) (coordinates x)=coordinates (α x) := rfl +lemma boundary_conjugate : bypass (rotation σ p) none=coordinates.permCongr σ := by + apply Equiv.ext + intro x + obtain ⟨x,rfl⟩ := coordinates.surjective x + rw [boundary_commutes] + simp only [Equiv.permCongr_apply,Equiv.symm_apply_apply] +omit [Fintype O] in +lemma partner_conjugate : restrict (partner α) none (partner_none α)=coordinates.permCongr α := by + apply Equiv.ext + intro x + obtain ⟨x,rfl⟩ := coordinates.surjective x + rw [partner_commutes] + simp only [Equiv.permCongr_apply,Equiv.symm_apply_apply] +/-- The literal marked rotation retains the exact genus-zero certificate. +This is only finite permutation insertion, not a surface realization. -/ +theorem genusZero (hz : MapEuler.GenusZero σ α) : MapEuler.GenusZero (rotation σ p) (partner α) := by + apply (MapDeletion.genusZero_iff_delete (rotation σ p) (partner α) none (partner_none α) (rotation_nonfixed σ p)).mpr + unfold MapDeletion.rotation MapDeletion.partner + rw [boundary_conjugate,partner_conjugate] + have hh := MapConjugation.genusZero coordinates σ α hz + convert hh using 1 + +end TorsionFreeZeroDivisors.MarkerInsertion +namespace TorsionFreeZeroDivisors.FinitePicture +open scoped Classical +open PortSubdivision +variable {V D A O : Type} [Fintype O] (Γ : PortGraph V D) (label : D→A) (inv : A→A) (x y : V) + (σ α : Equiv.Perm O) (hi : Function.Involutive α) (hf : ∀i,α i≠i) + (edge : O→D) (p : O) + (hc : ∀i,label (edge (α i))=inv (label (edge i))) + (hj : ∀i,σ i≠p → Γ.origin (Γ.reverse (edge i))=Γ.origin (edge (σ i))) + (hp : Γ.origin (edge p)=x) + (he : ∀i,σ i=p → Γ.origin (Γ.reverse (edge i))=y) + (hz : MapEuler.GenusZero σ α) +/-- Insert the literal root break in a lifted genus-zero full matching. This +retains every graph dart and all endpoints; no graph path is replaced by its +rose label. The initial existence of this full matching must still be proved. -/ +def ofBoundary : Data (O:=Option O) Γ label inv x y where + rotation := MarkerInsertion.rotation σ p + partner := MarkerInsertion.partner α + involutive := MarkerInsertion.partner_involutive α hi + marker := none + marker_fixed := rfl + fixed_only := MarkerInsertion.fixed_only α hf + dart := Option.map edge + none_iff i := by cases i <;> simp + before i := i.elim y (fun j=>Γ.origin (edge j)) + after i := i.elim x (fun j=>Γ.origin (Γ.reverse (edge j))) + begins i d hd := by + cases i with + | none=>simp at hd + | some i=>exact congrArg Γ.origin (Option.some.inj hd) + ends i d hd := by + cases i with + | none=>simp at hd + | some i=>exact congrArg (Γ.origin ∘ Γ.reverse) (Option.some.inj hd) + marker_before := rfl + marker_after := rfl + consistent i := by + cases i with + | none=>simpa only [MarkerInsertion.rotation_none,Option.elim_none,Option.elim_some] using hp.symm + | some i=> + by_cases hi : σ i=p + · have hx : i=σ.symm p := σ.injective (hi.trans (σ.apply_symm_apply p).symm) + rw [hx,MarkerInsertion.rotation_predecessor] + exact he _ (σ.apply_symm_apply p) + · rw [MarkerInsertion.rotation_some σ p i hi] + exact hj i hi + compatible i := by + cases i with + | none=>rfl + | some i=>exact congrArg some (hc i) + genusZero := MarkerInsertion.genusZero σ α p hz + +end TorsionFreeZeroDivisors.FinitePicture + +end + +end OAI diff --git a/lean/OAI/Algebra/GroupRing/Attachment.lean b/lean/OAI/Algebra/GroupRing/Attachment.lean new file mode 100644 index 0000000000000000000000000000000000000000..5546753d4f055a5a75647db4b89260b5c4c9d929 --- /dev/null +++ b/lean/OAI/Algebra/GroupRing/Attachment.lean @@ -0,0 +1,462 @@ +import Mathlib +import OAI.Algebra.GroupRing.HomotopyFunctor + +namespace OAI + +noncomputable section + +open Set Metric Topology BigOperators +open Set Metric Topology + +namespace GroupRingTopology.Cellular +universe u +variable {X Y : Type u} [TopologicalSpace X] [TopologicalSpace Y] [Nonempty X] +variable {C : Set X} [CWComplex C] {f : X → Y} (hf : IsClosedEmbedding f) + +def transportedMap (n : ℕ) (i : RelCWComplex.cell C n) : PartialEquiv (Fin n → ℝ) Y := + (RelCWComplex.map n i).trans (hf.isEmbedding.toPartialHomeomorph f).toPartialEquiv + +@[simp] lemma transportedMap_apply (n : ℕ) (i : RelCWComplex.cell C n) (x : Fin n → ℝ) : + transportedMap hf n i x = f (RelCWComplex.map n i x) := rfl + +lemma transportedMap_source (n : ℕ) (i : RelCWComplex.cell C n) : + (transportedMap hf n i).source = ball 0 1 := by + simp only [transportedMap,PartialEquiv.trans_source, + IsEmbedding.toPartialHomeomorph_source,Set.preimage_univ,Set.inter_univ, + RelCWComplex.source_eq] + +lemma transportedMap_image (n : ℕ) (i : RelCWComplex.cell C n) (S : Set (Fin n → ℝ)) : + transportedMap hf n i '' S = f '' (RelCWComplex.map n i '' S) := + Set.image_comp f (RelCWComplex.map n i) S + +lemma transportedMap_continuousOn (n : ℕ) (i : RelCWComplex.cell C n) : + ContinuousOn (transportedMap hf n i) (closedBall 0 1) := + hf.continuous.comp_continuousOn (RelCWComplex.continuousOn n i) + +lemma transportedMap_continuousOn_symm (n : ℕ) (i : RelCWComplex.cell C n) : + ContinuousOn (transportedMap hf n i).symm (transportedMap hf n i).target := by + let e := hf.isEmbedding.toPartialHomeomorph f + change ContinuousOn (fun y => (RelCWComplex.map n i).symm (e.symm y)) + (e.target ∩ e.symm ⁻¹' (RelCWComplex.map n i).target) + exact (RelCWComplex.continuousOn_symm n i).comp + (e.continuousOn_symm.mono Set.inter_subset_left) (fun _ h => h.2) + +variable [T2Space X] + +/-- Closed embeddings transport classical CW structures, including their weak + topology, with precisely the same cells. -/ +@[instance_reducible] +def transportCW : CWComplex (f '' C) where + cell := RelCWComplex.cell C + map := transportedMap hf + source_eq := transportedMap_source hf + continuousOn := transportedMap_continuousOn hf + continuousOn_symm := transportedMap_continuousOn_symm hf + pairwiseDisjoint' := by + intro p _ q _ hpq + change Disjoint (transportedMap hf p.1 p.2 '' ball 0 1) + (transportedMap hf q.1 q.2 '' ball 0 1) + rw [transportedMap_image,transportedMap_image] + exact (CWComplex.disjoint_openCell_of_ne hpq).image hf.injective.injOn (Set.subset_univ _) (Set.subset_univ _) + mapsTo' := by + intro n i + obtain ⟨I,hI⟩ := CWComplex.cellFrontier_subset_finite_closedCell n i + refine ⟨I,?_⟩ + intro x hx + have h := hI (show RelCWComplex.map n i x ∈ CWComplex.cellFrontier n i from ⟨x,hx,rfl⟩) + simp only [Set.mem_iUnion] at h + obtain ⟨m,hm,j,hj,hx⟩ := h + refine Set.mem_iUnion.mpr ⟨m,Set.mem_iUnion.mpr ⟨hm,Set.mem_iUnion.mpr + ⟨j,Set.mem_iUnion.mpr ⟨hj,?_⟩⟩⟩⟩ + rw [transportedMap_image] + exact ⟨_,hx,rfl⟩ + closed' := by + intro A hA hclosed + have hpre : IsClosed (f ⁻¹' A) := by + apply (CWComplex.closed C (f ⁻¹' A) ?_).mpr + · intro n i + have h := (hclosed n i).preimage hf.continuous + rw [transportedMap_image,Set.preimage_inter, + Set.preimage_image_eq _ hf.injective] at h + exact h + · intro x hx + obtain ⟨y,hy,hyx⟩ := hA hx + exact hf.injective hyx ▸ hy + have h := hf.isClosedMap _ hpre + rwa [Set.image_preimage_eq_of_subset (hA.trans (Set.image_subset_range f C))] at h + union' := by + simp only [transportedMap_image,← Set.image_iUnion] + change f '' (⋃ n, ⋃ i, CWComplex.closedCell n i) = f '' C + rw [CWComplex.union] + +end GroupRingTopology.Cellular +open Set Metric Topology +namespace GroupRingTopology.Attachment + +section +open Set Metric Topology +universe z +variable {X : Type z} [TopologicalSpace X] [T2Space X] [Nonempty X] +variable [CWComplex (Set.univ : Set X)] {ι : Type z} {n : ℕ} +variable (a : ι → C(Sphere n,X)) + +abbrev OldCell (m : ℕ) := RelCWComplex.cell (Set.univ : Set X) m + +omit [Nonempty X] in +lemma attaching_finite_frontier + (hdim : ∀ m (_ : OldCell (X := X) m), m < n) (i : ι) : + ∃ I : ∀ m, Finset (OldCell (X := X) m), + ∀ x, a i x ∈ ⋃ m < n, ⋃ j ∈ I m, CWComplex.closedCell m j := by + classical + let S := {p : Σ m, OldCell (X := X) m | + (Set.range (a i) ∩ CWComplex.openCell p.1 p.2).Nonempty} + have hS : S.Finite := Cellular.compact_finitely_many_cells (C := (Set.univ : Set X)) + (isCompact_range (a i).continuous) + have hSm (m : ℕ) : ((Sigma.mk m) ⁻¹' S).Finite := + hS.preimage (Set.injOn_of_injective (fun _ _ h => eq_of_heq (Sigma.mk.inj_iff.mp h).2)) + refine ⟨fun m => (hSm m).toFinset,?_⟩ + intro x + have hx : a i x ∈ (Set.univ : Set X) := Set.mem_univ _ + rw [← CWComplex.iUnion_openCell_eq_complex (C := (Set.univ : Set X))] at hx + simp only [Set.mem_iUnion] at hx + obtain ⟨m,j,hx⟩ := hx + exact Set.mem_iUnion.mpr ⟨m,Set.mem_iUnion.mpr ⟨hdim m j,Set.mem_iUnion.mpr + ⟨j,Set.mem_iUnion.mpr ⟨(hSm m).mem_toFinset.mpr ⟨a i x,⟨x,rfl⟩,hx⟩, + CWComplex.openCell_subset_closedCell m j hx⟩⟩⟩⟩ + +abbrev LayerCell (m : ℕ) := OldCell (X := X) m ⊕ CellIndex.{z,z} m n ι + +def layerMap (m : ℕ) : LayerCell (X := X) (ι := ι) (n := n) m → + PartialEquiv (Fin m → ℝ) (Space a) + | Sum.inl i => Cellular.transportedMap (C := Set.univ) (base_closedEmbedding a) m i + | Sum.inr i => cellMap a m i + +omit [T2Space X] in +lemma layerMap_old_apply (m : ℕ) (i : OldCell (X := X) m) (x : Fin m → ℝ) : + layerMap a m (Sum.inl i) x = base a (RelCWComplex.map m i x) := rfl + +omit [T2Space X] in +lemma layerMap_old_image (m : ℕ) (i : OldCell (X := X) m) (S : Set (Fin m → ℝ)) : + layerMap a m (Sum.inl i) '' S = base a '' (RelCWComplex.map m i '' S) := + Cellular.transportedMap_image (base_closedEmbedding a) m i S + +omit [T2Space X] in +lemma layerMap_new (i : ι) : + layerMap a n (Sum.inr ⟨⟨⟨rfl⟩,i⟩⟩) = characteristicPE a i := rfl + +@[instance_reducible] +def layerCW (hdim : ∀ m (_ : OldCell (X := X) m), m < n) : + CWComplex (Set.univ : Set (Space a)) where + cell := LayerCell (X := X) (ι := ι) (n := n) + map := layerMap a + source_eq := by + intro m i + cases i with + | inl i => exact Cellular.transportedMap_source (base_closedEmbedding a) m i + | inr i => exact (relCWComplex a).source_eq m i + continuousOn := by + intro m i + cases i with + | inl i => exact Cellular.transportedMap_continuousOn (base_closedEmbedding a) m i + | inr i => exact (relCWComplex a).continuousOn m i + continuousOn_symm := by + intro m i + cases i with + | inl i => exact Cellular.transportedMap_continuousOn_symm (base_closedEmbedding a) m i + | inr i => exact (relCWComplex a).continuousOn_symm m i + pairwiseDisjoint' := by + rintro ⟨m,i⟩ _ ⟨k,j⟩ _ hne + change Disjoint (layerMap a m i '' ball 0 1) (layerMap a k j '' ball 0 1) + cases i with + | inl i => + cases j with + | inl j => + rw [layerMap_old_image,layerMap_old_image] + apply (CWComplex.disjoint_openCell_of_ne ?_).image (base_closedEmbedding a).injective.injOn (Set.subset_univ _) (Set.subset_univ _) + intro h + cases h + exact hne rfl + | inr j => + obtain ⟨⟨⟨hk⟩,j⟩⟩ := j + subst k + rw [layerMap_old_image,layerMap_new,characteristicPE_image_ball] + apply Set.disjoint_left.mpr + rintro z ⟨x,_,rfl⟩ ⟨y,h⟩ + cases h + | inr i => + obtain ⟨⟨⟨hm⟩,i⟩⟩ := i + subst m + cases j with + | inl j => + rw [layerMap_new,characteristicPE_image_ball,layerMap_old_image] + apply Set.disjoint_left.mpr + rintro z ⟨x,rfl⟩ ⟨y,_,h⟩ + cases h + | inr j => + obtain ⟨⟨⟨hk⟩,j⟩⟩ := j + subst k + rw [layerMap_new,layerMap_new,characteristicPE_image_ball,characteristicPE_image_ball] + apply Set.disjoint_left.mpr + rintro z ⟨x,rfl⟩ ⟨y,h⟩ + have hij : j = i := congrArg Sigma.fst (Sum.inr_injective h) + subst j + exact hne rfl + mapsTo' := by + classical + intro m c + cases c with + | inl i => + obtain ⟨I,hI⟩ := CWComplex.cellFrontier_subset_finite_closedCell m i + refine ⟨fun k => (I k).image Sum.inl,?_⟩ + intro x hx + have hh := hI (show RelCWComplex.map m i x ∈ CWComplex.cellFrontier m i from ⟨x,hx,rfl⟩) + simp only [Set.mem_iUnion] at hh + obtain ⟨k,hkm,j,hj,hx⟩ := hh + refine Set.mem_iUnion.mpr ⟨k,Set.mem_iUnion.mpr ⟨hkm,Set.mem_iUnion.mpr + ⟨Sum.inl j,Set.mem_iUnion.mpr ⟨Finset.mem_image.mpr ⟨j,hj,rfl⟩,?_⟩⟩⟩⟩ + rw [layerMap_old_image] + exact ⟨_,hx,rfl⟩ + | inr i => + obtain ⟨⟨⟨hm⟩,i⟩⟩ := i + subst m + obtain ⟨I,hI⟩ := attaching_finite_frontier a hdim i + refine ⟨fun k => (I k).image Sum.inl,?_⟩ + intro x hx + have hh := hI ⟨x,hx⟩ + simp only [Set.mem_iUnion] at hh + obtain ⟨k,hkn,j,hj,hx'⟩ := hh + refine Set.mem_iUnion.mpr ⟨k,Set.mem_iUnion.mpr ⟨hkn,Set.mem_iUnion.mpr + ⟨Sum.inl j,Set.mem_iUnion.mpr ⟨Finset.mem_image.mpr ⟨j,hj,rfl⟩,?_⟩⟩⟩⟩ + rw [layerMap_old_image] + refine ⟨a i ⟨x,hx⟩,hx',?_⟩ + change base a (a i ⟨x,hx⟩) = characteristic a i x + exact (cell_boundary a i ⟨x,hx⟩).symm.trans + (characteristic_disk a i (boundary n ⟨x,hx⟩)).symm + closed' := by + intro A _ hA + apply (isClosed_iff a A).mpr + constructor + · apply (CWComplex.closed Set.univ (base a ⁻¹' A) (Set.subset_univ _)).mpr + intro m i + have h := (hA m (Sum.inl i)).preimage (continuous_base a) + rw [layerMap_old_image,Set.preimage_inter, + Set.preimage_image_eq _ (base_closedEmbedding a).injective] at h + exact h + · intro i + have h := (hA n (Sum.inr ⟨⟨⟨rfl⟩,i⟩⟩)).preimage (cell a i).continuous + rw [layerMap_new,characteristicPE_image_closedBall,Set.preimage_inter] at h + simpa only [Set.preimage_range,Set.inter_univ] using h + union' := by + apply Set.eq_univ_of_forall + intro z + cases z with + | inl x => + have hx : x ∈ (Set.univ : Set X) := Set.mem_univ _ + rw [← CWComplex.union (C := (Set.univ : Set X))] at hx + simp only [Set.mem_iUnion] at hx + obtain ⟨m,i,hx⟩ := hx + refine Set.mem_iUnion.mpr ⟨m,Set.mem_iUnion.mpr ⟨Sum.inl i,?_⟩⟩ + rw [layerMap_old_image] + exact ⟨x,hx,rfl⟩ + | inr p => + refine Set.mem_iUnion.mpr ⟨n,Set.mem_iUnion.mpr ⟨Sum.inr ⟨⟨⟨rfl⟩,p.1⟩⟩,?_⟩⟩ + rw [layerMap_new,characteristicPE_image_closedBall] + exact ⟨interior n p.2,cell_interior a p.1 p.2⟩ + +lemma layerCW_dimensions (hdim : ∀ m (_ : OldCell (X := X) m), m < n) + (m : ℕ) (i : (layerCW a hdim).cell m) : m < n+1 := by + cases i with + | inl i => exact (hdim m i).trans (Nat.lt_succ_self n) + | inr i => + obtain ⟨⟨⟨hm⟩,i⟩⟩ := i + subst m + exact Nat.lt_succ_self n + +lemma layerCW_finite_cells [Finite ι] + (hfin : ∀ m, Finite (OldCell (X := X) m)) + (hdim : ∀ m (_ : OldCell (X := X) m), m < n) (m : ℕ) : + Finite ((layerCW a hdim).cell m) := by + let := hfin m + change Finite (LayerCell (X := X) (ι := ι) (n := n) m) + infer_instance + +end + +section +open Set Metric Topology +universe u v w z +variable {X : Type u} [TopologicalSpace X] {ι : Type v} {n : ℕ} +variable (a : ι → C(Sphere n,X)) +variable {G : Type w} [Group G] [MulAction G X] [MulAction G ι] + +instance spaceMulAction : MulAction G (Space a) where + smul g := Sum.elim (fun x => Sum.inl (g • x)) (fun p => Sum.inr ⟨g • p.1,p.2⟩) + one_smul := by + intro x + cases x with + | inl x => change Sum.inl ((1 : G) • x) = Sum.inl x; rw [one_smul] + | inr p => change Sum.inr ⟨(1 : G) • p.1,p.2⟩ = Sum.inr p; rw [one_smul] + mul_smul := by + intro g h x + cases x with + | inl x => change Sum.inl ((g * h) • x) = Sum.inl (g • h • x); rw [mul_smul] + | inr p => change (Sum.inr ⟨(g * h) • p.1,p.2⟩ : Space a) = Sum.inr ⟨g • h • p.1,p.2⟩; rw [mul_smul] + +@[simp] lemma smul_base (g : G) (x : X) : g • base a x = base a (g • x) := rfl +@[simp] lemma smul_openCell (g : G) (i : ι) (x : OpenDisk n) : + g • openCell a i x = openCell a (g • i) x := rfl + +variable (ha : ∀ (g : G) i x, a (g • i) x = g • a i x) +include ha +lemma smul_cell (g : G) (i : ι) (d : Disk n) : + g • cell a i d = cell a (g • i) d := by + classical + by_cases hd : d.1 ∈ ball (0 : Fin n → ℝ) 1 + · have heq : d = interior n ⟨d.1,hd⟩ := rfl + rw [heq,cell_interior,cell_interior] + rfl + · let x : Sphere n := ⟨d.1,by + have hm := d.2 + simp only [mem_closedBall,mem_ball,mem_sphere] at * + exact le_antisymm hm (le_of_not_gt hd)⟩ + have heq : d = boundary n x := rfl + rw [heq,cell_boundary,cell_boundary,smul_base,ha] + +lemma continuousConstSMul [ContinuousConstSMul G X] : ContinuousConstSMul G (Space a) where + continuous_const_smul g := (continuous_iff a _).mpr ⟨ + (continuous_base a).comp (continuous_const_smul g),fun i => by + have heq : (g • ·) ∘ cell a i = cell a (g • i) := funext (smul_cell a ha g i) + rw [heq] + exact (cell a (g • i)).continuous⟩ + +omit ha in +lemma isOpen_iff (S : Set (Space a)) : + IsOpen S ↔ IsOpen (base a ⁻¹' S) ∧ ∀ i, IsOpen (cell a i ⁻¹' S) := by + change @IsOpen _ (TopologicalSpace.coinduced (quotient a) inferInstance) S ↔ _ + rw [isOpen_coinduced,isOpen_sum_iff,isOpen_sigma_iff] + rfl + +end + +open Set Metric Topology +universe u v w +abbrev Collar (n : ℕ) := {d : Disk n | (1 / 2 : ℝ) < ‖d.1‖} + +def collarInclusion (n : ℕ) : Collar n → Disk n := Subtype.val + +def radial (n : ℕ) : Collar n → Sphere n := fun d => + ⟨‖d.1.1‖⁻¹ • d.1.1,by + have hn : ‖d.1.1‖ ≠ 0 := ne_of_gt (lt_trans (by norm_num) d.2) + rw [mem_sphere,dist_zero_right,norm_smul,Real.norm_eq_abs,abs_inv,abs_norm, + inv_mul_cancel₀ hn]⟩ + +lemma continuous_radial (n : ℕ) : Continuous (radial n) := by + apply Continuous.subtype_mk + have hn : ∀ d : Collar n, ‖d.1.1‖ ≠ 0 := fun d => ne_of_gt (lt_trans (by norm_num) d.2) + exact ((continuous_subtype_val.comp continuous_subtype_val).norm.inv₀ hn).smul + (continuous_subtype_val.comp continuous_subtype_val) + +lemma collar_openEmbedding (n : ℕ) : IsOpenEmbedding (collarInclusion n) := + (isOpen_lt continuous_const continuous_subtype_val.norm).isOpenEmbedding_subtypeVal + +lemma radial_boundary (n : ℕ) (x : Sphere n) (h : (1/2:ℝ) < ‖(boundary n x).1‖) : + radial n ⟨boundary n x,h⟩ = x := by + apply Subtype.ext + have hx : ‖x.1‖ = 1 := by simpa only [mem_sphere,dist_zero_right] using x.2 + simp only [radial,boundary,hx,inv_one,one_smul] + +variable {X : Type u} [TopologicalSpace X] {ι : Type v} {n : ℕ} +variable (a : ι → C(Sphere n,X)) + +/-- An open old-space neighborhood thickened by the outer half of each disk. +Membership is tested by radial retraction of the disk to its attaching sphere. -/ +def thickening (U : Set X) : Set (Space a) := fun z => + match z with + | Sum.inl x => x ∈ U + | Sum.inr p => ∃ h : (1/2:ℝ) < ‖p.2.1‖, + a p.1 (radial n ⟨interior n p.2,h⟩) ∈ U + +@[simp] lemma base_mem_thickening (U : Set X) (x : X) : + base a x ∈ thickening a U ↔ x ∈ U := Iff.rfl + +lemma cell_preimage_thickening (U : Set X) (i : ι) : + cell a i ⁻¹' thickening a U = + collarInclusion n '' ((a i ∘ radial n) ⁻¹' U) := by + classical + ext d + by_cases hd : d.1 ∈ ball (0 : Fin n → ℝ) 1 + · have heq : d = interior n ⟨d.1,hd⟩ := rfl + rw [heq] + simp only [Set.mem_preimage,cell_interior,Set.mem_image] + constructor + · rintro ⟨h,hh⟩ + exact ⟨⟨d,h⟩,hh,rfl⟩ + · rintro ⟨y,hy,he⟩ + have heq' : y.1 = d := he + subst d + exact ⟨y.2,hy⟩ + · let x : Sphere n := ⟨d.1,by + have hm := d.2 + simp only [mem_closedBall,mem_ball,mem_sphere] at * + exact le_antisymm hm (le_of_not_gt hd)⟩ + have heq : d = boundary n x := rfl + have hx : ‖x.1‖ = 1 := by simpa only [mem_sphere,dist_zero_right] using x.2 + have hhalf : (1/2:ℝ) < ‖(boundary n x).1‖ := by change (1/2:ℝ) < ‖x.1‖; rw [hx]; norm_num + rw [heq] + simp only [Set.mem_preimage,cell_boundary,base_mem_thickening,Set.mem_image] + constructor + · intro h + exact ⟨⟨boundary n x,hhalf⟩,by simpa only [Function.comp_apply,radial_boundary] using h,rfl⟩ + · rintro ⟨y,hy,he⟩ + have heq' : y = ⟨boundary n x,hhalf⟩ := Subtype.ext he + simpa only [heq',Function.comp_apply,radial_boundary] using hy + +lemma thickening_isOpen {U : Set X} (hU : IsOpen U) : IsOpen (thickening a U) := by + rw [isOpen_iff] + refine ⟨hU,fun i => ?_⟩ + rw [cell_preimage_thickening] + exact (collar_openEmbedding n).isOpenMap _ + (hU.preimage ((a i).continuous.comp (continuous_radial n))) + +variable {G : Type w} [Group G] [MulAction G X] [MulAction G ι] +variable (ha : ∀ (g : G) i x, a (g • i) x = g • a i x) +include ha +lemma thickening_disjoint {U : Set X} + (hU : ∀ g : G, ((g • ·) '' U ∩ U).Nonempty → g = 1) : + ∀ g : G, ((g • ·) '' thickening a U ∩ thickening a U).Nonempty → g = 1 := by + intro g h + obtain ⟨_,⟨z,hz,rfl⟩,hgz⟩ := h + cases z with + | inl x => exact hU g ⟨g • x,⟨x,hz,rfl⟩,hgz⟩ + | inr p => + obtain ⟨hhalf,hz⟩ := hz + obtain ⟨_,hgz⟩ := hgz + change a (g • p.1) (radial n ⟨interior n p.2,hhalf⟩) ∈ U at hgz + rw [ha] at hgz + exact hU g ⟨g • a p.1 (radial n ⟨interior n p.2,hhalf⟩),⟨_,hz,rfl⟩,hgz⟩ + +lemma exists_disjoint_nhds [IsCancelSMul G ι] + (hX : ∀ x : X, ∃ U ∈ 𝓝 x, ∀ g : G, ((g • ·) '' U ∩ U).Nonempty → g = 1) : + ∀ z : Space a, ∃ U ∈ 𝓝 z, ∀ g : G, ((g • ·) '' U ∩ U).Nonempty → g = 1 := by + intro z + cases z with + | inl x => + obtain ⟨U,hUx,hU⟩ := hX x + obtain ⟨V,hVU,hV,hxV⟩ := mem_nhds_iff.mp hUx + refine ⟨thickening a V,(thickening_isOpen a hV).mem_nhds hxV, + thickening_disjoint a ha (fun g hg => hU g ?_)⟩ + exact hg.mono (Set.inter_subset_inter (Set.image_mono hVU) hVU) + | inr p => + refine ⟨Set.range (openCell a p.1),(openCell_openEmbedding a p.1).isOpen_range.mem_nhds + (Set.mem_range_self p.2),?_⟩ + intro g hg + obtain ⟨_,⟨_,⟨x,rfl⟩,rfl⟩,⟨y,hy⟩⟩ := hg + have hi : p.1 = g • p.1 := congrArg Sigma.fst (Sum.inr_injective hy) + apply IsCancelSMul.right_cancel g 1 p.1 + simpa only [one_smul] using hi.symm + +end GroupRingTopology.Attachment + +end + +end OAI diff --git a/lean/OAI/Algebra/GroupRing/AttachmentFurther.lean b/lean/OAI/Algebra/GroupRing/AttachmentFurther.lean new file mode 100644 index 0000000000000000000000000000000000000000..f37426b3221c6b2bdd8a0632c8b3be7b16943f0f --- /dev/null +++ b/lean/OAI/Algebra/GroupRing/AttachmentFurther.lean @@ -0,0 +1,414 @@ +import Mathlib +import OAI.Algebra.GroupRing.CellularFurther + +namespace OAI + +noncomputable section + +open Set Metric Topology BigOperators +open Set Metric Topology +open Set Topology +open Set Metric Topology +open scoped NNReal +open Set Metric Topology +open scoped NNReal ENNReal + +namespace GroupRingTopology.Attachment + +section +open Set Metric Topology +variable {X : Type*} [TopologicalSpace X] {ι : Type*} {n : ℕ} +variable (a : ι → C(Sphere n,X)) [T2Space (Space a)] + +lemma sphere_filling_preserved {m : ℕ} (hm : m < n) + (hX : ∀ f : C(Sphere (m+1),X), SphereTopology.Extends f) + (f : C(Sphere (m+1),Space a)) : SphereTopology.Extends f := by + let := SphereTopology.sphere_nonempty m + have hdim : dimH (Set.univ : Set (Sphere (m+1))) < n := + (GeneralPosition.dimH_cube_boundary_subtype_le m).trans_lt (by exact_mod_cast hm) + obtain ⟨g,H,_⟩ := exists_deformation_into_base a f hdim + apply SphereTopology.extends_of_homotopy H + obtain ⟨F,hF⟩ := hX g + refine ⟨(⟨base a,continuous_base a⟩ : C(X,Space a)).comp F,?_⟩ + ext x + exact congrArg (base a) (ContinuousMap.congr_fun hF x) + +lemma dimH_disk_subtype_le (m : ℕ) : dimH (Set.univ : Set (Disk m)) ≤ m := by + rw [← isometry_subtype_coe.dimH_image] + have hm := dimH_mono (Set.subset_univ (closedBall (0 : Fin m → ℝ) 1)) + simpa only [Set.image_univ,Subtype.range_coe_subtype,Set.ofPred_mem_eq,Real.dimH_univ_pi_fin] using hm + +/-- Relative cellular approximation implies that a low-dimensional sphere that +bounds after a high-dimensional attachment already bounded beforehand. -/ +lemma filling_reflected {m : ℕ} (hm : m < n) (b : C(Sphere m,X)) + (hb : SphereTopology.Extends ((⟨base a,continuous_base a⟩ : C(X,Space a)).comp b)) : + SphereTopology.Extends b := by + obtain ⟨F,hF⟩ := hb + have hdim : dimH (Set.univ : Set (Disk m)) < n := + (dimH_disk_subtype_le m).trans_lt (by exact_mod_cast hm) + obtain ⟨g,H,hstat⟩ := exists_deformation_into_base a F hdim + refine ⟨g,?_⟩ + ext x + apply (base_closedEmbedding a).injective + have hb' : F (SphereTopology.boundary m x) = base a (b x) := ContinuousMap.congr_fun hF x + have hh := hstat 1 (SphereTopology.boundary m x) ⟨b x,hb'.symm⟩ + simpa only [ContinuousMap.Homotopy.apply_one,ContinuousMap.comp_apply,ContinuousMap.coe_mk,hb'] using hh + +end +open Set Metric Topology +variable {X : Type*} [TopologicalSpace X] [PathConnectedSpace X] +variable {ι : Type*} {n : ℕ} (a : ι → C(Sphere n,X)) [Nonempty (Sphere n)] +lemma pathConnectedSpace : PathConnectedSpace (Space a) := by + let x₀ : X := Classical.choice inferInstance + let s₀ : Sphere n := Classical.choice inferInstance + have hj : ∀ z : Space a, Joined (base a x₀) z := by + intro z + cases z with + | inl x => exact (PathConnectedSpace.joined x₀ x).map (continuous_base a) + | inr p => + have h : Joined (boundary n s₀) (interior n p.2) := PathConnectedSpace.joined _ _ + have hh := h.map (cell a p.1).continuous + rw [cell_interior,cell_boundary] at hh + exact ((PathConnectedSpace.joined x₀ (a p.1 s₀)).map (continuous_base a)).trans hh + exact ⟨⟨base a x₀⟩,fun x y => (hj x).symm.trans (hj y)⟩ +end GroupRingTopology.Attachment + +namespace GroupRingTopology.Cayley +open Set Metric Topology Attachment +universe u +variable {G : Type u} [Group G] [TopologicalSpace G] [DiscreteTopology G] +variable {S : Type u} (s : S → G) (rels : Set (FreeGroup S)) +variable (hrel : ∀ r ∈ rels, FreeGroup.lift s r = 1) +variable (hs : Function.Surjective (FreeGroup.lift s)) +variable (hker : (FreeGroup.lift s).ker = Subgroup.normalClosure rels) + +instance presentationCoverT2 : T2Space (PresentationCover s rels hrel) := + t2Space _ (realSeparated _ (realSeparated_of_tychonoff (Y := G))) + +instance presentationCoverCW : CWComplex (Set.univ : Set (PresentationCover s rels hrel)) := + layerCW _ (graph_dimension s) + +include hs in +lemma presentationCover_pathConnected : PathConnectedSpace (PresentationCover s rels hrel) := by + have hgen : Subgroup.closure (Set.range s) = ⊤ := by + rw [←FreeGroup.range_lift_eq_closure,MonoidHom.range_eq_top] + exact hs + let := graph_pathConnected s hgen + let := SphereTopology.sphere_nonempty 1 + exact Attachment.pathConnectedSpace _ + +include hs hker in +lemma presentationCover_sphereFill (b : C(Sphere 2,PresentationCover s rels hrel)) : SphereTopology.Extends b := by + let := SphereTopology.sphere_nonempty 1 + have hdim : dimH (Set.univ : Set (Sphere 2)) < 2 := + (GeneralPosition.dimH_cube_boundary_subtype_le 1).trans_lt (by norm_num) + obtain ⟨g,H,_⟩ := exists_deformation_into_base _ b hdim + apply SphereTopology.extends_of_homotopy H + exact SphereTopology.extends_of_nullhomotopic + (((presentationGraphNullhomotopy s rels hrel hs hker).compContinuousMap g).symm) + +include hs hker in +lemma presentationCover_simplyConnected : SimplyConnectedSpace (PresentationCover s rels hrel) := by + apply simply_connected_iff_loops_nullhomotopic.mpr + refine ⟨presentationCover_pathConnected s rels hrel hs,?_⟩ + intro x p + obtain ⟨F,hF⟩ := presentationCover_sphereFill s rels hrel hs hker (LoopSphere.map p) + apply LoopSphere.homotopic_of_fill p F + intro z + exact ContinuousMap.congr_fun hF z +end GroupRingTopology.Cayley + +namespace GroupRingTopology +universe u v +variable {G : Type u} [Group G] {A : Type v} [MulAction G A] + +abbrev Orbits := Quotient (MulAction.orbitRel G A) + +lemma orbit_mk_smul (g : G) (a : A) : (Quotient.mk'' (g • a) : Orbits (G := G) (A := A)) = Quotient.mk'' a := by + apply Quotient.sound + exact ⟨g,rfl⟩ + +lemma orbit_out_translate (a : A) : ∃ g : G, a = g • (Quotient.mk'' a : Orbits (G := G)).out := by + have h := Quotient.exact (Quotient.out_eq' (q := (Quotient.mk'' a : Orbits (G := G)))) + obtain ⟨g,hg⟩ := h + refine ⟨g⁻¹,?_⟩ + rw [←hg,inv_smul_smul] + +variable (hfree : ∀ (g : G) (a : A), g • a = a → g = 1) + +include hfree in +lemma orbitCoordinates_bijective : Function.Bijective (fun p : G × Orbits (G := G) (A := A) => p.1 • p.2.out) := by + constructor + · rintro ⟨g,q⟩ ⟨h,r⟩ he + have hqr : q = r := by + have hh := congrArg (fun a : A => (Quotient.mk'' a : Orbits (G := G))) he + simpa only [orbit_mk_smul,Quotient.out_eq'] using hh + subst r + change g • q.out = h • q.out at he + have hh : (h⁻¹*g) • q.out = q.out := by rw [mul_smul,he,inv_smul_smul] + have hh := hfree (h⁻¹*g) q.out hh + have hgh : g = h := (inv_mul_eq_one.mp hh).symm + exact Prod.ext hgh rfl + · intro a + obtain ⟨g,hg⟩ := orbit_out_translate (G := G) a + exact ⟨(g,Quotient.mk'' a),hg.symm⟩ + +def orbitCoordinates : (G × Orbits (G := G) (A := A)) ≃ A := + Equiv.ofBijective _ (orbitCoordinates_bijective hfree) + +lemma orbitCoordinates_apply (g : G) (q : Orbits (G := G) (A := A)) : + orbitCoordinates hfree (g,q) = g • q.out := rfl + +end GroupRingTopology + +open Set Metric Topology +namespace GroupRingTopology.Cellular +universe u +variable {G : Type u} [Group G] {X : Type u} [TopologicalSpace X] + [MulAction G X] [ContinuousConstSMul G X] +variable [CWComplex (univ : Set X)] {ι : ℕ → Type u} +variable (σ : ∀ n, (G × ι n) ≃ RelCWComplex.cell (univ : Set X) n) + +def actionChart (n : ℕ) (i : G × ι n) : PartialEquiv (Fin n → ℝ) X := + (RelCWComplex.map n (σ n (1,i.2))).trans (Homeomorph.smul i.1).toEquiv.toPartialEquiv + +lemma actionChart_apply (n : ℕ) (i : G × ι n) (x : Fin n → ℝ) : + actionChart σ n i x = i.1 • RelCWComplex.map n (σ n (1,i.2)) x := rfl + +lemma actionChart_image (n : ℕ) (i : G × ι n) (A : Set (Fin n → ℝ)) : + actionChart σ n i '' A = (fun x : X => i.1 • x) '' (RelCWComplex.map n (σ n (1,i.2)) '' A) := + Set.image_comp (fun x : X => i.1 • x) (RelCWComplex.map n (σ n (1,i.2))) A + +lemma actionChart_source (n : ℕ) (i : G × ι n) : + (actionChart σ n i).source = ball 0 1 := by + simp [actionChart,PartialEquiv.trans_source,RelCWComplex.source_eq] + +lemma actionChart_continuousOn (n : ℕ) (i : G × ι n) : + ContinuousOn (actionChart σ n i) (closedBall 0 1) := + (continuous_const_smul i.1).comp_continuousOn (RelCWComplex.continuousOn _ _) + +lemma actionChart_continuousOn_symm (n : ℕ) (i : G × ι n) : + ContinuousOn (actionChart σ n i).symm (actionChart σ n i).target := by + change ContinuousOn (fun y => (RelCWComplex.map n (σ n (1,i.2))).symm (i.1⁻¹ • y)) + (univ ∩ (fun y : X => i.1⁻¹ • y) ⁻¹' (RelCWComplex.map n (σ n (1,i.2))).target) + exact (RelCWComplex.continuousOn_symm _ _).comp (continuous_const_smul _).continuousOn + (fun _ h => h.2) + +variable + (ho : ∀ n (g : G) (i : ι n), + (fun x : X => g • x) '' RelCWComplex.openCell n (σ n (1,i)) = RelCWComplex.openCell n (σ n (g,i))) + (hc : ∀ n (g : G) (i : ι n), + (fun x : X => g • x) '' RelCWComplex.closedCell n (σ n (1,i)) = RelCWComplex.closedCell n (σ n (g,i))) + +include ho in +lemma actionChart_open (n : ℕ) (i : G × ι n) : + actionChart σ n i '' ball 0 1 = RelCWComplex.openCell n (σ n i) := by + rw [actionChart_image] + exact ho n i.1 i.2 + +include hc in +lemma actionChart_closed (n : ℕ) (i : G × ι n) : + actionChart σ n i '' closedBall 0 1 = RelCWComplex.closedCell n (σ n i) := by + rw [actionChart_image] + exact hc n i.1 i.2 + +omit [ContinuousConstSMul G X] in +include hc in +lemma closedCell_smul (n : ℕ) (g h : G) (i : ι n) : + (fun x : X => g • x) '' RelCWComplex.closedCell n (σ n (h,i)) = + RelCWComplex.closedCell n (σ n (g*h,i)) := by + rw [←hc n h i,←Set.image_comp] + simpa only [Function.comp_def,mul_smul] using hc n (g*h) i + +variable [T2Space X] + +/-- A free permutation of cell orbits can be made strictly equivariant at the +level of characteristic maps. This changes neither the space nor the cells. -/ +@[instance_reducible] +def actionCW : CWComplex (univ : Set X) where + cell n := G × ι n + map := actionChart σ + source_eq := actionChart_source σ + continuousOn := actionChart_continuousOn σ + continuousOn_symm := actionChart_continuousOn_symm σ + pairwiseDisjoint' := by + intro p _ q _ hpq + change Disjoint (actionChart σ p.1 p.2 '' ball 0 1) (actionChart σ q.1 q.2 '' ball 0 1) + rw [actionChart_open σ ho,actionChart_open σ ho] + apply CWComplex.disjoint_openCell_of_ne + intro he + apply hpq + cases p with | mk n i => + cases q with | mk m j => + have hnm : n = m := congrArg Sigma.fst he + subst m + have hij : σ n i = σ n j := (Sigma.mk.inj he).2 |> eq_of_heq + exact congrArg (Sigma.mk n) ((σ n).injective hij) + mapsTo' := by + classical + intro n i + obtain ⟨I,hI⟩ := CWComplex.cellFrontier_subset_finite_closedCell n (σ n (1,i.2)) + let f (m : ℕ) (j : RelCWComplex.cell (univ : Set X) m) : G × ι m := + (i.1 * ((σ m).symm j).1,((σ m).symm j).2) + refine ⟨fun m => (I m).image (f m),?_⟩ + intro x hx + have h := hI (show RelCWComplex.map n (σ n (1,i.2)) x ∈ RelCWComplex.cellFrontier n (σ n (1,i.2)) from ⟨x,hx,rfl⟩) + simp only [Set.mem_iUnion] at h + obtain ⟨m,hm,j,hj,hxj⟩ := h + refine Set.mem_iUnion.mpr ⟨m,Set.mem_iUnion.mpr ⟨hm,Set.mem_iUnion.mpr + ⟨f m j,Set.mem_iUnion.mpr ⟨Finset.mem_image.mpr ⟨j,hj,rfl⟩,?_⟩⟩⟩⟩ + rw [actionChart_closed σ hc] + change i.1 • RelCWComplex.map n (σ n (1,i.2)) x ∈ RelCWComplex.closedCell m + (σ m (i.1 * ((σ m).symm j).1,((σ m).symm j).2)) + rw [←closedCell_smul σ hc] + refine ⟨_,?_,rfl⟩ + simpa only [Prod.eta,Equiv.apply_symm_apply] using hxj + closed' := by + intro A hA hclosed + apply (CWComplex.closed (univ : Set X) A hA).mpr + intro n j + obtain ⟨i,rfl⟩ := (σ n).surjective j + simpa only [actionChart_closed σ hc] using hclosed n i + union' := by + simp only [actionChart_closed σ hc] + have he (n : ℕ) : (⋃ j : G × ι n, RelCWComplex.closedCell n (σ n j)) = + ⋃ j : RelCWComplex.cell (univ : Set X) n, RelCWComplex.closedCell n j := by + ext x + simp only [mem_iUnion] + constructor + · rintro ⟨j,hj⟩; exact ⟨σ n j,hj⟩ + · rintro ⟨j,hj⟩; exact ⟨(σ n).symm j,by simpa only [Equiv.apply_symm_apply] using hj⟩ + simp_rw [he] + exact CWComplex.union + +omit [T2Space X] in +lemma actionChart_smul (n : ℕ) (g : G) (i : G × ι n) (x : Fin n → ℝ) : + actionChart σ n (g*i.1,i.2) x = g • actionChart σ n i x := by + exact mul_smul _ _ _ +end GroupRingTopology.Cellular + +namespace GroupRingTopology.Milnor +open Set Metric Topology GroupRingTopology.Simplicial +universe u +variable (G : Type u) [Group G] +local instance (priority := 2000) (α : Type*) : DecidableEq (ℕ × α) := Classical.decEq (ℕ × α) + +lemma vertexTranslate_injective (g : G) : Function.Injective (fun v : ℕ × G => (v.1,g*v.2)) := by + rintro ⟨i,a⟩ ⟨j,b⟩ h + change (i,g*a) = (j,g*b) at h + apply Prod.ext + · simpa only using congrArg (fun v : ℕ × G => v.1) h + · exact mul_left_cancel (congrArg Prod.snd h) + +lemma translate_card (g : G) (s : Finset (ℕ × G)) : (translate g s).card = s.card := + Finset.card_image_of_injective _ (vertexTranslate_injective G g) + +abbrev StageCell (S : Shapes G) (n : ℕ) := Simplicial.Cell (stage G S) n + +def cellTranslate (S : Shapes G) (n : ℕ) (g : G) (c : StageCell G S n) : StageCell G S n := + ⟨⟨translate g c.1.1,orbitSpan_invariant _ g c.1.2⟩,by rw [translate_card]; exact c.2⟩ + +instance cellAction (S : Shapes G) (n : ℕ) : MulAction G (StageCell G S n) where + smul := cellTranslate G S n + one_smul c := by apply Subtype.ext; apply Subtype.ext; exact translate_one _ + mul_smul g h c := by apply Subtype.ext; apply Subtype.ext; exact (translate_mul _ _ _).symm + +lemma cell_smul_val (S : Shapes G) (n : ℕ) (g : G) (c : StageCell G S n) : + (g • c).1.1 = translate g c.1.1 := rfl + +lemma cellAction_free (S : Shapes G) (n : ℕ) (g : G) (c : StageCell G S n) + (h : g • c = c) : g = 1 := by + have he : translate g c.1.1 = c.1.1 := congrArg (fun c : StageCell G S n => c.1.1) h + obtain ⟨v,hv⟩ := c.1.2.1.1 + have ht : (v.1,g*v.2) ∈ c.1.1 := he ▸ Finset.mem_image.mpr ⟨v,hv,rfl⟩ + have heq := c.1.2.1.2 ht hv rfl + have hg : g * v.2 = v.2 := congrArg Prod.snd heq + exact mul_right_cancel (hg.trans (one_mul _).symm) + +abbrev CellOrbits (S : Shapes G) (n : ℕ) := Orbits (G := G) (A := StageCell G S n) + +def cellCoordinates (S : Shapes G) (n : ℕ) : (G × CellOrbits G S n) ≃ StageCell G S n := + orbitCoordinates (cellAction_free G S n) + +lemma cellCoordinates_apply (S : Shapes G) (n : ℕ) (g : G) (c : CellOrbits G S n) : + cellCoordinates G S n (g,c) = g • c.out := rfl + +instance cellOrbits_finite (S : Shapes G) (n : ℕ) : Finite (CellOrbits G S n) := by + classical + obtain ⟨T,hT⟩ := orbitSpan_finite_representatives (basedShapes G S) + let R : Set (StageCell G S n) := {c | c.1.1 ∈ T} + have hinj : Function.Injective (fun c : StageCell G S n => c.1.1) := by + intro c d h; exact Subtype.ext (Subtype.ext h) + have hR : R.Finite := T.finite_toSet.preimage hinj.injOn + let := hR.fintype + apply Finite.of_surjective (fun c : R => (Quotient.mk'' c.1 : CellOrbits G S n)) + intro q + obtain ⟨s,hs,g,hg⟩ := hT q.out.1.1 q.out.1.2 + let c : StageCell G S n := g⁻¹ • q.out + have hc : c ∈ R := by + change translate g⁻¹ q.out.1.1 ∈ T + rw [hg,translate_mul,inv_mul_cancel,translate_one] + exact hs + refine ⟨⟨c,hc⟩,?_⟩ + exact (orbit_mk_smul g⁻¹ q.out).trans (Quotient.out_eq' _) + +lemma stage_smul_support (S : Shapes G) (g : G) (x : Stage G S) : + (g • x).1.support = translate g x.1.support := + Finsupp.mapDomain_support_of_injective (vertexTranslate_injective G g) _ + +lemma stage_openCell (S : Shapes G) (n : ℕ) (c : StageCell G S n) : + RelCWComplex.openCell (C := (univ : Set (Stage G S))) n c = {x : Stage G S | x.1.support = c.1.1} := + Simplicial.characteristicPE_open _ _ + +lemma stage_closedCell (S : Shapes G) (n : ℕ) (c : StageCell G S n) : + RelCWComplex.closedCell (C := (univ : Set (Stage G S))) n c = {x : Stage G S | x.1.support ⊆ c.1.1} := by + change Simplicial.characteristicPE _ c '' closedBall 0 1 = _ + rw [Simplicial.characteristicPE_closed,Simplicial.range_faceMap] + +lemma stage_openCell_smul (S : Shapes G) (n : ℕ) (g : G) (c : StageCell G S n) : + (fun x : Stage G S => g • x) '' RelCWComplex.openCell (C := (univ : Set (Stage G S))) n c = RelCWComplex.openCell (C := (univ : Set (Stage G S))) n (g • c) := by + rw [stage_openCell,stage_openCell] + ext x + constructor + · rintro ⟨y,hy,rfl⟩ + change (g • y).1.support = (g • c).1.1 + rw [stage_smul_support,cell_smul_val,hy] + · intro hx + refine ⟨g⁻¹ • x,?_,smul_inv_smul _ _⟩ + change (g⁻¹ • x).1.support = c.1.1 + change x.1.support = translate g c.1.1 at hx + rw [stage_smul_support,hx,translate_mul,inv_mul_cancel,translate_one] + +lemma stage_closedCell_smul (S : Shapes G) (n : ℕ) (g : G) (c : StageCell G S n) : + (fun x : Stage G S => g • x) '' RelCWComplex.closedCell (C := (univ : Set (Stage G S))) n c = RelCWComplex.closedCell (C := (univ : Set (Stage G S))) n (g • c) := by + rw [stage_closedCell,stage_closedCell] + ext x + constructor + · rintro ⟨y,hy,rfl⟩ + change (g • y).1.support ⊆ (g • c).1.1 + rw [stage_smul_support,cell_smul_val] + exact translate_mono _ hy + · intro hx + refine ⟨g⁻¹ • x,?_,smul_inv_smul _ _⟩ + change (g⁻¹ • x).1.support ⊆ c.1.1 + rw [stage_smul_support] + have h := translate_mono g⁻¹ hx + simpa only [cell_smul_val,translate_mul,inv_mul_cancel,translate_one] using h + +@[instance_reducible] +def stageEquivariantCW (S : Shapes G) : CWComplex (univ : Set (Stage G S)) := + Cellular.actionCW (cellCoordinates G S) + (fun n g i => by + change (fun x : Stage G S => g • x) '' RelCWComplex.openCell (C := (univ : Set (Stage G S))) n ((1:G) • i.out) = RelCWComplex.openCell (C := (univ : Set (Stage G S))) n (g • i.out) + rw [one_smul] + exact stage_openCell_smul G S n g i.out) + (fun n g i => by + change (fun x : Stage G S => g • x) '' RelCWComplex.closedCell (C := (univ : Set (Stage G S))) n ((1:G) • i.out) = RelCWComplex.closedCell (C := (univ : Set (Stage G S))) n (g • i.out) + rw [one_smul] + exact stage_closedCell_smul G S n g i.out) + +end GroupRingTopology.Milnor + +end + +end OAI diff --git a/lean/OAI/Algebra/GroupRing/AttachmentHEP.lean b/lean/OAI/Algebra/GroupRing/AttachmentHEP.lean new file mode 100644 index 0000000000000000000000000000000000000000..688984ca9cfe8a9217ecbb761b34d384fa14006a --- /dev/null +++ b/lean/OAI/Algebra/GroupRing/AttachmentHEP.lean @@ -0,0 +1,69 @@ +import Mathlib +import OAI.Algebra.GroupRing.HomotopyFunctor +import OAI.Algebra.GroupRing.CellHEP + +namespace OAI + + + +section +namespace TorsionFreeZeroDivisors.AttachmentHEP +open Set Metric Topology GroupRingTopology GroupRingTopology.Attachment +open scoped unitInterval +noncomputable section +universe u v w +variable {X : Type u} {Y : Type v} {J : Type w} [TopologicalSpace X] [TopologicalSpace Y] +variable {n : ℕ} (a : J→C(Sphere n,X)) (f : C(Space a,Y)) + (H : C(unitInterval × X,Y)) (h : ∀x,H (0,x)=f (base a x)) +def eval (t : unitInterval) : C(C(unitInterval,Y),Y) := ⟨fun p=>p t,continuous_eval_const t⟩ +def basePaths : C(X,C(unitInterval,Y)) := H.comp ⟨Prod.swap,continuous_swap⟩ |>.curry +def cellPaths (i : J) : C(Disk n,C(unitInterval,Y)) := + ((CellHEP.extension (f.comp (cell a i)) + (H.comp ⟨fun z : unitInterval × Sphere n=>(z.1,a i z.2), + continuous_fst.prodMk ((a i).continuous.comp continuous_snd)⟩) + (fun x=>by change H (0,a i x)=f (cell a i (boundary n x));rw [h,cell_boundary])).comp + ⟨Prod.swap,continuous_swap⟩).curry +lemma cellPaths_boundary (i : J) (x : Sphere n) : + cellPaths a f H h i (boundary n x)=basePaths H (a i x) := by + apply ContinuousMap.ext + intro t + dsimp only [cellPaths,basePaths,ContinuousMap.curry_apply,ContinuousMap.comp_apply,ContinuousMap.coe_mk,Prod.swap] + change CellHEP.extension _ _ _ (t,Cellular.boundary n x)=_ + rw [CellHEP.extension_boundary] + rfl +lemma cellPaths_zero (i : J) (d : Disk n) : cellPaths a f H h i d 0=f (cell a i d) := by + dsimp only [cellPaths,ContinuousMap.curry_apply,ContinuousMap.comp_apply,ContinuousMap.coe_mk,Prod.swap] + rw [CellHEP.extension_zero] + rfl +def paths : C(Space a,C(unitInterval,Y)) := + lift a (basePaths H) (cellPaths a f H h) (cellPaths_boundary a f H h) +lemma paths_base (x : X) (t : unitInterval) : paths a f H h (base a x) t=H (t,x) := rfl +lemma paths_zero (x : Space a) : paths a f H h x 0=f x := by + have he : (eval 0).comp (paths a f H h)=f := by + apply lift_unique a + · intro x + exact h x + · intro i d + change paths a f H h (cell a i d) 0=f (cell a i d) + rw [paths,lift_cell] + exact cellPaths_zero a f H h i d + exact ContinuousMap.congr_fun he x +/-- Homotopy extension for a genuine disk attachment with arbitrarily many +cells. Currying into the compact-open path space respects the weak topology. -/ +def extend : C(unitInterval × Space a,Y) := (paths a f H h).uncurry.comp ⟨Prod.swap,continuous_swap⟩ +lemma extend_base (t : unitInterval) (x : X) : extend a f H h (t,base a x)=H (t,x) := rfl +lemma extend_zero (x : Space a) : extend a f H h (0,x)=f x := paths_zero a f H h x +def endpoint : C(Space a,Y) := (eval 1).comp (paths a f H h) +def homotopy : f.Homotopy (endpoint a f H h) where + toContinuousMap := extend a f H h + map_zero_left := extend_zero a f H h + map_one_left _ := rfl +lemma endpoint_base (x : X) : endpoint a f H h (base a x)=H (1,x) := rfl +end +end TorsionFreeZeroDivisors.AttachmentHEP + +end + + + +end OAI diff --git a/lean/OAI/Algebra/GroupRing/BFSTree.lean b/lean/OAI/Algebra/GroupRing/BFSTree.lean new file mode 100644 index 0000000000000000000000000000000000000000..cd838a466a86af67330ff1c00ee5dcfe03b8c787 --- /dev/null +++ b/lean/OAI/Algebra/GroupRing/BFSTree.lean @@ -0,0 +1,426 @@ +import Mathlib +import OAI.Algebra.GroupRing.ConedMap + +namespace OAI + +noncomputable section + +namespace TorsionFreeZeroDivisors.ConedMap +open scoped Classical +open PermutationCycles MapEuler +variable {O : Type} [Fintype O] (σ α : Equiv.Perm O) (ha : Function.Involutive α) +local notation "ρ" => rotation σ α +local notation "π" => pairing α +local notation "G" => graph σ α ha +local notation "G'" => graph ρ π (pairing_involutive α ha) + +def oldVertex (v : Cycle σ) : Cycle ρ := (vertexEquiv σ α).symm (.inl v) +def centerVertex (f : Cycle (α*σ)) : Cycle ρ := (vertexEquiv σ α).symm (.inr f) +lemma oldVertex_injective : Function.Injective (oldVertex σ α) := + (vertexEquiv σ α).symm.injective.comp Sum.inl_injective +lemma centerVertex_injective : Function.Injective (centerVertex σ α) := + (vertexEquiv σ α).symm.injective.comp Sum.inr_injective +lemma old_ne_center (v : Cycle σ) (f : Cycle (α*σ)) : oldVertex σ α v≠centerVertex σ α f := by + intro he + have hh := (vertexEquiv σ α).symm.injective he + exact Sum.inl_ne_inr hh + +@[simp] lemma oldVertex_cycle (x : O) : oldVertex σ α (cycle σ x)=cycle ρ (old x) := rfl +@[simp] lemma centerVertex_cycle (x : O) : centerVertex σ α (cycle (α*σ) x)=cycle ρ (center x) := rfl + +lemma old_adj {v w : Cycle σ} (he : (G).Adj v w) : (G').Adj (oldVertex σ α v) (oldVertex σ α w) := by + obtain ⟨hne,x,hx,hy⟩ := he + refine ⟨(oldVertex_injective σ α).ne hne,old x,?_,?_⟩ + · rw [←oldVertex_cycle,hx] + · rw [pairing_old,←oldVertex_cycle,hy] + +lemma radial_adj (x : O) : (G').Adj (oldVertex σ α (cycle σ x)) + (centerVertex σ α (cycle (α*σ) x)) := by + refine ⟨old_ne_center σ α _ _,radial x,?_,?_⟩ + · rw [vertex_radial,oldVertex_cycle] + · rw [pairing_radial,centerVertex_cycle] + +def oldHom : G →g G' := ⟨oldVertex σ α,fun h=>old_adj σ α ha h⟩ + +theorem connected (hc : (G).Connected) : (G').Connected := by + apply connected_of_component_card_one + rw [Nat.card_congr (componentEquiv σ α)] + exact component_card_one_of_connected σ α ha hc + +lemma old_distance_le (hc : (G).Connected) (v w : Cycle σ) : + (G').dist (oldVertex σ α v) (oldVertex σ α w)≤(G).dist v w := by + obtain ⟨p,hp⟩ := hc.exists_walk_length_eq_dist v w + have hh := (G').dist_le (p.map (oldHom σ α ha)) + rwa [SimpleGraph.Walk.length_map,hp] at hh + +lemma center_distance_le (hc : (G).Connected) (root : Cycle σ) (r : ℕ) + (hr : ∀ v,(G).dist root v≤r) (f : Cycle (α*σ)) : + (G').dist (oldVertex σ α root) (centerVertex σ α f)≤r+1 := by + obtain ⟨x,rfl⟩ := cycle_surjective (α*σ) f + have hh := (connected σ α ha hc).dist_triangle + (u:=oldVertex σ α root) (v:=oldVertex σ α (cycle σ x)) + (w:=centerVertex σ α (cycle (α*σ) x)) + rw [SimpleGraph.dist_eq_one_iff_adj.mpr (radial_adj σ α ha x)] at hh + exact hh.trans (Nat.add_le_add_right ((old_distance_le σ α ha hc _ _).trans (hr _)) _) + +def oldEmbedding : Cycle σ ↪ Cycle ρ := ⟨oldVertex σ α,oldVertex_injective σ α⟩ +def liftSet (s : Finset (Cycle σ)) : Finset (Cycle ρ) := s.map (oldEmbedding σ α) +lemma liftSet_card (s : Finset (Cycle σ)) : (liftSet σ α s).card=s.card := Finset.card_map _ +lemma old_mem_liftSet (s : Finset (Cycle σ)) (v : Cycle σ) : + oldVertex σ α v∈liftSet σ α s ↔ v∈s := Finset.mem_map' (oldEmbedding σ α) +lemma center_not_liftSet (s : Finset (Cycle σ)) (f : Cycle (α*σ)) : + centerVertex σ α f∉liftSet σ α s := by + intro hf + obtain ⟨v,_,hv⟩ := Finset.mem_map.mp hf + exact old_ne_center σ α v f hv + +/-- Distances to zero-cost auxiliary centers incur one extra step, but all +original vertices remain within the original radius. -/ +theorem distance_cost (hc : (G).Connected) (root : Cycle σ) (r : ℕ) + (hr : ∀ v,(G).dist root v≤r) (v : Cycle ρ) : + (G').dist (oldVertex σ α root) v + (if v∈liftSet σ α Finset.univ then 1 else 0)≤r+1 := by + obtain ⟨q,rfl⟩ := (vertexEquiv σ α).symm.surjective v + rcases q with v|f + · change (G').dist (oldVertex σ α root) (oldVertex σ α v)+ + (if oldVertex σ α v∈liftSet σ α Finset.univ then 1 else 0)≤r+1 + rw [ite_eq_left ((old_mem_liftSet σ α Finset.univ v).mpr (Finset.mem_univ _))] + exact Nat.add_le_add_right ((old_distance_le σ α ha hc root v).trans (hr v)) _ + · change (G').dist (oldVertex σ α root) (centerVertex σ α f)+ + (if centerVertex σ α f∈liftSet σ α Finset.univ then 1 else 0)≤r+1 + rw [ite_eq_right (center_not_liftSet σ α Finset.univ f),Nat.add_zero] + exact center_distance_le σ α ha hc root r hr f + +end TorsionFreeZeroDivisors.ConedMap + +/-! A literal breadth-first spanning tree, with its distances and radius +preserved. This is the rooted tree used in the sharp planar separator. -/ +namespace TorsionFreeZeroDivisors.BFSTree +open scoped Classical +open SimpleGraph +variable {V : Type} (G : SimpleGraph V) (hc : G.Connected) (root : V) + +include hc in +lemma exists_parent (v : V) (hv : v≠root) : + ∃ u,G.Adj v u ∧ G.dist u root+1=G.dist v root := by + obtain ⟨p,hp⟩ := hc.exists_walk_length_eq_dist v root + cases p with + | nil => exact (hv rfl).elim + | @cons v u root h p => + refine ⟨u,h,?_⟩ + have h₁ := G.dist_le p + have h₂ := hc.dist_triangle (u:=v) (v:=u) (w:=root) + rw [G.dist_eq_one_iff_adj.mpr h] at h₂ + simp only [Walk.length_cons] at hp + omega + +def parent (v : V) : V := if hv : v=root then root else (exists_parent G hc root v hv).choose +lemma parent_adj (v : V) (hv : v≠root) : G.Adj v (parent G hc root v) := by + rw [parent,dite_eq_right hv] + exact (exists_parent G hc root v hv).choose_spec.1 +lemma parent_dist (v : V) (hv : v≠root) : + G.dist (parent G hc root v) root+1=G.dist v root := by + rw [parent,dite_eq_right hv] + exact (exists_parent G hc root v hv).choose_spec.2 +lemma parent_ne (v : V) (hv : v≠root) : parent G hc root v≠v := (parent_adj G hc root v hv).ne' + +def tree : SimpleGraph V where + Adj v w := (v≠root ∧ parent G hc root v=w) ∨ (w≠root ∧ parent G hc root w=v) + symm := ⟨fun _ _ h=>h.elim Or.inr Or.inl⟩ + loopless := ⟨fun v h=>h.elim (fun h=>parent_ne G hc root v h.1 h.2) + (fun h=>parent_ne G hc root v h.1 h.2)⟩ + +lemma tree_le : tree G hc root≤G := by + intro v w h + rcases h with ⟨hv,h⟩|⟨hw,h⟩ + · rw [←h] + exact parent_adj G hc root v hv + · rw [←h] + exact (parent_adj G hc root w hw).symm + +lemma exists_tree_walk (v : V) : + ∃ p : (tree G hc root).Walk v root,p.length=G.dist v root := by + generalize hn : G.dist v root=n + induction n using Nat.strong_induction_on generalizing v with + | h n ih => + by_cases hv : v=root + · subst v + exact ⟨Walk.nil,by simp only [Walk.length_nil,dist_self] at hn ⊢; omega⟩ + · have hp := parent_dist G hc root v hv + obtain ⟨p,hl⟩ := ih (G.dist (parent G hc root v) root) (by omega) + (parent G hc root v) rfl + have he : (tree G hc root).Adj v (parent G hc root v) := Or.inl ⟨hv,rfl⟩ + exact ⟨Walk.cons he p,by rw [Walk.length_cons,hl];omega⟩ + +lemma connected : (tree G hc root).Connected := by + have : Nonempty V := ⟨root⟩ + refine ⟨fun v w=>?_⟩ + obtain ⟨p,_⟩ := exists_tree_walk G hc root v + obtain ⟨q,_⟩ := exists_tree_walk G hc root w + exact ⟨p.append q.reverse⟩ + +/-- All root distances are unchanged, not merely bounded by an abstract height. -/ +theorem dist_root (v : V) : (tree G hc root).dist v root=G.dist v root := by + apply Nat.le_antisymm + · obtain ⟨p,hp⟩ := exists_tree_walk G hc root v + rw [←hp] + exact (tree G hc root).dist_le p + · exact Reachable.dist_anti (tree_le G hc root) ((connected G hc root) v root) + +def parentEdge (v : {v : V // v≠root}) : (tree G hc root).edgeSet := + ⟨s(v.val,parent G hc root v.val),Or.inl ⟨v.property,rfl⟩⟩ +lemma parentEdge_surjective : Function.Surjective (parentEdge G hc root) := by + rintro ⟨e,he⟩ + induction e using Sym2.inductionOn with + | _ v w => + rcases he with ⟨hv,h⟩|⟨hw,h⟩ + · refine ⟨⟨v,hv⟩,Subtype.ext ?_⟩ + change s(v,parent G hc root v)=s(v,w) + rw [h] + · refine ⟨⟨w,hw⟩,Subtype.ext ?_⟩ + change s(w,parent G hc root w)=s(v,w) + rw [h,Sym2.eq_swap] + +variable [Fintype V] +/-- The parent edges form an actual spanning tree of the original graph. -/ +theorem isTree : (tree G hc root).IsTree := by + apply SimpleGraph.isTree_iff_connected_and_card.mpr + refine ⟨connected G hc root,?_⟩ + have hl := Fintype.card_le_of_surjective _ (parentEdge_surjective G hc root) + have hr := (connected G hc root).card_vert_le_card_edgeSet_add_one + have hcard : Fintype.card {v : V // v≠root}+1=Fintype.card V := by + simpa only [Fintype.card_subtype_compl,Fintype.card_unique] using + Nat.sub_add_cancel (Fintype.card_pos_iff.mpr ⟨root⟩) + rw [←Nat.card_eq_fintype_card,←Nat.card_eq_fintype_card] at hl hcard + omega + +end TorsionFreeZeroDivisors.BFSTree + +namespace TorsionFreeZeroDivisors.TreeCentroid +open scoped Classical +open SimpleGraph +variable {V : Type} [Fintype V] {T : SimpleGraph V} (ht : T.IsTree) + +omit [Fintype V] in +lemma rootPath_cost (budget : Finset V) (root v : V) (r : ℕ) + (hr : T.dist root v+(if v∈budget then 1 else 0)≤r+1) : + ((rootPath ht root v)∩budget).card≤r+1 := by + by_cases hv : v∈budget + · have hh := Finset.card_le_card (show rootPath ht root v∩budget⊆rootPath ht root v from Finset.inter_subset_left) + rw [rootPath_card] at hh + rw [ite_eq_left hv] at hr + omega + · have hs : rootPath ht root v∩budget⊆(rootPath ht root v).erase v := by + intro x hx + obtain ⟨hx,hxb⟩ := Finset.mem_inter.mp hx + exact Finset.mem_erase.mpr ⟨fun he=>hv (he ▸ hxb),hx⟩ + have hh := Finset.card_le_card hs + rw [Finset.card_erase_of_mem (self_mem_rootPath ht root v),rootPath_card] at hh + rw [ite_eq_right hv] at hr + omega + +omit [Fintype V] in +/-- Zero-cost face centers may be introduced for triangulation without losing +the sharp original-vertex bound. Only original vertices are charged. -/ +theorem two_root_paths_cost (budget : Finset V) (root v w : V) (r : ℕ) + (hroot : root∈budget) + (hv : T.dist root v+(if v∈budget then 1 else 0)≤r+1) + (hw : T.dist root w+(if w∈budget then 1 else 0)≤r+1) : + ((rootPath ht root v∪rootPath ht root w)∩budget).card≤2*r+1 := by + have h₁ := rootPath_cost ht budget root v r hv + have h₂ := rootPath_cost ht budget root w r hw + have hp : 0<((rootPath ht root v∩budget)∩(rootPath ht root w∩budget)).card := + Finset.card_pos.mpr ⟨root,Finset.mem_inter.mpr + ⟨Finset.mem_inter.mpr ⟨root_mem_rootPath ht root v,hroot⟩, + Finset.mem_inter.mpr ⟨root_mem_rootPath ht root w,hroot⟩⟩⟩ + rw [Finset.union_inter_distrib_right] + have hh := Finset.card_union_add_card_inter (rootPath ht root v∩budget) (rootPath ht root w∩budget) + omega + +omit [Fintype V] in +lemma two_root_paths_cost_erase_root (budget : Finset V) (root v w : V) (r : ℕ) + (hroot : root∈budget) + (hv : T.dist root v+(if v∈budget then 1 else 0)≤r+1) + (hw : T.dist root w+(if w∈budget then 1 else 0)≤r+1) : + (((rootPath ht root v∪rootPath ht root w)∩budget).erase root).card≤2*r := by + have hc := two_root_paths_cost ht budget root v w r hroot hv hw + have hm : root∈(rootPath ht root v∪rootPath ht root w)∩budget := + Finset.mem_inter.mpr ⟨Finset.mem_union_left _ (root_mem_rootPath ht _ _),hroot⟩ + rw [Finset.card_erase_of_mem hm] + omega + +end TorsionFreeZeroDivisors.TreeCentroid + +namespace TorsionFreeZeroDivisors.MapEuler +open scoped Classical +open PermutationCycles +variable {O : Type} [Fintype O] + +/-- The exact bounded-radius separator on a genus-zero rotation map. The +partition balances any chosen set of unit-weight vertices. In particular the +root is charged once, so deleting a contracted root saves one unit. -/ +theorem radius_separator (σ α : Equiv.Perm O) (ha : Function.Involutive α) + (hz : GenusZero σ α) (hc : (graph σ α ha).Connected) + (root : Cycle σ) (r : ℕ) (hr : ∀ v,(graph σ α ha).dist root v≤r) + (active : Finset (Cycle σ)) : + ∃ cut side : Finset (Cycle σ), root∈cut ∧ cut.card≤2*r+1 ∧ + (cut.erase root).card≤2*r ∧ + 3*(active.filter (fun v=>v∉cut ∧ v∈side)).card≤2*active.card ∧ + 3*(active.filter (fun v=>v∉cut ∧ v∉side)).card≤2*active.card ∧ + ∀ v w,v∉cut→w∉cut→(graph σ α ha).Adj v w→(v∈side↔w∈side) := by + classical + let ρ := ConedMap.rotation σ α + let π := ConedMap.pairing α + have hπ := ConedMap.pairing_involutive α ha + let g := graph ρ π hπ + have hgc : g.Connected := ConedMap.connected σ α ha hc + let e := ConedMap.oldEmbedding σ α + let u := e root + let T := BFSTree.tree g hgc u + have hT : T≤g := BFSTree.tree_le g hgc u + have ht : T.IsTree := BFSTree.isTree g hgc u + have hz' : GenusZero ρ π := ConedMap.genusZero σ α hz + have htri : ∀ c : Cycle (π*ρ),(members (π*ρ) c).card≤3 := + fun c=>(ConedMap.triangular σ α c).le + let a := ConedMap.liftSet σ α active + obtain ⟨d,h₁,h₂⟩ := triangular_balanced_fundamental ρ π hπ T hT hz' ht a u htri + let F := fundamentalVertices ρ π T ht u d + let D := cotreeSide ρ π hπ T hT hz' ht d + let cut := Finset.univ.filter (fun v=>e v∈F) + let side := Finset.univ.filter (fun v=>homeFace ρ π (e v)∈D) + have hcut (v : Cycle σ) : v∈cut↔e v∈F := by simp only [cut,Finset.mem_filter,Finset.mem_univ,true_and] + have hside (v : Cycle σ) : v∈side↔homeFace ρ π (e v)∈D := by + simp only [side,Finset.mem_filter,Finset.mem_univ,true_and] + have hroot : root∈cut := (hcut root).mpr (root_mem_fundamentalVertices ρ π T ht u d) + let budget : Finset (Cycle ρ) := ConedMap.liftSet σ α Finset.univ + have hcost (v : Cycle ρ) : T.dist u v+(if v∈budget then 1 else 0)≤r+1 := by + rw [SimpleGraph.dist_comm,BFSTree.dist_root,SimpleGraph.dist_comm] + exact ConedMap.distance_cost σ α ha hc root r hr v + have hmap : cut.map e=F∩ConedMap.liftSet σ α Finset.univ := by + ext v + simp only [Finset.mem_map,Finset.mem_inter,ConedMap.liftSet,Finset.mem_univ,true_and] + constructor + · rintro ⟨x,hx,rfl⟩ + exact ⟨(hcut x).mp hx,⟨x,rfl⟩⟩ + · rintro ⟨hv,x,rfl⟩ + exact ⟨x,(hcut x).mpr hv,rfl⟩ + have hcard : cut.card≤2*r+1 := by + rw [←Finset.card_map (f:=e),hmap] + have hh := TreeCentroid.two_root_paths_cost ht budget + u (cycle ρ d) (cycle ρ (π d)) r + ((ConedMap.old_mem_liftSet σ α Finset.univ root).mpr (Finset.mem_univ _)) (by convert hcost (cycle ρ d) using 1; congr 2) (by convert hcost (cycle ρ (π d)) using 1; congr 2) + convert hh using 1 + congr 1 + ext v + simp only [F,budget,fundamentalVertices,Finset.mem_inter,Finset.mem_union,TreeCentroid.rootPath,List.mem_toFinset] + have hfilter (p : Cycle ρ→Prop) [DecidablePred p] : + (active.filter (fun v=>p (e v))).card=(a.filter p).card := by + rw [←Finset.card_map (f:=e)] + congr 1 + ext v + simp only [Finset.mem_map,Finset.mem_filter] + constructor + · rintro ⟨x,⟨hx,hp⟩,rfl⟩ + exact ⟨Finset.mem_map.mpr ⟨x,hx,rfl⟩,hp⟩ + · rintro ⟨hv,hp⟩ + obtain ⟨x,hx,rfl⟩ := Finset.mem_map.mp hv + exact ⟨x,⟨hx,hp⟩,rfl⟩ + refine ⟨cut,side,hroot,hcard,?_,?_,?_,?_⟩ + · rw [Finset.card_erase_of_mem hroot] + omega + · have he : active.filter (fun v=>v∉cut ∧ v∈side)= + active.filter (fun v=>e v∉F ∧ homeFace ρ π (e v)∈D) := by + ext v + simp only [Finset.mem_filter,hcut,hside] + rw [he,hfilter (fun v=>v∉F ∧ homeFace ρ π v∈D),←ConedMap.liftSet_card σ α active] + exact h₁ + · have he : active.filter (fun v=>v∉cut ∧ v∉side)= + active.filter (fun v=>e v∉F ∧ homeFace ρ π (e v)∉D) := by + ext v + simp only [Finset.mem_filter,hcut,hside] + rw [he,hfilter (fun v=>v∉F ∧ homeFace ρ π v∉D),←ConedMap.liftSet_card σ α active] + exact h₂ + · intro v w hv hw he + rw [hside,hside] + exact fundamental_no_crossing ρ π hπ T hT hz' ht + (fun h=>hv ((hcut v).mpr h)) (fun h=>hw ((hcut w).mpr h)) + (ConedMap.old_adj σ α ha he) (home_cycle ρ (e v)) (home_cycle ρ (e w)) + +end TorsionFreeZeroDivisors.MapEuler + +namespace TorsionFreeZeroDivisors.MapRestrict +open scoped Classical +open PermutationCycles +variable {O : Type} [Fintype O] (f : Equiv.Perm O) (P : O→Prop) (hf : ∀ x,P (f x)↔P x) + +def perm : Equiv.Perm {x // P x} := f.subtypeEquiv (fun x=>(hf x).symm) +omit [Fintype O] in +@[simp] lemma perm_val (x : {x // P x}) : (perm f P hf x).val=f x := rfl +omit [Fintype O] in +include hf in +lemma not_invariant (x : O) : (¬P (f x))↔¬P x := not_congr (hf x) +local notation "fP" => perm f P hf +local notation "fN" => perm f (fun x=>¬P x) (not_invariant f P hf) + +def cycleInclude : Cycle fP→Cycle f := + PermutationCycles.lift fP (fun x=>cycle f x.val) (fun x=>cycle_apply f x.val) +@[simp] lemma cycleInclude_cycle (x : {x // P x}) : cycleInclude f P hf (cycle fP x)=cycle f x.val := rfl + +def cycleRaw (x : O) : Cycle fP ⊕ Cycle fN := + if h:P x then .inl (cycle fP ⟨x,h⟩) else .inr (cycle fN ⟨x,h⟩) +omit [Fintype O] in +lemma cycleRaw_apply (x : O) : cycleRaw f P hf (f x)=cycleRaw f P hf x := by + by_cases hx : P x + · rw [cycleRaw,dite_eq_left ((hf x).mpr hx),cycleRaw,dite_eq_left hx] + exact congrArg Sum.inl (cycle_apply fP ⟨x,hx⟩) + · rw [cycleRaw,dite_eq_right (fun h=>hx ((hf x).mp h)),cycleRaw,dite_eq_right hx] + exact congrArg Sum.inr (cycle_apply fN ⟨x,hx⟩) + +def cycleEquiv : Cycle f≃Cycle fP ⊕ Cycle fN where + toFun := PermutationCycles.lift f (cycleRaw f P hf) (cycleRaw_apply f P hf) + invFun := Sum.elim (cycleInclude f P hf) (cycleInclude f (fun x=>¬P x) (not_invariant f P hf)) + left_inv := by + intro c + obtain ⟨x,rfl⟩ := cycle_surjective f c + change (Sum.elim _ _) (cycleRaw f P hf x)=cycle f x + unfold cycleRaw + split_ifs <;> rfl + right_inv := by + intro c + rcases c with c|c + · obtain ⟨x,rfl⟩ := cycle_surjective fP c + change cycleRaw f P hf x.val=Sum.inl (cycle fP x) + rw [cycleRaw,dite_eq_left x.property] + · obtain ⟨x,rfl⟩ := cycle_surjective fN c + change cycleRaw f P hf x.val=Sum.inr (cycle fN x) + rw [cycleRaw,dite_eq_right x.property] + +lemma cycle_card : Nat.card (Cycle f)=Nat.card (Cycle fP)+Nat.card (Cycle fN) := by + rw [Nat.card_congr (cycleEquiv f P hf),Nat.card_sum] +omit [Fintype O] in +lemma perm_involutive (hi : Function.Involutive f) : Function.Involutive fP := + fun x=>Subtype.ext (hi x.val) + +def supportEquiv : {x : O // f x≠x} ≃ + {x : Subtype P // fP x≠x} ⊕ {x : {x // ¬P x} // fN x≠x} where + toFun x := if h:P x.val then .inl ⟨⟨x.val,h⟩,fun he=>x.property (congrArg Subtype.val he)⟩ + else .inr ⟨⟨x.val,h⟩,fun he=>x.property (congrArg Subtype.val he)⟩ + invFun := Sum.elim (fun x=>⟨x.val.val,fun he=>x.property (Subtype.ext he)⟩) + (fun x=>⟨x.val.val,fun he=>x.property (Subtype.ext he)⟩) + left_inv := by intro x;dsimp;split_ifs <;> rfl + right_inv := by + intro x + rcases x with x|x + · dsimp + rw [dite_eq_left x.val.property] + · dsimp + rw [dite_eq_right x.val.property] + +lemma support_card : f.support.card=(fP).support.card+(fN).support.card := by + simp only [ConedMap.support_card_nat] + rw [Nat.card_congr (supportEquiv f P hf),Nat.card_sum] + +end TorsionFreeZeroDivisors.MapRestrict + +end + +end OAI diff --git a/lean/OAI/Algebra/GroupRing/BalancedPieces.lean b/lean/OAI/Algebra/GroupRing/BalancedPieces.lean new file mode 100644 index 0000000000000000000000000000000000000000..caacd1ce15ea62209b47d78dc2191887d4659fc4 --- /dev/null +++ b/lean/OAI/Algebra/GroupRing/BalancedPieces.lean @@ -0,0 +1,382 @@ +import Mathlib +import OAI.Algebra.GroupRing.ClusterLocalization + +namespace OAI + +noncomputable section + +namespace TorsionFreeZeroDivisors.BalancedPieces +open scoped Classical BigOperators + +def count (h cap : ℕ) : ℕ := (h+cap-1)/cap +def length (h m : ℕ) (i : Fin m) : ℕ := h/m + if i.val i.val omega + · by_cases hr : h%count h cap=0 + · rw [ite_eq_left hr] at hu + simp only [hr,Nat.not_lt_zero,ite_false,add_zero] + exact hu + · rw [ite_eq_right hr] at hu + split_ifs <;> omega +lemma count_charge {h cap : ℕ} (hc : 6≤cap) (hh : cap (length_bounds hc hh i).1 + simpa only [Finset.sum_const,Finset.card_univ,Fintype.card_fin,smul_eq_mul,←Finset.mul_sum,hs] using hi + +def number (h cap : ℕ) : ℕ := if h≤cap then 1 else count h cap +def sizes (h cap : ℕ) (i : Fin (number h cap)) : ℕ := + if h≤cap then h else length h (number h cap) i +lemma number_pos {h cap : ℕ} (hc : 0 l[index l n hs ⟨i,j⟩] +lemma length_segment (i : Fin m) : (segment l n hs i).length=n i := List.length_ofFn +lemma segment_get (i : Fin m) (j : Fin (n i)) : + (segment l n hs i)[j.val]'(by rw [length_segment]; exact j.isLt)=l[index l n hs ⟨i,j⟩] := by + simp only [segment,List.getElem_ofFn] +lemma segment_nonempty (i : Fin m) (h : 0hshort ⟨t,i⟩ hs + simp only [he,List.length_nil,Finset.sum_const_zero,Nat.mul_zero,Nat.zero_le] + · have hsum : (∑i : Fin (BalancedPieces.number (w t).length cap),(tail ⟨t,i⟩).length)≤ + BalancedPieces.number (w t).length cap*tailCap := by + calc + _ ≤ ∑_i : Fin (BalancedPieces.number (w t).length cap),tailCap := Finset.sum_le_sum fun i _=>htail ⟨t,i⟩ + _ = _ := by simp + have hcount := BalancedPieces.number_charge (h:= (w t).length) hcap + rw [ite_eq_left (show cap<(w t).length by omega)] at hcount + have ha := Nat.mul_le_mul_left cap hsum + have hb := Nat.mul_le_mul_right tailCap hcount + nlinarith +end TorsionFreeZeroDivisors.BalancedWords +namespace TorsionFreeZeroDivisors.ShortClosure +open PortSubdivision WeightedMoore.PortWalk +variable {V D : Type} (Γ : PortGraph V D) +lemma endpoint_cons' (a : V) (d : D) (p : List D) : + endpoint Γ a (d::p)=endpoint Γ (Γ.origin (Γ.reverse d)) p := by + cases p with + | nil => rfl + | cons e p => simp only [endpoint,List.getLast?_cons,Option.map_some,Option.getD_some] + +lemma ReducedPath.exists_walk {a b : V} {p : List D} (hp : ReducedPath Γ a b p) : + ∃ q : Γ.Walk a b,q.darts=p := by + induction p generalizing a with + | nil => + have he : a=b := hp.finish + subst b + exact ⟨.nil a,rfl⟩ + | cons d p ih => + have hc := List.isChain_cons.mp hp.chain + have ht : ReducedPath Γ (Γ.origin (Γ.reverse d)) b p := { + chain := hc.2 + start := fun e he=>(hc.1 e he).1.symm + finish := by rw [←endpoint_cons' Γ a d p]; exact hp.finish } + obtain ⟨q,hq⟩ := ih ht + exact ⟨.cons d (hp.start d (by simp)) q,by simp only [PortGraph.Walk.darts,hq]⟩ + +lemma ReducedPath.length_ge {a : V} {p : List D} (hp : ReducedPath Γ a a p) + (hn : p≠[]) (L : ℕ) (hg : (3*L:ℕ)≤Γ.subdivision.egirth) : L≤p.length := by + obtain ⟨q,hq⟩ := hp.exists_walk Γ + have hr : q.IsReduced := by + rw [PortGraph.Walk.IsReduced,hq] + exact hp.chain.imp (fun _ _ h=>h.2) + have hn' : 0 {x} + | k + 1 => (ends neighbors x k).biUnion neighbors + +/-- Finite closed combinatorial ball. -/ +def ball (neighbors : V → Finset V) (x : V) (r : ℕ) : Finset V := + (Finset.range (r + 1)).biUnion (ends neighbors x) + +theorem card_ends_le (neighbors : V → Finset V) (d : ℕ) + (hd : ∀ v, (neighbors v).card ≤ d) (x : V) (k : ℕ) : + (ends neighbors x k).card ≤ d ^ k := by + induction k with + | zero => simp [ends] + | succ k ih => + calc + (ends neighbors x (k+1)).card ≤ + ∑ v ∈ ends neighbors x k, (neighbors v).card := Finset.card_biUnion_le + _ ≤ ∑ _v ∈ ends neighbors x k, d := Finset.sum_le_sum fun v _ => hd v + _ = (ends neighbors x k).card * d := by simp + _ ≤ d^k * d := Nat.mul_le_mul_right d ih + _ = d^(k+1) := (pow_succ d k).symm + +/-- A non-asymptotic geometric-sum bound. -/ +theorem sum_powers_le (d r : ℕ) (hd : 2 ≤ d) : + ∑ k ∈ Finset.range (r+1), d^k ≤ 2 * d^r - 1 := by + induction r with + | zero => simp + | succ r ih => + rw [Finset.sum_range_succ, pow_succ] + have hp : 0 < d^r := pow_pos (by omega) _ + have hm : 2 * d^r ≤ d^r*d := by nlinarith + omega + +theorem card_ball_le (neighbors : V → Finset V) (d : ℕ) (h2 : 2 ≤ d) + (hd : ∀ v, (neighbors v).card ≤ d) (x : V) (r : ℕ) : + (ball neighbors x r).card ≤ d^(r+1) := by + calc + (ball neighbors x r).card ≤ ∑ k ∈ Finset.range (r+1), (ends neighbors x k).card := + Finset.card_biUnion_le + _ ≤ ∑ k ∈ Finset.range (r+1), d^k := + Finset.sum_le_sum fun k _ => card_ends_le neighbors d hd x k + _ ≤ 2 * d^r - 1 := sum_powers_le d r h2 + _ ≤ d^(r+1) := by + rw [pow_succ] + have hm : 2*d^r ≤ d^r*d := by simpa [Nat.mul_comm] using Nat.mul_le_mul_left (d^r) h2 + omega + +@[simp] theorem mem_ball_iff (neighbors : V → Finset V) (x y : V) (r : ℕ) : + y ∈ ball neighbors x r ↔ ∃ k ≤ r, y ∈ ends neighbors x k := by + simp [ball] + +theorem self_mem_ball (neighbors : V → Finset V) (x : V) (r : ℕ) : + x ∈ ball neighbors x r := by + rw [mem_ball_iff] + exact ⟨0,Nat.zero_le _,by simp [ends]⟩ + +/-- Forgetting parallel edges is sound for the endpoint bound. -/ +theorem port_degree_bound {T : Type*} (outgoing : V → Finset T) (next : V → T → V) + (d : ℕ) (hd : ∀ v, (outgoing v).card ≤ d) (v : V) : + ((outgoing v).image (next v)).card ≤ d := + (Finset.card_image_le).trans (hd v) + +/-- The ordinary finite neighbor set, with its classical finiteness data fixed. -/ +def graphNeighbors [Fintype V] (G : SimpleGraph V) (v : V) : Finset V := by + classical + exact G.neighborFinset v + +omit [DecidableEq V] in +@[simp] theorem mem_graphNeighbors [Fintype V] (G : SimpleGraph V) (a b : V) : + b ∈ graphNeighbors G a ↔ G.Adj a b := by + classical + simp [graphNeighbors] + +omit [DecidableEq V] in +theorem card_graphNeighbors [Fintype V] (G : SimpleGraph V) (v : V) : + (graphNeighbors G v).card = Nat.card (G.neighborSet v) := by + classical + rw [Nat.card_eq_fintype_card, SimpleGraph.card_neighborSet_eq_degree] + exact SimpleGraph.card_neighborFinset_eq_degree G v + +/-- The finite combinatorial balls contain all walk endpoints, not just paths. -/ +theorem mem_ends_of_walk [Fintype V] (G : SimpleGraph V) {a b : V} (p : G.Walk a b) : + b ∈ ends (graphNeighbors G) a p.length := by + classical + induction p using SimpleGraph.Walk.concatRec with + | Hnil => simp [ends] + | @Hconcat a b c p h ih => + simp only [SimpleGraph.Walk.length_concat,ends,Finset.mem_biUnion] + exact ⟨b,ih,by simpa using h⟩ + +theorem mem_ball_of_walk [Fintype V] (G : SimpleGraph V) {a b : V} + (p : G.Walk a b) (r : ℕ) (hr : p.length ≤ r) : b ∈ ball (graphNeighbors G) a r := by + exact mem_ball_iff _ _ _ _ |>.mpr ⟨p.length,hr,mem_ends_of_walk G p⟩ + +theorem far_of_not_mem_ball [Fintype V] (G : SimpleGraph V) {a b : V} (r : ℕ) + (h : b ∉ ball (graphNeighbors G) a r) (p : G.Walk a b) : r < p.length := by + by_contra hn + exact h (mem_ball_of_walk G p r (by omega)) + +section Matchings +variable {X Y : Type*} [Fintype X] [DecidableEq X] + +/-- Removing source and target ports in a bad vertex set discards at most twice +its cardinality, since each labelled carrier embeds in the vertex set. -/ +theorem matching_bad_card (f : X ≃ Y) (locX : X → V) (locY : Y → V) + (hX : Function.Injective locX) (hY : Function.Injective locY) (B : Finset V) : + (Finset.univ.filter (fun u => locX u ∈ B ∨ locY (f u) ∈ B)).card ≤ 2 * B.card := by + classical + have hx : (Finset.univ.filter (fun u => locX u ∈ B)).card ≤ B.card := by + apply Finset.card_le_card_of_injOn locX + · intro u hu; exact (Finset.mem_filter.mp hu).2 + · exact hX.injOn + have hy : (Finset.univ.filter (fun u => locY (f u) ∈ B)).card ≤ B.card := by + apply Finset.card_le_card_of_injOn (fun u => locY (f u)) + · intro u hu; exact (Finset.mem_filter.mp hu).2 + · exact (hY.comp f.injective).injOn + rw [Finset.filter_or] + exact (Finset.card_union_le _ _).trans (by omega) + +/-- A labelled matching has uniformly many choices outside both endpoint balls +and outside a prescribed set. This is the quantitative geometric input to the +conditioned transposition injection. -/ +theorem admissible_card (f : X ≃ Y) (locX : X → V) (locY : Y → V) + (hX : Function.Injective locX) (hY : Function.Injective locY) + (neighbors : V → Finset V) (d : ℕ) (h2 : 2 ≤ d) + (hd : ∀ v, (neighbors v).card ≤ d) (x y : V) (r : ℕ) (P : Finset X) : + Fintype.card X - P.card - 4*d^(r+1) ≤ + (Finset.univ.filter (fun u => u ∉ P ∧ + locX u ∉ ball neighbors x r ∪ ball neighbors y r ∧ + locY (f u) ∉ ball neighbors x r ∪ ball neighbors y r)).card := by + classical + let B := ball neighbors x r ∪ ball neighbors y r + let bad := Finset.univ.filter (fun u => locX u ∈ B ∨ locY (f u) ∈ B) + have hb : bad.card ≤ 4*d^(r+1) := by + have hb' := matching_bad_card f locX locY hX hY B + have hB : B.card ≤ 2*d^(r+1) := + (Finset.card_union_le _ _).trans (by + have hx := card_ball_le neighbors d h2 hd x r + have hy := card_ball_le neighbors d h2 hd y r + omega) + exact hb'.trans (by omega) + have he : Finset.univ.filter (fun u => u ∉ P ∧ locX u ∉ B ∧ locY (f u) ∉ B) = + Finset.univ \ (P ∪ bad) := by + ext u + simp [bad, not_or] + change _ ≤ (Finset.univ.filter (fun u => u ∉ P ∧ locX u ∉ B ∧ locY (f u) ∉ B)).card + rw [he,Finset.card_sdiff_of_subset (Finset.subset_univ _),Finset.card_univ] + have hu := Finset.card_union_le P bad + omega + +end Matchings +end +end TorsionFreeZeroDivisors.BallCount + + +/-! +A faithful simple-graph encoding of the manuscript's labelled multigraphs. +An original edge has two opposite ports, and its threefold subdivision is +original vertex -- port -- opposite port -- original vertex. Loops become +triangles and parallel edges remain distinct, so neither is silently discarded. +-/ + +end + +end OAI diff --git a/lean/OAI/Algebra/GroupRing/Basic.lean b/lean/OAI/Algebra/GroupRing/Basic.lean new file mode 100644 index 0000000000000000000000000000000000000000..19558126b20b8798423d4cb13f7a327563e5b2a6 --- /dev/null +++ b/lean/OAI/Algebra/GroupRing/Basic.lean @@ -0,0 +1,42 @@ +import Mathlib + +namespace OAI + + + +namespace TorsionFreeZeroDivisors + +/-- Ordinary group torsion-freeness, without requiring uniqueness of all roots. -/ +def TorsionFree (G : Type) [Group G] : Prop := + ∀ (g : G) (n : ℕ), 0 < n → g ^ n = 1 → g = 1 + +/-- A connected finite Hausdorff 2-dimensional CW K(G,1). -/ +def HasFiniteTwoDimensionalClassifyingSpace (G : Type) [Group G] : Prop := + ∃ (X : Type) (topX : TopologicalSpace X), + letI : TopologicalSpace X := topX + ∃ (_hausdorff : T2Space X) (_connected : PathConnectedSpace X) + (cw : Topology.CWComplex (Set.univ : Set X)), + letI : Topology.CWComplex (Set.univ : Set X) := cw + Topology.CWComplex.Finite (Set.univ : Set X) ∧ + (∀ n : ℕ, 2 < n → IsEmpty (Topology.CWComplex.cell (Set.univ : Set X) n)) ∧ + Nonempty (Topology.CWComplex.cell (Set.univ : Set X) 2) ∧ + ∃ (x : X), Nonempty (G ≃* FundamentalGroup X x) ∧ + ∃ (E : Type) (topE : TopologicalSpace E), + letI : TopologicalSpace E := topE + ContractibleSpace E ∧ + ∃ p : E → X, IsCoveringMap p ∧ Function.Surjective p + +/-- The entire main theorem, including its "Moreover" clause. -/ +def MainTheorem : Prop := + ∃ (G : Type) (inst : Group G), + letI : Group G := inst + Group.IsFinitelyPresented G ∧ TorsionFree G ∧ + HasFiniteTwoDimensionalClassifyingSpace G ∧ + ∃ α β : MonoidAlgebra (ZMod 2) G, α ≠ 0 ∧ β ≠ 0 ∧ α * β = 0 + + +end TorsionFreeZeroDivisors + + + +end OAI diff --git a/lean/OAI/Algebra/GroupRing/BlockGrid.lean b/lean/OAI/Algebra/GroupRing/BlockGrid.lean new file mode 100644 index 0000000000000000000000000000000000000000..0fac52ab8f96225380ea60c1507c4812dfbb507f --- /dev/null +++ b/lean/OAI/Algebra/GroupRing/BlockGrid.lean @@ -0,0 +1,360 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace TorsionFreeZeroDivisors.BlockGrid + +/-- Partition the unit interval into N half-open equal cells. -/ +def cell (N : ℕ) (hN : 0 < N) (x : ℝ) : Fin N := + ⟨⌊(N : ℝ) * Int.fract x⌋₊, by + apply (Nat.floor_lt (mul_nonneg (Nat.cast_nonneg _) (Int.fract_nonneg x))).mpr + simpa using mul_lt_mul_of_pos_left (Int.fract_lt_one x) (Nat.cast_pos.mpr hN)⟩ + +theorem same_cell {N : ℕ} (hN : 0 < N) {x y : ℝ} (he : cell N hN x = cell N hN y) : + |Int.fract x - Int.fract y| < 1 / (N : ℝ) := by + have hf := congrArg Fin.val he + dsimp [cell] at hf + have hx0 := Nat.floor_le (mul_nonneg (Nat.cast_nonneg N) (Int.fract_nonneg x)) + have hy0 := Nat.floor_le (mul_nonneg (Nat.cast_nonneg N) (Int.fract_nonneg y)) + have hx1 := Nat.lt_floor_add_one ((N : ℝ) * Int.fract x) + have hy1 := Nat.lt_floor_add_one ((N : ℝ) * Int.fract y) + rw [hf] at hx0 hx1 + have hNr : (0 : ℝ) < N := Nat.cast_pos.mpr hN + rw [abs_lt] + constructor + · apply (neg_lt_iff_pos_add).mpr + apply (mul_pos_iff_of_pos_left hNr).mp + have hi : (N : ℝ) * (1 / N) = 1 := by field_simp + nlinarith + · apply (lt_div_iff₀ hNr).mpr + nlinarith + +/-- Simultaneous approximation in all d coordinates, with the exact +denominator bound N^d, by the pigeonhole principle. -/ +theorem simultaneous {d N : ℕ} (hN : 0 < N) (a : Fin d → ℝ) : + ∃ u : ℕ, 1 ≤ u ∧ u ≤ N ^ d ∧ + ∃ z : Fin d → ℤ, ∀ i, |(u : ℝ) * a i - (z i : ℝ)| < 1 / (N : ℝ) := by + classical + let code : Fin (N ^ d + 1) → (Fin d → Fin N) := + fun k i => cell N hN ((k.val : ℝ) * a i) + obtain ⟨j, k, hne, he⟩ := Fintype.exists_ne_map_eq_of_card_lt code (by simp) + have diff (j k : Fin (N^d+1)) (hjk : j.val < k.val) (he : code j = code k) : + ∃ u : ℕ, 1 ≤ u ∧ u ≤ N^d ∧ + ∃ z : Fin d → ℤ, ∀ i, |(u : ℝ)*a i - (z i : ℝ)| < 1/(N : ℝ) := by + refine ⟨k.val-j.val, by omega, by omega, + (fun i => ⌊(k.val : ℝ)*a i⌋ - ⌊(j.val : ℝ)*a i⌋), ?_⟩ + intro i + have hi := same_cell hN (congrFun he i).symm + have hcast : ((k.val-j.val : ℕ) : ℝ) = (k.val : ℝ) - j.val := + Nat.cast_sub (Nat.le_of_lt hjk) + simpa only [code] using (by + rw [hcast, Int.cast_sub] + convert hi using 1 + simp only [Int.fract] + ring_nf) + rcases lt_or_gt_of_ne (Fin.val_injective.ne hne) with hjk | hkj + · exact diff j k hjk he + · exact diff k j hkj he.symm + +/-- Scaling the simultaneous approximation gives the common block +scale s=L/(uR), with error at most R/N for every prescribed offset. -/ +theorem scale_approximation {d N : ℕ} (hN : 0 < N) + (L R : ℝ) (hL : 0 < L) (hR : 0 < R) (offset : Fin d → ℝ) : + ∃ u : ℕ, 1 ≤ u ∧ u ≤ N^d ∧ + ∃ z : Fin d → ℤ, + let s := L / ((u : ℝ)*R) + 0 < s ∧ L / ((N^d : ℕ)*R) ≤ s ∧ s ≤ L/R ∧ + ∀ i, |offset i / s - R*(z i : ℝ)| < R / N := by + obtain ⟨u, hu, hub, z, hz⟩ := simultaneous hN (fun i => offset i / L) + have hur : (0 : ℝ) < u := by exact_mod_cast hu + have hNr : (0 : ℝ) < N := Nat.cast_pos.mpr hN + have hpow : (0 : ℝ) < (N^d : ℕ) := by positivity + refine ⟨u,hu,hub,z,?_,?_,?_,?_⟩ + · exact div_pos hL (mul_pos hur hR) + · exact div_le_div_of_nonneg_left hL.le (mul_pos hur hR) + (mul_le_mul_of_nonneg_right (by exact_mod_cast hub) hR.le) + · apply div_le_div_of_nonneg_left hL.le hR + simpa using mul_le_mul_of_nonneg_right (show (1 : ℝ) ≤ u by exact_mod_cast hu) hR.le + · intro i + have he := mul_lt_mul_of_pos_left (hz i) hR + have hscalar : offset i / (L / ((u : ℝ)*R)) - R*(z i : ℝ) = + R*((u : ℝ)*(offset i/L) - (z i : ℝ)) := by field_simp + rw [hscalar, abs_mul, abs_of_pos hR] + simpa [div_eq_mul_inv, mul_assoc] using he + +end TorsionFreeZeroDivisors.BlockGrid + +/-! Exact half-integer alignment, including the reflection endpoint conventions. +Uniform deficit bounds converge to zero relative to s +when |a/s-ν| does; no rounding of the prescribed real grid s is needed. -/ +namespace TorsionFreeZeroDivisors.BlockAlignment + +section +open scoped Classical + +/-- Integer edge indices whose half-integer centers belong to a real interval. -/ +def positions (lo hi : ℝ) : Finset ℤ := Finset.Ico ⌈lo-1/2⌉ ⌈hi-1/2⌉ + +theorem mem_positions {lo hi : ℝ} {q : ℤ} : + q ∈ positions lo hi ↔ lo ≤ (q : ℝ)+1/2 ∧ (q : ℝ)+1/2 < hi := by + simp only [positions,Finset.mem_Ico,Int.ceil_le,Int.lt_ceil] + constructor <;> rintro ⟨h1,h2⟩ <;> constructor <;> linarith + +/-- Works even for a reversed/empty real interval. -/ +theorem card_lower (lo hi : ℝ) : hi-lo-1 ≤ ((positions lo hi).card : ℝ) := by + have h1 := Int.le_ceil (lo-1/2) + have h2 := Int.ceil_lt_add_one (lo-1/2) + have h3 := Int.le_ceil (hi-1/2) + have h4 : (⌈hi-1/2⌉-⌈lo-1/2⌉ : ℤ) ≤ ((positions lo hi).card : ℤ) := by + simp only [positions,Int.card_Ico] + exact Int.self_le_toNat _ + have h5 : ((⌈hi-1/2⌉ : ℤ) : ℝ)-⌈lo-1/2⌉ ≤ ((positions lo hi).card : ℝ) := by exact_mod_cast h4 + linarith + +theorem card_upper {lo hi : ℝ} (hab : lo ≤ hi) : + ((positions lo hi).card : ℝ) ≤ hi-lo+1 := by + have hc : ⌈lo-1/2⌉ ≤ ⌈hi-1/2⌉ := Int.ceil_mono (by linarith) + have he : ((positions lo hi).card : ℤ) = ⌈hi-1/2⌉-⌈lo-1/2⌉ := by + simp only [positions,Int.card_Ico] + exact Int.toNat_of_nonneg (sub_nonneg.mpr hc) + have he' : ((positions lo hi).card : ℝ) = ((⌈hi-1/2⌉ : ℤ) : ℝ)-⌈lo-1/2⌉ := by exact_mod_cast he + have h1 := Int.le_ceil (lo-1/2) + have h2 := Int.ceil_lt_add_one (hi-1/2) + linarith + +def block (s : ℝ) (k : ℤ) : Finset ℤ := positions ((k : ℝ)*s) (((k : ℝ)+1)*s) + +def affine (reverse : Bool) (a q : ℤ) : ℤ := if reverse then a-1-q else q+a + +def partnerIndex (reverse : Bool) (ν k : ℤ) : ℤ := if reverse then ν-k-1 else k+ν + +def overlap (s : ℝ) (reverse : Bool) (a k ν : ℤ) : Finset ℤ := + (block s k).filter (fun q => affine reverse a q ∈ block s (partnerIndex reverse ν k)) + +/-- A central interval survives both translation and reflection. Using one +extra unit of margin removes the open/closed endpoint distinction. -/ +theorem core_subset (s : ℝ) (reverse : Bool) (a k ν : ℤ) : + positions ((k : ℝ)*s+(|a-(ν : ℝ)*s|+1)) + (((k : ℝ)+1)*s-(|a-(ν : ℝ)*s|+1)) ⊆ overlap s reverse a k ν := by + intro q hq + obtain ⟨hlo,hhi⟩ := mem_positions.mp hq + have ha0 := abs_nonneg ((a : ℝ)-(ν : ℝ)*s) + have ha1 := le_abs_self ((a : ℝ)-(ν : ℝ)*s) + have ha2 := neg_abs_le ((a : ℝ)-(ν : ℝ)*s) + refine Finset.mem_filter.mpr ⟨?_,?_⟩ + · apply mem_positions.mpr + constructor <;> linarith + · apply mem_positions.mpr + cases reverse <;> simp only [affine,partnerIndex,Bool.false_eq_true,ite_false,ite_true, + Int.cast_add,Int.cast_sub,Int.cast_one] <;> constructor <;> nlinarith + +/-- An explicit o(s) deficit for the exact grid and signed isometry. -/ +theorem overlap_deficit (s : ℝ) (hs : 0 ≤ s) (reverse : Bool) (a k ν : ℤ) : + (((block s k).card - (overlap s reverse a k ν).card : ℕ) : ℝ) ≤ + 2*|a-(ν : ℝ)*s|+4 := by + have hlo := card_lower ((k : ℝ)*s+(|a-(ν : ℝ)*s|+1)) + (((k : ℝ)+1)*s-(|a-(ν : ℝ)*s|+1)) + have hsub := Finset.card_le_card (core_subset s reverse a k ν) + have hsub' : ((positions ((k : ℝ)*s+(|a-(ν : ℝ)*s|+1)) + (((k : ℝ)+1)*s-(|a-(ν : ℝ)*s|+1))).card : ℝ) ≤ (overlap s reverse a k ν).card := by exact_mod_cast hsub + have hhi := card_upper (lo := (k : ℝ)*s) (hi := ((k : ℝ)+1)*s) (by nlinarith) + have hcard : (overlap s reverse a k ν).card ≤ (block s k).card := + Finset.card_le_card (Finset.filter_subset _ _) + rw [Nat.cast_sub hcard] + dsimp [block] at * + linarith + +/-- An overlap larger than half of its block dominates every disjoint one. -/ +theorem dominant_unique {B D E : Finset ℤ} (hD : D ⊆ B) (hE : E ⊆ B) + (hdis : Disjoint D E) (hd : B.card < 2*D.card) (he : B.card < 2*E.card) : False := by + have hc : D.card+E.card ≤ B.card := by + rw [← Finset.card_union_of_disjoint hdis] + exact Finset.card_le_card (Finset.union_subset hD hE) + omega + +end + +open scoped Classical BigOperators + +def inverseOffset (reverse : Bool) (a : ℤ) : ℤ := if reverse then a else -a + +theorem affine_inverse (reverse : Bool) (a q : ℤ) : + affine reverse (inverseOffset reverse a) (affine reverse a q) = q := by + cases reverse <;> simp [affine,inverseOffset] + +theorem affine_injective (reverse : Bool) (a : ℤ) : Function.Injective (affine reverse a) := + Function.LeftInverse.injective (affine_inverse reverse a) + +theorem partner_inverse (reverse : Bool) (ν k : ℤ) : + partnerIndex reverse (inverseOffset reverse ν) (partnerIndex reverse ν k) = k := by + cases reverse <;> simp [partnerIndex,inverseOffset]; omega + +/-- The overlap on the partner block is exactly the image of the first overlap. -/ +def overlapEquiv (s : ℝ) (reverse : Bool) (a k ν : ℤ) : + overlap s reverse a k ν ≃ + overlap s reverse (inverseOffset reverse a) (partnerIndex reverse ν k) (inverseOffset reverse ν) where + toFun q := ⟨affine reverse a q.val, by + obtain ⟨hq,hp⟩ := Finset.mem_filter.mp q.property + apply Finset.mem_filter.mpr + exact ⟨hp,by rw [affine_inverse,partner_inverse]; exact hq⟩⟩ + invFun q := ⟨affine reverse (inverseOffset reverse a) q.val,by + obtain ⟨hq,hp⟩ := Finset.mem_filter.mp q.property + apply Finset.mem_filter.mpr + refine ⟨?_,?_⟩ + · rwa [partner_inverse] at hp + · have he : affine reverse a (affine reverse (inverseOffset reverse a) q.val) = q.val := by + cases reverse <;> simp [affine,inverseOffset] + rw [he] + exact hq⟩ + left_inv q := Subtype.ext (affine_inverse reverse a q.val) + right_inv q := by + apply Subtype.ext + cases reverse <;> simp [affine,inverseOffset] + +theorem block_disjoint (s : ℝ) (hs : 0 < s) {k j : ℤ} (hne : k ≠ j) : + Disjoint (block s k) (block s j) := by + apply Finset.disjoint_left.mpr + intro q hk hj + obtain ⟨hk0,hk1⟩ := mem_positions.mp hk + obtain ⟨hj0,hj1⟩ := mem_positions.mp hj + rcases lt_or_gt_of_ne hne with hkj | hjk + · have hh : (k : ℝ)+1 ≤ j := by exact_mod_cast hkj + nlinarith + · have hh : (j : ℝ)+1 ≤ k := by exact_mod_cast hjk + nlinarith + +def blockCount (s : ℝ) (ell : ℕ) : ℕ := ⌊(ell : ℝ)/s⌋₊ + +def tail (s : ℝ) (ell : ℕ) : Finset ℤ := positions ((blockCount s ell : ℝ)*s) ell + +theorem count_bound (s : ℝ) (hs : 0 < s) (ell : ℕ) : + (blockCount s ell : ℝ)*s ≤ ell ∧ (ell : ℝ) < (blockCount s ell+1)*s := by + have h1 := Nat.floor_le (div_nonneg (Nat.cast_nonneg ell) hs.le) + have h2 := Nat.lt_floor_add_one ((ell : ℝ)/s) + constructor + · exact (le_div_iff₀ hs).mp h1 + · exact (div_lt_iff₀ hs).mp h2 + +theorem tail_bound (s : ℝ) (hs : 0 < s) (ell : ℕ) : + ((tail s ell).card : ℝ) ≤ s+1 := by + have he := count_bound s hs ell + have hh := card_upper he.1 + dsimp [tail] + linarith + +/-- Literal partition into full blocks and the end fragment. -/ +theorem full_or_tail (s : ℝ) (hs : 0 < s) (ell : ℕ) {q : ℤ} + (hq : q ∈ positions 0 ell) : + (∃ k : Fin (blockCount s ell), q ∈ block s k.val) ∨ q ∈ tail s ell := by + obtain ⟨hq0,hq1⟩ := mem_positions.mp hq + by_cases he : (q : ℝ)+1/2 < (blockCount s ell : ℝ)*s + · let k := ⌊((q : ℝ)+1/2)/s⌋₊ + have hk : k < blockCount s ell := by + apply (Nat.floor_lt (div_nonneg hq0 hs.le)).mpr + exact (div_lt_iff₀ hs).mpr he + left + refine ⟨⟨k,hk⟩,?_⟩ + apply mem_positions.mpr + simp only [Int.cast_natCast] + exact ⟨(le_div_iff₀ hs).mp (Nat.floor_le (div_nonneg hq0 hs.le)), + (div_lt_iff₀ hs).mp (Nat.lt_floor_add_one (((q : ℝ)+1/2)/s))⟩ + · right + exact mem_positions.mpr ⟨not_lt.mp he,hq1⟩ + +/-- A full block is entirely within its marked chain. -/ +theorem full_subset (s : ℝ) (hs : 0 < s) (ell : ℕ) (k : Fin (blockCount s ell)) : + block s k.val ⊆ positions 0 ell := by + intro q hq + obtain ⟨hlo,hhi⟩ := mem_positions.mp hq + apply mem_positions.mpr + have hk : (k.val : ℝ)+1 ≤ blockCount s ell := by exact_mod_cast k.isLt + have he := (count_bound s hs ell).1 + simp only [Int.cast_natCast] at hlo hhi + constructor + · have hkn : (0 : ℝ) ≤ k.val := Nat.cast_nonneg _ + nlinarith + · nlinarith + +/-- A grid block situated inside a comparison with one-block margins has a +full indicated target block. This includes negative offsets and reflections. -/ +theorem partner_full (s : ℝ) (hs : 0 < s) (reverse : Bool) (a k ν : ℤ) + (lo hi ell : ℝ) (herr : |(a : ℝ)-(ν : ℝ)*s| ≤ s) + (hlo : lo ≤ (k : ℝ)*s-s) (hhi : ((k : ℝ)+1)*s+s ≤ hi) + (htarget : if reverse then 0 ≤ (a : ℝ)-hi ∧ (a : ℝ)-lo ≤ ell + else 0 ≤ lo+(a : ℝ) ∧ hi+(a : ℝ) ≤ ell) : + 0 ≤ partnerIndex reverse ν k ∧ ((partnerIndex reverse ν k : ℤ)+1 : ℝ)*s ≤ ell := by + have he1 : (a : ℝ)-(ν : ℝ)*s ≤ s := (le_abs_self _).trans herr + have he2 : -s ≤ (a : ℝ)-(ν : ℝ)*s := by + have hh := neg_abs_le ((a : ℝ)-(ν : ℝ)*s) + linarith + cases reverse <;> simp only [Bool.false_eq_true,ite_false,ite_true,partnerIndex, + Int.cast_add,Int.cast_sub,Int.cast_one] at htarget ⊢ + · constructor + · have hz : (0 : ℝ) ≤ (k : ℝ)+(ν : ℝ) := by nlinarith [htarget.1] + exact_mod_cast hz + · nlinarith [htarget.2] + · constructor + · have hz : (0 : ℝ) ≤ (ν : ℝ)-(k : ℝ)-1 := by nlinarith [htarget.1] + exact_mod_cast hz + · nlinarith [htarget.2] + +theorem inverse_error (reverse : Bool) (a ν : ℤ) (s : ℝ) : + |(inverseOffset reverse a : ℝ)-(inverseOffset reverse ν : ℝ)*s| = + |(a : ℝ)-(ν : ℝ)*s| := by + cases reverse + · simp only [inverseOffset,Bool.false_eq_true,ite_false,Int.cast_neg] + have he : -(a : ℝ)- -(ν : ℝ)*s = -((a : ℝ)-(ν : ℝ)*s) := by ring + rw [he,abs_neg] + · rfl + +/-- Uniformly bounded exceptional grid indices near one real cut. -/ +def nearCut (s t : ℝ) : Finset ℤ := Finset.Icc ⌈t/s-5⌉ ⌊t/s+5⌋ + +theorem mem_nearCut (s t : ℝ) (k : ℤ) : + k ∈ nearCut s t ↔ |(k : ℝ)-t/s| ≤ 5 := by + simp only [nearCut,Finset.mem_Icc,Int.ceil_le,Int.le_floor,abs_le] + constructor <;> rintro ⟨h1,h2⟩ <;> constructor <;> linarith + +theorem nearCut_card (s t : ℝ) : (nearCut s t).card ≤ 11 := by + have h1 := Int.le_ceil (t/s-5) + have h2 := Int.floor_le (t/s+5) + have hi : ⌊t/s+5⌋+1-⌈t/s-5⌉ ≤ (11 : ℤ) := by + have hr : ((⌊t/s+5⌋ : ℤ) : ℝ)+1-⌈t/s-5⌉ ≤ 11 := by linarith + exact_mod_cast hr + simp only [nearCut,Int.card_Icc] + omega + +/-- A block containing a compared position and avoiding both endpoint +neighborhoods is deep inside that exact comparison interval. -/ +theorem margin_of_not_near (s : ℝ) (hs : 0 < s) (lo hi : ℝ) (k q : ℤ) + (hq : q ∈ block s k) (hdom : q ∈ positions lo hi) + (hnlo : k ∉ nearCut s lo) (hnhi : k ∉ nearCut s hi) : + lo ≤ (k : ℝ)*s-s ∧ ((k : ℝ)+1)*s+s ≤ hi := by + have hlo := not_le.mp (mt (mem_nearCut s lo k).mpr hnlo) + have hhi := not_le.mp (mt (mem_nearCut s hi k).mpr hnhi) + obtain ⟨hk0,hk1⟩ := mem_positions.mp hq + obtain ⟨hq0,hq1⟩ := mem_positions.mp hdom + rcases (lt_abs.mp hlo) with hl | hl + · have hz : 5+lo/s < (k : ℝ) := by linarith + have hz' := (div_lt_iff₀ hs).mp (show lo/s < (k : ℝ)-5 by linarith) + constructor + · nlinarith + · rcases (lt_abs.mp hhi) with hh | hh + · have ht := (div_lt_iff₀ hs).mp (show hi/s < (k : ℝ)-5 by linarith) + nlinarith + · have ht := (lt_div_iff₀ hs).mp (show (k : ℝ)+5 < hi/s by linarith) + nlinarith + · have ht := (lt_div_iff₀ hs).mp (show (k : ℝ)+5 < lo/s by linarith) + nlinarith + +end TorsionFreeZeroDivisors.BlockAlignment + +/-! Extraction of the actual partial matching of block occurrences from the +original comparison pairing. Comparison sides are retained, +so a block cannot join itself by aggregating several short comparisons. -/ + +end + +end OAI diff --git a/lean/OAI/Algebra/GroupRing/BlockPropagation.lean b/lean/OAI/Algebra/GroupRing/BlockPropagation.lean new file mode 100644 index 0000000000000000000000000000000000000000..0b4d5013c1e9784bc9f38a16216b50aff104cac7 --- /dev/null +++ b/lean/OAI/Algebra/GroupRing/BlockPropagation.lean @@ -0,0 +1,371 @@ +import Mathlib + +namespace OAI + +noncomputable section + +namespace TorsionFreeZeroDivisors.BlockPropagation + +open scoped BigOperators + +structure Skeleton (I : Type*) where + root : I + parent : I → I + rank : I → ℕ + decreasing : ∀ i, i ≠ root → rank (parent i) < rank i + +/-- A connected comparison graph supplies a decreasing parent system, with +any chosen block as root (in particular the minimizer of its weight bin). -/ +theorem exists_skeleton {I : Type*} (G : SimpleGraph I) (hc : G.Connected) (r : I) : + ∃ S : Skeleton I, S.root = r ∧ ∀ i, i ≠ r → G.Adj i (S.parent i) := by + classical + have hn (i : I) (hi : i ≠ r) : + ∃ j, G.Adj i j ∧ G.dist j r < G.dist i r := by + obtain ⟨p, hp⟩ := hc.exists_walk_length_eq_dist i r + cases p with + | nil => exact False.elim (hi rfl) + | @cons a b c hab p => + refine ⟨b, hab, ?_⟩ + have hle := G.dist_le p + simp only [SimpleGraph.Walk.length_cons] at hp + omega + let parent := fun i => if hi : i = r then r else (hn i hi).choose + refine ⟨⟨r, parent, fun i => G.dist i r, ?_⟩, rfl, ?_⟩ + · intro i hi + dsimp [parent] + rw [dite_eq_right hi] + exact (hn i hi).choose_spec.2 + · intro i hi + dsimp [parent] + rw [dite_eq_right hi] + exact (hn i hi).choose_spec.1 + +namespace Skeleton + +variable {I T : Type*} (S : Skeleton I) (h : I → ℕ) + (known : (i : I) → Finset (Fin (h i))) + (determine : (i : I) → Fin (h i) → (Fin (h (S.parent i)) → T) → T) + +abbrev Assignment := (i : I) → Fin (h i) → T + +def Consistent (w : Assignment h (T := T)) : Prop := + ∀ i, i ≠ S.root → ∀ k ∈ known i, w i k = determine i k (w (S.parent i)) + +abbrev FreePosition := {p : (i : I) × Fin (h i) // p.1 ≠ S.root ∧ p.2 ∉ known p.1} + +/-- The omitted coordinates plus the root word determine every full word. -/ +theorem assignment_ext {w v : Assignment h (T := T)} + (hw : S.Consistent h known determine w) (hv : S.Consistent h known determine v) + (hroot : w S.root = v S.root) + (hfree : ∀ p : S.FreePosition h known, w p.val.1 p.val.2 = v p.val.1 p.val.2) : w = v := by + have hall (n : ℕ) : ∀ i, S.rank i = n → w i = v i := by + induction n using Nat.strong_induction_on with + | h n ih => + intro i hi + by_cases hir : i = S.root + · subst i + exact hroot + · funext k + by_cases hk : k ∈ known i + · rw [hw i hir k hk, hv i hir k hk] + have hp : S.rank (S.parent i) < n := hi ▸ S.decreasing i hir + rw [ih _ hp (S.parent i) rfl] + · exact hfree ⟨⟨i,k⟩,hir,hk⟩ + funext i + exact hall (S.rank i) i rfl + +variable [Fintype I] [Fintype T] [DecidableEq I] + +/-- Exact number of unrecorded letters after the tree comparisons. -/ +theorem card_freePositions : + Nat.card (S.FreePosition h known) = + ∑ i : {i : I // i ≠ S.root}, (h i.val - (known i.val).card) := by + classical + let e : S.FreePosition h known ≃ + (i : {i : I // i ≠ S.root}) × {k : Fin (h i.val) // k ∉ known i.val} := + { toFun := fun p => ⟨⟨p.val.1,p.property.1⟩,⟨p.val.2,p.property.2⟩⟩ + invFun := fun p => ⟨⟨p.1.val,p.2.val⟩,p.1.property,p.2.property⟩ + left_inv := fun _ => rfl + right_inv := fun _ => rfl } + rw [Nat.card_congr e, Nat.card_eq_fintype_card, Fintype.card_sigma] + apply Finset.sum_congr rfl + intro i _ + rw [Fintype.card_subtype_compl, Fintype.card_fin, Fintype.card_coe] + +/-- Choose actual root words from R, then at most |T| choices per omitted +coordinate. The remaining coordinates are forced by the comparisons. -/ +theorem card_assignments (R : Finset (Fin (h S.root) → T)) : + Nat.card {w : Assignment h (T := T) // + S.Consistent h known determine w ∧ w S.root ∈ R} ≤ + R.card * (Fintype.card T) ^ + (∑ i : {i : I // i ≠ S.root}, (h i.val - (known i.val).card)) := by + classical + let encode : {w : Assignment h (T := T) // + S.Consistent h known determine w ∧ w S.root ∈ R} → + R × (S.FreePosition h known → T) := fun w => + (⟨w.val S.root,w.property.2⟩,fun p => w.val p.val.1 p.val.2) + have henc : Function.Injective encode := by + intro w v he + apply Subtype.ext + apply S.assignment_ext h known determine w.property.1 v.property.1 + · exact congrArg (fun p => p.1.val) he + · intro p + exact congrFun (congrArg Prod.snd he) p + have hc := Fintype.card_le_of_injective encode henc + rw [Fintype.card_prod, Fintype.card_coe, Fintype.card_fun] at hc + have he : Fintype.card (S.FreePosition h known) = + ∑ i : {i : I // i ≠ S.root}, (h i.val - (known i.val).card) := by + simpa only [Nat.card_eq_fintype_card] using S.card_freePositions h known + simpa only [Nat.card_eq_fintype_card, he] using hc + +end Skeleton +end TorsionFreeZeroDivisors.BlockPropagation + +/-! Label projection along connected substring links. +A link determines a specified subset of one block from positions in its +partner word, via a letter equivalence such as identity or inversion. +No embedding of inactive graph vertices is requested or assumed. -/ +namespace TorsionFreeZeroDivisors.StageLabels + +section +open scoped Classical BigOperators +open BlockPropagation + +variable {I T : Type*} [Fintype I] [Fintype T] [Nonempty T] + +/-- A finite directed presentation of substring links. Both directions of +an actual interval-isometry link may be included; extra constraints only +reduce the set of feasible strings. -/ +structure Links (h : I → ℕ) where + graph : SimpleGraph I + known : (i j : I) → Finset (Fin (h i)) + source : (i j : I) → known i j → Fin (h j) + symbol : I → I → (T ≃ T) + +namespace Links +variable {h : I → ℕ} (L : Links (T := T) h) + +abbrev Word := (i : I) → Fin (h i) → T + +def Consistent (w : Word (T := T) (h := h)) : Prop := + ∀ i j, L.graph.Adj i j → ∀ k : L.known i j, + w i k.val = L.symbol i j (w j (L.source i j k)) + +abbrev RootedWords (r : I) (R : Finset (Fin (h r) → T)) := + {w : Word (T := T) (h := h) // L.Consistent w ∧ w r ∈ R} + +/-- Full strings on a connected link component, with a chosen root, are +bounded by the root choices times one alphabet choice per missing position. -/ +theorem connected_count (hc : L.graph.Connected) (r : I) + (R : Finset (Fin (h r) → T)) (e : ℕ) + (he : ∀ i j, L.graph.Adj i j → h i - (L.known i j).card ≤ e) : + Fintype.card (L.RootedWords r R) ≤ + R.card * (Fintype.card T)^(e*(Fintype.card I-1)) := by + obtain ⟨S,hr,hparent⟩ := exists_skeleton L.graph hc r + subst r + let known := fun i => L.known i (S.parent i) + let determine := fun i (k : Fin (h i)) (w : Fin (h (S.parent i)) → T) => + if hk : k ∈ known i then L.symbol i (S.parent i) (w (L.source i (S.parent i) ⟨k,hk⟩)) + else Classical.choice (inferInstance : Nonempty T) + let forget : L.RootedWords S.root R → + {w : Skeleton.Assignment h (T := T) // S.Consistent h known determine w ∧ w S.root ∈ R} := + fun w => ⟨w.val,by + constructor + · intro i hi k hk + dsimp [determine] + rw [dite_eq_left hk] + exact w.property.1 i (S.parent i) (hparent i hi) ⟨k,hk⟩ + · exact w.property.2⟩ + have hf : Function.Injective forget := by + intro a b heq + apply Subtype.ext + exact congrArg (fun q : {w : Skeleton.Assignment h (T := T) // + S.Consistent h known determine w ∧ w S.root ∈ R} => q.val) heq + have hk : (∑ i : {i : I // i ≠ S.root}, (h i.val - (known i.val).card)) ≤ + e*(Fintype.card I-1) := by + calc + _ ≤ ∑ _i : {i : I // i ≠ S.root}, e := Finset.sum_le_sum (fun i _ => + he i.val (S.parent i.val) (hparent i.val i.property)) + _ = e*(Fintype.card I-1) := by + simp only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul,Fintype.card_subtype_compl] + have hr : Fintype.card {i : I // i = S.root} = 1 := by simp + rw [hr,mul_comm] + rfl + calc + _ ≤ Fintype.card {w : Skeleton.Assignment h (T := T) // + S.Consistent h known determine w ∧ w S.root ∈ R} := + Fintype.card_le_of_injective forget hf + _ ≤ R.card * (Fintype.card T)^ + (∑ i : {i : I // i ≠ S.root}, (h i.val - (known i.val).card)) := by + simpa only [Nat.card_eq_fintype_card] using S.card_assignments h known determine R + _ ≤ _ := Nat.mul_le_mul_left _ (Nat.pow_le_pow_right Fintype.card_pos hk) + +end Links + +variable {C : Type*} [Fintype C] (color : I → C) (h : I → ℕ) + +abbrev Fiber (c : C) := {i : I // color i = c} +abbrev PieceWord (c : C) := (i : Fiber color c) → Fin (h i.val) → T + +def restrictWord (w : (i : I) → Fin (h i) → T) (c : C) : PieceWord (T := T) color h c := + fun i => w i.val + +def activeComponents (A : Finset I) : Finset C := + A.image color + +def stageWords (A : Finset I) (P : ((i : I) → Fin (h i) → T) → Prop) : + Finset ((i : A) → Fin (h i.val) → T) := + (Finset.univ.filter P).image (fun w i => w i.val) + +omit [Nonempty T] [Fintype C] in +/-- Restriction to active blocks is bounded by complete strings only on the +components they meet. The representative root of a component need not be +active: the witness is a *string*, not an embedding in a sampled graph. -/ +theorem projection_count (A : Finset I) (P : ((i : I) → Fin (h i) → T) → Prop) + (Q : (c : C) → PieceWord (T := T) color h c → Prop) + (hQ : ∀ w, P w → ∀ c ∈ activeComponents color A, Q c (restrictWord color h w c)) : + (stageWords h A P).card ≤ + ∏ c : activeComponents color A, Fintype.card {w : PieceWord (T := T) color h c.val // Q c.val w} := by + have hs (w : stageWords h A P) : + ∃ W : (i : I) → Fin (h i) → T, P W ∧ (fun i : A => W i.val) = w.val := by + obtain ⟨W,hW,hw⟩ := Finset.mem_image.mp w.property + exact ⟨W,(Finset.mem_filter.mp hW).2,hw⟩ + let full (w : stageWords h A P) := (hs w).choose + have full_spec (w : stageWords h A P) : + P (full w) ∧ (fun i : A => full w i.val) = w.val := (hs w).choose_spec + let encode (w : stageWords h A P) : (c : activeComponents color A) → + {W : PieceWord (T := T) color h c.val // Q c.val W} := + fun c => ⟨restrictWord color h (full w) c.val,hQ _ (full_spec w).1 c.val c.property⟩ + have he : Function.Injective encode := by + intro w v heq + apply Subtype.ext + funext i + let c : activeComponents color A := ⟨color i.val,Finset.mem_image.mpr ⟨i.val,i.property,rfl⟩⟩ + have h1 := congrFun (congrArg (fun f => (f c).val) heq) (⟨i.val,rfl⟩ : Fiber color c.val) + change full w i.val = full v i.val at h1 + rw [← (congrFun (full_spec w).2 i),← (congrFun (full_spec v).2 i)] + exact h1 + have hc := Fintype.card_le_of_injective encode he + simpa only [Fintype.card_coe,Fintype.card_pi] using hc + +end + +open scoped Classical BigOperators +variable {I T : Type*} [Fintype I] [Fintype T] [Nonempty T] +variable {h : I → ℕ} (L : Links (T := T) h) + +namespace Links + +def component (c : L.graph.ConnectedComponent) : Links (T := T) (fun i : c => h i.val) where + graph := c.toSimpleGraph + known i j := L.known i.val j.val + source i j := L.source i.val j.val + symbol i j := L.symbol i.val j.val + +omit [Fintype I] [Fintype T] [Nonempty T] in +theorem restrict_consistent {w : (i : I) → Fin (h i) → T} (hw : L.Consistent w) + (c : L.graph.ConnectedComponent) : + (L.component c).Consistent (fun i => w i.val) := by + intro i j hij k + exact hw i.val j.val hij k + +/-- Exact local bound on one actual connected component; its root is arbitrary. -/ +theorem component_count (c : L.graph.ConnectedComponent) (r : c) + (R : Finset (Fin (h r.val) → T)) (e : ℕ) + (he : ∀ i j, L.graph.Adj i j → h i - (L.known i j).card ≤ e) : + Fintype.card ((L.component c).RootedWords r R) ≤ + R.card * (Fintype.card T)^(e*(Fintype.card c-1)) := by + have hc : (L.component c).graph.Connected := c.connected_toSimpleGraph + have hh := (L.component c).connected_count hc r R e + (fun i j hij => he i.val j.val hij) + simpa only [← Nat.card_eq_fintype_card] using hh + +omit [Fintype T] [Nonempty T] in +/-- Sum of sizes only over components met by the stage. -/ +theorem active_component_size (A : Finset I) : + (∑ c : activeComponents L.graph.connectedComponentMk A, Fintype.card c.val) ≤ + Fintype.card I := by + let f : (c : activeComponents L.graph.connectedComponentMk A) × c.val → I := + fun x => x.2.val + have hf : Function.Injective f := by + rintro ⟨c,i⟩ ⟨d,j⟩ hij + change i.val = j.val at hij + have hcd : c = d := Subtype.ext (i.property.symm.trans (hij ▸ j.property)) + subst d + have hi : i = j := Subtype.ext hij + subst j + rfl + simpa only [Fintype.card_sigma] using Fintype.card_le_of_injective f hf + +/-- Completing strings on each active link component before projection gives +an exponential stage bound. No vertices of an inactive chain are embedded. -/ +theorem stage_exp (A : Finset I) + (r : (c : L.graph.ConnectedComponent) → c) + (R : (c : L.graph.ConnectedComponent) → Finset (Fin (h (r c).val) → T)) + (P : ((i : I) → Fin (h i) → T) → Prop) + (hP : ∀ w, P w → L.Consistent w) + (hroot : ∀ w, P w → ∀ c, w (r c).val ∈ R c) + (e : ℕ) (he : ∀ i j, L.graph.Adj i j → h i - (L.known i j).card ≤ e) + (cost : L.graph.ConnectedComponent → ℝ) + (hcost : ∀ c, ((R c).card : ℝ) ≤ Real.exp (cost c)) : + ((stageWords h A P).card : ℝ) ≤ + Real.exp ((∑ c : activeComponents L.graph.connectedComponentMk A, cost c.val) + + (e : ℝ) * Fintype.card I * Real.log (Fintype.card T)) := by + let C := activeComponents L.graph.connectedComponentMk A + have hp : (stageWords h A P).card ≤ + ∏ c : C, Fintype.card ((L.component c.val).RootedWords (r c.val) (R c.val)) := by + have hh := projection_count L.graph.connectedComponentMk h A P + (fun c w => (L.component c).Consistent w ∧ w (r c) ∈ R c) + (fun w hw c _ => ⟨L.restrict_consistent (hP w hw) c, hroot w hw c⟩) + convert hh using 1 + apply congrArg + funext c + simp only [← Nat.card_eq_fintype_card] + rfl + have ha : 0 < (Fintype.card T : ℝ) := by exact_mod_cast Fintype.card_pos + have halog : 0 ≤ Real.log (Fintype.card T) := Real.log_nonneg (by exact_mod_cast Fintype.card_pos (α := T)) + have hcard (c : C) : + (Fintype.card ((L.component c.val).RootedWords (r c.val) (R c.val)) : ℝ) ≤ + Real.exp (cost c.val + (e : ℝ) * Fintype.card c.val * Real.log (Fintype.card T)) := by + have hn := L.component_count c.val (r c.val) (R c.val) e he + have hn' : (Fintype.card ((L.component c.val).RootedWords (r c.val) (R c.val)) : ℝ) ≤ + ((R c.val).card : ℝ) * (Fintype.card T : ℝ)^(e*(Fintype.card c.val-1)) := by exact_mod_cast hn + calc + _ ≤ ((R c.val).card : ℝ) * (Fintype.card T : ℝ)^(e*(Fintype.card c.val-1)) := hn' + _ ≤ Real.exp (cost c.val) * (Fintype.card T : ℝ)^(e*(Fintype.card c.val-1)) := + mul_le_mul_of_nonneg_right (hcost _) (pow_nonneg ha.le _) + _ = Real.exp (cost c.val + (e*(Fintype.card c.val-1) : ℕ) * Real.log (Fintype.card T)) := by + rw [Real.exp_add,Real.exp_nat_mul,Real.exp_log ha] + _ ≤ _ := by + apply Real.exp_le_exp.mpr + apply add_le_add_right + apply mul_le_mul_of_nonneg_right _ halog + rw [Nat.cast_mul] + apply mul_le_mul_of_nonneg_left _ (Nat.cast_nonneg e) + exact_mod_cast Nat.sub_le (Fintype.card c.val) 1 + calc + _ ≤ (∏ c : C, (Fintype.card ((L.component c.val).RootedWords (r c.val) (R c.val)) : ℝ)) := by + exact_mod_cast hp + _ ≤ ∏ c : C, Real.exp (cost c.val + (e : ℝ)*Fintype.card c.val*Real.log (Fintype.card T)) := + Finset.prod_le_prod₀ (fun _ _ => Nat.cast_nonneg _) (fun component _ => hcard component) + _ = Real.exp ((∑ c : C, cost c.val) + + (e : ℝ)*(∑ c : C, (Fintype.card c.val : ℝ))*Real.log (Fintype.card T)) := by + rw [← Real.exp_sum,Finset.sum_add_distrib] + congr 1 + simp only [Finset.mul_sum,Finset.sum_mul] + _ ≤ _ := by + apply Real.exp_le_exp.mpr + apply add_le_add_right + apply mul_le_mul_of_nonneg_right _ halog + apply mul_le_mul_of_nonneg_left _ (Nat.cast_nonneg e) + exact_mod_cast L.active_component_size A + +end Links +end TorsionFreeZeroDivisors.StageLabels + +/-! The link constraints are now extracted from the actual occurrence +matching, rather than supplied as an unexplained propagation hypothesis. -/ + +end + +end OAI diff --git a/lean/OAI/Algebra/GroupRing/BoundedSystem.lean b/lean/OAI/Algebra/GroupRing/BoundedSystem.lean new file mode 100644 index 0000000000000000000000000000000000000000..948e358dbeb5d2908817c5b550b33f55562a4afb --- /dev/null +++ b/lean/OAI/Algebra/GroupRing/BoundedSystem.lean @@ -0,0 +1,499 @@ +import Mathlib +import OAI.Algebra.GroupRing.SupportedImage +import OAI.Algebra.GroupRing.WeightedGirth + +namespace OAI + +noncomputable section + +namespace TorsionFreeZeroDivisors.SampleGraph +open scoped Classical BigOperators +open PortSubdivision ComparedBlocks ComparisonGeometry GirthAsymptotics TypedGraphs ActualPatternEvent +attribute [instance] BoundedSystem.fP BoundedSystem.fE + +namespace BoundedSystem +variable {Bnd K I rep : ℕ} {r : Match rep} {x : VA rep} {y : VB rep} + (s : BoundedSystem Bnd K I rep r x y) +def data (hr : r∈samples rep) : AmbientPattern.Data Bnd K I rep where + V := VA rep⊕VB rep + D := DA rep⊕DB rep + P := s.P + E := s.E + graph := graph rep r + side := SumPort.side + side_edge := SumPort.side_edge _ _ + paths := s.paths + nonempty := s.nonempty + root := s.root + path_bound := s.path_bound + comparison_bound := s.comparison_bound + path_chain := s.path_chain + cyclic_chain := s.cyclic_chain + girth := weighted_girth rep r hr + length_le := s.length_le + length_ge := s.length_ge + comparisons := s.comparisons + lower := s.lower + upper := s.upper + lower_eq := s.lower_eq + upper_eq := s.upper_eq + lower_le := s.lower_le + upper_le := s.upper_le + reduced := s.reduced + unpaired_le := s.unpaired_le +lemma event (hr : r∈samples rep) : (s.data hr).event x y r := + ⟨label rep,label_reverse rep r,immersed rep r,s.compatible, + ⟨embeddingA rep r _ x s.rootA⟩,⟨embeddingB rep r _ y s.rootB⟩⟩ +end BoundedSystem + +/-- A literal finite typed graph on both sides, simultaneously with diameter, +large girth, and exclusion of every bounded nearly-paired rooted path system. +This is an actual-word theorem, not a condition on encoded surrogate patterns. -/ +theorem exists_avoiding (Bnd K I : ℕ) (hK : 0 Γ.origin (Γ.reverse d))).getD z + +omit [Fintype V] [Fintype D] in +lemma endpoint_nil : endpoint Γ z []=z := rfl +omit [Fintype V] [Fintype D] in +lemma endpoint_append (l : List D) (d : D) : endpoint Γ z (l++[d])=Γ.origin (Γ.reverse d) := by + simp [endpoint] + +def choices (l : List D) : Finset D := Finset.univ.filter fun d => + allowed d ∧ Γ.origin d=endpoint Γ z l ∧ ∀ e∈l.getLast?,d≠Γ.reverse e + +def walks : ℕ → Finset (List D) + | 0 => {[]} + | k+1 => (walks k).biUnion (fun l => (choices Γ allowed z l).image (fun d => l++[d])) + +omit [Fintype V] in +lemma mem_walks_succ {k : ℕ} {l : List D} : l∈walks Γ allowed z (k+1) ↔ + ∃ p∈walks Γ allowed z k,∃ d∈choices Γ allowed z p,l=p++[d] := by + simp only [walks,Finset.mem_biUnion,Finset.mem_image] + aesop + +omit [Fintype V] in +lemma length_mem {k : ℕ} {l : List D} (hl : l∈walks Γ allowed z k) : l.length=k := by + induction k generalizing l with + | zero => simpa only [List.length_nil] using congrArg List.length (Finset.mem_singleton.mp hl) + | succ k ih => + obtain ⟨p,hp,d,_,rfl⟩ := (mem_walks_succ Γ allowed z).mp hl + simp only [List.length_append,List.length_singleton,ih hp] + +omit [Fintype V] in +lemma chain_mem {k : ℕ} {l : List D} (hl : l∈walks Γ allowed z k) : + l.IsChain (PortWalk.step Γ.origin Γ.reverse) := by + induction k generalizing l with + | zero => have := Finset.mem_singleton.mp hl; subst l; simp + | succ k ih => + obtain ⟨p,hp,d,hd,rfl⟩ := (mem_walks_succ Γ allowed z).mp hl + have hd := (Finset.mem_filter.mp hd).2 + refine (ih hp).append (by simp) ?_ + intro e he f hf + have hf : f=d := by simpa [eq_comm] using hf + subst f + refine ⟨?_,hd.2.2 e he⟩ + have he' : p.getLast?=some e := he + simpa only [endpoint,he',Option.map_some,Option.getD_some] using hd.2.1.symm + +omit [Fintype V] in +lemma allowed_mem {k : ℕ} {l : List D} (hl : l∈walks Γ allowed z k) : + ∀ d∈l,allowed d := by + induction k generalizing l with + | zero => have := Finset.mem_singleton.mp hl; subst l; simp + | succ k ih => + obtain ⟨p,hp,e,he,rfl⟩ := (mem_walks_succ Γ allowed z).mp hl + intro d hd + rcases List.mem_append.mp hd with hd | hd + · exact ih hp d hd + · have hde : d=e := by simpa [eq_comm] using hd + subst d + exact (Finset.mem_filter.mp he).2.1 + +omit [Fintype V] in +lemma head_mem {k : ℕ} {l : List D} (hl : l∈walks Γ allowed z k) : + ∀ d∈l.head?,Γ.origin d=z := by + induction k generalizing l with + | zero => have := Finset.mem_singleton.mp hl; subst l; simp + | succ k ih => + obtain ⟨p,hp,e,he,rfl⟩ := (mem_walks_succ Γ allowed z).mp hl + intro d hd + cases p with + | nil => + have hde : d=e := by simpa [eq_comm] using hd + subst d + exact (Finset.mem_filter.mp he).2.2.1 + | cons f p => + have hdf : d=f := by simpa [eq_comm] using hd + subst d + exact ih hp f (by simp) + +omit [Fintype V] in +lemma choices_card (l : List D) (hdeg : ∀ v,3≤(Finset.univ.filter (fun d => allowed d ∧ Γ.origin d=v)).card) : + 2≤(choices Γ allowed z l).card := by + let s := Finset.univ.filter (fun d => allowed d ∧ Γ.origin d=endpoint Γ z l) + cases he : l.getLast? with + | none => + have hh : choices Γ allowed z l=s := by ext d; simp [choices,s,he] + rw [hh] + exact (by omega : 2≤3).trans (hdeg _) + | some e => + have hh : choices Γ allowed z l=s.erase (Γ.reverse e) := by + ext d + simp only [choices,s,Finset.mem_filter,Finset.mem_univ,true_and,he, + Option.mem_some_iff,Finset.mem_erase] + constructor + · rintro ⟨ha,ho,hh⟩ + exact ⟨hh e rfl,ha,ho⟩ + · rintro ⟨hh,ha,ho⟩ + exact ⟨ha,ho,fun f hf => hf ▸ hh⟩ + rw [hh] + have hc3 : s.card ≤ (s.erase (Γ.reverse e)).card+1 := by + calc + _ ≤ (insert (Γ.reverse e) (s.erase (Γ.reverse e))).card := Finset.card_le_card (by intro d hd; by_cases h : d=Γ.reverse e <;> simp_all) + _ ≤ _ := Finset.card_insert_le _ _ + have hc' := hdeg (endpoint Γ z l) + change 3 ≤ s.card at hc' + omega + +omit [Fintype V] in +lemma card_walks_succ (k : ℕ) (hdeg : ∀ v,3≤(Finset.univ.filter (fun d => allowed d ∧ Γ.origin d=v)).card) : + 2*(walks Γ allowed z k).card≤(walks Γ allowed z (k+1)).card := by + rw [walks,Finset.card_biUnion] + · calc + _ = ∑ _l∈walks Γ allowed z k,2 := by simp [Nat.mul_comm] + _ ≤ _ := by + apply Finset.sum_le_sum + intro l _ + rw [Finset.card_image_of_injective _ (by intro d e h; simpa using (List.append_cancel_left h))] + exact choices_card Γ allowed z l hdeg + · intro p hp q hq hpq + apply Finset.disjoint_left.mpr + intro l hl hl' + obtain ⟨d,_,hd⟩ := Finset.mem_image.mp hl + obtain ⟨e,_,he⟩ := Finset.mem_image.mp hl' + have hh := List.append_inj (hd.trans he.symm) ((length_mem Γ allowed z hp).trans (length_mem Γ allowed z hq).symm) + exact hpq hh.1 + +omit [Fintype V] in +lemma card_walks (k : ℕ) (hdeg : ∀ v,3≤(Finset.univ.filter (fun d => allowed d ∧ Γ.origin d=v)).card) : + 2^k≤(walks Γ allowed z k).card := by + induction k with + | zero => simp [walks] + | succ k ih => + calc + _ = 2*2^k := by rw [pow_succ]; omega + _ ≤ 2*(walks Γ allowed z k).card := Nat.mul_le_mul_left 2 ih + _ ≤ _ := card_walks_succ Γ allowed z k hdeg + +/-- Collision of equal-length nonbacktracking paths, before any cancellation. -/ +def Collision (k : ℕ) : Prop := + ∃ p∈walks Γ allowed z k,∃ q∈walks Γ allowed z k,p≠q ∧ endpoint Γ z p=endpoint Γ z q + +lemma collision_exists (k : ℕ) (hk : Fintype.card V<2^k) + (hdeg : ∀ v,3≤(Finset.univ.filter (fun d => allowed d ∧ Γ.origin d=v)).card) : + Collision Γ allowed z k := by + apply Finset.exists_ne_map_eq_of_card_lt_of_maps_to + (t:=Finset.univ) (f:=endpoint Γ z) + · simpa only [Finset.card_univ] using hk.trans_le (card_walks Γ allowed z k hdeg) + · intro p _ + exact Finset.mem_univ _ + +omit [Fintype V] [Fintype D] in +lemma chain_reverse {l : List D} (hl : l.IsChain (PortWalk.step Γ.origin Γ.reverse)) : + (l.reverse.map Γ.reverse).IsChain (PortWalk.step Γ.origin Γ.reverse) := by + rw [List.isChain_map,List.isChain_reverse] + apply hl.imp + intro a b hab + refine ⟨?_,?_⟩ + · simpa only [PortWalk.step,PortGraph.reverse_reverse_apply] using hab.1.symm + · intro hh + apply hab.2 + simpa only [PortGraph.reverse_reverse_apply] using hh.symm + +/-- A based reduced loop with excluded darts never used. No cyclic reduction at +its base is asserted or needed. Least collision length avoids common suffixes. -/ +theorem based_loop (k : ℕ) (hk : Fintype.card V<2^k) + (hdeg : ∀ v,3≤(Finset.univ.filter (fun d => allowed d ∧ Γ.origin d=v)).card) + (hsymm : ∀ d,allowed d → allowed (Γ.reverse d)) : + ∃ l : List D,l≠[] ∧ l.length≤2*k ∧ + l.IsChain (PortWalk.step Γ.origin Γ.reverse) ∧ + (∀ d∈l,allowed d) ∧ (∀ d∈l.head?,Γ.origin d=z) ∧ endpoint Γ z l=z := by + have H : ∃ m,Collision Γ allowed z m := ⟨k,collision_exists Γ allowed z k hk hdeg⟩ + let m := Nat.find H + have hmle : m≤k := Nat.find_min' H (collision_exists Γ allowed z k hk hdeg) + obtain ⟨p,hp,q,hq,hpq,hep⟩ := Nat.find_spec H + have hmpos : 0 < m := by + by_contra hn + have hm0 : m=0 := by omega + change p∈walks Γ allowed z m at hp + change q∈walks Γ allowed z m at hq + rw [hm0] at hp hq + exact hpq ((Finset.mem_singleton.mp hp).trans (Finset.mem_singleton.mp hq).symm) + obtain ⟨j,hj⟩ := Nat.exists_eq_succ_of_ne_zero (Nat.ne_of_gt hmpos) + change p∈walks Γ allowed z m at hp + change q∈walks Γ allowed z m at hq + rw [hj] at hp hq + obtain ⟨p',hp',d,hd,hpd⟩ := (mem_walks_succ Γ allowed z).mp hp + obtain ⟨q',hq',e,he,hqe⟩ := (mem_walks_succ Γ allowed z).mp hq + have hde : d≠e := by + intro hde + have hc : Collision Γ allowed z j := by + refine ⟨p',hp',q',hq',?_,?_⟩ + · intro heq + apply hpq + simp only [hpd,hqe,heq,hde] + · exact (Finset.mem_filter.mp hd).2.2.1.symm.trans + (hde ▸ (Finset.mem_filter.mp he).2.2.1) + exact Nat.find_min H (by change j < m; omega) hc + have hpne : p≠[] := by + intro hh + have hh' := length_mem Γ allowed z hp + simp only [hh,List.length_nil] at hh' + omega + have hqne : q≠[] := by + intro hh + have hh' := length_mem Γ allowed z hq + simp only [hh,List.length_nil] at hh' + omega + refine ⟨p++q.reverse.map Γ.reverse,?_,?_,?_,?_,?_,?_⟩ + · intro hh + exact hpne (List.append_eq_nil_iff.mp hh).1 + · simp only [List.length_append,List.length_map,List.length_reverse, + length_mem Γ allowed z hp,length_mem Γ allowed z hq] + omega + · apply (chain_mem Γ allowed z hp).append (chain_reverse Γ (chain_mem Γ allowed z hq)) + intro x hx y hy + have hxd : x=d := by simpa only [hpd,List.getLast?_append,List.getLast?_singleton, + Option.some_or,Option.some.injEq] using hx.symm + have hye : y=Γ.reverse e := by + simpa only [hqe,List.head?_map,List.head?_reverse,List.getLast?_append, + List.getLast?_singleton,Option.some_or,Option.map_some,Option.some.injEq] using hy.symm + subst x; subst y + refine ⟨?_,fun h => hde (Γ.reverse_reverse.injective h).symm⟩ + simpa only [hpd,hqe,endpoint_append] using hep + · intro x hx + rcases List.mem_append.mp hx with hx|hx + · exact allowed_mem Γ allowed z hp x hx + · obtain ⟨y,hy,rfl⟩ := List.mem_map.mp hx + exact hsymm y (allowed_mem Γ allowed z hq y (List.mem_reverse.mp hy)) + · intro x hx + apply head_mem Γ allowed z hp x + cases p with + | nil => exact (hpne rfl).elim + | cons a p => simpa using hx + · cases hqq : q with + | nil => exact (hqne hqq).elim + | cons a q' => + simp only [List.reverse_cons,List.map_append,List.map_singleton,←List.append_assoc,endpoint_append, + PortGraph.reverse_reverse_apply] + exact head_mem Γ allowed z (hqq ▸ hq) a (by simp) + +/-- A logarithmic loop bound, valid even before excluding loops and parallel edges. -/ +theorem logarithmic_based_loop + (hdeg : ∀ v,3≤(Finset.univ.filter (fun d => allowed d ∧ Γ.origin d=v)).card) + (hsymm : ∀ d,allowed d → allowed (Γ.reverse d)) : + ∃ l : List D,l≠[] ∧ l.length≤2*(Nat.log 2 (Fintype.card V)+1) ∧ + l.IsChain (PortWalk.step Γ.origin Γ.reverse) ∧ + (∀ d∈l,allowed d) ∧ (∀ d∈l.head?,Γ.origin d=z) ∧ endpoint Γ z l=z := + based_loop Γ allowed z _ (Nat.lt_pow_succ_log_self (by decide) _) hdeg hsymm + +end +open scoped Classical BigOperators +open PortSubdivision WeightedMoore +variable {V D : Type} (Γ : PortGraph V D) + +structure ReducedPath (a b : V) (l : List D) : Prop where + chain : l.IsChain (PortWalk.step Γ.origin Γ.reverse) + start : ∀ d∈l.head?,Γ.origin d=a + finish : endpoint Γ a l=b + +lemma endpoint_append_list (a : V) (p q : List D) : + endpoint Γ a (p++q)=endpoint Γ (endpoint Γ a p) q := by + simp only [endpoint,List.getLast?_append] + cases p.getLast? <;> cases q.getLast? <;> rfl + +namespace ReducedPath +variable {Γ} {a b c : V} {p q : List D} +lemma nil_iff (h : ReducedPath Γ a b []) : a=b := h.finish +lemma last (h : ReducedPath Γ a b p) {d : D} (hd : d∈p.getLast?) : Γ.origin (Γ.reverse d)=b := by + have hd : p.getLast?=some d := hd + simpa only [endpoint,hd,Option.map_some,Option.getD_some] using h.finish + +lemma append (hp : ReducedPath Γ a b p) (hq : ReducedPath Γ b c q) + (hb : ∀ᵉ (x∈p.getLast?) (y∈q.head?),y≠Γ.reverse x) : + ReducedPath Γ a c (p++q) where + chain := hp.chain.append hq.chain fun x hx y hy => ⟨(hp.last hx).trans (hq.start y hy).symm,hb x hx y hy⟩ + start := by + cases p with + | nil => + have hab : a=b := hp.nil_iff + intro d hd + simpa only [List.nil_append,hab] using hq.start d hd + | cons d p => + intro e he + exact hp.start e (by simpa using he) + finish := by rw [endpoint_append_list,hp.finish]; exact hq.finish + +lemma cyclic_join (hp : ReducedPath Γ a a p) + (hb : ∀ᵉ (x∈p.getLast?) (y∈p.head?),y≠Γ.reverse x) : + ∀ᵉ (x∈p.getLast?) (y∈p.head?),PortWalk.step Γ.origin Γ.reverse x y := by + intro x hx y hy + exact ⟨(hp.last hx).trans (hp.start y hy).symm,hb x hx y hy⟩ +end ReducedPath + +/-- Excluding an undirected edge means excluding both of its darts. -/ +def forbidden (d e : D) : Finset D := {d,Γ.reverse d,e,Γ.reverse e} +def avoids (d e x : D) : Prop := x∉forbidden Γ d e +lemma avoids_symm (d e x : D) (hx : avoids Γ d e x) : avoids Γ d e (Γ.reverse x) := by + simp only [avoids,forbidden,Finset.mem_insert,Finset.mem_singleton] at hx ⊢ + rcases not_or.mp hx with ⟨h₁,hx⟩ + rcases not_or.mp hx with ⟨h₂,hx⟩ + rcases not_or.mp hx with ⟨h₃,h₄⟩ + intro hx + rcases hx with hx|hx|hx|hx + · exact h₂ (by simpa using congrArg Γ.reverse hx) + · exact h₁ (Γ.reverse_reverse.injective hx) + · exact h₄ (by simpa using congrArg Γ.reverse hx) + · exact h₃ (Γ.reverse_reverse.injective hx) +lemma avoids_left (d e x : D) (hx : avoids Γ d e x) : x≠d ∧ x≠Γ.reverse d := by + have hx : x≠d ∧ x≠Γ.reverse d ∧ x≠e ∧ x≠Γ.reverse e := by + simpa only [avoids,forbidden,Finset.mem_insert,Finset.mem_singleton,not_or] using hx + exact ⟨hx.1,hx.2.1⟩ +lemma avoids_right (d e x : D) (hx : avoids Γ d e x) : x≠e ∧ x≠Γ.reverse e := by + have hx : x≠d ∧ x≠Γ.reverse d ∧ x≠e ∧ x≠Γ.reverse e := by + simpa only [avoids,forbidden,Finset.mem_insert,Finset.mem_singleton,not_or] using hx + exact hx.2.2 + +variable [Fintype V] [Fintype D] +omit [Fintype V] in +lemma avoiding_degree (d e : D) + (hdeg : ∀ v,7≤(Finset.univ.filter (fun x : D => Γ.origin x=v)).card) : + ∀ v,3≤(Finset.univ.filter (fun x => avoids Γ d e x ∧ Γ.origin x=v)).card := by + intro v + have hsub : Finset.univ.filter (fun x : D => Γ.origin x=v) ⊆ + Finset.univ.filter (fun x => avoids Γ d e x ∧ Γ.origin x=v) ∪ forbidden Γ d e := by + intro x hx + have hv := (Finset.mem_filter.mp hx).2 + by_cases hb : x∈forbidden Γ d e + · exact Finset.mem_union_right _ hb + · exact Finset.mem_union_left _ (Finset.mem_filter.mpr ⟨Finset.mem_univ _,hb,hv⟩) + have hc := (Finset.card_le_card hsub).trans (Finset.card_union_le _ _) + have hf : (forbidden Γ d e).card≤4 := by + unfold forbidden + calc + _ ≤ ({Γ.reverse d,e,Γ.reverse e}:Finset D).card+1 := Finset.card_insert_le _ _ + _ ≤ ({e,Γ.reverse e}:Finset D).card+2 := by have := Finset.card_insert_le (Γ.reverse d) ({e,Γ.reverse e}:Finset D); omega + _ ≤ ({Γ.reverse e}:Finset D).card+3 := by have := Finset.card_insert_le e ({Γ.reverse e}:Finset D); omega + _ = 4 := by simp + have hv := hdeg v + omega + +/-- Literal reduced based loops avoiding both prescribed unoriented edges. -/ +lemma avoiding_loop (d e : D) (z : V) + (hdeg : ∀ v,7≤(Finset.univ.filter (fun x : D => Γ.origin x=v)).card) : + ∃ l : List D,l≠[] ∧ l.length≤2*(Nat.log 2 (Fintype.card V)+1) ∧ + ReducedPath Γ z z l ∧ ∀ x∈l,avoids Γ d e x := by + obtain ⟨l,hn,hl,hc,ha,hs,he⟩ := logarithmic_based_loop Γ (avoids Γ d e) z + (avoiding_degree Γ d e hdeg) (avoids_symm Γ d e) + exact ⟨l,hn,hl,⟨hc,hs,he⟩,ha⟩ + +omit [Fintype D] in +lemma mem_head_eq {l : List D} (hn : l≠[]) {x : D} (hx : x∈l.head?) : x=l.head hn := by + have h := List.head?_eq_some_head hn + rw [h] at hx + exact Option.some.inj hx.symm +omit [Fintype D] in +lemma mem_last_eq {l : List D} (hn : l≠[]) {x : D} (hx : x∈l.getLast?) : x=l.getLast hn := by + have h := List.getLast?_eq_some_getLast hn + rw [h] at hx + exact Option.some.inj hx.symm + +/-- Short closure, before the uniform logarithmic-to-L bound. +Only a reduced return path is used; its length need not be minimal. -/ +theorem extend_of_return {a b : V} {p q : List D} + (hp : ReducedPath Γ a b p) (hpn : p≠[]) (hq : ReducedPath Γ b a q) + (hdeg : ∀ v,7≤(Finset.univ.filter (fun x : D => Γ.origin x=v)).card) : + ∃ t : List D,t.length≤q.length+4*(Nat.log 2 (Fintype.card V)+1) ∧ + ReducedPath Γ a a (p++t) ∧ + ∀ᵉ (x∈(p++t).getLast?) (y∈(p++t).head?),PortWalk.step Γ.origin Γ.reverse x y := by + by_cases hqn : q=[] + · subst q + have hba : b=a := hq.nil_iff + subst b + obtain ⟨j,hjn,hjl,hj,ha⟩ := avoiding_loop Γ (p.getLast hpn) (p.head hpn) a hdeg + have hjp : ReducedPath Γ a a (p++j) := hp.append hj (by + intro x hx y hy + have hx := mem_last_eq hpn hx + subst x + exact (avoids_left Γ _ _ _ (ha y (List.mem_of_mem_head? hy))).2) + refine ⟨j,?_,hjp,hjp.cyclic_join ?_⟩ + · simp only [List.length_nil,zero_add] + omega + · intro x hx y hy + rw [List.getLast?_append_of_ne_nil _ hjn] at hx + rw [List.head?_append_of_ne_nil _ hpn] at hy + have hy := mem_head_eq hpn hy + subst y + intro he + have hx' := (avoids_right Γ _ _ _ (ha x (List.mem_of_mem_getLast? hx))).2 + exact hx' (by simpa using (congrArg Γ.reverse he).symm) + · obtain ⟨jb,hjbn,hjbl,hjb,hab⟩ := avoiding_loop Γ (p.getLast hpn) (q.head hqn) b hdeg + obtain ⟨ja,hjan,hjal,hja,haa⟩ := avoiding_loop Γ (q.getLast hqn) (p.head hpn) a hdeg + have hpjb : ReducedPath Γ a b (p++jb) := hp.append hjb (by + intro x hx y hy + have hx := mem_last_eq hpn hx + subst x + exact (avoids_left Γ _ _ _ (hab y (List.mem_of_mem_head? hy))).2) + have hpjbq : ReducedPath Γ a a ((p++jb)++q) := hpjb.append hq (by + intro x hx y hy + rw [List.getLast?_append_of_ne_nil _ hjbn] at hx + have hy := mem_head_eq hqn hy + subst y + intro he + have hx' := (avoids_right Γ _ _ _ (hab x (List.mem_of_mem_getLast? hx))).2 + exact hx' (by simpa using (congrArg Γ.reverse he).symm)) + have hall : ReducedPath Γ a a (((p++jb)++q)++ja) := hpjbq.append hja (by + intro x hx y hy + rw [List.getLast?_append_of_ne_nil _ hqn] at hx + have hx := mem_last_eq hqn hx + subst x + exact (avoids_left Γ _ _ _ (haa y (List.mem_of_mem_head? hy))).2) + refine ⟨jb++q++ja,?_,?_,?_⟩ + · simp only [List.length_append] + omega + · simpa only [List.append_assoc] using hall + · have hcy := hall.cyclic_join (by + intro x hx y hy + rw [List.getLast?_append_of_ne_nil _ hjan] at hx + rw [List.append_assoc,List.append_assoc,List.head?_append_of_ne_nil _ hpn] at hy + have hy := mem_head_eq hpn hy + subst y + intro he + have hx' := (avoids_right Γ _ _ _ (haa x (List.mem_of_mem_getLast? hx))).2 + exact hx' (by simpa using (congrArg Γ.reverse he).symm)) + simpa only [List.append_assoc] using hcy + +end TorsionFreeZeroDivisors.ShortClosure + +end + +end OAI diff --git a/lean/OAI/Algebra/GroupRing/Cayley.lean b/lean/OAI/Algebra/GroupRing/Cayley.lean new file mode 100644 index 0000000000000000000000000000000000000000..1b2db6f9474bd4ebfcf5858dc3cc89dc07ebaae1 --- /dev/null +++ b/lean/OAI/Algebra/GroupRing/Cayley.lean @@ -0,0 +1,483 @@ +import Mathlib +import OAI.Algebra.GroupRing.Attachment + +namespace OAI + +noncomputable section + +open Set Metric Topology BigOperators +open Set Metric Topology + +namespace GroupRingTopology.Attachment + +section +open Set Metric Topology +universe u v w z +variable {X : Type u} {Y : Type v} [TopologicalSpace X] [TopologicalSpace Y] +variable {ι : Type w} {κ : Type z} {n : ℕ} +variable (a : ι → C(Sphere n,X)) (b : κ → C(Sphere n,Y)) + +def map (p : C(X,Y)) (σ : ι → κ) (h : ∀ i x, p (a i x) = b (σ i) x) : + C(Space a,Space b) := + lift a ⟨base b ∘ p,(continuous_base b).comp p.continuous⟩ + (fun i => cell b (σ i)) (fun i x => by simp only [cell_boundary,ContinuousMap.coe_mk,Function.comp_apply,h]) + +@[simp] lemma map_base (p : C(X,Y)) (σ : ι → κ) + (h : ∀ i x, p (a i x) = b (σ i) x) (x : X) : + map a b p σ h (base a x) = base b (p x) := rfl + +@[simp] lemma map_cell (p : C(X,Y)) (σ : ι → κ) + (h : ∀ i x, p (a i x) = b (σ i) x) (i : ι) (d : Disk n) : + map a b p σ h (cell a i d) = cell b (σ i) d := lift_cell a _ _ _ i d + +@[simp] lemma map_openCell (p : C(X,Y)) (σ : ι → κ) + (h : ∀ i x, p (a i x) = b (σ i) x) (i : ι) (d : OpenDisk n) : + map a b p σ h (openCell a i d) = openCell b (σ i) d := by + change map a b p σ h (Sum.inr ⟨i,d⟩) = Sum.inr ⟨σ i,d⟩ + rw [← cell_interior a i d,map_cell,cell_interior] + +lemma map_surjective (p : C(X,Y)) (σ : ι → κ) + (h : ∀ i x, p (a i x) = b (σ i) x) + (hp : Function.Surjective p) (hσ : Function.Surjective σ) : + Function.Surjective (map a b p σ h) := by + intro z + cases z with + | inl y => + obtain ⟨x,rfl⟩ := hp y + exact ⟨base a x,rfl⟩ + | inr q => + obtain ⟨i,hi⟩ := hσ q.1 + exact ⟨openCell a i q.2,by rw [map_openCell,hi]; rfl⟩ + +lemma map_isQuotientMap (p : C(X,Y)) (σ : ι → κ) + (h : ∀ i x, p (a i x) = b (σ i) x) + (hp : IsQuotientMap p) (hσ : Function.Surjective σ) : + IsQuotientMap (map a b p σ h) := by + refine ⟨?_,map_surjective a b p σ h hp.surjective hσ⟩ + rw [isCoinducing_iff] + intro U + constructor + · intro hU + rw [isOpen_iff] at hU ⊢ + constructor + · apply hp.isOpen_preimage.mp + exact hU.1 + · intro j + obtain ⟨i,rfl⟩ := hσ j + convert hU.2 i using 1 + ext d + simp only [Set.mem_preimage,map_cell] + · exact fun hU => hU.preimage (map a b p σ h).continuous + +end + +open Set Metric Topology +universe u v w z + +def FreeIndex (G : Type u) (ι : Type v) := G × ι + +instance {G : Type u} [Group G] {ι : Type v} : MulAction G (FreeIndex G ι) where + smul g p := (g * p.1,p.2) + one_smul p := by change ((1:G)*p.1,p.2)=p; simp only [one_mul]; rfl + mul_smul g h p := by change ((g*h)*p.1,p.2)=(g*(h*p.1),p.2); rw [mul_assoc] + +instance {G : Type u} [Group G] {ι : Type v} : IsCancelSMul G (FreeIndex G ι) where + right_cancel' _ _ _ he := mul_right_cancel (congrArg (fun p : FreeIndex G ι => p.1) he) + +variable {G : Type u} [Group G] +variable {E : Type v} [TopologicalSpace E] [MulAction G E] [ContinuousConstSMul G E] +variable {X : Type w} [TopologicalSpace X] {ι : Type z} {n : ℕ} +variable (a : ι → C(Sphere n,E)) + +def equivariantFamily : FreeIndex G ι → C(Sphere n,E) := + fun i => ⟨fun x => i.1 • a i.2 x,(continuous_const_smul i.1).comp (a i.2).continuous⟩ + +lemma equivariantFamily_smul (g : G) (i : FreeIndex G ι) (x : Sphere n) : + equivariantFamily (G := G) a (g • i) x = g • equivariantFamily a i x := mul_smul g i.1 _ + +instance equivariantAttachmentContinuousAction : + ContinuousConstSMul G (Space (equivariantFamily (G := G) a)) := + continuousConstSMul _ (equivariantFamily_smul a) + +variable (p : C(E,X)) (hp : IsQuotientCoveringMap p G) +variable (b : ι → C(Sphere n,X)) (h : ∀ i x, p (a i x) = b i x) + +include hp h in +lemma equivariantFamily_over (i : FreeIndex G ι) (x : Sphere n) : + p (equivariantFamily (G := G) a i x) = b i.2 x := + (hp.map_smul i.1).trans (h i.2 x) + +def coverMap : C(Space (equivariantFamily (G := G) a),Space b) := + map _ b p Prod.snd (equivariantFamily_over a p hp b h) + +lemma coverMap_isQuotient : IsQuotientMap (coverMap a p hp b h) := + map_isQuotientMap _ b p Prod.snd _ hp.toIsQuotientMap (fun i => ⟨(1,i),rfl⟩) + +lemma coverMap_fibers {e₁ e₂ : Space (equivariantFamily (G := G) a)} : + coverMap a p hp b h e₁ = coverMap a p hp b h e₂ ↔ e₁ ∈ MulAction.orbit G e₂ := by + classical + cases e₁ with + | inl x => + cases e₂ with + | inl y => + change Sum.inl (p x) = Sum.inl (p y) ↔ _ + rw [Sum.inl.injEq,hp.apply_eq_iff_mem_orbit] + constructor + · rintro ⟨g,hg⟩; exact ⟨g,congrArg Sum.inl hg⟩ + · rintro ⟨g,hg⟩; exact ⟨g,Sum.inl_injective hg⟩ + | inr q => + constructor + · intro hh + change base b (p x) = map _ b p Prod.snd _ (openCell _ q.1 q.2) at hh + erw [map_openCell] at hh + cases hh + · rintro ⟨g,hg⟩; cases hg + | inr q => + cases e₂ with + | inl y => + constructor + · intro hh + change map _ b p Prod.snd _ (openCell _ q.1 q.2) = base b (p y) at hh + erw [map_openCell] at hh + cases hh + · rintro ⟨g,hg⟩; cases hg + | inr r => + change map _ b p Prod.snd _ (openCell _ q.1 q.2) = + map _ b p Prod.snd _ (openCell _ r.1 r.2) ↔ _ + erw [map_openCell,map_openCell] + constructor + · intro hh + have hi : q.1.2 = r.1.2 := congrArg Sigma.fst (Sum.inr_injective hh) + have hd : q.2 = r.2 := congrArg (fun p : Σ _ : ι, OpenDisk n => p.2) (Sum.inr_injective hh) + refine ⟨q.1.1 * r.1.1⁻¹,?_⟩ + change Sum.inr ⟨((q.1.1 * r.1.1⁻¹) * r.1.1,r.1.2),r.2⟩ = Sum.inr q + simp only [inv_mul_cancel_right,← hi,← hd] + rfl + · rintro ⟨g,hg⟩ + change (Sum.inr ⟨g • r.1,r.2⟩ : Space (equivariantFamily (G := G) a)) = Sum.inr q at hg + have hi : (g • r.1) = q.1 := congrArg Sigma.fst (Sum.inr_injective hg) + have htuple : (⟨g • r.1,r.2⟩ : Σ _ : FreeIndex G ι, OpenDisk n) = q := Sum.inr_injective hg + have hd' := congrArg (fun p : Σ _ : FreeIndex G ι, OpenDisk n => p.2) htuple + have hd : r.2 = q.2 := hd' + have his' := congrArg (fun p : FreeIndex G ι => p.2) hi + have his : r.1.2 = q.1.2 := his' + change (Sum.inr ⟨q.1.2,q.2⟩ : Space b) = Sum.inr ⟨r.1.2,r.2⟩ + rw [his,hd] + +/-- Free, equivariant cell attachments preserve a genuine regular covering. +The proof constructs collars of disjoint slices; no local-finiteness or +local-compactness hypothesis is imposed. -/ +lemma coverMap_isQuotientCovering : IsQuotientCoveringMap (coverMap a p hp b h) G where + __ := coverMap_isQuotient a p hp b h + __ := equivariantAttachmentContinuousAction a + apply_eq_iff_mem_orbit := coverMap_fibers a p hp b h + disjoint := exists_disjoint_nhds _ (equivariantFamily_smul a) hp.disjoint + +lemma coverMap_isCovering : IsCoveringMap (coverMap a p hp b h) := + (coverMap_isQuotientCovering a p hp b h).isCoveringMap + +end GroupRingTopology.Attachment + +namespace GroupRingTopology.Cayley +open Set Metric Topology Attachment +universe u + +lemma sphere_one_cases (x : Sphere 1) : x.1 0 = -1 ∨ x.1 0 = 1 := by + have hn : ‖x.1‖ = 1 := by simpa only [mem_sphere,dist_zero_right] using x.2 + have hc : x.1 = fun _ => x.1 0 := funext (fun i => congrArg x.1 (Subsingleton.elim i 0)) + rw [hc,pi_norm_const,Real.norm_eq_abs] at hn + exact ((abs_eq (by norm_num : (0:ℝ) ≤ 1)).mp hn).symm + +instance : Finite (Sphere 1) := by + have he : {r : ℝ | r = -1 ∨ r = 1} = {-1,1} := by ext r; simp + have hS : Set.Finite {r : ℝ | r = -1 ∨ r = 1} := he.symm ▸ ((Set.finite_singleton (1 : ℝ)).insert (-1)) + let : Finite {r : ℝ // r = -1 ∨ r = 1} := hS.to_subtype + apply Finite.of_injective (fun x : Sphere 1 => (⟨x.1 0,sphere_one_cases x⟩ : + {r : ℝ // r = -1 ∨ r = 1})) + intro x y h + apply Subtype.ext + funext i + have hi : i = 0 := Subsingleton.elim _ _ + simpa only [hi] using congrArg Subtype.val h + +instance : DiscreteTopology (Sphere 1) := inferInstance + +def minus : Sphere 1 := ⟨fun _ => -1,by norm_num [mem_sphere,dist_pi_def]⟩ +def plus : Sphere 1 := ⟨fun _ => 1,by norm_num [mem_sphere,dist_pi_def]⟩ + +variable {G : Type u} [Group G] [TopologicalSpace G] [DiscreteTopology G] +variable {S : Type u} (s : S → G) + +def attaching (i : S) : C(Sphere 1,G) := + ⟨fun x => if x.1 0 = -1 then 1 else s i,continuous_of_discreteTopology⟩ + +abbrev Graph := Space (equivariantFamily (G := G) (attaching s)) + +instance : Nonempty (Graph s) := ⟨base _ 1⟩ + +def vertex (g : G) : Graph s := base _ g + +omit [Group G] in +lemma discrete_dimension (m : ℕ) (i : RelCWComplex.cell (Set.univ : Set G) m) : m < 1 := by + cases m with + | zero => omega + | succ m => exact i.elim + +instance graphCW : CWComplex (Set.univ : Set (Graph s)) := + layerCW _ discrete_dimension + +instance : T2Space (Graph s) := + t2Space _ ((realSeparated_of_tychonoff (Y := G))) + +lemma graph_dimension (m : ℕ) (i : RelCWComplex.cell (Set.univ : Set (Graph s)) m) : m < 2 := + layerCW_dimensions _ discrete_dimension m i + +lemma vertex_injective : Function.Injective (vertex s) := Sum.inl_injective + +lemma cell_minus (g : G) (i : S) : + cell (equivariantFamily (G := G) (attaching s)) (g,i) (boundary 1 minus) = vertex s g := by + erw [cell_boundary] + simp only [equivariantFamily,attaching,ContinuousMap.coe_mk,minus,ite_true,smul_eq_mul,mul_one] + rfl + +lemma cell_plus (g : G) (i : S) : + cell (equivariantFamily (G := G) (attaching s)) (g,i) (boundary 1 plus) = vertex s (g*s i) := by + erw [cell_boundary] + norm_num only [equivariantFamily,attaching,ContinuousMap.coe_mk,plus,ite_false,smul_eq_mul] + rfl + +instance disk_pathConnected (n : ℕ) : PathConnectedSpace (Disk n) := + isPathConnected_iff_pathConnectedSpace.mp ((convex_closedBall (0 : Fin n → ℝ) 1).isPathConnected ⟨0,mem_closedBall_self (by norm_num)⟩) + +lemma cell_joined (g : G) (i : S) : Joined (vertex s g) (vertex s (g*s i)) := by + have h : Joined (boundary 1 minus) (boundary 1 plus) := PathConnectedSpace.joined _ _ + have hh := h.map (cell (equivariantFamily (G := G) (attaching s)) (g,i)).continuous + simpa only [cell_minus,cell_plus] using hh + +lemma vertex_smul (g h : G) : g • vertex s h = vertex s (g*h) := rfl + +lemma vertices_joined (hs : Subgroup.closure (Set.range s) = ⊤) (g : G) : + Joined (vertex s 1) (vertex s g) := by + let K : Subgroup G := + { carrier := {g | Joined (vertex s 1) (vertex s g)} + one_mem' := Joined.refl _ + mul_mem' := by + intro g h hg hh + have hh' := hh.map (continuous_const_smul g : Continuous (fun x : Graph s => g • x)) + rw [vertex_smul,vertex_smul,mul_one] at hh' + exact hg.trans hh' + inv_mem' := by + intro g hg + have hh := hg.symm.map (continuous_const_smul g⁻¹ : Continuous (fun x : Graph s => g⁻¹ • x)) + change Joined (vertex s 1) (vertex s g⁻¹) + simpa only [vertex_smul,mul_one,inv_mul_cancel] using hh } + have hK : Subgroup.closure (Set.range s) ≤ K := (Subgroup.closure_le K).2 (by + rintro _ ⟨i,rfl⟩ + change Joined (vertex s 1) (vertex s (s i)) + simpa only [one_mul] using cell_joined s 1 i) + rw [hs] at hK + exact hK (Subgroup.mem_top g) + +lemma graph_pathConnected (hs : Subgroup.closure (Set.range s) = ⊤) : PathConnectedSpace (Graph s) := by + have hj : ∀ x : Graph s, Joined (vertex s 1) x := by + intro x + cases x with + | inl g => exact vertices_joined s hs g + | inr p => + have h : Joined (boundary 1 minus) (interior 1 p.2) := PathConnectedSpace.joined _ _ + have hh := h.map (cell (equivariantFamily (G := G) (attaching s)) p.1).continuous + rw [cell_interior] at hh + have hp : cell (equivariantFamily (G := G) (attaching s)) p.1 (boundary 1 minus) = vertex s p.1.1 := + cell_minus s p.1.1 p.1.2 + rw [hp] at hh + exact (vertices_joined s hs p.1.1).trans hh + exact ⟨inferInstance,fun x y => (hj x).symm.trans (hj y)⟩ + +end GroupRingTopology.Cayley + +namespace GroupRingTopology.PathSquares +open Set +open scoped unitInterval +variable {X : Type*} [TopologicalSpace X] {x a b : X} + +lemma turn (p : Path x a) (q : Path x b) (e : Path a b) + (h : (p.trans e).Homotopic q) : e.Homotopic (p.symm.trans q) := by + apply (Path.Homotopic.refl_trans e).symm.trans + apply ((Path.Homotopic.symm_trans p).symm.hcomp (Path.Homotopic.refl e)).trans + exact (Path.Homotopic.trans_assoc p.symm p e).trans ((Path.Homotopic.refl p.symm).hcomp h) + +def spanContract (p : Path x a) (q : Path x b) : + (p.symm.trans q).toContinuousMap.Homotopy (.const _ x) where + toFun z := if (z.2 : ℝ) ≤ 1/2 then p.extend ((1-z.1)*(1-2*z.2)) + else q.extend ((1-z.1)*(2*z.2-1)) + continuous_toFun := continuous_if_le (by fun_prop) continuous_const + (by fun_prop) (by fun_prop) (by intro z hz; simp [hz]) + map_zero_left z := by simp [Path.trans,Path.extend_symm_apply] + map_one_left z := by simp + +lemma spanContract_source (p : Path x a) (q : Path x b) (t : I) : + spanContract p q (t,0) = p.symm t := by + change (if (0 : ℝ) ≤ 1/2 then p.extend ((1-(t:ℝ))*(1-2*0)) else q.extend ((1-(t:ℝ))*(2*0-1))) = _ + norm_num only [show (0:ℝ)≤1/2 by norm_num,ite_true,mul_zero,sub_zero,mul_one] + rw [← Path.extend_symm_apply,Path.extend_extends' ] +lemma spanContract_target (p : Path x a) (q : Path x b) (t : I) : + spanContract p q (t,1) = q.symm t := by + change (if (1 : ℝ) ≤ 1/2 then p.extend ((1-(t:ℝ))*(1-2*1)) else q.extend ((1-(t:ℝ))*(2*1-1))) = _ + norm_num only [mul_one,show (2:ℝ)-1=1 by norm_num,show ¬(1:ℝ)≤1/2 by norm_num,ite_false] + rw [← Path.extend_symm_apply,Path.extend_extends' ] + +def pauseReverse (p : Path x a) : C(I,X) := ((Path.refl a).trans p.symm).toContinuousMap + +/-- Compatible vertex paths fill every edge square, without any path-word +approximation assertion. The pause at the vertex is the same for every edge. -/ +theorem edgeSquare (p : Path x a) (q : Path x b) (e : Path a b) + (h : (p.trans e).Homotopic q) : + ∃ H : e.toContinuousMap.Homotopy (.const _ x), + (∀ t, H (t,0) = pauseReverse p t) ∧ (∀ t, H (t,1) = pauseReverse q t) := by + obtain ⟨A⟩ := turn p q e h + refine ⟨A.toHomotopy.trans (spanContract p q),?_,?_⟩ + · intro t + rw [ContinuousMap.Homotopy.trans_apply] + split_ifs with ht + · change (t:ℝ) ≤ 1/2 at ht + change A (_,0) = ((Path.refl a).trans p.symm) t + rw [Path.trans_apply,dite_eq_left ht] + exact A.source _ + · change ¬(t:ℝ) ≤ 1/2 at ht + change spanContract p q (_,0) = ((Path.refl a).trans p.symm) t + rw [Path.trans_apply,dite_eq_right ht,spanContract_source] + · intro t + rw [ContinuousMap.Homotopy.trans_apply] + split_ifs with ht + · change (t:ℝ) ≤ 1/2 at ht + change A (_,1) = ((Path.refl b).trans q.symm) t + rw [Path.trans_apply,dite_eq_left ht] + exact A.target _ + · change ¬(t:ℝ) ≤ 1/2 at ht + change spanContract p q (_,1) = ((Path.refl b).trans q.symm) t + rw [Path.trans_apply,dite_eq_right ht,spanContract_target] +end GroupRingTopology.PathSquares +namespace GroupRingTopology.Cayley +open Set Metric Topology Attachment +open scoped unitInterval +universe u v + +def edgeParam (t : I) : Disk 1 := ⟨fun _ => 2*(t:ℝ)-1,by + rw [mem_closedBall,dist_zero_right,pi_norm_le_iff_of_nonneg zero_le_one] + intro i + rw [Real.norm_eq_abs,abs_le] + constructor <;> linarith [t.2.1,t.2.2]⟩ +lemma continuous_edgeParam : Continuous edgeParam := by unfold edgeParam; fun_prop + +def edgeTime (d : Disk 1) : I := ⟨(d.1 0+1)/2,by + have hh : |d.1 0| ≤ 1 := by + have := d.2 + rw [mem_closedBall,dist_zero_right,pi_norm_le_iff_of_nonneg zero_le_one] at this + exact this 0 + rw [abs_le] at hh + constructor <;> linarith⟩ +lemma continuous_edgeTime : Continuous edgeTime := by + apply Continuous.subtype_mk + exact (((continuous_apply 0).comp continuous_subtype_val).add continuous_const).div_const 2 +lemma edgeParam_time (d : Disk 1) : edgeParam (edgeTime d) = d := by + apply Subtype.ext + funext i + have hi : i = 0 := Subsingleton.elim _ _ + subst i + dsimp [edgeParam,edgeTime] + ring +lemma edgeTime_param (t : I) : edgeTime (edgeParam t) = t := by + apply Subtype.ext + dsimp [edgeTime,edgeParam] + ring +lemma edgeParam_zero : edgeParam 0 = boundary 1 minus := by + apply Subtype.ext + funext i + norm_num [edgeParam,minus,boundary] +lemma edgeParam_one : edgeParam 1 = boundary 1 plus := by + apply Subtype.ext + funext i + norm_num [edgeParam,plus,boundary] +lemma edgeTime_minus : edgeTime (boundary 1 minus) = 0 := by + rw [←edgeParam_zero,edgeTime_param] +lemma edgeTime_plus : edgeTime (boundary 1 plus) = 1 := by + rw [←edgeParam_one,edgeTime_param] +lemma sphere_one_eq (t : Sphere 1) : t = minus ∨ t = plus := by + obtain h|h := sphere_one_cases t + · left; apply Subtype.ext; funext i; have hi : i=0 := Subsingleton.elim _ _; subst i; exact h + · right; apply Subtype.ext; funext i; have hi : i=0 := Subsingleton.elim _ _; subst i; exact h + +variable {G : Type u} [Group G] [TopologicalSpace G] [DiscreteTopology G] +variable {S : Type u} (s : S → G) + +def edge (g : G) (i : S) : Path (vertex s g) (vertex s (g*s i)) where + toFun t := cell (equivariantFamily (G := G) (attaching s)) (g,i) (edgeParam t) + continuous_toFun := (cell _ _).continuous.comp continuous_edgeParam + source' := by rw [edgeParam_zero,cell_minus] + target' := by rw [edgeParam_one,cell_plus] + +variable {Y : Type v} [TopologicalSpace Y] (f : C(Graph s,Y)) (y : Y) +variable (p : ∀ g, Path y (f (vertex s g))) +variable (hp : ∀ g i, ((p g).trans ((edge s g i).map f.continuous)).Homotopic (p (g*s i))) + +def edgeSquare (g : G) (i : S) : ((edge s g i).map f.continuous).toContinuousMap.Homotopy (.const _ y) := + (PathSquares.edgeSquare (p g) (p (g*s i)) ((edge s g i).map f.continuous) (hp g i)).choose +lemma edgeSquare_source (g : G) (i : S) (t : I) : + edgeSquare s f y p hp g i (t,0) = PathSquares.pauseReverse (p g) t := + (PathSquares.edgeSquare (p g) (p (g*s i)) ((edge s g i).map f.continuous) (hp g i)).choose_spec.1 t +lemma edgeSquare_target (g : G) (i : S) (t : I) : + edgeSquare s f y p hp g i (t,1) = PathSquares.pauseReverse (p (g*s i)) t := + (PathSquares.edgeSquare (p g) (p (g*s i)) ((edge s g i).map f.continuous) (hp g i)).choose_spec.2 t + +def edgePaths (i : FreeIndex G S) : C(Disk 1,C(I,Y)) := + ContinuousMap.curry ⟨fun z => edgeSquare s f y p hp i.1 i.2 (z.2,edgeTime z.1), + (edgeSquare s f y p hp i.1 i.2).continuous.comp + (continuous_snd.prodMk (continuous_edgeTime.comp continuous_fst))⟩ +def vertexPaths : C(G,C(I,Y)) := ⟨fun g => PathSquares.pauseReverse (p g),continuous_of_discreteTopology⟩ +lemma edgePaths_boundary (i : FreeIndex G S) (t : Sphere 1) : + edgePaths s f y p hp i (boundary 1 t) = + vertexPaths s f y p (equivariantFamily (G := G) (attaching s) i t) := by + obtain rfl|rfl := sphere_one_eq t + · apply ContinuousMap.ext; intro z + change edgeSquare s f y p hp i.1 i.2 (z,edgeTime (boundary 1 minus)) = _ + rw [edgeTime_minus,edgeSquare_source] + simp only [vertexPaths,equivariantFamily,attaching,ContinuousMap.coe_mk,minus,ite_true,smul_eq_mul,mul_one] + · apply ContinuousMap.ext; intro z + change edgeSquare s f y p hp i.1 i.2 (z,edgeTime (boundary 1 plus)) = _ + rw [edgeTime_plus,edgeSquare_target] + norm_num [vertexPaths,equivariantFamily,attaching,plus] + +def graphPaths : C(Graph s,C(I,Y)) := + lift _ (vertexPaths s f y p) (edgePaths s f y p hp) (edgePaths_boundary s f y p hp) + +lemma graphPaths_zero (z : Graph s) : graphPaths s f y p hp z 0 = f z := by + cases z with + | inl g => + change PathSquares.pauseReverse (p g) 0 = _ + exact Path.source _ + | inr z => + change edgeSquare s f y p hp z.1.1 z.1.2 (0,edgeTime (interior 1 z.2)) = _ + rw [ContinuousMap.Homotopy.apply_zero] + change f (cell _ z.1 (edgeParam (edgeTime (interior 1 z.2)))) = f _ + rw [edgeParam_time,cell_interior] +lemma graphPaths_one (z : Graph s) : graphPaths s f y p hp z 1 = y := by + cases z with + | inl g => + change PathSquares.pauseReverse (p g) 1 = y + exact Path.target _ + | inr z => + change edgeSquare s f y p hp z.1.1 z.1.2 (1,edgeTime (interior 1 z.2)) = y + exact ContinuousMap.Homotopy.apply_one _ _ + +/-- A coherent system of vertex paths contracts the entire graph map. -/ +def graphNullhomotopy : f.Homotopy (.const _ y) where + toFun z := graphPaths s f y p hp z.2 z.1 + continuous_toFun := (graphPaths s f y p hp).uncurry.continuous.comp continuous_swap + map_zero_left := graphPaths_zero s f y p hp + map_one_left := graphPaths_one s f y p hp +end GroupRingTopology.Cayley +open Set Metric Topology + +end + +end OAI diff --git a/lean/OAI/Algebra/GroupRing/CayleyFurther.lean b/lean/OAI/Algebra/GroupRing/CayleyFurther.lean new file mode 100644 index 0000000000000000000000000000000000000000..7edc456dfce98fbf23a43758a1a67b137584cc11 --- /dev/null +++ b/lean/OAI/Algebra/GroupRing/CayleyFurther.lean @@ -0,0 +1,437 @@ +import Mathlib +import OAI.Algebra.GroupRing.LoopSphere + +namespace OAI + +noncomputable section + +open Set Metric Topology BigOperators +open Set Metric Topology + +namespace GroupRingTopology.Cayley + +section +open Set Metric Topology Attachment PathExtension +open scoped unitInterval +universe u v +variable {G : Type u} [Group G] [TopologicalSpace G] [DiscreteTopology G] +variable {S : Type u} (s : S → G) +variable {Y : Type v} [TopologicalSpace Y] [MulAction G Y] [ContinuousConstSMul G Y] +variable (f : C(Graph s,Y)) (hf : ∀ (g : G) x, f (g • x) = g • f x) +include hf in +omit [ContinuousConstSMul G Y] in +lemma vertex_action (g : G) : f (vertex s g) = g • f (vertex s 1) := by + rw [← hf,smul_vertex,_root_.mul_one] + +lemma pathGenerator_equal (i : S) : Q.Equal (pathGenerator s i).2 (Path.Homotopic.Quotient.mk (edge s 1 i)) := by + refine ⟨rfl,?_,?_⟩ + · rw [smul_vertex]; simp only [_root_.one_mul,_root_.mul_one]; rfl + · exact Path.Homotopic.hpath_hext (fun _ => rfl) + +include hf in +lemma edge_smul_equal (g : G) (i : S) : + Q.Equal (((Path.Homotopic.Quotient.mk (edge s 1 i)).map f).map (smulMap g)) + (Path.Homotopic.Quotient.mk ((edge s g i).map f.continuous)) := by + refine ⟨(vertex_action s f hf g).symm,?_,?_⟩ + · change g • f (vertex s (1*s i)) = f (vertex s (g*s i)) + rw [←hf,smul_vertex,_root_.one_mul] + · apply Path.Homotopic.hpath_hext + intro t + change g • f (cell _ ((1:G),i) (edgeParam t)) = f (cell _ (g,i) (edgeParam t)) + erw [←hf,smul_cell _ (equivariantFamily_smul (attaching s))] + change f (cell _ (g*1,i) (edgeParam t)) = _ + rw [_root_.mul_one] + +variable (τ : G →* PathExtension.Extension G (f (vertex s 1))) +variable (hτ : ∀ g, (τ g).1 = g) +def coherentClass (g : G) : Path.Homotopic.Quotient (f (vertex s 1)) (f (vertex s g)) := + (τ g).2.cast rfl (by rw [hτ]; exact vertex_action s f hf g) +def coherentPath (g : G) : Path (f (vertex s 1)) (f (vertex s g)) := + (Path.Homotopic.Quotient.mk_surjective (coherentClass s f hf τ hτ g)).choose +lemma coherentPath_equal (g : G) : Q.Equal (Path.Homotopic.Quotient.mk (coherentPath s f hf τ hτ g)) (τ g).2 := + (Q.Equal.ofEq (Path.Homotopic.Quotient.mk_surjective (coherentClass s f hf τ hτ g)).choose_spec).trans + (Q.cast_equal _ _ _) + +variable (hgen : ∀ i, Q.Equal (τ (s i)).2 (Path.Homotopic.Quotient.mk ((edge s 1 i).map f.continuous))) +include hgen in +lemma coherentPath_edge (g : G) (i : S) : + ((coherentPath s f hf τ hτ g).trans ((edge s g i).map f.continuous)).Homotopic + (coherentPath s f hf τ hτ (g*s i)) := by + apply Path.Homotopic.Quotient.exact + change (Path.Homotopic.Quotient.mk (coherentPath s f hf τ hτ g)).trans + (Path.Homotopic.Quotient.mk ((edge s g i).map f.continuous)) = _ + apply eq_of_heq + apply Q.Equal.path + have he : Q.Equal ((τ (s i)).2.map (smulMap (τ g).1)) + (Path.Homotopic.Quotient.mk ((edge s g i).map f.continuous)) := by + apply ((hgen i).map (smulMap (τ g).1)).trans + rw [hτ] + exact edge_smul_equal s f hf g i + apply (Q.Equal.comp (coherentPath_equal s f hf τ hτ g) he.symm).trans + apply (mul_path_equal (τ g) (τ (s i))).symm.trans + have hm : Q.Equal (τ g * τ (s i)).2 (τ (g*s i)).2 := by + rw [←τ.map_mul] + exact .refl _ + exact hm.trans (coherentPath_equal s f hf τ hτ (g*s i)).symm + +def nullhomotopyOfSection : f.Homotopy (.const _ (f (vertex s 1))) := + graphNullhomotopy s f (f (vertex s 1)) (coherentPath s f hf τ hτ) + (coherentPath_edge s f hf τ hτ hgen) +end +open PathExtension Attachment +universe u +variable {G : Type u} [Group G] [TopologicalSpace G] [DiscreteTopology G] +variable {S : Type u} (s : S → G) (rels : Set (FreeGroup S)) +variable (hrel : ∀ r ∈ rels, FreeGroup.lift s r = 1) +variable (hs : Function.Surjective (FreeGroup.lift s)) +variable (hker : (FreeGroup.lift s).ker = Subgroup.normalClosure rels) +lemma presentationSection_generator (i : S) : + Q.Equal (presentationSection s rels hrel hs hker (s i)).2 + (Path.Homotopic.Quotient.mk ((edge s 1 i).map (presentationBase s rels hrel).continuous)) := by + have hh : presentationSection s rels hrel hs hker (s i) = + PathExtension.map (presentationBase s rels hrel) (presentationBase_smul s rels hrel) (vertex s 1) + (pathGenerator s i) := by + simpa only [FreeGroup.lift_apply_of,coverWordLift,MonoidHom.comp_apply,wordLift] + using presentationSection_lift s rels hrel hs hker (FreeGroup.of i) + rw [hh] + exact (PathExtension.mapFun_equal (presentationBase s rels hrel) (presentationBase_smul s rels hrel) (vertex s 1) (pathGenerator s i)).trans + ((pathGenerator_equal s i).map (presentationBase s rels hrel)) + +def presentationGraphNullhomotopy : + (presentationBase s rels hrel).Homotopy + (.const _ (presentationBase s rels hrel (vertex s 1))) := + nullhomotopyOfSection s (presentationBase s rels hrel) (presentationBase_smul s rels hrel) + (presentationSection s rels hrel hs hker) (presentationSection_fst s rels hrel hs hker) + (presentationSection_generator s rels hrel hs hker) +end GroupRingTopology.Cayley +namespace GroupRingTopology.Attachment +open Set Metric Topology +universe u v w z +variable {G : Type u} [Group G] +variable {X : Type v} [TopologicalSpace X] [MulAction G X] [ContinuousConstSMul G X] +variable {Y : Type w} [TopologicalSpace Y] [MulAction G Y] [ContinuousConstSMul G Y] +variable {ι : Type z} {n : ℕ} (a : ι → C(Sphere n,X)) + +/-- Fill one disk per orbit and translate the fillings, preserving the action. -/ +lemma exists_equivariant_extension (f : C(X,Y)) + (hf : ∀ (g : G) x, f (g • x) = g • f x) (hY : Cellular.SphereFillable Y) : + ∃ F : C(Space (equivariantFamily (G := G) a),Y), + (∀ x, F (base _ x) = f x) ∧ (∀ (g : G) x, F (g • x) = g • F x) := by + choose e he using fun i => hY n (f.comp (a i)) + let b : FreeIndex G ι → C(Disk n,Y) := fun i => + ⟨fun d => i.1 • e i.2 d,(continuous_const_smul i.1).comp (e i.2).continuous⟩ + have hb (i : FreeIndex G ι) (x : Sphere n) : + b i (boundary n x) = f (equivariantFamily a i x) := by + change i.1 • e i.2 (Cellular.boundary n x) = f (i.1 • a i.2 x) + rw [he,hf] + rfl + refine ⟨lift _ f b hb,fun _ => rfl,?_⟩ + intro g x + cases x with + | inl x => exact hf g x + | inr p => exact (mul_smul g p.1.1 (e p.1.2 (interior n p.2))) + +/-- Finitely many free cell orbits preserve existence of a compact fundamental set. -/ +lemma compactFundamentalSet [Finite ι] (hX : Milnor.CompactFundamentalSet G (X := X)) : + Milnor.CompactFundamentalSet G (X := Space (equivariantFamily (G := G) a)) := by + let b := equivariantFamily (G := G) a + obtain ⟨K,hK,hcov⟩ := hX + let L : Set (Space b) := (base b '' K) ∪ ⋃ i : ι, Set.range (cell b ((1:G),i)) + refine ⟨L,(hK.image (continuous_base b)).union (isCompact_iUnion (fun i => + isCompact_range (cell b ((1:G),i)).continuous)),?_⟩ + intro x + cases x with + | inl x => + obtain ⟨g,y,hy,rfl⟩ := hcov x + exact ⟨g,base b y,Or.inl ⟨y,hy,rfl⟩,rfl⟩ + | inr p => + refine ⟨p.1.1,cell b ((1:G),p.1.2) (interior n p.2),?_,?_⟩ + · exact Or.inr (Set.mem_iUnion.mpr ⟨p.1.2,Set.mem_range_self _⟩) + · erw [smul_cell _ (equivariantFamily_smul a)] + change Sum.inr p = cell b (p.1.1*1,p.1.2) (interior n p.2) + erw [mul_one,cell_interior] + rfl +end GroupRingTopology.Attachment + +namespace GroupRingTopology.Milnor +open Set Metric Topology Attachment +universe u +variable {G : Type u} [Group G] [TopologicalSpace G] [DiscreteTopology G] +variable {A : Type u} (s : A → G) + +omit [DiscreteTopology G] in +lemma group_compactFundamentalSet : CompactFundamentalSet G (X := G) := by + refine ⟨{1},isCompact_singleton,?_⟩ + intro g + exact ⟨g,1,Set.mem_singleton _,by simp only [smul_eq_mul,mul_one]⟩ + +lemma graph_compactFundamentalSet [Finite A] : CompactFundamentalSet G (X := Cayley.Graph s) := + Attachment.compactFundamentalSet (Cayley.attaching s) group_compactFundamentalSet + +variable (rels : Set (FreeGroup A)) (hrel : ∀ r ∈ rels, FreeGroup.lift s r = 1) +lemma presentation_compactFundamentalSet [Finite A] (hrels : rels.Finite) : + CompactFundamentalSet G (X := Cayley.PresentationCover s rels hrel) := by + let := hrels.to_subtype + exact Attachment.compactFundamentalSet (Cayley.relatorAttaching s rels hrel) + (graph_compactFundamentalSet s) + +lemma presentation_equivariant_map : + ∃ f : C(Cayley.PresentationCover s rels hrel,Space G), + ∀ (g : G) x, f (g • x) = g • f x := by + let f₀ : C(G,Space G) := ⟨fun g => g • vertex (0,1),continuous_of_discreteTopology⟩ + have hf₀ (g h : G) : f₀ (g • h) = g • f₀ h := mul_smul g h _ + obtain ⟨f₁,_,hf₁⟩ := Attachment.exists_equivariant_extension (Cayley.attaching s) f₀ hf₀ + (sphereFillable (1:G)) + obtain ⟨f₂,_,hf₂⟩ := Attachment.exists_equivariant_extension (Cayley.relatorAttaching s rels hrel) + f₁ hf₁ (sphereFillable (1:G)) + exact ⟨f₂,hf₂⟩ + +include hrel in +/-- Finite presentability supplies a coherent group section in ONE Milnor stage. +This is genuine low-dimensional control, not a simply-connected-stage assumption. -/ +lemma exists_stage_section [Finite A] (hrels : rels.Finite) + (hs : Function.Surjective (FreeGroup.lift s)) + (hker : (FreeGroup.lift s).ker = Subgroup.normalClosure rels) : + ∃ (S : Shapes G) (x : Stage G S) (τ : G →* PathExtension.Extension G x), ∀ g, (τ g).1 = g := by + obtain ⟨f,hf⟩ := presentation_equivariant_map s rels hrel + obtain ⟨S,hS⟩ := equivariant_controlled G (presentation_compactFundamentalSet s rels hrel hrels) f hf + let F := factorStage G f S hS + have hF : ∀ (g : G) x, F (g • x) = g • F x := factorStage_smul G f S hS hf + let x := Cayley.presentationBase s rels hrel (Cayley.vertex s 1) + let τ := (PathExtension.map F hF x).comp (Cayley.presentationSection s rels hrel hs hker) + refine ⟨S,F x,τ,?_⟩ + intro g + exact Cayley.presentationSection_fst s rels hrel hs hker g +end GroupRingTopology.Milnor + +namespace GroupRingTopology.Attachment +open Set Metric Topology +variable {X : Type*} [TopologicalSpace X] {ι : Type*} {n : ℕ} +variable (a : ι → C(Sphere n,X)) + +def cellCenter (i : ι) : Space a := openCell a i ⟨0,by simp⟩ +def punctured : Set (Space a) := (Set.range (cellCenter a))ᶜ + +def rawCoordinate : Space a → (Fin n → ℝ) + | Sum.inl _ => 0 | Sum.inr p => p.2.1 + +lemma base_mem_punctured (x : X) : base a x ∈ punctured a := by + rintro ⟨i,h⟩ + cases h + +lemma cell_mem_punctured (i : ι) (d : Disk n) : cell a i d ∈ punctured a ↔ d.1 ≠ 0 := by + classical + constructor + · intro hd hzero + apply hd + refine ⟨i,?_⟩ + have heq : d = interior n ⟨0,by simp⟩ := Subtype.ext hzero + rw [heq,cell_interior] + rfl + · intro hzero + rintro ⟨j,hj⟩ + by_cases h : d.1 ∈ ball (0 : Fin n → ℝ) 1 + · have heq : d = interior n ⟨d.1,h⟩ := rfl + rw [heq,cell_interior] at hj + exact hzero (congrArg (rawCoordinate a) hj).symm + · let s : Sphere n := ⟨d.1,by + have hd := d.2 + simp only [mem_sphere,mem_ball,mem_closedBall] at * + exact le_antisymm hd (le_of_not_gt h)⟩ + have heq : d = boundary n s := rfl + rw [heq,cell_boundary] at hj + cases hj + +lemma punctured_open : IsOpen (punctured a) := by + change IsOpen (Set.range (cellCenter a))ᶜ + rw [isOpen_compl_iff] + rw [isClosed_iff] + constructor + · have h : base a ⁻¹' Set.range (cellCenter a) = ∅ := by + ext x + simp only [mem_preimage,mem_empty_iff_false,iff_false] + exact base_mem_punctured a x + rw [h] + exact isClosed_empty + · intro i + have h : cell a i ⁻¹' Set.range (cellCenter a) = {d : Disk n | d.1 = 0} := by + ext d + exact not_iff_not.mp (cell_mem_punctured a i d) + rw [h] + exact isClosed_eq continuous_subtype_val continuous_const + +lemma continuous_punctured {Y : Type*} [TopologicalSpace Y] (F : punctured a → Y) + (hb : Continuous (fun x : X => F ⟨base a x,base_mem_punctured a x⟩)) + (hc : ∀ i, Continuous (fun d : {d : Disk n // d.1 ≠ 0} => + F ⟨cell a i d.1,(cell_mem_punctured a i d.1).mpr d.2⟩)) : Continuous F := by + let q := quotient a + have hq : IsQuotientMap q := ⟨⟨rfl⟩,quotient_surjective a⟩ + have hp := hq.restrictPreimage_isOpen (punctured_open a) + apply hp.continuous_iff.mpr + apply continuous_iff_continuousAt.mpr + rintro ⟨z,hz⟩ + cases z with + | inl x => + let e : X → q ⁻¹' punctured a := fun x => ⟨Sum.inl x,base_mem_punctured a x⟩ + have he : IsOpenEmbedding e := by + have hi : IsOpenEmbedding (Sum.inl : X → X ⊕ (Σ _ : ι, Disk n)) := .inl + exact ⟨hi.isEmbedding.codRestrict (q ⁻¹' punctured a) (fun x => base_mem_punctured a x),by + have hr : Set.range e = Subtype.val ⁻¹' Set.range Sum.inl := by + ext z + simp only [mem_range,mem_preimage,e] + constructor + · rintro ⟨x,rfl⟩; exact ⟨x,rfl⟩ + · rintro ⟨x,hx⟩; exact ⟨x,Subtype.ext hx⟩ + rw [hr] + exact hi.isOpen_range.preimage continuous_subtype_val⟩ + exact (he.continuousAt_iff (g := F ∘ (punctured a).restrictPreimage q)).mp (hb.continuousAt (x := x)) + | inr p => + rcases p with ⟨i,d⟩ + have hd : d.1 ≠ 0 := (cell_mem_punctured a i d).mp hz + let e : {d : Disk n // d.1 ≠ 0} → q ⁻¹' punctured a := + fun d => ⟨Sum.inr ⟨i,d.1⟩,(cell_mem_punctured a i d.1).mpr d.2⟩ + have he : IsOpenEmbedding e := by + have hi : IsOpenEmbedding (fun d : Disk n => (Sum.inr ⟨i,d⟩ : X ⊕ (Σ _ : ι, Disk n))) := + IsOpenEmbedding.inr.comp IsOpenEmbedding.sigmaMk + exact hi.restrict (fun d hd => (cell_mem_punctured a i d).mpr hd) + (isClosed_eq continuous_subtype_val continuous_const).isOpen_compl + have hc' : ContinuousAt ((F ∘ (punctured a).restrictPreimage q) ∘ e) ⟨d,hd⟩ := by + change ContinuousAt (fun d : {d : Disk n // d.1 ≠ 0} => + F ⟨cell a i d.1,(cell_mem_punctured a i d.1).mpr d.2⟩) ⟨d,hd⟩ + exact (hc i).continuousAt + have result := (he.continuousAt_iff (g := F ∘ (punctured a).restrictPreimage q)).mp hc' + exact result + +abbrev PuncturedDisk (n : ℕ) := {d : Disk n // d.1 ≠ 0} + +def puncturedBoundary (x : Sphere n) : PuncturedDisk n := + ⟨boundary n x,by + intro h + change x.1 = 0 at h + have hx := x.2 + simp only [mem_sphere,dist_zero_right] at hx + rw [h,norm_zero] at hx + norm_num at hx⟩ + +def puncturedCell (i : ι) (d : PuncturedDisk n) : punctured a := + ⟨cell a i d.1,(cell_mem_punctured a i d.1).mpr d.2⟩ + +def puncturedBase (x : X) : punctured a := ⟨base a x,base_mem_punctured a x⟩ + +lemma puncturedCell_boundary (i : ι) (x : Sphere n) : + puncturedCell a i (puncturedBoundary x) = puncturedBase a (a i x) := + Subtype.ext (cell_boundary a i x) + +noncomputable def puncturedLift {Y : Type*} [TopologicalSpace Y] (f : C(X,Y)) + (g : ι → C(PuncturedDisk n,Y)) + (h : ∀ i x, g i (puncturedBoundary x) = f (a i x)) : C(punctured a,Y) := by + classical + let F : punctured a → Y := fun z => match heq : z.1 with + | Sum.inl x => f x + | Sum.inr p => g p.1 ⟨interior n p.2,by + exact (cell_mem_punctured a p.1 (interior n p.2)).mp + (by simpa only [cell_interior,← heq] using z.2)⟩ + have hcell (i : ι) : F ∘ puncturedCell a i = g i := by + funext d + by_cases hd : d.1.1 ∈ ball (0 : Fin n → ℝ) 1 + · have heq : d.1 = interior n ⟨d.1.1,hd⟩ := rfl + change F ⟨cell a i d.1,_⟩ = g i d + have hc : cell a i d.1 = Sum.inr ⟨i,⟨d.1.1,hd⟩⟩ := (congrArg (cell a i) heq).trans (cell_interior a i ⟨d.1.1,hd⟩) + simp only [hc,F] + exact congrArg (g i) (Subtype.ext (Subtype.ext rfl)) + · let x : Sphere n := ⟨d.1.1,by + have hm := d.1.2 + simp only [mem_closedBall,mem_ball,mem_sphere] at * + exact le_antisymm hm (le_of_not_gt hd)⟩ + have heq : d.1 = boundary n x := rfl + change F ⟨cell a i d.1,_⟩ = g i d + have hc : cell a i d.1 = base a (a i x) := (congrArg (cell a i) heq).trans (cell_boundary a i x) + simp only [hc,base,F] + exact (h i x).symm.trans (congrArg (g i) (Subtype.ext (Subtype.ext rfl))) + exact ⟨F,continuous_punctured a F f.continuous (fun i => by + change Continuous (F ∘ puncturedCell a i) + rw [hcell] + exact (g i).continuous)⟩ + +@[simp] lemma puncturedLift_base {Y : Type*} [TopologicalSpace Y] (f : C(X,Y)) + (g : ι → C(PuncturedDisk n,Y)) + (h : ∀ i x, g i (puncturedBoundary x) = f (a i x)) (x : X) : + puncturedLift a f g h (puncturedBase a x) = f x := rfl + +@[simp] lemma puncturedLift_cell {Y : Type*} [TopologicalSpace Y] (f : C(X,Y)) + (g : ι → C(PuncturedDisk n,Y)) + (h : ∀ i x, g i (puncturedBoundary x) = f (a i x)) + (i : ι) (d : PuncturedDisk n) : + puncturedLift a f g h (puncturedCell a i d) = g i d := by + classical + by_cases hd : d.1.1 ∈ ball (0 : Fin n → ℝ) 1 + · have heq : d.1 = interior n ⟨d.1.1,hd⟩ := rfl + change puncturedLift a f g h ⟨cell a i d.1,_⟩ = _ + have hc : cell a i d.1 = Sum.inr ⟨i,⟨d.1.1,hd⟩⟩ := (congrArg (cell a i) heq).trans (cell_interior a i ⟨d.1.1,hd⟩) + simp only [hc,puncturedLift,ContinuousMap.coe_mk] + exact congrArg (g i) (Subtype.ext (Subtype.ext rfl)) + · let x : Sphere n := ⟨d.1.1,by + have hm := d.1.2 + simp only [mem_closedBall,mem_ball,mem_sphere] at * + exact le_antisymm hm (le_of_not_gt hd)⟩ + have hd : d = puncturedBoundary x := rfl + rw [hd,puncturedCell_boundary,puncturedLift_base,h] + +lemma punctured_surjective (z : punctured a) : + (∃ x, z = puncturedBase a x) ∨ ∃ i d, z = puncturedCell a i d := by + cases heq : z.1 with + | inl x => exact Or.inl ⟨x,Subtype.ext heq⟩ + | inr p => + have hd : p.2.1 ≠ 0 := (cell_mem_punctured a p.1 (interior n p.2)).mp + (by simpa only [cell_interior,← heq] using z.2) + exact Or.inr ⟨p.1,⟨interior n p.2,hd⟩,Subtype.ext (heq.trans (cell_interior a p.1 p.2).symm)⟩ + +/-- Radial projection of a nonzero disk point onto its sphere. -/ +def radialSphere : C(PuncturedDisk n,Sphere n) := by + have hm (d : PuncturedDisk n) : ‖d.1.1‖⁻¹ • d.1.1 ∈ sphere (0 : Fin n → ℝ) 1 := by + simp only [mem_sphere,dist_zero_right,norm_smul,Real.norm_eq_abs,abs_inv, + abs_norm,inv_mul_cancel₀ (norm_ne_zero_iff.mpr d.2)] + refine ⟨fun d => ⟨‖d.1.1‖⁻¹ • d.1.1,hm d⟩,?_⟩ + exact (((continuous_subtype_val.comp continuous_subtype_val).norm.inv₀ + (fun d : PuncturedDisk n => norm_ne_zero_iff.mpr d.2)).smul + (continuous_subtype_val.comp continuous_subtype_val)).subtype_mk hm + +@[simp] lemma radialSphere_boundary (x : Sphere n) : radialSphere (puncturedBoundary x) = x := by + apply Subtype.ext + have hx : ‖x.1‖ = 1 := by simpa only [mem_sphere,dist_zero_right] using x.2 + change ‖x.1‖⁻¹ • x.1 = x.1 + rw [hx,inv_one,one_smul] + +/-- Radial straight-line deformation, in the full disk. -/ +def radialDisk : C(unitInterval × PuncturedDisk n,Disk n) := by + let f (p : unitInterval × PuncturedDisk n) := + (1-(p.1:ℝ)) • p.2.1.1 + (p.1:ℝ) • (radialSphere p.2).1 + have hm (p : unitInterval × PuncturedDisk n) : f p ∈ closedBall (0 : Fin n → ℝ) 1 := + (convex_closedBall (0 : Fin n → ℝ) 1) p.2.1.2 + (sphere_subset_closedBall (radialSphere p.2).2) + (sub_nonneg.mpr p.1.2.2) p.1.2.1 (by ring) + have hc : Continuous f := + ((continuous_const.sub (continuous_subtype_val.comp continuous_fst)).smul + (continuous_subtype_val.comp (continuous_subtype_val.comp continuous_snd))).add + ((continuous_subtype_val.comp continuous_fst).smul + (continuous_subtype_val.comp (radialSphere.continuous.comp continuous_snd))) + exact ⟨fun p => ⟨f p,hm p⟩,hc.subtype_mk hm⟩ + +@[simp] lemma radialDisk_zero (d : PuncturedDisk n) : radialDisk (0,d) = d.1 := by + apply Subtype.ext + simp [radialDisk] +@[simp] lemma radialDisk_one (d : PuncturedDisk n) : radialDisk (1,d) = boundary n (radialSphere d) := by + apply Subtype.ext + simp [radialDisk,boundary] +@[simp] lemma radialDisk_boundary (t : unitInterval) (x : Sphere n) : + radialDisk (t,puncturedBoundary x) = boundary n x := by + apply Subtype.ext + simp only [radialDisk,ContinuousMap.coe_mk,radialSphere_boundary] + change (1-(t:ℝ)) • x.1 + (t:ℝ) • x.1 = x.1 + rw [← add_smul,sub_add_cancel,one_smul] + +end GroupRingTopology.Attachment + +end + +end OAI diff --git a/lean/OAI/Algebra/GroupRing/CellHEP.lean b/lean/OAI/Algebra/GroupRing/CellHEP.lean new file mode 100644 index 0000000000000000000000000000000000000000..1f180e90a02a3c794e5386d93083c3f899c45764 --- /dev/null +++ b/lean/OAI/Algebra/GroupRing/CellHEP.lean @@ -0,0 +1,153 @@ +import Mathlib +import OAI.Algebra.GroupRing.PartialLift + +namespace OAI + + + +section +namespace TorsionFreeZeroDivisors.CellHEP +open Set Metric Topology GroupRingTopology GroupRingTopology.Cellular +open scoped unitInterval +noncomputable section +variable {n : ℕ} +abbrev Cylinder (n : ℕ) := unitInterval × Disk n +def denom (q : Cylinder n) : ℝ := max (2-q.1.1) (2*‖q.2.1‖) +lemma denom_pos (q : Cylinder n) : 0(denom_pos q).ne') + exact (Continuous.subtype_mk ((continuous_const.sub (hs.mul + (continuous_const.sub (continuous_subtype_val.comp continuous_fst))))) _).prodMk + (Continuous.subtype_mk (hs.smul (continuous_subtype_val.comp continuous_snd)) _) +def Rim (n : ℕ) : Set (Cylinder n) := {q | q.1=0 ∨ q.2.1 ∈ sphere 0 1} +lemma retract_mem (q : Cylinder n) : retract q∈Rim n := by + rcases le_total (2*‖q.2.1‖) (2-q.1.1) with h|h + · left + apply Subtype.ext + change 2-scale q*(2-q.1.1)=0 + have he : denom q=2-q.1.1 := max_eq_left h + rw [scale,←he,div_mul_cancel₀ _ (denom_pos q).ne'] + ring + · right + rw [mem_sphere_zero_iff_norm] + change ‖scale q • q.2.1‖=1 + rw [norm_smul,Real.norm_eq_abs,abs_of_nonneg (scale_nonneg q)] + have he : denom q=2*‖q.2.1‖ := max_eq_right h + rw [scale,div_mul_eq_mul_div] + change (2*‖q.2.1‖)/denom q=1 + rw [←he,div_self (denom_pos q).ne'] +lemma retract_eq (q : Cylinder n) (h : q∈Rim n) : retract q=q := by + have hm : denom q=2 := by + apply le_antisymm (denom_le_two q) + rcases h with h|h + · have ht : q.1.1=0 := congrArg Subtype.val h + simp [denom,ht] + · have hn : ‖q.2.1‖=1 := mem_sphere_zero_iff_norm.mp h + simp [denom,hn] + have hs : scale q=1 := by simp [scale,hm] + apply Prod.ext + · apply Subtype.ext + change 2-scale q*(2-q.1.1)=q.1.1 + rw [hs];ring + · apply Subtype.ext + change scale q • q.2.1=q.2.1 + rw [hs,one_smul] + +def retraction : C(Cylinder n,Rim n) := ⟨fun q=>⟨retract q,retract_mem q⟩, + continuous_retract.subtype_mk _⟩ +variable {Y : Type*} [TopologicalSpace Y] +def face (n : ℕ) : Bool → Set (Rim n) + | false => {z | z.1.1=0} + | true => {z | z.1.2.1∈sphere 0 1} +lemma face_closed (b : Bool) : IsClosed (face n b) := by + cases b + · exact isClosed_eq (continuous_fst.comp continuous_subtype_val) continuous_const + · exact isClosed_sphere.preimage (continuous_subtype_val.comp + (continuous_snd.comp continuous_subtype_val)) +lemma face_cover : ⋃b,face n b=univ := by + apply eq_univ_of_forall + rintro ⟨q,hq⟩ + rcases hq with hq|hq + · exact mem_iUnion.mpr ⟨false,hq⟩ + · exact mem_iUnion.mpr ⟨true,hq⟩ +variable (f : C(Disk n,Y)) (H : C(unitInterval × Sphere n,Y)) + (h : ∀x,H (0,x)=f (boundary n x)) +def faceMap : ∀ b : Bool,C(face n b,Y) + | false => ⟨fun z=>f z.1.1.2, + f.continuous.comp (continuous_snd.comp (continuous_subtype_val.comp continuous_subtype_val))⟩ + | true => ⟨fun z=>H (z.1.1.1,⟨z.1.1.2.1,z.2⟩),H.continuous.comp + ((continuous_fst.comp (continuous_subtype_val.comp continuous_subtype_val)).prodMk + ((continuous_subtype_val.comp (continuous_snd.comp + (continuous_subtype_val.comp continuous_subtype_val))).subtype_mk _))⟩ +include h in +lemma faceMap_compat (b c : Bool) (z : Rim n) (hb : z∈face n b) (hc : z∈face n c) : + faceMap f H b ⟨z,hb⟩=faceMap f H c ⟨z,hc⟩ := by + have cross (hb : z∈face n false) (hc : z∈face n true) : + faceMap f H false ⟨z,hb⟩=faceMap f H true ⟨z,hc⟩ := by + change f z.1.2=H (z.1.1,⟨z.1.2.1,hc⟩) + change z.1.1=0 at hb + rw [hb,h] + rfl + cases b <;> cases c + · rfl + · exact cross hb hc + · exact (cross hc hb).symm + · rfl +def rimMap : C(Rim n,Y) := ⟨Set.liftCover (face n) (fun b=>faceMap f H b) + (faceMap_compat f H h) face_cover, + continuous_liftCover _ _ _ _ face_closed⟩ +lemma rimMap_face (b : Bool) (z : face n b) : + rimMap f H h z.1=faceMap f H b z := by + apply Set.liftCover_coe (S:=face n) (f:=fun b=>faceMap f H b) + (hf:=faceMap_compat f H h) (hS:=face_cover) +/-- Literal homotopy extension for a cell, with no fibrancy premise. -/ +def extension : C(Cylinder n,Y) := (rimMap f H h).comp retraction +lemma extension_zero (x : Disk n) : extension f H h (0,x)=f x := by + have hr : retract (0,x)=(0,x) := retract_eq _ (Or.inl rfl) + change rimMap f H h ⟨retract (0,x),retract_mem (0,x)⟩=f x + simp only [hr] + exact rimMap_face f H h false ⟨⟨(0,x),Or.inl rfl⟩,rfl⟩ +lemma extension_boundary (t : unitInterval) (x : Sphere n) : + extension f H h (t,boundary n x)=H (t,x) := by + have hr : retract (t,boundary n x)=(t,boundary n x) := retract_eq _ (Or.inr x.2) + change rimMap f H h ⟨retract (t,boundary n x),retract_mem (t,boundary n x)⟩=H (t,x) + simp only [hr] + exact rimMap_face f H h true ⟨⟨(t,boundary n x),Or.inr x.2⟩,x.2⟩ + +end +end TorsionFreeZeroDivisors.CellHEP + + +end + + + +end OAI diff --git a/lean/OAI/Algebra/GroupRing/CellModule.lean b/lean/OAI/Algebra/GroupRing/CellModule.lean new file mode 100644 index 0000000000000000000000000000000000000000..bc96492ab388f1d3f6647dc28243a75f1c963c7c --- /dev/null +++ b/lean/OAI/Algebra/GroupRing/CellModule.lean @@ -0,0 +1,84 @@ +import Mathlib + +namespace OAI + + + +section +namespace TorsionFreeZeroDivisors.CellModule +open scoped Classical BigOperators +noncomputable section +variable {G I : Type} [Group G] +abbrev Module (G I : Type) := G×I→₀ℤ +def translate (g : G) : Module G I ≃+ Module G I := + Finsupp.domCongr (Equiv.prodCongr (Equiv.mulLeft g) (Equiv.refl I)) +@[simp] lemma translate_apply (g : G) (x : Module G I) (p : G×I) : + translate g x p=x (g⁻¹*p.1,p.2) := rfl +@[simp] lemma translate_single (g : G) (p : G×I) (z : ℤ) : + translate g (Finsupp.single p z)=Finsupp.single (g*p.1,p.2) z := by + simp only [translate,Finsupp.domCongr_apply,Finsupp.equivMapDomain_single, + Equiv.prodCongr_apply] + rfl +@[simp] lemma translate_one (x : Module G I) : translate 1 x=x := by ext p;simp +lemma translate_mul (g h : G) (x : Module G I) : translate (g*h) x=translate g (translate h x) := by + ext p;simp only [translate_apply,mul_inv_rev,mul_assoc] +def action : G→*MulAut (Multiplicative (Module G I)) where + toFun g := (translate g).toMultiplicative + map_one' := by apply MulEquiv.ext;intro x;exact translate_one x + map_mul' g h := by apply MulEquiv.ext;intro x;exact translate_mul g h x +variable (q : FreeGroup I→*G) +abbrev Crossed := SemidirectProduct (Multiplicative (Module G I)) G (action (I:=I)) +def lift : FreeGroup I→*Crossed (G:=G) (I:=I) := + FreeGroup.lift (fun i=>⟨Multiplicative.ofAdd (Finsupp.single (1,i) 1),q (FreeGroup.of i)⟩) +lemma lift_right (w : FreeGroup I) : (lift q w).right=q w := by + have h : (SemidirectProduct.rightHom.comp (lift q))=q := by + ext i;simp [lift] + exact DFunLike.congr_fun h w +def fox (w : FreeGroup I) : Module G I := Multiplicative.toAdd (lift q w).left +@[simp] lemma fox_one : fox q 1=0 := rfl +@[simp] lemma fox_of (i : I) : fox q (FreeGroup.of i)=Finsupp.single (1,i) 1 := by + simp [fox,lift] +lemma fox_mul (w u : FreeGroup I) : fox q (w*u)=fox q w+translate (q w) (fox q u) := by + simp only [fox,map_mul,SemidirectProduct.mul_left,lift_right] + rfl +lemma fox_inv (w : FreeGroup I) : fox q w⁻¹= -translate (q w)⁻¹ (fox q w) := by + apply (translate (q w)).injective + have h := fox_mul q w w⁻¹ + rw [mul_inv_cancel,fox_one] at h + rw [map_neg,←translate_mul,mul_inv_cancel,translate_one] + exact eq_neg_of_add_eq_zero_right h.symm + +def boundary : Module G I→+Module G PUnit := + Finsupp.liftAddHom (fun p=> + (Finsupp.singleAddHom (p.1*q (FreeGroup.of p.2),PUnit.unit))- + (Finsupp.singleAddHom (p.1,PUnit.unit))) +@[simp] lemma boundary_single (p : G×I) (z : ℤ) : + boundary q (Finsupp.single p z)=Finsupp.single (p.1*q (FreeGroup.of p.2),PUnit.unit) z- + Finsupp.single (p.1,PUnit.unit) z := by + simp only [boundary,Finsupp.liftAddHom_apply_single,AddMonoidHom.sub_apply,Finsupp.singleAddHom_apply] +lemma boundary_translate (g : G) (x : Module G I) : + boundary q (translate g x)=translate g (boundary q x) := by + induction x using Finsupp.induction_linear with + | zero=>simp + | add a b ha hb=>simp only [map_add,ha,hb] + | single p z=>simp only [translate_single,boundary_single,map_sub,mul_assoc] +lemma boundary_fox (w : FreeGroup I) : + boundary q (fox q w)=Finsupp.single (q w,PUnit.unit) 1-Finsupp.single (1,PUnit.unit) 1 := by + induction w using FreeGroup.induction_on with + | one=>simp + | of i=>simp [boundary_single] + | inv_of i _=> + rw [fox_inv,fox_of,map_neg,boundary_translate,boundary_single] + simp only [one_mul] + simp only [map_sub,translate_single,inv_mul_cancel,mul_one,map_inv,neg_sub] + | mul w u hw hu=> + rw [fox_mul,map_add,boundary_translate,hw,hu] + simp only [map_sub,translate_single,mul_one,map_mul] + abel +end +end TorsionFreeZeroDivisors.CellModule + +end + + +end OAI diff --git a/lean/OAI/Algebra/GroupRing/CellNorm.lean b/lean/OAI/Algebra/GroupRing/CellNorm.lean new file mode 100644 index 0000000000000000000000000000000000000000..aa07936a79afacbd83b848b340d731b470afeadb --- /dev/null +++ b/lean/OAI/Algebra/GroupRing/CellNorm.lean @@ -0,0 +1,83 @@ +import Mathlib +import OAI.Algebra.GroupRing.CellModule +import OAI.Algebra.GroupRing.FreeActionNorm + +namespace OAI + + + +section +namespace TorsionFreeZeroDivisors.CellNorm +open scoped Classical BigOperators +open CellModule +noncomputable section +variable {H G I : Type} [CommGroup H] [Group G] [Fintype H] + (φ : H→*G) (hφ : Function.Injective φ) +def norm (x : CellModule.Module G I) : CellModule.Module G I := ∑h:H,translate (φ h) x +lemma norm_add (x y : CellModule.Module G I) : norm φ (x+y)=norm φ x+norm φ y := by + simp only [norm,map_add,Finset.sum_add_distrib] +lemma norm_sub (x y : CellModule.Module G I) : norm φ (x-y)=norm φ x-norm φ y := by + simp only [norm,map_sub,Finset.sum_sub_distrib] +lemma equivariance (J : Type) (f : CellModule.Module G I→+CellModule.Module G J) + (hf : ∀g x,f (translate g x)=translate g (f x)) (x : CellModule.Module G I) : + f (norm φ x)=norm φ (f x) := by + simp only [norm,map_sum,hf] +@[instance_reducible] def moduleAction : MulAction H (G×I) where + smul h p := (φ h*p.1,p.2) + one_smul p := by change (φ 1*p.1,p.2)=p; simp + mul_smul h k p := by change (φ (h*k)*p.1,p.2)=(φ h*(φ k*p.1),p.2); rw [map_mul,mul_assoc] +include hφ in +lemma invariant_norm (g : H) (hg : ∀h,h∈Subgroup.zpowers g) (x : CellModule.Module G I) + (hx : translate (φ g) x=x) : ∃y,norm φ y=x := by + let : MulAction H (G×I) := moduleAction φ + let : IsCancelSMul H (G×I) := { + right_cancel' h k p he := hφ (mul_right_cancel (congrArg Prod.fst he)) } + have hact (h : H) (y : CellModule.Module G I) : FreeActionNorm.act h y=translate (φ h) y := by + ext p + change y (φ h⁻¹*p.1,p.2)=y ((φ h)⁻¹*p.1,p.2) + rw [map_inv] + obtain ⟨y,hy⟩ := FreeActionNorm.invariant_norm g hg x ((hact g x).trans hx) + exact ⟨y,by simpa only [FreeActionNorm.norm,hact,norm] using hy⟩ +include hφ in +lemma kernel_norm (g : H) (hg : ∀h,h∈Subgroup.zpowers g) (x : CellModule.Module G I) + (hx : norm φ x=0) : ∃y,translate (φ g) y-y=x := by + let : MulAction H (G×I) := moduleAction φ + let : IsCancelSMul H (G×I) := { + right_cancel' h k p he := hφ (mul_right_cancel (congrArg Prod.fst he)) } + have hact (h : H) (y : CellModule.Module G I) : FreeActionNorm.act h y=translate (φ h) y := by + ext p + change y (φ h⁻¹*p.1,p.2)=y ((φ h)⁻¹*p.1,p.2) + rw [map_inv] + have hn : FreeActionNorm.norm (H:=H) x=0 := by simpa only [FreeActionNorm.norm,hact,norm] using hx + obtain ⟨y,hy⟩ := FreeActionNorm.kernel_norm g hg x hn + exact ⟨y,by rw [hact] at hy;exact hy⟩ + +def augmentation : CellModule.Module G I→+ℤ := Finsupp.liftAddHom (fun _=>AddMonoidHom.id ℤ) +omit [Group G] in +@[simp] lemma augmentation_single (p : G×I) (z : ℤ) : augmentation (Finsupp.single p z)=z := by simp [augmentation] +lemma augmentation_translate (g : G) (x : CellModule.Module G I) : augmentation (translate g x)=augmentation x := by + induction x using Finsupp.induction_linear with + | zero=>simp + | add a b ha hb=>simp only [map_add,ha,hb] + | single p z=>simp only [translate_single,augmentation_single] +lemma augmentation_norm (x : CellModule.Module G I) : augmentation (norm φ x)=(Fintype.card H:ℤ)*augmentation x := by + simp only [norm,map_sum,augmentation_translate,Finset.sum_const,Finset.card_univ,nsmul_eq_mul] +lemma augmentation_boundary {A : Type} (q : FreeGroup A→*G) (x : CellModule.Module G A) : + augmentation (boundary q x)=0 := by + induction x using Finsupp.induction_linear with + | zero=>simp + | add a b ha hb=>simp only [map_add,ha,hb,add_zero] + | single p z=>simp only [boundary_single,map_sub,augmentation_single,sub_self] +include hφ in +lemma invariant_augmentation (g : H) (hg : ∀h,h∈Subgroup.zpowers g) (x : CellModule.Module G I) + (hx : translate (φ g) x=x) : (Fintype.card H:ℤ)∣augmentation x := by + obtain ⟨y,hy⟩ := invariant_norm φ hφ g hg x hx + exact ⟨augmentation y,by rw [←hy,augmentation_norm]⟩ +end +end TorsionFreeZeroDivisors.CellNorm + +end + + + +end OAI diff --git a/lean/OAI/Algebra/GroupRing/Cellular.lean b/lean/OAI/Algebra/GroupRing/Cellular.lean new file mode 100644 index 0000000000000000000000000000000000000000..c5a005c6962d65f75f2d6338377003afeef66f45 --- /dev/null +++ b/lean/OAI/Algebra/GroupRing/Cellular.lean @@ -0,0 +1,426 @@ +import Mathlib +import OAI.Algebra.GroupRing.Simplicial + +namespace OAI + +noncomputable section + +open Set Metric Topology BigOperators +open Set Metric Topology + +namespace GroupRingTopology.Cellular +universe u +variable {X : Type u} [TopologicalSpace X] [T2Space X] +variable {C : Set X} [CWComplex C] + +omit [T2Space X] in +/-- Closure finiteness in terms of a single finite list of open cells. -/ +lemma closedCell_subset_finite_openCells (n : ℕ) (i : RelCWComplex.cell C n) : + ∃ I : Finset (Σ m, RelCWComplex.cell C m), + CWComplex.closedCell n i ⊆ ⋃ p ∈ I, CWComplex.openCell p.1 p.2 := by + classical + obtain ⟨J,hJ⟩ := CWComplex.cellFrontier_subset_finite_openCell n i + refine ⟨insert ⟨n,i⟩ ((Finset.range n).sigma J),?_⟩ + intro x hx + rw [← CWComplex.cellFrontier_union_openCell_eq_closedCell] at hx + rcases hx with hx | hx + swap + · exact Set.mem_iUnion.mpr ⟨⟨n,i⟩,Set.mem_iUnion.mpr ⟨Finset.mem_insert_self _ _,hx⟩⟩ + · have hxx := hJ hx + simp only [Set.mem_iUnion] at hxx + obtain ⟨m,hm,j,hj,hx⟩ := hxx + exact Set.mem_iUnion.mpr ⟨⟨m,j⟩,Set.mem_iUnion.mpr + ⟨Finset.mem_insert_of_mem (by simp only [Finset.mem_sigma,Finset.mem_range]; exact ⟨hm,hj⟩),hx⟩⟩ + +/-- Any selection of at most one point from each open cell has all its subsets +closed. This is the closure-finite weak-topology argument behind compactness. -/ +lemma cellSelection_closed {I : Type u} (c : I → Σ n, RelCWComplex.cell C n) + (hc : Function.Injective c) (x : I → X) + (hx : ∀ i, x i ∈ CWComplex.openCell (c i).1 (c i).2) (S : Set X) + (hS : S ⊆ Set.range x) : IsClosed S := by + apply (CWComplex.closed C S ?_).mpr + · intro n j + obtain ⟨J,hJ⟩ := closedCell_subset_finite_openCells n j + have hfinite : (S ∩ CWComplex.closedCell n j).Finite := by + have hcpre : (c ⁻¹' (J : Set (Σ n, RelCWComplex.cell C n))).Finite := + J.finite_toSet.preimage hc.injOn + apply (hcpre.image x).subset + rintro y ⟨hyS,hycell⟩ + obtain ⟨i,rfl⟩ := hS hyS + have hxx := hJ hycell + simp only [Set.mem_iUnion] at hxx + obtain ⟨p,hpJ,hxp⟩ := hxx + have heq : c i = p := by + by_contra hne + exact (CWComplex.disjoint_openCell_of_ne hne).notMem_of_mem_left (hx i) hxp + exact ⟨i,by change c i ∈ J; rw [heq]; exact hpJ,rfl⟩ + exact hfinite.isClosed + · rintro y hy + obtain ⟨i,rfl⟩ := hS hy + exact CWComplex.openCell_subset_complex (c i).1 (c i).2 (hx i) + +/-- A compact part of a CW complex can meet only finitely many open cells. -/ +theorem compact_finitely_many_cells {K : Set X} (hK : IsCompact K) : + {p : Σ n, RelCWComplex.cell C n | (K ∩ CWComplex.openCell p.1 p.2).Nonempty}.Finite := by + classical + let I := {p : Σ n, RelCWComplex.cell C n | (K ∩ CWComplex.openCell p.1 p.2).Nonempty} + let x : I → X := fun i => i.2.choose + have hx (i : I) : x i ∈ CWComplex.openCell i.1.1 i.1.2 := i.2.choose_spec.2 + have hxK (i : I) : x i ∈ K := i.2.choose_spec.1 + have hinj : Function.Injective x := by + intro i j hij + apply Subtype.ext + by_contra hne + exact (CWComplex.disjoint_openCell_of_ne hne).notMem_of_mem_left (hx i) (hij ▸ hx j) + have hall : ∀ S ⊆ Set.range x, IsClosed S := + cellSelection_closed (C := C) Subtype.val Subtype.val_injective x hx + have hcompact : IsCompact (Set.range x) := + hK.of_isClosed_subset (hall _ subset_rfl) (Set.range_subset_iff.mpr hxK) + have hdiscrete : IsDiscrete (Set.range x) := by + apply isDiscrete_iff_forall_mem_exists_isClosed.mpr + intro S hS + exact ⟨S,hall S hS,Set.inter_eq_left.mpr hS⟩ + have hrange := hcompact.finite hdiscrete + have : Finite I := (Set.finite_range_iff hinj).mp hrange + exact Set.toFinite I + +/-- Compact maps cannot run out through infinitely many dimensions. -/ +theorem compact_bounded_skeleton {K : Set X} (hK : IsCompact K) (hKC : K ⊆ C) : + ∃ n : ℕ, K ⊆ CWComplex.skeletonLT C n := by + classical + let S := {p : Σ n, RelCWComplex.cell C n | (K ∩ CWComplex.openCell p.1 p.2).Nonempty} + have hS : S.Finite := compact_finitely_many_cells hK + let I := hS.toFinset + refine ⟨I.sup (fun p => p.1+1),?_⟩ + intro x hx + have hxC := hKC hx + rw [← CWComplex.iUnion_openCell_eq_complex (C := C)] at hxC + simp only [Set.mem_iUnion] at hxC + obtain ⟨m,j,hj⟩ := hxC + have hmem : (⟨m,j⟩ : Σ n, RelCWComplex.cell C n) ∈ I := by + exact hS.mem_toFinset.mpr ⟨x,hx,hj⟩ + have hm : m+1 ≤ I.sup (fun p => p.1+1) := Finset.le_sup (f := fun p => p.1+1) hmem + apply CWComplex.skeletonLT_mono (C := C) + (m := (m : ℕ∞)+1) (n := ((I.sup (fun p => p.1+1) : ℕ) : ℕ∞)) (by exact_mod_cast hm) + exact CWComplex.closedCell_subset_skeletonLT m j (CWComplex.openCell_subset_closedCell m j hj) + +/-- The bounded-skeleton property in its map form, used for spheres and disks. -/ +theorem compactMap_bounded_skeleton {A : Type*} [TopologicalSpace A] [CompactSpace A] + (f : C(A,X)) (hf : ∀ a, f a ∈ C) : + ∃ n : ℕ, ∀ a, f a ∈ CWComplex.skeletonLT C n := by + obtain ⟨n,hn⟩ := compact_bounded_skeleton (C := C) (isCompact_range f.continuous) + (Set.range_subset_iff.mpr hf) + exact ⟨n,fun a => hn (Set.mem_range_self a)⟩ + +end GroupRingTopology.Cellular + +namespace GroupRingTopology.Simplicial +open Set Metric Topology BigOperators +open scoped Classical +universe u +variable {V : Type u} (K : PreAbstractSimplicialComplex V) + +lemma compact_bounded_vertices {A : Set (Space K)} (hA : IsCompact A) : + ∃ S : Finset V, ∀ x ∈ A, x.1.support ⊆ S := by + let T := {p : Σ n, Topology.RelCWComplex.cell (Set.univ : Set (Space K)) n | + (A ∩ CWComplex.openCell p.1 p.2).Nonempty} + have hT : T.Finite := Cellular.compact_finitely_many_cells hA + let S := hT.toFinset.biUnion (fun p => p.2.1.1) + refine ⟨S,?_⟩ + intro x hx + let s : Face K := ⟨x.1.support,x.2.2.2⟩ + let c := cellOfFace K s + have hc : (⟨s.1.card-1,c⟩ : Σ n, Topology.RelCWComplex.cell (Set.univ : Set (Space K)) n) ∈ hT.toFinset := by + rw [hT.mem_toFinset] + refine ⟨x,hx,?_⟩ + change x ∈ characteristicPE K c '' ball 0 1 + rw [characteristicPE_open] + rfl + exact Finset.subset_biUnion_of_mem (fun p => p.2.1.1) hc + +end GroupRingTopology.Simplicial + +open Set Metric Topology +namespace GroupRingTopology.SphereTopology +abbrev Disk (n : ℕ) := closedBall (0 : Fin n → ℝ) 1 +abbrev Sphere (n : ℕ) := sphere (0 : Fin n → ℝ) 1 + +def boundary (n : ℕ) : C(Sphere n,Disk n) := + ⟨fun x => ⟨x.1,sphere_subset_closedBall x.2⟩,continuous_subtype_val.subtype_mk _⟩ + +lemma sphere_norm {n : ℕ} (x : Sphere n) : ‖x.1‖ = 1 := by + simpa only [mem_sphere,dist_zero_right] using x.2 +lemma disk_norm {n : ℕ} (x : Disk n) : ‖x.1‖ ≤ 1 := by + simpa only [mem_closedBall,dist_zero_right] using x.2 + +def cone (n : ℕ) : C(unitInterval × Sphere n,Disk n) := by + have hm (p : unitInterval × Sphere n) : (p.1:ℝ) • p.2.1 ∈ closedBall (0 : Fin n → ℝ) 1 := by + simp only [mem_closedBall,dist_zero_right,norm_smul,Real.norm_eq_abs,abs_of_nonneg p.1.2.1,sphere_norm,mul_one] + exact p.1.2.2 + exact ⟨fun p => ⟨(p.1:ℝ) • p.2.1,hm p⟩, + ((continuous_subtype_val.comp continuous_fst).smul + (continuous_subtype_val.comp continuous_snd)).subtype_mk hm⟩ + +lemma cone_norm {n : ℕ} (p : unitInterval × Sphere n) : ‖(cone n p).1‖ = (p.1:ℝ) := by + simp only [cone,ContinuousMap.coe_mk,norm_smul,Real.norm_eq_abs,abs_of_nonneg p.1.2.1,sphere_norm,mul_one] + +lemma cone_surjective (n : ℕ) [Nonempty (Sphere n)] : Function.Surjective (cone n) := by + intro x + by_cases hx : x.1 = 0 + · obtain ⟨s⟩ := ‹Nonempty (Sphere n)› + refine ⟨(0,s),Subtype.ext ?_⟩ + simp only [cone,ContinuousMap.coe_mk,Set.Icc.coe_zero,zero_smul,hx] + · let s : Sphere n := ⟨‖x.1‖⁻¹ • x.1,by + simp only [mem_sphere,dist_zero_right,norm_smul,Real.norm_eq_abs,abs_inv,abs_norm, + inv_mul_cancel₀ (norm_ne_zero_iff.mpr hx)]⟩ + refine ⟨(⟨‖x.1‖,norm_nonneg _,disk_norm x⟩,s),Subtype.ext ?_⟩ + change ‖x.1‖ • (‖x.1‖⁻¹ • x.1) = x.1 + rw [smul_smul,mul_inv_cancel₀ (norm_ne_zero_iff.mpr hx),one_smul] + +lemma cone_quotient (n : ℕ) [Nonempty (Sphere n)] : IsQuotientMap (cone n) := + IsQuotientMap.of_surjective_continuous (cone_surjective n) (cone n).continuous + +variable {Y : Type*} [TopologicalSpace Y] {n : ℕ} + +def Extends (f : C(Sphere n,Y)) : Prop := ∃ F : C(Disk n,Y), F.comp (boundary n) = f + +lemma extends_of_nullhomotopic [Nonempty (Sphere n)] {y : Y} {f : C(Sphere n,Y)} + (H : (ContinuousMap.const (Sphere n) y).Homotopy f) : Extends f := by + have hf : Function.FactorsThrough H.toContinuousMap (cone n) := by + intro p q hpq + have ht : p.1 = q.1 := Subtype.ext ((cone_norm p).symm.trans ((congrArg (fun z : Disk n => ‖z.1‖) hpq).trans (cone_norm q))) + by_cases hzero : (p.1:ℝ) = 0 + · have hp : p.1 = 0 := Subtype.ext hzero + have hq : q.1 = 0 := ht.symm.trans hp + change H (p.1,p.2) = H (q.1,q.2) + rw [hp,hq,H.apply_zero,H.apply_zero] + rfl + · have hs : p.2 = q.2 := by + apply Subtype.ext + have heq := congrArg (fun z : Disk n => z.1) hpq + change (p.1:ℝ) • p.2.1 = (q.1:ℝ) • q.2.1 at heq + rw [← ht] at heq + exact (smul_right_injective _ hzero) heq + exact congrArg H.toContinuousMap (Prod.ext ht hs) + let F : C(Disk n,Y) := (cone_quotient n).lift H.toContinuousMap hf + refine ⟨F,?_⟩ + ext s + have hh := ContinuousMap.congr_fun ((cone_quotient n).lift_comp H.toContinuousMap hf) (1,s) + have hcone : cone n (1,s) = boundary n s := by apply Subtype.ext; simp [cone,boundary] + simpa only [ContinuousMap.comp_apply,hcone,ContinuousMap.Homotopy.coe_toContinuousMap, + ContinuousMap.Homotopy.apply_one] using hh + +lemma nullhomotopic_of_extends {f : C(Sphere n,Y)} (hf : Extends f) : + ∃ y : Y, Nonempty ((ContinuousMap.const (Sphere n) y).Homotopy f) := by + obtain ⟨F,hF⟩ := hf + let z : Disk n := ⟨0,by simp⟩ + refine ⟨F z,⟨{ + toFun := fun p => F (cone n p) + continuous_toFun := F.continuous.comp (cone n).continuous + map_zero_left := ?_ + map_one_left := ?_ }⟩⟩ + · intro s + exact congrArg F (Subtype.ext (by simp [cone,z])) + · intro s + have hs : cone n (1,s) = boundary n s := by apply Subtype.ext; simp [cone,boundary] + rw [hs] + exact ContinuousMap.congr_fun hF s + +lemma extends_of_homotopy [Nonempty (Sphere n)] {f g : C(Sphere n,Y)} + (H : f.Homotopy g) (hg : Extends g) : Extends f := by + obtain ⟨y,⟨J⟩⟩ := nullhomotopic_of_extends hg + exact extends_of_nullhomotopic (J.trans H.symm) + +lemma sphere_nonempty (n : ℕ) : Nonempty (Sphere (n+1)) := + (NormedSpace.sphere_nonempty.mpr (by norm_num : (0:ℝ) ≤ 1)).coe_sort + +end GroupRingTopology.SphereTopology + +/-! Classical cellular lifting and its geometric foundations. +No classifying-space existence or Hurewicz theorem is assumed. -/ +open Set Metric Topology + +namespace GroupRingTopology.Cellular +universe u v w + +abbrev Disk (n : ℕ) := closedBall (0 : Fin n → ℝ) 1 +abbrev Sphere (n : ℕ) := sphere (0 : Fin n → ℝ) 1 + +def boundary (n : ℕ) : Sphere n → Disk n := + fun x => ⟨x.1, sphere_subset_closedBall x.2⟩ + +lemma continuous_boundary (n : ℕ) : Continuous (boundary n) := + continuous_subtype_val.subtype_mk _ + +variable {X : Type u} [TopologicalSpace X] [T2Space X] +variable {C : Set X} [CWComplex C] + +/-- A characteristic map on its closed disk. -/ +def characteristic (n : ℕ) (i : RelCWComplex.cell C n) : C(Disk n, X) := + ⟨fun x => RelCWComplex.map n i x.1, (RelCWComplex.continuousOn n i).domRestrict⟩ + +omit [T2Space X] in +lemma range_characteristic (n : ℕ) (i : RelCWComplex.cell C n) : + Set.range (characteristic n i) = CWComplex.closedCell n i := by + ext x + constructor + · rintro ⟨y,rfl⟩; exact ⟨y.1,y.2,rfl⟩ + · rintro ⟨y,hy,rfl⟩; exact ⟨⟨y,hy⟩,rfl⟩ + +/-- The weak topology is genuinely final with respect to closed characteristic +maps; no finiteness or local-finiteness hypothesis is needed. -/ +lemma continuousOn_iff_characteristic {Y : Type v} [TopologicalSpace Y] (f : X → Y) : + ContinuousOn f C ↔ ∀ n (i : RelCWComplex.cell C n), + Continuous (f ∘ characteristic n i) := by + constructor + · intro hf n i + exact hf.comp_continuous (characteristic n i).continuous + (fun x => CWComplex.closedCell_subset_complex n i ⟨x.1,x.2,rfl⟩) + · intro hf + rw [continuousOn_iff_continuous_domRestrict, continuous_iff_isClosed] + intro S hS + have hclosed : IsClosed (C ∩ f ⁻¹' S) := by + apply (CWComplex.closed C _ inter_subset_left).2 + intro n i + have hpre : IsClosed ((f ∘ characteristic n i) ⁻¹' S) := + hS.preimage (hf n i) + have hcompact := hpre.isCompact.image (characteristic n i).continuous + convert hcompact.isClosed using 1 + ext x + constructor + · rintro ⟨⟨hxC,hxS⟩, y,hy,rfl⟩ + exact ⟨⟨y,hy⟩,hxS,rfl⟩ + · rintro ⟨y,hy,rfl⟩ + exact ⟨⟨CWComplex.closedCell_subset_complex n i ⟨y.1,y.2,rfl⟩,hy⟩, + y.1,y.2,rfl⟩ + convert hclosed.preimage continuous_subtype_val using 1 + ext x + simp only [Set.mem_preimage, Set.mem_inter_iff, and_iff_right x.2, Set.domRestrict_apply] + +abbrev Skeleton (C : Set X) [CWComplex C] (n : ℕ) : Set X := + CWComplex.skeletonLT C n + +lemma skeleton_mono {m n : ℕ} (h : m ≤ n) : + Skeleton C m ⊆ Skeleton C n := + CWComplex.skeletonLT_mono (by exact_mod_cast h) + +lemma sphere_mem_skeleton (n : ℕ) (i : RelCWComplex.cell C n) (x : Sphere n) : + characteristic n i (boundary n x) ∈ Skeleton C n := + CWComplex.cellFrontier_subset_skeletonLT n i ⟨x.1,x.2,rfl⟩ + +lemma characteristic_mem_skeleton {m n : ℕ} (h : m < n) + (i : RelCWComplex.cell C m) (x : Disk m) : + characteristic m i x ∈ Skeleton C n := by + apply skeleton_mono (Nat.succ_le_of_lt h) + exact CWComplex.closedCell_subset_skeletonLT m i ⟨x.1,x.2,rfl⟩ + +lemma openCell_not_skeleton (n : ℕ) (i : RelCWComplex.cell C n) {x : X} + (hx : x ∈ CWComplex.openCell n i) : x ∉ Skeleton C n := + (CWComplex.disjoint_skeletonLT_openCell (C := C) (j := i) le_rfl).notMem_of_mem_right hx + +/-- A continuous partial lift on the (n-1)-skeleton, represented by a total +function only to avoid transported subtype terms. Values outside the skeleton +carry no condition and are never used. -/ +structure PartialLift {E : Type v} {B : Type w} [TopologicalSpace E] [TopologicalSpace B] + (p : C(E,B)) (f : C(X,B)) (n : ℕ) where + val : X → E + continuousOn : ContinuousOn val (Skeleton C n) + fac : ∀ x ∈ Skeleton C n, p (val x) = f x + +/-- The concrete disk-boundary right lifting property. -/ +def DiskRLP {E : Type v} {B : Type w} [TopologicalSpace E] [TopologicalSpace B] + (p : C(E,B)) : Prop := + ∀ n (a : C(Sphere n,E)) (b : C(Disk n,B)), + (∀ x, p (a x) = b (boundary n x)) → + ∃ e : C(Disk n,E), (∀ x, e (boundary n x) = a x) ∧ ∀ x, p (e x) = b x + +variable {E : Type v} [TopologicalSpace E] {n : ℕ} + +/-- Glue the old skeleton map to a prescribed disk map on each new cell. -/ +noncomputable def attachValue (a : X → E) (e : ∀ _ : RelCWComplex.cell C n, C(Disk n,E)) + (x : X) : E := by + classical + exact if x ∈ Skeleton C n then a x + else if h : ∃ i : RelCWComplex.cell C n, x ∈ CWComplex.openCell n i then + let i := h.choose + let y := h.choose_spec.choose + e i ⟨y,ball_subset_closedBall h.choose_spec.choose_spec.1⟩ + else a x + +lemma attachValue_old (a : X → E) (e : ∀ _ : RelCWComplex.cell C n, C(Disk n,E)) + {x : X} (hx : x ∈ Skeleton C n) : attachValue a e x = a x := by + classical + simp only [attachValue, ite_eq_left hx] + +lemma attachValue_interior (a : X → E) (e : ∀ _ : RelCWComplex.cell C n, C(Disk n,E)) + (i : RelCWComplex.cell C n) (y : Disk n) (hy : y.1 ∈ ball 0 1) : + attachValue a e (characteristic n i y) = e i y := by + classical + have hx : characteristic n i y ∈ CWComplex.openCell n i := ⟨y.1,hy,rfl⟩ + have h : ∃ j : RelCWComplex.cell C n, + characteristic n i y ∈ CWComplex.openCell n j := ⟨i,hx⟩ + rw [attachValue,ite_eq_right (openCell_not_skeleton n i hx),dite_eq_left h] + have hi : h.choose = i := by + by_contra hne + have hd := CWComplex.disjoint_openCell_of_ne (C := C) (i := h.choose) (j := i) + (fun hEq => hne (sigma_mk_injective hEq)) + exact Set.disjoint_left.mp hd h.choose_spec hx + have hz := h.choose_spec.choose_spec.1 + have hmap : RelCWComplex.map n i h.choose_spec.choose = characteristic n i y := by + calc + RelCWComplex.map n i h.choose_spec.choose = + RelCWComplex.map n h.choose h.choose_spec.choose := + congrArg (fun k => RelCWComplex.map n k h.choose_spec.choose) hi.symm + _ = _ := h.choose_spec.choose_spec.2 + have hcoord : h.choose_spec.choose = y.1 := + (RelCWComplex.map n i).injOn + (by simpa only [RelCWComplex.source_eq] using hz) + (by simpa only [RelCWComplex.source_eq] using hy) hmap + exact (congrArg (fun k => e k ⟨h.choose_spec.choose,ball_subset_closedBall hz⟩) hi).trans + (congrArg (e i) (Subtype.ext hcoord)) + +lemma attachValue_characteristic (a : X → E) + (e : ∀ _ : RelCWComplex.cell C n, C(Disk n,E)) + (he : ∀ i (x : Sphere n), e i (boundary n x) = + a (characteristic n i (boundary n x))) + (i : RelCWComplex.cell C n) (y : Disk n) : + attachValue a e (characteristic n i y) = e i y := by + by_cases hy : y.1 ∈ ball 0 1 + · exact attachValue_interior a e i y hy + · have hs : y.1 ∈ sphere 0 1 := le_antisymm y.2 (le_of_not_gt hy) + have hx : characteristic n i y ∈ Skeleton C n := sphere_mem_skeleton n i ⟨y,hs⟩ + rw [attachValue_old a e hx] + exact (he i ⟨y,hs⟩).symm + +lemma attachValue_continuous (a : X → E) (ha : ContinuousOn a (Skeleton C n)) + (e : ∀ _ : RelCWComplex.cell C n, C(Disk n,E)) + (he : ∀ i (x : Sphere n), e i (boundary n x) = + a (characteristic n i (boundary n x))) : + ContinuousOn (attachValue a e) (Skeleton C (n+1)) := by + apply (continuousOn_iff_characteristic (C := Skeleton C (n+1)) _).2 + intro m j + change Continuous (fun x : Disk m => attachValue a e (characteristic m j.1 x)) + have hm : m < n+1 := by + have h : (m : ℕ∞) < ((n+1 : ℕ) : ℕ∞) := by + simpa only [RelCWComplex.skeletonLT_I,Set.mem_ofPred_eq] using j.2 + exact_mod_cast h + rcases Nat.lt_succ_iff_lt_or_eq.mp hm with hm | hm + · have hEq : (fun x : Disk m => attachValue a e (characteristic m j.1 x)) = + (fun x : Disk m => a (characteristic m j.1 x)) := by + funext x + exact attachValue_old a e (characteristic_mem_skeleton hm j.1 x) + rw [hEq] + exact ha.comp_continuous (characteristic m j.1).continuous + (characteristic_mem_skeleton hm j.1) + · subst m + have hEq : (fun x : Disk n => attachValue a e (characteristic n j.1 x)) = e j.1 := by + funext x + exact attachValue_characteristic a e he j.1 x + rw [hEq] + exact (e j.1).continuous + +end GroupRingTopology.Cellular + +end + +end OAI diff --git a/lean/OAI/Algebra/GroupRing/CellularFurther.lean b/lean/OAI/Algebra/GroupRing/CellularFurther.lean new file mode 100644 index 0000000000000000000000000000000000000000..9d38724f15a292375d591d8d78397ff29e10519c --- /dev/null +++ b/lean/OAI/Algebra/GroupRing/CellularFurther.lean @@ -0,0 +1,384 @@ +import Mathlib +import OAI.Algebra.GroupRing.GeneralPosition + +namespace OAI + +noncomputable section + +open Set Metric Topology BigOperators +open Set Metric Topology +open Set Topology +open Set Metric Topology +open scoped NNReal + +namespace GroupRingTopology.Cellular + +section +open Set Metric Topology +open scoped ENNReal NNReal +variable {Y : Type*} [TopologicalSpace Y] [T2Space Y] {n : ℕ} + +abbrev ChartDisk (n : ℕ) := Metric.ball (0 : Fin n → ℝ) 1 +abbrev ChartCore (n : ℕ) := Metric.closedBall (0 : Fin n → ℝ) (1/2) + +def chartCoreInclusion (n : ℕ) : C(ChartCore n,ChartDisk n) := + ⟨fun x => ⟨x.1, (mem_closedBall.mp x.2).trans_lt (by norm_num)⟩, + continuous_subtype_val.subtype_mk _⟩ + +def chartCore (e : C(ChartDisk n,Y)) : C(ChartCore n,Y) := e.comp (chartCoreInclusion n) + +lemma chartCore_closedEmbedding (e : C(ChartDisk n,Y)) (he : IsOpenEmbedding e) : + IsClosedEmbedding (chartCore e) := by + apply (chartCore e).continuous.isClosedEmbedding + intro x y h + apply Subtype.ext + exact congrArg (fun z : ChartDisk n => z.1) (he.injective h) + +variable {K : Type*} [MetricSpace K] + +def chartDomain (e : C(ChartDisk n,Y)) (f : C(K,Y)) : Set K := f ⁻¹' Set.range (chartCore e) + +lemma chartDomain_closed (e : C(ChartDisk n,Y)) (he : IsOpenEmbedding e) (f : C(K,Y)) : + IsClosed (chartDomain e f) := (chartCore_closedEmbedding e he).isClosed_range.preimage f.continuous + +def coreCoordinate (e : C(ChartDisk n,Y)) (he : IsOpenEmbedding e) (f : C(K,Y)) : + C(chartDomain e f,ChartCore n) := + ⟨fun x => (chartCore_closedEmbedding e he).toIsEmbedding.toHomeomorph.symm ⟨f x,x.2⟩, + (chartCore_closedEmbedding e he).toIsEmbedding.toHomeomorph.symm.continuous.comp + ((f.continuous.comp continuous_subtype_val).subtype_mk _)⟩ + +lemma coreCoordinate_fac (e : C(ChartDisk n,Y)) (he : IsOpenEmbedding e) (f : C(K,Y)) + (x : chartDomain e f) : chartCore e (coreCoordinate e he f x) = f x := + congrArg Subtype.val ((chartCore_closedEmbedding e he).toIsEmbedding.toHomeomorph.apply_symm_apply _) + +lemma coreCoordinate_frontier (e : C(ChartDisk n,Y)) (he : IsOpenEmbedding e) (f : C(K,Y)) + (x : chartDomain e f) (hx : (x:K) ∈ frontier (chartDomain e f)) : + ‖(coreCoordinate e he f x : Fin n → ℝ)‖ = 1/2 := by + apply le_antisymm + · simpa only [mem_closedBall,dist_zero_right] using (coreCoordinate e he f x).2 + · by_contra! h + let U : Set (ChartDisk n) := {z | ‖(z : Fin n → ℝ)‖ < 1/2} + have hU : IsOpen U := isOpen_lt (continuous_subtype_val.norm) continuous_const + have hsub : f ⁻¹' (e '' U) ⊆ chartDomain e f := by + intro y hy + obtain ⟨z,hz,hzy⟩ := hy + exact ⟨⟨z.1,by simpa only [mem_closedBall,dist_zero_right] using le_of_lt hz⟩,hzy⟩ + have hxU : (x:K) ∈ f ⁻¹' (e '' U) := by + refine ⟨chartCoreInclusion n (coreCoordinate e he f x),h,?_⟩ + exact coreCoordinate_fac e he f x + exact hx.2 (mem_interior.mpr ⟨f ⁻¹' (e '' U),hsub, + (he.isOpenMap U hU).preimage f.continuous,hxU⟩) + +omit [T2Space Y] in +lemma chartDomain_dimH_le (e : C(ChartDisk n,Y)) (f : C(K,Y)) : + dimH (Set.univ : Set (chartDomain e f)) ≤ dimH (Set.univ : Set K) := by + rw [← isometry_subtype_coe.dimH_image] + exact dimH_mono (Set.subset_univ _) + +end + +section +open Set Metric Topology +open scoped ENNReal NNReal +variable {Y : Type*} [TopologicalSpace Y] {n : ℕ} +variable {K : Type*} [MetricSpace K] + +def chartCenter (e : C(ChartDisk n,Y)) : Y := e ⟨0,by simp⟩ + +/-- A map of smaller dimension can be homotoped off one cell centre, +without changing it outside the cell. This works for merely continuous maps, +not just piecewise linear maps. -/ +lemma exists_chart_avoidance [T2Space Y] [CompactSpace K] (e : C(ChartDisk n,Y)) (he : IsOpenEmbedding e) (f : C(K,Y)) + (hdim : dimH (Set.univ : Set K) < n) : + ∃ (g : C(K,Y)) (H : f.Homotopy g), + (∀ x, g x ≠ chartCenter e) ∧ + (∀ (t : unitInterval) (x : K), f x ∉ Set.range e → H (t,x) = f x) ∧ + (∀ (t : unitInterval) (x : K), H (t,x) = f x ∨ H (t,x) ∈ Set.range e) := by + let A := chartDomain e f + have hA : IsClosed A := chartDomain_closed e he f + let : CompactSpace A := isCompact_iff_compactSpace.mp hA.isCompact + let u : C(A,Fin n → ℝ) := ⟨fun x => (coreCoordinate e he f x).1, + continuous_subtype_val.comp (coreCoordinate e he f).continuous⟩ + obtain ⟨v,hv0,hvfix,hvdist⟩ := GeneralPosition.exists_relative_nonzero_approximation u + ((chartDomain_dimH_le e f).trans_lt hdim) (δ := 1/8) (by norm_num) + have hi (t : unitInterval) (x : A) : ‖u x+(t:ℝ) • (v x-u x)‖ ≤ 1/2 := by + have hu : ‖u x‖ ≤ 4*(1/8:ℝ) := by + simpa only [u,ContinuousMap.coe_mk,show (4:ℝ)*(1/8)=1/2 by norm_num,mem_closedBall,dist_zero_right] + using (coreCoordinate e he f x).2 + simpa only [show (4:ℝ)*(1/8)=1/2 by norm_num] using + GeneralPosition.relative_interpolation_bound (by norm_num : (0:ℝ)<1/8) + hvfix hvdist x hu t + have hvc (x : A) : v x ∈ ChartCore n := by + have h := hi 1 x + simpa only [Set.Icc.coe_one,one_smul,add_sub_cancel,mem_closedBall,dist_zero_right] using h + let vcore : C(A,ChartCore n) := ⟨fun x => ⟨v x,hvc x⟩, + v.continuous.subtype_mk hvc⟩ + let gA : C(A,Y) := (chartCore e).comp vcore + let HA : (f.restrict A).Homotopy gA := + { toFun := fun tx => chartCore e ⟨u tx.2+(tx.1:ℝ) • (v tx.2-u tx.2),by + simpa only [mem_closedBall,dist_zero_right] using hi tx.1 tx.2⟩ + continuous_toFun := (chartCore e).continuous.comp + (((u.continuous.comp continuous_snd).add + ((continuous_subtype_val.comp continuous_fst).smul + ((v.continuous.comp continuous_snd).sub (u.continuous.comp continuous_snd)))).subtype_mk + (fun tx => by + simpa only [ChartCore,mem_closedBall,dist_zero_right,Pi.add_apply, + Pi.smul_apply',Pi.sub_apply,Function.comp_apply] using hi tx.1 tx.2)) + map_zero_left := fun x => by + simp only [Set.Icc.coe_zero,zero_smul,add_zero] + exact coreCoordinate_fac e he f x + map_one_left := fun x => by + simp only [Set.Icc.coe_one,one_smul,add_sub_cancel] + rfl } + have hboundary (t : unitInterval) (x : A) (hx : (x:K) ∈ frontier A) : + HA (t,x) = f x := by + have hfix : v x = u x := hvfix x (by + change 2*(1/8:ℝ) ≤ ‖(coreCoordinate e he f x).1‖ + rw [coreCoordinate_frontier e he f x hx] + norm_num) + change chartCore e ⟨u x+(t:ℝ) • (v x-u x),_⟩ = f x + simp only [hfix,sub_self,smul_zero,add_zero] + exact coreCoordinate_fac e he f x + let hg : ∀ x : A, (x:K) ∈ frontier A → gA x = f x := + fun x hx => by simpa using hboundary 1 x hx + let g := patch hA f gA hg + let H : f.Homotopy g := patchHomotopy hA f gA HA hboundary + have hOn (t : unitInterval) (x : A) : H (t,(x:K)) = HA (t,x) := by + change patchFun (Prod.snd ⁻¹' A) _ _ (t,(x:K)) = _ + rw [patchFun,dite_eq_left (show (t,(x:K)) ∈ Prod.snd ⁻¹' A from x.2)] + rfl + have hOff (t : unitInterval) (x : K) (hx : x ∉ A) : H (t,x) = f x := by + change patchFun (Prod.snd ⁻¹' A) _ _ (t,x) = _ + rw [patchFun,dite_eq_right (show (t,x) ∉ Prod.snd ⁻¹' A from hx)] + rfl + refine ⟨g,H,?_,?_,?_⟩ + · intro x hzero + by_cases hx : x ∈ A + · have hv : chartCore e (vcore ⟨x,hx⟩) = chartCenter e := by + exact (patch_on hA f gA hg ⟨x,hx⟩).symm.trans hzero + have hu := congrArg (fun z : ChartDisk n => z.1) (he.injective hv) + exact hv0 ⟨x,hx⟩ hu + · have hfx : f x = chartCenter e := (patch_off hA f gA hg hx).symm.trans hzero + apply hx + exact ⟨⟨0,by simp⟩,hfx.symm⟩ + · intro t x hx + apply hOff + rintro ⟨z,hz⟩ + exact hx ⟨chartCoreInclusion n z,hz⟩ + · intro t x + by_cases hx : x ∈ A + · right + rw [hOn t ⟨x,hx⟩] + exact ⟨_,rfl⟩ + · exact Or.inl (hOff t x hx) + +end + +open Set Metric Topology +open scoped ENNReal NNReal +section +variable {Y : Type*} [TopologicalSpace Y] {K : Type*} [TopologicalSpace K] + +lemma homotopy_trans_pointwise {f g h : C(K,Y)} (H : f.Homotopy g) (J : g.Homotopy h) + (P : K → Y → Prop) (hH : ∀ t x, P x (H (t,x))) (hJ : ∀ t x, P x (J (t,x))) : + ∀ t x, P x (H.trans J (t,x)) := by + intro t x + erw [ContinuousMap.Homotopy.trans_apply] + split_ifs + · exact hH _ x + · exact hJ _ x + +end +variable {Y : Type*} [TopologicalSpace Y] [T2Space Y] {n : ℕ} +variable {K : Type*} [MetricSpace K] [CompactSpace K] {ι : Type*} +variable (e : ι → C(ChartDisk n,Y)) (he : ∀ i, IsOpenEmbedding (e i)) +variable (hd : Pairwise (fun i j => Disjoint (Set.range (e i)) (Set.range (e j)))) + +omit [T2Space Y] in +lemma chartCenter_mem_range (i : ι) : chartCenter (e i) ∈ Set.range (e i) := ⟨_,rfl⟩ + +include he hd in +lemma exists_finite_chart_avoidance (f : C(K,Y)) (hdim : dimH (Set.univ : Set K) < n) + (S : Finset ι) : + ∃ (g : C(K,Y)) (H : f.Homotopy g), + (∀ i ∈ S, ∀ x, g x ≠ chartCenter (e i)) ∧ + (∀ t x, H (t,x) = f x ∨ ∃ i ∈ S, H (t,x) ∈ Set.range (e i)) ∧ + (∀ t x, (∀ i ∈ S, f x ∉ Set.range (e i)) → H (t,x) = f x) := by + classical + induction S using Finset.induction_on with + | empty => + exact ⟨f,.refl f,by simp,(fun _ _ => Or.inl rfl),fun _ _ _ => rfl⟩ + | @insert a S ha ih => + obtain ⟨g,H,hg,hH,hstat⟩ := ih + obtain ⟨g',J,hg',hJstat,hJ⟩ := exists_chart_avoidance (e a) (he a) g hdim + refine ⟨g',H.trans J,?_,?_,?_⟩ + · intro i hi x + rcases Finset.mem_insert.mp hi with rfl | hi + · exact hg' x + · intro hzero + rcases hJ 1 x with hj | hj + · have hh : g' x = g x := by simpa using hj + exact hg i hi x (hh.symm.trans hzero) + · have hj : g' x ∈ Set.range (e a) := by simpa using hj + rw [hzero] at hj + exact (hd (by intro heq; subst i; exact ha hi)).notMem_of_mem_left hj + (chartCenter_mem_range e i) + · apply homotopy_trans_pointwise H J + (fun x y => y = f x ∨ ∃ i ∈ insert a S, y ∈ Set.range (e i)) + · intro t x + rcases hH t x with h | ⟨i,hi,h⟩ + · exact Or.inl h + · exact Or.inr ⟨i,Finset.mem_insert_of_mem hi,h⟩ + · intro t x + rcases hJ t x with h | h + · rw [h] + have hh : g x = f x ∨ ∃ i ∈ S, g x ∈ Set.range (e i) := by simpa using hH 1 x + rcases hh with h | ⟨i,hi,h⟩ + · exact Or.inl h + · exact Or.inr ⟨i,Finset.mem_insert_of_mem hi,h⟩ + · exact Or.inr ⟨a,Finset.mem_insert_self _ _,h⟩ + · intro t x hx + have hfixed : ∀ t, H (t,x) = f x := fun t => + hstat t x (fun i hi => hx i (Finset.mem_insert_of_mem hi)) + have hgx : g x = f x := by simpa using hfixed 1 + have hjfixed : ∀ t, J (t,x) = f x := fun t => + (hJstat t x (by rw [hgx]; exact hx a (Finset.mem_insert_self _ _))).trans hgx + erw [ContinuousMap.Homotopy.trans_apply] + split_ifs + · exact hfixed _ + · exact hjfixed _ + +include he hd in +lemma exists_all_chart_avoidance (f : C(K,Y)) (hdim : dimH (Set.univ : Set K) < n) + (S : Finset ι) (hs : ∀ i, i ∉ S → ∀ x, f x ∉ Set.range (e i)) : + ∃ (g : C(K,Y)) (H : f.Homotopy g), + (∀ i x, g x ≠ chartCenter (e i)) ∧ + (∀ t x, (∀ i, f x ∉ Set.range (e i)) → H (t,x) = f x) := by + classical + obtain ⟨g,H,hg,hH,hstat⟩ := exists_finite_chart_avoidance e he hd f hdim S + refine ⟨g,H,?_,?_⟩ + · intro i x + by_cases hi : i ∈ S + · exact hg i hi x + · intro hzero + have hh : g x = f x ∨ ∃ j ∈ S, g x ∈ Set.range (e j) := by simpa using hH 1 x + rcases hh with h | ⟨j,hj,h⟩ + · apply hs i hi x + rw [← h,hzero] + exact chartCenter_mem_range e i + · rw [hzero] at h + exact (hd (by intro heq; subst j; exact hi hj)).notMem_of_mem_left h + (chartCenter_mem_range e i) + · intro t x hx + exact hstat t x (fun i _ => hx i) + +end GroupRingTopology.Cellular + +namespace GroupRingTopology.Attachment +open Set Metric Topology +variable {X : Type*} [TopologicalSpace X] {ι : Type*} {n : ℕ} +variable (a : ι → C(Sphere n,X)) [T2Space (Space a)] +variable {K : Type*} [MetricSpace K] [CompactSpace K] + +def chart (i : ι) : C(Cellular.ChartDisk n,Space a) := + ⟨openCell a i,(openCell_openEmbedding a i).continuous⟩ + +/-- Maps of dimension below the newly attached cells can be deformed into the +old space. The deformation is stationary on the original preimage of it. -/ +lemma exists_deformation_into_base (f : C(K,Space a)) + (hdim : dimH (Set.univ : Set K) < n) : + ∃ (g : C(K,X)) (H : f.Homotopy ((⟨base a,continuous_base a⟩ : C(X,Space a)).comp g)), + ∀ t x, f x ∈ Set.range (base a) → H (t,x) = f x := by + classical + let I := {i : ι | (Set.range f ∩ Set.range (openCell a i)).Nonempty} + have hI : I.Finite := compact_finitely_many_openCells a (isCompact_range f.continuous) + have hs : ∀ i, i ∉ hI.toFinset → ∀ x, f x ∉ Set.range (chart a i) := by + intro i hi x hx + apply hi + rw [Set.Finite.mem_toFinset] + exact ⟨f x,Set.mem_range_self x,hx⟩ + obtain ⟨g,H,hg,hstat⟩ := Cellular.exists_all_chart_avoidance (chart a) + (fun i => openCell_openEmbedding a i) (fun i j hij => openCell_disjoint a i j hij) + f hdim hI.toFinset hs + have hgp (x : K) : g x ∈ punctured a := by + rintro ⟨i,hi⟩ + exact hg i x hi.symm + let gp : C(K,punctured a) := ⟨fun x => ⟨g x,hgp x⟩,g.continuous.subtype_mk hgp⟩ + let J := (radialHomotopy a).compContinuousMap gp + have hJ0 : (puncturedInclusion a).comp gp = g := rfl + let J' : g.Homotopy ((radialEnd a).comp gp) := hJ0 ▸ J + refine ⟨(radialRetraction a).comp gp,H.trans J',?_⟩ + intro t x hx + obtain ⟨y,hy⟩ := hx + have hfixed (s : unitInterval) : H (s,x) = f x := by + apply hstat s x + intro i + rintro ⟨d,hd⟩ + rw [← hy] at hd + cases hd + have hgx : g x = base a y := by simpa only [ContinuousMap.Homotopy.apply_one,← hy] using hfixed 1 + have hgp' : gp x = puncturedBase a y := Subtype.ext hgx + have hjfixed (s : unitInterval) : J' (s,x) = f x := by + change radialHomotopy a (s,gp x) = f x + rw [hgp',radialHomotopy_base,hy] + erw [ContinuousMap.Homotopy.trans_apply] + split_ifs + · exact hfixed _ + · exact hjfixed _ + +end GroupRingTopology.Attachment +open Set Metric Topology +open scoped NNReal ENNReal +namespace GroupRingTopology.GeneralPosition + +lemma lipschitz_insertNth {n : ℕ} (i : Fin (n+1)) (c : ℝ) : + LipschitzWith 1 (Fin.insertNth (α := fun _ : Fin (n+1) => ℝ) i c : (Fin n → ℝ) → (Fin (n+1) → ℝ)) := by + apply LipschitzWith.of_dist_le_mul + intro x y + simp only [NNReal.coe_one,one_mul] + rw [dist_pi_le_iff dist_nonneg] + intro j + refine Fin.succAboveCases i ?_ (fun k => ?_) j + · simp only [Fin.insertNth_apply_same,dist_self,dist_nonneg] + · simp only [Fin.insertNth_apply_succAbove] + exact dist_le_pi_dist x y k + +lemma sphere_subset_faces (n : ℕ) : + Metric.sphere (0 : Fin (n+1) → ℝ) 1 ⊆ + ⋃ i : Fin (n+1), ⋃ c ∈ ({1,-1}:Set ℝ), Set.range (Fin.insertNth (α := fun _ : Fin (n+1) => ℝ) i c : (Fin n → ℝ) → _) := by + intro x hx + have hxnorm : ‖x‖ = 1 := by simpa only [Metric.mem_sphere,dist_zero_right] using hx + have hi : ∃ i, 1 ≤ ‖x i‖ := by + by_contra! hh + have := (pi_norm_lt_iff (by norm_num : (0:ℝ)<1)).mpr hh + linarith + obtain ⟨i,hi⟩ := hi + have heq : |x i| = 1 := le_antisymm ((norm_le_pi_norm x i).trans_eq hxnorm) hi + have hc : x i ∈ ({1,-1}:Set ℝ) := by + rcases abs_eq (by norm_num : (0:ℝ)≤1) |>.mp heq with h | h <;> simp [h] + refine Set.mem_iUnion.mpr ⟨i,Set.mem_iUnion.mpr ⟨x i,Set.mem_iUnion.mpr ⟨hc,?_⟩⟩⟩ + exact ⟨fun j => x (i.succAbove j),Fin.insertNth_self_removeNth _ _⟩ + +lemma dimH_cube_boundary_le (n : ℕ) : + dimH (Metric.sphere (0 : Fin (n+1) → ℝ) 1) ≤ n := by + apply (dimH_mono (sphere_subset_faces n)).trans + rw [dimH_iUnion] + apply iSup_le + intro i + rw [dimH_bUnion (Set.toFinite ({1,-1}:Set ℝ)).countable] + apply iSup_le + intro c + apply iSup_le + intro _ + exact (lipschitz_insertNth i c).dimH_range_le.trans_eq (Real.dimH_univ_pi_fin n) + +lemma dimH_cube_boundary_subtype_le (n : ℕ) : + dimH (Set.univ : Set (Metric.sphere (0 : Fin (n+1) → ℝ) 1)) ≤ n := by + rw [← isometry_subtype_coe.dimH_image] + simpa only [Subtype.range_coe_subtype,Set.image_univ,Set.ofPred_mem_eq] using dimH_cube_boundary_le n + +end GroupRingTopology.GeneralPosition + +end + +end OAI diff --git a/lean/OAI/Algebra/GroupRing/CellularFurther2.lean b/lean/OAI/Algebra/GroupRing/CellularFurther2.lean new file mode 100644 index 0000000000000000000000000000000000000000..05dd9a3fb0e259deb89a021d8498f8701d946635 --- /dev/null +++ b/lean/OAI/Algebra/GroupRing/CellularFurther2.lean @@ -0,0 +1,431 @@ +import Mathlib +import OAI.Algebra.GroupRing.HomotopyFunctor + +namespace OAI + +noncomputable section + +open Set Metric Topology BigOperators +open Set Metric Topology +open Set Topology +open Set Metric Topology +open scoped NNReal +open Set Metric Topology +open scoped NNReal ENNReal +open Set Metric Topology + +namespace GroupRingTopology.Cellular + +section +open Set Metric Topology +universe u +variable {X : Type u} [TopologicalSpace X] [T2Space X] +variable {C : Set X} [CWComplex C] + +/-- The actual attaching maps of a classical CW skeleton. -/ +def skeletonBoundary (n : ℕ) (i : RelCWComplex.cell C n) : + C(Attachment.Sphere n,Skeleton C n) := + ⟨fun x => ⟨characteristic n i (boundary n x),sphere_mem_skeleton n i x⟩, + ((characteristic n i).continuous.comp (continuous_boundary n)).subtype_mk _⟩ + +def skeletonBase (n : ℕ) : C(Skeleton C n,Skeleton C (n+1)) := + ⟨fun x => ⟨x.1,skeleton_mono (Nat.le_succ n) x.2⟩,continuous_subtype_val.subtype_mk _⟩ + +def skeletonCell (n : ℕ) (i : RelCWComplex.cell C n) : + C(Attachment.Disk n,Skeleton C (n+1)) := + ⟨fun x => ⟨characteristic n i x,characteristic_mem_skeleton (Nat.lt_succ_self n) i x⟩, + (characteristic n i).continuous.subtype_mk _⟩ + +def skeletonAssembly (n : ℕ) : C(Attachment.Space (skeletonBoundary (C := C) n),Skeleton C (n+1)) := + Attachment.lift _ (skeletonBase n) (skeletonCell n) (fun _ _ => rfl) + +lemma skeletonAssembly_base (n : ℕ) (x : Skeleton C n) : + skeletonAssembly n (Attachment.base _ x) = skeletonBase n x := + Attachment.lift_base _ _ _ _ x + +lemma skeletonAssembly_cell (n : ℕ) (i : RelCWComplex.cell C n) (x : Disk n) : + skeletonAssembly n (Attachment.cell _ i x) = skeletonCell n i x := + Attachment.lift_cell _ _ _ _ i x + +lemma skeletonAssembly_interior (n : ℕ) (i : RelCWComplex.cell C n) (x : Attachment.OpenDisk n) : + skeletonAssembly n (Sum.inr ⟨i,x⟩) = skeletonCell n i (Attachment.interior n x) := by + rw [← Attachment.cell_interior (skeletonBoundary n) i x,skeletonAssembly_cell] + +lemma skeletonAssembly_injective (n : ℕ) : Function.Injective (skeletonAssembly (C := C) n) := by + intro a b hab + rcases a with a|⟨i,a⟩ <;> rcases b with b|⟨j,b⟩ + · change skeletonAssembly n (Attachment.base _ a) = skeletonAssembly n (Attachment.base _ b) at hab + rw [skeletonAssembly_base,skeletonAssembly_base] at hab + exact congrArg Sum.inl (Subtype.ext (congrArg (fun z : Skeleton C (n+1) => z.1) hab)) + · have hh := congrArg Subtype.val hab + rw [← show Attachment.base (skeletonBoundary n) a = Sum.inl a from rfl, + skeletonAssembly_base,skeletonAssembly_interior] at hh + have hm : a.1 ∈ CWComplex.openCell n j := ⟨b.1,b.2,hh.symm⟩ + exact False.elim (openCell_not_skeleton n j hm a.2) + · have hh := congrArg Subtype.val hab + rw [skeletonAssembly_interior, + ← show Attachment.base (skeletonBoundary n) b = Sum.inl b from rfl, + skeletonAssembly_base] at hh + have hm : b.1 ∈ CWComplex.openCell n i := ⟨a.1,a.2,hh⟩ + exact False.elim (openCell_not_skeleton n i hm b.2) + · have hh := congrArg Subtype.val hab + rw [skeletonAssembly_interior,skeletonAssembly_interior] at hh + have hij : i = j := by + by_contra hne + have hd := CWComplex.disjoint_openCell_of_ne (C := C) (i := i) (j := j) + (fun h => hne (sigma_mk_injective h)) + exact Set.disjoint_left.mp hd ⟨a.1,a.2,rfl⟩ ⟨b.1,b.2,hh.symm⟩ + subst j + have he : a = b := Subtype.ext ((RelCWComplex.map n i).injOn + (by simpa only [RelCWComplex.source_eq] using a.2) + (by simpa only [RelCWComplex.source_eq] using b.2) hh) + subst b; rfl + +lemma skeletonAssembly_surjective (n : ℕ) : Function.Surjective (skeletonAssembly (C := C) n) := by + intro x + have hx := x.2 + have heq : Skeleton C (n+1) = Skeleton C n ∪ + ⋃ i : RelCWComplex.cell C n,CWComplex.closedCell n i := by + simpa only [Skeleton,Nat.cast_add,Nat.cast_one] using + (CWComplex.skeletonLT_union_iUnion_closedCell_eq_skeletonLT_succ (C := C) n).symm + have hx' := (congrArg (fun S : Set X => x.1 ∈ S) heq).mp hx + rcases hx' with hx|hx + · exact ⟨Attachment.base _ ⟨x.1,hx⟩,skeletonAssembly_base n _⟩ + · obtain ⟨i,y,hy,he⟩ := Set.mem_iUnion.mp hx + refine ⟨Attachment.cell _ i ⟨y,hy⟩,?_⟩ + rw [skeletonAssembly_cell] + exact Subtype.ext he + +lemma skeletonAssembly_closed (n : ℕ) : IsClosedMap (skeletonAssembly (C := C) n) := by + intro S hS + let e : Attachment.Space (skeletonBoundary (C := C) n) → X := + fun x => (skeletonAssembly n x).1 + have hei : Function.Injective e := Subtype.val_injective.comp (skeletonAssembly_injective n) + have hclosed : IsClosed (e '' S) := by + apply (CWComplex.closed (Skeleton C (n+1)) _ ?_).mpr + · intro m j + have hm : m < n+1 := by + have hh : (m : ℕ∞) < ((n+1 : ℕ) : ℕ∞) := by + simpa only [RelCWComplex.skeletonLT_I,Set.mem_ofPred_eq] using j.2 + exact_mod_cast hh + have hu : ∃ u : C(Disk m,Attachment.Space (skeletonBoundary (C := C) n)), + ∀ x, e (u x) = characteristic m j.1 x := by + rcases Nat.lt_succ_iff_lt_or_eq.mp hm with hm|hm + · refine ⟨⟨fun x => Attachment.base _ + ⟨characteristic m j.1 x,characteristic_mem_skeleton hm j.1 x⟩, + (Attachment.continuous_base _).comp ((characteristic m j.1).continuous.subtype_mk _)⟩,?_⟩ + intro x; exact congrArg Subtype.val (skeletonAssembly_base n _) + · subst m + exact ⟨Attachment.cell _ j.1,fun x => congrArg Subtype.val (skeletonAssembly_cell n j.1 x)⟩ + obtain ⟨u,hu⟩ := hu + have heq : (e '' S) ∩ CWComplex.closedCell m j = + characteristic m j.1 '' (u ⁻¹' S) := by + ext x + constructor + · rintro ⟨⟨y,hy,rfl⟩,z,hz,he⟩ + refine ⟨⟨z,hz⟩,?_,he⟩ + change u ⟨z,hz⟩ ∈ S + have hh : u ⟨z,hz⟩ = y := hei ((hu _).trans he) + rwa [hh] + · rintro ⟨z,hz,rfl⟩ + exact ⟨⟨u z,hz,hu z⟩,z.1,z.2,rfl⟩ + rw [heq] + exact ((hS.preimage u.continuous).isCompact.image (characteristic m j.1).continuous).isClosed + · rintro x ⟨y,hy,rfl⟩ + exact (skeletonAssembly n y).2 + have h : IsClosed ((Subtype.val : Skeleton C (n+1) → X) ⁻¹' (e '' S)) := + hclosed.preimage continuous_subtype_val + convert h using 1 + ext x + constructor + · rintro ⟨y,hy,rfl⟩; exact ⟨y,hy,rfl⟩ + · rintro ⟨y,hy,he⟩; exact ⟨y,hy,Subtype.ext he⟩ + +/-- A classical CW skeleton is literally the topological adjunction of the +previous skeleton and its disks, including arbitrary infinite cell families. -/ +def skeletonHomeomorph (n : ℕ) : + Attachment.Space (skeletonBoundary (C := C) n) ≃ₜ Skeleton C (n+1) := + (isHomeomorph_iff_continuous_isClosedMap_bijective.mpr + ⟨(skeletonAssembly n).continuous,skeletonAssembly_closed n, + skeletonAssembly_injective n,skeletonAssembly_surjective n⟩).homeomorph _ +end + +section +open Set Metric Topology +universe u +variable {G : Type u} [Group G] {X : Type u} [TopologicalSpace X] [T2Space X] + [MulAction G X] [ContinuousConstSMul G X] [CWComplex (univ : Set X)] +variable {ι : ℕ → Type u} +variable (σ : ∀ n, (G × ι n) ≃ RelCWComplex.cell (univ : Set X) n) +variable (hσ : ∀ n (g h : G) (i : ι n) (x : Fin n → ℝ), + RelCWComplex.map n (σ n (g*h,i)) x = g • RelCWComplex.map n (σ n (h,i)) x) + +omit [ContinuousConstSMul G X] in +include hσ in +lemma skeleton_smul_mem (n : ℕ) (g : G) {x : X} (hx : x ∈ Skeleton (univ : Set X) n) : + g • x ∈ Skeleton (univ : Set X) n := by + obtain ⟨m,hm,j,y,hy,rfl⟩ := (CWComplex.mem_skeletonLT_iff (C := (univ : Set X))).mp hx + let i := (σ m).symm j + have hj : σ m i = j := (σ m).apply_symm_apply j + apply (CWComplex.mem_skeletonLT_iff (C := (univ : Set X))).mpr + refine ⟨m,hm,σ m (g*i.1,i.2),y,hy,?_⟩ + rw [hσ] + exact congrArg (fun j => g • RelCWComplex.map m j y) hj + +def skeletonTranslate (n : ℕ) (g : G) : C(Skeleton (univ : Set X) n,Skeleton (univ : Set X) n) := + ⟨fun x => ⟨g • x.1,skeleton_smul_mem σ hσ n g x.2⟩, + ((continuous_const_smul g).comp continuous_subtype_val).subtype_mk _⟩ + +lemma skeletonTranslate_base (n : ℕ) (g : G) (x : Skeleton (univ : Set X) n) : + skeletonTranslate σ hσ (n+1) g (skeletonBase n x) = + skeletonBase n (skeletonTranslate σ hσ n g x) := rfl + +lemma skeletonTranslate_cell (n : ℕ) (g h : G) (i : ι n) (x : Disk n) : + skeletonTranslate σ hσ (n+1) g (skeletonCell n (σ n (h,i)) x) = + skeletonCell n (σ n (g*h,i)) x := by + apply Subtype.ext + exact (hσ n g h i x.1).symm + +variable {E : Type u} [TopologicalSpace E] [MulAction G E] [ContinuousConstSMul G E] + +lemma exists_equivariant_skeleton_extension (n : ℕ) + (b : C(Skeleton (univ : Set X) n,E)) + (hb : ∀ (g : G) x, b (skeletonTranslate σ hσ n g x) = g • b x) + (hfill : ∀ a : C(Sphere n,E), ∃ d : C(Disk n,E), ∀ x, d (boundary n x) = a x) : + ∃ e : C(Skeleton (univ : Set X) (n+1),E), + (∀ x, e (skeletonBase n x) = b x) ∧ + ∀ (g : G) x, e (skeletonTranslate σ hσ (n+1) g x) = g • e x := by + let a (i : ι n) := b.comp (skeletonBoundary n (σ n (1,i))) + choose d hd using fun i => hfill (a i) + let D (j : RelCWComplex.cell (univ : Set X) n) : C(Disk n,E) := + ⟨fun x => ((σ n).symm j).1 • d ((σ n).symm j).2 x, + (continuous_const_smul _).comp (d _).continuous⟩ + have hD (j : RelCWComplex.cell (univ : Set X) n) (x : Sphere n) : + D j (boundary n x) = b (skeletonBoundary n j x) := by + obtain ⟨⟨g,i⟩,rfl⟩ := (σ n).surjective j + change ((σ n).symm (σ n (g,i))).1 • d ((σ n).symm (σ n (g,i))).2 (boundary n x) = _ + rw [Equiv.symm_apply_apply,hd] + change g • b (skeletonBoundary n (σ n (1,i)) x) = _ + rw [←hb] + congr 1 + apply Subtype.ext + exact (hσ n g 1 i x.1).symm.trans (by rw [mul_one]; rfl) + let f := Attachment.lift (skeletonBoundary (C := (univ : Set X)) n) b D hD + let e : C(Skeleton (univ : Set X) (n+1),E) := f.comp ⟨(skeletonHomeomorph n).symm,(skeletonHomeomorph n).symm.continuous⟩ + have he_base (x : Skeleton (univ : Set X) n) : e (skeletonBase n x) = b x := by + change f ((skeletonHomeomorph n).symm (skeletonBase n x)) = _ + rw [←skeletonAssembly_base] + change f ((skeletonHomeomorph n).symm ((skeletonHomeomorph n) (Attachment.base _ x))) = _ + rw [Homeomorph.symm_apply_apply] + rfl + have he_cell (j : RelCWComplex.cell (univ : Set X) n) (x : Disk n) : + e (skeletonCell n j x) = D j x := by + change f ((skeletonHomeomorph n).symm (skeletonCell n j x)) = _ + rw [←skeletonAssembly_cell] + change f ((skeletonHomeomorph n).symm ((skeletonHomeomorph n) (Attachment.cell _ j x))) = _ + rw [Homeomorph.symm_apply_apply] + exact Attachment.lift_cell _ _ _ _ _ _ + refine ⟨e,he_base,?_⟩ + intro g x + obtain ⟨y,rfl⟩ := skeletonAssembly_surjective n x + cases y with + | inl x => + change e (skeletonTranslate σ hσ (n+1) g (skeletonBase n x)) = g • e (skeletonBase n x) + rw [skeletonTranslate_base,he_base,he_base,hb] + | inr p => + obtain ⟨⟨h,i⟩,hj⟩ := (σ n).surjective p.1 + have heq : skeletonAssembly n (Sum.inr p) = skeletonCell n p.1 (Attachment.interior n p.2) := by + exact skeletonAssembly_interior n p.1 p.2 + rw [heq,←hj,skeletonTranslate_cell,he_cell,he_cell] + change ((σ n).symm (σ n (g*h,i))).1 • d ((σ n).symm (σ n (g*h,i))).2 _ = + g • (((σ n).symm (σ n (h,i))).1 • d ((σ n).symm (σ n (h,i))).2 _) + simp only [Equiv.symm_apply_apply,mul_smul] +end + +section +open Set Metric Topology +universe u +variable {G : Type u} [Group G] {X : Type u} [TopologicalSpace X] [T2Space X] + [MulAction G X] [ContinuousConstSMul G X] [CWComplex (univ : Set X)] +variable {ι : ℕ → Type u} +variable (σ : ∀ n, (G × ι n) ≃ RelCWComplex.cell (univ : Set X) n) +variable (hσ : ∀ n (g h : G) (i : ι n) (x : Fin n → ℝ), + RelCWComplex.map n (σ n (g*h,i)) x = g • RelCWComplex.map n (σ n (h,i)) x) +variable {E B : Type u} [TopologicalSpace E] [TopologicalSpace B] + [MulAction G E] [ContinuousConstSMul G E] [MulAction G B] + +lemma exists_equivariant_skeleton_lift (n : ℕ) (p : C(E,B)) + (hp : ∀ (g : G) e, p (g • e) = g • p e) (hRLP : DiskRLP p) + (F : C(Skeleton (univ : Set X) (n+1),B)) + (hF : ∀ (g : G) x, F (skeletonTranslate σ hσ (n+1) g x) = g • F x) + (b : C(Skeleton (univ : Set X) n,E)) + (hb : ∀ (g : G) x, b (skeletonTranslate σ hσ n g x) = g • b x) + (hbF : ∀ x, p (b x) = F (skeletonBase n x)) : + ∃ e : C(Skeleton (univ : Set X) (n+1),E), + (∀ x, e (skeletonBase n x) = b x) ∧ (∀ x, p (e x) = F x) ∧ + ∀ (g : G) x, e (skeletonTranslate σ hσ (n+1) g x) = g • e x := by + let a (i : ι n) := b.comp (skeletonBoundary n (σ n (1,i))) + let c (i : ι n) := F.comp (skeletonCell n (σ n (1,i))) + have hsq (i : ι n) (x : Sphere n) : p (a i x) = c i (boundary n x) := by + change p (b (skeletonBoundary n (σ n (1,i)) x)) = F (skeletonCell n (σ n (1,i)) (boundary n x)) + rw [hbF] + rfl + choose d hd hf using fun i => hRLP n (a i) (c i) (hsq i) + let D (j : RelCWComplex.cell (univ : Set X) n) : C(Disk n,E) := + ⟨fun x => ((σ n).symm j).1 • d ((σ n).symm j).2 x, + (continuous_const_smul _).comp (d _).continuous⟩ + have hD (j : RelCWComplex.cell (univ : Set X) n) (x : Sphere n) : + D j (boundary n x) = b (skeletonBoundary n j x) := by + obtain ⟨⟨g,i⟩,rfl⟩ := (σ n).surjective j + change ((σ n).symm (σ n (g,i))).1 • d ((σ n).symm (σ n (g,i))).2 (boundary n x) = _ + rw [Equiv.symm_apply_apply,hd] + change g • b (skeletonBoundary n (σ n (1,i)) x) = _ + rw [←hb] + congr 1 + apply Subtype.ext + exact (hσ n g 1 i x.1).symm.trans (by rw [mul_one]; rfl) + let f := Attachment.lift (skeletonBoundary (C := (univ : Set X)) n) b D hD + let e : C(Skeleton (univ : Set X) (n+1),E) := f.comp ⟨(skeletonHomeomorph n).symm,(skeletonHomeomorph n).symm.continuous⟩ + have he_base (x : Skeleton (univ : Set X) n) : e (skeletonBase n x) = b x := by + change f ((skeletonHomeomorph n).symm (skeletonBase n x)) = _ + rw [←skeletonAssembly_base] + change f ((skeletonHomeomorph n).symm ((skeletonHomeomorph n) (Attachment.base _ x))) = _ + rw [Homeomorph.symm_apply_apply] + rfl + have he_cell (j : RelCWComplex.cell (univ : Set X) n) (x : Disk n) : + e (skeletonCell n j x) = D j x := by + change f ((skeletonHomeomorph n).symm (skeletonCell n j x)) = _ + rw [←skeletonAssembly_cell] + change f ((skeletonHomeomorph n).symm ((skeletonHomeomorph n) (Attachment.cell _ j x))) = _ + rw [Homeomorph.symm_apply_apply] + exact Attachment.lift_cell _ _ _ _ _ _ + have he (g : G) (x : Skeleton (univ : Set X) (n+1)) : + e (skeletonTranslate σ hσ (n+1) g x) = g • e x := by + obtain ⟨y,rfl⟩ := skeletonAssembly_surjective n x + cases y with + | inl x => + change e (skeletonTranslate σ hσ (n+1) g (skeletonBase n x)) = g • e (skeletonBase n x) + rw [skeletonTranslate_base,he_base,he_base,hb] + | inr q => + obtain ⟨⟨h,i⟩,hj⟩ := (σ n).surjective q.1 + have heq : skeletonAssembly n (Sum.inr q) = skeletonCell n q.1 (Attachment.interior n q.2) := + skeletonAssembly_interior n q.1 q.2 + rw [heq,←hj,skeletonTranslate_cell,he_cell,he_cell] + change ((σ n).symm (σ n (g*h,i))).1 • d ((σ n).symm (σ n (g*h,i))).2 _ = + g • (((σ n).symm (σ n (h,i))).1 • d ((σ n).symm (σ n (h,i))).2 _) + simp only [Equiv.symm_apply_apply,mul_smul] + refine ⟨e,he_base,?_,he⟩ + intro x + obtain ⟨y,rfl⟩ := skeletonAssembly_surjective n x + cases y with + | inl x => + change p (e (skeletonBase n x)) = F (skeletonBase n x) + rw [he_base,hbF] + | inr q => + rw [skeletonAssembly_interior,he_cell] + obtain ⟨⟨g,i⟩,hj⟩ := (σ n).surjective q.1 + rw [←hj] + change p (((σ n).symm (σ n (g,i))).1 • d ((σ n).symm (σ n (g,i))).2 _) = _ + rw [Equiv.symm_apply_apply,hp,hf] + change g • F (skeletonCell n (σ n (1,i)) _) = _ + rw [←hF,skeletonTranslate_cell,mul_one] +end + +open Set Metric Topology +universe u +variable {G : Type u} [Group G] {X : Type u} [TopologicalSpace X] [T2Space X] + [MulAction G X] [ContinuousConstSMul G X] [CWComplex (univ : Set X)] +variable {ι : ℕ → Type u} +variable (σ : ∀ n, (G × ι n) ≃ RelCWComplex.cell (univ : Set X) n) +variable (hσ : ∀ n (g h : G) (i : ι n) (x : Fin n → ℝ), + RelCWComplex.map n (σ n (g*h,i)) x = g • RelCWComplex.map n (σ n (h,i)) x) +omit [MulAction G X] [ContinuousConstSMul G X] in +lemma isEmpty_skeleton_zero : IsEmpty (Skeleton (univ : Set X) 0) := by + refine ⟨fun x => ?_⟩ + have hx := x.2 + change x.1 ∈ (CWComplex.skeletonLT (univ : Set X) 0 : Set X) at hx + rw [CWComplex.skeletonLT_zero_eq_empty] at hx + exact hx + +variable {E B : Type u} [TopologicalSpace E] [TopologicalSpace B] + [MulAction G E] [ContinuousConstSMul G E] [MulAction G B] + +lemma exists_equivariant_lift_on_skeleton (d : ℕ) (p : C(E,B)) + (hp : ∀ (g : G) e, p (g • e) = g • p e) (hRLP : DiskRLP p) + (F : C(Skeleton (univ : Set X) d,B)) + (hF : ∀ (g : G) x, F (skeletonTranslate σ hσ d g x) = g • F x) : + ∃ e : C(Skeleton (univ : Set X) d,E), (∀ x, p (e x) = F x) ∧ + ∀ (g : G) x, e (skeletonTranslate σ hσ d g x) = g • e x := by + induction d with + | zero => + let := isEmpty_skeleton_zero (X := X) + exact ⟨⟨isEmptyElim,continuous_of_discreteTopology⟩,fun x => isEmptyElim x,fun _ x => isEmptyElim x⟩ + | succ d ih => + obtain ⟨b,hbF,hb⟩ := ih (F.comp (skeletonBase d)) (fun g x => by + change F (skeletonBase d (skeletonTranslate σ hσ d g x)) = g • F (skeletonBase d x) + rw [←skeletonTranslate_base,hF]) + obtain ⟨e,_,heF,he⟩ := exists_equivariant_skeleton_lift σ hσ d p hp hRLP F hF b hb hbF + exact ⟨e,heF,he⟩ + +lemma exists_equivariant_map_on_skeleton (d : ℕ) + (hfill : ∀ n < d, ∀ a : C(Sphere n,E), ∃ e : C(Disk n,E), ∀ x, e (boundary n x) = a x) : + ∃ e : C(Skeleton (univ : Set X) d,E), + ∀ (g : G) x, e (skeletonTranslate σ hσ d g x) = g • e x := by + induction d with + | zero => + let := isEmpty_skeleton_zero (X := X) + exact ⟨⟨isEmptyElim,continuous_of_discreteTopology⟩,fun _ x => isEmptyElim x⟩ + | succ d ih => + obtain ⟨b,hb⟩ := ih (fun n hn => hfill n (Nat.lt_succ_of_lt hn)) + obtain ⟨e,_,he⟩ := exists_equivariant_skeleton_extension σ hσ d b hb (hfill d (Nat.lt_succ_self d)) + exact ⟨e,he⟩ + +variable {Y : Type u} [TopologicalSpace Y] [MulAction G Y] [ContinuousConstSMul G Y] +lemma exists_equivariant_homotopy_on_skeleton (d : ℕ) (hY : SphereFillable Y) + (a b : C(Skeleton (univ : Set X) d,Y)) + (ha : ∀ (g : G) x, a (skeletonTranslate σ hσ d g x) = g • a x) + (hb : ∀ (g : G) x, b (skeletonTranslate σ hσ d g x) = g • b x) : + ∃ H : a.Homotopy b, ∀ (g : G) t x, + H (t,skeletonTranslate σ hσ d g x) = g • H (t,x) := by + let F : C(Skeleton (univ : Set X) d,Y × Y) := a.prodMk b + have hF (g : G) x : F (skeletonTranslate σ hσ d g x) = g • F x := by + exact Prod.ext (ha g x) (hb g x) + obtain ⟨e,heF,he⟩ := exists_equivariant_lift_on_skeleton σ hσ d pathEndpoint + (fun _ _ => rfl) (pathEndpoint_RLP hY) F hF + let H : a.Homotopy b := + { toFun := fun z => e z.2 z.1 + continuous_toFun := e.continuous.comp continuous_snd |>.eval continuous_fst + map_zero_left := fun x => congrArg Prod.fst (heF x) + map_one_left := fun x => congrArg Prod.snd (heF x) } + refine ⟨H,?_⟩ + intro g t x + exact ContinuousMap.congr_fun (he g x) t + +omit [MulAction G X] [ContinuousConstSMul G X] in +def skeletonChart (n m : ℕ) (hm : m < n) (i : RelCWComplex.cell (univ : Set X) m) : + C(Disk m,Skeleton (univ : Set X) n) := + ⟨fun z => ⟨characteristic m i z,characteristic_mem_skeleton hm i z⟩, + (characteristic m i).continuous.subtype_mk _⟩ + +lemma skeleton_compact_representatives (n : ℕ) [∀ m,Finite (ι m)] : + ∃ K : Set (Skeleton (univ : Set X) n), IsCompact K ∧ + ∀ x, ∃ g : G, ∃ y ∈ K, x = skeletonTranslate σ hσ n g y := by + let K := ⋃ m : Fin n, ⋃ i : ι m, Set.range (skeletonChart n m m.2 (σ m (1,i))) + have hK : IsCompact K := isCompact_iUnion fun m => isCompact_iUnion fun i => + isCompact_range (skeletonChart n m m.2 (σ m (1,i))).continuous + refine ⟨K,hK,?_⟩ + intro x + obtain ⟨m,hm,j,z,hz,hj⟩ := (CWComplex.mem_skeletonLT_iff (C := (univ : Set X))).mp x.2 + obtain ⟨⟨g,i⟩,rfl⟩ := (σ m).surjective j + have hmn : m < n := by exact_mod_cast hm + let y := skeletonChart n m hmn (σ m (1,i)) ⟨z,ball_subset_closedBall hz⟩ + refine ⟨g,y,Set.mem_iUnion.mpr ⟨⟨m,hmn⟩,Set.mem_iUnion.mpr ⟨i,Set.mem_range_self _⟩⟩,?_⟩ + apply Subtype.ext + change x.1 = g • RelCWComplex.map m (σ m (1,i)) z + rw [←hσ,mul_one] + exact hj.symm +end GroupRingTopology.Cellular + +end + +end OAI diff --git a/lean/OAI/Algebra/GroupRing/ChainActiveStages.lean b/lean/OAI/Algebra/GroupRing/ChainActiveStages.lean new file mode 100644 index 0000000000000000000000000000000000000000..d9f05ab105860107e953619e9ae847d6e477d3dd --- /dev/null +++ b/lean/OAI/Algebra/GroupRing/ChainActiveStages.lean @@ -0,0 +1,368 @@ +import Mathlib +import OAI.Algebra.GroupRing.ChunkComparisons + +namespace OAI + +noncomputable section + +namespace TorsionFreeZeroDivisors.ChainActiveStages +open scoped Classical BigOperators +open Function PortSubdivision ChainSuppression DegreeTwoSuppression SuppressedMoore ChainPaths +open ChainIsomorphism ChainChunkTransport ChainMultiplicity ChunkComparisons FiniteChunking +open StageSubgraphs +variable {V D : Type*} [Fintype D] (Γ : PortGraph V D) + (mark : V → Prop) (h2 : ∀ v, ¬mark v → (out Γ.origin v).card=2) + {P : Type*} [Fintype P] (paths : P → List {d : D // turn Γ.origin mark h2 d=d}) +local notation "B" => {d : D // turn Γ.origin mark h2 d=d} +local notation "S" => suppressed Γ mark h2 +local notation "R" => ChainIsomorphism.Rep Γ mark h2 +local notation "col" => color Γ mark h2 paths +local notation "e" => ListStageExponents.edge paths +local notation "m" => StageSubgraphs.multiplicity (S) e +abbrev ActiveChain (j : ℕ) := {c : R // j < ChunkComparisons.multiplicity col c} +local notation "A" => ActiveChain Γ mark h2 paths + +/-- Literal active chain orientations, with no padding by inactive chains. -/ +def activeOrientation (j : ℕ) : ActiveD m j ≃ A j × Bool where + toFun d := (⟨representative Γ mark h2 d.val,by + rw [←multiplicity_at Γ mark h2 paths]; exact d.property⟩,reversed Γ mark h2 d.val) + invFun c := ⟨orientation Γ mark h2 (c.1.val,c.2),by + rw [multiplicity_at Γ mark h2 paths] + change j < ChunkComparisons.multiplicity col (((orientation Γ mark h2).symm ((orientation Γ mark h2) (c.1.val,c.2))).1) + rw [Equiv.symm_apply_apply] + exact c.1.property⟩ + left_inv d := by + apply Subtype.ext + exact (orientation Γ mark h2).apply_symm_apply d.val + right_inv c := by + apply Prod.ext + · apply Subtype.ext + change ((orientation Γ mark h2).symm ((orientation Γ mark h2) (c.1.val,c.2))).1=c.1.val + rw [Equiv.symm_apply_apply] + · change ((orientation Γ mark h2).symm ((orientation Γ mark h2) (c.1.val,c.2))).2=c.2 + rw [Equiv.symm_apply_apply] + +variable [Fintype V] + +omit [Fintype V] in +lemma edges_card (j : ℕ) : + (edges (stage (S) m (multiplicity_reverse (S) e) j)).card=Fintype.card (A j) := by + have ha := Fintype.card_congr (activeOrientation Γ mark h2 paths j) + rw [Fintype.card_prod,Fintype.card_bool] at ha + have he := two_edges (stage (S) m (multiplicity_reverse (S) e) j) + omega + +def first (j : ℕ) (c : A j) : ActiveV (S) m j := + ⟨ChainIsomorphism.first Γ mark h2 c.val,c.val.val,rfl,by + rw [multiplicity_eq Γ mark h2 paths]; exact c.property⟩ + +def last (j : ℕ) (c : A j) : ActiveV (S) m j := + ⟨ChainIsomorphism.last Γ mark h2 c.val,(S).reverse c.val.val,rfl,by + rw [multiplicity_reverse,multiplicity_eq Γ mark h2 paths]; exact c.property⟩ + +omit [Fintype V] in +lemma incident (j : ℕ) (v : ActiveV (S) m j) : + ∃ c : A j, first Γ mark h2 paths j c=v ∨ last Γ mark h2 paths j c=v := by + rcases v.property with ⟨d,hd,hm⟩ + let c : A j := ⟨representative Γ mark h2 d,by rwa [←multiplicity_at Γ mark h2 paths]⟩ + refine ⟨c,?_⟩ + have h := oriented Γ mark h2 d + cases hr : reversed Γ mark h2 d + · left + apply Subtype.ext + change (S).origin c.val.val=v.val + simp only [hr,Bool.false_eq_true,ite_false] at h + change d=c.val.val at h + rw [←h,hd] + · right + apply Subtype.ext + change (S).origin ((S).reverse c.val.val)=v.val + simp only [hr,ite_true] at h + change d=(S).reverse c.val.val at h + rw [←h,hd] + +/-- The signed exponent counted by the chain expectation is exactly the one +bounded by immersed path incidence, including the first-stage root saving. -/ +theorem exponent_nonpos (hp : ∀ i,paths i≠[]) (cyclic : P → Bool) + (hc : ∀ i,(paths i).IsChain (WeightedMoore.PortWalk.step (S).origin (S).reverse)) + (hclose : ∀ i,cyclic i=true → ∀ᵉ (x∈(paths i).getLast?) (y∈(paths i).head?), + WeightedMoore.PortWalk.step (S).origin (S).reverse x y) + (M : ℕ) (hM : 0 len c.val +def firstPoint (c : {c // active c}) : {v // incident v} := ⟨first c.val,hf _ c.property⟩ +def lastPoint (c : {c // active c}) : {v // incident v} := ⟨last c.val,hl _ c.property⟩ + +local notation "P" => graph len first last +local notation "Q" => graph (length len active) (firstPoint first active incident hf) (lastPoint last active incident hl) + +def vertex : Vertex (length len active) (V := {v // incident v}) → Vertex len (V := V) + | .inl v => .inl v.val + | .inr ⟨c,i⟩ => .inr ⟨c.val,i⟩ + +def dart : Dart (length len active) → Dart len := fun d => (⟨d.1.1.val,d.1.2⟩,d.2) + +lemma vertex_injective : Function.Injective (vertex len active incident) := by + intro v w h + cases v with + | inl v => + cases w with + | inl w => exact congrArg Sum.inl (Subtype.ext (Sum.inl.inj h)) + | inr w => cases h + | inr v => + cases w with + | inl w => cases h + | inr w => + rcases v with ⟨⟨c,hc⟩,i⟩ + rcases w with ⟨⟨d,hd⟩,k⟩ + have h' := Sum.inr.inj h + have hcd := congrArg Sigma.fst h' + cases hcd + have hik : i=k := eq_of_heq (Sigma.mk.inj_iff.mp h').2 + cases hik + rfl + +lemma dart_injective : Function.Injective (dart len active) := by + rintro ⟨⟨⟨c,hc⟩,i⟩,r⟩ ⟨⟨⟨d,hd⟩,k⟩,s⟩ h + have hrs := congrArg Prod.snd h + cases hrs + have h' := congrArg Prod.fst h + have hcd := congrArg Sigma.fst h' + cases hcd + have hik : i=k := eq_of_heq (Sigma.mk.inj_iff.mp h').2 + cases hik + rfl + +lemma point_map (c : {c // active c}) (k : Fin ((length len active) c+1)) : + vertex len active incident + (point (length len active) (firstPoint first active incident hf) (lastPoint last active incident hl) c k) = + point len first last c.val k := by + unfold point + split_ifs <;> rfl + +lemma origin_map (d : Dart (length len active)) : + vertex len active incident ((Q).origin d)=(P).origin (dart len active d) := by + rcases d with ⟨⟨c,i⟩,r⟩ + cases r + · simpa only [dart,origin_forward] using + point_map len first last active incident hf hl c ⟨i.val,by have h:=i.isLt; omega⟩ + · simpa only [dart,origin_backward] using + point_map len first last active incident hf hl c ⟨i.val+1,by have h:=i.isLt; omega⟩ + +lemma reverse_map (d : Dart (length len active)) : + dart len active ((Q).reverse d)=(P).reverse (dart len active d) := rfl + +end TorsionFreeZeroDivisors.SubdivisionRestriction + +namespace TorsionFreeZeroDivisors.ChainStageEmbedding +open scoped Classical BigOperators +open Function PortSubdivision ChainSuppression DegreeTwoSuppression SuppressedMoore ChainPaths +open ChainIsomorphism ChainChunkTransport ChainMultiplicity ChunkComparisons FiniteChunking +open StageSubgraphs +variable {V D : Type*} [Fintype D] (Γ : PortGraph V D) + (mark : V → Prop) (h2 : ∀ v, ¬mark v → (out Γ.origin v).card=2) + {P : Type*} [Fintype P] (paths : P → List {d : D // turn Γ.origin mark h2 d=d}) (j : ℕ) +local notation "S" => suppressed Γ mark h2 +local notation "R" => ChainIsomorphism.Rep Γ mark h2 +local notation "col" => color Γ mark h2 paths +local notation "e" => ListStageExponents.edge paths +local notation "m" => StageSubgraphs.multiplicity (S) e +local notation "A" => ChainActiveStages.ActiveChain Γ mark h2 paths j +local notation "W" => ActiveV (S) m j + +abbrev length : A → ℕ := fun c => repLength Γ mark h2 c.val +abbrev graph := ChainSubdivision.graph (length Γ mark h2 paths j) + (ChainActiveStages.first Γ mark h2 paths j) (ChainActiveStages.last Γ mark h2 paths j) +local notation "Q" => graph Γ mark h2 paths j + +abbrev active (c : R) : Prop := j z.val) h + +def vertexLift : ChainSubdivision.Vertex (length Γ mark h2 paths j) (V := W) → + ChainSubdivision.Vertex (repLength Γ mark h2) (V := Mark mark) + | .inl v => .inl (marked Γ mark h2 paths j v) + | .inr ⟨c,i⟩ => .inr ⟨c.val,i⟩ + +lemma vertexLift_injective : Injective (vertexLift Γ mark h2 paths j) := by + intro v w h + cases v with + | inl v => + cases w with + | inl w => exact congrArg Sum.inl (marked_injective Γ mark h2 paths j (Sum.inl.inj h)) + | inr w => cases h + | inr v => + cases w with + | inl w => cases h + | inr w => + rcases v with ⟨⟨c,hc⟩,i⟩ + rcases w with ⟨⟨d,hd⟩,k⟩ + have h' := Sum.inr.inj h + have hcd := congrArg Sigma.fst h' + cases hcd + have hik : i=k := eq_of_heq (Sigma.mk.inj_iff.mp h').2 + cases hik + rfl + +lemma point_lift (c : A) (k : Fin ((length Γ mark h2 paths j) c+1)) : + vertexLift Γ mark h2 paths j + (ChainSubdivision.point (length Γ mark h2 paths j) + (ChainActiveStages.first Γ mark h2 paths j) (ChainActiveStages.last Γ mark h2 paths j) c k) = + ChainSubdivision.point (repLength Γ mark h2) (ChainIsomorphism.first Γ mark h2) + (ChainIsomorphism.last Γ mark h2) c.val k := by + unfold ChainSubdivision.point + split_ifs <;> rfl + +def vertexMap : ChainSubdivision.Vertex (length Γ mark h2 paths j) (V := W) → V := + ChainIsomorphism.vertexMap Γ mark h2 ∘ vertexLift Γ mark h2 paths j + +def dartMap : ChainSubdivision.Dart (length Γ mark h2 paths j) → D := + ChainIsomorphism.dartMap Γ mark h2 ∘ SubdivisionRestriction.dart (repLength Γ mark h2) + (active Γ mark h2 paths j) + +lemma vertexMap_injective : Injective (vertexMap Γ mark h2 paths j) := + (ChainIsomorphism.vertexMap_injective Γ mark h2).comp + (vertexLift_injective Γ mark h2 paths j) + +lemma dartMap_injective : Injective (dartMap Γ mark h2 paths j) := + (ChainIsomorphism.dartMap_injective Γ mark h2).comp + (SubdivisionRestriction.dart_injective _ _) + +lemma origin_map (d : ChainSubdivision.Dart (length Γ mark h2 paths j)) : + vertexMap Γ mark h2 paths j ((Q).origin d)=Γ.origin (dartMap Γ mark h2 paths j d) := by + unfold vertexMap dartMap + dsimp only [Function.comp_apply] + have h : vertexLift Γ mark h2 paths j ((Q).origin d) = + (ChainSubdivision.graph (repLength Γ mark h2) (ChainIsomorphism.first Γ mark h2) + (ChainIsomorphism.last Γ mark h2)).origin + (SubdivisionRestriction.dart (repLength Γ mark h2) (active Γ mark h2 paths j) d) := by + rcases d with ⟨⟨c,i⟩,r⟩ + cases r + · simpa only [SubdivisionRestriction.dart,ChainSubdivision.origin_forward] using + point_lift Γ mark h2 paths j c ⟨i.val,by have h:=i.isLt; omega⟩ + · simpa only [SubdivisionRestriction.dart,ChainSubdivision.origin_backward] using + point_lift Γ mark h2 paths j c ⟨i.val+1,by have h:=i.isLt; omega⟩ + rw [h] + exact ChainIsomorphism.origin_map Γ mark h2 _ + +lemma reverse_map (d : ChainSubdivision.Dart (length Γ mark h2 paths j)) : + dartMap Γ mark h2 paths j ((Q).reverse d)=Γ.reverse (dartMap Γ mark h2 paths j d) := by + unfold dartMap + dsimp only [Function.comp_apply] + rw [show SubdivisionRestriction.dart (repLength Γ mark h2) (active Γ mark h2 paths j) ((Q).reverse d)= + (ChainSubdivision.graph (repLength Γ mark h2) (ChainIsomorphism.first Γ mark h2) + (ChainIsomorphism.last Γ mark h2)).reverse + (SubdivisionRestriction.dart (repLength Γ mark h2) (active Γ mark h2 paths j) d) from rfl] + exact ChainIsomorphism.dartMap_reverse Γ mark h2 _ + +/-- Restricting an immersed realization keeps every active chain vertex and +port injective, without ever trying to embed inactive marked vertices. -/ +theorem immersed {T : Type*} (label : D → T) + (hlabel : Injective (fun d => (Γ.origin d,label d))) : + Injective (fun d => ((Q).origin d,label (dartMap Γ mark h2 paths j d))) := by + intro a b h + apply dartMap_injective Γ mark h2 paths j + apply hlabel + apply Prod.ext + · change Γ.origin (dartMap Γ mark h2 paths j a) = Γ.origin (dartMap Γ mark h2 paths j b) + rw [←origin_map,←origin_map] + exact congrArg (vertexMap Γ mark h2 paths j) (congrArg Prod.fst h) + · change label (dartMap Γ mark h2 paths j a) = label (dartMap Γ mark h2 paths j b) + exact congrArg Prod.snd h + +end TorsionFreeZeroDivisors.ChainStageEmbedding + +namespace TorsionFreeZeroDivisors.RootPins +open scoped Classical BigOperators +variable {V T : Type*} [Fintype V] + +/-- At most one prescribed root. All other vertices remain unpinned. -/ +def pin (root : Option V) (target : T) (v : V) : Option T := + if root=some v then some target else none + +def free (root : Option V) (target : T) : ℕ := + (Finset.univ.filter fun v => pin root target v=none).card + +lemma free_none (target : T) : free (V:=V) none target=Fintype.card V := by + simp [free,pin] + +lemma free_some (root : V) (target : T) : free (some root) target+1=Fintype.card V := by + have h : (Finset.univ.filter fun v => pin (some root) target v=none) = Finset.univ.erase root := by + ext v + simp [pin,eq_comm] + unfold free + rw [h,Finset.card_erase_add_one (Finset.mem_univ root),Finset.card_univ] + +lemma free_cast (root : Option V) (target : T) : + (free root target : ℤ)=(Fintype.card V:ℤ)-(if root.isSome then 1 else 0) := by + cases root with + | none => simp only [free_none,Option.isSome_none,Bool.false_eq_true,ite_false,sub_zero] + | some v => + have h := free_some v target + simp only [Option.isSome_some,ite_true] + omega + +omit [Fintype V] in +lemma respects {root : Option V} {target : T} (f : V → T) + (h : ∀ v,root=some v → f v=target) : + ∀ v y,pin root target v=some y → f v=y := by + intro v y hy + unfold pin at hy + split_ifs at hy with hv + · cases Option.some.inj hy + exact h v hv + +end TorsionFreeZeroDivisors.RootPins + +namespace TorsionFreeZeroDivisors.ActiveRoot +open scoped Classical +open PortSubdivision StageSubgraphs +variable {V D P : Type*} [Fintype D] [Fintype P] + (Γ : PortGraph V D) (paths : P → List D) (hp : ∀ p,paths p≠[]) + +omit [Fintype D] in +lemma occurrence_positive (p : P) (i : Fin (paths p).length) : + 0 simp + | cons a p ih => + have ha := hh a (by simp) + intro d hd + rcases List.mem_cons.mp hd with rfl | hd + · exact ha + · apply ih hp.tail ?_ d hd + cases p with + | nil => simp + | cons b p => + intro e he + have heb : b=e := by simpa using he + subst e + exact covered_step Γ mark h2 ha (List.isChain_cons_cons.mp hp).1 + +/-- Every dart of the actual image belongs to a marked chain. No circle +component is dropped: a path start is marked in every component. -/ +theorem actual_image_covered {J : Type*} (paths : J → List D) + (hpaths : ∀ j, (paths j).IsChain (WeightedMoore.PortWalk.step Γ.origin Γ.reverse)) + (hstarts : ∀ j d, d∈(paths j).head? → mark (Γ.origin d)) + (himage : ∀ d : D, ∃ j, d∈paths j ∨ Γ.reverse d∈paths j) : + ∀ d, Covered Γ.reverse (turn Γ.origin mark h2) Γ.reverse_reverse + (turn_involutive Γ.origin mark h2) d := by + intro d + obtain ⟨j,hj⟩ := himage d + have hp := covered_path Γ mark h2 (paths j) (hpaths j) (by + intro e he + exact covered_fixed _ _ _ _ (turn_of_mark Γ.origin mark h2 e (hstarts j e he))) + rcases hj with hj|hj + · exact hp d hj + · have hh := covered_reverse _ _ _ _ (hp (Γ.reverse d) hj) + rwa [Γ.reverse_reverse d] at hh + +/-- Exact length accounting after suppressing the actual image, rather than +only the inequality for a possibly incomplete set of marked components. -/ +theorem actual_chain_total {J : Type*} (paths : J → List D) + (hpaths : ∀ j, (paths j).IsChain (WeightedMoore.PortWalk.step Γ.origin Γ.reverse)) + (hstarts : ∀ j d, d∈(paths j).head? → mark (Γ.origin d)) + (himage : ∀ d : D, ∃ j, d∈paths j ∨ Γ.reverse d∈paths j) : + ∑ d : {d : D // turn Γ.origin mark h2 d=d}, chainLength Γ mark h2 d = Fintype.card D := by + have hsurj : Surjective (fun p : (d : {d : D // turn Γ.origin mark h2 d=d}) × + Fin (chainLength Γ mark h2 d) => (next Γ.reverse (turn Γ.origin mark h2))^[p.2.val] p.1.val) := by + intro d + obtain ⟨x,i,hi⟩ := actual_image_covered Γ mark h2 paths hpaths hstarts himage d + exact ⟨⟨x,i⟩,hi⟩ + exact le_antisymm (chainLength_total Γ mark h2) (by + simpa only [Fintype.card_sigma,Fintype.card_fin] using Fintype.card_le_of_surjective _ hsurj) + +end TorsionFreeZeroDivisors.ActualMarkedChains + +namespace TorsionFreeZeroDivisors.MarkedChainBound +open PortSubdivision DegreeTwoSuppression CoreStripping ImageComplexity +open scoped Classical BigOperators +variable {V D : Type} [Fintype V] [Fintype D] (Γ : PortGraph V D) + +/-- Mark all irregular vertices and the specified +start/end vertices. -/ +def marks (M : Finset V) (v : V) : Prop := degree Γ Finset.univ v ≠ 2 ∨ v∈M + +omit [Fintype V] in +lemma marks_degree_two (M : Finset V) (v : V) (hv : ¬marks Γ M v) : + (out Γ.origin v).card=2 := by + change degree Γ Finset.univ v=2 + exact Classical.not_not.mp (fun h => hv (Or.inl h)) + +lemma marked_dart_bound (M : Finset V) : + (Finset.univ.filter (fun d => marks Γ M (Γ.origin d))).card ≤ + (Finset.univ.filter (fun d => 3≤degree Γ Finset.univ (Γ.origin d))).card + + (Finset.univ.filter (fun v => degree Γ Finset.univ v=1)).card + 2*M.card := by + rw [← fiber_count Γ Finset.univ (marks Γ M)] + calc (∑ v, if marks Γ M v then degree Γ Finset.univ v else 0) ≤ + ∑ v, ((if 3≤degree Γ Finset.univ v then degree Γ Finset.univ v else 0) + + (if degree Γ Finset.univ v=1 then 1 else 0) + (if v∈M then 2 else 0)) := by + apply Finset.sum_le_sum + intro v _ + by_cases hb : 3 ≤ degree Γ Finset.univ v <;> + by_cases hl : degree Γ Finset.univ v = 1 <;> + by_cases hm : v ∈ M <;> + simp_all [marks] <;> split_ifs <;> omega + _ = (Finset.univ.filter (fun d => 3≤degree Γ Finset.univ (Γ.origin d))).card + + (Finset.univ.filter (fun v => degree Γ Finset.univ v=1)).card + 2*M.card := by + rw [Finset.sum_add_distrib,Finset.sum_add_distrib,fiber_count] + simp [Finset.sum_ite_mem,Nat.mul_comm] + +omit [Fintype V] in +lemma chain_dart_card (M : Finset V) : + Fintype.card {d : D // turn Γ.origin (marks Γ M) (marks_degree_two Γ M) d=d} = + (Finset.univ.filter (fun d => marks Γ M (Γ.origin d))).card := by + rw [Fintype.card_subtype] + congr 1 + ext d + simp only [Finset.mem_filter,Finset.mem_univ,true_and,turn_fixed_iff] + +/-- Uniformly bounded many marked chains of the actual image, before choosing +any label assignments. The bound depends only on C and K. -/ +theorem bounded_marked_chains (C : ℝ) (hC : 0≤C) (K : ℕ) : + ∃ R : ℕ, ∀ {V D : Type} [Fintype V] [Fintype D] (Γ : PortGraph V D) + (L : ℝ) (_ : 0 (1:ℝ))) c) + (_ : (Finset.univ.filter (fun v => degree Γ Finset.univ v=1)).card≤2) + (M : Finset V) (_ : M.card≤2*K), + Fintype.card {d : D // turn Γ.origin (marks Γ M) (marks_degree_two Γ M) d=d}≤R := by + obtain ⟨R,hR⟩ := bounded_image_branches C hC 2 + refine ⟨R+2+4*K,?_⟩ + intro V D _ _ Γ L hL hsize hg hleaves M hM + rw [chain_dart_card] + have hb := marked_dart_bound Γ M + have hr := hR Γ L hL hsize hg hleaves + omega + +end TorsionFreeZeroDivisors.MarkedChainBound + +namespace TorsionFreeZeroDivisors.ChainPaths +open Function PortSubdivision ChainSuppression DegreeTwoSuppression +open WeightedMoore WeightedPortMoore SuppressedMoore ActualMarkedChains +open scoped Classical +variable {V D : Type*} [Fintype D] (Γ : PortGraph V D) + (mark : V → Prop) (h2 : ∀ v, ¬mark v → (DegreeTwoSuppression.out Γ.origin v).card=2) +local notation "τ" => turn Γ.origin mark h2 +local notation "F" => next Γ.reverse τ +local notation "B" => {d : D // τ d=d} +local notation "len" => chainLength Γ mark h2 + +/-- The literal nonempty word of original darts in one oriented marked chain. -/ +def word (d : B) : List D := outWord (iterChain F (len d-1) d.val) + +omit [Fintype D] in +lemma outWord_length {k : ℕ} (p : Chain D k) : (outWord p).length=k+1 := by + induction k with + | zero => rfl + | succ k ih => simpa only [outWord,List.length_cons,Nat.succ_eq_add_one,Nat.add_right_cancel_iff] using ih p.2 + +omit [Fintype D] in +lemma outWord_last {k : ℕ} (p : Chain D k) : (outWord p).getLast?=some (last p) := by + induction k with + | zero => rfl + | succ k ih => + change (p.1 :: outWord p.2).getLast? = some (last p.2) + simp only [List.getLast?_cons,ih,Option.getD_some] + +lemma word_length (d : B) : (word Γ mark h2 d).length=len d := by + rw [word,outWord_length] + have h := chainLength_pos Γ mark h2 d + omega + +lemma word_end (d : B) : ∀ e∈(word Γ mark h2 d).getLast?, mark (Γ.origin (Γ.reverse e)) := by + intro e he + rw [word,outWord_last] at he + have he' : last (iterChain F (len d-1) d.val)=e := by simpa using he + rw [←he',chain_last] + exact (turn_fixed_iff Γ.origin mark h2 _).mp ((suppressed Γ mark h2).reverse d).property + +/-- A reduced path cannot stop before the end of its current marked chain: +its prescribed last vertex is marked, while all interior chain vertices are not. -/ +lemma iter_chain_prefix (n : ℕ) (x : D) (p : List D) + (hp : p.IsChain (PortWalk.step Γ.origin Γ.reverse)) (hh : p.head?=some x) + (ht : ∀ d∈p.getLast?, mark (Γ.origin (Γ.reverse d))) + (hn : ∀ i : ℕ, 0 < i → i ≤ n → ¬mark (Γ.origin (F^[i] x))) : + outWord (iterChain F n x) <+: p := by + induction n generalizing x p with + | zero => + cases p with + | nil => simp at hh + | cons a p => + have ha : a=x := Option.some.inj hh + subst a + exact ⟨p,rfl⟩ + | succ n ih => + cases p with + | nil => simp at hh + | cons a p => + have ha : a=x := Option.some.inj hh + subst a + cases p with + | nil => + have ht' := ht x (by simp) + have hu := hn 1 (by omega) (by omega) + apply False.elim + apply hu + simpa only [iterate_one,next,comp_apply,turn_origin] using ht' + | cons y p => + have hst := (List.isChain_cons_cons.mp hp).1 + have hy : ¬mark (Γ.origin y) := by + have ho : Γ.origin (F x)=Γ.origin y := by + exact (turn_origin Γ.origin mark h2 (Γ.reverse x)).trans hst.1 + have hu := hn 1 (by omega) (by omega) + simpa only [iterate_one,ho] using hu + have he : F x=y := forced_turn Γ mark h2 hst hy + have htt : ∀ d∈(y::p).getLast?, mark (Γ.origin (Γ.reverse d)) := by + simpa only [List.getLast?_cons_cons] using ht + have hnn : ∀ i : ℕ, 0 < i → i ≤ n → ¬mark (Γ.origin (F^[i] y)) := by + intro i hi hin + have h := hn (i+1) (by omega) (by omega) + simpa only [iterate_succ_apply,he] using h + obtain ⟨q,hq⟩ := ih y (y::p) hp.tail rfl htt hnn + refine ⟨q,?_⟩ + change x :: (outWord (iterChain F n (F x)) ++ q) = x :: y :: p + rw [he,hq] + +lemma word_prefix (d : B) (p : List D) + (hp : p.IsChain (PortWalk.step Γ.origin Γ.reverse)) (hh : p.head?=some d.val) + (ht : ∀ e∈p.getLast?, mark (Γ.origin (Γ.reverse e))) : word Γ mark h2 d <+: p := by + apply iter_chain_prefix Γ mark h2 (len d-1) d.val p hp hh ht + intro i hi hil + rw [←turn_fixed_iff Γ.origin mark h2] + apply no_internal_mark Γ.reverse τ Γ.reverse_reverse (turn_involutive Γ.origin mark h2) + d.val d.property hi + have h := chainLength_pos Γ mark h2 d + change i exact ⟨[],rfl⟩ + | cons a p => + let d : B := ⟨a, turn_of_mark Γ.origin mark h2 a (hs a (by simp))⟩ + obtain ⟨r,hr⟩ := word_prefix Γ mark h2 d (a::p) hp rfl ht + have hparts := List.isChain_append.mp (hr.symm ▸ hp) + have hsr : ∀ b∈r.head?, mark (Γ.origin b) := by + intro b hb + let e := last (iterChain F (len d-1) d.val) + have he : e∈(word Γ mark h2 d).getLast? := by + rw [word,outWord_last] + exact rfl + have hstep := hparts.2.2 e he b hb + exact hstep.1 ▸ word_end Γ mark h2 d e he + have htr : ∀ b∈r.getLast?, mark (Γ.origin (Γ.reverse b)) := by + intro b hb + have hrne : r≠[] := by intro he; simp [he] at hb + apply ht b + rw [←hr,List.getLast?_append_of_ne_nil _ hrne] + exact hb + have hlen : r.length < (a::p).length := by + have h := congrArg List.length hr + simp only [List.length_append,word_length] at h + have hd := chainLength_pos Γ mark h2 d + omega + obtain ⟨ds,hds⟩ := path_decomposes r hparts.2.1 hsr htr + refine ⟨d::ds,?_⟩ + simpa only [List.flatMap_cons,hds] using hr +termination_by p.length + +omit [Fintype D] in +/-- Enumerating a chain lists precisely the forward iterates before its first mark. -/ +lemma outWord_iterChain (f : D → D) (n : ℕ) (x : D) : + outWord (iterChain f n x) = (List.range (n+1)).map (fun i => f^[i] x) := by + induction n generalizing x with + | zero => simp [iterChain,outWord] + | succ n ih => + rw [List.range_succ_eq_map] + simp only [iterChain,outWord,ih,List.map_cons,List.map_map,iterate_zero,id_eq] + congr 1 + +lemma word_eq_range (d : B) : + word Γ mark h2 d = (List.range (len d)).map (fun i => F^[i] d.val) := by + rw [word,outWord_iterChain] + have h := chainLength_pos Γ mark h2 d + congr 2 + omega + +lemma mem_word_iff (d : B) (x : D) : + x∈word Γ mark h2 d ↔ ∃ i : Fin (len d), F^[i.val] d.val=x := by + rw [word_eq_range,List.mem_map] + constructor + · rintro ⟨i,hi,hx⟩ + exact ⟨⟨i,List.mem_range.mp hi⟩,hx⟩ + · rintro ⟨i,hx⟩ + exact ⟨i.val,List.mem_range.mpr i.isLt,hx⟩ + +lemma word_nodup (d : B) : (word Γ mark h2 d).Nodup := by + rw [word_eq_range] + apply List.Nodup.map_on ?_ List.nodup_range + intro i hi j hj he + have h := chain_dart_injective Γ.reverse τ Γ.reverse_reverse + (turn_involutive Γ.origin mark h2) + (a₁ := ⟨d,⟨i,List.mem_range.mp hi⟩⟩) + (a₂ := ⟨d,⟨j,List.mem_range.mp hj⟩⟩) he + exact congrArg (fun p => p.2.val) h + +lemma words_disjoint {d e : B} (hne : d≠e) : + List.Disjoint (word Γ mark h2 d) (word Γ mark h2 e) := by + intro x hx hy + obtain ⟨i,hi⟩ := (mem_word_iff Γ mark h2 d x).mp hx + obtain ⟨j,hj⟩ := (mem_word_iff Γ mark h2 e x).mp hy + have h := chain_dart_injective Γ.reverse τ Γ.reverse_reverse + (turn_involutive Γ.origin mark h2) (a₁ := ⟨d,i⟩) (a₂ := ⟨e,j⟩) (hi.trans hj.symm) + exact hne (congrArg Sigma.fst h) + +lemma count_word (d e : B) (x : D) (hx : x∈word Γ mark h2 d) : + (word Γ mark h2 e).count x = if e=d then 1 else 0 := by + by_cases he : e=d + · subst e + simpa using List.count_eq_one_of_mem (word_nodup Γ mark h2 d) hx + · have hnot : x∉word Γ mark h2 e := by + intro hy + exact words_disjoint Γ mark h2 he hy hx + simp [he,List.count_eq_zero.mpr hnot] + +/-- Every directed edge in one chain has the same traversal multiplicity, +namely the number of occurrences of that oriented chain in the decomposition. -/ +lemma multiplicity_constant (ds : List B) (d : B) (x : D) + (hx : x∈word Γ mark h2 d) : + (ds.flatMap (word Γ mark h2)).count x = ds.count d := by + induction ds with + | nil => rfl + | cons e ds ih => + simp only [List.flatMap_cons,List.count_append,count_word Γ mark h2 d e x hx,ih] + by_cases he : e=d <;> simp [he,Nat.add_comm] + +end TorsionFreeZeroDivisors.ChainPaths + +end + +end OAI diff --git a/lean/OAI/Algebra/GroupRing/ChainUsage.lean b/lean/OAI/Algebra/GroupRing/ChainUsage.lean new file mode 100644 index 0000000000000000000000000000000000000000..5a485d43ae7b4efef61f2fec4841f3aadc8a95c9 --- /dev/null +++ b/lean/OAI/Algebra/GroupRing/ChainUsage.lean @@ -0,0 +1,398 @@ +import Mathlib +import OAI.Algebra.GroupRing.PatternTotalCoding + +namespace OAI + +noncomputable section + +namespace TorsionFreeZeroDivisors.ChainUsage +open scoped Classical BigOperators +open PortSubdivision DegreeTwoSuppression ChainSuppression SuppressedMoore ChainPaths +open ChainIsomorphism ChainChunkTransport ChainMultiplicity +variable {V D P : Type} [Fintype D] [Fintype P] (Γ : PortGraph V D) + (mark : V → Prop) (h2 : ∀ v,¬mark v → (out Γ.origin v).card=2) +local notation "B" => {d : D // turn Γ.origin mark h2 d=d} +local notation "S" => suppressed Γ mark h2 +local notation "R" => Rep Γ mark h2 +local notation "w" => word Γ mark h2 +variable (paths : P → List {d : D // turn Γ.origin mark h2 d=d}) +local notation "col" => color Γ mark h2 paths +local notation "m" => ChunkComparisons.multiplicity col + +def Used : Prop := ∀ d,∃ p,d∈(paths p).flatMap w ∨ Γ.reverse d∈(paths p).flatMap w + +omit [Fintype P] in +lemma representative_used (hu : Used Γ mark h2 paths) (c : R) : + ∃ p b,b∈paths p ∧ representative Γ mark h2 b=c := by + obtain ⟨p,hp⟩ := hu c.val.val + rcases hp with hp|hp + · obtain ⟨b,hb,he⟩ := List.mem_flatMap.mp hp + have heq := same_word Γ mark h2 he (start_mem_word Γ mark h2 c.val) + exact ⟨p,b,hb,heq ▸ representative_val Γ mark h2 c⟩ + · obtain ⟨b,hb,he⟩ := List.mem_flatMap.mp hp + have heq := same_word Γ mark h2 he + (reverse_mem_word Γ mark h2 c.val c.val.val (start_mem_word Γ mark h2 c.val)) + exact ⟨p,b,hb,by rw [heq,representative_reverse,representative_val]⟩ + +lemma multiplicity_pos (hu : Used Γ mark h2 paths) (c : R) : 1 ≤ m c := by + simp only [ChunkComparisons.multiplicity,Fintype.card_eq_nat_card] + obtain ⟨p,b,hb,he⟩ := representative_used Γ mark h2 paths hu c + obtain ⟨i,hi⟩ := List.mem_iff_get.mp hb + have hn : Nonempty {t // col t=c} := by + refine ⟨⟨⟨p,i⟩,?_⟩⟩ + change representative Γ mark h2 ((paths p).get i)=c + rw [hi,he] + exact Nat.card_pos + +lemma traversal_card : Fintype.card (RepeatedBlocks.Traversal m)=∑p,(paths p).length := by + rw [Fintype.card_congr (ChunkComparisons.enumeration col)] + simp only [FiniteChunking.Traversal,chunks] + exact (Fintype.card_sigma (α:=fun p : P => Fin (paths p).length)).trans (Finset.sum_congr rfl (fun p _ => Fintype.card_fin _)) + +lemma multiplicity_le (c : R) : m c≤∑p,(paths p).length := by + simp only [ChunkComparisons.multiplicity,Fintype.card_eq_nat_card] + have h := Nat.card_le_card_of_injective (Subtype.val : {t // col t=c} → _) + Subtype.val_injective + simpa only [FiniteChunking.Traversal,chunks,Nat.card_sigma,Nat.card_fin] using h + +omit [Fintype D] [Fintype P] in +lemma flatMap_length_le {A Z : Type*} (f : A → List Z) (l : List A) {a : A} (ha : a∈l) : + (f a).length≤(l.flatMap f).length := by + induction l with + | nil => simp at ha + | cons b l ih => + rcases List.mem_cons.mp ha with rfl|ha + · simp only [List.flatMap_cons,List.length_append] + omega + · have h := ih ha + simp only [List.flatMap_cons,List.length_append] + omega + +lemma length_le_total_of_mem (p : P) (b : B) (hb : b∈paths p) : + chainLength Γ mark h2 b≤∑p,((paths p).flatMap w).length := by + rw [←word_length] + exact (flatMap_length_le w _ hb).trans + (Finset.single_le_sum (f:=fun p => ((paths p).flatMap w).length) + (fun _ _ => Nat.zero_le _) (Finset.mem_univ p)) + +lemma chain_length_le (hu : Used Γ mark h2 paths) (b : B) : + chainLength Γ mark h2 b≤∑p,((paths p).flatMap w).length := by + obtain ⟨p,a,ha,he⟩ := representative_used Γ mark h2 paths hu (representative Γ mark h2 b) + have h := length_le_total_of_mem Γ mark h2 paths p a ha + rw [oriented_length Γ mark h2 a,he,←oriented_length Γ mark h2 b] at h + exact h + +lemma rep_card_le : Fintype.card R≤Fintype.card B := Fintype.card_subtype_le _ + +end TorsionFreeZeroDivisors.ChainUsage + +namespace TorsionFreeZeroDivisors.SourcePattern +open scoped Classical BigOperators +open PortSubdivision MarkedChainBound DegreeTwoSuppression ChainSuppression SuppressedMoore ChainPaths +open ChainIsomorphism ChainChunkTransport ChunkComparisons FiniteChunking ComparedBlocks +open ActualComplexity CoreStripping ImageComplexity GirthAsymptotics TypedGraphs + +/-- The uniformly bounded number of marked darts is derived, not required of an +original pattern. Extra marks are just the prescribed path endpoints. -/ +theorem marked_bound (B K : ℕ) : ∃ R : ℕ,0 (1:ℝ))) c), + Fintype.card {d : D // turn Γ.origin (marks Γ M) (marks_degree_two Γ M) d=d}≤R ∧ + Fintype.card (Mark (marks Γ M))≤R := by + obtain ⟨R,hR⟩ := bounded_image_branches (B:ℝ) (Nat.cast_nonneg _) (2*K) + refine ⟨R+6*K+1,by omega,?_⟩ + intro V D P _ _ _ Γ M hM paths hp hP hv hc hi L hL hH hg + have hleaf := leaf_bound Γ paths hp hc hi + have hdc := dart_count Γ paths hi + have hdc' : (Fintype.card D:ℝ)≤2*(B:ℝ)*L := by + have hdc' : (Fintype.card D:ℝ)≤2*(∑ p,(paths p).length:ℕ) := by exact_mod_cast hdc + nlinarith + have hleaf' : (Finset.univ.filter (fun v => degree Γ Finset.univ v=1)).card≤2*K := + hleaf.trans (Nat.mul_le_mul_left _ hP) + have hb := hR Γ L hL hdc' hg hleaf' + have hd := marked_dart_bound Γ M + have hseed : Fintype.card {d : D // + turn Γ.origin (marks Γ M) (marks_degree_two Γ M) d=d}≤R+6*K+1 := by + rw [chain_dart_card] + omega + exact ⟨hseed,(marked_vertices_le Γ _ _ hv).trans hseed⟩ + +abbrev Seeds {V D : Type} [Fintype D] (Γ : PortGraph V D) (M : Finset V) := + {d : D // turn Γ.origin (marks Γ M) (marks_degree_two Γ M) d=d} + +def R (B K : ℕ) : ℕ := (marked_bound B K).choose +lemma R_pos (B K : ℕ) : 0 (1:ℝ))) c + length_le : (∑p,((paths p).flatMap (word graph (marks graph vertices) (marks_degree_two graph vertices))).length:ℕ)≤B*L (size rep) + length_ge : L (size rep)≤(∑p,((paths p).flatMap (word graph (marks graph vertices) (marks_degree_two graph vertices))).length:ℕ) + comparisons : Comparisons (E:=E) (pathLength (chunks graph (marks graph vertices) (marks_degree_two graph vertices) paths) + (chunkLength graph (marks graph vertices) (marks_degree_two graph vertices) paths)) + lower : E → ℕ + upper : E → ℕ + lower_eq : ∀ e,comparisons.lo e=lower e + upper_eq : ∀ e,comparisons.hi e=upper e + lower_le : ∀ e,lower e≤upper e + upper_le : ∀ e,upper e≤pathLength (chunks graph (marks graph vertices) (marks_degree_two graph vertices) paths) + (chunkLength graph (marks graph vertices) (marks_degree_two graph vertices) paths) (comparisons.source e) + reduced : ∀ x e,comparisons.side x=some e → + originalDart graph (marks graph vertices) (marks_degree_two graph vertices) paths x≠ + originalDart graph (marks graph vertices) (marks_degree_two graph vertices) paths (comparisons.pairing.partner x) ∧ + originalDart graph (marks graph vertices) (marks_degree_two graph vertices) paths x≠graph.reverse + (originalDart graph (marks graph vertices) (marks_degree_two graph vertices) paths (comparisons.pairing.partner x)) + unpaired_le : ((Finset.univ.filter (fun x => comparisons.pairing.partner x=x)).card:ℝ)≤ + StageFusion.epsilon (1/600) 256* + (∑p,((paths p).flatMap (word graph (marks graph vertices) (marks_degree_two graph vertices))).length:ℕ) + +attribute [instance] Data.fV Data.fD Data.fP Data.fE + +namespace Data +variable {B K I rep : ℕ} (a : Data B K I rep) +abbrev mark := marks a.graph a.vertices +abbrev degree_two := marks_degree_two a.graph a.vertices +abbrev words (p : a.P) := (a.paths p).flatMap (word a.graph a.mark a.degree_two) +abbrev totalLength : ℕ := ∑p,(a.words p).length +abbrev lengths : a.P → ℕ := pathLength (chunks a.graph a.mark a.degree_two a.paths) + (chunkLength a.graph a.mark a.degree_two a.paths) + +lemma words_nonempty (p : a.P) : a.words p≠[] := by + intro he + obtain ⟨b,hb⟩ := List.exists_mem_of_ne_nil (a.paths p) (a.nonempty p) + have hm : b.val∈a.words p := by + apply List.mem_flatMap.mpr + exact ⟨b,hb,start_mem_word a.graph a.mark a.degree_two b⟩ + simp [he] at hm + +lemma lengths_le (p : a.P) : a.lengths p≤B*L (size rep) := by + rw [lengths,pathLength_eq] + apply le_trans (b:=a.totalLength) _ a.length_le + exact Finset.single_le_sum (f:=fun p => (a.words p).length) + (fun _ _ => Nat.zero_le _) (Finset.mem_univ p) + +lemma upper_bound (e : a.E) : a.upper e≤B*L (size rep) := + (a.upper_le e).trans (a.lengths_le _) + +lemma lower_bound (e : a.E) : a.lower e≤B*L (size rep) := + (a.lower_le e).trans (a.upper_bound e) + +lemma covered : ∀ d,ChainCoverage.Covered a.graph.reverse (turn a.graph.origin a.mark a.degree_two) + a.graph.reverse_reverse (turn_involutive a.graph.origin a.mark a.degree_two) d := by + apply ActualMarkedChains.actual_image_covered a.graph a.mark a.degree_two a.words a.path_chain _ a.image + intro p d hd + rw [words,ChainPathTransport.flatMap_head] at hd + obtain ⟨b,_hb,hbd⟩ := Option.mem_map.mp hd + subst d + exact (turn_fixed_iff a.graph.origin a.mark a.degree_two b.val).mp b.property + +lemma mark_bounds (hL : 0 (a.paths p).length) + (fun _ _ => Nat.zero_le _) (Finset.mem_univ p)).trans (a.total_traversals_le hL) + +lemma offset_bounds (e : a.E) : + -(2*(B*L (size rep):ℕ):ℤ)≤a.comparisons.offset e ∧ + a.comparisons.offset e≤(2*(B*L (size rep):ℕ):ℤ) := by + have hlo : (0:ℝ)≤a.comparisons.lo e := by rw [a.lower_eq]; positivity + have hhi : (0:ℝ)≤a.comparisons.hi e := by rw [a.upper_eq]; positivity + have hlb : a.comparisons.lo e≤(B*L (size rep):ℕ) := by + rw [a.lower_eq]; exact_mod_cast a.lower_bound e + have hub : a.comparisons.hi e≤(B*L (size rep):ℕ) := by + rw [a.upper_eq]; exact_mod_cast a.upper_bound e + have hlen : (a.lengths (a.comparisons.source (a.comparisons.flip e)):ℝ)≤(B*L (size rep):ℕ) := + by exact_mod_cast a.lengths_le _ + have hr := a.comparisons.target_range e + have he : -2*((B*L (size rep):ℕ):ℝ)≤(a.comparisons.offset e:ℝ) ∧ + (a.comparisons.offset e:ℝ)≤2*((B*L (size rep):ℕ):ℝ) := by + cases hh : a.comparisons.reverse e <;> simp only [hh,Bool.false_eq_true,↓reduceIte] at hr + · constructor <;> linarith + · constructor <;> linarith + exact_mod_cast he + +def bounded (hL : 0 (c:ℝ)*(B*L (size rep)+1:ℕ)^d* + Real.exp (-(L (size rep):ℝ)/(4800*M))) atTop (𝓝 0) := by + have hL : Tendsto (fun rep => (L (size rep):ℝ)) atTop atTop := + tendsto_natCast_atTop_atTop.comp (L_tendsto.comp size_tendsto) + have ht := (tendsto_rpow_mul_exp_neg_mul_atTop_nhds_zero (d:ℝ) + (1/(4800*M)) (by positivity)).comp hL + simp only [Function.comp_def,Real.rpow_natCast] at ht + have ht' := ht.const_mul ((c:ℝ)*(B+1:ℝ)^d) + simp only [mul_zero] at ht' + apply squeeze_zero' (Eventually.of_forall (fun _ => by positivity)) _ ht' + filter_upwards [hL.eventually (eventually_ge_atTop (1:ℝ))] with rep hr + have hp : ((B*L (size rep)+1:ℕ):ℝ)^d≤((B+1:ℝ)*(L (size rep):ℝ))^d := by + gcongr + push_cast + nlinarith + calc + _ ≤ (c:ℝ)*((B+1:ℝ)*(L (size rep):ℝ))^d* + Real.exp (-(L (size rep):ℝ)/(4800*M)) := by gcongr + _ = (c:ℝ)*(B+1:ℝ)^d*((L (size rep):ℝ)^d* + Real.exp (-(1/(4800*M:ℝ))*(L (size rep):ℝ))) := by + have he : -(L (size rep):ℝ)/(4800*M)=-(1/(4800*M:ℝ))*(L (size rep):ℝ) := by ring + rw [he,mul_pow] + ring + +lemma mem_samples (rep : ℕ) (r : Match rep) : r∈samples rep ↔ + (r.1.Contains ∅ ∧ ((3*L (size rep):ℕ):ℕ∞)≤(r.1.graph (PatternEmbeddings.origin (@Types.outgoingA rep))).subdivision.egirth) ∧ + (r.2.Contains ∅ ∧ ((3*L (size rep):ℕ):ℕ∞)≤(r.2.graph (PatternEmbeddings.origin (@Types.outgoingB rep))).subdivision.egirth) := by + simp only [samples,ConditionedMatchings.Matching.conditioned,Finset.mem_product, + Finset.mem_filter,Finset.mem_univ,true_and] + +lemma samples_eventually_nonempty : ∀ᶠ rep in atTop,(samples rep).Nonempty := by + filter_upwards [TypedGraphs.eventual_nonempty] with rep hr + obtain ⟨a,ha⟩ := hr.1 + obtain ⟨b,hb⟩ := hr.2 + simp only [ConditionedMatchings.Matching.conditioned, Finset.mem_filter, + Finset.mem_univ, true_and] at ha hb + refine ⟨(a,b),(mem_samples rep (a,b)).mpr ?_⟩ + exact ⟨ha,hb⟩ + +/-- With the bounds fixed beforehand, for every sufficiently large admissible +size there is an actual pair of conditioned matchings avoiding every bounded +pattern. The roots are universally quantified after the size threshold. -/ +theorem eventually_avoids (R K T I B Q M J : ℕ) + (hR : 0 ∃ a : Data R K T I (B*L (size rep)), + a.Good B Q M J rep ∧ a.event rep x y r)=samples rep := by + apply Finset.filter_eq_self.mpr + exact hall + rw [he,div_self (by exact_mod_cast (Finset.card_pos.mpr hs).ne')] at hprob + exact (lt_irrefl (1:ℝ)) hprob + +end TorsionFreeZeroDivisors.BoundedPattern + +end + +end OAI diff --git a/lean/OAI/Algebra/GroupRing/ChunkComparisons.lean b/lean/OAI/Algebra/GroupRing/ChunkComparisons.lean new file mode 100644 index 0000000000000000000000000000000000000000..4ec5455ff1f39c99f558ffe70199e70e72a41f0d --- /dev/null +++ b/lean/OAI/Algebra/GroupRing/ChunkComparisons.lean @@ -0,0 +1,470 @@ +import Mathlib +import OAI.Algebra.GroupRing.ListPassages +import OAI.Algebra.GroupRing.AffineIntervals + +namespace OAI + +noncomputable section + +namespace TorsionFreeZeroDivisors.ChunkComparisons +open scoped Classical +open ComparedBlocks +variable {P T U C : Type*} {lp : P → ℕ} {lt : T → ℕ} + +def positionEquiv (r : U ≃ T) (lu : U → ℕ) (hlen : ∀ u,lu u=lt (r u)) : + Position lu ≃ Position lt := + Equiv.sigmaCongr r (fun u => (Equiv.refl ℤ).subtypeEquiv (by + intro q + change q∈BlockAlignment.positions 0 (lu u) ↔ q∈BlockAlignment.positions 0 (lt (r u)) + rw [hlen])) + +lemma positionEquiv_source (r : U ≃ T) (lu : U → ℕ) (hlen : ∀ u,lu u=lt (r u)) (x : Position lu) : + (positionEquiv r lu hlen x).1=r x.1 := rfl + +lemma positionEquiv_coordinate (r : U ≃ T) (lu : U → ℕ) (hlen : ∀ u,lu u=lt (r u)) (x : Position lu) : + (positionEquiv r lu hlen x).2.val=x.2.val := rfl + +namespace Chunking +/-- Re-enumerating occurrence chunks does not change their geometric partition. -/ +def reindex (K : Chunking lp lt) (r : U ≃ T) (lu : U → ℕ) (hlen : ∀ u,lu u=lt (r u)) : Chunking lp lu where + equiv := (positionEquiv r lu hlen).trans K.equiv + path u := K.path (r u) + reverse u := K.reverse (r u) + offset u := K.offset (r u) + source x := K.source (positionEquiv r lu hlen x) + coordinate x := K.coordinate (positionEquiv r lu hlen x) +end Chunking + +variable [Fintype T] (color : T → C) +def multiplicity (c : C) : ℕ := Fintype.card {t // color t=c} + +/-- Exact color-fibre enumeration, identifying the literal path traversals +with the multiplicity-indexed traversal type used in every stage estimate. -/ +def enumeration : ((c : C) × Fin (multiplicity color c)) ≃ T := + (Equiv.sigmaCongrRight (fun c => (Fintype.equivFin {t // color t=c}).symm)).trans + (Equiv.sigmaFiberEquiv color) + +lemma enumeration_color (o : (c : C) × Fin (multiplicity color c)) : color (enumeration color o)=o.1 := + ((Fintype.equivFin {t // color t=o.1}).symm o.2).property + +lemma enumeration_length (len : C → ℕ) (hl : ∀ t,lt t=len (color t)) + (o : (c : C) × Fin (multiplicity color c)) : len o.1=lt (enumeration color o) := by + rw [hl (enumeration color o),enumeration_color color o] + +/-- The complete finite reindexing into underlying chain and occurrence number. -/ +def repeated (K : Chunking lp lt) (len : C → ℕ) (hl : ∀ t,lt t=len (color t)) : + Chunking lp (fun o : (c : C) × Fin (multiplicity color c) => len o.1) := + K.reindex (enumeration color) _ (enumeration_length color len hl) + +end TorsionFreeZeroDivisors.ChunkComparisons + +namespace TorsionFreeZeroDivisors.ListChunkCoordinates +open scoped Classical BigOperators +open FiniteChunking +variable {A D : Type*} (ds : List A) (word : A → List D) + +abbrev lengths (i : Fin ds.length) : ℕ := (word (ds.get i)).length + +lemma ofFn_lengths : List.ofFn (lengths ds word)=ds.map (fun a => (word a).length) := by + change List.ofFn (fun i : Fin ds.length => (word ds[i.val]).length) = _ + exact List.ofFn_getElem_eq_map ds (fun a => (word a).length) + +lemma total_length : (∑ i,lengths ds word i)=(ds.flatMap word).length := by + rw [← List.sum_ofFn,ofFn_lengths,List.length_flatMap] + +lemma start_eq (i : Fin ds.length) : + start (lengths ds word) i = ((ds.take i.val).flatMap word).length := by + rw [List.length_flatMap,List.map_take,← ofFn_lengths,List.sum_take_ofFn] + simp only [start,before,Fin.lt_def] + +/-- Literal indexing through a list concatenation, including repeated chunks. -/ +lemma get_flatMap (i : Fin ds.length) (q : Fin (lengths ds word i)) : + (ds.flatMap word)[start (lengths ds word) i+q.val]? = some ((word (ds.get i)).get q) := by + rw [start_eq] + have hdec : ds.take i.val ++ ds.get i :: ds.drop (i.val+1)=ds := by + simpa only [List.drop_eq_getElem_cons i.isLt,List.get_eq_getElem] using List.take_append_drop i.val ds + have hflat := congrArg (List.flatMap word) hdec + simp only [List.flatMap_append,List.flatMap_cons] at hflat + calc + _ = (((ds.take i.val).flatMap word) ++ + (word (ds.get i) ++ (ds.drop (i.val+1)).flatMap word))[ + ((ds.take i.val).flatMap word).length+q.val]? := by rw [hflat] + _ = (word (ds.get i) ++ (ds.drop (i.val+1)).flatMap word)[q.val]? := by + rw [List.getElem?_append_right (Nat.le_add_right _ _),Nat.add_sub_cancel_left] + _ = some ((word (ds.get i)).get q) := by + rw [List.getElem?_append_left q.isLt,List.getElem?_eq_getElem q.isLt] + rfl + +end TorsionFreeZeroDivisors.ListChunkCoordinates + +namespace TorsionFreeZeroDivisors.ChainChunkTransport +open Function PortSubdivision ChainSuppression DegreeTwoSuppression SuppressedMoore ChainPaths +open ChainIsomorphism ChunkComparisons FiniteChunking ComparedBlocks +open scoped Classical BigOperators +variable {V D : Type*} [Fintype D] (Γ : PortGraph V D) + (mark : V → Prop) (h2 : ∀ v, ¬mark v → (out Γ.origin v).card=2) +local notation "τ" => turn Γ.origin mark h2 +local notation "F" => next Γ.reverse τ +local notation "B" => {d : D // τ d=d} +local notation "S" => suppressed Γ mark h2 +local notation "len" => chainLength Γ mark h2 +local notation "R" => ChainIsomorphism.Rep Γ mark h2 +local notation "w" => word Γ mark h2 + +def orientation : R × Bool ≃ B := InvolutionOrientation.equiv (S).reverse (S).reverse_reverse (S).reverse_ne + +def representative (b : B) : R := ((orientation Γ mark h2).symm b).1 +def reversed (b : B) : Bool := ((orientation Γ mark h2).symm b).2 + +lemma oriented (b : B) : b=if reversed Γ mark h2 b then (S).reverse (representative Γ mark h2 b).val + else (representative Γ mark h2 b).val := (orientation Γ mark h2).apply_symm_apply b |>.symm + +lemma oriented_length (b : B) : len b=len (representative Γ mark h2 b).val := by + have h := oriented Γ mark h2 b + conv_lhs => rw [h] + split_ifs <;> simp only [chainLength_reverse] + +lemma word_get (b : B) (i : ℕ) (hi : i < len b) : (w b)[i]?=some (F^[i] b.val) := by + simp [word_eq_range,hi] + +lemma reverse_iter (b : B) (i : ℕ) (hi : i < len b) : + F^[len b-i-1] ((S).reverse b).val=Γ.reverse (F^[i] b.val) := by + let k := len b + have hf := endpoint_reverse Γ.reverse τ Γ.reverse_reverse + (turn_involutive Γ.origin mark h2) (x:=b) (i:=k-i) (by change k-i ≤ k; omega) + have he : k-(k-i)=i := by dsimp [k]; omega + have hs : k-i=(k-i-1)+1 := by dsimp [k]; omega + change F^[k-i] ((S).reverse b).val = τ (F^[k-(k-i)] b.val) at hf + rw [he,hs,iterate_succ_apply'] at hf + have h := congrArg τ hf + change τ (τ (Γ.reverse (F^[k-i-1] ((S).reverse b).val))) = τ (τ (F^[i] b.val)) at h + rw [turn_involutive Γ.origin mark h2,turn_involutive Γ.origin mark h2] at h + have hh := congrArg Γ.reverse h + rwa [Γ.reverse_reverse] at hh + +lemma listDart (b : B) (q : ℤ) (hq : q∈BlockAlignment.positions 0 (len b)) : + (w b)[(localIndex (reversed Γ mark h2 b) (len b) q).toNat]? = + some (if reversed Γ mark h2 b then Γ.reverse (F^[q.toNat] (representative Γ mark h2 b).val.val) + else F^[q.toNat] (representative Γ mark h2 b).val.val) := by + have hz : 0 ≤ q ∧ q < len b := by simpa only [AffineIntervals.nat_positions,Finset.mem_Ico] using hq + have hqcast : (q.toNat : ℤ)=q := Int.toNat_of_nonneg hz.1 + have hqn : q.toNat < len b := by omega + have h := oriented Γ mark h2 b + cases hr : reversed Γ mark h2 b + · simp only [hr,Bool.false_eq_true,ite_false] at h ⊢ + simp only [localIndex,BlockAlignment.affine,Bool.false_eq_true,ite_false,add_zero] + rw [word_get Γ mark h2 b q.toNat hqn,show b.val=(representative Γ mark h2 b).val.val from congrArg Subtype.val h] + · simp only [hr,ite_true] at h ⊢ + have he : (localIndex true (len b) q).toNat=len b-q.toNat-1 := by + simp only [localIndex,BlockAlignment.affine,ite_true] + omega + have hi : len b-q.toNat-1 < len b := by omega + rw [he,word_get Γ mark h2 b _ hi] + apply congrArg some + rw [oriented_length Γ mark h2 b,show b.val=((S).reverse (representative Γ mark h2 b).val).val from congrArg Subtype.val h] + apply reverse_iter + rwa [←oriented_length Γ mark h2 b] + +variable {P : Type*} [Fintype P] (paths : P → List {d : D // turn Γ.origin mark h2 d=d}) + +def chunks (p : P) : ℕ := (paths p).length +def chunkLength (p : P) (i : Fin (chunks Γ mark h2 paths p)) : ℕ := (w ((paths p).get i)).length +def chunkReverse (p : P) (i : Fin (chunks Γ mark h2 paths p)) : Bool := reversed Γ mark h2 ((paths p).get i) +def color (t : Traversal (chunks Γ mark h2 paths)) : R := representative Γ mark h2 ((paths t.1).get t.2) + +def splitChunks := FiniteChunking.chunking (chunks Γ mark h2 paths) (chunkLength Γ mark h2 paths) (chunkReverse Γ mark h2 paths) + +omit [Fintype P] in +lemma chunkLength_eq (t : Traversal (chunks Γ mark h2 paths)) : + traversalLength (chunks Γ mark h2 paths) (chunkLength Γ mark h2 paths) t=repLength Γ mark h2 (color Γ mark h2 paths t) := by + exact (word_length Γ mark h2 _).trans (oriented_length Γ mark h2 _) + +omit [Fintype P] in +lemma pathLength_eq (p : P) : + pathLength (chunks Γ mark h2 paths) (chunkLength Γ mark h2 paths) p=((paths p).flatMap w).length := + ListChunkCoordinates.total_length (paths p) w + +/-- The original path's actual dart at the signed chunk image. -/ +lemma chunk_dart (x : Position (traversalLength (chunks Γ mark h2 paths) (chunkLength Γ mark h2 paths))) : + ((paths x.1.1).flatMap w)[((splitChunks Γ mark h2 paths).equiv x).2.val.toNat]? = + some (if (splitChunks Γ mark h2 paths).reverse x.1 then + Γ.reverse (F^[x.2.val.toNat] (color Γ mark h2 paths x.1).val.val) + else F^[x.2.val.toNat] (color Γ mark h2 paths x.1).val.val) := by + let b := (paths x.1.1).get x.1.2 + let q := localIndex (reversed Γ mark h2 b) (len b) x.2.val + have hlen : chunkLength Γ mark h2 paths x.1.1 x.1.2=len b := word_length Γ mark h2 b + have hq : x.2.val∈BlockAlignment.positions 0 (len b) := by + have h := x.2.property + change x.2.val∈BlockAlignment.positions 0 (chunkLength Γ mark h2 paths x.1.1 x.1.2) at h + rwa [hlen] at h + have hqb := local_bounds (reversed Γ mark h2 b) (len b) hq + have hn : q.toNat < chunkLength Γ mark h2 paths x.1.1 x.1.2 := by + rw [hlen] + dsimp [q] + omega + have hflat := ListChunkCoordinates.get_flatMap (paths x.1.1) w x.1.2 ⟨q.toNat,hn⟩ + have him : ((splitChunks Γ mark h2 paths).equiv x).2.val.toNat= + start (chunkLength Γ mark h2 paths x.1.1) x.1.2+q.toNat := by + change (FiniteChunking.image _ _ _ x).2.val.toNat = _ + rw [FiniteChunking.image_val] + change ((start (chunkLength Γ mark h2 paths x.1.1) x.1.2:ℤ)+ + localIndex (reversed Γ mark h2 b) (chunkLength Γ mark h2 paths x.1.1 x.1.2) x.2.val).toNat = _ + rw [hlen] + omega + change ((paths x.1.1).flatMap w)[start (chunkLength Γ mark h2 paths x.1.1) x.1.2+q.toNat]? = + some ((w b).get ⟨q.toNat,hn⟩) at hflat + rw [him,hflat] + have hd := listDart Γ mark h2 b x.2.val hq + rw [List.getElem?_eq_getElem hn] at hd + exact hd + +/-- Literal darts at all original path positions. -/ +def originalDart (x : Position (pathLength (chunks Γ mark h2 paths) (chunkLength Γ mark h2 paths))) : D := + ((paths x.1).flatMap w).get ⟨x.2.val.toNat,by + have hx := x.2.property + have hz : 0≤x.2.val ∧ x.2.val < pathLength (chunks Γ mark h2 paths) (chunkLength Γ mark h2 paths) x.1 := by + simpa only [AffineIntervals.nat_positions,Finset.mem_Ico] using hx + rw [←pathLength_eq Γ mark h2 paths] + omega⟩ + +omit [Fintype P] in +lemma originalDart_get (x : Position (pathLength (chunks Γ mark h2 paths) (chunkLength Γ mark h2 paths))) : + ((paths x.1).flatMap w)[x.2.val.toNat]?=some (originalDart Γ mark h2 paths x) := + List.getElem?_eq_getElem _ + +lemma chunk_original (x : Position (traversalLength (chunks Γ mark h2 paths) (chunkLength Γ mark h2 paths))) : + originalDart Γ mark h2 paths ((splitChunks Γ mark h2 paths).equiv x)= + if (splitChunks Γ mark h2 paths).reverse x.1 then + Γ.reverse (F^[x.2.val.toNat] (color Γ mark h2 paths x.1).val.val) + else F^[x.2.val.toNat] (color Γ mark h2 paths x.1).val.val := by + apply Option.some.inj + rw [←originalDart_get] + exact chunk_dart Γ mark h2 paths x + +def repeatedChunks := ChunkComparisons.repeated (color Γ mark h2 paths) + (splitChunks Γ mark h2 paths) (repLength Γ mark h2) (chunkLength_eq Γ mark h2 paths) + +lemma repeated_original (x : Position (fun o : (c : R) × Fin (multiplicity (color Γ mark h2 paths) c) => repLength Γ mark h2 o.1)) : + originalDart Γ mark h2 paths ((repeatedChunks Γ mark h2 paths).equiv x)= + if (repeatedChunks Γ mark h2 paths).reverse x.1 then + Γ.reverse (F^[x.2.val.toNat] x.1.1.val.val) + else F^[x.2.val.toNat] x.1.1.val.val := by + unfold repeatedChunks ChunkComparisons.repeated Chunking.reindex + change originalDart Γ mark h2 paths ((splitChunks Γ mark h2 paths).equiv _)=_ + rw [chunk_original] + simp only [positionEquiv_source,positionEquiv_coordinate,enumeration_color] + +omit [Fintype D] in +lemma signed_eq_or_reverse (r s : Bool) (d : D) : + (if r then Γ.reverse d else d) = (if s then Γ.reverse d else d) ∨ + (if r then Γ.reverse d else d) = Γ.reverse (if s then Γ.reverse d else d) := by + cases r <;> cases s <;> simp + +variable {E : Type*} + (cmp : Comparisons (E:=E) (pathLength (chunks Γ mark h2 paths) (chunkLength Γ mark h2 paths))) + (lo hi : E → ℤ) (hlo : ∀ e,cmp.lo e=(lo e:ℝ)) (hhi : ∀ e,cmp.hi e=(hi e:ℝ)) + +/-- Reduction survives signed normalization: neither orientation of an actual +paired undirected edge can become the same chain-coordinate position. -/ +lemma normalized_reduced + (hred : ∀ x e,cmp.side x=some e → + originalDart Γ mark h2 paths x≠originalDart Γ mark h2 paths (cmp.pairing.partner x) ∧ + originalDart Γ mark h2 paths x≠Γ.reverse (originalDart Γ mark h2 paths (cmp.pairing.partner x))) : + ∀ x a,((repeatedChunks Γ mark h2 paths).comparisons cmp lo hi hlo hhi).side x=some a → + (x.1.1,x.2.val)≠ + ((((repeatedChunks Γ mark h2 paths).comparisons cmp lo hi hlo hhi).pairing.partner x).1.1, + (((repeatedChunks Γ mark h2 paths).comparisons cmp lo hi hlo hhi).pairing.partner x).2.val) := by + intro x a ha heq + let K := repeatedChunks Γ mark h2 paths + have he := ((K.side_iff cmp x a.1 a.2.1 a.2.2).mp ha).1 + have hbad := hred (K.equiv x) a.1 he + rw [←K.partner_image, repeated_original, repeated_original] at hbad + have hd : F^[x.2.val.toNat] x.1.1.val.val = + F^[((K.pairing cmp).partner x).2.val.toNat] ((K.pairing cmp).partner x).1.1.val.val := by + have h1 := congrArg Prod.fst heq + have h2 := congrArg Prod.snd heq + change x.1.1=((K.pairing cmp).partner x).1.1 at h1 + change x.2.val=((K.pairing cmp).partner x).2.val at h2 + rw [h1,h2] + rw [hd] at hbad + exact (signed_eq_or_reverse Γ (K.reverse x.1) (K.reverse ((K.pairing cmp).partner x).1) _).elim hbad.1 hbad.2 + +/-- Actual graph labels, including reversal, induce precisely the literal +compatibility constraints used by the repeated-block entropy estimates. -/ +lemma normalized_compatible {A : Type*} (bar : A → A) (hb : Function.Involutive bar) + (label : D → A) (hl : ∀ d,label (Γ.reverse d)=bar (label d)) + (hc : ∀ x e,cmp.side x=some e → label (originalDart Γ mark h2 paths x)= + if cmp.reverse e then bar (label (originalDart Γ mark h2 paths (cmp.pairing.partner x))) + else label (originalDart Γ mark h2 paths (cmp.pairing.partner x))) : + ∀ x a,((repeatedChunks Γ mark h2 paths).comparisons cmp lo hi hlo hhi).side x=some a → + label (F^[x.2.val.toNat] x.1.1.val.val)= + if ((repeatedChunks Γ mark h2 paths).comparisons cmp lo hi hlo hhi).reverse a then + bar (label (F^[(((repeatedChunks Γ mark h2 paths).pairing cmp).partner x).2.val.toNat] + (((repeatedChunks Γ mark h2 paths).pairing cmp).partner x).1.1.val.val)) + else label (F^[(((repeatedChunks Γ mark h2 paths).pairing cmp).partner x).2.val.toNat] + (((repeatedChunks Γ mark h2 paths).pairing cmp).partner x).1.1.val.val) := by + apply (repeatedChunks Γ mark h2 paths).compatible cmp lo hi hlo hhi bar hb + (fun x => label (originalDart Γ mark h2 paths x)) + (fun x => label (F^[x.2.val.toNat] x.1.1.val.val)) _ hc + intro x + rw [repeated_original] + split_ifs <;> simp only [hl] + +/-- A step strictly inside a suppressed chain is an actual reduced graph +passage, with both outgoing ports at precisely the same original vertex. -/ +lemma internal_step (d : B) (i : ℕ) (hi : i+1 < len d) : + Γ.origin (F^[i+1] d.val)=Γ.origin (Γ.reverse (F^[i] d.val)) ∧ + F^[i+1] d.val≠Γ.reverse (F^[i] d.val) := by + constructor + · rw [iterate_succ_apply'] + exact turn_origin Γ.origin mark h2 _ + · intro he + have hn := ChainSuppression.no_internal_mark Γ.reverse τ Γ.reverse_reverse + (turn_involutive Γ.origin mark h2) d.val d.property (by omega : 0 < i+1) hi + apply hn + conv_lhs => rw [iterate_succ_apply'] + change τ (τ (Γ.reverse (F^[i] d.val)))=F^[i+1] d.val + rw [turn_involutive Γ.origin mark h2,he] + +/-- Immersion of the literal labelled graph gives the reduced signed chain +words required by every reflection and squared-word argument. -/ +lemma normalized_immersed {A : Type*} (bar : A → A) (label : D → A) + (hl : ∀ d,label (Γ.reverse d)=bar (label d)) + (hinj : ∀ d e,Γ.origin d=Γ.origin e → label d=label e → d=e) + (c : R) (q : ℤ) (hq : 0≤q) (hq' : q+1 {d : D // turn Γ.origin mark h2 d=d} +local notation "S" => suppressed Γ mark h2 +local notation "R" => ChainIsomorphism.Rep Γ mark h2 + +lemma representative_val (c : R) : representative Γ mark h2 c.val=c := by + change ((orientation Γ mark h2).symm ((orientation Γ mark h2) (c,false))).1=c + rw [Equiv.symm_apply_apply] + +lemma reverse_oriented (b : B) : + (S).reverse b=(orientation Γ mark h2) (representative Γ mark h2 b,!(reversed Γ mark h2 b)) := by + have h := oriented Γ mark h2 b + cases hr : reversed Γ mark h2 b + · simp only [hr,Bool.false_eq_true,ite_false] at h + change (S).reverse b=(S).reverse (representative Γ mark h2 b).val + exact congrArg (S).reverse h + · simp only [hr,ite_true] at h + change (S).reverse b=(representative Γ mark h2 b).val + calc + _ = (S).reverse ((S).reverse (representative Γ mark h2 b).val) := congrArg (S).reverse h + _ = _ := (S).reverse_reverse _ + +lemma representative_reverse (b : B) : representative Γ mark h2 ((S).reverse b)=representative Γ mark h2 b := by + rw [reverse_oriented] + change ((orientation Γ mark h2).symm ((orientation Γ mark h2) _)).1=_ + rw [Equiv.symm_apply_apply] + +lemma unsigned (b : B) : + (if reversed Γ mark h2 b then (S).reverse b else b)=(representative Γ mark h2 b).val := by + have h := oriented Γ mark h2 b + cases hr : reversed Γ mark h2 b + · simpa only [hr,Bool.false_eq_true,ite_false] using h + · simp only [hr,ite_true] at h ⊢ + calc + _ = (S).reverse ((S).reverse (representative Γ mark h2 b).val) := congrArg (S).reverse h + _ = _ := (S).reverse_reverse _ + +lemma signed_representative (b : B) (r : Bool) : + representative Γ mark h2 (if r then (S).reverse b else b)=representative Γ mark h2 b := by + cases r <;> simp only [Bool.false_eq_true,ite_false,ite_true,representative_reverse] + +lemma representative_iff (b : B) (c : R) : + representative Γ mark h2 b=c ↔ b=c.val ∨ b=(S).reverse c.val := by + constructor + · intro h + have hb := oriented Γ mark h2 b + rw [h] at hb + cases hr : reversed Γ mark h2 b + · left; simpa only [hr,Bool.false_eq_true,ite_false] using hb + · right; simpa only [hr,ite_true] using hb + · rintro (rfl|rfl) + · exact representative_val Γ mark h2 c + · rw [representative_reverse,representative_val] + +lemma sign_injective (b : B) : Function.Injective (fun r : Bool => if r then (S).reverse b else b) := by + intro r t h + cases r <;> cases t <;> simp only [Bool.false_eq_true,ite_false,ite_true] at h ⊢ + · exact ((S).reverse_ne b h.symm).elim + · exact ((S).reverse_ne b h).elim + +variable {P : Type*} [Fintype P] + (paths : P → List {d : D // turn Γ.origin mark h2 d=d}) + +local notation "col" => color Γ mark h2 paths +local notation "tp" => Traversal (chunks Γ mark h2 paths) +local notation "e" => ListStageExponents.edge paths + +/-- The incidence fibre used in the Euler-exponent proof is the exact colour +fibre used in the chain/block first moment. Both chain orientations count once. -/ +def incidenceEquiv (c : R) : + {o : (p : P) × (Fin (paths p).length × Bool) // PathIncidences.familyPort (S).reverse e o=c.val} ≃ + {t : tp // col t=c} where + toFun o := ⟨⟨o.val.1,o.val.2.1⟩,by + have h := congrArg (representative Γ mark h2) o.property + change representative Γ mark h2 (if o.val.2.2 then (S).reverse ((paths o.val.1).get o.val.2.1) + else (paths o.val.1).get o.val.2.1)=representative Γ mark h2 c.val at h + rw [signed_representative,representative_val] at h + exact h⟩ + invFun t := ⟨⟨t.val.1,t.val.2,reversed Γ mark h2 ((paths t.val.1).get t.val.2)⟩,by + change (if reversed Γ mark h2 ((paths t.val.1).get t.val.2) then + (S).reverse ((paths t.val.1).get t.val.2) else (paths t.val.1).get t.val.2)=c.val + rw [unsigned] + exact congrArg Subtype.val t.property⟩ + left_inv := by + rintro ⟨⟨p,i,r⟩,ho⟩ + apply Subtype.ext + change (⟨p,i,reversed Γ mark h2 ((paths p).get i)⟩ : (p : P) × (Fin (paths p).length × Bool))=⟨p,i,r⟩ + have hr : reversed Γ mark h2 ((paths p).get i)=r := by + apply sign_injective Γ mark h2 ((paths p).get i) + dsimp only + rw [unsigned] + have h := congrArg (representative Γ mark h2) ho + change representative Γ mark h2 (if r then (S).reverse ((paths p).get i) + else (paths p).get i)=representative Γ mark h2 c.val at h + rw [signed_representative,representative_val] at h + rw [h] + exact ho.symm + rw [hr] + right_inv _ := rfl + +lemma multiplicity_eq (c : R) : + StageSubgraphs.multiplicity (S) e c.val=ChunkComparisons.multiplicity col c := by + classical + unfold StageSubgraphs.multiplicity IncidenceStages.Passages.multiplicity ChunkComparisons.multiplicity + simp only [Fintype.card_eq_nat_card] + exact Nat.card_congr (incidenceEquiv Γ mark h2 paths c) + +lemma multiplicity_at (b : B) : + StageSubgraphs.multiplicity (S) e b= + ChunkComparisons.multiplicity col (representative Γ mark h2 b) := by + have h := oriented Γ mark h2 b + conv_lhs => rw [h] + split_ifs + · rw [StageSubgraphs.multiplicity_reverse,multiplicity_eq] + · exact multiplicity_eq Γ mark h2 paths _ + +end TorsionFreeZeroDivisors.ChainMultiplicity + +end + +end OAI diff --git a/lean/OAI/Algebra/GroupRing/ClosedWords.lean b/lean/OAI/Algebra/GroupRing/ClosedWords.lean new file mode 100644 index 0000000000000000000000000000000000000000..f2481bbd4016032afb16cd2cd24f8b6af5b057a6 --- /dev/null +++ b/lean/OAI/Algebra/GroupRing/ClosedWords.lean @@ -0,0 +1,5499 @@ +import Mathlib +import OAI.Algebra.GroupRing.BalancedPieces + +namespace OAI + +noncomputable section + +namespace TorsionFreeZeroDivisors.SampleGraph.ClosedWords +open scoped Classical BigOperators +open GirthAsymptotics ActualPatternEvent TypedGraphs WeightedMoore +variable {rep : ℕ} {r : Match rep} {x : VA rep} {y : VB rep} + (s : PathSystem rep r x y) (cap : ℕ) (hc : 0 + if (s.paths t).length≤cap then some ⟨t,⟨0,BalancedPieces.number_pos hc⟩⟩ else none +lemma piece_eq (p q : Piece s cap) (h : p.1=q.1) (hp : (s.paths p.1).length≤cap) : p=q := by + rcases p with ⟨t,i⟩ + rcases q with ⟨u,j⟩ + dsimp only at h hp + subst u + have hij : i=j := by + apply Fin.ext + have hi := i.isLt + have hj := j.isLt + simp only [BalancedPieces.number,ite_eq_left hp] at hi hj + omega + cases hij + rfl +lemma root_eq_some (p : Piece s cap) : root s cap hc=some p ↔ s.root=some p.1 ∧ (s.paths p.1).length≤cap := by + cases hr : s.root with + | none => simp [root,hr] + | some t => + by_cases ht : (s.paths t).length≤cap + · simp only [root,hr,Option.bind_some,ite_eq_left ht,Option.some.injEq] + constructor + · intro h + rw [←h] + exact ⟨rfl,ht⟩ + · intro h + exact piece_eq s cap _ p h.1 ht + · simp only [root,hr,Option.bind_some,ite_eq_right ht,Option.some.injEq] + constructor + · intro h; cases h + · intro h; exact False.elim (ht (h.1 ▸ h.2)) +lemma cyclic_iff {T : Type} (root : Option T) (t : T) : + StageRoot.cyclic root t=true ↔ root≠some t := by + simp only [StageRoot.cyclic,decide_eq_true_eq] +lemma cyclic (p : Piece s cap) (hp : StageRoot.cyclic (root s cap hc) p=true) : + ∀ᵉ (a∈(word s cap hc hL hd p).getLast?) (b∈(word s cap hc hL hd p).head?), + PortWalk.step (graph rep r).origin (graph rep r).reverse a b := by + have hp' := (cyclic_iff (root s cap hc) p).mp hp + by_cases hs : (s.paths p.1).length≤cap + · rw [word_short s cap hc hL hd p hs] + apply s.cyclic_chain + apply (cyclic_iff _ _).mpr + intro he + exact hp' ((root_eq_some s cap hc p).mpr ⟨he,hs⟩) + · exact cyclic_of_long s cap hc hL hd p (by omega) +lemma root_start (p : Piece s cap) (hp : root s cap hc=some p) : + (word s cap hc hL hd p).head (nonempty s cap hc hL hd p)=(s.paths p.1).head (s.nonempty p.1) := by + have hs := ((root_eq_some s cap hc p).mp hp).2 + simp only [word_short s cap hc hL hd p hs] +lemma rootA (z : VA rep) (hz : (root s cap hc).map (fun p=>(graph rep r).origin + ((word s cap hc hL hd p).head (nonempty s cap hc hL hd p)))=some (.inl z)) : z=x := by + obtain ⟨p,hp,he⟩ := Option.map_eq_some_iff.mp hz + apply s.rootA z + have hh := (root_eq_some s cap hc p).mp hp + rw [hh.1,Option.map_some] + rw [root_start s cap hc hL hd p hp] at he + exact congrArg some he +lemma rootB (z : VB rep) (hz : (root s cap hc).map (fun p=>(graph rep r).origin + ((word s cap hc hL hd p).head (nonempty s cap hc hL hd p)))=some (.inr z)) : z=y := by + obtain ⟨p,hp,he⟩ := Option.map_eq_some_iff.mp hz + apply s.rootB z + have hh := (root_eq_some s cap hc p).mp hp + rw [hh.1,Option.map_some] + rw [root_start s cap hc hL hd p hp] at he + exact congrArg some he +end TorsionFreeZeroDivisors.SampleGraph.ClosedWords +namespace TorsionFreeZeroDivisors.SingleException +open scoped Classical BigOperators +variable {T : Type} [Fintype T] (root : Option T) (f : T → ℕ) (L : ℕ) +lemma cardinal_charge (h : ∀t,root≠some t → L≤f t) : Fintype.card T*L≤(∑t,f t)+L := by + classical + have hsum : (∑_t : T,L)≤∑t,(f t+if root=some t then L else 0) := by + apply Finset.sum_le_sum + intro t _ + by_cases ht : root=some t + · simp only [ite_eq_left ht]; omega + · simpa only [ite_eq_right ht,Nat.add_zero] using h t ht + rw [Finset.sum_add_distrib] at hsum + have he : (∑t : T,if root=some t then L else 0)≤L := by + cases root with + | none => simp + | some t => simp + simp only [Finset.sum_const,Finset.card_univ,smul_eq_mul] at hsum + omega +lemma two_mass (a b : T) (hab : a≠b) : f a+f b≤∑t,f t := by + classical + have h := Finset.sum_le_sum_of_subset (s:={a,b}) (t:=Finset.univ) (f:=f) (by simp) + simpa only [Finset.sum_pair hab] using h +lemma divide_cast {U L D A H : ℕ} (hU : 0(s.paths t).length) (fun _ _=>Nat.zero_le _) (Finset.mem_univ t)) +include hU hr in +lemma old_lower (p : Piece s (U*L (size rep))) + (hp : root s _ (cap_pos U hcap)≠some p) : + L (size rep)≤BalancedWords.old s.paths (U*L (size rep)) p := by + have hc := cap_pos U hcap + by_cases hs : (s.paths p.1).length≤U*L (size rep) + · have ht : s.root≠some p.1 := fun he=>hp ((root_eq_some s _ hc p).mpr ⟨he,hs⟩) + simp only [BalancedWords.old,BalancedPieces.sizes,ite_eq_left hs] + exact original_girth s hr p.1 ht + · have hh := BalancedPieces.sizes_lower_long hcap (by omega : U*L (size rep)<(s.paths p.1).length) p.2 + change L (size rep)≤BalancedPieces.sizes (s.paths p.1).length (U*L (size rep)) p.2 + nlinarith +include hU hcap hr hordinary in +lemma piece_charge : Fintype.card (Piece s (U*L (size rep)))*L (size rep)≤2*H₀ s := by + have hh := SingleException.cardinal_charge (root s _ (cap_pos U hcap)) (BalancedWords.old s.paths _) (L (size rep)) + (old_lower s U hU hcap hr) + rw [BalancedWords.old_sum s.paths _ (cap_pos U hcap)] at hh + have hH := H₀_ge s hr hordinary + change L (size rep)≤∑t,(s.paths t).length at hH + change _≤2*(∑t,(s.paths t).length) + omega +include hU hr in +lemma lower_word (p : Piece s (U*L (size rep))) + (hp : root s _ (cap_pos U hcap)≠some p) : + L (size rep)≤(word s _ (cap_pos U hcap) hL hd p).length := + (old_lower s U hU hcap hr p hp).trans (old_le_word s _ (cap_pos U hcap) hL hd p) +include hr hordinary in +lemma root_mass (p : Piece s (U*L (size rep))) + (hp : root s _ (cap_pos U hcap)=some p) + (hshort : (word s _ (cap_pos U hcap) hL hd p).length (s.paths t).length) p.1 t hne + rw [word_short s _ (cap_pos U hcap) hL hd p hs.2] at hshort ⊢ + change _≤∑t,(s.paths t).length + omega +include hU in +lemma added_real : (∑p : Piece s (U*L (size rep)),((tail s _ (cap_pos U hcap) hL hd p).length:ℝ))≤ + 3*(D:ℝ)/U*(H₀ s:ℝ) := by + have h := total_added s _ (cap_pos U hcap) hL hd hcap + have hh := SingleException.divide_cast (U:=U) (L:=L (size rep)) (D:=D) + (A:=∑p : Piece s (U*L (size rep)),(tail s _ (cap_pos U hcap) hL hd p).length) + (H:=H₀ s) (by omega) (by omega) h + rw [Nat.cast_sum] at hh + exact hh +end TorsionFreeZeroDivisors.SampleGraph.ClosedWords + +/-! Finite rotation systems. The Euler inequality here +is explicitly an input from a planar realization; no PL realization or planar +separator theorem is asserted by this file. The face cycles and bad-gap count, +however, are computed from the actual boundary and pairing permutations. -/ +namespace TorsionFreeZeroDivisors.PermutationCycles +open scoped Classical BigOperators +variable {O : Type} [Fintype O] (f : Equiv.Perm O) +abbrev Cycle := Quotient (Equiv.Perm.SameCycle.setoid f) +instance : Fintype (Cycle f) := Fintype.ofFinite _ +def cycle (x : O) : Cycle f := Quotient.mk _ x +def members (c : Cycle f) : Finset O := Finset.univ.filter (fun x => cycle f x=c) +@[simp] lemma mem_members {c : Cycle f} {x : O} : x∈members f c ↔ cycle f x=c := by simp [members] +omit [Fintype O] in +lemma cycle_eq {x y : O} : cycle f x=cycle f y ↔ f.SameCycle x y := Quotient.eq +omit [Fintype O] in +@[simp] lemma cycle_apply (x : O) : cycle f (f x)=cycle f x := by + apply (cycle_eq f).mpr + simpa only [Equiv.Perm.sameCycle_apply_left] using Equiv.Perm.SameCycle.refl f x +omit [Fintype O] in +lemma cycle_surjective : Function.Surjective (cycle f) := Quotient.mk_surjective +lemma members_nonempty (c : Cycle f) : (members f c).Nonempty := by + obtain ⟨x,rfl⟩ := cycle_surjective f c + exact ⟨x,(mem_members f).mpr rfl⟩ +lemma mem_of_mem {c : Cycle f} {x : O} (hx : x∈members f c) : f x∈members f c := by + simpa only [mem_members,cycle_apply] using hx +lemma card_one_fixed {x : O} (h : (members f (cycle f x)).card=1) : f x=x := by + obtain ⟨a,ha⟩ := Finset.card_eq_one.mp h + have hx : x∈members f (cycle f x) := (mem_members f).mpr rfl + have hf := mem_of_mem f hx + rw [ha,Finset.mem_singleton] at hx hf + exact hf.trans hx.symm +lemma card_le_two_square {x : O} (h : (members f (cycle f x)).card≤2) : f (f x)=x := by + by_contra hn + have hfx : f x≠x := fun he => hn (by rw [he,he]) + have hff : f (f x)≠f x := fun he => hfx (f.injective he) + have hx : x∈members f (cycle f x) := (mem_members f).mpr rfl + have hs : {x,f x,f (f x)}⊆members f (cycle f x) := by + intro a ha + simp only [Finset.mem_insert,Finset.mem_singleton] at ha + rcases ha with rfl|rfl|rfl + · exact hx + · exact mem_of_mem f hx + · exact mem_of_mem f (mem_of_mem f hx) + have hc := (Finset.card_le_card hs).trans h + have he : ({x,f x,f (f x)} : Finset O).card=3 := by + simp [Ne.symm hfx,Ne.symm hn,Ne.symm hff] + omega + +def fixed : Finset O := Finset.univ.filter (fun x => f x=x) +lemma fixed_le_cycles : (fixed f).card≤Fintype.card (Cycle f) := by + have hi : Function.Injective (fun x : {x // x∈fixed f} => cycle f x.val) := by + intro x y he + apply Subtype.ext + exact ((cycle_eq f).mp he).eq_of_left ((Finset.mem_filter.mp x.property).2) + simpa only [Fintype.card_coe] using Fintype.card_le_of_injective _ hi +lemma singleton_cycles_le_fixed : + (Finset.univ.filter (fun c : Cycle f => (members f c).card=1)).card≤(fixed f).card := by + let pick : {c : Cycle f // (members f c).card=1} → {x // x∈fixed f} := fun c => + ⟨Quotient.out c.val,by + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _,?_⟩ + apply card_one_fixed f + have he : cycle f (Quotient.out c.val)=c.val := Quotient.out_eq c.val + simpa only [he] using c.property⟩ + have hi : Function.Injective pick := by + intro c d he + apply Subtype.ext + have h := congrArg (fun x : {x // x∈fixed f} => cycle f x.val) he + simpa only [pick,cycle,Quotient.out_eq] using h + simpa only [Fintype.card_subtype,Finset.filter_mem_eq_inter,Finset.univ_inter] using Fintype.card_le_of_injective pick hi +lemma sum_card : (∑ c : Cycle f,(members f c).card)=Fintype.card O := by + have h := Finset.card_eq_sum_card_fiberwise (f:=cycle f) + (s:=Finset.univ) (t:=Finset.univ) (fun _ _ => Finset.mem_univ _) + exact h.symm +lemma large_count : + (∑ c∈Finset.univ.filter (fun c : Cycle f => 3≤(members f c).card),(members f c).card)= + (Finset.univ.filter (fun x : O => 3≤(members f (cycle f x)).card)).card := by + calc + _ = (Finset.univ.filter (fun x : O => cycle f x∈Finset.univ.filter + (fun c : Cycle f => 3≤(members f c).card))).card := + Finset.sum_card_fiberwise_eq_card_filter _ _ (cycle f) + _ = _ := by congr 1; ext x; simp + +end TorsionFreeZeroDivisors.PermutationCycles + +namespace TorsionFreeZeroDivisors.PlanarRotation +open scoped Classical BigOperators +open PermutationCycles +lemma excess_identity {C : Type} [Fintype C] (len : C→ℕ) (hp : ∀ c,0 len c=1)).card := by + calc + _ = ∑ c,(len c-2+2) := by simp [Finset.sum_add_distrib,Nat.mul_comm] + _ = ∑ c,(len c+if len c=1 then 1 else 0) := by + apply Finset.sum_congr rfl + intro c _ + have h := hp c + split_ifs <;> omega + _ = _ := by simp only [Finset.sum_add_distrib,Finset.sum_boole,Nat.cast_id] +lemma large_sum_le {C : Type} [Fintype C] (len : C→ℕ) : + (∑ c∈Finset.univ.filter (fun c => 3≤len c),len c)≤3*∑ c,(len c-2) := by + rw [Finset.sum_filter,Finset.mul_sum] + apply Finset.sum_le_sum + intro c _ + split_ifs <;> omega + +variable {O : Type} [Fintype O] (σ α : Equiv.Perm O) +def opposite : Equiv.Perm O := α*σ +/-- An actual distinct-arc digon gap, read solely from the two permutations. -/ +def Good (x : O) : Prop := + opposite σ α (opposite σ α x)=x ∧ opposite σ α x≠x ∧ σ x≠x +def bad : Finset O := Finset.univ.filter (fun x => ¬Good σ α x) +lemma bad_card_bound : + (bad σ α).card≤(fixed (opposite σ α)).card+(fixed σ).card+ + (Finset.univ.filter (fun x => 3≤(members (opposite σ α) (cycle (opposite σ α) x)).card)).card := by + let f := opposite σ α + let large := Finset.univ.filter (fun x => 3≤(members f (cycle f x)).card) + have hs : bad σ α⊆(fixed f∪fixed σ)∪large := by + intro x hx + have hx := (Finset.mem_filter.mp hx).2 + by_cases h1 : f x=x + · exact Finset.mem_union_left _ (Finset.mem_union_left _ (Finset.mem_filter.mpr ⟨Finset.mem_univ _,h1⟩)) + by_cases h2 : σ x=x + · exact Finset.mem_union_left _ (Finset.mem_union_right _ (Finset.mem_filter.mpr ⟨Finset.mem_univ _,h2⟩)) + apply Finset.mem_union_right + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _,?_⟩ + by_contra hn + exact hx ⟨card_le_two_square f (by omega),h1,h2⟩ + exact (Finset.card_le_card hs).trans ((Finset.card_union_le _ _).trans + (Nat.add_le_add_right (Finset.card_union_le _ _) _)) + +/-- The exact `8N` estimate. The planar input is only its explicit Euler +inequality; no comparison-count estimate is assumed. -/ +theorem bad_gaps_le + (heuler : Fintype.card O+4≤2*Fintype.card (Cycle σ)+2*Fintype.card (Cycle (opposite σ α))) + (hmono : (fixed (opposite σ α)).card≤1) : + (bad σ α).card≤8*Fintype.card (Cycle σ) := by + let f := opposite σ α + let P := ∑ c : Cycle f,((members f c).card-2) + let M := (Finset.univ.filter (fun c : Cycle f => (members f c).card=1)).card + have hM : M≤1 := (singleton_cycles_le_fixed f).trans hmono + change (fixed f).card≤1 at hmono + have hP : P+2*Fintype.card (Cycle f)=Fintype.card O+M := by + have h := excess_identity (fun c : Cycle f => (members f c).card) + (fun c => Finset.card_pos.mpr (members_nonempty f c)) + rw [sum_card] at h + exact h + have hl := large_sum_le (fun c : Cycle f => (members f c).card) + rw [large_count] at hl + have hb := bad_card_bound σ α + have hs := fixed_le_cycles σ + change (bad σ α).card≤(fixed f).card+(fixed σ).card+ + (Finset.univ.filter (fun x => 3≤(members f (cycle f x)).card)).card at hb + change (Finset.univ.filter (fun x => 3≤(members f (cycle f x)).card)).card≤3*P at hl + change Fintype.card O+4≤2*Fintype.card (Cycle σ)+2*Fintype.card (Cycle f) at heuler + omega + +omit [Fintype O] in +lemma good_opposite (hr : Function.Involutive α) {x : O} (hx : Good σ α x) : + Good σ α (opposite σ α x) := by + have he : σ (opposite σ α x)=α x := by + have h := congrArg α hx.1 + change α (α (σ (α (σ x))))=α x at h + rw [hr] at h + exact h + refine ⟨congrArg (opposite σ α) hx.1,?_,?_⟩ + · intro h + exact hx.2.1 (h.symm.trans hx.1) + · intro h + rw [he] at h + exact hx.2.2 (α.injective h).symm + +/-- Cut every bad gap and every prescribed marking together with its opposite. -/ +def cuts (marks : Finset O) : Finset O := bad σ α∪marks∪marks.image (opposite σ α) +lemma cardinal_cuts (marks : Finset O) : (cuts σ α marks).card≤(bad σ α).card+2*marks.card := by + have h := (Finset.card_union_le (bad σ α∪marks) (marks.image (opposite σ α))).trans + (Nat.add_le_add (Finset.card_union_le _ _) (Finset.card_image_le)) + unfold cuts + omega +lemma cut_stable (hr : Function.Involutive α) (marks : Finset O) {x : O} (hx : Good σ α x) : + x∈cuts σ α marks ↔ opposite σ α x∈cuts σ α marks := by + have hy := good_opposite σ α hr hx + have image_iff {z : O} (hz : Good σ α z) : + z∈marks.image (opposite σ α) ↔ opposite σ α z∈marks := by + constructor + · intro hm + obtain ⟨w,hw,he⟩ := Finset.mem_image.mp hm + have hwz : w=opposite σ α z := (opposite σ α).injective (he.trans hz.1.symm) + simpa only [hwz] using hw + · intro h + exact Finset.mem_image.mpr ⟨opposite σ α z,h,hz.1⟩ + simp only [cuts,Finset.mem_union,bad,Finset.mem_filter,Finset.mem_univ,true_and, + not_true_eq_false, hx,hy,false_or,image_iff hx,image_iff hy,hx.1] + exact or_comm + +/-- The source's `J ≤ 12N'`, retaining the exact boundary and splitting count. -/ +theorem cuts_le_twelve (marks : Finset O) (pieces : ℕ) + (heuler : Fintype.card O+4≤2*Fintype.card (Cycle σ)+2*Fintype.card (Cycle (opposite σ α))) + (hmono : (fixed (opposite σ α)).card≤1) + (hpieces : Fintype.card (Cycle σ)≤pieces) + (hmarks : marks.card≤Fintype.card (Cycle σ)+pieces) : + (cuts σ α marks).card≤12*pieces := by + have hb := bad_gaps_le σ α heuler hmono + have hc := cardinal_cuts σ α marks + omega +end TorsionFreeZeroDivisors.PlanarRotation +namespace TorsionFreeZeroDivisors.PlanarRuns +open scoped Classical BigOperators +open PlanarRotation +variable {O : Type} + +/-- A finite circular boundary cut at least once in each boundary component. -/ +structure CutSystem (σ : Equiv.Perm O) where + cut : Finset O + hits : ∀ x, ∃ n : ℕ, (σ^n) x∈cut + +namespace CutSystem +variable {σ : Equiv.Perm O} (S : CutSystem σ) +def distance (x : O) : ℕ := Nat.find (S.hits x) +def finish (x : O) : O := (σ^(S.distance x)) x +lemma finish_mem (x : O) : S.finish x∈S.cut := Nat.find_spec (S.hits x) +lemma before {x : O} {i : ℕ} (hi : i hx ((S.zero_iff x).mp h)) + apply Nat.le_antisymm + · apply Nat.find_min' + simpa only [finish,pow_succ,Equiv.Perm.mul_apply] using S.finish_mem (σ x) + · have hm := Nat.find_min' (S.hits (σ x)) (show (σ^(S.distance x-1)) (σ x)∈S.cut from by + rw [← Equiv.Perm.mul_apply,← pow_succ,Nat.sub_add_cancel hp] + exact S.finish_mem x) + change S.distance (σ x)≤S.distance x-1 at hm + omega +lemma finish_next {x : O} (hx : x∉S.cut) : S.finish (σ x)=S.finish x := by + simp only [finish,S.distance_next hx,pow_succ,Equiv.Perm.mul_apply] +lemma finish_surjective : Function.Surjective (fun x => (⟨S.finish x,S.finish_mem x⟩ : {x // x∈S.cut})) := by + intro x + exact ⟨x.val,Subtype.ext (S.finish_cut x.property)⟩ + +lemma distance_iterate (x : O) : ∀ i, i≤S.distance x → + S.distance ((σ^i) x)=S.distance x-i := by + intro i + induction i with + | zero => simp + | succ i ih => + intro hi + have hp := S.before (x:=x) (i:=i) (by omega) + have hn := S.distance_next hp + have hh := ih (by omega) + rw [pow_succ',Equiv.Perm.mul_apply] + omega +lemma finish_iterate (x : O) : ∀ i, i≤S.distance x → S.finish ((σ^i) x)=S.finish x := by + intro i hi + unfold finish + rw [S.distance_iterate x i hi,← Equiv.Perm.mul_apply,← pow_add,Nat.sub_add_cancel hi] + +/-- Every uncut adjacency is a distinct-arc digon, and cuts are stable under +its opposite gap. These are precisely the hypotheses obtained by cutting bad +and marked gaps in `PlanarRotation`. -/ +structure Paired (α : Equiv.Perm O) : Prop where + involutive : Function.Involutive α + fixed_free : ∀ x, α x≠x + good : ∀ x, x∉S.cut → Good σ α x + stable : ∀ x, Good σ α x → (x∈S.cut ↔ opposite σ α x∈S.cut) + +namespace Paired +variable {S} +variable {α : Equiv.Perm O} (P : S.Paired α) +include P +lemma opposite_next {x : O} (hx : x∉S.cut) : σ (α (σ x))=α x := by + have h := congrArg α (P.good x hx).1 + change α (α (σ (α (σ x))))=α x at h + rw [P.involutive] at h + exact h +lemma opposite_uncut {x : O} (hx : x∉S.cut) : α (σ x)∉S.cut := by + exact fun h => hx ((P.stable x (P.good x hx)).mpr h) +lemma finish_opposite {x : O} (hx : x∉S.cut) : S.finish (α (σ x))=S.finish (α x) := by + have h := S.finish_next (P.opposite_uncut hx) + rw [P.opposite_next hx] at h + exact h.symm +lemma finish_pair (x : O) : S.finish (α (S.finish x))=S.finish (α x) := by + generalize hn : S.distance x=n + induction n using Nat.strong_induction_on generalizing x with + | h n ih => + by_cases hx : x∈S.cut + · rw [S.finish_cut hx] + · have hd := S.distance_next hx + have he := ih (S.distance (σ x)) (by omega) (σ x) rfl + rw [S.finish_next hx] at he + exact he.trans (P.finish_opposite hx) + +def pair (_P : S.Paired α) (c : {x // x∈S.cut}) : {x // x∈S.cut} := ⟨S.finish (α c.val),S.finish_mem _⟩ +lemma pair_involutive : Function.Involutive (P.pair) := by + intro c + apply Subtype.ext + change S.finish (α (S.finish (α c.val)))=c.val + rw [P.finish_pair,P.involutive,S.finish_cut c.property] + +lemma reverse_steps (c : {x // x∈S.cut}) (hs : P.pair c=c) : + ∀ i, i≤S.distance (α c.val) → + α ((σ^i) (α c.val))=(σ^(S.distance (α c.val)-i)) (α c.val) := by + intro i + induction i with + | zero => + intro _ + have h := congrArg Subtype.val hs + change S.finish (α c.val)=c.val at h + simp only [pow_zero,Equiv.Perm.one_apply,Nat.sub_zero] + rw [P.involutive] + exact h.symm + | succ i ih => + intro hi + have hj : i (σ^i) (P.first c)) +lemma mem_run {c : {x // x∈S.cut}} {x : O} : x∈P.run c ↔ S.finish x=c.val := by + constructor + · intro h + obtain ⟨i,hi,rfl⟩ := List.mem_map.mp h + have hi' : i≤S.distance (P.first c) := by simpa only [List.mem_range,Nat.lt_succ_iff] using hi + exact (S.finish_iterate _ _ hi').trans (P.finish_first c) + · intro hx + apply List.mem_map.mpr + exact ⟨S.distance (P.first c)-S.distance x, + List.mem_range.mpr (by omega),P.run_coordinates hx⟩ +lemma run_nonempty (c : {x // x∈S.cut}) : P.run c≠[] := by + simp [run] +lemma run_nodup (c : {x // x∈S.cut}) : (P.run c).Nodup := by + apply List.Nodup.map_on _ List.nodup_range + intro i hi j hj he + have hi' : i≤S.distance (P.first c) := by simpa only [List.mem_range,Nat.lt_succ_iff] using hi + have hj' : j≤S.distance (P.first c) := by simpa only [List.mem_range,Nat.lt_succ_iff] using hj + have h := congrArg S.distance he + rw [S.distance_iterate _ _ hi',S.distance_iterate _ _ hj'] at h + omega +lemma belongs_opposite {c : {x // x∈S.cut}} {x : O} (hx : x∈P.run c) : + α x∈P.run (P.pair c) := by + apply P.mem_run.mpr + have he := P.mem_run.mp hx + have h := P.finish_pair x + rw [he] at h + exact h.symm +lemma distinct_runs (c : {x // x∈S.cut}) : P.run c≠P.run (P.pair c) := by + intro h + have hc : c.val∈P.run c := P.mem_run.mpr (S.finish_cut c.property) + rw [h] at hc + have he := P.mem_run.mp hc + rw [S.finish_cut c.property] at he + exact P.pair_fixed_free c (Subtype.ext he.symm) + +lemma first_pair (c : {x // x∈S.cut}) : P.first (P.pair c)=α c.val := by + unfold first + rw [P.pair_involutive] +lemma distance_reverse (c : {x // x∈S.cut}) : ∀ i,i≤S.distance (P.first c) → + S.distance (α ((σ^i) (P.first c)))=i := by + intro i + induction i with + | zero => + intro _ + simp only [pow_zero,Equiv.Perm.one_apply,first] + rw [P.involutive] + exact S.distance_zero (P.pair c).property + | succ i ih => + intro hi + have hc := S.before (x:=P.first c) (i:=i) (by omega) + have hd := S.distance_next (P.opposite_uncut hc) + rw [P.opposite_next hc,ih (by omega)] at hd + simpa only [pow_succ',Equiv.Perm.mul_apply] using hd +lemma distance_first_pair (c : {x // x∈S.cut}) : + S.distance (P.first (P.pair c))=S.distance (P.first c) := by + have h := P.distance_reverse c (S.distance (P.first c)) le_rfl + change S.distance (α (S.finish (P.first c)))=S.distance (P.first c) at h + rw [P.finish_first] at h + rw [P.first_pair] + exact h +lemma reverse_coordinate (c : {x // x∈S.cut}) (i : ℕ) (hi : i≤S.distance (P.first c)) : + α ((σ^i) (P.first c))=(σ^(S.distance (P.first c)-i)) (P.first (P.pair c)) := by + have hmem : (σ^i) (P.first c)∈P.run c := + P.mem_run.mpr ((S.finish_iterate _ _ hi).trans (P.finish_first c)) + have he := P.run_coordinates (P.mem_run.mp (P.belongs_opposite hmem)) + rw [P.distance_first_pair,P.distance_reverse c i hi] at he + exact he.symm +lemma run_reverse (c : {x // x∈S.cut}) : (P.run c).map α=(P.run (P.pair c)).reverse := by + apply List.ext_getElem + · simp only [List.length_map,List.length_reverse,run,List.length_range,P.distance_first_pair] + · intro i hi hj + have hi' : i≤S.distance (P.first c) := by simpa only [List.length_map,run,List.length_range,Nat.lt_succ_iff] using hi + simp only [run,List.getElem_map,List.getElem_range,List.getElem_reverse, + List.length_map,List.length_range,P.distance_first_pair] + have he : S.distance (P.first c)+1-1-i=S.distance (P.first c)-i := by omega + simpa only [he] using P.reverse_coordinate c i hi' + +end Paired +namespace PairOrbit +variable {A : Type} (r : A→A) (hr : Function.Involutive r) +def relation : Setoid A where + r x y := x=y ∨ r x=y + iseqv := ⟨fun _ => Or.inl rfl,fun {x y} h => by + rcases h with h|h + · exact Or.inl h.symm + · exact Or.inr (by rw [←h,hr]),fun {x y z} h k => by + rcases h with rfl|h + · exact k + · rcases k with rfl|k + · exact Or.inr h + · exact Or.inl (by rw [←k,←h,hr])⟩ +abbrev Orbit := Quotient (relation r hr) +variable [Fintype A] +instance : Fintype (Orbit r hr) := Fintype.ofFinite _ +def project (x : A) : Orbit r hr := Quotient.mk _ x +lemma fiber_two (hf : ∀ x,r x≠x) (c : Orbit r hr) : + (Finset.univ.filter (fun x => project r hr x=c)).card=2 := by + obtain ⟨x,rfl⟩ := Quotient.mk_surjective c + have he : Finset.univ.filter (fun y => project r hr y=project r hr x)={x,r x} := by + ext y + simp only [Finset.mem_filter,Finset.mem_univ,true_and,Finset.mem_insert,Finset.mem_singleton] + change Quotient.mk (relation r hr) y=Quotient.mk (relation r hr) x ↔ y=x ∨ y=r x + rw [Quotient.eq] + change (y=x ∨ r y=x) ↔ y=x ∨ y=r x + constructor + · rintro (h|h) + · exact Or.inl h + · exact Or.inr (by rw [←h,hr]) + · rintro (h|h) + · exact Or.inl h + · exact Or.inr (by rw [h,hr]) + change (Finset.univ.filter (fun y => project r hr y=project r hr x)).card=2 + rw [he] + simp [Ne.symm (hf x)] +lemma card_twice (hf : ∀ x,r x≠x) : 2*Fintype.card (Orbit r hr)=Fintype.card A := by + have h := Finset.card_eq_sum_card_fiberwise (s:=Finset.univ) (t:=Finset.univ) + (f:=project r hr) (fun _ _ => Finset.mem_univ _) + simpa only [fiber_two r hr hf,Finset.sum_const,Finset.card_univ,smul_eq_mul,Nat.mul_comm] using h.symm +end PairOrbit + +namespace Paired +variable {S} {α : Equiv.Perm O} (P : S.Paired α) +abbrev IntervalPair := PairOrbit.Orbit P.pair P.pair_involutive +instance : Fintype P.IntervalPair := PairOrbit.instFintypeOrbit _ _ +lemma twice_interval_pairs : 2*Fintype.card P.IntervalPair=S.cut.card := by + simpa only [Fintype.card_coe] using PairOrbit.card_twice P.pair P.pair_involutive P.pair_fixed_free +lemma interval_pairs_le (pieces : ℕ) (hcut : S.cut.card≤12*pieces) : + Fintype.card P.IntervalPair≤6*pieces := by + have h := P.twice_interval_pairs + omega +end Paired + +/-- The literal source cut construction has at least one cut per boundary, +using one chosen indexing mark there. -/ +def ofMarks [Fintype O] (α : Equiv.Perm O) (marks : Finset O) + (hmark : ∀ x,∃ y∈marks,σ.SameCycle x y) : CutSystem σ where + cut := PlanarRotation.cuts σ α marks + hits x := by + obtain ⟨y,hy,hxy⟩ := hmark x + obtain ⟨n,hn⟩ := hxy.exists_nat_pow_eq + refine ⟨n,?_⟩ + rw [hn] + exact Finset.mem_union.mpr (Or.inl (Finset.mem_union.mpr (Or.inr hy))) +lemma ofMarks_paired [Fintype O] (α : Equiv.Perm O) (marks : Finset O) + (hmark : ∀ x,∃ y∈marks,σ.SameCycle x y) + (hr : Function.Involutive α) (hf : ∀ x,α x≠x) : + (ofMarks α marks hmark).Paired α where + involutive := hr + fixed_free := hf + good x hx := by + by_contra hn + exact hx (Finset.mem_union.mpr (Or.inl (Finset.mem_union.mpr + (Or.inl (Finset.mem_filter.mpr ⟨Finset.mem_univ _,hn⟩))))) + stable x hx := PlanarRotation.cut_stable σ α hr marks hx + +/-- Exact `6N'` interval-pair count for the finite rotation data of the +manuscript. Euler planarity and the at-most-one exceptional monogon remain +explicit geometric inputs; the resulting intervals and their reversal are +constructed, not presumed. -/ +theorem source_interval_bound [Fintype O] (α : Equiv.Perm O) (marks : Finset O) + (hmark : ∀ x,∃ y∈marks,σ.SameCycle x y) + (hr : Function.Involutive α) (hf : ∀ x,α x≠x) (pieces : ℕ) + (heuler : Fintype.card O+4≤2*Fintype.card (PermutationCycles.Cycle σ)+ + 2*Fintype.card (PermutationCycles.Cycle (opposite σ α))) + (hmono : (PermutationCycles.fixed (opposite σ α)).card≤1) + (hpieces : Fintype.card (PermutationCycles.Cycle σ)≤pieces) + (hmarks : marks.card≤Fintype.card (PermutationCycles.Cycle σ)+pieces) : + Fintype.card (ofMarks_paired α marks hmark hr hf).IntervalPair≤6*pieces := by + apply Paired.interval_pairs_le + exact PlanarRotation.cuts_le_twelve σ α marks pieces heuler hmono hpieces hmarks + +end CutSystem +end TorsionFreeZeroDivisors.PlanarRuns + +namespace TorsionFreeZeroDivisors.PlanarIntervals +open scoped Classical BigOperators +open BlockAlignment ComparedBlocks PlanarRuns PlanarRuns.CutSystem +variable {T : Type} {len : T→ℕ} {σ α : Equiv.Perm (Position len)} + (S : CutSystem σ) (P : S.Paired α) + (hstep : ∀ x,x∉S.cut → (σ x).1=x.1 ∧ (σ x).2.val=x.2.val+1) + +lemma position_ext {x y : Position len} (hs : x.1=y.1) (hc : x.2.val=y.2.val) : x=y := by + rcases x with ⟨x,q⟩; rcases y with ⟨y,r⟩ + dsimp at hs hc + subst y + congr 1 + exact Subtype.ext hc + +include hstep +lemma coordinate_iterate (x : Position len) (i : ℕ) (hi : i≤S.distance x) : + ((σ^i) x).1=x.1 ∧ ((σ^i) x).2.val=x.2.val+i := by + induction i with + | zero => + change x.1=x.1 ∧ x.2.val=x.2.val+(0:ℤ) + simp + | succ i ih => + have hh := hstep ((σ^i) x) (S.before (by omega)) + have ih := ih (by omega) + rw [pow_succ',Equiv.Perm.mul_apply] + constructor + · exact hh.1.trans ih.1 + · rw [hh.2,ih.2,Nat.cast_add,Nat.cast_one]; ring + +def lower (c : {x // x∈S.cut}) : ℤ := (P.first c).2.val +def upper (c : {x // x∈S.cut}) : ℤ := c.val.2.val+1 +lemma finish_coordinates (c : {x // x∈S.cut}) : + c.val.1=(P.first c).1 ∧ upper S c=lower S P c+S.distance (P.first c)+1 := by + have hh := coordinate_iterate S hstep (P.first c) (S.distance (P.first c)) le_rfl + change (S.finish (P.first c)).1=_ ∧ (S.finish (P.first c)).2.val=_ at hh + rw [P.finish_first] at hh + exact ⟨hh.1,by dsimp only [upper,lower]; omega⟩ +lemma bounds (c : {x // x∈S.cut}) : + 0≤lower S P c ∧ lower S P c (len t : ℤ)) he.1) + refine ⟨by exact_mod_cast h0,?_,h1⟩ + rw [he.2] + omega + +lemma finish_iff (x : Position len) (c : {x // x∈S.cut}) : + S.finish x=c.val ↔ x.1=(P.first c).1 ∧ lower S P c≤x.2.val ∧ x.2.val dsimp only [lower] at * <;> omega + · rintro ⟨hs,hl,hu⟩ + have he := (finish_coordinates S P hstep c).2 + let i := (x.2.val-lower S P c).toNat + have hi : i≤S.distance (P.first c) := by dsimp only [i]; omega + have hh := coordinate_iterate S hstep (P.first c) i hi + have hp : (σ^i) (P.first c)=x := by + apply position_ext + · exact hh.1.trans hs.symm + · rw [hh.2] + dsimp only [i,lower] at * + omega + rw [←hp] + exact (S.finish_iterate _ _ hi).trans (P.finish_first c) + +lemma finish_real_iff (x : Position len) (c : {x // x∈S.cut}) : + S.finish x=c.val ↔ x.1=(P.first c).1 ∧ + x.2.val∈positions (lower S P c) (upper S c) := by + rw [finish_iff S P hstep,mem_positions] + constructor + · rintro ⟨hs,hl,hu⟩ + have hl' : (lower S P c:ℝ)≤x.2.val := by exact_mod_cast hl + have hu' : (x.2.val:ℝ)+1≤upper S c := by exact_mod_cast hu + exact ⟨hs,by linarith,by linarith⟩ + · rintro ⟨hs,hl,hu⟩ + have hl' : lower S P c≤x.2.val := by + have : (lower S P c:ℝ)-1 x.1) h + · exact congrArg (fun x : Position more => x.2.val) h + +def partner (x : Position more) : Position more := + if h : Old (len:=len) x then embed hle (C.pairing.partner (project x h)) else x +lemma partner_embed (x : Position len) : partner C hle (embed hle x)=embed hle (C.pairing.partner x) := by + simp only [partner,dite_eq_left (old_embed hle x),project_embed] +lemma partner_new (x : Position more) (h : ¬Old (len:=len) x) : partner C hle x=x := by + simp only [partner,dite_eq_right h] +lemma partner_inv : Function.Involutive (partner C hle) := by + intro x + by_cases h : Old (len:=len) x + · rw [←embed_project hle x h,partner_embed,partner_embed,C.pairing.involutive] + · rw [partner_new C hle x h,partner_new C hle x h] +def side (x : Position more) : Option E := + if h : Old (len:=len) x then C.side (project x h) else none +lemma side_embed (x : Position len) : side C (embed hle x)=C.side x := by + simp only [side,dite_eq_left (old_embed hle x),project_embed] +lemma side_some_old {x : Position more} {e : E} (h : side C x=some e) : Old (len:=len) x := by + by_contra hn + simp only [side,dite_eq_right hn] at h + cases h +lemma side_none (x : Position more) : side C x=none ↔ partner C hle x=x := by + by_cases h : Old (len:=len) x + · rw [←embed_project hle x h,side_embed,partner_embed] + exact (C.none_iff _).trans (embed_injective hle).eq_iff.symm + · simp only [side,dite_eq_right h,partner_new C hle x h] + +variable (hupper : ∀ e,C.hi e≤len (C.source e)) +include hupper in +lemma side_iff (x : Position more) (e : E) : + side C x=some e ↔ x.1=C.source e ∧ x.2.val∈positions (C.lo e) (C.hi e) := by + constructor + · intro hx + have ho := side_some_old C hx + rw [side,dite_eq_left ho] at hx + exact (C.side_iff _ _).mp hx + · intro hx + have ho : Old (len:=len) x := by + apply mem_positions.mpr + have h1 := (mem_positions.mp x.2.property).1 + have h2 := (mem_positions.mp hx.2).2 + have h3 : C.hi e≤len x.1 := by simpa only [hx.1] using hupper e + exact ⟨h1,h2.trans_le h3⟩ + rw [side,dite_eq_left ho] + exact (C.side_iff _ _).mpr hx + +lemma partner_side {x : Position more} {e : E} (hx : side C x=some e) : + side C (partner C hle x)=some (C.flip e) := by + have ho := side_some_old C hx + rw [←embed_project hle x ho,partner_embed,side_embed] + apply C.side_partner + rwa [←side_embed C hle,embed_project] +lemma partner_source {x : Position more} {e : E} (hx : side C x=some e) : + (partner C hle x).1=C.source (C.flip e) := by + have ho := side_some_old C hx + rw [←embed_project hle x ho,partner_embed] + exact C.partner_source _ _ (by rwa [←side_embed C hle,embed_project]) +lemma partner_coordinate {x : Position more} {e : E} (hx : side C x=some e) : + (partner C hle x).2.val=affine (C.reverse e) (C.offset e) x.2.val := by + have ho := side_some_old C hx + have hx' : C.side (project x ho)=some e := by + simpa only [side,dite_eq_left ho] using hx + have he : partner C hle x=embed hle (C.pairing.partner (project x ho)) := dite_eq_left ho + rw [he] + exact C.partner_coordinate (project x ho) e hx' +include hle in +lemma target_range (e : E) : if C.reverse e then + 0≤(C.offset e:ℝ)-C.hi e ∧ (C.offset e:ℝ)-C.lo e ≤ more (C.source (C.flip e)) + else 0≤C.lo e+(C.offset e:ℝ) ∧ C.hi e+(C.offset e:ℝ) ≤ more (C.source (C.flip e)) := by + have hh := C.target_range e + have hn : (len (C.source (C.flip e)):ℝ) ≤ more (C.source (C.flip e)) := by exact_mod_cast hle _ + split_ifs at hh ⊢ <;> exact ⟨hh.1,hh.2.trans hn⟩ + +def comparisons : Comparisons (E:=E) more where + pairing := ⟨partner C hle,partner_inv C hle⟩ + side := side C + flip := C.flip + flip_inv := C.flip_inv + flip_ne := C.flip_ne + side_partner _ _ := partner_side C hle + none_iff := side_none C hle + source := C.source + lo := C.lo + hi := C.hi + reverse := C.reverse + offset := C.offset + side_iff := side_iff C hupper + partner_source _ _ := partner_source C hle + partner_coordinate _ _ := partner_coordinate C hle + target_range := target_range C hle + +variable [Fintype T] +include hle in +lemma old_card : (Finset.univ.filter (fun x : Position more => Old (len:=len) x)).card= + Fintype.card (Position len) := by + symm + rw [←Finset.card_univ] + apply Finset.card_bij (fun x _ => embed hle x) + · intro x _ + exact Finset.mem_filter.mpr ⟨Finset.mem_univ _,old_embed hle x⟩ + · intro x _ y _ h + exact embed_injective hle h + · intro x hx + have ho := (Finset.mem_filter.mp hx).2 + exact ⟨project x ho,Finset.mem_univ _,embed_project hle x ho⟩ +lemma fixed_old_card : (Finset.univ.filter (fun x : Position more => Old (len:=len) x ∧ partner C hle x=x)).card= + (Finset.univ.filter (fun x : Position len => C.pairing.partner x=x)).card := by + symm + apply Finset.card_bij (fun x _ => embed hle x) + · intro x hx + refine Finset.mem_filter.mpr ⟨Finset.mem_univ _,old_embed hle x,?_⟩ + rw [partner_embed,(Finset.mem_filter.mp hx).2] + · intro x _ y _ h + exact embed_injective hle h + · intro x hx + obtain ⟨ho,hf⟩ := (Finset.mem_filter.mp hx).2 + refine ⟨project x ho,Finset.mem_filter.mpr ⟨Finset.mem_univ _,?_⟩,embed_project hle x ho⟩ + apply embed_injective hle + rw [←partner_embed,embed_project,hf] +lemma fixed_card : (Finset.univ.filter (fun x : Position more => partner C hle x=x)).card= + (Finset.univ.filter (fun x : Position len => C.pairing.partner x=x)).card+ + (Finset.univ.filter (fun x : Position more => ¬Old (len:=len) x)).card := by + have he : (Finset.univ.filter (fun x : Position more => partner C hle x=x))= + (Finset.univ.filter (fun x : Position more => Old (len:=len) x ∧ partner C hle x=x))∪ + (Finset.univ.filter (fun x : Position more => ¬Old (len:=len) x)) := by + ext x + simp only [Finset.mem_filter,Finset.mem_univ,true_and,Finset.mem_union] + by_cases h : Old (len:=len) x + · simp only [h,true_and,not_true_eq_false,or_false] + · simp only [h,false_and,not_false_eq_true,or_true,iff_true] + exact partner_new C hle x h + have hd : Disjoint (Finset.univ.filter (fun x : Position more => Old (len:=len) x ∧ partner C hle x=x)) + (Finset.univ.filter (fun x : Position more => ¬Old (len:=len) x)) := by + apply Finset.disjoint_left.mpr + intro x hx hy + exact (Finset.mem_filter.mp hy).2 (Finset.mem_filter.mp hx).2.1 + rw [he,Finset.card_union_of_disjoint hd,fixed_old_card] +end TorsionFreeZeroDivisors.ExtendComparisons +namespace TorsionFreeZeroDivisors.WordPositions + +section +open scoped Classical BigOperators +open BlockAlignment ComparedBlocks +lemma bounds {n : ℕ} (q : {z // z∈positions 0 (n:ℝ)}) : 0≤q.val ∧ q.val<(n:ℤ) := by + simpa only [AffineIntervals.nat_positions,Finset.mem_Ico] using q.property +variable {T : Type} (len : T → ℕ) +def fin : Position len ≃ ((t : T) × Fin (len t)) where + toFun x := ⟨x.1,⟨x.2.val.toNat,by + have hx := bounds x.2 + omega⟩⟩ + invFun x := ⟨x.1,⟨x.2.val,by + simpa only [AffineIntervals.nat_positions,Finset.mem_Ico] using + (show (0:ℤ)≤x.2.val ∧ (x.2.val:ℤ)(w t).length)).symm x)=(w x.1).get x.2 := by + change (w x.1).get ⟨(x.2.val:ℤ).toNat,_⟩=(w x.1).get x.2 + congr 1 +lemma dart_prefix (v : T → List A) (x : Position (fun t=>(w t).length)) : + RawDecomposition.dart (fun t=>w t++v t) + (ExtendComparisons.embed (fun t=>by simp only [List.length_append]; omega) x)= + RawDecomposition.dart w x := by + dsimp only [RawDecomposition.dart,ExtendComparisons.embed] + simpa only [List.get_eq_getElem] using List.getElem_append_left + (show x.2.val.toNat<(w x.1).length from (fin _ x).2.isLt) + +variable (cap : ℕ) (hc : 0Fin (BalancedPieces.sizes (w t).length cap i)).trans + (Equiv.sigmaCongrRight fun t=>ConsecutivePieces.index (w t) + (BalancedPieces.sizes (w t).length cap) (BalancedPieces.sizes_sum hc)) +def join : Position (BalancedWords.old w cap) ≃ Position (fun t=>(w t).length) := + (fin _).trans ((joinFin w cap hc).trans (fin _).symm) +lemma join_first (x : Position (BalancedWords.old w cap)) : (join w cap hc x).1=x.1.1 := rfl +lemma join_value (x : Position (BalancedWords.old w cap)) : (join w cap hc x).2.val= + (ConsecutivePieces.offset (BalancedPieces.sizes (w x.1.1).length cap) x.1.2:ℤ)+x.2.val := by + let q : Fin (BalancedPieces.sizes (w x.1.1).length cap x.1.2) := + ⟨x.2.val.toNat,by + have hb := (fin _ x).2.isLt + exact hb⟩ + change ((ConsecutivePieces.index (w x.1.1) (BalancedPieces.sizes (w x.1.1).length cap) + (BalancedPieces.sizes_sum hc) ⟨x.1.2,q⟩).val:ℤ)=_ + rw [ConsecutivePieces.index_val,Nat.cast_add] + congr 1 + exact Int.toNat_of_nonneg (bounds x.2).1 + +def segments : Position (fun p=>(BalancedWords.segment w cap hc p).length) ≃ + Position (fun t=>(w t).length) := + (ComparisonGeometry.position (Equiv.refl _) (BalancedWords.segment_length w cap hc)).trans (join w cap hc) +lemma segments_dart (x : Position (fun p=>(BalancedWords.segment w cap hc p).length)) : + RawDecomposition.dart (BalancedWords.segment w cap hc) x= + RawDecomposition.dart w (segments w cap hc x) := by + unfold RawDecomposition.dart + simp only [BalancedWords.segment,ConsecutivePieces.segment,List.get_eq_getElem,List.getElem_ofFn, + Fin.getElem_fin] + congr 1 +end +open scoped Classical BigOperators +open BlockAlignment ComparedBlocks +variable {T : Type} [Fintype T] (len : T → ℕ) +lemma cardinal : Fintype.card (Position len)=∑t,len t := by + rw [Fintype.card_congr (fin len),Fintype.card_sigma] + simp only [Fintype.card_fin] +variable {A : Type} (w v : T → List A) +abbrev prefix_bound (t : T) : (w t).length≤(w t++v t).length := by + simp only [List.length_append] + omega +lemma new_card : (Finset.univ.filter (fun x : Position (fun t=>(w t++v t).length)=> + ¬ExtendComparisons.Old (len:=fun t=>(w t).length) x)).card=∑t,(v t).length := by + have hp := Finset.card_filter_add_card_filter_not + (s:=Finset.univ (α:=Position (fun t=>(w t++v t).length))) + (p:=fun x=>ExtendComparisons.Old (len:=fun t=>(w t).length) x) + have ho := ExtendComparisons.old_card (prefix_bound w v) + rw [ho,Finset.card_univ,cardinal,cardinal] at hp + simp only [List.length_append,Finset.sum_add_distrib] at hp + omega +variable {E : Type} (C : Comparisons (E:=E) (fun t=>(w t).length)) +lemma fixed_card (hfull : ∀ x,C.pairing.partner x≠x) : + (Finset.univ.filter (fun x=>ExtendComparisons.partner C (prefix_bound w v) x=x)).card= + ∑t,(v t).length := by + rw [ExtendComparisons.fixed_card,new_card] + have he : (Finset.univ.filter (fun x=>C.pairing.partner x=x))=∅ := by + ext x + simp only [Finset.mem_filter,Finset.mem_univ,true_and,Finset.notMem_empty,iff_false] + exact hfull x + rw [he,Finset.card_empty,Nat.zero_add] +omit [Fintype T] in +lemma nonfixed_old (p : Position (fun t=>(w t++v t).length)) + (hp : ExtendComparisons.partner C (prefix_bound w v) p≠p) : + p.2.val∈positions 0 (w p.1).length := by + by_contra hn + exact hp (ExtendComparisons.partner_new C (prefix_bound w v) p hn) +end TorsionFreeZeroDivisors.WordPositions + +namespace TorsionFreeZeroDivisors.SampleGraph.ClosedWords +open scoped Classical BigOperators +open GirthAsymptotics ActualPatternEvent TypedGraphs WeightedMoore BlockAlignment ComparedBlocks +variable {rep : ℕ} {r : Match rep} {x : VA rep} {y : VB rep} + (s : PathSystem rep r x y) (cap : ℕ) (hc : 0(seg s cap hc p).length)) + (lo hi : E → ℕ) (hlo : ∀ e,C.lo e=lo e) (hhi : ∀ e,C.hi e=hi e) + (hle : ∀ e,lo e≤hi e) (hh : ∀ e,hi e≤(seg s cap hc (C.source e)).length) + (hred : ∀ p e,C.side p=some e → + RawDecomposition.dart (seg s cap hc) p≠RawDecomposition.dart (seg s cap hc) (C.pairing.partner p) ∧ + RawDecomposition.dart (seg s cap hc) p≠(graph rep r).reverse (RawDecomposition.dart (seg s cap hc) (C.pairing.partner p))) + (hcomp : ∀ p e,C.side p=some e → label rep (RawDecomposition.dart (seg s cap hc) p)= + if C.reverse e then Types.inverse (label rep (RawDecomposition.dart (seg s cap hc) (C.pairing.partner p))) + else label rep (RawDecomposition.dart (seg s cap hc) (C.pairing.partner p))) +abbrev grow := WordPositions.prefix_bound (seg s cap hc) (tail s cap hc hL hd) +include hhi hh in +omit [Fintype E] in +lemma upper_real (e : E) : C.hi e≤((seg s cap hc (C.source e)).length:ℝ) := by + rw [hhi] + exact_mod_cast hh e + +/-- Appending the actual short closures changes neither original comparison nor +its underlying graph lifts. Every newly added position is unpaired. -/ +def system : PathSystem rep r x y where + P := Piece s cap + E := E + fP := inferInstance + fE := inferInstance + paths := word s cap hc hL hd + nonempty := nonempty s cap hc hL hd + root := root s cap hc + path_chain := chain s cap hc hL hd + cyclic_chain := cyclic s cap hc hL hd + comparisons := ExtendComparisons.comparisons C (grow s cap hc hL hd) (upper_real s cap hc C hi hhi hh) + lower := lo + upper := hi + lower_eq := hlo + upper_eq := hhi + lower_le := hle + upper_le e := (hh e).trans (grow s cap hc hL hd _) + reduced := by + intro p e he + have hp := ExtendComparisons.side_some_old C he + have he' : C.side (ExtendComparisons.project p hp)=some e := by + simpa only [ExtendComparisons.comparisons,ExtendComparisons.side,dite_eq_left hp] using he + have hg := hred (ExtendComparisons.project p hp) e he' + rw [←ExtendComparisons.embed_project (grow s cap hc hL hd) p hp] + change RawDecomposition.dart (fun p=>seg s cap hc p++tail s cap hc hL hd p) _≠ + RawDecomposition.dart _ (ExtendComparisons.partner C (grow s cap hc hL hd) _) ∧ + RawDecomposition.dart (fun p=>seg s cap hc p++tail s cap hc hL hd p) _ ≠(graph rep r).reverse (RawDecomposition.dart _ (ExtendComparisons.partner C (grow s cap hc hL hd) _)) + rw [ExtendComparisons.partner_embed] + simpa only [word,WordPositions.dart_prefix] using hg + rootA := rootA s cap hc hL hd + rootB := rootB s cap hc hL hd + compatible := by + intro p e he + have hp := ExtendComparisons.side_some_old C he + have he' : C.side (ExtendComparisons.project p hp)=some e := by + simpa only [ExtendComparisons.comparisons,ExtendComparisons.side,dite_eq_left hp] using he + have hg := hcomp (ExtendComparisons.project p hp) e he' + rw [←ExtendComparisons.embed_project (grow s cap hc hL hd) p hp] + change label rep (RawDecomposition.dart (fun p=>seg s cap hc p++tail s cap hc hL hd p) _)= + if C.reverse e then Types.inverse (label rep (RawDecomposition.dart _ (ExtendComparisons.partner C (grow s cap hc hL hd) _))) + else label rep (RawDecomposition.dart _ (ExtendComparisons.partner C (grow s cap hc hL hd) _)) + rw [ExtendComparisons.partner_embed] + simpa only [word,WordPositions.dart_prefix] using hg +end TorsionFreeZeroDivisors.SampleGraph.ClosedWords + +namespace TorsionFreeZeroDivisors.BoundaryRotation + +section +open scoped Classical BigOperators +open BlockAlignment ComparedBlocks WordPositions PermutationCycles +variable {T : Type} (len : T → ℕ) +def perm : Equiv.Perm (Position len) := + (fin len).symm.permCongr (Equiv.sigmaCongrRight fun t=>finRotate (len t)) +lemma apply_fin (t : T) (i : Fin (len t)) : + perm len ((fin len).symm ⟨t,i⟩)=(fin len).symm ⟨t,finRotate (len t) i⟩ := by + simp only [perm,Equiv.permCongr_apply,Equiv.symm_symm,Equiv.apply_symm_apply, + Equiv.sigmaCongrRight_apply] +lemma pow_fin (t : T) (i : Fin (len t)) (n : ℕ) : + (perm len^n) ((fin len).symm ⟨t,i⟩)=(fin len).symm ⟨t,(finRotate (len t)^n) i⟩ := by + induction n with + | zero => rfl + | succ n ih => rw [pow_succ',Equiv.Perm.mul_apply,ih,apply_fin,pow_succ',Equiv.Perm.mul_apply] +lemma first (x : Position len) : (perm len x).1=x.1 := by + rw [←(fin len).symm_apply_apply x] + exact rfl +lemma finRotate_same {n : ℕ} (i j : Fin n) : (finRotate n).SameCycle i j := by + by_cases hn : 2≤n + · apply Equiv.Perm.IsCycle.sameCycle (isCycle_finRotate_of_le hn) + · have hm : i∈(finRotate n).support := by rw [support_finRotate_of_le hn]; exact Finset.mem_univ _ + exact Equiv.Perm.mem_support.mp hm + · have hm : j∈(finRotate n).support := by rw [support_finRotate_of_le hn]; exact Finset.mem_univ _ + exact Equiv.Perm.mem_support.mp hm + · have he : i=j := by apply Fin.ext; omega + exact he.sameCycle _ +lemma same_first {x y : Position len} (h : x.1=y.1) : (perm len).SameCycle x y := by + rcases x with ⟨a',i'⟩ + rcases y with ⟨b',j'⟩ + dsimp at h + subst b' + let u : Fin (len a') := ⟨i'.val.toNat,by have hb:=bounds i'; omega⟩ + let v : Fin (len a') := ⟨j'.val.toNat,by have hb:=bounds j'; omega⟩ + obtain ⟨n,hn⟩ := (finRotate_same u v).exists_nat_pow_eq + refine ⟨(n:ℤ),?_⟩ + rw [zpow_natCast] + have hh := pow_fin len a' u n + rw [hn] at hh + change (perm len^n) ((fin len).symm (fin len ⟨a',i'⟩))=(fin len).symm (fin len ⟨a',j'⟩) at hh + simpa only [Equiv.symm_apply_apply] using hh +lemma next {x : Position len} (hx : x.2.val+1<(len x.1:ℤ)) : + (perm len x).2.val=x.2.val+1 := by + let i : Fin (len x.1) := ⟨x.2.val.toNat,by have hb:=bounds x.2; omega⟩ + have he := apply_fin len x.1 i + change perm len ((fin len).symm (fin len x))=(fin len).symm ⟨x.1,finRotate (len x.1) i⟩ at he + rw [Equiv.symm_apply_apply] at he + rw [he] + change ((finRotate (len x.1) i).val:ℤ)=x.2.val+1 + have hb := bounds x.2 + have hp : 0(Quotient.out c).1 + have hi : Function.Injective f := by + intro c d h + have hh := same_first len h + have he := (cycle_eq (perm len)).mpr hh + simpa only [cycle,Quotient.out_eq] using he + exact Fintype.card_le_of_injective f hi + +def ends : Finset (Position len) := Finset.univ.filter (fun x=>x.2.val+1=len x.1) +lemma ends_le : (ends len).card≤Fintype.card T := by + let f : {x // x∈ends len} → T := fun x=>x.val.1 + have hi : Function.Injective f := by + intro x y h + apply Subtype.ext + apply PlanarIntervals.position_ext h + have hx := (Finset.mem_filter.mp x.property).2 + have hy := (Finset.mem_filter.mp y.property).2 + change x.val.1=y.val.1 at h + have hh := congrArg (fun t=>(len t:ℤ)) h + omega + simpa only [Fintype.card_coe] using Fintype.card_le_of_injective f hi +lemma hits (x : Position len) : ∃ y∈ends len,(perm len).SameCycle x y := by + have hb := bounds x.2 + let j : Fin (len x.1) := ⟨len x.1-1,by omega⟩ + refine ⟨(fin len).symm ⟨x.1,j⟩,?_,same_first len rfl⟩ + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _,?_⟩ + change ((len x.1-1:ℕ):ℤ)+1=len x.1 + omega +end + +section +open scoped Classical BigOperators +open BlockAlignment ComparedBlocks WordPositions PermutationCycles +variable {T A : Type} [Fintype T] (len : T → ℕ) (root : Option T) + (label : Position len → A) (bar : A → A) (α : Equiv.Perm (Position len)) + (hr : Function.Involutive α) + (hcomp : ∀ x,label (α x)=bar (label x)) + (hred : ∀ x,root≠some x.1 ∨ x∉ends len → label (perm len x)≠bar (label x)) +include hr hcomp hred in +lemma fixed_root_end {x : Position len} (hx : PlanarRotation.opposite (perm len) α x=x) : + root=some x.1 ∧ x∈ends len := by + have he : perm len x=α x := by + have hh := congrArg α hx + change α (α (perm len x))=α x at hh + rwa [hr] at hh + have hl : label (perm len x)=bar (label x) := he ▸ hcomp x + constructor + · by_contra hn + exact hred x (Or.inl hn) hl + · by_contra hn + exact hred x (Or.inr hn) hl +include hr hcomp hred in +lemma monogons_le : (fixed (PlanarRotation.opposite (perm len) α)).card≤1 := by + apply Finset.card_le_one.mpr + intro x hx y hy + simp only [fixed,Finset.mem_filter,Finset.mem_univ,true_and] at hx hy + have hx := fixed_root_end len root label bar α hr hcomp hred hx + have hy := fixed_root_end len root label bar α hr hcomp hred hy + have hs : x.1=y.1 := Option.some.inj (hx.1.symm.trans hy.1) + apply PlanarIntervals.position_ext hs + have hx' := (Finset.mem_filter.mp hx.2).2 + have hy' := (Finset.mem_filter.mp hy.2).2 + have hh := congrArg (fun t=>(len t:ℤ)) hs + omega +end + +open scoped Classical BigOperators +open BlockAlignment ComparedBlocks WordPositions +variable {T : Type} (len : T → ℕ) +lemma last_next {x : Position len} (hx : x.2.val+1=(len x.1:ℤ)) : (perm len x).2.val=0 := by + have hb := bounds x.2 + let i : Fin (len x.1) := ⟨x.2.val.toNat,by omega⟩ + have he := apply_fin len x.1 i + change perm len ((fin len).symm (fin len x))=(fin len).symm ⟨x.1,finRotate (len x.1) i⟩ at he + rw [Equiv.symm_apply_apply] at he + rw [he] + change ((finRotate (len x.1) i).val:ℤ)=0 + have hn : len x.1≠0 := by omega + obtain ⟨n,hn⟩ := Nat.exists_eq_succ_of_ne_zero hn + have hc : ∀ j : Fin (len x.1),j.val+1=len x.1 → (finRotate (len x.1) j).val=0 := by + rw [hn] + intro j hj + have he : j=Fin.last n := by apply Fin.ext; simp only [Fin.val_last]; omega + rw [he,finRotate_last] + rfl + rw [hc _ (by dsimp only [i]; omega)] + rfl +variable {A : Type} (w : T → List A) (R : A → A → Prop) +lemma step_nonlast (hc : ∀t,(w t).IsChain R) (x : Position (fun t=>(w t).length)) + (hx : x.2.val+1<(w x.1).length) : + R (RawDecomposition.dart w x) (RawDecomposition.dart w (perm (fun t=>(w t).length) x)) := by + have hb := bounds x.2 + have hh := next (fun t=>(w t).length) hx + have hi : x.2.val.toNat+1<(w x.1).length := by omega + have hn : (perm (fun t=>(w t).length) x).2.val.toNat=x.2.val.toNat+1 := by omega + have hc := (List.isChain_iff_getElem.mp (hc x.1)) x.2.val.toNat hi + change R (w x.1)[x.2.val.toNat] (w x.1)[(perm (fun t=>(w t).length) x).2.val.toNat] + simpa only [hn] using hc +lemma step_last (hne : ∀t,w t≠[]) (x : Position (fun t=>(w t).length)) + (hx : x.2.val+1=(w x.1).length) + (hcyc : ∀ᵉ (a∈(w x.1).getLast?) (b∈(w x.1).head?),R a b) : + R (RawDecomposition.dart w x) (RawDecomposition.dart w (perm (fun t=>(w t).length) x)) := by + have hb := bounds x.2 + have hn : x.2.val.toNat=(w x.1).length-1 := by omega + have hh := last_next (fun t=>(w t).length) hx + have hc := hcyc ((w x.1).getLast (hne x.1)) (List.getLast_mem_getLast? (hne x.1)) + ((w x.1).head (hne x.1)) (List.head_mem_head? (hne x.1)) + change R (w x.1)[x.2.val.toNat] (w x.1)[(perm (fun t=>(w t).length) x).2.val.toNat] + simpa only [hn,hh,List.getLast_eq_getElem,List.head_eq_getElem,Int.toNat_zero] using hc +end TorsionFreeZeroDivisors.BoundaryRotation + +namespace TorsionFreeZeroDivisors.SampleGraph.PathSystem +open scoped Classical BigOperators +open BlockAlignment ComparedBlocks WordPositions BoundaryRotation WeightedMoore ActualPatternEvent GirthAsymptotics +variable {rep : ℕ} {r : Match rep} {x : VA rep} {y : VB rep} (s : PathSystem rep r x y) +lemma step_label {d e : DA rep⊕DB rep} + (h : PortWalk.step (graph rep r).origin (graph rep r).reverse d e) : + label rep e≠Types.inverse (label rep d) := by + intro he + exact h.2 (immersed rep r e ((graph rep r).reverse d) h.1.symm + (he.trans (label_reverse rep r d).symm)) +lemma boundary_reduced (p : Position (fun t=>(s.paths t).length)) + (hp : s.root≠some p.1 ∨ p∉BoundaryRotation.ends (fun t=>(s.paths t).length)) : + label rep (RawDecomposition.dart s.paths (perm (fun t=>(s.paths t).length) p))≠ + Types.inverse (label rep (RawDecomposition.dart s.paths p)) := by + have hb : 0≤p.2.val ∧ p.2.val<((s.paths p.1).length:ℤ) := bounds p.2 + apply step_label + by_cases hl : p.2.val+1=(s.paths p.1).length + · apply step_last s.paths _ s.nonempty p hl + apply s.cyclic_chain p.1 + apply (ClosedWords.cyclic_iff _ _).mpr + rcases hp with hp|hp + · exact hp + · exact False.elim (hp (Finset.mem_filter.mpr ⟨Finset.mem_univ _,hl⟩)) + · exact step_nonlast s.paths _ s.path_chain p (by omega) +end TorsionFreeZeroDivisors.SampleGraph.PathSystem + +namespace TorsionFreeZeroDivisors.PermutationTransport +variable {A B : Type} (e : A ≃ B) (f : Equiv.Perm A) +lemma pow_apply (x : A) (n : ℕ) : (e.permCongr f^n) (e x)=e ((f^n) x) := by + induction n with + | zero => rfl + | succ n ih => simp only [pow_succ',Equiv.Perm.mul_apply,ih,Equiv.permCongr_apply,Equiv.symm_apply_apply] +lemma sameCycle [Finite A] {x y : A} (h : f.SameCycle x y) : (e.permCongr f).SameCycle (e x) (e y) := by + obtain ⟨n,hn⟩ := h.exists_nat_pow_eq + exact ⟨(n:ℤ),by rw [zpow_natCast,pow_apply,hn]⟩ +lemma involutive (h : Function.Involutive f) : Function.Involutive (e.permCongr f) := by + intro x + simp only [Equiv.permCongr_apply,Equiv.symm_apply_apply] + rw [h,Equiv.apply_symm_apply] +lemma fixed_free (h : ∀x,f x≠x) (x : B) : e.permCongr f x≠x := by + intro he + apply h (e.symm x) + simpa only [Equiv.permCongr_apply,Equiv.symm_apply_apply] using congrArg e.symm he +lemma mul (g : Equiv.Perm A) : e.permCongr (f*g)=e.permCongr f*e.permCongr g := by + ext x + simp only [Equiv.Perm.mul_apply,Equiv.permCongr_apply,Equiv.symm_apply_apply] +end TorsionFreeZeroDivisors.PermutationTransport + +namespace TorsionFreeZeroDivisors.BalancedRotation +open scoped Classical BigOperators +open BlockAlignment ComparedBlocks WordPositions PermutationCycles +variable {T A : Type} [Fintype T] (w : T → List A) (cap : ℕ) (hc : 0(w t).length)) +omit [Fintype T] in +lemma transport (x : Position (len w cap hc)) : + e w cap hc (perm w cap hc x)=BoundaryRotation.perm (fun t=>(w t).length) (e w cap hc x) := by + simp only [perm,Equiv.permCongr_apply,Equiv.symm_symm,Equiv.apply_symm_apply] +lemma same_source {x y : Position (len w cap hc)} (h : x.1.1=y.1.1) : (perm w cap hc).SameCycle x y := by + have hh := BoundaryRotation.same_first (fun t=>(w t).length) (x:=e w cap hc x) (y:=e w cap hc y) h + have hp := PermutationTransport.sameCycle (e w cap hc).symm _ hh + change ((e w cap hc).symm.permCongr (BoundaryRotation.perm (fun t=>(w t).length))).SameCycle x y + simpa only [Equiv.symm_apply_apply] using hp +omit [Fintype T] in +lemma step {x : Position (len w cap hc)} (hx : x.2.val+1<(len w cap hc x.1:ℤ)) : + (perm w cap hc x).1=x.1 ∧ (perm w cap hc x).2.val=x.2.val+1 := by + have hb := bounds x.2 + let y : Position (len w cap hc) := ⟨x.1,⟨x.2.val+1,by + simp only [AffineIntervals.nat_positions,Finset.mem_Ico] + exact ⟨by omega,hx⟩⟩⟩ + have hy := bounds (e w cap hc y).2 + have hxe := value w cap hc x + have hye := value w cap hc y + dsimp only [y] at hye + have ht : (e w cap hc x).2.val+1<((w (e w cap hc x).1).length:ℤ) := by + have hy2 := hy.2 + change (e w cap hc y).2.val<((w x.1.1).length:ℤ) at hy2 + change (e w cap hc y).2.val=_+ (x.2.val+1) at hye + change (e w cap hc x).2.val+1<((w x.1.1).length:ℤ) + omega + have he : e w cap hc (perm w cap hc x)=e w cap hc y := by + rw [transport] + apply PlanarIntervals.position_ext + · exact BoundaryRotation.first _ _ + · rw [BoundaryRotation.next _ ht,hxe,hye] + omega + have he := (e w cap hc).injective he + rw [he] + exact ⟨rfl,rfl⟩ +lemma hits (x : Position (len w cap hc)) : + ∃ y∈BoundaryRotation.ends (len w cap hc),(perm w cap hc).SameCycle x y := by + have hb := bounds x.2 + let j : Fin (len w cap hc x.1) := ⟨len w cap hc x.1-1,by omega⟩ + let y := (fin (len w cap hc)).symm ⟨x.1,j⟩ + refine ⟨y,?_,same_source w cap hc rfl⟩ + apply Finset.mem_filter.mpr + refine ⟨Finset.mem_univ _,?_⟩ + change ((len w cap hc x.1-1:ℕ):ℤ)+1=len w cap hc x.1 + omega +lemma cycles_le : Fintype.card (Cycle (perm w cap hc))≤Fintype.card (BalancedWords.Piece w cap) := by + have hT : Fintype.card (Cycle (perm w cap hc))≤Fintype.card T := by + let f : Cycle (perm w cap hc) → T := fun c=>(Quotient.out c).1.1 + have hf : Function.Injective f := by + intro c d hd + have hh := same_source w cap hc hd + have he := (cycle_eq (perm w cap hc)).mpr hh + simpa only [cycle,Quotient.out_eq] using he + exact Fintype.card_le_of_injective f hf + apply hT.trans + let f : T → BalancedWords.Piece w cap := fun t=>⟨t,⟨0,BalancedPieces.number_pos hc⟩⟩ + exact Fintype.card_le_of_injective f (fun _ _ h=>congrArg Sigma.fst h) +end TorsionFreeZeroDivisors.BalancedRotation + +namespace TorsionFreeZeroDivisors.SampleGraph +open scoped Classical BigOperators +open BlockAlignment ComparedBlocks GirthAsymptotics ActualPatternEvent +variable {rep : ℕ} {r : Match rep} {x : VA rep} {y : VB rep} +/-- The full inverse-letter pairing of the original boundary words, retaining +actual graph lifts. Planarity is additional data, not asserted here. -/ +structure FullPairing (s : PathSystem rep r x y) where + perm : Equiv.Perm (Position (fun t=>(s.paths t).length)) + involutive : Function.Involutive perm + fixed_free : ∀p,perm p≠p + compatible : ∀p,label rep (RawDecomposition.dart s.paths (perm p))= + Types.inverse (label rep (RawDecomposition.dart s.paths p)) + reduced : ∀p,RawDecomposition.dart s.paths p≠RawDecomposition.dart s.paths (perm p) ∧ + RawDecomposition.dart s.paths p≠(graph rep r).reverse (RawDecomposition.dart s.paths (perm p)) +namespace FullPairing +variable {s : PathSystem rep r x y} (a : FullPairing s) (cap : ℕ) (hc : 0(s.paths t).length)) a.perm) := by + exact (PermutationTransport.mul (BalancedRotation.e s.paths cap hc).symm a.perm _).symm +lemma opposite_transport (p : Position (BalancedRotation.len s.paths cap hc)) : + BalancedRotation.e s.paths cap hc (opposite (BalancedRotation.perm s.paths cap hc) (a.α cap hc) p)= + opposite (BoundaryRotation.perm (fun t=>(s.paths t).length)) a.perm (BalancedRotation.e s.paths cap hc p) := by + change BalancedRotation.e s.paths cap hc (a.α cap hc (BalancedRotation.perm s.paths cap hc p))=_ + rw [a.transport,BalancedRotation.transport] + rfl +lemma monogons : (fixed (opposite (BalancedRotation.perm s.paths cap hc) (a.α cap hc))).card≤1 := by + have ho := BoundaryRotation.monogons_le (fun t=>(s.paths t).length) s.root + (fun p=>label rep (RawDecomposition.dart s.paths p)) Types.inverse a.perm a.involutive + a.compatible s.boundary_reduced + apply Finset.card_le_one.mpr + intro p hp q hq + simp only [fixed,Finset.mem_filter,Finset.mem_univ,true_and] at hp hq + apply (BalancedRotation.e s.paths cap hc).injective + apply Finset.card_le_one.mp ho + · simp only [fixed,Finset.mem_filter,Finset.mem_univ,true_and] + rw [←a.opposite_transport,hp] + · simp only [fixed,Finset.mem_filter,Finset.mem_univ,true_and] + rw [←a.opposite_transport,hq] +/-- Only Euler planarity is needed in the interval-count argument. This file +proves neither Euler planarity for an abstract pairing nor its PL realization. -/ +def Euler : Prop := Fintype.card (Position (fun t=>(s.paths t).length))+4≤ + 2*Fintype.card (Cycle (BoundaryRotation.perm (fun t=>(s.paths t).length)))+ + 2*Fintype.card (Cycle (opposite (BoundaryRotation.perm (fun t=>(s.paths t).length)) a.perm)) +lemma balanced_euler (h : a.Euler) : Fintype.card (Position (BalancedRotation.len s.paths cap hc))+4≤ + 2*Fintype.card (Cycle (BalancedRotation.perm s.paths cap hc))+ + 2*Fintype.card (Cycle (opposite (BalancedRotation.perm s.paths cap hc) (a.α cap hc))) := by + rw [a.opposite_eq,PermutationTransport.card_cycles] + change _≤2*Fintype.card (Cycle ((BalancedRotation.e s.paths cap hc).symm.permCongr + (BoundaryRotation.perm (fun t=>(s.paths t).length))))+_ + rw [PermutationTransport.card_cycles,Fintype.card_congr (BalancedRotation.e s.paths cap hc)] + exact h +lemma sides_le (h : a.Euler) : Fintype.card (a.Side cap hc)≤12*Fintype.card (ClosedWords.Piece s cap) := by + rw [Fintype.card_coe] + apply cuts_le_twelve + · exact a.balanced_euler cap hc h + · exact a.monogons cap hc + · exact BalancedRotation.cycles_le s.paths cap hc + · have hm := BoundaryRotation.ends_le (BalancedRotation.len s.paths cap hc) + exact hm.trans (Nat.le_add_left _ _) +end + +open scoped Classical BigOperators +open BlockAlignment ComparedBlocks GirthAsymptotics ActualPatternEvent TypedGraphs +variable {rep : ℕ} {r : Match rep} {x : VA rep} {y : VB rep} + {s : PathSystem rep r x y} (a : FullPairing s) (cap : ℕ) (hc : 0a.balanced_reduced cap hc p) (fun p _ _=>a.balanced_compatible cap hc p) +lemma closed_fixed : (Finset.univ.filter (fun p=>(a.closed cap hc hL hd).comparisons.pairing.partner p=p)).card= + ∑t,(ClosedWords.tail s cap hc hL hd t).length := + WordPositions.fixed_card (ClosedWords.seg s cap hc) (ClosedWords.tail s cap hc hL hd) + (a.comparisons cap hc) (a.α_fixed_free cap hc) +lemma closed_old (p : Position (fun t=>((a.closed cap hc hL hd).paths t).length)) + (hp : (a.closed cap hc hL hd).comparisons.pairing.partner p≠p) : + p.2.val∈positions 0 (BalancedWords.old s.paths cap p.1) := by + have hh := WordPositions.nonfixed_old (ClosedWords.seg s cap hc) (ClosedWords.tail s cap hc hL hd) + (a.comparisons cap hc) p hp + convert hh using 2 + exact_mod_cast (BalancedWords.segment_length s.paths cap hc p.1).symm +end TorsionFreeZeroDivisors.SampleGraph.FullPairing + +/-! Recursive separation. This is the actual deletion-set +construction and sharp charging estimate. The one-step Lipton–Tarjan theorem +is kept as an explicit dependency, not asserted from an unspecified planar +predicate. No claim of a completed planar realization is made here. -/ +namespace TorsionFreeZeroDivisors.RecursiveSeparator +open scoped Classical BigOperators +variable {V : Type} [DecidableEq V] (R : V → V → Prop) + +/-- Every retained vertex lies in a small set closed under all retained edges. -/ +def Small (S : Finset V) (K : ℕ) : Prop := + ∀ x∈S, ∃ T : Finset V, T⊆S ∧ x∈T ∧ T.card≤K ∧ + ∀ y∈T, ∀ z∈S, R y z → z∈T + +omit [DecidableEq V] in +lemma small_of_card {S : Finset V} {K : ℕ} (h : S.card≤K) : Small R S K := by + intro x hx + exact ⟨S,Finset.Subset.refl _,hx,h,fun _ _ _ hz _ => hz⟩ + +/-- A genuine one-step separator, including its actual components/blocks. -/ +structure Split (S : Finset V) where + remove : Finset V + parts : Finset (Finset V) + remove_subset : remove⊆S + cover : parts.biUnion id=S\remove + disjoint : (parts : Set (Finset V)).Pairwise Disjoint + closed : ∀ b∈parts,∀ x∈b,∀ y∈S\remove,R x y → y∈b + size : ∀ b∈parts,3*b.card≤2*S.card + cost : (remove.card : ℝ)≤2*Real.sqrt 2*Real.sqrt S.card + +namespace Split +variable {R} {S : Finset V} (P : Split R S) +lemma subset {b : Finset V} (hb : b∈P.parts) : b⊆S\P.remove := by + intro x hx + rw [←P.cover] + exact Finset.mem_biUnion.mpr ⟨b,hb,hx⟩ +lemma mass : (∑ b∈P.parts,b.card)+P.remove.card=S.card := by + have h := Finset.card_biUnion P.disjoint + change (P.parts.biUnion id).card=∑ b∈P.parts,b.card at h + rw [P.cover] at h + rw [←h,Finset.card_sdiff_of_subset P.remove_subset] + exact Nat.sub_add_cancel (Finset.card_le_card P.remove_subset) +lemma smaller {b : Finset V} (hb : b∈P.parts) (hS : 0 x*Real.sqrt s) hc + nlinarith only [hcs] + +namespace Split +variable {R} {S : Finset V} (P : Split R S) (D : Finset V → Finset V) +def combined : Finset V := P.remove∪P.parts.biUnion D +lemma child_deleted {b : Finset V} (hb : b∈P.parts) : D b⊆P.combined D := by + intro x hx + exact Finset.mem_union_right _ (Finset.mem_biUnion.mpr ⟨b,hb,hx⟩) +lemma combined_subset (hD : ∀ b∈P.parts,D b⊆b) : P.combined D⊆S := by + intro x hx + rcases Finset.mem_union.mp hx with hx|hx + · exact P.remove_subset hx + · obtain ⟨b,hb,hx⟩ := Finset.mem_biUnion.mp hx + exact (Finset.mem_sdiff.mp (P.subset hb (hD b hb hx))).1 +lemma combined_small {K : ℕ} (hsmall : ∀ b∈P.parts,Small R (b\D b) K) : + Small R (S\P.combined D) K := by + intro x hx + have hxS := (Finset.mem_sdiff.mp hx).1 + have hxr : x∉P.remove := fun h => (Finset.mem_sdiff.mp hx).2 (Finset.mem_union_left _ h) + have hcover : x∈P.parts.biUnion id := by rw [P.cover]; exact Finset.mem_sdiff.mpr ⟨hxS,hxr⟩ + obtain ⟨b,hb,hxb⟩ := Finset.mem_biUnion.mp hcover + have hxd : x∉D b := fun h => (Finset.mem_sdiff.mp hx).2 (P.child_deleted D hb h) + obtain ⟨T,hTb,hxT,hTK,hclosed⟩ := hsmall b hb x (Finset.mem_sdiff.mpr ⟨hxb,hxd⟩) + refine ⟨T∩(S\P.combined D),Finset.inter_subset_right,Finset.mem_inter.mpr ⟨hxT,hx⟩, + (Finset.card_le_card Finset.inter_subset_left).trans hTK,?_⟩ + intro y hy z hz hyz + have hyT := (Finset.mem_inter.mp hy).1 + have hyb := (Finset.mem_sdiff.mp (hTb hyT)).1 + have hzS := (Finset.mem_sdiff.mp hz).1 + have hzr : z∉P.remove := fun h => (Finset.mem_sdiff.mp hz).2 (Finset.mem_union_left _ h) + have hzb := P.closed b hb y hyb z (Finset.mem_sdiff.mpr ⟨hzS,hzr⟩) hyz + have hzd : z∉D b := fun h => (Finset.mem_sdiff.mp hz).2 (P.child_deleted D hb h) + exact Finset.mem_inter.mpr ⟨hclosed y hyT z (Finset.mem_sdiff.mpr ⟨hzb,hzd⟩) hyz,hz⟩ +lemma combined_card : (P.combined D).card≤P.remove.card+∑ b∈P.parts,(D b).card := by + exact (Finset.card_union_le _ _).trans (Nat.add_le_add_left (Finset.card_biUnion_le) _) +end Split + +/-- Exact recursive deletion, with a stronger potential bound used internally. -/ +theorem recursive (K : ℕ) (hK : 0 + intro S hm + by_cases hSK : S.card≤K + · refine ⟨∅,Finset.empty_subset _,?_,by simp only [ite_eq_left hSK]⟩ + simpa only [Finset.sdiff_empty] using small_of_card R hSK + have hKS : K if hb : b∈P.parts then (hchild b hb).choose else ∅ + have hD : ∀ b∈P.parts,D b⊆b ∧ Small R (b\D b) K ∧ + (if b.card≤K then D b=∅ else + ((D b).card:ℝ)≤Csep*b.card/Real.sqrt K-Csep*q*Real.sqrt b.card) := by + intro b hb + dsimp only [D] + rw [dite_eq_left hb] + exact (hchild b hb).choose_spec + refine ⟨P.combined D,P.combined_subset D (fun b hb => (hD b hb).1), + P.combined_small D (fun b hb => (hD b hb).2.1),?_⟩ + rw [ite_eq_right hSK] + have hcharge : ∀ b∈P.parts,((D b).card:ℝ)≤ + Csep*b.card/Real.sqrt K-Csep*b.card/Real.sqrt S.card := by + intro b hb + apply child_charge hK hKS (P.size b hb) + have hh := (hD b hb).2.2 + split_ifs at hh ⊢ with hc + · simp only [hh,Finset.card_empty,Nat.cast_zero] + · exact hh + have hsummass : (∑ b∈P.parts,(b.card:ℝ))=(S.card:ℝ)-P.remove.card := by + have hh : (∑ b∈P.parts,(b.card:ℝ))+(P.remove.card:ℝ)=S.card := by exact_mod_cast P.mass + linarith + have hsum : (∑ b∈P.parts,((D b).card:ℝ))≤ + Csep*((S.card:ℝ)-P.remove.card)/Real.sqrt K- + Csep*((S.card:ℝ)-P.remove.card)/Real.sqrt S.card := by + calc + _ ≤ ∑ b∈P.parts,(Csep*b.card/Real.sqrt K-Csep*b.card/Real.sqrt S.card) := + Finset.sum_le_sum hcharge + _ = _ := by rw [Finset.sum_sub_distrib,←Finset.sum_div,←Finset.mul_sum, + ←Finset.sum_div,←Finset.mul_sum,hsummass] + have hcard : ((P.combined D).card:ℝ)≤P.remove.card+∑ b∈P.parts,((D b).card:ℝ) := by + exact_mod_cast P.combined_card D + have hp := parent_charge hK hKS (Finset.card_le_card P.remove_subset) P.cost + rw [Nat.cast_sub (Finset.card_le_card P.remove_subset)] at hp + linarith only [hcard,hsum,hp] + +/-- Source recursive planar-separation bound, once the actual one-step planar +separator is supplied for every induced subgraph. -/ +theorem separator (K : ℕ) (hK : 1≤K) + (oneStep : ∀ S : Finset V,K