{"id":19797099,"url":"https://github.com/joom/wangsalgorithm","last_synced_at":"2025-05-01T03:31:30.558Z","repository":{"id":25252619,"uuid":"28677588","full_name":"joom/WangsAlgorithm","owner":"joom","description":"A classical propositional theorem prover in Haskell, using Wang's Algorithm.","archived":false,"fork":false,"pushed_at":"2019-06-12T18:29:19.000Z","size":18,"stargazers_count":35,"open_issues_count":2,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2023-08-13T04:02:26.276Z","etag":null,"topics":["haskell","sequent-calculus","theorem-prover","wang-algorithm"],"latest_commit_sha":null,"homepage":"","language":"Haskell","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/joom.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":"2015-01-01T00:02:48.000Z","updated_at":"2023-08-13T04:02:26.277Z","dependencies_parsed_at":"2022-08-24T00:20:42.163Z","dependency_job_id":null,"html_url":"https://github.com/joom/WangsAlgorithm","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joom%2FWangsAlgorithm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joom%2FWangsAlgorithm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joom%2FWangsAlgorithm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joom%2FWangsAlgorithm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joom","download_url":"https://codeload.github.com/joom/WangsAlgorithm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224233435,"owners_count":17277784,"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":["haskell","sequent-calculus","theorem-prover","wang-algorithm"],"created_at":"2024-11-12T07:23:45.651Z","updated_at":"2024-11-12T07:23:46.312Z","avatar_url":"https://github.com/joom.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"WangsAlgorithm [![Build Status](https://secure.travis-ci.org/joom/WangsAlgorithm.svg)](http://travis-ci.org/joom/WangsAlgorithm)\n==============\n\nA propositional theorem prover in Haskell, using [Wang's Algorithm](http://www.cs.bham.ac.uk/research/projects/poplog/doc/popteach/wang), based on the sequent calculus (LK). Reading [a Prolog implementation](https://github.com/benhuds/Prolog) helped me understand it better.\n\n## Usage\n\nIn order to use or compile the program you need to have [Stack](http://haskellstack.org) installed.\n\nAfter you cloning the repository, go to the repository folder and do\n\n```bash\nstack install\n```\n\nNow you installed the program. You can run it like this:\n\n```bash\nwang --sequent \"[(p-\u003eq)\u0026(p-\u003er)] |- [p-\u003e(q\u0026r)]\" --backend Text\n```\n\nOr shortly:\n\n```bash\nwang -s \"[(p-\u003eq)\u0026(p-\u003er)] |- [p-\u003e(q\u0026r)]\" -b Text\n```\n\nYou can also use `LaTeX` for an output.\n\nHere's an example text proof for that:\n\n```\nBefore: [((p) ⊃ (q)) ∧ ((p) ⊃ (r))] ⊢ [(p) ⊃ ((q) ∧ (r))]\nRule:   AndLeft\n-------------------\nBefore: [(p) ⊃ (q),(p) ⊃ (r)] ⊢ [(p) ⊃ ((q) ∧ (r))]\nRule:   ImpliesRight\n-------------------\nBefore: [(p) ⊃ (q),(p) ⊃ (r),p] ⊢ [(q) ∧ (r)]\nRule:   AndRight\n-------------------\nFirst branch:\n    Before: [(p) ⊃ (q),(p) ⊃ (r),p] ⊢ [q]\n    Rule:   ImpliesLeft\n    -------------------\n    First branch:\n        Before: [(p) ⊃ (r),p] ⊢ [p,q]\n        Rule:   WeakeningLeft\n        -------------------\n        Before: [p] ⊢ [p,q]\n        Rule:   WeakeningRight\n        -------------------\n        Before: [p] ⊢ [p]\n        Rule:   Id\n        -------------------\n        End.\n\n    -------------------\n    Second branch:\n        Before: [q,(p) ⊃ (r),p] ⊢ [q]\n        Rule:   WeakeningLeft\n        -------------------\n        Before: [q,p] ⊢ [q]\n        Rule:   WeakeningLeft\n        -------------------\n        Before: [q] ⊢ [q]\n        Rule:   Id\n        -------------------\n        End.\n\n    -------------------\n\n-------------------\nSecond branch:\n    Before: [(p) ⊃ (q),(p) ⊃ (r),p] ⊢ [r]\n    Rule:   ImpliesLeft\n    -------------------\n    First branch:\n        Before: [(p) ⊃ (r),p] ⊢ [p,r]\n        Rule:   WeakeningLeft\n        -------------------\n        Before: [p] ⊢ [p,r]\n        Rule:   WeakeningRight\n        -------------------\n        Before: [p] ⊢ [p]\n        Rule:   Id\n        -------------------\n        End.\n\n    -------------------\n    Second branch:\n        Before: [q,(p) ⊃ (r),p] ⊢ [r]\n        Rule:   ImpliesLeft\n        -------------------\n        First branch:\n            Before: [q,p] ⊢ [p,r]\n            Rule:   WeakeningLeft\n            -------------------\n            Before: [p] ⊢ [p,r]\n            Rule:   WeakeningRight\n            -------------------\n            Before: [p] ⊢ [p]\n            Rule:   Id\n            -------------------\n            End.\n\n        -------------------\n        Second branch:\n            Before: [r,q,p] ⊢ [r]\n            Rule:   WeakeningLeft\n            -------------------\n            Before: [r,p] ⊢ [r]\n            Rule:   WeakeningLeft\n            -------------------\n            Before: [r] ⊢ [r]\n            Rule:   Id\n            -------------------\n            End.\n\n        -------------------\n\n    -------------------\n\n-------------------\nProof completed.\n```\n\nHere's the LaTeX output for the same sequent.\n\n```\n\\begin{prooftree}\n    \\AxiomC{} \\RightLabel{\\scriptsize $I$}\n    \\UnaryInfC{$p\\vdash p$} \\RightLabel{\\scriptsize $WR$}\n    \\UnaryInfC{$p\\vdash p,q$} \\RightLabel{\\scriptsize $WL$}\n    \\UnaryInfC{$\\left( p\\supset r\\right) ,p\\vdash p,q$}\n    \\AxiomC{} \\RightLabel{\\scriptsize $I$}\n    \\UnaryInfC{$q\\vdash q$} \\RightLabel{\\scriptsize $WL$}\n    \\UnaryInfC{$q,p\\vdash q$} \\RightLabel{\\scriptsize $WL$}\n    \\UnaryInfC{$q,\\left( p\\supset r\\right) ,p\\vdash q$}\n    \\RightLabel{\\scriptsize $\\supset L$}\n    \\BinaryInfC{$\\left( p\\supset q\\right) ,\\left( p\\supset\n               r\\right) ,p\\vdash q$} \\AxiomC{}\n    \\RightLabel{\\scriptsize $I$} \\UnaryInfC{$p\\vdash p$}\n    \\RightLabel{\\scriptsize $WR$} \\UnaryInfC{$p\\vdash p,r$}\n    \\RightLabel{\\scriptsize $WL$}\n    \\UnaryInfC{$\\left( p\\supset r\\right) ,p\\vdash p,r$}\n    \\AxiomC{} \\RightLabel{\\scriptsize $I$}\n    \\UnaryInfC{$p\\vdash p$} \\RightLabel{\\scriptsize $WR$}\n    \\UnaryInfC{$p\\vdash p,r$} \\RightLabel{\\scriptsize $WL$}\n    \\UnaryInfC{$q,p\\vdash p,r$} \\AxiomC{}\n    \\RightLabel{\\scriptsize $I$} \\UnaryInfC{$r\\vdash r$}\n    \\RightLabel{\\scriptsize $WL$} \\UnaryInfC{$r,p\\vdash r$}\n    \\RightLabel{\\scriptsize $WL$}\n    \\UnaryInfC{$r,q,p\\vdash r$}\n    \\RightLabel{\\scriptsize $\\supset L$}\n    \\BinaryInfC{$q,\\left( p\\supset r\\right) ,p\\vdash r$}\n    \\RightLabel{\\scriptsize $\\supset L$}\n    \\BinaryInfC{$\\left( p\\supset q\\right) ,\\left( p\\supset\n               r\\right) ,p\\vdash r$}\n    \\RightLabel{\\scriptsize $\\wedge R$}\n    \\BinaryInfC{$\\left( p\\supset q\\right) ,\\left( p\\supset\n               r\\right) ,p\\vdash \\left( q\\wedge r\\right) $}\n    \\RightLabel{\\scriptsize $\\supset R$}\n    \\UnaryInfC{$\\left( p\\supset q\\right) ,\\left( p\\supset\n              r\\right) \\vdash \\left( p\\supset \\left( q\\wedge\n              r\\right) \\right) $}\n    \\RightLabel{\\scriptsize $\\wedge L$}\n    \\UnaryInfC{$\\left( \\left( p\\supset q\\right) \\wedge\n              \\left( p\\supset r\\right) \\right) \\vdash \\left(\n              p\\supset \\left( q\\wedge r\\right) \\right) $}\n\\end{prooftree}\n```\n\nIf you want to run the tests, use this command:\n\n```bash\nstack test\n```\n\n# Further Reading\n\n* Hao Wang, 1960, \"Toward Mechanical Mathematics\"\n* John McCarthy, 1961, \"LISP 1.5 Programmer's Manual\"\n\n## License\n\nThe MIT License (MIT)\n\nCopyright (c) 2014 Joomy Korkut\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoom%2Fwangsalgorithm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoom%2Fwangsalgorithm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoom%2Fwangsalgorithm/lists"}