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

Adapt QQBar documentation #1715

Merged
merged 7 commits into from
Jun 7, 2024
Merged

Conversation

lgoettgens
Copy link
Collaborator

Some more progress towards oscar-system/Oscar.jl#3416.

This follows the approach of oscar-system/Oscar.jl#3416 (comment), i.e.:

  • preparing for removal of CalciumQQBar (global constant)
  • preparing for unexporting QQBar (global constant)
  • adapt the documentation and tests to use algebraic_closure(QQ) instead.

In the next breaking release of Nemo, a few things marked with a TODO can be removed. This will only be a breaking change for Nemo, but not for Oscar.

@thofma
Copy link
Member

thofma commented Apr 12, 2024

Test failure looks real

@lgoettgens
Copy link
Collaborator Author

Test failure looks real

Some copy-and-paste error when adapting the tests probably. But needs to wait for me to get back to a computer

Copy link

codecov bot commented Apr 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.95%. Comparing base (3d975fd) to head (48dcd18).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1715   +/-   ##
=======================================
  Coverage   85.95%   85.95%           
=======================================
  Files          95       95           
  Lines       36503    36503           
=======================================
  Hits        31375    31375           
  Misses       5128     5128           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lgoettgens lgoettgens requested review from thofma and fingolfin and removed request for thofma April 17, 2024 12:12
@lgoettgens lgoettgens closed this Apr 17, 2024
@lgoettgens lgoettgens reopened this Apr 17, 2024
@@ -132,7 +120,7 @@ julia> CC = AcbField(32); CC(QQBar(-1) ^ (QQBar(1) // 4))
Retrieving the minimal polynomial and algebraic conjugates
of a given algebraic number:

```jldoctest
```jldoctest; setup = :(QQBar = algebraic_closure(QQ))
Copy link
Member

Choose a reason for hiding this comment

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

If we unexport QQBar (and possibly also completely undefine), then should we really keep referring to it in examples? As opposed to changing the examples to reflect how one wold use these instead, i.e.

  • either add K = algebraic_closure(QQ) at the start then and then use K instead of QQBar, or
  • explicitly do QQBar = algebraic_closure(QQ) at the start of the example, or
  • use QQBarFieldElem(x) instead of QQBar(x)

@fieker @thofma what do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Just wanting to mention here that the same reasoning should be applied to all of the setup blocks where we create RR = RealField() and CC = ComplexField() etc.

Copy link
Member

Choose a reason for hiding this comment

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

agreed


u = sqrt(R(2))
i = sqrt(R(-1))
QQBar = algebraic_closure(QQ)
Copy link
Member

Choose a reason for hiding this comment

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

If this was just

Suggested change
QQBar = algebraic_closure(QQ)
R = algebraic_closure(QQ)

the diff would be much smaller

associated field of algebraic numbers is represented by the constant
parent object called `CalciumQQBar`.
associated field of algebraic numbers can be constructed using
`QQBar = algebraic_closure(QQ)`.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
`QQBar = algebraic_closure(QQ)`.
`algebraic_closure(QQ)`.

src/calcium/qqbar.jl Outdated Show resolved Hide resolved
src/calcium/qqbar.jl Outdated Show resolved Hide resolved
src/calcium/qqbar.jl Outdated Show resolved Hide resolved
@lgoettgens
Copy link
Collaborator Author

I think 5c8674d (#1715) together with the sentence that was already there is what you imagined @fingolfin ?

@@ -38,8 +28,7 @@ For fast calculation in $\overline{\mathbb{Q}}$,
`CalciumField` should typically be used instead (see the section
on *Exact real and complex numbers*).
Alternatively, to compute in a fixed subfield of $\overline{\mathbb{Q}}$,
you may fix a generator $a$ and construct an
Antic number field to represent $\mathbb{Q}(a)$.
you may fix a generator $a$ and construct a number field to represent $\mathbb{Q}(a)$.
Copy link
Member

Choose a reason for hiding this comment

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

I realize you are just editing existing text, so this is not a change request for this PR, but I genuinely wonder how to read this. Is a supposed to be an element of CalciumField ?! But in general were would a come from? Shouldn't we just say something like

Alternatively, one can often work in a suitable number field created via number_field.

Calcium | `QQBarFieldElem` | `QQBarField`
Library | Element type | Parent type
----------------|------------------|--------------------
Calcium | `QQBarFieldElem` | `QQBarField`
Copy link
Member

Choose a reason for hiding this comment

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

Again not part of this PR, but should we really still refer to "Calcium" here (and arb elsewhere), given that they have all been merged into FLINT?

Comment on lines 10 to 11
@test base_ring(R) == R
@test base_ring(QQBarFieldElem(3)) == R
Copy link
Member

Choose a reason for hiding this comment

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

Huh, why did the base_ring change?

test/calcium/qqbar-test.jl Outdated Show resolved Hide resolved

u = sqrt(R(2))
i = sqrt(R(-1))
QQBar = algebraic_closure(QQ)
Copy link
Member

Choose a reason for hiding this comment

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

Why not

Suggested change
QQBar = algebraic_closure(QQ)
R = algebraic_closure(QQ)

and then have the rest of this test stay unchanged?

Copy link
Member

@fingolfin fingolfin left a comment

Choose a reason for hiding this comment

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

I've tweaked this PR a bit and now I am happy with it in its current state, but now @lgoettgens should verify he is, too ;-)

@@ -86,8 +86,6 @@ Root 0.866025 of 4x^2 - 3
struct QQBarField <: Field
end

const QQBar = QQBarField()

@doc qq_field_doc
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Off-topic, but this is wrong. It should attach qqbar_field_doc instead

@lgoettgens
Copy link
Collaborator Author

Thanks @fingolfin for bringing this pr to this form. I am happy to have it merged

@lgoettgens lgoettgens merged commit 9a36922 into Nemocas:master Jun 7, 2024
26 checks passed
@lgoettgens lgoettgens deleted the lg/QQBar-docs branch June 7, 2024 15:31
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.

3 participants