The energy of a simplicial complex

The energy theorem tells that the sum over all g(x,y) is the Euler characteristic of a complex G, if g is the Green's function, the inverse of the connection matrix of G. Here is a rehearsal of 10/9/2017 for a talk on 10/10/2017. It was proven here and generalized here.
I) The notation {(12),(23),(1),(2),(3)} saves curly brackets and commas in {{1,2},{2,3},{1},{2},{3}}. II) The fact that omega(x) = i(x) is an index was understated a bit. It verifies in full generality that the Euler characteristic is invariant under Barycentric refinement G -> (V,E)=(G,{(a,b) | a subset b or b subset a}). This follows also from the eigenvector structure of the explicit Barycentric refinement operator involving Stirling numbers. III) Integral geometric approaches to Gauss-Bonnet have tradition: the Blaschke-Chern-Banchoff generation line illustrates this. I asked at various occasions what curvature we get if P is the normalized volume measure on a compact Riemannian manifold and for every x, the heat signature function y -> exp(-t L)(x,h) or the potentials y -> g(x,y) for the Green function is taken. IV) A hyperbolic structure defines a Morse cohomology. Almost by definition, Morse cohomology for the gradient flow of the dimension is simplicial cohomology of G. V) The proof of the multiplicative Poincare-Hopf formula needs the valuation argument that psi(G+x) = 0 if we glue a new cell along a complete complex. This can be analyzed by looking at the cycle structure of det(L) which is the Fredholm determinant det(1+A) of the adjacency matrix: the Fredholm determinant of the adjacency matrix of a complete graph is zero. VI) The talk mentions Boolean algebra. It is only a Boolean lattice. The fact that the class of subcomplexes does not form a Boolean algebra is a stumbling block for proving unimodularity algebraically. VII) In discrete McKean-Singer, str(L^-t))=X(G) only holds for t=1 unlike in the Hodge case, where it is a manifestation of super symmetry. The multiplicative story does not have supersymmetry. Actually, the energy is the discrepancy. VIII) There is more to discrete potential theory: the uniform measure maximizes entropy. One can look at the minimal energy mass on a subcomplex as in classical potential theory. Entropy and Euler characteristic are both natural (uniqueness theorems of Shannon for entropy and Meyer of Euler characteristic). It leads to Helmholtz free energy for which catastrophic phase transitions (blue-sky and pitchfork bifurcations) occur when changing temperature.
Below is Mathematica code computing the energy and Euler characteristic for a complex generated by a set A. The example given is the Klein bottle, a complex of Euler characteristic 0, Fermi characteristic 1 and f-vector (8,24,16). To the right, is the graph G1 whose Whitney complex is the Barycentric refinement as a complex. We think in the graph. Almost all textbooks of the 20th century treat graphs as 1-dimensional simplicial complexes. There is more to them. Graphs carry many interesting simplicial complex structures. Historically, in the Petersburg bridge problem which was the birth of graph theory, Euler introduced graphs as a model of a 2-dimensional CW complex. The point of view of topological graph theory is to see the 2-dim cells from a graph embedding. For general networks, a natural Whitney clique complex offers itself, rather than the 1-skeleton which treats a graph as a one-dimensional "curve". One can think of a simplicial complex structure on a graph in a similar way as a topological or measure theoretical or order or sheave theoretical structure on a set. If nothing is given on a graph, the most natural complex, the Whitney complex offers itself. On the other hand, given a simplicial complex or more generally a CW complex, one has a graph G1: the vertices of G1 are the sets of G, two vertices are connected, if one is contained in the other. Talking about a unit sphere in G1 is more intuitive than talking about links or other constructs introduced to the language of simplicial complexes. The fact that the Barycentric refinement of an arbitrary complex is a Whitney complex assures that one can focus on graphs.
Omega[x_]:=-(-1)^Length[x];   DJ[a_,b_]:=DisjointQ[a,b]; 
EulerChi[G_]:=Total[Map[Omega,G]];
FermiPhi[G_]:=Exp[Total[Log[Map[Omega,G]]]];
Generate[A_]:=Delete[Union[Sort[Flatten[Map[Subsets,A],1]]],1]
CL[G_]:=Table[If[DJ[G[[k]],G[[l]]],0,1],{k,Length[G]},{l,Length[G]}];
Energy[G_]:=Total[Flatten[Inverse[CL[G]]]];
A={{2,3,7},{1,2,3},{1,3,5},{1,5,7},{1,4,7},{2,4,6},{1,2,6},{1,6,0},
   {1,4,0},{2,4,0},{3,4,7},{3,4,6},{3,5,6},{5,6,0},{2,5,0},{2,5,7}};
G = Union[Map[Sort,Generate[A]]]; L = CL[G];
Print[{Det[L],FermiPhi[G]}]; Print[{Energy[G],EulerChi[G]}];
And here is a tweeted 140 Character code of the Energy computation of the example given in the talk:
L[G_]:=Table[If[DisjointQ[G[[k]],G[[l]]],0,1],{k,Length[G]},{l,Length[G]}]
X[G_]:=Total[Flatten[Inverse[L[G]]]]
X[{{1,2},{2,3},{1},{2},{3}}]
And here is self-contained demo code to "hear the Euler characteristic". Generate a random complex G, compute the number Pos of positive eigenvalues and the number Bos of even dimensional simplices. We also recompute Euler, Energy, Fermi and Fredholm:
(*"Hear the Euler characteristic of a complex", O.Knill,12/1/2017*)
Generate[A_]:=Delete[Union[Sort[Flatten[Map[Subsets,A],1]]],1]
R[n_,m_]:=Module[{A={},X=Range[n],k},Do[k:=1+Random[Integer,n-1];
  A=Append[A,Union[RandomChoice[X,k]]],{m}];Generate[A]];
G=R[10,12];n=Length[G]; Dim=Map[Length,G]-1; 
Fvector=Delete[BinCounts[Dim],1]; Vol=Total[Fvector];
L=Table[If[DisjointQ[G[[k]],G[[l]]],0,1],{k,n},{l,n}];
Pos=Length[Position[Sign[Eigenvalues[1.0*L]],1]];
Bos=Length[Position[Flatten[Map[OddQ,Map[Length,G]]],True]];
Fer=n-Bos; Euler=Bos-Fer; Fred=Det[1.0*L]; Fermi=(-1)^Fer;
Energy=Round[Total[Flatten[Inverse[1.0 L]]]];
Checks={Energy,Fred,Pos,Energy==Euler,Fred==Fermi,Pos==Bos,Vol==n}
And this is the first preparation board when organizing the talk.