Commit graph

6094 commits

Author SHA1 Message Date
Leonardo de Moura
2c825de6a1 fix: elim_scalar_array_cases 2022-07-24 14:46:46 -07:00
Leonardo de Moura
5253cc6742 fix: compiler support for FloatArray.casesOn and ByteArray.casesOn
closes #1311
2022-07-24 12:36:08 -07:00
Leonardo de Moura
8de798c4a6 feat: reject [macroInline] declarations in recursive declarations
closes #1363
2022-07-24 07:26:35 -07:00
Gabriel Ebner
b48061ed23 feat: expose lower level compile function 2022-07-11 12:26:53 -07:00
Gabriel Ebner
18a299f576 feat: allow implementedBy on constructors and casesOn 2022-07-11 12:26:53 -07:00
Leonardo de Moura
2472a6a1ea chore: fix build
Another ugly hack to survive until we port the code generator to Lean.
2022-07-08 10:34:50 -07:00
Leonardo de Moura
bf91956449 fix: add workaround for issue #1293
This is a temporary hack until we port the C++ code to Lean.

closes #1293
2022-07-07 23:39:35 -07:00
Leonardo de Moura
6ef81e1cdf fix: bug at the code specialization cache
closes #1292
2022-07-07 22:59:18 -07:00
Leonardo de Moura
dd924e5270 chore: remove codegen option
We should use `noncomputable` modifier instead.

closes #1288
2022-07-07 08:18:30 -07:00
Leonardo de Moura
ffc90f6a35 fix: bug at ll_infer_type 2022-07-04 13:55:55 -07:00
Leonardo de Moura
14260f454b feat: improve is_def_eq for projections
It implements in the kernel the optimization in the previous commit.

This commit addresses the following issue raised on Zulip.
https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/unfold.20essentially.20loops/near/288083209
2022-06-30 17:50:44 -07:00
Leonardo de Moura
a888b21bce fix: compiler bug at And.casesOn
Fixes issue reported at https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/.28libc.2B.2Babi.29.20lean.3A.3Aexception.3A.20incomplete.20case/near/287839995
2022-06-29 06:56:17 -07:00
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