Skip to content

Commit

Permalink
doc and tests for promote, lift update
Browse files Browse the repository at this point in the history
  • Loading branch information
pzinn committed Oct 7, 2024
1 parent 45ee510 commit 1ff3f83
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 4 deletions.
8 changes: 4 additions & 4 deletions M2/Macaulay2/packages/Macaulay2Doc/doc5.m2
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ document { Key => {(eagonNorthcott,Matrix),eagonNorthcott},

document { Key => {(selectVariables,List,PolynomialRing),selectVariables},
Headline => "make a subring of a polynomial ring generated by selected variables",
Usage => "(S,f) = selectVariables(v,R)",
Usage => "(S,F) = selectVariables(v,R)",
Inputs => {
"v" => {"a sorted list of numbers specifying which variables to select"},
"R"
Expand All @@ -369,13 +369,13 @@ document { Key => {(selectVariables,List,PolynomialRing),selectVariables},
"S" => PolynomialRing => {"a polynomial ring generated as a subring of R by the variables whose indices
occur in the list v, together with the induced monomial ordering"
},
"f" => RingMap => {"the inclusion map from S to R"}
"F" => RingMap => {"the inclusion map from S to R"}
},
EXAMPLE lines ///
(S,f) = selectVariables({2,4}, QQ[a..h,Weights=>1..8]);
(S,F) = selectVariables({2,4}, QQ[a..h,Weights=>1..8]);
describe S
options S
f
F
///
}

Expand Down
43 changes: 43 additions & 0 deletions M2/Macaulay2/packages/Macaulay2Doc/functions/setupLift-doc.m2
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
--- status: DRAFT
--- author(s): PZJ
--- notes:

undocumented methods setupLift

doc ///
Key
setupLift
Headline
automatic lift from one ring to another
Usage
setupLift (f,R,S)
setupLift g
Inputs
f: Function
R: Ring
S: Ring
g: RingMap
Description
Text
There are two possible ways of implementing @TO "lift"@. In the first one, we use a function:
Example
R=QQ[x]
S=QQ[y]
setupPromote map(R,S,{x^2})
setupLift(a->sum(listForm a, (e,c)->if odd first e then error "not liftable" else c*y^(first e//2)),R,S)
promote(y^2+2,R)
lift(oo,S)
lift(x,S,Verify=>false)
Text
In the second one, we define a ring map:
Example
R=QQ[x,y]
S=R[s]
setupPromote map(R,S,{x+y})
setupLift map(S,R,{s,0})
promote(s^3+2*s-1,R)
lift(oo,S)
lift(x,S,Verify=>false)
SeeAlso
setupPromote
///
29 changes: 29 additions & 0 deletions M2/Macaulay2/packages/Macaulay2Doc/functions/setupPromote-doc.m2
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
--- status: DRAFT
--- author(s): PZJ
--- notes:

undocumented methods setupPromote

doc ///
Key
setupPromote
Headline
automatic promotion from one ring to another
Usage
setupPromote f
Inputs
f: RingMap
Description
Text
After calling @TT "setupPromote"@, any operation that is given an element of the source of @TT "f"@ but
expects an element of the target of @TT "f"@ will automatically @TO "promote"@ it by applying @TT "f"@.
Example
R=QQ[x_1,x_2]
R'=QQ[e_1,e_2,Degrees=>{1,2}]
setupPromote map(R,R',{x_1+x_2,x_1*x_2})
promote(e_1^2,R)
e_1*x_1
e_2==x_1*x_2
SeeAlso
setupLift
///
23 changes: 23 additions & 0 deletions M2/Macaulay2/tests/normal/testpromote.m2
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,29 @@ assert( rawLift(raw C, f) == raw C_0 )
--E = frac D
--F = GF(2,5)

-- more sophisticated, m2 level, promotes
R=QQ[x]; S=R[y];
a=promote(1/x,frac S)
assert(lift(a,frac R) == 1/x)
assert(1/x + 1/y == a + 1/y)
assert(y/x == a * y)
assert(promote((frac R)^{1,2},frac S)==(frac S)^{{1,0},{2,0}})
T=R**QQ[z];
assert(promote(x_R,T) == x_T)
assert(lift(x_T,R) == x_R)
assert(lift(z,R,Verify=>false) === null)

R=QQ[x_1,x_2]
R'=QQ[e_1,e_2,Degrees=>{1,2}]
f=map(R,R',{x_1+x_2,x_1*x_2})
setupPromote f
assert(e_2==x_1*x_2)
assert(map(R,R') === f)

R=QQ[u]; S=QQ[v];
setupPromote map(R,S,{u^2},DegreeMap=>i->2*i)
assert(isHomogeneous map(R,S))
assert(promote(S^{1,2},R)==R^{2,4})

end
-- Local Variables:
Expand Down

0 comments on commit 1ff3f83

Please sign in to comment.