cl.red 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. % ----------------------------------------------------------------------
  2. % $Id: cl.red,v 1.12 1999/04/13 13:17:57 sturm Exp $
  3. % ----------------------------------------------------------------------
  4. % Copyright (c) 1995-1999 Andreas Dolzmann and Thomas Sturm
  5. % ----------------------------------------------------------------------
  6. % $Log: cl.red,v $
  7. % Revision 1.12 1999/04/13 13:17:57 sturm
  8. % Reformatted one comment.
  9. %
  10. % Revision 1.11 1999/04/12 09:28:16 sturm
  11. % Updated comments for exported procedures.
  12. %
  13. % Revision 1.10 1999/03/22 17:06:09 dolzmann
  14. % Changed copyright information.
  15. % Added list of exported procedures.
  16. % Reformatted comments.
  17. %
  18. % Revision 1.9 1997/08/24 16:18:47 sturm
  19. % Added service rl_surep with black box rl_multsurep.
  20. % Added service rl_siaddatl.
  21. %
  22. % Revision 1.8 1996/10/23 11:27:11 dolzmann
  23. % Added switch rlqevarsel and corresponding code.
  24. %
  25. % Revision 1.7 1996/10/10 10:14:27 sturm
  26. % Added missing fluid declarations for !*rlsipw and !*rlsipo.
  27. %
  28. % Revision 1.6 1996/10/01 10:24:53 reiske
  29. % Introduced new service rltnf and related code.
  30. %
  31. % Revision 1.5 1996/09/26 11:50:23 dolzmann
  32. % Fixed a bug in the fluid declaration.
  33. %
  34. % Revision 1.4 1996/09/05 11:11:06 dolzmann
  35. % Added fluid declaration of !*rlbnfsac and !*rltabib.
  36. %
  37. % Revision 1.3 1996/06/07 08:52:14 sturm
  38. % Do not load assist anymore.
  39. %
  40. % Revision 1.2 1996/05/12 08:26:33 sturm
  41. % Loading rltools now.
  42. % Introduced new internal switch !*rlqegen.
  43. %
  44. % Revision 1.1 1996/03/22 10:31:24 sturm
  45. % Moved and split.
  46. %
  47. % Revision 1.22 1996/03/18 15:45:28 sturm
  48. % Moved rl operator classification predicates to module rl.
  49. % Added procedure cl_atml.
  50. % Changed specification of rl_fctrat: the content is dropped now.
  51. %
  52. % Revision 1.21 1996/03/11 13:18:40 reiske
  53. % Added procedures cl_apnf, cl_freevp, and cl_ifacl.
  54. %
  55. % Revision 1.20 1996/03/10 13:03:15 sturm
  56. % Changed verbosity output in module clqe. Added switch !*rlqeheu and
  57. % corresponding code there.
  58. %
  59. % Revision 1.19 1996/03/10 12:48:12 dolzmann
  60. % Minor changes in module clbnf. Procedures use the rl access functions
  61. % for handling strict normal forms.
  62. % Bug fixes in code for order theoretical subsumption and cut.
  63. %
  64. % Revision 1.18 1996/03/09 13:34:07 sturm
  65. % Added procedure cl_matrix.
  66. % Modification in module clqe: pass the ans flag to the "trygauss" black
  67. % box, and via cl_qeatal to the "translat" black box.
  68. % Turned black box smacros into procedures and moved them to the module
  69. % rl changing the "cl_" prefixes into "rl_" accordingly.
  70. % Moved the constructors and access functions to module rl. They have
  71. % been renamed according to the following table:
  72. % cl_op -> rl_op
  73. % cl_arg1 -> rl_arg1
  74. % cl_arg2l -> rl_arg2l
  75. % cl_arg2r -> rl_arg2r
  76. % cl_argn -> rl_argn
  77. % cl_var -> rl_var
  78. % cl_mat -> rl_mat
  79. % cl_constr1 -> rl_mk1
  80. % cl_constr2 -> rl_mk2
  81. % cl_constrn -> rl_mkn
  82. % cl_sconstrn -> rl_smkn
  83. % cl_constrq -> rl_mkq
  84. % Renamed the operator test predicates as follows:
  85. % cl_quantifierp -> cl_quap
  86. % cl_junctorp -> cl_junctp
  87. % cl_basboolopp -> cl_basbp
  88. % cl_extboolopp -> cl_extbp
  89. % cl_boolopp -> cl_boolp
  90. % cl_truthvalp -> cl_tvalp
  91. % cl_opp -> cl_cxp
  92. % Renamed formula test predicates:
  93. % cl_cop -> cl_cxfp
  94. % cl_atp -> cl_atfp
  95. % cl_atlp -> cl_atflp
  96. %
  97. % Revision 1.17 1996/03/04 17:00:56 sturm
  98. % Added loading of assist package.
  99. % Changes in module clqe:
  100. % Added black boxes updatr, transform.
  101. % Modified container data structure and added constructors and access
  102. % functions.
  103. % Modified QE code for handling answer transformations.
  104. % Made requantification work.
  105. % Renamed procedure cl_alist!-union to cl_alpunion.
  106. %
  107. % Revision 1.16 1996/03/04 13:08:55 dolzmann
  108. % Added switch !*rlbnfsac.
  109. % Removed switch !*rlbnfsm.
  110. % Addes black boxes sacat, sacatlp, bnfsimpl.
  111. % Added procedures cl_atlp, cl_ncflp, cl_dnfp, cl_cnfp, cl_bnfp.
  112. % Removed treatment of !*rlbnfsb in cl_gdnf.
  113. % Added procedure cl_sac.
  114. %
  115. % Revision 1.15 1996/02/28 13:13:29 sturm
  116. % Major changes in cl_atl. Now available: cl_atl, cl_atl1, cl_atml1.
  117. %
  118. % Revision 1.14 1996/02/26 12:34:43 sturm
  119. % Moved treatment of elimination failures from the black box translat to
  120. % cl_qeatal1.
  121. %
  122. % Revision 1.13 1996/02/18 13:48:47 sturm
  123. % Added theory to black boxes cl_translat and cl_varsel.
  124. % Added black box cl_trygauss.
  125. % Added switch !*rlqegsd and corresonding call to ofsf_gsd in QE, Dirty!
  126. % Removed superfluous scalars from cl_simpl1.
  127. % Major changes in module clqe: Added theory and prepared for quadratic
  128. % elimination.
  129. %
  130. % Revision 1.12 1996/02/18 12:35:28 dolzmann
  131. % Modified cl_gdnf: Turned on !*rlidentify in dependence on !*rlbnfsb.
  132. % Additionally, turned on !*rlsiso then.
  133. %
  134. % Revision 1.11 1995/11/16 08:03:56 sturm
  135. % Added extra parameter to cl_closure, cl_ex, and cl_all.
  136. % Modified module clqe: The all case is handled by explicit negation now.
  137. % Removed module clxr.
  138. %
  139. % Revision 1.10 1995/10/18 08:38:34 sturm
  140. % Added switches rlbnfsb, rlbnfsm, parameter rlsubsumption!*, and
  141. % respective code.
  142. %
  143. % Revision 1.9 1995/09/05 08:02:20 sturm
  144. % Reimplemented parts of smart simplification. Support for switches
  145. % rlsipo, rlsipw; fixed a bug in smart simplification of impl.
  146. %
  147. % Revision 1.8 1995/08/30 07:58:37 sturm
  148. % Added procedure cl_cop.
  149. % Changes in cl_simpl. Added parameter rl_smsimpl!-equiv1!*.
  150. % Renamed scalar help to hlp in cl_setrel for DOS compatibility.
  151. % Renamed procedure cl_qe!-atfal to cl_qeatal.
  152. % Added switch rlqepnf.
  153. % Started reimplementation of tableau methods (not available in AM).
  154. %
  155. % Revision 1.7 1995/08/08 10:12:05 sturm
  156. % Changes in smart simplification: Added treatment of quantifiers,
  157. % atomic formulas, impl, repl, and equiv.
  158. %
  159. % Revision 1.6 1995/08/02 07:42:29 sturm
  160. % Rewritten simplifier.
  161. % Changed copyright messages.
  162. %
  163. % Revision 1.5 1995/07/12 15:02:57 sturm
  164. % Major changes in module clbnf.
  165. % Added parameter function rl_ordatp!*.
  166. % Added identification of atomic formulas to cl_smsimpl.
  167. % Added procedure cl_identifyonoff and changed some local bindings of
  168. % !*rlidentify to applications of on1 and off1.
  169. %
  170. % Revision 1.4 1995/07/07 10:53:13 sturm
  171. % Removed remflag statement for load!-package.
  172. % Removed "_" in switch names, renamed switch rl_smsimpl to rlsism,
  173. % added switch rlqeans.
  174. % Changes cl_qe, added parameter function rl_qemkans!*.
  175. % Changed cl_pnf, its argument formula is now made positive first.
  176. % Removed cl_terpri and cl_prinf.
  177. %
  178. % Revision 1.3 1995/06/21 07:28:56 sturm
  179. % Removed module tri.
  180. % Adapted preceedence of not to REDUCE 3.6.
  181. % Removed declarations of non-used local variables.
  182. % Minor changes in verbosity output of module qe.
  183. % Commented create!-package out.
  184. %
  185. % Revision 1.2 1995/06/01 13:26:41 dolzmann
  186. % Rewritten procedure cl_gand!-col. Renamed switch rl_nocheck to
  187. % rl_sichk with opposite semantic.
  188. % Fixed a bug in cl_nnf1.
  189. %
  190. % Revision 1.1 1995/05/29 14:47:17 sturm
  191. % Initial check-in.
  192. %
  193. % ----------------------------------------------------------------------
  194. lisp <<
  195. fluid '(cl_rcsid!* cl_copyright!*);
  196. cl_rcsid!* := "$Id: cl.red,v 1.12 1999/04/13 13:17:57 sturm Exp $";
  197. cl_copyright!* := "(c) 1995-1999 A. Dolzmann and T. Sturm"
  198. >>;
  199. module cl;
  200. % Common logic. Generic functions on first order formulas. This module
  201. % contains context independent code possibly addressing some black
  202. % boxes.
  203. create!-package('(cl clsimpl clbnf clnf clqe cltab clmisc),nil);
  204. load!-package 'rltools;
  205. exports cl_atfp,cl_cxfp,cl_atflp,cl_ncflp,cl_dnfp,cl_cnfp,cl_bnfp,cl_simpl,
  206. cl_sitheo,cl_ordp,cl_smcpknowl,cl_smrmknowl,cl_smupdknowl,cl_smmkatl,
  207. cl_smsimpl!-impl,cl_smsimpl!-equiv1,cl_siaddatl,cl_susimkatl,cl_susicpknowl,
  208. cl_susiupdknowl,cl_dnf,cl_cnf,cl_bnf!-cartprod,cl_bnfsimpl,cl_sacatlp,
  209. cl_sacat,cl_expand!-extbool,cl_nnf,cl_nnfnot,cl_pnf,cl_rename!-vars,cl_fvarl,
  210. cl_fvarl1,cl_bvarl,cl_bvarl1,cl_varl,cl_varl1,cl_apnf,cl_freevp,cl_tnf,
  211. cl_gqe,cl_gqea,cl_qe,cl_qea,cl_qeipo,cl_qews,cl_trygauss,cl_specelim,cl_tab,
  212. cl_atab,cl_itab,cl_gentheo,cl_apply2ats,cl_apply2ats1,cl_apply2ats2,cl_atnum,
  213. cl_f2ml,cl_atml,cl_atml1,cl_atl,cl_atl1,cl_identifyonoff,cl_ifacml,
  214. cl_ifacml1,cl_ifacl,cl_ifacl1,cl_matrix,cl_closure,cl_all,cl_ex,cl_flip,
  215. cl_cflip,cl_subfof,cl_termml,cl_termml1,cl_terml,cl_terml1,cl_struct,
  216. cl_ifstruct,cl_surep,cl_splt;
  217. imports rltools;
  218. fluid '(cl_identify!-atl!* !*rlidentify !*rlsichk !*rlsism !*rlsiexpla
  219. !*rlbnfsm !*rlverbose !*rlsiidem !*rlsiso !*rlqepnf !*rlqedfs !*rlqeans
  220. !*rlqegsd !*rlqeheu !*rlqegen !*rlbnfsac !*rltabib !*rltnft !*rlsipw
  221. !*rlsipo !*rlqevarsel !*rlspgs !*rlsithok);
  222. procedure cl_atfp(x);
  223. % Common logic atomic formula predicate. [x] is a formula. Returns
  224. % non-[nil] iff [x] is an atomic formula.
  225. not rl_cxp rl_op x;
  226. procedure cl_cxfp(x);
  227. % Common logic complex formula predicate. [x] is a formula. Returns
  228. % non-[nil] iff [x] is a complex, i.e. non-atomic, formula.
  229. rl_cxp rl_op x;
  230. procedure cl_atflp(fl);
  231. % Common logic atomic formula list predicate. [fl] is a list of
  232. % formulas. Returns [T] or [nil]. [T] is returned if and only if
  233. % [fl] is a list of atomic formulas.
  234. null fl or (cl_atfp car fl and cl_atflp cdr fl);
  235. procedure cl_ncflp(fl);
  236. % Common logic non-complex formula list predicate. [fl] is a list
  237. % of formulas. Returns [T] or [nil]. [T] is returned if and only if
  238. % [fl] is a list of atomic formulas and truth values.
  239. null fl or ((cl_atfp car fl or rl_tvalp car fl) and cl_ncflp cdr fl);
  240. procedure cl_dnfp(f);
  241. % Common logic disjunctive normal form predicate. [f] is a formula.
  242. % Returns [T] or [nil]. [T] is returned iff [f] is in disjunctive
  243. % normal form.
  244. (rl_tvalp f) or (cl_atfp f) or (rl_op f eq 'and and cl_ncflp rl_argn f)
  245. or ((rl_op f eq 'or) and cl_dnfp1 rl_argn f);
  246. procedure cl_dnfp1(fl);
  247. % Common logic disjunctive normal form predicate subroutine. [f] is
  248. % a formula. Returns [T] or [nil].
  249. (null fl) or ((rl_tvalp car fl) or (cl_atfp car fl) or
  250. ((rl_op car fl eq 'and) and (cl_ncflp rl_argn car fl))) and
  251. (cl_dnfp1 cdr fl);
  252. procedure cl_cnfp(f);
  253. % Common logic conjunctive normal form predicate. [f] is a formula.
  254. % Returns [T] or [nil]. [T] is returned iff [f] is in conjunctive
  255. % normal form.
  256. (rl_tvalp f) or (cl_atfp f) or (rl_op f eq 'or and cl_ncflp rl_argn f)
  257. or ((rl_op f eq 'and) and cl_cnfp1 rl_argn f);
  258. procedure cl_cnfp1(fl);
  259. % Common logic conjunctive normal form predicate subroutine . [f]
  260. % is a formula. Returns [T] or [nil]. [T] is returned iff [f] is in
  261. % conjunctive normal form.
  262. (null fl) or ((rl_tvalp car fl) or (cl_atfp car fl) or
  263. ((rl_op car fl eq 'or) and (cl_ncflp rl_argn car fl))) and
  264. (cl_cnfp1 cdr fl);
  265. procedure cl_bnfp(f);
  266. % Common logic boolean normal form predicate. [f] is a formula.
  267. % Returns [T] or [nil]. [T] is returned iff [f] is in disjunctive
  268. % or conjunctive normal form.
  269. (rl_tvalp f) or (cl_atfp f) or (cl_ncflp rl_argn f)
  270. or ((rl_op f eq 'and) and cl_cnfp1 rl_argn f) or
  271. ((rl_op f eq 'or) and cl_dnfp1 rl_argn f);
  272. endmodule; % [cl]
  273. end; % of file