Skip to content

Commit

Permalink
changes to documentation, including use of ofClass and Hom to \operat…
Browse files Browse the repository at this point in the history
…orname{Hom}, imported a test from Core related to total Ext
  • Loading branch information
mikestillman committed Sep 9, 2024
1 parent 325328b commit 6884cfb
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 63 deletions.
55 changes: 26 additions & 29 deletions M2/Macaulay2/packages/Complexes/ChainComplexDoc.m2
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ doc ///
TO (Ext, ZZ, Module, Module),
TO (Ext, ZZ, Matrix, Module),
TO (Ext, ZZ, Module, Matrix),
TO (Ext, Module, Module),
TO (Hom, Complex, Complex),
TO (Hom, ComplexMap, ComplexMap),
TO (homomorphism, ComplexMap),
Expand Down Expand Up @@ -2350,10 +2351,8 @@ doc ///
Usage
D = C1 ** C2
Inputs
C1:Complex
or @ofClass Module@
C2:Complex
or @ofClass Module@
C1:{Module}
C2:{Module}
Outputs
D:Complex
tensor product of {\tt C1} and {\tt C2}
Expand Down Expand Up @@ -2410,19 +2409,17 @@ doc ///
Usage
D = Hom(C1,C2)
Inputs
C1:Complex
or @ofClass Module@, or @ofClass Ring@
C2:Complex
or @ofClass Module@, or @ofClass Ring@
C1:{Module, Ring}
C2:{Module, Ring}
Outputs
D:Complex
the complex of homomorphisms between {\tt C1} and {\tt C2}
Description
Text
The complex of homomorphisms is a complex $D$ whose $i$th component is
the direct sum of $Hom(C1_j, C2_{j+i})$ over all $j$.
The differential on $Hom(C1_j, C2_{j+i})$ is the differential
$Hom(id_{C1}, dd^{C2}) + (-1)^j Hom(dd^{C1}, id_{C2})$.
the direct sum of $\operatorname{Hom}(C1_j, C2_{j+i})$ over all $j$.
The differential on $\operatorname{Hom}(C1_j, C2_{j+i})$ is the differential
$\operatorname{Hom}(id_{C1}, dd^{C2}) + (-1)^j \operatorname{Hom}(dd^{C1}, id_{C2})$.
$dd^{C1} \otimes id_{C2} + (-1)^j id_{C1} \otimes dd^{C2}$.

In particular, for this operation to be well-defined, both
Expand All @@ -2434,7 +2431,7 @@ doc ///
dd^D
assert isWellDefined D
Text
The homology of this complex is $Hom(C, ZZ/101)$
The homology of this complex is $\operatorname{Hom}(C, ZZ/101)$
Example
prune HH D == Hom(C, coker vars S)
Text
Expand Down Expand Up @@ -2481,17 +2478,17 @@ doc ///
g = homomorphism f
Inputs
f:ComplexMap
a map of the form $f : R^1 \to Hom(C, D)$, where
a map of the form $f : R^1 \to \operatorname{Hom}(C, D)$, where
$C$ and $D$ are complexes,
$Hom(C,D)$ has been previously computed, and $R$ is
$\operatorname{Hom}(C,D)$ has been previously computed, and $R$ is
the underlying ring of these complexes
Outputs
g:ComplexMap
the corresponding map of chain complexes from $C$ to $D$
Description
Text
As a first example, consider two Koszul complexes $C$ and $D$.
From a random map $f : R^1 \to Hom(C, D)$, we construct
From a random map $f : R^1 \to \operatorname{Hom}(C, D)$, we construct
the corresponding map of chain complexes $g : C \to D$.
Example
R = ZZ/101[a,b,c]
Expand All @@ -2504,9 +2501,9 @@ doc ///
isWellDefined g
assert not isCommutative g
Text
The map $g : C \to D$ corresponding to a random map into $Hom(C,D)$
The map $g : C \to D$ corresponding to a random map into $\operatorname{Hom}(C,D)$
does not generally commute with the differentials. However, if the
element of $Hom(C,D)$ is a cycle, then the corresponding map does commute.
element of $\operatorname{Hom}(C,D)$ is a cycle, then the corresponding map does commute.
Example
f = randomComplexMap(H, complex R^{-2}, Cycle => true)
isWellDefined f
Expand Down Expand Up @@ -2552,12 +2549,12 @@ doc ///
from $C$ to $D$
Outputs
f:ComplexMap
a map of the form $f : R^1 \to Hom(C, D)$, where
a map of the form $f : R^1 \to \operatorname{Hom}(C, D)$, where
$R$ is the underlying ring of these complexes
Description
Text
As a first example, consider two Koszul complexes $C$ and $D$.
From a random map $f : R^1 \to Hom(C, D)$, we construct
From a random map $f : R^1 \to \operatorname{Hom}(C, D)$, we construct
the corresponding map of chain complexes $g : C \to D$.
Example
R = ZZ/101[a,b,c]
Expand All @@ -2568,9 +2565,9 @@ doc ///
f = homomorphism' g
isWellDefined f
Text
The map $g : C \to D$ corresponding to a random map into $Hom(C,D)$
The map $g : C \to D$ corresponding to a random map into $\operatorname{Hom}(C,D)$
does not generally commute with the differentials. However, if the
element of $Hom(C,D)$ is a cycle, then the corresponding map does commute.
element of $\operatorname{Hom}(C,D)$ is a cycle, then the corresponding map does commute.
Example
g = randomComplexMap(D, C, Cycle => true, InternalDegree => 3)
isWellDefined g
Expand Down Expand Up @@ -2613,7 +2610,7 @@ doc ///
method returns the corresponding map of complexes of degree $i$.
Text
As a first example, consider two Koszul complexes $C$ and $D$.
From a random map $f \colon R^1 \to Hom(C, D)$, we construct
From a random map $f \colon R^1 \to \operatorname{Hom}(C, D)$, we construct
the corresponding map of chain complexes $g \colon C \to D$.
Example
R = ZZ/101[a,b,c];
Expand All @@ -2625,9 +2622,9 @@ doc ///
assert isWellDefined g
assert not isCommutative g
Text
The map $g \colon C \to D$ corresponding to a random map into $Hom(C,D)$
The map $g \colon C \to D$ corresponding to a random map into $\operatorname{Hom}(C,D)$
does not generally commute with the differentials. However, if the
element of $Hom(C,D)$ is a cycle, then the corresponding map does commute.
element of $\operatorname{Hom}(C,D)$ is a cycle, then the corresponding map does commute.
Example
h = randomComplexMap(E, complex R^{-2}, Cycle => true, Degree => -1)
f = h_0
Expand Down Expand Up @@ -2751,7 +2748,7 @@ doc ///
:Complex
Description
Text
The dual of a complex $C$ is by definition $Hom(C, R)$, where $R$ is the ring of $C$.
The dual of a complex $C$ is by definition $\operatorname{Hom}(C, R)$, where $R$ is the ring of $C$.
Example
S = ZZ/101[a..d];
B = intersect(ideal(a,c),ideal(b,d))
Expand Down Expand Up @@ -4385,10 +4382,10 @@ doc ///
Usage
Ext(M, N)
Inputs
M:Module
or ofClass{Ideal,Ring}, that is homogeneous
N:Module
or ofClass{Ideal,Ring} over the same ring as $M$, that is also homogeneous
M:{Ideal, Ring}
that is homogeneous
N:{Ideal, Ring}
over the same ring as $M$, that is also homogeneous
Outputs
:Module
the $\operatorname{Ext}$ module of $M$ and $N$, as a
Expand Down
4 changes: 2 additions & 2 deletions M2/Macaulay2/packages/Complexes/Ext.m2
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Ext(Module, Module) := Module => opts -> (M, N) -> (
blks := new MutableHashTable;
blks#(exponents 1_Rmon) = C.dd;
scan(0 .. c-1, i ->
blks#(exponents Rmon_i) = nullHomotopy (- f_i*id_C));
blks#(exponents Rmon_i) = nullHomotopy(- f_i*id_C, FreeToExact => true));
-- a helper function to list the factorizations of a monomial
factorizations := (gamma) -> (
-- Input: gamma is the list of exponents for a monomial
Expand All @@ -81,7 +81,7 @@ Ext(Module, Module) := Module => opts -> (M, N) -> (
then blks#alpha * blks#beta
else 0));
-- compute and save the nonzero nullhomotopies
if s != 0 then blks#gamma = nullhomotopy s))));
if s != 0 then blks#gamma = nullHomotopy(s, FreeToExact => true)))));
-- make a free module whose basis elements have the right degrees
(loC, hiC) := concentration C;
Cstar := S^(apply(toList(loC..hiC),
Expand Down
16 changes: 16 additions & 0 deletions M2/Macaulay2/packages/Complexes/FreeResolutionTests.m2
Original file line number Diff line number Diff line change
Expand Up @@ -897,3 +897,19 @@ TEST ///
assert(M === (target epsilon)_0)
///

TEST ///
-- errorDepth = 0
A = ZZ/103[x,y,z];
J = ideal(x^3,y^4,z^5);
B = A/J;
f = matrix {{27*x^2-19*z^2, 38*x^2*y+47*z^3},
{ -5*x^2+z^2, -37*x^2*y+51*x*y^2-36*y^3+11*y*z^2+8*z^3},
{x^2-x*y, z^3}};
M = cokernel f;
N = B^1/(x^2 + z^2,y^3 - 2*z^3);
time E = Ext(M,N); -- used 3.32 seconds in version 0.9.92
t = tally degrees target presentation E
u = new Tally from {{-3, -7} => 7, {-3, -6} => 7, {0, 1} => 3, {0, 2} => 4, {-4, -9} => 4, {-4, -8} => 1, {-4, -7} => 1, {-1, -2} => 4, {-2, -5} => 3,
{-2, -4} => 8}
assert ( t === u )
///
58 changes: 26 additions & 32 deletions M2/Macaulay2/tests/normal/ext-total.m2
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,32 @@ assert ( degs == apply( newdegs, repair ))

heft0 = {-3, 1}
degs1 = {{0, 0}, {0, 0}, {0, 0}, {1, 2}, {1, 3}, {1, 3}, {1, 3}, {1, 3}, {1, 4}, {1, 4}, {1, 4}, {1, 5}, {1, 5}, {1, 5}, {2, 5}, {2, 6}, {2, 6}, {2, 7}, {2, 7}, {2, 7}, {2, 7}, {2, 7}, {2, 7}, {2, 7}, {2, 7}, {2, 7}, {2, 8}, {2, 8}, {2, 8}, {3, 9}, {3, 9}, {3, 9}, {3, 9}, {3, 9}, {3, 9}, {3, 9}};
degs2 = {{0, -2}, {0, -3}, {0, -3}, {0, -4}, {0, -5}, {0, -2}, {0, -3}, {0, -3}, {0, -4}, {0, -5}, {0, -2}, {0, -3}, {0, -3}, {0, -4}, {0, -5}, {1, 0}, {1, -1}, {1, -1}, {1, -2}, {1, -3}, {1, 1}, {1, 0}, {1, 0}, {1, -1}, {1, -2}, {1, 1}, {1, 0}, {1, 0}, {1, -1}, {1, -2}, {1, 1}, {1, 0}, {1, 0}, {1, -1}, {1, -2}, {1, 1}, {1, 0}, {1, 0}, {1, -1}, {1, -2}, {1, 2}, {1, 1}, {1, 1}, {1, 0}, {1, -1}, {1, 2}, {1, 1}, {1, 1}, {1, 0}, {1, -1}, {1, 2}, {1, 1}, {1, 1}, {1, 0}, {1, -1}, {1, 3}, {1, 2}, {1, 2}, {1, 1}, {1, 0}, {1, 3}, {1, 2}, {1, 2}, {1, 1}, {1, 0}, {1, 3}, {1, 2}, {1, 2}, {1, 1}, {1, 0}, {2, 3}, {2, 2}, {2, 2}, {2, 1}, {2, 0}, {2, 4}, {2, 3}, {2, 3}, {2, 2}, {2, 1}, {2, 4}, {2, 3}, {2, 3}, {2, 2}, {2, 1}, {2, 5}, {2, 4}, {2, 4}, {2, 3}, {2, 2}, {2, 5}, {2, 4}, {2, 4}, {2, 3}, {2, 2}, {2, 5}, {2, 4}, {2, 4}, {2, 3}, {2, 2}, {2, 5}, {2, 4}, {2, 4}, {2, 3}, {2, 2}, {2, 5}, {2, 4}, {2, 4}, {2, 3}, {2, 2}, {2, 5}, {2, 4}, {2, 4}, {2, 3}, {2, 2}, {2, 5}, {2, 4}, {2, 4}, {2, 3}, {2, 2}, {2, 5}, {2, 4}, {2, 4}, {2, 3}, {2, 2}, {2, 5}, {2, 4}, {2, 4}, {2, 3}, {2, 2}, {2, 6}, {2, 5}, {2, 5}, {2, 4}, {2, 3}, {2, 6}, {2, 5}, {2, 5}, {2, 4}, {2, 3}, {2, 6}, {2, 5}, {2, 5}, {2, 4}, {2, 3}, {3, 7}, {3, 6}, {3, 6}, {3, 5}, {3, 4}, {3, 7}, {3, 6}, {3, 6}, {3, 5}, {3, 4}, {3, 7}, {3, 6}, {3, 6}, {3, 5}, {3, 4}, {3, 7}, {3, 6}, {3, 6}, {3, 5}, {3, 4}, {3, 7}, {3, 6}, {3, 6}, {3, 5}, {3, 4}, {3, 7}, {3, 6}, {3, 6}, {3, 5}, {3, 4}, {3, 7}, {3, 6}, {3, 6}, {3, 5}, {3, 4}};
degs2 = {{0, -2}, {0, -3}, {0, -3}, {0, -4}, {0, -5}, {0, -2},
{0, -3}, {0, -3}, {0, -4}, {0, -5}, {0, -2}, {0, -3},
{0, -3}, {0, -4}, {0, -5}, {1, 0}, {1, -1}, {1, -1},
{1, -2}, {1, -3}, {1, 1}, {1, 0}, {1, 0}, {1, -1},
{1, -2}, {1, 1}, {1, 0}, {1, 0}, {1, -1}, {1, -2},
{1, 1}, {1, 0}, {1, 0}, {1, -1}, {1, -2}, {1, 1},
{1, 0}, {1, 0}, {1, -1}, {1, -2}, {1, 2}, {1, 1},
{1, 1}, {1, 0}, {1, -1}, {1, 2}, {1, 1}, {1, 1},
{1, 0}, {1, -1}, {1, 2}, {1, 1}, {1, 1}, {1, 0}, {1, -1},
{1, 3}, {1, 2}, {1, 2}, {1, 1}, {1, 0}, {1, 3}, {1, 2},
{1, 2}, {1, 1}, {1, 0}, {1, 3}, {1, 2}, {1, 2}, {1, 1},
{1, 0}, {2, 3}, {2, 2}, {2, 2}, {2, 1}, {2, 0}, {2, 4},
{2, 3}, {2, 3}, {2, 2}, {2, 1}, {2, 4}, {2, 3}, {2, 3},
{2, 2}, {2, 1}, {2, 5}, {2, 4}, {2, 4}, {2, 3}, {2, 2},
{2, 5}, {2, 4}, {2, 4}, {2, 3}, {2, 2}, {2, 5}, {2, 4},
{2, 4}, {2, 3}, {2, 2}, {2, 5}, {2, 4}, {2, 4}, {2, 3},
{2, 2}, {2, 5}, {2, 4}, {2, 4}, {2, 3}, {2, 2}, {2, 5},
{2, 4}, {2, 4}, {2, 3}, {2, 2}, {2, 5}, {2, 4}, {2, 4},
{2, 3}, {2, 2}, {2, 5}, {2, 4}, {2, 4}, {2, 3}, {2, 2},
{2, 5}, {2, 4}, {2, 4}, {2, 3}, {2, 2}, {2, 6}, {2, 5},
{2, 5}, {2, 4}, {2, 3}, {2, 6}, {2, 5}, {2, 5}, {2, 4},
{2, 3}, {2, 6}, {2, 5}, {2, 5}, {2, 4}, {2, 3}, {3, 7},
{3, 6}, {3, 6}, {3, 5}, {3, 4}, {3, 7}, {3, 6}, {3, 6},
{3, 5}, {3, 4}, {3, 7}, {3, 6}, {3, 6}, {3, 5}, {3, 4},
{3, 7}, {3, 6}, {3, 6}, {3, 5}, {3, 4}, {3, 7}, {3, 6},
{3, 6}, {3, 5}, {3, 4}, {3, 7}, {3, 6}, {3, 6}, {3, 5}, {3, 4}, {3, 7}, {3, 6}, {3, 6}, {3, 5}, {3, 4}};
degDB = {-1, 0}

degs' = apply(degs, adjust)
Expand Down Expand Up @@ -57,39 +82,8 @@ assert ( t' === u )
<< "then we do the computation with unadjusted degrees" << endl
comp (degs,heft0,degs1,degs2,degDB)
t = tally degrees target presentation E

assert ( t === u )

-*
the answer changed between these two versions:
u123$ ls -l ~/local.Linux/encap/Macaulay2-0.9.95/bin/M2
-rwxr-xr-x 1 dan academic 5036156 2006-11-06 11:50 /home/25/dan/local.Linux/encap/Macaulay2-0.9.95/bin/M2
u123$ ls -l ~/local.Linux/encap/Macaulay2-0.9.94/bin/M2
-rwxr-xr-x 1 dan academic 5028988 2006-10-24 10:33 /home/25/dan/local.Linux/encap/Macaulay2-0.9.94/bin/M2
*-


-- errorDepth = 0
A = ZZ/103[x,y,z];
J = ideal(x^3,y^4,z^5);
B = A/J;
f = matrix {{27*x^2-19*z^2, 38*x^2*y+47*z^3},
{ -5*x^2+z^2, -37*x^2*y+51*x*y^2-36*y^3+11*y*z^2+8*z^3},
{x^2-x*y, z^3}};
M = cokernel f;
N = B^1/(x^2 + z^2,y^3 - 2*z^3);
-- gbTrace = 3
debugLevel = 99
time E = Ext(M,N);
-- used 3.32 seconds in version 0.9.92
t = tally degrees target presentation E
u = new Tally from {{-3, -7} => 7, {-3, -6} => 7, {0, 1} => 3, {0, 2} => 4, {-4, -9} => 4, {-4, -8} => 1, {-4, -7} => 1, {-1, -2} => 4, {-2, -5} => 3,
{-2, -4} => 8}
assert ( t === u )
-- Local Variables:
-- compile-command: "make -C $M2BUILDDIR/Macaulay2/packages/Macaulay2Doc/test ext-total.out"
-- End:

0 comments on commit 6884cfb

Please sign in to comment.