CocycleCondition(R,n):: FreeRes, Int --> IntMat

Inputs a free \mathbb ZG-resolution R of \mathbb Z and an integer n \ge 1. It returns an integer matrix M with the following property. Let d be the \mathbb ZG-rank of R_n. An integer vector f=[f_1, ... , f_d] then represents a \mathbb ZG-homomorphism R_n \rightarrow \mathbb Z_q which sends the ith generator of R_n to the integer f_i in the trivial \mathbb ZG-module \mathbb Z_q=\mathbb Z/q{\mathbb Z} (where possibly q=0). The homomorphism f is a cocycle if and only if M^tf=0 mod q.