acfsfsiat.red 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. % ----------------------------------------------------------------------
  2. % $Id: acfsfsiat.red,v 1.4 1999/04/12 09:25:59 sturm Exp $
  3. % ----------------------------------------------------------------------
  4. % Copyright (c) 1995-1999 Andreas Dolzmann and Thomas Sturm
  5. % ----------------------------------------------------------------------
  6. % $Log: acfsfsiat.red,v $
  7. % Revision 1.4 1999/04/12 09:25:59 sturm
  8. % Updated comments for exported procedures.
  9. %
  10. % Revision 1.3 1999/03/23 12:26:29 sturm
  11. % Renamed switch rlsisqf to rlsiatadv.
  12. %
  13. % Revision 1.2 1999/03/23 07:59:43 dolzmann
  14. % Added missing CVS header.
  15. % Added fluids for the rcsid of the file and for the copyright information.
  16. % Added copyright information.
  17. %
  18. % Revision 1.1 1997/08/22 17:30:42 sturm
  19. % Created an acfsf context based on ofsf.
  20. %
  21. % ----------------------------------------------------------------------
  22. lisp <<
  23. fluid '(acfsf_siat_rcsid!* acfsf_siat_copyright!*);
  24. acfsf_siat_rcsid!* := "$Id: acfsfsiat.red,v 1.4 1999/04/12 09:25:59 sturm Exp $";
  25. acfsf_siat_copyright!* := "Copyright (c) 1995-1999 A. Dolzmann and T. Sturm"
  26. >>;
  27. module acfsfsiat;
  28. % Algebraically closed field standard form simplification for atomic
  29. % formulas. Submodule of [acfsf].
  30. procedure acfsf_simplat1(f,sop);
  31. % Algebraically closed field standard form simplify atomic formula.
  32. % [f] is an atomic formula; [sop] is the boolean operator [f]
  33. % occurs with or [nil]. Accesses switches [rlsiatadv], [rlsifac],
  34. % [rlsiexpl], and [rlsiexpla]. Returns a quantifier-free formula
  35. % that is a simplified equivalent of [f].
  36. begin scalar rel,lhs;
  37. rel := acfsf_op f;
  38. if not (rel memq '(equal neq)) then
  39. return nil;
  40. lhs := acfsf_arg2l f;
  41. if domainp lhs then
  42. return if acfsf_evalatp(rel,lhs) then 'true else 'false;
  43. lhs := quotf(lhs,sfto_dcontentf lhs);
  44. if minusf lhs then
  45. lhs := negf lhs;
  46. if null !*rlsiatadv then return acfsf_0mk2(rel,lhs);
  47. if rel eq 'equal then return acfsf_simplequal(lhs,sop);
  48. if rel eq 'neq then return acfsf_simplneq(lhs,sop)
  49. end;
  50. procedure acfsf_simplequal(lhs,sop);
  51. % Algebraically closed field standard form simplify [equal]-atomic
  52. % formula. [lhs] is a term. Returns a quantifier-free formula.
  53. begin scalar w,ff,ww;
  54. ff := sfto_sqfpartf lhs;
  55. if !*rlsifac and (!*rlsiexpla or !*rlsiexpl and sop = 'or) then
  56. return acfsf_facequal ff;
  57. return acfsf_0mk2('equal,ff)
  58. end;
  59. procedure acfsf_facequal(f);
  60. % Left hand side factorization [equal] case.
  61. rl_smkn('or,for each x in cdr fctrf f collect acfsf_0mk2('equal,car x));
  62. procedure acfsf_simplneq(lhs,sop);
  63. % Algebraically closed field standard form simplify [neq]-atomic
  64. % formula. [lhs] is a term. Returns a quantifier-free formula.
  65. begin scalar w,ff,ww;
  66. ff := sfto_sqfpartf lhs;
  67. if !*rlsifac and (!*rlsiexpla or !*rlsiexpl and sop = 'and) then
  68. return acfsf_facneq ff;
  69. return acfsf_0mk2('neq,ff)
  70. end;
  71. procedure acfsf_facneq(f);
  72. % Left hand side factorization [neq] case.
  73. rl_smkn('and,for each x in cdr fctrf f collect acfsf_0mk2('neq,car x));
  74. procedure acfsf_evalatp(rel,lhs);
  75. % Algebraically closed field standard form evaluate atomic formula.
  76. % [rel] is a relation; [lhs] is a domain element. Returns a truth
  77. % value equivalent to $[rel]([lhs],0)$.
  78. if rel eq 'equal then null lhs
  79. else if rel eq 'neq then not null lhs
  80. else rederr {"acfsf_evalatp: unknown operator ",rel};
  81. endmodule; % [acfsfsiat]
  82. end; % of file