Instance search keeps reproving the same goals, which take time because of the way we currently compose structures, so we have to repeatedly reconstruct them.
Solution: specialize structures more, e.g., don't declare ktree notation for Kleisli itree, but make it a definition of its own. Derive the various instances with some copy-paste boilerplate.
A more long-term solution would be to implement caching in type class search. Our constraints are Haskell-like, so they're not too wild (we shouldn't have to worry about existential variables). Universe polymorphism might become a problem though. In any case, it's a lot of work.
The proof of Imp2AsmCorrectness.seq_asm_correct provides a small (enough for debugging) but still noticeably slow rewrite (0.2s) (there are probably many others earlier...).
In particular, looking at rewrite app_asm_correct line 455.
|
rewrite loop_asm_correct, relabel_asm_correct, app_asm_correct. |
The goal looks like this:
loop (subpure swap >>> denote_asm (app_asm ab bc) >>> subpure (id_ (B + C)))
⩯ denote_asm ab >>> denote_asm bc
And we're rewriting using
app_asm_correct : denote_asm (app_asm ab cd) ⩯ bimap (denote_asm ab) (denote_asm cd)
That spawns the ridiculous tree search summarized below, but basically, the same goals keep on reappearing.
-
Proper-ness of the context subpure swap >>> _, which is solved by properness of cat (>>>)...
-
This also requires reflexivity of equivalence of arrows eq2 (to ensure here that subpure swap is "proper")
eq2 is an Equivalence (...)
-
Properness of cat solved by category_proper_cat, requiring
-
sub (ktree E) is a Category, requiring
-
ktree E is a Category, requiring
itree E is a lawful monad (MonadLaws, EqMProps)
-
Proper-ness of the context _ >>> subpure (id_ (B + C))), which basically spawns the same search (...)
-
Proper-ness of loop, requiring
-
eq2 is an Equivalence (...)
-
sub (ktree E) is a Category (...)
-
sub (ktree E) is an Iterative category, which in turn requires
-
eq2 is an Equivalence (fourth time!) (...)
-
ktree E is a Category (fourth time!) (...)
-
ktree E has a Coproduct, requiring again that itree E is a monad, for at least the fifth time (others hidden in Category constraints)
(Related to #83)
Instance search keeps reproving the same goals, which take time because of the way we currently compose structures, so we have to repeatedly reconstruct them.
Solution: specialize structures more, e.g., don't declare
ktreenotation forKleisli itree, but make it a definition of its own. Derive the various instances with some copy-paste boilerplate.A more long-term solution would be to implement caching in type class search. Our constraints are Haskell-like, so they're not too wild (we shouldn't have to worry about existential variables). Universe polymorphism might become a problem though. In any case, it's a lot of work.
The proof of
Imp2AsmCorrectness.seq_asm_correctprovides a small (enough for debugging) but still noticeably slow rewrite (0.2s) (there are probably many others earlier...).In particular, looking at
rewrite app_asm_correctline 455.InteractionTrees/tutorial/Imp2AsmCorrectness.v
Line 455 in f140f0b
The goal looks like this:
And we're rewriting using
That spawns the ridiculous tree search summarized below, but basically, the same goals keep on reappearing.
Proper-ness of the contextsubpure swap >>> _, which is solved by properness ofcat(>>>)...This also requires reflexivity of equivalence of arrows
eq2(to ensure here thatsubpure swapis "proper")eq2is anEquivalence(...)Properness of
catsolved bycategory_proper_cat, requiringsub (ktree E)is aCategory, requiringktree Eis aCategory, requiringitree Eis a lawful monad (MonadLaws,EqMProps)Proper-ness of the context_ >>> subpure (id_ (B + C))), which basically spawns the same search (...)Proper-ness ofloop, requiringeq2is anEquivalence(...)sub (ktree E)is aCategory(...)sub (ktree E)is anIterativecategory, which in turn requireseq2is anEquivalence(fourth time!) (...)ktree Eis aCategory(fourth time!) (...)ktree Ehas aCoproduct, requiring again thatitree Eis a monad, for at least the fifth time (others hidden inCategoryconstraints)(Related to #83)