Commit graph

25 commits

Author SHA1 Message Date
Henrik Böving
09de5cd70e
refactor: remove Lean.RBMap usages (#9260)
This PR removes uses of `Lean.RBMap` in Lean itself.

Furthermore some massaging of the import graph is done in order to avoid
having `Std.Data.TreeMap.AdditionalOperations` (which is quite
expensive) be the critical path for a large chunk of Lean. In particular
we can build `Lean.Meta.Simp` and `Lean.Meta.Grind` without it thanks to
these changes.

We did previously not conduct this change as `Std.TreeMap` was not
outperforming `Lean.RBMap` yet, however this has changed with the new
code generator.
2025-07-21 14:04:45 +00:00
Eric Wieser
ae1ab94992
fix: replace bad simp lemmas for Id (#7352)
This PR reworks the `simp` set around the `Id` monad, to not elide or
unfold `pure` and `Id.run`

In particular, it stops encoding the "defeq abuse" of `Id X = X` in the
statements of theorems, instead using `Id.run` and `pure` to pass back
and forth between these two spellings. Often when writing these with
`pure`, they generalize to other lawful monads; though such changes were
split off to other PRs.

This fixes the problem with the current simp set where `Id.run (pure x)`
is simplified to `Id.run x`, instead of the desirable `x`.
This is particularly bad because the` x` is sometimes inferred with type
`Id X` instead of `X`, which prevents other `simp` lemmas about `X` from
firing.

Making `Id` reducible instead is not an option, as then the `Monad`
instances would have nothing to key on.

---------

Co-authored-by: Sebastian Graf <sg@lean-fro.org>
Co-authored-by: Kim Morrison <kim@tqft.net>
Co-authored-by: Paul Reichert <6992158+datokrat@users.noreply.github.com>
2025-05-22 22:45:35 +00:00
Kim Morrison
09e1a05ee9
chore: cleanup imports (#5825) 2024-10-23 23:51:13 +00:00
Kyle Miller
359f60003a
fix: use correct expr positions when delaborating match patterns (#4034)
In the following, hovering over `true` in the infoview was showing
`Nat.succ y`.
```lean
#check fun (x : Nat) =>
  match h : x with
  | 0 => false
  | y + 1 => true
```
Now hovering over `true` shows `true`.

The issue was that SubExpr positions were not being tracked for
patterns, and the position for a pattern could coincide with the
position for a RHS, putting overwriting terminfo. Now the position given
to a pattern is correct and unique.

Refactors the `match` delaborator, makes it handle shadowing of `h :`
discriminant annotations correctly, and makes it use the standard
`withOverApp` combinator to handle overapplication.
2024-05-01 12:02:10 +00:00
Leonardo de Moura
63067d0d34
chore: code convention (#4009) 2024-04-28 15:49:55 +00:00
Henrik Böving
23e49eb519 perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
Marcus Rossel
89d7eb8b78
doc: fix typos/indentation (#3085) 2023-12-17 18:41:46 +00:00
Wojciech Nawrocki
e1b3f10250 doc: fix contradictory docstring 2023-07-19 10:53:47 +02:00
Wojciech Nawrocki
c784031dd7 feat: add GoalLocation type 2023-01-13 17:13:02 -08:00
Mario Carneiro
85119ba9d1 chore: move Std.* data structures to Lean.* 2022-09-26 05:46:04 -07:00
Ed Ayers
2a6697e077
feat: goal-diffs (#1610) 2022-09-24 11:46:11 +02:00
Mario Carneiro
ebb5b97d73 chore: move Bootstrap.Data -> Lean.Data 2022-08-31 11:48:57 -07:00
Mario Carneiro
bf89c5a0f5 chore: move Std -> Bootstrap 2022-08-29 01:26:12 -07:00
Gabriel Ebner
a8cab84735 refactor: use computed fields for Expr 2022-07-11 14:19:41 -07:00
E.W.Ayers
b6f251bcd3 fix: SubExpr.Pos.toString not terminating
fixes 1232
2022-06-19 16:04:50 -07:00
E.W.Ayers
ee6ba180ea fix: remove fix2 2022-06-17 17:47:51 -07:00
E.W.Ayers
18ba16ded9 feat: string representation of Pos
This is needed because JSON will otherwise lossily
convert big nats to floats.
2022-06-17 17:47:51 -07:00
E.W.Ayers
933964f2a4 chore: rm SubExpr.mapPos because it is not useful 2022-06-17 17:47:51 -07:00
E.W.Ayers
114bbc78ed test: numBinders 2022-06-17 17:47:51 -07:00
E.W.Ayers
4a70143aaf style: minor formatting changes 2022-06-17 17:47:51 -07:00
E.W.Ayers
0e84f67d99 feat: with pos expr traversal functions 2022-06-17 17:47:51 -07:00
E.W.Ayers
ece1c1085c feat: add Expr lensing functions using SubExpr.Pos 2022-06-17 17:47:51 -07:00
E.W.Ayers
2fe933cdf5 refactor: make SubExpr.Pos a definition
Instead of an abbreviation. It is easier to understand
Pos operations in terms of 'push' and 'pop' rather than
through arithmetic.
2022-06-17 17:47:51 -07:00
E.W.Ayers
d55daf80d4 doc: fix misleading SubExpr docstring 2022-06-06 09:37:51 -07:00
E.W.Ayers
1785ab142e refactor: move Lean.PrettyPrinter.Delaborator.SubExpr to Lean.SubExpr
This is because SubExpr has uses outside the Delaborator.

Closes #1183
2022-06-03 12:38:14 -07:00