diff --git a/experimental/LieAlgebras/docs/src/modules.md b/experimental/LieAlgebras/docs/src/modules.md index a646d517f5d2..1c0dc6ecf63b 100644 --- a/experimental/LieAlgebras/docs/src/modules.md +++ b/experimental/LieAlgebras/docs/src/modules.md @@ -63,15 +63,3 @@ tensor_power(::LieAlgebraModule{C}, ::Int) where {C<:FieldElem} abstract_module(::LieAlgebra{C}, ::Int, ::Vector{<:MatElem{C}}, ::Vector{<:VarName}; ::Bool) where {C<:FieldElem} abstract_module(::LieAlgebra{C}, ::Int, ::Matrix{SRow{C}}, ::Vector{<:VarName}; ::Bool) where {C<:FieldElem} ``` - -# Type-dependent getters - -```@docs -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) -``` diff --git a/experimental/LieAlgebras/src/LieAlgebraModule.jl b/experimental/LieAlgebras/src/LieAlgebraModule.jl index 6c4c680048fc..9d03f57ad385 100644 --- a/experimental/LieAlgebras/src/LieAlgebraModule.jl +++ b/experimental/LieAlgebras/src/LieAlgebraModule.jl @@ -155,12 +155,12 @@ function Base.show(io::IO, ::MIME"text/plain", V::LieAlgebraModule) io = pretty(io) println(io, _module_type_to_string(V)) println(io, Indent(), "of dimension $(dim(V))") - 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] + 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] _show_inner(io, V) end print(io, Dedent()) @@ -169,38 +169,38 @@ function Base.show(io::IO, ::MIME"text/plain", V::LieAlgebraModule) end function _show_inner(io::IO, V::LieAlgebraModule) - if is_standard_module(V) + if _is_standard_module(V) println(io, "standard module") - elseif ((fl, W) = is_dual(V); fl) + elseif ((fl, W) = _is_dual(V); fl) println(io, "dual of ", Lowercase()) print(io, Indent()) _show_inner(io, W) print(io, Dedent()) - elseif ((fl, Ws) = is_direct_sum(V); fl) + elseif ((fl, Ws) = _is_direct_sum(V); fl) println(io, "direct sum with direct summands") print(io, Indent()) for W in Ws _show_inner(io, W) end print(io, Dedent()) - elseif ((fl, Ws) = is_tensor_product(V); fl) + elseif ((fl, Ws) = _is_tensor_product(V); fl) println(io, "tensor product with tensor factors") print(io, Indent()) for W in Ws _show_inner(io, W) end print(io, Dedent()) - elseif ((fl, W, k) = is_exterior_power(V); fl) + elseif ((fl, W, k) = _is_exterior_power(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(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(V); fl) println(io, "$(ordinal_number_string(k)) tensor power of") print(io, Indent()) _show_inner(io, W) @@ -221,19 +221,19 @@ function Base.show(io::IO, V::LieAlgebraModule) end function _module_type_to_string(V::LieAlgebraModule) - if is_standard_module(V) + if _is_standard_module(V) return "Standard module" - elseif is_dual(V)[1] + elseif _is_dual(V)[1] return "Dual module" - elseif is_direct_sum(V)[1] + elseif _is_direct_sum(V)[1] return "Direct sum module" - elseif is_tensor_product(V)[1] + elseif _is_tensor_product(V)[1] return "Tensor product module" - elseif is_exterior_power(V)[1] + elseif _is_exterior_power(V)[1] return "Exterior power module" - elseif is_symmetric_power(V)[1] + elseif _is_symmetric_power(V)[1] return "Symmetric power module" - elseif is_tensor_power(V)[1] + elseif _is_tensor_power(V)[1] return "Tensor power module" else return "Abstract Lie algebra module" @@ -354,24 +354,24 @@ function (V::LieAlgebraModule{C})( ) where {C<:FieldElem} if length(a) == 1 && V === parent(a[1]) return a[1] - elseif ((fl, W) = is_dual(V); fl) + elseif ((fl, W) = _is_dual(V); fl) @req length(a) == 1 "Invalid input length." @req W === parent(v) "Incompatible modules." return V(coefficients(v)) - elseif ((fl, Vs) = is_direct_sum(V); fl) + elseif ((fl, Vs) = _is_direct_sum(V); fl) @req length(a) == length(Vs) "Invalid input length." @req all(i -> parent(a[i]) === Vs[i], 1:length(a)) "Incompatible modules." return sum(inji(ai) for (ai, inji) in zip(a, canonical_injections(V)); init=zero(V)) - elseif is_tensor_product(V)[1] + 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(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(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(V)[1] pure = get_attribute(V, :tensor_pure_function) return pure(a)::elem_type(V) else @@ -384,15 +384,15 @@ function (V::LieAlgebraModule{C})(a::LieAlgebraModuleElem{C}...) where {C<:Field end function _is_allowed_input_length(V::LieAlgebraModule, a::Int) - if ((fl, Vs) = is_direct_sum(V); fl) + if ((fl, Vs) = _is_direct_sum(V); fl) return a == length(Vs) - elseif ((fl, Vs) = is_tensor_product(V); fl) + 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(V); fl) return a == k - elseif ((fl, W, k) = is_symmetric_power(V); fl) + elseif ((fl, W, k) = _is_symmetric_power(V); fl) return a == k - elseif ((fl, W, k) = is_tensor_power(V); fl) + elseif ((fl, W, k) = _is_tensor_power(V); fl) return a == k else throw(ArgumentError("Invalid input.")) @@ -518,11 +518,11 @@ end ############################################################################### @doc raw""" - is_standard_module(V::LieAlgebraModule{C}) -> Bool + _is_standard_module(V::LieAlgebraModule{C}) -> Bool Check whether `V` has been constructed as a standard module. """ -function is_standard_module(V::LieAlgebraModule) +function _is_standard_module(V::LieAlgebraModule) if has_attribute(V, :is_standard_module) @assert get_attribute(V, :is_standard_module)::Bool === true return true @@ -531,13 +531,13 @@ function is_standard_module(V::LieAlgebraModule) end @doc raw""" - is_dual(V::LieAlgebraModule{C}) -> Bool, LieAlgebraModule{C} + _is_dual(V::LieAlgebraModule{C}) -> Bool, LieAlgebraModule{C} Check whether `V` has been constructed as a dual module. If it has, return `true` and the base module. If not, return `false` as the first return value, and an arbitrary value for the second. """ -function is_dual(V::LieAlgebraModule) +function _is_dual(V::LieAlgebraModule) if has_attribute(V, :is_dual) W = get_attribute(V, :is_dual)::typeof(V) return (true, W) @@ -546,13 +546,13 @@ function is_dual(V::LieAlgebraModule) end @doc raw""" - is_direct_sum(V::LieAlgebraModule{C}) -> Bool, Vector{LieAlgebraModule{C}} + _is_direct_sum(V::LieAlgebraModule{C}) -> Bool, Vector{LieAlgebraModule{C}} Check whether `V` has been constructed as a direct sum of modules. If it has, return `true` and the summands. If not, return `false` as the first return value, and an empty vector for the second. """ -function is_direct_sum(V::LieAlgebraModule) +function _is_direct_sum(V::LieAlgebraModule) if has_attribute(V, :is_direct_sum) summands = get_attribute(V, :is_direct_sum)::Vector{typeof(V)} return (true, summands) @@ -561,13 +561,13 @@ function is_direct_sum(V::LieAlgebraModule) end @doc raw""" - is_tensor_product(V::LieAlgebraModule{C}) -> Bool, Vector{LieAlgebraModule{C}} + _is_tensor_product(V::LieAlgebraModule{C}) -> Bool, Vector{LieAlgebraModule{C}} Check whether `V` has been constructed as a tensor product of modules. If it has, return `true` and the tensor factors. If not, return `false` as the first return value, and an empty vector for the second. """ -function is_tensor_product(V::LieAlgebraModule) +function _is_tensor_product(V::LieAlgebraModule) if has_attribute(V, :is_tensor_product) factors = get_attribute(V, :is_tensor_product)::Vector{typeof(V)} return (true, factors) @@ -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(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(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) @@ -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(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(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) @@ -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(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(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) @@ -797,7 +797,7 @@ function dual(V::LieAlgebraModule{C}; cached::Bool=true) where {C<:FieldElem} -transpose(transformation_matrix(V, i)) end - s = if is_standard_module(V) + s = if _is_standard_module(V) [Symbol("$(s)*") for s in symbols(V)] else [Symbol("($(s))*") for s in symbols(V)] @@ -855,7 +855,7 @@ function direct_sum(V::LieAlgebraModule{C}, Vs::LieAlgebraModule{C}...) where {C else [ Symbol("$s^($j)") for (j, Vj) in enumerate(Vs) for - s in (is_standard_module(Vj) ? symbols(Vj) : (x -> "($x)").(symbols(Vj))) + s in (_is_standard_module(Vj) ? symbols(Vj) : (x -> "($x)").(symbols(Vj))) ] end @@ -926,7 +926,7 @@ function tensor_product( Symbol(join(s, (is_unicode_allowed() ? "⊗" : "(x)"))) for s in reverse.( ProductIterator([ - is_standard_module(Vi) ? symbols(Vi) : (x -> "($x)").(symbols(Vi)) for + _is_standard_module(Vi) ? symbols(Vi) : (x -> "($x)").(symbols(Vi)) for Vi in reverse(Vs) ]) ) @@ -1049,7 +1049,7 @@ function exterior_power( [Symbol("1")] elseif k == 1 symbols(V) - elseif is_standard_module(V) + elseif _is_standard_module(V) [Symbol(join(s, (is_unicode_allowed() ? "∧" : "^"))) for s in combinations(symbols(V), k)] else [ @@ -1185,7 +1185,7 @@ function symmetric_power( [Symbol("1")] elseif k == 1 symbols(V) - elseif is_standard_module(V) + elseif _is_standard_module(V) [ Symbol( join( @@ -1336,7 +1336,7 @@ function tensor_power( [Symbol("1")] elseif k == 1 symbols(V) - elseif is_standard_module(V) + elseif _is_standard_module(V) [ Symbol(join(s, (is_unicode_allowed() ? "⊗" : "(x)"))) for s in reverse.(ProductIterator(symbols(V), k)) diff --git a/experimental/LieAlgebras/src/LieAlgebraModuleHom.jl b/experimental/LieAlgebras/src/LieAlgebraModuleHom.jl index 4854e418e600..f544f7a07fd2 100644 --- a/experimental/LieAlgebras/src/LieAlgebraModuleHom.jl +++ b/experimental/LieAlgebras/src/LieAlgebraModuleHom.jl @@ -360,7 +360,7 @@ Return the canonical injections from all components into $V$ where $V$ has been constructed as $V_1 \oplus \cdot \oplus V_n$. """ function canonical_injections(V::LieAlgebraModule) - fl, Vs = is_direct_sum(V) + fl, Vs = Oscar._is_direct_sum(V) @req fl "Module must be a direct sum" return [canonical_injection(V, i) for i in 1:length(Vs)] end @@ -372,7 +372,7 @@ Return the canonical injection $V_i \to V$ where $V$ has been constructed as $V_1 \oplus \cdot \oplus V_n$. """ function canonical_injection(V::LieAlgebraModule, i::Int) - fl, Vs = is_direct_sum(V) + fl, Vs = Oscar._is_direct_sum(V) @req fl "Module must be a direct sum" @req 1 <= i <= length(Vs) "Index out of bound" j = sum(dim(Vs[l]) for l in 1:(i - 1); init=0) @@ -387,7 +387,7 @@ Return the canonical projections from $V$ to all components where $V$ has been constructed as $V_1 \oplus \cdot \oplus V_n$. """ function canonical_projections(V::LieAlgebraModule) - fl, Vs = is_direct_sum(V) + fl, Vs = Oscar._is_direct_sum(V) @req fl "Module must be a direct sum" return [canonical_projection(V, i) for i in 1:length(Vs)] end @@ -399,7 +399,7 @@ Return the canonical projection $V \to V_i$ where $V$ has been constructed as $V_1 \oplus \cdot \oplus V_n$. """ function canonical_projection(V::LieAlgebraModule, i::Int) - fl, Vs = is_direct_sum(V) + fl, Vs = Oscar._is_direct_sum(V) @req fl "Module must be a direct sum" @req 1 <= i <= length(Vs) "Index out of bound" j = sum(dim(Vs[l]) for l in 1:(i - 1); init=0) @@ -430,9 +430,9 @@ If `hs` is a vector, then it is interpreted as a diagonal matrix. function hom_direct_sum( V::LieAlgebraModule{C}, W::LieAlgebraModule{C}, hs::Matrix{<:LieAlgebraModuleHom} ) where {C<:FieldElem} - fl, Vs = is_direct_sum(V) + fl, Vs = Oscar._is_direct_sum(V) @req fl "First module must be a direct sum" - fl, Ws = is_direct_sum(W) + fl, Ws = Oscar._is_direct_sum(W) @req fl "Second module must be a direct sum" @req length(Vs) == size(hs, 1) "Length mismatch" @req length(Ws) == size(hs, 2) "Length mismatch" @@ -456,9 +456,9 @@ end function hom_direct_sum( V::LieAlgebraModule{C}, W::LieAlgebraModule{C}, hs::Vector{<:LieAlgebraModuleHom} ) where {C<:FieldElem} - fl, Vs = is_direct_sum(V) + fl, Vs = Oscar._is_direct_sum(V) @req fl "First module must be a direct sum" - fl, Ws = is_direct_sum(W) + fl, Ws = Oscar._is_direct_sum(W) @req fl "Second module must be a direct sum" @req length(Vs) == length(Ws) == length(hs) "Length mismatch" @req all(i -> domain(hs[i]) === Vs[i] && codomain(hs[i]) === Ws[i], 1:length(hs)) "Domain/codomain mismatch" @@ -479,16 +479,16 @@ This works for $r$th tensor powers as well. function hom_tensor( V::LieAlgebraModule{C}, W::LieAlgebraModule{C}, hs::Vector{<:LieAlgebraModuleHom} ) where {C<:FieldElem} # TODO: cleanup after refactoring tensor_product - if ((fl, Vs) = is_tensor_product(V); fl) + 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(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) + 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(W); fl) Ws = [Wb for _ in 1:k] else throw(ArgumentError("Second module must be a tensor product or power")) @@ -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(V)[1] return induced_map_on_exterior_power(h; domain=V, codomain=W) - elseif is_symmetric_power(V)[1] + elseif _is_symmetric_power(V)[1] return induced_map_on_symmetric_power(h; domain=V, codomain=W) - elseif is_tensor_power(V)[1] + elseif _is_tensor_power(V)[1] return induced_map_on_tensor_power(h; domain=V, codomain=W) else throw(ArgumentError("First module must be a power module")) @@ -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(domain) + (codomain_fl, codomain_base, codomain_k) = _is_exterior_power(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" @@ -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(domain) + (codomain_fl, codomain_base, codomain_k) = _is_symmetric_power(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" @@ -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(domain) + (codomain_fl, codomain_base, codomain_k) = _is_tensor_power(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" diff --git a/experimental/LieAlgebras/src/LieAlgebras.jl b/experimental/LieAlgebras/src/LieAlgebras.jl index ab537ded7a28..cd183c16fbc8 100644 --- a/experimental/LieAlgebras/src/LieAlgebras.jl +++ b/experimental/LieAlgebras/src/LieAlgebras.jl @@ -15,6 +15,8 @@ using AbstractAlgebra.PrettyPrinting # functions with new methods import ..Oscar: + _is_exterior_power, + _is_tensor_product, _iso_oscar_gap, action, basis_matrix, @@ -50,14 +52,12 @@ import ..Oscar: induced_map_on_exterior_power, inv, is_abelian, - is_exterior_power, is_finite, is_isomorphism, is_nilpotent, is_perfect, is_simple, is_solvable, - is_tensor_product, is_welldefined, kernel, lower_central_series, @@ -99,6 +99,13 @@ export WeightLatticeElem export WeylGroup, WeylGroupElem export WeylOrbitIterator +export _is_direct_sum +export _is_dual +export _is_exterior_power +export _is_standard_module +export _is_symmetric_power +export _is_tensor_power +export _is_tensor_product export abelian_lie_algebra export abstract_module export base_lie_algebra @@ -131,9 +138,7 @@ export induced_map_on_tensor_power export is_cartan_matrix export is_cartan_type export is_coroot_with_index -export is_direct_sum export is_dominant -export is_dual export is_negative_coroot_with_index export is_negative_root_with_index export is_positive_coroot_with_index @@ -142,10 +147,6 @@ export is_root_with_index 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_tensor_product export lie_algebra export lmul, lmul! export longest_element @@ -257,9 +258,7 @@ export induced_map_on_tensor_power export is_cartan_matrix export is_cartan_type export is_coroot_with_index -export is_direct_sum export is_dominant -export is_dual export is_negative_coroot_with_index export is_negative_root_with_index export is_positive_coroot_with_index @@ -268,10 +267,6 @@ export is_root_with_index 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_tensor_product export lie_algebra export lmul, lmul! export longest_element diff --git a/experimental/LieAlgebras/test/LieAlgebraModule-test.jl b/experimental/LieAlgebras/test/LieAlgebraModule-test.jl index bf696e2ab194..77701add151d 100644 --- a/experimental/LieAlgebras/test/LieAlgebraModule-test.jl +++ b/experimental/LieAlgebras/test/LieAlgebraModule-test.jl @@ -181,13 +181,13 @@ end module_type_bools(V) = ( - is_standard_module(V), - 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], + Oscar._is_standard_module(V), + Oscar._is_dual(V)[1], + Oscar._is_direct_sum(V)[1], + Oscar._is_tensor_product(V)[1], + Oscar._is_exterior_power(V)[1], + Oscar._is_symmetric_power(V)[1], + Oscar._is_tensor_power(V)[1], ) @testset "module constructions" begin @@ -215,7 +215,7 @@ @test dual_V === dual(V) @test dual_V !== dual(V; cached=false) @test type_V == module_type_bools(V) # construction of dual_V should not change type of V - @test is_dual(dual_V) === (true, V) + @test Oscar._is_dual(dual_V) === (true, V) @test dim(dual_V) == dim(V) @test length(repr(dual_V)) < 10^4 # outputs tend to be excessively long due to recursion @@ -241,8 +241,8 @@ @test_broken ds_V === direct_sum([V for _ in 1:k]...) @test_broken ds_V !== direct_sum([V for _ in 1:k]...; cached=false) @test type_V == module_type_bools(V) # construction of ds_V should not change type of V - @test is_direct_sum(ds_V) == (true, [V for _ in 1:k]) - @test all(x -> x[1] === x[2], zip(is_direct_sum(ds_V)[2], [V for _ in 1:k])) + @test Oscar._is_direct_sum(ds_V) == (true, [V for _ in 1:k]) + @test all(x -> x[1] === x[2], zip(Oscar._is_direct_sum(ds_V)[2], [V for _ in 1:k])) @test dim(ds_V) == k * dim(V) @test length(repr(ds_V)) < 10^4 # outputs tend to be excessively long due to recursion @@ -262,7 +262,7 @@ ds_V = direct_sum(V1, V2) @test type_V1 == module_type_bools(V1) # construction of ds_V should not change type of V1 @test type_V2 == module_type_bools(V2) # construction of ds_V should not change type of V2 - @test is_direct_sum(ds_V) == (true, [V1, V2]) + @test Oscar._is_direct_sum(ds_V) == (true, [V1, V2]) @test dim(ds_V) == dim(V1) + dim(V2) @test length(repr(ds_V)) < 10^4 # outputs tend to be excessively long due to recursion @@ -282,8 +282,8 @@ @test_broken tp_V === tensor_product([V for _ in 1:k]...) @test_broken tp_V !== tensor_product([V for _ in 1:k]...; cached=false) @test type_V == module_type_bools(V) # construction of tp_V should not change type of V - @test is_tensor_product(tp_V) == (true, [V for _ in 1:k]) - @test all(x -> x[1] === x[2], zip(is_tensor_product(tp_V)[2], [V for _ in 1:k])) + @test Oscar._is_tensor_product(tp_V) == (true, [V for _ in 1:k]) + @test all(x -> x[1] === x[2], zip(Oscar._is_tensor_product(tp_V)[2], [V for _ in 1:k])) @test dim(tp_V) == dim(V)^k @test length(repr(tp_V)) < 10^4 # outputs tend to be excessively long due to recursion @@ -305,7 +305,7 @@ tp_V = tensor_product(V1, V2) @test type_V1 == module_type_bools(V1) # construction of tp_V should not change type of V1 @test type_V2 == module_type_bools(V2) # construction of tp_V should not change type of V2 - @test is_tensor_product(tp_V) == (true, [V1, V2]) + @test Oscar._is_tensor_product(tp_V) == (true, [V1, V2]) @test dim(tp_V) == dim(V1) * dim(V2) @test length(repr(tp_V)) < 10^4 # outputs tend to be excessively long due to recursion @@ -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 Oscar._is_exterior_power(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 @@ -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 Oscar._is_symmetric_power(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 @@ -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 Oscar._is_tensor_power(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 diff --git a/src/Modules/ExteriorPowers/FreeModules.jl b/src/Modules/ExteriorPowers/FreeModules.jl index dc7bf8241eeb..ff653591bc79 100644 --- a/src/Modules/ExteriorPowers/FreeModules.jl +++ b/src/Modules/ExteriorPowers/FreeModules.jl @@ -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(F) !success && error("module must be an exterior power of some other module") return exterior_power(M, rank(M) - p, cached=cached)[1] end @@ -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(F) n = rank(M) success || error("element must be an exterior product") k = [findfirst(x->x==u, gens(F)) for u in v] diff --git a/src/Modules/ExteriorPowers/Generic.jl b/src/Modules/ExteriorPowers/Generic.jl index a1adcc46aa6b..b9f48389d557 100644 --- a/src/Modules/ExteriorPowers/Generic.jl +++ b/src/Modules/ExteriorPowers/Generic.jl @@ -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(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) @@ -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(M) success || error("module is not an exterior power") if is_unicode_allowed() print(io, "⋀^$p($F)") @@ -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(M) success || error("module is not an exterior power") io = IOContext(io, :compact => true) if is_unicode_allowed() @@ -60,7 +60,7 @@ 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(F) if !success Fwedge1, _ = exterior_power(F, 1) id = hom(F, Fwedge1, gens(Fwedge1)) @@ -68,7 +68,7 @@ function wedge_multiplication_map(F::ModuleFP, G::ModuleFP, v::ModuleFPElem) return compose(id, tmp) end - success, orig_mod_2, q = is_exterior_power(G) + success, orig_mod_2, q = _is_exterior_power(G) if !success Gwedge1, _ = exterior_power(G, 1) id = hom(Gwedge1, G, gens(G)) @@ -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(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") @@ -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(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(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(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(Oscar.parent(v)) if !success2 F = Oscar.parent(v) Fwedge1, _ = exterior_power(F1, 1) @@ -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(Oscar.parent(v)) if !success F = Oscar.parent(v) p = 1 @@ -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(M) @req success "module is not an exterior power" - success, FF, q = is_exterior_power(N) + success, FF, q = _is_exterior_power(N) @req success "module is not an exterior power" @req F === domain(phi) "map not compatible" @req FF === codomain(phi) "map not compatible" diff --git a/src/Modules/UngradedModules/Methods.jl b/src/Modules/UngradedModules/Methods.jl index 48bbdd6ee98a..d0250dc6e6eb 100644 --- a/src/Modules/UngradedModules/Methods.jl +++ b/src/Modules/UngradedModules/Methods.jl @@ -791,19 +791,19 @@ function Base.:*(k::Int, f::ModuleFPHom) return base_ring(codomain(f))(k)*f end -function is_tensor_product(M::ModuleFP) +function _is_tensor_product(M::ModuleFP) !has_attribute(M, :tensor_product) && return false, [M] return true, get_attribute(M, :tensor_product)::Tuple end function tensor_pure_function(M::ModuleFP) - success, facs = is_tensor_product(M) + success, facs = _is_tensor_product(M) success || error("not a tensor product") return get_attribute(M, :tensor_pure_function) end function tensor_generator_decompose_function(M::ModuleFP) - success, facs = is_tensor_product(M) + success, facs = _is_tensor_product(M) success || error("not a tensor product") return get_attribute(M, :tensor_generator_decompose_function) end diff --git a/src/Modules/deRhamComplexes.jl b/src/Modules/deRhamComplexes.jl index b344c99c7533..146bb4609f9f 100644 --- a/src/Modules/deRhamComplexes.jl +++ b/src/Modules/deRhamComplexes.jl @@ -150,7 +150,7 @@ end # printing of kaehler differentials function show_kaehler_differentials(io::IO, M::ModuleFP) - success, F, p = is_exterior_power(M) + success, F, p = _is_exterior_power(M) R = base_ring(F) if success if is_unicode_allowed() @@ -168,7 +168,7 @@ function show_kaehler_differentials(io::IO, M::ModuleFP) end function show_kaehler_differentials(io::IO, ::MIME"text/html", M::ModuleFP) - success, F, p = is_exterior_power(M) + success, F, p = _is_exterior_power(M) R = base_ring(F) io = IOContext(io, :compact => true) if success diff --git a/src/exports.jl b/src/exports.jl index 6c764fdbddb7..74c4da894801 100644 --- a/src/exports.jl +++ b/src/exports.jl @@ -763,7 +763,6 @@ export is_embedded export is_empty export is_equal_with_morphism export is_equidimensional -export is_exterior_power export is_faithful export is_fano export is_feasible diff --git a/test/Modules/ExteriorPowers.jl b/test/Modules/ExteriorPowers.jl index c3749f8b0392..fb7320952215 100644 --- a/test/Modules/ExteriorPowers.jl +++ b/test/Modules/ExteriorPowers.jl @@ -8,7 +8,7 @@ Fwedge1, _ = Oscar.exterior_power(F, 1) Fwedge2, _ = Oscar.exterior_power(F, 2) - success, orig_mod, q = Oscar.is_exterior_power(Fwedge3) + success, orig_mod, q = Oscar._is_exterior_power(Fwedge3) @test success @test orig_mod === F @test q == 3