Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/GAP/pkg/semigroups/tst/workspaces/   (GAP Algebra Version 4.15.1©)  Datei vom 29.7.2025 mit Größe 5 kB image not shown  

Quelle  save-workspace.tst   Sprache: unbekannt

 
Spracherkennung für: .tst vermutete Sprache: Unknown {[0] [0] [0]} [Methode: Schwerpunktbildung, einfache Gewichte, sechs Dimensionen]

#############################################################################
##
#W  workspaces/save-workspace.tst
#Y  Copyright (C) 2016                                      Michael Young
##
##  Licensing information can be found in the README file of this package.
##
#############################################################################
##
##  This file, together with load-workspace.tst, tests the ability to save
##  and load workspaces which include Semigroups objects.  Objects should be
##  created and stored in save-workspace.tst, and then loaded and tested in
##  load-workspace.tst to ensure that they work correctly after being saved.
##
#############################################################################

# DO NOT USE LOCAL VARIABLES @local in this file!

# Set up testing environment

gap> START_TEST("Semigroups package: workspaces/save-workspace.tst");
gap> SetInfoLevel(InfoDebug, 0);
gap> LoadPackage("semigroups", false);;
gap> SEMIGROUPS.StartTest();

#############################################################################
##  Create objects below here, and add tests to load-workspace.tst to ensure
##  that they are saved to disk correctly.  Do not reuse variable names.
#############################################################################

# Congruences from libsemigroups
gap> S := Semigroup(Matrix(IsBooleanMat, [[01], [10]]), 
>                   Matrix(IsBooleanMat, [[10], [11]]), 
>                   Matrix(IsBooleanMat, [[10], [00]]), 
>                   Matrix(IsBooleanMat, [[10], [00]]));;
gap> cong := LeftSemigroupCongruence(S, [S.1, S.2]);;
gap> NrEquivalenceClasses(cong);
4
gap> EquivalenceRelationCanonicalLookup(cong);
1121131121311243 ]

# Semigroups from libsemigroups
gap> T := Semigroup(Matrix(IsBooleanMat, [[01], [00]]), 
>                   Matrix(IsBooleanMat, [[10], [11]]), 
>                   Matrix(IsBooleanMat, [[10], [01]]), 
>                   Matrix(IsBooleanMat, [[10], [00]]));;
gap> Size(T); 
9
gap> NrIdempotents(T);
8
gap> x := T.1 * T.2 * T.3 ^ 5 * T.2 * T.3;
Matrix(IsBooleanMat, [[10], [00]])
gap> Factorization(T, x);
4 ]
gap> D := DClass(T, x);;
gap> id := Idempotents(D);
[ Matrix(IsBooleanMat, [[01], [01]]), 
  Matrix(IsBooleanMat, [[11], [00]]), 
  Matrix(IsBooleanMat, [[11], [11]]), 
  Matrix(IsBooleanMat, [[10], [00]]), 
  Matrix(IsBooleanMat, [[10], [10]]) ]
gap> ForAll(id, x -> x in T);
true
gap> U := AsSemigroup(IsTransformationSemigroup, T);
<transformation monoid of size 9, degree 4 with 3 generators>
gap> Size(U); 
9
gap> NrIdempotents(U);
8
gap> xx := U.1 * U.2 * U.3 ^ 5 * U.2 * U.3;
Transformation( [ 2244 ] )
gap> Factorization(U, xx);
4 ]
gap> DD := DClass(U, xx);;
gap> idd := Idempotents(DD);
[ Transformation( [ 1144 ] ), Transformation( [ 2244 ] ), 
  Transformation( [ 333 ] ), Transformation( [ 111 ] ), 
  Transformation( [ 222 ] ) ]
gap> ForAll(idd, x -> x in U);
true

# Bipartitions
gap> y := Bipartition([[13], [24, -1], [56, -2, -3], [-4, -5], [-6]]);
<bipartition: [ 13 ], [ 24, -1 ], [ 56, -2, -3 ], [ -4, -5 ], [ -6 ]>
gap> IsBipartition(y);
true
gap> DegreeOfBipartition(y);
6
gap> RankOfBipartition(y);
2
gap> NrTransverseBlocks(y);
2
gap> NrLeftBlocks(y);
3
gap> NrRightBlocks(y);
4
gap> NrBlocks(y);
5
gap> LeftBlocks(y);
<blocks: [ 13 ], [ 2*, 4* ], [ 5*, 6* ]>
gap> RightBlocks(y);
<blocks: [ 1* ], [ 2*, 3* ], [ 45 ], [ 6 ]>
gap> IntRepOfBipartition(y);
121233233445 ]
gap> LeftProjection(y);
<bipartition: [ 13 ], [ 24, -2, -4 ], [ 56, -5, -6 ], [ -1, -3 ]>
gap> RightProjection(y);
<bipartition: [ 1, -1 ], [ 23, -2, -3 ], [ 45 ], [ 6 ], [ -4, -5 ], 
 [ -6 ]>
gap> One(y);
<block bijection: [ 1, -1 ], [ 2, -2 ], [ 3, -3 ], [ 4, -4 ], [ 5, -5 ], 
 [ 6, -6 ]>
gap> IsBlockBijection(y);
false
gap> IsUniformBlockBijection(y);
false
gap> IsTransBipartition(y);
false
gap> IsDualTransBipartition(y);
false
gap> IsPermBipartition(y);
false
gap> IsPartialPermBipartition(y);
false

# Blocks
gap> b := BLOCKS_NC([[13], [-2, -4, -7], [5689], [10]]);
<blocks: [ 1*, 3* ], [ 247 ], [ 5*, 6*, 8*, 9* ], [ 10* ]>
gap> ProjectionFromBlocks(b);
<bipartition: [ 13, -1, -3 ], [ 247 ], [ 5689, -5, -6, -8, -9 ], 
 [ 10, -10 ], [ -2, -4, -7 ]>
gap> NrBlocks(b);
4
gap> RankOfBlocks(b);
3
gap> NrTransverseBlocks(b);
3
gap> DegreeOfBlocks(b);
10
gap> AsDigraph(b);
<immutable digraph with 10 vertices, 23 edges>
gap> CanonicalBlocks(b);
<blocks: [ 1* ], [ 2*, 3* ], [ 4*, 5*, 6*, 7* ], [ 8910 ]>

# Save the workspace
gap> SaveWorkspace(Concatenation(SEMIGROUPS.PackageDir,
>                                "/tst/workspaces/test-output.w"));
true

# Unbind local variables, auto-generated by etc/tst-unbind-local-vars.py
gap> Unbind(D);
gap> Unbind(DD);
gap> Unbind(S);
gap> Unbind(T);
gap> Unbind(U);
gap> Unbind(b);
gap> Unbind(cong);
gap> Unbind(id);
gap> Unbind(idd);
gap> Unbind(x);
gap> Unbind(xx);
gap> Unbind(y);

#
gap> SEMIGROUPS.StopTest();
gap> STOP_TEST("Semigroups package: workspaces/save-workspace.tst");

[Dauer der Verarbeitung: 0.17 Sekunden, vorverarbeitet 2026-06-17]