polyslp http://www.openmath.org/cd/polyslp.ocd 2003-04-01 2000-02-11 experimental 2 0 opnode relation1 setname1 poly This CD contains operators to deal with polynomials and more precisely polynomials held in Straight Line Program representation. Definition of data-structure constructors polynomial_SLP The constructor of Polynomials built with Straight Line Program representation. The first argument is the polynomial ring containing the polynomial built with poly_ring_SLP, The second argument is the program body built with ProgBody. The polynomial x^2 + y^2, which may be represented as the Straight Line Program : line 1 : InputNode x line 2 : InputNode y line 3 : OperationNode times line 1, line 1 line 4 : OperationNode times line 2, line 2 line 5 : OperationNode plus line 3, line 4 > may be encoded as : 1 1 2 2 3 4 prog_body the constructor of the body of the straight line program the arguments represent straight line instructions, as constructed by the following three constructors, op_node, inp_node and const_node. The order is taken to be the order in which they appear op_node This constructor takes three or four arguments. The first argument is a symbol from opnode, meant to specify whether the node is a plus, minus times or divide node, the second and third arguments are integers, which are pointers to the lines which are the arguments of the operation The optional fourth argument is from opnode if it exists it must be return to specify that this is a return value of the straight line program. inp_node This constructor takes one argument, which is a variable the return value is intended to represent an input node. variables. const_node This constructor takes one argument, which is a value of type PolyRingslp it is intended to represent a constant node Definition of some functions which are specific to slps length A unary function taking an slp as argument and returning the length of this slp. depth A unary function taking an slp as argument and returning the greatest depth of any leaf node, that is the greatest contiguous path to any leaf node. slp_degree A unary function taking an slp as argument and returning the apparent multiplicative degree of the slp, without performing any cancellation. The slp_degree of the polynomial x > degree(x) slpDegree(convert(x^2)@poly_ring_SLP - convert(x^2)@poly_ring_SLP) = 2 1 1 2 2 2 return_node Takes an slp as the argument returns the return node of the slp. node_selector Takes an slp as the first argument, the second argument is the position of the required node. Returns the node of the slp at this position. left_ref Takes as argument a node of an slp. returns the value of the left hand pointer of the node. right_ref Takes as argument a node of an slp. returns the value of the right hand pointer of the node. Definition of some functions which are very useful for slps quotient A quotient function for polynomials represented by slps. It is a requirement that this is an exact division. monte_carlo_eq This is a Monte-Carlo equality test, it takes three arguments, the first two are slps representing polynomials, the third argument is the maximum probability of incorrectness that is required of the equality test. (Monte-Carlo equality tests are very important for slps as they offer the only tractable method of solving the equality problem in many cases) poly_ring_SLP The constructor of the polynomial ring. The first argument is a ring, (the ring of the coefficients), the rest are the variables, in any order An example to represent a polynomial ring over the integers, with the two variables x,y. viz. Z[x,y]