{"id":20425343,"url":"https://github.com/catseye/samovar","last_synced_at":"2025-06-10T16:06:13.827Z","repository":{"id":49117126,"uuid":"69912156","full_name":"catseye/Samovar","owner":"catseye","description":"MIRROR of https://codeberg.org/catseye/Samovar : Model worlds using propositions and run simulations in them","archived":false,"fork":false,"pushed_at":"2023-12-08T09:25:11.000Z","size":172,"stargazers_count":16,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T13:12:00.011Z","etag":null,"topics":["dsl","experimental-language","hoare-logic","production-system","production-systems","proposition","simulation-engine","story-generation"],"latest_commit_sha":null,"homepage":"https://catseye.tc/node/Samovar","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/catseye.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-03T21:23:51.000Z","updated_at":"2024-07-21T21:30:21.000Z","dependencies_parsed_at":"2023-01-22T14:00:24.397Z","dependency_job_id":null,"html_url":"https://github.com/catseye/Samovar","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catseye%2FSamovar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catseye%2FSamovar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catseye%2FSamovar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catseye%2FSamovar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/catseye","download_url":"https://codeload.github.com/catseye/Samovar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248618273,"owners_count":21134200,"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":["dsl","experimental-language","hoare-logic","production-system","production-systems","proposition","simulation-engine","story-generation"],"created_at":"2024-11-15T07:13:00.472Z","updated_at":"2025-04-12T18:55:25.694Z","avatar_url":"https://github.com/catseye.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Samovar\n=======\n\nVersion 0.6 | _Entry_ [@ catseye.tc](https://catseye.tc/node/Samovar)\n| _See also:_ [The League of Extraordinarily Dull Gentlemen](https://git.catseye.tc/NaNoGenMo-Entries-2018/blob/master/league/README.md)\n∘ [The Swallows](https://git.catseye.tc/The-Swallows/)\n\n- - - -\n\n**Samovar** is a domain-specific language (DSL) for modelling a world using\npropositions (facts), and possible events that can occur based on those facts,\nchanging them.\n\nHere is a short example of a Samovar description:\n\n    scenario IgnatzWithBrick {\n      \n        [actor(?A),item(?I),~holding(?A,?I)]  ?A picks up the ?I.   [holding(?A,?I)]\n        [actor(?A),item(?I),holding(?A,?I)]   ?A puts down the ?I.  [~holding(?A,?I)]\n    \n        actor(Ignatz).\n        item(brick).\n    \n        goal [].\n    }\n\nAnd an implementation of Samovar could take this scenario and use it to,\namong other things, generate textual descriptions of chains of events like\n\n    Ignatz picks up the brick. Ignatz puts down the brick.\n\nOf course, this is a very simple example.  (It doesn't even prevent two\nactors from picking up the same item at the same time!)  For more complex\nexamples, and a fuller description of the language, see\n[doc/Samovar.md](doc/Samovar.md), which also serves as a test suite.\n\n### Implementation\n\nThe reference implementation of Samovar, `samovar`, is written in Python.\nIt can run under either Python 2.7 or Python 3.x (tested with 3.5 or higher.)\n\n### Discussion\n\nThis looks like logic programming but the internals are actually much simpler,\nand what it's doing is not logical inference.\n\nThe internals are far simpler than an inference engine or a theorem\nprover: there are no logical rules in the database, only propositions, so\nthey can be selected by simple pattern-matching rather than full unification.\n\nI originally described it as an \"assertion-retraction engine\", which could\nbe thought of as a highly stylized form of Prolog programming.  Alternately,\nit could be thought of as assigning preconditions and postconditions, like\nin [Hoare logic][], to actions in a world-model.  Instead of constructing a\nproof, though, we simply chain actions together, by selecting any next one\nwhose preconditions hold, and altering the world so that its postconditions hold.\n\nIn (I think) autumn 2019, I came across the concept of a [production system][],\nand I realized that is basically what Samovar implements.  Researching it\nfurther, I discovered [CLIPS][], a production system built in 1985,\nand I realized that Samovar is not essentially different from an\ninefficiently-implemented, stripped-down version of CLIPS.\n\nThe main innovation in Samovar is the ability to \"narrate\" the choices the\nproduction system makes, with human-readable text.\n\nThis isn't too surprising, since my goal with Samovar was to make an expressive\nlanguage, a syntax in which the author could write a story generator without\nthe undue effort of switching context between prose and code.  Picking logical\npropositions for the \"code\" and placing them before and after each fragment of\nprose was a reasonably \"ergonomic\" choice, and happens to coincide with the\nstructure of a production system.\n\n[Hoare logic]: https://en.wikipedia.org/wiki/Hoare_logic\n[production system]: https://en.wikipedia.org/wiki/Production_system_(computer_science)\n[CLIPS]: https://en.wikipedia.org/wiki/CLIPS\n\n### TODO\n\n*   Maybe allow variables to be notated so that they can bind reflexively,\n    e.g. `?*A looks at ?*B` can bind both variables to Alice.\n*   Make `?_` work such that you can say `¬holding(?_, club)` to mean\n    \"if no one is holding the club\".\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatseye%2Fsamovar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcatseye%2Fsamovar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatseye%2Fsamovar/lists"}