Documentation

ToMathlib.Data.FinEnum

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.

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.

theorem List.mem_sym {α : Type u} {n : } {xs : List α} {z : Sym α n} :
(∀ az, a xs)z List.sym n xs

Completeness of List.sym: every z : Sym α n whose members all lie in xs is enumerated by xs.sym n. This is the converse of List.mem_of_mem_of_mem_sym.

@[implicit_reducible]

Bool enumerated as [true, false].

@[reducible]
def Sym.finEnum {α : Type u} [FinEnum α] (n : ) :
FinEnum (Sym α n)

Computable enumeration of size-n multisets over a FinEnum type, drawn from List.sym of the canonical enumeration. Every z : Sym α n qualifies since all its members lie in FinEnum.toList.

Instances For
    @[reducible]
    def Equiv.Perm.finEnum {α : Type u} [FinEnum α] :

    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
      @[reducible]
      def Function.Embedding.finEnum {β α : Type u} [FinEnum β] [FinEnum α] :
      FinEnum (β α)

      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.

      Instances For