Commit graph

265 commits

Author SHA1 Message Date
Leonardo de Moura
e14255e7ae chore(util/sexpr): remove sexpr serializer
It was dead code.
Moreover, sexpr will not be part of Lean4
2018-06-20 11:27:29 -07:00
Leonardo de Moura
9ef934e090 chore(util): style 2018-06-15 16:05:11 -07:00
Leonardo de Moura
13c532d0d4 fix(*): truncation bugs
- Lean strings (like std::string) may contain null characters. The
  codebase was ignoring this issue.

- We now have a wrapper `string_ref` for wrapping Lean string objects in
  C++. This wrapper also implements correctly the coercions std::string <-> string_ref.
  Remark: I also found a few places where the code relies on the
  following property which is not true
  Forall s : std::string, std::string(s.c_str()) == s

- `name` object wrapper was assuming that all numerals were small
  `nat` values. This is true in most cases, but the system would
  crash when processing if it is a big number.

- The commit tries to make sure runtime/util/kernel are correct.
  Modules that will be deleted contain many `TODO` comments
  indicating they may crash and/or produce incorrect results
  when strings contain null characters and numerals are big.

cc @kha

@kha: I thought about using `string` instead of `string_ref`.
We consistently use `std::string`. So, it should be fine, but I
was concerned about code readability.

After we bootstrap Lean4, we will be able to delete `lean::list`
template, and rename `lean::list_ref` to `lean::list`.

I am going to add `pair_ref` for wrapping Lean pair objects.
If we use `lean::string` instead of `lean::string_ref`, then
we should also use `lean::pair` instead of `lean::pair_ref`.
But, there is a problem in this case since we have
https://github.com/leanprover/lean4/blob/master/src/util/pair.h#L13
:(
2018-06-15 16:05:11 -07:00
Leonardo de Moura
4432629eb0 feat(util/nat): add C++ wrapper for manipulating runtime nat values 2018-06-13 09:29:52 -07:00
Leonardo de Moura
c697cf4c29 chore(tests/util): remove exception test 2018-06-07 16:28:54 -07:00
Leonardo de Moura
5b17a30203 feat(runtime): add object serializer
Any type implemented on top of `object` gets the serializer/deserializer for free
2018-05-22 16:34:41 -07:00
Leonardo de Moura
0556412f8d refactor(*): add runtime folder
@kha The runtime folder includes what is needed to link a
standalone Lean program. It is still contains some unnecessary files.
We will be able to remove them after we release Lean4.
2018-05-14 14:23:56 -07:00
Leonardo de Moura
4b6583ae9f refactor(util): move mpz/mpq to util
The new lean_obj objects will be defined at util.
Reason: we will define `name`, `options`, `format`, ... on top of lean_obj.
lean_obj depends on mpz.
Remark: lean_obj will replace vm_obj.
2018-04-12 16:43:11 -07:00
Leonardo de Moura
d1cdae9d90 chore(util/sequence): remove dead code 2018-04-12 16:43:10 -07:00
Leonardo de Moura
1dd7165694 chore(util): remove dead code 2018-04-12 16:43:10 -07:00
Leonardo de Moura
4c14668bf0 chore(util/lru_cache): remove dead code 2018-04-12 16:43:10 -07:00
Leonardo de Moura
e3c1f6c7da chore(util/numerics): remove more leftovers from Lean1 2018-04-12 16:43:10 -07:00
Leonardo de Moura
46b0fd35ec chore(util/numerics): remove Z/pZ field
This abstraction was added when we started Lean.
We wanted to focus on nonlinear arithmetic and support dReal.
The zpz module was going to be used to implement polynomial
factorization procedures similar to the ones in Z3 and computer algebra
systems.

This is not a goal for the Lean project anymore.
2018-04-12 16:43:10 -07:00
Leonardo de Moura
ee3589d99c chore(util/numerics): remove float/double
These two abstractions were added when we planned to have an efficient
Simplex module, written in C++, in Lean. We have moved this module to
Z3. So, we don't need these abstractions anymore.
2018-04-12 16:43:10 -07:00
Leonardo de Moura
e938a75361 chore(util/numerics): remove binary rationals
Binary rationals were added when we started the Lean project.
We wanted to use them to implement an algebraic number module similar to the
one we implemented in Z3.
If one day we implement algebraic numbers in Lean, we will do it in Lean
instead of C++.
2018-04-12 16:43:10 -07:00
Nuno Lopes
9152aaa7d6 fix(bit_tricks): make sure no one calls math.h's log2()
this fixes the bit_trick test with MSVC
2018-03-06 11:21:28 -08:00
Nuno Lopes
7b45d28e77 chore(unicode): use utf8 chars directly in strings 2018-02-13 10:42:08 -08:00
Nuno Lopes
977e11f9be fix(warnings): fix warnings on VS. its now /W2 clean 2018-02-13 10:42:08 -08:00
Nuno Lopes
a8594c5bd0 fix(msvc): fix linking of .exe 2018-02-06 10:11:10 -08:00
Leonardo de Moura
cee73e8309 chore(util/lp): remove lp module
It has been moved to Z3.
2018-01-23 12:18:30 -08:00
Nuno Lopes
0d820fa23d fix(build): fix Cygwin build 2018-01-22 18:07:04 -08:00
Leonardo de Moura
6af3084f9a feat(util/numerics/mpz): add mpz(uint64) constructor 2017-06-02 16:36:40 -07:00
Corey Richardson
52f84c139b chore(lp): don't use readdir_r on glibc
glibc (unfortunately) deprecated readdir_r, as their readdir is already
reentrant. Future versions of POSIX will assume readdir is reentrant,
see https://www.gnu.org/software/libc/manual/html_node/Reading_002fClosing-Directory.html
2017-03-22 08:24:55 -07:00
Leonardo de Moura
7eef501ae1 chore(*): remove mpfr dependency
closes #1380
2017-02-17 20:36:53 -08:00
Sebastian Ullrich
9d8c84713c refactor(*): reduce exception context info from expr to pos_info 2017-02-17 13:45:57 +01:00
Gabriel Ebner
61804eb8e9 chore(util/sexpr): remove mpz and mpq cases 2017-01-31 09:39:31 +01:00
Gabriel Ebner
2867163db0 fix(tests): initialize util module 2016-12-08 13:11:53 -08:00
Leonardo de Moura
f9a0029a47 chore(tests/util/thread): enable test on OSX 2016-12-05 09:24:17 -08:00
Leonardo de Moura
79d87138f0 feat(util/memory): simplify memory tracking code 2016-12-01 16:07:46 -08:00
Gabriel Ebner
d8ee8d6ea7 fix(tests/util/exception): adapt to changed superclass of interrupted 2016-11-29 11:12:44 -08:00
Leonardo de Moura
7da0acc3fd chore(src/tests/util): fix gcc 6.2 warnings 2016-11-07 14:38:33 -08:00
Gabriel Ebner
888609013f feat(tests): run tests in emscripten build 2016-10-16 14:41:35 -07:00
Leonardo de Moura
e9ef7d1342 chore(util/parray): remove dead code 2016-10-03 19:09:57 -07:00
Leonardo de Moura
da27454c8c chore(util): remove dead code 2016-09-23 14:29:13 -07:00
Leonardo de Moura
803c956d18 feat(util/sexpr/option_declarations): allow options to be registered after initialization 2016-08-19 16:58:30 -07:00
Leonardo de Moura
83f64ef8b3 chore(util): remove dead code 2016-06-02 18:38:07 -07:00
Lev Nachmanson
c2d795e46a dev(lp): integrate with z3
Signed-off-by: Lev Nachmanson <levnach@microsoft.com>
2016-06-02 11:51:07 -07:00
Leonardo de Moura
53811822d4 chore(*): style 2016-05-25 18:10:15 -07:00
Leonardo de Moura
7641b602ca chore(util): fun_array ==> parray 2016-05-10 16:05:41 -07:00
Leonardo de Moura
6cb8e82fef feat(util/fun_array): add functional array 2016-05-09 17:40:26 -07:00
Leonardo de Moura
c8e5907b70 feat(util/rb_tree,util/rb_map): add back_find_if 2016-03-05 13:29:34 -08:00
Leonardo de Moura
82fb38b440 feat(util/rb_tree): add for_each_greater 2016-03-01 15:42:27 -08:00
Lev Nachmanson
23079a75a7 dev(lp): fix build for clang, avoid clang-3.3 bug, cleanup permutation_matrix
Signed-off-by: Lev Nachmanson <levnach@microsoft.com>
2016-02-26 16:07:16 -08:00
Leonardo de Moura
c9e9fee76a refactor(*): remove name_generator and use simpler mk_fresh_name 2016-02-11 18:05:57 -08:00
Leonardo de Moura
f67181baf3 chore(*): remove support for Lua 2016-02-11 17:17:55 -08:00
Leonardo de Moura
6c1c6cbbdd fix(util/lp,tests/util/lp): warning msgs on OSX 2016-02-05 11:51:20 -08:00
Leonardo de Moura
e785827688 fix(tests/util/lp/CMakeFiles): disable lp test that fails when executing ctest
This test need input parameters.
2016-02-05 10:17:48 -08:00
Lev Nachmanson
a7e3befd21 dev(lp): speed up primal with sorted list
Signed-off-by: Lev Nachmanson <levnach@microsoft.com>
2016-02-05 10:04:36 -08:00
Lev Nachmanson
fbe4f56aea chore(lp): remove warnings
Signed-off-by: Lev Nachmanson <levnach@microsoft.com>
2016-02-05 10:04:35 -08:00
Leonardo de Moura
739f9e5486 fix(tests/util/lp/lp): use regular C arrays 2016-02-05 10:04:35 -08:00