Skip to content

Commit 4b83244

Browse files
committed
chore: deprecate dif_ctx_congr, move if_(ctx_)congr (#16692)
The few uses of `dif_ctx_congr` can all be replaced without increasing the line count. The other two `ite` congruence lemmas are moved to `Logic.Basic`.
1 parent 0e1a0b8 commit 4b83244

File tree

5 files changed

+22
-18
lines changed

5 files changed

+22
-18
lines changed

Mathlib/CategoryTheory/Preadditive/Mat.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,11 @@ instance hasFiniteBiproducts : HasFiniteBiproducts (Mat_ C) where
184184
ext x y
185185
dsimp
186186
simp_rw [dite_comp, comp_dite]
187-
simp only [ite_self, dite_eq_ite, dif_ctx_congr, Limits.comp_zero, Limits.zero_comp,
187+
simp only [ite_self, dite_eq_ite, Limits.comp_zero, Limits.zero_comp,
188188
eqToHom_trans, Finset.sum_congr]
189189
erw [Finset.sum_sigma]
190190
dsimp
191-
simp only [if_congr, if_true, dif_ctx_congr, Finset.sum_dite_irrel, Finset.mem_univ,
191+
simp only [if_true, Finset.sum_dite_irrel, Finset.mem_univ,
192192
Finset.sum_const_zero, Finset.sum_congr, Finset.sum_dite_eq']
193193
split_ifs with h h'
194194
· substs h h'

Mathlib/FieldTheory/Minpoly/Basic.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ theorem eq_zero (hx : ¬IsIntegral A x) : minpoly A x = 0 :=
6060

6161
theorem algHom_eq (f : B →ₐ[A] B') (hf : Function.Injective f) (x : B) :
6262
minpoly A (f x) = minpoly A x := by
63-
refine dif_ctx_congr (isIntegral_algHom_iff _ hf) (fun _ => ?_) fun _ => rfl
64-
simp_rw [← Polynomial.aeval_def, aeval_algHom, AlgHom.comp_apply, _root_.map_eq_zero_iff f hf]
63+
simp_rw [minpoly, isIntegral_algHom_iff _ hf, ← Polynomial.aeval_def, aeval_algHom,
64+
AlgHom.comp_apply, _root_.map_eq_zero_iff f hf]
6565

6666
theorem algebraMap_eq {B} [CommRing B] [Algebra A B] [Algebra B B'] [IsScalarTower A B B']
6767
(h : Function.Injective (algebraMap B B')) (x : B) :

Mathlib/Init/Logic.lean

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -166,19 +166,7 @@ theorem imp_of_if_pos {c t e : Prop} [Decidable c] (h : ite c t e) (hc : c) : t
166166
theorem imp_of_if_neg {c t e : Prop} [Decidable c] (h : ite c t e) (hnc : ¬c) : e :=
167167
(if_neg hnc ▸ h :)
168168

169-
theorem if_ctx_congr {α : Sort u} {b c : Prop} [dec_b : Decidable b] [dec_c : Decidable c]
170-
{x y u v : α} (h_c : b ↔ c) (h_t : c → x = u) (h_e : ¬c → y = v) : ite b x y = ite c u v :=
171-
match dec_b, dec_c with
172-
| isFalse _, isFalse h₂ => h_e h₂
173-
| isTrue _, isTrue h₂ => h_t h₂
174-
| isFalse h₁, isTrue h₂ => absurd h₂ (Iff.mp (not_congr h_c) h₁)
175-
| isTrue h₁, isFalse h₂ => absurd h₁ (Iff.mpr (not_congr h_c) h₂)
176-
177-
theorem if_congr {α : Sort u} {b c : Prop} [Decidable b] [Decidable c]
178-
{x y u v : α} (h_c : b ↔ c) (h_t : x = u) (h_e : y = v) : ite b x y = ite c u v :=
179-
if_ctx_congr h_c (fun _ ↦ h_t) (fun _ ↦ h_e)
180-
181-
-- @[congr]
169+
@[deprecated (since := "2024-09-11")]
182170
theorem dif_ctx_congr {α : Sort u} {b c : Prop} [dec_b : Decidable b] [dec_c : Decidable c]
183171
{x : b → α} {u : c → α} {y : ¬b → α} {v : ¬c → α}
184172
(h_c : b ↔ c) (h_t : ∀ h : c, x (Iff.mpr h_c h) = u h)

Mathlib/Logic/Basic.lean

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -952,6 +952,22 @@ theorem dite_prop_iff_and {Q : P → Prop} {R : ¬P → Prop} :
952952
dite P Q R ↔ (∀ h, Q h) ∧ (∀ h, R h) := by
953953
by_cases h : P <;> simp [h, forall_prop_of_false, forall_prop_of_true]
954954

955+
section congr
956+
957+
variable [Decidable Q] {x y u v : α}
958+
959+
theorem if_ctx_congr (h_c : P ↔ Q) (h_t : Q → x = u) (h_e : ¬Q → y = v) : ite P x y = ite Q u v :=
960+
match ‹Decidable P›, ‹Decidable Q› with
961+
| isFalse _, isFalse h₂ => by simp_all
962+
| isTrue _, isTrue h₂ => by simp_all
963+
| isFalse h₁, isTrue h₂ => absurd h₂ (Iff.mp (not_congr h_c) h₁)
964+
| isTrue h₁, isFalse h₂ => absurd h₁ (Iff.mpr (not_congr h_c) h₂)
965+
966+
theorem if_congr (h_c : P ↔ Q) (h_t : x = u) (h_e : y = v) : ite P x y = ite Q u v :=
967+
if_ctx_congr h_c (fun _ ↦ h_t) (fun _ ↦ h_e)
968+
969+
end congr
970+
955971
end ite
956972

957973
theorem not_beq_of_ne {α : Type*} [BEq α] [LawfulBEq α] {a b : α} (ne : a ≠ b) : ¬(a == b) :=

Mathlib/RingTheory/Coprime/Ideal.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ theorem iSup_iInf_eq_top_iff_pairwise {t : Finset ι} (h : t.Nonempty) (I : ι
3535
· simp only [Finset.sum_singleton, Finset.coe_singleton, Set.pairwise_singleton, iff_true_iff]
3636
refine fun a => ⟨fun i => if h : i = a then1, ?_⟩ else 0, ?_⟩
3737
· simp [h]
38-
· simp only [dif_pos, dif_ctx_congr, Submodule.coe_mk, eq_self_iff_true]
38+
· simp only [dif_pos, Submodule.coe_mk, eq_self_iff_true]
3939
intro a t hat h ih
4040
rw [Finset.coe_cons,
4141
Set.pairwise_insert_of_symmetric fun i j (h : I i ⊔ I j = ⊤) ↦ (sup_comm _ _).trans h]

0 commit comments

Comments
 (0)