{"id":15971465,"url":"https://github.com/danielholmes/logic","last_synced_at":"2025-09-09T12:35:22.712Z","repository":{"id":8141543,"uuid":"9560450","full_name":"danielholmes/logic","owner":"danielholmes","description":"Formalisation of logic","archived":false,"fork":false,"pushed_at":"2013-04-26T01:21:01.000Z","size":252,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-10T01:41:25.680Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danielholmes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-04-20T06:53:44.000Z","updated_at":"2013-10-26T03:23:03.000Z","dependencies_parsed_at":"2022-09-05T01:10:52.716Z","dependency_job_id":null,"html_url":"https://github.com/danielholmes/logic","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielholmes%2Flogic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielholmes%2Flogic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielholmes%2Flogic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielholmes%2Flogic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielholmes","download_url":"https://codeload.github.com/danielholmes/logic/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247208064,"owners_count":20901568,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-07T20:21:40.663Z","updated_at":"2025-04-04T15:44:47.223Z","avatar_url":"https://github.com/danielholmes.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Logic Formalisation\n===================\n\n[![Build Status](https://api.travis-ci.org/danielholmes/logic.png)](http://travis-ci.org/danielholmes/logic)\n\nA library that formalises logic. I'm building this while undertaking an [Introduction to Logic](https://www.coursera.org/course/intrologic), \nso the implementation and understanding is a work in progress.\n\nRunning Tests\n-------------\nWhile the virtual environment is active:\n``` python ./tests ```\n\nSimple Example\n--------------\n```python\nfrom logic.display import TruthTable\nfrom logic.parser import parse\n\nconjunction = parse(\"a^b\")\n\ntable = TruthTable.for_sentences([conjunction])\n\nprint(table.simple_string)\n```\nOutputs:\n```\n+---+---+---------+\n| a | b | (a ^ b) |\n+---+---+---------+\n| 1 | 1 |    1    |\n| 1 | 0 |    0    |\n| 0 | 1 |    0    |\n| 0 | 0 |    0    |\n+---+---+---------+\n```\n\nMore Complex Example\n--------------------\n```python\nfrom logic.display import TruthTable\nfrom logic.parser import parse\n\nconjunction = parse(\"a ^ b\")\ncomplex_expr = parse(\"d =\u003e (a ^ (b | c))\")\n\nlogically_entails = conjunction.logically_entails(complex_expr)\nlogically_equivalent = conjunction.is_logically_equivalent(complex_expr)\ntable = TruthTable.for_sentences([conjunction, complex_expr])\n\nprint(\"Conjunction logically entails complex: %s\" % logically_entails)\nprint(\"Conjunction is logically equivalent to complex: %s\" % logically_equivalent)\nprint(table.simple_string)\n```\nOutputs:\n```\nConjunction logically entails complex: True\nConjunction is logically equivalent to complex: False\n+---+---+---+---+---------+----------------------+\n| a | b | c | d | (a ^ b) | (d =\u003e (a ^ (b | c))) |\n+---+---+---+---+---------+----------------------+\n| 1 | 1 | 1 | 1 |    1    |          1           |\n| 1 | 1 | 1 | 0 |    1    |          1           |\n| 1 | 1 | 0 | 1 |    1    |          1           |\n| 1 | 1 | 0 | 0 |    1    |          1           |\n| 1 | 0 | 1 | 1 |    0    |          1           |\n| 1 | 0 | 1 | 0 |    0    |          1           |\n| 1 | 0 | 0 | 1 |    0    |          0           |\n| 1 | 0 | 0 | 0 |    0    |          1           |\n| 0 | 1 | 1 | 1 |    0    |          0           |\n| 0 | 1 | 1 | 0 |    0    |          1           |\n| 0 | 1 | 0 | 1 |    0    |          0           |\n| 0 | 1 | 0 | 0 |    0    |          1           |\n| 0 | 0 | 1 | 1 |    0    |          0           |\n| 0 | 0 | 1 | 0 |    0    |          1           |\n| 0 | 0 | 0 | 1 |    0    |          0           |\n| 0 | 0 | 0 | 0 |    0    |          1           |\n+---+---+---+---+---------+----------------------+\n```\n\nTodo\n----\n- Add properties of sentences: is_valid, is_contingent, is_unsatisfiable, is_satisfiable, is_falsifiable.\n- Linear proofs - Mendelson System\n    - brute force solver configurable for levels to search, etc\n    - solver runs 4 rules in a brute force way, using a certain limit, then provides shortest proofs\n    - Brute force solver is perhaps configurable by system\n- Fitch System - might be a bit tougher. Would need to load with some strategies. Need to take care with sub proofs\n- Structured proof solver (including Implication Introduction). Do structured proofs only have I.E. and I.I.?\n- Linear proof renderer. Displays text list of premises to conclusion and the applied rule on the right\n- An \"efficient\" renderer - showing parenthesis only where needed considering order of precedence\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielholmes%2Flogic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielholmes%2Flogic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielholmes%2Flogic/lists"}