Skip to content

Commit 3a5524d

Browse files
committed
refactor: simplify InjOn univ f to Injective f (#31024)
This follows the pattern set by basically all other pairs of unrestricted/restricted predicates.
1 parent 147805a commit 3a5524d

File tree

13 files changed

+31
-33
lines changed

13 files changed

+31
-33
lines changed

Mathlib/Algebra/BigOperators/Expect.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ See `Function.Bijective.expect_comp` for a version without `h`. -/
396396
lemma expect_bijective (e : ι → κ) (he : Bijective e) (f : ι → M) (g : κ → M)
397397
(h : ∀ i, f i = g (e i)) : 𝔼 i, f i = 𝔼 i, g i :=
398398
expect_nbij e (fun _ _ ↦ mem_univ _) (fun i _ ↦ h i) he.injective.injOn <| by
399-
simpa using he.surjective.surjOn _
399+
simpa using he.surjective
400400

401401
/-- `Fintype.expect_equiv` is a specialization of `Finset.expect_bij` that automatically fills in
402402
most arguments.

Mathlib/Algebra/BigOperators/Finprod.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,7 @@ theorem finprod_mem_eq_of_bijOn {s : Set α} {t : Set β} {f : α → M} {g : β
848848
theorem finprod_eq_of_bijective {f : α → M} {g : β → M} (e : α → β) (he₀ : Bijective e)
849849
(he₁ : ∀ x, f x = g (e x)) : ∏ᶠ i, f i = ∏ᶠ j, g j := by
850850
rw [← finprod_mem_univ f, ← finprod_mem_univ g]
851-
exact finprod_mem_eq_of_bijOn _ (bijective_iff_bijOn_univ.mp he₀) fun x _ => he₁ x
851+
exact finprod_mem_eq_of_bijOn _ he₀.bijOn_univ fun x _ => he₁ x
852852

853853
/-- See also `finprod_eq_of_bijective`, `Fintype.prod_bijective` and `Finset.prod_bij`. -/
854854
@[to_additive

Mathlib/Data/Fintype/Defs.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ end BundledHoms
227227

228228
theorem nodup_map_univ_iff_injective [Fintype α] {f : α → β} :
229229
(Multiset.map f univ.val).Nodup ↔ Function.Injective f := by
230-
rw [nodup_map_iff_injOn, coe_univ, Set.injective_iff_injOn_univ]
230+
rw [nodup_map_iff_injOn, coe_univ, Set.injOn_univ]
231231

232232
instance decidableInjectiveFintype [DecidableEq β] [Fintype α] :
233233
DecidablePred (Injective : (α → β) → Prop) :=

Mathlib/Data/Set/Function.lean

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,10 @@ theorem injOn_insert {f : α → β} {s : Set α} {a : α} (has : a ∉ s) :
286286
rw [← union_singleton, injOn_union (disjoint_singleton_right.2 has)]
287287
simp
288288

289-
theorem injective_iff_injOn_univ : Injective f ↔ InjOn f univ :=
290-
fun h _ _ _ _ hxy => h hxy, fun h _ _ heq => h trivial trivial heq⟩
289+
@[simp] lemma injOn_univ : InjOn f univ ↔ Injective f := by simp [InjOn, Injective]
290+
291+
@[deprecated injOn_univ (since := "2025-10-27")]
292+
theorem injective_iff_injOn_univ : Injective f ↔ InjOn f univ := injOn_univ.symm
291293

292294
theorem injOn_of_injective (h : Injective f) {s : Set α} : InjOn f s := fun _ _ _ _ hxy => h hxy
293295

@@ -530,9 +532,15 @@ lemma surjOn_of_subsingleton' [Subsingleton β] (f : α → β) (h : t.Nonempty
530532
lemma surjOn_of_subsingleton [Subsingleton α] (f : α → α) (s : Set α) : SurjOn f s s :=
531533
surjOn_of_subsingleton' _ id
532534

533-
theorem surjective_iff_surjOn_univ : Surjective f ↔ SurjOn f univ univ := by
535+
@[simp] lemma surjOn_univ : SurjOn f univ univ ↔ Surjective f := by
534536
simp [Surjective, SurjOn, subset_def]
535537

538+
protected lemma _root_.Function.Surjective.surjOn (hf : Surjective f) : SurjOn f univ t :=
539+
(surjOn_univ.2 hf).mono .rfl (subset_univ _)
540+
541+
@[deprecated surjOn_univ (since := "2025-10-31")]
542+
theorem surjective_iff_surjOn_univ : Surjective f ↔ SurjOn f univ univ := surjOn_univ.symm
543+
536544
theorem SurjOn.image_eq_of_mapsTo (h₁ : SurjOn f s t) (h₂ : MapsTo f s t) : f '' s = t :=
537545
eq_of_subset_of_subset h₂.image_subset h₁
538546

@@ -694,16 +702,12 @@ theorem BijOn.bijective (h : BijOn f s t) : Bijective (h.mapsTo.restrict f s t)
694702
let ⟨x, hx, hxy⟩ := h.surjOn hy
695703
⟨⟨x, hx⟩, Subtype.eq hxy⟩⟩
696704

697-
theorem bijective_iff_bijOn_univ : Bijective f ↔ BijOn f univ univ :=
698-
Iff.intro
699-
(fun h =>
700-
let ⟨inj, surj⟩ := h
701-
⟨mapsTo_univ f _, inj.injOn, Iff.mp surjective_iff_surjOn_univ surj⟩)
702-
fun h =>
703-
let ⟨_map, inj, surj⟩ := h
704-
⟨Iff.mpr injective_iff_injOn_univ inj, Iff.mpr surjective_iff_surjOn_univ surj⟩
705+
@[simp] lemma bijOn_univ : BijOn f univ univ ↔ Bijective f := by simp [Bijective, BijOn]
705706

706-
alias ⟨_root_.Function.Bijective.bijOn_univ, _⟩ := bijective_iff_bijOn_univ
707+
protected alias ⟨_, _root_.Function.Bijective.bijOn_univ⟩ := bijOn_univ
708+
709+
@[deprecated bijOn_univ (since := "2025-10-31")]
710+
theorem bijective_iff_bijOn_univ : Bijective f ↔ BijOn f univ univ := bijOn_univ.symm
707711

708712
theorem BijOn.compl (hst : BijOn f s t) (hf : Bijective f) : BijOn f sᶜ tᶜ :=
709713
⟨hst.surjOn.mapsTo_compl hf.1, hf.1.injOn, hst.mapsTo.surjOn_compl hf.2
@@ -1089,9 +1093,6 @@ variable {fa : α → α} {fb : β → β} {f : α → β} {g : β → γ} {s t
10891093
theorem Injective.comp_injOn (hg : Injective g) (hf : s.InjOn f) : s.InjOn (g ∘ f) :=
10901094
hg.injOn.comp hf (mapsTo_univ _ _)
10911095

1092-
theorem Surjective.surjOn (hf : Surjective f) (s : Set β) : SurjOn f univ s :=
1093-
(surjective_iff_surjOn_univ.1 hf).mono (Subset.refl _) (subset_univ _)
1094-
10951096
theorem LeftInverse.leftInvOn {g : β → α} (h : LeftInverse f g) (s : Set β) : LeftInvOn f g s :=
10961097
fun x _ => h x
10971098

@@ -1123,7 +1124,7 @@ theorem surjOn_image (h : Semiconj f fa fb) (ha : SurjOn fa s t) : SurjOn fb (f
11231124
theorem surjOn_range (h : Semiconj f fa fb) (ha : Surjective fa) :
11241125
SurjOn fb (range f) (range f) := by
11251126
rw [← image_univ]
1126-
exact h.surjOn_image (ha.surjOn univ)
1127+
exact h.surjOn_image ha.surjOn
11271128

11281129
theorem injOn_image (h : Semiconj f fa fb) (ha : InjOn fa s) (hf : InjOn f (fa '' s)) :
11291130
InjOn fb (f '' s) := by
@@ -1144,7 +1145,7 @@ theorem bijOn_image (h : Semiconj f fa fb) (ha : BijOn fa s t) (hf : InjOn f t)
11441145
theorem bijOn_range (h : Semiconj f fa fb) (ha : Bijective fa) (hf : Injective f) :
11451146
BijOn fb (range f) (range f) := by
11461147
rw [← image_univ]
1147-
exact h.bijOn_image (bijective_iff_bijOn_univ.1 ha) hf.injOn
1148+
exact h.bijOn_image ha.bijOn_univ hf.injOn
11481149

11491150
theorem mapsTo_preimage (h : Semiconj f fa fb) {s t : Set β} (hb : MapsTo fb s t) :
11501151
MapsTo fa (f ⁻¹' s) (f ⁻¹' t) := fun x hx => by simp only [mem_preimage, h x, hb hx]

Mathlib/Data/Set/Piecewise.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ theorem range_piecewise (f g : α → β) : range (s.piecewise f g) = f '' s ∪
157157
theorem injective_piecewise_iff {f g : α → β} :
158158
Injective (s.piecewise f g) ↔
159159
InjOn f s ∧ InjOn g sᶜ ∧ ∀ x ∈ s, ∀ y ∉ s, f x ≠ g y := by
160-
rw [injective_iff_injOn_univ, ← union_compl_self s, injOn_union (@disjoint_compl_right _ _ s),
160+
rw [← injOn_univ, ← union_compl_self s, injOn_union (@disjoint_compl_right _ _ s),
161161
(piecewise_eqOn s f g).injOn_iff, (piecewise_eqOn_compl s f g).injOn_iff]
162162
refine and_congr Iff.rfl (and_congr Iff.rfl <| forall₄_congr fun x hx y hy => ?_)
163163
rw [piecewise_eq_of_mem s f g hx, piecewise_eq_of_notMem s f g hy]

Mathlib/Data/Setoid/Partition.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ theorem piecewise_bij {β : Type*} {f : ι → α → β}
477477
simp only [fun i ↦ BijOn.image_eq (hf i)]
478478
rintro i - j - hij
479479
exact ht.disjoint hij
480-
rw [bijective_iff_bijOn_univ, ← hs.iUnion, ← ht.iUnion]
480+
rw [← bijOn_univ, ← hs.iUnion, ← ht.iUnion]
481481
exact bijOn_iUnion hg_bij hg_inj
482482

483483
end IndexedPartition

Mathlib/FieldTheory/AxGrothendieck.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,5 +241,4 @@ algebraically closed field. -/
241241
theorem ax_grothendieck_univ (p : ι → MvPolynomial ι K) :
242242
(fun v i => eval v (p i)).Injective →
243243
(fun v i => eval v (p i)).Surjective := by
244-
simpa [Set.injective_iff_injOn_univ, Set.surjective_iff_surjOn_univ] using
245-
ax_grothendieck_zeroLocus 0 p
244+
simpa using ax_grothendieck_zeroLocus 0 p

Mathlib/FieldTheory/PrimitiveElement.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ theorem primitive_element_iff_algHom_eq_of_eval' (α : E) :
389389
(Algebra.IsSeparable.isSeparable F α) (hA _), ← toFinset_card,
390390
← (Algebra.IsAlgebraic.of_finite F E).range_eval_eq_rootSet_minpoly_of_splits _ hA α,
391391
← AlgHom.card_of_splits F E A hA, Fintype.card, toFinset_range, Finset.card_image_iff,
392-
Finset.coe_univ, ← injective_iff_injOn_univ]
392+
Finset.coe_univ, injOn_univ]
393393

394394
theorem primitive_element_iff_algHom_eq_of_eval (α : E)
395395
(φ : E →ₐ[F] A) : F⟮α⟯ = ⊤ ↔ ∀ ψ : E →ₐ[F] A, φ α = ψ α → φ = ψ := by

Mathlib/Geometry/Manifold/WhitneyEmbedding.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ theorem embeddingPiTangent_injOn : InjOn f.embeddingPiTangent s := by
7272

7373
theorem embeddingPiTangent_injective (f : SmoothBumpCovering ι I M) :
7474
Injective f.embeddingPiTangent :=
75-
injective_iff_injOn_univ.2 f.embeddingPiTangent_injOn
75+
injOn_univ.1 f.embeddingPiTangent_injOn
7676

7777
theorem comp_embeddingPiTangent_mfderiv (x : M) (hx : x ∈ s) :
7878
((ContinuousLinearMap.fst ℝ E ℝ).comp

Mathlib/LinearAlgebra/PID.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@ lemma trace_restrict_eq_of_forall_mem [IsDomain R] [IsPrincipalIdealRing R]
4141
contrapose! hi; exact snf.repr_eq_zero_of_notMem_range ⟨_, (hf _)⟩ hi
4242
change ∑ i, A i i = ∑ i, B i i
4343
rw [← Finset.sum_filter_of_ne (p := fun j ↦ j ∈ Set.range snf.f) (by simpa using aux)]
44-
simp [A, B, hf]
44+
simp [A, B, hf, Finset.sum_image snf.f.injective.injOn]
4545

4646
end LinearMap

0 commit comments

Comments
 (0)