OrderTypes[3]

?OrderTypes

diag=Diag[ar[5,4],ar[6,3],ar[7,1],ar[8,2]]

p=Times @@ (diag /. ar[i_,j_] :>eq[i,j-1]eq[i-1, j]ltheq[i-1, i]);
While[!FreeQ[p, eq],
p = (p 
/. Cases[p, eq[i_, j_]:> (i->j), Infinity, 1]
/. {
eq[i_,i_] -> 1,
ltheq[i_, i_] ->1/2
}
)
]

p

l=Length[indices=Union@@ Cases[{p}, ltheq[i_, j_] :> {i, j}, Infinity]]

indices

ineqs= p /. e_ltheq :> (e /. Thread[indices -> Range[l]])

Expand[Plus @@ (Times[
ineqs /. ltheq[i_, j_] :> Switch[
Order[#[[i]],#[[j]]],
1, 1,
0, 1/2,
-1, 0
],
Binomial[n, Max[#]]
]& /@ OrderTypes[l])]

Wgl[diag]