Skip to content

Adjunctions

An adjunction pairs two functors so that maps out of the first correspond to maps into the second (Mac Lane, 1998). A function from a set of generators into a monoid, for instance, determines a unique monoid homomorphism from the free monoid on those generators. The unit and counit express this correspondence, and the adjunction is an equivalence when both are isomorphisms. The module gives the Adjunction interface, with its unit and counit and checks of the triangle identities.

adjunctions

Adjunctions between endofunctors.

An adjunction F ⊣ G consists of functors F (left adjoint) and G (right adjoint), together with natural transformations:

η: Id ⇒ G ∘ F    (unit)
ε: F ∘ G ⇒ Id    (counit)

satisfying the triangle identities:

ε_{F(A)} ∘ F(η_A) = id_{F(A)}
G(ε_A) ∘ η_{G(A)} = id_{G(A)}

Every adjunction induces a monad T = G ∘ F with η as unit and μ = G(ε_F) as multiplication.

This module provides the abstract Adjunction interface and its triangle-identity checks.

Adjunction

Bases: ABC

Abstract adjunction F ⊣ G.

Subclasses must implement left, right, unit_component, and counit_component.

left abstractmethod property

left: Functor

The left adjoint F.

right abstractmethod property

right: Functor

The right adjoint G.

unit_component abstractmethod

unit_component(obj: SetObject) -> Morphism

The unit component η_A: A → G(F(A)).

PARAMETER DESCRIPTION
obj

The object A.

TYPE: SetObject

RETURNS DESCRIPTION
Morphism

The unit morphism η_A.

Source code in src/quivers/categorical/adjunctions.py
@abstractmethod
def unit_component(self, obj: SetObject) -> Morphism:
    """The unit component η_A: A → G(F(A)).

    Parameters
    ----------
    obj : SetObject
        The object A.

    Returns
    -------
    Morphism
        The unit morphism η_A.
    """
    ...

counit_component abstractmethod

counit_component(obj: SetObject) -> Morphism

The counit component ε_A: F(G(A)) → A.

PARAMETER DESCRIPTION
obj

The object A.

TYPE: SetObject

RETURNS DESCRIPTION
Morphism

The counit morphism ε_A.

Source code in src/quivers/categorical/adjunctions.py
@abstractmethod
def counit_component(self, obj: SetObject) -> Morphism:
    """The counit component ε_A: F(G(A)) → A.

    Parameters
    ----------
    obj : SetObject
        The object A.

    Returns
    -------
    Morphism
        The counit morphism ε_A.
    """
    ...

verify_triangle_left

verify_triangle_left(obj: SetObject, atol: float = 1e-05) -> bool

Verify left triangle identity: ε_{F(A)} ∘ F(η_A) ≈ id_{F(A)}.

PARAMETER DESCRIPTION
obj

The object A.

TYPE: SetObject

atol

Absolute tolerance.

TYPE: float DEFAULT: 1e-05

RETURNS DESCRIPTION
bool

True if the identity holds within tolerance.

Source code in src/quivers/categorical/adjunctions.py
def verify_triangle_left(self, obj: SetObject, atol: float = 1e-5) -> bool:
    """Verify left triangle identity: ε_{F(A)} ∘ F(η_A) ≈ id_{F(A)}.

    Parameters
    ----------
    obj : SetObject
        The object A.
    atol : float
        Absolute tolerance.

    Returns
    -------
    bool
        True if the identity holds within tolerance.
    """
    fa = self.left.map_object(obj)
    eta_a = self.unit_component(obj)
    f_eta = self.left.map_morphism(eta_a)
    eps_fa = self.counit_component(fa)
    result = (f_eta >> eps_fa).tensor
    expected = identity(fa).tensor

    return torch.allclose(result, expected, atol=atol)

verify_triangle_right

verify_triangle_right(obj: SetObject, atol: float = 1e-05) -> bool

Verify right triangle identity: G(ε_A) ∘ η_{G(A)} ≈ id_{G(A)}.

PARAMETER DESCRIPTION
obj

The object A.

TYPE: SetObject

atol

Absolute tolerance.

TYPE: float DEFAULT: 1e-05

RETURNS DESCRIPTION
bool

True if the identity holds within tolerance.

Source code in src/quivers/categorical/adjunctions.py
def verify_triangle_right(self, obj: SetObject, atol: float = 1e-5) -> bool:
    """Verify right triangle identity: G(ε_A) ∘ η_{G(A)} ≈ id_{G(A)}.

    Parameters
    ----------
    obj : SetObject
        The object A.
    atol : float
        Absolute tolerance.

    Returns
    -------
    bool
        True if the identity holds within tolerance.
    """
    ga = self.right.map_object(obj)
    eps_a = self.counit_component(obj)
    g_eps = self.right.map_morphism(eps_a)
    eta_ga = self.unit_component(ga)
    result = (eta_ga >> g_eps).tensor
    expected = identity(ga).tensor

    return torch.allclose(result, expected, atol=atol)

Cited sources

Saunders Mac Lane. Categories for the Working Mathematician. Volume 5 of Graduate Texts in Mathematics. Springer, 2 edition, 1998. URL: https://link.springer.com/book/10.1007/978-1-4757-4721-8, doi:10.1007/978-1-4757-4721-8.