Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit f90fcc9

Browse files
committed
chore(*): use is_algebra_tower instead of algebra.comap and generalize some constructions to semirings (#3299)
`algebra.comap` is now reserved to the **creation** of new algebra instances. For assumptions of theorems / constructions, `is_algebra_tower` is the new way to do it. For example: ```lean variables [algebra K L] [algebra L A] lemma is_algebraic_trans (L_alg : is_algebraic K L) (A_alg : is_algebraic L A) : is_algebraic K (comap K L A) := ``` is now written as: ```lean variables [algebra K L] [algebra L A] [algebra K A] [is_algebra_tower K L A] lemma is_algebraic_trans (L_alg : is_algebraic K L) (A_alg : is_algebraic L A) : is_algebraic K A := ```
1 parent ba8af8c commit f90fcc9

13 files changed

+614
-334
lines changed

src/algebra/lie_algebra.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,8 +466,8 @@ def lie_subalgebra_of_subalgebra (A : Type v) [ring A] [algebra R A]
466466
{ lie_mem := λ x y hx hy, by {
467467
change ⁅x, y⁆ ∈ A', change x ∈ A' at hx, change y ∈ A' at hy,
468468
rw lie_ring.of_associative_ring_bracket,
469-
have hxy := subalgebra.mul_mem A' x y hx hy,
470-
have hyx := subalgebra.mul_mem A' y x hy hx,
469+
have hxy := A'.mul_mem hx hy,
470+
have hyx := A'.mul_mem hy hx,
471471
exact submodule.sub_mem A'.to_submodule hxy hyx, },
472472
..A'.to_submodule }
473473

src/data/mv_polynomial.lean

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,39 @@ end
927927

928928
end total_degree
929929

930+
section aeval
931+
932+
/-! ### The algebra of multivariate polynomials -/
933+
934+
variables (R : Type u) (A : Type v) (f : σ → A)
935+
variables [comm_semiring R] [comm_semiring A] [algebra R A]
936+
937+
/-- A map `σ → A` where `A` is an algebra over `R` generates an `R`-algebra homomorphism
938+
from multivariate polynomials over `σ` to `A`. -/
939+
def aeval : mv_polynomial σ R →ₐ[R] A :=
940+
{ commutes' := λ r, eval₂_C _ _ _
941+
.. eval₂_hom (algebra_map R A) f }
942+
943+
theorem aeval_def (p : mv_polynomial σ R) : aeval R A f p = eval₂ (algebra_map R A) f p := rfl
944+
945+
@[simp] lemma aeval_X (s : σ) : aeval R A f (X s) = f s := eval₂_X _ _ _
946+
947+
@[simp] lemma aeval_C (r : R) : aeval R A f (C r) = algebra_map R A r := eval₂_C _ _ _
948+
949+
theorem eval_unique (φ : mv_polynomial σ R →ₐ[R] A) :
950+
φ = aeval R A (φ ∘ X) :=
951+
begin
952+
ext p,
953+
apply mv_polynomial.induction_on p,
954+
{ intro r, rw aeval_C, exact φ.commutes r },
955+
{ intros f g ih1 ih2,
956+
rw [φ.map_add, ih1, ih2, alg_hom.map_add] },
957+
{ intros p j ih,
958+
rw [φ.map_mul, alg_hom.map_mul, aeval_X, ih] }
959+
end
960+
961+
end aeval
962+
930963
end comm_semiring
931964

932965
section comm_ring
@@ -1069,39 +1102,6 @@ calc (a - b).total_degree = (a + -b).total_degree : by rw sub_eq_
10691102

10701103
end total_degree
10711104

1072-
section aeval
1073-
1074-
/-- The algebra of multivariate polynomials. -/
1075-
1076-
variables (R : Type u) (A : Type v) (f : σ → A)
1077-
variables [comm_ring R] [comm_ring A] [algebra R A]
1078-
1079-
/-- A map `σ → A` where `A` is an algebra over `R` generates an `R`-algebra homomorphism
1080-
from multivariate polynomials over `σ` to `A`. -/
1081-
def aeval : mv_polynomial σ R →ₐ[R] A :=
1082-
{ commutes' := λ r, eval₂_C _ _ _
1083-
.. eval₂_hom (algebra_map R A) f }
1084-
1085-
theorem aeval_def (p : mv_polynomial σ R) : aeval R A f p = eval₂ (algebra_map R A) f p := rfl
1086-
1087-
@[simp] lemma aeval_X (s : σ) : aeval R A f (X s) = f s := eval₂_X _ _ _
1088-
1089-
@[simp] lemma aeval_C (r : R) : aeval R A f (C r) = algebra_map R A r := eval₂_C _ _ _
1090-
1091-
theorem eval_unique (φ : mv_polynomial σ R →ₐ[R] A) :
1092-
φ = aeval R A (φ ∘ X) :=
1093-
begin
1094-
ext p,
1095-
apply mv_polynomial.induction_on p,
1096-
{ intro r, rw aeval_C, exact φ.commutes r },
1097-
{ intros f g ih1 ih2,
1098-
rw [φ.map_add, ih1, ih2, alg_hom.map_add] },
1099-
{ intros p j ih,
1100-
rw [φ.map_mul, alg_hom.map_mul, aeval_X, ih] }
1101-
end
1102-
1103-
end aeval
1104-
11051105
end comm_ring
11061106

11071107
section rename

src/data/polynomial.lean

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,17 +1821,21 @@ section comm_semiring
18211821
variables [comm_semiring R] {p q : polynomial R}
18221822

18231823
section aeval
1824-
/-- `R[X]` is the generator of the category `R-Alg`. -/
1825-
instance polynomial (R : Type u) [comm_semiring R] : algebra R (polynomial R) :=
1826-
{ commutes' := λ _ _, mul_comm _ _,
1827-
smul_def' := λ c p, (polynomial.C_mul' c p).symm,
1828-
.. polynomial.semimodule, .. ring_hom.of polynomial.C }
1824+
instance algebra' (R : Type u) [comm_semiring R] (A : Type v) [semiring A] [algebra R A] :
1825+
algebra R (polynomial A) :=
1826+
{ smul := λ r p, algebra_map R A r • p,
1827+
commutes' := λ c p, ext $ λ n,
1828+
show (C (algebra_map R A c) * p).coeff n = (p * C (algebra_map R A c)).coeff n,
1829+
by rw [coeff_C_mul, coeff_mul_C, algebra.commutes],
1830+
smul_def' := λ c p, (C_mul' _ _).symm,
1831+
.. C.comp (algebra_map R A) }
18291832

18301833
variables (R) (A)
18311834

18321835
-- TODO this could be generalized: there's no need for `A` to be commutative,
18331836
-- we just need that `x` is central.
1834-
variables [comm_ring A] [algebra R A]
1837+
variables [comm_semiring A] [algebra R A]
1838+
variables {B : Type*} [comm_semiring B] [algebra R B]
18351839
variables (x : A)
18361840

18371841
/-- Given a valuation `x` of the variable in an `R`-algebra `A`, `aeval R A x` is
@@ -1859,6 +1863,12 @@ begin
18591863
rw [pow_succ', ← mul_assoc, φ.map_mul, eval₂_mul (algebra_map R A), eval₂_X, ih] }
18601864
end
18611865

1866+
theorem aeval_alg_hom (f : A →ₐ[R] B) (x : A) : aeval R B (f x) = f.comp (aeval R A x) :=
1867+
alg_hom.ext $ λ p, by rw [eval_unique (f.comp (aeval R A x)), alg_hom.comp_apply, aeval_X, aeval_def]
1868+
1869+
theorem aeval_alg_hom_apply (f : A →ₐ[R] B) (x : A) (p) : aeval R B (f x) p = f (aeval R A x p) :=
1870+
alg_hom.ext_iff.1 (aeval_alg_hom f x) p
1871+
18621872
variables [comm_ring S] {f : R →+* S}
18631873

18641874
lemma is_root_of_eval₂_map_eq_zero
@@ -1874,7 +1884,7 @@ lemma is_root_of_aeval_algebra_map_eq_zero [algebra R S] {p : polynomial R}
18741884
{r : R} (hr : aeval R S (algebra_map R S r) p = 0) : p.is_root r :=
18751885
is_root_of_eval₂_map_eq_zero inj hr
18761886

1877-
lemma dvd_term_of_dvd_eval_of_dvd_terms {z p : A} {f : polynomial A} (i : ℕ)
1887+
lemma dvd_term_of_dvd_eval_of_dvd_terms {z p : S} {f : polynomial S} (i : ℕ)
18781888
(dvd_eval : p ∣ f.eval z) (dvd_terms : ∀ (j ≠ i), p ∣ f.coeff j * z ^ j) :
18791889
p ∣ f.coeff i * z ^ i :=
18801890
begin
@@ -1891,7 +1901,7 @@ begin
18911901
exact finsupp.not_mem_support_iff.mp hi }
18921902
end
18931903

1894-
lemma dvd_term_of_is_root_of_dvd_terms {r p : A} {f : polynomial A} (i : ℕ)
1904+
lemma dvd_term_of_is_root_of_dvd_terms {r p : S} {f : polynomial S} (i : ℕ)
18951905
(hr : f.is_root r) (h : ∀ (j ≠ i), p ∣ f.coeff j * r ^ j) : p ∣ f.coeff i * r ^ i :=
18961906
dvd_term_of_dvd_eval_of_dvd_terms i (eq.symm hr ▸ dvd_zero p) h
18971907

src/field_theory/splitting_field.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,12 +289,12 @@ splitting_field_aux.algebra n _
289289

290290
instance algebra_tower {n : ℕ} {f : polynomial α} (hfn : f.nat_degree = n + 1) :
291291
is_algebra_tower α (adjoin_root f.factor) (splitting_field_aux _ _ hfn) :=
292-
is_algebra_tower.of_algebra_map_eq _ _ _ $ λ x, rfl
292+
is_algebra_tower.of_algebra_map_eq $ λ x, rfl
293293

294294
instance algebra_tower' {n : ℕ} {f : polynomial α} (hfn : f.nat_degree = n + 1) :
295295
is_algebra_tower α (adjoin_root f.factor)
296296
(splitting_field_aux n f.remove_factor (nat_degree_remove_factor' hfn)) :=
297-
is_algebra_tower.of_algebra_map_eq _ _ _ $ λ x, rfl
297+
is_algebra_tower.of_algebra_map_eq $ λ x, rfl
298298

299299
theorem algebra_map_succ (n : ℕ) (f : polynomial α) (hfn : f.nat_degree = n + 1) :
300300
by exact algebra_map α (splitting_field_aux _ _ hfn) =

src/linear_algebra/tensor_product.lean

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@ Tensor product of modules over commutative rings.
99
import group_theory.free_abelian_group
1010
import linear_algebra.direct_sum_module
1111

12-
variables {R : Type*} [comm_ring R]
13-
variables {M : Type*} {N : Type*} {P : Type*} {Q : Type*} {S : Type*}
14-
variables [add_comm_group M] [add_comm_group N] [add_comm_group P] [add_comm_group Q] [add_comm_group S]
15-
variables [module R M] [module R N] [module R P] [module R Q] [module R S]
16-
include R
17-
12+
namespace linear_map
1813

14+
variables {R : Type*} [comm_semiring R]
15+
variables {M : Type*} {N : Type*} {P : Type*} {Q : Type*} {S : Type*}
1916

20-
namespace linear_map
17+
variables [add_comm_monoid M] [add_comm_monoid N] [add_comm_monoid P] [add_comm_monoid Q] [add_comm_monoid S]
18+
variables [semimodule R M] [semimodule R N] [semimodule R P] [semimodule R Q] [semimodule R S]
19+
include R
2120

2221
variables (R)
2322
def mk₂ (f : M → N → P)
@@ -64,7 +63,11 @@ variables {R M N P}
6463

6564
theorem map_zero₂ (y) : f 0 y = 0 := (flip f y).map_zero
6665

67-
theorem map_neg₂ (x y) : f (-x) y = -f x y := (flip f y).map_neg _
66+
theorem map_neg₂ {R : Type*} [comm_ring R] {M N P : Type*}
67+
[add_comm_group M] [add_comm_group N] [add_comm_group P]
68+
[module R M] [module R N] [module R P] (f : M →ₗ[R] N →ₗ[R] P) (x y) :
69+
f (-x) y = -f x y :=
70+
(flip f y).map_neg _
6871

6972
theorem map_add₂ (x₁ x₂ y) : f (x₁ + x₂) y = f x₁ y + f x₂ y := (flip f y).map_add _ _
7073

@@ -112,6 +115,13 @@ variables {R M}
112115

113116
end linear_map
114117

118+
variables {R : Type*} [comm_ring R]
119+
variables {M : Type*} {N : Type*} {P : Type*} {Q : Type*} {S : Type*}
120+
121+
variables [add_comm_group M] [add_comm_group N] [add_comm_group P] [add_comm_group Q] [add_comm_group S]
122+
variables [module R M] [module R N] [module R P] [module R Q] [module R S]
123+
include R
124+
115125
variables (M N)
116126

117127
namespace tensor_product
@@ -236,7 +246,7 @@ instance : semimodule R (M ⊗ N) := semimodule.of_core
236246
(smul_tmul _ _ _).symm
237247

238248
variables (R M N)
239-
def mk : M →ₗ N →ₗ M ⊗ N :=
249+
def mk : M →ₗ N →ₗ M ⊗[R] N :=
240250
linear_map.mk₂ R (⊗ₜ) add_tmul (λ c m n, by rw [smul_tmul, tmul_smul]) tmul_add tmul_smul
241251
variables {R M N}
242252

@@ -354,7 +364,7 @@ theorem lift_compr₂ (g : P →ₗ Q) : lift (f.compr₂ g) = g.comp (lift f) :
354364
eq.symm $ lift.unique $ λ x y, by simp
355365

356366
theorem lift_mk_compr₂ (f : M ⊗ N →ₗ P) : lift ((mk R M N).compr₂ f) = f :=
357-
by rw [lift_compr₂, lift_mk, linear_map.comp_id]
367+
by rw [lift_compr₂ f, lift_mk, linear_map.comp_id]
358368

359369
@[ext]
360370
theorem ext {g h : (M ⊗[R] N) →ₗ[R] P}
@@ -500,7 +510,7 @@ end
500510
rfl
501511

502512
/-- The tensor product of a pair of linear maps between modules. -/
503-
def map (f : M →ₗ[R] P) (g : N →ₗ Q) : M ⊗ N →ₗ P ⊗ Q :=
513+
def map (f : M →ₗ[R] P) (g : N →ₗ Q) : M ⊗ N →ₗ[R] P ⊗ Q :=
504514
lift $ comp (compl₂ (mk _ _ _) g) f
505515

506516
@[simp] theorem map_tmul (f : M →ₗ[R] P) (g : N →ₗ[R] Q) (m : M) (n : N) :

0 commit comments

Comments
 (0)