algebra/algebra/
bialgebra_trait.rs

1use crate::algebra::Algebra;
2
3/// An [`Algebra`] equipped with a coproduct operation that makes it into a
4/// bialgebra.
5#[enum_dispatch::enum_dispatch]
6pub trait Bialgebra: Algebra {
7    /// Computes a coproduct $\Delta(x)$, expressed as
8    ///
9    /// $$ Delta(x)_i = \sum_j A_{ij} \otimes B_{ij}. $$
10    ///
11    /// The return value is a list of these pairs of basis elements.
12    ///
13    /// `x` must have been returned by [`Bialgebra::decompose()`].
14    fn coproduct(&self, op_deg: i32, op_idx: usize) -> Vec<(i32, usize, i32, usize)>;
15
16    /// Decomposes an element of the algebra into a product of elements, each of
17    /// which we can compute a coproduct on efficiently.
18    ///
19    /// The product is laid out such that the first element of the vector is
20    /// applied to a module element first when acting on it.
21    ///
22    /// This function is to be used with [`Bialgebra::coproduct()`].
23    ///
24    /// This API is motivated by the fact that, in the admissible basis for the Adem algebra,
25    /// an element naturally decomposes into a product of Steenrod squares, each of which has an
26    /// easy coproduct formula.
27    fn decompose(&self, op_deg: i32, op_idx: usize) -> Vec<(i32, usize)>;
28}