Languages

Hilbert

The mathematics language: laws a reader can open, compiled to Aleph and computed on the GPU.

In use by every MLambda product

Hilbert

Hilbert is the language for everything in MLambda that is mathematics, science, rules or patterns. Aleph does the plumbing. Hilbert decides. A Hilbert library is compiled into Aleph by the Hilbert compiler, so a law written as mathematics runs as native code, and its bulk numbers run on Hilbert.Tensor on the GPU.

One language, several dialects

Dialect For
.hb Mathematics: models, laws, definitions, frames, tensors and Einstein summation
.hph Physics
.hc Chemistry
.hp Proofs, checked by a small trusted kernel
.hs Rules and facts, the Shin logic language: every inference in the family
.ha Agents (Max)
.hk Tasks and plans

Laws, not code

In Hilbert a model is a set of laws, and computing is rewriting by them. The compiler has no derivative of its own: differentiation is the laws of Calculus.hb, each one a line a mathematician can read.

model Calculus {
  law self        = ∂ x / ∂ x = 1
  law constant    = ∂ u / ∂ x = 0 where x ∉ u
  law product     = ∂ (u · v) / ∂ x = ∂ u / ∂ x · v + u · ∂ v / ∂ x
  law power       = ∂ (u^n) / ∂ x = n · u^(n − 1) · ∂ u / ∂ x where x ∉ n
  law sine        = ∂ sin(u) / ∂ x = cos(u) · ∂ u / ∂ x
  law hyperbolic  = ∂ tanh(u) / ∂ x = (1 − tanh(u) · tanh(u)) · ∂ u / ∂ x
}

∂ x² / ∂ x meets power, then self, then the arithmetic laws, and is 2x, and every step is a law that can be opened. That is also how networks get their gradients: nobody works them out by hand.

The compiler

The Hilbert compiler (MLambda.Hilbert.Compiler) reads a library’s .hb (its grammar is in MLambda.Grammar), inlines, folds and normalises it under its laws, and writes Aleph. A project runs it as a generator, so the mathematics is compiled with the program and never interpreted at run time. The proof kernel (MLambda.Math.Proof.Kernel) checks .hp proofs and is the trusted base.

The Prelude

Fifty-three libraries every project can name: arithmetic, calculus, linear algebra, integration, approximation, fitting, distributions, Bayes, inference, Markov chains, diffusions, jumps, kernels, clustering, neighbours, manifolds, graphs and their matrices, graph layout, networks, learning, gradients, evolution, genetics, decisions, deliberation, metrics and more. A product’s own maths sits beside it: the mail guard’s spam scores, the planner’s costs, Make’s retry delays, Helios’s series, Science’s physics and chemistry.

The guides

The documentation of the language is a book: what is a number, what is mathematics, what is infinity, thinking in transformations, functions as tensors, Einstein summation, tensor laws, physics, chemistry, materials, quantum, simulation, graphs, the Dirac equations and hyperspace calculus.

Where it is used

  • Shin: rules and every derivation of every service.
  • Tensor: all numeric work, batched and on the GPU.
  • Neuron: networks and models written as Hilbert maths.
  • Max: an agent’s norms are a Hilbert theory.
  • Science: CAD, simulation, quantum, chemistry and circuits.