Stafford38/Geometry/UnitPowerCenterTransport.lean

This project (Stafford38) · 1029fdb382eee06e7b59bcf32801f40931e2079a

1 module
2 public import Mathlib.RingTheory.Localization.AtPrime.Basic
3 
4 @[expose] public section
5 
6 open IsLocalRing
7 
8 universe u
9 
10 def castAtPrimeLocalization
11     {R : Type u} [CommRing R] {P Q : Ideal R} [P.IsPrime] [Q.IsPrime]
12     (hPQ : P = Q) (x : Localization.AtPrime Q) : Localization.AtPrime P := by
13   cases hPQ
14   exact x
15 
16 /-- Transport a unit factorization in the localization at one prime along an
17 equality of primes.  This preserves the same base elements and exponent; only
18 the localization carrier of the unit changes. -/
19 theorem unit_power_factor_transport
20     {R : Type u} [CommRing R]
21     (P Q : Ideal R) [P.IsPrime] [Q.IsPrime] (hPQ : P = Q)
22     (q s : R) (n : ℕ) (uQ : Localization.AtPrime Q)
23     (huQ : IsUnit uQ)
24     (hfactor : algebraMap R (Localization.AtPrime Q) q =
25       (algebraMap R (Localization.AtPrime Q) s) ^ n * uQ) :
26     IsUnit (castAtPrimeLocalization hPQ uQ) ∧
27       algebraMap R (Localization.AtPrime P) q =
28         (algebraMap R (Localization.AtPrime P) s) ^ n *
29           castAtPrimeLocalization hPQ uQ := by
30   cases hPQ
31   exact ⟨huQ, hfactor⟩
32 
33 /-- The two retained powers can be moved together without changing either
34 exponent or the shared uniformizer. -/
35 theorem two_unit_power_factors_transport
36     {R : Type u} [CommRing R]
37     (P Q : Ideal R) [P.IsPrime] [Q.IsPrime] (hPQ : P = Q)
38     (q₀ q₁ s : R) (n₀ n₁ : ℕ)
39     (u₀Q u₁Q : Localization.AtPrime Q)
40     (hu₀Q : IsUnit u₀Q) (hu₁Q : IsUnit u₁Q)
41     (hfactor₀ : algebraMap R (Localization.AtPrime Q) q₀ =
42       (algebraMap R (Localization.AtPrime Q) s) ^ n₀ * u₀Q)
43     (hfactor₁ : algebraMap R (Localization.AtPrime Q) q₁ =
44       (algebraMap R (Localization.AtPrime Q) s) ^ n₁ * u₁Q) :
45     ∃ u₀P u₁P : Localization.AtPrime P,
46       IsUnit u₀P ∧ IsUnit u₁P ∧
47       algebraMap R (Localization.AtPrime P) q₀ =
48         (algebraMap R (Localization.AtPrime P) s) ^ n₀ * u₀P ∧
49       algebraMap R (Localization.AtPrime P) q₁ =
50         (algebraMap R (Localization.AtPrime P) s) ^ n₁ * u₁P := by
51   refine ⟨castAtPrimeLocalization hPQ u₀Q,
52     castAtPrimeLocalization hPQ u₁Q, ?_, ?_, ?_, ?_⟩
53   · exact (unit_power_factor_transport P Q hPQ q₀ s n₀ u₀Q hu₀Q hfactor₀).1
54   · exact (unit_power_factor_transport P Q hPQ q₁ s n₁ u₁Q hu₁Q hfactor₁).1
55   · exact (unit_power_factor_transport P Q hPQ q₀ s n₀ u₀Q hu₀Q hfactor₀).2
56   · exact (unit_power_factor_transport P Q hPQ q₁ s n₁ u₁Q hu₁Q hfactor₁).2
57 
58 /-- The exact shape needed by the same-witness caller: the retained column
59 factors are first obtained at `centerB`, while the public certificate is
60 indexed by `PB`.  This changes only the localization of each unit; the same
61 `s`, `q₀`, `q₁`, and strict-order exponents `a < a + e` remain. -/
62 theorem selected_center_retained_factors_at_canonical_prime
63     {B : Type u} [CommRing B]
64     (PB centerB : Ideal B) [PB.IsPrime] [centerB.IsPrime]
65     (hPB_eq : PB = centerB)
66     (q₀ q₁ s : B) (a e : ℕ)
67     (u₀ u₁ : Localization.AtPrime centerB)
68     (hu₀ : IsUnit u₀) (hu₁ : IsUnit u₁)
69     (hfactor₀ : algebraMap B (Localization.AtPrime centerB) q₀ =
70       (algebraMap B (Localization.AtPrime centerB) s) ^ a * u₀)
71     (hfactor₁ : algebraMap B (Localization.AtPrime centerB) q₁ =
72       (algebraMap B (Localization.AtPrime centerB) s) ^ (a + e) * u₁) :
73     ∃ u₀PB u₁PB : Localization.AtPrime PB,
74       IsUnit u₀PB ∧ IsUnit u₁PB ∧
75       algebraMap B (Localization.AtPrime PB) q₀ =
76         (algebraMap B (Localization.AtPrime PB) s) ^ a * u₀PB ∧
77       algebraMap B (Localization.AtPrime PB) q₁ =
78         (algebraMap B (Localization.AtPrime PB) s) ^ (a + e) * u₁PB := by
79   exact two_unit_power_factors_transport PB centerB hPB_eq q₀ q₁ s a (a + e)
80     u₀ u₁ hu₀ hu₁ hfactor₀ hfactor₁
81 
82 /-- The same explicit equality elimination transports the local maximal-ideal
83 generator statement; rewriting under `AtPrime` can fail because its ring
84 instance is indexed by the prime. -/
85 theorem prime_span_eq_maximalIdeal_transport
86     {R : Type u} [CommRing R]
87     (P Q : Ideal R) [P.IsPrime] [Q.IsPrime] (hPQ : P = Q) (s : R)
88     (hspan : Ideal.span {algebraMap R (Localization.AtPrime Q) s} =
89       maximalIdeal (Localization.AtPrime Q)) :
90     Ideal.span {algebraMap R (Localization.AtPrime P) s} =
91       maximalIdeal (Localization.AtPrime P) := by
92   cases hPQ
93   exact hspan
94