/-
Copyright (c) 2026 Terence Rokop. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Terence Rokop
-/modulepublicimportMathlib.Logic.Equiv.Defs
Prototype: the morphisms the universe's type formers are functorial along
Throwaway exploration, not upstream-eligible content. Every declaration here is
Classical.choice-free.
Example 3.6 of [GhaniNordvallForsbergMalatesta2015] shows that the
dependent-product former of a universe does not extend to an IR⁺(Set) or
IR⁺(Setᵒᵖ) code: interpreting the δ rule at a morphism f : X' → X of the
decoding category requires a map Π X' (Y ∘ f) ⟶ Π X Y, and there is none in
general. The paper's answer is to move to the groupoid Set≅, where every
morphism is invertible.
This module records that invertibility is more than the interpretation needs.
What it needs is a map backwards along f, and a section suffices:
piMap builds Π X' (Y ∘ f) → Π X Y from a chosen section of f, and
piMap_id and piMap_comp are its functor laws. The dependent-sum former needs
nothing (sigmaMap), and not_piMap is the counterexample, the same one the
paper gives and the one Geb/Prototypes/FinCardUniverse/Value.lean reproduces
in its finite model.
The resulting class of morphisms — split epimorphisms carrying a chosen section,
composing contravariantly in the sections — sits strictly between the
isomorphisms and all functions. twIdEquivSplit identifies it: a morphism
between identity arrows in the twisted-arrow category is exactly such a pair. So
the decoding category a Σ-and-Π universe can be interpreted over is at least the
diagonal of Tw(C), not only the core groupoid.
Main definitions
Split — a function with a chosen section, with Split.id and Split.comp.
sigmaMap — the dependent-sum former's action, along an arbitrary function.
piMap — the dependent-product former's action, along a Split.
TwHom — a morphism of the twisted-arrow category.
Main statements
Split.id_comp, Split.comp_id, Split.comp_assoc — Split composes as a
category.
sigmaMap_id, sigmaMap_comp — the dependent-sum former's functor laws.
piMap_id, piMap_comp — the dependent-product former's functor laws, which
is the claim: the interpretation is functorial along split epimorphisms, not
merely along isomorphisms.
not_piMap — no such map along an arbitrary function.
twIdEquivSplit — Split A B is the hom-set of the twisted-arrow category
between the identity arrows on A and on B.
A function together with a chosen section: a split epimorphism whose section
is data rather than a property. The dependent-product former is functorial along
these; see piMap.
Every equivalence is split, so the groupoid of
[GhaniNordvallForsbergMalatesta2015]'s Example 3.6 is a special case: an
isomorphism is a function whose section happens to be a two-sided inverse.
Its action runs the reindexing backwards, which is what a chosen section
supplies. The transport along toFun_sect is the same move the discrete case
makes along an equality of decodings.
The dependent-product former's action along a function with a chosen
section: evaluate the given section family at the chosen section, and transport
along the right-inverse witness.
Without a section there is no such map: the counterexample of Example 3.6 of
[GhaniNordvallForsbergMalatesta2015], with the empty object mapping to the
singleton and the family constant at the empty object. The empty product is
inhabited and the product of the constant family is not.
Tw(C) has the morphisms of C as objects, and a morphism from f : a ⟶ b to
g : c ⟶ d is a pair (src : c ⟶ a, tgt : b ⟶ d) with tgt ∘ f ∘ src = g. Its
diagonal — the identity arrows — has exactly the Splits as its morphisms.
A morphism of the twisted-arrow category of types: contravariant in the
source of the arrow, covariant in its target.
A morphism between identity arrows in the twisted-arrow category is exactly
a function with a chosen section. Both round trips are definitional: the two
structures carry the same data under the relabelling src ↦ sect,
tgt ↦ toFun.