Skip to content

Commit

Permalink
Make new versions of AA, Nemo, Hecke available (#3231)
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens authored Jan 27, 2024
1 parent 56feead commit 910cd54
Show file tree
Hide file tree
Showing 58 changed files with 334 additions and 307 deletions.
8 changes: 4 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,23 @@ UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
cohomCalg_jll = "5558cf25-a90e-53b0-b813-cadaa3ae7ade"

[compat]
AbstractAlgebra = "0.35.2"
AbstractAlgebra = "0.36.6"
AlgebraicSolving = "0.4.6"
Distributed = "1.6"
DocStringExtensions = "0.8, 0.9"
GAP = "0.10.2"
Hecke = "0.24.0"
Hecke = "0.25.0"
JSON = "^0.20, ^0.21"
JSON3 = "1.13.2"
LazyArtifacts = "1.6"
Nemo = "0.39.1"
Nemo = "0.40.1"
Pkg = "1.6"
Polymake = "0.11.8"
Preferences = "1"
Random = "1.6"
RandomExtensions = "0.4.3"
Serialization = "1.6"
Singular = "0.21.2"
Singular = "0.22.0"
TOPCOM_jll = "0.17.8"
UUIDs = "1.6"
cohomCalg_jll = "0.32.0"
Expand Down
12 changes: 6 additions & 6 deletions docs/src/CommutativeAlgebra/rings.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,18 @@ Rational field

```jldoctest
julia> GF(3)
Finite field of degree 1 over GF(3)
Prime field of characteristic 3
julia> GF(ZZ(2)^127 - 1)
Finite field of degree 1 over GF(170141183460469231731687303715884105727)
Prime field of characteristic 170141183460469231731687303715884105727
```

### Finite fields $\mathbb{F}_{p^n}$ with $p^n$ elements, $p$ a prime

```jldoctest
julia> finite_field(2, 70, "a")
(Finite field of degree 70 over GF(2), a)
(Finite field of degree 70 and characteristic 2, a)
```

Expand All @@ -151,13 +151,13 @@ julia> K, a = number_field(t^2 + 1, "a")
(Number field of degree 2 over QQ, a)
julia> F = GF(3)
Finite field of degree 1 over GF(3)
Prime field of characteristic 3
julia> T, t = polynomial_ring(F, "t")
(Univariate polynomial ring in t over GF(3), t)
julia> K, a = finite_field(t^2 + 1, "a")
(Finite field of degree 2 over GF(3), a)
(Finite field of degree 2 and characteristic 3, a)
```

Expand Down Expand Up @@ -459,7 +459,7 @@ x^3*y^2 + 2*x + 3*y
julia> parent(f)
Multivariate polynomial ring in 2 variables x, y
over finite field of degree 1 over GF(5)
over prime field of characteristic 5
julia> total_degree(f)
5
Expand Down
2 changes: 1 addition & 1 deletion docs/src/NumberTheory/galois.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ julia> G, C = galois_group(f)
(Permutation group of degree 4 and order 4, Galois context for x^4 - 5*x^2 + 6 and prime 11)
julia> r = roots(C, 5)
4-element Vector{qadic}:
4-element Vector{QadicFieldElem}:
5*11^0 + 2*11^1 + 6*11^2 + 8*11^3 + 11^4 + O(11^5)
6*11^0 + 8*11^1 + 4*11^2 + 2*11^3 + 9*11^4 + O(11^5)
(10*11^0 + 4*11^1 + 4*11^2 + 10*11^3 + 8*11^4 + O(11^5))*a + 2*11^0 + 6*11^1 + 4*11^2 + 3*11^3 + 9*11^4 + O(11^5)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ function _simplify_matrix!(A::SMat; find_pivot=nothing)
found_unit && break
for (j, c) in v
j in done_columns && continue
if isunit(c)
if is_unit(c)
p = i
q = j
found_unit = true
Expand All @@ -433,7 +433,7 @@ function _simplify_matrix!(A::SMat; find_pivot=nothing)
found_unit && break
for (j, c) in v
j in done_columns && continue
if isunit(c)
if is_unit(c)
p = i
q = j
found_unit = true
Expand Down
2 changes: 1 addition & 1 deletion experimental/ExteriorAlgebra/ExteriorAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function exterior_algebra(K::Field, listOfVarNames::AbstractVector{<:VarName})
SINGULAR_PTR = Singular.libSingular.exteriorAlgebra(Singular.libSingular.rCopy(P.ptr))
ExtAlg_singular = Singular.create_ring_from_singular_ring(SINGULAR_PTR)
# Create Quotient ring with special implementation:
ExtAlg,_ = quo(PBW, I; SpecialImpl = ExtAlg_singular) # 2nd result is a QuoMap, apparently not needed
ExtAlg, _ = quo(PBW, I; SpecialImpl = ExtAlg_singular) # 2nd result is a QuoMap, apparently not needed
###### set_attribute!(ExtAlg, :is_exterior_algebra, :true) ### DID NOT WORK (see PBWAlgebraQuo.jl) Anyway, the have_special_impl function suffices.
return ExtAlg, gens(ExtAlg)
end
Expand Down
141 changes: 81 additions & 60 deletions experimental/ExteriorAlgebra/test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,58 +1,82 @@
@testset "ExteriorAlgebra" begin

### 2023-02-10 Tests for experimental/ExteriorAlgebra/ExteriorAlgebra.jl

######## CONSTRUCTOR TESTs
@test_throws ArgumentError exterior_algebra(QQ, 0);
exterior_algebra(QQ, 1); # --> special case (is commutative)
exterior_algebra(QQ, 2); # --> first general case
exterior_algebra(QQ, 99); # --> Also tried with 999 indets, but takes a long time [~19s]


exterior_algebra(GF(2), 2); # BUG?? not recognized as commutative!!
exterior_algebra(GF(3), 4);
## exterior_algebra(GF(2), 1500); ## limit 1500 on my 32Gbyte machine (!NB printing requires a lot of space!)

@test_broken exterior_algebra(GF(1180591620717411303449), 2); # --> ERROR prime too big (for GF)

# Duplicate names are allowed
exterior_algebra(QQ, ["x", "y", "x"]);


# residue_field produces a different result from GF... Singular does not like it
@test_broken exterior_algebra(residue_field(ZZ,2), 2);
@test_broken exterior_algebra(residue_field(ZZ,3), 4);
@test_broken exterior_algebra(residue_field(ZZ,1180591620717411303449), 2);


@test_throws MethodError exterior_algebra(ZZ, 3) # Coeffs not field
@test_throws MethodError exterior_algebra(residue_ring(ZZ,4), 3) # Coeffs not field

@test_throws ArgumentError exterior_algebra(QQ, String[]); # empty name list


## (reduced) COMPUTATIONAL SPEED TEST

ExtAlg, (e1,e2,e3,e4,e5,e6) = exterior_algebra(QQ, 6);
fac1 = e1 + 2*e1*e2 + 3*e1*e2*e3 + 4*e1*e2*e3*e4 + 5*e1*e2*e3*e4*e5 + 6*e1*e2*e3*e4*e5*e6;
fac2 = e6 + 2*e5*e6 + 3*e4*e5*e6 + 4*e3*e4*e5*e6 + 5*e2*e3*e4*e5*e6 + 6*e1*e2*e3*e4*e5*e6;
prod12 = fac1*fac2;
prod21 = fac2*fac1;
expected12 = 35*e1*e2*e3*e4*e5*e6 +4*e1*e2*e3*e4*e6 +6*e1*e2*e3*e5*e6 +6*e1*e2*e4*e5*e6 +4*e1*e3*e4*e5*e6 +3*e1*e2*e3*e6 +4*e1*e2*e5*e6 +3*e1*e4*e5*e6 +2*e1*e2*e6 +2*e1*e5*e6 +e1*e6;
expected21 = - 3*e1*e2*e3*e4*e5*e6 + 4*e1*e2*e3*e4*e6 + 6*e1*e2*e3*e5*e6 + 6*e1*e2*e4*e5*e6 + 4*e1*e3*e4*e5*e6 - 3*e1*e2*e3*e6 + 4*e1*e2*e5*e6 - 3*e1*e4*e5*e6 + 2*e1*e2*e6 + 2*e1*e5*e6 - e1*e6;
@test is_zero(prod12 - expected12);
@test is_zero(prod21 - expected21);

@test is_zero(fac1*prod12);
@test is_zero(prod12*fac1);
@test is_zero(fac2*prod12);
@test is_zero(prod12*fac2);

@test is_zero(fac1*prod21);
@test is_zero(prod21*fac1);
@test is_zero(fac2*prod21);
@test is_zero(prod21*fac2);

### 2023-02-10 Tests for experimental/ExteriorAlgebra/ExteriorAlgebra.jl

######## CONSTRUCTOR TESTs
@test_throws ArgumentError exterior_algebra(QQ, 0)
exterior_algebra(QQ, 1) # --> special case (is commutative)
exterior_algebra(QQ, 2) # --> first general case
exterior_algebra(QQ, 99) # --> Also tried with 999 indets, but takes a long time [~19s]

exterior_algebra(GF(2), 2) # BUG?? not recognized as commutative!!
exterior_algebra(GF(3), 4)
exterior_algebra(residue_field(ZZ, 2)[1], 2)
exterior_algebra(residue_field(ZZ, 3)[1], 4)
## exterior_algebra(GF(2), 1500); ## limit 1500 on my 32Gbyte machine (!NB printing requires a lot of space!)

@test_broken exterior_algebra(GF(1180591620717411303449), 2) # --> ERROR prime too big (for GF)
@test_broken exterior_algebra(residue_field(ZZ, 1180591620717411303449)[1], 2)

# Duplicate names are allowed
exterior_algebra(QQ, ["x", "y", "x"])

@test_throws MethodError exterior_algebra(ZZ, 3) # Coeffs not field
@test_throws MethodError exterior_algebra(residue_ring(ZZ, 4)[1], 3) # Coeffs not field

@test_throws ArgumentError exterior_algebra(QQ, String[]) # empty name list

## (reduced) COMPUTATIONAL SPEED TEST

ExtAlg, (e1, e2, e3, e4, e5, e6) = exterior_algebra(QQ, 6)
fac1 =
e1 +
2 * e1 * e2 +
3 * e1 * e2 * e3 +
4 * e1 * e2 * e3 * e4 +
5 * e1 * e2 * e3 * e4 * e5 +
6 * e1 * e2 * e3 * e4 * e5 * e6
fac2 =
e6 +
2 * e5 * e6 +
3 * e4 * e5 * e6 +
4 * e3 * e4 * e5 * e6 +
5 * e2 * e3 * e4 * e5 * e6 +
6 * e1 * e2 * e3 * e4 * e5 * e6
prod12 = fac1 * fac2
prod21 = fac2 * fac1
expected12 =
35 * e1 * e2 * e3 * e4 * e5 * e6 +
4 * e1 * e2 * e3 * e4 * e6 +
6 * e1 * e2 * e3 * e5 * e6 +
6 * e1 * e2 * e4 * e5 * e6 +
4 * e1 * e3 * e4 * e5 * e6 +
3 * e1 * e2 * e3 * e6 +
4 * e1 * e2 * e5 * e6 +
3 * e1 * e4 * e5 * e6 +
2 * e1 * e2 * e6 +
2 * e1 * e5 * e6 +
e1 * e6
expected21 =
-3 * e1 * e2 * e3 * e4 * e5 * e6 +
4 * e1 * e2 * e3 * e4 * e6 +
6 * e1 * e2 * e3 * e5 * e6 +
6 * e1 * e2 * e4 * e5 * e6 +
4 * e1 * e3 * e4 * e5 * e6 - 3 * e1 * e2 * e3 * e6 + 4 * e1 * e2 * e5 * e6 -
3 * e1 * e4 * e5 * e6 +
2 * e1 * e2 * e6 +
2 * e1 * e5 * e6 - e1 * e6
@test is_zero(prod12 - expected12)
@test is_zero(prod21 - expected21)

@test is_zero(fac1 * prod12)
@test is_zero(prod12 * fac1)
@test is_zero(fac2 * prod12)
@test is_zero(prod12 * fac2)

@test is_zero(fac1 * prod21)
@test is_zero(prod21 * fac1)
@test is_zero(fac2 * prod21)
@test is_zero(prod21 * fac2)
end

# # -------------------------------------------------------
Expand All @@ -68,24 +92,21 @@ end
# exterior_algebra_PBWAlgQuo(QQ, 2); # --> first general case
# exterior_algebra_PBWAlgQuo(QQ, 99); # --> with 999 indets takes a long time [~19s]


# exterior_algebra_PBWAlgQuo(GF(2), 2); # BUG?? not recognized as commutative!!
# exterior_algebra_PBWAlgQuo(GF(3), 4);
# ## exterior_algebra_PBWAlgQuo(GF(2), 1500); ## limit 1500 on my 32Gbyte machine (!NB printing requires a lot of space!)

# ### exterior_algebra_PBWAlgQuo(GF(1180591620717411303449), 2); # --> ERROR prime too big (for GF)

# exterior_algebra_PBWAlgQuo(residue_field(ZZ, 2)[1], 2);
# exterior_algebra_PBWAlgQuo(residue_field(ZZ, 3)[1], 4);
# exterior_algebra_PBWAlgQuo(residue_field(ZZ, 1180591620717411303449)[1], 2);

# exterior_algebra_PBWAlgQuo(residue_field(ZZ,2), 2);
# exterior_algebra_PBWAlgQuo(residue_field(ZZ,3), 4);
# exterior_algebra_PBWAlgQuo(residue_field(ZZ,1180591620717411303449), 2);

# exterior_algebra_PBWAlgQuo(residue_ring(ZZ,4), 3) # Coeffs not integral domain
# exterior_algebra_PBWAlgQuo(residue_ring(ZZ,4)[1], 3) # Coeffs not integral domain

# @test_throws ArgumentError exterior_algebra_PBWAlgQuo(QQ, String[]); # empty name list
# exterior_algebra_PBWAlgQuo(QQ, ["x", "y", "x"]); # !!duplicate names are allowed!!


# ## (reduced) COMPUTATIONAL SPEED TEST

# ExtAlg, (e1,e2,e3,e4,e5,e6) = exterior_algebra_PBWAlgQuo(QQ, 6);
Expand Down
18 changes: 9 additions & 9 deletions experimental/GModule/GaloisCohomology.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export local_index, units_mod_ideal
Oscar.elem_type(::Type{Hecke.NfMorSet{T}}) where {T <: Hecke.LocalField} = Hecke.LocalFieldMor{T, T}
parent(f::Hecke.LocalFieldMor) = Hecke.NfMorSet(domain(f))

_can_cache_aut(::FlintPadicField) = nothing
_can_cache_aut(::PadicField) = nothing
function _can_cache_aut(k)
a = get_attribute(k, :AutGroup)
if a === nothing
Expand Down Expand Up @@ -317,7 +317,7 @@ end
=#

"""
gmodule(K::Hecke.LocalField, k::Union{Hecke.LocalField, FlintPadicField, FlintQadicField} = base_field(K); Sylow::Int = 0, full::Bool = false)
gmodule(K::Hecke.LocalField, k::Union{Hecke.LocalField, PadicField, QadicField} = base_field(K); Sylow::Int = 0, full::Bool = false)
For a local field extension K/k, return the multiplicative
group of K as a Gal(K/k) module. Strictly, it returns a quotient
Expand All @@ -332,7 +332,7 @@ Returns:
- the map from G = Gal(K/k) -> Set of actual automorphisms
- the map from the module into K
"""
function Oscar.gmodule(K::Hecke.LocalField, k::Union{Hecke.LocalField, FlintPadicField, FlintQadicField} = base_field(K); Sylow::Int = 0, full::Bool = false)
function Oscar.gmodule(K::Hecke.LocalField, k::Union{Hecke.LocalField, PadicField, QadicField} = base_field(K); Sylow::Int = 0, full::Bool = false)

#if K/k is unramified, then the units are cohomological trivial,
# so Z (with trivial action) is correct for the gmodule
Expand Down Expand Up @@ -439,7 +439,7 @@ function Oscar.gmodule(K::Hecke.LocalField, k::Union{Hecke.LocalField, FlintPadi
end

#= Not used
function one_unit_cohomology(K::Hecke.LocalField, k::Union{Hecke.LocalField, FlintPadicField, FlintQadicField} = base_field(K))
function one_unit_cohomology(K::Hecke.LocalField, k::Union{Hecke.LocalField, PadicField, QadicField} = base_field(K))
U, mU = Hecke.one_unit_group(K)
G, mG = automorphism_group(PermGroup, K, k)
Expand Down Expand Up @@ -555,7 +555,7 @@ function debeerst(M::GrpAbFinGen, sigma::Map{GrpAbFinGen, GrpAbFinGen})

_K, _mK = snf(K)
_S, _mS = snf(S)
@assert istrivial(_S) || rank(_S) == ngens(_S)
@assert is_trivial(_S) || rank(_S) == ngens(_S)
@assert rank(_K) == ngens(_K)

m = matrix(GrpAbFinGenMap(_mS * mSK * inv((_mK))))
Expand All @@ -564,15 +564,15 @@ function debeerst(M::GrpAbFinGen, sigma::Map{GrpAbFinGen, GrpAbFinGen})
# elt in S * U^-1 U m V V^-1 = elt_in K
# elt in S * U^-1 snf = elt_in * V
s, U, V = snf_with_transform(m)
if istrivial(S)
if is_trivial(S)
r = 0
else
r = maximum(findall(x->isone(s[x,x]), 1:ngens(_S)))
end

mu = hom(_S, _S, inv(U))
mv = hom(_K, _K, V)
@assert istrivial(S) || all(i-> M(_mS(mu(gen(_S, i)))) == s[i,i] * M(_mK(mv(gen(_K, i)))), 1:ngens(S))
@assert is_trivial(S) || all(i-> M(_mS(mu(gen(_S, i)))) == s[i,i] * M(_mK(mv(gen(_K, i)))), 1:ngens(S))
b = [_mK(mv(x)) for x = gens(_K)]

Q, mQ = quo(S, image(sigma -id_hom(M), K)[1])
Expand Down Expand Up @@ -1185,8 +1185,8 @@ function induce_hom(ml::Hecke.CompletionMap, mL::Hecke.CompletionMap, mkK::NfToN
#so need embedding of the unram parts:
bl = base_field(l)
bL = base_field(L)
@assert isa(bl, FlintQadicField)
@assert isa(bL, FlintQadicField)
@assert isa(bl, QadicField)
@assert isa(bL, QadicField)
@assert degree(bL) % degree(bl) == 0
rL, mrL = residue_field(bL)
rl, mrl = residue_field(bl)
Expand Down
3 changes: 2 additions & 1 deletion experimental/LieAlgebras/src/LieAlgebras.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module LieAlgebras

using ..Oscar

import Oscar: GAPWrap, GroupsCore, IntegerUnion, MapHeader
import Oscar: GAPWrap, IntegerUnion, MapHeader

import Random

Expand Down Expand Up @@ -52,6 +52,7 @@ import ..Oscar:
inv,
is_abelian,
is_exterior_power,
is_finite,
is_isomorphism,
is_nilpotent,
is_perfect,
Expand Down
Loading

0 comments on commit 910cd54

Please sign in to comment.