Skip to content

Commit dd06748

Browse files
Merge master into nightly-testing
2 parents 1cdfd83 + 542645a commit dd06748

177 files changed

Lines changed: 3127 additions & 1151 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/get-mathlib-ci/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ inputs:
1010
# Default pinned commit used by workflows unless they explicitly override.
1111
# Update this ref as needed to pick up changes to mathlib-ci scripts
1212
# This is also updated automatically by .github/workflows/update_dependencies.yml
13-
default: 06beacf5884fb7242468c573c8fede0095552b53
13+
default: e7a159e9a129f92fd07e6852a742485798678473
1414
path:
1515
description: Checkout destination path.
1616
required: false

.github/workflows/PR_summary.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ jobs:
2222
ref: ${{ github.event.pull_request.head.sha }}
2323
fetch-depth: 0
2424
path: pr-branch
25+
# Untrusted (potentially fork) checkout: don't persist the GITHUB_TOKEN into its .git/config.
26+
persist-credentials: false
2527

2628
- name: Checkout local actions
2729
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

.github/workflows/add_label_from_diff.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ jobs:
4343
ref: ${{ github.event.pull_request.head.sha || github.sha }}
4444
fetch-depth: 0
4545
path: pr-branch
46+
# Untrusted (potentially fork) checkout: don't persist the GITHUB_TOKEN into its .git/config.
47+
persist-credentials: false
4648
- name: Run autolabel
4749
working-directory: pr-branch
4850
run: |

.github/workflows/bot_fix_style.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ on:
1212
# triggers on a review comment
1313
types: [created, edited]
1414

15+
# `lint-style-action` in `fix` mode pushes a style-fix commit and reacts/comments
16+
# on the PR. Grant exactly those scopes rather than inheriting the default token
17+
# permissions; all other scopes are implicitly 'none'.
18+
permissions:
19+
contents: write # push the style-fix commit to the PR branch
20+
pull-requests: write # add the bot's reaction/comment
21+
issues: write # PR comment reactions go through the issues API
22+
1523
jobs:
1624
fix_style:
1725
# we set some variables. The ones of the form `${{ X }}${{ Y }}` are typically not

.github/workflows/build_template.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ jobs:
127127
ref: ${{ inputs.pr_branch_ref }}
128128
fetch-depth: 2 # we may fetch cache from the commit before this one (or earlier)
129129
path: pr-branch
130+
# This is an untrusted (potentially fork) checkout whose code we build.
131+
# Don't leave the GITHUB_TOKEN in pr-branch/.git/config, where that code could read it.
132+
persist-credentials: false
130133

131134
- name: Prepare DownstreamTest directory
132135
shell: bash
@@ -689,6 +692,8 @@ jobs:
689692
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
690693
with:
691694
ref: ${{ inputs.pr_branch_ref }}
695+
# Untrusted (potentially fork) checkout: don't persist the GITHUB_TOKEN into its .git/config.
696+
persist-credentials: false
692697

693698
- name: Configure Lean
694699
uses: leanprover/lean-action@38fbc41a8c28c4cbaec22d7f7de508ec2e7c0dd9 # v1.5.0

.github/workflows/decls-diff.yml

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
# Post-build workflow that emits a Lean-aware declarations-diff in the Actions
2+
# step summary for each successful PR build. Consumes the `import-graph`
3+
# artifact uploaded by `build_template.yml` on both sides (PR head + master
4+
# merge-base) and computes the diff via mathlib-ci's `decls-diff` action.
5+
#
6+
# Stage-2 scope: visibility only. No `### PR summary` comment patching; that
7+
# behaviour ships in a follow-up PR.
8+
9+
name: Declarations diff (post-build)
10+
11+
on:
12+
workflow_run:
13+
# Match the build workflows by their `name:` — `build.yml` (non-fork PRs,
14+
# push-triggered) and `build_fork.yml` (fork PRs, pull_request_target).
15+
workflows: ["continuous integration", "continuous integration (mathlib forks)"]
16+
types: [completed]
17+
18+
permissions:
19+
contents: read
20+
actions: read # for cross-workflow artifact downloads
21+
22+
jobs:
23+
diff:
24+
# The build never runs on a `pull_request` event: non-fork PRs build via
25+
# `build.yml` on `push` (head_branch = the PR branch), fork PRs via
26+
# `build_fork.yml` on `pull_request_target`. Accept both, and for `push`
27+
# exclude master and the non-PR maintenance branches.
28+
if: >-
29+
github.repository == 'leanprover-community/mathlib4'
30+
&& github.event.workflow_run.conclusion == 'success'
31+
&& (
32+
github.event.workflow_run.event == 'pull_request_target'
33+
|| (
34+
github.event.workflow_run.event == 'push'
35+
&& github.event.workflow_run.head_branch != 'master'
36+
&& github.event.workflow_run.head_branch != 'nightly-testing'
37+
&& !startsWith(github.event.workflow_run.head_branch, 'lean-pr-testing-')
38+
)
39+
)
40+
runs-on: ubuntu-latest
41+
steps:
42+
- name: Resolve Build run + SHA
43+
id: meta
44+
run: |
45+
set -euo pipefail
46+
RUN_ID="${{ github.event.workflow_run.id }}"
47+
NEW_SHA="${{ github.event.workflow_run.head_sha }}"
48+
{
49+
echo "run-id=$RUN_ID"
50+
echo "new-sha=$NEW_SHA"
51+
} | tee -a "$GITHUB_OUTPUT"
52+
53+
- name: Checkout new commit
54+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
55+
with:
56+
ref: ${{ steps.meta.outputs.new-sha }}
57+
fetch-depth: 0
58+
59+
- name: Resolve merge-base against master
60+
id: resolve
61+
env:
62+
NEW_SHA: ${{ steps.meta.outputs.new-sha }}
63+
run: |
64+
set -euo pipefail
65+
git fetch --quiet origin master
66+
MB="$(git merge-base "$NEW_SHA" origin/master)"
67+
echo "merge-base=$MB" | tee -a "$GITHUB_OUTPUT"
68+
69+
- name: Download new-side artifact
70+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
71+
with:
72+
name: import-graph
73+
path: ./new-artifact
74+
run-id: ${{ steps.meta.outputs.run-id }}
75+
github-token: ${{ secrets.GITHUB_TOKEN }}
76+
77+
- name: Find master Build for the merge-base
78+
id: master-run
79+
env:
80+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81+
REPO: ${{ github.repository }}
82+
MB: ${{ steps.resolve.outputs.merge-base }}
83+
run: |
84+
set -euo pipefail
85+
RUN="$(gh api "repos/$REPO/actions/runs?head_sha=$MB&event=push&status=success&branch=master" \
86+
--jq '[.workflow_runs[] | select(.name=="continuous integration")] | .[0].id // ""')"
87+
# A successful run is not enough: it must also carry the `import-graph` artifact.
88+
HAS_ARTIFACT=""
89+
if [ -n "$RUN" ]; then
90+
HAS_ARTIFACT="$(gh api "repos/$REPO/actions/runs/$RUN/artifacts" \
91+
--jq '[.artifacts[] | select(.name=="import-graph")] | length')"
92+
fi
93+
if [ -n "$RUN" ] && [ "${HAS_ARTIFACT:-0}" -gt 0 ]; then
94+
{
95+
echo "found=true"
96+
echo "run-id=$RUN"
97+
} | tee -a "$GITHUB_OUTPUT"
98+
else
99+
echo "found=false" | tee -a "$GITHUB_OUTPUT"
100+
echo "No usable master Build for merge-base $MB (no run, or run lacks the import-graph artifact)."
101+
fi
102+
103+
- name: Download master-side artifact
104+
if: steps.master-run.outputs.found == 'true'
105+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
106+
with:
107+
name: import-graph
108+
path: ./ref-artifact
109+
run-id: ${{ steps.master-run.outputs.run-id }}
110+
github-token: ${{ secrets.GITHUB_TOKEN }}
111+
112+
- name: Checkout local actions
113+
if: steps.master-run.outputs.found == 'true'
114+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
115+
with:
116+
ref: ${{ github.workflow_sha }}
117+
fetch-depth: 1
118+
sparse-checkout: .github/actions
119+
path: workflow-actions
120+
121+
- name: Get mathlib-ci
122+
if: steps.master-run.outputs.found == 'true'
123+
uses: ./workflow-actions/.github/actions/get-mathlib-ci
124+
125+
- name: Compute Lean-aware declarations diff
126+
if: steps.master-run.outputs.found == 'true'
127+
uses: ./ci-tools/.github/actions/decls-diff
128+
with:
129+
reference-decls-file: ${{ github.workspace }}/ref-artifact/decls.txt
130+
reference-imports-file: ${{ github.workspace }}/ref-artifact/imports.json
131+
new-decls-file: ${{ github.workspace }}/new-artifact/decls.txt
132+
new-imports-file: ${{ github.workspace }}/new-artifact/imports.json
133+
new-sha: ${{ steps.meta.outputs.new-sha }}
134+
135+
- name: Note cache miss
136+
if: steps.master-run.outputs.found != 'true'
137+
run: |
138+
{
139+
echo "## Declarations diff"
140+
echo
141+
echo "⚠️ The Mathlib cache for this PR's merge-base \`${{ steps.resolve.outputs.merge-base }}\` isn't on the server (typically because the merge-base is a bors-batch intermediate that CI never built). Merge \`master\` into this PR and push to retrigger the build."
142+
} >> "$GITHUB_STEP_SUMMARY"

.github/workflows/maintainer_bors.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ on:
1313
pull_request_review_comment:
1414
types: [created]
1515

16+
# This job only parses the triggering comment and emits an artifact for the
17+
# privileged `maintainer_bors_wf_run` workflow to consume; it never uses the
18+
# token to mutate the repo. Keep it read-only rather than inheriting the
19+
# default token permissions.
20+
permissions:
21+
contents: read
22+
1623
jobs:
1724
add_ready_to_merge_label:
1825
# we set some variables. The ones of the form `${{ X }}${{ Y }}` are typically not

.github/workflows/olean_report.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ jobs:
8888
ref: refs/pull/${{ github.event.issue.number }}/head
8989
fetch-depth: 0
9090
path: pr-branch
91+
# Untrusted (potentially fork) checkout: don't persist the GITHUB_TOKEN into its .git/config.
92+
persist-credentials: false
9193

9294
# Check out master into tools-branch. We build the `cache` binary from
9395
# here so that a single binary can fetch oleans for both checkouts.

Mathlib.lean

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,6 +1318,7 @@ public import Mathlib.Algebra.Star.StarRingHom
13181318
public import Mathlib.Algebra.Star.Subalgebra
13191319
public import Mathlib.Algebra.Star.Subsemiring
13201320
public import Mathlib.Algebra.Star.TensorProduct
1321+
public import Mathlib.Algebra.Star.TransferInstance
13211322
public import Mathlib.Algebra.Star.Unitary
13221323
public import Mathlib.Algebra.Star.UnitaryStarAlgAut
13231324
public import Mathlib.Algebra.Symmetrized
@@ -2661,6 +2662,7 @@ public import Mathlib.CategoryTheory.EpiMono
26612662
public import Mathlib.CategoryTheory.EqToHom
26622663
public import Mathlib.CategoryTheory.Equivalence
26632664
public import Mathlib.CategoryTheory.Equivalence.Symmetry
2665+
public import Mathlib.CategoryTheory.EquivalenceRelation
26642666
public import Mathlib.CategoryTheory.EssentialImage
26652667
public import Mathlib.CategoryTheory.EssentiallySmall
26662668
public import Mathlib.CategoryTheory.Extensive
@@ -4378,6 +4380,7 @@ public import Mathlib.Data.Sum.Lattice
43784380
public import Mathlib.Data.Sum.Order
43794381
public import Mathlib.Data.Sym.Basic
43804382
public import Mathlib.Data.Sym.Card
4383+
public import Mathlib.Data.Sym.NatCard
43814384
public import Mathlib.Data.Sym.Sym2
43824385
public import Mathlib.Data.Sym.Sym2.Finsupp
43834386
public import Mathlib.Data.Sym.Sym2.Init
@@ -4827,6 +4830,7 @@ public import Mathlib.GroupTheory.Submonoid.Centralizer
48274830
public import Mathlib.GroupTheory.Submonoid.Inverses
48284831
public import Mathlib.GroupTheory.Subsemigroup.Center
48294832
public import Mathlib.GroupTheory.Subsemigroup.Centralizer
4833+
public import Mathlib.GroupTheory.Subsemigroup.Lemmas
48304834
public import Mathlib.GroupTheory.Sylow
48314835
public import Mathlib.GroupTheory.Torsion
48324836
public import Mathlib.GroupTheory.Transfer
@@ -5060,6 +5064,7 @@ public import Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Basic
50605064
public import Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Card
50615065
public import Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Defs
50625066
public import Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.FinTwo
5067+
public import Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.MvPolynomial
50635068
public import Mathlib.LinearAlgebra.Matrix.GeneralLinearGroup.Projective
50645069
public import Mathlib.LinearAlgebra.Matrix.Gershgorin
50655070
public import Mathlib.LinearAlgebra.Matrix.Hadamard
@@ -6169,6 +6174,7 @@ public import Mathlib.Order.WithBotTop
61696174
public import Mathlib.Order.Zorn
61706175
public import Mathlib.Order.ZornAtoms
61716176
public import Mathlib.Probability.BorelCantelli
6177+
public import Mathlib.Probability.BrownianMotion.GaussianProjectiveFamily
61726178
public import Mathlib.Probability.CDF
61736179
public import Mathlib.Probability.CentralLimitTheorem
61746180
public import Mathlib.Probability.Combinatorics.BinomialRandomGraph.Defs
@@ -6394,6 +6400,8 @@ public import Mathlib.RingTheory.Bialgebra.TensorProduct
63946400
public import Mathlib.RingTheory.Binomial
63956401
public import Mathlib.RingTheory.ChainOfDivisors
63966402
public import Mathlib.RingTheory.ClassGroup
6403+
public import Mathlib.RingTheory.ClassGroup.Basic
6404+
public import Mathlib.RingTheory.ClassGroup.ExtendedHom
63976405
public import Mathlib.RingTheory.Coalgebra.Basic
63986406
public import Mathlib.RingTheory.Coalgebra.CoassocSimps
63996407
public import Mathlib.RingTheory.Coalgebra.Convolution
@@ -6554,6 +6562,7 @@ public import Mathlib.RingTheory.Ideal.Colon
65546562
public import Mathlib.RingTheory.Ideal.Cotangent
65556563
public import Mathlib.RingTheory.Ideal.CotangentBaseChange
65566564
public import Mathlib.RingTheory.Ideal.Defs
6565+
public import Mathlib.RingTheory.Ideal.Finsupp
65576566
public import Mathlib.RingTheory.Ideal.GoingDown
65586567
public import Mathlib.RingTheory.Ideal.GoingUp
65596568
public import Mathlib.RingTheory.Ideal.Height
@@ -6852,6 +6861,7 @@ public import Mathlib.RingTheory.ReesAlgebra
68526861
public import Mathlib.RingTheory.Regular.Category
68536862
public import Mathlib.RingTheory.Regular.Depth
68546863
public import Mathlib.RingTheory.Regular.Flat
6864+
public import Mathlib.RingTheory.Regular.Free
68556865
public import Mathlib.RingTheory.Regular.IsSMulRegular
68566866
public import Mathlib.RingTheory.Regular.LinearMap
68576867
public import Mathlib.RingTheory.Regular.ProjectiveDimension
@@ -7093,6 +7103,7 @@ public import Mathlib.Tactic.ArithMult
70937103
public import Mathlib.Tactic.ArithMult.Init
70947104
public import Mathlib.Tactic.Attr.Core
70957105
public import Mathlib.Tactic.Attr.Register
7106+
public import Mathlib.Tactic.BDSimp
70967107
public import Mathlib.Tactic.Basic
70977108
public import Mathlib.Tactic.Bound
70987109
public import Mathlib.Tactic.Bound.Attribute

Mathlib/Algebra/Algebra/Defs.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ theorem linearMap_apply (r : R) : Algebra.linearMap R A r = algebraMap R A r :=
380380
theorem coe_linearMap : ⇑(Algebra.linearMap R A) = algebraMap R A :=
381381
rfl
382382

383+
-- see Note [higher instance priority]
383384
/-- The identity map inducing an `Algebra` structure. -/
384385
instance (priority := 1100) id : Algebra R R where
385386
-- We override `toFun` and `toSMul` because `RingHom.id` is not reducible and cannot

0 commit comments

Comments
 (0)