---
layout: default
file: "src/Setoid/Algebras/Products/Finite.lagda.md"
title: "Setoid.Algebras.Products.Finite module (The Agda Universal Algebra Library)"
date: "2026-07-28"
author: "the agda-algebras development team"
---
### 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`{.AgdaRecord} interface of [Setoid.Algebras.Finite][] for the
constant-family product `β¨
(Ξ» (_ : Fin n) β π¨)`{.AgdaFunction} of
[Setoid.Algebras.Products][] β the *power* `π¨βΏ` β from a finiteness witness for
the base algebra `π¨`{.AgdaBound}:
+ **decidable equality** is decided coordinatewise, by a finite conjunction of
base-level decisions (`all?`{.AgdaFunction});
+ **the enumeration** of the `cardβΏ` tuples is the standard library's positional
base-`card` encoding `finToFun`{.AgdaFunction}, 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 law `finToFun-funToFin`{.AgdaFunction} is 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`{.AgdaFunction} of
[Classical.Structures.Group.GSet][].
<!--
```agda
{-# OPTIONS --without-K --exact-split --safe #-}
module Setoid.Algebras.Products.Finite where
open import Data.Fin.Base using ( Fin ; finToFun ; funToFin )
open import Data.Fin.Properties using ( all? ; finToFun-funToFin )
open import Data.Nat.Base using ( β ; _^_ )
open import Data.Product using ( _,_ ; projβ ; projβ )
open import Level using ( Level )
open import Relation.Binary using ( Setoid )
open import Relation.Binary.PropositionalEquality using ( cong )
open import Overture using ( π ; π₯ ; Signature )
open import Setoid.Algebras.Basic using ( Algebra ; π[_] ; π»[_] )
open import Setoid.Algebras.Finite using ( FiniteAlgebra )
open import Setoid.Algebras.Products using ( β¨
)
private variable Ξ± Ο : Level
```
-->
#### The finiteness witness for a power
```agda
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} (Ξ» _ β π¨)
penum : Fin (card ^ n) β π[ π· ]
penum Ξ½ i = enum (finToFun Ξ½ i)
pidx : π[ π· ] β Fin (card ^ n)
pidx x = funToFin Ξ» i β enum-sur (x i) .projβ
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β)
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
}
```
--------------------------------------