#  Copyright (c) 1997-2015
#  Ewgenij Gawrilow, Michael Joswig (Technische Universitaet Berlin, Germany)
#  http://www.polymake.org
#
#  This program is free software; you can redistribute it and/or modify it
#  under the terms of the GNU General Public License as published by the
#  Free Software Foundation; either version 2, or (at your option) any
#  later version: http://www.gnu.org/licenses/gpl.txt.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#-------------------------------------------------------------------------------


# Note:
# So far we assume all ideals living in a polynomial ring with a global
# monomial ordering. If you need something else please contact the authors. 
object Ideal {

   # @category Commutative algebra
   # The depth of the ideal.
   # @depends singular
   property DEPTH : Int;

   # @category Commutative algebra
   # The dimension of the ideal, i.e. the Krull dimension of Polynomial ring/Ideal.
   # @depends singular
   property DIM : Int;

	# @category Commutative algebra
	# The number of variables of the polynomial ring containing the ideal.
	property N_VARIABLES : Int;

   # @category Input properties
   # A set of generators usually given by the user and not unique.
   property GENERATORS : Array<Polynomial> {
      sub equal {
         defined(eval { find_permutation(@_) })
      }
   }

   # @category Commutative algebra
   # Subobject containing properties that depend on the monomial ordering of the ring.
   # @depends singular
   property GROEBNER : Groebner : multiple;

   # @category Commutative algebra
   # The Hilbert polynomial of the ideal. For toric ideals this is linked with
   # the Ehrhart polynomial.
   property HILBERT_POLYNOMIAL : Polynomial;

   # @category Commutative algebra
   # True if the ideal can be generated by homogeneous polynomials.
   property HOMOGENEOUS : Bool;

   # @category Commutative algebra
   # True if the ideal can be generated by monomials.
   property MONOMIAL : Bool;

   # @category Commutative algebra
   # True if the is ideal a prime ideal.
   property PRIME : Bool;

   # @category Commutative algebra
   # True if the ideal is a primary ideal. I.e. its [[RADICAL]] is [[PRIME]] and 
   # in the quotient ring by the ideal every zero divisor is nilpotent.
   property PRIMARY : Bool;
   
   # @category Commutative algebra
   # An array containing the primary decomposition of the given ideal, i.e. the
   # contained ideals are [[PRIMARY]] and their intersection is the given ideal.
   # @depends singular
   property PRIMARY_DECOMPOSITION : Array<Ideal>;

   # @category Commutative algebra
   # The radical of the ideal.
   # @depends singular
   property RADICAL : Ideal;

   # @category Commutative algebra
   # True if the ideal is the zero ideal.
   property ZERO : Bool;
}

# This object contains all properties of an ideal that depend on the monomial ordering.
object Groebner {

   # @category Commutative algebra
   # The elements of the Groebner basis corresponding to the given order. This
   # may vary for different algorithms, even if the order stays the same.
   # @depends singular
   property BASIS : Array<Polynomial>;

   # @category Commutative algebra
   # The initial order corresponding to the given order. This is always a
   # [[ideal::Ideal::MONOMIAL|MONOMIAL]] ideal, even if only a weight vector is provided. Internally this
   # weight vector will be concatenated with a total order.
   # @depends singular
   property INITIAL_IDEAL : Ideal;

   # @category Commutative algebra
   # The initial forms of all polynomials in the [[BASIS]], with respect to either the [[ORDER_VECTOR]] or
   # the first row of the [[ORDER_MATRIX]].
   # @depends singular
   property INITIAL_FORMS : Array<Polynomial>;

   # @category Input properties
   # The matrix defining the monomial ordering.
   # For performance reasons this is realized via several weight vectors preceding a lexicographic order.
   # (Singular: a(row), a(row),...,lp)
   #
   # Note that only one of [[ORDER_MATRIX]], [[ORDER_VECTOR]], [[ORDER_NAME]]
   # should be given.
   property ORDER_MATRIX : Matrix<Int>;
   
   # @category Input properties
   # A weight vector for the monomial ordering, a reverse lexicographic order will be used
   # as tie-breaker. (Singular: wp(vector))
   # This vector is expected to consist of positive integers only.
   #
   # Note that only one of [[ORDER_MATRIX]], [[ORDER_VECTOR]], [[ORDER_NAME]]
   # should be given.
   property ORDER_VECTOR : Vector<Int>;
   
   # @category Input properties
   # A string containing the name of the monomial ordering. Currently we follow
   # the singular conventions, i.e. dp, lp, rp, ds, etc.
   #
   # Note that only one of [[ORDER_MATRIX]], [[ORDER_VECTOR]], [[ORDER_NAME]]
   # should be given.
   property ORDER_NAME : String;

}

# Local Variables:
# mode: perl
# cperl-indent-level:3
# indent-tabs-mode:nil
# End:
