{"action":"created","comment":{"url":"https://api.github.com/repos/pysmt/pysmt/pulls/comments/42308762","id":42308762,"diff_hunk":"@@ -0,0 +1,84 @@\n+#\n+# This file is part of pySMT.\n+#\n+#   Copyright 2014 Andrea Micheli and Marco Gario\n+#\n+#   Licensed under the Apache License, Version 2.0 (the \"License\");\n+#   you may not use this file except in compliance with the License.\n+#   You may obtain a copy of the License at\n+#\n+#       http://www.apache.org/licenses/LICENSE-2.0\n+#\n+#   Unless required by applicable law or agreed to in writing, software\n+#   distributed under the License is distributed on an \"AS IS\" BASIS,\n+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+#   See the License for the specific language governing permissions and\n+#   limitations under the License.\n+#\n+import unittest\n+\n+\n+from pysmt.shortcuts import And, Symbol, Exists, FALSE, ForAll, Or, TRUE\n+from pysmt.shortcuts import qelim\n+from pysmt.test import TestCase\n+from pysmt.test.examples import get_example_formulae\n+import pysmt.logics\n+\n+class TestShannon(TestCase):\n+\n+    def setUp(self):\n+        self.x, self.y = Symbol(\"x\"), Symbol(\"y\")\n+\n+\n+    def test_exists(self):\n+        f = Exists([self.x], And(self.x, self.y))\n+        g = qelim(f, solver_name=\"shannon\")\n+        g = g.simplify()\n+        self.assertEqual(g, self.y)\n+\n+\n+    def test_forall(self):\n+        f = ForAll([self.x], And(self.x, self.y))\n+        g = qelim(f, solver_name=\"shannon\")\n+        g = g.simplify()\n+        self.assertEqual(g, FALSE())\n+\n+\n+    def test_multiple(self):\n+        f = ForAll([self.x, self.y], Or(self.x, self.y))\n+        g = qelim(f, solver_name=\"shannon\")\n+        g = g.simplify()\n+        self.assertEqual(g, FALSE())\n+\n+\n+    def test_nested(self):\n+        f = Exists([self.x], ForAll([self.y], Or(self.x, self.y)))\n+        g = qelim(f, solver_name=\"shannon\")\n+        g = g.simplify()\n+        self.assertEqual(g, TRUE())\n+\n+\n+    def test_examples_solving(self):\n+        for example in get_example_formulae():\n+            if example.logic != pysmt.logics.BOOL:\n+                continue\n+\n+            fv = example.expr.get_free_variables()\n+            f = Exists(fv, example.expr)\n+            g = qelim(f, solver_name=\"shannon\").simplify()\n+            if example.is_sat:\n+                self.assertTrue(g.is_true())\n+            else:\n+                self.assertTrue(g.is_false())\n+\n+            f = ForAll(fv, example.expr)\n+            g = qelim(f, solver_name=\"shannon\").simplify()\n+            if example.is_valid:\n+                self.assertTrue(g.is_true())\n+            else:\n+                self.assertTrue(g.is_false())\n+","path":"pysmt/test/test_shannon_expansion.py","position":80,"original_position":80,"commit_id":"4ab3b1b10f7e8177782552b3783d5745abbb3eae","original_commit_id":"4ab3b1b10f7e8177782552b3783d5745abbb3eae","user":{"login":"mikand","id":2255972,"avatar_url":"https://avatars.githubusercontent.com/u/2255972?v=3","gravatar_id":"","url":"https://api.github.com/users/mikand","html_url":"https://github.com/mikand","followers_url":"https://api.github.com/users/mikand/followers","following_url":"https://api.github.com/users/mikand/following{/other_user}","gists_url":"https://api.github.com/users/mikand/gists{/gist_id}","starred_url":"https://api.github.com/users/mikand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikand/subscriptions","organizations_url":"https://api.github.com/users/mikand/orgs","repos_url":"https://api.github.com/users/mikand/repos","events_url":"https://api.github.com/users/mikand/events{/privacy}","received_events_url":"https://api.github.com/users/mikand/received_events","type":"User","site_admin":false},"body":"We cannot solve the satisfiability problem if a single non-boolean variable is present in the formula...","created_at":"2015-10-17T12:23:25Z","updated_at":"2015-10-17T12:23:25Z","html_url":"https://github.com/pysmt/pysmt/pull/195#discussion_r42308762","pull_request_url":"https://api.github.com/repos/pysmt/pysmt/pulls/195","_links":{"self":{"href":"https://api.github.com/repos/pysmt/pysmt/pulls/comments/42308762"},"html":{"href":"https://github.com/pysmt/pysmt/pull/195#discussion_r42308762"},"pull_request":{"href":"https://api.github.com/repos/pysmt/pysmt/pulls/195"}}},"pull_request":{"url":"https://api.github.com/repos/pysmt/pysmt/pulls/195","id":47937611,"html_url":"https://github.com/pysmt/pysmt/pull/195","diff_url":"https://github.com/pysmt/pysmt/pull/195.diff","patch_url":"https://github.com/pysmt/pysmt/pull/195.patch","issue_url":"https://api.github.com/repos/pysmt/pysmt/issues/195","number":195,"state":"open","locked":false,"title":"Implemented Shannon-Expansion","user":{"login":"mikand","id":2255972,"avatar_url":"https://avatars.githubusercontent.com/u/2255972?v=3","gravatar_id":"","url":"https://api.github.com/users/mikand","html_url":"https://github.com/mikand","followers_url":"https://api.github.com/users/mikand/followers","following_url":"https://api.github.com/users/mikand/following{/other_user}","gists_url":"https://api.github.com/users/mikand/gists{/gist_id}","starred_url":"https://api.github.com/users/mikand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikand/subscriptions","organizations_url":"https://api.github.com/users/mikand/orgs","repos_url":"https://api.github.com/users/mikand/repos","events_url":"https://api.github.com/users/mikand/events{/privacy}","received_events_url":"https://api.github.com/users/mikand/received_events","type":"User","site_admin":false},"body":"Implemented the classical shannon expansion method as a quantifier eliminator for the BOOL logic. This addresses #183.","created_at":"2015-10-16T17:27:59Z","updated_at":"2015-10-17T12:23:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bae55b77276106259b10f748e9caefa5b0e43545","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/pysmt/pysmt/pulls/195/commits","review_comments_url":"https://api.github.com/repos/pysmt/pysmt/pulls/195/comments","review_comment_url":"https://api.github.com/repos/pysmt/pysmt/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pysmt/pysmt/issues/195/comments","statuses_url":"https://api.github.com/repos/pysmt/pysmt/statuses/4ab3b1b10f7e8177782552b3783d5745abbb3eae","head":{"label":"pysmt:shannon-expander","ref":"shannon-expander","sha":"4ab3b1b10f7e8177782552b3783d5745abbb3eae","user":{"login":"pysmt","id":10014498,"avatar_url":"https://avatars.githubusercontent.com/u/10014498?v=3","gravatar_id":"","url":"https://api.github.com/users/pysmt","html_url":"https://github.com/pysmt","followers_url":"https://api.github.com/users/pysmt/followers","following_url":"https://api.github.com/users/pysmt/following{/other_user}","gists_url":"https://api.github.com/users/pysmt/gists{/gist_id}","starred_url":"https://api.github.com/users/pysmt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pysmt/subscriptions","organizations_url":"https://api.github.com/users/pysmt/orgs","repos_url":"https://api.github.com/users/pysmt/repos","events_url":"https://api.github.com/users/pysmt/events{/privacy}","received_events_url":"https://api.github.com/users/pysmt/received_events","type":"Organization","site_admin":false},"repo":{"id":27359780,"name":"pysmt","full_name":"pysmt/pysmt","owner":{"login":"pysmt","id":10014498,"avatar_url":"https://avatars.githubusercontent.com/u/10014498?v=3","gravatar_id":"","url":"https://api.github.com/users/pysmt","html_url":"https://github.com/pysmt","followers_url":"https://api.github.com/users/pysmt/followers","following_url":"https://api.github.com/users/pysmt/following{/other_user}","gists_url":"https://api.github.com/users/pysmt/gists{/gist_id}","starred_url":"https://api.github.com/users/pysmt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pysmt/subscriptions","organizations_url":"https://api.github.com/users/pysmt/orgs","repos_url":"https://api.github.com/users/pysmt/repos","events_url":"https://api.github.com/users/pysmt/events{/privacy}","received_events_url":"https://api.github.com/users/pysmt/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pysmt/pysmt","description":"pySMT: A library for SMT formulae manipulation and solving","fork":false,"url":"https://api.github.com/repos/pysmt/pysmt","forks_url":"https://api.github.com/repos/pysmt/pysmt/forks","keys_url":"https://api.github.com/repos/pysmt/pysmt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pysmt/pysmt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pysmt/pysmt/teams","hooks_url":"https://api.github.com/repos/pysmt/pysmt/hooks","issue_events_url":"https://api.github.com/repos/pysmt/pysmt/issues/events{/number}","events_url":"https://api.github.com/repos/pysmt/pysmt/events","assignees_url":"https://api.github.com/repos/pysmt/pysmt/assignees{/user}","branches_url":"https://api.github.com/repos/pysmt/pysmt/branches{/branch}","tags_url":"https://api.github.com/repos/pysmt/pysmt/tags","blobs_url":"https://api.github.com/repos/pysmt/pysmt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pysmt/pysmt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pysmt/pysmt/git/refs{/sha}","trees_url":"https://api.github.com/repos/pysmt/pysmt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pysmt/pysmt/statuses/{sha}","languages_url":"https://api.github.com/repos/pysmt/pysmt/languages","stargazers_url":"https://api.github.com/repos/pysmt/pysmt/stargazers","contributors_url":"https://api.github.com/repos/pysmt/pysmt/contributors","subscribers_url":"https://api.github.com/repos/pysmt/pysmt/subscribers","subscription_url":"https://api.github.com/repos/pysmt/pysmt/subscription","commits_url":"https://api.github.com/repos/pysmt/pysmt/commits{/sha}","git_commits_url":"https://api.github.com/repos/pysmt/pysmt/git/commits{/sha}","comments_url":"https://api.github.com/repos/pysmt/pysmt/comments{/number}","issue_comment_url":"https://api.github.com/repos/pysmt/pysmt/issues/comments{/number}","contents_url":"https://api.github.com/repos/pysmt/pysmt/contents/{+path}","compare_url":"https://api.github.com/repos/pysmt/pysmt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pysmt/pysmt/merges","archive_url":"https://api.github.com/repos/pysmt/pysmt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pysmt/pysmt/downloads","issues_url":"https://api.github.com/repos/pysmt/pysmt/issues{/number}","pulls_url":"https://api.github.com/repos/pysmt/pysmt/pulls{/number}","milestones_url":"https://api.github.com/repos/pysmt/pysmt/milestones{/number}","notifications_url":"https://api.github.com/repos/pysmt/pysmt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pysmt/pysmt/labels{/name}","releases_url":"https://api.github.com/repos/pysmt/pysmt/releases{/id}","created_at":"2014-12-01T02:52:26Z","updated_at":"2015-10-16T18:42:26Z","pushed_at":"2015-10-17T10:23:00Z","git_url":"git://github.com/pysmt/pysmt.git","ssh_url":"git@github.com:pysmt/pysmt.git","clone_url":"https://github.com/pysmt/pysmt.git","svn_url":"https://github.com/pysmt/pysmt","homepage":"http://www.pysmt.org","size":3331,"stargazers_count":52,"watchers_count":52,"language":"SMT","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":25,"forks":11,"open_issues":25,"watchers":52,"default_branch":"master"}},"base":{"label":"pysmt:master","ref":"master","sha":"38f1469b255f638907ce1cae5fe45369f2bd5bd9","user":{"login":"pysmt","id":10014498,"avatar_url":"https://avatars.githubusercontent.com/u/10014498?v=3","gravatar_id":"","url":"https://api.github.com/users/pysmt","html_url":"https://github.com/pysmt","followers_url":"https://api.github.com/users/pysmt/followers","following_url":"https://api.github.com/users/pysmt/following{/other_user}","gists_url":"https://api.github.com/users/pysmt/gists{/gist_id}","starred_url":"https://api.github.com/users/pysmt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pysmt/subscriptions","organizations_url":"https://api.github.com/users/pysmt/orgs","repos_url":"https://api.github.com/users/pysmt/repos","events_url":"https://api.github.com/users/pysmt/events{/privacy}","received_events_url":"https://api.github.com/users/pysmt/received_events","type":"Organization","site_admin":false},"repo":{"id":27359780,"name":"pysmt","full_name":"pysmt/pysmt","owner":{"login":"pysmt","id":10014498,"avatar_url":"https://avatars.githubusercontent.com/u/10014498?v=3","gravatar_id":"","url":"https://api.github.com/users/pysmt","html_url":"https://github.com/pysmt","followers_url":"https://api.github.com/users/pysmt/followers","following_url":"https://api.github.com/users/pysmt/following{/other_user}","gists_url":"https://api.github.com/users/pysmt/gists{/gist_id}","starred_url":"https://api.github.com/users/pysmt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pysmt/subscriptions","organizations_url":"https://api.github.com/users/pysmt/orgs","repos_url":"https://api.github.com/users/pysmt/repos","events_url":"https://api.github.com/users/pysmt/events{/privacy}","received_events_url":"https://api.github.com/users/pysmt/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pysmt/pysmt","description":"pySMT: A library for SMT formulae manipulation and solving","fork":false,"url":"https://api.github.com/repos/pysmt/pysmt","forks_url":"https://api.github.com/repos/pysmt/pysmt/forks","keys_url":"https://api.github.com/repos/pysmt/pysmt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pysmt/pysmt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pysmt/pysmt/teams","hooks_url":"https://api.github.com/repos/pysmt/pysmt/hooks","issue_events_url":"https://api.github.com/repos/pysmt/pysmt/issues/events{/number}","events_url":"https://api.github.com/repos/pysmt/pysmt/events","assignees_url":"https://api.github.com/repos/pysmt/pysmt/assignees{/user}","branches_url":"https://api.github.com/repos/pysmt/pysmt/branches{/branch}","tags_url":"https://api.github.com/repos/pysmt/pysmt/tags","blobs_url":"https://api.github.com/repos/pysmt/pysmt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pysmt/pysmt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pysmt/pysmt/git/refs{/sha}","trees_url":"https://api.github.com/repos/pysmt/pysmt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pysmt/pysmt/statuses/{sha}","languages_url":"https://api.github.com/repos/pysmt/pysmt/languages","stargazers_url":"https://api.github.com/repos/pysmt/pysmt/stargazers","contributors_url":"https://api.github.com/repos/pysmt/pysmt/contributors","subscribers_url":"https://api.github.com/repos/pysmt/pysmt/subscribers","subscription_url":"https://api.github.com/repos/pysmt/pysmt/subscription","commits_url":"https://api.github.com/repos/pysmt/pysmt/commits{/sha}","git_commits_url":"https://api.github.com/repos/pysmt/pysmt/git/commits{/sha}","comments_url":"https://api.github.com/repos/pysmt/pysmt/comments{/number}","issue_comment_url":"https://api.github.com/repos/pysmt/pysmt/issues/comments{/number}","contents_url":"https://api.github.com/repos/pysmt/pysmt/contents/{+path}","compare_url":"https://api.github.com/repos/pysmt/pysmt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pysmt/pysmt/merges","archive_url":"https://api.github.com/repos/pysmt/pysmt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pysmt/pysmt/downloads","issues_url":"https://api.github.com/repos/pysmt/pysmt/issues{/number}","pulls_url":"https://api.github.com/repos/pysmt/pysmt/pulls{/number}","milestones_url":"https://api.github.com/repos/pysmt/pysmt/milestones{/number}","notifications_url":"https://api.github.com/repos/pysmt/pysmt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pysmt/pysmt/labels{/name}","releases_url":"https://api.github.com/repos/pysmt/pysmt/releases{/id}","created_at":"2014-12-01T02:52:26Z","updated_at":"2015-10-16T18:42:26Z","pushed_at":"2015-10-17T10:23:00Z","git_url":"git://github.com/pysmt/pysmt.git","ssh_url":"git@github.com:pysmt/pysmt.git","clone_url":"https://github.com/pysmt/pysmt.git","svn_url":"https://github.com/pysmt/pysmt","homepage":"http://www.pysmt.org","size":3331,"stargazers_count":52,"watchers_count":52,"language":"SMT","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":25,"forks":11,"open_issues":25,"watchers":52,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pysmt/pysmt/pulls/195"},"html":{"href":"https://github.com/pysmt/pysmt/pull/195"},"issue":{"href":"https://api.github.com/repos/pysmt/pysmt/issues/195"},"comments":{"href":"https://api.github.com/repos/pysmt/pysmt/issues/195/comments"},"review_comments":{"href":"https://api.github.com/repos/pysmt/pysmt/pulls/195/comments"},"review_comment":{"href":"https://api.github.com/repos/pysmt/pysmt/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pysmt/pysmt/pulls/195/commits"},"statuses":{"href":"https://api.github.com/repos/pysmt/pysmt/statuses/4ab3b1b10f7e8177782552b3783d5745abbb3eae"}}}}