redlog.tst 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. % ----------------------------------------------------------------------
  2. % $Id: redlog.tst,v 1.5 1999/04/13 21:53:26 sturm Exp $
  3. % ----------------------------------------------------------------------
  4. % Copyright (c) 1995-1997
  5. % Andreas Dolzmann and Thomas Sturm, Universitaet Passau
  6. % ----------------------------------------------------------------------
  7. % $Log: redlog.tst,v $
  8. % Revision 1.5 1999/04/13 21:53:26 sturm
  9. % Removed "on echo".
  10. %
  11. % Revision 1.4 1999/04/05 12:25:29 dolzmann
  12. % Fixed a bug.
  13. %
  14. % Revision 1.3 1999/04/05 12:15:43 dolzmann
  15. % Added code for testing the contexts acfsf and dvfsf.
  16. %
  17. % Revision 1.2 1997/08/20 16:22:07 sturm
  18. % Do not use "on time".
  19. %
  20. % Revision 1.1 1997/08/18 15:59:01 sturm
  21. % Renamed "rl.red" to "redlog.red", and thus "rl.tst" to this file
  22. % "redlog.tst."
  23. %
  24. % ----------------------------------------------------------------------
  25. % Revision 1.3 1996/10/14 16:18:39 sturm
  26. % Added sc50b for testing the optimizer.
  27. %
  28. % Revision 1.2 1996/10/03 16:09:39 sturm
  29. % Added new QE example for testing rlatl, ..., rlifacml, rlstruct,
  30. % rlifstruct.
  31. %
  32. % Revision 1.1 1996/09/30 17:07:52 sturm
  33. % Initial check-in.
  34. %
  35. % ----------------------------------------------------------------------
  36. on rlverbose;
  37. % Ordered fields standard form:
  38. rlset ofsf;
  39. rlset();
  40. % Chains
  41. -3/5<x>y>z<=a<>b>c<5/3;
  42. % For loop actions.
  43. g := for i:=1:6 mkor
  44. for j := 1:6 mkand
  45. mkid(a,i) <= mkid(a,j);
  46. % Quantifier elimination and variants
  47. h := rlsimpl rlall g;
  48. rlmatrix h;
  49. on rlrealtime;
  50. rlqe h;
  51. off rlrealtime;
  52. h := rlsimpl rlall(g,{a2});
  53. rlqe h;
  54. off rlqeheu,rlqedfs;
  55. rlqe ex(x,a*x**2+b*x+c>0);
  56. on rlqedfs;
  57. rlqe ex(x,a*x**2+b*x+c>0);
  58. on rlqeheu;
  59. rlqe(ex(x,a*x**2+b*x+c>0),{a<0});
  60. rlgqe ex(x,a*x**2+b*x+c>0);
  61. rlthsimpl ({a*b*c=0,b<>0});
  62. rlqe ex({x,y},(for i:=1:5 product mkid(a,i)*x**10-mkid(b,i)*y**2)<=0);
  63. sol := rlqe ex(x,a*x**2+b*x+c>0);
  64. rlatnum sol;
  65. rlatl sol;
  66. rlatml sol;
  67. rlterml sol;
  68. rltermml sol;
  69. rlifacl sol;
  70. rlifacml sol;
  71. rlstruct(sol,v);
  72. rlifstruct(sol,v);
  73. rlitab sol;
  74. rlatnum ws;
  75. rlgsn sol;
  76. rlatnum ws;
  77. off rlverbose;
  78. rlqea ex(x,m*x+b=0);
  79. % from Marc van Dongen. Finding the first feasible solution for the
  80. % solution of systems of linear diophantine inequalities.
  81. dong := {
  82. 3*X259+4*X261+3*X262+2*X263+X269+2*X270+3*X271+4*X272+5*X273+X229=2,
  83. 7*X259+11*X261+8*X262+5*X263+3*X269+6*X270+9*X271+12*X272+15*X273+X229=4,
  84. 2*X259+5*X261+4*X262+3*X263+3*X268+4*X269+5*X270+6*X271+7*X272+8*X273=1,
  85. X262+2*X263+5*X268+4*X269+3*X270+2*X271+X272+2*X229=1,
  86. X259+X262+2*X263+4*X268+3*X269+2*X270+X271-X273+3*X229=2,
  87. X259+2*X261+2*X262+2*X263+3*X268+3*X269+3*X270+3*X271+3*X272+3*X273+X229=1,
  88. X259+X261+X262+X263+X268+X269+X270+X271+X272+X273+X229=1};
  89. sol := rlopt(dong,0);
  90. % Substitution
  91. sub(first second sol,for each atf in dong mkand atf);
  92. rlsimpl ws;
  93. sub(x=a,x=0 and a=0 and ex(x,x=y) and ex(a,x>a));
  94. f1 := x=0 and b>=0;
  95. f2 := a=0;
  96. f := f1 or f2;
  97. % Boolean normal forms.
  98. rlcnf f;
  99. rldnf ws;
  100. rlcnf f;
  101. % Negation normal form and prenex normal form
  102. hugo := a=0 and b=0 and y<0 equiv ex(y,y>=a) or a>0;
  103. rlnnf hugo;
  104. rlpnf hugo;
  105. % Length and Part
  106. part(hugo,0);
  107. part(hugo,2,1,2);
  108. length ws;
  109. length hugo;
  110. length part(hugo,1);
  111. % Tableau
  112. mats := all(t,ex({l,u},(
  113. (t>=0 and t<=1) impl
  114. (l>0 and u<=1 and
  115. -t*x1+t*x2+2*t*x1*u+u=l*x1 and
  116. -2*t*x2+t*x2*u=l*x2))));
  117. sol := rlgsn rlqe mats;
  118. rltab(sol,{x1>0,x1<0,x1=0});
  119. % Part on psopfn / cleanupfn
  120. part(rlqe ex(x,m*x+b=0),1);
  121. walter := (x>0 and y>0);
  122. rlsimpl(true,rlatl walter);
  123. part(rlatl walter,1,1);
  124. % Optimizer
  125. sc50b!-t := -1*vCOL00004$
  126. sc50b!-c := {
  127. vCOL00001 >= 0,vCOL00002 >= 0,vCOL00003 >= 0,vCOL00004 >= 0,vCOL00005 >= 0,
  128. vCOL00006 >= 0,vCOL00007 >= 0,vCOL00008 >= 0,vCOL00009 >= 0,vCOL00010 >= 0,
  129. vCOL00011 >= 0,vCOL00012 >= 0,vCOL00013 >= 0,vCOL00014 >= 0,vCOL00015 >= 0,
  130. vCOL00016 >= 0,vCOL00017 >= 0,vCOL00018 >= 0,vCOL00019 >= 0,vCOL00020 >= 0,
  131. vCOL00021 >= 0,vCOL00022 >= 0,vCOL00023 >= 0,vCOL00024 >= 0,vCOL00025 >= 0,
  132. vCOL00026 >= 0,vCOL00027 >= 0,vCOL00028 >= 0,vCOL00029 >= 0,vCOL00030 >= 0,
  133. vCOL00031 >= 0,vCOL00032 >= 0,vCOL00033 >= 0,vCOL00034 >= 0,vCOL00035 >= 0,
  134. vCOL00036 >= 0,vCOL00037 >= 0,vCOL00038 >= 0,vCOL00039 >= 0,vCOL00040 >= 0,
  135. vCOL00041 >= 0,vCOL00042 >= 0,vCOL00043 >= 0,vCOL00044 >= 0,vCOL00045 >= 0,
  136. vCOL00046 >= 0,vCOL00047 >= 0,vCOL00048 >= 0,
  137. 3*vCOL00001+(3*vCOL00002)+(3*vCOL00003) <= 300,
  138. 1*vCOL00004+(-1*vCOL00005) = 0,
  139. -1*vCOL00001+(1*vCOL00006) = 0,
  140. -1*vCOL00002+(1*vCOL00007) = 0,
  141. -1*vCOL00003+(1*vCOL00008) = 0,
  142. -1*vCOL00006+(1*vCOL00009) <= 0,
  143. -1*vCOL00007+(1*vCOL00010) <= 0,
  144. -1*vCOL00008+(1*vCOL00011) <= 0,
  145. -1*vCOL00009+(3*vCOL00012)+(3*vCOL00013)+(3*vCOL00014) <= 300,
  146. 0.400000*vCOL00005+(-1*vCOL00010) <= 0,
  147. 0.600000*vCOL00005+(-1*vCOL00011) <= 0,
  148. 1.100000*vCOL00004+(-1*vCOL00015) = 0,
  149. 1*vCOL00005+(1*vCOL00015)+(-1*vCOL00016) = 0,
  150. -1*vCOL00006+(-1*vCOL00012)+(1*vCOL00017) = 0,
  151. -1*vCOL00007+(-1*vCOL00013)+(1*vCOL00018) = 0,
  152. -1*vCOL00008+(-1*vCOL00014)+(1*vCOL00019) = 0,
  153. -1*vCOL00017+(1*vCOL00020) <= 0,
  154. -1*vCOL00018+(1*vCOL00021) <= 0,
  155. -1*vCOL00019+(1*vCOL00022) <= 0,
  156. -1*vCOL00020+(3*vCOL00023)+(3*vCOL00024)+(3*vCOL00025) <= 300,
  157. 0.400000*vCOL00016+(-1*vCOL00021) <= 0,
  158. 0.600000*vCOL00016+(-1*vCOL00022) <= 0,
  159. 1.100000*vCOL00015+(-1*vCOL00026) = 0,
  160. 1*vCOL00016+(1*vCOL00026)+(-1*vCOL00027) = 0,
  161. -1*vCOL00017+(-1*vCOL00023)+(1*vCOL00028) = 0,
  162. -1*vCOL00018+(-1*vCOL00024)+(1*vCOL00029) = 0,
  163. -1*vCOL00019+(-1*vCOL00025)+(1*vCOL00030) = 0,
  164. -1*vCOL00028+(1*vCOL00031) <= 0,
  165. -1*vCOL00029+(1*vCOL00032) <= 0,
  166. -1*vCOL00030+(1*vCOL00033) <= 0,
  167. -1*vCOL00031+(3*vCOL00034)+(3*vCOL00035)+(3*vCOL00036) <= 300,
  168. 0.400000*vCOL00027+(-1*vCOL00032) <= 0,
  169. 0.600000*vCOL00027+(-1*vCOL00033) <= 0,
  170. 1.100000*vCOL00026+(-1*vCOL00037) = 0,
  171. 1*vCOL00027+(1*vCOL00037)+(-1*vCOL00038) = 0,
  172. -1*vCOL00028+(-1*vCOL00034)+(1*vCOL00039) = 0,
  173. -1*vCOL00029+(-1*vCOL00035)+(1*vCOL00040) = 0,
  174. -1*vCOL00030+(-1*vCOL00036)+(1*vCOL00041) = 0,
  175. -1*vCOL00039+(1*vCOL00042) <= 0,
  176. -1*vCOL00040+(1*vCOL00043) <= 0,
  177. -1*vCOL00041+(1*vCOL00044) <= 0,
  178. -1*vCOL00042+(3*vCOL00045)+(3*vCOL00046)+(3*vCOL00047) <= 300,
  179. 0.400000*vCOL00038+(-1*vCOL00043) <= 0,
  180. 0.600000*vCOL00038+(-1*vCOL00044) <= 0,
  181. 1.100000*vCOL00037+(-1*vCOL00048) = 0,
  182. -0.700000*vCOL00045+(0.300000*vCOL00046)+(0.300000*vCOL00047) <= 0,
  183. -1*vCOL00046+(0.400000*vCOL00048) <= 0,
  184. -1*vCOL00047+(0.600000*vCOL00048) <= 0}$
  185. rlopt(sc50b!-c,sc50b!-t);
  186. % Algebraically closed fields standard form:
  187. sub(x=a,x=0 and a=0 and ex(x,x=y) and ex(a,x<>a));
  188. rlset acfsf;
  189. rlsimpl(x^2+y^2+1<>0);
  190. rlqe ex(x,x^2=y);
  191. clear f;
  192. h := rlqe ex(x,x^3+a*x^2+b*x+c=0 and x^3+d*x^2+e*x+f=0);
  193. rlstruct h;
  194. rlqe rlall (h equiv resultant(x^3+a*x^2+b*x+c,x^3+d*x^2+e*x+f,x)=0);
  195. clear h;
  196. % Discretely valued fields standard form:
  197. rlset dvfsf;
  198. sub(x=a,x=0 and a=0 and ex(x,x=y) and ex(a,x~a));
  199. % P-adic Balls, taken from Andreas Dolzmann, Thomas Sturm. P-adic
  200. % Constraint Solving, Proceedings of the ISSAC '99.
  201. rlset dvfsf;
  202. rlqe all(r_1,all(r_2,all(a,all(b,
  203. ex(x,r_1||x-a and r_2||x-b and r_1|r_2) impl
  204. all(y,r_2||y-b impl r_1||y-a)))));
  205. rlmkcanonic ws;
  206. rlset(dvfsf,100003);
  207. rlqe all(r_1,all(r_2,all(a,all(b,
  208. ex(x,r_1||x-a and r_2||x-b and r_1|r_2) impl
  209. all(y,r_2||y-b impl r_1||y-a)))));
  210. % Size of the Residue Field, taken from Andreas Dolzmann, Thomas
  211. % Sturm. P-adic Constraint Solving. Proceedings of the ISSAC '99.
  212. rlset(dvfsf);
  213. rlqe ex(x,x~1 and x-1~1 and x-2~1 and x-3~1 and 2~1 and 3~1);
  214. rlexplats ws;
  215. rldnf ws;
  216. % Selecting contexts:
  217. rlset ofsf;
  218. f:= ex(x,m*x+b=0);
  219. rlqe f;
  220. rlset dvfsf;
  221. rlqe f;
  222. rlset acfsf;
  223. rlqe f;
  224. end; % of file