# isWellDefined(ComplexMap) -- whether a map of chain complexes is well-defined

## Synopsis

• Function: isWellDefined
• Usage:
isWellDefined f
• Inputs:
• f, ,
• Outputs:
• , that is true when f determines a well defined complex map

## Description

A map of chain complexes $f : C \to D$ of degree $d$ is a sequence of maps $f_i : C_i \to D_{d+i}$. No relationship is required between these maps and the differentials in the source and target.

This routine checks that $C$ and $D$ are well-defined chain complexes, and that, for each $f_i$, the source and target equal $C_i$ and $D_{d+i}$, respectively. If the variable debugLevel is set to a value greater than zero, then information about the nature of any failure is displayed.

Unlike the corresponding function for Complexes, the basic constructors for complex maps are all but assured to be well defined. The only case that could cause a problem is if one constructs the source or target complex, and those are not well defined.

 i1 : R = ZZ/101[a,b,c]; i2 : C = freeResolution coker matrix{{a^2-b^2,b^3-c^3,c^4}} 1 3 3 1 o2 = R <-- R <-- R <-- R 0 1 2 3 o2 : Complex i3 : D = freeResolution coker vars R 1 3 3 1 o3 = R <-- R <-- R <-- R 0 1 2 3 o3 : Complex i4 : H = hashTable { 0 => map(D_0, C_0, 1), 1 => map(D_1, C_1, {{a, 0, 0}, {-b, b^2, 0}, {0, -c^2, c^3}}), 2 => map(D_2, C_2, {{a*b^2, 0, 0}, {-a*c^2, a*c^3, 0}, {b*c^2, -b*c^3, b^2*c^3}}), 3 => map(D_3, C_3, {{a*b^2*c^3}}) } o4 = HashTable{0 => | 1 | } 1 => {1} | a 0 0 | {1} | -b b2 0 | {1} | 0 -c2 c3 | 2 => {2} | ab2 0 0 | {2} | -ac2 ac3 0 | {2} | bc2 -bc3 b2c3 | 3 => {3} | ab2c3 | o4 : HashTable i5 : f = map(D, C, H) 1 1 o5 = 0 : R <--------- R : 0 | 1 | 3 3 1 : R <--------------------- R : 1 {1} | a 0 0 | {1} | -b b2 0 | {1} | 0 -c2 c3 | 3 3 2 : R <-------------------------- R : 2 {2} | ab2 0 0 | {2} | -ac2 ac3 0 | {2} | bc2 -bc3 b2c3 | 1 1 3 : R <----------------- R : 3 {3} | ab2c3 | o5 : ComplexMap i6 : assert isWellDefined f i7 : assert isHomogeneous f i8 : assert(degree f == 0) i9 : assert isComplexMorphism f

We construct two random maps of chain complexes, and check to see that, as should be the case, both are well defined.

 i10 : g = randomComplexMap(D,C) 1 1 o10 = 0 : R <---------- R : 0 | 24 | 3 3 1 : R <---------------------------------------------------------------------------------------------------------------- R : 1 {1} | -36a-30b-29c -29a2-24ab-16b2-38ac+39bc+21c2 16a3+22a2b-34ab2+47b3+45a2c-48abc+19b2c-47ac2-16bc2+7c3 | {1} | 19a+19b-10c 34a2+19ab-39b2-47ac-18bc-13c2 15a3-23a2b+43ab2+48b3+39a2c-17abc+36b2c-11ac2+35bc2+11c3 | {1} | -29a-8b-22c -43a2-15ab-47b2-28ac+38bc+2c2 -38a3+33a2b+11ab2+b3+40a2c+46abc-3b2c-28ac2+22bc2-47c3 | 3 3 2 : R <--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- R : 2 {2} | -23a3-7a2b+29ab2-37b3+2a2c-47abc-13b2c+15ac2-10bc2+30c3 44a4-39a3b+9a2b2+13ab3-11b4+36a3c-39a2bc-26ab2c-8b3c+4a2c2+22abc2+43b2c2-49ac3-8bc3+36c4 -29a5-48a4b-37a3b2+28a2b3+40ab4+13b5+30a4c+47a3bc-18a2b2c-22ab3c-17b4c-49a3c2+46a2bc2+10ab2c2-13b3c2+a2c3+7abc3+3b2c3+30ac4-41bc4+8c5 | {2} | -18a3+39a2b-22ab2-32b3+27a2c+32abc-20b2c-9ac2+24bc2-30c3 -3a4-22a3b+41a2b2-6ab3+6b4-30a3c+16a2bc+35ab2c+40b3c-28a2c2-9abc2+3b2c2-35ac3-31bc3+25c4 8a5-29a4b-46a3b2+42a2b3+18ab4+27b5+30a4c+49a3bc+23a2b2c-16ab3c-21b4c-18a3c2-28a2bc2-46ab2c2+23b3c2+15a2c3+12abc3-37b2c3-18ac4-23bc4+44c5 | {2} | -48a3-15a2b-33b3+39a2c+33abc-19b2c-49ac2+17bc2-20c3 -2a4-41a3b-13a2b2-47ab3-35b4-49a3c+4a2bc+27ab2c-31b3c+30a2c2-40abc2-39b2c2+37ac3-31bc3-48c4 -39a5+20a4b+47a2b3-33ab4-37b5+19a4c-47a3bc-28a2b2c+28ab3c-33b4c-28a3c2+6a2bc2-29ab2c2-28b3c2-9a2c3+26abc3+42b2c3+5ac4+44bc4+30c5 | 1 1 3 : R <-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- R : 3 {3} | 4a6+22a5b-20a4b2+15a3b3+9a2b4+16ab5-30b6+5a5c-13a4bc-4a3b2c-2a2b3c+10ab4c-4b5c-29a4c2+12a3bc2+20a2b2c2+31ab3c2-14b4c2+3a3c3-26a2bc3+28ab2c3-33b3c3+33a2c4-6abc4-42b2c4+21ac5-44bc5-5c6 | o10 : ComplexMap i11 : assert isWellDefined g i12 : assert not isCommutative g
 i13 : h = randomComplexMap(D,C, Cycle => true) 1 1 o13 = 0 : R <----------- R : 0 | -17 | 3 3 1 : R <------------------------------------------------------------------------------------------------------------- R : 1 {1} | -17a-29b-44c -49ab-b2+48ac-50bc-40c2 33a2b-9ab2+46b3-43a2c+35abc+27b2c+50ac2+45bc2+49c3 | {1} | 29a+17b-42c 49a2+ab-17b2+11ac+19bc-45c2 -33a3+9a2b-46ab2-41a2c-29abc-36b2c-47ac2+40bc2-45c3 | {1} | 44a+42b -48a2+39ab-19b2+40ac+45bc+17c2 43a3+6a2b+2ab2+36b3-50a2c+2abc-40b2c-49ac2+45bc2-17c3 | 3 3 2 : R <---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- R : 2 {2} | 49a3+a2b+35ab2-30b3-a2c+37abc+48b2c+34ac2+16bc2-2c3 -33a4+9a3b-13a2b2-9ab3+46b4+21a3c-40a2bc-ab2c-7b3c-8a2c2-42abc2-44b2c2-49ac3+26bc3+44c4 -33a2b3+9ab4-46b5-16a4c-35a3bc-4a2b2c-7ab3c+2b4c-39a3c2-24a2bc2-23ab2c2-19b3c2+a2c3-27abc3+b2c3-15ac4+15bc4-39c5 | {2} | -48a3-50a2b+11ab2-41b3+40a2c-34abc+45b2c+17ac2+31bc2+44c3 43a4+45a3b-30a2b2+36ab3+34b4-50a3c-37a2bc-9ab2c-12b3c-49a2c2+49abc2+23b2c2-17ac3+28bc3-44c4 16a4b+35a3b2+47a2b3-28ab4-29b5+39a3bc+24a2b2c-27ab3c-26b4c+32a2bc2+18ab2c2-4b3c2-43a2c3+abc3+11b2c3-3ac4+34bc4+9c5 | {2} | -12a3+18a2b-42ab2-23b3-22a2c+16abc-45b2c-31ac2-17bc2+42c3 -39a4-11a3b-6a2b2-36ab3-36b4+39a3c+19a2bc+10ab2c+40b3c-4a2c2+26abc2-45b2c2-28ac3+17bc3-42c4 -16a5-35a4b-4a3b2+34a2b3+31ab4+36b5-39a4c-24a3bc-23a2b2c+28ab3c-40b4c-32a3c2-18a2bc2-45ab2c2+45b3c2-7a2c3-13abc3+48b2c3+26ac4-42bc4+11c5 | 1 1 3 : R <------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- R : 3 {3} | -16a6-35a5b+12a4b2+7a3b3+46a2b4+8ab5+5b6-39a5c-24a4bc+16a3b2c+13a2b3c-36ab4c-38b5c-32a4c2-18a3bc2-13a2b2c2-34ab3c2+19b4c2-46a3c3-24a2bc3+49ab2c3+5b3c3-48a2c4-5abc4+43b2c4-15ac5+42bc5+42c6 | o13 : ComplexMap i14 : assert isWellDefined h i15 : assert isComplexMorphism h

This method also checks the following aspects of the data structure:

• The underlying hash table has exactly the expected keys, namely, source, target, degree, map, cache
• The ring of the source and target are the same
• The source and target are well defined complexes
• The degree is an integer
• All keys in the map field are integers, in the range of the concentration of the source
• The source and target of each $f_i$ is as expected
• If the isCommutative key is present in the cache table, then commutativity of the map with the differentials is checked