File: ispoly.gi

package info (click to toggle)
gap-polenta 1.3.11-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 1,040 kB
  • sloc: xml: 720; javascript: 155; makefile: 97
file content (300 lines) | stat: -rw-r--r-- 8,499 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
#############################################################################
##
#W ispoly.gi               POLENTA package                     Bjoern Assmann
##
## Methods for testing if a rational matrix group is polycyclic
##
#Y 2005
##

#############################################################################
##
#F  POL_Logarithm( x )
##
## IN: x ..... unipotent matrix
##
##  OUT: log(x)
##
POL_Logarithm := function( x )
    local n,mat,matPow,log,i;
    n := Length( x[1] );
    mat := x - x^0;
    matPow := mat;
    log := mat;
    for i in [2..n-1] do
        matPow := matPow*mat;
        log := log + (-1)^(i-1)*(i)^-1*matPow;
    od;
    return log;
end;

#############################################################################
##
#F POL_Exponential( v )
##
## IN: v ..... matrix which is conjugated to an
##             upper or lower triangular matrix with 0's on the diagonal
##
## OUT: exp(x)
##
POL_Exponential := function( v )
    local n,exp, vPow, fac, i;
    n := Length( v[1] );
    #exp := IdentityMat(n) + v;
    exp := v^0 + v;
    vPow := v;
    #fac := 1;
    fac := v[1][1]^0;
    for i in [2..n-1] do
        vPow := vPow*v;
        fac := fac*i;
        exp := exp + (fac^-1)*vPow;
    od;
    return exp;
end;

#############################################################################
##
#F POL_CloseMatrixSpaceUnderLieBracket( V )
##
## IN:  V ....  vector space < M_nxn( Q )
##
## OUT: smallest Lie algebra containing V
##
POL_CloseMatrixSpaceUnderLieBracket := function( V )
    local basis,n,com,i,j,basis_ext, V_ext;

    basis := Basis( V );
    n := Length( basis );

    for i in [1..n] do
        for j in [i+1..n] do
            com := basis[i]*basis[j]-basis[j]*basis[i];
            if not com in V then
               basis_ext := POL_CopyVectorList( basis );
               Add( basis_ext, com );
               V_ext := VectorSpace( Rationals, basis_ext, "basis" );
               return POL_CloseMatrixSpaceUnderLieBracket( V_ext );
            fi;
        od;
    od;
    return V;
end;

#############################################################################
##
#F
##
## IN: unipo_gens ..... matrices that generate a unipotent matrix group
##
## OUT: The Lie algebra L( <unipo_gens> )
##
POL_LieAlgebra := function( unipo_gens )
    local logs,V,V_ext;

    # get logs
    logs := List( unipo_gens, POL_Logarithm );

    # compute Q-span
    V := VectorSpace( Rationals, logs );

    # close under Lie bracket
    V_ext := POL_CloseMatrixSpaceUnderLieBracket( V );

    return V_ext;
end;

#############################################################################
##
#F POL_CloseLieAlgebraUnderGrpAction( gensG, L )
##
## IN: gensG ... generators of rational matrix group G of degree n
##     L  ...... nilpotent Lie Algebra generated by matrices of degree n
##
## OUT: L^G, where G acts on L by l^g = log( exp(l)^g );
##
POL_CloseLieAlgebraUnderGrpAction := function( gensG, L )
    local basis,b,g,exp,u,l,basis_ext,V_ext,L_ext;
    basis := Basis( L );
    for b in basis do
        for g in gensG do
            exp := POL_Exponential( b );
            u := exp^g;
            l := POL_Logarithm( u );
            if not l in L then
               basis_ext := POL_CopyVectorList( basis );
               Add( basis_ext, l );
               V_ext := VectorSpace( Rationals, basis_ext, "basis" );
               L_ext := POL_CloseMatrixSpaceUnderLieBracket( V_ext );
               return POL_CloseLieAlgebraUnderGrpAction( gensG, L_ext );
            fi;
        od;
    od;
    return L;
end;

#############################################################################
##
#F
##
## IN:  L ......... Lie algebra
##      g ......... group element
##
## OUT: Induced action of g on the Lie algebra, i.e. the linear mapping
##      which maps l to log( exp(l)^g )
##
POL_InducedActionToLieAlgebra := function( g, L )
    local basis,n,inducedAction,i,exp,u,log,coeff;

    basis := Basis( L );
    n := Length( basis );
    inducedAction := [];

    for i in [1..n] do
        exp := POL_Exponential( basis[i] );
        u := exp^g;
        log := POL_Logarithm( u );
        coeff := Coefficients( basis, log );
        Add( inducedAction, coeff );
    od;
    return inducedAction;
end;

#############################################################################
##
#F POL_IsIntegerList( list )
##
##
POL_IsIntegerList := function( list )
    local z;
    for z in list do
        if not z in Integers then
            return false;
        fi;
    od;
    return true;
end;

#############################################################################
##
#F POL_IsIntegralActionOnLieAlgebra( gens, L )
##
## IN: gens ....... list of matrices
##     L ........... Lie algebra on which gens acts
##                   via l^g = Log( Exp(l)^g )
##
## OUT: returns true if for all g in gens, the minimal polynomial of
##      the induced action of  g,g^-1 to L is integral.
##      false otherwise.
##
POL_IsIntegralActionOnLieAlgebra := function( gens, L )
    local g,ind,pol,coeffs,constTerm,bool;
    Info( InfoPolenta, 3, "Testing whether action on Lie alg. is integral" );
    for g in gens do
        Info( InfoPolenta, 3, "Generator that will be induced:" );
        Info( InfoPolenta, 3, g );
        ind := POL_InducedActionToLieAlgebra( g, L );
        Info( InfoPolenta, 3, "Induced action to Lie algebra:" );
        Info(InfoPolenta, 3, ind );
        if not Trace( ind ) in Integers then
            Info( InfoPolenta, 3, "Trace not integral\n" );
            return false;
        fi;
        pol := CharacteristicPolynomial( Rationals, Rationals, ind );
        # pol := MinimalPolynomial( Rationals, ind );
        Info( InfoPolenta, 3, "Characteristic polynomial:" );
        Info(InfoPolenta, 3, pol );
        coeffs := CoefficientsOfLaurentPolynomial( pol );

        # test if pol_g in Z[x]
        if not POL_IsIntegerList( coeffs[1] ) then
            return false;
        fi;

        # test if pol_g^-1 in Z[X]
        constTerm := Value( pol, 0 );
        bool := (constTerm = 1 ) or ( constTerm = -1);
        if not bool then
           return false;
        fi;
    od;
    return true;
end;

#############################################################################
##
#F POL_IsIntegralActionOnLieAlgebra_Beals( gens, L )
##
## IN: gens ....... list of matrices
##     L ........... Lie algebra on which gens acts
##                   via l^g = Log( Exp(l)^g )
##
## OUT: returns true if for all g in gens, the minimal polynomial of
##      the induced action of  g,g^-1 to L is integral.
##      false otherwise.
##
POL_IsIntegralActionOnLieAlgebra_Beals := function( gens, L )
    local gens_ind, G_ind, lat;

    gens_ind :=  List( gens, x-> POL_InducedActionToLieAlgebra( x, L ));
    G_ind := GroupByGenerators( gens_ind );

    lat := InvariantLattice( G_ind );
    if lat = fail then
        return false;
    else
        return true;
    fi;

end;

#############################################################################
##
#F
##
## IN: gensU_p ...... normal subgroup generators for U_p
##     gensG ........ the generators of the parent group G
##     gensGU ......  representatives of pc sequence of GU
##
POL_IsFinitelgeneratedU_p := function( gensU_p, gensG, gensGU )
    local L,L_ext,isIntegral,gensU_p_mod,i,method;

    # catch trivial case G/U = 1
    if Length( gensGU ) = 0 then
       return true;
    fi;

    # catch trivial case U_p = 1
    gensU_p_mod := [];
    for i in [1..Length( gensU_p )] do
        if not gensU_p[i]=gensU_p[i]^0 then
            Add( gensU_p_mod,gensU_p[i] );
        fi;
    od;
    if Length( gensU_p_mod ) = 0 then
       return true;
    fi;

    # get Lie algebra corresponding to <gensU_p>
    L := POL_LieAlgebra( gensU_p_mod );
    Info( InfoPolenta, 3, "Dimension L: ", Dimension( L ) );

    # close it under action of G
    L_ext := POL_CloseLieAlgebraUnderGrpAction( gensG, L );
    Info( InfoPolenta, 3, "Dimension L_ext: ", Dimension( L_ext ) );
    Info( InfoPolenta, 3, "Basis of L_ext: ", Basis( L ) );

    # test whether the action of gensGU on the Lie algebra is integral
    method := "beals";
    if method = "char" then
        isIntegral := POL_IsIntegralActionOnLieAlgebra_Beals( gensG, L_ext );
    else
        isIntegral := POL_IsIntegralActionOnLieAlgebra( gensGU, L_ext );
    fi;

    return isIntegral;
end;

#############################################################################
##
#E