[Paper] Implementing Grassroots Logic Programs with Multiagent Transition Systems and AI
Source: arXiv
Source: arXiv:2602.06934v1
Overview
Ehud Shapiro’s paper introduces Grassroots Logic Programs (GLP)—a concurrent logic‑programming language built around paired readers (futures) and writers (promises). By guaranteeing that each variable is written once and read once, GLP blends ideas from linear logic and promise‑based async programming, making it a natural fit for peer‑to‑peer smartphone networks that must operate without a central coordinator.
The work goes beyond theory:
- It defines deterministic operational semantics
- dGLP – for single agents
- madGLP – for multi‑agent systems
- It proves these semantics faithfully implement the original, more abstract semantics.
- The specifications are then used by an AI‑driven code generator to produce real‑world Dart implementations for both workstations and smartphones.
Key Contributions
- Grassroots Logic Programs (GLP) – a novel concurrent logic language featuring paired reader/writer variables that enforce single‑assignment and single‑consumption semantics.
- Deterministic Single‑Agent Semantics (dGLP) – an implementation‑ready, deterministic variant of GLP’s concurrent semantics, formally proven correct.
- Deterministic Multi‑Agent Semantics (madGLP) – extends dGLP to multi‑agent settings, preserving determinism at the agent level while supporting asynchronous communication.
- AI‑Assisted Code Generation – the deterministic semantics serve as formal specifications for an AI system that automatically generates Dart code for both desktop and mobile platforms.
- Proof‑Carried Correctness – rigorous proofs that dGLP and madGLP faithfully implement the original GLP semantics, providing strong confidence in the generated implementations.
Methodology
Language Design – GLP’s core idea is to split every logical variable into a reader (future) and a writer (promise).
- A writer can produce a value exactly once.
- A reader can consume that value exactly once.
This mirrors the “once‑only” nature of promises in modern async APIs while preserving the declarative power of logic programming.
Operational Semantics –
- Concurrent GLP – defined as a transition system where a single agent repeatedly applies inference rules to a global store of reader/writer pairs.
- Multi‑agent GLP (maGLP) – modeled as a multi‑agent transition system; each agent runs its own copy of the single‑agent semantics and communicates asynchronously via message passing.
Deterministic Refinement –
- dGLP – refactors the nondeterministic rule set into a deterministic scheduler that selects the next applicable rule in a canonical order, making the semantics directly executable.
- madGLP – builds on dGLP, adding a deterministic per‑agent scheduler while allowing nondeterminism only in the inter‑agent message‑delivery order (reflecting real‑world network latency).
Formal Verification – Using theorem‑proving techniques, the paper proves that every step taken by dGLP (respectively madGLP) corresponds to a valid step in the original GLP (respectively maGLP) semantics.
AI‑Driven Implementation – The deterministic semantics are fed to an AI code‑synthesis tool that emits Dart source code:
- a desktop prototype for dGLP, and
- a Flutter‑compatible mobile app for madGLP.
Results & Findings
| Aspect | Findings |
|---|---|
| Correctness | dGLP and madGLP are sound (no illegal steps) and complete (all legal steps can be reproduced) relative to the original semantics. |
| Determinism | Single‑agent execution becomes fully deterministic, simplifying debugging and testing. Multi‑agent execution remains deterministic per agent, with asynchrony isolated to message ordering. |
| Performance | Prototype implementations run efficiently on typical smartphones (Android/iOS) and on a standard workstation, handling tens of concurrent agents with low latency. |
| Expressiveness | The paired reader/writer model succinctly expresses common patterns—request/response, publish/subscribe, and more complex bidirectional protocols—without extra boilerplate. |
These findings demonstrate that the theoretical constructs are not only mathematically sound but also practically viable on commodity hardware.
Practical Implications
- Decentralized mobile apps – Developers can build peer‑to‑peer services (e.g., ad‑hoc chat, collaborative editing, local IoT coordination) without relying on cloud back‑ends, using GLP’s built‑in guarantees of single‑assignment and consumption.
- Simplified async code – The reader/writer pairing maps directly onto Dart’s
Future/Completerpattern, letting developers write logic‑style code while the runtime handles the underlying message passing. - Formal guarantees – Because the implementation stems from a formally verified semantics, bugs related to race conditions or double‑consumption are dramatically reduced, a boon for safety‑critical mobile systems.
- Rapid prototyping – The AI‑generated Dart skeletons provide a ready‑to‑run codebase that can be extended with custom business logic, cutting months of boilerplate development.
- Scalable grassroots platforms – GLP’s “grassroots” philosophy means new nodes can join or leave the network at any time, making it suitable for dynamic edge‑computing scenarios (e.g., disaster‑response networks).
Limitations
- Network Assumptions – madGLP assumes reliable, FIFO message delivery between peers. Real‑world mobile networks may drop or reorder packets, requiring additional reliability layers.
- Tooling Maturity – The AI code‑generation pipeline is still experimental; developers may need to manually refine the generated Dart code for production‑grade performance or UI integration.
- Scalability Benchmarks – Current prototypes have been tested with modest numbers of agents. Large‑scale stress testing (hundreds or thousands of devices) remains to be performed.
- Language Ecosystem – GLP is presently tied to Dart/Flutter; porting the deterministic semantics to other ecosystems (e.g., Kotlin, Swift) would broaden adoption.
Future Work
- Extend the semantics to handle unreliable communication.
- Integrate formal verification tools into the AI generation loop.
- Build a full‑featured GLP SDK for multiple programming languages.
## Authors
- **Ehud Shapiro**Paper Information
| Item | Details |
|---|---|
| arXiv ID | 2602.06934v1 |
| Categories | cs.PL, cs.AI, cs.DC, cs.LO, cs.MA |
| Published | February 6, 2026 |
| Download PDF |