forked from leanprover-community/mathlib4
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRingHom.lean
More file actions
100 lines (73 loc) · 3.76 KB
/
Copy pathRingHom.lean
File metadata and controls
100 lines (73 loc) · 3.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/-
Copyright (c) 2015 Nathaniel Thomas. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Nathaniel Thomas, Jeremy Avigad, Johannes Hölzl, Mario Carneiro
-/
module
public import Mathlib.Algebra.GroupWithZero.Action.End
public import Mathlib.Algebra.Module.Defs
public import Mathlib.Algebra.Ring.Hom.Defs
/-!
# Composing modules with a ring hom
## Main definitions
* `Module.compHom`: compose a `Module` with a `RingHom`, with action `f s • m`.
* `RingHom.toModule`: a `RingHom` defines a module structure by `r • x = f r * x`.
## Tags
semimodule, module, vector space
-/
@[expose] public section
assert_not_exists Field Invertible Multiset Pi.single_smul₀ Set.indicator
open Function Set
universe u v
variable {R S M M₂ : Type*}
section AddCommMonoid
variable [Semiring R] [AddCommMonoid M] [Module R M] (r s : R) (x : M)
variable (R)
/-- Push forward the action of `R` on `M` along a compatible surjective map `f : R →+* S`.
See also `Function.Surjective.mulActionLeft` and `Function.Surjective.distribMulActionLeft`.
-/
abbrev Function.Surjective.moduleLeft {R S M : Type*} [Semiring R] [AddCommMonoid M] [Module R M]
[Semiring S] [SMul S M] (f : R →+* S) (hf : Function.Surjective f)
(hsmul : ∀ (c) (x : M), f c • x = c • x) : Module S M :=
{ hf.distribMulActionLeft f.toMonoidHom hsmul with
zero_smul := fun x => by rw [← f.map_zero, hsmul, zero_smul]
add_smul := hf.forall₂.mpr fun a b x => by simp only [← f.map_add, hsmul, add_smul] }
variable {R} (M)
/-- Compose a `Module` with a `RingHom`, with action `f s • m`.
See note [reducible non-instances]. -/
abbrev Module.compHom [Semiring S] (f : S →+* R) : Module S M :=
{ MulActionWithZero.compHom M f.toMonoidWithZeroHom, DistribMulAction.compHom M (f : S →* R) with
-- Porting note: the `show f (r + s) • x = f r • x + f s • x` wasn't needed in mathlib3.
-- Somehow, now that `SMul` is heterogeneous, it can't unfold earlier fields of a definition for
-- use in later fields. See
-- https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Heterogeneous.20scalar.20multiplication
add_smul := fun r s x => show f (r + s) • x = f r • x + f s • x by simp [add_smul] }
lemma Module.compHom_smul [Semiring S] (f : S →+* R) (s : S) (m : M) :
letI := Module.compHom M f; s • m = f s • m :=
rfl
end AddCommMonoid
/-- A ring homomorphism `f : R →+* M` defines a module structure by `r • x = f r * x`.
See note [reducible non-instances]. -/
abbrev RingHom.toModule [Semiring R] [Semiring S] (f : R →+* S) : Module R S :=
Module.compHom S f
lemma RingHom.toModule_smul [Semiring R] [Semiring S] (f : R →+* S) (x : R) (y : S) :
letI := f.toModule
x • y = f x * y :=
rfl
/-- If the module action of `R` on `S` is compatible with multiplication on `S`, then
`fun x ↦ x • 1` is a ring homomorphism from `R` to `S`.
This is the `RingHom` version of `MonoidHom.smulOneHom`.
When `R` is commutative, usually `algebraMap` should be preferred. -/
@[simps!] def RingHom.smulOneHom
[Semiring R] [NonAssocSemiring S] [Module R S] [IsScalarTower R S S] : R →+* S where
__ := MonoidHom.smulOneHom
map_zero' := zero_smul R 1
map_add' := (add_smul · · 1)
/-- A homomorphism between semirings R and S can be equivalently specified by an R-module
structure on S such that S/S/R is a scalar tower. -/
def ringHomEquivModuleIsScalarTower [Semiring R] [Semiring S] :
(R →+* S) ≃ {_inst : Module R S // IsScalarTower R S S} where
toFun f := ⟨Module.compHom S f, SMul.comp.isScalarTower _⟩
invFun := fun ⟨_, _⟩ ↦ RingHom.smulOneHom
left_inv f := RingHom.ext fun r ↦ mul_one (f r)
right_inv := fun ⟨_, _⟩ ↦ Subtype.ext <| Module.ext <| funext₂ <| smul_one_smul S