Types for Grassroots Logic Programs

📅 2026-01-25
📈 Citations: 1
Influential: 0
📄 PDF
🤖 AI Summary
Existing Grassroots Logic Programs (GLPs) lack type support for interactive, potentially deadlocking, or non-terminating computations, making it difficult to ensure communication reliability in AI-assisted development. This work proposes the first modal path regular type system incorporating directional modes, which distinguishes between read and write directions of subterms to enable static type checking for partial, interactive, and even non-terminating programs. By integrating covariance and contravariance semantic conditions with formal syntactic rules, the system establishes that well-typedness is equivalent to semantic paths satisfying directional constraints. Furthermore, a correct-by-construction Dart implementation is automatically generated from the formal specification by an AI, demonstrating the feasibility of human-AI collaborative programming.

Technology Category

Application Category

📝 Abstract
Grassroots Logic Programs (GLP) is a concurrent logic programming language in which logic variables are partitioned into paired readers and writers. An assignment is produced at most once via a writer and consumed at most once via its paired reader, and may contain additional readers and/or writers. This enables the concise expression of rich multidirectional communication modalities. ``Logic Programs as Types for Logic Programs''(LICS'91) defined types as regular sets of paths over derivable ground atoms. Here, we define types to be regular sets of moded paths, where a mode captures directionality of communication -- whether a subterm is consumed from or produced to the environment -- enabling the typing of interactive partial computations including those that eventually deadlock or fail, or never terminate. We provide a syntactic definition of well-typing and prove that a program is well-typed iff the path abstraction of its moded-atom semantics satisfies covariance and contravariance conditions with respect to its type. The GLP type system was implemented in Dart by AI, starting from a mathematical specification of Typed GLP (this paper), deriving from it an English spec (written by AI), and from the spec deriving Dart code (by AI). While GLP is naturally untyped, the motivation for Typed GLP comes from programming with AI: Asking AI to program complex communication modalities in GLP (and in general) and hoping for the best is a tenuous strategy. The emerging discipline we advocate and employ is for the human designer and AI to jointly develop and agree upon (1)~GLP types; (2)~GLP procedure type declarations; (3)~informal (English) descriptions of the procedures; and only then let AI attempt to write (4)~GLP code based on those.
Problem

Research questions and friction points this paper is trying to address.

Grassroots Logic Programs
type system
concurrent logic programming
interactive computation
AI-assisted programming
Innovation

Methods, ideas, or system contributions that make the work stand out.

moded paths
type system
concurrent logic programming
covariance and contravariance
human-AI collaboration
🔎 Similar Papers
No similar papers found.