acfsf.red 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. % ----------------------------------------------------------------------
  2. % $Id: acfsf.red,v 1.9 1999/04/12 09:25:48 sturm Exp $
  3. % ----------------------------------------------------------------------
  4. % Copyright (c) 1995-1999 Andreas Dolzmann and Thomas Sturm
  5. % ----------------------------------------------------------------------
  6. % $Log: acfsf.red,v $
  7. % Revision 1.9 1999/04/12 09:25:48 sturm
  8. % Removed procedure acfsf_canegrel and acfsf_anegrel.
  9. % Updated comments for exported procedures.
  10. %
  11. % Revision 1.8 1999/04/04 19:01:52 sturm
  12. % Added fluid declaration for !*gbverbose.
  13. %
  14. % Revision 1.7 1999/03/23 12:26:29 sturm
  15. % Renamed switch rlsisqf to rlsiatadv.
  16. %
  17. % Revision 1.6 1999/03/23 07:54:31 dolzmann
  18. % Changed copyright information.
  19. % Added list of exported procedures and import list.
  20. % Added fluids for the rcsid of the file and for the copyright information.
  21. %
  22. % Revision 1.5 1999/03/21 13:33:02 dolzmann
  23. % Registered acfsf_getineq as the black box implementation for rl_getineq.
  24. % Use cl_bnfsimpl instead of acfsf_bnfsimpl.
  25. % Removed black box rl_zero.
  26. % Added service rlthsimpl.
  27. % Registered service rlqeipo.
  28. % Registered service rlgentheo.
  29. %
  30. % Revision 1.4 1997/10/02 13:14:39 sturm
  31. % The CGB switches have been renamed from gcgb... to cgb...
  32. %
  33. % Revision 1.3 1997/10/01 11:13:42 dolzmann
  34. % Added service rlqe.
  35. %
  36. % Revision 1.2 1997/08/24 16:18:39 sturm
  37. % Added service rl_surep with black box rl_multsurep.
  38. % Added service rl_siaddatl.
  39. %
  40. % Revision 1.1 1997/08/22 17:30:37 sturm
  41. % Created an acfsf context based on ofsf.
  42. %
  43. % ----------------------------------------------------------------------
  44. lisp <<
  45. fluid '(acfsf_rcsid!* acfsf_copyright!*);
  46. acfsf_rcsid!* := "$Id: acfsf.red,v 1.9 1999/04/12 09:25:48 sturm Exp $";
  47. acfsf_copyright!* := "Copyright (c) 1995-1999 A. Dolzmann and T. Sturm"
  48. >>;
  49. module acfsf;
  50. % Algebraically closed field standard form. Main module. Algorithms on
  51. % first-order formulas over algebraically closed fields. The language
  52. % contains binary relations ['equal], ['neq].
  53. create!-package(
  54. '(acfsf acfsfsiat acfsfsism acfsfbnf acfsfgs acfsfmisc acfsfqe),nil);
  55. load!-package 'rltools;
  56. load!-package 'cl;
  57. load!-package 'cgb;
  58. exports acfsf_simpterm,acfsf_prepat,acfsf_resimpat,acfsf_lengthat,
  59. acfsf_chsimpat,acfsf_simpat,acfsf_op,acfsf_arg2l,acfsf_arg2r,acfsf_argn,
  60. acfsf_mk2,acfsf_0mk2,acfsf_mkn,acfsf_opp,acfsf_simplat1,acfsf_smrmknowl,
  61. acfsf_smcpknowl,acfsf_smupdknowl,acfsf_smmkatl,acfsf_dnf,acfsf_cnf,
  62. acfsf_subsumption,acfsf_sacatlp,acfsf_sacat,acfsf_gsc,acfsf_gsd,acfsf_gsn,
  63. acfsf_gssimplify,acfsf_gssimplify0,acfsf_termprint,acfsf_clnegrel,
  64. acfsf_lnegrel,acfsf_fctrat,acfsf_negateat,
  65. acfsf_varlat,acfsf_varsubstat,acfsf_ordatp,acfsf_a2cdl,acfsf_t2cdl,
  66. acfsf_subat,acfsf_subalchk,acfsf_eqnrhskernels,acfsf_getineq,acfsf_structat,
  67. acfsf_ifstructat,acfsf_termmlat,acfsf_decdeg,acfsf_decdeg1,acfsf_multsurep,
  68. acfsf_gqe,acfsf_qe,acfsf_thsimpl;
  69. imports rltools,cl,cgb;
  70. fluid '(!*rlsiatadv !*rlsiexpl !*rlsiexpla !*rlgssub !*rlsiso !*rlgsrad
  71. !*rlgsred !*rlgsprod !*rlgserf !*rlverbose !*rlsifac !*rlbnfsac !*rlgsvb
  72. !*rlgsbnf !*rlgsutord !*rlnzden !*rladdcond !*rlqegen !*cgbgen !*cgbreal
  73. !*gbverbose);
  74. flag('(acfsf),'rl_package);
  75. % Parameters
  76. put('acfsf,'rl_params,'(
  77. (rl_subat!* . acfsf_subat)
  78. (rl_subalchk!* . acfsf_subalchk)
  79. (rl_eqnrhskernels!* . acfsf_eqnrhskernels)
  80. (rl_ordatp!* . acfsf_ordatp)
  81. (rl_simplat1!* . acfsf_simplat1)
  82. (rl_smupdknowl!* . acfsf_smupdknowl)
  83. (rl_smrmknowl!* . acfsf_smrmknowl)
  84. (rl_smcpknowl!* . acfsf_smcpknowl)
  85. (rl_smmkatl!* . acfsf_smmkatl)
  86. (rl_smsimpl!-impl!* . cl_smsimpl!-impl)
  87. (rl_smsimpl!-equiv1!* . cl_smsimpl!-equiv1)
  88. (rl_negateat!* . acfsf_negateat)
  89. (rl_varlat!* . acfsf_varlat)
  90. (rl_varsubstat!* . acfsf_varsubstat)
  91. (rl_subsumption!* . acfsf_subsumption)
  92. (rl_bnfsimpl!* . cl_bnfsimpl)
  93. (rl_sacat!* . acfsf_sacat)
  94. (rl_sacatlp!* . acfsf_sacatlp)
  95. (rl_fctrat!* . acfsf_fctrat)
  96. (rl_tordp!* . ordp)
  97. (rl_a2cdl!* . acfsf_a2cdl)
  98. (rl_t2cdl!* . acfsf_t2cdl)
  99. (rl_getineq!* . acfsf_getineq)
  100. (rl_structat!* . acfsf_structat)
  101. (rl_ifstructat!* . acfsf_ifstructat)
  102. (rl_termmlat!* . acfsf_termmlat)
  103. (rl_multsurep!* . acfsf_multsurep)));
  104. % Services
  105. put('acfsf,'rl_services,'(
  106. (rl_subfof!* . cl_subfof)
  107. (rl_identifyonoff!* . cl_identifyonoff)
  108. (rl_simpl!* . cl_simpl)
  109. (rl_thsimpl!* . acfsf_thsimpl)
  110. (rl_nnf!* . cl_nnf)
  111. (rl_nnfnot!* . cl_nnfnot)
  112. (rl_pnf!* . cl_pnf)
  113. (rl_cnf!* . acfsf_cnf)
  114. (rl_dnf!* . acfsf_dnf)
  115. (rl_all!* . cl_all)
  116. (rl_ex!* . cl_ex)
  117. (rl_atnum!* . cl_atnum)
  118. (rl_tab!* . cl_tab)
  119. (rl_atab!* . cl_atab)
  120. (rl_itab!* . cl_itab)
  121. (rl_gsc!* . acfsf_gsc)
  122. (rl_gsd!* . acfsf_gsd)
  123. (rl_gsn!* . acfsf_gsn)
  124. (rl_ifacl!* . cl_ifacl)
  125. (rl_ifacml!* . cl_ifacml)
  126. (rl_matrix!* . cl_matrix)
  127. (rl_apnf!* . cl_apnf)
  128. (rl_atml!* . cl_atml)
  129. (rl_tnf!* . cl_tnf)
  130. (rl_atl!* . cl_atl)
  131. (rl_struct!* . cl_struct)
  132. (rl_ifstruct!* . cl_ifstruct)
  133. (rl_termml!* . cl_termml)
  134. (rl_terml!* . cl_terml)
  135. (rl_varl!* . cl_varl)
  136. (rl_fvarl!* . cl_fvarl)
  137. (rl_bvarl!* . cl_bvarl)
  138. (rl_gentheo!* . cl_gentheo)
  139. (rl_decdeg!* . acfsf_decdeg)
  140. (rl_decdeg1!* . acfsf_decdeg1)
  141. (rl_surep!* . cl_surep)
  142. (rl_qe!* . acfsf_qe)
  143. (rl_qeipo!* . cl_qeipo)
  144. (rl_siaddatl!* . cl_siaddatl)));
  145. % Admin
  146. put('acfsf,'simpfnname,'acfsf_simpfn);
  147. put('acfsf,'simpdefault,'acfsf_simprel);
  148. put('acfsf,'rl_prepat,'acfsf_prepat);
  149. put('acfsf,'rl_resimpat,'acfsf_resimpat);
  150. put('acfsf,'rl_lengthat,'acfsf_lengthat);
  151. put('acfsf,'rl_prepterm,'prepf);
  152. put('acfsf,'rl_simpterm,'acfsf_simpterm);
  153. algebraic infix equal;
  154. put('equal,'acfsf_simpfn,'acfsf_chsimpat);
  155. put('equal,'number!-of!-args,2);
  156. algebraic infix neq;
  157. put('neq,'acfsf_simpfn,'acfsf_chsimpat);
  158. put('neq,'number!-of!-args,2);
  159. put('neq,'rtypefn,'quotelog);
  160. newtok '((!< !>) neq);
  161. flag('(equal neq),'spaced);
  162. flag('(acfsf_chsimpat),'full);
  163. procedure acfsf_simpterm(u);
  164. % Algebraically closed field simp term. [u] is Lisp Prefix. Returns
  165. % the [u] as an ACFSF term.
  166. numr simp u;
  167. procedure acfsf_prepat(f);
  168. % Algebraically closed field prep atomic formula. [f] is an ACFSF
  169. % atomic formula. Returns [f] in Lisp prefix form.
  170. {acfsf_op f,prepf acfsf_arg2l f,prepf acfsf_arg2r f};
  171. procedure acfsf_resimpat(f);
  172. % Algebraically closed field resimp atomic formula. [f] is an ACFSF
  173. % atomic formula. Returns the atomic formula [f] with resimplified
  174. % terms.
  175. acfsf_mk2(acfsf_op f,
  176. numr resimp !*f2q acfsf_arg2l f,numr resimp !*f2q acfsf_arg2r f);
  177. procedure acfsf_lengthat(f);
  178. % Algebraically closed field length of atomic formula. [f] is an
  179. % atomic formula. Returns a number, the length of [f].
  180. 2;
  181. procedure acfsf_chsimpat(u);
  182. % Algebraically closed field chain simp atomic formula. [u] is the
  183. % Lisp prefix representation of a chain of atomic formulas, i.e.,
  184. % the operators are nested right associatively. Returns a formula,
  185. % which is the corresponding conjunction.
  186. rl_smkn('and,for each x in acfsf_chsimpat1 u collect acfsf_simpat x);
  187. procedure acfsf_chsimpat1(u);
  188. % Algebraically closed field chain simp atomic formula. [u] is the
  189. % Lisp prefix representation of a chain of atomic formulas, i.e.,
  190. % the operators are nested right associatively.
  191. begin scalar leftl,rightl,lhs,rhs;
  192. lhs := cadr u;
  193. if pairp lhs and acfsf_opp car lhs then <<
  194. leftl := acfsf_chsimpat1 lhs;
  195. lhs := caddr lastcar leftl
  196. >>;
  197. rhs := caddr u;
  198. if pairp rhs and acfsf_opp car rhs then <<
  199. rightl := acfsf_chsimpat1 rhs;
  200. rhs := cadr car rightl
  201. >>;
  202. return nconc(leftl,{car u,lhs,rhs} . rightl)
  203. end;
  204. procedure acfsf_simpat(u);
  205. % Algebraically closed field simp atomic formula. [u] is Lisp
  206. % prefix. Returns [u] as an atomic formula.
  207. begin scalar op,lhs,rhs,nlhs,f;
  208. op := car u;
  209. lhs := simp cadr u;
  210. if not (!*rlnzden or (domainp denr lhs)) then
  211. typerr(u,"atomic formula");
  212. rhs := simp caddr u;
  213. if not (!*rlnzden or (domainp denr rhs)) then
  214. typerr(u,"atomic formula");
  215. lhs := subtrsq(lhs,rhs);
  216. nlhs := numr lhs;
  217. if !*rlnzden and not domainp denr lhs then <<
  218. f := acfsf_0mk2(op,nlhs);
  219. if !*rladdcond then
  220. f := rl_mkn('and,{acfsf_0mk2('neq,denr lhs),f});
  221. return f
  222. >>;
  223. return acfsf_0mk2(op,nlhs)
  224. end;
  225. procedure acfsf_op(atf);
  226. % Algebraically closed field operator. [atf] is an atomic formula
  227. % $R(t_1,t_2)$. Returns $R$.
  228. car atf;
  229. procedure acfsf_arg2l(atf);
  230. % Algebraically closed field binary operator left hand side
  231. % argument. [atf] is an atomic formula $R(t_1,t_2)$. Returns $t_1$.
  232. cadr atf;
  233. procedure acfsf_arg2r(atf);
  234. % Algebraically closed field binary operator right hand side
  235. % argument. [atf] is an atomic formula $R(t_1,t_2)$. Returns $t_2$.
  236. caddr atf;
  237. procedure acfsf_argn(atf);
  238. % Algebraically closed field n-ary operator argument list. [atf] is
  239. % an atomic formula $R(t_1,t_2)$. Returns the list $(t_1,t_2)$.
  240. {cadr atf,caddr atf};
  241. procedure acfsf_mk2(op,lhs,rhs);
  242. % Algebraically closed field make atomic formula for binary
  243. % operator. [op] is a relation; [lhs] and [rhs] are terms. Returns
  244. % the atomic formula $[op]([lhs],[rhs])$.
  245. {op,lhs,rhs};
  246. procedure acfsf_0mk2(op,lhs);
  247. % Algebraically closed field make zero right hand side atomic
  248. % formula for binary operator. [op] is a relation [lhs] is a term.
  249. % Returns the atomic formula $[op]([lhs],0)$.
  250. {op,lhs,nil};
  251. procedure acfsf_mkn(op,argl);
  252. % Algebraically closed field make atomic formula for n-ary
  253. % operator. [op] is a relation; [argl] is a list $(t_1,t_2)$ of
  254. % terms. Returns the atomic formula $[op](t_1,t_2)$.
  255. {op,car argl,cadr argl};
  256. procedure acfsf_opp(op);
  257. % Algebraically closed field operator predicate. [op] is an
  258. % S-expression. Returns non-[nil] iff op is a relation.
  259. op memq '(equal neq);
  260. endmodule; % [acfsf]
  261. end; % of file