-
Notifications
You must be signed in to change notification settings - Fork 113
/
lattices_with_isometry.jl
2394 lines (1956 loc) · 69.2 KB
/
lattices_with_isometry.jl
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
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
###############################################################################
#
# Accessors
#
###############################################################################
@doc raw"""
lattice(Lf::ZZLatWithIsom) -> ZZLat
Given a lattice with isometry $(L, f)$, return the underlying lattice $L$.
# Examples
```jldoctest
julia> L = root_lattice(:A,5);
julia> Lf = integer_lattice_with_isometry(L; neg=true);
julia> lattice(Lf) === L
true
```
"""
lattice(Lf::ZZLatWithIsom) = Lf.Lb
@doc raw"""
isometry(Lf::ZZLatWithIsom) -> QQMatrix
Given a lattice with isometry $(L, f)$, return the underlying isometry $f$.
# Examples
```jldoctest
julia> L = root_lattice(:A,5);
julia> Lf = integer_lattice_with_isometry(L; neg=true);
julia> isometry(Lf)
[-1 0 0 0 0]
[ 0 -1 0 0 0]
[ 0 0 -1 0 0]
[ 0 0 0 -1 0]
[ 0 0 0 0 -1]
```
"""
isometry(Lf::ZZLatWithIsom) = Lf.f
@doc raw"""
ambient_space(Lf::ZZLatWithIsom) -> QuadSpaceWithIsom
Given a lattice with isometry $(L, f)$, return the pair $(V, g)$ where
$V$ is the ambient quadratic space of $L$ and $g$ is an isometry of $V$
inducing $f$ on $L$.
Note that $g$ might not be unique and we fix such a global isometry
together with $V$ into a container type `QuadSpaceWithIsom`.
# Examples
```jldoctest
julia> L = root_lattice(:A,5);
julia> Lf = integer_lattice_with_isometry(L; neg=true);
julia> Vf = ambient_space(Lf)
Quadratic space of dimension 5
with isometry of finite order 2
given by
[-1 0 0 0 0]
[ 0 -1 0 0 0]
[ 0 0 -1 0 0]
[ 0 0 0 -1 0]
[ 0 0 0 0 -1]
julia> typeof(Vf)
QuadSpaceWithIsom
```
"""
ambient_space(Lf::ZZLatWithIsom) = Lf.Vf
@doc raw"""
ambient_isometry(Lf::ZZLatWithIsom) -> QQMatrix
Given a lattice with isometry $(L, f)$, return an isometry of the ambient
space of $L$ inducing $f$ on $L$.
# Examples
```jldoctest
julia> L = root_lattice(:A,5);
julia> Lf = integer_lattice_with_isometry(L; neg=true);
julia> ambient_isometry(Lf)
[-1 0 0 0 0]
[ 0 -1 0 0 0]
[ 0 0 -1 0 0]
[ 0 0 0 -1 0]
[ 0 0 0 0 -1]
```
"""
ambient_isometry(Lf::ZZLatWithIsom) = isometry(ambient_space(Lf))
@doc raw"""
order_of_isometry(Lf::ZZLatWithIsom) -> IntExt
Given a lattice with isometry $(L, f)$, return the order of the underlying
isometry $f$.
# Examples
```jldoctest
julia> L = root_lattice(:A,5);
julia> Lf = integer_lattice_with_isometry(L; neg=true);
julia> order_of_isometry(Lf) == 2
true
```
"""
order_of_isometry(Lf::ZZLatWithIsom) = Lf.n
###############################################################################
#
# Attributes
#
###############################################################################
@doc raw"""
rank(Lf::ZZLatWithIsom) -> Integer
Given a lattice with isometry $(L, f)$, return the rank of the underlying lattice
$L$.
# Examples
```jldoctest
julia> L = root_lattice(:A,5);
julia> Lf = integer_lattice_with_isometry(L; neg=true);
julia> rank(Lf)
5
```
"""
rank(Lf::ZZLatWithIsom) = rank(lattice(Lf))
@doc raw"""
characteristic_polynomial(Lf::ZZLatWithIsom) -> QQPolyRingElem
Given a lattice with isometry $(L, f)$, return the characteristic polynomial of the
underlying isometry $f$.
# Examples
```jldoctest
julia> L = root_lattice(:A,5);
julia> Lf = integer_lattice_with_isometry(L; neg=true);
julia> factor(characteristic_polynomial(Lf))
1 * (x + 1)^5
```
"""
characteristic_polynomial(Lf::ZZLatWithIsom) = characteristic_polynomial(isometry(Lf))
@doc raw"""
minimal_polynomial(Lf::ZZLatWithIsom) -> QQPolyRingElem
Given a lattice with isometry $(L, f)$, return the minimal polynomial of the
underlying isometry $f$.
# Examples
```jldoctest
julia> L = root_lattice(:A,5);
julia> Lf = integer_lattice_with_isometry(L; neg=true);
julia> minimal_polynomial(Lf)
x + 1
```
"""
minimal_polynomial(Lf::ZZLatWithIsom) = minimal_polynomial(isometry(Lf))
@doc raw"""
genus(Lf::ZZLatWithIsom) -> ZZGenus
Given a lattice with isometry $(L, f)$, return the genus of the underlying
lattice $L$.
# Examples
```jldoctest
julia> L = root_lattice(:A,5);
julia> Lf = integer_lattice_with_isometry(L; neg=true);
julia> genus(Lf)
Genus symbol for integer lattices
Signatures: (5, 0, 0)
Local symbols:
Local genus symbol at 2: 1^-4 2^1_7
Local genus symbol at 3: 1^-4 3^1
```
"""
genus(Lf::ZZLatWithIsom) = genus(lattice(Lf))
@doc raw"""
basis_matrix(Lf::ZZLatWithIsom) -> QQMatrix
Given a lattice with isometry $(L, f)$, return the basis matrix of the underlying
lattice $L$.
# Examples
```jldoctest
julia> L = root_lattice(:A,5);
julia> f = matrix(QQ,5,5,[ 1 0 0 0 0;
-1 -1 -1 -1 -1;
0 0 0 0 1;
0 0 0 1 0;
0 0 1 0 0])
[ 1 0 0 0 0]
[-1 -1 -1 -1 -1]
[ 0 0 0 0 1]
[ 0 0 0 1 0]
[ 0 0 1 0 0]
julia> Lf = integer_lattice_with_isometry(L, f);
julia> I = invariant_lattice(Lf);
julia> basis_matrix(I)
[1 0 0 0 0]
[0 0 1 0 1]
[0 0 0 1 0]
```
"""
basis_matrix(Lf::ZZLatWithIsom) = basis_matrix(lattice(Lf))
@doc raw"""
gram_matrix(Lf::ZZLatWithIsom) -> QQMatrix
Given a lattice with isometry $(L, f)$, return the gram matrix of the underlying
lattice $L$ with respect to its basis matrix.
# Examples
```jldoctest
julia> L = root_lattice(:A,5);
julia> Lf = integer_lattice_with_isometry(L);
julia> gram_matrix(Lf)
[ 2 -1 0 0 0]
[-1 2 -1 0 0]
[ 0 -1 2 -1 0]
[ 0 0 -1 2 -1]
[ 0 0 0 -1 2]
```
"""
gram_matrix(Lf::ZZLatWithIsom) = gram_matrix(lattice(Lf))
@doc raw"""
rational_span(Lf::ZZLatWithIsom) -> QuadSpaceWithIsom
Given a lattice with isometry $(L, f)$, return the rational span
$L \otimes \mathbb{Q}$ of the underlying lattice $L$ together with the
underlying isometry of $L$.
# Examples
```jldoctest
julia> L = root_lattice(:A,5);
julia> Lf = integer_lattice_with_isometry(L);
julia> Vf = rational_span(Lf)
Quadratic space of dimension 5
with isometry of finite order 1
given by
[1 0 0 0 0]
[0 1 0 0 0]
[0 0 1 0 0]
[0 0 0 1 0]
[0 0 0 0 1]
julia> typeof(Vf)
QuadSpaceWithIsom
```
"""
rational_span(Lf::ZZLatWithIsom) = quadratic_space_with_isometry(rational_span(lattice(Lf)), isometry(Lf))
@doc raw"""
det(Lf::ZZLatWithIsom) -> QQFieldElem
Given a lattice with isometry $(L, f)$, return the determinant of the
underlying lattice $L$.
# Examples
```jldoctest
julia> L = root_lattice(:A,5);
julia> Lf = integer_lattice_with_isometry(L);
julia> det(Lf)
6
```
"""
det(Lf::ZZLatWithIsom) = det(lattice(Lf))
@doc raw"""
scale(Lf::ZZLatWithIsom) -> QQFieldElem
Given a lattice with isometry $(L, f)$, return the scale of the underlying
lattice $L$.
# Examples
```jldoctest
julia> L = root_lattice(:A,5);
julia> Lf = integer_lattice_with_isometry(L);
julia> scale(Lf)
1
```
"""
scale(Lf::ZZLatWithIsom) = scale(lattice(Lf))
@doc raw"""
norm(Lf::ZZLatWithIsom) -> QQFieldElem
Given a lattice with isometry $(L, f)$, return the norm of the underlying
lattice $L$.
# Examples
```jldoctest
julia> L = root_lattice(:A,5);
julia> Lf = integer_lattice_with_isometry(L);
julia> norm(Lf)
2
```
"""
norm(Lf::ZZLatWithIsom) = norm(lattice(Lf))
@doc raw"""
is_positive_definite(Lf::ZZLatWithIsom) -> Bool
Given a lattice with isometry $(L, f)$, return whether the underlying
lattice $L$ is positive definite.
# Examples
```jldoctest
julia> L = root_lattice(:A,5);
julia> Lf = integer_lattice_with_isometry(L);
julia> is_positive_definite(Lf)
true
```
"""
is_positive_definite(Lf::ZZLatWithIsom) = is_positive_definite(lattice(Lf))
@doc raw"""
is_negative_definite(Lf::ZZLatWithIsom) -> Bool
Given a lattice with isometry $(L, f)$, return whether the underlying
lattice $L$ is negative definite.
# Examples
```jldoctest
julia> L = root_lattice(:A,5);
julia> Lf = integer_lattice_with_isometry(L);
julia> is_negative_definite(Lf)
false
```
"""
is_negative_definite(Lf::ZZLatWithIsom) = is_negative_definite(lattice(Lf))
@doc raw"""
is_definite(Lf::ZZLatWithIsom) -> Bool
Given a lattice with isometry $(L, f)$, return whether the underlying
lattice $L$ is definite.
# Examples
```jldoctest
julia> L = root_lattice(:A,5);
julia> Lf = integer_lattice_with_isometry(L);
julia> is_definite(Lf)
true
```
"""
is_definite(Lf::ZZLatWithIsom) = is_definite(lattice(Lf))
@doc raw"""
minimum(Lf::ZZLatWithIsom) -> QQFieldElem
Given a positive definite lattice with isometry $(L, f)$, return the minimum
of the underlying lattice $L$.
# Examples
```jldoctest
julia> L = root_lattice(:A,5);
julia> Lf = integer_lattice_with_isometry(L);
julia> minimum(Lf)
2
```
"""
function minimum(Lf::ZZLatWithIsom)
@req is_definite(Lf) "Underlying lattice must be definite"
return minimum(lattice(Lf))
end
@doc raw"""
is_integral(Lf::ZZLatWithIsom) -> Bool
Given a lattice with isometry $(L, f)$, return whether the underlying lattice
$L$ is integral.
# Examples
```jldoctest
julia> L = root_lattice(:A,5);
julia> Lf = integer_lattice_with_isometry(L);
julia> is_integral(Lf)
true
```
"""
is_integral(Lf::ZZLatWithIsom) = is_integral(lattice(Lf))
@doc raw"""
degree(Lf::ZZLatWithIsom) -> Int
Given a lattice with isometry $(L, f)$, return the degree of the underlying
lattice $L$.
# Examples
```jldoctest
julia> L = root_lattice(:A,5);
julia> Lf = integer_lattice_with_isometry(L);
julia> degree(Lf)
5
```
"""
degree(Lf::ZZLatWithIsom) = degree(lattice(Lf))
@doc raw"""
is_even(Lf::ZZLatWithIsom) -> Bool
Given a lattice with isometry $(L, f)$, return whether the underlying lattice
$L$ is even.
# Examples
```jldoctest
julia> L = root_lattice(:A,5);
julia> Lf = integer_lattice_with_isometry(L);
julia> is_even(Lf)
true
```
"""
is_even(Lf::ZZLatWithIsom) = iseven(lattice(Lf))
@doc raw"""
discriminant(Lf::ZZLatWithIsom) -> QQFieldElem
Given a lattice with isometry $(L, f)$, return the discriminant of the underlying
lattice $L$.
# Examples
```jldoctest
julia> L = root_lattice(:A,5);
julia> Lf = integer_lattice_with_isometry(L);
julia> discriminant(Lf) == det(Lf) == 6
true
```
"""
discriminant(Lf::ZZLatWithIsom) = discriminant(lattice(Lf))
@doc raw"""
signature_tuple(Lf::ZZLatWithIsom) -> Tuple{Int, Int, Int}
Given a lattice with isometry $(L, f)$, return the signature tuple of the
underlying lattice $L$.
# Examples
```jldoctest
julia> L = root_lattice(:A,5);
julia> Lf = integer_lattice_with_isometry(L);
julia> signature_tuple(Lf)
(5, 0, 0)
```
"""
signature_tuple(Lf::ZZLatWithIsom) = signature_tuple(lattice(Lf))
@doc raw"""
is_primary_with_prime(Lf::ZZLatWithIsom) -> Bool, ZZRingElem
Given a lattice with isometry $(L, f)$, return whether $L$ is primary,
that is whether $L$ is integral and its discriminant group is a
$p$-group for some prime number $p$. In case it is, $p$ is also returned as
second output.
Note that for unimodular lattices, this function returns `(true, 1)`. If the
lattice is not primary, the second return value is `-1` by default.
# Examples
```jldoctest
julia> L = root_lattice(:A, 5);
julia> Lf = integer_lattice_with_isometry(L);
julia> is_primary_with_prime(Lf)
(false, -1)
julia> genus(Lf)
Genus symbol for integer lattices
Signatures: (5, 0, 0)
Local symbols:
Local genus symbol at 2: 1^-4 2^1_7
Local genus symbol at 3: 1^-4 3^1
```
"""
is_primary_with_prime(Lf::ZZLatWithIsom) = is_primary_with_prime(lattice(Lf))
@doc raw"""
is_primary(Lf::ZZLatWithIsom, p::IntegerUnion) -> Bool
Given a lattice with isometry $(L, f)$ and a prime number $p$,
return whether $L$ is $p$-primary, that is whether its discriminant group
is a $p$-group.
# Examples
```jldoctest
julia> L = root_lattice(:A, 6);
julia> Lf = integer_lattice_with_isometry(L);
julia> is_primary(Lf, 7)
true
julia> genus(Lf)
Genus symbol for integer lattices
Signatures: (6, 0, 0)
Local symbols:
Local genus symbol at 2: 1^6
Local genus symbol at 7: 1^-5 7^-1
```
"""
is_primary(Lf::ZZLatWithIsom, p::IntegerUnion) = is_primary(lattice(Lf), p)
@doc raw"""
is_unimodular(Lf::ZZLatWithIsom) -> Bool
Given a lattice with isometry $(L, f)$, return whether `$L$ is unimodular,
that is whether its discriminant group is trivial.
# Examples
```jldoctest
julia> L = root_lattice(:E, 8);
julia> Lf = integer_lattice_with_isometry(L);
julia> is_unimodular(Lf)
true
julia> genus(Lf)
Genus symbol for integer lattices
Signatures: (8, 0, 0)
Local symbol:
Local genus symbol at 2: 1^8
```
"""
is_unimodular(Lf::ZZLatWithIsom) = is_unimodular(lattice(Lf))
@doc raw"""
is_elementary_with_prime(Lf::ZZLatWithIsom) -> Bool, ZZRingElem
Given a lattice with isometry $(L, f)$, return whether $L$ is elementary, that is
whether $L$ is integral and its discriminant group is an elemenentary $p$-group for
some prime number $p$. In case it is, $p$ is also returned as second output.
Note that for unimodular lattices, this function returns `(true, 1)`. If the lattice
is not elementary, the second return value is `-1` by default.
# Examples
```jldoctest
julia> L = root_lattice(:A, 7);
julia> Lf = integer_lattice_with_isometry(L);
julia> is_elementary_with_prime(Lf)
(false, -1)
julia> is_primary(Lf, 2)
true
julia> genus(Lf)
Genus symbol for integer lattices
Signatures: (7, 0, 0)
Local symbol:
Local genus symbol at 2: 1^6 8^1_7
```
"""
is_elementary_with_prime(Lf::ZZLatWithIsom) = is_elementary_with_prime(lattice(Lf))
@doc raw"""
is_elementary(Lf::ZZLatWithIsom, p::IntegerUnion) -> Bool
Given a lattice with isometry $(L, f)$ and a prime number $p$, return whether
$L$ is $p$-elementary, that is whether its discriminant group is an elementary
$p$-group.
# Examples
```jldoctest
julia> L = root_lattice(:E, 7);
julia> Lf = integer_lattice_with_isometry(L);
julia> is_elementary(Lf, 3)
false
julia> is_elementary(Lf, 2)
true
julia> genus(Lf)
Genus symbol for integer lattices
Signatures: (7, 0, 0)
Local symbol:
Local genus symbol at 2: 1^6 2^1_7
```
"""
is_elementary(Lf::ZZLatWithIsom, p::IntegerUnion) = is_elementary(lattice(Lf), p)
###############################################################################
#
# Constructors
#
###############################################################################
@doc raw"""
integer_lattice_with_isometry(L::ZZLat, f::QQMatrix; check::Bool = true,
ambient_representation = true)
-> ZZLatWithIsom
Given a $\mathbb Z$-lattice $L$ and a matrix $f$, if $f$ defines an isometry
of $L$ of order $n$, return the corresponding lattice with isometry pair $(L, f)$.
If `ambient_representation` is set to `true`, $f$ is consider as an isometry of
the ambient space of $L$ and the induced isometry on $L$ is automatically
computed as long as $f$ preserves $L$.
Otherwise, an isometry of the ambient space of $L$ is constructed, setting the
identity on the complement of the rational span of $L$ if it is not of full rank.
# Examples
The way we construct the lattice can have an influence on the isometry of the
ambient space we store. Indeed, if one mentions an isometry of the lattice,
this isometry will be extended by the identity on the orthogonal complement
of the rational span of the lattice. In the following example, `Lf` and `Lf2` are
the same object, but the isometry of their ambient space stored are
different (one has order 2, the other one is the identity).
```jldoctest
julia> B = matrix(QQ, 3, 5, [1 0 0 0 0;
0 0 1 0 1;
0 0 0 1 0]);
julia> G = matrix(QQ, 5, 5, [ 2 -1 0 0 0;
-1 2 -1 0 0;
0 -1 2 -1 0;
0 0 -1 2 -1;
0 0 0 -1 2]);
julia> L = integer_lattice(B; gram = G);
julia> f = matrix(QQ, 5, 5, [ 1 0 0 0 0;
-1 -1 -1 -1 -1;
0 0 0 0 1;
0 0 0 1 0;
0 0 1 0 0]);
julia> Lf = integer_lattice_with_isometry(L, f)
Integer lattice of rank 3 and degree 5
with isometry of finite order 1
given by
[1 0 0]
[0 1 0]
[0 0 1]
julia> ambient_isometry(Lf)
[ 1 0 0 0 0]
[-1 -1 -1 -1 -1]
[ 0 0 0 0 1]
[ 0 0 0 1 0]
[ 0 0 1 0 0]
julia> Lf2 = integer_lattice_with_isometry(L, isometry(Lf); ambient_representation=false)
Integer lattice of rank 3 and degree 5
with isometry of finite order 1
given by
[1 0 0]
[0 1 0]
[0 0 1]
julia> ambient_isometry(Lf2)
[1 0 0 0 0]
[0 1 0 0 0]
[0 0 1 0 0]
[0 0 0 1 0]
[0 0 0 0 1]
```
"""
function integer_lattice_with_isometry(L::ZZLat, f::QQMatrix; check::Bool = true,
ambient_representation::Bool = true)
if rank(L) == 0
Vf = quadratic_space_with_isometry(ambient_space(L))
return ZZLatWithIsom(Vf, L, matrix(QQ,0,0,[]), -1)
end
if check
@req det(f) != 0 "f is not invertible"
end
if ambient_representation
f_ambient = f
Vf = quadratic_space_with_isometry(ambient_space(L), f_ambient; check)
B = basis_matrix(L)
ok, f = can_solve_with_solution(B, B*f_ambient; side = :left)
@req ok "Isometry does not preserve the lattice"
else
V = ambient_space(L)
B = basis_matrix(L)
B2 = orthogonal_complement(V, B)
C = vcat(B, B2)
f_ambient = block_diagonal_matrix(QQMatrix[f, identity_matrix(QQ, nrows(B2))])
f_ambient = inv(C)*f_ambient*C
Vf = quadratic_space_with_isometry(V, f_ambient; check)
end
n = multiplicative_order(f)
if check
@req f*gram_matrix(L)*transpose(f) == gram_matrix(L) "f does not define an isometry of L"
@hassert :ZZLatWithIsom 1 basis_matrix(L)*f_ambient == f*basis_matrix(L)
end
return ZZLatWithIsom(Vf, L, f, n)
end
@doc raw"""
integer_lattice_with_isometry(L::ZZLat; neg::Bool = false) -> ZZLatWithIsom
Given a $\mathbb Z$-lattice $L$ return the lattice with isometry pair $(L, f)$,
where $f$ corresponds to the identity mapping of $L$.
If `neg` is set to `true`, then the isometry $f$ is negative the identity of $L$.
# Examples
```jldoctest
julia> L = root_lattice(:A,5);
julia> Lf = integer_lattice_with_isometry(L; neg=true)
Integer lattice of rank 5 and degree 5
with isometry of finite order 2
given by
[-1 0 0 0 0]
[ 0 -1 0 0 0]
[ 0 0 -1 0 0]
[ 0 0 0 -1 0]
[ 0 0 0 0 -1]
```
"""
function integer_lattice_with_isometry(L::ZZLat; neg::Bool = false)
d = degree(L)
f = identity_matrix(QQ, d)
if neg
f = -f
end
return integer_lattice_with_isometry(L, f; check = false, ambient_representation = true)
end
@doc raw"""
lattice(Vf::QuadSpaceWithIsom) -> ZZLatWithIsom
Given a quadratic space with isometry $(V, f)$, return the full rank lattice $L$
in $V$ with basis the standard basis, together with the induced action of $f$
on $L$.
# Examples
```jldoctest
julia> V = quadratic_space(QQ, QQ[2 -1; -1 2])
Quadratic space of dimension 2
over rational field
with gram matrix
[ 2 -1]
[-1 2]
julia> f = matrix(QQ, 2, 2, [1 1; 0 -1])
[1 1]
[0 -1]
julia> Vf = quadratic_space_with_isometry(V, f)
Quadratic space of dimension 2
with isometry of finite order 2
given by
[1 1]
[0 -1]
julia> Lf = lattice(Vf)
Integer lattice of rank 2 and degree 2
with isometry of finite order 2
given by
[1 1]
[0 -1]
```
"""
lattice(Vf::QuadSpaceWithIsom) = ZZLatWithIsom(Vf, lattice(space(Vf)), isometry(Vf), order_of_isometry(Vf))
@doc raw"""
lattice(Vf::QuadSpaceWithIsom, B::MatElem{<:RationalUnion};
isbasis::Bool = true, check::Bool = true)
-> ZZLatWithIsom
Given a quadratic space with isometry $(V, f)$ and a matrix $B$ generating a
lattice $L$ in $V$, if $L$ is preserved under the action of $f$, return the
lattice with isometry $(L, f_L)$ where $f_L$ is induced by the action of $f$
on $L$.
# Examples
```jldoctest
julia> V = quadratic_space(QQ, QQ[ 2 -1 0 0 0;
-1 2 -1 0 0;
0 -1 2 -1 0;
0 0 -1 2 -1;
0 0 0 -1 2]);
julia> f = matrix(QQ, 5, 5, [ 1 0 0 0 0;
-1 -1 -1 -1 -1;
0 0 0 0 1;
0 0 0 1 0;
0 0 1 0 0]);
julia> Vf = quadratic_space_with_isometry(V, f);
julia> B = matrix(QQ,3,5,[1 0 0 0 0;
0 0 1 0 1;
0 0 0 1 0])
[1 0 0 0 0]
[0 0 1 0 1]
[0 0 0 1 0]
julia> lattice(Vf, B)
Integer lattice of rank 3 and degree 5
with isometry of finite order 1
given by
[1 0 0]
[0 1 0]
[0 0 1]
```
"""
function lattice(Vf::QuadSpaceWithIsom, B::MatElem{<:RationalUnion}; isbasis::Bool = true, check::Bool = true)
L = lattice(space(Vf), B; isbasis, check)
ok, fB = can_solve_with_solution(basis_matrix(L), basis_matrix(L)*isometry(Vf); side = :left)
n = is_zero(fB) ? -1 : multiplicative_order(fB)
@req ok "The lattice defined by B is not preserved under the action of the isometry of Vf"
return ZZLatWithIsom(Vf, L, fB, n)
end
@doc raw"""
lattice_in_same_ambient_space(L::ZZLatWithIsom, B::MatElem;
check::Bool = true)
-> ZZLatWithIsom
Given a lattice with isometry $(L, f)$ and a matrix $B$ whose rows define a free
system of vectors in the ambient space $V$ of $L$, if the lattice $M$ in $V$ defined
by $B$ is preserved under the fixed isometry $g$ of $V$ inducing $f$ on $L$, return
the lattice with isometry pair $(M, f_M)$ where $f_M$ is induced by the action of
$g$ on $M$.
# Examples
```jldoctest
julia> L = root_lattice(:A,5);
julia> f = matrix(QQ, 5, 5, [ 1 0 0 0 0;
-1 -1 -1 -1 -1;
0 0 0 0 1;
0 0 0 1 0;
0 0 1 0 0]);
julia> Lf = integer_lattice_with_isometry(L, f);
julia> B = matrix(QQ,3,5,[1 0 0 0 0;
0 0 1 0 1;
0 0 0 1 0])
[1 0 0 0 0]
[0 0 1 0 1]
[0 0 0 1 0]
julia> I = lattice_in_same_ambient_space(Lf, B)
Integer lattice of rank 3 and degree 5
with isometry of finite order 1
given by
[1 0 0]
[0 1 0]
[0 0 1]
julia> ambient_space(I) === ambient_space(Lf)
true
```
"""
function lattice_in_same_ambient_space(L::ZZLatWithIsom, B::MatElem; check::Bool = true)
@req !check || (rank(B) == nrows(B)) "The rows of B must define a free system of vectors"
Vf = ambient_space(L)
return lattice(Vf, B; check)
end
###############################################################################
#
# Operations on lattices with isometry
#
###############################################################################
@doc raw"""
orthogonal_submodule(Lf::ZZLatWithIsom, B::QQMatrix) -> ZZLatWithIsom
Given a lattice with isometry $(L, f)$ and a matrix $B$ with rational entries
defining an $f$-stable sublattice of $L$, return the largest submodule of $L$
orthogonal to each row of $B$, equipped with the induced action from $f$.
# Examples
```jldoctest
julia> L = root_lattice(:A,5);
julia> f = matrix(QQ, 5, 5, [ 1 0 0 0 0;
-1 -1 -1 -1 -1;
0 0 0 0 1;
0 0 0 1 0;
0 0 1 0 0]);
julia> Lf = integer_lattice_with_isometry(L, f);
julia> B = matrix(QQ,3,5,[1 0 0 0 0;
0 0 1 0 1;
0 0 0 1 0])
[1 0 0 0 0]
[0 0 1 0 1]
[0 0 0 1 0]
julia> orthogonal_submodule(Lf, B)
Integer lattice of rank 2 and degree 5
with isometry of finite order 2
given by
[-1 0]
[ 0 -1]
```
"""
function orthogonal_submodule(Lf::ZZLatWithIsom, B::QQMatrix)
@req ncols(B) == degree(Lf) "The rows of B should represent vectors in the ambient space of Lf"
B2 = basis_matrix(orthogonal_submodule(lattice(Lf), B))
return lattice_in_same_ambient_space(Lf, B2; check = false)
end
@doc raw"""
rescale(Lf::ZZLatWithIsom, a::RationalUnion) -> ZZLatWithIsom
Given a lattice with isometry $(L, f)$ and a rational number $a$, return the
lattice with isometry $(L(a), f)$.
# Examples
```jldoctest
julia> L = root_lattice(:A,5)
Integer lattice of rank 5 and degree 5
with gram matrix
[ 2 -1 0 0 0]
[-1 2 -1 0 0]
[ 0 -1 2 -1 0]
[ 0 0 -1 2 -1]
[ 0 0 0 -1 2]
julia> f = matrix(QQ, 5, 5, [ 1 0 0 0 0;
-1 -1 -1 -1 -1;
0 0 0 0 1;
0 0 0 1 0;
0 0 1 0 0]);
julia> Lf = integer_lattice_with_isometry(L, f)
Integer lattice of rank 5 and degree 5
with isometry of finite order 2
given by
[ 1 0 0 0 0]
[-1 -1 -1 -1 -1]
[ 0 0 0 0 1]