{"action":"created","comment":{"url":"https://api.github.com/repos/sympy/sympy/pulls/comments/33419509","id":33419509,"diff_hunk":"@@ -9,66 +9,1114 @@\n from sympy.assumptions.assume import (global_assumptions, Predicate,\n         AppliedPredicate)\n from sympy.core.decorators import deprecated\n-from sympy.utilities.decorator import classproperty, ClassPropertyDescriptor\n-\n-\n-class Q(object):\n-    \"\"\"Supported ask keys.\"\"\"\n-    antihermitian = Predicate('antihermitian')\n-    finite = Predicate('finite')\n-    commutative = Predicate('commutative')\n-    complex = Predicate('complex')\n-    composite = Predicate('composite')\n-    even = Predicate('even')\n-    extended_real = Predicate('extended_real')\n-    hermitian = Predicate('hermitian')\n-    imaginary = Predicate('imaginary')\n-    infinitesimal = Predicate('infinitesimal')\n-    infinite = Predicate('infinite')\n-    integer = Predicate('integer')\n-    irrational = Predicate('irrational')\n-    rational = Predicate('rational')\n-    algebraic = Predicate('algebraic')\n-    transcendental = Predicate('transcendental')\n-    negative = Predicate('negative')\n-    nonzero = Predicate('nonzero')\n-    positive = Predicate('positive')\n-    prime = Predicate('prime')\n-    real = Predicate('real')\n-    odd = Predicate('odd')\n-    is_true = Predicate('is_true')\n-    nonpositive = Predicate('nonpositive')\n-    nonnegative = Predicate('nonnegative')\n-    zero = Predicate('zero')\n-\n-    symmetric = Predicate('symmetric')\n-    invertible = Predicate('invertible')\n-    singular = Predicate('singular')\n-    orthogonal = Predicate('orthogonal')\n-    unitary = Predicate('unitary')\n-    normal = Predicate('normal')\n-    positive_definite = Predicate('positive_definite')\n-    upper_triangular = Predicate('upper_triangular')\n-    lower_triangular = Predicate('lower_triangular')\n-    diagonal = Predicate('diagonal')\n-    triangular = Predicate('triangular')\n-    unit_triangular = Predicate('unit_triangular')\n-    fullrank = Predicate('fullrank')\n-    square = Predicate('square')\n-    real_elements = Predicate('real_elements')\n-    complex_elements = Predicate('complex_elements')\n-    integer_elements = Predicate('integer_elements')\n-\n-    @classproperty\n+from sympy.utilities.decorator import memoize_property\n+\n+\n+# Deprecated predicates should be added to this list\n+deprecated_predicates = [\n+    'bounded',\n+    'infinity'\n+]\n+\n+# Memoization storage for predicates\n+predicate_storage = {}\n+\n+\n+class QClass(object):\n+    \"\"\"\n+    This class contains all the supported keys by ``ask``.\n+    \"\"\"\n+\n+    @memoize_property(predicate_storage)\n+    def hermitian(self):\n+        \"\"\"\n+        Hermitian predicate.\n+\n+        ``ask(Q.hermitian(x))`` is true iff ``x`` belongs to the field of\n+        hermitian operators.\n+\n+        TODO: Add examples\n+\n+        \"\"\"\n+        return Predicate('hermitian')\n+\n+    @memoize_property(predicate_storage)\n+    def antihermitian(self):\n+        \"\"\"\n+        Antihermitian predicate.\n+\n+        ``Q.antihermitian(x)`` is true iff ``x`` belongs to the field of\n+        antihermitian operators, i.e., operators in the form ``x*I``, where\n+        ``x`` is Hermitian.\n+\n+        TODO: Add examples\n+\n+        \"\"\"\n+        return Predicate('antihermitian')\n+\n+    @memoize_property(predicate_storage)\n+    def real(self):\n+        r\"\"\"\n+        Real number predicate.\n+\n+        ``Q.real(x)`` is true iff ``x`` is a real number, i.e., it is in the\n+        interval :math:`(-\\infty, \\infty)`.  Note that, in particular the infinities\n+        are not real. Use ``Q.extended_real`` if you want to consider those as well.\n+\n+        A few important facts about reals:\n+\n+        - Every real number is positive, negative, or zero.  Furthermore, because\n+          these sets are pairwise disjoint, each real number is exactly one of\n+          those three.\n+\n+        - Every real number is also complex.\n+\n+        - Every real number is either rational or irrational.\n+\n+        - Every real number is either algebraic or transcendental.\n+\n+        - The facts ``Q.negative``, ``Q.zero``, ``Q.positive``, ``Q.nonnegative``,\n+          ``Q.nonpositive``, ``Q.nonzero``, ``Q.integer``, ``Q.rational``, and\n+          ``Q.irrational`` all imply ``Q.real``, as do all facts that imply those\n+          facts.\n+\n+        - The facts ``Q.algebraic``, and ``Q.transcendental`` do not imply\n+          ``Q.real``; they imply ``Q.complex``. An algebraic or transcendental\n+          number may or may not be real.\n+\n+        - The \"non\" facts (i.e., ``Q.nonnegative``, ``Q.nonzero``, and\n+          ``Q.nonpositive``) are not equivalent to not the fact, but rather, not\n+          the fact *and* ``Q.real``.  For example, ``Q.nonnegative`` means\n+          ``~Q.negative & Q.real``. So for example, ``I`` is not nonnegative,\n+          nonzero, or nonpositive.\n+\n+        Examples\n+        ========\n+\n+        >>> from sympy import Q, ask, symbols\n+        >>> x = symbols('x')\n+        >>> ask(Q.real(x), Q.positive(x))\n+        True\n+        >>> ask(Q.real(0))\n+        True\n+\n+        References\n+        ==========\n+\n+        .. [1] https://en.wikipedia.org/wiki/Real_number\n+\n+        \"\"\"\n+        return Predicate('real')\n+\n+    @memoize_property(predicate_storage)\n+    def extended_real(self):\n+        r\"\"\"\n+        Extended real predicate.\n+\n+        ``Q.extended_real(x)`` is true iff ``x`` is a real number including\n+        :math:`{-\\infty, \\infty}`.\n+\n+        See documentation of ``Q.real`` for more information about related facts.\n+\n+        Examples\n+        ========\n+\n+        >>> from sympy import ask, Q, oo, I\n+        >>> ask(Q.extended_real(1))\n+        True\n+        >>> ask(Q.extended_real(I))\n+        False\n+        >>> ask(Q.extended_real(oo))\n+        True\n+\n+        \"\"\"\n+        return Predicate('extended_real')\n+\n+    @memoize_property(predicate_storage)\n+    def imaginary(self):\n+        \"\"\"\n+        Imaginary number predicate.\n+\n+        ``Q.imaginary(x)`` is true iff ``x`` can be written as a real\n+        number multiplied by the imaginary unit ``I``. Please note that ``0``\n+        is not considered to be an imaginary number.\n+\n+        Examples\n+        ========\n+\n+        >>> from sympy import Q, ask, I\n+        >>> ask(Q.imaginary(3*I))\n+        True\n+        >>> ask(Q.imaginary(2 + 3*I))\n+        False\n+        >>> ask(Q.imaginary(0))\n+        False\n+\n+        References\n+        ==========\n+\n+        .. [1] https://en.wikipedia.org/wiki/Imaginary_number\n+\n+        \"\"\"\n+        return Predicate('imaginary')\n+\n+    @memoize_property(predicate_storage)\n+    def complex(self):\n+        \"\"\"\n+        Complex number predicate.\n+\n+        ``Q.complex(x)`` is true iff ``x`` belongs to the set of complex\n+        numbers.","path":"sympy/assumptions/ask.py","position":212,"original_position":212,"commit_id":"e8554a5c9f245b456cee76d09f517ab739cd48c1","original_commit_id":"e8554a5c9f245b456cee76d09f517ab739cd48c1","user":{"login":"asmeurer","id":71486,"avatar_url":"https://avatars.githubusercontent.com/u/71486?v=3","gravatar_id":"","url":"https://api.github.com/users/asmeurer","html_url":"https://github.com/asmeurer","followers_url":"https://api.github.com/users/asmeurer/followers","following_url":"https://api.github.com/users/asmeurer/following{/other_user}","gists_url":"https://api.github.com/users/asmeurer/gists{/gist_id}","starred_url":"https://api.github.com/users/asmeurer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asmeurer/subscriptions","organizations_url":"https://api.github.com/users/asmeurer/orgs","repos_url":"https://api.github.com/users/asmeurer/repos","events_url":"https://api.github.com/users/asmeurer/events{/privacy}","received_events_url":"https://api.github.com/users/asmeurer/received_events","type":"User","site_admin":false},"body":"I guess I didn't add it. You should note in both that it is specifically finite numbers. ","created_at":"2015-06-28T07:01:32Z","updated_at":"2015-06-28T07:01:32Z","html_url":"https://github.com/sympy/sympy/pull/9475#discussion_r33419509","pull_request_url":"https://api.github.com/repos/sympy/sympy/pulls/9475","_links":{"self":{"href":"https://api.github.com/repos/sympy/sympy/pulls/comments/33419509"},"html":{"href":"https://github.com/sympy/sympy/pull/9475#discussion_r33419509"},"pull_request":{"href":"https://api.github.com/repos/sympy/sympy/pulls/9475"}}},"pull_request":{"url":"https://api.github.com/repos/sympy/sympy/pulls/9475","id":37021509,"html_url":"https://github.com/sympy/sympy/pull/9475","diff_url":"https://github.com/sympy/sympy/pull/9475.diff","patch_url":"https://github.com/sympy/sympy/pull/9475.patch","issue_url":"https://api.github.com/repos/sympy/sympy/issues/9475","number":9475,"state":"open","locked":false,"title":"Documenting new assumptions","user":{"login":"debugger22","id":2821646,"avatar_url":"https://avatars.githubusercontent.com/u/2821646?v=3","gravatar_id":"","url":"https://api.github.com/users/debugger22","html_url":"https://github.com/debugger22","followers_url":"https://api.github.com/users/debugger22/followers","following_url":"https://api.github.com/users/debugger22/following{/other_user}","gists_url":"https://api.github.com/users/debugger22/gists{/gist_id}","starred_url":"https://api.github.com/users/debugger22/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/debugger22/subscriptions","organizations_url":"https://api.github.com/users/debugger22/orgs","repos_url":"https://api.github.com/users/debugger22/repos","events_url":"https://api.github.com/users/debugger22/events{/privacy}","received_events_url":"https://api.github.com/users/debugger22/received_events","type":"User","site_admin":false},"body":"I've changed the way predicates are documented here https://github.com/sympy/sympy/pull/2538. Changing the predicates to `@classproperty` has broken a lot of things, I'm looking into that.\r\n\r\nMost of the documentations are taken from https://github.com/sympy/sympy/pull/2538 and `core/assumptions.py`.","created_at":"2015-06-05T11:07:52Z","updated_at":"2015-06-28T07:01:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f44d4ba6b389214f8acd01a900fedfdfb3fc01fb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sympy/sympy/pulls/9475/commits","review_comments_url":"https://api.github.com/repos/sympy/sympy/pulls/9475/comments","review_comment_url":"https://api.github.com/repos/sympy/sympy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sympy/sympy/issues/9475/comments","statuses_url":"https://api.github.com/repos/sympy/sympy/statuses/e8554a5c9f245b456cee76d09f517ab739cd48c1","head":{"label":"debugger22:doc-new-assump","ref":"doc-new-assump","sha":"e8554a5c9f245b456cee76d09f517ab739cd48c1","user":{"login":"debugger22","id":2821646,"avatar_url":"https://avatars.githubusercontent.com/u/2821646?v=3","gravatar_id":"","url":"https://api.github.com/users/debugger22","html_url":"https://github.com/debugger22","followers_url":"https://api.github.com/users/debugger22/followers","following_url":"https://api.github.com/users/debugger22/following{/other_user}","gists_url":"https://api.github.com/users/debugger22/gists{/gist_id}","starred_url":"https://api.github.com/users/debugger22/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/debugger22/subscriptions","organizations_url":"https://api.github.com/users/debugger22/orgs","repos_url":"https://api.github.com/users/debugger22/repos","events_url":"https://api.github.com/users/debugger22/events{/privacy}","received_events_url":"https://api.github.com/users/debugger22/received_events","type":"User","site_admin":false},"repo":{"id":17359802,"name":"sympy","full_name":"debugger22/sympy","owner":{"login":"debugger22","id":2821646,"avatar_url":"https://avatars.githubusercontent.com/u/2821646?v=3","gravatar_id":"","url":"https://api.github.com/users/debugger22","html_url":"https://github.com/debugger22","followers_url":"https://api.github.com/users/debugger22/followers","following_url":"https://api.github.com/users/debugger22/following{/other_user}","gists_url":"https://api.github.com/users/debugger22/gists{/gist_id}","starred_url":"https://api.github.com/users/debugger22/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/debugger22/subscriptions","organizations_url":"https://api.github.com/users/debugger22/orgs","repos_url":"https://api.github.com/users/debugger22/repos","events_url":"https://api.github.com/users/debugger22/events{/privacy}","received_events_url":"https://api.github.com/users/debugger22/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/debugger22/sympy","description":"A computer algebra system written in pure Python","fork":true,"url":"https://api.github.com/repos/debugger22/sympy","forks_url":"https://api.github.com/repos/debugger22/sympy/forks","keys_url":"https://api.github.com/repos/debugger22/sympy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/debugger22/sympy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/debugger22/sympy/teams","hooks_url":"https://api.github.com/repos/debugger22/sympy/hooks","issue_events_url":"https://api.github.com/repos/debugger22/sympy/issues/events{/number}","events_url":"https://api.github.com/repos/debugger22/sympy/events","assignees_url":"https://api.github.com/repos/debugger22/sympy/assignees{/user}","branches_url":"https://api.github.com/repos/debugger22/sympy/branches{/branch}","tags_url":"https://api.github.com/repos/debugger22/sympy/tags","blobs_url":"https://api.github.com/repos/debugger22/sympy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/debugger22/sympy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/debugger22/sympy/git/refs{/sha}","trees_url":"https://api.github.com/repos/debugger22/sympy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/debugger22/sympy/statuses/{sha}","languages_url":"https://api.github.com/repos/debugger22/sympy/languages","stargazers_url":"https://api.github.com/repos/debugger22/sympy/stargazers","contributors_url":"https://api.github.com/repos/debugger22/sympy/contributors","subscribers_url":"https://api.github.com/repos/debugger22/sympy/subscribers","subscription_url":"https://api.github.com/repos/debugger22/sympy/subscription","commits_url":"https://api.github.com/repos/debugger22/sympy/commits{/sha}","git_commits_url":"https://api.github.com/repos/debugger22/sympy/git/commits{/sha}","comments_url":"https://api.github.com/repos/debugger22/sympy/comments{/number}","issue_comment_url":"https://api.github.com/repos/debugger22/sympy/issues/comments{/number}","contents_url":"https://api.github.com/repos/debugger22/sympy/contents/{+path}","compare_url":"https://api.github.com/repos/debugger22/sympy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/debugger22/sympy/merges","archive_url":"https://api.github.com/repos/debugger22/sympy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/debugger22/sympy/downloads","issues_url":"https://api.github.com/repos/debugger22/sympy/issues{/number}","pulls_url":"https://api.github.com/repos/debugger22/sympy/pulls{/number}","milestones_url":"https://api.github.com/repos/debugger22/sympy/milestones{/number}","notifications_url":"https://api.github.com/repos/debugger22/sympy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/debugger22/sympy/labels{/name}","releases_url":"https://api.github.com/repos/debugger22/sympy/releases{/id}","created_at":"2014-03-03T08:33:45Z","updated_at":"2015-04-23T02:12:12Z","pushed_at":"2015-06-23T16:23:04Z","git_url":"git://github.com/debugger22/sympy.git","ssh_url":"git@github.com:debugger22/sympy.git","clone_url":"https://github.com/debugger22/sympy.git","svn_url":"https://github.com/debugger22/sympy","homepage":"http://sympy.org/","size":72075,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"sympy:master","ref":"master","sha":"6f3ef90a6951af7ca7b2742e5f5ea735d06bea43","user":{"login":"sympy","id":260832,"avatar_url":"https://avatars.githubusercontent.com/u/260832?v=3","gravatar_id":"","url":"https://api.github.com/users/sympy","html_url":"https://github.com/sympy","followers_url":"https://api.github.com/users/sympy/followers","following_url":"https://api.github.com/users/sympy/following{/other_user}","gists_url":"https://api.github.com/users/sympy/gists{/gist_id}","starred_url":"https://api.github.com/users/sympy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sympy/subscriptions","organizations_url":"https://api.github.com/users/sympy/orgs","repos_url":"https://api.github.com/users/sympy/repos","events_url":"https://api.github.com/users/sympy/events{/privacy}","received_events_url":"https://api.github.com/users/sympy/received_events","type":"Organization","site_admin":false},"repo":{"id":640534,"name":"sympy","full_name":"sympy/sympy","owner":{"login":"sympy","id":260832,"avatar_url":"https://avatars.githubusercontent.com/u/260832?v=3","gravatar_id":"","url":"https://api.github.com/users/sympy","html_url":"https://github.com/sympy","followers_url":"https://api.github.com/users/sympy/followers","following_url":"https://api.github.com/users/sympy/following{/other_user}","gists_url":"https://api.github.com/users/sympy/gists{/gist_id}","starred_url":"https://api.github.com/users/sympy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sympy/subscriptions","organizations_url":"https://api.github.com/users/sympy/orgs","repos_url":"https://api.github.com/users/sympy/repos","events_url":"https://api.github.com/users/sympy/events{/privacy}","received_events_url":"https://api.github.com/users/sympy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sympy/sympy","description":"A computer algebra system written in pure Python","fork":false,"url":"https://api.github.com/repos/sympy/sympy","forks_url":"https://api.github.com/repos/sympy/sympy/forks","keys_url":"https://api.github.com/repos/sympy/sympy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sympy/sympy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sympy/sympy/teams","hooks_url":"https://api.github.com/repos/sympy/sympy/hooks","issue_events_url":"https://api.github.com/repos/sympy/sympy/issues/events{/number}","events_url":"https://api.github.com/repos/sympy/sympy/events","assignees_url":"https://api.github.com/repos/sympy/sympy/assignees{/user}","branches_url":"https://api.github.com/repos/sympy/sympy/branches{/branch}","tags_url":"https://api.github.com/repos/sympy/sympy/tags","blobs_url":"https://api.github.com/repos/sympy/sympy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sympy/sympy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sympy/sympy/git/refs{/sha}","trees_url":"https://api.github.com/repos/sympy/sympy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sympy/sympy/statuses/{sha}","languages_url":"https://api.github.com/repos/sympy/sympy/languages","stargazers_url":"https://api.github.com/repos/sympy/sympy/stargazers","contributors_url":"https://api.github.com/repos/sympy/sympy/contributors","subscribers_url":"https://api.github.com/repos/sympy/sympy/subscribers","subscription_url":"https://api.github.com/repos/sympy/sympy/subscription","commits_url":"https://api.github.com/repos/sympy/sympy/commits{/sha}","git_commits_url":"https://api.github.com/repos/sympy/sympy/git/commits{/sha}","comments_url":"https://api.github.com/repos/sympy/sympy/comments{/number}","issue_comment_url":"https://api.github.com/repos/sympy/sympy/issues/comments{/number}","contents_url":"https://api.github.com/repos/sympy/sympy/contents/{+path}","compare_url":"https://api.github.com/repos/sympy/sympy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sympy/sympy/merges","archive_url":"https://api.github.com/repos/sympy/sympy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sympy/sympy/downloads","issues_url":"https://api.github.com/repos/sympy/sympy/issues{/number}","pulls_url":"https://api.github.com/repos/sympy/sympy/pulls{/number}","milestones_url":"https://api.github.com/repos/sympy/sympy/milestones{/number}","notifications_url":"https://api.github.com/repos/sympy/sympy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sympy/sympy/labels{/name}","releases_url":"https://api.github.com/repos/sympy/sympy/releases{/id}","created_at":"2010-04-30T20:37:14Z","updated_at":"2015-06-27T14:47:30Z","pushed_at":"2015-06-28T06:25:48Z","git_url":"git://github.com/sympy/sympy.git","ssh_url":"git@github.com:sympy/sympy.git","clone_url":"https://github.com/sympy/sympy.git","svn_url":"https://github.com/sympy/sympy","homepage":"http://sympy.org/","size":149528,"stargazers_count":2196,"watchers_count":2196,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1086,"mirror_url":null,"open_issues_count":1929,"forks":1086,"open_issues":1929,"watchers":2196,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sympy/sympy/pulls/9475"},"html":{"href":"https://github.com/sympy/sympy/pull/9475"},"issue":{"href":"https://api.github.com/repos/sympy/sympy/issues/9475"},"comments":{"href":"https://api.github.com/repos/sympy/sympy/issues/9475/comments"},"review_comments":{"href":"https://api.github.com/repos/sympy/sympy/pulls/9475/comments"},"review_comment":{"href":"https://api.github.com/repos/sympy/sympy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sympy/sympy/pulls/9475/commits"},"statuses":{"href":"https://api.github.com/repos/sympy/sympy/statuses/e8554a5c9f245b456cee76d09f517ab739cd48c1"}}}}