DEAL

A contract-first programming language designed for AI-authored code. AI systems fail not at writing code, but at the free-text channel to it: hallucinations live where an AI can write something “plausible” and it ends up somewhere real. DEAL removes the channel: an AI submits verifiable transformations over a canonical AST, and the compiler is the only thing that ever touches the code, judging every transaction mechanically.

canonical AST — single source of truth projection is printed, never written witnesses instead of faith refusals are always verbal

Example in 60 seconds

A human reads the projection — a deterministic print of the AST, one form for everyone:

сделка деление(а: число, б: число) -> число
  тело:
    если б == 0:
      стой отказ деление_на_ноль
    верни а / б
  свидетель:
    а=100000, б=4 -> 25000.0
    а=100000, б=0 -> отказ деление_на_ноль

сделка цена_за_единицу(месячный: число, человек: число) -> число
  тело:
    цена = деление(месячный, человек)
    верни округлено(цена, 2)
  свидетель:
    месячный=100000, человек=4 -> 25000.0
    месячный=100000, человек=0 -> отказ деление_на_ноль
    месячный=0, человек=4 -> 0.0
{
 "файл": "цена_за_единицу",
 "сделки": [
  {
   "имя": "деление",
   "входы": [
    {
     "имя": "а",
     "тип": "число"
    },
    {
     "имя": "б",
     "тип": "число"
    }
   ],
   "выход": "число",
   "тело": [
    {
     "оп": "если",
     "условие": {
      "оп": "сравнение",
      "чем": "==",
      "лево": {
       "оп": "поле",
       "имя": "б"
      },
      "право": {
       "оп": "константа",
       "значение": 0
      }
     },
     "то": [
      {
       "оп": "стой",
       "отказ": "деление_на_ноль"
      }
     ],
     "иначе": []
    },
    {
     "оп": "верни",
     "что": {
      "оп": "арифметика",
      "чем": "/",
      "лево": {
       "оп": "поле",
       "имя": "а"
      },
      "право": {
       "оп": "поле",
       "имя": "б"
      }
     }
    }
   ],
   "свидетель": [
    {
     "вход": {
      "а": 100000,
      "б": 4
     },
     "выход": 25000.0
    },
    {
     "вход": {
      "а": 100000,
      "б": 0
     },
     "отказ": "деление_на_ноль"
    }
   ]
  },
  {
   "имя": "цена_за_единицу",
   "…": "…"
  }
 ]
}

Left — the projection (readable view); right — the canonical AST (stored in the .deal file, the single source of truth). The AI works through transformations, not text: introduce-deal → add-case → replace-body; every step is either judged by the machine or refused verbally. In this chain there is nowhere to type “looks about right”.

The keywords and field names are Russian by canon: the language fixes one spelling of every construct, and these are it — the AST is the single source of truth, the projection is its deterministic print. The keyword set is documented in full in the Syntax section; the semantics tables below read it into English.


The compiler — eight stages

 AI transformation (an atomic AST operation)
     |
     v
[1] FORM         — the operation comes from the closed set, fields complete
[2] COMPLETENESS — the contract is full: name/inputs/body/witness
[3] FEASIBILITY  — calls exist, fields declared before use
[4] WITNESS RUN  — the VM drives the cases, including hidden edges
[5] SERIAL HASH  — deterministic AST serialization -> sha256
[6] CHRONICLE    — before->after (history cannot be shortened)
[7] REGISTRY     — who submitted, when, what was refused
[8] ISSUE        — component + projection + court protocol

Every refusal is verbal: {stage, culprit, cause, what_to_fix}. The AI fixes itself by the words, without a human.


Properties — each with a mechanism

Decompilation always, losslessly

The DEAL source is the AST; “to decompile” means “to print”. Lose the projection — it reprints in seconds.

Canon

One spelling, one encoding (utf-8), one form of every construct — the classic disease of “two judges, two encodings” disappears by construction.

Address = hash of the contract

Components recognise each other by content, not paths. Loose dependencies are impossible.

Chronicle in the runtime

Every transformation is recorded as before→after; history cannot be shortened.

Verdicts are machine-made

A witness verdict is always computed — cases executed in a sandbox — never read.

Refusals are always verbal

Culprit, cause, what to fix — at every stage, no silent voids.

Export modes

Transparent .deal or native binary without the AST — per component; the AST always stays with the owner.


Status — a live pilot

The language is not just designed — it runs. The pilot closed stages 0–3 (Python VM → DEAL→DEAL self-compilation, byte-for-byte against a golden corpus) and is running stage 4: the x86-64 emitter is itself written in DEAL. The numbers are honest in both directions: on three independent 20M-element kernels DEAL-native is faster than Rust on one (×0.83) and slower on two (×1.7–2.5); the 81.92M-element reduction is ×1350+ faster than a pure Python loop (×1.56 vs Rust). The native backend is not published — pilot figures, the methodology is named in the benchmark. The compiler, VM and components are in Download — runnable by hand.