lean4-htt/library/init/data
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
..
array feat(library/init): add d_array type 2017-11-06 14:56:11 -08:00
bool feat(library/init/data/bool/lemmas): helper lemmas 2017-11-06 14:19:44 -08:00
char feat(library/init/data/char): char as an unicode scalar value 2017-10-23 10:55:26 -07:00
fin chore(init/data/nat/lemmas): pred_le_pred: remove superfluous assumption 2017-09-15 12:33:46 -07:00
int feat(init/meta/derive): implement [derive] attribute 2017-09-05 23:14:34 +02:00
list feat(library/vm/vm_string): add builtin VM implementation for string.has_decidable_eq 2017-10-23 10:55:26 -07:00
nat refactor(algebra/ordered_group): remove redundant axioms 2017-10-23 12:20:42 -07:00
option fix(init/data/option/instances): Use option.* instead of option_* 2017-09-05 08:35:26 +02:00
sigma refactor(frontends/lean/tactic_notation): rename note/define tactics to have/let 2017-06-22 08:03:23 -07:00
string feat(library/vm/vm_string): add builtin VM implementation for string.has_decidable_eq 2017-10-23 10:55:26 -07:00
subtype feat(init/data/subtype): add subtype.eta 2017-05-27 04:13:59 -04:00
sum feat(frontends/lean): no global universes in the frontend 2017-02-08 17:23:04 -08:00
unsigned feat(library/init/data/fin): add div 2017-03-05 16:43:15 -08:00
basic.lean refactor(library): add has_to_string back (but it produces unquoted values) 2017-06-18 18:30:10 -07:00
default.lean refactor(library): remove vector and bitvec from init 2017-08-16 13:40:50 -07:00
option_t.lean refactor(frontends/lean/tactic_notation): rename note/define tactics to have/let 2017-06-22 08:03:23 -07:00
ordering.lean feat(library/vm/vm_string): add builtin VM implementation for string.cmp 2017-10-23 10:55:26 -07:00
prod.lean feat(library/init/data/prod): add prod.map 2017-03-07 19:30:51 -08:00
quot.lean feat(init/data/quot): show that quot is the quotient by the generated equivalence 2017-05-27 04:14:00 -04:00
repr.lean fix(library/string): unicode char literals 2017-10-27 09:48:09 -07:00
set.lean feat(library/tactic/dsimplify): new configuration options for dsimp 2017-07-02 18:26:03 -07:00
setoid.lean chore(library/init/data/quot): use Sort instead of Type 2017-03-07 14:29:57 -08:00
to_string.lean refactor(library): add has_to_string back (but it produces unquoted values) 2017-06-18 18:30:10 -07:00
unit.lean refactor(library/data): delete init/data/instances.lean 2016-12-02 16:41:16 -08:00