Stafford38/Geometry/KaehlerTranscendenceBasis.lean

This project (Stafford38) · 1029fdb382eee06e7b59bcf32801f40931e2079a

1 module
2 
3 public import Mathlib.RingTheory.Kaehler.Polynomial
4 public import Mathlib.RingTheory.Etale.Kaehler
5 public import Mathlib.RingTheory.Etale.Field
6 public import Mathlib.RingTheory.Localization.FractionRing
7 public import Mathlib.RingTheory.AlgebraicIndependent.Adjoin
8 public import Mathlib.LinearAlgebra.TensorProduct.Basis
9 public import Mathlib.LinearAlgebra.Basis.Basic
10 
11 @[expose] public section
12 set_option autoImplicit false
13 
14 open scoped TensorProduct
15 open IntermediateField
16 universe u
17 
18 namespace Stafford38.Geometry
19 noncomputable section
20 
21 /-- A finite transcendence basis gives a basis of the Kähler differentials of the whole field.
22 
23 The construction starts with the standard basis over a multivariable polynomial ring, localizes
24 to its fraction field, transports across the transcendence-basis rational-function equivalence,
25 and then base-changes across the algebraic separable extension. -/
26 def kaehlerDifferentialBasisOfTranscendenceBasis
27     (k L : Type u) [Field k] [CharZero k] [Field L] [Algebra k L]
28     (ι : Type u) [Fintype ι] (x : ι → L) (hx : IsTranscendenceBasis k x) :
29     Module.Basis ι L (KaehlerDifferential k L) := by
30   let S := MvPolynomial ι k
31   let A := FractionRing S
32   let E := IntermediateField.adjoin k (Set.range x)
33   let e : A ≃ₐ[k] E := hx.1.aevalEquivField
34   letI : Algebra S A := inferInstance
35   letI : IsFractionRing S A := inferInstance
36   haveI : Algebra.FormallyEtale S A := Algebra.FormallyEtale.of_isLocalization
37     (nonZeroDivisors S)
38   let loc : A ⊗[S] KaehlerDifferential k S ≃ₗ[A] KaehlerDifferential k A :=
39     KaehlerDifferential.tensorKaehlerEquivOfFormallyEtale k S A
40   let bA : Module.Basis ι A (KaehlerDifferential k A) :=
41     (KaehlerDifferential.mvPolynomialBasis k ι).baseChange A |>.map loc
42   letI : Algebra A E := e.toRingHom.toAlgebra
43   haveI : IsScalarTower k A E := .of_algebraMap_eq fun z => (e.commutes z).symm
44   letI : Algebra E A := e.symm.toRingHom.toAlgebra
45   haveI : IsScalarTower k E A := .of_algebraMap_eq fun z => (e.symm.commutes z).symm
46   let f : KaehlerDifferential k A →ₛₗ[e.toRingHom] KaehlerDifferential k E := {
47     toFun := KaehlerDifferential.map k k A E
48     map_add' := by intro a b; exact (KaehlerDifferential.map k k A E).map_add a b
49     map_smul' := by
50       intro a z
51       change KaehlerDifferential.map k k A E (a • z) = e a • _
52       rw [map_smul]
53       rfl }
54   let g : KaehlerDifferential k E →ₛₗ[e.symm.toRingHom] KaehlerDifferential k A := {
55     toFun := KaehlerDifferential.map k k E A
56     map_add' := by intro a b; exact (KaehlerDifferential.map k k E A).map_add a b
57     map_smul' := by
58       intro a z
59       change KaehlerDifferential.map k k E A (a • z) = e.symm a • _
60       rw [map_smul]
61       rfl }
62   let gf : KaehlerDifferential k A →ₗ[A] KaehlerDifferential k A := {
63     toFun := fun z => g (f z)
64     map_add' := by intro a b; simp only [f.map_add, g.map_add]
65     map_smul' := by
66       intro a z
67       calc
68         g (f (a • z)) = g (e.toRingHom a • f z) := by rw [f.map_smulₛₗ]
69         _ = e.symm.toRingHom (e.toRingHom a) • g (f z) := by rw [g.map_smulₛₗ]
70         _ = a • g (f z) := by
71           have h : e.symm.toRingEquiv.toRingHom (e.toRingEquiv.toRingHom a) = a :=
72             e.toRingEquiv.symm_apply_apply a
73           rw [h] }
74   let fg : KaehlerDifferential k E →ₗ[E] KaehlerDifferential k E := {
75     toFun := fun z => f (g z)
76     map_add' := by intro a b; simp only [g.map_add, f.map_add]
77     map_smul' := by
78       intro a z
79       calc
80         f (g (a • z)) = f (e.symm.toRingHom a • g z) := by rw [g.map_smulₛₗ]
81         _ = e.toRingHom (e.symm.toRingHom a) • f (g z) := by rw [f.map_smulₛₗ]
82         _ = a • f (g z) := by
83           have h : e.toRingEquiv.toRingHom (e.symm.toRingEquiv.toRingHom a) = a :=
84             e.toRingEquiv.apply_symm_apply a
85           rw [h] }
86   have hgf : gf = LinearMap.id := by
87     apply Derivation.liftKaehlerDifferential_unique
88     ext z
89     change KaehlerDifferential.map k k E A
90       (KaehlerDifferential.map k k A E (KaehlerDifferential.D k A z)) = _
91     rw [KaehlerDifferential.map_D, KaehlerDifferential.map_D]
92     congr 1
93     exact e.symm_apply_apply z
94   have hfg : fg = LinearMap.id := by
95     apply Derivation.liftKaehlerDifferential_unique
96     ext z
97     change KaehlerDifferential.map k k A E
98       (KaehlerDifferential.map k k E A (KaehlerDifferential.D k E z)) = _
99     rw [KaehlerDifferential.map_D, KaehlerDifferential.map_D]
100     congr 1
101     exact e.apply_symm_apply z
102   have hbij : Function.Bijective f := by
103     constructor
104     · intro a b h
105       have h' := congrArg g h
106       have ha : g (f a) = a := by
107         have hh := congrArg (fun h : KaehlerDifferential k A →ₗ[A] KaehlerDifferential k A => h a) hgf
108         simpa [gf] using hh
109       have hb : g (f b) = b := by
110         have hh := congrArg (fun h : KaehlerDifferential k A →ₗ[A] KaehlerDifferential k A => h b) hgf
111         simpa [gf] using hh
112       simpa only [ha, hb] using h'
113     · intro b
114       refine ⟨g b, ?_⟩
115       have hb : f (g b) = b := by
116         have hh := congrArg (fun h : KaehlerDifferential k E →ₗ[E] KaehlerDifferential k E => h b) hfg
117         simpa [fg] using hh
118       exact hb
119   let fA : KaehlerDifferential k A →ₗ[A] KaehlerDifferential k E := {
120     toFun := f
121     map_add' := f.map_add
122     map_smul' := by intro a z; exact f.map_smulₛₗ a z }
123   let fAEquiv : KaehlerDifferential k A ≃ₗ[A] KaehlerDifferential k E :=
124     LinearEquiv.ofBijective fA hbij
125   let bEA : Module.Basis ι A (KaehlerDifferential k E) := bA.map fAEquiv
126   let bE : Module.Basis ι E (KaehlerDifferential k E) :=
127     bEA.mapCoeffs e.toRingEquiv (by intro a z; rfl)
128   haveI : Algebra.IsAlgebraic E L := hx.isAlgebraic_field
129   haveI : Algebra.IsIntegral E L := Algebra.isAlgebraic_iff_isIntegral.mp inferInstance
130   haveI : Algebra.IsSeparable E L := inferInstance
131   haveI : Algebra.FormallyEtale E L := Algebra.FormallyEtale.of_isSeparable E L
132   let et : L ⊗[E] KaehlerDifferential k E ≃ₗ[L] KaehlerDifferential k L :=
133     KaehlerDifferential.tensorKaehlerEquivOfFormallyEtale k E L
134   exact (bE.baseChange L).map et
135 
136 /-- The dimension is the cardinality of a finite transcendence basis. -/
137 theorem kaehlerFinrankOfTranscendenceBasis
138     (k L : Type u) [Field k] [CharZero k] [Field L] [Algebra k L]
139     (ι : Type u) [Fintype ι] (x : ι → L) (hx : IsTranscendenceBasis k x) :
140     Module.finrank L (KaehlerDifferential k L) = Fintype.card ι :=
141   Module.finrank_eq_card_basis (kaehlerDifferentialBasisOfTranscendenceBasis k L ι x hx)
142 
143 /-- The Kähler differential module of such a field extension is finite-dimensional. -/
144 theorem kaehlerFiniteOfTranscendenceBasis
145     (k L : Type u) [Field k] [CharZero k] [Field L] [Algebra k L]
146     (ι : Type u) [Fintype ι] (x : ι → L) (hx : IsTranscendenceBasis k x) :
147     Module.Finite L (KaehlerDifferential k L) :=
148   Module.Finite.of_basis (kaehlerDifferentialBasisOfTranscendenceBasis k L ι x hx)
149 
150 end
151 end Stafford38.Geometry
152