Skip to content

Commit d411237

Browse files
committed
chore: capitalise Injective (#501)
We had previously been changing mathport output to write `Function.injective` rather than `Function.Injective`. At #498 (comment) @digama0 pointed out that mathport is capitalising correctly here. This PR re-capitalises `Injective`, `Surjective`, `Bijective`, and `Involutive`, all in the `Function` namespace. Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
1 parent 9efcb95 commit d411237

File tree

14 files changed

+170
-170
lines changed

14 files changed

+170
-170
lines changed

Mathlib/Algebra/Group/Basic.lean

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,15 @@ section HasInvolutiveInv
143143
variable [HasInvolutiveInv G] {a b : G}
144144

145145
@[simp, to_additive]
146-
theorem inv_involutive : Function.involutive (Inv.inv : G → G) :=
146+
theorem inv_involutive : Function.Involutive (Inv.inv : G → G) :=
147147
inv_inv
148148

149149
@[simp, to_additive]
150-
theorem inv_surjective : Function.surjective (Inv.inv : G → G) :=
150+
theorem inv_surjective : Function.Surjective (Inv.inv : G → G) :=
151151
inv_involutive.surjective
152152

153153
@[to_additive]
154-
theorem inv_injective : Function.injective (Inv.inv : G → G) :=
154+
theorem inv_injective : Function.Injective (Inv.inv : G → G) :=
155155
inv_involutive.injective
156156

157157
@[simp, to_additive]
@@ -403,11 +403,11 @@ variable [Group G] {a b c d : G}
403403
theorem div_eq_inv_self : a / b = b⁻¹ ↔ a = 1 := by rw [div_eq_mul_inv, mul_left_eq_self]
404404

405405
@[to_additive]
406-
theorem mul_left_surjective (a : G) : Function.surjective ((· * ·) a) :=
406+
theorem mul_left_surjective (a : G) : Function.Surjective ((· * ·) a) :=
407407
fun x => ⟨a⁻¹ * x, mul_inv_cancel_left a x⟩
408408

409409
@[to_additive]
410-
theorem mul_right_surjective (a : G) : Function.surjective fun x => x * a := fun x =>
410+
theorem mul_right_surjective (a : G) : Function.Surjective fun x => x * a := fun x =>
411411
⟨x * a⁻¹, inv_mul_cancel_right x a⟩
412412

413413
@[to_additive]
@@ -473,13 +473,13 @@ theorem mul_inv_eq_one : a * b⁻¹ = 1 ↔ a = b := by rw [mul_eq_one_iff_eq_in
473473
theorem inv_mul_eq_one : a⁻¹ * b = 1 ↔ a = b := by rw [mul_eq_one_iff_eq_inv, inv_inj]
474474

475475
@[to_additive]
476-
theorem div_left_injective : Function.injective fun a => a / b := by
476+
theorem div_left_injective : Function.Injective fun a => a / b := by
477477
-- FIXME this could be by `simpa`, but it fails. This is probably a bug in `simpa`.
478478
simp only [div_eq_mul_inv]
479479
exact fun a a' h => mul_left_injective b⁻¹ h
480480

481481
@[to_additive]
482-
theorem div_right_injective : Function.injective fun a => b / a := by
482+
theorem div_right_injective : Function.Injective fun a => b / a := by
483483
-- FIXME see above
484484
simp only [div_eq_mul_inv]
485485
exact fun a a' h => inv_injective (mul_right_injective b h)

Mathlib/Algebra/Group/Defs.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ theorem mul_left_cancel_iff : a * b = a * c ↔ b = c :=
177177
⟨mul_left_cancel, congr_arg _⟩
178178

179179
@[to_additive]
180-
theorem mul_right_injective (a : G) : Function.injective ((· * ·) a) := fun _ _ => mul_left_cancel
180+
theorem mul_right_injective (a : G) : Function.Injective ((· * ·) a) := fun _ _ => mul_left_cancel
181181

182182
@[simp, to_additive]
183183
theorem mul_right_inj (a : G) {b c : G} : a * b = a * c ↔ b = c :=
@@ -215,7 +215,7 @@ theorem mul_right_cancel_iff : b * a = c * a ↔ b = c :=
215215
⟨mul_right_cancel, congr_arg (· * a)⟩
216216

217217
@[to_additive]
218-
theorem mul_left_injective (a : G) : Function.injective (· * a) := fun _ _ => mul_right_cancel
218+
theorem mul_left_injective (a : G) : Function.Injective (· * a) := fun _ _ => mul_right_cancel
219219

220220
@[simp, to_additive]
221221
theorem mul_left_inj (a : G) {b c : G} : b * a = c * a ↔ b = c :=
@@ -846,7 +846,7 @@ end Group
846846

847847
@[to_additive]
848848
theorem Group.toDivInvMonoid_injective {G : Type _} :
849-
Function.injective (@Group.toDivInvMonoid G) := by rintro ⟨⟩ ⟨⟩ ⟨⟩; rfl
849+
Function.Injective (@Group.toDivInvMonoid G) := by rintro ⟨⟩ ⟨⟩ ⟨⟩; rfl
850850

851851
/-- An additive commutative group is an additive group with commutative `(+)`. -/
852852
class AddCommGroup (G : Type u) extends AddGroup G, AddCommMonoid G
@@ -860,7 +860,7 @@ attribute [to_additive AddCommGroup.toAddCommMonoid] CommGroup.toCommMonoid
860860
attribute [instance] AddCommGroup.toAddCommMonoid
861861

862862
@[to_additive]
863-
theorem CommGroup.toGroup_injective {G : Type u} : Function.injective (@CommGroup.toGroup G) := by
863+
theorem CommGroup.toGroup_injective {G : Type u} : Function.Injective (@CommGroup.toGroup G) := by
864864
rintro ⟨⟩ ⟨⟩ ⟨⟩; rfl
865865

866866
section CommGroup

Mathlib/Data/List/Basic.lean

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ namespace List
2828
-- instance : is_associative (List α) has_append.append :=
2929
-- ⟨ append_assoc ⟩
3030

31-
@[simp] theorem cons_injective {a : α} : injective (cons a) :=
31+
@[simp] theorem cons_injective {a : α} : Injective (cons a) :=
3232
λ _ _ Pe => tail_eq_of_cons_eq Pe
3333

3434
/-! ### mem -/
@@ -53,7 +53,7 @@ fun p1 p2 => fun Pain => absurd (eq_or_mem_of_mem_cons Pain) (not_or.mpr ⟨p1,
5353
theorem ne_and_not_mem_of_not_mem_cons {a y : α} {l : List α} : (a ∉ y::l) → a ≠ y ∧ a ∉ l :=
5454
fun p => And.intro (ne_of_not_mem_cons p) (not_mem_of_not_mem_cons p)
5555

56-
theorem mem_map_of_injective {f : α → β} (H : injective f) {a : α} {l : List α} :
56+
theorem mem_map_of_injective {f : α → β} (H : Injective f) {a : α} {l : List α} :
5757
f a ∈ map f l ↔ a ∈ l :=
5858
fun m => let ⟨_, m', e⟩ := exists_of_mem_map m
5959
H e ▸ m', mem_map_of_mem _⟩
@@ -78,7 +78,7 @@ lemma exists_of_length_succ {n} :
7878
| h :: t, _ => ⟨h, t, rfl⟩
7979

8080
@[simp]
81-
lemma length_injective_iff : injective (List.length : List α → ℕ) ↔ Subsingleton α := by
81+
lemma length_injective_iff : Injective (List.length : List α → ℕ) ↔ Subsingleton α := by
8282
constructor
8383
· intro h; refine ⟨λ x y => ?_⟩; (suffices [x] = [y] by simpa using this); apply h; rfl
8484
· intros hα l1 l2 hl
@@ -91,7 +91,7 @@ lemma length_injective_iff : injective (List.length : List α → ℕ) ↔ Subsi
9191
· apply ih; simpa using hl
9292

9393
@[simp default+1]
94-
lemma length_injective [Subsingleton α] : injective (length : List α → ℕ) :=
94+
lemma length_injective [Subsingleton α] : Injective (length : List α → ℕ) :=
9595
length_injective_iff.mpr inferInstance
9696

9797
/-! ### set-theoretic notation of Lists -/
@@ -173,10 +173,10 @@ theorem append_left_cancel {s t₁ t₂ : List α} (h : s ++ t₁ = s ++ t₂) :
173173
theorem append_right_cancel {s₁ s₂ t : List α} (h : s₁ ++ t = s₂ ++ t) : s₁ = s₂ :=
174174
(append_left_inj _).1 h
175175

176-
theorem append_right_injective (s : List α) : injective fun t => s ++ t :=
176+
theorem append_right_injective (s : List α) : Injective fun t => s ++ t :=
177177
fun _ _ => append_left_cancel
178178

179-
theorem append_left_injective (t : List α) : injective fun s => s ++ t :=
179+
theorem append_left_injective (t : List α) : Injective fun s => s ++ t :=
180180
fun _ _ => append_right_cancel
181181

182182
/-! ### nth element -/

Mathlib/Data/List/Nodup.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ theorem Nodup.map_on {f : α → β} (H : ∀ x ∈ l, ∀ y ∈ l, f x = f y
2020
(map f l).Nodup :=
2121
Pairwise.map _ (fun a b ⟨ma, mb, n⟩ e => n (H a ma b mb e)) (Pairwise.and_mem.1 d)
2222

23-
protected theorem Nodup.map {f : α → β} (hf : Function.injective f) : Nodup l → Nodup (map f l) :=
23+
protected theorem Nodup.map {f : α → β} (hf : Function.Injective f) : Nodup l → Nodup (map f l) :=
2424
Nodup.map_on fun _ _ _ _ h => hf h
2525

2626
theorem Nodup.of_map (f : α → β) {l : List α} : Nodup (map f l) → Nodup l :=

Mathlib/Data/Option/Basic.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import Mathlib.Logic.Basic
99

1010
namespace Option
1111

12-
theorem some_injective (α : Type _) : Function.injective (@some α) :=
12+
theorem some_injective (α : Type _) : Function.Injective (@some α) :=
1313
fun _ _ => some_inj.mp
1414

1515
/-- `option.map f` is injective if `f` is injective. -/
16-
theorem map_injective {f : α → β} (Hf : Function.injective f) : Function.injective (Option.map f)
16+
theorem map_injective {f : α → β} (Hf : Function.Injective f) : Function.Injective (Option.map f)
1717
| none, none, _ => rfl
1818
| some a₁, some a₂, H => by rw [Hf (Option.some.inj H)]
1919

Mathlib/Data/Prod.lean

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ theorem mk.inj_iff {a₁ a₂ : α} {b₁ b₂ : β} : (a₁, b₁) = (a₂, b
6868
by intro hab; rw [hab.left, hab.right]⟩
6969

7070
lemma mk.inj_left {α β : Type _} (a : α) :
71-
Function.injective (Prod.mk a : β → α × β) :=
71+
Function.Injective (Prod.mk a : β → α × β) :=
7272
fun _ _ h => (Prod.mk.inj h).right
7373

7474
lemma mk.inj_right {α β : Type _} (b : β) :
75-
Function.injective (λ a => Prod.mk a b : α → α × β) :=
75+
Function.Injective (λ a => Prod.mk a b : α → α × β) :=
7676
fun _ _ h => (Prod.mk.inj h).left
7777

7878
-- Port note: this lemma comes from lean3/library/init/data/prod.lean.
@@ -94,16 +94,16 @@ by ext <;> simp
9494
lemma id_prod : (λ (p : α × α) => (p.1, p.2)) = id :=
9595
funext $ λ ⟨_, _⟩ => rfl
9696

97-
lemma fst_surjective [h : Nonempty β] : Function.surjective (@fst α β) :=
97+
lemma fst_surjective [h : Nonempty β] : Function.Surjective (@fst α β) :=
9898
λ x => h.elim $ λ y => ⟨⟨x, y⟩, rfl⟩
9999

100-
lemma snd_surjective [h : Nonempty α] : Function.surjective (@snd α β) :=
100+
lemma snd_surjective [h : Nonempty α] : Function.Surjective (@snd α β) :=
101101
λ y => h.elim $ λ x => ⟨⟨x, y⟩, rfl⟩
102102

103-
lemma fst_injective [Subsingleton β] : Function.injective (@fst α β) :=
103+
lemma fst_injective [Subsingleton β] : Function.Injective (@fst α β) :=
104104
λ x y h => ext' h (Subsingleton.elim x.snd y.snd)
105105

106-
lemma snd_injective [Subsingleton α] : Function.injective (@snd α β) :=
106+
lemma snd_injective [Subsingleton α] : Function.Injective (@snd α β) :=
107107
λ _ _ h => ext' (Subsingleton.elim _ _) h
108108

109109
/-- Swap the factors of a product. `swap (a, b) = (b, a)` -/
@@ -127,13 +127,13 @@ swap_swap
127127
lemma swap_RightInverse : Function.RightInverse (@swap α β) swap :=
128128
swap_swap
129129

130-
lemma swap_injective : Function.injective (@swap α β) :=
130+
lemma swap_injective : Function.Injective (@swap α β) :=
131131
swap_LeftInverse.injective
132132

133-
lemma swap_surjective : Function.surjective (@swap α β) :=
133+
lemma swap_surjective : Function.Surjective (@swap α β) :=
134134
Function.RightInverse.surjective swap_LeftInverse
135135

136-
lemma swap_bijective : Function.bijective (@swap α β) :=
136+
lemma swap_bijective : Function.Bijective (@swap α β) :=
137137
⟨swap_injective, swap_surjective⟩
138138

139139
@[simp] lemma swap_inj {p q : α × β} : swap p = swap q ↔ p = q :=
@@ -167,17 +167,17 @@ end Prod
167167

168168
open Function
169169

170-
lemma Function.injective.prod_map {f : α → γ} {g : β → δ} (hf : injective f) (hg : injective g) :
171-
injective (Prod.map f g) :=
170+
lemma Function.Injective.prod_map {f : α → γ} {g : β → δ} (hf : Injective f) (hg : Injective g) :
171+
Injective (Prod.map f g) :=
172172
by intros x y h
173173
have h1 := (Prod.ext_iff.1 h).1
174174
rw [Prod.map_fst, Prod.map_fst] at h1
175175
have h2 := (Prod.ext_iff.1 h).2
176176
rw [Prod.map_snd, Prod.map_snd] at h2
177177
exact Prod.ext' (hf h1) (hg h2)
178178

179-
lemma Function.surjective.prod_map {f : α → γ} {g : β → δ} (hf : surjective f) (hg : surjective g) :
180-
surjective (Prod.map f g) :=
179+
lemma Function.Surjective.prod_map {f : α → γ} {g : β → δ} (hf : Surjective f) (hg : Surjective g) :
180+
Surjective (Prod.map f g) :=
181181
λ p => let ⟨x, hx⟩ := hf p.1
182182
let ⟨y, hy⟩ := hg p.2
183183
⟨(x, y), Prod.ext' hx hy⟩

Mathlib/Data/Sigma/Basic.lean

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -90,31 +90,31 @@ def map (f₁ : α₁ → α₂) (f₂ : ∀ a, β₁ a → β₂ (f₁ a)) (x :
9090

9191
end Sigma
9292

93-
theorem sigma_mk_injective {i : α} : Function.injective (@Sigma.mk α β i)
93+
theorem sigma_mk_injective {i : α} : Function.Injective (@Sigma.mk α β i)
9494
| _, _, rfl => rfl
9595

96-
theorem Function.injective.sigma_map {f₁ : α₁ → α₂} {f₂ : ∀ a, β₁ a → β₂ (f₁ a)}
97-
(h₁ : Function.injective f₁) (h₂ : ∀ a, Function.injective (f₂ a)) :
98-
Function.injective (Sigma.map f₁ f₂)
96+
theorem Function.Injective.sigma_map {f₁ : α₁ → α₂} {f₂ : ∀ a, β₁ a → β₂ (f₁ a)}
97+
(h₁ : Function.Injective f₁) (h₂ : ∀ a, Function.Injective (f₂ a)) :
98+
Function.Injective (Sigma.map f₁ f₂)
9999
| ⟨i, x⟩, ⟨j, y⟩, h => by
100100
obtain rfl : i = j := h₁ (Sigma.mk.inj_iff.mp h).1
101101
obtain rfl : x = y := h₂ i (sigma_mk_injective h)
102102
rfl
103103

104-
theorem Function.injective.of_sigma_map {f₁ : α₁ → α₂} {f₂ : ∀ a, β₁ a → β₂ (f₁ a)}
105-
(h : Function.injective (Sigma.map f₁ f₂)) (a : α₁) : Function.injective (f₂ a) :=
104+
theorem Function.Injective.of_sigma_map {f₁ : α₁ → α₂} {f₂ : ∀ a, β₁ a → β₂ (f₁ a)}
105+
(h : Function.Injective (Sigma.map f₁ f₂)) (a : α₁) : Function.Injective (f₂ a) :=
106106
fun x y hxy =>
107107
sigma_mk_injective <| @h ⟨a, x⟩ ⟨a, y⟩ (Sigma.ext rfl (heq_of_eq hxy))
108108

109-
theorem Function.injective.sigma_map_iff {f₁ : α₁ → α₂} {f₂ : ∀ a, β₁ a → β₂ (f₁ a)}
110-
(h₁ : Function.injective f₁) :
111-
Function.injective (Sigma.map f₁ f₂) ↔ ∀ a, Function.injective (f₂ a) :=
109+
theorem Function.Injective.sigma_map_iff {f₁ : α₁ → α₂} {f₂ : ∀ a, β₁ a → β₂ (f₁ a)}
110+
(h₁ : Function.Injective f₁) :
111+
Function.Injective (Sigma.map f₁ f₂) ↔ ∀ a, Function.Injective (f₂ a) :=
112112
fun h => h.of_sigma_map, h₁.sigma_map⟩
113113

114-
theorem Function.surjective.sigma_map {f₁ : α₁ → α₂} {f₂ : ∀ a, β₁ a → β₂ (f₁ a)}
115-
(h₁ : Function.surjective f₁) (h₂ : ∀ a, Function.surjective (f₂ a)) :
116-
Function.surjective (Sigma.map f₁ f₂) := by
117-
simp only [Function.surjective, Sigma.forall, h₁.forall]
114+
theorem Function.Surjective.sigma_map {f₁ : α₁ → α₂} {f₂ : ∀ a, β₁ a → β₂ (f₁ a)}
115+
(h₁ : Function.Surjective f₁) (h₂ : ∀ a, Function.Surjective (f₂ a)) :
116+
Function.Surjective (Sigma.map f₁ f₂) := by
117+
simp only [Function.Surjective, Sigma.forall, h₁.forall]
118118
exact fun i => (h₂ _).forall.2 fun x => ⟨⟨i, x⟩, rfl⟩
119119

120120
/-- Interpret a function on `Σ x : α, β x` as a dependent function with two arguments.

Mathlib/Data/Subtype.lean

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ ext_iff
7070
theorem coe_eq_iff {a : {a // p a}} {b : α} : ↑a = b ↔ ∃ h, a = ⟨b, h⟩ :=
7171
⟨λ h => h ▸ ⟨a.2, (coe_eta _ _).symm⟩, λ ⟨_, ha⟩ => ha.symm ▸ rfl⟩
7272

73-
theorem coe_injective : injective ((↑·) : Subtype p → α) :=
73+
theorem coe_injective : Injective ((↑·) : Subtype p → α) :=
7474
by intros a b hab
7575
exact Subtype.ext hab
7676

77-
theorem val_injective : injective (@val _ p) :=
77+
theorem val_injective : Injective (@val _ p) :=
7878
coe_injective
7979

8080
/-- Restrict a (dependent) function to a subtype -/
@@ -87,27 +87,27 @@ lemma restrict_apply {α} {β : α → Type _} (f : ∀x, β x) (p : α → Prop
8787
-- FIXME: replace Subtype.val with (↑)
8888
lemma restrict_def {α β} (f : α → β) (p : α → Prop) : restrict f p = f ∘ Subtype.val := rfl
8989

90-
lemma restrict_injective {α β} {f : α → β} (p : α → Prop) (h : injective f) :
91-
injective (restrict f p) :=
90+
lemma restrict_injective {α β} {f : α → β} (p : α → Prop) (h : Injective f) :
91+
Injective (restrict f p) :=
9292
h.comp coe_injective
9393

9494
/-- Defining a map into a subtype, this can be seen as an "coinduction principle" of `Subtype`-/
9595
def coind {α β} (f : α → β) {p : β → Prop} (h : ∀a, p (f a)) : α → Subtype p :=
9696
λ a => ⟨f a, h a⟩
9797

9898
theorem coind_injective {α β} {f : α → β} {p : β → Prop} (h : ∀a, p (f a))
99-
(hf : injective f) : injective (coind f h) :=
99+
(hf : Injective f) : Injective (coind f h) :=
100100
by intros x y hxy
101101
refine hf ?_
102102
apply congrArg Subtype.val hxy
103103

104104
theorem coind_surjective {α β} {f : α → β} {p : β → Prop} (h : ∀a, p (f a))
105-
(hf : surjective f) : surjective (coind f h) :=
105+
(hf : Surjective f) : Surjective (coind f h) :=
106106
λ x => let ⟨a, ha⟩ := hf x
107107
⟨a, coe_injective ha⟩
108108

109109
theorem coind_bijective {α β} {f : α → β} {p : β → Prop} (h : ∀a, p (f a))
110-
(hf : bijective f) : bijective (coind f h) :=
110+
(hf : Bijective f) : Bijective (coind f h) :=
111111
⟨coind_injective h hf.1, coind_surjective h hf.2
112112

113113
/-- Restriction of a function to a function on subtypes. -/
@@ -124,11 +124,11 @@ theorem map_id {p : α → Prop} {h : ∀a, p a → p (id a)} : map (@id α) h =
124124
funext fun ⟨_, _⟩ => rfl
125125

126126
lemma map_injective {p : α → Prop} {q : β → Prop} {f : α → β} (h : ∀a, p a → q (f a))
127-
(hf : injective f) : injective (map f h) :=
127+
(hf : Injective f) : Injective (map f h) :=
128128
coind_injective _ $ hf.comp coe_injective
129129

130130
lemma map_involutive {p : α → Prop} {f : α → α} (h : ∀a, p a → p (f a))
131-
(hf : involutive f) : involutive (map f h) :=
131+
(hf : Involutive f) : Involutive (map f h) :=
132132
λ x => Subtype.ext (hf x)
133133

134134
instance [HasEquiv α] (p : α → Prop) : HasEquiv (Subtype p) :=

0 commit comments

Comments
 (0)