Skip to content

Commit

Permalink
fixup pullback is now a shared method with arbitrary options
Browse files Browse the repository at this point in the history
  • Loading branch information
mahrud committed Jan 2, 2024
1 parent 2a0032a commit 6f5027f
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 26 deletions.
2 changes: 1 addition & 1 deletion M2/Macaulay2/m2/shared.m2
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ chi = method()
cone = method()
rays = method()

pullback = method()
pullback = method(Options => true)
pushout = method()

decompose = method(Options => true)
Expand Down
3 changes: 1 addition & 2 deletions M2/Macaulay2/packages/DiffAlg.m2
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,7 @@ linearComb(List,String) := DiffAlgElement => (L,varName) -> (
new class L_0 from {"f" => sum apply(gens C,L,(i,j)->sub(i,T)*sub(j,T))}
)

pullback = method();
pullback(List,DiffAlgForm) := DiffAlgForm => (L,w) -> (
pullback(List,DiffAlgForm) := DiffAlgForm => {} >> o -> (L,w) -> (
x := getSymbol VAR;
dx := getSymbol (VARD|VAR);
if not uniform L or class L_0 =!= DiffAlgForm or
Expand Down
13 changes: 5 additions & 8 deletions M2/Macaulay2/packages/Divisor.m2
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export{
"toQWeilDivisor", --added checks
"toRWeilDivisor", --added checks
--divisors to modules and functorial properties
"pullback", --added checks
--"pullback", --added checks
"findElementOfDegree", --added checks
"getLinearDiophantineSolution", --added checks --has Safe option
"canonicalDivisor", --added checks --has IsGraded option
Expand Down Expand Up @@ -932,9 +932,7 @@ ideal( RWeilDivisor ) := Ideal=> (D) ->
--Give a ring map f: R -> S for which we assume is finite or flat, we want to construct its pullback from Div X to Div Y
--where Div X = Spec S and Div Y = Spec R. If the map is neither finite or flat, then this method can produce unexpected results unless the divisor is Cartier (which the function checks for).

pullback = method(Options => {Strategy => Primes});

pullback(RingMap, RWeilDivisor) := BasicDivisor => o->(f, D) ->
pullback(RingMap, RWeilDivisor) := BasicDivisor => {Strategy => Primes} >> o -> (f, D) ->
(
if ( not (ring D === source f) ) then error "(pullback, WeilDivisor): Expected the Divisor and the source of the map to have the same ambient ring.";

Expand Down Expand Up @@ -3263,7 +3261,7 @@ doc ///
Text
If {\tt Strategy=>Primes} then the pullback method will pull back each prime individually.
SeeAlso
pullback
(pullback, RingMap, RWeilDivisor)
Sheaves
///

Expand All @@ -3276,7 +3274,7 @@ doc ///
Text
If {\tt Strategy => Sheaves} then the pullback method will pull back the sheaf $O(D)$.
SeeAlso
pullback
(pullback, RingMap, RWeilDivisor)
Primes
///

Expand Down Expand Up @@ -3460,9 +3458,8 @@ doc ///

doc ///
Key
pullback
(pullback, RingMap, RWeilDivisor)
[pullback, Strategy]
[(pullback, RingMap, RWeilDivisor), Strategy]
Headline
pullback a divisor under a ring map
Usage
Expand Down
3 changes: 1 addition & 2 deletions M2/Macaulay2/packages/GKMVarieties.m2
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,7 @@ map(GKMVariety,GKMVariety,List) := EquivariantMap => opts -> (X,Y,L) -> (
)

--pullback map of KClasses given a EquivariantMap
--pullback = method(); --from version 1.16 onward "pullback" is a built-in global variable
pullback(EquivariantMap) := FunctionClosure => phi -> (
pullback(EquivariantMap) := FunctionClosure => {} >> o -> phi -> (
X := phi.source;
Y := phi.target;
if not phi.cache.?pullback then phi.cache.pullback = C -> (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ doc ///
makeKClass
(isWellDefined, KClass)
pushforward
pullback
(pullback, EquivariantMap)
(euler, KClass)

///
Expand Down Expand Up @@ -594,7 +594,7 @@ doc ///
(isWellDefined, KClass)
(symbol *, KClass, KClass)
(symbol +, KClass, KClass)
pullback
(pullback, EquivariantMap)
pushforward
///

Expand Down Expand Up @@ -850,7 +850,7 @@ doc ///
(compose, EquivariantMap, EquivariantMap)
(map, GKMVariety, GKMVariety, List)
flagMap
pullback
(pullback, EquivariantMap)
pushforward
(euler, KClass)
///
Expand Down
6 changes: 3 additions & 3 deletions M2/Macaulay2/packages/NormalToricVarieties/ToricMaps.m2
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ rayMaxList ToricMap := List => (cacheValue symbol maxRayList) (f -> (
)
)

pullback (ToricMap, ToricDivisor) := ToricDivisor => (f, D) -> (
pullback (ToricMap, ToricDivisor) := ToricDivisor => {} >> o -> (f, D) -> (
if not isCartier D then error "-- expected a Cartier divisor";
cartierData := cartierCoefficients D;
A := matrix f;
Expand All @@ -382,12 +382,12 @@ pullback (ToricMap, ToricDivisor) := ToricDivisor => (f, D) -> (
(transpose cartierData_(maxConeIndices_i) * rho)_(0,0) * X_i
)
)
pullback (ToricMap, Module) := Module => (f, M) -> (
pullback (ToricMap, Module) := Module => {} >> o -> (f, M) -> (
if ring target f =!= ring M then
error "-- expected module over the Cox ring of the target";
(inducedMap f) ** M
)
pullback (ToricMap, CoherentSheaf) := CoherentSheaf => (f, F) -> (
pullback (ToricMap, CoherentSheaf) := CoherentSheaf => {} >> o -> (f, F) -> (
sheaf (source f, pullback(f, module F))
)

Expand Down
7 changes: 2 additions & 5 deletions M2/Macaulay2/packages/Pullback.m2
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ Reload => false
--************************************************************************************************************
--************************************************************************************************************

export{"pullback"}
pullback = method(Options => {Verbose => false});

pullback(RingMap, RingMap) := o -> (f,g) -> (
pullback(RingMap, RingMap) := {Verbose => false} >> o -> (f,g) -> (
-- throughout A ---f-->> A/I <-----g----C
-- ^ ^
-- \ /
Expand Down Expand Up @@ -402,7 +399,7 @@ document{
}

document{
Key => {pullback,(pullback,RingMap,RingMap),[pullback,Verbose]},
Key => {(pullback,RingMap,RingMap),[(pullback,RingMap,RingMap),Verbose]},
Headline => "Compute the pullback of a diagram of rings",
TEX "The pullback functor in the category of rings. Given ring maps $f : A \\to B$ and $g : C \\to B$, this tries to compute the pullback of $\\{A \\to B \\leftarrow C\\}$ in the category of rings. It requires that $A \\to B$ is a surjective map of rings (otherwise it will give an error) and it requires that $C \\to B$ is finite (otherwise it will never terminate). Currently, it requires that the variable names of the rings $A$ and $C$ are distinct and that the variable names of $A$ are variable names of $B$ and those variables get sent to one another. If the Verbose option is turned on, then certain steps in the process will be specified.",
Usage => "pullback(f,g)",
Expand Down
4 changes: 2 additions & 2 deletions M2/Macaulay2/packages/Varieties/SheafMaps.m2
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ CoherentSheaf ++ CoherentSheaf := CoherentSheaf => (F, G) -> directSum(F, G)
components CoherentSheaf := List => F -> if F.cache.?components then F.cache.components else {F}

-- TODO: also for a list of matrices
pullback(Matrix, Matrix) := Module => (f, g) -> (
pullback(Matrix, Matrix) := Module => {} >> o -> (f, g) -> (
if target f =!= target g then error "expected maps with the same target";
h := f | -g;
P := ker h;
Expand All @@ -445,7 +445,7 @@ pullback(Matrix, Matrix) := Module => (f, g) -> (
map(source f, S, S^[0], Degree => - degree f) * inducedMap(S, P),
map(source g, S, S^[1], Degree => - degree g) * inducedMap(S, P)};
P)
pullback(SheafMap, SheafMap) := CoherentSheaf => (f, g) -> (
pullback(SheafMap, SheafMap) := CoherentSheaf => {} >> o -> (f, g) -> (
-- TODO: use != instead
if target f =!= target g then error "expected maps with the same target";
h := map(target f, source f ++ source g, matrix f | -matrix g);
Expand Down

0 comments on commit 6f5027f

Please sign in to comment.