Distributive Laws¶
Distributive laws between monads and comonads.
distributive_laws
¶
Distributive laws for composing monads.
A distributive law λ: S ∘ T ⇒ T ∘ S between monads S and T allows their composition T ∘ S to form a new monad. The component λ_A: S(T(A)) → T(S(A)) "pushes S past T."
This module provides:
DistributiveLaw (abstract)
└── FreeMonoidPowersetLaw — λ: Free(P(A)) → P(Free(A))
DistributiveLaw
¶
Bases: ABC
Abstract distributive law λ: S ∘ T ⇒ T ∘ S.
Subclasses must implement outer_monad, inner_monad, and distribute.
outer_monad
abstractmethod
property
¶
outer_monad: Monad
The outer monad S (applied second in S ∘ T).
inner_monad
abstractmethod
property
¶
inner_monad: Monad
The inner monad T (applied first in S ∘ T).
FreeMonoidPowersetLaw
¶
FreeMonoidPowersetLaw(max_length: int, algebra: Algebra | None = None)
Bases: DistributiveLaw
Distributive law λ: Free(P(A)) → P(Free(A)).
A word of fuzzy sets (S₁, ..., Sₖ) in Free(P(A)) maps to a fuzzy set of words in P(Free(A)) with membership:
λ(S₁,...,Sₖ)(a₁,...,aₖ) = ⊗ᵢ Sᵢ(aᵢ)
This is exactly the componentwise lift (the functorial action of FreeMonoid on morphisms). The distributive law witnesses the fact that "a word of fuzzy sets" can be reinterpreted as "a fuzzy set of words" via the product t-norm.
| PARAMETER | DESCRIPTION |
|---|---|
max_length
|
Maximum string length for the free monoid.
TYPE:
|
algebra
|
The enrichment algebra. Defaults to PRODUCT_FUZZY.
TYPE:
|
Source code in src/quivers/monadic/distributive_laws.py
distribute
¶
λ_A: Free(P(A)) → P(Free(A)) = Free(A) (at set level).
Since P is identity at set level, Free(P(A)) = Free(A) = A. And P(Free(A)) = Free(A) = A (also identity at set level). So λ_A: A → A is an endomorphism.
The tensor is the block-diagonal matrix built from componentwise_lift — which is exactly the FreeMonoidFunctor's action on the identity morphism A → A.
| PARAMETER | DESCRIPTION |
|---|---|
obj
|
Must be a FinSet.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ObservedMorphism
|
The distributive law component λ_A. |