Skip to content

Commit 29e7418

Browse files
fingolfinCodex
andcommitted
docs: move docstring examples, and de-duplicate
A bunch of docstrings that had text basically identical to the generic docstring for the operation (e.g. for +, issubset, etc.) except for an example, were removed. The examples were then put directly into the relevant .md files with some extra text. Co-authored-by: Codex <codex@openai.com>
1 parent 12c990a commit 29e7418

File tree

13 files changed

+423
-857
lines changed

13 files changed

+423
-857
lines changed

docs/src/CommutativeAlgebra/ModulesOverMultivariateRings/subquotients.md

Lines changed: 118 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,36 @@ zero(M::SubquoModule)
308308

309309
Whether a given element of a subquotient is zero can be tested as follows:
310310

311-
```@docs
312-
is_zero(m::SubquoModuleElem)
311+
```jldoctest
312+
julia> R, (x, y, z) = polynomial_ring(QQ, [:x, :y, :z])
313+
(Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[x, y, z])
314+
315+
julia> F = free_module(R, 1)
316+
Free module of rank 1 over R
317+
318+
julia> A = R[x; y]
319+
[x]
320+
[y]
321+
322+
julia> B = R[x^2; y^3; z^4]
323+
[x^2]
324+
[y^3]
325+
[z^4]
326+
327+
julia> M = subquotient(F, A, B)
328+
Subquotient of submodule with 2 generators
329+
1: x*e[1]
330+
2: y*e[1]
331+
by submodule with 3 generators
332+
1: x^2*e[1]
333+
2: y^3*e[1]
334+
3: z^4*e[1]
335+
336+
julia> is_zero(M[1])
337+
false
338+
339+
julia> is_zero(x*M[1])
340+
true
313341
```
314342

315343
In the graded case, we additionally have:
@@ -328,16 +356,98 @@ The functions [`is_graded`](@ref), [`is_standard_graded`](@ref), [`is_z_graded`]
328356
and [`is_zm_graded`](@ref) carry over analogously to subquotients. They return `true` if the
329357
respective property is satisfied, and `false` otherwise. In addition, we have:
330358

331-
```@docs
332-
==(M::SubquoModule{T}, N::SubquoModule{T}) where T
359+
```jldoctest
360+
julia> R, (x, y, z) = polynomial_ring(QQ, [:x, :y, :z])
361+
(Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[x, y, z])
362+
363+
julia> F = free_module(R, 1)
364+
Free module of rank 1 over R
365+
366+
julia> AM = R[x;]
367+
[x]
368+
369+
julia> BM = R[x^2; y^3; z^4]
370+
[x^2]
371+
[y^3]
372+
[z^4]
373+
374+
julia> M = subquotient(F, AM, BM)
375+
Subquotient of submodule with 1 generator
376+
1: x*e[1]
377+
by submodule with 3 generators
378+
1: x^2*e[1]
379+
2: y^3*e[1]
380+
3: z^4*e[1]
381+
382+
julia> AN = R[x; y]
383+
[x]
384+
[y]
385+
386+
julia> BN = R[x^2+y^4; y^3; z^4]
387+
[x^2 + y^4]
388+
[ y^3]
389+
[ z^4]
390+
391+
julia> N = subquotient(F, AN, BN)
392+
Subquotient of submodule with 2 generators
393+
1: x*e[1]
394+
2: y*e[1]
395+
by submodule with 3 generators
396+
1: (x^2 + y^4)*e[1]
397+
2: y^3*e[1]
398+
3: z^4*e[1]
399+
400+
julia> is_subset(M, N)
401+
true
402+
403+
julia> M == N
404+
false
333405
```
334406

335-
```@docs
336-
is_subset(M::SubquoModule{T}, N::SubquoModule{T}) where T
407+
```jldoctest
408+
julia> Rg, (x, y, z) = graded_polynomial_ring(QQ, [:x, :y, :z]);
409+
410+
julia> F = graded_free_module(Rg, 2);
411+
412+
julia> O1 = [x*F[1]+y*F[2], y*F[2]];
413+
414+
julia> O1a = [x*F[1], y*F[2]];
415+
416+
julia> O2 = [x^2*F[1]+y^2*F[2], y^2*F[2]];
417+
418+
julia> M1 = subquotient(F, O1, O2);
419+
420+
julia> M2 = subquotient(F, O1a, O2);
421+
422+
julia> M1 == M2
423+
true
337424
```
338425

339-
```@docs
340-
is_zero(M::SubquoModule)
426+
```jldoctest
427+
julia> R, (x, y, z) = polynomial_ring(QQ, [:x, :y, :z])
428+
(Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[x, y, z])
429+
430+
julia> F = free_module(R, 1)
431+
Free module of rank 1 over R
432+
433+
julia> A = R[x^2+y^2;]
434+
[x^2 + y^2]
435+
436+
julia> B = R[x^2; y^3; z^4]
437+
[x^2]
438+
[y^3]
439+
[z^4]
440+
441+
julia> M = subquotient(F, A, B)
442+
Subquotient of submodule with 1 generator
443+
1: (x^2 + y^2)*e[1]
444+
by submodule with 3 generators
445+
1: x^2*e[1]
446+
2: y^3*e[1]
447+
3: z^4*e[1]
448+
449+
julia> is_zero(M)
450+
false
341451
```
342452

343453
## Basic Operations on Subquotients
@@ -423,6 +533,3 @@ degree(a:: SubQuoHom)
423533
```@docs
424534
grading_group(a:: SubQuoHom)
425535
```
426-
427-
428-

docs/src/CommutativeAlgebra/affine_algebras.md

Lines changed: 112 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,22 @@ simplify(f::MPolyQuoRingElem)
172172

173173
### Tests on Elements of Affine Algebras
174174

175-
```@docs
176-
==(f::MPolyQuoRingElem{T}, g::MPolyQuoRingElem{T}) where T
175+
Use `f == g` to test whether two elements of an affine algebra represent the
176+
same class modulo the defining ideal.
177+
178+
```jldoctest
179+
julia> R, (x,) = polynomial_ring(QQ, [:x]);
180+
181+
julia> A, p = quo(R, ideal(R, [x^4]));
182+
183+
julia> f = p(x-x^6)
184+
-x^6 + x
185+
186+
julia> g = p(x)
187+
x
188+
189+
julia> f == g
190+
true
177191
```
178192

179193
```@docs
@@ -280,21 +294,42 @@ minimal_generating_set(I::MPolyQuoIdeal{<:MPolyDecRingElem})
280294

281295
#### Simple Ideal Operations in Affine Algebras
282296

283-
##### Powers of Ideal
297+
If `a` and `b` are ideals in an affine algebra `A`, and `m` is a non-negative
298+
integer, then the standard ideal operations are available:
284299

285-
```@docs
286-
:^(a::MPolyQuoIdeal, m::Int)
287-
```
288-
##### Sum of Ideals
300+
- `a + b` for sums,
301+
- `a * b` for products, and
302+
- `a^m` for powers.
289303

290-
```@docs
291-
:+(a::MPolyQuoIdeal{T}, b::MPolyQuoIdeal{T}) where T
292-
```
304+
The following examples illustrate these operations.
305+
306+
```jldoctest
307+
julia> R, (x, y) = polynomial_ring(QQ, [:x, :y]);
293308
294-
##### Product of Ideals
309+
julia> A, _ = quo(R, [x^2-y, y^2-x+y]);
295310
296-
```@docs
297-
:*(a::MPolyQuoIdeal{T}, b::MPolyQuoIdeal{T}) where T
311+
julia> a = ideal(A, [x+y])
312+
Ideal generated by
313+
x + y
314+
315+
julia> b = ideal(A, [x^2+y^2, x+y])
316+
Ideal generated by
317+
x^2 + y^2
318+
x + y
319+
320+
julia> a+b
321+
Ideal generated by
322+
x + y
323+
x^2 + y^2
324+
325+
julia> a*b
326+
Ideal generated by
327+
x^3 + x^2*y + x*y^2 + y^3
328+
x^2 + 2*x*y + y^2
329+
330+
julia> a^2
331+
Ideal generated by
332+
x^2 + 2*x*y + y^2
298333
```
299334

300335
#### Intersection of Ideals
@@ -321,20 +356,78 @@ With respect to the decomposition of an ideal `Ì` in an affine algebra, we hav
321356

322357
#### Basic Tests
323358

324-
```@docs
325-
is_zero(a::MPolyQuoIdeal)
359+
For ideals in an affine algebra `A`, use `is_zero(a)` to check whether `a` is
360+
the zero ideal.
361+
362+
```jldoctest
363+
julia> R, (x, y) = polynomial_ring(QQ, [:x, :y]);
364+
365+
julia> A, _ = quo(R, [x^2-y, y^2-x+y]);
366+
367+
julia> a = ideal(A, [x^2+y^2, x+y])
368+
Ideal generated by
369+
x^2 + y^2
370+
x + y
371+
372+
julia> is_zero(a)
373+
false
374+
375+
julia> b = ideal(A, [x^2-y])
376+
Ideal generated by
377+
x^2 - y
378+
379+
julia> is_zero(b)
380+
true
326381
```
327382

328383
#### Containment of Ideals in Affine Algebras
329384

330-
```@docs
331-
is_subset(a::MPolyQuoIdeal{T}, b::MPolyQuoIdeal{T}) where T
385+
Use `is_subset(a, b)` to test whether an ideal `a` is contained in another
386+
ideal `b`.
387+
388+
```jldoctest
389+
julia> R, (x, y) = polynomial_ring(QQ, [:x, :y]);
390+
391+
julia> A, _ = quo(R, ideal(R, [x^3*y^2-y^3*x^2, x*y^4-x*y^2]));
392+
393+
julia> a = ideal(A, [x^3*y^4-x+y, x*y+y^2*x])
394+
Ideal generated by
395+
x^3*y^4 - x + y
396+
x*y^2 + x*y
397+
398+
julia> b = ideal(A, [x^3*y^3-x+y, x^2*y+y^2*x])
399+
Ideal generated by
400+
x^3*y^3 - x + y
401+
x^2*y + x*y^2
402+
403+
julia> is_subset(a, b)
404+
false
405+
406+
julia> is_subset(b, a)
407+
true
332408
```
333409

334410
#### Equality of Ideals in Affine Algebras
335411

336-
```@docs
337-
==(a::MPolyQuoIdeal{T}, b::MPolyQuoIdeal{T}) where T
412+
Use `a == b` to test equality of ideals.
413+
414+
```jldoctest
415+
julia> R, (x, y) = polynomial_ring(QQ, [:x, :y]);
416+
417+
julia> A, _ = quo(R, ideal(R, [x^3*y^2-y^3*x^2, x*y^4-x*y^2]));
418+
419+
julia> a = ideal(A, [x^3*y^4-x+y, x*y+y^2*x])
420+
Ideal generated by
421+
x^3*y^4 - x + y
422+
x*y^2 + x*y
423+
424+
julia> b = ideal(A, [x^3*y^3-x+y, x^2*y+y^2*x])
425+
Ideal generated by
426+
x^3*y^3 - x + y
427+
x^2*y + x*y^2
428+
429+
julia> a == b
430+
false
338431
```
339432

340433
#### Ideal Membership

0 commit comments

Comments
 (0)