ofsf.red 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736
  1. % ----------------------------------------------------------------------
  2. % $Id: ofsf.red,v 1.52 2003/10/24 11:52:43 gilch Exp $
  3. % ----------------------------------------------------------------------
  4. % Copyright (c) 1995-1999 Andreas Dolzmann and Thomas Sturm
  5. % ----------------------------------------------------------------------
  6. % $Log: ofsf.red,v $
  7. % Revision 1.52 2003/10/24 11:52:43 gilch
  8. % Renamed !*rlrqtfcfullsplit to !*rlhqetfcfullsplit.
  9. % Renamed !*rlrqtfcfast to !*rlhqetfcfast.
  10. % Renamed !*rlrqvb to !*rlhqevb.
  11. % Renamed !*rlrqvarsel to !*rlhqevarsel.
  12. % Renamed !*rlrqvarselx to !*rlhqevarselx.
  13. % Renamed !*rlrqdim0 to !*rlhqedim0.
  14. % Renamed !*rlrqtheory to !*rlhqetheory.
  15. % Renamed !*rlrqgbred to !*rlhqegbred.
  16. % Renamed !*rlrqconnect to !*rlhqeconnect.
  17. % Renamed !*rlrqstrconst to !*rlhqestrconst.
  18. % Renamed !*rlrqgbdimmin to !*rlhqegbdimmin.
  19. % Renamed !*rlrqgen to !*rlhqegen.
  20. % Renamed ofsf_rqtheo!* to ofsf_hqetheo!*.
  21. % Renamed ofsf_rqxvars!* to ofsf_hqexvars!*.
  22. %
  23. % Revision 1.51 2003/10/21 15:16:57 gilch
  24. % Added new package ofsftfc.
  25. % Added fluid declarations for tfc switches.
  26. % Added new package ofsfhqe.
  27. % Added fluid declarations for HQE switches.
  28. % Added service implementations rl_hqe and rlghqe.
  29. %
  30. % Revision 1.50 2003/08/28 13:51:03 seidl
  31. % Worked on projection orders.
  32. %
  33. % Revision 1.49 2003/07/11 17:16:08 sturm
  34. % New service rlqnum (number of quantifiers).
  35. %
  36. % Revision 1.48 2003/06/11 08:46:38 dolzmann
  37. % Added black boxes rl_qssimpl and rl_qssiadd.
  38. %
  39. % Revision 1.47 2003/06/04 06:09:56 dolzmann
  40. % Added black box rl_qssusuat.
  41. %
  42. % Revision 1.46 2003/06/03 16:10:39 dolzmann
  43. % Added blackbox implementations for rl_qssubsumep, rl_qstrycons, and
  44. % rl_qssubat.
  45. %
  46. % Revision 1.45 2003/05/27 08:19:19 dolzmann
  47. % Changed wrong log messages.
  48. %
  49. % Revision 1.44 2003/05/27 08:17:42 dolzmann
  50. % Added pseudo implementation of black box cl_qscsa.
  51. %
  52. % Revision 1.43 2003/05/21 09:04:38 dolzmann
  53. % Added service rlquine.
  54. %
  55. % Revision 1.42 2003/05/20 07:36:44 dolzmann
  56. % Load cgb instead of gb.
  57. %
  58. % Revision 1.41 2003/05/19 10:39:00 dolzmann
  59. % The Groebner package now uses the GB package.
  60. %
  61. % Revision 1.40 2003/01/30 12:27:02 sturm
  62. % Renamed switch vmatverbose to rlvmatvb and moved switch and fluid
  63. % declarations to where they belong.
  64. %
  65. % Revision 1.39 2003/01/29 11:34:42 sturm
  66. % Moved determinant code to from module ofsfcadproj to new module ofsfdet.
  67. %
  68. % Revision 1.38 2003/01/29 10:43:12 sturm
  69. % Moved fluid declaration to ofsf.red, where all such declarations belong.
  70. % Moved list2set and list2vector to lto.red.
  71. %
  72. % Revision 1.37 2003/01/27 11:49:34 sturm
  73. % Introduced ofsf_fbqe, s.t. fallbackqe is compatible with new ofsf_cad,
  74. % which has got a second argument now.
  75. %
  76. % Revision 1.36 2003/01/13 10:00:12 dolzmann
  77. % Added definitions for ofsfxopt. Changed services qe and qea.
  78. %
  79. % Revision 1.35 2003/01/11 17:57:58 sturm
  80. % Added AM services rlcadporder, rlgcadporder for ofsf.
  81. %
  82. % Revision 1.34 2002/08/23 12:32:20 dolzmann
  83. % Added local quantifier elimination.
  84. %
  85. % Revision 1.33 2002/05/29 11:46:33 sturm
  86. % Provided ofsf_gcad() and corresponding AM interface.
  87. %
  88. % Revision 1.32 2002/05/28 13:21:59 sturm
  89. % Added black box rl_fbqe() and corresponding switch rlqefb.
  90. % That is, for ofsf, rlqe uses rlcad in case of failure now.
  91. %
  92. % Revision 1.31 2002/05/28 13:08:46 seidla
  93. % New switches rlcadpreponly, rlcadte and rlcadpbfvs.
  94. %
  95. % Revision 1.30 2002/01/25 14:42:33 sturm
  96. % Added switch rlcaddecdeg, off by default.
  97. %
  98. % Revision 1.29 2002/01/18 15:36:42 seidla
  99. % Package linalg has to be loaded due to procedures remove_rows, etc. in
  100. % ofsfcadproj.red. Removed unused switches rlallp and rlanuex. Added switch
  101. % rlcaddnfformula.
  102. %
  103. % Revision 1.28 2002/01/16 15:27:32 sturm
  104. % Load matrix instead of linalg.
  105. % Do not load specfac since poly is dumped.
  106. %
  107. % Revision 1.27 2002/01/16 15:00:18 sturm
  108. % Inserted a lost space in fluid declaration.
  109. %
  110. % Revision 1.26 2002/01/16 13:03:47 seidla
  111. % Imported CAD from rlprojects.
  112. %
  113. % Revision 1.25 1999/09/22 13:01:35 dolzmann
  114. % Added code and black box definitions for the ofsf part of susi.
  115. %
  116. % Revision 1.24 1999/03/23 12:26:33 sturm
  117. % Renamed switch rlsisqf to rlsiatadv.
  118. %
  119. % Revision 1.23 1999/03/23 07:40:16 dolzmann
  120. % Changed copyright information.
  121. % Added list of exported procedures and import list.
  122. %
  123. % Revision 1.22 1999/03/21 13:37:18 dolzmann
  124. % Use cl_bnfsimpl instead of acfsf_bnfsimpl.
  125. % Removed black box rl_zero.
  126. %
  127. % Revision 1.21 1999/03/18 14:08:20 sturm
  128. % Added new service rl_specelim!* in cl_qe for covering the "super
  129. % quadratic special case' for ofsf. This method is toggled by switch
  130. % rlsqsc, which is off by default. Context dvfsf uses cl_specelim which
  131. % is constantly "false." Context acfsf does not use cl_qe at all.
  132. %
  133. % Revision 1.20 1998/04/09 11:00:03 sturm
  134. % Added switch rlqeqsc for quadratic special case. This now OFF by default!
  135. %
  136. % Revision 1.19 1997/08/24 16:18:50 sturm
  137. % Added service rl_surep with black box rl_multsurep.
  138. % Added service rl_siaddatl.
  139. %
  140. % Revision 1.18 1997/08/14 10:10:30 sturm
  141. % Renamed rldecdeg to rldecdeg1.
  142. % Added service rldecdeg.
  143. %
  144. % Revision 1.17 1997/08/13 12:44:38 dolzmann
  145. % Introduced service rldecdeg.
  146. %
  147. % Revision 1.16 1996/10/23 11:24:48 dolzmann
  148. % Added procedure ofsf_mkstrict.
  149. %
  150. % Revision 1.15 1996/10/20 15:54:57 sturm
  151. % Added switches rlnzden, rlposden, and rladdcond and corresponding code
  152. % handling the input of reciprocal terms.
  153. %
  154. % Revision 1.14 1996/10/17 13:52:07 sturm
  155. % Introduced services rlvarl, rlfvarl, and rlbvarl. Renamed cl_varl to
  156. % cl_varl1 for this.
  157. %
  158. % Revision 1.13 1996/10/14 16:03:08 sturm
  159. % Declared !*rlqeheu fluid for the optimizer.
  160. %
  161. % Revision 1.12 1996/10/08 13:54:33 dolzmann
  162. % Renamed "degree parity decomposition" to "parity decomposition".
  163. % Adapted names of procedures and switches accordingly.
  164. %
  165. % Revision 1.11 1996/10/01 10:23:07 reiske
  166. % Added ofsf services rlqews and rlqeipo.
  167. % Introduced new service rltnf and related code.
  168. %
  169. % Revision 1.10 1996/09/30 16:55:30 sturm
  170. % Switched to new tableau code.
  171. %
  172. % Revision 1.9 1996/09/29 14:22:57 sturm
  173. % Introduced services rlqea and rlgqea.
  174. %
  175. % Revision 1.8 1996/09/26 11:48:55 dolzmann
  176. % Do not use T as formal parameter.
  177. %
  178. % Revision 1.7 1996/09/05 11:14:46 dolzmann
  179. % Introduced new switch !*rlqegenct.
  180. % Using cl black box implementation for black box rl_trygauss.
  181. % Introduced new black boxes rl_qefsolset, rl_bettergaussp!*, rl_bestgaussp,
  182. % rl_esetunion, rl_structat, rl_ifstructat, and rl_termmlat.
  183. % Introduced new services rl_ifacml, rl_struct, rl_ifstruct, rl_termml, and
  184. % rl_terml.
  185. % Added lost procedure ofsf_simpterm.
  186. %
  187. % Revision 1.6 1996/08/01 11:45:27 reiske
  188. % Added services rl_natab, rl_nitab, and rl_gentheo.
  189. % Added black boxes rl_a2cdl and rl_getineq.
  190. %
  191. % Revision 1.5 1996/07/13 11:09:33 dolzmann
  192. % Introduced new switches !*rlgsbnf and !*rlgsutord.
  193. % Using cl black box implementations for black boxes rl_smsimpl!-impl
  194. % and rl_smsimpl!-equiv1.
  195. %
  196. % Revision 1.4 1996/07/07 14:38:14 sturm
  197. % Introduced new service rl_nnfnot.
  198. % Introduced new black box rl_eqnrhskernels.
  199. %
  200. % Revision 1.3 1996/05/21 17:14:07 sturm
  201. % Added service rl_subfof and black boxes rl_subat, rl_subalchk.
  202. %
  203. % Revision 1.2 1996/05/12 08:27:19 sturm
  204. % Loading rltools now.
  205. % Introduced new switch rlsitsqspl.
  206. % Introduced internal switch !*rlqegen.
  207. % Removed context control for switch ezgcd.
  208. % Introduced new services rl_thsimpl and rl_gqe.
  209. %
  210. % Revision 1.1 1996/03/22 12:13:59 sturm
  211. % Moved and split.
  212. %
  213. % Revision 1.25 1996/03/18 15:46:31 sturm
  214. % Moved switch defaults to module rl.
  215. % Removed ofsf_enter, ofsf_exit, and ofsf_svezgcd!*. The ezgcd is treated
  216. % as context switch now.
  217. % Added service rl_atml.
  218. % Removed properties ofsf_prepfn from the ofsf predicates.
  219. % Removed properties "prepfnname", "prepdefault", "resimpfnname", and
  220. % "resimpdefault" from "ofsf."
  221. % Added property "rl_prepat" to "ofsf."
  222. % Added procedures ofsf_prepat, ofsf_resimpat, ofsf_lengthat,
  223. % Added service rl_atml.
  224. % Removed procedure ofsf_tordp.
  225. % Adapted black box implementation ofsf_fctrat: the content is dropped now.
  226. %
  227. % Revision 1.24 1996/03/11 13:19:23 reiske
  228. % Added black box implementations ofsf_fctrat and ofsf_tordp.
  229. %
  230. % Revision 1.23 1996/03/10 13:03:49 sturm
  231. % Added default setting for switch !*rlqeheu.
  232. % Added service rl_matrix.
  233. % Changed verbosity output in module ofsfqe.
  234. % Removed Gauss code that was commented out previously.
  235. %
  236. % Revision 1.22 1996/03/10 12:48:54 dolzmann
  237. % Set services rl_dnf to ofsf_dnf and rl_cnf to ofsf_cnf respectively.
  238. % Added procedures ofsf_dnf, ofsf_cnf. These procedures call
  239. % cl_cnf/cl_cnf with !*rlsiso on where necessary.
  240. % Introduced new switch !*rlgsvb and corresponding code. Groebner
  241. % simplifier gives verbosity output only with both !*rlverbose and
  242. % !*rlgsvb on.
  243. %
  244. % Revision 1.21 1996/03/09 13:36:02 sturm
  245. % Added switch rlqesr and corresponding code.
  246. % Renamed constructors:
  247. % ofsf_constr2 -> ofsf_mk2
  248. % ofsf_0constr2 -> ofsf_0mk2
  249. % ofsf_constrn -> ofsf_mkn
  250. % Changes in module ofsfqe:
  251. % Added procedures ofsf_qesubcr1, ofsf_qesubcrpe1 and ofsf_qesubcrme1.
  252. % Added parameter "ans" to procedures ofsf_translat, ofsf_trygauss, and
  253. % ofsf_findeqsol.
  254. % Fixed a bug in (former) ofsf_qemkans.
  255. % Added procedures ofsf_qemkans1 and ofsf_qebacksub for answer
  256. % back-substitution.
  257. %
  258. % Revision 1.20 1996/03/04 17:11:41 sturm
  259. % Added ofsf_enter, ofsf_exit, and fluid ofsf_svezgcd!* for turning on
  260. % ezgcd while in ofsf context.
  261. % Added black box implementations ofsf_transform, ofsf_updatr.
  262. % Fixed a bug in ofsf_qscp.
  263. % Added detection of formulas that are linear after factorization to
  264. % ofsf_varsel. The same for quadratic formulas.
  265. % Added handling of answer transformations to ofsf_qemkans.
  266. % Moved ofsf_reorder to module sfto.
  267. %
  268. % Revision 1.19 1996/03/04 13:09:19 dolzmann
  269. % Removed loading of groebner packages.
  270. % Added switch !*rlbnfsac.
  271. % Added black box implementations ofsf_bnfsimpl, ofsf_sacat, ofsf_sacatlp.
  272. % New module ofsf_bnf. Moved code for bnf computation from ofsf_below to
  273. % ofsf_bnf.
  274. % Turned off !*rlsiexpla with groebner simplifier
  275. % Moved procedures gs_groebnerf, gs_preducef, gs_greducef to module sfto.
  276. % Moved procedure ofsf_gsatlp to module cl.
  277. %
  278. % Revision 1.18 1996/02/28 13:15:24 sturm
  279. % Added quadratic special case detection to ofsf_varsel.
  280. % Fixed bugs in elimination set computation.
  281. %
  282. % Revision 1.17 1996/02/26 12:46:51 sturm
  283. % Started the implementation of a proper ofsf_varsel.
  284. % Added factorization to the ofsf_translat and ofsf_trygauss black box
  285. % implementations. Degree violations are communicated to the module cl
  286. % now.
  287. % Fixed a bug in ofsf_elimsetscl.
  288. % Removed treatment of ...2q keys from the elimination set computation.
  289. %
  290. % Revision 1.16 1996/02/18 15:55:14 sturm
  291. % Turned rlsiexpla on by default.
  292. %
  293. % Revision 1.15 1996/02/18 14:27:58 sturm
  294. % Updated export list.
  295. % Added factorization to ofsf_simplequal and ofsf_simplneq. Added
  296. % corresponding switch !*rlsifac.
  297. % Removed switch !*rlsdnf.
  298. % Added black box implementation ofsf_trygauss.
  299. % Changed default settings for the switches !*rlqedfs and !*rlsimpl.
  300. % Added service rlatl.
  301. % Added procedures ofsf_rotrel, ofsf_crotrel, and ofsf_reorder.
  302. % Moved ofsf_splitterm and ofsf_mksol from module ofsfqe to
  303. % ofsf_optsplitterm and ofsf_optmksol resp. in module ofsfopt.
  304. % Rewritten module ofsfqe. Implemented quadratic elimination. This module
  305. % is under development.
  306. %
  307. % Revision 1.14 1996/02/18 12:46:07 dolzmann
  308. % Added default value for switch !*rlgserf.
  309. % Rewritten module ofsfgs.
  310. %
  311. % Revision 1.13 1995/11/16 08:06:36 sturm
  312. % Added default setting for switch rlsimpl.
  313. %
  314. % Revision 1.12 1995/10/18 08:53:05 sturm
  315. % Added switches rlbnfsb, rlbnfsm, parameter rlsubsumption!*, and
  316. % respective code.
  317. % Bug fix: atomic formulas are made unique in ofsf_entry2at now.
  318. % Made ofsf_gsd use DNF computation.
  319. %
  320. % Revision 1.11 1995/09/05 08:05:15 sturm
  321. % Reimplemented parts of smart simplification. Added switches rlsipo,
  322. % rlsipw; fixed a bug in smart simplification of impl.
  323. % Modified procedure ofsf_esaord: improved substitution, added switch
  324. % rlqesdnf.
  325. %
  326. % Revision 1.10 1995/08/31 08:40:47 sturm
  327. % Added RTYPEFN property to all relations except equal.
  328. %
  329. % Revision 1.9 1995/08/30 08:09:15 sturm
  330. % Moved interface code to file rlsf and adapted the tag properties.
  331. % Fixed a bug: renamed cl_smsimpl!-equiv to ofsf_smsimpl!-equiv1.
  332. % Major changes in module ofsfopt:
  333. % Added BFS option to ofsf_opt2 using switch rlqedfs.
  334. % Changed return protocol in ofsf_opt2.
  335. % Added elimination set computation wrt. "z". Code contains some
  336. % experimental switches.
  337. % Added counting of tree nodes with verbose output.
  338. %
  339. % Revision 1.8 1995/08/08 10:18:18 sturm
  340. % Added smart simplification code for impl and equiv.
  341. % Adapted calls to cl_simpl to the new knowl argument.
  342. %
  343. % Revision 1.7 1995/08/03 05:39:06 dolzmann
  344. % Added procedures ofsf_gsn, ofsf_gsatlp.
  345. %
  346. % Revision 1.6 1995/08/02 08:19:08 sturm
  347. % Split module ofsfsimpl into ofsfsimplat and ofsfsmsimpl. Rewritten
  348. % smart simplification code.
  349. % Minor changes in module ofsfgs; fixed term ordering to REVGRADLEX.
  350. % Changed copyright messages.
  351. %
  352. % Revision 1.5 1995/07/12 15:08:54 sturm
  353. % Added procedure ofsf_optsubstat to module ofsfopt.
  354. % Added procedures ofsf_ordatp and ofsf_ordrelp.
  355. % Set service rl_identifyonoff to cl_identifyonoff.
  356. %
  357. % Revision 1.4 1995/07/07 11:12:25 sturm
  358. % Removed remflag statement for load!-package.
  359. % Removed "_" in switch names.
  360. % Added export statement.
  361. % Added switch rlopt1s.
  362. % Added procedures ofsf_qemkans (parameter function), ofsf_simpterm,
  363. % ofsf_prepterm, and ofsf_mkterm.
  364. % Added comments.
  365. % Changes in module ofsfopt.
  366. % Renamed Groebner simplifiers: ofsf_gbcsimpl to ofsf_gsc and
  367. % ofsf_gbdsimpl to ofsf_gsd.
  368. % Changed verbosity output, ioto is used now.
  369. %
  370. % Revision 1.3 1995/06/21 10:42:02 sturm
  371. % Removed declarations of non-used local variables.
  372. % Turned on switch rl_tabib by default.
  373. % Updated create!-package commented it out.
  374. % Many changes in module ofsfqe.
  375. % Added smart simplification code in module ofsfsimpl; ofsf_simpl1 is
  376. % used instead of of_simpl1 now.
  377. % Added module ofsfopt.
  378. %
  379. % Revision 1.2 1995/06/01 13:54:04 dolzmann
  380. % Added switch rl_verbose.
  381. % Fixed bugs in ofsf_simplleq and ofsf_simplgreaterp.
  382. % Added module ofsfgs containing a Groebner simplifier. Parts of the
  383. % interface have already been part of the previous revision.
  384. %
  385. % Revision 1.1 1995/05/29 14:47:21 sturm
  386. % Initial check-in.
  387. %
  388. % ----------------------------------------------------------------------
  389. lisp <<
  390. fluid '(ofsf_rcsid!* ofsf_copyright!*);
  391. ofsf_rcsid!* := "$Id: ofsf.red,v 1.52 2003/10/24 11:52:43 gilch Exp $";
  392. ofsf_copyright!* := "Copyright (c) 1995-1999 by A. Dolzmann and T. Sturm"
  393. >>;
  394. module ofsf;
  395. % Ordered field standard form. Main module. Algorithms on first-order
  396. % formulas over ordered fields. The language contains binary relations
  397. % ['equal], ['neq], ['greaterp], ['lessp], ['geq], ['leq].
  398. create!-package('(ofsf ofsfsiat ofsfsism ofsfbnf ofsfqe ofsfopt ofsfgs
  399. ofsfmisc ofsfcad ofsfcadproj ofsfanuex ofsfxopt ofsfdet ofsftfc ofsfhqe),
  400. nil);
  401. load!-package 'cl;
  402. load!-package 'rltools;
  403. load!-package 'linalg;
  404. load!-package 'matrix;
  405. load!-package 'factor;
  406. remflag('(load!-package),'eval); % for bootstrapping
  407. load!-package 'cgb;
  408. flag('(load!-package),'eval);
  409. exports ofsf_simpterm,ofsf_prepat,ofsf_resimpat,ofsf_lengthat,ofsf_chsimpat,
  410. ofsf_simpat,ofsf_op,ofsf_arg2l,ofsf_arg2r,ofsf_argn,ofsf_mk2,ofsf_0mk2,
  411. ofsf_mkn,ofsf_opp,ofsf_mkstrict,ofsf_simplat1,ofsf_smrmknowl,ofsf_smcpknowl,
  412. ofsf_smupdknowl,ofsf_smmkatl,ofsf_dnf,ofsf_cnf,ofsf_subsumption,
  413. ofsf_sacatlp,ofsf_sacat,ofsf_varsel,ofsf_qesubcr1,ofsf_qesubcr2,ofsf_qesubr,
  414. ofsf_qesubcq,ofsf_qesubq,ofsf_qesubi,ofsf_qesubcrpe1,ofsf_qesubcrme1,
  415. ofsf_qesubcrpe2,ofsf_qesubcrme2,ofsf_qesubrpe,ofsf_qesubrme,ofsf_qesubcqpe,
  416. ofsf_qesubcqme,ofsf_qesubqpe,ofsf_qesubqme,ofsf_valassp,ofsf_translat,
  417. ofsf_surep,ofsf_elimset,ofsf_bettergaussp,ofsf_esetunion,ofsf_bestgaussp,
  418. ofsf_qefsolset,ofsf_qemkans,ofsf_preprexpr,ofsf_decdeg,ofsf_decdeg1,
  419. ofsf_transform,ofsf_updatr,ofsf_thsimpl,ofsf_specelim,ofsf_opt,ofsf_gsn,
  420. ofsf_gsc,ofsf_gsd,ofsf_gssimplify,ofsf_gssimplify0,ofsf_termprint,
  421. ofsf_canegrel,ofsf_anegrel,ofsf_clnegrel,ofsf_lnegrel,ofsf_fctrat,
  422. ofsf_negateat,ofsf_varlat,ofsf_varsubstat,ofsf_ordatp,ofsf_ordrelp,
  423. ofsf_a2cdl,ofsf_t2cdl,ofsf_subat,ofsf_subalchk,ofsf_eqnrhskernels,
  424. ofsf_getineq,ofsf_structat,ofsf_ifstructat,ofsf_termmlat,ofsf_multsurep,
  425. ofsf_cad,ofsf_cadswitches;
  426. imports cl,rltools;
  427. fluid '(!*rlsiatadv !*rlsipd !*rlsiexpl !*rlsiexpla !*rlgssub !*rlsiso !*rlqesr
  428. !*rlgsrad !*rlgsred !*rlgsprod !*rlgserf !*rlverbose !*rlqedfs !*rlsipw
  429. !*rlsipo !*rlparallel !*rlopt1s !*rlsifac !*rlbnfsac !*rlgsvb !*rlqegen
  430. !*rlsitsqspl !*rlgsbnf !*rlgsutord !*rlqegenct !*rlqeheu !*rlnzden
  431. !*rlposden !*rladdcond !*rlqeqsc !*rlqesqsc !*rlsusi !*rlsusimult !*rlsusigs
  432. !*rlsusiadd !*rlcadfac !*rlcaddnfformula !*rlcadpreponly !*rlcadbaseonly
  433. !*rlcadextonly !*rlcadprojonly !*rlcadverbose !*rlcaddebug !*rlcadpartial
  434. !*rlcadfulldimonly !*rlcadtrimtree !*rlcadrawformula !*rlcadisoallroots
  435. !*rlcadaproj !*rlcadaprojalways !*rlcadhongproj !*exp !*rlanuexverbose
  436. !*rlanuexdifferentroots !*rlanuexdebug !*rlanuexpsremseq
  437. !*rlanuexgcdnormalize !*rlanuexsgnopt !*rlcaddecdeg !*rlcadte !*rlcadpbfvs
  438. !*rlvmatvb ofsf_cadtheo!* cl_pal!* cl_lps!* cl_theo!* !*rlcadfasteval
  439. ofsf_xopt!-nodes!* ofsf_xopt!-delnodes!* ofsf_xopt!-plnodes!*
  440. ofsf_xopt!-fnodes!* ofsf_xopt!-thcof!* !*rlxoptqe !*rlxopt !*rlxoptsb
  441. !*rlxoptpl !*rlxoptri !*rlxoptric !*rlxoptrir !*rlxoptses !*rlourdet
  442. ofsf_gstv!* !*cgbverbose !*groebopt !*rlhqetfcsplit !*rlhqetfcfullsplit
  443. !*rlhqetfcfast !*rlhqevb !*rlhqevarsel !*rlhqevarselx !*rlhqedim0
  444. !*rlhqetheory !*rlhqegbred !*rlhqeconnect !*rlhqestrconst !*rlhqegbdimmin
  445. !*rlhqegen);
  446. fluid '(!*rlqegen1 !*rlcadmcproj !*rlpscsgen); % temporary for CAD
  447. fluid '(ofsf_hqetheo!* ofsf_hqexvars!*); % temporary for HQE
  448. flag('(ofsf),'rl_package);
  449. % Parameters
  450. put('ofsf,'rl_params,'(
  451. (rl_subat!* . ofsf_subat)
  452. (rl_subalchk!* . ofsf_subalchk)
  453. (rl_eqnrhskernels!* . ofsf_eqnrhskernels)
  454. (rl_ordatp!* . ofsf_ordatp)
  455. (rl_qemkans!* . ofsf_qemkans)
  456. (rl_simplat1!* . ofsf_simplat1)
  457. (rl_smupdknowl!* . ofsf_smwupdknowl)
  458. (rl_smrmknowl!* . ofsf_smwrmknowl)
  459. (rl_smcpknowl!* . ofsf_smwcpknowl)
  460. (rl_smmkatl!* . ofsf_smwmkatl)
  461. (rl_smsimpl!-impl!* . cl_smsimpl!-impl)
  462. (rl_smsimpl!-equiv1!* . cl_smsimpl!-equiv1)
  463. (rl_susipost!* . ofsf_susipost)
  464. (rl_susitf!* . ofsf_susitf)
  465. (rl_susibin!* . ofsf_susibin)
  466. (rl_negateat!* . ofsf_negateat)
  467. (rl_varlat!* . ofsf_varlat)
  468. (rl_varsubstat!* . ofsf_varsubstat)
  469. (rl_translat!* . ofsf_translat)
  470. (rl_elimset!*. ofsf_elimset)
  471. (rl_trygauss!* . cl_trygauss)
  472. (rl_varsel!* . ofsf_varsel)
  473. (rl_subsumption!* . ofsf_subsumption)
  474. (rl_bnfsimpl!* . cl_bnfsimpl)
  475. (rl_sacat!* . ofsf_sacat)
  476. (rl_sacatlp!* . ofsf_sacatlp)
  477. (rl_qstrycons!* . ofsf_qstrycons)
  478. (rl_qscsaat!* . cl_qscsaat)
  479. (rl_qssubat!* . ofsf_qssubat)
  480. (rl_qsconsens!* . cl_qsnconsens)
  481. (rl_qsimpltestccl!* . cl_qsimpltestccl)
  482. % (rl_qssubsumep!* . cl_qssusubyit)
  483. (rl_qssubsumep!* . cl_qssusubytab)
  484. (rl_qstautp!* . cl_qstautp)
  485. (rl_qssusuat!* . ofsf_qssusuat)
  486. (rl_qssimpl!* . cl_qssimpl)
  487. (rl_qssiadd!* . ofsf_qssiadd)
  488. (rl_fctrat!* . ofsf_fctrat)
  489. (rl_tordp!* . ordp)
  490. (rl_transform!* . ofsf_transform)
  491. (rl_updatr!* . ofsf_updatr)
  492. (rl_a2cdl!* . ofsf_a2cdl)
  493. (rl_t2cdl!* . ofsf_t2cdl)
  494. (rl_getineq!* . ofsf_getineq)
  495. (rl_qefsolset!* . ofsf_qefsolset)
  496. (rl_bettergaussp!* . ofsf_bettergaussp)
  497. (rl_bestgaussp!* . ofsf_bestgaussp)
  498. (rl_esetunion!* . ofsf_esetunion)
  499. (rl_structat!* . ofsf_structat)
  500. (rl_ifstructat!* . ofsf_ifstructat)
  501. (rl_termmlat!* . ofsf_termmlat)
  502. (rl_multsurep!* . ofsf_multsurep)
  503. (rl_specelim!* . ofsf_specelim)
  504. (rl_fbqe!* . ofsf_fbqe)));
  505. % Services
  506. put('ofsf,'rl_services,'(
  507. (rl_subfof!* . cl_subfof)
  508. (rl_identifyonoff!* . cl_identifyonoff)
  509. (rl_simpl!* . cl_simpl)
  510. (rl_thsimpl!* . ofsf_thsimpl)
  511. (rl_nnf!* . cl_nnf)
  512. (rl_nnfnot!* . cl_nnfnot)
  513. (rl_pnf!* . cl_pnf)
  514. (rl_cnf!* . ofsf_cnf)
  515. (rl_dnf!* . ofsf_dnf)
  516. (rl_all!* . cl_all)
  517. (rl_ex!* . cl_ex)
  518. (rl_atnum!* . cl_atnum)
  519. (rl_qnum!* . cl_qnum)
  520. (rl_tab!* . cl_tab)
  521. (rl_atab!* . cl_atab)
  522. (rl_itab!* . cl_itab)
  523. (rl_gsc!* . ofsf_gsc)
  524. (rl_gsd!* . ofsf_gsd)
  525. (rl_gsn!* . ofsf_gsn)
  526. (rl_qe!* . ofsf_qe)
  527. (rl_qea!* . ofsf_qea)
  528. (rl_gqe!* . cl_gqe)
  529. (rl_gqea!* . cl_gqea)
  530. (rl_qeipo!* . cl_qeipo)
  531. (rl_qews!* . cl_qews)
  532. (rl_opt!* . ofsf_opt)
  533. (rl_ifacl!* . cl_ifacl)
  534. (rl_ifacml!* . cl_ifacml)
  535. (rl_matrix!* . cl_matrix)
  536. (rl_apnf!* . cl_apnf)
  537. (rl_atml!* . cl_atml)
  538. (rl_tnf!* . cl_tnf)
  539. (rl_atl!* . cl_atl)
  540. (rl_struct!* . cl_struct)
  541. (rl_ifstruct!* . cl_ifstruct)
  542. (rl_termml!* . cl_termml)
  543. (rl_terml!* . cl_terml)
  544. (rl_varl!* . cl_varl)
  545. (rl_fvarl!* . cl_fvarl)
  546. (rl_bvarl!* . cl_bvarl)
  547. (rl_gentheo!* . cl_gentheo)
  548. (rl_decdeg!* . ofsf_decdeg)
  549. (rl_decdeg1!* . ofsf_decdeg1)
  550. (rl_surep!* . cl_surep)
  551. (rl_siaddatl!* . cl_siaddatl)
  552. (rl_cad!* . ofsf_cad)
  553. (rl_gcad!* . ofsf_gcad)
  554. (rl_cadswitches!* . ofsf_cadswitches)
  555. (rl_lqe!* . cl_lqe)
  556. (rl_xqe!* . ofsf_xopt!-qe)
  557. (rl_xqea!* . ofsf_xopt!-qea)
  558. (rl_lthsimpl!* . ofsf_lthsimpl)
  559. (rl_lthsimpl!* . ofsf_lthsimpl)
  560. (rl_quine!* . cl_quine)
  561. (rl_cadporder!* . ofsf_cadporder)
  562. (rl_gcadporder!* . ofsf_gcadporder)
  563. (rl_cadproj!* . ofsf_cadproj)
  564. (rl_hqe!* . ofsf_hqe)
  565. (rl_ghqe!* . ofsf_ghqe)));
  566. % Admin
  567. put('ofsf,'simpfnname,'ofsf_simpfn);
  568. put('ofsf,'simpdefault,'ofsf_simprel);
  569. put('ofsf,'rl_prepat,'ofsf_prepat);
  570. put('ofsf,'rl_resimpat,'ofsf_resimpat);
  571. put('ofsf,'rl_lengthat,'ofsf_lengthat);
  572. put('ofsf,'rl_prepterm,'prepf);
  573. put('ofsf,'rl_simpterm,'ofsf_simpterm);
  574. algebraic infix equal;
  575. put('equal,'ofsf_simpfn,'ofsf_chsimpat);
  576. put('equal,'number!-of!-args,2);
  577. algebraic infix neq;
  578. put('neq,'ofsf_simpfn,'ofsf_chsimpat);
  579. put('neq,'number!-of!-args,2);
  580. put('neq,'rtypefn,'quotelog);
  581. newtok '((!< !>) neq);
  582. algebraic infix leq;
  583. put('leq,'ofsf_simpfn,'ofsf_chsimpat);
  584. put('leq,'number!-of!-args,2);
  585. put('leq,'rtypefn,'quotelog);
  586. algebraic infix geq;
  587. put('geq,'ofsf_simpfn,'ofsf_chsimpat);
  588. put('geq,'number!-of!-args,2);
  589. put('geq,'rtypefn,'quotelog);
  590. algebraic infix lessp;
  591. put('lessp,'ofsf_simpfn,'ofsf_chsimpat);
  592. put('lessp,'number!-of!-args,2);
  593. put('lessp,'rtypefn,'quotelog);
  594. algebraic infix greaterp;
  595. put('greaterp,'ofsf_simpfn,'ofsf_chsimpat);
  596. put('greaterp,'number!-of!-args,2);
  597. put('greaterp,'rtypefn,'quotelog);
  598. flag('(equal neq leq geq lessp greaterp),'spaced);
  599. flag('(ofsf_chsimpat),'full);
  600. procedure ofsf_simpterm(u);
  601. numr simp u;
  602. procedure ofsf_prepat(f);
  603. {ofsf_op f,prepf ofsf_arg2l f,prepf ofsf_arg2r f};
  604. procedure ofsf_resimpat(f);
  605. ofsf_mk2(ofsf_op f,
  606. numr resimp !*f2q ofsf_arg2l f,numr resimp !*f2q ofsf_arg2r f);
  607. procedure ofsf_lengthat(f);
  608. 2;
  609. procedure ofsf_chsimpat(u);
  610. rl_smkn('and,for each x in ofsf_chsimpat1 u collect ofsf_simpat x);
  611. procedure ofsf_chsimpat1(u);
  612. begin scalar leftl,rightl,lhs,rhs;
  613. lhs := cadr u;
  614. if pairp lhs and ofsf_opp car lhs then <<
  615. leftl := ofsf_chsimpat1 lhs;
  616. lhs := caddr lastcar leftl
  617. >>;
  618. rhs := caddr u;
  619. if pairp rhs and ofsf_opp car rhs then <<
  620. rightl := ofsf_chsimpat1 rhs;
  621. rhs := cadr car rightl
  622. >>;
  623. return nconc(leftl,{car u,lhs,rhs} . rightl)
  624. end;
  625. procedure ofsf_simpat(u);
  626. % Ordered field simp atomic formula. [u] is Lisp prefix. Returns an
  627. % atomic formula.
  628. begin scalar op,lhs,rhs,nlhs,f;
  629. op := car u;
  630. lhs := simp cadr u;
  631. if not (!*rlnzden or !*rlposden or (domainp denr lhs)) then
  632. typerr(u,"atomic formula");
  633. rhs := simp caddr u;
  634. if not (!*rlnzden or !*rlposden or (domainp denr rhs)) then
  635. typerr(u,"atomic formula");
  636. lhs := subtrsq(lhs,rhs);
  637. nlhs := numr lhs;
  638. if !*rlposden and not domainp denr lhs then <<
  639. f := ofsf_0mk2(op,nlhs);
  640. if !*rladdcond then
  641. f := if op memq '(lessp leq greaterp geq) then
  642. rl_mkn('and,{ofsf_0mk2('greaterp,denr lhs),f})
  643. else
  644. rl_mkn('and,{ofsf_0mk2('neq,denr lhs),f});
  645. return f
  646. >>;
  647. if !*rlnzden and not domainp denr lhs then <<
  648. if op memq '(lessp leq greaterp geq) then
  649. nlhs := multf(nlhs,denr lhs);
  650. f := ofsf_0mk2(op,nlhs);
  651. if !*rladdcond then
  652. f := rl_mkn('and,{ofsf_0mk2('neq,denr lhs),f});
  653. return f
  654. >>;
  655. return ofsf_0mk2(op,nlhs)
  656. end;
  657. procedure ofsf_op(atf);
  658. % Ordered field operator. [atf] is an atomic formula
  659. % $R(t_1,t_2)$. Returns $R$.
  660. car atf;
  661. procedure ofsf_arg2l(atf);
  662. % Ordered field binary operator left hand side argument. [atf] is
  663. % an atomic formula $R(t_1,t_2)$. Returns $t_1$.
  664. cadr atf;
  665. procedure ofsf_arg2r(atf);
  666. % Ordered field binary operator right hand side argument. [atf] is
  667. % an atomic formula $R(t_1,t_2)$. Returns $t_2$.
  668. caddr atf;
  669. procedure ofsf_argn(atf);
  670. % Ordered field binary operator right hand side argument. [atf] is
  671. % an atomic formula $R(t_1,t_2)$. Returns the list $(t_1,t_2)$.
  672. {cadr atf,caddr atf};
  673. procedure ofsf_mk2(op,lhs,rhs);
  674. % Ordered field constructor for binary operator. [op] is a relation
  675. % [lhs] and [rhs] are terms. Returns the atomic formula
  676. % $[op]([lhs],[rhs])$.
  677. {op,lhs,rhs};
  678. procedure ofsf_0mk2(op,lhs);
  679. % Ordered field zero constructor for binary operator. [op] is a
  680. % relation [lhs] is a term. Returns the atomic formula
  681. % $[op]([lhs],0)$.
  682. {op,lhs,nil};
  683. procedure ofsf_mkn(op,argl);
  684. % Ordered field constructor for binary operator. [op] is a relation
  685. % [argl] is a list $(t_1,t_2)$ of terms. Returns the atomic formula
  686. % $[op](t_1,t_2)$.
  687. {op,car argl,cadr argl};
  688. procedure ofsf_opp(op);
  689. % Orderd field standard form operator predicate. [op] is an
  690. % S-expression. Returns [nil] if op is not a relation.
  691. op memq '(lessp leq equal neq geq greaterp);
  692. procedure ofsf_mkstrict(r);
  693. % Ordered field standard form make strict. [r] is an ordering
  694. % relation. Returns the strict part of [r].
  695. if r eq 'leq then 'lessp else if r eq 'geq then 'greaterp else r;
  696. endmodule; % [ofsf]
  697. end; % of file