""" fusscatalan.py -- checks the Fuss-Catalan material of section 3. For Markov inclusions C(W) in C(V), namely the diagonal C^n in M_n, the diagonal embedding of M_2 into M_2 + M_2, and the classical fibrations with k fibers of size m, it checks that psi_V restricted to C(W) is [V:W] psi_W, that the conditional expectation E_W is an orthogonal projection, that E_W o E_W = E_W/[V:W], and that the smallest subspace containing 1, J, E_W and stable under the 4 basic operations has dimension 3, while at the 2 endpoints C1 and C(V), where E_W = J/N and E_W = 1, the span of 1, J, E_W has dimension 2. It then counts the pairs sigma <= pi of noncrossing partitions of k points, which are the Fuss-Catalan numbers 3, 12, 55, and computes the rank of the corresponding tensors for classical fibrations. Results are written to fusscatalan.log. """ import itertools import numpy as np from qspace import QSpace, Logger, close from products import closure log = Logger("fusscatalan.log") def check(name, q, E, psiW, NW): index = q.N / NW markov = all(np.isclose(q.psi(E @ x), index * psiW(E @ x)) for x in np.eye(q.N)) proj = close(E @ E, E) and close(q.adjoint(E), E) bip = close(q.schur_fast(E, E), E / index) dW = index * E simple = close(q.schur_fast(dW, dW), dW) and close(q.sharp(dW), dW) log(f"{name}: index [V:W] = {index:g}, Markov {markov}, E_W orthogonal projection {proj}, " f"E_W o E_W = E_W/[V:W] {bip}, d_W = [V:W]E_W simple and real {simple}, " f"closure of 1, J, E_W has dimension {closure(q, [q.identity(), q.J(), E])}") for n in [2, 3]: q = QSpace([n]) E = q.matrix_of(lambda x: [np.diag(np.diag(x[0]))]) check(f"diagonal C^{n} in M_{n}", q, E, lambda v: np.trace(q.to_blocks(v)[0]).real, n) q = QSpace([2, 2]) E = q.matrix_of(lambda x: [(x[0] + x[1]) / 2, (x[0] + x[1]) / 2]) check("diagonal embedding of M_2 into M_2 + M_2", q, E, lambda v: 2 * np.trace(q.to_blocks(v)[0]).real, 4) for k, m in [(2, 2), (3, 2), (2, 3)]: q = QSpace([1] * (k * m)) E = np.kron(np.eye(k), np.ones((m, m)) / m) check(f"fibration with {k} fibers of size {m}", q, E, lambda v, m=m: v.real.sum() / m, k) # the 2 endpoints C1 in C(V) and C(V) in C(V): there E_W = J/N and E_W = 1, and the span drops to 2 for blocks in [[2], [1, 2]]: q = QSpace(blocks) for name, E in [("W = point", q.J() / q.N), ("W = V", q.identity())]: rank = np.linalg.matrix_rank(np.array([q.identity().ravel(), q.J().ravel(), E.ravel()])) log(f"endpoint {name} over blocks {blocks}: 1, J, E_W span dimension {rank}") def nc_partitions(k): def parts(s): if not s: yield [] return for p in parts(s[1:]): for i in range(len(p)): yield p[:i] + [[s[0]] + p[i]] + p[i + 1:] yield [[s[0]]] + p def noncrossing(p): lab = {x: b for b, blk in enumerate(p) for x in blk} return not any(lab[a] == lab[c] and lab[b] == lab[d] and lab[a] != lab[b] for a, b, c, d in itertools.combinations(range(k), 4)) return [p for p in parts(list(range(k))) if noncrossing(p)] def finer(s, p): lab = {x: b for b, blk in enumerate(p) for x in blk} return all(len({lab[x] for x in blk}) == 1 for blk in s) def fc_rank(k, nf, m): N = nf * m idx = np.array(list(itertools.product(range(N), repeat=k))) w = idx // m vecs = [] NC = nc_partitions(k) for p in NC: for s in NC: if finer(s, p): ok = np.ones(len(idx), dtype=bool) for blk in p: for x in blk[1:]: ok &= w[:, x] == w[:, blk[0]] for blk in s: for x in blk[1:]: ok &= idx[:, x] == idx[:, blk[0]] vecs.append(ok.astype(float)) return len(vecs), int(np.linalg.matrix_rank(np.array(vecs))) for k in [2, 3, 4]: fc = int(round(np.prod([3 * k - i for i in range(k)]) / np.prod(range(1, k + 1)) / (2 * k + 1))) res = [(nf, m) + fc_rank(k, nf, m) for nf, m in [(2, 2), (3, 3), (4, 4)] if not (k == 4 and nf * m > 16)] log(f"k = {k}: Fuss-Catalan number {fc}, pairs sigma <= pi in NC(k), and ranks of the tensors for fibrations " f"(fibers, size, pairs, rank): {res}") log.save()