Skip to content

Commit

Permalink
chore(topology/continuous_function/continuous_map): add missing insta…
Browse files Browse the repository at this point in the history
…nces for `continuous_map` (#13717)

This adds instances related to the ring variants, i.e., non-unital, non-associative (semi)rings.


To avoid introducing accidental diamonds, this also changes how the existing instances are constructed, such that they now go through the `function.injective.*` definitions.
  • Loading branch information
j-loreaux committed Apr 26, 2022
1 parent 325dbc8 commit 560d1a7
Showing 1 changed file with 45 additions and 10 deletions.
55 changes: 45 additions & 10 deletions src/topology/continuous_function/algebra.lean
Expand Up @@ -185,6 +185,10 @@ instance {α : Type*} {β : Type*} [topological_space α]
[topological_space β] [mul_zero_class β] [has_continuous_mul β] : mul_zero_class C(α, β) :=
coe_injective.mul_zero_class _ coe_zero coe_mul

instance {α : Type*} {β : Type*} [topological_space α] [topological_space β]
[semigroup_with_zero β] [has_continuous_mul β] : semigroup_with_zero C(α, β) :=
coe_injective.semigroup_with_zero _ coe_zero coe_mul

@[to_additive]
instance {α : Type*} {β : Type*} [topological_space α] [topological_space β]
[monoid β] [has_continuous_mul β] : monoid C(α, β) :=
Expand Down Expand Up @@ -318,27 +322,58 @@ end subtype

namespace continuous_map

instance {α : Type*} {β : Type*} [topological_space α] [topological_space β]
[non_unital_non_assoc_semiring β] [topological_semiring β] :
non_unital_non_assoc_semiring C(α, β) :=
coe_injective.non_unital_non_assoc_semiring _ coe_zero coe_add coe_mul coe_nsmul

instance {α : Type*} {β : Type*} [topological_space α] [topological_space β]
[non_unital_semiring β] [topological_semiring β] :
non_unital_semiring C(α, β) :=
coe_injective.non_unital_semiring _ coe_zero coe_add coe_mul coe_nsmul

instance {α : Type*} {β : Type*} [topological_space α] [topological_space β]
[non_assoc_semiring β] [topological_semiring β] :
non_assoc_semiring C(α, β) :=
coe_injective.non_assoc_semiring _ coe_zero coe_one coe_add coe_mul coe_nsmul

instance {α : Type*} {β : Type*} [topological_space α] [topological_space β]
[semiring β] [topological_semiring β] : semiring C(α, β) :=
{ left_distrib := λ a b c, by ext; exact left_distrib _ _ _,
right_distrib := λ a b c, by ext; exact right_distrib _ _ _,
..continuous_map.add_comm_monoid,
..continuous_map.monoid_with_zero }
coe_injective.semiring _ coe_zero coe_one coe_add coe_mul coe_nsmul coe_pow

instance {α : Type*} {β : Type*} [topological_space α] [topological_space β]
[non_unital_non_assoc_ring β] [topological_ring β] : non_unital_non_assoc_ring C(α, β) :=
coe_injective.non_unital_non_assoc_ring _ coe_zero coe_add coe_mul coe_neg coe_sub
coe_nsmul coe_zsmul

instance {α : Type*} {β : Type*} [topological_space α] [topological_space β]
[non_unital_ring β] [topological_ring β] : non_unital_ring C(α, β) :=
coe_injective.non_unital_ring _ coe_zero coe_add coe_mul coe_neg coe_sub coe_nsmul coe_zsmul

instance {α : Type*} {β : Type*} [topological_space α] [topological_space β]
[non_assoc_ring β] [topological_ring β] : non_assoc_ring C(α, β) :=
coe_injective.non_assoc_ring _ coe_zero coe_one coe_add coe_mul coe_neg coe_sub coe_nsmul coe_zsmul

instance {α : Type*} {β : Type*} [topological_space α] [topological_space β]
[ring β] [topological_ring β] : ring C(α, β) :=
{ ..continuous_map.semiring,
..continuous_map.add_comm_group, }
coe_injective.ring _ coe_zero coe_one coe_add coe_mul coe_neg coe_sub coe_nsmul coe_zsmul coe_pow

instance {α : Type*} {β : Type*} [topological_space α] [topological_space β]
[non_unital_comm_semiring β] [topological_semiring β] : non_unital_comm_semiring C(α, β) :=
coe_injective.non_unital_comm_semiring _ coe_zero coe_add coe_mul coe_nsmul

instance {α : Type*} {β : Type*} [topological_space α]
[topological_space β] [comm_semiring β] [topological_semiring β] : comm_semiring C(α, β) :=
{ ..continuous_map.semiring,
..continuous_map.comm_monoid, }
coe_injective.comm_semiring _ coe_zero coe_one coe_add coe_mul coe_nsmul coe_pow

instance {α : Type*} {β : Type*} [topological_space α] [topological_space β]
[non_unital_comm_ring β] [topological_ring β] : non_unital_comm_ring C(α, β) :=
coe_injective.non_unital_comm_ring _ coe_zero coe_add coe_mul coe_neg coe_sub coe_nsmul coe_zsmul

instance {α : Type*} {β : Type*} [topological_space α]
[topological_space β] [comm_ring β] [topological_ring β] : comm_ring C(α, β) :=
{ ..continuous_map.comm_semiring,
..continuous_map.ring, }
coe_injective.comm_ring _ coe_zero coe_one coe_add coe_mul coe_neg coe_sub coe_nsmul coe_zsmul
coe_pow

/-- Composition on the left by a (continuous) homomorphism of topological semirings, as a
`ring_hom`. Similar to `ring_hom.comp_left`. -/
Expand Down

0 comments on commit 560d1a7

Please sign in to comment.