==============================================================================
PART A.  X = Z/4, sigma(x,y) = (y, x+1): X-basis, exact over Q
==============================================================================
  [ok]   sigma is a bijective solution of the braid relation
  [ok]   sigma is left and right non-degenerate
  [ok]   sigma is neither involutive nor idempotent
  [ok]   sigma has no fixed pairs
  dim A_n (n=0..7), union-find: [1, 4, 2, 1, 1, 1, 1, 1]
  [ok]   dim A_n = 1,4,2,1,1,1,1,1
  [ok]   A_2 has basis P, Q: P = class of pairs with y-x in {0,1}, Q with y-x in {2,3}
  dim B_n (n=0..4): [1, 4, 14, 47, 152]   dim K_n: [1, 4, 14, 49, 171]
  [ok]   dim B_n = 1,4,14,47,152
  [ok]   dim K_n = 1,4,14,49,171
  H_A(t)H_B(-t) to t^4: [1, 0, 0, 2, -11]
  [ok]   H_A(t)H_B(-t) = 1 + 2t^3 - 11t^4 + ...
  [ok]   H_A(t)H_K(-t) = 1 + O(t^5)
  [ok]   mu_i o QS_n = 0 for n <= 4, i.e. B_n is contained in K_n
  weight 1: dim C_n (n=0..1) = [8, 4], homology none
  [ok]   exact in weight 1
  weight 2: dim C_n (n=0..2) = [20, 32, 14], homology none
  [ok]   exact in weight 2
  weight 3: dim C_n (n=0..3) = [18, 80, 112, 47], homology {2: 2}
  [ok]   weight 3: H_2 = Q^2, all else zero
  weight 4: dim C_n (n=0..4) = [14, 72, 280, 376, 152], homology {3: 3}
  [ok]   weight 4: H_3 = Q^3, all else zero
  [ok]   aa-bb, u0a, u0b, ab+ba lie in R = B_2
  [ok]   u0 a = u0 b = 0 in A_2
  [ok]   aa = bb = 2P - 2Q in A_2
  [ok]   ab + ba = 0 in A_2
  [ok]   Re z and Im z are 2-cycles
  [ok]   Re z, Im z independent modulo boundaries (rank 47 -> 49)
  constant character eps = 1: H_n(B, d_eps) n=0..3: [1, 1, 0, 1]   H_n(K, d_eps): [1, 1, 0, 0]
  [ok]   H_3(B, d_eps) = Q while H_3(K, d_eps) = 0

==============================================================================
PART B.  Z/4 in the eigenbasis u_j = sum_x i^(-jx) x, exact over Q(i)
==============================================================================
  [ok]   sigma(u_a (x) u_b) = i^a u_b (x) u_a for all a, b
  [ok]   dim R = 14
  [ok]   u0u1, u1u0, u1u1 lie in R, so they vanish in A
  [ok]   u1u3 is not in R, but u1u3 - i u3u1 is
  [ok]   QS_3 maps W = span(u1u1u0, u1u0u1, u0u1u1) into W
  [ok]   QS_3 on W has the matrix of the paper (computed from the X-basis)
  [ok]   l(a1 w1 + a2 w2 + a3 w3) = i a1 + (1+i) a2 + a3 vanishes on QS_3(W)
  [ok]   QS_3|W has rank 2
  [ok]   c (x) id sends w1, w2, w3 to -i w1, -i w3, -w2
  [ok]   id (x) c sends w1, w2, w3 to -i w2, -w1, -i w3
  [ok]   kappa = (ad_c u1)^2 (u0)
  [ok]   Remark: words avoiding the leading terms number 1,4,2,1,1,1 = dim A_n
  [ok]   QS_3(kappa) = 0 for kappa = w1 + (1+i) w2 + i w3
  [ok]   u0u1u1 is not in B_3 (X-basis rank test over Q(i))
  eigenbasis dims n=0..5: A [1, 4, 2, 1, 1, 1]  B [1, 4, 14, 47, 152, 489]  K [1, 4, 14, 49, 171, 597]
  [ok]   diagonal model of Z/4: dims of A, B, K agree with the X-basis (n <= 4)
  [ok]   Table 1 up to n = 5 (eigenbasis, exact over Q(i))
  [ok]   H_A(t)H_B(-t) = 1 + 2t^3 - 11t^4 + 36t^5 + ..., H_A(t)H_K(-t) = 1 + O(t^6)
  [ok]   diagonal model: same 3x3 block
  [ok]   multidegree a0+2a1: dim K_3 = 3, dim B_3 = 2
  [ok]   multidegree a0+2a1: (C_0..C_3) = (0,3,6,2), H_2 = 1
  [ok]   z = u0 (x) u1u1 (x) 1 - 1 (x) u0u1 (x) u1 is a cycle and not a boundary
  [ok]   zbar (u3 in place of u1) is a cycle and not a boundary
  [ok]   z = z_re + i z_im (in the X-basis over Q(i))
    weight 3, multidegree (1, 0, 0, 2): homology {2: 1}
    weight 3, multidegree (1, 2, 0, 0): homology {2: 1}
  [ok]   diagonal model, weight 3: total homology {2: 2}
    weight 4, multidegree (0, 0, 0, 4): homology {3: 1}
    weight 4, multidegree (0, 4, 0, 0): homology {3: 1}
    weight 4, multidegree (2, 1, 0, 1): homology {3: 1}
  [ok]   diagonal model, weight 4: total homology {3: 3}

==============================================================================
PART C.  Two-letter models: u0 (eigenvalue 1) and u1 (eigenvalue lambda), over Q(zeta_12)
==============================================================================
 lambda = i
  [ok]   u1u1 = u0u1 = u1u0 = 0 in A, and u0u0 != 0
   multidegree (1, 2): dims C_n = [0, 3, 6, 2], homology {2: 1}
  [ok]   dims (0,3,6,2); H_2 = 1
 lambda = omega
  [ok]   u1u1 = u0u1 = u1u0 = 0 in A, and u0u0 != 0
   multidegree (1, 3): dims C_n = [0, 0, 4, 8, 3], homology {3: 1}
  [ok]   dims (0,0,4,8,3); H_3 = 1
   QS_3 on (u1u1u0, u1u0u1, u0u1u1), entries in Q(zeta_12), z = zeta_12:
       ['2 + -1*z^2', '-2 + 1*z^2', '2 + -1*z^2']
       ['1 + -2*z^2', '1 + 1*z^2', '-2 + 1*z^2']
       ['-1 + -1*z^2', '1 + -2*z^2', '2 + -1*z^2']
   det = -9
  [ok]   QS_3 invertible on span(u1u1u0, u1u0u1, u0u1u1), so u0u1u1 is in B_3
  [ok]   QS_3(u1u1u1) != 0, so u1u1u1 is in B_3
   QS_4 on (u1u1u1u0, u1u1u0u1, u1u0u1u1, u0u1u1u1):
       ['2 + -4*z^2', '-2 + 4*z^2', '2 + -4*z^2', '-2 + 4*z^2']
       ['-2 + -2*z^2', '5 + -1*z^2', '-5 + 4*z^2', '2 + -4*z^2']
       ['-4 + 2*z^2', '1 + -5*z^2', '5 + -1*z^2', '-2 + 4*z^2']
       ['-2 + 4*z^2', '-4 + 2*z^2', '-2 + -2*z^2', '2 + -4*z^2']
  [ok]   the QS_4 block has rank 3 (one-dimensional left kernel)
   left kernel vector l' = ['-1', '-2 + 2*z^2', '2*z^2', '1']
  [ok]   l' vanishes on QS_4 of the block and l'(u0u1u1u1) != 0: u0u1u1u1 is not in B_4
  [ok]   z' = u0 (x) [u1u1u1] (x) 1 + 1 (x) [u0u1u1] (x) u1 is a cycle
  [ok]   the kernel of the QS_4 block is one-dimensional
  [ok]   (8): QS_3|W = (1 - lambda) N(lambda) as polynomials in lambda
  [ok]   (8): det QS_3|W = (1 - lambda)^4 (1 + lambda^2)
  [ok]   det QS_3|W = -9 for lambda = omega
  [ok]   QS_3(u1^3) = (1+q)(1+q+q^2) u1^3 with q = -omega, and (1+q)(1+q+q^2) = -2 omega (1 - omega)
  [ok]   the 4x4 matrix of QS_4 printed in the paper (lambda = omega)
  [ok]   l' = (-1, 2 omega, 2 + 2 omega, 1) kills the columns, l'(v4) = 1
  [ok]   (ad_c u1)^3 (u0) is non-zero in T(V) and QS_4 kills it (lambda = omega)
  [ok]   (ad_c u1)^2 (u0) is not killed by QS_3 for lambda = omega
  [ok]   z' is a cycle and not a boundary (over Q(omega))
  [ok]   control lambda = -1, multidegree (1, 2): exact
  [ok]   control lambda = -1, multidegree (1, 3): exact
  [ok]   control lambda = zeta_6, multidegree (1, 2): exact
  [ok]   control lambda = zeta_6, multidegree (1, 3): exact
  [ok]   control lambda = zeta_12, multidegree (1, 2): exact
  [ok]   control lambda = zeta_12, multidegree (1, 3): exact

==============================================================================
PART D.  The dihedral quandle R_3: X = Z/3, sigma(x,y) = (y, 2y - x)
==============================================================================
  [ok]   bijective solution
  [ok]   non-degenerate, not involutive
  [ok]   square-free (it is a quandle)
  dim A_n (n=0..8): [1, 3, 5, 6, 6, 6, 6, 6, 6]
  [ok]   dim A_n = 1,3,5,6,6,6,6,6,6
  dim B_n (n=0..5): [1, 3, 4, 3, 1, 0]   dim K_n: [1, 3, 4, 3, 1, 0]
  [ok]   dim B_n = dim K_n = 1,3,4,3,1,0
  sigma-orbits on X^2: [[(0, 0)], [(0, 1), (1, 2), (2, 0)], [(0, 2), (2, 1), (1, 0)], [(1, 1)], [(2, 2)]]
  [ok]   orbits: three fixed pairs xx and two 3-cycles
  dim of T(V)/(orbit sums) in degrees 0..5: [1, 3, 4, 3, 1, 0]
  [ok]   the quadratic dual A^! has Hilbert series 1+3t+4t^2+3t^3+t^4
  H_A(t)H_B(-t) to t^8: [1, 0, 0, 0, 0, 0, -1, 0, 0]
  [ok]   H_A(t)H_B(-t) = 1 - t^6 + O(t^9)
  [ok]   mu_i o QS_n = 0 for n <= 5
  weight 1: dim C_n = [6, 3], homology none
  [ok]   R3 complex, weight 1
  weight 2: dim C_n = [19, 18, 4], homology none
  [ok]   R3 complex, weight 2
  weight 3: dim C_n = [42, 57, 24, 3], homology none
  [ok]   R3 complex, weight 3
  weight 4: dim C_n = [73, 126, 76, 18, 1], homology none
  [ok]   R3 complex, weight 4
  weight 5: dim C_n = [108, 219, 168, 57, 6, 0], homology none
  [ok]   R3 complex, weight 5
  weight 6: dim C_n = [144, 324, 292, 126, 19, 0, 0], homology {3: 1}
  [ok]   R3 complex, weight 6

==============================================================================
PART E.  Cyclic permutation racks Z/m (x <| y = x+1): exact dims in the eigenbasis
==============================================================================
  Z/2: H_A=[1, 2, 1, 1, 1] H_B=[1, 2, 3, 5, 8] H_K=[1, 2, 3, 5, 8]  H_A(t)H_B(-t)=[1, 0, 0, 0, 0]  first failure weight None
  [ok]   Z/2: eigenbasis dims of A agree with union-find
  [ok]   Z/2: H_A(t)H_K(-t) = 1 + O(t^5)
  [ok]   Z/2: first nonzero coefficient of H_A(t)H_B(-t) - 1 at weight None
  Z/3: H_A=[1, 3, 2, 1, 1] H_B=[1, 3, 7, 16, 33] H_K=[1, 3, 7, 16, 36]  H_A(t)H_B(-t)=[1, 0, 0, 0, -3]  first failure weight 4
  [ok]   Z/3: eigenbasis dims of A agree with union-find
  [ok]   Z/3: H_A(t)H_K(-t) = 1 + O(t^5)
  [ok]   Z/3: first nonzero coefficient of H_A(t)H_B(-t) - 1 at weight 4
  Z/4: H_A=[1, 4, 2, 1, 1] H_B=[1, 4, 14, 47, 152] H_K=[1, 4, 14, 49, 171]  H_A(t)H_B(-t)=[1, 0, 0, 2, -11]  first failure weight 3
  [ok]   Z/4: eigenbasis dims of A agree with union-find
  [ok]   Z/4: H_A(t)H_K(-t) = 1 + O(t^5)
  [ok]   Z/4: first nonzero coefficient of H_A(t)H_B(-t) - 1 at weight 3
  Z/5: H_A=[1, 5, 3, 1, 1] H_B=[1, 5, 22, 96, 407] H_K=[1, 5, 22, 96, 418]  H_A(t)H_B(-t)=[1, 0, 0, 0, -11]  first failure weight 4
  [ok]   Z/5: eigenbasis dims of A agree with union-find
  [ok]   Z/5: H_A(t)H_K(-t) = 1 + O(t^5)
  [ok]   Z/5: first nonzero coefficient of H_A(t)H_B(-t) - 1 at weight 4
  Z/6: H_A=[1, 6, 3, 1, 1] H_B=[1, 6, 33, 173, 883] H_K=[1, 6, 33, 181, 992]  H_A(t)H_B(-t)=[1, 0, 0, 8, -61]  first failure weight 3
  [ok]   Z/6: eigenbasis dims of A agree with union-find
  [ok]   Z/6: H_A(t)H_K(-t) = 1 + O(t^5)
  [ok]   Z/6: first nonzero coefficient of H_A(t)H_B(-t) - 1 at weight 3
  Z/7: H_A=[1, 7, 4, 1, 1] H_B=[1, 7, 45, 286, 1788] H_K=[1, 7, 45, 288, 1842]  H_A(t)H_B(-t)=[1, 0, 0, 2, -40]  first failure weight 3
  [ok]   Z/7: eigenbasis dims of A agree with union-find
  [ok]   Z/7: H_A(t)H_K(-t) = 1 + O(t^5)
  [ok]   Z/7: first nonzero coefficient of H_A(t)H_B(-t) - 1 at weight 3
  Z/8: H_A=[1, 8, 4, 1, 1] H_B=[1, 8, 60, 435, 3109] H_K=[1, 8, 60, 449, 3359]  H_A(t)H_B(-t)=[1, 0, 0, 14, -138]  first failure weight 3
  [ok]   Z/8: eigenbasis dims of A agree with union-find
  [ok]   Z/8: H_A(t)H_K(-t) = 1 + O(t^5)
  [ok]   Z/8: first nonzero coefficient of H_A(t)H_B(-t) - 1 at weight 3

time 12.3 s
ALL CHECKS PASSED
