Skip to content

Incidence Algebras ​

The incidence algebra of a finite poset PP has a basis indexed by its intervals — the pairs x≤yx ≤ y — and a product that is composition:

e[x,y]⋅e[u,z]={e[x,z]y=u0otherwisee_{[x,y]} \cdot e_{[u,z]} = \begin{cases} e_{[x,z]} & y = u \\ 0 & \text{otherwise}\end{cases}

Composable intervals compose; non-composable ones annihilate. That makes this the first family here whose product is usually zero — an honest annihilation, not a refusal to answer.

The point is the Möbius function ​

The zeta function ζ(x,y)=1ζ(x,y) = 1 on every interval is an element of this algebra, and because a poset can be listed in a linear extension, ζζ is upper-triangular with ones on the diagonal — so it is invertible over the integers. Its inverse is the Möbius function μμ, defined by the recursion that inverting forces:

μ(x,x)=1,μ(x,y)=−∑x≤z<yμ(x,z).μ(x,x) = 1, \qquad μ(x,y) = -\sum_{x ≤ z < y} μ(x,z).

That single fact — ζ∗μ=δζ * μ = δ — is Möbius inversion, and it is the test the whole package rests on, checked as a matrix identity on every poset here.

What makes it worth building is that specialising the poset recovers classical theorems.

The divisor lattice is number theory ​

Order the divisors of nn by divisibility, and the poset Möbius function of [a,b][a,b] is exactly the classical μ(b/a)μ(b/a) — zero when a square divides it, (−1)k(-1)^k otherwise. Number theory's Möbius function is not an analogy here; it is this one, on this poset.

μ on the divisors

30 = 2·3·5 is squarefree with three primes, so μ = −1. 12 is divisible by 4, so μ = 0.

InMoebiusFunction(DivisorLattice(30),1,30)\mathrm{MoebiusFunction}(\mathrm{DivisorLattice}(30), 1, 30)Out−1-1InMoebiusFunction(DivisorLattice(12),1,12)\mathrm{MoebiusFunction}(\mathrm{DivisorLattice}(12), 1, 12)Out00InMoebiusFunction(DivisorLattice(30),5,30)\mathrm{MoebiusFunction}(\mathrm{DivisorLattice}(30), 5, 30)Out11
source · editable

The tests check this against an independently written classical μμ for every interval of D(12)D(12), D(30)D(30), D(36)D(36), D(60)D(60) and D(210)D(210).

The Boolean lattice is inclusion–exclusion ​

Order subsets of {1,…,n}\{1,\ldots,n\} by inclusion and μ([S,T])=(−1)∣T∖S∣μ([S,T]) = (-1)^{|T ∖ S|}. Möbius inversion over this poset is the inclusion–exclusion principle — the alternating signs everyone writes by hand are the Möbius function of the Boolean lattice.

μ on subsets

Three elements added, so (−1)³. Adding two gives +1.

InMoebiusFunction(BooleanLattice(3),[],[1,2,3])\mathrm{MoebiusFunction}(\mathrm{BooleanLattice}(3), \bigl\lbrack\bigr\rbrack, \bigl\lbrack1, 2, 3\bigr\rbrack)Out−1-1InMoebiusFunction(BooleanLattice(3),[],[1,2])\mathrm{MoebiusFunction}(\mathrm{BooleanLattice}(3), \bigl\lbrack\bigr\rbrack, \bigl\lbrack1, 2\bigr\rbrack)Out11InMoebiusFunction(BooleanLattice(3),[1],[1,2,3])\mathrm{MoebiusFunction}(\mathrm{BooleanLattice}(3), \bigl\lbrack1\bigr\rbrack, \bigl\lbrack1, 2, 3\bigr\rbrack)Out11
source · editable

Inversion, both ways ​

PosetSumDown computes g(y)=∑x≤yf(x)g(y) = \sum_{x ≤ y} f(x); MoebiusInvert undoes it. The two are inverse on every poset here, which is the theorem in executable form.

Möbius inversion

Sum down the chain, then invert: the original comes back. On a chain the inversion is just first differences.

InPosetSumDown(Chain(4),[1,2,3,4])\mathrm{PosetSumDown}(\mathrm{Chain}(4), \bigl\lbrack1, 2, 3, 4\bigr\rbrack)Out[1,3,6,10]\bigl\lbrack1, 3, 6, 10\bigr\rbrackInMoebiusInvert(Chain(4),PosetSumDown(Chain(4),[1,2,3,4]))\mathrm{MoebiusInvert}(\mathrm{Chain}(4), \mathrm{PosetSumDown}(\mathrm{Chain}(4), \bigl\lbrack1, 2, 3, 4\bigr\rbrack))Out[1,2,3,4]\bigl\lbrack1, 2, 3, 4\bigr\rbrack
source · editable

Dimension counts intervals ​

How big is the algebra?

A chain on n has C(n+1,2) intervals; the Boolean lattice on n has 3ⁿ — for each element, it is in S, in T\S, or in neither.

InAlgebraDimension(IncidenceAlgebra(Chain(4)))\mathrm{AlgebraDimension}(\mathrm{IncidenceAlgebra}(\mathrm{Chain}(4)))Out1010InAlgebraDimension(IncidenceAlgebra(BooleanLattice(3)))\mathrm{AlgebraDimension}(\mathrm{IncidenceAlgebra}(\mathrm{BooleanLattice}(3)))Out2727InAlgebraDimension(IncidenceAlgebra(DivisorLattice(12)))\mathrm{AlgebraDimension}(\mathrm{IncidenceAlgebra}(\mathrm{DivisorLattice}(12)))Out1818
source · editable

Things worth knowing ​

The linear extension is load-bearing, and it is easy to get wrong. Elements are stored so that i≤ji ≤ j whenever element i≤i ≤ element jj; that is what makes ζζ triangular and therefore invertible over ℤ. Sorting with "is a≤ba ≤ b?" as a comparator does not produce one — on a genuine partial order that comparator is not transitive, and DivisorLattice(60) came out with 12 before 3. Sorting by how many elements lie below each one does work, because x<yx < y forces a strictly larger down-set.

Posets available: Chain(n), BooleanLattice(n) (elements are subsets), DivisorLattice(n) (elements are divisors). The element type differs per poset, and each one reads and prints its own.

Not built yet. The partition lattice — whose Möbius function is (−1)k−1(k−1)!(-1)^{k-1}(k-1)!, and which would connect this page to the diagram algebras and set partitions. Also the characteristic polynomial, and general element arithmetic: only the interval basis and the two named functions ζζ and μμ are here, not arbitrary elements of the algebra.