redlog.rlg 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293
  1. Tue Apr 15 00:35:11 2008 run on win32
  2. % ----------------------------------------------------------------------
  3. % $Id: redlog.tst,v 1.7 2002/08/20 14:44:50 seidl Exp $
  4. % ----------------------------------------------------------------------
  5. % Copyright (c) 1995-1997
  6. % Andreas Dolzmann and Thomas Sturm, Universitaet Passau
  7. % ----------------------------------------------------------------------
  8. % $Log: redlog.tst,v $
  9. % Revision 1.7 2002/08/20 14:44:50 seidl
  10. % Moved CAD example to a better place.
  11. %
  12. % Revision 1.6 2002/08/20 14:32:36 seidl
  13. % rlcad cox6 added.
  14. %
  15. % Revision 1.5 1999/04/13 21:53:26 sturm
  16. % Removed "on echo".
  17. %
  18. % Revision 1.4 1999/04/05 12:25:29 dolzmann
  19. % Fixed a bug.
  20. %
  21. % Revision 1.3 1999/04/05 12:15:43 dolzmann
  22. % Added code for testing the contexts acfsf and dvfsf.
  23. %
  24. % Revision 1.2 1997/08/20 16:22:07 sturm
  25. % Do not use "on time".
  26. %
  27. % Revision 1.1 1997/08/18 15:59:01 sturm
  28. % Renamed "rl.red" to "redlog.red", and thus "rl.tst" to this file
  29. % "redlog.tst."
  30. %
  31. % ----------------------------------------------------------------------
  32. % Revision 1.3 1996/10/14 16:18:39 sturm
  33. % Added sc50b for testing the optimizer.
  34. %
  35. % Revision 1.2 1996/10/03 16:09:39 sturm
  36. % Added new QE example for testing rlatl, ..., rlifacml, rlstruct,
  37. % rlifstruct.
  38. %
  39. % Revision 1.1 1996/09/30 17:07:52 sturm
  40. % Initial check-in.
  41. %
  42. % ----------------------------------------------------------------------
  43. on rlverbose;
  44. % Ordered fields standard form:
  45. rlset ofsf;
  46. {}
  47. rlset();
  48. {ofsf}
  49. % Chains
  50. -3/5<x>y>z<=a<>b>c<5/3;
  51. - 5*x - 3 < 0 and x - y > 0 and y - z > 0 and - a + z <= 0 and a - b <> 0
  52. and b - c > 0 and 3*c - 5 < 0
  53. % For loop actions.
  54. g := for i:=1:6 mkor
  55. for j := 1:6 mkand
  56. mkid(a,i) <= mkid(a,j);
  57. g := false or (true and 0 <= 0 and a1 - a2 <= 0 and a1 - a3 <= 0
  58. and a1 - a4 <= 0 and a1 - a5 <= 0 and a1 - a6 <= 0) or (true
  59. and - a1 + a2 <= 0 and 0 <= 0 and a2 - a3 <= 0 and a2 - a4 <= 0
  60. and a2 - a5 <= 0 and a2 - a6 <= 0) or (true and - a1 + a3 <= 0
  61. and - a2 + a3 <= 0 and 0 <= 0 and a3 - a4 <= 0 and a3 - a5 <= 0
  62. and a3 - a6 <= 0) or (true and - a1 + a4 <= 0 and - a2 + a4 <= 0
  63. and - a3 + a4 <= 0 and 0 <= 0 and a4 - a5 <= 0 and a4 - a6 <= 0) or (true
  64. and - a1 + a5 <= 0 and - a2 + a5 <= 0 and - a3 + a5 <= 0 and - a4 + a5 <= 0
  65. and 0 <= 0 and a5 - a6 <= 0) or (true and - a1 + a6 <= 0 and - a2 + a6 <= 0
  66. and - a3 + a6 <= 0 and - a4 + a6 <= 0 and - a5 + a6 <= 0 and 0 <= 0)
  67. % Quantifier elimination and variants
  68. h := rlsimpl rlall g;
  69. h := all a1 all a2 all a3 all a4 all a5 all a6 ((a1 - a2 <= 0 and a1 - a3 <= 0
  70. and a1 - a4 <= 0 and a1 - a5 <= 0 and a1 - a6 <= 0) or (a1 - a2 >= 0
  71. and a2 - a3 <= 0 and a2 - a4 <= 0 and a2 - a5 <= 0 and a2 - a6 <= 0) or (
  72. a1 - a3 >= 0 and a2 - a3 >= 0 and a3 - a4 <= 0 and a3 - a5 <= 0 and a3 - a6 <= 0
  73. ) or (a1 - a4 >= 0 and a2 - a4 >= 0 and a3 - a4 >= 0 and a4 - a5 <= 0
  74. and a4 - a6 <= 0) or (a1 - a5 >= 0 and a2 - a5 >= 0 and a3 - a5 >= 0
  75. and a4 - a5 >= 0 and a5 - a6 <= 0) or (a1 - a6 >= 0 and a2 - a6 >= 0
  76. and a3 - a6 >= 0 and a4 - a6 >= 0 and a5 - a6 >= 0))
  77. rlmatrix h;
  78. (a1 - a2 <= 0 and a1 - a3 <= 0 and a1 - a4 <= 0 and a1 - a5 <= 0
  79. and a1 - a6 <= 0) or (a1 - a2 >= 0 and a2 - a3 <= 0 and a2 - a4 <= 0
  80. and a2 - a5 <= 0 and a2 - a6 <= 0) or (a1 - a3 >= 0 and a2 - a3 >= 0
  81. and a3 - a4 <= 0 and a3 - a5 <= 0 and a3 - a6 <= 0) or (a1 - a4 >= 0
  82. and a2 - a4 >= 0 and a3 - a4 >= 0 and a4 - a5 <= 0 and a4 - a6 <= 0) or (
  83. a1 - a5 >= 0 and a2 - a5 >= 0 and a3 - a5 >= 0 and a4 - a5 >= 0 and a5 - a6 <= 0
  84. ) or (a1 - a6 >= 0 and a2 - a6 >= 0 and a3 - a6 >= 0 and a4 - a6 >= 0
  85. and a5 - a6 >= 0)
  86. on rlrealtime;
  87. rlqe h;
  88. ++++ Entering cl_qe
  89. ---- (all a1 a2 a3 a4 a5 a6) [DFS: depth 6, watching 5]
  90. [0e] [1e] [2e] [3e] [3e] [3e] [3e] [2e] [3e] [3e] [3e] [2e] [3e] [3e] [3e] [2e]
  91. [3e] [3e] [3e] [2e] [3e] [3e] [3e] [3e] [1e] [2e] [3e] [3e] [3e] [2e] [3e] [3e]
  92. [3e] [2e] [3e] [3e] [3e] [2e] [3e] [3e] [3e] [3e] [1e] [2e] [3e] [3e] [3e] [2e]
  93. [3e] [3e] [3e] [2e] [3e] [3e] [3e] [2e] [3e] [3e] [3e] [1e] [2e] [3e] [3e] [3e]
  94. [2e] [3e] [3e] [3e] [2e] [3e] [3e] [3e] [2e] [3e] [3e] [3e] [1e] [2e] [3e] [3e]
  95. [3e] [2e] [3e] [3e] [3e] [2e] [3e] [3e] [3e] [2e] [3e] [3e] [3e] [1e] [2e] [3e]
  96. [3e] [3e] [3e] [2e] [3e] [3e] [3e] [2e] [3e] [3e] [3e] [2e] [3e] [3e] [3e] [2e]
  97. [3e] [3e] [3e] [3e] [DEL:25/116]
  98. Realtime: 0 s
  99. true
  100. off rlrealtime;
  101. h := rlsimpl rlall(g,{a2});
  102. h := all a1 all a3 all a4 all a5 all a6 ((a1 - a2 <= 0 and a1 - a3 <= 0
  103. and a1 - a4 <= 0 and a1 - a5 <= 0 and a1 - a6 <= 0) or (a1 - a2 >= 0
  104. and a2 - a3 <= 0 and a2 - a4 <= 0 and a2 - a5 <= 0 and a2 - a6 <= 0) or (
  105. a1 - a3 >= 0 and a2 - a3 >= 0 and a3 - a4 <= 0 and a3 - a5 <= 0 and a3 - a6 <= 0
  106. ) or (a1 - a4 >= 0 and a2 - a4 >= 0 and a3 - a4 >= 0 and a4 - a5 <= 0
  107. and a4 - a6 <= 0) or (a1 - a5 >= 0 and a2 - a5 >= 0 and a3 - a5 >= 0
  108. and a4 - a5 >= 0 and a5 - a6 <= 0) or (a1 - a6 >= 0 and a2 - a6 >= 0
  109. and a3 - a6 >= 0 and a4 - a6 >= 0 and a5 - a6 >= 0))
  110. rlqe h;
  111. ++++ Entering cl_qe
  112. ---- (all a1 a3 a4 a5 a6) [BFS: depth 5]
  113. -- left: 5
  114. [1e]
  115. -- left: 4
  116. [6e] [5e] [4e] [3e] [2e] [1e]
  117. -- left: 3
  118. [17e] [16e] [15e] [14e] [13e] [12e] [11e] [10e] [9e] [8e] [7e] [6e] [5e] [4e]
  119. [3e] [2e] [1e]
  120. -- left: 2
  121. [16e] [15e] [14e] [13e] [12e] [11e] [10e] [9e] [8e] [7e] [6e] [5e] [4e] [3e]
  122. [2e] [1e] [DEL:65/40]
  123. true
  124. off rlqeheu,rlqedfs;
  125. rlqe ex(x,a*x**2+b*x+c>0);
  126. ++++ Entering cl_qe
  127. ---- (ex x) [BFS: depth 1]
  128. -- left: 1
  129. [1e] [DEL:0/1]
  130. 3
  131. a > 0 or (2*a*b*c - b > 0 and a = 0 and b <> 0)
  132. 2
  133. or (a = 0 and (b > 0 or (b = 0 and c > 0))) or (4*a*c - b < 0 and a < 0)
  134. on rlqedfs;
  135. rlqe ex(x,a*x**2+b*x+c>0);
  136. ++++ Entering cl_qe
  137. ---- (ex x) [DFS: depth 1, watching 1]
  138. [0e] [DEL:0/1]
  139. 3
  140. a > 0 or (2*a*b*c - b > 0 and a = 0 and b <> 0)
  141. 2
  142. or (a = 0 and (b > 0 or (b = 0 and c > 0))) or (4*a*c - b < 0 and a < 0)
  143. on rlqeheu;
  144. rlqe(ex(x,a*x**2+b*x+c>0),{a<0});
  145. ++++ Entering cl_qe
  146. ---- (ex x) [BFS: depth 1]
  147. -- left: 1
  148. [1e] [DEL:0/1]
  149. 2
  150. 4*a*c - b < 0
  151. rlgqe ex(x,a*x**2+b*x+c>0);
  152. ---- (ex x) [BFS: depth 1]
  153. -- left: 1
  154. [1e!] [DEL:0/1]
  155. {{a <> 0},
  156. 2
  157. 4*a*c - b < 0 or a >= 0}
  158. rlthsimpl ({a*b*c=0,b<>0});
  159. {a*c = 0,b <> 0}
  160. rlqe ex({x,y},(for i:=1:5 product mkid(a,i)*x**10-mkid(b,i)*y**2)<=0);
  161. ++++ Entering cl_qe
  162. ---- (ex x y) [BFS: depth 2]
  163. -- left: 2
  164. [1(y^2)(x^10)(SVF).e]
  165. -- left: 1
  166. [6e] [5e] [4e] [3e] [2e] [1e] [DEL:0/7]
  167. true
  168. sol := rlqe ex(x,a*x**2+b*x+c>0);
  169. ++++ Entering cl_qe
  170. ---- (ex x) [BFS: depth 1]
  171. -- left: 1
  172. [1e] [DEL:0/1]
  173. 3
  174. sol := a > 0 or (2*a*b*c - b > 0 and a = 0 and b <> 0)
  175. 2
  176. or (a = 0 and (b > 0 or (b = 0 and c > 0))) or (4*a*c - b < 0 and a < 0)
  177. rlatnum sol;
  178. 10
  179. rlatl sol;
  180. 3
  181. {2*a*b*c - b > 0,
  182. 2
  183. 4*a*c - b < 0,
  184. a = 0,
  185. a < 0,
  186. a > 0,
  187. b = 0,
  188. b <> 0,
  189. b > 0,
  190. c > 0}
  191. rlatml sol;
  192. 3
  193. {{2*a*b*c - b > 0,1},
  194. 2
  195. {4*a*c - b < 0,1},
  196. {a = 0,2},
  197. {a < 0,1},
  198. {a > 0,1},
  199. {b = 0,1},
  200. {b <> 0,1},
  201. {b > 0,1},
  202. {c > 0,1}}
  203. rlterml sol;
  204. 2
  205. {b*(2*a*c - b ),
  206. 2
  207. 4*a*c - b ,
  208. a,
  209. b,
  210. c}
  211. rltermml sol;
  212. 2
  213. {{b*(2*a*c - b ),1},
  214. 2
  215. {4*a*c - b ,1},
  216. {a,4},
  217. {b,3},
  218. {c,1}}
  219. rlifacl sol;
  220. 2
  221. {4*a*c - b ,
  222. 2
  223. 2*a*c - b ,
  224. a,
  225. b,
  226. c}
  227. rlifacml sol;
  228. 2
  229. {{4*a*c - b ,1},
  230. 2
  231. {2*a*c - b ,1},
  232. {a,4},
  233. {b,4},
  234. {c,1}}
  235. rlstruct(sol,v);
  236. {v3 > 0 or (v1 > 0 and v3 = 0 and v4 <> 0)
  237. or (v3 = 0 and (v4 > 0 or (v4 = 0 and v5 > 0))) or (v2 < 0 and v3 < 0),
  238. 3
  239. {v1 = 2*a*b*c - b ,
  240. 2
  241. v2 = 4*a*c - b ,
  242. v3 = a,
  243. v4 = b,
  244. v5 = c}}
  245. rlifstruct(sol,v);
  246. {v3 > 0 or (v2*v4 > 0 and v3 = 0 and v4 <> 0)
  247. or (v3 = 0 and (v4 > 0 or (v4 = 0 and v5 > 0))) or (v1 < 0 and v3 < 0),
  248. 2
  249. {v1 = 4*a*c - b ,
  250. 2
  251. v2 = 2*a*c - b ,
  252. v3 = a,
  253. v4 = b,
  254. v5 = c}}
  255. rlitab sol;
  256. 10 = 100%
  257. [9: 18] [8: 15] [7: 15] [6: 15] [5: 9] [4: 9] [3: 9] [2: 16] [1: 20]
  258. Success: 10 -> 9
  259. 0 = 100%
  260. No success, returning the original formula
  261. 5 = 100%
  262. [5: 7] [4: 5] [3: 5] [2: 5] [1: 9]
  263. No success, returning the original formula
  264. 1 = 100%
  265. [1: 1]
  266. No success, returning the original formula
  267. a > 0
  268. 3
  269. or (a = 0 and (b > 0 or (b = 0 and c > 0) or (2*a*b*c - b > 0 and b < 0)))
  270. 2
  271. or (4*a*c - b < 0 and a < 0)
  272. rlatnum ws;
  273. 9
  274. rlgsn sol;
  275. [DNF]
  276. global: 1; impl: 1; no neq: 3; glob-prod-al: 0.
  277. [GP] [1]
  278. [3] [2] [1]
  279. 3
  280. a > 0 or (a = 0 and b = 0 and c > 0) or (2*a*b*c - b > 0 and a = 0 and b <> 0)
  281. 2
  282. or (a = 0 and b > 0) or (4*a*c - b < 0 and a < 0)
  283. rlatnum ws;
  284. 11
  285. off rlverbose;
  286. rlqea ex(x,m*x+b=0);
  287. {{b = 0 and m = 0,{x = infinity1}},
  288. - b
  289. {m <> 0,{x = ------}}}
  290. m
  291. % from Marc van Dongen. Finding the first feasible solution for the
  292. % solution of systems of linear diophantine inequalities.
  293. dong := {
  294. 3*X259+4*X261+3*X262+2*X263+X269+2*X270+3*X271+4*X272+5*X273+X229=2,
  295. 7*X259+11*X261+8*X262+5*X263+3*X269+6*X270+9*X271+12*X272+15*X273+X229=4,
  296. 2*X259+5*X261+4*X262+3*X263+3*X268+4*X269+5*X270+6*X271+7*X272+8*X273=1,
  297. X262+2*X263+5*X268+4*X269+3*X270+2*X271+X272+2*X229=1,
  298. X259+X262+2*X263+4*X268+3*X269+2*X270+X271-X273+3*X229=2,
  299. X259+2*X261+2*X262+2*X263+3*X268+3*X269+3*X270+3*X271+3*X272+3*X273+X229=1,
  300. X259+X261+X262+X263+X268+X269+X270+X271+X272+X273+X229=1};
  301. dong := {x229 + 3*x259 + 4*x261 + 3*x262 + 2*x263 + x269 + 2*x270 + 3*x271
  302. + 4*x272 + 5*x273 = 2,
  303. x229 + 7*x259 + 11*x261 + 8*x262 + 5*x263 + 3*x269 + 6*x270 + 9*x271
  304. + 12*x272 + 15*x273 = 4,
  305. 2*x259 + 5*x261 + 4*x262 + 3*x263 + 3*x268 + 4*x269 + 5*x270 + 6*x271
  306. + 7*x272 + 8*x273 = 1,
  307. 2*x229 + x262 + 2*x263 + 5*x268 + 4*x269 + 3*x270 + 2*x271 + x272 = 1,
  308. 3*x229 + x259 + x262 + 2*x263 + 4*x268 + 3*x269 + 2*x270 + x271 - x273
  309. = 2,
  310. x229 + x259 + 2*x261 + 2*x262 + 2*x263 + 3*x268 + 3*x269 + 3*x270
  311. + 3*x271 + 3*x272 + 3*x273 = 1,
  312. x229 + x259 + x261 + x262 + x263 + x268 + x269 + x270 + x271 + x272
  313. + x273 = 1}
  314. sol := rlopt(dong,0);
  315. sol := {0,
  316. {{x229
  317. - x262 - 2*x263 - 5*x268 - 4*x269 - 3*x270 - 2*x271 - x272 + 1
  318. = -----------------------------------------------------------------,
  319. 2
  320. x259 = (x262 + 2*x263 + 7*x268 + 6*x269 + 5*x270 + 4*x271 + 3*x272
  321. + 2*x273 + 1)/2,
  322. x261 = - x262 - x263 - 2*x268 - 2*x269 - 2*x270 - 2*x271 - 2*x272
  323. - 2*x273}}}
  324. % Substitution
  325. sub(first second sol,for each atf in dong mkand atf);
  326. true and 0 = 0 and 0 = 0 and 0 = 0 and 0 = 0 and 0 = 0 and 0 = 0 and 0 = 0
  327. rlsimpl ws;
  328. true
  329. sub(x=a,x=0 and a=0 and ex(x,x=y) and ex(a,x>a));
  330. a = 0 and a = 0 and ex x (x - y = 0) and ex a0 (a - a0 > 0)
  331. f1 := x=0 and b>=0;
  332. f1 := x = 0 and b >= 0
  333. f2 := a=0;
  334. f2 := a = 0
  335. f := f1 or f2;
  336. f := (x = 0 and b >= 0) or a = 0
  337. % Boolean normal forms.
  338. rlcnf f;
  339. (a = 0 or b >= 0) and (a = 0 or x = 0)
  340. rldnf ws;
  341. a = 0 or (b >= 0 and x = 0)
  342. rlcnf f;
  343. (a = 0 or b >= 0) and (a = 0 or x = 0)
  344. % Negation normal form and prenex normal form
  345. hugo := a=0 and b=0 and y<0 equiv ex(y,y>=a) or a>0;
  346. hugo := (a = 0 and b = 0 and y < 0) equiv (ex y ( - a + y >= 0) or a > 0)
  347. rlnnf hugo;
  348. ((a = 0 and b = 0 and y < 0) and (ex y ( - a + y >= 0) or a > 0))
  349. or ((a <> 0 or b <> 0 or y >= 0) and (all y ( - a + y < 0) and a <= 0))
  350. rlpnf hugo;
  351. all y1 ex y0 (((a = 0 and b = 0 and y < 0) and ( - a + y0 >= 0 or a > 0))
  352. or ((a <> 0 or b <> 0 or y >= 0) and ( - a + y1 < 0 and a <= 0)))
  353. % Length and Part
  354. part(hugo,0);
  355. equiv
  356. part(hugo,2,1,2);
  357. - a + y >= 0
  358. length ws;
  359. 2
  360. length hugo;
  361. 2
  362. length part(hugo,1);
  363. 3
  364. % Tableau
  365. mats := all(t,ex({l,u},(
  366. (t>=0 and t<=1) impl
  367. (l>0 and u<=1 and
  368. -t*x1+t*x2+2*t*x1*u+u=l*x1 and
  369. -2*t*x2+t*x2*u=l*x2))));
  370. mats := all t ex l ex u ((t >= 0 and t - 1 <= 0) impl (l > 0 and u - 1 <= 0
  371. and - l*x1 + 2*t*u*x1 - t*x1 + t*x2 + u = 0 and - l*x2 + t*u*x2 - 2*t*x2 = 0)
  372. )
  373. sol := rlgsn rlqe mats;
  374. sol := 3*x1 + 2 <> 0 and 2*x1 + 1 <> 0 and x1 + 1 <> 0 and x2 = 0
  375. 2 2
  376. and (2*x1 + x1 < 0 or x1 >= 0) and (3*x1 + 5*x1 + 2 < 0
  377. 2 2 2
  378. or 2*x1 + 3*x1 + 1 >= 0 or 2*x1 + x1 < 0 or x1 + x1 > 0)
  379. 2 2 2
  380. and (3*x1 + 5*x1 + 2 < 0 or 2*x1 + x1 < 0 or x1 + x1 > 0 or x1 = 0)
  381. 2 2 2
  382. and (2*x1 + 3*x1 + 1 >= 0 or 2*x1 + x1 < 0 or x1 + x1 > 0)
  383. 2 2 2
  384. and (2*x1 + 3*x1 + 1 >= 0 or 2*x1 + x1 < 0 or x1 + x1 > 0 or x1 = 0)
  385. 2 2
  386. and (x1 + x1 < 0 or x1 >= 0) and (3*x1 + 2*x1 < 0 or x1 >= 0)
  387. rltab(sol,{x1>0,x1<0,x1=0});
  388. 2 2
  389. (x1 = 0 and (x2 = 0 and (3*x1 + 5*x1 + 2 < 0 or 2*x1 + 3*x1 + 1 >= 0
  390. 2 2
  391. or 2*x1 + x1 < 0 or x1 + x1 > 0)
  392. 2 2 2
  393. and (2*x1 + 3*x1 + 1 >= 0 or 2*x1 + x1 < 0 or x1 + x1 > 0))) or (x1 < 0 and
  394. 2 2 2
  395. (3*x1 + 2*x1 < 0 and 2*x1 + x1 < 0 and x1 + x1 < 0 and 3*x1 + 2 <> 0
  396. and 2*x1 + 1 <> 0 and x1 + 1 <> 0 and x2 = 0)) or (x1 > 0 and (x2 = 0 and (
  397. 2 2 2 2
  398. 3*x1 + 5*x1 + 2 < 0 or 2*x1 + 3*x1 + 1 >= 0 or 2*x1 + x1 < 0 or x1 + x1 > 0)
  399. 2 2 2
  400. and (3*x1 + 5*x1 + 2 < 0 or 2*x1 + x1 < 0 or x1 + x1 > 0)
  401. 2 2 2
  402. and (2*x1 + 3*x1 + 1 >= 0 or 2*x1 + x1 < 0 or x1 + x1 > 0)))
  403. % Part on psopfn / cleanupfn
  404. part(rlqe ex(x,m*x+b=0),1);
  405. b = 0
  406. walter := (x>0 and y>0);
  407. walter := x > 0 and y > 0
  408. rlsimpl(true,rlatl walter);
  409. true
  410. part(rlatl walter,1,1);
  411. x
  412. % Optimizer
  413. sc50b!-t := -1*vCOL00004$
  414. sc50b!-c := {
  415. vCOL00001 >= 0,vCOL00002 >= 0,vCOL00003 >= 0,vCOL00004 >= 0,vCOL00005 >= 0,
  416. vCOL00006 >= 0,vCOL00007 >= 0,vCOL00008 >= 0,vCOL00009 >= 0,vCOL00010 >= 0,
  417. vCOL00011 >= 0,vCOL00012 >= 0,vCOL00013 >= 0,vCOL00014 >= 0,vCOL00015 >= 0,
  418. vCOL00016 >= 0,vCOL00017 >= 0,vCOL00018 >= 0,vCOL00019 >= 0,vCOL00020 >= 0,
  419. vCOL00021 >= 0,vCOL00022 >= 0,vCOL00023 >= 0,vCOL00024 >= 0,vCOL00025 >= 0,
  420. vCOL00026 >= 0,vCOL00027 >= 0,vCOL00028 >= 0,vCOL00029 >= 0,vCOL00030 >= 0,
  421. vCOL00031 >= 0,vCOL00032 >= 0,vCOL00033 >= 0,vCOL00034 >= 0,vCOL00035 >= 0,
  422. vCOL00036 >= 0,vCOL00037 >= 0,vCOL00038 >= 0,vCOL00039 >= 0,vCOL00040 >= 0,
  423. vCOL00041 >= 0,vCOL00042 >= 0,vCOL00043 >= 0,vCOL00044 >= 0,vCOL00045 >= 0,
  424. vCOL00046 >= 0,vCOL00047 >= 0,vCOL00048 >= 0,
  425. 3*vCOL00001+(3*vCOL00002)+(3*vCOL00003) <= 300,
  426. 1*vCOL00004+(-1*vCOL00005) = 0,
  427. -1*vCOL00001+(1*vCOL00006) = 0,
  428. -1*vCOL00002+(1*vCOL00007) = 0,
  429. -1*vCOL00003+(1*vCOL00008) = 0,
  430. -1*vCOL00006+(1*vCOL00009) <= 0,
  431. -1*vCOL00007+(1*vCOL00010) <= 0,
  432. -1*vCOL00008+(1*vCOL00011) <= 0,
  433. -1*vCOL00009+(3*vCOL00012)+(3*vCOL00013)+(3*vCOL00014) <= 300,
  434. 0.400000*vCOL00005+(-1*vCOL00010) <= 0,
  435. 0.600000*vCOL00005+(-1*vCOL00011) <= 0,
  436. 1.100000*vCOL00004+(-1*vCOL00015) = 0,
  437. 1*vCOL00005+(1*vCOL00015)+(-1*vCOL00016) = 0,
  438. -1*vCOL00006+(-1*vCOL00012)+(1*vCOL00017) = 0,
  439. -1*vCOL00007+(-1*vCOL00013)+(1*vCOL00018) = 0,
  440. -1*vCOL00008+(-1*vCOL00014)+(1*vCOL00019) = 0,
  441. -1*vCOL00017+(1*vCOL00020) <= 0,
  442. -1*vCOL00018+(1*vCOL00021) <= 0,
  443. -1*vCOL00019+(1*vCOL00022) <= 0,
  444. -1*vCOL00020+(3*vCOL00023)+(3*vCOL00024)+(3*vCOL00025) <= 300,
  445. 0.400000*vCOL00016+(-1*vCOL00021) <= 0,
  446. 0.600000*vCOL00016+(-1*vCOL00022) <= 0,
  447. 1.100000*vCOL00015+(-1*vCOL00026) = 0,
  448. 1*vCOL00016+(1*vCOL00026)+(-1*vCOL00027) = 0,
  449. -1*vCOL00017+(-1*vCOL00023)+(1*vCOL00028) = 0,
  450. -1*vCOL00018+(-1*vCOL00024)+(1*vCOL00029) = 0,
  451. -1*vCOL00019+(-1*vCOL00025)+(1*vCOL00030) = 0,
  452. -1*vCOL00028+(1*vCOL00031) <= 0,
  453. -1*vCOL00029+(1*vCOL00032) <= 0,
  454. -1*vCOL00030+(1*vCOL00033) <= 0,
  455. -1*vCOL00031+(3*vCOL00034)+(3*vCOL00035)+(3*vCOL00036) <= 300,
  456. 0.400000*vCOL00027+(-1*vCOL00032) <= 0,
  457. 0.600000*vCOL00027+(-1*vCOL00033) <= 0,
  458. 1.100000*vCOL00026+(-1*vCOL00037) = 0,
  459. 1*vCOL00027+(1*vCOL00037)+(-1*vCOL00038) = 0,
  460. -1*vCOL00028+(-1*vCOL00034)+(1*vCOL00039) = 0,
  461. -1*vCOL00029+(-1*vCOL00035)+(1*vCOL00040) = 0,
  462. -1*vCOL00030+(-1*vCOL00036)+(1*vCOL00041) = 0,
  463. -1*vCOL00039+(1*vCOL00042) <= 0,
  464. -1*vCOL00040+(1*vCOL00043) <= 0,
  465. -1*vCOL00041+(1*vCOL00044) <= 0,
  466. -1*vCOL00042+(3*vCOL00045)+(3*vCOL00046)+(3*vCOL00047) <= 300,
  467. 0.400000*vCOL00038+(-1*vCOL00043) <= 0,
  468. 0.600000*vCOL00038+(-1*vCOL00044) <= 0,
  469. 1.100000*vCOL00037+(-1*vCOL00048) = 0,
  470. -0.700000*vCOL00045+(0.300000*vCOL00046)+(0.300000*vCOL00047) <= 0,
  471. -1*vCOL00046+(0.400000*vCOL00048) <= 0,
  472. -1*vCOL00047+(0.600000*vCOL00048) <= 0}$
  473. rlopt(sc50b!-c,sc50b!-t);
  474. {-70,
  475. {{vcol00001 = 30,
  476. vcol00002 = 28,
  477. vcol00003 = 42,
  478. vcol00004 = 70,
  479. vcol00005 = 70,
  480. vcol00006 = 30,
  481. vcol00007 = 28,
  482. vcol00008 = 42,
  483. vcol00009 = 30,
  484. vcol00010 = 28,
  485. vcol00011 = 42,
  486. vcol00012 = 33,
  487. 154
  488. vcol00013 = -----,
  489. 5
  490. 231
  491. vcol00014 = -----,
  492. 5
  493. vcol00015 = 77,
  494. vcol00016 = 147,
  495. vcol00017 = 63,
  496. 294
  497. vcol00018 = -----,
  498. 5
  499. 441
  500. vcol00019 = -----,
  501. 5
  502. vcol00020 = 63,
  503. 294
  504. vcol00021 = -----,
  505. 5
  506. 441
  507. vcol00022 = -----,
  508. 5
  509. 363
  510. vcol00023 = -----,
  511. 10
  512. 847
  513. vcol00024 = -----,
  514. 25
  515. 2541
  516. vcol00025 = ------,
  517. 50
  518. 847
  519. vcol00026 = -----,
  520. 10
  521. 2317
  522. vcol00027 = ------,
  523. 10
  524. 993
  525. vcol00028 = -----,
  526. 10
  527. 2317
  528. vcol00029 = ------,
  529. 25
  530. 6951
  531. vcol00030 = ------,
  532. 50
  533. 993
  534. vcol00031 = -----,
  535. 10
  536. 2317
  537. vcol00032 = ------,
  538. 25
  539. 6951
  540. vcol00033 = ------,
  541. 50
  542. 3993
  543. vcol00034 = ------,
  544. 100
  545. 9317
  546. vcol00035 = ------,
  547. 250
  548. 27951
  549. vcol00036 = -------,
  550. 500
  551. 9317
  552. vcol00037 = ------,
  553. 100
  554. 32487
  555. vcol00038 = -------,
  556. 100
  557. 13923
  558. vcol00039 = -------,
  559. 100
  560. 32487
  561. vcol00040 = -------,
  562. 250
  563. 97461
  564. vcol00041 = -------,
  565. 500
  566. 13923
  567. vcol00042 = -------,
  568. 100
  569. 32487
  570. vcol00043 = -------,
  571. 250
  572. 97461
  573. vcol00044 = -------,
  574. 500
  575. 43923
  576. vcol00045 = -------,
  577. 1000
  578. 102487
  579. vcol00046 = --------,
  580. 2500
  581. 307461
  582. vcol00047 = --------,
  583. 5000
  584. 102487
  585. vcol00048 = --------}}}
  586. 1000
  587. % QE by partial CAD:
  588. cox6 := ex({u,v},x=u*v and y=u**2 and z=v**2)$
  589. rlcad cox6;
  590. 2
  591. x - y*z = 0 and y >= 0 and z >= 0
  592. % Algebraically closed fields standard form:
  593. sub(x=a,x=0 and a=0 and ex(x,x=y) and ex(a,x<>a));
  594. a = 0 and a = 0 and ex x (x - y = 0) and ex a0 (a - a0 <> 0)
  595. rlset acfsf;
  596. {ofsf}
  597. rlsimpl(x^2+y^2+1<>0);
  598. 2 2
  599. x + y + 1 <> 0
  600. rlqe ex(x,x^2=y);
  601. true
  602. clear f;
  603. h := rlqe ex(x,x^3+a*x^2+b*x+c=0 and x^3+d*x^2+e*x+f=0);
  604. 2 2 2 2 3 2
  605. h := (a*b*c - 2*a*b*c*f + a*b*f - a*c *e + 2*a*c*e*f - a*e*f + b *f - b *c*e
  606. 2 2 2 3 2 3 2 3
  607. - 2*b *e*f + 2*b*c*e + b*e *f - c + 3*c *f - c*e - 3*c*f + f = 0 or (
  608. 3 2 2 2 2
  609. a*b*c - a*b*f - a*c*e + a*e*f - b + 2*b *e - b*e - c + 2*c*f - f <> 0
  610. and a - d <> 0) or (a*b - a*e - c + f <> 0 and a - d <> 0 and b - e <> 0)
  611. or (a - d <> 0 and b - e <> 0)) and (a - d <> 0 or b - e <> 0 or c - f = 0) and
  612. 2 2 2 2
  613. (a *e - a*b*d - a*c - a*d*e + a*f + b + b*d - 2*b*e + c*d - d*f + e <> 0
  614. 2 2 3 2
  615. or a *f - a*c*d - a*d*f + b*c - b*f + c*d - c*e + e*f = 0) and (a *f
  616. 2 2 2 2 2 2 2
  617. - a *b*e*f - 2*a *c*d*f + a *c*e - a *d*f + a*b *d*f - a*b*c*d*e + 3*a*b*c*f
  618. 2 2 2 2 2 2
  619. + a*b*d*e*f - 3*a*b*f + a*c *d - 2*a*c *e + 2*a*c*d *f - a*c*d*e + a*c*e*f
  620. 2 3 2 2 2 2 2 2
  621. + a*e*f - b *f + b *c*e - b *d *f + 2*b *e*f - b*c *d + b*c*d *e - b*c*d*f
  622. 2 2 2 3 2 3 2 2
  623. - 2*b*c*e + 2*b*d*f - b*e *f + c - c *d + 3*c *d*e - 3*c *f - 3*c*d*e*f
  624. 3 2 3
  625. + c*e + 3*c*f - f = 0 or a - d = 0)
  626. rlstruct h;
  627. {(v4 = 0 or (v5 <> 0 and v7 <> 0) or (v6 <> 0 and v7 <> 0 and v8 <> 0)
  628. or (v7 <> 0 and v8 <> 0)) and (v7 <> 0 or v8 <> 0 or v9 = 0)
  629. and (v2 <> 0 or v3 = 0) and (v1 = 0 or v7 = 0),
  630. 3 2 2 2 2 2 2 2 2
  631. {v1 = a *f - a *b*e*f - 2*a *c*d*f + a *c*e - a *d*f + a*b *d*f - a*b*c*d*e
  632. 2 2 2 2 2
  633. + 3*a*b*c*f + a*b*d*e*f - 3*a*b*f + a*c *d - 2*a*c *e + 2*a*c*d *f
  634. 2 2 3 2 2 2 2 2
  635. - a*c*d*e + a*c*e*f + a*e*f - b *f + b *c*e - b *d *f + 2*b *e*f - b*c *d
  636. 2 2 2 2 3 2 3 2
  637. + b*c*d *e - b*c*d*f - 2*b*c*e + 2*b*d*f - b*e *f + c - c *d + 3*c *d*e
  638. 2 3 2 3
  639. - 3*c *f - 3*c*d*e*f + c*e + 3*c*f - f ,
  640. 2 2 2 2
  641. v2 = a *e - a*b*d - a*c - a*d*e + a*f + b + b*d - 2*b*e + c*d - d*f + e ,
  642. 2 2
  643. v3 = a *f - a*c*d - a*d*f + b*c - b*f + c*d - c*e + e*f,
  644. 2 2 2 2 3 2
  645. v4 = a*b*c - 2*a*b*c*f + a*b*f - a*c *e + 2*a*c*e*f - a*e*f + b *f - b *c*e
  646. 2 2 2 3 2 3 2 3
  647. - 2*b *e*f + 2*b*c*e + b*e *f - c + 3*c *f - c*e - 3*c*f + f ,
  648. 3 2 2 2 2
  649. v5 = a*b*c - a*b*f - a*c*e + a*e*f - b + 2*b *e - b*e - c + 2*c*f - f ,
  650. v6 = a*b - a*e - c + f,
  651. v7 = a - d,
  652. v8 = b - e,
  653. v9 = c - f}}
  654. rlqe rlall (h equiv resultant(x^3+a*x^2+b*x+c,x^3+d*x^2+e*x+f,x)=0);
  655. true
  656. clear h;
  657. % Discretely valued fields standard form:
  658. rlset dvfsf;
  659. *** p is being cleared
  660. *** turned off switch rlqeheu
  661. *** turned off switch rlqedfs
  662. *** turned on switch rlsusi
  663. {acfsf}
  664. sub(x=a,x=0 and a=0 and ex(x,x=y) and ex(a,x~a));
  665. a = 0 and a = 0 and ex x (x - y = 0) and ex a0 (a ~ a0)
  666. % P-adic Balls, taken from Andreas Dolzmann, Thomas Sturm. P-adic
  667. % Constraint Solving, Proceedings of the ISSAC '99.
  668. rlset dvfsf;
  669. *** turned on switch rlqeheu
  670. *** turned on switch rlqedfs
  671. *** turned off switch rlsusi
  672. *** p is being cleared
  673. *** turned off switch rlqeheu
  674. *** turned off switch rlqedfs
  675. *** turned on switch rlsusi
  676. {dvfsf}
  677. rlqe all(r_1,all(r_2,all(a,all(b,
  678. ex(x,r_1||x-a and r_2||x-b and r_1|r_2) impl
  679. all(y,r_2||y-b impl r_1||y-a)))));
  680. 2 2
  681. (p - 4*p + 3 | 2 or 2 ~ 1) and (p + p - 2 | 3 or 3 ~ 1)
  682. and (p + 2 | 2*p or p - 2 || p + 2)
  683. rlmkcanonic ws;
  684. true
  685. rlset(dvfsf,100003);
  686. *** turned on switch rlqeheu
  687. *** turned on switch rlqedfs
  688. *** turned off switch rlsusi
  689. *** p is set to 100003
  690. *** turned off switch rlqeheu
  691. *** turned off switch rlqedfs
  692. *** turned on switch rlsusi
  693. {dvfsf}
  694. rlqe all(r_1,all(r_2,all(a,all(b,
  695. ex(x,r_1||x-a and r_2||x-b and r_1|r_2) impl
  696. all(y,r_2||y-b impl r_1||y-a)))));
  697. true
  698. % Size of the Residue Field, taken from Andreas Dolzmann, Thomas
  699. % Sturm. P-adic Constraint Solving. Proceedings of the ISSAC '99.
  700. rlset(dvfsf);
  701. *** turned on switch rlqeheu
  702. *** turned on switch rlqedfs
  703. *** turned off switch rlsusi
  704. *** p is being cleared
  705. *** turned off switch rlqeheu
  706. *** turned off switch rlqedfs
  707. *** turned on switch rlsusi
  708. {dvfsf,100003}
  709. rlqe ex(x,x~1 and x-1~1 and x-2~1 and x-3~1 and 2~1 and 3~1);
  710. (3 ~ 1 and 2 ~ 1) or (7 ~ 1 and 6 ~ 1 and 5 ~ 1 and 3 ~ 1 and 2 ~ 1)
  711. or (5 ~ 1 and 3 ~ 1 and 2 ~ 1)
  712. or (11 ~ 1 and 10 ~ 1 and 6 ~ 1 and 3 ~ 1 and 2 ~ 1)
  713. or (7 ~ 1 and 6 ~ 1 and 3 ~ 1 and 2 ~ 1)
  714. or (6 ~ 1 and 5 ~ 1 and 3 ~ 1 and 2 ~ 1)
  715. rlexplats ws;
  716. (3 ~ 1 and 2 ~ 1) or (7 ~ 1 and 5 ~ 1 and 3 ~ 1 and 2 ~ 1)
  717. or (11 ~ 1 and 5 ~ 1 and 3 ~ 1 and 2 ~ 1) or (7 ~ 1 and 3 ~ 1 and 2 ~ 1)
  718. or (5 ~ 1 and 3 ~ 1 and 2 ~ 1)
  719. rldnf ws;
  720. 3 ~ 1 and 2 ~ 1
  721. % Selecting contexts:
  722. rlset ofsf;
  723. *** turned on switch rlqeheu
  724. *** turned on switch rlqedfs
  725. *** turned off switch rlsusi
  726. {dvfsf}
  727. f:= ex(x,m*x+b=0);
  728. f := ex x (b + m*x = 0)
  729. rlqe f;
  730. b = 0 or m <> 0
  731. rlset dvfsf;
  732. *** p is being cleared
  733. *** turned off switch rlqeheu
  734. *** turned off switch rlqedfs
  735. *** turned on switch rlsusi
  736. {ofsf}
  737. rlqe f;
  738. b + m = 0 or m <> 0
  739. rlset acfsf;
  740. *** turned on switch rlqeheu
  741. *** turned on switch rlqedfs
  742. *** turned off switch rlsusi
  743. {dvfsf}
  744. rlqe f;
  745. b = 0 or m <> 0
  746. end;
  747. Time for test: 3659 ms, plus GC time: 154 ms