Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
e2e4fba
Added the Subring package
fragandi Apr 17, 2025
f1f3aa0
typos handled. Still need to resolve the issue with directory structure
fragandi Apr 18, 2025
2564a4a
Merge branch 'development' into master
fragandi Apr 18, 2025
2b35a8a
directory structure is fixed
fragandi Apr 18, 2025
c5e7721
paths fixed
fragandi Apr 18, 2025
ce9c38d
renamed package Subring -> Subrings
mahrud May 25, 2025
c81444a
deleted .vscode/settings.json
mahrud May 25, 2025
c6774f2
added link to SubalgebraBases in Subrings
mahrud May 25, 2025
308d007
fixed auxiliary file paths in Subrings
mahrud May 25, 2025
98da806
set AuxiliaryFiles for Subrings
mahrud Jun 2, 2025
b38618a
Merge branch 'Macaulay2:stable' into master
fragandi Jun 12, 2026
6d807f5
Add workflow to build and push testbot Docker image
d-torrance Jun 14, 2026
1a37f6f
Trust the Macaulay2 Homebrew tap
d-torrance Jun 6, 2026
fdf5ff2
Merge branch 'Macaulay2:stable' into master
ollieclarke8787 Jul 3, 2026
287c51b
cache subring in matrix
ollieclarke8787 Jul 3, 2026
79bc995
update Subring to handle towers of rings
ollieclarke8787 Jul 3, 2026
c9bb90c
fix M -> genMatrix
ollieclarke8787 Jul 3, 2026
9785924
fix subring opts
ollieclarke8787 Jul 3, 2026
0dd0ba9
add options for subring(List)
ollieclarke8787 Jul 3, 2026
7332fd8
fix isSubringElement to work with towers of rings
ollieclarke8787 Jul 3, 2026
6624403
fix indentation
ollieclarke8787 Jul 3, 2026
149d940
clean up comment
ollieclarke8787 Jul 3, 2026
89210ef
add test for tower of rings
ollieclarke8787 Jul 3, 2026
69c567b
TODO: rewrite isSubringElement to use hooks for future-proofing
ollieclarke8787 Jul 3, 2026
2f4dcb4
export Subring type
ollieclarke8787 Jul 4, 2026
b4777fe
add flattenRing Subring
ollieclarke8787 Jul 5, 2026
7b061ac
clean Subring doc
ollieclarke8787 Jul 5, 2026
ce6a670
clean spacing
ollieclarke8787 Jul 5, 2026
27ee670
use hooks for subring membership
ollieclarke8787 Jul 5, 2026
67170be
fix doc for flattenedRing
ollieclarke8787 Jul 5, 2026
2c5af3e
add flattenedRing doc
ollieclarke8787 Jul 5, 2026
1492759
add tests
ollieclarke8787 Jul 5, 2026
571b39c
use Subring in SubalgebraBases
ollieclarke8787 Jul 7, 2026
7b8351d
Update M2/Macaulay2/packages/Subrings.m2
ollieclarke8787 Aug 12, 2026
6b67548
Update package headline
ollieclarke8787 Aug 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
Comment thread
mahrud marked this conversation as resolved.
Outdated
"githubPullRequests.ignoredPullRequestBranches": [
"master"
]
}
3 changes: 2 additions & 1 deletion M2/Macaulay2/packages/=distributed-packages
Original file line number Diff line number Diff line change
Expand Up @@ -279,4 +279,5 @@ Permutations
SCMAlgebras
NumericalSemigroups
IncidenceCorrespondenceCohomology
ToricHigherDirectImages
ToricHigherDirectImages
Subring
173 changes: 173 additions & 0 deletions M2/Macaulay2/packages/Subring.m2
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
-- -*- coding: utf-8 -*-
newPackage(
"Subring",
Version => "1.0",
Date => "June 6, 2023",
Authors => {
{Name => "Francesca Gandini", Email => "fra.gandi.phd@gmail.com"},
{Name => "Casey Hill", Email => "casey.hill@uky.edu"},
{Name => "Trevor K. Karn", Email => "karnx018@umn.edu"},
{Name => "Miranda Moore", Email => "moor2340@umn.edu"},
{Name => "Christopher O'Neill", Email => "cdoneill@sdsu.edu"}},
Headline => "a package for subrings",
Keywords => {"Commutative Algebra"},
)


export {"subring",
"subringGenerators",
"presentationRing",
"presentationMap",
"presentationIdeal",
"toQuotientRing",
"isSubringElement"}

Subring = new Type of HashTable

-- a method to create subrings from a `Matrix` of generators
subring = method()
subring Matrix := genMatrix -> (

-- compute presentation ring
R := ring genMatrix;
nGens := numgens source genMatrix;
k := coefficientRing R;
p := symbol p;
P := k[p_0..p_(nGens-1)];

-- compute presentation map
f := map(R, P, genMatrix);

S := new Subring from {
generators => genMatrix,
ambient => R,

-- presentation ring: one variable for each generator
presentationRing => P,

-- presentation map: presentation ring --> ambient ring, image(f)=S
presentationMap => f,

cache => new CacheTable
};
S
)

-- a method to create subrings from a `List` of generators
subring List := genList -> (
subring matrix {genList}
)

presentationRing = method()
presentationRing Subring := S -> (
S#presentationRing
)

presentationMap = method()
presentationMap Subring := S -> (
S#presentationMap
)

presentationIdeal = method()
presentationIdeal Subring := S -> (
f := presentationMap S;
return ker f; --kernel is cached automatically
)

-- a quotient ring isomorphic to the image of the subring inside of the presentation ring
toQuotientRing = method()
toQuotientRing Subring := S -> (
P := presentationRing S;
I := presentationIdeal S;
return P/I;
)

subringGenerators = method()
subringGenerators Subring := S -> S#generators

generators Subring := Matrix => opts -> S -> (
if S#?generators then S#generators
else if S.cache.?generators then S.cache.generators
else S.cache.generators = S#generators)

ambient Subring := S -> S#ambient

-- format printing of Subring type
net Subring := S -> (
R := ambient S;
P := presentationRing S;
g := flatten entries S#generators;
genstr := "";
if #g <= 3 then (
genstr = toString(g_{0 .. min(2, #g-1)});
) else (
genstr = "{" | toString(g_0) | ", " | toString(g_1) | ", " | toString(g_2) | ", ...}";
);

"Subring of " | toString(R) | " generated by " | genstr | " with presentation ring " | toString(P)
)

-- given a subring S and an element x of the ambient ring, checks whether x is in S
isSubringElement = method()
isSubringElement(RingElement, Subring) := (r, S) -> (
R := ambient S;
P := presentationRing S;
T := tensor(R, P, MonomialOrder=>Eliminate(numgens R));
gT := vars T;
R2T := map(T, R, gT_{0 .. numgens R - 1});
P2T := map(T, P, gT_{numgens R .. numgens T - 1});
ambGens := gens R;
subringGens := subringGenerators S;
presGens := gens P;
graphIdealGens := for i from 0 to (-1 + numgens P) list
(P2T(presGens_i) - R2T(subringGens_i)_0);
I := ideal graphIdealGens;
M := matrix {{R2T(r) % I}};
selectInSubring(1, M) == M
)

-- equality of Subrings
-- check that every generator of S1 is in S2 and every generator of S2 is in S1
Subring == Subring := (S1, S2) -> (
if not (ambient S1) === (ambient S2) then return false;
all(entries(subringGenerators S1)_0, f -> isSubringElement(f, S2)) and all(entries(subringGenerators S2)_0, f -> isSubringElement(f, S1))
)



-*

-- given an element of S, write it in terms of the p_i's

*-

-----------------------------------------
--- Load documentation files ------------
-----------------------------------------
beginDocumentation()

load "./Subring/SubringDoc.m2"
load "./Subring/SubringTests.m2"

end--

restart
installPackage "Subring"
R = QQ[x]
S1 = subring {x, x^2}
S2 = subring {x^2}
S3 = subring {x}
S1 == S3 --true
S1 == S2 --false

net S3

mingens S1
presentationRing S1
mingens

gens S1

-- run tests
check Subring

Loading