{"id":18447276,"url":"https://github.com/lamg/predicate","last_synced_at":"2025-04-15T02:57:52.811Z","repository":{"id":57481923,"uuid":"175136240","full_name":"lamg/predicate","owner":"lamg","description":"Parsing, evaluating and textually representing predicates","archived":false,"fork":false,"pushed_at":"2019-10-11T19:41:36.000Z","size":93,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-15T02:57:49.646Z","etag":null,"topics":["boolean-expression","evaluation","parsing","predicates"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lamg.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":"2019-03-12T04:36:43.000Z","updated_at":"2020-10-12T03:19:25.000Z","dependencies_parsed_at":"2022-09-02T06:04:21.401Z","dependency_job_id":null,"html_url":"https://github.com/lamg/predicate","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamg%2Fpredicate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamg%2Fpredicate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamg%2Fpredicate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamg%2Fpredicate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lamg","download_url":"https://codeload.github.com/lamg/predicate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248997095,"owners_count":21195797,"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":["boolean-expression","evaluation","parsing","predicates"],"created_at":"2024-11-06T07:12:35.714Z","updated_at":"2025-04-15T02:57:52.796Z","avatar_url":"https://github.com/lamg.png","language":"Go","readme":"# Predicate\n\n[![Build Status][1]][2] [![Coverage Status][3]][4] [![Go Report Card][5]][6]\n\nPredicate is a simple library for parsing, evaluating and textually representing predicates (boolean functions).\n\n## Install\n\n```sh\ngit clone git@github.com:lamg/predicate.git\ncd predicate/cmd/reduce \u0026\u0026 go install\n```\n\n## Example\n\nThe following table shows some examples of how `reduce` works. Using standard input and output makes easier typing the boolean operators, since you can use Vim's multibyte input method (ex: C-k OR writes ∨), and then pipe the selected text using the visual mode to the `reduce` command, or just store the predicates in a file and then use it as standard input to `reduce` (`reduce \u003c file_with_predicates`).\n\n| Standard input  | Standard output |\n|-----------------|-----------------|\n| true            | true            |\n| ¬false          | true            |\n| ¬true           | false           |\n| true ∧ false    | false           |\n| false ∧ false   | false           |\n| false ∨ false   | false           |\n| false ∨ true    | true            |\n| ¬(true ∧ true)  | false           |\n| ¬(true ∧ ¬A)    | ¬(¬A)           |\n| A ∧ A           | A               |\n| true ⇒ false    | false           |\n| A ≡ true        | A               |\n| A ≡ false       | ¬A              |\n| A ≡ A           | true            |\n| A ≡ ¬A          | false           |\n| A ≢ A           | false           |\n| A ⇐ true        | A               |\n| A ≢ false       | A               |\n\n## Syntax\n\nThe syntax is based on [EWD1300][0] which I have formalized in the following grammar:\n\n```ebnf\npredicate = term {('≡'|'≢') term}.\nterm = junction ({'⇒' junction} | {'⇐' junction}).\njunction = factor ({'∨' factor} | {'∧' factor}).\nfactor =\t[unaryOp] (identifier | '(' predicate ')').\nunaryOp = '¬'.\n```\n\n## Reduction rules\n\nThe procedure `Reduce` applies the following rules while reducing the predicate.\n\n```\n¬true ≡ false\n¬false ≡ true\nA ∨ false ≡ A\nA ∧ true ≡ A\nA ∨ true ≡ true\nA ∧ false ≡ false\nA ∨ B ≡ B ∨ A\nA ∧ B ≡ B ∧ A\nA ≡ true ≡ A\nA ≡ false ≡ ¬A\ntrue ⇒ A ≡ A\nfalse ⇒ A ≡ true\nA ⇒ true ≡ true\nA ⇒ false ≡ ¬A\nA ⇐ B ≡ B ⇒ A\nA ≢ B ≡ A ≡ ¬B\n```\n\n[0]: https://www.cs.utexas.edu/users/EWD/transcriptions/EWD13xx/EWD1300.html\n[1]: https://travis-ci.com/lamg/predicate.svg?branch=master\n[2]: https://travis-ci.com/lamg/predicate\n[3]: https://coveralls.io/repos/github/lamg/predicate/badge.svg?branch=master\n[4]: https://coveralls.io/github/lamg/predicate?branch=master\n[5]: https://goreportcard.com/badge/github.com/lamg/predicate\n[6]: https://goreportcard.com/report/github.com/lamg/predicate\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flamg%2Fpredicate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flamg%2Fpredicate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flamg%2Fpredicate/lists"}