Commit graph

5850 commits

Author SHA1 Message Date
Leonardo de Moura
46adfcfdb6 refactor: Name fully implemented in Lean 2019-11-18 19:54:05 -08:00
Leonardo de Moura
b09fb4348d chore: rename Name constructors 2019-11-18 19:54:05 -08:00
Leonardo de Moura
043e011b72 fix: bug at USet
@Kha: I found the bug. The issue was at `USet`. The argument is a
usize scalar. So, we should use `var` instead of `eval_arg`.
2019-11-18 19:51:53 -08:00
Leonardo de Moura
3bc61e7ee9 chore: remove special support for Name in the equation compiler 2019-11-18 12:45:53 -08:00
Leonardo de Moura
85a1994bbb chore: use mkNameStr and mkNameNum for building quoted names 2019-11-18 12:45:53 -08:00
Leonardo de Moura
5e42b1df09 chore: remove dead constants 2019-11-17 09:46:56 -08:00
Leonardo de Moura
b78ac59523 refactor: Level fully implemented in Lean 2019-11-17 08:24:09 -08:00
Leonardo de Moura
a3ccbe66cf refactor: Expr fully implemented in Lean
No hidden fields.
2019-11-16 12:10:49 -08:00
Leonardo de Moura
85092412c7 refactor: remove Expr.FVar hack
@Kha @dselsam:
This hack was preventing us from making `Expr` a "real" Lean type.
This was bad for a few reasons:
- It was hard to extend/modify `Expr` in Lean since we would also have
to modify the C++ code that creates the `Expr` objects with the hidden
fields.
- `Expr.lam` and `Expr.forallE` were not following the Lean layout
standard where we sort fields by size. @Kha: recall we used that to
avoid a UB. The issue with `Expr.lam` and `Expr.forallE` is that they
have a "visible" field (`BinderInfo`), which is smaller than
hidden fields such as hash code.
- `Expr.fvar` had only one field at `Expr.lean,` but four behind the
scenes.

I added a new constructor `Local` that is only accessible from C++.
It is only used in legacy code we inherited from Lean2.
We will eventually delete it.

This refactoring was quite painful since many parts of the codebase
were mixing the new `Expr.fvar` with the old `Expr.local`.
I doubt I would be able to do it without the new staging framework
@Kha built.

BTW, some of the patches are horrible. I didn't care much since we
are going to deleted the super ugly files. That being said,
you should expect new weird bevaior due to `Expr.fvar` vs `Expr.local`.

Next step: use the new `ExprCachedData` to make all `Expr` hidden visibles
accessible from Lean.

checkpoint
2019-11-15 14:04:26 -08:00
Leonardo de Moura
0926dee83b chore: remove dead code 2019-11-15 11:53:09 -08:00
Leonardo de Moura
d9f3b4bf63 refactor: remove Expr.mvar hidden field 2019-11-15 10:04:42 -08:00
Leonardo de Moura
beac2a1af5 fix: treat panic as unreachable at ll_infer_type_fn
Motivation: ensure the correct type `IRType` is inferred for definitions
such as
```
def f (n : UInt32) : UInt32 :=
if n == 0 then panic! "foo"
else n+1
```
2019-11-14 21:56:09 -08:00
Leonardo de Moura
f31fcbba24 chore: remove unnecessary approximation that just complicates the code 2019-11-14 10:57:34 -08:00
Leonardo de Moura
aa9080e9e7 feat: do not specialize functions inside functions marked with @[specialize] 2019-11-13 13:32:52 -08:00
Sebastian Ullrich
ae3b3bb825 chore: remove cygwin support 2019-11-12 08:28:58 -08:00
Sebastian Ullrich
1f601708e4 fix: print messages to stderr
This ensures that errors during dependency resolution in the Makefile actually show up
2019-11-10 09:01:43 -08:00
Daniel Selsam
0bab51b66e feat: solve typeclass subgoals in reverse order
Some instance arguments may still need to be reversed.
2019-11-09 15:47:50 -08:00
Leonardo de Moura
1ff782334b chore: remove option for disabling zeta 2019-11-08 14:35:43 -08:00
Leonardo de Moura
791250fb9b chore: remove unfold_lemmas option
We should use `transparency_mode::All` instead.
2019-11-08 10:07:27 -08:00
Leonardo de Moura
dce1de3905 chore: remove transparency_mode::None 2019-11-08 10:04:06 -08:00
Leonardo de Moura
975188cee1 fix: typo 2019-11-08 10:02:44 -08:00
Leonardo de Moura
086dd2c362 chore: remove transparency_mode::Instances 2019-11-08 09:54:03 -08:00
Daniel Selsam
7cddeaa0d3 doc: tc triggers nested tc, potentially with tmp metavar leak 2019-11-06 10:15:05 -08:00
Leonardo de Moura
1bf1290570 feat: use kernel projections in constructions
Motivation: auxiliary recursors such as `brecOn` do not depend on
user-facing projection definitions anymore.
Thus, we can simplify `whnfCore` at `TypeUtil`.
2019-11-04 03:38:57 -08:00
Leonardo de Moura
ba7f2849dc chore: use aux recursor extension implemented in Lean 2019-11-02 11:48:02 -07:00
Leonardo de Moura
0c463e17f5 chore: update stage0 2019-10-26 16:37:56 -07:00
Leonardo de Moura
423b0fed3a refactor: use Array Expr at DelayedMVarAssignment 2019-10-25 12:03:09 -07:00
Leonardo de Moura
34acf2003c chore: rename assign delayed method 2019-10-25 10:44:42 -07:00
Leonardo de Moura
a50515e0d6 chore: use => instead of Lean3 , 2019-10-24 15:10:19 -07:00
Leonardo de Moura
b709979102 feat: improve arity guesser for IO extern primitives 2019-10-23 17:29:41 -07:00
Leonardo de Moura
f88561ae68 feat: add trace! macro 2019-10-22 16:08:37 -07:00
Leonardo de Moura
30571f12d4 chore: adjust runtime to new EState 2019-10-21 17:05:16 -07:00
Leonardo de Moura
65e5247944 chore: mark dead code 2019-10-21 10:25:38 -07:00
Leonardo de Moura
eb9f361232 chore: remove dead code 2019-10-21 10:14:19 -07:00
Leonardo de Moura
39e8499c7b fix: new offset at param_borrow 2019-10-11 16:27:29 -07:00
Leonardo de Moura
02ab51505c fix: adjust ir_interpreter
IRType is not a scalar type anymore.
2019-10-11 15:00:26 -07:00
Leonardo de Moura
7adf00666b feat: expose getCtorLayout 2019-10-11 14:34:30 -07:00
Leonardo de Moura
321d9a8a89 chore: update stage0 2019-10-11 10:57:51 -07:00
Leonardo de Moura
4793cbfa9a feat: add #[elem1, elem2, ..] notation for creating arrays
@kha @dselsam: I added this notation because I am tired of writing
`[elem1, elem2, ...].toArray`. BTW, the new notation is based on the
one available in SML.
2019-10-07 15:36:44 -07:00
Leonardo de Moura
c81ab9759f feat: add elimDeadBranches 2019-10-07 13:59:00 -07:00
Leonardo de Moura
81847302a7 feat(library/compiler): replace @[effectful] with @[neverExtract] 2019-10-01 14:06:08 -07:00
Leonardo de Moura
261c0b9c24 feat(frontends/lean): add panic! macro
cc @dselsam
2019-09-30 17:16:19 -07:00
Leonardo de Moura
75bdc8712e feat(library/compiler): disable a few optimizations for declarations tagged with @[effectful]
@kha @dselsam:
The main motivation for this change are functions such as `panic`.
I marked `panic` with the attribute `@[effectful]`.
Here is the summary of the changes. If `f` is marked as `@[effectful]`
1- Compiler will not perform common subexpression elimination on terms of the form `f ...`.
2- Compiler will not extract closed terms of the form `f ...`.
3- Compiler will throw an error if `f` is partially applied.
2019-09-30 16:53:11 -07:00
Sebastian Ullrich
ce558b6a9e doc(library/compiler/ir_interpreter): update docs 2019-09-20 10:46:33 +02:00
Leonardo de Moura
0bd268fc96 fix(library/compiler/erase_irrelevant): add elim_array_cases 2019-09-19 10:47:05 -07:00
Sebastian Ullrich
31c170117e feat(frontends/lean/builtin_cmds,library/compiler/ir_interpreter): reimplement #eval 2019-09-19 17:52:18 +02:00
Sebastian Ullrich
61819bee6d refactor(library/compiler/ir_interpreter): make box_t/unbox_t total 2019-09-19 17:51:51 +02:00
Leonardo de Moura
8148136aa9 fix(util/nat): nat::get_small_value must return size_t since unbox now returns size_t 2019-09-18 17:13:46 -07:00
Leonardo de Moura
b36caf701a chore(library/print): minor improvements 2019-09-17 17:17:46 -07:00
Sebastian Ullrich
a083cab532 fix(library/compiler/ir_interpreter): fix UB sequencing found by GCC 2019-09-17 09:51:24 +02:00