Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust to AA/Nemo/Hecke #3288

Merged
merged 17 commits into from
Feb 1, 2024
Merged

Adjust to AA/Nemo/Hecke #3288

merged 17 commits into from
Feb 1, 2024

Conversation

joschmitt
Copy link
Member

@joschmitt joschmitt commented Jan 31, 2024

Project.toml Outdated Show resolved Hide resolved
@lgoettgens

This comment was marked as resolved.

@thofma thofma closed this Jan 31, 2024
@thofma thofma reopened this Jan 31, 2024
@joschmitt
Copy link
Member Author

Renaming script used for the first commit:

#!/bin/sh
#

# some settings that avoid weirdness in sed when it tries to
# adapt to your locale (e.g. if your system uses German as system language)
export LANG=C
export LC_CTYPE=C
export LC_ALL=C

# Files to modify (default uses all files known to git,
# but obviously you can modify it)
FILES=$(git ls-files)

# on macOS, you may need to change the following
SED_I="sed -i"
#SED_I="gsed -i"
#SED_I="sed -i ''"

# from https://github.com/Nemocas/AbstractAlgebra.jl/pull/1574

$SED_I \
-e "s;\bMatAlgElem\b;MatRingElem;g" \
-e "s;\bMatAlgebra\b;MatRing;g" \
-e "s;\bMatrixAlgebra\b;matrix_ring;g" \
$FILES

# from https://hackmd.io/nRnyfrSxTVe5CzXidB1cBQ?both#Nemo

$SED_I \
-e "s;\bFlintPadicField\b;PadicField;g" \
-e "s;\bpadic\b;PadicFieldElem;g" \
-e "s;\bFlintQadicField\b;QadicField;g" \
-e "s;\bqadic\b;QadicFieldElem;g" \
-e "s;\barb_poly\b;ArbPolyRingElem;g" \
-e "s;\barb_mat\b;ArbMatrix;g" \
-e "s;\barb\b;ArbFieldElem;g" \
-e "s;\bacb_poly\b;AcbPolyRingElem;g" \
-e "s;\bacb_mat\b;AcbMatrix;g" \
-e "s;\bacb\b;AcbFieldElem;g" \
-e "s;\bca\b;CalciumFieldElem;g" \
-e "s;\bLoc\b;LocalizedEuclideanRing;g" \
-e "s;\bLocElem\b;LocalizedEuclideanRingElem;g" \
-e "s;\blll_ctx\b;LLLContext;g" \
-e "s;\bqqbar\b;QQBarFieldElem;g" \
-e "s;\bCalciumQQBarField\b;QQBarField;g" \
-e "s;\bFlintQQiField\b;QQiField;g" \
-e "s;\bfmpqi\b;QQiFieldElem;g" \
-e "s;\bFlintZZiRing\b;ZZiRing;g" \
-e "s;\bfmpzi\b;ZZiRingElem;g" \
-e "s;\bfmpzUnitRange\b;ZZRingElemUnitRange;g" \
$FILES
#-e "s;\bCalciumField\b;CalciumField;g" \ # no change
#-e "s;\bFac\b;;g" \ # to be decided

# from https://hackmd.io/ONVPdlfARgWzkfkNkcJkgA

# Number field related

$SED_I \
-e "s;\bAnticNumberField\b;AbsSimpleNumField;g" \
-e "s;\bnf_elem\b;AbsSimpleNumFieldElem;g" \
-e "s;\bNfAbsNS\b;AbsNonSimpleNumField;g" \
-e "s;\bNfAbsNSElem\b;AbsNonSimpleNumFieldElem;g" \
-e "s;\bNfRel\b;RelSimpleNumField;g" \
-e "s;\bNfRelElem\b;RelSimpleNumFieldElem;g" \
-e "s;\bNfRelNS\b;RelNonSimpleNumField;g" \
-e "s;\bNfRelNSElem\b;RelNonSimpleNumFieldElem;g" \
-e "s;\bNfToNfMor\b;NumFieldMor;g" \
-e "s;\bNumFieldOrd\b;NumFieldOrder;g" \
-e "s;\bNumFieldOrdElem\b;NumFieldOrderElem;g" \
-e "s;\bNumFieldOrdIdl\b;NumFieldOrderIdeal;g" \
-e "s;\bNumFieldOrdFracIdl\b;NumFieldOrderFractionalIdeal;g" \
-e "s;\bNfAbsOrd\b;AbsNumFieldOrder;g" \
-e "s;\bNfAbsOrdElem\b;AbsNumFieldOrderElem;g" \
-e "s;\bNfAbsOrdSet\b;AbsNumFieldOrderSet;g" \
-e "s;\bNfAbsOrdIdl\b;AbsNumFieldOrderIdeal;g" \
-e "s;\bNfAbsOrdIdlSet\b;AbsNumFieldOrderIdealSet;g" \
-e "s;\bNfAbsOrdFracIdl\b;AbsNumFieldOrderFractionalIdeal;g" \
-e "s;\bNfAbsOrdFracIdlSet\b;AbsNumFieldOrderFractionalIdealSet;g" \
-e "s;\bNfRelOrd\b;RelNumFieldOrder;g" \
-e "s;\bNfRelOrdElem\b;RelNumFieldOrderElem;g" \
-e "s;\bNfRelOrdIdl\b;RelNumFieldOrderIdeal;g" \
-e "s;\bNfRelOrdFracIdl\b;RelNumFieldOrderFractionalIdeal;g" \
-e "s;\bNfAbsNSToNfAbsNS\b;NumFieldAut{AbsNonSimpleNumField};g" \
-e "s;\bNfToNfMor\b;NumFieldAut{AbsSimpleNumField};g" \
-e "s;\bNumFieldMor\b;NumFieldHom;g" \
-e "s;\bNfAbsToNfAbsNS\b;NumFieldHom{AbsSimpleNumField, AbsNonSimpleNumField};g" \
-e "s;\bNfToNfRel\b;NumFieldHom{AbsSimpleNumField, RelSimpleNumField{AbsSimpleNumFieldElem}};g" \
-e "s;\bNfRelToNfRelMor_nf_elem_nf_elem\b;NumFieldHom{RelSimpleNumField{AbsSimpleNumFieldElem}, RelSimpleNumField{AbsSimpleNumFieldElem}};g" \
-e "s;\bNfRelToNf\b;NumFieldHom{RelSimpleNumField{AbsSimpleNumFieldElem}, AbsSimpleNumField};g" \
-e "s;\bNfRelNSToNfRelNSMor_nf_elem\b;NumFieldHom{RelNonSimpleNumField{AbsSimpleNumFieldElem}, RelNonSimpleNumField{AbsSimpleNumFieldElem}};g" \
-e "s;\bNfRelToNfRelNSMor_nf_elem\b;NumFieldHom{RelSimpleNumField{AbsSimpleNumFieldElem}, RelNonSimpleNumField{AbsSimpleNumFieldElem}};g" \
-e "s;\bNfOrd\b;AbsSimpleNumFieldOrder;g" \
-e "s;\bNfOrdElem\b;AbsSimpleNumFieldOrderElem;g" \
-e "s;\bNfOrdIdl\b;AbsSimpleNumFieldOrderIdeal;g" \
-e "s;\bNfOrdFracIdlSet\b;AbsSimpleNumFieldOrderFractionalIdealSet;g" \
-e "s;\bNfOrdFracIdl\b;AbsSimpleNumFieldOrderFractionalIdeal;g" \
-e "s;\bNfOrdQuoRing\b;AbsSimpleNumFieldOrderQuoRing;g" \
-e "s;\bNfOrdQuoRingElem\b;AbsSimpleNumFieldOrderQuoRingElem;g" \
-e "s;\bNumFieldEmbNfAbs\b;AbsSimpleNumFieldEmbedding;g" \
-e "s;\bNumFieldEmbNfAbsNS\b;AbsNonSimpleNumFieldEmbedding;g" \
-e "s;\bNumFieldEmbNfRel\b;RelSimpleNumFieldEmbedding;g" \
-e "s;\bNumFieldEmbNfNS\b;RelNonSimpleNumFieldEmbedding;g" \
$FILES

# Algebras related

$SED_I \
-e "s;\bAbsAlgAss\b;AbstractAssociativeAlgebra;g" \
-e "s;\bAbsAlgAssElem\b;AbstractAssociativeAlgebraElem;g" \
-e "s;\bAlgAss\b;StructureConstantAlgebra;g" \
-e "s;\bAlgAssElem\b;AssociativeAlgebraElem;g" \
-e "s;\bAlgGrp\b;GroupAlgebra;g" \
-e "s;\bAlgGrpElem\b;GroupAlgebraElem;g" \
-e "s;\bAlgMat\b;MatAlgebra;g" \
-e "s;\bAlgMatElem\b;MatAlgebraElem;g" \
-e "s;\bAlgQuat\b;QuaternionAlgebra;g" \
$FILES

# Something with groups

$SED_I \
-e "s;\bGrpAbFinGen\b;FinGenAbGroup;g" \
-e "s;\bGrpAbFinGenElem\b;FinGenAbGroupElem;g" \
-e "s;\bGrpAbFinGenMap\b;FinGenAbGroupHom;g" \
-e "s;\bGrpAbToGrpGenMor\b;FinGenAbGroupToGroupHom;g" \
-e "s;\bGrpGen\b;MultTableGroup;g" \
-e "s;\bGrpGenElem\b;MultTableGroupElem;g" \
-e "s;\bGrpGenToGrpAbMor\b;MultTableGroupToGroupHom;g" \
-e "s;\bGrpGenToGrpGenMor\b;MultTableGroupHom;g" \
$FILES

# Rest

$SED_I \
-e "s;\bEllCrv\b;EllipticCurve;g" \
-e "s;\bEllCrvPt\b;EllipticCurvePoint;g" \
-e "s;\bEmbeddedField\b;EmbeddedNumField;g" \
-e "s;\bEmbeddedElem\b;EmbeddedNumFieldElem;g" \
$FILES

Copy link
Member

@lgoettgens lgoettgens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed some printing things that don't look good (see comments). This is not a blocker for this PR, but should be adapted in a timely manner (for the book).

src/Modules/ModulesGraded.jl Outdated Show resolved Hide resolved
src/Rings/MPolyQuo.jl Outdated Show resolved Hide resolved
src/Rings/MPolyQuo.jl Show resolved Hide resolved
Copy link

codecov bot commented Jan 31, 2024

Codecov Report

Merging #3288 (0b7fe05) into master (b7a413b) will decrease coverage by 0.02%.
The diff coverage is 72.78%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3288      +/-   ##
==========================================
- Coverage   81.64%   81.62%   -0.02%     
==========================================
  Files         546      546              
  Lines       73445    73465      +20     
==========================================
+ Hits        59964    59969       +5     
- Misses      13481    13496      +15     
Files Coverage Δ
experimental/GModule/test/runtests.jl 100.00% <ø> (ø)
experimental/GaloisGrp/test/runtests.jl 100.00% <ø> (ø)
experimental/IntersectionTheory/src/Misc.jl 100.00% <100.00%> (ø)
...mental/LieAlgebras/test/AbstractLieAlgebra-test.jl 100.00% <ø> (ø)
...rimental/LieAlgebras/test/LinearLieAlgebra-test.jl 100.00% <ø> (ø)
experimental/LinearQuotients/src/cox_rings.jl 89.37% <100.00%> (ø)
...perimental/LinearQuotients/src/linear_quotients.jl 94.73% <100.00%> (ø)
experimental/LinearQuotients/src/types.jl 100.00% <100.00%> (ø)
experimental/MatrixGroups/matrix.jl 52.94% <100.00%> (ø)
.../MatroidRealizationSpaces/src/realization_space.jl 88.25% <ø> (ø)
... and 86 more

@lgoettgens lgoettgens marked this pull request as ready for review February 1, 2024 11:26
@joschmitt
Copy link
Member Author

As already discussed in Slack: there is a problem in the doctests now because a cached polynomial ring keeps whatever name it was assigned to first.

julia> R, (x, y, z) = QQ[:x, :y, :z]
(Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[x, y, z])

julia> quo(R, ideal(R, []))
(Quotient of multivariate polynomial ring by ideal (), Map: R -> quotient of multivariate polynomial ring)

julia> S, (x, y, z) = QQ[:x, :y, :z]
(Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[x, y, z])

julia> quo(S, ideal(S, []))
(Quotient of multivariate polynomial ring by ideal (), Map: R -> quotient of multivariate polynomial ring)

In the last map, it still says R.
We don't include the latest changes in AbstractAlgebra for now.

@fingolfin
Copy link
Member

There is now also a conflict in src/Groups/cosets.jl, sorry about that. Clearly this needs to be merged sooner rather than later. Should I not merge @fieker's PR #3294 for now as it references qqbar? Or merge it so that it can be updated by this PR?

@joschmitt
Copy link
Member Author

There is now also a conflict in src/Groups/cosets.jl, sorry about that. Clearly this needs to be merged sooner rather than later. Should I not merge @fieker's PR #3294 for now as it references qqbar? Or merge it so that it can be updated by this PR?

For me, it's fine to merge #3294. Sorting the printing out will take a moment here and it is no problem to run the renaming script again.

@fingolfin
Copy link
Member

Regarding the "cached name": I actually wanted to fix that a year ago or so; the idea being that the logic should not store/cache the REPL name of an object, but always query it dynamically (this has a performance penalty but printing is slow anyway). But I failed to untangle the messy relation ship between set_name, set_name!, extra_name, @show_name and @show_special. But I really think we need to do that (and then also document it)

@joschmitt
Copy link
Member Author

Regarding the "cached name": I actually wanted to fix that a year ago or so; the idea being that the logic should not store/cache the REPL name of an object, but always query it dynamically (this has a performance penalty but printing is slow anyway). But I failed to untangle the messy relation ship between set_name, set_name!, extra_name, @show_name and @show_special. But I really think we need to do that (and then also document it)

+1 for documenting all the printing magic that is happening!

@joschmitt joschmitt mentioned this pull request Feb 1, 2024
12 tasks
@thofma thofma enabled auto-merge (squash) February 1, 2024 15:28
@thofma thofma merged commit 757489f into oscar-system:master Feb 1, 2024
18 of 20 checks passed
@joschmitt joschmitt deleted the js/rename branch February 1, 2024 17:16
@thofma
Copy link
Collaborator

thofma commented Feb 2, 2024

@fieker: Do you have an opinion (since this is your invention). The option is

  1. Cache the name when it is printed first.
  2. Every time it is printed, take the lexicographically first.

At the moment we do 1), but @fingolfin/@lgoettgens propose to change it to 2).

@lgoettgens
Copy link
Member

@fieker: Do you have an opinion (since this is your invention). The option is

  1. Cache the name when it is printed first.
  2. Every time it is printed, take the lexicographically first.

At the moment we do 1), but @fingolfin/@lgoettgens propose to change it to 2).

To keep the discussion at a better place, I created Nemocas/AbstractAlgebra.jl#1594 with my proposal and some more explanation and motivation. Please put your opinions there instead

@fieker
Copy link
Contributor

fieker commented Feb 2, 2024

Not storing won't help. The docstrings possibly set up the same ring with different names.
Cached true as default is insane

Otherwise: whatever you orefer

@fieker
Copy link
Contributor

fieker commented Feb 2, 2024

Maybe in the docstrings the ring should R always?

@lgoettgens
Copy link
Member

Not storing won't help. The docstrings possibly set up the same ring with different names.

Different doctests run in different modules, so the find_name won't find names from other docstrings. I am very certain that this helps, but I'll verify before merging anything.

Cached true as default is insane

I agree, but that's the current state

Maybe in the docstrings the ring should R always?

This just fixes symptoms. For other types that may use this feature (but we haven't experienced the issues yet) there may be no canonical name to choose. And this would be very hard to enforce.

Thanks for your words, I'll then proceed with
Nemocas/AbstractAlgebra.jl#1594 and try to get it working

ooinaruhugh pushed a commit to ooinaruhugh/Oscar.jl that referenced this pull request Feb 15, 2024
* Adjust to AA/Nemo/Hecke

* `haspreimage`/`has_preimage` -> `has_preimage_with_preimage`

* Readd special show functions for hom/direct_product/...

* Put specialized show methods in a file that's actually included
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants