From 1c340af14e35fc48f67e47c918378bc2658ac57e Mon Sep 17 00:00:00 2001 From: Kevin Arlin Date: Fri, 1 Dec 2023 18:16:11 -0800 Subject: [PATCH] Better fix for overly tight typing --- src/categorical_algebra/FinSets.jl | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/categorical_algebra/FinSets.jl b/src/categorical_algebra/FinSets.jl index bb3576e47..01b14b533 100644 --- a/src/categorical_algebra/FinSets.jl +++ b/src/categorical_algebra/FinSets.jl @@ -853,10 +853,14 @@ function limit(d::BipartiteFreeDiagram{<:SetOb,<:FinDomFunction{Int}}) # For uniformity, e.g. when pairing below, ensure that all objects in layer 2 # are type sets. + # XX: map can introduce overtight typing if !all(x isa TypeSet for x in ob₂(d)) d = map(d, ob₁=identity, ob₂=ensure_type_set, hom=ensure_type_set_codom) end - + # Make sure Hom isn't too tight + d′ = BipartiteFreeDiagram{SetOb,FinDomFunction{Int}}() + copy_parts!(d′,d) + d = d′ # It is generally optimal to compute all equalizers (self joins) first, so as # to reduce the sizes of later pullbacks (joins) and products (cross joins). d, ιs = equalize_all(d) @@ -993,11 +997,6 @@ function pair_all(d::BipartiteFreeDiagram{Ob,Hom}) where {Ob,Hom} v = add_vertex₂!(d_paired, ob₂=ob(prod)) for (i,u) in enumerate(srcs) f = pair(prod, hom(d, getindex.(in_edges, i))) - f isa Hom || begin - d_paired_looser = BipartiteFreeDiagram{Ob,Union{Hom,typeof(f)}}() - copy_parts!(d_paired_looser,d_paired) - d_paired = d_paired_looser - end add_edge!(d_paired, u, v, hom=f) end end