Skip to content

Commit

Permalink
Move partial characters from experimental/Rings/ to src/ (oscar-s…
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens authored Apr 3, 2024
1 parent 915da71 commit 31aa134
Show file tree
Hide file tree
Showing 10 changed files with 152 additions and 172 deletions.
31 changes: 17 additions & 14 deletions examples/BinomIdeal.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
module BinomialIdeal

using Oscar
Oscar.example("QQAbAndPChars.jl")
using Main.QQAbModule
import Main.QQAbModule: my_product, QQAbElem, PCharSaturateAll, LatticeEqual
import lib4ti2_jll
using Oscar: PartialCharacter, have_same_span, partial_character, saturations
import Oscar.lib4ti2_jll

using DelimitedFiles

Expand All @@ -30,7 +28,7 @@ import Oscar.Singular: std, Ideal, lead_exponent
#markov4ti2(L::ZZMatrix)
#"=="(I::Singular.sideal,J::Singular.sideal)
#isSubset(I::Singular.sideal,J::Singular.sideal)
#idealFromCharacter(P::PChar, R::Singular.PolyRing)
#idealFromCharacter(P::PartialCharacter, R::Singular.PolyRing)
#partialCharacterFromIdeal(I::Singular.sideal, R::Singular.PolyRing)
#cellularStandardMonomials(I::Singular.sideal)
#witnessMonomials(I::Singular.sideal)
Expand Down Expand Up @@ -536,14 +534,14 @@ end
#
###################################################################################

function idealFromCharacter(P::PChar, R::Singular.PolyRing)
function idealFromCharacter(P::PartialCharacter, R::Singular.PolyRing)
#input: partial character P and a polynomial ring R
#output: the ideal $I_+(P)=\langle x^{u_+}- P(u)x^{u_-} \mid u \in P.A \rangle$

@assert Nemo.ncols(P.A)==Singular.nvars(R)
#test if the domain of the partial character is the zero lattice
Zero=matrix(FlintZZ,1,Nemo.ncols(P.A),zeros(Int64,1,Nemo.ncols(P.A)))
if Nemo.nrows(P.A)==1 && LatticeEqual(P.A,Zero)==true
if Nemo.nrows(P.A)==1 && have_same_span(P.A,Zero)==true
return Ideal(R,zero(R))
end

Expand Down Expand Up @@ -609,7 +607,7 @@ function idealFromCharacter(P::PChar, R::Singular.PolyRing)
return saturate(I,Ideal(R,varProduct))[1]
end

function makeBinomials(P::PChar, R::Singular.PolyRing)
function makeBinomials(P::PartialCharacter, R::Singular.PolyRing)
#output: ideal generated by the binomials corresponding to the generators of the domain P.A of the partial character P
#Note: This is not the ideal I_+(P)!!

Expand Down Expand Up @@ -648,7 +646,7 @@ function partialCharacterFromIdeal(I::Singular.sideal, R::Singular.PolyRing)

Delta=cell[2] #cell variables
if size(Delta,1)==0
P=PChar(matrix(FlintZZ,1,Singular.nvars(R), zeros(Int64,1,Singular.nvars(R))), [QQAbField()(1)], Set{Int64}(Delta))
P=partial_character(matrix(FlintZZ,1,Singular.nvars(R), zeros(Int64,1,Singular.nvars(R))), [QQAbField()(1)], Set{Int64}(Delta))
return P
end

Expand All @@ -673,7 +671,7 @@ argument, so we make an array prodDeltaC, push to it, then splice it in
#if Singular.ngens(J)==0 || (Singular.ngens(J)==1 && J[1]== R(0))
#return another trivial character
#lattice has only one generator, namely the zero vector
P=PChar(matrix(FlintZZ,1,Singular.nvars(R), zeros(Int64,1,Singular.nvars(R))), [QQAbField()(1)], Set{Int64}(Delta))
P=partial_character(matrix(FlintZZ,1,Singular.nvars(R), zeros(Int64,1,Singular.nvars(R))), [QQAbField()(1)], Set{Int64}(Delta))
return P
end
#now case if J \neq 0
Expand Down Expand Up @@ -712,7 +710,7 @@ argument, so we make an array prodDeltaC, push to it, then splice it in
#delete zero rows in the hnf of vsMat so that we do not get problems when considering a
#saturation
vsMat=deleteZerosInHNF(vsMat)
P=PChar(vsMat, images , Set{Int64}(Delta))
P=partial_character(vsMat, images , Set{Int64}(Delta))
return P
end

Expand Down Expand Up @@ -789,6 +787,11 @@ function cellularStandardMonomials(I::Singular.sideal)
return Result
end

function my_product(P::Array)
T = ntuple(x->P[x], length(P))
return Iterators.product(T...)
end

function witnessMonomials(I::Singular.sideal)
#input: cellular binomial ideal
#output: M_{emb}(I) (not the ideal, but the generators of it in an array)
Expand All @@ -802,7 +805,7 @@ function witnessMonomials(I::Singular.sideal)
R=Singular.base_ring(I)
Delta=cell[2]

#compute the PChar corresponding to I and the standard monomials of I \cap k[N^Delta]
#compute the PartialCharacter corresponding to I and the standard monomials of I \cap k[N^Delta]
P=partialCharacterFromIdeal(I, R)
M=cellularStandardMonomials(I) #array of standard monomials, this is our to-do list
Memb=Singular.spoly[] #this will hold our set of witness monomials
Expand Down Expand Up @@ -886,7 +889,7 @@ function cellularAssociatedPrimes(I::Singular.sideal)
Im=Singular.quotient(I,Ideal(I.base_ring,m))
Pm=partialCharacterFromIdeal(Im,Im.base_ring)
#now compute all saturations of the partial character Pm
PmSat=PCharSaturateAll(Pm)
PmSat=saturations(Pm)
for P in PmSat
Ass=[Ass; (idealFromCharacter(P, I.base_ring)+idealDeltaC)]
end
Expand Down Expand Up @@ -922,7 +925,7 @@ function cellularMinimalAssociatedPrimes(I::Singular.sideal)
end

P=partialCharacterFromIdeal(I,I.base_ring)
PSat=PCharSaturateAll(P)
PSat=saturations(P)
minAss=Array{Singular.sideal}[] #this will hold the set of minimal associated primes

#construct the ideal (x_i \mid i \in \Delta^c)
Expand Down
14 changes: 6 additions & 8 deletions examples/BinomIdeal2.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
module BinomialIdeal

using Oscar
Oscar.include("../experimental/Rings/QQAbAndPChars.jl")
using Oscar.QQAbModule
import Oscar.QQAbModule: QQAbElem, have_same_span
using Oscar: PartialCharacter, have_same_span, partial_character
import Oscar.lib4ti2_jll

#using DelimitedFiles
Expand Down Expand Up @@ -31,7 +29,7 @@ import Oscar.Singular: std, Ideal, lead_exponent
#markov4ti2(L::ZZMatrix)
#"=="(I::Singular.sideal,J::Singular.sideal)
#isSubset(I::Singular.sideal,J::Singular.sideal)
#idealFromCharacter(P::PChar, R::Singular.PolyRing)
#idealFromCharacter(P::PartialCharacter, R::Singular.PolyRing)
#partialCharacterFromIdeal(I::Singular.sideal, R::Singular.PolyRing)
#cellularStandardMonomials(I::Singular.sideal)
#witnessMonomials(I::Singular.sideal)
Expand Down Expand Up @@ -795,8 +793,8 @@ function cellularStandardMonomials(I::Singular.sideal)
end

function my_product(P::Array)
T = ntuple(x->P[x], length(P))
return Iterators.product(T...)
T = ntuple(x->P[x], length(P))
return Iterators.product(T...)
end

function witnessMonomials(I::Singular.sideal)
Expand All @@ -812,7 +810,7 @@ function witnessMonomials(I::Singular.sideal)
R=Singular.base_ring(I)
Delta=cell[2]

#compute the PChar corresponding to I and the standard monomials of I \cap k[N^Delta]
#compute the PartialCharacter corresponding to I and the standard monomials of I \cap k[N^Delta]
P=partialCharacterFromIdeal(I, R)
M=cellularStandardMonomials(I) #array of standard monomials, this is our to-do list
Memb=Singular.spoly[] #this will hold our set of witness monomials
Expand Down Expand Up @@ -932,7 +930,7 @@ function cellularMinimalAssociatedPrimes(I::Singular.sideal)
end

P=partialCharacterFromIdeal(I,I.base_ring)
PSat=PCharSaturateAll(P)
PSat=saturations(P)
minAss=Array{Singular.sideal}[] #this will hold the set of minimal associated primes

#construct the ideal (x_i \mid i \in \Delta^c)
Expand Down
1 change: 0 additions & 1 deletion experimental/Experimental.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
const expdir = joinpath(@__DIR__, "../experimental")
const oldexppkgs = [
"GModule",
"Rings",
"Schemes",
"FTheoryTools" # Must be loaded after the schemes.
]
Expand Down
1 change: 0 additions & 1 deletion experimental/NoExperimental_whitelist_.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ whitelist = String[
"GModule", # many doctest failures and `MethodError: no method matching numerator(::QQPolyRingElem)`
"InvariantTheory", # `undefined binding 'linearly_reductive_group' in `@docs` block in src/InvariantTheory/reductive_groups.md:53-55` and more docs errors`
"ModStd", # `MethodError: no method matching monomial(::QQMPolyRing, ::Vector{Int64})` and many similar errors
"Rings", # used by Rings/binomial_ideals.jl, see https://github.com/oscar-system/Oscar.jl/blob/13282dfd07b6aee58e433a45353f48261cda787b/src/Oscar.jl#L268
"Schemes", # TODO: untangle src/AlgebraicGeometry/Schemes/ and experimental/Schemes/
]
134 changes: 0 additions & 134 deletions experimental/Rings/QQAbAndPChars.jl

This file was deleted.

1 change: 0 additions & 1 deletion experimental/Rings/Rings.jl

This file was deleted.

2 changes: 0 additions & 2 deletions src/Oscar.jl
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,6 @@ include("Serialization/main.jl")

include("../experimental/Experimental.jl")

include("Rings/binomial_ideals.jl") # uses QQAbModule from experimental/Rings/QQAbAndPChars.jl

if is_dev
# include("../examples/ModStdNF.jl")
# include("../examples/ModStdQ.jl")
Expand Down
4 changes: 2 additions & 2 deletions src/Rings/AbelianClosure.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# Note that there are two possibilities construct a nth root of unity when n is
# even and n%4!=0. either we can construct the field Q(z_n) or we take -z_(n/2)
# as a primitive n-th root. to change between these two options, use
# PCharSaturateAll with allroots or allrootsNew (change this in the code)
# saturations with allroots or allrootsNew (change this in the code)

abstract type CyclotomicField end

Expand Down Expand Up @@ -1153,7 +1153,7 @@ function square_root_in_cyclotomic_field(F::QQAbField, n::Int, N::Int)
end

"""
quadratic_irrationality_info(a::QQAbModule.QQAbElem)
quadratic_irrationality_info(a::QQAbElem)
Return `(x, y, n)`, where `x`, `y` are of type `QQFieldElem` and `n` is
a squarefree integer, such that `a == x + y sqrt(n)` holds.
Expand Down
1 change: 1 addition & 0 deletions src/Rings/Rings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ include("FunctionField.jl")
include("AbelianClosure.jl")
include("AlgClosureFp.jl")
include("Laurent.jl")
include("binomial_ideals.jl")

include("PBWAlgebra.jl")
include("PBWAlgebraQuo.jl")
Expand Down
Loading

0 comments on commit 31aa134

Please sign in to comment.