Documentation

Transfer.Examples.ParamRetraction

The ℤ ↠ ZMod p retraction transfer domain (non-diagonal) #

This module builds the paper's ring-quotient example (int ↔ Zmodp) as a non-diagonal transfer domain for the Param engine — a representation change where the two sides are different types and the round-trip holds on one side only (a retraction, not an equivalence). It realizes the witness shape that ParamCryptoExamples's §4 note describes without constructing.

Why this is a retraction, and the exact Param class it reaches #

The encoding is Int.cast : ℤ → ZMod p with graph relation R i x := (↑i = x).

Hence the retraction is exactly a Param .map3 .map2a ℤ (ZMod p). Compare paramOfEquiv (Param .map3 .map2b, left inverse) — incomparable backward class. A two-sided bijection would reach map3/map4; the quotient cannot, because section ∘ Int.cast is reduction-mod-p, not id on ℤ.

Feeding the ∀-rule and TransferDom #

forallTransfer/TransferDom consume the domain at (.map0, .map2a) — forward nothing, backward map2a. The witness here is stronger forward (map3), so the forward structure is forgotten down to map0 (Map3Has → … → Map0Has) and the result fits TransferDom ℤ (ZMod p) directly. No shape gap: the retraction's backward map2a is precisely what the engine needs, so param_transfer resolves this non-diagonal domain with no caller-named relation.

The retraction witness ℤ ↠ ZMod p #

The ℤ ↠ ZMod p retraction as a Param .map3 .map2a.

Relation R i x := (↑i = x) (graph of Int.cast). Forward map3 (graph of Int.cast, both inclusions trivial). Backward map2a: decoder g x := (↑x.val : ℤ) with map_in_R the retraction Int.cast (↑x.val) = x (ZMod.natCast_val cast through Int.cast_natCast). It is not map2b, because the quotient is not injective — the class is asymmetric.

Equations
  • One or more equations did not get rendered due to their size.
Instances For

    Weakening into the ∀-rule level and the TransferDom instance #

    Forget the forward map3 of intZModParam down to map0, landing at the (.map0, .map2a) level that forallTransfer/TransferDom consume. The backward map2a retraction is preserved verbatim.

    Equations
    Instances For
      @[instance_reducible]

      TransferDom accepts the retraction. The ℤ ↠ ZMod p change of representation resolves automatically for param_transfer: the engine takes the backward map2a (decoder + retraction) it needs, with no caller-named relation. This is a non-diagonal TransferDom (distinct source and target types), unlike the diagonal TransferDom A A.

      Equations

      A non-diagonal transfer demo across ℤ/ZMod p #

      The relation on related pairs (i, x) is (↑i : ZMod p) = x, so the pointwise obligation is phrased with the integer i cast into ZMod p — a real representation change. We transfer a ∀ i : ℤ statement to a ∀ x : ZMod p statement, supplying the predicate correspondence and discharging the emitted obligation through the cast equation.

      theorem Transfer.Param.intZModForallTransfer {p : ℕ} [NeZero p] {P : ℤ → Prop} {P' : ZMod p → Prop} (PB : ∀ (i : ℤ) (x : ZMod p), ↑i = x → P i → P' x) :
      (∀ (i : ℤ), P i) → ∀ (x : ZMod p), P' x

      Non-diagonal ∀-transfer (ℤ ↠ ZMod p). From ∀ i : ℤ, (P i : Prop) the transfer yields ∀ x : ZMod p, P' x whenever, on related pairs (i, x) with (↑i : ZMod p) = x, the integer property P i implies the modular property P' x. The domain Param is the retraction, resolved by TransferDom.

      Secondary retraction: ℕ ↠ ZMod p (for [NeZero p]) #

      A cleaner natural-number retraction in the same shape: Nat.cast : ℕ → ZMod p (for [NeZero p]) is surjective with section ZMod.val, round-trip on the ZMod p side only (ZMod.natCast_rightInverse, since ZMod.val ∘ Nat.cast is reduction-mod-p, not id on ℕ). Same Param .map3 .map2a class, same TransferDom wiring — a second witness that the non-diagonal machinery is not tied to the ℤ source.

      The ℕ ↠ ZMod p retraction as a Param .map3 .map2a (for [NeZero p]): forward Nat.cast (graph, map3), backward ZMod.val with map_in_R the retraction Nat.cast (↑x.val) = x (ZMod.natCast_rightInverse).

      Equations
      Instances For

        The ℕ ↠ ZMod p domain at the ∀-rule level (.map0, .map2a).

        Equations
        Instances For
          @[instance_reducible]

          TransferDom accepts the ℕ ↠ ZMod p retraction too.

          Equations

          Axiom audit #