Skip to content

MLambda.AI#

MLambda.AI · samples you can read, run and prove

Artificial intelligence, written so you can check it.

Logic, agents, machine learning, reinforcement learning and the mathematics under them, each one real Hilbert source that the build compiles and checks, with a test asserting what it does. Nothing here is pseudocode, and a proof that stops checking stops the build.

3levels, novice to advanced
6subjects at every level
94theorems the kernel checks
404tests asserting behaviour
Animals.hs
theory Animals (Thing)
{
  def kind_of(narrow: Thing, wide: Thing)
  def known(who: Thing, kind: Thing)

  -- what you are told becomes what is so
  law directly = ∀ x k, known(x, k) ⇒ is_a(x, k)

  -- and classification climbs
  law climbing = ∀ x k w, is_a(x, k) ∧ kind_of(k, w) ⇒ is_a(x, w)

  query kinds(of: Thing, kind?: Thing) :- is_a(of, kind)
}
› What is fluffy?  cat, animal
  'animal' is in that list and nobody put it there.
› Proved  a_cat_is_an_animal
› Proved  classification_climbs_twice

How to use this site

Four steps. The first is short and every sample assumes it; the last is what the other three were for.

Why it matters

Four short essays, no code required: what it takes to put a thought into a machine, and why it is not a prompt.

Three levels

Every subject appears at each of them. A page is L1 because it is on the L1 shelf, so start where you are and climb.

Every subject, at every level

Read across a row to follow one subject from its first idea to its proofs, or down a column to take a whole level at once.

One language, four dialects

One compiler and one token set. Each file extension says a different kind of thing. Read the tour →

.hs

A theory: relations, Horn laws, queries. It becomes an engine you assert facts into and ask questions of.

.hp

Theorems over a theory, discharged by proof … qed and checked by a small kernel.

.ha

An agent: beliefs, desires, intentions, commitment, attention and plans.

.hb

Mathematics: formulas, models and processes over tensors and reals, lowered to code.

The capstone · read after L3

One house. Three agents. One verdict.

A buyer looks at a real house from 2 930 Ames sales. A valuation model, a condition model and a credit model each form a belief and an intention, and an adjudicator decides — with a veto, and a reserve that may refuse to exist.

ValuationAgent   +0.07 spreads over     → Buy
ConditionAgent   repair $17,523         → Negotiate
CreditAgent      default chance 30.40%  → Walk

Adjudicator      Walk. One agent seeing ruin
                 outranks two seeing a bargain.

Running the samples yourself. The Hilbert compilers are not on NuGet yet, so the repository builds against a sibling checkout of MLambda.Genesis. Clone both side by side, then dotnet build MLambda.AI.slnx and dotnet test MLambda.AI.slnx. Every sample page ends with the command that runs it.