Commit graph

6082 commits

Author SHA1 Message Date
Sebastian Ullrich
23d157a3ff chore: remove dead code 2022-06-15 12:43:59 +02:00
Leonardo de Moura
944063682e fix: another specialize.cpp bug
This is just a workaround. This code has to be ported to Lean.

The issue has been reported at https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/.28kernel.29.20unknown.20constant/near/283750650
2022-05-25 20:36:18 -07:00
Leonardo de Moura
16ed5a3213 fix: erase_irrelevant.cpp
It addresses issue reported at https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/'unreachable'.20code.20was.20reached.20by.20termination.20check/near/281159704
2022-05-04 08:06:59 -07:00
Leonardo de Moura
081dff288f fix: debug build 2022-04-13 13:12:53 -07:00
Leonardo de Moura
efb859013e chore: ignore {} annotations at mk_projections 2022-04-13 10:16:41 -07:00
Sebastian Ullrich
7460878e05 chore: define WIN32_LEAN_AND_MEAN 2022-04-06 09:38:19 +02:00
Leonardo de Moura
1900efd91a chore: add pp_expr helper function 2022-03-25 18:16:18 -07:00
Leonardo de Moura
7307b02fd7 fix: missing test at has_trivial_structure
see #1074
2022-03-25 17:36:30 -07:00
Leonardo de Moura
1afee372f7 refactor: move consume_type_annotations declaration to expr.h 2022-03-10 08:00:39 -08:00
Leonardo de Moura
33883e9d2a fix: resulting type of projection functions should not include auxiliary type annotations (e.g., autoParam) 2022-03-10 07:47:38 -08:00
Sebastian Ullrich
f2d5470f19 feat: allow interpretation of constants initialized by native code 2022-03-07 10:59:49 +01:00
Leonardo de Moura
049273afee fix: add workarounds to code generator
The issue is only going to be properly fixed when we rewrite `csimp`
in Lean. The `csimp` performs transformations that do not preserve
typability, but it also uses the kernel `infer_type` which assumes the
input is type correct. In the new `csimp`, we must have a different
`infer_type` which returns an `Any` type in this kind of situation.

The workaround in this commit simply disables optimizations when
`infer_type` fails. It does not fix all occurrences of this problem,
but the two places that issue #1030 triggered.

closes #1030
2022-02-25 08:47:56 -08:00
Leonardo de Moura
dedb6ee01b fix: skip value if type is computationally irrelevant 2022-02-17 10:41:16 -08:00
Leonardo de Moura
ba0904060b chore: missing trace_pp_expr 2022-02-17 10:40:21 -08:00
Sebastian Ullrich
c59f7a55cf fix: initialize precompiled modules 2022-01-20 18:55:57 +01:00
Gabriel Ebner
ab276a5ae3 chore: show declaration with sorry in #eval 2022-01-17 13:18:22 -08:00
Leonardo de Moura
999e125e3f feat: mark arguments such as {_ : BEq α} as specialization target
We want to specialize functions such as
```
def find? {_ : BEq α} {_ : Hashable α} : PersistentHashMap α β → α → Option β
  | { root := n, .. }, k => findAux n (hash k |>.toUSize) k
```
2022-01-17 13:05:50 -08:00
Leonardo de Moura
6ea0aaf35a fix: do not invoke add_extern for declarations marked with implementedBy 2022-01-14 20:27:50 -08:00
Leonardo de Moura
9499cea2a5 fix: bug at skip_code_generation 2022-01-14 19:58:24 -08:00
Leonardo de Moura
b22a3a4cc4 feat: skip code generation for declarations marked with implementedBy, init, and builtinInit
This is a bit hackish. We should clean up when we rewrite the compiler
in Lean.
2022-01-14 19:20:16 -08:00
Gabriel Ebner
e605c541d0 fix: do not infer type in erase_irrelevant
At the time erase_irrelevant is called, we have already eliminated the
`cast`-applications.  Therefore non-atomic expressions may no longer
be well-typed (and `infer_type` can fail).
2022-01-03 07:13:55 -08:00
Sebastian Ullrich
292fb257a7 perf: do not specialize Prop typeclasses 2021-12-22 17:48:11 -08:00
Sebastian Ullrich
399ad64854 perf: do not specialize Inhabited 2021-12-22 17:48:11 -08:00
Sebastian Ullrich
45e8d9af43 feat: support [nospecialize] on typeclasses 2021-12-22 17:48:11 -08:00
Sebastian Ullrich
fdd939fc40 fix: accidental memory leak in last commit 2021-12-21 19:43:02 +01:00
Sebastian Ullrich
3318f1fb05 feat: record declaration name in interpretation profile 2021-12-21 19:04:58 +01:00
Gabriel Ebner
e65f3fe810 fix: use redirected stderr for tout() 2021-12-16 10:23:05 -08:00
Joshua Seaton
a9317760e7
chore: update IR interpreter enum hygiene
This change addresses -Wreturn type and -Wimplicit-fallthrough
infractions in the IR interpreter. Moreover, default switch cases on
enum classes are removed to leverage compiler complaints of missing
cases, which ensures that all related switch logic gets thoughtfully
extended when the enums are extended themselves.
2021-11-28 10:29:08 +01:00
Leonardo de Moura
50ac21d0a6 refactor: move is_constructor_app to inductive.cpp 2021-11-25 11:31:00 -08:00
Leonardo de Moura
e22bffa94f refactor: move is_structure_like to inductive.cpp 2021-11-25 11:31:00 -08:00
Sebastian Ullrich
5a65189894 chore: use empty string for --githash instead of weird "GITDIR-NOTFOUND" when not building from commit 2021-11-04 15:29:48 -07:00
Leonardo de Moura
352391bfcb chore: remove mpz_get_d dependency 2021-10-26 12:40:20 -07:00
Leonardo de Moura
80a73dd903 feat: basic support for definitions at inductive declarations 2021-10-25 12:44:35 -07:00
Leonardo de Moura
81729d96f9 fix: make sure Quot primitives stay in eta expanded form
fixes #716
2021-10-08 09:36:06 -07:00
Leonardo de Moura
305d035f17 chore: use lean_always_assert at erase_irrelevant.cpp
The performance impact should be insignificant, and it should help
debugging issue https://github.com/leanprover/lean4/issues/716
2021-10-07 07:44:56 -07:00
Leonardo de Moura
28d81ee456 fix: do not extract closed terms containing constants being defined
It may produce crashes during initialization.
2021-09-30 12:46:38 -07:00
Sebastian Ullrich
b13d3e6ca5 fix: dllexport functions not already annotated in header 2021-09-20 18:41:46 +02:00
Leonardo de Moura
3fa54e604d fix: inductive type name is not a necessarily a prefix of the constructor name in Lean 4 anymore 2021-09-14 18:52:43 -07:00
Leonardo de Moura
96d00ff2d7 fix: fixes #664 2021-09-12 19:54:45 -07:00
Leonardo de Moura
e6f02b7b1a fix: workaround for inlining heuristic 2021-09-11 14:05:29 -07:00
Leonardo de Moura
6b235b05d2 feat: avoid code generation after stage1 for match auxiliary functions 2021-09-11 13:41:38 -07:00
Leonardo de Moura
c8406a301d chore: reduce src/include/lean 2021-09-07 08:24:54 -07:00
Leonardo de Moura
fc334ffbee fix: pattern matching on UInt 2021-09-05 19:15:59 -07:00
Leonardo de Moura
152572386b chore: fix comment 2021-08-27 10:43:51 -07:00
Leonardo de Moura
6713d8777a fix: work duplication bug at specialize.cpp
closes #646
2021-08-27 10:35:27 -07:00
Leonardo de Moura
6cfdfe9942 feat: apply csimp attribute constant replacements 2021-08-21 12:22:15 -07:00
Sebastian Ullrich
5f4b1b1d44 Revert "Revert "feat: reintroduce libleanshared, link lean & leanpkg against it""
This reverts commit ccbc9d00db.
2021-08-20 09:42:05 -07:00
Sebastian Ullrich
ccbc9d00db Revert "feat: reintroduce libleanshared, link lean & leanpkg against it" 2021-08-20 15:39:00 +02:00
Sebastian Ullrich
58d6f3b817 fix: search all loaded modules for symbols on Windows 2021-08-18 13:54:52 +02:00
Leonardo de Moura
14b611af96 refactor: move buffer.h and *_ref.h files to runtime 2021-08-16 15:39:38 -07:00