Setoid.Algebras.Products.Finite¶
Finiteness of finite powers¶
This is the Setoid.Algebras.Products.Finite module of the Agda Universal Algebra Library.
A finite power of a finite algebra is finite. This module discharges the
FiniteAlgebra interface of Setoid.Algebras.Finite for the
constant-family product β¨
(Ξ» (_ : Fin n) β π¨) of
Setoid.Algebras.Products β the power π¨βΏ β from a finiteness witness for
the base algebra π¨:
- decidable equality is decided coordinatewise, by a finite conjunction of
base-level decisions (
all?); - the enumeration of the
cardβΏtuples is the standard library's positional base-cardencodingfinToFun, composed with the base enumeration coordinatewise; - surjectivity holds pointwise up to
ββ which is exactly the setoid equality of the product β with no appeal to function extensionality: the round-trip lawfinToFun-funToFinis itself pointwise.
The first consumer is the KurzweilβNetter duality proof (issue #502), which
needs the power Sα΅ of a finite group to be a finite algebra so that the coset
algebra on Sα΅/D inherits finiteness through
cosetAlgebra-FiniteAlgebra of
Classical.Structures.Group.GSet.
The finiteness witness for a power¶
module _ {π : Signature π π₯} {π¨ : Algebra {π = π} Ξ± Ο} {n : β} (π : FiniteAlgebra π¨) where open Setoid π»[ π¨ ] using ( _β_ ; trans ) renaming ( reflexive to β-reflexive ) open FiniteAlgebra π using ( _β_ ; card ; enum ; enum-sur ) private π· : Algebra {π = π} Ξ± Ο π· = β¨ {I = Fin n} (Ξ» _ β π¨) -- The tuple encoded by an index: base enumeration after digit extraction. penum : Fin (card ^ n) β π[ π· ] penum Ξ½ i = enum (finToFun Ξ½ i) -- The index encoding a tuple: the digits are the base indices of its values. pidx : π[ π· ] β Fin (card ^ n) pidx x = funToFin Ξ» i β enum-sur (x i) .projβ -- The round trip hits the tuple coordinatewise, up to β. penum-pidx : (x : π[ π· ]) (i : Fin n) β penum (pidx x) i β x i penum-pidx x i = trans (β-reflexive (cong enum (finToFun-funToFin (Ξ» j β enum-sur (x j) .projβ) i))) (enum-sur (x i) .projβ) -- A finite power of a finite algebra is finite. power-FiniteAlgebra : FiniteAlgebra π· power-FiniteAlgebra = record { _β_ = Ξ» x y β all? (Ξ» i β x i β y i) ; card = card ^ n ; enum = penum ; enum-sur = Ξ» x β pidx x , penum-pidx x }