Natural Transformations¶
Morphisms between functors that preserve categorical structure naturally.
natural_transformations
¶
Natural transformations between endofunctors.
A natural transformation η: F ⇒ G is a family of morphisms {η_A: F(A) → G(A)} indexed by objects, satisfying the naturality condition:
η_B ∘ F(f) = G(f) ∘ η_A for all f: A → B
This module provides:
NaturalTransformation (abstract)
└── ComponentwiseNT — defined by a callable producing components
NaturalTransformation
¶
Bases: ABC
Abstract natural transformation η: F ⇒ G.
Subclasses must implement component to produce η_A for
each object A.
| PARAMETER | DESCRIPTION |
|---|---|
source
|
The source functor F.
TYPE:
|
target
|
The target functor G.
TYPE:
|
Source code in src/quivers/categorical/natural_transformations.py
43 44 45 | |
component
abstractmethod
¶
Return the component η_A: F(A) → G(A).
| PARAMETER | DESCRIPTION |
|---|---|
obj
|
The object A.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Morphism
|
The morphism η_A: F(A) → G(A). |
Source code in src/quivers/categorical/natural_transformations.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |
verify_naturality
¶
verify_naturality(f: Morphism, atol: float = 1e-05) -> bool
Verify the naturality condition for a given morphism.
Checks that η_B ∘ F(f) ≈ G(f) ∘ η_A for f: A → B.
| PARAMETER | DESCRIPTION |
|---|---|
f
|
A morphism f: A → B to check naturality against.
TYPE:
|
atol
|
Absolute tolerance for tensor comparison.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
True if the naturality square commutes within tolerance. |
Source code in src/quivers/categorical/natural_transformations.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | |
ComponentwiseNT
¶
Bases: NaturalTransformation
A natural transformation defined by a callable.
Wraps a function obj ↦ morphism into a NaturalTransformation. Useful for constructing natural transformations from explicit component definitions.
| PARAMETER | DESCRIPTION |
|---|---|
source
|
The source functor F.
TYPE:
|
target
|
The target functor G.
TYPE:
|
component_fn
|
A function that, given an object A, returns η_A: F(A) → G(A). |
Source code in src/quivers/categorical/natural_transformations.py
128 129 130 131 132 133 134 135 | |