home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / program / misc / mas / mashelp / dipc.def < prev    next >
Encoding:
Modula Definition  |  1989-10-08  |  16.0 KB  |  472 lines

  1.  
  2. (* DIP Common Polynomial System Definition Module. *)
  3.  
  4. DEFINITION MODULE DIPC;
  5.  
  6.  
  7. (* Import lists and declarations. *)
  8.  
  9. FROM MASSTOR IMPORT LIST;
  10.  
  11.  
  12. CONST LEX = 1;
  13.       INVLEX = 2;
  14.       GRLEX = 3;
  15.       IGRLEX = 4;      
  16.  
  17. VAR  EVORD: LIST; 
  18.      VALIS: LIST;    
  19.  
  20. PROCEDURE LPERM(L,P: LIST): LIST;
  21. (*List permute. L is a list (a sub 1, ..., a sub n). P is a list 
  22. (p sub 1, ..., p sub n) of integers in the range 1, ...,n. 
  23. LP is the list (a sub p sub 1, ..., a sub p sub n) . *)
  24.  
  25.  
  26. PROCEDURE BACKUB();
  27. (*Backspace until blank. *)
  28.  
  29.  
  30. PROCEDURE CLIN(): LIST;
  31. (*Character list in. If a character list is next in the input
  32. stream then it is read, else L is empty. *)
  33.  
  34.  
  35. PROCEDURE DILBSO(A: LIST);
  36. (*Distributive polynomial list bubble sort. A is a list of
  37. lists of base coefficients and exponent vectors.
  38. Each element of A is sorted with respect to the termordering
  39. defined in EVORD by the bubble-sort method,
  40. two monomials with equal exponents will lead to an error.
  41. The lists in A but not there location, are modified.*)
  42.  
  43.  
  44. PROCEDURE DILFPL(RL,A: LIST): LIST;
  45. (*Distributive polynomial list from polynom list. A is a list
  46. of polynomials in r variables, r ge 0. Every polynomial in A
  47. is converted to distributive representation and returned in B. *)
  48.  
  49.  
  50. PROCEDURE DIPADM(A: LIST;    VAR EL,FL,BL,B: LIST);
  51. (*Distributive polynomial advance main variable. A is a
  52. distributive polynomial in one or more variables. e is the
  53. degree of A, b is the leading coefficient of A,
  54. B is the reductum of A, f is the degree of B.*)
  55.  
  56.  
  57. PROCEDURE DIPADS(A,IL,SL: LIST;    VAR EL,FL,BL,B: LIST);
  58. (*Distributive polynomial advance and substitute. A is a
  59. distributive polynomial, i is the specified variable,
  60. 1 le i le r=DIPNOV(A), s is the new exponent of b
  61. in the i-th variable. e is the exponent of the leading
  62. monomial of A in the i-th variable, let bs be part of the
  63. coefficient of xi**e then b = bs * xi**s,
  64. B = A - bs*xi**e, f is the exponent of the leading monomial
  65. of B in the i-th variable.*)
  66.  
  67.  
  68. PROCEDURE DIPADV(A,IL: LIST;    VAR EL,FL,BL,B: LIST);
  69. (*Distributive polynomial advance. A is a distributive polynomial,
  70. i is the specified variable, 1 le i le r=DIPNOV(A). e is
  71. the exponent of the leading monomial of A in the i-th variable,
  72. b is part of the coefficient of xi**e of A,
  73. B = A - b*xi**e, f is the exponent of the leading monomial
  74. of B in the i-th variable.*)
  75.  
  76.  
  77. PROCEDURE DIPBSO(A: LIST);
  78. (*Distributive polynomial bubble sort. A is a list of
  79. base coefficients and exponent vectors, A is sorted
  80. with respect to the termordering defined in EVORD
  81. by the bubble-sort method, two monomials with equal
  82. exponents will lead to an error. The
  83. list A but not its location, is modified.*)
  84.  
  85.  
  86. PROCEDURE DIPCMP(EL,A: LIST): LIST;
  87. (*Distributive polynomial composition. A is a distributive
  88. polynomial in r variables. e is an exponent. Let t=r+1, then
  89. B(x1, ...,xr,xt)=A(x1, ...,xr)*xt**e.*)
  90.  
  91.  
  92. PROCEDURE DIPDEG(A: LIST): LIST;
  93. (*Distributive polynomial degree. A is a distributive polynomial.
  94. n is the degree of A in its main variable.*)
  95.  
  96.  
  97. PROCEDURE DIPDPV(A,SL,QL: LIST): LIST;
  98. (*Distributive polynomial division by power of variable. A is
  99. a distributive polynomial in r variables. s is the desired
  100. variable to be divided, s le r. q is a beta-integer.
  101. Q = A / ( xs**q). *)
  102.  
  103.  
  104. PROCEDURE DIPERM(A,P: LIST): LIST;
  105. (*Distributive polynomial permutation of variables. A is a
  106. distributive polynomial, in r variables, r ge 0. P is a
  107. list (p sub 1, ...,p sub r) whose elements are the
  108. beta-digits 1 through r.  B(x sub (p sub 1), ...,x sub (p sub r))
  109. =A(x sub 1, ...,x sub r). *)
  110.  
  111.  
  112. PROCEDURE DIPEVL(A: LIST): LIST;
  113. (*Distributive polynomial exponent vector leading monomial.
  114. A is a distributive polynomial. u is the exponent vector of
  115. the leading monomial of A. *)
  116.  
  117.  
  118. PROCEDURE DIPEVP(A,EL: LIST): LIST;
  119. (*Distributive polynomial exponent vector product. A is a
  120. distributive polynomial, e is an exponent vector  C=A*(x**e). *)
  121.  
  122.  
  123. PROCEDURE DIPEXC(A,ILP,JLP: LIST): LIST;
  124. (*Distributive polynomial exchange variables. A is a
  125. distributive polynomial, the variables ip and jp are exchanged,
  126. B=(x1, ...,xip, ...,xjp, ...,xr)=A(x1, ...,xjp, ...,xip, ...,xr), 
  127. 0 le ip, jp le DIPNOV(A).*)
  128.  
  129.  
  130. PROCEDURE DIPFMO(AL,EL: LIST): LIST;
  131. (*Distributive polynomial from monomial. A is a non zero
  132. distributive polynomial with a as its leading base coefficient
  133. and e as is its exponent vector of the leading monomial. *)
  134.  
  135.  
  136. PROCEDURE DIPFP(RL,A: LIST): LIST;
  137. (*Distributive polynomial from polynomial. A is a polynomial
  138. in r variables, r ge 0. B is the result of converting A from
  139. recursive to distributive representation. Modified version
  140. original version by G. E. Collins. *)
  141.  
  142.  
  143. PROCEDURE DIPINV(A,JL,KL: LIST): LIST;
  144. (*Distributive polynomial introduction of new variables.
  145. A is a distributive polynomial in r variables. k ge 0,
  146. 0 le j le r. B(x1, ...,xj,y1, ...,yk,xj+1, ...,xr)=A(x1, ...,xr).*)
  147.  
  148.  
  149. PROCEDURE DIPLBC(A: LIST): LIST;
  150. (*Distributive polynomial leading base coefficient. A is a
  151. distributive polynomial. a is the leading base coefficient of A.*)
  152.  
  153.  
  154. PROCEDURE DIPLDC(A: LIST): LIST;
  155. (*Distributive polynomial leading coefficient. A is a distributive
  156. polynomial in one or more variables. a is the leading
  157. coefficient of A.*)
  158.  
  159.  
  160. PROCEDURE DIPLM(L1,L2: LIST): LIST;
  161. (*Distributive polynomial list merge.  L1 and L2 are lists
  162. of non zero distributive polynomials in non decreasing
  163. order.  L is the merge of L1 and L2. L1 and L2 are
  164. modified to produce L. *)
  165.  
  166.  
  167. PROCEDURE DIPLPM(A: LIST): LIST;
  168. (*Distributive polynomial list pair-merge sort. A is
  169. a list of non zero distributive polynomials. B is the
  170. result of sorting A into non-decreasing order. Pairs of
  171. polynomials are merged. The list A is modified to produce B. *)
  172.  
  173.  
  174. PROCEDURE DIPLRS(A: LIST);
  175. (*Distributive polynomials list re-sort. A is a list of
  176. distributive  polynomials in r variables, r ge 0.
  177. The polynomials in A are re-sorted. *)
  178.  
  179.  
  180. PROCEDURE DIPMAD(A: LIST;    VAR AL,EL,AP: LIST);
  181. (*Distributive polynomial monomial advance. A is a non zero
  182. distributive polynomial. a is its leading base coefficient,
  183. e is the exponent vector of the leading monomial of A.
  184. AP is the distributive polynomial a without its leading
  185. monomial, or the empty list. *)
  186.  
  187.  
  188. PROCEDURE DIPMCP(AL,EL,A: LIST): LIST;
  189. (*Distributive polynomial monomial composition. A is an emty
  190. list or a non zero distributive polynomial. AP is a non zero
  191. distributive polynomial with a as its leading base coefficient,
  192. e as is its exponent vector of the leading monomial and A as
  193. its monomial reductum. *)
  194.  
  195.  
  196. PROCEDURE DIPMPM(A,PL: LIST): LIST;
  197. (*Distributive polynomial multiplication by power of main variable.
  198. A is a distributive polynomial in r variables. p is a beta-
  199. integer.  B = A * ( xr**p ). *)
  200.  
  201.  
  202. PROCEDURE DIPMPV(A,SL,PL: LIST): LIST;
  203. (*Distributive polynomial multiplication by power of variable.
  204. A is a distributive polynomial in r variables. s is the specified
  205. variable to be multiplicated, 1 le s le r. p is a beta-integer.
  206. B = A * ( xs**p ). *)
  207.  
  208.  
  209. PROCEDURE DIPMRD(A: LIST): LIST;
  210. (*Distributive polynomial monomial reductum. A is a distributive
  211. polynomial. B is the distributive polynomial a without the
  212. leading monomial of A. *)
  213.  
  214.  
  215. PROCEDURE DIPMST(A,AL,EL: LIST);
  216. (*Distributive polynomial monomial set. A is a non zero
  217. distributive polynomial. Its leading base coefficient is set
  218. to a and its exponent vector of the leading monomial is
  219. set to e. *)
  220.  
  221.  
  222. PROCEDURE DIPNBC(A: LIST): LIST;
  223. (*Distributive polynomial number of base coefficients. A is a
  224. distributive polynomial. l is the number of base coefficients.*)
  225.  
  226.  
  227. PROCEDURE DIPNOV(A: LIST): LIST;
  228. (*Distributive polynomial number of variables. A is a distributive
  229. polynomial. r is the number of variables, r ge 0. If A=0 then
  230. r is set to zero. *)
  231.  
  232.  
  233. PROCEDURE DIPRED(A: LIST): LIST;
  234. (*Distributive polynomial reductum. A is a distributive polynomial,
  235. in one or more variables. B is the reductum of A.*)
  236.  
  237.  
  238. PROCEDURE DIPTBC(A: LIST): LIST;
  239. (*Distributive polynomial trailing base coefficient. A is a
  240. distributive polynomial. a is the trailing base coefficient.*)
  241.  
  242.  
  243. PROCEDURE DIPTCF(A: LIST): LIST;
  244. (*Distributive polynomial trailing coefficient. A is a
  245. distributive polynomial. a is the trailing coefficient of A.*)
  246.  
  247.  
  248. PROCEDURE DIPTCS(A,IL: LIST): LIST;
  249. (*Distributive polynomial trailing coefficient specified variable.
  250. A is a distributive polynomial in r variables. a is the
  251. trailing coefficient of A with respect to the i-th variable,
  252. 1 le i le r. *)
  253.  
  254.  
  255. PROCEDURE DIPTDG(A: LIST): LIST;
  256. (*Distributive polynomial total degree. A is a distributive
  257. polynomial. n is the total degree of A.*)
  258.  
  259.  
  260. PROCEDURE DIPUNT(A: LIST): LIST;
  261. (*Distributive polynomial univariate test. A is a distributive
  262. polynomial. If a is univariate then t=1, otherwise t=0.*)
  263.  
  264.  
  265. PROCEDURE DIPUV(A: LIST): LIST;
  266. (*Distributive polynomial univariate variable output.
  267. A is a distributive polynomial. If A is univariate then t=i, 
  268. otherwise t=0. were i is the index of the variable in which A 
  269. is univariate. If A is constant then t= -1. *)
  270.  
  271.  
  272. PROCEDURE EPREAD(): LIST; 
  273. (*Exponent read.  If ** is found in the input stream
  274. then e=AREAD, else e=1. *)
  275.  
  276.  
  277. PROCEDURE EVCADD(U,IL,EL: LIST;    VAR V,FL: LIST);
  278. (*Exponent vector component add. U=(u1, ...,ur) is an
  279. exponent vector of length r, e is added to the i-th component,
  280. 1 le i le r, f=ui+e, V=(u1, ...,ui+e, ...,ur). *)
  281.  
  282.  
  283. PROCEDURE EVCOMP(U,V: LIST): LIST;
  284. (*Exponent vector compare. U=(u1, ...,ur), V=(v1, ...vr)
  285. are exponent vectors. r is the length of U and V.
  286. t=0 if U eq V. t=1 if U gt V. t=-1 if U lt V. eq, gt, lt
  287. with respect to the ordering of the exponent vectors specified
  288. in the global variable EVORD. Lexicographical, inverse
  289. lexicographical, graded lexicograhpical, inverse graded
  290. lexicographical orderings are possible. *)
  291.  
  292.  
  293. PROCEDURE EVCSUB(U,IL,EL: LIST;    VAR V,FL: LIST);
  294. (*Exponent vector component subtract. U=(u1, ...,ur) is an
  295. exponent vector of length r, e is subtracted from the i-th
  296. component, 1 le i le r, V=(u1, ...,ui-e, ...,ur), f=ui. *)
  297.  
  298.  
  299. PROCEDURE EVDEL(U,IL: LIST;    VAR V,EL: LIST);
  300. (*Exponent vector delete. U=(u1, ...,ur) is an exponent vector
  301. of length r. i is the component to be deleted, 1 le i le r.
  302. V=(u1, ...,ui-1,ui+1, ...,ur),  e=ui.*)
  303.  
  304.  
  305. PROCEDURE EVDER(U,IL,EL: LIST;    VAR V,FL: LIST);
  306. (*Exponent vector derivation. U=(u1, ...,ur) is an exponent
  307. vector of length r, from the i-th component e-times one is
  308. subtracted and f is multiplied with the result.
  309. V=(u1, ...,ui-e, ...,ur). If f=0 then V is undefined. *)
  310.  
  311.  
  312. PROCEDURE EVDFSI(U,V: LIST;    VAR W,SL: LIST);
  313. (*Exponent vector difference and sign. U=(u1, ...,ur),
  314. V=(v1, ...,vr) are exponent vectors of length r.
  315. W=(w1, ...,wr) is the componentwise difference of U and V.
  316. s is the EVSIGN of W. If s=-1 then W is undefined.*)
  317.  
  318.  
  319. PROCEDURE EVDIF(U,V: LIST): LIST;
  320. (*Exponent vector difference. U=(u1, ...,ur), V=(v1, ...,vr)
  321. are exponent vectors of length r. W=(w1, ...,wr) is the
  322. componentwise difference of U and V.*)
  323.  
  324.  
  325. PROCEDURE EVDOV(U: LIST): LIST;
  326. (*Exponent vector dependency on variables. U is an exponent
  327. vector. V is the list (j1, ...,jn) where each
  328. j is the index of a variable with non zero exponent in U. *)
  329.  
  330.  
  331. PROCEDURE EVEXC(U,IL,JL: LIST): LIST;
  332. (*Exponent vector exchange. U=(u1, ...,ui, ...,uj, ...,ur)
  333. is an exponent vector of length r. The components ui and uj are 
  334. exchanged, 1 le i lt j le r. V=(u1, ...,uj, ...,ui, ...,ur).*)
  335.  
  336.  
  337. PROCEDURE EVIGLC(U,V: LIST): LIST;
  338. (*Exponent vector inverse graded lexicographical compare.
  339. U=(u1, ...,ur), V=(v1, ...vr) are exponent vectors.
  340. t=0 if U eq V. t=1 if U gt V. t=-1 if U lt V. eq, gt, lt
  341. with respect to the inverse graded lexicographical ordering
  342. of the exponent vectors. r is the length of U and V.*)
  343.  
  344.  
  345. PROCEDURE EVILCI(U,V: LIST): LIST;
  346. (*Exponent vector inverse lexicographical compare inverse exponent 
  347. vector. U=(u1, ...,ur), V=(v1, ...vr) are exponent vectors.
  348. t=0 if U eq V. t=1 if U gt V. t=-1 if U lt V. eq, gt,
  349. lt with respect to the inverse lexicographical ordering
  350. of the exponent vectors. r is the length of U and V.*)
  351.  
  352.  
  353. PROCEDURE EVILCP(U,V: LIST): LIST;
  354. (*Exponent vector inverse lexicographical compare.
  355. U=(u1, ...,ur), V=(v1, ...vr) are exponent vectors.
  356. t=0 if U eq V. t=1 if U gt V. t=-1 if U lt V. eq, gt,
  357. lt with respect to the inverse lexicographical ordering
  358. of the exponent vectors. r is the length of U and V.*)
  359.  
  360.  
  361. PROCEDURE EVITDC(U,V: LIST): LIST;
  362. (*Exponent vector inverse total degree compare.
  363. U=(u1, ...,ur), V=(v1, ...vr) are exponent vectors.
  364. t=0 if U eq V. t=1 if U gt V. t=-1 if U lt V. eq, gt, lt
  365. with respect to buchbergers total degree ordering
  366. of the exponent vectors. r is the length of U and V.*)
  367.  
  368.  
  369. PROCEDURE EVLFCP(L,U,V: LIST): LIST;
  370. (*Exponent vector linear form compare. U=(u1, ...,ur),
  371. V=(v1, ...,vr) are exponent vectors of length r.
  372. L is an univariate integral polynomial vector.
  373. t=0 if U eq V. t=1 if U gt V. t=-1 if U lt V. eq, gt, lt
  374. with respect to the ordering of the exponent vectors 
  375. determined by the linear form.*)
  376.  
  377.  
  378. PROCEDURE EVLCM(U,V: LIST): LIST;
  379. (*Exponent vector least common multiple. U=(u1, ...,ur),
  380. V=(v1, ...,vr) are exponent vectors of length r.
  381. W=(w1, ...,wr) is the least common multiple of U and V. *)
  382.  
  383.  
  384. PROCEDURE EVMT(U,V: LIST): LIST;
  385. (*Exponent vector multiple test. U=(u1, ...,ur),
  386. V=(v1, ...,vr) are exponent vectors of length r.
  387. t=1 if U is a multiple of V, t=0 else. *)
  388.  
  389.  
  390. PROCEDURE EVNNZE(U: LIST): LIST;
  391. (*Exponent vector number of non zero exponents. U is an
  392. exponent vector. n is the number of non zero exponents of U. *)
  393.  
  394.  
  395. PROCEDURE EVRAND(RL,KL: LIST): LIST;
  396. (*Exponent vector random. r is the length of U. k is a
  397. positive beta-digit such that every component of U will be
  398. less than k and k lt beta. U is a random exponent vector.*)
  399.  
  400.  
  401. PROCEDURE EVRASP(RL,KL,QL: LIST): LIST;
  402. (*Exponent vector random. r is the length of U. k is a
  403. positive beta-digit such that every component of U will be
  404. less than k and k lt beta. U is a random exponent vector.*)
  405.  
  406.  
  407. PROCEDURE EVSIGN(U: LIST): LIST;
  408. (*Exponent vector signum. U=(u1, ...,ur) is an exponent vector
  409. of length r. t=0 if all components are eq 0, t=1 if all
  410. components are ge 0, else t=-1.*)
  411.  
  412.  
  413. PROCEDURE EVSU(U,IL,FL: LIST;    VAR V,EL: LIST);
  414. (*Exponent vector substitution. U=(u1, ...,ui, ...,ur)
  415. is an exponent vector of length r. The i-th component is
  416. changed into f. 1 le i le r. e=ui. 
  417. V=(u1, ...,ui-1,f,ui+1, ...,ur). *)
  418.  
  419.  
  420. PROCEDURE EVSUM(U,V: LIST): LIST;
  421. (*Exponent vector sum. U=(u1, ...,ur), V=(v1, ...,vr) are
  422. exponent vectors of length r. W=(u1+v1, ...,ur+vr) is the
  423. componentwise sum of U and V. *)
  424.  
  425.  
  426. PROCEDURE EVTDEG(U: LIST): LIST;
  427. (*Exponent vector total degree. U is an exponent vector.
  428. n is the sum of the components of U.*)
  429.  
  430.  
  431. PROCEDURE PBCLI(RL,A: LIST): LIST;
  432. (*Polynomial base coefficients list. A is a polynomial in
  433. r variables. B is the list of the base coefficients of A. *)
  434.  
  435.  
  436. PROCEDURE PFDIP(A: LIST;    VAR RL,B: LIST);
  437. (*Polynomial from distributive polynomial. A is a distributive
  438. polynomial. B is the result of converting A to recursive
  439. representation, r is the number of variables of B, r ge 0.
  440. Modified version, original version by G. E. Collins. *)
  441.  
  442.  
  443. PROCEDURE PLFDIL(A: LIST;    VAR RL,B: LIST);
  444. (*Polynomial list from distributive polynom list. A is a list
  445. of distributive polynomials in r variables, r ge 0. Every
  446. polynomial in A is converted to recursive representation and
  447. stored in B. *)
  448.  
  449.  
  450. PROCEDURE PMPV(RL,A,IL,NL: LIST): LIST;
  451. (*Polynomial multiplication by power of variable.  A is
  452. a polynomial in r variables. 1 le i le r
  453. and n is a beta-integer. B=A*(x sub i)**n. *)
  454.  
  455.  
  456. PROCEDURE PPERMV(RL,A,P: LIST): LIST;
  457. (*Polynomial permutation of variables.  A is a polynomial in
  458. r variables, r ge 0. P is a list (p sub 1, ...,p sub r)
  459. whose elements are the beta-digits 1 through r.
  460. B(x sub (p sub 1), ...,x sub (p sub r))=A(x sub 1, ...,
  461. x sub r).*)
  462.  
  463.  
  464. PROCEDURE STVL(RL: LIST): LIST; 
  465. (*Standard variable list. r is the number of variables.
  466. V is the variable list for the variables x1, ...,xr. *)
  467.  
  468.  
  469. END DIPC.
  470.  
  471.  
  472.