Documentation

Transfer.Base.Levels

Relatedness levels — the 3-point view of the Trocq lattice #

Trocq indexes each relation by a pair (m, n) of MapClass levels recording how much structure the relation carries in each direction; the full 6-point lattice (map0 ⊑ map1 ⊑ {map2a, map2b} ⊑ map3 ⊑ map4, with its order and meet) lives in Transfer.Hierarchy.ParamLevel. That lattice is the single source of truth for level arithmetic. This file supplies the coarse three-point view of it used by the crypto encodings (which are embeddings, never bijections):

map < embedding < equiv

RelLevel.toMapClass embeds the view into the lattice and MapClass.view3 retracts it (view3_toMapClass). The order RelLevel.le and the composite level RelLevel.meet are defined as the images of the lattice order and lattice meet under this view; the original three-point tables are recovered as theorems (le_iff_toNat, meet_eq_min), so every consumer of the 3-point API keeps its statements while the arithmetic is computed in the lattice.

The central operation is meet: a composite transfer (an op-tree assembled from sub-transfers) supports only the weakest level of its parts, so the level of a composite is the meet (the lower) of the component levels — computed as the MapClass meet of the images (toMapClass_meet).

The three relatedness levels — the univalence-free 3-point view of Trocq's MapClass lattice (see the module docstring; the embedding is RelLevel.toMapClass). Ordered map < embedding < equiv.

  • map : RelLevel

    A representation map: transfers equality forward only.

  • embedding : RelLevel

    An embedding (injective map): transfers equality both ways.

  • equiv : RelLevel

    An equivalence (bijection): the univalence/SIP level.

Instances For
    @[instance_reducible]
    Equations

    Rank of a level, for the linear order (the 3-point compatibility form; the primary order is the MapClass lattice order via toMapClass).

    Equations
    Instances For

      The reconciliation-table embedding of the 3-point view into the Trocq level lattice: a bare representation map carries a forward map (map1); an embedding's graph relation carries both inclusions (map3); the equivalence point is the coherent top (map4).

      Equations
      Instances For
        @[simp]

        RelLevel is a 3-point view: view3 retracts toMapClass.

        The order on levels: l₁ ≤ l₂ iff l₁ is no stronger than l₂ — defined as the MapClass lattice order on the images.

        Equations
        Instances For
          theorem Transfer.RelLevel.le_iff_toNat (l₁ l₂ : RelLevel) :
          l₁.le l₂ ↔ l₁.toNat ≤ l₂.toNat

          Old = new: the lattice-order definition of le agrees with the original 3-point rank order.

          theorem Transfer.RelLevel.toMapClass_mono {l₁ l₂ : RelLevel} (h : l₁ ≤ l₂) :

          The view embedding is monotone — definitionally, since le is the lattice order on the images.

          The meet (weaker) of two levels — the level a composite supports, given that it is only as strong as its weakest part. Defined as the view of the MapClass lattice meet of the images.

          Equations
          Instances For
            theorem Transfer.RelLevel.meet_eq_min (l₁ l₂ : RelLevel) :
            l₁.meet l₂ = if l₁.toNat ≤ l₂.toNat then l₁ else l₂

            Old = new: the lattice-computed meet agrees with the original 3-point table (the minimum in the rank order).

            The view embedding is a meet-homomorphism: the 3-point meet computes the lattice meet on the image (the image {map1, map3, map4} is meet-closed, and view3 retracts it).

            @[simp]
            theorem Transfer.RelLevel.meet_comm (l₁ l₂ : RelLevel) :
            l₁.meet l₂ = l₂.meet l₁
            @[simp]
            theorem Transfer.RelLevel.meet_le_left (l₁ l₂ : RelLevel) :
            l₁.meet l₂ ≤ l₁
            theorem Transfer.RelLevel.meet_le_right (l₁ l₂ : RelLevel) :
            l₁.meet l₂ ≤ l₂