Lean 4 fork for HoTT-compatible kernel extensions (Path types, transport, HITs). Maintained against upstream leanprover/lean4.
Find a file
Leonardo de Moura 7ebf16ca26 fix(library/equations_compiler): performance issues at structural_rec module and equational lemma generator
There were two performance bottlenecks in the recursive equation
compiler. Both bottlenecks were due to conversion checking.

1- We allow patterns such as (x+1) in the left-hand-side of a
   recursive equation. This is kind of pattern has to be reduced
   since it is not a constructor. Moreover, when we are trying to
   compile using structural recursion, we need to find an element
   that is structurally smaller in recursive applications.
   Again, we need to use reduction since the pattern may be (x+2),
   and in the recursive application we have (x+1). Now, consider
   the following equation

         f (x+1) (y+1) := f complex_term y

   It will first check whether complex_term is structurally smaller
   than (x+1), and the compiler will timeout trying to reduce
   complex_term.

   This commit adds the following workaround. The structural
   recursion module from now on will only unfold reducible constants
   and constants marked as patterns. This is not a complete
   solution. It will timeout in the following equation:

         f (x+1) (y+1) := f (x+1000000000000) y

   For this one, we need to add a whnf "fuel" option to type_context

2- Equational lemma generation was producing lemmas that are too
   expensive to check. Suppose we the following two definitions

       | f x 0     := 1
       | f x (y+1) := f complex_term y

    and

       | g 0     y    := 1
       | g (x+1) y    := g x complex_term

    Before this commit, we would generate the following proofs for
    the second equation of each definition:

         eq.refl (f complex_term y)
         eq.refl (g x complex_term)

    This proof triggers the following definitionally equality test:

             f x     (y+1)  =?= f complex_term y
             g (x+1) y      =?= g x complex_term

    Since, we have f/g on both sides, the type checker will try
    first to unify the arguments, and may timeout trying to solve

               x  =?= complex_term
               y  =?= complex_term

    since it may take a long time to reduce `complex_term`.

    We workaround this problem by creating a slightly different
    proof.

          eq.refl (unfold_of(f x (y+1)))
          eq.refl (unfold_of(g (x+1) y))

    where unfold_of(t) is the result of applying one delta reduction
    step.
2017-02-15 21:31:28 -08:00
bin refactor(gitignore): remove old ignore entries 2016-12-10 08:42:39 -08:00
doc feat(kernel,library,frontends/lean,api): remove global universe levels from kernel and APIs 2017-02-08 17:41:44 -08:00
extras chore(extra/latex/*): update to changes in syntax 2017-01-03 11:22:04 -08:00
images chore(CMakeLists.txt): move Lean logo to make sure we can test leanemacs without installing Lean 2015-01-31 17:38:49 -08:00
library fix(library/equations_compiler): performance issues at structural_rec module and equational lemma generator 2017-02-15 21:31:28 -08:00
old_library refactor(gitignore): remove old ignore entries 2016-12-10 08:42:39 -08:00
script refactor(emacs/load-lean): install emacs dependencies directly from (M)ELPA 2016-12-02 16:50:50 -08:00
src fix(library/equations_compiler): performance issues at structural_rec module and equational lemma generator 2017-02-15 21:31:28 -08:00
tests fix(library/equations_compiler): performance issues at structural_rec module and equational lemma generator 2017-02-15 21:31:28 -08:00
tmp refactor(library/debugger): move debugger to tools 2016-12-17 10:50:13 -08:00
.appveyor.yml chore(CMakeLists): make sure we change the version number in a single place 2017-01-19 18:28:51 -08:00
.appveyor.yml.in chore(CMakeLists): make sure we change the version number in a single place 2017-01-19 18:28:51 -08:00
.codecov.yml feat(.travis.yml): add codecov 2016-12-02 17:01:58 -08:00
.gitignore chore(.gitignore): ignore VSCode config file 2016-12-18 12:35:25 -08:00
.travis.yml chore(.travis.yml): reduce ctest verbosity 2017-02-04 13:49:30 -08:00
.travis.yml.in chore(.travis.yml): reduce ctest verbosity 2017-02-04 13:49:30 -08:00
LICENSE Add LICENSE file 2013-07-15 18:55:48 -07:00
README.md workaround instruction for gperftools on macOS Sierra 2017-01-17 16:37:06 -08:00

logo

LicenseWindowsLinux / macOSTest Coverage
Codecov

Issue Stats

About

Requirements

Installing required packages at

Windows

Linux

OS X

Build Instructions

Miscellaneous