useful-notes/hassan/010-datomic-for-geolog.md

120 lines
4.6 KiB
Markdown
Raw Normal View History

2026-03-26 16:05:41 +01:00
## Datomic as a Backend for Geolog
### Short Answer
Datomic could plausibly serve as the **persistence layer** for Geolog, but not as the full **logic/runtime backend**.
It matches Geolog's desire for:
* **Persistent, append-only storage** with history
* **Interactive mutation** over evolving instances
* **Datalog-style querying** over stored facts
It does **not** by itself provide the core Geolog semantics described elsewhere in these notes:
* **Existential witness generation** during the chase
* **Disjunctive branching** into multiple candidate models
* **Equality saturation / term merging**
* **Typed theories, dependent theories, and nested instances** as first-class language concepts
So the right mental model is:
* **Datomic stores Geolog state**
* **Geolog implements its own chase/type/equality engine above Datomic**
---
### Why It Fits Part of the Problem
The notes describe Geolog as infrastructure with **persistent, append-only storage** and an **interactive REPL**, not just as a one-shot solver. Datomic's immutable fact model lines up well with that storage story.
Good candidates to store in Datomic:
* theory definitions
* schemas for sorts, functions, and relations
* user-authored instance data
* derived facts and provenance
* transaction history
* saved snapshots / named worlds
This is especially attractive if Geolog wants:
* time travel / "as of" inspection
* auditability of derivations
* incremental recomputation from prior states
* a durable log of REPL activity
---
### Where Datomic Stops Being Enough
The Geolog notes are clear that the system goes beyond plain Datalog.
Geolog needs chase behavior that can:
* invent fresh witnesses for existential conclusions
* branch when a rule concludes a disjunction
* merge terms when equations force equality
Those are central to the chase-based model described in the notes, and they are not features Datomic gives you as a database. Datomic gives you a temporal fact store plus Datalog query tools; it does not give you a geometric-logic engine.
That means a Datomic-based Geolog would still need its own:
* rule compiler / evaluator
* model-branch management
* equality class machinery
* fixpoint / chase scheduler
* termination controls and bounds
Inference: Datomic is a reasonable substrate for storing models and derivation history, but it is not a substitute for the core Geolog runtime.
---
### Licensing and Stack Implications
As of **March 26, 2026**, Datomic's official docs say that **all editions are free** and that the **binaries are licensed under Apache 2.0**, while Datomic's own FAQ says it is **not open source** because the source is not published.
Official sources:
* [Datomic Overview](https://docs.datomic.com/datomic-overview.html)
* [Datomic Pro Releases](https://docs.datomic.com/releases-pro.html)
* [Datomic is Free](https://blog.datomic.com/2023/04/datomic-is-free.html)
* [Datomic Local is Released](https://blog.datomic.com/2023/08/datomic-local-is-released.html)
Practically, that means:
* You **can** use Datomic inside a stack whose other components are open source.
* You **can** redistribute Datomic binaries where the Apache-licensed binary terms allow it.
* Datomic does **not** force the rest of the stack to become closed-source.
* But you are still depending on a **source-unavailable vendor component**.
That source-unavailable dependency has real engineering consequences:
* you cannot inspect or modify Datomic internals
* you cannot self-maintain a fork if Nubank stops investing in it
* debugging deep engine behavior depends on vendor docs and black-box observation
* fully reproducible "build everything from source" workflows become weaker
* some contributors will reject the stack on principle because it is not fully open
So the licensing issue is not "can it legally coexist with open parts of the stack?" The answer there is mostly **yes**. The more important question is strategic:
* does Geolog want a **fully open, self-hostable, inspectable foundation**
* or is it acceptable to place the storage layer on a **free but closed-source binary**
If Geolog wants the strongest possible open-source story, Datomic is a poor fit. If Geolog mainly wants a strong immutable fact store and accepts vendor dependence, Datomic remains viable.
---
### Bottom Line
For Geolog as described in these notes:
* **Yes** for storage, history, and query support
* **No** for the core reasoning engine
* **Legally workable** in a mixed stack
* **Strategically questionable** if full openness is a project goal
## Changelog
* **Mar 26, 2026** -- Added note on whether Datomic could serve as a backend for Geolog, including licensing implications.