Skip to content

Commit b5155f3

Browse files
committed
chore: more simpNF cleanup (#19395)
1 parent 9b9e6ff commit b5155f3

File tree

17 files changed

+35
-92
lines changed

17 files changed

+35
-92
lines changed

Mathlib/LinearAlgebra/Multilinear/Basic.lean

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,7 +1719,6 @@ theorem curryFinFinset_symm_apply {k l n : ℕ} {s : Finset (Fin n)} (hk : #s =
17191719
m <| finSumEquivOfFinset hk hl (Sum.inr i) :=
17201720
rfl
17211721

1722-
-- @[simp] -- Porting note: simpNF linter, lhs simplifies, added aux version below
17231722
theorem curryFinFinset_symm_apply_piecewise_const {k l n : ℕ} {s : Finset (Fin n)} (hk : #s = k)
17241723
(hl : #sᶜ = l)
17251724
(f : MultilinearMap R (fun _ : Fin k => M') (MultilinearMap R (fun _ : Fin l => M') M₂))
@@ -1734,42 +1733,21 @@ theorem curryFinFinset_symm_apply_piecewise_const {k l n : ℕ} {s : Finset (Fin
17341733
rw [finSumEquivOfFinset_inr, Finset.piecewise_eq_of_not_mem]
17351734
exact Finset.mem_compl.1 (Finset.orderEmbOfFin_mem _ _ _)
17361735

1737-
@[simp]
1738-
theorem curryFinFinset_symm_apply_piecewise_const_aux {k l n : ℕ} {s : Finset (Fin n)}
1739-
(hk : #s = k) (hl : #sᶜ = l)
1740-
(f : MultilinearMap R (fun _ : Fin k => M') (MultilinearMap R (fun _ : Fin l => M') M₂))
1741-
(x y : M') :
1742-
((⇑f fun _ => x) (fun i => (Finset.piecewise s (fun _ => x) (fun _ => y)
1743-
((sᶜ.orderEmbOfFin hl) i))) = f (fun _ => x) fun _ => y) := by
1744-
have := curryFinFinset_symm_apply_piecewise_const hk hl f x y
1745-
simp only [curryFinFinset_symm_apply, finSumEquivOfFinset_inl, Finset.orderEmbOfFin_mem,
1746-
Finset.piecewise_eq_of_mem, finSumEquivOfFinset_inr] at this
1747-
exact this
1748-
17491736
@[simp]
17501737
theorem curryFinFinset_symm_apply_const {k l n : ℕ} {s : Finset (Fin n)} (hk : #s = k)
17511738
(hl : #sᶜ = l)
17521739
(f : MultilinearMap R (fun _ : Fin k => M') (MultilinearMap R (fun _ : Fin l => M') M₂))
17531740
(x : M') : ((curryFinFinset R M₂ M' hk hl).symm f fun _ => x) = f (fun _ => x) fun _ => x :=
17541741
rfl
17551742

1756-
-- @[simp] -- Porting note: simpNF, lhs simplifies, added aux version below
17571743
theorem curryFinFinset_apply_const {k l n : ℕ} {s : Finset (Fin n)} (hk : #s = k)
17581744
(hl : #sᶜ = l) (f : MultilinearMap R (fun _ : Fin n => M') M₂) (x y : M') :
17591745
(curryFinFinset R M₂ M' hk hl f (fun _ => x) fun _ => y) =
17601746
f (s.piecewise (fun _ => x) fun _ => y) := by
1747+
-- Porting note: `rw` fails
17611748
refine (curryFinFinset_symm_apply_piecewise_const hk hl _ _ _).symm.trans ?_
1762-
-- `rw` fails
17631749
rw [LinearEquiv.symm_apply_apply]
17641750

1765-
@[simp]
1766-
theorem curryFinFinset_apply_const_aux {k l n : ℕ} {s : Finset (Fin n)} (hk : #s = k)
1767-
(hl : #sᶜ = l) (f : MultilinearMap R (fun _ : Fin n => M') M₂) (x y : M') :
1768-
(f fun i => Sum.elim (fun _ => x) (fun _ => y) ((⇑ (Equiv.symm (finSumEquivOfFinset hk hl))) i))
1769-
= f (s.piecewise (fun _ => x) fun _ => y) := by
1770-
rw [← curryFinFinset_apply]
1771-
apply curryFinFinset_apply_const
1772-
17731751
end MultilinearMap
17741752

17751753
end Currying

Mathlib/NumberTheory/Modular.lean

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,6 @@ def lcRow0Extend {cd : Fin 2 → ℤ} (hcd : IsCoprime (cd 0) (cd 1)) :
180180
rw [neg_sq]
181181
exact hcd.sq_add_sq_ne_zero, LinearEquiv.refl ℝ (Fin 2 → ℝ)]
182182

183-
-- `simpNF` times out, but only in CI where all of `Mathlib` is imported
184-
attribute [nolint simpNF] lcRow0Extend_apply lcRow0Extend_symm_apply
185-
186183
/-- The map `lcRow0` is proper, that is, preimages of cocompact sets are finite in
187184
`[[* , *], [c, d]]`. -/
188185
theorem tendsto_lcRow0 {cd : Fin 2 → ℤ} (hcd : IsCoprime (cd 0) (cd 1)) :

Mathlib/NumberTheory/ModularForms/SlashActions.lean

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,14 @@ theorem is_invariant_const (A : SL(2, ℤ)) (x : ℂ) :
143143
zpow_neg, zpow_one, inv_one, mul_one, neg_zero, zpow_zero]
144144

145145
/-- The constant function 1 is invariant under any element of `SL(2, ℤ)`. -/
146-
-- @[simp] -- Porting note: simpNF says LHS simplifies to something more complex
147146
theorem is_invariant_one (A : SL(2, ℤ)) : (1 : ℍ → ℂ) ∣[(0 : ℤ)] A = (1 : ℍ → ℂ) :=
148147
is_invariant_const _ _
149148

149+
/-- Variant of `is_invariant_one` with the left hand side in simp normal form. -/
150+
@[simp]
151+
theorem is_invariant_one' (A : SL(2, ℤ)) : (1 : ℍ → ℂ) ∣[(0 : ℤ)] (A : GL(2, ℝ)⁺) = 1 := by
152+
simpa using is_invariant_one A
153+
150154
/-- A function `f : ℍ → ℂ` is slash-invariant, of weight `k ∈ ℤ` and level `Γ`,
151155
if for every matrix `γ ∈ Γ` we have `f(γ • z)= (c*z+d)^k f(z)` where `γ= ![![a, b], ![c, d]]`,
152156
and it acts on `ℍ` via Möbius transformations. -/

Mathlib/NumberTheory/Padics/PadicIntegers.lean

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,7 @@ def Coe.ringHom : ℤ_[p] →+* ℚ_[p] := (subring p).subtype
153153
@[simp, norm_cast]
154154
theorem coe_pow (x : ℤ_[p]) (n : ℕ) : (↑(x ^ n) : ℚ_[p]) = (↑x : ℚ_[p]) ^ n := rfl
155155

156-
-- @[simp] -- Porting note: not in simpNF
157-
theorem mk_coe (k : ℤ_[p]) : (⟨k, k.2⟩ : ℤ_[p]) = k := Subtype.coe_eta _ _
156+
theorem mk_coe (k : ℤ_[p]) : (⟨k, k.2⟩ : ℤ_[p]) = k := by simp
158157

159158
/-- The inverse of a `p`-adic integer with norm equal to `1` is also a `p`-adic integer.
160159
Otherwise, the inverse is defined to be `0`. -/
@@ -165,10 +164,8 @@ instance : CharZero ℤ_[p] where
165164
cast_injective m n h :=
166165
Nat.cast_injective (R := ℚ_[p]) (by rw [Subtype.ext_iff] at h; norm_cast at h)
167166

168-
@[norm_cast] -- @[simp] -- Porting note: not in simpNF
169-
theorem intCast_eq (z1 z2 : ℤ) : (z1 : ℤ_[p]) = z2 ↔ z1 = z2 := by
170-
suffices (z1 : ℚ_[p]) = z2 ↔ z1 = z2 from Iff.trans (by norm_cast) this
171-
norm_cast
167+
@[norm_cast]
168+
theorem intCast_eq (z1 z2 : ℤ) : (z1 : ℤ_[p]) = z2 ↔ z1 = z2 := by simp
172169

173170
@[deprecated (since := "2024-04-05")] alias coe_int_eq := intCast_eq
174171

@@ -280,8 +277,7 @@ theorem norm_eq_padic_norm {q : ℚ_[p]} (hq : ‖q‖ ≤ 1) : @norm ℤ_[p] _
280277
@[simp]
281278
theorem norm_p : ‖(p : ℤ_[p])‖ = (p : ℝ)⁻¹ := padicNormE.norm_p
282279

283-
-- @[simp] -- Porting note: not in simpNF
284-
theorem norm_p_pow (n : ℕ) : ‖(p : ℤ_[p]) ^ n‖ = (p : ℝ) ^ (-n : ℤ) := padicNormE.norm_p_pow n
280+
theorem norm_p_pow (n : ℕ) : ‖(p : ℤ_[p]) ^ n‖ = (p : ℝ) ^ (-n : ℤ) := by simp
285281

286282
private def cauSeq_to_rat_cauSeq (f : CauSeq ℤ_[p] norm) : CauSeq ℚ_[p] fun a => ‖a‖ :=
287283
fun n => f n, fun _ hε => by simpa [norm, norm_def] using f.cauchy hε⟩
@@ -413,10 +409,12 @@ theorem norm_lt_one_mul {z1 z2 : ℤ_[p]} (hz2 : ‖z2‖ < 1) : ‖z1 * z2‖ <
413409
‖z1 * z2‖ = ‖z1‖ * ‖z2‖ := by simp
414410
_ < 1 := mul_lt_one_of_nonneg_of_lt_one_right (norm_le_one _) (norm_nonneg _) hz2
415411

416-
-- @[simp] -- Porting note: not in simpNF
417412
theorem mem_nonunits {z : ℤ_[p]} : z ∈ nonunits ℤ_[p] ↔ ‖z‖ < 1 := by
418413
rw [lt_iff_le_and_ne]; simp [norm_le_one z, nonunits, isUnit_iff]
419414

415+
theorem not_isUnit_iff {z : ℤ_[p]} : ¬IsUnit z ↔ ‖z‖ < 1 := by
416+
simpa using mem_nonunits
417+
420418
/-- A `p`-adic number `u` with `‖u‖ = 1` is a unit of `ℤ_[p]`. -/
421419
def mkUnits {u : ℚ_[p]} (h : ‖u‖ = 1) : ℤ_[p]ˣ :=
422420
let z : ℤ_[p] := ⟨u, le_of_eq h⟩

Mathlib/NumberTheory/Padics/RingHoms.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ theorem ker_toZModPow (n : ℕ) :
393393
rw [zmod_congr_of_sub_mem_span n x _ 0 _ h, cast_zero]
394394
apply appr_spec
395395

396-
-- @[simp] -- Porting note: not in simpNF
396+
-- This is not a simp lemma; simp can't match the LHS.
397397
theorem zmod_cast_comp_toZModPow (m n : ℕ) (h : m ≤ n) :
398398
(ZMod.castHom (pow_dvd_pow p h) (ZMod (p ^ m))).comp (@toZModPow p _ n) = @toZModPow p _ m := by
399399
apply ZMod.ringHom_eq_of_ker_eq

Mathlib/Order/Closure.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ variable [PartialOrder α] [PartialOrder β] {u : β → α} (l : LowerAdjoint u
387387
theorem mem_closed_iff_closure_le (x : α) : x ∈ l.closed ↔ u (l x) ≤ x :=
388388
l.closureOperator.isClosed_iff_closure_le
389389

390-
@[simp, nolint simpNF] -- Porting note: lemma does prove itself, seems to be a linter error
390+
@[simp]
391391
theorem closure_is_closed (x : α) : u (l x) ∈ l.closed :=
392392
l.idempotent x
393393

Mathlib/Order/Compare.lean

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,7 @@ theorem cmp_swap [Preorder α] [@DecidableRel α (· < ·)] (a b : α) : (cmp a
137137
by_cases h : a < b <;> by_cases h₂ : b < a <;> simp [h, h₂, Ordering.swap]
138138
exact lt_asymm h h₂
139139

140-
-- Porting note: Not sure why the simpNF linter doesn't like this. @semorrison
141-
@[simp, nolint simpNF]
140+
@[simp]
142141
theorem cmpLE_toDual [LE α] [@DecidableRel α (· ≤ ·)] (x y : α) :
143142
cmpLE (toDual x) (toDual y) = cmpLE y x :=
144143
rfl
@@ -148,8 +147,7 @@ theorem cmpLE_ofDual [LE α] [@DecidableRel α (· ≤ ·)] (x y : αᵒᵈ) :
148147
cmpLE (ofDual x) (ofDual y) = cmpLE y x :=
149148
rfl
150149

151-
-- Porting note: Not sure why the simpNF linter doesn't like this. @semorrison
152-
@[simp, nolint simpNF]
150+
@[simp]
153151
theorem cmp_toDual [LT α] [@DecidableRel α (· < ·)] (x y : α) :
154152
cmp (toDual x) (toDual y) = cmp y x :=
155153
rfl

Mathlib/Order/Filter/Germ/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ theorem coe_compTendsto (f : α → β) {lc : Filter γ} {g : γ → α} (hg : T
237237
rfl
238238

239239
-- Porting note https://github.com/leanprover-community/mathlib4/issues/10959
240-
-- simp cannot prove this
240+
-- simp can't match the LHS.
241241
@[simp, nolint simpNF]
242242
theorem compTendsto'_coe (f : Germ l β) {lc : Filter γ} {g : γ → α} (hg : Tendsto g lc l) :
243243
f.compTendsto' _ hg.germ_tendsto = f.compTendsto g hg :=

Mathlib/Order/Filter/Pointwise.lean

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,8 @@ theorem pureOneHom_apply (a : α) : pureOneHom a = pure a :=
146146
variable [One β]
147147

148148
@[to_additive]
149-
-- Porting note (https://github.com/leanprover-community/mathlib4/issues/11119): removed `simp` attribute because `simpNF` says it can prove it.
150149
protected theorem map_one [FunLike F α β] [OneHomClass F α β] (φ : F) : map φ 1 = 1 := by
151-
rw [Filter.map_one', map_one, pure_one]
150+
simp
152151

153152
end One
154153

@@ -303,9 +302,7 @@ theorem mul_pure : f * pure b = f.map (· * b) :=
303302
map₂_pure_right
304303

305304
@[to_additive]
306-
-- Porting note (https://github.com/leanprover-community/mathlib4/issues/11119): removed `simp` attribute because `simpNF` says it can prove it.
307-
theorem pure_mul_pure : (pure a : Filter α) * pure b = pure (a * b) :=
308-
map₂_pure
305+
theorem pure_mul_pure : (pure a : Filter α) * pure b = pure (a * b) := by simp
309306

310307
@[to_additive (attr := simp)]
311308
theorem le_mul_iff : h ≤ f * g ↔ ∀ ⦃s⦄, s ∈ f → ∀ ⦃t⦄, t ∈ g → s * t ∈ h :=
@@ -408,9 +405,7 @@ theorem div_pure : f / pure b = f.map (· / b) :=
408405
map₂_pure_right
409406

410407
@[to_additive]
411-
-- Porting note (https://github.com/leanprover-community/mathlib4/issues/11119): removed `simp` attribute because `simpNF` says it can prove it.
412-
theorem pure_div_pure : (pure a : Filter α) / pure b = pure (a / b) :=
413-
map₂_pure
408+
theorem pure_div_pure : (pure a : Filter α) / pure b = pure (a / b) := by simp
414409

415410
@[to_additive]
416411
protected theorem div_le_div : f₁ ≤ f₂ → g₁ ≤ g₂ → f₁ / g₁ ≤ f₂ / g₂ :=
@@ -826,9 +821,7 @@ theorem smul_pure : f • pure b = f.map (· • b) :=
826821
map₂_pure_right
827822

828823
@[to_additive]
829-
-- Porting note (https://github.com/leanprover-community/mathlib4/issues/11119): removed `simp` attribute because `simpNF` says it can prove it.
830-
theorem pure_smul_pure : (pure a : Filter α) • (pure b : Filter β) = pure (a • b) :=
831-
map₂_pure
824+
theorem pure_smul_pure : (pure a : Filter α) • (pure b : Filter β) = pure (a • b) := by simp
832825

833826
@[to_additive]
834827
theorem smul_le_smul : f₁ ≤ f₂ → g₁ ≤ g₂ → f₁ • g₁ ≤ f₂ • g₂ :=
@@ -914,9 +907,7 @@ theorem pure_vsub : (pure a : Filter β) -ᵥ g = g.map (a -ᵥ ·) :=
914907
theorem vsub_pure : f -ᵥ pure b = f.map (· -ᵥ b) :=
915908
map₂_pure_right
916909

917-
-- Porting note (https://github.com/leanprover-community/mathlib4/issues/11119): removed `simp` attribute because `simpNF` says it can prove it.
918-
theorem pure_vsub_pure : (pure a : Filter β) -ᵥ pure b = (pure (a -ᵥ b) : Filter α) :=
919-
map₂_pure
910+
theorem pure_vsub_pure : (pure a : Filter β) -ᵥ pure b = (pure (a -ᵥ b) : Filter α) := by simp
920911

921912
theorem vsub_le_vsub : f₁ ≤ f₂ → g₁ ≤ g₂ → f₁ -ᵥ g₁ ≤ f₂ -ᵥ g₂ :=
922913
map₂_mono

Mathlib/Order/Heyting/Basic.lean

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,28 +1084,27 @@ theorem top_eq : (⊤ : PUnit) = unit :=
10841084
theorem bot_eq : (⊥ : PUnit) = unit :=
10851085
rfl
10861086

1087-
@[simp, nolint simpNF]
1087+
@[simp]
10881088
theorem sup_eq : a ⊔ b = unit :=
10891089
rfl
10901090

1091-
@[simp, nolint simpNF]
1091+
@[simp]
10921092
theorem inf_eq : a ⊓ b = unit :=
10931093
rfl
10941094

10951095
@[simp]
10961096
theorem compl_eq : aᶜ = unit :=
10971097
rfl
10981098

1099-
@[simp, nolint simpNF]
1099+
@[simp]
11001100
theorem sdiff_eq : a \ b = unit :=
11011101
rfl
11021102

1103-
@[simp, nolint simpNF]
1103+
@[simp]
11041104
theorem hnot_eq : ¬a = unit :=
11051105
rfl
11061106

1107-
-- eligible for `dsimp`
1108-
@[simp, nolint simpNF]
1107+
@[simp]
11091108
theorem himp_eq : a ⇨ b = unit :=
11101109
rfl
11111110

0 commit comments

Comments
 (0)