@@ -66,6 +66,7 @@ InstallGlobalFunction( LINEAR_CLOSURE_CONSTRUCTOR_USING_CategoryOfRows,
66
66
category!. compiler_hints := rec (
67
67
category_attribute_names := [
68
68
" UnderlyingCategory" ,
69
+ " CommutativeRingOfLinearCategory" ,
69
70
] ,
70
71
);
71
72
@@ -412,7 +413,7 @@ end );
412
413
413
414
InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_LINEAR_CLOSURE,
414
415
function ( rows, category )
415
- local ring, underlying_category, sorting_function, mul_coeffs, mul_supp, with_nf,
416
+ local ring, underlying_category, sorting_function, with_nf,
416
417
equality_func, finsets, t_obj, t_finsets, FunctorMor, FunctorObj, cocycle;
417
418
418
419
if not IsCategoryOfRows( rows ) then
@@ -446,14 +447,28 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_LINEAR_CLOSURE,
446
447
return UnderlyingOriginalObject( object );
447
448
448
449
end );
449
-
450
- # #
451
- AddMorphismConstructor( category,
452
- function ( cat, source, pair, range )
450
+
451
+ if with_nf then
453
452
454
- return LinearClosureMorphismNC( cat, source, pair[ 1 ] , pair[ 2 ] , range );
453
+ # #
454
+ AddMorphismConstructor( category,
455
+ function ( cat, source, pair, range )
456
+
457
+ return LinearClosureMorphism( cat, source, pair[ 1 ] , pair[ 2 ] , range );
458
+
459
+ end );
460
+
461
+ else
455
462
456
- end );
463
+ # #
464
+ AddMorphismConstructor( category,
465
+ function ( cat, source, pair, range )
466
+
467
+ return LinearClosureMorphismNC( cat, source, pair[ 1 ] , pair[ 2 ] , range );
468
+
469
+ end );
470
+
471
+ fi ;
457
472
458
473
# #
459
474
AddMorphismDatum( category,
@@ -464,52 +479,74 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_LINEAR_CLOSURE,
464
479
end );
465
480
466
481
# #
467
- AddIsEqualForObjects( category, { cat, a, b} -> IsEqualForObjects( UnderlyingOriginalObject( a ), UnderlyingOriginalObject( b ) ) );
482
+ AddIsEqualForObjects( category,
483
+ function ( cat, a, b )
484
+
485
+ return IsEqualForObjects( UnderlyingCategory( cat ), UnderlyingOriginalObject( a ), UnderlyingOriginalObject( b ) );
486
+
487
+ end );
468
488
469
- equality_func := function ( alpha, beta, equal_or_cong )
470
- local coeffs_a, coeffs_b, supp_a, supp_b, size;
489
+ # #
490
+ AddIsEqualForMorphisms( category,
491
+ function ( cat, alpha, beta )
492
+ local coeffs_a, coeffs_b, supp_a, supp_b, size_coeffs_a;
471
493
472
494
coeffs_a := CoefficientsList( alpha );
473
495
474
496
coeffs_b := CoefficientsList( beta );
475
497
476
- size := Length( coeffs_a );
498
+ size_coeffs_a := Length( coeffs_a );
477
499
478
- if size <> Length( coeffs_b ) then
479
- return false ;
480
- fi ;
481
-
482
- return ForAll( [ 1 .. size ] , i -> equal_or_cong( SupportMorphisms( alpha )[ i] , SupportMorphisms( beta )[ i] ) ) and
483
- coeffs_a = coeffs_b;
500
+ return size_coeffs_a = Length( coeffs_b ) and
501
+ ForAll( [ 1 .. size_coeffs_a ] , i ->
502
+ IsEqualForMorphisms( UnderlyingCategory( cat ), SupportMorphisms( alpha )[ i] , SupportMorphisms( beta )[ i] ) ) and
503
+ coeffs_a = coeffs_b;
484
504
485
- end ;
486
-
487
- # #
488
- AddIsEqualForMorphisms( category, { cat, alpha, beta} -> equality_func( alpha, beta, IsEqualForMorphisms ) );
505
+ end );
489
506
490
507
if with_nf then
491
508
492
509
# #
493
- AddIsCongruentForMorphisms( category, { cat, alpha, beta} -> equality_func( alpha, beta, IsCongruentForMorphisms ) );
510
+ AddIsCongruentForMorphisms( category,
511
+ function ( cat, alpha, beta )
512
+ local coeffs_a, coeffs_b, supp_a, supp_b, size_coeffs_a;
513
+
514
+ coeffs_a := CoefficientsList( alpha );
515
+
516
+ coeffs_b := CoefficientsList( beta );
517
+
518
+ size_coeffs_a := Length( coeffs_a );
519
+
520
+ return size_coeffs_a = Length( coeffs_b ) and
521
+ ForAll( [ 1 .. size_coeffs_a ] , i ->
522
+ IsCongruentForMorphisms( UnderlyingCategory( cat ), SupportMorphisms( alpha )[ i] , SupportMorphisms( beta )[ i] ) ) and
523
+ coeffs_a = coeffs_b;
524
+
525
+ end );
494
526
495
527
else
496
528
497
529
# #
498
530
AddIsCongruentForMorphisms( category,
499
- function ( cat, alpha, beta )
500
-
501
- return IsZeroForMorphisms( SubtractionForMorphisms( alpha, beta ) );
502
-
531
+ function ( cat, alpha, beta )
532
+
533
+ return IsZeroForMorphisms( cat, SubtractionForMorphisms( cat, alpha, beta ) );
534
+
503
535
end );
504
536
505
537
fi ;
506
538
507
539
# #
508
- AddIsWellDefinedForObjects( category, { cat, x} -> IsIdenticalObj( underlying_category, CapCategory( UnderlyingOriginalObject( x ) ) ) );
509
-
540
+ AddIsWellDefinedForObjects( category,
541
+ function ( cat, x )
542
+
543
+ return IsIdenticalObj( underlying_category, CapCategory( UnderlyingOriginalObject( x ) ) );
544
+
545
+ end );
546
+
510
547
# #
511
548
AddIsWellDefinedForMorphisms( category,
512
- function ( cat, alpha )
549
+ function ( cat, alpha )
513
550
local coeffs, supp, size, s, i;
514
551
515
552
coeffs := CoefficientsList( alpha );
@@ -561,22 +598,18 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_LINEAR_CLOSURE,
561
598
end );
562
599
563
600
# #
564
- mul_supp := { alpha, beta} -> PreCompose( alpha, beta );
565
-
566
- mul_coeffs := { a,b} -> a * b;
567
-
568
601
if not IsBound ( category!. cocycle ) then
569
602
570
603
# #
571
604
AddPreCompose( category,
572
605
function ( cat, alpha, beta )
573
606
local coeffs, supp;
574
607
575
- coeffs := ListX( CoefficientsList( alpha ), CoefficientsList( beta ), mul_coeffs );
608
+ coeffs := ListX( CoefficientsList( alpha ), CoefficientsList( beta ), { a,b } -> a * b );
576
609
577
- supp := ListX( SupportMorphisms( alpha ), SupportMorphisms( beta ), mul_supp );
610
+ supp := ListX( SupportMorphisms( alpha ), SupportMorphisms( beta ), { alpha, beta } -> PreCompose( underlying_category, alpha, beta ) );
578
611
579
- return LinearClosureMorphism( Source( alpha ), coeffs, supp, Range( beta ) );
612
+ return MorphismConstructor( cat, Source( alpha ), Pair( coeffs, supp ) , Range( beta ) );
580
613
581
614
end );
582
615
@@ -605,9 +638,9 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_LINEAR_CLOSURE,
605
638
606
639
for b in [ 1 .. Length( coeffs_beta ) ] do
607
640
608
- gamma := mul_supp ( supp_alpha[ a] , supp_beta[ b] );
641
+ gamma := PreCompose ( supp_alpha[ a] , supp_beta[ b] );
609
642
610
- coeff := mul_coeffs ( coeffs_alpha[ a] , coeffs_beta[ b] ) * cocycle( supp_alpha[ a] , supp_beta[ b] , gamma );
643
+ coeff := ( coeffs_alpha[ a] * coeffs_beta[ b] ) * cocycle( supp_alpha[ a] , supp_beta[ b] , gamma );
611
644
612
645
Add( supp, gamma );
613
646
@@ -617,7 +650,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_LINEAR_CLOSURE,
617
650
618
651
od ;
619
652
620
- return LinearClosureMorphism( Source( alpha ), coeffs, supp, Range( beta ) );
653
+ return MorphismConstructor( cat, Source( alpha ), Pair( coeffs, supp ) , Range( beta ) );
621
654
622
655
end );
623
656
@@ -643,12 +676,11 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_LINEAR_CLOSURE,
643
676
644
677
end );
645
678
646
-
647
679
if with_nf then
648
680
649
681
# #
650
682
AddIsZeroForMorphisms( category,
651
- function ( cat, alpha )
683
+ function ( cat, alpha )
652
684
653
685
return IsEmpty( CoefficientsList( alpha ) );
654
686
@@ -669,45 +701,49 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_LINEAR_CLOSURE,
669
701
# #
670
702
AddAdditionForMorphisms( category,
671
703
function ( cat, alpha, beta )
672
- return LinearClosureMorphism(
673
- Source( alpha ),
674
- Concatenation( CoefficientsList( alpha ), CoefficientsList( beta ) ),
675
- Concatenation( SupportMorphisms( alpha ), SupportMorphisms( beta ) ),
676
- Range( alpha )
677
- );
704
+
705
+ return MorphismConstructor( cat,
706
+ Source( alpha ),
707
+ Pair( Concatenation( CoefficientsList( alpha ), CoefficientsList( beta ) ),
708
+ Concatenation( SupportMorphisms( alpha ), SupportMorphisms( beta ) ) ),
709
+ Range( alpha ) );
710
+
678
711
end );
679
712
680
713
# #
681
714
AddAdditiveInverseForMorphisms( category,
682
715
function ( cat, alpha )
683
- return LinearClosureMorphism(
684
- Source( alpha ),
685
- List( CoefficientsList( alpha ), c -> MinusOne( ring ) * c ),
686
- SupportMorphisms( alpha ),
687
- Range( alpha )
688
- );
716
+
717
+ return MorphismConstructor( cat,
718
+ Source( alpha ),
719
+ Pair( List( CoefficientsList( alpha ), c -> MinusOne( ring ) * c ),
720
+ SupportMorphisms( alpha ) ),
721
+ Range( alpha ) );
722
+
689
723
end );
690
724
691
725
# #
692
726
AddSubtractionForMorphisms( category,
693
727
function ( cat, alpha, beta )
694
- return LinearClosureMorphism(
695
- Source( alpha ),
696
- Concatenation( CoefficientsList( alpha ), List( CoefficientsList( beta ), c -> MinusOne( ring ) * c ) ),
697
- Concatenation( SupportMorphisms( alpha ), SupportMorphisms( beta ) ),
698
- Range( alpha )
699
- );
728
+
729
+ return MorphismConstructor( cat,
730
+ Source( alpha ),
731
+ Pair( Concatenation( CoefficientsList( alpha ), List( CoefficientsList( beta ), c -> MinusOne( ring ) * c ) ),
732
+ Concatenation( SupportMorphisms( alpha ), SupportMorphisms( beta ) ) ),
733
+ Range( alpha ) );
734
+
700
735
end );
701
736
702
737
# #
703
738
AddMultiplyWithElementOfCommutativeRingForMorphisms( category,
704
- function ( cat, r, alpha )
705
- return LinearClosureMorphism(
706
- Source( alpha ),
707
- List( CoefficientsList( alpha ), c -> r * c ),
708
- SupportMorphisms( alpha ),
709
- Range( alpha )
710
- );
739
+ function ( cat, r, alpha )
740
+
741
+ return MorphismConstructor( cat,
742
+ Source( alpha ),
743
+ Pair( List( CoefficientsList( alpha ), c -> r * c ),
744
+ SupportMorphisms( alpha ) ),
745
+ Range( alpha ) );
746
+
711
747
end );
712
748
713
749
if not with_nf then
@@ -726,11 +762,11 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_LINEAR_CLOSURE,
726
762
727
763
# #
728
764
AddSetOfObjectsOfCategory( category,
729
- function ( cat )
730
-
731
- return List( SetOfObjectsOfCategory( underlying_category ),
732
- obj -> LinearClosureObject( category, obj ) );
733
-
765
+ function ( cat )
766
+
767
+ return List( SetOfObjectsOfCategory( underlying_category ),
768
+ obj -> LinearClosureObject( category, obj ) );
769
+
734
770
end );
735
771
736
772
fi ;
@@ -740,8 +776,7 @@ InstallGlobalFunction( INSTALL_FUNCTIONS_FOR_LINEAR_CLOSURE,
740
776
if with_nf and
741
777
HasIsEquippedWithHomomorphismStructure( underlying_category ) and
742
778
IsEquippedWithHomomorphismStructure( underlying_category ) and
743
- IsPackageMarkedForLoading( " FinSetsForCAP" , " >= 2023.07-03" )
744
- then
779
+ IsPackageMarkedForLoading( " FinSetsForCAP" , " >= 2023.07-03" ) then
745
780
746
781
INSTALL_HOMOMORPHISM_STRUCTURE_FOR_LINEAR_CLOSURE( category, rows );
747
782
0 commit comments