Skip to content

@acset_colim variants: exposing name mapping, and morphisms #986

Draft
kris-brown wants to merge 3 commits intomainfrom
namedacsetcolim
Draft

@acset_colim variants: exposing name mapping, and morphisms #986
kris-brown wants to merge 3 commits intomainfrom
namedacsetcolim

Conversation

@kris-brown
Copy link
Collaborator

This draft introduces two new macros related to @acset_colim. The first, @named_acset_colim, takes in an extra parameter which will be assigned a NamedTuple relating the names of the generators to their respective elements (Pair{Symbol, Int}).

acs = @named_acset_colim y_Graph MyDomain begin
  v::V; e::E; src(e)==v
end

@test acs[MyDomain.e[2],:src] == MyDomain.v[2]

The second @acset_transformation_colim, accepts two @acset_colim-style expressions as well as a sequence of pairs (which initializing a hom search) as well as keyword arguments for hom-search.

# sending path graph •→•→• to •→•↺↺. 
f = @acset_transformation_colim y_Graph #=domain=# begin
  (vstart,vend)::V; (e1,e2)::E; 
  src(e1)==vstart; tgt(e1)==src(e2); tgt(e2)==vend
end #=codomain =# begin
  v::V; (ea,eb,ec)::E; 
  src(ea)==v; tgt(ea)==src(eb) == tgt(eb) == src(ec) == tgt(ec)
end #=mapping=# begin vstart=>v; end #=kw=# (any=true, monic=[:E])

In order for this to truly work, the data of yoneda is actually not enough. We are missing the data of, in a representable Foo, which element is the representing element. For example, the representable edge in a reflexive graph has three edges in it. Only one of them is the representing element. Presently, for simplicity so that the same data can be plugged into @acset_colim and these macros, we throw an error if there is any ambiguity in what the representing element is.

@kris-brown kris-brown linked an issue Oct 31, 2025 that may be closed by this pull request
@kris-brown kris-brown self-assigned this Oct 31, 2025
@wwaites
Copy link

wwaites commented Nov 4, 2025

Moving some discussion from the Zulip here. Having some experience with these new macros now, I think that it might be unwise to have @named_acset_colimit implemented the way it is because it is not referentially transparent -- the names appear effectively by side-effect. This more functional (and simpler!) implementation might be better :

macro named_acset_colim(yon, body)
  quote 
    colimit_representables($(parse_diagram_data(body, __module__)), $(esc(yon)))
  end
end


# If we are just asking for a coproduct of representables
isempty(spans) && return apex(Σ)
isempty(spans) && return (names, apex(Σ))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

names is not yet defined here

ACSet with src=1 and tgt=2. However, unlike `@acset_colim`, this also assigns
to a variable MyDomain the NamedTuple `(v=(:V, 1),e=(:E, 1))`.
"""
macro named_acset_colim(yon, names_var, body)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on the PR moved here: #986 (comment)

Having some experience with these new macros now, I think that it might be unwise to have @named_acset_colimit implemented the way it is because it is not referentially transparent -- the names appear effectively by side-effect. This more functional (and simpler!) implementation might be better:

macro named_acset_colim(yon, body)
  quote 
    colimit_representables($(parse_diagram_data(body, __module__)), $(esc(yon)))
  end
end

end
```

This would behave like `@acset_colim` and assign to `Dom` the walking edge
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably ought to change the comment too:

This would behave like `@acset_colim` and assign to `Dom` the walking edge 
ACSet with src=1 and tgt=2. However, unlike `@acset_colim`, this returns the pair
`(names, colimit)` where `names =  (v=(:V, 1),e=(:E, 1))`.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@acset_colim variant that preserves symbol -> part mapping

2 participants