Over the past year, this blog has accumulated a library of Petri net models — coffee shops, tic-tac-toe, sudoku, knapsack problems, enzyme kinetics, Texas Hold'em — alongside concept posts on DDM, the token language, zero-knowledge proofs, and declarative infrastructure. Each post stood on its own, but taken together they trace a path from first principles to working systems.
I've organized that path into a book: Petri Nets as a Universal Abstraction: A Practitioner's Guide to Modeling with pflow.
Blog posts are good for snapshots. A book is better for structure.
The individual posts here were written as they came — a model one week, a concept the next, a tool walkthrough after that. A reader arriving fresh had no clear entry point: start with DDM? The token language? Jump straight to tic-tac-toe? The book answers that question by laying out a deliberate progression: theory first, then worked examples, then advanced topics, then the toolchain that ties it all together.
The book also fills gaps that blog posts skip over. The mathematics of incidence matrices and P-invariants. The formal firing rules. The connection between mass-action kinetics and ODE solvers. Conservation laws. These ideas were implicit in the blog models but never given a proper treatment. The book makes them explicit.
Starts with why Petri nets — what informal models get wrong and what a four-element formalism (places, transitions, arcs, tokens) gets right. Then the mathematics: the 5-tuple definition, markings as state vectors, incidence matrices, P-invariants, and conservation laws. Chapter 3 bridges the gap between discrete event simulation and continuous ODE analysis via mass-action kinetics. Chapter 4 introduces the token language — the four-term DSL (cell, func, arrow, guard) that every pflow model speaks.
If you've read the DDM and token language posts, these chapters expand on what you already know.
Six worked examples, each a blog post grown into a full chapter. The coffee shop becomes a resource modeling tutorial. Tic-tac-toe becomes a lesson in mutual exclusion and history-based pattern detection. Sudoku demonstrates constraint satisfaction through inhibitor arcs. The knapsack problem shows continuous relaxation applied to combinatorial optimization. Enzyme kinetics reveals that mass-action semantics were borrowed from biochemistry in the first place. Texas Hold'em tackles multi-phase state machines with role-based guards.
Each chapter follows the same arc: define the problem, build the net, run the ODE analysis, interpret the results, and identify what the topology tells us that brute-force search cannot.
Four chapters pushing the formalism further. Process mining discovers Petri nets from event logs — working backwards from observed behavior to structural models. Zero-knowledge proofs demonstrate how to prove a state transition is valid without revealing the state itself, using MiMC hashing and Groth16 circuits. Exponential scoring explores the boundary between net structure and external logic. Declarative infrastructure connects Petri nets to JSON-LD, content addressing, and the principle of monotonic expansion.
The ZK Petri nets and JSON-LD posts are the closest blog counterparts here.
The toolchain chapters. How to use pflow.xyz as a visual editor. How petri-pilot generates full-stack applications from models. How go-pflow works under the hood — its solver, reachability analysis, and verification APIs. And the dual implementation pattern: Go and JavaScript producing identical outputs from identical inputs, with state root parity as proof of unambiguous specification.
Readers of this blog will recognize most of the applied material, but the book adds:
The book supports two entry points:
Either way, Part IV is where everything converges into working tools.
The book is live at book.pflow.xyz. The blog continues alongside it — new models and ideas will appear here first, and the best ones will find their way into future chapters.
The premise hasn't changed: small models beat black boxes. The book just gives that premise a spine.