Lean 4.25.0-rc2 (2025-10-22)
For this release, 398 changes landed. In addition to the 141 feature additions and 83 fixes listed below there were 21 refactoring changes, 9 documentation improvements, 4 performance improvements, 5 improvements to the test suite and 135 other changes.
-
#10483 completes support for injective functions in grind. See examples:
/-! Add some injectivity theorems. -/ def double (x : Nat) := 2*x @[grind inj] theorem double_inj : Function.Injective double := by grind [Function.Injective, double] structure InjFn (α : Type) (β : Type) where f : α → β h : Function.Injective f instance : CoeFun (InjFn α β) (fun _ => α → β) where coe s := s.f @[grind inj] theorem fn_inj (F : InjFn α β) : Function.Injective (F : α → β) := by grind [Function.Injective, cases InjFn] def toList (a : α) : List α := [a] @[grind inj] theorem toList_inj : Function.Injective (toList : α → List α) := by grind [Function.Injective, toList] /-! Examples -/ example (x y : Nat) : toList (double x) = toList (double y) → x = y := by grind example (f : InjFn (List Nat) α) (x y z : Nat) : f (toList (double x)) = f (toList y) → y = double z → x = z := by grind -
#10486 adds and expands
grindrelated docstrings. -
#10529 adds some helper theorems for the upcoming
grind ordersolver. -
#10553 implements infrastructure for the new
grind ordermodule. -
#10562 simplifies the
grind ordermodule, and internalizes the order constraints. It removes theOffsettype class because it introduced too much complexity. We now cover the same use cases with a simpler approach:-
Any type that implements at least
Std.IsPreorder -
Arbitrary ordered rings.
-
Natby theNat.ToIntadapter.
-
-
#10583 allows users to declare additional
grindconstraint propagators for declarations that already include propagators in core. -
#10589 adds helper theorems for implementing
grind order -
#10590 implements proof term construction for
grind order. -
#10594 implements proof construction for theory propagation in
grind order. -
#10596 implements the function for adding new edges to the graph used by
grind order. The graph maintains the transitive closure of all asserted constraints. -
#10598 implements support for positive constraints in
grind order. The new module can already solve problems such as:example [LE α] [LT α] [Std.LawfulOrderLT α] [Std.IsPreorder α] (a b c : α) : a ≤ b → b ≤ c → c < a → False := by grind example [LE α] [LT α] [Std.LawfulOrderLT α] [Std.IsPreorder α] (a b c d : α) : a ≤ b → b ≤ c → c < d → d ≤ a → False := by grind example [LE α] [Std.IsPreorder α] (a b c : α) : a ≤ b → b ≤ c → a ≤ c := by grind example [LE α] [Std.IsPreorder α] (a b c d : α) : a ≤ b → b ≤ c → c ≤ d → a ≤ d := by grind -
#10599 fixes the support for
Natingrind order. This module uses theNat.ToIntadapter. -
#10600 implements support for negative constraints in
grind order. Examples:open Lean Grind example [LE α] [LT α] [Std.LawfulOrderLT α] [Std.IsLinearPreorder α] (a b c d : α) : a ≤ b → ¬ (c ≤ b) → ¬ (d ≤ c) → d < a → False := by grind -linarith (splits := 0) example [LE α] [Std.IsLinearPreorder α] (a b c d : α) : a ≤ b → ¬ (c ≤ b) → ¬ (d ≤ c) → ¬ (a ≤ d) → False := by grind -linarith (splits := 0) example [LE α] [LT α] [Std.LawfulOrderLT α] [Std.IsLinearPreorder α] [CommRing α] [OrderedRing α] (a b c d : α) : a - b ≤ 5 → ¬ (c ≤ b) → ¬ (d ≤ c + 2) → d ≤ a - 8 → False := by grind -linarith (splits := 0) -
#10601 fixes a panic in
grind orderwhen order is not a partial order. -
#10604 implements the method
processNewEqingrind order. It is responsible for processing equalities propagated by thegrindE-graph.
-
#10607 adds infrastructure for the upcoming
grindtactic mode, which will be similar to theconvmode. The goal is to extendgrindfrom a terminal tactic into an interactive mode:grind => …. -
#10677 implements the basic tactics for the new
grindinteractive mode. While many additionalgrindtactics will be added later, the foundational framework is already operational. The followinggrindtactics are currently implemented:skip,done,finish,lia, andring. also removes the notion ofgrindfallback procedure since it is subsumed by the new framework. Examples:example (x y : Nat) : x ≥ y + 1 → x > 0 := by grind => skip; lia; done
-
#10679 fixes an issue where "Invalid alternative name" errors from
inductionstick around after removing the offending alternative. -
#10690 adds the
instantiate,show_true,show_false,show_asserted, andshow_eqcstactics for thegrindinteractive mode. Theshowtactic take an optional "filter" and are used to probe thegrindstate. Example:example (as bs cs : Array α) (v₁ v₂ : α) (i₁ i₂ j : Nat) (h₁ : i₁ < as.size) (h₂ : bs = as.set i₁ v₁) (h₃ : i₂ < bs.size) (h₃ : cs = bs.set i₂ v₂) (h₄ : i₁ ≠ j ∧ i₂ ≠ j) (h₅ : j < cs.size) (h₆ : j < as.size) : cs[j] = as[j] := by grind => instantiate -- Display asserted facts with `generation > 0` show_asserted gen > 0 -- Display propositions known to be `True`, containing `j`, and `generation > 0` show_true j && gen > 0 -- Display equivalence classes with terms that contain `as` or `bs` show_eqcs as || bs instantiate -
#10695 fixes an issue where non-
macromembers of amutualblock were discarded if there was at least one macro present. -
#10706 adds the
havetactic for thegrindinteractive mode. Example:example {a b c d e : Nat} : a > 0 → b > 0 → 2*c + e <= 2 → e = d + 1 → a*b + 2 > 2*c + d := by grind => have : a*b > 0 := Nat.mul_pos h h_1 lia -
#10707 ensures the
finishtactic ingrindinteractive mode fails and reports diagnostics when goal is not closed. -
#10709 implements anchors (also known as stable hash codes) for referencing terms occurring in a
grindgoal. It also introduces the commandsshow_splitsandshow_state. The former displays the anchors for candidate case splits in the currentgrindgoal. -
#10715 improves anchor stability (aka stable hash codes) used to reference terms in a
grindgoal.
-
#10731 adds the following tactics to the
grindinteractive mode:-
focus <grind_tac_seq> -
next => <grind_tac_seq> -
any_goals <grind_tac_seq> -
all_goals <grind_tac_seq> -
grind_tac <;> grind_tac -
cases <anchor> -
tactic => <tac_seq>
-
-
#10737 adds the tactics
linarith,ac,fail,first,try,fail_if_success, andadmittogrindinteractive mode. -
#10740 improves the tactics
ac,linarith,lia,ringtactics ingrindinteractive mode. They now fail if no progress has been made. They also generate an info message with counterexample/basis if the goal was not closed. -
#10746 implements parameters for the
instantiatetactic in thegrindinteractive mode. Users can now select both global and local theorems. Local theorems are selected using anchors. It also adds theshow_thmstactic for displaying local theorems. Example:example (as bs cs : Array α) (v₁ v₂ : α) (i₁ i₂ j : Nat) (h₁ : i₁ < as.size) (h₂ : bs = as.set i₁ v₁) (h₃ : i₂ < bs.size) (h₃ : cs = bs.set i₂ v₂) (h₄ : i₁ ≠ j ∧ i₂ ≠ j) (h₅ : j < cs.size) (h₆ : j < as.size) : cs[j] = as[j] := by grind => instantiate = Array.getElem_set instantiate Array.getElem_set
-
#10747 implements infrastructure for
finish?andgrind?tactics. -
#10748 implements the
repeattactical for thegrindinteractive mode. -
#10767 implements the new control interface for implementing
grindsearch strategies. It will replace theSearchMframework. -
#10778 ensures that
grindinteractive mode is hygienic. It also adds tactics for renaming inaccessible names:rename_i h_1 ... h_nandnext h_1 ... h_n => .., andexpose_namesfor automatically generated tactic scripts. The PR also adds helper functions for implementing case-split actions. -
#10779 implements hover information for
grindanchors. Anchors are stable hash codes for referencing terms in the grind state. The anchors will be used when auto generating tactic scripts. -
#10791 adds a silent info message with the
grindstate in its interactive mode. The message is shown only when there is exactly one goal in the grind interactive mode. The condition is a workaround for current limitations of ourInfoTree. -
#10798 implements the
grindactionsintro,intros,assertNext,assertAll. -
#10801 implements the
splitNextaction forgrind. -
#10808 implements support for compressing auto-generated
grindtactic sequences.
-
#10811 implements proper case-split anchor generation in the
splitNextaction, which will be used to implementgrind?andfinish?. -
#10812 implements
lia,linarith, andacactions forgrindinteractive mode. -
#10824 implements the
cases?tactic for thegrindinteractive mode. It provides a convenient way to select anchors. Users can filter the candidates using the filter language. -
#10828 implements a compact notation for inspecting the
grindstate in interactive mode. Within agrindtactic block, each tactic may optionally have a suffix of the form| filter?. -
#10833 implements infrastructure for evaluating
grindtactics in theGrindMmonad. We are going to use it to check whether auto-generated tactics can effectively close the original goal. -
#10834 implements the
ringaction forgrind. -
#10836 implements support for
Actionin thegrindsolver extensions (SolverExtension). It also provides theSolvers.mkActionfunction that constructs anActionusing all registered solvers. The generated action is "fair," that is, a solver cannot prevent other solvers from making progress. -
#10837 implements the
finish?tactic for thegrindinteractive mode. When it successfully closes the goal, it produces a code action that allows the user to close the goal using explicit grind tactic steps, i.e., without any search. It also makes explicit which solvers have been used. -
#10841 improves the
grindtactic generated by theinstantiateaction in tracing mode. It also updates the syntax for theinstantiatetactic, making it similar tosimp. For example:-
instantiate only [thm1, thm2]instantiates only theoremsthm1andthm2. -
instantiate [thm1, thm2]instantiates theorems marked with the@[grind]attribute and theoremsthm1andthm2.
-
-
#10843 implements the
set_optiontactic ingrindinteractive mode. -
#10846 fixes a few issues on
instance only [...]tactic generation atfinish?.
Language
-
#7844 adds a simple implementation of MePo, from "Lightweight relevance filtering for machine-generated resolution problems" by Meng and Paulson.
-
#10158 adds information about definitions blocked from unfolding via the module system to type defeq errors.
-
#10268 adds an alternative implementation of
DerivingBEqbased on comparing.ctorIdxand using a dedicated matcher for comparing same constructors (added in #10152), to avoid the quadratic overhead of the default match implementation. The new optionderiving.beq.linear_construction_thresholdsets the constructor count threshold (10 by default) for using the new construction. Such instances also allowderiving ReflBEq, LawfulBeq, although these proofs for these properties are still quadratic. -
#10270 adds an alternative implementation of
Deriving Ordbased on comparing.ctorIdxand using a dedicated matcher for comparing same constructors (added in #10152). The new optionderiving.ord.linear_construction_thresholdsets the constructor count threshold (10 by default) for using the new construction. -
#10302 introduces the
@[specs]attribute. It can be applied to (certain) type class instances and define “specification theorems” for the class’ operations, by taking the equational theorems of the implementation function mentioned in the type class instance and rephrasing them in terms of the overloaded operations. Fixes #5295. -
#10333 introduces a
coinductivekeyword, that can be used to define coinductive predicates via a syntax identical to the one forinductivekeyword. The machinery relies on the implementation of elaboration of inductive types and extracts an endomap on the appropriate space of the predicates from the definition that is then fed to thePartialFixpoint. Upon elaborating definitions, all the constructors are declared through automatically generated lemmas. -
#10346 lets
deriving BEqandderiving Orduse@[method_specs]from #10302 when applicable (i.e. when not usingpartial). -
#10351 adds the ability to do
deriving ReflBEq, LawfulBEq. Both classes have to listed in thederivingclause. ForReflBEq, a simplesimp-based proof is used. ForLawfulBEq, a dedicated, syntax-directed tactic is used that should work for derivedBEqinstances. This is meant to work withderiving BEq(but you can try to use it on hand-rolled@[methods_specs] instance : BEq…instances). Does not support mutual or nested inductives. -
#10375 adds support for non-commutative ring normalization in
grind. The new normalizer also accounts for theIsCharPtype class. Examples:open Lean Grind variable (R : Type u) [Ring R] example (a b : R) : (a + 2 * b)^2 = a^2 + 2 * a * b + 2 * b * a + 4 * b^2 := by grind example (a b : R) : (a + 2 * b)^2 = a^2 + 2 * a * b + -b * (-4) * a - 2*b*a + 4 * b^2 := by grind variable [IsCharP R 4] example (a b : R) : (a - b)^2 = a^2 - a * b - b * 5 * a + b^2 := by grind example (a b : R) : (a - b)^2 = 13*a^2 - a * b - b * 5 * a + b*3*b*3 := by grind
-
#10377 fixes an issue where the "eta feature" in the app elaborator, which is invoked when positional arguments are skipped due to named arguments, results in variables that can be captured by those named arguments. Now the temporary local variables that implement this feature get fresh names. The names used for the closed lambda expression still use the original parameter names.
-
#10378 enables using
notationitems ininfix/infixl/infixr/prefix/postfix. The motivation for this is to enable being able to usepp.unicode-aware parsers. A followup PR can combine core parsers as such:infixr:30 unicode(" ∨ ", " \\/ ") => Or -
#10379 modifies the syntax for tactic configurations. Previously just
(identwould commit to tactic configuration item parsing, but now it needs to be(ident :=. This enables reliably using tactic configurations before thetermcategory. For example, givensyntax "my_tac" optConfig term : tactic, it used to be thatmy_tac (x + y)would have an error on+with "expected:=", but now it parses the term. -
#10380 implements sanity checks in the
grind ringmodule to ensure the instances synthesized by type class resolution are definitionally equal to the corresponding ones in thegrindcore classes. The definitional equality test is performed with reduction restricted to reducible definitions and instances. -
#10382 makes the builtin Verso docstring elaborators bootstrap correctly, adds the ability to postpone checks (which is necessary for resolving forward references and bootstrapping issues), and fixes a minor parser bug.
-
#10388 fixes a bug where definitions with nested proofs that contain
sorrymight not report "warning: declaration uses 'sorry'" if the proof has the same type as another nested proof from a previous declaration. The bug only affected log messages;#print axiomswould still correctly report uses ofsorryAx. -
#10391 gives anonymous constructor notation (
⟨x,y⟩) an error recovery mechanism where if there are not enough arguments then synthetic sorries are inserted for the missing arguments and an error is logged, rather than outright failing. -
#10392 fixes an issue with the
iftactic where errors were not placed at the correct source ranges. It also adds some error recovery to avoid additional errors about unsolved goals on theiftoken when the tactic has incomplete syntax. -
#10394 adds the
reduceBEqandreduceOrdsimprocs. They rewrite occurrences of_ == _resp.Ord.compare _ _if both arguments are constructors and the corresponding instance has been marked with@[method_specs](introduced in #10302), which now by default is the case for derived instances. -
#10406 improves upon #10302 to properly make the method spec theorems private if the implementation function is not exposed.
-
#10415 changes the order of steps tried when proving equational theorems for structural recursion. In order to avoid goals that
splitcannot handle, avoid unfolding the LHS of the equation to.brecOnand.recuntil after the RHS has been split into its final cases. -
#10417 changes the automation in
deriving_LawfulEq_tactic_stepto usewith_reduciblewhen asserting the shape of the goal usingchange, so that we do not accidentally unfoldx == x'calls here. Fixes #10416. -
#10419 adds the helper theorem
eq_normS_ncfor normalizing non-commutative semirings. We will use this theorem to justify normalization steps in thegrind ringmodule. -
#10421 adds a normalizer for non-commutative semirings to
grind. Examples:open Lean.Grind variable (R : Type u) [Semiring R] example (a b c : R) : a * (b + c) = a * c + a * b := by grind example (a b : R) : (a + 2 * b)^2 = a^2 + 2 * a * b + 2 * b * a + 4 * b^2 := by grind example (a b : R) : b^2 + (a + 2 * b)^2 = a^2 + 2 * a * b + b * (1+1) * a * 1 + 5 * b^2 := by grind example (a b : R) : a^3 + a^2*b + a*b*a + b*a^2 + a*b^2 + b*a*b + b^2*a + b^3 = (a+b)^3 := by grind
-
#10422 implements the new E-matching pattern inference heuristic for
grind. It is not enabled yet. You can activate the new behavior usingset_option backward.grind.inferPattern false. Here is a summary of the new behavior. -
#10425 lets the
splittactic generalize discriminants that are not free variables and proofs usinggeneralize. If the only non-fvar-discriminants are proofs, then this avoids the more elaborate generalization strategy ofsplit, which can fail with dependent motives, thus mitigating issue #10424. -
#10428 makes explicit missing
grindmodifiers, and ensuresgrinduses "minIndexable" for local theorems. -
#10430 ensures users can select the "minimal indexable subexpression" condition in
grindparameters. Example, they can now writegrind [! -> thmName].grind?will include the!modifier whenever users had used@[grind!]. also fixes a missing case in the new pattern inference procedure. It also adjusts somegrindannotations and tests in preparation for setting the new pattern inference heuristic as the new default. -
#10432 enables the new E-matching pattern inference heuristic for
grind, implemented in PR #10422. Important: Users can still use the old pattern inference heuristic by setting:set_option backward.grind.inferPattern true
-
#10434 adds
reprove N by T, which effectively elaboratesexample type_of% N := by T. It supports multiple identifiers. This is useful for testing tactics. -
#10438 fixes an issue where notations and other overloadings would signal kernel errors even though there exists a successful interpretation.
-
#10440 adds the
reduceCtorIdxsimproc which recognizes and reducesctorIdxapplications. This is not on by default yet because it does not use the discrimination tree (yet). -
#10453 makes
mvcgenreduce throughlets, so that it progresses over(have t := 42; fun _ => foo t) 23by reduction tohave t := 42; foo tand then introducingt. -
#10456 implements
mvcgen invariants?for providing initial invariant skeletons for the user to flesh out. When the loop body has an early return, it will helpfully suggestInvariant.withEarlyReturn ...as a skeleton. -
#10479 implements module docstrings in Verso syntax, as well as adding a number of improvements and fixes to Verso docstrings in general. In particular, they now have language server support and are parsed at parse time rather than elaboration time, so the snapshot's syntax tree includes the parsed documentation.
-
#10506 annotates the shadowing main definitions of
bv_decide,mvcgenand similar tactics inStdwith the semantically richertactic_altattribute so thatversowill not warn about overloads. -
#10507 makes the missing docs linter aware of
tactic_alt. -
#10508 allows
.congr_simptheorems to be created not just for definitoins, but any constant. This is important to make the machinery work across module boundaries. -
#10512 adds some helper functions for the premise selection API, to assist implementers.
-
#10533 adds a docstring role for module names, called
module. It also improves the suggestions provided for code elements, making them more relevant and proposinglit. -
#10535 ensures that
#guardcan be called under the module system without issues. -
#10536 fixes
simpin-zeta -zetaUnusedmode from producing incorrect proofs if in ahavetelescope a variable occurrs in the type of the body only transitively. Fixes #10353. -
#10543 lets
#print T.recshow more information about a recursor, in particular it's reduction rules. -
#10560 adds highlighted Lean code to Verso docstrings and fixes smaller quality-of-life issues.
-
#10563 moves some
ReduceEvalinstances about basic types up from thequote4library. -
#10566 improves
mvcgen invariants?to suggest concrete invariants based on how invariants are used in VCs. These suggestions are intentionally simplistic and boil down to "this holds at the start of the loop and this must hold at the end of the loop":def mySum (l : List Nat) : Nat := Id.run do let mut acc := 0 for x in l do acc := acc + x return acc /-- info: Try this: invariants · ⇓⟨xs, letMuts⟩ => ⌜xs.prefix = [] ∧ letMuts = 0 ∨ xs.suffix = [] ∧ letMuts = l.sum⌝ -/ #guard_msgs (info) in theorem mySum_suggest_invariant (l : List Nat) : mySum l = l.sum := by generalize h : mySum l = r apply Id.of_wp_run_eq h mvcgen invariants? all_goals admit -
#10567 fixes argument index calculation in
Lean.Expr.getArg!'. -
#10570 adds support for case label like syntax in
mvcgen invariantsin order to refer to inaccessible names. Example:def copy (l : List Nat) : Id (Array Nat) := do let mut acc := #[] for x in l do acc := acc.push x return acc theorem copy_labelled_invariants (l : List Nat) : ⦃⌜True⌝⦄ copy l ⦃⇓ r => ⌜r = l.toArray⌝⦄ := by mvcgen [copy] invariants | inv1 acc => ⇓ ⟨xs, letMuts⟩ => ⌜acc = l.toArray⌝ with admit -
#10571 ensures that
SPredproof mode tactics such asmspec,mintro, etc. immediately replace the main goal when entering the proof mode. This preventsNo goals to be solvederrors. -
#10612 fixes an issue reported on Zulip where
abstractMVars(which is used in typeclass inference andsimpargument elaboration) was not instantiating metavariables in the types of metavariables, causing it to abstract already-assigned metavariables. -
#10618 removes superfluous
Monadinstances from the spec lemmas of theMonadExceptOflifting framework. -
#10638 disables the "experimental" warning for
mvcgenby changing its default. -
#10639 fixes hygiene of the local context for all goals generated by
mvcgen, not just those that get a fresh MVar as in #9781. -
#10641 ensures that the
mspecandmvcgentactics no longer spuriously instantiate loop invariants byrfl. -
#10644 explicitly tries to synthesize synthetic MVars in
mspec. Doing so resolves a bug triggered by use of the loop invariant lemma forStd.PRange. -
#10650 improves the error message for
mstartwhen the goal is not aProp. -
#10654 avoid reducing at transparency all in equational theorem generation. Fixes #10651.
-
#10663 disables
{name}suggestions for.anonymousand adds syntax suggestions. -
#10682 changes the instance name for
deriving ToExprto be consistent with other derived instance since #10271. Fixes #10678. -
#10697 lets
inductionprint a warning if a variable occurring in theusingclause is generalized. Fixes #10683. -
#10712 lets
MVarId.cleanupchase local declarations (a bit as if they were equalities). Fixes #10710. -
#10714 removes support for reducible well-founded recursion, a Breaking Change. Using
@[semireducible]on a definition by well-founded recursion prints a warning that this is no longer effective. -
#10716 adds a new helper parser for implementing parsers that contain hexadecimal numbers. We are going to use it to implement anchors in the
grindinteractive mode. -
#10720 re-enables the "experimental" warning for
mvcgenby changing its default. The official release has been postponed to justify small breaking changes in the semantic foundations in the near future. -
#10722 changes where errors are displayed when trying to use
coinductivekeyword when targeting things that do not live inProp. Instead of displaying the error above the first element of the mutual block, it is displayed above the erroneous definition. -
#10733 unfolds auxillary theorems more aggressively during termination checking. This fixes #10721.
-
#10734 follows upon #10606 and creates equational theorems uniformly from the unfold theorem, there is only one handler registered in
registerGetEqnsFn. -
#10780 improves the error message when
decide +kernelfails in the kernel, but not the elaborator. Fixes #10766. -
#10782 implements a hint tactic
mvcgen?, expanding tomvcgen invariants? -
#10783 ensures that error messages such as “redundant alternative” have the right error location even if the arms share their RHS. Fixes #10781.
-
#10793 fixes #10792.
-
#10796 changes match compilation to reject some pattern matches that were previously accepted due to inaccessible patterns sometimes treated like accessible ones. Fixes #10794.
-
#10807 introduces the
backward.privateInPublicoption to aid in porting projects to the module system by temporarily allowing access to private declarations from the public scope, even across modules. A warning will be generated by such accesses unlessbackward.privateInPublic.warnis disabled. -
#10839 exposes the
optionValueparser used to implement theset_optionnotation.
Library
-
#9258 adds support for signal handlers to the Lean standard library.
-
#9298 adds support the Count Trailing Zeros operation
BitVec.ctzto the bitvector library and tobv_decide, relying on the existingclzcircuit. We also build some theory aroundBitVec.ctz(analogous to the theory existing forBitVec.clz) and introduce lemmasBitVec.[ctz_eq_reverse_clz, clz_eq_reverse_ctz, ctz_lt_iff_ne_zero, getLsbD_false_of_lt_ctz, getLsbD_true_ctz_of_ne_zero, two_pow_ctz_le_toNat_of_ne_zero, reverse_reverse_eq, reverse_eq_zero_iff]. -
#9932 adds
LawfulMonadandWPMonadinstances forOptionandOptionT. -
#10304 redefines
Stringto be the type of byte arraysbfor whichb.IsValidUtf8. -
#10319 "monomorphizes" the structure
Std.PRange shape α, replacing it with nine distinct structuresStd.Rcc,Std.Rco,Std.Rcietc., one for each possible shape of a range's bounds. This change was necessary because the shape polymorphism is detrimental to attempts of automation. -
#10366 refactors the Async module to use the
Asynctype in all of theAsyncfiles. -
#10367 adds vectored write for TCP and UDP (that helps a lot with not copying the arrays over and over) and fix a RC issue in TCP and UDP cancel functions with the line
lean_dec((lean_object*)udp_socket);and a similar one that tries to decrement the object inside of thesocket. -
#10368 adds
Notifythat is a structure that is similar toCondVarbut it's used for concurrency. The main difference betweenStd.Sync.NotifyandStd.Condvaris that depends on aStd.Mutexand blocks the entire thread that theTaskis using while waiting. -
#10369 adds a multi-consumer, multi-producer channel to Std.Sync.
-
#10370 adds async type classes for streams.
-
#10400 adds the StreamMap type that enables multiplexing in asynchronous streams.
-
#10407 adds
@[method_specs_simp]inInitfor type classes likeHAppend. -
#10457 introduces safe alternatives to
String.PosandSubstringthat can only represent valid positions/slices. -
#10487 adds vectored write and fix rc issues in tcp and udp cancel functions.
-
#10510 adds a
Std.CancellationTokentype -
#10514 defines the new
String.SliceAPI. -
#10552 ensures that
Substring.beqis reflexive, and in particular satisfies the equivalencess1 == ss2 <-> ss1.toString = ss2.toString. -
#10611 adds adds union operation on
DHashMap/HashMap/HashSetand their raw variants and provides lemmas about union operations. -
#10618 removes superfluous
Monadinstances from the spec lemmas of theMonadExceptOflifting framework. -
#10624 renames
String.PostoString.Pos.Raw. -
#10627 adds lemmas
forall_fin_zeroandexists_fin_zero. It also marks lemmasforall_fin_zero,forall_fin_one,forall_fin_two,exists_fin_zero,exists_fin_one,exists_fin_twowithsimpattribute. -
#10630 aims to fix the Timer API selector to make it finish as soon as possible when unregistered. This change makes the
Selectable.onefunction drop theselectablesarray as soon as possible, so when combined with finalizers that have some effects like the TCP socket finalizer, it runs it as soon as possible. -
#10631 exposes the definitions about
Int*. The main reason is that theSIntsimprocs require many of them to be exposed. Furthermore,decidenow works withInt*operations. This fixes #10631. -
#10633 provides range support for the signed finite number types
Int{8,16,32,64}andISize. The proof obligations are handled by reducing all of them to proofs about an internalUpwardEnumerableinstance forBitVecinterpreted as signed numbers. -
#10634 defines
ByteArray.validateUTF8, uses it to show thatByteArray.IsValidUtf8is decidable and redefinesString.fromUTF8and friends to use it. -
#10636 renames
String.getUtf8BytetoString.getUTF8Bytein order to adhere to the standard library naming convention. -
#10642 introduces
List.Cursor.posas an abbreviation forprefix.length. -
#10645 renames
StreamtoStd.Streamso that the name becomes available to mathlib after a deprecation cycle. -
#10649 renames
Nat.and_distrib_righttoNat.and_or_distrib_right. This is to make the name consistent with other theorems in the same file (e.g.Nat.and_or_distrib_left). -
#10653 adds equational lemmas about (filter-)mapping and then folding iterators.
-
#10667 adds more selectors for TCP and Signals.
-
#10676 adds the
IO.FS.hardLinkfunction, which can be used to create hard links. -
#10685 introduces
LTandLEinstances onString.ValidPosandString.Slice.Pos. -
#10686 introduces
any,anyM,allandallMfor pure and monadic iterators. It also provides lemmas about them. -
#10713 enforces rules around arithmetic of
String.Pos.Raw. -
#10728 introduces the
flatMapiterator combinator. It also adds lemmas relatingflatMaptotoListandtoArray. -
#10735 moves many operations involving
String.Pos.Rawto a theString.Pos.Rawnamespace with the eventual aim of freeing up theStringnamespace to contain operations usingString.ValidPos(to be renamed toString.Pos) instead. -
#10761 provides iterators on hash maps.
Tactics
-
#10445 adds helper definitions in preparation for the upcoming injective function support in
grind. -
#10447 adds the
[grind inj]attribute for marking injectivity theorems forgrind. -
#10448 modifies the "issues" grind diagnostics prints. Previously we would just describe synthesis failures. These messages were confusing to users, as in fact the linarith module continues to work, but less capably. For most of the issues, we now explain the resulting change in behaviour. There is a still a TODO to explain the change when
IsOrderedRingis not available. -
#10449 ensures that issues reported by the E-matching module are displayed only when
set_option grind.debug trueis enabled. Users reported that these messages are too distracting and not very useful. They are more valuable for library developers when annotating their libraries. -
#10461 fixes unnecessary case splits generated by the
grind mbtcmodule. Here,mbtcstands for model-based theory combination. -
#10463 adds
Nat.sub_zeroas agrindnormalization rule. -
#10465 skips cast-like helper
grindfunctions duringgrind mbtc -
#10466 reduces noise in the 'Equivalence classes' section of the
grinddiagnostics. It now uses a notion of support expressions. Right now, it is hard-coded, but we will probably make it extensible in the future. The current definition is -
#10469 fixes an incorrect optimization in the
grindcanonicalizer. See the new test for an example that exposes the problem. -
#10472 adds a code action for
grindparameters. We need to useset_option grind.param.codeAction trueto enable the option. The PR also adds a modifier to instructgrindto use the "default" pattern inference strategy. -
#10473 ensures the code action messages produced by
grindinclude the full context -
#10474 adds a doc string for the
!parameter modifier ingrind. -
#10477 ensures sorts are internalized by
grind. -
#10480 fixes a bug in the equality resolution frontend used in
grind. -
#10481 generalizes the theorem activation function used in
grind. The goal is to reuse it to implement the injective function module. -
#10482 fixes symbol collection for the
@[grind inj]attribute.
Compiler
-
#10429 fixes and overeager reuse of specialisation in the code generator.
-
#10444 fixes an overeager insertion of
incoperations for large uint constants. -
#10488 changes the way that scientific numerals are parsed in order to give better error messages for (invalid) syntax like
32.succ. -
#10495 fixes constant folding for UIntX in the code generator. This optimization was previously simply dead code due to the way that uint literals are encoded.
-
#10610 ensures that even if a type is marked as
irreduciblethe compiler can see through it in order to discover functions hidden behind type aliases. -
#10626 reduces the aggressiveness of the dead let eliminator from lambda RC.
-
#10689 fixes an oversight in the RC insertion phase in the code generator.
Pretty Printing
-
#10376 modifies pretty printing of
funbinders, suppressing the safe shadowing feature among the binders in the samefun. For example, rather than pretty printing asfun x x => 0, we now seefun x x_1 => 0. The calculation is done perfun, so for examplefun x => id fun x => 0pretty prints as-is, taking advantage of safe shadowing.
Documentation
Server
-
#10365 implements the server-side for a new trace search mechanism in the InfoView.
-
#10442 ensures that unknown identifier code actions are provided on auto-implicits.
-
#10524 adds support for interactivity to the combined "try this" messages that were introduced in #9966. In doing so, it moves the link to apply a suggestion to a separate
[apply]button in front of the suggestion. Hints with diffs remain unchanged, as they did not previously support interacting with terms in the diff, either. -
#10538 fixes deadlocking
exitcalls in the language server. -
#10584 causes Verso docstrings to search for a name in the environment that is at least as long as the current name, providing it as a suggestion.
-
#10609 fixes an LSP-non-compliance in the
FileSystemWatcherthat was introduced in #925. -
#10619 fixes a bug in the unknown identifier code actions where it would yield non-sensical suggestions for nested
opendeclarations likeopen Foo.Bar. -
#10660 adds auto-completion for identifiers after
end. It also fixes a bug where completion in the whitespace afterset_optionwould not yield the full option list. -
#10662 re-enables semantic tokens for Verso docstrings, after a prior change accidentally disabled them. It also adds a test to prevent this from happening again.
-
#10738 fixes a regression introduced by #10307, where hovering the name of an inductive type or constructor in its own declaration didn't show the docstring. In the process, a bug in docstring handling for coinductive types was discovered and also fixed. Tests are added to prevent the regression from repeating in the future.
-
#10757 fixes a bug in combination with VS Code where Lean code that looks like CSS color codes would display a color picker decoration.
-
#10797 fixes a bug in the unknown identifier code actions where the identifiers wouldn't be correctly minimized in nested namespaces. It also fixes a bug where identifiers would sometimes be minimized to
[anonymous].
Lake
-
#9855 adds a new
allowImportAllconfiguration option for packages and libraries. When enabled by an upstream package or library, downstream packages will be able toimport allmodules of that package or library. This enables package authors to selectively choose whichprivateelements, if any, downstream packages may have access to. -
#10188 adds support for remote artifact caches (e.g., Reservoir) to Lake. As part of this support, a new suite of
lake cacheCLI commands has been introduced to help manage Lake's cache. Also, the existing local cache support has been overhauled for better interplay with the new remote support. -
#10452 refactors Lake's package naming procedure to allow packages to be renamed by the consumer. With this, users can now require a package using a different name than the one it was defined with.
-
#10459 fixes a conditional check in a GitHub Action template generated by Lake.
-
#10468 refactors the Lake log monads to take a
LogConfigstructure when run (rather than multiple arguments). This breaking change should help minimize future breakages due to changes in configurations options. -
#10551 enables Reservoir packages to be required as dependencies at a specific package version (i.e., the
versionspecified in the package's configuration file). -
#10576 adds a new package configuration option:
restoreAllArtifacts. When set totrueand the Lake local artifact cache is enabled, Lake will copy all cached artifacts into the build directory. This ensures they are available for external consumers who expect build results to be in the build directory. -
#10578 adds support for the CMake spelling of a build type (i.e., capitalized) to Lake's
buildTypeconfiguration option. -
#10579 alters
libPrefixOnWindowsbehavior to add thelibprefix to the library'slibNamerather than just the file path. This means that Lake's-lwill now have the prefix on Windows. While this should not matter to a MSYS2 build (which accepts bothlib-prefixed and unprefixed variants), it should ensure compatibility with MSVC (if that is ever an issue). -
#10730 changes the Lake's remote cache interface to scope cache outputs by toolchain and/or platform were useful.
-
#10741 fixes a bug where partially up-to-date files built with
--oldcould be stored in the cache as fully up-to-date. Such files are no longer cached. In addition, builds without traces now only perform an modification time check with--old. Otherwise, they are considered out-of-date.
Other
-
#10383 includes some improvements to the release process, making the updating of
stablebranches more robust, and includingcslibin the release checklist. -
#10389 fixes a bug where string literal parsing ignored its trailing whitespace setting.
-
#10460 introduces a simple script that adjusts module headers in a package for use of the module system, without further minimizing import or annotation use.
-
#10476 fixes the dead
letelimination code in the kernel'sinfer_letfunction. -
#10575 adds the necessary infrastructure for recording elaboration dependencies that may not be apparent from the resulting environment such as notations and other metaprograms. An adapted version of
shakefrom Mathlib is added toscript/but may be moved to another location or repo in the future. -
#10777 improves the scripts assisting with cutting Lean releases (by reporting CI status of open PRs, and adding documentation), and adds a
.claude/commands/release.mdprompt file so Claude can assist.