Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - fix(field_theory/intermediate_field): use a better algebra.smul definition, and generalize #10012

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
47 changes: 28 additions & 19 deletions src/field_theory/intermediate_field.lean
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,26 @@ begin
{ simp [pow_succ, ih] }
end

instance algebra : algebra K S :=
S.to_subalgebra.algebra
/-! `intermediate_field`s inherit structure from their `subalgebra` coercions. -/

instance module' {R} [semiring R] [has_scalar R K] [module R L] [is_scalar_tower R K L] :
module R S :=
S.to_subalgebra.module'
instance module : module K S := S.to_subalgebra.module
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newline?

Suggested change
instance module : module K S := S.to_subalgebra.module
instance module : module K S := S.to_subalgebra.module

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm copying

instance module' [semiring R'] [has_scalar R' R] [module R' A] [is_scalar_tower R' R A] :
module R' S :=
S.to_submodule.module'
instance : module R S := S.module'


@[simp] lemma coe_smul {R} [semiring R] [has_scalar R K] [module R L] [is_scalar_tower R K L]
(r : R) (x : S) :
↑(r • x) = (r • x : L) := rfl

instance algebra' {K'} [comm_semiring K'] [has_scalar K' K] [algebra K' L] [is_scalar_tower K' K L] :
eric-wieser marked this conversation as resolved.
Show resolved Hide resolved
algebra K' S :=
S.to_subalgebra.algebra'
instance algebra : algebra K S := S.to_subalgebra.algebra

instance is_scalar_tower {K'} [comm_semiring K'] [has_scalar K' K] [algebra K' L]
[is_scalar_tower K' K L] :
is_scalar_tower K' K S :=
S.to_subalgebra.is_scalar_tower

instance to_algebra {R : Type*} [semiring R] [algebra L R] : algebra S R :=
S.to_subalgebra.to_algebra
Expand Down Expand Up @@ -285,30 +303,21 @@ instance has_lift2 {F : intermediate_field K L} :
@[simp] lemma mem_lift2 {F : intermediate_field K L} {E : intermediate_field F L} {x : L} :
x ∈ (↑E : intermediate_field K L) ↔ x ∈ E := iff.rfl

instance lift2_alg {F : intermediate_field K L} {E : intermediate_field F L} : algebra K E :=
{ to_fun := (algebra_map F E).comp (algebra_map K F),
map_zero' := ((algebra_map F E).comp (algebra_map K F)).map_zero,
map_one' := ((algebra_map F E).comp (algebra_map K F)).map_one,
map_add' := ((algebra_map F E).comp (algebra_map K F)).map_add,
map_mul' := ((algebra_map F E).comp (algebra_map K F)).map_mul,
smul := λ a b, (((algebra_map F E).comp (algebra_map K F)) a) * b,
smul_def' := λ _ _, rfl,
commutes' := λ a b, mul_comm (((algebra_map F E).comp (algebra_map K F)) a) b }
/-- This was formerly an instance called `lift2_alg`, but an instance above already provides it. -/
example {F : intermediate_field K L} {E : intermediate_field F L} : algebra K E :=
by apply_instance

lemma lift2_algebra_map {F : intermediate_field K L} {E : intermediate_field F L} (k : K) (e : E) :
eric-wieser marked this conversation as resolved.
Show resolved Hide resolved
algebra_map K E = (algebra_map F E).comp (algebra_map K F) := rfl

instance lift2_tower {F : intermediate_field K L} {E : intermediate_field F L} :
is_scalar_tower K F E :=
⟨λ a b c, by { simp only [algebra.smul_def, ring_hom.map_mul, mul_assoc], refl }⟩
E.is_scalar_tower

/-- `lift2` is isomorphic to the original `intermediate_field`. -/
def lift2_alg_equiv {F : intermediate_field K L} (E : intermediate_field F L) :
(↑E : intermediate_field K L) ≃ₐ[K] E :=
{ to_fun := λ x, x,
inv_fun := λ x, x,
left_inv := λ x, rfl,
right_inv := λ x, rfl,
map_add' := λ x y, rfl,
map_mul' := λ x y, rfl,
commutes' := λ x, rfl }
alg_equiv.refl

end tower

Expand Down