Skip to content

Commit 6280bdd

Browse files
committed
feat: extend Equiv.sumCompl API (#30889)
1 parent d00cab5 commit 6280bdd

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

Mathlib/Logic/Equiv/Fintype.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ theorem extendSubtype_apply_of_mem (e : { x // p x } ≃ { x // q x }) (x) (hx :
116116
e.extendSubtype x = e ⟨x, hx⟩ := by
117117
dsimp only [extendSubtype]
118118
simp only [subtypeCongr, Equiv.trans_apply, Equiv.sumCongr_apply]
119-
rw [sumCompl_apply_symm_of_pos _ _ hx, Sum.map_inl, sumCompl_apply_inl]
119+
rw [sumCompl_symm_apply_of_pos hx, Sum.map_inl, sumCompl_apply_inl]
120120

121121
theorem extendSubtype_mem (e : { x // p x } ≃ { x // q x }) (x) (hx : p x) :
122122
q (e.extendSubtype x) := by
@@ -127,7 +127,7 @@ theorem extendSubtype_apply_of_not_mem (e : { x // p x } ≃ { x // q x }) (x) (
127127
e.extendSubtype x = e.toCompl ⟨x, hx⟩ := by
128128
dsimp only [extendSubtype]
129129
simp only [subtypeCongr, Equiv.trans_apply, Equiv.sumCongr_apply]
130-
rw [sumCompl_apply_symm_of_neg _ _ hx, Sum.map_inr, sumCompl_apply_inr]
130+
rw [sumCompl_symm_apply_of_neg hx, Sum.map_inr, sumCompl_apply_inr]
131131

132132
theorem extendSubtype_not_mem (e : { x // p x } ≃ { x // q x }) (x) (hx : ¬p x) :
133133
¬q (e.extendSubtype x) := by

Mathlib/Logic/Equiv/Sum.lean

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,25 +266,40 @@ def sumCompl {α : Type*} (p : α → Prop) [DecidablePred p] :
266266
split_ifs <;> rfl
267267

268268
@[simp]
269-
theorem sumCompl_apply_inl {α} (p : α → Prop) [DecidablePred p] (x : { a // p a }) :
269+
theorem sumCompl_apply_inl {α} {p : α → Prop} [DecidablePred p] (x : { a // p a }) :
270270
sumCompl p (Sum.inl x) = x :=
271271
rfl
272272

273273
@[simp]
274-
theorem sumCompl_apply_inr {α} (p : α → Prop) [DecidablePred p] (x : { a // ¬p a }) :
274+
theorem sumCompl_apply_inr {α} {p : α → Prop} [DecidablePred p] (x : { a // ¬p a }) :
275275
sumCompl p (Sum.inr x) = x :=
276276
rfl
277277

278278
@[simp]
279-
theorem sumCompl_apply_symm_of_pos {α} (p : α → Prop) [DecidablePred p] (a : α) (h : p a) :
279+
theorem sumCompl_symm_apply_of_pos {α} {p : α → Prop} [DecidablePred p] {a : α} (h : p a) :
280280
(sumCompl p).symm a = Sum.inl ⟨a, h⟩ :=
281281
dif_pos h
282282

283283
@[simp]
284-
theorem sumCompl_apply_symm_of_neg {α} (p : α → Prop) [DecidablePred p] (a : α) (h : ¬p a) :
284+
theorem sumCompl_symm_apply_of_neg {α} {p : α → Prop} [DecidablePred p] {a : α} (h : ¬p a) :
285285
(sumCompl p).symm a = Sum.inr ⟨a, h⟩ :=
286286
dif_neg h
287287

288+
@[deprecated (since := "2025-10-28")]
289+
alias sumCompl_apply_symm_of_pos := sumCompl_symm_apply_of_pos
290+
@[deprecated (since := "2025-10-28")]
291+
alias sumCompl_apply_symm_of_neg := sumCompl_symm_apply_of_neg
292+
293+
@[simp]
294+
theorem sumCompl_symm_apply_pos {α} {p : α → Prop} [DecidablePred p] (x : {x // p x}) :
295+
(sumCompl p).symm x = Sum.inl x :=
296+
sumCompl_symm_apply_of_pos x.2
297+
298+
@[simp]
299+
theorem sumCompl_symm_apply_neg {α} {p : α → Prop} [DecidablePred p] (x : {x // ¬ p x}) :
300+
(sumCompl p).symm x = Sum.inr x :=
301+
sumCompl_symm_apply_of_neg x.2
302+
288303
end sumCompl
289304

290305
section

0 commit comments

Comments
 (0)