-
Notifications
You must be signed in to change notification settings - Fork 68
Document ideal interface #2113
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
Open
emikelsons
wants to merge
4
commits into
Nemocas:master
Choose a base branch
from
emikelsons:IdealDocs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Document ideal interface #2113
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
```@meta | ||
CurrentModule = AbstractAlgebra | ||
DocTestSetup = AbstractAlgebra.doctestsetup() | ||
``` | ||
|
||
# Ideal Interface | ||
|
||
AbstractAlgebra.jl generic code makes use of a standardised set of functions which it | ||
expects to be implemented by anyone implementing ideals for AbstractAlgebra rings. | ||
Here we document this interface. All libraries which want to make use of the generic | ||
capabilities of AbstractAlgebra.jl must supply all of the required functionality for their ideals. | ||
There are already many helper methods in AbstractAlgebra.jl for the methods mentioned below. | ||
|
||
In addition to the required functions, there are also optional functions which can be | ||
provided for certain types of ideals e.g., for ideals of polynomial rings. If implemented, | ||
these allow the generic code to provide additional functionality for those ideals, or in | ||
some cases, to select more efficient algorithms. | ||
|
||
Currently AbstractAlgebra.jl provides ideals of a Euclidean domain (assuming the existence of a `gcdx` function) | ||
or of a univariate or multivariate polynomial ring over the integers. | ||
Univariate and multivariate polynomial rings over other | ||
domains (other than fields) are not supported at this time. | ||
|
||
## Types and parents | ||
|
||
New implementations of ideals needn't necessarily supply new types and could just extend | ||
the existing functionality for new rings as AbstractAlgebra.jl provides a generic ideal type | ||
based on Julia arrays which is implemented in `src/generic/Ideal.jl`. For information | ||
about implementing new rings, see the [Ring interface](@ref "Ring Interface"). | ||
|
||
The generic ideals have type `Generic.Ideal{T}` where `T` is the type of | ||
elements of the ring the ideals belong to. Internally they consist of a Julia | ||
array of generators and some additional fields for a parent object, etc. See | ||
the file `src/generic/GenericTypes.jl` for details. | ||
|
||
Parent objects of ideals have type `Generic.IdealSet{T}`. | ||
|
||
All ideal types belong to the abstract type `Ideal{T}` and their parents belong | ||
to the abstract type `Set`. This enables one to write generic functions that | ||
can accept any AbstractAlgebra ideal type. | ||
|
||
New ideal types should come with the following methods: | ||
|
||
```julia | ||
ideal_type(NewRingType) = NewIdealType | ||
ideal_type(R::NewRing) = ideal_type(typeof(R)) | ||
base_ring_type(I::NewIdealType) = NewRingType | ||
parent_type(I::NewIdealType{T}) = DefaultIdealSet{T} | ||
``` | ||
## Required functionality for ideals | ||
|
||
In the following, we list all the functions that are required to be provided for ideals | ||
in AbstractAlgebra.jl or by external libraries wanting to use AbstractAlgebra.jl. | ||
|
||
We give this interface for fictitious type `NewIdeal` and `Ring` or `NewRing` for the type of the base ring | ||
object `R`, and `RingElem` for the type of the elements of the ring. | ||
We assume that the function | ||
|
||
```julia | ||
ideal(R::Ring, xs::Vector{U}) | ||
``` | ||
|
||
with `U === elem_type(Ring)` and `xs` a list of generators, | ||
is implemented by anyone implementing ideals for AbstractAlgebra rings. | ||
Additionally, the following constructors should be supported: | ||
|
||
```julia | ||
ideal(R::Ring, x::U) | ||
ideal(xs::Vector{U}) = ideal(parent(xs[1]), xs) | ||
ideal(x::U) = ideal(parent(x), x) | ||
*(x::RingElem, R::Ring) | ||
*(R::Ring, x::RingElem) | ||
emikelsons marked this conversation as resolved.
Show resolved
Hide resolved
|
||
``` | ||
|
||
An implementation of an Ideal subtype should also provide the | ||
following methods: | ||
|
||
```julia | ||
base_ring(I::NewIdeal) | ||
``` | ||
```julia | ||
gen(I::NewIdeal, k::Int) | ||
``` | ||
```julia | ||
gens(I::NewIdeal) | ||
``` | ||
```julia | ||
ngens(I::NewIdeal) | ||
``` | ||
|
||
## Optional functionality for ideals | ||
|
||
Some functionality is difficult or impossible to implement for all ideals. | ||
If it is provided, additional functionality or performance may become available. Here | ||
is a list of all functions that are considered optional and can't be relied on by | ||
generic functions in the AbstractAlgebra Ideal interface. | ||
|
||
It may be that no algorithm, or no efficient algorithm is known to implement these | ||
functions. As these functions are optional, they do not need to exist. Julia will | ||
already inform the user that the function has not been implemented if it is called but | ||
doesn't exist. | ||
|
||
```julia | ||
in(v::RingElem, I::NewIdeal) | ||
``` | ||
```julia | ||
issubset(I::NewIdeal, J::NewIdeal) | ||
``` | ||
```julia | ||
iszero(I::NewIdeal) | ||
``` | ||
```julia | ||
+(I::T, J::T) where {T <: NewIdeal} | ||
``` | ||
```julia | ||
*(I::T, J::T) where {T <: NewIdeal} | ||
``` | ||
```julia | ||
intersect(I::T, J::T) where {T <: NewIdeal} | ||
``` | ||
```julia | ||
==(I::T, J::T) where {T <: NewIdeal} | ||
``` | ||
```julia | ||
reduce_gens(I::NewIdeal) | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.