Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
157 commits
Select commit Hold shift + click to select a range
d301b1f
feat: A linter for instances that overlap on data
JovanGerb Jan 6, 2026
cc6b2b1
chore: Init and import management
thorimur Jan 7, 2026
b4a8dbb
feat: `localInstances` argument to `ContextInfo.runMetaMWithMessages`
thorimur Jan 7, 2026
8176967
feat: `getDeclBodyInfos`
thorimur Jan 7, 2026
8fa638f
chore: import changes + header mgmt
thorimur Jan 7, 2026
a2594a1
refactor: return data from `findOverlappingDataInstances`, remove env…
thorimur Jan 7, 2026
72cd2cb
feat: syntax linter `overlappingInstances`
thorimur Jan 7, 2026
e4cc55e
test: overlapping instances (first pass; all pass, but not comprehens…
thorimur Jan 7, 2026
3167b84
chore: remove prettty printing logic for now
thorimur Jan 7, 2026
664a00d
chore: simplify and document some internals
thorimur Jan 7, 2026
d446fbd
docs: misc.
thorimur Jan 7, 2026
73b6a3d
test: update tests
thorimur Jan 7, 2026
511c942
tweak: don't break, just record "dominating" cases
thorimur Jan 7, 2026
f034b5d
chore: deriving
thorimur Jan 7, 2026
b65b2ea
refactor: use an ultimately simpler data structure for collecting ove…
thorimur Jan 7, 2026
b377001
docs: explain choices
thorimur Jan 7, 2026
369dd15
chore: refactor infotree utils slightly
thorimur Jan 7, 2026
04a7e79
clean up `else acc` chain a bit
thorimur Jan 7, 2026
28d7938
chore: remove unused variables
thorimur Jan 7, 2026
691267d
chore: readability
thorimur Jan 7, 2026
e9508ae
chore: move comment
thorimur Jan 7, 2026
b60a105
test: show projections
thorimur Jan 7, 2026
e761690
chore: refactor message generation
thorimur Jan 23, 2026
c77a8d3
chore: continue refactoring
thorimur Jan 23, 2026
f86ae52
feat: first pass at deduplicating error messages
thorimur Jan 28, 2026
fe0dfa5
chore: tweak code comments
thorimur Jan 28, 2026
6397f9f
chore: update tests to remove redundant messages
thorimur Jan 28, 2026
b50ed2c
chore: improve tests a bit (still needs some fleshing out)
thorimur Jan 29, 2026
490dd49
chore: variable names
thorimur Jan 29, 2026
0aaa23c
chore: improve message
thorimur Jan 29, 2026
f258f91
chore: maybe improve wording a bit? hmm
thorimur Jan 29, 2026
d855595
chore: clearer source code + "both" in message
thorimur Jan 29, 2026
8e54ead
chore: more code cleanup
thorimur Jan 29, 2026
bea6931
test: namespace test
thorimur Jan 29, 2026
b7ceb99
chore: refactor info management. lets us document things better.
thorimur Jan 31, 2026
f381e61
style: use `Option.elim`, even though I'd prefer a dedicated wrapper
thorimur Jan 31, 2026
e8b9c97
chore: remove accidental whitespace
thorimur Feb 1, 2026
949c0f2
chore: whitespace, opens, namespaces
thorimur Feb 1, 2026
529b6a1
chore: rename `insts` and document more
thorimur Feb 5, 2026
606dfb5
chore: handle class inductives, clean up slightly
thorimur Feb 5, 2026
2b00b9f
chore: a little more documentation
thorimur Feb 5, 2026
efe34f9
chore: make `ofInstanceBinderType` public, resurrect `Mathlib.Lean.Me…
thorimur Feb 5, 2026
f4d75e6
chore: adjust directory dependency linter
thorimur Feb 5, 2026
7772c71
chore: fix docstring
thorimur Feb 5, 2026
9a487f3
chore: tweak variable names? hmm
thorimur Feb 6, 2026
9dfbdd0
chore: us `Array`s in `Overlap` implementation
thorimur Feb 6, 2026
05cc29e
chore: clean up
thorimur Feb 6, 2026
33dc4f5
chore: condition refactor, first pass
thorimur Feb 7, 2026
259ef14
chore: wording
thorimur Feb 7, 2026
9b5f661
chore: wording
thorimur Feb 7, 2026
8ef7526
chore: consider alternate factoring
thorimur Feb 7, 2026
8531cbc
chore: too much documentation? not relevant anymore?
thorimur Feb 7, 2026
d6a50c1
chore: wording
thorimur Feb 7, 2026
eb6e433
chore: wording
thorimur Feb 7, 2026
bd24af7
chore: import header in `Mathlib.Lean.Message`
thorimur Feb 7, 2026
cb9577a
chore: module docstring for `Mathlib.Lean.Message`
thorimur Feb 7, 2026
3be4374
chore: namespace under `Linter` instead of `Tactic`
thorimur Feb 7, 2026
976a8ea
fix: instantiateMVars
thorimur Feb 7, 2026
95098e7
chore: actually guard the messages
thorimur Feb 7, 2026
38d06a8
fix: better place for instantiateMVars?
thorimur Feb 8, 2026
cc49f64
chore: refactor to keep classes in order?
thorimur Feb 8, 2026
fb03eb2
docs: module docstring
thorimur Feb 10, 2026
cdcc316
chore: cheap better logging location
thorimur Feb 10, 2026
c60ff1a
chore: disable noninteractively
thorimur Feb 10, 2026
f268642
chore: temporarily inline `withSetBoolOptionIn`
thorimur Feb 10, 2026
ebd66fd
chore: use linter in test file in CI
thorimur Feb 10, 2026
be11998
chore: test `set_option ... in`
thorimur Feb 10, 2026
44bc7be
Merge remote-tracking branch 'upstream/master' into Jovan-overlapping…
thorimur Feb 10, 2026
2562644
chore: note about running interactively
thorimur Feb 10, 2026
3ea1ef1
chore: remove stale set_option comment
thorimur Feb 10, 2026
5583e06
feat: env linter for hybrid strategy
thorimur Feb 10, 2026
b18eef2
chore: fix `#lint` test
thorimur Feb 10, 2026
c2c3510
chore: fix or exempt declarations (two)
thorimur Feb 10, 2026
c28f197
chore: todo
thorimur Feb 10, 2026
e41f371
temp: bench old version
thorimur Feb 10, 2026
8f60681
Revert "temp: bench old version"
thorimur Feb 16, 2026
344c1fd
chore: don't manually limit to prefix
thorimur Feb 16, 2026
30ebadc
chore: fix nolint
thorimur Feb 16, 2026
0b8aaa3
chore: also set_option
thorimur Feb 16, 2026
d246cd4
Merge remote-tracking branch 'upstream/master' into Jovan-overlapping…
thorimur Feb 17, 2026
ea7abe0
chore: docs
thorimur Feb 18, 2026
2721676
chore docs
thorimur Feb 18, 2026
967f800
chore: tweak docs
thorimur Feb 18, 2026
d6d07a8
Merge remote-tracking branch 'upstream/master' into Jovan-overlapping…
thorimur Feb 24, 2026
af29528
chore: update copyright since file is being re-added
thorimur Feb 24, 2026
d55120d
Merge remote-tracking branch 'upstream/master' into Jovan-overlapping…
thorimur Mar 2, 2026
7de7246
Merge branch 'master' into Jovan-overlappingInstances-2
JovanGerb Apr 16, 2026
b2aff5a
new version
JovanGerb Apr 16, 2026
1eb3c0d
actually turn it on lol
JovanGerb Apr 16, 2026
41bd47e
improvements
JovanGerb Apr 16, 2026
c4c957f
some adaptations, there are so many!
JovanGerb Apr 16, 2026
d0d5a9c
improve output message
JovanGerb Apr 16, 2026
db46d60
fix all?
JovanGerb Apr 16, 2026
3dec916
fix
JovanGerb Apr 17, 2026
cfd593f
does specialization make a difference?
JovanGerb Apr 17, 2026
70d42d4
revert
JovanGerb Apr 17, 2026
88dfef6
avoid `runMetaMWithMessages`
JovanGerb Apr 17, 2026
74ba3a4
add trace nodes to help understand performance
JovanGerb Apr 17, 2026
bb07869
Merge branch 'master' into Jovan-overlappingInstances-2
JovanGerb Apr 17, 2026
211490f
update documentation and tests
JovanGerb Apr 17, 2026
1b84b1a
Merge branch 'master' into Jovan-overlappingInstances-2
JovanGerb Apr 18, 2026
9b9778c
Merge branch 'master' into Jovan-overlappingInstances-2
JovanGerb Apr 19, 2026
a61f8aa
feat: also warn against overlapping proofs
JovanGerb Apr 19, 2026
4f16178
hard-code an exception for `Nontrivial`
JovanGerb Apr 20, 2026
2b9d82e
Revert "hard-code an exception for `Nontrivial`"
JovanGerb Apr 23, 2026
f98207f
Revert "feat: also warn against overlapping proofs"
JovanGerb Apr 23, 2026
cc67cb9
Merge branch 'master' into Jovan-overlappingInstances-2
JovanGerb Apr 28, 2026
d64f825
review suggestions
JovanGerb Apr 28, 2026
14264d0
more comments
JovanGerb Apr 28, 2026
3201d6e
let's try `Std.TreeMap` for benchmarking
JovanGerb Apr 28, 2026
061ce7f
fix new violation
JovanGerb Apr 28, 2026
05f575c
move comment to correct place
JovanGerb Apr 28, 2026
cf04252
revert to `exprMap`
JovanGerb Apr 28, 2026
ad10953
.
JovanGerb Apr 28, 2026
4e2b7a2
attempt 2 for linting against Prop classes
JovanGerb Apr 30, 2026
99d291a
fix for a class extending a non-class
JovanGerb Apr 30, 2026
62d4fa1
Revert "attempt 2 for linting against Prop classes"
JovanGerb Apr 30, 2026
818f6ca
Attempt no. 3 for linting against Prop classes
JovanGerb May 1, 2026
af29da4
new adaptations
JovanGerb May 1, 2026
3a07663
update output text of the linter, depending on whether it is a `Prop`…
JovanGerb May 1, 2026
9cdda04
.
JovanGerb May 1, 2026
5d7404c
fix test
JovanGerb May 2, 2026
7fa5821
Merge branch 'master' into Jovan-overlappingInstances-2
JovanGerb May 2, 2026
96d6fff
new adaptation
JovanGerb May 2, 2026
f6c15fe
try profiling in radar?
JovanGerb May 3, 2026
d830fd3
suggestions
JovanGerb May 8, 2026
aeda3a5
fix test for `eraseInstances`
JovanGerb May 9, 2026
778a5fa
feat: also warn on overlaps between Prop and data instances
JovanGerb May 9, 2026
f51ad1c
Merge branch 'master' into Jovan-overlappingInstances-2
JovanGerb May 9, 2026
6f4646e
adaptations
JovanGerb May 9, 2026
6cb3978
Merge remote-tracking branch 'upstream/master' into Jovan-overlapping…
thorimur May 14, 2026
8a3ea57
chore: adaptations
thorimur May 14, 2026
1864b7a
review suggestions
JovanGerb May 18, 2026
59377c1
Update Mathlib/Tactic/Linter/OverlappingInstances.lean
JovanGerb May 18, 2026
4f757d4
feat: better messages
thorimur May 19, 2026
aa16b05
chore: string continuations
thorimur May 20, 2026
15b9025
chore: update tests
thorimur May 20, 2026
a877b3f
chore: update unicode linter to allow ⚠️
thorimur May 20, 2026
0bdfe22
chore: unicode selector
thorimur May 20, 2026
51fd3fd
Merge remote-tracking branch 'upstream/master' into Jovan-overlapping…
thorimur May 20, 2026
25632d8
chore: better unicode linter fix
thorimur May 20, 2026
8cfa633
new rewording
JovanGerb May 21, 2026
453f413
fix tests
JovanGerb May 21, 2026
8c92ade
redundant directory dependency exceptions
JovanGerb May 21, 2026
f405742
chore: tweak message
thorimur May 22, 2026
6597ce8
chore: directory dependency
thorimur May 22, 2026
f4c1b85
chore: more sensible unicode linter change
thorimur May 22, 2026
a524d14
Merge remote-tracking branch 'upstream/master' into Jovan-overlapping…
thorimur May 22, 2026
9270878
adaptation
JovanGerb May 24, 2026
888787b
show the explanation more often
JovanGerb May 24, 2026
ef0ed90
Revert "chore: more sensible unicode linter change"
JovanGerb May 24, 2026
810ff5b
Revert "chore: better unicode linter fix"
thorimur May 25, 2026
e10fd74
Revert "chore: update unicode linter to allow ⚠️"
thorimur May 25, 2026
17fe8dd
chore: `ite` -> `if then else` since it no longer saves us a line
thorimur May 25, 2026
d7702a0
chore: slightly nicer trace message
thorimur May 25, 2026
4a91eb8
Merge branch 'master' into Jovan-overlappingInstances-2
JovanGerb May 26, 2026
f0cfcfc
Merge remote-tracking branch 'upstream/master' into Jovan-overlapping…
thorimur May 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Mathlib.lean
Original file line number Diff line number Diff line change
Expand Up @@ -7239,6 +7239,7 @@ public import Mathlib.Tactic.Linter.Lint
public import Mathlib.Tactic.Linter.MinImports
public import Mathlib.Tactic.Linter.Multigoal
public import Mathlib.Tactic.Linter.OldObtain
public import Mathlib.Tactic.Linter.OverlappingInstances
public import Mathlib.Tactic.Linter.PPRoundtrip
public import Mathlib.Tactic.Linter.PrivateModule
public import Mathlib.Tactic.Linter.Style
Expand Down
1 change: 1 addition & 0 deletions Mathlib/Algebra/Category/Ring/FilteredColimits.lean
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ protected lemma nontrivial {F : J ⥤ CommRingCat.{v}} [IsFilteredOrEmpty J]
(Types.FilteredColimit.isColimit_eq_iff' (isColimitOfPreserves (forget _) hc) _ _).mp h
exact zero_ne_one (((F.map f).hom.map_zero.symm.trans e).trans (F.map f).hom.map_one)

set_option linter.overlappingInstances false in
omit [IsFiltered J] in
instance {F : J ⥤ CommRingCat.{v}} [IsFilteredOrEmpty J]
[HasColimit F] [∀ i, Nontrivial (F.obj i)] : Nontrivial ↑(Limits.colimit F) :=
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/Algebra/Colimit/DirectLimit.lean
Original file line number Diff line number Diff line change
Expand Up @@ -833,8 +833,8 @@ end NonUnitalStarRing
namespace Algebra

variable [CommSemiring R]
variable [∀ i, Semiring (G i)] [∀ i j h, RingHomClass (T h) (G i) (G j)]
variable [∀ i, Algebra R (G i)] [∀ i j h, AlgHomClass (T h) R (G i) (G j)]
variable [∀ i, Semiring (G i)] [∀ i, Algebra R (G i)]
variable [∀ i j h, AlgHomClass (T h) R (G i) (G j)]
variable [Nonempty ι]

variable (G f) in
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Algebra/Homology/HomotopyFiber.lean
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class HasHomotopyFiber (φ : F ⟶ G) : Prop where
instance [HasBinaryBiproducts C] : HasHomotopyFiber φ where
hasBinaryBiproduct _ _ _ := inferInstance

variable [HasHomotopyFiber φ] [DecidableRel c.Rel]
variable [HasHomotopyFiber φ]

instance : HasHomotopyCofiber ((opFunctor C c).map φ.op) where
hasBinaryBiproduct i j hij := by
Expand Down
4 changes: 1 addition & 3 deletions Mathlib/Algebra/Module/DedekindDomain.lean
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@ public section

universe u v

variable {R : Type u} [CommRing R] [IsDomain R] {M : Type v} [AddCommGroup M] [Module R M]
variable {R : Type u} [CommRing R] [IsDedekindDomain R] {M : Type v} [AddCommGroup M] [Module R M]

open scoped DirectSum

namespace Submodule

variable [IsDedekindDomain R]

open UniqueFactorizationMonoid

/-- Over a Dedekind domain, an `I`-torsion module is the internal direct sum of its `p i ^ e i`-
Expand Down
1 change: 1 addition & 0 deletions Mathlib/Algebra/Module/Equiv/Defs.lean
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ variable [RingHomCompTriple σ₁₃ σ₃₄ σ₁₄] [RingHomCompTriple σ₄
variable [RingHomCompTriple σ₂₃ σ₃₄ σ₂₄] [RingHomCompTriple σ₄₃ σ₃₂ σ₄₂]
variable (e₁₂ : M₁ ≃ₛₗ[σ₁₂] M₂) (e₂₃ : M₂ ≃ₛₗ[σ₂₃] M₃)

set_option linter.overlappingInstances false in
/-- Linear equivalences are transitive. -/
-- Note: the `RingHomCompTriple σ₃₂ σ₂₁ σ₃₁` is unused, but is convenient to carry around
-- implicitly for lemmas like `LinearEquiv.self_trans_symm`.
Expand Down
7 changes: 4 additions & 3 deletions Mathlib/Algebra/Module/GradedModule.lean
Original file line number Diff line number Diff line change
Expand Up @@ -191,20 +191,21 @@ end SetLike
namespace GradedModule

variable [AddCommMonoid M] [Module A M] [SetLike σ M] [AddSubmonoidClass σ' A]
[AddSubmonoidClass σ M] [SetLike.GradedMonoid 𝓐] [SetLike.GradedSMul 𝓐 𝓜]
[AddSubmonoidClass σ M] [SetLike.GradedSMul 𝓐 𝓜]
[DecidableEq ιA] [DecidableEq ιM] [GradedRing 𝓐]

/-- The smul multiplication of `A` on `⨁ i, 𝓜 i` from `(⨁ i, 𝓐 i) →+ (⨁ i, 𝓜 i) →+ ⨁ i, 𝓜 i`
turns `⨁ i, 𝓜 i` into an `A`-module
-/
@[implicit_reducible]
def isModule [DecidableEq ιA] [DecidableEq ιM] [GradedRing 𝓐] : Module A (⨁ i, 𝓜 i) :=
def isModule : Module A (⨁ i, 𝓜 i) :=
{ Module.compHom _ (DirectSum.decomposeRingEquiv 𝓐 : A ≃+* ⨁ i, 𝓐 i).toRingHom with
smul := fun a b => DirectSum.decompose 𝓐 a • b }

/-- `⨁ i, 𝓜 i` and `M` are isomorphic as `A`-modules.
"The internal version" and "the external version" are isomorphism as `A`-modules.
-/
def linearEquiv [DecidableEq ιA] [DecidableEq ιM] [GradedRing 𝓐] [DirectSum.Decomposition 𝓜] :
def linearEquiv [DirectSum.Decomposition 𝓜] :
@LinearEquiv A A _ _ (RingHom.id A) (RingHom.id A) _ _ M (⨁ i, 𝓜 i) _
_ _ (by letI := isModule 𝓐 𝓜; infer_instance) := by
letI h := isModule 𝓐 𝓜
Expand Down
1 change: 1 addition & 0 deletions Mathlib/Algebra/Order/Antidiag/Prod.lean
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ instance [AddMonoid A] : Subsingleton (HasAntidiagonal A) where

-- The goal of this lemma is to allow to rewrite antidiagonal
-- when the decidability instances obfuscate Lean
set_option linter.overlappingInstances false in
lemma hasAntidiagonal_congr (A : Type*) [AddMonoid A]
[H1 : HasAntidiagonal A] [H2 : HasAntidiagonal A] :
H1.antidiagonal = H2.antidiagonal := by congr!; subsingleton
Expand Down
3 changes: 1 addition & 2 deletions Mathlib/Algebra/Order/Invertible.lean
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,5 @@ theorem invOf_le_one [Invertible a] (h : 1 ≤ a) : ⅟a ≤ 1 :=
theorem invOf_lt_one [Invertible a] (h : 1 < a) : ⅟a < 1 :=
mul_invOf_self a ▸ lt_mul_of_one_lt_left (invOf_pos.2 <| one_pos.trans h) h

theorem pos_invOf_of_invertible_cast [Nontrivial R] (n : ℕ)
[Invertible (n : R)] : 0 < ⅟(n : R) :=
theorem pos_invOf_of_invertible_cast (n : ℕ) [Invertible (n : R)] : 0 < ⅟(n : R) :=
invOf_pos.2 <| Nat.cast_pos.2 <| pos_of_invertible_cast (R := R) n
2 changes: 1 addition & 1 deletion Mathlib/Algebra/Polynomial/Div.lean
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ lemma _root_.Irreducible.isRoot_eq_bot_of_natDegree_ne_one
(hi : Irreducible p) (hdeg : p.natDegree ≠ 1) : p.IsRoot = ⊥ :=
le_bot_iff.mp fun _ ↦ hi.not_isRoot_of_natDegree_ne_one hdeg

lemma _root_.Irreducible.subsingleton_isRoot [IsLeftCancelMulZero R]
lemma _root_.Irreducible.subsingleton_isRoot
(hi : Irreducible p) : { x | p.IsRoot x }.Subsingleton :=
fun _ hx ↦ (subsingleton_isRoot_of_natDegree_eq_one <| natDegree_eq_of_degree_eq_some <|
degree_eq_one_of_irreducible_of_root hi hx) hx
Expand Down
13 changes: 6 additions & 7 deletions Mathlib/Algebra/Star/StarRingHom.lean
Original file line number Diff line number Diff line change
Expand Up @@ -260,27 +260,26 @@ namespace StarRingEquivClass
-- See note [lower instance priority]
instance (priority := 50) {F A B : Type*} [Add A] [Mul A] [Star A] [Add B] [Mul B] [Star B]
[EquivLike F A B] [hF : StarRingEquivClass F A B] :
StarHomClass F A B :=
{ hF with }
StarHomClass F A B where
__ := hF

-- See note [lower instance priority]
instance (priority := 100) {F A B : Type*} [NonUnitalNonAssocSemiring A] [Star A]
[NonUnitalNonAssocSemiring B] [Star B] [EquivLike F A B] [RingEquivClass F A B]
[StarRingEquivClass F A B] : NonUnitalStarRingHomClass F A B :=
{ }
[NonUnitalNonAssocSemiring B] [Star B] [EquivLike F A B] [StarRingEquivClass F A B] :
NonUnitalStarRingHomClass F A B where

/-- Turn an element of a type `F` satisfying `StarRingEquivClass F A B` into an actual
`StarRingEquiv`. This is declared as the default coercion from `F` to `A ≃⋆+* B`. -/
@[coe]
def toStarRingEquiv {F A B : Type*} [Add A] [Mul A] [Star A] [Add B] [Mul B] [Star B]
[EquivLike F A B] [RingEquivClass F A B] [StarRingEquivClass F A B] (f : F) : A ≃⋆+* B :=
[EquivLike F A B] [StarRingEquivClass F A B] (f : F) : A ≃⋆+* B :=
{ (RingEquivClass.toRingEquiv f : A ≃+* B) with
map_star' := map_star f }

/-- Any type satisfying `StarRingEquivClass` can be cast into `StarRingEquiv` via
`StarRingEquivClass.toStarRingEquiv`. -/
instance instCoeHead {F A B : Type*} [Add A] [Mul A] [Star A] [Add B] [Mul B] [Star B]
[EquivLike F A B] [RingEquivClass F A B] [StarRingEquivClass F A B] : CoeHead F (A ≃⋆+* B) :=
[EquivLike F A B] [StarRingEquivClass F A B] : CoeHead F (A ≃⋆+* B) :=
⟨toStarRingEquiv⟩

end StarRingEquivClass
Expand Down
2 changes: 0 additions & 2 deletions Mathlib/Analysis/CStarAlgebra/Spectrum.lean
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,6 @@ theorem sqrt_toReal_spectralRadius_self_mul_star_eq_norm (a : A) :

end CStarAlgebra

variable [StarModule ℂ A]

/-- Any element of the spectrum of a selfadjoint is real. -/
theorem IsSelfAdjoint.mem_spectrum_eq_re {a : A} (ha : IsSelfAdjoint a) {z : ℂ}
(hz : z ∈ spectrum ℂ a) : z = z.re := by
Expand Down
2 changes: 2 additions & 0 deletions Mathlib/Analysis/Convex/StdSimplex.lean
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ theorem ite_eq_mem_stdSimplex (i : ι) : (if i = · then (1 : 𝕜) else 0) ∈

variable [IsOrderedRing 𝕜]

set_option linter.overlappingInstances false

#adaptation_note /-- nightly-2024-03-11
we need a type annotation on the segment in the following two lemmas. -/

Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Analysis/Fourier/FiniteAbelian/Orthogonality.lean
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ section AddGroup
variable [AddGroup G]

section Semifield
variable [Fintype G] [Semifield R] [IsDomain R] [CharZero R] {ψ : AddChar G R}
variable [Fintype G] [Semifield R] [CharZero R] {ψ : AddChar G R}

lemma expect_eq_ite (ψ : AddChar G R) : 𝔼 a, ψ a = if ψ = 0 then 1 else 0 := by
simp [Fintype.expect_eq_sum_div_card, sum_eq_ite, ite_div]
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/Analysis/Normed/Field/Krasner.lean
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ theorem krasner [Field K] [Algebra K L]
IsKrasner.krasner' hx sp hy h

variable [NontriviallyNormedField K] [CompleteSpace K] [IsUltrametricDist K]
[NormedAlgebra K L] [Algebra.IsAlgebraic K L]
[NormedAlgebra K L]

/-- Krasner's lemma assuming `Normal K L`. -/
theorem of_completeSpace_of_normal [Normal K L] : IsKrasner K L where
Expand Down Expand Up @@ -114,7 +114,7 @@ If `K` is a complete nontrivially normed field and `L` is an algebraic extension
such that the norm of `L` extends the norm on `K`, then `IsKrasner K L` holds.
This corresponds to the classical Krasner's lemma.
-/
instance of_completeSpace : IsKrasner K L where
instance of_completeSpace [Algebra.IsAlgebraic K L] : IsKrasner K L where
krasner' {x} {y} xsep sp yint kr := by
-- Reduce to the case `L = algebraic closure of K` to apply the previous lemma.
let C := AlgebraicClosure K
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ lemma conjSqrt_le_conjSqrt {c a b : A} (h : a ≤ b) : conjSqrt c a ≤ conjSqrt

variable [IsSemitopologicalRing A] [T2Space A]

set_option linter.overlappingInstances false

@[grind =]
lemma isStrictlyPositive_conjSqrt_iff (c a : A) (hc : IsStrictlyPositive c := by cfc_tac) :
IsStrictlyPositive (conjSqrt c a) ↔ IsStrictlyPositive a := by
Expand Down
1 change: 1 addition & 0 deletions Mathlib/Analysis/SpecificLimits/Normed.lean
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,7 @@ lemma tendsto_smul_congr_of_tendsto_left_cobounded_of_isBoundedUnder
· rw [← tendsto_zero_iff_norm_tendsto_zero]
exact tendsto_zero_of_isBoundedUnder_smul_of_tendsto_cobounded hmul.norm.isBoundedUnder_le hf₁

set_option linter.overlappingInstances false in
-- The use case in mind for this is when `K = ℝ`, and `R = ℝ` or `ℂ`
lemma tendsto_smul_comp_nat_floor_of_tendsto_nsmul [NormSMulClass ℤ K] [LinearOrder K]
[IsStrictOrderedRing K] [FloorSemiring K] [HasSolidNorm K] {g : ℕ → R} {t : R}
Expand Down
1 change: 1 addition & 0 deletions Mathlib/CategoryTheory/Localization/Predicate.lean
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ the composition with a localization functor `L : C ⥤ D` with respect to
def functorEquivalence : D ⥤ E ≌ W.FunctorsInverting E :=
(whiskeringLeftFunctor L W E).asEquivalence

set_option linter.overlappingInstances false in
/-- The functor `(D ⥤ E) ⥤ (C ⥤ E)` given by the composition with a localization
functor `L : C ⥤ D` with respect to `W : MorphismProperty C`. -/
@[nolint unusedArguments]
Expand Down
1 change: 1 addition & 0 deletions Mathlib/CategoryTheory/Monoidal/Closed/Cartesian.lean
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def powZero [BraidedCategory C] {I : C} (t : IsInitial I) [MonoidalClosed C] : I
rw [← curry_natural_left, curry_eq_iff, ← cancel_epi (mulZero t).inv]
apply t.hom_ext

set_option linter.overlappingInstances false in
set_option backward.isDefEq.respectTransparency false in
-- TODO: Generalise the below to its commuted variants.
-- TODO: Define a distributive category, so that zero_mul and friends can be derived from this.
Expand Down
2 changes: 2 additions & 0 deletions Mathlib/CategoryTheory/MorphismProperty/OverAdjunction.lean
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def Over.mapCongr [Q.RespectsIso] {X Y : T} {f g : X ⟶ Y} (hfg : f = g) (hf :
Over.map Q hf ≅ Over.map (f := g) Q (by cat_disch) :=
NatIso.ofComponents (fun Y ↦ Over.isoMk (Iso.refl _))

set_option linter.overlappingInstances false in
/-- `Over.map` preserves identities. -/
@[simps!]
def Over.mapId [P.IsMultiplicative] [Q.RespectsIso] (X : T) (f : X ⟶ X := 𝟙 X)
Expand Down Expand Up @@ -225,6 +226,7 @@ def Under.mapCongr [Q.RespectsIso] {X Y : T} {f g : X ⟶ Y} (hfg : f = g) (hf :
Under.map Q hf ≅ Under.map (f := g) Q (by cat_disch) :=
NatIso.ofComponents (fun Y ↦ Under.isoMk (Iso.refl _))

set_option linter.overlappingInstances false in
/-- `Under.map` preserves identities. -/
@[simps!]
def Under.mapId [P.IsMultiplicative] [Q.RespectsIso] (X : T) (f : X ⟶ X := 𝟙 X)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,7 @@ example : ((A.triangulatedLocalizerMorphism B).localizedFunctor L₁ L₂).Full
example : ((A.triangulatedLocalizerMorphism B).localizedFunctor L₁ L₂).Faithful := by
infer_instance

instance [A.IsVerdierLeftLocalizing B] [Preadditive D₁] [Preadditive D₂]
[L₁.Additive] [L₂.Additive] :
instance [Preadditive D₁] [Preadditive D₂] [L₁.Additive] [L₂.Additive] :
((A.triangulatedLocalizerMorphism B).localizedFunctor L₁ L₂).Additive := by
let F := (A.triangulatedLocalizerMorphism B).localizedFunctor L₁ L₂
rw [Localization.functor_additive_iff L₁ (B.inverseImage A.ι).trW]
Expand All @@ -316,7 +315,7 @@ instance [A.IsVerdierLeftLocalizing B] [Preadditive D₁] [Preadditive D₂]
then the induced functor between the localizations with respect to `(B.inverseImage A.ι).trW`
and `B.trW` is fully faithful. -/
@[no_expose]
noncomputable def IsVerdierLeftLocalizing.fullyFaithful [A.IsVerdierLeftLocalizing B]
noncomputable def IsVerdierLeftLocalizing.fullyFaithful
{L₁ : A.FullSubcategory ⥤ D₁} {L₂ : C ⥤ D₂} {F : D₁ ⥤ D₂}
[L₁.IsLocalization (B.inverseImage A.ι).trW] [L₂.IsLocalization B.trW]
(e : L₁ ⋙ F ≅ A.ι ⋙ L₂) :
Expand Down
1 change: 1 addition & 0 deletions Mathlib/Control/Applicative.lean
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ theorem Applicative.map_seq_map (f : α → β → γ) (g : σ → β) (x : F α
theorem Applicative.pure_seq_eq_map' (f : α → β) : ((pure f : F (α → β)) <*> ·) = (f <$> ·) := by
simp [functor_norm]

set_option linter.overlappingInstances false in
theorem Applicative.ext {F} :
∀ {A1 : Applicative F} {A2 : Applicative F} [@LawfulApplicative F A1] [@LawfulApplicative F A2],
(∀ {α : Type u} (x : α), @Pure.pure _ A1.toPure _ x = @Pure.pure _ A2.toPure _ x) →
Expand Down
1 change: 1 addition & 0 deletions Mathlib/Control/Functor.lean
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ theorem Functor.map_comp_map (f : α → β) (g : β → γ) :
((g <$> ·) ∘ (f <$> ·) : F α → F γ) = ((g ∘ f) <$> ·) :=
funext fun _ => (comp_map _ _ _).symm

set_option linter.overlappingInstances false in
theorem Functor.ext {F} :
∀ {F1 : Functor F} {F2 : Functor F} [@LawfulFunctor F F1] [@LawfulFunctor F F2],
(∀ (α β) (f : α → β) (x : F α), @Functor.map _ F1 _ _ f x = @Functor.map _ F2 _ _ f x) →
Expand Down
3 changes: 2 additions & 1 deletion Mathlib/FieldTheory/Normal/Defs.lean
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,10 @@ theorem AlgEquiv.transfer_normal (f : E ≃ₐ[F] E') : Normal F E ↔ Normal F
⟨fun _ ↦ Normal.of_algEquiv f, fun _ ↦ Normal.of_algEquiv f.symm⟩

theorem Normal.of_equiv_equiv {M N : Type*} [Field N] [Field M] [Algebra M N]
[Algebra.IsAlgebraic F E] [h : Normal F E] {f : F ≃+* M} {g : E ≃+* N}
[h : Normal F E] {f : F ≃+* M} {g : E ≃+* N}
(hcomp : (algebraMap M N).comp f = (g : E →+* N).comp (algebraMap F E)) :
Normal M N := by
have := h
rw [normal_iff] at h ⊢
intro x
rw [← g.apply_symm_apply x]
Expand Down
1 change: 1 addition & 0 deletions Mathlib/GroupTheory/OreLocalization/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ protected def hsmul (c : R) :
rw [← mul_one (oreDenom (c • 1) s), ← oreDiv_smul_oreDiv, ← mul_one (oreDenom (c • 1) _),
← oreDiv_smul_oreDiv, ← OreLocalization.expand])

set_option linter.overlappingInstances false in
/- Warning: This gives a diamond on `SMul R[S⁻¹] M[S⁻¹][S⁻¹]`, but we will almost never localize
at the same monoid twice. -/
/- Although the definition does not require `IsScalarTower R M X`,
Expand Down
1 change: 1 addition & 0 deletions Mathlib/Init.lean
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public import Mathlib.Tactic.Linter.Header
public import Mathlib.Tactic.Linter.FlexibleLinter
public import Mathlib.Tactic.Linter.Multigoal
public import Mathlib.Tactic.Linter.OldObtain
public import Mathlib.Tactic.Linter.OverlappingInstances
public import Mathlib.Tactic.Linter.PrivateModule
public import Mathlib.Tactic.Linter.TacticDocumentation
-- The following import contains the environment extension for the unused tactic linter.
Expand Down
46 changes: 45 additions & 1 deletion Mathlib/Lean/Elab/InfoTree.lean
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,17 @@ def onHighestNode? {α} (t : InfoTree) (ctx? : Option ContextInfo)
(f : ContextInfo → Info → PersistentArray InfoTree → α) : Option α :=
t.findSome? (ctx? := ctx?) fun ctx i ch => some (f ctx i ch)

/--
Returns the context and `info` on the outermost `.node info _` which has
context, having merged and updated contexts appropriately.

If `ctx?` is `some ctx`, `ctx` is used as an initial context. A `ctx?` of `none` should **only** be
used when operating on the first node of the entire infotree. Otherwise, it is likely that no
context will be found.
-/
def getHighestInfo? (t : InfoTree) (ctx? : Option ContextInfo) : Option (ContextInfo × Info) :=
t.onHighestNode? ctx? fun ctx i _ => (ctx, i)

/--
Get the `parentDecl`s of every elaborated body.

Expand All @@ -119,6 +130,22 @@ def getDeclsByBody (t : InfoTree) : List Name :=
else decls
| _ => decls

/-- Gets the first child info of each `Lean.Elab.BodyInfo`, which should be the only child, and
should be a `TermInfo`, `PartialTermInfo`, or `TacticInfo`. `getDeclBodyInfos` does not validate
either of these conditions. -/
def getDeclBodyInfos (t : InfoTree) : List (Syntax × ContextInfo × Info) :=
t.foldInfoTree (init := []) fun ctx t acc =>
match t with
| .node (.ofCustomInfo i) body => Id.run do
if i.value.typeName == ``Lean.Elab.Term.BodyInfo then
if h : 0 < body.size then
-- See through `.context`s instead of just matching on `.node`:
let result? := body[0].getHighestInfo? ctx
if let some result := result? then
return (i.stx, result) :: acc
return acc
| _ => acc

/--
Get the declarations elaborated in the infotree `t` which are theorems according to the
environment. This includes e.g. `instance`s of `Prop` classes in addition to declarations declared
Expand All @@ -127,4 +154,21 @@ using the keyword `theorem` directly.
def getTheorems (t : InfoTree) (env : Environment) : List ConstantVal :=
t.getDeclsByBody.filterMap env.findTheoremConstVal?

end Lean.Elab.InfoTree
end InfoTree

namespace Info

/-- Gets the local context, and the expected type of the `Info`.
Handles `TacticInfo`s (looking at the first goal), `TermInfo`s, and `PartialTermInfo`s.
Does not get the metavariable context; assumes that the caller has accumulated an ambient
`ContextInfo` at this point which is sufficient. -/
def getLCtx? : Info → Option (LocalContext × Option Expr)
| .ofTacticInfo i => do
let g ← i.goalsBefore.head?
let decl ← i.mctxBefore.findDecl? g
some (decl.lctx, decl.type)
| .ofTermInfo i
| .ofPartialTermInfo i => some (i.lctx, i.expectedType?)
| _ => none

end Lean.Elab.Info
4 changes: 2 additions & 2 deletions Mathlib/LinearAlgebra/BilinearForm/Orthogonal.lean
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ theorem iIsOrtho.not_isOrtho_basis_self_of_nondegenerate {n : Type w} [Nontrivia

/-- Given an orthogonal basis with respect to a bilinear form, the bilinear form is nondegenerate
iff the basis has no elements which are self-orthogonal. -/
theorem iIsOrtho.nondegenerate_iff_not_isOrtho_basis_self {n : Type w} [Nontrivial R]
[IsDomain R] (B : BilinForm R M) (v : Basis n R M) (hO : B.iIsOrtho v) :
theorem iIsOrtho.nondegenerate_iff_not_isOrtho_basis_self {n : Type w} [IsDomain R]
(B : BilinForm R M) (v : Basis n R M) (hO : B.iIsOrtho v) :
B.Nondegenerate ↔ ∀ i, ¬B.IsOrtho (v i) (v i) :=
⟨hO.not_isOrtho_basis_self_of_nondegenerate, hO.nondegenerate_of_not_isOrtho_basis_self _⟩

Expand Down
2 changes: 2 additions & 0 deletions Mathlib/LinearAlgebra/Eigenspace/Matrix.lean
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ lemma hasEigenvector_toLin'_diagonal (d : n → R) (i : n) :
HasEigenvector (toLin' (diagonal d)) (d i) (Pi.basisFun R n i) :=
hasEigenvector_toLin_diagonal _ _ (Pi.basisFun R n)

set_option linter.overlappingInstances false

/-- Eigenvalues of a diagonal linear operator are the diagonal entries. -/
lemma hasEigenvalue_toLin_diagonal_iff (d : n → R) {μ : R} [IsDomain R] [IsTorsionFree R M]
(b : Basis n R M) : HasEigenvalue (toLin b b (diagonal d)) μ ↔ ∃ i, d i = μ := by
Expand Down
1 change: 1 addition & 0 deletions Mathlib/LinearAlgebra/RootSystem/Finite/G2.lean
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ lemma not_isG2_iff_isNotG2 :
· specialize h i j
lia

set_option linter.overlappingInstances false in
lemma IsG2.pairingIn_mem_zero_one_three [P.IsG2]
(i j : ι) (h : P.root i ≠ P.root j) (h' : P.root i ≠ -P.root j) :
P.pairingIn ℤ i j ∈ ({-3, -1, 0, 1, 3} : Set ℤ) := by
Expand Down
Loading
Loading