Skip to content

Commit f97729d

Browse files
authored
Document ideal interface (#2113)
1 parent 82f6998 commit f97729d

File tree

2 files changed

+108
-0
lines changed

2 files changed

+108
-0
lines changed

docs/make.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ makedocs(
9090
"field_interface.md",
9191
"fraction_interface.md",
9292
"module_interface.md",
93+
"ideal_interface.md",
9394
"matrix_interface.md",
9495
"map_interface.md",
9596
"rand.md",

docs/src/ideal_interface.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
```@meta
2+
CurrentModule = AbstractAlgebra
3+
DocTestSetup = AbstractAlgebra.doctestsetup()
4+
```
5+
6+
# Ideal Interface
7+
8+
AbstractAlgebra.jl generic code makes use of a standardised set of functions which it
9+
expects to be implemented by anyone implementing ideals for AbstractAlgebra rings.
10+
Here we document this interface. All libraries which want to make use of the generic
11+
capabilities of AbstractAlgebra.jl must supply all of the required functionality for their ideals.
12+
There are already many helper methods in AbstractAlgebra.jl for the methods mentioned below.
13+
14+
In addition to the required functions, there are also optional functions which can be
15+
provided for certain types of ideals e.g., for ideals of polynomial rings. If implemented,
16+
these allow the generic code to provide additional functionality for those ideals, or in
17+
some cases, to select more efficient algorithms.
18+
19+
## Types and parents
20+
21+
New ideal types should come with the following type information:
22+
23+
```julia
24+
ideal_type(::Type{NewRing}) = NewIdealType
25+
base_ring_type(::Type{NewIdeal}) = NewRingType
26+
parent_type(::Type{NewIdeal{T}}) = DefaultIdealSet{T}
27+
```
28+
29+
However, new implementations of ideals needn't necessarily supply new types and could just extend
30+
the existing functionality for new rings as AbstractAlgebra.jl provides a generic ideal type
31+
based on Julia arrays which is implemented in `src/generic/Ideal.jl`. For information
32+
about implementing new rings, see the [Ring interface](@ref "Ring Interface").
33+
34+
## Required functionality for ideals
35+
36+
In the following, we list all the functions that are required to be provided for ideals
37+
in AbstractAlgebra.jl or by external libraries wanting to use AbstractAlgebra.jl.
38+
39+
We give this interface for fictitious type `NewIdeal` and `Ring` or `NewRing` for the type of the base ring
40+
object `R`, and `RingElem` for the type of the elements of the ring.
41+
We assume that the function
42+
43+
```julia
44+
ideal(R::Ring, xs::Vector{U})
45+
```
46+
47+
with `U === elem_type(Ring)` and `xs` a list of generators,
48+
is implemented by anyone implementing ideals for AbstractAlgebra rings.
49+
Additionally, the following constructors are already implemented generically:
50+
51+
```julia
52+
ideal(R::Ring, x::U)
53+
ideal(xs::Vector{U}) = ideal(parent(xs[1]), xs)
54+
ideal(x::U) = ideal(parent(x), x)
55+
*(x::RingElem, R::Ring)
56+
*(R::Ring, x::RingElem)
57+
```
58+
59+
An implementation of an Ideal subtype should also provide the
60+
following methods:
61+
62+
```julia
63+
base_ring(I::NewIdeal)
64+
```
65+
```julia
66+
gen(I::NewIdeal, k::Int)
67+
```
68+
```julia
69+
gens(I::NewIdeal)
70+
```
71+
```julia
72+
ngens(I::NewIdeal)
73+
```
74+
75+
## Optional functionality for ideals
76+
77+
Some functionality is difficult or impossible to implement for all ideals.
78+
If it is provided, additional functionality or performance may become available. Here
79+
is a list of all functions that are considered optional and can't be relied on by
80+
generic functions in the AbstractAlgebra Ideal interface.
81+
82+
It may be that no algorithm, or no efficient algorithm is known to implement these
83+
functions. As these functions are optional, they do not need to exist. Julia will
84+
already inform the user that the function has not been implemented if it is called but
85+
doesn't exist.
86+
87+
```julia
88+
in(v::RingElem, I::NewIdeal)
89+
```
90+
```julia
91+
issubset(I::NewIdeal, J::NewIdeal)
92+
```
93+
```julia
94+
iszero(I::NewIdeal)
95+
```
96+
```julia
97+
+(I::T, J::T) where {T <: NewIdeal}
98+
```
99+
```julia
100+
*(I::T, J::T) where {T <: NewIdeal}
101+
```
102+
```julia
103+
intersect(I::T, J::T) where {T <: NewIdeal}
104+
```
105+
```julia
106+
==(I::T, J::T) where {T <: NewIdeal}
107+
```

0 commit comments

Comments
 (0)