Metastrudel: A Dependently Typed Metagraph Database
Graph databases make a choice that most applications later regret: some things are first-class and some are not. In RDF a statement has no identity without reification; in property graphs an edge property cannot itself carry an edge; in TypeDB a role-player connection and an attribute ownership cannot be talked about. Schemas are, almost everywhere, a separate language that lives outside the data they constrain. We present Metastrudel, a database whose native model is a typed metagraph. Everything stored is an element of one of two shapes, an atom or a link; links are elements and may be the subjects of further links; contexts, which group elements, are elements too; and types, link types, signatures and typing rules are elements stored in the same graph, in a fixed three-layer stratification. Typing is context-relative: the central judgment is M ⊢ x : T, “x has type T inside context M”. It is dependent in a deliberately narrow and decidable sense: a signature declares type parameters that each conforming context binds, and a type may depend on a value only through refinement by a decidable predicate. Stronger rules run in a logic-programming engine (lean-elpi) under a budget or offline, optionally producing proof certificates checked by the Lean kernel. Queries are homoiconic: every query and rule is stored as a content-addressed metagraph in the same kernel, so it can be typed, versioned and queried like data. The kernel and type system are specified in Lean 4, which is the normative source; the Rust implementation is differentially tested against an executable Lean reference. We describe the model, the typing judgments and their decision procedures, the incremental commit-time checker together with its soundness and preservation theorems, and the design of the query, reasoning and certification layers.
Authors
- Володимир Іванович Павлишин (ORCID: https://orcid.org/0009-0005-3587-3738)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-12-02
- DOI
- https://doi.org/10.5281/zenodo.24754240
- Primary Topic
- Logic, programming, and type systems
- Type
- preprint