1#############################################################################
2#0
3#F	BarComplexEquivalence
4##	Input:	A HAP resolution
5##	Output: An equivariant chain homotopy between the bar and the HAP complex
6##
7InstallGlobalFunction(BarComplexEquivalence,function(R)
8local
9	e,dim,
10	BarResEqui,Phi,Psi,Equiv,
11	CPhi,CPsi,CEquiv;
12
13	e:=Identity(R!.group);
14	dim:=R!.dimension;
15	BarResEqui:=BarResolutionEquivalence(R);
16	Phi:=BarResEqui!.phi;
17	Psi:=BarResEqui!.psi;
18	Equiv:=BarResEqui!.equiv;
19
20	######################################################################
21	#1
22	#F	CPsi
23	##	Input: A word w =[[m1,e_1],...[m_k,e_k]] with k:=R!.dimension(n)
24	##	Output: The image of w under the map cpsi: cR_n->cB_n
25	##
26	CPsi:=function(n,w)
27	local Rew,x,cw;
28
29		cw:=StructuralCopy(w);
30		for x in cw do
31			Add(x,1);
32		od;
33		Rew:=Psi(n,cw);
34		for x in Rew do
35			Remove(x,2);
36		od;
37		return Rew;
38	end;
39	##
40	############### end of CPsi ##########################################
41
42	######################################################################
43	#1
44	#F	CPhi
45	##	Input: A word w =[[m_1,g_11,..,g_1n],...[m_k,g_k1,...,g_kn]]
46	##	Output: The image of w under the map cphi: cB_n->cR_n
47	##
48	CPhi:=function(n,w)
49	local Zw,x,tmp,PhiZw,i,Rew;
50
51		Zw:=[];
52		for x in w do
53			tmp:=[x[1],e];
54			for i in [2..n+1] do
55				Add(tmp,x[i]);
56			od;
57			Add(Zw,tmp);
58		od;
59		PhiZw:=Phi(n,Zw);
60		Rew:= List([ 1..dim(n)],x->0);
61		for tmp in PhiZw do
62			i:=tmp[2];
63			Rew[i]:=Rew[i]+tmp[1];
64		od;
65	return Rew;
66	end;
67	##
68	############### end of CPhi ##########################################
69
70	######################################################################
71	#1
72	#F	CEquiv
73	##	Input: A word w =[[m_1,g_11,...,g_1n],...,[m_k,g_k1,...,g_kn]]
74	##	Output: The image of w under the homotopy map cH_n: cB_n->cB_{n+1}
75	##
76	CEquiv:=function(n,w)
77	local Zw,x,i,tmp,Rew;
78
79		Zw:=[];
80		for x in w do
81			tmp:=[x[1],e];
82			for i in [2..n+1] do
83				Add(tmp,x[i]);
84			od;
85			Add(Zw,tmp);
86		od;
87		Rew:=Equiv(n,Zw);
88		for tmp in Rew do
89			Remove(tmp,2);
90		od;
91		return Rew;
92	end;
93	##
94	############### end of CEquiv ########################################
95
96	return rec(
97				phi:=CPhi,
98				psi:=CPsi,
99				equiv:=CEquiv
100			);
101end);
102##
103################### end of BarComplexEquivalence ############################
104