Skip to content

Commit 8a8d388

Browse files
chore: work around simp issues in future nightlies (#11546)
1 parent b6fe43d commit 8a8d388

File tree

12 files changed

+92
-25
lines changed

12 files changed

+92
-25
lines changed

Mathlib/CategoryTheory/CofilteredSystem.lean

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,15 @@ def toPreimages : J ⥤ Type v where
185185
rw [← mem_preimage, preimage_preimage, mem_preimage]
186186
convert h (g ≫ f); rw [F.map_comp]; rfl
187187
map_id j := by
188-
simp (config := { unfoldPartialApp := true }) only [MapsTo.restrict, Subtype.map, F.map_id]
188+
-- Adaptation note: nightly-2024-03-16: simp was
189+
-- simp (config := { unfoldPartialApp := true }) only [MapsTo.restrict, Subtype.map, F.map_id]
190+
simp only [MapsTo.restrict, Subtype.map_def, F.map_id]
189191
ext
190192
rfl
191193
map_comp f g := by
192-
simp (config := { unfoldPartialApp := true }) only [MapsTo.restrict, Subtype.map, F.map_comp]
194+
-- Adaptation note: nightly-2024-03-16: simp was
195+
-- simp (config := { unfoldPartialApp := true }) only [MapsTo.restrict, Subtype.map, F.map_comp]
196+
simp only [MapsTo.restrict, Subtype.map_def, F.map_comp]
193197
rfl
194198
#align category_theory.functor.to_preimages CategoryTheory.Functor.toPreimages
195199

@@ -272,11 +276,15 @@ def toEventualRanges : J ⥤ Type v where
272276
obj j := F.eventualRange j
273277
map f := (F.eventualRange_mapsTo f).restrict _ _ _
274278
map_id i := by
275-
simp (config := { unfoldPartialApp := true }) only [MapsTo.restrict, Subtype.map, F.map_id]
279+
-- Adaptation note: nightly-2024-03-16: simp was
280+
-- simp (config := { unfoldPartialApp := true }) only [MapsTo.restrict, Subtype.map, F.map_id]
281+
simp only [MapsTo.restrict, Subtype.map_def, F.map_id]
276282
ext
277283
rfl
278284
map_comp _ _ := by
279-
simp (config := { unfoldPartialApp := true }) only [MapsTo.restrict, Subtype.map, F.map_comp]
285+
-- Adaptation note: nightly-2024-03-16: simp was
286+
-- simp (config := { unfoldPartialApp := true }) only [MapsTo.restrict, Subtype.map, F.map_comp]
287+
simp only [MapsTo.restrict, Subtype.map_def, F.map_comp]
280288
rfl
281289
#align category_theory.functor.to_eventual_ranges CategoryTheory.Functor.toEventualRanges
282290

Mathlib/Control/Fold.lean

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,12 @@ def Foldl.ofFreeMonoid (f : β → α → β) : FreeMonoid α →* Monoid.Foldl
123123
toFun xs := op <| flip (List.foldl f) (FreeMonoid.toList xs)
124124
map_one' := rfl
125125
map_mul' := by
126-
intros; simp only [FreeMonoid.toList_mul, flip, unop_op, List.foldl_append, op_inj]; rfl
126+
intros
127+
-- Adaptation note: nightly-2024-03-16: simp was
128+
-- simp only [FreeMonoid.toList_mul, flip, unop_op, List.foldl_append, op_inj]
129+
simp only [FreeMonoid.toList_mul, unop_op, List.foldl_append, op_inj, Function.flip_def,
130+
List.foldl_append]
131+
rfl
127132
#align monoid.foldl.of_free_monoid Monoid.Foldl.ofFreeMonoid
128133

129134
@[reducible]
@@ -316,16 +321,22 @@ theorem foldr.ofFreeMonoid_comp_of (f : β → α → α) :
316321
theorem foldlm.ofFreeMonoid_comp_of {m} [Monad m] [LawfulMonad m] (f : α → β → m α) :
317322
foldlM.ofFreeMonoid f ∘ FreeMonoid.of = foldlM.mk ∘ flip f := by
318323
ext1 x
319-
simp only [foldlM.ofFreeMonoid, flip, MonoidHom.coe_mk, OneHom.coe_mk, Function.comp_apply,
320-
FreeMonoid.toList_of, List.foldlM_cons, List.foldlM_nil, bind_pure, foldlM.mk, op_inj]
324+
-- Adaptation note: nightly-2024-03-16: simp was
325+
-- simp only [foldlM.ofFreeMonoid, flip, MonoidHom.coe_mk, OneHom.coe_mk, Function.comp_apply,
326+
-- FreeMonoid.toList_of, List.foldlM_cons, List.foldlM_nil, bind_pure, foldlM.mk, op_inj]
327+
simp only [foldlM.ofFreeMonoid, Function.flip_def, MonoidHom.coe_mk, OneHom.coe_mk,
328+
Function.comp_apply, FreeMonoid.toList_of, List.foldlM_cons, List.foldlM_nil, bind_pure,
329+
foldlM.mk, op_inj]
321330
rfl
322331
#align traversable.mfoldl.of_free_monoid_comp_of Traversable.foldlm.ofFreeMonoid_comp_of
323332

324333
@[simp]
325334
theorem foldrm.ofFreeMonoid_comp_of {m} [Monad m] [LawfulMonad m] (f : β → α → m α) :
326335
foldrM.ofFreeMonoid f ∘ FreeMonoid.of = foldrM.mk ∘ f := by
327336
ext
328-
simp [(· ∘ ·), foldrM.ofFreeMonoid, foldrM.mk, flip]
337+
-- Adaptation note: nightly-2024-03-16: simp was
338+
-- simp [(· ∘ ·), foldrM.ofFreeMonoid, foldrM.mk, flip]
339+
simp [(· ∘ ·), foldrM.ofFreeMonoid, foldrM.mk, Function.flip_def]
329340
#align traversable.mfoldr.of_free_monoid_comp_of Traversable.foldrm.ofFreeMonoid_comp_of
330341

331342
theorem toList_spec (xs : t α) : toList xs = FreeMonoid.toList (foldMap FreeMonoid.of xs) :=
@@ -336,12 +347,14 @@ theorem toList_spec (xs : t α) : toList xs = FreeMonoid.toList (foldMap FreeMon
336347
by simp only [List.reverse_reverse]
337348
_ = FreeMonoid.toList (List.foldr cons [] (foldMap FreeMonoid.of xs).reverse).reverse :=
338349
by simp only [List.foldr_eta]
339-
_ = (unop (Foldl.ofFreeMonoid (flip cons) (foldMap FreeMonoid.of xs)) []).reverse :=
340-
by simp [flip, List.foldr_reverse, Foldl.ofFreeMonoid, unop_op]
341-
_ = toList xs :=
342-
by rw [foldMap_hom_free (Foldl.ofFreeMonoid (flip <| @cons α))]
343-
simp only [toList, foldl, List.reverse_inj, Foldl.get, foldl.ofFreeMonoid_comp_of,
344-
Function.comp_apply]
350+
_ = (unop (Foldl.ofFreeMonoid (flip cons) (foldMap FreeMonoid.of xs)) []).reverse := by
351+
-- Adaptation note: nightly-2024-03-16: simp was
352+
-- simp [flip, List.foldr_reverse, Foldl.ofFreeMonoid, unop_op]
353+
simp [Function.flip_def, List.foldr_reverse, Foldl.ofFreeMonoid, unop_op]
354+
_ = toList xs := by
355+
rw [foldMap_hom_free (Foldl.ofFreeMonoid (flip <| @cons α))]
356+
simp only [toList, foldl, List.reverse_inj, Foldl.get, foldl.ofFreeMonoid_comp_of,
357+
Function.comp_apply]
345358
#align traversable.to_list_spec Traversable.toList_spec
346359

347360
theorem foldMap_map [Monoid γ] (f : α → β) (g : β → γ) (xs : t α) :
@@ -370,7 +383,9 @@ theorem toList_map (f : α → β) (xs : t α) : toList (f <$> xs) = f <$> toLis
370383
@[simp]
371384
theorem foldl_map (g : β → γ) (f : α → γ → α) (a : α) (l : t β) :
372385
foldl f a (g <$> l) = foldl (fun x y => f x (g y)) a l := by
373-
simp only [foldl, foldMap_map, (· ∘ ·), flip]
386+
-- Adaptation note: nightly-2024-03-16: simp was
387+
-- simp only [foldl, foldMap_map, (· ∘ ·), flip]
388+
simp only [foldl, foldMap_map, (· ∘ ·), Function.flip_def]
374389
#align traversable.foldl_map Traversable.foldl_map
375390

376391
@[simp]
@@ -418,7 +433,9 @@ theorem foldrm_toList (f : α → β → m β) (x : β) (xs : t α) :
418433
@[simp]
419434
theorem foldlm_map (g : β → γ) (f : α → γ → m α) (a : α) (l : t β) :
420435
foldlm f a (g <$> l) = foldlm (fun x y => f x (g y)) a l := by
421-
simp only [foldlm, foldMap_map, (· ∘ ·), flip]
436+
-- Adaptation note: nightly-2024-03-16: simp was
437+
-- simp only [foldlm, foldMap_map, (· ∘ ·), flip]
438+
simp only [foldlm, foldMap_map, (· ∘ ·), Function.flip_def]
422439
#align traversable.mfoldl_map Traversable.foldlm_map
423440

424441
@[simp]

Mathlib/Data/DFinsupp/WellFounded.lean

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,9 @@ protected theorem DFinsupp.wellFoundedLT [∀ i, Zero (α i)] [∀ i, Preorder (
224224
refine Lex.wellFounded' ?_ (fun i ↦ IsWellFounded.wf) ?_
225225
· rintro i ⟨a⟩
226226
apply hbot
227-
· simp (config := { unfoldPartialApp := true }) only [Function.swap]
227+
· -- Adaptation note: nightly-2024-03-16: simp was
228+
-- simp (config := { unfoldPartialApp := true }) only [Function.swap]
229+
simp only [Function.swap_def]
228230
exact IsWellFounded.wf
229231
refine Subrelation.wf (fun h => ?_) <| InvImage.wf (mapRange (fun i ↦ e i) fun _ ↦ rfl) this
230232
have := IsStrictOrder.swap (@WellOrderingRel ι)

Mathlib/Data/Nat/Bitwise.lean

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ theorem binaryRec_of_ne_zero {C : Nat → Sort*} (z : C 0) (f : ∀ b n, C n →
8181
lemma bitwise_bit {f : Bool → Bool → Bool} (h : f false false = false := by rfl) (a m b n) :
8282
bitwise f (bit a m) (bit b n) = bit (f a b) (bitwise f m n) := by
8383
conv_lhs => unfold bitwise
84-
simp (config := { unfoldPartialApp := true }) only [bit, bit1, bit0, Bool.cond_eq_ite]
84+
-- Adaptation note: nightly-2024-03-16: simp was
85+
-- simp (config := { unfoldPartialApp := true }) only [bit, bit1, bit0, Bool.cond_eq_ite]
86+
simp only [bit, ite_apply, bit1, bit0, Bool.cond_eq_ite]
8587
have h1 x : (x + x) % 2 = 0 := by rw [← two_mul, mul_comm]; apply mul_mod_left
8688
have h2 x : (x + x + 1) % 2 = 1 := by rw [← two_mul, add_comm]; apply add_mul_mod_self_left
8789
have h3 x : (x + x) / 2 = x := by rw [← two_mul, mul_comm]; apply mul_div_left _ zero_lt_two
@@ -92,7 +94,10 @@ lemma bitwise_bit {f : Bool → Bool → Bool} (h : f false false = false := by
9294

9395
lemma bit_mod_two (a : Bool) (x : ℕ) :
9496
bit a x % 2 = if a then 1 else 0 := by
95-
simp (config := { unfoldPartialApp := true }) only [bit, bit1, bit0, ← mul_two, Bool.cond_eq_ite]
97+
-- Adaptation note: nightly-2024-03-16: simp was
98+
-- simp (config := { unfoldPartialApp := true }) only [bit, bit1, bit0, ← mul_two,
99+
-- Bool.cond_eq_ite]
100+
simp only [bit, ite_apply, bit1, bit0, ← mul_two, Bool.cond_eq_ite]
96101
split_ifs <;> simp [Nat.add_mod]
97102

98103
@[simp]

Mathlib/Data/Rel.lean

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,15 @@ theorem inv_comp (r : Rel α β) (s : Rel β γ) : inv (r • s) = inv s • inv
149149

150150
@[simp]
151151
theorem inv_bot : (⊥ : Rel α β).inv = (⊥ : Rel β α) := by
152-
simp [Bot.bot, inv, flip]
152+
-- Adaptation note: nightly-2024-03-16: simp was
153+
-- simp [Bot.bot, inv, flip]
154+
simp [Bot.bot, inv, Function.flip_def]
153155

154156
@[simp]
155157
theorem inv_top : (⊤ : Rel α β).inv = (⊤ : Rel β α) := by
156-
simp [Top.top, inv, flip]
158+
-- Adaptation note: nightly-2024-03-16: simp was
159+
-- simp [Top.top, inv, flip]
160+
simp [Top.top, inv, Function.flip_def]
157161

158162
/-- Image of a set under a relation -/
159163
def image (s : Set α) : Set β := { y | ∃ x ∈ s, r x y }

Mathlib/Data/Subtype.lean

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,11 @@ def map {p : α → Prop} {q : β → Prop} (f : α → β) (h : ∀ a, p a →
203203
#align subtype.map Subtype.map
204204
#align subtype.map_coe Subtype.map_coe
205205

206+
-- Adaptation note: nightly-2024-03-16: added to replace simp [Subtype.map]
207+
theorem map_def {p : α → Prop} {q : β → Prop} (f : α → β) (h : ∀ a, p a → q (f a)) :
208+
map f h = fun x ↦ ⟨f x, h x x.prop⟩ :=
209+
rfl
210+
206211
theorem map_comp {p : α → Prop} {q : β → Prop} {r : γ → Prop} {x : Subtype p}
207212
(f : α → β) (h : ∀ a, p a → q (f a)) (g : β → γ) (l : ∀ a, q a → r (g a)) :
208213
map g l (map f h x) = map (g ∘ f) (fun a ha ↦ l (f a) <| h a ha) x :=

Mathlib/Geometry/Euclidean/Inversion/Basic.lean

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ def inversion (c : P) (R : ℝ) (x : P) : P :=
4242
(R / dist x c) ^ 2 • (x -ᵥ c) +ᵥ c
4343
#align euclidean_geometry.inversion EuclideanGeometry.inversion
4444

45+
-- Adaptation note: nightly-2024-03-16: added to replace simp [inversion]
46+
theorem inversion_def :
47+
inversion = fun (c : P) (R : ℝ) (x : P) => (R / dist x c) ^ 2 • (x -ᵥ c) +ᵥ c :=
48+
rfl
49+
4550
/-!
4651
### Basic properties
4752

Mathlib/Geometry/Euclidean/Inversion/Calculus.lean

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ theorem hasFDerivAt_inversion (hx : x ≠ c) :
8888
((R / dist x c) ^ 2 • (reflection (ℝ ∙ (x - c))ᗮ : F →L[ℝ] F)) x := by
8989
rcases add_left_surjective c x with ⟨x, rfl⟩
9090
have : HasFDerivAt (inversion c R) (_ : F →L[ℝ] F) (c + x) := by
91-
simp (config := { unfoldPartialApp := true }) only [inversion]
91+
-- Adaptation note: nightly-2024-03-16: simp was
92+
-- simp (config := { unfoldPartialApp := true }) only [inversion]
93+
simp only [inversion_def]
9294
simp_rw [dist_eq_norm, div_pow, div_eq_mul_inv]
9395
have A := (hasFDerivAt_id (𝕜 := ℝ) (c + x)).sub_const c
9496
have B := ((hasDerivAt_inv <| by simpa using hx).comp_hasFDerivAt _ A.norm_sq).const_mul

Mathlib/Init/Function.lean

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@ attribute [eqns comp_def] comp
2828

2929
lemma flip_def {f : α → β → φ} : flip f = fun b a => f a b := rfl
3030

31-
attribute [eqns flip_def] flip
31+
-- Adaptation note: nightly-2024-03-16
32+
-- Because of changes in how equation lemmas are generated,
33+
-- `@[eqns]` will only work properly when used immediately after the definition
34+
-- (and when none of the default equation lemmas are needed).
35+
-- Thus this usage is no longer allowed:
36+
-- attribute [eqns flip_def] flip
3237

3338
/-- Composition of dependent functions: `(f ∘' g) x = f (g x)`, where type of `g x` depends on `x`
3439
and type of `f (g x)` depends on `x` and `g x`. -/
@@ -74,6 +79,9 @@ def combine (f : α → β → φ) (op : φ → δ → ζ) (g : α → β → δ
7479
def swap {φ : α → β → Sort u₃} (f : ∀ x y, φ x y) : ∀ y x, φ x y := fun y x => f x y
7580
#align function.swap Function.swap
7681

82+
-- Adaptation note: nightly-2024-03-16: added to replace simp [Function.swap]
83+
theorem swap_def {φ : α → β → Sort u₃} (f : ∀ x y, φ x y) : swap f = fun y x => f x y := rfl
84+
7785
@[reducible, deprecated] -- Deprecated since 13 January 2024
7886
def app {β : α → Sort u₂} (f : ∀ x, β x) (x : α) : β x :=
7987
f x

Mathlib/Probability/Martingale/Upcrossing.lean

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,10 @@ theorem crossing_pos_eq (hab : a < b) :
679679
have hf' (ω i) : (f i ω - a)⁺ ≤ 0 ↔ f i ω ≤ a := by rw [posPart_nonpos, sub_nonpos]
680680
induction' n with k ih
681681
· refine' ⟨rfl, _⟩
682-
simp (config := { unfoldPartialApp := true }) only [lowerCrossingTime_zero, hitting,
682+
-- Adaptation note: nightly-2024-03-16: simp was
683+
-- simp (config := { unfoldPartialApp := true }) only [lowerCrossingTime_zero, hitting,
684+
-- Set.mem_Icc, Set.mem_Iic, Nat.zero_eq]
685+
simp (config := { unfoldPartialApp := true }) only [lowerCrossingTime_zero, hitting_def,
683686
Set.mem_Icc, Set.mem_Iic, Nat.zero_eq]
684687
ext ω
685688
split_ifs with h₁ h₂ h₂

0 commit comments

Comments
 (0)