*****************************************************************************
*       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: St000949

-----------------------------------------------------------------------------
Collection: Dyck paths

-----------------------------------------------------------------------------
Description: Gives the number of generalised tilting modules of the corresponding LNakayama algebra.

-----------------------------------------------------------------------------
References: [1]   [[https://en.wikipedia.org/wiki/Tilting_theory]]

-----------------------------------------------------------------------------
Code:
gap('LoadPackage("QPA");')

def NthRadical(M, n):
    if n == 0:
        f = gap.IdentityMapping(M)
    else:
        f = gap.RadicalOfModuleInclusion(M)
        N = gap.Source(f)
        for i in range(n-1):
            h = gap.RadicalOfModuleInclusion(N);
            N = gap.Source(h)
            f = h * f
    return f

def ARQuiverNak(A):
    injA = gap.IndecInjectiveModules(A)
    L = [gap.Source(NthRadical(inj, j))
         for inj in injA
         for j in range(gap.Dimension(inj).sage())]
    return L

def kupisch(D):
    """
    sage: [kupisch(D) for D in DyckWords(3)]
    [[2, 2, 2, 1], [2, 3, 2, 1], [3, 2, 2, 1], [3, 3, 2, 1], [4, 3, 2, 1]]

    sage: all(kupisch(D) == [a+2 for a in D.reverse().to_area_sequence()[::-1]] + [1] for D in DyckWords(5))
    """
    H = D.heights()
    return [1+H[i] for i, s in enumerate(D) if s == 0]+[1]

def statistic(D):
    D = DyckWord(D)
    K = kupisch(D)
    A = gap.NakayamaAlgebra(K, gap.GF(3))
    g = gap.GlobalDimensionOfAlgebra(A,30)
    L = ARQuiverNak(A)
    LL = [x for x in L
          if not gap.IsProjectiveModule(x) or not gap.IsInjectiveModule(x)]
    r = len(gap.SimpleModules(A)) - (len(L) - len(LL))
    S = [[LL[i-1] for i in s] for s in Subsets(len(LL), r)]
    return sum(1 for x in S
               if gap.N_RigidModule(gap.DirectSumOfQPAModules(x) , g))


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

[1,0]                 => 2
[1,0,1,0]             => 3
[1,1,0,0]             => 5
[1,0,1,0,1,0]         => 4
[1,0,1,1,0,0]         => 7
[1,1,0,0,1,0]         => 7
[1,1,0,1,0,0]         => 9
[1,1,1,0,0,0]         => 14
[1,0,1,0,1,0,1,0]     => 5
[1,0,1,0,1,1,0,0]     => 9
[1,0,1,1,0,0,1,0]     => 10
[1,0,1,1,0,1,0,0]     => 11
[1,0,1,1,1,0,0,0]     => 19
[1,1,0,0,1,0,1,0]     => 9
[1,1,0,0,1,1,0,0]     => 16
[1,1,0,1,0,0,1,0]     => 11
[1,1,0,1,0,1,0,0]     => 15
[1,1,0,1,1,0,0,0]     => 23
[1,1,1,0,0,0,1,0]     => 19
[1,1,1,0,0,1,0,0]     => 23
[1,1,1,0,1,0,0,0]     => 28
[1,1,1,1,0,0,0,0]     => 42
[1,0,1,0,1,0,1,0,1,0] => 6
[1,0,1,0,1,0,1,1,0,0] => 11
[1,0,1,0,1,1,0,0,1,0] => 13
[1,0,1,0,1,1,0,1,0,0] => 13
[1,0,1,0,1,1,1,0,0,0] => 24
[1,0,1,1,0,0,1,0,1,0] => 13
[1,0,1,1,0,0,1,1,0,0] => 23
[1,0,1,1,0,1,0,0,1,0] => 13
[1,0,1,1,0,1,0,1,0,0] => 18
[1,0,1,1,0,1,1,0,0,0] => 27
[1,0,1,1,1,0,0,0,1,0] => 26
[1,0,1,1,1,0,0,1,0,0] => 32
[1,0,1,1,1,0,1,0,0,0] => 33
[1,0,1,1,1,1,0,0,0,0] => 56
[1,1,0,0,1,0,1,0,1,0] => 11
[1,1,0,0,1,0,1,1,0,0] => 20
[1,1,0,0,1,1,0,0,1,0] => 23
[1,1,0,0,1,1,0,1,0,0] => 24
[1,1,0,0,1,1,1,0,0,0] => 43
[1,1,0,1,0,0,1,0,1,0] => 13
[1,1,0,1,0,0,1,1,0,0] => 24
[1,1,0,1,0,1,0,0,1,0] => 18
[1,1,0,1,0,1,0,1,0,0] => 22
[1,1,0,1,0,1,1,0,0,0] => 37
[1,1,0,1,1,0,0,0,1,0] => 32
[1,1,0,1,1,0,0,1,0,0] => 32
[1,1,0,1,1,0,1,0,0,0] => 43
[1,1,0,1,1,1,0,0,0,0] => 66
[1,1,1,0,0,0,1,0,1,0] => 24
[1,1,1,0,0,0,1,1,0,0] => 43
[1,1,1,0,0,1,0,0,1,0] => 27
[1,1,1,0,0,1,0,1,0,0] => 37
[1,1,1,0,0,1,1,0,0,0] => 57
[1,1,1,0,1,0,0,0,1,0] => 33
[1,1,1,0,1,0,0,1,0,0] => 43
[1,1,1,0,1,0,1,0,0,0] => 52
[1,1,1,0,1,1,0,0,0,0] => 76
[1,1,1,1,0,0,0,0,1,0] => 56
[1,1,1,1,0,0,0,1,0,0] => 66
[1,1,1,1,0,0,1,0,0,0] => 76
[1,1,1,1,0,1,0,0,0,0] => 90
[1,1,1,1,1,0,0,0,0,0] => 132

-----------------------------------------------------------------------------
Created: Aug 25, 2017 at 10:52 by Rene Marczinzik

-----------------------------------------------------------------------------
Last Updated: Aug 25, 2020 at 15:00 by Martin Rubey