We can now elaborate
https://gist.github.com/gebner/439273deee592603190d4f8b4447295b
in 1.6 secs and using less than 500Kb of stack space.
It was takins 44 secs and 5Mb before this commit.
Two modifications:
1) Use pre_monad.seq instead of pre_monad.and_then.
They have the same implementation, but seq is not marked as [inline].
2) Modify how we concatenate the tactics in a begin...end block.
Before: (((a_1 ++ a_2) ++ a_3) ++ a_4)
After: ((a_1 ++ a_2) ++ (a_3 ++ a_4))
(Type u) is the old (Type (u+1))
(PType u) is the old (Type u)
Type* is the old (Type (_+1))
PType* is the old Type*
The stdlib can be compiled, but we still have > 70 broken tests
See discussion at #1341
It produces non-termination because it triggers sub-problems of the
form (has_monad_lift_t t ?M), and this kind of sub-problem is bad
for the transitive closure rule:
instance has_monad_lift_t_trans (m n o) [has_monad_lift n o] [has_monad_lift_t m n] : has_monad_lift_t m o
The trick above only behaves well for synthesis subproblems that do not
contain sub-variables.
Note that the sub-problem (has_monad_lift_t t ?M) is created by a
similar rule used at has_coe_t.
instance {a : Type u₁} {b : Type u₂} {c : Type u₃} [has_coe a b] [has_coe_t b c] : has_coe_t a c
AND
instance {m n} [has_monad_lift_t m n] {α} : has_coe (m α) (n α) :=
We workaround the issue by disabling
instance {m n} [has_monad_lift_t m n] {α} : has_coe (m α) (n α)
and adding instances of it. Example:
meta instance (α : Type) : has_coe (tactic α) (solver α) := ...
meta instance (α : Type) : has_coe (tactic α) (prover α) := ...
meta instance (α : Type) : has_coe (tactic α) (smt_tactic α) := ...
We also removed the notation (♯tac) since it is not needed anymore.
@gebner, the comment at elaborator.cpp explains why you had to use the ♯
notation. The workaround is a little bit hackish, but I think it is
worth it. We will use monad lifts in many different places.