Pensieve header: Implementing KH, day 2.

Road map:
1. Produce all the info in a “cube of smoothings”.
2. Produce a commuting cube of vector spaces and maps between them.
3. Produce a complex.
4. Compute homology.

K[3,1]=Xm[1,4,2,5] Xm[3,6,4,1] Xm[5,2,6,3];
K[5,1]=Xm[1,6,2,7] Xm[3,8,4,9] Xm[5,10,6,1] Xm[7,2,8,3] Xm[9,4,10,5];
K[10,132]=Xm[5,12,6,13] Xm[9,16,10,17] Xm[11,6,12,7] Xm[13,20,14,1] Xm[15,18,16,19] Xm[17,10,18,11] Xm[19,14,20,15] Xp[2,8,3,7] Xp[4,2,5,1] Xp[8,4,9,3];

SetAttributes[p,Orderless];
SetAttributes[dx,Orderless];
α=0;
ϵ /: (ϵ^(n_))/; n>1 =0;
t1=Expand[
dx[]K[3,1] /. {
(Xp|Xm)[i_,j_,k_,l_] :> (++α; 
p[i,j]p[k,l]+dx[α]p[i,l]p[j,k]+ϵ e[α]X[i,j,k,l])
} /. p[i_,j_] :> p[i,j][Min[i,j]]
] //. p[i_,j_][m_]p[j_,k_][n_] :> p[i,k][Min[m,n]] /. {
X[i_,j_,k_,l_]p[i_,j_][m_]p[k_,l_][n_] :>  (c[m]c[n]->c[Min[m,n]]),
X[i_,j_,k_,l_]p[i_,l_][m_]p[j_,k_][n_] :> (c[Min[m,n]]->c[m]c[n])
}/. 
((p[i_,j_][m_])^(_.)):>c[m] //. dx[i___]dx[j___]:> dx[i,j]

(3^10)

t1 /. ϵ->0

Coefficient[t1,ϵ]

t1 /. c[i_] :>(q+1/q)

log /: log[a_]+log[b_]:=log[a b]

log[7]+log[5]

f[x_] /; x>0:= x;
f[x_] /; x<0:= (x^3);
Plot[f[x], {x,-1,1}]

{a;}

(Subscript[S, a__])[K_] := Table[
{{a}[[i]],K[[i]]},{i,1,Length[K]}
] /. {
{0,Xp[i_,j_,k_,l_] :>...},
{1, Xp} :>   ..
{0,Xm} :> ...