Documentation

ReflectiveSubsystems.GradedConjugation

Transport at grade: conjugating a graded realizer between re-encodings ([Decoupling] §4.5) #

Conjecture 4.4's load-bearing step asks a capacity-respecting simulation to transport a realizer without overflowing the budget. ReflectiveSubsystems/GradeTransport.lean priced the conjugation on a single injective encoding (an Assembly); this module runs the same transport one level up, on the many-realizers assemblies (Asm) over which the graded exponential [A ⇒ B]_g is built, and reads the price off as a grade.

What is transported #

reencodeAsm A c re-encodes an assembly: an element keeps its identity, but a realizer index m of it is carried to val c m, the value the code c computes on m. This is the direct-image realizability relation (∃ m, A.realizes m a ∧ n = val c m); unlike the Assembly-level reencode, it asks for no injectivity of the new naming, because a many-realizers assembly already tolerates many names per element.

transportIdx c_emb c_proj r transports a realizer index: decode r to a code, conjugate it with the coded retraction pair (c_emb, c_proj) (transportRealizer), re-encode the result. Its tracking law (tracks_transportIdx) and its grade law (grade_transportIdx_le) are the two halves; gradedTransport packages them, carrying an element of [A ⇒ B]_g to an element of [reencodeAsm A c_embA ⇒ reencodeAsm B c_emb]_{4·max g b + 9}.

The pullback direction (pullbackAsm, tracks_pullback, gradedPullback) is the mirror: a new index realizes an element when reading it back lands on an old realizer, and the same conjugation transports the tracker with the reading in the source slot. It reuses the identical index arithmetic (grade_transportIdx_le), so the grade law is unchanged — only the retraction's side flips, from input to output.

The retraction, and its asymmetry #

tracks_transportIdx inherits the asymmetry of the Assembly-level realizes_transport (cross-referenced for orientation, not consumed here — the two live over different assembly notions). The input side needs a genuine retraction (hretr: c_proj undoes c_embA on the realizer indices actually in use), because the conjugate must recover the old index before the realizer can run on it; the output side needs only a coded map c_emb, applied to the result with nothing to undo. The realizer r itself needs neither a fragment hypothesis nor totality — its behaviour enters only as the membership k ∈ ap r m. The retraction is conditioned over the indices in use, as every realizer hypothesis in this development is, never over all of ℕ.

The price #

grade_transportIdx_le is the §4.5 transport clause at grade: the index length of the conjugate is at most 4 · max g b + 9, where g bounds the realizer's grade and b the re-encoders'. It is the one-hop max-affine law of bitlen_transport_le read through the Code ≃ ℕ numbering (grade_encode, bitlen_ofNat). The semantic conjunct needs no separate statement: it is exactly gradedExp's tracking clause, holding on the transported element by tracks_transportIdx.

Deliberately absent #

One partial combinatory algebra (Kleene's first, on Nat.Partrec.Code), one hop. Nothing here iterates the transport or claims a functor: the leading factor of the max-affine law compounds once per hop (the ×4 is 2², for the two nested comp nodes), so an iterated transport grows the index budget geometrically — the one-hop law is a theorem while the full functor of Conjecture 4.4 stays open. The packaging map gradedTransport is a function on carriers; it is not itself claimed trackable — conjugation-as-code, the functor's action on realizers, is the boundary this module stops at. No tightness is claimed for the constant 4 · max g b + 9, and no host-side assembly map is built (the assembly induced by a hosting square is a separate construction).

Re-encoding a many-realizers assembly, and transporting an index #

Re-encoding an Asm along a code. The carrier is unchanged; a realizer index m of an element is carried to val c m. The relation is the direct image of A's under val c, so it needs no injectivity — a many-realizers assembly already names each element by many codes.

Equations
Instances For

    Transporting a realizer index. Decode the index r to a code, conjugate it with the coded retraction pair (c_emb, c_proj) (transportRealizer), and re-encode the conjugate. This is the action transportIdx a capacity-respecting simulation has on realizer indices.

    Equations
    Instances For

      The tracking law transports #

      theorem ReflectiveSubsystems.tracks_transportIdx {A B : RealizabilityCCC.Asm} {f : A.carrier → B.carrier} {c_embA c_emb c_proj : Nat.Partrec.Code} {r : ℕ} (hemb : TimeCost.RfindFree c_emb) (hproj : TimeCost.RfindFree c_proj) (hretr : ∀ (a : A.carrier) (m : ℕ), A.realizes m a → TimeCost.val c_proj (TimeCost.val c_embA m) = m) (hr : RealizabilityCCC.Tracks A B r f) :
      RealizabilityCCC.Tracks (reencodeAsm A c_embA) (reencodeAsm B c_emb) (transportIdx c_emb c_proj r) f

      The tracking condition transports along a re-encoding. If r tracks f : A ⟶ B and (c_embA, c_proj) is a retraction pair on the indices A actually uses (hretr), then the transported index transportIdx c_emb c_proj r tracks the same function f between the re-encodings reencodeAsm A c_embA and reencodeAsm B c_emb.

      The realizer r enters only through the membership k ∈ ap r m, so it needs neither an rfind-free fragment nor totality; the two re-encoding codes c_proj/c_emb are run, so they are RfindFree. The input side undoes c_embA with c_proj; the output side only applies c_emb.

      The grade law, and the packaged transport #

      theorem ReflectiveSubsystems.grade_transportIdx_le {c_emb c_proj : Nat.Partrec.Code} {r b g : ℕ} (hemb : bitlen c_emb ≤ b) (hproj : bitlen c_proj ≤ b) (hg : grade r ≤ g) :
      grade (transportIdx c_emb c_proj r) ≤ 4 * max g b + 9

      The transported index stays within the max-affine budget ([Decoupling] §4.5). If the two re-encoders have index length at most b and the realizer has grade at most g, the transported index has grade at most 4 · max g b + 9. This is bitlen_transport_le read through the Code ≃ ℕ numbering (grade_encode, bitlen_ofNat): the counting-bound realizer length and the exponential's grade are one quantity.

      noncomputable def ReflectiveSubsystems.gradedTransport {A B : RealizabilityCCC.Asm} {b g : ℕ} {c_embA c_emb c_proj : Nat.Partrec.Code} (hemb : TimeCost.RfindFree c_emb) (hproj : TimeCost.RfindFree c_proj) (hbe : bitlen c_emb ≤ b) (hbp : bitlen c_proj ≤ b) (hretr : ∀ (a : A.carrier) (m : ℕ), A.realizes m a → TimeCost.val c_proj (TimeCost.val c_embA m) = m) (f : (gradedExp g A B).carrier) :
      (gradedExp (4 * max g b + 9) (reencodeAsm A c_embA) (reencodeAsm B c_emb)).carrier

      The transport clause of Conjecture 4.4, at grade. A capacity-respecting re-encoding takes a morphism affordable at grade g — an element of the graded exponential [A ⇒ B]_g — to a morphism of the re-encoded assemblies affordable at grade 4 · max g b + 9, where b bounds the two re-encoders' index lengths. The underlying function is unchanged (gradedTransport_fn); the new realizer is the conjugated index, whose grade the max-affine one-hop law bounds (grade_transportIdx_le) and whose tracking tracks_transportIdx supplies. The budget of a capacity-respecting transport does not overflow — it grows by one max-affine hop.

      Equations
      Instances For
        theorem ReflectiveSubsystems.gradedTransport_fn {A B : RealizabilityCCC.Asm} {b g : ℕ} {c_embA c_emb c_proj : Nat.Partrec.Code} (hemb : TimeCost.RfindFree c_emb) (hproj : TimeCost.RfindFree c_proj) (hbe : bitlen c_emb ≤ b) (hbp : bitlen c_proj ≤ b) (hretr : ∀ (a : A.carrier) (m : ℕ), A.realizes m a → TimeCost.val c_proj (TimeCost.val c_embA m) = m) (f : (gradedExp g A B).carrier) :
        fn (gradedTransport hemb hproj hbe hbp hretr f) = fn f

        The transport leaves the underlying function untouched. gradedTransport re-encodes realizers, not elements; the morphism it produces computes the same map on carriers as its input.

        The pullback direction: re-encoding by reading, and its inverted asymmetry #

        def ReflectiveSubsystems.pullbackAsm (A : RealizabilityCCC.Asm) (c_read c_sect : Nat.Partrec.Code) (hsect : ∀ (a : A.carrier) (m : ℕ), A.realizes m a → TimeCost.val c_read (TimeCost.val c_sect m) = m) :

        Pulling an Asm back along a reading. The carrier is unchanged; a new index n realizes an element exactly when reading it back with c_read lands on an old realizer — A.realizes (val c_read n) a. Where reencodeAsm pushes realizers forward through a code, this pulls them back: the reading c_read is applied to the candidate index. The section c_sect (with the retraction hsect) supplies a witness index, so the object stays inhabited by realizers.

        Equations
        Instances For
          theorem ReflectiveSubsystems.tracks_pullback {A B : RealizabilityCCC.Asm} {f : A.carrier → B.carrier} {c_read c_sect : Nat.Partrec.Code} {r : ℕ} (hread : TimeCost.RfindFree c_read) (hsectRF : TimeCost.RfindFree c_sect) (hsA : ∀ (a : A.carrier) (m : ℕ), A.realizes m a → TimeCost.val c_read (TimeCost.val c_sect m) = m) (hsB : ∀ (b' : B.carrier) (m : ℕ), B.realizes m b' → TimeCost.val c_read (TimeCost.val c_sect m) = m) (hr : RealizabilityCCC.Tracks A B r f) :
          RealizabilityCCC.Tracks (pullbackAsm A c_read c_sect hsA) (pullbackAsm B c_read c_sect hsB) (transportIdx c_sect c_read r) f

          Tracking transports along a pullback — the mirror of tracks_transportIdx. The transported index is the same conjugation, but with the reading in the source slot: transportIdx c_sect c_read runs c_read first, then the realizer, then c_sect.

          The asymmetry inverts. In the pushforward the retraction sat on the input — the conjugate had to recover the old index before running. Here the input is free: the pullback hands the guest index to c_read directly, and the realizer runs on val c_read n. The genuine retraction is on the output (hsB, over B's realizers in use): the result is re-encoded by c_sect and c_read must read it back. hsA does no tracking work at all — it only builds the domain object. This is a sibling proof, not an instance of tracks_transportIdx.

          noncomputable def ReflectiveSubsystems.gradedPullback {A B : RealizabilityCCC.Asm} {b g : ℕ} {c_read c_sect : Nat.Partrec.Code} (hread : TimeCost.RfindFree c_read) (hsectRF : TimeCost.RfindFree c_sect) (hbr : bitlen c_read ≤ b) (hbs : bitlen c_sect ≤ b) (hsA : ∀ (a : A.carrier) (m : ℕ), A.realizes m a → TimeCost.val c_read (TimeCost.val c_sect m) = m) (hsB : ∀ (b' : B.carrier) (m : ℕ), B.realizes m b' → TimeCost.val c_read (TimeCost.val c_sect m) = m) (f : (gradedExp g A B).carrier) :
          (gradedExp (4 * max g b + 9) (pullbackAsm A c_read c_sect hsA) (pullbackAsm B c_read c_sect hsB)).carrier

          The pullback clause of Conjecture 4.4, at grade. The host-side counterpart of gradedTransport: a morphism affordable at grade g between guest assemblies is carried to a morphism affordable at grade 4 · max g b + 9 between their pullbacks along a reading pair of index length at most b. The grade law is grade_transportIdx_le at (c_sect, c_read) — the same max-affine index arithmetic; only the conjugation's argument order differs.

          Equations
          Instances For
            theorem ReflectiveSubsystems.gradedPullback_fn {A B : RealizabilityCCC.Asm} {b g : ℕ} {c_read c_sect : Nat.Partrec.Code} (hread : TimeCost.RfindFree c_read) (hsectRF : TimeCost.RfindFree c_sect) (hbr : bitlen c_read ≤ b) (hbs : bitlen c_sect ≤ b) (hsA : ∀ (a : A.carrier) (m : ℕ), A.realizes m a → TimeCost.val c_read (TimeCost.val c_sect m) = m) (hsB : ∀ (b' : B.carrier) (m : ℕ), B.realizes m b' → TimeCost.val c_read (TimeCost.val c_sect m) = m) (f : (gradedExp g A B).carrier) :
            fn (gradedPullback hread hsectRF hbr hbs hsA hsB f) = fn f

            The pullback leaves the underlying function untouched, exactly as the pushforward does.