Title: fiind_unit_clause function used by dpll_satisfiable in logic.py has a missing case · Issue #35 · ivan133/aima-python · GitHub
Open Graph Title: fiind_unit_clause function used by dpll_satisfiable in logic.py has a missing case · Issue #35 · ivan133/aima-python
X Title: fiind_unit_clause function used by dpll_satisfiable in logic.py has a missing case · Issue #35 · ivan133/aima-python
Description: To reproduce the problem try running the following script: import logic print logic.dpll_satisfiable(logic.expr("A & ~B & C & (A | ~D) & (~E | ~D) & (C | ~D) & (~A | ~F) & (E | ~F) & (~D | ~F) & (B | ~C | D) & (A | ~E | F) & (~A | E | D)...
Open Graph Description: To reproduce the problem try running the following script: import logic print logic.dpll_satisfiable(logic.expr("A & ~B & C & (A | ~D) & (~E | ~D) & (C | ~D) & (~A | ~F) & (E | ~F) & (~D | ~F) & (B...
X Description: To reproduce the problem try running the following script: import logic print logic.dpll_satisfiable(logic.expr("A & ~B & C & (A | ~D) & (~E | ~D) & (C | ~D) & (~A | ~F...
Opengraph URL: https://github.com/ivan133/aima-python/issues/35
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"fiind_unit_clause function used by dpll_satisfiable in logic.py has a missing case","articleBody":"```\n\nTo reproduce the problem try running the following script:\n\nimport logic\n\nprint logic.dpll_satisfiable(logic.expr(\"A & ~B & C & (A | ~D) & (~E | ~D) & (C \n| ~D) & (~A | ~F) & (E | ~F) & (~D | ~F) & (B | ~C | D) & (A | ~E | F) & (~A | \nE | D)\"))\n\nIt will produce \"False\" as an answer while there actually exists a model i.e. \nthe expected output should be:\n\n{B: False, C: True, A: True, F: False, D: True, E: False}\n\n\nThe problem occurs in v193 of logic.py from SVN that arrives with v201 of the \noverall package.\n\nThe problem is due to a missed case in find_unit_clause function in logic.py. \nWhen searching for new unit clauses after assigning True to A, False to B, True \nto C and False to F, the algorithm mistakenly assigns False to D due to clause \n(A | ~D). The problem is due to missing check on whether the clause is already \ntrue or not. A possible fixed version of the find_unit_clause function is below:\n\ndef find_unit_clause(clauses, model):\n \"\"\"A unit clause has only 1 variable that is not bound in the model.\n >>> find_unit_clause([A|B|C, B|~C, A|~B], {A:True})\n (B, False)\n \"\"\"\n for clause in clauses:\n num_not_in_model = 0\n clause_true=False\n for literal in disjuncts(clause):\n sym = literal_symbol(literal)\n if sym not in model:\n num_not_in_model += 1\n P, value = sym, (literal.op != '~')\n else:\n clause_true = clause_true | (model[sym] == (literal.op != '~' ))\n if ((num_not_in_model == 1) and not(clause_true)):\n return P, value\n return None, None\n\n```\n\nOriginal issue reported on code.google.com by `juhan.er...@gmail.com` on 10 Dec 2012 at 10:34\n","author":{"url":"https://github.com/GoogleCodeExporter","@type":"Person","name":"GoogleCodeExporter"},"datePublished":"2015-03-25T03:15:49Z","url":"https://github.com/ivan133/aima-python/issues/35"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:63abe7aa-bc40-e428-9c75-5f9bc060dfc5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CF62:A2006:A74DF4:E419D2:6AFE7DD7 |
| html-safe-nonce | 969a939abd04bd4fb6dcad64978df067df237c545233a2c0343f82feb3727a3e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRjYyOkEyMDA2OkE3NERGNDpFNDE5RDI6NkFGRTdERDciLCJ2aXNpdG9yX2lkIjoiMzc5ODYzMTg3MDUyMjg4MzU0MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 67e5ba8acd7cbd3e3b2772444b7d24f15cb4431568353c1f6a47d4a96fd6873a |
| hovercard-subject-tag | issue:64160906 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/ivan133/aima-python/35/issue_layout |
| twitter:image | https://opengraph.githubassets.com/75b3d406f00e3c0cd7d57f161cb8474fce1336f803f54b6ba785cb25f77cea88/ivan133/aima-python/issues/35 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/75b3d406f00e3c0cd7d57f161cb8474fce1336f803f54b6ba785cb25f77cea88/ivan133/aima-python/issues/35 |
| og:image:alt | To reproduce the problem try running the following script: import logic print logic.dpll_satisfiable(logic.expr("A & ~B & C & (A | ~D) & (~E | ~D) & (C | ~D) & (~A | ~F) & (E | ~F) & (~D | ~F) & (B... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | GoogleCodeExporter |
| hostname | github.com |
| expected-hostname | github.com |
| None | b3c0f155eafc27e60db6e254d1ffff0e072e9ab3b4018a5ee518797c19d89f86 |
| turbo-cache-control | no-preview |
| go-import | github.com/ivan133/aima-python git https://github.com/ivan133/aima-python.git |
| octolytics-dimension-user_id | 4018236 |
| octolytics-dimension-user_login | ivan133 |
| octolytics-dimension-repository_id | 32839887 |
| octolytics-dimension-repository_nwo | ivan133/aima-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 32839887 |
| octolytics-dimension-repository_network_root_nwo | ivan133/aima-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4a10310af51a1bfffbedc4fd81cb582acf0cb0ff |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width