ask_generated.py 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. """
  2. Do NOT manually edit this file.
  3. Instead, run ./bin/ask_update.py.
  4. """
  5. from sympy.assumptions.ask import Q
  6. from sympy.assumptions.cnf import Literal
  7. from sympy.core.cache import cacheit
  8. @cacheit
  9. def get_all_known_facts():
  10. """
  11. Known facts between unary predicates as CNF clauses.
  12. """
  13. return {
  14. frozenset((Literal(Q.algebraic, False), Literal(Q.imaginary, True), Literal(Q.transcendental, False))),
  15. frozenset((Literal(Q.algebraic, False), Literal(Q.negative, True), Literal(Q.transcendental, False))),
  16. frozenset((Literal(Q.algebraic, False), Literal(Q.positive, True), Literal(Q.transcendental, False))),
  17. frozenset((Literal(Q.algebraic, False), Literal(Q.rational, True))),
  18. frozenset((Literal(Q.algebraic, False), Literal(Q.transcendental, False), Literal(Q.zero, True))),
  19. frozenset((Literal(Q.algebraic, True), Literal(Q.finite, False))),
  20. frozenset((Literal(Q.algebraic, True), Literal(Q.transcendental, True))),
  21. frozenset((Literal(Q.antihermitian, False), Literal(Q.hermitian, False), Literal(Q.zero, True))),
  22. frozenset((Literal(Q.antihermitian, False), Literal(Q.imaginary, True))),
  23. frozenset((Literal(Q.commutative, False), Literal(Q.finite, True))),
  24. frozenset((Literal(Q.commutative, False), Literal(Q.infinite, True))),
  25. frozenset((Literal(Q.complex_elements, False), Literal(Q.real_elements, True))),
  26. frozenset((Literal(Q.composite, False), Literal(Q.even, True), Literal(Q.positive, True), Literal(Q.prime, False))),
  27. frozenset((Literal(Q.composite, True), Literal(Q.even, False), Literal(Q.odd, False))),
  28. frozenset((Literal(Q.composite, True), Literal(Q.positive, False))),
  29. frozenset((Literal(Q.composite, True), Literal(Q.prime, True))),
  30. frozenset((Literal(Q.diagonal, False), Literal(Q.lower_triangular, True), Literal(Q.upper_triangular, True))),
  31. frozenset((Literal(Q.diagonal, True), Literal(Q.lower_triangular, False))),
  32. frozenset((Literal(Q.diagonal, True), Literal(Q.normal, False))),
  33. frozenset((Literal(Q.diagonal, True), Literal(Q.symmetric, False))),
  34. frozenset((Literal(Q.diagonal, True), Literal(Q.upper_triangular, False))),
  35. frozenset((Literal(Q.even, False), Literal(Q.odd, False), Literal(Q.prime, True))),
  36. frozenset((Literal(Q.even, False), Literal(Q.zero, True))),
  37. frozenset((Literal(Q.even, True), Literal(Q.odd, True))),
  38. frozenset((Literal(Q.even, True), Literal(Q.rational, False))),
  39. frozenset((Literal(Q.finite, False), Literal(Q.transcendental, True))),
  40. frozenset((Literal(Q.finite, True), Literal(Q.infinite, True))),
  41. frozenset((Literal(Q.fullrank, False), Literal(Q.invertible, True))),
  42. frozenset((Literal(Q.fullrank, True), Literal(Q.invertible, False), Literal(Q.square, True))),
  43. frozenset((Literal(Q.hermitian, False), Literal(Q.negative, True))),
  44. frozenset((Literal(Q.hermitian, False), Literal(Q.positive, True))),
  45. frozenset((Literal(Q.hermitian, False), Literal(Q.zero, True))),
  46. frozenset((Literal(Q.imaginary, True), Literal(Q.negative, True))),
  47. frozenset((Literal(Q.imaginary, True), Literal(Q.positive, True))),
  48. frozenset((Literal(Q.imaginary, True), Literal(Q.zero, True))),
  49. frozenset((Literal(Q.infinite, False), Literal(Q.negative_infinite, True))),
  50. frozenset((Literal(Q.infinite, False), Literal(Q.positive_infinite, True))),
  51. frozenset((Literal(Q.integer_elements, True), Literal(Q.real_elements, False))),
  52. frozenset((Literal(Q.invertible, False), Literal(Q.positive_definite, True))),
  53. frozenset((Literal(Q.invertible, False), Literal(Q.singular, False))),
  54. frozenset((Literal(Q.invertible, False), Literal(Q.unitary, True))),
  55. frozenset((Literal(Q.invertible, True), Literal(Q.singular, True))),
  56. frozenset((Literal(Q.invertible, True), Literal(Q.square, False))),
  57. frozenset((Literal(Q.irrational, False), Literal(Q.negative, True), Literal(Q.rational, False))),
  58. frozenset((Literal(Q.irrational, False), Literal(Q.positive, True), Literal(Q.rational, False))),
  59. frozenset((Literal(Q.irrational, False), Literal(Q.rational, False), Literal(Q.zero, True))),
  60. frozenset((Literal(Q.irrational, True), Literal(Q.negative, False), Literal(Q.positive, False), Literal(Q.zero, False))),
  61. frozenset((Literal(Q.irrational, True), Literal(Q.rational, True))),
  62. frozenset((Literal(Q.lower_triangular, False), Literal(Q.triangular, True), Literal(Q.upper_triangular, False))),
  63. frozenset((Literal(Q.lower_triangular, True), Literal(Q.triangular, False))),
  64. frozenset((Literal(Q.negative, False), Literal(Q.positive, False), Literal(Q.rational, True), Literal(Q.zero, False))),
  65. frozenset((Literal(Q.negative, True), Literal(Q.negative_infinite, True))),
  66. frozenset((Literal(Q.negative, True), Literal(Q.positive, True))),
  67. frozenset((Literal(Q.negative, True), Literal(Q.positive_infinite, True))),
  68. frozenset((Literal(Q.negative, True), Literal(Q.zero, True))),
  69. frozenset((Literal(Q.negative_infinite, True), Literal(Q.positive, True))),
  70. frozenset((Literal(Q.negative_infinite, True), Literal(Q.positive_infinite, True))),
  71. frozenset((Literal(Q.negative_infinite, True), Literal(Q.zero, True))),
  72. frozenset((Literal(Q.normal, False), Literal(Q.unitary, True))),
  73. frozenset((Literal(Q.normal, True), Literal(Q.square, False))),
  74. frozenset((Literal(Q.odd, True), Literal(Q.rational, False))),
  75. frozenset((Literal(Q.orthogonal, False), Literal(Q.real_elements, True), Literal(Q.unitary, True))),
  76. frozenset((Literal(Q.orthogonal, True), Literal(Q.positive_definite, False))),
  77. frozenset((Literal(Q.orthogonal, True), Literal(Q.unitary, False))),
  78. frozenset((Literal(Q.positive, False), Literal(Q.prime, True))),
  79. frozenset((Literal(Q.positive, True), Literal(Q.positive_infinite, True))),
  80. frozenset((Literal(Q.positive, True), Literal(Q.zero, True))),
  81. frozenset((Literal(Q.positive_infinite, True), Literal(Q.zero, True))),
  82. frozenset((Literal(Q.square, False), Literal(Q.symmetric, True))),
  83. frozenset((Literal(Q.triangular, False), Literal(Q.unit_triangular, True))),
  84. frozenset((Literal(Q.triangular, False), Literal(Q.upper_triangular, True)))
  85. }
  86. @cacheit
  87. def get_known_facts_dict():
  88. """
  89. Logical relations between unary predicates as dictionary.
  90. Each key is a predicate, and item is two groups of predicates.
  91. First group contains the predicates which are implied by the key, and
  92. second group contains the predicates which are rejected by the key.
  93. """
  94. return {
  95. Q.algebraic: (set([Q.algebraic, Q.commutative, Q.complex, Q.finite]),
  96. set([Q.infinite, Q.negative_infinite, Q.positive_infinite,
  97. Q.transcendental])),
  98. Q.antihermitian: (set([Q.antihermitian]), set([])),
  99. Q.commutative: (set([Q.commutative]), set([])),
  100. Q.complex: (set([Q.commutative, Q.complex, Q.finite]),
  101. set([Q.infinite, Q.negative_infinite, Q.positive_infinite])),
  102. Q.complex_elements: (set([Q.complex_elements]), set([])),
  103. Q.composite: (set([Q.algebraic, Q.commutative, Q.complex, Q.composite,
  104. Q.extended_nonnegative, Q.extended_nonzero,
  105. Q.extended_positive, Q.extended_real, Q.finite, Q.hermitian,
  106. Q.integer, Q.nonnegative, Q.nonzero, Q.positive, Q.rational,
  107. Q.real]), set([Q.extended_negative, Q.extended_nonpositive,
  108. Q.imaginary, Q.infinite, Q.irrational, Q.negative,
  109. Q.negative_infinite, Q.nonpositive, Q.positive_infinite,
  110. Q.prime, Q.transcendental, Q.zero])),
  111. Q.diagonal: (set([Q.diagonal, Q.lower_triangular, Q.normal, Q.square,
  112. Q.symmetric, Q.triangular, Q.upper_triangular]), set([])),
  113. Q.even: (set([Q.algebraic, Q.commutative, Q.complex, Q.even,
  114. Q.extended_real, Q.finite, Q.hermitian, Q.integer, Q.rational,
  115. Q.real]), set([Q.imaginary, Q.infinite, Q.irrational,
  116. Q.negative_infinite, Q.odd, Q.positive_infinite,
  117. Q.transcendental])),
  118. Q.extended_negative: (set([Q.commutative, Q.extended_negative,
  119. Q.extended_nonpositive, Q.extended_nonzero, Q.extended_real]),
  120. set([Q.composite, Q.extended_nonnegative, Q.extended_positive,
  121. Q.imaginary, Q.nonnegative, Q.positive, Q.positive_infinite,
  122. Q.prime, Q.zero])),
  123. Q.extended_nonnegative: (set([Q.commutative, Q.extended_nonnegative,
  124. Q.extended_real]), set([Q.extended_negative, Q.imaginary,
  125. Q.negative, Q.negative_infinite])),
  126. Q.extended_nonpositive: (set([Q.commutative, Q.extended_nonpositive,
  127. Q.extended_real]), set([Q.composite, Q.extended_positive,
  128. Q.imaginary, Q.positive, Q.positive_infinite, Q.prime])),
  129. Q.extended_nonzero: (set([Q.commutative, Q.extended_nonzero,
  130. Q.extended_real]), set([Q.imaginary, Q.zero])),
  131. Q.extended_positive: (set([Q.commutative, Q.extended_nonnegative,
  132. Q.extended_nonzero, Q.extended_positive, Q.extended_real]),
  133. set([Q.extended_negative, Q.extended_nonpositive, Q.imaginary,
  134. Q.negative, Q.negative_infinite, Q.nonpositive, Q.zero])),
  135. Q.extended_real: (set([Q.commutative, Q.extended_real]),
  136. set([Q.imaginary])),
  137. Q.finite: (set([Q.commutative, Q.finite]), set([Q.infinite,
  138. Q.negative_infinite, Q.positive_infinite])),
  139. Q.fullrank: (set([Q.fullrank]), set([])),
  140. Q.hermitian: (set([Q.hermitian]), set([])),
  141. Q.imaginary: (set([Q.antihermitian, Q.commutative, Q.complex,
  142. Q.finite, Q.imaginary]), set([Q.composite, Q.even,
  143. Q.extended_negative, Q.extended_nonnegative,
  144. Q.extended_nonpositive, Q.extended_nonzero,
  145. Q.extended_positive, Q.extended_real, Q.infinite, Q.integer,
  146. Q.irrational, Q.negative, Q.negative_infinite, Q.nonnegative,
  147. Q.nonpositive, Q.nonzero, Q.odd, Q.positive,
  148. Q.positive_infinite, Q.prime, Q.rational, Q.real, Q.zero])),
  149. Q.infinite: (set([Q.commutative, Q.infinite]), set([Q.algebraic,
  150. Q.complex, Q.composite, Q.even, Q.finite, Q.imaginary,
  151. Q.integer, Q.irrational, Q.negative, Q.nonnegative,
  152. Q.nonpositive, Q.nonzero, Q.odd, Q.positive, Q.prime,
  153. Q.rational, Q.real, Q.transcendental, Q.zero])),
  154. Q.integer: (set([Q.algebraic, Q.commutative, Q.complex,
  155. Q.extended_real, Q.finite, Q.hermitian, Q.integer, Q.rational,
  156. Q.real]), set([Q.imaginary, Q.infinite, Q.irrational,
  157. Q.negative_infinite, Q.positive_infinite, Q.transcendental])),
  158. Q.integer_elements: (set([Q.complex_elements, Q.integer_elements,
  159. Q.real_elements]), set([])),
  160. Q.invertible: (set([Q.fullrank, Q.invertible, Q.square]),
  161. set([Q.singular])),
  162. Q.irrational: (set([Q.commutative, Q.complex, Q.extended_nonzero,
  163. Q.extended_real, Q.finite, Q.hermitian, Q.irrational,
  164. Q.nonzero, Q.real]), set([Q.composite, Q.even, Q.imaginary,
  165. Q.infinite, Q.integer, Q.negative_infinite, Q.odd,
  166. Q.positive_infinite, Q.prime, Q.rational, Q.zero])),
  167. Q.is_true: (set([Q.is_true]), set([])),
  168. Q.lower_triangular: (set([Q.lower_triangular, Q.triangular]), set([])),
  169. Q.negative: (set([Q.commutative, Q.complex, Q.extended_negative,
  170. Q.extended_nonpositive, Q.extended_nonzero, Q.extended_real,
  171. Q.finite, Q.hermitian, Q.negative, Q.nonpositive, Q.nonzero,
  172. Q.real]), set([Q.composite, Q.extended_nonnegative,
  173. Q.extended_positive, Q.imaginary, Q.infinite,
  174. Q.negative_infinite, Q.nonnegative, Q.positive,
  175. Q.positive_infinite, Q.prime, Q.zero])),
  176. Q.negative_infinite: (set([Q.commutative, Q.extended_negative,
  177. Q.extended_nonpositive, Q.extended_nonzero, Q.extended_real,
  178. Q.infinite, Q.negative_infinite]), set([Q.algebraic,
  179. Q.complex, Q.composite, Q.even, Q.extended_nonnegative,
  180. Q.extended_positive, Q.finite, Q.imaginary, Q.integer,
  181. Q.irrational, Q.negative, Q.nonnegative, Q.nonpositive,
  182. Q.nonzero, Q.odd, Q.positive, Q.positive_infinite, Q.prime,
  183. Q.rational, Q.real, Q.transcendental, Q.zero])),
  184. Q.nonnegative: (set([Q.commutative, Q.complex, Q.extended_nonnegative,
  185. Q.extended_real, Q.finite, Q.hermitian, Q.nonnegative,
  186. Q.real]), set([Q.extended_negative, Q.imaginary, Q.infinite,
  187. Q.negative, Q.negative_infinite, Q.positive_infinite])),
  188. Q.nonpositive: (set([Q.commutative, Q.complex, Q.extended_nonpositive,
  189. Q.extended_real, Q.finite, Q.hermitian, Q.nonpositive,
  190. Q.real]), set([Q.composite, Q.extended_positive, Q.imaginary,
  191. Q.infinite, Q.negative_infinite, Q.positive,
  192. Q.positive_infinite, Q.prime])),
  193. Q.nonzero: (set([Q.commutative, Q.complex, Q.extended_nonzero,
  194. Q.extended_real, Q.finite, Q.hermitian, Q.nonzero, Q.real]),
  195. set([Q.imaginary, Q.infinite, Q.negative_infinite,
  196. Q.positive_infinite, Q.zero])),
  197. Q.normal: (set([Q.normal, Q.square]), set([])),
  198. Q.odd: (set([Q.algebraic, Q.commutative, Q.complex,
  199. Q.extended_nonzero, Q.extended_real, Q.finite, Q.hermitian,
  200. Q.integer, Q.nonzero, Q.odd, Q.rational, Q.real]),
  201. set([Q.even, Q.imaginary, Q.infinite, Q.irrational,
  202. Q.negative_infinite, Q.positive_infinite, Q.transcendental,
  203. Q.zero])),
  204. Q.orthogonal: (set([Q.fullrank, Q.invertible, Q.normal, Q.orthogonal,
  205. Q.positive_definite, Q.square, Q.unitary]), set([Q.singular])),
  206. Q.positive: (set([Q.commutative, Q.complex, Q.extended_nonnegative,
  207. Q.extended_nonzero, Q.extended_positive, Q.extended_real,
  208. Q.finite, Q.hermitian, Q.nonnegative, Q.nonzero, Q.positive,
  209. Q.real]), set([Q.extended_negative, Q.extended_nonpositive,
  210. Q.imaginary, Q.infinite, Q.negative, Q.negative_infinite,
  211. Q.nonpositive, Q.positive_infinite, Q.zero])),
  212. Q.positive_definite: (set([Q.fullrank, Q.invertible,
  213. Q.positive_definite, Q.square]), set([Q.singular])),
  214. Q.positive_infinite: (set([Q.commutative, Q.extended_nonnegative,
  215. Q.extended_nonzero, Q.extended_positive, Q.extended_real,
  216. Q.infinite, Q.positive_infinite]), set([Q.algebraic,
  217. Q.complex, Q.composite, Q.even, Q.extended_negative,
  218. Q.extended_nonpositive, Q.finite, Q.imaginary, Q.integer,
  219. Q.irrational, Q.negative, Q.negative_infinite, Q.nonnegative,
  220. Q.nonpositive, Q.nonzero, Q.odd, Q.positive, Q.prime,
  221. Q.rational, Q.real, Q.transcendental, Q.zero])),
  222. Q.prime: (set([Q.algebraic, Q.commutative, Q.complex,
  223. Q.extended_nonnegative, Q.extended_nonzero,
  224. Q.extended_positive, Q.extended_real, Q.finite, Q.hermitian,
  225. Q.integer, Q.nonnegative, Q.nonzero, Q.positive, Q.prime,
  226. Q.rational, Q.real]), set([Q.composite, Q.extended_negative,
  227. Q.extended_nonpositive, Q.imaginary, Q.infinite, Q.irrational,
  228. Q.negative, Q.negative_infinite, Q.nonpositive,
  229. Q.positive_infinite, Q.transcendental, Q.zero])),
  230. Q.rational: (set([Q.algebraic, Q.commutative, Q.complex,
  231. Q.extended_real, Q.finite, Q.hermitian, Q.rational, Q.real]),
  232. set([Q.imaginary, Q.infinite, Q.irrational,
  233. Q.negative_infinite, Q.positive_infinite, Q.transcendental])),
  234. Q.real: (set([Q.commutative, Q.complex, Q.extended_real, Q.finite,
  235. Q.hermitian, Q.real]), set([Q.imaginary, Q.infinite,
  236. Q.negative_infinite, Q.positive_infinite])),
  237. Q.real_elements: (set([Q.complex_elements, Q.real_elements]), set([])),
  238. Q.singular: (set([Q.singular]), set([Q.invertible, Q.orthogonal,
  239. Q.positive_definite, Q.unitary])),
  240. Q.square: (set([Q.square]), set([])),
  241. Q.symmetric: (set([Q.square, Q.symmetric]), set([])),
  242. Q.transcendental: (set([Q.commutative, Q.complex, Q.finite,
  243. Q.transcendental]), set([Q.algebraic, Q.composite, Q.even,
  244. Q.infinite, Q.integer, Q.negative_infinite, Q.odd,
  245. Q.positive_infinite, Q.prime, Q.rational, Q.zero])),
  246. Q.triangular: (set([Q.triangular]), set([])),
  247. Q.unit_triangular: (set([Q.triangular, Q.unit_triangular]), set([])),
  248. Q.unitary: (set([Q.fullrank, Q.invertible, Q.normal, Q.square,
  249. Q.unitary]), set([Q.singular])),
  250. Q.upper_triangular: (set([Q.triangular, Q.upper_triangular]), set([])),
  251. Q.zero: (set([Q.algebraic, Q.commutative, Q.complex, Q.even,
  252. Q.extended_nonnegative, Q.extended_nonpositive,
  253. Q.extended_real, Q.finite, Q.hermitian, Q.integer,
  254. Q.nonnegative, Q.nonpositive, Q.rational, Q.real, Q.zero]),
  255. set([Q.composite, Q.extended_negative, Q.extended_nonzero,
  256. Q.extended_positive, Q.imaginary, Q.infinite, Q.irrational,
  257. Q.negative, Q.negative_infinite, Q.nonzero, Q.odd, Q.positive,
  258. Q.positive_infinite, Q.prime, Q.transcendental])),
  259. }