For the purpose of inverting tuples in unification, I would need a way to automatically build projections associated to a singleton inductive type (e.g. out of prod
or sigT
). Such code already exists in record.ml
but associated to named constants (or to primitive projections). What would be the best way to do it:
internal_prod_proj1
constant (equivalent to fst
or proj2_sig
) the first time some internal code needs it (as for dependent rewrite
) and to later referring to it anytime it is needed again?injection
when it needs to invert a constructor)?Any advice?
Don't use schemes. They're already broken enough.
Pierre-Marie Pédrot said:
Don't use schemes. They're already broken enough.
Broken?
Your recommendation is then to expand the code at each use?
Yes.
you could invert only those types which have registered projections
The basic types to invert are prod
and sigT
. So, we would need to first move them to Record
(even if, in a first step, for compatibility reasons, not to primitive records).
But the principle of extracting subterms from patterns can be extended to non-record types. For instance, the x
in S x
can be extracted with a pred
. So, eventually, we need canonical ways to invert the argument of any constructor (like in injection
).
Anyway, for my current purpose (unification), expanding is ok.
Last updated: Sep 15 2024 at 12:01 UTC