-
Notifications
You must be signed in to change notification settings - Fork 260
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-inverseas the inverse of the single constructoracc(sic); - in
Data.Rational{.Unnormalised}.Propertieswe 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 haveinvertas the inverse ofof, where the implicitBoolean 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.Reflectsetc. #2149 , but I would also recommend choosing a better root name thanofhere)
etc.
And to do so as soon as practicable, so that further incoherent/non-uniform choices do not get added elsewhere.