The relation hierarchy as classes #
Trocq keeps a hierarchy of relation structures and picks, per subterm, the
weakest level a transfer needs. This module promotes the ReprTransfer
structures into a univalence-free class hierarchy:
ReprMapClass (a map, transfers = forward)
⊂ ReprEmbeddingClass (+ injective, reflects =, so transfers = both ways)
⊂ ReprEquivClass (a bijection — the top level the SIP/univalence route needs).
The hierarchy bottoms out below equivalence: the crypto encodings are embeddings
(point/Fp¹²/word serializations are injective, not surjective), so the
equality-transfer level is ReprEmbeddingClass, and the layer never requires —
nor incurs the TCB cost of — univalence. The per-operation realizations
(BinOpRealization / EndoOpRealization / BinOpHomOn in ReprTransfer) are
the op-level instances built over these levels; the repr registry (Transfer.Base.Core)
indexes them.
Level 1: a representation embedding — a map that reflects equality (injective). Transfers a decidable equality in both directions.
- enc : A → α
- enc_inj : Function.Injective ReprMapClass.enc
The encoding reflects equality.
Instances
Equality transfers across an embedding (both directions).
Level 2 (top): a representation equivalence — a bijective encoding. The level the univalence / structure-identity route requires; the crypto encodings do not reach it (they are embeddings, not bijections), which is why the transfer layer stays univalence-free.
- enc : A → α
- dec : α → A
The inverse decoding.
Instances
An EndoOpRealization (from ReprTransfer) supplies an embedding level: its
enc/enc_inj are exactly a ReprEmbeddingClass. Bridges the op-level
realizations to the relation hierarchy.
Equations
- Transfer.endoOpRealizationToEmbeddingClass R = { enc := R.enc, enc_inj := ⋯ }