From 2dd3a1ae8a00272f4fc02e0acd3dd100f0f0399f Mon Sep 17 00:00:00 2001 From: leanprover-community-mathlib4-bot Date: Thu, 5 Feb 2026 13:14:22 +0000 Subject: [PATCH 01/33] Update lean-toolchain for testing https://github.com/leanprover/lean4/pull/12325 --- lake-manifest.json | 4 ++-- lakefile.lean | 2 +- lean-toolchain | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index 00f73aed808a81..f7c903beacf4d1 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,10 +65,10 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "ce030d6f9d50c300615415ad8d9e134636fa586a", + "rev": "18933b3edaa16d8aac444eae8997a32fbe700cbb", "name": "batteries", "manifestFile": "lake-manifest.json", - "inputRev": "nightly-testing", + "inputRev": "lean-pr-testing-12325", "inherited": false, "configFile": "lakefile.toml"}, {"url": "https://github.com/leanprover/lean4-cli", diff --git a/lakefile.lean b/lakefile.lean index 7f61f430740e47..22f2368a59cacd 100644 --- a/lakefile.lean +++ b/lakefile.lean @@ -6,7 +6,7 @@ open Lake DSL ## Mathlib dependencies on upstream projects -/ -require "leanprover-community" / "batteries" @ git "nightly-testing" +require "leanprover-community" / "batteries" @ git "lean-pr-testing-12325" require "leanprover-community" / "Qq" @ git "nightly-testing" require "leanprover-community" / "aesop" @ git "nightly-testing" require "leanprover-community" / "proofwidgets" @ git "v0.0.86" -- ProofWidgets should always be pinned to a specific version diff --git a/lean-toolchain b/lean-toolchain index f6c97cd73eda8a..85f6ca90d5bc36 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-02-04 +leanprover/lean4-pr-releases:pr-release-12325-7bf12d4 From f532e9a6d50035cbf05010bfcaa19db0d45ab256 Mon Sep 17 00:00:00 2001 From: leanprover-community-mathlib4-bot Date: Thu, 5 Feb 2026 15:02:53 +0000 Subject: [PATCH 02/33] Update lean-toolchain for https://github.com/leanprover/lean4/pull/12325 --- lake-manifest.json | 2 +- lean-toolchain | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index f7c903beacf4d1..2cc53420b64999 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,7 +65,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "18933b3edaa16d8aac444eae8997a32fbe700cbb", + "rev": "51c9db343ea7fb2d5775fcfb0ef782855c838b29", "name": "batteries", "manifestFile": "lake-manifest.json", "inputRev": "lean-pr-testing-12325", diff --git a/lean-toolchain b/lean-toolchain index 85f6ca90d5bc36..f8679fc221b678 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4-pr-releases:pr-release-12325-7bf12d4 +leanprover/lean4-pr-releases:pr-release-12325-466e765 From 04ae22641f130c2613ed1ba2ebc0c8b6f84466d4 Mon Sep 17 00:00:00 2001 From: leanprover-community-mathlib4-bot Date: Mon, 23 Feb 2026 20:40:58 +0000 Subject: [PATCH 03/33] Update lean-toolchain for testing https://github.com/leanprover/lean4/pull/12662 --- lake-manifest.json | 4 ++-- lakefile.lean | 2 +- lean-toolchain | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index 53cee42f7dd41c..25c353c13cf432 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,10 +65,10 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "24d33aadbf620c9ed742589b6a9c7da015351da5", + "rev": "6cdfa07f1030f6a94a342479dd57000d864b457e", "name": "batteries", "manifestFile": "lake-manifest.json", - "inputRev": "nightly-testing", + "inputRev": "lean-pr-testing-12662", "inherited": false, "configFile": "lakefile.toml"}, {"url": "https://github.com/leanprover/lean4-cli", diff --git a/lakefile.lean b/lakefile.lean index 9e20a1143179c6..707733609366fe 100644 --- a/lakefile.lean +++ b/lakefile.lean @@ -6,7 +6,7 @@ open Lake DSL ## Mathlib dependencies on upstream projects -/ -require "leanprover-community" / "batteries" @ git "nightly-testing" +require "leanprover-community" / "batteries" @ git "lean-pr-testing-12662" require "leanprover-community" / "Qq" @ git "nightly-testing" require "leanprover-community" / "aesop" @ git "nightly-testing" require "leanprover-community" / "proofwidgets" @ git "v0.0.87" -- ProofWidgets should always be pinned to a specific version diff --git a/lean-toolchain b/lean-toolchain index d8c58310bb86d9..5a522648c520c7 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-02-17 +leanprover/lean4-pr-releases:pr-release-12662-3c3eb02 From 6fdcfbf92215bfab42243f053bd407d7c58afe06 Mon Sep 17 00:00:00 2001 From: mhuisi Date: Wed, 25 Feb 2026 10:00:21 +0000 Subject: [PATCH 04/33] chore: adapt for inclusion of leading whitespace in input syntax --- Mathlib/CategoryTheory/ConcreteCategory/Basic.lean | 3 ++- Mathlib/CategoryTheory/ConcreteCategory/Forget.lean | 3 ++- Mathlib/Data/Nat/Choose/Basic.lean | 3 ++- Mathlib/RingTheory/Valuation/LocalSubring.lean | 7 ++++++- Mathlib/Tactic.lean | 5 ++--- Mathlib/Tactic/CancelDenoms.lean | 2 ++ Mathlib/Tactic/Linter.lean | 2 ++ Mathlib/Tactic/Monotonicity.lean | 2 ++ Mathlib/Tactic/NormNum.lean | 2 ++ Mathlib/Tactic/Positivity.lean | 2 ++ Mathlib/Tactic/Ring.lean | 2 ++ 11 files changed, 26 insertions(+), 7 deletions(-) diff --git a/Mathlib/CategoryTheory/ConcreteCategory/Basic.lean b/Mathlib/CategoryTheory/ConcreteCategory/Basic.lean index d20e8ec8005a86..1b3da22e41d480 100644 --- a/Mathlib/CategoryTheory/ConcreteCategory/Basic.lean +++ b/Mathlib/CategoryTheory/ConcreteCategory/Basic.lean @@ -1,7 +1,8 @@ /- Copyright (c) 2018 Kim Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. -Authors: Kim Morrison, Johannes Hölzl, Reid Barton, Sean Leather, Yury Kudryashov, Anne Baanen, Dagur Asgeirsson +Authors: Kim Morrison, Johannes Hölzl, Reid Barton, Sean Leather, Yury Kudryashov, Anne Baanen, + Dagur Asgeirsson -/ module diff --git a/Mathlib/CategoryTheory/ConcreteCategory/Forget.lean b/Mathlib/CategoryTheory/ConcreteCategory/Forget.lean index d0fa94d9ad22bc..a577d45e17cf02 100644 --- a/Mathlib/CategoryTheory/ConcreteCategory/Forget.lean +++ b/Mathlib/CategoryTheory/ConcreteCategory/Forget.lean @@ -1,7 +1,8 @@ /- Copyright (c) 2018 Kim Morrison. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. -Authors: Kim Morrison, Johannes Hölzl, Reid Barton, Sean Leather, Yury Kudryashov, Anne Baanen, Dagur Asgeirsson +Authors: Kim Morrison, Johannes Hölzl, Reid Barton, Sean Leather, Yury Kudryashov, Anne Baanen, + Dagur Asgeirsson -/ module diff --git a/Mathlib/Data/Nat/Choose/Basic.lean b/Mathlib/Data/Nat/Choose/Basic.lean index 555d7cb4d5c30b..992ff3e1ed9fd2 100644 --- a/Mathlib/Data/Nat/Choose/Basic.lean +++ b/Mathlib/Data/Nat/Choose/Basic.lean @@ -1,7 +1,8 @@ /- Copyright (c) 2018 Chris Hughes. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. -Authors: Chris Hughes, Bhavik Mehta, Stuart Presnell, Antoine Chambert-Loir, María-Inés de Frutos—Fernández +Authors: Chris Hughes, Bhavik Mehta, Stuart Presnell, Antoine Chambert-Loir, + María-Inés de Frutos—Fernández -/ module diff --git a/Mathlib/RingTheory/Valuation/LocalSubring.lean b/Mathlib/RingTheory/Valuation/LocalSubring.lean index 28d13cc023501c..842f4fd7a3833b 100644 --- a/Mathlib/RingTheory/Valuation/LocalSubring.lean +++ b/Mathlib/RingTheory/Valuation/LocalSubring.lean @@ -1,5 +1,6 @@ /- -Copyright (c) 2024 Andrew Yang, Yaël Dillies, Javier López-Contreras, Daniel Funck, Junyan Xu. All rights reserved. +Copyright (c) 2024 Andrew Yang, Yaël Dillies, Javier López-Contreras, Daniel Funck, Junyan Xu. +All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Andrew Yang, Yaël Dillies, Javier López-Contreras, Daniel Funck, Junyan Xu -/ @@ -12,6 +13,10 @@ public import Mathlib.RingTheory.Polynomial.Ideal public import Mathlib.RingTheory.Valuation.Integral public import Mathlib.RingTheory.Valuation.ValuationSubring +-- The copyright notice exceeds the maximum column width, but the `linter.style.header` linter +-- flags the copyright notice if "All rights reserved." is not on the same line as "Copyright". +set_option linter.style.header false + /-! # Valuation subrings are exactly the maximal local subrings diff --git a/Mathlib/Tactic.lean b/Mathlib/Tactic.lean index 54c811f9b68d41..3f78211a76b8c7 100644 --- a/Mathlib/Tactic.lean +++ b/Mathlib/Tactic.lean @@ -119,7 +119,6 @@ public import Mathlib.Tactic.GRewrite public import Mathlib.Tactic.GRewrite.Core public import Mathlib.Tactic.GRewrite.Elab public import Mathlib.Tactic.Generalize -public import Mathlib.Tactic.GeneralizeProofs public import Mathlib.Tactic.Group public import Mathlib.Tactic.GuardGoalNums public import Mathlib.Tactic.GuardHypNums @@ -152,7 +151,6 @@ public import Mathlib.Tactic.LinearCombination' public import Mathlib.Tactic.LinearCombination.Lemmas public import Mathlib.Tactic.Linter public import Mathlib.Tactic.Linter.CommandRanges -public import Mathlib.Tactic.Linter.CommandStart public import Mathlib.Tactic.Linter.DeprecatedModule public import Mathlib.Tactic.Linter.DeprecatedSyntaxLinter public import Mathlib.Tactic.Linter.DirectoryDependency @@ -240,7 +238,6 @@ public import Mathlib.Tactic.Positivity.Basic public import Mathlib.Tactic.Positivity.Core public import Mathlib.Tactic.Positivity.Finset public import Mathlib.Tactic.ProdAssoc -public import Mathlib.Tactic.Propose public import Mathlib.Tactic.ProxyType public import Mathlib.Tactic.Push public import Mathlib.Tactic.Push.Attr @@ -323,3 +320,5 @@ public import Mathlib.Tactic.Widget.SelectPanelUtils public import Mathlib.Tactic.Widget.StringDiagram public import Mathlib.Tactic.WithoutCDot public import Mathlib.Tactic.Zify + +set_option linter.style.header false diff --git a/Mathlib/Tactic/CancelDenoms.lean b/Mathlib/Tactic/CancelDenoms.lean index 0f0d02d1e46f15..feb75d4d83bb9e 100644 --- a/Mathlib/Tactic/CancelDenoms.lean +++ b/Mathlib/Tactic/CancelDenoms.lean @@ -2,3 +2,5 @@ module public import Mathlib.Tactic.CancelDenoms.Core public import Mathlib.Tactic.NormNum.Ineq + +set_option linter.style.header false diff --git a/Mathlib/Tactic/Linter.lean b/Mathlib/Tactic/Linter.lean index 310e9d9a6e06cf..8bd76d57ce0b46 100644 --- a/Mathlib/Tactic/Linter.lean +++ b/Mathlib/Tactic/Linter.lean @@ -16,3 +16,5 @@ public import Mathlib.Tactic.Linter.PPRoundtrip public import Mathlib.Tactic.Linter.PrivateModule public import Mathlib.Tactic.Linter.UnusedInstancesInType public import Mathlib.Tactic.Linter.UpstreamableDecl + +set_option linter.style.header false diff --git a/Mathlib/Tactic/Monotonicity.lean b/Mathlib/Tactic/Monotonicity.lean index a4a268ac4657c8..dec6ecbf4cfbca 100644 --- a/Mathlib/Tactic/Monotonicity.lean +++ b/Mathlib/Tactic/Monotonicity.lean @@ -2,3 +2,5 @@ module public import Mathlib.Tactic.Monotonicity.Basic public import Mathlib.Tactic.Monotonicity.Lemmas + +set_option linter.style.header false diff --git a/Mathlib/Tactic/NormNum.lean b/Mathlib/Tactic/NormNum.lean index 160c73ae742daf..7a839bb5977144 100644 --- a/Mathlib/Tactic/NormNum.lean +++ b/Mathlib/Tactic/NormNum.lean @@ -9,3 +9,5 @@ public import Mathlib.Tactic.NormNum.Ineq public import Mathlib.Tactic.NormNum.Inv public import Mathlib.Tactic.NormNum.OfScientific public import Mathlib.Tactic.NormNum.Pow + +set_option linter.style.header false diff --git a/Mathlib/Tactic/Positivity.lean b/Mathlib/Tactic/Positivity.lean index c55fd1e6a882e6..eaffac58155e49 100644 --- a/Mathlib/Tactic/Positivity.lean +++ b/Mathlib/Tactic/Positivity.lean @@ -2,3 +2,5 @@ module public import Mathlib.Tactic.Positivity.Basic public import Mathlib.Tactic.Positivity.Finset + +set_option linter.style.header false diff --git a/Mathlib/Tactic/Ring.lean b/Mathlib/Tactic/Ring.lean index 4bddcebb2e6a40..a0dab621a2ef7c 100644 --- a/Mathlib/Tactic/Ring.lean +++ b/Mathlib/Tactic/Ring.lean @@ -3,3 +3,5 @@ module public import Mathlib.Tactic.Ring.Basic public import Mathlib.Tactic.Ring.PNat public import Mathlib.Tactic.Ring.RingNF + +set_option linter.style.header false From faad3887cce5277c814253f32ba74ceb3ba3505a Mon Sep 17 00:00:00 2001 From: mhuisi Date: Wed, 25 Feb 2026 12:48:19 +0000 Subject: [PATCH 05/33] chore: add Mathlib.Tactic exception --- Mathlib/Tactic.lean | 5 +++-- Mathlib/Tactic/Linter/Header.lean | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Mathlib/Tactic.lean b/Mathlib/Tactic.lean index 3f78211a76b8c7..54c811f9b68d41 100644 --- a/Mathlib/Tactic.lean +++ b/Mathlib/Tactic.lean @@ -119,6 +119,7 @@ public import Mathlib.Tactic.GRewrite public import Mathlib.Tactic.GRewrite.Core public import Mathlib.Tactic.GRewrite.Elab public import Mathlib.Tactic.Generalize +public import Mathlib.Tactic.GeneralizeProofs public import Mathlib.Tactic.Group public import Mathlib.Tactic.GuardGoalNums public import Mathlib.Tactic.GuardHypNums @@ -151,6 +152,7 @@ public import Mathlib.Tactic.LinearCombination' public import Mathlib.Tactic.LinearCombination.Lemmas public import Mathlib.Tactic.Linter public import Mathlib.Tactic.Linter.CommandRanges +public import Mathlib.Tactic.Linter.CommandStart public import Mathlib.Tactic.Linter.DeprecatedModule public import Mathlib.Tactic.Linter.DeprecatedSyntaxLinter public import Mathlib.Tactic.Linter.DirectoryDependency @@ -238,6 +240,7 @@ public import Mathlib.Tactic.Positivity.Basic public import Mathlib.Tactic.Positivity.Core public import Mathlib.Tactic.Positivity.Finset public import Mathlib.Tactic.ProdAssoc +public import Mathlib.Tactic.Propose public import Mathlib.Tactic.ProxyType public import Mathlib.Tactic.Push public import Mathlib.Tactic.Push.Attr @@ -320,5 +323,3 @@ public import Mathlib.Tactic.Widget.SelectPanelUtils public import Mathlib.Tactic.Widget.StringDiagram public import Mathlib.Tactic.WithoutCDot public import Mathlib.Tactic.Zify - -set_option linter.style.header false diff --git a/Mathlib/Tactic/Linter/Header.lean b/Mathlib/Tactic/Linter/Header.lean index bd62c956b86f14..bf7f4d8200d238 100644 --- a/Mathlib/Tactic/Linter/Header.lean +++ b/Mathlib/Tactic/Linter/Header.lean @@ -419,7 +419,7 @@ def headerLinter : Linter where run := withSetOptionIn fun stx ↦ do | .original lead .. => lead.toString | _ => "" -- Report any errors about the copyright line. - if mainModule != `Mathlib.Init then + if mainModule != `Mathlib.Init && mainModule != `Mathlib.Tactic then for (stx, m) in copyrightHeaderChecks copyright do Linter.logLint linter.style.header stx m!"* '{stx.getAtomVal}':\n{m}\n" -- Report a missing module doc-string. From 445449b1bfa166825b57eb0791fc4f3fded9aa8e Mon Sep 17 00:00:00 2001 From: leanprover-community-mathlib4-bot Date: Wed, 25 Feb 2026 14:14:09 +0000 Subject: [PATCH 06/33] Update lean-toolchain for https://github.com/leanprover/lean4/pull/12662 --- lake-manifest.json | 2 +- lean-toolchain | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index 25c353c13cf432..850d39a9ca140b 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,7 +65,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "6cdfa07f1030f6a94a342479dd57000d864b457e", + "rev": "b05c36dc4432582e2d2666ffba824752f8286600", "name": "batteries", "manifestFile": "lake-manifest.json", "inputRev": "lean-pr-testing-12662", diff --git a/lean-toolchain b/lean-toolchain index 5a522648c520c7..aed715b7e8c61a 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4-pr-releases:pr-release-12662-3c3eb02 +leanprover/lean4-pr-releases:pr-release-12662-bd55a8b From 129c3f7e105d5dfe00bce85d4718039ca66b2421 Mon Sep 17 00:00:00 2001 From: mhuisi Date: Thu, 26 Feb 2026 09:55:55 +0000 Subject: [PATCH 07/33] chore: add module docstring linter special handling for eoi tokens --- Mathlib/Tactic/Linter/Header.lean | 1 + 1 file changed, 1 insertion(+) diff --git a/Mathlib/Tactic/Linter/Header.lean b/Mathlib/Tactic/Linter/Header.lean index bf7f4d8200d238..5e3afb470296e6 100644 --- a/Mathlib/Tactic/Linter/Header.lean +++ b/Mathlib/Tactic/Linter/Header.lean @@ -426,6 +426,7 @@ def headerLinter : Linter where run := withSetOptionIn fun stx ↦ do match afterImports with | none => return | some (.node _ ``Lean.Parser.Command.moduleDoc _) => return + | some (.node _ ``Lean.Parser.Command.eoi _) => return | some rest => Linter.logLint linter.style.header rest m!"The module doc-string for a file should be the first command after the imports.\n\ From edb380ebbb02bbb8b004b73218b0e1eed22cd805 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Thu, 5 Mar 2026 00:00:53 +0000 Subject: [PATCH 08/33] rm stray file --- Mathlib/Algebra/Order/Module/OrderedSMul.lean | 151 ------------------ 1 file changed, 151 deletions(-) delete mode 100644 Mathlib/Algebra/Order/Module/OrderedSMul.lean diff --git a/Mathlib/Algebra/Order/Module/OrderedSMul.lean b/Mathlib/Algebra/Order/Module/OrderedSMul.lean deleted file mode 100644 index c171752e876500..00000000000000 --- a/Mathlib/Algebra/Order/Module/OrderedSMul.lean +++ /dev/null @@ -1,151 +0,0 @@ -/- -Copyright (c) 2020 Frédéric Dupuis. All rights reserved. -Released under Apache 2.0 license as described in the file LICENSE. -Authors: Frédéric Dupuis --/ -module -- shake: keep-all - -public import Mathlib.Algebra.Field.Defs -public import Mathlib.Algebra.Group.Action.Basic -public import Mathlib.Algebra.GroupWithZero.Action.Pi -public import Mathlib.Algebra.GroupWithZero.Action.Prod -public import Mathlib.Algebra.Order.Module.Defs - -/-! -# Ordered scalar product - -In this file we define - -* `OrderedSMul R M` : an ordered additive commutative monoid `M` is an `OrderedSMul` - over an `OrderedSemiring` `R` if the scalar product respects the order relation on the - monoid and on the ring. There is a correspondence between this structure and convex cones, - which is proven in `Mathlib/Analysis/Convex/Cone.lean`. - -## Implementation notes -* We choose to define `OrderedSMul` as a `Prop`-valued mixin, so that it can be - used for actions, modules, and algebras - (the axioms for an "ordered algebra" are exactly that the algebra is ordered as a module). -* To get ordered modules and ordered vector spaces, it suffices to replace the - `OrderedAddCommMonoid` and the `OrderedSemiring` as desired. - -## TODO - -This file is now mostly useless. We should try deleting `OrderedSMul` - -## References - -* https://en.wikipedia.org/wiki/Ordered_vector_space - -## Tags - -ordered module, ordered scalar, ordered smul, ordered action, ordered vector space --/ - -@[expose] public section - -deprecated_module (since := "2025-08-25") - -/-- The ordered scalar product property is when an ordered additive commutative monoid -with a partial order has a scalar multiplication which is compatible with the order. Note that this -is different from `IsOrderedSMul`, which uses `≤`, has no semiring assumption, and has no positivity -constraint on the defining conditions. --/ -@[deprecated IsStrictOrderedModule (since := "2025-08-25")] -class OrderedSMul (R M : Type*) [Semiring R] [PartialOrder R] - [AddCommMonoid M] [PartialOrder M] [SMulWithZero R M] : - Prop where - /-- Scalar multiplication by positive elements preserves the order. -/ - protected smul_lt_smul_of_pos : ∀ {a b : M}, ∀ {c : R}, a < b → 0 < c → c • a < c • b - /-- If `c • a < c • b` for some positive `c`, then `a < b`. -/ - protected lt_of_smul_lt_smul_of_pos : ∀ {a b : M}, ∀ {c : R}, c • a < c • b → 0 < c → a < b - -variable {ι 𝕜 R M N : Type*} - -section OrderedSMul -set_option linter.deprecated false -variable [Semiring R] [PartialOrder R] [AddCommMonoid M] [PartialOrder M] - [SMulWithZero R M] [OrderedSMul R M] - -instance OrderedSMul.toPosSMulStrictMono : PosSMulStrictMono R M where - smul_lt_smul_of_pos_left _a ha _b₁ _b₂ hb := OrderedSMul.smul_lt_smul_of_pos hb ha - -instance OrderedSMul.toPosSMulReflectLT : PosSMulReflectLT R M := - .of_pos fun _a ha _b₁ _b₂ h ↦ OrderedSMul.lt_of_smul_lt_smul_of_pos h ha - -instance OrderDual.instOrderedSMul : OrderedSMul R Mᵒᵈ where - smul_lt_smul_of_pos := OrderedSMul.smul_lt_smul_of_pos (M := M) - lt_of_smul_lt_smul_of_pos := OrderedSMul.lt_of_smul_lt_smul_of_pos (M := M) - -end OrderedSMul - -set_option linter.deprecated false in -/-- To prove that a linear ordered monoid is an ordered module, it suffices to verify only the first -axiom of `OrderedSMul`. -/ -theorem OrderedSMul.mk'' [Semiring 𝕜] [PartialOrder 𝕜] - [AddCommMonoid M] [LinearOrder M] [SMulWithZero 𝕜 M] - (h : ∀ ⦃c : 𝕜⦄, 0 < c → StrictMono fun a : M => c • a) : OrderedSMul 𝕜 M := - { smul_lt_smul_of_pos := fun hab hc => h hc hab - lt_of_smul_lt_smul_of_pos := fun hab hc => (h hc).lt_iff_lt.1 hab } - -set_option linter.deprecated false in -instance Nat.orderedSMul [AddCommMonoid M] [LinearOrder M] [IsOrderedCancelAddMonoid M] : - OrderedSMul ℕ M := - OrderedSMul.mk'' fun n hn a b hab => by - cases n with - | zero => cases hn - | succ n => - induction n with - | zero => dsimp; rwa [one_nsmul, one_nsmul] - | succ n ih => simp only [succ_nsmul _ n.succ, _root_.add_lt_add (ih n.succ_pos) hab] - -set_option linter.deprecated false in -instance Int.orderedSMul [AddCommGroup M] [LinearOrder M] [IsOrderedAddMonoid M] : - OrderedSMul ℤ M := - OrderedSMul.mk'' fun n hn => by - cases n - · simp only [Int.ofNat_eq_coe, Int.natCast_pos, natCast_zsmul] at hn ⊢ - exact strictMono_smul_left_of_pos hn - · cases (Int.negSucc_not_pos _).1 hn - -section LinearOrderedSemiring -variable [Semiring R] [LinearOrder R] [IsStrictOrderedRing R] - -set_option linter.deprecated false in -instance LinearOrderedSemiring.toOrderedSMul : OrderedSMul R R := - OrderedSMul.mk'' fun _ => strictMono_mul_left_of_pos - -end LinearOrderedSemiring - -section LinearOrderedSemifield - -variable [Semifield 𝕜] [PartialOrder 𝕜] [IsStrictOrderedRing 𝕜] [PosMulReflectLT 𝕜] - [AddCommMonoid M] [PartialOrder M] - [AddCommMonoid N] [PartialOrder N] - [MulActionWithZero 𝕜 M] [MulActionWithZero 𝕜 N] - -set_option linter.deprecated false in -/-- To prove that a vector space over a linear ordered field is ordered, it suffices to verify only -the first axiom of `OrderedSMul`. -/ -theorem OrderedSMul.mk' (h : ∀ ⦃a b : M⦄ ⦃c : 𝕜⦄, a < b → 0 < c → c • a ≤ c • b) : - OrderedSMul 𝕜 M := by - have hlt' : ∀ (a b : M) (c : 𝕜), a < b → 0 < c → c • a < c • b := by - refine fun a b c hab hc => (h hab hc).lt_of_ne ?_ - rw [Ne, hc.ne'.isUnit.smul_left_cancel] - exact hab.ne - refine ⟨fun {a b c} => hlt' a b c, fun {a b c hab hc} => ?_⟩ - obtain ⟨c, rfl⟩ := hc.ne'.isUnit - rw [← inv_smul_smul c a, ← inv_smul_smul c b] - refine hlt' _ _ _ hab (pos_of_mul_pos_right ?_ hc.le) - simp only [c.mul_inv, zero_lt_one] - -set_option linter.deprecated false in -instance [OrderedSMul 𝕜 M] [OrderedSMul 𝕜 N] : OrderedSMul 𝕜 (M × N) := - OrderedSMul.mk' fun _ _ _ h hc => - ⟨smul_le_smul_of_nonneg_left h.1.1 hc.le, smul_le_smul_of_nonneg_left h.1.2 hc.le⟩ - -set_option linter.deprecated false in -instance Pi.orderedSMul {M : ι → Type*} [∀ i, AddCommMonoid (M i)] [∀ i, PartialOrder (M i)] - [∀ i, MulActionWithZero 𝕜 (M i)] [∀ i, OrderedSMul 𝕜 (M i)] : OrderedSMul 𝕜 (∀ i, M i) := - OrderedSMul.mk' fun _ _ _ h hc i => smul_le_smul_of_nonneg_left (h.le i) hc.le - -end LinearOrderedSemifield From aaea3359138ec18e31ec30c3e02325e61246c58e Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Thu, 5 Mar 2026 01:15:31 +0000 Subject: [PATCH 09/33] mk_all --- Mathlib.lean | 1 - 1 file changed, 1 deletion(-) diff --git a/Mathlib.lean b/Mathlib.lean index 253ceab0074963..4d3093203e2403 100644 --- a/Mathlib.lean +++ b/Mathlib.lean @@ -984,7 +984,6 @@ public import Mathlib.Algebra.Order.Module.Defs public import Mathlib.Algebra.Order.Module.Equiv public import Mathlib.Algebra.Order.Module.Field public import Mathlib.Algebra.Order.Module.HahnEmbedding -public import Mathlib.Algebra.Order.Module.OrderedSMul public import Mathlib.Algebra.Order.Module.Pointwise public import Mathlib.Algebra.Order.Module.PositiveLinearMap public import Mathlib.Algebra.Order.Module.Rat From d20daa0a95e7231f82d4efc32b0109a364e2571d Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Thu, 5 Mar 2026 04:16:30 +0000 Subject: [PATCH 10/33] fixes --- Mathlib/Algebra/Algebra/ZMod.lean | 1 + Mathlib/Algebra/BrauerGroup/Defs.lean | 1 + .../Category/FGModuleCat/Colimits.lean | 1 + .../Algebra/Category/FGModuleCat/Limits.lean | 1 + Mathlib/Algebra/Category/Grp/Abelian.lean | 2 ++ .../Algebra/Category/ModuleCat/Abelian.lean | 2 ++ .../Algebra/Category/ModuleCat/Descent.lean | 1 + .../Algebra/Category/ModuleCat/EpiMono.lean | 1 + .../Category/ModuleCat/Presheaf/Sheafify.lean | 1 + Mathlib/Algebra/CharP/Invertible.lean | 3 ++ Mathlib/Algebra/CharP/MixedCharZero.lean | 1 + Mathlib/Algebra/DirectSum/Decomposition.lean | 1 + Mathlib/Algebra/Expr.lean | 4 +++ Mathlib/Algebra/Field/IsField.lean | 2 ++ Mathlib/Algebra/GCDMonoid/Basic.lean | 9 ++++++ Mathlib/Algebra/Group/Action/Basic.lean | 4 +-- Mathlib/Algebra/Group/Action/Defs.lean | 2 +- .../Group/Action/Pointwise/Finset.lean | 4 +-- .../Group/Action/Pointwise/Set/Basic.lean | 4 +-- Mathlib/Algebra/Group/Hom/Basic.lean | 2 ++ Mathlib/Algebra/Group/Invertible/Basic.lean | 5 ++- Mathlib/Algebra/Group/Invertible/Defs.lean | 6 ++++ .../Algebra/Group/Pointwise/Finset/Basic.lean | 22 ++++++------- .../Group/Pointwise/Finset/Scalar.lean | 4 +-- .../Algebra/Group/Pointwise/Set/Basic.lean | 22 ++++++------- .../Algebra/Group/Pointwise/Set/Scalar.lean | 4 +-- .../Algebra/Group/Submonoid/Pointwise.lean | 4 +-- Mathlib/Algebra/Group/Units/Defs.lean | 3 ++ .../Algebra/GroupWithZero/Action/Defs.lean | 2 ++ Mathlib/Algebra/GroupWithZero/Basic.lean | 1 + Mathlib/Algebra/GroupWithZero/InjSurj.lean | 1 + Mathlib/Algebra/GroupWithZero/Invertible.lean | 2 ++ .../Algebra/GroupWithZero/Units/Basic.lean | 2 ++ .../Algebra/Homology/ComplexShapeSigns.lean | 3 ++ Mathlib/Algebra/Lie/Basic.lean | 2 ++ Mathlib/Algebra/Lie/Classical.lean | 1 + Mathlib/Algebra/Lie/Extension.lean | 2 +- Mathlib/Algebra/Module/GradedModule.lean | 1 + Mathlib/Algebra/Module/NatInt.lean | 2 ++ Mathlib/Algebra/Module/Submodule/Defs.lean | 1 + Mathlib/Algebra/MonoidAlgebra/Module.lean | 1 + Mathlib/Algebra/Order/Archimedean/Basic.lean | 1 + Mathlib/Algebra/Order/Floor/Defs.lean | 4 ++- .../Algebra/Order/Monoid/Unbundled/Basic.lean | 4 +-- Mathlib/Algebra/Ring/Invertible.lean | 1 + Mathlib/Algebra/SkewMonoidAlgebra/Basic.lean | 1 + Mathlib/Algebra/Star/RingQuot.lean | 1 + Mathlib/AlgebraicGeometry/Cover/Directed.lean | 1 + .../ModelCategory/Basic.lean | 1 + .../Analysis/CStarAlgebra/CStarMatrix.lean | 1 + Mathlib/Analysis/CStarAlgebra/Matrix.lean | 2 ++ .../Analysis/CStarAlgebra/Module/Defs.lean | 1 + .../Complex/UpperHalfPlane/Metric.lean | 1 + .../Analysis/Distribution/TestFunction.lean | 1 + Mathlib/Analysis/InnerProductSpace/Basic.lean | 2 ++ Mathlib/Analysis/InnerProductSpace/Defs.lean | 5 +++ .../Analysis/InnerProductSpace/OfNorm.lean | 1 + .../Analysis/LocallyConvex/WithSeminorms.lean | 1 + Mathlib/Analysis/Matrix/Order.lean | 3 ++ Mathlib/Analysis/Matrix/PosDef.lean | 2 ++ .../Analysis/Normed/Algebra/Exponential.lean | 2 ++ Mathlib/Analysis/Normed/Field/Basic.lean | 2 ++ Mathlib/Analysis/Normed/Group/AddTorsor.lean | 2 ++ Mathlib/Analysis/Normed/Module/Basic.lean | 2 ++ Mathlib/Analysis/Normed/Ring/Basic.lean | 1 + .../Normed/Unbundled/SpectralNorm.lean | 7 ++++ Mathlib/Analysis/RCLike/Basic.lean | 2 ++ Mathlib/CategoryTheory/Abelian/Basic.lean | 5 ++- .../Abelian/NonPreadditive.lean | 1 + Mathlib/CategoryTheory/Abelian/Transfer.lean | 3 +- .../Bicategory/Monad/Basic.lean | 1 + Mathlib/CategoryTheory/CatCommSq.lean | 10 +++--- Mathlib/CategoryTheory/Center/Linear.lean | 3 ++ .../ConcreteCategory/Forget.lean | 1 + Mathlib/CategoryTheory/Enriched/Basic.lean | 1 + .../Enriched/FunctorCategory.lean | 1 + .../Enriched/Ordinary/Basic.lean | 1 + Mathlib/CategoryTheory/EpiMono.lean | 1 + .../FiberedCategory/HasFibers.lean | 1 + .../CategoryTheory/Functor/Functorial.lean | 1 + Mathlib/CategoryTheory/Groupoid.lean | 4 +++ .../CategoryTheory/Groupoid/Subgroupoid.lean | 1 + Mathlib/CategoryTheory/IsConnected.lean | 1 + .../LimitsOfProductsAndEqualizers.lean | 8 +++++ Mathlib/CategoryTheory/Limits/Creates.lean | 25 +++++++++++++++ Mathlib/CategoryTheory/Limits/Final.lean | 4 +++ .../Limits/FullSubcategory.lean | 6 ++++ .../Limits/MorphismProperty.lean | 4 +++ Mathlib/CategoryTheory/Limits/Preorder.lean | 8 +++++ .../Limits/Preserves/Creates/Finite.lean | 8 +++++ .../Limits/Shapes/ConcreteCategory.lean | 1 + .../Limits/Shapes/NormalMono/Basic.lean | 12 +++++++ .../Limits/Shapes/ZeroMorphisms.lean | 2 ++ .../Localization/Bifunctor.lean | 2 ++ .../CalculusOfFractions/Preadditive.lean | 3 ++ .../Localization/HasLocalization.lean | 1 + .../CategoryTheory/Localization/Linear.lean | 1 + .../Localization/LocallySmall.lean | 1 + .../Localization/Monoidal/Functor.lean | 1 + .../Localization/Predicate.lean | 2 +- .../Localization/Triangulated.lean | 1 + .../Localization/Trifunctor.lean | 2 ++ .../ChosenPullbacksAlong.lean | 13 +++++--- .../ExponentiableMorphism.lean | 2 ++ .../CategoryTheory/Monad/Comonadicity.lean | 5 +++ Mathlib/CategoryTheory/Monad/Limits.lean | 8 +++++ Mathlib/CategoryTheory/Monad/Monadicity.lean | 5 +++ .../CategoryTheory/Monoidal/Action/End.lean | 4 +-- .../Monoidal/Action/Opposites.lean | 4 +-- Mathlib/CategoryTheory/Monoidal/Bimod.lean | 1 + .../Monoidal/Braided/Basic.lean | 5 +++ .../Monoidal/Braided/Multifunctor.lean | 2 ++ .../Monoidal/Braided/Reflection.lean | 2 ++ .../Monoidal/Cartesian/Basic.lean | 1 + .../Monoidal/Cartesian/CommGrp_.lean | 1 + .../Monoidal/Cartesian/Grp_.lean | 1 + .../Monoidal/Cartesian/Mon_.lean | 2 +- .../CategoryTheory/Monoidal/Closed/Basic.lean | 3 ++ .../Monoidal/Closed/Cartesian.lean | 1 + .../Closed/FunctorCategory/Basic.lean | 1 + .../Closed/FunctorCategory/Complete.lean | 2 ++ .../CategoryTheory/Monoidal/Closed/Ideal.lean | 2 ++ .../CategoryTheory/Monoidal/Closed/Types.lean | 1 + .../CategoryTheory/Monoidal/Closed/Zero.lean | 1 + .../Monoidal/DayConvolution.lean | 5 +++ Mathlib/CategoryTheory/Monoidal/Functor.lean | 15 ++++++--- Mathlib/CategoryTheory/Monoidal/Mod_.lean | 2 +- Mathlib/CategoryTheory/Monoidal/Mon_.lean | 2 +- .../CategoryTheory/Monoidal/Multifunctor.lean | 3 ++ .../Monoidal/OfHasFiniteProducts.lean | 5 +-- .../CategoryTheory/Monoidal/Rigid/Basic.lean | 5 +++ .../Monoidal/Rigid/Braided.lean | 3 ++ .../Monoidal/Rigid/OfEquivalence.lean | 7 ++++ .../CategoryTheory/Monoidal/Transport.lean | 4 ++- Mathlib/CategoryTheory/Preadditive/Schur.lean | 1 + .../CategoryTheory/Preadditive/Transfer.lean | 1 + Mathlib/CategoryTheory/Quotient/Linear.lean | 4 +++ .../CategoryTheory/Quotient/Preadditive.lean | 1 + Mathlib/CategoryTheory/Shift/Adjunction.lean | 6 ++-- Mathlib/CategoryTheory/Shift/Basic.lean | 2 ++ Mathlib/CategoryTheory/Shift/CommShift.lean | 4 ++- Mathlib/CategoryTheory/Shift/Induced.lean | 2 ++ .../Shift/InducedShiftSequence.lean | 1 + .../CategoryTheory/Shift/Localization.lean | 5 ++- Mathlib/CategoryTheory/Shift/Opposite.lean | 2 +- .../CategoryTheory/Shift/ShiftSequence.lean | 1 + Mathlib/CategoryTheory/Sites/Limits.lean | 1 + Mathlib/CategoryTheory/Sites/Monoidal.lean | 2 ++ Mathlib/CategoryTheory/Thin.lean | 1 + .../TStructure/AbelianSubcategory.lean | 1 + .../Triangulated/TStructure/Heart.lean | 1 + Mathlib/Combinatorics/Configuration.lean | 2 ++ Mathlib/Combinatorics/Hindman.lean | 4 +-- .../Combinatorics/Quiver/Arborescence.lean | 1 + .../Quiver/ConnectedComponent.lean | 2 ++ .../SimpleGraph/CompleteMultipartite.lean | 1 + .../SimpleGraph/Connectivity/Connected.lean | 1 + .../SimpleGraph/Extremal/Turan.lean | 1 + .../SimpleGraph/Hamiltonian.lean | 1 + .../Combinatorics/SimpleGraph/Subgraph.lean | 1 + Mathlib/Combinatorics/SimpleGraph/Trails.lean | 1 + Mathlib/Computability/Primrec/Basic.lean | 2 ++ Mathlib/Computability/Primrec/List.lean | 1 + Mathlib/Computability/Tape.lean | 1 + Mathlib/Control/Functor/Multivariate.lean | 1 + Mathlib/Control/Monad/Writer.lean | 2 +- Mathlib/Control/Traversable/Equiv.lean | 2 ++ Mathlib/Control/ULiftable.lean | 4 +++ Mathlib/Data/Analysis/Topology.lean | 1 + Mathlib/Data/FinEnum.lean | 7 ++++ Mathlib/Data/FinEnum/Option.lean | 1 + Mathlib/Data/Fintype/Basic.lean | 2 ++ Mathlib/Data/Fintype/Card.lean | 2 ++ Mathlib/Data/Fintype/EquivFin.lean | 2 ++ Mathlib/Data/Fintype/OfMap.lean | 8 +++++ Mathlib/Data/Fintype/Option.lean | 2 ++ Mathlib/Data/Fintype/Perm.lean | 1 + Mathlib/Data/Fintype/Sum.lean | 1 + Mathlib/Data/FunLike/Fintype.lean | 2 ++ Mathlib/Data/List/GetD.lean | 1 + Mathlib/Data/List/Rotate.lean | 1 + Mathlib/Data/Matrix/Invertible.lean | 4 +++ Mathlib/Data/QPF/Multivariate/Basic.lean | 1 + .../QPF/Multivariate/Constructions/Quot.lean | 3 ++ Mathlib/Data/QPF/Univariate/Basic.lean | 2 ++ Mathlib/Data/Quot.lean | 1 + Mathlib/Data/Set/Countable.lean | 1 + Mathlib/Data/Set/Finite/Basic.lean | 6 ++++ Mathlib/Data/Set/Finite/Lattice.lean | 1 + Mathlib/Data/Set/Finite/Monad.lean | 1 + Mathlib/Data/Setoid/Basic.lean | 4 +++ Mathlib/Data/Setoid/Partition.lean | 2 ++ Mathlib/Data/W/Basic.lean | 2 ++ Mathlib/Deprecated/Estimator.lean | 1 + Mathlib/Dynamics/Flow.lean | 1 + Mathlib/FieldTheory/Differential/Basic.lean | 1 + Mathlib/FieldTheory/Finite/Basic.lean | 1 + Mathlib/FieldTheory/Finiteness.lean | 1 + Mathlib/FieldTheory/Galois/IsGaloisGroup.lean | 1 + .../IntermediateField/Adjoin/Basic.lean | 1 + Mathlib/FieldTheory/KrullTopology.lean | 1 + Mathlib/FieldTheory/Minpoly/Field.lean | 1 + Mathlib/FieldTheory/Minpoly/IsConjRoot.lean | 1 + .../FieldTheory/PolynomialGaloisGroup.lean | 1 + Mathlib/FieldTheory/RatFunc/Basic.lean | 2 ++ Mathlib/Geometry/Convex/Cone/Basic.lean | 1 + Mathlib/Geometry/Diffeology/Basic.lean | 4 +++ Mathlib/Geometry/Manifold/ChartedSpace.lean | 5 +++ Mathlib/Geometry/Manifold/HasGroupoid.lean | 2 ++ .../Geometry/Manifold/PartitionOfUnity.lean | 1 + .../Manifold/VectorBundle/LocalFrame.lean | 1 + Mathlib/GroupTheory/Coset/Defs.lean | 7 ++-- Mathlib/GroupTheory/Divisible.lean | 8 +++-- Mathlib/GroupTheory/DoubleCoset.lean | 1 + Mathlib/GroupTheory/FixedPointFree.lean | 1 + Mathlib/GroupTheory/Index.lean | 2 +- Mathlib/GroupTheory/Nilpotent.lean | 1 + .../GroupTheory/OreLocalization/Basic.lean | 2 +- Mathlib/GroupTheory/PGroup.lean | 1 + Mathlib/GroupTheory/Perm/Centralizer.lean | 1 + Mathlib/GroupTheory/Perm/Cycle/Basic.lean | 1 + Mathlib/GroupTheory/Perm/Sign.lean | 1 + Mathlib/GroupTheory/QuotientGroup/Finite.lean | 4 +-- .../GroupTheory/SpecificGroups/Cyclic.lean | 4 +-- Mathlib/GroupTheory/Subgroup/Center.lean | 1 + Mathlib/GroupTheory/Sylow.lean | 1 + Mathlib/LinearAlgebra/Basis/Defs.lean | 1 + .../CliffordAlgebra/Inversion.lean | 2 ++ Mathlib/LinearAlgebra/Dimension/Finite.lean | 2 ++ .../Dimension/StrongRankCondition.lean | 1 + .../FiniteDimensional/Basic.lean | 2 ++ .../LinearAlgebra/FiniteDimensional/Defs.lean | 1 + Mathlib/LinearAlgebra/Matrix/Basis.lean | 1 + Mathlib/LinearAlgebra/Matrix/Block.lean | 1 + .../Matrix/GeneralLinearGroup/Projective.lean | 1 + .../Matrix/Irreducible/Defs.lean | 1 + .../Matrix/NonsingularInverse.lean | 9 ++++++ .../LinearAlgebra/Matrix/SchurComplement.lean | 6 ++++ .../LinearAlgebra/Matrix/SemiringInverse.lean | 4 +-- .../LinearAlgebra/Projectivization/Basic.lean | 1 + Mathlib/LinearAlgebra/RootSystem/Defs.lean | 2 +- .../LinearAlgebra/RootSystem/Finite/G2.lean | 4 ++- Mathlib/Logic/Basic.lean | 2 ++ Mathlib/Logic/Denumerable.lean | 4 +++ Mathlib/Logic/Encodable/Basic.lean | 8 ++++- Mathlib/Logic/Equiv/List.lean | 2 ++ Mathlib/Logic/Relation.lean | 1 + Mathlib/Logic/Unique.lean | 4 +++ .../Constructions/BorelSpace/Basic.lean | 1 + .../Constructions/Cylinders.lean | 1 + .../Constructions/Polish/Basic.lean | 1 + Mathlib/MeasureTheory/Function/AEEqFun.lean | 1 + .../MeasureTheory/MeasurableSpace/Basic.lean | 2 ++ .../MeasurableSpace/Constructions.lean | 1 + .../MeasureTheory/MeasurableSpace/Defs.lean | 3 ++ .../MeasurableSpace/EventuallyMeasurable.lean | 1 + .../MeasurableSpace/Invariants.lean | 1 + .../OuterMeasure/Caratheodory.lean | 1 + Mathlib/MeasureTheory/PiSystem.lean | 1 + Mathlib/ModelTheory/Basic.lean | 3 +- Mathlib/ModelTheory/Equivalence.lean | 1 + Mathlib/ModelTheory/Graph.lean | 1 + Mathlib/ModelTheory/LanguageMap.lean | 3 ++ Mathlib/ModelTheory/Order.lean | 5 +++ Mathlib/NumberTheory/ClassNumber/Finite.lean | 2 ++ Mathlib/NumberTheory/FunctionField.lean | 1 + .../ModularForms/SlashActions.lean | 1 + Mathlib/Order/Antisymmetrization.lean | 2 +- Mathlib/Order/Atoms.lean | 7 ++++ Mathlib/Order/BooleanAlgebra/Defs.lean | 1 + Mathlib/Order/BooleanGenerators.lean | 2 ++ Mathlib/Order/Comparable.lean | 3 +- Mathlib/Order/Compare.lean | 1 + Mathlib/Order/CompleteBooleanAlgebra.lean | 2 ++ .../ConditionallyCompleteLattice/Defs.lean | 4 +++ Mathlib/Order/Defs/PartialOrder.lean | 1 + Mathlib/Order/DirectedInverseSystem.lean | 1 + Mathlib/Order/Extension/Well.lean | 1 + Mathlib/Order/Filter/Germ/Basic.lean | 2 ++ Mathlib/Order/Filter/Pointwise.lean | 32 +++++++++---------- Mathlib/Order/GaloisConnection/Defs.lean | 2 ++ Mathlib/Order/Interval/Finset/Basic.lean | 1 + Mathlib/Order/Interval/Finset/Defs.lean | 8 +++++ Mathlib/Order/Lattice.lean | 3 ++ Mathlib/Order/OmegaCompletePartialOrder.lean | 1 + Mathlib/Order/OrderDual.lean | 1 + Mathlib/Order/RelClasses.lean | 3 +- Mathlib/Order/SuccPred/Basic.lean | 7 ++-- .../Order/SuccPred/CompleteLinearOrder.lean | 1 + .../Order/SuccPred/LinearLocallyFinite.lean | 2 ++ Mathlib/Order/SupClosed.lean | 2 ++ Mathlib/Order/Types/Defs.lean | 1 + Mathlib/Order/WellFounded.lean | 2 +- Mathlib/Probability/Process/Predictable.lean | 1 + Mathlib/Probability/Process/Stopping.lean | 1 + Mathlib/RingTheory/AlgebraTower.lean | 2 ++ Mathlib/RingTheory/Bialgebra/Basic.lean | 1 + .../DedekindDomain/AdicValuation.lean | 1 + .../DiscreteValuationRing/Basic.lean | 1 + Mathlib/RingTheory/EuclideanDomain.lean | 1 + Mathlib/RingTheory/GradedAlgebra/Basic.lean | 1 + Mathlib/RingTheory/IdealFilter/Topology.lean | 3 +- Mathlib/RingTheory/IntegralDomain.lean | 3 ++ Mathlib/RingTheory/Invariant/Basic.lean | 1 + Mathlib/RingTheory/LittleWedderburn.lean | 1 + Mathlib/RingTheory/Localization/Basic.lean | 2 ++ Mathlib/RingTheory/Localization/Defs.lean | 2 ++ .../MvPolynomial/WeightedHomogeneous.lean | 2 ++ .../RingTheory/NonUnitalSubring/Basic.lean | 1 + .../RingTheory/OreLocalization/OreSet.lean | 2 ++ .../Polynomial/UniqueFactorization.lean | 1 + Mathlib/RingTheory/PowerBasis.lean | 1 + Mathlib/RingTheory/PrincipalIdealDomain.lean | 1 + .../UniqueFactorizationDomain/Finite.lean | 1 + .../UniqueFactorizationDomain/GCDMonoid.lean | 1 + .../NormalizedFactors.lean | 1 + Mathlib/RingTheory/Valuation/Basic.lean | 2 ++ Mathlib/RingTheory/Valuation/RankOne.lean | 1 + .../Valuation/ValuativeRel/Basic.lean | 2 ++ .../Valuation/ValuativeRel/Trivial.lean | 1 + Mathlib/SetTheory/Ordinal/Basic.lean | 2 ++ Mathlib/SetTheory/ZFC/Basic.lean | 1 + Mathlib/Tactic/Inhabit.lean | 2 ++ Mathlib/Tactic/Linarith/Preprocessing.lean | 2 +- Mathlib/Tactic/NormNum/Basic.lean | 2 ++ Mathlib/Tactic/NormNum/Result.lean | 2 ++ Mathlib/Topology/Algebra/FilterBasis.lean | 3 ++ .../Topology/Algebra/IsUniformGroup/Defs.lean | 4 +-- .../Algebra/Nonarchimedean/AdicTopology.lean | 3 ++ .../Algebra/Nonarchimedean/Bases.lean | 4 +++ .../Topology/Algebra/UniformFilterBasis.lean | 1 + .../Algebra/Valued/ValuationTopology.lean | 1 + Mathlib/Topology/Basic.lean | 1 + Mathlib/Topology/Bornology/Basic.lean | 4 +-- .../Topology/CWComplex/Classical/Basic.lean | 2 +- .../Topology/CWComplex/Classical/Finite.lean | 8 ++--- .../Category/CompHausLike/Cartesian.lean | 1 + Mathlib/Topology/Compactness/Compact.lean | 1 + .../Compactness/CompactlyGeneratedSpace.lean | 1 + .../Compactness/DeltaGeneratedSpace.lean | 1 + .../Topology/Compactness/LocallyFinite.lean | 1 + .../Topology/Compactness/SigmaCompact.lean | 1 + Mathlib/Topology/Connected/Clopen.lean | 1 + Mathlib/Topology/Connected/PathConnected.lean | 1 + Mathlib/Topology/Convenient/GeneratedBy.lean | 1 + Mathlib/Topology/Defs/Filter.lean | 1 + Mathlib/Topology/Defs/Induced.lean | 2 ++ Mathlib/Topology/EMetricSpace/Defs.lean | 1 + Mathlib/Topology/FiberBundle/Basic.lean | 2 ++ Mathlib/Topology/Homotopy/HSpaces.lean | 2 +- .../Topology/Instances/ENNReal/Lemmas.lean | 1 + Mathlib/Topology/MetricSpace/Defs.lean | 1 + Mathlib/Topology/MetricSpace/Gluing.lean | 2 ++ Mathlib/Topology/MetricSpace/PiNat.lean | 3 ++ .../MetricSpace/Pseudo/Constructions.lean | 2 ++ Mathlib/Topology/MetricSpace/Pseudo/Defs.lean | 2 ++ .../Metrizable/CompletelyMetrizable.lean | 4 +++ Mathlib/Topology/Metrizable/Uniformity.lean | 1 + Mathlib/Topology/Order.lean | 4 +++ Mathlib/Topology/Order/Basic.lean | 1 + Mathlib/Topology/Order/Bornology.lean | 1 + Mathlib/Topology/Order/LawsonTopology.lean | 1 + .../Topology/Order/LowerUpperTopology.lean | 2 ++ Mathlib/Topology/Order/ScottTopology.lean | 2 ++ .../Topology/Order/UpperLowerSetTopology.lean | 2 ++ Mathlib/Topology/Separation/Basic.lean | 1 + Mathlib/Topology/Separation/Hausdorff.lean | 1 + Mathlib/Topology/Sets/Closeds.lean | 1 + .../Spectral/ConstructibleTopology.lean | 1 + .../Topology/UniformSpace/AbsoluteValue.lean | 1 + Mathlib/Topology/UniformSpace/Defs.lean | 1 + .../Topology/UniformSpace/OfCompactT2.lean | 1 + Mathlib/Topology/UniformSpace/OfFun.lean | 2 ++ .../UniformSpace/UniformEmbedding.lean | 1 + Mathlib/Topology/VectorBundle/Basic.lean | 2 ++ lake-manifest.json | 6 ++-- lakefile.lean | 2 +- 377 files changed, 821 insertions(+), 131 deletions(-) diff --git a/Mathlib/Algebra/Algebra/ZMod.lean b/Mathlib/Algebra/Algebra/ZMod.lean index 791cfac4e3eb5b..146943a3d88cd4 100644 --- a/Mathlib/Algebra/Algebra/ZMod.lean +++ b/Mathlib/Algebra/Algebra/ZMod.lean @@ -49,6 +49,7 @@ abbrev algebra (p : ℕ) [CharP R p] : Algebra (ZMod p) R := set_option backward.isDefEq.respectTransparency false in /-- Any ring with a `ZMod p`-module structure can be upgraded to a `ZMod p`-algebra. Not an +@[implicit_reducible] instance because this is usually not the default way, and this will cause typeclass search loop. -/ def algebraOfModule (n : ℕ) (R : Type*) [Ring R] [Module (ZMod n) R] : Algebra (ZMod n) R := Algebra.ofModule' (proof · · |>.1) (proof · · |>.2) where diff --git a/Mathlib/Algebra/BrauerGroup/Defs.lean b/Mathlib/Algebra/BrauerGroup/Defs.lean index 82094522315e53..8b82a886f653dd 100644 --- a/Mathlib/Algebra/BrauerGroup/Defs.lean +++ b/Mathlib/Algebra/BrauerGroup/Defs.lean @@ -89,6 +89,7 @@ end IsBrauerEquivalent variable (K) /-- `CSA` equipped with Brauer Equivalence is indeed a setoid. -/ +@[implicit_reducible] def Brauer.CSA_Setoid : Setoid (CSA K) where r := IsBrauerEquivalent iseqv := IsBrauerEquivalent.is_eqv diff --git a/Mathlib/Algebra/Category/FGModuleCat/Colimits.lean b/Mathlib/Algebra/Category/FGModuleCat/Colimits.lean index e5fb89d6278bd6..a95196565f1e53 100644 --- a/Mathlib/Algebra/Category/FGModuleCat/Colimits.lean +++ b/Mathlib/Algebra/Category/FGModuleCat/Colimits.lean @@ -48,6 +48,7 @@ have (j : J) : Module.Finite k ((F ⋙ forget₂ (FGModuleCat k) (ModuleCat.{v} ((ModuleCat.epi_iff_surjective _).1 inferInstance) /-- The forgetful functor from `FGModuleCat k` to `ModuleCat k` creates all finite colimits. -/ +@[implicit_reducible] def forget₂CreatesColimit (F : J ⥤ FGModuleCat k) : CreatesColimit F (forget₂ (FGModuleCat k) (ModuleCat.{v} k)) := createsColimitOfFullyFaithfulOfIso diff --git a/Mathlib/Algebra/Category/FGModuleCat/Limits.lean b/Mathlib/Algebra/Category/FGModuleCat/Limits.lean index ece16af8316205..c465021e6573e1 100644 --- a/Mathlib/Algebra/Category/FGModuleCat/Limits.lean +++ b/Mathlib/Algebra/Category/FGModuleCat/Limits.lean @@ -55,6 +55,7 @@ instance (F : J ⥤ FGModuleCat k) : ((ModuleCat.mono_iff_injective _).1 inferInstance) /-- The forgetful functor from `FGModuleCat k` to `ModuleCat k` creates all finite limits. -/ +@[implicit_reducible] def forget₂CreatesLimit (F : J ⥤ FGModuleCat k) : CreatesLimit F (forget₂ (FGModuleCat k) (ModuleCat.{v} k)) := createsLimitOfFullyFaithfulOfIso diff --git a/Mathlib/Algebra/Category/Grp/Abelian.lean b/Mathlib/Algebra/Category/Grp/Abelian.lean index f7f4596c8f3512..7c562be12b48e8 100644 --- a/Mathlib/Algebra/Category/Grp/Abelian.lean +++ b/Mathlib/Algebra/Category/Grp/Abelian.lean @@ -29,11 +29,13 @@ namespace AddCommGrpCat variable {X Y Z : AddCommGrpCat.{u}} (f : X ⟶ Y) (g : Y ⟶ Z) /-- In the category of abelian groups, every monomorphism is normal. -/ +@[implicit_reducible] def normalMono (_ : Mono f) : NormalMono f := equivalenceReflectsNormalMono (forget₂ (ModuleCat.{u} ℤ) AddCommGrpCat.{u}).inv <| ModuleCat.normalMono _ inferInstance /-- In the category of abelian groups, every epimorphism is normal. -/ +@[implicit_reducible] def normalEpi (_ : Epi f) : NormalEpi f := equivalenceReflectsNormalEpi (forget₂ (ModuleCat.{u} ℤ) AddCommGrpCat.{u}).inv <| ModuleCat.normalEpi _ inferInstance diff --git a/Mathlib/Algebra/Category/ModuleCat/Abelian.lean b/Mathlib/Algebra/Category/ModuleCat/Abelian.lean index 783a23e67141ce..9485de97692a42 100644 --- a/Mathlib/Algebra/Category/ModuleCat/Abelian.lean +++ b/Mathlib/Algebra/Category/ModuleCat/Abelian.lean @@ -32,6 +32,7 @@ namespace ModuleCat variable {R : Type u} [Ring R] {M N : ModuleCat.{v} R} (f : M ⟶ N) /-- In the category of modules, every monomorphism is normal. -/ +@[implicit_reducible] def normalMono (hf : Mono f) : NormalMono f where Z := of R (N ⧸ LinearMap.range f.hom) g := ofHom (LinearMap.range f.hom).mkQ @@ -53,6 +54,7 @@ def normalMono (hf : Mono f) : NormalMono f where LinearEquiv.ofEq _ _ (Submodule.ker_mkQ _).symm))) <| by ext; rfl /-- In the category of modules, every epimorphism is normal. -/ +@[implicit_reducible] def normalEpi (hf : Epi f) : NormalEpi f where W := of R (LinearMap.ker f.hom) g := ofHom (LinearMap.ker f.hom).subtype diff --git a/Mathlib/Algebra/Category/ModuleCat/Descent.lean b/Mathlib/Algebra/Category/ModuleCat/Descent.lean index 43d8e542761853..b63d64b4b6aeef 100644 --- a/Mathlib/Algebra/Category/ModuleCat/Descent.lean +++ b/Mathlib/Algebra/Category/ModuleCat/Descent.lean @@ -55,6 +55,7 @@ lemma ModuleCat.reflectsIsomorphisms_extendScalars_of_faithfullyFlat rwa [Module.FaithfullyFlat.lTensor_bijective_iff_bijective] at h /-- Extension of scalars by a faithfully flat ring map is comonadic. -/ +@[implicit_reducible] def comonadicExtendScalars (hf : f.FaithfullyFlat) : ComonadicLeftAdjoint (extendScalars f) := by have := preservesFiniteLimits_extendScalars_of_flat hf.flat diff --git a/Mathlib/Algebra/Category/ModuleCat/EpiMono.lean b/Mathlib/Algebra/Category/ModuleCat/EpiMono.lean index 8d4a56263b4c75..0c343d5024e7b0 100644 --- a/Mathlib/Algebra/Category/ModuleCat/EpiMono.lean +++ b/Mathlib/Algebra/Category/ModuleCat/EpiMono.lean @@ -51,6 +51,7 @@ theorem epi_iff_surjective : Epi f ↔ Function.Surjective f := by rw [epi_iff_range_eq_top, LinearMap.range_eq_top] /-- If the zero morphism is an epi then the codomain is trivial. -/ +@[implicit_reducible] def uniqueOfEpiZero (X) [h : Epi (0 : X ⟶ of R M)] : Unique M := uniqueOfSurjectiveZero X ((ModuleCat.epi_iff_surjective _).mp h) diff --git a/Mathlib/Algebra/Category/ModuleCat/Presheaf/Sheafify.lean b/Mathlib/Algebra/Category/ModuleCat/Presheaf/Sheafify.lean index 3613a1c32f71ef..b8ef83d1568cc6 100644 --- a/Mathlib/Algebra/Category/ModuleCat/Presheaf/Sheafify.lean +++ b/Mathlib/Algebra/Category/ModuleCat/Presheaf/Sheafify.lean @@ -288,6 +288,7 @@ variable (X) /-- The module structure on the sections of the sheafification of the underlying presheaf of abelian groups of a presheaf of modules. -/ +@[implicit_reducible] noncomputable def module : Module (R.val.obj X) (A.val.obj X) where smul r m := smul α φ r m one_smul := Sheafify.one_smul α φ diff --git a/Mathlib/Algebra/CharP/Invertible.lean b/Mathlib/Algebra/CharP/Invertible.lean index e0bfd66445fbd1..1ffa05c0ca238b 100644 --- a/Mathlib/Algebra/CharP/Invertible.lean +++ b/Mathlib/Algebra/CharP/Invertible.lean @@ -56,6 +56,7 @@ theorem CharP.natCast_gcdA_mul_intCast_eq_gcd (n : ℕ) : /-- In a ring of characteristic `p`, `(n : R)` is invertible when `n` is coprime with `p`, with inverse `n.gcdA p`. -/ +@[implicit_reducible] def invertibleOfCoprime {n : ℕ} (h : n.Coprime p) : Invertible (n : R) where invOf := n.gcdA p @@ -92,11 +93,13 @@ variable [Semifield K] /-- A natural number `t` is invertible in a semifield `K` if the characteristic of `K` does not divide `t`. -/ +@[implicit_reducible] def invertibleOfRingCharNotDvd {t : ℕ} (not_dvd : ¬ringChar K ∣ t) : Invertible (t : K) := invertibleOfNonzero fun h => not_dvd ((ringChar.spec K t).mp h) /-- A natural number `t` is invertible in a semifield `K` of characteristic `p` if `p` does not divide `t`. -/ +@[implicit_reducible] def invertibleOfCharPNotDvd {p : ℕ} [CharP K p] {t : ℕ} (not_dvd : ¬p ∣ t) : Invertible (t : K) := invertibleOfNonzero fun h => not_dvd ((CharP.cast_eq_zero_iff K p t).mp h) diff --git a/Mathlib/Algebra/CharP/MixedCharZero.lean b/Mathlib/Algebra/CharP/MixedCharZero.lean index f654a7b6874477..d2998f61d06100 100644 --- a/Mathlib/Algebra/CharP/MixedCharZero.lean +++ b/Mathlib/Algebra/CharP/MixedCharZero.lean @@ -209,6 +209,7 @@ theorem pnatCast_eq_natCast [Fact (∀ I : Ideal R, I ≠ ⊤ → CharZero (R simp only [IsUnit.unit_spec] /-- Equal characteristic implies `ℚ`-algebra. -/ +@[implicit_reducible] noncomputable def algebraRat (h : ∀ I : Ideal R, I ≠ ⊤ → CharZero (R ⧸ I)) : Algebra ℚ R := haveI : Fact (∀ I : Ideal R, I ≠ ⊤ → CharZero (R ⧸ I)) := ⟨h⟩ diff --git a/Mathlib/Algebra/DirectSum/Decomposition.lean b/Mathlib/Algebra/DirectSum/Decomposition.lean index d2cfa23b382b6e..55ce3b9e28c1cf 100644 --- a/Mathlib/Algebra/DirectSum/Decomposition.lean +++ b/Mathlib/Algebra/DirectSum/Decomposition.lean @@ -76,6 +76,7 @@ abbrev Decomposition.ofAddHom (decompose : M →+ ⨁ i, ℳ i) right_inv := DFunLike.congr_fun h_right_inv /-- Noncomputably conjure a decomposition instance from a `DirectSum.IsInternal` proof. -/ +@[implicit_reducible] noncomputable def IsInternal.chooseDecomposition (h : IsInternal ℳ) : DirectSum.Decomposition ℳ where decompose' := (Equiv.ofBijective _ h).symm diff --git a/Mathlib/Algebra/Expr.lean b/Mathlib/Algebra/Expr.lean index 77049b4e66253e..8a68c40ae87c11 100644 --- a/Mathlib/Algebra/Expr.lean +++ b/Mathlib/Algebra/Expr.lean @@ -18,17 +18,21 @@ This file provides instances on `x y : Q($α)` such that `x + y = q($x + $y)`. open Qq /-- Produce a `One` instance for `Q($α)` such that `1 : Q($α)` is `q(1 : $α)`. -/ +@[implicit_reducible] def Expr.instOne {u : Lean.Level} (α : Q(Type u)) (_ : Q(One $α)) : One Q($α) where one := q(1 : $α) /-- Produce a `Zero` instance for `Q($α)` such that `0 : Q($α)` is `q(0 : $α)`. -/ +@[implicit_reducible] def Expr.instZero {u : Lean.Level} (α : Q(Type u)) (_ : Q(Zero $α)) : Zero Q($α) where zero := q(0 : $α) /-- Produce a `Mul` instance for `Q($α)` such that `x * y : Q($α)` is `q($x * $y)`. -/ +@[implicit_reducible] def Expr.instMul {u : Lean.Level} (α : Q(Type u)) (_ : Q(Mul $α)) : Mul Q($α) where mul x y := q($x * $y) /-- Produce an `Add` instance for `Q($α)` such that `x + y : Q($α)` is `q($x + $y)`. -/ +@[implicit_reducible] def Expr.instAdd {u : Lean.Level} (α : Q(Type u)) (_ : Q(Add $α)) : Add Q($α) where add x y := q($x + $y) diff --git a/Mathlib/Algebra/Field/IsField.lean b/Mathlib/Algebra/Field/IsField.lean index 4321c2c6e8b4df..95650bb70874d0 100644 --- a/Mathlib/Algebra/Field/IsField.lean +++ b/Mathlib/Algebra/Field/IsField.lean @@ -71,6 +71,7 @@ theorem not_isField_of_subsingleton (R : Type u) [Semiring R] [Subsingleton R] : open Classical in /-- Transferring from `IsField` to `Semifield`. -/ +@[implicit_reducible] noncomputable def IsField.toSemifield {R : Type u} [Semiring R] (h : IsField R) : Semifield R where __ := ‹Semiring R› __ := h @@ -81,6 +82,7 @@ noncomputable def IsField.toSemifield {R : Type u} [Semiring R] (h : IsField R) nnqsmul_def _ _ := rfl /-- Transferring from `IsField` to `Field`. -/ +@[implicit_reducible] noncomputable def IsField.toField {R : Type u} [Ring R] (h : IsField R) : Field R where __ := (‹Ring R› :) -- this also works without the `( :)`, but it's slow __ := h.toSemifield diff --git a/Mathlib/Algebra/GCDMonoid/Basic.lean b/Mathlib/Algebra/GCDMonoid/Basic.lean index 1abf684c30f33a..ff6f0fde6b0f6d 100644 --- a/Mathlib/Algebra/GCDMonoid/Basic.lean +++ b/Mathlib/Algebra/GCDMonoid/Basic.lean @@ -967,6 +967,7 @@ private theorem map_mk_unit_aux {f : Associates α →* α} variable [IsCancelMulZero α] /-- Define `NormalizationMonoid` on a structure from a `MonoidHom` inverse to `Associates.mk`. -/ +@[implicit_reducible] def normalizationMonoidOfMonoidHomRightInverse [DecidableEq α] (f : Associates α →* α) (hinv : Function.RightInverse f Associates.mk) : NormalizationMonoid α where @@ -992,6 +993,7 @@ def normalizationMonoidOfMonoidHomRightInverse [DecidableEq α] (f : Associates Associates.mk_one, map_one] /-- Define `GCDMonoid` on a structure just from the `gcd` and its properties. -/ +@[implicit_reducible] noncomputable def gcdMonoidOfGCD [DecidableEq α] (gcd : α → α → α) (gcd_dvd_left : ∀ a b, gcd a b ∣ a) (gcd_dvd_right : ∀ a b, gcd a b ∣ b) (dvd_gcd : ∀ {a b c}, a ∣ c → a ∣ b → a ∣ gcd c b) : GCDMonoid α := @@ -1019,6 +1021,7 @@ noncomputable def gcdMonoidOfGCD [DecidableEq α] (gcd : α → α → α) set_option backward.isDefEq.respectTransparency false in /-- Define `NormalizedGCDMonoid` on a structure just from the `gcd` and its properties. -/ +@[implicit_reducible] noncomputable def normalizedGCDMonoidOfGCD [NormalizationMonoid α] [DecidableEq α] (gcd : α → α → α) (gcd_dvd_left : ∀ a b, gcd a b ∣ a) (gcd_dvd_right : ∀ a b, gcd a b ∣ b) (dvd_gcd : ∀ {a b c}, a ∣ c → a ∣ b → a ∣ gcd c b) @@ -1073,6 +1076,7 @@ noncomputable def normalizedGCDMonoidOfGCD [NormalizationMonoid α] [DecidableEq rw [h, mul_zero, normalize_zero] } /-- Define `GCDMonoid` on a structure just from the `lcm` and its properties. -/ +@[implicit_reducible] noncomputable def gcdMonoidOfLCM [DecidableEq α] (lcm : α → α → α) (dvd_lcm_left : ∀ a b, a ∣ lcm a b) (dvd_lcm_right : ∀ a b, b ∣ lcm a b) (lcm_dvd : ∀ {a b c}, c ∣ a → b ∣ a → lcm c b ∣ a) : GCDMonoid α := @@ -1138,6 +1142,7 @@ noncomputable def gcdMonoidOfLCM [DecidableEq α] (lcm : α → α → α) set_option backward.isDefEq.respectTransparency false in /-- Define `NormalizedGCDMonoid` on a structure just from the `lcm` and its properties. -/ +@[implicit_reducible] noncomputable def normalizedGCDMonoidOfLCM [NormalizationMonoid α] [DecidableEq α] (lcm : α → α → α) (dvd_lcm_left : ∀ a b, a ∣ lcm a b) (dvd_lcm_right : ∀ a b, b ∣ lcm a b) (lcm_dvd : ∀ {a b c}, c ∣ a → b ∣ a → lcm c b ∣ a) @@ -1229,6 +1234,7 @@ noncomputable def normalizedGCDMonoidOfLCM [NormalizationMonoid α] [DecidableEq apply ac } /-- Define a `GCDMonoid` structure on a monoid just from the existence of a `gcd`. -/ +@[implicit_reducible] noncomputable def gcdMonoidOfExistsGCD [DecidableEq α] (h : ∀ a b : α, ∃ c : α, ∀ d : α, d ∣ a ∧ d ∣ b ↔ d ∣ c) : GCDMonoid α := gcdMonoidOfGCD (fun a b => Classical.choose (h a b)) @@ -1237,6 +1243,7 @@ noncomputable def gcdMonoidOfExistsGCD [DecidableEq α] fun {a b c} ac ab => (Classical.choose_spec (h c b) a).1 ⟨ac, ab⟩ /-- Define a `NormalizedGCDMonoid` structure on a monoid just from the existence of a `gcd`. -/ +@[implicit_reducible] noncomputable def normalizedGCDMonoidOfExistsGCD [NormalizationMonoid α] [DecidableEq α] (h : ∀ a b : α, ∃ c : α, ∀ d : α, d ∣ a ∧ d ∣ b ↔ d ∣ c) : NormalizedGCDMonoid α := normalizedGCDMonoidOfGCD (fun a b => normalize (Classical.choose (h a b))) @@ -1248,6 +1255,7 @@ noncomputable def normalizedGCDMonoidOfExistsGCD [NormalizationMonoid α] [Decid fun _ _ => normalize_idem _ /-- Define a `GCDMonoid` structure on a monoid just from the existence of an `lcm`. -/ +@[implicit_reducible] noncomputable def gcdMonoidOfExistsLCM [DecidableEq α] (h : ∀ a b : α, ∃ c : α, ∀ d : α, a ∣ d ∧ b ∣ d ↔ c ∣ d) : GCDMonoid α := gcdMonoidOfLCM (fun a b => Classical.choose (h a b)) @@ -1256,6 +1264,7 @@ noncomputable def gcdMonoidOfExistsLCM [DecidableEq α] fun {a b c} ac ab => (Classical.choose_spec (h c b) a).1 ⟨ac, ab⟩ /-- Define a `NormalizedGCDMonoid` structure on a monoid just from the existence of an `lcm`. -/ +@[implicit_reducible] noncomputable def normalizedGCDMonoidOfExistsLCM [NormalizationMonoid α] [DecidableEq α] (h : ∀ a b : α, ∃ c : α, ∀ d : α, a ∣ d ∧ b ∣ d ↔ c ∣ d) : NormalizedGCDMonoid α := normalizedGCDMonoidOfLCM (fun a b => normalize (Classical.choose (h a b))) diff --git a/Mathlib/Algebra/Group/Action/Basic.lean b/Mathlib/Algebra/Group/Action/Basic.lean index 037029399e7cdb..af1f28cd06a114 100644 --- a/Mathlib/Algebra/Group/Action/Basic.lean +++ b/Mathlib/Algebra/Group/Action/Basic.lean @@ -95,7 +95,7 @@ section Arrow variable {G A B : Type*} [DivisionMonoid G] [MulAction G A] /-- If `G` acts on `A`, then it acts also on `A → B`, by `(g • F) a = F (g⁻¹ • a)`. -/ -@[to_additive (attr := instance_reducible) (attr := simps) arrowAddAction +@[to_additive (attr := implicit_reducible, simps) arrowAddAction /-- If `G` acts on `A`, then it acts also on `A → B`, by `(g +ᵥ F) a = F (g⁻¹ +ᵥ a)` -/] def arrowAction : MulAction G (A → B) where smul g F a := F (g⁻¹ • a) @@ -111,7 +111,7 @@ attribute [local instance] arrowAction variable [Monoid M] /-- When `M` is a monoid, `ArrowAction` is additionally a `MulDistribMulAction`. -/ -@[instance_reducible] +@[implicit_reducible] def arrowMulDistribMulAction : MulDistribMulAction G (A → M) where smul_one _ := rfl smul_mul _ _ _ := rfl diff --git a/Mathlib/Algebra/Group/Action/Defs.lean b/Mathlib/Algebra/Group/Action/Defs.lean index 0553285aa00823..2df4f9a3156d6e 100644 --- a/Mathlib/Algebra/Group/Action/Defs.lean +++ b/Mathlib/Algebra/Group/Action/Defs.lean @@ -57,7 +57,7 @@ attribute [to_additive Add.toVAdd /-- See also `AddMonoid.toAddAction` -/] instS -- see Note [lower instance priority] /-- See also `Monoid.toMulAction` and `MulZeroClass.toSMulWithZero`. -/ -@[deprecated instSMulOfMul (since := "2025-10-18")] +@[deprecated instSMulOfMul (since := "2025-10-18"), implicit_reducible] def Mul.toSMul (α : Type*) [Mul α] : SMul α α := ⟨(· * ·)⟩ /-- Like `Mul.toSMul`, but multiplies on the right. diff --git a/Mathlib/Algebra/Group/Action/Pointwise/Finset.lean b/Mathlib/Algebra/Group/Action/Pointwise/Finset.lean index 556ef3def089c7..552f2830287b62 100644 --- a/Mathlib/Algebra/Group/Action/Pointwise/Finset.lean +++ b/Mathlib/Algebra/Group/Action/Pointwise/Finset.lean @@ -79,7 +79,7 @@ instance isCentralScalar [SMul α β] [SMul αᵐᵒᵖ β] [IsCentralScalar α /-- A multiplicative action of a monoid `α` on a type `β` gives a multiplicative action of `Finset α` on `Finset β`. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- An additive action of an additive monoid `α` on a type `β` gives an additive action of `Finset α` on `Finset β` -/] protected def mulAction [DecidableEq α] [Monoid α] [MulAction α β] : @@ -89,7 +89,7 @@ protected def mulAction [DecidableEq α] [Monoid α] [MulAction α β] : /-- A multiplicative action of a monoid on a type `β` gives a multiplicative action on `Finset β`. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- An additive action of an additive monoid on a type `β` gives an additive action on `Finset β`. -/] protected def mulActionFinset [Monoid α] [MulAction α β] : MulAction α (Finset β) := diff --git a/Mathlib/Algebra/Group/Action/Pointwise/Set/Basic.lean b/Mathlib/Algebra/Group/Action/Pointwise/Set/Basic.lean index e823921fb96f94..68432a615db4ae 100644 --- a/Mathlib/Algebra/Group/Action/Pointwise/Set/Basic.lean +++ b/Mathlib/Algebra/Group/Action/Pointwise/Set/Basic.lean @@ -168,7 +168,7 @@ instance isCentralScalar [SMul α β] [SMul αᵐᵒᵖ β] [IsCentralScalar α /-- A multiplicative action of a monoid `α` on a type `β` gives a multiplicative action of `Set α` on `Set β`. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- An additive action of an additive monoid `α` on a type `β` gives an additive action of `Set α` on `Set β` -/] protected noncomputable def mulAction [Monoid α] [MulAction α β] : MulAction (Set α) (Set β) where @@ -176,7 +176,7 @@ protected noncomputable def mulAction [Monoid α] [MulAction α β] : MulAction one_smul s := image2_singleton_left.trans <| by simp_rw [one_smul, image_id'] /-- A multiplicative action of a monoid on a type `β` gives a multiplicative action on `Set β`. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- An additive action of an additive monoid on a type `β` gives an additive action on `Set β`. -/] protected def mulActionSet [Monoid α] [MulAction α β] : MulAction α (Set β) where mul_smul _ _ _ := by simp only [← image_smul, image_image, ← mul_smul] diff --git a/Mathlib/Algebra/Group/Hom/Basic.lean b/Mathlib/Algebra/Group/Hom/Basic.lean index a98bc727a9deeb..94b3d51bf17eb8 100644 --- a/Mathlib/Algebra/Group/Hom/Basic.lean +++ b/Mathlib/Algebra/Group/Hom/Basic.lean @@ -302,11 +302,13 @@ lemma comp_div (f : G →* H) (g h : M →* G) : f.comp (g / h) = f.comp g / f.c end InvDiv /-- If `H` is commutative and `G →* H` is injective, then `G` is commutative. -/ +@[implicit_reducible] def commGroupOfInjective [Group G] [CommGroup H] (f : G →* H) (hf : Function.Injective f) : CommGroup G := ⟨by simp_rw [← hf.eq_iff, map_mul, mul_comm, implies_true]⟩ /-- If `G` is commutative and `G →* H` is surjective, then `H` is commutative. -/ +@[implicit_reducible] def commGroupOfSurjective [CommGroup G] [Group H] (f : G →* H) (hf : Function.Surjective f) : CommGroup H := ⟨by simp_rw [hf.forall₂, ← map_mul, mul_comm, implies_true]⟩ diff --git a/Mathlib/Algebra/Group/Invertible/Basic.lean b/Mathlib/Algebra/Group/Invertible/Basic.lean index 6319d5c461e87f..349047163caaee 100644 --- a/Mathlib/Algebra/Group/Invertible/Basic.lean +++ b/Mathlib/Algebra/Group/Invertible/Basic.lean @@ -51,6 +51,7 @@ theorem IsUnit.nonempty_invertible [Monoid α] {a : α} (h : IsUnit a) : Nonempt /-- Convert `IsUnit` to `Invertible` using `Classical.choice`. Prefer `casesI h.nonempty_invertible` over `letI := h.invertible` if you want to avoid choice. -/ +@[implicit_reducible] noncomputable def IsUnit.invertible [Monoid α] {a : α} (h : IsUnit a) : Invertible a := Classical.choice h.nonempty_invertible @@ -122,6 +123,7 @@ lemma invOf_pow (m : α) [Invertible m] (n : ℕ) [Invertible (m ^ n)] : ⅟(m ^ @invertible_unique _ _ _ _ _ (invertiblePow m n) rfl /-- If `x ^ n = 1` then `x` has an inverse, `x^(n - 1)`. -/ +@[implicit_reducible] def invertibleOfPowEqOne (x : α) (n : ℕ) (hx : x ^ n = 1) (hn : n ≠ 0) : Invertible x := (Units.ofPowEqOne x n hx hn).invertible @@ -129,6 +131,7 @@ end Monoid /-- Monoid homs preserve invertibility. -/ +@[implicit_reducible] def Invertible.map {R : Type*} {S : Type*} {F : Type*} [MulOneClass R] [MulOneClass S] [FunLike F R S] [MonoidHomClass F R S] (f : F) (r : R) [Invertible r] : Invertible (f r) where @@ -149,7 +152,7 @@ theorem map_invOf {R : Type*} {S : Type*} {F : Type*} [MulOneClass R] [Monoid S] then `r : R` is invertible if `f r` is. The inverse is computed as `g (⅟(f r))` -/ -@[simps! -isSimp] +@[simps! -isSimp, implicit_reducible] def Invertible.ofLeftInverse {R : Type*} {S : Type*} {G : Type*} [MulOneClass R] [MulOneClass S] [FunLike G S R] [MonoidHomClass G S R] (f : R → S) (g : G) (r : R) (h : Function.LeftInverse g f) [Invertible (f r)] : Invertible r := diff --git a/Mathlib/Algebra/Group/Invertible/Defs.lean b/Mathlib/Algebra/Group/Invertible/Defs.lean index 47ea57d572e041..a4c8c1d3da929a 100644 --- a/Mathlib/Algebra/Group/Invertible/Defs.lean +++ b/Mathlib/Algebra/Group/Invertible/Defs.lean @@ -163,6 +163,7 @@ theorem Invertible.congr [Monoid α] (a b : α) [Invertible a] [Invertible b] (h invertible_unique a b h /-- If `r` is invertible and `s = r` and `si = ⅟r`, then `s` is invertible with `⅟s = si`. -/ +@[implicit_reducible] def Invertible.copy' [MulOneClass α] {r : α} (hr : Invertible r) (s : α) (si : α) (hs : s = r) (hsi : si = ⅟r) : Invertible s where invOf := si @@ -175,6 +176,7 @@ abbrev Invertible.copy [MulOneClass α] {r : α} (hr : Invertible r) (s : α) (h hr.copy' _ _ hs rfl /-- Each element of a group is invertible. -/ +@[implicit_reducible] def invertibleOfGroup [Group α] (a : α) : Invertible a := ⟨a⁻¹, inv_mul_cancel a, mul_inv_cancel a⟩ @@ -183,6 +185,7 @@ theorem invOf_eq_group_inv [Group α] (a : α) [Invertible a] : ⅟a = a⁻¹ := invOf_eq_right_inv (mul_inv_cancel a) /-- `1` is the inverse of itself -/ +@[implicit_reducible] def invertibleOne [Monoid α] : Invertible (1 : α) := ⟨1, mul_one _, one_mul _⟩ @@ -205,6 +208,7 @@ theorem invOf_inj [Monoid α] {a b : α} [Invertible a] [Invertible b] : ⅟a = ⟨invertible_unique _ _, invertible_unique _ _⟩ /-- `⅟b * ⅟a` is the inverse of `a * b` -/ +@[implicit_reducible] def invertibleMul [Monoid α] (a b : α) [Invertible a] [Invertible b] : Invertible (a * b) := ⟨⅟b * ⅟a, by simp [← mul_assoc], by simp [← mul_assoc]⟩ @@ -244,10 +248,12 @@ theorem mul_right_eq_iff_eq_mul_invOf : a * c = b ↔ a = b * ⅟c := by variable [IsDedekindFiniteMonoid α] (a b : α) /-- An element in a Dedekind-finite monoid is invertible if it has a left inverse. -/ +@[implicit_reducible] def invertibleOfLeftInverse (h : b * a = 1) : Invertible a := ⟨b, h, mul_eq_one_symm h⟩ /-- An element in a Dedekind-finite monoid is invertible if it has a right inverse. -/ +@[implicit_reducible] def invertibleOfRightInverse (h : a * b = 1) : Invertible a := ⟨b, mul_eq_one_symm h, h⟩ diff --git a/Mathlib/Algebra/Group/Pointwise/Finset/Basic.lean b/Mathlib/Algebra/Group/Pointwise/Finset/Basic.lean index ebd7def758bfbf..c5e4c90b63f22b 100644 --- a/Mathlib/Algebra/Group/Pointwise/Finset/Basic.lean +++ b/Mathlib/Algebra/Group/Pointwise/Finset/Basic.lean @@ -66,7 +66,7 @@ section One variable [One α] {s : Finset α} {a : α} /-- The finset `1 : Finset α` is defined as `{1}` in scope `Pointwise`. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- The finset `0 : Finset α` is defined as `{0}` in scope `Pointwise`. -/] protected def one : One (Finset α) := ⟨{1}⟩ @@ -184,7 +184,7 @@ section Inv variable [DecidableEq α] [Inv α] {s t : Finset α} {a : α} /-- The pointwise inversion of finset `s⁻¹` is defined as `{x⁻¹ | x ∈ s}` in scope `Pointwise`. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- The pointwise negation of finset `-s` is defined as `{-x | x ∈ s}` in scope `Pointwise`. -/] protected def inv : Inv (Finset α) := ⟨image Inv.inv⟩ @@ -317,7 +317,7 @@ variable [DecidableEq α] [Mul α] [Mul β] [FunLike F α β] [MulHomClass F α /-- The pointwise multiplication of finsets `s * t` and `t` is defined as `{x * y | x ∈ s, y ∈ t}` in scope `Pointwise`. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- The pointwise addition of finsets `s + t` is defined as `{x + y | x ∈ s, y ∈ t}` in scope `Pointwise`. -/] protected def mul : Mul (Finset α) := @@ -536,7 +536,7 @@ variable [DecidableEq α] [Div α] {s s₁ s₂ t t₁ t₂ u : Finset α} {a b /-- The pointwise division of finsets `s / t` is defined as `{x / y | x ∈ s, y ∈ t}` in locale `Pointwise`. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- The pointwise subtraction of finsets `s - t` is defined as `{x - y | x ∈ s, y ∈ t}` in scope `Pointwise`. -/] protected def div : Div (Finset α) := @@ -725,7 +725,7 @@ protected def zpow [One α] [Mul α] [Inv α] : Pow (Finset α) ℤ := scoped[Pointwise] attribute [instance] Finset.nsmul Finset.npow Finset.zsmul Finset.zpow /-- `Finset α` is a `Semigroup` under pointwise operations if `α` is. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- `Finset α` is an `AddSemigroup` under pointwise operations if `α` is. -/] protected def semigroup [Semigroup α] : Semigroup (Finset α) := coe_injective.semigroup _ coe_mul @@ -735,7 +735,7 @@ section CommSemigroup variable [CommSemigroup α] {s t : Finset α} /-- `Finset α` is a `CommSemigroup` under pointwise operations if `α` is. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- `Finset α` is an `AddCommSemigroup` under pointwise operations if `α` is. -/] protected def commSemigroup : CommSemigroup (Finset α) := coe_injective.commSemigroup _ coe_mul @@ -755,7 +755,7 @@ section MulOneClass variable [MulOneClass α] /-- `Finset α` is a `MulOneClass` under pointwise operations if `α` is. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- `Finset α` is an `AddZeroClass` under pointwise operations if `α` is. -/] protected def mulOneClass : MulOneClass (Finset α) := coe_injective.mulOneClass _ (coe_singleton 1) coe_mul @@ -819,7 +819,7 @@ theorem coe_pow (s : Finset α) (n : ℕ) : ↑(s ^ n) = (s : Set α) ^ n := by | succ n ih => rw [npowRec, pow_succ, coe_mul, ih] /-- `Finset α` is a `Monoid` under pointwise operations if `α` is. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- `Finset α` is an `AddMonoid` under pointwise operations if `α` is. -/] protected def monoid : Monoid (Finset α) := coe_injective.monoid _ coe_one coe_mul coe_pow @@ -945,7 +945,7 @@ section CommMonoid variable [CommMonoid α] /-- `Finset α` is a `CommMonoid` under pointwise operations if `α` is. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- `Finset α` is an `AddCommMonoid` under pointwise operations if `α` is. -/] protected def commMonoid : CommMonoid (Finset α) := coe_injective.commMonoid _ coe_one coe_mul coe_pow @@ -970,7 +970,7 @@ protected theorem mul_eq_one_iff : s * t = 1 ↔ ∃ a b, s = {a} ∧ t = {b} simp_rw [← coe_inj, coe_mul, coe_one, Set.mul_eq_one_iff, coe_singleton] /-- `Finset α` is a division monoid under pointwise operations if `α` is. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- `Finset α` is a subtraction monoid under pointwise operations if `α` is. -/] protected def divisionMonoid : DivisionMonoid (Finset α) := coe_injective.divisionMonoid _ coe_one coe_mul coe_inv coe_div coe_pow coe_zpow @@ -1024,7 +1024,7 @@ lemma singleton_zpow (a : α) (n : ℤ) : ({a} : Finset α) ^ n = {a ^ n} := by end DivisionMonoid /-- `Finset α` is a commutative division monoid under pointwise operations if `α` is. -/ -@[to_additive (attr := instance_reducible) subtractionCommMonoid +@[to_additive (attr := implicit_reducible) subtractionCommMonoid /-- `Finset α` is a commutative subtraction monoid under pointwise operations if `α` is. -/] protected def divisionCommMonoid [DivisionCommMonoid α] : DivisionCommMonoid (Finset α) := diff --git a/Mathlib/Algebra/Group/Pointwise/Finset/Scalar.lean b/Mathlib/Algebra/Group/Pointwise/Finset/Scalar.lean index b76bb8274ad728..8bab40b6c0229c 100644 --- a/Mathlib/Algebra/Group/Pointwise/Finset/Scalar.lean +++ b/Mathlib/Algebra/Group/Pointwise/Finset/Scalar.lean @@ -63,7 +63,7 @@ section SMul variable [DecidableEq β] [SMul α β] {s s₁ s₂ : Finset α} {t t₁ t₂ u : Finset β} {a : α} {b : β} /-- The pointwise product of two finsets `s` and `t`: `s • t = {x • y | x ∈ s, y ∈ t}`. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- The pointwise sum of two finsets `s` and `t`: `s +ᵥ t = {x +ᵥ y | x ∈ s, y ∈ t}`. -/] protected def smul : SMul (Finset α) (Finset β) := ⟨image₂ (· • ·)⟩ @@ -153,7 +153,7 @@ section SMul variable [DecidableEq β] [SMul α β] {s s₁ s₂ t : Finset β} {a : α} {b : β} /-- The scaling of a finset `s` by a scalar `a`: `a • s = {a • x | x ∈ s}`. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- The translation of a finset `s` by a vector `a`: `a +ᵥ s = {a +ᵥ x | x ∈ s}`. -/] protected def smulFinset : SMul α (Finset β) where smul a := image <| (a • ·) diff --git a/Mathlib/Algebra/Group/Pointwise/Set/Basic.lean b/Mathlib/Algebra/Group/Pointwise/Set/Basic.lean index ff013f818beb59..df9a2585439926 100644 --- a/Mathlib/Algebra/Group/Pointwise/Set/Basic.lean +++ b/Mathlib/Algebra/Group/Pointwise/Set/Basic.lean @@ -78,7 +78,7 @@ section One variable [One α] {s : Set α} {a : α} /-- The set `1 : Set α` is defined as `{1}` in scope `Pointwise`. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- The set `0 : Set α` is defined as `{0}` in scope `Pointwise`. -/] protected def one : One (Set α) := ⟨{1}⟩ @@ -144,7 +144,7 @@ section Inv /-- The pointwise inversion of set `s⁻¹` is defined as `{x | x⁻¹ ∈ s}` in scope `Pointwise`. It is equal to `{x⁻¹ | x ∈ s}`, see `Set.image_inv_eq_inv`. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- The pointwise negation of set `-s` is defined as `{x | -x ∈ s}` in scope `Pointwise`. It is equal to `{-x | x ∈ s}`, see `Set.image_neg_eq_neg`. -/] protected def inv [Inv α] : Inv (Set α) := @@ -283,7 +283,7 @@ variable {ι : Sort*} {κ : ι → Sort*} [Mul α] {s s₁ s₂ t t₁ t₂ u : /-- The pointwise multiplication of sets `s * t` and `t` is defined as `{x * y | x ∈ s, y ∈ t}` in scope `Pointwise`. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- The pointwise addition of sets `s + t` is defined as `{x + y | x ∈ s, y ∈ t}` in locale `Pointwise`. -/] protected def mul : Mul (Set α) := @@ -425,7 +425,7 @@ variable {ι : Sort*} {κ : ι → Sort*} [Div α] {s s₁ s₂ t t₁ t₂ u : /-- The pointwise division of sets `s / t` is defined as `{x / y | x ∈ s, y ∈ t}` in locale `Pointwise`. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- The pointwise subtraction of sets `s - t` is defined as `{x - y | x ∈ s, y ∈ t}` in locale `Pointwise`. -/] protected def div : Div (Set α) := @@ -558,7 +558,7 @@ protected def ZPow [One α] [Mul α] [Inv α] : Pow (Set α) ℤ := scoped[Pointwise] attribute [instance] Set.NSMul Set.NPow Set.ZSMul Set.ZPow /-- `Set α` is a `Semigroup` under pointwise operations if `α` is. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- `Set α` is an `AddSemigroup` under pointwise operations if `α` is. -/] protected def semigroup [Semigroup α] : Semigroup (Set α) := { Set.mul with mul_assoc := fun _ _ _ => image2_assoc mul_assoc } @@ -568,7 +568,7 @@ section CommSemigroup variable [CommSemigroup α] {s t : Set α} /-- `Set α` is a `CommSemigroup` under pointwise operations if `α` is. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- `Set α` is an `AddCommSemigroup` under pointwise operations if `α` is. -/] protected def commSemigroup : CommSemigroup (Set α) := { Set.semigroup with mul_comm := fun _ _ => image2_comm mul_comm } @@ -588,7 +588,7 @@ section MulOneClass variable [MulOneClass α] /-- `Set α` is a `MulOneClass` under pointwise operations if `α` is. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- `Set α` is an `AddZeroClass` under pointwise operations if `α` is. -/] protected def mulOneClass : MulOneClass (Set α) := { Set.one, Set.mul with @@ -628,7 +628,7 @@ section Monoid variable [Monoid α] {s t : Set α} {a : α} {m n : ℕ} /-- `Set α` is a `Monoid` under pointwise operations if `α` is. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- `Set α` is an `AddMonoid` under pointwise operations if `α` is. -/] protected def monoid : Monoid (Set α) := { Set.semigroup, Set.mulOneClass, @Set.NPow α _ _ with } @@ -755,7 +755,7 @@ lemma Nontrivial.pow (hs : s.Nontrivial) : ∀ {n}, n ≠ 0 → (s ^ n).Nontrivi end CancelMonoid /-- `Set α` is a `CommMonoid` under pointwise operations if `α` is. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- `Set α` is an `AddCommMonoid` under pointwise operations if `α` is. -/] protected def commMonoid [CommMonoid α] : CommMonoid (Set α) := { Set.monoid, Set.commSemigroup with } @@ -791,7 +791,7 @@ protected theorem mul_eq_one_iff : s * t = 1 ↔ ∃ a b, s = {a} ∧ t = {b} rw [← nonempty_inv, inter_inv]; simp_rw [← image_inv_eq_inv, image_image, mul_inv_rev, inv_inv] /-- `Set α` is a division monoid under pointwise operations if `α` is. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- `Set α` is a subtraction monoid under pointwise operations if `α` is. -/] protected def divisionMonoid : DivisionMonoid (Set α) := { Set.monoid, Set.involutiveInv, Set.div, @Set.ZPow α _ _ _ with @@ -850,7 +850,7 @@ lemma singleton_zpow (a : α) (n : ℤ) : ({a} : Set α) ^ n = {a ^ n} := by cas end DivisionMonoid /-- `Set α` is a commutative division monoid under pointwise operations if `α` is. -/ -@[to_additive (attr := instance_reducible) subtractionCommMonoid +@[to_additive (attr := implicit_reducible) subtractionCommMonoid /-- `Set α` is a commutative subtraction monoid under pointwise operations if `α` is. -/] protected def divisionCommMonoid [DivisionCommMonoid α] : DivisionCommMonoid (Set α) := diff --git a/Mathlib/Algebra/Group/Pointwise/Set/Scalar.lean b/Mathlib/Algebra/Group/Pointwise/Set/Scalar.lean index 40ebd3b83b0016..5ee70eb67f728c 100644 --- a/Mathlib/Algebra/Group/Pointwise/Set/Scalar.lean +++ b/Mathlib/Algebra/Group/Pointwise/Set/Scalar.lean @@ -64,13 +64,13 @@ namespace Set section SMul /-- The dilation of set `x • s` is defined as `{x • y | y ∈ s}` in scope `Pointwise`. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- The translation of set `x +ᵥ s` is defined as `{x +ᵥ y | y ∈ s}` in scope `Pointwise`. -/] protected def smulSet [SMul α β] : SMul α (Set β) where smul a := image (a • ·) /-- The pointwise scalar multiplication of sets `s • t` is defined as `{x • y | x ∈ s, y ∈ t}` in scope `Pointwise`. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- The pointwise scalar addition of sets `s +ᵥ t` is defined as `{x +ᵥ y | x ∈ s, y ∈ t}` in locale `Pointwise`. -/] protected def smul [SMul α β] : SMul (Set α) (Set β) where smul := image2 (· • ·) diff --git a/Mathlib/Algebra/Group/Submonoid/Pointwise.lean b/Mathlib/Algebra/Group/Submonoid/Pointwise.lean index 22d354ae65c3d7..db787927c5dce7 100644 --- a/Mathlib/Algebra/Group/Submonoid/Pointwise.lean +++ b/Mathlib/Algebra/Group/Submonoid/Pointwise.lean @@ -122,7 +122,7 @@ theorem pow_smul_mem_closure_smul {N : Type*} [CommMonoid N] [MulAction M N] [Is variable [Group G] /-- The submonoid with every element inverted. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- The additive submonoid with every element negated. -/] protected def inv : Inv (Submonoid G) where inv S := @@ -141,7 +141,7 @@ theorem mem_inv {g : G} {S : Submonoid G} : g ∈ S⁻¹ ↔ g⁻¹ ∈ S := Iff.rfl /-- Inversion is involutive on submonoids. -/ -@[to_additive (attr := instance_reducible) /-- Inversion is involutive on additive submonoids. -/] +@[to_additive (attr := implicit_reducible) /-- Inversion is involutive on additive submonoids. -/] def involutiveInv : InvolutiveInv (Submonoid G) := SetLike.coe_injective.involutiveInv _ fun _ => rfl diff --git a/Mathlib/Algebra/Group/Units/Defs.lean b/Mathlib/Algebra/Group/Units/Defs.lean index 11a34ebd6b6f05..42ab84c83ac000 100644 --- a/Mathlib/Algebra/Group/Units/Defs.lean +++ b/Mathlib/Algebra/Group/Units/Defs.lean @@ -634,10 +634,12 @@ section NoncomputableDefs variable {M : Type*} /-- Constructs an inv operation for a `Monoid` consisting only of units. -/ +@[implicit_reducible] noncomputable def invOfIsUnit [Monoid M] (h : ∀ a : M, IsUnit a) : Inv M where inv := fun a => ↑(h a).unit⁻¹ /-- Constructs a `Group` structure on a `Monoid` consisting only of units. -/ +@[implicit_reducible] noncomputable def groupOfIsUnit [hM : Monoid M] (h : ∀ a : M, IsUnit a) : Group M := { hM with toInv := invOfIsUnit h, @@ -646,6 +648,7 @@ noncomputable def groupOfIsUnit [hM : Monoid M] (h : ∀ a : M, IsUnit a) : Grou rw [Units.inv_mul_eq_iff_eq_mul, (h a).unit_spec, mul_one] } /-- Constructs a `CommGroup` structure on a `CommMonoid` consisting only of units. -/ +@[implicit_reducible] noncomputable def commGroupOfIsUnit [hM : CommMonoid M] (h : ∀ a : M, IsUnit a) : CommGroup M := { hM with toInv := invOfIsUnit h, diff --git a/Mathlib/Algebra/GroupWithZero/Action/Defs.lean b/Mathlib/Algebra/GroupWithZero/Action/Defs.lean index bc43ec840b1ae6..e09d0f9a3c5889 100644 --- a/Mathlib/Algebra/GroupWithZero/Action/Defs.lean +++ b/Mathlib/Algebra/GroupWithZero/Action/Defs.lean @@ -159,6 +159,7 @@ protected abbrev Function.Surjective.smulWithZero (f : ZeroHom A A') (hf : Surje variable (A) /-- Compose a `SMulWithZero` with a `ZeroHom`, with action `f r' • m` -/ +@[implicit_reducible] def SMulWithZero.compHom (f : ZeroHom M₀' M₀) : SMulWithZero M₀' A where smul := (f · • ·) smul_zero m := smul_zero (f m) @@ -237,6 +238,7 @@ protected abbrev Function.Surjective.mulActionWithZero (f : ZeroHom A A') (hf : variable (A) /-- Compose a `MulActionWithZero` with a `MonoidWithZeroHom`, with action `f r' • m` -/ +@[implicit_reducible] def MulActionWithZero.compHom (f : M₀' →*₀ M₀) : MulActionWithZero M₀' A where __ := SMulWithZero.compHom A f.toZeroHom mul_smul r s m := by change f (r * s) • m = f r • f s • m; simp [mul_smul] diff --git a/Mathlib/Algebra/GroupWithZero/Basic.lean b/Mathlib/Algebra/GroupWithZero/Basic.lean index 9be446abb8e0d4..73066faabfe318 100644 --- a/Mathlib/Algebra/GroupWithZero/Basic.lean +++ b/Mathlib/Algebra/GroupWithZero/Basic.lean @@ -108,6 +108,7 @@ theorem eq_zero_of_zero_eq_one (h : (0 : M₀) = 1) (a : M₀) : a = 0 := by Somewhat arbitrarily, we define the default element to be `0`. All other elements will be provably equal to it, but not necessarily definitionally equal. -/ +@[implicit_reducible] def uniqueOfZeroEqOne (h : (0 : M₀) = 1) : Unique M₀ where default := 0 uniq := eq_zero_of_zero_eq_one h diff --git a/Mathlib/Algebra/GroupWithZero/InjSurj.lean b/Mathlib/Algebra/GroupWithZero/InjSurj.lean index 392be4453895a2..f4dcc90064bab7 100644 --- a/Mathlib/Algebra/GroupWithZero/InjSurj.lean +++ b/Mathlib/Algebra/GroupWithZero/InjSurj.lean @@ -201,6 +201,7 @@ protected abbrev Function.Injective.commGroupWithZero [Zero G₀'] [Mul G₀'] [ /-- Push forward a `CommGroupWithZero` along a surjective function. See note [reducible non-instances]. -/ +@[implicit_reducible] protected def Function.Surjective.commGroupWithZero [Zero G₀'] [Mul G₀'] [One G₀'] [Inv G₀'] [Div G₀'] [Pow G₀' ℕ] [Pow G₀' ℤ] (h01 : (0 : G₀') ≠ 1) (f : G₀ → G₀') (hf : Surjective f) (zero : f 0 = 0) (one : f 1 = 1) (mul : ∀ x y, f (x * y) = f x * f y) diff --git a/Mathlib/Algebra/GroupWithZero/Invertible.lean b/Mathlib/Algebra/GroupWithZero/Invertible.lean index 492edb70af949c..e359b0cd2b487e 100644 --- a/Mathlib/Algebra/GroupWithZero/Invertible.lean +++ b/Mathlib/Algebra/GroupWithZero/Invertible.lean @@ -47,6 +47,7 @@ section GroupWithZero variable [GroupWithZero α] /-- `a⁻¹` is an inverse of `a` if `a ≠ 0` -/ +@[implicit_reducible] def invertibleOfNonzero {a : α} (h : a ≠ 0) : Invertible a := ⟨a⁻¹, inv_mul_cancel₀ h, mul_inv_cancel₀ h⟩ @@ -79,6 +80,7 @@ theorem div_self_of_invertible (a : α) [Invertible a] : a / a = 1 := div_self (Invertible.ne_zero a) /-- `b / a` is the inverse of `a / b` -/ +@[implicit_reducible] def invertibleDiv (a b : α) [Invertible a] [Invertible b] : Invertible (a / b) := ⟨b / a, by simp [← mul_div_assoc], by simp [← mul_div_assoc]⟩ diff --git a/Mathlib/Algebra/GroupWithZero/Units/Basic.lean b/Mathlib/Algebra/GroupWithZero/Units/Basic.lean index 58dd9afffc988c..a614fdd5fe775e 100644 --- a/Mathlib/Algebra/GroupWithZero/Units/Basic.lean +++ b/Mathlib/Algebra/GroupWithZero/Units/Basic.lean @@ -458,6 +458,7 @@ variable {M : Type*} [Nontrivial M] open Classical in /-- Constructs a `GroupWithZero` structure on a `MonoidWithZero` consisting only of units and 0. -/ +@[implicit_reducible] noncomputable def groupWithZeroOfIsUnitOrEqZero [hM : MonoidWithZero M] (h : ∀ a : M, IsUnit a ∨ a = 0) : GroupWithZero M := { hM with @@ -469,6 +470,7 @@ noncomputable def groupWithZeroOfIsUnitOrEqZero [hM : MonoidWithZero M] /-- Constructs a `CommGroupWithZero` structure on a `CommMonoidWithZero` consisting only of units and 0. -/ +@[implicit_reducible] noncomputable def commGroupWithZeroOfIsUnitOrEqZero [hM : CommMonoidWithZero M] (h : ∀ a : M, IsUnit a ∨ a = 0) : CommGroupWithZero M := { groupWithZeroOfIsUnitOrEqZero h, hM with } diff --git a/Mathlib/Algebra/Homology/ComplexShapeSigns.lean b/Mathlib/Algebra/Homology/ComplexShapeSigns.lean index 52bf553ec04356..09c8547221ef66 100644 --- a/Mathlib/Algebra/Homology/ComplexShapeSigns.lean +++ b/Mathlib/Algebra/Homology/ComplexShapeSigns.lean @@ -273,6 +273,7 @@ end ComplexShape /-- The total complex shape for `c₂`, `c₁` and `c₁₂` that is deduced from a total complex shape for `c₁`, `c₂` and `c₁₂`. -/ +@[implicit_reducible] def TotalComplexShape.symm [TotalComplexShape c₁ c₂ c₁₂] : TotalComplexShape c₂ c₁ c₁₂ where π := fun ⟨i₂, i₁⟩ ↦ ComplexShape.π c₁ c₂ c₁₂ ⟨i₁, i₂⟩ @@ -298,6 +299,7 @@ class TotalComplexShapeSymmetry [TotalComplexShape c₁ c₂ c₁₂] [TotalComp /-- The symmetry between the total complex shape for `c₁`, `c₂` and `c₁₂`, and its symmetric total complex shape. -/ +@[implicit_reducible] def TotalComplexShape.symmSymmetry [TotalComplexShape c₁ c₂ c₁₂] : letI := TotalComplexShape.symm c₁ c₂ c₁₂ TotalComplexShapeSymmetry c₁ c₂ c₁₂ := @@ -356,6 +358,7 @@ end ComplexShape /-- The obvious `TotalComplexShapeSymmetry c₂ c₁ c₁₂` deduced from a `TotalComplexShapeSymmetry c₁ c₂ c₁₂`. -/ +@[implicit_reducible] def TotalComplexShapeSymmetry.symmetry [TotalComplexShape c₁ c₂ c₁₂] [TotalComplexShape c₂ c₁ c₁₂] [TotalComplexShapeSymmetry c₁ c₂ c₁₂] : TotalComplexShapeSymmetry c₂ c₁ c₁₂ where diff --git a/Mathlib/Algebra/Lie/Basic.lean b/Mathlib/Algebra/Lie/Basic.lean index fed11ea6133e32..c035b83b1c1c30 100644 --- a/Mathlib/Algebra/Lie/Basic.lean +++ b/Mathlib/Algebra/Lie/Basic.lean @@ -298,6 +298,7 @@ instance Module.Dual.instLieModule : LieModule R L (M →ₗ[R] R) where variable (L) in /-- It is sometimes useful to regard a `LieRing` as a `NonUnitalNonAssocRing`. -/ +@[implicit_reducible] def LieRing.toNonUnitalNonAssocRing : NonUnitalNonAssocRing L := { mul := Bracket.bracket left_distrib := lie_add @@ -481,6 +482,7 @@ variable (f : L₁ →ₗ⁅R⁆ L₂) /-- A Lie ring module may be pulled back along a morphism of Lie algebras. See note [reducible non-instances]. -/ +@[implicit_reducible] def LieRingModule.compLieHom : LieRingModule L₁ M where bracket x m := ⁅f x, m⁆ lie_add x := lie_add (f x) diff --git a/Mathlib/Algebra/Lie/Classical.lean b/Mathlib/Algebra/Lie/Classical.lean index 356fa78675ca04..ed0db032728ead 100644 --- a/Mathlib/Algebra/Lie/Classical.lean +++ b/Mathlib/Algebra/Lie/Classical.lean @@ -203,6 +203,7 @@ theorem pso_inv {i : R} (hi : i * i = -1) : Pso p q R i * Pso p q R (-i) = 1 := simp [Pso, h, hi, one_apply] /-- There is a constructive inverse of `Pso p q R i`. -/ +@[implicit_reducible] def invertiblePso {i : R} (hi : i * i = -1) : Invertible (Pso p q R i) := invertibleOfRightInverse _ _ (pso_inv p q R hi) diff --git a/Mathlib/Algebra/Lie/Extension.lean b/Mathlib/Algebra/Lie/Extension.lean index ed386890751113..85c91ade1fe3df 100644 --- a/Mathlib/Algebra/Lie/Extension.lean +++ b/Mathlib/Algebra/Lie/Extension.lean @@ -323,7 +323,7 @@ set_option backward.isDefEq.respectTransparency false in /-- Given an extension of `L` by `M` whose kernel `M` is abelian, the kernel `M` gets an `L`-module structure. We do not make this an instance, because we may have to work with more than one extension. -/ -@[simps] +@[simps, implicit_reducible] noncomputable def ringModuleOf [IsLieAbelian M] (E : Extension R M L) : LieRingModule L M where bracket x y := E.toKer.symm ⁅E.proj_surjective.hasRightInverse.choose x, E.toKer y⁆ add_lie x y m := by diff --git a/Mathlib/Algebra/Module/GradedModule.lean b/Mathlib/Algebra/Module/GradedModule.lean index 5a061b5d8457c8..4a8a2e32e392ae 100644 --- a/Mathlib/Algebra/Module/GradedModule.lean +++ b/Mathlib/Algebra/Module/GradedModule.lean @@ -200,6 +200,7 @@ variable [AddCommMonoid M] [Module A M] [SetLike σ M] [AddSubmonoidClass σ' A] /-- 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) := { Module.compHom _ (DirectSum.decomposeRingEquiv 𝓐 : A ≃+* ⨁ i, 𝓐 i).toRingHom with smul := fun a b => DirectSum.decompose 𝓐 a • b } diff --git a/Mathlib/Algebra/Module/NatInt.lean b/Mathlib/Algebra/Module/NatInt.lean index 0a2b21fa6ceba8..187e0a47745314 100644 --- a/Mathlib/Algebra/Module/NatInt.lean +++ b/Mathlib/Algebra/Module/NatInt.lean @@ -131,6 +131,7 @@ theorem nat_smul_eq_nsmul (h : Module ℕ M) (n : ℕ) (x : M) : h.smul n x = n /-- All `ℕ`-module structures are equal. Not an instance since in mathlib all `AddCommMonoid` should normally have exactly one `ℕ`-module structure by design. -/ +@[implicit_reducible] def AddCommMonoid.uniqueNatModule : Unique (Module ℕ M) where default := inferInstance uniq P := (Module.ext' P _) fun n => by convert nat_smul_eq_nsmul P n @@ -182,6 +183,7 @@ theorem int_smul_eq_zsmul (h : Module ℤ M) (n : ℤ) (x : M) : h.smul n x = n /-- All `ℤ`-module structures are equal. Not an instance since in mathlib all `AddCommGroup` should normally have exactly one `ℤ`-module structure by design. -/ +@[implicit_reducible] def AddCommGroup.uniqueIntModule : Unique (Module ℤ M) where default := inferInstance uniq P := (Module.ext' P _) fun n => by convert int_smul_eq_zsmul P n diff --git a/Mathlib/Algebra/Module/Submodule/Defs.lean b/Mathlib/Algebra/Module/Submodule/Defs.lean index 8d9c319b7e96f4..529c65e1e8d8de 100644 --- a/Mathlib/Algebra/Module/Submodule/Defs.lean +++ b/Mathlib/Algebra/Module/Submodule/Defs.lean @@ -179,6 +179,7 @@ instance (priority := 75) toModule : Module R S' := fast_instance% /-- This can't be an instance because Lean wouldn't know how to find `R`, but we can still use this to manually derive `Module` on specific types. -/ +@[implicit_reducible] def toModule' (S R' R A : Type*) [Semiring R] [NonUnitalNonAssocSemiring A] [Module R A] [Semiring R'] [SMul R' R] [Module R' A] [IsScalarTower R' R A] [SetLike S A] [AddSubmonoidClass S A] [SMulMemClass S R A] (s : S) : diff --git a/Mathlib/Algebra/MonoidAlgebra/Module.lean b/Mathlib/Algebra/MonoidAlgebra/Module.lean index f9cc4e5a0b2416..33fc4b583b89e3 100644 --- a/Mathlib/Algebra/MonoidAlgebra/Module.lean +++ b/Mathlib/Algebra/MonoidAlgebra/Module.lean @@ -78,6 +78,7 @@ lemma basis_apply (k) [Semiring k] (r : R) : TODO: Change the type to `DistribMulAction Gᵈᵐᵃ k[G]` and then it can be an instance. TODO: Generalise to a group acting on another, instead of just the left multiplication action. -/ +@[implicit_reducible] def comapDistribMulActionSelf [Group G] [Semiring k] : DistribMulAction G k[G] := Finsupp.comapDistribMulAction diff --git a/Mathlib/Algebra/Order/Archimedean/Basic.lean b/Mathlib/Algebra/Order/Archimedean/Basic.lean index c3a3688739a88e..e44bf813b06d02 100644 --- a/Mathlib/Algebra/Order/Archimedean/Basic.lean +++ b/Mathlib/Algebra/Order/Archimedean/Basic.lean @@ -527,6 +527,7 @@ instance : MulArchimedean NNRat := Nonneg.instMulArchimedean /-- A linear ordered archimedean ring is a floor ring. This is not an `instance` because in some cases we have a computable `floor` function. -/ +@[implicit_reducible] noncomputable def Archimedean.floorRing (R) [Ring R] [LinearOrder R] [IsStrictOrderedRing R] [Archimedean R] : FloorRing R := .ofBounded _ exists_nat_ge diff --git a/Mathlib/Algebra/Order/Floor/Defs.lean b/Mathlib/Algebra/Order/Floor/Defs.lean index 0230bde1061065..16dc71e2bf97b8 100644 --- a/Mathlib/Algebra/Order/Floor/Defs.lean +++ b/Mathlib/Algebra/Order/Floor/Defs.lean @@ -163,6 +163,7 @@ instance : FloorRing ℤ where rw [Int.cast_id, id_def] /-- A `FloorRing` constructor from the `floor` function alone. -/ +@[implicit_reducible] def FloorRing.ofFloor (α) [Ring α] [LinearOrder α] [IsStrictOrderedRing α] (floor : α → ℤ) (gc_coe_floor : GaloisConnection (↑) floor) : FloorRing α := { floor @@ -171,6 +172,7 @@ def FloorRing.ofFloor (α) [Ring α] [LinearOrder α] [IsStrictOrderedRing α] ( gc_ceil_coe := fun a z => by rw [neg_le, ← gc_coe_floor, Int.cast_neg, neg_le_neg_iff] } /-- A `FloorRing` constructor from the `ceil` function alone. -/ +@[implicit_reducible] def FloorRing.ofCeil (α) [Ring α] [LinearOrder α] [IsStrictOrderedRing α] (ceil : α → ℤ) (gc_ceil_coe : GaloisConnection ceil (↑)) : FloorRing α := { floor := fun a => -ceil (-a) @@ -197,7 +199,7 @@ theorem exists_floor' {α} [Ring α] [PartialOrder α] [IsStrictOrderedRing α] /-- Construct a `FloorRing` instance noncomputably, from the hypothesis that every element is bounded above by a natural number. -/ -@[no_expose] +@[no_expose, implicit_reducible] noncomputable def FloorRing.ofBounded (α) [Ring α] [LinearOrder α] [IsStrictOrderedRing α] (bounded : ∀ x : α, ∃ n : ℕ, x ≤ n) : FloorRing α := have below (x : α) : ∃ n : ℤ, n ≤ x := by diff --git a/Mathlib/Algebra/Order/Monoid/Unbundled/Basic.lean b/Mathlib/Algebra/Order/Monoid/Unbundled/Basic.lean index 74908c4ae0eda2..590be47935d42d 100644 --- a/Mathlib/Algebra/Order/Monoid/Unbundled/Basic.lean +++ b/Mathlib/Algebra/Order/Monoid/Unbundled/Basic.lean @@ -1112,7 +1112,7 @@ variable [PartialOrder α] to the appropriate covariant class. -/ /-- A semigroup with a partial order and satisfying `LeftCancelSemigroup` (i.e. `a * c < b * c → a < b`) is a `LeftCancelSemigroup`. -/ -@[to_additive +@[to_additive (attr := implicit_reducible) /-- An additive semigroup with a partial order and satisfying `AddLeftCancelSemigroup` (i.e. `c + a < c + b → a < b`) is a `AddLeftCancelSemigroup`. -/] def Contravariant.toLeftCancelSemigroup [MulLeftReflectLE α] : @@ -1123,7 +1123,7 @@ def Contravariant.toLeftCancelSemigroup [MulLeftReflectLE α] : to the appropriate covariant class. -/ /-- A semigroup with a partial order and satisfying `RightCancelSemigroup` (i.e. `a * c < b * c → a < b`) is a `RightCancelSemigroup`. -/ -@[to_additive +@[to_additive (attr := implicit_reducible) /-- An additive semigroup with a partial order and satisfying `AddRightCancelSemigroup` (`a + c < b + c → a < b`) is a `AddRightCancelSemigroup`. -/] def Contravariant.toRightCancelSemigroup [MulRightReflectLE α] : diff --git a/Mathlib/Algebra/Ring/Invertible.lean b/Mathlib/Algebra/Ring/Invertible.lean index dccc6cc68610fd..4dd279d7c665cb 100644 --- a/Mathlib/Algebra/Ring/Invertible.lean +++ b/Mathlib/Algebra/Ring/Invertible.lean @@ -62,6 +62,7 @@ theorem IsAddUnit.mul_right {x : R} (h : IsAddUnit x) (y : R) : IsAddUnit (x * y end NonUnitalNonAssocSemiring /-- `-⅟a` is the inverse of `-a` -/ +@[implicit_reducible] def invertibleNeg [Mul R] [One R] [HasDistribNeg R] (a : R) [Invertible a] : Invertible (-a) := ⟨-⅟a, by simp, by simp⟩ diff --git a/Mathlib/Algebra/SkewMonoidAlgebra/Basic.lean b/Mathlib/Algebra/SkewMonoidAlgebra/Basic.lean index 5fa7f37df363bd..4f32bc16093b57 100644 --- a/Mathlib/Algebra/SkewMonoidAlgebra/Basic.lean +++ b/Mathlib/Algebra/SkewMonoidAlgebra/Basic.lean @@ -835,6 +835,7 @@ def comapMulAction : MulAction G (SkewMonoidAlgebra M α) where attribute [local instance] comapMulAction /-- This is not an instance as it conflicts with `SkewMonoidAlgebra.distribMulAction` when `G = kˣ`. -/ +@[implicit_reducible] def comapDistribMulActionSelf [AddCommMonoid k] : DistribMulAction G (SkewMonoidAlgebra k G) where smul_zero g := by diff --git a/Mathlib/Algebra/Star/RingQuot.lean b/Mathlib/Algebra/Star/RingQuot.lean index d09859398586a5..e764383d85d648 100644 --- a/Mathlib/Algebra/Star/RingQuot.lean +++ b/Mathlib/Algebra/Star/RingQuot.lean @@ -43,6 +43,7 @@ private theorem star'_quot (hr : ∀ a b, r a b → r (star a) (star b)) {a} : (star' r hr ⟨Quot.mk _ a⟩ : RingQuot r) = ⟨Quot.mk _ (star a)⟩ := rfl /-- Transfer a star_ring instance through a quotient, if the quotient is invariant to `star` -/ +@[implicit_reducible] def starRing {R : Type u} [Semiring R] [StarRing R] (r : R → R → Prop) (hr : ∀ a b, r a b → r (star a) (star b)) : StarRing (RingQuot r) where star := star' r hr diff --git a/Mathlib/AlgebraicGeometry/Cover/Directed.lean b/Mathlib/AlgebraicGeometry/Cover/Directed.lean index 1b5ea111c99a38..4b3c7f7f54b112 100644 --- a/Mathlib/AlgebraicGeometry/Cover/Directed.lean +++ b/Mathlib/AlgebraicGeometry/Cover/Directed.lean @@ -261,6 +261,7 @@ end OpenCover /-- If `𝒰` is an open cover such that the images of the components form a basis of the topology of `X`, `𝒰` is directed by the ordering of subset inclusion of the images. -/ +@[implicit_reducible] def Cover.LocallyDirected.ofIsBasisOpensRange {𝒰 : X.OpenCover} [Preorder 𝒰.I₀] (hle : ∀ {i j : 𝒰.I₀}, i ≤ j ↔ (𝒰.f i).opensRange ≤ (𝒰.f j).opensRange) (H : TopologicalSpace.Opens.IsBasis (Set.range <| fun i ↦ (𝒰.f i).opensRange)) : diff --git a/Mathlib/AlgebraicTopology/ModelCategory/Basic.lean b/Mathlib/AlgebraicTopology/ModelCategory/Basic.lean index d9fc4502e4ec75..e195d28aa33f8f 100644 --- a/Mathlib/AlgebraicTopology/ModelCategory/Basic.lean +++ b/Mathlib/AlgebraicTopology/ModelCategory/Basic.lean @@ -122,6 +122,7 @@ private lemma mk'.cm3a_aux [CategoryWithFibrations C] [CategoryWithCofibrations set_option backward.isDefEq.respectTransparency false in /-- Constructor for `ModelCategory C` which assumes a formulation of axioms using weak factorization systems. -/ +@[implicit_reducible] def mk' [CategoryWithFibrations C] [CategoryWithCofibrations C] [CategoryWithWeakEquivalences C] [HasFiniteLimits C] [HasFiniteColimits C] [(weakEquivalences C).HasTwoOutOfThreeProperty] diff --git a/Mathlib/Analysis/CStarAlgebra/CStarMatrix.lean b/Mathlib/Analysis/CStarAlgebra/CStarMatrix.lean index 8aa7c448c4c3ac..a34574108e384c 100644 --- a/Mathlib/Analysis/CStarAlgebra/CStarMatrix.lean +++ b/Mathlib/Analysis/CStarAlgebra/CStarMatrix.lean @@ -642,6 +642,7 @@ private noncomputable local instance normedAddCommGroupAux : .ofCore CStarMatrix.normedSpaceCore set_option backward.isDefEq.respectTransparency false in +@[implicit_reducible] private noncomputable def normedSpaceAux : NormedSpace ℂ (CStarMatrix m n A) := .ofCore CStarMatrix.normedSpaceCore diff --git a/Mathlib/Analysis/CStarAlgebra/Matrix.lean b/Mathlib/Analysis/CStarAlgebra/Matrix.lean index 66f0608e606b3d..ad670d30fb5da4 100644 --- a/Mathlib/Analysis/CStarAlgebra/Matrix.lean +++ b/Mathlib/Analysis/CStarAlgebra/Matrix.lean @@ -120,6 +120,7 @@ lemma ofLp_toEuclideanCLM (A : Matrix n n 𝕜) (x : EuclideanSpace 𝕜 n) : /-- An auxiliary definition used only to construct the true `NormedAddCommGroup` (and `Metric`) structure provided by `Matrix.instMetricSpaceL2Op` and `Matrix.instNormedAddCommGroupL2Op`. -/ +@[implicit_reducible] def l2OpNormedAddCommGroupAux : NormedAddCommGroup (Matrix m n 𝕜) := @NormedAddCommGroup.induced ((Matrix m n 𝕜) ≃ₗ[𝕜] (EuclideanSpace 𝕜 n →L[𝕜] EuclideanSpace 𝕜 m)) _ _ _ _ ContinuousLinearMap.toNormedAddCommGroup.toNormedAddGroup _ _ <| @@ -127,6 +128,7 @@ def l2OpNormedAddCommGroupAux : NormedAddCommGroup (Matrix m n 𝕜) := /-- An auxiliary definition used only to construct the true `NormedRing` (and `Metric`) structure provided by `Matrix.instMetricSpaceL2Op` and `Matrix.instNormedRingL2Op`. -/ +@[implicit_reducible] def l2OpNormedRingAux : NormedRing (Matrix n n 𝕜) := @NormedRing.induced ((Matrix n n 𝕜) ≃⋆ₐ[𝕜] (EuclideanSpace 𝕜 n →L[𝕜] EuclideanSpace 𝕜 n)) _ _ _ _ ContinuousLinearMap.toNormedRing _ _ toEuclideanCLM.injective diff --git a/Mathlib/Analysis/CStarAlgebra/Module/Defs.lean b/Mathlib/Analysis/CStarAlgebra/Module/Defs.lean index 2c8bd1189c9c1b..cf28f629559644 100644 --- a/Mathlib/Analysis/CStarAlgebra/Module/Defs.lean +++ b/Mathlib/Analysis/CStarAlgebra/Module/Defs.lean @@ -168,6 +168,7 @@ local notation "⟪" x ", " y "⟫" => inner A x y open scoped InnerProductSpace in /-- The norm associated with a Hilbert C⋆-module. It is not registered as a norm, since a type might already have a norm defined on it. -/ +@[implicit_reducible] noncomputable def norm (A : Type*) {E : Type*} [Norm A] [Inner A E] : Norm E where norm x := √‖⟪x, x⟫_A‖ diff --git a/Mathlib/Analysis/Complex/UpperHalfPlane/Metric.lean b/Mathlib/Analysis/Complex/UpperHalfPlane/Metric.lean index 2513b094cbcc78..b5b8dd4ae74332 100644 --- a/Mathlib/Analysis/Complex/UpperHalfPlane/Metric.lean +++ b/Mathlib/Analysis/Complex/UpperHalfPlane/Metric.lean @@ -109,6 +109,7 @@ theorem dist_le_dist_coe_div_sqrt (z w : ℍ) : dist z w ≤ dist (z : ℂ) w / /-- An auxiliary `MetricSpace` instance on the upper half-plane. This instance has bad projection to `TopologicalSpace`. We replace it later. -/ +@[implicit_reducible] def metricSpaceAux : MetricSpace ℍ where dist := dist dist_self z := by rw [dist_eq, dist_self, zero_div, arsinh_zero, mul_zero] diff --git a/Mathlib/Analysis/Distribution/TestFunction.lean b/Mathlib/Analysis/Distribution/TestFunction.lean index e0814f89f50e88..e1bf6b4d5f4f7a 100644 --- a/Mathlib/Analysis/Distribution/TestFunction.lean +++ b/Mathlib/Analysis/Distribution/TestFunction.lean @@ -241,6 +241,7 @@ limit of the `𝓓^{n}_{K}(E, F)`s **in the category of topological spaces**. Note that this has no reason to be a locally convex (or even vector space) topology. For this reason, we actually endow `𝓓^{n}(Ω, F)` with another topology, namely the finest locally convex topology which is coarser than this original topology. See `TestFunction.topologicalSpace`. -/ +@[implicit_reducible] noncomputable def originalTop : TopologicalSpace 𝓓^{n}(Ω, F) := ⨆ (K : Compacts E) (K_sub_Ω : (K : Set E) ⊆ Ω), coinduced (ofSupportedIn K_sub_Ω) ContDiffMapSupportedIn.topologicalSpace diff --git a/Mathlib/Analysis/InnerProductSpace/Basic.lean b/Mathlib/Analysis/InnerProductSpace/Basic.lean index 25b6c9fe199d8b..d5d873c216e587 100644 --- a/Mathlib/Analysis/InnerProductSpace/Basic.lean +++ b/Mathlib/Analysis/InnerProductSpace/Basic.lean @@ -913,6 +913,7 @@ local notation "⟪" x ", " y "⟫" => inner 𝕜 x y /-- A general inner product implies a real inner product. This is not registered as an instance since `𝕜` does not appear in the return type `Inner ℝ E`. -/ +@[implicit_reducible] def Inner.rclikeToReal : Inner ℝ E where inner x y := re ⟪x, y⟫ /-- A general inner product space structure implies a real inner product structure. @@ -951,6 +952,7 @@ theorem real_inner_I_smul_self (x : E) : /-- A complex inner product implies a real inner product. This cannot be an instance since it creates a diamond with `PiLp.innerProductSpace` because `re (sum i, ⟪x i, y i⟫)` and `sum i, re ⟪x i, y i⟫` are not defeq. -/ +@[implicit_reducible] def InnerProductSpace.complexToReal [SeminormedAddCommGroup G] [InnerProductSpace ℂ G] : InnerProductSpace ℝ G := InnerProductSpace.rclikeToReal ℂ G diff --git a/Mathlib/Analysis/InnerProductSpace/Defs.lean b/Mathlib/Analysis/InnerProductSpace/Defs.lean index bcfbb91a043e7e..a2fd1a2f87cbb0 100644 --- a/Mathlib/Analysis/InnerProductSpace/Defs.lean +++ b/Mathlib/Analysis/InnerProductSpace/Defs.lean @@ -170,6 +170,7 @@ instance (𝕜 : Type*) (F : Type*) [RCLike 𝕜] [AddCommGroup F] `PreInnerProductSpace.Core` for `PreInnerProductSpace`s. Note that the `Seminorm` instance provided by `PreInnerProductSpace.Core.norm` is propositionally but not definitionally equal to the original norm. -/ +@[implicit_reducible] def PreInnerProductSpace.toCore [SeminormedAddCommGroup E] [c : InnerProductSpace 𝕜 E] : PreInnerProductSpace.Core 𝕜 E where __ := c @@ -179,6 +180,7 @@ def PreInnerProductSpace.toCore [SeminormedAddCommGroup E] [c : InnerProductSpac `InnerProductSpace.Core` for `InnerProductSpace`s. Note that the `Norm` instance provided by `InnerProductSpace.Core.norm` is propositionally but not definitionally equal to the original norm. -/ +@[implicit_reducible] def InnerProductSpace.toCore [NormedAddCommGroup E] [c : InnerProductSpace 𝕜 E] : InnerProductSpace.Core 𝕜 E := { c with @@ -410,6 +412,7 @@ attribute [local instance] toSeminormedAddCommGroup /-- Normed space (which is actually a seminorm in general) structure constructed from a `PreInnerProductSpace.Core` structure -/ +@[implicit_reducible] def toNormedSpace : NormedSpace 𝕜 F where norm_smul_le r x := by rw [norm_eq_sqrt_re_inner, inner_smul_left, inner_smul_right, ← mul_assoc] @@ -563,6 +566,7 @@ attribute [local instance] InnerProductSpace.Core.toSeminormedAddCommGroup the space into a pre-inner product space (i.e., `SeminormedAddCommGroup` and `InnerProductSpace`). The `SeminormedAddCommGroup` structure is expected to already be defined with `InnerProductSpace.ofCore.toSeminormedAddCommGroup`. -/ +@[implicit_reducible] def InnerProductSpace.ofCore [AddCommGroup F] [Module 𝕜 F] (cd : PreInnerProductSpace.Core 𝕜 F) : InnerProductSpace 𝕜 F := letI : NormedSpace 𝕜 F := InnerProductSpace.Core.toNormedSpace @@ -577,6 +581,7 @@ end /-- Given an `InnerProductSpace.Core` structure on a space with a topology, one can use it to turn the space into an inner product space. The `NormedAddCommGroup` structure is expected to already be defined with `InnerProductSpace.ofCore.toNormedAddCommGroupOfTopology`. -/ +@[implicit_reducible] def InnerProductSpace.ofCoreOfTopology [AddCommGroup F] [hF : Module 𝕜 F] [TopologicalSpace F] [IsTopologicalAddGroup F] [ContinuousConstSMul 𝕜 F] (cd : InnerProductSpace.Core 𝕜 F) diff --git a/Mathlib/Analysis/InnerProductSpace/OfNorm.lean b/Mathlib/Analysis/InnerProductSpace/OfNorm.lean index 8b0c13087a6bfc..a0cfdf74f4c2d7 100644 --- a/Mathlib/Analysis/InnerProductSpace/OfNorm.lean +++ b/Mathlib/Analysis/InnerProductSpace/OfNorm.lean @@ -203,6 +203,7 @@ set_option backward.privateInPublic true in set_option backward.privateInPublic.warn false in /-- **Fréchet–von Neumann–Jordan Theorem**. A normed space `E` whose norm satisfies the parallelogram identity can be given a compatible inner product. -/ +@[implicit_reducible] noncomputable def InnerProductSpace.ofNorm (h : ∀ x y : E, ‖x + y‖ * ‖x + y‖ + ‖x - y‖ * ‖x - y‖ = 2 * (‖x‖ * ‖x‖ + ‖y‖ * ‖y‖)) : InnerProductSpace 𝕜 E := diff --git a/Mathlib/Analysis/LocallyConvex/WithSeminorms.lean b/Mathlib/Analysis/LocallyConvex/WithSeminorms.lean index 4f7173b9a9d296..16f2286961874d 100644 --- a/Mathlib/Analysis/LocallyConvex/WithSeminorms.lean +++ b/Mathlib/Analysis/LocallyConvex/WithSeminorms.lean @@ -138,6 +138,7 @@ theorem basisSets_neg (U) (hU' : U ∈ p.basisSets) : exact ⟨U, hU', Eq.subset hU⟩ /-- The `addGroupFilterBasis` induced by the filter basis `Seminorm.basisSets`. -/ +@[implicit_reducible] protected def addGroupFilterBasis : AddGroupFilterBasis E := addGroupFilterBasisOfComm p.basisSets p.basisSets_nonempty p.basisSets_intersect p.basisSets_zero p.basisSets_add p.basisSets_neg diff --git a/Mathlib/Analysis/Matrix/Order.lean b/Mathlib/Analysis/Matrix/Order.lean index f861864fe9a3ee..76dc37c2b1d117 100644 --- a/Mathlib/Analysis/Matrix/Order.lean +++ b/Mathlib/Analysis/Matrix/Order.lean @@ -358,6 +358,7 @@ set_option backward.privateInPublic true in set_option backward.privateInPublic.warn false in /-- A positive definite matrix `M` induces a norm on `Matrix n n 𝕜` `‖x‖ = sqrt (x * M * xᴴ).trace`. -/ +@[implicit_reducible] noncomputable def toMatrixSeminormedAddCommGroup (M : Matrix n n 𝕜) (hM : M.PosSemidef) : SeminormedAddCommGroup (Matrix n n 𝕜) := @InnerProductSpace.Core.toSeminormedAddCommGroup _ _ _ _ _ hM.matrixPreInnerProductSpace @@ -367,6 +368,7 @@ set_option backward.privateInPublic true in set_option backward.privateInPublic.warn false in /-- A positive definite matrix `M` induces a norm on `Matrix n n 𝕜`: `‖x‖ = sqrt (x * M * xᴴ).trace`. -/ +@[implicit_reducible] noncomputable def toMatrixNormedAddCommGroup (M : Matrix n n 𝕜) (hM : M.PosDef) : NormedAddCommGroup (Matrix n n 𝕜) := letI : InnerProductSpace.Core 𝕜 (Matrix n n 𝕜) := @@ -385,6 +387,7 @@ noncomputable def toMatrixNormedAddCommGroup (M : Matrix n n 𝕜) (hM : M.PosDe set_option backward.isDefEq.respectTransparency false in /-- A positive semi-definite matrix `M` induces an inner product on `Matrix n n 𝕜`: `⟪x, y⟫ = (y * M * xᴴ).trace`. -/ +@[implicit_reducible] def toMatrixInnerProductSpace (M : Matrix n n 𝕜) (hM : M.PosSemidef) : letI : SeminormedAddCommGroup (Matrix n n 𝕜) := M.toMatrixSeminormedAddCommGroup hM InnerProductSpace 𝕜 (Matrix n n 𝕜) := diff --git a/Mathlib/Analysis/Matrix/PosDef.lean b/Mathlib/Analysis/Matrix/PosDef.lean index 93bda388027ef2..76809f5b7bc2e8 100644 --- a/Mathlib/Analysis/Matrix/PosDef.lean +++ b/Mathlib/Analysis/Matrix/PosDef.lean @@ -97,6 +97,7 @@ set_option backward.privateInPublic true in /-- The pre-inner product space structure implementation. Only an auxiliary for `Matrix.toSeminormedAddCommGroup`, `Matrix.toNormedAddCommGroup`, and `Matrix.toInnerProductSpace`. -/ +@[implicit_reducible] private def PosSemidef.preInnerProductSpace {M : Matrix n n 𝕜} (hM : M.PosSemidef) : PreInnerProductSpace.Core 𝕜 (n → 𝕜) where inner x y := (M *ᵥ y) ⬝ᵥ star x @@ -126,6 +127,7 @@ noncomputable abbrev toNormedAddCommGroup (M : Matrix n n 𝕜) (hM : M.PosDef) simpa [hx, lt_irrefl, dotProduct_comm] using hM.re_dotProduct_pos h } /-- A positive semi-definite matrix `M` induces an inner product `⟪x, y⟫ = xᴴMy`. -/ +@[implicit_reducible] def toInnerProductSpace (M : Matrix n n 𝕜) (hM : M.PosSemidef) : @InnerProductSpace 𝕜 (n → 𝕜) _ (M.toSeminormedAddCommGroup hM) := InnerProductSpace.ofCore _ diff --git a/Mathlib/Analysis/Normed/Algebra/Exponential.lean b/Mathlib/Analysis/Normed/Algebra/Exponential.lean index 185d8d20f4ede8..42cab64d03c2b3 100644 --- a/Mathlib/Analysis/Normed/Algebra/Exponential.lean +++ b/Mathlib/Analysis/Normed/Algebra/Exponential.lean @@ -343,6 +343,7 @@ theorem exp_add_of_commute_of_mem_ball [CharZero 𝕂] {x y : 𝔸} (hxy : Commu field_simp [n.factorial_ne_zero] /-- `NormedSpace.exp x` has explicit two-sided inverse `NormedSpace.exp (-x)`. -/ +@[implicit_reducible] noncomputable def invertibleExpOfMemBall [CharZero 𝕂] {x : 𝔸} (hx : x ∈ Metric.eball (0 : 𝔸) (expSeries 𝕂 𝔸).radius) : Invertible (exp x) where @@ -512,6 +513,7 @@ theorem exp_add_of_commute {x y : 𝔸} (hxy : Commute x y) : exp (x + y) = exp ((expSeries_radius_eq_top ℚ 𝔸).symm ▸ edist_lt_top _ _) /-- `NormedSpace.exp x` has explicit two-sided inverse `NormedSpace.exp (-x)`. -/ +@[implicit_reducible] noncomputable def invertibleExp (x : 𝔸) : Invertible (exp x) := invertibleExpOfMemBall <| (expSeries_radius_eq_top ℚ 𝔸).symm ▸ edist_lt_top _ _ diff --git a/Mathlib/Analysis/Normed/Field/Basic.lean b/Mathlib/Analysis/Normed/Field/Basic.lean index 086f0d23dbd165..723c9f6c4f2f3f 100644 --- a/Mathlib/Analysis/Normed/Field/Basic.lean +++ b/Mathlib/Analysis/Normed/Field/Basic.lean @@ -280,6 +280,7 @@ end NormedField /-- A normed field is nontrivially normed provided that the norm of some nonzero element is not one. -/ +@[implicit_reducible] def NontriviallyNormedField.ofNormNeOne {𝕜 : Type*} [h' : NormedField 𝕜] (h : ∃ x : 𝕜, x ≠ 0 ∧ ‖x‖ ≠ 1) : NontriviallyNormedField 𝕜 where toNormedField := h' @@ -354,6 +355,7 @@ end SubfieldClass namespace AbsoluteValue /-- A real absolute value on a field determines a `NormedField` structure. -/ +@[implicit_reducible] noncomputable def toNormedField {K : Type*} [Field K] (v : AbsoluteValue K ℝ) : NormedField K where toField := inferInstanceAs (Field K) __ := v.toNormedRing diff --git a/Mathlib/Analysis/Normed/Group/AddTorsor.lean b/Mathlib/Analysis/Normed/Group/AddTorsor.lean index 04546a46b443cd..73660df26438d0 100644 --- a/Mathlib/Analysis/Normed/Group/AddTorsor.lean +++ b/Mathlib/Analysis/Normed/Group/AddTorsor.lean @@ -181,6 +181,7 @@ theorem edist_vsub_vsub_le (p₁ p₂ p₃ p₄ : P) : /-- The pseudodistance defines a pseudometric space structure on the torsor. This is not an instance because it depends on `V` to define a `MetricSpace P`. -/ +@[implicit_reducible] def pseudoMetricSpaceOfNormedAddCommGroupOfAddTorsor (V P : Type*) [SeminormedAddCommGroup V] [AddTorsor V P] : PseudoMetricSpace P where dist x y := ‖(x -ᵥ y : V)‖ @@ -192,6 +193,7 @@ def pseudoMetricSpaceOfNormedAddCommGroupOfAddTorsor (V P : Type*) [SeminormedAd /-- The distance defines a metric space structure on the torsor. This is not an instance because it depends on `V` to define a `MetricSpace P`. -/ +@[implicit_reducible] def metricSpaceOfNormedAddCommGroupOfAddTorsor (V P : Type*) [NormedAddCommGroup V] [AddTorsor V P] : MetricSpace P where dist x y := ‖(x -ᵥ y : V)‖ diff --git a/Mathlib/Analysis/Normed/Module/Basic.lean b/Mathlib/Analysis/Normed/Module/Basic.lean index 7c5606bd3db3f1..ed3addade0e3ff 100644 --- a/Mathlib/Analysis/Normed/Module/Basic.lean +++ b/Mathlib/Analysis/Normed/Module/Basic.lean @@ -482,6 +482,7 @@ instance RestrictScalars.normedSpace : NormedSpace 𝕜 (RestrictScalars 𝕜 /-- The action of the original normed_field on `RestrictScalars 𝕜 𝕜' E`. This is not an instance as it would be contrary to the purpose of `RestrictScalars`. -/ +@[implicit_reducible] def Module.RestrictScalars.normedSpaceOrig {𝕜 : Type*} {𝕜' : Type*} {E : Type*} [NormedField 𝕜'] [SeminormedAddCommGroup E] [I : NormedSpace 𝕜' E] : NormedSpace 𝕜' (RestrictScalars 𝕜 𝕜' E) := I @@ -523,6 +524,7 @@ instance RestrictScalars.normedAlgebra : NormedAlgebra 𝕜 (RestrictScalars /-- The action of the original normed_field on `RestrictScalars 𝕜 𝕜' E`. This is not an instance as it would be contrary to the purpose of `RestrictScalars`. -/ +@[implicit_reducible] def Module.RestrictScalars.normedAlgebraOrig {𝕜 : Type*} {𝕜' : Type*} {E : Type*} [NormedField 𝕜'] [SeminormedRing E] [I : NormedAlgebra 𝕜' E] : NormedAlgebra 𝕜' (RestrictScalars 𝕜 𝕜' E) := I diff --git a/Mathlib/Analysis/Normed/Ring/Basic.lean b/Mathlib/Analysis/Normed/Ring/Basic.lean index 8857c89a544479..d44510babaabd1 100644 --- a/Mathlib/Analysis/Normed/Ring/Basic.lean +++ b/Mathlib/Analysis/Normed/Ring/Basic.lean @@ -908,6 +908,7 @@ end SubringClass namespace AbsoluteValue /-- A real absolute value on a ring determines a `NormedRing` structure. -/ +@[implicit_reducible] noncomputable def toNormedRing {R : Type*} [Ring R] (v : AbsoluteValue R ℝ) : NormedRing R where norm := v dist x y := v (-x + y) diff --git a/Mathlib/Analysis/Normed/Unbundled/SpectralNorm.lean b/Mathlib/Analysis/Normed/Unbundled/SpectralNorm.lean index 7f9fd75de20229..67c0edd1289b2b 100644 --- a/Mathlib/Analysis/Normed/Unbundled/SpectralNorm.lean +++ b/Mathlib/Analysis/Normed/Unbundled/SpectralNorm.lean @@ -857,6 +857,7 @@ namespace spectralNorm variable (K L) /-- `L` with the spectral norm is a `NormedField`. -/ +@[implicit_reducible] def normedField : NormedField L := { (inferInstance : Field L) with norm x := (spectralNorm K L x : ℝ) @@ -875,6 +876,7 @@ def normedField : NormedField L := edist_dist x y := by rw [ENNReal.ofReal_eq_coe_nnreal] } /-- `L` with the spectral norm is a `NontriviallyNormedField`. -/ +@[implicit_reducible] def nontriviallyNormedField [CompleteSpace K] : NontriviallyNormedField L where __ := spectralNorm.normedField K L non_trivial := @@ -882,16 +884,19 @@ def nontriviallyNormedField [CompleteSpace K] : NontriviallyNormedField L where ⟨algebraMap K L x, hx.trans_eq <| (spectralNorm_extends _).symm⟩ /-- `L` with the spectral norm is a `normed_add_comm_group`. -/ +@[implicit_reducible] def normedAddCommGroup : NormedAddCommGroup L := by haveI : NormedField L := normedField K L infer_instance /-- `L` with the spectral norm is a `seminormed_add_comm_group`. -/ +@[implicit_reducible] def seminormedAddCommGroup : SeminormedAddCommGroup L := by have : NormedField L := normedField K L infer_instance /-- `L` with the spectral norm is a `normed_space` over `K`. -/ +@[implicit_reducible] def normedSpace : @NormedSpace K L _ (seminormedAddCommGroup K L) := letI _ := seminormedAddCommGroup K L { (inferInstance : Module K L) with @@ -900,9 +905,11 @@ def normedSpace : @NormedSpace K L _ (seminormedAddCommGroup K L) := exact le_of_eq (map_smul_eq_mul _ _ _) } /-- The metric space structure on `L` induced by the spectral norm. -/ +@[implicit_reducible] def metricSpace : MetricSpace L := (normedField K L).toMetricSpace /-- The uniform space structure on `L` induced by the spectral norm. -/ +@[implicit_reducible] def uniformSpace : UniformSpace L := (metricSpace K L).toUniformSpace set_option backward.isDefEq.respectTransparency false in diff --git a/Mathlib/Analysis/RCLike/Basic.lean b/Mathlib/Analysis/RCLike/Basic.lean index 65f2a4ad5f2b14..7a78fe2eecb52e 100644 --- a/Mathlib/Analysis/RCLike/Basic.lean +++ b/Mathlib/Analysis/RCLike/Basic.lean @@ -1258,6 +1258,7 @@ instance (priority := 100) (𝕜 : Type*) [h : RCLike 𝕜] : IsRCLikeNormedFiel /-- A copy of an `RCLike` field in which the `NormedField` field is adjusted to be become defeq to a propeq one. -/ +@[implicit_reducible] noncomputable def RCLike.copy_of_normedField {𝕜 : Type*} (h : RCLike 𝕜) (hk : NormedField 𝕜) (h'' : hk = h.toNormedField) : RCLike 𝕜 where __ := hk @@ -1301,6 +1302,7 @@ noncomputable def RCLike.copy_of_normedField {𝕜 : Type*} (h : RCLike 𝕜) (h /-- Given a normed field `𝕜` satisfying `IsRCLikeNormedField 𝕜`, build an associated `RCLike 𝕜` structure on `𝕜` which is definitionally compatible with the given normed field structure. -/ +@[implicit_reducible] noncomputable def IsRCLikeNormedField.rclike (𝕜 : Type*) [hk : NormedField 𝕜] [h : IsRCLikeNormedField 𝕜] : RCLike 𝕜 := by choose p hp using h.out diff --git a/Mathlib/CategoryTheory/Abelian/Basic.lean b/Mathlib/CategoryTheory/Abelian/Basic.lean index 709c1474edf03a..4706830dbccaf7 100644 --- a/Mathlib/CategoryTheory/Abelian/Basic.lean +++ b/Mathlib/CategoryTheory/Abelian/Basic.lean @@ -253,7 +253,8 @@ attribute [local instance] OfCoimageImageComparisonIsIso.isNormalEpiCategory in which the coimage-image comparison morphism is always an isomorphism, is an abelian category. -/ @[stacks 0109 -"The Stacks project uses this characterisation at the definition of an abelian category."] +"The Stacks project uses this characterisation at the definition of an abelian category.", + implicit_reducible] def ofCoimageImageComparisonIsIso : Abelian C where end CategoryTheory.Abelian @@ -822,6 +823,7 @@ namespace CategoryTheory.NonPreadditiveAbelian variable (C : Type u) [Category.{v} C] [NonPreadditiveAbelian C] /-- Every `NonPreadditiveAbelian` category can be promoted to an abelian category. -/ +@[implicit_reducible] def abelian : Abelian C where toPreadditive := NonPreadditiveAbelian.preadditive normalMonoOfMono := fun f _ ↦ ⟨normalMonoOfMono f⟩ @@ -870,6 +872,7 @@ preadditive, has finite products, and that any morphism `f : X ⟶ Y` has a kernel `i : K ⟶ X`, a cokernel `p : Y ⟶ Q` such that `f` factors as `f = π ≫ ι` where `π : X ⟶ I` is a cokernel of `i` and `ι : I ⟶ Y` is a kernel of `p`. This assumption is packaged in a structure `AbelianStruct f`. -/ +@[implicit_reducible] noncomputable def mk' [HasFiniteProducts C] (h : ∀ ⦃X Y : C⦄ (f : X ⟶ Y), Nonempty (AbelianStruct f)) : Abelian C where diff --git a/Mathlib/CategoryTheory/Abelian/NonPreadditive.lean b/Mathlib/CategoryTheory/Abelian/NonPreadditive.lean index 3f992296fcc4ba..fc5bc0badfcf57 100644 --- a/Mathlib/CategoryTheory/Abelian/NonPreadditive.lean +++ b/Mathlib/CategoryTheory/Abelian/NonPreadditive.lean @@ -409,6 +409,7 @@ theorem add_comp (X Y Z : C) (f g : X ⟶ Y) (h : Y ⟶ Z) : (f + g) ≫ h = f rw [add_def, sub_comp, neg_def, sub_comp, zero_comp, add_def, neg_def] /-- Every `NonPreadditiveAbelian` category is preadditive. -/ +@[implicit_reducible] def preadditive : Preadditive C where homGroup X Y := { add_assoc := add_assoc diff --git a/Mathlib/CategoryTheory/Abelian/Transfer.lean b/Mathlib/CategoryTheory/Abelian/Transfer.lean index 7578c9800c9250..099e982bca1390 100644 --- a/Mathlib/CategoryTheory/Abelian/Transfer.lean +++ b/Mathlib/CategoryTheory/Abelian/Transfer.lean @@ -84,7 +84,7 @@ we have `F : C ⥤ D` `G : D ⥤ C` (with `G` preserving zero morphisms), `G` is left exact (that is, preserves finite limits), and further we have `adj : G ⊣ F` and `i : F ⋙ G ≅ 𝟭 C`, then `C` is also abelian. -/ -@[stacks 03A3] +@[stacks 03A3, implicit_reducible] def abelianOfAdjunction {C : Type u₁} [Category.{v₁} C] [Preadditive C] [HasFiniteProducts C] {D : Type u₂} [Category.{v₂} D] [Abelian D] (F : C ⥤ D) (G : D ⥤ C) [Functor.PreservesZeroMorphisms G] [PreservesFiniteLimits G] (i : F ⋙ G ≅ 𝟭 C) @@ -108,6 +108,7 @@ def abelianOfAdjunction {C : Type u₁} [Category.{v₁} C] [Preadditive C] [Has via a functor that preserves zero morphisms, then `C` is also abelian. -/ +@[implicit_reducible] def abelianOfEquivalence {C : Type u₁} [Category.{v₁} C] [Preadditive C] [HasFiniteProducts C] {D : Type u₂} [Category.{v₂} D] [Abelian D] (F : C ⥤ D) [F.IsEquivalence] : Abelian C := diff --git a/Mathlib/CategoryTheory/Bicategory/Monad/Basic.lean b/Mathlib/CategoryTheory/Bicategory/Monad/Basic.lean index 33c7e39570f840..5e4fae35cb8c5f 100644 --- a/Mathlib/CategoryTheory/Bicategory/Monad/Basic.lean +++ b/Mathlib/CategoryTheory/Bicategory/Monad/Basic.lean @@ -77,6 +77,7 @@ instance {a : B} : Comonad (𝟙 a) := ComonObj.instTensorUnit (a ⟶ a) /-- An oplax functor from the trivial bicategory to `B` defines a comonad in `B`. -/ +@[implicit_reducible] def ofOplaxFromUnit (F : LocallyDiscrete (Discrete Unit) ⥤ᵒᵖᴸ B) : Comonad (F.map (𝟙 ⟨⟨Unit.unit⟩⟩)) where comul := F.map₂ (ρ_ _).inv ≫ F.mapComp _ _ diff --git a/Mathlib/CategoryTheory/CatCommSq.lean b/Mathlib/CategoryTheory/CatCommSq.lean index 2f5328fb17cf06..7901ff1fb7cd09 100644 --- a/Mathlib/CategoryTheory/CatCommSq.lean +++ b/Mathlib/CategoryTheory/CatCommSq.lean @@ -49,7 +49,7 @@ def vId : CatCommSq T (𝟭 C₁) (𝟭 C₂) T where iso := (Functor.leftUnitor _) ≪≫ (Functor.rightUnitor _).symm /-- The horizontal identity `CatCommSq` -/ -@[simps!] +@[simps!, implicit_reducible] def hId : CatCommSq (𝟭 C₁) L L (𝟭 C₃) where iso := (Functor.rightUnitor _) ≪≫ (Functor.leftUnitor _).symm @@ -64,7 +64,7 @@ lemma iso_inv_naturality [h : CatCommSq T L R B] {x y : C₁} (f : x ⟶ y) : (iso T L R B).inv.naturality f /-- Horizontal composition of 2-commutative squares -/ -@[simps!] +@[simps!, implicit_reducible] def hComp (T₁ : C₁ ⥤ C₂) (T₂ : C₂ ⥤ C₃) (V₁ : C₁ ⥤ C₄) (V₂ : C₂ ⥤ C₅) (V₃ : C₃ ⥤ C₆) (B₁ : C₄ ⥤ C₅) (B₂ : C₅ ⥤ C₆) [CatCommSq T₁ V₁ V₂ B₁] [CatCommSq T₂ V₂ V₃ B₂] : CatCommSq (T₁ ⋙ T₂) V₁ V₃ (B₁ ⋙ B₂) where @@ -81,7 +81,7 @@ abbrev hComp' {T₁ : C₁ ⥤ C₂} {T₂ : C₂ ⥤ C₃} {V₁ : C₁ ⥤ C hComp _ _ _ V₂ _ _ _ /-- Vertical composition of 2-commutative squares -/ -@[simps!] +@[simps!, implicit_reducible] def vComp (L₁ : C₁ ⥤ C₂) (L₂ : C₂ ⥤ C₃) (H₁ : C₁ ⥤ C₄) (H₂ : C₂ ⥤ C₅) (H₃ : C₃ ⥤ C₆) (R₁ : C₄ ⥤ C₅) (R₂ : C₅ ⥤ C₆) [CatCommSq H₁ L₁ R₁ H₂] [CatCommSq H₂ L₂ R₂ H₃] : CatCommSq H₁ (L₁ ⋙ L₂) (R₁ ⋙ R₂) H₃ where @@ -102,7 +102,7 @@ section variable (T : C₁ ≌ C₂) (L : C₁ ⥤ C₃) (R : C₂ ⥤ C₄) (B : C₃ ≌ C₄) /-- Horizontal inverse of a 2-commutative square -/ -@[simps!] +@[simps!, implicit_reducible] def hInv (_ : CatCommSq T.functor L R B.functor) : CatCommSq T.inverse R L B.inverse where iso := isoWhiskerLeft _ (L.rightUnitor.symm ≪≫ isoWhiskerLeft L B.unitIso ≪≫ (associator _ _ _).symm ≪≫ @@ -142,7 +142,7 @@ section variable (T : C₁ ⥤ C₂) (L : C₁ ≌ C₃) (R : C₂ ≌ C₄) (B : C₃ ⥤ C₄) /-- Vertical inverse of a 2-commutative square -/ -@[simps!] +@[simps!, implicit_reducible] def vInv (_ : CatCommSq T L.functor R.functor B) : CatCommSq B L.inverse R.inverse T where iso := isoWhiskerRight (B.leftUnitor.symm ≪≫ isoWhiskerRight L.counitIso.symm B ≪≫ associator _ _ _ ≪≫ diff --git a/Mathlib/CategoryTheory/Center/Linear.lean b/Mathlib/CategoryTheory/Center/Linear.lean index 6095144040f133..a66179f9ba9d05 100644 --- a/Mathlib/CategoryTheory/Center/Linear.lean +++ b/Mathlib/CategoryTheory/Center/Linear.lean @@ -52,6 +52,7 @@ variable (φ : R →+* CatCenter C) (X Y : C) /-- The scalar multiplication by `R` on the type `X ⟶ Y` of morphisms in a category `C` equipped with a ring morphism `R →+* CatCenter C`. -/ +@[implicit_reducible] def smulOfRingMorphism : SMul R (X ⟶ Y) where smul a f := (φ a).app X ≫ f @@ -73,6 +74,7 @@ variable (X Y) set_option backward.isDefEq.respectTransparency false in /-- The `R`-module structure on the type `X ⟶ Y` of morphisms in a category `C` equipped with a ring morphism `R →+* CatCenter C`. -/ +@[implicit_reducible] def homModuleOfRingMorphism : Module R (X ⟶ Y) := by letI := smulOfRingMorphism φ X Y exact @@ -95,6 +97,7 @@ def homModuleOfRingMorphism : Module R (X ⟶ Y) := by set_option backward.isDefEq.respectTransparency false in /-- The `R`-linear structure on a preadditive category `C` equipped with a ring morphism `R →+* CatCenter C`. -/ +@[implicit_reducible] def ofRingMorphism : Linear R C := by letI := homModuleOfRingMorphism φ exact diff --git a/Mathlib/CategoryTheory/ConcreteCategory/Forget.lean b/Mathlib/CategoryTheory/ConcreteCategory/Forget.lean index d0fa94d9ad22bc..9ed3b89f4fa9af 100644 --- a/Mathlib/CategoryTheory/ConcreteCategory/Forget.lean +++ b/Mathlib/CategoryTheory/ConcreteCategory/Forget.lean @@ -114,6 +114,7 @@ instance FullSubcategory.hasForget₂ (P : ObjectProperty C) : HasForget₂ P.Fu /-- In order to construct a “partially forgetting” functor, we do not need to verify functor laws; it suffices to ensure that compositions agree with `forget₂ C D ⋙ forget D = forget C`. -/ +@[implicit_reducible] def HasForget₂.mk' (obj : C → D) (h_obj : ∀ X, (forget D).obj (obj X) = (forget C).obj X) (map : ∀ {X Y}, (X ⟶ Y) → (obj X ⟶ obj Y)) (h_map : ∀ {X Y} {f : X ⟶ Y}, (forget D).map (map f) ≍ (forget C).map f) : diff --git a/Mathlib/CategoryTheory/Enriched/Basic.lean b/Mathlib/CategoryTheory/Enriched/Basic.lean index 612a0fcddead90..b2758d13de6eac 100644 --- a/Mathlib/CategoryTheory/Enriched/Basic.lean +++ b/Mathlib/CategoryTheory/Enriched/Basic.lean @@ -166,6 +166,7 @@ def categoryOfEnrichedCategoryType (C : Type u₁) [𝒞 : EnrichedCategory (Typ /-- Construct a `Type v`-enriched category from an honest category. -/ +@[implicit_reducible] def enrichedCategoryTypeOfCategory (C : Type u₁) [𝒞 : Category.{v} C] : EnrichedCategory (Type v) C where Hom := 𝒞.Hom diff --git a/Mathlib/CategoryTheory/Enriched/FunctorCategory.lean b/Mathlib/CategoryTheory/Enriched/FunctorCategory.lean index 8883082b3026b3..812312f6278747 100644 --- a/Mathlib/CategoryTheory/Enriched/FunctorCategory.lean +++ b/Mathlib/CategoryTheory/Enriched/FunctorCategory.lean @@ -233,6 +233,7 @@ variable (J C) /-- If `C` is a `V`-enriched ordinary category, and `C` has suitable limits, then `J ⥤ C` is also a `V`-enriched ordinary category. -/ +@[implicit_reducible] noncomputable def enrichedOrdinaryCategory [∀ (F₁ F₂ : J ⥤ C), HasEnrichedHom V F₁ F₂] : EnrichedOrdinaryCategory V (J ⥤ C) where Hom F₁ F₂ := enrichedHom V F₁ F₂ diff --git a/Mathlib/CategoryTheory/Enriched/Ordinary/Basic.lean b/Mathlib/CategoryTheory/Enriched/Ordinary/Basic.lean index 8a763683680f46..f7d6480d1603db 100644 --- a/Mathlib/CategoryTheory/Enriched/Ordinary/Basic.lean +++ b/Mathlib/CategoryTheory/Enriched/Ordinary/Basic.lean @@ -232,6 +232,7 @@ set_option backward.isDefEq.respectTransparency false in `(𝟙_ V ⟶ v) → (𝟙_ W ⟶ F.obj v)` is bijective, and `C` is an enriched ordinary category on `V`, then `F` induces the structure of a `W`-enriched ordinary category on `TransportEnrichment F C`, i.e. on the same underlying category `C`. -/ +@[implicit_reducible] def TransportEnrichment.enrichedOrdinaryCategory (e : ∀ v : V, (𝟙_ V ⟶ v) ≃ (𝟙_ W ⟶ F.obj v)) (h : ∀ v : V, ∀ f : 𝟙_ V ⟶ v, e v f = Functor.LaxMonoidal.ε F ≫ F.map f) : diff --git a/Mathlib/CategoryTheory/EpiMono.lean b/Mathlib/CategoryTheory/EpiMono.lean index 75901d37ce6208..a6289435205f3b 100644 --- a/Mathlib/CategoryTheory/EpiMono.lean +++ b/Mathlib/CategoryTheory/EpiMono.lean @@ -208,6 +208,7 @@ theorem IsIso.of_epi_section {X Y : C} (f : X ⟶ Y) [hf : IsSplitEpi f] [hf' : -- FIXME this has unnecessarily become noncomputable! /-- A category where every morphism has a `Trunc` retraction is computably a groupoid. -/ +@[implicit_reducible] noncomputable def Groupoid.ofTruncSplitMono (all_split_mono : ∀ {X Y : C} (f : X ⟶ Y), Trunc (IsSplitMono f)) : Groupoid.{v₁} C := by apply Groupoid.ofIsIso diff --git a/Mathlib/CategoryTheory/FiberedCategory/HasFibers.lean b/Mathlib/CategoryTheory/FiberedCategory/HasFibers.lean index 95ce828c874d32..b34089098f958a 100644 --- a/Mathlib/CategoryTheory/FiberedCategory/HasFibers.lean +++ b/Mathlib/CategoryTheory/FiberedCategory/HasFibers.lean @@ -78,6 +78,7 @@ class HasFibers (p : 𝒳 ⥤ 𝒮) where namespace HasFibers /-- The `HasFibers` on `p : 𝒳 ⥤ 𝒮` given by the fibers of `p` -/ +@[implicit_reducible] def canonical (p : 𝒳 ⥤ 𝒮) : HasFibers p where Fib := Fiber p ι S := fiberInclusion diff --git a/Mathlib/CategoryTheory/Functor/Functorial.lean b/Mathlib/CategoryTheory/Functor/Functorial.lean index cf4bf44c4c3ae5..0ccf44c8d7bd1d 100644 --- a/Mathlib/CategoryTheory/Functor/Functorial.lean +++ b/Mathlib/CategoryTheory/Functor/Functorial.lean @@ -65,6 +65,7 @@ variable {E : Type u₃} [Category.{v₃} E] -- Will this be a problem? /-- `G ∘ F` is a functorial if both `F` and `G` are. -/ +@[implicit_reducible] def functorial_comp (F : C → D) [Functorial.{v₁, v₂} F] (G : D → E) [Functorial.{v₂, v₃} G] : Functorial.{v₁, v₃} (G ∘ F) := { Functor.of F ⋙ Functor.of G with map := fun f => map G (map F f) } diff --git a/Mathlib/CategoryTheory/Groupoid.lean b/Mathlib/CategoryTheory/Groupoid.lean index 653dde4906c234..6da4fb35aa30fe 100644 --- a/Mathlib/CategoryTheory/Groupoid.lean +++ b/Mathlib/CategoryTheory/Groupoid.lean @@ -134,16 +134,19 @@ noncomputable instance {C : Type u} [Groupoid.{v} C] : IsGroupoid C where variable {C : Type u} [Category.{v} C] /-- Promote (noncomputably) an `IsGroupoid` to a `Groupoid` structure. -/ +@[implicit_reducible] noncomputable def Groupoid.ofIsGroupoid [IsGroupoid C] : Groupoid.{v} C where inv := fun f => CategoryTheory.inv f /-- A category where every morphism `IsIso` is a groupoid. -/ +@[implicit_reducible] noncomputable def Groupoid.ofIsIso (all_is_iso : ∀ {X Y : C} (f : X ⟶ Y), IsIso f) : Groupoid.{v} C where inv := fun f => CategoryTheory.inv f /-- A category with a unique morphism between any two objects is a groupoid -/ +@[implicit_reducible] def Groupoid.ofHomUnique (all_unique : ∀ {X Y : C}, Unique (X ⟶ Y)) : Groupoid.{v} C where inv _ := all_unique.default @@ -155,6 +158,7 @@ lemma isGroupoid_of_reflects_iso {C D : Type*} [Category* C] [Category* D] all_isIso _ := isIso_of_reflects_iso _ F /-- A category equipped with a fully faithful functor to a groupoid is fully faithful -/ +@[implicit_reducible] def Groupoid.ofFullyFaithfulToGroupoid {C : Type*} [𝒞 : Category C] {D : Type u} [Groupoid.{v} D] (F : C ⥤ D) (h : F.FullyFaithful) : Groupoid C := { 𝒞 with diff --git a/Mathlib/CategoryTheory/Groupoid/Subgroupoid.lean b/Mathlib/CategoryTheory/Groupoid/Subgroupoid.lean index eaf6a2c0f4e1cf..a50e4ef8887173 100644 --- a/Mathlib/CategoryTheory/Groupoid/Subgroupoid.lean +++ b/Mathlib/CategoryTheory/Groupoid/Subgroupoid.lean @@ -127,6 +127,7 @@ theorem id_mem_of_tgt {c d : C} {f : c ⟶ d} (h : f ∈ S.arrows c d) : 𝟙 d id_mem_of_nonempty_isotropy S d (mem_objs_of_tgt S h) /-- A subgroupoid seen as a quiver on vertex set `C` -/ +@[implicit_reducible] def asWideQuiver : Quiver C := ⟨fun c d => S.arrows c d⟩ diff --git a/Mathlib/CategoryTheory/IsConnected.lean b/Mathlib/CategoryTheory/IsConnected.lean index 2631222327ed30..23a4f6765c89d4 100644 --- a/Mathlib/CategoryTheory/IsConnected.lean +++ b/Mathlib/CategoryTheory/IsConnected.lean @@ -365,6 +365,7 @@ theorem Zigzag.of_inv_inv {j₁ j₂ j₃ : J} (f₂₁ : j₂ ⟶ j₁) (f₃ /-- The setoid given by the equivalence relation `Zigzag`. A quotient for this setoid is a connected component of the category. -/ +@[implicit_reducible] def Zigzag.setoid (J : Type u₂) [Category.{v₁} J] : Setoid J where r := Zigzag iseqv := zigzag_equivalence diff --git a/Mathlib/CategoryTheory/Limits/Constructions/LimitsOfProductsAndEqualizers.lean b/Mathlib/CategoryTheory/Limits/Constructions/LimitsOfProductsAndEqualizers.lean index 30123cee463417..905a1e53757c56 100644 --- a/Mathlib/CategoryTheory/Limits/Constructions/LimitsOfProductsAndEqualizers.lean +++ b/Mathlib/CategoryTheory/Limits/Constructions/LimitsOfProductsAndEqualizers.lean @@ -224,6 +224,7 @@ We additionally require the rather strong condition that the functor reflects is unclear whether the statement remains true without this condition. There are various definitions of "creating limits" in the literature, and whether or not the condition can be dropped seems to depend on the specific definition that is used. -/ +@[implicit_reducible] noncomputable def createsLimitsOfShapeOfCreatesEqualizersAndProducts : CreatesLimitsOfShape J G where CreatesLimit {K} := @@ -244,6 +245,7 @@ We additionally require the rather strong condition that the functor reflects is unclear whether the statement remains true without this condition. There are various definitions of "creating limits" in the literature, and whether or not the condition can be dropped seems to depend on the specific definition that is used. -/ +@[implicit_reducible] noncomputable def createsFiniteLimitsOfCreatesEqualizersAndFiniteProducts [HasEqualizers D] [HasFiniteProducts D] (G : C ⥤ D) [G.ReflectsIsomorphisms] [CreatesLimitsOfShape WalkingParallelPair G] @@ -256,6 +258,7 @@ We additionally require the rather strong condition that the functor reflects is unclear whether the statement remains true without this condition. There are various definitions of "creating limits" in the literature, and whether or not the condition can be dropped seems to depend on the specific definition that is used. -/ +@[implicit_reducible] noncomputable def createsLimitsOfSizeOfCreatesEqualizersAndProducts [HasEqualizers D] [HasProducts.{w} D] (G : C ⥤ D) [G.ReflectsIsomorphisms] [CreatesLimitsOfShape WalkingParallelPair G] [∀ J, CreatesLimitsOfShape (Discrete.{w} J) G] : @@ -289,6 +292,7 @@ We additionally require the rather strong condition that the functor reflects is unclear whether the statement remains true without this condition. There are various definitions of "creating limits" in the literature, and whether or not the condition can be dropped seems to depend on the specific definition that is used. -/ +@[implicit_reducible] noncomputable def createsFiniteLimitsOfCreatesTerminalAndPullbacks [HasTerminal D] [HasPullbacks D] (G : C ⥤ D) [G.ReflectsIsomorphisms] [CreatesLimitsOfShape (Discrete.{0} PEmpty) G] [CreatesLimitsOfShape WalkingCospan G] : @@ -493,6 +497,7 @@ We additionally require the rather strong condition that the functor reflects is unclear whether the statement remains true without this condition. There are various definitions of "creating colimits" in the literature, and whether or not the condition can be dropped seems to depend on the specific definition that is used. -/ +@[implicit_reducible] noncomputable def createsColimitsOfShapeOfCreatesCoequalizersAndCoproducts : CreatesColimitsOfShape J G where CreatesColimit {K} := @@ -513,6 +518,7 @@ We additionally require the rather strong condition that the functor reflects is unclear whether the statement remains true without this condition. There are various definitions of "creating colimits" in the literature, and whether or not the condition can be dropped seems to depend on the specific definition that is used. -/ +@[implicit_reducible] noncomputable def createsFiniteColimitsOfCreatesCoequalizersAndFiniteCoproducts [HasCoequalizers D] [HasFiniteCoproducts D] (G : C ⥤ D) [G.ReflectsIsomorphisms] [CreatesColimitsOfShape WalkingParallelPair G] @@ -525,6 +531,7 @@ We additionally require the rather strong condition that the functor reflects is unclear whether the statement remains true without this condition. There are various definitions of "creating colimits" in the literature, and whether or not the condition can be dropped seems to depend on the specific definition that is used. -/ +@[implicit_reducible] noncomputable def createsColimitsOfSizeOfCreatesCoequalizersAndCoproducts [HasCoequalizers D] [HasCoproducts.{w} D] (G : C ⥤ D) [G.ReflectsIsomorphisms] [CreatesColimitsOfShape WalkingParallelPair G] @@ -560,6 +567,7 @@ We additionally require the rather strong condition that the functor reflects is unclear whether the statement remains true without this condition. There are various definitions of "creating colimits" in the literature, and whether or not the condition can be dropped seems to depend on the specific definition that is used. -/ +@[implicit_reducible] noncomputable def createsFiniteColimitsOfCreatesInitialAndPushouts [HasInitial D] [HasPushouts D] (G : C ⥤ D) [G.ReflectsIsomorphisms] [CreatesColimitsOfShape (Discrete.{0} PEmpty) G] [CreatesColimitsOfShape WalkingSpan G] : diff --git a/Mathlib/CategoryTheory/Limits/Creates.lean b/Mathlib/CategoryTheory/Limits/Creates.lean index ca76f9a0a12c52..704190cec47113 100644 --- a/Mathlib/CategoryTheory/Limits/Creates.lean +++ b/Mathlib/CategoryTheory/Limits/Creates.lean @@ -254,6 +254,7 @@ structure LiftsToColimit (K : J ⥤ C) (F : C ⥤ D) (c : Cocone (K ⋙ F)) (t : then `F` creates limits. In particular here we don't need to assume that F reflects limits. -/ +@[implicit_reducible] def createsLimitOfReflectsIso {K : J ⥤ C} {F : C ⥤ D} [F.ReflectsIsomorphisms] (h : ∀ c t, LiftsToLimit K F c t) : CreatesLimit K F where lifts c t := (h c t).toLiftableCone @@ -275,6 +276,7 @@ def createsLimitOfReflectsIso {K : J ⥤ C} {F : C ⥤ D} [F.ReflectsIsomorphism /-- If `F` reflects isomorphisms and we can lift a single limit cone to a limit cone, then `F` creates limits. Note that unlike `createsLimitOfReflectsIso`, to apply this result it is necessary to know that `K ⋙ F` actually has a limit. -/ +@[implicit_reducible] def createsLimitOfReflectsIso' {K : J ⥤ C} {F : C ⥤ D} [F.ReflectsIsomorphisms] {c : Cone (K ⋙ F)} (hc : IsLimit c) (h : LiftsToLimit K F c hc) : CreatesLimit K F := createsLimitOfReflectsIso fun _ t => @@ -284,6 +286,7 @@ def createsLimitOfReflectsIso' {K : J ⥤ C} {F : C ⥤ D} [F.ReflectsIsomorphis /-- If `F` reflects isomorphisms, and we already know that the limit exists in the source and `F` preserves it, then `F` creates that limit. -/ +@[implicit_reducible] def createsLimitOfReflectsIsomorphismsOfPreserves {K : J ⥤ C} {F : C ⥤ D} [F.ReflectsIsomorphisms] [HasLimit K] [PreservesLimit K F] : CreatesLimit K F := createsLimitOfReflectsIso' (isLimitOfPreserves F (limit.isLimit _)) @@ -296,6 +299,7 @@ def createsLimitOfReflectsIsomorphismsOfPreserves {K : J ⥤ C} {F : C ⥤ D} [F When `F` is fully faithful, to show that `F` creates the limit for `K` it suffices to exhibit a lift of a limit cone for `K ⋙ F`. -/ +@[implicit_reducible] def createsLimitOfFullyFaithfulOfLift' {K : J ⥤ C} {F : C ⥤ D} [F.Full] [F.Faithful] {l : Cone (K ⋙ F)} (hl : IsLimit l) (c : Cone K) (i : F.mapCone c ≅ l) : CreatesLimit K F := @@ -307,6 +311,7 @@ def createsLimitOfFullyFaithfulOfLift' {K : J ⥤ C} {F : C ⥤ D} [F.Full] [F.F /-- When `F` is fully faithful, and `HasLimit (K ⋙ F)`, to show that `F` creates the limit for `K` it suffices to exhibit a lift of the chosen limit cone for `K ⋙ F`. -/ +@[implicit_reducible] def createsLimitOfFullyFaithfulOfLift {K : J ⥤ C} {F : C ⥤ D} [F.Full] [F.Faithful] [HasLimit (K ⋙ F)] (c : Cone K) (i : F.mapCone c ≅ limit.cone (K ⋙ F)) : CreatesLimit K F := @@ -320,6 +325,7 @@ set_option backward.isDefEq.respectTransparency false in When `F` is fully faithful, to show that `F` creates the limit for `K` it suffices to show that a limit point is in the essential image of `F`. -/ +@[implicit_reducible] def createsLimitOfFullyFaithfulOfIso' {K : J ⥤ C} {F : C ⥤ D} [F.Full] [F.Faithful] {l : Cone (K ⋙ F)} (hl : IsLimit l) (X : C) (i : F.obj X ≅ l.pt) : CreatesLimit K F := createsLimitOfFullyFaithfulOfLift' hl @@ -337,11 +343,13 @@ def createsLimitOfFullyFaithfulOfIso' {K : J ⥤ C} {F : C ⥤ D} [F.Full] [F.Fa /-- When `F` is fully faithful, and `HasLimit (K ⋙ F)`, to show that `F` creates the limit for `K` it suffices to show that the chosen limit point is in the essential image of `F`. -/ +@[implicit_reducible] def createsLimitOfFullyFaithfulOfIso {K : J ⥤ C} {F : C ⥤ D} [F.Full] [F.Faithful] [HasLimit (K ⋙ F)] (X : C) (i : F.obj X ≅ limit (K ⋙ F)) : CreatesLimit K F := createsLimitOfFullyFaithfulOfIso' (limit.isLimit _) X i /-- A fully faithful functor that preserves a limit that exists also creates the limit. -/ +@[implicit_reducible] def createsLimitOfFullyFaithfulOfPreserves {K : J ⥤ C} {F : C ⥤ D} [F.Full] [F.Faithful] [HasLimit K] [PreservesLimit K F] : CreatesLimit K F := createsLimitOfFullyFaithfulOfLift' (isLimitOfPreserves _ (limit.isLimit K)) _ (Iso.refl _) @@ -369,6 +377,7 @@ instance (priority := 100) preservesLimits_of_createsLimits_and_hasLimits (F : C then `F` creates colimits. In particular here we don't need to assume that F reflects colimits. -/ +@[implicit_reducible] def createsColimitOfReflectsIso {K : J ⥤ C} {F : C ⥤ D} [F.ReflectsIsomorphisms] (h : ∀ c t, LiftsToColimit K F c t) : CreatesColimit K F where lifts c t := (h c t).toLiftableCocone @@ -390,6 +399,7 @@ def createsColimitOfReflectsIso {K : J ⥤ C} {F : C ⥤ D} [F.ReflectsIsomorphi /-- If `F` reflects isomorphisms and we can lift a single colimit cocone to a colimit cocone, then `F` creates limits. Note that unlike `createsColimitOfReflectsIso`, to apply this result it is necessary to know that `K ⋙ F` actually has a colimit. -/ +@[implicit_reducible] def createsColimitOfReflectsIso' {K : J ⥤ C} {F : C ⥤ D} [F.ReflectsIsomorphisms] {c : Cocone (K ⋙ F)} (hc : IsColimit c) (h : LiftsToColimit K F c hc) : CreatesColimit K F := createsColimitOfReflectsIso fun _ t => @@ -399,6 +409,7 @@ def createsColimitOfReflectsIso' {K : J ⥤ C} {F : C ⥤ D} [F.ReflectsIsomorph /-- If `F` reflects isomorphisms, and we already know that the colimit exists in the source and `F` preserves it, then `F` creates that colimit. -/ +@[implicit_reducible] def createsColimitOfReflectsIsomorphismsOfPreserves {K : J ⥤ C} {F : C ⥤ D} [F.ReflectsIsomorphisms] [HasColimit K] [PreservesColimit K F] : CreatesColimit K F := createsColimitOfReflectsIso' (isColimitOfPreserves F (colimit.isColimit _)) @@ -411,6 +422,7 @@ def createsColimitOfReflectsIsomorphismsOfPreserves {K : J ⥤ C} {F : C ⥤ D} When `F` is fully faithful, to show that `F` creates the colimit for `K` it suffices to exhibit a lift of a colimit cocone for `K ⋙ F`. -/ +@[implicit_reducible] def createsColimitOfFullyFaithfulOfLift' {K : J ⥤ C} {F : C ⥤ D} [F.Full] [F.Faithful] {l : Cocone (K ⋙ F)} (hl : IsColimit l) (c : Cocone K) (i : F.mapCocone c ≅ l) : CreatesColimit K F := @@ -423,6 +435,7 @@ def createsColimitOfFullyFaithfulOfLift' {K : J ⥤ C} {F : C ⥤ D} [F.Full] [F When `F` is fully faithful, and `HasColimit (K ⋙ F)`, to show that `F` creates the colimit for `K` it suffices to exhibit a lift of the chosen colimit cocone for `K ⋙ F`. -/ +@[implicit_reducible] def createsColimitOfFullyFaithfulOfLift {K : J ⥤ C} {F : C ⥤ D} [F.Full] [F.Faithful] [HasColimit (K ⋙ F)] (c : Cocone K) (i : F.mapCocone c ≅ colimit.cocone (K ⋙ F)) : CreatesColimit K F := @@ -435,6 +448,7 @@ def createsColimitOfFullyFaithfulOfLift {K : J ⥤ C} {F : C ⥤ D} [F.Full] [F. When `F` is fully faithful, to show that `F` creates the colimit for `K` it suffices to show that a colimit point is in the essential image of `F`. -/ +@[implicit_reducible] def createsColimitOfFullyFaithfulOfIso' {K : J ⥤ C} {F : C ⥤ D} [F.Full] [F.Faithful] {l : Cocone (K ⋙ F)} (hl : IsColimit l) (X : C) (i : F.obj X ≅ l.pt) : CreatesColimit K F := createsColimitOfFullyFaithfulOfLift' hl @@ -453,6 +467,7 @@ def createsColimitOfFullyFaithfulOfIso' {K : J ⥤ C} {F : C ⥤ D} [F.Full] [F. When `F` is fully faithful, and `HasColimit (K ⋙ F)`, to show that `F` creates the colimit for `K` it suffices to show that the chosen colimit point is in the essential image of `F`. -/ +@[implicit_reducible] def createsColimitOfFullyFaithfulOfIso {K : J ⥤ C} {F : C ⥤ D} [F.Full] [F.Faithful] [HasColimit (K ⋙ F)] (X : C) (i : F.obj X ≅ colimit (K ⋙ F)) : CreatesColimit K F := createsColimitOfFullyFaithfulOfIso' (colimit.isColimit _) X i @@ -480,6 +495,7 @@ instance (priority := 100) preservesColimits_of_createsColimits_and_hasColimits PreservesColimitsOfSize.{w, w'} F where /-- Transfer creation of limits along a natural isomorphism in the diagram. -/ +@[implicit_reducible] def createsLimitOfIsoDiagram {K₁ K₂ : J ⥤ C} (F : C ⥤ D) (h : K₁ ≅ K₂) [CreatesLimit K₁ F] : CreatesLimit K₂ F := { reflectsLimit_of_iso_diagram F h with @@ -495,6 +511,7 @@ def createsLimitOfIsoDiagram {K₁ K₂ : J ⥤ C} (F : C ⥤ D) (h : K₁ ≅ K simp } } /-- If `F` creates the limit of `K` and `F ≅ G`, then `G` creates the limit of `K`. -/ +@[implicit_reducible] def createsLimitOfNatIso {F G : C ⥤ D} (h : F ≅ G) [CreatesLimit K F] : CreatesLimit K G where lifts c t := { liftedCone := liftLimit ((IsLimit.postcomposeInvEquiv (isoWhiskerLeft K h :) c).symm t) @@ -505,15 +522,18 @@ def createsLimitOfNatIso {F G : C ⥤ D} (h : F ≅ G) [CreatesLimit K F] : Crea toReflectsLimit := reflectsLimit_of_natIso _ h /-- If `F` creates limits of shape `J` and `F ≅ G`, then `G` creates limits of shape `J`. -/ +@[implicit_reducible] def createsLimitsOfShapeOfNatIso {F G : C ⥤ D} (h : F ≅ G) [CreatesLimitsOfShape J F] : CreatesLimitsOfShape J G where CreatesLimit := createsLimitOfNatIso h /-- If `F` creates limits and `F ≅ G`, then `G` creates limits. -/ +@[implicit_reducible] def createsLimitsOfNatIso {F G : C ⥤ D} (h : F ≅ G) [CreatesLimitsOfSize.{w, w'} F] : CreatesLimitsOfSize.{w, w'} G where CreatesLimitsOfShape := createsLimitsOfShapeOfNatIso h /-- If `F` creates limits of shape `J` and `J ≌ J'`, then `F` creates limits of shape `J'`. -/ +@[implicit_reducible] def createsLimitsOfShapeOfEquiv {J' : Type w₁} [Category.{w'₁} J'] (e : J ≌ J') (F : C ⥤ D) [CreatesLimitsOfShape J F] : CreatesLimitsOfShape J' F where CreatesLimit {K} := @@ -527,6 +547,7 @@ def createsLimitsOfShapeOfEquiv {J' : Type w₁} [Category.{w'₁} J'] (e : J toReflectsLimit := have := reflectsLimitsOfShape_of_equiv e F; inferInstance } /-- Transfer creation of colimits along a natural isomorphism in the diagram. -/ +@[implicit_reducible] def createsColimitOfIsoDiagram {K₁ K₂ : J ⥤ C} (F : C ⥤ D) (h : K₁ ≅ K₂) [CreatesColimit K₁ F] : CreatesColimit K₂ F := { reflectsColimit_of_iso_diagram F h with @@ -543,6 +564,7 @@ def createsColimitOfIsoDiagram {K₁ K₂ : J ⥤ C} (F : C ⥤ D) (h : K₁ ≅ simp } } /-- If `F` creates the colimit of `K` and `F ≅ G`, then `G` creates the colimit of `K`. -/ +@[implicit_reducible] def createsColimitOfNatIso {F G : C ⥤ D} (h : F ≅ G) [CreatesColimit K F] : CreatesColimit K G where lifts c t := { liftedCocone := liftColimit ((IsColimit.precomposeHomEquiv (isoWhiskerLeft K h :) c).symm t) @@ -553,15 +575,18 @@ def createsColimitOfNatIso {F G : C ⥤ D} (h : F ≅ G) [CreatesColimit K F] : toReflectsColimit := reflectsColimit_of_natIso _ h /-- If `F` creates colimits of shape `J` and `F ≅ G`, then `G` creates colimits of shape `J`. -/ +@[implicit_reducible] def createsColimitsOfShapeOfNatIso {F G : C ⥤ D} (h : F ≅ G) [CreatesColimitsOfShape J F] : CreatesColimitsOfShape J G where CreatesColimit := createsColimitOfNatIso h /-- If `F` creates colimits and `F ≅ G`, then `G` creates colimits. -/ +@[implicit_reducible] def createsColimitsOfNatIso {F G : C ⥤ D} (h : F ≅ G) [CreatesColimitsOfSize.{w, w'} F] : CreatesColimitsOfSize.{w, w'} G where CreatesColimitsOfShape := createsColimitsOfShapeOfNatIso h /-- If `F` creates colimits of shape `J` and `J ≌ J'`, then `F` creates colimits of shape `J'`. -/ +@[implicit_reducible] def createsColimitsOfShapeOfEquiv {J' : Type w₁} [Category.{w'₁} J'] (e : J ≌ J') (F : C ⥤ D) [CreatesColimitsOfShape J F] : CreatesColimitsOfShape J' F where CreatesColimit {K} := diff --git a/Mathlib/CategoryTheory/Limits/Final.lean b/Mathlib/CategoryTheory/Limits/Final.lean index c1edde688aabd6..49bacd9c921561 100644 --- a/Mathlib/CategoryTheory/Limits/Final.lean +++ b/Mathlib/CategoryTheory/Limits/Final.lean @@ -410,6 +410,7 @@ theorem reflectsColimit_of_comp {B : Type u₄} [Category.{v₄} B] {H : E ⥤ B exact IsColimit.ofIsoColimit hc' (Cocones.ext (Iso.refl _) (by simp)) /-- If `F` is final and `F ⋙ G` creates colimits of `H`, then so does `G`. -/ +@[implicit_reducible] def createsColimitOfComp {B : Type u₄} [Category.{v₄} B] {H : E ⥤ B} [CreatesColimit (F ⋙ G) H] : CreatesColimit G H where reflects := (reflectsColimit_of_comp F).reflects @@ -436,6 +437,7 @@ theorem reflectsColimitsOfShape_of_final {B : Type u₄} [Category.{v₄} B] (H include F in /-- If `H` creates colimits of shape `C` and `F : C ⥤ D` is final, then `H` creates colimits of shape `D`. -/ +@[implicit_reducible] def createsColimitsOfShapeOfFinal {B : Type u₄} [Category.{v₄} B] (H : E ⥤ B) [CreatesColimitsOfShape C H] : CreatesColimitsOfShape D H where CreatesColimit := createsColimitOfComp F @@ -751,6 +753,7 @@ theorem reflectsLimit_of_comp {B : Type u₄} [Category.{v₄} B] {H : E ⥤ B} exact IsLimit.ofIsoLimit hc' (Cones.ext (Iso.refl _) (by simp)) /-- If `F` is initial and `F ⋙ G` creates limits of `H`, then so does `G`. -/ +@[implicit_reducible] def createsLimitOfComp {B : Type u₄} [Category.{v₄} B] {H : E ⥤ B} [CreatesLimit (F ⋙ G) H] : CreatesLimit G H where reflects := (reflectsLimit_of_comp F).reflects @@ -777,6 +780,7 @@ theorem reflectsLimitsOfShape_of_initial {B : Type u₄} [Category.{v₄} B] (H include F in /-- If `H` creates limits of shape `C` and `F : C ⥤ D` is initial, then `H` creates limits of shape `D`. -/ +@[implicit_reducible] def createsLimitsOfShapeOfInitial {B : Type u₄} [Category.{v₄} B] (H : E ⥤ B) [CreatesLimitsOfShape C H] : CreatesLimitsOfShape D H where CreatesLimit := createsLimitOfComp F diff --git a/Mathlib/CategoryTheory/Limits/FullSubcategory.lean b/Mathlib/CategoryTheory/Limits/FullSubcategory.lean index dddbeeceeba00f..8d1bf11de6ae6f 100644 --- a/Mathlib/CategoryTheory/Limits/FullSubcategory.lean +++ b/Mathlib/CategoryTheory/Limits/FullSubcategory.lean @@ -34,6 +34,7 @@ variable {J : Type w} [Category.{w'} J] {C : Type u} [Category.{v} C] {P : Objec /-- If a `J`-shaped diagram in `FullSubcategory P` has a limit cone in `C` whose cone point lives in the full subcategory, then this defines a limit in the full subcategory. -/ +@[implicit_reducible] def createsLimitFullSubcategoryInclusion' (F : J ⥤ P.FullSubcategory) {c : Cone (F ⋙ P.ι)} (hc : IsLimit c) (h : P c.pt) : CreatesLimit F P.ι := @@ -41,6 +42,7 @@ def createsLimitFullSubcategoryInclusion' (F : J ⥤ P.FullSubcategory) /-- If a `J`-shaped diagram in `FullSubcategory P` has a limit in `C` whose cone point lives in the full subcategory, then this defines a limit in the full subcategory. -/ +@[implicit_reducible] def createsLimitFullSubcategoryInclusion (F : J ⥤ P.FullSubcategory) [HasLimit (F ⋙ P.ι)] (h : P (limit (F ⋙ P.ι))) : CreatesLimit F P.ι := @@ -48,6 +50,7 @@ def createsLimitFullSubcategoryInclusion (F : J ⥤ P.FullSubcategory) /-- If a `J`-shaped diagram in `FullSubcategory P` has a colimit cocone in `C` whose cocone point lives in the full subcategory, then this defines a colimit in the full subcategory. -/ +@[implicit_reducible] def createsColimitFullSubcategoryInclusion' (F : J ⥤ P.FullSubcategory) {c : Cocone (F ⋙ P.ι)} (hc : IsColimit c) (h : P c.pt) : CreatesColimit F P.ι := @@ -55,6 +58,7 @@ def createsColimitFullSubcategoryInclusion' (F : J ⥤ P.FullSubcategory) /-- If a `J`-shaped diagram in `FullSubcategory P` has a colimit in `C` whose cocone point lives in the full subcategory, then this defines a colimit in the full subcategory. -/ +@[implicit_reducible] def createsColimitFullSubcategoryInclusion (F : J ⥤ P.FullSubcategory) [HasColimit (F ⋙ P.ι)] (h : P (colimit (F ⋙ P.ι))) : @@ -64,6 +68,7 @@ def createsColimitFullSubcategoryInclusion (F : J ⥤ P.FullSubcategory) variable (P J) /-- If `P` is closed under limits of shape `J`, then the inclusion creates such limits. -/ +@[implicit_reducible] def createsLimitFullSubcategoryInclusionOfClosed [P.IsClosedUnderLimitsOfShape J] (F : J ⥤ P.FullSubcategory) [HasLimit (F ⋙ P.ι)] : CreatesLimit F P.ι := @@ -85,6 +90,7 @@ instance hasLimitsOfShape_of_closedUnderLimits [P.IsClosedUnderLimitsOfShape J] { has_limit := fun F => hasLimit_of_closedUnderLimits J P F } /-- If `P` is closed under colimits of shape `J`, then the inclusion creates such colimits. -/ +@[implicit_reducible] def createsColimitFullSubcategoryInclusionOfClosed [P.IsClosedUnderColimitsOfShape J] (F : J ⥤ P.FullSubcategory) [HasColimit (F ⋙ P.ι)] : CreatesColimit F P.ι := diff --git a/Mathlib/CategoryTheory/Limits/MorphismProperty.lean b/Mathlib/CategoryTheory/Limits/MorphismProperty.lean index b21bcecd989668..e677848924fa9a 100644 --- a/Mathlib/CategoryTheory/Limits/MorphismProperty.lean +++ b/Mathlib/CategoryTheory/Limits/MorphismProperty.lean @@ -28,6 +28,7 @@ variable (D : J ⥤ P.Comma L R ⊤ ⊤) /-- If `P` is closed under limits of shape `J` in `Comma L R`, then when `D` has a limit in `Comma L R`, the forgetful functor creates this limit. -/ +@[implicit_reducible] noncomputable def forgetCreatesLimitOfClosed [(P.commaObj L R).IsClosedUnderLimitsOfShape J] [HasLimit (D ⋙ forget L R P ⊤ ⊤)] : @@ -39,6 +40,7 @@ noncomputable def forgetCreatesLimitOfClosed /-- If `Comma L R` has limits of shape `J` and `Comma L R` is closed under limits of shape `J`, then `forget L R P ⊤ ⊤` creates limits of shape `J`. -/ +@[implicit_reducible] noncomputable def forgetCreatesLimitsOfShapeOfClosed [HasLimitsOfShape J (Comma L R)] [ObjectProperty.IsClosedUnderLimitsOfShape (P.commaObj L R) J] : CreatesLimitsOfShape J (forget L R P ⊤ ⊤) where @@ -58,6 +60,7 @@ instance hasLimitsOfShape_of_closedUnderLimitsOfShape [HasLimitsOfShape J (Comma /-- If `P` is closed under colimits of shape `J` in `Comma L R`, then when `D` has a colimit in `Comma L R`, the forgetful functor creates this colimit. -/ +@[implicit_reducible] noncomputable def forgetCreatesColimitOfClosed [(P.commaObj L R).IsClosedUnderColimitsOfShape J] [HasColimit (D ⋙ forget L R P ⊤ ⊤)] : @@ -69,6 +72,7 @@ noncomputable def forgetCreatesColimitOfClosed variable (J) in /-- If `Comma L R` has colimits of shape `J` and `Comma L R` is closed under colimits of shape `J`, then `forget L R P ⊤ ⊤` creates colimits of shape `J`. -/ +@[implicit_reducible] noncomputable def forgetCreatesColimitsOfShapeOfClosed [HasColimitsOfShape J (Comma L R)] [(P.commaObj L R).IsClosedUnderColimitsOfShape J] : CreatesColimitsOfShape J (forget L R P ⊤ ⊤) where diff --git a/Mathlib/CategoryTheory/Limits/Preorder.lean b/Mathlib/CategoryTheory/Limits/Preorder.lean index d780dc57c46e4c..d98872dc4a3f7f 100644 --- a/Mathlib/CategoryTheory/Limits/Preorder.lean +++ b/Mathlib/CategoryTheory/Limits/Preorder.lean @@ -104,11 +104,13 @@ section variable [Preorder C] /-- A terminal object in a preorder `C` is top element for `C`. -/ +@[implicit_reducible] def _root_.CategoryTheory.Limits.IsTerminal.orderTop {X : C} (t : IsTerminal X) : OrderTop C where top := X le_top Y := leOfHom (t.from Y) /-- A preorder with a terminal object has a greatest element. -/ +@[implicit_reducible] noncomputable def orderTopOfHasTerminal [HasTerminal C] : OrderTop C := IsTerminal.orderTop terminalIsTerminal @@ -119,11 +121,13 @@ def isTerminalTop [OrderTop C] : IsTerminal (⊤ : C) := IsTerminal.ofUnique _ instance (priority := low) [OrderTop C] : HasTerminal C := hasTerminal_of_unique ⊤ /-- An initial object in a preorder `C` is bottom element for `C`. -/ +@[implicit_reducible] def _root_.CategoryTheory.Limits.IsInitial.orderBot {X : C} (t : IsInitial X) : OrderBot C where bot := X bot_le Y := leOfHom (t.to Y) /-- A preorder with an initial object has a least element. -/ +@[implicit_reducible] noncomputable def orderBotOfHasInitial [HasInitial C] : OrderBot C := IsInitial.orderBot initialIsInitial @@ -142,6 +146,7 @@ variable [PartialOrder C] /-- A family of limiting binary fans on a partial order induces an inf-semilattice structure on it. -/ +@[implicit_reducible] def semilatticeInfOfIsLimitBinaryFan (c : ∀ (X Y : C), BinaryFan X Y) (h : (X Y : C) → IsLimit (c X Y)) : SemilatticeInf C where inf X Y := (c X Y).pt @@ -151,6 +156,7 @@ def semilatticeInfOfIsLimitBinaryFan variable (C) in /-- If a partial order has binary products, then it is an inf-semilattice -/ +@[implicit_reducible] noncomputable def semilatticeInfOfHasBinaryProducts [HasBinaryProducts C] : SemilatticeInf C := semilatticeInfOfIsLimitBinaryFan (fun _ _ ↦ BinaryFan.mk prod.fst prod.snd) (fun X Y ↦ prodIsProd X Y) @@ -158,6 +164,7 @@ noncomputable def semilatticeInfOfHasBinaryProducts [HasBinaryProducts C] : Semi /-- A family of colimiting binary cofans on a partial order induces a sup-semilattice structure on it. -/ +@[implicit_reducible] def semilatticeSupOfIsColimitBinaryCofan (c : ∀ (X Y : C), BinaryCofan X Y) (h : (X Y : C) → IsColimit (c X Y)) : SemilatticeSup C where sup X Y := (c X Y).pt @@ -167,6 +174,7 @@ def semilatticeSupOfIsColimitBinaryCofan variable (C) in /-- If a partial order has binary coproducts, then it is a sup-semilattice -/ +@[implicit_reducible] noncomputable def semilatticeSupOfHasBinaryCoproducts [HasBinaryCoproducts C] : SemilatticeSup C := semilatticeSupOfIsColimitBinaryCofan (fun _ _ ↦ BinaryCofan.mk coprod.inl coprod.inr) (fun X Y ↦ coprodIsCoprod X Y) diff --git a/Mathlib/CategoryTheory/Limits/Preserves/Creates/Finite.lean b/Mathlib/CategoryTheory/Limits/Preserves/Creates/Finite.lean index 23b4d2684f6041..98e5c63fb67bfa 100644 --- a/Mathlib/CategoryTheory/Limits/Preserves/Creates/Finite.lean +++ b/Mathlib/CategoryTheory/Limits/Preserves/Creates/Finite.lean @@ -46,6 +46,7 @@ instance (priority := 100) createsLimitsOfShapeOfCreatesFiniteLimits (F : C ⥤ -- Cannot be an instance because of unbound universe variables. /-- If `F` creates limits of any size, it creates finite limits. -/ +@[implicit_reducible] def CreatesLimitsOfSize.createsFiniteLimits (F : C ⥤ D) [CreatesLimitsOfSize.{w, w'} F] : CreatesFiniteLimits F where createsFiniteLimits J _ _ := createsLimitsOfShapeOfEquiv @@ -61,6 +62,7 @@ instance (priority := 100) CreatesLimits.createsFiniteLimits (F : C ⥤ D) attribute [local instance] uliftCategory in /-- If `F` creates finite limits in any universe, then it creates finite limits. -/ +@[implicit_reducible] def createsFiniteLimitsOfCreatesFiniteLimitsOfSize (F : C ⥤ D) (h : ∀ (J : Type w) {_ : SmallCategory J} (_ : FinCategory J), CreatesLimitsOfShape J F) : CreatesFiniteLimits F where @@ -73,6 +75,7 @@ instance compCreatesFiniteLimits (F : C ⥤ D) (G : D ⥤ E) [CreatesFiniteLimit createsFiniteLimits _ _ _ := compCreatesLimitsOfShape F G /-- Transfer creation of finite limits along a natural isomorphism in the functor. -/ +@[implicit_reducible] def createsFiniteLimitsOfNatIso {F G : C ⥤ D} {h : F ≅ G} [CreatesFiniteLimits F] : CreatesFiniteLimits G where createsFiniteLimits _ _ _ := createsLimitsOfShapeOfNatIso h @@ -108,6 +111,7 @@ instance compCreatesFiniteProducts (F : C ⥤ D) (G : D ⥤ E) [CreatesFinitePro creates _ _ := compCreatesLimitsOfShape _ _ /-- Transfer creation of finite products along a natural isomorphism in the functor. -/ +@[implicit_reducible] def createsFiniteProductsOfNatIso {F G : C ⥤ D} {h : F ≅ G} [CreatesFiniteProducts F] : CreatesFiniteProducts G where creates _ _ := createsLimitsOfShapeOfNatIso h @@ -135,6 +139,7 @@ instance (priority := 100) createsColimitsOfShapeOfCreatesFiniteColimits (F : C -- Cannot be an instance because of unbound universe variables. /-- If `F` creates colimits of any size, it creates finite colimits. -/ +@[implicit_reducible] def CreatesColimitsOfSize.createsFiniteColimits (F : C ⥤ D) [CreatesColimitsOfSize.{w, w'} F] : CreatesFiniteColimits F where createsFiniteColimits J _ _ := createsColimitsOfShapeOfEquiv @@ -150,6 +155,7 @@ instance (priority := 100) CreatesColimits.createsFiniteColimits (F : C ⥤ D) attribute [local instance] uliftCategory in /-- If `F` creates finite colimits in any universe, then it creates finite colimits. -/ +@[implicit_reducible] def createsFiniteColimitsOfCreatesFiniteColimitsOfSize (F : C ⥤ D) (h : ∀ (J : Type w) {_ : SmallCategory J} (_ : FinCategory J), CreatesColimitsOfShape J F) : CreatesFiniteColimits F where @@ -162,6 +168,7 @@ instance compCreatesFiniteColimits (F : C ⥤ D) (G : D ⥤ E) [CreatesFiniteCol createsFiniteColimits _ _ _ := compCreatesColimitsOfShape F G /-- Transfer creation of finite colimits along a natural isomorphism in the functor. -/ +@[implicit_reducible] def createsFiniteColimitsOfNatIso {F G : C ⥤ D} {h : F ≅ G} [CreatesFiniteColimits F] : CreatesFiniteColimits G where createsFiniteColimits _ _ _ := createsColimitsOfShapeOfNatIso h @@ -197,6 +204,7 @@ instance compCreatesFiniteCoproducts (F : C ⥤ D) (G : D ⥤ E) [CreatesFiniteC creates _ _ := compCreatesColimitsOfShape _ _ /-- Transfer creation of finite limits along a natural isomorphism in the functor. -/ +@[implicit_reducible] def createsFiniteCoproductsOfNatIso {F G : C ⥤ D} {h : F ≅ G} [CreatesFiniteCoproducts F] : CreatesFiniteCoproducts G where creates _ _ := createsColimitsOfShapeOfNatIso h diff --git a/Mathlib/CategoryTheory/Limits/Shapes/ConcreteCategory.lean b/Mathlib/CategoryTheory/Limits/Shapes/ConcreteCategory.lean index 8a907fff2af3ab..fb8191039f11b4 100644 --- a/Mathlib/CategoryTheory/Limits/Shapes/ConcreteCategory.lean +++ b/Mathlib/CategoryTheory/Limits/Shapes/ConcreteCategory.lean @@ -99,6 +99,7 @@ variable [ConcreteCategory.{w} C FC] /-- If `forget C` preserves terminals and `X` is terminal, then `ToType X` is a singleton. -/ +@[implicit_reducible] noncomputable def uniqueOfTerminalOfPreserves [PreservesLimit (Functor.empty.{0} C) (forget C)] (X : C) (h : IsTerminal X) : Unique (ToType X) := Types.isTerminalEquivUnique (ToType X) <| IsTerminal.isTerminalObj (forget C) X h diff --git a/Mathlib/CategoryTheory/Limits/Shapes/NormalMono/Basic.lean b/Mathlib/CategoryTheory/Limits/Shapes/NormalMono/Basic.lean index 90181c63952c93..fe428b181e0d33 100644 --- a/Mathlib/CategoryTheory/Limits/Shapes/NormalMono/Basic.lean +++ b/Mathlib/CategoryTheory/Limits/Shapes/NormalMono/Basic.lean @@ -55,6 +55,7 @@ attribute [inherit_doc NormalMono] NormalMono.Z NormalMono.g NormalMono.w Normal section /-- If `F` is an equivalence and `F.map f` is a normal mono, then `f` is a normal mono. -/ +@[implicit_reducible] def equivalenceReflectsNormalMono {D : Type u₂} [Category.{v₁} D] [HasZeroMorphisms D] (F : C ⥤ D) [F.IsEquivalence] {X Y : C} {f : X ⟶ Y} (hf : NormalMono (F.map f)) : NormalMono f where Z := F.objPreimage hf.Z @@ -91,6 +92,7 @@ def NormalMono.lift' {W : C} (f : X ⟶ Y) [hf : NormalMono f] (k : W ⟶ Y) (h See also `pullback.sndOfMono` for the basic monomorphism version, and `normalOfIsPullbackFstOfNormal` for the flipped version. -/ +@[implicit_reducible] def normalOfIsPullbackSndOfNormal {P Q R S : C} {f : P ⟶ Q} {g : P ⟶ R} {h : Q ⟶ S} {k : R ⟶ S} [hn : NormalMono h] (comm : f ≫ h = g ≫ k) (t : IsLimit (PullbackCone.mk _ _ comm)) : NormalMono g where @@ -110,6 +112,7 @@ def normalOfIsPullbackSndOfNormal {P Q R S : C} {f : P ⟶ Q} {g : P ⟶ R} {h : See also `pullback.fstOfMono` for the basic monomorphism version, and `normalOfIsPullbackSndOfNormal` for the flipped version. -/ +@[implicit_reducible] def normalOfIsPullbackFstOfNormal {P Q R S : C} {f : P ⟶ Q} {g : P ⟶ R} {h : Q ⟶ S} {k : R ⟶ S} [NormalMono k] (comm : f ≫ h = g ≫ k) (t : IsLimit (PullbackCone.mk _ _ comm)) : NormalMono f := @@ -117,6 +120,7 @@ def normalOfIsPullbackFstOfNormal {P Q R S : C} {f : P ⟶ Q} {g : P ⟶ R} {h : set_option backward.isDefEq.respectTransparency false in /-- Transport a `NormalMono` structure via an isomorphism of arrows. -/ +@[implicit_reducible] def NormalMono.ofArrowIso {X Y : C} {f : X ⟶ Y} (hf : NormalMono f) {X' Y' : C} {f' : X' ⟶ Y'} (e : Arrow.mk f ≅ Arrow.mk f') : NormalMono f' where @@ -145,6 +149,7 @@ end /-- In a category in which every monomorphism is normal, we can express every monomorphism as a kernel. This is not an instance because it would create an instance loop. -/ +@[implicit_reducible] def normalMonoOfMono [IsNormalMonoCategory C] (f : X ⟶ Y) [Mono f] : NormalMono f := (IsNormalMonoCategory.normalMonoOfMono _).some @@ -172,6 +177,7 @@ attribute [inherit_doc NormalEpi] NormalEpi.W NormalEpi.g NormalEpi.w NormalEpi. section /-- If `F` is an equivalence and `F.map f` is a normal epi, then `f` is a normal epi. -/ +@[implicit_reducible] def equivalenceReflectsNormalEpi {D : Type u₂} [Category.{v₁} D] [HasZeroMorphisms D] (F : C ⥤ D) [F.IsEquivalence] {X Y : C} {f : X ⟶ Y} (hf : NormalEpi (F.map f)) : NormalEpi f where W := F.objPreimage hf.W @@ -205,6 +211,7 @@ def NormalEpi.desc' {W : C} (f : X ⟶ Y) [nef : NormalEpi f] (k : X ⟶ W) (h : See also `pushout.sndOfEpi` for the basic epimorphism version, and `normalOfIsPushoutFstOfNormal` for the flipped version. -/ +@[implicit_reducible] def normalOfIsPushoutSndOfNormal {P Q R S : C} {f : P ⟶ Q} {g : P ⟶ R} {h : Q ⟶ S} {k : R ⟶ S} [gn : NormalEpi g] (comm : f ≫ h = g ≫ k) (t : IsColimit (PushoutCocone.mk _ _ comm)) : NormalEpi h where @@ -224,6 +231,7 @@ def normalOfIsPushoutSndOfNormal {P Q R S : C} {f : P ⟶ Q} {g : P ⟶ R} {h : See also `pushout.fstOfEpi` for the basic epimorphism version, and `normalOfIsPushoutSndOfNormal` for the flipped version. -/ +@[implicit_reducible] def normalOfIsPushoutFstOfNormal {P Q R S : C} {f : P ⟶ Q} {g : P ⟶ R} {h : Q ⟶ S} {k : R ⟶ S} [NormalEpi f] (comm : f ≫ h = g ≫ k) (t : IsColimit (PushoutCocone.mk _ _ comm)) : NormalEpi k := @@ -237,6 +245,7 @@ variable [HasZeroMorphisms C] set_option backward.isDefEq.respectTransparency false in /-- Transport a `NormalEpi` structure via an isomorphism of arrows. -/ +@[implicit_reducible] def NormalEpi.ofArrowIso {X Y : C} {f : X ⟶ Y} (hf : NormalEpi f) {X' Y' : C} {f' : X' ⟶ Y'} (e : Arrow.mk f ≅ Arrow.mk f') : NormalEpi f' where @@ -253,6 +262,7 @@ def NormalEpi.ofArrowIso {X Y : C} {f : X ⟶ Y} /-- A normal mono becomes a normal epi in the opposite category. -/ +@[implicit_reducible] def normalEpiOfNormalMonoUnop {X Y : Cᵒᵖ} (f : X ⟶ Y) (m : NormalMono f.unop) : NormalEpi f where W := op m.Z g := m.g.op @@ -271,6 +281,7 @@ def normalEpiOfNormalMonoUnop {X Y : Cᵒᵖ} (f : X ⟶ Y) (m : NormalMono f.un rintro (⟨⟩ | ⟨⟩) <;> simp) /-- A normal epi becomes a normal mono in the opposite category. -/ +@[implicit_reducible] def normalMonoOfNormalEpiUnop {X Y : Cᵒᵖ} (f : X ⟶ Y) (m : NormalEpi f.unop) : NormalMono f where Z := op m.W g := m.g.op @@ -302,6 +313,7 @@ end /-- In a category in which every epimorphism is normal, we can express every epimorphism as a kernel. This is not an instance because it would create an instance loop. -/ +@[implicit_reducible] def normalEpiOfEpi [IsNormalEpiCategory C] (f : X ⟶ Y) [Epi f] : NormalEpi f := (IsNormalEpiCategory.normalEpiOfEpi _).some diff --git a/Mathlib/CategoryTheory/Limits/Shapes/ZeroMorphisms.lean b/Mathlib/CategoryTheory/Limits/Shapes/ZeroMorphisms.lean index 5e35a2aa24760e..926cf79e622a5e 100644 --- a/Mathlib/CategoryTheory/Limits/Shapes/ZeroMorphisms.lean +++ b/Mathlib/CategoryTheory/Limits/Shapes/ZeroMorphisms.lean @@ -224,6 +224,7 @@ morphisms for some other reason, for example from additivity. Library code that the `HasZeroMorphisms` instances will not be definitionally equal. For this reason library code should generally ask for an instance of `HasZeroMorphisms` separately, even if it already asks for an instance of `HasZeroObject`. -/ +@[implicit_reducible] def IsZero.hasZeroMorphisms {O : C} (hO : IsZero O) : HasZeroMorphisms C where zero X Y := { zero := hO.from_ X ≫ hO.to_ Y } zero_comp X {Y Z} f := by @@ -251,6 +252,7 @@ morphisms for some other reason, for example from additivity. Library code that the `HasZeroMorphisms` instances will not be definitionally equal. For this reason library code should generally ask for an instance of `HasZeroMorphisms` separately, even if it already asks for an instance of `HasZeroObject`. -/ +@[implicit_reducible] def zeroMorphismsOfZeroObject : HasZeroMorphisms C where zero X _ := { zero := (default : X ⟶ 0) ≫ default } zero_comp X {Y Z} f := by diff --git a/Mathlib/CategoryTheory/Localization/Bifunctor.lean b/Mathlib/CategoryTheory/Localization/Bifunctor.lean index 8fe016a034ac62..353cb3077db755 100644 --- a/Mathlib/CategoryTheory/Localization/Bifunctor.lean +++ b/Mathlib/CategoryTheory/Localization/Bifunctor.lean @@ -71,6 +71,7 @@ variable (W₁ : MorphismProperty C₁) (W₂ : MorphismProperty C₂) /-- If `Lifting₂ L₁ L₂ W₁ W₂ F F'` holds, then `Lifting L₂ W₂ (F.obj X₁) (F'.obj (L₁.obj X₁))` holds for any `X₁ : C₁`. -/ +@[implicit_reducible] noncomputable def Lifting₂.fst (X₁ : C₁) : Lifting L₂ W₂ (F.obj X₁) (F'.obj (L₁.obj X₁)) where iso := ((evaluation _ _).obj X₁).mapIso (Lifting₂.iso L₁ L₂ W₁ W₂ F F') @@ -80,6 +81,7 @@ noncomputable instance Lifting₂.flip : Lifting₂ L₂ L₁ W₂ W₁ F.flip F /-- If `Lifting₂ L₁ L₂ W₁ W₂ F F'` holds, then `Lifting L₁ W₁ (F.flip.obj X₂) (F'.flip.obj (L₂.obj X₂))` holds for any `X₂ : C₂`. -/ +@[implicit_reducible] noncomputable def Lifting₂.snd (X₂ : C₂) : Lifting L₁ W₁ (F.flip.obj X₂) (F'.flip.obj (L₂.obj X₂)) := Lifting₂.fst L₂ L₁ W₂ W₁ F.flip F'.flip X₂ diff --git a/Mathlib/CategoryTheory/Localization/CalculusOfFractions/Preadditive.lean b/Mathlib/CategoryTheory/Localization/CalculusOfFractions/Preadditive.lean index ed3f857e9c262c..75e5824a5a84b8 100644 --- a/Mathlib/CategoryTheory/Localization/CalculusOfFractions/Preadditive.lean +++ b/Mathlib/CategoryTheory/Localization/CalculusOfFractions/Preadditive.lean @@ -222,6 +222,7 @@ variable (L X Y) /-- The abelian group structure on `L.obj X ⟶ L.obj Y` when `L : C ⥤ D` is a localization functor, `C` is preadditive and there is a left calculus of fractions. -/ +@[implicit_reducible] noncomputable def addCommGroup' : AddCommGroup (L.obj X ⟶ L.obj Y) := by letI : Zero (L.obj X ⟶ L.obj Y) := ⟨L.map 0⟩ letI : Add (L.obj X ⟶ L.obj Y) := ⟨add' W⟩ @@ -278,6 +279,7 @@ lemma add_eq_add {X'' Y'' : C} (eX' : L.obj X'' ≅ X') (eY' : L.obj Y'' ≅ Y') variable (L X' Y') in /-- The abelian group structure on morphisms in `D`, when `L : C ⥤ D` is a localization functor, `C` is preadditive and there is a left calculus of fractions. -/ +@[implicit_reducible] noncomputable def addCommGroup : AddCommGroup (X' ⟶ Y') := by have := Localization.essSurj L W letI := addCommGroup' L W (L.objPreimage X') (L.objPreimage Y') @@ -304,6 +306,7 @@ variable [W.HasLeftCalculusOfFractions] /-- The preadditive structure on `D`, when `L : C ⥤ D` is a localization functor, `C` is preadditive and there is a left calculus of fractions. -/ +@[implicit_reducible] noncomputable def preadditive : Preadditive D where homGroup := Preadditive.addCommGroup L W add_comp _ _ _ _ _ _ := by apply Preadditive.add_comp diff --git a/Mathlib/CategoryTheory/Localization/HasLocalization.lean b/Mathlib/CategoryTheory/Localization/HasLocalization.lean index 945d3701805ae2..cc5e52d23e5ab5 100644 --- a/Mathlib/CategoryTheory/Localization/HasLocalization.lean +++ b/Mathlib/CategoryTheory/Localization/HasLocalization.lean @@ -75,6 +75,7 @@ def Q' : C ⥤ W.Localization' := HasLocalization.L instance : W.Q'.IsLocalization W := HasLocalization.hL /-- The constructed localized category. -/ +@[implicit_reducible] def HasLocalization.standard : HasLocalization.{max u v} W where L := W.Q diff --git a/Mathlib/CategoryTheory/Localization/Linear.lean b/Mathlib/CategoryTheory/Localization/Linear.lean index 346e9f6a34b873..e8a4cba0b19603 100644 --- a/Mathlib/CategoryTheory/Localization/Linear.lean +++ b/Mathlib/CategoryTheory/Localization/Linear.lean @@ -34,6 +34,7 @@ variable (R : Type w) [Ring R] {C : Type u₁} [Category.{v₁} C] {D : Type u /-- If `L : C ⥤ D` is a localization functor and `C` is `R`-linear, then `D` is `R`-linear if we already know that `D` is preadditive and `L` is additive. -/ +@[implicit_reducible] noncomputable def linear : Linear R D := Linear.ofRingMorphism ((CatCenter.localizationRingHom L W).comp (Linear.toCatCenter R C)) diff --git a/Mathlib/CategoryTheory/Localization/LocallySmall.lean b/Mathlib/CategoryTheory/Localization/LocallySmall.lean index 664419c3a142f3..974c737bf45da2 100644 --- a/Mathlib/CategoryTheory/Localization/LocallySmall.lean +++ b/Mathlib/CategoryTheory/Localization/LocallySmall.lean @@ -33,6 +33,7 @@ variable {C : Type u₁} [Category.{v₁} C] (W : MorphismProperty C) a `HasLocalization.{w} W` instance by shrinking the morphisms in `D`. (This version assumes that the types of objects of the categories `C` and `D` are in the same universe.) -/ +@[implicit_reducible] noncomputable def hasLocalizationOfLocallySmall {D : Type u₁} [Category.{v₂} D] [LocallySmall.{w} D] (L : C ⥤ D) [L.IsLocalization W] : diff --git a/Mathlib/CategoryTheory/Localization/Monoidal/Functor.lean b/Mathlib/CategoryTheory/Localization/Monoidal/Functor.lean index b93bfa0d892814..23031efa82ee12 100644 --- a/Mathlib/CategoryTheory/Localization/Monoidal/Functor.lean +++ b/Mathlib/CategoryTheory/Localization/Monoidal/Functor.lean @@ -126,6 +126,7 @@ noncomputable def functorCoreMonoidalOfComp : F.CoreMonoidal := by Monoidal structure on `F`, given that `F` lifts along `L` to a monoidal functor `G`, where `L` is a monoidal localization functor. -/ +@[implicit_reducible] noncomputable def functorMonoidalOfComp : F.Monoidal := (functorCoreMonoidalOfComp L W F G).toMonoidal diff --git a/Mathlib/CategoryTheory/Localization/Predicate.lean b/Mathlib/CategoryTheory/Localization/Predicate.lean index 00c891db85c457..61e11f360888ce 100644 --- a/Mathlib/CategoryTheory/Localization/Predicate.lean +++ b/Mathlib/CategoryTheory/Localization/Predicate.lean @@ -366,7 +366,7 @@ instance compLeft (F : D ⥤ E) : Localization.Lifting L W (L ⋙ F) F := ⟨Iso /-- Given a localization functor `L : C ⥤ D` for `W : MorphismProperty C`, if `F₁' : D ⥤ E` lifts a functor `F₁ : C ⥤ D`, then a functor `F₂'` which is isomorphic to `F₁'` also lifts a functor `F₂` that is isomorphic to `F₁`. -/ -@[simps] +@[simps, implicit_reducible] def ofIsos {F₁ F₂ : C ⥤ E} {F₁' F₂' : D ⥤ E} (e : F₁ ≅ F₂) (e' : F₁' ≅ F₂') [Lifting L W F₁ F₁'] : Lifting L W F₂ F₂' := ⟨isoWhiskerLeft L e'.symm ≪≫ iso L W F₁ F₁' ≪≫ e⟩ diff --git a/Mathlib/CategoryTheory/Localization/Triangulated.lean b/Mathlib/CategoryTheory/Localization/Triangulated.lean index 41fc2bc566cc4b..f1b2caee53ee57 100644 --- a/Mathlib/CategoryTheory/Localization/Triangulated.lean +++ b/Mathlib/CategoryTheory/Localization/Triangulated.lean @@ -193,6 +193,7 @@ lemma complete_distinguished_triangle_morphism (T₁ T₂ : Triangle D) variable [HasZeroObject D] [Preadditive D] [∀ (n : ℤ), (shiftFunctor D n).Additive] [L.Additive] /-- The pretriangulated structure on the localized category. -/ +@[implicit_reducible] def pretriangulated : Pretriangulated D where distinguishedTriangles := L.essImageDistTriang isomorphic_distinguished _ hT₁ _ e := L.essImageDistTriang_mem_of_iso e hT₁ diff --git a/Mathlib/CategoryTheory/Localization/Trifunctor.lean b/Mathlib/CategoryTheory/Localization/Trifunctor.lean index e1764ab50944db..e778aca55ce319 100644 --- a/Mathlib/CategoryTheory/Localization/Trifunctor.lean +++ b/Mathlib/CategoryTheory/Localization/Trifunctor.lean @@ -172,6 +172,7 @@ variable /-- The construction `bifunctorComp₁₂` of a trifunctor by composition of bifunctors is compatible with localization. -/ +@[implicit_reducible] noncomputable def Lifting₃.bifunctorComp₁₂ : Lifting₃ L₁ L₂ L₃ W₁ W₂ W₃ ((Functor.postcompose₃.obj L).obj (bifunctorComp₁₂ F₁₂ G)) @@ -186,6 +187,7 @@ noncomputable def Lifting₃.bifunctorComp₁₂ : /-- The construction `bifunctorComp₂₃` of a trifunctor by composition of bifunctors is compatible with localization. -/ +@[implicit_reducible] noncomputable def Lifting₃.bifunctorComp₂₃ : Lifting₃ L₁ L₂ L₃ W₁ W₂ W₃ ((Functor.postcompose₃.obj L).obj (bifunctorComp₂₃ F G₂₃)) diff --git a/Mathlib/CategoryTheory/LocallyCartesianClosed/ChosenPullbacksAlong.lean b/Mathlib/CategoryTheory/LocallyCartesianClosed/ChosenPullbacksAlong.lean index fadc3bb2461691..2990cfbd755a5a 100644 --- a/Mathlib/CategoryTheory/LocallyCartesianClosed/ChosenPullbacksAlong.lean +++ b/Mathlib/CategoryTheory/LocallyCartesianClosed/ChosenPullbacksAlong.lean @@ -60,13 +60,14 @@ abbrev ChosenPullbacks := Π {X Y : C} (f : Y ⟶ X), ChosenPullbacksAlong f namespace ChosenPullbacksAlong /-- Relating the existing noncomputable `HasPullbacksAlong` typeclass to `ChosenPullbacksAlong`. -/ -@[simps] +@[simps, implicit_reducible] noncomputable def ofHasPullbacksAlong {Y X : C} (f : Y ⟶ X) [HasPullbacksAlong f] : ChosenPullbacksAlong f where pullback := Over.pullback f mapPullbackAdj := Over.mapPullbackAdj f /-- The identity morphism has a functorial choice of pullbacks. -/ +@[implicit_reducible] def id (X : C) : ChosenPullbacksAlong (𝟙 X) where pullback := 𝟭 _ mapPullbackAdj := (Adjunction.id).ofNatIsoLeft (Over.mapId _).symm @@ -98,7 +99,7 @@ theorem pullbackId_hom_counit (X : C) [ChosenPullbacksAlong (𝟙 X)] : set_option backward.isDefEq.respectTransparency false in /-- Every isomorphism has a functorial choice of pullbacks. -/ -@[simps] +@[simps, implicit_reducible] def iso {Y X : C} (f : Y ≅ X) : ChosenPullbacksAlong f.hom where pullback.obj Z := Over.mk (Z.hom ≫ f.inv) pullback.map {Y Z} g := Over.homMk (g.left) @@ -106,10 +107,11 @@ def iso {Y X : C} (f : Y ≅ X) : ChosenPullbacksAlong f.hom where mapPullbackAdj.counit.app U := Over.homMk (𝟙 _) /-- The inverse of an isomorphism has a functorial choice of pullbacks. -/ -@[simps!] +@[simps!, implicit_reducible] def isoInv {Y X : C} (f : Y ≅ X) : ChosenPullbacksAlong f.inv := iso f.symm /-- The composition of morphisms with chosen pullbacks has a chosen pullback. -/ +@[implicit_reducible] def comp {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z) [ChosenPullbacksAlong f] [ChosenPullbacksAlong g] : ChosenPullbacksAlong (f ≫ g) where pullback := pullback g ⋙ pullback f @@ -152,7 +154,7 @@ def cartesianMonoidalCategoryToUnit [CartesianMonoidalCategory C] {X : C} (f : X set_option backward.isDefEq.respectTransparency false in /-- In cartesian monoidal categories, the first product projections `fst` have a functorial choice of pullbacks. -/ -@[simps] +@[simps, implicit_reducible] def cartesianMonoidalCategoryFst [CartesianMonoidalCategory C] (X Y : C) : ChosenPullbacksAlong (fst X Y : X ⊗ Y ⟶ X) where pullback.obj Z := Over.mk (Z.hom ▷ Y) @@ -163,7 +165,7 @@ def cartesianMonoidalCategoryFst [CartesianMonoidalCategory C] (X Y : C) : set_option backward.isDefEq.respectTransparency false in /-- In cartesian monoidal categories, the second product projections `snd` have a functorial choice of pullbacks. -/ -@[simps] +@[simps, implicit_reducible] def cartesianMonoidalCategorySnd [CartesianMonoidalCategory C] (X Y : C) : ChosenPullbacksAlong (snd X Y : X ⊗ Y ⟶ Y) where pullback.obj Z := Over.mk (X ◁ Z.hom) @@ -329,6 +331,7 @@ theorem isPullback : IsPullback (fst f g) (snd f g) f g where set_option backward.isDefEq.respectTransparency false in attribute [local simp] condition in /-- If `g` has a chosen pullback, then `Over.ChosenPullbacksAlong.fst f g` has a chosen pullback. -/ +@[implicit_reducible] def chosenPullbacksAlongFst : ChosenPullbacksAlong (fst f g) where pullback.obj W := Over.mk (pullbackMap _ _ _ _ W.hom (𝟙 _) (𝟙 _)) pullback.map {W' W} k := Over.homMk (lift (fst _ g ≫ k.left) (snd _ g)) _ diff --git a/Mathlib/CategoryTheory/LocallyCartesianClosed/ExponentiableMorphism.lean b/Mathlib/CategoryTheory/LocallyCartesianClosed/ExponentiableMorphism.lean index bba1179297f966..b6fbe5404661b2 100644 --- a/Mathlib/CategoryTheory/LocallyCartesianClosed/ExponentiableMorphism.lean +++ b/Mathlib/CategoryTheory/LocallyCartesianClosed/ExponentiableMorphism.lean @@ -149,6 +149,7 @@ end section /-- The identity morphisms `𝟙 _` are exponentiable. -/ +@[implicit_reducible] def id (I : C) [ChosenPullbacksAlong (𝟙 I)] : ExponentiableMorphism (𝟙 I) := ⟨𝟭 _, ofNatIsoLeft (F := 𝟭 _) Adjunction.id (pullbackId I).symm⟩ @@ -177,6 +178,7 @@ theorem pushforwardId_hom_counit (I : C) [ChosenPullbacksAlong (𝟙 I)] rw [pushforwardId, Adjunction.rightAdjointUniq_hom_counit] /-- The composition of exponentiable morphisms is exponentiable. -/ +@[implicit_reducible] def comp {I J K : C} (f : I ⟶ J) (g : J ⟶ K) [ChosenPullbacksAlong f] [ChosenPullbacksAlong g] [ChosenPullbacksAlong (f ≫ g)] [ExponentiableMorphism f] [ExponentiableMorphism g] : diff --git a/Mathlib/CategoryTheory/Monad/Comonadicity.lean b/Mathlib/CategoryTheory/Monad/Comonadicity.lean index 7ecd676f03357a..6d05f13d6d28a5 100644 --- a/Mathlib/CategoryTheory/Monad/Comonadicity.lean +++ b/Mathlib/CategoryTheory/Monad/Comonadicity.lean @@ -227,6 +227,7 @@ variable (G) in If `F` is comonadic, it creates limits of `F`-cosplit pairs. This is the "boring" direction of Beck's comonadicity theorem, the converse is given in `comonadicOfCreatesFSplitEqualizers`. -/ +@[implicit_reducible] def createsFSplitEqualizersOfComonadic [ComonadicLeftAdjoint F] ⦃A B⦄ (f g : A ⟶ B) [F.IsCosplitPair f g] : CreatesLimit (parallelPair f g) F := by apply +allowSynthFailures comonadicCreatesLimitOfPreservesLimit @@ -275,6 +276,7 @@ instance [ReflectsLimitOfIsCosplitPair F] : ∀ (A : Coalgebra adj.toComonad), /-- To show `F` is a comonadic left adjoint, we can show it preserves and reflects `F`-split equalizers, and `C` has them. -/ +@[implicit_reducible] def comonadicOfHasPreservesReflectsFSplitEqualizers [HasEqualizerOfIsCosplitPair F] [PreservesLimitOfIsCosplitPair F] [ReflectsLimitOfIsCosplitPair F] : ComonadicLeftAdjoint F where @@ -322,6 +324,7 @@ Beck's comonadicity theorem. If `F` has a right adjoint and creates equalizers o then it is comonadic. This is the converse of `createsFSplitEqualizersOfComonadic`. -/ +@[implicit_reducible] def comonadicOfCreatesFSplitEqualizers [CreatesLimitOfIsCosplitPair F] : ComonadicLeftAdjoint F := by have I {A B} (f g : A ⟶ B) [F.IsCosplitPair f g] : HasLimit (parallelPair f g ⋙ F) := by @@ -335,6 +338,7 @@ def comonadicOfCreatesFSplitEqualizers [CreatesLimitOfIsCosplitPair F] : /-- An alternate version of Beck's comonadicity theorem. If `F` reflects isomorphisms, preserves equalizers of `F`-cosplit pairs and `C` has equalizers of `F`-cosplit pairs, then it is comonadic. -/ +@[implicit_reducible] def comonadicOfHasPreservesFSplitEqualizersOfReflectsIsomorphisms [F.ReflectsIsomorphisms] [HasEqualizerOfIsCosplitPair F] [PreservesLimitOfIsCosplitPair F] : ComonadicLeftAdjoint F := by @@ -368,6 +372,7 @@ set_option backward.isDefEq.respectTransparency false in /-- Coreflexive (crude) comonadicity theorem. If `F` has a right adjoint, `C` has and `F` preserves coreflexive equalizers and `F` reflects isomorphisms, then `F` is comonadic. -/ +@[implicit_reducible] def comonadicOfHasPreservesCoreflexiveEqualizersOfReflectsIsomorphisms : ComonadicLeftAdjoint F where R := G diff --git a/Mathlib/CategoryTheory/Monad/Limits.lean b/Mathlib/CategoryTheory/Monad/Limits.lean index 3c57fff0b2a1b7..5148e3f59caf58 100644 --- a/Mathlib/CategoryTheory/Monad/Limits.lean +++ b/Mathlib/CategoryTheory/Monad/Limits.lean @@ -274,6 +274,7 @@ instance comp_comparison_hasLimit (F : J ⥤ D) (R : D ⥤ C) [MonadicRightAdjoi Monad.hasLimit_of_comp_forget_hasLimit (F ⋙ Monad.comparison (monadicAdjunction R)) /-- Any monadic functor creates limits. -/ +@[implicit_reducible] noncomputable def monadicCreatesLimits (R : D ⥤ C) [MonadicRightAdjoint R] : CreatesLimitsOfSize.{v, u} R := createsLimitsOfNatIso (Monad.comparisonForget (monadicAdjunction R)) @@ -281,6 +282,7 @@ noncomputable def monadicCreatesLimits (R : D ⥤ C) [MonadicRightAdjoint R] : /-- The forgetful functor from the Eilenberg-Moore category for a monad creates any colimit which the monad itself preserves. -/ +@[implicit_reducible] noncomputable def monadicCreatesColimitOfPreservesColimit (R : D ⥤ C) (K : J ⥤ D) [MonadicRightAdjoint R] [PreservesColimit (K ⋙ R) (monadicLeftAdjoint R ⋙ R)] [PreservesColimit ((K ⋙ R) ⋙ monadicLeftAdjoint R ⋙ R) (monadicLeftAdjoint R ⋙ R)] : @@ -309,6 +311,7 @@ noncomputable def monadicCreatesColimitOfPreservesColimit (R : D ⥤ C) (K : J apply createsColimitOfNatIso e /-- A monadic functor creates any colimits of shapes it preserves. -/ +@[implicit_reducible] noncomputable def monadicCreatesColimitsOfShapeOfPreservesColimitsOfShape (R : D ⥤ C) [MonadicRightAdjoint R] [PreservesColimitsOfShape J R] : CreatesColimitsOfShape J R := letI : PreservesColimitsOfShape J (monadicLeftAdjoint R) := by @@ -318,6 +321,7 @@ noncomputable def monadicCreatesColimitsOfShapeOfPreservesColimitsOfShape (R : D ⟨monadicCreatesColimitOfPreservesColimit _ _⟩ /-- A monadic functor creates colimits if it preserves colimits. -/ +@[implicit_reducible] noncomputable def monadicCreatesColimitsOfPreservesColimits (R : D ⥤ C) [MonadicRightAdjoint R] [PreservesColimitsOfSize.{v, u} R] : CreatesColimitsOfSize.{v, u} R where CreatesColimitsOfShape := @@ -601,6 +605,7 @@ instance comp_comparison_hasColimit (F : J ⥤ D) (R : D ⥤ C) [ComonadicLeftAd Comonad.hasColimit_of_comp_forget_hasColimit (F ⋙ Comonad.comparison (comonadicAdjunction R)) /-- Any comonadic functor creates colimits. -/ +@[implicit_reducible] noncomputable def comonadicCreatesColimits (R : D ⥤ C) [ComonadicLeftAdjoint R] : CreatesColimitsOfSize.{v, u} R := createsColimitsOfNatIso (Comonad.comparisonForget (comonadicAdjunction R)) @@ -608,6 +613,7 @@ noncomputable def comonadicCreatesColimits (R : D ⥤ C) [ComonadicLeftAdjoint R /-- The forgetful functor from the Eilenberg-Moore category for a comonad creates any limit which the comonad itself preserves. -/ +@[implicit_reducible] noncomputable def comonadicCreatesLimitOfPreservesLimit (R : D ⥤ C) (K : J ⥤ D) [ComonadicLeftAdjoint R] [PreservesLimit (K ⋙ R) (comonadicRightAdjoint R ⋙ R)] [PreservesLimit ((K ⋙ R) ⋙ comonadicRightAdjoint R ⋙ R) (comonadicRightAdjoint R ⋙ R)] : @@ -634,6 +640,7 @@ noncomputable def comonadicCreatesLimitOfPreservesLimit (R : D ⥤ C) (K : J ⥤ apply createsLimitOfNatIso e /-- A comonadic functor creates any limits of shapes it preserves. -/ +@[implicit_reducible] noncomputable def comonadicCreatesLimitsOfShapeOfPreservesLimitsOfShape (R : D ⥤ C) [ComonadicLeftAdjoint R] [PreservesLimitsOfShape J R] : CreatesLimitsOfShape J R := letI : PreservesLimitsOfShape J (comonadicRightAdjoint R) := by @@ -643,6 +650,7 @@ noncomputable def comonadicCreatesLimitsOfShapeOfPreservesLimitsOfShape (R : D ⟨comonadicCreatesLimitOfPreservesLimit _ _⟩ /-- A comonadic functor creates limits if it preserves limits. -/ +@[implicit_reducible] noncomputable def comonadicCreatesLimitsOfPreservesLimits (R : D ⥤ C) [ComonadicLeftAdjoint R] [PreservesLimitsOfSize.{v, u} R] : CreatesLimitsOfSize.{v, u} R where CreatesLimitsOfShape := diff --git a/Mathlib/CategoryTheory/Monad/Monadicity.lean b/Mathlib/CategoryTheory/Monad/Monadicity.lean index f696757a14f626..99ee72bac41279 100644 --- a/Mathlib/CategoryTheory/Monad/Monadicity.lean +++ b/Mathlib/CategoryTheory/Monad/Monadicity.lean @@ -233,6 +233,7 @@ variable (G) in If `G` is monadic, it creates colimits of `G`-split pairs. This is the "boring" direction of Beck's monadicity theorem, the converse is given in `monadicOfCreatesGSplitCoequalizers`. -/ +@[implicit_reducible] def createsGSplitCoequalizersOfMonadic [MonadicRightAdjoint G] ⦃A B⦄ (f g : A ⟶ B) [G.IsSplitPair f g] : CreatesColimit (parallelPair f g) G := by apply +allowSynthFailures monadicCreatesColimitOfPreservesColimit @@ -292,6 +293,7 @@ instance [ReflectsColimitOfIsSplitPair G] : ∀ (A : Algebra adj.toMonad), /-- To show `G` is a monadic right adjoint, we can show it preserves and reflects `G`-split coequalizers, and `D` has them. -/ +@[implicit_reducible] def monadicOfHasPreservesReflectsGSplitCoequalizers [HasCoequalizerOfIsSplitPair G] [PreservesColimitOfIsSplitPair G] [ReflectsColimitOfIsSplitPair G] : MonadicRightAdjoint G where @@ -344,6 +346,7 @@ instance [CreatesColimitOfIsSplitPair G] : ∀ (A : Algebra adj.toMonad), pairs, then it is monadic. This is the converse of `createsGSplitCoequalizersOfMonadic`. -/ +@[implicit_reducible] def monadicOfCreatesGSplitCoequalizers [CreatesColimitOfIsSplitPair G] : MonadicRightAdjoint G := by have I {A B} (f g : A ⟶ B) [G.IsSplitPair f g] : HasColimit (parallelPair f g ⋙ G) := by @@ -357,6 +360,7 @@ def monadicOfCreatesGSplitCoequalizers [CreatesColimitOfIsSplitPair G] : /-- An alternate version of **Beck's monadicity theorem**: if `G` reflects isomorphisms, preserves coequalizers of `G`-split pairs and `C` has coequalizers of `G`-split pairs, then it is monadic. -/ +@[implicit_reducible] def monadicOfHasPreservesGSplitCoequalizersOfReflectsIsomorphisms [G.ReflectsIsomorphisms] [HasCoequalizerOfIsSplitPair G] [PreservesColimitOfIsSplitPair G] : MonadicRightAdjoint G := by @@ -391,6 +395,7 @@ variable [PreservesColimitOfIsReflexivePair G] /-- Reflexive (crude) monadicity theorem. If `G` has a right adjoint, `D` has and `G` preserves reflexive coequalizers and `G` reflects isomorphisms, then `G` is monadic. -/ +@[implicit_reducible] def monadicOfHasPreservesReflexiveCoequalizersOfReflectsIsomorphisms : MonadicRightAdjoint G where L := F adj := adj diff --git a/Mathlib/CategoryTheory/Monoidal/Action/End.lean b/Mathlib/CategoryTheory/Monoidal/Action/End.lean index 27d9ef2c18d917..c78b5cce7de094 100644 --- a/Mathlib/CategoryTheory/Monoidal/Action/End.lean +++ b/Mathlib/CategoryTheory/Monoidal/Action/End.lean @@ -94,7 +94,7 @@ variable {C D} set_option backward.isDefEq.respectTransparency false in /-- A monoidal functor `F : C ⥤ (D ⥤ D)ᴹᵒᵖ` can be thought of as a left action of `C` on `D`. -/ -@[simps!] +@[simps!, implicit_reducible] def actionOfMonoidalFunctorToEndofunctorMop (F : C ⥤ (D ⥤ D)ᴹᵒᵖ) [F.Monoidal] : MonoidalLeftAction C D where actionObj c d := (F.obj c).unmop.obj d @@ -183,7 +183,7 @@ instance curriedActionMonoidal [MonoidalRightAction C D] : set_option backward.isDefEq.respectTransparency false in /-- A monoidal functor `F : C ⥤ D ⥤ D` can be thought of as a right action of `C` on `D`. -/ -@[simps!] +@[simps!, implicit_reducible] def actionOfMonoidalFunctorToEndofunctor (F : C ⥤ D ⥤ D) [F.Monoidal] : MonoidalRightAction C D where actionObj d c := (F.obj c).obj d diff --git a/Mathlib/CategoryTheory/Monoidal/Action/Opposites.lean b/Mathlib/CategoryTheory/Monoidal/Action/Opposites.lean index 27624dc6e30af0..2e0f9631fca986 100644 --- a/Mathlib/CategoryTheory/Monoidal/Action/Opposites.lean +++ b/Mathlib/CategoryTheory/Monoidal/Action/Opposites.lean @@ -41,7 +41,7 @@ open MonoidalOpposite /-- Define a left action of `C` on `D` from a right action of `Cᴹᵒᵖ` on `D` via the formula `c ⊙ₗ d := d ⊙ᵣ (mop c)`. -/ -@[simps -isSimp] +@[simps -isSimp, implicit_reducible] def leftActionOfMonoidalOppositeRightAction [MonoidalRightAction Cᴹᵒᵖ D] : MonoidalLeftAction C D where actionObj c d := d ⊙ᵣ mop c @@ -257,7 +257,7 @@ open MonoidalOpposite /-- Define a right action of `C` on `D` from a left action of `Cᴹᵒᵖ` on `D` via the formula `d ⊙ᵣ c := (mop c) ⊙ₗ d`. -/ -@[simps -isSimp] +@[simps -isSimp, implicit_reducible] def rightActionOfMonoidalOppositeLeftAction [MonoidalLeftAction Cᴹᵒᵖ D] : MonoidalRightAction C D where actionObj d c := mop c ⊙ₗ d diff --git a/Mathlib/CategoryTheory/Monoidal/Bimod.lean b/Mathlib/CategoryTheory/Monoidal/Bimod.lean index 214857e25294e0..67cc206e99c17c 100644 --- a/Mathlib/CategoryTheory/Monoidal/Bimod.lean +++ b/Mathlib/CategoryTheory/Monoidal/Bimod.lean @@ -971,6 +971,7 @@ theorem triangle_bimod {X Y Z : Mon C} (M : Bimod X Y) (N : Bimod Y Z) : simp only [Category.assoc] /-- The bicategory of algebras (monoids) and bimodules, all internal to some monoidal category. -/ +@[implicit_reducible] noncomputable def monBicategory : Bicategory (Mon C) where Hom X Y := Bimod X Y homCategory X Y := (inferInstance : Category (Bimod X Y)) diff --git a/Mathlib/CategoryTheory/Monoidal/Braided/Basic.lean b/Mathlib/CategoryTheory/Monoidal/Braided/Basic.lean index 430b305a6ab333..7f3572b1df92fe 100644 --- a/Mathlib/CategoryTheory/Monoidal/Braided/Basic.lean +++ b/Mathlib/CategoryTheory/Monoidal/Braided/Basic.lean @@ -207,6 +207,7 @@ end BraidedCategory Verifying the axioms for a braiding by checking that the candidate braiding is sent to a braiding by a faithful monoidal functor. -/ +@[implicit_reducible] def BraidedCategory.ofFaithful {C D : Type*} [Category* C] [Category* D] [MonoidalCategory C] [MonoidalCategory D] (F : C ⥤ D) [F.Monoidal] [F.Faithful] [BraidedCategory D] (β : ∀ X Y : C, X ⊗ Y ≅ Y ⊗ X) @@ -250,6 +251,7 @@ def BraidedCategory.ofFaithful {C D : Type*} [Category* C] [Category* D] [Monoid braiding_naturality_left_assoc, Functor.LaxMonoidal.associativity_inv, hexagon_reverse_assoc] /-- Pull back a braiding along a fully faithful monoidal functor. -/ +@[implicit_reducible] noncomputable def BraidedCategory.ofFullyFaithful {C D : Type*} [Category* C] [Category* D] [MonoidalCategory C] [MonoidalCategory D] (F : C ⥤ D) [F.Monoidal] [F.Full] [F.Faithful] [BraidedCategory D] : BraidedCategory C := @@ -401,6 +403,7 @@ instance (F : C ⥤ D) (G : D ⥤ E) [F.LaxBraided] [G.LaxBraided] : /-- Given two lax monoidal, monoidally isomorphic functors, if one is lax braided, so is the other. -/ +@[implicit_reducible] def ofNatIso {F G : C ⥤ D} (i : F ≅ G) [F.LaxBraided] [G.LaxMonoidal] [NatTrans.IsMonoidal i.hom] : G.LaxBraided where braided X Y := by @@ -528,12 +531,14 @@ lemma Functor.map_braiding (F : C ⥤ D) (X Y : C) [F.Braided] : /-- A braided category with a faithful braided functor to a symmetric category is itself symmetric. -/ +@[implicit_reducible] def SymmetricCategory.ofFaithful {C D : Type*} [Category* C] [Category* D] [MonoidalCategory C] [MonoidalCategory D] [BraidedCategory C] [SymmetricCategory D] (F : C ⥤ D) [F.Braided] [F.Faithful] : SymmetricCategory C where symmetry X Y := F.map_injective (by simp) /-- Pull back a symmetric braiding along a fully faithful monoidal functor. -/ +@[implicit_reducible] noncomputable def SymmetricCategory.ofFullyFaithful {C D : Type*} [Category* C] [Category* D] [MonoidalCategory C] [MonoidalCategory D] (F : C ⥤ D) [F.Monoidal] [F.Full] [F.Faithful] [SymmetricCategory D] : SymmetricCategory C := diff --git a/Mathlib/CategoryTheory/Monoidal/Braided/Multifunctor.lean b/Mathlib/CategoryTheory/Monoidal/Braided/Multifunctor.lean index 061df9dfab9c3d..eb23027de8d8c1 100644 --- a/Mathlib/CategoryTheory/Monoidal/Braided/Multifunctor.lean +++ b/Mathlib/CategoryTheory/Monoidal/Braided/Multifunctor.lean @@ -221,6 +221,7 @@ Given a braiding `β : curriedTensor C ≅ (curriedTensor C).flip` as a natural bifunctors, and the two equalities `hexagon_forward` and `hexagon_reverse` of natural transformations between trifunctors, we obtain a braided category structure. -/ +@[implicit_reducible] def ofBifunctor : BraidedCategory C where braiding X Y := (β.app X).app Y braiding_naturality_right _ _ _ _ := (β.app _).hom.naturality _ @@ -238,6 +239,7 @@ open BraidedCategory Alternative constructor for symmetric categories, where the symmetry of the braiding is phrased as an equality of natural transformation of bifunctors. -/ +@[implicit_reducible] def SymmetricCategory.ofCurried [BraidedCategory C] (h : (curriedBraidingNatIso C).hom ≫ (flipFunctor _ _ _).map (curriedBraidingNatIso C).hom = 𝟙 _) : diff --git a/Mathlib/CategoryTheory/Monoidal/Braided/Reflection.lean b/Mathlib/CategoryTheory/Monoidal/Braided/Reflection.lean index 1cc16bb84dcfb7..bee7b8fe85abb0 100644 --- a/Mathlib/CategoryTheory/Monoidal/Braided/Reflection.lean +++ b/Mathlib/CategoryTheory/Monoidal/Braided/Reflection.lean @@ -217,6 +217,7 @@ instance (c : C) (d : D) : IsIso (adj.unit.app ((ihom d).obj (R.obj c))) := by set_option backward.isDefEq.respectTransparency false in /-- Auxiliary definition for `monoidalClosed`. -/ +@[implicit_reducible] noncomputable def closed (c : C) : Closed c where rightAdj := R ⋙ (ihom (R.obj c)) ⋙ L adj := by @@ -236,6 +237,7 @@ noncomputable def closed (c : C) : Closed c where Given a reflective functor `R : C ⥤ D` with a monoidal left adjoint, such that `D` is symmetric monoidal closed, then `C` is monoidal closed. -/ +@[implicit_reducible] noncomputable def monoidalClosed : MonoidalClosed C where closed c := closed adj c diff --git a/Mathlib/CategoryTheory/Monoidal/Cartesian/Basic.lean b/Mathlib/CategoryTheory/Monoidal/Cartesian/Basic.lean index 2e69f459d435bd..ce52f087b80a25 100644 --- a/Mathlib/CategoryTheory/Monoidal/Cartesian/Basic.lean +++ b/Mathlib/CategoryTheory/Monoidal/Cartesian/Basic.lean @@ -466,6 +466,7 @@ instance (priority := low) toSymmetricCategory : SymmetricCategory C where /-- `CartesianMonoidalCategory` implies `BraidedCategory`. This is not an instance to prevent diamonds. -/ +@[implicit_reducible] def _root_.CategoryTheory.BraidedCategory.ofCartesianMonoidalCategory : BraidedCategory C where braiding X Y := { hom := lift (snd _ _) (fst _ _), inv := lift (snd _ _) (fst _ _) } diff --git a/Mathlib/CategoryTheory/Monoidal/Cartesian/CommGrp_.lean b/Mathlib/CategoryTheory/Monoidal/Cartesian/CommGrp_.lean index 02fac6fad3b8d7..064fd3fa6532c7 100644 --- a/Mathlib/CategoryTheory/Monoidal/Cartesian/CommGrp_.lean +++ b/Mathlib/CategoryTheory/Monoidal/Cartesian/CommGrp_.lean @@ -32,6 +32,7 @@ class abbrev CommGrpObj := GrpObj X, IsCommMonObj X variable (X) in /-- If `X` represents a presheaf of commutative groups, then `X` is a commutative group object. -/ +@[implicit_reducible] def CommGrpObj.ofRepresentableBy (F : Cᵒᵖ ⥤ CommGrpCat.{w}) (α : (F ⋙ forget _).RepresentableBy X) : CommGrpObj X where __ := GrpObj.ofRepresentableBy X (F ⋙ forget₂ CommGrpCat GrpCat) α diff --git a/Mathlib/CategoryTheory/Monoidal/Cartesian/Grp_.lean b/Mathlib/CategoryTheory/Monoidal/Cartesian/Grp_.lean index b09382f878e71b..888e67fdecbc96 100644 --- a/Mathlib/CategoryTheory/Monoidal/Cartesian/Grp_.lean +++ b/Mathlib/CategoryTheory/Monoidal/Cartesian/Grp_.lean @@ -31,6 +31,7 @@ variable {C : Type u} [Category.{v} C] [CartesianMonoidalCategory C] set_option backward.isDefEq.respectTransparency false in variable (X) in /-- If `X` represents a presheaf of monoids, then `X` is a monoid object. -/ +@[implicit_reducible] def GrpObj.ofRepresentableBy (F : Cᵒᵖ ⥤ GrpCat.{w}) (α : (F ⋙ forget _).RepresentableBy X) : GrpObj X where __ := MonObj.ofRepresentableBy X (F ⋙ forget₂ GrpCat MonCat) α diff --git a/Mathlib/CategoryTheory/Monoidal/Cartesian/Mon_.lean b/Mathlib/CategoryTheory/Monoidal/Cartesian/Mon_.lean index aa43adc428c34e..98b75756943b4a 100644 --- a/Mathlib/CategoryTheory/Monoidal/Cartesian/Mon_.lean +++ b/Mathlib/CategoryTheory/Monoidal/Cartesian/Mon_.lean @@ -125,7 +125,7 @@ end Mon set_option backward.isDefEq.respectTransparency false in variable (X) in /-- If `X` represents a presheaf of monoids, then `X` is a monoid object. -/ -@[simps] +@[simps, implicit_reducible] def MonObj.ofRepresentableBy (F : Cᵒᵖ ⥤ MonCat.{w}) (α : (F ⋙ forget _).RepresentableBy X) : MonObj X where one := α.homEquiv.symm 1 diff --git a/Mathlib/CategoryTheory/Monoidal/Closed/Basic.lean b/Mathlib/CategoryTheory/Monoidal/Closed/Basic.lean index 3c76c078a15baf..a5c9fe046080fc 100644 --- a/Mathlib/CategoryTheory/Monoidal/Closed/Basic.lean +++ b/Mathlib/CategoryTheory/Monoidal/Closed/Basic.lean @@ -53,6 +53,7 @@ variable {C : Type u} [Category.{v} C] [MonoidalCategory.{v} C] This isn't an instance because it's not usually how we want to construct internal homs, we'll usually prove all objects are closed uniformly. -/ +@[implicit_reducible] def tensorClosed {X Y : C} (hX : Closed X) (hY : Closed Y) : Closed (X ⊗ Y) where rightAdj := Closed.rightAdj X ⋙ Closed.rightAdj Y adj := (hY.adj.comp hX.adj).ofNatIsoLeft (MonoidalCategory.tensorLeftTensor X Y).symm @@ -61,6 +62,7 @@ def tensorClosed {X Y : C} (hX : Closed X) (hY : Closed Y) : Closed (X ⊗ Y) wh This isn't an instance because most of the time we'll prove closedness for all objects at once, rather than just for this one. -/ +@[implicit_reducible] def unitClosed : Closed (𝟙_ C) where rightAdj := 𝟭 C adj := Adjunction.id.ofNatIsoLeft (MonoidalCategory.leftUnitorNatIso C).symm @@ -301,6 +303,7 @@ variable (F : C ⥤ D) {G : D ⥤ C} (adj : F ⊣ G) [F.Monoidal] [F.IsEquivalence] [MonoidalClosed D] /-- Transport the property of being monoidal closed across a monoidal equivalence of categories -/ +@[implicit_reducible] noncomputable def ofEquiv : MonoidalClosed C where closed X := { rightAdj := F ⋙ ihom (F.obj X) ⋙ G diff --git a/Mathlib/CategoryTheory/Monoidal/Closed/Cartesian.lean b/Mathlib/CategoryTheory/Monoidal/Closed/Cartesian.lean index 66accaa8ed2e05..5fdd055d657958 100644 --- a/Mathlib/CategoryTheory/Monoidal/Closed/Cartesian.lean +++ b/Mathlib/CategoryTheory/Monoidal/Closed/Cartesian.lean @@ -144,6 +144,7 @@ variable [CartesianMonoidalCategory D] Note we didn't require any coherence between the choice of finite products here, since we transport along the `prodComparison` isomorphism. -/ +@[implicit_reducible] noncomputable def cartesianClosedOfEquiv (e : C ≌ D) [MonoidalClosed C] : MonoidalClosed D := letI : e.inverse.Monoidal := .ofChosenFiniteProducts _ MonoidalClosed.ofEquiv e.inverse e.symm.toAdjunction diff --git a/Mathlib/CategoryTheory/Monoidal/Closed/FunctorCategory/Basic.lean b/Mathlib/CategoryTheory/Monoidal/Closed/FunctorCategory/Basic.lean index 440981feb239de..ece467692ef6c1 100644 --- a/Mathlib/CategoryTheory/Monoidal/Closed/FunctorCategory/Basic.lean +++ b/Mathlib/CategoryTheory/Monoidal/Closed/FunctorCategory/Basic.lean @@ -133,6 +133,7 @@ noncomputable def adj (F : J ⥤ C) : /-- When `C` is monoidal closed and has suitable limits, then for any `F : J ⥤ C`, `tensorLeft F` has a right adjoint. -/ +@[implicit_reducible] noncomputable def closed (F : J ⥤ C) : Closed F where rightAdj := (eHomFunctor _ _).obj ⟨F⟩ adj := adj F diff --git a/Mathlib/CategoryTheory/Monoidal/Closed/FunctorCategory/Complete.lean b/Mathlib/CategoryTheory/Monoidal/Closed/FunctorCategory/Complete.lean index 32cad5de52ed19..31f5754c824cca 100644 --- a/Mathlib/CategoryTheory/Monoidal/Closed/FunctorCategory/Complete.lean +++ b/Mathlib/CategoryTheory/Monoidal/Closed/FunctorCategory/Complete.lean @@ -68,6 +68,7 @@ instance (F : I ⥤ C) : IsLeftAdjoint (tensorLeft (incl I ⋙ F)) := set_option backward.privateInPublic true in set_option backward.privateInPublic.warn false in /-- Auxiliary definition for `functorCategoryMonoidalClosed` -/ +@[implicit_reducible] def functorCategoryClosed (F : I ⥤ C) : Closed F := have := (ihom.adjunction (incl I ⋙ F)).isLeftAdjoint have := isLeftAdjoint_square_lift_comonadic (tensorLeft F) ((whiskeringLeft _ _ C).obj (incl I)) @@ -82,6 +83,7 @@ monoidal closed category. Note: this is defined completely abstractly, and does not have any good definitional properties. See the TODO in the module docstring. -/ +@[implicit_reducible] def functorCategoryMonoidalClosed : MonoidalClosed (I ⥤ C) where closed F := functorCategoryClosed I C F diff --git a/Mathlib/CategoryTheory/Monoidal/Closed/Ideal.lean b/Mathlib/CategoryTheory/Monoidal/Closed/Ideal.lean index 3e3f4b2f0bb3f7..38473f13787dde 100644 --- a/Mathlib/CategoryTheory/Monoidal/Closed/Ideal.lean +++ b/Mathlib/CategoryTheory/Monoidal/Closed/Ideal.lean @@ -199,6 +199,7 @@ takes in an explicit choice of lift of the essential image of `i` to `D`, in the `l : i.EssImageSubcategory ⥤ D` and natural isomorphism `φ : l ⋙ i ≅ i.essImage.ι`. When `l ⋙ i` is defeq to `i.essImage.ι`, images of exponential objects in `D` under `i` will be defeq to the respective exponential objects in `C`. -/ +@[implicit_reducible] def cartesianClosedOfReflective' (l : i.EssImageSubcategory ⥤ D) (φ : l ⋙ i ≅ i.essImage.ι) : MonoidalClosed D where closed := fun B => @@ -224,6 +225,7 @@ Unlike `cartesianClosedOfReflective'` this construction lifts exponential object exponential objects in `D` by applying the reflector to them, even though they already lie in the essential image of `i`; if you need better control over definitional equality, use `cartesianClosedOfReflective'` instead. -/ +@[implicit_reducible] def cartesianClosedOfReflective : MonoidalClosed D := cartesianClosedOfReflective' i (i.essImage.ι ⋙ reflector i) (NatIso.ofComponents (fun X ↦ diff --git a/Mathlib/CategoryTheory/Monoidal/Closed/Types.lean b/Mathlib/CategoryTheory/Monoidal/Closed/Types.lean index 151c82226536f8..f38d2122f5ea67 100644 --- a/Mathlib/CategoryTheory/Monoidal/Closed/Types.lean +++ b/Mathlib/CategoryTheory/Monoidal/Closed/Types.lean @@ -58,6 +58,7 @@ instance {C : Type v₁} [SmallCategory C] : MonoidalClosed (C ⥤ Type v₁) := attribute [local instance] uliftCategory in /-- This is not a good instance because of the universe levels. Below is the instance where the target category is `Type (max u₁ v₁)`. -/ +@[implicit_reducible] def cartesianClosedFunctorToTypes {C : Type u₁} [Category.{v₁} C] : MonoidalClosed (C ⥤ Type (max u₁ v₁ u₂)) := let e : (ULiftHom.{max u₁ v₁ u₂} (ULift.{max u₁ v₁ u₂} C)) ⥤ Type (max u₁ v₁ u₂) ≌ diff --git a/Mathlib/CategoryTheory/Monoidal/Closed/Zero.lean b/Mathlib/CategoryTheory/Monoidal/Closed/Zero.lean index e2170006cee535..360ccf0f4c1fe6 100644 --- a/Mathlib/CategoryTheory/Monoidal/Closed/Zero.lean +++ b/Mathlib/CategoryTheory/Monoidal/Closed/Zero.lean @@ -40,6 +40,7 @@ open scoped CartesianClosed /-- If a Cartesian closed category has an initial object which is isomorphic to the terminal object, then each homset has exactly one element. -/ +@[implicit_reducible] def uniqueHomsetOfInitialIsoUnit [HasInitial C] (i : ⊥_ C ≅ 𝟙_ C) (X Y : C) : Unique (X ⟶ Y) := Equiv.unique <| calc diff --git a/Mathlib/CategoryTheory/Monoidal/DayConvolution.lean b/Mathlib/CategoryTheory/Monoidal/DayConvolution.lean index 72396251bf72e3..e0b3bcd5b4f6e5 100644 --- a/Mathlib/CategoryTheory/Monoidal/DayConvolution.lean +++ b/Mathlib/CategoryTheory/Monoidal/DayConvolution.lean @@ -892,6 +892,7 @@ open DayConvolution DayConvolutionUnit in /-- We can promote a `LawfulDayConvolutionMonoidalCategoryStruct` to a monoidal category, note that every non-prop data is already here, so this is just about showing that they satisfy the axioms of a monoidal category. -/ +@[implicit_reducible] def monoidalOfLawfulDayConvolutionMonoidalCategoryStruct (D : Type u₃) [Category.{v₃} D] [MonoidalCategoryStruct D] @@ -1180,6 +1181,7 @@ lemma ι_map_tensorHom_eq {d₁ d₁' d₂ d₂' : D} (f : d₁ ⟶ d₂) (f' : set_option backward.isDefEq.respectTransparency false in /-- The monoidal category struct constructed in `DayConvolution.mkMonoidalCategoryStruct` extends to a `LawfulDayConvolutionMonoidalCategoryStruct`. -/ +@[implicit_reducible] def mkLawfulDayConvolutionMonoidalCategoryStruct : letI : MonoidalCategoryStruct D := mkMonoidalCategoryStruct C V D LawfulDayConvolutionMonoidalCategoryStruct C V D := @@ -1226,6 +1228,7 @@ variable {C V} in `ι.obj d` and `ι.obj d'` such that the convolution remains in the essential image of `ι`, construct an `InducedLawfulDayConvolutionMonoidalCategoryStructCore` by letting all other data be the generic ones from the `HasPointwiseLeftKanExtension` API. -/ +@[implicit_reducible] noncomputable def ofHasDayConvolutions {D : Type u₃} [Category.{v₃} D] (ι : D ⥤ C ⥤ V) @@ -1304,6 +1307,7 @@ variable {C V} of relevant colimits by the tensor product of `V`, we can define a `MonoidalCategory D` from the data of a fully faithful functor `ι : D ⥤ C ⥤ V` whose essential image contains a Day convolution unit and is stable under binary Day convolutions. -/ +@[implicit_reducible] noncomputable def monoidalOfHasDayConvolutions : MonoidalCategory D := letI induced : InducedLawfulDayConvolutionMonoidalCategoryStructCore C V D := .ofHasDayConvolutions ι ffι essImageDayConvolution essImageDayConvolutionUnit @@ -1315,6 +1319,7 @@ noncomputable def monoidalOfHasDayConvolutions : MonoidalCategory D := open InducedLawfulDayConvolutionMonoidalCategoryStructCore in /-- The monoidal category constructed via `monoidalOfHasDayConvolutions` has a canonical `LawfulDayConvolutionMonoidalCategoryStruct C V D`. -/ +@[implicit_reducible] noncomputable def lawfulDayConvolutionMonoidalCategoryStructOfHasDayConvolutions : letI := monoidalOfHasDayConvolutions ι ffι essImageDayConvolution essImageDayConvolutionUnit diff --git a/Mathlib/CategoryTheory/Monoidal/Functor.lean b/Mathlib/CategoryTheory/Monoidal/Functor.lean index a9d7c5ca516a98..5ec981b7a2bee4 100644 --- a/Mathlib/CategoryTheory/Monoidal/Functor.lean +++ b/Mathlib/CategoryTheory/Monoidal/Functor.lean @@ -189,6 +189,7 @@ set_option backward.privateInPublic.warn false in A constructor for lax monoidal functors whose axioms are described by `tensorHom` instead of `whiskerLeft` and `whiskerRight`. -/ +@[implicit_reducible] def ofTensorHom : F.LaxMonoidal where ε := ε μ := μ @@ -615,7 +616,7 @@ attribute [reassoc] left_unitality right_unitality variable {F} (h : F.CoreMonoidal) /-- The lax monoidal functor structure induced by a `Functor.CoreMonoidal` structure. -/ -@[simps -isSimp] +@[simps -isSimp, implicit_reducible] def toLaxMonoidal : F.LaxMonoidal where ε := h.εIso.hom μ X Y := (h.μIso X Y).hom @@ -623,7 +624,7 @@ def toLaxMonoidal : F.LaxMonoidal where right_unitality := h.right_unitality /-- The oplax monoidal functor structure induced by a `Functor.CoreMonoidal` structure. -/ -@[simps -isSimp] +@[simps -isSimp, implicit_reducible] def toOplaxMonoidal : F.OplaxMonoidal where η := h.εIso.inv δ X Y := (h.μIso X Y).inv @@ -646,7 +647,7 @@ def toOplaxMonoidal : F.OplaxMonoidal where attribute [local simp] toLaxMonoidal_ε toLaxMonoidal_μ toOplaxMonoidal_η toOplaxMonoidal_δ in /-- The monoidal functor structure induced by a `Functor.CoreMonoidal` structure. -/ -@[simps! toLaxMonoidal toOplaxMonoidal] +@[simps! toLaxMonoidal toOplaxMonoidal, implicit_reducible] def toMonoidal : F.Monoidal where toLaxMonoidal := h.toLaxMonoidal toOplaxMonoidal := h.toOplaxMonoidal @@ -853,7 +854,7 @@ variable [F.OplaxMonoidal] set_option backward.isDefEq.respectTransparency false in /-- The right adjoint of an oplax monoidal functor is lax monoidal. -/ -@[simps] +@[simps, implicit_reducible] def rightAdjointLaxMonoidal : G.LaxMonoidal where ε := adj.homEquiv _ _ (η F) μ X Y := adj.homEquiv _ _ (δ F _ _ ≫ (adj.counit.app X ⊗ₘ adj.counit.app Y)) @@ -986,6 +987,7 @@ instance [e.functor.Monoidal] : e.symm.inverse.Monoidal := inferInstanceAs (e.fu set_option backward.isDefEq.respectTransparency false in /-- If a monoidal functor `F` is an equivalence of categories then its inverse is also monoidal. -/ +@[implicit_reducible] noncomputable def inverseMonoidal [e.functor.Monoidal] : e.inverse.Monoidal := by letI := e.toAdjunction.rightAdjointLaxMonoidal have : IsIso (LaxMonoidal.ε e.inverse) := by @@ -1199,6 +1201,7 @@ def coreMonoidalTransport {F G : C ⥤ D} [F.Monoidal] (i : F ≅ G) : G.CoreMon /-- Transport the structure of a monoidal functor along a natural isomorphism of functors. -/ +@[implicit_reducible] def transport {F G : C ⥤ D} [F.Monoidal] (i : F ≅ G) : G.Monoidal := (coreMonoidalTransport i).toMonoidal @@ -1233,6 +1236,7 @@ variable {C D} Given a functor `F` and an equivalence of categories `e` such that `e.inverse` and `e.functor ⋙ F` are monoidal functors, `F` is monoidal as well. -/ +@[implicit_reducible] def monoidalOfPrecompFunctor (e : C ≌ D) (F : D ⥤ E) {F' : C ⥤ E} (i : e.functor ⋙ F ≅ F') [e.inverse.Monoidal] [F'.Monoidal] : F.Monoidal := letI : (e.functor ⋙ F).Monoidal := .transport i.symm @@ -1242,6 +1246,7 @@ def monoidalOfPrecompFunctor (e : C ≌ D) (F : D ⥤ E) {F' : C ⥤ E} (i : e.f Given a functor `F` and an equivalence of categories `e` such that `e.functor` and `e.inverse ⋙ F` are monoidal functors, `F` is monoidal as well. -/ +@[implicit_reducible] def monoidalOfPrecompInverse (e : C ≌ D) (F : C ⥤ E) {F' : D ⥤ E} (i : e.inverse ⋙ F ≅ F') [e.functor.Monoidal] [F'.Monoidal] : F.Monoidal := e.symm.monoidalOfPrecompFunctor F i @@ -1250,6 +1255,7 @@ def monoidalOfPrecompInverse (e : C ≌ D) (F : C ⥤ E) {F' : D ⥤ E} (i : e.i Given a functor `F` and an equivalence of categories `e` such that `e.functor` and `F ⋙ e.inverse` are monoidal functors, `F` is monoidal as well. -/ +@[implicit_reducible] def monoidalOfPostcompInverse (e : C ≌ D) (F : E ⥤ D) {F' : E ⥤ C} (i : F ⋙ e.inverse ≅ F') [e.functor.Monoidal] [F'.Monoidal] : F.Monoidal := .transport (Functor.isoWhiskerRight i.symm e.functor ≪≫ Functor.associator _ _ _ ≪≫ @@ -1259,6 +1265,7 @@ def monoidalOfPostcompInverse (e : C ≌ D) (F : E ⥤ D) {F' : E ⥤ C} (i : F Given a functor `F` and an equivalence of categories `e` such that `e.inverse` and `F ⋙ e.functor` are monoidal functors, `F` is monoidal as well. -/ +@[implicit_reducible] def monoidalOfPostcompFunctor (e : C ≌ D) (F : E ⥤ C) {F' : E ⥤ D} (i : F ⋙ e.functor ≅ F') [e.inverse.Monoidal] [F'.Monoidal] : F.Monoidal := e.symm.monoidalOfPostcompInverse _ i diff --git a/Mathlib/CategoryTheory/Monoidal/Mod_.lean b/Mathlib/CategoryTheory/Monoidal/Mod_.lean index c3213e02e3f781..3b93f031adc042 100644 --- a/Mathlib/CategoryTheory/Monoidal/Mod_.lean +++ b/Mathlib/CategoryTheory/Monoidal/Mod_.lean @@ -219,7 +219,7 @@ open MonoidalLeftAction in /-- When `M` is a `B`-module in `D` and `f : A ⟶ B` is a morphism of internal monoid objects, `M` inherits an `A`-module structure via "restriction of scalars", i.e `γ[A, M] = f.hom ⊵ₗ M ≫ γ[B, M]`. -/ -@[simps!] +@[simps!, implicit_reducible] def scalarRestriction (M : D) [ModObj B M] : ModObj A M where smul := f ⊵ₗ M ≫ γ[B,M] one_smul' := by diff --git a/Mathlib/CategoryTheory/Monoidal/Mon_.lean b/Mathlib/CategoryTheory/Monoidal/Mon_.lean index b3363ec524ea6a..83bb843d016c66 100644 --- a/Mathlib/CategoryTheory/Monoidal/Mon_.lean +++ b/Mathlib/CategoryTheory/Monoidal/Mon_.lean @@ -82,7 +82,7 @@ attribute [reassoc (attr := simp)] one_mul mul_one mul_assoc /-- Transfer `MonObj` along an isomorphism. -/ -- Note: The simps lemmas are not tagged simp because their `#discr_tree_simp_key` are too generic. -@[simps! -isSimp] +@[simps! -isSimp, implicit_reducible] def ofIso (e : M ≅ X) : MonObj X where one := η[M] ≫ e.hom mul := (e.inv ⊗ₘ e.inv) ≫ μ[M] ≫ e.hom diff --git a/Mathlib/CategoryTheory/Monoidal/Multifunctor.lean b/Mathlib/CategoryTheory/Monoidal/Multifunctor.lean index 221a809875c432..c117febc42ff2f 100644 --- a/Mathlib/CategoryTheory/Monoidal/Multifunctor.lean +++ b/Mathlib/CategoryTheory/Monoidal/Multifunctor.lean @@ -271,6 +271,7 @@ variable {F : C ⥤ D} `μ : F - ⊗ F - ⟶ F (- ⊗ -)` as a natural transformation between bifunctors, satisfying the relevant compatibilities. -/ +@[implicit_reducible] def ofBifunctor : F.LaxMonoidal where ε := ε μ X Y := (μ.app X).app Y @@ -457,6 +458,7 @@ variable {F : C ⥤ D} `δ : F (- ⊗ -) ⟶ F - ⊗ F -` as a natural transformation between bifunctors, satisfying the relevant compatibilities. -/ +@[implicit_reducible] def ofBifunctor : F.OplaxMonoidal where η := η δ X Y := (δ.app X).app Y @@ -503,6 +505,7 @@ variable {F : C ⥤ D} `μ / δ : F - ⊗ F - ↔ F (- ⊗ -)` as natural transformations between bifunctors, satisfying the relevant compatibilities. -/ +@[implicit_reducible] def ofBifunctor (ε_η : ε ≫ η = 𝟙 _) (η_ε : η ≫ ε = 𝟙 _) (μ_δ : μ ≫ δ = 𝟙 _) (δ_μ : δ ≫ μ = 𝟙 _) : F.Monoidal where toLaxMonoidal := .ofBifunctor ε μ associativity left_unitality right_unitality diff --git a/Mathlib/CategoryTheory/Monoidal/OfHasFiniteProducts.lean b/Mathlib/CategoryTheory/Monoidal/OfHasFiniteProducts.lean index 2f00bcd5452106..bf16eec601baa7 100644 --- a/Mathlib/CategoryTheory/Monoidal/OfHasFiniteProducts.lean +++ b/Mathlib/CategoryTheory/Monoidal/OfHasFiniteProducts.lean @@ -145,7 +145,8 @@ open MonoidalCategory set_option linter.deprecated false in /-- The monoidal structure coming from finite products is symmetric. -/ -@[deprecated CartesianMonoidalCategory.toSymmetricCategory (since := "2025-10-19"), simps!] +@[deprecated CartesianMonoidalCategory.toSymmetricCategory (since := "2025-10-19"), simps!, + implicit_reducible] def symmetricOfHasFiniteProducts [HasTerminal C] [HasBinaryProducts C] : SymmetricCategory C := have : HasFiniteProducts C := hasFiniteProducts_of_has_binary_and_terminal let : CartesianMonoidalCategory C := .ofHasFiniteProducts @@ -246,7 +247,7 @@ open MonoidalCategory set_option backward.isDefEq.respectTransparency false in /-- The monoidal structure coming from finite coproducts is symmetric. -/ -@[simps] +@[simps, implicit_reducible] def symmetricOfHasFiniteCoproducts [HasInitial C] [HasBinaryCoproducts C] : SymmetricCategory C where braiding := Limits.coprod.braiding diff --git a/Mathlib/CategoryTheory/Monoidal/Rigid/Basic.lean b/Mathlib/CategoryTheory/Monoidal/Rigid/Basic.lean index 76a49b5a4de810..f99b0fd913ea54 100644 --- a/Mathlib/CategoryTheory/Monoidal/Rigid/Basic.lean +++ b/Mathlib/CategoryTheory/Monoidal/Rigid/Basic.lean @@ -367,6 +367,7 @@ structure shouldn't come from `HasLeftDual` (e.g. in the category `FinVect k`, i convenient to define the internal hom as `Y →ₗ[k] X` rather than `ᘁY ⊗ X` even though these are naturally isomorphic). -/ +@[implicit_reducible] def closedOfHasLeftDual (Y : C) [HasLeftDual Y] : Closed Y where rightAdj := tensorLeft (ᘁY) adj := tensorLeftAdjunction (ᘁY) Y @@ -480,6 +481,7 @@ theorem rightAdjointMate_comp_evaluation {X Y : C} [HasRightDual X] [HasRightDua simp /-- Transport an exact pairing across an isomorphism in the first argument. -/ +@[implicit_reducible] def exactPairingCongrLeft {X X' Y : C} [ExactPairing X' Y] (i : X ≅ X') : ExactPairing X Y where evaluation' := Y ◁ i.hom ≫ ε_ _ _ coevaluation' := η_ _ _ ≫ i.inv ▷ Y @@ -508,6 +510,7 @@ def exactPairingCongrLeft {X X' Y : C} [ExactPairing X' Y] (i : X ≅ X') : Exac simp /-- Transport an exact pairing across an isomorphism in the second argument. -/ +@[implicit_reducible] def exactPairingCongrRight {X Y Y' : C} [ExactPairing X Y'] (i : Y ≅ Y') : ExactPairing X Y where evaluation' := i.hom ▷ X ≫ ε_ _ _ coevaluation' := η_ _ _ ≫ X ◁ i.inv @@ -536,6 +539,7 @@ def exactPairingCongrRight {X Y Y' : C} [ExactPairing X Y'] (i : Y ≅ Y') : Exa monoidal /-- Transport an exact pairing across isomorphisms. -/ +@[implicit_reducible] def exactPairingCongr {X X' Y Y' : C} [ExactPairing X' Y'] (i : X ≅ X') (j : Y ≅ Y') : ExactPairing X Y := haveI : ExactPairing X' Y := exactPairingCongrRight j @@ -594,6 +598,7 @@ often a more useful definition of the internal hom object than `ᘁY ⊗ X`, in closed structure shouldn't come the rigid structure (e.g. in the category `FinVect k`, it is more convenient to define the internal hom as `Y →ₗ[k] X` rather than `ᘁY ⊗ X` even though these are naturally isomorphic). -/ +@[implicit_reducible] def monoidalClosedOfLeftRigidCategory (C : Type u) [Category.{v} C] [MonoidalCategory.{v} C] [LeftRigidCategory C] : MonoidalClosed C where closed X := closedOfHasLeftDual X diff --git a/Mathlib/CategoryTheory/Monoidal/Rigid/Braided.lean b/Mathlib/CategoryTheory/Monoidal/Rigid/Braided.lean index 48d29d20719032..d59f5f737e0c34 100644 --- a/Mathlib/CategoryTheory/Monoidal/Rigid/Braided.lean +++ b/Mathlib/CategoryTheory/Monoidal/Rigid/Braided.lean @@ -77,6 +77,7 @@ set_option backward.privateInPublic true in set_option backward.privateInPublic.warn false in /-- If `X` and `Y` forms an exact pairing in a braided category, then so does `Y` and `X` by composing the coevaluation and evaluation morphisms with associators. -/ +@[implicit_reducible] def exactPairing_swap (X Y : C) [ExactPairing X Y] : ExactPairing Y X where coevaluation' := η_ X Y ≫ (β_ Y X).inv evaluation' := (β_ X Y).hom ≫ ε_ X Y @@ -84,11 +85,13 @@ def exactPairing_swap (X Y : C) [ExactPairing X Y] : ExactPairing Y X where evaluation_coevaluation' := evaluation_coevaluation_braided' /-- If `X` has a right dual in a braided category, then it has a left dual. -/ +@[implicit_reducible] def hasLeftDualOfHasRightDual [HasRightDual X] : HasLeftDual X where leftDual := Xᘁ exact := exactPairing_swap X Xᘁ /-- If `X` has a left dual in a braided category, then it has a right dual. -/ +@[implicit_reducible] def hasRightDualOfHasLeftDual [HasLeftDual X] : HasRightDual X where rightDual := ᘁX exact := exactPairing_swap ᘁX X diff --git a/Mathlib/CategoryTheory/Monoidal/Rigid/OfEquivalence.lean b/Mathlib/CategoryTheory/Monoidal/Rigid/OfEquivalence.lean index dcf1d58b3321c8..241b5dc065b6e9 100644 --- a/Mathlib/CategoryTheory/Monoidal/Rigid/OfEquivalence.lean +++ b/Mathlib/CategoryTheory/Monoidal/Rigid/OfEquivalence.lean @@ -24,6 +24,7 @@ variable {C D : Type*} [Category* C] [Category* D] [MonoidalCategory C] [Monoida /-- Given candidate data for an exact pairing, which is sent by a faithful monoidal functor to an exact pairing, the equations holds automatically. -/ +@[implicit_reducible] def ExactPairing.ofFaithful [F.Faithful] {X Y : C} (eval : Y ⊗ X ⟶ 𝟙_ C) (coeval : 𝟙_ C ⟶ X ⊗ Y) [ExactPairing (F.obj X) (F.obj Y)] (map_eval : F.map eval = (δ F _ _) ≫ ε_ _ _ ≫ ε F) @@ -42,6 +43,7 @@ def ExactPairing.ofFaithful [F.Faithful] {X Y : C} (eval : Y ⊗ X ⟶ 𝟙_ C) /-- Given a pair of objects which are sent by a fully faithful functor to a pair of objects with an exact pairing, we get an exact pairing. -/ +@[implicit_reducible] noncomputable def ExactPairing.ofFullyFaithful [F.Full] [F.Faithful] (X Y : C) [ExactPairing (F.obj X) (F.obj Y)] : ExactPairing X Y := .ofFaithful F (F.preimage (δ F _ _ ≫ ε_ _ _ ≫ (ε F))) @@ -58,6 +60,7 @@ variable {G : D ⥤ C} (adj : F ⊣ G) [F.IsEquivalence] noncomputable section /-- Pull back a left dual along an equivalence. -/ +@[implicit_reducible] def hasLeftDualOfEquivalence (X : C) [HasLeftDual (F.obj X)] : HasLeftDual X where leftDual := G.obj (ᘁ(F.obj X)) @@ -67,6 +70,7 @@ def hasLeftDualOfEquivalence (X : C) [HasLeftDual (F.obj X)] : apply ExactPairing.ofFullyFaithful F /-- Pull back a right dual along an equivalence. -/ +@[implicit_reducible] def hasRightDualOfEquivalence (X : C) [HasRightDual (F.obj X)] : HasRightDual X where rightDual := G.obj ((F.obj X)ᘁ) @@ -76,14 +80,17 @@ def hasRightDualOfEquivalence (X : C) [HasRightDual (F.obj X)] : apply ExactPairing.ofFullyFaithful F /-- Pull back a left rigid structure along an equivalence. -/ +@[implicit_reducible] def leftRigidCategoryOfEquivalence [LeftRigidCategory D] : LeftRigidCategory C where leftDual X := hasLeftDualOfEquivalence adj X /-- Pull back a right rigid structure along an equivalence. -/ +@[implicit_reducible] def rightRigidCategoryOfEquivalence [RightRigidCategory D] : RightRigidCategory C where rightDual X := hasRightDualOfEquivalence adj X /-- Pull back a rigid structure along an equivalence. -/ +@[implicit_reducible] def rigidCategoryOfEquivalence [RigidCategory D] : RigidCategory C where leftDual X := hasLeftDualOfEquivalence adj X rightDual X := hasRightDualOfEquivalence adj X diff --git a/Mathlib/CategoryTheory/Monoidal/Transport.lean b/Mathlib/CategoryTheory/Monoidal/Transport.lean index bf5f1396432d60..d7813ea4b8e44e 100644 --- a/Mathlib/CategoryTheory/Monoidal/Transport.lean +++ b/Mathlib/CategoryTheory/Monoidal/Transport.lean @@ -79,6 +79,7 @@ where the operations are already defined on the destination type `D`. The functor `F` must preserve all the data parts of the monoidal structure between the two categories. -/ +@[implicit_reducible] def induced [MonoidalCategoryStruct D] (F : D ⥤ C) [F.Faithful] (fData : InducingFunctorData F) : MonoidalCategory.{v₂} D where @@ -132,7 +133,7 @@ instance fromInducedMonoidal [MonoidalCategoryStruct D] (F : D ⥤ C) [F.Faithfu /-- Transport a monoidal structure along an equivalence of (plain) categories. -/ -@[simps -isSimp] +@[simps -isSimp, implicit_reducible] def transportStruct (e : C ≌ D) : MonoidalCategoryStruct.{v₂} D where tensorObj X Y := e.functor.obj (e.inverse.obj X ⊗ e.inverse.obj Y) whiskerLeft X _ _ f := e.functor.map (e.inverse.obj X ◁ e.inverse.map f) @@ -157,6 +158,7 @@ attribute [local simp] transportStruct in set_option backward.isDefEq.respectTransparency false in /-- Transport a monoidal structure along an equivalence of (plain) categories. -/ +@[implicit_reducible] def transport (e : C ≌ D) : MonoidalCategory.{v₂} D := letI : MonoidalCategoryStruct.{v₂} D := transportStruct e induced e.inverse diff --git a/Mathlib/CategoryTheory/Preadditive/Schur.lean b/Mathlib/CategoryTheory/Preadditive/Schur.lean index 6d7234e5811de6..254cf45acf2c65 100644 --- a/Mathlib/CategoryTheory/Preadditive/Schur.lean +++ b/Mathlib/CategoryTheory/Preadditive/Schur.lean @@ -135,6 +135,7 @@ theorem endomorphism_simple_eq_smul_id {X : C} [Simple X] [FiniteDimensional /-- Endomorphisms of a simple object form a field if they are finite dimensional. This can't be an instance as `𝕜` would be undetermined. -/ +@[implicit_reducible] noncomputable def fieldEndOfFiniteDimensional (X : C) [Simple X] [I : FiniteDimensional 𝕜 (X ⟶ X)] : Field (End X) := by classical exact diff --git a/Mathlib/CategoryTheory/Preadditive/Transfer.lean b/Mathlib/CategoryTheory/Preadditive/Transfer.lean index 7c526af6443229..cfaddcf4e6f864 100644 --- a/Mathlib/CategoryTheory/Preadditive/Transfer.lean +++ b/Mathlib/CategoryTheory/Preadditive/Transfer.lean @@ -31,6 +31,7 @@ namespace Preadditive /-- If `D` is a preadditive category, any fully faithful functor `F : C ⥤ D` induces a preadditive structure on `C`. -/ +@[implicit_reducible] def ofFullyFaithful : Preadditive C where homGroup P Q := hF.homEquiv.addCommGroup add_comp P Q R f f' g := hF.map_injective (by simp [Equiv.add_def]) diff --git a/Mathlib/CategoryTheory/Quotient/Linear.lean b/Mathlib/CategoryTheory/Quotient/Linear.lean index ff2a5109427ad4..88ae1392c2785b 100644 --- a/Mathlib/CategoryTheory/Quotient/Linear.lean +++ b/Mathlib/CategoryTheory/Quotient/Linear.lean @@ -33,6 +33,7 @@ variable {R C : Type*} [Semiring R] [Category* C] [Preadditive C] [Linear R C] namespace Linear /-- The scalar multiplications on morphisms in `Quotient R`. -/ +@[implicit_reducible] def smul (hr : ∀ (a : R) ⦃X Y : C⦄ (f₁ f₂ : X ⟶ Y) (_ : r f₁ f₂), r (a • f₁) (a • f₂)) (X Y : Quotient r) : SMul R (X ⟶ Y) where smul a := Quot.lift (fun g => Quot.mk _ (a • g)) (fun f₁ f₂ h₁₂ => by @@ -50,6 +51,7 @@ lemma smul_eq (hr : ∀ (a : R) ⦃X Y : C⦄ (f₁ f₂ : X ⟶ Y) (_ : r f₁ /-- Auxiliary definition for `Quotient.Linear.module`. -/ +@[implicit_reducible] def module' (hr : ∀ (a : R) ⦃X Y : C⦄ (f₁ f₂ : X ⟶ Y) (_ : r f₁ f₂), r (a • f₁) (a • f₂)) [Preadditive (Quotient r)] [(functor r).Additive] (X Y : C) : Module R ((functor r).obj X ⟶ (functor r).obj Y) := @@ -79,6 +81,7 @@ def module' (hr : ∀ (a : R) ⦃X Y : C⦄ (f₁ f₂ : X ⟶ Y) (_ : r f₁ f rw [add_smul, Functor.map_add] } /-- Auxiliary definition for `Quotient.linear`. -/ +@[implicit_reducible] def module (hr : ∀ (a : R) ⦃X Y : C⦄ (f₁ f₂ : X ⟶ Y) (_ : r f₁ f₂), r (a • f₁) (a • f₂)) [Preadditive (Quotient r)] [(functor r).Additive] (X Y : Quotient r) : Module R (X ⟶ Y) := module' r hr X.as Y.as @@ -92,6 +95,7 @@ set_option backward.isDefEq.respectTransparency false in such that `functor r : C ⥤ Quotient r` is additive, and that `C` has an `R`-linear category structure compatible with `r`, this is the induced `R`-linear category structure on `Quotient r`. -/ +@[implicit_reducible] def linear (hr : ∀ (a : R) ⦃X Y : C⦄ (f₁ f₂ : X ⟶ Y) (_ : r f₁ f₂), r (a • f₁) (a • f₂)) [Preadditive (Quotient r)] [(functor r).Additive] : Linear R (Quotient r) := by letI := Linear.module r hr diff --git a/Mathlib/CategoryTheory/Quotient/Preadditive.lean b/Mathlib/CategoryTheory/Quotient/Preadditive.lean index 4c6c7fc0b3bbed..647f39174bec0b 100644 --- a/Mathlib/CategoryTheory/Quotient/Preadditive.lean +++ b/Mathlib/CategoryTheory/Quotient/Preadditive.lean @@ -57,6 +57,7 @@ end Preadditive /-- The preadditive structure on the category `Quotient r` when `r` is compatible with the addition. -/ +@[implicit_reducible] def preadditive (hr : ∀ ⦃X Y : C⦄ (f₁ f₂ g₁ g₂ : X ⟶ Y) (_ : r f₁ f₂) (_ : r g₁ g₂), r (f₁ + g₁) (f₂ + g₂)) : Preadditive (Quotient r) where diff --git a/Mathlib/CategoryTheory/Shift/Adjunction.lean b/Mathlib/CategoryTheory/Shift/Adjunction.lean index d18dce9b6ff4cf..d55bc3351fedd7 100644 --- a/Mathlib/CategoryTheory/Shift/Adjunction.lean +++ b/Mathlib/CategoryTheory/Shift/Adjunction.lean @@ -383,7 +383,7 @@ open RightAdjointCommShift in Given an adjunction `F ⊣ G` and a `CommShift` structure on `F`, this constructs the unique compatible `CommShift` structure on `G`. -/ -@[simps -isSimp] +@[simps -isSimp, implicit_reducible] noncomputable def rightAdjointCommShift [F.CommShift A] : G.CommShift A where commShiftIso a := iso adj a commShiftIso_zero := by @@ -468,7 +468,7 @@ open LeftAdjointCommShift in Given an adjunction `F ⊣ G` and a `CommShift` structure on `G`, this constructs the unique compatible `CommShift` structure on `F`. -/ -@[simps -isSimp] +@[simps -isSimp, implicit_reducible] noncomputable def leftAdjointCommShift [G.CommShift A] : F.CommShift A where commShiftIso a := iso adj a commShiftIso_zero := by @@ -598,6 +598,7 @@ variable (A : Type*) [AddGroup A] [HasShift C A] [HasShift D A] If `E : C ≌ D` is an equivalence and we have a `CommShift` structure on `E.functor`, this constructs the unique compatible `CommShift` structure on `E.inverse`. -/ +@[implicit_reducible] noncomputable def commShiftInverse [E.functor.CommShift A] : E.inverse.CommShift A := E.toAdjunction.rightAdjointCommShift A @@ -611,6 +612,7 @@ lemma commShift_of_functor [E.functor.CommShift A] : If `E : C ≌ D` is an equivalence and we have a `CommShift` structure on `E.inverse`, this constructs the unique compatible `CommShift` structure on `E.functor`. -/ +@[implicit_reducible] noncomputable def commShiftFunctor [E.inverse.CommShift A] : E.functor.CommShift A := E.symm.toAdjunction.rightAdjointCommShift A diff --git a/Mathlib/CategoryTheory/Shift/Basic.lean b/Mathlib/CategoryTheory/Shift/Basic.lean index e447ffbf31bf63..036efdbd74959b 100644 --- a/Mathlib/CategoryTheory/Shift/Basic.lean +++ b/Mathlib/CategoryTheory/Shift/Basic.lean @@ -153,6 +153,7 @@ instance (h : ShiftMkCore C A) : (Discrete.functor h.F).Monoidal := simp [h.add_zero_inv_app] } /-- Constructs a `HasShift C A` instance from `ShiftMkCore`. -/ +@[implicit_reducible] def hasShiftMk (h : ShiftMkCore C A) : HasShift C A where shift := Discrete.functor h.F @@ -756,6 +757,7 @@ set_option backward.isDefEq.respectTransparency false in open hasShift in /-- Given a family of endomorphisms of `C` which are intertwined by a fully faithful `F : C ⥤ D` with shift functors on `D`, we can promote that family to shift functors on `C`. -/ +@[implicit_reducible] def hasShift : HasShift C A := hasShiftMk C A diff --git a/Mathlib/CategoryTheory/Shift/CommShift.lean b/Mathlib/CategoryTheory/Shift/CommShift.lean index 8386688a8ce36f..82e17576cccfb6 100644 --- a/Mathlib/CategoryTheory/Shift/CommShift.lean +++ b/Mathlib/CategoryTheory/Shift/CommShift.lean @@ -465,7 +465,7 @@ variable {C D E : Type*} [Category* C] [Category* D] set_option backward.isDefEq.respectTransparency false in /-- If `e : F ≅ G` is an isomorphism of functors and if `F` commutes with the shift, then `G` also commutes with the shift. -/ -@[simps! -isSimp commShiftIso_hom_app commShiftIso_inv_app] +@[simps! -isSimp commShiftIso_hom_app commShiftIso_inv_app, implicit_reducible] def ofIso : G.CommShift A where commShiftIso a := isoWhiskerLeft _ e.symm ≪≫ F.commShiftIso a ≪≫ isoWhiskerRight e _ commShiftIso_zero := by @@ -506,6 +506,7 @@ set_option backward.isDefEq.respectTransparency false in /-- If `F : C ⥤ D` is a fully faithful functor which is used to construct a shift by `A` on `C` from a shift on `D`, then the functor `F` itself commutes with the shift by `A`. -/ +@[implicit_reducible] def ofHasShiftOfFullyFaithful : letI := hF.hasShift s i; F.CommShift A := by letI := hF.hasShift s i @@ -591,6 +592,7 @@ end OfComp set_option backward.isDefEq.respectTransparency false in /-- Given an isomorphism `e : F ⋙ G ≅ H` where `G` is fully faithful, the functor `F` commutes with shifts by `A` if `G` and `H` do. -/ +@[implicit_reducible] noncomputable def ofComp : F.CommShift A where commShiftIso := OfComp.iso e commShiftIso_zero := by diff --git a/Mathlib/CategoryTheory/Shift/Induced.lean b/Mathlib/CategoryTheory/Shift/Induced.lean index 15f57abe2f3bc2..377c8e9f4eebaf 100644 --- a/Mathlib/CategoryTheory/Shift/Induced.lean +++ b/Mathlib/CategoryTheory/Shift/Induced.lean @@ -94,6 +94,7 @@ variable (A) set_option backward.isDefEq.respectTransparency false in /-- When `F : C ⥤ D` is a functor satisfying suitable technical assumptions, this is the induced term of type `HasShift D A` deduced from `[HasShift C A]`. -/ +@[implicit_reducible] noncomputable def induced : HasShift D A := hasShiftMk D A { F := s @@ -214,6 +215,7 @@ set_option backward.isDefEq.respectTransparency false in /-- When the target category of a functor `F : C ⥤ D` is equipped with the induced shift, this is the compatibility of `F` with the shifts on the categories `C` and `D`. -/ +@[implicit_reducible] noncomputable def Functor.CommShift.ofInduced : letI := HasShift.induced F A s i F.CommShift A := by diff --git a/Mathlib/CategoryTheory/Shift/InducedShiftSequence.lean b/Mathlib/CategoryTheory/Shift/InducedShiftSequence.lean index 6a23b5928e5a1f..4433482b5fb53b 100644 --- a/Mathlib/CategoryTheory/Shift/InducedShiftSequence.lean +++ b/Mathlib/CategoryTheory/Shift/InducedShiftSequence.lean @@ -84,6 +84,7 @@ set_option backward.isDefEq.respectTransparency false in equipped with isomorphisms `e' : ∀ m, L ⋙ F' m ≅ G.shift m`, this is the shift sequence induced on `F` induced by a shift sequence for the functor `G`, provided that the functor `(whiskeringLeft C D A).obj L` of precomposition by `L` is fully faithful. -/ +@[implicit_reducible] noncomputable def induced : F.ShiftSequence M where sequence := F' isoZero := induced.isoZero e M F' e' diff --git a/Mathlib/CategoryTheory/Shift/Localization.lean b/Mathlib/CategoryTheory/Shift/Localization.lean index 7ac09cceef2265..2fd7a37e6fc53e 100644 --- a/Mathlib/CategoryTheory/Shift/Localization.lean +++ b/Mathlib/CategoryTheory/Shift/Localization.lean @@ -76,6 +76,7 @@ variable [W.IsCompatibleWithShift A] /-- When `L : C ⥤ D` is a localization functor with respect to a morphism property `W` that is compatible with the shift by a monoid `A` on `C`, this is the induced shift on the category `D`. -/ +@[implicit_reducible] noncomputable def HasShift.localized : HasShift D A := have := Localization.full_whiskeringLeft L W D have := Localization.faithful_whiskeringLeft L W D @@ -85,7 +86,7 @@ noncomputable def HasShift.localized : HasShift D A := (fun _ => Localization.fac _ _ _) /-- The localization functor `L : C ⥤ D` is compatible with the shift. -/ -@[nolint unusedHavesSuffices] +@[nolint unusedHavesSuffices, implicit_reducible] noncomputable def Functor.CommShift.localized : @Functor.CommShift _ _ _ _ L A _ _ (HasShift.localized L W A) := have := Localization.full_whiskeringLeft L W D @@ -177,6 +178,7 @@ set_option backward.isDefEq.respectTransparency false in /-- In the context of localization of categories, if a functor is induced by a functor which commutes with the shift, then this functor commutes with the shift. -/ +@[implicit_reducible] noncomputable def commShiftOfLocalization : F'.CommShift A where commShiftIso := commShiftOfLocalization.iso L W F F' commShiftIso_zero := by @@ -275,6 +277,7 @@ variable (M) in `e : Φ.functor ⋙ L₂ ≅ L₁ ⋙ G` is an isomorphism, `Φ` is a localizer morphism and `L₁` is a localization functor. We assume that all categories involved are equipped with shifts and that `L₁`, `L₂` and `Φ.functor` commute to them. -/ +@[implicit_reducible] noncomputable def commShift : G.CommShift M := by letI : Localization.Lifting L₁ W₁ (Φ.functor ⋙ L₂) G := ⟨e.symm⟩ exact Functor.commShiftOfLocalization L₁ W₁ M (Φ.functor ⋙ L₂) G diff --git a/Mathlib/CategoryTheory/Shift/Opposite.lean b/Mathlib/CategoryTheory/Shift/Opposite.lean index cb475fc035a7a6..f9f1ac016cefa5 100644 --- a/Mathlib/CategoryTheory/Shift/Opposite.lean +++ b/Mathlib/CategoryTheory/Shift/Opposite.lean @@ -193,7 +193,7 @@ set_option backward.isDefEq.respectTransparency false in Given a `CommShift` structure on `OppositeShift.functor F` (for the naive shifts on the opposite categories), this is the corresponding `CommShift` structure on `F`. -/ -@[simps -isSimp] +@[simps -isSimp, implicit_reducible] def commShiftUnop [CommShift (OppositeShift.functor A F) A] : CommShift F A where commShiftIso a := NatIso.removeOp ((OppositeShift.functor A F).commShiftIso a).symm diff --git a/Mathlib/CategoryTheory/Shift/ShiftSequence.lean b/Mathlib/CategoryTheory/Shift/ShiftSequence.lean index 7541f9c0f3d52a..95110fe29d5c97 100644 --- a/Mathlib/CategoryTheory/Shift/ShiftSequence.lean +++ b/Mathlib/CategoryTheory/Shift/ShiftSequence.lean @@ -57,6 +57,7 @@ class ShiftSequence where isoWhiskerLeft _ (shiftIso n a a' ha') ≪≫ shiftIso m a' a'' ha'' /-- The tautological shift sequence on a functor. -/ +@[implicit_reducible] noncomputable def ShiftSequence.tautological : ShiftSequence F M where sequence n := shiftFunctor C n ⋙ F isoZero := isoWhiskerRight (shiftFunctorZero C M) F ≪≫ F.rightUnitor diff --git a/Mathlib/CategoryTheory/Sites/Limits.lean b/Mathlib/CategoryTheory/Sites/Limits.lean index 816fc97542ebdd..cf613186e71b63 100644 --- a/Mathlib/CategoryTheory/Sites/Limits.lean +++ b/Mathlib/CategoryTheory/Sites/Limits.lean @@ -239,6 +239,7 @@ creates colimits of the diagram. Note: this almost never holds in sheaf categories in general, but it does for the extensive topology (see `Mathlib/CategoryTheory/Sites/Coherent/ExtensiveColimits.lean`). -/ +@[implicit_reducible] def createsColimitOfIsSheaf (F : K ⥤ Sheaf J D) (h : ∀ (c : Cocone (F ⋙ sheafToPresheaf J D)) (_ : IsColimit c), Presheaf.IsSheaf J c.pt) : CreatesColimit F (sheafToPresheaf J D) := diff --git a/Mathlib/CategoryTheory/Sites/Monoidal.lean b/Mathlib/CategoryTheory/Sites/Monoidal.lean index 33316b5501e198..2f7c84550b8f40 100644 --- a/Mathlib/CategoryTheory/Sites/Monoidal.lean +++ b/Mathlib/CategoryTheory/Sites/Monoidal.lean @@ -171,6 +171,7 @@ attribute [local instance] monoidalCategory /-- The monoidal category structure on `Sheaf J A` obtained in `Sheaf.monoidalCategory` is braided when `A` is braided. -/ +@[implicit_reducible] noncomputable def braidedCategory [(J.W (A := A)).IsMonoidal] [HasWeakSheafify J A] [BraidedCategory A] : BraidedCategory (Sheaf J A) := inferInstanceAs (BraidedCategory @@ -178,6 +179,7 @@ noncomputable def braidedCategory [(J.W (A := A)).IsMonoidal] [HasWeakSheafify J /-- The monoidal category structure on `Sheaf J A` obtained in `Sheaf.monoidalCategory` is symmetric when `A` is symmetric. -/ +@[implicit_reducible] noncomputable def symmetricCategory [(J.W (A := A)).IsMonoidal] [HasWeakSheafify J A] [SymmetricCategory A] : SymmetricCategory (Sheaf J A) := diff --git a/Mathlib/CategoryTheory/Thin.lean b/Mathlib/CategoryTheory/Thin.lean index 37c7f6cb44dad9..c177c615528024 100644 --- a/Mathlib/CategoryTheory/Thin.lean +++ b/Mathlib/CategoryTheory/Thin.lean @@ -36,6 +36,7 @@ variable [CategoryStruct.{v₁} C] [Quiver.IsThin C] /-- Construct a category instance from a `CategoryStruct`, using the fact that hom spaces are subsingletons to prove the axioms. -/ +@[implicit_reducible] def thin_category : Category C where end diff --git a/Mathlib/CategoryTheory/Triangulated/TStructure/AbelianSubcategory.lean b/Mathlib/CategoryTheory/Triangulated/TStructure/AbelianSubcategory.lean index 97118bbe2ccdc6..9d9ef45aa4c571 100644 --- a/Mathlib/CategoryTheory/Triangulated/TStructure/AbelianSubcategory.lean +++ b/Mathlib/CategoryTheory/Triangulated/TStructure/AbelianSubcategory.lean @@ -299,6 +299,7 @@ is abelian if the following conditions are satisfied: we complete `ι.obj f₁` in a distinguished triangle `ι.obj X₁ ⟶ ι.obj X₂ ⟶ X₃ ⟶ (ι.obj X₁)⟦1⟧`, there exists objects `K` and `Q`, and a distinguished triangle `(ι.obj K)⟦1⟧ ⟶ X₃ ⟶ (ι.obj Q) ⟶ ...`. -/ +@[implicit_reducible] noncomputable def abelian [IsTriangulated C] : Abelian A := Abelian.mk' (fun X₁ X₂ f₁ ↦ by obtain ⟨X₃, f₂, f₃, hT⟩ := distinguished_cocone_triangle (ι.map f₁) diff --git a/Mathlib/CategoryTheory/Triangulated/TStructure/Heart.lean b/Mathlib/CategoryTheory/Triangulated/TStructure/Heart.lean index 03554b9e9a620d..0c258022806f56 100644 --- a/Mathlib/CategoryTheory/Triangulated/TStructure/Heart.lean +++ b/Mathlib/CategoryTheory/Triangulated/TStructure/Heart.lean @@ -65,6 +65,7 @@ class Heart where /-- Unless a better candidate category is available, the full subcategory of objects satisfying `t.heart` can be chosen as the heart of a t-structure `t`. -/ +@[implicit_reducible] def hasHeartFullSubcategory : t.Heart t.heart.FullSubcategory where ι := t.heart.ι essImage_eq_heart := by diff --git a/Mathlib/Combinatorics/Configuration.lean b/Mathlib/Combinatorics/Configuration.lean index faeb7faf426ff6..8eb4a861d30d4b 100644 --- a/Mathlib/Combinatorics/Configuration.lean +++ b/Mathlib/Combinatorics/Configuration.lean @@ -280,6 +280,7 @@ theorem HasPoints.lineCount_eq_pointCount [HasPoints P L] [Fintype P] [Fintype L /-- If a nondegenerate configuration has a unique line through any two points, and if `|P| = |L|`, then there is a unique point on any two lines. -/ +@[implicit_reducible] noncomputable def HasLines.hasPoints [HasLines P L] [Fintype P] [Fintype L] (h : Fintype.card P = Fintype.card L) : HasPoints P L := let this : ∀ l₁ l₂ : L, l₁ ≠ l₂ → ∃ p : P, p ∈ l₁ ∧ p ∈ l₂ := fun l₁ l₂ hl => by @@ -314,6 +315,7 @@ noncomputable def HasLines.hasPoints [HasLines P L] [Fintype P] [Fintype L] /-- If a nondegenerate configuration has a unique point on any two lines, and if `|P| = |L|`, then there is a unique line through any two points. -/ +@[implicit_reducible] noncomputable def HasPoints.hasLines [HasPoints P L] [Fintype P] [Fintype L] (h : Fintype.card P = Fintype.card L) : HasLines P L := let this := @HasLines.hasPoints (Dual L) (Dual P) _ _ _ _ h.symm diff --git a/Mathlib/Combinatorics/Hindman.lean b/Mathlib/Combinatorics/Hindman.lean index 3bdf775baed38f..aa6b6cccc45e12 100644 --- a/Mathlib/Combinatorics/Hindman.lean +++ b/Mathlib/Combinatorics/Hindman.lean @@ -49,7 +49,7 @@ Ramsey theory, ultrafilter open Filter /-- Multiplication of ultrafilters given by `∀ᶠ m in U*V, p m ↔ ∀ᶠ m in U, ∀ᶠ m' in V, p (m*m')`. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- Addition of ultrafilters given by `∀ᶠ m in U+V, p m ↔ ∀ᶠ m in U, ∀ᶠ m' in V, p (m+m')`. -/] def Ultrafilter.mul {M} [Mul M] : Mul (Ultrafilter M) where mul U V := (· * ·) <$> U <*> V @@ -63,7 +63,7 @@ theorem Ultrafilter.eventually_mul {M} [Mul M] (U V : Ultrafilter M) (p : M → Iff.rfl /-- Semigroup structure on `Ultrafilter M` induced by a semigroup structure on `M`. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- Additive semigroup structure on `Ultrafilter M` induced by an additive semigroup structure on `M`. -/] def Ultrafilter.semigroup {M} [Semigroup M] : Semigroup (Ultrafilter M) := diff --git a/Mathlib/Combinatorics/Quiver/Arborescence.lean b/Mathlib/Combinatorics/Quiver/Arborescence.lean index fdc13f4cd2c6f6..0cf845b9e36aec 100644 --- a/Mathlib/Combinatorics/Quiver/Arborescence.lean +++ b/Mathlib/Combinatorics/Quiver/Arborescence.lean @@ -57,6 +57,7 @@ instance {V : Type u} [Quiver V] [Arborescence V] (b : V) : Unique (Path (root V lower vertex to a higher vertex, - show that every vertex has at most one arrow to it, and - show that every vertex other than `r` has an arrow to it. -/ +@[implicit_reducible] noncomputable def arborescenceMk {V : Type u} [Quiver V] (r : V) (height : V → ℕ) (height_lt : ∀ ⦃a b⦄, (a ⟶ b) → height a < height b) (unique_arrow : ∀ ⦃a b c : V⦄ (e : a ⟶ c) (f : b ⟶ c), a = b ∧ e ≍ f) diff --git a/Mathlib/Combinatorics/Quiver/ConnectedComponent.lean b/Mathlib/Combinatorics/Quiver/ConnectedComponent.lean index bbd2de98a6dd62..487b77e3ca3e42 100644 --- a/Mathlib/Combinatorics/Quiver/ConnectedComponent.lean +++ b/Mathlib/Combinatorics/Quiver/ConnectedComponent.lean @@ -36,6 +36,7 @@ variable (V : Type*) [Quiver.{u} V] /-- Two vertices are related in the zigzag setoid if there is a zigzag of arrows from one to the other. -/ +@[implicit_reducible] def zigzagSetoid : Setoid V := ⟨fun a b ↦ Nonempty (@Path (Symmetrify V) _ a b), fun _ ↦ ⟨Path.nil⟩, fun ⟨p⟩ ↦ ⟨p.reverse⟩, fun ⟨p⟩ ⟨q⟩ ↦ ⟨p.comp q⟩⟩ @@ -114,6 +115,7 @@ lemma IsSStronglyConnected.isStronglyConnected intro i j; obtain ⟨p, _⟩ := h i j; exact ⟨p⟩ /-- Equivalence relation identifying vertices connected by directed paths in both directions. -/ +@[implicit_reducible] def stronglyConnectedSetoid : Setoid V := ⟨fun a b => (Nonempty (Path a b)) ∧ (Nonempty (Path b a)), fun _ => ⟨⟨Path.nil⟩, ⟨Path.nil⟩⟩, fun ⟨hab, hba⟩ => ⟨hba, hab⟩, fun ⟨hab, hba⟩ ⟨hbc, hcb⟩ => diff --git a/Mathlib/Combinatorics/SimpleGraph/CompleteMultipartite.lean b/Mathlib/Combinatorics/SimpleGraph/CompleteMultipartite.lean index f2a4c08e98bdf5..2198e47a1d78c4 100644 --- a/Mathlib/Combinatorics/SimpleGraph/CompleteMultipartite.lean +++ b/Mathlib/Combinatorics/SimpleGraph/CompleteMultipartite.lean @@ -71,6 +71,7 @@ theorem bot_isCompleteMultipartite : (⊥ : SimpleGraph α).IsCompleteMultiparti variable {G : SimpleGraph α} /-- The setoid given by non-adjacency -/ +@[implicit_reducible] def IsCompleteMultipartite.setoid (h : G.IsCompleteMultipartite) : Setoid α := ⟨(¬ G.Adj · ·), ⟨G.loopless.irrefl, fun h' ↦ by rwa [adj_comm] at h', fun h1 h2 ↦ h h1 h2⟩⟩ diff --git a/Mathlib/Combinatorics/SimpleGraph/Connectivity/Connected.lean b/Mathlib/Combinatorics/SimpleGraph/Connectivity/Connected.lean index 7be3860d80c9d0..c49793c6363857 100644 --- a/Mathlib/Combinatorics/SimpleGraph/Connectivity/Connected.lean +++ b/Mathlib/Combinatorics/SimpleGraph/Connectivity/Connected.lean @@ -197,6 +197,7 @@ lemma not_reachable_of_right_degree_zero {G : SimpleGraph V} {u v : V} [Fintype exact not_reachable_of_left_degree_zero huv.symm hu /-- The equivalence relation on vertices given by `SimpleGraph.Reachable`. -/ +@[implicit_reducible] def reachableSetoid : Setoid V := Setoid.mk _ G.reachable_is_equivalence /-- A graph is preconnected if every pair of vertices is reachable from one another. -/ diff --git a/Mathlib/Combinatorics/SimpleGraph/Extremal/Turan.lean b/Mathlib/Combinatorics/SimpleGraph/Extremal/Turan.lean index e7c38a89e1b335..f38f6a64b6ef43 100644 --- a/Mathlib/Combinatorics/SimpleGraph/Extremal/Turan.lean +++ b/Mathlib/Combinatorics/SimpleGraph/Extremal/Turan.lean @@ -165,6 +165,7 @@ theorem equivalence_not_adj : Equivalence (¬G.Adj · ·) where /-- The non-adjacency setoid over the vertices of a Turán-maximal graph induced by `equivalence_not_adj`. -/ +@[implicit_reducible] def setoid : Setoid V := ⟨_, h.equivalence_not_adj⟩ instance : DecidableRel h.setoid.r := diff --git a/Mathlib/Combinatorics/SimpleGraph/Hamiltonian.lean b/Mathlib/Combinatorics/SimpleGraph/Hamiltonian.lean index dcd376c9bcc69a..eef89fa3ea96a0 100644 --- a/Mathlib/Combinatorics/SimpleGraph/Hamiltonian.lean +++ b/Mathlib/Combinatorics/SimpleGraph/Hamiltonian.lean @@ -60,6 +60,7 @@ theorem IsHamiltonian.of_subsingleton [Subsingleton α] : p.IsHamiltonian := by rw [nil_iff_support_eq.mp p.nil_of_subsingleton, Subsingleton.elim v a, List.count_singleton_self] /-- If a path `p` is Hamiltonian then its vertex set must be finite. -/ +@[implicit_reducible] protected def IsHamiltonian.fintype (hp : p.IsHamiltonian) : Fintype α where elems := p.support.toFinset complete x := List.mem_toFinset.mpr (mem_support hp x) diff --git a/Mathlib/Combinatorics/SimpleGraph/Subgraph.lean b/Mathlib/Combinatorics/SimpleGraph/Subgraph.lean index 32c442fc97fb39..94604c5820a218 100644 --- a/Mathlib/Combinatorics/SimpleGraph/Subgraph.lean +++ b/Mathlib/Combinatorics/SimpleGraph/Subgraph.lean @@ -756,6 +756,7 @@ instance finiteAt {G' : Subgraph G} (v : G'.verts) [DecidableRel G'.Adj] /-- If a subgraph is locally finite at a vertex, then so are subgraphs of that subgraph. This is not an instance because `G''` cannot be inferred. -/ +@[implicit_reducible] def finiteAtOfSubgraph {G' G'' : Subgraph G} [DecidableRel G'.Adj] (h : G' ≤ G'') (v : G'.verts) [Fintype (G''.neighborSet v)] : Fintype (G'.neighborSet v) := Set.fintypeSubset (G''.neighborSet v) (neighborSet_subset_of_subgraph h v) diff --git a/Mathlib/Combinatorics/SimpleGraph/Trails.lean b/Mathlib/Combinatorics/SimpleGraph/Trails.lean index 02711395a713b7..6082d7b851a461 100644 --- a/Mathlib/Combinatorics/SimpleGraph/Trails.lean +++ b/Mathlib/Combinatorics/SimpleGraph/Trails.lean @@ -92,6 +92,7 @@ theorem IsEulerian.mem_edges_iff {u v : V} {p : G.Walk u v} (h : p.IsEulerian) { fun he => by simpa [Nat.succ_le_iff] using (h e he).ge⟩ /-- The edge set of an Eulerian graph is finite. -/ +@[implicit_reducible] def IsEulerian.fintypeEdgeSet {u v : V} {p : G.Walk u v} (h : p.IsEulerian) : Fintype G.edgeSet := Fintype.ofFinset h.isTrail.edgesFinset fun e => by diff --git a/Mathlib/Computability/Primrec/Basic.lean b/Mathlib/Computability/Primrec/Basic.lean index 083e8e9802ee30..7d8f756ee875bb 100644 --- a/Mathlib/Computability/Primrec/Basic.lean +++ b/Mathlib/Computability/Primrec/Basic.lean @@ -140,6 +140,7 @@ instance (priority := 10) ofDenumerable (α) [Denumerable α] : Primcodable α : ⟨Nat.Primrec.succ.of_eq <| by simp⟩ /-- Builds a `Primcodable` instance from an equivalence to a `Primcodable` type. -/ +@[implicit_reducible] def ofEquiv (α) {β} [Primcodable α] (e : β ≃ α) : Primcodable β := { __ := Encodable.ofEquiv α e prim := (Primcodable.prim α).of_eq fun n => by @@ -812,6 +813,7 @@ variable {α : Type*} [Primcodable α] open Primrec /-- A subtype of a primitive recursive predicate is `Primcodable`. -/ +@[implicit_reducible] def subtype {p : α → Prop} [DecidablePred p] (hp : PrimrecPred p) : Primcodable (Subtype p) := ⟨have : Primrec fun n => (@decode α _ n).bind fun a => Option.guard p a := option_bind .decode (option_guard (hp.comp snd).primrecRel snd) diff --git a/Mathlib/Computability/Primrec/List.lean b/Mathlib/Computability/Primrec/List.lean index fe38ce62dae448..a67821974cbf31 100644 --- a/Mathlib/Computability/Primrec/List.lean +++ b/Mathlib/Computability/Primrec/List.lean @@ -35,6 +35,7 @@ variable (H : Nat.Primrec fun n => Encodable.encode (@decode (List β) _ n)) open Primrec set_option backward.privateInPublic true in +@[implicit_reducible] private def prim : Primcodable (List β) := ⟨H⟩ private theorem list_casesOn' {f : α → List β} {g : α → σ} {h : α → β × List β → σ} diff --git a/Mathlib/Computability/Tape.lean b/Mathlib/Computability/Tape.lean index 70412ba62aed3c..c4a59c71c4096c 100644 --- a/Mathlib/Computability/Tape.lean +++ b/Mathlib/Computability/Tape.lean @@ -115,6 +115,7 @@ theorem BlankRel.equivalence (Γ) [Inhabited Γ] : Equivalence (@BlankRel Γ _) ⟨BlankRel.refl, @BlankRel.symm _ _, @BlankRel.trans _ _⟩ /-- Construct a setoid instance for `BlankRel`. -/ +@[implicit_reducible] def BlankRel.setoid (Γ) [Inhabited Γ] : Setoid (List Γ) := ⟨_, BlankRel.equivalence _⟩ diff --git a/Mathlib/Control/Functor/Multivariate.lean b/Mathlib/Control/Functor/Multivariate.lean index b6022acc2b09fd..493f39fa6c8857 100644 --- a/Mathlib/Control/Functor/Multivariate.lean +++ b/Mathlib/Control/Functor/Multivariate.lean @@ -211,6 +211,7 @@ theorem LiftR_RelLast_iff (x y : F (α ::: β)) : end LiftPLastPredIff /-- Any type function that is (extensionally) equivalent to a functor, is itself a functor -/ +@[implicit_reducible] def ofEquiv {F F' : TypeVec.{u} n → Type*} [MvFunctor F'] (eqv : ∀ α, F α ≃ F' α) : MvFunctor F where map f x := (eqv _).symm <| f <$$> eqv _ x diff --git a/Mathlib/Control/Monad/Writer.lean b/Mathlib/Control/Monad/Writer.lean index 566dd51c28fd21..f2886e669f8062 100644 --- a/Mathlib/Control/Monad/Writer.lean +++ b/Mathlib/Control/Monad/Writer.lean @@ -88,7 +88,7 @@ def monad (empty : ω) (append : ω → ω → ω) : Monad (WriterT ω M) where (fun (b, w₂) ↦ (b, append w₁ w₂)) <$> (f a) /-- Lift an `M` to a `WriterT ω M`, using the given `empty` as the monoid unit. -/ -@[inline] +@[inline, implicit_reducible] protected def liftTell (empty : ω) : MonadLift M (WriterT ω M) where monadLift := fun cmd ↦ WriterT.mk <| (fun a ↦ (a, empty)) <$> cmd diff --git a/Mathlib/Control/Traversable/Equiv.lean b/Mathlib/Control/Traversable/Equiv.lean index d85d00a5a347aa..c06c1e225636ee 100644 --- a/Mathlib/Control/Traversable/Equiv.lean +++ b/Mathlib/Control/Traversable/Equiv.lean @@ -50,6 +50,7 @@ protected def map {α β : Type u} (f : α → β) (x : t' α) : t' β := /-- The function `Equiv.map` transfers the functoriality of `t` to `t'` using the equivalences `eqv`. -/ +@[implicit_reducible] protected def functor : Functor t' where map := Equiv.map eqv variable [LawfulFunctor t] @@ -101,6 +102,7 @@ theorem traverse_def (f : α → m β) (x : t' α) : rfl /-- The function `Equiv.traverse` transfers a traversable functor +@[implicit_reducible] instance across the equivalences `eqv`. -/ protected def traversable : Traversable t' where toFunctor := Equiv.functor eqv diff --git a/Mathlib/Control/ULiftable.lean b/Mathlib/Control/ULiftable.lean index f4910789afaed8..95571f205712d2 100644 --- a/Mathlib/Control/ULiftable.lean +++ b/Mathlib/Control/ULiftable.lean @@ -121,6 +121,7 @@ instance instULiftableId : ULiftable Id Id where congr F := F /-- for specific state types, this function helps to create a uliftable instance -/ +@[implicit_reducible] def StateT.uliftable' {m : Type u₀ → Type v₀} {m' : Type u₁ → Type v₁} [ULiftable m m'] (F : s ≃ s') : ULiftable (StateT s m) (StateT s' m') where congr G := @@ -134,6 +135,7 @@ instance StateT.instULiftableULiftULift {m m'} [ULiftable m m'] : StateT.uliftable' <| Equiv.ulift.trans Equiv.ulift.symm /-- for specific reader monads, this function helps to create a uliftable instance -/ +@[implicit_reducible] def ReaderT.uliftable' {m m'} [ULiftable m m'] (F : s ≃ s') : ULiftable (ReaderT s m) (ReaderT s' m') where congr G := ReaderT.equiv <| Equiv.piCongr F fun _ => ULiftable.congr G @@ -146,6 +148,7 @@ instance ReaderT.instULiftableULiftULift {m m'} [ULiftable m m'] : ReaderT.uliftable' <| Equiv.ulift.trans Equiv.ulift.symm /-- for specific continuation passing monads, this function helps to create a uliftable instance -/ +@[implicit_reducible] def ContT.uliftable' {m m'} [ULiftable m m'] (F : r ≃ r') : ULiftable (ContT r m) (ContT r' m') where congr := ContT.equiv (ULiftable.congr F) @@ -158,6 +161,7 @@ instance ContT.instULiftableULiftULift {m m'} [ULiftable m m'] : ContT.uliftable' <| Equiv.ulift.trans Equiv.ulift.symm /-- for specific writer monads, this function helps to create a uliftable instance -/ +@[implicit_reducible] def WriterT.uliftable' {m m'} [ULiftable m m'] (F : w ≃ w') : ULiftable (WriterT w m) (WriterT w' m') where congr G := WriterT.equiv <| ULiftable.congr <| Equiv.prodCongr G F diff --git a/Mathlib/Data/Analysis/Topology.lean b/Mathlib/Data/Analysis/Topology.lean index 4974976bd07a7b..8af8bb6e22b76f 100644 --- a/Mathlib/Data/Analysis/Topology.lean +++ b/Mathlib/Data/Analysis/Topology.lean @@ -80,6 +80,7 @@ theorem ofEquiv_val (E : σ ≃ τ) (F : Ctop α σ) (a : τ) : F.ofEquiv E a = end /-- Every `Ctop` is a topological space. -/ +@[implicit_reducible] def toTopsp (F : Ctop α σ) : TopologicalSpace α := TopologicalSpace.generateFrom (Set.range F.f) theorem toTopsp_isTopologicalBasis (F : Ctop α σ) : diff --git a/Mathlib/Data/FinEnum.lean b/Mathlib/Data/FinEnum.lean index 5f0a74bcffe0d6..e5cbe3dbe2f89f 100644 --- a/Mathlib/Data/FinEnum.lean +++ b/Mathlib/Data/FinEnum.lean @@ -40,12 +40,14 @@ namespace FinEnum variable {α : Type u} {β : α → Type v} /-- transport a `FinEnum` instance across an equivalence -/ +@[implicit_reducible] def ofEquiv (α) {β} [FinEnum α] (h : β ≃ α) : FinEnum β where card := card α equiv := h.trans (equiv) decEq := (h.trans (equiv)).decidableEq /-- create a `FinEnum` instance from an exhaustive list without duplicates -/ +@[implicit_reducible] def ofNodupList [DecidableEq α] (xs : List α) (h : ∀ x : α, x ∈ xs) (h' : List.Nodup xs) : FinEnum α where card := xs.length @@ -54,6 +56,7 @@ def ofNodupList [DecidableEq α] (xs : List α) (h : ∀ x : α, x ∈ xs) (h' : fun i => by ext; simp [h'.idxOf_getElem]⟩ /-- create a `FinEnum` instance from an exhaustive list; duplicates are removed -/ +@[implicit_reducible] def ofList [DecidableEq α] (xs : List α) (h : ∀ x : α, x ∈ xs) : FinEnum α := ofNodupList xs.dedup (by simp [*]) (List.nodup_dedup _) @@ -72,10 +75,12 @@ theorem nodup_toList [FinEnum α] : List.Nodup (toList α) := by simp only [toList]; apply List.Nodup.map <;> [apply Equiv.injective; apply List.nodup_finRange] /-- create a `FinEnum` instance using a surjection -/ +@[implicit_reducible] def ofSurjective {β} (f : β → α) [DecidableEq α] [FinEnum β] (h : Surjective f) : FinEnum α := ofList ((toList β).map f) (by intro; simpa using h _) /-- create a `FinEnum` instance using an injection -/ +@[implicit_reducible] noncomputable def ofInjective {α β} (f : α → β) [DecidableEq α] [FinEnum β] (h : Injective f) : FinEnum α := ofList ((toList β).filterMap (partialInv f)) @@ -228,6 +233,7 @@ instance [IsEmpty α] : Unique (FinEnum α) where /-- An empty type has a trivial enumeration. Not registered as an instance, to make sure that there aren't two definitionally differing instances around. -/ +@[implicit_reducible] def ofIsEmpty [IsEmpty α] : FinEnum α := default instance [Unique α] : Unique (FinEnum α) where @@ -242,6 +248,7 @@ instance [Unique α] : Unique (FinEnum α) where /-- A type with unique inhabitant has a trivial enumeration. Not registered as an instance, to make sure that there aren't two definitionally differing instances around. -/ +@[implicit_reducible] def ofUnique [Unique α] : FinEnum α := default end FinEnum diff --git a/Mathlib/Data/FinEnum/Option.lean b/Mathlib/Data/FinEnum/Option.lean index 73f3f05c54613e..41be5993f77b7c 100644 --- a/Mathlib/Data/FinEnum/Option.lean +++ b/Mathlib/Data/FinEnum/Option.lean @@ -24,6 +24,7 @@ namespace FinEnum universe u v /-- Inserting an `Option.none` anywhere in an enumeration yields another enumeration. -/ +@[implicit_reducible] def insertNone (α : Type u) [FinEnum α] (i : Fin (card α + 1)) : FinEnum (Option α) where card := card α + 1 equiv := equiv.optionCongr.trans <| finSuccEquiv' i |>.symm diff --git a/Mathlib/Data/Fintype/Basic.lean b/Mathlib/Data/Fintype/Basic.lean index c55fb01f4cc186..9e8c44d553c5c2 100644 --- a/Mathlib/Data/Fintype/Basic.lean +++ b/Mathlib/Data/Fintype/Basic.lean @@ -143,10 +143,12 @@ theorem Fintype.univ_bool : @univ Bool _ = {true, false} := rfl /-- Given that `α × β` is a fintype, `α` is also a fintype. -/ +@[implicit_reducible] def Fintype.prodLeft {α β} [DecidableEq α] [Fintype (α × β)] [Nonempty β] : Fintype α := ⟨(@univ (α × β) _).image Prod.fst, fun a => by simp⟩ /-- Given that `α × β` is a fintype, `β` is also a fintype. -/ +@[implicit_reducible] def Fintype.prodRight {α β} [DecidableEq β] [Fintype (α × β)] [Nonempty α] : Fintype β := ⟨(@univ (α × β) _).image Prod.snd, fun b => by simp⟩ diff --git a/Mathlib/Data/Fintype/Card.lean b/Mathlib/Data/Fintype/Card.lean index cbe768bf6c735e..abc1d141e8be24 100644 --- a/Mathlib/Data/Fintype/Card.lean +++ b/Mathlib/Data/Fintype/Card.lean @@ -204,11 +204,13 @@ theorem Fintype.card_subtype_true [Fintype α] {h : Fintype {_a : α // True}} : /-- Given that `α ⊕ β` is a fintype, `α` is also a fintype. This is non-computable as it uses that `Sum.inl` is an injection, but there's no clear inverse if `α` is empty. -/ +@[implicit_reducible] noncomputable def Fintype.sumLeft {α β} [Fintype (α ⊕ β)] : Fintype α := Fintype.ofInjective (Sum.inl : α → α ⊕ β) Sum.inl_injective /-- Given that `α ⊕ β` is a fintype, `β` is also a fintype. This is non-computable as it uses that `Sum.inr` is an injection, but there's no clear inverse if `β` is empty. -/ +@[implicit_reducible] noncomputable def Fintype.sumRight {α β} [Fintype (α ⊕ β)] : Fintype β := Fintype.ofInjective (Sum.inr : β → α ⊕ β) Sum.inr_injective diff --git a/Mathlib/Data/Fintype/EquivFin.lean b/Mathlib/Data/Fintype/EquivFin.lean index 54f340fa6c3326..9a81740a1fb9f1 100644 --- a/Mathlib/Data/Fintype/EquivFin.lean +++ b/Mathlib/Data/Fintype/EquivFin.lean @@ -409,6 +409,7 @@ theorem isEmpty_fintype {α : Type*} : IsEmpty (Fintype α) ↔ Infinite α := ⟨fun ⟨h⟩ => ⟨fun h' => (@nonempty_fintype α h').elim h⟩, fun ⟨h⟩ => ⟨fun h' => h h'.finite⟩⟩ /-- A non-infinite type is a fintype. -/ +@[implicit_reducible] noncomputable def fintypeOfNotInfinite {α : Type*} (h : ¬Infinite α) : Fintype α := @Fintype.ofFinite _ (not_infinite_iff_finite.mp h) @@ -575,6 +576,7 @@ theorem exists_superset_card_eq [Infinite α] (s : Finset α) (n : ℕ) (hn : #s end Infinite /-- If every finset in a type has bounded cardinality, that type is finite. -/ +@[implicit_reducible] noncomputable def fintypeOfFinsetCardLe {ι : Type*} (n : ℕ) (w : ∀ s : Finset ι, #s ≤ n) : Fintype ι := by apply fintypeOfNotInfinite diff --git a/Mathlib/Data/Fintype/OfMap.lean b/Mathlib/Data/Fintype/OfMap.lean index dd881d1a1a910e..3ce4dfb8d64892 100644 --- a/Mathlib/Data/Fintype/OfMap.lean +++ b/Mathlib/Data/Fintype/OfMap.lean @@ -37,20 +37,24 @@ open Finset namespace Fintype /-- Construct a proof of `Fintype α` from a universal multiset -/ +@[implicit_reducible] def ofMultiset [DecidableEq α] (s : Multiset α) (H : ∀ x : α, x ∈ s) : Fintype α := ⟨s.toFinset, by simpa using H⟩ /-- Construct a proof of `Fintype α` from a universal list -/ +@[implicit_reducible] def ofList [DecidableEq α] (l : List α) (H : ∀ x : α, x ∈ l) : Fintype α := ⟨l.toFinset, by simpa using H⟩ /-- If `f : α → β` is a bijection and `α` is a fintype, then `β` is also a fintype. -/ +@[implicit_reducible] def ofBijective [Fintype α] (f : α → β) (H : Function.Bijective f) : Fintype β := ⟨univ.map ⟨f, H.1⟩, fun b => let ⟨_, e⟩ := H.2 b e ▸ mem_map_of_mem _ (mem_univ _)⟩ /-- If `f : α → β` is a surjection and `α` is a fintype, then `β` is also a fintype. -/ +@[implicit_reducible] def ofSurjective [DecidableEq β] [Fintype α] (f : α → β) (H : Function.Surjective f) : Fintype β := ⟨univ.image f, fun b => let ⟨_, e⟩ := H b @@ -59,6 +63,7 @@ def ofSurjective [DecidableEq β] [Fintype α] (f : α → β) (H : Function.Sur /-- Given an injective function to a fintype, the domain is also a fintype. This is noncomputable because injectivity alone cannot be used to construct preimages. -/ +@[implicit_reducible] noncomputable def ofInjective [Fintype β] (f : α → β) (H : Function.Injective f) : Fintype α := letI := Classical.dec if hα : Nonempty α then @@ -67,10 +72,12 @@ noncomputable def ofInjective [Fintype β] (f : α → β) (H : Function.Injecti else ⟨∅, fun x => (hα ⟨x⟩).elim⟩ /-- If `f : α ≃ β` and `α` is a fintype, then `β` is also a fintype. -/ +@[implicit_reducible] def ofEquiv (α : Type*) [Fintype α] (f : α ≃ β) : Fintype β := ofBijective _ f.bijective /-- Any subsingleton type with a witness is a fintype (with one term). -/ +@[implicit_reducible] def ofSubsingleton (a : α) [Subsingleton α] : Fintype α := ⟨{a}, fun _ => Finset.mem_singleton.2 (Subsingleton.elim _ _)⟩ @@ -81,6 +88,7 @@ theorem univ_ofSubsingleton (a : α) [Subsingleton α] : @univ _ (ofSubsingleton /-- An empty type is a fintype. Not registered as an instance, to make sure that there aren't two conflicting `Fintype ι` instances around when casing over whether a fintype `ι` is empty or not. -/ +@[implicit_reducible] def ofIsEmpty [IsEmpty α] : Fintype α := ⟨∅, isEmptyElim⟩ diff --git a/Mathlib/Data/Fintype/Option.lean b/Mathlib/Data/Fintype/Option.lean index 96e4bdf75305f7..9a1284c63aa876 100644 --- a/Mathlib/Data/Fintype/Option.lean +++ b/Mathlib/Data/Fintype/Option.lean @@ -42,11 +42,13 @@ theorem Fintype.card_option {α : Type*} [Fintype α] : (Finset.card_cons (by simp)).trans <| congr_arg₂ _ (card_map _) rfl /-- If `Option α` is a `Fintype` then so is `α` -/ +@[implicit_reducible] def fintypeOfOption {α : Type*} [Fintype (Option α)] : Fintype α := ⟨Finset.eraseNone (Fintype.elems (α := Option α)), fun x => mem_eraseNone.mpr (Fintype.complete (some x))⟩ /-- A type is a `Fintype` if its successor (using `Option`) is a `Fintype`. -/ +@[implicit_reducible] def fintypeOfOptionEquiv [Fintype α] (f : α ≃ Option β) : Fintype β := haveI := Fintype.ofEquiv _ f fintypeOfOption diff --git a/Mathlib/Data/Fintype/Perm.lean b/Mathlib/Data/Fintype/Perm.lean index ff2590b681d94d..b95edc60fd9ac5 100644 --- a/Mathlib/Data/Fintype/Perm.lean +++ b/Mathlib/Data/Fintype/Perm.lean @@ -137,6 +137,7 @@ theorem card_perms_of_finset : ∀ s : Finset α, #(permsOfFinset s) = (#s)! := rintro ⟨⟨l⟩, hs⟩; exact length_permsOfList l /-- The collection of permutations of a fintype is a fintype. -/ +@[implicit_reducible] def fintypePerm [Fintype α] : Fintype (Perm α) := ⟨permsOfFinset (@Finset.univ α _), by simp [mem_perms_of_finset_iff]⟩ diff --git a/Mathlib/Data/Fintype/Sum.lean b/Mathlib/Data/Fintype/Sum.lean index a053a4fadb1efa..1e0154e21fe59d 100644 --- a/Mathlib/Data/Fintype/Sum.lean +++ b/Mathlib/Data/Fintype/Sum.lean @@ -65,6 +65,7 @@ theorem Fintype.card_sum [Fintype α] [Fintype β] : card_disjSum _ _ /-- If the subtype of all-but-one elements is a `Fintype` then the type itself is a `Fintype`. -/ +@[implicit_reducible] def fintypeOfFintypeNe (a : α) (_ : Fintype { b // b ≠ a }) : Fintype α := Fintype.ofBijective (Sum.elim ((↑) : { b // b = a } → α) ((↑) : { b // b ≠ a } → α)) <| by classical exact (Equiv.sumCompl (· = a)).bijective diff --git a/Mathlib/Data/FunLike/Fintype.lean b/Mathlib/Data/FunLike/Fintype.lean index 72e51ea818a297..1934baab8c283f 100644 --- a/Mathlib/Data/FunLike/Fintype.lean +++ b/Mathlib/Data/FunLike/Fintype.lean @@ -41,6 +41,7 @@ This is not an instance because specific `DFunLike` types might have a better-su See also `DFunLike.finite`. -/ +@[implicit_reducible] noncomputable def DFunLike.fintype [DecidableEq α] [Fintype α] [∀ i, Fintype (β i)] : Fintype F := Fintype.ofInjective _ DFunLike.coe_injective @@ -49,6 +50,7 @@ noncomputable def DFunLike.fintype [DecidableEq α] [Fintype α] [∀ i, Fintype Non-dependent version of `DFunLike.fintype` that might be easier to infer. This is not an instance because specific `FunLike` types might have a better-suited definition. -/ +@[implicit_reducible] noncomputable def FunLike.fintype [DecidableEq α] [Fintype α] [Fintype γ] : Fintype G := DFunLike.fintype G diff --git a/Mathlib/Data/List/GetD.lean b/Mathlib/Data/List/GetD.lean index acef6966d10b58..79a0bd6ef01c46 100644 --- a/Mathlib/Data/List/GetD.lean +++ b/Mathlib/Data/List/GetD.lean @@ -52,6 +52,7 @@ theorem getD_reverse {l : List α} (i) (h : i < length l) : /-- An empty list can always be decidably checked for the presence of an element. Not an instance because it would clash with `DecidableEq α`. -/ +@[implicit_reducible] def decidableGetDNilNe (a : α) : DecidablePred fun i : ℕ => getD ([] : List α) i a ≠ a := fun _ => isFalse fun H => H getD_nil diff --git a/Mathlib/Data/List/Rotate.lean b/Mathlib/Data/List/Rotate.lean index af0cba99edd5a4..92cae6b3a1a9a4 100644 --- a/Mathlib/Data/List/Rotate.lean +++ b/Mathlib/Data/List/Rotate.lean @@ -396,6 +396,7 @@ theorem IsRotated.eqv : Equivalence (@IsRotated α) := Equivalence.mk IsRotated.refl IsRotated.symm IsRotated.trans /-- The relation `List.IsRotated l l'` forms a `Setoid` of cycles. -/ +@[implicit_reducible] def IsRotated.setoid (α : Type*) : Setoid (List α) where r := IsRotated iseqv := IsRotated.eqv diff --git a/Mathlib/Data/Matrix/Invertible.lean b/Mathlib/Data/Matrix/Invertible.lean index d62d993e71eecb..728b99934521fd 100644 --- a/Mathlib/Data/Matrix/Invertible.lean +++ b/Mathlib/Data/Matrix/Invertible.lean @@ -89,6 +89,7 @@ instance invertibleConjTranspose [Invertible A] : Invertible Aᴴ := Invertible. lemma conjTranspose_invOf [Invertible A] [Invertible Aᴴ] : (⅟A)ᴴ = ⅟(Aᴴ) := star_invOf _ /-- A matrix is invertible if the conjugate transpose is invertible. -/ +@[implicit_reducible] def invertibleOfInvertibleConjTranspose [Invertible Aᴴ] : Invertible A := by rw [← conjTranspose_conjTranspose A, ← star_eq_conjTranspose] infer_instance @@ -114,6 +115,7 @@ lemma transpose_invOf [Invertible A] [Invertible Aᵀ] : (⅟A)ᵀ = ⅟(Aᵀ) : convert (rfl : _ = ⅟(Aᵀ)) /-- `Aᵀ` is invertible when `A` is. -/ +@[implicit_reducible] def invertibleOfInvertibleTranspose [Invertible Aᵀ] : Invertible A where invOf := (⅟(Aᵀ))ᵀ invOf_mul_self := by rw [← transpose_one, ← mul_invOf_self Aᵀ, transpose_mul, transpose_transpose] @@ -185,6 +187,7 @@ lemma add_mul_mul_invOf_mul_eq_one' : abel /-- If matrices `A`, `C`, and `C⁻¹ + V * A⁻¹ * U` are invertible, then so is `A + U * C * V`. -/ +@[implicit_reducible] def invertibleAddMulMul : Invertible (A + U * C * V) where invOf := ⅟A - ⅟A * U * ⅟(⅟C + V * ⅟A * U) * V * ⅟A invOf_mul_self := add_mul_mul_invOf_mul_eq_one' _ _ _ _ @@ -228,6 +231,7 @@ lemma add_mul_mul_mul_invOf_eq_one' : simp only [Matrix.mul_assoc] /-- If matrices `A` and `C + C * V * A⁻¹ * U * C` are invertible, then so is `A + U * C * V`. -/ +@[implicit_reducible] def invertibleAddMulMul' : Invertible (A + U * C * V) where invOf := ⅟A - ⅟A * U * C * ⅟(C + C * V * ⅟A * U * C) * C * V * ⅟A invOf_mul_self := add_mul_mul_mul_invOf_eq_one' A U C V diff --git a/Mathlib/Data/QPF/Multivariate/Basic.lean b/Mathlib/Data/QPF/Multivariate/Basic.lean index 8df24b98c68d07..61ce8d6076d807 100644 --- a/Mathlib/Data/QPF/Multivariate/Basic.lean +++ b/Mathlib/Data/QPF/Multivariate/Basic.lean @@ -264,6 +264,7 @@ theorem liftpPreservation_iff_uniform : q.LiftPPreservation ↔ q.IsUniform := b set_option linter.style.whitespace false in -- manual alignment is not recognised /-- Any type function `F` that is (extensionally) equivalent to a QPF, is itself a QPF, assuming that the functorial map of `F` behaves similar to `MvFunctor.ofEquiv eqv` -/ +@[implicit_reducible] def ofEquiv {F F' : TypeVec.{u} n → Type*} [q : MvQPF F'] [MvFunctor F] (eqv : ∀ α, F α ≃ F' α) (map_eq : ∀ (α β : TypeVec n) (f : α ⟹ β) (a : F α), diff --git a/Mathlib/Data/QPF/Multivariate/Constructions/Quot.lean b/Mathlib/Data/QPF/Multivariate/Constructions/Quot.lean index 3a63aa05ba70c5..3fff9c46592de7 100644 --- a/Mathlib/Data/QPF/Multivariate/Constructions/Quot.lean +++ b/Mathlib/Data/QPF/Multivariate/Constructions/Quot.lean @@ -37,6 +37,7 @@ variable {FG_repr : ∀ {α}, G α → F α} /-- If `F` is a QPF then `G` is a QPF as well. Can be used to construct `MvQPF` instances by transporting them across surjective functions -/ +@[implicit_reducible] def quotientQPF (FG_abs_repr : ∀ {α} (x : G α), FG_abs (FG_repr x) = x) (FG_abs_map : ∀ {α β} (f : α ⟹ β) (x : F α), FG_abs (f <$$> x) = f <$$> FG_abs x) : MvQPF G where @@ -68,6 +69,7 @@ def Quot1.map ⦃α β⦄ (f : α ⟹ β) : Quot1.{u} R α → Quot1.{u} R β := Quot.lift (fun x : F α => Quot.mk _ (f <$$> x : F β)) fun a b h => Quot.sound <| Hfunc a b _ h /-- `mvFunctor` instance for `Quot1` with well-behaved `R` -/ +@[implicit_reducible] def Quot1.mvFunctor : MvFunctor (Quot1 R) where map := @Quot1.map _ _ R _ Hfunc end @@ -77,6 +79,7 @@ section variable [q : MvQPF F] (Hfunc : ∀ ⦃α β⦄ (a b : F α) (f : α ⟹ β), R a b → R (f <$$> a) (f <$$> b)) /-- `Quot1` is a QPF -/ +@[implicit_reducible] noncomputable def relQuot : @MvQPF _ (Quot1 R) := @quotientQPF n F q _ (MvQPF.Quot1.mvFunctor R Hfunc) (fun x => Quot.mk _ x) Quot.out (fun _x => Quot.out_eq _) fun _f _x => rfl diff --git a/Mathlib/Data/QPF/Univariate/Basic.lean b/Mathlib/Data/QPF/Univariate/Basic.lean index 382eb25db471f0..cafb4578dd5c9b 100644 --- a/Mathlib/Data/QPF/Univariate/Basic.lean +++ b/Mathlib/Data/QPF/Univariate/Basic.lean @@ -455,6 +455,7 @@ variable {F₂ : Type u → Type u} [q₂ : QPF F₂] variable {F₁ : Type u → Type u} [q₁ : QPF F₁] /-- composition of qpfs gives another qpf -/ +@[implicit_reducible] def comp : QPF (Functor.Comp F₂ F₁) where P := PFunctor.comp q₂.P q₁.P abs {α} := by @@ -514,6 +515,7 @@ variable {FG_repr : ∀ {α}, G α → F α} functor `G α`, `G` is a qpf. We can consider `G` a quotient on `F` where elements `x y : F α` are in the same equivalence class if `FG_abs x = FG_abs y`. -/ +@[implicit_reducible] def quotientQPF (FG_abs_repr : ∀ {α} (x : G α), FG_abs (FG_repr x) = x) (FG_abs_map : ∀ {α β} (f : α → β) (x : F α), FG_abs (f <$> x) = f <$> FG_abs x) : QPF G where P := q.P diff --git a/Mathlib/Data/Quot.lean b/Mathlib/Data/Quot.lean index 55fbfb0311dcfc..6276672bffea6b 100644 --- a/Mathlib/Data/Quot.lean +++ b/Mathlib/Data/Quot.lean @@ -455,6 +455,7 @@ theorem true_equivalence : @Equivalence α fun _ _ ↦ True := /-- Always-true relation as a `Setoid`. Note that in later files the preferred spelling is `⊤ : Setoid α`. -/ +@[implicit_reducible] def trueSetoid : Setoid α := ⟨_, true_equivalence⟩ diff --git a/Mathlib/Data/Set/Countable.lean b/Mathlib/Data/Set/Countable.lean index ee155a748e2589..159b4c557c90d1 100644 --- a/Mathlib/Data/Set/Countable.lean +++ b/Mathlib/Data/Set/Countable.lean @@ -72,6 +72,7 @@ theorem countable_iff_nonempty_encodable {s : Set α} : s.Countable ↔ Nonempty alias ⟨Countable.nonempty_encodable, _⟩ := countable_iff_nonempty_encodable /-- Convert `Set.Countable s` to `Encodable s` (noncomputable). -/ +@[implicit_reducible] protected def Countable.toEncodable {s : Set α} (hs : s.Countable) : Encodable s := Classical.choice hs.nonempty_encodable diff --git a/Mathlib/Data/Set/Finite/Basic.lean b/Mathlib/Data/Set/Finite/Basic.lean index 32da5020dd50c1..7ae16b6b5f6459 100644 --- a/Mathlib/Data/Set/Finite/Basic.lean +++ b/Mathlib/Data/Set/Finite/Basic.lean @@ -67,6 +67,7 @@ This is the `Fintype` projection for a `Set.Finite`. Note that because `Finite` isn't a typeclass, this definition will not fire if it is made into an instance -/ +@[implicit_reducible] protected noncomputable def Finite.fintype {s : Set α} (h : s.Finite) : Fintype s := h.nonempty_fintype.some @@ -237,6 +238,7 @@ instance fintypeUniv [Fintype α] : Fintype (@univ α) := instance fintypeTop [Fintype α] : Fintype (⊤ : Set α) := inferInstanceAs (Fintype (univ : Set α)) /-- If `(Set.univ : Set α)` is finite then `α` is a finite type. -/ +@[implicit_reducible] noncomputable def fintypeOfFiniteUniv (H : (univ (α := α)).Finite) : Fintype α := @Fintype.ofEquiv _ (univ : Set α) H.fintype (Equiv.Set.univ _) @@ -263,6 +265,7 @@ instance fintypeInterOfRight (s t : Set α) [Fintype t] [DecidablePred (· ∈ s Fintype.ofFinset {a ∈ t.toFinset | a ∈ s} <| by simp [and_comm] /-- A `Fintype` structure on a set defines a `Fintype` structure on its subset. -/ +@[implicit_reducible] def fintypeSubset (s : Set α) {t : Set α} [Fintype s] [DecidablePred (· ∈ t)] (h : t ⊆ s) : Fintype t := by rw [← inter_eq_self_of_subset_right h] @@ -290,11 +293,13 @@ instance fintypeInsert (a : α) (s : Set α) [DecidableEq α] [Fintype s] : Fintype.ofFinset (insert a s.toFinset) <| by simp /-- A `Fintype` structure on `insert a s` when inserting a new element. -/ +@[implicit_reducible] def fintypeInsertOfNotMem {a : α} (s : Set α) [Fintype s] (h : a ∉ s) : Fintype (insert a s : Set α) := Fintype.ofFinset ⟨a ::ₘ s.toFinset.1, s.toFinset.nodup.cons (by simp [h])⟩ <| by simp /-- A `Fintype` structure on `insert a s` when inserting a pre-existing element. -/ +@[implicit_reducible] def fintypeInsertOfMem {a : α} (s : Set α) [Fintype s] (h : a ∈ s) : Fintype (insert a s : Set α) := Fintype.ofFinset s.toFinset <| by simp [h] @@ -315,6 +320,7 @@ instance fintypeImage [DecidableEq β] (s : Set α) (f : α → β) [Fintype s] /-- If a function `f` has a partial inverse `g` and the image of `s` under `f` is a set with a `Fintype` instance, then `s` has a `Fintype` structure as well. -/ +@[implicit_reducible] def fintypeOfFintypeImage (s : Set α) {f : α → β} {g} (I : IsPartialInv f g) [Fintype (f '' s)] : Fintype s := Fintype.ofFinset ⟨_, (f '' s).toFinset.2.filterMap g <| injective_of_isPartialInv_right I⟩ diff --git a/Mathlib/Data/Set/Finite/Lattice.lean b/Mathlib/Data/Set/Finite/Lattice.lean index 88200de35b17a8..2d7257d8473a03 100644 --- a/Mathlib/Data/Set/Finite/Lattice.lean +++ b/Mathlib/Data/Set/Finite/Lattice.lean @@ -59,6 +59,7 @@ lemma toFinset_iUnion [Fintype β] [DecidableEq α] (f : β → Set α) /-- A union of sets with `Fintype` structure over a set with `Fintype` structure has a `Fintype` structure. -/ +@[implicit_reducible] def fintypeBiUnion [DecidableEq α] {ι : Type*} (s : Set ι) [Fintype s] (t : ι → Set α) (H : ∀ i ∈ s, Fintype (t i)) : Fintype (⋃ x ∈ s, t x) := haveI : ∀ i : toFinset s, Fintype (t i) := fun i => H i (mem_toFinset.1 i.2) diff --git a/Mathlib/Data/Set/Finite/Monad.lean b/Mathlib/Data/Set/Finite/Monad.lean index 69c8220874ba0c..206b0c7e0cc284 100644 --- a/Mathlib/Data/Set/Finite/Monad.lean +++ b/Mathlib/Data/Set/Finite/Monad.lean @@ -41,6 +41,7 @@ attribute [local instance] Set.monad /-- If `s : Set α` is a set with `Fintype` instance and `f : α → Set β` is a function such that each `f a`, `a ∈ s`, has a `Fintype` structure, then `s >>= f` has a `Fintype` structure. -/ +@[implicit_reducible] def fintypeBind {α β} [DecidableEq β] (s : Set α) [Fintype s] (f : α → Set β) (H : ∀ a ∈ s, Fintype (f a)) : Fintype (s >>= f) := Set.fintypeBiUnion s f H diff --git a/Mathlib/Data/Setoid/Basic.lean b/Mathlib/Data/Setoid/Basic.lean index 03c30cd887eb94..bc9a33add88bff 100644 --- a/Mathlib/Data/Setoid/Basic.lean +++ b/Mathlib/Data/Setoid/Basic.lean @@ -70,6 +70,7 @@ theorem comm' (s : Setoid α) {x y} : s x y ↔ s y x := open scoped Function -- required for scoped `on` notation /-- The kernel of a function is an equivalence relation. -/ +@[implicit_reducible] def ker (f : α → β) : Setoid α := ⟨(· = ·) on f, eq_equivalence.comap f⟩ @@ -88,6 +89,7 @@ theorem ker_def {f : α → β} {x y : α} : ker f x y ↔ f x = f y := /-- Given types `α`, `β`, the product of two equivalence relations `r` on `α` and `s` on `β`: `(x₁, x₂), (y₁, y₂) ∈ α × β` are related by `r.prod s` iff `x₁` is related to `y₁` by `r` and `x₂` is related to `y₂` by `s`. -/ +@[implicit_reducible] protected def prod (r : Setoid α) (s : Setoid β) : Setoid (α × β) where r x y := r x.1 y.1 ∧ s x.2 y.2 @@ -392,12 +394,14 @@ variable {r f} /-- Given a function `f : α → β` and equivalence relation `r` on `α`, the equivalence closure of the relation on `f`'s image defined by '`x ≈ y` iff the elements of `f⁻¹(x)` are related to the elements of `f⁻¹(y)` by `r`.' -/ +@[implicit_reducible] def map (r : Setoid α) (f : α → β) : Setoid β := Relation.EqvGen.setoid (Relation.Map r f f) /-- Given a surjective function f whose kernel is contained in an equivalence relation r, the equivalence relation on f's codomain defined by x ≈ y ↔ the elements of f⁻¹(x) are related to the elements of f⁻¹(y) by r. -/ +@[implicit_reducible] def mapOfSurjective (r : Setoid α) (f : α → β) (h : ker f ≤ r) (hf : Surjective f) : Setoid β := ⟨Relation.Map r f f, Relation.map_equivalence r.iseqv f hf h⟩ diff --git a/Mathlib/Data/Setoid/Partition.lean b/Mathlib/Data/Setoid/Partition.lean index d29073aea2dbb1..722a9903bd99f5 100644 --- a/Mathlib/Data/Setoid/Partition.lean +++ b/Mathlib/Data/Setoid/Partition.lean @@ -47,6 +47,7 @@ theorem eq_of_mem_eqv_class {c : Set (Set α)} (H : ∀ a, ∃! b ∈ c, a ∈ b (H x).unique ⟨hc, hb⟩ ⟨hc', hb'⟩ /-- Makes an equivalence relation from a set of sets partitioning α. -/ +@[implicit_reducible] def mkClasses (c : Set (Set α)) (H : ∀ a, ∃! b ∈ c, a ∈ b) : Setoid α where r x y := ∀ s ∈ c, x ∈ s → y ∈ s iseqv.refl := fun _ _ _ hx => hx @@ -142,6 +143,7 @@ theorem eqv_classes_of_disjoint_union {c : Set (Set α)} (hu : Set.sUnion c = @S ExistsUnique.intro b ⟨hc, ha⟩ fun _ hc' => H.elim_set hc'.1 hc _ hc'.2 ha /-- Makes an equivalence relation from a set of disjoints sets covering α. -/ +@[implicit_reducible] def setoidOfDisjointUnion {c : Set (Set α)} (hu : Set.sUnion c = @Set.univ α) (H : c.PairwiseDisjoint id) : Setoid α := Setoid.mkClasses c <| eqv_classes_of_disjoint_union hu H diff --git a/Mathlib/Data/W/Basic.lean b/Mathlib/Data/W/Basic.lean index cdde29895d29cb..81c5d481441c4d 100644 --- a/Mathlib/Data/W/Basic.lean +++ b/Mathlib/Data/W/Basic.lean @@ -136,6 +136,7 @@ private abbrev WType' {α : Type*} (β : α → Type*) [∀ a : α, Fintype (β variable [∀ a : α, Encodable (β a)] set_option backward.privateInPublic true in +@[implicit_reducible] private def encodable_zero : Encodable (WType' β 0) := let f : WType' β 0 → Empty := fun ⟨_, h⟩ => False.elim <| not_lt_of_ge h (WType.depth_pos _) let finv : Empty → WType' β 0 := by @@ -160,6 +161,7 @@ private def finv (n : ℕ) : (Σ a : α, β a → WType' β n) → WType' β (n variable [Encodable α] set_option backward.privateInPublic true in +@[implicit_reducible] private def encodable_succ (n : Nat) (_ : Encodable (WType' β n)) : Encodable (WType' β (n + 1)) := Encodable.ofLeftInverse (f n) (finv n) (by diff --git a/Mathlib/Deprecated/Estimator.lean b/Mathlib/Deprecated/Estimator.lean index 357f14bc0a605f..753f1c4dcc8a98 100644 --- a/Mathlib/Deprecated/Estimator.lean +++ b/Mathlib/Deprecated/Estimator.lean @@ -227,6 +227,7 @@ instance [DecidableLT α] {a : Thunk α} {b : Thunk β} /-- Given an estimator for a pair, we can extract an estimator for the first factor. -/ -- This isn't an instance as at the sole use case we need to provide -- the instance arguments by hand anyway. +@[implicit_reducible] def Estimator.fstInst [DecidableLT α] [∀ (p : α × β), WellFoundedGT { q // q ≤ p }] (a : Thunk α) (b : Thunk β) (i : Estimator (a.prod b) ε) : Estimator a (Estimator.fst (a.prod b) ε) where diff --git a/Mathlib/Dynamics/Flow.lean b/Mathlib/Dynamics/Flow.lean index 27ce2c40525576..75a838868ae61f 100644 --- a/Mathlib/Dynamics/Flow.lean +++ b/Mathlib/Dynamics/Flow.lean @@ -155,6 +155,7 @@ theorem coe_restrict_apply {s : Set α} (h : IsInvariant ϕ s) (t : τ) (x : s) set_option linter.style.whitespace false in -- manual alignment is not recognised /-- Convert a flow to an additive monoid action. -/ +@[implicit_reducible] def toAddAction : AddAction τ α where vadd := ϕ add_vadd := ϕ.map_add' diff --git a/Mathlib/FieldTheory/Differential/Basic.lean b/Mathlib/FieldTheory/Differential/Basic.lean index 56f4bdb9e8c5af..b2a4d2f50b3dc0 100644 --- a/Mathlib/FieldTheory/Differential/Basic.lean +++ b/Mathlib/FieldTheory/Differential/Basic.lean @@ -156,6 +156,7 @@ lemma differentialAlgebraFiniteDimensional [FiniteDimensional F K] : A finite extension of a differential field has a unique derivation which agrees with the one on the base field. -/ +@[implicit_reducible] noncomputable def uniqueDifferentialAlgebraFiniteDimensional [FiniteDimensional F K] : Unique {_a : Differential K // DifferentialAlgebra F K} := by let default : {_a : Differential K // DifferentialAlgebra F K} := diff --git a/Mathlib/FieldTheory/Finite/Basic.lean b/Mathlib/FieldTheory/Finite/Basic.lean index c3b22155f372e4..a50f4af8a387c3 100644 --- a/Mathlib/FieldTheory/Finite/Basic.lean +++ b/Mathlib/FieldTheory/Finite/Basic.lean @@ -724,6 +724,7 @@ theorem Subfield.card_bot : Nat.card (⊥ : Subfield F) = p := by ← Nat.card_eq_of_bijective _ (RingHom.rangeRestrictField_bijective _), Nat.card_zmod] /-- The prime subfield is finite. -/ +@[implicit_reducible] def Subfield.fintypeBot : Fintype (⊥ : Subfield F) := Fintype.subtype (univ.map ⟨_, (ZMod.castHom (m := p) dvd_rfl F).injective⟩) fun _ ↦ by simp_rw [Finset.mem_map, mem_univ, true_and, ← fieldRange_castHom_eq_bot p]; rfl diff --git a/Mathlib/FieldTheory/Finiteness.lean b/Mathlib/FieldTheory/Finiteness.lean index 18e02ec7f9cc35..24304ee35fee15 100644 --- a/Mathlib/FieldTheory/Finiteness.lean +++ b/Mathlib/FieldTheory/Finiteness.lean @@ -42,6 +42,7 @@ theorem iff_rank_lt_aleph0 : IsNoetherian K V ↔ Module.rank K V < ℵ₀ := by rw [Set.Finite.coe_toFinset, ← b.span_eq, Basis.coe_ofVectorSpace, Subtype.range_coe] /-- In a Noetherian module over a division ring, all bases are indexed by a finite type. -/ +@[implicit_reducible] noncomputable def fintypeBasisIndex {ι : Type*} [IsNoetherian K V] (b : Basis ι K V) : Fintype ι := b.fintypeIndexOfRankLtAleph0 (rank_lt_aleph0 K V) diff --git a/Mathlib/FieldTheory/Galois/IsGaloisGroup.lean b/Mathlib/FieldTheory/Galois/IsGaloisGroup.lean index 223d533cee4ff3..8e8503befac582 100644 --- a/Mathlib/FieldTheory/Galois/IsGaloisGroup.lean +++ b/Mathlib/FieldTheory/Galois/IsGaloisGroup.lean @@ -135,6 +135,7 @@ attribute [local instance] FractionRing.liftAlgebra in Assume that `IsGaloisGroup G A B` with `A` and `B` domains, then `G` has a `MulSemiringAction` on `FractionRing B`. This cannot be an instance since Lean cannot figure out `A`. -/ +@[implicit_reducible] noncomputable def FractionRing.mulSemiringAction_of_isGaloisGroup [IsDomain A] [IsDomain B] [IsTorsionFree A B] [IsGaloisGroup G A B] : MulSemiringAction G (FractionRing B) := MulSemiringAction.compHom (FractionRing B) diff --git a/Mathlib/FieldTheory/IntermediateField/Adjoin/Basic.lean b/Mathlib/FieldTheory/IntermediateField/Adjoin/Basic.lean index abfcba80010ca5..78e4456775e2ce 100644 --- a/Mathlib/FieldTheory/IntermediateField/Adjoin/Basic.lean +++ b/Mathlib/FieldTheory/IntermediateField/Adjoin/Basic.lean @@ -606,6 +606,7 @@ lemma algHomAdjoinIntegralEquiv_symm_apply_gen (h : IsIntegral F α) rw [adjoin.powerBasis_gen, minpoly_gen]; exact (mem_aroots.mp x.2).2 /-- Fintype of algebra homomorphism `F⟮α⟯ →ₐ[F] K` -/ +@[implicit_reducible] noncomputable def fintypeOfAlgHomAdjoinIntegral (h : IsIntegral F α) : Fintype (F⟮α⟯ →ₐ[F] K) := PowerBasis.AlgHom.fintype (adjoin.powerBasis h) diff --git a/Mathlib/FieldTheory/KrullTopology.lean b/Mathlib/FieldTheory/KrullTopology.lean index e11c013f47fb0d..caddf3bca2ec12 100644 --- a/Mathlib/FieldTheory/KrullTopology.lean +++ b/Mathlib/FieldTheory/KrullTopology.lean @@ -100,6 +100,7 @@ theorem mem_galBasis_iff (K L : Type*) [Field K] [Field L] [Algebra K L] (U : Se /-- For a field extension `L/K`, `galGroupBasis K L` is the group filter basis on `Gal(L/K)` whose sets are `Gal(L/E)` for finite subextensions `E/K`. -/ +@[implicit_reducible] def galGroupBasis (K L : Type*) [Field K] [Field L] [Algebra K L] : GroupFilterBasis Gal(L/K) where toFilterBasis := galBasis K L diff --git a/Mathlib/FieldTheory/Minpoly/Field.lean b/Mathlib/FieldTheory/Minpoly/Field.lean index ab43430234df65..e1cd04214e4724 100644 --- a/Mathlib/FieldTheory/Minpoly/Field.lean +++ b/Mathlib/FieldTheory/Minpoly/Field.lean @@ -211,6 +211,7 @@ section AlgHomFintype open scoped Classical in /-- A technical finiteness result. -/ +@[implicit_reducible] noncomputable def Fintype.subtypeProd {E : Type*} {X : Set E} (hX : X.Finite) {L : Type*} (F : E → Multiset L) : Fintype (∀ x : X, { l : L // l ∈ F x }) := @Pi.instFintype _ _ _ (Finite.fintype hX) _ diff --git a/Mathlib/FieldTheory/Minpoly/IsConjRoot.lean b/Mathlib/FieldTheory/Minpoly/IsConjRoot.lean index 7687b2c63ee030..05bd01e589e60e 100644 --- a/Mathlib/FieldTheory/Minpoly/IsConjRoot.lean +++ b/Mathlib/FieldTheory/Minpoly/IsConjRoot.lean @@ -82,6 +82,7 @@ variable (R A) in /-- The setoid structure on `A` defined by the equivalence relation of `IsConjRoot R · ·`. -/ +@[implicit_reducible] def setoid : Setoid A where r := IsConjRoot R iseqv := ⟨fun _ => refl, symm, trans⟩ diff --git a/Mathlib/FieldTheory/PolynomialGaloisGroup.lean b/Mathlib/FieldTheory/PolynomialGaloisGroup.lean index f9b6759bf41993..efb2f32e0d1cca 100644 --- a/Mathlib/FieldTheory/PolynomialGaloisGroup.lean +++ b/Mathlib/FieldTheory/PolynomialGaloisGroup.lean @@ -70,6 +70,7 @@ theorem ext {σ τ : p.Gal} (h : ∀ x ∈ p.rootSet p.SplittingField, σ x = τ rwa [eq_top_iff, ← SplittingField.adjoin_rootSet, Algebra.adjoin_le_iff] /-- If `p` splits in `F` then the `p.gal` is trivial. -/ +@[implicit_reducible] def uniqueGalOfSplits (h : p.Splits) : Unique p.Gal where default := 1 uniq f := diff --git a/Mathlib/FieldTheory/RatFunc/Basic.lean b/Mathlib/FieldTheory/RatFunc/Basic.lean index d9c0316d25482c..f4c3f818eb0b56 100644 --- a/Mathlib/FieldTheory/RatFunc/Basic.lean +++ b/Mathlib/FieldTheory/RatFunc/Basic.lean @@ -268,6 +268,7 @@ variable (K) [CommRing K] This is an intermediate step on the way to the full instance `RatFunc.instCommRing`. -/ +@[implicit_reducible] def instCommMonoid : CommMonoid (RatFunc K) where mul_assoc := by frac_tac mul_comm := by frac_tac @@ -279,6 +280,7 @@ def instCommMonoid : CommMonoid (RatFunc K) where This is an intermediate step on the way to the full instance `RatFunc.instCommRing`. -/ +@[implicit_reducible] def instAddCommGroup : AddCommGroup (RatFunc K) where add_assoc := by frac_tac add_comm := by frac_tac diff --git a/Mathlib/Geometry/Convex/Cone/Basic.lean b/Mathlib/Geometry/Convex/Cone/Basic.lean index b1ab3a61f89142..66210aa8fc42c3 100644 --- a/Mathlib/Geometry/Convex/Cone/Basic.lean +++ b/Mathlib/Geometry/Convex/Cone/Basic.lean @@ -318,6 +318,7 @@ theorem Blunt.salient : C.Blunt → C.Salient := by exact mt Flat.pointed /-- A pointed convex cone defines a preorder. -/ +@[implicit_reducible] def toPreorder (C : ConvexCone R G) (h₁ : C.Pointed) : Preorder G where le x y := y - x ∈ C le_refl x := by rw [sub_self x]; exact h₁ diff --git a/Mathlib/Geometry/Diffeology/Basic.lean b/Mathlib/Geometry/Diffeology/Basic.lean index a394337f583590..7c23eb4c120284 100644 --- a/Mathlib/Geometry/Diffeology/Basic.lean +++ b/Mathlib/Geometry/Diffeology/Basic.lean @@ -265,6 +265,7 @@ namespace DiffeologicalSpace /-- Replaces the D-topology of a diffeology with another topology equal to it. Useful to construct diffeologies with better definitional equalities. -/ +@[implicit_reducible] def replaceDTopology {X : Type*} (d : DiffeologicalSpace X) (t : TopologicalSpace X) (h : @dTopology _ d = t) : DiffeologicalSpace X where dTopology := t @@ -311,6 +312,7 @@ structure CorePlotsOn (X : Type*) where organised in the form of the auxiliary `CorePlotsOn` structure. This is more involved in most regards, but also often makes it quite a lot easier to prove the locality condition. -/ +@[implicit_reducible] def ofCorePlotsOn {X : Type*} (d : DiffeologicalSpace.CorePlotsOn X) : DiffeologicalSpace X where plots _ := {p | d.isPlot p} @@ -475,6 +477,7 @@ lemma injective_toPlots : Function.Injective (@toPlots X) := fun d d' h ↦ by ext n p; exact Set.ext_iff.1 h ⟨n, p⟩ /-- The diffeology generated by a set `g` of plots. -/ +@[implicit_reducible] def generateFrom (g : Set ((n : ℕ) × (𝔼ⁿ → X))) : DiffeologicalSpace X where plots n := {p | ∀ (d : DiffeologicalSpace X), g ⊆ d.toPlots → ⟨n, p⟩ ∈ d.toPlots} constant_plots {n} x := fun _ _ ↦ constant_plots x @@ -513,6 +516,7 @@ lemma generateFrom_le_iff {g : Set ((n : ℕ) × (𝔼ⁿ → X))} {d : Diffeolo /-- The diffeology defined by `g`. Same as `generateFrom g`, except that its set of plots is definitionally equal to `g`. -/ +@[implicit_reducible] protected def mkOfClosure (g : Set ((n : ℕ) × (𝔼ⁿ → X))) (hg : (generateFrom g).toPlots = g) : DiffeologicalSpace X where plots n := {p | ⟨n, p⟩ ∈ g} diff --git a/Mathlib/Geometry/Manifold/ChartedSpace.lean b/Mathlib/Geometry/Manifold/ChartedSpace.lean index 5abc4e48faa2f6..d5f159ef6ef1c9 100644 --- a/Mathlib/Geometry/Manifold/ChartedSpace.lean +++ b/Mathlib/Geometry/Manifold/ChartedSpace.lean @@ -281,6 +281,7 @@ theorem ChartedSpace.locPathConnectedSpace [LocPathConnectedSpace H] : LocPathCo /-- If `M` is modelled on `H'` and `H'` is itself modelled on `H`, then we can consider `M` as being modelled on `H`. -/ +@[implicit_reducible] def ChartedSpace.comp (H : Type*) [TopologicalSpace H] (H' : Type*) [TopologicalSpace H'] (M : Type*) [TopologicalSpace M] [ChartedSpace H H'] [ChartedSpace H' M] : ChartedSpace H M where @@ -322,6 +323,7 @@ end section Constructions /-- An empty type is a charted space over any topological space. -/ +@[implicit_reducible] def ChartedSpace.empty (H : Type*) [TopologicalSpace H] (M : Type*) [TopologicalSpace M] [IsEmpty M] : ChartedSpace H M where atlas := ∅ @@ -488,6 +490,7 @@ variable [TopologicalSpace H] [TopologicalSpace M] [TopologicalSpace M'] /-- The disjoint union of two charted spaces modelled on a non-empty space `H` is a charted space over `H`. -/ +@[implicit_reducible] def ChartedSpace.sum_of_nonempty [Nonempty H] : ChartedSpace H (M ⊕ M') where atlas := ((fun e ↦ e.lift_openEmbedding IsOpenEmbedding.inl) '' cm.atlas) ∪ ((fun e ↦ e.lift_openEmbedding IsOpenEmbedding.inr) '' cm'.atlas) @@ -588,6 +591,7 @@ namespace ChartedSpaceCore variable [TopologicalSpace H] (c : ChartedSpaceCore H M) {e : PartialEquiv M H} /-- Topology generated by a set of charts on a Type. -/ +@[implicit_reducible] protected def toTopologicalSpace : TopologicalSpace M := TopologicalSpace.generateFrom <| ⋃ (e : PartialEquiv M H) (_ : e ∈ c.atlas) (s : Set H) (_ : IsOpen s), @@ -645,6 +649,7 @@ protected def openPartialHomeomorph (e : PartialEquiv M H) (he : e ∈ c.atlas) /-- Given a charted space without topology, endow it with a genuine charted space structure with respect to the topology constructed from the atlas. -/ +@[implicit_reducible] def toChartedSpace : @ChartedSpace H _ M c.toTopologicalSpace := { __ := c.toTopologicalSpace atlas := ⋃ (e : PartialEquiv M H) (he : e ∈ c.atlas), {c.openPartialHomeomorph e he} diff --git a/Mathlib/Geometry/Manifold/HasGroupoid.lean b/Mathlib/Geometry/Manifold/HasGroupoid.lean index fb3ac3d4e71d90..8db797c83a66a9 100644 --- a/Mathlib/Geometry/Manifold/HasGroupoid.lean +++ b/Mathlib/Geometry/Manifold/HasGroupoid.lean @@ -201,6 +201,7 @@ variable (e : OpenPartialHomeomorph α H) whole space `α`, then that open partial homeomorphism induces an `H`-charted space structure on `α`. (This condition is equivalent to `e` being an open embedding of `α` into `H`; see `IsOpenEmbedding.singletonChartedSpace`.) -/ +@[implicit_reducible] def singletonChartedSpace (h : e.source = Set.univ) : ChartedSpace H α where atlas := {e} chartAt _ := e @@ -242,6 +243,7 @@ variable [Nonempty α] /-- An open embedding of `α` into `H` induces an `H`-charted space structure on `α`. See `OpenPartialHomeomorph.singletonChartedSpace`. -/ +@[implicit_reducible] def singletonChartedSpace {f : α → H} (h : IsOpenEmbedding f) : ChartedSpace H α := (h.toOpenPartialHomeomorph f).singletonChartedSpace (toOpenPartialHomeomorph_source _ _) diff --git a/Mathlib/Geometry/Manifold/PartitionOfUnity.lean b/Mathlib/Geometry/Manifold/PartitionOfUnity.lean index 6a9914b406e437..eb51dcda5c5a12 100644 --- a/Mathlib/Geometry/Manifold/PartitionOfUnity.lean +++ b/Mathlib/Geometry/Manifold/PartitionOfUnity.lean @@ -420,6 +420,7 @@ theorem mem_extChartAt_ind_source (x : M) (hx : x ∈ s) : fs.mem_extChartAt_source_of_eq_one (fs.apply_ind x hx) /-- The index type of a `SmoothBumpCovering` of a compact manifold is finite. -/ +@[implicit_reducible] protected def fintype [CompactSpace M] : Fintype ι := fs.locallyFinite.fintypeOfCompact fun i => (fs i).nonempty_support diff --git a/Mathlib/Geometry/Manifold/VectorBundle/LocalFrame.lean b/Mathlib/Geometry/Manifold/VectorBundle/LocalFrame.lean index e97d641a462961..3e2422b1b3d769 100644 --- a/Mathlib/Geometry/Manifold/VectorBundle/LocalFrame.lean +++ b/Mathlib/Geometry/Manifold/VectorBundle/LocalFrame.lean @@ -172,6 +172,7 @@ lemma toBasisAt_coe (hs : IsLocalFrameOn I F n s u) (hx : x ∈ u) (i : ι) : /-- If `{sᵢ}` is a local frame on a vector bundle, `F` being finite-dimensional implies the indexing set being finite. -/ +@[implicit_reducible] noncomputable def fintypeOfFiniteDimensional [VectorBundle 𝕜 F V] [FiniteDimensional 𝕜 F] (hs : IsLocalFrameOn I F n s u) (hx : x ∈ u) : Fintype ι := by have : FiniteDimensional 𝕜 (V x) := by diff --git a/Mathlib/GroupTheory/Coset/Defs.lean b/Mathlib/GroupTheory/Coset/Defs.lean index 42623ede6c7596..05e7df77897d42 100644 --- a/Mathlib/GroupTheory/Coset/Defs.lean +++ b/Mathlib/GroupTheory/Coset/Defs.lean @@ -60,7 +60,7 @@ variable [Group α] (s : Subgroup α) /-- The equivalence relation corresponding to the partition of a group by left cosets of a subgroup. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- The equivalence relation corresponding to the partition of a group by left cosets of a subgroup. -/] def leftRel : Setoid α := @@ -100,8 +100,9 @@ instance [DecidablePred (· ∈ s)] : DecidableEq (α ⧸ s) := /-- The equivalence relation corresponding to the partition of a group by right cosets of a subgroup. -/ -@[to_additive /-- The equivalence relation corresponding to the partition of a group by right cosets -of a subgroup. -/] +@[to_additive (attr := implicit_reducible) + /-- The equivalence relation corresponding to the partition of a group by right cosets + of a subgroup. -/] def rightRel : Setoid α := MulAction.orbitRel s α diff --git a/Mathlib/GroupTheory/Divisible.lean b/Mathlib/GroupTheory/Divisible.lean index fcaa85776e7638..5e8bf984cfff90 100644 --- a/Mathlib/GroupTheory/Divisible.lean +++ b/Mathlib/GroupTheory/Divisible.lean @@ -119,8 +119,9 @@ theorem pow_left_surj_of_rootableBy [RootableBy A α] {n : α} (hn : n ≠ 0) : A `Monoid A` is `α`-rootable iff the `pow _ n` function is surjective, i.e. the constructive version implies the textbook approach. -/ -@[to_additive divisibleByOfSMulRightSurj /-- An `AddMonoid A` is `α`-divisible iff `n • _` is a -surjective function, i.e. the constructive version implies the textbook approach. -/] +@[to_additive (attr := implicit_reducible) divisibleByOfSMulRightSurj + /-- An `AddMonoid A` is `α`-divisible iff `n • _` is a surjective function, i.e. the + constructive version implies the textbook approach. -/] noncomputable def rootableByOfPowLeftSurj (H : ∀ {n : α}, n ≠ 0 → Function.Surjective (fun a => a ^ n : A → A)) : RootableBy A α where root a n := @dite _ (n = 0) (Classical.dec _) (fun _ => (1 : A)) fun hn => (H hn a).choose @@ -178,6 +179,7 @@ theorem smul_top_eq_top_of_divisibleBy_int [DivisibleBy A ℤ] {n : ℤ} (hn : n /-- If for all `n ≠ 0 ∈ ℤ`, `n • A = A`, then `A` is divisible. -/ +@[implicit_reducible] noncomputable def divisibleByIntOfSMulTopEqTop (H : ∀ {n : ℤ} (_hn : n ≠ 0), n • (⊤ : AddSubgroup A) = ⊤) : DivisibleBy A ℤ where div a n := @@ -239,7 +241,7 @@ variable (f : A → B) /-- If `f : A → B` is a surjective homomorphism and `A` is `α`-rootable, then `B` is also `α`-rootable. -/ -@[to_additive +@[to_additive (attr := implicit_reducible) /-- If `f : A → B` is a surjective homomorphism and `A` is `α`-divisible, then `B` is also `α`-divisible. -/] noncomputable def Function.Surjective.rootableBy (hf : Function.Surjective f) diff --git a/Mathlib/GroupTheory/DoubleCoset.lean b/Mathlib/GroupTheory/DoubleCoset.lean index 8309b21a438920..5c05129f90da57 100644 --- a/Mathlib/GroupTheory/DoubleCoset.lean +++ b/Mathlib/GroupTheory/DoubleCoset.lean @@ -72,6 +72,7 @@ theorem eq_of_not_disjoint {H K : Subgroup G} {a b : G} apply doubleCoset_eq_of_mem ha /-- The setoid defined by the double_coset relation -/ +@[implicit_reducible] def setoid (H K : Set G) : Setoid G := Setoid.ker fun x => doubleCoset x H K diff --git a/Mathlib/GroupTheory/FixedPointFree.lean b/Mathlib/GroupTheory/FixedPointFree.lean index 2f5bf36c88ccc6..0667459f420b41 100644 --- a/Mathlib/GroupTheory/FixedPointFree.lean +++ b/Mathlib/GroupTheory/FixedPointFree.lean @@ -71,6 +71,7 @@ theorem commute_all_of_involutive (hφ : FixedPointFree φ) (h2 : Function.Invol rwa [hφ.coe_eq_inv_of_involutive h2, inv_eq_iff_eq_inv, mul_inv_rev, inv_inv, inv_inv] at key /-- If a finite group admits a fixed-point-free involution, then it is commutative. -/ +@[implicit_reducible] def commGroupOfInvolutive (hφ : FixedPointFree φ) (h2 : Function.Involutive φ) : CommGroup G := .mk (hφ.commute_all_of_involutive h2) diff --git a/Mathlib/GroupTheory/Index.lean b/Mathlib/GroupTheory/Index.lean index 3cf4028c6663bb..109e2406479a8f 100644 --- a/Mathlib/GroupTheory/Index.lean +++ b/Mathlib/GroupTheory/Index.lean @@ -688,7 +688,7 @@ theorem not_finiteIndex_iff {G : Type*} [Group G] {H : Subgroup G} : ¬ H.FiniteIndex ↔ H.index = 0 := by simp [finiteIndex_iff] /-- A finite index subgroup has finite quotient. -/ -@[to_additive (attr := instance_reducible) /-- A finite index subgroup has finite quotient -/] +@[to_additive (attr := implicit_reducible) /-- A finite index subgroup has finite quotient -/] noncomputable def fintypeQuotientOfFiniteIndex [FiniteIndex H] : Fintype (G ⧸ H) := fintypeOfIndexNeZero FiniteIndex.index_ne_zero diff --git a/Mathlib/GroupTheory/Nilpotent.lean b/Mathlib/GroupTheory/Nilpotent.lean index 9b21eb8cc5c088..baf957b92d233e 100644 --- a/Mathlib/GroupTheory/Nilpotent.lean +++ b/Mathlib/GroupTheory/Nilpotent.lean @@ -689,6 +689,7 @@ theorem CommGroup.nilpotencyClass_le_one {G : Type*} [CommGroup G] : apply CommGroup.center_eq_top /-- Groups with nilpotency class at most one are abelian -/ +@[implicit_reducible] def commGroupOfNilpotencyClass [IsNilpotent G] (h : Group.nilpotencyClass G ≤ 1) : CommGroup G := Group.commGroupOfCenterEqTop <| by rw [← upperCentralSeries_one] diff --git a/Mathlib/GroupTheory/OreLocalization/Basic.lean b/Mathlib/GroupTheory/OreLocalization/Basic.lean index 41cd7d1203b96b..f6867fd3b5a6db 100644 --- a/Mathlib/GroupTheory/OreLocalization/Basic.lean +++ b/Mathlib/GroupTheory/OreLocalization/Basic.lean @@ -59,7 +59,7 @@ namespace OreLocalization variable {R : Type*} [Monoid R] (S : Submonoid R) [OreSet S] (X) [MulAction R X] /-- The setoid on `R × S` used for the Ore localization. -/ -@[to_additive (attr := instance_reducible) AddOreLocalization.oreEqv +@[to_additive (attr := implicit_reducible) AddOreLocalization.oreEqv /-- The setoid on `R × S` used for the Ore localization. -/] def oreEqv : Setoid (X × S) where r rs rs' := ∃ (u : S) (v : R), u • rs'.1 = v • rs.1 ∧ u * rs'.2 = v * rs.2 diff --git a/Mathlib/GroupTheory/PGroup.lean b/Mathlib/GroupTheory/PGroup.lean index 6a14bd53b5bdaf..451c164ddc3f6c 100644 --- a/Mathlib/GroupTheory/PGroup.lean +++ b/Mathlib/GroupTheory/PGroup.lean @@ -369,6 +369,7 @@ theorem cyclic_center_quotient_of_card_eq_prime_sq (hG : Nat.card G = p ^ 2) : /-- A group of order `p ^ 2` is commutative. See also `IsPGroup.commutative_of_card_eq_prime_sq` for just the proof that `∀ a b, a * b = b * a` -/ +@[implicit_reducible] def commGroupOfCardEqPrimeSq (hG : Nat.card G = p ^ 2) : CommGroup G := @commGroupOfCyclicCenterQuotient _ _ _ _ (cyclic_center_quotient_of_card_eq_prime_sq hG) _ (QuotientGroup.ker_mk' (center G)).le diff --git a/Mathlib/GroupTheory/Perm/Centralizer.lean b/Mathlib/GroupTheory/Perm/Centralizer.lean index f6b40d854cbe97..147810bd35a6ad 100644 --- a/Mathlib/GroupTheory/Perm/Centralizer.lean +++ b/Mathlib/GroupTheory/Perm/Centralizer.lean @@ -128,6 +128,7 @@ lemma Subgroup.Centralizer.toConjAct_smul_mem_cycleFactorsFinset {k c : Perm α} /-- The action by conjugation of `Subgroup.centralizer {g}` on the cycles of a given permutation -/ +@[implicit_reducible] def Subgroup.Centralizer.cycleFactorsFinset_mulAction : MulAction (centralizer {g}) g.cycleFactorsFinset where smul k c := ⟨ConjAct.toConjAct (k : Perm α) • c.val, diff --git a/Mathlib/GroupTheory/Perm/Cycle/Basic.lean b/Mathlib/GroupTheory/Perm/Cycle/Basic.lean index b80e8e637c68f2..83506be89a3efe 100644 --- a/Mathlib/GroupTheory/Perm/Cycle/Basic.lean +++ b/Mathlib/GroupTheory/Perm/Cycle/Basic.lean @@ -78,6 +78,7 @@ theorem SameCycle.equivalence : Equivalence (SameCycle f) := ⟨SameCycle.refl f, SameCycle.symm, SameCycle.trans⟩ /-- The setoid defined by the `SameCycle` relation. -/ +@[implicit_reducible] def SameCycle.setoid (f : Perm α) : Setoid α where r := f.SameCycle iseqv := SameCycle.equivalence f diff --git a/Mathlib/GroupTheory/Perm/Sign.lean b/Mathlib/GroupTheory/Perm/Sign.lean index b56ceff0b0b3c9..17876c56574cb5 100644 --- a/Mathlib/GroupTheory/Perm/Sign.lean +++ b/Mathlib/GroupTheory/Perm/Sign.lean @@ -44,6 +44,7 @@ namespace Equiv.Perm We use this to partition permutations in `Matrix.det_zero_of_row_eq`, such that each partition sums up to `0`. -/ +@[implicit_reducible] def modSwap (i j : α) : Setoid (Perm α) := ⟨fun σ τ => σ = τ ∨ σ = swap i j * τ, fun σ => Or.inl (refl σ), fun {σ τ} h => Or.casesOn h (fun h => Or.inl h.symm) fun h => Or.inr (by rw [h, swap_mul_self_mul]), diff --git a/Mathlib/GroupTheory/QuotientGroup/Finite.lean b/Mathlib/GroupTheory/QuotientGroup/Finite.lean index 6f2209b753e433..dc0fb0f6e769b3 100644 --- a/Mathlib/GroupTheory/QuotientGroup/Finite.lean +++ b/Mathlib/GroupTheory/QuotientGroup/Finite.lean @@ -27,7 +27,7 @@ namespace Group open scoped Classical in /-- If `F` and `H` are finite such that `ker(G →* H) ≤ im(F →* G)`, then `G` is finite. -/ -@[to_additive +@[to_additive (attr := implicit_reducible) /-- If `F` and `H` are finite such that `ker(G →+ H) ≤ im(F →+ G)`, then `G` is finite. -/] noncomputable def fintypeOfKerLeRange (h : g.ker ≤ f.range) : Fintype G := @Fintype.ofEquiv _ _ @@ -36,7 +36,7 @@ noncomputable def fintypeOfKerLeRange (h : g.ker ≤ f.range) : Fintype G := groupEquivQuotientProdSubgroup.symm /-- If `F` and `H` are finite such that `ker(G →* H) = im(F →* G)`, then `G` is finite. -/ -@[to_additive +@[to_additive (attr := implicit_reducible) /-- If `F` and `H` are finite such that `ker(G →+ H) = im(F →+ G)`, then `G` is finite. -/] noncomputable def fintypeOfKerEqRange (h : g.ker = f.range) : Fintype G := fintypeOfKerLeRange _ _ h.le diff --git a/Mathlib/GroupTheory/SpecificGroups/Cyclic.lean b/Mathlib/GroupTheory/SpecificGroups/Cyclic.lean index 9d05c039fa8041..6ed511fd05cdd8 100644 --- a/Mathlib/GroupTheory/SpecificGroups/Cyclic.lean +++ b/Mathlib/GroupTheory/SpecificGroups/Cyclic.lean @@ -104,7 +104,7 @@ instance IsCyclic.commutative [Group α] [IsCyclic α] : /-- A cyclic group is always commutative. This is not an `instance` because often we have a better proof of `CommGroup`. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- A cyclic group is always commutative. This is not an `instance` because often we have a better proof of `AddCommGroup`. -/] def IsCyclic.commGroup [hg : Group α] [IsCyclic α] : CommGroup α := @@ -591,7 +591,7 @@ theorem commutative_of_cyclic_center_quotient [IsCyclic G'] (f : G →* G') (hf _ = b * a := by group /-- A group is commutative if the quotient by the center is cyclic. -/ -@[to_additive +@[to_additive (attr := implicit_reducible) /-- A group is commutative if the quotient by the center is cyclic. -/] def commGroupOfCyclicCenterQuotient [IsCyclic G'] (f : G →* G') (hf : f.ker ≤ center G) : CommGroup G := diff --git a/Mathlib/GroupTheory/Subgroup/Center.lean b/Mathlib/GroupTheory/Subgroup/Center.lean index 1369b740729004..2fdf802f21ad3b 100644 --- a/Mathlib/GroupTheory/Subgroup/Center.lean +++ b/Mathlib/GroupTheory/Subgroup/Center.lean @@ -79,6 +79,7 @@ theorem _root_.CommGroup.center_eq_top {G : Type*} [CommGroup G] : center G = exact mul_comm y x /-- A group is commutative if the center is the whole group -/ +@[implicit_reducible] def _root_.Group.commGroupOfCenterEqTop (h : center G = ⊤) : CommGroup G := { ‹Group G› with mul_comm := by diff --git a/Mathlib/GroupTheory/Sylow.lean b/Mathlib/GroupTheory/Sylow.lean index 06c775dfa4db3a..a85b68e4d96d80 100644 --- a/Mathlib/GroupTheory/Sylow.lean +++ b/Mathlib/GroupTheory/Sylow.lean @@ -720,6 +720,7 @@ theorem card_eq_multiplicity [Finite G] {p : ℕ} [hp : Fact p.Prime] (P : Sylow exact P.1.card_subgroup_dvd_card /-- If `G` has a normal Sylow `p`-subgroup, then it is the only Sylow `p`-subgroup. -/ +@[implicit_reducible] noncomputable def unique_of_normal {p : ℕ} [Fact p.Prime] [Finite (Sylow p G)] (P : Sylow p G) (h : P.Normal) : Unique (Sylow p G) := by refine { uniq := fun Q ↦ ?_ } diff --git a/Mathlib/LinearAlgebra/Basis/Defs.lean b/Mathlib/LinearAlgebra/Basis/Defs.lean index 2b9f2609378222..daaf333eb880b6 100644 --- a/Mathlib/LinearAlgebra/Basis/Defs.lean +++ b/Mathlib/LinearAlgebra/Basis/Defs.lean @@ -229,6 +229,7 @@ def Basis.equivFun [Finite ι] (b : Basis ι R M) : M ≃ₗ[R] ι → R := (ι →₀ R) ≃ₗ[R] ι → R) /-- A module over a finite ring that admits a finite basis is finite. -/ +@[implicit_reducible] def fintypeOfFintype [Fintype ι] (b : Basis ι R M) [Fintype R] : Fintype M := haveI := Classical.decEq ι Fintype.ofEquiv _ b.equivFun.toEquiv.symm diff --git a/Mathlib/LinearAlgebra/CliffordAlgebra/Inversion.lean b/Mathlib/LinearAlgebra/CliffordAlgebra/Inversion.lean index fd6c69670b2cb7..47e386a8f5cb7d 100644 --- a/Mathlib/LinearAlgebra/CliffordAlgebra/Inversion.lean +++ b/Mathlib/LinearAlgebra/CliffordAlgebra/Inversion.lean @@ -23,6 +23,7 @@ namespace CliffordAlgebra variable (Q) /-- If the quadratic form of a vector is invertible, then so is that vector. -/ +@[implicit_reducible] def invertibleιOfInvertible (m : M) [Invertible (Q m)] : Invertible (ι Q m) where invOf := ι Q (⅟(Q m) • m) invOf_mul_self := by @@ -58,6 +59,7 @@ variable [Invertible (2 : R)] set_option backward.isDefEq.respectTransparency false in /-- Over a ring where `2` is invertible, `Q m` is invertible whenever `ι Q m`. -/ +@[implicit_reducible] def invertibleOfInvertibleι (m : M) [Invertible (ι Q m)] : Invertible (Q m) := ExteriorAlgebra.invertibleAlgebraMapEquiv M (Q m) <| .algebraMapOfInvertibleAlgebraMap (equivExterior Q).toLinearMap (by simp) <| diff --git a/Mathlib/LinearAlgebra/Dimension/Finite.lean b/Mathlib/LinearAlgebra/Dimension/Finite.lean index b65336015f8d61..471aca8dac0637 100644 --- a/Mathlib/LinearAlgebra/Dimension/Finite.lean +++ b/Mathlib/LinearAlgebra/Dimension/Finite.lean @@ -139,6 +139,7 @@ theorem Module.Basis.nonempty_fintype_index_of_rank_lt_aleph0 {ι : Type*} (b : Cardinal.lt_aleph0_iff_fintype] at h /-- If a module has a finite dimension, all bases are indexed by a finite type. -/ +@[implicit_reducible] noncomputable def Module.Basis.fintypeIndexOfRankLtAleph0 {ι : Type*} (b : Basis ι R M) (h : Module.rank R M < ℵ₀) : Fintype ι := Classical.choice (b.nonempty_fintype_index_of_rank_lt_aleph0 h) @@ -268,6 +269,7 @@ theorem iSupIndep.subtype_ne_bot_le_finrank_aux /-- If `p` is an independent family of submodules of an `R`-finite module `M`, then the number of nontrivial subspaces in the family `p` is finite. -/ +@[implicit_reducible] noncomputable def iSupIndep.fintypeNeBotOfFiniteDimensional {p : ι → Submodule R M} (hp : iSupIndep p) : Fintype { i : ι // p i ≠ ⊥ } := by diff --git a/Mathlib/LinearAlgebra/Dimension/StrongRankCondition.lean b/Mathlib/LinearAlgebra/Dimension/StrongRankCondition.lean index 1189421e069d77..c2d143762d0fbe 100644 --- a/Mathlib/LinearAlgebra/Dimension/StrongRankCondition.lean +++ b/Mathlib/LinearAlgebra/Dimension/StrongRankCondition.lean @@ -478,6 +478,7 @@ theorem finrank_self : finrank R R = 1 := finrank_eq_of_rank_eq (by simp) /-- Given a basis of a ring over itself indexed by a type `ι`, then `ι` is `Unique`. -/ +@[implicit_reducible] noncomputable def _root_.Module.Basis.unique {ι : Type*} (b : Basis ι R R) : Unique ι := by have : Cardinal.mk ι = ↑(Module.finrank R R) := (Module.mk_finrank_eq_card_basis b).symm have : Subsingleton ι ∧ Nonempty ι := by simpa [Cardinal.eq_one_iff_unique] diff --git a/Mathlib/LinearAlgebra/FiniteDimensional/Basic.lean b/Mathlib/LinearAlgebra/FiniteDimensional/Basic.lean index 51725becb98321..701bb7a6c26d30 100644 --- a/Mathlib/LinearAlgebra/FiniteDimensional/Basic.lean +++ b/Mathlib/LinearAlgebra/FiniteDimensional/Basic.lean @@ -481,6 +481,7 @@ lemma FiniteDimensional.exists_mul_eq_one (F : Type*) {K : Type*} [Field F] [Rin exact this 1 /-- A domain that is module-finite as an algebra over a field is a division ring. -/ +@[implicit_reducible] noncomputable def divisionRingOfFiniteDimensional (F K : Type*) [Field F] [Ring K] [IsDomain K] [Algebra F K] [FiniteDimensional F K] : DivisionRing K where __ := ‹IsDomain K› @@ -501,6 +502,7 @@ lemma FiniteDimensional.isUnit (F : Type*) {K : Type*} [Field F] [Ring K] [IsDom let _ := divisionRingOfFiniteDimensional F K; H.isUnit /-- An integral domain that is module-finite as an algebra over a field is a field. -/ +@[implicit_reducible] noncomputable def fieldOfFiniteDimensional (F K : Type*) [Field F] [h : CommRing K] [IsDomain K] [Algebra F K] [FiniteDimensional F K] : Field K := { divisionRingOfFiniteDimensional F K with diff --git a/Mathlib/LinearAlgebra/FiniteDimensional/Defs.lean b/Mathlib/LinearAlgebra/FiniteDimensional/Defs.lean index 55f86eec9f9c02..1186d35f74b29f 100644 --- a/Mathlib/LinearAlgebra/FiniteDimensional/Defs.lean +++ b/Mathlib/LinearAlgebra/FiniteDimensional/Defs.lean @@ -111,6 +111,7 @@ theorem _root_.Module.Basis.finiteDimensional_of_finite {ι : Type w} [Finite ι alias of_fintype_basis := Module.Basis.finiteDimensional_of_finite /-- If a vector space is `FiniteDimensional`, all bases are indexed by a finite type -/ +@[implicit_reducible] noncomputable def fintypeBasisIndex {ι : Type*} [FiniteDimensional K V] (b : Basis ι K V) : Fintype ι := @Fintype.ofFinite _ (Module.Finite.finite_basis b) diff --git a/Mathlib/LinearAlgebra/Matrix/Basis.lean b/Mathlib/LinearAlgebra/Matrix/Basis.lean index 3762820a60b1c0..6cc2855fc54d87 100644 --- a/Mathlib/LinearAlgebra/Matrix/Basis.lean +++ b/Mathlib/LinearAlgebra/Matrix/Basis.lean @@ -258,6 +258,7 @@ theorem toMatrix_mul_toMatrix_flip [DecidableEq ι] [Fintype ι'] : b.toMatrix b' * b'.toMatrix b = 1 := by rw [toMatrix_mul_toMatrix, toMatrix_self] /-- A matrix whose columns form a basis `b'`, expressed w.r.t. a basis `b`, is invertible. -/ +@[implicit_reducible] def invertibleToMatrix [DecidableEq ι] [Fintype ι] (b b' : Basis ι R₂ M₂) : Invertible (b.toMatrix b') := ⟨b'.toMatrix b, toMatrix_mul_toMatrix_flip _ _, toMatrix_mul_toMatrix_flip _ _⟩ diff --git a/Mathlib/LinearAlgebra/Matrix/Block.lean b/Mathlib/LinearAlgebra/Matrix/Block.lean index 96ce3424d703b0..a173c67c3cbd03 100644 --- a/Mathlib/LinearAlgebra/Matrix/Block.lean +++ b/Mathlib/LinearAlgebra/Matrix/Block.lean @@ -332,6 +332,7 @@ theorem BlockTriangular.inv_toBlock [LinearOrder α] [Invertible M] (hM : BlockT inv_eq_left_inv <| hM.toBlock_inverse_mul_toBlock_eq_one k /-- An upper-left subblock of an invertible block-triangular matrix is invertible. -/ +@[implicit_reducible] def BlockTriangular.invertibleToBlock [LinearOrder α] [Invertible M] (hM : BlockTriangular M b) (k : α) : Invertible (M.toBlock (fun i => b i < k) fun i => b i < k) := invertibleOfLeftInverse _ ((⅟M).toBlock (fun i => b i < k) fun i => b i < k) <| by diff --git a/Mathlib/LinearAlgebra/Matrix/GeneralLinearGroup/Projective.lean b/Mathlib/LinearAlgebra/Matrix/GeneralLinearGroup/Projective.lean index 127e129f992daa..25ade94d8031fa 100644 --- a/Mathlib/LinearAlgebra/Matrix/GeneralLinearGroup/Projective.lean +++ b/Mathlib/LinearAlgebra/Matrix/GeneralLinearGroup/Projective.lean @@ -76,6 +76,7 @@ theorem lift_comp_mk {f : GL n R →* M} (hf) : (lift f hf).comp mk = f := by /-- Given an action of `GL n R` such that the scalar matrices act trivially, define an action of `PGL n R`. -/ +@[implicit_reducible] def mulActionOfGL {α : Type*} [MulAction (GL n R) α] (h : ∀ (u : Rˣ) (a : α), GeneralLinearGroup.scalar n u • a = a) : MulAction (PGL(n, R)) α := diff --git a/Mathlib/LinearAlgebra/Matrix/Irreducible/Defs.lean b/Mathlib/LinearAlgebra/Matrix/Irreducible/Defs.lean index 78d483e09cf634..35da6988979f1e 100644 --- a/Mathlib/LinearAlgebra/Matrix/Irreducible/Defs.lean +++ b/Mathlib/LinearAlgebra/Matrix/Irreducible/Defs.lean @@ -73,6 +73,7 @@ variable {n R : Type*} [Ring R] [LinearOrder R] /-- The directed graph (quiver) associated with a matrix `A`, with an edge `i ⟶ j` iff `0 < A i j`. -/ +@[implicit_reducible] def toQuiver (A : Matrix n n R) : Quiver n := ⟨fun i j => PLift (0 < A i j)⟩ diff --git a/Mathlib/LinearAlgebra/Matrix/NonsingularInverse.lean b/Mathlib/LinearAlgebra/Matrix/NonsingularInverse.lean index 1173fe8729ce1a..3417f6ddcee531 100644 --- a/Mathlib/LinearAlgebra/Matrix/NonsingularInverse.lean +++ b/Mathlib/LinearAlgebra/Matrix/NonsingularInverse.lean @@ -74,6 +74,7 @@ variable [Fintype n] [DecidableEq n] [CommRing α] variable (A : Matrix n n α) (B : Matrix n n α) /-- If `A.det` has a constructive inverse, produce one for `A`. -/ +@[implicit_reducible] def invertibleOfDetInvertible [Invertible A.det] : Invertible A where invOf := ⅟A.det • A.adjugate mul_invOf_self := by @@ -86,18 +87,21 @@ theorem invOf_eq [Invertible A.det] [Invertible A] : ⅟A = ⅟A.det • A.adjug convert (rfl : ⅟A = _) /-- `A.det` is invertible if `A` has a left inverse. -/ +@[implicit_reducible] def detInvertibleOfLeftInverse (h : B * A = 1) : Invertible A.det where invOf := B.det mul_invOf_self := by rw [mul_comm, ← det_mul, h, det_one] invOf_mul_self := by rw [← det_mul, h, det_one] /-- `A.det` is invertible if `A` has a right inverse. -/ +@[implicit_reducible] def detInvertibleOfRightInverse (h : A * B = 1) : Invertible A.det where invOf := B.det mul_invOf_self := by rw [← det_mul, h, det_one] invOf_mul_self := by rw [mul_comm, ← det_mul, h, det_one] /-- If `A` has a constructive inverse, produce one for `A.det`. -/ +@[implicit_reducible] def detInvertibleOfInvertible [Invertible A] : Invertible A.det := detInvertibleOfLeftInverse A (⅟A) (invOf_mul_self _) @@ -438,6 +442,7 @@ theorem isUnit_nonsing_inv_iff {A : Matrix n n α} : IsUnit A⁻¹ ↔ IsUnit A -- `IsUnit.invertible` lifts the proposition `IsUnit A` to a constructive inverse of `A`. /-- A version of `Matrix.invertibleOfDetInvertible` with the inverse defeq to `A⁻¹` that is therefore noncomputable. -/ +@[implicit_reducible] noncomputable def invertibleOfIsUnitDet (h : IsUnit A.det) : Invertible A := ⟨A⁻¹, nonsing_inv_mul A h, mul_nonsing_inv A h⟩ @@ -518,6 +523,7 @@ theorem inv_adjugate (A : Matrix n n α) (h : IsUnit A.det) : (adjugate A)⁻¹ section Diagonal /-- `diagonal v` is invertible if `v` is -/ +@[implicit_reducible] def diagonalInvertible {α} [NonAssocSemiring α] (v : n → α) [Invertible v] : Invertible (diagonal v) := Invertible.map (diagonalRingHom n α) v @@ -528,6 +534,7 @@ theorem invOf_diagonal_eq {α} [Semiring α] (v : n → α) [Invertible v] [Inve rfl /-- `v` is invertible if `diagonal v` is -/ +@[implicit_reducible] def invertibleOfDiagonalInvertible (v : n → α) [Invertible (diagonal v)] : Invertible v where invOf := diag (⅟(diagonal v)) invOf_mul_self := @@ -675,12 +682,14 @@ variable [Fintype m] variable [DecidableEq m] /-- `A.submatrix e₁ e₂` is invertible if `A` is -/ +@[implicit_reducible] def submatrixEquivInvertible (A : Matrix m m α) (e₁ e₂ : n ≃ m) [Invertible A] : Invertible (A.submatrix e₁ e₂) := invertibleOfRightInverse _ ((⅟A).submatrix e₂ e₁) <| by rw [Matrix.submatrix_mul_equiv, mul_invOf_self, submatrix_one_equiv] /-- `A` is invertible if `A.submatrix e₁ e₂` is -/ +@[implicit_reducible] def invertibleOfSubmatrixEquivInvertible (A : Matrix m m α) (e₁ e₂ : n ≃ m) [Invertible (A.submatrix e₁ e₂)] : Invertible A := invertibleOfRightInverse _ ((⅟(A.submatrix e₁ e₂)).submatrix e₂.symm e₁.symm) <| by diff --git a/Mathlib/LinearAlgebra/Matrix/SchurComplement.lean b/Mathlib/LinearAlgebra/Matrix/SchurComplement.lean index c8bccb3134b2af..8e12547a8067d1 100644 --- a/Mathlib/LinearAlgebra/Matrix/SchurComplement.lean +++ b/Mathlib/LinearAlgebra/Matrix/SchurComplement.lean @@ -74,6 +74,7 @@ section Triangular /-- An upper-block-triangular matrix is invertible if its diagonal is. -/ +@[implicit_reducible] def fromBlocksZero₂₁Invertible (A : Matrix m m α) (B : Matrix m n α) (D : Matrix n n α) [Invertible A] [Invertible D] : Invertible (fromBlocks A B 0 D) := invertibleOfLeftInverse _ (fromBlocks (⅟A) (-(⅟A * B * ⅟D)) 0 (⅟D)) <| by @@ -82,6 +83,7 @@ def fromBlocksZero₂₁Invertible (A : Matrix m m α) (B : Matrix m n α) (D : fromBlocks_one] /-- A lower-block-triangular matrix is invertible if its diagonal is. -/ +@[implicit_reducible] def fromBlocksZero₁₂Invertible (A : Matrix m m α) (C : Matrix n m α) (D : Matrix n n α) [Invertible A] [Invertible D] : Invertible (fromBlocks A 0 C D) := invertibleOfLeftInverse _ @@ -227,6 +229,7 @@ section Block /-- A block matrix is invertible if the bottom right corner and the corresponding Schur complement is. -/ +@[implicit_reducible] def fromBlocks₂₂Invertible (A : Matrix m m α) (B : Matrix m n α) (C : Matrix n m α) (D : Matrix n n α) [Invertible D] [Invertible (A - B * ⅟D * C)] : Invertible (fromBlocks A B C D) := by @@ -254,6 +257,7 @@ def fromBlocks₂₂Invertible (A : Matrix m m α) (B : Matrix m n α) (C : Matr /-- A block matrix is invertible if the top left corner and the corresponding Schur complement is. -/ +@[implicit_reducible] def fromBlocks₁₁Invertible (A : Matrix m m α) (B : Matrix m n α) (C : Matrix n m α) (D : Matrix n n α) [Invertible A] [Invertible (D - C * ⅟A * B)] : Invertible (fromBlocks A B C D) := by @@ -288,6 +292,7 @@ theorem invOf_fromBlocks₁₁_eq (A : Matrix m m α) (B : Matrix m n α) (C : M /-- If a block matrix is invertible and so is its bottom left element, then so is the corresponding Schur complement. -/ +@[implicit_reducible] def invertibleOfFromBlocks₂₂Invertible (A : Matrix m m α) (B : Matrix m n α) (C : Matrix n m α) (D : Matrix n n α) [Invertible D] [Invertible (fromBlocks A B C D)] : Invertible (A - B * ⅟D * C) := by @@ -305,6 +310,7 @@ def invertibleOfFromBlocks₂₂Invertible (A : Matrix m m α) (B : Matrix m n /-- If a block matrix is invertible and so is its bottom left element, then so is the corresponding Schur complement. -/ +@[implicit_reducible] def invertibleOfFromBlocks₁₁Invertible (A : Matrix m m α) (B : Matrix m n α) (C : Matrix n m α) (D : Matrix n n α) [Invertible A] [Invertible (fromBlocks A B C D)] : Invertible (D - C * ⅟A * B) := by diff --git a/Mathlib/LinearAlgebra/Matrix/SemiringInverse.lean b/Mathlib/LinearAlgebra/Matrix/SemiringInverse.lean index 81e05bb81d1f59..8ec6ebf676d1d9 100644 --- a/Mathlib/LinearAlgebra/Matrix/SemiringInverse.lean +++ b/Mathlib/LinearAlgebra/Matrix/SemiringInverse.lean @@ -239,12 +239,12 @@ instance (priority := low) instIsStablyFiniteRingOfCommSemiring : IsStablyFinite variable (A B) /-- We can construct an instance of invertible A if A has a left inverse. -/ -@[deprecated invertibleOfLeftInverse (since := "2025-12-06")] +@[deprecated invertibleOfLeftInverse (since := "2025-12-06"), implicit_reducible] protected def invertibleOfLeftInverse (h : B * A = 1) : Invertible A := invertibleOfLeftInverse _ _ h /-- We can construct an instance of invertible A if A has a right inverse. -/ -@[deprecated invertibleOfRightInverse (since := "2025-12-06")] +@[deprecated invertibleOfRightInverse (since := "2025-12-06"), implicit_reducible] protected def invertibleOfRightInverse (h : A * B = 1) : Invertible A := invertibleOfRightInverse _ _ h diff --git a/Mathlib/LinearAlgebra/Projectivization/Basic.lean b/Mathlib/LinearAlgebra/Projectivization/Basic.lean index a70fb4efb0c8c6..819a4587eb8fdc 100644 --- a/Mathlib/LinearAlgebra/Projectivization/Basic.lean +++ b/Mathlib/LinearAlgebra/Projectivization/Basic.lean @@ -39,6 +39,7 @@ We have three ways to construct terms of `ℙ K V`: variable (K V : Type*) [DivisionRing K] [AddCommGroup V] [Module K V] /-- The setoid whose quotient is the projectivization of `V`. -/ +@[implicit_reducible] def projectivizationSetoid : Setoid { v : V // v ≠ 0 } := (MulAction.orbitRel Kˣ V).comap (↑) diff --git a/Mathlib/LinearAlgebra/RootSystem/Defs.lean b/Mathlib/LinearAlgebra/RootSystem/Defs.lean index 783aba975591b2..874e0014d08516 100644 --- a/Mathlib/LinearAlgebra/RootSystem/Defs.lean +++ b/Mathlib/LinearAlgebra/RootSystem/Defs.lean @@ -400,7 +400,7 @@ lemma pairing_reflectionPerm_self_right (i j : ι) : /-- The indexing set of a root pairing carries an involutive negation, corresponding to the negation of a root / coroot. -/ -@[simps] def indexNeg : InvolutiveNeg ι where +@[simps, implicit_reducible] def indexNeg : InvolutiveNeg ι where neg i := P.reflectionPerm i i neg_neg i := by apply P.root.injective diff --git a/Mathlib/LinearAlgebra/RootSystem/Finite/G2.lean b/Mathlib/LinearAlgebra/RootSystem/Finite/G2.lean index 26c0925419ffb5..8c68dcaf3cadae 100644 --- a/Mathlib/LinearAlgebra/RootSystem/Finite/G2.lean +++ b/Mathlib/LinearAlgebra/RootSystem/Finite/G2.lean @@ -78,6 +78,7 @@ section IsG2 /-- By making an arbitrary choice of roots pairing to `-3`, we can obtain an embedded `𝔤₂` root system just from the knowledge that such a pairs exists. -/ +@[implicit_reducible] def IsG2.toEmbeddedG2 [P.IsG2] : P.EmbeddedG2 where long := (IsG2.exists_pairingIn_neg_three (P := P)).choose short := (IsG2.exists_pairingIn_neg_three (P := P)).choose_spec.choose @@ -198,7 +199,8 @@ end IsNotG2 namespace EmbeddedG2 /-- A pair of roots which pair to `+3` are also sufficient to distinguish an embedded `𝔤₂`. -/ -@[simps] def ofPairingInThree [CharZero R] [P.IsCrystallographic] [P.IsReduced] (long short : ι) +@[simps, implicit_reducible] +def ofPairingInThree [CharZero R] [P.IsCrystallographic] [P.IsReduced] (long short : ι) (h : P.pairingIn ℤ long short = 3) : P.EmbeddedG2 where long := P.reflectionPerm long long short := short diff --git a/Mathlib/Logic/Basic.lean b/Mathlib/Logic/Basic.lean index d98e42c8f90525..57da66ed92527d 100644 --- a/Mathlib/Logic/Basic.lean +++ b/Mathlib/Logic/Basic.lean @@ -699,9 +699,11 @@ noncomputable def dec (p : Prop) : Decidable p := by infer_instance variable {α : Sort*} /-- Any predicate `p` is decidable classically. -/ +@[implicit_reducible] noncomputable def decPred (p : α → Prop) : DecidablePred p := by infer_instance /-- Any relation `p` is decidable classically. -/ +@[implicit_reducible] noncomputable def decRel (p : α → α → Prop) : DecidableRel p := by infer_instance /-- Any type `α` has decidable equality classically. -/ diff --git a/Mathlib/Logic/Denumerable.lean b/Mathlib/Logic/Denumerable.lean index 2f61dd8e3beabf..87b11eaec77263 100644 --- a/Mathlib/Logic/Denumerable.lean +++ b/Mathlib/Logic/Denumerable.lean @@ -76,6 +76,7 @@ instance (priority := 100) : Infinite α := Infinite.of_surjective _ (eqv α).surjective /-- A type equivalent to `ℕ` is denumerable. -/ +@[implicit_reducible] def mk' {α} (e : α ≃ ℕ) : Denumerable α where encode := e decode := some ∘ e.symm @@ -84,6 +85,7 @@ def mk' {α} (e : α ≃ ℕ) : Denumerable α where /-- Denumerability is conserved by equivalences. This is transitivity of equivalence the denumerable way. -/ +@[implicit_reducible] def ofEquiv (α) {β} [Denumerable α] (e : β ≃ α) : Denumerable β := { Encodable.ofEquiv _ e with decode_inv := fun n => by @@ -297,6 +299,7 @@ private theorem right_inverse_aux : ∀ n, toFunAux (ofNat s n) = n set_option backward.privateInPublic true in set_option backward.privateInPublic.warn false in /-- Any infinite set of naturals is denumerable. -/ +@[implicit_reducible] def denumerable (s : Set ℕ) [DecidablePred (· ∈ s)] [Infinite s] : Denumerable s := Denumerable.ofEquiv ℕ { toFun := toFunAux @@ -311,6 +314,7 @@ namespace Denumerable open Encodable /-- An infinite encodable type is denumerable. -/ +@[implicit_reducible] def ofEncodableOfInfinite (α : Type*) [Encodable α] [Infinite α] : Denumerable α := by letI := @decidableRangeEncode α _ letI : Infinite (Set.range (@encode α _)) := diff --git a/Mathlib/Logic/Encodable/Basic.lean b/Mathlib/Logic/Encodable/Basic.lean index d39f4c29f7c8c5..aae4f20a14efb9 100644 --- a/Mathlib/Logic/Encodable/Basic.lean +++ b/Mathlib/Logic/Encodable/Basic.lean @@ -93,17 +93,20 @@ def decidableEqOfEncodable (α) [Encodable α] : DecidableEq α | _, _ => decidable_of_iff _ encode_inj /-- If `α` is encodable and there is an injection `f : β → α`, then `β` is encodable as well. -/ +@[implicit_reducible] def ofLeftInjection [Encodable α] (f : β → α) (finv : α → Option β) (linv : ∀ b, finv (f b) = some b) : Encodable β := ⟨fun b => encode (f b), fun n => (decode n).bind finv, fun b => by simp [Encodable.encodek, linv]⟩ /-- If `α` is encodable and `f : β → α` is invertible, then `β` is encodable as well. -/ +@[implicit_reducible] def ofLeftInverse [Encodable α] (f : β → α) (finv : α → β) (linv : ∀ b, finv (f b) = b) : Encodable β := ofLeftInjection f (some ∘ finv) fun b => congr_arg some (linv b) /-- Encodability is preserved by equivalence. -/ +@[implicit_reducible] def ofEquiv (α) [Encodable α] (e : β ≃ α) : Encodable β := ofLeftInverse e e.symm e.left_inv @@ -227,6 +230,7 @@ def equivRangeEncode (α : Type*) [Encodable α] : α ≃ Set.range (@encode α rw [encode_injective.eq_iff, ← Option.some_inj, Option.some_get, ← hx, encodek₂] /-- A type with unique element is encodable. This is not an instance to avoid diamonds. -/ +@[implicit_reducible] def _root_.Unique.encodable [Unique α] : Encodable α := ⟨fun _ => 0, fun _ => some default, Unique.forall_iff.2 rfl⟩ @@ -387,11 +391,12 @@ instance _root_.PLift.encodable [Encodable α] : Encodable (PLift α) := ofEquiv _ Equiv.plift /-- If `β` is encodable and there is an injection `f : α → β`, then `α` is encodable as well. -/ +@[implicit_reducible] noncomputable def ofInj [Encodable β] (f : α → β) (hf : Injective f) : Encodable α := ofLeftInjection f (partialInv f) fun _ => (partialInv_of_injective hf _ _).2 rfl /-- If `α` is countable, then it has a (non-canonical) `Encodable` structure. -/ -@[no_expose] +@[no_expose, implicit_reducible] noncomputable def ofCountable (α : Type*) [Countable α] : Encodable α := Nonempty.some <| let ⟨f, hf⟩ := exists_injective_nat α @@ -614,6 +619,7 @@ theorem Quotient.rep_spec (q : Quotient s) : ⟦q.rep⟧ = q := choose_spec (exists_rep q) /-- The quotient of an encodable space by a decidable equivalence relation is encodable. -/ +@[implicit_reducible] def encodableQuotient : Encodable (Quotient s) := ⟨fun q => encode q.rep, fun n => Quotient.mk'' <$> decode n, by rintro ⟨l⟩; dsimp; rw [encodek]; exact congr_arg some ⟦l⟧.rep_spec⟩ diff --git a/Mathlib/Logic/Equiv/List.lean b/Mathlib/Logic/Equiv/List.lean index ab1c343a132b65..c589047ab85ee2 100644 --- a/Mathlib/Logic/Equiv/List.lean +++ b/Mathlib/Logic/Equiv/List.lean @@ -106,6 +106,7 @@ instance _root_.Finset.countable [Countable α] : Countable (Finset α) := Finset.val_injective.countable /-- A listable type with decidable equality is encodable. -/ +@[implicit_reducible] def encodableOfList [DecidableEq α] (l : List α) (H : ∀ x, x ∈ l) : Encodable α := ⟨fun a => idxOf a l, (l[·]?), fun _ => getElem?_idxOf (H _)⟩ @@ -118,6 +119,7 @@ def _root_.Fintype.truncEncodable (α : Type*) [DecidableEq α] [Fintype α] : T /-- A noncomputable way to arbitrarily choose an ordering on a finite type. It is not made into a global instance, since it involves an arbitrary choice. This can be locally made into an instance with `attribute [local instance] Fintype.toEncodable`. -/ +@[implicit_reducible] noncomputable def _root_.Fintype.toEncodable (α : Type*) [Fintype α] : Encodable α := by classical exact (Fintype.truncEncodable α).out diff --git a/Mathlib/Logic/Relation.lean b/Mathlib/Logic/Relation.lean index 50c813849c9f7a..052246f1cae6d1 100644 --- a/Mathlib/Logic/Relation.lean +++ b/Mathlib/Logic/Relation.lean @@ -741,6 +741,7 @@ theorem is_equivalence : Equivalence (@EqvGen α r) := The motivation for this definition is that `Quot r` behaves like `Quotient (EqvGen.setoid r)`, see for example `Quot.eqvGen_exact` and `Quot.eqvGen_sound`. -/ +@[implicit_reducible] def setoid : Setoid α := Setoid.mk _ (EqvGen.is_equivalence r) diff --git a/Mathlib/Logic/Unique.lean b/Mathlib/Logic/Unique.lean index 86374edc495a54..e58e08169f6e71 100644 --- a/Mathlib/Logic/Unique.lean +++ b/Mathlib/Logic/Unique.lean @@ -89,6 +89,7 @@ theorem PUnit.default_eq_unit : (default : PUnit) = PUnit.unit := rfl /-- Every provable proposition is unique, as all proofs are equal. -/ +@[implicit_reducible] def uniqueProp {p : Prop} (h : p) : Unique.{0} p where default := h uniq _ := rfl @@ -197,15 +198,18 @@ protected theorem Surjective.subsingleton [Subsingleton α] (hf : Surjective f) /-- If the domain of a surjective function is a singleton, then the codomain is a singleton as well. -/ +@[implicit_reducible] protected def Surjective.unique {α : Sort u} (f : α → β) (hf : Surjective f) [Unique.{u} α] : Unique β := @Unique.mk' _ ⟨f default⟩ hf.subsingleton /-- If `α` is inhabited and admits an injective map to a subsingleton type, then `α` is `Unique`. -/ +@[implicit_reducible] protected def Injective.unique [Inhabited α] [Subsingleton β] (hf : Injective f) : Unique α := @Unique.mk' _ _ hf.subsingleton /-- If a constant function is surjective, then the codomain is a singleton. -/ +@[implicit_reducible] def Surjective.uniqueOfSurjectiveConst (α : Type*) {β : Type*} (b : β) (h : Function.Surjective (Function.const α b)) : Unique β := @uniqueOfSubsingleton _ (subsingleton_of_forall_eq b <| h.forall.mpr fun _ ↦ rfl) b diff --git a/Mathlib/MeasureTheory/Constructions/BorelSpace/Basic.lean b/Mathlib/MeasureTheory/Constructions/BorelSpace/Basic.lean index 192233aff4a010..7e67fbae39ffd5 100644 --- a/Mathlib/MeasureTheory/Constructions/BorelSpace/Basic.lean +++ b/Mathlib/MeasureTheory/Constructions/BorelSpace/Basic.lean @@ -49,6 +49,7 @@ variable {α β γ γ₂ δ : Type*} {ι : Sort y} {s t u : Set α} open MeasurableSpace TopologicalSpace /-- `MeasurableSpace` structure generated by `TopologicalSpace`. -/ +@[implicit_reducible] def borel (α : Type u) [TopologicalSpace α] : MeasurableSpace α := generateFrom { s : Set α | IsOpen s } diff --git a/Mathlib/MeasureTheory/Constructions/Cylinders.lean b/Mathlib/MeasureTheory/Constructions/Cylinders.lean index c2c49b0c3c57a3..d7098da37fa417 100644 --- a/Mathlib/MeasureTheory/Constructions/Cylinders.lean +++ b/Mathlib/MeasureTheory/Constructions/Cylinders.lean @@ -390,6 +390,7 @@ variable {α ι : Type*} {X : ι → Type*} {mα : MeasurableSpace α} [m : ∀ /-- The σ-algebra of cylinder events on `Δ`. It is the smallest σ-algebra making the projections on the `i`-th coordinate measurable for all `i ∈ Δ`. -/ +@[implicit_reducible] def cylinderEvents (Δ : Set ι) : MeasurableSpace (∀ i, X i) := ⨆ i ∈ Δ, (m i).comap fun σ ↦ σ i @[simp] lemma cylinderEvents_univ : cylinderEvents (X := X) univ = MeasurableSpace.pi := by diff --git a/Mathlib/MeasureTheory/Constructions/Polish/Basic.lean b/Mathlib/MeasureTheory/Constructions/Polish/Basic.lean index a2203f9e8ffbba..227eed60cecccb 100644 --- a/Mathlib/MeasureTheory/Constructions/Polish/Basic.lean +++ b/Mathlib/MeasureTheory/Constructions/Polish/Basic.lean @@ -92,6 +92,7 @@ a compatible Polish topology. Warning: following this with `borelize α` will cause an error. Instead, one can rewrite with `eq_borel_upgradeStandardBorel α`. TODO: fix the corresponding bug in `borelize`. -/ +@[implicit_reducible] noncomputable def upgradeStandardBorel [MeasurableSpace α] [h : StandardBorelSpace α] : UpgradedStandardBorel α := by diff --git a/Mathlib/MeasureTheory/Function/AEEqFun.lean b/Mathlib/MeasureTheory/Function/AEEqFun.lean index d0bc61906ac56e..d3e767f5524bd0 100644 --- a/Mathlib/MeasureTheory/Function/AEEqFun.lean +++ b/Mathlib/MeasureTheory/Function/AEEqFun.lean @@ -90,6 +90,7 @@ variable (β) /-- The equivalence relation of being almost everywhere equal for almost everywhere strongly measurable functions. -/ +@[implicit_reducible] def Measure.aeEqSetoid (μ : Measure α) : Setoid { f : α → β // AEStronglyMeasurable f μ } := ⟨fun f g => (f : α → β) =ᵐ[μ] g, fun {f} => ae_eq_refl f.val, fun {_ _} => ae_eq_symm, fun {_ _ _} => ae_eq_trans⟩ diff --git a/Mathlib/MeasureTheory/MeasurableSpace/Basic.lean b/Mathlib/MeasureTheory/MeasurableSpace/Basic.lean index c030e166ccf930..5cb3099def10bf 100644 --- a/Mathlib/MeasureTheory/MeasurableSpace/Basic.lean +++ b/Mathlib/MeasureTheory/MeasurableSpace/Basic.lean @@ -59,6 +59,7 @@ variable {m m₁ m₂ : MeasurableSpace α} {m' : MeasurableSpace β} {f : α /-- The forward image of a measurable space under a function. `map f m` contains the sets `s : Set β` whose preimage under `f` is measurable. -/ +@[implicit_reducible] protected def map (f : α → β) (m : MeasurableSpace α) : MeasurableSpace β where MeasurableSet' s := MeasurableSet[m] <| f ⁻¹' s measurableSet_empty := m.measurableSet_empty @@ -77,6 +78,7 @@ theorem map_comp {f : α → β} {g : β → γ} : (m.map f).map g = m.map (g /-- The reverse image of a measurable space under a function. `comap f m` contains the sets `s : Set α` such that `s` is the `f`-preimage of a measurable set in `β`. -/ +@[implicit_reducible] protected def comap (f : α → β) (m : MeasurableSpace β) : MeasurableSpace α where MeasurableSet' s := ∃ s', MeasurableSet[m] s' ∧ f ⁻¹' s' = s measurableSet_empty := ⟨∅, m.measurableSet_empty, rfl⟩ diff --git a/Mathlib/MeasureTheory/MeasurableSpace/Constructions.lean b/Mathlib/MeasureTheory/MeasurableSpace/Constructions.lean index f5dccfa3cd7fa7..3acc5c6890087a 100644 --- a/Mathlib/MeasureTheory/MeasurableSpace/Constructions.lean +++ b/Mathlib/MeasureTheory/MeasurableSpace/Constructions.lean @@ -362,6 +362,7 @@ end Atoms section Prod /-- A `MeasurableSpace` structure on the product of two measurable spaces. -/ +@[implicit_reducible] def MeasurableSpace.prod {α β} (m₁ : MeasurableSpace α) (m₂ : MeasurableSpace β) : MeasurableSpace (α × β) := m₁.comap Prod.fst ⊔ m₂.comap Prod.snd diff --git a/Mathlib/MeasureTheory/MeasurableSpace/Defs.lean b/Mathlib/MeasureTheory/MeasurableSpace/Defs.lean index a12e21d740ca36..e37f719337521a 100644 --- a/Mathlib/MeasureTheory/MeasurableSpace/Defs.lean +++ b/Mathlib/MeasureTheory/MeasurableSpace/Defs.lean @@ -289,6 +289,7 @@ namespace MeasurableSpace /-- Copy of a `MeasurableSpace` with a new `MeasurableSet` equal to the old one. Useful to fix definitional equalities. -/ +@[implicit_reducible] protected def copy (m : MeasurableSpace α) (p : Set α → Prop) (h : ∀ s, p s ↔ MeasurableSet[m] s) : MeasurableSpace α where MeasurableSet' := p @@ -325,6 +326,7 @@ inductive GenerateMeasurable (s : Set (Set α)) : Set α → Prop GenerateMeasurable s (⋃ i, f i) /-- Construct the smallest measure space containing a collection of basic sets -/ +@[implicit_reducible] def generateFrom (s : Set (Set α)) : MeasurableSpace α where MeasurableSet' := GenerateMeasurable s measurableSet_empty := .empty @@ -371,6 +373,7 @@ theorem forall_generateFrom_mem_iff_mem_iff {S : Set (Set α)} {x y : α} : /-- If `g` is a collection of subsets of `α` such that the `σ`-algebra generated from `g` contains the same sets as `g`, then `g` was already a `σ`-algebra. -/ +@[implicit_reducible] protected def mkOfClosure (g : Set (Set α)) (hg : { t | MeasurableSet[generateFrom g] t } = g) : MeasurableSpace α := (generateFrom g).copy (· ∈ g) <| Set.ext_iff.1 hg.symm diff --git a/Mathlib/MeasureTheory/MeasurableSpace/EventuallyMeasurable.lean b/Mathlib/MeasureTheory/MeasurableSpace/EventuallyMeasurable.lean index 5e4d55f2bc5c89..40678cb63a5071 100644 --- a/Mathlib/MeasureTheory/MeasurableSpace/EventuallyMeasurable.lean +++ b/Mathlib/MeasureTheory/MeasurableSpace/EventuallyMeasurable.lean @@ -40,6 +40,7 @@ variable {α : Type*} (m : MeasurableSpace α) {s t : Set α} /-- The `MeasurableSpace` of sets which are measurable with respect to a given σ-algebra `m` on `α`, modulo a given σ-filter `l` on `α`. -/ +@[implicit_reducible] def eventuallyMeasurableSpace (l : Filter α) [CountableInterFilter l] : MeasurableSpace α where MeasurableSet' s := ∃ t, MeasurableSet t ∧ s =ᶠ[l] t measurableSet_empty := ⟨∅, MeasurableSet.empty, EventuallyEq.refl _ _ ⟩ diff --git a/Mathlib/MeasureTheory/MeasurableSpace/Invariants.lean b/Mathlib/MeasureTheory/MeasurableSpace/Invariants.lean index 72849947867fbb..2fc1fef927a4dd 100644 --- a/Mathlib/MeasureTheory/MeasurableSpace/Invariants.lean +++ b/Mathlib/MeasureTheory/MeasurableSpace/Invariants.lean @@ -29,6 +29,7 @@ variable {α : Type*} A set `s` is `(invariants f)`-measurable iff it is measurable w.r.t. the canonical σ-algebra on `α` and `f ⁻¹' s = s`. -/ +@[implicit_reducible] def invariants [m : MeasurableSpace α] (f : α → α) : MeasurableSpace α := { m ⊓ ⟨fun s ↦ f ⁻¹' s = s, by simp, by simp, fun f hf ↦ by simp [hf]⟩ with MeasurableSet' := fun s ↦ MeasurableSet[m] s ∧ f ⁻¹' s = s } diff --git a/Mathlib/MeasureTheory/OuterMeasure/Caratheodory.lean b/Mathlib/MeasureTheory/OuterMeasure/Caratheodory.lean index 3619c796323d94..8b49b5cffdb610 100644 --- a/Mathlib/MeasureTheory/OuterMeasure/Caratheodory.lean +++ b/Mathlib/MeasureTheory/OuterMeasure/Caratheodory.lean @@ -169,6 +169,7 @@ def caratheodoryDynkin : MeasurableSpace.DynkinSystem α where /-- Given an outer measure `μ`, the Carathéodory-measurable space is defined such that `s` is measurable if `∀ t, μ t = μ (t ∩ s) + μ (t \ s)`. -/ +@[implicit_reducible] protected def caratheodory : MeasurableSpace α := by apply MeasurableSpace.DynkinSystem.toMeasurableSpace (caratheodoryDynkin m) intro s₁ s₂ diff --git a/Mathlib/MeasureTheory/PiSystem.lean b/Mathlib/MeasureTheory/PiSystem.lean index 768a1832c37b38..b67a28910ab1aa 100644 --- a/Mathlib/MeasureTheory/PiSystem.lean +++ b/Mathlib/MeasureTheory/PiSystem.lean @@ -596,6 +596,7 @@ instance : Inhabited (DynkinSystem α) := ⟨generate univ⟩ /-- If a Dynkin system is closed under binary intersection, then it forms a `σ`-algebra. -/ +@[implicit_reducible] def toMeasurableSpace (h_inter : ∀ s₁ s₂, d.Has s₁ → d.Has s₂ → d.Has (s₁ ∩ s₂)) : MeasurableSpace α where MeasurableSet' := d.Has diff --git a/Mathlib/ModelTheory/Basic.lean b/Mathlib/ModelTheory/Basic.lean index 4cfe3203b2c6be..516d213164a182 100644 --- a/Mathlib/ModelTheory/Basic.lean +++ b/Mathlib/ModelTheory/Basic.lean @@ -763,6 +763,7 @@ end SumStructure section Empty /-- Any type can be made uniquely into a structure over the empty language. -/ +@[implicit_reducible] def emptyStructure : Language.empty.Structure M where instance : Unique (Language.empty.Structure M) := @@ -806,7 +807,7 @@ open FirstOrder FirstOrder.Language FirstOrder.Language.Structure variable {L : Language} {M : Type*} {N : Type*} [L.Structure M] /-- A structure induced by a bijection. -/ -@[simps!] +@[simps!, implicit_reducible] def inducedStructure (e : M ≃ N) : L.Structure N := ⟨fun f x => e (funMap f (e.symm ∘ x)), fun r x => RelMap r (e.symm ∘ x)⟩ diff --git a/Mathlib/ModelTheory/Equivalence.lean b/Mathlib/ModelTheory/Equivalence.lean index 4d7e9c8e61c823..770411c75d26af 100644 --- a/Mathlib/ModelTheory/Equivalence.lean +++ b/Mathlib/ModelTheory/Equivalence.lean @@ -201,6 +201,7 @@ protected theorem imp {φ ψ φ' ψ' : L.BoundedFormula α n} (h : φ ⇔[T] ψ) end Iff /-- Semantic equivalence forms an equivalence relation on formulas. -/ +@[implicit_reducible] def iffSetoid (T : L.Theory) : Setoid (L.BoundedFormula α n) where r := T.Iff iseqv := ⟨fun _ => refl _, fun {_ _} h => h.symm, fun {_ _ _} h1 h2 => h1.trans h2⟩ diff --git a/Mathlib/ModelTheory/Graph.lean b/Mathlib/ModelTheory/Graph.lean index 131851c2b38b8a..98dc597999ec1d 100644 --- a/Mathlib/ModelTheory/Graph.lean +++ b/Mathlib/ModelTheory/Graph.lean @@ -53,6 +53,7 @@ protected def graph : Language := ⟨fun _ => Empty, graphRel⟩ abbrev adj : Language.graph.Relations 2 := .adj /-- Any simple graph can be thought of as a structure in the language of graphs. -/ +@[implicit_reducible] def _root_.SimpleGraph.structure (G : SimpleGraph V) : Language.graph.Structure V where RelMap | .adj => (fun x => G.Adj (x 0) (x 1)) diff --git a/Mathlib/ModelTheory/LanguageMap.lean b/Mathlib/ModelTheory/LanguageMap.lean index 57888d1b392c9e..4e593b18af71cf 100644 --- a/Mathlib/ModelTheory/LanguageMap.lean +++ b/Mathlib/ModelTheory/LanguageMap.lean @@ -65,6 +65,7 @@ namespace LHom variable (ϕ : L →ᴸ L') /-- Pulls a structure back along a language map. -/ +@[implicit_reducible] def reduct (M : Type*) [L'.Structure M] : L.Structure M where funMap f xs := funMap (ϕ.onFunction f) xs RelMap r xs := RelMap (ϕ.onRelation r) xs @@ -181,6 +182,7 @@ protected structure Injective : Prop where /-- Pulls an `L`-structure along a language map `ϕ : L →ᴸ L'`, and then expands it to an `L'`-structure arbitrarily. -/ +@[implicit_reducible] noncomputable def defaultExpansion (ϕ : L →ᴸ L') [∀ (n) (f : L'.Functions n), Decidable (f ∈ Set.range fun f : L.Functions n => onFunction ϕ f)] [∀ (n) (r : L'.Relations n), Decidable (r ∈ Set.range fun r : L.Relations n => onRelation ϕ r)] @@ -345,6 +347,7 @@ theorem card_constantsOn : (constantsOn α).card = #α := by simp [card_eq_card_functions_add_card_relations, sum_nat_eq_add_sum_succ] /-- Gives a `constantsOn α` structure to a type by assigning each constant a value. -/ +@[implicit_reducible] def constantsOn.structure (f : α → M) : (constantsOn α).Structure M where funMap := fun {n} c _ => match n, c with diff --git a/Mathlib/ModelTheory/Order.lean b/Mathlib/ModelTheory/Order.lean index ee7845849e7f72..35778f7f3fedcc 100644 --- a/Mathlib/ModelTheory/Order.lean +++ b/Mathlib/ModelTheory/Order.lean @@ -205,6 +205,7 @@ variable (L M) /-- Any linearly-ordered type is naturally a structure in the language `Language.order`. This is not an instance, because sometimes the `Language.order.Structure` is defined first. -/ +@[implicit_reducible] def orderStructure [LE M] : Language.order.Structure M where RelMap | .le => (fun x => x 0 ≤ x 1) @@ -352,6 +353,7 @@ section structure_to_order variable (L) [IsOrdered L] (M) [L.Structure M] /-- Any structure in an ordered language can be ordered correspondingly. -/ +@[implicit_reducible] def leOfStructure : LE M where le a b := Structure.RelMap (leSymb : L.Relations 2) ![a, b] @@ -372,6 +374,7 @@ def decidableLEOfStructure DecidableLE M := h /-- Any model of a theory of preorders is a preorder. -/ +@[implicit_reducible] def preorderOfModels [h : M ⊨ L.preorderTheory] : Preorder M where __ := L.leOfStructure M le_refl := Relations.realize_reflexive.1 ((Theory.model_iff _).1 h _ @@ -380,6 +383,7 @@ def preorderOfModels [h : M ⊨ L.preorderTheory] : Preorder M where (by simp only [preorderTheory, Set.mem_insert_iff, Set.mem_singleton_iff, or_true])) /-- Any model of a theory of partial orders is a partial order. -/ +@[implicit_reducible] def partialOrderOfModels [h : M ⊨ L.partialOrderTheory] : PartialOrder M where __ := L.preorderOfModels M le_antisymm := (Relations.realize_antisymmetric.mp <| @@ -387,6 +391,7 @@ def partialOrderOfModels [h : M ⊨ L.partialOrderTheory] : PartialOrder M where set_option backward.isDefEq.respectTransparency false in /-- Any model of a theory of linear orders is a linear order. -/ +@[implicit_reducible] def linearOrderOfModels [h : M ⊨ L.linearOrderTheory] [DecidableRel (fun (a b : M) => Structure.RelMap (leSymb : L.Relations 2) ![a, b])] : LinearOrder M where diff --git a/Mathlib/NumberTheory/ClassNumber/Finite.lean b/Mathlib/NumberTheory/ClassNumber/Finite.lean index de609d7080034f..bdf5c2f4838e64 100644 --- a/Mathlib/NumberTheory/ClassNumber/Finite.lean +++ b/Mathlib/NumberTheory/ClassNumber/Finite.lean @@ -323,6 +323,7 @@ algebraic extension `L` is finite if there is an admissible absolute value. See also `ClassGroup.fintypeOfAdmissibleOfFinite` where `L` is a finite extension of `K = Frac(R)`, supplying most of the required assumptions automatically. -/ +@[implicit_reducible] noncomputable def fintypeOfAdmissibleOfAlgebraic [IsDedekindDomain S] [Algebra.IsAlgebraic R S] : Fintype (ClassGroup S) := @Fintype.ofSurjective _ _ _ @@ -344,6 +345,7 @@ absolute value. See also `ClassGroup.fintypeOfAdmissibleOfAlgebraic` where `L` is an algebraic extension of `R`, that includes some extra assumptions. -/ +@[implicit_reducible] noncomputable def fintypeOfAdmissibleOfFinite [IsIntegralClosure S R L] : Fintype (ClassGroup S) := by letI := Classical.decEq L diff --git a/Mathlib/NumberTheory/FunctionField.lean b/Mathlib/NumberTheory/FunctionField.lean index a7b656f78d7aab..91061669013755 100644 --- a/Mathlib/NumberTheory/FunctionField.lean +++ b/Mathlib/NumberTheory/FunctionField.lean @@ -232,6 +232,7 @@ theorem inftyValuation.polynomial {p : Fq[X]} (hp : p ≠ 0) : instance : Valuation.IsNontrivial (inftyValuation Fq) := ⟨RatFunc.X, by simp⟩ /-- The valued field `Fq(t)` with the valuation at infinity. -/ +@[implicit_reducible] def inftyValuedFqt : Valued (RatFunc Fq) ℤᵐ⁰ := Valued.mk' <| inftyValuation Fq diff --git a/Mathlib/NumberTheory/ModularForms/SlashActions.lean b/Mathlib/NumberTheory/ModularForms/SlashActions.lean index 03b4e66f3e67fc..093b411ae1963c 100644 --- a/Mathlib/NumberTheory/ModularForms/SlashActions.lean +++ b/Mathlib/NumberTheory/ModularForms/SlashActions.lean @@ -61,6 +61,7 @@ attribute [simp] SlashAction.zero_slash SlashAction.slash_one SlashAction.add_sl | insert i t hi IH => simp [hi, IH] /-- Slash_action induced by a monoid homomorphism. -/ +@[implicit_reducible] def monoidHomSlashAction {β G H α : Type*} [Monoid G] [AddMonoid α] [Monoid H] [SlashAction β G α] (h : H →* G) : SlashAction β H α where map k g := SlashAction.map k (h g) diff --git a/Mathlib/Order/Antisymmetrization.lean b/Mathlib/Order/Antisymmetrization.lean index 7264e82e14cea7..41baa11a92e93b 100644 --- a/Mathlib/Order/Antisymmetrization.lean +++ b/Mathlib/Order/Antisymmetrization.lean @@ -121,7 +121,7 @@ section IsPreorder variable (α) (r : α → α → Prop) [IsPreorder α r] /-- The antisymmetrization relation as an equivalence relation. -/ -@[simps] +@[simps, implicit_reducible] def AntisymmRel.setoid : Setoid α := ⟨AntisymmRel r, .refl r, .symm, .trans⟩ diff --git a/Mathlib/Order/Atoms.lean b/Mathlib/Order/Atoms.lean index f569340d5cedea..e4bd8498c2ed8c 100644 --- a/Mathlib/Order/Atoms.lean +++ b/Mathlib/Order/Atoms.lean @@ -757,6 +757,7 @@ instance OrderDual.instIsSimpleOrder {α} [LE α] [BoundedOrder α] [IsSimpleOrd IsSimpleOrder αᵒᵈ := isSimpleOrder_iff_isSimpleOrder_orderDual.1 (by infer_instance) /-- A simple `BoundedOrder` induces a preorder. This is not an instance to prevent loops. -/ +@[implicit_reducible] protected def IsSimpleOrder.preorder {α} [LE α] [BoundedOrder α] [IsSimpleOrder α] : Preorder α where le_refl a := by rcases eq_bot_or_eq_top a with (rfl | rfl) <;> simp @@ -769,6 +770,7 @@ protected def IsSimpleOrder.preorder {α} [LE α] [BoundedOrder α] [IsSimpleOrd /-- A simple partial ordered `BoundedOrder` induces a linear order. This is not an instance to prevent loops. -/ +@[implicit_reducible] protected def IsSimpleOrder.linearOrder [DecidableEq α] : LinearOrder α := { (inferInstance : PartialOrder α) with le_total := fun a b => by rcases eq_bot_or_eq_top a with (rfl | rfl) <;> simp @@ -825,12 +827,14 @@ variable [Lattice α] [BoundedOrder α] [IsSimpleOrder α] /-- A simple partial ordered `BoundedOrder` induces a lattice. This is not an instance to prevent loops -/ +@[implicit_reducible] protected def lattice {α} [DecidableEq α] [PartialOrder α] [BoundedOrder α] [IsSimpleOrder α] : Lattice α := @LinearOrder.toLattice α IsSimpleOrder.linearOrder /-- A lattice that is a `BoundedOrder` is a distributive lattice. This is not an instance to prevent loops -/ +@[implicit_reducible] protected def distribLattice : DistribLattice α := { (inferInstance : Lattice α) with le_sup_inf := fun x y z => by rcases eq_bot_or_eq_top x with (rfl | rfl) <;> simp } @@ -869,6 +873,7 @@ def orderIsoBool : α ≃o Bool := · simp } /-- A simple `BoundedOrder` is also a `BooleanAlgebra`. -/ +@[implicit_reducible] protected def booleanAlgebra {α} [DecidableEq α] [Lattice α] [BoundedOrder α] [IsSimpleOrder α] : BooleanAlgebra α := { inferInstanceAs (BoundedOrder α), IsSimpleOrder.distribLattice with @@ -888,6 +893,7 @@ variable [Lattice α] [BoundedOrder α] [IsSimpleOrder α] open Classical in /-- A simple `BoundedOrder` is also complete. -/ +@[implicit_reducible] protected noncomputable def completeLattice : CompleteLattice α := { (inferInstance : Lattice α), (inferInstance : BoundedOrder α) with @@ -917,6 +923,7 @@ protected noncomputable def completeLattice : CompleteLattice α := set_option backward.isDefEq.respectTransparency false in open Classical in /-- A simple `BoundedOrder` is also a `CompleteBooleanAlgebra`. -/ +@[implicit_reducible] protected noncomputable def completeBooleanAlgebra : CompleteBooleanAlgebra α := { __ := IsSimpleOrder.completeLattice __ := IsSimpleOrder.booleanAlgebra } diff --git a/Mathlib/Order/BooleanAlgebra/Defs.lean b/Mathlib/Order/BooleanAlgebra/Defs.lean index f5b674e80fa0bf..ca857871b3cfe6 100644 --- a/Mathlib/Order/BooleanAlgebra/Defs.lean +++ b/Mathlib/Order/BooleanAlgebra/Defs.lean @@ -161,6 +161,7 @@ a distributive lattice that is complemented is a Boolean algebra. This is not an instance, because it creates data using choice. -/ +@[implicit_reducible] noncomputable def booleanAlgebraOfComplemented [BoundedOrder α] [ComplementedLattice α] : BooleanAlgebra α where __ := (inferInstanceAs (BoundedOrder α)) diff --git a/Mathlib/Order/BooleanGenerators.lean b/Mathlib/Order/BooleanGenerators.lean index 7a1d549c3f7793..cc22745afc6d43 100644 --- a/Mathlib/Order/BooleanGenerators.lean +++ b/Mathlib/Order/BooleanGenerators.lean @@ -139,6 +139,7 @@ lemma sSup_inter (hS : BooleanGenerators S) {T₁ T₂ : Set α} (hT₁ : T₁ · exact (_root_.le_sSup hI).trans (hX'.ge.trans inf_le_right) /-- A lattice generated by Boolean generators is a distributive lattice. -/ +@[implicit_reducible] def distribLattice_of_sSup_eq_top (hS : BooleanGenerators S) (h : sSup S = ⊤) : DistribLattice α where le_sup_inf a b c := by @@ -161,6 +162,7 @@ lemma complementedLattice_of_sSup_eq_top (hS : BooleanGenerators S) (h : sSup S set_option backward.isDefEq.respectTransparency false in /-- A compactly generated complete lattice generated by Boolean generators is a Boolean algebra. -/ +@[implicit_reducible] noncomputable def booleanAlgebra_of_sSup_eq_top (hS : BooleanGenerators S) (h : sSup S = ⊤) : BooleanAlgebra α := let _i := hS.distribLattice_of_sSup_eq_top h diff --git a/Mathlib/Order/Comparable.lean b/Mathlib/Order/Comparable.lean index 02ff4c03bc14d2..7d69e586ef42fe 100644 --- a/Mathlib/Order/Comparable.lean +++ b/Mathlib/Order/Comparable.lean @@ -199,6 +199,7 @@ theorem AntisymmRel.compRel_congr_right (h : AntisymmRel (· ≤ ·) b c) : end Preorder /-- A partial order where any two elements are comparable is a linear order. -/ +@[implicit_reducible] def Relation.linearOrderOfSymmGen [PartialOrder α] [decLE : DecidableLE α] [decLT : DecidableLT α] [decEq : DecidableEq α] (h : ∀ a b : α, Relation.SymmGen (· ≤ ·) a b) : LinearOrder α where @@ -209,7 +210,7 @@ def Relation.linearOrderOfSymmGen [PartialOrder α] set_option linter.deprecated false in /-- A partial order where any two elements are comparable is a linear order. -/ -@[deprecated linearOrderOfSymmGen (since := "2026-01-25")] +@[deprecated linearOrderOfSymmGen (since := "2026-01-25"), implicit_reducible] def linearOrderOfComprel [PartialOrder α] [decLE : DecidableLE α] [decLT : DecidableLT α] [decEq : DecidableEq α] (h : ∀ a b : α, CompRel (· ≤ ·) a b) : LinearOrder α := diff --git a/Mathlib/Order/Compare.lean b/Mathlib/Order/Compare.lean index b04488bcde3ca5..abd9cc4f410659 100644 --- a/Mathlib/Order/Compare.lean +++ b/Mathlib/Order/Compare.lean @@ -151,6 +151,7 @@ theorem cmp_ofDual [LT α] [DecidableLT α] (x y : αᵒᵈ) : cmp (ofDual x) (o rfl /-- Generate a linear order structure from a preorder and `cmp` function. -/ +@[implicit_reducible] def linearOrderOfCompares [Preorder α] (cmp : α → α → Ordering) (h : ∀ a b, (cmp a b).Compares a b) : LinearOrder α := let H : DecidableLE α := fun a b => decidable_of_iff _ (h a b).ne_gt diff --git a/Mathlib/Order/CompleteBooleanAlgebra.lean b/Mathlib/Order/CompleteBooleanAlgebra.lean index d88e49e2b03f9c..99d49326570765 100644 --- a/Mathlib/Order/CompleteBooleanAlgebra.lean +++ b/Mathlib/Order/CompleteBooleanAlgebra.lean @@ -157,6 +157,7 @@ lemma inf_iSup₂_eq {f : ∀ i, κ i → α} (a : α) : (a ⊓ ⨆ i, ⨆ j, f simp only [inf_iSup_eq] /-- The `Order.Frame.MinimalAxioms` element corresponding to a frame. -/ +@[implicit_reducible] def of [Frame α] : MinimalAxioms α where __ := ‹Frame α› inf_sSup_le_iSup_inf a s := _root_.inf_sSup_eq.le @@ -196,6 +197,7 @@ lemma sup_iInf₂_eq {f : ∀ i, κ i → α} (a : α) : (a ⊔ ⨅ i, ⨅ j, f simp only [sup_iInf_eq] /-- The `Order.Coframe.MinimalAxioms` element corresponding to a frame. -/ +@[implicit_reducible] def of [Coframe α] : MinimalAxioms α where __ := ‹Coframe α› iInf_sup_le_sup_sInf a s := _root_.sup_sInf_eq.ge diff --git a/Mathlib/Order/ConditionallyCompleteLattice/Defs.lean b/Mathlib/Order/ConditionallyCompleteLattice/Defs.lean index fcdae9b63d016b..c46b8a9429949f 100644 --- a/Mathlib/Order/ConditionallyCompleteLattice/Defs.lean +++ b/Mathlib/Order/ConditionallyCompleteLattice/Defs.lean @@ -133,6 +133,7 @@ constructor provides poor definitional equalities. If other fields are known ex should be provided; for example, if `inf` is known explicitly, construct the `ConditionallyCompleteLattice` instance as ``` +@[implicit_reducible] instance : ConditionallyCompleteLattice my_T := { inf := better_inf, le_inf := ..., @@ -184,6 +185,7 @@ constructor provides poor definitional equalities. If other fields are known ex should be provided; for example, if `inf` is known explicitly, construct the `ConditionallyCompleteLattice` instance as ``` +@[implicit_reducible] instance : ConditionallyCompleteLattice my_T := { inf := better_inf, le_inf := ..., @@ -232,6 +234,7 @@ def conditionallyCompleteLatticeOfsInf (α : Type*) [H1 : PartialOrder α] [H2 : /-- A version of `conditionallyCompleteLatticeOfsSup` when we already know that `α` is a lattice. This should only be used when it is both hard and unnecessary to provide `inf` explicitly. -/ +@[implicit_reducible] def conditionallyCompleteLatticeOfLatticeOfsSup (α : Type*) [H1 : Lattice α] [SupSet α] (isLUB_sSup : ∀ s : Set α, BddAbove s → s.Nonempty → IsLUB s (sSup s)) : ConditionallyCompleteLattice α := @@ -244,6 +247,7 @@ def conditionallyCompleteLatticeOfLatticeOfsSup (α : Type*) [H1 : Lattice α] [ /-- A version of `conditionallyCompleteLatticeOfsInf` when we already know that `α` is a lattice. This should only be used when it is both hard and unnecessary to provide `sup` explicitly. -/ +@[implicit_reducible] def conditionallyCompleteLatticeOfLatticeOfsInf (α : Type*) [H1 : Lattice α] [InfSet α] (isGLB_sInf : ∀ s : Set α, BddBelow s → s.Nonempty → IsGLB s (sInf s)) : ConditionallyCompleteLattice α := diff --git a/Mathlib/Order/Defs/PartialOrder.lean b/Mathlib/Order/Defs/PartialOrder.lean index d9a8154754bd67..233a684fea11c3 100644 --- a/Mathlib/Order/Defs/PartialOrder.lean +++ b/Mathlib/Order/Defs/PartialOrder.lean @@ -136,6 +136,7 @@ instance instTransGTGE : @Trans α α α GT.gt GE.ge GT.gt := ⟨lt_of_lt_of_le' instance instTransGEGT : @Trans α α α GE.ge GT.gt GT.gt := ⟨lt_of_le_of_lt'⟩ /-- `<` is decidable if `≤` is. -/ +@[implicit_reducible] def decidableLTOfDecidableLE [DecidableLE α] : DecidableLT α := fun _ _ => decidable_of_iff _ lt_iff_le_not_ge.symm diff --git a/Mathlib/Order/DirectedInverseSystem.lean b/Mathlib/Order/DirectedInverseSystem.lean index 7e5cec35acb097..f767e76cc8a1c6 100644 --- a/Mathlib/Order/DirectedInverseSystem.lean +++ b/Mathlib/Order/DirectedInverseSystem.lean @@ -96,6 +96,7 @@ open DirectedSystem variable [IsDirectedOrder ι] /-- The setoid on the sigma type defining the direct limit. -/ +@[implicit_reducible] def setoid : Setoid (Σ i, F i) where r x y := ∃ᵉ (i) (hx : x.1 ≤ i) (hy : y.1 ≤ i), f _ _ hx x.2 = f _ _ hy y.2 iseqv := ⟨fun x ↦ ⟨x.1, le_rfl, le_rfl, rfl⟩, fun ⟨i, hx, hy, eq⟩ ↦ ⟨i, hy, hx, eq.symm⟩, diff --git a/Mathlib/Order/Extension/Well.lean b/Mathlib/Order/Extension/Well.lean index 47b6d1cb46f81a..e72e673cfafe2b 100644 --- a/Mathlib/Order/Extension/Well.lean +++ b/Mathlib/Order/Extension/Well.lean @@ -56,6 +56,7 @@ By taking the lexicographic product of the two, we get both properties, so we ca get a well-order that extend our original order `r`. Another way to view this is that we choose an arbitrary well-order to serve as a tiebreak between two elements of same rank. -/ +@[implicit_reducible] noncomputable def wellOrderExtension : LinearOrder α := @LinearOrder.lift' α (Ordinal ×ₗ Cardinal) _ (fun a : α => (rank r a, embeddingToCardinal a)) fun _ _ h => embeddingToCardinal.injective <| congr_arg Prod.snd h diff --git a/Mathlib/Order/Filter/Germ/Basic.lean b/Mathlib/Order/Filter/Germ/Basic.lean index e85acd32e12d0d..3e1663a813d393 100644 --- a/Mathlib/Order/Filter/Germ/Basic.lean +++ b/Mathlib/Order/Filter/Germ/Basic.lean @@ -70,6 +70,7 @@ theorem const_eventuallyEq [NeBot l] {a b : β} : ((fun _ => a) =ᶠ[l] fun _ => @const_eventuallyEq' _ _ _ _ a b /-- Setoid used to define the space of germs. -/ +@[implicit_reducible] def germSetoid (l : Filter α) (β : Type*) : Setoid (α → β) where r := EventuallyEq l iseqv := ⟨EventuallyEq.refl _, EventuallyEq.symm, EventuallyEq.trans⟩ @@ -80,6 +81,7 @@ def Germ (l : Filter α) (β : Type*) : Type _ := /-- Setoid used to define the filter product. This is a dependent version of `Filter.germSetoid`. -/ +@[implicit_reducible] def productSetoid (l : Filter α) (ε : α → Type*) : Setoid ((a : _) → ε a) where r f g := ∀ᶠ a in l, f a = g a iseqv := diff --git a/Mathlib/Order/Filter/Pointwise.lean b/Mathlib/Order/Filter/Pointwise.lean index 342e509f5a5da7..8b745ac8a9e718 100644 --- a/Mathlib/Order/Filter/Pointwise.lean +++ b/Mathlib/Order/Filter/Pointwise.lean @@ -78,7 +78,7 @@ section One variable [One α] {f : Filter α} {s : Set α} /-- `1 : Filter α` is defined as the filter of sets containing `1 : α` in scope `Pointwise`. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- `0 : Filter α` is defined as the filter of sets containing `0 : α` in scope `Pointwise`. -/] protected def instOne : One (Filter α) := ⟨pure 1⟩ @@ -166,7 +166,7 @@ section Inv variable [Inv α] {f g : Filter α} {s : Set α} {a : α} /-- The inverse of a filter is the pointwise preimage under `⁻¹` of its sets. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- The negation of a filter is the pointwise preimage under `-` of its sets. -/] def instInv : Inv (Filter α) := ⟨map Inv.inv⟩ @@ -224,7 +224,7 @@ protected theorem HasBasis.inv {ι : Sort*} {p : ι → Prop} {s : ι → Set α simpa using h.map Inv.inv /-- Inversion is involutive on `Filter α` if it is on `α`. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- Negation is involutive on `Filter α` if it is on `α`. -/] protected def instInvolutiveInv : InvolutiveInv (Filter α) := { Filter.instInv with @@ -257,7 +257,7 @@ section Mul variable [Mul α] [Mul β] {f f₁ f₂ g g₁ g₂ h : Filter α} {s t : Set α} {a b : α} /-- The filter `f * g` is generated by `{s * t | s ∈ f, t ∈ g}` in scope `Pointwise`. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- The filter `f + g` is generated by `{s + t | s ∈ f, t ∈ g}` in scope `Pointwise`. -/] protected def instMul : Mul (Filter α) := ⟨/- This is defeq to `map₂ (· * ·) f g`, but the hypothesis unfolds to `t₁ * t₂ ⊆ s` rather @@ -367,7 +367,7 @@ section Div variable [Div α] {f f₁ f₂ g g₁ g₂ h : Filter α} {s t : Set α} {a b : α} /-- The filter `f / g` is generated by `{s / t | s ∈ f, t ∈ g}` in scope `Pointwise`. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- The filter `f - g` is generated by `{s - t | s ∈ f, t ∈ g}` in scope `Pointwise`. -/] protected def instDiv : Div (Filter α) := ⟨/- This is defeq to `map₂ (· / ·) f g`, but the hypothesis unfolds to `t₁ / t₂ ⊆ s` @@ -492,13 +492,13 @@ scoped[Pointwise] attribute [instance] Filter.instNSMul Filter.instNPow Filter.instZSMul Filter.instZPow /-- `Filter α` is a `Semigroup` under pointwise operations if `α` is. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- `Filter α` is an `AddSemigroup` under pointwise operations if `α` is. -/] protected def semigroup [Semigroup α] : Semigroup (Filter α) where mul_assoc _ _ _ := map₂_assoc mul_assoc /-- `Filter α` is a `CommSemigroup` under pointwise operations if `α` is. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- `Filter α` is an `AddCommSemigroup` under pointwise operations if `α` is. -/] protected def commSemigroup [CommSemigroup α] : CommSemigroup (Filter α) := { Filter.semigroup with mul_comm := fun _ _ => map₂_comm mul_comm } @@ -508,7 +508,7 @@ section MulOneClass variable [MulOneClass α] [MulOneClass β] /-- `Filter α` is a `MulOneClass` under pointwise operations if `α` is. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- `Filter α` is an `AddZeroClass` under pointwise operations if `α` is. -/] protected def mulOneClass : MulOneClass (Filter α) where one_mul := map₂_left_identity one_mul @@ -560,7 +560,7 @@ section Monoid variable [Monoid α] {f g : Filter α} {s : Set α} {a : α} {m n : ℕ} /-- `Filter α` is a `Monoid` under pointwise operations if `α` is. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- `Filter α` is an `AddMonoid` under pointwise operations if `α` is. -/] protected def monoid : Monoid (Filter α) := { Filter.mulOneClass, Filter.semigroup, @Filter.instNPow α _ _ with } @@ -611,7 +611,7 @@ protected theorem _root_.IsUnit.filter : IsUnit a → IsUnit (pure a : Filter α end Monoid /-- `Filter α` is a `CommMonoid` under pointwise operations if `α` is. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- `Filter α` is an `AddCommMonoid` under pointwise operations if `α` is. -/] protected def commMonoid [CommMonoid α] : CommMonoid (Filter α) := { Filter.mulOneClass, Filter.commSemigroup with } @@ -634,7 +634,7 @@ protected theorem mul_eq_one_iff : f * g = 1 ↔ ∃ a b, f = pure a ∧ g = pur rw [pure_mul_pure, h, pure_one] /-- `Filter α` is a division monoid under pointwise operations if `α` is. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- `Filter α` is a subtraction monoid under pointwise operations if `α` is. -/] protected def divisionMonoid : DivisionMonoid (Filter α) := { Filter.monoid, Filter.instInvolutiveInv, Filter.instDiv, Filter.instZPow (α := α) with @@ -658,7 +658,7 @@ theorem isUnit_iff : IsUnit f ↔ ∃ a, f = pure a ∧ IsUnit a := by end DivisionMonoid /-- `Filter α` is a commutative division monoid under pointwise operations if `α` is. -/ -@[to_additive (attr := instance_reducible) subtractionCommMonoid +@[to_additive (attr := implicit_reducible) subtractionCommMonoid /-- `Filter α` is a commutative subtraction monoid under pointwise operations if `α` is. -/] protected def divisionCommMonoid [DivisionCommMonoid α] : DivisionCommMonoid (Filter α) := { Filter.divisionMonoid, Filter.commSemigroup with } @@ -784,7 +784,7 @@ variable [SMul α β] {f f₁ f₂ : Filter α} {g g₁ g₂ h : Filter β} {s : {b : β} /-- The filter `f • g` is generated by `{s • t | s ∈ f, t ∈ g}` in scope `Pointwise`. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- The filter `f +ᵥ g` is generated by `{s +ᵥ t | s ∈ f, t ∈ g}` in locale `Pointwise`. -/] protected def instSMul : SMul (Filter α) (Filter β) := @@ -967,7 +967,7 @@ section SMul variable [SMul α β] {f f₁ f₂ : Filter β} {s : Set β} {a : α} /-- `a • f` is the map of `f` under `a •` in scope `Pointwise`. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- `a +ᵥ f` is the map of `f` under `a +ᵥ` in scope `Pointwise`. -/] protected def instSMulFilter : SMul α (Filter β) := ⟨fun a => map (a • ·)⟩ @@ -1064,7 +1064,7 @@ instance isCentralScalar [SMul α β] [SMul αᵐᵒᵖ β] [IsCentralScalar α /-- A multiplicative action of a monoid `α` on a type `β` gives a multiplicative action of `Filter α` on `Filter β`. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- An additive action of an additive monoid `α` on a type `β` gives an additive action of `Filter α` on `Filter β`. -/] protected def mulAction [Monoid α] [MulAction α β] : MulAction (Filter α) (Filter β) where @@ -1073,7 +1073,7 @@ protected def mulAction [Monoid α] [MulAction α β] : MulAction (Filter α) (F /-- A multiplicative action of a monoid on a type `β` gives a multiplicative action on `Filter β`. -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- An additive action of an additive monoid on a type `β` gives an additive action on `Filter β`. -/] protected def mulActionFilter [Monoid α] [MulAction α β] : MulAction α (Filter β) where diff --git a/Mathlib/Order/GaloisConnection/Defs.lean b/Mathlib/Order/GaloisConnection/Defs.lean index 5e4dd2aff2834c..0dc253834c35ec 100644 --- a/Mathlib/Order/GaloisConnection/Defs.lean +++ b/Mathlib/Order/GaloisConnection/Defs.lean @@ -224,6 +224,7 @@ def GaloisConnection.toGaloisInsertion {α β : Type*} [Preorder α] [Preorder choice_eq := fun _ _ => rfl } /-- Lift the bottom along a Galois connection -/ +@[implicit_reducible] def GaloisConnection.liftOrderBot {α β : Type*} [Preorder α] [OrderBot α] [PartialOrder β] {l : α → β} {u : β → α} (gc : GaloisConnection l u) : OrderBot β where @@ -311,6 +312,7 @@ def GaloisConnection.toGaloisCoinsertion {α β : Type*} [Preorder α] [Preorder choice_eq := fun _ _ => rfl } /-- Lift the top along a Galois connection -/ +@[implicit_reducible] def GaloisConnection.liftOrderTop {α β : Type*} [PartialOrder α] [Preorder β] [OrderTop β] {l : α → β} {u : β → α} (gc : GaloisConnection l u) : OrderTop α where diff --git a/Mathlib/Order/Interval/Finset/Basic.lean b/Mathlib/Order/Interval/Finset/Basic.lean index 61757b96a38bdb..58d7bc5a4a83aa 100644 --- a/Mathlib/Order/Interval/Finset/Basic.lean +++ b/Mathlib/Order/Interval/Finset/Basic.lean @@ -264,6 +264,7 @@ theorem Ioo_self : Ioo a a = ∅ := variable {a} /-- A set with upper and lower bounds in a locally finite order is a fintype -/ +@[implicit_reducible] def _root_.Set.fintypeOfMemBounds {s : Set α} [DecidablePred (· ∈ s)] (ha : a ∈ lowerBounds s) (hb : b ∈ upperBounds s) : Fintype s := Set.fintypeSubset (Set.Icc a b) fun _ hx => ⟨ha hx, hb hx⟩ diff --git a/Mathlib/Order/Interval/Finset/Defs.lean b/Mathlib/Order/Interval/Finset/Defs.lean index 91619c0e61ed91..34269e5eec7e8e 100644 --- a/Mathlib/Order/Interval/Finset/Defs.lean +++ b/Mathlib/Order/Interval/Finset/Defs.lean @@ -149,6 +149,7 @@ class LocallyFiniteOrderBot (α : Type*) [Preorder α] where /-- A constructor from a definition of `Finset.Icc` alone, the other ones being derived by removing the ends. As opposed to `LocallyFiniteOrder.ofIcc`, this one requires `DecidableLE` but only `Preorder`. -/ +@[implicit_reducible] def LocallyFiniteOrder.ofIcc' (α : Type*) [Preorder α] [DecidableLE α] (finsetIcc : α → α → Finset α) (mem_Icc : ∀ a b x, x ∈ finsetIcc a b ↔ a ≤ x ∧ x ≤ b) : LocallyFiniteOrder α where @@ -165,6 +166,7 @@ def LocallyFiniteOrder.ofIcc' (α : Type*) [Preorder α] [DecidableLE α] /-- A constructor from a definition of `Finset.Icc` alone, the other ones being derived by removing the ends. As opposed to `LocallyFiniteOrder.ofIcc'`, this one requires `PartialOrder` but only `DecidableEq`. -/ +@[implicit_reducible] def LocallyFiniteOrder.ofIcc (α : Type*) [PartialOrder α] [DecidableEq α] (finsetIcc : α → α → Finset α) (mem_Icc : ∀ a b x, x ∈ finsetIcc a b ↔ a ≤ x ∧ x ≤ b) : LocallyFiniteOrder α where @@ -181,6 +183,7 @@ def LocallyFiniteOrder.ofIcc (α : Type*) [PartialOrder α] [DecidableEq α] /-- A constructor from a definition of `Finset.Ici` alone, the other ones being derived by removing the ends. As opposed to `LocallyFiniteOrderTop.ofIci`, this one requires `DecidableLE` but only `Preorder`. -/ +@[implicit_reducible] def LocallyFiniteOrderTop.ofIci' (α : Type*) [Preorder α] [DecidableLE α] (finsetIci : α → Finset α) (mem_Ici : ∀ a x, x ∈ finsetIci a ↔ a ≤ x) : LocallyFiniteOrderTop α where @@ -192,6 +195,7 @@ def LocallyFiniteOrderTop.ofIci' (α : Type*) [Preorder α] [DecidableLE α] /-- A constructor from a definition of `Finset.Ici` alone, the other ones being derived by removing the ends. As opposed to `LocallyFiniteOrderTop.ofIci'`, this one requires `PartialOrder` but only `DecidableEq`. -/ +@[implicit_reducible] def LocallyFiniteOrderTop.ofIci (α : Type*) [PartialOrder α] [DecidableEq α] (finsetIci : α → Finset α) (mem_Ici : ∀ a x, x ∈ finsetIci a ↔ a ≤ x) : LocallyFiniteOrderTop α where @@ -203,6 +207,7 @@ def LocallyFiniteOrderTop.ofIci (α : Type*) [PartialOrder α] [DecidableEq α] /-- A constructor from a definition of `Finset.Iic` alone, the other ones being derived by removing the ends. As opposed to `LocallyFiniteOrderBot.ofIic`, this one requires `DecidableLE` but only `Preorder`. -/ +@[implicit_reducible] def LocallyFiniteOrderBot.ofIic' (α : Type*) [Preorder α] [DecidableLE α] (finsetIic : α → Finset α) (mem_Iic : ∀ a x, x ∈ finsetIic a ↔ x ≤ a) : LocallyFiniteOrderBot α where @@ -214,6 +219,7 @@ def LocallyFiniteOrderBot.ofIic' (α : Type*) [Preorder α] [DecidableLE α] /-- A constructor from a definition of `Finset.Iic` alone, the other ones being derived by removing the ends. As opposed to `LocallyFiniteOrderBot.ofIic'`, this one requires `PartialOrder` but only `DecidableEq`. -/ +@[implicit_reducible] def LocallyFiniteOrderBot.ofIic (α : Type*) [PartialOrder α] [DecidableEq α] (finsetIic : α → Finset α) (mem_Iic : ∀ a x, x ∈ finsetIic a ↔ x ≤ a) : LocallyFiniteOrderBot α where @@ -611,6 +617,7 @@ section Preorder variable [Preorder α] [Preorder β] /-- A noncomputable constructor from the finiteness of all closed intervals. -/ +@[implicit_reducible] noncomputable def LocallyFiniteOrder.ofFiniteIcc (h : ∀ a b : α, (Set.Icc a b).Finite) : LocallyFiniteOrder α := @LocallyFiniteOrder.ofIcc' α _ (Classical.decRel _) (fun a b => (h a b).toFinset) fun a b x => by @@ -678,6 +685,7 @@ instance : Subsingleton (LocallyFiniteOrderBot α) := -- Should this be called `LocallyFiniteOrder.lift`? /-- Given an order embedding `α ↪o β`, pulls back the `LocallyFiniteOrder` on `β` to `α`. -/ +@[implicit_reducible] protected noncomputable def OrderEmbedding.locallyFiniteOrder [LocallyFiniteOrder β] (f : α ↪o β) : LocallyFiniteOrder α where finsetIcc a b := (Icc (f a) (f b)).preimage f f.toEmbedding.injective.injOn diff --git a/Mathlib/Order/Lattice.lean b/Mathlib/Order/Lattice.lean index d5ba9ce7c00a83..ce9237844a9e05 100644 --- a/Mathlib/Order/Lattice.lean +++ b/Mathlib/Order/Lattice.lean @@ -100,6 +100,7 @@ join-semilattice. The partial order is defined so that `a ≤ b` unfolds to `a ⊔ b = b`; cf. `sup_eq_right`. -/ +@[implicit_reducible] def SemilatticeSup.mk' {α : Type*} [Max α] (sup_comm : ∀ a b : α, a ⊔ b = b ⊔ a) (sup_assoc : ∀ a b c : α, a ⊔ b ⊔ c = a ⊔ (b ⊔ c)) (sup_idem : ∀ a : α, a ⊔ a = a) : SemilatticeSup α where @@ -118,6 +119,7 @@ meet-semilattice. The partial order is defined so that `a ≤ b` unfolds to `b ⊓ a = a`; cf. `inf_eq_right`. -/ +@[implicit_reducible] def SemilatticeInf.mk' {α : Type*} [Min α] (inf_comm : ∀ a b : α, a ⊓ b = b ⊓ a) (inf_assoc : ∀ a b c : α, a ⊓ b ⊓ c = a ⊓ (b ⊓ c)) (inf_idem : ∀ a : α, a ⊓ a = a) : SemilatticeInf α where @@ -390,6 +392,7 @@ laws relating the two operations has the structure of a lattice. The partial order is defined so that `a ≤ b` unfolds to `a ⊔ b = b`; cf. `sup_eq_right`. -/ +@[implicit_reducible] def Lattice.mk' {α : Type*} [Max α] [Min α] (sup_comm : ∀ a b : α, a ⊔ b = b ⊔ a) (sup_assoc : ∀ a b c : α, a ⊔ b ⊔ c = a ⊔ (b ⊔ c)) (inf_comm : ∀ a b : α, a ⊓ b = b ⊓ a) (inf_assoc : ∀ a b c : α, a ⊓ b ⊓ c = a ⊓ (b ⊓ c)) (sup_inf_self : ∀ a b : α, a ⊔ a ⊓ b = a) diff --git a/Mathlib/Order/OmegaCompletePartialOrder.lean b/Mathlib/Order/OmegaCompletePartialOrder.lean index ac2bfc305e844d..8de50091394f0b 100644 --- a/Mathlib/Order/OmegaCompletePartialOrder.lean +++ b/Mathlib/Order/OmegaCompletePartialOrder.lean @@ -235,6 +235,7 @@ lemma ωSup_eq_of_isLUB {c : Chain α} {a : α} (h : IsLUB (Set.range c) a) : a /-- A subset `p : α → Prop` of the type closed under `ωSup` induces an `OmegaCompletePartialOrder` on the subtype `{a : α // p a}`. -/ +@[implicit_reducible] def subtype {α : Type*} [OmegaCompletePartialOrder α] (p : α → Prop) (hp : ∀ c : Chain α, (∀ i ∈ c, p i) → p (ωSup c)) : OmegaCompletePartialOrder (Subtype p) := OmegaCompletePartialOrder.lift (OrderHom.Subtype.val p) diff --git a/Mathlib/Order/OrderDual.lean b/Mathlib/Order/OrderDual.lean index 3f80d60ea06755..747f78e7fee042 100644 --- a/Mathlib/Order/OrderDual.lean +++ b/Mathlib/Order/OrderDual.lean @@ -100,6 +100,7 @@ instance instLinearOrder (α : Type*) [LinearOrder α] : LinearOrder αᵒᵈ wh rfl /-- The opposite linear order to a given linear order -/ +@[implicit_reducible] def _root_.LinearOrder.swap (α : Type*) (_ : LinearOrder α) : LinearOrder α := inferInstanceAs <| LinearOrder (OrderDual α) diff --git a/Mathlib/Order/RelClasses.lean b/Mathlib/Order/RelClasses.lean index 17870c2fcde06e..7b0640df822909 100644 --- a/Mathlib/Order/RelClasses.lean +++ b/Mathlib/Order/RelClasses.lean @@ -292,7 +292,7 @@ theorem fix_eq {motive : α → Sort*} (ind : ∀ x : α, (∀ y : α, y < x → IsWellFounded.fix_eq _ ind /-- Derive a `WellFoundedRelation` instance from a `WellFoundedLT` instance. -/ -@[to_dual (attr := instance_reducible) +@[to_dual (attr := implicit_reducible) /-- Derive a `WellFoundedRelation` instance from a `WellFoundedGT` instance. -/] def toWellFoundedRelation : WellFoundedRelation α := IsWellFounded.toWellFoundedRelation (· < ·) @@ -301,6 +301,7 @@ end WellFoundedLT open Classical in /-- Construct a decidable linear order from a well-founded linear order. -/ +@[implicit_reducible] noncomputable def IsWellOrder.linearOrder (r : α → α → Prop) [IsWellOrder α r] : LinearOrder α := linearOrderOfSTO r diff --git a/Mathlib/Order/SuccPred/Basic.lean b/Mathlib/Order/SuccPred/Basic.lean index 55b18bc2b61dc9..51f971b5005b3c 100644 --- a/Mathlib/Order/SuccPred/Basic.lean +++ b/Mathlib/Order/SuccPred/Basic.lean @@ -89,6 +89,7 @@ section Preorder variable [Preorder α] /-- A constructor for `SuccOrder α` usable when `α` has no maximal element. -/ +@[implicit_reducible] def SuccOrder.ofSuccLeIff (succ : α → α) (hsucc_le_iff : ∀ {a b}, succ a ≤ b ↔ a < b) : SuccOrder α where succ := succ @@ -97,6 +98,7 @@ def SuccOrder.ofSuccLeIff (succ : α → α) (hsucc_le_iff : ∀ {a b}, succ a succ_le_of_lt := hsucc_le_iff.2 /-- A constructor for `PredOrder α` usable when `α` has no minimal element. -/ +@[implicit_reducible] def PredOrder.ofLePredIff (pred : α → α) (hle_pred_iff : ∀ {a b}, a ≤ pred b ↔ a < b) : PredOrder α where pred := pred @@ -111,7 +113,7 @@ section LinearOrder variable [LinearOrder α] /-- A constructor for `SuccOrder α` for `α` a linear order. -/ -@[simps] +@[simps, implicit_reducible] def SuccOrder.ofCore (succ : α → α) (hn : ∀ {a}, ¬IsMax a → ∀ b, a < b ↔ succ a ≤ b) (hm : ∀ a, IsMax a → succ a = a) : SuccOrder α where succ := succ @@ -120,7 +122,7 @@ def SuccOrder.ofCore (succ : α → α) (hn : ∀ {a}, ¬IsMax a → ∀ b, a < max_of_succ_le {a} := not_imp_not.mp fun h ↦ by simpa using (hn h a).not /-- A constructor for `PredOrder α` for `α` a linear order. -/ -@[simps] +@[simps, implicit_reducible] def PredOrder.ofCore (pred : α → α) (hn : ∀ {a}, ¬IsMin a → ∀ b, b ≤ pred a ↔ b < a) (hm : ∀ a, IsMin a → pred a = a) : PredOrder α where @@ -133,6 +135,7 @@ variable (α) open Classical in /-- A well-order is a `SuccOrder`. -/ +@[implicit_reducible] noncomputable def SuccOrder.ofLinearWellFoundedLT [WellFoundedLT α] : SuccOrder α := ofCore (fun a ↦ if h : (Ioi a).Nonempty then wellFounded_lt.min _ h else a) (fun ha _ ↦ by diff --git a/Mathlib/Order/SuccPred/CompleteLinearOrder.lean b/Mathlib/Order/SuccPred/CompleteLinearOrder.lean index 31de80c9adb332..d514475c7b9f9a 100644 --- a/Mathlib/Order/SuccPred/CompleteLinearOrder.lean +++ b/Mathlib/Order/SuccPred/CompleteLinearOrder.lean @@ -62,6 +62,7 @@ lemma IsGLB.exists_of_nonempty_of_not_isPredPrelimit open Classical in /-- Every conditionally complete linear order with well-founded `<` is a successor order, by setting the successor of an element to be the infimum of all larger elements. -/ +@[implicit_reducible] noncomputable def ConditionallyCompleteLinearOrder.toSuccOrder [WellFoundedLT α] : SuccOrder α where succ a := if IsMax a then a else sInf {b | a < b} diff --git a/Mathlib/Order/SuccPred/LinearLocallyFinite.lean b/Mathlib/Order/SuccPred/LinearLocallyFinite.lean index 005626654e1b6c..5ff288a1432557 100644 --- a/Mathlib/Order/SuccPred/LinearLocallyFinite.lean +++ b/Mathlib/Order/SuccPred/LinearLocallyFinite.lean @@ -149,6 +149,7 @@ variable (ι) in /-- A locally finite order is a `SuccOrder`. This is not an instance, because its `succ` field conflicts with computable `SuccOrder` structures on `ℕ` and `ℤ`. -/ +@[implicit_reducible] noncomputable def succOrder [LocallyFiniteOrder ι] : SuccOrder ι where succ := succFn le_succ := le_succFn @@ -159,6 +160,7 @@ variable (ι) in /-- A locally finite order is a `PredOrder`. This is not an instance, because its `succ` field conflicts with computable `PredOrder` structures on `ℕ` and `ℤ`. -/ +@[implicit_reducible] noncomputable def predOrder [LocallyFiniteOrder ι] : PredOrder ι := letI := succOrder (ι := ιᵒᵈ) inferInstanceAs (PredOrder ιᵒᵈᵒᵈ) diff --git a/Mathlib/Order/SupClosed.lean b/Mathlib/Order/SupClosed.lean index 5c2dfd62a95037..9b414e7c798338 100644 --- a/Mathlib/Order/SupClosed.lean +++ b/Mathlib/Order/SupClosed.lean @@ -532,6 +532,7 @@ end DistribLattice /-- A join-semilattice where every sup-closed set has a least upper bound is automatically complete. -/ +@[implicit_reducible] def SemilatticeSup.toCompleteSemilatticeSup [SemilatticeSup α] (sSup : Set α → α) (h : ∀ s, SupClosed s → IsLUB s (sSup s)) : CompleteSemilatticeSup α where sSup := fun s => sSup (supClosure s) @@ -540,6 +541,7 @@ def SemilatticeSup.toCompleteSemilatticeSup [SemilatticeSup α] (sSup : Set α /-- A meet-semilattice where every inf-closed set has a greatest lower bound is automatically complete. -/ +@[implicit_reducible] def SemilatticeInf.toCompleteSemilatticeInf [SemilatticeInf α] (sInf : Set α → α) (h : ∀ s, InfClosed s → IsGLB s (sInf s)) : CompleteSemilatticeInf α where sInf := fun s => sInf (infClosure s) diff --git a/Mathlib/Order/Types/Defs.lean b/Mathlib/Order/Types/Defs.lean index 33fa9719d5025f..66a25a7f0dca4d 100644 --- a/Mathlib/Order/Types/Defs.lean +++ b/Mathlib/Order/Types/Defs.lean @@ -49,6 +49,7 @@ variable {α β : Type u} [LinearOrder α] [LinearOrder β] {δ : Sort v} /-- Equivalence relation on linear orders on arbitrary types in universe `u`, given by order isomorphism. -/ +@[implicit_reducible] def OrderType.instSetoid : Setoid LinOrd where r := fun lin_ord₁ lin_ord₂ ↦ Nonempty (lin_ord₁ ≃o lin_ord₂) iseqv := ⟨fun _ ↦ ⟨.refl _⟩, fun ⟨e⟩ ↦ ⟨e.symm⟩, fun ⟨e₁⟩ ⟨e₂⟩ ↦ ⟨e₁.trans e₂⟩⟩ diff --git a/Mathlib/Order/WellFounded.lean b/Mathlib/Order/WellFounded.lean index d06c52b51ca2be..f17c1c652696c6 100644 --- a/Mathlib/Order/WellFounded.lean +++ b/Mathlib/Order/WellFounded.lean @@ -312,7 +312,7 @@ theorem WellFounded.induction_bot {α} {r : α → α → Prop} (hwf : WellFound end Induction /-- A nonempty linear order with well-founded `<` has a bottom element. -/ -@[to_dual (attr := instance_reducible) +@[to_dual (attr := implicit_reducible) /-- A nonempty linear order with well-founded `>` has a top element. -/] noncomputable def WellFoundedLT.toOrderBot (α) [LinearOrder α] [Nonempty α] [h : WellFoundedLT α] : OrderBot α where diff --git a/Mathlib/Probability/Process/Predictable.lean b/Mathlib/Probability/Process/Predictable.lean index bfe2e9bf7eb727..e614c009b4a4f9 100644 --- a/Mathlib/Probability/Process/Predictable.lean +++ b/Mathlib/Probability/Process/Predictable.lean @@ -50,6 +50,7 @@ namespace Filtration /-- Given a filtration `𝓕`, the predictable σ-algebra is the σ-algebra on `ι × Ω` generated by sets of the form `(t, ∞) × A` for `t ∈ ι` and `A ∈ 𝓕 t` and `{⊥} × A` for `A ∈ 𝓕 ⊥`. -/ +@[implicit_reducible] def predictable (𝓕 : Filtration ι m) : MeasurableSpace (ι × Ω) := MeasurableSpace.generateFrom <| {s | ∃ A, MeasurableSet[𝓕 ⊥] A ∧ s = {⊥} ×ˢ A} ∪ diff --git a/Mathlib/Probability/Process/Stopping.lean b/Mathlib/Probability/Process/Stopping.lean index e7b5664976e74e..176d68ea3ed472 100644 --- a/Mathlib/Probability/Process/Stopping.lean +++ b/Mathlib/Probability/Process/Stopping.lean @@ -361,6 +361,7 @@ section Preorder variable [Preorder ι] {f : Filtration ι m} {τ π : Ω → WithTop ι} /-- The associated σ-algebra with a stopping time. -/ +@[implicit_reducible] protected def measurableSpace (hτ : IsStoppingTime f τ) : MeasurableSpace Ω where MeasurableSet' s := MeasurableSet s ∧ ∀ i : ι, MeasurableSet[f i] (s ∩ {ω | τ ω ≤ i}) measurableSet_empty := by simp diff --git a/Mathlib/RingTheory/AlgebraTower.lean b/Mathlib/RingTheory/AlgebraTower.lean index 6a485512e0dd95..375d528611b045 100644 --- a/Mathlib/RingTheory/AlgebraTower.lean +++ b/Mathlib/RingTheory/AlgebraTower.lean @@ -42,6 +42,7 @@ variable [IsScalarTower R S A] [IsScalarTower R S B] /-- Suppose that `R → S → A` is a tower of algebras. If an element `r : R` is invertible in `S`, then it is invertible in `A`. -/ +@[implicit_reducible] def Invertible.algebraTower (r : R) [Invertible (algebraMap R S r)] : Invertible (algebraMap R A r) := Invertible.copy (Invertible.map (algebraMap S A) (algebraMap R S r)) (algebraMap R A r) @@ -49,6 +50,7 @@ def Invertible.algebraTower (r : R) [Invertible (algebraMap R S r)] : /-- A natural number that is invertible when coerced to `R` is also invertible when coerced to any `R`-algebra. -/ +@[implicit_reducible] def invertibleAlgebraCoeNat (n : ℕ) [inv : Invertible (n : R)] : Invertible (n : A) := haveI : Invertible (algebraMap ℕ R n) := inv Invertible.algebraTower ℕ R A n diff --git a/Mathlib/RingTheory/Bialgebra/Basic.lean b/Mathlib/RingTheory/Bialgebra/Basic.lean index 90704a00bc9874..323f33e19674de 100644 --- a/Mathlib/RingTheory/Bialgebra/Basic.lean +++ b/Mathlib/RingTheory/Bialgebra/Basic.lean @@ -103,6 +103,7 @@ is an `R`-algebra with a coalgebra structure, then `Bialgebra.mk'` consumes proofs that the counit and comultiplication preserve the identity and multiplication, and produces a bialgebra structure on `A`. -/ +@[implicit_reducible] def mk' (R : Type u) (A : Type v) [CommSemiring R] [Semiring A] [Algebra R A] [C : Coalgebra R A] (counit_one : C.counit 1 = 1) (counit_mul : ∀ {a b}, C.counit (a * b) = C.counit a * C.counit b) diff --git a/Mathlib/RingTheory/DedekindDomain/AdicValuation.lean b/Mathlib/RingTheory/DedekindDomain/AdicValuation.lean index 5864ca27e5de82..77deb1baf14aeb 100644 --- a/Mathlib/RingTheory/DedekindDomain/AdicValuation.lean +++ b/Mathlib/RingTheory/DedekindDomain/AdicValuation.lean @@ -414,6 +414,7 @@ ring of integers, denoted `v.adicCompletionIntegers`. -/ /-- `K` as a valued field with the `v`-adic valuation. -/ +@[implicit_reducible] def adicValued : Valued K ℤᵐ⁰ := Valued.mk' (v.valuation K) diff --git a/Mathlib/RingTheory/DiscreteValuationRing/Basic.lean b/Mathlib/RingTheory/DiscreteValuationRing/Basic.lean index 6a18fa8fc80c11..83d2c7358b50b8 100644 --- a/Mathlib/RingTheory/DiscreteValuationRing/Basic.lean +++ b/Mathlib/RingTheory/DiscreteValuationRing/Basic.lean @@ -536,6 +536,7 @@ variable (R) in only takes two steps to terminate. Given `GCD(x,y)`, if `x ∣ y` then `y%x = 0` so we're done in one step; otherwise `y%x = y` and then `GCD(x,y) = GCD(y,x)` which brings us back to the first case. See `EuclideanDomain.to_principal_ideal_domain` for EuclideanDomain ⇒ PID. -/ +@[implicit_reducible] def toEuclideanDomain : EuclideanDomain R where quotient := quotient quotient_zero x := by simp [quotient] diff --git a/Mathlib/RingTheory/EuclideanDomain.lean b/Mathlib/RingTheory/EuclideanDomain.lean index 5fe934c3377798..175a23a7a3cce8 100644 --- a/Mathlib/RingTheory/EuclideanDomain.lean +++ b/Mathlib/RingTheory/EuclideanDomain.lean @@ -69,6 +69,7 @@ end GCDMonoid namespace EuclideanDomain /-- Create a `GCDMonoid` whose `GCDMonoid.gcd` matches `EuclideanDomain.gcd`. -/ +@[implicit_reducible] def gcdMonoid (R) [EuclideanDomain R] [DecidableEq R] : GCDMonoid R where gcd := gcd lcm := lcm diff --git a/Mathlib/RingTheory/GradedAlgebra/Basic.lean b/Mathlib/RingTheory/GradedAlgebra/Basic.lean index ce323849c82f87..8a1c61e3c9b503 100644 --- a/Mathlib/RingTheory/GradedAlgebra/Basic.lean +++ b/Mathlib/RingTheory/GradedAlgebra/Basic.lean @@ -359,6 +359,7 @@ and satisfying `SetLike.GradedMonoid M` (essentially, is multiplicative) such that `DirectSum.IsInternal M` (`A` is the direct sum of the `M i`), we endow `A` with the structure of a graded algebra. The submodules are the *homogeneous* parts. -/ +@[implicit_reducible] noncomputable def gradedAlgebra (hM : DirectSum.IsInternal M) : GradedAlgebra M := { (inferInstance : SetLike.GradedMonoid M) with decompose' := hM.coeAlgEquiv.symm diff --git a/Mathlib/RingTheory/IdealFilter/Topology.lean b/Mathlib/RingTheory/IdealFilter/Topology.lean index d690c41227dfff..4b8e5b15e66405 100644 --- a/Mathlib/RingTheory/IdealFilter/Topology.lean +++ b/Mathlib/RingTheory/IdealFilter/Topology.lean @@ -43,6 +43,7 @@ open scoped Pointwise Topology namespace IdealFilter /-- The additive-group filter basis whose sets are the ideals belonging to the ideal filter `F`. -/ +@[implicit_reducible] def addGroupFilterBasis {A : Type*} [Ring A] (F : IdealFilter A) : AddGroupFilterBasis A where sets := {(I : Set A) | I ∈ F} nonempty := ⟨_, ⟨_, F.nonempty.choose_spec, rfl⟩⟩ @@ -55,7 +56,7 @@ def addGroupFilterBasis {A : Type*} [Ring A] (F : IdealFilter A) : AddGroupFilte conj' := by aesop /-- Under `[F.IsUniform]`, the ring filter basis obtained from `addGroupFilterBasis`. -/ -@[simps! -isSimp sets] +@[simps! -isSimp sets, implicit_reducible] def ringFilterBasis {A : Type*} [Ring A] {F : IdealFilter A} [F.IsUniform] : RingFilterBasis A where __ := F.addGroupFilterBasis diff --git a/Mathlib/RingTheory/IntegralDomain.lean b/Mathlib/RingTheory/IntegralDomain.lean index 488081edffa82f..5beb881dda83cd 100644 --- a/Mathlib/RingTheory/IntegralDomain.lean +++ b/Mathlib/RingTheory/IntegralDomain.lean @@ -51,6 +51,7 @@ theorem mul_left_bijective_of_finite₀ [IsRightCancelMulZero M] {a : M} (ha : a Finite.injective_iff_bijective.1 <| mul_left_injective₀ ha /-- Every finite nontrivial cancel_monoid_with_zero is a group_with_zero. -/ +@[implicit_reducible] def Fintype.groupWithZeroOfCancel (M : Type*) [MonoidWithZero M] [IsLeftCancelMulZero M] [DecidableEq M] [Fintype M] [Nontrivial M] : GroupWithZero M := { ‹Nontrivial M›, @@ -92,6 +93,7 @@ section Ring /-- Every finite domain is a division ring. More generally, they are fields; this can be found in `Mathlib/RingTheory/LittleWedderburn.lean`. -/ +@[implicit_reducible] def Fintype.divisionRingOfIsDomain (R : Type*) [Ring R] [IsDomain R] [DecidableEq R] [Fintype R] : DivisionRing R where __ := (‹Ring R› :) -- this also works without the `( :)`, but it's slightly slow @@ -103,6 +105,7 @@ def Fintype.divisionRingOfIsDomain (R : Type*) [Ring R] [IsDomain R] [DecidableE /-- Every finite commutative domain is a field. More generally, commutativity is not required: this can be found in `Mathlib/RingTheory/LittleWedderburn.lean`. -/ +@[implicit_reducible] def Fintype.fieldOfDomain (R) [CommRing R] [IsDomain R] [DecidableEq R] [Fintype R] : Field R := { Fintype.divisionRingOfIsDomain R, ‹CommRing R› with } diff --git a/Mathlib/RingTheory/Invariant/Basic.lean b/Mathlib/RingTheory/Invariant/Basic.lean index e8ca07ad4beed5..f8c4eb2661ba3c 100644 --- a/Mathlib/RingTheory/Invariant/Basic.lean +++ b/Mathlib/RingTheory/Invariant/Basic.lean @@ -50,6 +50,7 @@ variable (A K L B : Type*) [CommRing A] [CommRing B] [Field K] [Field L] [IsIntegrallyClosed A] [IsIntegralClosure B A L] /-- In the AKLB setup, the Galois group of `L/K` acts on `B`. -/ +@[implicit_reducible] noncomputable def IsIntegralClosure.MulSemiringAction [Algebra.IsAlgebraic K L] : MulSemiringAction Gal(L/K) B := MulSemiringAction.compHom B (galRestrict A K L B).toMonoidHom diff --git a/Mathlib/RingTheory/LittleWedderburn.lean b/Mathlib/RingTheory/LittleWedderburn.lean index 8e816c3735f830..a654b612c2766c 100644 --- a/Mathlib/RingTheory/LittleWedderburn.lean +++ b/Mathlib/RingTheory/LittleWedderburn.lean @@ -55,6 +55,7 @@ open Module Polynomial variable {D} +@[implicit_reducible] private def field (hD : InductionHyp D) {R : Subring D} (hR : R < ⊤) [Fintype D] [DecidableEq D] [DecidablePred (· ∈ R)] : Field R := diff --git a/Mathlib/RingTheory/Localization/Basic.lean b/Mathlib/RingTheory/Localization/Basic.lean index 7076f2fde79436..0d2b2ddd6668a3 100644 --- a/Mathlib/RingTheory/Localization/Basic.lean +++ b/Mathlib/RingTheory/Localization/Basic.lean @@ -431,6 +431,7 @@ noncomputable def algEquiv : Localization M ≃ₐ[R] S := IsLocalization.algEquiv M _ _ /-- The localization of a singleton is a singleton. Cannot be an instance due to metavariables. -/ +@[implicit_reducible] noncomputable def _root_.IsLocalization.unique (R Rₘ) [CommSemiring R] [CommSemiring Rₘ] (M : Submonoid R) [Subsingleton R] [Algebra R Rₘ] [IsLocalization M Rₘ] : Unique Rₘ := have : Inhabited Rₘ := ⟨1⟩ @@ -502,6 +503,7 @@ This instance can be helpful if you define `Sₘ := Localization (Algebra.algebr however we will instead use the hypotheses `[Algebra Rₘ Sₘ] [IsScalarTower R Rₘ Sₘ]` in lemmas since the algebra structure may arise in different ways. -/ +@[implicit_reducible] noncomputable def localizationAlgebra : Algebra Rₘ Sₘ := (map Sₘ (algebraMap R S) (show _ ≤ (Algebra.algebraMapSubmonoid S M).comap _ from M.le_comap_map) : diff --git a/Mathlib/RingTheory/Localization/Defs.lean b/Mathlib/RingTheory/Localization/Defs.lean index fbdf520976116b..748c35528b027f 100644 --- a/Mathlib/RingTheory/Localization/Defs.lean +++ b/Mathlib/RingTheory/Localization/Defs.lean @@ -313,6 +313,7 @@ theorem exists_mk'_eq (z : S) : ∃ (x : R) (y : M), mk' S x y = z := variable (S) in /-- The localization of a `Fintype` is a `Fintype`. Cannot be an instance. -/ +@[implicit_reducible] noncomputable def fintype' [Fintype R] : Fintype S := have := Classical.propDecidable .ofSurjective (Function.uncurry <| IsLocalization.mk' S) <| mk'_surjective M @@ -320,6 +321,7 @@ noncomputable def fintype' [Fintype R] : Fintype S := variable {M} /-- Localizing at a submonoid with 0 inside it leads to the trivial ring. -/ +@[implicit_reducible] def uniqueOfZeroMem (h : (0 : R) ∈ M) : Unique S := uniqueOfZeroEqOne <| by simpa using IsLocalization.map_units S ⟨0, h⟩ diff --git a/Mathlib/RingTheory/MvPolynomial/WeightedHomogeneous.lean b/Mathlib/RingTheory/MvPolynomial/WeightedHomogeneous.lean index 1034f84c2fda9d..e100dc7aeb47ac 100644 --- a/Mathlib/RingTheory/MvPolynomial/WeightedHomogeneous.lean +++ b/Mathlib/RingTheory/MvPolynomial/WeightedHomogeneous.lean @@ -631,6 +631,7 @@ theorem decompose'_apply [DecidableEq M] (φ : MvPolynomial σ R) (m : M) : /-- Given a weight `w`, the decomposition of `MvPolynomial σ R` into weighted homogeneous submodules -/ +@[implicit_reducible] def weightedDecomposition [DecidableEq M] : DirectSum.Decomposition (weightedHomogeneousSubmodule R w) where decompose' := decompose' R w @@ -656,6 +657,7 @@ def weightedDecomposition [DecidableEq M] : set_option linter.style.whitespace false in -- manual alignment is not recognised /-- Given a weight, `MvPolynomial` as a graded algebra -/ +@[implicit_reducible] def weightedGradedAlgebra [DecidableEq M] : GradedAlgebra (weightedHomogeneousSubmodule R w) where toDecomposition := weightedDecomposition R w diff --git a/Mathlib/RingTheory/NonUnitalSubring/Basic.lean b/Mathlib/RingTheory/NonUnitalSubring/Basic.lean index 3a03c532fe3c27..0174c413490c89 100644 --- a/Mathlib/RingTheory/NonUnitalSubring/Basic.lean +++ b/Mathlib/RingTheory/NonUnitalSubring/Basic.lean @@ -505,6 +505,7 @@ theorem mem_closure_iff {s : Set R} {x} : | neg _ _ h => exact neg_mem h⟩ /-- If all elements of `s : Set A` commute pairwise, then `closure s` is a commutative ring. -/ +@[implicit_reducible] def closureNonUnitalCommRingOfComm {R : Type u} [NonUnitalRing R] {s : Set R} (hcomm : ∀ a ∈ s, ∀ b ∈ s, a * b = b * a) : NonUnitalCommRing (closure s) := { (closure s).toNonUnitalRing with diff --git a/Mathlib/RingTheory/OreLocalization/OreSet.lean b/Mathlib/RingTheory/OreLocalization/OreSet.lean index eccca20b0dcbb4..ab74b4f90def7a 100644 --- a/Mathlib/RingTheory/OreLocalization/OreSet.lean +++ b/Mathlib/RingTheory/OreLocalization/OreSet.lean @@ -29,6 +29,7 @@ namespace OreLocalization /-- Cancellability in monoids with zeros can act as a replacement for the `ore_right_cancel` condition of an ore set. -/ +@[implicit_reducible] def oreSetOfIsCancelMulZero {R : Type*} [MonoidWithZero R] [IsCancelMulZero R] {S : Submonoid R} (oreNum : R → S → R) (oreDenom : R → S → S) (ore_eq : ∀ (r : R) (s : S), oreDenom r s * r = oreNum r s * s) : OreSet S := @@ -41,6 +42,7 @@ def oreSetOfIsCancelMulZero {R : Type*} [MonoidWithZero R] [IsCancelMulZero R] /-- In rings without zero divisors, the first (cancellability) condition is always fulfilled, it suffices to give a proof for the Ore condition itself. -/ +@[implicit_reducible] def oreSetOfNoZeroDivisors {R : Type*} [Ring R] [NoZeroDivisors R] {S : Submonoid R} (oreNum : R → S → R) (oreDenom : R → S → S) (ore_eq : ∀ (r : R) (s : S), oreDenom r s * r = oreNum r s * s) : OreSet S := diff --git a/Mathlib/RingTheory/Polynomial/UniqueFactorization.lean b/Mathlib/RingTheory/Polynomial/UniqueFactorization.lean index 6602c389dbee91..f1d223a1ea6680 100644 --- a/Mathlib/RingTheory/Polynomial/UniqueFactorization.lean +++ b/Mathlib/RingTheory/Polynomial/UniqueFactorization.lean @@ -99,6 +99,7 @@ instance (priority := 100) uniqueFactorizationMonoid : UniqueFactorizationMonoid only finitely many monic factors. (Note that its factors up to unit may be more than monic factors.) See also `UniqueFactorizationMonoid.fintypeSubtypeDvd`. -/ +@[implicit_reducible] noncomputable def fintypeSubtypeMonicDvd (f : D[X]) (hf : f ≠ 0) : Fintype { g : D[X] // g.Monic ∧ g ∣ f } := by set G := { g : D[X] // g.Monic ∧ g ∣ f } diff --git a/Mathlib/RingTheory/PowerBasis.lean b/Mathlib/RingTheory/PowerBasis.lean index ec098808233d2f..79d0777c55b70a 100644 --- a/Mathlib/RingTheory/PowerBasis.lean +++ b/Mathlib/RingTheory/PowerBasis.lean @@ -334,6 +334,7 @@ noncomputable def liftEquiv' [IsDomain B] (pb : PowerBasis A S) : /-- There are finitely many algebra homomorphisms `S →ₐ[A] B` if `S` is of the form `A[x]` and `B` is an integral domain. -/ +@[implicit_reducible] noncomputable def AlgHom.fintype [IsDomain B] (pb : PowerBasis A S) : Fintype (S →ₐ[A] B) := letI := Classical.decEq B Fintype.ofEquiv _ pb.liftEquiv'.symm diff --git a/Mathlib/RingTheory/PrincipalIdealDomain.lean b/Mathlib/RingTheory/PrincipalIdealDomain.lean index 24c1c52c3d4e15..6fa1bf358ef5f5 100644 --- a/Mathlib/RingTheory/PrincipalIdealDomain.lean +++ b/Mathlib/RingTheory/PrincipalIdealDomain.lean @@ -213,6 +213,7 @@ variable (R) /-- Any Bézout domain is a GCD domain. This is not an instance since `GCDMonoid` contains data, and this might not be how we would like to construct it. -/ +@[implicit_reducible] noncomputable def toGCDDomain [IsBezout R] [IsDomain R] [DecidableEq R] : GCDMonoid R := gcdMonoidOfGCD (gcd · ·) (gcd_dvd_left · ·) (gcd_dvd_right · ·) dvd_gcd diff --git a/Mathlib/RingTheory/UniqueFactorizationDomain/Finite.lean b/Mathlib/RingTheory/UniqueFactorizationDomain/Finite.lean index 28833b1bc01f8b..00c3f3ed991167 100644 --- a/Mathlib/RingTheory/UniqueFactorizationDomain/Finite.lean +++ b/Mathlib/RingTheory/UniqueFactorizationDomain/Finite.lean @@ -27,6 +27,7 @@ namespace UniqueFactorizationMonoid /-- If `y` is a nonzero element of a unique factorization monoid with finitely many units (e.g. `ℤ`, `Ideal (ring_of_integers K)`), it has finitely many divisors. -/ +@[implicit_reducible] noncomputable def fintypeSubtypeDvd {M : Type*} [CommMonoidWithZero M] [UniqueFactorizationMonoid M] [Fintype Mˣ] (y : M) (hy : y ≠ 0) : Fintype { x // x ∣ y } := by haveI : Nontrivial M := ⟨⟨y, 0, hy⟩⟩ diff --git a/Mathlib/RingTheory/UniqueFactorizationDomain/GCDMonoid.lean b/Mathlib/RingTheory/UniqueFactorizationDomain/GCDMonoid.lean index 9b6e1a2c449336..abb5e77d5c3859 100644 --- a/Mathlib/RingTheory/UniqueFactorizationDomain/GCDMonoid.lean +++ b/Mathlib/RingTheory/UniqueFactorizationDomain/GCDMonoid.lean @@ -49,6 +49,7 @@ noncomputable def UniqueFactorizationMonoid.toGCDMonoid (α : Type*) [CommMonoid /-- `toNormalizedGCDMonoid` constructs a GCD monoid out of a normalization on a unique factorization domain. -/ +@[implicit_reducible] noncomputable def UniqueFactorizationMonoid.toNormalizedGCDMonoid (α : Type*) [CommMonoidWithZero α] [UniqueFactorizationMonoid α] [NormalizationMonoid α] : NormalizedGCDMonoid α := diff --git a/Mathlib/RingTheory/UniqueFactorizationDomain/NormalizedFactors.lean b/Mathlib/RingTheory/UniqueFactorizationDomain/NormalizedFactors.lean index dd216ef1d44d81..20c83c0b8feee8 100644 --- a/Mathlib/RingTheory/UniqueFactorizationDomain/NormalizedFactors.lean +++ b/Mathlib/RingTheory/UniqueFactorizationDomain/NormalizedFactors.lean @@ -375,6 +375,7 @@ variable [CommMonoidWithZero α] [UniqueFactorizationMonoid α] open scoped Classical in /-- Noncomputably defines a `normalizationMonoid` structure on a `UniqueFactorizationMonoid`. -/ +@[implicit_reducible] protected noncomputable def normalizationMonoid : NormalizationMonoid α := normalizationMonoidOfMonoidHomRightInverse { toFun := fun a : Associates α => diff --git a/Mathlib/RingTheory/Valuation/Basic.lean b/Mathlib/RingTheory/Valuation/Basic.lean index 3efc21b6eb5217..e76514765834ad 100644 --- a/Mathlib/RingTheory/Valuation/Basic.lean +++ b/Mathlib/RingTheory/Valuation/Basic.lean @@ -198,6 +198,7 @@ protected theorem map_pow : ∀ (x) (n : ℕ), v (x ^ n) = v x ^ n := -- The following definition is not an instance, because we have more than one `v` on a given `R`. -- In addition, type class inference would not be able to infer `v`. /-- A valuation gives a preorder on the underlying ring. -/ +@[implicit_reducible] def toPreorder : Preorder R := Preorder.lift v @@ -971,6 +972,7 @@ theorem ext {v₁ v₂ : AddValuation R Γ₀} (h : ∀ r, v₁ r = v₂ r) : v -- The following definition is not an instance, because we have more than one `v` on a given `R`. -- In addition, type class inference would not be able to infer `v`. /-- A valuation gives a preorder on the underlying ring. -/ +@[implicit_reducible] def toPreorder : Preorder R := Preorder.lift v diff --git a/Mathlib/RingTheory/Valuation/RankOne.lean b/Mathlib/RingTheory/Valuation/RankOne.lean index 7a8f8a18d3894f..670c6c5895ebc4 100644 --- a/Mathlib/RingTheory/Valuation/RankOne.lean +++ b/Mathlib/RingTheory/Valuation/RankOne.lean @@ -128,6 +128,7 @@ variable {R : Type*} [CommRing R] [ValuativeRel R] /-- A valuative relation has a rank one valuation when it is both nontrivial and the rank is at most one. -/ +@[implicit_reducible] def Valuation.RankOne.ofRankLeOneStruct [ValuativeRel.IsNontrivial R] (e : RankLeOneStruct R) : Valuation.RankOne (valuation R) where hom := e.emb diff --git a/Mathlib/RingTheory/Valuation/ValuativeRel/Basic.lean b/Mathlib/RingTheory/Valuation/ValuativeRel/Basic.lean index e505f6fed7ec04..6ece75cf6e5be0 100644 --- a/Mathlib/RingTheory/Valuation/ValuativeRel/Basic.lean +++ b/Mathlib/RingTheory/Valuation/ValuativeRel/Basic.lean @@ -314,6 +314,7 @@ lemma val_posSubmonoid_ne_zero (x : posSubmonoid R) : (x : R) ≠ 0 := by variable (R) in /-- The setoid used to construct `ValueGroupWithZero R`. -/ +@[implicit_reducible] def valueSetoid : Setoid (R × posSubmonoid R) where r := fun (x, s) (y, t) => x * t ≤ᵥ y * s ∧ y * s ≤ᵥ x * t iseqv := { @@ -667,6 +668,7 @@ lemma ValueGroupWithZero.mk_eq_div (r : R) (s : posSubmonoid R) : set_option linter.flexible false in -- simp followed by gcongr /-- Construct a valuative relation on a ring using a valuation. -/ +@[implicit_reducible] def ofValuation {S Γ : Type*} [CommRing S] [LinearOrderedCommGroupWithZero Γ] diff --git a/Mathlib/RingTheory/Valuation/ValuativeRel/Trivial.lean b/Mathlib/RingTheory/Valuation/ValuativeRel/Trivial.lean index b3ddb0181f7a3e..a5d43e16a81f46 100644 --- a/Mathlib/RingTheory/Valuation/ValuativeRel/Trivial.lean +++ b/Mathlib/RingTheory/Valuation/ValuativeRel/Trivial.lean @@ -33,6 +33,7 @@ open WithZero /-- The trivial valuative relation on a domain `R`, such that all non-zero elements are related. The domain condition is necessary so that the relation is closed when multiplying. -/ +@[implicit_reducible] def trivialRel : ValuativeRel R where vle x y := if y = 0 then x = 0 else True vle_total _ _ := by split_ifs <;> simp_all diff --git a/Mathlib/SetTheory/Ordinal/Basic.lean b/Mathlib/SetTheory/Ordinal/Basic.lean index 50ffe8025fa9da..5051b60b66919a 100644 --- a/Mathlib/SetTheory/Ordinal/Basic.lean +++ b/Mathlib/SetTheory/Ordinal/Basic.lean @@ -563,6 +563,7 @@ instance small_Ioo (a b : Ordinal.{u}) : Small.{u} (Ioo a b) := small_subset Ioo instance small_Ioc (a b : Ordinal.{u}) : Small.{u} (Ioc a b) := small_subset Ioc_subset_Iic_self /-- `o.ToType` is an `OrderBot` whenever `o ≠ 0`. -/ +@[implicit_reducible] def toTypeOrderBot {o : Ordinal} (ho : o ≠ 0) : OrderBot o.ToType where bot := (enum (· < ·)) ⟨0, _⟩ bot_le := enum_zero_le' (by rwa [pos_iff_ne_zero]) @@ -1339,6 +1340,7 @@ theorem small_iff_lift_mk_lt_univ {α : Type u} : exact ⟨⟨c.out, lift_mk_eq.{u, _, v + 1}.1 (hc.trans (congr rfl c.mk_out.symm))⟩⟩ /-- If a cardinal `c` is nonzero, then `c.ord.ToType` has a least element. -/ +@[implicit_reducible] noncomputable def toTypeOrderBot {c : Cardinal} (hc : c ≠ 0) : OrderBot c.ord.ToType := Ordinal.toTypeOrderBot (fun h ↦ hc (ord_injective (by simpa using h))) diff --git a/Mathlib/SetTheory/ZFC/Basic.lean b/Mathlib/SetTheory/ZFC/Basic.lean index b4ca442704079c..1174059866d25d 100644 --- a/Mathlib/SetTheory/ZFC/Basic.lean +++ b/Mathlib/SetTheory/ZFC/Basic.lean @@ -147,6 +147,7 @@ namespace Classical open PSet ZFSet /-- All functions are classically definable. -/ +@[implicit_reducible] noncomputable def allZFSetDefinable {n} (F : (Fin n → ZFSet.{u}) → ZFSet.{u}) : Definable n F where out xs := (F (mk <| xs ·)).out diff --git a/Mathlib/Tactic/Inhabit.lean b/Mathlib/Tactic/Inhabit.lean index 9c6930404e6f7e..c201b4c41d8a56 100644 --- a/Mathlib/Tactic/Inhabit.lean +++ b/Mathlib/Tactic/Inhabit.lean @@ -20,11 +20,13 @@ open Lean.Meta namespace Lean.Elab.Tactic /-- Derives `Inhabited α` from `Nonempty α` with `Classical.choice`. -/ +@[implicit_reducible] noncomputable def nonempty_to_inhabited (α : Sort*) (_ : Nonempty α) : Inhabited α := Inhabited.mk (Classical.ofNonempty) /-- Derives `Inhabited α` from `Nonempty α` without `Classical.choice` assuming `α` is of type `Prop`. -/ +@[implicit_reducible] def nonempty_prop_to_inhabited (α : Prop) (α_nonempty : Nonempty α) : Inhabited α := Inhabited.mk <| Nonempty.elim α_nonempty id diff --git a/Mathlib/Tactic/Linarith/Preprocessing.lean b/Mathlib/Tactic/Linarith/Preprocessing.lean index a09e9e8c66a686..2cbad19b229410 100644 --- a/Mathlib/Tactic/Linarith/Preprocessing.lean +++ b/Mathlib/Tactic/Linarith/Preprocessing.lean @@ -139,7 +139,7 @@ def mk_natCast_nonneg_prf (p : Expr × Expr) : MetaM (Option Expr) := @[deprecated "Use `Expr.lt` and `Expr.equal` or `Expr.eqv` directly. \ If you need to order expressions, consider ordering them by order seen, with AtomM." - (since := "2025-08-31")] + (since := "2025-08-31"), implicit_reducible] def Expr.Ord : Ord Expr := ⟨fun a b => if Expr.lt a b then .lt else if a.equal b then .eq else .gt⟩ diff --git a/Mathlib/Tactic/NormNum/Basic.lean b/Mathlib/Tactic/NormNum/Basic.lean index e024ba6cd9e670..b369dc4b2d68e3 100644 --- a/Mathlib/Tactic/NormNum/Basic.lean +++ b/Mathlib/Tactic/NormNum/Basic.lean @@ -32,6 +32,7 @@ universe u namespace Mathlib.Meta.NormNum /-- If `b` divides `a` and `a` is invertible, then `b` is invertible. -/ +@[implicit_reducible] def invertibleOfMul {α} [Semiring α] (k : ℕ) (b : α) : ∀ (a : α) [Invertible a], a = k * b → Invertible b | _, ⟨c, hc1, hc2⟩, rfl => by @@ -40,6 +41,7 @@ def invertibleOfMul {α} [Semiring α] (k : ℕ) (b : α) : exact ⟨_, hc1, hc2⟩ /-- If `b` divides `a` and `a` is invertible, then `b` is invertible. -/ +@[implicit_reducible] def invertibleOfMul' {α} [Semiring α] {a k b : ℕ} [Invertible (a : α)] (h : a = k * b) : Invertible (b : α) := invertibleOfMul k (b:α) ↑a (by simp [h]) diff --git a/Mathlib/Tactic/NormNum/Result.lean b/Mathlib/Tactic/NormNum/Result.lean index 7be9fc990a70db..cbc2bb45983c5e 100644 --- a/Mathlib/Tactic/NormNum/Result.lean +++ b/Mathlib/Tactic/NormNum/Result.lean @@ -41,9 +41,11 @@ variable {u : Level} /-- A shortcut (non)instance for `AddMonoidWithOne α` from `Semiring α` to shrink generated proofs. -/ +@[implicit_reducible] def instAddMonoidWithOne' {α : Type u} [Semiring α] : AddMonoidWithOne α := inferInstance /-- A shortcut (non)instance for `AddMonoidWithOne α` from `Ring α` to shrink generated proofs. -/ +@[implicit_reducible] def instAddMonoidWithOne {α : Type u} [Ring α] : AddMonoidWithOne α := inferInstance /-- A shortcut (non)instance for `Nat.AtLeastTwo (n + 2)` to shrink generated proofs. -/ diff --git a/Mathlib/Topology/Algebra/FilterBasis.lean b/Mathlib/Topology/Algebra/FilterBasis.lean index 8b3219f51e6ee5..2d7edd9dd228a5 100644 --- a/Mathlib/Topology/Algebra/FilterBasis.lean +++ b/Mathlib/Topology/Algebra/FilterBasis.lean @@ -253,6 +253,7 @@ theorem mul_right (x₀ : R) {U : Set R} (hU : U ∈ B) : ∃ V ∈ B, V ⊆ (fu /-- The topology associated to a ring filter basis. It has the given basis as a basis of neighborhoods of zero. -/ +@[implicit_reducible] def topology : TopologicalSpace R := B.toAddGroupFilterBasis.topology @@ -335,12 +336,14 @@ instance [DiscreteTopology R] : Inhabited (ModuleFilterBasis R M) := /-- The topology associated to a module filter basis on a module over a topological ring. It has the given basis as a basis of neighborhoods of zero. -/ +@[implicit_reducible] def topology : TopologicalSpace M := B.toAddGroupFilterBasis.topology /-- The topology associated to a module filter basis on a module over a topological ring. It has the given basis as a basis of neighborhoods of zero. This version gets the ring topology by unification instead of type class inference. -/ +@[implicit_reducible] def topology' {R M : Type*} [CommRing R] {_ : TopologicalSpace R} [AddCommGroup M] [Module R M] (B : ModuleFilterBasis R M) : TopologicalSpace M := B.toAddGroupFilterBasis.topology diff --git a/Mathlib/Topology/Algebra/IsUniformGroup/Defs.lean b/Mathlib/Topology/Algebra/IsUniformGroup/Defs.lean index ca442627b753f0..d7114e136086fc 100644 --- a/Mathlib/Topology/Algebra/IsUniformGroup/Defs.lean +++ b/Mathlib/Topology/Algebra/IsUniformGroup/Defs.lean @@ -589,7 +589,7 @@ Warning: in general the right and left uniformities do not coincide and so one d `IsUniformGroup` structure. Two important special cases where they _do_ coincide are for commutative groups (see `isUniformGroup_of_commGroup`) and for compact groups (see `IsUniformGroup.of_compactSpace`). -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- The right uniformity on a topological additive group (as opposed to the left uniformity). @@ -637,7 +637,7 @@ Warning: in general the right and left uniformities do not coincide and so one d `IsUniformGroup` structure. Two important special cases where they _do_ coincide are for commutative groups (see `isUniformGroup_of_commGroup`) and for compact groups (see `IsUniformGroup.of_compactSpace`). -/ -@[to_additive (attr := instance_reducible) +@[to_additive (attr := implicit_reducible) /-- The left uniformity on a topological additive group (as opposed to the right uniformity). diff --git a/Mathlib/Topology/Algebra/Nonarchimedean/AdicTopology.lean b/Mathlib/Topology/Algebra/Nonarchimedean/AdicTopology.lean index c61d5a4449a2d1..11567f37a26545 100644 --- a/Mathlib/Topology/Algebra/Nonarchimedean/AdicTopology.lean +++ b/Mathlib/Topology/Algebra/Nonarchimedean/AdicTopology.lean @@ -82,6 +82,7 @@ def ringFilterBasis (I : Ideal R) := /-- The adic topology associated to an ideal `I`. This topology admits powers of `I` as a basis of neighborhoods of zero. It is compatible with the ring structure and is non-archimedean. -/ +@[implicit_reducible] def adicTopology (I : Ideal R) : TopologicalSpace R := (adic_basis I).topology @@ -127,6 +128,7 @@ theorem adic_module_basis : /-- The topology on an `R`-module `M` associated to an ideal `M`. Submodules $I^n M$, written `I^n • ⊤` form a basis of neighborhoods of zero. -/ +@[implicit_reducible] def adicModuleTopology : TopologicalSpace M := @ModuleFilterBasis.topology R M _ I.adic_basis.topology _ _ (I.ringFilterBasis.moduleFilterBasis (I.adic_module_basis M)) @@ -247,6 +249,7 @@ instance (priority := 100) : IsUniformAddGroup R := /-- The adic topology on an `R` module coming from the ideal `WithIdeal.I`. This cannot be an instance because `R` cannot be inferred from `M`. -/ +@[implicit_reducible] def topologicalSpaceModule (M : Type*) [AddCommGroup M] [Module R M] : TopologicalSpace M := (i : Ideal R).adicModuleTopology M diff --git a/Mathlib/Topology/Algebra/Nonarchimedean/Bases.lean b/Mathlib/Topology/Algebra/Nonarchimedean/Bases.lean index abcbcd635baba3..52dd8f67bbd70d 100644 --- a/Mathlib/Topology/Algebra/Nonarchimedean/Bases.lean +++ b/Mathlib/Topology/Algebra/Nonarchimedean/Bases.lean @@ -64,6 +64,7 @@ theorem of_comm {A ι : Type*} [CommRing A] (B : ι → AddSubgroup A) rightMul := fun x i ↦ (leftMul x i).imp fun j hj ↦ by simpa only [mul_comm] using hj } /-- Every subgroups basis on a ring leads to a ring filter basis. -/ +@[implicit_reducible] def toRingFilterBasis [Nonempty ι] {B : ι → AddSubgroup A} (hB : RingSubgroupsBasis B) : RingFilterBasis A where sets := { U | ∃ i, U = B i } @@ -133,6 +134,7 @@ theorem mem_addGroupFilterBasis (i) : (B i : Set A) ∈ hB.toRingFilterBasis.toA /-- The topology defined from a subgroups basis, admitting the given subgroups as a basis of neighborhoods of zero. -/ +@[implicit_reducible] def topology : TopologicalSpace A := hB.toRingFilterBasis.toAddGroupFilterBasis.topology @@ -225,6 +227,7 @@ theorem toRing_subgroups_basis (hB : SubmodulesRingBasis B) : exact hj ⟨b, b_in, rfl⟩ /-- The topology associated to a basis of submodules in an algebra. -/ +@[implicit_reducible] def topology [Nonempty ι] (hB : SubmodulesRingBasis B) : TopologicalSpace A := hB.toRing_subgroups_basis.topology @@ -304,6 +307,7 @@ def toModuleFilterBasis : ModuleFilterBasis R M where exact hB.smul m₀ i /-- The topology associated to a basis of submodules in a module. -/ +@[implicit_reducible] def topology : TopologicalSpace M := hB.toModuleFilterBasis.toAddGroupFilterBasis.topology diff --git a/Mathlib/Topology/Algebra/UniformFilterBasis.lean b/Mathlib/Topology/Algebra/UniformFilterBasis.lean index 9e38c903a3ef21..510e248f6b8768 100644 --- a/Mathlib/Topology/Algebra/UniformFilterBasis.lean +++ b/Mathlib/Topology/Algebra/UniformFilterBasis.lean @@ -31,6 +31,7 @@ variable {G : Type*} [AddCommGroup G] (B : AddGroupFilterBasis G) /-- The uniform space structure associated to an abelian group filter basis via the associated topological abelian group structure. -/ +@[implicit_reducible] protected def uniformSpace : UniformSpace G := @IsTopologicalAddGroup.rightUniformSpace G _ B.topology B.isTopologicalAddGroup diff --git a/Mathlib/Topology/Algebra/Valued/ValuationTopology.lean b/Mathlib/Topology/Algebra/Valued/ValuationTopology.lean index 053937cd639265..f6e328f2410dba 100644 --- a/Mathlib/Topology/Algebra/Valued/ValuationTopology.lean +++ b/Mathlib/Topology/Algebra/Valued/ValuationTopology.lean @@ -118,6 +118,7 @@ namespace Valued set_option backward.isDefEq.respectTransparency false in /-- Alternative `Valued` constructor for use when there is no preferred `UniformSpace` structure. -/ +@[implicit_reducible] def mk' (v : Valuation R Γ₀) : Valued R Γ₀ := { v toUniformSpace := @IsTopologicalAddGroup.rightUniformSpace R _ v.subgroups_basis.topology _ diff --git a/Mathlib/Topology/Basic.lean b/Mathlib/Topology/Basic.lean index 09a54af2adddf7..0b5dec9eaf6d6f 100644 --- a/Mathlib/Topology/Basic.lean +++ b/Mathlib/Topology/Basic.lean @@ -39,6 +39,7 @@ universe u v /-- A constructor for topologies by specifying the closed sets, and showing that they satisfy the appropriate conditions. -/ +@[implicit_reducible] def TopologicalSpace.ofClosed {X : Type u} (T : Set (Set X)) (empty_mem : ∅ ∈ T) (sInter_mem : ∀ A, A ⊆ T → ⋂₀ A ∈ T) (union_mem : ∀ A, A ∈ T → ∀ B, B ∈ T → A ∪ B ∈ T) : TopologicalSpace X where diff --git a/Mathlib/Topology/Bornology/Basic.lean b/Mathlib/Topology/Bornology/Basic.lean index 4ed5f3942210d7..f55f092748bff1 100644 --- a/Mathlib/Topology/Bornology/Basic.lean +++ b/Mathlib/Topology/Bornology/Basic.lean @@ -67,7 +67,7 @@ lemma Bornology.ext (t t' : Bornology α) /-- A constructor for bornologies by specifying the bounded sets, and showing that they satisfy the appropriate conditions. -/ -@[simps] +@[simps, implicit_reducible] def Bornology.ofBounded {α : Type*} (B : Set (Set α)) (empty_mem : ∅ ∈ B) (subset_mem : ∀ s₁ ∈ B, ∀ s₂ ⊆ s₁, s₂ ∈ B) @@ -78,7 +78,7 @@ def Bornology.ofBounded {α : Type*} (B : Set (Set α)) /-- A constructor for bornologies by specifying the bounded sets, and showing that they satisfy the appropriate conditions. -/ -@[simps! cobounded] +@[simps! cobounded, implicit_reducible] def Bornology.ofBounded' {α : Type*} (B : Set (Set α)) (empty_mem : ∅ ∈ B) (subset_mem : ∀ s₁ ∈ B, ∀ s₂ ⊆ s₁, s₂ ∈ B) diff --git a/Mathlib/Topology/CWComplex/Classical/Basic.lean b/Mathlib/Topology/CWComplex/Classical/Basic.lean index 1c4166dd49f92a..728b8f1d294e1e 100644 --- a/Mathlib/Topology/CWComplex/Classical/Basic.lean +++ b/Mathlib/Topology/CWComplex/Classical/Basic.lean @@ -165,7 +165,7 @@ instance (priority := high) CWComplex.instRelCWComplex {X : Type*} [TopologicalS union' := by simpa only [empty_union] using CWComplex.union' /-- A relative CW complex with an empty base is an absolute CW complex. -/ -@[simps -isSimp] +@[simps -isSimp, implicit_reducible] def RelCWComplex.toCWComplex {X : Type*} [TopologicalSpace X] (C : Set X) [RelCWComplex C ∅] : CWComplex C where cell := cell C diff --git a/Mathlib/Topology/CWComplex/Classical/Finite.lean b/Mathlib/Topology/CWComplex/Classical/Finite.lean index 5308659be04503..f797b35576d9ee 100644 --- a/Mathlib/Topology/CWComplex/Classical/Finite.lean +++ b/Mathlib/Topology/CWComplex/Classical/Finite.lean @@ -68,7 +68,7 @@ end CWComplex /-- If we want to construct a relative CW complex of finite type, we can add the condition `finite_cell` and relax the condition `mapsTo`. -/ -@[simps -isSimp] +@[simps -isSimp, implicit_reducible] def RelCWComplex.mkFiniteType.{u} {X : Type u} [TopologicalSpace X] (C : Set X) (D : outParam (Set X)) (cell : (n : ℕ) → Type u) (map : (n : ℕ) → (i : cell n) → PartialEquiv (Fin n → ℝ) X) @@ -127,7 +127,7 @@ lemma RelCWComplex.finiteType_mkFiniteType.{u} {X : Type u} [TopologicalSpace X] /-- If we want to construct a CW complex of finite type, we can add the condition `finite_cell` and relax the condition `mapsTo`. -/ -@[simps -isSimp] +@[simps -isSimp, implicit_reducible] def CWComplex.mkFiniteType.{u} {X : Type u} [TopologicalSpace X] (C : Set X) (cell : (n : ℕ) → Type u) (map : (n : ℕ) → (i : cell n) → PartialEquiv (Fin n → ℝ) X) (finite_cell : ∀ (n : ℕ), _root_.Finite (cell n)) @@ -179,7 +179,7 @@ lemma CWComplex.finiteType_mkFiniteType.{u} {X : Type u} [TopologicalSpace X] (C /-- If we want to construct a finite relative CW complex we can add the conditions `eventually_isEmpty_cell` and `finite_cell`, relax the condition `mapsTo` and remove the condition `closed'`. -/ -@[simps -isSimp] +@[simps -isSimp, implicit_reducible] def RelCWComplex.mkFinite.{u} {X : Type u} [TopologicalSpace X] (C : Set X) (D : outParam (Set X)) (cell : (n : ℕ) → Type u) (map : (n : ℕ) → (i : cell n) → PartialEquiv (Fin n → ℝ) X) @@ -255,7 +255,7 @@ lemma RelCWComplex.finite_mkFinite.{u} {X : Type u} [TopologicalSpace X] (C : Se set_option backward.isDefEq.respectTransparency false in /-- If we want to construct a finite CW complex we can add the conditions `eventually_isEmpty_cell` and `finite_cell`, relax the condition `mapsTo` and remove the condition `closed'`. -/ -@[simps! -isSimp] +@[simps! -isSimp, implicit_reducible] def CWComplex.mkFinite.{u} {X : Type u} [TopologicalSpace X] (C : Set X) (cell : (n : ℕ) → Type u) (map : (n : ℕ) → (i : cell n) → PartialEquiv (Fin n → ℝ) X) (eventually_isEmpty_cell : ∀ᶠ n in Filter.atTop, IsEmpty (cell n)) diff --git a/Mathlib/Topology/Category/CompHausLike/Cartesian.lean b/Mathlib/Topology/Category/CompHausLike/Cartesian.lean index a82993de8bccbf..6fedbf0612828b 100644 --- a/Mathlib/Topology/Category/CompHausLike/Cartesian.lean +++ b/Mathlib/Topology/Category/CompHausLike/Cartesian.lean @@ -59,6 +59,7 @@ This could be an instance but that causes some slowness issues with typeclass se keep it as a def and turn it on as an instance for the explicit examples of `CompHausLike` as needed. -/ +@[implicit_reducible] def cartesianMonoidalCategory [∀ (X Y : CompHausLike.{u} P), HasProp P (X × Y)] [HasProp P PUnit.{u + 1}] : CartesianMonoidalCategory (CompHausLike.{u} P) := .ofChosenFiniteProducts diff --git a/Mathlib/Topology/Compactness/Compact.lean b/Mathlib/Topology/Compactness/Compact.lean index dcb515949b0d44..2f93f763bfdf43 100644 --- a/Mathlib/Topology/Compactness/Compact.lean +++ b/Mathlib/Topology/Compactness/Compact.lean @@ -654,6 +654,7 @@ variable (X) in /-- Sets that are contained in a compact set form a bornology. Its `cobounded` filter is `Filter.cocompact`. See also `Bornology.relativelyCompact` the bornology of sets with compact closure. -/ +@[implicit_reducible] def inCompact : Bornology X where cobounded := Filter.cocompact X le_cofinite := Filter.cocompact_le_cofinite diff --git a/Mathlib/Topology/Compactness/CompactlyGeneratedSpace.lean b/Mathlib/Topology/Compactness/CompactlyGeneratedSpace.lean index 7f2cec7b0eba9d..e6ed7e3c69780b 100644 --- a/Mathlib/Topology/Compactness/CompactlyGeneratedSpace.lean +++ b/Mathlib/Topology/Compactness/CompactlyGeneratedSpace.lean @@ -61,6 +61,7 @@ topology, continuous. Note: this definition should be used with an explicit universe parameter `u` for the size of the compact Hausdorff spaces mapping to `X`. -/ +@[implicit_reducible] def TopologicalSpace.compactlyGenerated (X : Type w) [TopologicalSpace X] : TopologicalSpace X := let f : (Σ (i : (S : CompHaus.{u}) × C(S, X)), i.fst) → X := fun ⟨⟨_, i⟩, s⟩ ↦ i s coinduced f inferInstance diff --git a/Mathlib/Topology/Compactness/DeltaGeneratedSpace.lean b/Mathlib/Topology/Compactness/DeltaGeneratedSpace.lean index ca9223018b6b44..cc8c32a4972fe7 100644 --- a/Mathlib/Topology/Compactness/DeltaGeneratedSpace.lean +++ b/Mathlib/Topology/Compactness/DeltaGeneratedSpace.lean @@ -33,6 +33,7 @@ variable {X Y : Type*} [tX : TopologicalSpace X] [tY : TopologicalSpace Y] open TopologicalSpace Topology /-- The topology coinduced by all maps from ℝⁿ into a space. -/ +@[implicit_reducible] def TopologicalSpace.deltaGenerated (X : Type*) [TopologicalSpace X] : TopologicalSpace X := ⨆ f : (n : ℕ) × C(((Fin n) → ℝ), X), coinduced f.2 inferInstance diff --git a/Mathlib/Topology/Compactness/LocallyFinite.lean b/Mathlib/Topology/Compactness/LocallyFinite.lean index 3c7314c71fb460..a16b41cba607f6 100644 --- a/Mathlib/Topology/Compactness/LocallyFinite.lean +++ b/Mathlib/Topology/Compactness/LocallyFinite.lean @@ -45,6 +45,7 @@ theorem finite_of_compact [CompactSpace X] {f : ι → Set X} /-- If `X` is a compact space, then a locally finite family of nonempty sets of `X` can have only finitely many elements, `Fintype` version. -/ +@[implicit_reducible] noncomputable def fintypeOfCompact [CompactSpace X] {f : ι → Set X} (hf : LocallyFinite f) (hne : ∀ i, (f i).Nonempty) : Fintype ι := fintypeOfFiniteUniv (hf.finite_of_compact hne) diff --git a/Mathlib/Topology/Compactness/SigmaCompact.lean b/Mathlib/Topology/Compactness/SigmaCompact.lean index 0f59c8f17f2b75..6fb535229de368 100644 --- a/Mathlib/Topology/Compactness/SigmaCompact.lean +++ b/Mathlib/Topology/Compactness/SigmaCompact.lean @@ -280,6 +280,7 @@ protected theorem LocallyFinite.countable_univ {f : ι → Set X} (hf : LocallyF /-- If `f : ι → Set X` is a locally finite covering of a σ-compact topological space by nonempty sets, then the index type `ι` is encodable. -/ +@[implicit_reducible] protected noncomputable def LocallyFinite.encodable {ι : Type*} {f : ι → Set X} (hf : LocallyFinite f) (hne : ∀ i, (f i).Nonempty) : Encodable ι := @Encodable.ofEquiv _ _ (hf.countable_univ hne).toEncodable (Equiv.Set.univ _).symm diff --git a/Mathlib/Topology/Connected/Clopen.lean b/Mathlib/Topology/Connected/Clopen.lean index abab2184d2dc5f..f485d890d37de5 100644 --- a/Mathlib/Topology/Connected/Clopen.lean +++ b/Mathlib/Topology/Connected/Clopen.lean @@ -471,6 +471,7 @@ end Preconnected section connectedComponentSetoid /-- The setoid of connected components of a topological space -/ +@[implicit_reducible] def connectedComponentSetoid (α : Type*) [TopologicalSpace α] : Setoid α := ⟨fun x y => connectedComponent x = connectedComponent y, ⟨fun x => by trivial, fun h1 => h1.symm, fun h1 h2 => h1.trans h2⟩⟩ diff --git a/Mathlib/Topology/Connected/PathConnected.lean b/Mathlib/Topology/Connected/PathConnected.lean index 0369fc7575a734..88a27eeb8fd59e 100644 --- a/Mathlib/Topology/Connected/PathConnected.lean +++ b/Mathlib/Topology/Connected/PathConnected.lean @@ -99,6 +99,7 @@ theorem Joined.inv {G : Type*} [Inv G] [TopologicalSpace G] [ContinuousInv G] variable (X) /-- The setoid corresponding the equivalence relation of being joined by a continuous path. -/ +@[implicit_reducible] def pathSetoid : Setoid X where r := Joined iseqv := Equivalence.mk Joined.refl Joined.symm Joined.trans diff --git a/Mathlib/Topology/Convenient/GeneratedBy.lean b/Mathlib/Topology/Convenient/GeneratedBy.lean index 7cd64db3da7d22..08525adc9468c2 100644 --- a/Mathlib/Topology/Convenient/GeneratedBy.lean +++ b/Mathlib/Topology/Convenient/GeneratedBy.lean @@ -47,6 +47,7 @@ namespace TopologicalSpace /-- Given a family of topological spaces `X i`, the `X`-generated topology on a topological space `Y` is the topology that is coinduced by all continuous maps `X i → Y`. -/ +@[implicit_reducible] def generatedBy : TopologicalSpace Y := ⨆ (i : ι) (f : C(X i, Y)), coinduced f inferInstance diff --git a/Mathlib/Topology/Defs/Filter.lean b/Mathlib/Topology/Defs/Filter.lean index 5fa8726ee35c88..0be587a14e8a85 100644 --- a/Mathlib/Topology/Defs/Filter.lean +++ b/Mathlib/Topology/Defs/Filter.lean @@ -231,6 +231,7 @@ def specializationPreorder : Preorder X := lt := fun x y => y ⤳ x ∧ ¬x ⤳ y } /-- A `setoid` version of `Inseparable`, used to define the `SeparationQuotient`. -/ +@[implicit_reducible] def inseparableSetoid : Setoid X := { Setoid.comap 𝓝 ⊥ with r := Inseparable } /-- The quotient of a topological space by its `inseparableSetoid`. Also called the Kolmogorov diff --git a/Mathlib/Topology/Defs/Induced.lean b/Mathlib/Topology/Defs/Induced.lean index f00e888cec7beb..b400542862de3e 100644 --- a/Mathlib/Topology/Defs/Induced.lean +++ b/Mathlib/Topology/Defs/Induced.lean @@ -57,6 +57,7 @@ variable {X Y : Type*} the induced topology on `X` is the collection of sets that are preimages of some open set in `Y`. This is the coarsest topology that makes `f` continuous. -/ +@[implicit_reducible] def induced (f : X → Y) (t : TopologicalSpace Y) : TopologicalSpace X where IsOpen s := ∃ t, IsOpen t ∧ f ⁻¹' t = s isOpen_univ := ⟨univ, isOpen_univ, preimage_univ⟩ @@ -77,6 +78,7 @@ instance _root_.instTopologicalSpaceSubtype {p : X → Prop} [t : TopologicalSpa the coinduced topology on `Y` is defined such that `s : Set Y` is open if the preimage of `s` is open. This is the finest topology that makes `f` continuous. -/ +@[implicit_reducible] def coinduced (f : X → Y) (t : TopologicalSpace X) : TopologicalSpace Y where IsOpen s := IsOpen (f ⁻¹' s) isOpen_univ := t.isOpen_univ diff --git a/Mathlib/Topology/EMetricSpace/Defs.lean b/Mathlib/Topology/EMetricSpace/Defs.lean index ca392276514a81..6d29e6e9c86ccb 100644 --- a/Mathlib/Topology/EMetricSpace/Defs.lean +++ b/Mathlib/Topology/EMetricSpace/Defs.lean @@ -447,6 +447,7 @@ theorem ordConnected_setOf_eball_subset (x : α) (s : Set α) : OrdConnected { r ⟨fun _ _ _ h₁ _ h₂ => (eball_subset_eball h₂.2).trans h₁⟩ /-- Relation “two points are at a finite edistance” is an equivalence relation. -/ +@[implicit_reducible] def edistLtTopSetoid : Setoid α where r x y := edist x y < ⊤ iseqv := diff --git a/Mathlib/Topology/FiberBundle/Basic.lean b/Mathlib/Topology/FiberBundle/Basic.lean index 712038d8442161..36280dd684f967 100644 --- a/Mathlib/Topology/FiberBundle/Basic.lean +++ b/Mathlib/Topology/FiberBundle/Basic.lean @@ -731,6 +731,7 @@ variable {F E} variable (a : FiberPrebundle F E) {e : Pretrivialization F (π F E)} /-- Topology on the total space that will make the prebundle into a bundle. -/ +@[implicit_reducible] def totalSpaceTopology (a : FiberPrebundle F E) : TopologicalSpace (TotalSpace F E) := ⨆ (e : Pretrivialization F (π F E)) (_ : e ∈ a.pretrivializationAtlas), coinduced e.setSymm instTopologicalSpaceSubtype @@ -812,6 +813,7 @@ number of "pretrivializations" identifying parts of `E` with product spaces `U establishes that for the topology constructed on the sigma-type using `FiberPrebundle.totalSpaceTopology`, these "pretrivializations" are actually "trivializations" (i.e., homeomorphisms with respect to the constructed topology). -/ +@[implicit_reducible] def toFiberBundle : @FiberBundle B F _ _ E a.totalSpaceTopology _ := let _ := a.totalSpaceTopology { totalSpaceMk_isInducing' := fun b ↦ a.inducing_totalSpaceMk_of_inducing_comp b diff --git a/Mathlib/Topology/Homotopy/HSpaces.lean b/Mathlib/Topology/Homotopy/HSpaces.lean index b90168462645fa..73ab1e2285b428 100644 --- a/Mathlib/Topology/Homotopy/HSpaces.lean +++ b/Mathlib/Topology/Homotopy/HSpaces.lean @@ -113,7 +113,7 @@ namespace IsTopologicalGroup lead to a diamond since a topological field would inherit two `HSpace` structures, one from the `MulOneClass` and one from the `AddZeroClass`. In the case of a group, we make `IsTopologicalGroup.hSpace` an instance." -/ -@[to_additive +@[to_additive (attr := implicit_reducible) /-- The definition `toHSpace` is not an instance because it comes together with a multiplicative version which would lead to a diamond since a topological field would inherit two `HSpace` structures, one from the `MulOneClass` and one from the `AddZeroClass`. diff --git a/Mathlib/Topology/Instances/ENNReal/Lemmas.lean b/Mathlib/Topology/Instances/ENNReal/Lemmas.lean index 2c4693e24476df..b5ed9d60ae0824 100644 --- a/Mathlib/Topology/Instances/ENNReal/Lemmas.lean +++ b/Mathlib/Topology/Instances/ENNReal/Lemmas.lean @@ -568,6 +568,7 @@ theorem edist_ne_top_of_mem_ball {a : β} {r : ℝ≥0∞} (x y : eball a r) : e /-- Each ball in an extended metric space gives us a metric space, as the edist is everywhere finite. -/ +@[implicit_reducible] def metricSpaceEMetricBall (a : β) (r : ℝ≥0∞) : MetricSpace (eball a r) := EMetricSpace.toMetricSpace edist_ne_top_of_mem_ball diff --git a/Mathlib/Topology/MetricSpace/Defs.lean b/Mathlib/Topology/MetricSpace/Defs.lean index feaae358cea47e..328ea2694b99a7 100644 --- a/Mathlib/Topology/MetricSpace/Defs.lean +++ b/Mathlib/Topology/MetricSpace/Defs.lean @@ -66,6 +66,7 @@ theorem MetricSpace.ext {α : Type*} {m m' : MetricSpace α} (h : m.toDist = m'. /-- Construct a metric space structure whose underlying topological space structure (definitionally) agrees which a pre-existing topology which is compatible with a given distance function. -/ +@[implicit_reducible] def MetricSpace.ofDistTopology {α : Type u} [TopologicalSpace α] (dist : α → α → ℝ) (dist_self : ∀ x : α, dist x x = 0) (dist_comm : ∀ x y : α, dist x y = dist y x) (dist_triangle : ∀ x y z : α, dist x z ≤ dist x y + dist y z) diff --git a/Mathlib/Topology/MetricSpace/Gluing.lean b/Mathlib/Topology/MetricSpace/Gluing.lean index 23a3e239960fa7..6de6ed21da7120 100644 --- a/Mathlib/Topology/MetricSpace/Gluing.lean +++ b/Mathlib/Topology/MetricSpace/Gluing.lean @@ -183,6 +183,7 @@ set_option backward.privateInPublic.warn false in `Φ p` and `Φ q`, and between `Ψ p` and `Ψ q`, coincide up to `2 ε` where `ε > 0`, one can almost glue the two spaces `X` and `Y` along the images of `Φ` and `Ψ`, so that `Φ p` and `Ψ p` are at distance `ε`. -/ +@[implicit_reducible] def glueMetricApprox [Nonempty Z] (Φ : Z → X) (Ψ : Z → Y) (ε : ℝ) (ε0 : 0 < ε) (H : ∀ p q, |dist (Φ p) (Φ q) - dist (Ψ p) (Ψ q)| ≤ 2 * ε) : MetricSpace (X ⊕ Y) where dist := glueDist Φ Ψ ε @@ -468,6 +469,7 @@ set_option backward.privateInPublic true in set_option backward.privateInPublic.warn false in /-- Given two isometric embeddings `Φ : Z → X` and `Ψ : Z → Y`, we define a pseudometric space structure on `X ⊕ Y` by declaring that `Φ x` and `Ψ x` are at distance `0`. -/ +@[implicit_reducible] def gluePremetric (hΦ : Isometry Φ) (hΨ : Isometry Ψ) : PseudoMetricSpace (X ⊕ Y) where dist := glueDist Φ Ψ 0 dist_self := glueDist_self Φ Ψ 0 diff --git a/Mathlib/Topology/MetricSpace/PiNat.lean b/Mathlib/Topology/MetricSpace/PiNat.lean index 461c34b7e3c103..b97f49e5df1acd 100644 --- a/Mathlib/Topology/MetricSpace/PiNat.lean +++ b/Mathlib/Topology/MetricSpace/PiNat.lean @@ -405,6 +405,7 @@ protected def metricSpace : MetricSpace (∀ n, E n) := /-- Metric space structure on `Π (n : ℕ), E n` when the spaces `E n` have the discrete uniformity, where the distance is given by `dist x y = (1/2)^n`, where `n` is the smallest index where `x` and `y` differ. Not registered as a global instance by default. -/ +@[implicit_reducible] protected def metricSpaceOfDiscreteUniformity {E : ℕ → Type*} [∀ n, UniformSpace (E n)] (h : ∀ n, uniformity (E n) = 𝓟 SetRel.id) : MetricSpace (∀ n, E n) := haveI : ∀ n, DiscreteTopology (E n) := fun n => discreteTopology_of_discrete_uniformity (h n) @@ -440,6 +441,7 @@ protected def metricSpaceOfDiscreteUniformity {E : ℕ → Type*} [∀ n, Unifor /-- Metric space structure on `ℕ → ℕ` where the distance is given by `dist x y = (1/2)^n`, where `n` is the smallest index where `x` and `y` differ. Not registered as a global instance by default. -/ +@[implicit_reducible] def metricSpaceNatNat : MetricSpace (ℕ → ℕ) := PiNat.metricSpaceOfDiscreteUniformity fun _ => rfl @@ -963,6 +965,7 @@ variable [∀ i, MetricSpace (F i)] It is highly non-canonical, though, and therefore not registered as a global instance. The distance we use here is `edist x y = ∑' i, min (1/2)^(encode i) (edist (x i) (y i))`. -/ +@[implicit_reducible] protected def metricSpace : MetricSpace (∀ i, F i) := EMetricSpace.toMetricSpaceOfDist dist (by simp) (by simp [edist_dist]) diff --git a/Mathlib/Topology/MetricSpace/Pseudo/Constructions.lean b/Mathlib/Topology/MetricSpace/Pseudo/Constructions.lean index d786fb13091bd6..d6dabd1bf1f661 100644 --- a/Mathlib/Topology/MetricSpace/Pseudo/Constructions.lean +++ b/Mathlib/Topology/MetricSpace/Pseudo/Constructions.lean @@ -40,6 +40,7 @@ abbrev PseudoMetricSpace.induced {α β} (f : α → β) (m : PseudoMetricSpace /-- Pull back a pseudometric space structure by an inducing map. This is a version of `PseudoMetricSpace.induced` useful in case if the domain already has a `TopologicalSpace` structure. -/ +@[implicit_reducible] def Topology.IsInducing.comapPseudoMetricSpace {α β : Type*} [TopologicalSpace α] [m : PseudoMetricSpace β] {f : α → β} (hf : IsInducing f) : PseudoMetricSpace α := .replaceTopology (.induced f m) hf.eq_induced @@ -47,6 +48,7 @@ def Topology.IsInducing.comapPseudoMetricSpace {α β : Type*} [TopologicalSpace /-- Pull back a pseudometric space structure by a uniform inducing map. This is a version of `PseudoMetricSpace.induced` useful in case if the domain already has a `UniformSpace` structure. -/ +@[implicit_reducible] def IsUniformInducing.comapPseudoMetricSpace {α β} [UniformSpace α] [m : PseudoMetricSpace β] (f : α → β) (h : IsUniformInducing f) : PseudoMetricSpace α := .replaceUniformity (.induced f m) h.comap_uniformity.symm diff --git a/Mathlib/Topology/MetricSpace/Pseudo/Defs.lean b/Mathlib/Topology/MetricSpace/Pseudo/Defs.lean index d37c20e8d9a339..f8120f50379bda 100644 --- a/Mathlib/Topology/MetricSpace/Pseudo/Defs.lean +++ b/Mathlib/Topology/MetricSpace/Pseudo/Defs.lean @@ -57,6 +57,7 @@ theorem UniformSpace.ofDist_aux (ε : ℝ) (hε : 0 < ε) : ∃ δ > (0 : ℝ), ⟨ε / 2, half_pos hε, fun _x hx _y hy => add_halves ε ▸ add_lt_add hx hy⟩ /-- Construct a uniform structure from a distance function and metric space axioms -/ +@[implicit_reducible] def UniformSpace.ofDist (dist : α → α → ℝ) (dist_self : ∀ x : α, dist x x = 0) (dist_comm : ∀ x y : α, dist x y = dist y x) (dist_triangle : ∀ x y z : α, dist x z ≤ dist x y + dist y z) : UniformSpace α := @@ -164,6 +165,7 @@ instance (priority := 200) PseudoMetricSpace.toEDist : EDist α := /-- Construct a pseudo-metric space structure whose underlying topological space structure (definitionally) agrees which a pre-existing topology which is compatible with a given distance function. -/ +@[implicit_reducible] def PseudoMetricSpace.ofDistTopology {α : Type u} [TopologicalSpace α] (dist : α → α → ℝ) (dist_self : ∀ x : α, dist x x = 0) (dist_comm : ∀ x y : α, dist x y = dist y x) (dist_triangle : ∀ x y z : α, dist x z ≤ dist x y + dist y z) diff --git a/Mathlib/Topology/Metrizable/CompletelyMetrizable.lean b/Mathlib/Topology/Metrizable/CompletelyMetrizable.lean index 77a7f6fb8e277c..d416c3a18d3788 100644 --- a/Mathlib/Topology/Metrizable/CompletelyMetrizable.lean +++ b/Mathlib/Topology/Metrizable/CompletelyMetrizable.lean @@ -74,6 +74,7 @@ instance (priority := 100) IsCompletelyPseudoMetrizableSpace.of_completeSpace_ps /-- Construct on a completely pseudometrizable space a pseudometric (compatible with the topology) which is complete. -/ +@[implicit_reducible] noncomputable def completelyPseudoMetrizableMetric (X : Type*) [TopologicalSpace X] [h : IsCompletelyPseudoMetrizableSpace X] : PseudoMetricSpace X := h.complete.choose.replaceTopology h.complete.choose_spec.1.symm @@ -86,6 +87,7 @@ theorem complete_completelyPseudoMetrizableMetric (X : Type*) [ht : TopologicalS /-- This definition endows a completely pseudometrizable space with a complete pseudometric. Use it as: `letI := upgradeIsCompletelyPseudoMetrizable X`. -/ +@[implicit_reducible] noncomputable def upgradeIsCompletelyPseudoMetrizable (X : Type*) [TopologicalSpace X] [IsCompletelyPseudoMetrizableSpace X] : @@ -191,6 +193,7 @@ instance (priority := 100) IsCompletelyMetrizableSpace.of_completeSpace_metrizab /-- Construct on a completely metrizable space a metric (compatible with the topology) which is complete. -/ +@[implicit_reducible] noncomputable def completelyMetrizableMetric (X : Type*) [TopologicalSpace X] [h : IsCompletelyMetrizableSpace X] : MetricSpace X := h.complete.choose.replaceTopology h.complete.choose_spec.1.symm @@ -203,6 +206,7 @@ theorem complete_completelyMetrizableMetric (X : Type*) [ht : TopologicalSpace X /-- This definition endows a completely metrizable space with a complete metric. Use it as: `letI := upgradeIsCompletelyMetrizable X`. -/ +@[implicit_reducible] noncomputable def upgradeIsCompletelyMetrizable (X : Type*) [TopologicalSpace X] [IsCompletelyMetrizableSpace X] : UpgradedIsCompletelyMetrizableSpace X := diff --git a/Mathlib/Topology/Metrizable/Uniformity.lean b/Mathlib/Topology/Metrizable/Uniformity.lean index a97bd1bc1d73eb..567970db6e5053 100644 --- a/Mathlib/Topology/Metrizable/Uniformity.lean +++ b/Mathlib/Topology/Metrizable/Uniformity.lean @@ -58,6 +58,7 @@ namespace PseudoMetricSpace /-- The maximal pseudometric space structure on `X` such that `dist x y ≤ d x y` for all `x y`, where `d : X → X → ℝ≥0` is a function such that `d x x = 0` and `d x y = d y x` for all `x`, `y`. -/ +@[implicit_reducible] noncomputable def ofPreNNDist (d : X → X → ℝ≥0) (dist_self : ∀ x, d x x = 0) (dist_comm : ∀ x y, d x y = d y x) : PseudoMetricSpace X where dist x y := ↑(⨅ l : List X, ((x::l).zipWith d (l ++ [y])).sum : ℝ≥0) diff --git a/Mathlib/Topology/Order.lean b/Mathlib/Topology/Order.lean index 69e6ad870b9054..a69f45efb325cd 100644 --- a/Mathlib/Topology/Order.lean +++ b/Mathlib/Topology/Order.lean @@ -64,6 +64,7 @@ inductive GenerateOpen (g : Set (Set α)) : Set α → Prop | sUnion : ∀ S : Set (Set α), (∀ s ∈ S, GenerateOpen g s) → GenerateOpen g (⋃₀ S) /-- The smallest topological space containing the collection `g` of basic sets -/ +@[implicit_reducible] def generateFrom (g : Set (Set α)) : TopologicalSpace α where IsOpen := GenerateOpen g isOpen_univ := GenerateOpen.univ @@ -94,6 +95,7 @@ lemma tendsto_nhds_generateFrom_iff {β : Type*} {m : α → β} {f : Filter α} tendsto_principal]; rfl /-- Construct a topology on α given the filter of neighborhoods of each point of α. -/ +@[implicit_reducible] protected def mkOfNhds (n : α → Filter α) : TopologicalSpace α where IsOpen s := ∀ a ∈ s, s ∈ n a isOpen_univ _ _ := univ_mem @@ -155,6 +157,7 @@ theorem le_generateFrom_iff_subset_isOpen {g : Set (Set α)} {t : TopologicalSpa /-- If `s` equals the collection of open sets in the topology it generates, then `s` defines a topology. -/ +@[implicit_reducible] protected def mkOfClosure (s : Set (Set α)) (hs : { u | GenerateOpen s u } = s) : TopologicalSpace α where IsOpen u := u ∈ s @@ -616,6 +619,7 @@ lemma generateFrom_insert_empty {α : Type*} {s : Set (Set α)} : /-- This construction is left adjoint to the operation sending a topology on `α` to its neighborhood filter at a fixed point `a : α`. -/ +@[implicit_reducible] def nhdsAdjoint (a : α) (f : Filter α) : TopologicalSpace α where IsOpen s := a ∈ s → s ∈ f isOpen_univ _ := univ_mem diff --git a/Mathlib/Topology/Order/Basic.lean b/Mathlib/Topology/Order/Basic.lean index cbc369642af385..1e6919c6cb2257 100644 --- a/Mathlib/Topology/Order/Basic.lean +++ b/Mathlib/Topology/Order/Basic.lean @@ -73,6 +73,7 @@ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞, b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an +@[implicit_reducible] instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := diff --git a/Mathlib/Topology/Order/Bornology.lean b/Mathlib/Topology/Order/Bornology.lean index 74787641272e87..e0954ccfadaa42 100644 --- a/Mathlib/Topology/Order/Bornology.lean +++ b/Mathlib/Topology/Order/Bornology.lean @@ -30,6 +30,7 @@ variable [Lattice α] [Nonempty α] /-- Order-bornology on a nonempty lattice. The bounded sets are the sets that are bounded both above and below. -/ +@[implicit_reducible] def orderBornology : Bornology α := .ofBounded {s | BddBelow s ∧ BddAbove s} (by simp) diff --git a/Mathlib/Topology/Order/LawsonTopology.lean b/Mathlib/Topology/Order/LawsonTopology.lean index a71d5175031c82..dba8bf4c6dcf00 100644 --- a/Mathlib/Topology/Order/LawsonTopology.lean +++ b/Mathlib/Topology/Order/LawsonTopology.lean @@ -64,6 +64,7 @@ section Preorder /-- The Lawson topology is defined as the meet of `Topology.lower` and the `Topology.scott`. -/ +@[implicit_reducible] def lawson (α : Type*) [Preorder α] : TopologicalSpace α := lower α ⊓ scott α univ variable (α) [Preorder α] [TopologicalSpace α] diff --git a/Mathlib/Topology/Order/LowerUpperTopology.lean b/Mathlib/Topology/Order/LowerUpperTopology.lean index a8e34e2d83c6a8..9c46484ec1637e 100644 --- a/Mathlib/Topology/Order/LowerUpperTopology.lean +++ b/Mathlib/Topology/Order/LowerUpperTopology.lean @@ -61,12 +61,14 @@ namespace Topology The lower topology is the topology generated by the complements of the left-closed right-infinite intervals. -/ +@[implicit_reducible] def lower (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom {s | ∃ a, (Ici a)ᶜ = s} /-- The upper topology is the topology generated by the complements of the right-closed left-infinite intervals. -/ +@[implicit_reducible] def upper (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom {s | ∃ a, (Iic a)ᶜ = s} /-- Type synonym for a preorder equipped with the lower set topology. -/ diff --git a/Mathlib/Topology/Order/ScottTopology.lean b/Mathlib/Topology/Order/ScottTopology.lean index abed370fc91ac5..4e54b7c4735a9b 100644 --- a/Mathlib/Topology/Order/ScottTopology.lean +++ b/Mathlib/Topology/Order/ScottTopology.lean @@ -148,6 +148,7 @@ section ScottHausdorff A set `u` is open in the Scott-Hausdorff topology iff when the least upper bound of a directed set `d` lies in `u` then there is a tail of `d` which is a subset of `u`. -/ +@[implicit_reducible] def scottHausdorff (α : Type*) (D : Set (Set α)) [Preorder α] : TopologicalSpace α where IsOpen u := ∀ ⦃d : Set α⦄, d ∈ D → d.Nonempty → DirectedOn (· ≤ ·) d → ∀ ⦃a : α⦄, IsLUB d a → a ∈ u → ∃ b ∈ d, Ici b ∩ d ⊆ u @@ -220,6 +221,7 @@ section Preorder /-- The Scott topology. It is defined as the join of the topology of upper sets and the Scott-Hausdorff topology. -/ +@[implicit_reducible] def scott (α : Type*) (D : Set (Set α)) [Preorder α] : TopologicalSpace α := upperSet α ⊔ scottHausdorff α D diff --git a/Mathlib/Topology/Order/UpperLowerSetTopology.lean b/Mathlib/Topology/Order/UpperLowerSetTopology.lean index dece0bbecc2099..27e0c40c20d4bc 100644 --- a/Mathlib/Topology/Order/UpperLowerSetTopology.lean +++ b/Mathlib/Topology/Order/UpperLowerSetTopology.lean @@ -59,6 +59,7 @@ namespace Topology /-- Topology whose open sets are upper sets. Note: In general the upper set topology does not coincide with the upper topology. -/ +@[implicit_reducible] def upperSet (α : Type*) [Preorder α] : TopologicalSpace α where IsOpen := IsUpperSet isOpen_univ := isUpperSet_univ @@ -68,6 +69,7 @@ def upperSet (α : Type*) [Preorder α] : TopologicalSpace α where /-- Topology whose open sets are lower sets. Note: In general the lower set topology does not coincide with the lower topology. -/ +@[implicit_reducible] def lowerSet (α : Type*) [Preorder α] : TopologicalSpace α where IsOpen := IsLowerSet isOpen_univ := isLowerSet_univ diff --git a/Mathlib/Topology/Separation/Basic.lean b/Mathlib/Topology/Separation/Basic.lean index 10233b13a8ede9..2a0fc265433955 100644 --- a/Mathlib/Topology/Separation/Basic.lean +++ b/Mathlib/Topology/Separation/Basic.lean @@ -314,6 +314,7 @@ variable (X) in /-- In an R₀ space, relatively compact sets form a bornology. Its cobounded filter is `Filter.coclosedCompact`. See also `Bornology.inCompact` the bornology of sets contained in a compact set. -/ +@[implicit_reducible] def Bornology.relativelyCompact : Bornology X where cobounded := Filter.coclosedCompact X le_cofinite := Filter.coclosedCompact_le_cofinite diff --git a/Mathlib/Topology/Separation/Hausdorff.lean b/Mathlib/Topology/Separation/Hausdorff.lean index 1b733527ef0839..af0ce925eeda8d 100644 --- a/Mathlib/Topology/Separation/Hausdorff.lean +++ b/Mathlib/Topology/Separation/Hausdorff.lean @@ -404,6 +404,7 @@ section variable (X) /-- The smallest equivalence relation on a topological space giving a T2 quotient. -/ +@[implicit_reducible] def t2Setoid : Setoid X := sInf {s | T2Space (Quotient s)} /-- The largest T2 quotient of a topological space. This construction is left-adjoint to the diff --git a/Mathlib/Topology/Sets/Closeds.lean b/Mathlib/Topology/Sets/Closeds.lean index e48e883ef5beae..eae91006490039 100644 --- a/Mathlib/Topology/Sets/Closeds.lean +++ b/Mathlib/Topology/Sets/Closeds.lean @@ -184,6 +184,7 @@ theorem iInf_mk {ι} (s : ι → Set α) (h : ∀ i, IsClosed (s i)) : iInf_def _ /-- Closed sets in a topological space form a coframe. -/ +@[implicit_reducible] def coframeMinimalAxioms : Coframe.MinimalAxioms (Closeds α) where iInf_sup_le_sup_sInf a s := (SetLike.coe_injective <| by simp only [coe_sup, coe_iInf, coe_sInf, Set.union_iInter₂]).le diff --git a/Mathlib/Topology/Spectral/ConstructibleTopology.lean b/Mathlib/Topology/Spectral/ConstructibleTopology.lean index 88fb17b7bc4a0e..73057a2d08c2ef 100644 --- a/Mathlib/Topology/Spectral/ConstructibleTopology.lean +++ b/Mathlib/Topology/Spectral/ConstructibleTopology.lean @@ -37,6 +37,7 @@ def constructibleTopologySubbasis (X : Type*) [TopologicalSpace X] : Set (Set X) /-- The constructible topology on a topological space `X` has as a subbasis the open and compact sets of `X` and their complements. -/ +@[implicit_reducible] def constructibleTopology (X : Type*) [TopologicalSpace X] : TopologicalSpace X := .generateFrom (constructibleTopologySubbasis X) diff --git a/Mathlib/Topology/UniformSpace/AbsoluteValue.lean b/Mathlib/Topology/UniformSpace/AbsoluteValue.lean index a8706860addad0..ab8d8149b1dc0e 100644 --- a/Mathlib/Topology/UniformSpace/AbsoluteValue.lean +++ b/Mathlib/Topology/UniformSpace/AbsoluteValue.lean @@ -36,6 +36,7 @@ variable {𝕜 : Type*} [Field 𝕜] [LinearOrder 𝕜] [IsStrictOrderedRing variable {R : Type*} [CommRing R] (abv : AbsoluteValue R 𝕜) /-- The uniform structure coming from an absolute value. -/ +@[implicit_reducible] def uniformSpace : UniformSpace R := .ofFun (fun x y => abv (y - x)) (by simp) (fun x y => abv.map_sub y x) (fun _ _ _ => (abv.sub_le _ _ _).trans_eq (add_comm _ _)) diff --git a/Mathlib/Topology/UniformSpace/Defs.lean b/Mathlib/Topology/UniformSpace/Defs.lean index fcba84a6141dcb..f4adcf7562c83b 100644 --- a/Mathlib/Topology/UniformSpace/Defs.lean +++ b/Mathlib/Topology/UniformSpace/Defs.lean @@ -339,6 +339,7 @@ def UniformSpace.Core.mkOfBasis {α : Type u} (B : FilterBasis (α × α)) comp := ((B.hasBasis.lift' (monotone_id.relComp monotone_id)).le_basis_iff B.hasBasis).2 comp /-- A uniform space generates a topological space -/ +@[implicit_reducible] def UniformSpace.Core.toTopologicalSpace {α : Type u} (u : UniformSpace.Core α) : TopologicalSpace α := .mkOfNhds fun x ↦ .comap (Prod.mk x) u.uniformity diff --git a/Mathlib/Topology/UniformSpace/OfCompactT2.lean b/Mathlib/Topology/UniformSpace/OfCompactT2.lean index a72441380698e1..30bda8d8f9ae7c 100644 --- a/Mathlib/Topology/UniformSpace/OfCompactT2.lean +++ b/Mathlib/Topology/UniformSpace/OfCompactT2.lean @@ -41,6 +41,7 @@ variable {γ : Type*} set_option backward.isDefEq.respectTransparency false in /-- The unique uniform structure inducing a given compact topological structure. -/ +@[implicit_reducible] def uniformSpaceOfCompactR1 [TopologicalSpace γ] [CompactSpace γ] [R1Space γ] : UniformSpace γ where uniformity := 𝓝ˢ (diagonal γ) symm := continuous_swap.tendsto_nhdsSet fun _ => Eq.symm diff --git a/Mathlib/Topology/UniformSpace/OfFun.lean b/Mathlib/Topology/UniformSpace/OfFun.lean index dde2c6817456da..5cf81b8e13dbbb 100644 --- a/Mathlib/Topology/UniformSpace/OfFun.lean +++ b/Mathlib/Topology/UniformSpace/OfFun.lean @@ -29,6 +29,7 @@ namespace UniformSpace /-- Define a `UniformSpace` using a "distance" function. The function can be, e.g., the distance in a (usual or extended) metric space or an absolute value on a ring. -/ +@[implicit_reducible] def ofFun [AddCommMonoid M] [PartialOrder M] (d : X → X → M) (refl : ∀ x, d x x = 0) (symm : ∀ x y, d x y = d y x) (triangle : ∀ x y z, d x z ≤ d x y + d y z) @@ -59,6 +60,7 @@ distance in a (usual or extended) metric space or an absolute value on a ring. W there is a preexisting topology, for which the neighborhoods can be expressed using the "distance", and we make sure that the uniform space structure we construct has a topology which is defeq to the original one. -/ +@[implicit_reducible] def ofFunOfHasBasis [t : TopologicalSpace X] [AddCommMonoid M] [LinearOrder M] (d : X → X → M) (refl : ∀ x, d x x = 0) (symm : ∀ x y, d x y = d y x) (triangle : ∀ x y z, d x z ≤ d x y + d y z) diff --git a/Mathlib/Topology/UniformSpace/UniformEmbedding.lean b/Mathlib/Topology/UniformSpace/UniformEmbedding.lean index 60f7c8ea86082f..ef6f72808b397e 100644 --- a/Mathlib/Topology/UniformSpace/UniformEmbedding.lean +++ b/Mathlib/Topology/UniformSpace/UniformEmbedding.lean @@ -414,6 +414,7 @@ theorem isUniformEmbedding_comap {α : Type*} {β : Type*} {f : α → β} [u : /-- Pull back a uniform space structure by an embedding, adjusting the new uniform structure to make sure that its topology is defeq to the original one. -/ +@[implicit_reducible] def Topology.IsEmbedding.comapUniformSpace {α β} [TopologicalSpace α] [u : UniformSpace β] (f : α → β) (h : IsEmbedding f) : UniformSpace α := (u.comap f).replaceTopology h.eq_induced diff --git a/Mathlib/Topology/VectorBundle/Basic.lean b/Mathlib/Topology/VectorBundle/Basic.lean index 0ed32787be5ded..e5380bec69e3db 100644 --- a/Mathlib/Topology/VectorBundle/Basic.lean +++ b/Mathlib/Topology/VectorBundle/Basic.lean @@ -792,6 +792,7 @@ def toFiberPrebundle (a : VectorPrebundle R F E) : FiberPrebundle F E := rw [a.mk_coordChange _ _ hb, e'.mk_symm hb.1] } /-- Topology on the total space that will make the prebundle into a bundle. -/ +@[implicit_reducible] def totalSpaceTopology (a : VectorPrebundle R F E) : TopologicalSpace (TotalSpace F E) := a.toFiberPrebundle.totalSpaceTopology @@ -827,6 +828,7 @@ theorem continuous_totalSpaceMk (b : B) : /-- Make a `FiberBundle` from a `VectorPrebundle`; auxiliary construction for `VectorPrebundle.toVectorBundle`. -/ +@[implicit_reducible] def toFiberBundle : @FiberBundle B F _ _ _ a.totalSpaceTopology _ := a.toFiberPrebundle.toFiberBundle diff --git a/lake-manifest.json b/lake-manifest.json index cd3b26ab1a755e..a880d92b0f9c96 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -5,10 +5,10 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "2b93f2523263a6df8a8fbbe3dd28b7f028087480", + "rev": "6e5f0df32349311ba4242de24a5e35f4389a71c3", "name": "plausible", "manifestFile": "lake-manifest.json", - "inputRev": "main", + "inputRev": "lean-pr-testing-12325", "inherited": false, "configFile": "lakefile.toml"}, {"url": "https://github.com/leanprover-community/LeanSearchClient", @@ -65,7 +65,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "f4fc9a3b15c5bda5b91e2954252c21e7f60bb6f0", + "rev": "a249c2685e439e3d2ca8c18104813f03e49b7c1f", "name": "batteries", "manifestFile": "lake-manifest.json", "inputRev": "lean-pr-testing-12325", diff --git a/lakefile.lean b/lakefile.lean index cfcdd9a299504b..af445b0bed12f6 100644 --- a/lakefile.lean +++ b/lakefile.lean @@ -16,7 +16,7 @@ require "leanprover-community" / "proofwidgets" @ git "v0.0.90" -- ProofWidgets If this does not work, report your issue on the Lean Zulip." require "leanprover-community" / "importGraph" @ git "main" require "leanprover-community" / "LeanSearchClient" @ git "main" -require "leanprover-community" / "plausible" @ git "main" +require "leanprover-community" / "plausible" @ git "lean-pr-testing-12325" /-! From 284b70481df2e13b80085496aff929bb7e54d414 Mon Sep 17 00:00:00 2001 From: leanprover-community-mathlib4-bot Date: Thu, 5 Mar 2026 08:55:02 +0000 Subject: [PATCH 11/33] Update lean-toolchain for https://github.com/leanprover/lean4/pull/12325 --- lake-manifest.json | 2 +- lean-toolchain | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index a880d92b0f9c96..e96e4b8f2e116c 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,7 +65,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "a249c2685e439e3d2ca8c18104813f03e49b7c1f", + "rev": "af6579e821f363ee97f10035dcf688ae7d349459", "name": "batteries", "manifestFile": "lake-manifest.json", "inputRev": "lean-pr-testing-12325", diff --git a/lean-toolchain b/lean-toolchain index 99899cca25fdd2..86ea5f7d3e0f9a 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4-pr-releases:pr-release-12325-1ce851e +leanprover/lean4-pr-releases:pr-release-12325-32e1aa9 From ec8913147b34aeda03f2287062cf827b4269a3db Mon Sep 17 00:00:00 2001 From: "mathlib-nightly-testing[bot]" Date: Thu, 5 Mar 2026 09:18:33 +0000 Subject: [PATCH 12/33] chore: bump to nightly-2026-03-05 --- lean-toolchain | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lean-toolchain b/lean-toolchain index 5406d71f0eb63f..fd315255c53152 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-03-04 +leanprover/lean4:nightly-2026-03-05 From 29e0d5d9411c011b13fba0fa57eedfd93cc0ffab Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Thu, 5 Mar 2026 11:36:29 +0000 Subject: [PATCH 13/33] fix: address classDefReducibility warnings for lean4#12325 Add `@[implicit_reducible]` to class-typed `def`s where safe, and disable the warning with `set_option warn.classDefReducibility false in` where adding the attribute causes downstream breakage. Co-Authored-By: Claude Opus 4.6 --- Mathlib/Algebra/Algebra/ZMod.lean | 1 + Mathlib/Algebra/FreeMonoid/Basic.lean | 3 +- Mathlib/Algebra/Group/Pi/Basic.lean | 3 +- Mathlib/Algebra/Module/Torsion/Basic.lean | 8 +++++ Mathlib/Algebra/Order/Group/Lattice.lean | 3 +- .../Localization/LocallySmall.lean | 2 ++ .../Monoidal/Braided/Basic.lean | 1 + Mathlib/CategoryTheory/Monoidal/Functor.lean | 2 ++ Mathlib/Control/Traversable/Equiv.lean | 1 + Mathlib/Data/Fintype/Defs.lean | 4 +++ Mathlib/Data/Fintype/Sets.lean | 2 ++ Mathlib/GroupTheory/Divisible.lean | 6 ++-- Mathlib/GroupTheory/GroupAction/Defs.lean | 2 ++ Mathlib/GroupTheory/GroupExtension/Basic.lean | 2 +- Mathlib/GroupTheory/Index.lean | 2 +- Mathlib/GroupTheory/OrderOfElement.lean | 6 ++-- Mathlib/GroupTheory/QuotientGroup/Finite.lean | 6 ++-- Mathlib/GroupTheory/Torsion.lean | 3 +- Mathlib/LinearAlgebra/Quotient/Defs.lean | 2 ++ .../ConditionallyCompleteLattice/Defs.lean | 2 ++ Mathlib/Order/Copy.lean | 30 +++++++++++++++++++ Mathlib/Order/SuccPred/Basic.lean | 2 +- Mathlib/Topology/Algebra/FilterBasis.lean | 6 ++-- .../Algebra/Nonarchimedean/AdicTopology.lean | 1 + .../Topology/FiberBundle/Constructions.lean | 2 ++ Mathlib/Topology/Order/Basic.lean | 1 + Mathlib/Topology/Sets/Opens.lean | 2 ++ 27 files changed, 90 insertions(+), 15 deletions(-) diff --git a/Mathlib/Algebra/Algebra/ZMod.lean b/Mathlib/Algebra/Algebra/ZMod.lean index 146943a3d88cd4..4f774cc47a6887 100644 --- a/Mathlib/Algebra/Algebra/ZMod.lean +++ b/Mathlib/Algebra/Algebra/ZMod.lean @@ -51,6 +51,7 @@ set_option backward.isDefEq.respectTransparency false in /-- Any ring with a `ZMod p`-module structure can be upgraded to a `ZMod p`-algebra. Not an @[implicit_reducible] instance because this is usually not the default way, and this will cause typeclass search loop. -/ +@[implicit_reducible] def algebraOfModule (n : ℕ) (R : Type*) [Ring R] [Module (ZMod n) R] : Algebra (ZMod n) R := Algebra.ofModule' (proof · · |>.1) (proof · · |>.2) where proof (r : ZMod n) (x : R) : r • 1 * x = r • x ∧ x * r • 1 = r • x := by diff --git a/Mathlib/Algebra/FreeMonoid/Basic.lean b/Mathlib/Algebra/FreeMonoid/Basic.lean index 7c2c0cbf968609..5a8a719bc8357f 100644 --- a/Mathlib/Algebra/FreeMonoid/Basic.lean +++ b/Mathlib/Algebra/FreeMonoid/Basic.lean @@ -344,7 +344,8 @@ theorem hom_map_lift (g : M →* N) (f : α → M) (x : FreeMonoid α) : g (lift DFunLike.ext_iff.1 (comp_lift g f) x /-- Define a multiplicative action of `FreeMonoid α` on `β`. -/ -@[to_additive /-- Define an additive action of `FreeAddMonoid α` on `β`. -/] +@[to_additive (attr := implicit_reducible) + /-- Define an additive action of `FreeAddMonoid α` on `β`. -/] def mkMulAction (f : α → β → β) : MulAction (FreeMonoid α) β where smul l b := l.toList.foldr f b one_smul _ := rfl diff --git a/Mathlib/Algebra/Group/Pi/Basic.lean b/Mathlib/Algebra/Group/Pi/Basic.lean index 249691638ce082..ba7f7d9d87f6f1 100644 --- a/Mathlib/Algebra/Group/Pi/Basic.lean +++ b/Mathlib/Algebra/Group/Pi/Basic.lean @@ -191,7 +191,8 @@ lemma comp_ne_one_iff [One β] [One γ] (f : α → β) {g : β → γ} (hg : In end Function /-- If the one function is surjective, the codomain is trivial. -/ -@[to_additive /-- If the zero function is surjective, the codomain is trivial. -/] +@[to_additive (attr := implicit_reducible) + /-- If the zero function is surjective, the codomain is trivial. -/] def uniqueOfSurjectiveOne (α : Type*) {β : Type*} [One β] (h : Function.Surjective (1 : α → β)) : Unique β := h.uniqueOfSurjectiveConst α (1 : β) diff --git a/Mathlib/Algebra/Module/Torsion/Basic.lean b/Mathlib/Algebra/Module/Torsion/Basic.lean index eb7c0f00b43ddb..30e68aaec35a83 100644 --- a/Mathlib/Algebra/Module/Torsion/Basic.lean +++ b/Mathlib/Algebra/Module/Torsion/Basic.lean @@ -501,6 +501,8 @@ namespace Module variable [Ring R] [AddCommGroup M] [Module R M] variable {I : Ideal R} {r : R} +-- adding `@[implicit_reducible]` causes downstream breakage +set_option warn.classDefReducibility false in /-- can't be an instance because `hM` can't be inferred -/ def IsTorsionBySet.hasSMul (hM : IsTorsionBySet R M I) : SMul (R ⧸ I) M where smul b := QuotientAddGroup.lift I.toAddSubgroup (smulAddHom R M) @@ -522,6 +524,8 @@ theorem IsTorsionBy.mk_smul [(Ideal.span {r}).IsTwoSided] (hM : IsTorsionBy R M Ideal.Quotient.mk (Ideal.span {r}) b • x = b • x := rfl +-- adding `@[implicit_reducible]` causes downstream breakage +set_option warn.classDefReducibility false in /-- An `(R ⧸ I)`-module is an `R`-module which `IsTorsionBySet R M I`. -/ def IsTorsionBySet.module [I.IsTwoSided] (hM : IsTorsionBySet R M I) : Module (R ⧸ I) M := letI := hM.hasSMul; I.mkQ_surjective.moduleLeft _ (IsTorsionBySet.mk_smul hM) @@ -553,6 +557,8 @@ abbrev IsTorsionBy.module [h : (Ideal.span {r}).IsTwoSided] (hM : IsTorsionBy R Module (R ⧸ Ideal.span {r}) M := by rw [Ideal.span] at h; exact ((isTorsionBySet_span_singleton_iff r).mpr hM).module +-- adding `@[implicit_reducible]` causes downstream breakage +set_option warn.classDefReducibility false in /-- Any module is also a module over the quotient of the ring by the annihilator. Not an instance because it causes synthesis failures / timeouts. -/ def quotientAnnihilator : Module (R ⧸ Module.annihilator R M) M := @@ -948,6 +954,8 @@ lemma torsionBy.mod_self_nsmul' (s : ℕ) {x : A} (h : x ∈ A[n]) : s • x = (s % n) • x := nsmul_eq_mod_nsmul s (torsionBy.nsmul_iff.mp h) +-- adding `@[implicit_reducible]` causes downstream breakage +set_option warn.classDefReducibility false in /-- For a natural number `n`, the `n`-torsion subgroup of `A` is a `ZMod n` module. -/ def torsionBy.zmodModule : Module (ZMod n) A[n] := AddCommGroup.zmodModule torsionBy.nsmul diff --git a/Mathlib/Algebra/Order/Group/Lattice.lean b/Mathlib/Algebra/Order/Group/Lattice.lean index 015f62bce25b8d..58d100aebc7618 100644 --- a/Mathlib/Algebra/Order/Group/Lattice.lean +++ b/Mathlib/Algebra/Order/Group/Lattice.lean @@ -119,7 +119,8 @@ lemma inf_mul_sup [MulLeftMono α] (a b : α) : (a ⊓ b) * (a ⊔ b) = a * b := /-- Every lattice ordered commutative group is a distributive lattice. -/ -- Non-comm case needs cancellation law https://ncatlab.org/nlab/show/distributive+lattice -@[to_additive /-- Every lattice ordered commutative additive group is a distributive lattice -/] +@[to_additive (attr := implicit_reducible) + /-- Every lattice ordered commutative additive group is a distributive lattice -/] def CommGroup.toDistribLattice (α : Type*) [Lattice α] [CommGroup α] [MulLeftMono α] : DistribLattice α where le_sup_inf x y z := by diff --git a/Mathlib/CategoryTheory/Localization/LocallySmall.lean b/Mathlib/CategoryTheory/Localization/LocallySmall.lean index 974c737bf45da2..bac83aa39df13b 100644 --- a/Mathlib/CategoryTheory/Localization/LocallySmall.lean +++ b/Mathlib/CategoryTheory/Localization/LocallySmall.lean @@ -41,6 +41,8 @@ noncomputable def hasLocalizationOfLocallySmall D := ShrinkHoms D L := L ⋙ (ShrinkHoms.equivalence D).functor +-- adding `@[implicit_reducible]` causes downstream breakage +set_option warn.classDefReducibility false in /-- If `L : C ⥤ D` is a localization functor for a class of morphisms `W : MorphismProperty C`, and `D` is locally `w`-small, we may obtain a `HasLocalization.{w} W` instance. This should be used only in the diff --git a/Mathlib/CategoryTheory/Monoidal/Braided/Basic.lean b/Mathlib/CategoryTheory/Monoidal/Braided/Basic.lean index 7f3572b1df92fe..9b1e965364989d 100644 --- a/Mathlib/CategoryTheory/Monoidal/Braided/Basic.lean +++ b/Mathlib/CategoryTheory/Monoidal/Braided/Basic.lean @@ -878,6 +878,7 @@ lemma SymmetricCategory.reverseBraiding_eq (C : Type u₁) [Category.{v₁} C] /-- The identity functor from `C` to `C`, where the codomain is given the reversed braiding, upgraded to a braided functor. -/ +@[implicit_reducible] def SymmetricCategory.equivReverseBraiding (C : Type u₁) [Category.{v₁} C] [MonoidalCategory C] [SymmetricCategory C] := @Functor.Braided.mk C _ _ _ C _ _ (reverseBraiding C) (𝟭 C) _ <| by diff --git a/Mathlib/CategoryTheory/Monoidal/Functor.lean b/Mathlib/CategoryTheory/Monoidal/Functor.lean index 5ec981b7a2bee4..90f88179f33954 100644 --- a/Mathlib/CategoryTheory/Monoidal/Functor.lean +++ b/Mathlib/CategoryTheory/Monoidal/Functor.lean @@ -677,12 +677,14 @@ end CoreMonoidal /-- The `Functor.Monoidal` structure given by a lax monoidal functor such that `ε` and `μ` are isomorphisms. -/ +@[implicit_reducible] noncomputable def Monoidal.ofLaxMonoidal [F.LaxMonoidal] [IsIso (ε F)] [∀ X Y, IsIso (μ F X Y)] := (CoreMonoidal.ofLaxMonoidal F).toMonoidal /-- The `Functor.Monoidal` structure given by an oplax monoidal functor such that `η` and `δ` are isomorphisms. -/ +@[implicit_reducible] noncomputable def Monoidal.ofOplaxMonoidal [F.OplaxMonoidal] [IsIso (η F)] [∀ X Y, IsIso (δ F X Y)] := (CoreMonoidal.ofOplaxMonoidal F).toMonoidal diff --git a/Mathlib/Control/Traversable/Equiv.lean b/Mathlib/Control/Traversable/Equiv.lean index c06c1e225636ee..7943e2c36207e9 100644 --- a/Mathlib/Control/Traversable/Equiv.lean +++ b/Mathlib/Control/Traversable/Equiv.lean @@ -104,6 +104,7 @@ theorem traverse_def (f : α → m β) (x : t' α) : /-- The function `Equiv.traverse` transfers a traversable functor @[implicit_reducible] instance across the equivalences `eqv`. -/ +@[implicit_reducible] protected def traversable : Traversable t' where toFunctor := Equiv.functor eqv traverse := Equiv.traverse eqv diff --git a/Mathlib/Data/Fintype/Defs.lean b/Mathlib/Data/Fintype/Defs.lean index 4e033397faa589..fe671fe13e58a6 100644 --- a/Mathlib/Data/Fintype/Defs.lean +++ b/Mathlib/Data/Fintype/Defs.lean @@ -257,6 +257,8 @@ instance subsingleton (α : Type*) : Subsingleton (Fintype α) := instance (α : Type*) : Lean.Meta.FastSubsingleton (Fintype α) := {} +-- adding `@[implicit_reducible]` causes downstream breakage +set_option warn.classDefReducibility false in /-- Given a predicate that can be represented by a finset, the subtype associated to the predicate is a fintype. -/ protected def subtype {p : α → Prop} (s : Finset α) (H : ∀ x : α, x ∈ s ↔ p x) : @@ -264,6 +266,8 @@ protected def subtype {p : α → Prop} (s : Finset α) (H : ∀ x : α, x ∈ s ⟨⟨s.1.pmap Subtype.mk fun x => (H x).1, s.nodup.pmap fun _ _ _ _ => congr_arg Subtype.val⟩, fun ⟨x, px⟩ => Multiset.mem_pmap.2 ⟨x, (H x).2 px, rfl⟩⟩ +-- adding `@[implicit_reducible]` causes downstream breakage +set_option warn.classDefReducibility false in /-- Construct a fintype from a finset with the same elements. -/ def ofFinset {p : Set α} (s : Finset α) (H : ∀ x, x ∈ s ↔ x ∈ p) : Fintype p := Fintype.subtype s H diff --git a/Mathlib/Data/Fintype/Sets.lean b/Mathlib/Data/Fintype/Sets.lean index ff7ac32bced983..61c792e2e9ecb0 100644 --- a/Mathlib/Data/Fintype/Sets.lean +++ b/Mathlib/Data/Fintype/Sets.lean @@ -264,6 +264,8 @@ theorem Fintype.univ_Prop : (Finset.univ : Finset Prop) = {True, False} := instance Subtype.fintype (p : α → Prop) [DecidablePred p] [Fintype α] : Fintype { x // p x } := Fintype.subtype (univ.filter p) (by simp) +-- adding `@[implicit_reducible]` causes downstream breakage +set_option warn.classDefReducibility false in /-- A set on a fintype, when coerced to a type, is a fintype. -/ def setFintype [Fintype α] (s : Set α) [DecidablePred (· ∈ s)] : Fintype s := Subtype.fintype fun x => x ∈ s diff --git a/Mathlib/GroupTheory/Divisible.lean b/Mathlib/GroupTheory/Divisible.lean index 5e8bf984cfff90..355c4303a28933 100644 --- a/Mathlib/GroupTheory/Divisible.lean +++ b/Mathlib/GroupTheory/Divisible.lean @@ -206,7 +206,8 @@ variable (A : Type*) [Group A] open Int in /-- A group is `ℤ`-rootable if it is `ℕ`-rootable. -/ -@[to_additive /-- An additive group is `ℤ`-divisible if it is `ℕ`-divisible. -/] +@[to_additive (attr := implicit_reducible) + /-- An additive group is `ℤ`-divisible if it is `ℕ`-divisible. -/] def rootableByIntOfRootableByNat [RootableBy A ℕ] : RootableBy A ℤ where root a z := match z with @@ -221,7 +222,8 @@ def rootableByIntOfRootableByNat [RootableBy A ℕ] : RootableBy A ℤ where /-- A group is `ℕ`-rootable if it is `ℤ`-rootable -/ -@[to_additive /-- An additive group is `ℕ`-divisible if it `ℤ`-divisible. -/] +@[to_additive (attr := implicit_reducible) + /-- An additive group is `ℕ`-divisible if it `ℤ`-divisible. -/] def rootableByNatOfRootableByInt [RootableBy A ℤ] : RootableBy A ℕ where root a n := RootableBy.root a (n : ℤ) root_zero a := RootableBy.root_zero a diff --git a/Mathlib/GroupTheory/GroupAction/Defs.lean b/Mathlib/GroupTheory/GroupAction/Defs.lean index cc9f98fd378fc1..0ef5c29fa28b4f 100644 --- a/Mathlib/GroupTheory/GroupAction/Defs.lean +++ b/Mathlib/GroupTheory/GroupAction/Defs.lean @@ -276,6 +276,8 @@ lemma mem_subgroup_orbit_iff {H : Subgroup G} {x : α} {a b : orbit G x} : variable (G α) +-- adding `@[implicit_reducible]` causes downstream breakage +set_option warn.classDefReducibility false in /-- The relation 'in the same orbit'. -/ @[to_additive /-- The relation 'in the same orbit'. -/] def orbitRel : Setoid α where diff --git a/Mathlib/GroupTheory/GroupExtension/Basic.lean b/Mathlib/GroupTheory/GroupExtension/Basic.lean index df1a5fed32cf62..ca3105cef08cc0 100644 --- a/Mathlib/GroupTheory/GroupExtension/Basic.lean +++ b/Mathlib/GroupTheory/GroupExtension/Basic.lean @@ -202,7 +202,7 @@ theorem trans {s₁ s₂ s₃ : S.Splitting} (h₁ : S.IsConj s₁ s₂) (h₂ : exact ⟨n₁ * n₂, by simp only [hn₁, hn₂, map_mul]; group⟩ /-- The setoid of splittings with `N`-conjugacy -/ -@[to_additive /-- The setoid of splittings with `N`-conjugacy -/] +@[to_additive (attr := implicit_reducible) /-- The setoid of splittings with `N`-conjugacy -/] def setoid : Setoid S.Splitting where r := S.IsConj iseqv := diff --git a/Mathlib/GroupTheory/Index.lean b/Mathlib/GroupTheory/Index.lean index 109e2406479a8f..85773453c38a6d 100644 --- a/Mathlib/GroupTheory/Index.lean +++ b/Mathlib/GroupTheory/Index.lean @@ -532,7 +532,7 @@ theorem index_ne_zero_of_finite [hH : Finite (G ⧸ H)] : H.index ≠ 0 := by exact Nat.card_pos.ne' /-- Finite index implies finite quotient. -/ -@[to_additive /-- Finite index implies finite quotient. -/] +@[to_additive (attr := implicit_reducible) /-- Finite index implies finite quotient. -/] noncomputable def fintypeOfIndexNeZero (hH : H.index ≠ 0) : Fintype (G ⧸ H) := @Fintype.ofFinite _ (Nat.finite_of_card_ne_zero hH) diff --git a/Mathlib/GroupTheory/OrderOfElement.lean b/Mathlib/GroupTheory/OrderOfElement.lean index dfac829fd04825..805450b2f1ee49 100644 --- a/Mathlib/GroupTheory/OrderOfElement.lean +++ b/Mathlib/GroupTheory/OrderOfElement.lean @@ -942,7 +942,8 @@ lemma isOfFinOrder_of_finite (x : G) : IsOfFinOrder x := by by_contra h; exact infinite_not_isOfFinOrder h <| Set.toFinite _ /-- Every finite left cancellative monoid is a group. -/ -@[to_additive /-- Every finite left cancellative additive monoid is an additive group. -/] +@[to_additive (attr := implicit_reducible) + /-- Every finite left cancellative additive monoid is an additive group. -/] noncomputable def LeftCancelMonoid.groupOfFinite : Group G where inv x := x ^ (orderOf x - 1) inv_mul_cancel x := by @@ -950,7 +951,8 @@ noncomputable def LeftCancelMonoid.groupOfFinite : Group G where exact (isOfFinOrder_of_finite x).orderOf_pos /-- Every finite right cancellative monoid is a group. -/ -@[to_additive /-- Every finite right cancellative additive monoid is an additive group. -/] +@[to_additive (attr := implicit_reducible) + /-- Every finite right cancellative additive monoid is an additive group. -/] noncomputable def RightCancelMonoid.groupOfFinite {H : Type*} [RightCancelMonoid H] [Finite H] : Group H := by letI : Finite Hᵐᵒᵖ := Finite.of_equiv H MulOpposite.opEquiv diff --git a/Mathlib/GroupTheory/QuotientGroup/Finite.lean b/Mathlib/GroupTheory/QuotientGroup/Finite.lean index dc0fb0f6e769b3..99d3fa66167d19 100644 --- a/Mathlib/GroupTheory/QuotientGroup/Finite.lean +++ b/Mathlib/GroupTheory/QuotientGroup/Finite.lean @@ -43,13 +43,15 @@ noncomputable def fintypeOfKerEqRange (h : g.ker = f.range) : Fintype G := set_option backward.isDefEq.respectTransparency false in /-- If `ker(G →* H)` and `H` are finite, then `G` is finite. -/ -@[to_additive /-- If `ker(G →+ H)` and `H` are finite, then `G` is finite. -/] +@[to_additive (attr := implicit_reducible) + /-- If `ker(G →+ H)` and `H` are finite, then `G` is finite. -/] noncomputable def fintypeOfKerOfCodom [Fintype g.ker] : Fintype G := fintypeOfKerLeRange ((topEquiv : _ ≃* G).toMonoidHom.comp <| inclusion le_top) g fun x hx => ⟨⟨x, hx⟩, rfl⟩ /-- If `F` and `coker(F →* G)` are finite, then `G` is finite. -/ -@[to_additive /-- If `F` and `coker(F →+ G)` are finite, then `G` is finite. -/] +@[to_additive (attr := implicit_reducible) + /-- If `F` and `coker(F →+ G)` are finite, then `G` is finite. -/] noncomputable def fintypeOfDomOfCoker [Normal f.range] [Fintype <| G ⧸ f.range] : Fintype G := fintypeOfKerLeRange _ (mk' f.range) fun x => (eq_one_iff x).mp diff --git a/Mathlib/GroupTheory/Torsion.lean b/Mathlib/GroupTheory/Torsion.lean index 649a5ee803ce3d..a669047b5565a2 100644 --- a/Mathlib/GroupTheory/Torsion.lean +++ b/Mathlib/GroupTheory/Torsion.lean @@ -66,7 +66,8 @@ end Monoid open Monoid /-- Torsion monoids are really groups. -/ -@[to_additive /-- Torsion additive monoids are really additive groups -/] +@[to_additive (attr := implicit_reducible) + /-- Torsion additive monoids are really additive groups -/] noncomputable def IsTorsion.group [Monoid G] (tG : IsTorsion G) : Group G := { ‹Monoid G› with inv := fun g => g ^ (orderOf g - 1) diff --git a/Mathlib/LinearAlgebra/Quotient/Defs.lean b/Mathlib/LinearAlgebra/Quotient/Defs.lean index d4d02890966599..0ad1aabb5d3b4a 100644 --- a/Mathlib/LinearAlgebra/Quotient/Defs.lean +++ b/Mathlib/LinearAlgebra/Quotient/Defs.lean @@ -37,6 +37,8 @@ variable (p p' : Submodule R M) open QuotientAddGroup +-- adding `@[implicit_reducible]` causes downstream breakage +set_option warn.classDefReducibility false in /-- The equivalence relation associated to a submodule `p`, defined by `x ≈ y` iff `-x + y ∈ p`. Note this is equivalent to `y - x ∈ p`, but defined this way to be defeq to the `AddSubgroup` diff --git a/Mathlib/Order/ConditionallyCompleteLattice/Defs.lean b/Mathlib/Order/ConditionallyCompleteLattice/Defs.lean index c46b8a9429949f..a4ba96da820a3a 100644 --- a/Mathlib/Order/ConditionallyCompleteLattice/Defs.lean +++ b/Mathlib/Order/ConditionallyCompleteLattice/Defs.lean @@ -143,6 +143,7 @@ instance : ConditionallyCompleteLattice my_T := ..conditionallyCompleteLatticeOfsSup my_T _ } ``` -/ +@[implicit_reducible] def conditionallyCompleteLatticeOfsSup (α : Type*) [H1 : PartialOrder α] [H2 : SupSet α] (bddAbove_pair : ∀ a b : α, BddAbove ({a, b} : Set α)) (bddBelow_pair : ∀ a b : α, BddBelow ({a, b} : Set α)) @@ -195,6 +196,7 @@ instance : ConditionallyCompleteLattice my_T := ..conditionallyCompleteLatticeOfsInf my_T _ } ``` -/ +@[implicit_reducible] def conditionallyCompleteLatticeOfsInf (α : Type*) [H1 : PartialOrder α] [H2 : InfSet α] (bddAbove_pair : ∀ a b : α, BddAbove ({a, b} : Set α)) (bddBelow_pair : ∀ a b : α, BddBelow ({a, b} : Set α)) diff --git a/Mathlib/Order/Copy.lean b/Mathlib/Order/Copy.lean index dfd69d8418a91d..a277ddbe3742c8 100644 --- a/Mathlib/Order/Copy.lean +++ b/Mathlib/Order/Copy.lean @@ -24,6 +24,8 @@ universe u variable {α : Type u} +-- adding `@[implicit_reducible]` causes downstream breakage +set_option warn.classDefReducibility false in /-- A function to create a provable equal copy of a top order with possibly different definitional equalities. -/ def OrderTop.copy {h : LE α} {h' : LE α} (c : @OrderTop α h') @@ -31,6 +33,8 @@ def OrderTop.copy {h : LE α} {h' : LE α} (c : @OrderTop α h') (le_eq : ∀ x y : α, (@LE.le α h) x y ↔ x ≤ y) : @OrderTop α h := @OrderTop.mk α h { top := top } fun _ ↦ by simp [eq_top, le_eq] +-- adding `@[implicit_reducible]` causes downstream breakage +set_option warn.classDefReducibility false in /-- A function to create a provable equal copy of a bottom order with possibly different definitional equalities. -/ def OrderBot.copy {h : LE α} {h' : LE α} (c : @OrderBot α h') @@ -38,6 +42,8 @@ def OrderBot.copy {h : LE α} {h' : LE α} (c : @OrderBot α h') (le_eq : ∀ x y : α, (@LE.le α h) x y ↔ x ≤ y) : @OrderBot α h := @OrderBot.mk α h { bot := bot } fun _ ↦ by simp [eq_bot, le_eq] +-- adding `@[implicit_reducible]` causes downstream breakage +set_option warn.classDefReducibility false in /-- A function to create a provable equal copy of a bounded order with possibly different definitional equalities. -/ def BoundedOrder.copy {h : LE α} {h' : LE α} (c : @BoundedOrder α h') @@ -47,6 +53,8 @@ def BoundedOrder.copy {h : LE α} {h' : LE α} (c : @BoundedOrder α h') @BoundedOrder.mk α h (@OrderTop.mk α h { top := top } (fun _ ↦ by simp [eq_top, le_eq])) (@OrderBot.mk α h { bot := bot } (fun _ ↦ by simp [eq_bot, le_eq])) +-- adding `@[implicit_reducible]` causes downstream breakage +set_option warn.classDefReducibility false in /-- A function to create a provable equal copy of a lattice with possibly different definitional equalities. -/ def Lattice.copy (c : Lattice α) @@ -67,6 +75,8 @@ def Lattice.copy (c : Lattice α) inf_le_right := by intros; simp [eq_le, eq_inf] le_inf := by intro _ _ _ hac hbc; simp_rw [eq_le] at hac hbc ⊢; simp [eq_inf, hac, hbc] +-- adding `@[implicit_reducible]` causes downstream breakage +set_option warn.classDefReducibility false in set_option backward.isDefEq.respectTransparency false in /-- A function to create a provable equal copy of a distributive lattice with possibly different definitional equalities. -/ @@ -77,6 +87,8 @@ def DistribLattice.copy (c : DistribLattice α) toLattice := Lattice.copy (@DistribLattice.toLattice α c) le eq_le sup eq_sup inf eq_inf le_sup_inf := by intros; simp +instances [eq_le, eq_sup, eq_inf, le_sup_inf] +-- adding `@[implicit_reducible]` causes downstream breakage +set_option warn.classDefReducibility false in set_option backward.isDefEq.respectTransparency false in /-- A function to create a provable equal copy of a generalised heyting algebra with possibly different definitional equalities. -/ @@ -93,6 +105,8 @@ def GeneralizedHeytingAlgebra.copy (c : GeneralizedHeytingAlgebra α) himp := himp le_himp_iff _ _ _ := by simp +instances [eq_le, eq_himp, eq_inf] +-- adding `@[implicit_reducible]` causes downstream breakage +set_option warn.classDefReducibility false in set_option backward.isDefEq.respectTransparency false in /-- A function to create a provable equal copy of a generalised co-Heyting algebra with possibly different definitional equalities. -/ @@ -109,6 +123,8 @@ def GeneralizedCoheytingAlgebra.copy (c : GeneralizedCoheytingAlgebra α) sdiff := sdiff sdiff_le_iff := by simp +instances [eq_le, eq_sdiff, eq_sup] +-- adding `@[implicit_reducible]` causes downstream breakage +set_option warn.classDefReducibility false in set_option backward.isDefEq.respectTransparency false in /-- A function to create a provable equal copy of a heyting algebra with possibly different definitional equalities. -/ @@ -129,6 +145,8 @@ def HeytingAlgebra.copy (c : HeytingAlgebra α) compl := compl himp_bot := by simp +instances [eq_le, eq_himp, eq_bot, eq_compl] +-- adding `@[implicit_reducible]` causes downstream breakage +set_option warn.classDefReducibility false in set_option backward.isDefEq.respectTransparency false in /-- A function to create a provable equal copy of a co-Heyting algebra with possibly different definitional equalities. -/ @@ -149,6 +167,8 @@ def CoheytingAlgebra.copy (c : CoheytingAlgebra α) hnot := hnot top_sdiff := by simp +instances [eq_le, eq_sdiff, eq_top, eq_hnot] +-- adding `@[implicit_reducible]` causes downstream breakage +set_option warn.classDefReducibility false in /-- A function to create a provable equal copy of a bi-Heyting algebra with possibly different definitional equalities. -/ def BiheytingAlgebra.copy (c : BiheytingAlgebra α) @@ -167,6 +187,8 @@ def BiheytingAlgebra.copy (c : BiheytingAlgebra α) __ := CoheytingAlgebra.copy (@BiheytingAlgebra.toCoheytingAlgebra α c) le eq_le top eq_top bot eq_bot sup eq_sup inf eq_inf sdiff eq_sdiff hnot eq_hnot +-- adding `@[implicit_reducible]` causes downstream breakage +set_option warn.classDefReducibility false in set_option backward.isDefEq.respectTransparency false in /-- A function to create a provable equal copy of a complete lattice with possibly different definitional equalities. -/ @@ -191,6 +213,8 @@ def CompleteLattice.copy (c : CompleteLattice α) le_top := by intros; simp +instances [eq_le, eq_top] bot_le := by intros; simp +instances [eq_le, eq_bot] +-- adding `@[implicit_reducible]` causes downstream breakage +set_option warn.classDefReducibility false in /-- A function to create a provable equal copy of a frame with possibly different definitional equalities. -/ def Frame.copy (c : Frame α) (le : α → α → Prop) (eq_le : le = (by infer_instance : LE α).le) @@ -207,6 +231,8 @@ def Frame.copy (c : Frame α) (le : α → α → Prop) (eq_le : le = (by infer_ __ := HeytingAlgebra.copy (@Frame.toHeytingAlgebra α c) le eq_le top eq_top bot eq_bot sup eq_sup inf eq_inf himp eq_himp compl eq_compl +-- adding `@[implicit_reducible]` causes downstream breakage +set_option warn.classDefReducibility false in /-- A function to create a provable equal copy of a coframe with possibly different definitional equalities. -/ def Coframe.copy (c : Coframe α) (le : α → α → Prop) (eq_le : le = (by infer_instance : LE α).le) @@ -223,6 +249,8 @@ def Coframe.copy (c : Coframe α) (le : α → α → Prop) (eq_le : le = (by in __ := CoheytingAlgebra.copy (@Coframe.toCoheytingAlgebra α c) le eq_le top eq_top bot eq_bot sup eq_sup inf eq_inf sdiff eq_sdiff hnot eq_hnot +-- adding `@[implicit_reducible]` causes downstream breakage +set_option warn.classDefReducibility false in /-- A function to create a provable equal copy of a complete distributive lattice with possibly different definitional equalities. -/ def CompleteDistribLattice.copy (c : CompleteDistribLattice α) @@ -243,6 +271,8 @@ def CompleteDistribLattice.copy (c : CompleteDistribLattice α) __ := Coframe.copy (@CompleteDistribLattice.toCoframe α c) le eq_le top eq_top bot eq_bot sup eq_sup inf eq_inf sdiff eq_sdiff hnot eq_hnot sSup eq_sSup sInf eq_sInf +-- adding `@[implicit_reducible]` causes downstream breakage +set_option warn.classDefReducibility false in /-- A function to create a provable equal copy of a conditionally complete lattice with possibly different definitional equalities. -/ def ConditionallyCompleteLattice.copy (c : ConditionallyCompleteLattice α) diff --git a/Mathlib/Order/SuccPred/Basic.lean b/Mathlib/Order/SuccPred/Basic.lean index 51f971b5005b3c..fa12159b18faa2 100644 --- a/Mathlib/Order/SuccPred/Basic.lean +++ b/Mathlib/Order/SuccPred/Basic.lean @@ -145,7 +145,7 @@ noncomputable def SuccOrder.ofLinearWellFoundedLT [WellFoundedLT α] : SuccOrder fun _ ha ↦ dif_neg (not_not_intro ha <| not_isMax_iff.mpr ·) /-- A linear order with well-founded greater-than relation is a `PredOrder`. -/ -@[to_dual existing] +@[implicit_reducible, to_dual existing] noncomputable def PredOrder.ofLinearWellFoundedGT (α) [LinearOrder α] [WellFoundedGT α] : PredOrder α := letI := SuccOrder.ofLinearWellFoundedLT αᵒᵈ; inferInstanceAs (PredOrder αᵒᵈᵒᵈ) diff --git a/Mathlib/Topology/Algebra/FilterBasis.lean b/Mathlib/Topology/Algebra/FilterBasis.lean index 2d7edd9dd228a5..dc7d6ebc649009 100644 --- a/Mathlib/Topology/Algebra/FilterBasis.lean +++ b/Mathlib/Topology/Algebra/FilterBasis.lean @@ -67,7 +67,8 @@ class AddGroupFilterBasis (A : Type u) [AddGroup A] extends FilterBasis A where attribute [to_additive] GroupFilterBasis /-- `GroupFilterBasis` constructor in the commutative group case. -/ -@[to_additive /-- `AddGroupFilterBasis` constructor in the additive commutative group case. -/] +@[to_additive (attr := implicit_reducible) + /-- `AddGroupFilterBasis` constructor in the additive commutative group case. -/] def groupFilterBasisOfComm {G : Type*} [CommGroup G] (sets : Set (Set G)) (nonempty : sets.Nonempty) (inter_sets : ∀ x y, x ∈ sets → y ∈ sets → ∃ z ∈ sets, z ⊆ x ∩ y) (one : ∀ U ∈ sets, (1 : G) ∈ U) (mul : ∀ U ∈ sets, ∃ V ∈ sets, V * V ⊆ U) @@ -137,7 +138,8 @@ protected theorem hasBasis (B : GroupFilterBasis G) (x : G) : HasBasis.map (fun y ↦ x * y) toFilterBasis.hasBasis /-- The topological space structure coming from a group filter basis. -/ -@[to_additive /-- The topological space structure coming from an additive group filter basis. -/] +@[to_additive (attr := implicit_reducible) + /-- The topological space structure coming from an additive group filter basis. -/] def topology (B : GroupFilterBasis G) : TopologicalSpace G := TopologicalSpace.mkOfNhds B.N diff --git a/Mathlib/Topology/Algebra/Nonarchimedean/AdicTopology.lean b/Mathlib/Topology/Algebra/Nonarchimedean/AdicTopology.lean index 11567f37a26545..167e84076bd7d4 100644 --- a/Mathlib/Topology/Algebra/Nonarchimedean/AdicTopology.lean +++ b/Mathlib/Topology/Algebra/Nonarchimedean/AdicTopology.lean @@ -77,6 +77,7 @@ theorem adic_basis (I : Ideal R) : SubmodulesRingBasis fun n : ℕ => (I ^ n • exact (I ^ n).smul_mem x hb } /-- The adic ring filter basis associated to an ideal `I` is made of powers of `I`. -/ +@[implicit_reducible] def ringFilterBasis (I : Ideal R) := I.adic_basis.toRing_subgroups_basis.toRingFilterBasis diff --git a/Mathlib/Topology/FiberBundle/Constructions.lean b/Mathlib/Topology/FiberBundle/Constructions.lean index 6945408397a7b8..bbcad9c9e4ef47 100644 --- a/Mathlib/Topology/FiberBundle/Constructions.lean +++ b/Mathlib/Topology/FiberBundle/Constructions.lean @@ -261,6 +261,8 @@ instance [∀ x : B, TopologicalSpace (E x)] : ∀ x : B', TopologicalSpace ((f variable [TopologicalSpace B'] [TopologicalSpace (TotalSpace F E)] +-- adding `@[implicit_reducible]` causes downstream breakage +set_option warn.classDefReducibility false in /-- Definition of `Pullback.TotalSpace.topologicalSpace`, which we make irreducible. -/ irreducible_def pullbackTopology : TopologicalSpace (TotalSpace F (f *ᵖ E)) := induced TotalSpace.proj ‹TopologicalSpace B'› ⊓ diff --git a/Mathlib/Topology/Order/Basic.lean b/Mathlib/Topology/Order/Basic.lean index 1e6919c6cb2257..39c8489f97f954 100644 --- a/Mathlib/Topology/Order/Basic.lean +++ b/Mathlib/Topology/Order/Basic.lean @@ -76,6 +76,7 @@ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop @[implicit_reducible] instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ +@[implicit_reducible] def Preorder.topology (α : Type*) [Preorder α] : TopologicalSpace α := generateFrom { s : Set α | ∃ a : α, s = { b : α | a < b } ∨ s = { b : α | b < a } } diff --git a/Mathlib/Topology/Sets/Opens.lean b/Mathlib/Topology/Sets/Opens.lean index a17cb959fb0235..42637ff1745349 100644 --- a/Mathlib/Topology/Sets/Opens.lean +++ b/Mathlib/Topology/Sets/Opens.lean @@ -250,6 +250,8 @@ theorem mem_iSup {ι} {x : α} {s : ι → Opens α} : x ∈ iSup s ↔ ∃ i, x theorem mem_sSup {Us : Set (Opens α)} {x : α} : x ∈ sSup Us ↔ ∃ u ∈ Us, x ∈ u := by simp_rw [sSup_eq_iSup, mem_iSup, exists_prop] +-- adding `@[implicit_reducible]` causes downstream breakage +set_option warn.classDefReducibility false in /-- Open sets in a topological space form a frame. -/ def frameMinimalAxioms : Frame.MinimalAxioms (Opens α) where inf_sSup_le_iSup_inf a s := From daec739c8a40bdc8d1275e7688a2d913ccccf23d Mon Sep 17 00:00:00 2001 From: leanprover-community-mathlib4-bot Date: Thu, 5 Mar 2026 15:13:23 +0000 Subject: [PATCH 14/33] Update lean-toolchain for https://github.com/leanprover/lean4/pull/12325 --- lake-manifest.json | 2 +- lean-toolchain | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index e96e4b8f2e116c..ea474e0f9ca145 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,7 +65,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "af6579e821f363ee97f10035dcf688ae7d349459", + "rev": "860cf811bc6d90f8ece22eb34aa601b2a1062894", "name": "batteries", "manifestFile": "lake-manifest.json", "inputRev": "lean-pr-testing-12325", diff --git a/lean-toolchain b/lean-toolchain index 86ea5f7d3e0f9a..150df0b5643e65 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4-pr-releases:pr-release-12325-32e1aa9 +leanprover/lean4-pr-releases:pr-release-12325-b00a659 From f147a6bccecefd0d23525d78d995e8a0202eadc9 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Thu, 5 Mar 2026 23:47:41 +0000 Subject: [PATCH 15/33] fix: remove set_option/implicit_reducible from Setoid-typed defs The new toolchain version of lean4#12325 exempts `Setoid` from the classDefReducibility warning, so these suppressions are no longer needed. Co-Authored-By: Claude Opus 4.6 --- Mathlib/GroupTheory/GroupAction/Defs.lean | 2 -- Mathlib/GroupTheory/GroupExtension/Basic.lean | 2 +- Mathlib/LinearAlgebra/Quotient/Defs.lean | 2 -- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Mathlib/GroupTheory/GroupAction/Defs.lean b/Mathlib/GroupTheory/GroupAction/Defs.lean index 0ef5c29fa28b4f..cc9f98fd378fc1 100644 --- a/Mathlib/GroupTheory/GroupAction/Defs.lean +++ b/Mathlib/GroupTheory/GroupAction/Defs.lean @@ -276,8 +276,6 @@ lemma mem_subgroup_orbit_iff {H : Subgroup G} {x : α} {a b : orbit G x} : variable (G α) --- adding `@[implicit_reducible]` causes downstream breakage -set_option warn.classDefReducibility false in /-- The relation 'in the same orbit'. -/ @[to_additive /-- The relation 'in the same orbit'. -/] def orbitRel : Setoid α where diff --git a/Mathlib/GroupTheory/GroupExtension/Basic.lean b/Mathlib/GroupTheory/GroupExtension/Basic.lean index ca3105cef08cc0..df1a5fed32cf62 100644 --- a/Mathlib/GroupTheory/GroupExtension/Basic.lean +++ b/Mathlib/GroupTheory/GroupExtension/Basic.lean @@ -202,7 +202,7 @@ theorem trans {s₁ s₂ s₃ : S.Splitting} (h₁ : S.IsConj s₁ s₂) (h₂ : exact ⟨n₁ * n₂, by simp only [hn₁, hn₂, map_mul]; group⟩ /-- The setoid of splittings with `N`-conjugacy -/ -@[to_additive (attr := implicit_reducible) /-- The setoid of splittings with `N`-conjugacy -/] +@[to_additive /-- The setoid of splittings with `N`-conjugacy -/] def setoid : Setoid S.Splitting where r := S.IsConj iseqv := diff --git a/Mathlib/LinearAlgebra/Quotient/Defs.lean b/Mathlib/LinearAlgebra/Quotient/Defs.lean index 0ad1aabb5d3b4a..d4d02890966599 100644 --- a/Mathlib/LinearAlgebra/Quotient/Defs.lean +++ b/Mathlib/LinearAlgebra/Quotient/Defs.lean @@ -37,8 +37,6 @@ variable (p p' : Submodule R M) open QuotientAddGroup --- adding `@[implicit_reducible]` causes downstream breakage -set_option warn.classDefReducibility false in /-- The equivalence relation associated to a submodule `p`, defined by `x ≈ y` iff `-x + y ∈ p`. Note this is equivalent to `y - x ∈ p`, but defined this way to be defeq to the `AddSubgroup` From d6d02d24d68edd150e2613589f90f7c95bc3e634 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Fri, 6 Mar 2026 00:38:44 +0000 Subject: [PATCH 16/33] fix: address classDefReducibility warnings in Archive Co-Authored-By: Claude Opus 4.6 --- Archive/Imo/Imo2019Q2.lean | 1 + Archive/MinimalSheffer.lean | 2 ++ 2 files changed, 3 insertions(+) diff --git a/Archive/Imo/Imo2019Q2.lean b/Archive/Imo/Imo2019Q2.lean index 4d0e81c7a68cd8..a626601d667650 100644 --- a/Archive/Imo/Imo2019Q2.lean +++ b/Archive/Imo/Imo2019Q2.lean @@ -96,6 +96,7 @@ structure Imo2019q2Cfg where C_ne_Q₁ : C ≠ Q₁ /-- A default choice of orientation, for lemmas that need to pick one. -/ +@[implicit_reducible] def someOrientation [hd2 : Fact (finrank ℝ V = 2)] : Module.Oriented ℝ V (Fin 2) := ⟨Basis.orientation (finBasisOfFinrankEq _ _ hd2.out)⟩ diff --git a/Archive/MinimalSheffer.lean b/Archive/MinimalSheffer.lean index 92c0c5f5625195..5eb903463f1085 100644 --- a/Archive/MinimalSheffer.lean +++ b/Archive/MinimalSheffer.lean @@ -46,6 +46,7 @@ class VeroffAlgebra (α : Type*) extends Inhabited α where variable {α : Type*} /-- Derive a Veroff algebra from a Boolean algebra. -/ +@[implicit_reducible] def BooleanAlgebra.veroffAlgebra [BooleanAlgebra α] : VeroffAlgebra α where default := ⊥ f a b := (a ⊓ b)ᶜ @@ -206,6 +207,7 @@ class SingleShefferAlgebra (α : Type*) extends Inhabited α where variable {α : Type*} /-- Derive a `SingleShefferAlgebra` from a Boolean algebra. -/ +@[implicit_reducible] def BooleanAlgebra.singleShefferAlgebra [BooleanAlgebra α] : SingleShefferAlgebra α where default := ⊥ f a b := (a ⊓ b)ᶜ From 858a3d5a14c870764c6462ed2f33337c4070a242 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Fri, 6 Mar 2026 01:15:01 +0000 Subject: [PATCH 17/33] fix: address classDefReducibility warnings in MathlibTest Co-Authored-By: Claude Opus 4.6 --- MathlibTest/DeriveFintype.lean | 3 +++ MathlibTest/MinImports.lean | 1 + MathlibTest/Simps.lean | 1 + MathlibTest/Subsingleton.lean | 1 + MathlibTest/ToDual.lean | 2 ++ MathlibTest/apply_with.lean | 1 + MathlibTest/toAdditive.lean | 2 ++ 7 files changed, 11 insertions(+) diff --git a/MathlibTest/DeriveFintype.lean b/MathlibTest/DeriveFintype.lean index 1515cb8909aae2..c4cc532c0516ef 100644 --- a/MathlibTest/DeriveFintype.lean +++ b/MathlibTest/DeriveFintype.lean @@ -134,14 +134,17 @@ inductive I' {α : Type _} `derive_fintype%` -/ +set_option warn.classDefReducibility false in def myBoolInst := derive_fintype% Bool example : Fintype Bool := myBoolInst +set_option warn.classDefReducibility false in def myBoolInst' : Fintype Bool := derive_fintype% _ example : Fintype Bool := myBoolInst' +set_option warn.classDefReducibility false in def myProdInst [Fintype α] [Fintype β] : Fintype (α × β) := derive_fintype% _ structure MySubtype (s : Set α) where diff --git a/MathlibTest/MinImports.lean b/MathlibTest/MinImports.lean index c6460f9037a70d..8398988f709606 100644 --- a/MathlibTest/MinImports.lean +++ b/MathlibTest/MinImports.lean @@ -26,6 +26,7 @@ namespace X /-- info: import Mathlib.Algebra.Ring.Nat -/ #guard_msgs in #min_imports in +set_option warn.classDefReducibility false in protected def xxx : Semiring Nat := inferInstance end X diff --git a/MathlibTest/Simps.lean b/MathlibTest/Simps.lean index baa81b5169bed0..b8a586392a7d71 100644 --- a/MathlibTest/Simps.lean +++ b/MathlibTest/Simps.lean @@ -1176,6 +1176,7 @@ initialize_simps_projections AddHomPlus2 (-myMul, myMul_toFun_toFun → mul) attribute [ext] Equiv' +set_option warn.classDefReducibility false in @[simps] def thing (h : Bool ≃ (Bool ≃ Bool)) : AddHomPlus2 (fun _ : ℕ ↦ Bool) := { myMul := diff --git a/MathlibTest/Subsingleton.lean b/MathlibTest/Subsingleton.lean index 4126aaf391ba06..cf327a1c5c6065 100644 --- a/MathlibTest/Subsingleton.lean +++ b/MathlibTest/Subsingleton.lean @@ -138,6 +138,7 @@ example {α : Type} [BEq α] (f : ∀ {β : Type} [BEq β], Subsingleton β) (x /-! The same, but now there's a universe level metavariable. -/ +set_option warn.classDefReducibility false in def fdef : ∀ {β : Type _} [BEq β], Subsingleton β := test_sorry example {α : Type} [BEq α] (x y : α) : x = y := by diff --git a/MathlibTest/ToDual.lean b/MathlibTest/ToDual.lean index 113c01f82ae401..bbe21f49e1a34c 100644 --- a/MathlibTest/ToDual.lean +++ b/MathlibTest/ToDual.lean @@ -169,9 +169,11 @@ def lt_sum_eq_of_le [DecidableLE α] {a b : α} (hab : a ≤ b) : a < b ⊕' a = b := if hba : b ≤ a then PSum.inr (le_antisymm hab hba) else PSum.inl (lt_of_le_not_ge hab hba) +set_option warn.classDefReducibility false in @[to_dual DecidableLE1_dual] def DecidableLE1 (h : ∀ a b : α, Decidable (a ≤ b)) : DecidableLE α := fun a b ↦ h a b +set_option warn.classDefReducibility false in @[to_dual DecidableLE2_dual] def DecidableLE2 (h : ∀ a b : α, Decidable (a ≤ b)) : DecidableLE α := id h diff --git a/MathlibTest/apply_with.lean b/MathlibTest/apply_with.lean index 3169a64c90452c..a7c96480e6e044 100644 --- a/MathlibTest/apply_with.lean +++ b/MathlibTest/apply_with.lean @@ -18,6 +18,7 @@ example (f : ∀ x : Nat, x = x → α) : α := by class Foo where val : Nat +set_option warn.classDefReducibility false in def foo : Foo where val := 37 diff --git a/MathlibTest/toAdditive.lean b/MathlibTest/toAdditive.lean index c8e4cb67dc8208..a33281326f2e07 100644 --- a/MathlibTest/toAdditive.lean +++ b/MathlibTest/toAdditive.lean @@ -267,9 +267,11 @@ def foo_mul {I J K : Type} (n : ℕ) {f : I → Type} (L : Type) [∀ i, One (f instance pi.has_one {I : Type} {f : I → Type} [(i : I) → One <| f i] : One ((i : I) → f i) := ⟨fun _ => 1⟩ +set_option warn.classDefReducibility false in @[to_additive] def nat_pi_has_one {α : Type} [One α] : One ((x : Nat) → α) := by infer_instance +set_option warn.classDefReducibility false in @[to_additive] def pi_nat_has_one {I : Type} : One ((x : I) → Nat) := pi.has_one From 4d08fa814ff357fd4f9f87977e3b8d1a5e10c7c4 Mon Sep 17 00:00:00 2001 From: "mathlib-nightly-testing[bot]" Date: Fri, 6 Mar 2026 18:49:24 +0000 Subject: [PATCH 18/33] chore: bump to nightly-2026-03-06 --- lean-toolchain | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lean-toolchain b/lean-toolchain index fd315255c53152..65ef5b757d1873 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-03-05 +leanprover/lean4:nightly-2026-03-06 From cc5e4e1ca4fac00d2b8cccd10449ecbafd5980a2 Mon Sep 17 00:00:00 2001 From: "mathlib-nightly-testing[bot]" Date: Sat, 7 Mar 2026 09:04:32 +0000 Subject: [PATCH 19/33] chore: bump to nightly-2026-03-07 --- lean-toolchain | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lean-toolchain b/lean-toolchain index 65ef5b757d1873..388919ac67593c 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-03-06 +leanprover/lean4:nightly-2026-03-07 From c64e602098bb0513e00120658f7df4ef0c0d0ff9 Mon Sep 17 00:00:00 2001 From: leanprover-community-mathlib4-bot Date: Sun, 8 Mar 2026 20:46:22 +0000 Subject: [PATCH 20/33] Update lean-toolchain for testing https://github.com/leanprover/lean4/pull/12841 --- lake-manifest.json | 4 ++-- lakefile.lean | 2 +- lean-toolchain | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index b5083d35a59ab6..95db04ec58bfab 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,10 +65,10 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "922c94b86687f3b7ab165d43ce9ddee610696d0c", + "rev": "d64dddccde0defdc7c01c3b760e77405f6fe8ffe", "name": "batteries", "manifestFile": "lake-manifest.json", - "inputRev": "nightly-testing", + "inputRev": "lean-pr-testing-12841", "inherited": false, "configFile": "lakefile.toml"}, {"url": "https://github.com/leanprover/lean4-cli", diff --git a/lakefile.lean b/lakefile.lean index 5aabb9deadeeb2..f6ed8e65de592b 100644 --- a/lakefile.lean +++ b/lakefile.lean @@ -6,7 +6,7 @@ open Lake DSL ## Mathlib dependencies on upstream projects -/ -require "leanprover-community" / "batteries" @ git "nightly-testing" +require "leanprover-community" / "batteries" @ git "lean-pr-testing-12841" require "leanprover-community" / "Qq" @ git "nightly-testing" require "leanprover-community" / "aesop" @ git "nightly-testing" require "leanprover-community" / "proofwidgets" @ git "v0.0.92-pre1" -- ProofWidgets should always be pinned to a specific version diff --git a/lean-toolchain b/lean-toolchain index fd315255c53152..0fa536a0c04363 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-03-05 +leanprover/lean4-pr-releases:pr-release-12841-fea9418 From a81f3f58b58629c25f3ae75d42b335d89aefdf05 Mon Sep 17 00:00:00 2001 From: leanprover-community-mathlib4-bot Date: Sun, 8 Mar 2026 23:57:27 +0000 Subject: [PATCH 21/33] Update lean-toolchain for https://github.com/leanprover/lean4/pull/12841 --- lake-manifest.json | 2 +- lean-toolchain | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index 95db04ec58bfab..020c6ce5dbca1d 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -65,7 +65,7 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "d64dddccde0defdc7c01c3b760e77405f6fe8ffe", + "rev": "52c1477b2a0a320d3f913a043da6bd85c45cc13f", "name": "batteries", "manifestFile": "lake-manifest.json", "inputRev": "lean-pr-testing-12841", diff --git a/lean-toolchain b/lean-toolchain index 0fa536a0c04363..dac537a9f0b059 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4-pr-releases:pr-release-12841-fea9418 +leanprover/lean4-pr-releases:pr-release-12841-ad8fa9c From 93efe7e3a56b649b0085021bd6fa1e1d3b65304f Mon Sep 17 00:00:00 2001 From: Kyle Miller Date: Sun, 8 Mar 2026 17:46:44 -0700 Subject: [PATCH 22/33] fix --- Mathlib/Tactic/Translate/Core.lean | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Mathlib/Tactic/Translate/Core.lean b/Mathlib/Tactic/Translate/Core.lean index 44c0acd8a05b5d..c8fc6b74c6499e 100644 --- a/Mathlib/Tactic/Translate/Core.lean +++ b/Mathlib/Tactic/Translate/Core.lean @@ -299,14 +299,14 @@ structure Config : Type where /-- The given name of the target. -/ tgt : Name := Name.anonymous /-- An optional doc string. -/ - doc : Option String := none + doc : Option String := .none /-- If `allowAutoName` is `false` (default) then we check whether the given name can be auto-generated. -/ allowAutoName : Bool := false /-- The arguments that should be reordered when translating, using cycle notation. -/ - reorder? : Option Reorder := none + reorder? : Option Reorder := .none /-- The argument used to determine whether this constant should be translated. -/ - relevantArg? : Option RelevantArg := none + relevantArg? : Option RelevantArg := .none /-- The attributes which we want to give to the original and translated declaration. For `simps` this will also add generated lemmas to the translation dictionary. -/ attrs : Array Syntax := #[] From 9e6b5401b14535c8b625887e26bf6f81d2f877e9 Mon Sep 17 00:00:00 2001 From: "mathlib-nightly-testing[bot]" Date: Mon, 9 Mar 2026 09:15:47 +0000 Subject: [PATCH 23/33] chore: bump to nightly-2026-03-09 --- lean-toolchain | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lean-toolchain b/lean-toolchain index 388919ac67593c..a07c58f5e4e07a 100644 --- a/lean-toolchain +++ b/lean-toolchain @@ -1 +1 @@ -leanprover/lean4:nightly-2026-03-07 +leanprover/lean4:nightly-2026-03-09 From 56d241b98030f68fdb2e1e0752b9111449ca70be Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Tue, 10 Mar 2026 00:55:01 +0000 Subject: [PATCH 24/33] =?UTF-8?q?fix:=20isStructureLike=20=E2=86=92=20isSt?= =?UTF-8?q?ructure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adapts to https://github.com/leanprover/lean4/pull/12749 Co-Authored-By: Claude Opus 4.6 --- Mathlib/Tactic/DefEqTransformations.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/Tactic/DefEqTransformations.lean b/Mathlib/Tactic/DefEqTransformations.lean index 8cf395eb1e2cc0..94d36c226bbe5d 100644 --- a/Mathlib/Tactic/DefEqTransformations.lean +++ b/Mathlib/Tactic/DefEqTransformations.lean @@ -309,7 +309,7 @@ def etaStruct? (e : Expr) (tryWhnfR : Bool := true) : MetaM (Option Expr) := do let .const f _ := e.getAppFn | return none let some (ConstantInfo.ctorInfo fVal) := (← getEnv).find? f | return none unless 0 < fVal.numFields && e.getAppNumArgs == fVal.numParams + fVal.numFields do return none - unless isStructureLike (← getEnv) fVal.induct do return none + unless isStructure (← getEnv) fVal.induct do return none let args := e.getAppArgs let mut x? ← findProj fVal args pure if tryWhnfR then From feebe0fb4109d8d8fbc2bb4f36a2400e57d18b57 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Tue, 10 Mar 2026 01:10:36 +0000 Subject: [PATCH 25/33] chore: update plausible to nightly-testing (lean4#12325 adaptations) Co-Authored-By: Claude Opus 4.6 --- lake-manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lake-manifest.json b/lake-manifest.json index fee2ac44758dad..dc38ffed83c002 100644 --- a/lake-manifest.json +++ b/lake-manifest.json @@ -5,10 +5,10 @@ "type": "git", "subDir": null, "scope": "leanprover-community", - "rev": "650d4104daeb660ff3cc46715602a664504e7785", + "rev": "c7314e41459a8c0aa8c9b610748c72292851625d", "name": "plausible", "manifestFile": "lake-manifest.json", - "inputRev": "main", + "inputRev": "nightly-testing", "inherited": false, "configFile": "lakefile.toml"}, {"url": "https://github.com/leanprover-community/LeanSearchClient", From ed9f3fe334ce700653807a2414140d93a943c18f Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Tue, 10 Mar 2026 01:11:08 +0000 Subject: [PATCH 26/33] fix merge --- Mathlib/Data/ENat/Basic.lean | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Mathlib/Data/ENat/Basic.lean b/Mathlib/Data/ENat/Basic.lean index ae4a909f58ccbd..3b903c1a2922b5 100644 --- a/Mathlib/Data/ENat/Basic.lean +++ b/Mathlib/Data/ENat/Basic.lean @@ -129,7 +129,6 @@ def lift (x : ℕ∞) (h : x < ⊤) : ℕ := WithTop.untop x (WithTop.lt_top_iff @[simp] theorem add_lt_top {a b : ℕ∞} : a + b < ⊤ ↔ a < ⊤ ∧ b < ⊤ := WithTop.add_lt_top -set_option backward.isDefEq.respectTransparency false in @[simp] theorem lift_add (a b : ℕ∞) (h : a + b < ⊤) : lift (a + b) h = lift a (add_lt_top.1 h).1 + lift b (add_lt_top.1 h).2 := by apply coe_inj.1 @@ -266,7 +265,6 @@ theorem toNat_sub {n : ℕ∞} (hn : n ≠ ⊤) (m : ℕ∞) : toNat (m - n) = t · rw [top_sub_coe, toNat_top, zero_tsub] · rw [← coe_sub, toNat_coe, toNat_coe, toNat_coe] -set_option backward.isDefEq.respectTransparency false in @[simp] theorem toNat_mul (a b : ℕ∞) : (a * b).toNat = a.toNat * b.toNat := by cases a <;> cases b · simp @@ -346,7 +344,6 @@ theorem nat_induction {motive : ℕ∞ → Prop} (a : ℕ∞) (zero : motive 0) lemma add_one_pos : 0 < n + 1 := succ_def n ▸ Order.bot_lt_succ n -set_option backward.isDefEq.respectTransparency false in lemma natCast_lt_succ {n : ℕ} : (n : ℕ∞) < (n : ℕ∞) + 1 := by rw [← Nat.cast_one, ← Nat.cast_add, coe_lt_coe] @@ -439,7 +436,6 @@ lemma self_le_mul_left (a : ℕ∞) (hc : c ≠ 0) : a ≤ c * a := by rw [mul_comm] exact ENat.self_le_mul_right a hc -set_option backward.isDefEq.respectTransparency false in instance : Unique ℕ∞ˣ where uniq x := by have := x.val_inv @@ -466,7 +462,6 @@ lemma add_one_natCast_le_withTop_of_lt {m : ℕ} {n : WithTop ℕ∞} (h : m < n @[simp] lemma coe_top_add_one : ((⊤ : ℕ∞) : WithTop ℕ∞) + 1 = (⊤ : ℕ∞) := rfl -set_option backward.isDefEq.respectTransparency false in @[simp] lemma add_one_eq_coe_top_iff {n : WithTop ℕ∞} : n + 1 = (⊤ : ℕ∞) ↔ n = (⊤ : ℕ∞) := by match n with | ⊤ => exact Iff.rfl @@ -613,16 +608,16 @@ lemma map_natCast_mul {R : Type*} [NonAssocSemiring R] [DecidableEq R] [CharZero end ENat -set_option backward.isDefEq.respectTransparency false in -lemma WithBot.lt_add_one_iff {n : WithBot ℕ∞} {m : ℕ} : n < m + 1 ↔ n ≤ m := by +namespace ENat.WithBot + +lemma lt_add_one_iff {n : WithBot ℕ∞} {m : ℕ} : n < m + 1 ↔ n ≤ m := by rw [← WithBot.coe_one, ← ENat.coe_one, WithBot.coe_natCast, ← Nat.cast_add, ← WithBot.coe_natCast] cases n · simp only [bot_le, WithBot.bot_lt_coe] · rw [WithBot.coe_lt_coe, Nat.cast_add, ENat.coe_one, ENat.lt_add_one_iff (ENat.coe_ne_top _), ← WithBot.coe_le_coe, WithBot.coe_natCast] -set_option backward.isDefEq.respectTransparency false in -lemma WithBot.add_one_le_iff {n : ℕ} {m : WithBot ℕ∞} : n + 1 ≤ m ↔ n < m := by +lemma add_one_le_iff {n : ℕ} {m : WithBot ℕ∞} : n + 1 ≤ m ↔ n < m := by rw [← WithBot.coe_one, ← ENat.coe_one, WithBot.coe_natCast, ← Nat.cast_add, ← WithBot.coe_natCast] cases m · simp From 49f86939639177ee096da3f6715353ee88196297 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Tue, 10 Mar 2026 01:11:49 +0000 Subject: [PATCH 27/33] implicit_reducible warning --- Mathlib/CategoryTheory/Monoidal/Grp_.lean | 1 + 1 file changed, 1 insertion(+) diff --git a/Mathlib/CategoryTheory/Monoidal/Grp_.lean b/Mathlib/CategoryTheory/Monoidal/Grp_.lean index ba74650fb996d2..53d67fa6c22694 100644 --- a/Mathlib/CategoryTheory/Monoidal/Grp_.lean +++ b/Mathlib/CategoryTheory/Monoidal/Grp_.lean @@ -303,6 +303,7 @@ lemma ext {X : C} (h₁ h₂ : GrpObj X) (H : h₁.toMonObj = h₂.toMonObj) : h set_option backward.isDefEq.respectTransparency false in /-- A monoid object with invertible homs is a group object. -/ +@[implicit_reducible] def ofInvertible (G : C) [CartesianMonoidalCategory C] [MonObj G] (h : ∀ X (f : X ⟶ G), Invertible f) : GrpObj G where inv := Yoneda.fullyFaithful.preimage ⟨fun X f ↦ (h X.unop f).invOf, fun X Y f ↦ by From 795e3ac329096ebc80f0571a0012cd1d6477ad24 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Tue, 10 Mar 2026 01:27:27 +0000 Subject: [PATCH 28/33] fix merge --- Mathlib/Algebra/Star/RingQuot.lean | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mathlib/Algebra/Star/RingQuot.lean b/Mathlib/Algebra/Star/RingQuot.lean index 8e01fb1d47c600..732c9d167e8ede 100644 --- a/Mathlib/Algebra/Star/RingQuot.lean +++ b/Mathlib/Algebra/Star/RingQuot.lean @@ -42,8 +42,8 @@ private def star' (hr : ∀ a b, r a b → r (star a) (star b)) : RingQuot r → private theorem star'_quot (hr : ∀ a b, r a b → r (star a) (star b)) {a} : (star' r hr ⟨Quot.mk _ a⟩ : RingQuot r) = ⟨Quot.mk _ (star a)⟩ := rfl -@[implicit_reducible] /-- Transfer a `StarRing` instance through a quotient, if the quotient is invariant to `star` -/ +@[implicit_reducible] def starRing {R : Type u} [Semiring R] [StarRing R] (r : R → R → Prop) (hr : ∀ a b, r a b → r (star a) (star b)) : StarRing (RingQuot r) where star := star' r hr From e14778e4ea7293349a427b02dd2135d437fc2e06 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Tue, 10 Mar 2026 01:30:43 +0000 Subject: [PATCH 29/33] more implict_reducible --- Mathlib/Analysis/Normed/Unbundled/SpectralNorm.lean | 3 +++ Mathlib/CategoryTheory/Sites/Point/Basic.lean | 1 + Mathlib/NumberTheory/ModularForms/SlashActions.lean | 1 + Mathlib/RingTheory/Valuation/Discrete/RankOne.lean | 1 + Mathlib/RingTheory/Valuation/RankOne.lean | 2 ++ 5 files changed, 8 insertions(+) diff --git a/Mathlib/Analysis/Normed/Unbundled/SpectralNorm.lean b/Mathlib/Analysis/Normed/Unbundled/SpectralNorm.lean index f15ecd94770dd5..24831682b19981 100644 --- a/Mathlib/Analysis/Normed/Unbundled/SpectralNorm.lean +++ b/Mathlib/Analysis/Normed/Unbundled/SpectralNorm.lean @@ -894,6 +894,7 @@ def nontriviallyNormedField [CompleteSpace K] : NontriviallyNormedField L where ⟨algebraMap K L x, hx.trans_eq <| (spectralNorm_extends _).symm⟩ /-- `L` with the spectral norm is a `SeminormedRing`. -/ +@[implicit_reducible] def seminormedRing : SeminormedRing L := by letI : NormedField L := normedField K L infer_instance @@ -920,6 +921,7 @@ def normedSpace : @NormedSpace K L _ (seminormedAddCommGroup K L) := exact le_of_eq (map_smul_eq_mul _ _ _) } /-- `L` with the spectral norm is a `NormedAlgebra` over `K`. -/ +@[implicit_reducible] def normedAlgebra : @NormedAlgebra K L _ (seminormedRing K L) := letI _ := normedField K L @@ -928,6 +930,7 @@ def normedAlgebra : set_option backward.isDefEq.respectTransparency false in /-- `L` with the spectral norm is a `NormedAlgebra` over any intermediate `E` that is a normed algebra over `K`. -/ +@[implicit_reducible] def normedAlgebra' (E L : Type*) [Field L] [Algebra K L] [Algebra.IsAlgebraic K L] [NormedField E] [NormedAlgebra K E] [Algebra E L] [IsScalarTower K E L] : @NormedAlgebra E L _ (seminormedRing K L) := diff --git a/Mathlib/CategoryTheory/Sites/Point/Basic.lean b/Mathlib/CategoryTheory/Sites/Point/Basic.lean index a325f616963fc1..3c9ef9f1b2645f 100644 --- a/Mathlib/CategoryTheory/Sites/Point/Basic.lean +++ b/Mathlib/CategoryTheory/Sites/Point/Basic.lean @@ -298,6 +298,7 @@ noncomputable def isTerminalFiberObj (T : C) (hT : IsTerminal T) : IsTerminal.isTerminalObj _ _ hT /-- The fiber of the terminal object contains a unique element. -/ +@[implicit_reducible] noncomputable def uniqueFiberObj (T : C) (hT : IsTerminal T) : Unique (Φ.fiber.obj T) := Types.isTerminalEquivUnique _ (Φ.isTerminalFiberObj T hT) diff --git a/Mathlib/NumberTheory/ModularForms/SlashActions.lean b/Mathlib/NumberTheory/ModularForms/SlashActions.lean index b4cad7b28418a2..e705d7707f1ba9 100644 --- a/Mathlib/NumberTheory/ModularForms/SlashActions.lean +++ b/Mathlib/NumberTheory/ModularForms/SlashActions.lean @@ -61,6 +61,7 @@ attribute [simp] SlashAction.zero_slash SlashAction.slash_one SlashAction.add_sl | insert i t hi IH => simp [hi, IH] /-- `SlashAction` induced by a monoid homomorphism. -/ +@[implicit_reducible] def monoidHomSlashAction {β G H α : Type*} [Monoid G] [AddMonoid α] [Monoid H] [SlashAction β G α] (h : H →* G) : SlashAction β H α where map k g := SlashAction.map k (h g) diff --git a/Mathlib/RingTheory/Valuation/Discrete/RankOne.lean b/Mathlib/RingTheory/Valuation/Discrete/RankOne.lean index 1d37d497a1cd26..b00702a868aa20 100644 --- a/Mathlib/RingTheory/Valuation/Discrete/RankOne.lean +++ b/Mathlib/RingTheory/Valuation/Discrete/RankOne.lean @@ -105,6 +105,7 @@ lemma valueGroup₀_equiv_withZeroMulInt_restrict_apply_of_surjective (hsurj : F simp [WithZero.exp] /-- A discrete valuation has rank one. -/ +@[implicit_reducible] noncomputable def rankOne (v : Valuation K Γ) [hv : v.IsRankOneDiscrete] {e : ℝ≥0} (he : 1 < e) : v.RankOne where hom' := (toNNReal (ne_of_gt (lt_trans zero_lt_one he))).comp (valueGroup₀_equiv_withZeroMulInt v) diff --git a/Mathlib/RingTheory/Valuation/RankOne.lean b/Mathlib/RingTheory/Valuation/RankOne.lean index 292698879c11cd..3a4a257ba88b9b 100644 --- a/Mathlib/RingTheory/Valuation/RankOne.lean +++ b/Mathlib/RingTheory/Valuation/RankOne.lean @@ -173,6 +173,7 @@ variable {K : Type*} [DivisionRing K] (v : Valuation K Γ₀) [RankLeOne v] /-- If a valuation has rank at most one and is non trivial, then it has rank one -/ +@[implicit_reducible] def rankOne_of_exists (H : ∃ x ≠ 0, v x ≠ 1) : RankOne v where exists_val_nontrivial := by by_contra H' @@ -182,6 +183,7 @@ def rankOne_of_exists (H : ∃ x ≠ 0, v x ≠ 1) : RankOne v where /-- If a valuation has rank at most one and is non trivial, then it has rank one -/ +@[implicit_reducible] def rankOne_of_nontrivial (H : Nontrivial (ValueGroup₀ v)ˣ) : RankOne v where exists_val_nontrivial := by by_contra H' From 5375d4f3d1695c5f9509c8137e976f6287c6d361 Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Tue, 10 Mar 2026 01:33:56 +0000 Subject: [PATCH 30/33] simplify proof --- Mathlib/NumberTheory/ModularForms/Delta.lean | 1 - 1 file changed, 1 deletion(-) diff --git a/Mathlib/NumberTheory/ModularForms/Delta.lean b/Mathlib/NumberTheory/ModularForms/Delta.lean index 135e104d5577de..012c669e2b9dae 100644 --- a/Mathlib/NumberTheory/ModularForms/Delta.lean +++ b/Mathlib/NumberTheory/ModularForms/Delta.lean @@ -88,7 +88,6 @@ lemma logDeriv_eta_comp_eq_logDeriv_csqrt_eta (z : ℍ) : grind [I_sq] · rw [div_mul_eq_mul_div₀ _ _ (2 : ℂ), neg_div, cpow_neg, ← mul_inv, ← cpow_add _ _ z.ne_zero] norm_num - exact (cpow_one _).symm lemma eta_comp_eqOn_const_mul_csqrt_eta : ∃ c : ℂ, c ≠ 0 ∧ upperHalfPlaneSet.EqOn (η ∘ (fun z : ℂ ↦ -1 / z)) (c • (sqrt * η)) := by From c04eb92efd84c9f17f86605d2098e8cf04962147 Mon Sep 17 00:00:00 2001 From: Kim Morrison <477956+kim-em@users.noreply.github.com> Date: Tue, 10 Mar 2026 19:17:32 +1100 Subject: [PATCH 31/33] Apply suggestion from @kim-em --- Mathlib/Algebra/Algebra/ZMod.lean | 1 - 1 file changed, 1 deletion(-) diff --git a/Mathlib/Algebra/Algebra/ZMod.lean b/Mathlib/Algebra/Algebra/ZMod.lean index 4f774cc47a6887..c4d63858a1e73b 100644 --- a/Mathlib/Algebra/Algebra/ZMod.lean +++ b/Mathlib/Algebra/Algebra/ZMod.lean @@ -49,7 +49,6 @@ abbrev algebra (p : ℕ) [CharP R p] : Algebra (ZMod p) R := set_option backward.isDefEq.respectTransparency false in /-- Any ring with a `ZMod p`-module structure can be upgraded to a `ZMod p`-algebra. Not an -@[implicit_reducible] instance because this is usually not the default way, and this will cause typeclass search loop. -/ @[implicit_reducible] def algebraOfModule (n : ℕ) (R : Type*) [Ring R] [Module (ZMod n) R] : Algebra (ZMod n) R := From 8bbcc56b3410b1522cbd33383a6a22ef96b21155 Mon Sep 17 00:00:00 2001 From: Kim Morrison <477956+kim-em@users.noreply.github.com> Date: Tue, 10 Mar 2026 19:17:50 +1100 Subject: [PATCH 32/33] Apply suggestion from @kim-em --- Mathlib/Control/Traversable/Equiv.lean | 1 - 1 file changed, 1 deletion(-) diff --git a/Mathlib/Control/Traversable/Equiv.lean b/Mathlib/Control/Traversable/Equiv.lean index 7943e2c36207e9..592ad08403c948 100644 --- a/Mathlib/Control/Traversable/Equiv.lean +++ b/Mathlib/Control/Traversable/Equiv.lean @@ -102,7 +102,6 @@ theorem traverse_def (f : α → m β) (x : t' α) : rfl /-- The function `Equiv.traverse` transfers a traversable functor -@[implicit_reducible] instance across the equivalences `eqv`. -/ @[implicit_reducible] protected def traversable : Traversable t' where From c7ac5a14aee27c36b1b9fc50655b9c378b52f4c0 Mon Sep 17 00:00:00 2001 From: Kim Morrison <477956+kim-em@users.noreply.github.com> Date: Tue, 10 Mar 2026 19:18:38 +1100 Subject: [PATCH 33/33] Apply suggestion from @kim-em --- Mathlib/Topology/Order/Basic.lean | 1 - 1 file changed, 1 deletion(-) diff --git a/Mathlib/Topology/Order/Basic.lean b/Mathlib/Topology/Order/Basic.lean index c96ea7289bac5e..411f62900e27c8 100644 --- a/Mathlib/Topology/Order/Basic.lean +++ b/Mathlib/Topology/Order/Basic.lean @@ -73,7 +73,6 @@ class OrderTopology (α : Type*) [t : TopologicalSpace α] [Preorder α] : Prop /-- (Order) topology on a partial order `α` generated by the subbase of open intervals `(a, ∞) = { x ∣ a < x }, (-∞, b) = {x ∣ x < b}` for all `a, b` in `α`. We do not register it as an -@[implicit_reducible] instance as many ordered sets are already endowed with the same topology, most often in a non-defeq way though. Register as a local instance when necessary. -/ @[implicit_reducible]