[CONFLICT] Sync upstream mathlib4 (2026-05-14)#8
Conversation
…q abuse (#38029) At the moment, many proofs use the numeric dot notation on arguments of the form `(hp : p ∈ I.minimalPrimes)` to access the proof of `p.IsPrime` and the proof that `I` is contained in `p`. In this PR we introduce a predicate `Ideal.IsMinimalPrime` and provide two API lemmas to get rid of this pattern. In a follow-up PR we refactor the remaining lemmas taking an assumption `(hp : p ∈ I.minimalPrimes)` and replace it by `I.IsMinimalPrime p`.
…IsBotZeroClass` (#39060)
As mentioned here https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/support.20of.20permutations.20on.20Type.20instead.20of.20Fintype/with/593547821 I misdiagnosed the issue in that thread, and this PR only fixes one of the issues. The "issue" in this case was that the lemma `cycleType_ofSubtype` contains a non-variable instance of `Fintype (Subtype p)`, which means that when applying the lemma, the "wrong" instance could be picked. The correct pattern is that if a lemma requires `Fintype _`, then it should be stated *explicitly* in the type, even if that instance is derivable from other hypotheses. (An existing example is https://leanprover-community.github.io/mathlib4_docs/Mathlib/Data/Fintype/Sets.html#Set.toFinset_union).
…9179) - refactors `Mathlib/MeasureTheory/Measure/Sub` by shortening `sub_le_iff_le_add_of_le` Extracted from #38104 [](https://gitpod.io/from-referrer/)
…composition/Lebesgue` (#39180) - refactors `Mathlib/MeasureTheory/VectorMeasure/Decomposition/Lebesgue` by simplifying `singularPart_mutuallySingular` and `singularPart_neg` Extracted from #38104 [](https://gitpod.io/from-referrer/)
This PR renames the internal namespace to `Mathlib.CrossRef`, factors out a shared `addCrossRefDoc` helper, and replaces hardcoded database strings with `databaseName`/`databaseURL` lookups so further databases can be added with minimal duplication. Drive-by: `#kerodon_tags` now prints "Kerodon Tag" instead of "Stacks Tag". Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This PR updates the Mathlib dependencies.
Basic API lemmas for `List.bagInter` and correct a few misnamed lemmas. Co-authored-by: Aristotle (Harmonic) <aristotle-harmonic@harmonic.fun>
After #39261, the only remaining files are fun_prop2.lean and fun_prop_dev.lean. Rename them to something more telling, and make them UpperCamelCase while at it. (The latter is mathlib's policy for module names anyway.)
…athlib (#39306) Follow-up to #39085. The cache doesn't contain oleans for Archive and Counterexamples so we need to run `lake build`. Also upload the `explain.txt` in case of workflow failure for better diagnostics, and post Zulip messages to the new `nightly-testing-mathlib` stream.
…e Cauchy-Schwarz inequality (#39268) The hypothesis `∀ i ∈ s, r i ^ 2 = f i * g i` in the Cauchy-Schwarz inequality `sum_sq_le_sum_mul_sum_of_sq_eq_mul` can be weakened. We only need `∀ i ∈ s, r i ^ 2 ≤ f i * g i`.
… (#37850) This PR introduces two simprocs `eqComm` and `iffComm` that can use `@[simp]` lemmas on symmetrical forms of an expression: if we have a simp lemma saying `f a = b ↔ a = g b` and the goal contains `b = f a`, then we would end up with `g b = a`. I developed these in #36534. Enabling them globally proved to be quite slow (+0,44% overall build time, which corresponds to +5% `simp`ing time), so this PR only declares them (and enables them locally, using e.g. `simp [eqComm]`, when we see that it pays off in the proof). Co-authored-by: Anne C.A. Baanen <vierkantor@vierkantor.com>
…c notation (#38359)
…toCommRing (#39263) This instance always applies, and is unlikely to be the right answer in practice.
…alIdeal` (#39292)
`RationalMap.toPartialMap` only needs reduced, not integral.
…cation (#39312) Module `SmoothSection` has been deprecated in favour of `ContMDiffSection` - see #39272.
…(#38555) Define `OrderEmbedding.id` and `OrderEmbedding.comp`, and add missing associativity lemmas for `OrderHom` and `OrderIso`.
This PR adds a Wikidata cross-reference attribute alongside the existing Stacks and Kerodon ones, accepting identifiers of the form `QN+`, plus a `#wikidata_tags`/`#wikidata_tags!` trace command. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Turns out they can't be shaken because thy're not modulized yet.
Move `RationalMap.lean` into a new subdirectory `Birational/`. This is in preparation for my other PR's on birational geometry. I will follow this up with a module deprecation in a separate PR.
…on (#38406) Removes a `[Nonempty M]` assumption by slightly modifying two proofs.
Follow-up to #39096. Without this comment, the import gets `shake`n, which causes a linting error: https://github.com/leanprover-community/mathlib4/actions/runs/25820802726/job/75861222173?pr=39155#step:2:398 I searched for other imports of `Mathlib.Tactic.Linter.Header` and copied the variant that seemed to be the most commonly used.
Was "`(R ○ S) a c ↔ ∃ b, a ~[R] b ∧ b ~[S] z`", changed to "`(R ○ S) a c ↔ ∃ b, a ~[R] b ∧ b ~[S] c`" (`z` -> `c`)
… (#39319) Rename `CoFG.cofg_of_le` to `CoFG.of_le` Co-authored-by: faenuccio <filippo.nuccio@univ-st-etienne.fr> Co-authored-by: Anatole Dedecker <anatolededecker@gmail.com>
…39343) Rename the existing `SeparationQuotient.continuous_lift` (which is an iff) to `continuous_lift_iff`, and add an alias for the converse direction. Use this to golf a proof using fun_prop. Extracted from #39337.
- Migrate some lemmas from `DiscreteTopology (_ : Set _)` to `IsDiscrete`. - Generalize `mem_codiscrete_subtype_iff_mem_codiscreteWithin` to a topological embedding. - Add lemmas about `codiscreteWithin` for a compact set and `codiscrete` for a compact space.
We already have the `Fintype` instances. I take the liberty of moving these into namespaces in order to produce nicer auto-generated instance names.
…ally complete lattices (#39104) The motivation for this PR is to show that if a random variable is in $L^\infty$, then so is it conditional expectation (proved in #36888). Created with the help of Codex.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8fb9087. Configure here.
| default: 455d84939bba1fbe157ff2c1469a0c258372d05c | ||
| >>>>>>> upstream/master | ||
| ======= | ||
| default: 78f34ded6a5f5aa11ea5b7c3120fe5d8422db1da |
There was a problem hiding this comment.
Unresolved nested merge conflict markers in YAML action
High Severity
The file contains nested git merge conflict markers (<<<<<<< HEAD, =======, >>>>>>> upstream/master), making it invalid YAML. This breaks the get-mathlib-ci composite action — any workflow referencing this action will fail to parse the default value for the ref input. The outer conflict markers are newly introduced by this commit on top of pre-existing inner conflict markers, resulting in a doubly-conflicted file that needs manual resolution.
Reviewed by Cursor Bugbot for commit 8fb9087. Configure here.


Automated daily sync from
leanprover-community/mathlib4@master.e9da88d74d4f24032858100ad765d947c57e94a0The merge commit on this branch contains conflict markers, so CI will fail
and auto-merge will not run. Resolve manually:
Files with conflict markers
Note
High Risk
High risk due to changes in core simp/meta tooling (
Simp.withoutTheorems,eqCommsimproc, new simp attrs) and broad foundational refactors, plus an unresolved conflict marker in.github/actions/get-mathlib-ci/action.ymlthat will break CI until fixed.Overview
Pulls in an upstream snapshot with broad library updates, including new modules
Analysis/Complex/BranchLogRoot,RingTheory/LocalRing/MaximalIdeal/Square, and a deprecated shimGeometry/Manifold/VectorBundle/SmoothSection, plus correspondingMathlib.leanimport updates.Refactors algebraic foundations: lowers instance priority for
EuclideanDomain.toCommRing, generalizesSubmodule/LinearMap.restrictto→ₛₗ, replaces severalCanonicallyOrderedAddrequirements withIsBotZeroClassand addsIsBotZeroClass/OrderBotinstances forFinsupp/DFinsupp(andLex/Colex), and introduces anIdeal.IsMinimalPrimeAPI with widespread updates fromh.1.1-style projections toh.isPrime/h.le.Adds new simp/meta infrastructure:
Lean/Meta/Simp.leangainsSimp.withoutTheorems,Logic/Basic.leanaddseqComm/iffCommsimprocs, andTactic/Attr/Register.leanregisterspull_end/push_endsimpsets; many lemmas are updated to use these (eqComm,pull_end) and some old simp lemmas are deprecated.CI/automation changes include a new scheduled/manual
shakeGitHub workflow that runslake shake --fixand opens a PR + posts to Zulip, and theget-mathlib-cicomposite action currently contains unresolved merge conflict markers that must be resolved for CI to pass.Reviewed by Cursor Bugbot for commit 8fb9087. Bugbot is set up for automated code reviews on this repo. Configure here.