Commit graph

26741 commits

Author SHA1 Message Date
Wojciech Nawrocki
b022a7c1d2 style: indent 2021-08-01 09:58:44 +02:00
Wojciech Nawrocki
5f021baa95 style: statement ordering
Co-authored-by: Sebastian Ullrich <sebasti@nullri.ch>
2021-08-01 09:58:44 +02:00
Wojciech Nawrocki
0b6d51d60b feat: tag pretty-printer outputs 2021-08-01 09:58:44 +02:00
Wojciech Nawrocki
9b8e44618d chore: default to Format Nat 2021-08-01 09:58:44 +02:00
Wojciech Nawrocki
a937fa26ba chore: fewer explicit types 2021-08-01 09:58:44 +02:00
Wojciech Nawrocki
f51b80060d feat: generic tagged Format 2021-08-01 09:58:44 +02:00
Wojciech Nawrocki
d2e23ff5cf fix: deriving RpcEncoding 2021-08-01 09:58:44 +02:00
Wojciech Nawrocki
1d57ffb4d7 refactor: shuffle classes to avoid dependency loops 2021-08-01 09:58:44 +02:00
Wojciech Nawrocki
1311f87a8b feat: eagerly initialize RPC session
With this we are able to send RpcRefs immediately, in particular in (interactive) diagnostics.
2021-08-01 09:58:44 +02:00
Wojciech Nawrocki
d3ca1e98e9 refactor: make lsp/release a notification 2021-08-01 09:58:44 +02:00
Wojciech Nawrocki
55ffb73bbe refactor: rename rpc/initialize to rpc/connect 2021-08-01 09:58:44 +02:00
Leonardo de Moura
af5ff9ceb2 refactor: move List.takeWhile to Init.Data.List.Basic
Motivation: make sure it will be aligned by BinPort
2021-07-31 15:03:33 -07:00
Leonardo de Moura
59dff3f3e0 chore: update stage0 2021-07-31 14:30:43 -07:00
Leonardo de Moura
3f72555437 feat: use staged sets at namespacesExt
Mathlib has more than 120k namespaces
2021-07-31 14:27:24 -07:00
Leonardo de Moura
6cc30a3f90 feat: add NameSSet
Staged set of names
2021-07-31 14:24:00 -07:00
Leonardo de Moura
2abafd9df4 feat: add "staged set" helper type 2021-07-31 14:23:29 -07:00
Leonardo de Moura
bd60e59f9a feat: add HashMap.insert'
The new function returns a flag indicating whether the new entry
replaced an existing or not.
We use it to implement `importModules`.
2021-07-31 13:42:01 -07:00
Sebastian Ullrich
32bea73708 fix: ensure hygiene of double-quoted names
Fixes #586
2021-07-30 07:17:50 -07:00
Sebastian Ullrich
2833c61a60 fix: respect preresolved names at resolveConst*
This makes sure we can properly quote e.g. `deriving` clauses and avoids
a suspicious `eraseMacroScopes` call (though not at `Elab.Syntax`, since
categories do not have to be declaration names)
2021-07-30 07:17:50 -07:00
Leonardo de Moura
c0f811a725 chore: update stage0 2021-07-29 17:01:08 -07:00
Leonardo de Moura
c6308a0f1f feat: add support for kernel projections to DiscrTree 2021-07-29 16:59:47 -07:00
Leonardo de Moura
2c037c3989 chore: fix proofs 2021-07-29 16:59:47 -07:00
Leonardo de Moura
c054fa9a60 chore: update stage0 2021-07-29 16:33:13 -07:00
Leonardo de Moura
b25bb78e2a feat: improve DiscrTree
Try to improve the performance issue described at #587.

The issue is that Mathlib contains thousands of theorems where the
associated key for the discrimination tree is just
`Key.other`. The indexing is not effective for them. This happens because

1- Lambda expressions are indexed using `Key.other`. The
   discrimination tree mainly focus on the first-order structure.

2- It unfolds reducible constants when inserting and retrieving
   entries. The motivation is that users expect simp theorems to fire
   modulo reducible constants.

Then, we have many theorems such as
```lean
map ?g ∘ map ?f = map (?g ∘ ?f)
```
when we expand the function composition on the left-hand side, we get
```lean
fun (x : List ?α) => map ?g (map ?f x)
```
Which is indexed as `Key.other`.

We should not avoid the `Array`s in the discrimination tree nodes
If the index is working effectively, these arrays are all very small.

In this commit, we try to address the problem by using a different
approach. When processing the root of a pattern, we interrupt
reduction as soon as the we hit something that would be indexed
as `Key.other`. Note that, in Lean 3, the root of a pattern also
receives special treatment.
2021-07-29 16:08:26 -07:00
Leonardo de Moura
096b0c2cec chore: update stage0 2021-07-29 15:29:12 -07:00
Leonardo de Moura
c08ce69a51 refactor: break DiscrTree -> WHNF dependency
Motivation: we want to use `whnfCore` at `DiscrTree.lean`
2021-07-29 15:26:35 -07:00
Leonardo de Moura
ad216db08d chore: add Repr instance for Literal and Key 2021-07-29 09:34:55 -07:00
Leonardo de Moura
f10c27dfb7 perf: add workaround for perf issue
See issue #361
2021-07-29 08:29:09 -07:00
Leonardo de Moura
16d803c0b3 chore: update comment 2021-07-28 17:18:41 -07:00
Leonardo de Moura
49a87ceb4d feat: add basic isDefEq cache 2021-07-28 16:29:44 -07:00
Leonardo de Moura
51e03837f5 fix: exact and refine succeed if they produce no new metavariables
closes #492
2021-07-27 18:30:14 -07:00
Leonardo de Moura
a09883a0eb feat: add mechanism for tracking metavariables "age" 2021-07-27 18:11:56 -07:00
Leonardo de Moura
6d05daf73b feat: add flag for allowing synthetic opaque mvars to be assigned at isDefEq
See issue #492
TODO: add a mechanism for detecting new metavariables.
2021-07-27 17:58:08 -07:00
Leonardo de Moura
8c12a264ee fix: offset support at isDefEq should not use HAdd.hAdd
fixes #550
2021-07-27 16:16:03 -07:00
Leonardo de Moura
3f22d5f624 feat: take auto params into account in the structure instance notation
closes #461
2021-07-27 15:49:23 -07:00
Leonardo de Moura
56e247763f fix: scope of the auto param at fields 2021-07-27 15:22:51 -07:00
Leonardo de Moura
0ccd110eb4 feat: elaborate Term.binderTactic at structure declarations 2021-07-27 14:49:23 -07:00
Leonardo de Moura
3b5e762882 chore: add temporary workaround 2021-07-27 14:23:05 -07:00
Leonardo de Moura
67f4d5bd57 chore: update stage0 2021-07-27 14:19:53 -07:00
Leonardo de Moura
fb3ea8109f fix: structure instance parser 2021-07-27 12:54:17 -07:00
Leonardo de Moura
1a62826107 chore: cleanup 2021-07-27 12:41:26 -07:00
Leonardo de Moura
714cadfb31 fix: bug at structure instance notation
It was exposed by the second example at #461.
2021-07-27 11:56:33 -07:00
Sebastian Ullrich
e25edf893c fix: mark MPZ objects in compacted regions as persistent 2021-07-27 16:35:42 +02:00
Leonardo de Moura
b986bde639 fix: IO.Error.alreadyExists may have an optional file name
We got an assertion violation yesterday at `leanpkg` at
```cpp
  case EEXIST: case EINPROGRESS: case EISCONN:
        lean_assert(fname == nullptr);   // <<<<<<< HERE
        return lean_mk_io_error_already_exists(errnum, details);
```
2021-07-27 07:00:06 -07:00
Leonardo de Moura
8973982926 chore: update stage0 2021-07-26 18:25:11 -07:00
Leonardo de Moura
a77598f7cf feat: user-defined attributes
See new test for an example.

closes #513
2021-07-26 18:24:10 -07:00
Leonardo de Moura
0bea52d1b5 chore: update stage0 2021-07-26 16:19:59 -07:00
Leonardo de Moura
cdd1dbbb36 feat: user-defined environment extensions
New test demonstrates how to use them.
The user-defined extensions cannot be used in the same file where they
were declared because the `initialize` commands are only executed when
we import the modules containing them.

TODO: user-defined attributes.
2021-07-26 16:18:48 -07:00
Leonardo de Moura
42561bb93f perf: change is_def_eq_proof_irrel type to lbool 2021-07-26 07:11:55 -07:00
Leonardo de Moura
8a98987e26 chore: use isDefEq heuristic on regular definitions only 2021-07-26 07:11:55 -07:00