Commit graph

10263 commits

Author SHA1 Message Date
Sebastian Ullrich
71e01d2f89 fix(emacs): actually initialize lean-company 2016-10-14 17:52:21 -04:00
Leonardo de Moura
541e9010e1 fix(shell/lean): disable initialize/finalize server when -DSERVER=OFF is used 2016-10-14 12:56:50 -07:00
Leonardo de Moura
39dba8f5e5 chore(shell/server): make sure "make style" works 2016-10-14 11:58:10 -07:00
Sebastian Ullrich
8f71f4c82d fix(emacs): void-function in lean-debug-mode 2016-10-14 11:53:00 -07:00
Sebastian Ullrich
7e570d7777 feat(shell/server, emacs): bring back basic completion 2016-10-14 11:53:00 -07:00
Leonardo de Moura
2a5616d2b9 fix(shell/json): typos 2016-10-14 11:51:00 -07:00
Leonardo de Moura
936eb76466 feat(CMakeFiles): add -DSERVER=OFF cmake option
Motivation: we can disable lean-server and the json dependency when compiling lean.js.
2016-10-14 11:48:02 -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
Leonardo de Moura
b9e62a982f chore(shell/server): fix 'make style' 2016-10-13 19:35:50 -07:00
Leonardo de Moura
0ee1eed751 chore(library/type_context): comment assertion violated by the pretty printer 2016-10-13 19:34:58 -07:00
Leonardo de Moura
3162bac4e7 feat(shell/lean): disable assertion violation dialog in server mode 2016-10-13 18:56:10 -07:00
Gabriel Ebner
b24291fc99 fix(shell/server): remove static integer underflow 2016-10-13 18:49:10 -07:00
Gabriel Ebner
a4d8ae2e30 fix(frontends/lean/parser): fix snapshots in prelude files 2016-10-13 18:49:10 -07:00
Sebastian Ullrich
42af889159 refactor(emacs): parse response as plist 2016-10-13 18:49:10 -07:00
Gabriel Ebner
ba74530cc0 chore(*): remove legacy flycheck support 2016-10-13 18:49:10 -07:00
Gabriel Ebner
6da53bf87e fix(shell/emscripten): reenable flycheck output 2016-10-13 18:49:10 -07:00
Gabriel Ebner
a8b284e6d7 feat(emacs/lean-server): rerun flycheck on server restart 2016-10-13 18:49:10 -07:00
Gabriel Ebner
7e3285bf06 feat(emacs/lean-server): do not restart server on dependency change 2016-10-13 18:49:10 -07:00
Gabriel Ebner
559b96ab3e feat(shell/server): parse file again if imports have changed 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
Sebastian Ullrich
3eb007166d fix(emacs/lean-server): use lean-get-executable 2016-10-13 18:49:10 -07:00
Gabriel Ebner
fd467584bd feat(emacs/lean-server): show linja output in compilation mode 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
5c76489921 fix(emacs/lean-server): support files with >4096 bytes 2016-10-13 18:49:10 -07:00
Gabriel Ebner
98c3436f93 feat(emacs): add lean-run-linja command 2016-10-13 18:49:10 -07:00
Gabriel Ebner
2d7c3bbd20 chore(emacs/lean-server): add more documentation 2016-10-13 18:49:10 -07:00
Gabriel Ebner
46eefdac89 feat(emacs/lean-server): support files in projects 2016-10-13 18:49:10 -07:00
Gabriel Ebner
4d4e6f3415 feat(emacs): use lean server for incremental compilation 2016-10-13 18:49:10 -07:00
Gabriel Ebner
9c520e3096 feat(shell/server): use parser snapshots 2016-10-13 18:49:10 -07:00
Gabriel Ebner
d78a2171ec feat(shell/server): first version of the compile server API 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
9e518efe46 fix(util/debug): put lean_unreachable into a block 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
bd09d8febe feat(shell/json): json-formatted error messages 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
Leonardo de Moura
bf7bae6eaf feat(library/init/meta/tactic): add beta/zeta tactics 2016-10-13 18:47:27 -07:00
Daniel Selsam
b4644acba4 fix(meta/mk_dec_eq_instance): handle indices and ginductives 2016-10-13 10:12:37 -07:00
Daniel Selsam
ae730532c8 fix(inductive_compiler): preserve invariant that all basic ir names are <ind_name>.<atomic> 2016-10-13 10:12:08 -07:00
Daniel Selsam
8d94dfd8e8 fix(inductive_cmd): intro rule names must be atomic identifiers 2016-10-13 10:12:08 -07:00
Daniel Selsam
047556528d refactor(inductive_compiler): keep simulated inductive types semireducible 2016-10-13 10:12:08 -07:00
Leonardo de Moura
881aa6d023 perf(library/type_context): small optimization
It makes a big difference in examples such as:

example (p : nat → Prop) (a : nat) (h : false) : p (a + 5000) :=
begin
  unfold add has_add.add nat.add bit0 bit1 one has_one.one,
  contradiction
end
2016-10-12 21:39:10 -07:00
Leonardo de Moura
45997a0ca8 chore(library/init/meta/simp_tactic): update documentation 2016-10-12 17:34:57 -07:00
Leonardo de Moura
ef23c591fc feat(library/init/meta): implement unfold tactics in Lean using new building blocks 2016-10-12 17:25:56 -07:00
Leonardo de Moura
9320016b97 refactor(library/tactic): merge simp_lemmas and simp_lemmas_tactics 2016-10-12 14:49:54 -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