Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Internal categories in Set are ordinary small categories

Proved
QAlgorithms.Papers.Independent.Intake100.P20.internalCategoriesInSet

by Gohan · Oct 30, 2026 · Mathlib 0df444a (Lean v4.33.1)

prove2quantum

An internal category in Set has an object set OOO, an arrow set AAA, source and target maps s,t:A→Os,t:A\to Os,t:A→O, identities e:O→Ae:O\to Ae:O→A, and composition g∘fg\circ fg∘f when t(f)=s(g)t(f)=s(g)t(f)=s(g). Require se=te=idOse=te=\mathrm{id}_Ose=te=idO​, the correct source and target of a composite, associativity, and both unit laws. It gives an ordinary small category by

Hom⁡(x,y)={f∈A:s(f)=x, t(f)=y}.\operatorname{Hom}(x,y)=\{f\in A:s(f)=x,\ t(f)=y\}.Hom(x,y)={f∈A:s(f)=x, t(f)=y}.

Conversely, the total arrow set ∐x,yHom⁡(x,y)\coprod_{x,y}\operatorname{Hom}(x,y)∐x,y​Hom(x,y) of an ordinary small category has these internal maps, with (y,z,g)∘(x,y,f)=(x,z,f;g)(y,z,g)\circ(x,y,f)=(x,z,f\mathbin{;}g)(y,z,g)∘(x,y,f)=(x,z,f;g), where f;gf\mathbin{;}gf;g means first fff, then ggg. The explicit arrow and hom-fibre equivalences recover identities and composition. Empty categories are allowed. This is a correspondence of structures with the original operations, not two unrelated existence statements.

Preamble
import Definitions.Def_QAlgorithms_Papers_Independent_Intake100_P20
Formal statement
namespace QAlgorithms.Papers.Independent.Intake100.P20

open CategoryTheory

open scoped TensorProduct Manifold ContDiff

universe u v w z

/-- PDF pp. 6–8: internal categories in Set and ordinary small categories have
mutually inverse structure translations. Objects stay fixed; arrows are identified
by the displayed canonical equivalences. Every reconstruction equation for
composition is restricted to the source's composable pairs. -/
theorem internalCategoriesInSet :
    (∀ {A : Type u} {O : Type v} (D : CategoryMaps A O) (h : CategoryDiagrams D),
      letI := categoryOfMaps D h
      let E := mapsOfCategory O
      let q := totalArrowEquiv D h
      (∀ a, E.source (q a) = D.source a ∧ E.target (q a) = D.target a) ∧
      (∀ x, E.identity x = q (D.identity x)) ∧
      (∀ f g, D.target f = D.source g →
        E.compose (q g) (q f) = q (D.compose g f))) ∧
    (∀ (O : Type v) [Category.{u} O], CategoryDiagrams (mapsOfCategory O) ∧
      (∀ x, (mapsOfCategory O).identity x = ⟨x, x, 𝟙 x⟩) ∧
      (∀ x y z (f : x ⟶ y) (g : y ⟶ z),
        (mapsOfCategory O).compose ⟨y, z, g⟩ ⟨x, y, f⟩ = ⟨x, z, f ≫ g⟩) ∧
      (∀ x y (f : x ⟶ y), (totalHomEquiv O x y f).val = ⟨x, y, f⟩)) := by sorry

end QAlgorithms.Papers.Independent.Intake100.P20
Source
Group Objects and Internal Categories, arXiv:math/0212065v1, PDF p. 8, §3, pp. 6–8
Read-back

What the Lean code literally says, in plain math · gpt-6.1-sol

The theorem asserts the conjunction of two statements. First, let A,OA,OA,O be arbitrary types, and let s,t:A→Os,t:A\to Os,t:A→O, i:O→Ai:O\to Ai:O→A, and c:A×A→Ac:A\times A\to Ac:A×A→A be total functions satisfying s(i(x))=t(i(x))=xs(i(x))=t(i(x))=xs(i(x))=t(i(x))=x for every x∈Ox\in Ox∈O; s(c(g,f))=s(f)s(c(g,f))=s(f)s(c(g,f))=s(f) and t(c(g,f))=t(g)t(c(g,f))=t(g)t(c(g,f))=t(g) whenever t(f)=s(g)t(f)=s(g)t(f)=s(g); c(i(t(f)),f)=fc(i(t(f)),f)=fc(i(t(f)),f)=f and c(f,i(s(f)))=fc(f,i(s(f)))=fc(f,i(s(f)))=f for every f∈Af\in Af∈A; and c(h,c(g,f))=c(c(h,g),f)c(h,c(g,f))=c(c(h,g),f)c(h,c(g,f))=c(c(h,g),f) whenever t(f)=s(g)t(f)=s(g)t(f)=s(g) and t(g)=s(h)t(g)=s(h)t(g)=s(h). Give OOO the category whose morphisms x→yx\to yx→y are elements f∈Af\in Af∈A equipped with s(f)=xs(f)=xs(f)=x and t(f)=yt(f)=yt(f)=y, whose identities are i(x)i(x)i(x), and whose composition is induced by ccc. Let TTT be the type of triples (x,y,f)(x,y,f)(x,y,f) with f:x→yf:x\to yf:x→y in this category, and let q:A→Tq:A\to Tq:A→T be the bijection q(a)=(s(a),t(a),a)q(a)=(s(a),t(a),a)q(a)=(s(a),t(a),a), where the last component includes its endpoint equalities. On TTT, define S(x,y,f)=xS(x,y,f)=xS(x,y,f)=x, T ⁣o(x,y,f)=yT_{\!o}(x,y,f)=yTo​(x,y,f)=y, I(x)=(x,x,idx)I(x)=(x,x,\mathrm{id}_x)I(x)=(x,x,idx​), and define C(β,α)C(\beta,\alpha)C(β,α), for α=(x,y,f)\alpha=(x,y,f)α=(x,y,f) and β=(z,w,g)\beta=(z,w,g)β=(z,w,g), to be (x,w,f followed by the equality arrow y→z followed by g)(x,w,f\text{ followed by the equality arrow }y\to z\text{ followed by }g)(x,w,f followed by the equality arrow y→z followed by g) if y=zy=zy=z, and to be α\alphaα otherwise. Then S(q(a))=s(a)S(q(a))=s(a)S(q(a))=s(a) and T ⁣o(q(a))=t(a)T_{\!o}(q(a))=t(a)To​(q(a))=t(a) for every aaa, I(x)=q(i(x))I(x)=q(i(x))I(x)=q(i(x)) for every xxx, and C(q(g),q(f))=q(c(g,f))C(q(g),q(f))=q(c(g,f))C(q(g),q(f))=q(c(g,f)) whenever t(f)=s(g)t(f)=s(g)t(f)=s(g). Second, for every category with object type OOO, form its type of all morphism triples and the same maps S,T ⁣o,I,CS,T_{\!o},I,CS,To​,I,C, including the rule that composition returns its second argument when the endpoints do not match. These maps satisfy all the source, target, identity, and conditional associativity equations listed above; moreover I(x)=(x,x,idx)I(x)=(x,x,\mathrm{id}_x)I(x)=(x,x,idx​), C((y,z,g),(x,y,f))=(x,z,g∘f)C((y,z,g),(x,y,f))=(x,z,g\circ f)C((y,z,g),(x,y,f))=(x,z,g∘f) for every f:x→yf:x\to yf:x→y and g:y→zg:y\to zg:y→z, and the underlying triple of the image of f:x→yf:x\to yf:x→y under the endpoint-restricted bijection is (x,y,f)(x,y,f)(x,y,f). Empty types and empty morphism sets are allowed wherever the stated data exist; the composition-preservation assertions apply only when the specified endpoints match.

Human review
  • Endorsed by Shuze Chen · Oct 31, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Gohan · Oct 31, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me