Skip to content

Commit 23aa2cf

Browse files
author
leanprover-community-mathlib4-bot
committed
Update lean-toolchain for leanprover/lean4#13492
2 parents 69cbc3c + c22b6cc commit 23aa2cf

190 files changed

Lines changed: 2706 additions & 743 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.

Archive/Imo/Imo1962Q4.lean

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ in fact the simplest form of the set of solutions, and then prove it equals the
1616

1717
open Real
1818

19-
open scoped Real
20-
2119
namespace Imo1962Q4
2220

2321
noncomputable section

Archive/Imo/Imo1987Q1.lean

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ open Equiv Fintype Function
2929

3030
open Finset (range sum_const)
3131

32-
open Set (Iic)
33-
3432
namespace Imo1987Q1
3533

3634
/-- The set of pairs `(x : α, σ : Perm α)` such that `σ x = x` is equivalent to the set of pairs

Archive/Imo/Imo2019Q2.lean

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@ rather than more literally with `affineSegment`.
5858

5959

6060
open Affine Affine.Simplex EuclideanGeometry Module
61-
62-
open scoped Affine EuclideanGeometry Real
63-
61+
open scoped Real
6462

6563
attribute [local instance] FiniteDimensional.of_fact_finrank_eq_two
6664

Cache/IO.lean

Lines changed: 70 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ Authors: Arthur Paulino, Jon Eugster
55
-/
66
import Std.Data.TreeSet
77
import Cache.Lean
8+
import Lake.Load.Toml
9+
import Batteries.Tactic.OpenPrivate
810

911
variable {α : Type}
1012

1113
open Lean
12-
1314
namespace Cache.IO
1415

1516
open System (FilePath)
@@ -483,22 +484,27 @@ def lookup (hashMap : ModuleHashMap) (modules : List Name) : IO Unit := do
483484
println! " comment: {line}"
484485
if err then IO.Process.exit 1
485486

487+
open private Lake.Glob.ofString? from Lake.Load.Toml in
488+
486489
/--
487490
Parse a string as either a path or a Lean module name.
488-
TODO: If the argument describes a folder, use `walkDir` to find all `.lean` files within.
491+
If the argument describes a folder, use `walkDir` to find all `.lean` files within.
489492
490493
Return tuples of the form ("module name", "path to .lean file").
491494
492495
The input string `arg` takes one of the following forms:
493496
494497
1. `Mathlib.Algebra.Field.Basic`: there exists such a Lean file
495-
2. `Mathlib.Algebra.Field`: no Lean file exists but a folder (TODO)
496-
3. `Mathlib/Algebra/Field/Basic.lean`: the file exists (note potentially `\` on Windows)
497-
4. `Mathlib/Algebra/Field/`: the folder exists (TODO)
498+
2. `Mathlib.Algebra.Field.+`: no Lean file exists but a folder `Field`
499+
3. `Mathlib.Algebra.Field.*`: either a file or a folder
500+
(note in some shells escaping as `.\*` might be necessary)
501+
4. `Mathlib/Algebra/Field/Basic.lean`: the file exists
502+
(note potentially `\` on Windows)
503+
5. `Mathlib/Algebra/Field/`: the folder exists
498504
499505
Not supported yet:
500506
501-
5. `Aesop/Builder.lean`: the file does not exist, it's actually somewhere in `.lake`.
507+
6. `Aesop/Builder.lean`: the file does not exist, it's actually somewhere in `.lake`.
502508
503509
Note: An argument like `Archive` is treated as module, not a path.
504510
-/
@@ -514,39 +520,73 @@ def leanModulesFromSpec (sp : SearchPath) (argₛ : String) :
514520
-- provided file name of a Lean file
515521
let mod : Name := arg.withExtension "" |>.components.foldl .str .anonymous
516522
if !(← arg.pathExists) then
517-
-- TODO: (5.) We could use `getSrcDir` to allow arguments like `Aesop/Builder.lean` which
523+
-- TODO: (6.) We could use `getSrcDir` to allow arguments like `Aesop/Builder.lean` which
518524
-- refer to a file located under `.lake/packages/...`
519525
return .error s!"Invalid argument: non-existing path {arg}"
520526
if arg.extension == "lean" then
521-
-- (3.) provided existing `.lean` file
527+
-- (4.) provided existing `.lean` file
522528
return .ok #[(mod, arg)]
523529
else
524-
-- (4.) provided existing directory: walk it
525-
return .error "Searching lean files in a folder is not supported yet!"
530+
-- (5.) provided existing directory: walk it
531+
IO.println s!"Searching directory {arg} for .lean files"
532+
let leanModulesInFolder ← walkDir sp arg mod
533+
return .ok leanModulesInFolder
526534
else
527535
-- provided a module
528-
let mod := argₛ.toName
529-
if mod.isAnonymous then
530-
-- provided a module name which is not a valid Lean identifier
536+
-- user might provide `.*` or `.+` to include folders
537+
match Lake.Glob.ofString? argₛ with
538+
| none =>
531539
return .error s!"Invalid argument: expected path or module name, not {argₛ}"
532-
let sourceFile ← Lean.findLean sp mod
533-
if ← sourceFile.pathExists then
534-
-- (1.) provided valid module
535-
return .ok #[(mod, sourceFile)]
536-
else
537-
-- provided "pseudo-module" (like `Mathlib.Data`) which
538-
-- does not correspond to a Lean file, but to an existing folder
539-
-- `Mathlib/Data/`
540-
let folder := sourceFile.withExtension ""
541-
IO.println s!"Searching directory {folder} for .lean files"
542-
if ← folder.pathExists then
543-
-- (2.) provided "module name" of an existing folder: walk dir
544-
-- TODO: will be implemented in https://github.com/leanprover-community/mathlib4/issues/21838
545-
return .error "Entering a part of a module name \
546-
(i.e. `Mathlib.Data` when only the folder `Mathlib/Data/` but no \
547-
file `Mathlib/Data.lean` exists) is not supported yet!"
540+
| some glob =>
541+
let modules ← match glob with
542+
| .one mod =>
543+
let sourceFile ← Lean.findLean sp mod
544+
pure #[(mod, sourceFile)]
545+
| .submodules mod =>
546+
let sourceFile ← Lean.findLean sp mod
547+
let folder := sourceFile.withExtension ""
548+
if ← folder.pathExists then
549+
IO.println s!"Searching directory {folder} for .lean files"
550+
let leanModulesInFolder ← walkDir sp folder mod
551+
pure leanModulesInFolder
552+
else
553+
pure #[]
554+
| .andSubmodules mod =>
555+
let sourceFile ← Lean.findLean sp mod
556+
let folder := sourceFile.withExtension ""
557+
if ← folder.pathExists then
558+
IO.println s!"Searching directory {folder} for .lean files"
559+
let leanModulesInFolder ← walkDir sp folder mod
560+
pure <| #[(mod, sourceFile)] ++ leanModulesInFolder
561+
else
562+
pure #[]
563+
if !modules.isEmpty then
564+
return .ok modules
548565
else
549-
return .error s!"Invalid argument: non-existing module {mod}"
566+
return .error s!"Invalid argument: {argₛ}"
567+
568+
where
569+
/--
570+
Search all `.lean` files inside `folder`.
571+
572+
In order to figure out the module name corresponding
573+
to the found files, we use `mod` and the search path `sp` to figure out how much of
574+
the relative path needs to be trimmed.
575+
576+
This assumes the `folder` exists.
577+
-/
578+
walkDir (sp : SearchPath) (folder : FilePath) (mod : Name) : IO <| Array (Name × FilePath) := do
579+
-- The source direcory where `mod` is located
580+
let srcDir ← getSrcDir sp mod
581+
-- find all Lean files in the folder only skipping special entries such as `.` and `..`
582+
let files ← folder.walkDir (pure ·.fileName.isSome)
583+
let leanFiles := files.filter (·.extension == some "lean")
584+
let mut leanModulesInFolder : Array (Name × FilePath) := #[]
585+
for file in leanFiles do
586+
let path := file.withoutParent srcDir
587+
let mod : Name := path.withExtension "" |>.components.foldl .str .anonymous
588+
leanModulesInFolder := leanModulesInFolder.push (mod, file)
589+
pure leanModulesInFolder
550590

551591
/--
552592
Parse command line arguments.

Cache/Main.lean

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,13 @@ Options:
5252
Valid arguments are:
5353
5454
* Module names like 'Mathlib.Init'
55+
* Module globs like 'Mathlib.Data.+' (find all Lean files inside `Mathlib/Data/`)
56+
* Module globs like 'Mathlib.Data.*' (both of the above)
5557
* File names like 'Mathlib/Init.lean'
5658
* Folder names like 'Mathlib/Data/' (find all Lean files inside `Mathlib/Data/`)
5759
* With bash's automatic glob expansion one can also write things like
58-
'Mathlib/**/Order/*.lean'.
60+
'Mathlib/**/Order/*.lean'. However, one would need to write `Mathlib.Data.\\*`
61+
to prevent glob expansion.
5962
6063
# Environment variables
6164
@@ -75,6 +78,12 @@ def curlArgs : List String :=
7578
def leanTarArgs : List String :=
7679
["get", "get!", "put", "put!", "put-unpacked", "pack", "pack!", "unpack", "lookup", "stage", "stage!"]
7780

81+
/-- The named options supported by the CLI. -/
82+
def knownNamedOpts : List String := ["repo", "staging-dir"]
83+
84+
/-- The flag options supported by the CLI. -/
85+
def knownFlagOpts : List String := ["help"]
86+
7887
/-- Parses an optional `--foo=bar` option. -/
7988
def parseNamedOpt (opt : String) (args : List String) : IO (Option String) := do
8089
let pref := s!"--{opt}="
@@ -87,17 +96,28 @@ def parseNamedOpt (opt : String) (args : List String) : IO (Option String) := do
8796
def parseFlagOpt (opt : String) (args : List String) : Bool :=
8897
args.elem s!"--{opt}"
8998

99+
/-- Check whether `opt` (e.g. `"--repo=foo"` or `"--help"`) is a recognized option. -/
100+
def isKnownOpt (opt : String) : Bool :=
101+
knownNamedOpts.any (opt.startsWith s!"--{·}=") ||
102+
knownFlagOpts.any (opt == s!"--{·}")
103+
90104
open Cache IO Hashing Requests System in
91105
def main (args : List String) : IO Unit := do
92-
if args.isEmpty then
106+
if args.isEmpty || parseFlagOpt "help" args then
93107
println help
94108
Process.exit 0
95109
CacheM.run do
96110

97111
-- split args and named options
98112
let (options, args) := args.partition (·.startsWith "--")
99113

100-
-- parse relevant options, ignore the rest
114+
-- check for unrecognized options
115+
for opt in options do
116+
unless isKnownOpt opt do
117+
IO.eprintln s!"Unknown option '{opt}'"
118+
IO.eprintln help
119+
Process.exit 1
120+
101121
let repo? ← parseNamedOpt "repo" options
102122
let stagingDir? ← parseNamedOpt "staging-dir" options
103123

@@ -165,4 +185,8 @@ def main (args : List String) : IO Unit := do
165185
commit hashMap true (← getUploadAuth)
166186
| ["collect"] => IO.println "TODO"
167187
| "lookup" :: _ => lookup hashMap roots.keys
168-
| _ => println help
188+
| [] => println help -- unreachable: options are already partitioned out
189+
| cmd :: _ =>
190+
IO.eprintln s!"Unknown command '{cmd}'"
191+
IO.eprintln help
192+
Process.exit 1

Counterexamples/MapFloor.lean

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ noncomputable section
4242

4343
open Function Int Polynomial
4444

45-
open scoped Polynomial
46-
4745
/-- The integers with infinitesimals adjoined. -/
4846
def IntWithEpsilon :=
4947
ℤ[X] deriving Nontrivial, CommRing, Inhabited

Counterexamples/Phillips.lean

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -457,27 +457,13 @@ along horizontals). Such a set cannot be measurable as it would contradict Fubin
457457
We need the continuum hypothesis to construct it.
458458
-/
459459

460-
460+
-- TODO: deprecate in favor of `Cardinal.exists_rel_mk_fibers_lt`
461461
theorem sierpinski_pathological_family (Hcont : #ℝ = ℵ₁) :
462462
∃ f : ℝ → Set ℝ, (∀ x, (univ \ f x).Countable) ∧ ∀ y, {x : ℝ | y ∈ f x}.Countable := by
463-
rcases Cardinal.exists_ord_eq ℝ with ⟨r, hr, H⟩
464-
refine ⟨fun x => {y | r x y}, fun x => ?_, fun y => ?_⟩
465-
· have : univ \ {y | r x y} = {y | r y x} ∪ {x} := by
466-
ext y
467-
simp only [true_and, mem_univ, mem_setOf_eq, mem_insert_iff, union_singleton, mem_diff]
468-
rcases trichotomous_of r x y with (h | rfl | h)
469-
· simp only [h, not_or, false_iff, not_true]
470-
constructor
471-
· rintro rfl; exact irrefl_of r y h
472-
· exact asymm h
473-
· simp only [true_or, iff_true]; exact irrefl x
474-
· simp only [h, iff_true, or_true]; exact asymm h
475-
rw [this]
476-
apply Countable.union _ (countable_singleton _)
477-
rw [← Cardinal.le_aleph0_iff_set_countable, ← Cardinal.lt_aleph_one_iff, ← Hcont]
478-
exact Cardinal.card_typein_lt x H
479-
· rw [← Cardinal.le_aleph0_iff_set_countable, ← Cardinal.lt_aleph_one_iff, ← Hcont]
480-
exact Cardinal.card_typein_lt y H
463+
obtain ⟨r, hr₁, hr₂⟩ := Cardinal.exists_rel_mk_fibers_lt ℝ
464+
refine ⟨fun x ↦ setOf (r x), ?_, ?_⟩
465+
· simpa [Hcont, ← Set.compl_eq_univ_diff] using hr₁
466+
· simpa [Hcont] using hr₂
481467

482468
/-- A family of sets in `ℝ` which only miss countably many points, but such that any point is
483469
contained in only countably many of them. -/

Counterexamples/SeminormLatticeNotDistrib.lean

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ This proves the lattice `Seminorm ℝ (ℝ × ℝ)` is not distributive.
1818
* https://en.wikipedia.org/wiki/Seminorm#Examples
1919
-/
2020

21-
2221
open Seminorm
2322

2423
open scoped NNReal

Counterexamples/SorgenfreyLine.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ Prove that the Sorgenfrey line is a paracompact space.
3434

3535

3636
open Set Filter TopologicalSpace
37-
38-
open scoped Topology Filter Cardinal
37+
open scoped Topology Cardinal
3938

4039
namespace Counterexample
4140

Mathlib.lean

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ public import Mathlib.Algebra.FreeAlgebra
331331
public import Mathlib.Algebra.FreeAlgebra.Cardinality
332332
public import Mathlib.Algebra.FreeMonoid.Basic
333333
public import Mathlib.Algebra.FreeMonoid.Count
334+
public import Mathlib.Algebra.FreeMonoid.FreeSemigroup
334335
public import Mathlib.Algebra.FreeMonoid.Symbols
335336
public import Mathlib.Algebra.FreeMonoid.UniqueProds
336337
public import Mathlib.Algebra.FreeNonUnitalNonAssocAlgebra
@@ -1329,6 +1330,7 @@ public import Mathlib.AlgebraicGeometry.EllipticCurve.IsomOfJ
13291330
public import Mathlib.AlgebraicGeometry.EllipticCurve.Jacobian.Basic
13301331
public import Mathlib.AlgebraicGeometry.EllipticCurve.Jacobian.Formula
13311332
public import Mathlib.AlgebraicGeometry.EllipticCurve.Jacobian.Point
1333+
public import Mathlib.AlgebraicGeometry.EllipticCurve.LFunction
13321334
public import Mathlib.AlgebraicGeometry.EllipticCurve.ModelsWithJ
13331335
public import Mathlib.AlgebraicGeometry.EllipticCurve.NormalForms
13341336
public import Mathlib.AlgebraicGeometry.EllipticCurve.Projective.Basic
@@ -1731,6 +1733,7 @@ public import Mathlib.Analysis.Calculus.FDeriv.Linear
17311733
public import Mathlib.Analysis.Calculus.FDeriv.Measurable
17321734
public import Mathlib.Analysis.Calculus.FDeriv.Mul
17331735
public import Mathlib.Analysis.Calculus.FDeriv.Norm
1736+
public import Mathlib.Analysis.Calculus.FDeriv.Partial
17341737
public import Mathlib.Analysis.Calculus.FDeriv.Pi
17351738
public import Mathlib.Analysis.Calculus.FDeriv.Pow
17361739
public import Mathlib.Analysis.Calculus.FDeriv.Prod
@@ -1742,6 +1745,7 @@ public import Mathlib.Analysis.Calculus.FormalMultilinearSeries
17421745
public import Mathlib.Analysis.Calculus.Gradient.Basic
17431746
public import Mathlib.Analysis.Calculus.Implicit
17441747
public import Mathlib.Analysis.Calculus.ImplicitContDiff
1748+
public import Mathlib.Analysis.Calculus.ImplicitFunction.Bivariate
17451749
public import Mathlib.Analysis.Calculus.ImplicitFunction.ProdDomain
17461750
public import Mathlib.Analysis.Calculus.InverseFunctionTheorem.Analytic
17471751
public import Mathlib.Analysis.Calculus.InverseFunctionTheorem.ApproximatesLinearOn
@@ -2974,6 +2978,7 @@ public import Mathlib.CategoryTheory.LocallyCartesianClosed.Over
29742978
public import Mathlib.CategoryTheory.LocallyCartesianClosed.Sections
29752979
public import Mathlib.CategoryTheory.LocallyDirected
29762980
public import Mathlib.CategoryTheory.MarkovCategory.Basic
2981+
public import Mathlib.CategoryTheory.MarkovCategory.Positive
29772982
public import Mathlib.CategoryTheory.Monad.Adjunction
29782983
public import Mathlib.CategoryTheory.Monad.Algebra
29792984
public import Mathlib.CategoryTheory.Monad.Basic
@@ -3074,6 +3079,7 @@ public import Mathlib.CategoryTheory.Monoidal.Rigid.Braided
30743079
public import Mathlib.CategoryTheory.Monoidal.Rigid.Functor
30753080
public import Mathlib.CategoryTheory.Monoidal.Rigid.FunctorCategory
30763081
public import Mathlib.CategoryTheory.Monoidal.Rigid.OfEquivalence
3082+
public import Mathlib.CategoryTheory.Monoidal.Ring
30773083
public import Mathlib.CategoryTheory.Monoidal.Skeleton
30783084
public import Mathlib.CategoryTheory.Monoidal.Subcategory
30793085
public import Mathlib.CategoryTheory.Monoidal.Tor
@@ -3279,6 +3285,7 @@ public import Mathlib.CategoryTheory.Sites.IsSheafFor
32793285
public import Mathlib.CategoryTheory.Sites.JointlySurjective
32803286
public import Mathlib.CategoryTheory.Sites.LeftExact
32813287
public import Mathlib.CategoryTheory.Sites.Limits
3288+
public import Mathlib.CategoryTheory.Sites.LocalProperties
32823289
public import Mathlib.CategoryTheory.Sites.Localization
32833290
public import Mathlib.CategoryTheory.Sites.LocallyBijective
32843291
public import Mathlib.CategoryTheory.Sites.LocallyFullyFaithful
@@ -5614,6 +5621,7 @@ public import Mathlib.NumberTheory.ModularForms.Basic
56145621
public import Mathlib.NumberTheory.ModularForms.BoundedAtCusp
56155622
public import Mathlib.NumberTheory.ModularForms.Bounds
56165623
public import Mathlib.NumberTheory.ModularForms.CongruenceSubgroups
5624+
public import Mathlib.NumberTheory.ModularForms.CuspFormSubmodule
56175625
public import Mathlib.NumberTheory.ModularForms.Cusps
56185626
public import Mathlib.NumberTheory.ModularForms.DedekindEta
56195627
public import Mathlib.NumberTheory.ModularForms.Delta
@@ -6996,6 +7004,7 @@ public import Mathlib.Tactic.ComputeAsymptotics.Multiseries.Basis
69967004
public import Mathlib.Tactic.ComputeAsymptotics.Multiseries.Corecursion
69977005
public import Mathlib.Tactic.ComputeAsymptotics.Multiseries.Defs
69987006
public import Mathlib.Tactic.ComputeAsymptotics.Multiseries.Majorized
7007+
public import Mathlib.Tactic.ComputeAsymptotics.Multiseries.Monomial.Basic
69997008
public import Mathlib.Tactic.ComputeAsymptotics.Multiseries.Monomial.Predicates
70007009
public import Mathlib.Tactic.ComputeDegree
70017010
public import Mathlib.Tactic.CongrExclamation

0 commit comments

Comments
 (0)