Commit graph

418 commits

Author SHA1 Message Date
Sebastian Ullrich
db6b1d6e85 feat(frontends/lean/vm_elaborator,library/init/lean/elaborator): pass parser_state between languages, create parser object on C++ side to existing functions (that don't actually parse anything) 2018-12-18 15:30:38 +01:00
Sebastian Ullrich
cf1aa13a2c feat(library/init/lean/elaborator): to_pexpr: translate match nodes to pre_equations pexpr
Building a proper `equations` pexpr in Lean is not feasible right now because we
need global+local name resolution, [pattern] attribute retrieval, ... to
reimplement `patexpr_to_pattern`. The `pre_equations` will instead be converted
by the old elaborator using this function (TBD).

With this change, `to_pexpr` can now translate every basic definition body in
`core.lean`.
2018-12-05 12:57:41 +01:00
Leonardo de Moura
ed4eeddf0a feat(runtime/object): add more string primitives 2018-11-14 16:51:10 -08:00
Leonardo de Moura
2fa938220b chore(library/init/data/string): cleanup 2018-11-14 14:09:45 -08:00
Leonardo de Moura
835b3a10cc chore(library/init): consistent names 2018-11-14 13:08:57 -08:00
Leonardo de Moura
f404c5c446 refactor(library/init/data): make sure uint* and usize are irreducible
Remark: this commit breaks the support for `uint*` and `usize` in the old VM.
2018-11-06 16:55:02 -08:00
Leonardo de Moura
34f01ff32e chore(library/init/data/nat/basic): missing [specialize] 2018-10-31 14:44:23 -07:00
Leonardo de Moura
cc3767e6a5 refactor(library/init/data): avoid indirection at rbmap
Now, the nodes in a `rbmap` contain the key and value, and we avoid
one level of indirection. `rbmap`s are more common than `rbtree`.
We implement `rbtree A` as `rbmap A unit`.
2018-10-26 17:14:09 -07:00
Leonardo de Moura
3ee863da68 feat(library/compiler/erase_irrelevant): eliminate cases_on for builtin types 2018-10-23 14:58:38 -07:00
Leonardo de Moura
8d47d2a026 chore(library/vm,library/init/meta): remove vm_format, and some obsolete meta objects 2018-10-23 11:32:56 -07:00
Leonardo de Moura
89afabae29 refactor(library/init/lean/parser/parsec): make sure custom error message doesn't need to be inhabited 2018-10-21 10:57:23 -07:00
Leonardo de Moura
12d8b0e7ef feat(library/init/data): annotate rbtree and rbmap functions 2018-10-19 14:57:31 -07:00
Leonardo de Moura
38bc3beffb fix(library/init): alternative instances
Both `alternative` and `monad` implement `applicative`. However,
their default implementations for `seq_right` and `seq_left` are
different. The `alternative` implementation uses the inefficient default
version for `seq_right` available at `applicative`:
```
(seq_right := λ α β a b, const α id <$> a <*> b)
```
instead of the more efficient
```
(seq_right := λ α β x y, x >>= λ _, y)
```
defined at `monad` using the `bind` operator.

This commit makes sure the `applicative` instances for `reader_t`,
`state_t`, `option` and `parsec_t` use the efficient version.
I found the problem when inspecting the generated code for:
```
def symbol (s : string) : parsec' unit :=
(str s *> whitespace) <?> ("'" ++ s ++ "'")
```
2018-10-17 14:25:50 -07:00
Leonardo de Moura
17cb9b4532 chore(library/init/data/repr): remove unnecessary definition 2018-10-17 12:32:38 -07:00
Leonardo de Moura
fa9d6b4ddf chore(library/init): missing [inline] and remove unnecessary defs 2018-10-17 08:38:30 -07:00
Leonardo de Moura
5683143e8d chore(library/init/data/to_string): remove unnecessary definition 2018-10-16 16:18:07 -07:00
Leonardo de Moura
effccf9a6d chore(library/init): mark a few combinators with [specialize] 2018-10-15 13:47:26 -07:00
Sebastian Ullrich
50e6b42f8c fix(frontends/lean/elaborator): ensure_no_unassigned_metavars: only check mvars in parameter
Had forgotten to re-check the standard lib...
2018-10-07 21:11:02 -07:00
Leonardo de Moura
4bcb7051a8 chore(library/init/data/nat/basic): missing @[inline] 2018-10-03 17:24:53 -07:00
Leonardo de Moura
dc937281b3 chore(library/init/string): remove string.iterator_imp 2018-10-02 13:46:01 -07:00
Leonardo de Moura
5ff63c3c96 feat(library/init/data/uint): add uint8 2018-10-01 14:17:11 -07:00
Leonardo de Moura
3a4acbee9e chore(library/init/data/string): remove string_imp
We will use the (to be implemented) `opaque` keyword
2018-10-01 14:17:11 -07:00
Sebastian Ullrich
5123148aa6 feat(library/init/data/string/basic): trim whitespace around symbols 2018-09-28 13:08:24 -07:00
Leonardo de Moura
6a7fbb24f5 feat(library/init/data/dlist): inlining dlist functions is counterproductive 2018-09-24 18:47:10 -07:00
Leonardo de Moura
a31f12d8cd chore(library/init/core): revert ite+thunks modification
We don't need it since we marked `ite` as `[macro_inline]`
2018-09-23 19:27:06 -07:00
Leonardo de Moura
4fd2e71bc9 chore(library/init/data/ordering/basic): mark cmp_using as [inline] 2018-09-17 14:56:31 -07:00
Leonardo de Moura
b07c718425 refactor(library/init/core): change ite signature 2018-09-17 14:27:28 -07:00
Sebastian Ullrich
fea637288d fix(library/init/data/nat/basic,library/vm/vm_nat): regression in old compiler: primitive for nat equality was ignored
Improves parser performance by 26%
2018-09-14 16:33:04 -07:00
Leonardo de Moura
afd54039ab chore(library): remove >>, we should use *> 2018-09-12 17:31:21 -07:00
Leonardo de Moura
9e305a5f26 chore(library): remove return, we should use pure 2018-09-12 16:51:11 -07:00
Leonardo de Moura
4e6748b55b feat(library/init/data/rbmap/basic): add rbmap_core low level functions 2018-09-09 18:18:40 -07:00
Leonardo de Moura
5ae63ea1f2 chore(library/init/data/list/basic): remove unnecessary workaround 2018-09-07 17:10:23 -07:00
Leonardo de Moura
71dd8653bc feat(library/init/core): decidable_eq is a proper class
We need this to take advantage of the new indexing structure we are
going to add to improve performance.
2018-09-07 16:38:11 -07:00
Leonardo de Moura
c48eaed9a4 chore(library): remove relation_manager 2018-09-07 12:35:04 -07:00
Sebastian Ullrich
d4105e1e16 chore(library/init/lean/parser/basic): avoid nesting rbnode in trie
The new two-layer rbnode/list structure is a little faster
2018-09-05 10:37:03 -07:00
Leonardo de Moura
66adac6af6 chore(library/init): avoid calc at corelib 2018-08-27 12:17:30 -07:00
Sebastian Ullrich
80745ba776 chore(library/init/data/string/basic): rename string.iterator's next_to_string to remaining_to_string
The old name implied that `curr` was not part of its result
2018-07-05 10:42:37 +02:00
Sebastian Ullrich
9e51ff5580 feat(library/init/data/string/basic): add forward and is_prefix_of_remaining to iterator 2018-07-05 10:20:25 +02:00
Leonardo de Moura
0a5d5b9036 fix(library/init/data/list/basic): list.lt 2018-06-21 09:16:58 -07:00
Leonardo de Moura
70fc656931 refactor(library/init/data/nat/basic): remove nat.less_than_or_equal inductive predicate
We now define nat.le using (nat.ble : nat -> nat -> bool) function.
We will add builtin support for reducing `nat.ble` efficiently when the arguments are the to be added nat literals.
2018-06-14 11:30:09 -07:00
Leonardo de Moura
a7d08d2f3d feat(kernel/inductive/inductive): dependent elimination for inductive predicates
In Lean4, we will not generate non dependent recursors for inductive
predicates. The main goal is to make the shape of the automatically
generated recursors more uniform. The non uniform representation is
leftover from Lean2. In Lean2, we wanted to support different kernels
with different features. For example: we could create proof relevant
kernels, no impredicative universe, etc.
Recall that, in a kernel with an impredicative Prop and no proof
irrelevance, inductive predicates without dependent elimination are
weaker that inductive predicates with dependent elimination.
When proof irrelevance is enabled, we can generate the dependent
recursor from the non dependent one. Actually, the module drec.cpp
generates the dependent recursor.
Now, we only support one kind of kernel, and it doesn't make sense
anymore to generate non dependent recursors for inductive predicates.
This would only produce an unnecessary asymmetry on the inductive
datatype module.

Remark: we had to create non dependent recursors to help the elaborator.
This can be avoid if we improve the elaborator. I will do that in the
new elaborator implemented in Lean.

Remark: equation lemmas are broken for definitions that pattern match on
nested inductive datatypes. The problem is the super messy
`prove_eq_rec_invertible_aux` function. This function will not be needed
after I finish the new inductive datatype support in the kernel.

cc @kha
2018-06-12 13:03:26 -07:00
Leonardo de Moura
e9b4b811de chore(library/equations_compiler/util): disable generation of equational lemmas
@kha, `eqn_compiler.lemmas` is false by default.
I will keep them disabled until I remove the inductive compiler.
I'm building the new inductive datatype module (to replace the inductive
compiler), and the lemmas will fail to be proved in the next commits
until the transition is complete.
2018-06-12 13:03:25 -07:00
Leonardo de Moura
530c437953 feat(library/init/data/char/basic): missing theorems for equation compiler 2018-06-06 08:47:17 -07:00
Sebastian Ullrich
732c823646 feat(library/init/lean/parser): remove syntax_id, use De Bruijn indices instead 2018-06-06 15:36:28 +02:00
Leonardo de Moura
60339d6c87 feat(library/init/data/hashmap/basic): missing function 2018-06-04 19:58:24 -07:00
Leonardo de Moura
4d7ae73d39 feat(library/init/lean): add level 2018-05-22 09:45:18 -07:00
Leonardo de Moura
afd018d7cc chore(*): remove several tactics 2018-05-21 06:53:01 -07:00
Leonardo de Moura
032a101262 chore(*): remove more files
@kha I'm trying to remove as much as possible before I start
modifying `expr`
2018-05-21 06:42:58 -07:00
Leonardo de Moura
0955962f65 chore(*): remove some unnecessary files and tactics 2018-05-21 06:29:50 -07:00
Leonardo de Moura
0c785f8ab7 feat(library/init/data): add instances for has_repr (id A) and has_to_string (id A) 2018-05-10 17:37:57 -07:00