{"id":18185984,"url":"https://github.com/lamagraph/interaction-nets-in-fpga","last_synced_at":"2025-04-09T20:14:43.183Z","repository":{"id":251754064,"uuid":"837050732","full_name":"Lamagraph/interaction-nets-in-fpga","owner":"Lamagraph","description":"Interaction nets based processor in Clash","archived":false,"fork":false,"pushed_at":"2025-03-25T16:01:35.000Z","size":293,"stargazers_count":1,"open_issues_count":20,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-09T20:14:38.108Z","etag":null,"topics":["clash","fpga","haskell","interaction-nets"],"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/Lamagraph.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}},"created_at":"2024-08-02T05:38:04.000Z","updated_at":"2025-03-20T15:42:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"12f9a7cf-18d4-4033-92c6-ee6e2cb66909","html_url":"https://github.com/Lamagraph/interaction-nets-in-fpga","commit_stats":{"total_commits":23,"total_committers":3,"mean_commits":7.666666666666667,"dds":"0.13043478260869568","last_synced_commit":"92f219edbced99fed09afd3d6f6e3f8340590284"},"previous_names":["lamagraph/interaction-nets-in-fpga"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lamagraph%2Finteraction-nets-in-fpga","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lamagraph%2Finteraction-nets-in-fpga/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lamagraph%2Finteraction-nets-in-fpga/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lamagraph%2Finteraction-nets-in-fpga/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lamagraph","download_url":"https://codeload.github.com/Lamagraph/interaction-nets-in-fpga/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248103872,"owners_count":21048245,"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":["clash","fpga","haskell","interaction-nets"],"created_at":"2024-11-02T23:04:17.410Z","updated_at":"2025-04-09T20:14:43.161Z","avatar_url":"https://github.com/Lamagraph.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Interaction nets based processor in Clash\n\n## Required tools\n\n### Pre-commit\n\nWe use [pre-commit](https://pre-commit.com/) for general tidy up of files.\nTo install pre-commit run:\n\n```shell\npip install pre-commit # or install using your distro package manager\npre-commit install\n```\n\nTo run pre-commit on all files run\n\n```shell\npre-commit run --all-files\n```\n\n### Fourmolu\n\nWe use [Fourmolu](https://fourmolu.github.io/) as a formatter for Haskell source files with our custom config.\n**Fourmolu must be explicitly enabled in VS Code!**\n\n## Editor\n\nOur editor of choice is [VS Code](https://code.visualstudio.com/) with following extensions:\n\n- [Haskell](https://marketplace.visualstudio.com/items?itemName=haskell.haskell)\n\n## Interaction nets\n\nWe use a variation of interaction nets that was proposer by Yves Lafont in 1989 in the paper [\"Interaction nets\"](https://dl.acm.org/doi/10.1145/96709.96718) as a base for our project.\nBelow we introduce basic definitions and discuss some assumptions that we use.\n\nLet $\\Sigma$ is an alphabet of **agents**.\nLet $Ar: \\Sigma \\to \\mathbb{N}$ is an **arity function**.\nWe suppose that $0 \\in \\mathbb{N}$.\nEach agent $l \\in \\Sigma$ has a one **primary port** and $Ar(l)$ **secondary ports**: $Ar(l) + 1$ ports in total.\n\n**Network** $\\mathcal{n}$ over alphabet $\\Sigma$ is an undirected graph where\n- Each vertex is labelled with an agent and contains respective number of ports.\n- Each edge is a connection between ports.\n- Each port can be connected with not more then one port.\n\n$\\mathcal{N}_{\\Sigma}$ is a set of all possible networks over $\\Sigma$.\n\n**Note**\n- Network can contains ports that do not connected to other ports. The port without connection is a **free port**. $\\mathcal{I}(\\mathcal{n})$ is set of free ports of network $\\mathcal{n}$ or an **interface of the network $\\mathcal{n}$**.\n- Network can consists of edges only. In this case, each end of edge is a free port.\n- Network without vertices and edges is an **empty network**.\n\nThe pair of nodes $a$ and $b$ that connected via primary ports (there is an edge that connects primary port of $a$ with primary port of $b$) is an **active pair**.\nWe use $a \\bowtie b$ to denote that $a$ and $b$ is an active pair.\n\nNetwork $\\mathcal{n}$ is in **normal form** if there is no active pairs in $\\mathcal{n}$.\n\n**Reduction rule** $r \\in \\Sigma \\times \\Sigma \\times \\mathcal{N}_{\\Sigma}$ is graph rewriting rule.\n$\\mathcal{R}$ is a set of reduction rules.\n- If $(l_1,l_2,\\mathcal{n}) \\in \\mathcal{R}$ then $(l_2, l_1,\\mathcal{n}) \\in \\mathcal{R}$.\n- If $(l_1,l_2,\\mathcal{n}_1) \\in \\mathcal{R}$ and $(m_1, m_2,\\mathcal{n}_2) \\in \\mathcal{R}$ then $(l_1,l_2) \\neq (m_1,m_2)$.\n- For all $(l_1,l_2,\\mathcal{n}) \\in \\mathcal{R}$, $\\mathcal{n}$ is in normal form.\n- For all $(l_1,l_2,\\mathcal{n}) \\in \\mathcal{R}$, $Ar(l_1) + Ar(l_2) = |\\mathcal{I}(\\mathcal{n})|$.\n\nComputation is an application of rewriting rules to active pairs.\nIf there is an active pair $a \\bowtie b$ in network $\\mathcal{n_0}$, where\n- $a$ is labelled with $l_1$\n- $b$ is labelled with $l_2$\n- $r = (l_1, l_2, \\mathcal{m}) \\in \\mathcal{R}$\n\nthen we can replace $a \\bowtie b$ with $\\mathcal{m}$ and get new network $\\mathcal{n_1}$.\nThus, computation is a sequence of steps of the form $\\mathcal{n_i} \\xrightarrow{r} \\mathcal{n_{i+1}}$.\nComputation finishes when network in normal form.\n\nActive pair $a \\bowtie b$ is **realizable** if there is a sequence\n\n$$\\mathcal{n_0} \\xrightarrow{r_0} \\ldots \\xrightarrow{r_{k-1}} \\mathcal{n_k},$$\n\n$r_i \\in \\mathcal{R}$, such that $\\mathcal{n}_k$ contains $a \\bowtie b$.\nWe assume that for the given network $\\mathcal{n}$ and rules set $\\mathcal{R}$, $\\mathcal{R}$ contains rules for all **realizable** active pairs.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flamagraph%2Finteraction-nets-in-fpga","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flamagraph%2Finteraction-nets-in-fpga","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flamagraph%2Finteraction-nets-in-fpga/lists"}