Turn a definition into a projection if it looks like a projection.
Conditions for projection-likeness of f:
The type of f must be of the shape Γ → D Γ → C for D
a name (Def) which is eligibleForProjectionLike:
data record postulate.
The application of f should only get stuck if the principal argument
is inferable (neutral). Thus:
a. f cannot have absurd clauses (which are stuck even if the principal
argument is a constructor).
b. f cannot be abstract as it does not reduce outside abstract blocks
(always stuck).
c. f cannot match on other arguments than the principal argument.
d. f cannot match deeply.
e. fs body may not mention the parameters.
f. A rhs of f cannot be a record expression, since this will be
translated to copatterns by recordExpressionsToCopatterns.
Thus, an application of f waiting for a projection
can be stuck even when the principal argument is a constructor.
g. f cannot be an irrelevant definition (Andreas, 2022-03-07, #5809),
as those are not reduced.
For internal reasons:
f cannot be constructor headed
f cannot be recursive, since we have not implemented a function
which goes through the bodies of the f and the mutually recursive
functions and drops the parameters from all applications of f.
Examples for these reasons: see testSucceedNotProjectionLike.agda