Leonardo de Moura
29c245ceba
perf: (try to) fix regression introduced by #3139
2024-01-09 12:57:15 +01:00
Joe Hendrix
903493799d
fix: reduceNat? match terms with free or meta variables ( #3139 )
...
This removes checks in `Lean.Meta.reduceNat?` that caused it to fail on
terms it could handle because they contain meta variables in arguments.
This lead to those operations being reduced using their equational
definitions and slow performance on large patterns:
```
set_option profiler true
set_option profiler.threshold 1
def testMod (x:Nat) :=
match x with
| 128 % 1024 => true
| _ => false
-- elaboration took 3.02ms
def testMul (x:Nat) :=
match x with
| 128 * 1 => true
| _ => false
-- type checking took 11.1ms
-- compilation of testMul.match_1 took 313ms
-- compilation of testMul took 65.7ms
-- elaboration took 58.9ms
```
Performance is slower on `testMul` than `testMod` because `whnf` ends up
evaluateing `128 * 1` using Peano arithmetic while `128 % 1024` is able
to avoid that treatment since `128 < 1024`.
2024-01-05 18:08:26 +00:00
Kyle Miller
a2226a43ac
feat: encode let_fun using a letFun function ( #2973 )
...
Switches from encoding `let_fun` using an annotated `(fun x : t => b) v`
expression to a function application `letFun v (fun x : t => b)`.
---------
Co-authored-by: Sebastian Ullrich <sebasti@nullri.ch>
2023-12-18 09:01:42 +00:00
Sebastian Ullrich
74b8dda181
feat: check task cancellation in elaborator
2023-10-26 08:33:09 +02:00
Leonardo de Moura
3a13200772
refactor: add configuration options to control WHNF
...
This commit also removes parameter `simpleReduce` from discrimination
trees, and take WHNF configuration options.
Reason: it is more dynamic now. For example, the simplifier
will be able to use different configurations for discrimination tree insertion
and retrieval. We need this feature to address issues #2669 and #2281
This commit also removes the dead Meta.Config field `zetaNonDep`.
2023-10-25 03:12:35 -07:00
Leonardo de Moura
aecc83e2fc
chore: add some doc strings and cleanup
2023-10-25 03:12:35 -07:00
Scott Morrison
fb0d0245db
Revert "Cancel outstanding tasks on document edit in the language server" ( #2703 )
...
* Revert "perf: inline `checkInterrupted`"
This reverts commit 6494af4513 .
* Revert "fix: switch to C++ interruption whitelist"
This reverts commit 5aae74199b .
* Revert "fix: do not throw interrupt exceptions inside pure functions"
This reverts commit c0e3b9568e .
* Revert "feat: cancel tasks on document edit"
This reverts commit a2e2481c51 .
* Revert "feat: translate `interrupted` kernel exception"
This reverts commit 14c640c15e .
* Revert "feat: check task cancellation in elaborator"
This reverts commit 2070df2328 .
* Revert "feat: move `check_interrupted` from unused thread class to `Task` cancellation"
This reverts commit bf48a18cf9 .
2023-10-17 00:59:11 +00:00
Scott Morrison
1e74c6a348
feat: use nat_gcd in the kernel ( #2533 )
...
* feat: use nat_gcd in the kernel
---------
Co-authored-by: Sebastian Ullrich <sebasti@nullri.ch>
2023-10-15 13:49:41 +11:00
Sebastian Ullrich
2070df2328
feat: check task cancellation in elaborator
2023-10-13 09:52:26 +02:00
Sebastian Ullrich
00e981edcd
perf: do not inhibit caching of default-level match reduction
2023-10-08 17:24:20 -07:00
Leonardo de Moura
9f50f44eed
perf: missing cache at whnfImp
2023-10-08 17:22:14 -07:00
int-y1
8d7520b36f
chore: fix typos in comments
2023-10-08 10:46:05 +02:00
Scott Morrison
1dd443a368
doc: improve doc-string for Meta.getConst?
2023-08-24 07:42:28 -07:00
Jannis Limperg
6407197e54
chore: better error message for loose bvar in whnf
2023-07-20 13:47:20 -07:00
Leonardo de Moura
7367f2edc6
fix: unfold constant theorems when transparency is set to .all
2023-06-21 20:28:17 -07:00
Leonardo de Moura
9df2f6b0c9
fix: bump transparency to .all when reducing the major premise of Acc.rec and WellFounded.rec
2023-06-21 20:28:17 -07:00
Sebastian Ullrich
8a302e6135
fix: match discriminant reduction should not unfold irreducible defs
2023-04-10 21:09:04 -07:00
Gabriel Ebner
75252d2b85
perf: whnf projections during defeq
2023-02-09 19:54:23 -08:00
Leonardo de Moura
8225be2f0e
feat: ensure projections are not reducing at DiscrTree V (simpleReduce := true)
...
Now, the `simp` discrimination tree does not perform `iota` nor reduce
projections.
2022-11-15 16:47:12 -08:00
Leonardo de Moura
81c84bf045
feat: do not perform iota reduction at the discrimination tree module
2022-11-15 16:47:12 -08:00
Mario Carneiro
583e023314
chore: snake-case attributes (part 2)
2022-10-19 09:28:08 -07:00
Mario Carneiro
6392c5b456
chore: import reductions
2022-09-15 14:02:38 -07:00
Leonardo de Moura
ee70805c35
feat: add LCNF missing cases
2022-08-06 20:23:29 -07:00
Leonardo de Moura
fbef8a32e1
feat: add support for stuck class projection function applications at getStuckMVar?
...
closes #1408
2022-08-02 16:01:06 -07:00
Leonardo de Moura
3896244c55
chore: cleanup
2022-07-25 22:39:56 -07:00
Leonardo de Moura
90fb110cc9
refactor: improve FVarId method discoverability
...
See issue #1346
2022-07-25 22:18:58 -07:00
Mario Carneiro
f6211b1a74
chore: convert doc/mod comments from /- to /--//-! ( #1354 )
2022-07-22 12:05:31 -07:00
Leonardo de Moura
4d81c609cc
chore: cleanup
2022-07-11 18:52:55 -07:00
Gabriel Ebner
a8cab84735
refactor: use computed fields for Expr
2022-07-11 14:19:41 -07:00
Leonardo de Moura
db47664d4a
fix: discrepancy between isDefEq and whnf for transparency mode instances
2022-07-07 15:39:58 -07:00
Leonardo de Moura
608a306ef0
refactor: simplify/cleanup DelayedMetavarAssignment
2022-07-06 15:24:17 -07:00
Leonardo de Moura
81ed8b0b32
chore: cleanup
2022-07-06 15:24:17 -07:00
Leonardo de Moura
a1413b8fa1
feat: cache failures at isDefEq
...
We can compile Lean with these changes, but 3 tests are still broken.
This cache is used to address a performance issue reported at
https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/deterministic.20timeout.20with.20structures/near/288180087
2022-07-03 21:52:01 -07:00
Leonardo de Moura
2ebcf29cde
chore: use a[i]! for array accesses that may panic
2022-07-02 15:12:05 -07:00
Leonardo de Moura
f3bb0be045
feat: add flag to control projection reduction at whnfCore
2022-06-30 16:48:00 -07:00
Leonardo de Moura
2c152dae7d
chore: remove unnecessary partial
2022-06-30 15:47:31 -07:00
Leonardo de Moura
02c4e548df
feat: replace constant with opaque
2022-06-14 17:02:59 -07:00
Leonardo de Moura
041827bed5
chore: unused variables
2022-06-07 17:54:10 -07:00
Leonardo de Moura
5055855637
feat: improve default simp discharge method
...
closes #1193
2022-06-06 17:29:12 -07:00
Leonardo de Moura
2832442e7a
fix: unfold declarations tagged with [matchPattern] at reduceMatcher? even if transparency setting is not the default one
...
see #1193
It fixes one of the issues exposed at the issue above.
2022-06-06 15:53:40 -07:00
Leonardo de Moura
6af1da450e
feat: disable only eta for classes during TC resolution
...
closes #1123
2022-04-26 08:20:39 -07:00
Leonardo de Moura
36fad4bba0
fix: do not assign metavariables in the major premise type when trying K
2022-04-23 07:31:51 -07:00
Leonardo de Moura
3bdb385c19
fix: make sure "eta for structures" in the elaborator uses projection functions if available
2022-04-11 19:23:10 -07:00
Leonardo de Moura
d1e4712038
fix: smart unfolding
...
See new comment to understand the issue.
closes #1081
2022-03-29 15:49:14 -07:00
Leonardo de Moura
3a310fb122
fix: the eta for structures implementation in the elaborator was different from the implementation in the kernel
...
This issue was exposed by issue #1074
2022-03-25 18:24:15 -07:00
Leonardo de Moura
0bd9de1cb9
perf: add InstantiateLevelCaches for types and values at CoreM
2022-03-15 17:42:38 -07:00
Leonardo de Moura
4e261b15e5
fix: smart unfolding bug in over applications
2022-03-14 19:17:21 -07:00
Leonardo de Moura
fddc8b06ac
fix: missing case at getStuckMVar?
...
Fix issue reported at
https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/'rewrite'.20failed.20but.20it.20should.20work/near/274870747
2022-03-10 10:33:11 -08:00
Leonardo de Moura
d39102f865
fix: smart unfolding for reducible definitions
...
When `TransparencyMode.reducible`, smart unfolding for reducible
definitions was not being used.
2022-03-05 14:42:47 -08:00
Leonardo de Moura
32dd3c6b29
feat: use at least default transparency at toCtorWhenK
...
Improves the effectiveness of `simp` when reducing `match`-expr.
2022-02-12 07:56:45 -08:00