Skip to content

Commit

Permalink
Rename is_exterior_power to is_exterior_power_with_data (and frie…
Browse files Browse the repository at this point in the history
…nds)
  • Loading branch information
lgoettgens committed Feb 16, 2024
1 parent a4f5d1e commit b19369b
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 65 deletions.
6 changes: 3 additions & 3 deletions experimental/LieAlgebras/docs/src/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ is_standard_module(::LieAlgebraModule)
is_dual(::LieAlgebraModule)
is_direct_sum(::LieAlgebraModule)
is_tensor_product(::LieAlgebraModule)
is_exterior_power(::LieAlgebraModule)
is_symmetric_power(::LieAlgebraModule)
is_tensor_power(::LieAlgebraModule)
is_exterior_power_with_data(::LieAlgebraModule)
is_symmetric_power_with_data(::LieAlgebraModule)
is_tensor_power_with_data(::LieAlgebraModule)
```
42 changes: 21 additions & 21 deletions experimental/LieAlgebras/src/LieAlgebraModule.jl
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ function Base.show(io::IO, ::MIME"text/plain", V::LieAlgebraModule)
if is_dual(V)[1] ||
is_direct_sum(V)[1] ||
is_tensor_product(V)[1] ||
is_exterior_power(V)[1] ||
is_symmetric_power(V)[1] ||
is_tensor_power(V)[1]
is_exterior_power_with_data(V)[1] ||
is_symmetric_power_with_data(V)[1] ||
is_tensor_power_with_data(V)[1]
_show_inner(io, V)
end
print(io, Dedent())
Expand Down Expand Up @@ -190,17 +190,17 @@ function _show_inner(io::IO, V::LieAlgebraModule)
_show_inner(io, W)
end
print(io, Dedent())
elseif ((fl, W, k) = is_exterior_power(V); fl)
elseif ((fl, W, k) = is_exterior_power_with_data(V); fl)
println(io, "$(ordinal_number_string(k)) exterior power of")
print(io, Indent())
_show_inner(io, W)
print(io, Dedent())
elseif ((fl, W, k) = is_symmetric_power(V); fl)
elseif ((fl, W, k) = is_symmetric_power_with_data(V); fl)
println(io, "$(ordinal_number_string(k)) symmetric power of")
print(io, Indent())
_show_inner(io, W)
print(io, Dedent())
elseif ((fl, W, k) = is_tensor_power(V); fl)
elseif ((fl, W, k) = is_tensor_power_with_data(V); fl)
println(io, "$(ordinal_number_string(k)) tensor power of")
print(io, Indent())
_show_inner(io, W)
Expand Down Expand Up @@ -229,11 +229,11 @@ function _module_type_to_string(V::LieAlgebraModule)
return "Direct sum module"
elseif is_tensor_product(V)[1]
return "Tensor product module"
elseif is_exterior_power(V)[1]
elseif is_exterior_power_with_data(V)[1]
return "Exterior power module"
elseif is_symmetric_power(V)[1]
elseif is_symmetric_power_with_data(V)[1]
return "Symmetric power module"
elseif is_tensor_power(V)[1]
elseif is_tensor_power_with_data(V)[1]
return "Tensor power module"
else
return "Abstract Lie algebra module"
Expand Down Expand Up @@ -365,13 +365,13 @@ function (V::LieAlgebraModule{C})(
elseif is_tensor_product(V)[1]
pure = get_attribute(V, :tensor_pure_function)
return pure(a)::elem_type(V)
elseif is_exterior_power(V)[1]
elseif is_exterior_power_with_data(V)[1]
pure = get_attribute(V, :wedge_pure_function)
return pure(a)::elem_type(V)
elseif is_symmetric_power(V)[1]
elseif is_symmetric_power_with_data(V)[1]
pure = get_attribute(V, :mult_pure_function)
return pure(a)::elem_type(V)
elseif is_tensor_power(V)[1]
elseif is_tensor_power_with_data(V)[1]
pure = get_attribute(V, :tensor_pure_function)
return pure(a)::elem_type(V)
else
Expand All @@ -388,11 +388,11 @@ function _is_allowed_input_length(V::LieAlgebraModule, a::Int)
return a == length(Vs)
elseif ((fl, Vs) = is_tensor_product(V); fl)
return a == length(Vs)
elseif ((fl, W, k) = is_exterior_power(V); fl)
elseif ((fl, W, k) = is_exterior_power_with_data(V); fl)
return a == k
elseif ((fl, W, k) = is_symmetric_power(V); fl)
elseif ((fl, W, k) = is_symmetric_power_with_data(V); fl)
return a == k
elseif ((fl, W, k) = is_tensor_power(V); fl)
elseif ((fl, W, k) = is_tensor_power_with_data(V); fl)
return a == k
else
throw(ArgumentError("Invalid input."))
Expand Down Expand Up @@ -576,13 +576,13 @@ function is_tensor_product(V::LieAlgebraModule)
end

@doc raw"""
is_exterior_power(V::LieAlgebraModule{C}) -> Bool, LieAlgebraModule{C}, Int
is_exterior_power_with_data(V::LieAlgebraModule{C}) -> Bool, LieAlgebraModule{C}, Int
Check whether `V` has been constructed as an exterior power of a module.
If it has, return `true`, the base module, and the power.
If not, return `false` as the first return value, and arbitrary values for the other two.
"""
function is_exterior_power(V::LieAlgebraModule)
function is_exterior_power_with_data(V::LieAlgebraModule)
if has_attribute(V, :is_exterior_power)
W, k = get_attribute(V, :is_exterior_power)::Tuple{typeof(V),Int}
return (true, W, k)
Expand All @@ -591,13 +591,13 @@ function is_exterior_power(V::LieAlgebraModule)
end

@doc raw"""
is_symmetric_power(V::LieAlgebraModule{C}) -> Bool, LieAlgebraModule{C}, Int
is_symmetric_power_with_data(V::LieAlgebraModule{C}) -> Bool, LieAlgebraModule{C}, Int
Check whether `V` has been constructed as an symmetric power of a module.
If it has, return `true`, the base module, and the power.
If not, return `false` as the first return value, and arbitrary values for the other two.
"""
function is_symmetric_power(V::LieAlgebraModule)
function is_symmetric_power_with_data(V::LieAlgebraModule)
if has_attribute(V, :is_symmetric_power)
W, k = get_attribute(V, :is_symmetric_power)::Tuple{typeof(V),Int}
return (true, W, k)
Expand All @@ -606,13 +606,13 @@ function is_symmetric_power(V::LieAlgebraModule)
end

@doc raw"""
is_tensor_power(V::LieAlgebraModule{C}) -> Bool, LieAlgebraModule{C}, Int
is_tensor_power_with_data(V::LieAlgebraModule{C}) -> Bool, LieAlgebraModule{C}, Int
Check whether `V` has been constructed as a tensor power of a module.
If it has, return `true`, the base module, and the power.
If not, return `false` as the first return value, and arbitrary values for the other two.
"""
function is_tensor_power(V::LieAlgebraModule)
function is_tensor_power_with_data(V::LieAlgebraModule)
if has_attribute(V, :is_tensor_power)
W, k = get_attribute(V, :is_tensor_power)::Tuple{typeof(V),Int}
return (true, W, k)
Expand Down
22 changes: 11 additions & 11 deletions experimental/LieAlgebras/src/LieAlgebraModuleHom.jl
Original file line number Diff line number Diff line change
Expand Up @@ -481,14 +481,14 @@ function hom_tensor(
) where {C<:FieldElem} # TODO: cleanup after refactoring tensor_product
if ((fl, Vs) = is_tensor_product(V); fl)
# nothing to do
elseif ((fl, Vb, k) = is_tensor_power(V); fl)
elseif ((fl, Vb, k) = is_tensor_power_with_data(V); fl)
Vs = [Vb for _ in 1:k]
else
throw(ArgumentError("First module must be a tensor product or power"))
end
if ((fl, Ws) = is_tensor_product(W); fl)
# nothing to do
elseif ((fl, Wb, k) = is_tensor_power(W); fl)
elseif ((fl, Wb, k) = is_tensor_power_with_data(W); fl)
Ws = [Wb for _ in 1:k]
else
throw(ArgumentError("Second module must be a tensor product or power"))
Expand All @@ -515,11 +515,11 @@ $S^k h: V \to W$ (analogous for other types of powers).
function hom(
V::LieAlgebraModule{C}, W::LieAlgebraModule{C}, h::LieAlgebraModuleHom
) where {C<:FieldElem}
if is_exterior_power(V)[1]
if is_exterior_power_with_data(V)[1]
return induced_map_on_exterior_power(h; domain=V, codomain=W)
elseif is_symmetric_power(V)[1]
elseif is_symmetric_power_with_data(V)[1]
return induced_map_on_symmetric_power(h; domain=V, codomain=W)
elseif is_tensor_power(V)[1]
elseif is_tensor_power_with_data(V)[1]
return induced_map_on_tensor_power(h; domain=V, codomain=W)
else
throw(ArgumentError("First module must be a power module"))
Expand Down Expand Up @@ -553,8 +553,8 @@ function induced_map_on_exterior_power(
domain::LieAlgebraModule{C}=exterior_power(Oscar.domain(phi), p)[1],
codomain::LieAlgebraModule{C}=exterior_power(Oscar.codomain(phi), p)[1],
) where {C<:FieldElem}
(domain_fl, domain_base, domain_k) = is_exterior_power(domain)
(codomain_fl, codomain_base, codomain_k) = is_exterior_power(codomain)
(domain_fl, domain_base, domain_k) = is_exterior_power_with_data(domain)
(codomain_fl, codomain_base, codomain_k) = is_exterior_power_with_data(codomain)
@req domain_fl "Domain must be an exterior power"
@req codomain_fl "Codomain must be an exterior power"
@req domain_k == codomain_k "Exponent mismatch"
Expand All @@ -569,8 +569,8 @@ function induced_map_on_symmetric_power(
domain::LieAlgebraModule{C}=symmetric_power(Oscar.domain(phi), p)[1],
codomain::LieAlgebraModule{C}=symmetric_power(Oscar.codomain(phi), p)[1],
) where {C<:FieldElem}
(domain_fl, domain_base, domain_k) = is_symmetric_power(domain)
(codomain_fl, codomain_base, codomain_k) = is_symmetric_power(codomain)
(domain_fl, domain_base, domain_k) = is_symmetric_power_with_data(domain)
(codomain_fl, codomain_base, codomain_k) = is_symmetric_power_with_data(codomain)
@req domain_fl "Domain must be an symmetric power"
@req codomain_fl "Codomain must be an symmetric power"
@req domain_k == codomain_k "Exponent mismatch"
Expand All @@ -585,8 +585,8 @@ function induced_map_on_tensor_power(
domain::LieAlgebraModule{C}=tensor_power(Oscar.domain(phi), p)[1],
codomain::LieAlgebraModule{C}=tensor_power(Oscar.codomain(phi), p)[1],
) where {C<:FieldElem}
(domain_fl, domain_base, domain_k) = is_tensor_power(domain)
(codomain_fl, codomain_base, codomain_k) = is_tensor_power(codomain)
(domain_fl, domain_base, domain_k) = is_tensor_power_with_data(domain)
(codomain_fl, codomain_base, codomain_k) = is_tensor_power_with_data(codomain)
@req domain_fl "Domain must be an tensor power"
@req codomain_fl "Codomain must be an tensor power"
@req domain_k == codomain_k "Exponent mismatch"
Expand Down
10 changes: 5 additions & 5 deletions experimental/LieAlgebras/src/LieAlgebras.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import ..Oscar:
induced_map_on_exterior_power,
inv,
is_abelian,
is_exterior_power,
is_exterior_power_with_data,
is_finite,
is_isomorphism,
is_nilpotent,
Expand Down Expand Up @@ -143,8 +143,8 @@ export is_self_normalizing
export is_simple_coroot_with_index
export is_simple_root_with_index
export is_standard_module
export is_symmetric_power
export is_tensor_power
export is_symmetric_power_with_data
export is_tensor_power_with_data
export is_tensor_product
export lie_algebra
export lmul, lmul!
Expand Down Expand Up @@ -268,8 +268,8 @@ export is_self_normalizing
export is_simple_coroot_with_index
export is_simple_root_with_index
export is_standard_module
export is_symmetric_power
export is_tensor_power
export is_symmetric_power_with_data
export is_tensor_power_with_data
export is_tensor_product
export lie_algebra
export lmul, lmul!
Expand Down
12 changes: 6 additions & 6 deletions experimental/LieAlgebras/test/LieAlgebraModule-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@
is_dual(V)[1],
is_direct_sum(V)[1],
is_tensor_product(V)[1],
is_exterior_power(V)[1],
is_symmetric_power(V)[1],
is_tensor_power(V)[1],
is_exterior_power_with_data(V)[1],
is_symmetric_power_with_data(V)[1],
is_tensor_power_with_data(V)[1],
)

@testset "module constructions" begin
Expand Down Expand Up @@ -328,7 +328,7 @@
@test E === exterior_power(V, k)[1]
@test E !== exterior_power(V, k; cached=false)[1]
@test type_V == module_type_bools(V) # construction of E should not change type of V
@test is_exterior_power(E) === (true, V, k)
@test is_exterior_power_with_data(E) === (true, V, k)
@test dim(E) == binomial(dim(V), k)
@test length(repr(E)) < 10^4 # outputs tend to be excessively long due to recursion

Expand Down Expand Up @@ -386,7 +386,7 @@
@test S === symmetric_power(V, k)[1]
@test S !== symmetric_power(V, k; cached=false)[1]
@test type_V == module_type_bools(V) # construction of S should not change type of V
@test is_symmetric_power(S) === (true, V, k)
@test is_symmetric_power_with_data(S) === (true, V, k)
@test dim(S) == binomial(dim(V) + k - 1, k)
@test length(repr(S)) < 10^4 # outputs tend to be excessively long due to recursion

Expand Down Expand Up @@ -441,7 +441,7 @@
@test T === tensor_power(V, k)[1]
@test T !== tensor_power(V, k; cached=false)[1]
@test type_V == module_type_bools(V) # construction of T should not change type of V
@test is_tensor_power(T) === (true, V, k)
@test is_tensor_power_with_data(T) === (true, V, k)
@test dim(T) == dim(V)^k
@test length(repr(T)) < 10^4 # outputs tend to be excessively long due to recursion

Expand Down
4 changes: 2 additions & 2 deletions src/Modules/ExteriorPowers/FreeModules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ function koszul_homology(v::FreeModElem, M::ModuleFP, i::Int; cached::Bool=true)
end

function koszul_dual(F::FreeMod; cached::Bool=true)
success, M, p = is_exterior_power(F)
success, M, p = is_exterior_power_with_data(F)
!success && error("module must be an exterior power of some other module")
return exterior_power(M, rank(M) - p, cached=cached)[1]
end
Expand All @@ -170,7 +170,7 @@ function koszul_duals(v::Vector{T}; cached::Bool=true) where {T<:FreeModElem}
all(u->parent(u) === parent(first(v)), v[2:end]) || error("parent mismatch")

F = parent(first(v))
success, M, p = is_exterior_power(F)
success, M, p = is_exterior_power_with_data(F)
n = rank(M)
success || error("element must be an exterior product")
k = [findfirst(x->x==u, gens(F)) for u in v]
Expand Down
26 changes: 13 additions & 13 deletions src/Modules/ExteriorPowers/Generic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ end
# User facing method to ask whether F = ⋀ ᵖ M for some M.
# This returns a triple `(true, M, p)` in the affirmative case
# and `(false, F, 0)` otherwise.
function is_exterior_power(M::ModuleFP)
function is_exterior_power_with_data(M::ModuleFP)
if has_attribute(M, :is_exterior_power)
MM, p = get_attribute(M, :is_exterior_power)::Tuple{typeof(M), Int}
return (true, MM, p)
Expand All @@ -16,7 +16,7 @@ end

# Printing of exterior powers
function show_exterior_product(io::IO, M::ModuleFP)
success, F, p = is_exterior_power(M)
success, F, p = is_exterior_power_with_data(M)
success || error("module is not an exterior power")
if is_unicode_allowed()
print(io, "⋀^$p($F)")
Expand All @@ -26,7 +26,7 @@ function show_exterior_product(io::IO, M::ModuleFP)
end

function show_exterior_product(io::IO, ::MIME"text/html", M::ModuleFP)
success, F, p = is_exterior_power(M)
success, F, p = is_exterior_power_with_data(M)
success || error("module is not an exterior power")
io = IOContext(io, :compact => true)
if is_unicode_allowed()
Expand Down Expand Up @@ -60,15 +60,15 @@ end
# We also allow v ∈ M considered as ⋀ ¹M and the same holds in
# the cases p = 1 and r = 1.
function wedge_multiplication_map(F::ModuleFP, G::ModuleFP, v::ModuleFPElem)
success, orig_mod, p = is_exterior_power(F)
success, orig_mod, p = is_exterior_power_with_data(F)
if !success
Fwedge1, _ = exterior_power(F, 1)
id = hom(F, Fwedge1, gens(Fwedge1))
tmp = wedge_multiplication_map(Fwedge1, G, v)
return compose(id, tmp)
end

success, orig_mod_2, q = is_exterior_power(G)
success, orig_mod_2, q = is_exterior_power_with_data(G)
if !success
Gwedge1, _ = exterior_power(G, 1)
id = hom(Gwedge1, G, gens(G))
Expand All @@ -86,7 +86,7 @@ function wedge_multiplication_map(F::ModuleFP, G::ModuleFP, v::ModuleFPElem)
return wedge_multiplication_map(F, G, w)
end

success, orig_mod_2, r = is_exterior_power(H)
success, orig_mod_2, r = is_exterior_power_with_data(H)
success || error("element is not an exterior product")
orig_mod_2 === orig_mod || error("element is not an exterior product for the correct module")
p + r == q || error("powers are incompatible")
Expand All @@ -99,24 +99,24 @@ end
# The wedge product of two or more elements.
function wedge(u::ModuleFPElem, v::ModuleFPElem;
parent::ModuleFP=begin
success, F, p = is_exterior_power(Oscar.parent(u))
success, F, p = is_exterior_power_with_data(Oscar.parent(u))
if !success
F = Oscar.parent(u)
p = 1
end
success, _, q = is_exterior_power(Oscar.parent(v))
success, _, q = is_exterior_power_with_data(Oscar.parent(v))
!success && (q = 1)
exterior_power(F, p + q)[1]
end
)
success1, F1, p = is_exterior_power(Oscar.parent(u))
success1, F1, p = is_exterior_power_with_data(Oscar.parent(u))
if !success1
F = Oscar.parent(u)
Fwedge1, _ = exterior_power(F1, 1)
return wedge(Fwedge1(coordinates(u)), v, parent=parent)
end

success2, F2, q = is_exterior_power(Oscar.parent(v))
success2, F2, q = is_exterior_power_with_data(Oscar.parent(v))
if !success2
F = Oscar.parent(v)
Fwedge1, _ = exterior_power(F1, 1)
Expand Down Expand Up @@ -145,7 +145,7 @@ function wedge(u::Vector{T};
isempty(u) && error("list must not be empty")
F = Oscar.parent(first(u)) # initialize variable
for v in u
success, F, p = is_exterior_power(Oscar.parent(v))
success, F, p = is_exterior_power_with_data(Oscar.parent(v))
if !success
F = Oscar.parent(v)
p = 1
Expand Down Expand Up @@ -182,9 +182,9 @@ end

# The induced map on exterior powers
function hom(M::FreeMod, N::FreeMod, phi::FreeModuleHom)
success, F, p = is_exterior_power(M)
success, F, p = is_exterior_power_with_data(M)
@req success "module is not an exterior power"
success, FF, q = is_exterior_power(N)
success, FF, q = is_exterior_power_with_data(N)
@req success "module is not an exterior power"
@req F === domain(phi) "map not compatible"
@req FF === codomain(phi) "map not compatible"
Expand Down
Loading

0 comments on commit b19369b

Please sign in to comment.