Commit graph

1523 commits

Author SHA1 Message Date
Leonardo de Moura
61191f9921 chore: use b_obj_arg annotation 2019-12-22 15:14:36 -08:00
Sebastian Ullrich
3b37737c8a fix: leaks 2019-12-22 15:09:19 -08:00
Leonardo de Moura
fdfff29bb1 feat: expose liftLooseBVars and lowerLooseBVars 2019-12-21 08:57:11 -08:00
Leonardo de Moura
6ae510cea4 fix: reject inductive datatypes with duplicate constructor names 2019-12-14 09:11:39 -08:00
Leonardo de Moura
8192828b9c fix: lean_expr_update_* functions 2019-12-11 10:15:21 -08:00
Leonardo de Moura
427df087e8 feat: instantiateLevelParams in Lean 2019-12-01 18:32:48 -08:00
Sebastian Ullrich
3980194fbf chore: more assertions and old code 2019-11-19 12:55:02 +01:00
Sebastian Ullrich
11809d23a9 chore: remove outdated assertion
/cc @leodemoura
2019-11-19 10:56:35 +01: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
3ae5c2f2e4 chore: remove old comment 2019-11-15 14:11:50 -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
aea02eb1f8 chore: fix MVar refactoring issues 2019-11-15 10:04:42 -08:00
Leonardo de Moura
d9f3b4bf63 refactor: remove Expr.mvar hidden field 2019-11-15 10:04:42 -08:00
Leonardo de Moura
017554fbb6 chore: minor optimization 2019-11-11 17:23:59 -08:00
Leonardo de Moura
1e065d495b feat: expose hasLooseBVar 2019-11-09 12:29:50 -08:00
Leonardo de Moura
54ce57fe26 feat: add instantiateRevRange 2019-11-08 08:28:31 -08:00
Leonardo de Moura
146aa71886 feat: reduce auxiliary recursors 2019-11-02 14:38:24 -07:00
Leonardo de Moura
8c7f514a9d feat: expose instantiateLevelParams 2019-10-31 20:12:08 -07:00
Leonardo de Moura
7c99d58b83 chore: update stage0 and fix local_ctx.cpp 2019-10-26 09:55:31 -07:00
Leonardo de Moura
f46db3cc01 feat: add Expr helper functions 2019-10-25 16:47:07 -07:00
Leonardo de Moura
966882b85c feat: add Expr.updateMData 2019-10-25 10:57:17 -07:00
Leonardo de Moura
14afe50384 chore: fix extern Level primitive names 2019-10-24 19:09:37 -07:00
Leonardo de Moura
025e9d32ef feat: update functions for universe levels, use C version of Level.hasParam and Level.hasMVar 2019-10-24 19:04:01 -07:00
Leonardo de Moura
ba286dee8e chore: update stage0 2019-10-24 17:44:41 -07:00
Leonardo de Moura
cb210b0adc feat: expose Expr.hasExprMVar and Expr.hasLevelMVar 2019-10-24 17:32:47 -07:00
Leonardo de Moura
563da4522d chore: udpate stage0 2019-10-24 15:12:09 -07:00
Leonardo de Moura
d1c9a440d8 feat: add missing Expr.update* functions 2019-10-24 15:10:03 -07:00
Leonardo de Moura
93c6ab8eee feat: add Expr.updateApp test of concept 2019-10-23 15:19:34 -07:00
Leonardo de Moura
0032c02247 feat: expose Expr.equal (structural equality) and adding Expr mappings aliases 2019-10-23 10:49:51 -07:00
Leonardo de Moura
9baf91e641 feat: add Level.isEquiv 2019-10-21 10:56:59 -07:00
Leonardo de Moura
1aac5380b9 chore: use TO_REF 2019-10-19 14:23:15 -07:00
Leonardo de Moura
cc18c0ef91 feat(library/init/lean/expr): add Expr.hasFVar and Expr.hasMVar
cc @dselsam
2019-10-02 10:07:26 -07:00
Leonardo de Moura
a507145eb1 feat(library/init/lean/level): add instance : HasBeq Level 2019-10-01 09:47:44 -07:00
Leonardo de Moura
2b252a441e feat(library/init/lean/declaration): add ConstantInfo.instantiateTypeUnivParams and ConstantInfo.instantiateValueUnivParams
cc @dselsam

See new test for an example.
2019-09-30 15:46:19 -07:00
Leonardo de Moura
faebe15a7f feat(library/init/lean/expr): add efficient instantiate1
cc: @dselsam
2019-09-30 14:33:32 -07:00
Leonardo de Moura
2abca22e00 fix(kernel/instantiate): compilation problem on Windows 2019-09-18 18:41:59 -07:00
Leonardo de Moura
eebc722f57 feat(library/init/lean/expr): add abstractRange 2019-09-17 17:17:46 -07:00
Leonardo de Moura
75e5f5bfd8 feat(library/init/lean/expr): expose abstract 2019-09-16 18:34:45 -07:00
Leonardo de Moura
704f90d728 feat(library/init/lean/expr): expose instantiate and instantiateRev 2019-09-16 18:29:43 -07:00
Leonardo de Moura
51955bd945 chore(kernel/instantiate): remove obsolete optimization
I also tested its effectiveness in Lean3, and I did not observe any
performance impact when compiling stdlib without it.
2019-09-16 16:09:26 -07:00
Leonardo de Moura
3b762d4dc0 refactor(runtime): C backend 2019-08-24 07:40:38 -07:00
Leonardo de Moura
dcd15f3424 refactor(runtime): C backend 2019-08-24 07:40:38 -07:00
Leonardo de Moura
a5c97e21bf chore(library/init/lean): export as C functions 2019-08-16 20:15:30 -07:00
Leonardo de Moura
19051d9a0d chore(library/init/lean/localcontext): export as C functions 2019-08-16 19:49:17 -07:00
Leonardo de Moura
03e455d32d feat(frontends/lean/elaborator): add oldElaborate 2019-08-13 19:23:29 -07:00
Leonardo de Moura
68a93a358c fix(kernel/expr): initialization problem 2019-08-13 15:04:02 -07:00
Leonardo de Moura
73f96730bb feat(library/init/lean,kernel): add KernelException, addDecl and compileDecl
This commit also refines the type of `addAndCompile`.
We also add `ElabException.kernel` constructor for kernel exceptions.
2019-08-07 17:15:40 -07:00
Leonardo de Moura
ae97cfdd68 feat(kernel/local_ctx): use LocalContext 2019-08-07 11:50:20 -07:00
Leonardo de Moura
bad3f8e77e chore(kernel/local_ctx): use new representation defined at localcontext.lean 2019-08-06 10:47:50 -07:00