Towards a specification of theory refinements › Preliminary thoughts on specifying shallow refinements [01HW]
To a first approximation, a refinement of a theory with telescope \Phi is given by a prefix \Phi of \Psi together with an instantiation of \Phi . This is a good first step, but it does not correctly handle the (very common) case where we wish to refine only certain fields that are not necessarly forming a contiguous prefix. In the simplest example, we might want to speak of pairs whose second component is fixed.
These cases arise when one field’s type doesn’t depend on all of the prior fields. One approach to dealing with this would be to replace telescopes by directed acyclic graphs in which the edges represent dependency. I think this can be achieved, but I think it might very complicated, keeping in mind that as one field gets refined, the remainder of the DAG would need to reconfigure itself (in other words, substitution can cause dependencies to disappear).
I have been thinking that a better way to deal with this would be instead to allow a refinement to start in the middle of the telescope, and have it be implicitly abstracted over all the previous fields. Skipping a field just abstracts over that field. Then by construction, the refinement is well-typed but we can still handle the mentioned examples. This is kind of what I did in my Lean prototype of Pterodactyl, but it is difficult to understand my code…
One subtlety of this approach is to figure out appropriate syntactic conditions for these refinements to always correspond to a display map. The naïve version outlined above would allow a refinement by the diagonal, which is probably not what we want.