From 243a1f4160ad9735ca8cbae527fa44ddb4a3488c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Mon, 14 Aug 2023 13:35:33 +0200 Subject: [PATCH 01/11] Add `isomorphic_module_with_simple_structure` --- src/ModuleSimpleStructure.jl | 285 +++++++++++++++++++++++++++++++++++ src/PBWDeformations.jl | 3 + 2 files changed, 288 insertions(+) create mode 100644 src/ModuleSimpleStructure.jl diff --git a/src/ModuleSimpleStructure.jl b/src/ModuleSimpleStructure.jl new file mode 100644 index 0000000..166d715 --- /dev/null +++ b/src/ModuleSimpleStructure.jl @@ -0,0 +1,285 @@ +function isomorphic_module_with_simple_structure(V::LieAlgebraModule) + if is_standard_module(V) + return V, identity_map(V) + elseif is_dual(V) + B = base_module(V) + if is_standard_module(B) + return V, identity_map(V) + end + if is_dual(B) + U = base_module(B) + elseif is_direct_sum(B) + U = direct_sum(dual.(base_modules(B))...) + elseif is_tensor_product(B) + U = tensor_product(dual.(base_modules(B))...) + elseif is_exterior_power(B) + C = base_module(B) + k = get_attribute(B, :power) + U = exterior_power(dual(base_module(B)), k) + elseif is_symmetric_power(B) + C = base_module(B) + k = get_attribute(B, :power) + U = symmetric_power(dual(base_module(B)), k) + elseif is_tensor_power(B) + C = base_module(B) + k = get_attribute(B, :power) + U = tensor_power(dual(base_module(B)), k) + end + V_to_U = hom(V, U, identity_matrix(coefficient_ring(V), dim(V))) + W, U_to_W = isomorphic_module_with_simple_structure(U) + V_to_W = compose(V_to_U, U_to_W) + return W, V_to_W + elseif is_direct_sum(V) + Bs = base_modules(V) + Cs_with_hom = [isomorphic_module_with_simple_structure(B) for B in Bs] + Ds = [] + for (C, _) in Cs_with_hom + if is_direct_sum(C) + push!(Ds, base_modules(C)...) + else + push!(Ds, C) + end + end + if length(Ds) == 1 + W = Ds[1] + B_to_W = Cs_with_hom[1][2] + h = hom(V, W, matrix(B_to_W)) + return W, h + else + W = direct_sum(Ds...) + h = hom(V, W, diagonal_matrix([matrix(B_to_C) for (_, B_to_C) in Cs_with_hom])) + return W, h + end + elseif is_tensor_product(V) + Bs = base_modules(V) + Cs_with_hom = [isomorphic_module_with_simple_structure(B) for B in Bs] + Ds = [] + for (C, _) in Cs_with_hom + if is_tensor_product(C) + push!(Ds, base_modules(C)...) + else + push!(Ds, C) + end + end + if length(Ds) == 1 + W = Ds[1] + B_to_W = Cs_with_hom[1][2] + h = hom(V, W, matrix(B_to_W)) + return W, h + end + U = tensor_product(Ds...) + V_to_U = hom(V, U, reduce(kronecker_product, [matrix(B_to_C) for (_, B_to_C) in Cs_with_hom])) + if all(!is_direct_sum, Ds) + W = U + U_to_W = identity_map(U) + else + Es = [is_direct_sum(D) ? D : direct_sum(D) for D in Ds] + Fs = [] + direct_summand_mappings = [_direct_summand_mapping(E) for E in Es] + ind_map = get_attribute(U, :ind_map) + mat = zero_matrix(coefficient_ring(U), dim(U), dim(U)) + dim_accum = 0 + for summ_comb in reverse.(ProductIterator(reverse([1:length(base_modules(E)) for E in Es]))) + F = tensor_product([base_modules(E)[i] for (E, i) in zip(Es, summ_comb)]...) + println(base_modules(F)) + for i in 1:dim(U) + inds = ind_map[i] + if [direct_summand_mappings[j][ind][1] for (j, ind) in enumerate(inds)] == summ_comb + dsmap = [direct_summand_mappings[j][ind] for (j, ind) in enumerate(inds)] + img = F([basis(base_modules(E)[summ_comb[j]], dsmap[j][2]) for (j, E) in enumerate(Es)]) + mat[i, dim_accum+1:dim_accum+dim(F)] = Oscar.LieAlgebras._matrix(img) + end + end + dim_accum += dim(F) + push!(Fs, F) + end + W = direct_sum(Fs...) + U_to_W = hom(U, W, mat) + end + V_to_W = compose(V_to_U, U_to_W) + return W, V_to_W + elseif is_exterior_power(V) + B = base_module(V) + k = get_attribute(V, :power) + C, B_to_C = isomorphic_module_with_simple_structure(B) + if k == 1 + U = C + V_to_B = hom(V, B, identity_matrix(coefficient_ring(V), dim(V))) + V_to_U = compose(V_to_B, B_to_C) + return U, V_to_U + end + U = exterior_power(C, k) + V_to_U = hom(V, U, [U(B_to_C.(_basis_repres(V, i))) for i in 1:dim(V)]) + if is_direct_sum(C) + direct_summand_mapping = _direct_summand_mapping(C) + ind_map = get_attribute(U, :ind_map) + Ds = base_modules(C) + m = length(Ds) + Es = [] + mat = zero_matrix(coefficient_ring(U), dim(U), dim(U)) + dim_accum = 0 + for summ_comb in multicombinations(m, k) + lambda = [count(==(i), summ_comb) for i in 1:m] + factors = [lambda[i] != 0 ? exterior_power(Ds[i], lambda[i]) : nothing for i in 1:m] + factors_cleaned = filter(!isnothing, factors) + E = tensor_product(factors_cleaned...) + for i in 1:dim(U) + inds = ind_map[i] + if [direct_summand_mapping[ind][1] for ind in inds] == summ_comb + dsmap = [direct_summand_mapping[ind] for ind in inds] + img = E([ + factors[j]([basis(Ds[j], dsmap[k][2]) for k in 1:m if dsmap[k][1] == j]) for + j in 1:m if lambda[j] != 0 + ]) + mat[i, dim_accum+1:dim_accum+dim(E)] = Oscar.LieAlgebras._matrix(img) + end + end + dim_accum += dim(E) + if length(factors_cleaned) == 1 + E = base_modules(E)[1] + end + push!(Es, E) + end + F = direct_sum(Es...) + @assert dim(U) == dim_accum == dim(F) + U_to_F = hom(U, F, mat) + W, F_to_W = isomorphic_module_with_simple_structure(F) + U_to_W = compose(U_to_F, F_to_W) + else + W = U + U_to_W = identity_map(U) + end + V_to_W = compose(V_to_U, U_to_W) + return W, V_to_W + elseif is_symmetric_power(V) + B = base_module(V) + k = get_attribute(V, :power) + C, B_to_C = isomorphic_module_with_simple_structure(B) + if k == 1 + U = C + V_to_B = hom(V, B, identity_matrix(coefficient_ring(V), dim(V))) + V_to_U = compose(V_to_B, B_to_C) + return U, V_to_U + end + U = symmetric_power(C, k) + V_to_U = hom(V, U, [U(B_to_C.(_basis_repres(V, i))) for i in 1:dim(V)]) + if is_direct_sum(C) + direct_summand_mapping = _direct_summand_mapping(C) + ind_map = get_attribute(U, :ind_map) + Ds = base_modules(C) + m = length(Ds) + Es = [] + mat = zero_matrix(coefficient_ring(U), dim(U), dim(U)) + dim_accum = 0 + for summ_comb in multicombinations(m, k) + lambda = [count(==(i), summ_comb) for i in 1:m] + factors = [lambda[i] != 0 ? symmetric_power(Ds[i], lambda[i]) : nothing for i in 1:m] + factors_cleaned = filter(!isnothing, factors) + E = tensor_product(factors_cleaned...) + for i in 1:dim(U) + inds = ind_map[i] + if [direct_summand_mapping[ind][1] for ind in inds] == summ_comb + dsmap = [direct_summand_mapping[ind] for ind in inds] + img = E([ + factors[j]([basis(Ds[j], dsmap[k][2]) for k in 1:m if dsmap[k][1] == j]) for + j in 1:m if lambda[j] != 0 + ]) + mat[i, dim_accum+1:dim_accum+dim(E)] = Oscar.LieAlgebras._matrix(img) + end + end + dim_accum += dim(E) + if length(factors_cleaned) == 1 + E = base_modules(E)[1] + end + push!(Es, E) + end + F = direct_sum(Es...) + @assert dim(U) == dim_accum == dim(F) + U_to_F = hom(U, F, mat) + W, F_to_W = isomorphic_module_with_simple_structure(F) + U_to_W = compose(U_to_F, F_to_W) + else + W = U + U_to_W = identity_map(U) + end + V_to_W = compose(V_to_U, U_to_W) + return W, V_to_W + elseif is_tensor_power(V) + B = base_module(V) + k = get_attribute(V, :power) + C, B_to_C = isomorphic_module_with_simple_structure(B) + if k == 1 + U = C + V_to_B = hom(V, B, identity_matrix(coefficient_ring(V), dim(V))) + V_to_U = compose(V_to_B, B_to_C) + return U, V_to_U + end + U = tensor_power(C, k) + V_to_U = hom(V, U, [U(B_to_C.(_basis_repres(V, i))) for i in 1:dim(V)]) + if is_direct_sum(C) + direct_summand_mapping = _direct_summand_mapping(C) + ind_map = get_attribute(U, :ind_map) + Ds = base_modules(C) + m = length(Ds) + Es = [] + mat = zero_matrix(coefficient_ring(U), dim(U), dim(U)) + dim_accum = 0 + for summ_comb in AbstractAlgebra.ProductIterator(1:m, k) + lambda = [count(==(i), summ_comb) for i in 1:m] + factors = [lambda[i] != 0 ? tensor_power(Ds[i], lambda[i]) : nothing for i in 1:m] + factors_cleaned = filter(!isnothing, factors) + E = tensor_product(factors_cleaned...) + for i in 1:dim(U) + inds = ind_map[i] + if [direct_summand_mapping[ind][1] for ind in inds] == summ_comb + dsmap = [direct_summand_mapping[ind] for ind in inds] + img = E([ + factors[j]([basis(Ds[j], dsmap[k][2]) for k in 1:m if dsmap[k][1] == j]) for + j in 1:m if lambda[j] != 0 + ]) + mat[i, dim_accum+1:dim_accum+dim(E)] = Oscar.LieAlgebras._matrix(img) + end + end + dim_accum += dim(E) + if length(factors_cleaned) == 1 + E = base_modules(E)[1] + end + push!(Es, E) + end + F = direct_sum(Es...) + @assert dim(U) == dim_accum == dim(F) + U_to_F = hom(U, F, mat) + W, F_to_W = isomorphic_module_with_simple_structure(F) + U_to_W = compose(U_to_F, F_to_W) + else + W = U + U_to_W = identity_map(U) + end + V_to_W = compose(V_to_U, U_to_W) + return W, V_to_W + end + error("not implemented for this type of module") +end + + +function _basis_repres(V::LieAlgebraModule, i::Int) + @req is_exterior_power(V) || is_symmetric_power(V) || is_tensor_power(V) "Not a power module." + B = base_module(V) + ind_map = get_attribute(V, :ind_map) + js = ind_map[i] + return map(j -> basis(B, j), js) +end + +function _direct_summand_mapping(V::LieAlgebraModule) + @req is_direct_sum(V) "Not a direct sum" + map = [(0, 0) for _ in 1:dim(V)] + Bs = base_modules(V) + i = 1 + for (j, Bj) in enumerate(Bs) + for k in 1:dim(Bj) + map[i+k-1] = (j, k) + end + i += dim(Bj) + end + return map +end diff --git a/src/PBWDeformations.jl b/src/PBWDeformations.jl index 56ac2fe..5f2c026 100644 --- a/src/PBWDeformations.jl +++ b/src/PBWDeformations.jl @@ -76,6 +76,7 @@ export inneighbor export inneighbors export is_crossing_free export is_pbwdeformation +export isomorphic_module_with_simple_structure export lookup_data export lower_vertex, is_lower_vertex export lower_vertices @@ -105,6 +106,8 @@ function __init__() add_verbose_scope(:PBWDeformations) end +include("ModuleSimpleStructure.jl") + include("DeformationBases/DeformBasis.jl") include("SmashProductLie.jl") From dd8c1341341aafb01d9955228c377f6f25ee2973 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Fri, 25 Aug 2023 12:24:20 +0200 Subject: [PATCH 02/11] Some adaptions to `isomorphic_module_with_simple_structure` --- src/ModuleSimpleStructure.jl | 67 ++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 29 deletions(-) diff --git a/src/ModuleSimpleStructure.jl b/src/ModuleSimpleStructure.jl index 166d715..d84d6b3 100644 --- a/src/ModuleSimpleStructure.jl +++ b/src/ModuleSimpleStructure.jl @@ -1,4 +1,4 @@ -function isomorphic_module_with_simple_structure(V::LieAlgebraModule) +function isomorphic_module_with_simple_structure(V::LieAlgebraModule; check::Bool=true) if is_standard_module(V) return V, identity_map(V) elseif is_dual(V) @@ -8,30 +8,40 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule) end if is_dual(B) U = base_module(B) + V_to_U = hom(V, U, identity_matrix(coefficient_ring(V), dim(V)); check) elseif is_direct_sum(B) U = direct_sum(dual.(base_modules(B))...) + V_to_U = hom(V, U, identity_matrix(coefficient_ring(V), dim(V)); check) elseif is_tensor_product(B) U = tensor_product(dual.(base_modules(B))...) + V_to_U = hom(V, U, identity_matrix(coefficient_ring(V), dim(V)); check) elseif is_exterior_power(B) C = base_module(B) k = get_attribute(B, :power) U = exterior_power(dual(base_module(B)), k) + V_to_U = hom(V, U, identity_matrix(coefficient_ring(V), dim(V)); check) elseif is_symmetric_power(B) C = base_module(B) k = get_attribute(B, :power) + ind_map = get_attribute(B, :ind_map) U = symmetric_power(dual(base_module(B)), k) + mat = zero_matrix(coefficient_ring(V), dim(V), dim(V)) + for i in 1:dim(B) + mat[i, i] = div(factorial(k), prod(factorial(count(==(j), ind_map[i])) for j in 1:dim(C))) + end + V_to_U = hom(V, U, mat; check) elseif is_tensor_power(B) C = base_module(B) k = get_attribute(B, :power) U = tensor_power(dual(base_module(B)), k) + V_to_U = hom(V, U, identity_matrix(coefficient_ring(V), dim(V)); check) end - V_to_U = hom(V, U, identity_matrix(coefficient_ring(V), dim(V))) - W, U_to_W = isomorphic_module_with_simple_structure(U) + W, U_to_W = isomorphic_module_with_simple_structure(U; check) V_to_W = compose(V_to_U, U_to_W) return W, V_to_W elseif is_direct_sum(V) Bs = base_modules(V) - Cs_with_hom = [isomorphic_module_with_simple_structure(B) for B in Bs] + Cs_with_hom = [isomorphic_module_with_simple_structure(B; check) for B in Bs] Ds = [] for (C, _) in Cs_with_hom if is_direct_sum(C) @@ -43,16 +53,16 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule) if length(Ds) == 1 W = Ds[1] B_to_W = Cs_with_hom[1][2] - h = hom(V, W, matrix(B_to_W)) + h = hom(V, W, matrix(B_to_W); check) return W, h else W = direct_sum(Ds...) - h = hom(V, W, diagonal_matrix([matrix(B_to_C) for (_, B_to_C) in Cs_with_hom])) + h = hom(V, W, diagonal_matrix([matrix(B_to_C) for (_, B_to_C) in Cs_with_hom]); check) return W, h end elseif is_tensor_product(V) Bs = base_modules(V) - Cs_with_hom = [isomorphic_module_with_simple_structure(B) for B in Bs] + Cs_with_hom = [isomorphic_module_with_simple_structure(B; check) for B in Bs] Ds = [] for (C, _) in Cs_with_hom if is_tensor_product(C) @@ -64,11 +74,11 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule) if length(Ds) == 1 W = Ds[1] B_to_W = Cs_with_hom[1][2] - h = hom(V, W, matrix(B_to_W)) + h = hom(V, W, matrix(B_to_W); check) return W, h end U = tensor_product(Ds...) - V_to_U = hom(V, U, reduce(kronecker_product, [matrix(B_to_C) for (_, B_to_C) in Cs_with_hom])) + V_to_U = hom(V, U, reduce(kronecker_product, [matrix(B_to_C) for (_, B_to_C) in Cs_with_hom]); check) if all(!is_direct_sum, Ds) W = U U_to_W = identity_map(U) @@ -81,7 +91,6 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule) dim_accum = 0 for summ_comb in reverse.(ProductIterator(reverse([1:length(base_modules(E)) for E in Es]))) F = tensor_product([base_modules(E)[i] for (E, i) in zip(Es, summ_comb)]...) - println(base_modules(F)) for i in 1:dim(U) inds = ind_map[i] if [direct_summand_mappings[j][ind][1] for (j, ind) in enumerate(inds)] == summ_comb @@ -94,22 +103,22 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule) push!(Fs, F) end W = direct_sum(Fs...) - U_to_W = hom(U, W, mat) + U_to_W = hom(U, W, mat; check) end V_to_W = compose(V_to_U, U_to_W) return W, V_to_W elseif is_exterior_power(V) B = base_module(V) k = get_attribute(V, :power) - C, B_to_C = isomorphic_module_with_simple_structure(B) + C, B_to_C = isomorphic_module_with_simple_structure(B; check) if k == 1 U = C - V_to_B = hom(V, B, identity_matrix(coefficient_ring(V), dim(V))) + V_to_B = hom(V, B, identity_matrix(coefficient_ring(V), dim(V)); check) V_to_U = compose(V_to_B, B_to_C) return U, V_to_U end U = exterior_power(C, k) - V_to_U = hom(V, U, [U(B_to_C.(_basis_repres(V, i))) for i in 1:dim(V)]) + V_to_U = hom(V, U, [U(B_to_C.(_basis_repres(V, i))) for i in 1:dim(V)]; check) if is_direct_sum(C) direct_summand_mapping = _direct_summand_mapping(C) ind_map = get_attribute(U, :ind_map) @@ -128,7 +137,7 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule) if [direct_summand_mapping[ind][1] for ind in inds] == summ_comb dsmap = [direct_summand_mapping[ind] for ind in inds] img = E([ - factors[j]([basis(Ds[j], dsmap[k][2]) for k in 1:m if dsmap[k][1] == j]) for + factors[j]([basis(Ds[j], dsmap[l][2]) for l in 1:k if dsmap[l][1] == j]) for j in 1:m if lambda[j] != 0 ]) mat[i, dim_accum+1:dim_accum+dim(E)] = Oscar.LieAlgebras._matrix(img) @@ -142,8 +151,8 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule) end F = direct_sum(Es...) @assert dim(U) == dim_accum == dim(F) - U_to_F = hom(U, F, mat) - W, F_to_W = isomorphic_module_with_simple_structure(F) + U_to_F = hom(U, F, mat; check) + W, F_to_W = isomorphic_module_with_simple_structure(F; check) U_to_W = compose(U_to_F, F_to_W) else W = U @@ -154,15 +163,15 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule) elseif is_symmetric_power(V) B = base_module(V) k = get_attribute(V, :power) - C, B_to_C = isomorphic_module_with_simple_structure(B) + C, B_to_C = isomorphic_module_with_simple_structure(B; check) if k == 1 U = C - V_to_B = hom(V, B, identity_matrix(coefficient_ring(V), dim(V))) + V_to_B = hom(V, B, identity_matrix(coefficient_ring(V), dim(V)); check) V_to_U = compose(V_to_B, B_to_C) return U, V_to_U end U = symmetric_power(C, k) - V_to_U = hom(V, U, [U(B_to_C.(_basis_repres(V, i))) for i in 1:dim(V)]) + V_to_U = hom(V, U, [U(B_to_C.(_basis_repres(V, i))) for i in 1:dim(V)]; check) if is_direct_sum(C) direct_summand_mapping = _direct_summand_mapping(C) ind_map = get_attribute(U, :ind_map) @@ -181,7 +190,7 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule) if [direct_summand_mapping[ind][1] for ind in inds] == summ_comb dsmap = [direct_summand_mapping[ind] for ind in inds] img = E([ - factors[j]([basis(Ds[j], dsmap[k][2]) for k in 1:m if dsmap[k][1] == j]) for + factors[j]([basis(Ds[j], dsmap[l][2]) for l in 1:k if dsmap[l][1] == j]) for j in 1:m if lambda[j] != 0 ]) mat[i, dim_accum+1:dim_accum+dim(E)] = Oscar.LieAlgebras._matrix(img) @@ -195,8 +204,8 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule) end F = direct_sum(Es...) @assert dim(U) == dim_accum == dim(F) - U_to_F = hom(U, F, mat) - W, F_to_W = isomorphic_module_with_simple_structure(F) + U_to_F = hom(U, F, mat; check) + W, F_to_W = isomorphic_module_with_simple_structure(F; check) U_to_W = compose(U_to_F, F_to_W) else W = U @@ -207,15 +216,15 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule) elseif is_tensor_power(V) B = base_module(V) k = get_attribute(V, :power) - C, B_to_C = isomorphic_module_with_simple_structure(B) + C, B_to_C = isomorphic_module_with_simple_structure(B; check) if k == 1 U = C - V_to_B = hom(V, B, identity_matrix(coefficient_ring(V), dim(V))) + V_to_B = hom(V, B, identity_matrix(coefficient_ring(V), dim(V)); check) V_to_U = compose(V_to_B, B_to_C) return U, V_to_U end U = tensor_power(C, k) - V_to_U = hom(V, U, [U(B_to_C.(_basis_repres(V, i))) for i in 1:dim(V)]) + V_to_U = hom(V, U, [U(B_to_C.(_basis_repres(V, i))) for i in 1:dim(V)]; check) if is_direct_sum(C) direct_summand_mapping = _direct_summand_mapping(C) ind_map = get_attribute(U, :ind_map) @@ -234,7 +243,7 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule) if [direct_summand_mapping[ind][1] for ind in inds] == summ_comb dsmap = [direct_summand_mapping[ind] for ind in inds] img = E([ - factors[j]([basis(Ds[j], dsmap[k][2]) for k in 1:m if dsmap[k][1] == j]) for + factors[j]([basis(Ds[j], dsmap[l][2]) for l in 1:k if dsmap[l][1] == j]) for j in 1:m if lambda[j] != 0 ]) mat[i, dim_accum+1:dim_accum+dim(E)] = Oscar.LieAlgebras._matrix(img) @@ -248,8 +257,8 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule) end F = direct_sum(Es...) @assert dim(U) == dim_accum == dim(F) - U_to_F = hom(U, F, mat) - W, F_to_W = isomorphic_module_with_simple_structure(F) + U_to_F = hom(U, F, mat; check) + W, F_to_W = isomorphic_module_with_simple_structure(F; check) U_to_W = compose(U_to_F, F_to_W) else W = U From 00866545208f8f2daf2e2b315b6665e4384d1cf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Fri, 25 Aug 2023 12:25:11 +0200 Subject: [PATCH 03/11] Add some tests --- test/ModuleSimpleStructure-test.jl | 325 +++++++++++++++++++++++++++++ test/runtests.jl | 1 + 2 files changed, 326 insertions(+) create mode 100644 test/ModuleSimpleStructure-test.jl diff --git a/test/ModuleSimpleStructure-test.jl b/test/ModuleSimpleStructure-test.jl new file mode 100644 index 0000000..350e579 --- /dev/null +++ b/test/ModuleSimpleStructure-test.jl @@ -0,0 +1,325 @@ +@testset "ModuleSimpleStructure.jl tests" begin + @testset for L in [general_linear_lie_algebra(QQ, 3), special_orthogonal_lie_algebra(QQ, 3)] + stdV = standard_module(L) + + @testset "Duality, standard" begin + V = dual(stdV) + W, h = isomorphic_module_with_simple_structure(V) + @test is_isomorphism(h) + @test W == V + @test sprint(show, basis(V)) == "LieAlgebraModuleElem{QQFieldElem}[v_1*, v_2*, v_3*]" + @test sprint(show, h.(basis(V))) == "LieAlgebraModuleElem{QQFieldElem}[v_1*, v_2*, v_3*]" + end + + @testset "Duality, duality" begin + V = dual(dual(stdV)) + W, h = isomorphic_module_with_simple_structure(V) + @test is_isomorphism(h) + @test W == stdV + @test sprint(show, basis(V)) == "LieAlgebraModuleElem{QQFieldElem}[(v_1*)*, (v_2*)*, (v_3*)*]" + @test sprint(show, h.(basis(V))) == "LieAlgebraModuleElem{QQFieldElem}[v_1, v_2, v_3]" + end + + @testset "Duality, direct sum" begin + V = dual(direct_sum(stdV, stdV, dual(stdV))) + W, h = isomorphic_module_with_simple_structure(V) + @test is_isomorphism(h) + @test W == direct_sum(dual(stdV), dual(stdV), stdV) + @test sprint(show, basis(V)) == + "LieAlgebraModuleElem{QQFieldElem}[(v_1^(1))*, (v_2^(1))*, (v_3^(1))*, (v_1^(2))*, (v_2^(2))*, (v_3^(2))*, ((v_1*)^(3))*, ((v_2*)^(3))*, ((v_3*)^(3))*]" + @test sprint(show, h.(basis(V))) == + "LieAlgebraModuleElem{QQFieldElem}[(v_1*)^(1), (v_2*)^(1), (v_3*)^(1), (v_1*)^(2), (v_2*)^(2), (v_3*)^(2), v_1^(3), v_2^(3), v_3^(3)]" + end + + @testset "Duality, tensor product" begin + V = dual(tensor_product(stdV, dual(stdV))) + W, h = isomorphic_module_with_simple_structure(V) + @test is_isomorphism(h) + @test W == tensor_product(dual(stdV), stdV) + @test sprint(show, basis(V)) == + "LieAlgebraModuleElem{QQFieldElem}[(v_1 ⊗ (v_1*))*, (v_1 ⊗ (v_2*))*, (v_1 ⊗ (v_3*))*, (v_2 ⊗ (v_1*))*, (v_2 ⊗ (v_2*))*, (v_2 ⊗ (v_3*))*, (v_3 ⊗ (v_1*))*, (v_3 ⊗ (v_2*))*, (v_3 ⊗ (v_3*))*]" + @test sprint(show, h.(basis(V))) == + "LieAlgebraModuleElem{QQFieldElem}[(v_1*) ⊗ v_1, (v_1*) ⊗ v_2, (v_1*) ⊗ v_3, (v_2*) ⊗ v_1, (v_2*) ⊗ v_2, (v_2*) ⊗ v_3, (v_3*) ⊗ v_1, (v_3*) ⊗ v_2, (v_3*) ⊗ v_3]" + end + + @testset "Duality, exterior power, k = $k" for k in 2:3 + V = dual(exterior_power(stdV, k)) + W, h = isomorphic_module_with_simple_structure(V) + @test is_isomorphism(h) + @test W == exterior_power(dual(stdV), k) + if k == 2 + @test sprint(show, basis(V)) == + "LieAlgebraModuleElem{QQFieldElem}[(v_1 ∧ v_2)*, (v_1 ∧ v_3)*, (v_2 ∧ v_3)*]" + @test sprint(show, h.(basis(V))) == + "LieAlgebraModuleElem{QQFieldElem}[(v_1*) ∧ (v_2*), (v_1*) ∧ (v_3*), (v_2*) ∧ (v_3*)]" + end + end + + @testset "Duality, symmetric power, k = $k" for k in 2:5 + V = dual(symmetric_power(stdV, k)) + W, h = isomorphic_module_with_simple_structure(V) + @test is_isomorphism(h) + @test W == symmetric_power(dual(stdV), k) + if k == 2 + @test sprint(show, basis(V)) == + "LieAlgebraModuleElem{QQFieldElem}[(v_1^2)*, (v_1*v_2)*, (v_1*v_3)*, (v_2^2)*, (v_2*v_3)*, (v_3^2)*]" + @test sprint(show, h.(basis(V))) == + "LieAlgebraModuleElem{QQFieldElem}[(v_1*)^2, 2*(v_1*)*(v_2*), 2*(v_1*)*(v_3*), (v_2*)^2, 2*(v_2*)*(v_3*), (v_3*)^2]" + end + end + + @testset "Duality, tensor power, k = $k" for k in 2:5 + V = dual(tensor_power(stdV, k)) + W, h = isomorphic_module_with_simple_structure(V) + @test is_isomorphism(h) + @test W == tensor_power(dual(stdV), k) + if k == 2 + @test sprint(show, basis(V)) == + "LieAlgebraModuleElem{QQFieldElem}[(v_1 ⊗ v_1)*, (v_1 ⊗ v_2)*, (v_1 ⊗ v_3)*, (v_2 ⊗ v_1)*, (v_2 ⊗ v_2)*, (v_2 ⊗ v_3)*, (v_3 ⊗ v_1)*, (v_3 ⊗ v_2)*, (v_3 ⊗ v_3)*]" + @test sprint(show, h.(basis(V))) == + "LieAlgebraModuleElem{QQFieldElem}[(v_1*) ⊗ (v_1*), (v_1*) ⊗ (v_2*), (v_1*) ⊗ (v_3*), (v_2*) ⊗ (v_1*), (v_2*) ⊗ (v_2*), (v_2*) ⊗ (v_3*), (v_3*) ⊗ (v_1*), (v_3*) ⊗ (v_2*), (v_3*) ⊗ (v_3*)]" + end + end + + @testset "Direct sum: one summand" begin + V = direct_sum(exterior_power(stdV, 2)) + W, h = isomorphic_module_with_simple_structure(V) + @test is_isomorphism(h) + @test W == exterior_power(stdV, 2) + @test sprint(show, basis(V)) == "LieAlgebraModuleElem{QQFieldElem}[v_1 ∧ v_2, v_1 ∧ v_3, v_2 ∧ v_3]" + @test sprint(show, h.(basis(V))) == "LieAlgebraModuleElem{QQFieldElem}[v_1 ∧ v_2, v_1 ∧ v_3, v_2 ∧ v_3]" + end + + @testset "Direct sum: nested" begin + V = direct_sum(direct_sum(stdV, exterior_power(stdV, 2)), dual(stdV)) + W, h = isomorphic_module_with_simple_structure(V) + @test is_isomorphism(h) + @test W == direct_sum(stdV, exterior_power(stdV, 2), dual(stdV)) + @test sprint(show, basis(V)) == + "LieAlgebraModuleElem{QQFieldElem}[(v_1^(1))^(1), (v_2^(1))^(1), (v_3^(1))^(1), ((v_1 ∧ v_2)^(2))^(1), ((v_1 ∧ v_3)^(2))^(1), ((v_2 ∧ v_3)^(2))^(1), (v_1*)^(2), (v_2*)^(2), (v_3*)^(2)]" + @test sprint(show, h.(basis(V))) == + "LieAlgebraModuleElem{QQFieldElem}[v_1^(1), v_2^(1), v_3^(1), (v_1 ∧ v_2)^(2), (v_1 ∧ v_3)^(2), (v_2 ∧ v_3)^(2), (v_1*)^(3), (v_2*)^(3), (v_3*)^(3)]" + end + + @testset "Tensor product: one factor" begin + V = tensor_product(exterior_power(stdV, 2)) + W, h = isomorphic_module_with_simple_structure(V) + @test is_isomorphism(h) + @test W == exterior_power(stdV, 2) + @test sprint(show, basis(V)) == "LieAlgebraModuleElem{QQFieldElem}[v_1 ∧ v_2, v_1 ∧ v_3, v_2 ∧ v_3]" + @test sprint(show, h.(basis(V))) == "LieAlgebraModuleElem{QQFieldElem}[v_1 ∧ v_2, v_1 ∧ v_3, v_2 ∧ v_3]" + end + + @testset "Tensor product: nested" begin + V = tensor_product(tensor_product(stdV, exterior_power(stdV, 3)), dual(stdV)) + W, h = isomorphic_module_with_simple_structure(V) + @test is_isomorphism(h) + @test W == tensor_product(stdV, exterior_power(stdV, 3), dual(stdV)) + @test sprint(show, basis(V)) == + "LieAlgebraModuleElem{QQFieldElem}[(v_1 ⊗ (v_1 ∧ v_2 ∧ v_3)) ⊗ (v_1*), (v_1 ⊗ (v_1 ∧ v_2 ∧ v_3)) ⊗ (v_2*), (v_1 ⊗ (v_1 ∧ v_2 ∧ v_3)) ⊗ (v_3*), (v_2 ⊗ (v_1 ∧ v_2 ∧ v_3)) ⊗ (v_1*), (v_2 ⊗ (v_1 ∧ v_2 ∧ v_3)) ⊗ (v_2*), (v_2 ⊗ (v_1 ∧ v_2 ∧ v_3)) ⊗ (v_3*), (v_3 ⊗ (v_1 ∧ v_2 ∧ v_3)) ⊗ (v_1*), (v_3 ⊗ (v_1 ∧ v_2 ∧ v_3)) ⊗ (v_2*), (v_3 ⊗ (v_1 ∧ v_2 ∧ v_3)) ⊗ (v_3*)]" + @test sprint(show, h.(basis(V))) == + "LieAlgebraModuleElem{QQFieldElem}[v_1 ⊗ (v_1 ∧ v_2 ∧ v_3) ⊗ (v_1*), v_1 ⊗ (v_1 ∧ v_2 ∧ v_3) ⊗ (v_2*), v_1 ⊗ (v_1 ∧ v_2 ∧ v_3) ⊗ (v_3*), v_2 ⊗ (v_1 ∧ v_2 ∧ v_3) ⊗ (v_1*), v_2 ⊗ (v_1 ∧ v_2 ∧ v_3) ⊗ (v_2*), v_2 ⊗ (v_1 ∧ v_2 ∧ v_3) ⊗ (v_3*), v_3 ⊗ (v_1 ∧ v_2 ∧ v_3) ⊗ (v_1*), v_3 ⊗ (v_1 ∧ v_2 ∧ v_3) ⊗ (v_2*), v_3 ⊗ (v_1 ∧ v_2 ∧ v_3) ⊗ (v_3*)]" + end + + @testset "Tensor product, direct sum" begin + V = tensor_product(direct_sum(stdV, exterior_power(stdV, 3)), direct_sum(dual(stdV), stdV)) + W, h = isomorphic_module_with_simple_structure(V) + @test is_isomorphism(h) + @test W == direct_sum( + tensor_product(stdV, dual(stdV)), + tensor_product(stdV, stdV), + tensor_product(exterior_power(stdV, 3), dual(stdV)), + tensor_product(exterior_power(stdV, 3), stdV), + ) + @test sprint(show, basis(V)) == + "LieAlgebraModuleElem{QQFieldElem}[(v_1^(1)) ⊗ ((v_1*)^(1)), (v_1^(1)) ⊗ ((v_2*)^(1)), (v_1^(1)) ⊗ ((v_3*)^(1)), (v_1^(1)) ⊗ (v_1^(2)), (v_1^(1)) ⊗ (v_2^(2)), (v_1^(1)) ⊗ (v_3^(2)), (v_2^(1)) ⊗ ((v_1*)^(1)), (v_2^(1)) ⊗ ((v_2*)^(1)), (v_2^(1)) ⊗ ((v_3*)^(1)), (v_2^(1)) ⊗ (v_1^(2)), (v_2^(1)) ⊗ (v_2^(2)), (v_2^(1)) ⊗ (v_3^(2)), (v_3^(1)) ⊗ ((v_1*)^(1)), (v_3^(1)) ⊗ ((v_2*)^(1)), (v_3^(1)) ⊗ ((v_3*)^(1)), (v_3^(1)) ⊗ (v_1^(2)), (v_3^(1)) ⊗ (v_2^(2)), (v_3^(1)) ⊗ (v_3^(2)), ((v_1 ∧ v_2 ∧ v_3)^(2)) ⊗ ((v_1*)^(1)), ((v_1 ∧ v_2 ∧ v_3)^(2)) ⊗ ((v_2*)^(1)), ((v_1 ∧ v_2 ∧ v_3)^(2)) ⊗ ((v_3*)^(1)), ((v_1 ∧ v_2 ∧ v_3)^(2)) ⊗ (v_1^(2)), ((v_1 ∧ v_2 ∧ v_3)^(2)) ⊗ (v_2^(2)), ((v_1 ∧ v_2 ∧ v_3)^(2)) ⊗ (v_3^(2))]" + @test sprint(show, h.(basis(V))) == + "LieAlgebraModuleElem{QQFieldElem}[(v_1 ⊗ (v_1*))^(1), (v_1 ⊗ (v_2*))^(1), (v_1 ⊗ (v_3*))^(1), (v_1 ⊗ v_1)^(2), (v_1 ⊗ v_2)^(2), (v_1 ⊗ v_3)^(2), (v_2 ⊗ (v_1*))^(1), (v_2 ⊗ (v_2*))^(1), (v_2 ⊗ (v_3*))^(1), (v_2 ⊗ v_1)^(2), (v_2 ⊗ v_2)^(2), (v_2 ⊗ v_3)^(2), (v_3 ⊗ (v_1*))^(1), (v_3 ⊗ (v_2*))^(1), (v_3 ⊗ (v_3*))^(1), (v_3 ⊗ v_1)^(2), (v_3 ⊗ v_2)^(2), (v_3 ⊗ v_3)^(2), ((v_1 ∧ v_2 ∧ v_3) ⊗ (v_1*))^(3), ((v_1 ∧ v_2 ∧ v_3) ⊗ (v_2*))^(3), ((v_1 ∧ v_2 ∧ v_3) ⊗ (v_3*))^(3), ((v_1 ∧ v_2 ∧ v_3) ⊗ v_1)^(4), ((v_1 ∧ v_2 ∧ v_3) ⊗ v_2)^(4), ((v_1 ∧ v_2 ∧ v_3) ⊗ v_3)^(4)]" + + + V1 = exterior_power(stdV, 2) + V2 = dual(stdV) + V3 = symmetric_power(stdV, 2) + V4 = dual(stdV) + V5 = stdV + V6 = exterior_power(stdV, 3) + V = tensor_product(V1, direct_sum(V2, V3, V4), direct_sum(V5, V6)) + W, h = isomorphic_module_with_simple_structure(V) + @test is_isomorphism(h) + @test W == direct_sum( + tensor_product(V1, V2, V5), + tensor_product(V1, V2, V6), + tensor_product(V1, V3, V5), + tensor_product(V1, V3, V6), + tensor_product(V1, V4, V5), + tensor_product(V1, V4, V6), + ) + end + + @testset "Exterior power: 1st power" begin + V1 = stdV + V = exterior_power(V1, 1) + W, h = isomorphic_module_with_simple_structure(V) + @test is_isomorphism(h) + @test W == V1 + end + + @testset "Exterior power, direct sum" begin + V1 = stdV + V2 = dual(stdV) + V3 = exterior_power(stdV, 2) + V = exterior_power(direct_sum(V1, V2, V3), 3) + W, h = isomorphic_module_with_simple_structure(V) + @test is_isomorphism(h) + @test W == direct_sum( + exterior_power(V1, 3), + tensor_product(exterior_power(V1, 2), V2), + tensor_product(exterior_power(V1, 2), V3), + tensor_product(V1, exterior_power(V2, 2)), + tensor_product(V1, V2, V3), + tensor_product(V1, exterior_power(V3, 2)), + exterior_power(V2, 3), + tensor_product(exterior_power(V2, 2), V3), + tensor_product(V2, exterior_power(V3, 2)), + exterior_power(V3, 3), + ) + end + + @testset "Symmetric power: 1st power" begin + V1 = stdV + V = symmetric_power(V1, 1) + W, h = isomorphic_module_with_simple_structure(V) + @test is_isomorphism(h) + @test W == V1 + end + + @testset "Symmetric power, direct sum" begin + V1 = stdV + V2 = dual(stdV) + V3 = exterior_power(stdV, 2) + V = symmetric_power(direct_sum(V1, V2, V3), 3) + W, h = isomorphic_module_with_simple_structure(V) + @test is_isomorphism(h) + @test W == direct_sum( + symmetric_power(V1, 3), + tensor_product(symmetric_power(V1, 2), V2), + tensor_product(symmetric_power(V1, 2), V3), + tensor_product(V1, symmetric_power(V2, 2)), + tensor_product(V1, V2, V3), + tensor_product(V1, symmetric_power(V3, 2)), + symmetric_power(V2, 3), + tensor_product(symmetric_power(V2, 2), V3), + tensor_product(V2, symmetric_power(V3, 2)), + symmetric_power(V3, 3), + ) + end + + @testset "Tensor power: 1st power" begin + V1 = stdV + V = tensor_power(V1, 1) + W, h = isomorphic_module_with_simple_structure(V) + @test is_isomorphism(h) + @test W == V1 + end + + @testset "Tensor power, direct sum" begin + V1 = stdV + V2 = exterior_power(dual(stdV), 3) + V3 = exterior_power(stdV, 2) + V = tensor_power(direct_sum(V1, V2, V3), 3) + W, h = isomorphic_module_with_simple_structure(V; check=false) # otherwise needs 3 minutes + @test is_isomorphism(h) + @test W == direct_sum( + tensor_power(V1, 3), # 111 + tensor_product(tensor_power(V1, 2), V2), # 112 + tensor_product(tensor_power(V1, 2), V3), # 113 + tensor_product(tensor_power(V1, 2), V2), # 121 + tensor_product(V1, tensor_power(V2, 2)), # 122 + tensor_product(V1, V2, V3), # 123 + tensor_product(tensor_power(V1, 2), V3), # 131 + tensor_product(V1, V2, V3), # 132 + tensor_product(V1, tensor_power(V3, 2)), # 133 + tensor_product(tensor_power(V1, 2), V2), # 211 + tensor_product(V1, tensor_power(V2, 2)), # 212 + tensor_product(V1, V2, V3), # 213 + tensor_product(V1, tensor_power(V2, 2)), # 221 + tensor_power(V2, 3), # 222 + tensor_product(tensor_power(V2, 2), V3), # 223 + tensor_product(V1, V2, V3), # 231 + tensor_product(tensor_power(V2, 2), V3), # 232 + tensor_product(V2, tensor_power(V3, 2)), # 233 + tensor_product(tensor_power(V1, 2), V3), # 311 + tensor_product(V1, V2, V3), # 312 + tensor_product(V1, tensor_power(V3, 2)), # 313 + tensor_product(V1, V2, V3), # 321 + tensor_product(tensor_power(V2, 2), V3), # 322 + tensor_product(V2, tensor_power(V3, 2)), # 323 + tensor_product(V1, tensor_power(V3, 2)), # 331 + tensor_product(V2, tensor_power(V3, 2)), # 332 + tensor_power(V3, 3), # 333 + ) + end + + @testset "Complex cases 1" begin + V1 = stdV + V2 = dual(V1) + V3 = direct_sum(V1, V2) + + V_1 = exterior_power(V3, 1) + W_1, h = isomorphic_module_with_simple_structure(V_1) + @test is_isomorphism(h) + @test W_1 == V3 + + V_2 = exterior_power(V3, 2) + W_2, h = isomorphic_module_with_simple_structure(V_2) + @test is_isomorphism(h) + @test W_2 == direct_sum(exterior_power(V1, 2), tensor_product(V1, V2), exterior_power(V2, 2)) + + V_3 = exterior_power(V3, 3) + W_3, h = isomorphic_module_with_simple_structure(V_3) + @test is_isomorphism(h) + @test W_3 == direct_sum( + exterior_power(V1, 3), + tensor_product(exterior_power(V1, 2), V2), + tensor_product(V1, exterior_power(V2, 2)), + exterior_power(V2, 3), + ) + + # TODO: handle zero-dim modules (e.g. 4th exterior power of 3-dim module) + # V_4 = exterior_power(V3, 4) + # W_4, h = isomorphic_module_with_simple_structure(V_4) + # @test is_isomorphism(h) + # @test W_4 == direct_sum( + # exterior_power(V1, 4), + # tensor_product(exterior_power(V1, 3), V2), + # tensor_product(exterior_power(V1, 2), exterior_power(V2, 2)), + # tensor_product(V1, exterior_power(V2, 3)), + # exterior_power(V2, 4), + # ) + end + + @testset "Complex cases 2" begin + V1 = symmetric_power(stdV, 3) + + Ve2 = dual(exterior_power(dual(V1), 2)) + We2, h = isomorphic_module_with_simple_structure(Ve2) + @test is_isomorphism(h) + @test We2 == exterior_power(V1, 2) + + Ve3 = dual(exterior_power(dual(V1), 3)) + We3, h = isomorphic_module_with_simple_structure(Ve3) + @test is_isomorphism(h) + @test We3 == exterior_power(V1, 3) + + Vs2 = dual(symmetric_power(dual(V1), 2)) + Ws2, h = isomorphic_module_with_simple_structure(Vs2) + @test is_isomorphism(h) + @test Ws2 == symmetric_power(V1, 2) + + Vt2 = dual(tensor_power(dual(V1), 2)) + Wt2, h = isomorphic_module_with_simple_structure(Vt2) + @test is_isomorphism(h) + @test Wt2 == tensor_power(V1, 2) + end + end +end diff --git a/test/runtests.jl b/test/runtests.jl index 4824e16..dc38242 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -2,6 +2,7 @@ include("setup.jl") include("Aqua.jl") +include("ModuleSimpleStructure-test.jl") include("ArcDiagram-test.jl") include("DeformationBases-test.jl") include("Pseudograph-test.jl") From 4ba04f02cd002f58fc52ae176dd48c4be8d4fece Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Tue, 29 Aug 2023 14:34:42 +0200 Subject: [PATCH 04/11] Some adjustments --- src/ModuleSimpleStructure.jl | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/ModuleSimpleStructure.jl b/src/ModuleSimpleStructure.jl index d84d6b3..826180f 100644 --- a/src/ModuleSimpleStructure.jl +++ b/src/ModuleSimpleStructure.jl @@ -118,7 +118,7 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule; check::Boo return U, V_to_U end U = exterior_power(C, k) - V_to_U = hom(V, U, [U(B_to_C.(_basis_repres(V, i))) for i in 1:dim(V)]; check) + V_to_U = hom(V, U, elem_type(U)[U(B_to_C.(_basis_repres(V, i))) for i in 1:dim(V)]; check) if is_direct_sum(C) direct_summand_mapping = _direct_summand_mapping(C) ind_map = get_attribute(U, :ind_map) @@ -144,9 +144,6 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule; check::Boo end end dim_accum += dim(E) - if length(factors_cleaned) == 1 - E = base_modules(E)[1] - end push!(Es, E) end F = direct_sum(Es...) @@ -171,7 +168,7 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule; check::Boo return U, V_to_U end U = symmetric_power(C, k) - V_to_U = hom(V, U, [U(B_to_C.(_basis_repres(V, i))) for i in 1:dim(V)]; check) + V_to_U = hom(V, U, elem_type(U)[U(B_to_C.(_basis_repres(V, i))) for i in 1:dim(V)]; check) if is_direct_sum(C) direct_summand_mapping = _direct_summand_mapping(C) ind_map = get_attribute(U, :ind_map) @@ -197,9 +194,6 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule; check::Boo end end dim_accum += dim(E) - if length(factors_cleaned) == 1 - E = base_modules(E)[1] - end push!(Es, E) end F = direct_sum(Es...) @@ -224,7 +218,7 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule; check::Boo return U, V_to_U end U = tensor_power(C, k) - V_to_U = hom(V, U, [U(B_to_C.(_basis_repres(V, i))) for i in 1:dim(V)]; check) + V_to_U = hom(V, U, elem_type(U)[U(B_to_C.(_basis_repres(V, i))) for i in 1:dim(V)]; check) if is_direct_sum(C) direct_summand_mapping = _direct_summand_mapping(C) ind_map = get_attribute(U, :ind_map) @@ -250,9 +244,6 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule; check::Boo end end dim_accum += dim(E) - if length(factors_cleaned) == 1 - E = base_modules(E)[1] - end push!(Es, E) end F = direct_sum(Es...) @@ -274,7 +265,7 @@ end function _basis_repres(V::LieAlgebraModule, i::Int) @req is_exterior_power(V) || is_symmetric_power(V) || is_tensor_power(V) "Not a power module." B = base_module(V) - ind_map = get_attribute(V, :ind_map) + ind_map = get_attribute(V, :ind_map)::Vector{Vector{Int}} js = ind_map[i] return map(j -> basis(B, j), js) end From 7177eeac4b26f2311949c6261d129b730f32632a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Tue, 29 Aug 2023 14:34:57 +0200 Subject: [PATCH 05/11] Remove trivial summands/factors --- src/ModuleSimpleStructure.jl | 2 ++ test/ModuleSimpleStructure-test.jl | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/ModuleSimpleStructure.jl b/src/ModuleSimpleStructure.jl index 826180f..d2e7a8e 100644 --- a/src/ModuleSimpleStructure.jl +++ b/src/ModuleSimpleStructure.jl @@ -50,6 +50,7 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule; check::Boo push!(Ds, C) end end + filter!(D -> dim(D) > 0, Ds) if length(Ds) == 1 W = Ds[1] B_to_W = Cs_with_hom[1][2] @@ -71,6 +72,7 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule; check::Boo push!(Ds, C) end end + filter!(D -> dim(D) != 1 || any(!iszero, D.transformation_matrices), Ds) if length(Ds) == 1 W = Ds[1] B_to_W = Cs_with_hom[1][2] diff --git a/test/ModuleSimpleStructure-test.jl b/test/ModuleSimpleStructure-test.jl index 350e579..6eaab3c 100644 --- a/test/ModuleSimpleStructure-test.jl +++ b/test/ModuleSimpleStructure-test.jl @@ -90,6 +90,21 @@ @test sprint(show, h.(basis(V))) == "LieAlgebraModuleElem{QQFieldElem}[v_1 ∧ v_2, v_1 ∧ v_3, v_2 ∧ v_3]" end + @testset "Direct sum: 0-dim summand" begin + V1 = dual(stdV) + V3 = exterior_power(stdV, 2) + for V2 in [trivial_module(L, 0), exterior_power(stdV, dim(stdV) + 1)] + V = direct_sum(V1, V2, V3) + W, h = isomorphic_module_with_simple_structure(V) + @test is_isomorphism(h) + @test W == direct_sum(V1, V3) + @test sprint(show, basis(V)) == + "LieAlgebraModuleElem{QQFieldElem}[(v_1*)^(1), (v_2*)^(1), (v_3*)^(1), (v_1 ∧ v_2)^(3), (v_1 ∧ v_3)^(3), (v_2 ∧ v_3)^(3)]" + @test sprint(show, h.(basis(V))) == + "LieAlgebraModuleElem{QQFieldElem}[(v_1*)^(1), (v_2*)^(1), (v_3*)^(1), (v_1 ∧ v_2)^(3), (v_1 ∧ v_3)^(3), (v_2 ∧ v_3)^(3)]" + end + end + @testset "Direct sum: nested" begin V = direct_sum(direct_sum(stdV, exterior_power(stdV, 2)), dual(stdV)) W, h = isomorphic_module_with_simple_structure(V) @@ -110,6 +125,17 @@ @test sprint(show, h.(basis(V))) == "LieAlgebraModuleElem{QQFieldElem}[v_1 ∧ v_2, v_1 ∧ v_3, v_2 ∧ v_3]" end + @testset "Tensor product: trivial 1-dim factor" begin + V1 = dual(stdV) + V3 = exterior_power(stdV, 2) + for V2 in [tensor_power(stdV, 0), exterior_power(stdV, dim(stdV))] + V = tensor_product(V1, V2, V3) + W, h = isomorphic_module_with_simple_structure(V) + @test is_isomorphism(h) + @test W == tensor_product(V1, V3) + end + end + @testset "Tensor product: nested" begin V = tensor_product(tensor_product(stdV, exterior_power(stdV, 3)), dual(stdV)) W, h = isomorphic_module_with_simple_structure(V) From 5cc1638808dc0f7f0465f7e378e30148e66a1203 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Wed, 30 Aug 2023 11:38:29 +0200 Subject: [PATCH 06/11] Fix tests --- test/ModuleSimpleStructure-test.jl | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/ModuleSimpleStructure-test.jl b/test/ModuleSimpleStructure-test.jl index 6eaab3c..4a6a5e8 100644 --- a/test/ModuleSimpleStructure-test.jl +++ b/test/ModuleSimpleStructure-test.jl @@ -93,7 +93,7 @@ @testset "Direct sum: 0-dim summand" begin V1 = dual(stdV) V3 = exterior_power(stdV, 2) - for V2 in [trivial_module(L, 0), exterior_power(stdV, dim(stdV) + 1)] + for V2 in [exterior_power(stdV, dim(stdV) + 1)] V = direct_sum(V1, V2, V3) W, h = isomorphic_module_with_simple_structure(V) @test is_isomorphism(h) @@ -101,7 +101,7 @@ @test sprint(show, basis(V)) == "LieAlgebraModuleElem{QQFieldElem}[(v_1*)^(1), (v_2*)^(1), (v_3*)^(1), (v_1 ∧ v_2)^(3), (v_1 ∧ v_3)^(3), (v_2 ∧ v_3)^(3)]" @test sprint(show, h.(basis(V))) == - "LieAlgebraModuleElem{QQFieldElem}[(v_1*)^(1), (v_2*)^(1), (v_3*)^(1), (v_1 ∧ v_2)^(3), (v_1 ∧ v_3)^(3), (v_2 ∧ v_3)^(3)]" + "LieAlgebraModuleElem{QQFieldElem}[(v_1*)^(1), (v_2*)^(1), (v_3*)^(1), (v_1 ∧ v_2)^(2), (v_1 ∧ v_3)^(2), (v_2 ∧ v_3)^(2)]" end end @@ -128,7 +128,7 @@ @testset "Tensor product: trivial 1-dim factor" begin V1 = dual(stdV) V3 = exterior_power(stdV, 2) - for V2 in [tensor_power(stdV, 0), exterior_power(stdV, dim(stdV))] + for V2 in [tensor_power(stdV, 0), exterior_power(stdV, 0), symmetric_power(stdV, 0)] V = tensor_product(V1, V2, V3) W, h = isomorphic_module_with_simple_structure(V) @test is_isomorphism(h) @@ -137,10 +137,10 @@ end @testset "Tensor product: nested" begin - V = tensor_product(tensor_product(stdV, exterior_power(stdV, 3)), dual(stdV)) + V = tensor_product(tensor_product(stdV, symmetric_power(stdV, 3)), dual(stdV)) W, h = isomorphic_module_with_simple_structure(V) @test is_isomorphism(h) - @test W == tensor_product(stdV, exterior_power(stdV, 3), dual(stdV)) + @test W == tensor_product(stdV, symmetric_power(stdV, 3), dual(stdV)) @test sprint(show, basis(V)) == "LieAlgebraModuleElem{QQFieldElem}[(v_1 ⊗ (v_1 ∧ v_2 ∧ v_3)) ⊗ (v_1*), (v_1 ⊗ (v_1 ∧ v_2 ∧ v_3)) ⊗ (v_2*), (v_1 ⊗ (v_1 ∧ v_2 ∧ v_3)) ⊗ (v_3*), (v_2 ⊗ (v_1 ∧ v_2 ∧ v_3)) ⊗ (v_1*), (v_2 ⊗ (v_1 ∧ v_2 ∧ v_3)) ⊗ (v_2*), (v_2 ⊗ (v_1 ∧ v_2 ∧ v_3)) ⊗ (v_3*), (v_3 ⊗ (v_1 ∧ v_2 ∧ v_3)) ⊗ (v_1*), (v_3 ⊗ (v_1 ∧ v_2 ∧ v_3)) ⊗ (v_2*), (v_3 ⊗ (v_1 ∧ v_2 ∧ v_3)) ⊗ (v_3*)]" @test sprint(show, h.(basis(V))) == @@ -148,14 +148,14 @@ end @testset "Tensor product, direct sum" begin - V = tensor_product(direct_sum(stdV, exterior_power(stdV, 3)), direct_sum(dual(stdV), stdV)) + V = tensor_product(direct_sum(stdV, symmetric_power(stdV, 3)), direct_sum(dual(stdV), stdV)) W, h = isomorphic_module_with_simple_structure(V) @test is_isomorphism(h) @test W == direct_sum( tensor_product(stdV, dual(stdV)), tensor_product(stdV, stdV), - tensor_product(exterior_power(stdV, 3), dual(stdV)), - tensor_product(exterior_power(stdV, 3), stdV), + tensor_product(symmetric_power(stdV, 3), dual(stdV)), + tensor_product(symmetric_power(stdV, 3), stdV), ) @test sprint(show, basis(V)) == "LieAlgebraModuleElem{QQFieldElem}[(v_1^(1)) ⊗ ((v_1*)^(1)), (v_1^(1)) ⊗ ((v_2*)^(1)), (v_1^(1)) ⊗ ((v_3*)^(1)), (v_1^(1)) ⊗ (v_1^(2)), (v_1^(1)) ⊗ (v_2^(2)), (v_1^(1)) ⊗ (v_3^(2)), (v_2^(1)) ⊗ ((v_1*)^(1)), (v_2^(1)) ⊗ ((v_2*)^(1)), (v_2^(1)) ⊗ ((v_3*)^(1)), (v_2^(1)) ⊗ (v_1^(2)), (v_2^(1)) ⊗ (v_2^(2)), (v_2^(1)) ⊗ (v_3^(2)), (v_3^(1)) ⊗ ((v_1*)^(1)), (v_3^(1)) ⊗ ((v_2*)^(1)), (v_3^(1)) ⊗ ((v_3*)^(1)), (v_3^(1)) ⊗ (v_1^(2)), (v_3^(1)) ⊗ (v_2^(2)), (v_3^(1)) ⊗ (v_3^(2)), ((v_1 ∧ v_2 ∧ v_3)^(2)) ⊗ ((v_1*)^(1)), ((v_1 ∧ v_2 ∧ v_3)^(2)) ⊗ ((v_2*)^(1)), ((v_1 ∧ v_2 ∧ v_3)^(2)) ⊗ ((v_3*)^(1)), ((v_1 ∧ v_2 ∧ v_3)^(2)) ⊗ (v_1^(2)), ((v_1 ∧ v_2 ∧ v_3)^(2)) ⊗ (v_2^(2)), ((v_1 ∧ v_2 ∧ v_3)^(2)) ⊗ (v_3^(2))]" @@ -168,7 +168,7 @@ V3 = symmetric_power(stdV, 2) V4 = dual(stdV) V5 = stdV - V6 = exterior_power(stdV, 3) + V6 = symmetric_power(stdV, 2) V = tensor_product(V1, direct_sum(V2, V3, V4), direct_sum(V5, V6)) W, h = isomorphic_module_with_simple_structure(V) @test is_isomorphism(h) From c0436358e85a30aa6e9565807c7a114506557a41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Wed, 30 Aug 2023 16:52:28 +0200 Subject: [PATCH 07/11] More fixes --- src/ModuleSimpleStructure.jl | 12 +++++--- test/ModuleSimpleStructure-test.jl | 45 +++++++++++++++--------------- 2 files changed, 30 insertions(+), 27 deletions(-) diff --git a/src/ModuleSimpleStructure.jl b/src/ModuleSimpleStructure.jl index d2e7a8e..cb65f2b 100644 --- a/src/ModuleSimpleStructure.jl +++ b/src/ModuleSimpleStructure.jl @@ -50,10 +50,12 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule; check::Boo push!(Ds, C) end end - filter!(D -> dim(D) > 0, Ds) + Ds_filtered = filter(D -> dim(D) > 0, Ds) + Ds = length(Ds_filtered) > 0 ? Ds_filtered : [Ds[1]] if length(Ds) == 1 W = Ds[1] - B_to_W = Cs_with_hom[1][2] + i = findfirst(C_with_hom -> C_with_hom[1] == W, Cs_with_hom) + B_to_W = Cs_with_hom[i][2] h = hom(V, W, matrix(B_to_W); check) return W, h else @@ -72,10 +74,12 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule; check::Boo push!(Ds, C) end end - filter!(D -> dim(D) != 1 || any(!iszero, D.transformation_matrices), Ds) + Ds_filtered = filter(D -> dim(D) != 1 || any(!iszero, D.transformation_matrices), Ds) + Ds = length(Ds_filtered) > 0 ? Ds_filtered : [Ds[1]] if length(Ds) == 1 W = Ds[1] - B_to_W = Cs_with_hom[1][2] + i = findfirst(C_with_hom -> C_with_hom[1] == W, Cs_with_hom) + B_to_W = Cs_with_hom[i][2] h = hom(V, W, matrix(B_to_W); check) return W, h end diff --git a/test/ModuleSimpleStructure-test.jl b/test/ModuleSimpleStructure-test.jl index 4a6a5e8..28f2538 100644 --- a/test/ModuleSimpleStructure-test.jl +++ b/test/ModuleSimpleStructure-test.jl @@ -137,31 +137,26 @@ end @testset "Tensor product: nested" begin - V = tensor_product(tensor_product(stdV, symmetric_power(stdV, 3)), dual(stdV)) + V = tensor_product(tensor_product(stdV, exterior_power(stdV, 2)), dual(stdV)) W, h = isomorphic_module_with_simple_structure(V) @test is_isomorphism(h) - @test W == tensor_product(stdV, symmetric_power(stdV, 3), dual(stdV)) + @test W == tensor_product(stdV, exterior_power(stdV, 2), dual(stdV)) @test sprint(show, basis(V)) == - "LieAlgebraModuleElem{QQFieldElem}[(v_1 ⊗ (v_1 ∧ v_2 ∧ v_3)) ⊗ (v_1*), (v_1 ⊗ (v_1 ∧ v_2 ∧ v_3)) ⊗ (v_2*), (v_1 ⊗ (v_1 ∧ v_2 ∧ v_3)) ⊗ (v_3*), (v_2 ⊗ (v_1 ∧ v_2 ∧ v_3)) ⊗ (v_1*), (v_2 ⊗ (v_1 ∧ v_2 ∧ v_3)) ⊗ (v_2*), (v_2 ⊗ (v_1 ∧ v_2 ∧ v_3)) ⊗ (v_3*), (v_3 ⊗ (v_1 ∧ v_2 ∧ v_3)) ⊗ (v_1*), (v_3 ⊗ (v_1 ∧ v_2 ∧ v_3)) ⊗ (v_2*), (v_3 ⊗ (v_1 ∧ v_2 ∧ v_3)) ⊗ (v_3*)]" + "LieAlgebraModuleElem{QQFieldElem}[(v_1 ⊗ (v_1 ∧ v_2)) ⊗ (v_1*), (v_1 ⊗ (v_1 ∧ v_2)) ⊗ (v_2*), (v_1 ⊗ (v_1 ∧ v_2)) ⊗ (v_3*), (v_1 ⊗ (v_1 ∧ v_3)) ⊗ (v_1*), (v_1 ⊗ (v_1 ∧ v_3)) ⊗ (v_2*), (v_1 ⊗ (v_1 ∧ v_3)) ⊗ (v_3*), (v_1 ⊗ (v_2 ∧ v_3)) ⊗ (v_1*), (v_1 ⊗ (v_2 ∧ v_3)) ⊗ (v_2*), (v_1 ⊗ (v_2 ∧ v_3)) ⊗ (v_3*), (v_2 ⊗ (v_1 ∧ v_2)) ⊗ (v_1*), (v_2 ⊗ (v_1 ∧ v_2)) ⊗ (v_2*), (v_2 ⊗ (v_1 ∧ v_2)) ⊗ (v_3*), (v_2 ⊗ (v_1 ∧ v_3)) ⊗ (v_1*), (v_2 ⊗ (v_1 ∧ v_3)) ⊗ (v_2*), (v_2 ⊗ (v_1 ∧ v_3)) ⊗ (v_3*), (v_2 ⊗ (v_2 ∧ v_3)) ⊗ (v_1*), (v_2 ⊗ (v_2 ∧ v_3)) ⊗ (v_2*), (v_2 ⊗ (v_2 ∧ v_3)) ⊗ (v_3*), (v_3 ⊗ (v_1 ∧ v_2)) ⊗ (v_1*), (v_3 ⊗ (v_1 ∧ v_2)) ⊗ (v_2*), (v_3 ⊗ (v_1 ∧ v_2)) ⊗ (v_3*), (v_3 ⊗ (v_1 ∧ v_3)) ⊗ (v_1*), (v_3 ⊗ (v_1 ∧ v_3)) ⊗ (v_2*), (v_3 ⊗ (v_1 ∧ v_3)) ⊗ (v_3*), (v_3 ⊗ (v_2 ∧ v_3)) ⊗ (v_1*), (v_3 ⊗ (v_2 ∧ v_3)) ⊗ (v_2*), (v_3 ⊗ (v_2 ∧ v_3)) ⊗ (v_3*)]" @test sprint(show, h.(basis(V))) == - "LieAlgebraModuleElem{QQFieldElem}[v_1 ⊗ (v_1 ∧ v_2 ∧ v_3) ⊗ (v_1*), v_1 ⊗ (v_1 ∧ v_2 ∧ v_3) ⊗ (v_2*), v_1 ⊗ (v_1 ∧ v_2 ∧ v_3) ⊗ (v_3*), v_2 ⊗ (v_1 ∧ v_2 ∧ v_3) ⊗ (v_1*), v_2 ⊗ (v_1 ∧ v_2 ∧ v_3) ⊗ (v_2*), v_2 ⊗ (v_1 ∧ v_2 ∧ v_3) ⊗ (v_3*), v_3 ⊗ (v_1 ∧ v_2 ∧ v_3) ⊗ (v_1*), v_3 ⊗ (v_1 ∧ v_2 ∧ v_3) ⊗ (v_2*), v_3 ⊗ (v_1 ∧ v_2 ∧ v_3) ⊗ (v_3*)]" + "LieAlgebraModuleElem{QQFieldElem}[v_1 ⊗ (v_1 ∧ v_2) ⊗ (v_1*), v_1 ⊗ (v_1 ∧ v_2) ⊗ (v_2*), v_1 ⊗ (v_1 ∧ v_2) ⊗ (v_3*), v_1 ⊗ (v_1 ∧ v_3) ⊗ (v_1*), v_1 ⊗ (v_1 ∧ v_3) ⊗ (v_2*), v_1 ⊗ (v_1 ∧ v_3) ⊗ (v_3*), v_1 ⊗ (v_2 ∧ v_3) ⊗ (v_1*), v_1 ⊗ (v_2 ∧ v_3) ⊗ (v_2*), v_1 ⊗ (v_2 ∧ v_3) ⊗ (v_3*), v_2 ⊗ (v_1 ∧ v_2) ⊗ (v_1*), v_2 ⊗ (v_1 ∧ v_2) ⊗ (v_2*), v_2 ⊗ (v_1 ∧ v_2) ⊗ (v_3*), v_2 ⊗ (v_1 ∧ v_3) ⊗ (v_1*), v_2 ⊗ (v_1 ∧ v_3) ⊗ (v_2*), v_2 ⊗ (v_1 ∧ v_3) ⊗ (v_3*), v_2 ⊗ (v_2 ∧ v_3) ⊗ (v_1*), v_2 ⊗ (v_2 ∧ v_3) ⊗ (v_2*), v_2 ⊗ (v_2 ∧ v_3) ⊗ (v_3*), v_3 ⊗ (v_1 ∧ v_2) ⊗ (v_1*), v_3 ⊗ (v_1 ∧ v_2) ⊗ (v_2*), v_3 ⊗ (v_1 ∧ v_2) ⊗ (v_3*), v_3 ⊗ (v_1 ∧ v_3) ⊗ (v_1*), v_3 ⊗ (v_1 ∧ v_3) ⊗ (v_2*), v_3 ⊗ (v_1 ∧ v_3) ⊗ (v_3*), v_3 ⊗ (v_2 ∧ v_3) ⊗ (v_1*), v_3 ⊗ (v_2 ∧ v_3) ⊗ (v_2*), v_3 ⊗ (v_2 ∧ v_3) ⊗ (v_3*)]" end @testset "Tensor product, direct sum" begin - V = tensor_product(direct_sum(stdV, symmetric_power(stdV, 3)), direct_sum(dual(stdV), stdV)) + V = tensor_product(direct_sum(stdV, symmetric_power(stdV, 2)), direct_sum(dual(stdV), stdV)) W, h = isomorphic_module_with_simple_structure(V) @test is_isomorphism(h) @test W == direct_sum( tensor_product(stdV, dual(stdV)), tensor_product(stdV, stdV), - tensor_product(symmetric_power(stdV, 3), dual(stdV)), - tensor_product(symmetric_power(stdV, 3), stdV), + tensor_product(symmetric_power(stdV, 2), dual(stdV)), + tensor_product(symmetric_power(stdV, 2), stdV), ) - @test sprint(show, basis(V)) == - "LieAlgebraModuleElem{QQFieldElem}[(v_1^(1)) ⊗ ((v_1*)^(1)), (v_1^(1)) ⊗ ((v_2*)^(1)), (v_1^(1)) ⊗ ((v_3*)^(1)), (v_1^(1)) ⊗ (v_1^(2)), (v_1^(1)) ⊗ (v_2^(2)), (v_1^(1)) ⊗ (v_3^(2)), (v_2^(1)) ⊗ ((v_1*)^(1)), (v_2^(1)) ⊗ ((v_2*)^(1)), (v_2^(1)) ⊗ ((v_3*)^(1)), (v_2^(1)) ⊗ (v_1^(2)), (v_2^(1)) ⊗ (v_2^(2)), (v_2^(1)) ⊗ (v_3^(2)), (v_3^(1)) ⊗ ((v_1*)^(1)), (v_3^(1)) ⊗ ((v_2*)^(1)), (v_3^(1)) ⊗ ((v_3*)^(1)), (v_3^(1)) ⊗ (v_1^(2)), (v_3^(1)) ⊗ (v_2^(2)), (v_3^(1)) ⊗ (v_3^(2)), ((v_1 ∧ v_2 ∧ v_3)^(2)) ⊗ ((v_1*)^(1)), ((v_1 ∧ v_2 ∧ v_3)^(2)) ⊗ ((v_2*)^(1)), ((v_1 ∧ v_2 ∧ v_3)^(2)) ⊗ ((v_3*)^(1)), ((v_1 ∧ v_2 ∧ v_3)^(2)) ⊗ (v_1^(2)), ((v_1 ∧ v_2 ∧ v_3)^(2)) ⊗ (v_2^(2)), ((v_1 ∧ v_2 ∧ v_3)^(2)) ⊗ (v_3^(2))]" - @test sprint(show, h.(basis(V))) == - "LieAlgebraModuleElem{QQFieldElem}[(v_1 ⊗ (v_1*))^(1), (v_1 ⊗ (v_2*))^(1), (v_1 ⊗ (v_3*))^(1), (v_1 ⊗ v_1)^(2), (v_1 ⊗ v_2)^(2), (v_1 ⊗ v_3)^(2), (v_2 ⊗ (v_1*))^(1), (v_2 ⊗ (v_2*))^(1), (v_2 ⊗ (v_3*))^(1), (v_2 ⊗ v_1)^(2), (v_2 ⊗ v_2)^(2), (v_2 ⊗ v_3)^(2), (v_3 ⊗ (v_1*))^(1), (v_3 ⊗ (v_2*))^(1), (v_3 ⊗ (v_3*))^(1), (v_3 ⊗ v_1)^(2), (v_3 ⊗ v_2)^(2), (v_3 ⊗ v_3)^(2), ((v_1 ∧ v_2 ∧ v_3) ⊗ (v_1*))^(3), ((v_1 ∧ v_2 ∧ v_3) ⊗ (v_2*))^(3), ((v_1 ∧ v_2 ∧ v_3) ⊗ (v_3*))^(3), ((v_1 ∧ v_2 ∧ v_3) ⊗ v_1)^(4), ((v_1 ∧ v_2 ∧ v_3) ⊗ v_2)^(4), ((v_1 ∧ v_2 ∧ v_3) ⊗ v_3)^(4)]" - V1 = exterior_power(stdV, 2) V2 = dual(stdV) @@ -250,7 +245,7 @@ @testset "Tensor power, direct sum" begin V1 = stdV - V2 = exterior_power(dual(stdV), 3) + V2 = exterior_power(dual(stdV), 2) V3 = exterior_power(stdV, 2) V = tensor_power(direct_sum(V1, V2, V3), 3) W, h = isomorphic_module_with_simple_structure(V; check=false) # otherwise needs 3 minutes @@ -312,16 +307,20 @@ ) # TODO: handle zero-dim modules (e.g. 4th exterior power of 3-dim module) - # V_4 = exterior_power(V3, 4) - # W_4, h = isomorphic_module_with_simple_structure(V_4) - # @test is_isomorphism(h) - # @test W_4 == direct_sum( - # exterior_power(V1, 4), - # tensor_product(exterior_power(V1, 3), V2), - # tensor_product(exterior_power(V1, 2), exterior_power(V2, 2)), - # tensor_product(V1, exterior_power(V2, 3)), - # exterior_power(V2, 4), - # ) + V_4 = exterior_power(V3, 4) + W_4a, ha = isomorphic_module_with_simple_structure(V_4) + @test is_isomorphism(ha) + W_4b, hb = isomorphic_module_with_simple_structure( + direct_sum( + exterior_power(V1, 4), + tensor_product(exterior_power(V1, 3), V2), + tensor_product(exterior_power(V1, 2), exterior_power(V2, 2)), + tensor_product(V1, exterior_power(V2, 3)), + exterior_power(V2, 4), + ), + ) + @test is_isomorphism(hb) + @test W_4a == W_4b end @testset "Complex cases 2" begin From 07d092447c11d66a68c6484827263edfa56f13f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Thu, 14 Sep 2023 20:02:09 +0200 Subject: [PATCH 08/11] Make it work with new Oscar --- src/ModuleSimpleStructure.jl | 136 ++++++++++++++++++++++------------- 1 file changed, 86 insertions(+), 50 deletions(-) diff --git a/src/ModuleSimpleStructure.jl b/src/ModuleSimpleStructure.jl index cb65f2b..89e929b 100644 --- a/src/ModuleSimpleStructure.jl +++ b/src/ModuleSimpleStructure.jl @@ -23,11 +23,13 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule; check::Boo elseif is_symmetric_power(B) C = base_module(B) k = get_attribute(B, :power) - ind_map = get_attribute(B, :ind_map) + inv_pure = get_attribute(B, :symmetric_pure_preimage_function) U = symmetric_power(dual(base_module(B)), k) mat = zero_matrix(coefficient_ring(V), dim(V), dim(V)) for i in 1:dim(B) - mat[i, i] = div(factorial(k), prod(factorial(count(==(j), ind_map[i])) for j in 1:dim(C))) + pure_factors = inv_pure(basis(B, i)) + mat[i, i] = + div(factorial(k), prod(factorial(count(==(xj), pure_factors)) for xj in unique(pure_factors))) end V_to_U = hom(V, U, mat; check) elseif is_tensor_power(B) @@ -91,17 +93,31 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule; check::Boo else Es = [is_direct_sum(D) ? D : direct_sum(D) for D in Ds] Fs = [] - direct_summand_mappings = [_direct_summand_mapping(E) for E in Es] - ind_map = get_attribute(U, :ind_map) + inv_pure = get_attribute(U, :tensor_pure_preimage_function) mat = zero_matrix(coefficient_ring(U), dim(U), dim(U)) dim_accum = 0 for summ_comb in reverse.(ProductIterator(reverse([1:length(base_modules(E)) for E in Es]))) F = tensor_product([base_modules(E)[i] for (E, i) in zip(Es, summ_comb)]...) - for i in 1:dim(U) - inds = ind_map[i] - if [direct_summand_mappings[j][ind][1] for (j, ind) in enumerate(inds)] == summ_comb - dsmap = [direct_summand_mappings[j][ind] for (j, ind) in enumerate(inds)] - img = F([basis(base_modules(E)[summ_comb[j]], dsmap[j][2]) for (j, E) in enumerate(Es)]) + for (i, bi) in enumerate(basis(U)) + pure_factors = inv_pure(bi) + dsmap = [ + begin + local j, pr_f + projs = canonical_projections(Es[i]) + if parent(f) !== Es[i] + f = Es[i]([f]) + end + for outer j in 1:length(projs) + pr_f = projs[j](f) + if !iszero(pr_f) + break + end + end + (j, pr_f) + end for (i, f) in enumerate(pure_factors) + ] + if [dsmap[l][1] for l in 1:length(Es)] == summ_comb + img = F([dsmap[j][2] for (j, E) in enumerate(Es)]) mat[i, dim_accum+1:dim_accum+dim(F)] = Oscar.LieAlgebras._matrix(img) end end @@ -126,11 +142,11 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule; check::Boo U = exterior_power(C, k) V_to_U = hom(V, U, elem_type(U)[U(B_to_C.(_basis_repres(V, i))) for i in 1:dim(V)]; check) if is_direct_sum(C) - direct_summand_mapping = _direct_summand_mapping(C) - ind_map = get_attribute(U, :ind_map) Ds = base_modules(C) m = length(Ds) Es = [] + inv_pure = get_attribute(U, :exterior_pure_preimage_function) + projs = canonical_projections(C) mat = zero_matrix(coefficient_ring(U), dim(U), dim(U)) dim_accum = 0 for summ_comb in multicombinations(m, k) @@ -138,13 +154,23 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule; check::Boo factors = [lambda[i] != 0 ? exterior_power(Ds[i], lambda[i]) : nothing for i in 1:m] factors_cleaned = filter(!isnothing, factors) E = tensor_product(factors_cleaned...) - for i in 1:dim(U) - inds = ind_map[i] - if [direct_summand_mapping[ind][1] for ind in inds] == summ_comb - dsmap = [direct_summand_mapping[ind] for ind in inds] + for (i, bi) in enumerate(basis(U)) + pure_factors = inv_pure(bi) + dsmap = [ + begin + local j, pr_f + for outer j in 1:length(projs) + pr_f = projs[j](f) + if !iszero(pr_f) + break + end + end + (j, pr_f) + end for f in pure_factors + ] + if [dsmap[l][1] for l in 1:k] == summ_comb img = E([ - factors[j]([basis(Ds[j], dsmap[l][2]) for l in 1:k if dsmap[l][1] == j]) for - j in 1:m if lambda[j] != 0 + factors[j]([dsmap[l][2] for l in 1:k if dsmap[l][1] == j]) for j in 1:m if lambda[j] != 0 ]) mat[i, dim_accum+1:dim_accum+dim(E)] = Oscar.LieAlgebras._matrix(img) end @@ -176,11 +202,11 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule; check::Boo U = symmetric_power(C, k) V_to_U = hom(V, U, elem_type(U)[U(B_to_C.(_basis_repres(V, i))) for i in 1:dim(V)]; check) if is_direct_sum(C) - direct_summand_mapping = _direct_summand_mapping(C) - ind_map = get_attribute(U, :ind_map) Ds = base_modules(C) m = length(Ds) Es = [] + inv_pure = get_attribute(U, :symmetric_pure_preimage_function) + projs = canonical_projections(C) mat = zero_matrix(coefficient_ring(U), dim(U), dim(U)) dim_accum = 0 for summ_comb in multicombinations(m, k) @@ -188,13 +214,23 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule; check::Boo factors = [lambda[i] != 0 ? symmetric_power(Ds[i], lambda[i]) : nothing for i in 1:m] factors_cleaned = filter(!isnothing, factors) E = tensor_product(factors_cleaned...) - for i in 1:dim(U) - inds = ind_map[i] - if [direct_summand_mapping[ind][1] for ind in inds] == summ_comb - dsmap = [direct_summand_mapping[ind] for ind in inds] + for (i, bi) in enumerate(basis(U)) + pure_factors = inv_pure(bi) + dsmap = [ + begin + local j, pr_f + for outer j in 1:length(projs) + pr_f = projs[j](f) + if !iszero(pr_f) + break + end + end + (j, pr_f) + end for f in pure_factors + ] + if [dsmap[l][1] for l in 1:k] == summ_comb img = E([ - factors[j]([basis(Ds[j], dsmap[l][2]) for l in 1:k if dsmap[l][1] == j]) for - j in 1:m if lambda[j] != 0 + factors[j]([dsmap[l][2] for l in 1:k if dsmap[l][1] == j]) for j in 1:m if lambda[j] != 0 ]) mat[i, dim_accum+1:dim_accum+dim(E)] = Oscar.LieAlgebras._matrix(img) end @@ -226,11 +262,11 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule; check::Boo U = tensor_power(C, k) V_to_U = hom(V, U, elem_type(U)[U(B_to_C.(_basis_repres(V, i))) for i in 1:dim(V)]; check) if is_direct_sum(C) - direct_summand_mapping = _direct_summand_mapping(C) - ind_map = get_attribute(U, :ind_map) Ds = base_modules(C) m = length(Ds) Es = [] + inv_pure = get_attribute(U, :tensor_pure_preimage_function) + projs = canonical_projections(C) mat = zero_matrix(coefficient_ring(U), dim(U), dim(U)) dim_accum = 0 for summ_comb in AbstractAlgebra.ProductIterator(1:m, k) @@ -238,13 +274,23 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule; check::Boo factors = [lambda[i] != 0 ? tensor_power(Ds[i], lambda[i]) : nothing for i in 1:m] factors_cleaned = filter(!isnothing, factors) E = tensor_product(factors_cleaned...) - for i in 1:dim(U) - inds = ind_map[i] - if [direct_summand_mapping[ind][1] for ind in inds] == summ_comb - dsmap = [direct_summand_mapping[ind] for ind in inds] + for (i, bi) in enumerate(basis(U)) + pure_factors = inv_pure(bi) + dsmap = [ + begin + local j, pr_f + for outer j in 1:length(projs) + pr_f = projs[j](f) + if !iszero(pr_f) + break + end + end + (j, pr_f) + end for f in pure_factors + ] + if [dsmap[l][1] for l in 1:k] == summ_comb img = E([ - factors[j]([basis(Ds[j], dsmap[l][2]) for l in 1:k if dsmap[l][1] == j]) for - j in 1:m if lambda[j] != 0 + factors[j]([dsmap[l][2] for l in 1:k if dsmap[l][1] == j]) for j in 1:m if lambda[j] != 0 ]) mat[i, dim_accum+1:dim_accum+dim(E)] = Oscar.LieAlgebras._matrix(img) end @@ -270,22 +316,12 @@ end function _basis_repres(V::LieAlgebraModule, i::Int) @req is_exterior_power(V) || is_symmetric_power(V) || is_tensor_power(V) "Not a power module." - B = base_module(V) - ind_map = get_attribute(V, :ind_map)::Vector{Vector{Int}} - js = ind_map[i] - return map(j -> basis(B, j), js) -end - -function _direct_summand_mapping(V::LieAlgebraModule) - @req is_direct_sum(V) "Not a direct sum" - map = [(0, 0) for _ in 1:dim(V)] - Bs = base_modules(V) - i = 1 - for (j, Bj) in enumerate(Bs) - for k in 1:dim(Bj) - map[i+k-1] = (j, k) - end - i += dim(Bj) + inv_pure = if is_exterior_power(V) + get_attribute(V, :exterior_pure_preimage_function) + elseif is_symmetric_power(V) + get_attribute(V, :symmetric_pure_preimage_function) + elseif is_tensor_power(V) + get_attribute(V, :tensor_pure_preimage_function) end - return map + return inv_pure(basis(V, i)) end From bfa0e203f512d6f8e276623a4385d3ee97345187 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Thu, 14 Sep 2023 20:08:08 +0200 Subject: [PATCH 09/11] Update tests --- test/ModuleSimpleStructure-test.jl | 91 ++++++++++++++++++++---------- 1 file changed, 61 insertions(+), 30 deletions(-) diff --git a/test/ModuleSimpleStructure-test.jl b/test/ModuleSimpleStructure-test.jl index 28f2538..c552e04 100644 --- a/test/ModuleSimpleStructure-test.jl +++ b/test/ModuleSimpleStructure-test.jl @@ -4,7 +4,8 @@ @testset "Duality, standard" begin V = dual(stdV) - W, h = isomorphic_module_with_simple_structure(V) + W, h = isomorphic_module_with_simple_structure(V; check=false) + @test is_welldefined(h) @test is_isomorphism(h) @test W == V @test sprint(show, basis(V)) == "LieAlgebraModuleElem{QQFieldElem}[v_1*, v_2*, v_3*]" @@ -13,7 +14,8 @@ @testset "Duality, duality" begin V = dual(dual(stdV)) - W, h = isomorphic_module_with_simple_structure(V) + W, h = isomorphic_module_with_simple_structure(V; check=false) + @test is_welldefined(h) @test is_isomorphism(h) @test W == stdV @test sprint(show, basis(V)) == "LieAlgebraModuleElem{QQFieldElem}[(v_1*)*, (v_2*)*, (v_3*)*]" @@ -22,7 +24,8 @@ @testset "Duality, direct sum" begin V = dual(direct_sum(stdV, stdV, dual(stdV))) - W, h = isomorphic_module_with_simple_structure(V) + W, h = isomorphic_module_with_simple_structure(V; check=false) + @test is_welldefined(h) @test is_isomorphism(h) @test W == direct_sum(dual(stdV), dual(stdV), stdV) @test sprint(show, basis(V)) == @@ -33,7 +36,8 @@ @testset "Duality, tensor product" begin V = dual(tensor_product(stdV, dual(stdV))) - W, h = isomorphic_module_with_simple_structure(V) + W, h = isomorphic_module_with_simple_structure(V; check=false) + @test is_welldefined(h) @test is_isomorphism(h) @test W == tensor_product(dual(stdV), stdV) @test sprint(show, basis(V)) == @@ -44,7 +48,8 @@ @testset "Duality, exterior power, k = $k" for k in 2:3 V = dual(exterior_power(stdV, k)) - W, h = isomorphic_module_with_simple_structure(V) + W, h = isomorphic_module_with_simple_structure(V; check=false) + @test is_welldefined(h) @test is_isomorphism(h) @test W == exterior_power(dual(stdV), k) if k == 2 @@ -57,7 +62,8 @@ @testset "Duality, symmetric power, k = $k" for k in 2:5 V = dual(symmetric_power(stdV, k)) - W, h = isomorphic_module_with_simple_structure(V) + W, h = isomorphic_module_with_simple_structure(V; check=false) + @test is_welldefined(h) @test is_isomorphism(h) @test W == symmetric_power(dual(stdV), k) if k == 2 @@ -70,7 +76,8 @@ @testset "Duality, tensor power, k = $k" for k in 2:5 V = dual(tensor_power(stdV, k)) - W, h = isomorphic_module_with_simple_structure(V) + W, h = isomorphic_module_with_simple_structure(V; check=false) + @test is_welldefined(h) @test is_isomorphism(h) @test W == tensor_power(dual(stdV), k) if k == 2 @@ -83,7 +90,8 @@ @testset "Direct sum: one summand" begin V = direct_sum(exterior_power(stdV, 2)) - W, h = isomorphic_module_with_simple_structure(V) + W, h = isomorphic_module_with_simple_structure(V; check=false) + @test is_welldefined(h) @test is_isomorphism(h) @test W == exterior_power(stdV, 2) @test sprint(show, basis(V)) == "LieAlgebraModuleElem{QQFieldElem}[v_1 ∧ v_2, v_1 ∧ v_3, v_2 ∧ v_3]" @@ -95,7 +103,8 @@ V3 = exterior_power(stdV, 2) for V2 in [exterior_power(stdV, dim(stdV) + 1)] V = direct_sum(V1, V2, V3) - W, h = isomorphic_module_with_simple_structure(V) + W, h = isomorphic_module_with_simple_structure(V; check=false) + @test is_welldefined(h) @test is_isomorphism(h) @test W == direct_sum(V1, V3) @test sprint(show, basis(V)) == @@ -107,7 +116,8 @@ @testset "Direct sum: nested" begin V = direct_sum(direct_sum(stdV, exterior_power(stdV, 2)), dual(stdV)) - W, h = isomorphic_module_with_simple_structure(V) + W, h = isomorphic_module_with_simple_structure(V; check=false) + @test is_welldefined(h) @test is_isomorphism(h) @test W == direct_sum(stdV, exterior_power(stdV, 2), dual(stdV)) @test sprint(show, basis(V)) == @@ -118,7 +128,8 @@ @testset "Tensor product: one factor" begin V = tensor_product(exterior_power(stdV, 2)) - W, h = isomorphic_module_with_simple_structure(V) + W, h = isomorphic_module_with_simple_structure(V; check=false) + @test is_welldefined(h) @test is_isomorphism(h) @test W == exterior_power(stdV, 2) @test sprint(show, basis(V)) == "LieAlgebraModuleElem{QQFieldElem}[v_1 ∧ v_2, v_1 ∧ v_3, v_2 ∧ v_3]" @@ -130,7 +141,8 @@ V3 = exterior_power(stdV, 2) for V2 in [tensor_power(stdV, 0), exterior_power(stdV, 0), symmetric_power(stdV, 0)] V = tensor_product(V1, V2, V3) - W, h = isomorphic_module_with_simple_structure(V) + W, h = isomorphic_module_with_simple_structure(V; check=false) + @test is_welldefined(h) @test is_isomorphism(h) @test W == tensor_product(V1, V3) end @@ -138,7 +150,8 @@ @testset "Tensor product: nested" begin V = tensor_product(tensor_product(stdV, exterior_power(stdV, 2)), dual(stdV)) - W, h = isomorphic_module_with_simple_structure(V) + W, h = isomorphic_module_with_simple_structure(V; check=false) + @test is_welldefined(h) @test is_isomorphism(h) @test W == tensor_product(stdV, exterior_power(stdV, 2), dual(stdV)) @test sprint(show, basis(V)) == @@ -149,7 +162,8 @@ @testset "Tensor product, direct sum" begin V = tensor_product(direct_sum(stdV, symmetric_power(stdV, 2)), direct_sum(dual(stdV), stdV)) - W, h = isomorphic_module_with_simple_structure(V) + W, h = isomorphic_module_with_simple_structure(V; check=false) + @test is_welldefined(h) @test is_isomorphism(h) @test W == direct_sum( tensor_product(stdV, dual(stdV)), @@ -165,7 +179,8 @@ V5 = stdV V6 = symmetric_power(stdV, 2) V = tensor_product(V1, direct_sum(V2, V3, V4), direct_sum(V5, V6)) - W, h = isomorphic_module_with_simple_structure(V) + W, h = isomorphic_module_with_simple_structure(V; check=false) + @test is_welldefined(h) @test is_isomorphism(h) @test W == direct_sum( tensor_product(V1, V2, V5), @@ -180,7 +195,8 @@ @testset "Exterior power: 1st power" begin V1 = stdV V = exterior_power(V1, 1) - W, h = isomorphic_module_with_simple_structure(V) + W, h = isomorphic_module_with_simple_structure(V; check=false) + @test is_welldefined(h) @test is_isomorphism(h) @test W == V1 end @@ -190,7 +206,8 @@ V2 = dual(stdV) V3 = exterior_power(stdV, 2) V = exterior_power(direct_sum(V1, V2, V3), 3) - W, h = isomorphic_module_with_simple_structure(V) + W, h = isomorphic_module_with_simple_structure(V; check=false) + @test is_welldefined(h) @test is_isomorphism(h) @test W == direct_sum( exterior_power(V1, 3), @@ -209,7 +226,8 @@ @testset "Symmetric power: 1st power" begin V1 = stdV V = symmetric_power(V1, 1) - W, h = isomorphic_module_with_simple_structure(V) + W, h = isomorphic_module_with_simple_structure(V; check=false) + @test is_welldefined(h) @test is_isomorphism(h) @test W == V1 end @@ -219,7 +237,8 @@ V2 = dual(stdV) V3 = exterior_power(stdV, 2) V = symmetric_power(direct_sum(V1, V2, V3), 3) - W, h = isomorphic_module_with_simple_structure(V) + W, h = isomorphic_module_with_simple_structure(V; check=false) + @test is_welldefined(h) @test is_isomorphism(h) @test W == direct_sum( symmetric_power(V1, 3), @@ -238,7 +257,8 @@ @testset "Tensor power: 1st power" begin V1 = stdV V = tensor_power(V1, 1) - W, h = isomorphic_module_with_simple_structure(V) + W, h = isomorphic_module_with_simple_structure(V; check=false) + @test is_welldefined(h) @test is_isomorphism(h) @test W == V1 end @@ -248,7 +268,8 @@ V2 = exterior_power(dual(stdV), 2) V3 = exterior_power(stdV, 2) V = tensor_power(direct_sum(V1, V2, V3), 3) - W, h = isomorphic_module_with_simple_structure(V; check=false) # otherwise needs 3 minutes + W, h = isomorphic_module_with_simple_structure(V; check=false) + # @test is_welldefined(h) # needs 3 minutes @test is_isomorphism(h) @test W == direct_sum( tensor_power(V1, 3), # 111 @@ -287,17 +308,20 @@ V3 = direct_sum(V1, V2) V_1 = exterior_power(V3, 1) - W_1, h = isomorphic_module_with_simple_structure(V_1) + W_1, h = isomorphic_module_with_simple_structure(V_1; check=false) + @test is_welldefined(h) @test is_isomorphism(h) @test W_1 == V3 V_2 = exterior_power(V3, 2) - W_2, h = isomorphic_module_with_simple_structure(V_2) + W_2, h = isomorphic_module_with_simple_structure(V_2; check=false) + @test is_welldefined(h) @test is_isomorphism(h) @test W_2 == direct_sum(exterior_power(V1, 2), tensor_product(V1, V2), exterior_power(V2, 2)) V_3 = exterior_power(V3, 3) - W_3, h = isomorphic_module_with_simple_structure(V_3) + W_3, h = isomorphic_module_with_simple_structure(V_3; check=false) + @test is_welldefined(h) @test is_isomorphism(h) @test W_3 == direct_sum( exterior_power(V1, 3), @@ -308,7 +332,8 @@ # TODO: handle zero-dim modules (e.g. 4th exterior power of 3-dim module) V_4 = exterior_power(V3, 4) - W_4a, ha = isomorphic_module_with_simple_structure(V_4) + W_4a, ha = isomorphic_module_with_simple_structure(V_4; check=false) + @test is_welldefined(ha) @test is_isomorphism(ha) W_4b, hb = isomorphic_module_with_simple_structure( direct_sum( @@ -317,8 +342,10 @@ tensor_product(exterior_power(V1, 2), exterior_power(V2, 2)), tensor_product(V1, exterior_power(V2, 3)), exterior_power(V2, 4), - ), + ); + check=false, ) + @test is_welldefined(hb) @test is_isomorphism(hb) @test W_4a == W_4b end @@ -327,22 +354,26 @@ V1 = symmetric_power(stdV, 3) Ve2 = dual(exterior_power(dual(V1), 2)) - We2, h = isomorphic_module_with_simple_structure(Ve2) + We2, h = isomorphic_module_with_simple_structure(Ve2; check=false) + @test is_welldefined(h) @test is_isomorphism(h) @test We2 == exterior_power(V1, 2) Ve3 = dual(exterior_power(dual(V1), 3)) - We3, h = isomorphic_module_with_simple_structure(Ve3) + We3, h = isomorphic_module_with_simple_structure(Ve3; check=false) + @test is_welldefined(h) @test is_isomorphism(h) @test We3 == exterior_power(V1, 3) Vs2 = dual(symmetric_power(dual(V1), 2)) - Ws2, h = isomorphic_module_with_simple_structure(Vs2) + Ws2, h = isomorphic_module_with_simple_structure(Vs2; check=false) + @test is_welldefined(h) @test is_isomorphism(h) @test Ws2 == symmetric_power(V1, 2) Vt2 = dual(tensor_power(dual(V1), 2)) - Wt2, h = isomorphic_module_with_simple_structure(Vt2) + Wt2, h = isomorphic_module_with_simple_structure(Vt2; check=false) + @test is_welldefined(h) @test is_isomorphism(h) @test Wt2 == tensor_power(V1, 2) end From 2dfb8cfebf81e0e19ad9678ac878497de7031ed4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Thu, 14 Sep 2023 20:13:29 +0200 Subject: [PATCH 10/11] Remove `check` kwarg --- src/ModuleSimpleStructure.jl | 60 ++++++++++++++--------------- test/ModuleSimpleStructure-test.jl | 61 +++++++++++++++--------------- 2 files changed, 60 insertions(+), 61 deletions(-) diff --git a/src/ModuleSimpleStructure.jl b/src/ModuleSimpleStructure.jl index 89e929b..6c2e710 100644 --- a/src/ModuleSimpleStructure.jl +++ b/src/ModuleSimpleStructure.jl @@ -1,4 +1,4 @@ -function isomorphic_module_with_simple_structure(V::LieAlgebraModule; check::Bool=true) +function isomorphic_module_with_simple_structure(V::LieAlgebraModule) if is_standard_module(V) return V, identity_map(V) elseif is_dual(V) @@ -8,18 +8,18 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule; check::Boo end if is_dual(B) U = base_module(B) - V_to_U = hom(V, U, identity_matrix(coefficient_ring(V), dim(V)); check) + V_to_U = hom(V, U, identity_matrix(coefficient_ring(V), dim(V)); check=false) elseif is_direct_sum(B) U = direct_sum(dual.(base_modules(B))...) - V_to_U = hom(V, U, identity_matrix(coefficient_ring(V), dim(V)); check) + V_to_U = hom(V, U, identity_matrix(coefficient_ring(V), dim(V)); check=false) elseif is_tensor_product(B) U = tensor_product(dual.(base_modules(B))...) - V_to_U = hom(V, U, identity_matrix(coefficient_ring(V), dim(V)); check) + V_to_U = hom(V, U, identity_matrix(coefficient_ring(V), dim(V)); check=false) elseif is_exterior_power(B) C = base_module(B) k = get_attribute(B, :power) U = exterior_power(dual(base_module(B)), k) - V_to_U = hom(V, U, identity_matrix(coefficient_ring(V), dim(V)); check) + V_to_U = hom(V, U, identity_matrix(coefficient_ring(V), dim(V)); check=false) elseif is_symmetric_power(B) C = base_module(B) k = get_attribute(B, :power) @@ -31,19 +31,19 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule; check::Boo mat[i, i] = div(factorial(k), prod(factorial(count(==(xj), pure_factors)) for xj in unique(pure_factors))) end - V_to_U = hom(V, U, mat; check) + V_to_U = hom(V, U, mat; check=false) elseif is_tensor_power(B) C = base_module(B) k = get_attribute(B, :power) U = tensor_power(dual(base_module(B)), k) - V_to_U = hom(V, U, identity_matrix(coefficient_ring(V), dim(V)); check) + V_to_U = hom(V, U, identity_matrix(coefficient_ring(V), dim(V)); check=false) end - W, U_to_W = isomorphic_module_with_simple_structure(U; check) + W, U_to_W = isomorphic_module_with_simple_structure(U) V_to_W = compose(V_to_U, U_to_W) return W, V_to_W elseif is_direct_sum(V) Bs = base_modules(V) - Cs_with_hom = [isomorphic_module_with_simple_structure(B; check) for B in Bs] + Cs_with_hom = [isomorphic_module_with_simple_structure(B) for B in Bs] Ds = [] for (C, _) in Cs_with_hom if is_direct_sum(C) @@ -58,16 +58,16 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule; check::Boo W = Ds[1] i = findfirst(C_with_hom -> C_with_hom[1] == W, Cs_with_hom) B_to_W = Cs_with_hom[i][2] - h = hom(V, W, matrix(B_to_W); check) + h = hom(V, W, matrix(B_to_W); check=false) return W, h else W = direct_sum(Ds...) - h = hom(V, W, diagonal_matrix([matrix(B_to_C) for (_, B_to_C) in Cs_with_hom]); check) + h = hom(V, W, diagonal_matrix([matrix(B_to_C) for (_, B_to_C) in Cs_with_hom]); check=false) return W, h end elseif is_tensor_product(V) Bs = base_modules(V) - Cs_with_hom = [isomorphic_module_with_simple_structure(B; check) for B in Bs] + Cs_with_hom = [isomorphic_module_with_simple_structure(B) for B in Bs] Ds = [] for (C, _) in Cs_with_hom if is_tensor_product(C) @@ -82,11 +82,11 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule; check::Boo W = Ds[1] i = findfirst(C_with_hom -> C_with_hom[1] == W, Cs_with_hom) B_to_W = Cs_with_hom[i][2] - h = hom(V, W, matrix(B_to_W); check) + h = hom(V, W, matrix(B_to_W); check=false) return W, h end U = tensor_product(Ds...) - V_to_U = hom(V, U, reduce(kronecker_product, [matrix(B_to_C) for (_, B_to_C) in Cs_with_hom]); check) + V_to_U = hom(V, U, reduce(kronecker_product, [matrix(B_to_C) for (_, B_to_C) in Cs_with_hom]); check=false) if all(!is_direct_sum, Ds) W = U U_to_W = identity_map(U) @@ -125,22 +125,22 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule; check::Boo push!(Fs, F) end W = direct_sum(Fs...) - U_to_W = hom(U, W, mat; check) + U_to_W = hom(U, W, mat; check=false) end V_to_W = compose(V_to_U, U_to_W) return W, V_to_W elseif is_exterior_power(V) B = base_module(V) k = get_attribute(V, :power) - C, B_to_C = isomorphic_module_with_simple_structure(B; check) + C, B_to_C = isomorphic_module_with_simple_structure(B) if k == 1 U = C - V_to_B = hom(V, B, identity_matrix(coefficient_ring(V), dim(V)); check) + V_to_B = hom(V, B, identity_matrix(coefficient_ring(V), dim(V)); check=false) V_to_U = compose(V_to_B, B_to_C) return U, V_to_U end U = exterior_power(C, k) - V_to_U = hom(V, U, elem_type(U)[U(B_to_C.(_basis_repres(V, i))) for i in 1:dim(V)]; check) + V_to_U = hom(V, U, elem_type(U)[U(B_to_C.(_basis_repres(V, i))) for i in 1:dim(V)]; check=false) if is_direct_sum(C) Ds = base_modules(C) m = length(Ds) @@ -180,8 +180,8 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule; check::Boo end F = direct_sum(Es...) @assert dim(U) == dim_accum == dim(F) - U_to_F = hom(U, F, mat; check) - W, F_to_W = isomorphic_module_with_simple_structure(F; check) + U_to_F = hom(U, F, mat; check=false) + W, F_to_W = isomorphic_module_with_simple_structure(F) U_to_W = compose(U_to_F, F_to_W) else W = U @@ -192,15 +192,15 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule; check::Boo elseif is_symmetric_power(V) B = base_module(V) k = get_attribute(V, :power) - C, B_to_C = isomorphic_module_with_simple_structure(B; check) + C, B_to_C = isomorphic_module_with_simple_structure(B) if k == 1 U = C - V_to_B = hom(V, B, identity_matrix(coefficient_ring(V), dim(V)); check) + V_to_B = hom(V, B, identity_matrix(coefficient_ring(V), dim(V)); check=false) V_to_U = compose(V_to_B, B_to_C) return U, V_to_U end U = symmetric_power(C, k) - V_to_U = hom(V, U, elem_type(U)[U(B_to_C.(_basis_repres(V, i))) for i in 1:dim(V)]; check) + V_to_U = hom(V, U, elem_type(U)[U(B_to_C.(_basis_repres(V, i))) for i in 1:dim(V)]; check=false) if is_direct_sum(C) Ds = base_modules(C) m = length(Ds) @@ -240,8 +240,8 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule; check::Boo end F = direct_sum(Es...) @assert dim(U) == dim_accum == dim(F) - U_to_F = hom(U, F, mat; check) - W, F_to_W = isomorphic_module_with_simple_structure(F; check) + U_to_F = hom(U, F, mat; check=false) + W, F_to_W = isomorphic_module_with_simple_structure(F) U_to_W = compose(U_to_F, F_to_W) else W = U @@ -252,15 +252,15 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule; check::Boo elseif is_tensor_power(V) B = base_module(V) k = get_attribute(V, :power) - C, B_to_C = isomorphic_module_with_simple_structure(B; check) + C, B_to_C = isomorphic_module_with_simple_structure(B) if k == 1 U = C - V_to_B = hom(V, B, identity_matrix(coefficient_ring(V), dim(V)); check) + V_to_B = hom(V, B, identity_matrix(coefficient_ring(V), dim(V)); check=false) V_to_U = compose(V_to_B, B_to_C) return U, V_to_U end U = tensor_power(C, k) - V_to_U = hom(V, U, elem_type(U)[U(B_to_C.(_basis_repres(V, i))) for i in 1:dim(V)]; check) + V_to_U = hom(V, U, elem_type(U)[U(B_to_C.(_basis_repres(V, i))) for i in 1:dim(V)]; check=false) if is_direct_sum(C) Ds = base_modules(C) m = length(Ds) @@ -300,8 +300,8 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule; check::Boo end F = direct_sum(Es...) @assert dim(U) == dim_accum == dim(F) - U_to_F = hom(U, F, mat; check) - W, F_to_W = isomorphic_module_with_simple_structure(F; check) + U_to_F = hom(U, F, mat; check=false) + W, F_to_W = isomorphic_module_with_simple_structure(F) U_to_W = compose(U_to_F, F_to_W) else W = U diff --git a/test/ModuleSimpleStructure-test.jl b/test/ModuleSimpleStructure-test.jl index c552e04..2d01123 100644 --- a/test/ModuleSimpleStructure-test.jl +++ b/test/ModuleSimpleStructure-test.jl @@ -4,7 +4,7 @@ @testset "Duality, standard" begin V = dual(stdV) - W, h = isomorphic_module_with_simple_structure(V; check=false) + W, h = isomorphic_module_with_simple_structure(V) @test is_welldefined(h) @test is_isomorphism(h) @test W == V @@ -14,7 +14,7 @@ @testset "Duality, duality" begin V = dual(dual(stdV)) - W, h = isomorphic_module_with_simple_structure(V; check=false) + W, h = isomorphic_module_with_simple_structure(V) @test is_welldefined(h) @test is_isomorphism(h) @test W == stdV @@ -24,7 +24,7 @@ @testset "Duality, direct sum" begin V = dual(direct_sum(stdV, stdV, dual(stdV))) - W, h = isomorphic_module_with_simple_structure(V; check=false) + W, h = isomorphic_module_with_simple_structure(V) @test is_welldefined(h) @test is_isomorphism(h) @test W == direct_sum(dual(stdV), dual(stdV), stdV) @@ -36,7 +36,7 @@ @testset "Duality, tensor product" begin V = dual(tensor_product(stdV, dual(stdV))) - W, h = isomorphic_module_with_simple_structure(V; check=false) + W, h = isomorphic_module_with_simple_structure(V) @test is_welldefined(h) @test is_isomorphism(h) @test W == tensor_product(dual(stdV), stdV) @@ -48,7 +48,7 @@ @testset "Duality, exterior power, k = $k" for k in 2:3 V = dual(exterior_power(stdV, k)) - W, h = isomorphic_module_with_simple_structure(V; check=false) + W, h = isomorphic_module_with_simple_structure(V) @test is_welldefined(h) @test is_isomorphism(h) @test W == exterior_power(dual(stdV), k) @@ -62,7 +62,7 @@ @testset "Duality, symmetric power, k = $k" for k in 2:5 V = dual(symmetric_power(stdV, k)) - W, h = isomorphic_module_with_simple_structure(V; check=false) + W, h = isomorphic_module_with_simple_structure(V) @test is_welldefined(h) @test is_isomorphism(h) @test W == symmetric_power(dual(stdV), k) @@ -76,7 +76,7 @@ @testset "Duality, tensor power, k = $k" for k in 2:5 V = dual(tensor_power(stdV, k)) - W, h = isomorphic_module_with_simple_structure(V; check=false) + W, h = isomorphic_module_with_simple_structure(V) @test is_welldefined(h) @test is_isomorphism(h) @test W == tensor_power(dual(stdV), k) @@ -90,7 +90,7 @@ @testset "Direct sum: one summand" begin V = direct_sum(exterior_power(stdV, 2)) - W, h = isomorphic_module_with_simple_structure(V; check=false) + W, h = isomorphic_module_with_simple_structure(V) @test is_welldefined(h) @test is_isomorphism(h) @test W == exterior_power(stdV, 2) @@ -103,7 +103,7 @@ V3 = exterior_power(stdV, 2) for V2 in [exterior_power(stdV, dim(stdV) + 1)] V = direct_sum(V1, V2, V3) - W, h = isomorphic_module_with_simple_structure(V; check=false) + W, h = isomorphic_module_with_simple_structure(V) @test is_welldefined(h) @test is_isomorphism(h) @test W == direct_sum(V1, V3) @@ -116,7 +116,7 @@ @testset "Direct sum: nested" begin V = direct_sum(direct_sum(stdV, exterior_power(stdV, 2)), dual(stdV)) - W, h = isomorphic_module_with_simple_structure(V; check=false) + W, h = isomorphic_module_with_simple_structure(V) @test is_welldefined(h) @test is_isomorphism(h) @test W == direct_sum(stdV, exterior_power(stdV, 2), dual(stdV)) @@ -128,7 +128,7 @@ @testset "Tensor product: one factor" begin V = tensor_product(exterior_power(stdV, 2)) - W, h = isomorphic_module_with_simple_structure(V; check=false) + W, h = isomorphic_module_with_simple_structure(V) @test is_welldefined(h) @test is_isomorphism(h) @test W == exterior_power(stdV, 2) @@ -141,7 +141,7 @@ V3 = exterior_power(stdV, 2) for V2 in [tensor_power(stdV, 0), exterior_power(stdV, 0), symmetric_power(stdV, 0)] V = tensor_product(V1, V2, V3) - W, h = isomorphic_module_with_simple_structure(V; check=false) + W, h = isomorphic_module_with_simple_structure(V) @test is_welldefined(h) @test is_isomorphism(h) @test W == tensor_product(V1, V3) @@ -150,7 +150,7 @@ @testset "Tensor product: nested" begin V = tensor_product(tensor_product(stdV, exterior_power(stdV, 2)), dual(stdV)) - W, h = isomorphic_module_with_simple_structure(V; check=false) + W, h = isomorphic_module_with_simple_structure(V) @test is_welldefined(h) @test is_isomorphism(h) @test W == tensor_product(stdV, exterior_power(stdV, 2), dual(stdV)) @@ -162,7 +162,7 @@ @testset "Tensor product, direct sum" begin V = tensor_product(direct_sum(stdV, symmetric_power(stdV, 2)), direct_sum(dual(stdV), stdV)) - W, h = isomorphic_module_with_simple_structure(V; check=false) + W, h = isomorphic_module_with_simple_structure(V) @test is_welldefined(h) @test is_isomorphism(h) @test W == direct_sum( @@ -179,7 +179,7 @@ V5 = stdV V6 = symmetric_power(stdV, 2) V = tensor_product(V1, direct_sum(V2, V3, V4), direct_sum(V5, V6)) - W, h = isomorphic_module_with_simple_structure(V; check=false) + W, h = isomorphic_module_with_simple_structure(V) @test is_welldefined(h) @test is_isomorphism(h) @test W == direct_sum( @@ -195,7 +195,7 @@ @testset "Exterior power: 1st power" begin V1 = stdV V = exterior_power(V1, 1) - W, h = isomorphic_module_with_simple_structure(V; check=false) + W, h = isomorphic_module_with_simple_structure(V) @test is_welldefined(h) @test is_isomorphism(h) @test W == V1 @@ -206,7 +206,7 @@ V2 = dual(stdV) V3 = exterior_power(stdV, 2) V = exterior_power(direct_sum(V1, V2, V3), 3) - W, h = isomorphic_module_with_simple_structure(V; check=false) + W, h = isomorphic_module_with_simple_structure(V) @test is_welldefined(h) @test is_isomorphism(h) @test W == direct_sum( @@ -226,7 +226,7 @@ @testset "Symmetric power: 1st power" begin V1 = stdV V = symmetric_power(V1, 1) - W, h = isomorphic_module_with_simple_structure(V; check=false) + W, h = isomorphic_module_with_simple_structure(V) @test is_welldefined(h) @test is_isomorphism(h) @test W == V1 @@ -237,7 +237,7 @@ V2 = dual(stdV) V3 = exterior_power(stdV, 2) V = symmetric_power(direct_sum(V1, V2, V3), 3) - W, h = isomorphic_module_with_simple_structure(V; check=false) + W, h = isomorphic_module_with_simple_structure(V) @test is_welldefined(h) @test is_isomorphism(h) @test W == direct_sum( @@ -257,7 +257,7 @@ @testset "Tensor power: 1st power" begin V1 = stdV V = tensor_power(V1, 1) - W, h = isomorphic_module_with_simple_structure(V; check=false) + W, h = isomorphic_module_with_simple_structure(V) @test is_welldefined(h) @test is_isomorphism(h) @test W == V1 @@ -268,7 +268,7 @@ V2 = exterior_power(dual(stdV), 2) V3 = exterior_power(stdV, 2) V = tensor_power(direct_sum(V1, V2, V3), 3) - W, h = isomorphic_module_with_simple_structure(V; check=false) + W, h = isomorphic_module_with_simple_structure(V) # @test is_welldefined(h) # needs 3 minutes @test is_isomorphism(h) @test W == direct_sum( @@ -308,19 +308,19 @@ V3 = direct_sum(V1, V2) V_1 = exterior_power(V3, 1) - W_1, h = isomorphic_module_with_simple_structure(V_1; check=false) + W_1, h = isomorphic_module_with_simple_structure(V_1) @test is_welldefined(h) @test is_isomorphism(h) @test W_1 == V3 V_2 = exterior_power(V3, 2) - W_2, h = isomorphic_module_with_simple_structure(V_2; check=false) + W_2, h = isomorphic_module_with_simple_structure(V_2) @test is_welldefined(h) @test is_isomorphism(h) @test W_2 == direct_sum(exterior_power(V1, 2), tensor_product(V1, V2), exterior_power(V2, 2)) V_3 = exterior_power(V3, 3) - W_3, h = isomorphic_module_with_simple_structure(V_3; check=false) + W_3, h = isomorphic_module_with_simple_structure(V_3) @test is_welldefined(h) @test is_isomorphism(h) @test W_3 == direct_sum( @@ -332,7 +332,7 @@ # TODO: handle zero-dim modules (e.g. 4th exterior power of 3-dim module) V_4 = exterior_power(V3, 4) - W_4a, ha = isomorphic_module_with_simple_structure(V_4; check=false) + W_4a, ha = isomorphic_module_with_simple_structure(V_4) @test is_welldefined(ha) @test is_isomorphism(ha) W_4b, hb = isomorphic_module_with_simple_structure( @@ -342,8 +342,7 @@ tensor_product(exterior_power(V1, 2), exterior_power(V2, 2)), tensor_product(V1, exterior_power(V2, 3)), exterior_power(V2, 4), - ); - check=false, + ), ) @test is_welldefined(hb) @test is_isomorphism(hb) @@ -354,25 +353,25 @@ V1 = symmetric_power(stdV, 3) Ve2 = dual(exterior_power(dual(V1), 2)) - We2, h = isomorphic_module_with_simple_structure(Ve2; check=false) + We2, h = isomorphic_module_with_simple_structure(Ve2) @test is_welldefined(h) @test is_isomorphism(h) @test We2 == exterior_power(V1, 2) Ve3 = dual(exterior_power(dual(V1), 3)) - We3, h = isomorphic_module_with_simple_structure(Ve3; check=false) + We3, h = isomorphic_module_with_simple_structure(Ve3) @test is_welldefined(h) @test is_isomorphism(h) @test We3 == exterior_power(V1, 3) Vs2 = dual(symmetric_power(dual(V1), 2)) - Ws2, h = isomorphic_module_with_simple_structure(Vs2; check=false) + Ws2, h = isomorphic_module_with_simple_structure(Vs2) @test is_welldefined(h) @test is_isomorphism(h) @test Ws2 == symmetric_power(V1, 2) Vt2 = dual(tensor_power(dual(V1), 2)) - Wt2, h = isomorphic_module_with_simple_structure(Vt2; check=false) + Wt2, h = isomorphic_module_with_simple_structure(Vt2) @test is_welldefined(h) @test is_isomorphism(h) @test Wt2 == tensor_power(V1, 2) From 666a837e0a7ef0d16ed2f6a9d7a8c02c7427c16d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Fri, 13 Oct 2023 17:12:41 +0200 Subject: [PATCH 11/11] Adapt to new Oscar functionality --- src/ModuleSimpleStructure.jl | 48 ++++++++++++++---------------------- src/PBWDeformations.jl | 3 +++ 2 files changed, 22 insertions(+), 29 deletions(-) diff --git a/src/ModuleSimpleStructure.jl b/src/ModuleSimpleStructure.jl index 6c2e710..9e440e5 100644 --- a/src/ModuleSimpleStructure.jl +++ b/src/ModuleSimpleStructure.jl @@ -44,6 +44,8 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule) elseif is_direct_sum(V) Bs = base_modules(V) Cs_with_hom = [isomorphic_module_with_simple_structure(B) for B in Bs] + Csum = direct_sum([C for (C, _) in Cs_with_hom]...) + V_to_Csum = hom_direct_sum(V, Csum, [B_to_C for (_, B_to_C) in Cs_with_hom]) Ds = [] for (C, _) in Cs_with_hom if is_direct_sum(C) @@ -56,18 +58,17 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule) Ds = length(Ds_filtered) > 0 ? Ds_filtered : [Ds[1]] if length(Ds) == 1 W = Ds[1] - i = findfirst(C_with_hom -> C_with_hom[1] == W, Cs_with_hom) - B_to_W = Cs_with_hom[i][2] - h = hom(V, W, matrix(B_to_W); check=false) - return W, h else W = direct_sum(Ds...) - h = hom(V, W, diagonal_matrix([matrix(B_to_C) for (_, B_to_C) in Cs_with_hom]); check=false) - return W, h end + Csum_to_W = hom(Csum, W, identity_matrix(coefficient_ring(V), dim(Csum)); check=false) + V_to_W = compose(V_to_Csum, Csum_to_W) + return W, V_to_W elseif is_tensor_product(V) Bs = base_modules(V) Cs_with_hom = [isomorphic_module_with_simple_structure(B) for B in Bs] + Cprod = tensor_product([C for (C, _) in Cs_with_hom]...) + V_to_Cprod = hom_tensor(V, Cprod, [B_to_C for (_, B_to_C) in Cs_with_hom]) Ds = [] for (C, _) in Cs_with_hom if is_tensor_product(C) @@ -79,14 +80,16 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule) Ds_filtered = filter(D -> dim(D) != 1 || any(!iszero, D.transformation_matrices), Ds) Ds = length(Ds_filtered) > 0 ? Ds_filtered : [Ds[1]] if length(Ds) == 1 - W = Ds[1] - i = findfirst(C_with_hom -> C_with_hom[1] == W, Cs_with_hom) - B_to_W = Cs_with_hom[i][2] - h = hom(V, W, matrix(B_to_W); check=false) - return W, h + U = Ds[1] + else + U = tensor_product(Ds...) + end + Cprod_to_U = hom(Cprod, U, identity_matrix(coefficient_ring(V), dim(Cprod)); check=false) + V_to_U = compose(V_to_Cprod, Cprod_to_U) + + if length(Ds) == 1 + return U, V_to_U end - U = tensor_product(Ds...) - V_to_U = hom(V, U, reduce(kronecker_product, [matrix(B_to_C) for (_, B_to_C) in Cs_with_hom]); check=false) if all(!is_direct_sum, Ds) W = U U_to_W = identity_map(U) @@ -140,7 +143,7 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule) return U, V_to_U end U = exterior_power(C, k) - V_to_U = hom(V, U, elem_type(U)[U(B_to_C.(_basis_repres(V, i))) for i in 1:dim(V)]; check=false) + V_to_U = hom_power(V, U, B_to_C) if is_direct_sum(C) Ds = base_modules(C) m = length(Ds) @@ -200,7 +203,7 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule) return U, V_to_U end U = symmetric_power(C, k) - V_to_U = hom(V, U, elem_type(U)[U(B_to_C.(_basis_repres(V, i))) for i in 1:dim(V)]; check=false) + V_to_U = hom_power(V, U, B_to_C) if is_direct_sum(C) Ds = base_modules(C) m = length(Ds) @@ -260,7 +263,7 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule) return U, V_to_U end U = tensor_power(C, k) - V_to_U = hom(V, U, elem_type(U)[U(B_to_C.(_basis_repres(V, i))) for i in 1:dim(V)]; check=false) + V_to_U = hom_power(V, U, B_to_C) if is_direct_sum(C) Ds = base_modules(C) m = length(Ds) @@ -312,16 +315,3 @@ function isomorphic_module_with_simple_structure(V::LieAlgebraModule) end error("not implemented for this type of module") end - - -function _basis_repres(V::LieAlgebraModule, i::Int) - @req is_exterior_power(V) || is_symmetric_power(V) || is_tensor_power(V) "Not a power module." - inv_pure = if is_exterior_power(V) - get_attribute(V, :exterior_pure_preimage_function) - elseif is_symmetric_power(V) - get_attribute(V, :symmetric_pure_preimage_function) - elseif is_tensor_power(V) - get_attribute(V, :tensor_pure_preimage_function) - end - return inv_pure(basis(V, i)) -end diff --git a/src/PBWDeformations.jl b/src/PBWDeformations.jl index 5f2c026..62d1a41 100644 --- a/src/PBWDeformations.jl +++ b/src/PBWDeformations.jl @@ -18,6 +18,9 @@ using Oscar.LieAlgebras: exterior_power, general_linear_lie_algebra, highest_weight_module, + hom_direct_sum, + hom_power, + hom_tensor, is_exterior_power, is_standard_module, is_symmetric_power,