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

Replace more uses of isFOO by is_foo #1270

Merged
merged 1 commit into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/src/abelian/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ is_snf(A::GrpAbFinGen)
ngens(A::GrpAbFinGen)
nrels(G::GrpAbFinGen)
rels(A::GrpAbFinGen)
isfinite(A::GrpAbFinGen)
is_finite(A::GrpAbFinGen)
is_infinite(A::GrpAbFinGen)
rank(A::GrpAbFinGen)
order(A::GrpAbFinGen)
exponent(A::GrpAbFinGen)
istrivial(A::GrpAbFinGen)
is_trivial(A::GrpAbFinGen)
is_torsion(G::GrpAbFinGen)
is_cyclic(G::GrpAbFinGen)
elementary_divisors(G::GrpAbFinGen)
Expand Down
2 changes: 1 addition & 1 deletion src/AlgAss/AbsAlgAss.jl
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ Given an étale algebra $A$, return the simple components of $A$
as fields $K$ together with the projection $A \to K$.
"""
function components(::Type{Field}, A::AbsAlgAss)
@assert iscommutative(A)
@assert is_commutative(A)
return as_number_fields(A)
end

Expand Down
28 changes: 14 additions & 14 deletions src/AlgAss/Ramification.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function is_split(A::AbsAlgAss{nf_elem})
end

function is_split(A::AbsAlgAss, P::InfPlc)
if iscomplex(P)
if is_complex(P)
return true
end
return schur_index(A, P) == 1
Expand Down Expand Up @@ -116,8 +116,8 @@ Determine the Schur index of $A$ at $p$, where $p$ is either a prime or `inf`.
schur_index(A::AbsAlgAss{QQFieldElem}, ::Union{IntegerUnion, PosInf})

function schur_index(A::AbsAlgAss{QQFieldElem}, ::PosInf)
@req iscentral(A) "Algebra must be central"
@req issimple(A) "Algebra must be simple"
@req is_central(A) "Algebra must be central"
@req is_simple(A) "Algebra must be simple"

dim(A) % 4 == 0 || return 1

Expand All @@ -132,8 +132,8 @@ function schur_index(A::AbsAlgAss{QQFieldElem}, ::PosInf)
end

function schur_index(A::AbsAlgAss{nf_elem}, P::InfPlc)
@req iscentral(A) "Algebra must be central"
@req issimple(A) "Algebra must be simple"
@req is_central(A) "Algebra must be central"
@req is_simple(A) "Algebra must be simple"

dim(A) % 4 == 0 && is_real(P) || return 1

Expand All @@ -150,8 +150,8 @@ end
# Schur Index at p

function schur_index(A::AbsAlgAss, p::IntegerUnion)
@req iscentral(A) "Algebra must be central"
@req issimple(A) "Algebra must be simple"
@req is_central(A) "Algebra must be central"
@req is_simple(A) "Algebra must be simple"

d = discriminant(maximal_order(A))
v = valuation(d, p)
Expand All @@ -164,8 +164,8 @@ function schur_index(A::AbsAlgAss, p::IntegerUnion)
end

function schur_index(A::AbsAlgAss{<: NumFieldElem}, p::NumFieldOrdIdl)
@req iscentral(A) "Algebra must be central"
@req issimple(A) "Algebra must be simple"
@req is_central(A) "Algebra must be central"
@req is_simple(A) "Algebra must be simple"

M = maximal_order(A)
d = discriminant(maximal_order(A))
Expand Down Expand Up @@ -206,7 +206,7 @@ end
################################################################################

function is_eichler(A::AbsAlgAss)
if issimple(A) && iscentral(A)
if is_simple(A) && is_central(A)
return _is_eichler_csa(A)
end
d = decompose(A)
Expand All @@ -222,8 +222,8 @@ end
# Tests whether A fulfils the Eichler condition relative to the maximal Z-order
# of base_ring(A)
function _is_eichler_csa(A::AbsAlgAss{nf_elem})
@assert issimple(A)
@assert iscentral(A)
@assert is_simple(A)
@assert is_central(A)

if !istotally_real(base_ring(A))
return true
Expand All @@ -244,8 +244,8 @@ function _is_eichler_csa(A::AbsAlgAss{nf_elem})
end

function _is_eichler_csa(A::AbsAlgAss{QQFieldElem})
@assert issimple(A)
@assert iscentral(A)
@assert is_simple(A)
@assert is_central(A)
if dim(A) != 4
return true
end
Expand Down
2 changes: 1 addition & 1 deletion src/AlgAssAbsOrd/Ideal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1781,7 +1781,7 @@ Returns the prime ideal factorization of $I$ as a dictionary.
function factor(I::AlgAssAbsOrdIdl)
@assert is_commutative(algebra(I))
O = order(I)
@hassert :AlgAssOrd ismaximal(O)
@hassert :AlgAssOrd is_maximal(O)
A = algebra(O)
fields_and_maps = as_number_fields(A)
@hassert :AlgAssOrd _test_ideal_sidedness(I, O, :left)
Expand Down
22 changes: 11 additions & 11 deletions src/AlgAssAbsOrd/PIP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2439,7 +2439,7 @@ function __isprincipal(O, I, side = :right, _alpha = nothing)

for (B, mB) in dec
MinB = Order(B, elem_type(B)[(mB\(mB(one(B)) * elem_in_algebra(b))) for b in absolute_basis(M)])
#@show ismaximal(MinC)
#@show is_maximal(MinC)
#@show hnf(basis_matrix(MinC))
IMinB = ideal_from_lattice_gens(B, elem_type(B)[(mB\(b)) for b in absolute_basis(IM)])
IMinB_basis = [mB(u) for u in absolute_basis(IMinB)]
Expand Down Expand Up @@ -2537,7 +2537,7 @@ function __isprincipal(O, I, side = :right, _alpha = nothing)
indices_nonintegral = Vector{Int}[Int[] for i in 1:l]
for j in 1:length(local_coeffs[end])
for i in o:(o + l - 1)
if isintegral(local_coeffs[end][j][i])
if is_integral(local_coeffs[end][j][i])
push!(indices_integral[i - o + 1], j)
else
push!(indices_nonintegral[i - o + 1], j)
Expand Down Expand Up @@ -2613,25 +2613,25 @@ function _old_optimization(dd, local_coeffs, dec, bases_offsets_and_lengths, H,
end
#@show vtemp
#@assert vtemp == reduce(.+, (local_coeffs[j][idx[j]] for j in 1:length(dec) - 1))
if any(!isintegral, @view vtemp[1:bases_offsets_and_lengths[end][1] - 1])
if any(!is_integral, @view vtemp[1:bases_offsets_and_lengths[end][1] - 1])
l += 1
j = findfirst([any(!isintegral, vtemp[bases_offsets_and_lengths[j][1]:bases_offsets_and_lengths[j + 1][1] - 1]) for j in 1:length(dec) - 1])
j = findfirst([any(!is_integral, vtemp[bases_offsets_and_lengths[j][1]:bases_offsets_and_lengths[j + 1][1] - 1]) for j in 1:length(dec) - 1])
ll[j] += 1
continue
else
@vprintln :PIP "good"
end
o = bases_offsets_and_lengths[end][1]
l = bases_offsets_and_lengths[end][2]
ids = reduce(intersect, [isintegral(vtemp[o - 1 + i]) ? indices_integral[i] : indices_nonintegral[i] for i in 1:l])
ids = reduce(intersect, [is_integral(vtemp[o - 1 + i]) ? indices_integral[i] : indices_nonintegral[i] for i in 1:l])
_vtempcopy = deepcopy(vtemp)
#@show length(ids)
for j in ids
#for i in 1:dd
# ccall((:fmpq_set, libflint), Ref{Nothing}, (Ref{QQFieldElem}, Ref{QQFieldElem}), vtemp[i], _vtempcopy[i])
#end
_vtemp = deepcopy(vtemp) .+ local_coeffs[end][j]
if all(isintegral, _vtemp)
if all(is_integral, _vtemp)
@vprintln :PIP "found x = $((idx...,j))"
return true, A(_vtemp * (H * special_basis_matrix))
end
Expand All @@ -2653,18 +2653,18 @@ function _recursive_iterator!(x, lengths, d, elts::Vector, bases_offsets, indice
# We do something clever for the indices
o = bases_offsets[end][1]
l = bases_offsets[end][2]
ids = copy(isintegral(vtemp[o]) ? indices_integral[1] : indices_nonintegral[1])
ids = copy(is_integral(vtemp[o]) ? indices_integral[1] : indices_nonintegral[1])
for i in 2:l
intersect!(ids, isintegral(vtemp[o - 1 + i]) ? indices_integral[i] : indices_nonintegral[i])
intersect!(ids, is_integral(vtemp[o - 1 + i]) ? indices_integral[i] : indices_nonintegral[i])
end

#ids2 = reduce(intersect!, (isintegral(vtemp[o - 1 + i]) ? indices_integral[i] : indices_nonintegral[i] for i in 1:l))
#ids2 = reduce(intersect!, (is_integral(vtemp[o - 1 + i]) ? indices_integral[i] : indices_nonintegral[i] for i in 1:l))
#@assert ids == ids2

for j in ids # 1:lengths[i]
x[i] = j
if _is_admissible(x, i, d, elts, bases_offsets, vtemp)
#@assert all(isintegral, reduce(.+, (elts[k][x[k]] for k in 1:length(elts))))
#@assert all(is_integral, reduce(.+, (elts[k][x[k]] for k in 1:length(elts))))
return true
end
#if _is_admissible(x, i, d, elts, bases_offsets)
Expand Down Expand Up @@ -2716,7 +2716,7 @@ function _is_admissible(x, i, d, elts, bases_offsets, vtemp)

vvtemp = @view vtemp[bases_offsets[i][1]:(bases_offsets[i][1] + bases_offsets[i][2] - 1)]

if any(!isintegral, vvtemp)
if any(!is_integral, vvtemp)
return false
else
return true
Expand Down
10 changes: 5 additions & 5 deletions src/AlgAssAbsOrd/UnitGroup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
################################################################################

function unit_group(O::AlgAssAbsOrd)
@assert iscommutative(O)
@assert is_commutative(O)
mU = get_attribute!(O, :unit_group) do
if ismaximal(O)
if is_maximal(O)
U, mU = _unit_group_maximal(O)
else
OK = maximal_order(O)
Expand All @@ -20,9 +20,9 @@ function unit_group(O::AlgAssAbsOrd)
end

function unit_group_fac_elem(O::AlgAssAbsOrd)
@assert iscommutative(O)
@assert is_commutative(O)
mU = get_attribute!(O, :unit_group_fac_elem) do
if ismaximal(O)
if is_maximal(O)
U, mU = _unit_group_maximal_fac_elem(O)
else
OK = maximal_order(O)
Expand Down Expand Up @@ -192,7 +192,7 @@ function unit_group_positive(O::AlgAssAbsOrd, rlpl)
uinK = co[i][2](u)
for r in rlpl[i]
@assert number_field(r) === co[i][1]
if ispositive(uinK, r)
if is_positive(uinK, r)
push!(imu, 0)
else
push!(imu, 1)
Expand Down
1 change: 0 additions & 1 deletion src/Aliases.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# make some Julia names compatible with our naming conventions
@alias is_trivial istrivial
@alias is_hermitian ishermitian

# for backwards compatibility
Expand Down
2 changes: 1 addition & 1 deletion src/EllCrv/EllCrv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ y^2 + x*y = x^3 + x + 1
```
"""
function elliptic_curve(f::PolyRingElem{T}, h::PolyRingElem{T} = zero(parent(f)); check::Bool = true) where T
@req ismonic(f) "First polynomial must be monic"
@req is_monic(f) "First polynomial must be monic"
@req degree(f) == 3 "First polynomial must be of degree 3"
@req degree(h) <= 1 "Second polynomial must be of degree at most 1"
R = base_ring(f)
Expand Down
4 changes: 2 additions & 2 deletions src/EllCrv/Heights.jl
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function local_height(P::EllCrvPt{QQFieldElem}, p, prec::Int = 100)
return _real_height(P, prec)
end

@req p > 0 && isprime(p) "p must be 0 or a non-negative prime"
@req p > 0 && is_prime(p) "p must be 0 or a non-negative prime"

E = parent(P)
F, phi = minimal_model(E)
Expand Down Expand Up @@ -224,7 +224,7 @@ function local_height(P::EllCrvPt{nf_elem}, pIdeal::NfOrdIdl, prec::Int = 100)
# return _real_height(P, prec)
#end

@req #=p > 0 &&=# isprime(pIdeal) "p must be 0 or a non-negative prime"
@req #=p > 0 &&=# is_prime(pIdeal) "p must be 0 or a non-negative prime"

E = parent(P)
K = base_field(E)
Expand Down
2 changes: 1 addition & 1 deletion src/EllCrv/LocalData.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,7 @@ end
Return the reduction of $E$ modulo the prime ideal p if p has good reduction
"""
function modp_reduction(E::EllCrv{nf_elem}, p::NfOrdIdl)
if !isprime(p)
if !is_prime(p)
throw(DomainError(p,"p is not a prime ideal"))
end

Expand Down
2 changes: 1 addition & 1 deletion src/EllCrv/ModularPolynomials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function atkin_modular_polynomial(n::Int)
end

function atkin_modular_polynomial(R::MPolyRing, n::Int)
@req isprime(n) "Level ($n) must be prime"
@req is_prime(n) "Level ($n) must be prime"
@req 1 <= n <= 400 "Database only contains Atkin modular polynomials up to level 400"
get!(_atkin_modular_polynomial_cache, (R, n)) do
open(joinpath(default_atkin_mod_pol_db, "$n")) do io
Expand Down
2 changes: 1 addition & 1 deletion src/EllCrv/Torsion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ having found a basis that spans p^r points.
"""
function pr_torsion_basis(E::EllCrv{T}, p, r = typemax(Int)) where T <: Union{nf_elem, QQFieldElem}

if !isprime(p)
if !is_prime(p)
error("p should be a prime number")
end

Expand Down
18 changes: 8 additions & 10 deletions src/GrpAb/GrpAbFinGen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@
#
################################################################################

import AbstractAlgebra.GroupsCore: istrivial

export abelian_group, free_abelian_group, is_snf, ngens, nrels, rels, snf, isfinite,
is_infinite, rank, order, exponent, istrivial, is_isomorphic,
is_infinite, rank, order, exponent, is_trivial, is_isomorphic,
direct_product, is_torsion, torsion_subgroup, sub, quo, is_cyclic,
psylow_subgroup, is_subgroup, abelian_groups, flat, tensor_product,
dual, chain_complex, is_exact, free_resolution, obj, map,
Expand Down Expand Up @@ -563,11 +561,11 @@ exponent_gen(A::GrpAbFinGen) = exponent(snf(A)[1])
################################################################################

@doc raw"""
istrivial(A::GrpAbFinGen) -> Bool
is_trivial(A::GrpAbFinGen) -> Bool

Return whether $A$ is the trivial group.
"""
istrivial(A::GrpAbFinGen) = isfinite(A) && isone(order(A))
is_trivial(A::GrpAbFinGen) = isfinite(A) && isone(order(A))

################################################################################
#
Expand Down Expand Up @@ -644,7 +642,7 @@ For finite abelian groups, finite direct sums and finite direct products agree a
they are therefore called biproducts.
If one wants to obtain $D$ as a direct sum together with the injections $G_i \to D$,
one should call `direct_sum(G...)`.
If one wants to obtain $D$ as a direct product together with the projections $D \to G_i$,
If one wants to obtain $D$ as a direct product together with the projections $D \to G_i$,
one should call `direct_product(G...)`.

Otherwise, one could also call `canonical_injections(D)` or `canonical_projections(D)`
Expand Down Expand Up @@ -723,7 +721,7 @@ end
⊕(A::GrpAbFinGen...) = direct_sum(A..., task = :none)
export ⊕

#TODO: use matrices as above - or design special maps that are not tied
#TODO: use matrices as above - or design special maps that are not tied
# to matrices but operate directly.
@doc raw"""
canonical_injections(G::GrpAbFinGen) -> Vector{GrpAbFinGenMap}
Expand All @@ -736,7 +734,7 @@ function canonical_injections(G::GrpAbFinGen)
D === nothing && error("1st argument must be a direct product")
return [canonical_injection(G, i) for i=1:length(D)]
end

@doc raw"""
canonical_injection(G::GrpAbFinGen, i::Int) -> GrpAbFinGenMap

Expand All @@ -762,7 +760,7 @@ function canonical_projections(G::GrpAbFinGen)
D === nothing && error("1st argument must be a direct product")
return [canonical_projection(G, i) for i=1:length(D)]
end

@doc raw"""
canonical_projection(G::GrpAbFinGen, i::Int) -> GrpAbFinGenMap

Expand Down Expand Up @@ -2071,7 +2069,7 @@ end
has_complement(f::GrpAbFinGenMap) -> Bool, GrpAbFinGenMap
has_complement(U::GrpAbFinGen, G::GrpAbFinGen) -> Bool, GrpAbFinGenMap

Given a map representing a subgroup of a group $G$,
Given a map representing a subgroup of a group $G$,
or a subgroup `U` of a group `G`, return either true and
an injection of a complement in $G$, or false.

Expand Down
Loading