Theory Higher_Order_Terms.Name
chapter ‹Names as a unique datatype›
theory Name
imports Main
begin
text ‹
I would like to model names as @{typ string}s. Unfortunately, there is no default order on lists,
as there could be multiple reasonable implementations: e.g.\ lexicographic and point-wise.
For both choices, users can import the corresponding instantiation.
In Isabelle, only at most one implementation of a given type class for a given type may be present
in the same theory. Consequently, I avoided importing a list ordering from the library, because it
may cause conflicts with users who use another ordering. The general approach for these situations
is to introduce a type copy.
The full flexibility of strings (i.e.\ string manipulations) is only required where fresh names
are being produced. Otherwise, only a linear order on terms is needed. Conveniently, Sternagel and
Thiemann \<^cite>‹sternagel2015deriving› provide tooling to automatically generate such a
lexicographic order.
›