task_id,task_type,difficulty,difficulty_score,repo,pr_number,pr_title,pr_url,pr_labels,base_commit,merge_commit,files_changed,primary_file,problem_statement,golden_patch,loc_added,loc_deleted,loc,task_quality_score,statement_strategy,has_linked_issue,pr_body_length,files_changed_count,new_theorems_count,new_lemmas_count,new_definitions_count,proof_source,human_verified,lean_toolchain,docker_image,verification_command,timeout_seconds,verification_method,domain,created_at,created_by LB-0001,pr_completion,easy,0.44,ImperialCollegeLondon/FLT,910,fix(CI): Blueprint test driver,https://github.com/ImperialCollegeLondon/FLT/pull/910,,ed4af4822818ad935393f983051e3bf27308e855,47c2d775b991e9f8dacf77a375b02e4c0edf613a,"FLTTest.lean,FLTTest/FLTTest.lean",FLTTest.lean,"# Task: fix(CI): Blueprint test driver ## Context Checking if the band aid works in the main repo, consists of a CI step to forcibly relocate the `FLTTest.olean` for the blueprint checkdecls to see. ## Files affected - FLTTest.lean (+1/-0) - FLTTest/FLTTest.lean (+1/-0) ## Verification The patched repository must compile with `lake build`.","diff --git a/FLTTest.lean b/FLTTest.lean --- a/FLTTest.lean +++ b/FLTTest.lean @@ -1 +1,2 @@ +import FLTTest.FLTTest import FLTTest.MathlibCompatibility diff --git a/FLTTest/FLTTest.lean b/FLTTest/FLTTest.lean --- /dev/null +++ b/FLTTest/FLTTest.lean @@ -0,0 +1 @@ +import FLTTest.MathlibCompatibility",2,0,2,6.0,diff_derived,False,148,2,0,0,0,pr_merge,False,leanprover/lean4:v4.29.0,leanbench/lean4-env:4.29.0,lake build,600,lean_compiler,general,2026-04-28T12:39:47Z,extraction_pipeline_v2 LB-0002,pr_completion,easy,3.1,ImperialCollegeLondon/FLT,898,feat(Patching/Utils/CompactHausdorffRings): add partial proof that compact Hausdorff rings are totally disconnected,https://github.com/ImperialCollegeLondon/FLT/pull/898,,d346976c67e8437079ff1fd2b7878506e9ad0f37,e8c35753f741cf30ffc59dcec88b5ce4e36f37b7,"FLT.lean,FLT/Patching/Utils/AdicTopology.lean,FLT/Patching/Utils/CompactHausdorffRings.lean",FLT.lean,"# Task: feat(Patching/Utils/CompactHausdorffRings): add partial proof that compact Hausdorff rings are totally disconnected ## Context I don't have immediately plans to finish this off (since @YaelDillies is actively working in this area and has ideas for how to do things in the right generality for mathlib), so I'm putting the current state of things here. ## Files affected - FLT.lean (+1/-0) - FLT/Patching/Utils/AdicTopology.lean (+1/-0) - FLT/Patching/Utils/CompactHausdorffRings.lean (+135/-0) ## Theorems to prove ### `Group.subsingleton_of_pow_prime_eq_one` in `FLT/Patching/Utils/CompactHausdorffRings.lean` ```lean theorem Group.subsingleton_of_pow_prime_eq_one ``` Description: A connected compact Hausdorff vector space over `𝔽_p` is trivial. This might sound easy, but it ### `Group.totallyDisconnected_of_pow_prime_eq_one` in `FLT/Patching/Utils/CompactHausdorffRings.lean` ```lean theorem Group.totallyDisconnected_of_pow_prime_eq_one ``` Description: A compact Hausdorff vector space over `𝔽_p` is totally disconnected. ### `CommGroup.no_compact_automorphisms` in `FLT/Patching/Utils/CompactHausdorffRings.lean` ```lean theorem CommGroup.no_compact_automorphisms ``` Description: A connected compact Hausdorff abelian topological group does not admit a nontrivial compact ## Verification The patched repository must compile with `lake build`.","diff --git a/FLT.lean b/FLT.lean --- a/FLT.lean +++ b/FLT.lean @@ -161,6 +161,7 @@ import FLT.Patching.REqualsT import FLT.Patching.System import FLT.Patching.Ultraproduct import FLT.Patching.Utils.AdicTopology +import FLT.Patching.Utils.CompactHausdorffRings import FLT.Patching.Utils.Depth import FLT.Patching.Utils.InverseLimit import FLT.Patching.Utils.Lemmas diff --git a/FLT/Patching/Utils/AdicTopology.lean b/FLT/Patching/Utils/AdicTopology.lean --- a/FLT/Patching/Utils/AdicTopology.lean +++ b/FLT/Patching/Utils/AdicTopology.lean @@ -172,6 +172,7 @@ lemma compactSpace_of_finite_residueField [IsNoetherianRing R] [Finite (ResidueF -- TODO: `TotallyDisconnectedSpace` is unnecessary. See -- https://ncatlab.org/nlab/show/compact+Hausdorff+rings+are+profinite +-- A partial proof can be found at `FLT/Patching/Utils/CompactHausdorffRings`. omit [IsAdicTopology R] in /-- Any profinite noetherian ring has the `𝔪`-adic topology. diff --git a/FLT/Patching/Utils/CompactHausdorffRings.lean b/FLT/Patching/Utils/CompactHausdorffRings.lean --- /dev/null +++ b/FLT/Patching/Utils/CompactHausdorffRings.lean @@ -0,0 +1,135 @@ +import Mathlib.Data.Nat.Factorization.Induction +import Mathlib.GroupTheory.Divisible +import Mathlib.GroupTheory.GroupAction.Ring +import Mathlib.Topology.Algebra.Group.CompactOpen +import Mathlib.Topology.Algebra.Group.SubmonoidClosure +import Mathlib.Topology.Algebra.Ring.Ideal + +section CompactHausdorff + +/-- A connected compact Hausdorff vector space over `𝔽_p` is trivial. This might sound easy, but it +seems to require the fact that every nontrivial compact hausdorff group has a nontrivial continuous +character. This fact is a special case of Pontryagin duality, and also a consequence of the +Peter-Weyl theorem. This fact is being worked on at `YaelDillies/mean-fourier`. + +Here's a proof of the theorem, using this fact that nontrivial groups have nontrivial characters: +If `χ : A → circle` is a continuous character, then the image of `χ` is connected but is a +subgroup of the `p`th roots of unity, hence must be trivial. Thus, `A` has no nontrivial continuous +characters, so `A` must be trivial. -/ +@[to_additive] +theorem Group.subsingleton_of_pow_prime_eq_one + (A : Type*) [CommGroup A] [TopologicalSpace A] [IsTopologicalGroup A] + [ConnectedSpace A] [CompactSpace A] [T2Space A] + (p : ℕ) (hp : p.Prime) (hAp : ∀ a : A, a ^ p = 1) : + Subsingleton A := by + sorry + +/-- A compact Hausdorff vector space over `𝔽_p` is totally disconnected. -/ +@[to_additive] +theorem Group.totallyDisconnected_of_pow_prime_eq_one + (A : Type*) [CommGroup A] [TopologicalSpace A] [IsTopologicalGroup A] + [T2Space A] [CompactSpace A] (p : ℕ) (hp : p.Prime) (hA : ∀ a : A, a ^ p = 1) : + TotallyDisconnectedSpace A := by + have : ConnectedSpace (Subgroup.connectedComponentOfOne A) := + Subtype.connectedSpace isConnected_connectedComponent + have : CompactSpace (Subgroup.connectedComponentOfOne A) := + isCompact_iff_compactSpace.mp (isClosed_connectedComponent.isCompact) + have := subsingleton_of_pow_prime_eq_one (Subgroup.connectedComponentOfOne A) p hp + fun a ↦ Subtype.ext (hA a) + rw [totallyDisconnectedSpace_iff_connectedComponent_one] + exact ((Set.subsingleton_coe _).mp this).eq_singleton_of_mem mem_connectedComponent + +/-- A connected compact Hausdorff abelian topological group is divisible. -/ +@[to_additive /-- A connected compact Hausdorff abelian topological group is divisible. -/, + implicit_reducible] +noncomputable def Group.rootable + (A : Type*) [CommGroup A] [TopologicalSpace A] [IsTopologicalGroup A] + [ConnectedSpace A] [CompactSpace A] [T2Space A] : RootableBy A ℕ := by + apply rootableByOfPowLeftSurj + suffices ∀ p : ℕ, p.Prime → Function.Surjective fun a : A ↦ a ^ p by + apply Nat.prime_composite_induction + · simp + · simpa using Function.surjective_id + · grind + · intro a _ ha b _ hb _ + simp only [pow_mul] + exact (hb (by grind)).comp (ha (by grind)) + intro p hp + let f : A →* A := powMonoidHom p + change Function.Surjective f + have hf : ∀ a : A ⧸ f.range, a ^ p = 1 := by + intro a + obtain ⟨a, rfl⟩ := QuotientGroup.mk_surjective a + rw [← QuotientGroup.mk_pow, QuotientGroup.eq_one_iff] + exact ⟨a, rfl⟩ + have : IsClosed (f.range : Set A) := (isCompact_range (continuous_pow p)).isClosed + have := totallyDisconnected_of_pow_prime_eq_one (A ⧸ f.range) p hp hf + have : ConnectedSpace (A ⧸ f.range) := + QuotientGroup.mk_surjective.connectedSpace QuotientGroup.continuous_mk + rw [← MonoidHom.range_eq_top, ← QuotientGroup.subsingleton_iff] + exact subsingleton_of_preconnected_totallyDisconnected + +/-- A connected compact Hausdorff abelian topological group does not admit a nontrivial compact +group of automorphisms. -/ +@[to_additive] +theorem CommGroup.no_compact_automorphisms + {A : Type*} [CommGroup A] [TopologicalSpace A] [IsTopologicalGroup A] + [ConnectedSpace A] [CompactSpace A] [T2Space A] (K : Subgroup (ContinuousMonoidHom A A)) + (hK : IsCompact (K : Set (ContinuousMonoidHom A A))) : + K = ⊥ := by + have A_rootable : RootableBy A ℕ := Group.rootable A + rw [eq_bot_iff] + intro f hf + ext a + rw [ContinuousMonoidHom.one_toFun] + by_contra! ha + let U : Set A := {f a}ᶜ + have hU : IsOpen U := isOpen_compl_singleton + have hU1 : 1 ∈ U := ha.symm + let W : Set (A →ₜ* A) := {f | Set.MapsTo f Set.univ U} + have hW : IsOpen W := + (ContinuousMonoidHom.isInducing_toContinuousMap A A).continuous.isOpen_preimage _ + (ContinuousMap.isOpen_setOf_mapsTo isCompact_univ hU) + have hW1 : 1 ∈ W := by simpa [W] + replace hW1 : W ∈ nhds 1 := hW.mem_nhds hW1 + have : CompactSpace K := isCompact_iff_compactSpace.mp hK + obtain ⟨n, hn0, hnf⟩ := + (mapClusterPt_iff_frequently.mp (mapClusterPt_one_atTop_pow ⟨f, hf⟩) (Subtype.val ⁻¹' W) + (continuousAt_subtype_val.preimage_mem_nhds (by exact hW1))).forall_exists_of_atTop 1 + replace hn0 : n ≠ 0 := by grind + rw [Set.mem_preimage, Subgroup.coe_pow, Subtype.coe_mk, + Set.mem_setOf_eq, Set.mapsTo_univ_iff, ← Set.range_subset_iff] at hnf + change (f ^ n).range ≤ U at hnf + suffices f.range ≤ (f ^ n).range by + exact (Set.Subset.trans this hnf) ⟨a, rfl⟩ rfl + rintro - ⟨b, rfl⟩ + use RootableBy.root b n + simp [ContinuousMonoidHom.pow_apply, ← map_pow, RootableBy.root_cancel b hn0] + +/-- A compact Hausdorff ring is totally disconnected. -/ +instance {R : Type*} [Ring R] [TopologicalSpace R] [IsTopologicalRing R] + [CompactSpace R] [T2Space R] : TotallyDisconnectedSpace R := by + let C₀ : Ideal R := Ideal.connectedComponentOfZero R + suffices C₀ = ⊥ from + totallyDisconnectedSpace_iff_connectedComponent_zero.mpr (SetLike.ext'_iff.mp this) + have C₀_isClosed : IsClosed (C₀ : Set R) := isClosed_connectedComponent + have C₀_isCompact : IsCompact (C₀ : Set R) := C₀_isClosed.isCompact + have : CompactSpace C₀ := isCompact_iff_compactSpace.mp C₀_isCompact + have C₀_isConnected : IsConnected (C₀ : Set R) := isConnected_connectedComponent + have : ConnectedSpace C₀ := isConnected_iff_connectedSpace.mp C₀_isConnected + let f : ContinuousAddMonoidHom R (ContinuousAddMonoidHom C₀ C₀) := + { toFun r := + { toFun := fun c ↦ r • c + map_zero' := by simp + map_add' := by simp [smul_add] + continuous_toFun := by fun_prop } + map_zero' := by apply DFunLike.ext; intros; apply zero_smul + map_add' := by intros; apply DFunLike.ext; intros; apply add_smul + continuous_toFun := ContinuousAddMonoidHom.continuous_of_continuous_uncurry _ continuous_smul } + have key := AddCommGroup.no_compact_automorphisms f.range (isCompact_range f.continuous) + refine eq_bot_iff.mpr fun c hc ↦ ?_ + replace key : f.toAddMonoidHom 1 ⟨c, hc⟩ = (0 : ContinuousAddMonoidHom C₀ C₀) ⟨c, hc⟩ := by + rw [AddMonoidHom.range_eq_bot_iff.mp key, AddMonoidHom.zero_apply] + exact (one_smul R c).symm.trans (Subtype.ext_iff.mp key) + +end CompactHausdorff",137,0,137,8.0,diff_derived,False,224,3,3,0,0,pr_merge,False,leanprover/lean4:v4.29.0,leanbench/lean4-env:4.29.0,lake build,600,lean_compiler,algebra,2026-04-28T12:39:47Z,extraction_pipeline_v2 LB-0003,pr_completion,easy,1.6,ImperialCollegeLondon/FLT,887,fix: finiteness files in `4.29` bump,https://github.com/ImperialCollegeLondon/FLT/pull/887,,4554fdf0c9ff937384bda4692e603572c6adb7f0,504213abdafa05a5508d31f25b03dc9fc3c09e99,"FLT/AutomorphicForm/QuaternionAlgebra/FiniteDimensional.lean,FLT/DivisionAlgebra/Finiteness.lean,FLT/Mathlib/MeasureTheory/Haar/Extension.lean",FLT/AutomorphicForm/QuaternionAlgebra/FiniteDimensional.lean,"# Task: fix: finiteness files in `4.29` bump ## Context - A couple more `maxHeartbeats 0` required - Remove upstreamed material in `MeasureTheory.Haar.Extension` ## Files affected - FLT/AutomorphicForm/QuaternionAlgebra/FiniteDimensional.lean (+1/-0) - FLT/DivisionAlgebra/Finiteness.lean (+76/-9) - FLT/Mathlib/MeasureTheory/Haar/Extension.lean (+8/-289) ## Verification The patched repository must compile with `lake build`.","diff --git a/FLT/AutomorphicForm/QuaternionAlgebra/FiniteDimensional.lean b/FLT/AutomorphicForm/QuaternionAlgebra/FiniteDimensional.lean --- a/FLT/AutomorphicForm/QuaternionAlgebra/FiniteDimensional.lean +++ b/FLT/AutomorphicForm/QuaternionAlgebra/FiniteDimensional.lean @@ -28,6 +28,7 @@ open TotallyDefiniteQuaternionAlgebra -- functions, or something. Perhaps some of these hypotheses might need to be re-added -- later on. +set_option backward.isDefEq.respectTransparency false in -- If it's any help, the below argument will also show that the space of forms is -- finitely-generated if `K` is an arbitrary Noetherian ring. /-- diff --git a/FLT/DivisionAlgebra/Finiteness.lean b/FLT/DivisionAlgebra/Finiteness.lean --- a/FLT/DivisionAlgebra/Finiteness.lean +++ b/FLT/DivisionAlgebra/Finiteness.lean @@ -75,6 +75,7 @@ abbrev Dinf := D ⊗[K] (NumberField.InfiniteAdeleRing K) /-- Dinfx is notation for (D ⊗ 𝔸_K^∞)ˣ -/ abbrev Dinfx := (Dinf K D)ˣ +set_option backward.isDefEq.respectTransparency false in /-- The inclusion Dˣ → D_𝔸ˣ as a group homomorphism. -/ abbrev incl : Dˣ →* D_𝔸ˣ := Units.map Algebra.TensorProduct.includeLeftRingHom.toMonoidHom @@ -104,9 +105,11 @@ instance : IsScalarTower ℝ (InfiniteAdeleRing K) (Dinf K D) := variable [FiniteDimensional K D] +set_option backward.isDefEq.respectTransparency false in /-- We put the Borel measurable space structure on D_𝔸 in this file. -/ instance : MeasurableSpace D_𝔸 := borel _ +set_option backward.isDefEq.respectTransparency false in instance : BorelSpace D_𝔸 := ⟨rfl⟩ instance : Module.Finite ℝ (Dinf K D) := @@ -149,20 +152,24 @@ abbrev D_iso : (D ≃ₗ[K] ((Fin (Module.finrank K D) → K))) := Module.Finite -- Mathlib#29315.... attribute [local instance 1100] IsTopologicalSemiring.toIsModuleTopology +set_option backward.isDefEq.respectTransparency false in -- ...makes this work example : IsModuleTopology (AdeleRing (𝓞 K) K) ((Fin (Module.finrank K D) → AdeleRing (𝓞 K) K)) := inferInstance +set_option backward.isDefEq.respectTransparency false in /-- The 𝔸_K-algebra equivalence of D_𝔸 and 𝔸_K^d. -/ abbrev D𝔸_iso : (D_𝔸 ≃ₗ[(AdeleRing (𝓞 K) K)] ((Fin (Module.finrank K D) → AdeleRing (𝓞 K) K))) := ((TensorProduct.RightActions.Module.TensorProduct.comm _ _ _).symm).trans (TensorProduct.AlgebraTensorModule.finiteEquivPi K D (AdeleRing (𝓞 K) K)) +set_option backward.isDefEq.respectTransparency false in /-- The topological 𝔸_K-linear equivalence D_𝔸 ≃ 𝔸_K^d. -/ abbrev D𝔸_iso_top : D_𝔸 ≃L[(AdeleRing (𝓞 K) K)] ((Fin (Module.finrank K D) → AdeleRing (𝓞 K) K)) := IsModuleTopology.continuousLinearEquiv (D𝔸_iso K D) +set_option backward.isDefEq.respectTransparency false in theorem D_discrete_aux (U : Set (Fin (Module.finrank K D) → AdeleRing (𝓞 K) K)) : incl_Kn_𝔸Kn K D ⁻¹' U = (D_iso K D) '' @@ -179,6 +186,7 @@ theorem D_discrete_aux (U : Set (Fin (Module.finrank K D) → AdeleRing (𝓞 K) simp [← Algebra.algebraMap_eq_smul_one] simpa [← hy2, this] using hy1 +set_option backward.isDefEq.respectTransparency false in theorem D_discrete : ∀ x : D, ∃ U : Set D_𝔸, IsOpen U ∧ (Algebra.TensorProduct.includeLeft : D →ₐ[K] D_𝔸) ⁻¹' U = {x} := by apply Discrete_of_HomeoDiscrete (Y' := ((Fin (Module.finrank K D) → AdeleRing (𝓞 K) K))) @@ -187,10 +195,12 @@ theorem D_discrete : ∀ x : D, ∃ U : Set D_𝔸, ((D𝔸_iso_top K D) ∘ (Algebra.TensorProduct.includeLeft : D →ₐ[K] D_𝔸)) (D_iso K D) simpa [D_discrete_aux] using Kn_discrete K D +set_option backward.isDefEq.respectTransparency false in /-- The additive subgroup D of D_𝔸. -/ def includeLeft_subgroup : AddSubgroup D_𝔸 := AddMonoidHom.range (G := D) (Algebra.TensorProduct.includeLeft : D →ₐ[K] D_𝔸) +set_option backward.isDefEq.respectTransparency false in instance discrete_includeLeft_subgroup : DiscreteTopology (includeLeft_subgroup K D).carrier := by rw [includeLeft_subgroup, discreteTopology_iff_isOpen_singleton] @@ -206,6 +216,7 @@ instance discrete_includeLeft_subgroup : simp [Set.ext_iff] at hUeq grind +set_option backward.isDefEq.respectTransparency false in instance : T2Space (D ⊗[K] AdeleRing (𝓞 K) K) := IsModuleTopology.t2Space (AdeleRing (𝓞 K) K) instance discrete_principalSubgroup : @@ -222,6 +233,7 @@ instance discrete_principalSubgroup : simp [Set.ext_iff] at hU grind +set_option backward.isDefEq.respectTransparency false in -- we seem to have this twice? instance compact_includeLeft_subgroup : CompactSpace (D_𝔸 ⧸ (includeLeft_subgroup K D)) := by @@ -239,7 +251,7 @@ instance compact_includeLeft_subgroup : have : DiscreteTopology (principalSubgroup (𝓞 K) K : Set (AdeleRing (𝓞 K) K)) := discrete_principalSubgroup K have key := TopologicalAddGroup.IsSES.ofClosedAddSubgroup (principalSubgroup (𝓞 K) K) - exact IsOpenQuotientMap.piMap (fun _ ↦ key.isOpenQuotientMap) + exact IsOpenQuotientMap.piMap (fun _ ↦ (key AddSubgroup.isClosed_of_discrete).isOpenQuotientMap) let φ : (Fin (Module.finrank K D) → AdeleRing (𝓞 K) K) →+ (D_𝔸 ⧸ H) := AddMonoidHom.comp (QuotientAddGroup.mk' _) (D𝔸_iso_top K D).symm.toAddMonoidHom have hφ0 : π.ker ≤ φ.ker := by @@ -268,6 +280,7 @@ instance compact_includeLeft_subgroup : rw [← isCompact_univ_iff, ← Set.image_univ_of_surjective hf2] exact isCompact_univ.image hf1 +set_option backward.isDefEq.respectTransparency false in open scoped NNReal in lemma not_injective_of_large_measure : ∃ B : ℝ≥0, ∀ U : Set D_𝔸, IsOpen U → B < MeasureTheory.Measure.addHaar U → @@ -282,6 +295,7 @@ lemma not_injective_of_large_measure : ∃ B : ℝ≥0, ∀ U : Set D_𝔸, section FiniteAdeleRing +set_option backward.isDefEq.respectTransparency false in /-- The K-algebra isomorphism `D_𝔸 ≃ D_∞ × D_f` -- adelic D is infinite adele D times finite adele D. -/ abbrev D𝔸_prodRight : D_𝔸 ≃ₐ[K] Dinf K D × Df K D := @@ -311,6 +325,7 @@ instance [FiniteDimensional K D] : IsModuleTopology (AdeleRing (𝓞 K) K) (Dinf K D × Df K D) := IsModuleTopology.instProd' +set_option backward.isDefEq.respectTransparency false in /-- The 𝔸_K linear map `D_𝔸 ≃ D_∞ × D_f`. -/ abbrev D𝔸_prodRight' : D_𝔸 ≃ₗ[AdeleRing (𝓞 K) K] (Dinf K D × Df K D) := { toFun := D𝔸_prodRight K D @@ -327,25 +342,28 @@ abbrev D𝔸_prodRight' : D_𝔸 ≃ₗ[AdeleRing (𝓞 K) K] (Dinf K D × Df K rfl } +set_option backward.isDefEq.respectTransparency false in /-- The continuous additive isomorphism `D_𝔸 ≃ D_∞ × D_f`. -/ abbrev D𝔸_prodRight'' : D_𝔸 ≃ₜ+ Dinf K D × Df K D where __ := D𝔸_prodRight K D continuous_toFun := IsModuleTopology.continuous_of_linearMap (D𝔸_prodRight' K D).toLinearMap continuous_invFun := IsModuleTopology.continuous_of_linearMap (D𝔸_prodRight' K D).symm.toLinearMap +set_option backward.isDefEq.respectTransparency false in /-- The equivalence of the units of D_𝔸 and the product of the units of (D ⊗ 𝔸_K^f) and (D ⊗ 𝔸_K^∞). -/ abbrev D𝔸_prodRight_units : D_𝔸ˣ ≃* (Dinfx K D) × (Dfx K D) := (Units.mapEquiv (D𝔸_prodRight K D)).trans (MulEquiv.prodUnits) +set_option backward.isDefEq.respectTransparency false in omit [FiniteDimensional K D] in lemma smul_D𝔸_prodRight_symm (a : (Dinf K D)ˣ) (b : (Df K D)ˣ) (di : Dinf K D) (df : Df K D) : ((D𝔸_prodRight_units K D).symm (a, b)) • ((D𝔸_prodRight K D).symm (di, df)) = (D𝔸_prodRight K D).symm (a • di, b • df) := (map_mul _ _ _).symm - +set_option backward.isDefEq.respectTransparency false in lemma D𝔸_prodRight_units_cont : Continuous (D𝔸_prodRight_units K D) := by rw [ MulEquiv.coe_trans] -- annoying that fun_prop and continuity can't seem to do this @@ -359,13 +377,15 @@ lemma D𝔸_prodRight_units_cont : Continuous (D𝔸_prodRight_units K D) := by · apply Continuous.units_map exact IsModuleTopology.continuous_of_linearMap (D𝔸_prodRight' K D).toLinearMap +set_option backward.isDefEq.respectTransparency false in lemma ringHaarChar_D𝔸 (a : Dinfx K D) (b : Dfx K D) : ringHaarChar ((D𝔸_prodRight_units K D).symm (a, b)) = ringHaarChar (MulEquiv.prodUnits.symm (a, b)) := by apply MeasureTheory.addEquivAddHaarChar_eq_addEquivAddHaarChar_of_continuousAddEquiv (D𝔸_prodRight'' K D) simp [MulEquivClass.map_mul] +set_option backward.isDefEq.respectTransparency false in /-- For any positive real `r`, there's some `ρ ∈ ℝˣ` such that the haar character of `(ρ, 1) ∈ D_f × D_∞` is `r`. -/ lemma ringHaarChar_D𝔸_real_surjective (r : ℝ) (h : r > 0) : @@ -401,6 +421,8 @@ variable [FiniteDimensional K D] instance (vi : InfinitePlace K) : SecondCountableTopology (D ⊗[K] vi.Completion) := Module.Finite.secondCountabletopology vi.Completion _ +set_option synthInstance.maxHeartbeats 0 in +set_option maxHeartbeats 0 in variable [(vi : InfinitePlace K) → MeasurableSpace (D ⊗[K] vi.Completion)] [(vi : InfinitePlace K) → BorelSpace (D ⊗[K] vi.Completion)] in @@ -451,18 +473,21 @@ omit [NumberField K] in lemma algebraMap_completion_def (vi : InfinitePlace K) : (algebraMap ℝ vi.Completion) = (real_to_completion K vi) := rfl +set_option backward.isDefEq.respectTransparency false in instance (vi : InfinitePlace K) : Module.Finite ℝ vi.Completion := by by_cases h : vi.IsReal · let e : vi.Completion ≃ₗ[ℝ] ℝ := { __ := InfinitePlace.Completion.ringEquivRealOfIsReal h map_smul' r x := by - simp_all [Algebra.smul_def, algebraMap_completion_def, real_to_completion, ↓reduceDIte] + simp_all [Algebra.smul_def, algebraMap_completion_def, real_to_completion, ↓reduceDIte, + -InfinitePlace.Completion.ringEquivRealOfIsReal_apply] } exact Module.Finite.of_injective _ e.injective · let e : vi.Completion ≃ₗ[ℝ] ℂ := { __ := InfinitePlace.Completion.ringEquivComplexOfIsComplex (by simpa using h) map_smul' r x := by - simp_all [Algebra.smul_def, algebraMap_completion_def, real_to_completion, ↓reduceDIte] + simp_all [Algebra.smul_def, algebraMap_completion_def, real_to_completion, ↓reduceDIte, + -InfinitePlace.Completion.ringEquivComplexOfIsComplex_apply] } exact Module.Finite.of_injective _ e.injective @@ -476,6 +501,7 @@ instance (vi : InfinitePlace K) : ContinuousSMul ℝ vi.Completion := by (by simpa using h)).symm.isometry_toFun.continuous.comp Complex.continuous_ofReal simpa only [real_to_completion, h, ↓reduceDIte] +set_option backward.isDefEq.respectTransparency false in instance (vi : InfinitePlace K) : IsModuleTopology ℝ vi.Completion := isModuleTopologyOfFiniteDimensional @@ -485,13 +511,15 @@ instance (vi : InfinitePlace K) : Algebra ℝ (D ⊗[K] vi.Completion) := instance (vi : InfinitePlace K) : IsScalarTower ℝ vi.Completion (D ⊗[K] vi.Completion) := IsScalarTower.of_compHom .. +set_option backward.isDefEq.respectTransparency false in instance (vi : InfinitePlace K) : IsModuleTopology ℝ (D ⊗[K] vi.Completion) := by rw [IsModuleTopology.trans ℝ vi.Completion] infer_instance instance : IsModuleTopology ℝ (Π vi : InfinitePlace K, (D ⊗[K] vi.Completion)) := IsModuleTopology.instPi +set_option backward.isDefEq.respectTransparency false in omit [NumberField K] in lemma algebraMap_completion {vi : InfinitePlace K} {x : ℝ} : (algebraMap ℝ (InfiniteAdeleRing K)) x vi = (algebraMap ℝ vi.Completion) x := by @@ -508,6 +536,7 @@ lemma algebraMap_completion {vi : InfinitePlace K} {x : ℝ} : end RealAlgebra +set_option backward.isDefEq.respectTransparency false in omit [NumberField K] in lemma tensorPi_equiv_piTensor_map_mul {x y : Dinf K D} : tensorPi_equiv_piTensor K D InfinitePlace.Completion (x * y) @@ -526,6 +555,7 @@ lemma tensorPi_equiv_piTensor_map_mul {x y : Dinf K D} : funext vi simp [Dinf, InfiniteAdeleRing, tensorPi_equiv_piTensor_apply] +set_option backward.isDefEq.respectTransparency false in /-- `tensorPi_equiv_piTensor` applied to `Dinf`, as a `ℝ`-linear equiv. -/ def Dinf_tensorPi_equiv_piTensor_aux : (Dinf K D) ≃ₗ[ℝ] Π vi : InfinitePlace K, (D ⊗[K] vi.Completion) := { @@ -562,6 +592,8 @@ def Dinf_tensorPi_equiv_piTensor_mulEquiv : map_mul' _ _ := tensorPi_equiv_piTensor_map_mul .. } +set_option maxHeartbeats 0 in +set_option synthInstance.maxHeartbeats 0 in open scoped NumberField.AdeleRing in lemma isCentralSimple_infinite_addHaarScalarFactor_left_mul_eq_right_mul [Algebra.IsCentral K D] (u : (Dinf K D)ˣ) : @@ -607,6 +639,7 @@ local instance : MeasurableSpace ((FiniteAdeleRing (𝓞 K) K) ⊗[K] D) := bore local instance : BorelSpace ((FiniteAdeleRing (𝓞 K) K) ⊗[K] D) := ⟨rfl⟩ +set_option backward.isDefEq.respectTransparency false in open scoped TensorProduct.RightActions in lemma isCentralSimple_addHaarScalarFactor_left_mul_eq_right_mul [Algebra.IsCentral K D] (u : D_𝔸ˣ) : @@ -661,6 +694,7 @@ end auxiliary_defs open scoped Pointwise +set_option backward.isDefEq.respectTransparency false in open InfinitePlace.Completion Set Rat RestrictedProduct in /-- An auxiliary definition of an increasing family of compact subsets of D_𝔸, defined as the product of a compact neighbourhood of 0 @@ -670,11 +704,13 @@ at the infinite places. def Efamily (r : ℝ) : Set (D_𝔸) := (D𝔸_prodRight'' K D).symm '' (r • Ui K D) ×ˢ (Uf K D) +set_option backward.isDefEq.respectTransparency false in lemma E_family_compact (r : ℝ) : IsCompact (Efamily K D r) := by refine IsCompact.image ?_ (by fun_prop) refine IsCompact.prod ?_ (Uf.spec K D).1 exact IsCompact.image (Ui.spec K D).1 (show Continuous (fun x ↦ r • x) by fun_prop) +set_option backward.isDefEq.respectTransparency false in lemma E_family_nonempty_interior : (interior (Efamily K D 1)).Nonempty := by unfold Efamily rw [one_smul] @@ -684,6 +720,7 @@ lemma E_family_nonempty_interior : (interior (Efamily K D 1)).Nonempty := by rw [mem_interior_iff_mem_nhds, Prod.zero_eq_mk, mem_nhds_prod_iff] exact ⟨Ui K D, (Ui.spec K D).2, Uf K D, (Uf.spec K D).2, subset_rfl⟩ +set_option backward.isDefEq.respectTransparency false in open NNReal ENNReal in lemma E_family_unbounded (B : ℝ≥0) : ∃ r, MeasureTheory.Measure.addHaar (Efamily K D r) > B := by @@ -748,6 +785,7 @@ lemma E_family_unbounded (B : ℝ≥0) : exact mt (NNReal.eq (m := 0)) hm · linarith +set_option backward.isDefEq.respectTransparency false in lemma existsE : ∃ E : Set (D_𝔸), IsCompact E ∧ ∀ φ : D_𝔸 ≃ₜ+ D_𝔸, addEquivAddHaarChar φ = 1 → ∃ e₁ ∈ E, ∃ e₂ ∈ E, e₁ ≠ e₂ ∧ φ e₁ - φ e₂ ∈ Set.range (Algebra.TensorProduct.includeLeft : D →ₐ[K] D_𝔸) := by @@ -774,13 +812,16 @@ lemma existsE : ∃ E : Set (D_𝔸), IsCompact E ∧ /-- An auxiliary set E used in the proof of Fujisaki's lemma. -/ def E : Set D_𝔸 := (existsE K D).choose +set_option backward.isDefEq.respectTransparency false in lemma E_compact : IsCompact (E K D) := (existsE K D).choose_spec.1 +set_option backward.isDefEq.respectTransparency false in lemma E_noninjective_left {x : D_𝔸ˣ} (h : x ∈ ringHaarChar_ker D_𝔸) : ∃ e₁ ∈ E K D, ∃ e₂ ∈ E K D, e₁ ≠ e₂ ∧ x * e₁ - x * e₂ ∈ Set.range (Algebra.TensorProduct.includeLeft : D →ₐ[K] D_𝔸) := (existsE K D).choose_spec.2 (ContinuousAddEquiv.mulLeft x) h +set_option backward.isDefEq.respectTransparency false in lemma E_noninjective_right [Algebra.IsCentral K D] {x : D_𝔸ˣ} (h : x ∈ ringHaarChar_ker D_𝔸) : ∃ e₁ ∈ E K D, ∃ e₂ ∈ E K D, e₁ ≠ e₂ ∧ e₁ * x⁻¹ - e₂ * x⁻¹ ∈ Set.range (Algebra.TensorProduct.includeLeft : D →ₐ[K] D_𝔸) := by @@ -798,14 +839,17 @@ open scoped Pointwise in /-- An auxiliary set Y used in the proof of Fukisaki's lemma. Defined as X * X. -/ def Y : Set D_𝔸 := X K D * X K D +set_option backward.isDefEq.respectTransparency false in lemma X_compact : IsCompact (X K D) := by simpa only [Set.image_prod, Set.image2_sub] using (IsCompact.image_of_continuousOn ((E_compact K D).prod (E_compact K D)) ((continuous_fst.sub continuous_snd).continuousOn)) +set_option backward.isDefEq.respectTransparency false in lemma Y_compact : IsCompact (Y K D) := by simpa only [Pi.mul_def, Set.image_prod, Set.image2_mul, Y] using (IsCompact.image_of_continuousOn ((X_compact K D).prod (X_compact K D)) ((continuous_fst.mul continuous_snd).continuousOn)) +set_option backward.isDefEq.respectTransparency false in lemma X_meets_kernel {β : D_𝔸ˣ} (hβ : β ∈ ringHaarChar_ker D_𝔸) : ∃ x ∈ X K D, ∃ d ∈ Set.range (incl K D : Dˣ → D_𝔸ˣ), β * x = d := by obtain ⟨e1, he1, e2, he2, noteq, b, hb⟩ := E_noninjective_left K D hβ @@ -819,6 +863,7 @@ lemma X_meets_kernel {β : D_𝔸ˣ} (hβ : β ∈ ringHaarChar_ker D_𝔸) : simp only [← hb, TensorProduct.zero_tmul, ne_eq, not_true_eq_false] at h1 exact ⟨incl K D b1, ⟨b1, rfl⟩, by simpa [mul_sub] using hb.symm⟩ +set_option backward.isDefEq.respectTransparency false in lemma X_meets_kernel' [Algebra.IsCentral K D] {β : D_𝔸ˣ} (hβ : β ∈ ringHaarChar_ker D_𝔸) : ∃ x ∈ X K D, ∃ d ∈ Set.range (incl K D : Dˣ → D_𝔸ˣ), x * β⁻¹ = d := by obtain ⟨e1, he1, e2, he2, noteq, b, hb⟩ := E_noninjective_right K D hβ @@ -832,9 +877,11 @@ lemma X_meets_kernel' [Algebra.IsCentral K D] {β : D_𝔸ˣ} (hβ : β ∈ ring simp only [← hb, TensorProduct.zero_tmul, ne_eq, not_true_eq_false] at h1 exact ⟨incl K D b1, ⟨b1, rfl⟩, by simpa [sub_mul] using hb.symm⟩ +set_option backward.isDefEq.respectTransparency false in /-- An auxiliary set T used in the proof of Fukisaki's lemma. Defined as Y ∩ Dˣ. -/ def T : Set D_𝔸ˣ := ((↑) : D_𝔸ˣ → D_𝔸) ⁻¹' (Y K D) ∩ Set.range ((incl K D : Dˣ → D_𝔸ˣ)) +set_option backward.isDefEq.respectTransparency false in lemma T_finite_extracted1 : IsCompact (Y K D ∩ Set.range (Algebra.TensorProduct.includeLeft : D →ₐ[K] D_𝔸)) := by refine IsCompact.inter_right (Y_compact K D) ?_ @@ -843,6 +890,7 @@ lemma T_finite_extracted1 : IsCompact (Y K D ∩ simpa [includeLeft_subgroup] using AddSubgroup.isClosed_of_discrete (H := includeLeft_subgroup K D) +set_option backward.isDefEq.respectTransparency false in lemma T_finite : Set.Finite (T K D) := by have h := IsCompact.finite (T_finite_extracted1 K D) ⟨(inter_Discrete (includeLeft_subgroup K D).carrier (Y K D))⟩ @@ -853,10 +901,12 @@ lemma T_finite : Set.Finite (T K D) := by exact Set.Finite.of_finite_image (Set.Finite.subset h h1) (Function.Injective.injOn Units.val_injective) +set_option backward.isDefEq.respectTransparency false in open scoped Pointwise in /-- An auxiliary set C used in the proof of Fukisaki's lemma. Defined as T⁻¹X × X. -/ def C : Set (D_𝔸 × D_𝔸) := ((((↑) : D_𝔸ˣ → D_𝔸) '' (T K D)⁻¹) * X K D) ×ˢ X K D +set_option backward.isDefEq.respectTransparency false in lemma C_compact : IsCompact (C K D) := by refine IsCompact.prod ?_ (X_compact K D) simpa only [Pi.mul_def, Set.image_prod, Set.image2_mul] using @@ -865,6 +915,7 @@ lemma C_compact : IsCompact (C K D) := by (Units.continuous_val) (continuousOn_id' (T K D)⁻¹))) (X_compact K D)) ((continuous_fst.mul continuous_snd).continuousOn)) +set_option backward.isDefEq.respectTransparency false in lemma antidiag_mem_C [Algebra.IsCentral K D] {β : D_𝔸ˣ} (hβ : β ∈ ringHaarChar_ker D_𝔸) : ∃ b ∈ Set.range (incl K D : Dˣ → D_𝔸ˣ), ∃ ν ∈ ringHaarChar_ker D_𝔸, @@ -886,25 +937,28 @@ lemma antidiag_mem_C [Algebra.IsCentral K D] {β : D_𝔸ˣ} (hβ : β ∈ ringH simp_rw [(Eq.symm (inv_mul_eq_of_eq_mul (eq_mul_inv_of_mul_eq ht1)))] exact Set.mem_mul.mpr ⟨↑t⁻¹, Set.mem_image_of_mem Units.val ht, x2, hx2, rfl⟩ - - +set_option backward.isDefEq.respectTransparency false in /-- The inclusion of `ringHaarChar_ker D_𝔸` into the product space `D_𝔸 × D_𝔸ᵐᵒᵖ`. -/ def incl₂ : ringHaarChar_ker D_𝔸 → Prod D_𝔸 D_𝔸ᵐᵒᵖ := fun u => Units.embedProduct D_𝔸 (Subgroup.subtype (ringHaarChar_ker D_𝔸) u) +set_option backward.isDefEq.respectTransparency false in /-- An auxiliary set used in the proof of compact_quotient'. -/ def M : Set (ringHaarChar_ker D_𝔸) := Set.preimage (incl₂ K D) (Set.image (fun p => (p.1, MulOpposite.op p.2)) (Aux.C K D)) +set_option backward.isDefEq.respectTransparency false in /-- The map from `ringHaarChar_ker D_𝔸` to the quotient `Dˣ \ ringHaarChar_ker D_𝔸`. -/ abbrev toQuot (a : ringHaarChar_ker D_𝔸) : (_root_.Quotient (QuotientGroup.rightRel ((MonoidHom.range (incl K D)).comap (ringHaarChar_ker D_𝔸).subtype))) := (Quotient.mk (QuotientGroup.rightRel ((MonoidHom.range (incl K D)).comap (ringHaarChar_ker D_𝔸).subtype)) a) +set_option backward.isDefEq.respectTransparency false in lemma toQuot_cont : Continuous (toQuot K D) where isOpen_preimage := fun _ a ↦ a +set_option backward.isDefEq.respectTransparency false in lemma toQuot_surjective [Algebra.IsCentral K D] : (toQuot K D) '' (M K D) = Set.univ := by rw [Set.eq_univ_iff_forall] rintro ⟨a, ha⟩ @@ -927,6 +981,7 @@ lemma toQuot_surjective [Algebra.IsCentral K D] : (toQuot K D) '' (M K D) = Set. rw [this] rfl +set_option backward.isDefEq.respectTransparency false in lemma incl₂_isClosedEmbedding : Topology.IsClosedEmbedding (incl₂ K D) := by apply Units.isClosedEmbedding_embedProduct.comp refine Topology.IsClosedEmbedding.of_continuous_injective_isClosedMap @@ -938,25 +993,31 @@ lemma incl₂_isClosedEmbedding : Topology.IsClosedEmbedding (incl₂ K D) := by exact IsClosed.preimage (continuous_id') (IsClosed.preimage (map_continuous ringHaarChar) (by simp)) +set_option backward.isDefEq.respectTransparency false in lemma ImAux_isCompact : IsCompact ((fun p ↦ (p.1, MulOpposite.op p.2)) '' Aux.C K D) := IsCompact.image (Aux.C_compact K D) <| by fun_prop +set_option backward.isDefEq.respectTransparency false in lemma M_compact : IsCompact (M K D) := Topology.IsClosedEmbedding.isCompact_preimage (incl₂_isClosedEmbedding K D) (ImAux_isCompact K D) +set_option backward.isDefEq.respectTransparency false in /-- The restriction of ringHaarChar_ker D_𝔸 to (D ⊗ 𝔸_K^∞)ˣ via D𝔸_iso_prod_units. -/ abbrev rest₁ : ringHaarChar_ker D_𝔸 → Dfx K D := fun a => (D𝔸_prodRight_units K D) a.val |>.2 +set_option backward.isDefEq.respectTransparency false in lemma rest₁_continuous : Continuous (rest₁ K D) := Continuous.comp continuous_snd (Continuous.comp (D𝔸_prodRight_units_cont K D) continuous_subtype_val) +set_option backward.isDefEq.respectTransparency false in lemma ringHaarChar_D𝔸_prodRight_units_aux (r : ℝ) (h : r > 0) : ∃ y, ringHaarChar ((D𝔸_prodRight_units K D).symm (y,1)) = r := by obtain ⟨ρ, hρ⟩ := ringHaarChar_D𝔸_real_surjective K D r h use ((Units.map (algebraMap ℝ (Dinf K D))) ρ) +set_option backward.isDefEq.respectTransparency false in open scoped NNReal in lemma rest₁_surjective : Function.Surjective (rest₁ K D) := by intro x @@ -979,6 +1040,7 @@ lemma rest₁_surjective : Function.Surjective (rest₁ K D) := by ext <;> simp simp_rw [this, map_mul, map_inv, hy, ← hr_def, inv_mul_cancel₀ hr.ne'] +set_option backward.isDefEq.respectTransparency false in -- the goal that comes up when you define the map `Dˣ \ D_𝔸^(1) to Dˣ \ (Dfx K D)` -- below using Quot.lift lemma incl_D𝔸quot_equivariant : ∀ (a b : ↥(ringHaarChar_ker D_𝔸)), @@ -988,16 +1050,17 @@ lemma incl_D𝔸quot_equivariant : ∀ (a b : ↥(ringHaarChar_ker D_𝔸)), Quotient.mk (QuotientGroup.rightRel (incl₁ K D).range) (rest₁ K D b)) := by refine fun a b hab ↦ Quotient.eq''.mpr ?_ obtain ⟨⟨t, t', ht⟩, rfl⟩ := hab - simp_rw [QuotientGroup.rightRel, MulAction.orbitRel, MulAction.orbit, Set.mem_range, - Subtype.exists, Subgroup.mk_smul, smul_eq_mul, MonoidHom.mem_range, exists_prop, - exists_exists_eq_and] + unfold QuotientGroup.rightRel MulAction.orbitRel MulAction.orbit + simp_rw [Set.mem_range, Subtype.exists, Subgroup.mk_smul, smul_eq_mul, MonoidHom.mem_range, + exists_prop, exists_exists_eq_and] use t' have : incl₁ K D t' = ((D𝔸_prodRight_units K D) (AdeleRing.DivisionAlgebra.Aux.incl K D t')).2 := by rfl simp_rw [this, ht, ← Prod.snd_mul, Subgroup.subtype_apply, Subgroup.comap_subtype, ← map_mul] rfl +set_option backward.isDefEq.respectTransparency false in /-- The obvious map Dˣ \ D_𝔸^(1) to Dˣ \ (Dfx K D). -/ abbrev incl_D𝔸quot : Quotient (QuotientGroup.rightRel ((MonoidHom.range (NumberField.AdeleRing.DivisionAlgebra.Aux.incl K D)).comap @@ -1007,10 +1070,12 @@ abbrev incl_D𝔸quot : Quotient (QuotientGroup.rightRel (fun a => Quotient.mk (QuotientGroup.rightRel (incl₁ K D).range) (rest₁ K D a)) (incl_D𝔸quot_equivariant K D) +set_option backward.isDefEq.respectTransparency false in lemma incl_D𝔸quot_continuous : Continuous (incl_D𝔸quot K D) := by refine Continuous.quotient_lift ?_ (incl_D𝔸quot_equivariant K D) exact Continuous.comp' ({isOpen_preimage := fun s a ↦ a}) (rest₁_continuous K D) +set_option backward.isDefEq.respectTransparency false in lemma incl_D𝔸quot_surjective : Function.Surjective (incl_D𝔸quot K D) := by refine (Quot.surjective_lift (f := fun a => Quotient.mk (QuotientGroup.rightRel (incl₁ K D).range) (rest₁ K D a)) (incl_D𝔸quot_equivariant K D)).mpr ?_ @@ -1030,6 +1095,7 @@ variable [FiniteDimensional K D] open scoped TensorProduct.RightActions +set_option backward.isDefEq.respectTransparency false in /-- Dˣ \ D_𝔸^{(1)} is compact. -/ lemma compact_quotient [Algebra.IsCentral K D] : CompactSpace (_root_.Quotient (QuotientGroup.rightRel @@ -1039,6 +1105,7 @@ lemma compact_quotient [Algebra.IsCentral K D] : variable [Algebra.IsCentral K D] +set_option backward.isDefEq.respectTransparency false in /-- Dˣ \ D_𝔸^fˣ is compact. -/ theorem _root_.NumberField.FiniteAdeleRing.DivisionAlgebra.units_cocompact : CompactSpace (_root_.Quotient (QuotientGroup.rightRel (incl₁ K D).range)) := by diff --git a/FLT/Mathlib/MeasureTheory/Haar/Extension.lean b/FLT/Mathlib/MeasureTheory/Haar/Extension.lean --- a/FLT/Mathlib/MeasureTheory/Haar/Extension.lean +++ b/FLT/Mathlib/MeasureTheory/Haar/Extension.lean @@ -4,11 +4,10 @@ Released under Apache 2.0 license as described in the file LICENSE. Authors: Thomas Browning -/ -import Mathlib.Analysis.InnerProductSpace.Basic import Mathlib.MeasureTheory.Constructions.Polish.Basic -import Mathlib.MeasureTheory.Group.Integral +import Mathlib.MeasureTheory.Measure.Haar.Extension import Mathlib.MeasureTheory.Measure.Haar.Unique -import Mathlib.MeasureTheory.Integral.RieszMarkovKakutani.Real + /-! # Haar measures on group extensions @@ -35,34 +34,8 @@ open MeasureTheory MeasureTheory.Measure open scoped Pointwise -/-- A predicate stating that `φ` and `ψ` define a short exact sequence of topological groups. -/ -structure TopologicalGroup.IsSES {A B C : Type*} [Group A] [Group B] [Group C] - [TopologicalSpace A] [TopologicalSpace B] [TopologicalSpace C] (φ : A →* B) (ψ : B →* C) where - isClosedEmbedding : Topology.IsClosedEmbedding φ - isOpenQuotientMap : IsOpenQuotientMap ψ - exact : φ.range = ψ.ker - -/-- A predicate stating that `φ` and `ψ` define a short exact sequence of topological groups. -/ -structure TopologicalAddGroup.IsSES {A B C : Type*} [AddGroup A] [AddGroup B] [AddGroup C] - [TopologicalSpace A] [TopologicalSpace B] [TopologicalSpace C] (φ : A →+ B) (ψ : B →+ C) where - isClosedEmbedding : Topology.IsClosedEmbedding φ - isOpenQuotientMap : IsOpenQuotientMap ψ - exact : φ.range = ψ.ker - -attribute [to_additive TopologicalAddGroup.IsSES] TopologicalGroup.IsSES - namespace TopologicalGroup.IsSES -/-- Construct a short exact sequence of topological groups from a closed normal subgroup. -/ -@[to_additive /-- Construct a short exact sequence of topological groups from a -closed normal subgroup. -/] -theorem ofClosedSubgroup {G : Type*} [Group G] [TopologicalSpace G] [IsTopologicalGroup G] - (H : Subgroup G) [H.Normal] [IsClosed (H : Set G)] : - TopologicalGroup.IsSES H.subtype (QuotientGroup.mk' H) where - isClosedEmbedding := ⟨⟨Topology.IsInducing.subtypeVal, H.subtype_injective⟩, by simpa⟩ - isOpenQuotientMap := MulAction.isOpenQuotientMap_quotientMk - exact := by simp - variable {A B C : Type*} [Group A] [Group B] [Group C] [TopologicalSpace A] [TopologicalSpace B] [TopologicalSpace C] {φ : A →* B} {ψ : B →* C} (H : TopologicalGroup.IsSES φ ψ) @@ -72,287 +45,32 @@ theorem apply_apply {A B C : Type*} [Group A] [Group B] [Group C] [TopologicalSpace A] [TopologicalSpace B] [TopologicalSpace C] {φ : A →* B} {ψ : B →* C} (H : TopologicalGroup.IsSES φ ψ) (a : A) : ψ (φ a) = 1 := - H.exact.le ⟨a, rfl⟩ + H.mulExact.apply_apply_eq_one _ variable {A B C E : Type*} [Group A] [Group B] [Group C] [TopologicalSpace A] [TopologicalSpace B] [TopologicalSpace C] {φ : A →* B} {ψ : B →* C} (H : TopologicalGroup.IsSES φ ψ) [IsTopologicalGroup A] [IsTopologicalGroup B] [NormedAddCommGroup E] -/-- Pullback a continuous compactly supported function `f` on `B` to the -continuous compactly supported function `a ↦ f (b * φ a)` on `A`. -/ -@[to_additive /--Pullback a continuous compactly supported function `f` on `B` to the -continuous compactly supported function `a ↦ f (b * φ a)` on `A`.-/] -noncomputable def pullback (f : CompactlySupportedContinuousMap B E) (b : B) : - CompactlySupportedContinuousMap A E where - toFun a := f (b * φ a) - hasCompactSupport' := by - obtain ⟨K, hK, hf⟩ := exists_compact_iff_hasCompactSupport.mpr f.hasCompactSupport - refine exists_compact_iff_hasCompactSupport.mp ⟨φ ⁻¹' (b⁻¹ • K), - H.isClosedEmbedding.isCompact_preimage (hK.smul b⁻¹), fun x hx ↦ hf _ ?_⟩ - simpa [Set.mem_smul_set_iff_inv_smul_mem] using hx - continuous_toFun := by - have : Continuous φ := H.isClosedEmbedding.continuous - fun_prop - -@[to_additive] -theorem pullback_def (f : CompactlySupportedContinuousMap B E) (b : B) (a : A) : - pullback H f b a = f (b * φ a) := - rfl - variable [MeasurableSpace A] [BorelSpace A] (μA : Measure A) [hμA : IsHaarMeasure μA] [NormedSpace ℝ E] - -@[to_additive] -theorem integral_pullback_invFun_apply (f : CompactlySupportedContinuousMap B E) (b : B) : - ∫ a, H.pullback f (Function.invFun ψ (ψ b)) a ∂μA = ∫ a, H.pullback f b a ∂μA := by - have h : ψ ((Function.invFun ψ (ψ b))⁻¹ * b) = 1 := by simp [Function.apply_invFun_apply] - rw [← ψ.mem_ker, ← H.exact] at h - obtain ⟨a, ha⟩ := h - rw [← integral_mul_left_eq_self _ a] - simp [pullback, ha, mul_assoc] - variable [IsTopologicalGroup C] [LocallyCompactSpace B] -/-- Pushforward a continuous comapctly supported function on `B` to a -continuous compactly supported function on `C` by integrating over `A`. -/ -@[to_additive /-- Pushforward a continuous comapctly supported function on `B` to a -continuous compactly supported function on `C` by integrating over `A`. -/] -noncomputable def pushforward : - CompactlySupportedContinuousMap B E →ₗ[ℝ] CompactlySupportedContinuousMap C E where - toFun f := - { toFun := fun c ↦ ∫ a, pullback H f (Function.invFun ψ c) a ∂μA - hasCompactSupport' := by - obtain ⟨K, hK, hf⟩ := exists_compact_iff_hasCompactSupport.mpr f.hasCompactSupport - refine exists_compact_iff_hasCompactSupport.mp - ⟨ψ '' K, hK.image H.isOpenQuotientMap.continuous, fun x hx ↦ ?_⟩ - suffices ∀ a : A, f (Function.invFun ψ x * φ a) = 0 by simp [this, pullback] - intro a - apply hf - contrapose! hx - refine ⟨_, hx, ?_⟩ - rw [map_mul, Function.rightInverse_invFun H.isOpenQuotientMap.surjective, mul_eq_left, - ← ψ.mem_ker, ← H.exact] - use a - continuous_toFun := by - rw [← H.isOpenQuotientMap.continuous_comp_iff, Function.comp_def] - simp only [integral_pullback_invFun_apply] - let p : B → A → E := fun b a ↦ f (b * φ a) - have hp (b : B) : MemLp (p b) 1 μA := - (pullback H f b).continuous.memLp_of_hasCompactSupport (pullback H f b).hasCompactSupport - suffices Continuous (fun b ↦ MemLp.toLp (p b) (hp b)) from by - refine (continuous_congr (fun b ↦ integral_congr_ae (hp b).coeFn_toLp)).mp ?_ - exact continuous_integral.comp this - simp only [p] - let := IsTopologicalGroup.rightUniformSpace B - rw [Metric.continuous_iff'] - intro b ε hε - obtain ⟨U₀, hU₀, hb⟩ := exists_compact_mem_nhds b - have hf₀ := f.hasCompactSupport - rw [← exists_compact_iff_hasCompactSupport] at hf₀ - obtain ⟨K, hK, hf₀⟩ := hf₀ - let S : Set A := φ ⁻¹' (U₀⁻¹ * K) - have hS : IsCompact S := H.isClosedEmbedding.isCompact_preimage (hU₀.inv.mul hK) - have hS' : ∀ x ∈ U₀, ∀ y : A, f (x * φ y) ≠ 0 → y ∈ S := by - intro x hx y h - contrapose! h - apply hf₀ - contrapose! h - replace h := Set.mul_mem_mul (Set.inv_mem_inv.mpr hx) h - rwa [inv_mul_cancel_left] at h - set V₀ := μA S with hV₀ - have hV₀' : V₀ < ⊤ := hS.measure_lt_top - have : ∃ v : ℝ, 0 < v ∧ v * ENNReal.toReal V₀ < ε := by - by_cases h : V₀ = 0 - · exact ⟨1, one_pos, by simpa [h]⟩ - · replace h := ENNReal.toReal_pos h hV₀'.ne - refine ⟨(ε / 2) / ENNReal.toReal (μA S), div_pos (div_pos hε two_pos) h, ?_⟩ - rw [div_mul_cancel₀ _ h.ne'] - exact half_lt_self hε - obtain ⟨v, hv0, hv⟩ := this - simp only [dist_eq_norm_sub, ← MemLp.toLp_sub, MeasureTheory.Lp.norm_toLp] - have ha := f.hasCompactSupport.uniformContinuous_of_continuous f.continuous - rw [UniformContinuous, Filter.tendsto_iff_forall_eventually_mem] at ha - obtain ⟨U, hU, hf⟩ := ha _ (Metric.dist_mem_uniformity hv0) - refine Filter.mem_of_superset (Filter.inter_mem - (mul_singleton_mem_nhds_of_nhds_one b (inv_mem_nhds_one B hU)) hb) ?_ - rintro - ⟨⟨t, ht, b, rfl, -, rfl⟩, htb⟩ - have hd (a : A) : dist (f (t * b * φ a)) (f (b * φ a)) < v := by - simpa using @hf ⟨t * b * φ a, b * φ a⟩ (by simpa) - replace hd (a : A) : ‖f (t * b * φ a) - f (b * φ a)‖ₑ ≤ ENNReal.ofReal v := by - rw [← ofReal_norm_eq_enorm, ← dist_eq_norm_sub] - exact ENNReal.ofReal_le_ofReal (hd a).le - apply ENNReal.toReal_lt_of_lt_ofReal - rw [MeasureTheory.eLpNorm_one_eq_lintegral_enorm, - ← MeasureTheory.setLIntegral_eq_of_support_subset (s := S)] - · apply (MeasureTheory.lintegral_mono hd).trans_lt - rwa [lintegral_const, Measure.restrict_apply_univ, ← hV₀, - ← ENNReal.ofReal_toReal hV₀'.ne, ← ENNReal.ofReal_mul hv0.le, - ENNReal.ofReal_lt_ofReal_iff_of_nonneg (by positivity)] - · intro x hx - have : f (t * b * φ x) ≠ 0 ∨ f (b * φ x) ≠ 0 := by - contrapose! hx - simp [hx.1, hx.2] - rcases this with h | h - · exact hS' (t * b) htb x h - · exact hS' b (mem_of_mem_nhds hb) x h } - map_add' f g := by - ext c - apply integral_add - · exact (pullback H f _).integrable - · exact (pullback H g _).integrable - map_smul' x f := by - ext c - apply integral_smul - -@[to_additive] -theorem pushforward_def (f : CompactlySupportedContinuousMap B E) (c : C) : - pushforward H μA f c = ∫ a, pullback H f (Function.invFun ψ c) a ∂μA := - rfl - @[to_additive] theorem pushforward_apply (f : CompactlySupportedContinuousMap B E) (b : B) : pushforward H μA f (ψ b) = ∫ a, pullback H f b a ∂μA := integral_pullback_invFun_apply H μA f b -@[to_additive] -theorem pushforward_mono (f g : CompactlySupportedContinuousMap B ℝ) (h : f ≤ g) : - pushforward H μA f ≤ pushforward H μA g := by - intro c - apply integral_mono - · exact (pullback H f _).integrable - · exact (pullback H g _).integrable - · intro a - apply h - variable [MeasurableSpace C] [BorelSpace C] (μC : Measure C) [hμC : IsHaarMeasure μC] - -/-- Integrate a continuous comapctly supported function on `B` by integrating over `A` and `C`. -/ -@[to_additive /-- Integrate a continuous comapctly supported function on `B` by integrating -over `A` and `C`. -/] -noncomputable def integrate : CompactlySupportedContinuousMap B E →ₗ[ℝ] E where - toFun f := ∫ c, pushforward H μA f c ∂μC - map_add' f g := by - rw [map_add] - exact integral_add (pushforward H μA f).integrable (pushforward H μA g).integrable - map_smul' x f := by - rw [map_smul] - exact integral_smul x (H.pushforward μA f) - -@[to_additive] -theorem integrate_apply (f : CompactlySupportedContinuousMap B E) : - H.integrate μA μC f = ∫ c, pushforward H μA f c ∂μC := - rfl - -@[to_additive] -theorem integrate_mono (f g : CompactlySupportedContinuousMap B ℝ) (h : f ≤ g) : - integrate H μA μC f ≤ integrate H μA μC g := - integral_mono (pushforward H μA f).integrable (pushforward H μA g).integrable - (pushforward_mono H μA f g h) - variable [T2Space B] [MeasurableSpace B] [BorelSpace B] -/-- The Haar measure on `B` induced by the Haar measures on `A` and `C`. -/ -@[to_additive /-- The Haar measure on `B` induced by the Haar measures on `A` and `C`. -/] -noncomputable def inducedMeasure : Measure B := - RealRMK.rieszMeasure ⟨integrate H μA μC, integrate_mono H μA μC⟩ - -@[to_additive] -instance inducedMeasure_regular : (inducedMeasure H μA μC).Regular := - RealRMK.regular_rieszMeasure _ - -@[to_additive] -theorem integral_inducedMeasure (f : CompactlySupportedContinuousMap B ℝ) : - ∫ b : B, f b ∂(inducedMeasure H μA μC) = integrate H μA μC f := by - apply RealRMK.integral_rieszMeasure - -@[to_additive] -instance isHaarMeasure_inducedMeasure : IsHaarMeasure (inducedMeasure H μA μC) where - lt_top_of_isCompact K hK := by - let U : Set B := Set.univ - have hU : IsOpen U := isOpen_univ - have hKU : K ⊆ U := K.subset_univ - obtain ⟨f, hf1, hf2, hf3, hf4⟩ := exists_continuousMap_one_of_isCompact_subset_isOpen hK hU hKU - exact lt_of_le_of_lt (RealRMK.rieszMeasure_le_of_eq_one (f := ⟨f, hf2⟩) _ - (fun x ↦ (hf4 x).1) hK (fun x hx ↦ hf1 hx)) ENNReal.ofReal_lt_top - map_mul_left_eq_self b := by - have : ((inducedMeasure H μA μC).map (fun x ↦ b * x)).Regular := - Regular.map (Homeomorph.mulLeft b) - refine MeasureTheory.Measure.ext_of_integral_eq_on_compactlySupported fun f ↦ ?_ - rw [integral_map (by fun_prop) (by fun_prop)] - have h (x : B) : f (b * x) = f.comp (Homeomorph.mulLeft b).toCocompactMap x := rfl - simp only [h, integral_inducedMeasure, integrate_apply] - rw [← integral_mul_left_eq_self _ (ψ b)⁻¹] - congr - ext c - obtain ⟨b', rfl⟩ := H.isOpenQuotientMap.surjective c - rw [← map_inv, ← map_mul, pushforward_apply, pushforward_apply] - simp [pullback, mul_assoc] - open_pos U hU := by - rintro ⟨b, hb⟩ - obtain ⟨K, hK, hb, hKU⟩ := exists_compact_subset hU hb - replace hb : b ∈ K := interior_subset hb - obtain ⟨f, hf1, hf2, hf3, hf4⟩ := exists_continuousMap_one_of_isCompact_subset_isOpen hK hU hKU - have hf0 : 0 ≤ H.pushforward μA ⟨f, hf2⟩ := by - rw [← map_zero (H.pushforward μA)] - apply pushforward_mono - exact fun x ↦ (hf4 x).1 - refine (lt_of_lt_of_le ?_ - (RealRMK.le_rieszMeasure_tsupport_subset (f := ⟨f, hf2⟩) _ hf4 hf3)).ne' - rw [ENNReal.ofReal_pos] - suffices (0 : ℝ) < pushforward H μA ⟨f, hf2⟩ (ψ b) from - (pushforward H μA ⟨f, hf2⟩).continuous.integral_pos_of_hasCompactSupport_nonneg_nonzero - (pushforward H μA ⟨f, hf2⟩).hasCompactSupport hf0 this.ne' - have : (Function.invFun ψ (ψ b))⁻¹ * b ∈ φ.range := by - simp [H.exact, Function.apply_invFun_apply] - obtain ⟨a, ha⟩ := this - replace ha : f (Function.invFun ψ (ψ b) * φ a) ≠ 0 := by simp [ha, hf1 hb] - exact (pullback H ⟨f, hf2⟩ _).continuous.integral_pos_of_hasCompactSupport_nonneg_nonzero - (pullback H ⟨f, hf2⟩ _).hasCompactSupport (fun x ↦ (hf4 _).1) ha - -/-- If `ψ` is injective on an open set `U`, then `U` has bounded measure. -/ -@[to_additive /-- If `ψ` is injective on an open set `U`, then `U` has bounded measure. -/] -theorem inducedMeasure_lt_of_injOn (U : Set B) (hU : IsOpen U) [DiscreteTopology A] - (h : U.InjOn ψ) : - inducedMeasure H μA μC U ≤ μC Set.univ * μA {1} := by - contrapose! h - have ho : 0 < μA {1} := (isOpen_discrete {1}).measure_pos _ (Set.singleton_nonempty 1) - have ht : μA {1} < ⊤ := isCompact_singleton.measure_lt_top - obtain ⟨K, hKU, hK, h⟩ := Regular.innerRegular hU _ h - obtain ⟨f, hf1, hf2, hf3, hf4⟩ := exists_continuousMap_one_of_isCompact_subset_isOpen hK hU hKU - replace h : μC Set.univ * μA {1} < ENNReal.ofReal (∫ c : C, pushforward H μA ⟨f, hf2⟩ c ∂μC) := - lt_of_lt_of_le h ((RealRMK.rieszMeasure_le_of_eq_one (f := ⟨f, hf2⟩) _ (fun x ↦ (hf4 x).1) - hK (fun x hx ↦ hf1 hx))) - replace h : ∃ c : C, (μA {1}).toReal < pushforward H μA ⟨f, hf2⟩ c := by - contrapose! h - rcases eq_top_or_lt_top (μC Set.univ) with hC | hC - · simp [hC, ENNReal.top_mul ho.ne'] - · have : IsFiniteMeasure μC := ⟨hC⟩ - rw [ENNReal.ofReal_le_iff_le_toReal (ENNReal.mul_lt_top hC ht).ne, ENNReal.toReal_mul, - ← Measure.real_def, ← smul_eq_mul, ← integral_const] - exact integral_mono (H.pushforward μA ⟨f, hf2⟩).integrable (integrable_const _) h - obtain ⟨c, hc⟩ := h - contrapose! hc - obtain ⟨b, rfl⟩ := H.isOpenQuotientMap.surjective c - simp only [pushforward_apply, pullback_def, CompactlySupportedContinuousMap.coe_mk] - rw [← MeasureTheory.setIntegral_support] - have key : (Function.support fun a ↦ f (b * φ a)).Subsingleton := by - intro a ha b hb - simpa [H.isClosedEmbedding.injective.eq_iff] using - hc (hf3 (subset_tsupport _ ha)) (hf3 (subset_tsupport _ hb)) (by simp [H.apply_apply]) - obtain h | ⟨a, ha⟩ := key.eq_empty_or_singleton - · simp [h] - · rw [ha, integral_singleton, real_def, haar_singleton, smul_eq_mul, mul_le_iff_le_one_right] - · exact (hf4 _).2 - · exact ENNReal.toReal_pos ho.ne' ht.ne - /-- A sufficiently large open subset of `B` cannot be a fundamental domain. -/ @[to_additive] theorem not_injOn_of_inducedMeasure_gt (U : Set B) (hU : IsOpen U) [DiscreteTopology A] (h : μC Set.univ * μA {1} < inducedMeasure H μA μC U) : ¬ U.InjOn ψ := by contrapose! h - exact H.inducedMeasure_lt_of_injOn μA μC U hU h + exact H.inducedMeasure_lt_of_injOn μA μC hU h set_option backward.isDefEq.respectTransparency false in @[to_additive] @@ -362,13 +80,14 @@ theorem not_injOn_of_measure_gt (H : Subgroup G) [H.Normal] [DiscreteTopology H] [CompactSpace (G ⧸ H)] : ∃ B : NNReal, ∀ U : Set G, IsOpen U → B < haar U → ¬ U.InjOn (QuotientGroup.mk' H) := by have h := ofClosedSubgroup H - use ((haarScalarFactor (h.inducedMeasure haar haar) haar)⁻¹ • + use ((haarScalarFactor ((h Subgroup.isClosed_of_discrete).inducedMeasure haar haar) haar)⁻¹ • (haar (Set.univ : Set (G ⧸ H)) * haar ({1} : Set H))).toNNReal intro U hU hU' rw [ENNReal.coe_toNNReal] at hU' · rw [inv_smul_lt_iff_of_pos (haarScalarFactor_pos_of_isHaarMeasure _ _)] at hU' - apply h.not_injOn_of_inducedMeasure_gt haar haar U hU - rwa [measure_isHaarMeasure_eq_smul_of_isOpen (h.inducedMeasure haar haar) haar hU] + apply (h Subgroup.isClosed_of_discrete).not_injOn_of_inducedMeasure_gt haar haar U hU + rwa [measure_isHaarMeasure_eq_smul_of_isOpen ((h Subgroup.isClosed_of_discrete).inducedMeasure + haar haar) haar hU] · apply ENNReal.nnreal_smul_ne_top apply ENNReal.mul_ne_top · exact isCompact_univ.measure_ne_top",85,298,383,5.0,diff_derived,False,106,3,0,0,0,pr_merge,False,leanprover/lean4:v4.29.0,leanbench/lean4-env:4.29.0,lake build,600,lean_compiler,algebra,2026-04-28T12:39:47Z,extraction_pipeline_v2 LB-0004,pr_completion,easy,1.06,ImperialCollegeLondon/FLT,886,fix: `4.29` fixes for `HaarChar.AdeleRing`,https://github.com/ImperialCollegeLondon/FLT/pull/886,,7c8ac5865d778d3c2eafd3fe7dfb83803d8dc41c,4554fdf0c9ff937384bda4692e603572c6adb7f0,FLT/HaarMeasure/HaarChar/AdeleRing.lean,FLT/HaarMeasure/HaarChar/AdeleRing.lean,"# Task: fix: `4.29` fixes for `HaarChar.AdeleRing` ## Files affected - FLT/HaarMeasure/HaarChar/AdeleRing.lean (+22/-21) ## Verification The patched repository must compile with `lake build`.","diff --git a/FLT/HaarMeasure/HaarChar/AdeleRing.lean b/FLT/HaarMeasure/HaarChar/AdeleRing.lean --- a/FLT/HaarMeasure/HaarChar/AdeleRing.lean +++ b/FLT/HaarMeasure/HaarChar/AdeleRing.lean @@ -40,6 +40,7 @@ open scoped TensorProduct open NumberField MeasureTheory +set_option backward.isDefEq.respectTransparency false in lemma MeasureTheory.ringHaarChar_adeles_rat (x : (𝔸 ℚ)ˣ) : ringHaarChar x = ringHaarChar (MulEquiv.prodUnits x).1 * (∏ᶠ p, ringHaarChar (MulEquiv.restrictedProductUnits (MulEquiv.prodUnits x).2 p)) := by @@ -57,6 +58,7 @@ lemma MeasureTheory.ringHaarChar_adeles_rat (x : (𝔸 ℚ)ˣ) : (fun x hx ↦ Subring.mul_mem _ ((Submonoid.mem_units_iff _ _).mp hp).1 hx) (fun x hx ↦ Subring.mul_mem _ ((Submonoid.mem_units_iff _ _).mp hp).2 hx)) +set_option backward.isDefEq.respectTransparency false in lemma MeasureTheory.ringHaarChar_adeles_units_rat_eq_one (x : ℚˣ) : ringHaarChar (Units.map (algebraMap ℚ (𝔸 ℚ)) x : (𝔸 ℚ)ˣ) = 1 := by rw [ringHaarChar_adeles_rat (Units.map (algebraMap ℚ (𝔸 ℚ)) x : (𝔸 ℚ)ˣ)] @@ -80,12 +82,21 @@ lemma MeasureTheory.ringHaarChar_adeles_units_rat_eq_one (x : ℚˣ) : apply NNReal.toRealHom.map_finprod_of_injective (.of_eq_imp_le fun {_ _} a ↦ a.le) apply finprod_congr; intro p let : Algebra ℤ (p.adicCompletion ℚ) := Ring.toIntAlgebra _ - simp [FinitePlace.equivHeightOneSpectrum, - ringHaarChar_eq_ringHaarChar_of_continuousAlgEquiv { - __ := (Rat.HeightOneSpectrum.adicCompletion.padicEquiv p) - commutes' := by simp}, - Rat.HeightOneSpectrum.adicCompletion.padicEquiv_norm_eq] - rfl + simp only [RingHom.toMonoidHom_eq_coe, + ringHaarChar_eq_ringHaarChar_of_continuousAlgEquiv + { __ := (Rat.HeightOneSpectrum.adicCompletion.padicEquiv p) + commutes' := by simp }, + AlgEquiv.toEquiv_eq_coe, MulEquiv.toMonoidHom_eq_coe, ringHaarChar_padic, Units.coe_map, + MonoidHom.coe_coe, MulEquiv.coe_mk, EquivLike.coe_coe, ContinuousAlgEquiv.coe_toAlgEquiv, + NNReal.coe_toRealHom, coe_nnnorm, Rat.HeightOneSpectrum.adicCompletion.padicEquiv_norm_eq, + FinitePlace.equivHeightOneSpectrum, Equiv.coe_fn_symm_mk, FinitePlace.mk_apply, + MulEquiv.restrictedProductUnits, RestrictedProduct.inv_apply, + Units.val_inv_eq_inv_val, MulEquiv.prodUnits, MulEquiv.coe_mk, Equiv.coe_fn_mk, + MonoidHom.prod_apply, Units.coe_map, MonoidHom.coe_coe, MonoidHom.coe_snd, Units.coe_map_inv, + RestrictedProduct.mk_apply] + rw [AdeleRing.algebraMap_snd_apply, WithVal.equiv_symm_apply] + rw [NumberField.FinitePlace.norm_embedding'] + simp [FinitePlace.norm_def] open scoped TensorProduct.RightActions in /-- The continuous A-linear map (A a topological ring, tensor products have the module @@ -109,20 +120,6 @@ lemma ContinuousLinearEquiv.baseChange_apply (R : Type*) [CommRing R] TensorProduct.RightActions.ContinuousLinearEquiv.baseChange R A M N φ (m ⊗ₜ a) = (φ m) ⊗ₜ a := rfl --- mathlib? -lemma LinearMap.toMatrix_map_left {R M N P ι j : Type*} [Fintype ι] [DecidableEq ι] [Fintype j] - [CommRing R] [AddCommGroup M] [Module R M] [AddCommGroup N] [Module R N] [AddCommGroup P] - [Module R P] (φ : M ≃ₗ[R] P) (α : P →ₗ[R] N) - (b : Module.Basis ι R M) (c : Module.Basis j R N) : - LinearMap.toMatrix (b.map φ) c α = LinearMap.toMatrix b c (α ∘ₗ φ) := rfl - --- mathlib? -lemma LinearMap.toMatrix_map_right {R M N P ι j : Type*} [Fintype ι] [DecidableEq ι] [Fintype j] - [CommRing R] [AddCommGroup M] [Module R M] [AddCommGroup N] [Module R N] [AddCommGroup P] - [Module R P] (φ : N ≃ₗ[R] P) (α : M →ₗ[R] P) - (b : Module.Basis ι R M) (c : Module.Basis j R N) : - LinearMap.toMatrix b (c.map φ) α = LinearMap.toMatrix b c (φ.symm ∘ₗ α) := rfl - -- mathlib? lemma LinearMap.toMatrix_basis {R : Type*} (A : Type*) {M : Type*} {ι j : Type*} [Fintype ι] [Fintype j] [DecidableEq ι] [CommSemiring R] [CommSemiring A] @@ -133,6 +130,7 @@ lemma LinearMap.toMatrix_basis {R : Type*} (A : Type*) {M : Type*} {ι j : Type* ext simp +set_option backward.isDefEq.respectTransparency false in open TensorProduct.RightActions in lemma MeasureTheory.addHaarScalarFactor_tensor_adeles_rat_eq_one [Module ℚ V] [FiniteDimensional ℚ V] (φ : V ≃ₗ[ℚ] V) @@ -161,6 +159,7 @@ lemma MeasureTheory.addHaarScalarFactor_tensor_adeles_rat_eq_one [Module ℚ V] ext simp +set_option backward.isDefEq.respectTransparency false in open scoped NumberField.AdeleRing in open TensorProduct.RightActions in lemma MeasureTheory.addHaarScalarFactor_tensor_adeles_eq_one (φ : V ≃ₗ[K] V) @@ -190,8 +189,9 @@ lemma MeasureTheory.addHaarScalarFactor_tensor_adeles_eq_one (φ : V ≃ₗ[K] V induction x with | zero => simp | tmul x y => rfl - | add x y hx hy => simp [hx, hy] + | add x y hx hy => simp at hx hy; simp [hx, hy] +set_option backward.isDefEq.respectTransparency false in open TensorProduct.RightActions in /-- Left multiplication by an element of Bˣ on B ⊗ 𝔸_K does not scale additive Haar measure. In other words, Bˣ is in the kernel of the `ringHaarChar` of `B ⊗ 𝔸_K`. @@ -211,6 +211,7 @@ lemma NumberField.AdeleRing.units_mem_ringHaarCharacter_ker | tmul x y => simp [LinearEquiv.mulLeft] | add x y hx hy => simp_all [mul_add] +set_option backward.isDefEq.respectTransparency false in open TensorProduct.RightActions in /-- Right multiplication by an element of Bˣ on B ⊗ 𝔸_K does not scale additive Haar measure.",22,21,43,6.0,diff_derived,False,0,1,0,0,0,pr_merge,False,leanprover/lean4:v4.29.0,leanbench/lean4-env:4.29.0,lake build,600,lean_compiler,algebra,2026-04-28T12:39:47Z,extraction_pipeline_v2 LB-0005,pr_completion,medium,5.0,ImperialCollegeLondon/FLT,885,fix: `4.29` fixes for finite adele files,https://github.com/ImperialCollegeLondon/FLT/pull/885,,166dbe151303e083f2d18a2478f7d3bb218ee511,b30cfb53c2a30eb96fb19c2b62b670075dd44fd1,"FLT/DedekindDomain/Completion/BaseChange.lean,FLT/DedekindDomain/FiniteAdeleRing/BaseChange.lean,FLT/DedekindDomain/IntegralClosure.lean,FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean,FLT/NumberField/AdeleRing.lean",FLT/DedekindDomain/Completion/BaseChange.lean,"# Task: fix: `4.29` fixes for finite adele files ## Context Some `maxHeartbeats 0` required in - `Completion.BaseChange` - `FiniteAdeleRing.BaseChange` - `HaarCharacter.FiniteAdeleRing` ## Files affected - FLT/DedekindDomain/Completion/BaseChange.lean (+134/-97) - FLT/DedekindDomain/FiniteAdeleRing/BaseChange.lean (+44/-31) - FLT/DedekindDomain/IntegralClosure.lean (+19/-27) - FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean (+21/-4) - FLT/NumberField/AdeleRing.lean (+49/-8) ## Theorems to prove ### `integerBaseChangeLinearEquiv_bijOn` in `FLT/DedekindDomain/Completion/BaseChange.lean` ```lean theorem integerBaseChangeLinearEquiv_bijOn (v : HeightOneSpectrum A) : ``` ## Definitions to add - `_root_.WithVal.semialgebraMap` in `FLT/DedekindDomain/Completion/BaseChange.lean` ```lean def _root_.WithVal.semialgebraMap {R S Γ₀ Γ₀' : Type*} [CommRing R] ``` - `Extension` in `FLT/DedekindDomain/IntegralClosure.lean` ```lean def Extension (v : HeightOneSpectrum A) := {w : HeightOneSpectrum B // w.under A = v} ``` ## Supporting lemmas - `adicValued.continuous_algebraMap` in `FLT/DedekindDomain/Completion/BaseChange.lean` ```lean lemma adicValued.continuous_algebraMap ``` - `adicCompletionSemialgHom_coe` in `FLT/DedekindDomain/Completion/BaseChange.lean` ```lean lemma adicCompletionSemialgHom_coe (x : WithVal (v.valuation K)) : ``` - `baseChangeRight_isOpenQuotientMap` in `FLT/DedekindDomain/Completion/BaseChange.lean` ```lean lemma baseChangeRight_isOpenQuotientMap [FiniteDimensional K L] : ``` ## Existing declarations to modify - `adicCompletionSemialgHom_coe` in `FLT/DedekindDomain/Completion/BaseChange.lean` (preserve semantics while updating code/proof) - `adicValued.continuous_algebraMap` in `FLT/DedekindDomain/Completion/BaseChange.lean` (preserve semantics while updating code/proof) - `baseChangeRight_isOpenQuotientMap` in `FLT/DedekindDomain/Completion/BaseChange.lean` (preserve semantics while updating code/proof) - `integerBaseChangeLinearEquiv_bijOn` in `FLT/DedekindDomain/Completion/BaseChange.lean` (preserve semantics while updating code/proof) - `Extension` in `FLT/DedekindDomain/IntegralClosure.lean` (preserve semantics while updating code/proof) ## Verification The patched repository must compile with `lake build`.","diff --git a/FLT/DedekindDomain/Completion/BaseChange.lean b/FLT/DedekindDomain/Completion/BaseChange.lean --- a/FLT/DedekindDomain/Completion/BaseChange.lean +++ b/FLT/DedekindDomain/Completion/BaseChange.lean @@ -40,6 +40,7 @@ map is continuous, `K_v`-linear and restricts to an isomorphism `B ⊗_A 𝓞_v -/ open scoped WithZero Valued TensorProduct +open Valuation.IsRankOneDiscrete WithZero /-! @@ -112,49 +113,66 @@ that `σ v w` is continuous. local notation ""σ"" => fun v w => algebraMap (WithVal (HeightOneSpectrum.valuation K v)) (WithVal (HeightOneSpectrum.valuation L w)) -lemma adicValued.continuous_algebraMap (w : HeightOneSpectrum B) (hvw : w.comap A = v) : +set_option backward.isDefEq.respectTransparency false in +lemma adicValued.continuous_algebraMap + (w : HeightOneSpectrum B) (hvw : w.under A = v) : Continuous (σ v w) := by + refine continuous_of_continuousAt_zero _ ?_ + rw [ContinuousAt, map_zero, (Valued.hasBasis_nhds_zero _ _).tendsto_iff + (Valued.hasBasis_nhds_zero _ _)] + intro γL _ + let e := v.asIdeal.ramificationIdx w.asIdeal + -- push `γL` to `ℤᵐ⁰` + let σL := WithVal.valueGroupOrderIso₀ (w.valuation L) + let σw := valueGroup₀_equiv_withZeroMulInt (w.valuation L) + let m : ℤᵐ⁰ := σw (σL γL) + -- `ℤᵐ⁰` values in `K` exponentiate by `e` in `L` so take the `e`th root and pull back to `γK` + let σv := valueGroup₀_equiv_withZeroMulInt (v.valuation K) + let σK := (WithVal.valueGroupOrderIso₀ (v.valuation K)) + let γK := σK.symm (σv.symm (exp (m.log / e))) + have hγK : γK ≠ 0 := by simp [γK] + use .mk0 _ hγK + simp only [Units.val_mk0, Set.mem_setOf_eq, true_and] + intro x hx + rcases eq_or_ne x 0 with rfl | hx₀; · simp + rw [σK.lt_symm_apply, ← (valueGroup₀_equiv_withZeroMulInt_strictMono _).lt_iff_lt, + WithVal.valueGroupOrderIso₀_restrict, + valueGroup₀_equiv_withZeroMulInt_restrict_apply_of_surjective (v.valuation_surjective K), + MulEquiv.apply_symm_apply, ← log_lt_log (by simp_all) (by simp)] at hx + rw [← σL.strictMono.lt_iff_lt, WithVal.valueGroupOrderIso₀_restrict, + ← (valueGroup₀_equiv_withZeroMulInt_strictMono _).lt_iff_lt, + valueGroup₀_equiv_withZeroMulInt_restrict_apply_of_surjective (w.valuation_surjective L), + WithVal.algebraMap_left_apply, WithVal.algebraMap_right_apply, ← valuation_comap A, + ← log_lt_log (by simp_all) (by simp), log_pow, nsmul_eq_mul, mul_comm] subst hvw - refine continuous_of_continuousAt_zero (algebraMap _ _) ?hf - delta ContinuousAt - simp only [map_zero] - rw [(@Valued.hasBasis_nhds_zero K _ _ _ (comap A w).adicValued).tendsto_iff - (@Valued.hasBasis_nhds_zero L _ _ _ w.adicValued)] - simp only [HeightOneSpectrum.adicValued_apply, Set.mem_setOf_eq, true_and, true_implies] - rw [WithZero.unitsWithZeroEquiv.forall_congr_left, Multiplicative.forall] - intro a - rw [WithZero.unitsWithZeroEquiv.exists_congr_left, Multiplicative.exists] - let m := Ideal.ramificationIdx (algebraMap A B) (comap A w).asIdeal w.asIdeal - let e : ℤ ≃ ℤᵐ⁰ˣ := Multiplicative.ofAdd.trans OrderMonoidIso.unitsWithZero.symm.toEquiv - have e_apply (a : ℤ) : e a = OrderMonoidIso.unitsWithZero.symm (Multiplicative.ofAdd a) := rfl - have hm : m ≠ 0 := by - refine ramificationIdx_ne_zero A B ?_ w - exact algebraMap_injective_of_field_isFractionRing A B K L - refine ⟨a / m, fun x hx ↦ ?_⟩ - erw [← valuation_comap A] - calc - (comap A w).valuation K x ^ m < e (a / ↑m) ^ m := by gcongr; exacts [zero_le', hx] - _ = e (m • (a / ↑m)) := by - dsimp [e] - rfl - _ ≤ e a := by - simp only [nsmul_eq_mul, e_apply, Units.val_le_val, OrderIsoClass.map_le_map_iff] - rw [mul_comm] - exact Int.mul_le_of_le_ediv (by positivity) le_rfl + apply Int.mul_lt_of_lt_ediv (mod_cast pos_of_ne_zero (ramificationIdx_ne_zero A B + (algebraMap_injective_of_field_isFractionRing A B K L) w)) hx namespace Extension variable {v} (w : v.Extension B) -/-- If w of L divides v of K, `comapSemialgHom v w pf` is the canonical map +@[simps!] +def _root_.WithVal.semialgebraMap {R S Γ₀ Γ₀' : Type*} [CommRing R] + [CommRing S] [LinearOrderedCommGroupWithZero Γ₀] [LinearOrderedCommGroupWithZero Γ₀'] + [Algebra R S] (v : Valuation R Γ₀) (w : Valuation S Γ₀') : + WithVal v →ₛₐ[algebraMap R S] WithVal w where + __ := algebraMap (WithVal v) (WithVal w) + map_smul' r x := by + simp [WithVal.algebraMap_left_apply, WithVal.algebraMap_right_apply, Algebra.smul_def] + +/-- If w of L divides v of K, `underSemialgHom v w pf` is the canonical map `Kᵥ → L_w` lying above `K → L`. Here we actually use the type synonyms `WithVal K` and `WithVal L`. -/ -noncomputable def adicCompletionSemialgHom : v.adicCompletion K →ₛₐ[σ v w.1] w.1.adicCompletion L := - UniformSpace.Completion.mapSemialgHom _ <| adicValued.continuous_algebraMap K L v w.1 w.2 +noncomputable def adicCompletionSemialgHom : + v.adicCompletion K →ₛₐ[algebraMap K L] w.1.adicCompletion L := + .restrictScalars (WithVal.semialgebraMap (v.valuation K) (w.1.valuation L)) <| + UniformSpace.Completion.mapSemialgHom _ <| adicValued.continuous_algebraMap K L v w.1 w.2 /-- The square with sides K → K_v → L_w and K → L → L_w commutes. -/ -lemma adicCompletionSemialgHom_coe (x : K) : w.adicCompletionSemialgHom K L x = algebraMap K L x := - (w.adicCompletionSemialgHom K L).commutes x +lemma adicCompletionSemialgHom_coe (x : WithVal (v.valuation K)) : + w.adicCompletionSemialgHom K L x = algebraMap K L x.ofVal := + (w.adicCompletionSemialgHom K L).commutes _ open WithZeroTopology in /-- @@ -163,19 +181,19 @@ index for the extension w/v. In other words, if x in K_v and i:K_v->L_w then w(i where e is computed globally. -/ lemma valued_adicCompletionSemialgHom (x) : - Valued.v (w.adicCompletionSemialgHom K L x) = Valued.v x ^ - (comap A w.1).asIdeal.ramificationIdx (algebraMap A B) w.1.asIdeal := by + Valued.v (adicCompletionSemialgHom K L w x) = Valued.v x ^ + (w.1.under A).asIdeal.ramificationIdx w.1.asIdeal := by revert x apply funext_iff.mp symm apply UniformSpace.Completion.ext - · exact Valued.continuous_valuation.pow _ - · exact Valued.continuous_valuation.comp UniformSpace.Completion.continuous_extension + · exact (Valued.continuous_valuation_of_surjective (v.valuedAdicCompletion_surjective K)).pow _ + · exact (Valued.continuous_valuation_of_surjective (w.1.valuedAdicCompletion_surjective L)).comp + UniformSpace.Completion.continuous_map intro a - simp_rw [adicCompletionSemialgHom_coe, adicCompletion, Valued.valuedCompletion_apply, - adicValued_apply'] - simp_rw [← w.2] - rw [← valuation_comap A K L B w.1 a] + simp only [adicCompletion, Valued.valuedCompletion_apply, w.2, adicCompletionSemialgHom_coe, + WithVal.equiv_symm_apply, WithVal.valued_toVal, ← valuation_comap A K L B w.1 _] + rw [WithVal.valued_toVal] /-- The canonical map K_v → L_w sends 𝓞_v to 𝓞_w. -/ lemma adicCompletionSemialgHom_image_adicCompletionIntegers : @@ -206,7 +224,7 @@ end Extension namespace adicCompletion -variable (v : HeightOneSpectrum A) (B) +variable (B) /-- The canonical map `K_v → ∏_{w|v} L_w` extending K → L. -/ noncomputable def semialgHomPi : @@ -223,7 +241,7 @@ lemma baseChange_tmul_apply (x y w) : baseChange K L B v (x ⊗ₜ y) w = open scoped TensorProduct.RightActions in /-- The canonical ring homomorphism `L ⊗_K K_v → ∏_{w|v} L_w` as an `K_v`-linear map. -/ -noncomputable def baseChangeRight : +noncomputable abbrev baseChangeRight : L ⊗[K] adicCompletion K v →ₐ[adicCompletion K v] Π w : v.Extension B, w.1.adicCompletion L := (semialgHomPi K L B v).baseChangeRightOfAlgebraMap @@ -236,13 +254,10 @@ open WithZeroMulInt Valued in /-- The data of a rank 1 (ℝ-valued) valuation on K_v. -/ noncomputable local instance : Valuation.RankOne (Valued.v : Valuation (adicCompletion K v) ℤᵐ⁰) where - hom := { - toFun := toNNReal (by norm_num : (2 : NNReal) ≠ 0) - map_zero' := rfl - map_one' := rfl - map_mul' := MonoidWithZeroHom.map_mul (toNNReal (by norm_num)) - } - strictMono' := toNNReal_strictMono (by norm_num) + hom' := (toNNReal (by norm_num : (2 : NNReal) ≠ 0)).comp + (valueGroup₀_equiv_withZeroMulInt _).toMonoidWithZeroHom + strictMono' := toNNReal_strictMono (by norm_num) |>.comp + (by simpa using valueGroup₀_equiv_withZeroMulInt_strictMono _) exists_val_nontrivial := by obtain ⟨x, hx1, hx2⟩ := Submodule.exists_mem_ne_zero_of_ne_bot v.ne_bot use algebraMap A K x @@ -252,14 +267,16 @@ noncomputable local instance : · apply ne_of_lt rwa [valuation_of_algebraMap, intValuation_lt_one_iff_mem] +-- attribute [local instance 9999] SMulCommClass.of_commMonoid TensorProduct.isScalarTower_left +-- IsScalarTower.right Algebra.toSMul Algebra.toModule + +set_option backward.isDefEq.respectTransparency false in +attribute [local instance 9999] Algebra.toModule in open scoped TensorProduct.RightActions in /-- The canonical map `L ⊗[K] K_v → ∏_{w|v} L_w` is surjective. -/ lemma baseChangeRight_surjective [FiniteDimensional K L] : Function.Surjective (baseChangeRight K L B v) := by - let f' := baseChangeRight K L B v |>.toLinearMap - let s : Submodule (adicCompletion K v) ((w : Extension B v) → adicCompletion L w.val) := - LinearMap.range f' - have hFinite : Module.Finite (adicCompletion K v) s := Module.Finite.range f' + let s := (baseChangeRight K L B v).toLinearMap.range have isClosed : IsClosed s.carrier := Submodule.closed_of_finiteDimensional (E := (w : Extension B v) → adicCompletion L w.val) s rw [← AlgHom.coe_toLinearMap, ← LinearMap.range_eq_top, Submodule.eq_top_iff'] @@ -272,20 +289,24 @@ lemma baseChangeRight_surjective [FiniteDimensional K L] : apply Dense.mono _ denseL rintro _ ⟨l, rfl⟩ use (l ⊗ₜ 1) - ext w - simp [baseChangeRight, f'] + simp +attribute [local instance 9999] Algebra.toModule in open scoped TensorProduct.RightActions in /-- ∏_{w|v} L_w is a finite K_v-module. -/ instance [FiniteDimensional K L] : Module.Finite (adicCompletion K v) (Π w : v.Extension B, w.1.adicCompletion L) := .of_surjective (baseChangeRight K L B v).toLinearMap (baseChangeRight_surjective K L B v) +attribute [local instance 9999] Algebra.toModule in /-- L_w is a finite K_v-module if w | v. -/ instance [FiniteDimensional K L] (w : v.Extension B) : Module.Finite (adicCompletion K v) (adicCompletion L w.1) := Module.Finite.of_pi (fun (w : Extension B v) => w.1.adicCompletion L) w +-- attribute [local instance 9999] SMulCommClass.of_commMonoid TensorProduct.isScalarTower_left +-- IsScalarTower.right Algebra.toSMul Algebra.toModule + /-- L_w has the K_v-module topology. -/ instance instIsModuleTopology [FiniteDimensional K L] (w : v.Extension B) : IsModuleTopology (v.adicCompletion K) (w.1.adicCompletion L) := by @@ -295,17 +316,20 @@ instance instIsModuleTopology [FiniteDimensional K L] (w : v.Extension B) : ContinuousLinearEquiv.ofFinrankEq (Module.finrank_fin_fun Kv) apply IsModuleTopology.iso iso +attribute [local instance 9999] Algebra.toModule Algebra.toSMul in /-- ∏_{w|v} L_w has the K_v-module topology. -/ instance instIsModuleTopologyPi [FiniteDimensional K L] : -- the claim that L_w has the module topology. IsModuleTopology (v.adicCompletion K) (Π (w : v.Extension B), w.1.adicCompletion L) := by let := Extension.finite A K L B v exact IsModuleTopology.instPi +attribute [local instance 9999] IsSemitopologicalRing.toIsTopologicalAddGroup + instT2SpaceOfR1SpaceOfT0Space Algebra.toModule in open scoped TensorProduct.RightActions in /-- `tensorAdicCompletionComapLinearMap` is continuous, open and surjective. We later show that it's a homeomorphism. -/ -lemma baseChangeRight_isOpenQuotientMap [FiniteDimensional K L] (v : HeightOneSpectrum A) : +lemma baseChangeRight_isOpenQuotientMap [FiniteDimensional K L] : IsOpenQuotientMap (baseChangeRight K L B v) := by have : T2Space (L ⊗[K] adicCompletion K v) := IsModuleTopology.t2Space' (K := (adicCompletion K v)) @@ -324,13 +348,6 @@ open Extension adicCompletion variable (B) -attribute [local instance 9999] Algebra.toSMul in -/-- The triangle A → 𝓞_v → K_v commutes. -/ -instance (R K : Type*) [CommRing R] [IsDedekindDomain R] [Field K] - [Algebra R K] [IsFractionRing R K] (v : HeightOneSpectrum R) : - IsScalarTower R (v.adicCompletionIntegers K) (v.adicCompletion K) := - ⟨fun x y z ↦ by exact smul_mul_assoc x y.1 z⟩ - /-- The canonical B-algebra map `B ⊗[A] 𝓞_v → L ⊗[K] K_v` -/ noncomputable def tensorAdicCompletionIntegersTo : B ⊗[A] adicCompletionIntegers K v →ₐ[B] L ⊗[K] adicCompletion K v := @@ -401,6 +418,8 @@ lemma tensorAdicCompletionIntegersTo_range_subset_closure [FiniteDimensional K L Algebra.TensorProduct.algebraMap_apply, RingHom.map_mul, ← Algebra.smul_def] simp +set_option maxHeartbeats 0 in +attribute [local instance 9999] Algebra.toModule Algebra.toSMul in open scoped TensorProduct.RightActions in omit [Algebra.IsIntegral A B] [IsDedekindDomain B] [IsFractionRing B L] in /-- The image of `B ⊗[A] 𝓞_v` in `L ⊗[K] K_v` is clopen. -/ @@ -409,6 +428,7 @@ lemma tensorAdicCompletionIntegersTo_isClopen_range IsClopen (SetLike.coe (tensorAdicCompletionIntegersTo K L B v).range) := by -- `B ⊗[A] 𝒪_v` is a subgroup of `L ⊗[K] K_v`, so we can show it's closed -- by showing that it's open. **TODO** split into IsOpen + IsClosed lemmas? + have : SeparatelyContinuousAdd (L ⊗[K] v.adicCompletion K) := instSeparatelyContinuousAddOfContinuousAdd rw [← Subalgebra.coe_toSubring, ← Subring.coe_toAddSubgroup] refine OpenAddSubgroup.isClopen ⟨_, ?_⟩ -- Further, we can show `B ⊗[A] 𝒪_v` is open by showing that it contains an @@ -422,11 +442,11 @@ lemma tensorAdicCompletionIntegersTo_isClopen_range classical exact b.rightBaseChange L -- Use the basis to get a continuous equivalence from `L ⊗[K] K_v` to `ι → K_v`. - let equiv : L ⊗[K] (adicCompletion K v) ≃L[K] (ι → adicCompletion K v) := - IsModuleTopology.continuousLinearEquiv (b'.equivFun) |>.restrictScalars K + let equiv : L ⊗[K] (adicCompletion K v) ≃L[v.adicCompletion K] (ι → adicCompletion K v) := + IsModuleTopology.continuousLinearEquiv (b'.equivFun) -- Use the preimage of `∏ 𝒪_v` as the open neighbourhood. use equiv.symm '' (Set.pi Set.univ (fun _ => SetLike.coe (adicCompletionIntegers K v))) - refine ⟨?_, ?_, by simp⟩ + refine ⟨?_, ?_, by simp [-EmbeddingLike.map_eq_zero_iff, ContinuousLinearEquiv.map_eq_zero_iff]⟩ · intro t ⟨g, hg, ht⟩ -- We have `t = equiv g = ∑ i, b i ⊗ g i`, since `g in ∏ 𝒪_v` and -- `b i ∈ (algebraMap B L).range`, this is `tensorAdicCompletionTo` @@ -435,22 +455,24 @@ lemma tensorAdicCompletionIntegersTo_isClopen_range intro i apply IsIntegralClosure.isIntegral_iff.mp (hb i) choose f hf_prop using hf - use ∑ (i : ι), (f i) ⊗ₜ ⟨g i, hg i trivial⟩ - rw [map_sum, ← ht] + let b : B ⊗[A] ↥(adicCompletionIntegers K v) := ∑ (i : ι), (f i) ⊗ₜ ⟨g i, hg i trivial⟩ + use b + rw [AlgHom.toRingHom_eq_coe, RingHom.coe_coe, map_sum, ← ht] unfold equiv - rw [ContinuousLinearEquiv.restrictScalars_symm_apply, - IsModuleTopology.continuousLinearEquiv_symm_apply, - Module.Basis.equivFun_symm_apply] + rw [IsModuleTopology.continuousLinearEquiv_symm_apply, Module.Basis.equivFun_symm_apply] apply Finset.sum_congr rfl intro x - have : (algebraMap _ (L ⊗[K] adicCompletion K v)) (g x) = 1 ⊗ₜ[K] (g x) := rfl - simp [Algebra.smul_def, tensorAdicCompletionIntegersTo_tmul, hf_prop, b', this] + simp only [Finset.univ_eq_attach, Finset.mem_attach, tensorAdicCompletionIntegersTo_tmul, + hf_prop, Module.Basis.rightBaseChange_apply, Algebra.smul_def, + TensorProduct.RightActions.algebraMap_eval, Algebra.TensorProduct.tmul_mul_tmul, one_mul, + mul_one, imp_self, b'] · rw [ContinuousLinearEquiv.image_symm_eq_preimage] apply IsOpen.preimage equiv.continuous apply isOpen_set_pi Set.finite_univ rintro i - exact Valued.isOpen_valuationSubring (v.adicCompletion K) + omit [Algebra.IsIntegral A B] [IsDedekindDomain B] [IsFractionRing B L] in open scoped TensorProduct.RightActions in /-- The image of `B ⊗[A] 𝓞_v` in `L ⊗[K] K_v` is the closure of the image of `B`. -/ @@ -552,7 +574,7 @@ instance : IsBiscalar B (v.adicCompletionIntegers K) (tensorAdicCompletionIntege TensorProduct.RightActions.algebraMap_eval, map_mul, map_one] rfl -attribute [local instance 9999] Algebra.toSMul in +attribute [local instance 9999] Algebra.toModule Algebra.toSMul in instance {w : v.Extension B} : IsScalarTower (adicCompletionIntegers K v) (adicCompletion K v) (w.1.adicCompletion L) := Submonoid.instIsScalarTowerSubtypeMem (adicCompletionIntegers K v) @@ -599,20 +621,23 @@ lemma tensorAdicCompletionIntegersToAdicCompletion_range_eq_integers [FiniteDime use y simpa [hx'] using congr_fun hy w -attribute [local instance 9999] Algebra.toSMul in +-- shortcut +noncomputable local instance : MulAction (v.adicCompletionIntegers K) (v.adicCompletion K) := + LieAlgebra.ofAssociativeAlgebra.toMulAction + +attribute [local instance 9999] Algebra.toSMul Algebra.toModule in open scoped TensorProduct.RightActions in /-- `𝓞_w` is finite over `𝓞_v`. -/ -- This can be proved for finite extensions of complete discretely valued fields without -- reference to underlying fields being completed, but this is sufficient for our -- purposes. -instance [Module.Finite A B] [FiniteDimensional K L] : +noncomputable instance (priority := 1001) [Module.Finite A B] [FiniteDimensional K L] : Module.Finite (adicCompletionIntegers K v) (adicCompletionIntegers L w.1) := by let integerSubmodule : Submodule (adicCompletionIntegers K v) (adicCompletion L w.1) := - letI : Algebra (v.adicCompletionIntegers K) (w.1.adicCompletionIntegers L).toSubring := + let : Algebra (v.adicCompletionIntegers K) (w.1.adicCompletionIntegers L).toSubring := inferInstanceAs (Algebra (adicCompletionIntegers K v) (adicCompletionIntegers L w.1)) - have : IsScalarTower (adicCompletionIntegers K v) (adicCompletionIntegers L w.1).toSubring - (adicCompletion L w.1) := by - apply IsScalarTower.of_algebraMap_smul fun _ _ ↦ rfl + have : IsScalarTower (adicCompletionIntegers K v) (adicCompletionIntegers L w.1) + (adicCompletion L w.1) := .of_algebraMap_smul fun _ _ ↦ rfl (adicCompletionIntegers L w.1).toSubmodule.restrictScalars (adicCompletionIntegers K v) have heq : (w.tensorAdicCompletionIntegersToAdicCompletion K L B v).toLinearMap.range = @@ -634,16 +659,16 @@ open Extension section RamificationInertia -variable {v : HeightOneSpectrum A} (w : v.Extension B) +variable {v} (w : v.Extension B) lemma _root_.WithZero.ofAdd_neg_ofNat_pow (n : ℕ) : (WithZero.coe (Multiplicative.ofAdd (-n : ℤ))) = (Multiplicative.ofAdd (-1 : ℤ)) ^ n := by congr rw [← ofAdd_nsmul, nsmul_eq_mul, Int.mul_neg_one] theorem ramificationIdx_eq_ramificationIdx : - (v.completionIdeal K).ramificationIdx (algebraMap _ _) (w.1.completionIdeal L) = - v.asIdeal.ramificationIdx (algebraMap A B) w.1.asIdeal := by + (v.completionIdeal K).ramificationIdx (w.1.completionIdeal L) = + v.asIdeal.ramificationIdx w.1.asIdeal := by apply Ideal.ramificationIdx_spec · rw [Ideal.map_le_iff_le_comap] intro x hx @@ -661,7 +686,7 @@ theorem ramificationIdx_eq_ramificationIdx : have hcomap := h hϖ' rw [Ideal.mem_comap, adicCompletion.mem_completionIdeal_pow, integer_algebraMap_apply, valued_adicCompletionSemialgHom, hϖ, ← WithZero.ofAdd_neg_ofNat_pow, - WithZero.coe_le_coe, Multiplicative.ofAdd_le, w.2] at hcomap + WithZero.coe_le_coe, w.2, Multiplicative.ofAdd_le] at hcomap simp at hcomap theorem inertiaDeg_eq_inertiaDeg : @@ -696,14 +721,18 @@ theorem inertiaDeg_eq_inertiaDeg : rw [Ideal.inertiaDeg_algebra_tower v.asIdeal (v.completionIdeal K) (w.1.completionIdeal L), inertiaDeg_asIdeal_completionIdeal, one_mul] +-- shortcut +noncomputable local instance : MulAction (v.adicCompletionIntegers K) (v.adicCompletion K) := + LieAlgebra.ofAssociativeAlgebra.toMulAction + -- We use Ideal.sum_ramification_inertia_of_isLocalRing here to show this, but we could make use -- of the more general results in BGR: -- - in general e * f <= degree (Prop 3.1.3.2) -- - equality holds for L/K if L is K-cartesian (Prop 3.6.2.4) -- - so for example if K is complete and discretely-valued (Cor 2.4.3.11). -attribute [local instance 9999] Algebra.toModule Algebra.toSMul in +attribute [local instance 9999] Algebra.toSMul Algebra.toModule in theorem ramificationIdx_mul_inertiaDeg_eq_finrank [FiniteDimensional K L] [Module.Finite A B] : - v.asIdeal.ramificationIdx (algebraMap A B) w.1.asIdeal * v.asIdeal.inertiaDeg w.1.asIdeal = + v.asIdeal.ramificationIdx w.1.asIdeal * v.asIdeal.inertiaDeg w.1.asIdeal = Module.finrank (adicCompletion K v) (adicCompletion L w.1) := by have : IsScalarTower (adicCompletionIntegers K v) (adicCompletionIntegers L w.1) (adicCompletion L w.1) := .of_algebraMap_smul fun _ _ ↦ rfl @@ -718,23 +747,28 @@ end RamificationInertia variable [FiniteDimensional K L] [Module.Finite A B] (B) variable (v : HeightOneSpectrum A) (w : v.Extension B) +--shortcut +local instance : Module.Free (v.adicCompletion K) (adicCompletion L w.1) := + Module.free_of_finite_type_torsion_free' + open scoped TensorProduct.RightActions in -attribute [local instance 9999] Algebra.toModule in +attribute [local instance 9999] Algebra.toSMul Algebra.toModule in /-- `L ⊗[K] K_v` and `∏_{w|v} L_w` have equal dimensions -/ lemma finrank_tensorProduct_adicCompletion_eq_finrank_pi_adicCompletion : Module.finrank (adicCompletion K v) (L ⊗[K] adicCompletion K v) = Module.finrank (adicCompletion K v) ((w : Extension B v) → adicCompletion L w.val) := letI := Extension.fintype A K L B v calc Module.finrank (adicCompletion K v) (L ⊗[K] adicCompletion K v) _ = Module.finrank K L := by rw [TensorProduct.finrank_rightAlgebra] - _ = ∑ (w : Extension B v), Ideal.ramificationIdx (algebraMap A B) v.asIdeal w.val.asIdeal * + _ = ∑ (w : Extension B v), Ideal.ramificationIdx v.asIdeal w.val.asIdeal * Ideal.inertiaDeg v.asIdeal w.val.asIdeal := by rw [Ideal.sum_ramification_inertia_extensions] _ = ∑ (w : Extension B v), Module.finrank (adicCompletion K v) (adicCompletion L w.val) := Finset.sum_congr rfl fun w _ ↦ ramificationIdx_mul_inertiaDeg_eq_finrank K L w _ = Module.finrank (adicCompletion K v) ((w : Extension B v) → adicCompletion L w.val) := by rw [Module.finrank_pi_fintype (adicCompletion K v)] +attribute [local instance 9999] Algebra.toModule in open scoped TensorProduct.RightActions in /-- The canonical map `L ⊗[K] K_v → ∏_{w|v} L_w` is bijective. -/ theorem baseChange_bijective : Function.Bijective (baseChange K L B v) := by @@ -749,6 +783,8 @@ noncomputable def baseChangeAlgEquiv : L ⊗[K] v.adicCompletion K ≃ₐ[L] Π w : v.Extension B, w.1.adicCompletion L := AlgEquiv.ofBijective (baseChange K L B v) <| baseChange_bijective K L B v +set_option backward.isDefEq.respectTransparency false +attribute [local instance 9999] Algebra.toModule in open scoped TensorProduct.RightActions in /-- The continuous L-algebra isomorphism `L ⊗[K] K_v ≅ ∏_{w|v} L_w`. -/ noncomputable def baseChangeContinuousAlgEquiv : @@ -772,7 +808,7 @@ lemma integerBaseChangeLinearEquiv_tmul_apply (b x) : rfl /-- `𝓞_v` as an `A`-submodule of `K_v`. -/ -noncomputable def integerSubmodule : Submodule A (adicCompletion K v) := +noncomputable def integerSubmodule (v : HeightOneSpectrum A) : Submodule A (adicCompletion K v) := let s : Submodule (adicCompletionIntegers K v) _ := (adicCompletionIntegers K v).toSubmodule s.restrictScalars A @@ -799,23 +835,24 @@ namespace adicCompletion open Extension -variable [FiniteDimensional K L] [Module.Finite A B] (v : HeightOneSpectrum A) +variable [FiniteDimensional K L] [Module.Finite A B] -theorem integerBaseChangeLinearEquiv_bijOn : +attribute [local instance 9999] SMulCommClass.of_commMonoid TensorProduct.isScalarTower_left + IsScalarTower.right in +theorem integerBaseChangeLinearEquiv_bijOn (v : HeightOneSpectrum A) : Set.BijOn (integerBaseChangeLinearEquiv K L B v) (Set.range (adicCompletionIntegers.tensorCoe K B v)) (Submodule.pi Set.univ fun (w : Extension B v) ↦ integerSubmodule L w.val) := by - suffices h : ((integerBaseChangeLinearEquiv K L B v).toEquiv '' + suffices h : ((integerBaseChangeLinearEquiv K L B v) '' (LinearMap.range (adicCompletionIntegers.tensorCoe K B v))) = Submodule.pi .univ fun (w : Extension B v) ↦ (integerSubmodule L w.val).restrictScalars A from h ▸ Equiv.bijOn_image (integerBaseChangeLinearEquiv K L B v).toEquiv - apply Eq.trans _ congr($(range_baseChange_comp_tensorAdicCompletionTo_eq_pi K L B v)) - rw [LinearMap.coe_range, ← Set.range_comp, LinearEquiv.coe_toEquiv, - ← LinearEquiv.coe_toLinearMap, ← LinearMap.coe_comp] - simp_rw [← AlgHom.coe_restrictScalars' B (baseChange K L B v), ← AlgHom.coe_comp, + apply Eq.trans _ (range_baseChange_comp_tensorAdicCompletionTo_eq_pi K L B v) + rw [LinearMap.coe_range, ← Set.range_comp, ← LinearEquiv.coe_toLinearMap, ← LinearMap.coe_comp] + rw [← AlgHom.coe_restrictScalars' B (baseChange K L B v), ← AlgHom.coe_comp, ← ((AlgHom.restrictScalars B _).comp _).coe_restrictScalars' A, ← AlgHom.coe_toLinearMap] congr - refine TensorProduct.ext' (fun x y ↦ ?_) + apply TensorProduct.ext' (fun x y ↦ ?_) ext w simp [← IsScalarTower.algebraMap_apply, baseChange_tmul_apply] diff --git a/FLT/DedekindDomain/FiniteAdeleRing/BaseChange.lean b/FLT/DedekindDomain/FiniteAdeleRing/BaseChange.lean --- a/FLT/DedekindDomain/FiniteAdeleRing/BaseChange.lean +++ b/FLT/DedekindDomain/FiniteAdeleRing/BaseChange.lean @@ -15,7 +15,7 @@ import Mathlib.RingTheory.Flat.TorsionFree # Base change of adele rings. -If `A` is a Dedekind domain with field of fractions `K`, if `L/K` is a finite separable +If `A` is a Dedekind domain with field of fractions `K`, if `L/Ktha` is a finite separable extension and if `B` is the integral closure of `A` in `L`, then `B` is also a Dedekind domain. Hence the rings of finite adeles `𝔸_K^∞` and `𝔸_L^∞` (defined using `A` and `B`) are defined. In this file we define the natural `K`-algebra map `𝔸_K^∞ → 𝔸_L^∞` and @@ -44,7 +44,7 @@ open IsDedekindDomain HeightOneSpectrum adicCompletion Extension open scoped TensorProduct -- ⊗ notation for tensor product lemma tendsTo_comap_cofinite [FaithfulSMul A B] : - Filter.Tendsto (comap A (B:=B)) Filter.cofinite Filter.cofinite := + Filter.Tendsto (under A (B:=B)) Filter.cofinite Filter.cofinite := have : FaithfulSMul A (FractionRing B) := FractionRing.instFaithfulSMul A B letI : Algebra (FractionRing A) (FractionRing B) := FractionRing.liftAlgebra A (FractionRing B) @@ -53,8 +53,8 @@ lemma tendsTo_comap_cofinite [FaithfulSMul A B] : lemma cofinite_mapsTo_adicCompletionSemialgHom : ∀ᶠ (w : HeightOneSpectrum B) in Filter.cofinite, - Set.MapsTo (Extension.adicCompletionSemialgHom K L (v := comap A w) ⟨w, rfl⟩) - (adicCompletionIntegers K (comap A w)) (adicCompletionIntegers L w) := by + Set.MapsTo (Extension.adicCompletionSemialgHom K L (v := under A w) ⟨w, rfl⟩) + (adicCompletionIntegers K (under A w)) (adicCompletionIntegers L w) := by apply Filter.Eventually.of_forall intro w exact Set.image_subset_iff.1 <| adicCompletionSemialgHom_image_adicCompletionIntegers K L ⟨w, rfl⟩ @@ -67,8 +67,8 @@ scoped notation:max ""𝔸ᶠ["" A "", "" K ""]"" => FiniteAdeleRing A K /-- The ring homomorphism `𝔸_K^∞ → 𝔸_L^∞` for `L/K` an extension of number fields. -/ noncomputable def mapRingHom : 𝔸ᶠ[A, K] →+* 𝔸ᶠ[B, L] := have : FaithfulSMul A B := FaithfulSMul.of_field_isFractionRing A B K L - RestrictedProduct.mapAlongRingHom (adicCompletion K) (adicCompletion L) (comap A) - (tendsTo_comap_cofinite A B) (fun w ↦ adicCompletionSemialgHom K L (v := w.comap A) ⟨w, rfl⟩) + RestrictedProduct.mapAlongRingHom (adicCompletion K) (adicCompletion L) (under A) + (tendsTo_comap_cofinite A B) (fun w ↦ adicCompletionSemialgHom K L (v := w.under A) ⟨w, rfl⟩) (cofinite_mapsTo_adicCompletionSemialgHom A K L B) /-- The ring homomorphism `𝔸_K^∞ → 𝔸_L^∞` for `L/K` an extension of number fields, @@ -79,7 +79,7 @@ noncomputable def mapSemialgHom : map_smul' k a := by ext w simpa only [Algebra.smul_def'] using - (adicCompletionSemialgHom K L (v := w.comap A) ⟨w, rfl⟩).map_smul' k (a (comap A w)) + (adicCompletionSemialgHom K L (v := w.under A) ⟨w, rfl⟩).map_smul' k (a (under A w)) continuous_toFun := have : FaithfulSMul A B := FaithfulSMul.of_field_isFractionRing A B K L RestrictedProduct.mapAlong_continuous _ _ _ (tendsTo_comap_cofinite A B) _ @@ -88,7 +88,7 @@ noncomputable def mapSemialgHom : variable {A K B} in lemma mapSemialgHom_apply (x : 𝔸ᶠ[A, K]) (w : HeightOneSpectrum B) : - mapSemialgHom A K L B x w = adicCompletionSemialgHom K L ⟨w, rfl⟩ (x (comap A w)) := rfl + mapSemialgHom A K L B x w = adicCompletionSemialgHom K L ⟨w, rfl⟩ (x (under A w)) := rfl open scoped TensorProduct.RightActions RestrictedProduct @@ -98,10 +98,11 @@ instance : Algebra (Πʳ v : HeightOneSpectrum A, [v.adicCompletion K, v.adicCom (Πʳ w: HeightOneSpectrum B, [w.adicCompletion L, w.adicCompletionIntegers L]) := inferInstanceAs (Algebra 𝔸ᶠ[A, K] 𝔸ᶠ[B, L]) +attribute [local instance 9999] Algebra.toSMul in /-- Utility class which specialises `RestrictedProduct.FiberwiseSMul` to the case of finite adele rings. -/ class ComapFiberwiseSMul extends RestrictedProduct.FiberwiseSMul (α := HeightOneSpectrum B) - (comap A) (adicCompletion K) (fun v ↦ adicCompletionIntegers K v) Filter.cofinite + (under A) (adicCompletion K) (fun v ↦ adicCompletionIntegers K v) Filter.cofinite (adicCompletion L) (fun w ↦ adicCompletionIntegers L w) Filter.cofinite variable [ComapFiberwiseSMul A K L B] @@ -113,8 +114,8 @@ theorem ComapFiberwiseSMul.map_smul' (x : 𝔸ᶠ[A, K]) (y : 𝔸ᶠ[B, L]) (v variable {A K B} in lemma BaseChange.algebraMap_apply (w : HeightOneSpectrum B) (x : 𝔸ᶠ[A, K]) : - algebraMap _ 𝔸ᶠ[B, L] x w = adicCompletionSemialgHom K L ⟨w, rfl⟩ (x (comap A w)) := by - simp [Algebra.algebraMap_eq_smul_one, ComapFiberwiseSMul.map_smul' x 1 (w.comap A) ⟨w, rfl⟩, + algebraMap _ 𝔸ᶠ[B, L] x w = adicCompletionSemialgHom K L ⟨w, rfl⟩ (x (under A w)) := by + simp [Algebra.algebraMap_eq_smul_one, ComapFiberwiseSMul.map_smul' x 1 (w.under A) ⟨w, rfl⟩, RingHom.smul_toAlgebra, SemialgHom.toLinearMap_eq_coe] noncomputable section bijection @@ -133,6 +134,8 @@ lemma tensorEquivTensor_tmul [FiniteDimensional K L] (b : B) (x : 𝔸ᶠ[A, K]) tensorEquivTensor A K L B (algebraMap B L b ⊗ₜ[K] x) = b ⊗ₜ[A] x := by simp [tensorEquivTensor, linearEquivTensorProductModule_tmul] +set_option synthInstance.maxHeartbeats 0 in +set_option maxHeartbeats 0 in /-- The `A`-linear isomorphism `φ : B ⊗[K] 𝔸_K^∞ ≅ ∏'_v [B ⊗[A] K_v, B ⊗[A] 𝓞_v]` given by `φ (b ⊗ x) v = b ⊗ (x v)`. -/ def tensorEquivRestrictedProduct : @@ -156,6 +159,8 @@ lemma tensorEquivRestrictedProduct_tmul (b : B) (x : 𝔸ᶠ[A, K]) (v : HeightOneSpectrum A) : tensorEquivRestrictedProduct A K L B (b ⊗ₜ[A] x) v = b ⊗ₜ[A] (x v) := rfl +set_option synthInstance.maxHeartbeats 0 in +set_option maxHeartbeats 0 in /-- The `A`-linear isomorphism `∏'_v [B ⊗[A] K_v, B ⊗[A] 𝓞_v] ≅ ∏'_v [∏_{w|v} L_w, ∏_{w|v} 𝓞_w]` given by `adicCompletionComapIntegerLinearEquiv`. -/ def restrictedProduct_tensorProduct_equiv_restrictedProduct_prod [FiniteDimensional K L] : @@ -173,6 +178,8 @@ lemma restrictedProduct_tensorProduct_equiv_restrictedProduct_prod_apply [Finite FiniteAdeleRing.restrictedProduct_tensorProduct_equiv_restrictedProduct_prod A K L B f v = integerBaseChangeLinearEquiv K L B v (f v) := rfl +set_option synthInstance.maxHeartbeats 0 in +set_option maxHeartbeats 0 in /-- The `A`-linear isomorphism `∏'_v [∏_{w|v} L_w, ∏_{w|v} 𝓞_w] → 𝔸_L^∞` given by `RestrictedProduct.flatten_equiv'`. -/ def restrictedProduct_prod_equiv [Algebra A 𝔸ᶠ[B, L]] [IsScalarTower A B 𝔸ᶠ[B, L]] : @@ -187,7 +194,7 @@ def restrictedProduct_prod_equiv [Algebra A 𝔸ᶠ[B, L]] [IsScalarTower A B map_add' x y := rfl map_smul' a x := by ext w - change a • (x (comap A w) ⟨w, rfl⟩) = _ + change a • (x (under A w) ⟨w, rfl⟩) = _ simp only [Submodule.coe_pi, Submodule.coe_restrictScalars, Algebra.smul_def, RingHom.id_apply, Equiv.toFun_as_coe, IsScalarTower.algebraMap_apply A B (w.adicCompletion L)] @@ -198,12 +205,14 @@ def restrictedProduct_prod_equiv [Algebra A 𝔸ᶠ[B, L]] [IsScalarTower A B omit [Algebra 𝔸ᶠ[A, K] 𝔸ᶠ[B, L]] [ComapFiberwiseSMul A K L B] in lemma restrictedProduct_prod_equiv_apply [Algebra A 𝔸ᶠ[B, L]] [IsScalarTower A B 𝔸ᶠ[B, L]] (f) (w : HeightOneSpectrum B) : - restrictedProduct_prod_equiv A K L B f w = f (comap A w) ⟨w, rfl⟩ := rfl + restrictedProduct_prod_equiv A K L B f w = f (under A w) ⟨w, rfl⟩ := rfl -- TODO : are all these needed? variable [Algebra K 𝔸ᶠ[B, L]] [IsScalarTower K 𝔸ᶠ[A, K] 𝔸ᶠ[B, L]] [Algebra A 𝔸ᶠ[B, L]] [IsScalarTower A B 𝔸ᶠ[B, L]] [IsScalarTower A 𝔸ᶠ[A, K] 𝔸ᶠ[B, L]] +set_option synthInstance.maxHeartbeats 0 in +set_option maxHeartbeats 0 in /-- The `K`-linear isomorphism `L ⊗ A_K^∞ ≅ A_L^∞` given by composing the previous four maps. -/ def baseChangeLinearEquiv [FiniteDimensional K L] : L ⊗[K] 𝔸ᶠ[A, K] ≃ₗ[K] 𝔸ᶠ[B, L] := have : IsScalarTower A K 𝔸ᶠ[B, L] := .to₁₂₄ _ _ 𝔸ᶠ[A, K] _ @@ -217,6 +226,9 @@ def baseChangeLinearEquiv [FiniteDimensional K L] : L ⊗[K] 𝔸ᶠ[A, K] ≃ lemma algebraMap_apply (x : K) (v : HeightOneSpectrum A) : algebraMap K 𝔸ᶠ[A, K] x v = algebraMap K (v.adicCompletion K) x := rfl +set_option synthInstance.maxHeartbeats 0 in +set_option maxHeartbeats 0 in +set_option backward.isDefEq.respectTransparency false in @[simp] lemma baseChangeLinearEquiv_tmul [FiniteDimensional K L] (b : B) (x : 𝔸ᶠ[A, K]) : baseChangeLinearEquiv A K L B (algebraMap B L b ⊗ₜ x) = @@ -228,6 +240,7 @@ lemma baseChangeLinearEquiv_tmul [FiniteDimensional K L] (b : B) (x : 𝔸ᶠ[A, IsScalarTower.algebraMap_apply B L 𝔸ᶠ[B, L], IsScalarTower.algebraMap_apply B L (w.adicCompletion L), -Submodule.coe_pi] using .inl rfl +set_option backward.isDefEq.respectTransparency false in theorem baseChange_bijective [FiniteDimensional K L] [IsScalarTower K L 𝔸ᶠ[B, L]] : Function.Bijective (SemialgHom.baseChange_of_algebraMap <| (mapSemialgHom A K L B).toSemialgHom) := by @@ -250,6 +263,7 @@ def baseChangeAlgEquiv [FiniteDimensional K L] [IsScalarTower K L 𝔸ᶠ[B, L]] .ofBijective (SemialgHom.baseChange_of_algebraMap <| FiniteAdeleRing.mapSemialgHom A K L B) (FiniteAdeleRing.baseChange_bijective A K L B) +set_option backward.isDefEq.respectTransparency false in /-- The `𝔸_K^∞`-algebra isomorphism `L ⊗_K 𝔸_K^∞ ≅ 𝔸_L^∞`. -/ def baseChangeAdeleAlgEquiv [FiniteDimensional K L] [IsScalarTower K L 𝔸ᶠ[B, L]] : L ⊗[K] 𝔸ᶠ[A, K] ≃ₐ[𝔸ᶠ[A, K]] 𝔸ᶠ[B, L] where @@ -272,20 +286,7 @@ section moduleTopology variable [Algebra K 𝔸ᶠ[B, L]] [IsScalarTower K 𝔸ᶠ[A, K] 𝔸ᶠ[B, L]] [Algebra A 𝔸ᶠ[B, L]] [IsScalarTower A B 𝔸ᶠ[B, L]] [IsScalarTower A 𝔸ᶠ[A, K] 𝔸ᶠ[B, L]] --- shortcut instances - -variable (v : HeightOneSpectrum A) in -noncomputable instance : Module (v.adicCompletionIntegers K) (v.adicCompletion K) := - Algebra.toModule - -variable (v : HeightOneSpectrum A) in -noncomputable instance : MulAction (v.adicCompletionIntegers K) (v.adicCompletion K) := - Algebra.toModule.toMulAction - -variable (v : HeightOneSpectrum A) in -noncomputable instance : SMul (v.adicCompletionIntegers K) (v.adicCompletion K) := - Algebra.toModule.toMulAction.toSMul - +attribute [local instance 9999] Algebra.toModule in /-- `𝓞_v`-module structure on `∏ L_w` from restricting the scalars of the `K_v`-module structure. -/ noncomputable local instance (v : HeightOneSpectrum A) : Module (adicCompletionIntegers K v) ((w : Extension B v) → adicCompletion L w.val) := @@ -296,6 +297,11 @@ noncomputable local instance (v : HeightOneSpectrum A) : SMul (adicCompletionInt ((w : Extension B v) → adicCompletion L w.val) := Module.toDistribMulAction.toDistribSMul.toSMul +-- shortcut +noncomputable local instance (v : HeightOneSpectrum A) : MulAction (v.adicCompletionIntegers K) + (v.adicCompletion K) := LieAlgebra.ofAssociativeAlgebra.toMulAction + +attribute [local instance 9999] Algebra.toModule Algebra.toSMul in /-- `∏_{w∣v} 𝓞_w` as an `𝓞_v`-submodule of `∏_{w∣v} L_w` -/ noncomputable def piAdicIntegerSubmodule (v : HeightOneSpectrum A) : Submodule (adicCompletionIntegers K v) ((w : Extension B v) → adicCompletion L w.val) := @@ -316,17 +322,19 @@ private noncomputable local instance (priority := 9999) (v : HeightOneSpectrum A Module (adicCompletion K v) ((w : Extension B v) → adicCompletion L w.val) := Algebra.toModule +set_option synthInstance.maxHeartbeats 0 in +set_option maxHeartbeats 0 in /-- An auxiliary 𝔸_K-module structure on restricted product over v of (product of w's dividing v of L_w wrt 𝓞_w). Only used in this file to compare L ⊗ 𝔸_K and 𝔸_L. -/ noncomputable local instance : Module 𝔸ᶠ[A, K] Πʳ (v : HeightOneSpectrum A), [(w : Extension B v) → adicCompletion L w.1, ↑(piAdicIntegerSubmodule A K L B v)] := - inferInstanceAs <| Module - (Πʳ v : HeightOneSpectrum A, [v.adicCompletion K, v.adicCompletionIntegers K]) - Πʳ (v : HeightOneSpectrum A), [(w : Extension B v) → adicCompletion L w.1, - ↑(piAdicIntegerSubmodule A K L B v)] + RestrictedProduct.instModuleCoe_fLT +set_option backward.isDefEq.respectTransparency false in +set_option synthInstance.maxHeartbeats 0 in +set_option maxHeartbeats 0 in /-- The continuous `𝔸 K`-Linear equivalence between `∏'_v ∏_{w∣v} L_w` and `𝔸 L` given by reaindexing the elements. -/ noncomputable def restrictedProduct_pi_equiv : @@ -348,6 +356,9 @@ noncomputable def restrictedProduct_pi_equiv : -- needed for the below lemmas for some reason attribute [instance 100] RestrictedProduct.instSMulCoeOfSMulMemClass +set_option backward.isDefEq.respectTransparency false in +set_option synthInstance.maxHeartbeats 0 in +set_option maxHeartbeats 0 in lemma restrictedProduct_pi_isModuleTopology [FiniteDimensional K L] [IsScalarTower K L 𝔸ᶠ[B, L]] : IsModuleTopology 𝔸ᶠ[A, K] (Πʳ (v : HeightOneSpectrum A), [(w : Extension B v) → adicCompletion L w.val, @@ -363,6 +374,8 @@ lemma restrictedProduct_pi_isModuleTopology [FiniteDimensional K L] [IsScalarTow rw [Set.finite_univ_iff] exact Extension.finite A K L B v +set_option synthInstance.maxHeartbeats 0 in +set_option maxHeartbeats 0 in instance [FiniteDimensional K L] [IsScalarTower K L 𝔸ᶠ[B, L]] : IsModuleTopology 𝔸ᶠ[A, K] 𝔸ᶠ[B, L] := have := restrictedProduct_pi_isModuleTopology A K L B diff --git a/FLT/DedekindDomain/IntegralClosure.lean b/FLT/DedekindDomain/IntegralClosure.lean --- a/FLT/DedekindDomain/IntegralClosure.lean +++ b/FLT/DedekindDomain/IntegralClosure.lean @@ -28,33 +28,25 @@ variable (A K L B : Type*) [CommRing A] [CommRing B] [Algebra A B] [Field K] [Fi variable (v : HeightOneSpectrum A) -variable {B L} in -/-- If B/A is an integral extension of Dedekind domains, `comap w` is the pullback -of the nonzero prime `w` to `A`. -/ -def comapAlgebraMap (w : HeightOneSpectrum B) : HeightOneSpectrum A where - asIdeal := w.asIdeal.comap (algebraMap A B) - isPrime := Ideal.comap_isPrime (algebraMap A B) w.asIdeal - ne_bot := mt Ideal.eq_bot_of_comap_eq_bot w.ne_bot - variable {A} in /-- If `B` is an `A`-algebra and `v : HeightOneSpectrum A` is a nonzero prime, then `v.Extension B` is the subtype of `HeightOneSpeectrum B` consisting of valuations of `B` which restrict to `v`. -/ -def Extension (v : HeightOneSpectrum A) := {w : HeightOneSpectrum B // w.comapAlgebraMap A = v} +def Extension (v : HeightOneSpectrum A) := {w : HeightOneSpectrum B // w.under A = v} lemma mk_count_factors_map (hAB : Function.Injective (algebraMap A B)) (w : HeightOneSpectrum B) (I : Ideal A) : (Associates.mk w.asIdeal).count (Associates.mk (Ideal.map (algebraMap A B) I)).factors = - Ideal.ramificationIdx (comapAlgebraMap A w).asIdeal w.asIdeal * - (Associates.mk (comapAlgebraMap A w).asIdeal).count (Associates.mk I).factors := by + Ideal.ramificationIdx (under A w).asIdeal w.asIdeal * + (Associates.mk (under A w).asIdeal).count (Associates.mk I).factors := by classical induction I using UniqueFactorizationMonoid.induction_on_prime with | h₁ => rw [Associates.mk_zero, Ideal.zero_eq_bot, Ideal.map_bot, ← Ideal.zero_eq_bot, Associates.mk_zero] - simp [Associates.count, Associates.factors_zero, w.associates_irreducible, - associates_irreducible (comapAlgebraMap A w), Associates.bcount] + simp [-under_asIdeal, Associates.count, Associates.factors_zero, w.associates_irreducible, + associates_irreducible (under A w), Associates.bcount] | h₂ I hI => obtain rfl : I = ⊤ := by simpa using hI simp only [Ideal.map_top] @@ -71,14 +63,14 @@ lemma mk_count_factors_map (Associates.mk_ne_zero.mpr hI_bot) (associates_irreducible _)] simp only [IH, mul_add] congr 1 - by_cases hw : (w.comapAlgebraMap A).asIdeal = p + by_cases hw : (w.under A).asIdeal = p · have : Irreducible (Associates.mk p) := Associates.irreducible_mk.mpr hp.irreducible rw [hw, Associates.factors_self this, Associates.count_some this] simp only [Multiset.nodup_singleton, Multiset.mem_singleton, Multiset.count_eq_one_of_mem, mul_one] rw [count_associates_factors_eq hp_bot' w.2 w.3, Ideal.IsDedekindDomain.ramificationIdx_eq_normalizedFactors_count hp_bot' w.2 w.3] - · have : (Associates.mk (comapAlgebraMap A w).asIdeal).count (Associates.mk p).factors = 0 := + · have : (Associates.mk (under A w).asIdeal).count (Associates.mk p).factors = 0 := Associates.count_eq_zero_of_ne (associates_irreducible _) (Associates.irreducible_mk.mpr hp.irreducible) (by rwa [ne_eq, Associates.mk_eq_mk_iff_associated, associated_iff_eq]) @@ -87,19 +79,19 @@ lemma mk_count_factors_map rw [eq_comm, ← ne_eq, Associates.count_ne_zero_iff_dvd hp_bot' (irreducible w), Ideal.dvd_iff_le, Ideal.map_le_iff_le_comap] at H apply hw (((Ideal.isPrime_of_prime hp).isMaximal hp_bot).eq_of_le - (comapAlgebraMap A w).2.ne_top H).symm + (under A w).2.ne_top H).symm lemma ramificationIdx_ne_zero (hAB : Function.Injective (algebraMap A B)) (w : HeightOneSpectrum B) : - Ideal.ramificationIdx (comapAlgebraMap A w).asIdeal w.asIdeal ≠ 0 := + Ideal.ramificationIdx (under A w).asIdeal w.asIdeal ≠ 0 := Ideal.IsDedekindDomain.ramificationIdx_ne_zero - ((Ideal.map_eq_bot_iff_of_injective hAB).not.mpr (comapAlgebraMap A w).3) w.2 Ideal.map_comap_le + ((Ideal.map_eq_bot_iff_of_injective hAB).not.mpr (under A w).3) w.2 Ideal.map_comap_le /-- If w | v then for a ∈ A we have w(a)=v(a)^e where e is the ramification index. -/ lemma intValuation_comap (hAB : Function.Injective (algebraMap A B)) (w : HeightOneSpectrum B) (x : A) : - (comapAlgebraMap A w).intValuation x ^ - (Ideal.ramificationIdx (comapAlgebraMap A w).asIdeal w.asIdeal) = + (under A w).intValuation x ^ + (Ideal.ramificationIdx (under A w).asIdeal w.asIdeal) = w.intValuation (algebraMap A B x) := by classical have h_ne_zero := ramificationIdx_ne_zero A B hAB w @@ -114,8 +106,8 @@ lemma intValuation_comap (hAB : Function.Injective (algebraMap A B)) omit [IsIntegralClosure B A L] in /-- If w | v then for x ∈ K we have w(x)=v(x)^e where e is the ramification index. -/ lemma valuation_comap (w : HeightOneSpectrum B) (x : K) : - (comapAlgebraMap A w).valuation K x ^ - (Ideal.ramificationIdx (comapAlgebraMap A w).asIdeal w.asIdeal) = + (under A w).valuation K x ^ + (Ideal.ramificationIdx (under A w).asIdeal w.asIdeal) = w.valuation L (algebraMap K L x) := by obtain ⟨x, y, hy, rfl⟩ := IsFractionRing.div_surjective (A := A) x simp [valuation, ← IsScalarTower.algebraMap_apply A K L, IsScalarTower.algebraMap_apply A B L, @@ -144,7 +136,7 @@ theorem Extension.finite (v : HeightOneSpectrum A) : Finite (v.Extension B) := b rintro w rfl simp only [Ideal.primesOver, Set.mem_setOf_eq, isPrime, true_and] constructor - simp [Ideal.under_def, comapAlgebraMap] + simp [Ideal.under_def, under] · intro x hx y hy hxy rwa [← @HeightOneSpectrum.ext_iff] at hxy @@ -157,8 +149,8 @@ noncomputable def Extension.fintype : Fintype (Extension B v) := include K L in omit [IsIntegralClosure B A L] [IsFractionRing B L] in theorem preimage_comap_finite (S : Set (HeightOneSpectrum A)) (hS : S.Finite) : - ((comapAlgebraMap A : HeightOneSpectrum B → HeightOneSpectrum A) ⁻¹' S).Finite := by - rw [← Set.biUnion_preimage_singleton (comapAlgebraMap A) S] + ((under A : HeightOneSpectrum B → HeightOneSpectrum A) ⁻¹' S).Finite := by + rw [← Set.biUnion_preimage_singleton (under A) S] exact Set.Finite.biUnion' hS <| fun v _ ↦ Extension.finite A K L B v /-- Given an inclusion of Dedekind domains A → B, making B finite over A, @@ -181,7 +173,7 @@ lemma _root_.Ideal.sum_ramification_inertia_extensions [Module.Finite A B] : -- Check that the sums are equal via a bijection apply Finset.sum_nbij (fun w ↦ w.val.asIdeal) · rintro ⟨a, rfl⟩ - - rw [← Finset.mem_coe, coe_primesOverFinset (comapAlgebraMap A a).ne_bot] + rw [← Finset.mem_coe, coe_primesOverFinset (under A a).ne_bot] exact ⟨a.isPrime, ⟨rfl⟩⟩ · apply Function.Injective.injOn exact fun _ _ hw ↦ Subtype.ext <| HeightOneSpectrum.ext hw @@ -195,7 +187,7 @@ lemma _root_.Ideal.sum_ramification_inertia_extensions [Module.Finite A B] : rw [hyover, hbot] exact Ideal.comap_bot_of_injective _ (FaithfulSMul.algebraMap_injective _ _) let w' : HeightOneSpectrum B := ⟨y, hprime, hybot⟩ - have wcomap : comapAlgebraMap A w' = v := HeightOneSpectrum.ext hyover.symm + have wcomap : under A w' = v := HeightOneSpectrum.ext hyover.symm let w : Extension B v := ⟨w', wcomap⟩ exact ⟨w, by simp, rfl⟩ · exact fun _ _ ↦ rfl diff --git a/FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean b/FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean --- a/FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean +++ b/FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean @@ -35,7 +35,7 @@ variable (B : Type*) [Ring B] [Algebra K B] [FiniteDimensional K B] open MeasureTheory IsDedekindDomain HeightOneSpectrum RestrictedProduct /-- We give 𝔸_K^f ⊗ B the 𝔸_K^f-module topology in this file (it's the only sensible topology). -/ -local instance : TopologicalSpace (FiniteAdeleRing (𝓞 K) K ⊗[K] B) := +noncomputable local instance : TopologicalSpace (FiniteAdeleRing (𝓞 K) K ⊗[K] B) := moduleTopology (FiniteAdeleRing (𝓞 K) K) _ local instance : IsModuleTopology (FiniteAdeleRing (𝓞 K) K) (FiniteAdeleRing (𝓞 K) K ⊗[K] B) := @@ -49,7 +49,7 @@ local instance : LocallyCompactSpace (FiniteAdeleRing (𝓞 K) K ⊗[K] B) := /-- We put the Borel measurable space structure on 𝔸_K^f ⊗ B (because it's the only sensible one). -/ -local instance : MeasurableSpace ((FiniteAdeleRing (𝓞 K) K) ⊗[K] B) := borel _ +noncomputable local instance : MeasurableSpace ((FiniteAdeleRing (𝓞 K) K) ⊗[K] B) := borel _ local instance : BorelSpace ((FiniteAdeleRing (𝓞 K) K) ⊗[K] B) := ⟨rfl⟩ @@ -98,6 +98,7 @@ local instance : Set (v.adicCompletion K))) := ⟨isOpenAdicCompletionIntegers K⟩ +set_option backward.isDefEq.respectTransparency false in local instance (v : HeightOneSpectrum (𝓞 K)) : CompactSpace (AddSubgroup.pi (Set.univ : Set (Module.Free.ChooseBasisIndex K B)) fun _ ↦ (adicCompletionIntegers K v).toAddSubgroup) := by @@ -149,6 +150,8 @@ noncomputable def FiniteAdeleRing.Aux.g {ι : Type*} [Fintype ι] (fun _ v ↦ isOpenAdicCompletionIntegers K v) f.trans (ψ.toContinuousAddEquiv.trans f.symm) +set_option maxHeartbeats 0 in +set_option synthInstance.maxHeartbeats 0 in lemma FiniteAdeleRing.Aux.g_commSq {ι : Type*} [Fintype ι] (ψ : (ι → (FiniteAdeleRing (𝓞 K) K)) ≃L[FiniteAdeleRing (𝓞 K) K] (ι → (FiniteAdeleRing (𝓞 K) K))) : @@ -167,7 +170,8 @@ lemma FiniteAdeleRing.Aux.g_commSq {ι : Type*} [Fintype ι] end moving_from_pi_restrictedproduct_to_restrictedproduct_pi /-- The only sensible topological space structure on Kᵥ ⊗ B. -/ -local instance (v : HeightOneSpectrum (𝓞 K)) : TopologicalSpace (adicCompletion K v ⊗[K] B) := +noncomputable local instance (v : HeightOneSpectrum (𝓞 K)) : + TopologicalSpace (adicCompletion K v ⊗[K] B) := moduleTopology (adicCompletion K v) _ local instance (v : HeightOneSpectrum (𝓞 K)) : @@ -198,7 +202,7 @@ noncomputable def FiniteAdeleRing.Aux.e (v : HeightOneSpectrum (𝓞 K)) exact β /-- The only sensible measurable space structure on Kᵥ ⊗ B. -/ -local instance (v : HeightOneSpectrum (𝓞 K)) : +noncomputable local instance (v : HeightOneSpectrum (𝓞 K)) : MeasurableSpace (adicCompletion K v ⊗[K] B) := borel _ local instance (v : HeightOneSpectrum (𝓞 K)) : @@ -265,6 +269,8 @@ lemma basis_eq_single (v : HeightOneSpectrum (𝓞 K)) change ((Module.Free.chooseBasis K B).repr ((Module.Free.chooseBasis K B) j)) b • x simp [Finsupp.single, Pi.single, Algebra.smul_def, Function.update] +set_option maxHeartbeats 0 in +set_option synthInstance.maxHeartbeats 0 in lemma basis_eq (v : HeightOneSpectrum (𝓞 K)) {w : Module.Free.ChooseBasisIndex K B → adicCompletion K v} : ∑ (j : Module.Free.ChooseBasisIndex K B), (w j) • (b_local K B v) j @@ -275,6 +281,7 @@ lemma basis_eq (v : HeightOneSpectrum (𝓞 K)) conv_rhs => rw [hw] simp only [basis_eq_single K B v, map_sum]; rfl +set_option backward.isDefEq.respectTransparency false in lemma basis_eq_single_global {j : Module.Free.ChooseBasisIndex K B} {x : FiniteAdeleRing (𝓞 K) K} : x • (b_global K B) j @@ -335,6 +342,10 @@ noncomputable def φ_local_Kv_linear (v : HeightOneSpectrum (𝓞 K)) | add x y _ _ => simp_all only [AlgHom.toRingHom_eq_coe, smul_add, map_add] } +set_option backward.isDefEq.respectTransparency false in +set_option maxHeartbeats 0 in +set_option synthInstance.maxHeartbeats 0 in +attribute [local instance 9999] Algebra.toSMul Algebra.toModule in lemma localcomponent_matrix (v : HeightOneSpectrum (𝓞 K)) (φ : FiniteAdeleRing (𝓞 K) K ⊗[K] B ≃L[FiniteAdeleRing (𝓞 K) K] FiniteAdeleRing (𝓞 K) K ⊗[K] B) @@ -438,6 +449,8 @@ lemma toMatrix_f simp [f, ← basis_repr_eq_global K B, ← basis_eq_global', LinearMap.toMatrix_apply] +set_option maxHeartbeats 0 in +set_option synthInstance.maxHeartbeats 0 in -- A (continuous) 𝔸_K^f-linear automorphism of 𝔸_K^f ⊗ B is ""integral"" at all but -- finitely many places lemma FiniteAdeleRing.Aux.almost_always_mapsTo @@ -496,6 +509,10 @@ lemma FiniteAdeleRing.Aux.almost_always_bijOn intro v h1 h2 exact (e K B v (FiniteAdeleRing.TensorProduct.localcomponentEquiv (𝓞 K) K B v φ)).bijOn' h1 h2 +set_option backward.isDefEq.respectTransparency false in +set_option maxHeartbeats 0 in +set_option synthInstance.maxHeartbeats 0 in +attribute [local instance 9999] Algebra.toSMul Algebra.toModule in /-- A diagram which obviously commutes, commutes. -/ lemma FiniteAdeleRing.Aux.f_g_local_global (φ : ((FiniteAdeleRing (𝓞 K) K) ⊗[K] B) ≃L[FiniteAdeleRing (𝓞 K) K] diff --git a/FLT/NumberField/AdeleRing.lean b/FLT/NumberField/AdeleRing.lean --- a/FLT/NumberField/AdeleRing.lean +++ b/FLT/NumberField/AdeleRing.lean @@ -67,12 +67,14 @@ scoped notation:max ""𝔸ᶠ["" K ""]"" => 𝔸ᶠ[𝓞 K, K] instance [SMul (𝔸 K) (𝔸 L)] : SMul (K∞ × 𝔸ᶠ[K]) (L∞ × 𝔸ᶠ[L]) := inferInstanceAs (SMul (𝔸 K) (𝔸 L)) +set_option backward.isDefEq.respectTransparency false in lemma smul_fst [SMul K∞ L∞] [SMul 𝔸ᶠ[K] 𝔸ᶠ[L]] [SMul (𝔸 K) (𝔸 L)] [Prod.IsProdSMul K∞ 𝔸ᶠ[K] L∞ 𝔸ᶠ[L]] (x : 𝔸 K) (y : 𝔸 L) : (x • y).1 = x.1 • y.1 := by rw [Prod.IsProdSMul.smul_fst] +set_option backward.isDefEq.respectTransparency false in lemma smul_snd [SMul K∞ L∞] [Algebra 𝔸ᶠ[K] 𝔸ᶠ[L]] [SMul (𝔸 K) (𝔸 L)] [Prod.IsProdSMul K∞ 𝔸ᶠ[K] L∞ 𝔸ᶠ[L]] (x : 𝔸 K) (y : 𝔸 L) : @@ -93,6 +95,7 @@ noncomputable def baseChange : open scoped TensorProduct +set_option backward.isDefEq.respectTransparency false in instance instPiIsModuleTopology : IsModuleTopology (𝔸 K) (Fin (Module.finrank K L) → 𝔸 K) := IsModuleTopology.instPi @@ -102,6 +105,7 @@ variable [Algebra K 𝔸ᶠ[L]] [IsScalarTower K 𝔸ᶠ[K] 𝔸ᶠ[L]] [Algebra (𝓞 K) 𝔸ᶠ[L]] [IsScalarTower (𝓞 K) (𝓞 L) 𝔸ᶠ[L]] [IsScalarTower (𝓞 K) 𝔸ᶠ[K] 𝔸ᶠ[L]] [IsScalarTower K L 𝔸ᶠ[L]] +set_option backward.isDefEq.respectTransparency false in /-- The L-algebra isomorphism `L ⊗[K] 𝔸_K = 𝔸_L`. -/ noncomputable def baseChangeAlgEquiv : (L ⊗[K] 𝔸 K) ≃ₐ[L] 𝔸 L := let tensor := @@ -119,11 +123,17 @@ lemma baseChangeAlgEquiv_fst_apply (l : L) (x : 𝔸 K) : (baseChangeAlgEquiv K L (l ⊗ₜ x)).1 = InfiniteAdeleRing.baseChangeAlgEquiv K L (l ⊗ₜ x.1) := rfl +set_option backward.isDefEq.respectTransparency false in lemma baseChangeAlgEquiv_snd_apply (l : L) (x : 𝔸 K) : (baseChangeAlgEquiv K L (l ⊗ₜ x)).2 = FiniteAdeleRing.baseChangeAlgEquiv (𝓞 K) K L (𝓞 L) (l ⊗ₜ x.2) := rfl +open scoped NumberField.LiesOver + +attribute [local instance 9999] Algebra.toModule + +set_option backward.isDefEq.respectTransparency false in -- TODO: abstract this to a general result `Biscalar × Biscalar → Biscalar` if `Prod.IsProdSMul`? open TensorProduct.RightActions in /-- Take arbitrary `Algebra K L∞`, `Algebra K∞ L∞`, `Algebra 𝔸ᶠ[K] 𝔸ᶠ[L]`, Algebra K 𝔸ᶠ[L]`, @@ -171,6 +181,7 @@ variable [Algebra K∞ L∞] variable [Algebra (𝔸 K) (𝔸 L)] [Prod.IsProdSMul K∞ (FiniteAdeleRing (𝓞 K) K) L∞ (FiniteAdeleRing (𝓞 L) L)] +set_option backward.isDefEq.respectTransparency false in open TensorProduct.RightActions in /-- The `L`-algebra homeomorphism `L ⊗[K] 𝔸 K = 𝔸 L`. -/ noncomputable def baseChangeEquiv [IsModuleTopology (𝔸 K) (𝔸 L)] : @@ -179,6 +190,7 @@ noncomputable def baseChangeEquiv [IsModuleTopology (𝔸 K) (𝔸 L)] : variable {L} [IsModuleTopology (𝔸 K) (𝔸 L)] +set_option backward.isDefEq.respectTransparency false in open scoped TensorProduct.RightActions in theorem baseChangeEquiv_tsum_apply_right (l : L) : baseChangeEquiv K L (l ⊗ₜ[K] 1) = algebraMap L (𝔸 L) l := by @@ -188,11 +200,12 @@ theorem baseChangeEquiv_tsum_apply_right (l : L) : variable (L) +set_option backward.isDefEq.respectTransparency false in open scoped TensorProduct.RightActions in open TensorProduct.AlgebraTensorModule in /-- A continuous `K`-linear isomorphism `L ⊗[K] 𝔸_K = (𝔸_K)ⁿ` for `n = [L:K]` -/ noncomputable abbrev tensorProductEquivPi : - L ⊗[K] (𝔸 K) ≃L[K] (Fin (Module.finrank K L) → 𝔸 K) := + L ⊗[K] (𝔸 K) ≃L[𝔸 K] (Fin (Module.finrank K L) → 𝔸 K) := letI := instPiIsModuleTopology K L -- `𝔸 K ⊗[K] L ≃ₗ[𝔸 K] L ⊗[K] 𝔸 K` -- Note: needs to be this order to avoid instance clash with inferred leftAlgebra @@ -201,8 +214,9 @@ noncomputable abbrev tensorProductEquivPi : let π := finiteEquivPi K L (𝔸 K) -- Stitch together to get `L ⊗[K] 𝔸 K ≃ₗ[𝔸 K] ⊕ 𝔸 K`, which is automatically -- continuous due to `𝔸 K` module topologies on both sides, then restrict scalars to `K` - IsModuleTopology.continuousLinearEquiv (comm.symm.trans π) |>.restrictScalars K + IsModuleTopology.continuousLinearEquiv (comm.symm.trans π) +set_option backward.isDefEq.respectTransparency false in open scoped TensorProduct.RightActions in /-- A continuous additive isomorphism `(𝔸_K)ⁿ ≃ 𝔸_L` for `n = [L:K]` -/ noncomputable abbrev piEquiv : (Fin (Module.finrank K L) → 𝔸 K) ≃ₜ+ 𝔸 L := @@ -214,6 +228,7 @@ noncomputable abbrev piEquiv : (Fin (Module.finrank K L) → 𝔸 K) ≃ₜ+ variable {K L} +set_option backward.isDefEq.respectTransparency false in open TensorProduct.AlgebraTensorModule TensorProduct.RightActions in theorem piEquiv_apply_of_algebraMap {x : Fin (Module.finrank K L) → 𝔸 K} @@ -222,10 +237,9 @@ theorem piEquiv_apply_of_algebraMap piEquiv K L x = algebraMap L _ (Module.Finite.equivPi _ _ |>.symm y) := by simp only [← funext h, ContinuousAddEquiv.trans_apply, ContinuousLinearEquiv.toContinuousAddEquiv_apply, - ContinuousLinearEquiv.restrictScalars_symm_apply, IsModuleTopology.continuousLinearEquiv_symm_apply] rw [LinearEquiv.trans_symm, LinearEquiv.trans_apply, finiteEquivPi_symm_apply] - simp [ContinuousAlgEquiv.toContinuousLinearEquiv_apply, baseChangeEquiv_tsum_apply_right] + simp [baseChangeEquiv_tsum_apply_right] open scoped TensorProduct.RightActions in theorem piEquiv_mem_principalSubgroup @@ -238,6 +252,7 @@ theorem piEquiv_mem_principalSubgroup variable (K L) +set_option backward.isDefEq.respectTransparency false in open scoped TensorProduct.RightActions in theorem piEquiv_map_principalSubgroup : (AddSubgroup.pi Set.univ (fun (_ : Fin (Module.finrank K L)) => principalSubgroup (𝓞 K) K)).map @@ -279,6 +294,7 @@ variable [Algebra K 𝔸ᶠ[L]] [IsScalarTower K 𝔸ᶠ[K] 𝔸ᶠ[L]] [Algebra (𝓞 K) 𝔸ᶠ[L]] [IsScalarTower (𝓞 K) (𝓞 L) 𝔸ᶠ[L]] [IsScalarTower (𝓞 K) 𝔸ᶠ[K] 𝔸ᶠ[L]] [IsScalarTower K L 𝔸ᶠ[L]] +set_option backward.isDefEq.respectTransparency false in /-- V ⊗[K] 𝔸_K = V ⊗[L] 𝔸_L as L-modules for V an L-module and K ⊆ L number fields. -/ noncomputable def ModuleBaseChangeLinearEquiv : V ⊗[K] (𝔸 K) ≃ₗ[L] (V ⊗[L] (𝔸 L)) := @@ -291,6 +307,11 @@ noncomputable def ModuleBaseChangeLinearEquiv : ModuleBaseChangeLinearEquiv K L V (v ⊗ₜ[K] x) = v ⊗ₜ[L] (baseChangeAlgEquiv K L (1 ⊗ₜ[K] x)) := rfl +open scoped NumberField.LiesOver + +attribute [local instance 9999] Algebra.toModule + +set_option backward.isDefEq.respectTransparency false in open TensorProduct.RightActions in instance [Algebra K∞ L∞] [Algebra (𝔸 K) (𝔸 L)] [Pi.FiberwiseSMul (fun a => a.comap (algebraMap K L)) Completion Completion] @@ -311,6 +332,7 @@ instance [Algebra K∞ L∞] [Algebra (𝔸 K) (𝔸 L)] simp [TensorProduct.smul_tmul'] | add x y _ _ => simp_all +set_option backward.isDefEq.respectTransparency false in open scoped TensorProduct.RightActions in /-- 𝔸_K ⊗[K] V = 𝔸_L ⊗[L] V as topological additive groups for V an L-module and K ⊆ L number fields. -/ @@ -340,13 +362,15 @@ are provided as scoped instances to avoid creating diamonds when `K = L`. -/ open IsDedekindDomain AdeleRing -open scoped InfiniteAdeleRing TensorProduct.RightActions NumberField.AdeleRing +open scoped InfiniteAdeleRing TensorProduct.RightActions NumberField.AdeleRing NumberField.LiesOver variable {K L : Type*} [Field K] [Field L] [NumberField K] [NumberField L] [Algebra K L] /-- The `K∞`-algebra on `L∞`, induced by `InfiniteAdeleRing.baseChange K L`. -/ scoped instance : Algebra K∞ L∞ := (InfiniteAdeleRing.baseChange K L).toAlgebra +attribute [local instance 9999] Algebra.toModule + /-- Ensures that `Algebra K∞ L∞` is built out of local algebras `Algebra v.Completion wv.Completion`. -/ scoped instance : Pi.FiberwiseSMul (fun a => a.comap (algebraMap K L)) Completion Completion where @@ -369,6 +393,7 @@ scoped instance : IsScalarTower (𝓞 K) (𝓞 L) 𝔸ᶠ[L] := IsScalarTower.of scoped instance : FiniteAdeleRing.ComapFiberwiseSMul (𝓞 K) K L (𝓞 L) where map_smul r x b σ := by obtain ⟨a, rfl⟩ := σ; rfl +set_option backward.isDefEq.respectTransparency false in scoped instance : IsScalarTower K 𝔸ᶠ[K] 𝔸ᶠ[L] := by apply IsScalarTower.of_algebraMap_eq intro x @@ -387,9 +412,11 @@ finite adele algebra. -/ scoped instance : Prod.IsProdSMul K∞ 𝔸ᶠ[K] L∞ 𝔸ᶠ[L] where map_smul _ _ := rfl +set_option backward.isDefEq.respectTransparency false in scoped instance : Module.Finite (𝔸 K) (𝔸 L) := Module.Finite.equiv ((baseChangeAlgEquiv K L).changeScalars (𝔸 K)).toLinearEquiv +set_option backward.isDefEq.respectTransparency false in scoped instance instIsModuleTopology : IsModuleTopology (𝔸 K) (𝔸 L) := IsModuleTopology.instProd' (A := K∞) @@ -428,6 +455,7 @@ theorem Rat.AdeleRing.integral_and_norm_lt_one (x : ℚ) rw [Int.negSucc_eq] at h1 omega +set_option backward.isDefEq.respectTransparency false in theorem Rat.AdeleRing.zero_discrete : ∃ U : Set (AdeleRing (𝓞 ℚ) ℚ), IsOpen U ∧ (algebraMap ℚ (AdeleRing (𝓞 ℚ) ℚ)) ⁻¹' U = {0} := by let integralAdeles := {f : FiniteAdeleRing (𝓞 ℚ) ℚ | @@ -471,6 +499,7 @@ theorem Rat.AdeleRing.zero_discrete : ∃ U : Set (AdeleRing (𝓞 ℚ) ℚ), variable (K : Type*) [Field K] [NumberField K] +set_option backward.isDefEq.respectTransparency false in theorem NumberField.AdeleRing.zero_discrete : ∃ U : Set (AdeleRing (𝓞 K) K), IsOpen U ∧ (algebraMap K (AdeleRing (𝓞 K) K)) ⁻¹' U = {0} := by obtain ⟨V, hV, hV0⟩ := Rat.AdeleRing.zero_discrete @@ -528,6 +557,7 @@ namespace Rat.FiniteAdeleRing local instance {p : Nat.Primes} : Fact p.1.Prime := ⟨p.2⟩ +set_option backward.isDefEq.respectTransparency false in /-- The `ℚ`-algebra equivalence between `FiniteAdeleRing (𝓞 ℚ) ℚ` and the restricted product `Πʳ (p : Nat.Primes), [ℚ_[p], subring p]` of `Padic`s lifting the equivalence `v.adicCompletion ℚ ≃ₐ[ℚ] ℚ_[v.natGenerator]` at each place. -/ @@ -571,6 +601,7 @@ theorem sub_mem_integralAdeles end Rat.FiniteAdeleRing +set_option backward.isDefEq.respectTransparency false in open NumberField.InfinitePlace.Completion in theorem Rat.InfiniteAdeleRing.exists_unique_sub_mem_Ico (a : InfiniteAdeleRing ℚ) : ∃! (x : 𝓞 ℚ), ∀ v, extensionEmbeddingOfIsReal (Rat.infinitePlace_isReal v) @@ -583,15 +614,15 @@ theorem Rat.InfiniteAdeleRing.exists_unique_sub_mem_Ico (a : InfiniteAdeleRing · intro v rw [Subsingleton.elim v v₀, InfiniteAdeleRing.algebraMap_apply, ringOfIntegersEquiv_symm_apply_coe, map_sub, extensionEmbeddingOfIsReal_coe, - map_intCast, Int.self_sub_floor] + WithAbs.equiv_apply, map_intCast] exact ⟨Int.fract_nonneg _, Int.fract_lt_one _⟩ · intro y hy set x' := ringOfIntegersEquiv y with hx' rw [RingEquiv.eq_symm_apply, ← hx'] let hy2 := (RingEquiv.eq_symm_apply _).2 hx'.symm specialize hy v₀ rw [InfiniteAdeleRing.algebraMap_apply, hy2, ringOfIntegersEquiv_symm_apply_coe, - map_sub, extensionEmbeddingOfIsReal_coe, map_intCast] at hy + map_sub, extensionEmbeddingOfIsReal_coe, WithAbs.equiv_apply, map_intCast] at hy exact Int.eq_floor hy.1 hy.2 open NumberField.InfinitePlace.Completion in @@ -608,6 +639,7 @@ theorem Rat.InfiniteAdeleRing.exists_sub_norm_le_one (a : InfiniteAdeleRing ℚ) instance (v : InfinitePlace K) : ProperSpace v.Completion := ProperSpace.of_locallyCompactSpace v.Completion +set_option backward.isDefEq.respectTransparency false in open Metric IsDedekindDomain.FiniteAdeleRing AdeleRing in theorem Rat.AdeleRing.cocompact : CompactSpace (AdeleRing (𝓞 ℚ) ℚ ⧸ AdeleRing.principalSubgroup (𝓞 ℚ) ℚ) where @@ -673,7 +705,7 @@ lemma Rat.AdeleRing.mem_fundamentalDomain (a : AdeleRing (𝓞 ℚ) ℚ) : ext v change _ = a.2 _ + _ push_cast - simp only [structureMap, FiniteAdeleRing.mk_apply, add_right_inj] + simp only [structureMap] rfl · rw [map_sub, ← add_sub_assoc] refine sub_mem ?_ (coe_algebraMap_mem (𝓞 ℚ) ℚ p r) @@ -683,6 +715,7 @@ lemma Rat.AdeleRing.mem_fundamentalDomain (a : AdeleRing (𝓞 ℚ) ℚ) : rw [map_neg, ← sub_eq_add_neg, Eq.comm] convert (map_sub (FiniteAdeleRing.toAdicCompletion p) a.2 _) +set_option backward.isDefEq.respectTransparency false in -- this uses the same techniques as `Rat.AdeleRing.zero_discrete` which should -- be a corollary: fundamentalDomain - fundamentalDomain ⊆ the U used in the proof -- This lemma is in fact a ""concrete version"" of that one @@ -735,6 +768,7 @@ open NumberField Metric MeasureTheory IsDedekindDomain noncomputable instance : VAdd ℚ (AdeleRing (𝓞 ℚ) ℚ) where vadd q a := algebraMap ℚ (AdeleRing (𝓞 ℚ) ℚ) q + a +set_option backward.isDefEq.respectTransparency false in open IsDedekindDomain Rat in theorem Rat.AdeleRing.isAddFundamentalDomain : IsAddFundamentalDomain ℚ Rat.AdeleRing.fundamentalDomain @@ -778,6 +812,7 @@ theorem Rat.AdeleRing.isAddFundamentalDomain : variable (K L : Type*) [Field K] [Field L] [NumberField K] [NumberField L] [Algebra K L] +set_option backward.isDefEq.respectTransparency false in theorem NumberField.AdeleRing.cocompact : CompactSpace (AdeleRing (𝓞 K) K ⧸ principalSubgroup (𝓞 K) K) := letI := Rat.AdeleRing.cocompact @@ -809,11 +844,13 @@ open scoped TensorProduct.RightActions variable (K L : Type*) [Field K] [NumberField K] [Field L] [NumberField L] [Algebra K L] +set_option backward.isDefEq.respectTransparency false in /-- The canonical `𝔸 K`-algebra homomorphism `(L ⊗_K 𝔸 K) → 𝔸 L` induced by the maps from `L` and `𝔸 K` into `𝔸 L`. -/ noncomputable def baseChangeAdeleAlgHom : (L ⊗[K] (𝔸 K)) →ₐ[𝔸 K] 𝔸 L := (baseChange K L).baseChangeRightOfAlgebraMap +set_option backward.isDefEq.respectTransparency false in lemma baseChangeAdeleAlgHom_bijective : Function.Bijective (baseChangeAdeleAlgHom K L) := by -- There's a linear equivalence `(L ⊗_K 𝔸 K) ≅ 𝔸 L` let linearEquiv : (L ⊗[K] 𝔸 K) ≃ₗ[L] 𝔸 L := @@ -831,23 +868,27 @@ lemma baseChangeAdeleAlgHom_bijective : Function.Bijective (baseChangeAdeleAlgHo rw [eqEquiv] exact linearEquiv.bijective +set_option backward.isDefEq.respectTransparency false in /-- The canonical `𝔸_K`-algebra isomorphism from `L ⊗_K 𝔸_K` to `𝔸_L` induced by the base change map `𝔸_K → 𝔸_L`. -/ noncomputable def baseChangeAlgAdeleEquiv : (L ⊗[K] 𝔸 K) ≃ₐ[𝔸 K] 𝔸 L := AlgEquiv.ofBijective (baseChangeAdeleAlgHom K L) (baseChangeAdeleAlgHom_bijective K L) +set_option backward.isDefEq.respectTransparency false in /-- The canonical `𝔸_K`-algebra homeomorphism from `L ⊗_K 𝔸_K` to `𝔸_L` induced by the base change map `𝔸_K → 𝔸_L`. -/ noncomputable def baseChangeAdeleEquiv : (L ⊗[K] 𝔸 K) ≃A[𝔸 K] 𝔸 L := IsModuleTopology.continuousAlgEquivOfAlgEquiv <| baseChangeAlgAdeleEquiv K L +set_option backward.isDefEq.respectTransparency false in /-- The canonical `L`-algebra isomorphism from `L ⊗_K 𝔸_K` to `𝔸_L` induced by the `K`-algebra base change map `𝔸_K → 𝔸_L`. -/ noncomputable def baseChangeEquiv' : (L ⊗[K] 𝔸 K) ≃A[L] 𝔸 L where __ := (baseChange K L).baseChange_of_algebraMap __ := baseChangeAdeleEquiv K L +set_option backward.isDefEq.respectTransparency false in -- this isn't rfl. Explanation below example (x : L ⊗[K] 𝔸 K) : baseChangeEquiv K L x = baseChangeEquiv' K L x := by induction x with",267,167,434,6.5,diff_derived,False,129,5,1,3,2,pr_merge,False,leanprover/lean4:v4.29.0,leanbench/lean4-env:4.29.0,lake build,600,lean_compiler,algebra,2026-04-28T12:39:48Z,extraction_pipeline_v2 LB-0006,pr_completion,easy,2.4,ImperialCollegeLondon/FLT,883,fix: `WithZeroMulInt` issues for bump to 4.29.0,https://github.com/ImperialCollegeLondon/FLT/pull/883,,6e04ca51c224b2ef37db017617e56bf917858a68,df1bd1124322a770996e7cb67e747e6802c25ea8,"FLT/Mathlib/Topology/Algebra/Valued/WithZeroMulInt.lean,FLT/NumberField/Completion/Finite.lean",FLT/Mathlib/Topology/Algebra/Valued/WithZeroMulInt.lean,"# Task: fix: `WithZeroMulInt` issues for bump to 4.29.0 ## Files affected - FLT/Mathlib/Topology/Algebra/Valued/WithZeroMulInt.lean (+21/-46) - FLT/NumberField/Completion/Finite.lean (+1/-0) ## Theorems to prove ### `finite_cover_of_uniformity_basis` in `FLT/Mathlib/Topology/Algebra/Valued/WithZeroMulInt.lean` ```lean theorem finite_cover_of_uniformity_basis [IsDiscreteValuationRing 𝒪[K]] (γ : ℤᵐ⁰ˣ) ``` ### `integer_compactSpace` in `FLT/Mathlib/Topology/Algebra/Valued/WithZeroMulInt.lean` ```lean theorem integer_compactSpace [CompleteSpace K] [IsDiscreteValuationRing 𝒪[K]] ``` ## Existing declarations to modify - `finite_cover_of_uniformity_basis` in `FLT/Mathlib/Topology/Algebra/Valued/WithZeroMulInt.lean` (preserve semantics while updating code/proof) - `integer_compactSpace` in `FLT/Mathlib/Topology/Algebra/Valued/WithZeroMulInt.lean` (preserve semantics while updating code/proof) ## Verification The patched repository must compile with `lake build`.","diff --git a/FLT/Mathlib/Topology/Algebra/Valued/WithZeroMulInt.lean b/FLT/Mathlib/Topology/Algebra/Valued/WithZeroMulInt.lean --- a/FLT/Mathlib/Topology/Algebra/Valued/WithZeroMulInt.lean +++ b/FLT/Mathlib/Topology/Algebra/Valued/WithZeroMulInt.lean @@ -9,6 +9,9 @@ import Mathlib.RingTheory.DiscreteValuationRing.Basic import Mathlib.RingTheory.Ideal.IsPrincipalPowQuotient import Mathlib.Analysis.Normed.Ring.Lemmas import Mathlib.Topology.Algebra.Valued.ValuedField +import Mathlib.Topology.Algebra.Valued.WithZeroMulInt +import Mathlib.Topology.Algebra.Valued.LocallyCompact +import Mathlib.RingTheory.Valuation.Discrete.RankOne /-! # Topological results for integer-valued rings @@ -24,43 +27,7 @@ open scoped Topology namespace Valued.WithZeroMulInt -open Set Filter in -/-- In a `ℤᵐ⁰`-valued ring, powers of `x` tend to zero if `v x ≤ ofAdd (-1 : ℤ)`. -/ -theorem tendsto_zero_pow_of_le_neg_one {K : Type*} [Ring K] [Valued K ℤᵐ⁰] - {x : K} (hx : v x ≤ ofAdd (-1 : ℤ)) : - Tendsto (fun (n : ℕ) => x ^ n) atTop (𝓝 0) := by - simp only [(hasBasis_nhds_zero _ _).tendsto_right_iff, mem_setOf_eq, map_pow, eventually_atTop] - have h_lt : ofAdd (-1 : ℤ) < (1 : ℤᵐ⁰) := by - rw [← coe_one, coe_lt_coe, ← ofAdd_zero, ofAdd_lt]; linarith - intro γ _ - let γ' := Units.map MonoidWithZeroHom.ValueGroup₀.embedding.toMonoidHom γ - suffices ∃ a, ∀ b ≥ a, v x ^ b < γ' by sorry - by_cases hγ' : γ'.val ≤ 1 - · let m := - toAdd (unitsWithZeroEquiv γ') + 1 |>.toNat - refine ⟨m, fun b hb => lt_of_le_of_lt - (pow_le_pow_of_le_one zero_le' (le_trans hx <| le_of_lt h_lt) hb) ?_⟩ - replace hγ' : 0 ≤ -toAdd (unitsWithZeroEquiv γ') + 1 := by - rw [← coe_unitsWithZeroEquiv_eq_units_val, ←coe_one, coe_le_coe, ← toAdd_le, toAdd_one] at hγ' - linarith - apply lt_of_le_of_lt <| pow_le_pow_left₀ zero_le' hx m - rw [← coe_unitsWithZeroEquiv_eq_units_val, ← coe_pow, coe_lt_coe, ← ofAdd_nsmul, - nsmul_eq_mul, Int.toNat_of_nonneg hγ', mul_neg, mul_one, neg_add_rev, neg_neg, ofAdd_add, - ofAdd_neg, ofAdd_toAdd, mul_lt_iff_lt_one_right', Left.inv_lt_one_iff, ← ofAdd_zero, ofAdd_lt] - exact zero_lt_one - · refine ⟨1, fun b hb => lt_of_le_of_lt - (pow_le_pow_of_le_one zero_le' (le_trans hx <| le_of_lt h_lt) hb) ?_⟩ - apply pow_one (v x) ▸ lt_trans (lt_of_le_of_lt hx h_lt) (lt_of_not_ge hγ') - -open Filter in -theorem exists_pow_lt_of_le_neg_one {K : Type*} [Ring K] [Valued K ℤᵐ⁰] - {x : K} (hx : v x ≤ ofAdd (-1 : ℤ)) (γ : ℤᵐ⁰ˣ) : - ∃ n, v x ^ n < γ := by - simp_rw [← map_pow] - let ⟨n, hn⟩ := eventually_atTop.1 <| - ((hasBasis_nhds_zero _ _).tendsto_right_iff ).1 (tendsto_zero_pow_of_le_neg_one hx) γ trivial - exact ⟨n, by simpa using hn n le_rfl⟩ - -variable {K : Type*} [Field K] [Valued K ℤᵐ⁰] +variable {K : Type*} [Field K] [hv : Valued K ℤᵐ⁰] theorem irreducible_valuation_lt_one {ϖ : 𝒪[K]} (h : Irreducible ϖ) : v ϖ.1 < 1 := by have := mt (Valuation.integer.integers _).isUnit_iff_valuation_eq_one.2 h.not_isUnit @@ -107,13 +74,13 @@ lemma finite_quotient_maximalIdeal_pow_of_finite_residueField {K Γ₀ : Type*} /-- The ring of integers `𝒪[K]` of a `ℤᵐ⁰`-valued field `K` with finite residue field has a finite covering by elements of the basis of uniformity of `K`, whenever `𝒪[K]` is a discrete valuation ring. -/ -theorem finite_cover_of_uniformity_basis [IsDiscreteValuationRing 𝒪[K]] {γ : ℤᵐ⁰ˣ} +theorem finite_cover_of_uniformity_basis [IsDiscreteValuationRing 𝒪[K]] (γ : ℤᵐ⁰ˣ) (h : Finite 𝓀[K]) : ∃ t : Set K, Set.Finite t ∧ (𝒪[K]).carrier ⊆ ⋃ y ∈ t, { x | (x, y) ∈ { p | v (p.2 - p.1) < γ.val } } := by classical let ⟨ϖ, hϖ⟩ := IsDiscreteValuationRing.exists_irreducible 𝒪[K] - let ⟨m, hm⟩ := exists_pow_lt_of_le_neg_one (irreducible_valuation_le_ofAdd_neg_one hϖ) γ + let ⟨m, hm⟩ := exists_pow_lt_of_le_exp_neg_one (irreducible_valuation_le_ofAdd_neg_one hϖ) γ letI := finite_quotient_maximalIdeal_pow_of_finite_residueField h m have h := Fintype.ofFinite (𝒪[K] ⧸ 𝓂[K] ^ m) let T := Subtype.val '' (h.elems.image Quotient.out : Set 𝒪[K]) @@ -125,15 +92,23 @@ theorem finite_cover_of_uniformity_basis [IsDiscreteValuationRing 𝒪[K]] {γ : variable (K) -set_option backward.isDefEq.respectTransparency false in +open Valuation.IsRankOneDiscrete in /-- The ring of integers `𝒪[K]` of a complete `ℤᵐ⁰`-valued field `K` with finite residue field is compact, whenever `𝒪[K]` is a discrete valuation ring. -/ -theorem integer_compactSpace [CompleteSpace K] [IsDiscreteValuationRing 𝒪[K]] (h : Finite 𝓀[K]) : +theorem integer_compactSpace [CompleteSpace K] [IsDiscreteValuationRing 𝒪[K]] + [hv.v.IsRankOneDiscrete] (h : Finite 𝓀[K]) (hsurj : Function.Surjective hv.v) : CompactSpace 𝒪[K] where - isCompact_univ := - isCompact_iff_isCompact_univ.1 <| - isCompact_iff_totallyBounded_isComplete.2 - ⟨(hasBasis_uniformity _ _).totallyBounded_iff.2 <| fun _ _ => - finite_cover_of_uniformity_basis h, (isClosed_integer K).isComplete⟩ + isCompact_univ := by + refine isCompact_iff_isCompact_univ.1 <| isCompact_iff_totallyBounded_isComplete.2 + ⟨(hasBasis_uniformity _ _).totallyBounded_iff.2 fun γ _ ↦ ?_, (isClosed_integer K).isComplete⟩ + obtain ⟨t, htf, ht⟩ := finite_cover_of_uniformity_basis + (Units.mapEquiv (valueGroup₀_equiv_withZeroMulInt v) γ) h + refine ⟨t, htf, ht.trans fun x hx ↦ ?_⟩ + simp only [Set.mem_setOf_eq, Set.mem_iUnion] at hx ⊢ + obtain ⟨i, hit, hi⟩ := hx + use i, hit + rw [← (valueGroup₀_equiv_withZeroMulInt_strictMono _).lt_iff_lt, + valueGroup₀_equiv_withZeroMulInt_restrict_apply_of_surjective hsurj] + simpa using hi end Valued.WithZeroMulInt diff --git a/FLT/NumberField/Completion/Finite.lean b/FLT/NumberField/Completion/Finite.lean --- a/FLT/NumberField/Completion/Finite.lean +++ b/FLT/NumberField/Completion/Finite.lean @@ -42,6 +42,7 @@ instance : Finite (𝓀[v.adicCompletion K]) := instance NumberField.instCompactSpaceAdicCompletionIntegers : CompactSpace (v.adicCompletionIntegers K) := Valued.WithZeroMulInt.integer_compactSpace (v.adicCompletion K) inferInstance + (v.valuedAdicCompletion_surjective) lemma NumberField.isCompactAdicCompletionIntegers : IsCompact (v.adicCompletionIntegers K : Set (v.adicCompletion K)) := by",22,46,68,7.0,diff_derived,False,0,2,2,0,0,pr_merge,False,leanprover/lean4:v4.29.0,leanbench/lean4-env:4.29.0,lake build,600,lean_compiler,algebra,2026-04-28T12:39:48Z,extraction_pipeline_v2 LB-0007,pr_completion,hard,7.4,ImperialCollegeLondon/FLT,882,fix: `WithAbs` issues in 4.29.0 bump,https://github.com/ImperialCollegeLondon/FLT/pull/882,,bd1033acf6742eb55c375c2f5a7fafb9e0ef6d25,5b0ecd9f4770fe3425cff1af11a8ad5bf1d7e243,"FLT.lean,FLT/Mathlib/Algebra/Algebra/Hom.lean,FLT/Mathlib/Analysis/Normed/Ring/WithAbs.lean,FLT/NumberField/Completion/Infinite.lean,FLT/NumberField/InfiniteAdeleRing.lean,FLT/NumberField/InfinitePlace/Dimension.lean,FLT/NumberField/InfinitePlace/WeakApproximation.lean",FLT.lean,"# Task: fix: `WithAbs` issues in 4.29.0 bump ## Context - `WeakApproximation.lean` is now in mathlib - `Dimension.lean` is almost in mathlib, so just replace contents with the open mathlib PR [#30551](https://github.com/leanprover-community/mathlib4/pull/30551) - most of `WithAbs.lean` is in mathlib - Introduce `SemialgHom.restrictScalars` to go from `v.Completion →ₛₐ[algebraMap (WithAbs v.1) (WithAbs w.1)] w.Completion` to `v.Completion →ₛₐ[algebraMap K L] w.Completion` which was previously defeq ## Files affected - FLT.lean (+0/-1) - FLT/Mathlib/Algebra/Algebra/Hom.lean (+13/-0) - FLT/Mathlib/Analysis/Normed/Ring/WithAbs.lean (+0/-74) - FLT/NumberField/Completion/Infinite.lean (+51/-15) - FLT/NumberField/InfiniteAdeleRing.lean (+22/-29) - FLT/NumberField/InfinitePlace/Dimension.lean (+124/-541) - FLT/NumberField/InfinitePlace/WeakApproximation.lean (+0/-312) ## Theorems to prove ### `denseRange_algebraMap_subtype_pi` in `FLT/NumberField/Completion/Infinite.lean` ```lean theorem denseRange_algebraMap_subtype_pi (p : InfinitePlace K → Prop) [NumberField K] : ``` ### `mem_placesOver_iff_comap` in `FLT/NumberField/Completion/Infinite.lean` ```lean theorem mem_placesOver_iff_comap (v : InfinitePlace K) (w : InfinitePlace L) : ``` ### `finrank_eq_two_of_isRamified` in `FLT/NumberField/InfinitePlace/Dimension.lean` ```lean theorem finrank_eq_two_of_isRamified (w : InfinitePlace L) [w.1.LiesOver v.1] ``` Description: If `w` is a ramified place over `v` then `w.Completion` has `v.Completion` dimension two. ### `finrank_eq_one_of_isUnramified` in `FLT/NumberField/InfinitePlace/Dimension.lean` ```lean theorem finrank_eq_one_of_isUnramified [w.1.LiesOver v.1] (h : w.IsUnramified K) : ``` Description: If `w` is an unramified place over `v` then `w.Completion` has `v.Completion` dimension one. ### `inertiaDeg_of_liesOver` in `FLT/NumberField/InfinitePlace/Dimension.lean` ```lean theorem inertiaDeg_of_liesOver [w.1.LiesOver v.1] : ``` Description: The inertia degree of `w` over `v`. ### `inertiaDeg_eq_finrank` in `FLT/NumberField/InfinitePlace/Dimension.lean` ```lean theorem inertiaDeg_eq_finrank [w.1.LiesOver v.1] : ``` ### `inertiaDeg_eq_one` in `FLT/NumberField/InfinitePlace/Dimension.lean` ```lean theorem inertiaDeg_eq_one (hw : w ∈ unramifiedPlacesOver L v) : v.inertiaDeg w = 1 := ``` ### `inertiaDeg_eq_two` in `FLT/NumberField/InfinitePlace/Dimension.lean` ```lean theorem inertiaDeg_eq_two (hw : w ∈ ramifiedPlacesOver L v) : v.inertiaDeg w = 2 := ``` ### `sum_inertiaDeg_eq_finrank` in `FLT/NumberField/InfinitePlace/Dimension.lean` ```lean theorem sum_inertiaDeg_eq_finrank [NumberField K] [NumberField L] : ``` Description: The degree of `L` over `K` is equal to the sum of the inertia degrees of the places over `v`. ## Definitions to add - `SemialgHom.restrictScalars` in `FLT/Mathlib/Algebra/Algebra/Hom.lean`: Restrict the scalars of semialgebra map `f : A →ₛₐ[ψ] B` where `ψ : R' →ₛₐ[φ] S'`, to - `_root_.WithAbs.semialgebraMap` in `FLT/NumberField/Completion/Infinite.lean` ```lean def _root_.WithAbs.semialgebraMap {R R' S : Type*} [CommSemiring R] [CommSemiring R'] [Semiring S] ``` ## Verification The patched repository must compile with `lake build`.","diff --git a/FLT.lean b/FLT.lean --- a/FLT.lean +++ b/FLT.lean @@ -152,7 +152,6 @@ import FLT.NumberField.HeightOneSpectrum import FLT.NumberField.InfiniteAdeleRing import FLT.NumberField.InfinitePlace.Dimension import FLT.NumberField.InfinitePlace.Extension -import FLT.NumberField.InfinitePlace.WeakApproximation import FLT.NumberField.Padics.RestrictedProduct import FLT.Patching.Algebra import FLT.Patching.Module diff --git a/FLT/Mathlib/Algebra/Algebra/Hom.lean b/FLT/Mathlib/Algebra/Algebra/Hom.lean --- a/FLT/Mathlib/Algebra/Algebra/Hom.lean +++ b/FLT/Mathlib/Algebra/Algebra/Hom.lean @@ -128,4 +128,17 @@ def SemialgHom.prodMap {C D : Type*} [Semiring C] [Semiring D] A × B →ₛₐ[φ] C × D := (f.compAlgHom (AlgHom.fst R A B)).prod (g.compAlgHom (AlgHom.snd R A B)) +/-- Restrict the scalars of semialgebra map `f : A →ₛₐ[ψ] B` where `ψ : R' →ₛₐ[φ] S'`, to +`φ : R →+* S`. -/ +@[simps!] +def SemialgHom.restrictScalars {R S R' S' : Type*} [CommSemiring R] [CommSemiring S] + [CommSemiring R'] [CommSemiring S'] [Algebra R R'] [Algebra S S'] {φ : R →+* S} + (ψ : R' →ₛₐ[φ] S') {A B : Type*} [Semiring A] [Semiring B] [Algebra R A] [Algebra S B] + [Algebra R' A] [Algebra S' B] [IsScalarTower R R' A] [IsScalarTower S S' B] + (f : A →ₛₐ[ψ.toRingHom] B) : A →ₛₐ[φ] B where + __ := f.toRingHom + map_smul' r a := by + have := f.map_smul (algebraMap R R' r) a + simp_all [SemialgHom.toLinearMap_eq_coe, Algebra.algebraMap_eq_smul_one, ψ.map_smul] + end semialghom diff --git a/FLT/Mathlib/Analysis/Normed/Ring/WithAbs.lean b/FLT/Mathlib/Analysis/Normed/Ring/WithAbs.lean --- a/FLT/Mathlib/Analysis/Normed/Ring/WithAbs.lean +++ b/FLT/Mathlib/Analysis/Normed/Ring/WithAbs.lean @@ -5,84 +5,10 @@ import Mathlib namespace WithAbs -variable {R S : Type*} [Semiring S] [Field R] [PartialOrder S] (v : AbsoluteValue R S) - -variable {R' : Type*} [Field R'] - --- attribute [local instance] moduleLeft in --- instance [Module R R'] : Module (WithAbs v) R' := inferInstance --- -- Module.compHom R' (equiv v).toRingHom - --- attribute [local instance] algebraLeft in --- instance [Algebra R R'] : Algebra (WithAbs v) R' := inferInstance - ---set_option backward.isDefEq.respectTransparency false in -attribute [local instance] moduleLeft in -instance [Module R R'] [FiniteDimensional R R'] : FiniteDimensional (WithAbs v) R' := - inferInstance - -instance [Algebra R R'] [Algebra.IsSeparable R R'] : Algebra.IsSeparable (WithAbs v) R' := - inferInstance - variable {K : Type*} [Field K] {v : AbsoluteValue K ℝ} {L : Type*} [Field L] [Algebra K L] {w : AbsoluteValue L ℝ} -instance : Algebra (WithAbs v) (WithAbs w) := inferInstance - -instance : Algebra K (WithAbs w) := inferInstance - instance [NumberField K] : NumberField (WithAbs v) := NumberField.of_ringEquiv K (WithAbs v) (equiv v).symm -theorem norm_eq_abs (x : WithAbs v) : ‖x‖ = v x := rfl - -theorem uniformContinuous_algebraMap {v : AbsoluteValue K ℝ} {w : AbsoluteValue L ℝ} - (h : ∀ x, w (algebraMap (WithAbs v) (WithAbs w) x) = v (WithAbs.equiv v x)) : - UniformContinuous (algebraMap (WithAbs v) (WithAbs w)) := - AddMonoidHomClass.isometry_of_norm _ h |>.uniformContinuous - -instance : UniformContinuousConstSMul K (WithAbs w) := - uniformContinuousConstSMul_of_continuousConstSMul _ _ - -instance : IsScalarTower K L (WithAbs w) := inferInstanceAs (IsScalarTower K L L) - end WithAbs - -namespace AbsoluteValue.Completion - -variable {K : Type*} [Field K] {v : AbsoluteValue K ℝ} - {L : Type*} [Field L] [Algebra K L] {w : AbsoluteValue L ℝ} - -/-- If $K/L$ are fields, $v$ and $w$ are absolute values of $K$ and $L$ respectively, such that -$w|_K = v$, then this is the natural semi-algebra map from the completion $K_v$ of $K$ at $v$ -to the completion $L_w$ at $w$. -/ -noncomputable abbrev semialgHomOfComp - (h : ∀ x, w (algebraMap (WithAbs v) (WithAbs w) x) = v (WithAbs.equiv v x)) : - v.Completion →ₛₐ[algebraMap (WithAbs v) (WithAbs w)] w.Completion := - UniformSpace.Completion.mapSemialgHom _ - (AddMonoidHomClass.isometry_of_norm _ h).uniformContinuous.continuous - -theorem semialgHomOfComp_coe - (h : ∀ x, w (algebraMap (WithAbs v) (WithAbs w) x) = v (WithAbs.equiv v x)) - (x : WithAbs v) : - semialgHomOfComp h x = algebraMap (WithAbs v) (WithAbs w) x := - UniformSpace.Completion.mapSemialgHom_coe - (AddMonoidHomClass.isometry_of_norm _ h).uniformContinuous x - -theorem semiAlgHomOfComp_dist_eq - (h : ∀ x, w (algebraMap (WithAbs v) (WithAbs w) x) = v (WithAbs.equiv v x)) - (x y : v.Completion) : - dist (semialgHomOfComp h x) (semialgHomOfComp h y) = dist x y := by - refine UniformSpace.Completion.induction_on₂ x y ?_ (fun x y => ?_) - · refine isClosed_eq ?_ continuous_dist - exact continuous_iff_continuous_dist.1 UniformSpace.Completion.continuous_extension - · rw [semialgHomOfComp_coe, semialgHomOfComp_coe, UniformSpace.Completion.dist_eq] - exact UniformSpace.Completion.dist_eq x y ▸ - (AddMonoidHomClass.isometry_of_norm _ h).dist_eq x y - -theorem isometry_semiAlgHomOfComp - (h : ∀ x, w (algebraMap (WithAbs v) (WithAbs w) x) = v (WithAbs.equiv v x)) : - Isometry (semialgHomOfComp h) := - Isometry.of_dist_eq <| semiAlgHomOfComp_dist_eq h - -end AbsoluteValue.Completion diff --git a/FLT/NumberField/Completion/Infinite.lean b/FLT/NumberField/Completion/Infinite.lean --- a/FLT/NumberField/Completion/Infinite.lean +++ b/FLT/NumberField/Completion/Infinite.lean @@ -4,7 +4,9 @@ import FLT.Mathlib.Topology.Algebra.Module.FiniteDimension import FLT.Mathlib.Topology.Algebra.Module.ModuleTopology import FLT.Mathlib.Topology.MetricSpace.Pseudo.Matrix import FLT.NumberField.InfinitePlace.Dimension -import FLT.NumberField.InfinitePlace.WeakApproximation +import FLT.NumberField.InfinitePlace.Extension +import FLT.Mathlib.Topology.Algebra.UniformRing +import Mathlib.NumberTheory.NumberField.InfiniteAdeleRing open scoped TensorProduct @@ -17,42 +19,64 @@ noncomputable section namespace NumberField.InfinitePlace.Completion open AbsoluteValue.Completion UniformSpace.Completion SemialgHom +open scoped NumberField.LiesOver variable {K L : Type*} [Field K] [Field L] [Algebra K L] {v : InfinitePlace K} {w : InfinitePlace L} {wv : v.Extension L} -instance {v : InfinitePlace K} : NontriviallyNormedField (v.Completion) where +instance : wv.1.1.LiesOver v.1 where + comp_eq := by simp [← wv.2, InfinitePlace.comap] + +instance {v : InfinitePlace K} : NontriviallyNormedField v.Completion where toNormedField := InfinitePlace.Completion.instNormedField v non_trivial := let ⟨x, hx⟩ := v.isNontrivial.exists_abv_gt_one ⟨x, by rw [UniformSpace.Completion.norm_coe]; exact hx⟩ -instance : NormedSpace v.Completion wv.1.Completion where - norm_smul_le x y := by - rw [Algebra.smul_def, norm_mul, SemialgHom.algebraMap_apply, - ← isometry_semiAlgHomOfComp (comp_of_comap_eq wv.2) |>.norm_map_of_map_zero (map_zero _)] - noncomputable instance : FiniteDimensional v.Completion wv.1.Completion := FiniteDimensional.of_locallyCompactSpace v.Completion +variable (K) in +theorem denseRange_algebraMap_subtype_pi (p : InfinitePlace K → Prop) [NumberField K] : + DenseRange <| algebraMap K ((v : Subtype p) → v.1.Completion) := by + apply DenseRange.comp (g := Subtype.restrict p) + (f := algebraMap K ((v : InfinitePlace K) → v.1.Completion)) + · exact Subtype.surjective_restrict (β := fun v => v.1.Completion) p |>.denseRange + · exact InfiniteAdeleRing.denseRange_algebraMap K + · exact continuous_pi (fun _ => continuous_apply _) + +attribute [local instance] WithAbs.algebraLeft + +@[simps!] +def _root_.WithAbs.semialgebraMap {R R' S : Type*} [CommSemiring R] [CommSemiring R'] [Semiring S] + [PartialOrder S] [Algebra R R'] (v : AbsoluteValue R S) (w : AbsoluteValue R' S) : + WithAbs v →ₛₐ[algebraMap R R'] WithAbs w where + __ := algebraMap (WithAbs v) (WithAbs w) + map_smul' r x := by + simp [WithAbs.algebraMap_left_apply, WithAbs.algebraMap_right_apply, Algebra.smul_def] + +set_option backward.isDefEq.respectTransparency false in /-- The map from `v.Completion` to `w.Completion` whenever the infinite place `w` of `L` lies above the infinite place `v` of `K`. -/ abbrev comapHom (h : w.comap (algebraMap K L) = v) : - v.Completion →ₛₐ[algebraMap (WithAbs v.1) (WithAbs w.1)] w.Completion := - semialgHomOfComp (comp_of_comap_eq h) + v.Completion →ₛₐ[algebraMap K L] w.Completion := + have h' : w.1.LiesOver v.1 := ⟨by simp [← h, InfinitePlace.comap]⟩ + .restrictScalars (WithAbs.semialgebraMap v.1 w.1) <| UniformSpace.Completion.mapSemialgHom _ + (LiesOver.isometry_algebraMap (v := v) w).uniformContinuous.continuous theorem comapHom_cont (h : w.comap (algebraMap K L) = v) : Continuous (comapHom h) := continuous_map variable (L v) +set_option backward.isDefEq.respectTransparency false in /-- The map from `v.Completion` to the product of all completions of `L` lying above `v`. -/ def piExtension : v.Completion →ₛₐ[algebraMap K L] (wv : v.Extension L) → wv.1.Completion := - Pi.semialgHom _ _ fun wv => comapHom wv.2 + Pi.semialgHom _ _ fun wv ↦ comapHom wv.2 @[simp] theorem piExtension_apply (x : v.Completion) : - piExtension L v x = fun wv : v.Extension L => comapHom wv.2 x := rfl + piExtension L v x = fun wv ↦ comapHom wv.2 x := rfl open scoped TensorProduct.RightActions @@ -66,6 +90,7 @@ abbrev baseChange : L ⊗[K] v.Completion →ₐ[L] (wv : v.Extension L) → wv.1.Completion := baseChange_of_algebraMap (piExtension L v) +set_option backward.isDefEq.respectTransparency false in /- The motivation for changing the scalars of `baseChange L v` to `v.Completion` is that both sides are _finite-dimensional_ `v.Completion`-modules, which have the same dimension. This fact is used to show that `baseChangeRight` (and therefore `baseChange`) is surjective. -/ @@ -75,6 +100,11 @@ abbrev baseChangeRight : L ⊗[K] v.Completion →ₐ[v.Completion] ((wv : v.Extension L) → wv.1.Completion) := baseChangeRightOfAlgebraMap (piExtension L v) +theorem mem_placesOver_iff_comap (v : InfinitePlace K) (w : InfinitePlace L) : + w ∈ placesOver L v ↔ w.comap (algebraMap K L) = v := by + simp only [placesOver, Set.mem_setOf_eq] + exact ⟨fun _ ↦ LiesOver.comap_eq _ _, fun h ↦ ⟨by simp [← h, InfinitePlace.comap]⟩⟩ + variable [NumberField L] variable {L v} @@ -90,8 +120,9 @@ theorem finrank_prod_eq_finrank [NumberField K] : Module.finrank v.Completion ((wv : Extension L v) → wv.1.Completion) = Module.finrank K L := by classical - rw [Module.finrank_pi_fintype v.Completion, ← Extension.sum_ramificationIdx_eq L v] - exact Finset.sum_congr rfl (fun w _ => finrank_eq_ramificationIdx w) + rw [Module.finrank_pi_fintype v.Completion, ← sum_inertiaDeg_eq_finrank K L v, + ← Finset.sum_congr rfl fun (w : v.Extension L) _ ↦ inertiaDeg_eq_finrank (K := K) (L := L) v w, + ← Finset.sum_subtype (placesOver L v).toFinset (by simpa using mem_placesOver_iff_comap L v)] theorem finrank_pi_eq_finrank_tensorProduct [NumberField K] : Module.finrank v.Completion ((w : v.Extension L) → w.1.Completion) = @@ -101,6 +132,7 @@ theorem finrank_pi_eq_finrank_tensorProduct [NumberField K] : Module.finrank_tensorProduct, Module.finrank_self, one_mul, finrank_prod_eq_finrank] +set_option backward.isDefEq.respectTransparency false in open scoped Classical in theorem baseChange_surjective : Function.Surjective (baseChange L v) := by -- Let `Bw` be a `K_v` basis of `Π v | w, L_w` @@ -120,6 +152,7 @@ theorem baseChange_surjective : Function.Surjective (baseChange L v) := by variable [NumberField K] +set_option backward.isDefEq.respectTransparency false in theorem baseChange_injective : Function.Injective (baseChange L v) := by rw [← baseChangeRightOfAlgebraMap_coe, ← AlgHom.coe_toLinearMap, @@ -131,6 +164,7 @@ instance : IsModuleTopology v.Completion wv.1.Completion := IsModuleTopology.iso (FiniteDimensional.nonempty_continuousLinearEquiv_of_finrank_eq (Module.finrank_fin_fun v.Completion)).some +set_option backward.isDefEq.respectTransparency false in /-- The `L`-algebra homeomorphism between `L ⊗[K] v.Completion` and the product of all completions of `L` lying above `v`. -/ def baseChangeEquiv : @@ -140,6 +174,7 @@ def baseChangeEquiv : inferInstanceAs (IsBiscalar L v.Completion (baseChange L v)) IsModuleTopology.continuousAlgEquivOfIsBiscalar K v.Completion e +set_option backward.isDefEq.respectTransparency false in instance : IsBiscalar L v.Completion (baseChangeEquiv L v).toAlgHom := inferInstanceAs (IsBiscalar L v.Completion (baseChange L v)) @@ -149,6 +184,7 @@ theorem baseChangeEquiv_tmul (l : L) (x : v.Completion) : simp [baseChangeEquiv, baseChange, SemialgHom.baseChange_of_algebraMap_tmul] rfl +set_option backward.isDefEq.respectTransparency false in /-- The `Kᵥ`-algebra homeomorphism between `L ⊗[K] v.Completion` and the product of all completions of `L` lying above `v`. -/ def baseChangeEquivRight : @@ -178,7 +214,7 @@ def piEquiv : theorem piEquiv_smul (x : v.Completion) (y : Fin (Module.finrank K L) → v.Completion) (wv : v.Extension L) : piEquiv L v (x • y) wv = comapHom wv.2 x * piEquiv L v y wv := by - simp_rw [(piEquiv L v).map_smul x y, Pi.smul_def, RingHom.smul_toAlgebra, - SemialgHom.toRingHom_eq_coe, RingHom.coe_coe] + simp_rw [(piEquiv L v).map_smul x y, Pi.smul_def, RingHom.smul_toAlgebra] + rfl end NumberField.InfinitePlace.Completion diff --git a/FLT/NumberField/InfiniteAdeleRing.lean b/FLT/NumberField/InfiniteAdeleRing.lean --- a/FLT/NumberField/InfiniteAdeleRing.lean +++ b/FLT/NumberField/InfiniteAdeleRing.lean @@ -11,12 +11,12 @@ import FLT.Mathlib.Topology.Algebra.Algebra.Hom If `v` is an infinite place of a number field `K`, we have established in `FLT.NumberField.Completion.Infinite` a continuous `L`-algebra homomorphism -`NumberField.InfinitePlace.Completion.baseChangeEquiv : L ⊗[K] K_v ≃A[L] ∏ w ∣ v, L_w` where -the product is over all infinite places `w` of `L` lying above `v`. +`NumberField.InfinitePlace.Completion.baseChangeEquiv : L ⊗[K] K_v ≃A[L] ∏ w ∣ v, L_w` where the +product is over all infinite places `w` of `L` lying above `v`. In this file we analogously establish the base change for the infinite adele ring -`NumberField.InfiniteAdeleRing.baseChangeEquiv : L ⊗[K] K_∞ ≃A[L] L_∞` where `K_∞` is -the infinite adele ring of `K` and `L_∞` that of `L`. There are two approaches: +`NumberField.InfiniteAdeleRing.baseChangeEquiv : L ⊗[K] K_∞ ≃A[L] L_∞` where `K_∞` is the +infinite adele ring of `K` and `L_∞` that of `L`. There are two approaches: (1) Piece together the local results on completions at infinite places to get a global result on infinite adele rings. @@ -72,6 +72,7 @@ namespace NumberField.InfiniteAdeleRing /-- `K∞` is notation for `InfiniteAdeleRing K`. -/ scoped notation:10000 K ""∞"" => InfiniteAdeleRing K +set_option backward.isDefEq.respectTransparency false in /-- The canonical map from the infinite adeles of K to the infinite adeles of L -/ noncomputable def baseChange : K∞ →SA[algebraMap K L] L∞ where @@ -90,20 +91,23 @@ noncomputable instance [Algebra K∞ L∞] : /-! Show that `L_∞` has the `K_∞`-module topology. -/ +open scoped NumberField.LiesOver + variable [NumberField K] [NumberField L] +attribute [local instance 9999] Algebra.toModule + /-- The $K_{\infty}$-linear homeomorphism $K_{\infty}^{[L:K]} \cong L_{\infty}$. -/ -noncomputable -def piEquiv [Algebra K∞ L∞] - [Pi.FiberwiseSMul (fun a => a.comap (algebraMap K L)) Completion Completion] : - (Fin (Module.finrank K L) → K∞) ≃L[K∞] L∞ := by - -- I think we could remove convert if we make `InfiniteAdeleRing` an `abbrev` - -- (K_∞)^d ≃[K_∞] ∏ v, K_v^d - convert (ContinuousLinearEquiv.piScalarPiComm _ _).symm.trans +noncomputable def piEquiv [Algebra K∞ L∞] + [Pi.FiberwiseSMul (fun a : InfinitePlace L => a.comap (algebraMap K L)) Completion Completion] : + (Fin (Module.finrank K L) → K∞) ≃L[K∞] L∞ := + have := (ContinuousLinearEquiv.piScalarPiComm Completion fun v _ ↦ v.Completion).symm.trans -- lift the equivalence K_v^d ≃[v.Completion] ∏ w ∣ v, L_w on fibers of comap (ContinuousLinearEquiv.piScalarPiCongrFiberwise - (fun v : InfinitePlace K => (Completion.piEquiv L v).symm)).symm + fun v : InfinitePlace K ↦ (Completion.piEquiv L v).symm).symm + this +set_option backward.isDefEq.respectTransparency false in instance instIsModuleTopology_fLT [Algebra K∞ L∞] [Pi.FiberwiseSMul (fun a => a.comap (algebraMap K L)) Completion Completion] : IsModuleTopology K∞ L∞ := .iso (piEquiv K L) @@ -122,21 +126,9 @@ noncomputable def baseChangeAlgEquiv : (AlgEquiv.piCongrFiberwise (fun v : InfinitePlace K => (Completion.baseChangeEquiv L v).toAlgEquiv.symm)).symm --- Then we show that this lift is the same as the lift of `baseChange : K_∞ → L_∞` coming from --- `SemialgHom.baseChange_of_algebraMap` - theorem baseChangeAlgEquiv_tmul (l : L) (x : K∞) : baseChangeAlgEquiv K L (l ⊗ₜ[K] x) = algebraMap _ _ l * baseChange K L x := rfl -theorem baseChangeAlgEquiv_coe_eq_baseChange_of_algebraMap [Algebra K L∞] [IsScalarTower K L L∞] : - ↑(baseChangeAlgEquiv K L) = (baseChange K L).baseChange_of_algebraMap := - Algebra.TensorProduct.ext' fun _ _ ↦ rfl - -theorem baseChangeAlgEquiv_apply (x : L ⊗[K] K∞) - [Algebra K L∞] [IsScalarTower K L L∞] : - baseChangeAlgEquiv K L x = SemialgHom.baseChange_of_algebraMap (baseChange K L) x := by - simpa using AlgHom.ext_iff.1 (baseChangeAlgEquiv_coe_eq_baseChange_of_algebraMap K L) x - open TensorProduct.AlgebraTensorModule in instance : Module.Free K∞ (L ⊗[K] K∞) := by -- L ⊗ K_∞ ≃ₗ[K_∞] K_∞ ⊗ L @@ -146,13 +138,13 @@ instance : Module.Free K∞ (L ⊗[K] K∞) := by -- Compose to transfer freeness of ∏ v, K_v ⊗ L to L ⊗ K_∞ exact Module.Free.of_equiv (e₁.trans e₂).symm +set_option backward.isDefEq.respectTransparency false in /-- Take two arbitrary `Algebra K L∞` and `Algebra K∞ L∞` instances. Assume that `Algebra K L∞` factors through (existing) `Algebra K L` and `Algebra L L∞`. Assume further that `Algebra K∞ L∞` is determined by the fibers of restriction of infinite places of `L` to `K` via (x • y) v = x (v.comap (algebraMap K L)) • y v. Then the `L` algebra base change -map is also linear in `K∞`. --/ -instance [Algebra K L∞] [IsScalarTower K L L∞] [Algebra K∞ L∞] +map is also linear in `K∞`. -/ +instance [Algebra K∞ L∞] [Pi.FiberwiseSMul (fun a => a.comap (algebraMap K L)) Completion Completion] : IsBiscalar L K∞ (baseChangeAlgEquiv K L).toAlgHom where map_smul₁ l x := (InfiniteAdeleRing.baseChangeAlgEquiv K L).toAlgHom.map_smul_of_tower l x @@ -161,15 +153,16 @@ instance [Algebra K L∞] [IsScalarTower K L L∞] [Algebra K∞ L∞] | zero => simp | tmul l r => funext w - simp [TensorProduct.smul_tmul', baseChangeAlgEquiv_apply, baseChange_of_algebraMap_tmul, + simp [TensorProduct.smul_tmul', baseChangeAlgEquiv_tmul, Pi.FiberwiseSMul.map_smul _ _ Completion (σ := w.toExtension K), RingHom.smul_toAlgebra, - Completion.comapHom, SemialgHom.toLinearMap_eq_coe, coe_toExtension] + Isometry.mapRingHom, WithAbs.semialgebraMap, UniformSpace.Completion.mapSemialgHom] ring | add x y _ _ => simp_all -- `IsModuleTopology.continuousAlgEquivOfIsScalarTower` is then applicable in the same -- way it was for `baseChangeEquiv` in `InfinitePlace.Completion` +set_option backward.isDefEq.respectTransparency false in /-- The canonical `L`-algebra homeomorphism from `L ⊗_K K_∞` to `L_∞` induced by the `K`-algebra base change map `K_∞ → L_∞`. -/ noncomputable diff --git a/FLT/NumberField/InfinitePlace/Dimension.lean b/FLT/NumberField/InfinitePlace/Dimension.lean --- a/FLT/NumberField/InfinitePlace/Dimension.lean +++ b/FLT/NumberField/InfinitePlace/Dimension.lean @@ -1,580 +1,163 @@ /- -Copyright (c) 2025 Salvatore Mercuri. All rights reserved. +Copyright (c) 2026 Salvatore Mercuri. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Salvatore Mercuri -/ -import Mathlib.NumberTheory.NumberField.InfinitePlace.Completion -import FLT.NumberField.InfinitePlace.Extension -import FLT.Mathlib.Analysis.Normed.Ring.WithAbs +module + +public import Mathlib.NumberTheory.RamificationInertia.Basic +public import Mathlib.NumberTheory.NumberField.Completion.InfinitePlace /-! -# Dimensions of completions at infinite places +# Ramification theory of completions of number fields -Let `L/K` and `w` be an infinite place of `L` lying above the infinite place `v` of `K`. -In this file, we prove: -- the sum of the ramification indices of all such places `w` is the same as `[L:K]`; -- the `v.Completion` dimension of `w.Completion` is equal to the ramification index. --/ +This file studies the ramification of completions of number fields. -noncomputable section +## Main definitions -namespace NumberField.InfinitePlace +- `NumberField.InfinitePlace.inertiaDeg` : the inertia degree of a place `w` of `L` over a + place `v` of `K`, defined as the local degree of the extension of completions at `w` and + `v` if `w` lies over `v` and zero otherwise. -open NumberField.ComplexEmbedding - -variable {K : Type*} {L : Type*} [Field K] [Field L] -variable [Algebra K L] {v : InfinitePlace K} {w : InfinitePlace L} - -theorem comap_embedding_eq_of_isReal (h : (w.comap (algebraMap K L)).IsReal) : - (w.comap (algebraMap K L)).embedding = w.embedding.comp (algebraMap K L) := by - rw [← mk_embedding w, comap_mk, mk_embedding, embedding_mk_eq_of_isReal - (by rwa [← isReal_mk_iff, ← comap_mk, mk_embedding])] - -theorem comap_mk_of_isExtension {ψ : L →+* ℂ} (hψ : IsExtension v.embedding ψ) : - (mk ψ).comap (algebraMap K L) = v := by - rw [comap_mk, hψ, mk_embedding] - -variable (w) - -namespace RamifiedExtension - -open Extension - -variable (w : v.RamifiedExtension L) - -theorem isExtension_embedding : IsExtension v.embedding w.1.embedding := by - rw [IsExtension, ← congrArg embedding w.comap_eq, - ← comap_embedding_eq_of_isReal w.isReal_comap] - -instance : IsLift L v w := ⟨w.isExtension_embedding⟩ - -theorem isExtension_conjugate_embedding : IsExtension v.embedding (conjugate w.1.embedding) := by - rw [IsExtension, ← ComplexEmbedding.isReal_iff.1 <| isReal_iff.1 w.isReal, - ← congrArg InfinitePlace.embedding w.comap_eq] - simp [comap_embedding_eq_of_isReal w.isReal_comap] - -instance : IsConjugateLift L v w := ⟨w.isExtension_conjugate_embedding⟩ - -theorem isMixedExtension : IsMixedExtension v.embedding w.1.embedding := - ⟨w.isExtension_embedding, isReal_iff.1 w.isReal, isComplex_iff.1 w.isComplex⟩ - -theorem isMixedExtension_conjugate : IsMixedExtension v.embedding (conjugate w.1.embedding) := - ⟨w.isExtension_conjugate_embedding, isReal_iff.1 w.isReal, - mt ComplexEmbedding.isReal_conjugate_iff.1 <| isComplex_iff.1 w.isComplex⟩ - -/-- A mixed extension `ψ : L →+* ℂ` determines a ramified infinite place `w` lying above `v`. -/ -def ofIsMixedExtension {ψ : L →+* ℂ} (h : IsMixedExtension v.embedding ψ) : - RamifiedExtension L v := by - refine ⟨mk ψ, comap_mk_of_isExtension h.1, ?_⟩ - rw [isRamified_iff, isComplex_iff, comap_mk, isReal_iff, h.1, embedding_mk_eq_of_isReal h.2.1] - refine ⟨?_, h.2.1⟩ - cases embedding_mk_eq ψ with - | inl hψ => - rw [hψ]; exact h.2.2 - | inr hψ => - rw [hψ, ComplexEmbedding.isReal_conjugate_iff] - exact h.2.2 - -/-- The conjugate of a mixed extension `ψ : L →+* ℂ` determines a ramified infinite place -`w` lying above `v`. -/ -def ofIsMixedExtension_conjugate {ψ : L →+* ℂ} (h : IsMixedExtension v.embedding ψ) : - RamifiedExtension L v := by - refine ⟨mk ψ, comap_mk_of_isExtension h.1, ?_⟩ - rw [isRamified_iff, isComplex_iff, comap_mk, isReal_iff, h.1, embedding_mk_eq_of_isReal h.2.1] - refine ⟨?_, h.2.1⟩ - cases embedding_mk_eq ψ with - | inl hψ => - rw [hψ]; exact h.2.2 - | inr hψ => - rw [hψ, ComplexEmbedding.isReal_conjugate_iff] - exact h.2.2 - -theorem ofIsMixedExtension_embedding {ψ : L →+* ℂ} (h : IsMixedExtension v.embedding ψ) : - (ofIsMixedExtension h).1.embedding = ψ ∨ conjugate (ofIsMixedExtension h).1.embedding = ψ := by - cases embedding_mk_eq ψ with - | inl hl => exact Or.inl hl - | inr hr => right; simp_rw [star_eq_iff_star_eq, ← hr]; rfl - -variable (L v) - -/-- If `w` is a ramified place above `v` then `w.embedding` and `conjugate w.embedding` -are distinct mixed extensions of `v.embedding`, giving a two-fold map from `RamifiedExtension` -to the type of all mixed extensions of `v.embedding`. -/ -def toIsMixedExtension (w : v.RamifiedExtension L ⊕ v.RamifiedExtension L) : - { ψ : L →+* ℂ // IsMixedExtension v.embedding ψ } := - let f : v.RamifiedExtension L → { ψ : L →+* ℂ // IsMixedExtension v.embedding ψ } := - Subtype.map (fun w => w.embedding) (fun w h => isMixedExtension ⟨w, h⟩) - let g : v.RamifiedExtension L → { ψ : L →+* ℂ // IsMixedExtension v.embedding ψ } := - Subtype.map (fun w => conjugate w.embedding) (fun w h => isMixedExtension_conjugate ⟨w, h⟩) - Sum.elim f g w - -theorem toIsMixedExtension_injective : (toIsMixedExtension L v).Injective := by - apply Subtype.map_injective _ (embedding_injective _) |>.sumElim - (Subtype.map_injective _ (conjugate_embedding_injective _)) - intro a b - rw [Subtype.map_ne] - exact b.prop.2.ne_conjugate - -theorem toIsMixedExtension_surjective : (toIsMixedExtension L v).Surjective := by - intro ⟨ψ, h⟩ - cases ofIsMixedExtension_embedding h with - | inl hl => - use Sum.inl (ofIsMixedExtension h) - simp [toIsMixedExtension, Subtype.map_def, hl] - | inr hr => - use Sum.inr (ofIsMixedExtension h) - simp [toIsMixedExtension, Subtype.map_def, hr] - -/-- The equivalence between two copies of ramified places `w` over `v` and the type of all -mixed extensions of `v.embedding`. -/ -def sumEquivIsMixedExtension : - v.RamifiedExtension L ⊕ v.RamifiedExtension L ≃ - { ψ : L →+* ℂ // IsMixedExtension v.embedding ψ } := - Equiv.ofBijective _ ⟨toIsMixedExtension_injective L v, toIsMixedExtension_surjective L v⟩ +## Main results -open scoped Classical in -theorem two_mul_card_eq [NumberField L] : - 2 * Fintype.card (v.RamifiedExtension L) = - Fintype.card { ψ : L →+* ℂ // IsMixedExtension v.embedding ψ } := by - simp [← Fintype.card_eq.2 ⟨sumEquivIsMixedExtension L v⟩] - ring - -end RamifiedExtension - -namespace IsUnramified - -variable {w} - -theorem not_isMixedExtension (h : w.IsUnramified K) (hw : w.comap (algebraMap K L) = v) : - ¬IsMixedExtension v.embedding w.embedding := by - contrapose! h - rw [not_isUnramified_iff, isComplex_iff, isReal_iff] - aesop - -theorem not_isMixedExtension_conjugate (h : w.IsUnramified K) (hw : w.comap (algebraMap K L) = v) : - ¬IsMixedExtension v.embedding (conjugate w.embedding) := by - contrapose! h - rw [not_isUnramified_iff, isComplex_iff, isReal_iff] - aesop - -end IsUnramified - -namespace UnramifiedExtension - -open Extension - -variable {w : v.UnramifiedExtension L} - -theorem isUnmixedExtension (h : IsExtension v.embedding w.1.embedding) : - IsUnmixedExtension v.embedding w.1.embedding := - ⟨h, w.isUnramified.not_isMixedExtension w.comap_eq⟩ - -instance : Coe (v.UnramifiedExtension L) (v.Extension L) where - coe w := ⟨w.1, w.comap_eq⟩ - -theorem isUnmixedExtension_conjugate (h : ¬IsExtension v.embedding w.1.embedding) : - IsUnmixedExtension v.embedding (conjugate w.1.embedding) := - ⟨isExtension_conjugate_of_not_isExtension (w : v.Extension L) h, - w.isUnramified.not_isMixedExtension_conjugate w.comap_eq⟩ - -theorem isReal_of_isReal (w : UnramifiedExtension L v) (hv : v.IsReal) : w.1.IsReal := - (InfinitePlace.isUnramified_iff.1 w.isUnramified).resolve_right - (by simpa [w.comap_eq] using not_isComplex_iff_isReal.2 hv) - -theorem isComplex_base {w : UnramifiedExtension L v} (hw : w.1.IsComplex) : - v.IsComplex := - not_isReal_iff_isComplex.1 <| mt w.isReal_of_isReal <| not_isReal_iff_isComplex.2 hw - -theorem not_isExtension_iff_isExtension_conj (w : UnramifiedExtension L v) - (hw : w.1.IsComplex) : - ¬IsExtension v.embedding (w.1.embedding) ↔ - IsExtension v.embedding (conjugate w.1.embedding) := by - refine ⟨isExtension_conjugate_of_not_isExtension (w : v.Extension L), ?_⟩ - intro hc h - have hv_isComplex : v.IsComplex := w.isComplex_base hw - rw [isComplex_iff, ComplexEmbedding.isReal_iff, RingHom.ext_iff, not_forall] at hv_isComplex - let ⟨x, hx⟩ := hv_isComplex - exact hx <| RingHom.congr_fun hc x ▸ ComplexEmbedding.conjugate_comp _ (algebraMap K L) ▸ - RingHom.congr_fun (congrArg conjugate h) x |>.symm - -/-- An unmixed extension `ψ : L →+* ℂ` determines an unramified infinite place `w` -lying above `v`. -/ -def ofIsUnmixedExtension {ψ : L →+* ℂ} - (h : IsUnmixedExtension v.embedding ψ) : - UnramifiedExtension L v := by - refine ⟨mk ψ, comap_mk_of_isExtension h.1, ?_⟩ - rw [isUnramified_iff, isReal_iff] - by_cases hv : ComplexEmbedding.IsReal v.embedding - · simpa [embedding_mk_eq_of_isReal <| h.isReal_of_isReal hv] using Or.inl (h.isReal_of_isReal hv) - · simpa [comap_mk, h.1, mk_embedding, isComplex_iff] using Or.inr hv - -@[simp] -theorem ofIsUnmixedExtension_embedding {ψ : L →+* ℂ} - (h : IsUnmixedExtension v.embedding ψ) : - (ofIsUnmixedExtension h).1.embedding = (mk ψ).embedding := - rfl - -theorem ofIsUnmixedExtension_embedding_isExtension {ψ : L →+* ℂ} - (h : IsUnmixedExtension v.embedding ψ) : - letI w := ofIsUnmixedExtension h - ((IsExtension v.embedding w.1.embedding ∧ w.1.embedding = ψ) ∨ - (¬IsExtension v.embedding w.1.embedding ∧ conjugate w.1.embedding = ψ)) := by - by_cases hv : ComplexEmbedding.IsReal v.embedding - · simpa [embedding_mk_eq_of_isReal <| h.isReal_of_isReal hv] using Or.inl h.1 - · cases embedding_mk_eq ψ with - | inl hl => simpa [hl] using Or.inl h.1 - | inr hr => - rw [not_isExtension_iff_isExtension_conj _ - (isComplex_mk_iff.2 <| ComplexEmbedding.not_isReal_of_not_isReal h.1 hv)] - simpa [ofIsUnmixedExtension_embedding, hr] using Or.inr h.1 +- `NumberField.InfinitePlace.sum_inertiaDeg_eq_finrank` : the degree of `L` over `K` is equal to +the sum of the inertia degrees of the places of `L` over `v`. -variable (L v) +## Tags -open scoped Classical in -/-- If `w` is an unramified place above `v` then there are the following two cases: -- `v` and `w` are both real; -- `v` and `w` are both complex. -In the first case `w.embedding` and `conjugate w.embedding` coincide. In the second case -only one of `w.embedding` and `conjugate w.embedding` can extend `v.embedding`. In both cases -then, there is a unique unmixed extension of `v.embedding` associated to the unramified -place `w` over `v`. -/ -def toIsUnmixedExtension (w : UnramifiedExtension L v) : - { ψ : L →+* ℂ // IsUnmixedExtension v.embedding ψ } := - let f := Subtype.map (fun w => w.1.embedding) (fun w h => w.isUnmixedExtension h) - let g := Subtype.map (fun w => conjugate w.1.embedding) - (fun w h => w.isUnmixedExtension_conjugate h) - if h : IsExtension v.embedding w.1.embedding then f ⟨w, h⟩ else g ⟨w, h⟩ - -variable {L v} in -theorem toIsUnmixedExtension_ofIsUnmixedExtension {ψ : L →+* ℂ} - (h : IsUnmixedExtension v.embedding ψ) : - toIsUnmixedExtension L v (ofIsUnmixedExtension h) = ⟨ψ, h⟩ := by - cases ofIsUnmixedExtension_embedding_isExtension h with - | inl hl => - simp_rw [toIsUnmixedExtension, dif_pos hl.1, Subtype.map_def, ofIsUnmixedExtension_embedding, - Subtype.mk.injEq] - rw [← hl.2, ofIsUnmixedExtension_embedding, mk_embedding] - | inr hr => - simp_rw [toIsUnmixedExtension, dif_neg hr.1, Subtype.map_def, ofIsUnmixedExtension_embedding, - Subtype.mk.injEq] - rw [← hr.2, ofIsUnmixedExtension_embedding, mk_conjugate_eq, mk_embedding] +number field, infinite places, ramification +-/ -open scoped Classical in -theorem toIsUnmixedExtension_injective : (toIsUnmixedExtension L v).Injective := by - classical - apply Function.Injective.dite _ - (Subtype.map_injective _ <| - Function.Injective.comp (embedding_injective _) Subtype.val_injective) - (Subtype.map_injective _ <| - Function.Injective.comp (conjugate_embedding_injective _) Subtype.val_injective) - (@fun _ _ hw₁ hw₂ => by - simpa [Subtype.map_def] using mt (eq_of_embedding_eq_conjugate L) - (embedding_injective L |>.ne_iff.1 (hw₁.ne hw₂))) - -theorem toIsUnmixedExtension_surjective : (toIsUnmixedExtension L v).Surjective := - fun ⟨_, h⟩ => ⟨ofIsUnmixedExtension h, toIsUnmixedExtension_ofIsUnmixedExtension h⟩ - -/-- The equivalence between the unramified places `w` over `v` and the type of all -unmixed extensions of `v.embedding`. -/ -def equivIsUnmixedExtension : - UnramifiedExtension L v ≃ { ψ : L →+* ℂ // IsUnmixedExtension v.embedding ψ } := - Equiv.ofBijective _ ⟨toIsUnmixedExtension_injective L v, toIsUnmixedExtension_surjective L v⟩ +-- TODO : remove after #30511 is merged -open scoped Classical in -theorem card_eq [NumberField L] : - Fintype.card (UnramifiedExtension L v) = - Fintype.card { ψ : L →+* ℂ // IsUnmixedExtension v.embedding ψ } := by - rw [← Fintype.card_eq.2 ⟨equivIsUnmixedExtension L v⟩] +@[expose] public section -instance (w : v.UnramifiedExtension L) [h : Fact v.IsReal] : - IsLift L v w where - isExtension' := by - rw [← congrArg embedding w.comap_eq, - comap_embedding_eq_of_isReal <| by apply w.comap_eq ▸ h.elim] +open NumberField.ComplexEmbedding Finset AbsoluteValue.Completion -end UnramifiedExtension +section infinite_place -variable (K) +namespace NumberField.InfinitePlace.Completion -open scoped Classical in -/-- If `w` is unramified over `K` then the ramification index is `1`, else `2`. -/ -abbrev ramificationIdx := if w.IsUnramified K then 1 else 2 +variable {K : Type*} [Field K] -variable {w} +@[simp] theorem ringEquivComplexOfIsComplex_apply {v : InfinitePlace K} (hv : IsComplex v) + (x : v.Completion) : ringEquivComplexOfIsComplex hv x = extensionEmbedding v x := rfl -theorem ramificationIdx_eq_one (h : w.IsUnramified K) : ramificationIdx K w = 1 := by - rw [ramificationIdx, if_pos h] +@[simp] theorem ringEquivRealOfIsReal_apply {v : InfinitePlace K} (hv : IsReal v) + (x : v.Completion) : ringEquivRealOfIsReal hv x = extensionEmbeddingOfIsReal hv x := rfl -theorem ramificationIdx_eq_two (h : w.IsRamified K) : ramificationIdx K w = 2 := by - rw [ramificationIdx, if_neg h] +end NumberField.InfinitePlace.Completion -namespace Extension +namespace NumberField.LiesOver -variable {K} +open UniformSpace.Completion InfinitePlace -instance : Algebra (WithAbs v.1) ℂ := v.embedding.toAlgebra +variable {K L : Type*} [Field K] [Field L] [Algebra K L] {v : InfinitePlace K} {w : InfinitePlace L} +variable [w.1.LiesOver v.1] -theorem isExtension_algHom (φ : L →ₐ[WithAbs v.1] ℂ) : IsExtension v.embedding φ.toRingHom := by - have := v.embedding.algebraMap_toAlgebra ▸ funext_iff.2 φ.commutes' - simp only [AlgHom.toRingHom_eq_coe, RingHom.toMonoidHom_eq_coe, OneHom.toFun_eq_coe, - MonoidHom.toOneHom_coe, MonoidHom.coe_coe, RingHom.coe_coe, AlgHom.commutes, - DFunLike.coe_fn_eq] at this - change φ.toRingHom.comp (algebraMap (WithAbs v.1) L) = v.embedding - rwa [AlgHom.toRingHom_eq_coe, AlgHom.comp_algebraMap_of_tower] +set_option backward.isDefEq.respectTransparency false in +/-- If `w` lies over `v`, then `w.Completion` is a `v.Completion`-algebra. -/ +noncomputable scoped instance : Algebra v.Completion w.Completion := + (LiesOver.isometry_algebraMap w).mapRingHom.toAlgebra -variable (L v) +set_option backward.isDefEq.respectTransparency false in +scoped instance : IsScalarTower K v.Completion w.Completion := + .of_algebraMap_eq fun x ↦ by + simp_rw [RingHom.algebraMap_toAlgebra, UniformSpace.Completion.algebraMap_def, + Isometry.mapRingHom_coe] + simp [WithAbs.algebraMap_left_apply, WithAbs.algebraMap_right_apply] -/-- For any infinite place `v` of `K`, the `K`-algebra maps from `L` to `ℂ` are equivalent to -the embeddings `L →+* ℂ` that extend `v.embedding`. -/ -def algHomEquivIsExtension : - (L →ₐ[WithAbs v.1] ℂ) ≃ { ψ : L →+* ℂ // IsExtension v.embedding ψ } := - Equiv.ofBijective (fun φ => ⟨φ.toRingHom, isExtension_algHom φ⟩) - ⟨fun _ _ h => AlgHom.coe_ringHom_injective (by simpa using h), - fun ⟨σ, h⟩ => ⟨⟨σ, fun _ => by simp [RingHom.algebraMap_toAlgebra, ← h]; rfl⟩, rfl⟩⟩ +set_option backward.isDefEq.respectTransparency false in +scoped instance : ContinuousSMul v.Completion w.Completion where + continuous_smul := (UniformSpace.Completion.continuous_map.comp continuous_fst).mul + (Continuous.comp continuous_id continuous_snd) -open scoped Classical in -theorem card_isUnramified_add_two_mul_card_isRamified [NumberField K] [NumberField L] : - Fintype.card (v.UnramifiedExtension L) + 2 * Fintype.card (v.RamifiedExtension L) = - Module.finrank K L := by - change _ = Module.finrank (WithAbs v.1) L - rw [← AlgHom.card (WithAbs v.1) L ℂ, Fintype.card_eq.2 ⟨algHomEquivIsExtension L v⟩, - Fintype.card_eq.2 ⟨isExtensionEquivSum v.embedding⟩, Fintype.card_sum, - RamifiedExtension.two_mul_card_eq, UnramifiedExtension.card_eq] - ring +end NumberField.LiesOver -open scoped Classical in -theorem sum_ramificationIdx_eq [NumberField K] [NumberField L] : - ∑ w : v.Extension L, w.1.ramificationIdx K = Module.finrank K L := by - let e : v.Extension L ≃ v.UnramifiedExtension L ⊕ v.RamifiedExtension L := - (Equiv.sumCompl _).symm.trans <| - (Equiv.subtypeSubtypeEquivSubtypeInter _ _).sumCongr - (Equiv.subtypeSubtypeEquivSubtypeInter _ (fun w => ¬IsUnramified K w)) - rw [Fintype.sum_equiv e _ ((fun w => w.1.ramificationIdx K) ∘ e.symm) - (fun _ => by simp only [Function.comp_apply, Equiv.symm_apply_apply])] - simp only [Function.comp_apply, Equiv.symm_trans_apply, Equiv.symm_symm, Equiv.sumCongr_symm, - Equiv.sumCongr_apply, Fintype.sum_sum_type, Sum.map_inl, Equiv.sumCompl_apply_inl, e, - Equiv.subtypeSubtypeEquivSubtypeInter_symm_apply_coe_coe, Sum.map_inr, Equiv.sumCompl_apply_inr] - rw [Finset.sum_congr rfl (fun x _ => ramificationIdx_eq_one K x.2.2), - Finset.sum_congr rfl (fun x _ => ramificationIdx_eq_two K x.2.2), - Finset.sum_const, Finset.sum_const, ← Fintype.card, ← Fintype.card, smul_eq_mul, mul_one, - smul_eq_mul, mul_comm, ← card_isUnramified_add_two_mul_card_isRamified L v] - -end Extension +namespace NumberField.InfinitePlace + +open scoped NumberField.LiesOver + +variable {K L : Type*} [Field K] [Field L] [Algebra K L] (v : InfinitePlace K) (w : InfinitePlace L) namespace Completion -open AbsoluteValue.Completion NumberField.ComplexEmbedding - -variable {K : Type*} [Field K] {v : InfinitePlace K} -variable {L : Type*} [Field L] [Algebra K L] - -open UniformSpace.Completion in -theorem coe_extensionEmbeddingOfIsReal [hv : Fact v.IsReal] (x : v.Completion) : - extensionEmbeddingOfIsReal hv.elim x = extensionEmbedding v x := by - induction x using induction_on - · exact isClosed_eq (Continuous.comp' (by fun_prop) continuous_extension) continuous_extension - · simp only [extensionEmbeddingOfIsReal_coe, embedding_of_isReal_apply, extensionEmbedding_coe] - -instance algebraReal [hv : Fact v.IsReal] : Algebra v.Completion ℝ := - (extensionEmbeddingOfIsReal hv.elim).toAlgebra - -/-- There are two choices for embedding `v.Completion` into `ℂ`, and therefore two choices -for giving `ℂ` a `v.Completion` algebra. The canonical algebra is the one that aligns -with the choice made for `extensionEmbedding`. -/ -instance : Algebra v.Completion ℂ := (extensionEmbedding v).toAlgebra - -variable (v) in -/-- There are two choices for embedding `v.Completion` into `ℂ`, and therefore two choices -for giving `ℂ` a `v.Completion` algebra. `algebraComplexStar` is the alternative algebra -defined by the conjugate of `extensionEmbedding`. -/ -def algebraComplexStar : Algebra v.Completion ℂ := - conjugate (extensionEmbedding v) |>.toAlgebra - -variable (v) in -/-- If `v` is a real infinite place, then `v.Completion` is isomorphic to `ℝ` as `v.Completion` -algebras. -/ -def algEquivRealOfReal [Fact v.IsReal] : - v.Completion ≃ₐ[v.Completion] ℝ := - AlgEquiv.ofRingEquiv (f := ringEquivRealOfIsReal _) (fun _ => rfl) - -variable (v) in -/-- If `v` is a complex infinite place, then `v.Completion` is isomorphic to `ℂ` as `v.Completion` -algebras, using the canonical `v.Completion` algebra for `ℂ`. -/ -def algEquivComplexOfComplex [hv : Fact v.IsComplex] : - v.Completion ≃ₐ[v.Completion] ℂ := - AlgEquiv.ofRingEquiv (f := ringEquivComplexOfIsComplex hv.elim) (fun _ => rfl) - -variable (v) in -/-- If `v` is a complex infinite place, then `v.Completion` is isomorphic to `ℂ` as `v.Completion` -algebras, using the conjugate `v.Completion` algebra for `ℂ`. -/ -def algEquivComplexOfComplexStar [hv : Fact v.IsComplex] : - letI := algebraComplexStar v - v.Completion ≃ₐ[v.Completion] ℂ := - letI := algebraComplexStar v - AlgEquiv.ofRingEquiv (f := (ringEquivComplexOfIsComplex hv.elim).trans starRingAut) - (fun _ => rfl) - -instance {L : Type*} [Field L] [Algebra K L] (w : v.Extension L) : - Algebra v.Completion w.1.Completion := - semialgHomOfComp (comp_of_comap_eq w.2) |>.toAlgebra - -namespace RamifiedExtension - -variable (w : v.RamifiedExtension L) - -instance : Algebra v.Completion w.1.Completion := - inferInstanceAs (Algebra v.Completion (w : v.Extension L).1.Completion) - -open UniformSpace.Completion in -theorem extensionEmbedding_algebraMap (x : v.Completion) : - extensionEmbedding w.1 (algebraMap v.Completion w.1.Completion x) = - extensionEmbedding v x := by - induction x using induction_on - · exact isClosed_eq (Continuous.comp continuous_extension continuous_map) continuous_extension - · simp only [RingHom.algebraMap_toAlgebra, SemialgHom.toRingHom_eq_coe, - RingHom.coe_coe, extensionEmbedding_coe, semialgHomOfComp_coe _, - ← congrArg InfinitePlace.embedding w.comap_eq, - comap_embedding_eq_of_isReal w.isReal_comap] - rfl - -instance : IsScalarTower v.Completion w.1.Completion ℂ := - .of_algebraMap_smul fun r x => by - rw [Algebra.smul_def, Algebra.smul_def, RingHom.algebraMap_toAlgebra, - extensionEmbedding_algebraMap, RingHom.algebraMap_toAlgebra] - -instance [Fact v.IsReal] : IsScalarTower v.Completion ℝ ℂ := - .of_algebraMap_smul fun r x => by - simp [Algebra.smul_def, RingHom.algebraMap_toAlgebra, coe_extensionEmbeddingOfIsReal] - -instance (w : v.RamifiedExtension L) : Fact w.1.IsComplex := ⟨w.isComplex⟩ - -/-- If `w` is a ramified extension of `v`, then `w.Completion` is isomorphic to `ℂ` as -`v.Completion` algebras. -/ -def algEquivComplex : w.1.Completion ≃ₐ[v.Completion] ℂ := - algEquivComplexOfComplex w.1 |>.restrictScalars v.Completion - -/-- If `w` is a ramified extension of `v`, then the `v.Completion`-dimension of `w.Completion` -is `2`. -/ -theorem finrank_eq_two [Fact v.IsReal] : Module.finrank v.Completion w.1.Completion = 2 := by - rw [algEquivComplex w |>.toLinearEquiv.finrank_eq, ← Module.finrank_mul_finrank v.Completion ℝ ℂ, - ← algEquivRealOfReal v |>.toLinearEquiv.finrank_eq, Module.finrank_self, - Complex.finrank_real_complex, one_mul] - -end RamifiedExtension - -namespace UnramifiedExtension - -open NumberField.ComplexEmbedding Extension - -variable {L : Type*} [Field L] [Algebra K L] (w : v.UnramifiedExtension L) - -instance : Algebra v.Completion w.1.Completion := - inferInstanceAs (Algebra v.Completion (w : v.Extension L).1.Completion) - -open UniformSpace.Completion in -theorem extensionEmbedding_algebraMap [IsLift L v w] (x : v.Completion) : - extensionEmbedding w.1 (algebraMap v.Completion w.1.Completion x) = - extensionEmbedding v x := by - induction x using induction_on - · exact isClosed_eq (Continuous.comp continuous_extension continuous_map) continuous_extension - · simp only [RingHom.algebraMap_toAlgebra, SemialgHom.toRingHom_eq_coe, - RingHom.coe_coe, extensionEmbedding_coe, semialgHomOfComp_coe _, ← IsLift.isExtension L v w] - rfl - -open UniformSpace.Completion in -theorem extensionEmbeddingOfIsReal_algebraMap - [hv : Fact v.IsReal] [hw : Fact w.1.IsReal] (x : v.Completion) : - extensionEmbeddingOfIsReal hw.elim (algebraMap v.Completion w.1.Completion x) = - extensionEmbeddingOfIsReal hv.elim x := by - apply_fun Complex.ofReal using Complex.ofReal_injective - simp only [coe_extensionEmbeddingOfIsReal, extensionEmbedding_algebraMap] - -instance [Fact v.IsReal] [Fact w.1.IsReal] : IsScalarTower v.Completion w.1.Completion ℝ := - .of_algebraMap_smul fun r x => by - rw [Algebra.smul_def, Algebra.smul_def, RingHom.algebraMap_toAlgebra, - extensionEmbeddingOfIsReal_algebraMap, RingHom.algebraMap_toAlgebra] - -/-- If `w` is an unramified extension of `v`, and both infinite places are real, then -`w.Completion` is isomorphic to `ℝ` as `v.Completion` algebras. -/ -def algEquivReal [Fact v.IsReal] [Fact w.1.IsReal] : w.1.Completion ≃ₐ[v.Completion] ℝ := - algEquivRealOfReal w.1 |>.restrictScalars v.Completion - -instance [IsLift L v w] : IsScalarTower v.Completion w.1.Completion ℂ := - .of_algebraMap_smul fun r x => by - rw [Algebra.smul_def, Algebra.smul_def, RingHom.algebraMap_toAlgebra, - extensionEmbedding_algebraMap, RingHom.algebraMap_toAlgebra] - -open UniformSpace.Completion in -theorem extensionEmbedding_algebraMap_star [IsConjugateLift L v w] (x : v.Completion) : - conjugate (extensionEmbedding w.1) (algebraMap v.Completion w.1.Completion x) = - (extensionEmbedding v) x := by - induction x using induction_on - · exact isClosed_eq (Continuous.comp (by - change Continuous (starRingEnd ℂ ∘ extensionEmbedding w.1); - exact Continuous.comp Complex.continuous_conj continuous_extension) continuous_map) - continuous_extension - · simp only [RingHom.algebraMap_toAlgebra, SemialgHom.toRingHom_eq_coe, - RingHom.coe_coe, extensionEmbedding_coe, semialgHomOfComp_coe _, conjugate_coe_eq, - ← IsConjugateLift.isExtension L v w] - rfl - -/-- If `w` is an unramified extension of `v` such that both infinite places are complex -and `w.embedding` extends `v.embedding` then `w.Completion` is isomorphic to `ℂ` as -`v.Completion` algebras. This uses the canonical `w.Completion` algebra for `ℂ`. -/ -def algEquivComplex [Fact w.1.IsComplex] [IsLift L v w] : - w.1.Completion ≃ₐ[v.Completion] ℂ := - algEquivComplexOfComplex w.1 |>.restrictScalars v.Completion - -@[nolint unusedArguments] -instance [IsConjugateLift L v w] : Algebra w.1.Completion ℂ := - algebraComplexStar w.1 - -instance [IsConjugateLift L v w] : IsScalarTower v.Completion w.1.Completion ℂ := - .of_algebraMap_smul fun r x => by - rw [Algebra.smul_def, Algebra.smul_def, RingHom.algebraMap_toAlgebra, - extensionEmbedding_algebraMap_star, RingHom.algebraMap_toAlgebra] - -/-- If `w` is an unramified extension of `v` such that both infinite places are complex -and `conjugate w.embedding` extends `v.embedding` then `w.Completion` is isomorphic to `ℂ` as -`v.Completion` algebras. This uses the conjugate `w.Completion` algebra for `ℂ`. -/ -def algEquivComplexStar [Fact w.1.IsComplex] [IsConjugateLift L v w] : - w.1.Completion ≃ₐ[v.Completion] ℂ := - algEquivComplexOfComplexStar w.1 |>.restrictScalars v.Completion - -instance [hv : Fact v.IsReal] : Fact w.1.IsReal := ⟨w.isReal_of_isReal hv.elim⟩ - -instance [hv : Fact v.IsComplex] : Fact w.1.IsComplex := - ⟨Extension.isComplex_of_isComplex (w : v.Extension L) hv.elim⟩ - -/-- If `w` is an unramified extension of `v` and both infinite places are complex then -the `v.Completion`-dimension of `w.Completion` is `1`. -/ -theorem finrank_eq_one : Module.finrank v.Completion w.1.Completion = 1 := by +set_option backward.isDefEq.respectTransparency false in +/-- If `w` is a ramified place over `v` then `w.Completion` has `v.Completion` dimension two. -/ +theorem finrank_eq_two_of_isRamified (w : InfinitePlace L) [w.1.LiesOver v.1] + (h : w.IsRamified K) : Module.finrank v.Completion w.Completion = 2 := by + have := LiesOver.extensionEmbedding_liesOver_of_isReal w <| h.liesOver_isReal_under w v + rw [Algebra.finrank_eq_of_equiv_equiv (ringEquivRealOfIsReal <| h.liesOver_isReal_under w v) + (ringEquivComplexOfIsComplex h.isComplex) (by + ext; erw [this.over_apply]; simp [ringEquivRealOfIsReal]), + Complex.finrank_real_complex] + +set_option backward.isDefEq.respectTransparency false in +/-- If `w` is an unramified place over `v` then `w.Completion` has `v.Completion` dimension one. -/ +theorem finrank_eq_one_of_isUnramified [w.1.LiesOver v.1] (h : w.IsUnramified K) : + Module.finrank v.Completion w.Completion = 1 := by by_cases hv : v.IsReal - · have : Fact v.IsReal := ⟨hv⟩ - rw [algEquivReal w |>.toLinearEquiv.finrank_eq, - ← algEquivRealOfReal v |>.toLinearEquiv.finrank_eq, Module.finrank_self] - · have : Fact v.IsComplex := ⟨not_isReal_iff_isComplex.1 hv⟩ - cases isLift_or_isConjugateLift L v w with + · have := LiesOver.extensionEmbedding_liesOver_of_isReal w hv + rw [Algebra.finrank_eq_of_equiv_equiv (ringEquivRealOfIsReal hv) (ringEquivRealOfIsReal + (h.liesOver_isReal_over _ _ hv)) (RingHom.ext fun _ ↦ Complex.ofReal_inj.1 <| by + simp [this.over_apply]), Module.finrank_self] + · have hv : v.IsComplex := not_isReal_iff_isComplex.1 hv + cases LiesOver.embedding_comp_eq_or_conjugate_embedding_comp_eq w v with | inl hl => - rw [algEquivComplex w |>.toLinearEquiv.finrank_eq, - ← algEquivComplexOfComplex v |>.toLinearEquiv.finrank_eq, Module.finrank_self] + have : ComplexEmbedding.LiesOver w.embedding v.embedding := ⟨hl⟩ + have := liesOver_extensionEmbedding w (v := v) + rw [Algebra.finrank_eq_of_equiv_equiv (ringEquivComplexOfIsComplex hv) + (ringEquivComplexOfIsComplex (LiesOver.isComplex_of_isComplex_under _ hv)) + (by ext; simp [this.over_apply]), Module.finrank_self] | inr hr => - rw [algEquivComplexStar w |>.toLinearEquiv.finrank_eq, - ← algEquivComplexOfComplex v |>.toLinearEquiv.finrank_eq, Module.finrank_self] - -end UnramifiedExtension + have : ComplexEmbedding.LiesOver (conjugate w.embedding) v.embedding := ⟨hr⟩ + have := liesOver_conjugate_extensionEmbedding w (v := v) + rw [Algebra.finrank_eq_of_equiv_equiv (ringEquivComplexOfIsComplex hv) + ((ringEquivComplexOfIsComplex (LiesOver.isComplex_of_isComplex_under _ hv)).trans + (starRingAut (R := ℂ))) (by ext; simp [← conjugate_coe_eq, this.over_apply]), + Module.finrank_self] -variable (w : v.Extension L) +end Completion -theorem finrank_eq_ramificationIdx : - Module.finrank v.Completion w.1.Completion = ramificationIdx K w.1 := by - by_cases h : w.1.IsRamified K - · let w := w.toRamifiedExtension h - have : Fact v.IsReal := ⟨w.isReal⟩ - change Module.finrank v.Completion w.1.Completion = ramificationIdx K w.1 - simp [ramificationIdx, w.isRamified, RamifiedExtension.finrank_eq_two] - · let w := w.toUnramifiedExtension (by simpa using h) - change Module.finrank v.Completion w.1.Completion = ramificationIdx K w.1 - simp [ramificationIdx, w.isUnramified, UnramifiedExtension.finrank_eq_one] +open Completion -end NumberField.InfinitePlace.Completion +open scoped Classical in +/-- The inertia degree of `w` over `v`. -/ +protected noncomputable def inertiaDeg : ℕ := + if _ : w.1.LiesOver v.1 then (⊥ : Ideal v.Completion).inertiaDeg (⊥ : Ideal w.Completion) else 0 + +theorem inertiaDeg_of_liesOver [w.1.LiesOver v.1] : + v.inertiaDeg w = (⊥ : Ideal v.Completion).inertiaDeg (⊥ : Ideal w.Completion) := by + simp only [InfinitePlace.inertiaDeg, dif_pos] + +theorem inertiaDeg_eq_finrank [w.1.LiesOver v.1] : + v.inertiaDeg w = Module.finrank v.Completion w.Completion := by + simp only [inertiaDeg_of_liesOver, Ideal.inertiaDeg, Ideal.comap_bot_of_injective _ <| + FaithfulSMul.algebraMap_injective v.Completion w.Completion] + exact Algebra.finrank_eq_of_equiv_equiv (RingEquiv.quotientBot v.Completion) + (RingEquiv.quotientBot w.Completion) (by ext; simp [RingHom.algebraMap_toAlgebra]) + +variable {v w} in +theorem inertiaDeg_eq_one (hw : w ∈ unramifiedPlacesOver L v) : v.inertiaDeg w = 1 := + have := hw.1; finrank_eq_one_of_isUnramified v w hw.2 ▸ inertiaDeg_eq_finrank v w + +variable {v w} in +theorem inertiaDeg_eq_two (hw : w ∈ ramifiedPlacesOver L v) : v.inertiaDeg w = 2 := + have := hw.1; finrank_eq_two_of_isRamified v w hw.2 ▸ inertiaDeg_eq_finrank v w + +variable (K L) in +open scoped Classical in +open Finset Set in +/-- The degree of `L` over `K` is equal to the sum of the inertia degrees of the places over `v`. -/ +theorem sum_inertiaDeg_eq_finrank [NumberField K] [NumberField L] : + ∑ w ∈ v.placesOver L, v.inertiaDeg w = Module.finrank K L := by + rw [← union_ramifiedPlacesOver_unramifiedPlacesOver L v, toFinset_union, + sum_union (Set.disjoint_toFinset.2 <| disjoint_ramifiedPlacesOver_unramifiedPlacesOver L v), + sum_congr rfl (fun _ h ↦ inertiaDeg_eq_two (by simpa using h)), + sum_congr rfl (fun _ h ↦ inertiaDeg_eq_one (by simpa using h)), sum_const, add_comm] + simp [← unramifedPlacesOver_ncard_add_eq_finrank L v, mul_comm, ncard_eq_toFinset_card'] + +end NumberField.InfinitePlace + +end infinite_place diff --git a/FLT/NumberField/InfinitePlace/WeakApproximation.lean b/FLT/NumberField/InfinitePlace/WeakApproximation.lean --- a/FLT/NumberField/InfinitePlace/WeakApproximation.lean +++ /dev/null @@ -1,312 +0,0 @@ -/- -Copyright (c) 2024 Salvatore Mercuri. All rights reserved. -Released under Apache 2.0 license as described in the file LICENSE. -Authors: Salvatore Mercuri --/ -import FLT.Mathlib.Analysis.Normed.Ring.WithAbs -import FLT.Mathlib.Data.Fin.Basic -import FLT.Mathlib.Topology.Algebra.Order.Field -import Mathlib.Analysis.SpecialFunctions.Log.Base -import Mathlib.NumberTheory.NumberField.InfiniteAdeleRing - -/-! -# Weak approximation - -This file contains weak approximation theorems for number fields and their completions -at infinite places. The main weak approximation theorem here states that for `(xᵥ)ᵥ` indexed by -finitely many infinite places, with each `xᵥ ∈ Kᵥ` there exists a global `y ∈ K` such that -`y` is arbitrarily close to each `xᵥ` (with respect to the topology on `Kᵥ` defined by `v`). -This can be equivalently stated by asserting that the appropriate `algebraMap` has dense range. - -## Main results -- `NumberField.InfinitePlace.denseRange_algebraMap_pi` : weak approximation for `(xᵥ)ᵥ` when - `v` ranges over all infinite places and each `xᵥ ∈ K` is rational. -- `NumberField.InfiniteAdeleRing.denseRange_algebraMap` : weak approximation for `(xᵥ)ᵥ` when - `v` ranges over all infinite places and each `xᵥ ∈ Kᵥ` (i.e., `(xᵥ)ᵥ` is an infinite adele). -- `NumberField.InfinitePlace.Completion.denseRange_algebraMap_subtype_pi` : weak approximation - for `(xᵥ)ᵥ` when `v` ranges over a subcollection of all infinite places and each - `xᵥ ∈ Kᵥ` (useful for example when thinking only about infinite places `w` of `L` that extend - some infinite place `v` of `K`). --/ - -open scoped Topology - -open NumberField - -noncomputable section - -namespace AbsoluteValue - -variable {K : Type*} [Field K] {v : AbsoluteValue K ℝ} - -open Filter in -/-- -Let `a, b ∈ K`, and let `v₁, ..., vₖ` be absolute values with some `1 < vᵢ a` while all other -`vⱼ a < 1`. Suppose `1 < vᵢ b`. Let `w` be another absolute value on `K` such that `w a = 1`, -while `w b < 1`. Then we can find a sequence of values in `K` that tends to `∞` under `vᵢ`, -tends to `0` under `vⱼ`, and is always `< 1` under `w`. - -Such a sequence is given by `a ^ n * b`. --/ -theorem exists_tendsto_zero_tendsto_atTop_tendsto_const - {ι : Type*} {v : ι → AbsoluteValue K ℝ} {w : AbsoluteValue K ℝ} {a b : K} {i : ι} - (ha : 1 < v i a) (haj : ∀ j ≠ i, v j a < 1) (haw : w a = 1) (hb : 1 < v i b) (hbw : w b < 1) : - ∃ c : ℕ → K, - Tendsto (fun n => (v i) (c n)) atTop atTop ∧ - (∀ j ≠ i, Tendsto (fun n => (v j) (c n)) atTop (𝓝 0)) ∧ - (∀ n, w (c n) < 1) := by - refine ⟨fun n => a ^ n * b, ?_⟩; simp_rw [map_mul, map_pow, haw, one_pow, one_mul] - refine ⟨Tendsto.atTop_mul_const (by linarith) (tendsto_pow_atTop_atTop_of_one_lt ha), - fun j hj => ?_, fun _ => hbw⟩ - rw [← zero_mul <| v j b] - exact Tendsto.mul_const _ <| tendsto_pow_atTop_nhds_zero_of_lt_one ((v j).nonneg _) (haj j hj) - -open scoped Classical in -/-- -Let `a, b ∈ K`, and let `v₁, ..., vₖ` be absolute values with some `1 < vᵢ a` while all other -`vⱼ a < 1`. Suppose `1 < vᵢ b`. Let `w` be another absolute value on `K` such that `w a = 1`, -while `w b < 1`. Then there is an element `k ∈ K` such that `1 < vᵢ k` while `vⱼ k < 1` for all -`j ≠ i` and `w k < 1`. - -This is given by taking large enough values of a witness sequence to -`exists_tendsto_zero_tendsto_atTop_tendsto_const` (for example `a ^ n * b` works). --/ -theorem exists_one_lt_lt_one_lt_one_of_eq_one - {ι : Type*} [Finite ι] {v : ι → AbsoluteValue K ℝ} {w : AbsoluteValue K ℝ} {a b : K} {i : ι} - (ha : 1 < v i a) (haj : ∀ j ≠ i, v j a < 1) (haw : w a = 1) (hb : 1 < v i b) (hbw : w b < 1) : - ∃ k : K, 1 < v i k ∧ (∀ j ≠ i, v j k < 1) ∧ w k < 1 := by - classical - let := Fintype.ofFinite ι - let ⟨c, hc⟩ := exists_tendsto_zero_tendsto_atTop_tendsto_const ha haj haw hb hbw - simp_rw [Metric.tendsto_nhds, Filter.tendsto_atTop_atTop, Filter.eventually_atTop, - dist_zero_right, ← WithAbs.norm_eq_abs, norm_norm] at hc - choose r₁ hr₁ using hc.1 2 - choose rₙ hrₙ using fun j hj => hc.2.1 j hj 1 (by linarith) - let r := Finset.univ.sup fun j => if h : j = i then r₁ else rₙ j h - refine ⟨c r, lt_of_lt_of_le (by linarith) (hr₁ r ?_), fun j hj => ?_, hc.2.2 r⟩ - · exact Finset.le_sup_dite_pos (p := fun j => j = i) (f := fun _ _ => r₁) (Finset.mem_univ _) rfl - · convert hrₙ j hj _ <| Finset.le_sup_dite_neg (fun j => j = i) (Finset.mem_univ j) _ - -open Filter in -/-- -Let `a, b ∈ K`, and let `v₁, ..., vₖ` be absolute values with some `1 < vᵢ a` while all other -`vⱼ a < 1`. Let `w` be another absolute value on `K` such that `1 < w a`. Then there is a -sequence of elements in `K` that tendsto `vᵢ b` under `vᵢ`, tends to `0` under `vⱼ` for `j ≠ i`, -and tends to `w b` under `w`. - -Such a sequence is given by `1 / (1 + a ^ (- n))`. --/ -theorem exists_tendsto_const_tendsto_zero_tendsto_const - {ι : Type*} {v : ι → AbsoluteValue K ℝ} {w : AbsoluteValue K ℝ} {a : K} {i : ι} - (b : K) (ha : 1 < v i a) (haj : ∀ j ≠ i, v j a < 1) (haw : 1 < w a) : - ∃ c : ℕ → K, - Tendsto (fun n => (v i) (c n)) atTop (𝓝 ((v i) b)) ∧ - (∀ j ≠ i, Tendsto (fun n => v j (c n)) atTop (𝓝 0)) ∧ - Tendsto (fun n => w (c n)) atTop (𝓝 (w b)) := by - refine ⟨fun n => (1 / (1 + a⁻¹ ^ n) * b), ?_⟩; simp_rw [map_mul] - nth_rw 2 [← one_mul (v i b), ← one_mul (w b)] - let hai := map_inv₀ (v i) _ ▸ inv_lt_one_of_one_lt₀ ha - replace haw := (map_inv₀ w _ ▸ inv_lt_one_of_one_lt₀ haw) - refine ⟨Tendsto.mul_const _ (tendsto_div_one_add_pow_nhds_one hai), fun j hj => ?_, - Tendsto.mul_const _ (tendsto_div_one_add_pow_nhds_one haw)⟩ - replace haj := map_inv₀ (v j) _ ▸ (one_lt_inv₀ (pos_of_pos (v j) (by linarith))).2 (haj j hj) - exact zero_mul (v j b) ▸ Tendsto.mul_const _ (tendsto_div_one_add_pow_nhds_zero haj) - -open scoped Classical in -/-- -Let `a, b ∈ K`, and let `v₁, ..., vₖ` be absolute values with some `1 < vᵢ a` while all other -`vⱼ a < 1`. Suppose `1 < vᵢ b`. Let `w` be another absolute value on `K` such that `1 < w a`, -while `w b < 1`. Then there is an element `k ∈ K` such that `1 < vᵢ k` while `vⱼ k < 1` for all -`j ≠ i` and `w k < 1`. - -This is given by taking large enough values of a witness sequence to -`exists_tendsto_const_tendsto_zero_tendsto_const` (for example `1 / (1 + a ^ (-n))` works). - -Note that this is the result `exists_one_lt_lt_one_lt_one_of_eq_one` replacing the condition -that `w a = 1` with `1 < w a`. --/ -theorem exists_one_lt_lt_one_lt_one_of_one_lt - {ι : Type*} [Finite ι] {v : ι → AbsoluteValue K ℝ} {w : AbsoluteValue K ℝ} {a b : K} {i : ι} - (ha : 1 < v i a) (haj : ∀ j ≠ i, v j a < 1) (haw : 1 < w a) (hb : 1 < v i b) (hbw : w b < 1) : - ∃ k : K, 1 < v i k ∧ (∀ j ≠ i, v j k < 1) ∧ w k < 1 := by - classical - let := Fintype.ofFinite ι - let ⟨c, hc⟩ := exists_tendsto_const_tendsto_zero_tendsto_const b ha haj haw - have hₙ := fun j hj => Metric.tendsto_nhds.1 <| hc.2.1 j hj - simp_rw [Filter.eventually_atTop, dist_zero_right] at hₙ - choose r₁ hr₁ using Filter.eventually_atTop.1 <| Filter.Tendsto.eventually_const_lt hb hc.1 - choose rₙ hrₙ using fun j hj => hₙ j hj 1 (by linarith) - choose rN hrN using Filter.eventually_atTop.1 <| Filter.Tendsto.eventually_lt_const hbw hc.2.2 - let r := max (Finset.univ.sup fun j => if h : j = i then r₁ else rₙ j h) rN - refine ⟨c r, hr₁ r ?_, fun j hj => ?_, ?_⟩ - · exact le_max_iff.2 <| Or.inl <| - Finset.le_sup_dite_pos (p := fun j => j = i) (f := fun _ _ => r₁) (Finset.mem_univ _) rfl - · simp only [← WithAbs.norm_eq_abs, norm_norm] at hrₙ - exact hrₙ j hj _ <| le_max_iff.2 <| Or.inl <| - Finset.le_sup_dite_neg (fun j => j = i) (Finset.mem_univ j) _ - · exact hrN _ <| le_max_iff.2 (Or.inr le_rfl) - -/-- -Let `v₁, ..., vₖ` be a collection of at least two non-trivial and pairwise inequivalent -absolute values. Then there is `a ∈ K` such that `1 < v₁ a` while `vⱼ a < 1` for -all other `j ≠ 0`. --/ -theorem exists_one_lt_lt_one {n : ℕ} {v : Fin (n + 2) → AbsoluteValue K ℝ} - (h : ∀ i, (v i).IsNontrivial) - (hv : Pairwise fun i j => ¬∃ (t : ℝ) (_ : 0 < t), ∀ x, v i x = (v j x) ^ t) : - ∃ (a : K), 1 < v 0 a ∧ ∀ j ≠ 0, v j a < 1 := by - induction n using Nat.case_strong_induction_on with - | hz => - let ⟨a, ha⟩ := (v 0).exists_one_lt_lt_one_of_ne_rpow (h 0) (h 1) (hv zero_ne_one) - exact ⟨a, ha.1, by simp [Fin.forall_fin_two, ha.2]⟩ - | hi n ih => - -- Assume the result is true for all smaller collections of absolute values - -- Let `a : K` be the value from the collection with the last absolute value removed - let ⟨a, ha⟩ := ih n le_rfl (fun _ => h _) (hv.comp_of_injective <| Fin.castSucc_injective _) - -- Let `b : K` be the value using then first and last absolute value - let ⟨b, hb⟩ := ih 0 (by linarith) (fun _ => h _) <| Fin.pairwise_forall_two hv - simp only [Nat.succ_eq_add_one, Nat.reduceAdd, Fin.isValue, Matrix.cons_val_zero, ne_eq, - Fin.forall_fin_two, not_true_eq_false, IsEmpty.forall_iff, one_ne_zero, not_false_eq_true, - Matrix.cons_val_one, forall_const, true_and] at hb - -- If `v last < 1` then `a` works. - by_cases ha₀ : v (Fin.last _) a < 1 - · refine ⟨a, ha.1, fun j hj => ?_⟩ - by_cases hj' : j = Fin.last (n + 2) - · exact hj' ▸ ha₀ - · exact ha.2 (Fin.castPred _ (ne_eq _ _ ▸ hj')) <| Fin.castPred_ne_zero _ hj - -- If `v last = 1` then this is given by `exists_one_lt_lt_one_lt_one_of_eq_one` with - -- `w = v last`. - · by_cases ha₁ : v (Fin.last _) a = 1 - · let ⟨k, hk⟩ := exists_one_lt_lt_one_lt_one_of_eq_one - (v := fun i : Fin (n + 2) => v i.castSucc) ha.1 ha.2 ha₁ hb.1 hb.2 - refine ⟨k, hk.1, fun j hj => ?_⟩ - by_cases h : j ≠ Fin.last (n + 2) - · exact ne_eq _ _ ▸ hk.2.1 (j.castPred h) <| Fin.castPred_ne_zero _ hj - · exact not_ne_iff.1 h ▸ hk.2.2 - -- The last cast `1 < v last` is given by `exists_one_lt_lt_one_lt_one_of_one_lt` with - -- `w = v last`. - · let ⟨k, hk⟩ := exists_one_lt_lt_one_lt_one_of_one_lt - (v := fun i : Fin (n + 2) => v i.castSucc) ha.1 ha.2 - (lt_of_le_of_ne (not_lt.1 ha₀) (ne_eq _ _ ▸ ha₁).symm) hb.1 hb.2 - refine ⟨k, hk.1, fun j hj => ?_⟩ - by_cases h : j ≠ Fin.last _ - · apply ne_eq _ _ ▸ hk.2.1 (j.castPred h) - rwa [← Fin.castPred_zero, Fin.castPred_inj] - · exact not_ne_iff.1 h ▸ hk.2.2 - -end AbsoluteValue - -/-! -## Weak approximation results --/ - -namespace NumberField.InfinitePlace - -open AbsoluteValue - -variable {K : Type*} [Field K] {v : InfinitePlace K} (w : InfinitePlace K) - -theorem pos_of_pos {x : K} (hv : 0 < v x) : 0 < w x := by - rw [coe_apply] at hv ⊢ - exact v.1.pos_of_pos _ hv - -variable {w} - -/-- -If `v` and `w` are infinite places of `K` and `v = w ^ t` for some `t > 0` then `t = 1`. --/ -theorem rpow_eq_one_of_eq_rpow {t : ℝ} (h : ∀ x, v x = (w x) ^ t) : t = 1 := by - let ⟨ψv, hψv⟩ := v.2 - let ⟨ψw, hψw⟩ := w.2 - simp only [coe_apply, ← hψv, ← hψw] at h - have := congrArg (Real.logb 2) (h 2) - simp only [place_apply, map_ofNat, RCLike.norm_ofNat, Nat.one_lt_ofNat, Real.logb_self_eq_one, - Nat.ofNat_pos, ne_eq, OfNat.ofNat_ne_one, not_false_eq_true, Real.logb_rpow] at this - exact this.symm - -/-- -If `v` and `w` are infinite places of `K` and `v = w ^ t`, then `v = w`. --/ -theorem eq_of_eq_rpow (h : ∃ (t : ℝ) (_ : 0 < t), ∀ x, v x = (w x) ^ t) : v = w := by - let ⟨t, _, h⟩ := h - simp only [rpow_eq_one_of_eq_rpow h, Real.rpow_one] at h - exact Subtype.ext <| AbsoluteValue.ext h - -open Filter in -/-- -Let `v` be an infinite place and `c ∈ K` such that `1 < v c`. Suppose that `w c < 1` for any -other infinite place `w ≠ v`. Then we can find a sequence in `K` that tends to `1` with respect -to `v` and tends to `0` with respect to all other `w ≠ v`. - -Such a sequence is given by `1 / (1 + c ^ (-n))`. --/ -theorem exists_tendsto_one_tendsto_zero {v : InfinitePlace K} {c : K} (hv : 1 < v c) - (h : ∀ w : InfinitePlace K, w ≠ v → w c < 1) : - ∃ a : ℕ → K, - Tendsto (β := WithAbs v.1) a atTop (𝓝 1) ∧ (∀ w, w ≠ v → - Tendsto (β := WithAbs w.1) a atTop (𝓝 0)) := by - refine ⟨fun n => 1 / (1 + c⁻¹ ^ n), ?_, ?_⟩ - · have hx₁ := map_inv₀ v _ ▸ inv_lt_one_of_one_lt₀ hv - nth_rw 3 [show (1 : WithAbs v.1) = 1 / 1 by norm_num] - apply Filter.Tendsto.div tendsto_const_nhds _ one_ne_zero - nth_rw 2 [← add_zero (1 : WithAbs v.1)] - apply Filter.Tendsto.const_add - rw [tendsto_zero_iff_norm_tendsto_zero] - simp_rw [norm_pow] - apply tendsto_pow_atTop_nhds_zero_of_lt_one (AbsoluteValue.nonneg _ _) hx₁ - · intro w hwv - simp_rw [div_eq_mul_inv, one_mul] - rw [tendsto_zero_iff_norm_tendsto_zero] - simp_rw [norm_inv] - apply Filter.Tendsto.inv_tendsto_atTop - have (a : WithAbs w.1) (n : ℕ) : ‖a ^ n‖ - 1 ≤ ‖1 + a ^ n‖ := by - simp_rw [add_comm, ← norm_one (α := WithAbs w.1), tsub_le_iff_right] - exact norm_le_add_norm_add _ _ - apply Filter.tendsto_atTop_mono (this _) - apply Filter.tendsto_atTop_add_right_of_le _ (-1) _ (fun _ => le_rfl) - simp only [inv_pow, norm_inv, norm_pow] - refine tendsto_atTop_of_geom_le (c := w c⁻¹) ?_ ?_ (fun n => ?_) - · simp only [pow_zero, inv_one, zero_lt_one] - · exact map_inv₀ w _ ▸ (one_lt_inv₀ (pos_of_pos w (by linarith))).2 (h w hwv) - · rw [map_inv₀, ← inv_pow, ← inv_pow, pow_add, pow_one, mul_comm] - exact le_rfl - -/-- -Suppose that there are at least two infinite places of `K`. Let `v` be one of them. -Then we can find an `x ∈ K` such that `1 < v x`, while `w x < 1` for all other `w ≠ v`. - -This element is obtained by applying the analogous result for collections of non-equivalent -and non-trivial absolute values `AbsoluteValue.exists_one_lt_lt_one`. --/ -theorem exists_one_lt_lt_one [NumberField K] (h : 1 < Fintype.card (InfinitePlace K)) : - ∃ (x : K), 1 < v x ∧ ∀ w ≠ v, w x < 1 := by - let ⟨n, ⟨e⟩⟩ := Finite.exists_equiv_fin (InfinitePlace K) - have : 1 < n := by linarith [Fintype.card_fin n ▸ Fintype.card_eq.2 ⟨e⟩] - obtain ⟨k, rfl⟩ := Nat.exists_eq_add_of_le' this - let ⟨m, hm⟩ := e.symm.surjective v - let e₀ := e.trans (Equiv.swap 0 m) - let ⟨x, hx⟩ := AbsoluteValue.exists_one_lt_lt_one (fun i => (e₀.symm i).isNontrivial) - (fun i j hj => mt eq_of_eq_rpow <| e₀.symm.injective.ne hj) - refine ⟨x, hm ▸ hx.1, fun w hw => ?_⟩ - have he₀ : e₀ v = 0 := by simp [e₀, e.symm_apply_eq.1 hm] - exact e₀.symm_apply_apply _ ▸ hx.2 (e₀ w) <| he₀ ▸ e₀.injective.ne hw - -end InfinitePlace - -namespace InfinitePlace.Completion - -variable (K : Type*) [Field K] {v w : InfinitePlace K} - -/-- -*Weak approximation for subcollections*: this is the result that `K` is dense in any subcollection -`Π v ∈ S, Kᵥ` of completions at infinite places. --/ -theorem denseRange_algebraMap_subtype_pi (p : InfinitePlace K → Prop) [NumberField K] : - DenseRange <| algebraMap K ((v : Subtype p) → v.1.Completion) := by - apply DenseRange.comp (g := Subtype.restrict p) - (f := algebraMap K ((v : InfinitePlace K) → v.1.Completion)) - · exact Subtype.surjective_restrict (β := fun v => v.1.Completion) p |>.denseRange - · exact InfiniteAdeleRing.denseRange_algebraMap K - · exact continuous_pi (fun _ => continuous_apply _) - -end NumberField.InfinitePlace.Completion",210,972,1182,4.5,diff_derived,False,450,7,9,0,2,pr_merge,False,leanprover/lean4:v4.29.0,leanbench/lean4-env:4.29.0,lake build,600,lean_compiler,algebra,2026-04-28T12:39:48Z,extraction_pipeline_v2 LB-0008,pr_completion,easy,2.4,leanprover-community/mathlib4,37059,review: #36709,https://github.com/leanprover-community/mathlib4/pull/37059,"ready-to-merge,t-meta",9450d934e6c23ce226e8ddfa16ebd28f9cab1df4,23a8036a7a7f35719b883ebf20f5fa25c4b2a65e,"Mathlib/Tactic/DefEqAbuse.lean,MathlibTest/DefEqAbuse.lean",Mathlib/Tactic/DefEqAbuse.lean,"# Task: review: #36709 ## Context This review suggests - various improvements to the code structure + readability; pruning of unnecessary code - using `withCurrHeartbeats` instead of setting max heartbeats to 0 (and nothing at all in the `elabCommand` case, which should effectively start heartbeats afresh anyway) - not re-throwing `.internal` errors (does not touch unmodified sections of code that do the same) - hovers on names in the logged message + message newline fixes - another test, this time at the command level - `Name.lt` instead of `.quickLt` for human-readable sorting ## Files affected - Mathlib/Tactic/DefEqAbuse.lean (+55/-62) - MathlibTest/DefEqAbuse.lean (+22/-4) ## Definitions to add - `minimizeCandidates` in `Mathlib/Tactic/DefEqAbuse.lean`: Given a function `succeeds : Array Name → m Bool` and an initial array of `candidates` such - `somewhere.` in `Mathlib/Tactic/DefEqAbuse.lean` ```lean instance somewhere. \n\n\ ``` ## Verification The patched repository must compile with `lake build`.","diff --git a/Mathlib/Tactic/DefEqAbuse.lean b/Mathlib/Tactic/DefEqAbuse.lean --- a/Mathlib/Tactic/DefEqAbuse.lean +++ b/Mathlib/Tactic/DefEqAbuse.lean @@ -362,48 +362,40 @@ def reportDefEqAbuse {m : Type → Type} [Monad m] [MonadLog m] [AddMessageConte `backward.isDefEq.respectTransparency true` but succeeds with `false`.\n\ The following isDefEq checks are the root causes of the failure:\n{failureList}"" -/-- Collect candidate semireducible definition names by transitively following definition values +/-- Collect candidate semireducible definition names by transitively following declaration values reachable from `roots`, up to a bounded depth. -/ def collectCandidates (env : Environment) (roots : Array Name) : Array Name := Id.run do - let mut visited : Std.HashSet Name := {} + let mut visited : NameSet := {} let mut queue := roots - for _ in List.range 6 do -- depth limit + let mut candidates : Array Name := #[] + for _ in (0 : Nat)...6 do -- depth limit if queue.isEmpty then break let current := queue queue := #[] for name in current do if visited.contains name then continue visited := visited.insert name if let some info := env.find? name then - if let some val := info.value? then - for c in val.getUsedConstants do + if wasOriginallyDefn env name && getReducibilityStatusCore env name == .semireducible then + candidates := candidates.push name + -- Only `defs`, `theorem`s and `opaque`s can have values, and we only care about the first. + if let .defnInfo { value .. } := info then + for c in value.getUsedConstants do if !visited.contains c then queue := queue.push c - let mut candidates : Array Name := #[] - for name in visited.toArray do - if getReducibilityStatusCore env name == .semireducible then - if let some (.defnInfo _) := env.find? name then - candidates := candidates.push name return candidates -/-- Apply `@[implicit_reducible]` marks to the given constants. -/ -private def markImplicitReducible {m : Type → Type} [Monad m] [MonadEnv m] - (names : Array Name) : m Unit := do - for name in names do setReducibilityStatus name .implicitReducible - /-- Temporarily mark constants as `@[implicit_reducible]`, run an action, then restore all state. -Both the environment (which carries the reducibility marks) and the full tactic state (metavar -context, goals) are saved before the marks are applied and restored via `finally`, so this -helper is self-contained: callers do not need additional save/restore wrappers. -/ +The full tactic state (which includes the environment carrying recuibility marks) are saved before +the marks are applied and restored via `finally`, so this helper is self-contained: callers do not +need additional save/restore wrappers. -/ def withTempImplicitReducible {α : Type} (names : Array Name) (k : TacticM α) : TacticM α := do let s ← saveState - let savedEnv ← getEnv try - markImplicitReducible names + for name in names do setReducibilityStatus name .implicitReducible k finally - setEnv savedEnv s.restore (restoreInfo := true) /-- Temporarily mark constants as `@[implicit_reducible]`, run an action, then restore all state. @@ -414,11 +406,27 @@ def withTempImplicitReducibleCmd {α : Type} (names : Array Name) (k : CommandElabM α) : CommandElabM α := do let saved ← get try - markImplicitReducible names + for name in names do setReducibilityStatus name .implicitReducible k finally set saved +/-- Given a function `succeeds : Array Name → m Bool` and an initial array of `candidates` such +that `succeeds candidates` is `true` (returning `none` if this is not the case), tries removing +elements from `candidates` in order such that the resulting array still `succeeds`. Sorts the +result. + +This minimization may not be unique. It also is only minimal under the assumption that removing a +later element from the array cannot cause an earlier element to become removable. -/ +def minimizeCandidates {m} [Monad m] (succeeds : Array Name → m Bool) (candidates : Array Name) : + m (Option (Array Name)) := do + unless ← succeeds candidates do return none + let mut minimal := candidates + for name in minimal do + let without := minimal.filter (· != name) + if ← succeeds without then minimal := without + return minimal.qsort Name.lt + /-- Try to find a (possibly non-unique) minimal set of semireducible constants that, when marked `@[implicit_reducible]`, make the tactic succeed with `backward.isDefEq.respectTransparency true`. @@ -429,20 +437,15 @@ def suggestAnnotationsTac (tac : Syntax) : TacticM (Option (Array Name)) := do let goalType ← getMainTarget let candidates := collectCandidates (← getEnv) goalType.getUsedConstants if candidates.isEmpty then return none - let tryWith (names : Array Name) : TacticM Bool := - withTempImplicitReducible names do - withTheReader Core.Context (fun c => { c with maxHeartbeats := 0 }) do - withOptions (fun o => o.setBool `backward.isDefEq.respectTransparency true) do - try evalTactic tac; pure true - catch | .internal id ref => throw (.internal id ref) | _ => pure false - -- Verify that marking ALL candidates fixes the issue. - unless ← tryWith candidates do return none - -- Minimize by greedy removal. - let mut minimal := candidates - for name in candidates do - let without := minimal.filter (· != name) - if ← tryWith without then minimal := without - return some (minimal.qsort Name.quickLt) + let succeedsWith (names : Array Name) : TacticM Bool := + withTempImplicitReducible names do withCurrHeartbeats do + withOptions (·.setBool `backward.isDefEq.respectTransparency true) do + try + Core.resetMessageLog + Term.withoutErrToSorry <| evalTactic tac + notM MonadLog.hasErrors + catch _ => pure false + minimizeCandidates succeedsWith candidates /-- Try to find a (possibly non-unique) minimal set of semireducible constants that, when marked `@[implicit_reducible]`, make the command succeed with `backward.isDefEq.respectTransparency true`. @@ -456,44 +459,34 @@ def suggestAnnotationsCmd (cmd : Syntax) : CommandElabM (Option (Array Name)) := let saved ← get let roots ← try withScope (fun scope => - { scope with opts := (scope.opts.setBool `Elab.async false) + { scope with opts := scope.opts.setBool `Elab.async false |>.setBool `backward.isDefEq.respectTransparency false }) do elabCommand cmd let newEnv ← getEnv - let mut names : Array Name := #[] + let mut names : NameSet := {} -- Collect constants from any new declarations added by this command - for (name, _) in newEnv.constants.map₂.toList do - if env.constants.map₂.find? name |>.isNone then - if let some info := newEnv.find? name then - names := names ++ info.type.getUsedConstants - if let some val := info.value? then - names := names ++ val.getUsedConstants + for (name, info) in newEnv.constants.map₂ do + if !env.constants.map₂.contains name then + names := names ∪ info.getUsedConstantsAsSet return names - catch _ => pure #[] + catch _ => pure {} set saved - let candidates := collectCandidates (← getEnv) roots + let candidates := collectCandidates (← getEnv) roots.toArray if candidates.isEmpty then return none - let tryWith (names : Array Name) : CommandElabM Bool := + let succeedsWith (names : Array Name) : CommandElabM Bool := withTempImplicitReducibleCmd names do withScope (fun scope => - { scope with opts := ((scope.opts.setBool `Elab.async false) - |>.setBool `backward.isDefEq.respectTransparency true) - |>.insert `maxHeartbeats (.ofNat 0) }) do + { scope with opts := scope.opts.setBool `Elab.async false + |>.setBool `backward.isDefEq.respectTransparency true }) do try elabCommand cmd - let hasErrors := (← get).messages.hasErrors - return !hasErrors - catch | .internal id ref => throw (.internal id ref) | _ => return false - unless ← tryWith candidates do return none - let mut minimal := candidates - for name in candidates do - let without := minimal.filter (· != name) - if ← tryWith without then minimal := without - return some (minimal.qsort Name.quickLt) + notM MonadLog.hasErrors + catch _ => return false + minimizeCandidates succeedsWith candidates /-- Format the annotation workaround as a Lean code snippet. -/ def formatAnnotations (names : Array Name) : MessageData := - let namesList := joinSep (names.toList.map fun n => m!"" {n}"") ""\n"" + let namesList := joinSep (names.toList.map (m!"" {.ofConstName · (fullNames := true)}"")) ""\n"" m!""set_option allowUnsafeReducibility true\nattribute [implicit_reducible]\n{namesList}"" /-- Log annotation suggestions as info. -/ @@ -502,8 +495,8 @@ def logAnnotationSuggestions {m : Type → Type} [Monad m] [MonadLog m] [AddMess let some names := names | return if names.isEmpty then return logInfo m!""Workaround: the following `@[implicit_reducible]` annotations (a possibly \ - non-unique minimal set) would paper over this problem,\n\ - but the real issue is likely a leaky instance somewhere.\n\ + non-unique minimal set) would paper over this problem, but the real issue is likely a leaky \ + instance somewhere.\n\n\ {formatAnnotations names}"" /-- diff --git a/MathlibTest/DefEqAbuse.lean b/MathlibTest/DefEqAbuse.lean --- a/MathlibTest/DefEqAbuse.lean +++ b/MathlibTest/DefEqAbuse.lean @@ -68,8 +68,8 @@ warning: #defeq_abuse: tactic fails with `backward.isDefEq.respectTransparency t The following isDefEq checks are the root causes of the failure: ❌️ (i : ℕ) → (fun a => Prop) i =?= MyPred ℕ --- -info: Workaround: the following `@[implicit_reducible]` annotations (a possibly non-unique minimal set) would paper over this problem, -but the real issue is likely a leaky instance somewhere. +info: Workaround: the following `@[implicit_reducible]` annotations (a possibly non-unique minimal set) would paper over this problem, but the real issue is likely a leaky instance somewhere. + set_option allowUnsafeReducibility true attribute [implicit_reducible] MyPred @@ -79,6 +79,24 @@ noncomputable example (s : MyPred ℕ) (a : ℕ) (ha : a ∉ s) : Disjoint s {a} #defeq_abuse in rw [myPred_disjoint_singleton_right] exact ha +/-- +warning: #defeq_abuse: command fails with `backward.isDefEq.respectTransparency true` but succeeds with `false`. +The following isDefEq checks are the root causes of the failure: + ❌️ MyPred ℕ =?= (i : ℕ) → (fun a => Prop) i + ❌️ (i : ℕ) → (fun a => Prop) i =?= MyPred ℕ +--- +info: Workaround: the following `@[implicit_reducible]` annotations (a possibly non-unique minimal set) would paper over this problem, but the real issue is likely a leaky instance somewhere. + +set_option allowUnsafeReducibility true +attribute [implicit_reducible] + MyPred +-/ +#guard_msgs in +#defeq_abuse in +noncomputable def fooDependingOnMyPred (s : MyPred ℕ) (a : ℕ) (ha : a ∉ s) : Disjoint s {a} := by + rw [myPred_disjoint_singleton_right] + exact ha + end SetAliasAbuse section VirtualParentAbuse @@ -196,8 +214,8 @@ warning: #defeq_abuse: tactic fails with `backward.isDefEq.respectTransparency t The following isDefEq checks are the root causes of the failure: ❌️ @ZoC.zo Int instZoCInt =?= @ZoC.zo Int (@GrC.toZoC Int ?m.11) --- -info: Workaround: the following `@[implicit_reducible]` annotations (a possibly non-unique minimal set) would paper over this problem, -but the real issue is likely a leaky instance somewhere. +info: Workaround: the following `@[implicit_reducible]` annotations (a possibly non-unique minimal set) would paper over this problem, but the real issue is likely a leaky instance somewhere. + set_option allowUnsafeReducibility true attribute [implicit_reducible] zoDirectC",77,66,143,8.0,diff_derived,False,557,2,0,0,2,pr_merge,False,leanprover/lean4:v4.29.0,leanbench/lean4-env:4.29.0,lake build,600,lean_compiler,general,2026-04-28T12:39:49Z,extraction_pipeline_v2 LB-0009,pr_completion,easy,1.7,leanprover-community/mathlib4,36880,review: MessageData.ForExprs,https://github.com/leanprover-community/mathlib4/pull/36880,t-meta,35d565bba7a120c88be1e421e84ff70e8778dc3c,94acb1345e3767c673cd2cf656f86e25d5f4e6ec,Mathlib/Lean/MessageData/ForExprs.lean,Mathlib/Lean/MessageData/ForExprs.lean,"# Task: review: MessageData.ForExprs ## Context This review of #36796 suggests implementing `for (ppCtx, e) in msgs.exprs do` notation by letting the caller handle `ppCtx` themselves, via an approach patterned after `Syntax.topDown`. This also means we can avoid running `MetaM` when we're simply getting the expressions. It also fixes issues in handling `FormatWithInfos` where `DelabTermInfo` (which extends `TermInfo`) was not handled and where the local context from the info node was ignored, and where `isExporting` was not updated. See comment for explanation. Also fixes some style issues, cleans up the logic `goFmt` (worth looking over to ensure it still makes sense!), and namespaces under `Lean.MessageData`. (Note: `goFmt` appears to be private by default.) ## Files affected - Mathlib/Lean/MessageData/ForExprs.lean (+71/-37) ## Definitions to add - `exprs` in `Mathlib/Lean/MessageData/ForExprs.lean`: `for (ppCtx, e) in msg.exprs do` iterates through the expressions in `MessageData` together ## Verification The patched repository must compile with `lake build`.","diff --git a/Mathlib/Lean/MessageData/ForExprs.lean b/Mathlib/Lean/MessageData/ForExprs.lean --- a/Mathlib/Lean/MessageData/ForExprs.lean +++ b/Mathlib/Lean/MessageData/ForExprs.lean @@ -13,25 +13,30 @@ public import Lean.Meta.Basic /-! # Tools for extracting `Expr`s from `MessageData` nodes -The main definition in this file is `Lean.MessageData.forExprs`, -which locates `Expr` objects nested within a message. +This file provides `for (ppCtx, e) in msg.exprs do` notation, which iterates through the +expressions `e` in a `msg : MessageData`. The surrounding monad must support `BaseIO` to handle +`.ofLazy` `MessageData` nodes. `e` may be interpreted in a `MetaM` context using `ppCtx.runMetaM e`. Some helpers are provided implemented in terms of this. -/ public section -/-- Iterate over all the expressions in a `MessageData`. +namespace Lean.MessageData -`σ` is a state, allowing this to emulate `ForIn`. +universe u -`f` is run with `PPContext.runMetaM` with the appropriate context. -/ -partial def Lean.MessageData.forExprs {σ} (msg : MessageData) (s : σ) - (f : σ → Expr → MetaM (ForInStep σ)) : IO σ := do +variable {m : Type → Type u} [Monad m] [MonadLiftT BaseIO m] + +/-- Iterate over all the expressions in a `MessageData`. Used to implement +`for (ppCtx, e) in msg.exprs do` notation, which should be preferred over using this declaration +directly. -/ +partial def forExprsIn {σ} (msg : MessageData) (s : σ) + (f : PPContext × Expr → σ → m (ForInStep σ)) : m σ := do return (← go ⟨.anonymous, []⟩ none s msg).value where go (nctx : NamingContext) (ctx? : Option MessageDataContext) (s : σ) : - MessageData → IO (ForInStep σ) + MessageData → m (ForInStep σ) | .withContext ctx m => go nctx (some ctx) s m | .withNamingContext nctx m => go nctx ctx? s m | .compose a b => do @@ -41,8 +46,7 @@ where | .ofLazy f _ => do let ppCtx? := ctx?.map (mkPPContext nctx) let dyn ← f ppCtx? - let some innerMsg := dyn.get? MessageData | - return .yield s + let some innerMsg := dyn.get? MessageData | return .yield s go nctx ctx? s innerMsg | .nest _ m | .group m | .tagged _ m => go nctx ctx? s m | .ofWidget _ alt => go nctx ctx? s alt @@ -57,43 +61,73 @@ where return .yield s' | .ofGoal m => do if let some ppCtx := ctx?.map (mkPPContext nctx) then - ppCtx.runMetaM (f s (.mvar m)) + -- See below; `.goal`s also go through `ctx.runMetaM` when being displayed. + f ({ ppCtx with env := ppCtx.env.setExporting false }, .mvar m) s else return .yield s | .ofFormatWithInfos fwi => do let some ppCtx := ctx?.map (mkPPContext nctx) | return .yield s - goFmt fwi.infos s (fun s' i _ => do - let some (.ofTermInfo i) := fwi.infos.get? i | return (.yield s', false) - let ri ← ppCtx.runMetaM (f s' i.expr) - return (ri, true) - ) fwi.fmt - /-- Iterate over the tags of a `Format` using `f`. If `f` returns `true` as its second piece, - do not recurse further into the tag. -/ - goFmt {σ} (infos) (s : σ) (f : σ → Nat → Format → IO (ForInStep σ × Bool)) : - Format → IO (ForInStep σ) + goFmt ppCtx fwi.infos s fwi.fmt + /-- Iterate over the tags of a `Format` using `f`. -/ + goFmt (ppCtx : PPContext) (infos) (s : σ) : Format → m (ForInStep σ) | .tag n fmt => do - let (rn, b) ← f s n fmt - if b then return rn - let .yield s := rn | return rn - goFmt infos s f fmt - | .group fmt _ => goFmt infos s f fmt - | .nest _ fmt => goFmt infos s f fmt + match infos.get? n with + | some (.ofTermInfo { expr, lctx .. }) + | some (.ofDelabTermInfo { expr, lctx .. }) => do + /- When displaying interactive expressions, lean creates a `ctx : Elab.ContextInfo` from + the surrounding `ppCtx`, abandoning the `ppCtx`'s `lctx` and using whatever `lctx` is + provided by the info. But we want to expose a uniform interface, so we try to create a + `ppCtx` such that `ppCtx.runMetaM` behaves the same as `ctx.runMetaM info.lctx`. This means + passing in the `lctx` from the info node and setting exporting to `false` (see + `ContextInfo.runCoreM`). We regard the other differences (e.g. `ngen`, `diag`) as + too minor to change. + + See `Lean.Widget.Interactive` and `msgToInteractiveAux` to see how lean handles + `FormatWithInfos` in the language server. -/ + let ppCtx := { ppCtx with lctx, env := ppCtx.env.setExporting false } + f (ppCtx, expr) s + | _ => goFmt ppCtx infos s fmt + | .group fmt _ => goFmt ppCtx infos s fmt + | .nest _ fmt => goFmt ppCtx infos s fmt | .append fmt1 fmt2 => do - let r1 ← goFmt infos s f fmt1 + let r1 ← goFmt ppCtx infos s fmt1 let .yield s := r1 | return r1 - goFmt infos s f fmt2 + goFmt ppCtx infos s fmt2 | .text _ | .align _ | .line | .nil => return .yield s +/-- A wrapper structure for `MessageData` to enable `for (ppCtx, e) in msg.exprs do` notation. -/ +protected structure Exprs where + /-- The `MessageData` whose expressions will be iterated over. -/ + msg : MessageData + +/-- `for (ppCtx, e) in msg.exprs do` iterates through the expressions in `MessageData` together +with their `ppCtx : PPContext`. The `ppCtx` can be used to interpret the expression in a valid +`MetaM` context via `ppCtx.runMetaM`. + +The monad must support `BaseIO` in order to interpret `.ofLazy` nodes in `MessageData`. + +Expressions without a valid `ppCtx` are skipped. -/ +def exprs (msg : MessageData) : MessageData.Exprs := ⟨msg⟩ + +instance : ForIn m MessageData.Exprs (PPContext × Expr) where + forIn exprs := exprs.msg.forExprsIn + /-- Find the expression in a message on which `f` does not return `none`. -/ -partial def Lean.MessageData.firstExpr? {α} (msg : MessageData) (f : Expr → MetaM (Option α)) : - IO (Option α) := - msg.forExprs none fun s e => do - if let .some a ← f e then - return .done (some a) - return .yield s +partial def firstExpr? {α} (msg : MessageData) (f : Expr → MetaM (Option α)) : + IO (Option α) := do + for (ppCtx, e) in msg.exprs do + let a@(some _) ← ppCtx.runMetaM (f e) | continue + return a + return none /-- Get all the expressions in a message, in order. -If you need the context of the expressions, prefer to use `forExprs` directly. -/ -partial def Lean.MessageData.getExprs (msg : MessageData) : IO (Array Expr) := - msg.forExprs #[] fun s e => return .yield (s.push e) +If you need the context of the expressions, prefer iterating over the expressions via +`for (ppCtx, e) in msg.exprs do` directly. -/ +partial def getExprs (msg : MessageData) : m (Array Expr) := do + let mut arr := #[] + for (_, e) in msg.exprs do + arr := arr.push e + return arr + +end Lean.MessageData",71,37,108,8.5,diff_derived,False,729,1,0,0,1,pr_merge,False,leanprover/lean4:v4.29.0,leanbench/lean4-env:4.29.0,lake build,600,lean_compiler,general,2026-04-28T12:39:53Z,extraction_pipeline_v2 LB-0010,pr_completion,easy,3.4,leanprover-community/mathlib4,35843,review: just the basics,https://github.com/leanprover-community/mathlib4/pull/35843,"delegated,t-meta",be3f919ded3ff56ae14edfbbe776bb5542a929f0,93584a945344b3c995cac4249c4e1ae747998b02,"Mathlib/Lean/MessageData/Trace.lean,Mathlib/Tactic/DefEqAbuse.lean",Mathlib/Lean/MessageData/Trace.lean,"# Task: review: just the basics ## Context This ultra-quick review of #35750 doesn't check for good behavior or maintainable code; instead, as per the [zulip thread](https://leanprover.zulipchat.com/#narrow/channel/113488-general/topic/backward.2EisDefEq.2ErespectTransparency/with/575687635), it merely - adds disclaimers - makes some things private - reviews documentation and behavior in the public module - makes sure that nothing catastrophic is happening ## Files affected - Mathlib/Lean/MessageData/Trace.lean (+33/-99) - Mathlib/Tactic/DefEqAbuse.lean (+106/-29) ## Definitions to add - `extractInstName` in `Mathlib/Lean/MessageData/Trace.lean`: Extract the instance name from a rendered `apply @Foo to Goal` trace header. - `dedupByString` in `Mathlib/Lean/MessageData/Trace.lean`: Deduplicate an array of `MessageData` by their rendered string representations. - `analyzeTraces` in `Mathlib/Tactic/DefEqAbuse.lean`: Convenience wrapper which accumulates the results of `visitM` across `arr`, attempting to - `reportDefEqAbuse` in `Mathlib/Tactic/DefEqAbuse.lean` ```lean def reportDefEqAbuse {m : Type → Type} [Monad m] [MonadLog m] [AddMessageContext m] ``` ## Existing declarations to modify - `dedupByString` in `Mathlib/Lean/MessageData/Trace.lean` (preserve semantics while updating code/proof) ## Verification The patched repository must compile with `lake build`.","diff --git a/Mathlib/Lean/MessageData/Trace.lean b/Mathlib/Lean/MessageData/Trace.lean --- a/Mathlib/Lean/MessageData/Trace.lean +++ b/Mathlib/Lean/MessageData/Trace.lean @@ -10,13 +10,9 @@ public import Lean.Message public import Std.Data.HashSet.Basic /-! -# Trace Tree Analysis Utilities for `MessageData` +# Utilities for analyzing `MessageData` -Lean's `MessageData.trace` nodes form a tree structure used by the tracing infrastructure -(`withTraceNode`, `withTraceNodeBefore`). These utilities provide generic traversal -and analysis of trace trees embedded in `MessageData`. - -## Status Encoding +**WARNING**: The declarations in this module may become obsolete with upcoming core changes. `TraceData` has no structured success/failure field. Instead, `withTraceNodeBefore` (in `Lean.Util.Trace`) prepends emoji to the rendered header message using `ExceptToEmoji`: @@ -26,19 +22,14 @@ and analysis of trace trees embedded in `MessageData`. The `TraceResult` type and `traceResultOf` function provide structured access to this encoding. -## Upstream Candidates - -`foldTraceNodes`, `TraceResult`, and `traceResultOf` are candidates for upstreaming to lean4, -alongside `MessageData.hasTag` in `Lean/Message.lean`. - -## Pending lean4 PRs (not required for this module) +## Pending lean4 PRs -These lean4 PRs will simplify things further but are not prerequisites: +These lean4 PRs may render declarations in this module obsolete: -- https://github.com/leanprover/lean4/pull/12698 adds `TraceResult` to `TraceData`. +- [lean4#12698](https://github.com/leanprover/lean4/pull/12698) adds `TraceResult` to `TraceData`. Once available, callers can use `td.result?` instead of parsing the header string. -- https://github.com/leanprover/lean4/pull/12699 adds a `Meta.synthInstance.apply` trace class, - so synthesis ""apply"" nodes can be identified via `td.cls` instead of string-matching. +- [lean4#12699](https://github.com/leanprover/lean4/pull/12699) adds a `Meta.synthInstance.apply` + trace class, so synthesis ""apply"" nodes can be identified via `td.cls` instead of string-matching. -/ public section @@ -47,9 +38,10 @@ namespace Lean.MessageData /-- The success/failure status of a trace node, as encoded by `withTraceNodeBefore` via emoji prefix on the rendered header. -Intended to match `TraceResult` from https://github.com/leanprover/lean4/pull/12698, -wrapped in `Option` (where `none` = no recognized emoji prefix). -Once that PR is available, callers should prefer `td.result?` over parsing the header string. -/ + +Intended to match `TraceResult` from [lean4#12698](https://github.com/leanprover/lean4/pull/12698). +Once that PR is available, callers should prefer `td.result?` over parsing the header string with +`traceResultOf`. -/ inductive TraceResult where /-- Header starts with ✅️ (checkEmoji) -/ | success @@ -64,6 +56,9 @@ inductive TraceResult where Lean's `withTraceNodeBefore` prepends `checkEmoji`/`crossEmoji`/`bombEmoji` (defined in `Lean.Util.Trace`) to trace headers to indicate outcomes. +The `TraceResult` will be recorded in trace messages directly in [lean4#12698](https://github.com/leanprover/lean4/pull/12698). +Once that PR is available, callers should prefer `td.result?` over calling this function. + Note: the emoji constants include a variation selector (U+FE0F), but `String.startsWith` handles this since we check for the base codepoint which is always the prefix. -/ def traceResultOf (headerStr : String) : Option TraceResult := @@ -79,89 +74,28 @@ Trace headers from `withTraceNodeBefore` have the form `""{emoji}[{VS16}] {conten This strips everything through the first space. Returns the string unchanged if no recognized status prefix is present. -/ def stripTraceResultPrefix (s : String) : String := - if (traceResultOf s).isNone then s - else match s.splitOn "" "" with - | _ :: rest@(_ :: _) => "" "".intercalate rest + if (traceResultOf s).isNone then s else + s.toSlice.dropPrefix (!·.isWhitespace) |>.dropPrefix ' ' |>.copy + +/-- Extract the instance name from a rendered `apply @Foo to Goal` trace header. +Returns the string between `""apply ""` and `"" to ""`. + +Note: this is fragile string matching against Lean's `Meta.synthInstance` trace format. +If the trace format changes, this function will silently return the original string. +Once [lean4#12699](https://github.com/leanprover/lean4/pull/12699) is available, +these nodes will have trace class `Meta.synthInstance.apply` and can be identified +structurally via `td.cls` instead of string-matching on the header. -/ +def extractInstName (s : String) : String := + match s.splitOn ""apply "" with + | [_, rest] => match rest.splitOn "" to "" with + | name :: _ => name.trimAscii.toString + | _ => s | _ => s -/-- A return value for functions called by traversals of `MessageData`. May either descend into -children or ascend immediately (skipping children), optionally including a value accumulated by the -traversal in both cases. -/ -inductive VisitStep (α) where -/-- Descends through the `MessageData`, visiting all children. If the argument `butFirst` is given -as `some a` (`none` by default), starts with `a`, and combines any values produced by children with -this value. -/ -| descend (butFirst : Option α := none) -/-- Skips visiting children, and ascends to the parent, returning the value given in `returning` -(if any). -/ -| ascend (returning : Option α := none) - -variable {m : Type → Type} [Monad m] {α : Type} - -/-- Collect and combine values of type `α` produced by visiting all trace nodes in a `MessageData` -tree. - -Automatically recurses through structural wrappers, invoking `onTrace` only for -`.trace` nodes. The `onTrace` callback receives the arguments of `.trace`: -- the `TraceData` (class name, timing, etc.) -- the trace node's header message -- the trace node's child messages - -Each call to `onTrace` is expected to produce either a `descend`, in which case the children of the -trace nodes will be visited, or an `ascend`, in which case they will not. Both may take an argument -`butFirst := some a`, which will cause `a` to be `combine`d into the accumulated value. - -We assume `x = combine empty x = combine x empty`. `empty` is attempted to be synthesized as the -`EmptyCollection`, and `combine` is attempted to be synthesized first via the notation `(· ++ ·)` -then via `(· ∪ ·)` as a fallback. - -Note that the children may be visited manually via a recursive call to `collectWith` or -`collectWithAndAscend`. - -Note: `.ofLazy` nodes are skipped (return `empty`) because they contain unevaluated -formatting thunks, not trace tree structure. This is consistent with `hasTag` -in `Lean.Message` which also skips `.ofLazy`. -/ -partial def visitTraceNodesM (msg : MessageData) - (onTrace : TraceData → MessageData → Array MessageData → m (MessageData.VisitStep α)) - (empty : α := by exact {}) (combine : α → α → α := by first | exact (· ++ ·) | exact (· ∪ ·)) : - m α := - go msg -where - /-- The continuation for `visitTraceNodesM`; this is mainly for readability (takes only one - argument in source). -/ - go : MessageData → m α - | .trace td header children => do - match ← onTrace td header children with - | .descend a? => do - let mut result := a?.getD empty - for child in children do - result := combine result (← go child) - return result - | .ascend a? => return a?.getD empty - | .compose a b => return combine (← go a) (← go b) - | .nest _ m | .group m | .tagged _ m | .withContext _ m | .withNamingContext _ m => go m - | .ofLazy _ _ | .ofWidget _ _ | .ofGoal _ | .ofFormatWithInfos _ => return empty - -/-- Convenience wrapper which accumulates the results of `visitM` across `arr`, attempting to -produce `empty` and `combine` from `{}` and `(· ++ ·)` or `(· ∪ ·)`. -/ -@[inline] def visitWithM {β} (arr : Array β) (visitM : β → m α) - (empty : α := by exact {}) (combine : α → α → α := by first | exact (· ++ ·) | exact (· ∪ ·)) : - m α := - arr.foldlM (init := empty) fun acc msg => return combine acc (← visitM msg) - -/-- Convenience wrapper which accumulates the results of `visitM` across `arr`, attempting to -produce `empty` and `combine` from `{}` and `(· ++ ·)` or `(· ∪ ·)`, then `.ascend`s with the result -(if any). This effectively replaces a return value of `.descend`. -/ -@[inline] def visitWithAndAscendM {β} (arr : Array β) (visitM : β → m α) - (empty : α := by exact {}) (combine : α → α → α := by first | exact (· ++ ·) | exact (· ∪ ·)) : - m (VisitStep α) := do - if arr.isEmpty then return .ascend else - return .ascend <|← visitWithM arr visitM empty combine - -/-- Deduplicate an array of `MessageData` by their rendered string representation. -/ -def dedupByString (msgs : Array Lean.MessageData) : BaseIO (Array Lean.MessageData) := do +/-- Deduplicate an array of `MessageData` by their rendered string representations. -/ +def dedupByString (msgs : Array MessageData) : BaseIO (Array MessageData) := do let mut seen : Std.HashSet String := {} - let mut unique : Array Lean.MessageData := #[] + let mut unique : Array MessageData := #[] for msg in msgs do let s ← msg.toString unless seen.contains s do diff --git a/Mathlib/Tactic/DefEqAbuse.lean b/Mathlib/Tactic/DefEqAbuse.lean --- a/Mathlib/Tactic/DefEqAbuse.lean +++ b/Mathlib/Tactic/DefEqAbuse.lean @@ -11,6 +11,11 @@ public meta import Mathlib.Lean.MessageData.Trace /-! # The `#defeq_abuse` tactic and command combinators +**WARNING:** `#defeq_abuse` is an experimental tool intended to assist with breaking changes to +transparency handling (associated with `backward.isDefEq.respectTransparency`). Its syntax may +change at any time, and it may not behave as expected. Please report unexpected behavior +[on Zulip](https://leanprover.zulipchat.com/#narrow/channel/113488-general/topic/backward.2EisDefEq.2ErespectTransparency/with/575685551). + `#defeq_abuse in tac` runs `tac` with `backward.isDefEq.respectTransparency` both `true` and `false`. If the tactic succeeds with `false` but fails with `true`, it identifies the specific `isDefEq` checks that fail with the stricter setting, helping to diagnose where Mathlib relies on @@ -45,29 +50,94 @@ instance {V : Type} [AddCommGroup V] [Module ℝ V] {l : Submodule ℝ V} : will report the synthesis failures grouped by instance application. -/ -public meta section +meta section open Lean MessageData Meta Elab Tactic Command -namespace Mathlib.Tactic.DefEqAbuse +namespace Lean.MessageData + +/- TODO: this section should be moved to `Lean.MessageData.Trace` when finalized and made public. -/ + +/-- A return value for functions called by traversals of `MessageData`. May either descend into +children or ascend immediately (skipping children), optionally including a value accumulated by the +traversal in both cases. -/ +inductive VisitStep (α) where +/-- Descends through the `MessageData`, visiting all children. If the argument `butFirst` is given +as `some a` (`none` by default), starts with `a`, and combines any values produced by children with +this value. -/ +| descend (butFirst : Option α := none) +/-- Skips visiting children, and ascends to the parent, returning the value given in `returning` +(if any). -/ +| ascend (returning : Option α := none) + +variable {m : Type → Type} [Monad m] {α : Type} + +/-- Collect and combine values of type `α` produced by visiting all trace nodes in a `MessageData` +tree. + +Automatically recurses through structural wrappers, invoking `onTrace` only for +`.trace` nodes. The `onTrace` callback receives the arguments of `.trace`: +- the `TraceData` (class name, timing, etc.) +- the trace node's header message +- the trace node's child messages + +Each call to `onTrace` is expected to produce either a `descend`, in which case the children of the +trace nodes will be visited, or an `ascend`, in which case they will not. Both may take an argument +`butFirst := some a`, which will cause `a` to be `combine`d into the accumulated value. + +We assume `x = combine empty x = combine x empty`. `empty` is attempted to be synthesized as the +`EmptyCollection`, and `combine` is attempted to be synthesized first via the notation `(· ++ ·)` +then via `(· ∪ ·)` as a fallback. -/-- Extract the instance name from a rendered `apply @Foo to Goal` trace header. -Returns the string between `""apply ""` and `"" to ""`. - -Note: this is fragile string matching against Lean's `Meta.synthInstance` trace format. -If the trace format changes, this function will silently return the original string. -Once https://github.com/leanprover/lean4/pull/12699 is available, -these nodes will have trace class `Meta.synthInstance.apply` and can be identified -structurally via `td.cls` instead of string-matching on the header. -/ -private def extractInstName (s : String) : String := - match s.splitOn ""apply "" with - | [_, rest] => match rest.splitOn "" to "" with - | name :: _ => name.trimAscii.toString - | _ => s - | _ => s +Note that the children may be visited manually via a recursive call to `collectWith` or +`collectWithAndAscend`. + +Note: `.ofLazy` nodes are skipped (return `empty`) because they contain unevaluated +formatting thunks, not trace tree structure. This is consistent with `hasTag` +in `Lean.Message` which also skips `.ofLazy`. -/ +partial def visitTraceNodesM (msg : MessageData) + (onTrace : TraceData → MessageData → Array MessageData → m (MessageData.VisitStep α)) + (empty : α := by exact {}) (combine : α → α → α := by first | exact (· ++ ·) | exact (· ∪ ·)) : + m α := + go msg +where + /-- The continuation for `visitTraceNodesM`; this is mainly for readability (takes only one + argument in source). -/ + go : MessageData → m α + | .trace td header children => do + match ← onTrace td header children with + | .descend a? => do + let mut result := a?.getD empty + for child in children do + result := combine result (← go child) + return result + | .ascend a? => return a?.getD empty + | .compose a b => return combine (← go a) (← go b) + | .nest _ m | .group m | .tagged _ m | .withContext _ m | .withNamingContext _ m => go m + | .ofLazy _ _ | .ofWidget _ _ | .ofGoal _ | .ofFormatWithInfos _ => return empty + +/-- Convenience wrapper which accumulates the results of `visitM` across `arr`, attempting to +produce `empty` and `combine` from `{}` and `(· ++ ·)` or `(· ∪ ·)`. -/ +@[inline] def visitWithM {β} (arr : Array β) (visitM : β → m α) + (empty : α := by exact {}) (combine : α → α → α := by first | exact (· ++ ·) | exact (· ∪ ·)) : + m α := + arr.foldlM (init := empty) fun acc msg => return combine acc (← visitM msg) + +/-- Convenience wrapper which accumulates the results of `visitM` across `arr`, attempting to +produce `empty` and `combine` from `{}` and `(· ++ ·)` or `(· ∪ ·)`, then `.ascend`s with the result +(if any). This effectively replaces a return value of `.descend`. -/ +@[inline] def visitWithAndAscendM {β} (arr : Array β) (visitM : β → m α) + (empty : α := by exact {}) (combine : α → α → α := by first | exact (· ++ ·) | exact (· ∪ ·)) : + m (VisitStep α) := do + if arr.isEmpty then return .ascend else + return .ascend <|← visitWithM arr visitM empty combine + +end Lean.MessageData + +namespace Mathlib.Tactic.DefEqAbuse /-- Only applies `f` to `Meta.isDefEq` trace nodes. Skips `Meta.isDefEq.onFailure` nodes. -/ -@[inline] private def onlyOnDefEqNodes {m} [Monad m] {α} +@[inline] def onlyOnDefEqNodes {m} [Monad m] {α} (f : TraceData → MessageData → Array MessageData → m (VisitStep α)) : TraceData → MessageData → Array MessageData → m (VisitStep α) := fun td header children => do @@ -79,7 +149,7 @@ private def extractInstName (s : String) : String := Skips `onFailure` retry nodes and ignores ✅ branches (recovered failures aren't root causes). Note: status is currently determined by parsing emoji from the rendered header string. Once https://github.com/leanprover/lean4/pull/12698 is available, use `td.result?` instead. -/ -private partial def findLeafFailures (msg : MessageData) : BaseIO (Array MessageData) := +partial def findLeafFailures (msg : MessageData) : BaseIO (Array MessageData) := msg.visitTraceNodesM <| onlyOnDefEqNodes fun td header children => do unless traceResultOf (← header.toString) matches some .failure do return .ascend @@ -89,7 +159,7 @@ private partial def findLeafFailures (msg : MessageData) : BaseIO (Array Message /-- Collect rendered check strings from `Meta.isDefEq` trace nodes matching a status predicate. Returns a `HashSet` of emoji-stripped header strings. -/ -private partial def collectIsDefEqChecks (pred : TraceResult → Bool) +partial def collectIsDefEqChecks (pred : TraceResult → Bool) (msg : MessageData) : BaseIO (Std.HashSet String) := msg.visitTraceNodesM <| onlyOnDefEqNodes fun td header children => do let headerStr ← header.toString @@ -104,7 +174,7 @@ as a failure in the permissive trace (which would indicate the check is context- rather than transparency-dependent). A ""deepest transition point"" has no descendant transition points. Falls back to `findLeafFailures` behavior when `permSuccesses` is empty. -/ -private partial def findTransitionFailures (permSuccesses : Std.HashSet String) +partial def findTransitionFailures (permSuccesses : Std.HashSet String) (permFailures : Std.HashSet String) (msg : MessageData) : BaseIO (Array MessageData) := if permSuccesses.isEmpty then findLeafFailures msg @@ -129,7 +199,7 @@ private partial def findTransitionFailures (permSuccesses : Std.HashSet String) and their `isDefEq` transition failures. Once https://github.com/leanprover/lean4/pull/12699 is available, the `headerStr.contains ""apply""` check can be replaced with ``td.cls == `Meta.synthInstance.apply``. -/ -private partial def findSynthAppFailures (permSuccesses permFailures : Std.HashSet String) +partial def findSynthAppFailures (permSuccesses permFailures : Std.HashSet String) (msg : MessageData) : BaseIO (Array (MessageData × Array MessageData)) := msg.visitTraceNodesM fun td header children => do if td.cls == `Meta.isDefEq.onFailure then return .ascend @@ -144,7 +214,7 @@ private partial def findSynthAppFailures (permSuccesses permFailures : Std.HashS /-- Find top-level synthesis failures and their `isDefEq` root causes. Only enters failing synthesis nodes to avoid reporting recovered sub-attempts. -/ -private partial def findSynthFailures (permSuccesses permFailures : Std.HashSet String) +partial def findSynthFailures (permSuccesses permFailures : Std.HashSet String) (msg : MessageData) : BaseIO (Array (MessageData × Array MessageData)) := msg.visitTraceNodesM fun td header children => do if td.cls == `Meta.isDefEq.onFailure then return .ascend @@ -160,8 +230,8 @@ private partial def findSynthFailures (permSuccesses permFailures : Std.HashSet /-- Collect instance names from successful `apply @Instance to Goal` trace nodes. Once https://github.com/leanprover/lean4/pull/12699 is available, the `headerStr.contains ""apply""` -check can be replaced with `td.cls == `Meta.synthInstance.apply``. -/ -private partial def findSynthSuccessApps (msg : MessageData) : BaseIO (Std.HashSet String) := +check can be replaced with ``td.cls == `Meta.synthInstance.apply``. -/ +partial def findSynthSuccessApps (msg : MessageData) : BaseIO (Std.HashSet String) := msg.visitTraceNodesM fun td header children => do if td.cls == `Meta.synthInstance then let headerStr ← header.toString @@ -172,8 +242,7 @@ private partial def findSynthSuccessApps (msg : MessageData) : BaseIO (Std.HashS /-- Analyze strict and permissive trace messages to find isDefEq transition failures and (optionally) synthesis-grouped failures. Returns `(flatFailures, synthGroupedFailures)`. -/ -private def analyzeTraces (strictMsgs permMsgs : Array MessageData) - (includeSynth : Bool := false) : +def analyzeTraces (strictMsgs permMsgs : Array MessageData) (includeSynth : Bool := false) : BaseIO (Array MessageData × Array (MessageData × Array MessageData)) := do -- Build sets of permissive successes and failures for transition-point detection. let mut permSuccesses : Std.HashSet String := {} @@ -207,7 +276,7 @@ private def analyzeTraces (strictMsgs permMsgs : Array MessageData) /-- Format and log the `#defeq_abuse` diagnostic report. `kind` is `""tactic""` or `""command""`. -/ -private def reportDefEqAbuse {m : Type → Type} [Monad m] [MonadLog m] [AddMessageContext m] +def reportDefEqAbuse {m : Type → Type} [Monad m] [MonadLog m] [AddMessageContext m] [MonadOptions m] (kind : String) (uniqueFailures : Array MessageData) (synthResults : Array (MessageData × Array MessageData)) : m Unit := do if !synthResults.isEmpty then @@ -236,6 +305,10 @@ private def reportDefEqAbuse {m : Type → Type} [Monad m] [MonadLog m] [AddMess The following isDefEq checks are the root causes of the failure:\n{failureList}"" /-- +> **WARNING:** `#defeq_abuse` is an experimental tool intended to assist with breaking +changes to transparency handling. Its syntax may change at any time, and it may not behave as +expected. Please report unexpected behavior [on Zulip](https://leanprover.zulipchat.com/#narrow/channel/113488-general/topic/backward.2EisDefEq.2ErespectTransparency/with/575685551). + `#defeq_abuse in tac` runs `tac` with `backward.isDefEq.respectTransparency` both `true` and `false`. If the tactic succeeds with `false` but fails with `true`, it identifies the specific `isDefEq` checks that fail with the stricter setting. @@ -299,6 +372,10 @@ elab (name := defeqAbuse) ""#defeq_abuse "" ""in "" tac:tactic : tactic => withMainC evalTactic tac /-- +> **WARNING:** `#defeq_abuse` is an experimental tool intended to assist with breaking +changes to transparency handling. Its syntax may change at any time, and it may not behave as +expected. Please report unexpected behavior [on Zulip](https://leanprover.zulipchat.com/#narrow/channel/113488-general/topic/backward.2EisDefEq.2ErespectTransparency/with/575685551). + `#defeq_abuse in cmd` runs `cmd` with `backward.isDefEq.respectTransparency` both `true` and `false`. If the command succeeds with `false` but fails with `true`, it identifies the specific synthesis applications and `isDefEq` checks that fail with the stricter setting. @@ -334,6 +411,7 @@ elab_rules : command -- We set `Elab.async false` to force synchronous proof checking, -- otherwise `theorem` proofs are elaborated in a background task and errors -- won't appear in `messages` until after `elabCommand` returns. + -- TODO: wait on all of the tasks instead of disabling async entirely. let traceOpts (strict : Bool) (scope : Scope) : Scope := { scope with opts := (scope.opts.setBool `Elab.async false) |>.setBool `backward.isDefEq.respectTransparency strict @@ -366,8 +444,7 @@ elab_rules : command reportDefEqAbuse ""command"" uniqueFailures synthResults -- Pass 3: run the command with permissive setting so it actually takes effect withScope (fun scope => - { scope with opts := (scope.opts.setBool `Elab.async false) - |>.setBool `backward.isDefEq.respectTransparency false }) do + { scope with opts := scope.opts.setBool `backward.isDefEq.respectTransparency false }) do elabCommand cmd end Mathlib.Tactic.DefEqAbuse",139,128,267,8.5,diff_derived,False,421,2,0,0,4,pr_merge,False,leanprover/lean4:v4.29.0,leanbench/lean4-env:4.29.0,lake build,600,lean_compiler,general,2026-04-28T12:39:53Z,extraction_pipeline_v2 LB-0011,pr_completion,medium,4.4,ImperialCollegeLondon/FLT,841,Complete `localcomponent_matrix` and `f_g_local_global`,https://github.com/ImperialCollegeLondon/FLT/pull/841,,e36185c7b9eaf3ecb0ce044a0536490f4007e0f1,712e8a20d2647895feed1cbf5518dce4056f58cb,"FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean,FLT/Mathlib/Topology/Algebra/RestrictedProduct/TopologicalSpace.lean",FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean,"# Task: Complete `localcomponent_matrix` and `f_g_local_global` ## Files affected - FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean (+112/-12) - FLT/Mathlib/Topology/Algebra/RestrictedProduct/TopologicalSpace.lean (+18/-0) ## Supporting lemmas - `basis_repr_eq_global` in `FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean` ```lean lemma basis_repr_eq_global {x : (FiniteAdeleRing (𝓞 K) K) ⊗[K] B} : ``` - `basis_eq_single_global` in `FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean` ```lean lemma basis_eq_single_global ``` - `basis_eq_global` in `FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean` ```lean lemma basis_eq_global ``` - `toMatrix_f` in `FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean` ```lean lemma toMatrix_f ``` - `ContinuousMulEquiv.restrictedProductPi_apply` in `FLT/Mathlib/Topology/Algebra/RestrictedProduct/TopologicalSpace.lean` ```lean lemma ContinuousMulEquiv.restrictedProductPi_apply {ι : Type*} {n : Type*} [Fintype n] ``` - `ContinuousMulEquiv.restrictedProductPi_symm_apply` in `FLT/Mathlib/Topology/Algebra/RestrictedProduct/TopologicalSpace.lean` ```lean lemma ContinuousMulEquiv.restrictedProductPi_symm_apply {ι : Type*} {n : Type*} [Fintype n] ``` ## Verification The patched repository must compile with `lake build`.","diff --git a/FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean b/FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean --- a/FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean +++ b/FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean @@ -239,23 +239,33 @@ TODO: Could all probably be elsewhere and in greater generality. -/ noncomputable abbrev b_local (v : HeightOneSpectrum (𝓞 K)) := Module.Basis.baseChange (v.adicCompletion K) (Module.Free.chooseBasis K B) +/-- `b_global` is `FiniteAdeleRing (𝓞 K) K`-basis for `FiniteAdeleRing (𝓞 K) K ⊗[K] B`. -/ +noncomputable abbrev b_global := + Module.Basis.baseChange (FiniteAdeleRing (𝓞 K) K) (Module.Free.chooseBasis K B) + lemma basis_repr_eq (v : HeightOneSpectrum (𝓞 K)) {x : adicCompletion K v ⊗[K] B} : (b_local K B v).repr x = (ContinuousLinearEquiv.chooseBasis_piScalarRight' K (v.adicCompletion K) B) x := by refine TensorProduct.induction_on x (by simp) (fun _ _ ↦ ?_) (fun _ _ ↦ by simp +contextual) ext; simp; rfl +lemma basis_repr_eq_global {x : (FiniteAdeleRing (𝓞 K) K) ⊗[K] B} : + (b_global K B).repr x + = (ContinuousLinearEquiv.chooseBasis_piScalarRight' K (FiniteAdeleRing (𝓞 K) K) B) x := by + refine TensorProduct.induction_on x (by simp) (fun _ _ ↦ ?_) (fun _ _ ↦ by simp +contextual) + ext; simp; rfl + lemma basis_eq_single (v : HeightOneSpectrum (𝓞 K)) {j : Module.Free.ChooseBasisIndex K B} {x : adicCompletion K v} : x • (b_local K B v) j = (ContinuousLinearEquiv.chooseBasis_piScalarRight' K (v.adicCompletion K) B).symm (Pi.single j x) := by rw [ContinuousLinearEquiv.eq_symm_apply]; ext b; + have : (x • (b_local K B v) j) = (x ⊗ₜ[K] (Module.Free.chooseBasis K B) j) := by + simp [Algebra.smul_def] + rw [this] conv_lhs => - simp only [Module.Basis.baseChange_apply, Algebra.smul_def, - Algebra.TensorProduct.algebraMap_apply, Algebra.algebraMap_self, RingHom.id_apply, - Algebra.TensorProduct.tmul_mul_tmul, mul_one, one_mul] change ((Module.Free.chooseBasis K B).repr ((Module.Free.chooseBasis K B) j)) b • x simp [Finsupp.single, Pi.single, Algebra.smul_def, Function.update] @@ -269,6 +279,30 @@ lemma basis_eq (v : HeightOneSpectrum (𝓞 K)) conv_rhs => rw [hw] simp only [basis_eq_single K B v, map_sum]; rfl +lemma basis_eq_single_global + {j : Module.Free.ChooseBasisIndex K B} {x : FiniteAdeleRing (𝓞 K) K} : + x • (b_global K B) j + = (ContinuousLinearEquiv.chooseBasis_piScalarRight' + K (FiniteAdeleRing (𝓞 K) K) B).symm (Pi.single j x) := by + rw [ContinuousLinearEquiv.eq_symm_apply]; + ext b v; + have : (x • (b_global K B) j) = (x ⊗ₜ[K] (Module.Free.chooseBasis K B) j) := by + simp [Algebra.smul_def] + rw [this] + conv_lhs => + change (((Module.Free.chooseBasis K B).repr ((Module.Free.chooseBasis K B) j)) b • x) v + simp [Finsupp.single, Pi.single, Algebra.smul_def, Function.update] + +lemma basis_eq_global + {w : Module.Free.ChooseBasisIndex K B → (FiniteAdeleRing (𝓞 K) K)} : + ∑ (j : Module.Free.ChooseBasisIndex K B), (w j) • b_global K B j + = (ContinuousLinearEquiv.chooseBasis_piScalarRight' + K (FiniteAdeleRing (𝓞 K) K) B).toContinuousAddEquiv.symm w := by + have hw : w = ∑ x, (Pi.single x (w x)) := by + ext; simp + conv_rhs => rw [hw] + simp only [basis_eq_single_global K B, map_sum]; rfl + end auxiliary_basis_lemmas -- this should really be just after the definition of `localcomponent` @@ -343,6 +377,27 @@ lemma localcomponent_matrix (v : HeightOneSpectrum (𝓞 K)) rw [← mul_one ((FiniteAdeleRing.singleLinearMap (𝓞 K) K v) 1)] rw [← smul_eq_mul, ← TensorProduct.smul_tmul', map_smul, AlgHom.rTensor_map_smul] rw [FiniteAdeleRing.evalAlgebraMap_singleLinearMap, one_smul] + conv_lhs => + change (AlgHom.rTensor B (FiniteAdeleRing.evalAlgebraMap (𝓞 K) K v)) + (φ.toLinearEquiv.toLinearMap (1 ⊗ₜ[K] r)) + rw [← Matrix.toLin_toMatrix b b φ.toLinearEquiv] + have rTensor_basis (j : Module.Free.ChooseBasisIndex K B) : + (AlgHom.rTensor B (FiniteAdeleRing.evalAlgebraMap (𝓞 K) K v)) (b j) + = b_local j := by + simp [AlgHom.rTensor, b, b_local] + have eval_mulVec_eq (j : Module.Free.ChooseBasisIndex K B) : + (FiniteAdeleRing.evalAlgebraMap (𝓞 K) K v) + (((LinearMap.toMatrix b b) ↑φ.toLinearEquiv).mulVec (⇑(b.repr (1 ⊗ₜ[K] r))) j) + = + (((LinearMap.toMatrix b b) ↑φ.toLinearEquiv).map + ⇑(evalRingHom (fun p ↦ adicCompletion K p) v)).mulVec + (⇑(b_local.repr (1 ⊗ₜ[K] r))) j := by + set m := ((LinearMap.toMatrix b b) ↑φ.toLinearEquiv) + convert RingHom.map_mulVec (evalRingHom (fun p ↦ adicCompletion K p) v) m _ j + ext i + simp [b, b_local, evalRingHom, evalMonoidHom, Algebra.smul_def] + rfl + simp [-Matrix.toLin_toMatrix, Matrix.toLin_apply, rTensor_basis, eval_mulVec_eq] /- localcomponent stuff and `single` (an annoying linear map) now gone. @@ -370,7 +425,22 @@ lemma localcomponent_matrix (v : HeightOneSpectrum (𝓞 K)) Could just break everything up into sums? Tried this and got confused. -/ - sorry + +/-- The matrix reps of `φ` and `f φ` agree. -/ +lemma toMatrix_f + (φ : FiniteAdeleRing (𝓞 K) K ⊗[K] B ≃L[FiniteAdeleRing (𝓞 K) K] + FiniteAdeleRing (𝓞 K) K ⊗[K] B) : + LinearMap.toMatrix (b_global K B) (b_global K B) φ.toLinearEquiv + = LinearMap.toMatrix' (f K B φ) := by + have basis_eq_global' + {w : Module.Free.ChooseBasisIndex K B → (FiniteAdeleRing (𝓞 K) K)} : + ∑ (j : Module.Free.ChooseBasisIndex K B), (w j) • b_global K B j + = (ContinuousLinearEquiv.chooseBasis_piScalarRight' + K (FiniteAdeleRing (𝓞 K) K) B).symm w := + basis_eq_global K B + ext + simp [f, ← basis_repr_eq_global K B, + ← basis_eq_global', LinearMap.toMatrix_apply] -- A (continuous) 𝔸_K^f-linear automorphism of 𝔸_K^f ⊗ B is ""integral"" at all but -- finitely many places @@ -405,9 +475,8 @@ lemma FiniteAdeleRing.Aux.almost_always_mapsTo ((b_local.repr (φ_local_Kv_linear K B v φ (b_local j))) i) = (m i j) v := by rw [← LinearMap.toMatrix_apply, localcomponent_matrix] -- simp [e, ← basis_eq K B v] - simp only [e, ← basis_eq K B v, Subsemiring.coe_carrier_toSubmonoid, Subring.coe_toSubsemiring, - ContinuousAddEquiv.trans_apply, map_sum, Finset.sum_apply, SetLike.mem_coe, - ValuationSubring.mem_toSubring] --argh! + simp only [e, ← basis_eq K B v, + ContinuousAddEquiv.trans_apply, map_sum, Finset.sum_apply] --argh! change ∑ c, (ContinuousLinearEquiv.chooseBasis_piScalarRight' K (adicCompletion K v) B) (φ_local_Kv_linear K B v φ (w c • b_local c)) j @@ -438,11 +507,42 @@ lemma FiniteAdeleRing.Aux.f_g_local_global g K (f K B φ) = ContinuousAddEquiv.restrictedProductCongrRight (fun v ↦ e _ _ _ (FiniteAdeleRing.TensorProduct.localcomponentEquiv (𝓞 K) K B v φ)) (FiniteAdeleRing.Aux.almost_always_bijOn _ _ _) := by - ext r v i; - simp [ContinuousAddEquiv.restrictedProductCongrRight] - simp [e,f,g, FiniteAdeleRing.TensorProduct.localcomponentEquiv, - FiniteAdeleRing.TensorProduct.localcomponent] - sorry -- this is hopefully close to being true by ext but I didn't think about it. + ext r v j; + letI b₀ := Module.Free.chooseBasis K B + letI b := Module.Basis.baseChange (FiniteAdeleRing (𝓞 K) K) b₀ + letI b_local := Module.Basis.baseChange (v.adicCompletion K) b₀ + let m := LinearMap.toMatrix b b φ.toLinearMap + simp only [ContinuousAddEquiv.restrictedProductCongrRight, e, ← basis_eq K B v, + ContinuousAddEquiv.coe_trans, ContinuousAddEquiv.coe_mk, AddEquiv.coe_mk, Equiv.coe_fn_mk, + map_apply, Function.comp_apply, map_sum, Finset.sum_apply] + conv_rhs => + change ∑ c, + (ContinuousLinearEquiv.chooseBasis_piScalarRight' K (adicCompletion K v) B) + (φ_local_Kv_linear K B v φ (r v c • b_local c)) j + have basis_repr_eq' {x : adicCompletion K v ⊗[K] B} : + b_local.repr x + = (ContinuousLinearEquiv.chooseBasis_piScalarRight' K (v.adicCompletion K) B) x := + basis_repr_eq K B v + have local_repr_eq (i j : Module.Free.ChooseBasisIndex K B) : + ((b_local.repr (φ_local_Kv_linear K B v φ (b_local j))) i) = (m i j) v := by + rw [← LinearMap.toMatrix_apply, localcomponent_matrix] + have hf : m = LinearMap.toMatrix' (f K B φ) := toMatrix_f K B φ + simp only [ ← basis_repr_eq', local_repr_eq, m, hf, g, + ContinuousAddEquiv.trans_apply, map_smul, Finsupp.coe_smul, Pi.smul_apply] + -- Up to here, what we have done is to simplify the RHS `e (localcomponent φ)` in terms of + -- the matrix rep of `φ`, which is the same as the matrix rep of `f φ` by `toMatrix_f` above. + -- What remains is to simplify `g`, i.e. to simplify `ContinuousAddEquiv.restrictedProductPi`. + set ψ := f K B φ + conv_lhs => + change (ψ.toLinearEquiv.toLinearMap (fun j ↦ map (fun i t ↦ t j) + (Filter.Eventually.of_forall (fun _ _ _ ↦ by simp_all [AddSubgroup.mem_pi])) r) j) v + rw [← Matrix.toLin'_toMatrix' ψ.toLinearEquiv.toLinearMap] + have {f : Module.Free.ChooseBasisIndex K B → FiniteAdeleRing (𝓞 K) K} : + (∑ x, f x) v = ∑ x, f x v := + -- general lemma + map_sum (RestrictedProduct.evalAddMonoidHom _ _) _ _ + simp [-Matrix.toLin'_toMatrix', Matrix.mulVec, dotProduct, this, FiniteAdeleRing, + mul_comm (r v _) _] lemma localcomponent_mulLeft (u : ((FiniteAdeleRing (𝓞 K) K) ⊗[K] B)ˣ) (v : HeightOneSpectrum (𝓞 K)) : diff --git a/FLT/Mathlib/Topology/Algebra/RestrictedProduct/TopologicalSpace.lean b/FLT/Mathlib/Topology/Algebra/RestrictedProduct/TopologicalSpace.lean --- a/FLT/Mathlib/Topology/Algebra/RestrictedProduct/TopologicalSpace.lean +++ b/FLT/Mathlib/Topology/Algebra/RestrictedProduct/TopologicalSpace.lean @@ -181,6 +181,24 @@ def ContinuousMulEquiv.restrictedProductPi {ι : Type*} {n : Type*} [Fintype n] continuous_rng_of_principal_pi.mpr fun _ ↦ continuous_pi fun _ ↦ (RestrictedProduct.continuous_eval _).comp (continuous_apply _) +@[to_additive (attr := simp)] +lemma ContinuousMulEquiv.restrictedProductPi_apply {ι : Type*} {n : Type*} [Fintype n] + {A : n → ι → Type*} [∀ j i, TopologicalSpace (A j i)] [∀ j i, Group (A j i)] + {C : (j : n) → (i : ι) → Subgroup (A j i)} {hCopen : ∀ j i, IsOpen (C j i : Set (A j i))} + {x : Πʳ i, [Π j, A j i, Subgroup.pi (Set.univ : Set n) (fun j ↦ C j i)]} {i : ι} {j : n} : + ContinuousMulEquiv.restrictedProductPi hCopen x j i + = (x i) j := + rfl + +@[to_additive (attr := simp)] +lemma ContinuousMulEquiv.restrictedProductPi_symm_apply {ι : Type*} {n : Type*} [Fintype n] + {A : n → ι → Type*} [∀ j i, TopologicalSpace (A j i)] [∀ j i, Group (A j i)] + {C : (j : n) → (i : ι) → Subgroup (A j i)} {hCopen : ∀ j i, IsOpen (C j i : Set (A j i))} + {x : Π j, (Πʳ i, [A j i, C j i])} {i : ι} {j : n} : + (ContinuousMulEquiv.restrictedProductPi hCopen).symm x i j + = (x j) i := + rfl + theorem Homeomorph.restrictedProductMatrix_aux {ι n : Type*} [Fintype n] {A : ι → Type*} [(i : ι) → TopologicalSpace (A i)] {C : (i : ι) → Set (A i)} (i : ι) (hCopen : ∀ (i : ι), IsOpen (C i)) :",130,12,142,7.5,diff_derived,False,0,2,0,6,0,pr_merge,False,leanprover/lean4:v4.29.0,leanbench/lean4-env:4.29.0,lake build,600,lean_compiler,algebra,2026-04-28T12:40:01Z,extraction_pipeline_v2 LB-0012,pr_completion,medium,6.6,ImperialCollegeLondon/FLT,836,feat: FiniteAdeleRing.Aux.almost_always_bijOn,https://github.com/ImperialCollegeLondon/FLT/pull/836,awaiting-CI,20c7c4548a6a67fdcfb585a83a46b273f45843ca,799f7d54d7e3f096b3037189f9713abc28be81f0,"FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean,FLT/Mathlib/LinearAlgebra/TensorProduct/Algebra.lean,FLT/Mathlib/RingTheory/DedekindDomain/FiniteAdeleRing.lean",FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean,"# Task: feat: FiniteAdeleRing.Aux.almost_always_bijOn ## Files affected - FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean (+198/-6) - FLT/Mathlib/LinearAlgebra/TensorProduct/Algebra.lean (+7/-1) - FLT/Mathlib/RingTheory/DedekindDomain/FiniteAdeleRing.lean (+52/-3) ## Definitions to add - `evalAlgebraMap` in `FLT/Mathlib/RingTheory/DedekindDomain/FiniteAdeleRing.lean` ```lean def evalAlgebraMap (j : HeightOneSpectrum R) : ``` - `evalContinuousAlgebraMap` in `FLT/Mathlib/RingTheory/DedekindDomain/FiniteAdeleRing.lean` ```lean def evalContinuousAlgebraMap (j : HeightOneSpectrum R) : ``` ## Supporting lemmas - `basis_repr_eq` in `FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean` ```lean lemma basis_repr_eq (v : HeightOneSpectrum (𝓞 K)) {x : adicCompletion K v ⊗[K] B} : ``` - `basis_eq_single` in `FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean` ```lean lemma basis_eq_single (v : HeightOneSpectrum (𝓞 K)) ``` - `basis_eq` in `FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean` ```lean lemma basis_eq (v : HeightOneSpectrum (𝓞 K)) ``` - `localcomponent_matrix` in `FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean` ```lean lemma localcomponent_matrix (v : HeightOneSpectrum (𝓞 K)) ``` - `FiniteAdeleRing.Aux.almost_always_mapsTo` in `FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean` ```lean lemma FiniteAdeleRing.Aux.almost_always_mapsTo ``` - `FiniteAdeleRing.Aux.almost_always_bijOn` in `FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean` ```lean lemma FiniteAdeleRing.Aux.almost_always_bijOn ``` - `AlgHom.rTensor_map_smul` in `FLT/Mathlib/LinearAlgebra/TensorProduct/Algebra.lean` ```lean lemma AlgHom.rTensor_map_smul {R : Type*} [CommSemiring R] (M : Type*) {N : Type*} ``` - `evalAlgebraMap_singleLinearMap` in `FLT/Mathlib/RingTheory/DedekindDomain/FiniteAdeleRing.lean` ```lean lemma evalAlgebraMap_singleLinearMap (j : HeightOneSpectrum R) ``` ## Existing declarations to modify - `evalContinuousAlgebraMap` in `FLT/Mathlib/RingTheory/DedekindDomain/FiniteAdeleRing.lean` (preserve semantics while updating code/proof) ## Verification The patched repository must compile with `lake build`.","diff --git a/FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean b/FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean --- a/FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean +++ b/FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean @@ -230,26 +230,218 @@ open FiniteAdeleRing.Aux generality so no harm in making it classical. -/ noncomputable local instance : DecidableEq (HeightOneSpectrum (𝓞 K)) := Classical.decEq _ +section auxiliary_basis_lemmas + +/- API for relating `ContinuousLinearEquiv.chooseBasis_piScalarRight'` to `Module.Basis`. +TODO: Could all probably be elsewhere and in greater generality. -/ + +/-- `b_local` is `v.adicCompletion K`-basis for `v.adicCompletion K ⊗[K] B`. -/ +noncomputable abbrev b_local (v : HeightOneSpectrum (𝓞 K)) := + Module.Basis.baseChange (v.adicCompletion K) (Module.Free.chooseBasis K B) + +lemma basis_repr_eq (v : HeightOneSpectrum (𝓞 K)) {x : adicCompletion K v ⊗[K] B} : + (b_local K B v).repr x + = (ContinuousLinearEquiv.chooseBasis_piScalarRight' K (v.adicCompletion K) B) x := by + refine TensorProduct.induction_on x (by simp) (fun _ _ ↦ ?_) (fun _ _ ↦ by simp +contextual) + ext; simp; rfl + +lemma basis_eq_single (v : HeightOneSpectrum (𝓞 K)) + {j : Module.Free.ChooseBasisIndex K B} {x : adicCompletion K v} : + x • (b_local K B v) j + = (ContinuousLinearEquiv.chooseBasis_piScalarRight' + K (v.adicCompletion K) B).symm (Pi.single j x) := by + rw [ContinuousLinearEquiv.eq_symm_apply]; + ext b; + conv_lhs => + simp only [Module.Basis.baseChange_apply, Algebra.smul_def, + Algebra.TensorProduct.algebraMap_apply, Algebra.algebraMap_self, RingHom.id_apply, + Algebra.TensorProduct.tmul_mul_tmul, mul_one, one_mul] + change ((Module.Free.chooseBasis K B).repr ((Module.Free.chooseBasis K B) j)) b • x + simp [Finsupp.single, Pi.single, Algebra.smul_def, Function.update] + +lemma basis_eq (v : HeightOneSpectrum (𝓞 K)) + {w : Module.Free.ChooseBasisIndex K B → adicCompletion K v} : + ∑ (j : Module.Free.ChooseBasisIndex K B), (w j) • (b_local K B v) j + = (ContinuousLinearEquiv.chooseBasis_piScalarRight' + K (v.adicCompletion K) B).toContinuousAddEquiv.symm w := by + have hw : w = ∑ x, (Pi.single x (w x)) := by + ext; simp + conv_rhs => rw [hw] + simp only [basis_eq_single K B v, map_sum]; rfl + +end auxiliary_basis_lemmas + +-- this should really be just after the definition of `localcomponent` +/-- `TensorProduct.localcomponent φ` as `v.adicCompletion K`-linear map -/ +noncomputable def φ_local_Kv_linear (v : HeightOneSpectrum (𝓞 K)) + (φ : FiniteAdeleRing (𝓞 K) K ⊗[K] B ≃L[FiniteAdeleRing (𝓞 K) K] + FiniteAdeleRing (𝓞 K) K ⊗[K] B) : + v.adicCompletion K ⊗[K] B →ₗ[v.adicCompletion K] v.adicCompletion K ⊗[K] B := { + __ := (FiniteAdeleRing.TensorProduct.localcomponentEquiv (𝓞 K) K B v φ) + map_smul' kv x := by + -- rewrite so topology-free + change AlgHom.rTensor B (FiniteAdeleRing.evalAlgebraMap (𝓞 K) K v) + (φ (LinearMap.rTensor B (FiniteAdeleRing.singleLinearMap (𝓞 K) K v) (kv • x))) = + kv • (AlgHom.rTensor B (FiniteAdeleRing.evalAlgebraMap (𝓞 K) K v) + (φ (LinearMap.rTensor B (FiniteAdeleRing.singleLinearMap (𝓞 K) K v) x))) + induction x with + | zero => simp only [AlgHom.toRingHom_eq_coe, smul_zero, map_zero] + | tmul x y => + -- need to slowly move the `kv •` out on the LHS + rw [LinearMap.rTensor_tmul, TensorProduct.smul_tmul', + LinearMap.rTensor_tmul, smul_eq_mul] + -- 1/3 of the way there + -- we needed `single` to be linear, but now we need it to be a MulHom + conv => + enter [1, 2, 2, 2] + change FiniteAdeleRing.singleMulHom _ _ _ _ + rw [map_mul, ← smul_eq_mul] + -- 2/3 of the way there + rw [← TensorProduct.smul_tmul', map_smul, AlgHom.rTensor_map_smul] + -- out, but now in the form (single (eval kv) •) + congr + -- but we know this is kv + exact FiniteAdeleRing.evalContinuousAlgebraMap_singleContinuousLinearMap (𝓞 K) K v kv + | add x y _ _ => simp_all only [AlgHom.toRingHom_eq_coe, smul_add, map_add] +} + +lemma localcomponent_matrix (v : HeightOneSpectrum (𝓞 K)) + (φ : FiniteAdeleRing (𝓞 K) K ⊗[K] B ≃L[FiniteAdeleRing (𝓞 K) K] + FiniteAdeleRing (𝓞 K) K ⊗[K] B) + (i j : Module.Free.ChooseBasisIndex K B) : + letI b₀ := Module.Free.chooseBasis K B + letI b := Module.Basis.baseChange (FiniteAdeleRing (𝓞 K) K) b₀ + letI b_local := Module.Basis.baseChange (v.adicCompletion K) b₀ + (LinearMap.toMatrix b_local b_local) (φ_local_Kv_linear K B v φ) i j = + (LinearMap.toMatrix b b φ.toLinearMap i j) v := by + letI b₀ := Module.Free.chooseBasis K B + letI b := Module.Basis.baseChange (FiniteAdeleRing (𝓞 K) K) b₀ + letI b_local := Module.Basis.baseChange (v.adicCompletion K) b₀ + change (LinearMap.toMatrix b_local b_local) (φ_local_Kv_linear K B v φ) i j = + RingHom.mapMatrix + (evalRingHom (fun (p : HeightOneSpectrum (𝓞 K)) ↦ p.adicCompletion K) v) + (LinearMap.toMatrix b b φ.toLinearMap) i j + -- get rid of i,j + apply congr_fun + apply congr_fun + -- move LinearMap.toMatrix onto the other side of the equation + rw [RingHom.mapMatrix_apply (evalRingHom (fun p ↦ adicCompletion K p) v) + ((LinearMap.toMatrix b b) ↑φ.toLinearEquiv)] + apply_fun (Matrix.toLin b_local b_local) using (Matrix.toLin b_local b_local).injective + rw [Matrix.toLin_toMatrix] + -- This is now an equality of linear maps Kᵥ ⊗[K] B → Kᵥ ⊗[K] B + ext r -- r ∈ B + -- now get rid of `φ_local_Kv_linear` + change AlgHom.rTensor B (FiniteAdeleRing.evalAlgebraMap (𝓞 K) K v) + (φ (LinearMap.rTensor B (FiniteAdeleRing.singleLinearMap (𝓞 K) K v) (1 ⊗ₜ r))) = + ((Matrix.toLin b_local b_local) + (((LinearMap.toMatrix b b) ↑φ.toLinearEquiv).map ⇑(evalRingHom (fun p ↦ adicCompletion K p) v))) + (1 ⊗ₜ[K] r) + rw [LinearMap.rTensor_tmul] + conv => + enter [1, 2, 2, 2] + rw [← mul_one ((FiniteAdeleRing.singleLinearMap (𝓞 K) K v) 1)] + rw [← smul_eq_mul, ← TensorProduct.smul_tmul', map_smul, AlgHom.rTensor_map_smul] + rw [FiniteAdeleRing.evalAlgebraMap_singleLinearMap, one_smul] + /- + + localcomponent stuff and `single` (an annoying linear map) now gone. + + goal is + + ⊢ (AlgHom.rTensor B (FiniteAdeleRing.evalAlgebraMap (𝓞 K) K v)) (φ (1 ⊗ₜ[K] r)) = + ((Matrix.toLin b_local b_local) + (((LinearMap.toMatrix b b) ↑φ.toLinearEquiv).map + ⇑(evalRingHom (fun p ↦ adicCompletion K p) v))) + (1 ⊗ₜ[K] r) + + Breakdown of goal: we have φ an 𝔸_K^f-linear endomorphism of 𝔸_K^f ⊗ B, and we have r ∈ B. + + LHS is (evalᵥ ⊗ id_B : 𝔸_K^f ⊗ B → Kᵥ ⊗ B) evaluated at φ (1_𝔸 ⊗ₜ r) (a random tensor and + not a pure tensor in general) + + RHS is: take φ as a linear map, make its matrix wrt basis b, apply evalᵥ, + turn it back into a linear map wrt b_local (which is (evalᵥ ⊗ id_B) b, although we don't have + a proof of this) and then evaluate at (1ᵥ ⊗ₜ[K] r) (which is (evalᵥ ⊗ id_B) (1_𝔸 ⊗ₜ r) + + so there should be some general statement here from which this follows? + + I'm not entirely sure of the best way to say that b_local is evalᵥ ⊗ id_B of b + + Could just break everything up into sums? Tried this and got confused. + -/ + sorry + +-- A (continuous) 𝔸_K^f-linear automorphism of 𝔸_K^f ⊗ B is ""integral"" at all but +-- finitely many places +lemma FiniteAdeleRing.Aux.almost_always_mapsTo + (φ : FiniteAdeleRing (𝓞 K) K ⊗[K] B ≃L[FiniteAdeleRing (𝓞 K) K] + FiniteAdeleRing (𝓞 K) K ⊗[K] B) : + letI ι := Module.Free.ChooseBasisIndex K B + ∀ᶠ (i : HeightOneSpectrum (𝓞 K)) in Filter.cofinite, + Set.MapsTo ⇑((fun v ↦ e K B v + (FiniteAdeleRing.TensorProduct.localcomponentEquiv (𝓞 K) K B v φ)) i) + ↑(AddSubgroup.pi (Set.univ : Set ι) fun _ ↦ (adicCompletionIntegers K i).toAddSubgroup) + ↑(AddSubgroup.pi (Set.univ : Set ι) fun _ ↦ (adicCompletionIntegers K i).toAddSubgroup) := by + let b₀ := Module.Free.chooseBasis K B + let b := Module.Basis.baseChange (FiniteAdeleRing (𝓞 K) K) b₀ + let m := LinearMap.toMatrix b b φ.toLinearMap + have := fun i j ↦ (m i j).2 + simp_rw [← Filter.eventually_all] at this + filter_upwards [this] + intro v hv w (hw : w ∈ Set.pi _ _) j _ + rw [Set.mem_univ_pi] at hw + -- hopefully true :-) + -- Idea: φ is represented by a matrix M, and the claim is that for a finite place v + -- at which the matrix is v-integral, the local component of φ + -- should preserve integrality. + let b_local := Module.Basis.baseChange (v.adicCompletion K) b₀ + -- `b_local` is `v.adicCompletion K`-basis for `v.adicCompletion K ⊗[K] B` + have basis_repr_eq' {x : adicCompletion K v ⊗[K] B} : + b_local.repr x + = (ContinuousLinearEquiv.chooseBasis_piScalarRight' K (v.adicCompletion K) B) x := + basis_repr_eq K B v + have local_repr_eq (i j : Module.Free.ChooseBasisIndex K B) : + ((b_local.repr (φ_local_Kv_linear K B v φ (b_local j))) i) = (m i j) v := by + rw [← LinearMap.toMatrix_apply, localcomponent_matrix] + -- simp [e, ← basis_eq K B v] + simp only [e, ← basis_eq K B v, Subsemiring.coe_carrier_toSubmonoid, Subring.coe_toSubsemiring, + ContinuousAddEquiv.trans_apply, map_sum, Finset.sum_apply, SetLike.mem_coe, + ValuationSubring.mem_toSubring] --argh! + change ∑ c, + (ContinuousLinearEquiv.chooseBasis_piScalarRight' K (adicCompletion K v) B) + (φ_local_Kv_linear K B v φ (w c • b_local c)) j + ∈ adicCompletionIntegers K v + simpa [← basis_repr_eq', local_repr_eq] using sum_mem fun i hi ↦ mul_mem (hw i) (hv j i) + -- A (continuous) 𝔸_K^f-linear automorphism of 𝔸_K^f ⊗ B is ""integral"" at all but -- finitely many places -lemma FiniteAdeleRing.Aux.almost_always_integral +lemma FiniteAdeleRing.Aux.almost_always_bijOn (φ : FiniteAdeleRing (𝓞 K) K ⊗[K] B ≃L[FiniteAdeleRing (𝓞 K) K] FiniteAdeleRing (𝓞 K) K ⊗[K] B) : - let ι := Module.Free.ChooseBasisIndex K B + letI ι := Module.Free.ChooseBasisIndex K B ∀ᶠ (i : HeightOneSpectrum (𝓞 K)) in Filter.cofinite, Set.BijOn ⇑((fun v ↦ e K B v (FiniteAdeleRing.TensorProduct.localcomponentEquiv (𝓞 K) K B v φ)) i) - ↑(AddSubgroup.pi (Set.univ : Set ι) fun x ↦ (adicCompletionIntegers K i).toAddSubgroup) - ↑(AddSubgroup.pi (Set.univ : Set ι) fun x ↦ (adicCompletionIntegers K i).toAddSubgroup) := - sorry -- this needs some thought + ↑(AddSubgroup.pi (Set.univ : Set ι) fun _ ↦ (adicCompletionIntegers K i).toAddSubgroup) + ↑(AddSubgroup.pi (Set.univ : Set ι) fun _ ↦ (adicCompletionIntegers K i).toAddSubgroup) := by + have h1 := FiniteAdeleRing.Aux.almost_always_mapsTo K B φ + have h2 := FiniteAdeleRing.Aux.almost_always_mapsTo K B φ.symm + filter_upwards [h1, h2] + intro v h1 h2 + exact (e K B v (FiniteAdeleRing.TensorProduct.localcomponentEquiv (𝓞 K) K B v φ)).bijOn' h1 h2 /-- A diagram which obviously commutes, commutes. -/ lemma FiniteAdeleRing.Aux.f_g_local_global (φ : ((FiniteAdeleRing (𝓞 K) K) ⊗[K] B) ≃L[FiniteAdeleRing (𝓞 K) K] (FiniteAdeleRing (𝓞 K) K) ⊗[K] B) : g K (f K B φ) = ContinuousAddEquiv.restrictedProductCongrRight (fun v ↦ e _ _ _ (FiniteAdeleRing.TensorProduct.localcomponentEquiv (𝓞 K) K B v φ)) - (FiniteAdeleRing.Aux.almost_always_integral _ _ _) := by + (FiniteAdeleRing.Aux.almost_always_bijOn _ _ _) := by + ext r v i; + simp [ContinuousAddEquiv.restrictedProductCongrRight] + simp [e,f,g, FiniteAdeleRing.TensorProduct.localcomponentEquiv, + FiniteAdeleRing.TensorProduct.localcomponent] sorry -- this is hopefully close to being true by ext but I didn't think about it. lemma localcomponent_mulLeft (u : ((FiniteAdeleRing (𝓞 K) K) ⊗[K] B)ˣ) diff --git a/FLT/Mathlib/LinearAlgebra/TensorProduct/Algebra.lean b/FLT/Mathlib/LinearAlgebra/TensorProduct/Algebra.lean --- a/FLT/Mathlib/LinearAlgebra/TensorProduct/Algebra.lean +++ b/FLT/Mathlib/LinearAlgebra/TensorProduct/Algebra.lean @@ -1,7 +1,7 @@ import Mathlib.LinearAlgebra.TensorProduct.Basic import Mathlib.Algebra.Algebra.Hom -open TensorProduct in +open TensorProduct /-- The base extension of an R-algebra homomorphism `f : N → P` to an `f`-semilinear map `N ⊗[R] M → P ⊗[R] M`. @@ -24,3 +24,9 @@ def AlgHom.rTensor {R : Type*} [CommSemiring R] (M : Type*) {N : Type*} rfl | add x y _ _ => simp_all } + +lemma AlgHom.rTensor_map_smul {R : Type*} [CommSemiring R] (M : Type*) {N : Type*} + {P : Type*} [AddCommMonoid M] [Semiring N] [Semiring P] [Module R M] + [Algebra R N] [Algebra R P] (f : N →ₐ[R] P) (n : N) (nm : N ⊗[R] M) : + AlgHom.rTensor M f (n • nm) = f n • AlgHom.rTensor M f nm := + MulActionHom.map_smul' (AlgHom.rTensor M f).toMulActionHom n nm diff --git a/FLT/Mathlib/RingTheory/DedekindDomain/FiniteAdeleRing.lean b/FLT/Mathlib/RingTheory/DedekindDomain/FiniteAdeleRing.lean --- a/FLT/Mathlib/RingTheory/DedekindDomain/FiniteAdeleRing.lean +++ b/FLT/Mathlib/RingTheory/DedekindDomain/FiniteAdeleRing.lean @@ -31,18 +31,61 @@ lemma mk_apply (f : ∀ v, HeightOneSpectrum.adicCompletion K v) variable (R K) /-- -The continuous K-algebra map `𝔸_K^f → Kᵥ` from the finite adele ring of K to a completion. +The K-algebra map `𝔸_K^f → Kᵥ` from the finite adele ring of K to a completion. -/ -def evalContinuousAlgebraMap (j : HeightOneSpectrum R) : - FiniteAdeleRing R K →A[K] j.adicCompletion K := { +def evalAlgebraMap (j : HeightOneSpectrum R) : + FiniteAdeleRing R K →ₐ[K] j.adicCompletion K := { __ := RestrictedProduct.evalContinuousAddMonoidHom _ j map_one' := rfl map_mul' _ _ := rfl commutes' _ := rfl + } + +/-- +The continuous K-algebra map `𝔸_K^f → Kᵥ` from the finite adele ring of K to a completion. +-/ +def evalContinuousAlgebraMap (j : HeightOneSpectrum R) : + FiniteAdeleRing R K →A[K] j.adicCompletion K := { + __ := RestrictedProduct.evalContinuousAddMonoidHom _ j + __ := IsDedekindDomain.FiniteAdeleRing.evalAlgebraMap R K j cont := RestrictedProduct.continuous_eval j -- this should be automatic -- why is this -- field not called continuous_toFun?? } +variable [DecidableEq (HeightOneSpectrum R)] in +/-- +The continuous K-linear inclusion Kᵥ → 𝔸_K^f from a completion to the finite K-adeles. +-/ +noncomputable def singleLinearMap (j : HeightOneSpectrum R) : + j.adicCompletion K →ₗ[K] FiniteAdeleRing R K := { + __ := RestrictedProduct.singleContinuousAddMonoidHom _ j + map_smul' k x := by + open RestrictedProduct in + ext i + change Pi.single j (k • x) i = _ + obtain rfl | h := eq_or_ne i j + · simp [Pi.single_eq_same, -mul_eq_mul_right_iff, FiniteAdeleRing, Algebra.smul_def, + singleContinuousAddMonoidHom_apply_same] + rfl -- (annoying) + · simp [Pi.single_eq_of_ne h, FiniteAdeleRing, Algebra.smul_def, + singleContinuousAddMonoidHom_apply_of_ne _ h _] + } + +variable [DecidableEq (HeightOneSpectrum R)] in +/-- +The continuous K-linear inclusion Kᵥ → 𝔸_K^f from a completion to the finite K-adeles. +-/ +noncomputable def singleMulHom (j : HeightOneSpectrum R) : + j.adicCompletion K →ₙ* FiniteAdeleRing R K := { + __ := RestrictedProduct.singleContinuousAddMonoidHom _ j + map_mul' a b := by + ext v + change Pi.single j (a * b) v = Pi.single j a v * Pi.single j b v + obtain rfl | h := eq_or_ne j v + · simp + · simp [Pi.single_eq_of_ne' h] + } + variable [DecidableEq (HeightOneSpectrum R)] in /-- The continuous K-linear inclusion Kᵥ → 𝔸_K^f from a completion to the finite K-adeles. @@ -68,6 +111,12 @@ lemma evalContinuousAlgebraMap_singleContinuousLinearMap (j : HeightOneSpectrum (evalContinuousAlgebraMap R K j) (singleContinuousLinearMap R K j xj) = xj := Pi.single_eq_same j xj +variable [DecidableEq (HeightOneSpectrum R)] in +lemma evalAlgebraMap_singleLinearMap (j : HeightOneSpectrum R) + (xj : j.adicCompletion K) : + (evalAlgebraMap R K j) (singleLinearMap R K j xj) = xj := + Pi.single_eq_same j xj + variable [DecidableEq (HeightOneSpectrum R)] in /-- `localIdempotent R K p` is the finite adele which is 1 at p and 0 elsewhere.",257,10,267,7.5,diff_derived,False,14,3,0,8,2,pr_merge,False,leanprover/lean4:v4.29.0,leanbench/lean4-env:4.29.0,lake build,600,lean_compiler,algebra,2026-04-28T12:40:01Z,extraction_pipeline_v2 LB-0013,pr_completion,easy,1.0,ImperialCollegeLondon/FLT,834,feat(HaarChar/FiniteAdeleRing): Fill in two sorries,https://github.com/ImperialCollegeLondon/FLT/pull/834,,52dd0fdbe9ccb9b3a874773c3bc44c8b946e3d46,20c7c4548a6a67fdcfb585a83a46b273f45843ca,FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean,FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean,"# Task: feat(HaarChar/FiniteAdeleRing): Fill in two sorries ## Context This PR fills in two sorres in `HaarChar/FiniteAdeleRing`. ## Files affected - FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean (+34/-6) ## Verification The patched repository must compile with `lake build`.","diff --git a/FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean b/FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean --- a/FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean +++ b/FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean @@ -259,9 +259,23 @@ lemma localcomponent_mulLeft (u : ((FiniteAdeleRing (𝓞 K) K) ⊗[K] B)ˣ) (ContinuousAddEquiv.mulLeft (u.map (Algebra.TensorProduct.rTensor B (IsDedekindDomain.FiniteAdeleRing.evalContinuousAlgebraMap (𝓞 K) K v).toAlgHom).toMonoidHom)) := by - ext u - -- should hopefully follow from localcomponent_eval - sorry + ext u' + have keyFin := FiniteAdeleRing.TensorProduct.localcomponent_apply (𝓞 K) K B + (ContinuousLinearEquiv.mulLeft (FiniteAdeleRing (𝓞 K) K) u) + (TensorProduct.map (FiniteAdeleRing.singleContinuousLinearMap (𝓞 K) K v) .id u') v + have : (FiniteAdeleRing.evalContinuousAlgebraMap (𝓞 K) K v).toContinuousLinearMap.toLinearMap ∘ₗ + FiniteAdeleRing.singleContinuousLinearMap (𝓞 K) K v = .id := by + ext + simp [FiniteAdeleRing.evalContinuousAlgebraMap_singleContinuousLinearMap] + have : u' = + (FiniteAdeleRing.evalContinuousAlgebraMap (𝓞 K) K v).toContinuousLinearMap.rTensor B + ((TensorProduct.map (FiniteAdeleRing.singleContinuousLinearMap (𝓞 K) K v) .id) u') := by + rw [ContinuousLinearMap.rTensor, ContinuousLinearMap.coe_mk', LinearMap.rTensor_map, this, + TensorProduct.map_id, LinearMap.id_apply] + convert keyFin.symm + change _ = Algebra.TensorProduct.rTensor B _ _ + simp [ContinuousLinearEquiv.mulLeft, LinearEquiv.mulLeft, map_mul] + congr lemma localcomponent_mulRight (u : ((FiniteAdeleRing (𝓞 K) K) ⊗[K] B)ˣ) (v : HeightOneSpectrum (𝓞 K)) : @@ -270,9 +284,23 @@ lemma localcomponent_mulRight (u : ((FiniteAdeleRing (𝓞 K) K) ⊗[K] B)ˣ) (ContinuousAddEquiv.mulRight (u.map (Algebra.TensorProduct.rTensor B (IsDedekindDomain.FiniteAdeleRing.evalContinuousAlgebraMap (𝓞 K) K v).toAlgHom).toMonoidHom)) := by - ext u - -- should hopefully follow from localcomponent_eval - sorry + ext u' + have keyFin := FiniteAdeleRing.TensorProduct.localcomponent_apply (𝓞 K) K B + (ContinuousLinearEquiv.mulRight (FiniteAdeleRing (𝓞 K) K) u) + (TensorProduct.map (FiniteAdeleRing.singleContinuousLinearMap (𝓞 K) K v) .id u') v + have : (FiniteAdeleRing.evalContinuousAlgebraMap (𝓞 K) K v).toContinuousLinearMap.toLinearMap ∘ₗ + FiniteAdeleRing.singleContinuousLinearMap (𝓞 K) K v = .id := by + ext + simp [FiniteAdeleRing.evalContinuousAlgebraMap_singleContinuousLinearMap] + have : u' = + (FiniteAdeleRing.evalContinuousAlgebraMap (𝓞 K) K v).toContinuousLinearMap.rTensor B + ((TensorProduct.map (FiniteAdeleRing.singleContinuousLinearMap (𝓞 K) K v) .id) u') := by + rw [ContinuousLinearMap.rTensor, ContinuousLinearMap.coe_mk', LinearMap.rTensor_map, this, + TensorProduct.map_id, LinearMap.id_apply] + convert keyFin.symm + change _ = Algebra.TensorProduct.rTensor B _ _ + simp [ContinuousLinearEquiv.mulRight, LinearEquiv.mulRight, map_mul] + congr /-- left multiplication and right multiplication by a unit have the same Haar character on `𝔸_K^f ⊗ B`. See also",34,6,40,6.0,diff_derived,False,58,1,0,0,0,pr_merge,False,leanprover/lean4:v4.29.0,leanbench/lean4-env:4.29.0,lake build,600,lean_compiler,algebra,2026-04-28T12:40:02Z,extraction_pipeline_v2 LB-0014,pr_completion,easy,1.98,ImperialCollegeLondon/FLT,835,"localcomponent_id, localcomponent_comp, IsCompact (v.adicCompletionIntegers K)",https://github.com/ImperialCollegeLondon/FLT/pull/835,,52dd0fdbe9ccb9b3a874773c3bc44c8b946e3d46,ba672bce4061ac4782b7d959d87020de5d59e60d,"FLT/DedekindDomain/FiniteAdeleRing/TensorProduct.lean,FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean,FLT/NumberField/Completion/Finite.lean",FLT/DedekindDomain/FiniteAdeleRing/TensorProduct.lean,"# Task: localcomponent_id, localcomponent_comp, IsCompact (v.adicCompletionIntegers K) ## Context The first 3 tasks in [#FLT > Outstanding tasks, V10](https://leanprover.zulipchat.com/#narrow/channel/416277-FLT/topic/Outstanding.20tasks.2C.20V10) ## Files affected - FLT/DedekindDomain/FiniteAdeleRing/TensorProduct.lean (+27/-2) - FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean (+5/-5) - FLT/NumberField/Completion/Finite.lean (+5/-0) ## Supporting lemmas - `NumberField.isCompactAdicCompletionIntegers` in `FLT/NumberField/Completion/Finite.lean` ```lean lemma NumberField.isCompactAdicCompletionIntegers : ``` ## Verification The patched repository must compile with `lake build`.","diff --git a/FLT/DedekindDomain/FiniteAdeleRing/TensorProduct.lean b/FLT/DedekindDomain/FiniteAdeleRing/TensorProduct.lean --- a/FLT/DedekindDomain/FiniteAdeleRing/TensorProduct.lean +++ b/FLT/DedekindDomain/FiniteAdeleRing/TensorProduct.lean @@ -55,15 +55,40 @@ noncomputable def TensorProduct.localcomponent (p : HeightOneSpectrum R) lemma TensorProduct.localcomponent_id_apply (p : HeightOneSpectrum R) (x : p.adicCompletion K ⊗[K] V) : TensorProduct.localcomponent R K V p (ContinuousLinearMap.id _ _) x = x := by - sorry + have : + (evalContinuousAlgebraMap R K p).toContinuousLinearMap + ∘ₗ (singleContinuousLinearMap R K p).toLinearMap + = LinearMap.id := by + ext; + apply evalContinuousAlgebraMap_singleContinuousLinearMap + simp [localcomponent, ContinuousLinearMap.rTensor, ← LinearMap.rTensor_comp_apply, this] lemma TensorProduct.localcomponent_comp_apply (p : HeightOneSpectrum R) (φ ψ : FiniteAdeleRing R K ⊗[K] V →L[FiniteAdeleRing R K] FiniteAdeleRing R K ⊗[K] V) (x : p.adicCompletion K ⊗[K] V) : TensorProduct.localcomponent R K V p (φ.comp ψ) x = (TensorProduct.localcomponent R K V p φ) ((TensorProduct.localcomponent R K V p ψ) x) := by - sorry + have rTensor_single_comp_eval {x : FiniteAdeleRing R K ⊗[K] V} : + LinearMap.rTensor V ((singleContinuousLinearMap R K p).toLinearMap + ∘ₗ (evalContinuousAlgebraMap R K p).toContinuousLinearMap) x + = (localIdempotent R K p) • x := + have {a : FiniteAdeleRing R K} := congr_arg (fun f ↦ f a) + (singleContinuousAlgebraMap_comp_evalContinuousLinearMap R K p) + TensorProduct.induction_on x (by simp) + (fun _ _ ↦ by simp_all [TensorProduct.smul_tmul']) + (fun _ _ ↦ by simp +contextual) + have rTensor_eval_localIdempotent (x : FiniteAdeleRing R K ⊗[K] V) : + (LinearMap.rTensor V (evalContinuousAlgebraMap R K p).toContinuousLinearMap) x + = (LinearMap.rTensor V (evalContinuousAlgebraMap R K p).toContinuousLinearMap.toLinearMap) + (localIdempotent R K p • x) := + TensorProduct.induction_on x (by simp) + (fun _ _ ↦ by simp_all [TensorProduct.smul_tmul', eval_localIdempotent]) + (fun _ _ ↦ by simp +contextual) + simp [localcomponent, ContinuousLinearMap.rTensor, + ← LinearMap.rTensor_comp_apply, rTensor_single_comp_eval, + rTensor_eval_localIdempotent + (φ (ψ ((LinearMap.rTensor V (singleContinuousLinearMap R K p)) x)))] /-- If `φ : 𝔸_K^f ⊗ V → 𝔸_K^f ⊗ V` is `𝔸_K^f`-linear and `φₚ` is its local component at a place `p` diff --git a/FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean b/FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean --- a/FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean +++ b/FLT/HaarMeasure/HaarChar/FiniteAdeleRing.lean @@ -104,24 +104,24 @@ local instance : local instance (v : HeightOneSpectrum (𝓞 K)) : CompactSpace (AddSubgroup.pi (Set.univ : Set (Module.Free.ChooseBasisIndex K B)) - fun x ↦ (adicCompletionIntegers K v).toAddSubgroup) := by + fun _ ↦ (adicCompletionIntegers K v).toAddSubgroup) := by change CompactSpace (Set.pi Set.univ fun x ↦ _) rw [← isCompact_iff_compactSpace] refine isCompact_univ_pi (fun i ↦ ?_) change IsCompact (v.adicCompletionIntegers K : Set (v.adicCompletion K)) - sorry -- ""integers are compact"" + exact isCompactAdicCompletionIntegers K v variable {ι : Type*} [Fintype ι] in local instance : LocallyCompactSpace Πʳ (v : HeightOneSpectrum (𝓞 K)), [ι → adicCompletion K v, - (↑(AddSubgroup.pi (Set.univ : Set ι) fun x ↦ (adicCompletionIntegers K v).toAddSubgroup) : + (↑(AddSubgroup.pi (Set.univ : Set ι) fun _ ↦ (adicCompletionIntegers K v).toAddSubgroup) : Set ((ι → adicCompletion K v)))] := by refine RestrictedProduct.locallyCompactSpace_of_addGroup _ ?_ filter_upwards intro v refine isCompact_univ_pi (fun i ↦ ?_) change IsCompact (v.adicCompletionIntegers K : Set (v.adicCompletion K)) - sorry -- ""integers are compact"" + exact isCompactAdicCompletionIntegers K v local instance : LocallyCompactSpace Πʳ (v : HeightOneSpectrum (𝓞 K)), [adicCompletion K v, @@ -130,7 +130,7 @@ local instance : LocallyCompactSpace filter_upwards intro v change IsCompact (v.adicCompletionIntegers K : Set (v.adicCompletion K)) - sorry -- ""integers are compact"" + exact isCompactAdicCompletionIntegers K v local instance : SecondCountableTopology Πʳ (v : HeightOneSpectrum (𝓞 K)), [v.adicCompletion K, v.adicCompletionIntegers K] := inferInstanceAs <| diff --git a/FLT/NumberField/Completion/Finite.lean b/FLT/NumberField/Completion/Finite.lean --- a/FLT/NumberField/Completion/Finite.lean +++ b/FLT/NumberField/Completion/Finite.lean @@ -45,6 +45,11 @@ instance NumberField.instCompactSpaceAdicCompletionIntegers : CompactSpace (v.adicCompletionIntegers K) := Valued.WithZeroMulInt.integer_compactSpace (v.adicCompletion K) inferInstance +lemma NumberField.isCompactAdicCompletionIntegers : + IsCompact (v.adicCompletionIntegers K : Set (v.adicCompletion K)) := by + rw [isCompact_iff_compactSpace] + exact instCompactSpaceAdicCompletionIntegers K v + lemma NumberField.isOpenAdicCompletionIntegers : IsOpen (v.adicCompletionIntegers K : Set (v.adicCompletion K)) := Valued.isOpen_valuationSubring _",37,7,44,7.5,diff_derived,False,148,3,0,1,0,pr_merge,False,leanprover/lean4:v4.29.0,leanbench/lean4-env:4.29.0,lake build,600,lean_compiler,algebra,2026-04-28T12:40:02Z,extraction_pipeline_v2 LB-0015,pr_completion,easy,1.88,ImperialCollegeLondon/FLT,833,feat: state id and comp for localcomponent,https://github.com/ImperialCollegeLondon/FLT/pull/833,,5c2aa9fd9120d195a0fb0178fe221ac0bab617cd,52dd0fdbe9ccb9b3a874773c3bc44c8b946e3d46,FLT/DedekindDomain/FiniteAdeleRing/TensorProduct.lean,FLT/DedekindDomain/FiniteAdeleRing/TensorProduct.lean,"# Task: feat: state id and comp for localcomponent ## Files affected - FLT/DedekindDomain/FiniteAdeleRing/TensorProduct.lean (+21/-13) ## Supporting lemmas - `TensorProduct.localcomponent_id_apply` in `FLT/DedekindDomain/FiniteAdeleRing/TensorProduct.lean` ```lean lemma TensorProduct.localcomponent_id_apply (p : HeightOneSpectrum R) ``` - `TensorProduct.localcomponent_comp_apply` in `FLT/DedekindDomain/FiniteAdeleRing/TensorProduct.lean` ```lean lemma TensorProduct.localcomponent_comp_apply (p : HeightOneSpectrum R) ``` ## Verification The patched repository must compile with `lake build`.","diff --git a/FLT/DedekindDomain/FiniteAdeleRing/TensorProduct.lean b/FLT/DedekindDomain/FiniteAdeleRing/TensorProduct.lean --- a/FLT/DedekindDomain/FiniteAdeleRing/TensorProduct.lean +++ b/FLT/DedekindDomain/FiniteAdeleRing/TensorProduct.lean @@ -52,6 +52,19 @@ noncomputable def TensorProduct.localcomponent (p : HeightOneSpectrum R) -- f1 ∘ f2 ∘ f3 f1.comp (f2.comp f3) +lemma TensorProduct.localcomponent_id_apply (p : HeightOneSpectrum R) + (x : p.adicCompletion K ⊗[K] V) : + TensorProduct.localcomponent R K V p (ContinuousLinearMap.id _ _) x = x := by + sorry + +lemma TensorProduct.localcomponent_comp_apply (p : HeightOneSpectrum R) + (φ ψ : FiniteAdeleRing R K ⊗[K] V →L[FiniteAdeleRing R K] + FiniteAdeleRing R K ⊗[K] V) (x : p.adicCompletion K ⊗[K] V) : + TensorProduct.localcomponent R K V p (φ.comp ψ) x = + (TensorProduct.localcomponent R K V p φ) + ((TensorProduct.localcomponent R K V p ψ) x) := by + sorry + /-- If `φ : 𝔸_K^f ⊗ V → 𝔸_K^f ⊗ V` is `𝔸_K^f`-linear and `φₚ` is its local component at a place `p` then for all `x : 𝔸_K^f ⊗ V` we have @@ -94,19 +107,14 @@ noncomputable def TensorProduct.localcomponentEquiv (p : HeightOneSpectrum R) p.adicCompletion K ⊗[K] V ≃L[K] p.adicCompletion K ⊗[K] V where __ := TensorProduct.localcomponent R K V p φ invFun := TensorProduct.localcomponent R K V p φ.symm - left_inv := sorry -- these follow formally from - -- localcomponent_id and localcomponent_comp and it's probably better to prove - -- localcomponent_comp rather thn running at these, because then you'll only have - -- to get to the heart of the matter once (in comp). The proof of comp: ocalcomponent φ is - -- defined as eval ∘ φ ∘ single, so one needs to check eval ∘ φ ∘ single ∘ eval ∘ ψ ∘ single = - -- eval ∘ φ ∘ ψ ∘ single and the proof is: cancel the single on the right, then - -- use that the middle single ∘ eval is multiplication by - -- the local idempotent e_v at v (this - -- is `singleContinuousAlgebraMap_comp_evalContinuousLinearMap`) - -- and then that φ is 𝔸_K^f-linear, which - -- reduces the question to evalᵥ ∘ (multiply by e_v) = eval which is true - -- and easy by ext. - right_inv := sorry + left_inv x := by + change (localcomponent R K V p φ.symm) (localcomponent R K V p φ x) = x + rw [← TensorProduct.localcomponent_comp_apply] + simp [TensorProduct.localcomponent_id_apply] + right_inv x := by + change (localcomponent R K V p φ) (localcomponent R K V p φ.symm x) = x + rw [← TensorProduct.localcomponent_comp_apply] + simp [TensorProduct.localcomponent_id_apply] end FiniteAdeleRing ",21,13,34,7.5,diff_derived,False,0,1,0,2,0,pr_merge,False,leanprover/lean4:v4.29.0,leanbench/lean4-env:4.29.0,lake build,600,lean_compiler,algebra,2026-04-28T12:40:02Z,extraction_pipeline_v2 LB-0016,pr_completion,hard,7.2,ImperialCollegeLondon/FLT,823,isCentralSimple_addHaarScalarFactor_left_mul_eq_right_mul,https://github.com/ImperialCollegeLondon/FLT/pull/823,awaiting-review,0b0f52f7516a7baab568686949b3ce3f952e444a,3c9d5604540b3b9f50857802d85ea6230103e764,"FLT.lean,FLT/DivisionAlgebra/Finiteness.lean,FLT/HaarMeasure/HaarChar/AdeleRing.lean,FLT/Mathlib/Algebra/Central/TensorProduct.lean,FLT/Mathlib/LinearAlgebra/Determinant.lean,FLT/NumberField/Completion/Finite.lean",FLT.lean,"# Task: isCentralSimple_addHaarScalarFactor_left_mul_eq_right_mul ## Context Current progress: reduce to the finite adeles, i.e. instead of `isCentralSimple_addHaarScalarFactor_left_mul_eq_right_mul`, we now have `isCentralSimple_finite_addHaarScalarFactor_left_mul_eq_right_mul` in the same place, with `AdeleRing` replaced by `FiniteAdeleRing`. The reduction is carried out within `FLT/DivisionAlgebra/Finiteness.lean` (to make use of the API there), i.e. the main result `isCentralSimple_addHaarScalarFactor_left_mul_eq_right_mul` is moved one file down the import hierarchy. We also add some results about centrality of algebras which are needed to apply the local result `IsSimpleRing.ringHaarChar_eq_addEquivAddHaarChar_mulRight` (which currently only applies to algebras which are central over the respective local fields). ## Files affected - FLT.lean (+1/-0) - FLT/DivisionAlgebra/Finiteness.lean (+250/-1) - FLT/HaarMeasure/HaarChar/AdeleRing.lean (+26/-4) - FLT/Mathlib/Algebra/Central/TensorProduct.lean (+93/-0) - FLT/Mathlib/LinearAlgebra/Determinant.lean (+5/-0) - FLT/NumberField/Completion/Finite.lean (+11/-0) ## Definitions to add - `real_to_completion` in `FLT/DivisionAlgebra/Finiteness.lean`: The canonical `ℝ`-algebra structure on `InfinitePlace.Completion`. - `Dinf_tensorPi_equiv_piTensor_aux` in `FLT/DivisionAlgebra/Finiteness.lean`: `tensorPi_equiv_piTensor` applied to `Dinf`, as a `ℝ`-linear equiv. - `Dinf_tensorPi_equiv_piTensor` in `FLT/DivisionAlgebra/Finiteness.lean`: `tensorPi_equiv_piTensor` applied to `Dinf`, as a continuous `ℝ`-linear equiv. - `Dinf_tensorPi_equiv_piTensor_mulEquiv` in `FLT/DivisionAlgebra/Finiteness.lean`: `tensorPi_equiv_piTensor` applied to `Dinf`, as a mul equiv. ## Supporting lemmas - `isCentralSimple_infinite_addHaarScalarFactor_left_mul_eq_right_mul_aux` in `FLT/DivisionAlgebra/Finiteness.lean` ```lean lemma isCentralSimple_infinite_addHaarScalarFactor_left_mul_eq_right_mul_aux ``` - `algebraMap_completion_def` in `FLT/DivisionAlgebra/Finiteness.lean` ```lean lemma algebraMap_completion_def (vi : InfinitePlace K) : ``` - `algebraMap_completion` in `FLT/DivisionAlgebra/Finiteness.lean` ```lean lemma algebraMap_completion {vi : InfinitePlace K} {x : ℝ} : ``` - `tensorPi_equiv_piTensor_map_mul` in `FLT/DivisionAlgebra/Finiteness.lean` ```lean lemma tensorPi_equiv_piTensor_map_mul {x y : Dinf K D} : ``` - `isCentralSimple_infinite_addHaarScalarFactor_left_mul_eq_right_mul` in `FLT/DivisionAlgebra/Finiteness.lean` ```lean lemma isCentralSimple_infinite_addHaarScalarFactor_left_mul_eq_right_mul ``` - `isCentralSimple_addHaarScalarFactor_left_mul_eq_right_mul` in `FLT/DivisionAlgebra/Finiteness.lean` ```lean lemma isCentralSimple_addHaarScalarFactor_left_mul_eq_right_mul ``` - `NumberField.FiniteAdeleRing.isCentralSimple_finite_addHaarScalarFactor_left_mul_eq_right_mul` in `FLT/HaarMeasure/HaarChar/AdeleRing.lean` ```lean lemma NumberField.FiniteAdeleRing.isCentralSimple_finite_addHaarScalarFactor_left_mul_eq_right_mul ``` - `Subalgebra.sup_includeLeft_includeRight_eq_top` in `FLT/Mathlib/Algebra/Central/TensorProduct.lean` ```lean lemma Subalgebra.sup_includeLeft_includeRight_eq_top ``` - `Subalgebra.center_tensorProduct_eq_inf` in `FLT/Mathlib/Algebra/Central/TensorProduct.lean` ```lean lemma Subalgebra.center_tensorProduct_eq_inf ``` - `Submodule.tensorProduct_inf_eq_range_map` in `FLT/Mathlib/Algebra/Central/TensorProduct.lean` ```lean lemma Submodule.tensorProduct_inf_eq_range_map ``` - `Subalgebra.tensorProduct_inf_eq_range_map` in `FLT/Mathlib/Algebra/Central/TensorProduct.lean` ```lean lemma Subalgebra.tensorProduct_inf_eq_range_map ``` - `Subalgebra.center_tensorProduct` in `FLT/Mathlib/Algebra/Central/TensorProduct.lean` ```lean lemma Subalgebra.center_tensorProduct ``` ## Verification The patched repository must compile with `lake build`.","diff --git a/FLT.lean b/FLT.lean --- a/FLT.lean +++ b/FLT.lean @@ -64,6 +64,7 @@ import FLT.Mathlib.Algebra.Algebra.Bilinear import FLT.Mathlib.Algebra.Algebra.Hom import FLT.Mathlib.Algebra.Algebra.Pi import FLT.Mathlib.Algebra.Algebra.Tower +import FLT.Mathlib.Algebra.Central.TensorProduct import FLT.Mathlib.Algebra.FixedPoints.Basic import FLT.Mathlib.Algebra.IsDirectLimit import FLT.Mathlib.Algebra.IsQuaternionAlgebra diff --git a/FLT/DivisionAlgebra/Finiteness.lean b/FLT/DivisionAlgebra/Finiteness.lean --- a/FLT/DivisionAlgebra/Finiteness.lean +++ b/FLT/DivisionAlgebra/Finiteness.lean @@ -30,6 +30,11 @@ space `Dˣ \ (D ⊗[K] 𝔸_K^infty)ˣ / U` is finite. Most of the definitions in this file are auxiliary definitions, in an `Aux` namespace. +-- TODO -- the nature of this file has changed; there are now also a bunch of results +relating `D ⊗ 𝔸` to `D ⊗ 𝔸ᶠ × D × K∞` which probably should be elsewhere. The +title of the file ""Finiteness.lean"" should be referring to the fundamental finiteness +result of Fujisaki rather than all the intermediate stuff. + ## Main theorem Fujisaki's lemma: @@ -48,7 +53,7 @@ open IsDedekindDomain MeasureTheory NumberField -- don't need it). attribute [-instance] instIsScalarTowerFiniteAdeleRing_fLT_1 --- this instance creates a nasty diamond for `IsScalarTower K K_∞ L_∞ when K = L and +-- this instance creates a nasty diamond for `IsScalarTower K K_∞ L_∞` when K = L and -- should probably be scoped (or even removed and statements changed so that they -- don't need it). attribute [-instance] InfiniteAdeleRing.instIsScalarTower_fLT_1 @@ -395,6 +400,250 @@ lemma ringHaarChar_D𝔸_real_surjective (r : ℝ) (h : r > 0) : end FiniteAdeleRing +end AdeleRing.DivisionAlgebra.Aux + +namespace InfiniteAdeleRing + +open AdeleRing.DivisionAlgebra.Aux + +open scoped TensorProduct.RightActions + +variable [FiniteDimensional K D] + +instance (vi : InfinitePlace K) : SecondCountableTopology (D ⊗[K] vi.Completion) := + Module.Finite.secondCountabletopology vi.Completion _ + +variable + [(vi : InfinitePlace K) → MeasurableSpace (D ⊗[K] vi.Completion)] + [(vi : InfinitePlace K) → BorelSpace (D ⊗[K] vi.Completion)] in +/-- Left and right Haar characters agree for +`u : (Π vi : InfinitePlace K, (D ⊗[K] vi.Completion))ˣ`. -/ +lemma isCentralSimple_infinite_addHaarScalarFactor_left_mul_eq_right_mul_aux + [Algebra.IsCentral K D] (u : (Π vi : InfinitePlace K, (D ⊗[K] vi.Completion))ˣ) : + addEquivAddHaarChar (ContinuousAddEquiv.mulLeft u) = + addEquivAddHaarChar (ContinuousAddEquiv.mulRight u) := by + open MeasureTheory in + have : BorelSpace (Π vi : InfinitePlace K, (D ⊗[K] vi.Completion)) := Pi.borelSpace + let u' := MulEquiv.piUnits u + have hl : + addEquivAddHaarChar (ContinuousAddEquiv.mulLeft u) + = ∏ vi, addEquivAddHaarChar (ContinuousAddEquiv.mulLeft (u' vi)) := by + rw [← addEquivAddHaarChar_piCongrRight (fun vi ↦ ContinuousAddEquiv.mulLeft (u' vi))] + congr + have hr : + addEquivAddHaarChar (ContinuousAddEquiv.mulRight u) + = ∏ vi, addEquivAddHaarChar (ContinuousAddEquiv.mulRight (u' vi)) := by + rw [← addEquivAddHaarChar_piCongrRight (fun vi ↦ ContinuousAddEquiv.mulRight (u' vi))] + congr + rw [hl, hr]; congr; funext vi + apply + IsSimpleRing.ringHaarChar_eq_addEquivAddHaarChar_mulRight (F := vi.Completion) (u' vi) + +section RealAlgebra + +-- This section on `ℝ`-algebra structures is really only needed +-- to show continuity of `tensorPi_equiv_piTensor`. +-- TODO: fix this approach in view of the diamond created with things like +-- `instAlgebraRealInfiniteAdeleRing_fLT` +-- (but everything below works, so I'm hesitant to touch it for now) + +open Classical in +/-- The canonical `ℝ`-algebra structure on `InfinitePlace.Completion`. -/ +def real_to_completion (vi : InfinitePlace K) : ℝ →+* vi.Completion := + if h : vi.IsReal + then (InfinitePlace.Completion.ringEquivRealOfIsReal h).symm.toRingHom + else + (InfinitePlace.Completion.ringEquivComplexOfIsComplex (by simpa using h)).symm.toRingHom.comp + Complex.ofRealHom + +instance (vi : InfinitePlace K) : Algebra ℝ vi.Completion := + (real_to_completion K vi).toAlgebra + +omit [NumberField K] in +lemma algebraMap_completion_def (vi : InfinitePlace K) : + (algebraMap ℝ vi.Completion) = (real_to_completion K vi) := rfl + +instance (vi : InfinitePlace K) : Module.Finite ℝ vi.Completion := by + by_cases h : vi.IsReal + · let e : vi.Completion ≃ₗ[ℝ] ℝ := { + __ := InfinitePlace.Completion.ringEquivRealOfIsReal h + map_smul' r x := by + simp_all [Algebra.smul_def, algebraMap_completion_def, real_to_completion, ↓reduceDIte] + } + exact Module.Finite.of_injective _ e.injective + · let e : vi.Completion ≃ₗ[ℝ] ℂ := { + __ := InfinitePlace.Completion.ringEquivComplexOfIsComplex (by simpa using h) + map_smul' r x := by + simp_all [Algebra.smul_def, algebraMap_completion_def, real_to_completion, ↓reduceDIte] + } + exact Module.Finite.of_injective _ e.injective + +instance (vi : InfinitePlace K) : ContinuousSMul ℝ vi.Completion := by + refine continuousSMul_of_algebraMap ℝ vi.Completion ?_ + rw [algebraMap_completion_def] + by_cases h : vi.IsReal + · have := (InfinitePlace.Completion.isometryEquivRealOfIsReal h).symm.isometry_toFun.continuous + simpa [real_to_completion, h, ↓reduceDIte] + · have := (InfinitePlace.Completion.isometryEquivComplexOfIsComplex + (by simpa using h)).symm.isometry_toFun.continuous.comp Complex.continuous_ofReal + simpa only [real_to_completion, h, ↓reduceDIte] + +instance (vi : InfinitePlace K) : IsModuleTopology ℝ vi.Completion := + isModuleTopologyOfFiniteDimensional + +instance (vi : InfinitePlace K) : Algebra ℝ (D ⊗[K] vi.Completion) := + Algebra.compHom _ <| real_to_completion K vi + +instance (vi : InfinitePlace K) : IsScalarTower ℝ vi.Completion (D ⊗[K] vi.Completion) := + IsScalarTower.of_compHom .. + +instance (vi : InfinitePlace K) : IsModuleTopology ℝ (D ⊗[K] vi.Completion) := by + rw [IsModuleTopology.trans ℝ vi.Completion] + infer_instance + +instance : IsModuleTopology ℝ (Π vi : InfinitePlace K, (D ⊗[K] vi.Completion)) := + IsModuleTopology.instPi + +omit [NumberField K] in +lemma algebraMap_completion {vi : InfinitePlace K} {x : ℝ} : + (algebraMap ℝ (InfiniteAdeleRing K)) x vi = (algebraMap ℝ vi.Completion) x := by + change + ((InfiniteAdeleRing.ringEquiv_mixedSpace K).symm.toRingHom.comp (algebraMap ℝ _)) x vi + = real_to_completion K vi x + by_cases h : vi.IsReal + · simp_all [real_to_completion, ↓reduceDIte, + RingEquiv.piEquivPiSubtypeProd, Equiv.piEquivPiSubtypeProd] + rfl + · simp_all [-InfinitePlace.not_isReal_iff_isComplex, real_to_completion, ↓reduceDIte, + RingEquiv.piEquivPiSubtypeProd, Equiv.piEquivPiSubtypeProd] + rfl + +end RealAlgebra + +omit [NumberField K] in +lemma tensorPi_equiv_piTensor_map_mul {x y : Dinf K D} : + tensorPi_equiv_piTensor K D InfinitePlace.Completion (x * y) + = tensorPi_equiv_piTensor K D InfinitePlace.Completion x + * tensorPi_equiv_piTensor K D InfinitePlace.Completion y := by + -- we need that `tensorPi_equiv_piTensor` is a ring hom + -- **TODO** this is certainly true in more generality and so can go elsewhere later on + refine TensorProduct.induction_on x + (by simp only [LinearEquiv.map_zero, zero_mul]) + (fun x₁ x₂ ↦ ?_) (fun x₁ x₂ hx₁ hx₂ ↦ by + simp_all only [LinearEquiv.map_add, add_mul]) + refine TensorProduct.induction_on y + (by simp only [LinearEquiv.map_zero, mul_zero]) + (fun y₁ y₂ ↦ ?_) (fun y₁ y₂ hy₁ hy₂ ↦ by + simp_all only [LinearEquiv.map_add, mul_add]) + funext vi + simp [Dinf, InfiniteAdeleRing, tensorPi_equiv_piTensor_apply] + +/-- `tensorPi_equiv_piTensor` applied to `Dinf`, as a `ℝ`-linear equiv. -/ +def Dinf_tensorPi_equiv_piTensor_aux : + (Dinf K D) ≃ₗ[ℝ] Π vi : InfinitePlace K, (D ⊗[K] vi.Completion) := { + __ := tensorPi_equiv_piTensor K D InfinitePlace.Completion + map_smul' x y := by + change tensorPi_equiv_piTensor K D InfinitePlace.Completion (x • y) + = x • tensorPi_equiv_piTensor K D InfinitePlace.Completion y + simp only [Algebra.smul_def, tensorPi_equiv_piTensor_map_mul]; + congr + have h₁ : (algebraMap ℝ (Dinf K D)) x = 1 ⊗ₜ[K] (algebraMap ℝ (InfiniteAdeleRing K) x) := rfl + have h₂ : + (algebraMap ℝ ((i : InfinitePlace K) → D ⊗[K] i.Completion)) x + = fun (i : InfinitePlace K) ↦ 1 ⊗ₜ[K] (algebraMap ℝ i.Completion x) := rfl + rw [h₁, h₂, tensorPi_equiv_piTensor_apply] + funext vi + congr + exact algebraMap_completion _ +} + +/-- `tensorPi_equiv_piTensor` applied to `Dinf`, as a continuous `ℝ`-linear equiv. -/ +def Dinf_tensorPi_equiv_piTensor : + (Dinf K D) ≃L[ℝ] Π vi : InfinitePlace K, (D ⊗[K] vi.Completion) := { + __ := Dinf_tensorPi_equiv_piTensor_aux .. + continuous_toFun := + IsModuleTopology.continuous_of_linearMap (Dinf_tensorPi_equiv_piTensor_aux K D).toLinearMap + continuous_invFun := + IsModuleTopology.continuous_of_linearMap (Dinf_tensorPi_equiv_piTensor_aux K D).symm.toLinearMap +} + +/-- `tensorPi_equiv_piTensor` applied to `Dinf`, as a mul equiv. -/ +def Dinf_tensorPi_equiv_piTensor_mulEquiv : + (Dinf K D) ≃* Π vi : InfinitePlace K, (D ⊗[K] vi.Completion) := { + __ := Dinf_tensorPi_equiv_piTensor K D + map_mul' _ _ := tensorPi_equiv_piTensor_map_mul .. +} + +lemma isCentralSimple_infinite_addHaarScalarFactor_left_mul_eq_right_mul + [Algebra.IsCentral K D] (u : (Dinf K D)ˣ) : + addEquivAddHaarChar (ContinuousAddEquiv.mulLeft u) = + addEquivAddHaarChar (ContinuousAddEquiv.mulRight u) := by + -- infinite places + -- use `Dinf_tensorPi_equiv_piTensor` to reduce to + -- `isCentralSimple_infinite_addHaarScalarFactor_left_mul_eq_right_mul_aux` + open MeasureTheory in + let (vi : InfinitePlace K) : MeasurableSpace (D ⊗[K] vi.Completion) := borel _ + have (vi : InfinitePlace K) : BorelSpace (D ⊗[K] vi.Completion) := ⟨rfl⟩ + let e := Dinf_tensorPi_equiv_piTensor K D + let u' := Units.map (Dinf_tensorPi_equiv_piTensor_mulEquiv K D).toMonoidHom u + have hl : + addEquivAddHaarChar (ContinuousAddEquiv.mulLeft u) + = addEquivAddHaarChar (ContinuousAddEquiv.mulLeft u') := by + apply addEquivAddHaarChar_eq_addEquivAddHaarChar_of_continuousAddEquiv {__ := e} + intro x; have : e (u * x) = u' * e x := tensorPi_equiv_piTensor_map_mul .. + simpa + have hr : + addEquivAddHaarChar (ContinuousAddEquiv.mulRight u) + = addEquivAddHaarChar (ContinuousAddEquiv.mulRight u') := by + apply addEquivAddHaarChar_eq_addEquivAddHaarChar_of_continuousAddEquiv {__ := e} + intro x; have : e (x * u) = e x * u' := tensorPi_equiv_piTensor_map_mul .. + simpa + rw [hl, hr] + apply isCentralSimple_infinite_addHaarScalarFactor_left_mul_eq_right_mul_aux + +end InfiniteAdeleRing + +namespace AdeleRing + +open AdeleRing.DivisionAlgebra.Aux + +variable [FiniteDimensional K D] + +open scoped TensorProduct.RightActions in +lemma isCentralSimple_addHaarScalarFactor_left_mul_eq_right_mul + [Algebra.IsCentral K D] (u : D_𝔸ˣ) : + addEquivAddHaarChar (ContinuousAddEquiv.mulLeft u) = + addEquivAddHaarChar (ContinuousAddEquiv.mulRight u) := by + open IsDedekindDomain MeasureTheory in + let u' := D𝔸_prodRight_units K D u + have hl : + addEquivAddHaarChar (ContinuousAddEquiv.mulLeft u) + = addEquivAddHaarChar (ContinuousAddEquiv.mulLeft u'.1) + * addEquivAddHaarChar (ContinuousAddEquiv.mulLeft u'.2) := by + rw [← addEquivAddHaarChar_prodCongr + (ContinuousAddEquiv.mulLeft u'.1) (ContinuousAddEquiv.mulLeft u'.2)] + apply addEquivAddHaarChar_eq_addEquivAddHaarChar_of_continuousAddEquiv (D𝔸_prodRight'' K D) + intro x; simp; rfl + have hr : + addEquivAddHaarChar (ContinuousAddEquiv.mulRight u) + = addEquivAddHaarChar (ContinuousAddEquiv.mulRight u'.1) + * addEquivAddHaarChar (ContinuousAddEquiv.mulRight u'.2) := by + rw [← addEquivAddHaarChar_prodCongr + (ContinuousAddEquiv.mulRight u'.1) (ContinuousAddEquiv.mulRight u'.2)] + apply addEquivAddHaarChar_eq_addEquivAddHaarChar_of_continuousAddEquiv (D𝔸_prodRight'' K D) + intro x; simp; rfl + simp [hl, hr, Dinfx, Dfx, Df, + InfiniteAdeleRing.isCentralSimple_infinite_addHaarScalarFactor_left_mul_eq_right_mul _, + FiniteAdeleRing.isCentralSimple_finite_addHaarScalarFactor_left_mul_eq_right_mul K D _] + +end AdeleRing + +namespace AdeleRing.DivisionAlgebra.Aux + +open scoped TensorProduct.RightActions + +variable [FiniteDimensional K D] + section auxiliary_defs -- We need a subset of D ⊗[K] 𝔸_K^f with positive finite measure -- and a subset of D ⊗[K] K_∞ with positive finite measure. We build them diff --git a/FLT/HaarMeasure/HaarChar/AdeleRing.lean b/FLT/HaarMeasure/HaarChar/AdeleRing.lean --- a/FLT/HaarMeasure/HaarChar/AdeleRing.lean +++ b/FLT/HaarMeasure/HaarChar/AdeleRing.lean @@ -1,10 +1,12 @@ import FLT.HaarMeasure.HaarChar.Ring +import FLT.Mathlib.Algebra.Central.TensorProduct import FLT.Mathlib.MeasureTheory.Constructions.BorelSpace.AdicCompletion import FLT.Mathlib.NumberTheory.NumberField.AdeleRing import FLT.Mathlib.NumberTheory.Padics.HeightOneSpectrum import FLT.NumberField.AdeleRing import FLT.HaarMeasure.HaarChar.RealComplex import FLT.HaarMeasure.HaarChar.Padic +import FLT.HaarMeasure.HaarChar.FiniteDimensional import Mathlib.NumberTheory.NumberField.ProductFormula import FLT.HaarMeasure.HaarChar.FiniteDimensional /-! @@ -36,14 +38,34 @@ open scoped TensorProduct open NumberField MeasureTheory +open scoped TensorProduct.RightActions in +instance (k A B : Type*) [Field k] [Field A] [Ring B] + [Algebra k A] [Algebra k B] + [Algebra.IsCentral k B] : + Algebra.IsCentral A (B ⊗[k] A) := + Algebra.IsCentral.of_algEquiv _ _ _ { + __ := (Algebra.TensorProduct.comm k A B) + commutes' := by simp } + +open IsDedekindDomain HeightOneSpectrum RestrictedProduct in open scoped TensorProduct.RightActions in variable - [MeasurableSpace (B ⊗[K] 𝔸 K)] - [BorelSpace (B ⊗[K] 𝔸 K)] in -lemma NumberField.AdeleRing.isCentralSimple_addHaarScalarFactor_left_mul_eq_right_mul - [IsSimpleRing B] [Algebra.IsCentral K B] (u : (B ⊗[K] (𝔸 K))ˣ) : + [MeasurableSpace (B ⊗[K] (FiniteAdeleRing (𝓞 K) K))] + [BorelSpace (B ⊗[K] (FiniteAdeleRing (𝓞 K) K))] in +lemma NumberField.FiniteAdeleRing.isCentralSimple_finite_addHaarScalarFactor_left_mul_eq_right_mul + [IsSimpleRing B] [Algebra.IsCentral K B] (u : (B ⊗[K] (FiniteAdeleRing (𝓞 K) K))ˣ) : addEquivAddHaarChar (ContinuousAddEquiv.mulLeft u) = addEquivAddHaarChar (ContinuousAddEquiv.mulRight u) := by + -- finite places + -- the code here is just testing whether `ringHaarChar_eq_addEquivAddHaarChar_mulRight` + -- works for each finite place `v` + -- feel free to modify this code + have : Module.FinitePresentation K B := Module.finitePresentation_of_finite .. + let v : HeightOneSpectrum (𝓞 K) := sorry + let u' : (B ⊗[K] (v.adicCompletion K))ˣ := sorry + let : MeasurableSpace (B ⊗[K] v.adicCompletion K) := borel _ + have : BorelSpace (B ⊗[K] v.adicCompletion K) := ⟨rfl⟩ + have hf := IsSimpleRing.ringHaarChar_eq_addEquivAddHaarChar_mulRight (F := v.adicCompletion K) u' sorry lemma MeasureTheory.ringHaarChar_adeles_rat (x : (𝔸 ℚ)ˣ) : diff --git a/FLT/Mathlib/Algebra/Central/TensorProduct.lean b/FLT/Mathlib/Algebra/Central/TensorProduct.lean --- /dev/null +++ b/FLT/Mathlib/Algebra/Central/TensorProduct.lean @@ -0,0 +1,93 @@ +import Mathlib.Algebra.Central.TensorProduct +import Mathlib.Algebra.Algebra.Subalgebra.Centralizer +import Mathlib.LinearAlgebra.TensorProduct.Subalgebra + +open scoped TensorProduct + +@[simp] +lemma Subalgebra.sup_includeLeft_includeRight_eq_top + {k A B : Type*} [CommSemiring k] + [Semiring A] [Algebra k A] [Semiring B] [Algebra k B] : + Algebra.TensorProduct.includeLeft.range ⊔ Algebra.TensorProduct.includeRight.range + = (⊤ : Subalgebra k (A ⊗[k] B)) := by + ext x + simp only [Algebra.mem_top, iff_true] + refine TensorProduct.induction_on x (by simp) (fun a b ↦ ?_) (fun _ _ ↦ AddMemClass.add_mem) + have : a ⊗ₜ[k] b = a ⊗ₜ[k] 1 * 1 ⊗ₜ[k] b := by simp + rw [this] + exact Subalgebra.mul_mem _ + (Algebra.mem_sup_left <| Set.mem_range_self _) + (Algebra.mem_sup_right <| Set.mem_range_self _) + +lemma Subalgebra.center_tensorProduct_eq_inf + {k : Type*} [Field k] + {A B : Type*} [Ring A] [Algebra k A] [Ring B] [Algebra k B] : + Subalgebra.center k (A ⊗[k] B) + = (Algebra.TensorProduct.map (Subalgebra.center k A).val (AlgHom.id k B)).range + ⊓ (Algebra.TensorProduct.map (AlgHom.id k A) (Subalgebra.center k B).val).range := by + rw [← Subalgebra.centralizer_coe_range_includeLeft_eq_center_tensorProduct, + ← Subalgebra.centralizer_range_includeRight_eq_center_tensorProduct, + ← Subalgebra.centralizer_coe_sup] + simp + +lemma Submodule.tensorProduct_inf_eq_range_map + {k : Type*} [Field k] + {A B : Type*} [AddCommGroup A] [Module k A] [AddCommGroup B] [Module k B] + (S : Submodule k A) (T : Submodule k B) : + LinearMap.range (TensorProduct.map S.subtype LinearMap.id) ⊓ + LinearMap.range (TensorProduct.map LinearMap.id T.subtype) = + LinearMap.range (TensorProduct.map S.subtype T.subtype) := by + refine le_antisymm ?_ + (le_inf (TensorProduct.range_map_mono le_rfl (by simp)) + (TensorProduct.range_map_mono (by simp) le_rfl)) + rintro x ⟨⟨u, hux⟩, ⟨v, hvx⟩⟩ + let qS := S.linearProjOfIsCompl S.exists_isCompl.choose S.exists_isCompl.choose_spec + let qT := T.linearProjOfIsCompl T.exists_isCompl.choose T.exists_isCompl.choose_spec + have hxS : TensorProduct.map (S.subtype.comp qS) LinearMap.id x = x := by + rw [← hux] + exact TensorProduct.induction_on u (by simp) + (fun _ _ ↦ by simp_all [qS]) (fun _ _ ↦ by simp_all) + have hxT : TensorProduct.map LinearMap.id (T.subtype.comp qT) x = x := by + rw [← hvx] + exact TensorProduct.induction_on v (by simp) + (fun _ _ ↦ by simp_all [qT]) (fun _ _ ↦ by simp_all) + have hxST : TensorProduct.map (S.subtype.comp qS) (T.subtype.comp qT) x = x := by + conv_rhs => rw [← hxS, ← hxT] + simp [← TensorProduct.map_comp, ← LinearMap.comp_apply] + use TensorProduct.map qS qT x; + simpa [← TensorProduct.map_comp, ← LinearMap.comp_apply] using hxST + +lemma Subalgebra.tensorProduct_inf_eq_range_map + {k : Type*} [Field k] + {A B : Type*} [Ring A] [Algebra k A] [Ring B] [Algebra k B] + (S : Subalgebra k A) (T : Subalgebra k B) : + (Algebra.TensorProduct.map S.val (AlgHom.id k B)).range ⊓ + (Algebra.TensorProduct.map (AlgHom.id k A) T.val).range = + (Algebra.TensorProduct.map S.val T.val).range := + Subalgebra.toSubmodule_injective <| + Submodule.tensorProduct_inf_eq_range_map S.toSubmodule T.toSubmodule + +lemma Subalgebra.center_tensorProduct + {k : Type*} [Field k] + {A B : Type*} [Ring A] [Algebra k A] [Ring B] [Algebra k B] : + Subalgebra.center k (A ⊗[k] B) + = (Algebra.TensorProduct.map (Subalgebra.center k A).val + (Subalgebra.center k B).val).range := by + have := Subalgebra.center_tensorProduct_eq_inf (k := k) (A := A) (B := B) + simp_all [Subalgebra.tensorProduct_inf_eq_range_map] + +instance (k A B : Type*) [Field k] [CommRing A] [Ring B] + [Algebra k A] [Algebra k B] + [Algebra.IsCentral k B] : + Algebra.IsCentral A (A ⊗[k] B) := ⟨fun x hx ↦ by + have : + x ∈ (Algebra.TensorProduct.map + (Subalgebra.center k A).val (Subalgebra.center k B).val).range := by + simpa [← Subalgebra.center_tensorProduct] using hx + rw [Algebra.IsCentral.center_eq_bot k B] at this + obtain ⟨ab, rfl⟩ := this + refine TensorProduct.induction_on ab (by simp) + (fun a ⟨b, hb⟩ ↦ ?_) (fun _ _ ↦ by simpa using AddMemClass.add_mem) + obtain ⟨kb, rfl⟩ := Algebra.mem_bot.mp hb + refine Algebra.mem_bot.mpr ⟨kb • a, ?_⟩ + simp [-TensorProduct.tmul_smul, TensorProduct.smul_tmul, Algebra.smul_def kb (1 : B)]⟩ diff --git a/FLT/Mathlib/LinearAlgebra/Determinant.lean b/FLT/Mathlib/LinearAlgebra/Determinant.lean --- a/FLT/Mathlib/LinearAlgebra/Determinant.lean +++ b/FLT/Mathlib/LinearAlgebra/Determinant.lean @@ -49,6 +49,11 @@ at https://github.com/leanprover-community/mathlib4/pull/26377 . instance (A B : Type*) [Ring A] [Ring B] [Algebra k A] [Algebra k B] [Algebra.IsCentral k B] [IsSimpleRing A] [IsSimpleRing B] : IsSimpleRing (A ⊗[k] B) := sorry +instance (A B : Type*) [Ring A] [Ring B] [Algebra k A] [Algebra k B] + [Algebra.IsCentral k B] [IsSimpleRing A] [IsSimpleRing B] : IsSimpleRing (B ⊗[k] A) := + IsSimpleRing.of_ringEquiv + (Algebra.TensorProduct.comm k A B).toRingEquiv inferInstance + lemma IsSimpleRing.mulLeft_det_eq_mulRight_det (d : D) : (LinearMap.mulLeft k d).det = (LinearMap.mulRight k d).det := by let K' := AlgebraicClosure k diff --git a/FLT/NumberField/Completion/Finite.lean b/FLT/NumberField/Completion/Finite.lean --- a/FLT/NumberField/Completion/Finite.lean +++ b/FLT/NumberField/Completion/Finite.lean @@ -54,6 +54,17 @@ instance Rat.adicCompletion.locallyCompactSpace (v : HeightOneSpectrum (𝓞 ℚ (Rat.HeightOneSpectrum.adicCompletion.padicEquiv v).toHomeomorph.isClosedEmbedding |>.locallyCompactSpace +instance (v : HeightOneSpectrum (𝓞 K)) : + WeaklyLocallyCompactSpace (v.adicCompletion K) where + exists_compact_mem_nhds x := + open Pointwise in + ⟨x +ᵥ ((v.adicCompletionIntegers K) : Set (v.adicCompletion K)), + (isCompact_iff_compactSpace.mpr <| instCompactSpaceAdicCompletionIntegers K v).vadd x, + ((isOpenAdicCompletionIntegers K v).vadd x).mem_nhds (Set.mem_vadd_set.mpr ⟨0, by simp⟩)⟩ + +instance (v : HeightOneSpectrum (𝓞 K)) : + LocallyCompactSpace (v.adicCompletion K) := inferInstance + -- does this exist upstream? Should do. example (v : HeightOneSpectrum (𝓞 K)) : SecondCountableTopology (v.adicCompletion K) := inferInstance",386,5,391,5.5,diff_derived,False,760,6,0,12,4,pr_merge,False,leanprover/lean4:v4.29.0,leanbench/lean4-env:4.29.0,lake build,600,lean_compiler,algebra,2026-04-28T12:40:02Z,extraction_pipeline_v2 LB-0017,pr_completion,hard,7.6,ImperialCollegeLondon/FLT,825,feat: API for finite adele ring tensor vector space,https://github.com/ImperialCollegeLondon/FLT/pull/825,awaiting-CI,68062db94b8fdbdc8d306532d7b0e99f4e0046b1,0b0f52f7516a7baab568686949b3ce3f952e444a,"FLT.lean,FLT/DedekindDomain/FiniteAdeleRing/TensorProduct.lean,FLT/Mathlib/LinearAlgebra/TensorProduct/Algebra.lean,FLT/Mathlib/LinearAlgebra/TensorProduct/FiniteFree.lean,FLT/Mathlib/RingTheory/DedekindDomain/FiniteAdeleRing.lean,FLT/Mathlib/Topology/Algebra/Module/TensorProduct.lean,FLT/Mathlib/Topology/Algebra/RestrictedProduct/Basic.lean,FLT/Mathlib/Topology/Algebra/RestrictedProduct/TopologicalSpace.lean",FLT.lean,"# Task: feat: API for finite adele ring tensor vector space ## Files affected - FLT.lean (+4/-0) - FLT/DedekindDomain/FiniteAdeleRing/TensorProduct.lean (+90/-0) - FLT/Mathlib/LinearAlgebra/TensorProduct/Algebra.lean (+26/-0) - FLT/Mathlib/LinearAlgebra/TensorProduct/FiniteFree.lean (+19/-0) - FLT/Mathlib/RingTheory/DedekindDomain/FiniteAdeleRing.lean (+70/-4) - FLT/Mathlib/Topology/Algebra/Module/TensorProduct.lean (+120/-0) - FLT/Mathlib/Topology/Algebra/RestrictedProduct/Basic.lean (+22/-0) - FLT/Mathlib/Topology/Algebra/RestrictedProduct/TopologicalSpace.lean (+58/-0) ## Definitions to add - `AlgHom.rTensor` in `FLT/Mathlib/LinearAlgebra/TensorProduct/Algebra.lean` ```lean def AlgHom.rTensor {R : Type*} [CommSemiring R] (M : Type*) {N : Type*} ``` - `evalContinuousAlgebraMap` in `FLT/Mathlib/RingTheory/DedekindDomain/FiniteAdeleRing.lean` ```lean def evalContinuousAlgebraMap (j : HeightOneSpectrum R) : ``` - `rTensor` in `FLT/Mathlib/Topology/Algebra/Module/TensorProduct.lean`: The continuous `R`-linear map `M ⊗[R] V → N ⊗[R] V` induced - `evalContinuousAddMonoidHom` in `FLT/Mathlib/Topology/Algebra/RestrictedProduct/TopologicalSpace.lean`: The continuous additive projection from a restricted product of topological additive groups ## Supporting lemmas - `TensorProduct.localcomponent_apply` in `FLT/DedekindDomain/FiniteAdeleRing/TensorProduct.lean` ```lean lemma TensorProduct.localcomponent_apply ``` - `evalContinuousAlgebraMap_singleContinuousLinearMap` in `FLT/Mathlib/RingTheory/DedekindDomain/FiniteAdeleRing.lean` ```lean lemma evalContinuousAlgebraMap_singleContinuousLinearMap (j : HeightOneSpectrum R) ``` - `eval_localIdempotent` in `FLT/Mathlib/RingTheory/DedekindDomain/FiniteAdeleRing.lean` ```lean lemma eval_localIdempotent (p : HeightOneSpectrum R) : ``` - `singleContinuousAlgebraMap_comp_evalContinuousLinearMap` in `FLT/Mathlib/RingTheory/DedekindDomain/FiniteAdeleRing.lean` ```lean lemma singleContinuousAlgebraMap_comp_evalContinuousLinearMap (j : HeightOneSpectrum R) : ``` - `rTensor_id_apply` in `FLT/Mathlib/Topology/Algebra/Module/TensorProduct.lean` ```lean lemma rTensor_id_apply {R : Type*} {M : Type*} (V : Type*) ``` - `rTensor_id` in `FLT/Mathlib/Topology/Algebra/Module/TensorProduct.lean` ```lean lemma rTensor_id {R : Type*} {M : Type*} (V : Type*) ``` - `rTensor_comp_apply` in `FLT/Mathlib/Topology/Algebra/Module/TensorProduct.lean` ```lean lemma rTensor_comp_apply {R : Type*} {M N P : Type*} (V : Type*) ``` - `rTensor_comp` in `FLT/Mathlib/Topology/Algebra/Module/TensorProduct.lean` ```lean lemma rTensor_comp {R : Type*} {M N P : Type*} (V : Type*) ``` - `singleContinuousAddMonoidHom_apply_same` in `FLT/Mathlib/Topology/Algebra/RestrictedProduct/TopologicalSpace.lean` ```lean lemma singleContinuousAddMonoidHom_apply_same {j : ι} (x : A j) : ``` - `singleContinuousAddMonoidHom_apply_of_ne` in `FLT/Mathlib/Topology/Algebra/RestrictedProduct/TopologicalSpace.lean` ```lean lemma singleContinuousAddMonoidHom_apply_of_ne {j i : ι} (h : i ≠ j) (x : A j) : ``` ## Verification The patched repository must compile with `lake build`.","diff --git a/FLT.lean b/FLT.lean --- a/FLT.lean +++ b/FLT.lean @@ -17,6 +17,7 @@ import FLT.DedekindDomain.FiniteAdeleRing.BaseChange import FLT.DedekindDomain.FiniteAdeleRing.IsDirectLimitRestricted import FLT.DedekindDomain.FiniteAdeleRing.LocalUnits import FLT.DedekindDomain.FiniteAdeleRing.TensorPi +import FLT.DedekindDomain.FiniteAdeleRing.TensorProduct import FLT.DedekindDomain.FiniteAdeleRing.TensorRestrictedProduct import FLT.DedekindDomain.IntegralClosure import FLT.Deformations.Algebra.InverseLimit.Basic @@ -83,7 +84,9 @@ import FLT.Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Defs import FLT.Mathlib.LinearAlgebra.Matrix.Transvection import FLT.Mathlib.LinearAlgebra.Pi import FLT.Mathlib.LinearAlgebra.Span.Defs +import FLT.Mathlib.LinearAlgebra.TensorProduct.Algebra import FLT.Mathlib.LinearAlgebra.TensorProduct.Basis +import FLT.Mathlib.LinearAlgebra.TensorProduct.FiniteFree import FLT.Mathlib.MeasureTheory.Constructions.BorelSpace.AdeleRing import FLT.Mathlib.MeasureTheory.Constructions.BorelSpace.AdicCompletion import FLT.Mathlib.MeasureTheory.Constructions.BorelSpace.FiniteAdeleRing @@ -125,6 +128,7 @@ import FLT.Mathlib.Topology.Algebra.Module.Equiv import FLT.Mathlib.Topology.Algebra.Module.FiniteDimension import FLT.Mathlib.Topology.Algebra.Module.ModuleTopology import FLT.Mathlib.Topology.Algebra.Module.Quotient +import FLT.Mathlib.Topology.Algebra.Module.TensorProduct import FLT.Mathlib.Topology.Algebra.Monoid import FLT.Mathlib.Topology.Algebra.MulAction import FLT.Mathlib.Topology.Algebra.Order.Field diff --git a/FLT/DedekindDomain/FiniteAdeleRing/TensorProduct.lean b/FLT/DedekindDomain/FiniteAdeleRing/TensorProduct.lean --- /dev/null +++ b/FLT/DedekindDomain/FiniteAdeleRing/TensorProduct.lean @@ -0,0 +1,90 @@ +import FLT.Mathlib.LinearAlgebra.TensorProduct.Algebra +import FLT.Mathlib.Topology.Algebra.RestrictedProduct.TopologicalSpace +import FLT.Mathlib.LinearAlgebra.TensorProduct.FiniteFree +import FLT.Mathlib.Topology.Algebra.Module.TensorProduct +import FLT.Mathlib.RingTheory.DedekindDomain.FiniteAdeleRing + +open scoped TensorProduct + +namespace IsDedekindDomain.FiniteAdeleRing + +open scoped RestrictedProduct + +variable (R : Type*) [CommRing R] [IsDedekindDomain R] [DecidableEq (HeightOneSpectrum R)] + +variable (K : Type*) [Field K] [Algebra R K] [IsFractionRing R K] + +open TensorProduct + +variable (V : Type*) [AddCommGroup V] [Module K V] [FiniteDimensional K V] + +variable + [TopologicalSpace (FiniteAdeleRing R K ⊗[K] V)] + [IsTopologicalAddGroup (FiniteAdeleRing R K ⊗[K] V)] + [IsModuleTopology (FiniteAdeleRing R K) (FiniteAdeleRing R K ⊗[K] V)] + [∀ (p : HeightOneSpectrum R), TopologicalSpace (p.adicCompletion K ⊗[K] V)] + [∀ (p : HeightOneSpectrum R), IsTopologicalAddGroup (p.adicCompletion K ⊗[K] V)] + [∀ (p : HeightOneSpectrum R), IsModuleTopology (p.adicCompletion K) (p.adicCompletion K ⊗[K] V)] + +open IsDedekindDomain NumberField + +/-- +If `φ : 𝔸_K^f ⊗[K] V → 𝔸_K^f ⊗[K] V` is `𝔸_K^f`-linear and `p : HeightOneSpectrum (𝓞 K)` +then `localcomponent R K V p φ : Kₚ ⊗[K] V →[K] Kₚ ⊗[K] V` is the associated +map `φₚ` defined as `Kₚ ⊗[K] V --(single)--> 𝔸_K^f ⊗ V --(φ)--> 𝔸_K^f ⊗ V --(eval)--> Kₚ ⊗ V`. +This map morally satisfies `φ = Πₚ φₚ` but because source of φ isn't literally a restricted +product we cannot make this assertion. +-/ +noncomputable def TensorProduct.localcomponent (p : HeightOneSpectrum R) + (φ : FiniteAdeleRing R K ⊗[K] V →L[FiniteAdeleRing R K] + FiniteAdeleRing R K ⊗[K] V) : + p.adicCompletion K ⊗[K] V →L[K] p.adicCompletion K ⊗[K] V := + -- f1 : `𝔸_K^f ⊗[K] V →L[K] Kₚ ⊗[K] V` is evalₚ ⊗ id_V + letI f1 := (ContinuousLinearMap.rTensor V + (evalContinuousAlgebraMap R K p).toContinuousLinearMap) + -- f2 : `𝔸_K^f ⊗[K] V →L[K] 𝔸_K^f ⊗[K] V` is φ + letI f2 : FiniteAdeleRing R K ⊗[K] V →L[K] FiniteAdeleRing R K ⊗[K] V := { + __ := φ.toLinearMap.restrictScalars K + cont := φ.cont + } + -- f3 : `Kₚ ⊗[K] V →L[K] 𝔸_K^f ⊗[K] V` is singleₚ ⊗ id_V + letI f3 := (ContinuousLinearMap.rTensor V (singleContinuousLinearMap R K p)) + -- f1 ∘ f2 ∘ f3 + f1.comp (f2.comp f3) + +/-- +If `φ : 𝔸_K^f ⊗ V → 𝔸_K^f ⊗ V` is `𝔸_K^f`-linear and `φₚ` is its local component at a place `p` +then for all `x : 𝔸_K^f ⊗ V` we have +`(evalₚ ⊗ id_V) (φ x) = φₚ ((evalₚ ⊗ id_V) x)`, or, more colloquiually, +`(φ x)ₚ = φₚ (xₚ)`. +-/ +lemma TensorProduct.localcomponent_apply + (φ : FiniteAdeleRing R K ⊗[K] V →L[FiniteAdeleRing R K] FiniteAdeleRing R K ⊗[K] V) + (x : FiniteAdeleRing R K ⊗[K] V) (p : HeightOneSpectrum R) : + (ContinuousLinearMap.rTensor V + (evalContinuousAlgebraMap R K p).toContinuousLinearMap) (φ x) = + TensorProduct.localcomponent R K V p φ ((ContinuousLinearMap.rTensor V + (evalContinuousAlgebraMap R K p).toContinuousLinearMap) x) := by + dsimp [localcomponent] + rw [← ContinuousLinearMap.rTensor_comp_apply] + change (LinearMap.rTensor V _) (φ x) = (LinearMap.rTensor V _) (φ ((LinearMap.rTensor V _) x)) + rw [singleContinuousAlgebraMap_comp_evalContinuousLinearMap] + let f := (LinearMap.lsmul + (FiniteAdeleRing R K) (FiniteAdeleRing R K) (localIdempotent R K p)).restrictScalars K + have hf : LinearMap.rTensor V f x = (localIdempotent R K p) • x := by + induction x with + | zero => simp + | tmul x y => exact LinearMap.rTensor_tmul _ _ _ _ + | add x y _ _ => simp_all + rw [hf, ContinuousLinearMap.map_smul] + change (AlgHom.rTensor V ((evalContinuousAlgebraMap R K p).toAlgHom)) (φ x) = + (AlgHom.rTensor V ((evalContinuousAlgebraMap R K p).toAlgHom)) (localIdempotent R K p • φ x) + simp [eval_localIdempotent] + +-- plan; 𝔸_K ⊗ V = (Fin n) → 𝔸_K topologically, which is Πʳ (Fin n -> K_v) +-- topologically, and the claim is that the induced top iso A_K ⊗ V = Πʳ (Fin n -> K_v) +-- sends φ to ∏_v φ_v + +end FiniteAdeleRing + +end IsDedekindDomain diff --git a/FLT/Mathlib/LinearAlgebra/TensorProduct/Algebra.lean b/FLT/Mathlib/LinearAlgebra/TensorProduct/Algebra.lean --- /dev/null +++ b/FLT/Mathlib/LinearAlgebra/TensorProduct/Algebra.lean @@ -0,0 +1,26 @@ +import Mathlib.LinearAlgebra.TensorProduct.Basic +import Mathlib.Algebra.Algebra.Hom + +open TensorProduct in +/-- +The base extension of an R-algebra homomorphism `f : N → P` to an `f`-semilinear +map `N ⊗[R] M → P ⊗[R] M`. +-/ +def AlgHom.rTensor {R : Type*} [CommSemiring R] (M : Type*) {N : Type*} + {P : Type*} [AddCommMonoid M] [Semiring N] [Semiring P] [Module R M] + [Algebra R N] [Algebra R P] (f : N →ₐ[R] P) : + N ⊗[R] M →ₛₗ[f.toRingHom] P ⊗[R] M := { + __ := LinearMap.rTensor M f + map_smul' n x := by + induction x with + | zero => simp + | tmul x y => + rw [smul_tmul'] + change (LinearMap.rTensor M f.toLinearMap) _ = _ + rw [LinearMap.rTensor_tmul] + rw [smul_eq_mul] + change f (n * x) ⊗ₜ[R] y = _ + rw [map_mul] + rfl + | add x y _ _ => simp_all + } diff --git a/FLT/Mathlib/LinearAlgebra/TensorProduct/FiniteFree.lean b/FLT/Mathlib/LinearAlgebra/TensorProduct/FiniteFree.lean --- /dev/null +++ b/FLT/Mathlib/LinearAlgebra/TensorProduct/FiniteFree.lean @@ -0,0 +1,19 @@ +import Mathlib.LinearAlgebra.TensorProduct.Pi +import Mathlib.LinearAlgebra.FreeModule.Finite.Basic + +open TensorProduct + +/-- +The M-algebra isomorphism `M ⊗ V ≃ₗ[M] (ι → M)` coming from the canonical +`ι`-indexed basis of a finite free `R`-module `V`. +-/ +noncomputable def LinearEquiv.chooseBasis_piScalarRight (R : Type*) (M : Type*) (V : Type*) + -- Probably OK for Semirings? + -- commutativity needed in the below construction for `TensorProduct.piScalarRight` + [CommSemiring M] [CommRing R] [Algebra R M] + [AddCommGroup V] [Module R V] [Module.Finite R V] [Module.Free R V] : + (M ⊗[R] V) ≃ₗ[M] (Module.Free.ChooseBasisIndex R V → M) := by + letI b := Module.Free.chooseBasis R V + letI f := b.equivFun + refine (LinearEquiv.baseChange R M V (Module.Free.ChooseBasisIndex R V → R) f) ≪≫ₗ ?_ + exact TensorProduct.piScalarRight R M M (Module.Free.ChooseBasisIndex R V) diff --git a/FLT/Mathlib/RingTheory/DedekindDomain/FiniteAdeleRing.lean b/FLT/Mathlib/RingTheory/DedekindDomain/FiniteAdeleRing.lean --- a/FLT/Mathlib/RingTheory/DedekindDomain/FiniteAdeleRing.lean +++ b/FLT/Mathlib/RingTheory/DedekindDomain/FiniteAdeleRing.lean @@ -1,5 +1,5 @@ import Mathlib.RingTheory.DedekindDomain.FiniteAdeleRing -import FLT.Mathlib.Topology.Algebra.RestrictedProduct.Basic +import FLT.Mathlib.Topology.Algebra.RestrictedProduct.TopologicalSpace namespace IsDedekindDomain.FiniteAdeleRing @@ -10,8 +10,6 @@ variable (R K : Type*) [CommRing R] [Field K] [IsDedekindDomain R] [Algebra R K] abbrev integralAdeles : Subring (FiniteAdeleRing R K) := RestrictedProduct.structureSubring _ _ _ -section for_mathlib - variable {R K} @[simp] lemma one_apply (v : HeightOneSpectrum R) : (1 : FiniteAdeleRing R K) v = 1 := rfl @@ -31,6 +29,74 @@ lemma mk_apply (f : ∀ v, HeightOneSpectrum.adicCompletion K v) f i ∈ (fun v ↦ ↑(HeightOneSpectrum.adicCompletionIntegers K v)) i) (v : HeightOneSpectrum R) : mk f h v = f v := rfl -end for_mathlib +variable (R K) +/-- +The continuous K-algebra map `𝔸_K^f → Kᵥ` from the finite adele ring of K to a completion. +-/ +def evalContinuousAlgebraMap (j : HeightOneSpectrum R) : + FiniteAdeleRing R K →A[K] j.adicCompletion K := { + __ := RestrictedProduct.evalContinuousAddMonoidHom _ j + map_one' := rfl + map_mul' _ _ := rfl + commutes' _ := rfl + cont := RestrictedProduct.continuous_eval j -- this should be automatic -- why is this + -- field not called continuous_toFun?? + } + +variable [DecidableEq (HeightOneSpectrum R)] in +/-- +The continuous K-linear inclusion Kᵥ → 𝔸_K^f from a completion to the finite K-adeles. +-/ +noncomputable def singleContinuousLinearMap (j : HeightOneSpectrum R) : + j.adicCompletion K →L[K] FiniteAdeleRing R K := { + __ := RestrictedProduct.singleContinuousAddMonoidHom _ j + map_smul' k x := by + open RestrictedProduct in + ext i + change Pi.single j (k • x) i = _ + obtain rfl | h := eq_or_ne i j + · simp [Pi.single_eq_same, -mul_eq_mul_right_iff, FiniteAdeleRing, Algebra.smul_def, + singleContinuousAddMonoidHom_apply_same] + rfl -- (annoying) + · simp [Pi.single_eq_of_ne h, FiniteAdeleRing, Algebra.smul_def, + singleContinuousAddMonoidHom_apply_of_ne _ h _] + } + +variable [DecidableEq (HeightOneSpectrum R)] in +lemma evalContinuousAlgebraMap_singleContinuousLinearMap (j : HeightOneSpectrum R) + (xj : j.adicCompletion K) : + (evalContinuousAlgebraMap R K j) (singleContinuousLinearMap R K j xj) = xj := + Pi.single_eq_same j xj + +variable [DecidableEq (HeightOneSpectrum R)] in +/-- +`localIdempotent R K p` is the finite adele which is 1 at p and 0 elsewhere. +-/ +noncomputable def localIdempotent (p : HeightOneSpectrum R) : FiniteAdeleRing R K := + ⟨Pi.single p 1, by + apply Set.Finite.subset (Set.finite_singleton p) + rw [Set.compl_subset_comm] + intro q hq + simp [Pi.single_eq_of_ne hq]⟩ + +variable [DecidableEq (HeightOneSpectrum R)] in +lemma eval_localIdempotent (p : HeightOneSpectrum R) : + (evalContinuousAlgebraMap R K p) (localIdempotent R K p) = 1 := + Pi.single_eq_same _ _ + +variable [DecidableEq (HeightOneSpectrum R)] in +/-- +The composite `𝔸_K^f --(eval)--> Kᵥ --(single)--> 𝔸_K^f` is multiplication by +the local idempotent at v. +-/ +lemma singleContinuousAlgebraMap_comp_evalContinuousLinearMap (j : HeightOneSpectrum R) : + ((singleContinuousLinearMap R K j).comp + (evalContinuousAlgebraMap R K j).toContinuousLinearMap).toLinearMap = + LinearMap.lsmul (FiniteAdeleRing R K) (FiniteAdeleRing R K) (localIdempotent R K j) := by + ext x q + change Pi.single _ (x j) _ = Pi.single j _ q * _ + obtain rfl | h := eq_or_ne j q + · simp [Pi.single_eq_same] + · simp [Pi.single_eq_of_ne' h] end IsDedekindDomain.FiniteAdeleRing diff --git a/FLT/Mathlib/Topology/Algebra/Module/TensorProduct.lean b/FLT/Mathlib/Topology/Algebra/Module/TensorProduct.lean --- /dev/null +++ b/FLT/Mathlib/Topology/Algebra/Module/TensorProduct.lean @@ -0,0 +1,120 @@ +import Mathlib.Topology.Algebra.Module.Equiv +import FLT.Mathlib.LinearAlgebra.TensorProduct.FiniteFree +import Mathlib.Topology.Algebra.Module.ModuleTopology + +open scoped TensorProduct + +/-- The canonical continuous R-linear isomorphism `M ⊗[R] V ≃ (ι → M)` +where V is a finite free R-module with basis indexed by `ι`, `M` is a commutative +`R`-algebra, and `M ⊗[R] V` has the `M`-module topology. -/ +noncomputable def ContinuousLinearEquiv.chooseBasis_piScalarRight (R M V : Type*) + [CommRing M] [CommRing R] [Algebra R M] + [TopologicalSpace M] [IsTopologicalRing M] + [AddCommGroup V] [Module R V] [Module.Finite R V] [Module.Free R V] + [TopologicalSpace (M ⊗[R] V)] [IsTopologicalAddGroup (M ⊗[R] V)] + [IsModuleTopology M (M ⊗[R] V)] : + (M ⊗[R] V) ≃L[R] (Module.Free.ChooseBasisIndex R V → M) := { + __ := (LinearEquiv.chooseBasis_piScalarRight R M V).restrictScalars _ + continuous_toFun := IsModuleTopology.continuous_of_linearMap + (LinearEquiv.chooseBasis_piScalarRight R M V).toLinearMap + continuous_invFun := IsModuleTopology.continuous_of_linearMap + (LinearEquiv.chooseBasis_piScalarRight R M V).symm.toLinearMap + } + + +namespace ContinuousLinearMap + +/-- The continuous `R`-linear map `M ⊗[R] V → N ⊗[R] V` induced +by a continuous `R`-linear map `M → N`. +-/ +def rTensor {R : Type*} {M N : Type*} (V : Type*) + [CommRing M] [CommRing N] [CommRing R] [Algebra R M] [Algebra R N] + [TopologicalSpace M] [TopologicalSpace N] [IsTopologicalRing M] [IsTopologicalRing N] + (φ : M →L[R] N) + [AddCommGroup V] [Module R V] [Module.Finite R V] [Module.Free R V] + [TopologicalSpace (M ⊗[R] V)] [IsTopologicalAddGroup (M ⊗[R] V)] [IsModuleTopology M (M ⊗[R] V)] + [TopologicalSpace (N ⊗[R] V)] [IsTopologicalAddGroup (N ⊗[R] V)] + [IsModuleTopology N (N ⊗[R] V)] : + (M ⊗[R] V) →L[R] (N ⊗[R] V) := { + __ := LinearMap.rTensor V φ.toLinearMap + cont := by + -- f1 : M ⊗[R] V ≃L[R] (ι → M) + let f1 := ContinuousLinearEquiv.chooseBasis_piScalarRight R M V + -- f2 : (ι → M) →L[R] (ι → N) + let f2 : (Module.Free.ChooseBasisIndex R V → M) →L[R] + (Module.Free.ChooseBasisIndex R V → N) := { + __ := φ.toLinearMap.compLeft (Module.Free.ChooseBasisIndex R V) + } + -- f3 : (N ⊗[R] V) ≃[L]R (ι → N) + let f3 := (ContinuousLinearEquiv.chooseBasis_piScalarRight R N V) + -- f = f3.symm ∘ f2 ∘ f1 + let f := f3.symm.toContinuousLinearMap.comp (f2.comp f1.toContinuousLinearMap) + -- it suffices to show that the map we want to be continuous is f, + -- because f is obviously continuous. + suffices LinearMap.rTensor V ↑φ = f.toLinearMap by + rw [this] + exact f.cont + -- The question is no longer a topological one, it's just algebraic. + -- We now want to change goal from g = f3.symm ∘ f2 ∘ f1 to f3 ∘ g = f2 ∘ f1 + -- and this is annoyingly painful + simp only [f] + push_cast + suffices f3.toLinearMap ∘ₗ (LinearMap.rTensor V φ) = + (f2 ∘ₗ f1.toContinuousLinearMap.toLinearMap) by + rw [← this] + ext + simp + -- but now that's done, it's easy + ext m v j + exact (map_smul φ _ m).symm + } + +lemma rTensor_id_apply {R : Type*} {M : Type*} (V : Type*) + [CommRing M] [CommRing R] [Algebra R M] + [TopologicalSpace M] [IsTopologicalRing M] + [AddCommGroup V] [Module R V] [Module.Finite R V] [Module.Free R V] + [TopologicalSpace (M ⊗[R] V)] [IsTopologicalAddGroup (M ⊗[R] V)] + [IsModuleTopology M (M ⊗[R] V)] (x : M ⊗[R] V) : + rTensor V (.id R M) x = x := by + simp [rTensor] + +lemma rTensor_id {R : Type*} {M : Type*} (V : Type*) + [CommRing M] [CommRing R] [Algebra R M] + [TopologicalSpace M] [IsTopologicalRing M] + [AddCommGroup V] [Module R V] [Module.Finite R V] [Module.Free R V] + [TopologicalSpace (M ⊗[R] V)] [IsTopologicalAddGroup (M ⊗[R] V)] + [IsModuleTopology M (M ⊗[R] V)] : + rTensor V (.id R M) = .id R (M ⊗[R] V) := by + ext x + apply rTensor_id_apply + +lemma rTensor_comp_apply {R : Type*} {M N P : Type*} (V : Type*) + [CommRing M] [CommRing N] [CommRing P] [CommRing R] [Algebra R M] [Algebra R N] [Algebra R P] + [TopologicalSpace M] [IsTopologicalRing M] + [TopologicalSpace N] [IsTopologicalRing N] + [TopologicalSpace P] [IsTopologicalRing P] + (φ : M →L[R] N) + (ψ : N →L[R] P) [AddCommGroup V] [Module R V] [Module.Finite R V] [Module.Free R V] + [TopologicalSpace (M ⊗[R] V)] [IsTopologicalAddGroup (M ⊗[R] V)] [IsModuleTopology M (M ⊗[R] V)] + [TopologicalSpace (N ⊗[R] V)] [IsTopologicalAddGroup (N ⊗[R] V)] [IsModuleTopology N (N ⊗[R] V)] + [TopologicalSpace (P ⊗[R] V)] [IsTopologicalAddGroup (P ⊗[R] V)] [IsModuleTopology P (P ⊗[R] V)] + (x : M ⊗[R] V) : + rTensor V (ψ.comp φ) x = rTensor V ψ (rTensor V φ x) := by + simp [rTensor, LinearMap.rTensor, TensorProduct.map_map] + +lemma rTensor_comp {R : Type*} {M N P : Type*} (V : Type*) + [CommRing M] [CommRing N] [CommRing P] [CommRing R] [Algebra R M] [Algebra R N] [Algebra R P] + [TopologicalSpace M] [IsTopologicalRing M] + [TopologicalSpace N] [IsTopologicalRing N] + [TopologicalSpace P] [IsTopologicalRing P] + (φ : M →L[R] N) + (ψ : N →L[R] P) [AddCommGroup V] [Module R V] [Module.Finite R V] [Module.Free R V] + [TopologicalSpace (M ⊗[R] V)] [IsTopologicalAddGroup (M ⊗[R] V)] [IsModuleTopology M (M ⊗[R] V)] + [TopologicalSpace (N ⊗[R] V)] [IsTopologicalAddGroup (N ⊗[R] V)] [IsModuleTopology N (N ⊗[R] V)] + [TopologicalSpace (P ⊗[R] V)] [IsTopologicalAddGroup (P ⊗[R] V)] + [IsModuleTopology P (P ⊗[R] V)] : + rTensor V (ψ.comp φ) = (rTensor V ψ).comp (rTensor V φ) := by + ext + apply rTensor_comp_apply + +end ContinuousLinearMap diff --git a/FLT/Mathlib/Topology/Algebra/RestrictedProduct/Basic.lean b/FLT/Mathlib/Topology/Algebra/RestrictedProduct/Basic.lean --- a/FLT/Mathlib/Topology/Algebra/RestrictedProduct/Basic.lean +++ b/FLT/Mathlib/Topology/Algebra/RestrictedProduct/Basic.lean @@ -405,4 +405,26 @@ theorem mem_structureSubring_iff {ι : Type*} {R : ι → Type*} {S : ι → Typ end structure_map +section single + +/- + +## Maps from a factor into a restricted product + +-/ + +variable {ι : Type*} [DecidableEq ι] (A : ι → Type*) {𝓕 : Filter ι} + {S : ι → Type*} + [(i : ι) → SetLike (S i) (A i)] {B : (i : ι) → S i} (j : ι) [(i : ι) → AddMonoid (A i)] + [∀ (i : ι), AddSubmonoidClass (S i) (A i)] + +/-- The inclusion from a factor into a restricted product of additive groups. -/ +noncomputable def singleAddMonoidHom (j : ι) : A j →+ Πʳ i, [A i, B i] where + toFun x := ⟨Pi.single j x, by + simpa using (Set.finite_singleton j).subset fun i _ ↦ by by_cases h : i = j <;> simp_all⟩ + map_zero' := by ext; simp + map_add' _ _ := by ext; simp [Pi.single_add] + +end single + end RestrictedProduct diff --git a/FLT/Mathlib/Topology/Algebra/RestrictedProduct/TopologicalSpace.lean b/FLT/Mathlib/Topology/Algebra/RestrictedProduct/TopologicalSpace.lean --- a/FLT/Mathlib/Topology/Algebra/RestrictedProduct/TopologicalSpace.lean +++ b/FLT/Mathlib/Topology/Algebra/RestrictedProduct/TopologicalSpace.lean @@ -523,3 +523,61 @@ noncomputable def ContinuousMulEquiv.restrictedProductPrincipal {ι : Type*} map_mul' _ _ := rfl end equivs + +namespace RestrictedProduct + +section single + +variable {ι : Type*} [DecidableEq ι] {R : Type*} [Semiring R] (A : ι → Type*) {𝓕 : Filter ι} + {S : ι → Type*} + [(i : ι) → SetLike (S i) (A i)] {B : (i : ι) → S i} (j : ι) [(i : ι) → AddCommMonoid (A i)] + [(i : ι) → Module R (A i)] [∀ (i : ι), AddSubmonoidClass (S i) (A i)] + +variable [∀ i, TopologicalSpace (A i)] +open Filter in +/-- +The inclusion from a factor into the restricted product of topological additive groups, +as a continuous group homomorphism. +-/ +noncomputable def singleContinuousAddMonoidHom (j : ι) : A j →ₜ+ Πʳ i, [A i, B i] where + __ := singleAddMonoidHom A j + continuous_toFun := by + let S : Set ι := {j}ᶜ + let single' : A j → Πʳ i, [A i, B i]_[𝓟 S] := + fun x ↦ ⟨Pi.single j x, + eventually_principal.mpr + fun i hi ↦ by simp [Pi.single_eq_of_ne (Set.mem_compl_singleton_iff.mp hi)]⟩ + have : Continuous single' := by + simpa [continuous_rng_of_principal] using continuous_single j + apply (isEmbedding_inclusion_principal + (le_principal_iff.mpr (Set.finite_singleton j).compl_mem_cofinite)).continuous.comp this + +lemma singleContinuousAddMonoidHom_apply_same {j : ι} (x : A j) : + (singleContinuousAddMonoidHom A j x : Πʳ i, [A i, B i]) j = x := + Pi.single_eq_same j x + +lemma singleContinuousAddMonoidHom_apply_of_ne {j i : ι} (h : i ≠ j) (x : A j) : + (singleContinuousAddMonoidHom A j x : Πʳ i, [A i, B i]) i = 0 := + Pi.single_eq_of_ne h x + +end single + +section eval + +variable {ι : Type*} [DecidableEq ι] {R : Type*} [Semiring R] (A : ι → Type*) {𝓕 : Filter ι} + {S : ι → Type*} + [(i : ι) → SetLike (S i) (A i)] {B : (i : ι) → S i} (j : ι) [(i : ι) → AddCommMonoid (A i)] + [(i : ι) → Module R (A i)] [∀ (i : ι), AddSubmonoidClass (S i) (A i)] + +variable [∀ i, TopologicalSpace (A i)] + +/-- The continuous additive projection from a restricted product of topological additive groups +to a factor. -/ +def evalContinuousAddMonoidHom (j : ι) : Πʳ i, [A i, B i] →ₜ+ A j := { + __ := evalAddMonoidHom A j + continuous_toFun := continuous_eval j +} + +end eval + +end RestrictedProduct",409,4,413,4.5,diff_derived,False,0,8,0,10,4,pr_merge,False,leanprover/lean4:v4.29.0,leanbench/lean4-env:4.29.0,lake build,600,lean_compiler,algebra,2026-04-28T12:40:02Z,extraction_pipeline_v2 LB-0018,pr_completion,easy,3.5,leanprover/lean4,13301,feat: add `try? => tac` syntax and parallel cancellation test,https://github.com/leanprover/lean4/pull/13301,"builds-mathlib,toolchain-available,changelog-tactics,mathlib4-nightly-available",ec727859274c18a82f26dd66028e36f380fdd35c,432d11541ba76fb474d5817769f8a9b9a5fd5c4c,"src/Init/Try.lean,src/Lean/Elab/Tactic/Try.lean,src/Lean/Server/Test/Cancel.lean,tests/elab/try_eval_suggest.lean,tests/server_interactive/cancellation_par.lean",src/Init/Try.lean,"# Task: feat: add `try? => tac` syntax and parallel cancellation test ## Context This PR adds a `try? => tac` syntax that runs `evalSuggest` directly on a given tactic, useful for testing the `try?` machinery in isolation. It also adds a server_interactive test (`cancellation_par.lean`) that demonstrates a cancellation bug with parallel tactic combinators. The test contrasts three combinators: - **`first`** (sequential): cancellation works correctly — the tactic runs on the main elaboration thread and shares its cancel token. - **`attempt_all_par`** (parallel): cancellation is broken — the subtask spawned via `asTask` gets a fresh cancel token that is never set on re-elaboration. - **`first_par`** (parallel): same bug as `attempt_all_par`. The test uses a `check_cancel