Skip to content

Commit 5e9b6b9

Browse files
kim-emmathlib4-botgithub-actionsTwoFXkbuzzard
committed
chore: bump toolchain to v4.27.0-rc1 (leanprover-community#32874)
Co-authored-by: mathlib4-bot <github-mathlib4-bot@leanprover.zulipchat.com> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Markus Himmel <markus@lean-fro.org> Co-authored-by: Kevin Buzzard <k.buzzard@imperial.ac.uk> Co-authored-by: leanprover-community-bot-assistant <97194829+leanprover-community-bot-assistant@users.noreply.github.com>
1 parent 3ac4753 commit 5e9b6b9

File tree

115 files changed

+373
-371
lines changed

Some content is hidden

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

115 files changed

+373
-371
lines changed

Archive/Imo/Imo2015Q6.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ lemma pool_subset_Icc : ∀ {t}, pool a t ⊆ Icc 0 2014
8585
| t + 1 => by
8686
intro x hx
8787
simp_rw [pool, mem_map, Equiv.coe_toEmbedding, Equiv.subRight_apply] at hx
88-
obtain ⟨y, my, ey⟩ := hx
88+
obtain ⟨y, my, rfl⟩ := hx
8989
suffices y ∈ Icc 1 2015 by rw [mem_Icc] at this ⊢; lia
9090
rw [mem_insert, mem_erase] at my; rcases my with h | ⟨h₁, h₂⟩
9191
· exact h ▸ ha.1 t

Cache/IO.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ private def CacheM.mathlibDepPath (sp : SearchPath) : IO FilePath := do
142142
def _root_.Lean.SearchPath.relativize (sp : SearchPath) : IO SearchPath := do
143143
let pwd ← IO.FS.realPath "."
144144
let pwd' := pwd.toString ++ System.FilePath.pathSeparator.toString
145-
return sp.map fun x => ⟨if x = pwd then "." else x.toString.stripPrefix pwd'⟩
145+
return sp.map fun x => ⟨if x = pwd then "." else x.toString.dropPrefix pwd' |>.copy
146146

147147
private def CacheM.getContext : IO CacheM.Context := do
148148
let sp ← (← getSrcSearchPath).relativize
@@ -208,8 +208,8 @@ def validateCurl : IO Bool := do
208208
let _ := @leOfOrd
209209
if version >= (7, 81) then return true
210210
-- TODO: support more platforms if the need arises
211-
let arch ← (·.trim) <$> runCmd "uname" #["-m"] false
212-
let kernel ← (·.trim) <$> runCmd "uname" #["-s"] false
211+
let arch ← (·.trimAscii.copy) <$> runCmd "uname" #["-m"] false
212+
let kernel ← (·.trimAscii.copy) <$> runCmd "uname" #["-s"] false
213213
if kernel == "Linux" && arch ∈ ["x86_64", "aarch64"] then
214214
IO.println s!"curl is too old; downloading more recent version"
215215
IO.FS.createDirAll IO.CACHEDIR
@@ -249,7 +249,7 @@ def validateLeanTar : IO Unit := do
249249
let target ← if win then
250250
pure "x86_64-pc-windows-msvc"
251251
else
252-
let mut arch ← (·.trim) <$> runCmd "uname" #["-m"] false
252+
let mut arch ← (·.trimAscii.copy) <$> runCmd "uname" #["-m"] false
253253
if arch = "arm64" then arch := "aarch64"
254254
unless arch ∈ ["x86_64", "aarch64"] do
255255
throw <| IO.userError s!"unsupported architecture {arch}"

Cache/Requests.lean

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ structure RepoInfo where
2828
Helper function to extract repository name from a git remote URL
2929
-/
3030
def extractRepoFromUrl (url : String) : Option String := do
31-
let url := url.stripSuffix ".git"
32-
let pos ← url.revFind (· == '/')
33-
let pos ← url.revFindAux (fun c => c == '/' || c == ':') pos
34-
return (String.Pos.Raw.extract url) (String.Pos.Raw.next url pos) url.rawEndPos
31+
let url := url.dropSuffix ".git"
32+
let pos ← url.revFind? (· == '/')
33+
let pos ← (url.sliceTo pos).revFind? (fun c => c == '/' || c == ':')
34+
return url.sliceFrom (String.Slice.Pos.ofSliceTo pos).next! |>.copy
3535

3636
/-- Spot check if a URL is valid for a git remote -/
3737
def isRemoteURL (url : String) : Bool :=
@@ -50,14 +50,14 @@ def getRepoFromRemote (mathlibDepPath : FilePath) (remoteName : String) (errorCo
5050
let out ← IO.Process.output
5151
{cmd := "git", args := #["remote", "get-url", remoteName], cwd := mathlibDepPath}
5252
-- If `git remote get-url` fails then bail out with an error to help debug
53-
let output := out.stdout.trim
53+
let output := out.stdout.trimAscii
5454
unless out.exitCode == 0 do
5555
throw <| IO.userError s!"\
5656
Failed to run Git to determine Mathlib's repository from {remoteName} remote (exit code: {out.exitCode}).\n\
5757
{errorContext}\n\
58-
Stdout:\n{output}\nStderr:\n{out.stderr.trim}\n"
58+
Stdout:\n{output}\nStderr:\n{out.stderr.trimAscii}\n"
5959
-- Finally attempt to extract the repository from the remote URL returned by `git remote get-url`
60-
repoFromURL output
60+
repoFromURL output.copy
6161
where repoFromURL (url : String) : IO String := do
6262
if let some repo := extractRepoFromUrl url then
6363
return repo
@@ -79,17 +79,17 @@ def findMathlibRemote (mathlibDepPath : FilePath) : IO String := do
7979
throw <| IO.userError s!"\
8080
Failed to run Git to list remotes (exit code: {remotesInfo.exitCode}).\n\
8181
Ensure Git is installed.\n\
82-
Stdout:\n{remotesInfo.stdout.trim}\nStderr:\n{remotesInfo.stderr.trim}\n"
82+
Stdout:\n{remotesInfo.stdout.trimAscii}\nStderr:\n{remotesInfo.stderr.trimAscii}\n"
8383

8484
let remoteLines := remotesInfo.stdout.splitToList (· == '\n')
8585
let mut mathlibRemote : Option String := none
8686
let mut originPointsToMathlib : Bool := false
8787

8888
for line in remoteLines do
89-
let parts := line.trim.splitToList (· == '\t')
89+
let parts := line.trimAscii.copy.splitToList (· == '\t')
9090
if parts.length >= 2 then
9191
let remoteName := parts[0]!
92-
let remoteUrl := parts[1]!.takeWhile (· != ' ') -- Remove (fetch) or (push) suffix
92+
let remoteUrl := parts[1]!.takeWhile (· != ' ') |>.copy -- Remove (fetch) or (push) suffix
9393

9494
-- Check if this remote points to leanprover-community/mathlib4
9595
let isMathlibRepo := remoteUrl.containsSubstr "leanprover-community/mathlib4"
@@ -128,11 +128,11 @@ def isDetachedAtNightlyTesting (mathlibDepPath : FilePath) : IO Bool := do
128128
let currentCommit ← IO.Process.output
129129
{cmd := "git", args := #["rev-parse", "HEAD"], cwd := mathlibDepPath}
130130
if currentCommit.exitCode == 0 then
131-
let commitHash := currentCommit.stdout.trim
131+
let commitHash := currentCommit.stdout.trimAscii.copy
132132
let tagInfo ← IO.Process.output
133133
{cmd := "git", args := #["name-rev", "--tags", commitHash], cwd := mathlibDepPath}
134134
if tagInfo.exitCode == 0 then
135-
let parts := tagInfo.stdout.trim.splitOn " "
135+
let parts := tagInfo.stdout.trimAscii.copy.splitOn " "
136136
-- git name-rev returns "commit_hash tags/tag_name" or just "commit_hash undefined" if no tag
137137
if parts.length >= 2 && parts[1]!.startsWith "tags/" then
138138
let tagName := parts[1]!.drop 5 -- Remove "tags/" prefix
@@ -159,17 +159,17 @@ def getRemoteRepo (mathlibDepPath : FilePath) : IO RepoInfo := do
159159
{cmd := "git", args := #["rev-parse", "--abbrev-ref", "HEAD"], cwd := mathlibDepPath}
160160

161161
if currentBranch.exitCode == 0 then
162-
let branchName := currentBranch.stdout.trim.stripPrefix "heads/"
162+
let branchName := currentBranch.stdout.trimAscii.dropPrefix "heads/"
163163
IO.println s!"Current branch: {branchName}"
164164

165165
-- Check if we're in a detached HEAD state at a nightly-testing tag
166-
let isDetachedAtNightlyTesting ← if branchName == "HEAD" then
166+
let isDetachedAtNightlyTesting ← if branchName == "HEAD".toSlice then
167167
isDetachedAtNightlyTesting mathlibDepPath
168168
else
169169
pure false
170170

171171
-- Check if we're on a branch that should use nightly-testing remote
172-
let shouldUseNightlyTesting := branchName == "nightly-testing" ||
172+
let shouldUseNightlyTesting := branchName == "nightly-testing".toSlice ||
173173
branchName.startsWith "lean-pr-testing-" ||
174174
branchName.startsWith "batteries-pr-testing-" ||
175175
branchName.startsWith "bump/" ||
@@ -229,10 +229,10 @@ def getRemoteRepo (mathlibDepPath : FilePath) : IO RepoInfo := do
229229

230230
-- Fall back to using the remote that the current branch is tracking
231231
let trackingRemote ← IO.Process.output
232-
{cmd := "git", args := #["config", "--get", s!"branch.{currentBranch.stdout.trim}.remote"], cwd := mathlibDepPath}
232+
{cmd := "git", args := #["config", "--get", s!"branch.{currentBranch.stdout.trimAscii}.remote"], cwd := mathlibDepPath}
233233

234234
let remoteName := if trackingRemote.exitCode == 0 then
235-
trackingRemote.stdout.trim
235+
trackingRemote.stdout.trimAscii.copy
236236
else
237237
-- If no tracking remote is configured, fall back to origin
238238
"origin"
@@ -329,15 +329,15 @@ def monitorCurl (args : Array String) (size : Nat)
329329
let s@{success, failed, done, speed, ..} ← IO.runCurlStreaming args init fun a line => do
330330
let mut {last, success, failed, done, speed} := a
331331
-- output errors other than 404 and remove corresponding partial downloads
332-
let line := line.trim
332+
let line := line.trimAscii
333333
if !line.isEmpty then
334-
match Lean.Json.parse line with
334+
match Lean.Json.parse line.copy with
335335
| .ok result =>
336336
match result.getObjValAs? Nat "http_code" with
337337
| .ok 200 =>
338338
if let .ok fn := result.getObjValAs? String "filename_effective" then
339339
if (← System.FilePath.pathExists fn) && fn.endsWith ".part" then
340-
IO.FS.rename fn (fn.dropRight 5)
340+
IO.FS.rename fn (fn.dropEnd 5).copy
341341
success := success + 1
342342
| .ok 404 => pure ()
343343
| code? =>
@@ -415,10 +415,10 @@ def checkForToolchainMismatch : IO.CacheM Unit := do
415415
let mathlibToolchainFile := (← read).mathlibDepPath / "lean-toolchain"
416416
let downstreamToolchain ← IO.FS.readFile "lean-toolchain"
417417
let mathlibToolchain ← IO.FS.readFile mathlibToolchainFile
418-
if !(mathlibToolchain.trim = downstreamToolchain.trim) then
418+
if !(mathlibToolchain.trimAscii == downstreamToolchain.trimAscii) then
419419
IO.println "Dependency Mathlib uses a different lean-toolchain"
420-
IO.println s!" Project uses {downstreamToolchain.trim}"
421-
IO.println s!" Mathlib uses {mathlibToolchain.trim}"
420+
IO.println s!" Project uses {downstreamToolchain.trimAscii}"
421+
IO.println s!" Mathlib uses {mathlibToolchain.trimAscii}"
422422
IO.println "\nThe cache will not work unless your project's toolchain matches Mathlib's toolchain"
423423
IO.println s!"This can be achieved by copying the contents of the file `{mathlibToolchainFile}`
424424
into the `lean-toolchain` file at the root directory of your project"
@@ -554,7 +554,8 @@ section Commit
554554
def isGitStatusClean : IO Bool :=
555555
return (← IO.runCmd "git" #["status", "--porcelain"]).isEmpty
556556

557-
def getGitCommitHash : IO String := return (← IO.runCmd "git" #["rev-parse", "HEAD"]).trimRight
557+
def getGitCommitHash : IO String :=
558+
return (← IO.runCmd "git" #["rev-parse", "HEAD"]).trimAsciiEnd.copy
558559

559560
/--
560561
Sends a commit file to the server, containing the hashes of the respective committed files.

Mathlib/Algebra/GroupWithZero/Torsion.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ theorem IsMulTorsionFree.mk' (ih : ∀ x ≠ 0, ∀ y ≠ 0, ∀ n ≠ 0, (x ^ n
2727
refine ⟨fun n hn x y hxy ↦ ?_⟩
2828
by_cases h : x ≠ 0 ∧ y ≠ 0
2929
· exact ih x h.1 y h.2 n hn hxy
30-
grind [pow_eq_zero, zero_pow]
30+
grind [eq_zero_of_pow_eq_zero, zero_pow]
3131

3232
variable [UniqueFactorizationMonoid M] [NormalizationMonoid M] [IsMulTorsionFree Mˣ]
3333

Mathlib/Algebra/Homology/DerivedCategory/Ext/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ noncomputable def extFunctor (n : ℕ) : Cᵒᵖ ⥤ C ⥤ AddCommGrpCat.{w} whe
431431
dsimp
432432
symm
433433
apply Ext.comp_assoc
434-
all_goals omega }
434+
all_goals lia }
435435
map_comp {X₁ X₂ X₃} f f' := by
436436
ext Y α
437437
simp

Mathlib/Algebra/Homology/ExactSequence.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ lemma isComplex₀ (S : ComposableArrows C 0) : S.IsComplex where
106106
zero i hi := by simp at hi
107107

108108
lemma isComplex₁ (S : ComposableArrows C 1) : S.IsComplex where
109-
zero i hi := by omega
109+
zero i hi := by lia
110110

111111
variable (S)
112112

@@ -193,7 +193,7 @@ lemma exact₀ (S : ComposableArrows C 0) : S.Exact where
193193

194194
lemma exact₁ (S : ComposableArrows C 1) : S.Exact where
195195
toIsComplex := S.isComplex₁
196-
exact i hi := by exfalso; omega
196+
exact i hi := by exfalso; lia
197197

198198
lemma isComplex₂_iff (S : ComposableArrows C 2) :
199199
S.IsComplex ↔ S.map' 0 1 ≫ S.map' 1 2 = 0 := by

Mathlib/Algebra/Homology/HomotopyCategory/MappingCone.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ lemma liftCochain_descCochain :
547547
lemma liftCochain_v_descCochain_v (p₁ p₂ p₃ : ℤ) (h₁₂ : p₁ + n = p₂) (h₂₃ : p₂ + n' = p₃)
548548
(q : ℤ) (hq : p₁ + m = q) :
549549
(liftCochain φ α β h).v p₁ p₂ h₁₂ ≫ (descCochain φ α' β' h').v p₂ p₃ h₂₃ =
550-
α.v p₁ q hq ≫ α'.v q p₃ (by lia) + β.v p₁ p₂ h₁₂ ≫ β'.v p₂ p₃ h₂₃ := by
550+
α.v p₁ q hq ≫ α'.v q p₃ (by omega) + β.v p₁ p₂ h₁₂ ≫ β'.v p₂ p₃ h₂₃ := by
551551
have eq := Cochain.congr_v (liftCochain_descCochain φ α β α' β' h h' p hp) p₁ p₃ (by lia)
552552
simpa only [Cochain.comp_v _ _ hp p₁ p₂ p₃ h₁₂ h₂₃, Cochain.add_v,
553553
Cochain.comp_v _ _ _ _ _ _ hq (show q + m' = p₃ by lia)] using eq

Mathlib/Algebra/Module/ZLattice/Summable.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ lemma sum_piFinset_Icc_rpow_le {ι : Type*} [Fintype ι] [DecidableEq ι]
124124
norm_num at this
125125
zify
126126
convert this using 3
127-
· rw [abs_eq_self.mpr (sub_nonneg.mpr (by gcongr; omega)), Nat.cast_sub (by gcongr; omega)]
127+
· rw [abs_eq_self.mpr (sub_nonneg.mpr (by gcongr; lia)), Nat.cast_sub (by gcongr; lia)]
128128
simp
129-
· rw [max_eq_left (by gcongr; omega), abs_eq_self.mpr (by positivity)]
129+
· rw [max_eq_left (by gcongr; lia), abs_eq_self.mpr (by positivity)]
130130
let ε := normBound b
131131
have hε : 0 < ε := normBound_pos b
132132
calc ∑ p ∈ s n, ‖∑ i, p i • b i‖ ^ r
@@ -147,7 +147,7 @@ lemma sum_piFinset_Icc_rpow_le {ι : Type*} [Fintype ι] [DecidableEq ι]
147147
gcongr with k hk
148148
refine (this _).trans ?_
149149
gcongr
150-
omega
150+
lia
151151
_ = 2 * d * 3 ^ (d - 1) * ε ^ r * ∑ k ∈ range n, (k + 1) ^ (d - 1) * (k + 1 : ℝ) ^ r := by
152152
simp_rw [Finset.mul_sum]
153153
congr with k

Mathlib/Algebra/Polynomial/Coeff.lean

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,10 @@ end Fewnomials
225225
theorem coeff_mul_X_pow (p : R[X]) (n d : ℕ) :
226226
coeff (p * Polynomial.X ^ n) (d + n) = coeff p d := by
227227
rw [coeff_mul, Finset.sum_eq_single (d, n), coeff_X_pow, if_pos rfl, mul_one]
228-
all_goals grind [mem_antidiagonal, mul_zero]
228+
· rintro ⟨i, j⟩ h1 h2
229+
rw [coeff_X_pow, if_neg, mul_zero]
230+
grind [mem_antidiagonal]
231+
· grind [mem_antidiagonal]
229232

230233
@[simp]
231234
theorem coeff_X_pow_mul (p : R[X]) (n d : ℕ) :

Mathlib/Algebra/Polynomial/RuleOfSigns.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ theorem succ_signVariations_le_X_sub_C_mul (hη : 0 < η) (hP : P ≠ 0) :
313313
· --P is zero degree, therefore a constant.
314314
have hcQ : 0 < coeff P 0 := by grind [leadingCoeff]
315315
have hxcQ : coeff ((X - C η) * P) 1 = coeff P 0 := by
316-
grind [coeff_X_sub_C_mul, mul_zero, coeff_eq_zero_of_natDegree_lt]
316+
simp_all [coeff_X_sub_C_mul, coeff_eq_zero_of_natDegree_lt]
317317
dsimp [signVariations, coeffList]
318318
rw [withBotSucc_degree_eq_natDegree_add_one hP, withBotSucc_degree_eq_natDegree_add_one h_mul]
319319
simp [h_deg_mul, hxcQ, hη, hcQ, hd, List.range_succ]

0 commit comments

Comments
 (0)