Description
Inversion (in Prawitz' sense) of inductive definitions is a special case of pattern-matching, corresponding to there being a unique combination of premises for an inference rule which guarantee the form of the conclusion, namely those given by the premises of the rule itself. Cf. irrefutable with
... which corresponds to a given instance of an inductive family having a 'constructor' which gives rise to the instance. A further special case occurs when we have a data
type with only a single constructor, which somehow captures that scenario for all such instances, uniformly.
In the library, there are many examples of such phenomena, but all with ad hoc names, eg:
- in
Induction.WellFounded
, we haveacc-inverse
as the inverse of the single constructoracc
(sic); - in
Data.Rational{.Unnormalised}.Properties
we havedrop-...
as the corresponding inversion principles for the various equality/ordering relations, to strip off the unique associated constructor, in order to expose the underlying (typicallyInteger
-based) relation instance; - in
Data.Nat.Base
, we have, since Refactoring (inversion) properties of_<_
onNat
, plus consequences #2000 , the inversionss≤s⁻¹
ands<s⁻¹
for the (obvious) instances of the associated type families_≤_
and_<_
; - in
Relation.Nullary.Reflects
, we haveinvert
as the inverse ofof
, where the implicitBool
ean argument ensures that we have 'unique' inversion;
and there are probably several/many more to be unearthed.
PROPOSAL: that we agree on a consistent naming scheme for such things, add it to the style guide, and refactor/deprecate existing definitions in order to exploit it. Naturally, I would argue for ⁻¹
as the 'minimal-ink' uniform suffix for such names, thus:
-
acc-inverse
$\mapsto$ acc⁻¹
-
drop-*≤*
$\mapsto$ *≤*⁻¹
etc. -
invert
$\mapsto$ of⁻¹
(this is already part of Enhancement toRelation.Nullary.Reflects
etc. #2149 , but I would also recommend choosing a better root name thanof
here)
etc.
And to do so as soon as practicable, so that further incoherent/non-uniform choices do not get added elsewhere.