Lean 4.22.0-rc3 (2025-07-04)
For this release, 468 changes landed. In addition to the 185 feature additions and 85 fixes listed below there were 15 refactoring changes, 5 documentation improvements, 4 performance improvements, 0 improvements to the test suite and 174 other changes.
Language
-
#6672 filters out all declarations from
Lean.*,*.Tactic.*, and*.Linter.*from the results ofexact?andrw?. -
#7395 changes the
show ttactic to match its documentation. Previously it was a synonym forchange t, but now it finds the first goal that unifies with the termtand moves it to the front of the goal list. -
#7639 changes the generated
belowandbrecOnimplementations for reflexive inductive types to support motives inSort urather thanType u. -
#8337 adjusts the experimental module system to not export any private declarations from modules.
-
#8373 enables transforming nondependent
lets intohaves in a number of contexts: the bodies of nonrecursive definitions, equation lemmas, smart unfolding definitions, and types of theorems. A motivation for this change is that when zeta reduction is disabled,simpcan only effectively rewritehaveexpressions (e.g.splitusessimpwith zeta reduction disabled), and so we cache the nondependence calculations by transforminglets tohaves. The transformation can be disabled usingset_option cleanup.letToHave false. -
#8387 improves the error messages produced by
endand prevents invalidendcommands from closing scopes on failure. -
#8419 introduces an explicit
defeqattribute to mark theorems that can be used bydsimp. The benefit of an explicit attribute over the prior logic of looking at the proof body is that we can reliably omit theorem bodies across module boundaries. It also helps with intra-file parallelism. -
#8519 makes the equational theorems of non-exposed defs private. If the author of a module chose not to expose the body of their function, then they likely don't want that implementation to leak through equational theorems. Helps with #8419.
-
#8543 adds typeclasses for
grindto embed types intoInt, for cutsat. This allows, for example, treatingFin n, or Mathlib'sℕ+in a uniform and extensible way. -
#8568 modifies the
structureelaborator to add local terminfo for structure fields and explicit parent projections, enabling "go to definition" when there are dependent fields. -
#8574 adds an additional diff mode to the error-message hint suggestion widget that displays diffs per word rather than per character.
-
#8596 makes
guard_msgs.diff=truethe default. The main usage of#guard_msgsis for writing tests, and this makes staring at altered test outputs considerably less tiring. -
#8609 uses
grindto shorten some proofs in the LRAT checker. The intention is not particularly to improve the quality or maintainability of these proofs (although hopefully this is a side effect), but just to givegrinda work out. -
#8619 fixes an internalization (aka preprocessing) issue in
grindwhen applying injectivity theorems. -
#8621 fixes a bug in the equality-resolution procedure used by
grind. The procedure now performs a topological sort so that every simplified theorem declaration is emitted before any place where it is referenced. Previously, applying equality resolution toh : ∀ x, p x a → ∀ y, p y b → x ≠ y
in the example
example (p : Nat → Nat → Prop) (a b c : Nat) (h : ∀ x, p x a → ∀ y, p y b → x ≠ y) (h₁ : p c a) (h₂ : p c b) : False := by grind
caused
grindto produce the incorrect termp ?y a → ∀ y, p y b → False
The patch eliminates this error, and the following correct simplified theorem is generated
∀ y, p y a → p y b → False
-
#8622 adds a test case / use case example for
grind, setting up the very basics ofIndexMap, modelled on Rust'sindexmap. It is not intended as a complete implementation: just enough to exercisegrind. -
#8625 improves the diagnostic information produced by
grindwhen it succeeds. We now include the list of case-splits performed, and the number of application per function symbol. -
#8633 implements case-split tracking in
grind. The information is displayed whengrindfails or diagnostic information is requested. Examples:-
Failure
-
-
#8637 adds background theorems for normalizing
IntModuleexpressions using reflection. -
#8638 improves the diagnostic information produced by
grind. It now sorts the equivalence classes by generation and thenExpr. lt. -
#8639 completes the
ToIntfamily of typeclasses whichgrindwill use to embed types into the integers forcutsat. It contains instances for the usual concrete data types (Fin,UIntX,IntX,BitVec), and is extensible (e.g. for Mathlib'sPNat). -
#8641 adds the
#print sig $identvariant of the#printcommand, which omits the body. This is useful for testing meta-code, in the#guard_msgs (drop trace, all) in #print sig foo
idiom. The benefit over
#checkis that it shows the declaration kind, reducibility attributes (and in the future more built-in attributes, like@[defeq]in #8419). (One downside is that#checkshows unused function parameter names, e.g. in induction principles; this could probably be refined.) -
#8645 adds many helper theorems for the future
IntModulelinear arithmetic procedure ingrind. It also adds helper theorems for normalizing input atoms and support for disequality in the new linear arithmetic procedure ingrind. -
#8650 adds helper theorems for coefficient normalization and equality detection. This theorems are for the linear arithmetic procedure in
grind. -
#8662 adds a
warn.sorryoption (default true) that logs the "declaration uses 'sorry'" warning when declarations containsorryAx. When false, the warning is not logged. -
#8670 adds helper theorems that will be used to interface the
CommRingmodule with the linarith procedure ingrind. -
#8671 allow structures to have non-bracketed binders, making it consistent with
inductive. -
#8677 adds the basic infrastructure for the linarith module in
grind. -
#8680 adds the
reify?anddenoteExprfor the new linarith module ingrind. -
#8682 uses the
CommRingmodule to normalize linarith inequalities. -
#8687 implements the infrastructure for constructing proof terms in the linarith procedure in
grind. It also adds theToExprinstances for the reified objects. -
#8689 implements proof term generation for the
CommRingandlinarithinterface. It also fixes theCommRinghelper theorems. -
#8690 implements the main framework of the model search procedure for the linarith component in grind. It currently handles only inequalities. It can already solve simple goals such as
example [IntModule α] [Preorder α] [IntModule.IsOrdered α] (a b c : α) : a < b → b < c → c < a → False := by grind -
#8693 fixes the denotation functions used to interface the ring and linarith modules in grind.
-
#8694 implements special support for
One.onein linarith when the structure is a ordered ring. It also fixes bugs during initialization. -
#8697 implements support for inequalities in the
grindlinear arithmetic procedure and simplifies its design. Some examples that can already be solved:open Lean.Grind example [IntModule α] [Preorder α] [IntModule.IsOrdered α] (a b c d : α) : a + d < c → b = a + (2:Int)*d → b - d > c → False := by grind -
#8708 fixes an internalization bug in the interface between linarith and ring modules in
grind. TheCommRingmodule may create new terms during normalization. -
#8713 fixes a bug in the commutative ring module used in
grind. It was missing simplification opportunities. -
#8715 implements the basic infrastructure for processing disequalities in the
grind linarithmodule. We still have to implement backtracking. -
#8723 implements a
finallysection following a (potentially empty)whereblock.where ... finallyopens a tactic sequence block in which the goals are the unassigned metavariables from the definition body and its auxiliary definitions that arise from use oflet recandwhere. -
#8730 adds support for throwing named errors with associated error explanations. In particular, it adds elaborators for the syntax defined in #8649, which use the error-explanation infrastructure added in #8651. This includes completions, hovers, and jump-to-definition for error names.
-
#8733 implements disequality splitting and non-chronological backtracking for the
grindlinarith procedure.example [IntModule α] [LinearOrder α] [IntModule.IsOrdered α] (a b c d : α) : a ≤ b → a - c ≥ 0 + d → d ≤ 0 → d ≥ 0 → b = c → a ≠ b → False := by grind -
#8751 adds the
nondepfield ofExpr.letEto the C++ data model. Previously this field has been unused, and in followup PRs the elaborator will use it to encodehaveexpressions (non-dependentlets). The kernel does not verify thatnondepis correctly applied during typechecking. TheletEdelaborator now printshaves whennondepis true, thoughhavestill elaborates asletFunfor now. Breaking change:Expr.updateLet!is renamed toExpr.updateLetE!. -
#8753 fixes a bug in
simpwhere it was not resetting the set of zeta-delta reduced let definitions betweensimpcalls. It also fixes a bug wheresimpwould report zeta-delta reduced let definitions that weren't given as simp arguments (these extraneous let definitions appear due to certain processes temporarily settingzetaDelta := true). This PR also modifies the metaprogramming interface for the zeta-delta tracking functions to be re-entrant and to prevent this kind of no-reset bug from occurring again. Closes #6655. -
#8756 implements counterexamples for grind linarith. Example:
example [CommRing α] [LinearOrder α] [Ring.IsOrdered α] (a b c d : α) : b ≥ 0 → c > b → d > b → a ≠ b + c → a > b + c → a < b + d → False := by grindproduces the counterexample
a := 7/2 b := 1 c := 2 d := 3
-
#8759 implements model-based theory combination for grind linarith. Example:
example [CommRing α] [LinearOrder α] [Ring.IsOrdered α] (f : α → α → α) (x y z : α) : z ≤ x → x ≤ 1 → z = 1 → f x y = 2 → f 1 y = 2 := by grind -
#8763 corrects the handling of explicit
monotonicityproofs for mutualpartial_fixpointdefinitions. -
#8773 implements support for the heterogeneous
(k : Nat) * (a : R)in ordered modules. Example:variable (R : Type u) [IntModule R] [LinearOrder R] [IntModule.IsOrdered R]
-
#8774 adds an option for disabling the cutsat procedure in
grind. The linarith module takes over linear integer/nat constraints. Example:set_option trace.grind.cutsat.assert true in -- cutsat should **not** process the following constraints example (x y z : Int) (h1 : 2 * x < 3 * y) (h2 : -4 * x + 2 * z < 0) : ¬ 12*y - 4* z < 0 := by grind -cutsat -- `linarith` module solves it
-
#8775 adds a
grindnormalization theorem forInt.negSucc. Example:example (p : Int) (n : Nat) (hmp : Int.negSucc (n + 1) + 1 = p) (hnm : Int.negSucc (n + 1 + 1) + 1 = Int.negSucc (n + 1)) : p = Int.negSucc n := by grind -
#8776 ensures that user provided
natCastapplication are properly internalized in the grind cutsat module. -
#8777 implements basic
Fieldsupport in the commutative ring module ingrind. It is just division by numerals for now. Examples:open Lean Grind
-
#8780 makes Lean code generation respect the module name provided through
lean --setup. -
#8786 improves the support for fields in
grind. New supported examples:example [Field α] [IsCharP α 0] (x : α) : x ≠ 0 → (4 / x)⁻¹ * ((3 * x^3) / x)^2 * ((1 / (2 * x))⁻¹)^3 = 18 * x^8 := by grind example [Field α] (a : α) : 2 * a ≠ 0 → 1 / a + 1 / (2 * a) = 3 / (2 * a) := by grind example [Field α] [IsCharP α 0] (a : α) : 1 / a + 1 / (2 * a) = 3 / (2 * a) := by grind example [Field α] [IsCharP α 0] (a b : α) : 2*b - a = a + b → 1 / a + 1 / (2 * a) = 3 / b := by grind example [Field α] [NoNatZeroDivisors α] (a : α) : 1 / a + 1 / (2 * a) = 3 / (2 * a) := by grind example [Field α] {x y z w : α} : x / y = z / w → y ≠ 0 → w ≠ 0 → x * w = z * y := by grind example [Field α] (a : α) : a = 0 → a ≠ 1 := by grind example [Field α] (a : α) : a = 0 → a ≠ 1 - a := by grind -
#8789 implements the Rabinowitsch transformation for
Fielddisequalities ingrind. For example, this transformation is necessary for solving:example [Field α] (a : α) : a^2 = 0 → a = 0 := by grind
-
#8791 ensures the
grind linarithmodule is activated for any type that implements onlyIntModule. That is, the type does not need to be a preorder anymore. -
#8792 makes the
clear_valuetactic preserve the order of variables in the local context. This is done by addingLean.MVarId.withRevertedFrom, which reverts all local variables starting from a given variable, rather than only the ones that depend on it. -
#8794 adds a module
Lean.Util.CollectLooseBVarswith a functionExpr.collectLooseBVarsthat collects the set of loose bound variables in an expression. That is, it computes the set of allisuch thate.hasLooseBVar iis true. -
#8795 ensures that auxliary terms are not internalized by the ring and linarith modules.
-
#8796 fixes
grind linarithterm internalization and support forHSMul. -
#8798 adds the following instance
instance [Field α] [LinearOrder α] [Ring.IsOrdered α] : IsCharP α 0
The goal is to ensure we do not perform unnecessary case-splits in our test suite.
-
#8804 implements first-class support for nondependent let expressions in the elaborator; recall that a let expression
let x : t := v; bis called nondependent iffun x : t => btypechecks, and the notation for a nondependent let expression ishave x := v; b. Previously we encodedhaveusing theletFunfunction, but now we make use of thenondepflag in theExpr.letEconstructor for the encoding. This has been given full support throughout the metaprogramming interface and the elaborator. Key changes to the metaprogramming interface:-
Local context
ldecls withnondep := trueare generally treated ascdecls. This is because in the body of ahaveexpression the variable is opaque. Functions likeLocalDecl.isLetby default returnfalsefor nondependentldecls. In the rare case where it is needed, they take an additional optionalallowNondep : Boolflag (defaults tofalse) if the variable is being processed in a context where the value is relevant. -
Functions such as
mkLetFVarsby default generalize nondependent let variables and create lambda expressions for them. ThegeneralizeNondepLetflag (default true) can be set to false ifhaveexpressions should be produced instead. Breaking change: Uses ofletLambdaTelescope/mkLetFVarsneed to usegeneralizeNondepLet := false. See the next item. -
There are now some mapping functions to make telescoping operations more convenient. See
mapLetTelescopeandmapLambdaLetTelescope. There is alsomapLetDeclas a counterpart towithLetDeclfor creatinglet/haveexpressions. -
Important note about the
generalizeNondepLetflag: it should only be used for variables in a local context that the metaprogram "owns". Since nondependent let variables are treated as constants in most cases, thevaluefield might refer to variables that do not exist, if for example those variables were cleared or reverted. UsingmapLetDeclis always fine. -
The simplifier will cache its let dependence calculations in the nondep field of let expressions.
-
The
introtactic still produces dependent local variables. Given that the simplifier will transform lets into haves, it would be surprising if that would preventintrofrom creating a local variable whose value cannot be used.
-
-
#8809 introduces the basic theory of ordered modules over Nat (i.e. without subtraction), for
grind. We'll solve problems here by embedding them in theIntModuleenvelope. -
#8810 implements equality elimination in
grind linarith. The current implementation supports onlyIntModuleandIntModule+NoNatZeroDivisors -
#8813 adds some basic lemmas about
grindinternal notions of modules. -
#8815 refactors the way simp arguments are elaborated: Instead of changing the
SimpTheoremsstructure as we go, this elaborates each argument to a more declarative description of what it does, and then apply those. This enables more interesting checks of simp arguments that need to happen in the context of the eventually constructed simp context (the checks in #8688), or after simp has run (unused argument linter #8901). -
#8828 extends the experimental module system to support resolving private names imported (transitively) through
import all. -
#8835 defines the embedding of a
CommSemiringinto itsCommRingenvelope, injective when theCommSemiringis cancellative. This will be used bygrindto prove results inNat. -
#8836 generalizes #8835 to the noncommutative case, allowing us to embed a
Lean.Grind.Semiringinto aLean.Grind.Ring. -
#8845 implements the proof-by-reflection infrastructure for embedding semiring terms as ring ones.
-
#8847 relaxes the assumptions for
Lean.Grind.IsCharPfromRingtoSemiring, and provides an alternative constructor for rings. -
#8848 generalizes the internal
grindinstanceinstance [Field α] [LinearOrder α] [Ring.IsOrdered α] : IsCharP α 0
to
instance [Ring α] [Preorder α] [Ring.IsOrdered α] : IsCharP α 0
-
#8855 refactors
Lean.Grind.NatModule/IntModule/Ring.IsOrdered. -
#8859 shows the equivalence between
Lean.Grind.NatModule.IsOrderedandLean.Grind.IntModule.IsOrderedover anIntModule. -
#8865 allows
simpto recognize and warn about simp lemmas that are likely looping in the current simp set. It does so automatically whenever simplification fails with the dreaded “max recursion depth” error fails, but it can be made to do it always withset_option linter.loopingSimpArgs true. This check is not on by default because it is somewhat costly, and can warn about simp calls that still happen to work. -
#8874 skips attempting to compute a module name from the file name and root directory (i.e.,
lean -R) if a name is already provided vialean --setup. -
#8880 makes
simpconsult its own cache more often, to avoid replicating work. -
#8882 adds
@[expose]annotations to terms that appear ingrindproof certificates, sogrindcan be used in the module system. It's possible/likely that I haven't identified all of them yet. -
#8890 adds doc-strings to the
Lean.Grindalgebra typeclasses, as these will appear in the reference manual explaining how to extendgrindalgebra solvers to new types. Also removes some redundant fields. -
#8892 corrects the pretty printing of
grindmodifiers. Previously@[grind →]was being pretty printed as@[grind→ ](Space on the right of the symbol, rather than left.) This fixes the pretty printing of attributes, and preserves the presence of spaces after the symbol in the output ofgrind?. -
#8893 fixes a bug in the
dvdpropagation function in cutsat. -
#8901 adds a linter (
linter.unusedSimpArgs) that complains when a simp argument (simp [foo]) is unused. It should do the right thing if thesimpinvocation is run multiple times, e.g. insideall_goals. It does not trigger when thesimpcall is inside a macro. The linter message contains a clickable hint to remove the simp argument. -
#8903 make sure that the local instance cache calculation applies more reductions. In #2199 there was an issue where metavariables could prevent local variables from being considered as local instances. We use a slightly different approach that ensures that, for example,
lets at the ends of telescopes do not cause similar problems. These reductions were already being calculated, so this does not require any additional work to be done. -
#8909 refactors the
NoNatZeroDivisorsto make sure it will work with the newSemiringsupport. -
#8910 adds the
NoNatZeroDivisorsinstance forOfSemiring.Q α -
#8913 cleans up
grind's internal order typeclasses, removing unnecessary duplication. -
#8914 modifies
letandhaveterm syntaxes to be consistent with each other. Adds configuration options; for example,haveis equivalent tolet +nondep, for nondependent lets. Other options include+usedOnly(forlet_tmp),+zeta(forletI/haveI), and+postponeValue(forlet_delayed). There is alsolet (eq := h) x := v; bfor introducingh : x = vwhen elaboratingb. Theeqoption works for pattern matching as well, for examplelet (eq := h) (x, y) := p; b. -
#8918 fixes the
guard_msgs.diffdefault behavior so that the default specified in the option definition is actually used everywhere. -
#8921 implements support for (commutative) semirings in
grind. It uses the Grothendieck completion to construct a (commutative) ringLean.Grind.Ring.OfSemiring.Q αfrom a (commutative) semiringα. This construction is mostly useful for semirings that implementAddRightCancel α. Otherwise, the functiontoQis not injective. Examples:example (x y : Nat) : x^2*y = 1 → x*y^2 = y → y*x = 1 := by grind
-
#8935 adds the
+generalizeoption to theletandhavesyntaxes. For example,have +generalize n := a + b; bodyreplaces all instances ofa + bin the expected type withnwhen elaboratingbody. This can be likened to a term version of thegeneralizetactic. One can combine this witheqinhave +generalize (eq := h) n := a + b; bodyas an analogue ofgeneralize h : n = a + b. -
#8937 changes the output universe of the generated
belowimplementation for non-reflexive inductive types to match the implementation for reflexive inductive types in #7639. -
#8940 introduces antitonicity lemmas that support the elaboration of mixed inductive-coinductive predicates defined using the
least_fixpoint/greatest_fixpointconstructs. -
#8943 adds helper theorems for normalizing semirings that do not implement
AddRightCancel. -
#8953 implements support for normalization for commutative semirings that do not implement
AddRightCancel. Examples:variable (R : Type u) [CommSemiring R]
-
#8954 adds a procedure that efficiently transforms
letexpressions intohaveexpressions (Meta.letToHave). This is exposed as thelet_to_havetactic. -
#8955 fixes
Lean.MVarId.deltaLocalDecl, which previously replaced the local definition with the target. -
#8957 adds configuration options to the
let/havetactic syntaxes. For example,let (eq := h) x := vaddsh : x = vto the local context. The configuration options are the same as those for thelet/haveterm syntaxes. -
#8958 improves the case splitting strategy used in
grind, and ensuresgrindalso considers simplematch-conditions for case-splitting. Example:example (x y : Nat) : 0 < match x, y with | 0, 0 => 1 | _, _ => x + y := by -- x or y must be greater than 0 grind -
#8959 add instances showing that the Grothendieck (i.e. additive) envelope of a semiring is an ordered ring if the original semiring is ordered (and satisfies ExistsAddOfLE), and in this case the embedding is monotone.
-
#8963 embeds a NatModule into its IntModule completion, which is injective when we have AddLeftCancel, and monotone when the modules are ordered. Also adds some (failing) grind test cases that can be verified once
grinduses this embedding. -
#8964 adds
@[expose]attributes to proof terms constructed bygrindthat need to be evaluated in the kernel. -
#8965 revises @[grind] annotations on Nat bitwise operations.
-
#8968 adds the following features to
simp:-
A routine for simplifying
havetelescopes in a way that avoids quadratic complexity arising from locally nameless expression representations, like what #6220 did forletFuntelescopes. Furthermore, simp convertsletFuns intohaves (nondependent lets), and we remove the #6220 routine since we are moving away fromletFunencodings of nondependent lets. -
A
+letToHaveconfiguration option (enabled by default) that converts lets into haves when possible, when-zetais set. Previously Lean would need to do a full typecheck of the bodies oflets, but theletToHaveprocedure can skip checking some subexpressions, and it modifies thelets in an entire expression at once rather than one at a time. -
A
+zetaHaveconfiguration option, to turn off zeta reduction ofhaves specifically. The motivation is that dependentlets can only be dsimped by let, so zeta reducing just the dependent lets is a reasonable way to make progress. The+zetaHaveoption is also added to the meta configuration. -
When
simpis zeta reducing, it now uses an algorithm that avoids complexity quadratic in the depth of the let telescope. -
Additionally, the zeta reduction routines in
simp,whnf, andisDefEqnow all are consistent with how they apply thezeta,zetaHave, andzetaUnusedconfigurations.
-
-
#8971 fixes
linter.simpUnusedSimpArgsto check the syntax kind, to not fire onsimpcalls behind macros. Fixes #8969 -
#8973 refactors the juggling of universes in the linear
noConfusionTypeconstruction: Instead of usingPUnit.{…} →in the to get the branches ofwithCtorTypeto the same universe level, we usePULift. -
#8978 updates the
solveMonoStepfunction used in themonotonicitytactic to check for definitional equality between the current goal and the monotonicity proof obtained from a recursive call. This ensures soundness by preventing incorrect applications whenLean.Order.PartialOrderinstances differ—an issue that can arise withmutualblocks defined using thepartial_fixpointkeyword, where differentLean.Order.CCPOstructures may be involved. -
#8980 improves the consistency of error message formatting by rendering addenda of several existing error messages as labeled notes and hints.
-
#8983 fixes a bug in congruence proof generation in
grindfor over-applied functions. -
#8986 improves the error messages produced by invalid projections and field notation. It also adds a hint to the "function expected" error message noting the argument to which the term is being applied, which can be helpful for debugging spurious "function expected" messages actually caused by syntax errors.
-
#8991 adds some missing
ToInt.Xtypeclass instances forgrind. -
#8995 introduces a Hoare logic for monadic programs in
Std.Do.Triple, and assorted tactics:-
mspecfor applying Hoare triple specifications -
mvcgento turn a Hoare triple proof obligation⦃P⦄ prog ⦃Q⦄into pure verification conditoins (i.e., without any traces of Hoare triples or weakest preconditions reminiscent ofprog). The resulting verification conditions in the stateful logic ofStd.Do.SPredcan be discharged manually with the tactics coming with its custom proof mode or with automation such assimpandgrind.
-
-
#8996 provides the remaining instances for the
Lean.Grind.ToInttypeclasses. -
#9004 ensures that type-class synthesis failure errors in interpolated strings are displayed at the interpolant at which they occurred.
-
#9005 changes the definition of
Lean.Grind.ToInt.OfNat, introducing awrapon the right-hand-side. -
#9008 implements the basic infrastructure for the generic
ToIntsupport incutsat. -
#9022 completes the generic
toIntinfrastructure for embedding terms implementing theToInttype classes intoInt. -
#9026 implements support for (non strict)
ToIntinequalities ingrind cutsat.grind cutsatcan solve simple problems such as:example (a b c : Fin 11) : a ≤ b → b ≤ c → a ≤ c := by grind
-
#9030 fixes a couple of bootstrapping-related hiccups in the newly added
Std.Domodule. More precisely, -
#9035 extends the list of acceptable characters to all the french ones as well as some others, by adding characters from the Latin-1-Supplement add Latin-Extended-A unicode block.
-
#9038 adds test cases for the VC generator and implements a few small and tedious fixes to ensure they pass.
-
#9041 makes
mspecdetect more viable assignments byrflinstead of generating a VC. -
#9044 adjusts the experimental module system to make
privatethe default visibility modifier inmodules, introducingpublicas a new modifier instead.public sectioncan be used to revert the default for an entire section, though this is more intended to ease gradual adoption of the new semantics such as inInit(and soonStd) where they should be replaced by a future decl-by-decl re-review of visibilities. -
#9045 fixes a type error in
mvcgenand makes it turn fewer natural goals into synthetic opaque ones, so that tactics such astrivialmay instantiate them more easily. -
#9048 implements support for strict inequalities in the
ToIntadapter used ingrind cutsat. Example:example (a b c : Fin 11) : c ≤ 9 → a ≤ b → b < c → a < c + 1 := by grind
-
#9050 ensures the
ToIntbounds are asserted for everytoInt aapplication internalized ingrind cutsat. -
#9051 implements support for equalities and disequalities in
grind cutsat. We still have to improve the encoding. Examples:example (a b c : Fin 11) : a ≤ 2 → b ≤ 3 → c = a + b → c ≤ 5 := by grind
-
#9057 introduces a simple variable-reordering heuristic for
cutsat. It is needed by theToIntadapter to support finite types such asUInt64. The current encoding intoIntproduces large coefficients, which can enlarge the search space when an unfavorable variable order is used. Example:example (a b c : UInt64) : a ≤ 2 → b ≤ 3 → c - a - b = 0 → c ≤ 5 := by grind
-
#9059 adds helper theorems for normalizing coefficients in rings of unknown characteristic.
-
#9062 implements support for equations
<num> = 0in rings and fields of unknown characteristic. Examples:example [Field α] (a : α) : (2 * a)⁻¹ = a⁻¹ / 2 := by grind
-
#9065 improves the counterexamples produced by the
cutsatprocedure ingrindwhen using theToIntgadget. -
#9067 adds a docstring for the
grindtactic. -
#9069 implements support for the type class
LawfulEqCmp. Examples:example (a b c : Vector (List Nat) n) : b = c → a.compareLex (List.compareLex compare) b = o → o = .eq → a = c := by grind -
#9073 copies #9069 to handle
ReflCmpthe same way; we need to call this in propagateUp rather than propagateDown. -
#9074 uses the commutative ring module to normalize nonlinear polynomials in
grind cutsat. Examples:example (a b : Nat) (h₁ : a + 1 ≠ a * b * a) (h₂ : a * a * b ≤ a + 1) : b * a^2 < a + 1 := by grind
-
#9076 adds an unexpander for
OfSemiring.toQ. This an auxiliary function used by theringmodule ingrind, but we want to reduce the clutter in the diagnostic information produced bygrind. Example:example [CommSemiring α] [AddRightCancel α] [IsCharP α 0] (x y : α) : x^2*y = 1 → x*y^2 = y → x + y = 2 → False := by grindproduces
[ring] Ring `Ring.OfSemiring.Q α` ▼ [basis] Basis ▼ [_] ↑x + ↑y + -2 = 0 [_] ↑y + -1 = 0 -
#9086 deprecates
let_funsyntax in favor ofhaveand removesletFunsupport from WHNF andsimp. -
#9087 removes the
irreducibleattribute fromletFun, which is one step toward removing specialletFunsupport; part of #9086.
Library
-
#8003 adds a new monadic interface for
Asyncoperations. -
#8072 adds DNS functions to the standard library
-
#8109 adds system information functions to the standard library
-
#8178 provides a compact formula for the MSB of the sdiv. Most of the work in the PR involves handling the corner cases of division overflowing (e.g.
intMin / -1 = intMin) -
#8203 adds trichotomy lemmas for unsigned and signed comparisons, stating that only one of three cases may happen: either
x < y,x = y, orx > y(for both signed and unsigned comparsions). We use explicit arguments so that users can writercases slt_trichotomy x y with hlt | heq | hgt. -
#8205 adds a simp lemma that simplifies T-division where the numerator is a
Natinto an E-division:@[simp] theorem ofNat_tdiv_eq_ediv {a : Nat} {b : Int} : (a : Int).tdiv b = a / b := tdiv_eq_ediv_of_nonneg (by simp) -
#8210 adds an equivalence relation to tree maps akin to the existing one for hash maps. In order to get many congruence lemmas to eventually use for defining functions on extensional tree maps, almost all of the remaining tree map functions have also been given lemmas to relate them to list functions, although these aren't currently used to prove lemmas other than congruence lemmas.
-
#8253 adds
toInt_smodand auxilliary lemmas necessary for its proof (msb_intMin_umod_neg_of_msb_true,msb_neg_umod_neg_of_msb_true_of_msb_true,toInt_dvd_toInt_iff,toInt_dvd_toInt_iff_of_msb_true_msb_false,toInt_dvd_toInt_iff_of_msb_false_msb_true,neg_toInt_neg_umod_eq_of_msb_true_msb_true,toNat_pos_of_ne_zero,toInt_umod_neg_add,toInt_sub_neg_umodandBitVec.[lt_of_msb_false_of_msb_true, msb_umod_of_msb_false_of_ne_zero,neg_toInt_neg]) -
#8420 provides the iterator combinator
dropthat transforms any iterator into one that drops the firstnelements. -
#8534 fixes
IO.FS.realPathon windows to take symbolic links into account. -
#8545 provides the means to reason about "equivalent" iterators. Simply speaking, two iterators are equivalent if they behave the same as long as consumers do not introspect their states.
-
#8546 adds a new
BitVec.clzoperation and a correspondingclzcircuit tobv_decide, allowing to bitblast the count leading zeroes operation. The AIG circuit is linear in the number of bits of the original expression, making the bitblasting convenient wrt. rewriting.clzis common in numerous compiler intrinsics (see here) and architectures (see here). -
#8573 avoids the likely unexpected behavior of
removeDirAllto delete through symlinks and adds the new functionIO.FS.symlinkMetadata. -
#8585 makes the lemma
BitVec.extractLsb'_append_eq_itemore usable by using the "simple case" more often, and uses this simplification to makeBitVec.extractLsb'_append_eq_of_add_ltstronger, renaming it toBitVec.extractLsb'_append_eq_of_add_le. -
#8587 adjusts the grind annotation on
Std.HashMap.map_fst_toList_eq_keysand variants, sogrindcan reason bidirectionally betweenm.keysandm.toList. -
#8590 adds
@[grind]togetElem?_posand variants. -
#8615 provides a special empty iterator type. Although its behavior can be emulated with a list iterator (for example), having a special type has the advantage of being easier to optimize for the compiler.
-
#8620 removes the
NatCast (Fin n)global instance (both the direct instance, and the indirect one viaLean.Grind.Semiring), as that instance causes causesx < n(forx : Fin k,n : Nat) to be elaborated asx < ↑nrather than↑x < n, which is undesirable. Note however that in Mathlib this happens anyway! -
#8629 replaces special, more optimized
IteratorLoopinstances, for which no lawfulness proof has been made, with the verified default implementation. The specialization of the loop/collect implementations is low priority, but having lawfulness instances for all iterators is important for verification. -
#8631 generalizes
Std.Sat.AIG. relabel(Nat)_unsat_iffto allow the AIG type to be empty. We generalize the proof, by showing that in the case whenαis empty, the environment doesn't matter, since all environmentsα → Boolare isomorphic. -
#8640 adds
BitVec.setWidth'_eqtobv_normalizesuch thatbv_decidecan reduce it and solve lemmas involvingsetWidth'_eq -
#8669 makes
unsafeBaseIOnoinline. The new compiler is better at optimizingResult-like types, which can cause the final operation in anunsafeBaseIOblock to be dropped, sinceunsafeBaseIOis discarding the state. -
#8678 makes the LHS of
isSome_finIdxOf?andisNone_finIdxOf?more general. -
#8703 corrects the
IteratorLoopinstance inDropWhile, which previously triggered for arbitrary iterator types. -
#8719 adds grind annotations for List/Array/Vector.eraseP/erase/eraseIdx. It also adds some missing lemmas.
-
#8721 adds the types
Std.ExtDTreeMap,Std.ExtTreeMapandStd.ExtTreeSetof extensional tree maps and sets. These are very similar in construction to the existing extensional hash maps with one exception: extensional tree maps and sets provide all functions from regular tree maps and sets. This is possible because in contrast to hash maps, tree maps are always ordered. -
#8734 adds the missing instance
instance decidableExistsFin (P : Fin n → Prop) [DecidablePred P] : Decidable (∃ i, P i)
-
#8740 introduces associativity rules and preservation of
(umul, smul, uadd, sadd)Overflowflags. -
#8741 adds annotations for
List/Array/Vector.find?/findSome?/idxOf?/findIdx?. -
#8742 fixes a bug where the single-quote character
Char.ofNat 39would delaborate as''', which causes a parse error if pasted back in to the source code. -
#8745 adds a logic of stateful predicates
SPredtoStd.Doin order to support reasoning about monadic programs. It comes with a dedicated proof mode the tactics of which are accessible by importingStd.Tactic.Do. -
#8747 adds grind annotations for `List/Array/Vector.finRange` theorems.
-
#8748 adds grind annotations for
Array/Vector.mapIdxandmapFinIdxtheorems. -
#8749 adds grind annotations for
List/Array/Vector.ofFntheorems and additionalList.Implfind operations. -
#8750 adds grind annotations for the
List/Array/Vector.zipWith/zipWithAll/unzipfunctions. -
#8765 adds grind annotations for
List.Perm; involves a revision of grind annotations forList.countP/countas well. -
#8768 introduces a
ForIn'instance and asizefunction for iterators in a minimal fashion. TheForIn'instance is not marked as an instance because it is unclear whichMembershiprelation is sufficiently useful. TheForIn'instance existing as adefand inducing theForIninstance, it becomes possible to provide more specializedForIn'instances, with niceMembershiprelations, for various types of iterators. Thesizefunction has no lemmas yet. -
#8784 introduces ranges that are polymorphic, in contrast to the existing
Std.Rangewhich only supports natural numbers. -
#8805 continues adding
grindannotations forList/Array/Vectorlemmas. -
#8808 adds the missing
le_of_add_left_le {n m k : Nat} (h : k + n ≤ m) : n ≤ mandle_add_left_of_le {n m k : Nat} (h : n ≤ m) : n ≤ k + m. -
#8811 adds theorems
BitVec.(toNat, toInt, toFin)_shiftLeftZeroExtend, completing the API forBitVec.shiftLeftZeroExtend. -
#8826 corrects the definition of
Lean.Grind.NatModule, which wasn't previously useful. -
#8827 renames
BitVec.getLsb'toBitVec.getLsb, now that older deprecated definition occupying that name has been removed. (Similarly forBitVec.getMsb'.) -
#8829 avoids importing all of
BitVec.LemmasandBitVec.BitBlastintoUInt.Lemmas. (They are still imported intoSInt.Lemmas; this seems much harder to avoid.) -
#8830 rearranges files under
Init.Grind, moving out instances for concrete algebraic types inInit.GrindInstances. -
#8849 adds
grindannotations forSum. -
#8850 adds
grindannotations forProd. -
#8851 adds grind annotations for
Function.curry/uncurry. -
#8852 adds grind annotations for
Nat.testBitand bitwise operations onNat. -
#8853 adds
grindannotations relatingNat.fold/foldRev/any/allandFin.foldl/foldr/foldlM/foldrMto the corresponding operations onList.finRange. -
#8877 adds grind annotations for
List/Array/Vector.attach/attachWith/pmap. -
#8878 adds grind annotations for List/Array/Vector monadic functions.
-
#8886 adds
IO.FS.Stream.readToEndwhich parallelsIO.FS.Handle.readToEndalong with its upstream definitions (i.e.,readBinToEndIntoandreadBinToEnd). It also removes an unnecessarypartialfromIO.FS.Handle.readBinToEnd. -
#8887 generalizes
IO.FS.lineswithIO.FS.Handle.linesand adds the parallelIO.FS.Stream.linesfor streams. -
#8897 simplifies some
simpcalls. -
#8905 uses the linter from https://github.com/leanprover/lean4/pull/8901 to clean up simp arguments.
-
#8920 uses the linter from #8901 to clean up more simp arguments, completing #8905.
-
#8928 adds a logic of stateful predicates SPred to Std.Do in order to support reasoning about monadic programs. It comes with a dedicated proof mode the tactics of which are accessible by importing Std.Tactic.Do.
-
#8941 adds
BitVec.(getElem, getLsbD, getMsbD)_(smod, sdiv, srem)theorems to complete the API forsdiv,srem,smod. Even though the rhs is not particularly succint (it's hard to find a meaning for what it means to have "the n-th bit of the result of a signed division/modulo operation"), these lemmas prevent the need tounfoldof operations. -
#8947 introduces polymorphic slices in their most basic form. They come with a notation similar to the new range notation.
Subarrayis now also a slice and can produce an iterator now. It is intended to migrate more operations ofSubarrayto theSlicewrapper type to make them available for slices of other types, too. -
#8950 adds
BitVec.toFin_(sdiv, smod, srem)andBitVec.toNat_srem. The strategy for therhsof thetoFin_*lemmas is to consider what the correspondingtoNat_*theorems do and push thetoFincloserto the operands. For therhsofBitVec.toNat_sremI used the same strategy asBitVec.toNat_smod. -
#8967 both adds initial
@[grind]annotations forBitVec, and usesgrindto remove many proofs fromBitVec/Lemmas. -
#8974 adds
BitVec.msb_(smod, srem). -
#8977 adds a generic
MonadLiftT Id minstance. We do not implement aMonadLift Id minstance because it would slow down instance resolution and because it would create more non-canonical instances. This change makes it possible to iterate over a pure iterator, such as[1, 2, 3].iter, in arbitrary monads. -
#8992 adds
PULift, a more general form ofULiftandPLiftthat subsumes both. -
#8995 introduces a Hoare logic for monadic programs in
Std.Do.Triple, and assorted tactics:-
mspecfor applying Hoare triple specifications -
mvcgento turn a Hoare triple proof obligation⦃P⦄ prog ⦃Q⦄into pure verification conditoins (i.e., without any traces of Hoare triples or weakest preconditions reminiscent ofprog). The resulting verification conditions in the stateful logic ofStd.Do.SPredcan be discharged manually with the tactics coming with its custom proof mode or with automation such assimpandgrind.
-
-
#9027 provides an iterator combinator that lifts the emitted values into a higher universe level via
ULift. This combinator is then used to make the subarray iterators universe-polymorphic. Previously, they were only available forSubarray αifα : Type. -
#9030 fixes a couple of bootstrapping-related hiccups in the newly added
Std.Domodule. More precisely, -
#9038 adds test cases for the VC generator and implements a few small and tedious fixes to ensure they pass.
-
#9049 proves that the default
toList,toListRevandtoArrayfunctions on slices can be described in terms of the slice iterator. Relying on new lemmas for theuLiftandattachWithiterator combinators, a more concrete description of said functions is given forSubarray. -
#9054 corrects some inconsistencies in
TreeMap/HashMapgrind annotations, forisSome_get?_eq_containsandempty_eq_emptyc. -
#9055 renames
Array/Vector.extract_pushtoextract_push_of_le, and replaces the lemma with one without a side condition. -
#9058 provides a
ToStreaminstance for slices so that they can be used infor i in xs, j in ys donotation. -
#9075 adds
BEqinstances forByteArrayandFloatArray(also aDecidableEqinstance forByteArray).
Compiler
-
#8594 removes incorrect optimizations for strictOr/strictAnd from the old compiler, along with deleting an incorrect test. In order to do these optimizations correctly, nontermination analysis is required. Arguably, the correct way to express these optimizations is by exposing the implementation of strictOr/strictAnd to a nontermination-aware phase of the compiler, and then having them follow from more general transformations.
-
#8595 wraps the invocation of the new compiler in
withoutExporting. This is not necessary for the old compiler because it uses more direct access to the kernel environment. -
#8602 adds support to the new compiler for
Eq.recOn(which is supported by the old compiler but missing a test). -
#8604 adds support for the
compiler.extract_closedoption to the new compiler, since this is used by the definition ofunsafeBaseIO. We'll revisit this once we switch to the new compiler and rethink its relationship with IO. -
#8614 implements constant folding for
toNatin the new compiler, which improves parity with the old compiler. -
#8616 adds constant folding for
Nat.powto the new compiler, following the same limits as the old compiler. -
#8618 implements LCNF constant folding for
Nat.nextPowerOfTwo. -
#8634 makes
hasTrivialStructure?return false for types whose constructors have types that are erased, e.g. if they construct aProp. -
#8636 adds a function called
lean_setup_libuvthat initializes required LIBUV components. It needs to be outside oflean_initialize_runtime_modulebecause it requiresargvandargcto work correctly. -
#8647 improves the precision of the new compiler's
noncomputablecheck for projections. There is no test included because while this was reduced from Mathlib, the old compiler does not correctly handle the reduced test case. It's not entirely clear to me if the check is passing with the old compiler for correct reasons. A test will be added to the new compiler's branch. -
#8675 increases the precision of the new compiler's non computable check, particularly around irrelevant uses of
noncomputabledefs in applications. -
#8681 adds an optimization to the LCNF simp pass where the discriminant of a
casesconstruct will only be mark used if it has a non-default alternative. -
#8683 adds an optimization to the LCNF simp pass where the discriminant of a single-alt cases is only marked as used if any param is used.
-
#8709 handles constants with erased types in
toMonoType. It is much harder to write a test case for this than you would think, because most references to such types get replaced withlcErasedearlier. -
#8712 optimizes let decls of an erased type to an erased value. Specialization can create local functions that produce a Prop, and there's no point in keeping them around.
-
#8716 makes any type application of an erased term to be erased. This comes up a bit more than one would expect in the implementation of Lean itself.
-
#8717 uses the fvar substitution mechanism to replace erased code. This isn't entirely satisfactory, since LCNF's
.returndoesn't support a generalArg(which has a.erasedconstructor), it only supports anFVarId. This is in contrast to the IR.ret, which does support a generalArg. -
#8729 changes LCNF's
FVarSubstto useArgrather thanExpr. This enforces the requirements on substitutions, which match the requirements onArg. -
#8752 fixes an issue where the
extendJoinPointContextpass can lift join points containing projections to the top level, as siblings ofcasesconstructs matching on other projections of the same base value. This prevents thestructProjCasespass from projecting both at once, extending the lifetime of the parent value and breaking linearity at runtime. -
#8754 changes the implementation of computed fields in the new compiler, which should enable more optimizations (and remove a questionable hack in
toLCNFthat was only suitable for bringup). We convertcasesOntocaseslike we do for other inductive types, all constructors get replaced by their real implementations late in the base phase, and then thecasesexpression is rewritten to use the real constructors intoMono. -
#8758 adds caching for the
hasTrivialStructure?function for LCNF types. This is one of the hottest small functions in the new compiler, so adding a cache makes a lot of sense. -
#8764 changes the LCNF pass pipeline so checks are no longer run by default after every pass, only after
init,saveBase,toMonoandsaveMono. This is a compile time improvement, and the utility of these checks is decreased a bit after the decision to no longer attempt to preserve types throughout compilation. They have not been a significant way to discover issues during development of the new compiler. -
#8802 fixes a bug in
floatLetInwhere if one decl (e.g. a join point) is floated into a case arm and it uses another decl (e.g. another join point) that does not have any other existing uses in that arm, then the second decl does not get floated in despite this being perfectly legal. This was causing artificial array linearity issues inLean.Elab.Tactic.BVDecide.LRAT.trim.useAnalysis. -
#8816 adds constant folding for Char.ofNat in LCNF simp. This implicitly relies on the representation of
CharasUInt32rather than making a separate.charliteral type, which seems reasonable asCharis erased by the trivial structure optimization intoMono. -
#8822 adds a cache for constructor info in toIR. This is called for all constructors, projections, and cases alternatives, so it makes sense to cache.
-
#8825 improves IR generation for constructors of inductive types that are represented by scalars. Surprisingly, this isn't required for correctness, because the boxing pass will fix it up. The extra
unboxoperation it inserts shouldn't matter when compiling to native code, because it's trivial for a C compiler to optimize, but it does matter for the interpreter. -
#8831 caches the result of
lowerEnumToScalarType, which is used heavily in LCNF to IR conversion. -
#8885 removes an old workaround around non-implemented C++11 features in the thread finalization.
-
#8923 implements
casesOnforThunkandTask. Since these are builtin types, this needs to be special-cased intoMono. -
#8952 fixes the handling of the
never_extractattribute in the compiler's CSE pass. There is an interesting debate to be had about exactly how hard the compiler should try to avoid duplicating anything that transitively usesnever_extract, but this is the simplest form and roughly matches the check in the old compiler (although due to different handling of local function decls in the two compilers, the consequences might be slightly different). -
#8956 changes
toLCNFto stop caching translations of expressions upon seeing an expression markednever_extract. This is more coarse-grained than it needs to be, but it is difficult to do any better, as the new compiler'sExprcache is based on structural identity (rather than the pointer identity of the old compiler). -
#9003 implements the validity check for the type of
mainin the new compiler. There were no tests for this, so it slipped under the radar.
Pretty Printing
-
#7954 improves
pp.oneline, where it now preserves tags when truncating formatted syntax to a single line. Note that the[...]continuation does not yet have any functionality to enable seeing the untruncated syntax. Closes #3681. -
#8617 fixes (1) an issue where private names are not unresolved when they are pretty printed, (2) an issue where in
pp.universesmode names were allowed to shadow local names, (3) an issue where inmatchpatterns constants shadowing locals wouldn't use_root_, and (4) an issue where tactics might have an incorrect "try this" whenpp.fullNamesis set. Adds more delaboration tests for name unresolution. -
#8626 closes #3791, making sure that the Syntax formatter inserts whitespace before and after comments in the leading and trailing text of Syntax to avoid having comments comment out any following syntax, and to avoid comments' lexical syntax from being interpreted as being part of another syntax. If the text contains newlines before or after any comments, they are formatted as hard newlines rather than soft newlines. For example,
--comments will have a hard newline after them. Note: metaprograms generating Syntax with comments should be sure to include newlines at the ends of--comments.
Documentation
-
#8934 adds explanations for a few errors concerning noncomputability, redundant match alternatives, and invalid inductive declarations.
-
#8990 adds missing doc-strings for grind's internal algebra typeclasses, for inclusion in the reference manual.
-
#8998 makes the docstrings related to
FormatandReprhave consistent formatting and style, and adds missing docstrings.
Server
-
#8105 adds support for server-sided
RpcRefreuse and fixes a bug where trace nodes in the InfoView would close while the file was still being processed. -
#8511 implements signature help support. When typing a function application, editors with support for signature help will now display a popup that designates the current (remaining) function type. This removes the need to remember the function signature while typing the function application, or having to constantly cycle between hovering over the function identifier and typing the application. In VS Code, the signature help can be triggered manually using
Ctrl+Shift+Space. -
#8654 adds server-side support for a new module hierarchy component in VS Code that can be used to navigate both the import tree of a module and the imported-by tree of a module. Specifically, it implements new requests
$/lean/prepareModuleHierarchy,$/lean/moduleHierarchy/importsand$/lean/moduleHierarchy/importedBy. These requests are not supported by standard LSP. Companion PR at leanprover/vscode-lean4#620. -
#8699 adds support to the server for the new module setup process by changing how
lake setup-fileis used. -
#8868 ensures that code actions do not have to wait for the full file to elaborate. This regression was accidentally introduced in #7665.
-
#9019 fixes a bug where semantic highlighting would only highlight keywords that started with an alphanumeric character. Now, it uses
Lean.isIdFirst.
Lake
-
#7738 makes memoization of built-in facets toggleable through a
memoizeoption on the facet configuration. Built-in facets which are essentially aliases (e.g.,default,o) have had memoization disabled. -
#8447 makes use of
lean --setupin Lake builds of Lean modules and adds Lake support for the new.oleanartifacts produced by the module system. -
#8613 changes the Lake version syntax (to
5.0.0-src+<commit>) to ensure it is a well-formed SemVer, -
#8656 enables auto-implicits in the Lake math template. This resolves an issue where new users sometimes set up a new project for math formalization and then quickly realize that none of the code samples in our official books and docs that use auto-implicits work in their projects. With the introduction of inlay hints for auto-implicits, we consider the auto-implicit UX to be sufficiently usable that they can be enabled by default in the math template. Notably, this change does not affect Mathlib itself, which will proceed to disable auto-implicits.
-
#8701 exports
LeanOptionin theLeannamespace from theLakenamespace.LeanOptionwas moved fromLeantoLakein #8447, which can cause unnecessary breakage without this. -
#8736 partially reverts #8024 which introduced a significant Lake performance regression during builds. Once the cause is discovered and fixed, a similar PR will be made to revert this.
-
#8846 reintroduces the basics of
lean --setupintegration into Lake without the module computation which is still undergoing performance debugging in #8787. -
#8866 upgrades the
mathtemplate forlake initandlake newto configures the new project to meet rigorous Mathlib maintenance standards. In comparison with the previous version (now available aslake new ... math-lax), this automatically provides:-
Strict linting options matching Mathlib.
-
GitHub workflow for automatic upgrades to newer Lean and Mathlib releases.
-
Automatic release tagging for toolchain upgrades.
-
API documentation generated by doc-gen4 and hosted on
github.io. -
README with some GitHub-specific instructions.
-
-
#8922 introduces a local artifact cache for Lake. When enabled, Lake will shared build artifacts (built files) across different instances of the same package using an input- and content-addressed cache.
-
#8981 removes Lake's usage of
lean -RandmoduleNameOfFileNameto pass module names to Lean. For workspace names, it now relies on directly passing the module name throughlean --setup. For non-workspace modules passed tolake leanorlake setup-file, it uses a fixed module name of_unknown. -
#9068 fixes some bugs with the local Lake artifact cache and cleans up the surrounding API. It also adds the ability to opt-in to the cache on packages without
enableArtifactCacheset using theLAKE_ARTIFACT_CACHEenvironment variable. -
#9081 fixes a bug with Lake where the job monitor would sit on a top-level build (e.g.,
mathlib/Mathlib:default) instead of reporting module build progress. -
#9101 fixes a bug introduce by #9081 where the source file was dropped from the module input trace and some entries were dropped from the module job log.
Other
-
#8702 enhances the PR release workflow to create both short format and SHA-suffixed release tags. Creates both pr-release-{PR_NUMBER} and pr-release-{PR_NUMBER}-{SHORT_SHA} tags, generates separate releases for both formats, adds separate GitHub status checks, and updates Batteries/Mathlib testing branches to use SHA-suffixed tags for exact commit traceability.
-
#8710 pins the precise hash of softprops/action-gh-release to
-
#9033 adds a Mathlib-like testing and feedback system for the reference manual. Lean PRs will receive comments that reflect the status of the language reference with respect to the PR.
-
#9092 further updates release automation. The per-repository update scripts
script/release_steps.pynow actually performs the tests, rather than outputting a script for the release manager to run line by line. It's been tested onv4.21.0(i.e. the easy case of a stable release), and we'll debug its behaviour onv4.22.0-rc1tonight.