Commit graph

2348 commits

Author SHA1 Message Date
Leonardo de Moura
ea3adf4a7c feat(library/init/meta/tactic): universe polymorphic tactics 2016-10-25 03:42:55 +08:00
Leonardo de Moura
e358a15dd4 fix(frontends/lean/elaborator): show-goal-at-pos after last tactic
See issue #1169
2016-10-25 02:40:24 +08:00
Gabriel Ebner
5f803c0353 feat(frontends/lean/elaborator): make show-goal-at-pos work on
by-tactics
2016-10-21 15:42:29 -07:00
Gabriel Ebner
47e6fd091f refactor(frontends/lean): implement show goal function using exceptions 2016-10-21 15:42:29 -07:00
Joe Hendrix
8ceada5555 feat(frontends/lean): support binary, octal and hex literals
Scanner will interpret numeric literals prefixed with '0b', '0o', and
'0x' as binary, octal, and hex decimal values respectively.  The prefix
character ('b', 'o', 'x') may be upper or lower case.
2016-10-19 10:13:24 -07:00
Leonardo de Moura
1185799b1f feat(frontends/lean/elaborator): more detailed error message for a^.f notation 2016-10-18 16:22:05 -07:00
Sebastian Ullrich
7f4cbdf402 fix(frontends/lean/parser): create snapshot even after prelude-only import 2016-10-16 22:13:44 -07:00
Leonardo de Moura
9b84db083d fix(frontends/lean): error localization bugs 2016-10-15 13:40:57 -07:00
Leonardo de Moura
c3861c7ab3 fix(frontends/lean/elaborator): bug when creating error message 2016-10-15 13:30:26 -07:00
Leonardo de Moura
a5029ab5d2 fix(frontends/lean): improve error localization 2016-10-15 10:43:33 -07:00
Leonardo de Moura
0bb155a427 chore(*): remove .clean support
In Lean2, we used to cache elaborated definitions in .clean files. The
main goal was to optimize each flycheck invocation produced by Emacs.

The Lean3 definition package was not updating this cache. Moreover, it
is not necessary because the new compilation server subsumes it.
2016-10-13 19:58:58 -07:00
Gabriel Ebner
a4d8ae2e30 fix(frontends/lean/parser): fix snapshots in prelude files 2016-10-13 18:49:10 -07:00
Gabriel Ebner
b14a0c43ff feat(frontends/lean/parser,library/module): warn if imported modules are out-of-date 2016-10-13 18:49:10 -07:00
Gabriel Ebner
f969ed5d39 fix(frontends/lean/parser): copy options from snapshot 2016-10-13 18:49:10 -07:00
Gabriel Ebner
73b685db2e fix(frontends/lean/parser): copy environment from snapshot 2016-10-13 18:49:10 -07:00
Gabriel Ebner
ed6aace6ff feat(frontends/lean/parser): save messages in snapshots 2016-10-13 18:49:10 -07:00
Gabriel Ebner
60afce092a fix(library/trace): prevent memory corruption with scope_traces_as_messages 2016-10-13 18:49:10 -07:00
Gabriel Ebner
a9bff2a7f0 fix(frontends/lean/definition_cmds): report timing messages 2016-10-13 18:49:10 -07:00
Gabriel Ebner
8c188c59c5 feat(frontends/lean): remember column for snapshots 2016-10-13 18:49:10 -07:00
Gabriel Ebner
66be9c31db refactor(library/flycheck): use flycheck_message_stream instead of option 2016-10-13 18:49:10 -07:00
Gabriel Ebner
5acb722d46 refactor(library/flycheck,library/trace): convert trace output to messages independently of flycheck 2016-10-13 18:49:10 -07:00
Gabriel Ebner
b05b514cc2 refactor(*): structured message objects 2016-10-13 18:49:10 -07:00
Daniel Selsam
8d94dfd8e8 fix(inductive_cmd): intro rule names must be atomic identifiers 2016-10-13 10:12:08 -07: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
50aca35ce3 fix(frontends/lean/definition_cmds): do not generate code for examples 2016-10-09 19:27:07 -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
e8497f3b7e fix(frontends/lean/definition_cmds): typo 2016-10-09 11:42:30 -07:00
Gabriel Ebner
37b998ff1e feat(frontends/lean,library/flycheck): redirect all diagnostic output from commands to flycheck 2016-10-08 22:23:53 -07:00
Daniel Selsam
7cdec2c8f3 chore(frontents/lean/definition_cmds): improve error message 2016-10-08 22:22:23 -07:00
Daniel Selsam
1644e52c47 fix(frontends/lean/decl_cmds): allow noncomputable meta 2016-10-08 22:21:56 -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
cc3150ea79 fix(frontends/lean/definition_cmds): make sure theorem/lemma type does not contain metavariables before we try to elaborate its proof 2016-10-07 11:10:01 -07:00
Leonardo de Moura
3fbdb71f3e feat(library/tactic/simplifier): remove simp_extensions 2016-10-06 20:50:23 -07:00
Leonardo de Moura
d747fcb17c refactor(library/tactic/simp_lemmas): new caching mechanism 2016-10-06 20:20:01 -07:00
Leonardo de Moura
1e93c2c235 refactor(library/rfl_lemmas): simplify 2016-10-06 16:49:20 -07:00
Leonardo de Moura
e473d7cefc feat(frontends/lean/definition_cmds): make sure copied lemma is a rfl lemma if source is a rfl lemma
The idea is to allow the defeq simplifier to use the copied lemma.
2016-10-06 15:49:38 -07:00
Leonardo de Moura
c745519e50 feat(frontends/lean/definition_cmds): generate equation lemmas for top-level definitions 2016-10-06 15:30:43 -07:00
Gabriel Ebner
996b4375a9 feat(library/flycheck,frontends/lean/elaborator): show trace messages in flycheck 2016-10-05 15:20:00 -07:00
Daniel Selsam
3d2ff8a76d chore(frontends/lean/inductive_cmd): readable name for ind result level placeholder 2016-10-05 15:10:21 -07:00
Leonardo de Moura
73ed9db161 chore(frontends/lean/token_table): remove old keyword 2016-10-05 08:46:23 -07:00
Leonardo de Moura
d252f4ac7d feat(frontends/lean/elaborator): improve mini-lenses 2016-10-03 20:17:45 -07:00
Leonardo de Moura
16985d0de1 feat(frontends/lean/elaborator): better error message for eval_expr 2016-10-03 18:23:47 -07:00
Leonardo de Moura
7465529445 feat(library/tactic): 'eval_expr' tactic skeleton 2016-10-03 16:26:28 -07:00
Leonardo de Moura
1baa953b48 feat(frontends/lean/elaborator): improve error localization 2016-10-02 13:33:49 -07:00
Leonardo de Moura
838b3329ce fix(frontends/lean/elaborator): structure instance update with type classes 2016-10-02 11:36:22 -07:00
Leonardo de Moura
f21f1219d9 fix(frontends/lean/structure_cmd): handle is_one_placeholder 2016-10-02 08:07:19 -07:00
Leonardo de Moura
4f69fe943a fix(frontends/lean/structure_cmd): make sure structure_cmd takes the option default_priority into account 2016-10-01 13:47:19 -07:00
Leonardo de Moura
95ffdca3f7 feat(frontends/lean/decl_attributes): add 'default_priority' attribute 2016-10-01 13:27:08 -07:00
Leonardo de Moura
837915f06b fix(frontends/lean/builtin_exprs): bug when parsing in quoted names 2016-10-01 13:19:24 -07:00