---
layout: default
file: "src/FLRP/Certificates.lagda.md"
title: "FLRP.Certificates module (The Agda Universal Algebra Library)"
date: "2026-07-22"
author: "the agda-algebras development team"
---
### Machine-checked representation certificates
This is the [FLRP.Certificates][] module of the [Agda Universal Algebra Library][].
The FLRP program's computational campaigns[^1] produce claims of the form "`Con šØ ā
š³` for this finite algebra `šØ` and this finite lattice `š³`" from external engines ā
GAP, UACalc, SAT and model finders.
Per the certificate discipline of [the roadmap](docs/notes/flrp-research-roadmap.md)
§ 6 and [the WP-6 design note](docs/notes/flrp-wp6-freese-certificates.md), nothing
enters the corpus on the authority of an external tool: the engine emits a
whole-lattice certificate (normal-form parent vectors, Freese traces, and pointer
tables ā [Setoid.Congruences.Certificates.Schema][]), the generic checkers verify it
with no search and no `Cg-dec`{.AgdaFunction}
([Setoid.Congruences.Certificates.Congruence][],
[Setoid.Congruences.Certificates.Lattice][]), and *this* module turns the
checked certificate into the FLRP-facing theorem: a
`Representableįµ`{.AgdaRecord} witness ([FLRP.Representable][]) for the target
lattice.
Concretely, we are given
+ a finite finitary algebra (`š`, `šŗ`, everything at level `0ā`, as
`ConIsoįµ`{.AgdaFunction} demands),
+ a target `FiniteLattice`{.AgdaRecord} `š³` ([FLRP.Problem][]), and
+ a whole-lattice certificate `lc` whose entry list is indexed by `š³`'s carrier.
Then two checked hypotheses produce the order isomorphism; the hypotheses are
as follows:
+ `LatticeCertOK lc`{.AgdaRecord} ā the whole-lattice checker's bundle
(decided by one `latticeCertOK?`{.AgdaFunction});
+ `MeetMatches lc`{.AgdaFunction} ā the certificate's meet table is
*syntactically* the target lattice's `ā§`{.AgdaFunction} table (decided by
`meetMatches?`{.AgdaFunction}).
The isomorphism's two maps are the whole-lattice checker's completeness fold
`indexOf`{.AgdaFunction} (which executes only the given congruence's own decision
procedure and table lookups) and the certificate's entry decoder
`entryDec`{.AgdaFunction}; the four order-isomorphism laws are exactly the exported
fold lemmas, with the meet-table match translating containment of entries into the
lattice's meet order `x ⤠y := x ā§ y ā x` ([Classical.Properties.Lattice][]).
Since `toLattice`{.AgdaFunction} builds its carrier setoid on propositional equality,
the translation is definitional.
This is problem-specific wiring; all reusable mathematics lives under the `Setoid`
tree; in this case, under `Setoid.Congruences.Certificates`.
<!--
```agda
{-# OPTIONS --cubical-compatible --exact-split --safe #-}
module FLRP.Certificates where
open import Agda.Primitive using () renaming ( Set to Type )
open import Data.Fin.Base using ( Fin )
open import Data.Fin.Properties using ( all? )
renaming ( _ā_ to _āį¶ _ )
open import Data.Nat.Base using ( suc )
open import Data.Product using ( projā )
open import Level using ( 0ā )
open import Relation.Binary.PropositionalEquality using ( _ā”_ ; sym ; trans )
open import Relation.Nullary.Decidable using ( Dec )
open import FLRP.Problem using ( FiniteLattice
; toLattice )
open import FLRP.Representable using ( Representableįµ ; ConIsoįµ )
open import Overture using ( Signature )
open import Setoid.Algebras.Basic using ( Algebra )
open import Setoid.Algebras.Finite using ( FiniteAlgebra )
open import Setoid.Congruences.Finite.Basic using ( DecCon )
open import Setoid.Congruences.Lattice using ( ā-sym )
open import Setoid.Congruences.Certificates.Schema using ( LatticeCert )
open import Setoid.Congruences.Certificates.Congruence using ( module CertCheck )
open import Setoid.Congruences.Certificates.Lattice using ( module LatticeCheck )
open import Setoid.Signatures.Finite using ( FiniteSignature )
```
-->
#### The certified order isomorphism
Fix the finite finitary algebra, the target finite lattice, and a certificate
whose entry list is indexed by the lattice's carrier `Fin (suc size)`.
```agda
module _ {š : Signature 0ā 0ā} {šØ : Algebra {š = š} 0ā 0ā}
(š : FiniteAlgebra šØ) (šŗ : FiniteSignature š) (š³ : FiniteLattice)
where
open FiniteAlgebra š using ( card )
open FiniteSignature šŗ using ( opCard )
open CertCheck š šŗ using ( arOf )
open LatticeCheck š šŗ
open FiniteLattice š³ using ( size ; _ā§_ )
module _ (lc : LatticeCert card opCard arOf (suc size)) where
open LatticeCert lc using ( meet )
```
The meet-table match: the certificate's meet table *is* the target lattice's
`ā§`{.AgdaFunction} table. This is what pins the certificate's entry indexing
to the intended lattice, and it is decided by an `m ²` sweep of
`Fin`{.AgdaDatatype} comparisons.
```agda
MeetMatches : Type
MeetMatches = ā k l ā meet k l ā” k ā§ l
meetMatches? : Dec MeetMatches
meetMatches? = all? (Ī» k ā all? (Ī» l ā meet k l āį¶ k ā§ l))
```
Given the two checked hypotheses, the order isomorphism between the decidable
congruences of `šØ` and the meet order of the target lattice. The maps and all
four laws are the whole-lattice checker's exports; only the two monotonicity
clauses do any translation, moving between containment of entries and
meet-table idempotence through `MeetMatches`{.AgdaFunction} ā definitionally,
because the classical lattice's carrier equality is propositional.
```agda
module _ (OK : LatticeCertOK lc) (mm : MeetMatches) where
private
toIdx : DecCon šØ 0ā ā Fin (suc size)
toIdx = indexOf lc OK
fromIdx : Fin (suc size) ā DecCon šØ 0ā
fromIdx = entryDec lc OK
certConIsoįµ : ConIsoįµ šØ (toLattice š³)
certConIsoįµ = record
{ to = toIdx
; from = fromIdx
; to-mono = Ī» {d} {e} dāe ā
trans (sym (mm (toIdx d) (toIdx e)))
(āāmeetIdem lc OK (toIdx d) (toIdx e)
(fold-mono lc OK d e dāe))
; from-mono = Ī» {u} {v} uā¤v ā
meetIdemāā lc OK u v (trans (mm u v) uā¤v)
; toāfrom = fold-entry lc OK
; fromāto = Ī» d ā
ā-sym {Īø = projā d} {Ļ = projā (fromIdx (toIdx d))}
(dāfold lc OK d)
}
```
#### The certified representability witness
Packaging the finite finitary data with the certified isomorphism gives the
headline: the target lattice is decidably representable ā a machine-checked
representation, on no authority but the checker's.
```agda
certRepresentableįµ : Representableįµ (toLattice š³)
certRepresentableįµ = record
{ sigįµ = š
; algįµ = šØ
; finiteįµ = š
; finsigįµ = šŗ
; con-isoįµ = certConIsoįµ
}
```
--------------------------------------
[^1]: See [the roadmap](docs/notes/flrp-research-roadmap.md) § 5, Avenue A.