Commit graph

13 commits

Author SHA1 Message Date
Leonardo de Moura
a39c0531cf feat(library/init/data): has_lt for string and list 2017-11-13 15:30:41 -08:00
Leonardo de Moura
9399ce8346 feat(library/vm/vm_string): provide native implementation of type string in the VM
closes #1175

The types `string_imp` and `string.iterator_imp` were supposed to be
marked private, but we cannot do it because we need to provide
`string_imp.mk`, `string_imp.cases_on`, `string.iterator_imp.mk` and
`string.iterator_imp.cases_on` in the VM since we use a different
internal representation. Note that marking them as private does not
work since users can still access `string_imp.cases_on` using
meta-programming.
So, we need better support for private declarations.

Missing feature, char literals do not support non ASCII values.
That is, in the current implementation, we cannot write 'α'.
This will be implemented in the future.

The VM native implementation does not behave correctly for huge
strings (i.e., strings with more than 4G characters).
The problem is that the current implementation relies on
```
size_t force_to_size_t(vm_obj const & o, size_t def)
```
We may also have overflow problems in the string.iterator implementation
code. This is not a big deal right now, since I doubt we will try
to process string with more than 2^32 characters.

@Kha the `core_lib` and tests seem to be working correctly, but
we need more tests.
2017-10-23 10:55:26 -07:00
Leonardo de Moura
28501a0e0e feat(library/init/data/string): string as a list of unicode scalar values, and iterator abstraction
TODO:
- Implement string primitives in the VM.
- Support for unicode char literals.
2017-10-23 10:55:26 -07:00
Sebastian Ullrich
30f4b2f2dd refactor(library): list.taken/dropn ~> list.take/drop 2017-07-05 11:20:10 -07:00
Leonardo de Moura
dc1a1c8540 refactor(library): has_to_string ==> has_repr
See issue #1664

This is just the first step to implement proposal described at issue #1664.
2017-06-18 18:29:19 -07:00
Gabriel Ebner
dc81915da6 refactor(library): unify char.to_string and char.has_to_string 2017-06-12 16:32:35 +02:00
Leonardo de Moura
0b04376676 refactor(library/init/data/string/basic): mark string implementation as private
See issue #1175

BTW, we may have to revise this decision in the future when we decide to
populate the string library with lemmas.
It is inconvenient to prove the lemmas at string/basic.lean since the
tactic framework has not been defined yet.
Anyway, I think it is worth to keep the private for now, and make sure
nobody relies on its implementation.
2017-06-07 18:00:24 -07:00
Leonardo de Moura
4eefc41b6e refactor(*): wrap string in a structure
We want to make sure string users do not depend on the string
implementation. This is the first step.

We need this refactoring *now* to make sure it will not be
super painful to address issue #1175
2017-06-07 17:30:49 -07:00
Leonardo de Moura
a0a8103804 chore(frontends/lean): go back to 'c' as notation for characters
This suggestion has been discussed at Slack.
We have decided to use #"c" as notation because we wanted to allow `'`
in the beginning of identifiers like in SML and F*. In particular,
we wanted to allow users to use 'a 'b 'c for naming type parameters
like in SML. However, nobody used this notation. In the Lean standard
library, we are using greek letters for naming type parameters.
So, there is no real motivation for the ugly #"c" syntax.
2017-05-02 13:00:51 -07:00
Leonardo de Moura
f6556ecdcc fix(library/init): missing has_sizeof instances for subtype, char and string 2017-04-15 23:31:14 -07:00
Leonardo de Moura
71685e4dd6 feat(frontends/lean): add support for t.<id> and t.<idx> when t is a composite term
Replace `^.` with `.` in the stdlib
2017-03-28 17:47:49 -07:00
Daniel Selsam
95882c14cd feat(init/data/string/basic.lean): inhabited string 2016-12-23 14:45:53 -08:00
Leonardo de Moura
e11fd8820a refactor(library/init): create init.data folder 2016-12-02 14:23:06 -08:00
Renamed from library/init/string.lean (Browse further)