I am trying to use a tree based map in Coq, specifically Coq.FSets.FMapAVL
.
I found this 4 year old question: Finite map example
Looking at the standard lib documentation referenced in the comments, I see this note:
NB: This file is here only for compatibility with earlier version of FSets and FMap. Please use Structures/Orders.v directly now.
What does this mean? When I google "Structures.v" or "Orders.v" I always end up at other documentation pages with related deprecation warnings.
What is the proper, non-deprecated way to use an FMap in Coq 8.6?
Since the
OrderedTypeEx
module is deprecated, we won't useNat_as_OT
defined in it.There is
Nat_as_OT
inOrdersEx
(just a synonym forPeanoNat.Nat
), which is useful for our purposes.Unfortunately, the following code
won't work, because signatures
OrderedType.OrderedType
(currently used byFMapAVL
) andOrders.OrderedType
are not compatible.However, the
OrdersAlt
module contains functors, which allow to build a module of one type from another. In this case, we are interested inBackport_OT
. The following code shows how to useFMapAVL.Make
, the rest of the code can be copied from the linked question:The situation with
FMapAVL
was explained by Pierre Letouzey in this Coq-Club post: