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 authored and d-torrance committed Oct 31, 2024
1 parent f3c37d2 commit eed5da6
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 6 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
2 changes: 1 addition & 1 deletion M2/Macaulay2/packages/Macaulay2Doc/functions/lift-doc.m2
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,5 @@ document {
.0001^QQ
.0001_QQ
///,
SeeAlso => {baseRings,liftable,promote}
SeeAlso => {baseRings,liftable,promote,setupLift}
}
Original file line number Diff line number Diff line change
Expand Up @@ -149,5 +149,5 @@ document {
an algebra over ", TO "QQ", ", then an element of ", TT "R", " is provided
by attempting the evident division.",
SeeAlso => {baseRings, lift, liftable, "substitution and maps between rings",
substitute, (symbol**,Matrix,Ring) }
substitute, (symbol**,Matrix,Ring), setupPromote }
}
45 changes: 45 additions & 0 deletions M2/Macaulay2/packages/Macaulay2Doc/functions/setupLift-doc.m2
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
--- status: DRAFT
--- author(s): PZJ
--- notes:

undocumented {(setupLift,Function,Ring,Ring,Function), (setupLift,RingMap,Ring,Ring)}

doc ///
Key
setupLift
(setupLift,Function,Ring,Ring)
(setupLift,RingMap)
Headline
set up 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"@ using @TT "setupLift"@. 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 which is a partial inverse to the promotion 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
///
32 changes: 32 additions & 0 deletions M2/Macaulay2/packages/Macaulay2Doc/functions/setupPromote-doc.m2
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
--- status: DRAFT
--- author(s): PZJ
--- notes:

undocumented {(setupPromote,RingMap,Ring,Ring,Function), (setupPromote,Function,Ring,Ring,Function), (setupPromote,Function,Ring,Ring), (setupPromote,RingMap,Ring,Ring), (setupPromote,Ring,Ring)}


doc ///
Key
setupPromote
(setupPromote,RingMap)
Headline
set up promote from one ring to another
Usage
setupPromote f
Inputs
f: RingMap
Description
Text
This defines promotion from one ring to another as the application of a ring map.
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 eed5da6

Please sign in to comment.