{"id":22195256,"url":"https://github.com/sano-jin/vertex","last_synced_at":"2025-03-24T21:33:25.328Z","repository":{"id":55957194,"uuid":"293096550","full_name":"sano-jin/vertex","owner":"sano-jin","description":"A proof of concept of DHLMNtal.","archived":false,"fork":false,"pushed_at":"2021-05-28T15:39:34.000Z","size":15876,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-30T01:44:05.897Z","etag":null,"topics":["atoms","dhl","language-model","reduction","rewrite-graphs","visualizes"],"latest_commit_sha":null,"homepage":"https://sano-jin.github.io/vertex/","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sano-jin.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}},"created_at":"2020-09-05T14:53:47.000Z","updated_at":"2021-07-05T10:20:45.000Z","dependencies_parsed_at":"2022-08-15T10:20:12.174Z","dependency_job_id":null,"html_url":"https://github.com/sano-jin/vertex","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sano-jin%2Fvertex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sano-jin%2Fvertex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sano-jin%2Fvertex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sano-jin%2Fvertex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sano-jin","download_url":"https://codeload.github.com/sano-jin/vertex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245355619,"owners_count":20601761,"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":["atoms","dhl","language-model","reduction","rewrite-graphs","visualizes"],"created_at":"2024-12-02T13:17:29.261Z","updated_at":"2025-03-24T21:33:25.275Z","avatar_url":"https://github.com/sano-jin.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Directed HyperLMNtal\n\n![Cube](/doc/dhlvis_cube.png)\n\n*This is an experimental project*\n\nDirected HyperLMNtal (DHLMNtal) is a derived calculus model of [LMNtal](https://www.ueda.info.waseda.ac.jp/lmntal/index.php).\nIt is designed to be able to deal with hypergraphs representing structures and pointers easily\nwithout having dangling pointers.\n\n## Installization\n- Requirement\n  - stack (haskell).\n\n```bash\ngit clone https://github.com/sano-jin/vertex.git\ncd vertex\nstack build  \n```\n\n## Introduction\n\n### Atoms and Links\nDHLMNtal program is consists of graphs. Graphs are consists of Atoms (= nodes) and Links (= directed hyper edges).\n\n- Links\n  - links are denoted by identifiers starting from capital letters.\n  - When representing a graph, links must appear inside of the *link creation* `\\X1 X2 ... Xn.\u003cinside the link creation\u003e`.\n  - E.g. `X`, `Y`, ...\n- Atoms\n  - An atom has an *incomming link*, its name and 0 or more *outgoing links*.\n    Denote them as `\u003cthe incomming link\u003e \"-\u003e\" \u003cthe name of the atom\u003e \"(\" \u003cthe outgoing links\u003e \")\"`.\n    - The name can be an identifier starting from small lettes.\n    - You can omit the parentheses if there is no outging link and\n    - you can omit the incomming link if the link doesn't appear other than it.\n  - E.g. `X -\u003e a(Y, Z)`, `X -\u003e b`, `c`, ...\n\nSeparate atoms with commas.\n\nFor example, you may write like this.\n```\n\\X.(a(X), X -\u003e b)\n```\n\nOpen your favorite editor, write down the former program, save it as `test1.dhl` and visualize it with the `dhlvis`.\n\n```bash\nstack exec dhlvis -- test1.dhl\n```\n\n![The graphical image of the test1.dhl](doc/dhlvis_sample1-1.png)\n\nPress ESC to terminate.\n\n\nThere also are several abbreveation schemes for convenience.\n\nFor example, `a(b)` is as same as the former `\\X.(a(X), X -\u003e b)`.\nSince you can embed the atom where the outgoing link should occur\nand omit the link creation if the outgoing link and the incomming link of the atom are the same\nand there is no other occurrence in the link creation.\n\n### Rules\n\nBesides the graphs, you can write the (rewriting) *rules* `\u003cleft hand side: subgraph to match\u003e \":-\" \u003cright hand-side: subgraph to yield\u003e`.\nThe rule will rewrite the graph to its right hand-side if it's left hand-side mathces.\nNotice the rule remains and tries to rewrite graphs until it fails.\n\nYou can use period to separate graphs and rules.\n\nRewrite the former program as the following\n```\na(b).\nX -\u003e b :- X -\u003e c.\n```\n\nand visualize it.\n\n```bash\nstack exec dhlvis -- test1.dhl\n```\n\n![The graphical image of the test1.dhl](/doc/dhlvis_sample1-2.png)\n\nPress SPACE to reduce (rewrite) 1 step.\n\nIf you want the reduction steps in a text, run `dhli`.\n```stack \nstack exec dhlvis -- test1.dhl\n```\n\nThe output will be the following.\n```\n0: \na(b). \n\n1: X -\u003e b :- X -\u003e c ~\u003e \na(c). \n```\nThis shows\n- The initial state is the `a(b)` (and the rule),\n- the reduction `~\u003e` proceeds with a rule `X -\u003e a :- X -\u003e c` and\n- the second and the terminal state is `a(c)` (and the rule).\n\nNotice that the rule is hided for the simplicity but it does exist throughout the calculation process.\n\n### Non-detereminisity\nDHLMNtal has non-detereminisity.\nRules can rewrite graph as long as they matches, they are not ordered. \n\nFor example, the resulting graph of `a. a :- b. a :- c` can be `b` or `c`.\n\nYou can use `--nd` (non-deterministic) option to construct the state transition space (all possible states and reduction).\n\nThis can be also applied to the not-terminating program.\n\nFor example, `example/nd/cycle.dhl` is a following program.\n```\na.\n\na :- b.\nb :- c.\nc :- d.\nd :- e.\ne :- f.\nf :- a.\n```\n\nYou can run this with the `--nd` option.\n```bash\nstack exec dhli  -- example/nd/cycle.dhl --nd\n```\n\n\nAlso, you can visualize the state transition space.\n\nRun `stateViewer` as below.\n\n```bash\nstack exec stateViewer  -- example/nd/cycle.dhl\n```\n\n![stateViewer_nd1](/doc/stateViewer_nd1.png)\n\nYou can easily see that the transitions are forming a cycle and there is no terminal state.\n\n### For more informations\nSee [here](/semantics.md) to get more description about semantics.\n[This pdf](/doc/Directed_HyperFlatLMNtal.pdf) also describes the semantics.\n\nAlso, feel free to take a look at the [slide](/doc/DHLMNtal.pdf) (its written in Japanese though).\n\n\n## Tools in a nutshell\n\n- `dhli`\n  - the ordinary (one-way) execution if you put no option.\n    - E.g. `stack exec dhli -- example/sample.dhl`\n  - put `--nd` for the non-deterministic execution \n    - E.g. `stack exec dhli -- example/nd/cycle.dhl --nd`\n    - add `--show-all` for more detailed result (this shows the all transitions).\n- `dhlvis`\n  - visualizes the graph rewriting process in the ordinary execution.\n    - E.g. `stack exec dhlvis -- example/vis/cube.dhl`\n- `stateViewer`\n  - visualizes the state transition space (all possible states and the transitions).\n    - E.g. `stack exec stateViewer -- example/nd/cycle.dhl`\n\n## Development\n\n### Test\nRun this test to obtain more detailed information about the state of the heap, etc.\n\n```shell\nstack test --test-arguments \"example/sample.dhl\"\n```\n\nAlso, see [here](/test/test-suits) to get more information about testing this.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsano-jin%2Fvertex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsano-jin%2Fvertex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsano-jin%2Fvertex/lists"}