redlog.red 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754
  1. % ----------------------------------------------------------------------
  2. % $Id: redlog.red,v 1.24 2003/11/11 15:08:19 sturm Exp $
  3. % ----------------------------------------------------------------------
  4. % Copyright (c) 1995-2003 Andreas Dolzmann and Thomas Sturm
  5. % ----------------------------------------------------------------------
  6. % $Log: redlog.red,v $
  7. % Revision 1.24 2003/11/11 15:08:19 sturm
  8. % Added fluid declaration for fancy printing.
  9. %
  10. % Revision 1.23 2003/10/27 14:32:25 gilch
  11. % Renamed rlrqtfcplit to rlhqetfcsplit.
  12. % Renamed rlrqtfcfullsplit to rlhqetfcfullsplit.
  13. % Renamed rlrqtfcfast to rlhqetfcfast.
  14. % Renamed rlrqvb to rlhqevb.
  15. % Renamed rlrqvarsel to rlhqevarsel.
  16. % Renamed rlrqvarselx to rlhqevarselx.
  17. % Renamed rlrqdim0 to rlhqedim0.
  18. % Renamed rlrqtheory to rlhqetheory.
  19. % Renamed rlrqgbred to rlhqegbred.
  20. % Renamed rlrqconnect to rlhqeconnect.
  21. % Renamed rlrqstrconst to rlhqestrconst.
  22. % Renamed gbdimmin to rlhqegbdimmin.
  23. %
  24. % Revision 1.22 2003/10/21 15:22:31 gilch
  25. % Added switches for type formual computation.
  26. % Added switches for HQE.
  27. %
  28. % Revision 1.21 2003/10/12 19:41:14 sturm
  29. % Introduced rl_texmacs. The test "if get('or,'fancy!-infix!-symbol) = 218"
  30. % does not work in general since Windows does not guarantee to load
  31. % fmprint at startup.
  32. %
  33. % Revision 1.20 2003/08/21 14:46:38 seidl
  34. % Fancy printing for bounded quantifiers (for TeXmacs).
  35. %
  36. % Revision 1.19 2003/07/08 13:34:23 sturm
  37. % Added support for TeXmacs.
  38. %
  39. % Revision 1.18 2003/06/03 15:40:33 seidl
  40. % Added case for bounded quantifiers to rl_cxp.
  41. %
  42. % Revision 1.17 2003/03/27 22:54:35 seidl
  43. % Introduced bounded quantifiers ball and bex. Added access function
  44. % rl_b, constructor rl_mkbq, predicate rl_bquap.
  45. %
  46. % Revision 1.16 2003/01/30 12:27:05 sturm
  47. % Renamed switch vmatverbose to rlvmatvb and moved switch and fluid
  48. % declarations to where they belong.
  49. %
  50. % Revision 1.15 2003/01/29 11:34:45 sturm
  51. % Moved determinant code to from module ofsfcadproj to new module ofsfdet.
  52. %
  53. % Revision 1.14 2003/01/13 10:01:10 dolzmann
  54. % Added entry points for xopt.
  55. %
  56. % Revision 1.13 2003/01/11 16:39:04 sturm
  57. % Switch rlcadverbose on by default.
  58. %
  59. % Revision 1.12 2002/05/28 13:22:00 sturm
  60. % Added black box rl_fbqe() and corresponding switch rlqefb.
  61. % That is, for ofsf, rlqe uses rlcad in case of failure now.
  62. %
  63. % Revision 1.11 2002/05/28 13:12:23 seidla
  64. % Added switches rlcadpreponly, rlcadte and rlcadpbfvs, changed default for
  65. % switch rlcadaproj to off.
  66. %
  67. % Revision 1.10 2002/01/25 14:42:36 sturm
  68. % Added switch rlcaddecdeg, off by default.
  69. %
  70. % Revision 1.9 2002/01/18 15:37:34 seidla
  71. % Default value for switch rlcadpartial set to ON. Removed unused
  72. % switches rlallp and rlanuex. Added switch rlcaddnfformula.
  73. %
  74. % Revision 1.8 2002/01/16 13:04:02 seidla
  75. % Imported CAD from rlprojects.
  76. %
  77. % Revision 1.7 1999/09/22 13:02:12 dolzmann
  78. % Added switch definitions for the ofsf part of susi.
  79. %
  80. % Revision 1.6 1999/03/23 12:26:37 sturm
  81. % Renamed switch rlsisqf to rlsiatadv.
  82. %
  83. % Revision 1.5 1999/03/23 09:23:41 dolzmann
  84. % Changed copyright information.
  85. % Added list of exported procedures.
  86. %
  87. % Revision 1.4 1999/03/21 13:38:51 dolzmann
  88. % Added switch rlsusi.
  89. %
  90. % Revision 1.3 1999/03/18 14:08:22 sturm
  91. % Added new service rl_specelim!* in cl_qe for covering the "super
  92. % quadratic special case' for ofsf. This method is toggled by switch
  93. % rlsqsc, which is off by default. Context dvfsf uses cl_specelim which
  94. % is constantly "false." Context acfsf does not use cl_qe at all.
  95. %
  96. % Revision 1.2 1998/04/09 11:00:09 sturm
  97. % Added switch rlqeqsc for quadratic special case. This now OFF by default!
  98. %
  99. % Revision 1.1 1997/08/18 14:51:10 sturm
  100. % Renamed "rl.red" to this file "redlog.red".
  101. % Adapted created!-package.
  102. %
  103. % ----------------------------------------------------------------------
  104. % Revision 1.15 1997/08/12 17:03:51 sturm
  105. % Fixed fancy printing for Xr and PC versions.
  106. %
  107. % Revision 1.14 1996/10/23 11:28:08 dolzmann
  108. % Added switch rlqevarsel and corresponding code.
  109. %
  110. % Revision 1.13 1996/10/20 15:55:07 sturm
  111. % Added switches rlnzden, rlposden, and rladdcond and corresponding code
  112. % handling the input of reciprocal terms.
  113. %
  114. % Revision 1.12 1996/10/08 13:54:52 dolzmann
  115. % Renamed "degree parity decomposition" to "parity decomposition".
  116. % Adapted names of procedures and switches accordingly.
  117. %
  118. % Revision 1.11 1996/10/08 13:01:26 dolzmann
  119. % Removed switch rltabcb.
  120. %
  121. % Revision 1.10 1996/10/01 10:25:17 reiske
  122. % Introduced new service rltnf and related code.
  123. %
  124. % Revision 1.9 1996/09/29 14:21:25 sturm
  125. % Removed switch rlqeans. Introduced service rlqea instead.
  126. % Also introduced corresponding service rlgqea.
  127. %
  128. % Revision 1.8 1996/09/05 11:16:37 dolzmann
  129. % Introduced new switch !*rlqegenct.
  130. % Turned on rlsiexpla by default.
  131. % Introduced property cleanupfn on the internal service procedure identifier.
  132. %
  133. % Revision 1.7 1996/07/13 11:22:22 dolzmann
  134. % Introduced new switches rlgsbnf and rlgsutord with default values.
  135. %
  136. % Revision 1.6 1996/07/08 07:18:42 sturm
  137. % ex, all, and !*fof are no longer operators. Consequently, the number
  138. % of arguments of ex and all is checked now.
  139. %
  140. % Revision 1.5 1996/07/02 15:12:21 sturm
  141. % Fixed a bug in length computation.
  142. %
  143. % Revision 1.4 1996/06/24 09:11:44 sturm
  144. % Put 'lengthfn to rtype 'logical instead of tag '!*fof.
  145. %
  146. % Revision 1.3 1996/06/05 15:10:42 sturm
  147. % Turned off rlsimpl and rlsiexpla by default.
  148. % Changed the subfn of the rtype logical to rl_sub!*fof.
  149. %
  150. % Revision 1.2 1996/05/12 08:28:07 sturm
  151. % Introduced new switches rldavgcd and rlsitsqspl.
  152. %
  153. % Revision 1.1 1996/03/22 12:18:24 sturm
  154. % Moved and split.
  155. %
  156. % Revision 1.23 1996/03/18 15:47:20 sturm
  157. % Added service rlatml.
  158. % Made rl_simp apply rl_simpl in dependence on the switch rlsimpl.
  159. % Changed rl_reval to avoid double simplification.
  160. % Removed rl_aeval.
  161. % Major changes in the treatment of switches. Moved default declarations
  162. % from context files to here.
  163. % Major changes in rl_set.
  164. % Removed treatment of several context properties: rl_enterargnum,
  165. % rl_me2tag, rl_tag2me.
  166. % The for loop actions "mkand" and "mkor" flatten the top-level now.
  167. % Moved rl operator classification predicates from module cl to here.
  168. % Rewritten rl_prepfof1, rl_resimp.
  169. % Changed context conversion in rl_simp!*fof.
  170. % Added macros rl_mkbb: black boxes are introduced by this now.
  171. % Added macro rl_mkserv replacing smacro rl_mkinterf. Major changes in
  172. % AM-SM paramter passing routines.
  173. % Changed data-driven code for internal representations. Introduced
  174. % "rl_"-properties on the context tag: rl_lengthat, rl_resimpat, and
  175. % rl_prepat, rl_prepterm, rl_simpterm.
  176. %
  177. % Revision 1.22 1996/03/11 13:19:03 reiske
  178. % Added black boxes fctrat and tordp.
  179. % Added interface for rlapnf and rlifacl.
  180. %
  181. % Revision 1.21 1996/03/10 13:04:09 sturm
  182. % Added switch rlqeheu.
  183. % Added interface for rlmatrix.
  184. %
  185. % Revision 1.20 1996/03/10 12:48:34 dolzmann
  186. % Added new switch !*rlgsvb.
  187. %
  188. % Revision 1.19 1996/03/09 13:37:01 sturm
  189. % Added switch rlqesr.
  190. % Renamed fluid rl_tag!* to rl_cid!*, removed fluid rl_ctag!*.
  191. % Moved rl_updcache1 to rl_updcache.
  192. % Moved the black boxes from module cl to here changing the "cl_"
  193. % prefixes into "rl_".
  194. % Moved the constructors/access functions from module cl to here
  195. % renaming them as follows:
  196. % cl_op -> rl_op
  197. % cl_arg1 -> rl_arg1
  198. % cl_arg2l -> rl_arg2l
  199. % cl_arg2r -> rl_arg2r
  200. % cl_argn -> rl_argn
  201. % cl_var -> rl_var
  202. % cl_mat -> rl_mat
  203. % cl_constr1 -> rl_mk1
  204. % cl_constr2 -> rl_mk2
  205. % cl_constrn -> rl_mkn
  206. % cl_sconstrn -> rl_smkn
  207. % cl_constrq -> rl_mkq
  208. % Overworked structuring into submodules.
  209. % Added primitive support for a subfn.
  210. %
  211. % Revision 1.18 1996/03/04 17:14:14 sturm
  212. % Moved the treatment of the switch !*rlsimpl to rl_mk!*fof and
  213. % rl_prepfof. Turned off !*rlrealtime temporarily for the call to
  214. % rl_simpl.
  215. %
  216. % Revision 1.17 1996/03/04 13:09:39 dolzmann
  217. % Added switch !*rlbnfsac.
  218. % Removed switch !*rlbnfsb.
  219. %
  220. % Revision 1.16 1996/02/26 12:51:38 sturm
  221. % Fixed bugs in rl_updcache1 and rl_mkinterf.
  222. %
  223. % Revision 1.15 1996/02/18 14:07:41 sturm
  224. % Added switches rlsifac and rlqegsd.
  225. % Removed switch rlqesdnf.
  226. % Added optional theory to rlqe. Modified rl_qe!-s2a accordingly.
  227. % Made rlatl available in the AM.
  228. %
  229. % Revision 1.14 1996/02/18 12:42:52 dolzmann
  230. % Fixed a bug in rl_simp.
  231. % Added optional parameters to rlgsc, rlgsd, and rlgsn.
  232. % Added switch rlgserf.
  233. %
  234. % Revision 1.13 1995/11/16 08:12:14 sturm
  235. % Added switch rlsimpl and respective code.
  236. % Added primitive support for Xr.
  237. % Rewritten rl_simpq: Variable lists as first argument are possible now.
  238. % Added module rlfor implementing mkand and mkor actions in for-loops.
  239. % Added an optional parameter to the interface for rlex and rlall.
  240. %
  241. % Revision 1.12 1995/10/18 10:17:59 sturm
  242. % Added switches rlbnfsb and rlbnfsm.
  243. %
  244. % Revision 1.11 1995/09/05 07:59:02 sturm
  245. % Added switches rlqesdnf, rlsipw, rlsipo.
  246. %
  247. % Revision 1.10 1995/08/31 13:57:32 sturm
  248. % Added procedure rl_!*foflength.
  249. % Modified rl_mk!*fof for a more consistent AM representation of atomic
  250. % formulas.
  251. %
  252. % Revision 1.9 1995/08/30 07:44:14 sturm
  253. % Modified rl_set. It accepts and returns a list now. Added fluid
  254. % rl_argl!* for the extra rl_set parameters.
  255. % Removed psopfn rl_set from AM.
  256. % Fixed rlrealtime to nil in rl_identifyonoff.
  257. %
  258. % Revision 1.8 1995/08/08 10:22:39 sturm
  259. % Removed switch rldev and dependent code.
  260. % Renamed rl_ppriand to rl_ppriop. It is now used with all RL infix
  261. % operators.
  262. % Added rl_prepq.
  263. % Fixed a bug in procedure rl_mkinterf1.
  264. % Added extra optional argument to rlsimpl. Extended its AM backconversion.
  265. %
  266. % Revision 1.7 1995/08/03 05:32:52 dolzmann
  267. % Added procedure rlgsn.
  268. %
  269. % Revision 1.6 1995/08/02 07:22:02 sturm
  270. % Added fluid rl_deflang!* and default language code.
  271. % Added switches rlsiidem and rlsiso.
  272. % Changed copyright messages.
  273. %
  274. % Revision 1.5 1995/07/12 15:11:26 sturm
  275. % Added procedure rl_identifyonoff.
  276. %
  277. % Revision 1.4 1995/07/07 11:29:50 sturm
  278. % Removed "_" in switch names and AM interface names.
  279. % Added switches rlrealtime, rlopt1s, renamed switch rl_smsimpl to rlsism.
  280. % Renamed Groebner simplifiers: rl_gbcsimpl to rlgsc and
  281. % rl_gbdsimpl to rlgsd.
  282. % Added procedures rl_simpterm, rl_prepterm, and rl_mkterm.
  283. % Major changes in module rl3 (AM interface), added realtime code.
  284. %
  285. % Revision 1.3 1995/06/21 09:04:37 sturm
  286. % Removed declarations of non-used local variables.
  287. % Commented create!-package out.
  288. % Changed qe inteface, added opt and optgen interfaces.
  289. % Added switches rl_parallel, rl_qeans, rl_qedfs.
  290. % Renamed switches rl_tablib and rl_tablcb to rl_tabib and rl_tabcb resp.
  291. %
  292. % Revision 1.2 1995/06/01 13:36:37 dolzmann
  293. % Renamed switch rl_nocheck to rl_sichk with opposite semantic.
  294. % Added switch rl_gsprod.
  295. % Moved treatment of SQ's from rl_simpatom to rl_simp.
  296. %
  297. % Revision 1.1 1995/05/29 14:47:22 sturm
  298. % Initial check-in.
  299. %
  300. % ----------------------------------------------------------------------
  301. lisp <<
  302. fluid '(rl_rcsid!* rl_copyright!*);
  303. rl_rcsid!* := "$Id: redlog.red,v 1.24 2003/11/11 15:08:19 sturm Exp $";
  304. rl_copyright!* := "Copyright (c) 1995-1999 by A. Dolzmann and T. Sturm"
  305. >>;
  306. module redlog;
  307. % Reduce logic component.
  308. create!-package('(redlog rlami rlsched rlcont),nil);
  309. exports quotelog,rl_mkbb,rl_mkserv,rl_op,rl_arg1,rl_arg2l,rl_arg2r,rl_argn,
  310. rl_var,rl_mat,rl_mk1,rl_mk2,rl_mkn,rl_smkn,rl_mkq,rl_quap,rl_junctp,rl_basbp,
  311. rl_extbp,rl_boolp,rl_tvalp,rl_cxp,rl_mk!*fof,rl_reval,rl_prepfof,rl_cleanup,
  312. rl_simp,rl_simpbop,rl_simpq,rl_simp!*fof,rl_lengthlogical,rl_sub!*fof,
  313. rl_print!*fof,rl_priq,rl_ppriop,rl_fancy!-ppriop,rl_fancy!-priq,
  314. rl_interf1,rl_a2s!-decdeg1,rl_a2s!-varl,rl_a2s!-number,rl_a2s!-id,
  315. rl_a2s!-atl,rl_a2s!-posf,rl_s2a!-simpl,rl_s2a!-gqe,rl_s2a!-gqea,rl_s2a!-qea,
  316. rl_s2a!-opt,rl_s2a!-atl,rl_s2a!-ml,rl_s2a!-term,rl_s2a!-decdeg1,
  317. rl_a2s!-targfn,rl_a2s!-terml,rl_s2a!-terml,rl_a2s!-term,rl_s2a!-varl,
  318. rl_s2a!-fbvarl,rl_s2a!-struct,rlmkor,rlmkand,rl_set!$,rl_set,rl_exit,
  319. rl_enter,rl_onp,rl_vonoff,rl_updcache,rl_serviadd,rl_bbiadd;
  320. fluid '(rl_cid!* rl_argl!* rl_deflang!* rl_ocswitches!* rl_bbl!* rl_servl!*);
  321. fluid '(fancy!-line!* fancy!-pos!*);
  322. switch rlsism,rlsichk,rlsiidem,rlsiatadv,rlsipd,rlsiexpl,rlsiexpla,rlsiso,
  323. rlsipw,rlsipo,rltabib,rlverbose,rlrealtime,rlidentify,rlgssub,rlgsrad,
  324. rlgsred,rlgsprod,rlqepnf,rlqedfs,rlparallel,rlopt1s,rlbrop,
  325. rlbnfsm,rlsimpl,rlsifac,rlqegsd,rlgserf,rlbnfsac,rlgsvb,rlqesr,rlqeheu,
  326. rldavgcd,rlsitsqspl,rlgsbnf,rlgsutord,rlqegenct,rltnft,rlnzden,rlposden,
  327. rladdcond,rlqevarsel,rlqeqsc,rlqesqsc,rlsusi,rlsusimult,rlsusigs,rlsusiadd,
  328. rlcadfac,rlcaddnfformula,rlcadprojonly,rlcadpreponly,rlcadbaseonly,
  329. rlcadextonly,rlcadverbose,rlcadfasteval,rlcaddebug,rlcadpartial,
  330. rlcadfulldimonly,rlcadtrimtree,rlcadrawformula,rlcadisoallroots,rlcadaproj,
  331. rlcadaprojalways,rlcadhongproj,rlanuexverbose,rlanuexdifferentroots,
  332. rlanuexdebug,rlanuexpsremseq,rlanuexgcdnormalize,rlanuexsgnopt,rlcaddecdeg,
  333. rlcadte,rlcadpbfvs,rlqefb,rlxopt,rlxoptsb,rlxoptpl,rlxoptri,rlxoptric,
  334. rlxoptses,rlxoptrir,rlourdet,rlvmatvb,rlhqetfcsplit,rlhqetfcfullsplit,
  335. rlhqetfcfast,rlhqevb,rlhqevarsel,rlhqevarselx,rlhqedim0,rlhqetheory,
  336. rlhqegbred,rlhqeconnect,rlhqestrconst,rlhqegbdimmin;
  337. on1 'rlbrop;
  338. off1 'rlbnfsm;
  339. on1 'rlbnfsac;
  340. on1 'rlqepnf;
  341. on1 'rlsiso;
  342. on1 'rlsiidem;
  343. off1 'rlidentify;
  344. off1 'rlrealtime;
  345. off1 'rlparallel;
  346. off1 'rlopt1s;
  347. off1 'rlqedfs;
  348. off1 'rlverbose;
  349. on1 'rlsichk;
  350. on1 'rlsism;
  351. off1 'rlsipw;
  352. on1 'rlsipo;
  353. on1 'rltabib;
  354. on1 'rlgssub;
  355. on1 'rlgsrad;
  356. on1 'rlgsred;
  357. on1 'rlgserf;
  358. off1 'rlgsprod;
  359. on1 'rlgsvb;
  360. off1 'rlsimpl;
  361. on1 'rlsiatadv;
  362. on1 'rlsipd;
  363. on1 'rlsiexpl;
  364. on1 'rlsiexpla;
  365. on1 'rlsifac;
  366. off1 'rlqesr;
  367. on1 'rlqeheu;
  368. off1 'rlqegsd;
  369. on1 'rldavgcd;
  370. on1 'rlsitsqspl;
  371. on1 'rlgsbnf;
  372. off1 'rlgsutord;
  373. on1 'rlqegenct;
  374. on1 'rltnft;
  375. on1 'rlqevarsel;
  376. off1 'rlnzden;
  377. off1 'rlposden;
  378. off1 'rladdcond;
  379. off1 'rlqeqsc;
  380. off1 'rlqesqsc;
  381. off1 'rlsusi;
  382. on1 'rlsusimult;
  383. off1 'rlsusigs;
  384. on1 'rlsusiadd;
  385. on1 'rlcadfac;
  386. on1 'rlcaddnfformula;
  387. off1 'rlcadpreponly;
  388. off1 'rlcadprojonly;
  389. off1 'rlcadbaseonly;
  390. off1 'rlcadextonly;
  391. on1 'rlcadverbose;
  392. on1 'rlcadfasteval;
  393. off1 'rlcaddebug;
  394. on1 'rlcadpartial;
  395. off1 'rlcadfulldimonly;
  396. on1 'rlcadtrimtree;
  397. off1 'rlcadrawformula;
  398. off1 'rlcadisoallroots;
  399. off1 'rlcadaproj;
  400. off1 'rlcadaprojalways;
  401. on1 'rlcadhongproj;
  402. off1 'rlanuexverbose;
  403. on1 'rlanuexdifferentroots;
  404. off1 'rlanuexdebug;
  405. off1 'rlanuexpsremseq;
  406. on1 'rlanuexgcdnormalize;
  407. off1 'rlanuexsgnopt;
  408. off1 'rlcaddecdeg;
  409. on1 'rlcadte;
  410. on1 'rlcadpbfvs;
  411. on1 'rlqefb;
  412. on1 'rlxopt;
  413. on1 'rlxoptsb; % select boundary type
  414. on1 'rlxoptpl; % passive list
  415. on1 'rlxoptri; % result inheritance
  416. off1 'rlxoptric; % result inheritance to conatiner
  417. off1 'rlxoptrir; % result inheritance to result
  418. on1 'rlxoptses; % structural elimination sets.
  419. off1 'rlourdet;
  420. off1 'rlvmatvb; % Fixied switch, provides debugging within ofsfdet
  421. on1 'rlhqetfcsplit; % Splits type formula computation up to degree 4.
  422. off1 'rlhqetfcfast; % Splits type formula computation unconditionally.
  423. off1 'rlhqetfcfullsplit; % Compute case distinctions only for unknown signs.
  424. off1 'rlhqevb; % More verbose output.
  425. on1 'rlhqevarsel; % Optimize variable selection in the case dim I=n.
  426. on1 'rlhqevarselx; % Advances optimization with more computational effort.
  427. on1 'rlhqetheory; % Use initial conditions for CGB computation.
  428. off1 'rlhqedim0; % Only zero dimensional branches.
  429. off1 'rlhqegbred; % Use reduced Groebner systems.
  430. off1 'rlhqeconnect; % Connect branches which differs only in the theory.
  431. on1 'rlhqestrconst; % Use combined structure constants.
  432. on1 'rlhqegbdimmin; % Choose maximal independent variable set with
  433. % minimal cardinality in the case 0<dim<n.
  434. put('rlidentify,'simpfg,
  435. '((t (rl_identifyonoff t)) (nil (rl_identifyonoff nil))));
  436. procedure quotelog(x); 'logical;
  437. procedure rl_texmacsp();
  438. get('tmprint,'package);
  439. put('logical,'evfn,'rl_reval);
  440. put('logical,'subfn,'rl_sub!*fof);
  441. put('logical,'lengthfn,'rl_lengthlogical);
  442. put('!*fof,'prifn,'rl_print!*fof);
  443. put('!*fof,'fancy!-prifn,'rl_print!*fof);
  444. %put('!*fof,'prifn,'prin2!*);
  445. put('!*fof,'rtypefn,'quotelog);
  446. put('!*fof,'rl_simpfn,'rl_simp!*fof);
  447. put('and,'rtypefn,'quotelog);
  448. put('and,'rl_simpfn,'rl_simpbop);
  449. put('and,'rl_prepfn,'rl_prepbop);
  450. put('and,'pprifn,'rl_ppriop);
  451. put('and,'fancy!-pprifn,'rl_fancy!-ppriop);
  452. put('or,'rtypefn,'quotelog);
  453. put('or,'rl_simpfn,'rl_simpbop);
  454. put('or,'rl_prepfn,'rl_prepbop);
  455. put('or,'pprifn,'rl_ppriop);
  456. put('or,'fancy!-pprifn,'rl_fancy!-ppriop);
  457. put('not,'rtypefn,'quotelog);
  458. put('not,'rl_simpfn,'rl_simpbop);
  459. put('not,'rl_prepfn,'rl_prepbop);
  460. algebraic infix impl;
  461. put('impl,'rtypefn,'quotelog);
  462. put('impl,'rl_simpfn,'rl_simpbop);
  463. put('impl,'rl_prepfn,'rl_prepbop);
  464. put('impl,'number!-of!-args,2);
  465. put('impl,'pprifn,'rl_ppriop);
  466. if rl_texmacsp() then
  467. put('impl,'fancy!-infix!-symbol,"\longrightarrow ")
  468. else
  469. put('impl,'fancy!-infix!-symbol,222);
  470. algebraic infix repl;
  471. put('repl,'rtypefn,'quotelog);
  472. put('repl,'rl_simpfn,'rl_simpbop);
  473. put('repl,'rl_prepfn,'rl_prepbop);
  474. put('repl,'number!-of!-args,2);
  475. put('repl,'pprifn,'rl_ppriop);
  476. if rl_texmacsp() then
  477. put('repl,'fancy!-infix!-symbol,"\longleftarrow ")
  478. else
  479. put('repl,'fancy!-infix!-symbol,220);
  480. algebraic infix equiv;
  481. put('equiv,'rtypefn,'quotelog);
  482. put('equiv,'rl_simpfn,'rl_simpbop);
  483. put('equiv,'rl_prepfn,'rl_prepbop);
  484. put('equiv,'number!-of!-args,2);
  485. put('equiv,'pprifn,'rl_ppriop);
  486. if rl_texmacsp() then
  487. put('equiv,'fancy!-infix!-symbol,"\longleftrightarrow ")
  488. else
  489. put('equiv,'fancy!-infix!-symbol,219);
  490. flag('(impl repl equiv and or),'spaced);
  491. precedence equiv,when;
  492. precedence repl,equiv;
  493. precedence impl,repl;
  494. flag('(true false),'reserved);
  495. put('ex,'rtypefn,'quotelog);
  496. put('ex,'rl_simpfn,'rl_simpq);
  497. put('ex,'number!-of!-args,2);
  498. put('ex,'prifn,'rl_priq);
  499. put('ex,'rl_prepfn,'rl_prepq);
  500. put('ex,'fancy!-prifn,'rl_fancy!-priq);
  501. if rl_texmacsp() then
  502. put('ex,'fancy!-functionsymbol,"\exists ")
  503. else
  504. put('ex,'fancy!-functionsymbol,36);
  505. put('all,'rtypefn,'quotelog);
  506. put('all,'rl_simpfn,'rl_simpq);
  507. put('all,'number!-of!-args,2);
  508. put('all,'prifn,'rl_priq);
  509. put('all,'rl_prepfn,'rl_prepq);
  510. put('all,'fancy!-prifn,'rl_fancy!-priq);
  511. if rl_texmacsp() then
  512. put('all,'fancy!-functionsymbol,"\forall ")
  513. else
  514. put('all,'fancy!-functionsymbol,34);
  515. put('bex,'rtypefn,'quotelog);
  516. put('bex,'rl_simpfn,'rl_simpbq);
  517. put('bex,'number!-of!-args,3);
  518. put('bex,'prifn,'rl_pribq);
  519. put('bex,'rl_prepfn,'rl_prepbq); % semms not to be used!
  520. %put('bex,'fancy!-functionsymbol,36);
  521. put('bex,'fancy!-prifn,'rl_fancy!-pribq);
  522. if rl_texmacsp() then
  523. put('bex,'fancy!-functionsymbol,"\bigvee ")
  524. else
  525. put('bex,'fancy!-functionsymbol,36); %%% 36 okay?
  526. put('ball,'rtypefn,'quotelog);
  527. put('ball,'rl_simpfn,'rl_simpbq);
  528. put('ball,'number!-of!-args,3);
  529. put('ball,'prifn,'rl_pribq);
  530. put('ball,'rl_prepfn,'rl_prepbq);
  531. %put('ball,'fancy!-functionsymbol,34);
  532. put('ball,'fancy!-prifn,'rl_fancy!-pribq);
  533. if rl_texmacsp() then
  534. put('ball,'fancy!-functionsymbol,"\bigwedge ")
  535. else
  536. put('ball,'fancy!-functionsymbol,34); %%% 34 okay?
  537. flag('(rl_simpbop rl_simpq rl_simpbq rl_prepbop rl_prepq rl_prepbq),'full);
  538. macro procedure rl_mkbb(lst);
  539. % Make black box.
  540. begin scalar args,vn,name,n,prgn;
  541. name := eval cadr lst;
  542. n := eval caddr lst;
  543. args := for i := 1:n collect mkid('a,i);
  544. vn := intern compress nconc(explode name,'(!! !*));
  545. prgn := {'setq,'rl_bbl!*,{'cons,mkquote vn,'rl_bbl!*}} . prgn;
  546. prgn := {'put,mkquote name,''number!-of!-args,n} . prgn;
  547. prgn := {'de,name,args,{'apply,vn,'list . args}} . prgn;
  548. prgn := {'fluid,mkquote {vn}} . prgn;
  549. return 'progn . prgn
  550. end;
  551. macro procedure rl_mkserv(argl);
  552. begin
  553. scalar bname,evalfnl,oevalfnl,odefl,resconv,amp,len,
  554. args,sm,smv,prgn,am,psval;
  555. bname := eval nth(argl,2);
  556. evalfnl := eval nth(argl,3);
  557. oevalfnl := eval nth(argl,4);
  558. odefl := eval nth(argl,5);
  559. resconv := eval nth(argl,6);
  560. amp := eval nth(argl,7);
  561. len := length evalfnl + length oevalfnl;
  562. args := for i := 1:len collect mkid('a,i);
  563. sm := intern compress append('(!r !l !_),explode bname);
  564. smv := intern compress nconc(explode sm,'(!! !*));
  565. prgn := {'setq,'rl_servl!*,{'cons,mkquote smv,'rl_servl!*}} . prgn;
  566. prgn := {'put,mkquote sm,''number!-of!-args,len} . prgn;
  567. prgn := {'de,sm,args,{'apply,smv,'list . args}} . prgn;
  568. prgn := {'fluid,mkquote {smv}} . prgn;
  569. if amp then <<
  570. am := intern compress append('(!r !l),explode bname);
  571. psval := intern compress nconc(explode sm,'(!! !$));
  572. prgn := {'put,mkquote am,''psopfn,mkquote psval} . prgn;
  573. prgn := {'put,mkquote psval,''number!-of!-args,1} . prgn;
  574. prgn := {'put,mkquote psval,''cleanupfn,''rl_cleanup} . prgn;
  575. prgn := {'de,psval,'(argl),{'rl_interf1,mkquote sm,mkquote evalfnl,
  576. mkquote oevalfnl,mkquote odefl,mkquote resconv,'argl}} . prgn
  577. >>;
  578. return 'progn . prgn
  579. end;
  580. procedure rl_op(f);
  581. % Reduce logic operator. [f] is a formula. Returns the top-level
  582. % operator of [f]. In this sense truth values are operators.
  583. if atom f then f else car f;
  584. procedure rl_arg1(f);
  585. % Reduce logic argument of unary operator. [f] is a formula $\tau
  586. % (\phi)$ with a unary boolean top-level operator $\tau$. Returns
  587. % the single argument $\phi$ of $\tau$.
  588. cadr f;
  589. procedure rl_arg2l(f);
  590. % Reduce logic left hand side argument of binary operator. [f] is a
  591. % formula $\tau(\phi_1,\phi_2)$ with a binary boolean top-level
  592. % operator $\tau$. Returns the left hand side argument $\phi_1$ of
  593. % $\tau$.
  594. cadr f;
  595. procedure rl_arg2r(f);
  596. % Reduce logic right hand side argument of binary operator. [f] is
  597. % a formula $\tau(\phi_1,\phi_2)$ with a binary boolean top-level
  598. % operator $\tau$. Returns the right hand side argument $\phi_2$ of
  599. % $\tau$.
  600. caddr f;
  601. procedure rl_argn(f);
  602. % Reduce logic argument list of n-ary operator. [f] is a formula
  603. % $\tau(\phi_1,...)$ with unary, binary, or $n$-ary top-level
  604. % operator $\tau$. Returns the arguments of $\tau$ as a list
  605. % $(\phi_1,...)$.
  606. cdr f;
  607. procedure rl_var(f);
  608. % Reduce logic variable. [f] is a formula $Q x (\phi)$ where $Q$ is
  609. % a quantifier. Returns the quantified variable $x$.
  610. cadr f;
  611. procedure rl_mat(f);
  612. % Reduce logic matrix. [f] is a formula $Q x (\phi)$ where $Q$ is a
  613. % quantifier. Returns the matrix $\phi$.
  614. caddr f;
  615. procedure rl_b(f);
  616. % Reduce logic bound. [f] is a formula starting with a bounded
  617. % quantifier. Returns the bound.
  618. cadddr f;
  619. procedure rl_mk1(uop,arg);
  620. % Reduce logic make formula for unary operator. [uop] is a unary
  621. % operator, [arg] is a formula. Returns the formula $[uop]([arg])$
  622. % with top-level operator [uop] and argument [arg].
  623. {uop,arg};
  624. procedure rl_mk2(bop,larg,rarg);
  625. % Reduce logic make formula for binary operator. [bop] is a binary
  626. % operator, [larg] and [rarg] are formulas. Returns the formula
  627. % $[bop]([larg],[rarg])$ with top-level operator [bop], left hand
  628. % side [larg], and right hand side [rarg].
  629. {bop,larg,rarg};
  630. procedure rl_mkn(nop,argl);
  631. % Reduce logic make formula for n-ary operator. [nop] is a unary,
  632. % binary, or $n$-ary operator; [argl] is a list $(\phi_1,...)$ of
  633. % formulas; for binary or $n$-ary [nop] the length of [argl] is a
  634. % least 2. Returns the formula $[nop](\phi_1,..)$ with top-level
  635. % operator [nop], and the elements of [argl] as its arguments.
  636. nop . argl;
  637. procedure rl_smkn(nop,argl);
  638. % Reduce logic safe make formula for n-ary operator. [nop] is one
  639. % of ['and], ['or]; [argl] is a list $(\phi_1,...)$ of formulas.
  640. % Returns a formula. If [argl] is empty, ['true] is returned for
  641. % $[nop]=['and]$, and $['false]$ is returned for $[nop]=['or]$. If
  642. % [argl] is of length 1, its single element $\phi_1$ is returned.
  643. % Else the formula $[nop](\phi_1,..)$ with top-level operator
  644. % [nop], and the elements of [argl] as its arguments is returned.
  645. if argl and cdr argl then
  646. nop . argl
  647. else if null argl then
  648. if nop eq 'and then 'true else 'false
  649. else
  650. car argl;
  651. procedure rl_mkq(q,v,m);
  652. % Reduce logic make quantified formula. [q] is a quantifier, [v] is
  653. % a variable, [m] is a formula. Returns the formula $[q] [x] ([m])$
  654. % which is quantified with quantifier [q], quantified variable [v],
  655. % and matrix [m].
  656. {q,v,m};
  657. procedure rl_mkbq(q,v,b,m);
  658. % Reduce logic make quantified formula. [q] is a quantifier, [v] is
  659. % a variable, [b] is a fof with x as only free variable, [m] is a
  660. % formula. Returns a formula which is quantified with quantifier
  661. % [q], quantified variable [v], which is restricted by [b] and
  662. % matrix [m].
  663. {q,v,m,b};
  664. procedure rl_quap(x);
  665. % Reduce logic quantifier predicate. [x] is any S-expression.
  666. % Returns non-[nil] iff [x] is a quantifier.
  667. x eq 'ex or x eq 'all;
  668. procedure rl_bquap(x);
  669. % Reduce logic bounded quantifier predicate. [x] is any
  670. % S-expression. Returns non-[nil] iff [x] is a bounded quantifier.
  671. x eq 'bex or x eq 'ball;
  672. procedure rl_junctp(x);
  673. % Reduce logic junctor predicate. [x] is any S-expression. Returns
  674. % non-[nil] iff [x] is one of ['and], ['or] which we refer to as
  675. % junctors.
  676. x eq 'or or x eq 'and;
  677. procedure rl_basbp(x);
  678. % Reduce logic basic boolean operator predicate. [x] is any
  679. % S-expression. Returns non-[nil] iff [x] is a junctor or ['not].
  680. % We refer to these as basic boolean operators.
  681. rl_junctp x or x eq 'not;
  682. procedure rl_extbp(x);
  683. % Reduce logic extended boolean operator predicate. [x] is any
  684. % S-expression. Returns non-[nil] iff [x] is one of ['impl],
  685. % ['repl], or ['equiv]. We refer to these as basic boolean
  686. % operators.
  687. x eq 'impl or x eq 'repl or x eq 'equiv;
  688. procedure rl_boolp(x);
  689. % Reduce logic boolean operator predicate. [x] is any S-expression.
  690. % Returns non-[nil] iff [x] is a boolean operator, i.e. one of
  691. % ['and], ['or], ['not], ['impl], ['repl], or ['equiv].
  692. rl_basbp x or rl_extbp x;
  693. procedure rl_tvalp(x);
  694. % Reduce logic truth value predicate. [x] is any S-expression.
  695. % Returns non-[nil] iff [x] is one of ['true], ['false].
  696. x eq 'true or x eq 'false;
  697. procedure rl_cxp(x);
  698. % Reduce logic complex, i.e., non-atomic, operator predicate.
  699. rl_tvalp x or rl_boolp x or rl_quap x or rl_bquap x;
  700. endmodule; % [redlog]
  701. end; % of file