<Chapter><Heading> Homology and cohomology groups</Heading>

<Table Align="|l|" > 


<Row>
<Item> <Index> Cohomology </Index>
<C>Cohomology(X,n) </C>
<P/>
Inputs either a cochain complex <M>X=C</M>  (or G-cocomplex C) 
or a cochain map <M>X=(C \longrightarrow
D)</M> in characteristic <M>p</M> together with a non-negative intereg <M>n</M>.
                                

<List>
<Item>If <M>X=C</M> and <M>p=0</M> then the torsion coefficients of <M>H^n(C)</M>
are retuned. If <M>X=C</M> and <M>p</M> is prime then the dimension of <M>H^n(C)</M>
are retuned. </Item>
 <Item>If <M>X=(C \longrightarrow
	D)</M> then the induced homomorphism <M>H^n(C)\longrightarrow
	H^n(D)</M> is returned as a homomorphism 
	of finitely presented groups. </Item>
</List>
A <M>G</M>-cocomplex <M>C</M> can also be input. The cohomology groups of such a complex may not be abelian. <B>Warning:</B> in this case Cohomology(C,n) returns the abelian invariants of the <M>n</M>-th cohomology group of <M>C</M>.

</Item>
</Row>

<Row>
<Item> <Index> CohomologyModule </Index>
<C>CohomologyModule(C,n) </C>
<P/>
Inputs  a <M>G</M>-cocomplex <M>C</M>  
 together with a non-negative integer <M>n</M>.
 It returns the cohomology <M>H^n(C)</M> as a <M>G</M>-outer group.
If <M>C</M> was constructed from a resolution <M>R</M> by homing to an abelian
 <M>G</M>-outer group <M>A</M> then, for each x in H:=CohomologyModule(C,n),
 there is a function f:=H!.representativeCocycle(x) which is a
standard n-cocycle corresponding to the cohomology class x. (At present this  works only for n=1,2,3.)


</Item>
</Row>

<Row>
<Item>
<Index>CohomologyPrimePart</Index>
<C>CohomologyPrimePart(C,n,p)</C>
<P/>

Inputs a cochain complex <M>C</M> in characteristic 0,
a positive integer <M>n</M>, and a prime <M>p</M>. It returns a list of
those torsion coefficients of <M>H^n(C)</M> that are positive powers of <M>p</M>.

 The function uses the EDIM  package by Frank Luebeck.
 </Item>
 </Row>
 

<Row>
<Item>
<Index>GroupCohomology</Index>
<C>GroupCohomology(X,n) </C>
<C>GroupCohomology(X,n,p)</C>
<P/>

Inputs a positive integer <M>n</M> and either
<List>
<Item> a finite group <M>X=G</M> </Item>
<Item> or a nilpotent Pcp-group <M>X=G</M> </Item>
<Item> or a space group <M>X=G</M> </Item>
<Item> or a list <M>X=D</M> representing a graph of groups</Item>
<Item>or a pair <M>X=["Artin",D]</M> where <M>D</M> is a Coxeter diagram  representing an infinite Artin group <M>G</M>.</Item>
<Item>or a pair <M>X=["Coxeter",D]</M> where <M>D</M> is a Coxeter diagram  representing a finite Coxeter group <M>G</M>.</Item>
</List>
It returns the torsion coefficients of the integral cohomology <M>H^n(G,Z)</M>.
<P/>

There is an optional third argument which, when set equal to a prime <M>p</M>, 
causes the function to return the the mod <M>p</M> cohomology <M>H^n(G,Z_p)</M>
as a list of length equal to its rank.
<P/>

This function is a composite of more basic functions, and makes choices 
for a number of parameters. For a particular group you would almost 
certainly be better using the more basic functions and making the choices 
yourself!
</Item>
</Row>

<Row>
<Item>
<Index>  GroupHomology</Index>
<C>GroupHomology(X,n)</C>
<C>GroupHomology(X,n,p)</C>
<P/>

Inputs a positive integer <M>n</M> and either
<List>
<Item> a finite group <M>X=G</M> </Item>
<Item> or a nilpotent Pcp-group <M>X=G</M> </Item>
<Item> or a space group <M>X=G</M> </Item>
<Item> or a list <M>X=D</M> representing a graph of groups</Item>
<Item>or a pair <M>X=["Artin",D]</M> where <M>D</M> is a Coxeter diagram  representing an infinite Artin group <M>G</M>.</Item>
<Item>or a pair <M>X=["Coxeter",D]</M> where <M>D</M> is a Coxeter diagram  representing a finite Coxeter group <M>G</M>.</Item>
</List>

It returns the torsion coefficients of the integral homology <M>H_n(G,Z)</M>.
<P/>
There is an optional third argument which, when set equal to a prime <M>p</M>, 
causes the function to return the mod <M>p</M> homology <M>H_n(G,Z_p)</M>
as a list of lenth equal to its rank.
<P/>
This function is a composite of more basic functions, 
and makes choices for a number of parameters. 
For a particular group you would almost certainly be better 
using the more basic functions and making the choices yourself!
</Item>
</Row>

<Row>
<Item>
<Index>  PersistentHomologyOfQuotientGroupSeries</Index>
<C>PersistentHomologyOfQuotientGroupSeries(S,n)</C>
<C>PersistentHomologyOfQuotientGroupSeries(S,n,p,Resolution_Algorithm)</C>
<P/>

Inputs a positive integer <M>n</M> and a decreasing chain <M>S=[S_1,  S_2, ..., S_k]</M> of normal subgroups in a finite  <M>p</M>-group
<M>G=S_1</M>. 

It returns the bar code of the persistent mod <M>p</M> homology in degree <M>n</M> of the sequence of quotient homomorphisms
<M>G \rightarrow G/S_k \rightarrow G/S_{k-1} \rightarrow ... \rightarrow G/S_2 </M>. The bar code is returned as a  matrix containing the dimensions of the images of the induced homology maps.

<P/>
If one sets <M>p=0</M> then the integral persitent homology bar code is returned.  This is a matrix whose entries are pairs of the lists: the list of abelian invariants of the images of the induced homology maps and the cokernels of the induced homology maps. (The matrix  probably does not  uniquely determine the induced homology maps.)

<P/>
Non prime-power (and possibly infinite) groups <M>G</M> can also be handled; in this case the prime must be entered as a third argument, and the resolution algorithm (e.g. ResolutionNilpotentGroup) can be entered as a fourth argument. (The default algorithm is ResolutionFiniteGroup, so this must be changed for infinite groups.)
</Item>
</Row>

<Row>
<Item>
<Index>  PersistentCohomologyOfQuotientGroupSeries</Index>
<C>PersistentCohomologyOfQuotientGroupSeries(S,n)</C>
<C>PersistentCohomologyOfQuotientGroupSeries(S,n,p,Resolution_Algorithm)</C>
<P/>

Inputs a positive integer <M>n</M> and a decreasing chain <M>S=[S_1,  S_2, ..., S_k]</M> of normal subgroups in a finite  <M>p</M>-group
<M>G=S_1</M>.

It returns the bar code of the persistent mod <M>p</M> cohomology in degree <M>n</M> of the sequence of quotient homomorphisms
<M>G \rightarrow G/S_k \rightarrow G/S_{k-1} \rightarrow ... \rightarrow G/S_2 </M>. The bar code is returned as a  matrix containing the dimensions of the images of the induced homology maps. 

<P/>
If one sets <M>p=0</M> then the integral persitent cohomology bar code is returned.  This is a matrix whose entries are pairs of the lists: the list of abelian invariants of the images of the induced cohomology maps and the cokernels of the induced 
cohomology maps. (The matrix  probably does not  uniquely determine the induced homology maps.)

<P/>
Non prime-power (and possibly infinite) groups <M>G</M> can also be handled; in this case the prime must be entered as a third argument, and the resolution algorithm (e.g. ResolutionNilpotentGroup) can be entered as a fourth argument. (The default algorithm is ResolutionFiniteGroup, so this must be changed for infinite groups.)

<P/>
 (The implementation is possibly a little less efficient than that of the corresponding persistent homology function.)

</Item>
</Row>

<Row>
<Item>
<Index>UniversalBarCode</Index>
<C>UniversalBarCode("UpperCentralSeries",n,d)</C>
<C>UniversalBarCode("UpperCentralSeries",n,d,k)</C>
<P/>

Inputs integers <M>n,d</M> that identify a prime power group G=SmallGroup(n,d), together with  one of the strings "UpperCentralSeries",
LowerCentralSeries", "DerivedSeries", "UpperPCentralSeries", "LowerPCentralSeries".
The function returns a matrix of rational functions; the coefficients of <M>x^k</M> in their expansions yield the persistence matrix for the degree <M>k</M> homology with trivial mod p coefficients associated to the quotients of <M>G</M> by the terms of the given series.

<P/>
If the additional integer argument <M>k</M> is supplied then the function returns the degree k homology persistence matrix. 
</Item>
</Row>


<Row>
<Item>
<Index>PersistentHomologyOfSubGroupSeries</Index>
<C>PersistentHomologyOfSubGroupSeries(S,n)</C>
<C>PersistentHomologyOfSubGroupSeries(S,n,p,Resolution_Algorithm)</C>
<P/>

Inputs a positive integer <M>n</M> and a decreasing chain <M>S=[S_1,  S_2, ..., S_k]</M> of  subgroups in a finite  <M>p</M>-group
<M>G=S_1</M>.

It returns the bar code of the persistent mod <M>p</M> homology in degree <M>n</M> of the sequence of inclusion
homomorphisms
<M>S_k \rightarrow S_{k-1} \rightarrow ... \rightarrow S_1=G </M>. The bar code is returned as a binary matrix.
<P/>
Non prime-power (and possibly infinite) groups <M>G</M> can also be handled; in this case the prime must be entered as a third argument, and the resolution algorithm (e.g. ResolutionNilpotentGroup) must be entered as a fourth argument.
</Item>
</Row>



<Row>
<Item>
<Index> PersistentHomologyOfFilteredChainComplex </Index>
<C>PersistentHomologyOfFilteredChainComplex(C,n,p) </C>
<P/>

Inputs a filtered chain complex <M>C</M> (of characteristic <M>0</M> or <M>p</M>) together with a positive integer <M>n</M> and prime <M>p</M>. 

It returns the bar code of the persistent mod <M>p</M> homology in degree <M>n</M> of the 
filtered chain complex <M>C</M>.
 (This function needs a more efficient implementation. Its fine as it stands for investigation in group homology, but not sufficiently efficient for the homology of large complexes arising in applied topology.)

</Item>
</Row>


<Row>
<Item>
<C>PersistentHomologyOfCommutativeDiagramOfPGroups(D,n) </C>
<P/>

Inputs  a commutative diagram <M>D</M> of finite <M>p</M>-groups and a positive integer <M>n</M>. It
returns a list containing, for each homomorphism in the nerve of <M>D</M>,
a triple <M>[k,l,m]</M> where <M>k</M> is
 the dimension of the source of the induced mod <M>p</M> homology map in degree <M>n</M>, <M>l</M> is the dimension of the image, and <M>m</M> is
 the dimension of the cokernel.
</Item>
</Row>

<Row>
<Item>
<Index>PersistentHomologyOfFilteredCubicalComplex </Index>
<C>PersistentHomologyOfFilteredCubicalComplex(M,n)</C>
<P/>
Inputs a filtered pure cubical complex <M>M</M> and a 
non-negative integer <M>n</M>. It returns the degree <M>n</M> persistent 
homology of <M> M</M> with rational coefficients.
  </Item> </Row>


<Row>
<Item>
<Index>  PersistentHomologyOfPureCubicalComplex</Index>
<C>PersistentHomologyOfPureCubicalComplex(L,n,p)</C>
<P/>

Inputs a positive integer <M>n</M>, a prime <M>p</M> and an increasing chain <M>L=[L_1,  L_2, ..., L_k]</M> of  subcomplexes 
in a pure cubical complex <M>L_k</M>.

It returns the bar code of the persistent mod <M>p</M> homology in degree <M>n</M> of the sequence of inclusion
maps.
 The bar code is returned as a  matrix. (This function is extremely inefficient and it is better to use PersistentHomologyOFilteredfPureCubicalComplex.
<P/>
</Item>
</Row>

<Row>
<Item>
<Index>ZZPersistentHomologyOfPureCubicalComplex</Index>
<C>ZZPersistentHomologyOfPureCubicalComplex(L,n,p)</C>
<P/>

Inputs a positive integer <M>n</M>, a prime <M>p</M> and any sequence <M>L=[L_1,  L_2, ..., L_k]</M> of  subcomplexes
of some  pure cubical complex.

It returns the bar code of the zig-zag persistent mod <M>p</M> homology in degree <M>n</M> of the sequence of 
maps  <M>L_1 \rightarrow L_1 \cup L_2 \leftarrow L_2 \rightarrow L_2 \cup L_3 \leftarrow L_4 \rightarrow ... \leftarrow L_k</M>.
 The bar code is returned as a  matrix.
<P/>
</Item>
</Row>


<Row>
<Item>
<Index>RipsHomology </Index>
<C>RipsHomology(G,n)</C>
<C>RipsHomology(G,n,p)</C>

<P/>
Inputs a graph <M>G</M>, a non-negative integer <M>n</M> (and optionally a prime number <M>p</M>). It returns the integral  homology (or mod p homology) in degree <M>n</M> of the Rips complex of <M>G</M>.

</Item>
</Row>



<Row>
<Item>
<Index> BarCode </Index>
<C>BarCode(P)</C>
<P/>
Inputs an integer persistence matrix P and returns the same information in the form of a binary matrix (corresponding to the usual bar code).

</Item>
</Row>

<Row>
<Item>
<Index> BarCodeDisplay </Index>
<Index> BarCodeCompactDisplay </Index>
<C>BarCodeDisplay(P)</C>
<C>BarCodeDisplay(P,"mozilla")</C>
<C>BarCodeCompactDisplay(P)</C>
<C>BarCodeCompactDisplay(P,"mozilla")</C>
<P/>
Inputs an integer persistence matrix P, and an optional string specifying a viewer/browser. It  displays a picture of the bar code (using GraphViz software).
The compact display is better for large bar codes.
</Item>
</Row>



<Row>
<Item>
<Index> Homology </Index>
<C>Homology(X,n)</C>
<P/>

Inputs either a chain complex <M>X=C</M> or a chain map 
<M>X=(C \longrightarrow D)</M>.
<List>
<Item>If <M>X=C</M> then the torsion coefficients of <M>H_n(C)</M>
are retuned.</Item>
<Item> If <M>X=(C \longrightarrow D)</M> then the induced homomorphism 
<M>H_n(C) \longrightarrow  H_n(D)</M> is returned as a homomorphism of 
finitely presented groups. </Item>
</List>
A <M>G</M>-complex <M>C</M> can also be input. The homology groups of such a complex may not be abelian. <B>Warning:</B> in this case Homology(C,n) returns the abelian invariants of the <M>n</M>-th homology group of <M>C</M>. 
</Item>
</Row>

<Row>
<Item>
<Index> HomologyPb </Index>
<C>HomologyPb(C,n)</C>
<P/>

This is a back-up function which might work in some instances 
where <M>Homology(C,n)</M> fails. 
It is most useful for chain complexes whose boundary homomorphisms are sparse.
<P/>
It inputs a chain complex <M>C</M> in characteristic <M>0</M>
and returns the torsion coefficients of <M>H_n(C)</M> . 
There is a small probability that an incorrect answer could be returned. 
The computation relies on probabilistic Smith Normal Form 
algorithms implemented in the Simplicial Homology GAP package. 
This package therefore needs to be loaded.
The computation is stored as a component of <M>C</M> so, when called a second
time for a given <M>C</M> and <M>n</M>, the calculation
is recalled without rerunning the algorithm.

<P/>
The choice of probabalistic algorithm can be changed using the command

<P/> SetHomologyAlgorithm(HomologyAlgorithm[i]);<P/>

where i = 1,2,3 or 4. The upper limit for the probability of an 
incorrect answer can be set to any rational number <M>0</M>&tlt;<M>e</M>&tlt;=
<M>1</M> using the following command.

<P/>SetUncertaintyTolerence(e);<P/>

See the Simplicial Homology package manual for further details.
</Item>
</Row>

<Row>
<Item>
<Index> HomologyVectorSpace </Index>
<C>HomologyVectorSpace(X,n)</C>
<P/>

Inputs either a chain complex <M>X=C</M> or a chain map
<M>X=(C \longrightarrow D)</M> in prime characteristic.
<List>
<Item>If <M>X=C</M> then  <M>H_n(C)</M>
is retuned as a vector space.</Item>
<Item> If <M>X=(C \longrightarrow D)</M> then the induced homomorphism
<M>H_n(C) \longrightarrow  H_n(D)</M> is returned as a homomorphism of
vector spaces. </Item>
</List>
</Item>
</Row>


<Row>
<Item>
<Index>HomologyPrimePart</Index>
<C>HomologyPrimePart(C,n,p)</C>
<P/>

Inputs a chain complex <M>C</M> in characteristic 0, 
a positive integer <M>n</M>, and a prime <M>p</M>. It returns a list of
those torsion coefficients of <M>H_n(C)</M> that are positive powers of <M>p</M>.

 The function uses the EDIM GAP package by Frank Luebeck.
</Item>
</Row>

<Row>
<Item>
<Index>  LeibnizAlgebraHomology</Index>
<C>LeibnizAlgebraHomology(A,n)</C>
<P/>

Inputs a Lie or Leibniz algebra <M>X=A</M> 
(over the ring of integers <M>Z</M> or over a field <M>K</M>), 
together with a positive integer <M>n</M>. 
It returns the <M>n</M>-dimensional Leibniz homology of <M>A</M>.
</Item>
</Row>

<Row>
<Item>
<Index> LieAlgebraHomology </Index>
<C>LieAlgebraHomology(A,n)</C>
<P/>

Inputs a Lie algebra <M>A</M> (over the integers or a field) 
and a positive integer <M>n</M>. 
It returns the homology <M>H_n(A,k)</M>  where  <M>k</M>
denotes the ground ring.
</Item>
</Row>


<Row>
<Item>
<Index> PrimePartDerivedFunctor </Index>
<C>PrimePartDerivedFunctor(G,R,F,n)</C>
<P/>

Inputs a finite group <M>G</M>, a positive integer <M>n</M>, 
at least <M>n+1</M> terms of a <M>ZP</M>-resolution for a Sylow subgroup 
<M>P</M>&tlt;<M>G</M> and a "mathematically suitable" covariant additive functor 
<M>F</M> such as TensorWithIntegers . It returns the abelian invariants of the 
<M>p</M>-component of the  homology <M>H_n(F(R))</M> .
<P/>
Warning: All calculations are assumed to be in characteristic 0. 
The function should not be used if the coefficient module is over the field of 
<M>p</M> elements.
<P/>
"Mathematically suitable" means that the Cartan-Eilenberg double coset formula must hold.
</Item>
</Row>

<Row>
<Item>
<Index> RankHomologyPGroup</Index>
<C>RankHomologyPGroup(G,n)</C>
<C>RankHomologyPGroup(R,n)</C>
<C>RankHomologyPGroup(G,n,"empirical")</C>
<P/>

Inputs a (smallish) <M>p</M>-group <M>G</M>, or <M>n</M> 
terms of a minimal <M>Z_pG</M>-resolution <M>R</M> of <M>Z_p</M> , 
together with a positive integer <M>n</M>. It returns the minimal 
number of generators of the integral homology group <M>H_n(G,Z)</M>.
<P/>
If an option third string argument "empirical" is included then an 
empirical algorithm will be used. This is one which always seems 
to yield the right answer but  which we can't prove yields the 
correct answer.
</Item>
</Row>

<Row>
<Item>
<Index> RankPrimeHomology</Index>
<C>RankPrimeHomology(G,n)</C>
<P/>

Inputs a (smallish) <M>p</M>-group <M>G</M> 
together with a positive integer <M>n</M>. 
It returns a function <M>dim(k)</M> which gives the rank of the 
vector space
<M>H_k(G,Z_p)</M> for all <M>0</M> &tlt;= <M>k</M> &tlt;= <M>n</M>.
</Item>
</Row>
</Table>
</Chapter>


