Lean 4.22.0 (2025-08-14)
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.
Highlights
Grind is released!
Lean now includes a new SMT-style tactic grind, along with annotations for the Lean standard library.
grind ships theory-specific solvers, including cutsat (superseding omega, with model construction)
and a new Gröbner basis solver.
Also see the chapter on grind in the reference manual.
New compiler
The old compiler has been replaced by the new compiler (#8577)! This closes many long-standing issues, and lays the foundation for many future features and performance improvements.
New math project template
#8866 upgrades the math template for lake init and
lake new to meet rigorous Mathlib maintenance standards.
In comparison with the previous version (now available as lake new ... math-lax), the new template 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.
Signature help
#8511 implements signature help support in the editors. See the demo in the PR description.
Displaying import hierarchy
#8654 (together with #620 for vscode-lean4) adds 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.
Refactor of have/let semantics
TL;DR: nondependent let bindings are now transformed to have bindings for better performance.
Syntax of have and let is unified, and new options are added.
-
#8373 enables transforming nondependent
lets intohaves sosimpworks better without zeta reduction. Disable withset_option cleanup.letToHave false. -
#8804 implements first-class support for nondependent
letexpressions in the elaborator. This has been given full support throughout the metaprogramming interface and the elaborator. -
#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. -
#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. -
#8954 adds a procedure that efficiently transforms
letexpressions intohaveexpressions (Meta.letToHave). This is exposed as thelet_to_havetactic. -
#9086 deprecates
let_funsyntax in favor ofhaveand removesletFunsupport from WHNF andsimp.
Simp
-
Flagging unused
simparguments#8901 adds a linter (
linter.unusedSimpArgs) that complains when a simp argument (simp [foo]) is unused, with a clickable suggestion to remove it. Handles repeated simp calls correctly (e.g., insideall_goals), but skips macros. -
Detection of possibly looping lemmas
#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, 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. -
Faster
simpvia cache reuse#8880 makes
simpconsult its own cache more often, to avoid replicating work. -
Explicit
defeqattribute fordsimp#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.
Named errors with explanations
Lean now supports named error messages with associated explanations.
#8649 and #8730 add macro syntax for registering and throwing named errors, mechanisms for displaying error names in the Infoview and at the command line, and the ability to link to error explanations in the reference manual.
This infrastructure lays the foundation for a searchable error index and improved diagnostics.
finally section
#8723 implements a finally section following a (potentially empty)
where block. where ... finally opens a tactic sequence block in
which the goals are the unassigned metavariables from the definition
body and its auxiliary definitions that arise from use of let rec and
where.
This can be useful for discharging multiple proof obligations in the definition body
by a single invocation of a tactic such as all_goals:
example (i j : Nat) (xs : Array Nat) (hi : i < xs.size) (hj: j < xs.size) := 我与 | 0 => x | _ => xs[i]'?_ + xs[j]'?_ 其中 x := 13 最后all_goals假设
Polymorphic ranges and slices
#8784 introduces new syntax for ranges:
1...*, 1...=3, 1...<3, 1<...=2, *...=3..
#8947 extends this syntax to slices, allowing expressions like xs[*...end].
Library highlights
Notable additions to the standard library are:
Experimental: monadic verification framework
#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 conditions.
Experimental: module system
The new module system (enabled by the module keyword before import statements) is available
for experimentation.
Experimental: sharing oleans between different checkouts of the same repository
#8922 introduces a local artifact cache for Lake. When enabled, Lake
will share build artifacts (built files) across different instances of
the same package using an input- and content-addressed cache. Requires export LAKE_ARTIFACT_CACHE=true for now.
Warnings about sorrys
#8662 adds a warn.sorry option (default true) that logs the
"declaration uses 'sorry'" warning when declarations contain sorryAx.
When false, the warning is not logged.
Breaking changes
-
#8751 adds the
nondepfield ofExpr.letEto the C++ data model.Breaking change:
Expr.updateLet!is renamed toExpr.updateLetE!. -
#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.Breaking change: Since
WithRpcRefis now capable of tracking its identity to decide whichWithRpcRefusage constitutes a reuse, the constructor ofWithRpcRefhas been madeprivateto discourage downstream users from creatingWithRpcRefinstances with manually-setids. Instead,WithRpcRef.mk(which lives inBaseIO) is now the preferred way to createWithRpcRefinstances. -
#8654 adds server-side support for a new module hierarchy component in VS Code.
Breaking change: This PR augments the .ilean format with the direct imports of a file in order to implement the
$/lean/moduleHierarchy/importedByrequest and bumps the .ilean format version. -
#8804 implements first-class support for nondependent
letexpressions in the elaborator.Breaking change: Uses of
letLambdaTelescope/mkLetFVarsneed to usegeneralizeNondepLet := false; see the PR description for more info.
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 type classes 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
例子 (p:Nat → Nat → Prop) (a b c : 纳特) (h : ∀ x, p x a → ∀ y, p y b → x ≠ y) (h₁:p c a) (h2:PCB): 错误 := 通过 磨
caused
grindto produce the incorrect termp ?y a → ∀ y, p y b → 假
The patch eliminates this error, and the following correct simplified theorem is generated
∀ y, p y a → p y b → 假
-
#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 type classes 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 磨 -
#8693 修复了用于连接环和环的表示函数 磨削中的 linarith 模块。
-
#8694 在 linarith 中实现对
One.one的特殊支持 structure is a ordered ring. It also fixes bugs during initialization. -
#8697 实现对
grind线性不等式的支持 算法过程并简化其设计。一些例子可以 已经解决: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 磨 -
#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 磨produces the counterexample
:= 7/2 乙:= 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 := 通过 磨 -
#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 添加了一个用于禁用
grind中的 cutsat 过程的选项。 linarith 模块接管线性整数/nat 约束。例子: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 为
Int.negSucc添加grind归一化定理。例子: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 确保用户提供的
natCast应用程序正确 内化在grinding cutsat模块中。 -
#8777 在交换环模块中实现基本的
Field支持 在grind中。目前只是按数字除法。示例: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 磨
-
#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 docstrings to the
Lean.Grindalgebra type classes, 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 makes 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 type classes, 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 磨
-
#8935 将
+generalize选项添加到let和have语法中。 例如,have +generalize n := a + b; body替换所有实例 精化body时,a + b与n的预期类型相同。这个 可以比作generalize策略的术语版本。一个可以 将此与have +generalize (eq := h) n := a + b; body中的eq结合起来 作为generalize h : n = a + b的类似物。 -
#8937 更改生成的
below的输出 Universe 非自反归纳类型的实现以匹配 #7639 中自反归纳类型的实现。 -
#8940 引入了支持精化的反调引理 使用定义的混合归纳-共归纳谓词
least_fixpoint/greatest_fixpoint构造。 -
#8943 添加了辅助定理,用于标准化半环,但半环不 实施
AddRightCancel。 -
#8953 实现对交换半环标准化的支持 不实现
AddRightCancel。示例: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 < 将 x, y 与 | 0, 0 => 1 | _, _ => x + y := by -- x 或 y 必须大于 0 磨 -
#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.Xtype class 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 conditions (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.ToInttype classes. -
#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 磨
-
#9030 修复了新版本中一些与引导相关的问题 添加了
Std.Do模块。更准确地说, -
#9035 将可接受的字符列表扩展到所有法语字符 以及其他一些人, 通过添加 Latin-1-Suplement 中的字符添加 Latin-Extended-A 统一码块。
-
#9038 添加了 VC 生成器的测试用例并实现了一些小的 以及繁琐的修复以确保它们通过。
-
#9041 使
mspec通过rfl检测更可行的分配,而不是 生成 VC。 -
#9044 调整实验模块系统,使
privatemodule中的默认可见性修饰符,引入public作为新的 改为修饰符。public section可用于恢复默认值 整个部分,尽管这更多的是为了方便逐步采用 新语义,例如在Init(以及很快的Std)中,它们 应由未来逐个 DECL 的可见性重新审查来取代。 -
#9045 修复了
mvcgen中的类型错误,并使其变得不那么自然 目标转换为合成的不透明目标,以便策略例如trivial可以 更容易地实例化它们。 -
#9048 在
ToInt中实现对严格不等式的支持grind cutsat中使用的适配器。例子:example (a b c : Fin 11) : c ≤ 9 → a ≤ b → b < c → a < c + 1 := by grind
-
#9050 确保为每个
toInt a断言ToInt边界 应用程序内置于grind cutsat中。 -
#9051 在
grind 中实现对平等和不平等的支持 切萨特。我们仍然需要改进编码。示例: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 磨
-
#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 改进了
cutsat过程生成的反例 使用ToInt小工具时在grind中。 -
#9067 添加
grind策略的文档字符串。 -
#9069 实现对类型类
LawfulEqCmp的支持。示例: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 磨
-
#9076 为
OfSemiring.toQ添加一个解扩展器。这是一个辅助grind中的ring模块使用的函数,但我们希望减少grind生成的诊断信息混乱。例子:example [CommSemiring α] [AddRightCancel α] [IsCharP α 0] (x y : α) : x^2*y = 1 → x*y^2 = y → x + y = 2 → False := by grind产生
[ring] Ring `Ring.OfSemiring.Q α` ▼ [basis] Basis ▼ [_] ↑x + ↑y + -2 = 0 [_] ↑y + -1 = 0 -
#9086 弃用
let_fun语法,转而使用have并删除 来自 WHNF 和simp的letFun支持。 -
#9087 从
letFun中删除irreducible属性,该属性是 朝着删除特殊letFun支持的方向迈进; #9086 的一部分。
图书馆
-
#8003 为
Async操作添加了新的单子接口。 -
#8072 将 DNS 函数添加到标准库
-
#8109 将系统信息函数添加到标准库
-
#8178 为 sdiv 的 MSB 提供紧凑的公式。大部分的 PR 的工作涉及处理分裂的极端情况 溢出(例如
intMin / -1 = intMin) -
#8203 为无符号和有符号比较添加三分引理, 说明仅可能发生三种情况之一:
x < y,x = y, orx > y(对于有符号和无符号比较)。我们使用 显式参数,以便用户可以编写rcases slt_trichotomy x y 与 hlt |赫克 | hgt。 -
#8205 添加了一个 simpl 引理,可简化 T 除法,其中分子 是
Nat进入 E 分区:@[simp] theorem ofNat_tdiv_eq_ediv {a : Nat} {b : Int} : (a : Int).tdiv b = a / b := tdiv_eq_ediv_of_nonneg (by simp) -
#8210 向树图添加类似于现有的等价关系 一个用于哈希映射。为了最终得到许多同余引理 用于在扩展树图上定义函数,几乎所有 其余的树图函数也已给出引理来将它们联系起来 列出函数,尽管这些函数目前不用于证明引理 除了同余引理之外。
-
#8253 添加了证明所需的
toInt_smod和辅助引理 (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_umod和BitVec.[lt_of_msb_false_of_msb_true, msb_umod_of_msb_false_of_ne_zero,neg_toInt_neg]) -
#8420 提供迭代器组合器
drop,可转换任何 迭代器进入删除第一个n元素的迭代器。 -
#8534 修复了 Windows 上的
IO.FS.realPath,以将符号链接引入 帐户。 -
#8545 提供了推理“等效”迭代器的方法。 简单来说,如果两个迭代器的行为相同,那么它们是等价的 只要消费者不反思自己的状态。
-
#8546 添加新的
BitVec.clz操作和相应的clz电路连接到bv_decide,允许对计数前导零进行位爆破 操作。 AIG 电路与位数呈线性关系 原始表达,使位爆破变得方便。重写。clz在许多编译器内在函数中很常见(请参阅 此处) 和架构(参见 此处)。 -
#8573 避免了
removeDirAll可能出现的意外行为 通过符号链接删除并添加新功能IO.FS.symlinkMetadata。 -
#8585 使引理
BitVec.extractLsb'_append_eq_ite更可用 通过更频繁地使用“简单情况”,并使用这种简化来 使BitVec.extractLsb'_append_eq_of_add_lt更强,将其重命名为BitVec.extractLsb'_append_eq_of_add_le。 -
#8587 调整研磨注释
Std.HashMap.map_fst_toList_eq_keys和变体,因此grind可以推理m.keys和m.toList之间双向。 -
#8590 将
@[grind]添加到getElem?_pos及其变体。 -
#8615 提供特殊的空迭代器类型。虽然它的行为 可以用列表迭代器(例如)来模拟,具有特殊的 type 的优点是更容易为编译器优化。
-
#8620 删除
NatCast (Fin n)全局实例(直接 实例,以及通过Lean.Grind.Semiring的间接实例),因为 instance causesx < n(forx : Fin k,n : Nat) to be 详细说明为x < ↑n而不是↑x < n,这是不可取的。注意事项 然而,在 Mathlib 中,这种情况无论如何都会发生! -
#8629 替换特殊的、更优化的
IteratorLoop实例, 未提供合法性证明,已核实违约 实施。循环/收集实现的专门化 优先级较低,但所有迭代器都具有合法性实例 对于验证很重要。 -
#8631 概括
Std.Sat.AIG. relabel(Nat)_unsat_iff以允许 AIG 类型为空。我们通过证明在 当α为空时,环境并不重要,因为所有 环境α → Bool是同构的。 -
#8640 将
BitVec.setWidth'_eq添加到bv_normalize,使得bv_decide可以减少它并解决涉及setWidth'_eq的引理 -
#8669 使
unsafeBaseIOnoinline。新的编译器更擅长 优化Result类类型,这会导致最终操作 要删除的unsafeBaseIO块,因为unsafeBaseIO是 丢弃状态。 -
#8678 使
isSome_finIdxOf?和isNone_finIdxOf?的 LHS 更 一般。 -
#8703 更正了
DropWhile中的IteratorLoop实例,该实例 先前为任意迭代器类型触发。 -
#8719 添加研磨注释 列表/数组/Vector.eraseP/erase/eraseIdx。它还补充了一些缺失的 引理。
-
#8721 添加类型
Std.ExtDTreeMap、Std.ExtTreeMap和Std.ExtTreeSet扩展树图和集合。这些都是非常 在构造上与现有的扩展哈希映射类似,其中一个 例外:扩展树映射和集合提供来自 常规树图和集合。这是可能的,因为与哈希相比 地图、树图始终是有序的。 -
#8734 添加缺失的实例
instance decidableExistsFin (P : Fin n → Prop) [DecidablePred P] : Decidable (∃ i, P i)
-
#8740 引入了关联规则和保存
(umul, smul, uadd,sadd)溢出标志。 -
#8741 添加注释
List/Array/Vector.find?/findSome?/idxOf?/findIdx?。 -
#8742 修复了单引号字符
Char.ofNat 39的错误 将详细说明为''',如果粘贴回,则会导致解析错误 到源代码。 -
#8745 按顺序将状态谓词
SPred的逻辑添加到Std.Do支持关于一元程序的推理。它配备了专用的 校样模式策略可通过导入访问Std.Tactic.Do。 -
#8747 添加 `List/Array/Vector.finRange` 的研磨注释 定理。
-
#8748 添加
Array/Vector.mapIdx和mapFinIdx的研磨注释 定理。 -
#8749 为
List/Array/Vector.ofFn定理添加研磨注释 额外的List.Impl查找操作。 -
#8750 添加研磨注释
List/Array/Vector.zipWith/zipWithAll/unzip功能。 -
#8765 为
List.Perm添加研磨注释;涉及修订 还对List.countP/count进行研磨注释。 -
#8768 引入了
ForIn'实例和size函数 以最小的方式迭代器。ForIn'实例未标记为 一个实例,因为尚不清楚Membership关系是什么 足够有用。ForIn'实例作为def存在,并且 引入ForIn实例,可以提供更多 专门的ForIn'实例,具有良好的Membership关系,用于 各种类型的迭代器。size函数还没有引理。 -
#8784 引入了多态范围,与 现有的
Std.Range仅支持自然数。 -
#8805 继续为
List/Array/Vector添加grind注释 引理。 -
#8808 添加缺失的
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 + 米。 -
#8811 添加定理
BitVec.(toNat, toInt, toFin)_shiftLeftZeroExtend,完成 APIBitVec.shiftLeftZeroExtend。 -
#8826 更正了
Lean.Grind.NatModule的定义,该定义不是 以前有用。 -
#8827 将
BitVec.getLsb'重命名为BitVec.getLsb,现在更旧了 占用该名称的已弃用定义已被删除。 (同样 适用于BitVec.getMsb'。) -
#8829 避免导入所有
BitVec.Lemmas和BitVec.BitBlast进入UInt.Lemmas。 (它们仍然导入到SInt.Lemmas中;这 似乎更难避免。) -
#8830 重新排列
Init.Grind下的文件,移出实例Init.GrindInstances中的具体代数类型。 -
#8849 为
Sum添加grind注释。 -
#8850 为
Prod添加grind注释。 -
#8851 添加
Function.curry/uncurry的研磨注释。 -
#8852 添加
Nat.testBit和按位运算的研磨注释 在Nat上。 -
#8853 添加与
Nat.fold/foldRev/any/all和Fin.foldl/foldr/foldlM/foldrM上对应的操作List.finRange。 -
#8877 添加研磨注释
List/Array/Vector.attach/attachWith/pmap。 -
#8878 为列表/数组/向量一元函数添加研磨注释。
-
#8886 添加并行的
IO.FS.Stream.readToEndIO.FS.Handle.readToEnd及其上游定义(即readBinToEndInto和readBinToEnd)。它还删除了不必要的partial来自IO.FS.Handle.readBinToEnd。 -
#8887 将
IO.FS.lines概括为IO.FS.Handle.lines并添加 用于流的并行IO.FS.Stream.lines。 -
#8897 简化了一些
simp调用。 -
#8905 使用来自 https://github.com/leanprover/lean4/pull/8901 清理简单 论据。
-
#8920 使用 #8901 中的 linter 来清理更多 simp 参数, 完成#8905。
-
#8928 将状态谓词
SPred的逻辑添加到Std.Do,以便 支持关于一元程序的推理。它配备了专用的 校样模式策略可通过导入访问 标准策略.Do。 -
#8941 添加
BitVec.(getElem, getLsbD, getMsbD)_(smod, sdiv, srem)定理来完成sdiv、srem、smod的 API。尽管 rhs 并不是特别简洁(很难找到它的含义) 意思是“有符号除法/模结果的第n位 操作”),这些引理阻止了unfold操作的需要。 -
#8947 以最基本的形式引入多态切片。他们 带有类似于新范围符号的符号。
Subarray是 现在也是一个切片并且可以生成一个迭代器。其目的是 将Subarray的更多操作迁移到Slice包装类型 也使它们可用于其他类型的切片。 -
#8950 添加
BitVec.toFin_(sdiv, smod, srem)和BitVec.toNat_srem。toFin_*引理的rhs的策略是考虑什么 相应的toNat_*定理使toFin更接近 操作数。对于BitVec.toNat_srem的rhs我使用了相同的 策略为BitVec.toNat_smod。 -
#8967 都为
BitVec添加初始@[grind]注释,并使用grind从BitVec/Lemmas中删除许多校样。 -
#8974 添加
BitVec.msb_(smod, srem)。 -
#8977 添加通用
MonadLiftT Id m实例。我们不实施MonadLift Id m实例,因为它会减慢实例解析速度 因为它会创建更多非规范实例。这个改变 使得迭代纯迭代器成为可能,例如[1, 2, 3].iter,在任意单子中。 -
#8992 添加了
PULift,这是ULift和PLift的更通用形式, 包含两者。 -
#8995 为单子程序引入了霍尔逻辑
Std.Do.Triple, and assorted策略:-
mspec适用于霍尔三重规格 -
mvcgen将霍尔三重证明义务⦃P⦄ prog ⦃Q⦄转变为 纯验证条件(即,没有任何霍尔三元组的痕迹 或最弱的先决条件,例如prog)。由此产生的Std.Do.SPred状态逻辑中的验证条件可以是 使用具有自定义校样模式的策略手动放电 或使用simp和grind等自动化系统。
-
-
#9027 提供一个迭代器组合器,用于提升发出的值 通过
ULift进入更高的 宇宙层级。然后使用这个组合器 使子数组迭代器具有全域多态性。此前,他们 仅适用于Subarray α(如果是α : Type)。 -
#9030 修复了新版本中一些与引导相关的问题 添加了
Std.Do模块。更准确地说, -
#9038 添加了 VC 生成器的测试用例并实现了一些小的 以及繁琐的修复以确保它们通过。
-
#9049 证明默认的
toList、toListRev和toArray切片上的函数可以用切片迭代器来描述。 依赖uLift和attachWith迭代器的新引理 组合器,给出了所述功能的更具体描述Subarray。 -
#9054 更正了
TreeMap/HashMap研磨中的一些不一致之处 注释,适用于isSome_get?_eq_contains和empty_eq_emptyc。 -
#9055 将
Array/Vector.extract_push重命名为extract_push_of_le,并且 将引理替换为没有附加条件的引理。 -
#9058 为切片提供
ToStream实例,以便它们可以 以for i in xs, j in ys do表示法使用。 -
#9075 为
ByteArray和FloatArray添加BEq实例(也是ByteArray的DecidableEq实例)。
编译器
-
#8594 从中删除了 strictOr/strictAnd 的错误优化 旧的编译器,并删除不正确的测试。为了做到 这些优化正确,需要非终止分析。 可以说,表达这些优化的正确方法是公开 将 strictOr/strictAnd 实现到非终止感知阶段 编译器的,然后让它们遵循更一般的 转变。
-
#8595 将新编译器的调用包装在
withoutExporting中。 这对于旧的编译器来说是不必要的,因为它使用更直接的 访问内核环境。 -
#8602 添加了对
Eq.recOn的新编译器的支持(即 旧编译器支持但缺少测试)。 -
#8604 在新版本中添加了对
compiler.extract_closed选项的支持 编译器,因为这是由unsafeBaseIO的定义使用的。我们会 一旦我们切换到新的编译器并重新考虑它,就重新审视这一点 与 IO 的关系。 -
#8614 在新编译器中实现
toNat的常量折叠, 这提高了与旧编译器的奇偶性。 -
#8616 在新编译器中添加了
Nat.pow的常量折叠, 遵循与旧编译器相同的限制。 -
#8618 为
Nat.nextPowerOfTwo实现 LCNF 常量折叠。 -
#8634 使
hasTrivialStructure?对于以下类型返回 false 构造函数具有被删除的类型,例如如果他们建造一个Prop。 -
#8636 添加一个名为
lean_setup_libuv的函数,用于初始化 所需的 LIBUV 组件。它需要在以下范围之外lean_initialize_runtime_module,因为它需要argv和argc才能正常工作。 -
#8647 提高了新编译器
noncomputable的精度 检查预测。没有包含测试,因为虽然这是 从 Mathlib 减少,旧编译器不能正确处理 减少测试用例。我不太清楚检查是否通过 出于正确的原因使用旧编译器。将添加一个测试 新编译器的分支。 -
#8675 提高了新编译器不可计算的精度 检查,特别是关于
noncomputabledefs 的不相关使用 应用程序。 -
#8681 向 LCNF simp pass 添加优化,其中
cases构造的判别式只有在具有 非默认替代方案。 -
#8683 向 LCNF simp pass 添加优化,其中 仅当有任何参数时,单个 alt 情况的判别才被标记为已使用 被使用。
-
#8709 处理
toMonoType中已删除类型的常量。这是很多 为此编写测试用例比您想象的更难,因为大多数 对此类类型的引用之前已替换为lcErased。 -
#8712 将擦除类型的 let decls 优化为擦除值。 专业化可以创建产生 Prop 的局部函数,并且 把它们留在身边是没有意义的。
-
#8716 使已擦除术语的任何类型应用程序都被擦除。这个 在 Lean 的实现中出现的情况比人们预期的要多一些 本身。
-
#8717 使用 fvar 替换机制来替换已擦除的代码。 这并不完全令人满意,因为 LCNF 的
.return不支持 一个通用的Arg(它有一个.erased构造函数),它只支持FVarId。这与 IR.ret形成对比,后者确实支持 一般Arg。 -
#8729 将 LCNF 的
FVarSubst更改为使用Arg而不是Expr。这个 强制执行符合要求的替换要求 在Arg上。 -
#8752 修复了
extendJoinPointContext通行证可以解除的问题 连接包含到顶层的投影的点,作为cases构造对相同基值的其他投影的匹配。 这可以防止structProjCases通道同时投影两者, 延长父值的生命周期并打破线性 运行时。 -
#8754 更改了新版本中计算字段的实现 编译器,它应该能够实现更多优化(并删除
toLCNF中的可疑黑客仅适合启动)。我们 将casesOn转换为cases,就像我们对其他归纳类型所做的那样,所有 构造函数在基础后期被其实际实现所取代 相,然后重写cases表达式以使用实数toMono中的构造函数。 -
#8758 为 LCNF 的
hasTrivialStructure?函数添加缓存 类型。这是新编译器中最热门的小函数之一, 所以添加缓存很有意义。 -
#8764 更改 LCNF 传递管道,因此检查不再由 每次通过后默认,仅在
init、saveBase、toMono和saveMono。这是编译时间的改进,这些的实用性 在决定不再尝试之后,检查有所减少 在整个编译过程中保留类型。他们并没有成为一个重要的 在新编译器的开发过程中发现问题的方法。 -
#8802 修复了
floatLetIn中的一个错误,其中如果一个 decl(例如,一个 join 点)被浮动到一个案例臂中,并且它使用另一个 decl(例如另一个 连接点)在该臂中没有任何其他现有用途,那么 尽管这是完美的,但第二个 decl 并未浮动 合法的。这导致了人为阵列线性问题Lean.Elab.Tactic.BVDecide.LRAT.trim.useAnalysis。 -
#8816 在 LCNF simp 中为 Char.ofNat 添加常量折叠。这个 隐式依赖于
Char作为UInt32的表示 而不是制作一个单独的.char文字类型,这似乎是合理的Char通过toMono中的琐碎结构优化而被擦除。 -
#8822 在 toIR 中添加构造函数信息的缓存。这是要求 所有构造函数、投影和案例替代方案,所以这是有道理的 缓存。
-
#8825 改进了归纳类型构造函数的 IR 生成, 由标量表示。令人惊讶的是,这不是必需的 正确性,因为拳击传球会修复它。额外的
unbox当编译为本机代码时,它插入的操作应该不重要, 因为对于 C 编译器来说优化是微不足道的,但它确实很重要 对于口译员来说。 -
#8831 缓存
lowerEnumToScalarType的结果,以供使用 主要从事 LCNF 到 IR 的转换。 -
#8885 删除了围绕未实现的 C++11 功能的旧解决方法 在线程终结中。
-
#8923 为
Thunk和Task实现casesOn。由于这些是 内置类型,需要在toMono中进行特殊处理。 -
#8952 修复了
never_extract属性的处理 编译器的 CSE 通过。有一场有趣的辩论 编译器到底应该如何努力避免重复任何内容 传递使用never_extract,但这是最简单的形式 并大致匹配旧编译器中的检查(尽管由于 两个编译器中对本地函数 decl 的不同处理, 结果可能略有不同)。 -
#8956 更改
toLCNF以停止缓存表达式的翻译 当看到标记为never_extract的表达式时。这更 粒度比需要的要粗,但是很难做到任何 更好,因为新编译器的Expr缓存是基于结构的 身份(而不是旧编译器的指针身份)。 -
#9003 实现新版本中
main类型的有效性检查 编译器。由于没有对此进行测试,因此它没有受到关注。
漂亮的印刷
-
#7954 改进了
pp.oneline,现在它会在以下情况下保留标签: 将格式化语法截断为一行。请注意,[...]Continuation 尚不具备任何功能来支持查看 未截断的语法。关闭#3681。 -
#8617 修复了 (1) 在以下情况下私有名称未被解析的问题: 它们打印得很漂亮,(2)
pp.universes模式名称中的问题 允许隐藏本地名称,(3)match中的问题 阴影局部变量的模式常量不会使用_root_,并且 (4) 策略可能会出现错误的“尝试这个”问题pp.fullNames已设置。添加更多名称详细测试 未解决。 -
#8626 关闭 #3791,确保语法格式化程序插入 前导和尾随文本中注释前后的空格 语法以避免注释注释掉任何以下语法,并 避免注释的词法语法被解释为是 另一种语法。如果文本在任何内容之前或之后包含换行符 注释,它们被格式化为硬换行符而不是软换行符。 例如,
--注释后将有一个硬换行符。注意: 生成带有注释的语法的元程序应确保包括--注释末尾的换行符。
文档
服务器
-
#8105 添加了对服务器端
RpcRef重用的支持并修复了错误 当文件仍然存在时,InfoView 中的跟踪节点将关闭 正在处理中。 -
#8511 实现签名帮助支持。当输入函数时 应用程序中,支持签名帮助的编辑器现在将显示 指定当前(剩余)函数类型的弹出窗口。这个 无需在键入时记住函数签名 功能应用程序,或者必须在悬停之间不断循环 通过函数标识符并键入应用程序。在 VS 代码中, 可以使用
Ctrl+Shift+Space手动触发签名帮助。 -
#8654 添加了对新模块层次结构组件的服务器端支持 VS Code 可用于导航模块的导入树 以及模块的导入树。具体来说,它实现了新的 请求
$/lean/prepareModuleHierarchy,$/lean/moduleHierarchy/imports和$/lean/moduleHierarchy/importedBy。这些请求不被支持 标准 LSP。同伴公关 leanprover/vscode-lean4#620。 -
#8699 添加了对服务器新模块设置过程的支持 更改
lake setup-file的使用方式。 -
#8868 确保代码操作不必等待完整文件 详细说明。这个回归是在 #7665 中意外引入的。
-
#9019 修复了语义突出显示仅突出显示的错误 以字母数字字符开头的关键字。现在,它使用
Lean.isIdFirst。
Lake
-
#7738 使内置构面的记忆可通过 构面配置上的
memoize选项。内置的方面是 本质上别名(例如,default、o)已被记忆 禁用。 -
#8447 在 Lake 版本的 Lean 模块中使用
lean --setup,并且 添加了对模块生成的新.olean工件的 Lake 支持 系统。 -
#8613 将 Lake 版本语法(更改为
5.0.0-src+<commit>)更改为 确保它是格式良好的 SemVer, -
#8656 在 Lake 数学模板中启用自动隐式。这解决了 新用户有时会设置新的数学项目的问题 形式化,然后很快意识到没有任何代码示例 我们的官方书籍和文档在其使用自动隐式工作 项目。随着[镶嵌提示]的引入 自动隐式](https://github.com/leanprover/lean4/pull/6768),我们 认为自动隐式用户体验足够可用,可以 在数学模板中默认启用。 值得注意的是,此更改不会影响 Mathlib 本身,它将继续 禁用自动隐式。
-
#8701 从
Lake导出Lean命名空间中的LeanOption命名空间。LeanOption在#8447 中从Lean移至Lake,其中 如果没有这个,可能会导致不必要的损坏。 -
#8736 部分恢复 #8024,它引入了重要的 Lake 构建期间的性能回归。一旦发现原因并 已修复,将发布类似的 PR 来恢复此问题。
-
#8846 重新引入了
lean --setup集成到 Lake 中的基础知识 没有仍在进行性能的模块计算 在#8787 中进行调试。 -
#8866 将
lake init和lake new的math模板升级为 配置新项目以满足严格的 Mathlib 维护 标准。与以前的版本相比(现在可用lake new ... math-lax),这会自动提供:-
与 Mathlib 匹配的严格 linting 选项。
-
GitHub 自动升级到较新的 Lean 和 Mathlib 的工作流程 发布。
-
用于工具链升级的自动发布标记。
-
API 文档生成者 doc-gen4 并托管于
github.io。 -
自述文件包含一些 GitHub 特定说明。
-
-
#8922 引入了 Lake 的本地工件缓存。启用后,Lake 将在不同实例之间共享构建工件(构建文件) 使用输入和内容寻址缓存的同一包。
-
#8981 删除了 Lake 对
lean -R和moduleNameOfFileName的使用 将模块名称传递给 Lean。对于工作区名称,它现在依赖于 直接通过lean --setup传递模块名称。对于 非工作区模块传递到lake lean或lake setup-file,它 使用固定模块名称_unknown。 -
#9068 修复了本地 Lake 工件缓存的一些错误并进行了清理 周围的API。它还增加了选择加入缓存的能力 没有使用
enableArtifactCache设置的软件包LAKE_ARTIFACT_CACHE环境变量。 -
#9081 修复了 Lake 中作业监视器位于 顶级构建(例如,
mathlib/Mathlib:default)而不是报告 模块构建进度。 -
#9101 修复了 #9081 引入的源文件被删除的错误 从模块输入跟踪中删除了一些条目 模块作业日志。
其他
-
#8702 增强了 PR 发布工作流程,以创建短格式和 SHA 后缀的发布标签。创建预发布-{PR_NUMBER} 和 pr-release-{PR_NUMBER}-{SHORT_SHA} 标签,生成单独的版本 两种格式,添加单独的 GitHub 状态检查和更新 Batteries/Mathlib 测试分支使用 SHA 后缀标签进行精确测试 提交可追溯性。
-
#8710 将 softprops/action-gh-release 的精确散列固定到
-
#9033 添加了类似 Mathlib 的测试和反馈系统 参考手册。 Lean PR 将收到反映状态的评论 PR 相关的语言参考。
-
#9092 进一步更新发布自动化。每个存储库的更新 脚本
script/release_steps.py现在实际执行测试, 而不是输出脚本供发布管理器逐行运行 线。它已经在v4.21.0上进行了测试(即稳定的简单情况) 发布),今晚我们将在v4.22.0-rc1上调试其行为。