From 1217ab321f1f83588c0ea6c792ab163f6c801e38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Mon, 7 Oct 2024 12:14:22 +0200 Subject: [PATCH] Prefer symbols over strings as indeterminants (#4158) * Add "prefer symbols" paragraph to styleguide * Prefer symbols over strings in more non-trivial `polynomial_ring` calls Co-authored-by: Max Horn --- .../Schemes/AffineSchemes.md | 2 +- docs/src/DeveloperDocumentation/styleguide.md | 5 ++++ .../BasisLieHighestWeight/src/WeylPolytope.jl | 2 +- .../src/AbstractFTheoryModels/methods.jl | 2 +- .../src/HypersurfaceModels/constructors.jl | 8 +++---- .../src/HypersurfaceModels/methods.jl | 2 +- .../src/LiteratureModels/constructors.jl | 2 +- .../src/TateModels/constructors.jl | 8 +++---- .../FTheoryTools/src/TateModels/methods.jl | 2 +- .../src/WeierstrassModels/constructors.jl | 8 +++---- .../src/WeierstrassModels/methods.jl | 2 +- experimental/FTheoryTools/src/auxiliary.jl | 22 ++++++++--------- .../FTheoryTools/test/hypersurface_models.jl | 8 +++---- .../FTheoryTools/test/literature_models.jl | 2 +- experimental/GroebnerWalk/examples/ku10.jl | 2 +- .../examples/zero-dimensional/cyclic7.jl | 2 +- experimental/IntersectionTheory/src/Bott.jl | 4 ++-- experimental/IntersectionTheory/src/Main.jl | 2 +- experimental/LinearQuotients/src/cox_rings.jl | 4 ++-- .../LinearQuotients/src/linear_quotients.jl | 2 +- experimental/LinearQuotients/src/misc.jl | 2 +- .../Schemes/src/CoveredProjectiveSchemes.jl | 2 +- experimental/Schemes/src/CoveredScheme.jl | 14 +++++------ .../src/ToricIdealSheaves/constructors.jl | 6 ++--- experimental/Schemes/src/elliptic_surface.jl | 2 +- .../src/StandardFiniteFields.jl | 6 ++--- .../src/symmetric_grassmannians.jl | 2 +- .../Rings/Methods.jl | 2 +- .../AffineSchemes/Objects/Constructors.jl | 12 +++++----- .../Schemes/AffineSchemes/Objects/Methods.jl | 2 +- .../CoveredSchemes/Objects/Constructors.jl | 2 +- .../Schemes/CoveredSchemes/Objects/Methods.jl | 4 ++-- .../Schemes/Sheaves/CoherentSheaves.jl | 6 ++--- .../CohomologyClasses/special_attributes.jl | 2 +- src/Modules/deRhamComplexes.jl | 4 ++-- src/Modules/hilbert.jl | 2 +- src/Rings/FreeAssociativeAlgebraIdeal.jl | 4 ++-- src/Rings/Laurent.jl | 4 ++-- src/Rings/PBWAlgebra.jl | 24 +++++++++---------- src/Rings/ReesAlgebra.jl | 17 ++++++------- src/Rings/groebner.jl | 2 +- src/Rings/hilbert.jl | 2 +- src/Rings/mpoly-affine-algebras.jl | 10 ++++---- src/Rings/mpoly-graded.jl | 2 +- .../Schemes/BlowupMorphism.jl | 4 ++-- .../Schemes/CartierDivisor.jl | 2 +- .../Schemes/CoherentSheaves.jl | 6 ++--- .../Schemes/CoveredProjectiveSchemes.jl | 2 +- .../Schemes/CoveredScheme.jl | 4 ++-- .../Schemes/FunctionFields.jl | 4 ++-- test/AlgebraicGeometry/Schemes/K3.jl | 2 +- .../ToricVarieties/toric_schemes.jl | 4 ++-- test/Modules/MPolyQuo.jl | 2 +- test/Modules/UngradedModules.jl | 2 +- test/Rings/FreeAssociativeAlgebraIdeal.jl | 12 +++++----- test/Rings/PBWAlgebra.jl | 10 ++++---- test/Rings/hilbert.jl | 2 +- test/Rings/mpoly-graded.jl | 6 ++--- test/Rings/orderings.jl | 2 +- 59 files changed, 147 insertions(+), 143 deletions(-) diff --git a/docs/src/AlgebraicGeometry/Schemes/AffineSchemes.md b/docs/src/AlgebraicGeometry/Schemes/AffineSchemes.md index 46fe309f2d30..c5773afdfaa1 100644 --- a/docs/src/AlgebraicGeometry/Schemes/AffineSchemes.md +++ b/docs/src/AlgebraicGeometry/Schemes/AffineSchemes.md @@ -29,7 +29,7 @@ See [`inclusion_morphism(::AbsAffineScheme, ::AbsAffineScheme)`](@ref) for a way ### Affine n-space ```@docs -affine_space(kk::BRT, n::Int; variable_name="x") where {BRT<:Ring} +affine_space(kk::BRT, n::Int; variable_name=:x) where {BRT<:Ring} affine_space(kk::BRT, var_names::AbstractVector{<:VarName}) where {BRT<:Ring} ``` diff --git a/docs/src/DeveloperDocumentation/styleguide.md b/docs/src/DeveloperDocumentation/styleguide.md index e3c35f9e2046..e326f2639202 100644 --- a/docs/src/DeveloperDocumentation/styleguide.md +++ b/docs/src/DeveloperDocumentation/styleguide.md @@ -37,6 +37,11 @@ deviate from them in some cases; in that case just do so. matrices... - Input sanity checks should be enabled by default, they can then be disabled internally if they are known to be true, and manually by users. +- All user-facing functions that expect some kind of indeterminant name etc. + (like `polynomial_ring(QQ, )`) should accept a + `VarName = Union{Symbol, Char, String}`, and convert it to a symbol for internal + handling. Library and test code should (if possible) call such functions with + `Symbol` arguments, as this is the most efficient way. ## Naming conventions diff --git a/experimental/BasisLieHighestWeight/src/WeylPolytope.jl b/experimental/BasisLieHighestWeight/src/WeylPolytope.jl index 72e6b8cd8bf4..72cbeec859c2 100644 --- a/experimental/BasisLieHighestWeight/src/WeylPolytope.jl +++ b/experimental/BasisLieHighestWeight/src/WeylPolytope.jl @@ -116,7 +116,7 @@ function compute_zero_coordinates( zero_coordinates = Int[] for c in n:-1:1 length(non_zeros) == m && break - if !isempty(intersect(non_zeros, findall(!iszero, bir_sequence.weights_alpha[c]))) + if !isdisjoint(non_zeros, findall(!iszero, bir_sequence.weights_alpha[c])) union!(non_zeros, findall(<(0), bir_sequence.weights_w[c])) else push!(zero_coordinates, c) diff --git a/experimental/FTheoryTools/src/AbstractFTheoryModels/methods.jl b/experimental/FTheoryTools/src/AbstractFTheoryModels/methods.jl index 2292056795a2..2b101c2d04fa 100644 --- a/experimental/FTheoryTools/src/AbstractFTheoryModels/methods.jl +++ b/experimental/FTheoryTools/src/AbstractFTheoryModels/methods.jl @@ -334,7 +334,7 @@ function put_over_concrete_base(m::AbstractFTheoryModel, concrete_data::Dict{Str all_appearing_exponents = hcat([collect(exponents(m))[1] for m in all_appearing_monomials]...) for k in 1:nrows(all_appearing_exponents) if any(!is_zero, all_appearing_exponents[k,:]) - gen_name = string(gens(parent(polys[1]))[k]) + gen_name = string(symbols(parent(polys[1]))[k]) @req haskey(concrete_data, gen_name) "Required base section $gen_name not specified" @req parent(concrete_data[gen_name]) == cox_ring(concrete_data["base"]) "Specified sections must reside in Cox ring of given base" new_model_secs[gen_name] = concrete_data[gen_name] diff --git a/experimental/FTheoryTools/src/HypersurfaceModels/constructors.jl b/experimental/FTheoryTools/src/HypersurfaceModels/constructors.jl index c5406f1c07ff..0119de7519d6 100644 --- a/experimental/FTheoryTools/src/HypersurfaceModels/constructors.jl +++ b/experimental/FTheoryTools/src/HypersurfaceModels/constructors.jl @@ -53,9 +53,9 @@ end function hypersurface_model(base::NormalToricVariety, fiber_ambient_space::NormalToricVariety, fiber_twist_divisor_classes::Vector{ToricDivisorClass}, p::String; completeness_check::Bool = true) # Consistency checks - gens_base_names = [string(g) for g in gens(cox_ring(base))] - gens_fiber_names = [string(g) for g in gens(cox_ring(fiber_ambient_space))] - if intersect(Set(gens_base_names), Set(gens_fiber_names)) != Set() + gens_base_names = symbols(cox_ring(base)) + gens_fiber_names = symbols(cox_ring(fiber_ambient_space)) + if !isdisjoint(gens_base_names, gens_fiber_names) @vprint :FTheoryModelPrinter 0 "Variable names duplicated between base and fiber coordinates.\n" end if completeness_check @@ -183,7 +183,7 @@ function hypersurface_model(auxiliary_base_vars::Vector{String}, auxiliary_base_ # Conduct simple consistency checks @req d > 0 "The dimension of the base space must be positive" - @req intersect(set_base_vars, set_fiber_vars) == Set() "Variable names duplicated between base and fiber coordinates." + @req isdisjoint(set_base_vars, set_fiber_vars) "Variable names duplicated between base and fiber coordinates." @req union(set_base_vars, set_fiber_vars) == set_p_vars "Variables names for polynomial p do not match variable choice for base and fiber" @req ncols(auxiliary_base_grading) == length(auxiliary_base_vars) "Number of base variables does not match the number of provided base gradings" diff --git a/experimental/FTheoryTools/src/HypersurfaceModels/methods.jl b/experimental/FTheoryTools/src/HypersurfaceModels/methods.jl index 8682bb80b0eb..df398375c58a 100644 --- a/experimental/FTheoryTools/src/HypersurfaceModels/methods.jl +++ b/experimental/FTheoryTools/src/HypersurfaceModels/methods.jl @@ -120,7 +120,7 @@ function tune(h::HypersurfaceModel, input_sections::Dict{String, <:Any}; complet # 2. Compute the new hypersurface equation parametrized_hypersurface_equation = hypersurface_equation_parametrization(h) R = parent(parametrized_hypersurface_equation) - vars = [string(k) for k in gens(R)] + vars = [string(k) for k in symbols(R)] S = cox_ring(ambient_space(h)) images = [k in secs_names ? eval_poly(string(explicit_secs[k]), S) : k == "Kbar" ? eval_poly("0", S) : eval_poly(k, S) for k in vars] map = hom(R, S, images; check=false) diff --git a/experimental/FTheoryTools/src/LiteratureModels/constructors.jl b/experimental/FTheoryTools/src/LiteratureModels/constructors.jl index 894128eb6761..720a7704d60e 100644 --- a/experimental/FTheoryTools/src/LiteratureModels/constructors.jl +++ b/experimental/FTheoryTools/src/LiteratureModels/constructors.jl @@ -525,7 +525,7 @@ function _construct_literature_model_over_arbitrary_base(model_dict::Dict{String elseif model_dict["model_descriptors"]["type"] == "hypersurface" # Extract base variable names - auxiliary_base_vars = [string(g) for g in gens(auxiliary_base_ring)] + auxiliary_base_vars = [string(g) for g in symbols(auxiliary_base_ring)] # Extract fiber ambient space rays = [[a for a in b] for b in model_dict["model_data"]["fiber_ambient_space_rays"]] diff --git a/experimental/FTheoryTools/src/TateModels/constructors.jl b/experimental/FTheoryTools/src/TateModels/constructors.jl index a55df9c8541d..816d7495b9ce 100644 --- a/experimental/FTheoryTools/src/TateModels/constructors.jl +++ b/experimental/FTheoryTools/src/TateModels/constructors.jl @@ -61,8 +61,8 @@ function global_tate_model(base::NormalToricVariety, vs2 = collect(keys(defining_section_parametrization)) @req all(in(["a1", "a2", "a3", "a4", "a6"]), vs2) "Only the Tate sections a1, a2, a3, a4, a6 must be parametrized" - gens_base_names = [string(g) for g in gens(cox_ring(base))] - if ("x" in gens_base_names) || ("y" in gens_base_names) || ("z" in gens_base_names) + gens_base_names = symbols(cox_ring(base)) + if (:x in gens_base_names) || (:y in gens_base_names) || (:z in gens_base_names) @vprint :FTheoryModelPrinter 0 "Variable names duplicated between base and fiber coordinates.\n" end @@ -144,7 +144,7 @@ Global Tate model over a not fully specified base function global_tate_model(auxiliary_base_ring::MPolyRing, auxiliary_base_grading::Matrix{Int64}, d::Int, ais::Vector{T}) where {T<:MPolyRingElem} # Execute consistency checks - gens_base_names = [string(g) for g in gens(auxiliary_base_ring)] + gens_base_names = [string(g) for g in symbols(auxiliary_base_ring)] @req length(ais) == 5 "We expect exactly 5 Tate sections" @req all(k -> parent(k) == auxiliary_base_ring, ais) "All Tate sections must reside in the provided auxiliary base ring" @req d > 0 "The dimension of the base space must be positive" @@ -170,7 +170,7 @@ function global_tate_model(auxiliary_base_ring::MPolyRing, auxiliary_base_gradin # Compute defining_section_parametrization defining_section_parametrization = Dict{String, MPolyRingElem}() - vars_S = [string(k) for k in gens(S)] + vars_S = [string(k) for k in symbols(S)] if !("a1" in vars_S) || (a1 != eval_poly("a1", parent(a1))) defining_section_parametrization["a1"] = a1 end diff --git a/experimental/FTheoryTools/src/TateModels/methods.jl b/experimental/FTheoryTools/src/TateModels/methods.jl index 61d0ec189dbd..6afbf51cc8db 100644 --- a/experimental/FTheoryTools/src/TateModels/methods.jl +++ b/experimental/FTheoryTools/src/TateModels/methods.jl @@ -184,7 +184,7 @@ function tune(t::GlobalTateModel, input_sections::Dict{String, <:Any}; completen if !isempty(parametrization_keys) && !isempty(secs_names) R = parent(def_secs_param[parametrization_keys[1]]) S = parent(explicit_secs[secs_names[1]]) - vars = [string(k) for k in gens(R)] + vars = [string(k) for k in symbols(R)] images = [k in secs_names ? explicit_secs[k] : k == "Kbar" ? eval_poly("0", S) : eval_poly(k, S) for k in vars] map = hom(R, S, images) for section in tate_sections diff --git a/experimental/FTheoryTools/src/WeierstrassModels/constructors.jl b/experimental/FTheoryTools/src/WeierstrassModels/constructors.jl index c2f9087e6bcd..ba73a47455fd 100644 --- a/experimental/FTheoryTools/src/WeierstrassModels/constructors.jl +++ b/experimental/FTheoryTools/src/WeierstrassModels/constructors.jl @@ -55,8 +55,8 @@ function weierstrass_model(base::NormalToricVariety, vs2 = collect(keys(defining_section_parametrization)) @req all(in(("f", "g")), vs2) "Only the Weierstrass sections f, g must be parametrized" - gens_base_names = [string(g) for g in gens(cox_ring(base))] - if ("x" in gens_base_names) || ("y" in gens_base_names) || ("z" in gens_base_names) + gens_base_names = symbols(cox_ring(base)) + if (:x in gens_base_names) || (:y in gens_base_names) || (:z in gens_base_names) @vprint :FTheoryModelPrinter 0 "Variable names duplicated between base and fiber coordinates.\n" end @@ -125,7 +125,7 @@ Weierstrass model over a not fully specified base function weierstrass_model(auxiliary_base_ring::MPolyRing, auxiliary_base_grading::Matrix{Int64}, d::Int, weierstrass_f::MPolyRingElem, weierstrass_g::MPolyRingElem) # Execute consistency checks - gens_base_names = [string(g) for g in gens(auxiliary_base_ring)] + gens_base_names = [string(g) for g in symbols(auxiliary_base_ring)] @req ((parent(weierstrass_f) == auxiliary_base_ring) && (parent(weierstrass_g) == auxiliary_base_ring)) "All Weierstrass sections must reside in the provided auxiliary base ring" @req d > 0 "The dimension of the base space must be positive" if ("x" in gens_base_names) || ("y" in gens_base_names) || ("z" in gens_base_names) @@ -150,7 +150,7 @@ function weierstrass_model(auxiliary_base_ring::MPolyRing, auxiliary_base_gradin # Compute defining_section_parametrization defining_section_parametrization = Dict{String, MPolyRingElem}() - vars_S = [string(k) for k in gens(S)] + vars_S = [string(k) for k in symbols(S)] if !("f" in vars_S) || (f != eval_poly("f", parent(f))) defining_section_parametrization["f"] = f end diff --git a/experimental/FTheoryTools/src/WeierstrassModels/methods.jl b/experimental/FTheoryTools/src/WeierstrassModels/methods.jl index 508155a8f12e..62f1ccfe8940 100644 --- a/experimental/FTheoryTools/src/WeierstrassModels/methods.jl +++ b/experimental/FTheoryTools/src/WeierstrassModels/methods.jl @@ -107,7 +107,7 @@ function tune(w::WeierstrassModel, input_sections::Dict{String, <:Any}; complete if !isempty(parametrization_keys) && !isempty(secs_names) R = parent(def_secs_param[parametrization_keys[1]]) S = parent(explicit_secs[secs_names[1]]) - vars = [string(k) for k in gens(R)] + vars = [string(k) for k in symbols(R)] images = [k in secs_names ? explicit_secs[k] : k == "Kbar" ? eval_poly("0", S) : eval_poly(k, S) for k in vars] map = hom(R, S, images) for section in weierstrass_sections diff --git a/experimental/FTheoryTools/src/auxiliary.jl b/experimental/FTheoryTools/src/auxiliary.jl index 1dbcfa37e55c..2ef9f7b977a6 100644 --- a/experimental/FTheoryTools/src/auxiliary.jl +++ b/experimental/FTheoryTools/src/auxiliary.jl @@ -9,13 +9,13 @@ function _ambient_space(base::NormalToricVariety, fiber_amb_space::NormalToricVa b_rays = matrix(ZZ, rays(base)) b_cones = matrix(ZZ, ray_indices(maximal_cones(base))) b_grades = reduce(vcat, [elem.coeff for elem in cox_ring(base).d]) - b_var_names = [string(k) for k in gens(cox_ring(base))] + b_var_names = symbols(cox_ring(base)) # Extract information about the fiber ambient space f_rays = matrix(ZZ, rays(fiber_amb_space)) f_cones = matrix(ZZ, ray_indices(maximal_cones(fiber_amb_space))) f_grades = reduce(vcat, [elem.coeff for elem in cox_ring(fiber_amb_space).d]) - f_var_names = [string(k) for k in gens(cox_ring(fiber_amb_space))] + f_var_names = symbols(cox_ring(fiber_amb_space)) # Extract coefficients of divisors D1, D2 and compute u_matrix fiber_twist_divisor_classes_coeffs = [divisor_class(D).coeff for D in fiber_twist_divisor_classes] @@ -179,8 +179,8 @@ function _kodaira_type(id::MPolyIdeal{<:MPolyRingElem}, ords::Tuple{Int64, Int64 # Create new ring with auxiliary variable to construct the monodromy polynomial R = parent(f) - S, (_psi, ) = polynomial_ring(QQ, ["_psi"; [string(v) for v in gens(R)]], cached = false) - ring_map = hom(R, S, gens(S)[2:end]) + S, (_psi,), _old_gens = polynomial_ring(QQ, [:_psi], symbols(R); cached = false) + ring_map = hom(R, S, _old_gens) poly_f = ring_map(f) poly_g = ring_map(g) locus = ring_map(gens(id)[1]) @@ -206,17 +206,17 @@ function _kodaira_type(id::MPolyIdeal{<:MPolyRingElem}, ords::Tuple{Int64, Int64 # Get the grading matrix and the coordinates of the arbitrary base grading = weights(base_space(w)) - base_coords = gens(coordinate_ring(base_space(w))) - @req (length(base_coords) == length(grading[1, :])) "The number of columns in the weight matrix does not match the number of base cooordinates" + base_coords_symbols = symbols(coordinate_ring(base_space(w))) + @req (length(base_coords_symbols) == length(grading[1, :])) "The number of columns in the weight matrix does not match the number of base cooordinates" # Choose explicit sections for all parameters of the model, # and then put the model over the concrete base using these data - concrete_data = merge(Dict(string(base_coords[i]) => generic_section(KBar^grading[1, i] * prod(hyperplane_bundle^grading[j, i] for j in 2:length(grading[:, 1]))) for i in eachindex(base_coords)), Dict("base" => concrete_base)) + concrete_data = merge(Dict(string(base_coords_symbols[i]) => generic_section(KBar^grading[1, i] * prod(hyperplane_bundle^grading[j, i] for j in 2:length(grading[:, 1]))) for i in eachindex(base_coords_symbols)), Dict("base" => concrete_base)) w = put_over_concrete_base(w, concrete_data) # We also need to determine the gauge locus over the new base # by using the explicit forms of all of the sections chosen above - list_of_sections = [concrete_data[string(base_coords[i])] for i in eachindex(base_coords)] + list_of_sections = [concrete_data[string(base_coords_symbols[i])] for i in eachindex(base_coords_symbols)] id = ideal([evaluate(p, list_of_sections) for p in gens(id)]) end @@ -315,7 +315,7 @@ function _blowup_global(id::MPolyIdeal{QQMPolyRingElem}, center::MPolyIdeal{QQMP lin = ideal(map(hom(base_ring(lin), R, collect(1:ngens(R))), gens(lin))) # Create new base ring for the blown up ideal and a map between the rings - S, S_gens = polynomial_ring(QQ, [string("e_", index); [string("b_", index, "_", i) for i in 1:center_size]; [string(v) for v in gens(R)]], cached = false) + S, S_gens = polynomial_ring(QQ, [Symbol("e_", index); [Symbol("b_", index, "_", i) for i in 1:center_size]; symbols(R)], cached = false) (_e, new_coords...) = S_gens[1:center_size + 1] ring_map = hom(R, S, S_gens[center_size + 2:end]) @@ -471,7 +471,7 @@ function _strict_transform(bd::ToricBlowupMorphism, II::ToricIdealSheafFromCoxRi _e = gen(S, index_of_new_ray(bd)) images = MPolyRingElem[] g_list = gens(S) - g_center = [string(k) for k in gens(ideal_in_cox_ring(center_unnormalized(bd)))] + g_center = [string(k) for k in symbols(ideal_in_cox_ring(center_unnormalized(bd)))] for v in g_list v == _e && continue if string(v) in g_center @@ -490,7 +490,7 @@ end function _strict_transform(bd::ToricBlowupMorphism, tate_poly::MPolyRingElem) S = cox_ring(domain(bd)) _e = gen(S, index_of_new_ray(bd)) - g_list = string.(gens(S)) + g_list = string.(symbols(S)) g_center = [string(k) for k in gens(ideal_in_cox_ring(center_unnormalized(bd)))] position_of_center_variables = [findfirst(==(g), g_list) for g in g_center] pos_of_e = findfirst(==(string(_e)), g_list) diff --git a/experimental/FTheoryTools/test/hypersurface_models.jl b/experimental/FTheoryTools/test/hypersurface_models.jl index c693947af24e..ebb6d80d0076 100644 --- a/experimental/FTheoryTools/test/hypersurface_models.jl +++ b/experimental/FTheoryTools/test/hypersurface_models.jl @@ -16,7 +16,7 @@ h = hypersurface_model(B3, ambient_space_of_fiber, [D1, D2, D3], p; completeness @test dim(base_space(h)) == dim(B3) @test fiber_ambient_space(h) == ambient_space_of_fiber @test is_smooth(fiber_ambient_space(h)) == false - @test [string(g) for g in gens(cox_ring(fiber_ambient_space(h)))] == ["x", "y", "z"] + @test symbols(cox_ring(fiber_ambient_space(h))) == [:x, :y, :z] @test toric_variety(calabi_yau_hypersurface(h)) == ambient_space(h) @test is_base_space_fully_specified(h) == true end @@ -102,7 +102,7 @@ end @test dim(base_space(h3)) == 2 @test is_smooth(fiber_ambient_space(h3)) == false @test is_simplicial(fiber_ambient_space(h3)) == true - @test [string(g) for g in gens(cox_ring(fiber_ambient_space(h3)))] == ["u", "w", "v"] + @test symbols(cox_ring(fiber_ambient_space(h3))) == [:u, :w, :v] @test is_base_space_fully_specified(h3) == true @test is_partially_resolved(h3) == false end @@ -131,7 +131,7 @@ h4 = hypersurface_model(auxiliary_base_vars, auxiliary_base_grading, d, ambient_ @test fiber_ambient_space(h4) == ambient_space_of_fiber_2 @test is_smooth(fiber_ambient_space(h4)) == false @test is_simplicial(fiber_ambient_space(h4)) == true - @test [string(g) for g in gens(cox_ring(fiber_ambient_space(h4)))] == ["x", "y", "z"] + @test symbols(cox_ring(fiber_ambient_space(h4))) == [:x, :y, :z] @test is_base_space_fully_specified(h4) == false @test is_partially_resolved(h4) == false end @@ -148,7 +148,7 @@ h5 = literature_model(arxiv_id = "1208.2695", equation = "B.5") @test dim(base_space(h5)) == 2 @test is_smooth(fiber_ambient_space(h5)) == false @test is_simplicial(fiber_ambient_space(h5)) == true - @test [string(g) for g in gens(cox_ring(fiber_ambient_space(h5)))] == ["u", "w", "v"] + @test symbols(cox_ring(fiber_ambient_space(h5))) == [:u, :w, :v] @test is_base_space_fully_specified(h5) == false @test is_partially_resolved(h5) == false end diff --git a/experimental/FTheoryTools/test/literature_models.jl b/experimental/FTheoryTools/test/literature_models.jl index a3dd9c9b1793..e4e5a1b91284 100644 --- a/experimental/FTheoryTools/test/literature_models.jl +++ b/experimental/FTheoryTools/test/literature_models.jl @@ -363,7 +363,7 @@ h = literature_model(arxiv_id = "1507.05954", equation = "3.4") @test parent(hypersurface_equation(h)) == coordinate_ring(ambient_space(h)) @test dim(base_space(h)) == 2 @test is_smooth(fiber_ambient_space(h)) == true - @test [string(g) for g in gens(cox_ring(fiber_ambient_space(h)))] == ["u", "v", "w"] + @test symbols(cox_ring(fiber_ambient_space(h))) == [:u, :v, :w] @test is_base_space_fully_specified(h) == false @test is_partially_resolved(h) == false @test string.(zero_section(h)) == ["0", "-b1", "a1"] diff --git a/experimental/GroebnerWalk/examples/ku10.jl b/experimental/GroebnerWalk/examples/ku10.jl index 33b51b108e36..efa376c6275e 100644 --- a/experimental/GroebnerWalk/examples/ku10.jl +++ b/experimental/GroebnerWalk/examples/ku10.jl @@ -1,7 +1,7 @@ #ku using Oscar -R, (x1, x2, x3, x4, x5, x6, x7, x8, x9, x10) = polynomial_ring(QQ, ["x$index" for index in 1:10]) +R, (x1, x2, x3, x4, x5, x6, x7, x8, x9, x10) = polynomial_ring(QQ, "x#" => 1:10) I = ideal([ 5*x1*x2+ 5*x1+ 3*x2+ 55, diff --git a/experimental/GroebnerWalk/examples/zero-dimensional/cyclic7.jl b/experimental/GroebnerWalk/examples/zero-dimensional/cyclic7.jl index 8f134ec6017f..f61dffe79484 100644 --- a/experimental/GroebnerWalk/examples/zero-dimensional/cyclic7.jl +++ b/experimental/GroebnerWalk/examples/zero-dimensional/cyclic7.jl @@ -1,7 +1,7 @@ #cyclic7 using Oscar -R, (z0, z1, z2, z3, z4, z5, z6) = polynomial_ring(QQ, ["z$index" for index in 0:6 ]) +R, (z0, z1, z2, z3, z4, z5, z6) = polynomial_ring(QQ, "z#" => 0:6) I = ideal([ z0 + z1 + z2 + z3 + z4 + z5 + z6, diff --git a/experimental/IntersectionTheory/src/Bott.jl b/experimental/IntersectionTheory/src/Bott.jl index 5a07c7c08a6b..558330d4ba92 100644 --- a/experimental/IntersectionTheory/src/Bott.jl +++ b/experimental/IntersectionTheory/src/Bott.jl @@ -125,7 +125,7 @@ Base.show(io::IO, c::TnBundleChern) = print(io, "Chern class $(c.c) of $(c.F)") function _get_ring(F::TnBundle) if get_attribute(F, :R) === nothing r = min(F.parent.dim, F.rank) - R, _ = graded_polynomial_ring(QQ, _parse_symbol("c", 1:r), collect(1:r)) + R, _ = graded_polynomial_ring(QQ, :c => 1:r, collect(1:r)) set_attribute!(R, :abstract_variety_dim => F.parent.dim) set_attribute!(F, :R => R) end @@ -168,7 +168,7 @@ end # utility function that parses the weight specification function _parse_weight(n::Int, w) w == :int && return ZZ.(collect(1:n)) - w == :poly && return polynomial_ring(QQ, ["u$i" for i in 1:n])[2] + w == :poly && return polynomial_ring(QQ, "u#" => 1:n)[2] if (w isa AbstractUnitRange) w = collect(w) end w isa Vector && length(w) == n && return w error("incorrect specification for weights") diff --git a/experimental/IntersectionTheory/src/Main.jl b/experimental/IntersectionTheory/src/Main.jl index 300ced07acc0..64b0c7711b49 100644 --- a/experimental/IntersectionTheory/src/Main.jl +++ b/experimental/IntersectionTheory/src/Main.jl @@ -1295,7 +1295,7 @@ function schur_functor(F::AbstractBundle, λ::Partition) λ = conjugate(λ) X = F.parent w = _wedge(sum(λ), chern_character(F)) - S, ei = polynomial_ring(QQ, ["e$i" for i in 1:length(w)]) + S, ei = polynomial_ring(QQ, "e#" => 1:length(w)) e = i -> i < 0 ? S() : ei[i+1] M = [e(λ[i]-i+j) for i in 1:length(λ), j in 1:length(λ)] sch = det(matrix(S, M)) # Jacobi-Trudi diff --git a/experimental/LinearQuotients/src/cox_rings.jl b/experimental/LinearQuotients/src/cox_rings.jl index 0d096ec910c9..99aeafe962b6 100644 --- a/experimental/LinearQuotients/src/cox_rings.jl +++ b/experimental/LinearQuotients/src/cox_rings.jl @@ -457,7 +457,7 @@ function minimal_parts(I::MPolyIdeal, w::Vector{ZZRingElem}) @assert nvars(R) == length(w) w1 = push!(copy(w), ZZRingElem(-1)) - S, t = graded_polynomial_ring(K, ["t$i" for i in 1:(nvars(R) + 1)], w1) + S, t = graded_polynomial_ring(K, "t#" => 1:(nvars(R) + 1), w1) Ihom = homogenize_at_last_variable(I, S) @@ -487,7 +487,7 @@ function g_homogeneous_ideal(I::MPolyIdeal, weights::Vector{ZZRingElem}, order:: R = base_ring(I) w = push!(copy(weights), ZZRingElem(1)) - S, t = graded_polynomial_ring(coefficient_ring(R), ["t$i" for i in 1:(nvars(R) + 1)], w) + S, t = graded_polynomial_ring(coefficient_ring(R), "t#" => 1:(nvars(R) + 1), w) Ihom = homogenize_at_last_variable(I, S) diff --git a/experimental/LinearQuotients/src/linear_quotients.jl b/experimental/LinearQuotients/src/linear_quotients.jl index 7b706c3cec1f..61c7442a8efe 100644 --- a/experimental/LinearQuotients/src/linear_quotients.jl +++ b/experimental/LinearQuotients/src/linear_quotients.jl @@ -161,7 +161,7 @@ function weights_of_action( end to_eig = right_action(R, inv(V)) - S, t = graded_polynomial_ring(K, ["t$i" for i in 1:ngens(R)], weights) + S, t = graded_polynomial_ring(K, "t#" => 1:ngens(R), weights) # The images of the generators of R are in general not homogeneous in S, so # we have to turn of the check, if we want to build this map... RtoS = hom(R, S, [to_eig(x)(t...) for x in gens(R)]; check=false) diff --git a/experimental/LinearQuotients/src/misc.jl b/experimental/LinearQuotients/src/misc.jl index e4bd4cb94b19..1020aa69703b 100644 --- a/experimental/LinearQuotients/src/misc.jl +++ b/experimental/LinearQuotients/src/misc.jl @@ -125,7 +125,7 @@ function homogenize_at_last_variable(I::MPolyIdeal, S::MPolyDecRing) Rp = polynomial_ring(coefficient_ring(R), :t => 1:ngens(R))[1] RtoRp = hom(R, Rp, [gen(Rp, findfirst(isequal(i), p)) for i in 1:ngens(Rp)]) - Sp, _ = graded_polynomial_ring(coefficient_ring(S), ["t$i" for i in 1:ngens(S)], w_perm) + Sp, _ = graded_polynomial_ring(coefficient_ring(S), "t#" => 1:ngens(S), w_perm) SptoS = hom(Sp, S, [gens(S)[p[i]] for i in 1:ngens(S)]) # Homogenize the generators diff --git a/experimental/Schemes/src/CoveredProjectiveSchemes.jl b/experimental/Schemes/src/CoveredProjectiveSchemes.jl index 701aeca67b62..3936f4a2ca97 100644 --- a/experimental/Schemes/src/CoveredProjectiveSchemes.jl +++ b/experimental/Schemes/src/CoveredProjectiveSchemes.jl @@ -362,7 +362,7 @@ end # PW = projective_space(W, var_names) # PWC = affine_cone(PW) # prW = projection_to_base(PW) -# WA1, pW, pA = product(W, affine_space(base_ring(base_ring(OO(W))), 1, variable_name="t")) +# WA1, pW, pA = product(W, affine_space(base_ring(base_ring(OO(W))), 1, variable_name="t#")) # t = pullback(pA)(OO(codomain(pA))(base_ring(OO(codomain(pA)))[1])) # imgs = vcat((x->t*x).(pullback(pW).(gens(I))), pullback(pW).(gens(base_ring(OO(W))))) # inner_phi = hom(base_ring(OO(PWC)), OO(WA1), imgs) diff --git a/experimental/Schemes/src/CoveredScheme.jl b/experimental/Schemes/src/CoveredScheme.jl index 485526f14f61..427f15075511 100644 --- a/experimental/Schemes/src/CoveredScheme.jl +++ b/experimental/Schemes/src/CoveredScheme.jl @@ -115,8 +115,8 @@ function _generate_affine_charts(X::AbsProjectiveScheme{<:Ring, <:MPolyQuoRing}) r = relative_ambient_dimension(X) s = symbols(S) for i in 0:r - R, x = polynomial_ring(kk, [Symbol("("*String(s[k+1])*"//"*String(s[i+1])*")") for k in 0:r if k != i]) - phi = hom(S, R, vcat(gens(R)[1:i], [one(R)], gens(R)[i+1:r]), check=false) + R, gens_R = polynomial_ring(kk, [Symbol("(",s[k+1],"//",s[i+1],")") for k in 0:r if k != i]) + phi = hom(S, R, vcat(gens_R[1:i], [one(R)], gens_R[i+1:r]); check=false) I = ideal(R, phi.(gens(defining_ideal(X)))) if !isone(I) # return the non-empty charts only chart_dict[i+1] = spec(quo(R, I)[1]) @@ -133,7 +133,7 @@ function _generate_affine_charts(X::AbsProjectiveScheme{<:Ring, <:MPolyDecRing}) r = relative_ambient_dimension(X) s = symbols(S) for i in 0:r - R, x = polynomial_ring(kk, [Symbol("("*String(s[k+1])*"//"*String(s[i+1])*")") for k in 0:r if k != i]) + R, x = polynomial_ring(kk, [Symbol("(",s[k+1],"//",s[i+1],")") for k in 0:r if k != i]) chart_dict[i+1] = spec(R) end return chart_dict @@ -159,10 +159,10 @@ function _generate_affine_charts(X::AbsProjectiveScheme{<:CRT, <:MPolyQuoRing}) r = relative_ambient_dimension(X) for i in 0:r - R_fiber, x = polynomial_ring(kk, [Symbol("("*String(s[k+1])*"//"*String(s[i+1])*")") for k in 0:r if k != i]) + R_fiber, gens_R_fiber = polynomial_ring(kk, [Symbol("(",s[k+1],"//",s[i+1],")") for k in 0:r if k != i]) F = spec(R_fiber) ambient_space, pF, pY = product(F, Y) - fiber_vars = pullback(pF).(gens(R_fiber)) + fiber_vars = pullback(pF).(gens_R_fiber) mapped_polys = [map_coefficients(pullback(pY), f) for f in gens(defining_ideal(X))] patch = subscheme(ambient_space, elem_type(OO(ambient_space))[evaluate(f, vcat(fiber_vars[1:i], [one(OO(ambient_space))], fiber_vars[i+1:end])) for f in mapped_polys]) chart_dict[i+1] = patch @@ -184,10 +184,10 @@ function _generate_affine_charts(X::AbsProjectiveScheme{<:CRT, <:MPolyDecRing}) r = relative_ambient_dimension(X) for i in 0:r - R_fiber, x = polynomial_ring(kk, [Symbol("("*String(s[k+1])*"//"*String(s[i+1])*")") for k in 0:r if k != i]) + R_fiber, gens_R_fiber = polynomial_ring(kk, [Symbol("(",s[k+1],"//",s[i+1],")") for k in 0:r if k != i]) F = spec(R_fiber) ambient_space, pF, pY = product(F, Y) - fiber_vars = pullback(pF).(gens(R_fiber)) + fiber_vars = pullback(pF).(gens_R_fiber) chart_dict[i+1] = ambient_space pU[ambient_space] = pY end diff --git a/experimental/Schemes/src/ToricIdealSheaves/constructors.jl b/experimental/Schemes/src/ToricIdealSheaves/constructors.jl index 849af729991d..1ec64f7a4d15 100644 --- a/experimental/Schemes/src/ToricIdealSheaves/constructors.jl +++ b/experimental/Schemes/src/ToricIdealSheaves/constructors.jl @@ -102,7 +102,7 @@ function IdealSheaf(X::NormalToricVarietyType, I::MPolyIdeal) # We first create the morphism \pi_s* from p. 224, l. 3. indices = [k for k in row(IM, k)] - help_ring, x_rho = polynomial_ring(QQ, ["x_$j" for j in indices]) + help_ring, x_rho = polynomial_ring(QQ, "x#" => indices) imgs_phi_star = [j in indices ? x_rho[findfirst(==(j), indices)] : one(help_ring) for j in 1:n_rays(X)] phi_s_star = hom(cox_ring(X), help_ring, imgs_phi_star; check=false) @@ -205,7 +205,7 @@ function _dehomogenize_to_chart(X::NormalToricVarietyType, I::MPolyIdeal, k::Int # # We first create the morphism \pi_s* from p. 224, l. 3. # indices = [k for k in row(IM, k)] -# help_ring, x_rho = polynomial_ring(QQ, ["x_$j" for j in indices]) +# help_ring, x_rho = polynomial_ring(QQ, "x#" => indices) # imgs_phi_star = [j in indices ? x_rho[findfirst(==(j), indices)] : one(help_ring) for j in 1:n_rays(X)] # phi_s_star = hom(cox_ring(X), help_ring, imgs_phi_star; check=false) # @@ -243,7 +243,7 @@ function _dehomogenize_to_chart(X::NormalToricVarietyType, I::MPolyIdeal, k::Int # Assemble the dehomogenization map phi_sigma^star. indices = [k for k in row(IM, k)] - help_ring, x_rho = polynomial_ring(QQ, ["x_$j" for j in indices]) + help_ring, x_rho = polynomial_ring(QQ, "x#" => indices) imgs_phi_star = [j in indices ? x_rho[findfirst(==(j), indices)] : one(help_ring) for j in 1:n_rays(X)] phi_s_star = hom(S_loc, help_ring, imgs_phi_star; check=false) diff --git a/experimental/Schemes/src/elliptic_surface.jl b/experimental/Schemes/src/elliptic_surface.jl index e9144342748c..d8eeacad7164 100644 --- a/experimental/Schemes/src/elliptic_surface.jl +++ b/experimental/Schemes/src/elliptic_surface.jl @@ -434,7 +434,7 @@ function weierstrass_model(X::EllipticSurface) bundleE = direct_sum([O0, O4, O6]) - P_proj = projectivization(bundleE, var_names=["z", "x", "y"]) + P_proj = projectivization(bundleE, var_names=[:z, :x, :y]) P = covered_scheme(P_proj) pr = covered_projection_to_base(P_proj) @assert has_decomposition_info(default_covering(P)) diff --git a/experimental/StandardFiniteFields/src/StandardFiniteFields.jl b/experimental/StandardFiniteFields/src/StandardFiniteFields.jl index a11dddbbb44b..cac2d7d7fb8f 100644 --- a/experimental/StandardFiniteFields/src/StandardFiniteFields.jl +++ b/experimental/StandardFiniteFields/src/StandardFiniteFields.jl @@ -348,8 +348,7 @@ function _extension_with_tower_basis( end push!(lcoeffs, one(K)) pmat = identity_matrix(K, Int(deg)) - vname = "x" * string(deg) - L, X = Native.finite_field(polynomial(K, lcoeffs), vname) + L, X = Native.finite_field(polynomial(K, lcoeffs), Symbol(:x, deg)) set_standard_finite_field!(L) set_primitive_powers_in_tower_basis!(L, pmat) @@ -439,8 +438,7 @@ function _extension_with_tower_basis( # Now p is the minimal polynomial over F # pmat gives the primitive powers in the tower basis for the new extension - vname = "x" * string(d) - L, X = Native.finite_field(polynomial(F, poly), vname) + L, X = Native.finite_field(polynomial(F, poly), Symbol(:x, d)) set_standard_finite_field!(L) set_primitive_powers_in_tower_basis!(L, pmat) diff --git a/experimental/SymmetricIntersections/src/symmetric_grassmannians.jl b/experimental/SymmetricIntersections/src/symmetric_grassmannians.jl index fa6801644e25..e9d1ed41f0af 100644 --- a/experimental/SymmetricIntersections/src/symmetric_grassmannians.jl +++ b/experimental/SymmetricIntersections/src/symmetric_grassmannians.jl @@ -92,7 +92,7 @@ function defining_ideal(M::IsotGrass) return defining_ideal(projective_space(F, binomial(n, t)-1)) end t = cd[1] - S, _ = graded_polynomial_ring(F, String["x[$j]" for j in 0:binomial(n, t)-1]) + S, _ = graded_polynomial_ring(F, :x => 0:binomial(n, t)-1) return grassmann_pluecker_ideal(S, t, n) end diff --git a/src/AlgebraicGeometry/Schemes/AffineSchemeOpenSubscheme/Rings/Methods.jl b/src/AlgebraicGeometry/Schemes/AffineSchemeOpenSubscheme/Rings/Methods.jl index 1419c4e2f157..79e6723f1840 100644 --- a/src/AlgebraicGeometry/Schemes/AffineSchemeOpenSubscheme/Rings/Methods.jl +++ b/src/AlgebraicGeometry/Schemes/AffineSchemeOpenSubscheme/Rings/Methods.jl @@ -244,7 +244,7 @@ function restriction_map( # the terms accordingly, we derive the desired expressions for the cᵢ's. #W = localized_ring(OO(Y)) W = OO(Y) - S, t = polynomial_ring(W, ["t$i" for i in 1:r]; cached=false) + S, t = polynomial_ring(W, "t#" => 1:r; cached=false) ta = length(a) == 0 ? zero(S) : sum([t*a for (t, a) in zip(t, a)]) function mysecondmap(f::AffineSchemeOpenSubschemeRingElem) sep = [pull_from_denominator(f[i], d[i]) for i in 1:r] diff --git a/src/AlgebraicGeometry/Schemes/AffineSchemes/Objects/Constructors.jl b/src/AlgebraicGeometry/Schemes/AffineSchemes/Objects/Constructors.jl index 8562eda637bd..5bf06e145ae9 100644 --- a/src/AlgebraicGeometry/Schemes/AffineSchemes/Objects/Constructors.jl +++ b/src/AlgebraicGeometry/Schemes/AffineSchemes/Objects/Constructors.jl @@ -156,7 +156,7 @@ Base.deepcopy_internal(X::AffineScheme, dict::IdDict) = AffineScheme(deepcopy_in ######################################################## @doc raw""" - affine_space(kk::BRT, n::Int; variable_name="x") where {BRT<:Ring} + affine_space(kk::BRT, n::Int; variable_name::VarName="x#") where {BRT<:Ring} The ``n``-dimensional affine space over a ring ``kk`` is created by this method. By default, the variable names are chosen as `x1`, `x2` @@ -169,14 +169,14 @@ Affine space of dimension 5 over rational field with coordinates [x1, x2, x3, x4, x5] -julia> affine_space(QQ,5,variable_name="y") +julia> affine_space(QQ,5,variable_name="y#") Affine space of dimension 5 over rational field with coordinates [y1, y2, y3, y4, y5] ``` """ -function affine_space(kk::BRT, n::Int; variable_name="x") where {BRT<:Ring} - R, _ = polynomial_ring(kk, [variable_name * "$i" for i in 1:n]; cached=false) +function affine_space(kk::BRT, n::Int; variable_name::VarName="x#") where {BRT<:Ring} + R, _ = polynomial_ring(kk, variable_name => 1:n; cached=false) return spec(R) end @@ -211,8 +211,8 @@ function affine_space(kk::BRT, var_names::AbstractVector{<:VarName}) where {BRT< return spec(R) end -function affine_space(kk::BRT, n::Int; variable_name="x") where {BRT<:Field} - R, _ = polynomial_ring(kk, [variable_name * "$i" for i in 1:n]; cached=false) +function affine_space(kk::BRT, n::Int; variable_name::VarName="x#") where {BRT<:Field} + R, _ = polynomial_ring(kk, variable_name => 1:n; cached=false) return variety(spec(R), check=false) end diff --git a/src/AlgebraicGeometry/Schemes/AffineSchemes/Objects/Methods.jl b/src/AlgebraicGeometry/Schemes/AffineSchemes/Objects/Methods.jl index 9aa319b4510f..724c56802dcf 100644 --- a/src/AlgebraicGeometry/Schemes/AffineSchemes/Objects/Methods.jl +++ b/src/AlgebraicGeometry/Schemes/AffineSchemes/Objects/Methods.jl @@ -187,7 +187,7 @@ Returns whether the scheme ``X`` is normal. # Examples ```jldoctest -julia> R, (x, y, z) = rational_field()["x", "y", "z"]; +julia> R, (x, y, z) = QQ[:x, :y, :z]; julia> X = spec(R); diff --git a/src/AlgebraicGeometry/Schemes/CoveredSchemes/Objects/Constructors.jl b/src/AlgebraicGeometry/Schemes/CoveredSchemes/Objects/Constructors.jl index 6a766f546fe4..113ccd7eb5bb 100644 --- a/src/AlgebraicGeometry/Schemes/CoveredSchemes/Objects/Constructors.jl +++ b/src/AlgebraicGeometry/Schemes/CoveredSchemes/Objects/Constructors.jl @@ -85,7 +85,7 @@ X_i \to X``, where ``X`` is the disjoint union of the covered schemes # Examples ```jldoctest -julia> R_1, (x, y, z) = grade(rational_field()["x", "y", "z"][1]); +julia> R_1, (x, y, z) = graded_polynomial_ring(QQ, [:x, :y, :z]); julia> I_1 = ideal(R_1, z*x^2 + y^3); diff --git a/src/AlgebraicGeometry/Schemes/CoveredSchemes/Objects/Methods.jl b/src/AlgebraicGeometry/Schemes/CoveredSchemes/Objects/Methods.jl index 49c8ed6d18c3..ccf4b01222d3 100644 --- a/src/AlgebraicGeometry/Schemes/CoveredSchemes/Objects/Methods.jl +++ b/src/AlgebraicGeometry/Schemes/CoveredSchemes/Objects/Methods.jl @@ -168,7 +168,7 @@ Returns whether the scheme ``X`` is normal. # Examples ```jldoctest -julia> R, (x, y, z) = rational_field()["x", "y", "z"]; +julia> R, (x, y, z) = QQ[:x, :y, :z]; julia> X = covered_scheme(spec(R)); @@ -204,7 +204,7 @@ of non-integral schemes. # Examples ```jldoctest -julia> R, (x, y, z) = grade(rational_field()["x", "y", "z"][1]); +julia> R, (x, y, z) = graded_polynomial_ring(QQ, [:x, :y, :z]); julia> I = ideal(R, z*x^2 + y^3); diff --git a/src/AlgebraicGeometry/Schemes/Sheaves/CoherentSheaves.jl b/src/AlgebraicGeometry/Schemes/Sheaves/CoherentSheaves.jl index ba41a41b91b6..7d545157679a 100644 --- a/src/AlgebraicGeometry/Schemes/Sheaves/CoherentSheaves.jl +++ b/src/AlgebraicGeometry/Schemes/Sheaves/CoherentSheaves.jl @@ -1031,7 +1031,7 @@ rings can be provided with `var_names`. can be computed. The check for this can be turned off by setting `check=false`. """ function projectivization(E::AbsCoherentSheaf; - var_names::Vector{String}=Vector{String}(), + var_names::Vector{<:VarName}=Vector{Symbol}(), check::Bool=true ) X = scheme(E) @@ -1049,7 +1049,7 @@ function projectivization(E::AbsCoherentSheaf; F isa FreeMod || error("modules must locally be free") r = (rank(F) > r ? rank(F) : r) end - var_names = ["s$i" for i in 0:r-1] + var_names = [Symbol(:s, i) for i in 0:r-1] end for U in patches(C) @@ -1057,7 +1057,7 @@ function projectivization(E::AbsCoherentSheaf; F isa FreeMod || error("modules must locally be free") r = rank(F) length(var_names) >= r || error("number of names for the variables must greater or equal to the local rank of the module") - RU = rees_algebra(E(U), var_names=var_names[1:r]) + RU = rees_algebra(E(U); var_names=var_names[1:r]) algebras[U] = RU SU, _ = grade(RU) PU = proj(SU) diff --git a/src/AlgebraicGeometry/ToricVarieties/CohomologyClasses/special_attributes.jl b/src/AlgebraicGeometry/ToricVarieties/CohomologyClasses/special_attributes.jl index 162a20883f88..605ecfecc967 100644 --- a/src/AlgebraicGeometry/ToricVarieties/CohomologyClasses/special_attributes.jl +++ b/src/AlgebraicGeometry/ToricVarieties/CohomologyClasses/special_attributes.jl @@ -63,7 +63,7 @@ end generators = [cohomology_class(d) for d in torusinvariant_prime_divisors(v)] # find combinations of those classes that we have to integrate - S, _ = graded_polynomial_ring(QQ, ["g$i" for i in 1:length(generators)]; cached=false) + S, _ = graded_polynomial_ring(QQ, "g#" => 1:length(generators); cached=false) hc = homogeneous_component(S, [dim(v)]) monoms = [hc[2](x) for x in gens(hc[1])] combinations = reduce(vcat, [[[ZZRingElem(l) for l in k] for k in AbstractAlgebra.exponent_vectors(m)] for m in monoms]) diff --git a/src/Modules/deRhamComplexes.jl b/src/Modules/deRhamComplexes.jl index ebd8475b38e5..ef8420405992 100644 --- a/src/Modules/deRhamComplexes.jl +++ b/src/Modules/deRhamComplexes.jl @@ -15,7 +15,7 @@ function kaehler_differentials(R::Union{MPolyRing, MPolyLocRing}; cached::Bool=t n = ngens(R) result = FreeMod(R, n) symb = symbols(R) - result.S = [Symbol("d"*String(symb[i])) for i in 1:n] + result.S = [Symbol(:d, symb[i]) for i in 1:n] set_attribute!(result, :show, show_kaehler_differentials) cached && (_kaehler_differentials(R)[1] = result) @@ -30,7 +30,7 @@ function kaehler_differentials(R::MPolyDecRing; cached::Bool=true) n = ngens(R) result = graded_free_module(R, [1 for i in 1:n]) symb = symbols(R) - result.S = [Symbol("d"*String(symb[i])) for i in 1:n] + result.S = [Symbol(:d, symb[i]) for i in 1:n] set_attribute!(result, :show, show_kaehler_differentials) cached && (_kaehler_differentials(R)[1] = result) diff --git a/src/Modules/hilbert.jl b/src/Modules/hilbert.jl index 11f10745c52e..1fefdc218087 100644 --- a/src/Modules/hilbert.jl +++ b/src/Modules/hilbert.jl @@ -198,7 +198,7 @@ function multi_hilbert_series_parent(S::MPolyDecRing) if !isdefined(S, :multi_hilbert_series_parent) G = grading_group(S) m = ngens(G) - S.multi_hilbert_series_parent = laurent_polynomial_ring(ZZ, (isone(m) ? [:t] : [Symbol("t[$i]") for i in 1:m]); cached=false)[1] + S.multi_hilbert_series_parent = laurent_polynomial_ring(ZZ, (isone(m) ? [:t] : (:t => 1:m)); cached=false)[1] end return S.multi_hilbert_series_parent end diff --git a/src/Rings/FreeAssociativeAlgebraIdeal.jl b/src/Rings/FreeAssociativeAlgebraIdeal.jl index 3235790d065b..3547db25a148 100644 --- a/src/Rings/FreeAssociativeAlgebraIdeal.jl +++ b/src/Rings/FreeAssociativeAlgebraIdeal.jl @@ -99,7 +99,7 @@ Otherwise, returning `false` indicates an inconclusive answer, but larger `deg_b If `deg_bound` is not specified, the default value is `-1`, which means that no degree bound is imposed, resulting in a calculation using a much slower algorithm that may not terminate, but will return a full Groebner basis if it does. ```jldoctest -julia> free, (x,y,z) = free_associative_algebra(QQ, ["x", "y", "z"]); +julia> free, (x,y,z) = free_associative_algebra(QQ, [:x, :y, :z]); julia> f1 = x*y + y*z; @@ -163,7 +163,7 @@ The default value of `deg_bound` is `-1`, which means that no degree bound is imposed, resulting in a computation that is usually slower, but will return a full Groebner basis if there exists a finite one. ```jldoctest -julia> free, (x,y,z) = free_associative_algebra(QQ, ["x", "y", "z"]); +julia> free, (x,y,z) = free_associative_algebra(QQ, [:x, :y, :z]); julia> f1 = x*y + y*z; diff --git a/src/Rings/Laurent.jl b/src/Rings/Laurent.jl index 9de1761eb9f1..ab97dd3f7326 100644 --- a/src/Rings/Laurent.jl +++ b/src/Rings/Laurent.jl @@ -61,8 +61,8 @@ function _polyringquo(R::LaurentMPolyWrapRing) get_attribute!(R, :polyring) do n = nvars(R) C = base_ring(R) - Cx, x = polynomial_ring(C, append!(["x$i" for i in 1:n], ["x$i^-1" for i in 1:n]); cached = false) - I = ideal(Cx, [x[i]*x[i + n] - 1 for i in 1:n]) + Cx, x, xinv = polynomial_ring(C,"x#" => 1:n, "x#^-1" => 1:n; cached = false) + I = ideal(Cx, [x[i]*xinv[i] - 1 for i in 1:n]) Q, = quo(Cx, I) return _LaurentMPolyBackend(R, Q) end::_LaurentMPolyBackend # TODO: make the type fully concrete diff --git a/src/Rings/PBWAlgebra.jl b/src/Rings/PBWAlgebra.jl index 40fbdc7ad051..515989d88413 100644 --- a/src/Rings/PBWAlgebra.jl +++ b/src/Rings/PBWAlgebra.jl @@ -499,7 +499,7 @@ The generators of the returned algebra print according to the entries of `xs`. S # Examples ```jldoctest -julia> D, (x, y, dx, dy) = weyl_algebra(QQ, ["x", "y"]) +julia> D, (x, y, dx, dy) = weyl_algebra(QQ, [:x, :y]) (Weyl-algebra over Rational field in variables (x, y), PBWAlgElem{QQFieldElem, Singular.n_Q}[x, y, dx, dy]) julia> dx*x @@ -548,7 +548,7 @@ Return the opposite algebra of `A`. # Examples ```jldoctest -julia> D, (x, y, dx, dy) = weyl_algebra(QQ, ["x", "y"]) +julia> D, (x, y, dx, dy) = weyl_algebra(QQ, [:x, :y]) (Weyl-algebra over Rational field in variables (x, y), PBWAlgElem{QQFieldElem, Singular.n_Q}[x, y, dx, dy]) julia> Dop, opp = opposite_algebra(D); @@ -743,7 +743,7 @@ Return `true` if `I` is the zero ideal, `false` otherwise. # Examples ```jldoctest -julia> D, (x, y, dx, dy) = weyl_algebra(QQ, ["x", "y"]) +julia> D, (x, y, dx, dy) = weyl_algebra(QQ, [:x, :y]) (Weyl-algebra over Rational field in variables (x, y), PBWAlgElem{QQFieldElem, Singular.n_Q}[x, y, dx, dy]) julia> I = left_ideal(D, [x, dx]) @@ -773,7 +773,7 @@ Return `true` if `I` is generated by `1`, `false` otherwise. # Examples ```jldoctest -julia> D, (x, y, dx, dy) = weyl_algebra(QQ, ["x", "y"]) +julia> D, (x, y, dx, dy) = weyl_algebra(QQ, [:x, :y]) (Weyl-algebra over Rational field in variables (x, y), PBWAlgElem{QQFieldElem, Singular.n_Q}[x, y, dx, dy]) julia> I = left_ideal(D, [x, dx]) @@ -796,7 +796,7 @@ true ``` ```jldoctest -julia> D, (x, y, dx, dy) = weyl_algebra(GF(3), ["x", "y"]); +julia> D, (x, y, dx, dy) = weyl_algebra(GF(3), [:x, :y]); julia> I = two_sided_ideal(D, [x^3]) two_sided_ideal(x^3) @@ -860,7 +860,7 @@ or `I` and `J` are a left and a right ideal, respectively, return the product of # Examples ```jldoctest -julia> D, (x, y, dx, dy) = weyl_algebra(GF(3), ["x", "y"]); +julia> D, (x, y, dx, dy) = weyl_algebra(GF(3), [:x, :y]); julia> I = left_ideal(D, [x^3+y^3, x*y^2]) left_ideal(x^3 + y^3, x*y^2) @@ -886,7 +886,7 @@ Given a two_sided ideal `I`, return the `k`-th power of `I`. # Examples ```jldoctest -julia> D, (x, dx) = weyl_algebra(GF(3), ["x"]); +julia> D, (x, dx) = weyl_algebra(GF(3), [:x]); julia> I = two_sided_ideal(D, [x^3]) two_sided_ideal(x^3) @@ -925,7 +925,7 @@ Return the intersection of two or more ideals. # Examples ```jldoctest -julia> D, (x, y, dx, dy) = weyl_algebra(QQ, ["x", "y"]); +julia> D, (x, y, dx, dy) = weyl_algebra(QQ, [:x, :y]); julia> I = intersect(left_ideal(D, [x^2, x*dy, dy^2])+left_ideal(D, [dx]), left_ideal(D, [dy^2-x^3+x])) left_ideal(-x^3 + dy^2 + x) @@ -972,7 +972,7 @@ Return `true` if `f` is contained in `I`, `false` otherwise. Alternatively, use # Examples ```jldoctest -julia> D, (x, dx) = weyl_algebra(QQ, ["x"]); +julia> D, (x, dx) = weyl_algebra(QQ, [:x]); julia> I = left_ideal(D, [x*dx^4, x^3*dx^2]) left_ideal(x*dx^4, x^3*dx^2) @@ -982,7 +982,7 @@ true ``` ```jldoctest -julia> D, (x, y, dx, dy) = weyl_algebra(QQ, ["x", "y"]); +julia> D, (x, y, dx, dy) = weyl_algebra(QQ, [:x, :y]); julia> I = two_sided_ideal(D, [x, dx]) two_sided_ideal(x, dx) @@ -1017,7 +1017,7 @@ end Return `true` if `I` is contained in `J`, `false` otherwise. # Examples ```jldoctest -julia> D, (x, dx) = weyl_algebra(QQ, ["x"]); +julia> D, (x, dx) = weyl_algebra(QQ, [:x]); julia> I = left_ideal(D, [dx^2]) left_ideal(dx^2) @@ -1052,7 +1052,7 @@ Return `true` if `I` is equal to `J`, `false` otherwise. # Examples ```jldoctest -julia> D, (x, dx) = weyl_algebra(QQ, ["x"]); +julia> D, (x, dx) = weyl_algebra(QQ, [:x]); julia> I = left_ideal(D, [dx^2]) left_ideal(dx^2) diff --git a/src/Rings/ReesAlgebra.jl b/src/Rings/ReesAlgebra.jl index 459f0f5c665d..c9c1952b45de 100644 --- a/src/Rings/ReesAlgebra.jl +++ b/src/Rings/ReesAlgebra.jl @@ -13,9 +13,9 @@ module ``F`` this computes the Rees algebra of ``M`` according to [EHU03](@cite)[^2]. !!! note If `check` is set to `true`, the method will check the sufficient -criterion "``fᵀ : F* → M*`` surjective" to verify that ``f`` is versal. -Since no general criterion is known, this will abort with an error message -in the non-affirmative case. + criterion "``fᵀ : F* → M*`` surjective" to verify that ``f`` is versal. + Since no general criterion is known, this will abort with an error message + in the non-affirmative case. [^1]: A morphism of ``M`` into a free module ``F`` as above is called versal if any other morphism ``g : M → F'`` from ``M`` to another free module ``F'`` factors through ``f``. @@ -23,7 +23,7 @@ in the non-affirmative case. """ function rees_algebra(f::ModuleFPHom{<:ModuleFP, <:FreeMod, Nothing}; check::Bool=true, - var_names::Vector{String}=["s$i" for i in 0:ngens(domain(f))-1] + var_names::Vector{<:VarName}=[Symbol(:s, i) for i in 0:ngens(domain(f))-1] ) if check f_dual = dual(f) @@ -40,7 +40,7 @@ function rees_algebra(f::ModuleFPHom{<:ModuleFP, <:FreeMod, Nothing}; r = rank(FM) r == length(var_names) || error("wrong number of variable names given") sym_FM, s = polynomial_ring(R, Symbol.(var_names); cached = false) - sym_F, t = polynomial_ring(R, [Symbol("t$i") for i in 1:rank(F)]; cached = false) + sym_F, t = polynomial_ring(R, "t#" => 1:rank(F); cached = false) imgs = Vector{elem_type(sym_F)}() for v in gens(FM) w = coordinates(f(p(v))) @@ -53,7 +53,8 @@ function rees_algebra(f::ModuleFPHom{<:ModuleFP, <:FreeMod, Nothing}; end function rees_algebra(M::FreeMod; - var_names::Vector{String}=["s$i" for i in 0:ngens(M)-1] + check::Bool=true, + var_names::Vector{<:VarName}=[Symbol(:s, i) for i in 0:ngens(M)-1] ) R = base_ring(M) r = rank(M) @@ -62,8 +63,8 @@ function rees_algebra(M::FreeMod; end function rees_algebra(M::SubquoModule; - var_names::Vector{String}=["s$i" for i in 0:ngens(M)-1], - check::Bool=true + check::Bool=true, + var_names::Vector{<:VarName}=[Symbol(:s, i) for i in 0:ngens(M)-1] ) success, p, sigma = is_projective(M) if success diff --git a/src/Rings/groebner.jl b/src/Rings/groebner.jl index 9c10ffad1699..3d4bb0027e25 100644 --- a/src/Rings/groebner.jl +++ b/src/Rings/groebner.jl @@ -1312,7 +1312,7 @@ with respect to the ordering function _fglm(G::IdealGens, ordering::MonomialOrdering) (G.isGB == true && G.isReduced == true) || error("Input must be a reduced Gröbner basis.") Singular.dimension(singular_generators(G)) == 0 || error("Dimension of corresponding ideal must be zero.") - SR_destination, = Singular.polynomial_ring(base_ring(G.Sx),["$i" for i in gens(G.Sx)]; ordering = singular(ordering)) + SR_destination, = Singular.polynomial_ring(base_ring(G.Sx), symbols(G.Sx); ordering = singular(ordering)) ptr = Singular.libSingular.fglmzero(G.S.ptr, G.Sx.ptr, SR_destination.ptr) return IdealGens(base_ring(G), Singular.sideal{Singular.spoly}(SR_destination, ptr, true)) diff --git a/src/Rings/hilbert.jl b/src/Rings/hilbert.jl index aa6bddd066ce..26acdd148b69 100644 --- a/src/Rings/hilbert.jl +++ b/src/Rings/hilbert.jl @@ -1033,7 +1033,7 @@ julia> I = ideal(R, [x*z+y^2, y^6+x^3*z^3, z^6, x^6]); julia> RmodI,_ = quo(R,I); -julia> HSRing2,_ = polynomial_ring(ZZ, ["t[1]", "t[2]"]); +julia> HSRing2,_ = polynomial_ring(ZZ, :t => 1:2); julia> Oscar.HSNum_abbott(RmodI, HSRing2) -t[1]^28*t[2]^28 + t[1]^24*t[2]^24 + t[1]^22*t[2]^10 - t[1]^18*t[2]^6 + t[1]^10*t[2]^22 - t[1]^6*t[2]^18 - t[1]^4*t[2]^4 + 1 diff --git a/src/Rings/mpoly-affine-algebras.jl b/src/Rings/mpoly-affine-algebras.jl index f7a43a3d5f87..ea73898c699c 100644 --- a/src/Rings/mpoly-affine-algebras.jl +++ b/src/Rings/mpoly-affine-algebras.jl @@ -523,7 +523,7 @@ Return the Hilbert series of the graded affine algebra `A`. ```jldoctest julia> W = [1 1 1; 0 0 -1]; -julia> R, x = graded_polynomial_ring(QQ, ["x[1]", "x[2]", "x[3]"], W) +julia> R, x = graded_polynomial_ring(QQ, :x => 1:3, W) (Graded multivariate polynomial ring in 3 variables over QQ, MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}[x[1], x[2], x[3]]) julia> I = ideal(R, [x[1]^3*x[2], x[2]*x[3]^2, x[2]^2*x[3], x[3]^4]); @@ -715,7 +715,7 @@ Return the reduced Hilbert series of the positively graded affine algebra `A`. ```jldoctest julia> W = [1 1 1; 0 0 -1]; -julia> R, x = graded_polynomial_ring(QQ, ["x[1]", "x[2]", "x[3]"], W) +julia> R, x = graded_polynomial_ring(QQ, :x => 1:3, W) (Graded multivariate polynomial ring in 3 variables over QQ, MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}[x[1], x[2], x[3]]) julia> I = ideal(R, [x[1]^3*x[2], x[2]*x[3]^2, x[2]^2*x[3], x[3]^4]); @@ -816,7 +816,7 @@ of $A$, and return the value $H(A, g)$ as above. ```jldoctest julia> W = [1 1 1; 0 0 -1]; -julia> R, x = graded_polynomial_ring(QQ, ["x[1]", "x[2]", "x[3]"], W) +julia> R, x = graded_polynomial_ring(QQ, :x => 1:3, W) (Graded multivariate polynomial ring in 3 variables over QQ, MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}[x[1], x[2], x[3]]) julia> I = ideal(R, [x[1]^3*x[2], x[2]*x[3]^2, x[2]^2*x[3], x[3]^4]); @@ -1098,7 +1098,7 @@ function _subalgebra_membership_homogeneous_precomp(d::Int, v::Vector{PolyRingEl # of f suffices to check containment of f in J GJ = _groebner_basis(J, d, ordering = o) - S, _ = polynomial_ring(base_ring(R), [ "t$i" for i in 1:length(v) ]; cached=false) + S, _ = polynomial_ring(base_ring(R), "t#" => 1:length(v); cached=false) TtoS = hom(T, S, append!(zeros(S, ngens(R)), gens(S))) return RtoT, TtoS, GJ @@ -1380,7 +1380,7 @@ function _conv_normalize_data(A::MPolyQuoRing, l, br) return [ begin newSR = l[1][i][1]::Singular.PolyRing - newOR, _ = polynomial_ring(br, [string(x) for x in gens(newSR)]) + newOR, _ = polynomial_ring(br, symbols(newSR)) newA, newAmap = quo(newOR, ideal(newOR, newOR.(gens(l[1][i][2][:norid])))) set_attribute!(newA, :is_normal=>true) newgens = newOR.(gens(l[1][i][2][:normap])) diff --git a/src/Rings/mpoly-graded.jl b/src/Rings/mpoly-graded.jl index 91d7d472f3d1..a6a2ffcd5cad 100644 --- a/src/Rings/mpoly-graded.jl +++ b/src/Rings/mpoly-graded.jl @@ -857,7 +857,7 @@ julia> W = [[1, 0], [0, 1], [1, 0], [4, 1]] [1, 0] [4, 1] -julia> R, x = graded_polynomial_ring(QQ, ["x[1]", "x[2]", "x[3]", "x[4]"], W) +julia> R, x = graded_polynomial_ring(QQ, :x => 1:4, W) (Graded multivariate polynomial ring in 4 variables over QQ, MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}[x[1], x[2], x[3], x[4]]) julia> f = x[1]^4*x[2]+x[4] diff --git a/test/AlgebraicGeometry/Schemes/BlowupMorphism.jl b/test/AlgebraicGeometry/Schemes/BlowupMorphism.jl index c8194d4eb5d6..9d08e8f4790f 100644 --- a/test/AlgebraicGeometry/Schemes/BlowupMorphism.jl +++ b/test/AlgebraicGeometry/Schemes/BlowupMorphism.jl @@ -18,7 +18,7 @@ end @testset "strict transforms of cartier divisors" begin - IP2 = projective_space(QQ, ["x", "y", "z"]) + IP2 = projective_space(QQ, [:x, :y, :z]) S = ambient_coordinate_ring(IP2) (x,y,z) = gens(S) I = ideal(S, [x, y]) @@ -37,7 +37,7 @@ end end @testset "isomorphism on complement of center" begin - P = projective_space(QQ, ["x", "y", "z"]) + P = projective_space(QQ, [:x, :y, :z]) S = homogeneous_coordinate_ring(P) (x, y, z) = gens(S) II = IdealSheaf(P, [x, y]) diff --git a/test/AlgebraicGeometry/Schemes/CartierDivisor.jl b/test/AlgebraicGeometry/Schemes/CartierDivisor.jl index ce3ea584db59..d4045cfe986e 100644 --- a/test/AlgebraicGeometry/Schemes/CartierDivisor.jl +++ b/test/AlgebraicGeometry/Schemes/CartierDivisor.jl @@ -63,7 +63,7 @@ end end @testset "conversion of Cartier to Weil divisors" begin - IP2 = projective_space(QQ, ["x", "y", "z"]) + IP2 = projective_space(QQ, [:x, :y, :z]) S = homogeneous_coordinate_ring(IP2) (x,y,z) = gens(S) I = ideal(S, x^2*y^3*(x+y+z)) diff --git a/test/AlgebraicGeometry/Schemes/CoherentSheaves.jl b/test/AlgebraicGeometry/Schemes/CoherentSheaves.jl index e86251af05a5..f3a32e279bc3 100644 --- a/test/AlgebraicGeometry/Schemes/CoherentSheaves.jl +++ b/test/AlgebraicGeometry/Schemes/CoherentSheaves.jl @@ -44,7 +44,7 @@ end @testset "Pushforward of modules" begin - IP = projective_space(QQ, ["x", "y", "z"]) + IP = projective_space(QQ, [:x, :y, :z]) S = homogeneous_coordinate_ring(IP) (x,y,z) = gens(S) f = z^2 - x*y @@ -119,7 +119,7 @@ end end @testset "projectivization of vector bundles" begin - IP = projective_space(QQ, ["x", "y", "z", "w"]) + IP = projective_space(QQ, [:x, :y, :z, :w]) S = homogeneous_coordinate_ring(IP) (x,y,z,w) = gens(S) f = x^4 + y^4 + z^4 + w^4 @@ -155,7 +155,7 @@ end end @testset "direct sums of sheaves" begin - IP = projective_space(QQ, ["x", "y", "z", "w"]) + IP = projective_space(QQ, [:x, :y, :z, :w]) S = homogeneous_coordinate_ring(IP) (x, y, z, w) = gens(S) f = x^4 + y^4 + z^4 + w^4 diff --git a/test/AlgebraicGeometry/Schemes/CoveredProjectiveSchemes.jl b/test/AlgebraicGeometry/Schemes/CoveredProjectiveSchemes.jl index b7464fa06d69..0d6e10da0950 100644 --- a/test/AlgebraicGeometry/Schemes/CoveredProjectiveSchemes.jl +++ b/test/AlgebraicGeometry/Schemes/CoveredProjectiveSchemes.jl @@ -71,7 +71,7 @@ end E = direct_sum([O4, O6, O1]) - X_proj = projectivization(E, var_names=["x", "y", "z"]) + X_proj = projectivization(E, var_names=[:x, :y, :z]) X = covered_scheme(X_proj) diff --git a/test/AlgebraicGeometry/Schemes/CoveredScheme.jl b/test/AlgebraicGeometry/Schemes/CoveredScheme.jl index 988dae3b3d27..8cac4e68fda3 100644 --- a/test/AlgebraicGeometry/Schemes/CoveredScheme.jl +++ b/test/AlgebraicGeometry/Schemes/CoveredScheme.jl @@ -16,7 +16,7 @@ end @testset "Covered schemes 2" begin - P = projective_space(QQ, ["x", "y", "z", "w"]) + P = projective_space(QQ, [:x, :y, :z, :w]) Pc = covered_scheme(P) S = homogeneous_coordinate_ring(P) (x,y,z,w) = gens(S) @@ -118,7 +118,7 @@ end @testset "closed embeddings and singular loci" begin - IP2 = projective_space(QQ, ["x", "y", "z"]) + IP2 = projective_space(QQ, [:x, :y, :z]) S = homogeneous_coordinate_ring(IP2) (x, y, z) = gens(S) f = x^2*z + y^3 - y^2*z diff --git a/test/AlgebraicGeometry/Schemes/FunctionFields.jl b/test/AlgebraicGeometry/Schemes/FunctionFields.jl index 582d4bca63fc..b99b08c09c8e 100644 --- a/test/AlgebraicGeometry/Schemes/FunctionFields.jl +++ b/test/AlgebraicGeometry/Schemes/FunctionFields.jl @@ -119,7 +119,7 @@ end end @testset "pullbacks for function fields" begin - P = projective_space(QQ, ["x", "y", "z"]) + P = projective_space(QQ, [:x, :y, :z]) (x, y, z) = gens(homogeneous_coordinate_ring(P)) Y = covered_scheme(P) II = ideal_sheaf(P, [x,y]) @@ -143,7 +143,7 @@ end end @testset "refinements" begin - P = projective_space(QQ, ["x", "y", "z"]) + P = projective_space(QQ, [:x, :y, :z]) S = homogeneous_coordinate_ring(P) (x, y, z) = gens(S) Y = covered_scheme(P) diff --git a/test/AlgebraicGeometry/Schemes/K3.jl b/test/AlgebraicGeometry/Schemes/K3.jl index 0c648a44db83..e0d424010779 100644 --- a/test/AlgebraicGeometry/Schemes/K3.jl +++ b/test/AlgebraicGeometry/Schemes/K3.jl @@ -7,7 +7,7 @@ E = direct_sum([O0, O4, O6]) - X_proj = projectivization(E, var_names=["z", "x", "y"]) + X_proj = projectivization(E, var_names=[:z, :x, :y]) X = covered_scheme(X_proj) diff --git a/test/AlgebraicGeometry/ToricVarieties/toric_schemes.jl b/test/AlgebraicGeometry/ToricVarieties/toric_schemes.jl index 79f208686452..b723ea89f198 100644 --- a/test/AlgebraicGeometry/ToricVarieties/toric_schemes.jl +++ b/test/AlgebraicGeometry/ToricVarieties/toric_schemes.jl @@ -18,7 +18,7 @@ end IP1 = projective_space(NormalToricVariety, 1) - set_coordinate_names(IP1, ["x", "y"]) + set_coordinate_names(IP1, [:x, :y]) Y = IP1*IP1 @testset "Product of projective spaces" begin @@ -27,7 +27,7 @@ end IP2 = projective_space(NormalToricVariety, 2) - set_coordinate_names(IP2, ["x", "y", "z"]) + set_coordinate_names(IP2, [:x, :y, :z]) X, iso = Oscar.forget_toric_structure(IP2) @testset "Forget toric structure" begin diff --git a/test/Modules/MPolyQuo.jl b/test/Modules/MPolyQuo.jl index 75e50e45b147..930ba3be00ee 100644 --- a/test/Modules/MPolyQuo.jl +++ b/test/Modules/MPolyQuo.jl @@ -24,7 +24,7 @@ end @testset "Issues in #1806 part 1" begin - R, (x, y, z) = polynomial_ring(QQ, ["x$i" for i in 1:3]) + R, (x, y, z) = polynomial_ring(QQ, :x => 1:3) M = R[x y; y-1 z] f = det(M) diff --git a/test/Modules/UngradedModules.jl b/test/Modules/UngradedModules.jl index 52c7ab5cc883..09cccde6cd4a 100644 --- a/test/Modules/UngradedModules.jl +++ b/test/Modules/UngradedModules.jl @@ -377,7 +377,7 @@ end M = SubquoModule(F, [(x^2*y^2*F[1]+y*z*F[2]), x*z*F[1]+z^2*F[2]]) @test leading_module(M,lp) == SubquoModule(F, [x*z*F[1], x*y^2*z^2*F[2], x^2*y^2*F[1]]) - R, x = polynomial_ring(QQ, ["x_"*string(i) for i=1:4]) + R, x = polynomial_ring(QQ, :x => 1:4) F = FreeMod(R, 1) lp = lex(gens(base_ring(F)))*lex(gens(F)) diff --git a/test/Rings/FreeAssociativeAlgebraIdeal.jl b/test/Rings/FreeAssociativeAlgebraIdeal.jl index 62bf331d1903..1647fff4604e 100644 --- a/test/Rings/FreeAssociativeAlgebraIdeal.jl +++ b/test/Rings/FreeAssociativeAlgebraIdeal.jl @@ -1,6 +1,6 @@ @testset "FreeAssociativeAlgebraIdeal.basic" begin Zt = polynomial_ring(ZZ, :t)[1] - R, (x, y, z) = free_associative_algebra(Zt, ["x", "y", "z", "w"]) + R, (x, y, z) = free_associative_algebra(Zt, [:x, :y, :z, :w]) I = ideal(R, [x*y*x, y*z^2]) @test base_ring(I) == R for p in gens(R) @@ -9,13 +9,13 @@ end @testset "FreeAssociativeAlgebraIdeal.printing" begin - R, (x, y, z) = free_associative_algebra(GF(5), ["x", "y", "z", "w"]) + R, (x, y, z) = free_associative_algebra(GF(5), [:x, :y, :z, :w]) I = ideal(R, [x*y*x, y*z^2]) @test length(string(I)) > 3 end @testset "FreeAssociativeAlgebraIdeal.membership" begin - R, (x, y, z) = free_associative_algebra(QQ, ["x", "y", "z"]) + R, (x, y, z) = free_associative_algebra(QQ, [:x, :y, :z]) I = ideal(R, [x*y - y*x, x*z - z*x]) @test !ideal_membership(x, I, 5) @test !ideal_membership(x, I, 10) @@ -34,7 +34,7 @@ end end @testset "FreeAssociativeAlgebraIdeal.utils" begin - R, (x, y, z) = free_associative_algebra(QQ, ["x", "y", "z"]) + R, (x, y, z) = free_associative_algebra(QQ, [:x, :y, :z]) I = ideal(R, [x*y - y*x, x*z - z*x]) @test base_ring(I) == R @test isa(ngens(I),Int) @@ -46,7 +46,7 @@ end @test isa(lpring,NCRing) _, (x, y, z) = Singular.FreeAlgebra(QQ, ["x", "y","z"],6) - free, _ = free_associative_algebra(QQ, ["x", "y", "z"]) + free, _ = free_associative_algebra(QQ, [:x, :y, :z]) f1 = x*y + y*z F1 = free(f1) @@ -54,7 +54,7 @@ end end @testset "FreeAssociativeAlgebraIdeal.groebner_basis" begin - free, (x,y,z) = free_associative_algebra(QQ, ["x", "y", "z"]) + free, (x,y,z) = free_associative_algebra(QQ, [:x, :y, :z]) f1 = x*y + y*z f2 = x^2 + y^2 I = ideal([f1, f2]) diff --git a/test/Rings/PBWAlgebra.jl b/test/Rings/PBWAlgebra.jl index 4723c00a9128..7b499bbe0eb8 100644 --- a/test/Rings/PBWAlgebra.jl +++ b/test/Rings/PBWAlgebra.jl @@ -65,10 +65,10 @@ end end @testset "PBWAlgebra.weyl_algebra" begin - R, (x, dx) = weyl_algebra(QQ, ["x"]) + R, (x, dx) = weyl_algebra(QQ, [:x]) @test dx*x == 1 + x*dx - R, (x, y, dx, dy) = weyl_algebra(QQ, ["x", "y"]) + R, (x, y, dx, dy) = weyl_algebra(QQ, [:x, :y]) @test dx*x == 1 + x*dx @test dy*y == 1 + y*dy @test dx*y == y*dx @@ -77,7 +77,7 @@ end end @testset "PBWAlgebra.opposite_algebra" begin - R, (x, y, dx, dy) = weyl_algebra(QQ, ["x", "y"]) + R, (x, y, dx, dy) = weyl_algebra(QQ, [:x, :y]) opR, M = opposite_algebra(R) @test M(dy*dx*x*y) == M(y)*M(x)*M(dx)*M(dy) @test inv(M)(M(x)) == x @@ -91,7 +91,7 @@ end end @testset "PBWAlgebra.ideals" begin - R, (x, y, dx, dy) = weyl_algebra(QQ, ["x", "y"]) + R, (x, y, dx, dy) = weyl_algebra(QQ, [:x, :y]) I = left_ideal([x^2, y^2]) @test length(string(I)) > 2 @@ -206,7 +206,7 @@ end @test eliminate(M.(I), M.([x, d])) == M.(left_ideal([a])) end - R, (x, dx) = weyl_algebra(QQ, ["x"]) + R, (x, dx) = weyl_algebra(QQ, [:x]) @test is_zero(eliminate(left_ideal([x*dx]), [x, dx])) @test is_one(eliminate(left_ideal([x, 1-x]), [x, dx])) diff --git a/test/Rings/hilbert.jl b/test/Rings/hilbert.jl index f1d72b3bebb7..756b99909326 100644 --- a/test/Rings/hilbert.jl +++ b/test/Rings/hilbert.jl @@ -126,7 +126,7 @@ end @testset "Hilbert series part 4" begin # This test verifies that an intermediate overflow that was reported in # https://github.com/oscar-system/Oscar.jl/issues/2411 is fixed. - A, x = graded_polynomial_ring(QQ, ["x$i" for i in 1:37]) + A, x = graded_polynomial_ring(QQ, :x => 1:37) I = ideal([2*x[11] - 2*x[17] - 2*x[24] + 2*x[32] - 111916*x[37], 2*x[4] - 2*x[8] - 2*x[26] + 2*x[34] - 41216*x[37], 2*x[2] - 2*x[9] - 2*x[20] + 2*x[35] + 37974*x[37], x[28] - x[36], x[21] - x[36], x[27] - x[28] + x[33] + x[36], x[26] - x[27] - x[33] + x[34], x[20] - x[21] + x[35] + x[36], x[15] - x[21] - x[28] + x[36], x[10] - x[36], x[25] - x[28] + x[31] + x[36], x[24] - x[25] - x[26] + x[27] - x[31] + x[32] + x[33] - x[34], -x[14] + x[15] + x[18] - x[21] + x[25] - x[28] + x[31] + x[36], x[13] - x[14] + x[18] - x[19] - 2*x[20] + 2*x[21] - x[26] + x[27] + x[33] - x[34] - 2*x[35] - 2*x[36], x[9] - x[10] + x[35] + x[36], x[6] - x[10] - x[28] + x[36], x[19] - x[21] + x[30] + x[36], -x[18] + x[19] + x[23] - x[25] - x[27] + x[28] + x[30] - x[31] - x[33] - x[36], x[17] - x[19] - x[30] + x[32], x[12] - x[14] - x[17] + x[18] - x[27] + x[28] + x[31] - x[32] - x[33] - x[36], x[8] - x[10] + x[34] + x[36], x[5] - x[6] - x[8] + x[10] - x[27] + x[28] - x[34] - x[36], x[3] - x[10] - x[21] + x[36], -x[18] + x[19] + x[20] - x[21] + x[29] + x[30] + x[35] + x[36], x[22] + x[23] + x[24] - x[25] - x[29] - x[30] - x[31] + x[32], x[16] + x[17] + x[18] - x[19] - x[22] - x[23] - x[24] + x[25], x[11] + x[12] + x[13] - x[14] - x[16] - x[17] - x[18] + x[19] + x[22] + x[23] + x[24] - x[25] + x[29] + x[30] + x[31] - x[32], x[7] + x[8] + x[9] - x[10] - x[33] + x[34] + x[35] + x[36], x[4] + x[5] + x[9] - x[10] + x[26] - x[27] + x[35] + x[36], x[2] + x[3] + x[9] - x[10] + x[20] - x[21] + x[35] + x[36], x[1] - x[3] - x[6] + x[10] - x[15] + x[21] + x[28] - x[36], -x[27]*x[36] + x[34]*x[35], -x[25]*x[36] + x[32]*x[35], x[14]*x[36] + x[19]*x[35] + x[25]*x[36] + x[27]*x[36] - x[32]*x[35] - x[34]*x[35], -x[19]*x[36] - x[25]*x[36] + x[32]*x[34] + x[32]*x[35], -x[19]*x[35] - x[19]*x[36] + x[25]*x[34] - x[25]*x[36] + x[32]*x[34] + x[32]*x[35], x[14]*x[36] - x[19]*x[35] + x[25]*x[34] + x[27]*x[32], x[14]*x[35] - x[14]*x[36] + x[19]*x[35] - x[19]*x[36] + x[25]*x[27] - x[25]*x[34] - x[27]*x[32] + x[32]*x[34], x[14]*x[34] + x[19]*x[27] - 2*x[19]*x[35] + 2*x[25]*x[34] - x[25]*x[36] + x[32]*x[35], x[14]*x[32] - 2*x[14]*x[36] + x[19]*x[25] - 2*x[19]*x[35] - x[27]*x[36] + x[34]*x[35]]) Q, _ = quo(A, I) h = hilbert_polynomial(Q) diff --git a/test/Rings/mpoly-graded.jl b/test/Rings/mpoly-graded.jl index 85939139b394..abbf930d361a 100644 --- a/test/Rings/mpoly-graded.jl +++ b/test/Rings/mpoly-graded.jl @@ -297,7 +297,7 @@ end @test custom == gcd == generator == cocoa == indeterminate - R, x = polynomial_ring(QQ, ["x$i" for i in 1:5]) + R, x = polynomial_ring(QQ, :x => 1:5) P, _ = grade(R) I = ideal(P, [prod([x[i]^e[i] for i in 1:length(x)]) for e in g]) Q, _ = quo(P, I) @@ -306,7 +306,7 @@ end @test evaluate(sing[1], gens(parent(cocoa))[1]) == cocoa W = [1 1 1 1 1; 2 5 3 4 1; 9 2 -3 5 0] - S, _ = laurent_polynomial_ring(QQ, ["t₁", "t₂", "t₃"]) + S, _ = laurent_polynomial_ring(QQ, :t => 1:3) custom = Oscar._hilbert_numerator_from_leading_exponents(g, W, S, :custom) gcd = Oscar._hilbert_numerator_from_leading_exponents(g, W, S, :gcd) generator = Oscar._hilbert_numerator_from_leading_exponents(g, W, S, :generator) @@ -469,7 +469,7 @@ end # It is easy to honogenize a principal ideal: just homogenize the gen! # Do not really need lots of vars; just a "large" single polynomial LotsOfVars = 250; - Rbig, v = polynomial_ring(GF(32003), ["v$k" for k in 1:LotsOfVars]); + Rbig, v = polynomial_ring(GF(32003), :v => 1:LotsOfVars); WW1 = ones(Int64, 1,LotsOfVars); # std graded WW2 = Matrix{Int64}(reshape(1:LotsOfVars, (1,LotsOfVars))); # positive graded WW3 = Matrix{Int64}(reshape([(is_prime(k)) ? 0 : 1 for k in 1:LotsOfVars], (1,LotsOfVars))); # non-neg graded diff --git a/test/Rings/orderings.jl b/test/Rings/orderings.jl index a22a9cd0fd11..8fac041a8e28 100644 --- a/test/Rings/orderings.jl +++ b/test/Rings/orderings.jl @@ -219,7 +219,7 @@ function test_opposite_ordering(a) end @testset "Polynomial Orderings sorting" begin - R, (x1, x2, x3, x4) = polynomial_ring(QQ, "x".*string.(1:4)) + R, (x1, x2, x3, x4) = polynomial_ring(QQ, :x => 1:4) M = [x2^3, x1*x2^2, x1^2*x2, x2^2*x4, x2^2*x3, x2^2, x1^3, x1*x2*x4, x1*x2*x3, x1*x2, x1^2*x4, x1^2*x3, x1^2, x2*x4^2, x2*x3*x4,