Commit graph

65 commits

Author SHA1 Message Date
Leonardo de Moura
6830291fd5 chore: remove dead code at Class.lean used by old frontend 2020-11-20 16:51:44 -08:00
Sebastian Ullrich
7718795178 fix: mark Lean objects in C++ globals reachable from the new frontend as persistent
sed -Ei 's/(g_\w+)\s*= new (name|expr|format|level|string_ref)\W.*;/\0\n    mark_persistent(\1->raw());/' src/kernel/**/*.cpp src/util/**/*.cpp src/library/**/*.cpp
2020-10-11 17:43:28 +02:00
Leonardo de Moura
b773bb9ceb fix: make sure instances created by class command are stored in the new DiscrTree 2019-12-11 17:16:12 -08:00
Leonardo de Moura
67a37c6917 chore(library/init/lean/class): export as C functions 2019-08-16 19:42:14 -07:00
Leonardo de Moura
4e444a283d feat(library/class): switch to Lean implementation 2019-06-27 13:51:09 -07:00
Leonardo de Moura
8399e41a5b feat(library/class): simpler get_class function
It does not depend on `type_context.h`, and we will used it as a
template to implement the Lean version.
2019-06-27 10:42:14 -07:00
Leonardo de Moura
bd58525080 chore(library/class): simplify 2019-06-26 16:51:36 -07:00
Sebastian Ullrich
280dc4e8d8 fix(library/class): is_anonymous_inst_name: ignore macro scopes 2019-01-20 21:43:35 +01:00
Leonardo de Moura
49b5216604 chore(library): remove fingerprint 2018-09-07 12:54:19 -07:00
Leonardo de Moura
5d00936a8f chore(*): remove some old_type_checker dependencies 2018-09-07 08:48:21 -07:00
Leonardo de Moura
58e91559d0 feat(*): use new inductive datatype module 2018-09-06 18:09:22 -07:00
Leonardo de Moura
3c521960c8 chore(library/class): remove attribute tracking symbols 2018-09-05 18:42:19 -07:00
Leonardo de Moura
82095cc018 refactor(kernel): split declaration into declaration and constant_info
This is just another step towards the design described at commit 16598391a07d4a
2018-08-22 17:53: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
c0e1d05199 chore(kernel): type_checker ==> old_type_checker 2018-06-06 16:10:40 -07:00
Leonardo de Moura
d707a27c2b chore(library/class): unnecessary dependency 2018-05-30 14:05:21 -07:00
Leonardo de Moura
75c63ec921 refactor(*): list<name> ==> obj_list<name> 2018-05-23 15:48:43 -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
bdea7d420d chore(*): type_context ==> type_context_old 2018-03-05 12:38:24 -08:00
Leonardo de Moura
f0352d31a1 feat(library/type_context, library): inout ==> out modifier in type class declarations
@kha: I decided to implement this change before I start the
type_context modifications. The change did not affect the corelib and
test suite much. The only annoying problem is that `out` cannot be
used to name locals anymore.
2017-12-15 14:46:47 -08:00
Leonardo de Moura
0091cef9f2 feat(library/tactic): start algebraic normalizer 2017-05-15 21:46:19 -07:00
Leonardo de Moura
55fee26b36 feat(library/class): add attribute for tracking symbols occurring in instances of type classes
For more information see:
https://github.com/leanprover/lean/wiki/Refactoring-structures
The new attribute [algebra] implements the [algebraic_class] described
in the page above.
2017-05-01 18:02:30 -07:00
Leonardo de Moura
ba5eccdca8 refactor(library/init/core): rename out_param => inout_param
It is really input/output.
2017-05-01 14:01:41 -07:00
Leonardo de Moura
cabb4350d9 feat(library): instances are not reducible by default anymore
Motivation: see "Other goodies" section at
https://github.com/leanprover/lean/wiki/Refactoring-structures

We had to add a new transparency mode: Instances at type_context.
In this mode, instances and reducible definitions are considered
transparent.

The new mode is used in the defeq_canonizer, code generator,
and sizeof lemma generation at inductive_compiler.

We also use the new mode in the unfold tactics.
2017-04-26 14:10:11 -07:00
Leonardo de Moura
707cf45a26 refactor(library/type_context): rename whnf_pred => whnf_head_pred 2017-02-15 20:20:27 -08:00
Leonardo de Moura
5da8b205b9 feat(library/type_context, frontends/lean/elaborator): type classes with output parameters 2017-01-30 18:32:54 -08:00
Leonardo de Moura
93c8e69313 chore(frontends/lean, library): cleanup anonymous instance management 2017-01-06 14:37:44 -08:00
Leonardo de Moura
7c06306154 chore(library/type_context): reduce redundancy 2016-12-27 17:19:19 -08:00
Gabriel Ebner
a26e2c9108 feat(library/module): intermediary data structure for environment modifications 2016-12-20 10:15:19 -08:00
Leonardo de Moura
43aa6eb87f fix(library/class): bug in whnf_pred predicate 2016-11-05 11:44:05 -07:00
Leonardo de Moura
9631b70295 fix(library/class): attributes instance and class were not being registered in the attribute_manager when procedures add_instance and add_class were being used directly 2016-10-01 13:45:23 -07:00
Leonardo de Moura
89f62edaf0 refactor(library): reduce dependecies on old code, simplify normalize module 2016-09-19 22:12:34 -07:00
Sebastian Ullrich
ca8be3857c feat(library/user_attribute): add user-defined attributes and make attribute_manager environment-aware 2016-08-18 12:56:44 -07:00
Sebastian Ullrich
34e00cd5a2 refactor(library/attribute_manger): simplify: make every attribute prioritizable 2016-08-16 13:49:02 -07:00
Leonardo de Moura
0169989411 chore(library/class): remove transitive instance support
Conflicts:
	src/frontends/lean/structure_cmd.cpp
	src/library/class.cpp
	src/library/class.h
2016-07-29 23:32:10 -07:00
Leonardo de Moura
264c23a24f chore(library/class): disable [trans_instance] attribute
Conflicts:
	src/library/class.cpp
2016-07-29 23:28:36 -07:00
Sebastian Ullrich
31f599e088 refactor(library/attribute_manager): introduce hierarchy of attribute classes 2016-07-29 23:44:22 -04:00
Sebastian Ullrich
c4edad0372 feat(frontends/lean, library): remove attribute and metaclass scoping
All data is now part of either a global, permanent scope or a local,
temporary one
2016-07-29 23:44:21 -04:00
Sebastian Ullrich
661fafc940 refactor(frontends/lean): replace different attribute classes with single scoped_ext 2016-07-29 18:51:23 -04:00
Leonardo de Moura
d8079aa16a refactor(library): create copy of the kernel type_checker in library
Motivation: it will allow us to simplify the kernel type_checker and
make sure it implements the same API provided by type_context
2016-03-18 14:34:10 -07:00
Leonardo de Moura
d7de521126 refactor(library/class): remove attribute [multiple_instances] and old type class resolution procedure 2016-03-03 13:58:22 -08:00
Leonardo de Moura
3c878ecd01 feat(kernel): add let-expressions to the kernel
The frontend is still using the old "let-expression macros".
We will use the new let-expressions to implement the new tactic framework.
2016-02-29 16:40:17 -08:00
Leonardo de Moura
5a4dd3f237 feat(library/reducible): remove [quasireducible] annotation 2016-02-25 17:42:44 -08:00
Leonardo de Moura
146edde5b3 feat(library/class): mark instances as quasireducible by default
quasireducible are also known as lazyreducible.

There is a lot of work to be done.
We still need to revise blast, and add a normalizer for type class
instances. This commit worksaround that by eagerly unfolding
quasireducible.
2016-02-25 12:11:29 -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
155df48665 feat(library): remove decl_stats
We are not using (and will not use) this module in the blast proof procedures
2016-01-02 13:00:43 -08:00
Leonardo de Moura
26d0a62052 refactor(*): make sure we use LEAN_DEFAULT_PRIORITY
We recently implemented the attribute manager.
2015-12-28 10:47:56 -08:00
Leonardo de Moura
f177082c3b refactor(*): normalize metaclass names
@avigad and @fpvandoorn, I changed the metaclasses names. They
were not uniform:
- The plural was used in some cases (e.g., [coercions]).
- In other cases a cryptic name was used (e.g., [brs]).

Now, I tried to use the attribute name as the metaclass name whenever
possible. For example, we write

   definition foo [coercion] ...
   definition bla [forward] ...

and

  open [coercion] nat
  open [forward] nat

It is easier to remember and is uniform.
2015-12-28 10:39:15 -08:00
Leonardo de Moura
45dbf76df9 refactor(library): add attribute manager 2015-12-17 20:58:15 -08:00
Leonardo de Moura
3057dde885 fix(library/class,library/coercion): fixes #852 2015-12-10 22:52:02 -08:00