{"id":34052124,"url":"https://github.com/logic-and-learning-lab/popper","last_synced_at":"2026-04-08T12:02:53.524Z","repository":{"id":39281736,"uuid":"354963683","full_name":"logic-and-learning-lab/Popper","owner":"logic-and-learning-lab","description":"An inductive logic programming system","archived":false,"fork":false,"pushed_at":"2026-04-03T16:20:36.000Z","size":22683,"stargazers_count":278,"open_issues_count":7,"forks_count":52,"subscribers_count":19,"default_branch":"main","last_synced_at":"2026-04-03T18:29:56.084Z","etag":null,"topics":["inductive-logic-programming","program-synthesis","symbolic-learning"],"latest_commit_sha":null,"homepage":"","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/logic-and-learning-lab.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,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-04-05T20:28:13.000Z","updated_at":"2026-04-03T16:27:31.000Z","dependencies_parsed_at":"2023-01-29T02:31:43.013Z","dependency_job_id":"8fcea498-3b4a-4e3a-a535-f46af5fa409d","html_url":"https://github.com/logic-and-learning-lab/Popper","commit_stats":{"total_commits":314,"total_committers":10,"mean_commits":31.4,"dds":"0.15923566878980888","last_synced_commit":"323fdfbe5b1cc959207f021f83020588adb19d94"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/logic-and-learning-lab/Popper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logic-and-learning-lab%2FPopper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logic-and-learning-lab%2FPopper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logic-and-learning-lab%2FPopper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logic-and-learning-lab%2FPopper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/logic-and-learning-lab","download_url":"https://codeload.github.com/logic-and-learning-lab/Popper/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logic-and-learning-lab%2FPopper/sbom","scorecard":{"id":597206,"data":{"date":"2025-08-11","repo":{"name":"github.com/logic-and-learning-lab/Popper","commit":"6454c9b97d30c8b08333fcc9b32273dca5250c2b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 1/29 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":10,"reason":"7 commit(s) and 7 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-20T23:26:14.064Z","repository_id":39281736,"created_at":"2025-08-20T23:26:14.064Z","updated_at":"2025-08-20T23:26:14.064Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31554110,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T10:21:54.569Z","status":"ssl_error","status_checked_at":"2026-04-08T10:21:38.171Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["inductive-logic-programming","program-synthesis","symbolic-learning"],"created_at":"2025-12-14T01:57:01.524Z","updated_at":"2026-04-08T12:02:53.450Z","avatar_url":"https://github.com/logic-and-learning-lab.png","language":"Python","readme":"# Popper\n\nPopper is an [inductive logic programming](https://arxiv.org/pdf/2008.07912.pdf) system. Popper combines logical reasoning with machine learning to induce rules from examples and background knowledge.\n\nIf you use Popper, please cite the paper [Learning programs by learning from failures](https://arxiv.org/abs/2005.02259) (MLJ 2021).\n\nIf you have any questions, ask us on [Discord](https://discord.gg/Rv5mQCayAp) or email [Andrew Cropper](mailto:andrew.cropper@helsinki.fi).\n\n#### Requirements\n- [SWI-Prolog](https://www.swi-prolog.org) (9.2.0 or above)\n- [Clingo](https://potassco.org/clingo/) (5.6.2 or above)\n- [Janus-swi](https://github.com/SWI-Prolog/packages-swipy)\n- [pysat](https://pysathq.github.io)\n- [bitarray](https://github.com/ilanschnell/bitarray)\n\n#### Installation\nInstall Popper with the command ```pip install git+https://github.com/logic-and-learning-lab/Popper@main```\n\n#### Command line usage\nRun Popper with the command `python popper.py \u003cinput dir\u003e`. For instance, `python popper.py examples/zendo1` produces:\n```prolog\n********** SOLUTION **********\nPrecision:1.00 Recall:1.00 TP:20 FN:0 TN:20 FP:0 Size:6\nzendo(V0):- small(V2),piece(V0,V1),red(V1),contact(V1,V3),size(V3,V2).\n******************************\n```\n\n#### Example problem\nPopper requires three input files:\n- an examples file\n- a background knowledge (BK) file\n- a bias file\n\nAn examples file contains positive and negative examples of the relation you want to learn:\n\n```prolog\npos(grandparent(ann,amelia)).\npos(grandparent(steve,amelia)).\npos(grandparent(ann,spongebob)).\nneg(grandparent(amy,amelia)).\n```\n\nA BK file contains other information about the problem:\n\n```prolog\nmother(ann,amy).\nmother(ann,andy).\nmother(amy,amelia).\nmother(linda,gavin).\nfather(steve,amy).\nfather(steve,andy).\nfather(gavin,amelia).\nfather(andy,spongebob).\n```\n\nA bias file defines the search space of Popper. Predicate declarations tell Popper which predicate symbols it can use in the head (`head_pred`) or body (`body_pred`) of a rule, such as:\n\n```prolog\nhead_pred(grandparent,2).\nbody_pred(mother,2).\nbody_pred(father,2).\n```\n\nThese declarations say that Popper can use the symbol *grandparent* with two arguments in the head of a rule and *mother* or *father* in the body, also each with two arguments.\n\n#### Noisy examples\nPopper can learn from [noisy](https://arxiv.org/pdf/2308.09393.pdf) data with the `--noisy` flag. Popper learns the minimal description length program.\n\n#### Recursion\nPopper can learn recursive programs where a predicate symbol appears in both the head and body of a rule, such as to find a duplicate element (`python popper.py examples/find-dupl`) in a list:\n```prolog\nf(A,B):- tail(A,C),head(A,B),element(C,B).\nf(A,B):- tail(A,C),f(C,B).\n```\nTo enable recursion, add `enable_recursion.` to the bias file. However, recursion is expensive, so it is best to avoid it if possible.\n\n#### Types\nPopper supports type annotations in the bias file. A type annotation is of the form `type(p,(t1,t2,...,tk)` for a predicate symbol `p` with arity `k`, such as:\n\n```prolog\ntype(head,(list,element)).\ntype(tail,(list,list)).\ntype(length,(list,int,)).\ntype(empty,(list,)).\ntype(prepend,(element,list,list)).\n```\nTypes are **optional** but can substantially reduce learning times.\n\n#### Directions\nProlog often requires arguments to be ground. For instance, when asking Prolog to answer the query:\n```prolog\nX is 3+K.\n```\nIt throws an error:\n```prolog\nERROR: Arguments are not sufficiently instantiated\n```\nTo avoid these issues, Popper supports **optional** direction annotations. A direction annotation is of the form `direction(p,(d1,d2,...,dk)` for a predicate symbol `p` with arity `k`, where each `di` is either `in` or `out`.\nAn `in` variable must be ground when calling the relation. By contrast, an `out` variable need not be ground. Here are example directions:\n\n```prolog\ndirection(head,(in,out)).\ndirection(tail,(in,out)).\ndirection(length,(in,out)).\ndirection(prepend,(in,in,out)).\ndirection(geq,(in,in)).\n```\n\nPopper cannot learn with partial directions. If you provide them, you must provide them for all relations.\n\n#### Bias\nPopper has two important bias settings:\n\n- `max_vars(N)` sets the maximum number of variables in a rule to `N` (default: 6)\n- `max_body(N)` sets the maximum number of body literals in a rule to `N` (default: 6)\n\nThese settings greatly influence performance. If the values are too high, Popper might struggle to find a solution. If the settings are too low, the search space might be too small to contain a good solution. \n\n#### Predicate invention\n\nPopper supports [automatic predicate invention](https://arxiv.org/pdf/2104.14426.pdf) (PI). With PI enabled, Popper (`python popper.py examples/kinship-pi`) learns the program:\n\n```prolog\ngrandparent(A,B):-inv1(C,B),inv1(A,C).\ninv1(A,B):-mother(A,B).\ninv1(A,B):-father(A,B).\n% Precision:1.00, Recall:1.00, TP:5, FN:0, TN:1, FP:0\n```\nTo enable PI, add the setting `enable_pi.` to the bias file. However, predicate invention is currently *very* expensive so it is best to avoid it if possible.\n\n#### Popper settings\n - `--noisy` (default: false) learn from [noisy](https://arxiv.org/pdf/2308.09393.pdf) (misclassified examples)\n - `--stats` (default: false) shows runtime statistics\n - `--debug` (default: false) runs in debug mode\n - `--quiet` (default: False)  runs in quiet mode\n - `--timeout` (default: 1200 seconds) sets a maximum learning time\n - `--eval-timeout` (default: 0.001 seconds) sets a maximum example testing time. This flag only applies when learning recursive programs.\n - `--solver {rc2,uwr,wmaxcdcl}`(default: `rc2`) which exact solver to use\n - `--anytime-solver {wmaxcdcl,nuwls}`(default: `None`) which anytime solver to use\n - `--anytime-timeout` (default: 10 seconds) sets the maximum time allowed by the anytime solver\n\n\n#### Solvers\nPopper uses various MaxSAT solvers. By default, Popper uses the [RC2](https://alexeyignatiev.github.io/assets/pdf/imms-jsat19-preprint.pdf) exact solver provided by PySAT. Popper also supports these solvers:\n\n- [UWrMaxSat](https://github.com/marekpiotrow/UWrMaxSat) (exact)\n- WMaxCDCL (exact)\n- [NuWLS](https://ojs.aaai.org/index.php/AAAI/article/view/25505) (anytime)\n\nYou can download and compile these solvers from the [MaxSAT 2023 evaluation](https://maxsat-evaluations.github.io/2023/descriptions.html) website.\n**We strongly recommend using the anytime NuWLS** solver as it greatly improves the performance of Popper. To use them, ensure that the solver is available on your path.  See the [install solvers](solvers.md) file for help.\n\n#### Performance tips\n- Transform your BK to Datalog, which allows Popper to perform preprocessing on the BK\n- Try the NuWLS anytime solver.\n- Use 6 variables or fewer\n- Avoid recursion and predicate invention\n\n#### Library usage\n\nYou can import Popper and use it in your Python code like so:\n\n```python\nfrom popper.util import Settings\nfrom popper.loop import learn_solution\n\nsettings = Settings(kbpath='input_dir')\nprog, score, stats = learn_solution(settings)\nif prog != None:\n    settings.print_prog_score(prog, score)\n```\n\n#### Contributing\nIf you want to make Popper better, look at the [discussion page](https://github.com/logic-and-learning-lab/Popper/discussions) for open problems or email  [Andrew Cropper](mailto:andrew.cropper@helsinki.fi).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flogic-and-learning-lab%2Fpopper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flogic-and-learning-lab%2Fpopper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flogic-and-learning-lab%2Fpopper/lists"}