Commit graph

37 commits

Author SHA1 Message Date
Kim Morrison
1758b37a71
chore: List.filterMapM runs and returns left-to-right (#4820)
Closes #4676. Previously `List.filterMapM` was returning results
left-to-right, but evaluating right-to-left.
2024-07-24 09:00:10 +00:00
Kim Morrison
3a457e6ad6
chore: use #guard_msgs in run tests (#4175)
Many of our tests in `tests/lean/run/` produce output from `#eval` (or
`#check`) statements, that is then ignored.

This PR tries to capture all the useful output using `#guard_msgs`. I've
only done a cursory check that the output is still sane --- there is a
chance that some "unchecked" tests have already accumulated regressions
and this just cements them!

In the other direction, I did identify two rotten tests:
* a minor one in `setStructInstNotation.lean`, where a comment says `Set
Nat`, but `#check` actually prints `?_`. Weird?
* `CompilerProbe.lean` is generating empty output, apparently indicating
that something is broken, but I don't know the signficance of this file.

In any case, I'll ask about these elsewhere.

(This started by noticing that a recent `grind` test file had an
untested `trace_state`, and then got carried away.)
2024-05-16 00:38:31 +00:00
Leonardo de Moura
d9273786c7 chore: remove when and «unless»
They are obsolete.

cc @Kha
2021-03-20 18:52:18 -07:00
Leonardo de Moura
2c06ba577e chore: fix test 2020-11-17 17:14:06 -08:00
Leonardo de Moura
7e533b4650 refactor: use Lists for Array reference implementation
Motivation: better reduction in the kernel.

cc @Kha
2020-11-17 17:05:53 -08:00
Leonardo de Moura
db9e390b4d chore: remove new_frontend from tests 2020-10-25 09:16:38 -07:00
Leonardo de Moura
c10e92b348 chore: add temporary workarounds 2020-09-30 07:05:46 -07:00
Leonardo de Moura
ef9b661c8d chore: add temporary workarounds until we implement new elabDo 2020-09-26 18:11:46 -07:00
Leonardo de Moura
c46e64b089 feat: add Array.zipWith and Array.zip 2020-09-23 18:24:56 -07:00
Leonardo de Moura
2ee1821f13 fix: ensure expectedType at fun body 2020-09-13 13:44:05 -07:00
Leonardo de Moura
e4a3b434d7 chore: moving tests to new frontend
@Kha The transition has begun :)
I found and fixed a few bugs, but it is going well so far.
2020-09-10 18:00:34 -07:00
Leonardo de Moura
ea2e86afba feat: add Array.allDiff 2020-09-08 16:16:14 -07:00
Leonardo de Moura
fc1e4cb533 feat: add Array.isPrefixOf 2020-09-08 14:40:43 -07:00
Leonardo de Moura
3ae3c51a8c feat: add Array.partition 2020-09-05 08:48:15 -07:00
Leonardo de Moura
3dbd2b728b feat: add Array.getMax? 2020-09-04 10:40:34 -07:00
Leonardo de Moura
b4b60dc326 feat: add List.filterMapM 2020-08-14 10:50:48 -07:00
Leonardo de Moura
bd8e2d305f feat: add Array.filterMap 2020-08-14 10:50:48 -07:00
Leonardo de Moura
6be71b337f refactor: add prototype2.lean 2020-08-04 18:35:11 -07:00
Leonardo de Moura
d2d6e85719 feat: add forRevM 2019-12-19 17:24:29 -08:00
Leonardo de Moura
69723b48c3 feat: add Array.insertAt 2019-11-22 17:42:27 -08:00
Leonardo de Moura
b147ebad67 chore(tests/lean/run/array1): remove #exit 2019-09-19 10:47:40 -07:00
Sebastian Ullrich
8cb387e599 chore(tests/lean/extract): reactivate some #eval tests 2019-09-19 18:12:51 +02:00
Leonardo de Moura
a02443d23d chore(frontends/lean): fun x, e ==> fun x => e 2019-07-02 13:22:11 -07:00
Leonardo de Moura
4149a25186 chore(tests): fix tests 2019-03-29 11:25:26 -07:00
Leonardo de Moura
7bb015c6b3 chore(tests/lean): fix more tests 2019-03-21 15:11:05 -07:00
Sebastian Ullrich
f34d37c371 chore(tests): port tests, fix at least compiler tests 2019-03-21 15:11:05 -07:00
Sebastian Ullrich
6d0b3afa7e fix(library/compiler/compiler): do not silently abort on user-given sorrys 2018-11-17 18:00:55 +01:00
Leonardo de Moura
04227701d6 chore(tests/lean/run): fix the tests
@kha I found the real issue with these two tests.
You have modified the compiler to ignore definitions containing `sorry` :)
2018-11-15 11:21:12 -08:00
Leonardo de Moura
d0ccaa1083 chore(tests/lean): fix tests
TODO: `io` modifications performed yesterday may have affected `eval`.
2018-11-15 10:56:03 -08:00
Leonardo de Moura
69734dfb3a chore(tests/lean): fix tests 2018-08-23 13:49:07 -07:00
Leonardo de Moura
acade175b6 feat(library/init/data/array): store dimension in the array
The array dimension is now stored inside the array.
The main motivation is that it reflects the actual runtime implementation.
We need to store the array size to be able to GC it.
So, it feels silly to have the array size stored in each array object,
but we cannot use this information.
For example, in the `hashmap` we implemented the bucket array using
`array`, and we store the `size` of the array.
Same for the Lean3 `buffer` object.
The `buffer` object doesn't even need to exist.
The actual `array` implementation is the `buffer`
2018-05-03 15:43:03 -07:00
Leonardo de Moura
6234c60aae chore(*): disable test suite 2018-04-10 12:56:55 -07:00
Leonardo de Moura
e96026651b feat(library/init): add d_array type
@kha I added the `d_array` type that we discussed today.
However, the VM implemantion is still using persistent arrays.
If we remove the persistent array support, then code using
hash_map will only be efficient if the hash_map is used linearly.
This is not the case in the reader module because we are planning
to support backtracking.

On the other hand, it is awkward we currently don't have a vanilla
array implementation in the VM. I suspect this will be a problem in
the future.

So, I see the following possibilities:

1- We implement a map data-structure using red-black trees in Lean.
We use this new data-structure to implement all maps in the new reader and
macro expander.

2- We implement a very simple map as a list of pairs.
Then, we replace it in the VM with an efficient implementation.
The VM implementation may use our internal red-black trees.
We may also use a persistent hash table implemented in C++,
but it would be awkward to ask the user to provide a hash function in the reference
implementation (i.e., the one using list of pairs), but not use it
anywhere :)
In contrast, if we use the red-black tree implementation we
would have to ask the user to provide a total order.
It is overkill for the list of pair reference implementation because
we just need an equality test, but, at least, the comparison function
will be used in the implementation.

3- Add types `d_parray` (dependent persistent array) and
`parray` (persistent array). In Lean, they would just wrap the
`d_array` and `array` types. In the VM, `d_array` and `array` would
be implemented using vanilla arrays and `d_parray` and `parray` would
be implemented using persistent arrays. Then, we could have
`d_hash_map`, `hash_map`, `d_phash_map` and `phash_map`. Argh, so many
versions :(
We would use `phash_map` to implement our reader and macro expander.

4- Add a `(persistent : bool := ff)` parameter to `d_array` and
`array` types. The disadvantage of this approach is that it has
a performance impact. The VM implementation would have to check
the `persisent` flag at runtime. The value of this flag is known
at compilation time, but we currently don't have a mechanism
for specializing native builtin C++ implementations for VM functions.
2017-11-06 14:56:11 -08:00
Leonardo de Moura
b0a33259ee fix(library/compiler/simp_inductive): array^.data should not be treated as a regular projection 2017-03-09 19:11:51 -08:00
Leonardo de Moura
9d3c0497cb chore(frontends/lean): rename transient commands
See issue #1432
2017-03-09 18:41:19 -08:00
Leonardo de Moura
3f87fd15eb feat(library/vm): add liveness analysis, and support destructive updates for lean arrays 2017-02-21 15:09:37 -08:00
Leonardo de Moura
e9a98362d3 feat(library): functional arrays 2017-02-20 22:00:02 -08:00