LeanPool.FormalizationOfBoundedArithmetic.IsEnum #
A finite type equipped with explicit encodings to and from a finite index type.
- size : ℕ
The number of elements in the enumeration.
Encode an element as an index.
Decode an index as an element.
Decoding and then encoding gives back the same index.
Encoding and then decoding gives back the same element.
Instances
Deriving handler for IsEnum on finite inductive types.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The index decoder is a left inverse of the encoder.
The index decoder is a right inverse of the encoder.
The equivalence between an enumerated type and its finite index type.
Equations
- IsEnum.equiv = { toFun := IsEnum.toIdx, invFun := IsEnum.fromIdx, left_inv := ⋯, right_inv := ⋯ }
Instances For
The decoder from indices is injective.
The encoder to indices is injective.
List all elements of an enumerated type in index order.