File: cubeCwComplex.gi

package info (click to toggle)
gap-hap 1.66%2Bds-1
  • links: PTS
  • area: main
  • in suites: trixie
  • size: 55,348 kB
  • sloc: xml: 15,368; sh: 216; javascript: 155; makefile: 126; ansic: 57; perl: 36
file content (278 lines) | stat: -rw-r--r-- 8,211 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

####################################################
####################################################
HAP_PoincareCubeManifoldEdgeDegrees:=function(Y)
local s,pos, b;

#Returns a list [[d1,n1], [d2,n2], ..., [dk,nk]]
# where nk is the number of *cube* edges in YY such that
# lie in precisely dk faces.
# NOTE: Y must be constructed using PoincareCubeCWComplexNS. 

s:=List([1..Y!.nrCells(1)],i->Y!.coboundaries[2][i][1]);
s:=Collected(s);;

pos:=PositionProperty(s,x->x[1]=8);;
s[pos][2]:=s[pos][2]-6;;

pos:=PositionProperty(s,x->x[1]=6);;
s[pos][2]:=s[pos][2]-8;;

pos:=PositionProperty(s,x->x[1]=4);;
s[pos][2]:=s[pos][2]-12-24;;

s:=Filtered(s,x->x[2]<>0);
s:=List(s,x->[x[1]/2,x[2]]);
return SortedList(s);;
end;
#####################################################
####################################################


####################################################
####################################################
InstallGlobalFunction(BarycentricallySimplifiedComplex,
function(Y)
local V,W,s,t;
W:=SimplifiedComplex(Y);
s:=Size(W);
t:=0;
while s> t do
V:=W;
s:=Size(V);
W:=SimplifiedComplex(RegularCWComplex(BarycentricSubdivision(V)));
t:=Size(W);
od;
if IsBound(Y!.cubeFacePairings) then
V!.cubeFacePairings:=Y!.cubeFacePairings;
fi;
return V;
end);
####################################################
####################################################

####################################################
####################################################
InstallGlobalFunction(PoincareCubeCWComplex,
function(arg)
local Y, YY;

if Length(arg)=2 then
Y:=PoincareCubeCWComplexNS(arg[1],arg[2]);
else
Y:=PoincareCubeCWComplexNS(arg[1],arg[2],arg[3]);
fi;
YY:=SimplifiedComplex(Y);
YY!.cubeFacePairings:=Y!.cubeFacePairings;
YY!.edgeDegrees:=Y!.edgeDegrees;
return YY;
end);
####################################################
####################################################

####################################################
####################################################
InstallGlobalFunction(PoincareCubeCWComplexNS,
function(arg)
local A, G, L, M, N, Y, B, F, data, NF, NFF, Vertices, Edges, Faces, 
      CubeEdges, CubeFaces, bool, act, p, q, i,
      X, K, KK, DD,SD,TD,x, cnt,pos, C,v,n;

#First input variable is a pairing of the integers 1..6
#such as A:=[ [1,6], [2,3], [4,5]  ];
#Second variable is a list B:=[a,b,c] of three elements of 
#the dihedral group D_8 < Sym([1..4]);

#######################################
#Action of an element g of the dihedral group of order 8
#on a list x=[x1,x2,x3,x4] of length 4
act:=function(g,x);
return List([1..4],i->x[i^g]);
end;
#######################################

#######################################
#Y is the 3-dimensional cube as a regular CW-complex.
B:=[];
B[1]:=List([1..8],i->[1,0]);
B[2]:=[[2,1,2],[2,3,4],[2,7,8],[2,5,6],
       [2,1,4],[2,2,3],[2,6,7],[2,5,8],
       [2,1,5],[2,4,8],[2,3,7],[2,2,6]];
B[3]:=[[4,1,4,9,12],[4,2,3,10,11],[4,1,2,5,6],[4,3,4,7,8],
       [4,5,8,9,10],[4,6,7,11,12]];
B[4]:=[[6,1,2,3,4,5,6]];
B[5]:=[];
Y:=RegularCWComplex(B);

K:=BarycentricSubdivision(Y);
KK:=RegularCWComplex(K);
#######################################

#data is a list of three lists which describe the identification.
data:=[ [ ], [ ], [ ], [ ] ];

#      5 6
#    5 1 2 6
#    8 4 3 7
#      8 7
#      5 6

CubeEdges:= [ [1,2], [3,4], [7,8], [5,6],[1,4],[2,3],[6,7],[5,8],
              [1,5], [4,8], [3,7], [2,6]];
CubeFaces:=[ [1,5,6,2], [3,7,8,4], [1,2,3,4], [5,8,7,6], [1,4,8,5], [2,6,7,3]];
#Note: CubeEdges/Vertices have the same order as the boundary B above.
F:=CubeFaces;

###########################################
#Normal form for faces
NF:=function(F)
local m;
m:=Minimum(F);
m:=Position(F,m);
return Concatenation(F{[m..Length(F)]},F{[1..m-1]}   );
end;
###########################################

###########################################
#Normal form for faces incorporating orientation
NFF:=function(F)
local T;
T:=NF(F);
if T in CubeFaces then return T;
else return NF(Reversed(F));
fi;
end;
###########################################


if Length(arg)=0 then
Print("This function returns a CW-complex arising as a quotient of a cube with vertices \n [1,5,6,2] in the plane z=1 (face 1) \n [3,7,8,4] in the plane z=0 (face 2)\n [1,2,3,4] in the plane y=0 (face 3)\n [5,8,7,6] in the plane y=1 (face 4)\n [1,4,8,5] in the plane x=0 (face 5)\n [2,6,7,3] in the plane x=1 (face 6).\n\nThe function can be applied to two inputs PoincareCubeCWComplex(A,G) where A is a pairing of the six faces such as A=[[1,2],[3,4],[5,6]] and G is a list of three elements of the dihedral group D8 such as G=[(2,4),(2,4),(2,4)*(1,3)].\n\nAlternatively the function can be applied to three inputs PoincareCubeCWComplex(L,M,N) where each input is a pairing of faces specified by a bijection of face vertices such as L=[[1,2,3,4], [6,7,5,3]].\n\n");
return fail;
fi;

if Length(arg)=2 then
A:=arg[1];
G:=arg[2];

L:= [ F[A[1][1]], act( G[1], F[A[1][2]] ) ];
M:= [ F[A[2][1]], act( G[2], F[A[2][2]] ) ];
N:= [ F[A[3][1]], act(G[3], F[A[3][2]] ) ];
fi;

if Length(arg)=3 then
L:= arg[1];
M:= arg[2];
N:= arg[3];

A:=[];
for x in [L,M,N] do
Add(A, [Position(F,NFF(x[1])),Position(F,NFF(x[2]))]);
od;

fi;

###########################################
#Let's check that the input arguments are genuine faces of our cube.
#This check is not needed but might catch a programming slip.
bool:=false;
if not NFF(L[1]) in CubeFaces then bool:=true; fi;
if not NFF(L[2]) in CubeFaces then bool:=true; fi;
if not NFF(M[1]) in CubeFaces then bool:=true; fi;
if not NFF(M[2]) in CubeFaces then bool:=true; fi;
if not NFF(N[1]) in CubeFaces then bool:=true; fi;
if not NFF(N[2]) in CubeFaces then bool:=true; fi;
if bool then
Print("Arguments must be pairs of cube faces.\n"); return fail;
fi;
###########################################


cnt:=0;
for X in [L,M,N] do
Vertices:=[];
Edges:=[];
Faces:=[];
cnt:=cnt+1;
SD:=1*K!.simplicesLst[3];
SD:=Filtered(SD,x->A[cnt][1]+20 in x and not 27 in x);

Add(Faces, [Position(CubeFaces,NFF(X[1])), Position(CubeFaces,NFF(X[2]))]);
TD:=List(SD,x->[x[1],x[2],Faces[1][2]+20]);


Add(Vertices, [X[1][1], X[2][1]]);
Add(Vertices, [X[1][2], X[2][2]]);
Add(Vertices, [X[1][3], X[2][3]]);
Add(Vertices, [X[1][4], X[2][4]]);

for x in TD do
pos:=PositionProperty(Vertices,v->v[1]=x[1]);
x[1]:=Vertices[pos][2]*1;
od;

p:=Position(CubeEdges,SortedList(X[1]{[1,2]}));
q:=Position(CubeEdges,SortedList(X[2]{[1,2]}));
Add(Edges,([p,q]));
p:=Position(CubeEdges,SortedList(X[1]{[2,3]}));
q:=Position(CubeEdges,SortedList(X[2]{[2,3]}));
Add(Edges,([p,q]));
p:=Position(CubeEdges,SortedList(X[1]{[3,4]}));
q:=Position(CubeEdges,SortedList(X[2]{[3,4]}));
Add(Edges,([p,q]));
p:=Position(CubeEdges,SortedList(X[1]{[1,4]}));
q:=Position(CubeEdges,SortedList(X[2]{[1,4]}));
Add(Edges,([p,q]));

for x in TD do
pos:=PositionProperty(Edges,v->v[1]=x[2]-8);
x[2]:=Edges[pos][2]+8;
od;

for i in [1..Length(SD)] do
Add(data[3],[Position(K!.simplicesLst[3],SD[i]), Position(K!.simplicesLst[3],TD[i])]);

Add(data[1],[Position(K!.simplicesLst[1],SD[i]{[1]}), Position(K!.simplicesLst[1],TD[i]{[1]})]);

Add(data[1],[Position(K!.simplicesLst[1],SD[i]{[2]}), Position(K!.simplicesLst[1],TD[i]{[2]})]);

Add(data[1],[Position(K!.simplicesLst[1],SD[i]{[3]}), Position(K!.simplicesLst[1],TD[i]{[3]})]);

Add(data[2],[Position(K!.simplicesLst[2],SD[i]{[1,2]}), Position(K!.simplicesLst[2],TD[i]{[1,2]})]);

Add(data[2],[Position(K!.simplicesLst[2],SD[i]{[1,3]}), Position(K!.simplicesLst[2],TD[i]{[1,3]})]);

Add(data[2],[Position(K!.simplicesLst[2],SD[i]{[2,3]}), Position(K!.simplicesLst[2],TD[i]{[2,3]})]);


od;


od;


C:=Target(QuotientChainMap(KK,data));

B:=[];
B[1]:=List([1..C!.dimension(0)],i->[1,0]);

for n in [1..3] do
B[n+1]:=[];
for i in [1..C!.dimension(n)] do
v:=C!.boundary(n,i);
v:=Filtered([1..Length(v)],j -> not IsZero(v[j]));
v:=Concatenation([Length(v)],v);
Add(B[n+1],v);
od;

od;
Add(B,[]);

#Y:=SimplifiedComplex(RegularCWComplex(B));
Y:=RegularCWComplex(B);
Y!.cubeFacePairings:=[L,M,N];
Y!.edgeDegrees:=HAP_PoincareCubeManifoldEdgeDegrees(Y);
return Y;
end);
###################################################
###################################################