/-
Copyright (c) 2026 Terence Rokop. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Terence Rokop
-/modulepublicimportGeb.Mathlib.Data.PFunctor.Slice.BasicpublicimportGeb.Mathlib.Data.PFunctor.Univariate.FunctorpublicimportMathlib.CategoryTheory.Comma.Over.BasicpublicimportMathlib.CategoryTheory.Subfunctor.Basic
Slice polynomial functors: categorical wrapper
Packages the constructive core (Slice.Basic) as a
CategoryTheory.Functor between Over categories. mathlib's Over is
Classical.choice-dependent at the type level, so this categorical
packaging is kept in a separate module from the choice-free core.
Main definitions
SliceDomPFunctor.domSubfunctor — the compatible assignments as a
subfunctor of the underlying polynomial functor.
SliceDomPFunctor.domFunctor — the functor Over dom ⥤ Type.
SlicePFunctor.functor — the functor Over dom ⥤ Over cod.
Main statements
SlicePFunctor.functor_obj / functor_map — the categorical
functor's object and morphism maps are definitionally the
core SlicePFunctor.obj / map.
SlicePFunctor.functor_comp_forget — the wrapper forgets back to
domFunctor.
Implementation notes
domSubfunctor is the subfunctor of Over.forget dom ⋙ PFunctor.functor
cut out by the compatibility predicate, and domFunctor reads it as a
functor, so the functor laws come from Subfunctor.toFunctor and
Subfunctor.ι is the inclusion into the underlying polynomial functor.
Over structure maps are read through ConcreteCategory.hom, the
slice-morphism hypothesis is SliceDomPFunctor.over_hom_comp (the
function-level form of Over.w), and the subfunctor's closure condition
is the core map's output compatibility. The composite instantiates
PFunctor.functor at v := uD, written explicitly as
PFunctor.functor.{uA, uB, uD}. functor is the Functor.toOver lift
along the shape-output map q; it is @[expose] so functor_obj /
functor_map can state the definitional equalities as exported rfl
theorems. cod is pinned to domFunctor's codomain universe
max uA uB uD because Functor.toOver requires its over-base object
to inhabit the codomain category of the lifted functor, so the core's
cod-universe polymorphism cannot survive into the categorical layer.
The function-level form of Over.w: a slice morphism g : Y ⟶ Z
commutes with the projections, Z.hom ∘ g.left = Y.hom, read through
ConcreteCategory.hom.
The r-compatible assignments, as a subfunctor of the underlying
polynomial functor pulled back along the forgetful functor. The obj
field is the compatibility predicate; the map field is its closure
under the polynomial functor's action, supplied by the core map.
@[`@[expose]` has no effect outside a `module` fileexpose]defdomSubfunctor{dom:TypeuD}(F:SliceDomPFunctor.{uA,uB}dom):Subfunctor(Over.forgetdom⋙F.toPFunctor.functor.{uA,uB,uD})whereobjY:={x|F.Compatible(ConcreteCategory.homY.hom)x.1x.2}mapixhx:=(F.map(ConcreteCategory.homi.left)(over_hom_compi)⟨x,hx⟩).2
The functor Over dom ⥤ Type restricting the PFunctor
interpretation to r-compatible assignments: the subfunctor
domSubfunctor read as a functor. Subfunctor.ι is the inclusion into
the underlying polynomial functor.
@[`@[expose]` has no effect outside a `module` fileexpose]defdomFunctor{dom:TypeuD}(F:SliceDomPFunctor.{uA,uB}dom):CategoryTheory.Functor(Overdom)(Type(maxuAuBuD)):=F.domSubfunctor.toFunctor
endSliceDomPFunctornamespaceSlicePFunctor
Output-index naturality: domFunctor.map g fixes the shape component,
so post-composing with the shape-output map q is preserved. This is
the Functor.toOver triangle obligation for functor, shared with
functor_comp_forget.
privatetheoremoutput_triangle{dom:TypeuD}{cod:Type(maxuAuBuD)}(F:SlicePFunctor.{uA,uB,uD,maxuAuBuD}domcod){YZ:Overdom}(g:Y⟶Z):F.toSliceDomPFunctor.domFunctor.mapg≫(↾funz↦F.qz.1.1)=(↾funz↦F.qz.1.1):=bydom:Type uDcod:Type (max uA uB uD)F:SlicePFunctordomcodY:OverdomZ:Overdomg:Y⟶Z⊢ (F.domFunctor.mapg≫↾funz↦F.q(↑z).fst)=↾funz↦F.q(↑z).fstextzdom:Type uDcod:Type (max uA uB uD)F:SlicePFunctordomcodY:OverdomZ:Overdomg:Y⟶Zz:F.domFunctor.objY⊢ (ConcreteCategory.hom(F.domFunctor.mapg≫↾funz↦F.q(↑z).fst)).toFunz=(ConcreteCategory.hom(↾funz↦F.q(↑z).fst)).toFunzexactcongrArgF.q(F.toSliceDomPFunctor.map_fst(ConcreteCategory.homg.left)(SliceDomPFunctor.over_hom_compg)z)All goals completed! 🐙
The slice polynomial functor Over dom ⥤ Over cod: the
Functor.toOver lift of domFunctor along the shape-output map q.
@[`@[expose]` has no effect outside a `module` fileexpose]deffunctor{dom:TypeuD}{cod:Type(maxuAuBuD)}(F:SlicePFunctor.{uA,uB,uD,maxuAuBuD}domcod):CategoryTheory.Functor(Overdom)(Overcod):=Functor.toOverF.toSliceDomPFunctor.domFunctorcod(fun_↦↾(funz↦F.qz.1.1))(bydom:Type uDcod:Type (max uA uB uD)F:SlicePFunctordomcod⊢ ∀{YZ:Overdom}(g:Y⟶Z),(F.domFunctor.mapg≫↾funz↦F.q(↑z).fst)=↾funz↦F.q(↑z).fstintroYZgdom:Type uDcod:Type (max uA uB uD)F:SlicePFunctordomcodY:OverdomZ:Overdomg:Y⟶Z⊢ (F.domFunctor.mapg≫↾funz↦F.q(↑z).fst)=↾funz↦F.q(↑z).fst;exactF.output_trianglegAll goals completed! 🐙)
The wrapper forgets back to domFunctor.
theoremfunctor_comp_forget{dom:TypeuD}{cod:Type(maxuAuBuD)}(F:SlicePFunctor.{uA,uB,uD,maxuAuBuD}domcod):F.functor⋙Over.forgetcod=F.toSliceDomPFunctor.domFunctor:=bydom:Type uDcod:Type (max uA uB uD)F:SlicePFunctordomcod⊢ F.functor⋙Over.forgetcod=F.domFunctorrw[functordom:Type uDcod:Type (max uA uB uD)F:SlicePFunctordomcod⊢ F.domFunctor.toOvercod(funx↦↾funz↦F.q(↑z).fst)⋯⋙Over.forgetcod=F.domFunctor]dom:Type uDcod:Type (max uA uB uD)F:SlicePFunctordomcod⊢ F.domFunctor.toOvercod(funx↦↾funz↦F.q(↑z).fst)⋯⋙Over.forgetcod=F.domFunctorexactFunctor.toOver_comp_forget___fung↦F.output_trianglegAll goals completed! 🐙
functor.obj is the core obj, packaged with Over.mk. The
categorical object map carries no data beyond the core.
functor.map's underlying function is the core map. An Over
morphism's only data is its left component, so this fixes the categorical
morphism map up to its Prop-valued commuting condition.