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

Commit 0ab9b5f

Browse files
committed
chore(topology/continuous_function/bounded): golf algebra instances (#12082)
Using the `function.injective.*` lemmas saves a lot of proofs. This also adds a few missing lemmas about `one` that were already present for `zero`.
1 parent d86ce02 commit 0ab9b5f

File tree

1 file changed

+26
-32
lines changed

1 file changed

+26
-32
lines changed

src/topology/continuous_function/bounded.lean

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,22 @@ end
500500

501501
end arzela_ascoli
502502

503+
section has_one
504+
505+
variables [topological_space α] [metric_space β] [has_one β]
506+
507+
@[to_additive] instance : has_one (α →ᵇ β) := ⟨const α 1
508+
509+
@[simp, to_additive] lemma coe_one : ((1 : α →ᵇ β) : α → β) = 1 := rfl
510+
511+
@[to_additive] lemma forall_coe_one_iff_one (f : α →ᵇ β) : (∀x, f x = 1) ↔ f = 1 :=
512+
(@ext_iff _ _ _ _ f 1).symm
513+
514+
@[simp, to_additive] lemma one_comp_continuous [topological_space γ] (f : C(γ, α)) :
515+
(1 : α →ᵇ β).comp_continuous f = 1 := rfl
516+
517+
end has_one
518+
503519
section has_lipschitz_add
504520
/- In this section, if `β` is an `add_monoid` whose addition operation is Lipschitz, then we show
505521
that the space of bounded continuous functions from `α` to `β` inherits a topological `add_monoid`
@@ -514,15 +530,6 @@ version. -/
514530

515531
variables [topological_space α] [metric_space β] [add_monoid β]
516532

517-
instance : has_zero (α →ᵇ β) := ⟨const α 0
518-
519-
@[simp] lemma coe_zero : ((0 : α →ᵇ β) : α → β) = 0 := rfl
520-
521-
lemma forall_coe_zero_iff_zero (f : α →ᵇ β) : (∀x, f x = 0) ↔ f = 0 := (@ext_iff _ _ _ _ f 0).symm
522-
523-
@[simp] lemma zero_comp_continuous [topological_space γ] (f : C(γ, α)) :
524-
(0 : α →ᵇ β).comp_continuous f = 0 := rfl
525-
526533
variables [has_lipschitz_add β]
527534
variables (f g : α →ᵇ β) {x : α} {C : ℝ}
528535

@@ -548,11 +555,7 @@ lemma add_comp_continuous [topological_space γ] (h : C(γ, α)) :
548555
(g + f).comp_continuous h = g.comp_continuous h + f.comp_continuous h := rfl
549556

550557
instance : add_monoid (α →ᵇ β) :=
551-
{ add_assoc := assume f g h, by ext; simp [add_assoc],
552-
zero_add := assume f, by ext; simp,
553-
add_zero := assume f, by ext; simp,
554-
.. bounded_continuous_function.has_add,
555-
.. bounded_continuous_function.has_zero }
558+
coe_injective.add_monoid _ coe_zero coe_add
556559

557560
instance : has_lipschitz_add (α →ᵇ β) :=
558561
{ lipschitz_add := ⟨has_lipschitz_add.C β, begin
@@ -752,17 +755,12 @@ instance : has_sub (α →ᵇ β) :=
752755
@[simp] lemma coe_neg : ⇑(-f) = -f := rfl
753756
lemma neg_apply : (-f) x = -f x := rfl
754757

755-
instance : add_comm_group (α →ᵇ β) :=
756-
{ add_left_neg := assume f, by ext; simp,
757-
add_comm := assume f g, by ext; simp [add_comm],
758-
sub_eq_add_neg := assume f g, by { ext, apply sub_eq_add_neg },
759-
..bounded_continuous_function.add_monoid,
760-
..bounded_continuous_function.has_neg,
761-
..bounded_continuous_function.has_sub }
762-
763758
@[simp] lemma coe_sub : ⇑(f - g) = f - g := rfl
764759
lemma sub_apply : (f - g) x = f x - g x := rfl
765760

761+
instance : add_comm_group (α →ᵇ β) :=
762+
coe_injective.add_comm_group _ coe_zero coe_add coe_neg coe_sub
763+
766764
instance : normed_group (α →ᵇ β) :=
767765
{ dist_eq := λ f g, by simp only [norm_eq, dist_eq, dist_eq_norm, sub_apply] }
768766

@@ -914,21 +912,17 @@ pointwise operations and checking that they are compatible with the uniform dist
914912

915913
variables [topological_space α] {R : Type*} [normed_ring R]
916914

917-
instance : ring (α →ᵇ R) :=
918-
{ one := const α 1,
919-
mul := λ f g, of_normed_group (f * g) (f.continuous.mul g.continuous) (∥f∥ * ∥g∥) $ λ x,
915+
instance : has_mul (α →ᵇ R) :=
916+
{ mul := λ f g, of_normed_group (f * g) (f.continuous.mul g.continuous) (∥f∥ * ∥g∥) $ λ x,
920917
le_trans (normed_ring.norm_mul (f x) (g x)) $
921-
mul_le_mul (f.norm_coe_le_norm x) (g.norm_coe_le_norm x) (norm_nonneg _) (norm_nonneg _),
922-
one_mul := λ f, ext $ λ x, one_mul (f x),
923-
mul_one := λ f, ext $ λ x, mul_one (f x),
924-
mul_assoc := λ f₁ f₂ f₃, ext $ λ x, mul_assoc _ _ _,
925-
left_distrib := λ f₁ f₂ f₃, ext $ λ x, left_distrib _ _ _,
926-
right_distrib := λ f₁ f₂ f₃, ext $ λ x, right_distrib _ _ _,
927-
.. bounded_continuous_function.add_comm_group }
918+
mul_le_mul (f.norm_coe_le_norm x) (g.norm_coe_le_norm x) (norm_nonneg _) (norm_nonneg _) }
928919

929920
@[simp] lemma coe_mul (f g : α →ᵇ R) : ⇑(f * g) = f * g := rfl
930921
lemma mul_apply (f g : α →ᵇ R) (x : α) : (f * g) x = f x * g x := rfl
931922

923+
instance : ring (α →ᵇ R) :=
924+
coe_injective.ring _ coe_zero coe_one coe_add coe_mul coe_neg coe_sub
925+
932926
instance : normed_ring (α →ᵇ R) :=
933927
{ norm_mul := λ f g, norm_of_normed_group_le _ (mul_nonneg (norm_nonneg _) (norm_nonneg _)) _,
934928
.. bounded_continuous_function.normed_group }

0 commit comments

Comments
 (0)