RedPRL / cooltt

😎TT
http://www.redprl.org/
Apache License 2.0
216 stars 16 forks source link

Abstract hcom mechanism #179

Open cangiuli opened 3 years ago

cangiuli commented 3 years ago

The goal of this proposal, developed with @jonsterling, is to make hcom less unwieldy in practice. Comments are very welcome.

The basic idea is to add a new abstract-hcom A r r' φ p tactic that succeeds exactly when the ordinary hcom tactic does. Instead of inserting an hcom term, it creates and then inserts a fresh global symbol x : [...] → (i : I) → sub A {φ ∨ i=r} {p i _} for the corresponding filler parameterized over the current hypotheses. In other words, it creates a special kind of hole differing from ordinary holes in two ways: (1) the development is not considered incomplete, because this hole can be resolved by an hcom, and (2) we may include a mechanism for replacing x by the corresponding hcom. It differs from the current treatment of hcom by (1) not unfolding, and (2) importantly, making sure that the entire filler is always around even if the user only asks for the composite.

The rationale is the following:

favonia commented 3 years ago

My only question is that it seems we can simulate this with opaque lemmas? That is, it appears that we could define an opaque hcom with all the cubical constraints and then use it whenever we don't want the hcom to compute.

jonsterling commented 3 years ago

I think the one place where we need some special feature it make the coherence with between an abstract hcom and something else. Am I missing something?

cangiuli commented 3 years ago

I think that's right -- it would help future automation if we knew that this particular opaque lemma is hcom. It would also be desirable to allow it to unfold in some circumstances, but maybe that's better deferred to a discussion on controlling unfolding. But I take @favonia's point that we can try out this idea immediately.

cangiuli commented 3 years ago

Actually, there is one really important aspect of this design that I've only just edited into the issue description (sorry about that! lol), and it's that the created symbol should always be the filler even if only the composite is being used. This alleviates the common problem that one defines symm and then realizes that they actually have to define symm/filler if they want to prove a law about symm, etc. /cc @favonia