acfsfbnf.red 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. % ----------------------------------------------------------------------
  2. % $Id: acfsfbnf.red,v 1.4 1999/04/12 09:25:58 sturm Exp $
  3. % ----------------------------------------------------------------------
  4. % Copyright (c) 1995-1999 Andreas Dolzmann and Thomas Sturm
  5. % ----------------------------------------------------------------------
  6. % $Log: acfsfbnf.red,v $
  7. % Revision 1.4 1999/04/12 09:25:58 sturm
  8. % Updated comments for exported procedures.
  9. %
  10. % Revision 1.3 1999/03/23 08:11:41 dolzmann
  11. % Changed copyright information.
  12. % Added fluids for the rcsid of the file and for the copyright information.
  13. %
  14. % Revision 1.2 1999/03/21 13:33:16 dolzmann
  15. % Removed procedure acfsf_bnfsimpl which was identical to cl_bnfsimpl.
  16. %
  17. % Revision 1.1 1997/08/22 17:30:38 sturm
  18. % Created an acfsf context based on ofsf.
  19. %
  20. % ----------------------------------------------------------------------
  21. lisp <<
  22. fluid '(acfsf_bnf_rcsid!* acfsf_bnf_copyright!*);
  23. acfsf_bnf_rcsid!* :=
  24. "$Id: acfsfbnf.red,v 1.4 1999/04/12 09:25:58 sturm Exp $";
  25. acfsf_bnf_copyright!* := "Copyright (c) 1995-1999 A. Dolzmann and T. Sturm"
  26. >>;
  27. module acfsfbnf;
  28. % Algebraically closed field standard form Boolean normal forms.
  29. % Submodule of [acfsf].
  30. procedure acfsf_dnf(f);
  31. % Algebraically closed field disjunctive normal form. [f] is a
  32. % formula. Returns a DNF of [f]. Depends on switch [rlbnfsac].
  33. if !*rlbnfsac then
  34. (cl_dnf f) where !*rlsiso=T
  35. else
  36. cl_dnf f;
  37. procedure acfsf_cnf(f);
  38. % Algebraically closed field conjunctive normal form. [f] is a
  39. % formula. Returns a CNF of [f]. Depends on switch [rlbnfsac].
  40. if !*rlbnfsac then
  41. (cl_cnf f) where !*rlsiso=T
  42. else
  43. cl_cnf f;
  44. procedure acfsf_subsumption(l1,l2,gor);
  45. % Algebraically closed subsumption. [l1] and [l2] are lists of
  46. % atomic formulas; [gor] is one of [and], [or]. Returns one of
  47. % [keep1], [keep2], [nil].
  48. if gor eq 'or then (
  49. if acfsf_subsumep!-and(l1,l2) then
  50. 'keep2
  51. else if acfsf_subsumep!-and(l2,l1) then
  52. 'keep1
  53. ) else % [gor eq 'and]
  54. if acfsf_subsumep!-or(l1,l2) then
  55. 'keep1
  56. else if acfsf_subsumep!-or(l2,l1) then
  57. 'keep2;
  58. procedure acfsf_subsumep!-and(l1,l2);
  59. % Algebraically closed field standard form subsume [and] case. [l1]
  60. % and [l2] are lists of atomic formulas.
  61. begin scalar a;
  62. while l2 do <<
  63. a := car l2;
  64. l2 := cdr l2;
  65. if cl_simpl(a,l1,-1) neq 'true then a := l2 := nil
  66. >>;
  67. return a
  68. end;
  69. procedure acfsf_subsumep!-or(l1,l2);
  70. % Algebraically closed field standard form subsume [or] case. [l1]
  71. % and [l2] are lists of atomic formulas.
  72. begin scalar a;
  73. while l1 do <<
  74. a := car l1;
  75. l1 := cdr l1;
  76. if cl_simpl(rl_smkn('or,l2),{a},-1) neq 'true then a := l1 := nil
  77. >>;
  78. return a
  79. end;
  80. procedure acfsf_sacatlp(a,l);
  81. % Algebraically closed field subsume and cut atomic formula list
  82. % predicate. [a] is an atomic formula; [l] is a list of atomic
  83. % formulas. Returns [T] iff a subsumption or a cut can be applied
  84. % between [a] and an element of [l].
  85. not ((acfsf_arg2l a neq acfsf_arg2l w) and ordp(acfsf_arg2l a,acfsf_arg2l w))
  86. where w=car l;
  87. procedure acfsf_sacat(a1,a2,gor);
  88. % Algebraically closed field subsume and cut atomic formula. [a1]
  89. % and [a2] are atomic formulas; [gor] is one of [and], [or].
  90. % Returns [nil], [keep], [keep1], [keep2], [drop], or an atomic
  91. % formula. If [nil] is returned, then neither a cut nor a
  92. % subsumption can be applied. If [keep] is returned, then the
  93. % atomic formulas are identical. In the case of [keep1] or [keep2],
  94. % the corresponding atomic formula must be kept, but the other one
  95. % can be dropped. If an atomic formula, is returned then this
  96. % atomic formula is the result of the cut beween [a1] and [a2]. If
  97. % ['drop] is returned, then a cut with result [true] or [false] can
  98. % be performed.
  99. begin scalar w;
  100. if acfsf_arg2l a1 neq acfsf_arg2l a2 then return nil;
  101. w := acfsf_sacrel(acfsf_op a1, acfsf_op a2,gor);
  102. if w memq '(drop keep keep1 keep2) then return w;
  103. return acfsf_0mk2(w,acfsf_arg2l a1)
  104. end;
  105. procedure acfsf_sacrel(r1,r2,gor);
  106. % Algebraically closed field standard form subsume and cut
  107. % relation. [r1] and [r2] are relations; [gor] is one of [or],
  108. % [and]. Returns ['keep], ['keep2], ['keep1], ['drop], or a
  109. % relation. [r1] and [r2] are considered as relations of atomic
  110. % formulas $[r1](t,0)$ and $[r2](t,0)$. If [keep] is returned then
  111. % the atomic formulas are identical, in the case of [keep1] or
  112. % [keep2] the respective atomic formula must be kept but the other
  113. % can be dropped, if a relation $\rho$ is returned a cut with
  114. % result $t\rho 0$ can be performed, where $t$ is the left hand
  115. % side of [a1] and [a2], if ['drop] is returned, a cut with result
  116. % ['true] or ['false] can be performed.
  117. if r1 eq r2 then 'keep else 'drop;
  118. endmodule; % [acfsfbnf]
  119. end; % of file