Adjunctions¶
The Adjunction interface, the FreeForgetfulAdjunction implementation,
and their unit and counit operations.
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:
Adjunction (abstract)
└── FreeForgetfulAdjunction — Free monoid ⊣ Forgetful
ForgetfulFunctor
¶
Bases: Functor
The forgetful functor from FreeMonoid-algebras to FinSet.
On objects: A ↦ A (the underlying set). Since FreeMonoid is already a CoproductSet (hence a SetObject), the forgetful functor is the identity on the set level. On morphisms: identity on tensors.
In the adjunction Free ⊣ Forget, "Forget" maps A back to A as a bare set (no monoid structure). Since we represent everything as bare sets already, this is the identity functor.
map_object
¶
map_morphism
¶
map_morphism(morph: Morphism) -> FunctorMorphism
Adjunction
¶
Bases: ABC
Abstract adjunction F ⊣ G.
Subclasses must implement left, right, unit_component, and counit_component.
unit_component
abstractmethod
¶
counit_component
abstractmethod
¶
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:
|
atol
|
Absolute tolerance.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if the identity holds within tolerance. |
Source code in src/quivers/categorical/adjunctions.py
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:
|
atol
|
Absolute tolerance.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if the identity holds within tolerance. |
Source code in src/quivers/categorical/adjunctions.py
FreeForgetfulAdjunction
¶
Bases: Adjunction
The free-forgetful adjunction: Free ⊣ Forget.
Free: FinSet → FinSet via FreeMonoidFunctor (A ↦ A) Forget: identity at set level (A ↦ A* as bare set)
η_A: A → A embeds each element as a length-1 word. ε_A: A → A projects onto length-1 words (for A a FinSet).
| PARAMETER | DESCRIPTION |
|---|---|
max_length
|
Maximum string length for the free monoid.
TYPE:
|
Source code in src/quivers/categorical/adjunctions.py
unit_component
¶
η_A: A → A* embeds as length-1 words.
| PARAMETER | DESCRIPTION |
|---|---|
obj
|
Must be a FinSet.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Morphism
|
The embedding morphism. |
Source code in src/quivers/categorical/adjunctions.py
counit_component
¶
ε_A: Free(Forget(A)) → A.
For a FinSet A, this projects A* onto A by extracting the length-1 stratum. Length-1 words map to their element; all others (empty string, longer words) map to zero.
For a FreeMonoid A (needed by the left triangle identity), this is the monoid evaluation map (A) → A that concatenates formal words of words into single words.
| PARAMETER | DESCRIPTION |
|---|---|
obj
|
The object A.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Morphism
|
The counit morphism. |