Roy Gonzalez
MLambda · independent research

Research

MLambda — one family of software I have been building since 2019, from the compiler up.

Everything below is something I designed and built. Each entry links to its page on www.mlambda.net, where it is documented in detail. The repositories themselves are private, so the links go to documentation and to the MLambda Store rather than to source.

Aleph: a language and its compiler

I designed and built Aleph, a pure, lazy, Hindley–Milner typed language, and its native compiler, which is written in Aleph itself. The compiler is a pipeline of small phases: a front end generated from its grammar, type inference with traits and associated types, a pattern compiler, fifteen optimisation passes (inlining, specialisation, defunctionalisation, tail-call contification), and LLVM code generation for nine targets: Windows, Linux (glibc and static musl), ARM64, Android, macOS, RISC-V Linux and bare metal, and WebAssembly for the browser.

What the compiler would usually hard-code (which platforms exist, how a test run is planned, how packages resolve) is decided by logic rules instead. Its runtime, from the heap and the tracing collector to fibers, STM and a native TLS 1.3, is written in Aleph too. Every MLambda program, from the database to the apps, is built with it.

  • Compiler design
  • Hindley–Milner
  • Type classes
  • LLVM
  • RISC-V
  • WebAssembly
  • Runtime and GC

MLambda.Data: a database engine

I built a database engine from the storage up: a write-ahead log, memtables, SSTables with bloom blocks and compaction, four kinds of index, a query planner and joins, schema evolution and constraints, and replication on a consistent-hash ring with One, Quorum or All per request. It is actor-native: every component is an actor, the actor framework is the cluster, and a query is a typed value the compiler checks, so there is no query text to parse or inject. Its consistency model is a TLA+ specification, model-checked.

  • LSM storage
  • WAL
  • B-tree, hash, bloom and inverted indexes
  • Query planning
  • Consistent hashing
  • TLA+

MLambda.Actors: an actor model

I created an actor model whose actors are addressed by route rather than by location, so the same actor runs unchanged in one process, in a cluster or on a node that is both. It has supervision trees, behaviour switching, death watch, timers and circuit breakers, sagas with compensations, gossip membership with phi accrual failure detection, a CRDT route table, and encrypted frames between nodes. Its behaviour (delivery, routing, supervision, gossip) is specified in TLA+ and model-checked. It is the runtime of every service I build.

  • Actor model
  • Supervision
  • Gossip
  • CRDTs
  • Phi accrual failure detection
  • Sagas
  • TLA+

MLambda.OS: an embedded operating system

I am building an embedded operating system in freestanding Aleph: a Minix-style microkernel on RISC-V, with every driver, the file system and the shell as user-space servers that are restarted when they fail. It runs on a RISC-V machine I also wrote (RV64 with paging, interrupts and virtio devices). Above the drivers, machines are designed to join into one operating system on actors and the database, updated live, never by turning a machine off.

  • Microkernel
  • RISC-V
  • Freestanding Aleph
  • Virtio
  • User-space drivers
  • Live update

Hilbert.Tensor: tensors redefined from scratch

I redefined the tensor from scratch. A tensor is a term, not a buffer: an operation adds a node of mathematics to a lazy graph, so the graph can be rewritten by laws before it runs, and gradients come from the same calculus laws as the rest of Hilbert rather than a separate autograd. A cost-based planner decides per graph whether it runs at once on the host or is cut into fused kernels for the GPU, which are generated as LLVM IR and compiled by the system’s own driver. No BLAS, no CUDA library, no Python. When the planner landed, a quantum bond computation fell from 4 216 s to 0.375 s.

  • Lazy graphs
  • Einstein summation
  • Kernel fusion
  • Cost-based planning
  • GPU code generation
  • f64

Hilbert and Shin: mathematics and logic programming

Hilbert is the language where MLambda’s mathematics lives: a model is a set of laws, computing is rewriting by them, and the compiler turns them into native code. Shin is its logic-programming dialect: rules and facts with semi-naive forward chaining, tabled resolution, stratified negation, modal operators, aggregation and abduction. Every inference in every MLambda system, from the compiler’s platforms to a mail guard’s verdict, is a Shin rule.

  • Rewriting
  • Computer algebra
  • Proof kernel
  • Datalog and Prolog
  • Tabling
  • Stratified negation
  • Abduction

Turing: rational software

Turing builds software the way an architect does. A paragraph about a project becomes a backlog discovered level by level (context, sub-system, epic, feature, use case, story), every item judged by the architectural canon: TOGAF, the SEI’s quality attributes, Domain-Driven Design, UML. Only what is accepted is designed (the microservices, the domain model with its aggregates, the databases, the screens), and only what is designed is built. Language models propose; logic decides.

  • TOGAF
  • SEI quality attributes
  • DDD
  • UML
  • BDI agents
  • Domain modelling

Max and Neuron: BDI agents with a neural engine

Max is an agent language on the belief–desire–intention architecture: neural models perceive, and a logic theory derives what an agent is owed, licensed and has broken, so an agent cannot promise what its policy does not allow. Neuron is the neural engine under it: networks written as mathematics, models imported from PyTorch, GGUF, Keras, TFLite and ONNX, and run on Hilbert.Tensor on the GPU, from chat and speech to diffusion and 3D.

  • BDI agents
  • Deontic logic
  • Sortal lattices
  • Transformers
  • Diffusion
  • Speech
  • Model import

Design: prototypes, Aphrodite and side by side

I design the products as well as build them. Each one starts with research into how people work and a clickable prototype of every screen and state. The windows are written in Aphrodite, a UI language I created that draws the same component in a window, in a browser and in a terminal, and Playground proves each window against its prototype state by state, side by side and with a slider, until they match.

  • UX research
  • Prototyping
  • Design systems
  • UI languages
  • Visual regression

MLambda Science

A workbench for science and engineering in which every law and number comes from Hilbert, computed on the tensor engine: CAD parts, assemblies and simulation with fatigue and drawings; quantum circuits stepped gate by gate with their amplitudes, entanglement and Bloch vectors; chemistry, circuit boards and processors.

  • CAD
  • Kinematic simulation
  • Signed distance fields
  • Quantum circuits
  • Chemistry
  • GPU rendering

Genesis and the quality tools

Genesis holds the whole family: the languages, the runtime, the intelligence, the services and the applications (CRM, ERP, a service desk, an integration platform, Muse for marketing, logistics apps). Around them I built the tools that make quality and security the default: Tsadi derives the tests from a system’s model, Ayin judges the code (0 warnings, security A, reliability A, coverage of at least 95 %), Litush refactors until Ayin is satisfied, Katharsis drives every change from branch to tag, and Arkhos writes the infrastructure and deploys the microservices, watched by Helios.

  • Monorepo of submodules
  • Test derivation
  • Static analysis
  • Automated refactoring
  • Kubernetes
  • Observability

Across all of it

Aleph is where all of this is written now: the compilers, the runtime, the database, the services and the applications. What was once C# has been rewritten natively and moved aside. Every rule and every inference is a Shin theory, every formula is Hilbert, every screen is Aphrodite and every test is Dream. Earlier, Go came from years of production back-end work at TradeStation and a reactive framework of its own. The through-line is not the languages: it is compilers, type systems, formal verification, storage engines and distributed systems, the five things I keep coming back to.

Machine learning and neural networks run through the newer half of this work. Neuron runs language, vision, speech, diffusion and 3D models on the tensor engine I wrote, and Max puts them inside belief–desire–intention agents whose norms are derived by logic. The position behind both is the same: neural networks are extraordinary at acquiring content and poor at guaranteeing it, so the guarantee has to come from somewhere else.