Commit graph

90 commits

Author SHA1 Message Date
Leonardo de Moura
97dd2f34d5 feat(library,frontends/lean): add basic doc string support 2016-11-25 18:52:56 -08:00
Leonardo de Moura
680bab8bb8 feat(library/comp_val): add mk_fin_val_ne_proof and mk_char_val_ne_proof 2016-11-23 10:25:04 -08:00
Leonardo de Moura
924b4d3bdc refactor(library, library/tactic): move simp_lemmas and eqn_lemmas to tactic folder
They were at src/library because we hoped we would be able to use them
in the type_context unifier. However, the plan did not work for several
reasons. We saved the partial implementation in the branch: https://github.com/leodemoura/lean/tree/type_context_with_refl_lemmas

Here are the problems:

1) We have to be able to rewrite even when the type context is already in tmp-mode.
   This is an issue because the tmp metavariables in the refl lemma clash with the ones created in the type context.

  Solution: implemented lift operation for idx metavariables, and custom
  match. This solution is not perfect since the lifting is extra overhead.

2) The term being "unfolded" may be stuck. Example:

      nat.add n (@one nat ?m)

  will not match the pattern

      nat.add ?x_0 (nat.succ ?x_1)

  because ?m is not assigned yet.
  We can assign it during the matching process because it is a regular metavariable and the matching is performed in
  tmp_mode.

  Possible workaround a) try to instanciate type class instances before we try the refl lemmas.
  This is a potential performance problem because the term can be arbitrarily big.
  The current heuristics we use to speed up the process do not work for the example above.

  Possible workaround b) allow regular metavariables be assigned by type class resolution even
  when we are in tmp-mode.

  We have not tried to implement any of these workarounds.

3) There are many more lazy-delta steps. Before this feature, when we unfold `nat.add a (succ ... (succ b) ...)`,
   we are done with delta-reduction. It is just iota and beta after that.
   However, with refl-lemmas, the term `nat.add a (succ ... (succ b) ...)` produces one lazy-delta step per succ.
   This produces nasty side-effects because of the
   The heuristic (f t =?= f s) ==> (t =?= s).

   Examples such as
       (fib 8) =?= 34
   will take a very long time because of this heuristic.

   Possible workaround: cache failures like we did in Lean2.
   However, failure are only easy to cache if there are no meta-variables.

4) The type context trace gets very confusing since we use is_def_eq for matching lhs while we are computing is_def_eq.
   Possible workaround: disable trace when trying refl_lemmas.

5) We must be able to temporarily disable the feature.
   Example: when proving a refl_lemma for a definition `f`, we may have
   to expand the nested definitions
   (e.g., for match-end blocks)

6) refl/simp lemmas were designed to rewrite elaborated terms.
   Using them during unification may produce a series of unexpected
   behaviors since terms usually contain many regular and universe meta-variables.

7) We need to define a notion of "refl stuck application".
   Right now, a metavar is stuck, a projection is stuck if the structure
   is stuck, a recursor is stuck is the major premise is stuck.
   An application (f ...) is refl-lemma stuck if f has refl-lemmas
   associated with it, AND metavariables occurring in arguments are
   preventing a refl-lemma from being applied.
2016-10-12 14:36:00 -07:00
Leonardo de Moura
ebd912d243 feat(library/eqn_lemmas): add map function name => equational lemmas 2016-10-09 11:48:55 -07:00
Leonardo de Moura
476684a284 refactor(library,library/tactic/defeq_simplifier): use simp_lemmas in the defeq_simplifier 2016-10-08 22:15:27 -07:00
Leonardo de Moura
a796bda14e refactor(library/tactic): use new simp_lemmas module in the simplifier 2016-10-08 21:54:34 -07:00
Leonardo de Moura
465f898882 chore(library): remove lean2 old type checker 2016-09-19 22:21:19 -07:00
Leonardo de Moura
668be38bb2 chore(library): remove old_type_context 2016-09-19 21:34:27 -07:00
Leonardo de Moura
a1d36b6c4d chore(library): remove legacy_type_context 2016-09-19 21:31:21 -07:00
Leonardo de Moura
bbd10b99f7 chore(library): remove old type class resolution procedure 2016-09-19 21:22:02 -07:00
Leonardo de Moura
d2b400ac2c chore(library): remove old unifier 2016-09-19 17:18:47 -07:00
Daniel Selsam
52f87760d8 feat(src/library/inductive_compiler): support for nested inductive types 2016-09-16 12:50:59 -07:00
Leonardo de Moura
d43764b6fb refactor(library/tactic/defeq_simplifier): move defeq_simp_lemmas to library
This commit also renames them to "rfl_lemmas".
Reason: these lemmas will be used at type_context::is_def_eq and type_context::whnf
2016-09-12 10:36:11 -07:00
Daniel Selsam
b0c5744eea feat(inductive_compiler): support for mutually inductive types 2016-09-10 14:22:27 -07:00
Leonardo de Moura
1afd81384f chore(library/let): delete let-macro hack 2016-09-10 13:06:07 -07:00
Leonardo de Moura
9c8e9e07ae refactor(library): injectivity ==> inverse 2016-09-07 08:16:14 -07:00
Leonardo de Moura
f954ddbdbf feat(library/injectivity): add injectivity attribute 2016-09-06 18:01:09 -07:00
Leonardo de Moura
2a912c2650 feat(frontends/lean, library): move constructor attribute to frontend
Now, it only affects the elaborator.
2016-09-05 09:34:45 -07:00
Leonardo de Moura
a74f02546b refactor(*): remove abbreviation command 2016-09-03 17:11:29 -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
Leonardo de Moura
5ffa481634 chore(library): remove dead code 2016-08-17 10:45:54 -07:00
Daniel Selsam
53190c38ca feat(library/inductive): scaffold for inductive type manager 2016-08-11 13:48:54 -07: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
a64d1a77ea refactor(library, frontends/lean): remove old coercion management module 2016-07-29 13:51:26 -07:00
Daniel Selsam
e7cee1b2cd feat(src/library/mpq_macro): numeral macros 2016-07-29 10:44:43 -07:00
Leonardo de Moura
5b0100ef0b refactor(library/lazy_abstraction): lazy ==> delayed 2016-07-27 13:53:17 -07:00
Leonardo de Moura
579f643d1d refactor(library): move kabstract to tactic folder 2016-07-18 09:57:02 -04:00
Leonardo de Moura
0213f1970f feat(library): add kabstract 2016-07-16 15:41:31 -04:00
Daniel Selsam
9327d85f6c chore(library/defeq_simplifier): move to new module inside library/tactic 2016-06-22 17:18:57 -07:00
Leonardo de Moura
16c050b66c reactor(library): port fun_info_manager to new type_context (and rename module to fun_info) 2016-06-21 10:42:38 -07:00
Leonardo de Moura
586baa4118 feat(library,frontends/lean): support for quoted expressions in the VM, compiler and frontend
TODO: invoke elaborator at tactic.to_expr
2016-06-15 16:06:39 -07:00
Leonardo de Moura
9fad884dd8 feat(library/tactic): add tactic.mk_app for using app_builder 2016-06-14 17:13:10 -07:00
Leonardo de Moura
a16e3343a0 chore(library,frontends/lean): disable modules that need to be refactored 2016-06-14 10:02:11 -07:00
Leonardo de Moura
b0b008d0bd feat(library): add lazy_abstraction macro 2016-06-10 18:29:40 -07:00
Leonardo de Moura
224203f215 feat(library,frontends/lean/builtin_cmds): store export cmds and replay them
see #603
closes #723
2016-06-03 12:51:12 -07:00
Leonardo de Moura
6a9e5079c9 feat(library,frontends/lean/pp): add support for new string encoding 2016-05-24 16:20:43 -07:00
Leonardo de Moura
399b83122c refactor(library): move vm to a separate directory 2016-05-12 14:45:06 -07:00
Leonardo de Moura
3dd7cd7403 feat(library/vm): implement nat functions in C++ 2016-05-10 17:35:53 -07:00
Leonardo de Moura
7cca77c97c dev(library/type_context): improve is_productive, add better tracing 2016-03-25 15:38:04 -07:00
Leonardo de Moura
f72d06c31e refactor(library): remove resolve_macro 2016-03-21 18:04:43 -07:00
Leonardo de Moura
384e8bf7bf refactor(library): remove unifier_plugin 2016-03-21 17:57:53 -07:00
Leonardo de Moura
9cf995fae8 refactor(library/util): move more procedures from old_util to util 2016-03-21 14:25:40 -07:00
Leonardo de Moura
8dde1489f9 refactor(library/util): isolate util procedures that depend on old_type_checker 2016-03-21 13:36:08 -07: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
4543dc4a7f feat(library): add metavar_context 2016-03-05 12:53:45 -08:00
Leonardo de Moura
05f58547c5 chore(library/type_context): rename type_context to old_type_context
We are going to implement a new type_context object.
2016-03-04 10:51:04 -08:00
Leonardo de Moura
eaac6ba721 chore(library/type_context): rename default_type_context to legacy_type_context and move it to different file 2016-03-04 10:26:50 -08:00
Daniel Selsam
d521063dfb feat(library/defeq_simplifier): new simplifier that uses only definitional equalities 2016-02-22 11:01:36 -08:00
Daniel Selsam
bb4b8da582 feat(library/unification_hint): basic handling of user-supplied unification hints 2016-02-12 11:48:51 -08:00
Leonardo de Moura
f67181baf3 chore(*): remove support for Lua 2016-02-11 17:17:55 -08:00