lean4-htt/src
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
..
api feat(frontends/lean): force user to use meta keyword on meta inductive/structure/class 2016-09-29 17:56:35 -07:00
cmake feat(CMakeLists.txt): include cpp14_lang/sized_deallocation.cmake 2016-10-03 22:21:55 -07:00
emacs chore(emacs/lean-input): add custom shorthands for French quote symbols 2016-10-11 14:17:30 -07:00
frontends refactor(library, library/tactic): move simp_lemmas and eqn_lemmas to tactic folder 2016-10-12 14:36:00 -07:00
init refactor(*): delete HoTT support 2016-09-27 16:33:39 -07:00
kernel feat(kernel/inductive): v_idx ==> ih_idx 2016-10-05 17:13:52 -07:00
library refactor(library, library/tactic): move simp_lemmas and eqn_lemmas to tactic folder 2016-10-12 14:36:00 -07:00
shared
shell refactor(*): delete HoTT support 2016-09-27 16:33:39 -07:00
tests chore(util/parray): remove dead code 2016-10-03 19:09:57 -07:00
util fix(tests/util/lp): fix debug build 2016-10-03 22:22:12 -07:00
vim refactor(*): remove abbreviation command 2016-09-03 17:11:29 -07:00
CMakeLists.txt fix(CMakeLists.txt): disable check when compiling with emscripten 2016-10-05 15:05:22 -07:00
compatibility.h.in feat(CMakeLists.txt): use compatibility module to check sized_deallocation feacture 2016-06-02 11:52:59 -07:00
CTestConfig.cmake
CTestCustom.cmake.in
Doxyfile
githash.h.in
memcheck.supp
version.h.in