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

Commit b3b7fe6

Browse files
committed
chore(algebra/module): generalize char_zero.of_algebra to char_zero.of_module (#10609)
1 parent 5d0e65a commit b3b7fe6

File tree

3 files changed

+13
-21
lines changed

3 files changed

+13
-21
lines changed

src/algebra/algebra/basic.lean

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,23 +1220,6 @@ lemma algebra_rat_subsingleton {α} [semiring α] :
12201220

12211221
end rat
12221222

1223-
namespace char_zero
1224-
1225-
variables {R : Type*} (S : Type*) [comm_semiring R] [semiring S] [algebra R S]
1226-
1227-
lemma of_algebra [char_zero S] : char_zero R :=
1228-
begin
1229-
suffices : function.injective (algebra_map R S ∘ coe),
1230-
{ exact this.of_comp },
1231-
convert char_zero.cast_injective,
1232-
ext n,
1233-
rw [function.comp_app, ← (algebra_map ℕ _).eq_nat_cast, ← ring_hom.comp_apply,
1234-
ring_hom.eq_nat_cast],
1235-
all_goals { apply_instance }
1236-
end
1237-
1238-
end char_zero
1239-
12401223
namespace algebra
12411224
open module
12421225

src/algebra/module/basic.lean

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -528,12 +528,22 @@ lemma nat.no_zero_smul_divisors : no_zero_smul_divisors ℕ M :=
528528

529529
variables {M}
530530

531-
lemma eq_zero_of_smul_two_eq_zero {v : M} (hv : 2 • v = 0) : v = 0 :=
531+
lemma eq_zero_of_two_nsmul_eq_zero {v : M} (hv : 2 • v = 0) : v = 0 :=
532532
by haveI := nat.no_zero_smul_divisors R M;
533533
exact (smul_eq_zero.mp hv).resolve_left (by norm_num)
534534

535535
end nat
536536

537+
variables (R M)
538+
539+
/-- If `M` is an `R`-module with one and `M` has characteristic zero, then `R` has characteristic
540+
zero as well. Usually `M` is an `R`-algebra. -/
541+
lemma char_zero.of_module [has_one M] [char_zero M] : char_zero R :=
542+
begin
543+
refine ⟨λ m n h, @nat.cast_injective M _ _ _ _ _ _⟩,
544+
rw [← nsmul_one, ← nsmul_one, nsmul_eq_smul_cast R m (1 : M), nsmul_eq_smul_cast R n (1 : M), h]
545+
end
546+
537547
end module
538548

539549
section add_comm_group -- `R` can still be a semiring here
@@ -559,8 +569,7 @@ include R
559569

560570
lemma eq_zero_of_eq_neg {v : M} (hv : v = - v) : v = 0 :=
561571
begin
562-
haveI := nat.no_zero_smul_divisors R M,
563-
refine eq_zero_of_smul_two_eq_zero R _,
572+
refine eq_zero_of_two_nsmul_eq_zero R _,
564573
rw two_smul,
565574
exact add_eq_zero_iff_eq_neg.mpr hv
566575
end

src/number_theory/number_field.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ protected noncomputable def equiv (R : Type*) [comm_ring R] [algebra R K]
8282

8383
variables (K)
8484

85-
instance [number_field K] : char_zero (ring_of_integers K) := char_zero.of_algebra K
85+
instance [number_field K] : char_zero (ring_of_integers K) := char_zero.of_module _ K
8686

8787
instance [number_field K] : is_dedekind_domain (ring_of_integers K) :=
8888
is_integral_closure.is_dedekind_domain ℤ ℚ K _

0 commit comments

Comments
 (0)