Level-annotated relatedness #
This refines the Related kernel (Bridges/Transfer/Related) with the relatedness
levels of Bridges/Transfer/Levels. A RelatedAt lvl enc a b carries the same
underlying equation enc a = b and additionally records the strongest encoding
strength (RelLevel) available along this transfer.
The level is metadata rather than a proof obligation: the equation is identical
at every level. The level provides reflection at the embedding level —
transferIffAt turns a one-way encoding equality into the two-way ↔ of
ReprEmbeddingClass.eq_iff, which the bare map level cannot supply.
Composition follows Levels.meet: an op-tree assembled from sub-transfers is
only as strong as its weakest part, so composeBinOpAt sits at the meet of the
component levels — and since RelLevel.meet is the view of the MapClass
lattice meet, the composite's level index is computed in the Trocq lattice
(composeBinOpAt_level_toMapClass).
The Param-hierarchy foundation #
The primary, lattice-indexed semantics of a level-annotated transfer is
membership in the graph Param at the image level: RelLevel.graphParam lvl enc : Param lvl.toMapClass .map0 packages the graph of enc with the exact
MapHas structure the image level carries (map1 a bare map, map3 both
inclusions, map4 + the proof-irrelevance coherence), and
relatedAt_iff_graphParam identifies RelatedAt lvl enc a b with
(graphParam lvl enc).R a b. At the class-registered points the graph Param
is the committed hierarchy witness (graphParam_map_eq_paramOfMap,
graphParam_embedding_eq_paramOfEmbedding), and the embedding-level
reflection transferIffAt is derived from its Param-side form
(transferIffParam). The RelatedAt class is kept as the resolution-facing
wrapper over this semantics.
Bridges to the unlevelled kernel #
RelatedAt.toRelated— forget the level (always sound: same equation).Related.toRelatedAtMap— every transfer is at leastmap-level.
RelatedAt lvl enc a b: like Related enc a b (the value b is the
encoding enc a of a), but indexed by the relatedness lvl recording the
strongest encoding strength available along this transfer. The underlying
equation is the same at every level.
bis exactly the encoding ofa.
Instances
A level-annotated registered realization of a binary operation: the
commuting square enc (op x y) = bop (enc x) (enc y), tagged with the level
lvl at which the operation's encoding is realized.
The commuting square for this operation.
Instances
Composition. A composite transfer is only as strong as its weakest part.
A realized operation at level lop and operands at levels la, lb give
the composite at meet lop (meet la lb). The equation proof mirrors
composeBinOp.
Leaf (generic encoding) at an explicit level. The encoding of a value is
related to it. Low priority so composeBinOpAt is preferred and resolution
terminates at leaves. The level must be pinned by the goal.
Every transfer is at least map-level. A plain transfer lifts to a
map-annotated one (the weakest level).
The level a transfer used, reportable as data.
Equations
- Transfer.levelOf x✝ = lvl
Instances For
The Param-hierarchy foundation: graph Param at the image level #
The forward MapHas structure of the graph of enc at the image level
lvl.toMapClass: a bare map at map1, both graph inclusions (identities)
at map3, and the map4 coherence free by proof irrelevance on the
Prop-valued graph.
Equations
- Transfer.RelLevel.graphMapHas enc Transfer.RelLevel.map = { map := enc }
- Transfer.RelLevel.graphMapHas enc Transfer.RelLevel.embedding = { map := enc, map_in_R := ⋯, R_in_map := ⋯ }
- Transfer.RelLevel.graphMapHas enc Transfer.RelLevel.equiv = { map := enc, map_in_R := ⋯, R_in_map := ⋯, R_in_mapK := ⋯ }
Instances For
The graph of enc as an annotated relation at the image level: the
primary, lattice-indexed semantics of a level-annotated transfer.
Backward map0 — no decoder is packaged (an annotation records forward
strength only; the backward directions live in the Param hierarchy's
committed witnesses).
Equations
- lvl.graphParam enc = { R := fun (a : A) (b : α) => enc a = b, fwd := Transfer.RelLevel.graphMapHas enc lvl, bwd := { } }
Instances For
At the map point the graph Param of a class-registered map is the
committed hierarchy witness paramOfMap.
At the embedding point the graph Param of a class-registered embedding
is the committed hierarchy witness paramOfEmbedding.
The composite level index of composeBinOpAt is computed in the
MapClass lattice: its toMapClass is the lattice meet of the images
(immediate from the lattice definition of RelLevel.meet).
Reflection at the embedding level #
Reflection stated on the Param side (the primary form): membership in
the class-registered embedding's Param relation reflects equality —
the one-way graph equation becomes the two-way ↔ via
ReprEmbeddingClass.eq_iff.
Embedding-level reflection. At embedding level the encoding reflects
equality, so the one-way transfer equation enc a = b becomes the two-way
b = enc a' ↔ a = a'. This is what embedding provides over map: map
transfers equality forward, while embedding (ReprEmbeddingClass.eq_iff)
transfers it both ways. Derived from the Param-side primary form
transferIffParam.
Demonstrations at explicit levels #
A tiny self-contained registered operation over Nat keeps the file light while
exercising leaf resolution, single-op composition, and the meet of a
composite.
A trivially-realized + on Nat under the identity encoding, registered at
equiv level (Nat ↔ Nat is a bijection).