{"id":13749221,"url":"https://github.com/ixjf/logic-rs","last_synced_at":"2025-05-09T12:30:54.843Z","repository":{"id":216842676,"uuid":"164328465","full_name":"ixjf/logic-rs","owner":"ixjf","description":"A parser of relational predicate logic \u0026 truth tree solver, written in Rust.","archived":false,"fork":false,"pushed_at":"2019-05-01T14:06:28.000Z","size":3418,"stargazers_count":15,"open_issues_count":16,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-05-22T21:35:11.760Z","etag":null,"topics":["consistency","contingency","contradiction","first","first-order","formal-validity","formulas","logic","order","parser","pest","predicate","relational","rust","tautology","truth-tree","validity","wasm"],"latest_commit_sha":null,"homepage":"https://ixjf.github.io/logic-rs/","language":"Rust","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/ixjf.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-01-06T17:12:18.000Z","updated_at":"2024-05-04T05:59:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"a76b8ac8-ec89-413c-ac98-82870b7a3fd4","html_url":"https://github.com/ixjf/logic-rs","commit_stats":null,"previous_names":["ixjf/logic-rs"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ixjf%2Flogic-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ixjf%2Flogic-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ixjf%2Flogic-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ixjf%2Flogic-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ixjf","download_url":"https://codeload.github.com/ixjf/logic-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224859694,"owners_count":17381676,"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":["consistency","contingency","contradiction","first","first-order","formal-validity","formulas","logic","order","parser","pest","predicate","relational","rust","tautology","truth-tree","validity","wasm"],"created_at":"2024-08-03T07:00:57.246Z","updated_at":"2024-11-15T23:32:20.482Z","avatar_url":"https://github.com/ixjf.png","language":"Rust","readme":"# logic-rs\n[![Build Status](https://travis-ci.org/ixjf/logic-rs.svg?branch=master)](https://travis-ci.org/ixjf/logic-rs)\n[![codecov](https://codecov.io/gh/ixjf/logic-rs/branch/master/graph/badge.svg)](https://codecov.io/gh/ixjf/logic-rs)\n\n**This is WIP but not currently being maintained. The issue tracker contains the roadmap with all known bugs/changes/features yet to be added.**\n\nA parser of relational predicate logic and truth tree solver.\n\nlogic-rs is heavily influenced by the book _Meaning and Argument:\nAn Introduction to Logic Through Language_, by Ernest Lepore and Sam Cumming, trying\nto follow as closely as possible its grammar and rules.\n\nIt uses separate syntax for statement sets, arguments, and sole statements, and so\ncan automatically generate and analyse truth trees accordingly.\n\nThe library powers its website, which you can find [here](https://ixjf.github.io/logic-rs/),\nserving only that purpose, but it is not tied to it at all, and can be used\ncompletely independently.\n\n**Note: logic-rs _currently_ doesn't support identity statements.**\n\n# Usage\nValidating some formula is as simple as:\n\n```rust\nmatch parse_input(\"(∀x)(B¹x ⊃ (L²xm ⊃ L²bx))\") {\n    Ok(input_kind) =\u003e {\n        // Input is a well-formed formula\n    },\n    Err(parse_err) =\u003e {\n        // Input is **not** a well-formed formula\n    }\n}\n```\n\nAnd proving that the input above is a sole statement and that that statement is a contingency\nis just as simple:\n```rust\nmatch parse_input(\"(∀x)(B¹x ⊃ (L²xm ⊃ L²bx))\") {\n    Ok(input_kind) =\u003e match input_kind {\n        InputKind::Statement(st) =\u003e {\n            let (\n                is_contingency,\n                truth_tree_statement,\n                truth_tree_negation_of_stmt\n                ) = st.is_contingency();\n            \n            assert_eq!(is_contingency, true);\n        },\n        _ =\u003e assert!(false)\n    },\n    Err(parse_err) =\u003e assert!(false)\n}\n```\n\nThe same process would be used to test whether the statement is a contradiction or a contingency, as well\nas to test the consistency of a statement set, or the formal validity of an argument. \n\n\n`truth_tree_statement` and `truth_tree_negation_of_stmt` are the resulting truth trees generated by the algorithm for some initial statement, and for the negation of that statement, respectively. If the truth tree\nfor the statement closed, it would be proved that the statement is a contradiction, since that would mean it's not possible\nfor it to be true in any case; if, on the other hand, the truth tree for the negation of the statement closed, it would be\nproved that the statement is a tautology, since the negation of a tautology is a contradiction.In this case, the initial statement is a contingency, so if we called the method `is_open` on each\ntruth tree, we would find that both were open. \n\n`truth_tree_statement` and `truth_tree_negation_of_stmt` are\n`TruthTree`s, ID-based trees containing the entire generated tree and additional information to identify\neach derivation.\n\n\nFor details on how to use, see the documentation at [docs.rs](https://docs.rs/logic_rs/0.1.0).\n\n# Language and Truth Tree Algorithm\nlogic_rs allows an infinite universe of discourse and does not place any other restrictions on the set\nof allowed input sets. This means that inputs that can lead to infinite trees _are_ allowed,\nand will make the algorithm get stuck in an infinite loop. Enforcing a finite universe of discourse\nwould solve the problem, but it would lead to the generation of unnecessarily massive truth trees. Ideally,\na solution to this problem would:\n1) not generate huge truth trees,\n2) maintain the correctness of the classification of the allowed input sets\n\nBut it might be that it would necessarily have to involve limiting the set of allowed input sets. Work is still\nbeing made about this.\n\nIt is guaranteed, however, _unless there is some bug_, that the algorithm will always correctly classify\n_all_ unsatisfiable set of statements. So, if the algorithm _does_ get into an infinite loop, then\nit is certain that the initial set of statements is satisfiable.\n\n# Branches\n\n**master** branch - source code for Rust crate logic-rs\n\n**www** branch - source code for website\n\n**gh-pages** branch - production code for website\n\n**wasm-layer** branch - wasm layer for integrating the Rust crate into the website\n","funding_links":[],"categories":["Books code"],"sub_categories":["Libraries"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fixjf%2Flogic-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fixjf%2Flogic-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fixjf%2Flogic-rs/lists"}