{"id":13837498,"url":"https://github.com/lambduli/minilog","last_synced_at":"2025-07-10T18:33:29.006Z","repository":{"id":161020625,"uuid":"572877272","full_name":"lambduli/minilog","owner":"lambduli","description":"A small logic programming language.","archived":false,"fork":false,"pushed_at":"2024-05-14T10:44:46.000Z","size":92,"stargazers_count":17,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-14T11:49:33.267Z","etag":null,"topics":["language","logic-programming","programming-language","prolog","prolog-implementation","repl","unification"],"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/lambduli.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2022-12-01T08:15:22.000Z","updated_at":"2024-05-30T04:34:19.221Z","dependencies_parsed_at":null,"dependency_job_id":"a3a1a5de-dcbb-40e6-be0f-3e776d4ef994","html_url":"https://github.com/lambduli/minilog","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lambduli/minilog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambduli%2Fminilog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambduli%2Fminilog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambduli%2Fminilog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambduli%2Fminilog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lambduli","download_url":"https://codeload.github.com/lambduli/minilog/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambduli%2Fminilog/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264631212,"owners_count":23640941,"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":["language","logic-programming","programming-language","prolog","prolog-implementation","repl","unification"],"created_at":"2024-08-04T15:01:11.791Z","updated_at":"2025-07-10T18:33:28.772Z","avatar_url":"https://github.com/lambduli.png","language":"Haskell","funding_links":[],"categories":["Haskell"],"sub_categories":[],"readme":"# Minilog\n\nMinilog is a very small programming language implementation.\nIt's goal is to capture the essence of logic programming.\n\n\u003e For the implementation write up see: [the write up](./WRITEUP.md).\n\nIt is very much a subset of Prolog, at least in terms of the syntax.\nThe biggest (intended) difference in terms of a runtime behaviour is the strict\n`occurs` checking.\nUnlike Prolog, Minilog does not accept infinite terms.\n\nThis means that the following snippet will succeed in Prolog but not in Minilog:\n\n```prolog\nX = foo(X).\n```\n\n## Syntax\nAs stated above, Minilog's syntax is a subset of the syntax of Prolog.\nIn Minilog you have:\n\n- Atoms\n\n  `foo`, `z`\n\n- Variables\n\n  `X`, `Y`\n- Wildcards\n\n  `_`\n- Structs\n\n  `foo(X, thing)`\n\n- Facts\n\n  `plus(z, N, N).`\n\n- Rules\n\n  `plus(s(N), M, s(R)) :- plus(N, M, R).`\n\n- Conjunctions\n\n  `times(N, M, R), plus(R, M, A).`\n\n- Unification Operator\n\n  `X = something`\n\n----\n\nHere is an example of a valid Minilog knowledge base definition:\n```prolog\n  plus(z, N, N).\n  plus(s(N), M, s(R)) :- plus(N, M, R).\n\n  times(z, _, z).\n  times(s(N), M, A) :- times(N, M, R), plus(R, M, A).\n\n  fact(z, s(z)).\n  fact(s(N), R) :- fact(N, PR), times(s(N), PR, R).\n```\n\nAnd here is an example of a valid query:\n```prolog\n?- fact(A, B) , plus(A,B, s(s(z))) .\n```\n\n---\n\n## What is not in Minilog?\n\n- numbers\n- arithmetics (obviously)\n- strings\n- explicit or (`;`)\n- cuts (`!`)\n\n## What is it for?\n\nThe implementation is just a complement of the [write up](./WRITEUP.md).\nThe goal of this project is to offer an introductory level almost tutorial-like description of an implementation of a simple abstract machine for a logic language.\n\nThe design of the implementation is not aming to represent a practical implementation of a logic programming language.\nIt should not be considered more than an initial exposition to the ideas behind concepts like\nunification, proof search that happens during the evaluation and a backtracking in such a proof search.\n\nYou could also say that the design of the implementation was chosen to be observable by default. Indeed, as the runtime is implemented\nas a simple \"stepping\" interpreter, we can very much see \"inside\" the process.\nThe write up goes into more detail on that topic.\n\nThe goal of the project is not to be a rigorous introduction into the matter! At best it should serve as a toy-like demonstration; similar to when a math or physics teacher reaches for a vast (but still valid) simplification to make some complicated sounding concept more approachable.\n\n\n## How can you use it?\n\n1) You run `cabal build` and if that succeeded `cabal run`.\n\n2) You can use the knowledge base in the repository, modify it, or use your own. It is loaded into the repl using a command `:load \u003cpath to the file\u003e` like `:load factorial.pl`.\n\n3) You write Prolog-like query and hit enter.\n\n4) When presented with a result, you either write `:next` and hit enter (to backtrack) or you write `:done` and hit enter to conclude the computation.\n\n5) When you want to quit the REPL, you submit `:q` or `:Q`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flambduli%2Fminilog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flambduli%2Fminilog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flambduli%2Fminilog/lists"}