cgb.rlg 56 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293
  1. Sun Aug 18 19:02:06 2002 run on Windows
  2. % ----------------------------------------------------------------------
  3. % $Id: cgb.tst,v 1.2 1999/04/13 21:50:44 sturm Exp $
  4. % ----------------------------------------------------------------------
  5. % Copyright (c) 1999 Andreas Dolzmann and Thomas Sturm
  6. % ----------------------------------------------------------------------
  7. % $Log: cgb.tst,v $
  8. % Revision 1.2 1999/04/13 21:50:44 sturm
  9. % Removed echo, and gbverbose settings. There is no gbverbose.
  10. %
  11. % Revision 1.1 1999/04/05 08:30:45 dolzmann
  12. % Copied and overworked Rev. 1.6 of the old cgb version.
  13. %
  14. % ----------------------------------------------------------------------
  15. % Examples taken from the manual:
  16. % 1 Introduction
  17. oo := torder({x,y},lex)$
  18. cgb {a*x,x+y};
  19. {x + y,a*x,a*y}
  20. gsys {a*x,x+y};
  21. {{a <> 0,{x + y,a*x,a*y}},
  22. {a = 0,{x + y}}}
  23. torder oo;
  24. {{x,y},lex}
  25. % 4 CGB: Comprehensive Groebner Basis
  26. oo := torder({x,y},lex)$
  27. cgb {a*x+y,x+b*y};
  28. {x + b*y,a*x + y,(a*b - 1)*y}
  29. torder oo;
  30. {{x,y},lex}
  31. % 5 GSYS: Groebner System
  32. oo := torder({x,y},lex)$
  33. gsys {a*x+y,x+b*y};
  34. {{a*b - 1 <> 0 and a <> 0,
  35. {a*x + y,x + b*y,(a*b - 1)*y}},
  36. {a <> 0 and a*b - 1 = 0,
  37. {a*x + y,x + b*y}},
  38. {a = 0,{a*x + y,x + b*y}}}
  39. torder oo;
  40. {{x,y},lex}
  41. % 6 GSYS2CGB: Groebner System to CGB
  42. oo := torder({x,y},lex)$
  43. gsys {a*x+y,x+b*y};
  44. {{a*b - 1 <> 0 and a <> 0,
  45. {a*x + y,x + b*y,(a*b - 1)*y}},
  46. {a <> 0 and a*b - 1 = 0,
  47. {a*x + y,x + b*y}},
  48. {a = 0,{a*x + y,x + b*y}}}
  49. gsys2cgb ws;
  50. {x + b*y,a*x + y,(a*b - 1)*y}
  51. torder oo;
  52. {{x,y},lex}
  53. % 7 Switch CGBREAL: Computing over the Real Numbers
  54. oo := torder({x,y},lex)$
  55. off cgbreal;
  56. gsys {a*x+y,x-a*y};
  57. 2
  58. {{a + 1 <> 0 and a <> 0,
  59. 2
  60. {a*x + y,x - a*y,(a + 1)*y}},
  61. 2
  62. {a <> 0 and a + 1 = 0,{a*x + y,x - a*y}},
  63. {a = 0,{a*x + y,x - a*y}}}
  64. on cgbreal;
  65. gsys({a*x+y,x-a*y});
  66. {{a <> 0,
  67. 2
  68. {a*x + y,x - a*y,(a + 1)*y}},
  69. {a = 0,{a*x + y,x - a*y}}}
  70. torder oo;
  71. {{x,y},lex}
  72. % Miscellaneous examples:
  73. % Dolzmann's Example
  74. oo := torder({x,y,z},lex);
  75. oo := {{},lex}
  76. cgb({a*x+b*y,c*x+d*y,(a*d-b*c)*z});
  77. {c*x + d*y,
  78. a*x + b*y,
  79. (a*d - b*c)*y,
  80. (a*d - b*c)*z}
  81. gsys({a*x+b*y,c*x+d*y,(a*d-b*c)*z});
  82. {{a*d - b*c <> 0 and a <> 0 and c <> 0,
  83. {a*x + b*y,
  84. c*x + d*y,
  85. (a*d - b*c)*y,
  86. (a*d - b*c)*z}},
  87. {a*d - b*c <> 0 and a <> 0 and d <> 0 and c = 0,
  88. {a*x + b*y,c*x + d*y,(a*d - b*c)*z}},
  89. {a*d - b*c <> 0 and a <> 0 and c = 0 and d = 0,
  90. {a*x + b*y,(a*d - b*c)*z}},
  91. {a*d - b*c <> 0 and b <> 0 and c <> 0 and a = 0,
  92. {a*x + b*y,c*x + d*y,(a*d - b*c)*z}},
  93. {a*d - b*c <> 0 and b <> 0 and d <> 0 and a = 0 and c = 0,
  94. {a*x + b*y,c*x + d*y,(a*d - b*c)*z}},
  95. {a*d - b*c <> 0 and b <> 0 and a = 0 and c = 0 and d = 0,
  96. {a*x + b*y,(a*d - b*c)*z}},
  97. {a*d - b*c <> 0 and c <> 0 and a = 0 and b = 0,
  98. {c*x + d*y,(a*d - b*c)*z}},
  99. {a*d - b*c <> 0 and d <> 0 and a = 0 and b = 0 and c = 0,
  100. {c*x + d*y,(a*d - b*c)*z}},
  101. {a*d - b*c <> 0 and a = 0 and b = 0 and c = 0 and d = 0,
  102. {(a*d - b*c)*z}},
  103. {a <> 0 and c <> 0 and a*d - b*c = 0,
  104. {a*x + b*y,c*x + d*y}},
  105. {a <> 0 and d <> 0 and a*d - b*c = 0 and c = 0,
  106. {a*x + b*y,c*x + d*y}},
  107. {a <> 0 and a*d - b*c = 0 and c = 0 and d = 0,
  108. {a*x + b*y}},
  109. {b <> 0 and c <> 0 and a*d - b*c = 0 and a = 0,
  110. {a*x + b*y,c*x + d*y}},
  111. {b <> 0 and d <> 0 and a*d - b*c = 0 and a = 0 and c = 0,
  112. {a*x + b*y,c*x + d*y}},
  113. {b <> 0 and a*d - b*c = 0 and a = 0 and c = 0 and d = 0,
  114. {a*x + b*y}},
  115. {c <> 0 and a*d - b*c = 0 and a = 0 and b = 0,
  116. {c*x + d*y}},
  117. {d <> 0 and a*d - b*c = 0 and a = 0 and b = 0 and c = 0,
  118. {c*x + d*y}},
  119. {a*d - b*c = 0 and a = 0 and b = 0 and c = 0 and d = 0,
  120. {}}}
  121. gsys2cgb ws;
  122. {c*x + d*y,
  123. a*x + b*y,
  124. (a*d - b*c)*y,
  125. (a*d - b*c)*z}
  126. torder oo;
  127. {{x,y,z},lex}
  128. % Forsman's Example (hybrid control system).
  129. oo := torder({x1,x2,y2,y1,y0},lex);
  130. oo := {{},lex}
  131. gsys({(u1*u2-u1)*x1+u2*x2+y2,(u2-1)*x1+u2*x2+y1,-x2+y0});
  132. {{u1*u2 - u1 <> 0,
  133. {(u1*u2 - u1)*x1 + u2*x2 + y2,
  134. (u2 - 1)*x1 + u2*x2 + y1,
  135. x2 - y0,
  136. y2 - u1*y1 - (u1*u2 - u2)*y0}},
  137. {u2 - 1 <> 0 and u2 <> 0 and u1*u2 - u1 = 0,
  138. {(u1*u2 - u1)*x1 + u2*x2 + y2,
  139. (u2 - 1)*x1 + u2*x2 + y1,
  140. (u1*u2 - u1)*x1 + y2 + u2*y0,
  141. x2 - y0}},
  142. {u1*u2 - u1 = 0 and u2 - 1 = 0,
  143. {(u1*u2 - u1)*x1 + u2*x2 + y2,
  144. (u2 - 1)*x1 + u2*x2 + y1,
  145. (u1*u2 - u1 - u2 + 1)*x1 + y2 - y1,
  146. (u2 - 1)*x1 + y1 + u2*y0,
  147. x2 - y0}},
  148. {u1*u2 - u1 = 0 and u2 = 0,
  149. {(u1*u2 - u1)*x1 + u2*x2 + y2,
  150. (u2 - 1)*x1 + u2*x2 + y1,
  151. x2 - y0}}}
  152. torder oo;
  153. {{x1,x2,y2,y1,y0},lex}
  154. % Weispfenning's Example
  155. oo := torder({x,y},lex);
  156. oo := {{},lex}
  157. gsys({v*x*y + x,u*y^2 + x^2});
  158. {{u*v <> 0 and v <> 0,
  159. 2 2
  160. {x + u*y ,
  161. v*x*y + x,
  162. 3 2
  163. (u*v)*y + u*y }},
  164. {u <> 0 and v <> 0 and u*v = 0,
  165. 2 2
  166. {x + u*y ,
  167. 3 3
  168. (u*v )*x*y + u*x,
  169. v*x*y + x,
  170. 3 2
  171. (u*v)*y + u*y }},
  172. {u <> 0 and v = 0,
  173. 2 2
  174. {v*x *y - u*y ,
  175. 2 2
  176. x + u*y ,
  177. v*x*y + x}},
  178. {v <> 0 and u*v = 0 and u = 0,
  179. 2 2
  180. {x + u*y ,v*x*y + x}},
  181. {u = 0 and v = 0,
  182. 2 2
  183. {x + u*y ,v*x*y + x}}}
  184. torder oo;
  185. {{x,y},lex}
  186. % The folllowing three examples are taken from
  187. % Weispfenning, Comprehensive Groebner Bases,
  188. % J. Symbolic Computation (1992) 14, 1-29
  189. % Weispfenning's Example 7.1
  190. oo := torder({x},lex);
  191. oo := {{},lex}
  192. gsys({a0*x**2 + a1*x + a2,b0*x**2 + b1*x + b2});
  193. 3 2 2 2 2 2 2
  194. {{a0 *b2 - a0 *a1*b1*b2 - 2*a0 *a2*b0*b2 + a0 *a2*b1 + a0*a1 *b0*b2
  195. 2 2
  196. - a0*a1*a2*b0*b1 + a0*a2 *b0 <> 0 and a0*b1 - a1*b0 <> 0 and a0 <> 0
  197. and b0 <> 0,
  198. 3 2 2 2 2 2 2
  199. {a0 *b2 - a0 *a1*b1*b2 - 2*a0 *a2*b0*b2 + a0 *a2*b1 + a0*a1 *b0*b2
  200. 2 2
  201. - a0*a1*a2*b0*b1 + a0*a2 *b0 }},
  202. 3 2 2
  203. {a0*b1 - a1*b0 <> 0 and a0 <> 0 and b0 <> 0 and a0 *b2 - a0 *a1*b1*b2
  204. 2 2 2 2 2 2
  205. - 2*a0 *a2*b0*b2 + a0 *a2*b1 + a0*a1 *b0*b2 - a0*a1*a2*b0*b1 + a0*a2 *b0
  206. = 0,
  207. 2
  208. {a0*x + a1*x + a2,
  209. 2
  210. b0*x + b1*x + b2,
  211. (a0*b1 - a1*b0)*x + (a0*b2 - a2*b0)}},
  212. 2 2
  213. {a0*b2 - a1*b1*b2 + a2*b1 <> 0 and a0 <> 0 and b1 <> 0 and b0 = 0,
  214. 3 2 2 2
  215. {(a0*b0*b1)*x - (a0*b0*b2 - a1*b0*b1)*x - (a0*b2 - a1*b1*b2 + a2*b1 )}},
  216. {a0*b2 - a2*b0 <> 0 and a0 <> 0 and b0 <> 0 and a0*b1 - a1*b0 = 0,
  217. {(a0*b1 - a1*b0)*x + (a0*b2 - a2*b0)}},
  218. {a0 <> 0 and b0 <> 0 and a0*b1 - a1*b0 = 0 and a0*b2 - a2*b0 = 0,
  219. 2 2
  220. {a0*x + a1*x + a2,b0*x + b1*x + b2}},
  221. 2 2
  222. {a0 <> 0 and b1 <> 0 and a0*b2 - a1*b1*b2 + a2*b1 = 0 and b0 = 0,
  223. 2 2
  224. {a0*x + a1*x + a2,b0*x + b1*x + b2}},
  225. {a0 <> 0 and b2 <> 0 and b0 = 0 and b1 = 0,
  226. 2
  227. {b0*x + b1*x + b2}},
  228. {a0 <> 0 and b0 = 0 and b1 = 0 and b2 = 0,
  229. 2
  230. {a0*x + a1*x + a2}},
  231. 2 2
  232. {a1 *b2 - a1*a2*b1 + a2 *b0 <> 0 and a1 <> 0 and b0 <> 0 and a0 = 0,
  233. 3 2 2 2
  234. {(a0*a1*b0)*x + (a0*a1*b1 - a0*a2*b0)*x - (a1 *b2 - a1*a2*b1 + a2 *b0)}},
  235. {a1*b2 - a2*b1 <> 0 and a1 <> 0 and b1 <> 0 and a0 = 0 and b0 = 0,
  236. 2
  237. {(a0*b1 - a1*b0)*x - (a1*b2 - a2*b1)}},
  238. 2 2
  239. {a1 <> 0 and b0 <> 0 and a0 = 0 and a1 *b2 - a1*a2*b1 + a2 *b0 = 0,
  240. 2 2
  241. {a0*x + a1*x + a2,b0*x + b1*x + b2}},
  242. {a1 <> 0 and b1 <> 0 and a0 = 0 and a1*b2 - a2*b1 = 0 and b0 = 0,
  243. 2 2
  244. {a0*x + a1*x + a2,b0*x + b1*x + b2}},
  245. {a1 <> 0 and b2 <> 0 and a0 = 0 and b0 = 0 and b1 = 0,
  246. 2
  247. {b0*x + b1*x + b2}},
  248. {a1 <> 0 and a0 = 0 and b0 = 0 and b1 = 0 and b2 = 0,
  249. 2
  250. {a0*x + a1*x + a2}},
  251. {a2 <> 0 and a0 = 0 and a1 = 0,
  252. 2
  253. {a0*x + a1*x + a2}},
  254. {b0 <> 0 and a0 = 0 and a1 = 0 and a2 = 0,
  255. 2
  256. {b0*x + b1*x + b2}},
  257. {b1 <> 0 and a0 = 0 and a1 = 0 and a2 = 0 and b0 = 0,
  258. 2
  259. {b0*x + b1*x + b2}},
  260. {b2 <> 0 and a0 = 0 and a1 = 0 and a2 = 0 and b0 = 0 and b1 = 0,
  261. 2
  262. {b0*x + b1*x + b2}},
  263. {a0 = 0 and a1 = 0 and a2 = 0 and b0 = 0 and b1 = 0 and b2 = 0,
  264. {}}}
  265. torder oo;
  266. {{x},lex}
  267. % Weispfenning's Example 7.2
  268. oo := torder({x,y},lex);
  269. oo := {{},lex}
  270. gsys({v*x*y + u*x**2 + x,u*y**2 + x**2});
  271. 4 3
  272. {{u *v + u*v <> 0 and u <> 0 and v <> 0,
  273. 2
  274. {u*x + v*x*y + x,
  275. 2 2
  276. x + u*y ,
  277. 2 2
  278. v*x*y + x - u *y ,
  279. 3 5 2 3 3 5 2 2 2
  280. u *x + (u *v + u *v )*y - (u - u *v )*y ,
  281. 7 2 4 4 4 4 3 3 4 2 2
  282. (u *v + u *v )*y + (2*u *v )*y + (u *v )*y }},
  283. 4 3
  284. {u <> 0 and v <> 0 and u *v + u*v = 0,
  285. 2
  286. {u*x + v*x*y + x,
  287. 2 2
  288. x + u*y ,
  289. 2 2
  290. v*x*y + x - u *y ,
  291. 3 5 2 3 3 5 2 2 2
  292. u *x + (u *v + u *v )*y - (u - u *v )*y ,
  293. 7 2 4 4 4 4 3 3 4 2 2
  294. (u *v + u *v )*y + (2*u *v )*y + (u *v )*y }},
  295. {u <> 0 and v = 0,
  296. 2 3 3 5 4 2 2
  297. {(u*v)*x *y + (u *v)*x*y - u *y - u *y ,
  298. 2
  299. u*x + v*x*y + x,
  300. 2 2
  301. x + u*y ,
  302. 2 2
  303. v*x*y + x - u *y }},
  304. {v <> 0 and u = 0,
  305. 2 2 2
  306. {u*x + v*x*y + x,x + u*y }},
  307. {u = 0 and v = 0,
  308. 2 2 2
  309. {u*x + v*x*y + x,x + u*y }}}
  310. torder oo;
  311. {{x,y},lex}
  312. % Weispfenning's Example 7.3
  313. oo := torder({x1,x2,x3,x4},lex);
  314. oo := {{},lex}
  315. gsys {x4 - (a4-a2),x1 + x2 + x3 + x4 + (a1 + a3 + a4),
  316. x1*x3 + x1*x4 + x2*x3 + x3*x4 - (a1*a4 + a1*a3 + a3*a4),x1*x3*x4 - a1*a3*a4};
  317. 2 2 3 2 2
  318. {{a1*a2 - a1*a2*a3 - 3*a1*a2*a4 + 2*a1*a4 - a2 + a2 *a3 + 4*a2 *a4
  319. 2 2 3
  320. - 3*a2*a3*a4 - 5*a2*a4 + 2*a3*a4 + 2*a4 <> 0 and a2 - a4 = 0,
  321. 2
  322. {(a2 - a4)*x2*x3 - (a2 - a4)*x2*x4 + (a1*a2 - a1*a2*a3 - 3*a1*a2*a4
  323. 2 3 2 2 2 2
  324. + 2*a1*a4 - a2 + a2 *a3 + 4*a2 *a4 - 3*a2*a3*a4 - 5*a2*a4 + 2*a3*a4
  325. 3
  326. + 2*a4 )}},
  327. {a2 - a4 <> 0,
  328. {x1*x3*x4 - a1*a3*a4,
  329. x1*x3 + x1*x4 + x2*x3 + x3*x4 - (a1*a3 + a1*a4 + a3*a4),
  330. x1 + x2 + x3 + x4 + (a1 + a3 + a4),
  331. 2
  332. (a2 - a4)*x2 - x3 - (a1 - a2 + a3 + 2*a4)*x3
  333. 2 2
  334. + (a1*a2 - a1*a3 - 2*a1*a4 - a2 + a2*a3 + 3*a2*a4 - 2*a3*a4 - 2*a4 ),
  335. 3 2
  336. x3 + (a1 + a3 + a4)*x3 + (a1*a3 + a1*a4 + a3*a4)*x3 - a1*a3*a4,
  337. x4 + (a2 - a4)}},
  338. 2 2 3 2 2
  339. {a1*a2 - a1*a2*a3 - 3*a1*a2*a4 + 2*a1*a4 - a2 + a2 *a3 + 4*a2 *a4
  340. 2 2 3
  341. - 3*a2*a3*a4 - 5*a2*a4 + 2*a3*a4 + 2*a4 = 0 and a2 - a4 = 0,
  342. {x1*x3*x4 - a1*a3*a4,
  343. x1*x3 + x1*x4 + x2*x3 + x3*x4 - (a1*a3 + a1*a4 + a3*a4),
  344. x1 + x2 + x3 + x4 + (a1 + a3 + a4),
  345. 2
  346. (a2 - a4)*x2 - x3 - (a1 - a2 + a3 + 2*a4)*x3
  347. 2 2
  348. + (a1*a2 - a1*a3 - 2*a1*a4 - a2 + a2*a3 + 3*a2*a4 - 2*a3*a4 - 2*a4 ),
  349. x4 + (a2 - a4)}}}
  350. torder oo;
  351. {{x1,x2,x3,x4},lex}
  352. % Pesch's example (Circle through three points)
  353. oo := torder({y,x},revgradlex);
  354. oo := {{},lex}
  355. gsys({2*b2*y + 2*a2*x - b2**2 + a2**2,2*b1*y + 2*a1*x - b1**2 + a1**2});
  356. 2 2 2 2
  357. {{a1 *a2 - a1*a2 + a1*b2 - a2*b1 <> 0 and a1 <> 0 and a2 <> 0 and b1 = 0
  358. and b2 = 0,
  359. 2 2 2 2
  360. {(2*a1*b2 - 2*a2*b1)*y - (a1 *a2 - a1*a2 + a1*b2 - a2*b1 )}},
  361. 2 2 2 2
  362. {a1 *b2 - a2 *b1 - b1 *b2 + b1*b2 <> 0 and b1 <> 0 and b2 <> 0
  363. and a1*b2 - a2*b1 = 0,
  364. 2 2 2 2
  365. {(2*a1*b2 - 2*a2*b1)*x + (a1 *b2 - a2 *b1 - b1 *b2 + b1*b2 )}},
  366. 2 2
  367. {a1 - b1 <> 0 and a1 = 0 and b1 = 0,
  368. 2 2
  369. {(2*b1)*y + (2*a1)*x + (a1 - b1 )}},
  370. {a1*b2 - a2*b1 <> 0 and b1 <> 0 and b2 <> 0,
  371. 2 2
  372. {(2*b1)*y + (2*a1)*x + (a1 - b1 ),
  373. 2 2
  374. (2*b2)*y + (2*a2)*x + (a2 - b2 ),
  375. 2 2 2 2
  376. (2*a1*b2 - 2*a2*b1)*x + (a1 *b2 - a2 *b1 - b1 *b2 + b1*b2 )}},
  377. 2 2
  378. {a1 <> 0 and a2 - b2 <> 0 and a2 = 0 and b1 = 0 and b2 = 0,
  379. 2 2
  380. {(2*b2)*y + (2*a2)*x + (a2 - b2 )}},
  381. 2 2 2 2
  382. {a1 <> 0 and a2 <> 0 and a1 *a2 - a1*a2 + a1*b2 - a2*b1 = 0 and b1 = 0
  383. and b2 = 0,
  384. 2 2
  385. {(2*b1)*y + (2*a1)*x + (a1 - b1 ),
  386. 2 2
  387. (2*b2)*y + (2*a2)*x + (a2 - b2 )}},
  388. {a1 <> 0 and b2 <> 0 and b1 = 0,
  389. 2 2
  390. {(2*b1)*y + (2*a1)*x + (a1 - b1 ),
  391. 2 2
  392. (2*b2)*y + (2*a2)*x + (a2 - b2 )}},
  393. 2 2
  394. {a1 <> 0 and a2 - b2 = 0 and a2 = 0 and b1 = 0 and b2 = 0,
  395. 2 2
  396. {(2*b1)*y + (2*a1)*x + (a1 - b1 )}},
  397. 2 2
  398. {a2 - b2 <> 0 and b1 <> 0 and a2 = 0 and b2 = 0,
  399. 2 2
  400. {(2*b2)*y + (2*a2)*x + (a2 - b2 )}},
  401. 2 2 2 2
  402. {a2 - b2 <> 0 and a1 - b1 = 0 and a1 = 0 and a2 = 0 and b1 = 0 and b2 = 0,
  403. 2 2
  404. {(2*b2)*y + (2*a2)*x + (a2 - b2 )}},
  405. {a2 <> 0 and b1 <> 0 and b2 = 0,
  406. 2 2
  407. {(2*b1)*y + (2*a1)*x + (a1 - b1 ),
  408. 2 2
  409. (2*b2)*y + (2*a2)*x + (a2 - b2 )}},
  410. 2 2
  411. {a2 <> 0 and a1 - b1 = 0 and a1 = 0 and b1 = 0 and b2 = 0,
  412. 2 2
  413. {(2*b2)*y + (2*a2)*x + (a2 - b2 )}},
  414. 2 2 2 2
  415. {b1 <> 0 and b2 <> 0 and a1 *b2 - a2 *b1 - b1 *b2 + b1*b2 = 0
  416. and a1*b2 - a2*b1 = 0,
  417. 2 2
  418. {(2*b1)*y + (2*a1)*x + (a1 - b1 ),
  419. 2 2
  420. (2*b2)*y + (2*a2)*x + (a2 - b2 )}},
  421. 2 2
  422. {b1 <> 0 and a2 - b2 = 0 and a2 = 0 and b2 = 0,
  423. 2 2
  424. {(2*b1)*y + (2*a1)*x + (a1 - b1 )}},
  425. 2 2
  426. {b2 <> 0 and a1 - b1 = 0 and a1 = 0 and b1 = 0,
  427. 2 2
  428. {(2*b2)*y + (2*a2)*x + (a2 - b2 )}},
  429. 2 2 2 2
  430. {a1 - b1 = 0 and a1 = 0 and a2 - b2 = 0 and a2 = 0 and b1 = 0 and b2 = 0,
  431. {}}}
  432. torder oo;
  433. {{y,x},revgradlex}
  434. % Effelterre's example (Aspect graphs)
  435. f1 := -4-4*v**2-4*u**2+40*v*v1+24*v-120*v1+8*u-40*v2-68*v1**2-100*v2**2+40*u*v2+
  436. 24*v1*v2-4*v1**2*u-4*v2**2*v**2+24*v2**2*v-24*v1*u*v2+8*v*v1*u*v2$
  437. f2 := 8*v*v1*u*v2-4*v1**2*u**2+4*v1**2-4*v2**2*v**2+4*v2**2-16*v**2-16*u**2+16$
  438. f3 := 16*v-48*u+16*v*v1**2-48*u*v2**2-12*v1**2*u+4*v2**2*v-36*v*v1*v2+
  439. 12*v1*u*v2+12*v*v2**2*u-
  440. 80*u*v1+80*v2*v-20*v1*u*v2**2+20*v2*v*v1**2-20*v1**3*u+20*v2**3*v-12*v1**2*v*u+
  441. 12*v2*v**2*v1-12*v1*u**2*v2$
  442. f4 := -160u*v2-1596v2**2+3200*v2-1596-4*u**2+160*u$
  443. % Special case I2, v1=0
  444. oo := torder({v,u},lex);
  445. oo := {{},lex}
  446. gsys(sub(v1=0,{f1,f2,f4}));
  447. 16 15 14
  448. {{1000557799569*v2 - 8971728968760*v2 + 32332553961916*v2
  449. 13 12 11
  450. - 56816638983720*v2 + 43557281160966*v2 - 2232864400680*v2
  451. 10 9 8
  452. - 2141149653636*v2 - 24710286679320*v2 + 22557177598385*v2
  453. 7 6 5
  454. - 4364899181280*v2 + 1970637124608*v2 - 2915313822720*v2
  455. 4 3 2
  456. + 1467702460416*v2 - 1340557025280*v2 + 685570158592*v2 - 140796887040*v2
  457. 7 6 5 4
  458. + 63647907840 <> 0 and 55175*v2 - 184787*v2 + 144885*v2 + 44895*v2
  459. 3 2
  460. - 13020*v2 - 35580*v2 + 320*v2 - 6368 <> 0,
  461. 16 15 14
  462. {1000557799569*v2 - 8971728968760*v2 + 32332553961916*v2
  463. 13 12 11
  464. - 56816638983720*v2 + 43557281160966*v2 - 2232864400680*v2
  465. 10 9 8
  466. - 2141149653636*v2 - 24710286679320*v2 + 22557177598385*v2
  467. 7 6 5
  468. - 4364899181280*v2 + 1970637124608*v2 - 2915313822720*v2
  469. 4 3 2
  470. + 1467702460416*v2 - 1340557025280*v2 + 685570158592*v2 - 140796887040*v2
  471. + 63647907840}},
  472. 8 7 6 5 4
  473. {3389663*v2 - 14658420*v2 + 20230730*v2 - 6945060*v2 - 3218385*v2
  474. 3 2 7
  475. - 497040*v2 + 1656704*v2 - 257280*v2 + 255872 <> 0 and 55175*v2
  476. 6 5 4 3 2
  477. - 184787*v2 + 144885*v2 + 44895*v2 - 13020*v2 - 35580*v2 + 320*v2 - 6368
  478. = 0,
  479. 7 6 5 4 3 2
  480. {(220700*v2 - 739148*v2 + 579540*v2 + 179580*v2 - 52080*v2 - 142320*v2
  481. 8 7 6
  482. + 1280*v2 - 25472)*u + (3389663*v2 - 14658420*v2 + 20230730*v2
  483. 5 4 3 2
  484. - 6945060*v2 - 3218385*v2 - 497040*v2 + 1656704*v2 - 257280*v2
  485. + 255872)}},
  486. 7 6 5 4 3 2
  487. {55175*v2 - 184787*v2 + 144885*v2 + 44895*v2 - 13020*v2 - 35580*v2
  488. 16 15
  489. + 320*v2 - 6368 <> 0 and 1000557799569*v2 - 8971728968760*v2
  490. 14 13 12
  491. + 32332553961916*v2 - 56816638983720*v2 + 43557281160966*v2
  492. 11 10 9
  493. - 2232864400680*v2 - 2141149653636*v2 - 24710286679320*v2
  494. 8 7 6
  495. + 22557177598385*v2 - 4364899181280*v2 + 1970637124608*v2
  496. 5 4 3
  497. - 2915313822720*v2 + 1467702460416*v2 - 1340557025280*v2
  498. 2
  499. + 685570158592*v2 - 140796887040*v2 + 63647907840 = 0,
  500. 2 2 2 2 2
  501. {(v2 + 1)*v - (6*v2 + 6)*v + u - (10*v2 + 2)*u + (25*v2 + 10*v2 + 1),
  502. 2 2 2 2
  503. (v2 + 4)*v + 4*u - (v2 + 4),
  504. 4 2 3 2
  505. (6*v2 + 30*v2 + 24)*v - (110*v2 - 122*v2 - 40*v2 - 8)*u
  506. 4 3 2
  507. - (1223*v2 - 2390*v2 + 1303*v2 + 40*v2 + 8),
  508. 2 2
  509. u + (40*v2 - 40)*u + (399*v2 - 800*v2 + 399),
  510. 7 6 5 4 3 2
  511. (220700*v2 - 739148*v2 + 579540*v2 + 179580*v2 - 52080*v2 - 142320*v2
  512. 8 7 6
  513. + 1280*v2 - 25472)*u + (3389663*v2 - 14658420*v2 + 20230730*v2
  514. 5 4 3 2
  515. - 6945060*v2 - 3218385*v2 - 497040*v2 + 1656704*v2 - 257280*v2
  516. + 255872)}},
  517. 8 7 6 5 4
  518. {3389663*v2 - 14658420*v2 + 20230730*v2 - 6945060*v2 - 3218385*v2
  519. 3 2 7
  520. - 497040*v2 + 1656704*v2 - 257280*v2 + 255872 = 0 and 55175*v2
  521. 6 5 4 3 2
  522. - 184787*v2 + 144885*v2 + 44895*v2 - 13020*v2 - 35580*v2 + 320*v2 - 6368
  523. = 0,
  524. 2 2 2 2 2
  525. {(v2 + 1)*v - (6*v2 + 6)*v + u - (10*v2 + 2)*u + (25*v2 + 10*v2 + 1),
  526. 2 2 2 2
  527. (v2 + 4)*v + 4*u - (v2 + 4),
  528. 4 2 3 2
  529. (6*v2 + 30*v2 + 24)*v - (110*v2 - 122*v2 - 40*v2 - 8)*u
  530. 4 3 2
  531. - (1223*v2 - 2390*v2 + 1303*v2 + 40*v2 + 8),
  532. 2 2
  533. u + (40*v2 - 40)*u + (399*v2 - 800*v2 + 399)}}}
  534. torder oo;
  535. {{v,u},lex}
  536. clear f1,f2,f3,f4;
  537. % Sit's Example 2.2
  538. oo := torder({z2,z2},revgradlex);
  539. oo := {{},lex}
  540. gsys({d*z2 + c*z1 - v,b*z2 + a*z1 - u});
  541. {{a*d*z1 - b*c*z1 + b*v - d*u <> 0 and b <> 0 and d <> 0,
  542. {a*d*z1 - b*c*z1 + b*v - d*u}},
  543. {a*z1 - u <> 0 and b = 0,
  544. {b*z2 + (a*z1 - u)}},
  545. {b <> 0 and c*z1 - v <> 0 and d = 0,
  546. {d*z2 + (c*z1 - v)}},
  547. {b <> 0 and d <> 0 and a*d*z1 - b*c*z1 + b*v - d*u = 0,
  548. {b*z2 + (a*z1 - u),d*z2 + (c*z1 - v)}},
  549. {b <> 0 and c*z1 - v = 0 and d = 0,
  550. {b*z2 + (a*z1 - u)}},
  551. {c*z1 - v <> 0 and a*z1 - u = 0 and b = 0 and d = 0,
  552. {d*z2 + (c*z1 - v)}},
  553. {d <> 0 and a*z1 - u = 0 and b = 0,
  554. {d*z2 + (c*z1 - v)}},
  555. {a*z1 - u = 0 and b = 0 and c*z1 - v = 0 and d = 0,
  556. {}}}
  557. torder oo;
  558. {{z2,z2},revgradlex}
  559. % Sit's Example 2.3
  560. oo := torder({z2,z2},revgradlex);
  561. oo := {{},lex}
  562. gsys({x**3*z2 + (x**2+1)*z1,x**2*z2 + x*z1 - 1});
  563. 2
  564. {{x *z1 + z1 <> 0 and x = 0,
  565. 3 2
  566. {x *z2 + (x *z1 + z1)}},
  567. 2
  568. {x*z1 - 1 <> 0 and x *z1 + z1 = 0 and x = 0,
  569. 2
  570. {x *z2 + (x*z1 - 1)}},
  571. {x + z1 <> 0 and x <> 0,{x + z1}},
  572. {x <> 0 and x + z1 = 0,
  573. 3 2 2
  574. {x *z2 + (x *z1 + z1),x *z2 + (x*z1 - 1)}},
  575. 2
  576. {x *z1 + z1 = 0 and x*z1 - 1 = 0 and x = 0,{}}}
  577. torder oo;
  578. {{z2,z2},revgradlex}
  579. % Sit's Example 3.3
  580. oo := torder({z3,z2,z2},revgradlex);
  581. oo := {{},lex}
  582. gsys({z3 + b*z2 + a*z1 - 1,a*z3 + z2 + b*z1 - 1,b*z3 + a*z2 + z1 - 1});
  583. 3 2
  584. {{a *z1 - a - 2*a*b*z1 + a*b + a + z1 - 1 <> 0 and a <> 0 and b = 0,
  585. 2 3 2
  586. {(a*b - b)*z3 - (a *z1 - a - 2*a*b*z1 + a*b + a + z1 - 1)}},
  587. 3 2 3 2 2
  588. {a *z1 - a - 3*a*b*z1 + a*b + a + b *z1 - b + b + z1 - 1 <> 0 and a - b <> 0
  589. and a <> 0 and b <> 0,
  590. 3 2 3 2
  591. {a *z1 - a - 3*a*b*z1 + a*b + a + b *z1 - b + b + z1 - 1}},
  592. 2
  593. {a *z1 - a - b*z1 + 1 <> 0 and a <> 0 and b <> 0 and a*b*z1 - b - z1 + 1 = 0
  594. 2
  595. and a*b - 1 = 0 and a - b = 0,
  596. 2
  597. {(a*b - 1)*z2 + (a *z1 - a - b*z1 + 1)}},
  598. 3 2
  599. {2*a*b*z1 - a - b *z1 + b - b - z1 + 1 <> 0 and b <> 0 and a = 0,
  600. 2 2 3 2
  601. {(a - a*b )*z3 + (2*a*b*z1 - a - b *z1 + b - b - z1 + 1)}},
  602. 2
  603. {a*b*z1 - b - z1 + 1 <> 0 and a <> 0 and b <> 0 and a - b = 0,
  604. 2
  605. {(a - b )*z2 - (a*b*z1 - b - z1 + 1)}},
  606. 2
  607. {a*b - 1 <> 0 and a <> 0 and b <> 0 and a*b*z1 - b - z1 + 1 = 0 and a - b = 0,
  608. {z3 + b*z2 + (a*z1 - 1),
  609. b*z3 + a*z2 + (z1 - 1),
  610. a*z3 + z2 + (b*z1 - 1),
  611. 2
  612. (a*b - 1)*z2 + (a *z1 - a - b*z1 + 1)}},
  613. 2
  614. {a - b <> 0 and a <> 0 and b <> 0
  615. 3 2 3 2
  616. and a *z1 - a - 3*a*b*z1 + a*b + a + b *z1 - b + b + z1 - 1 = 0,
  617. {z3 + b*z2 + (a*z1 - 1),
  618. b*z3 + a*z2 + (z1 - 1),
  619. a*z3 + z2 + (b*z1 - 1),
  620. 2
  621. (a - b )*z2 - (a*b*z1 - b - z1 + 1)}},
  622. 2
  623. {a <> 0 and b <> 0 and a *z1 - a - b*z1 + 1 = 0 and a*b*z1 - b - z1 + 1 = 0
  624. 2
  625. and a*b - 1 = 0 and a - b = 0,
  626. {z3 + b*z2 + (a*z1 - 1),
  627. b*z3 + a*z2 + (z1 - 1),
  628. a*z3 + z2 + (b*z1 - 1)}},
  629. 3 2
  630. {a <> 0 and a *z1 - a - 2*a*b*z1 + a*b + a + z1 - 1 = 0 and b = 0,
  631. {z3 + b*z2 + (a*z1 - 1),
  632. b*z3 + a*z2 + (z1 - 1),
  633. a*z3 + z2 + (b*z1 - 1)}},
  634. 3 2
  635. {b <> 0 and 2*a*b*z1 - a - b *z1 + b - b - z1 + 1 = 0 and a = 0,
  636. {z3 + b*z2 + (a*z1 - 1),
  637. b*z3 + a*z2 + (z1 - 1),
  638. a*z3 + z2 + (b*z1 - 1)}},
  639. {z1 - 1 <> 0 and a = 0 and b = 0,
  640. {b*z3 + a*z2 + (z1 - 1)}},
  641. {a = 0 and b = 0 and z1 - 1 = 0,
  642. {z3 + b*z2 + (a*z1 - 1),a*z3 + z2 + (b*z1 - 1)}}}
  643. torder oo;
  644. {{z3,z2,z2},revgradlex}
  645. % Sit's Example 8.3
  646. oo := torder({z4,z3,z2,z2},revgradlex);
  647. oo := {{},lex}
  648. gsys({z4 + c*z3 + b*z2 + a*z1 - w2,2*z4 + z2 - w1,a*z4 - z3 - w4,d*z4 + z3 +
  649. 2*z1 - w3,z4 + z1 - w5});
  650. 3 2 2 2 2 2 2 2 2
  651. {{a *c*z1 + a *b*c*w1 + a *c *w3 - 2*a *c *z1 + a *c*d*z1 - a *c*w2 + a *z1
  652. 2
  653. + a*b*c*d*w1 - 2*a*b*c*w3 - 2*a*b*c*w4 + 4*a*b*c*z1 + a*b*w1 - a*c *d*w4
  654. - a*c*d*w2 + 2*a*c*w3 + a*c*w4 - 4*a*c*z1 + a*d*z1 - a*w2 + b*d*w1 - 2*b*w3
  655. - 2*b*w4 + 4*b*z1 - c*d*w4 - d*w2 + w3 + w4 - 2*z1 <> 0 and a*b + b*d <> 0
  656. and a*c + 1 <> 0 and a <> 0 and d <> 0,
  657. 3 2 2 2 2 2 2 2 2
  658. {a *c*z1 + a *b*c*w1 + a *c *w3 - 2*a *c *z1 + a *c*d*z1 - a *c*w2 + a *z1
  659. 2
  660. + a*b*c*d*w1 - 2*a*b*c*w3 - 2*a*b*c*w4 + 4*a*b*c*z1 + a*b*w1 - a*c *d*w4
  661. - a*c*d*w2 + 2*a*c*w3 + a*c*w4 - 4*a*c*z1 + a*d*z1 - a*w2 + b*d*w1 - 2*b*w3
  662. - 2*b*w4 + 4*b*z1 - c*d*w4 - d*w2 + w3 + w4 - 2*z1}},
  663. 3 2 2 2 2
  664. {a *c*z1 + a *b*c*w1 - a *c*w2 - a *c*w5 + a *c*z1 - 2*a*b*c*w4 + 2*a*b*w5
  665. - 2*a*b*z1 + 2*a*c*w4 - a*w5 + a*z1 - 2*b*w4 + w4 <> 0 and a*b <> 0
  666. and a*c - 2*b + 1 <> 0 and a <> 0 and d <> 0 and a*c + 1 = 0
  667. and a*w3 - 2*a*z1 - d*w4 = 0 and a + d = 0,
  668. 2 2 3 2 2
  669. {(a *c - 2*a*b*c + 2*a*c - 2*b + 1)*z3 + (a *c*z1 + a *b*c*w1 - a *c*w2
  670. 2 2
  671. - a *c*w5 + a *c*z1 - 2*a*b*c*w4 + 2*a*b*w5 - 2*a*b*z1 + 2*a*c*w4 - a*w5
  672. + a*z1 - 2*b*w4 + w4)}},
  673. 3 2 2 2 2 2
  674. {a *z1 + 2*a *b*c*w3 - 4*a *b*c*z1 + a *b*w1 + a *d*z1 - a *w2 - 2*a*b*c*d*w4
  675. + a*b*d*w1 - 2*a*b*w4 - a*d*w2 + a*w4 - 2*b*d*w4 + d*w4 <> 0 and a*b <> 0
  676. and a + d <> 0 and a <> 0 and d <> 0 and a*c + 1 = 0,
  677. 2 2 3
  678. {(2*a *b*c - a *c + 2*a*b*c*d + 2*a*b - a*c*d - a + 2*b*d - d)*z3 - (a *z1
  679. 2 2 2 2 2
  680. + 2*a *b*c*w3 - 4*a *b*c*z1 + a *b*w1 + a *d*z1 - a *w2 - 2*a*b*c*d*w4
  681. + a*b*d*w1 - 2*a*b*w4 - a*d*w2 + a*w4 - 2*b*d*w4 + d*w4)}},
  682. 2 2 2 2 2 2
  683. {a *c *w5 - a *c *z1 + a *c*z1 + a*b*c*w1 - 2*a*b*c*w5 + 2*a*b*c*z1 - a*c *w4
  684. - a*c*w2 + 2*a*c*w5 - 2*a*c*z1 + a*z1 + b*w1 - 2*b*w5 + 2*b*z1 - c*w4 - w2
  685. + w5 - z1 <> 0 and a*c - 2*b + 1 <> 0 and a*c + 1 <> 0 and a <> 0 and d <> 0
  686. 2
  687. and a *z1 + a*c*w3 - 2*a*c*z1 + a*d*z1 - a*w2 - c*d*w4 - d*w2 + w3 + w4 - 2*z1
  688. = 0 and a*b + b*d = 0,
  689. 2 2 2 2 2 2
  690. {a *c *w5 - a *c *z1 + a *c*z1 + a*b*c*w1 - 2*a*b*c*w5 + 2*a*b*c*z1 - a*c *w4
  691. - a*c*w2 + 2*a*c*w5 - 2*a*c*z1 + a*z1 + b*w1 - 2*b*w5 + 2*b*z1 - c*w4 - w2
  692. + w5 - z1}},
  693. 2 2 2 2
  694. {a *c*w3 - 2*a *c*z1 + a *w5 - a *z1 - a*c*d*w4 + a*d*w5 - a*d*z1 - a*w4 - d*w4
  695. 3
  696. <> 0 and a*b <> 0 and a + d <> 0 and a <> 0 and d <> 0 and a *z1
  697. 2 2 2 2 2
  698. + 2*a *b*c*w3 - 4*a *b*c*z1 + a *b*w1 + a *d*z1 - a *w2 - 2*a*b*c*d*w4
  699. + a*b*d*w1 - 2*a*b*w4 - a*d*w2 + a*w4 - 2*b*d*w4 + d*w4 = 0 and a*c + 1 = 0,
  700. 2 2 2 2 2
  701. {(a *c + a*c*d + a + d)*z3 - (a *c*w3 - 2*a *c*z1 + a *w5 - a *z1 - a*c*d*w4
  702. + a*d*w5 - a*d*z1 - a*w4 - d*w4)}},
  703. 2 2
  704. {a *c*w5 - a *c*z1 + a*c*d*w5 - a*c*d*z1 - a*c*w3 - a*c*w4 + 2*a*c*z1 + a*w5
  705. - a*z1 + d*w5 - d*z1 - w3 - w4 + 2*z1 <> 0 and a*b + b*d <> 0
  706. 3 2 2 2
  707. and a*c + 1 <> 0 and a <> 0 and d <> 0 and a *c*z1 + a *b*c*w1 + a *c *w3
  708. 2 2 2 2 2
  709. - 2*a *c *z1 + a *c*d*z1 - a *c*w2 + a *z1 + a*b*c*d*w1 - 2*a*b*c*w3
  710. 2
  711. - 2*a*b*c*w4 + 4*a*b*c*z1 + a*b*w1 - a*c *d*w4 - a*c*d*w2 + 2*a*c*w3 + a*c*w4
  712. - 4*a*c*z1 + a*d*z1 - a*w2 + b*d*w1 - 2*b*w3 - 2*b*w4 + 4*b*z1 - c*d*w4
  713. - d*w2 + w3 + w4 - 2*z1 = 0,
  714. 2 2
  715. {a *c*w5 - a *c*z1 + a*c*d*w5 - a*c*d*z1 - a*c*w3 - a*c*w4 + 2*a*c*z1 + a*w5
  716. - a*z1 + d*w5 - d*z1 - w3 - w4 + 2*z1}},
  717. 2
  718. {a *z1 + a*b*w1 + a*c*w3 - 2*a*c*z1 - a*w2 - 2*b*w3 - 2*b*w4 + 4*b*z1 + w3 + w4
  719. - 2*z1 <> 0 and a*b <> 0 and a <> 0 and d = 0,
  720. 2
  721. {(a*c*d - 2*b*d + d)*z4 - (a *z1 + a*b*w1 + a*c*w3 - 2*a*c*z1 - a*w2 - 2*b*w3
  722. - 2*b*w4 + 4*b*z1 + w3 + w4 - 2*z1)}},
  723. 2
  724. {a *z1 + a*b*w1 - a*w2 - 2*b*w4 + w4 <> 0 and a*b <> 0 and a <> 0 and d <> 0
  725. and a*c - 2*b + 1 = 0 and a*c + 1 = 0 and a*w3 - 2*a*z1 - d*w4 = 0
  726. and a + d = 0,
  727. 2
  728. {(a*c - 2*b + 1)*z3 + (a *z1 + a*b*w1 - a*w2 - 2*b*w4 + w4)}},
  729. 2
  730. {a *z1 + a*c*w3 - 2*a*c*z1 + a*d*z1 - a*w2 - c*d*w4 - d*w2 + w3 + w4 - 2*z1
  731. <> 0 and a*c + 1 <> 0 and a <> 0 and d <> 0 and a*b + b*d = 0,
  732. 2
  733. {(a*b + b*d)*z2 + (a *z1 + a*c*w3 - 2*a*c*z1 + a*d*z1 - a*w2 - c*d*w4 - d*w2
  734. + w3 + w4 - 2*z1)}},
  735. 2
  736. {a *z1 + a*c*w3 - 2*a*c*z1 - a*w2 + w3 + w4 - 2*z1 <> 0 and a <> 0 and a*b = 0
  737. and d = 0,
  738. {(a*c*d + d)*z4 - (a*b)*z2
  739. 2
  740. - (a *z1 + a*c*w3 - 2*a*c*z1 - a*w2 + w3 + w4 - 2*z1)}},
  741. 2
  742. {a *z1 - a*w2 + w4 <> 0 and a <> 0 and d <> 0 and a*b = 0 and a*c + 1 = 0,
  743. 2
  744. {(a*c + 1)*z3 + (a*b)*z2 + (a *z1 - a*w2 + w4)}},
  745. 3 2
  746. {a*b + b*d <> 0 and a*c + 1 <> 0 and a <> 0 and d <> 0 and a *c*z1 + a *b*c*w1
  747. 2 2 2 2 2 2 2
  748. + a *c *w3 - 2*a *c *z1 + a *c*d*z1 - a *c*w2 + a *z1 + a*b*c*d*w1
  749. 2
  750. - 2*a*b*c*w3 - 2*a*b*c*w4 + 4*a*b*c*z1 + a*b*w1 - a*c *d*w4 - a*c*d*w2
  751. + 2*a*c*w3 + a*c*w4 - 4*a*c*z1 + a*d*z1 - a*w2 + b*d*w1 - 2*b*w3 - 2*b*w4
  752. 2 2
  753. + 4*b*z1 - c*d*w4 - d*w2 + w3 + w4 - 2*z1 = 0 and a *c*w5 - a *c*z1
  754. + a*c*d*w5 - a*c*d*z1 - a*c*w3 - a*c*w4 + 2*a*c*z1 + a*w5 - a*z1 + d*w5
  755. - d*z1 - w3 - w4 + 2*z1 = 0,
  756. {z4 + c*z3 + b*z2 + (a*z1 - w2),
  757. a*z4 - z3 - w4,
  758. d*z4 + z3 - (w3 - 2*z1),
  759. 2*z4 + z2 - w1,
  760. z4 - (w5 - z1),
  761. 2
  762. (a*c + 1)*z3 + (a*b)*z2 + (a *z1 - a*w2 + w4),
  763. 2
  764. (a*b + b*d)*z2 + (a *z1 + a*c*w3 - 2*a*c*z1 + a*d*z1 - a*w2 - c*d*w4 - d*w2
  765. + w3 + w4 - 2*z1)}},
  766. 3 2
  767. {a*b <> 0 and a*c - 2*b + 1 <> 0 and a <> 0 and d <> 0 and a *c*z1 + a *b*c*w1
  768. 2 2 2
  769. - a *c*w2 - a *c*w5 + a *c*z1 - 2*a*b*c*w4 + 2*a*b*w5 - 2*a*b*z1 + 2*a*c*w4
  770. - a*w5 + a*z1 - 2*b*w4 + w4 = 0 and a*c + 1 = 0 and a*w3 - 2*a*z1 - d*w4 = 0
  771. and a + d = 0,
  772. {z4 + c*z3 + b*z2 + (a*z1 - w2),
  773. a*z4 - z3 - w4,
  774. d*z4 + z3 - (w3 - 2*z1),
  775. 2*z4 + z2 - w1,
  776. z4 - (w5 - z1),
  777. 2
  778. (a*c + 1)*z3 + (a*b)*z2 + (a *z1 - a*w2 + w4),
  779. 2
  780. (a*c - 2*b + 1)*z3 + (a *z1 + a*b*w1 - a*w2 - 2*b*w4 + w4)}},
  781. {a*b <> 0 and a*w3 - 2*a*z1 - d*w4 <> 0 and a <> 0 and d <> 0 and a*c + 1 = 0
  782. and a + d = 0,
  783. {(a + d)*z3 - (a*w3 - 2*a*z1 - d*w4)}},
  784. 2
  785. {a*b <> 0 and a*w5 - a*z1 - w3 - w4 + 2*z1 <> 0 and a <> 0 and a *z1 + a*b*w1
  786. + a*c*w3 - 2*a*c*z1 - a*w2 - 2*b*w3 - 2*b*w4 + 4*b*z1 + w3 + w4 - 2*z1 = 0
  787. and d = 0,
  788. {d*z4 + (a*w5 - a*z1 - w3 - w4 + 2*z1)}},
  789. 3 2
  790. {a*b <> 0 and a + d <> 0 and a <> 0 and d <> 0 and a *z1 + 2*a *b*c*w3
  791. 2 2 2 2
  792. - 4*a *b*c*z1 + a *b*w1 + a *d*z1 - a *w2 - 2*a*b*c*d*w4 + a*b*d*w1
  793. - 2*a*b*w4 - a*d*w2 + a*w4 - 2*b*d*w4 + d*w4 = 0 and
  794. 2 2 2 2
  795. a *c*w3 - 2*a *c*z1 + a *w5 - a *z1 - a*c*d*w4 + a*d*w5 - a*d*z1 - a*w4 - d*w4
  796. = 0 and a*c + 1 = 0,
  797. {z4 + c*z3 + b*z2 + (a*z1 - w2),
  798. a*z4 - z3 - w4,
  799. d*z4 + z3 - (w3 - 2*z1),
  800. 2*z4 + z2 - w1,
  801. z4 - (w5 - z1),
  802. 2
  803. (a*c + 1)*z3 + (a*b)*z2 + (a *z1 - a*w2 + w4),
  804. (a + d)*z3 - (a*w3 - 2*a*z1 - d*w4)}},
  805. 2
  806. {a*b <> 0 and a <> 0 and d <> 0 and a *z1 + a*b*w1 - a*w2 - 2*b*w4 + w4 = 0
  807. and a*c - 2*b + 1 = 0 and a*c + 1 = 0 and a*w3 - 2*a*z1 - d*w4 = 0
  808. and a + d = 0,
  809. {z4 + c*z3 + b*z2 + (a*z1 - w2),
  810. a*z4 - z3 - w4,
  811. d*z4 + z3 - (w3 - 2*z1),
  812. 2*z4 + z2 - w1,
  813. z4 - (w5 - z1),
  814. 2
  815. (a*c + 1)*z3 + (a*b)*z2 + (a *z1 - a*w2 + w4),
  816. z3 - (a*w5 - a*z1 - w4)}},
  817. 2
  818. {a*b <> 0 and a <> 0 and a *z1 + a*b*w1 + a*c*w3 - 2*a*c*z1 - a*w2 - 2*b*w3
  819. - 2*b*w4 + 4*b*z1 + w3 + w4 - 2*z1 = 0 and a*w5 - a*z1 - w3 - w4 + 2*z1 = 0
  820. and d = 0,
  821. {z4 + c*z3 + b*z2 + (a*z1 - w2),
  822. a*z4 - z3 - w4,
  823. d*z4 + z3 - (w3 - 2*z1),
  824. 2*z4 + z2 - w1,
  825. (a*c*d + d)*z4 - (a*b)*z2
  826. 2
  827. - (a *z1 + a*c*w3 - 2*a*c*z1 - a*w2 + w3 + w4 - 2*z1),
  828. z4 - (w5 - z1)}},
  829. 2 2
  830. {a*c*d *z1 + b*c*d *w1 - 2*b*c*d*w3 + 4*b*c*d*z1 - 2*b*d*w5 + 2*b*d*z1 + 2*b*w3
  831. 2 2 2
  832. - 4*b*z1 - c*d *w2 - c*d *w5 + c*d *z1 + 2*c*d*w3 - 4*c*d*z1 + d*w5 - d*z1
  833. - w3 + 2*z1 <> 0 and a <> 0 and b*d <> 0 and 2*b + c*d - 1 <> 0 and d <> 0
  834. 2
  835. and a *z1 - a*w2 + w4 = 0 and a*b = 0 and a*c + 1 = 0 and c*d - 1 = 0,
  836. 2 2 2 2
  837. {(2*b*c*d - 2*b + c *d - 2*c*d + 1)*z3 + (a*c*d *z1 + b*c*d *w1 - 2*b*c*d*w3
  838. 2 2
  839. + 4*b*c*d*z1 - 2*b*d*w5 + 2*b*d*z1 + 2*b*w3 - 4*b*z1 - c*d *w2 - c*d *w5
  840. 2
  841. + c*d *z1 + 2*c*d*w3 - 4*c*d*z1 + d*w5 - d*z1 - w3 + 2*z1)}},
  842. {a*c*d*z1 - a*z1 + b*c*d*w1 - 2*b*c*d*w5 + 2*b*c*d*z1 - b*w1 + 2*b*w5 - 2*b*z1
  843. 2 2 2 2 2 2
  844. - c *d *w5 + c *d *z1 + c *d*w3 - 2*c *d*z1 - c*d*w2 + 2*c*d*w5 - 2*c*d*z1
  845. - c*w3 + 2*c*z1 + w2 - w5 + z1 <> 0 and a <> 0 and 2*b + c*d - 1 <> 0
  846. 2
  847. and c*d - 1 <> 0 and d <> 0 and a *z1 - a*w2 + w4 = 0 and a*b = 0
  848. and a*c + 1 = 0,
  849. {a*c*d*z1 - a*z1 + b*c*d*w1 - 2*b*c*d*w5 + 2*b*c*d*z1 - b*w1 + 2*b*w5 - 2*b*z1
  850. 2 2 2 2 2 2
  851. - c *d *w5 + c *d *z1 + c *d*w3 - 2*c *d*z1 - c*d*w2 + 2*c*d*w5 - 2*c*d*z1
  852. - c*w3 + 2*c*z1 + w2 - w5 + z1}},
  853. {a*c*w1 + 2*a*z1 - 2*c*w4 + w1 - 2*w2 <> 0 and a*c + 1 <> 0 and a <> 0
  854. and d <> 0 and
  855. 2
  856. a *z1 + a*c*w3 - 2*a*c*z1 + a*d*z1 - a*w2 - c*d*w4 - d*w2 + w3 + w4 - 2*z1 = 0
  857. and a*b + b*d = 0 and a*c - 2*b + 1 = 0,
  858. {(a*c - 2*b + 1)*z2 - (a*c*w1 + 2*a*z1 - 2*c*w4 + w1 - 2*w2)}},
  859. {a*c*w5 - a*c*z1 + a*z1 - c*w4 - w2 + w5 - z1 <> 0 and a*c + 1 <> 0 and a <> 0
  860. and d <> 0 and
  861. 2
  862. a *z1 + a*c*w3 - 2*a*c*z1 + a*d*z1 - a*w2 - c*d*w4 - d*w2 + w3 + w4 - 2*z1 = 0
  863. and a*b + b*d = 0 and a*c*w1 + 2*a*z1 - 2*c*w4 + w1 - 2*w2 = 0
  864. and a*c - 2*b + 1 = 0 and b = 0,
  865. {b*z2 + (a*c*w5 - a*c*z1 + a*z1 - c*w4 - w2 + w5 - z1)}},
  866. 2 2
  867. {a*c - 2*b + 1 <> 0 and a*c + 1 <> 0 and a <> 0 and d <> 0 and a *c *w5
  868. 2 2 2 2
  869. - a *c *z1 + a *c*z1 + a*b*c*w1 - 2*a*b*c*w5 + 2*a*b*c*z1 - a*c *w4 - a*c*w2
  870. + 2*a*c*w5 - 2*a*c*z1 + a*z1 + b*w1 - 2*b*w5 + 2*b*z1 - c*w4 - w2 + w5 - z1
  871. = 0 and
  872. 2
  873. a *z1 + a*c*w3 - 2*a*c*z1 + a*d*z1 - a*w2 - c*d*w4 - d*w2 + w3 + w4 - 2*z1 = 0
  874. and a*b + b*d = 0,
  875. {z4 + c*z3 + b*z2 + (a*z1 - w2),
  876. a*z4 - z3 - w4,
  877. d*z4 + z3 - (w3 - 2*z1),
  878. 2*z4 + z2 - w1,
  879. z4 - (w5 - z1),
  880. 2
  881. (a*c + 1)*z3 + (a*b)*z2 + (a *z1 - a*w2 + w4),
  882. (a*c - 2*b + 1)*z2 - (a*c*w1 + 2*a*z1 - 2*c*w4 + w1 - 2*w2)}},
  883. {a*c + 1 <> 0 and a <> 0 and b <> 0 and d <> 0 and
  884. 2
  885. a *z1 + a*c*w3 - 2*a*c*z1 + a*d*z1 - a*w2 - c*d*w4 - d*w2 + w3 + w4 - 2*z1 = 0
  886. and a*b + b*d = 0 and a*c*w1 + 2*a*z1 - 2*c*w4 + w1 - 2*w2 = 0
  887. and a*c - 2*b + 1 = 0,
  888. {z4 + c*z3 + b*z2 + (a*z1 - w2),
  889. a*z4 - z3 - w4,
  890. d*z4 + z3 - (w3 - 2*z1),
  891. 2*z4 + z2 - w1,
  892. z4 - (w5 - z1),
  893. 2
  894. (a*c + 1)*z3 + (a*b)*z2 + (a *z1 - a*w2 + w4),
  895. b*z2 + (a*c*w5 - a*c*z1 + a*z1 - c*w4 - w2 + w5 - z1)}},
  896. {a*c + 1 <> 0 and a <> 0 and d <> 0 and
  897. 2
  898. a *z1 + a*c*w3 - 2*a*c*z1 + a*d*z1 - a*w2 - c*d*w4 - d*w2 + w3 + w4 - 2*z1 = 0
  899. and a*b + b*d = 0 and a*c*w1 + 2*a*z1 - 2*c*w4 + w1 - 2*w2 = 0
  900. and a*c*w5 - a*c*z1 + a*z1 - c*w4 - w2 + w5 - z1 = 0 and a*c - 2*b + 1 = 0
  901. and b = 0,
  902. {z4 + c*z3 + b*z2 + (a*z1 - w2),
  903. a*z4 - z3 - w4,
  904. d*z4 + z3 - (w3 - 2*z1),
  905. 2*z4 + z2 - w1,
  906. z4 - (w5 - z1),
  907. 2
  908. (a*c + 1)*z3 + (a*b)*z2 + (a *z1 - a*w2 + w4)}},
  909. {a*d*z1 + b*d*w1 - 2*b*w3 - 2*b*w4 + 4*b*z1 - c*d*w4 - d*w2 + w3 + w4 - 2*z1
  910. <> 0 and b*d <> 0 and d <> 0 and a = 0,
  911. {(2*a*b + a*c*d - a)*z4 + (a*d*z1 + b*d*w1 - 2*b*w3 - 2*b*w4 + 4*b*z1 - c*d*w4
  912. - d*w2 + w3 + w4 - 2*z1)}},
  913. {a*d*z1 + b*d*w1 - 2*b*w3 + 4*b*z1 - d*w2 + w3 - 2*z1 <> 0 and a <> 0
  914. 2
  915. and b*d <> 0 and d <> 0 and a *z1 - a*w2 + w4 = 0 and a*b = 0 and a*c + 1 = 0
  916. and 2*b + c*d - 1 = 0 and c*d - 1 = 0,
  917. {(2*b + c*d - 1)*z3 + (a*d*z1 + b*d*w1 - 2*b*w3 + 4*b*z1 - d*w2 + w3 - 2*z1)}}
  918. ,
  919. {a*d*z1 - c*d*w4 - d*w2 + w3 + w4 - 2*z1 <> 0 and d <> 0 and a = 0 and b*d = 0,
  920. {(a*c*d - a)*z4 + (b*d)*z2 + (a*d*z1 - c*d*w4 - d*w2 + w3 + w4 - 2*z1)}},
  921. 2
  922. {a*d*z1 - d*w2 + w3 - 2*z1 <> 0 and a <> 0 and d <> 0 and a *z1 - a*w2 + w4 = 0
  923. and a*b = 0 and a*c + 1 = 0 and b*d = 0 and c*d - 1 = 0,
  924. {(c*d - 1)*z3 + (b*d)*z2 + (a*d*z1 - d*w2 + w3 - 2*z1)}},
  925. {2*a*z1 - c*d*w1 + 2*c*w3 - 4*c*z1 + w1 - 2*w2 <> 0 and a <> 0 and c*d - 1 <> 0
  926. 2
  927. and d <> 0 and a *z1 - a*w2 + w4 = 0 and a*b = 0 and a*c + 1 = 0
  928. and 2*b + c*d - 1 = 0,
  929. {(2*b + c*d - 1)*z2 + (2*a*z1 - c*d*w1 + 2*c*w3 - 4*c*z1 + w1 - 2*w2)}},
  930. {2*a*z1 + 2*c*w3 - 4*c*z1 + w1 - 2*w2 <> 0 and a <> 0
  931. 2
  932. and a *z1 + a*c*w3 - 2*a*c*z1 - a*w2 + w3 + w4 - 2*z1 = 0 and a*b = 0
  933. and 2*b - 1 = 0 and d = 0,
  934. {(2*c*d)*z4 - (2*b - 1)*z2 - (2*a*z1 + 2*c*w3 - 4*c*z1 + w1 - 2*w2)}},
  935. {2*a*z1 - 2*c*w4 + w1 - 2*w2 <> 0 and d <> 0
  936. and a*d*z1 - c*d*w4 - d*w2 + w3 + w4 - 2*z1 = 0 and a = 0 and b*d = 0
  937. and 2*b - 1 = 0,
  938. {(2*a*c)*z4 + (2*b - 1)*z2 + (2*a*z1 - 2*c*w4 + w1 - 2*w2)}},
  939. {2*a*z1 - 2*c*w4 + w1 - 2*w2 <> 0 and a = 0 and 2*b - 1 = 0 and d = 0
  940. and w3 + w4 - 2*z1 = 0,
  941. {(2*a*c)*z4 + (2*b - 1)*z2 + (2*a*z1 - 2*c*w4 + w1 - 2*w2)}},
  942. 2
  943. {2*a*z1 + w1 - 2*w2 <> 0 and a <> 0 and d <> 0 and a *z1 - a*w2 + w4 = 0
  944. and a*b = 0 and a*c + 1 = 0 and a*d*z1 - d*w2 + w3 - 2*z1 = 0 and b*d = 0
  945. and 2*b - 1 = 0 and c*d - 1 = 0 and c = 0,
  946. {(2*c)*z3 + (2*b - 1)*z2 + (2*a*z1 + w1 - 2*w2)}},
  947. {a*z1 + b*w1 - 2*b*w5 + 2*b*z1 + c*w3 - 2*c*z1 - w2 + w5 - z1 <> 0 and a <> 0
  948. 2
  949. and 2*b - 1 <> 0 and a *z1 + a*c*w3 - 2*a*c*z1 - a*w2 + w3 + w4 - 2*z1 = 0
  950. and a*b = 0 and d = 0,
  951. {(c*d)*z4 - (a*z1 + b*w1 - 2*b*w5 + 2*b*z1 + c*w3 - 2*c*z1 - w2 + w5 - z1)}},
  952. {a*z1 + b*w1 - 2*b*w5 + 2*b*z1 - c*w4 - w2 + w5 - z1 <> 0 and 2*b - 1 <> 0
  953. and d <> 0 and a*d*z1 - c*d*w4 - d*w2 + w3 + w4 - 2*z1 = 0 and a = 0
  954. and b*d = 0,
  955. {(a*c)*z4 + (a*z1 + b*w1 - 2*b*w5 + 2*b*z1 - c*w4 - w2 + w5 - z1)}},
  956. {a*z1 + b*w1 - 2*b*w5 + 2*b*z1 - c*w4 - w2 + w5 - z1 <> 0 and 2*b - 1 <> 0
  957. and a = 0 and d = 0 and w3 + w4 - 2*z1 = 0,
  958. {(a*c)*z4 + (a*z1 + b*w1 - 2*b*w5 + 2*b*z1 - c*w4 - w2 + w5 - z1)}},
  959. {a*z1 + b*w1 - 2*b*w5 + 2*b*z1 - w2 + w5 - z1 <> 0 and a <> 0 and 2*b - 1 <> 0
  960. 2
  961. and d <> 0 and a *z1 - a*w2 + w4 = 0 and a*b = 0 and a*c + 1 = 0
  962. and a*d*z1 - d*w2 + w3 - 2*z1 = 0 and b*d = 0 and c*d - 1 = 0 and c = 0,
  963. {c*z3 + (a*z1 + b*w1 - 2*b*w5 + 2*b*z1 - w2 + w5 - z1)}},
  964. {a*z1 - c*d*w5 + c*d*z1 + c*w3 - 2*c*z1 - w2 + w5 - z1 <> 0 and a <> 0
  965. 2
  966. and c*d - 1 <> 0 and d <> 0 and a *z1 - a*w2 + w4 = 0 and a*b = 0
  967. and a*c + 1 = 0 and 2*a*z1 - c*d*w1 + 2*c*w3 - 4*c*z1 + w1 - 2*w2 = 0
  968. and 2*b + c*d - 1 = 0 and b = 0,
  969. {b*z2 + (a*z1 - c*d*w5 + c*d*z1 + c*w3 - 2*c*z1 - w2 + w5 - z1)}},
  970. {a <> 0 and b*d <> 0 and 2*b + c*d - 1 <> 0 and d <> 0
  971. 2 2 2
  972. and a *z1 - a*w2 + w4 = 0 and a*b = 0 and a*c*d *z1 + b*c*d *w1 - 2*b*c*d*w3
  973. 2 2
  974. + 4*b*c*d*z1 - 2*b*d*w5 + 2*b*d*z1 + 2*b*w3 - 4*b*z1 - c*d *w2 - c*d *w5
  975. 2
  976. + c*d *z1 + 2*c*d*w3 - 4*c*d*z1 + d*w5 - d*z1 - w3 + 2*z1 = 0 and a*c + 1 = 0
  977. and c*d - 1 = 0,
  978. {z4 + c*z3 + b*z2 + (a*z1 - w2),
  979. a*z4 - z3 - w4,
  980. d*z4 + z3 - (w3 - 2*z1),
  981. 2*z4 + z2 - w1,
  982. z4 - (w5 - z1),
  983. (c*d - 1)*z3 + (b*d)*z2 + (a*d*z1 - d*w2 + w3 - 2*z1),
  984. (2*b + c*d - 1)*z3 + (a*d*z1 + b*d*w1 - 2*b*w3 + 4*b*z1 - d*w2 + w3 - 2*z1)}}
  985. ,
  986. 2
  987. {a <> 0 and b*d <> 0 and d <> 0 and a *z1 - a*w2 + w4 = 0 and a*b = 0
  988. and a*c + 1 = 0 and a*d*z1 + b*d*w1 - 2*b*w3 + 4*b*z1 - d*w2 + w3 - 2*z1 = 0
  989. and 2*b + c*d - 1 = 0 and c*d - 1 = 0,
  990. {z4 + c*z3 + b*z2 + (a*z1 - w2),
  991. a*z4 - z3 - w4,
  992. d*z4 + z3 - (w3 - 2*z1),
  993. 2*z4 + z2 - w1,
  994. z4 - (w5 - z1),
  995. (c*d - 1)*z3 + (b*d)*z2 + (a*d*z1 - d*w2 + w3 - 2*z1),
  996. z3 + (d*w5 - d*z1 - w3 + 2*z1)}},
  997. {a <> 0 and 2*b + c*d - 1 <> 0 and c*d - 1 <> 0 and d <> 0
  998. 2
  999. and a *z1 - a*w2 + w4 = 0 and a*b = 0 and a*c*d*z1 - a*z1 + b*c*d*w1
  1000. 2 2 2 2
  1001. - 2*b*c*d*w5 + 2*b*c*d*z1 - b*w1 + 2*b*w5 - 2*b*z1 - c *d *w5 + c *d *z1
  1002. 2 2
  1003. + c *d*w3 - 2*c *d*z1 - c*d*w2 + 2*c*d*w5 - 2*c*d*z1 - c*w3 + 2*c*z1 + w2
  1004. - w5 + z1 = 0 and a*c + 1 = 0,
  1005. {z4 + c*z3 + b*z2 + (a*z1 - w2),
  1006. a*z4 - z3 - w4,
  1007. d*z4 + z3 - (w3 - 2*z1),
  1008. 2*z4 + z2 - w1,
  1009. z4 - (w5 - z1),
  1010. (c*d - 1)*z3 + (b*d)*z2 + (a*d*z1 - d*w2 + w3 - 2*z1),
  1011. (2*b + c*d - 1)*z2 + (2*a*z1 - c*d*w1 + 2*c*w3 - 4*c*z1 + w1 - 2*w2)}},
  1012. 2
  1013. {a <> 0 and 2*b - 1 <> 0 and d <> 0 and a *z1 - a*w2 + w4 = 0 and a*b = 0
  1014. and a*c + 1 = 0 and a*d*z1 - d*w2 + w3 - 2*z1 = 0
  1015. and a*z1 + b*w1 - 2*b*w5 + 2*b*z1 - w2 + w5 - z1 = 0 and b*d = 0
  1016. and c*d - 1 = 0 and c = 0,
  1017. {z4 + c*z3 + b*z2 + (a*z1 - w2),
  1018. a*z4 - z3 - w4,
  1019. d*z4 + z3 - (w3 - 2*z1),
  1020. 2*z4 + z2 - w1,
  1021. z4 - (w5 - z1),
  1022. (2*c)*z3 + (2*b - 1)*z2 + (2*a*z1 + w1 - 2*w2)}},
  1023. {a <> 0 and 2*b - 1 <> 0
  1024. 2
  1025. and a *z1 + a*c*w3 - 2*a*c*z1 - a*w2 + w3 + w4 - 2*z1 = 0 and a*b = 0
  1026. and a*z1 + b*w1 - 2*b*w5 + 2*b*z1 + c*w3 - 2*c*z1 - w2 + w5 - z1 = 0
  1027. and d = 0,
  1028. {z4 + c*z3 + b*z2 + (a*z1 - w2),
  1029. a*z4 - z3 - w4,
  1030. d*z4 + z3 - (w3 - 2*z1),
  1031. 2*z4 + z2 - w1,
  1032. (2*c*d)*z4 - (2*b - 1)*z2 - (2*a*z1 + 2*c*w3 - 4*c*z1 + w1 - 2*w2),
  1033. z4 - (w5 - z1)}},
  1034. 2
  1035. {a <> 0 and b <> 0 and c*d - 1 <> 0 and d <> 0 and a *z1 - a*w2 + w4 = 0
  1036. and a*b = 0 and a*c + 1 = 0
  1037. and 2*a*z1 - c*d*w1 + 2*c*w3 - 4*c*z1 + w1 - 2*w2 = 0 and 2*b + c*d - 1 = 0,
  1038. {z4 + c*z3 + b*z2 + (a*z1 - w2),
  1039. a*z4 - z3 - w4,
  1040. d*z4 + z3 - (w3 - 2*z1),
  1041. 2*z4 + z2 - w1,
  1042. z4 - (w5 - z1),
  1043. (c*d - 1)*z3 + (b*d)*z2 + (a*d*z1 - d*w2 + w3 - 2*z1),
  1044. b*z2 + (a*z1 - c*d*w5 + c*d*z1 + c*w3 - 2*c*z1 - w2 + w5 - z1)}},
  1045. 2
  1046. {a <> 0 and c*d - 1 <> 0 and d <> 0 and a *z1 - a*w2 + w4 = 0 and a*b = 0
  1047. and a*c + 1 = 0 and 2*a*z1 - c*d*w1 + 2*c*w3 - 4*c*z1 + w1 - 2*w2 = 0
  1048. and a*z1 - c*d*w5 + c*d*z1 + c*w3 - 2*c*z1 - w2 + w5 - z1 = 0
  1049. and 2*b + c*d - 1 = 0 and b = 0,
  1050. {z4 + c*z3 + b*z2 + (a*z1 - w2),
  1051. a*z4 - z3 - w4,
  1052. d*z4 + z3 - (w3 - 2*z1),
  1053. 2*z4 + z2 - w1,
  1054. z4 - (w5 - z1),
  1055. (c*d - 1)*z3 + (b*d)*z2 + (a*d*z1 - d*w2 + w3 - 2*z1)}},
  1056. 2
  1057. {a <> 0 and c <> 0 and d <> 0 and a *z1 - a*w2 + w4 = 0 and a*b = 0
  1058. and a*c + 1 = 0 and a*d*z1 - d*w2 + w3 - 2*z1 = 0 and b*d = 0 and c*d - 1 = 0
  1059. ,
  1060. {z4 + c*z3 + b*z2 + (a*z1 - w2),
  1061. a*z4 - z3 - w4,
  1062. d*z4 + z3 - (w3 - 2*z1),
  1063. 2*z4 + z2 - w1,
  1064. z4 - (w5 - z1),
  1065. (2*c)*z3 + (2*b - 1)*z2 + (2*a*z1 + w1 - 2*w2),
  1066. z2 - (w1 - 2*w5 + 2*z1)}},
  1067. 2
  1068. {a <> 0 and d <> 0 and a *z1 - a*w2 + w4 = 0 and a*b = 0 and a*c + 1 = 0
  1069. and a*d*z1 - d*w2 + w3 - 2*z1 = 0 and 2*a*z1 + w1 - 2*w2 = 0 and b*d = 0
  1070. and 2*b - 1 = 0 and c*d - 1 = 0 and c = 0,
  1071. {z4 + c*z3 + b*z2 + (a*z1 - w2),
  1072. a*z4 - z3 - w4,
  1073. d*z4 + z3 - (w3 - 2*z1),
  1074. 2*z4 + z2 - w1,
  1075. z4 - (w5 - z1),
  1076. c*z3 + b*z2 + (a*z1 - w2 + w5 - z1)}},
  1077. 2
  1078. {a <> 0 and a *z1 + a*c*w3 - 2*a*c*z1 - a*w2 + w3 + w4 - 2*z1 = 0 and a*b = 0
  1079. and 2*a*z1 + 2*c*w3 - 4*c*z1 + w1 - 2*w2 = 0 and 2*b - 1 = 0 and d = 0,
  1080. {z4 + c*z3 + b*z2 + (a*z1 - w2),
  1081. a*z4 - z3 - w4,
  1082. d*z4 + z3 - (w3 - 2*z1),
  1083. 2*z4 + z2 - w1,
  1084. (c*d)*z4 - b*z2 - (a*z1 + c*w3 - 2*c*z1 - w2 + w5 - z1),
  1085. z4 - (w5 - z1)}},
  1086. {b*d <> 0 and d*w5 - d*z1 - w3 - w4 + 2*z1 <> 0 and d <> 0 and
  1087. a*d*z1 + b*d*w1 - 2*b*w3 - 2*b*w4 + 4*b*z1 - c*d*w4 - d*w2 + w3 + w4 - 2*z1
  1088. = 0 and a = 0,
  1089. {a*z4 + (d*w5 - d*z1 - w3 - w4 + 2*z1)}},
  1090. {b*d <> 0 and d <> 0 and
  1091. a*d*z1 + b*d*w1 - 2*b*w3 - 2*b*w4 + 4*b*z1 - c*d*w4 - d*w2 + w3 + w4 - 2*z1
  1092. = 0 and a = 0 and d*w5 - d*z1 - w3 - w4 + 2*z1 = 0,
  1093. {z4 + c*z3 + b*z2 + (a*z1 - w2),
  1094. a*z4 - z3 - w4,
  1095. d*z4 + z3 - (w3 - 2*z1),
  1096. 2*z4 + z2 - w1,
  1097. (a*c*d - a)*z4 + (b*d)*z2 + (a*d*z1 - c*d*w4 - d*w2 + w3 + w4 - 2*z1),
  1098. z4 - (w5 - z1)}},
  1099. {2*b - 1 <> 0 and d <> 0 and a*d*z1 - c*d*w4 - d*w2 + w3 + w4 - 2*z1 = 0
  1100. and a*z1 + b*w1 - 2*b*w5 + 2*b*z1 - c*w4 - w2 + w5 - z1 = 0 and a = 0
  1101. and b*d = 0,
  1102. {z4 + c*z3 + b*z2 + (a*z1 - w2),
  1103. a*z4 - z3 - w4,
  1104. d*z4 + z3 - (w3 - 2*z1),
  1105. 2*z4 + z2 - w1,
  1106. (2*a*c)*z4 + (2*b - 1)*z2 + (2*a*z1 - 2*c*w4 + w1 - 2*w2),
  1107. z4 - (w5 - z1)}},
  1108. {2*b - 1 <> 0 and a*z1 + b*w1 - 2*b*w5 + 2*b*z1 - c*w4 - w2 + w5 - z1 = 0
  1109. and a = 0 and d = 0 and w3 + w4 - 2*z1 = 0,
  1110. {z4 + c*z3 + b*z2 + (a*z1 - w2),
  1111. a*z4 - z3 - w4,
  1112. d*z4 + z3 - (w3 - 2*z1),
  1113. 2*z4 + z2 - w1,
  1114. (2*a*c)*z4 + (2*b - 1)*z2 + (2*a*z1 - 2*c*w4 + w1 - 2*w2),
  1115. z4 - (w5 - z1)}},
  1116. {d <> 0 and a*d*z1 - c*d*w4 - d*w2 + w3 + w4 - 2*z1 = 0
  1117. and 2*a*z1 - 2*c*w4 + w1 - 2*w2 = 0 and a = 0 and b*d = 0 and 2*b - 1 = 0,
  1118. {z4 + c*z3 + b*z2 + (a*z1 - w2),
  1119. a*z4 - z3 - w4,
  1120. d*z4 + z3 - (w3 - 2*z1),
  1121. 2*z4 + z2 - w1,
  1122. (a*c)*z4 + b*z2 + (a*z1 - c*w4 - w2 + w5 - z1),
  1123. z4 - (w5 - z1)}},
  1124. {w3 + w4 - 2*z1 <> 0 and a = 0 and d = 0,
  1125. {(a + d)*z4 - (w3 + w4 - 2*z1)}},
  1126. {2*a*z1 - 2*c*w4 + w1 - 2*w2 = 0 and a = 0 and 2*b - 1 = 0 and d = 0
  1127. and w3 + w4 - 2*z1 = 0,
  1128. {z4 + c*z3 + b*z2 + (a*z1 - w2),
  1129. a*z4 - z3 - w4,
  1130. d*z4 + z3 - (w3 - 2*z1),
  1131. 2*z4 + z2 - w1,
  1132. (a*c)*z4 + b*z2 + (a*z1 - c*w4 - w2 + w5 - z1),
  1133. z4 - (w5 - z1)}}}
  1134. torder oo;
  1135. {{z4,z3,z2,z2},revgradlex}
  1136. % Two dimensional transportation problem
  1137. oo := torder({x33,x32,x31,x23,x22,x21,x13,x12,x11},lex);
  1138. oo := {{},lex}
  1139. gsys({x11+x12+x13-a1,x11+x21+x31-b1,x12+x22+x32-b2,x13+x23+x33-b3,
  1140. x21+x22+x23-a2,x31+x32+x33-a3});
  1141. {{a1 + a2 + a3 - b1 - b2 - b3 <> 0,
  1142. {a1 + a2 + a3 - b1 - b2 - b3}},
  1143. {a1 + a2 + a3 - b1 - b2 - b3 = 0,
  1144. {x33 + x32 + x31 - a3,
  1145. x33 + x23 + x13 - b3,
  1146. x32 + x22 + x12 - b2,
  1147. x31 + x21 + x11 - b1,
  1148. x23 + x22 + x21 - a2,
  1149. x13 + x12 + x11 - a1}}}
  1150. torder oo;
  1151. {{x33,x32,x31,x23,x22,x21,x13,x12,x11},lex}
  1152. % Thomas Weis's Example 1
  1153. oo := torder({x,y,z},lex);
  1154. oo := {{},lex}
  1155. gsys({z*y*x-b*y*x-b*z*x+b**2*x-b*z*y+b**2*y+b**2*z-(n3+b**3),
  1156. z*y*x-a*y*x-a*z*x+a**2*x-a*z*y+a**2*y+a**2*z-(n3+a**3),
  1157. z*y*x-n1});
  1158. 3 3
  1159. {{a *b - a*b + a*n1 - a*n3 - b*n1 + b*n3 <> 0 and a - b <> 0
  1160. 2 2
  1161. and a *b - a*b = 0,
  1162. 2 2 2 2 2 2
  1163. {(a *b - a*b )*x + (a *b - a*b )*y + (a *b - a*b )*z
  1164. 3 3
  1165. - (a *b - a*b + a*n1 - a*n3 - b*n1 + b*n3)}},
  1166. 3
  1167. {a - n1 + n3 <> 0 and a - b = 0 and a = 0,
  1168. 2 2 2 3
  1169. {a*x*y + a*x*z - a *x + a*y*z - a *y - a *z + (a - n1 + n3)}},
  1170. 2 2
  1171. {a *b - a*b <> 0 and a - b <> 0,
  1172. 2 2 2 3
  1173. {x*y*z - a*x*y - a*x*z + a *x - a*y*z + a *y + a *z - (a + n3),
  1174. 2 2 2 3
  1175. x*y*z - b*x*y - b*x*z + b *x - b*y*z + b *y + b *z - (b + n3),
  1176. x*y*z - n1,
  1177. 2 2 2 2
  1178. (a - b)*x*y + (a - b)*x*z - (a - b )*x + (a - b)*y*z - (a - b )*y
  1179. 2 2 3 3
  1180. - (a - b )*z + (a - b ),
  1181. 2 2 2 2 2 2
  1182. (a *b - a*b )*x + (a *b - a*b )*y + (a *b - a*b )*z
  1183. 3 3
  1184. - (a *b - a*b + a*n1 - a*n3 - b*n1 + b*n3),
  1185. 2 2 2 2 2
  1186. (a *b - a*b )*y + (a *b - a*b )*y*z
  1187. 3 3 2 2 2
  1188. - (a *b - a*b + a*n1 - a*n3 - b*n1 + b*n3)*y + (a *b - a*b )*z
  1189. 3 3
  1190. - (a *b - a*b + a*n1 - a*n3 - b*n1 + b*n3)*z
  1191. 3 2 2 3 2 2 2 2
  1192. + (a *b - a *b + a *n1 - a *n3 - b *n1 + b *n3),
  1193. 2 2 3 3 3 2
  1194. (a *b - a*b )*z - (a *b - a*b + a*n1 - a*n3 - b*n1 + b*n3)*z
  1195. 3 2 2 3 2 2 2 2 2 2
  1196. + (a *b - a *b + a *n1 - a *n3 - b *n1 + b *n3)*z - (a *b*n1 - a*b *n1)}},
  1197. 3 3 2 2
  1198. {a - b <> 0 and a *b - a*b + a*n1 - a*n3 - b*n1 + b*n3 = 0 and a *b - a*b = 0
  1199. ,
  1200. 2 2 2 3
  1201. {x*y*z - a*x*y - a*x*z + a *x - a*y*z + a *y + a *z - (a + n3),
  1202. 2 2 2 3
  1203. x*y*z - b*x*y - b*x*z + b *x - b*y*z + b *y + b *z - (b + n3),
  1204. x*y*z - n1,
  1205. 2 2 2 2
  1206. (a - b)*x*y + (a - b)*x*z - (a - b )*x + (a - b)*y*z - (a - b )*y
  1207. 2 2 3 3
  1208. - (a - b )*z + (a - b ),
  1209. 2 2 2 2 2 2 2 2
  1210. (a - b)*x*z - (a - b )*x*z + (a *b - a*b )*x + (a - b)*y*z - (a - b )*y*z
  1211. 2 2 2 2 2 3 2 2 3
  1212. + (a *b - a*b )*y - (a - b )*z + (a + a *b - a*b - b )*z
  1213. 3 3
  1214. - (a *b - a*b - a*n3 + b*n3),
  1215. 2 2 2 2 2 2 2 2 2 2 2
  1216. (a - b)*y *z - (a - b )*y *z + (a *b - a*b )*y - (a - b )*y*z
  1217. 3 2 2 3 3 3
  1218. + (a + a *b - a*b - b )*y*z - (a *b - a*b - a*n3 + b*n3)*y
  1219. 2 2 2 3 3
  1220. + (a *b - a*b )*z - (a *b - a*b - a*n3 + b*n3)*z
  1221. 3 2 2 3 2 2
  1222. + (a *b - a *b - a *n3 + b *n3)}},
  1223. {a <> 0 and a - b = 0,
  1224. 2 2 2 3
  1225. {x*y*z - a*x*y - a*x*z + a *x - a*y*z + a *y + a *z - (a + n3),
  1226. 2 2 2 3
  1227. x*y*z - b*x*y - b*x*z + b *x - b*y*z + b *y + b *z - (b + n3),
  1228. x*y*z - n1,
  1229. 2 2 2 3
  1230. a*x*y + a*x*z - a *x + a*y*z - a *y - a *z + (a - n1 + n3),
  1231. 2 2 2 2 2 2 3
  1232. a*x*z - a *x*z + a*y*z - a *y*z - a *z + (a - n1 + n3)*z + a*n1,
  1233. 2 2 2 2 2 2 3
  1234. a*y *z - a *y *z - a *y*z + (a - n1 + n3)*y*z + (a*n1)*y + (a*n1)*z
  1235. 2
  1236. - a *n1}},
  1237. 3
  1238. {a - n1 + n3 = 0 and a - b = 0 and a = 0,
  1239. 2 2 2 3
  1240. {x*y*z - a*x*y - a*x*z + a *x - a*y*z + a *y + a *z - (a + n3),
  1241. 2 2 2 3
  1242. x*y*z - b*x*y - b*x*z + b *x - b*y*z + b *y + b *z - (b + n3),
  1243. x*y*z - n1}}}
  1244. torder oo;
  1245. {{x,y,z},lex}
  1246. % Thomas Weis's Example 2
  1247. oo := torder({z,y,x,w},lex);
  1248. oo := {{},lex}
  1249. gsys({w*x*y*z-x*y*z-w*y*z+y*z-w*x*z+x*z+w*z-z-w*x*y+x*y+w*y-
  1250. y+w*x-x-w-(b-1),
  1251. w*x*y*z-2*x*y*z-2*w*y*z+4*y*z-2*w*x*z+4*x*z+4*w*z-8*z-2*w*x*y+4x*y+
  1252. 4*w*y-8*y+4*w*x-8*x-8*w-(c-16),
  1253. w*x*y*z-a,z+y+x+w-v});
  1254. {{true,
  1255. {z*y*x*w - z*y*x - z*y*w + z*y - z*x*w + z*x + z*w - z - y*x*w + y*x + y*w - y
  1256. + x*w - x - w - (b - 1),
  1257. z*y*x*w - 2*z*y*x - 2*z*y*w + 4*z*y - 2*z*x*w + 4*z*x + 4*z*w - 8*z - 2*y*x*w
  1258. + 4*y*x + 4*y*w - 8*y + 4*x*w - 8*x - 8*w - (c - 16),
  1259. z*y*x*w - a,
  1260. z + y + x + w - v,
  1261. 2 2 2 2 2
  1262. y *x + y *w - 3*y + y*x + 2*y*x*w - (v + 3)*y*x + y*w - (v + 3)*y*w
  1263. 2 2 2 2
  1264. + (3*v)*y + x *w - 3*x + x*w - (v + 3)*x*w + (3*v)*x - 3*w + (3*v)*w
  1265. + (b - c - 7*v + 15),
  1266. 2 2 2
  1267. 2*y + 2*y*x + 2*y*w - (2*v)*y + 2*x + 2*x*w - (2*v)*x + 2*w - (2*v)*w
  1268. + (a - 2*b + c + 6*v - 14),
  1269. 3 2 2 2
  1270. 2*x + 2*x *w - (2*v)*x + 2*x*w - (2*v)*x*w + (a - 2*b + c + 6*v - 14)*x
  1271. 3 2
  1272. + 2*w - (2*v)*w + (a - 2*b + c + 6*v - 14)*w - (3*a - 4*b + c + 4*v - 12),
  1273. 4 3 2
  1274. 2*w - (2*v)*w + (a - 2*b + c + 6*v - 14)*w - (3*a - 4*b + c + 4*v - 12)*w
  1275. + 2*a}}}
  1276. torder oo;
  1277. {{z,y,x,w},lex}
  1278. end;
  1279. Time for test: 12317 ms, plus GC time: 91 ms