The type of objects of the opposite of α; used to defined opposite category/group/...
In order to avoid confusion between α and its opposite type, we
set up the type of objects opposite α using the following pattern,
which will be repeated later for the morphisms.
- Define opposite α := α.
- Define the isomorphisms op : α → opposite α, unop : opposite α → α.
- Make the definition opposite irreducible.
This has the following consequences.
- opposite α and α are distinct types in the elaborator, so you
must use op and unop explicitly to convert between them.
- Both unop (op X) = X and op (unop X) = X are definitional
equalities. Notably, every object of the opposite category is
definitionally of the form op X, which greatly simplifies the
definition of the structure of the opposite category, for example.
(If Lean supported definitional eta equality for records, we could
achieve the same goals using a structure with one field.)