Computable FinEnum constructions for Bool, Sym, Equiv.Perm, and embeddings #
FinEnum α packages a finite type with a canonical computable enumeration (an exhaustive
duplicate-free list, hence DecidableEq and Fintype). Mathlib provides FinEnum for the
basic shape-formers (Fin, products, sums, Finset, subtypes, pi types, …) but not for Bool
nor for the combinatorial type-formers Sym, Equiv.Perm, and function embeddings — even though
each has a Fintype instance and an underlying list enumerator. This file fills those gaps.
FinEnum Boolis a small base instance.Sym.finEnum,Equiv.Perm.finEnum, andFunction.Embedding.finEnumare provided as plaindefs (not instances) on purpose: a globalFinEnuminstance for any of these would, through thepriority 100FinEnum → Fintypeinstance, synthesize a secondFintypecompeting withMathlib's native one and not definitionally equal to it. Callers that want the enumeration introduce it locally withletIso no competingFintypeever enters global resolution.
Each construction reuses an existing computable enumerator: List.sym for Sym, permsOfList
for Equiv.Perm, and the equivalence with the injective-function subtype for embeddings (the
latter is genuinely computable, unlike Mathlib's noncomputable Function.Embedding.fintype).
List.mem_sym supplies the completeness half that Mathlib is missing for List.sym.
Bool enumerated as [true, false].
Computable enumeration of permutations of a FinEnum type via permsOfList applied to the
canonical enumeration. Completeness holds because every element a permutation can move lies in
FinEnum.toList.
Instances For
Computable enumeration of embeddings β ↪ α between FinEnum types, transported from the
FinEnum on the subtype of injective functions {f : β → α // Function.Injective f}. Injectivity
is decidable for functions out of a finite domain, so this subtype is itself FinEnum.