Zulip Chat Archive

Stream: mathlib4

Topic: Computable cartesian closed categories


Albus Dompeldorius (Mar 13 2025 at 08:47):

I want to work with cartesian closed categories in a computable way, but everything in Mathlib.CategoryTheory.Closed.Cartesian is marked as noncomputable, even though it seems that almost all of the definitions are already computable. Is there a reason we can't remove the global noncomputable and mark the few noncomputable definitions instead?

There are four noncomputable definitions:

def internalizeHom (f : A  Y) : ⊤_ C  A  Y
def powZero {I : C} (t : IsInitial I) [CartesianClosed C] : I  B  𝟙_ C

These can be made computable by replacing ⊤_ C with 𝟙_ C (which is available since we assume ChosenFiniteProducts C anyway).

def prodCoprodDistrib [HasBinaryCoproducts C] [CartesianClosed C] (X Y Z : C)
def cartesianClosedOfEquiv (e : C  D) [CartesianClosed C] : CartesianClosed D :=
  letI := e.inverse.monoidalOfChosenFiniteProducts
  MonoidalClosed.ofEquiv (e.inverse) e.symm.toAdjunction

These remain noncomputable since they depend on the noncomputable HasBinaryCoproducts C MonoidalClosed.ofEquiv respectively.

Kim Morrison (Mar 13 2025 at 09:19):

No objection.

Albus Dompeldorius (Mar 13 2025 at 09:23):

Great! I will make a PR.

Albus Dompeldorius (Mar 13 2025 at 10:08):

Opened pull request here: PR.


Last updated: May 02 2025 at 03:31 UTC