*****************************************************************************
*       www.FindStat.org - The Combinatorial Statistic Finder               *
*                                                                           *
*       Copyright (C) 2019 The FindStatCrew <info@findstat.org>             *
*                                                                           *
*    This information is distributed in the hope that it will be useful,    *
*    but WITHOUT ANY WARRANTY; without even the implied warranty of         *
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                   *
*****************************************************************************

-----------------------------------------------------------------------------
Statistic identifier: St001751

-----------------------------------------------------------------------------
Collection: Finite Cartan types

-----------------------------------------------------------------------------
Description: The number of proper elements in the Weyl group of a finite Cartan type.

-----------------------------------------------------------------------------
References: [1]   Balogh, József, Brewster, D., Hodges, R. Proper elements of Coxeter Groups [[arXiv:2111.15105]]

-----------------------------------------------------------------------------
Code:
@cached_function
def statistic(ct):
    return sum(1 for w in WeylGroup(ct) if is_proper(ct, w))

def is_proper(ct, w):
    ct = CartanType(ct)
    n = ct.rank()
    l = w.length()
    d = len(w.descents(side="left"))
    if ct.type() == "A":
        return l <= n + binomial(d + 1, 2)
    if ct.type() in ["B", "C"]:
        return l <= n + d^2
    if ct.type() == "D":
        if d > 3:
            return l <= n + d^2 - d
        return l <= binomial(d + 1, 2)
    if ct.type() == "E":
        m = [0, 1, 3, 6, 12, 20, 36, 63, 120]
        return l <= n + m[d]
    if ct.type() == "F":
        m = [0, 1, 4, 9, 24]
        return l <= n + m[d]
    if ct.type() == "G": # = I_2(6)
        if d == 2:
            return l <= 6 + n
        if d < 2:
            return l <= 2 + d


-----------------------------------------------------------------------------
Statistic values:

['A',1] => 2
['A',2] => 6
['B',2] => 8
['G',2] => 8
['A',3] => 24
['B',3] => 38
['C',3] => 38
['A',4] => 115
['B',4] => 237
['C',4] => 237
['D',4] => 26
['F',4] => 297
['A',5] => 631
['B',5] => 1813
['C',5] => 1813
['D',5] => 229
['A',6] => 3907
['B',6] => 16981
['C',6] => 16981
['D',6] => 4143
['E',6] => 10690
['E',7] => 159368
['E',8] => 4854344

-----------------------------------------------------------------------------
Created: Dec 02, 2021 at 12:26 by Martin Rubey

-----------------------------------------------------------------------------
Last Updated: Dec 02, 2021 at 12:26 by Martin Rubey