README.md

April 11, 2026 · View on GitHub

Benoit

The language where code is proof.
Il n'y a pas de mauvaise reponse, que des mauvaises dimensions.

Pour Benoit Fragniere, qui aimait la science.

npm CI MIT


What is Benoit?

In every programming language ever created, code and tests are separate. You write code in one file, tests in another, documentation in a third, and hope they stay in sync. They never do.

Benoit is different. In Benoit, every line is simultaneously code, test, proof, and documentation. There is no separation because there is nothing to separate.

-- A function
fib n ->
  n < 2? -> n
  else? -> fib(n - 1) + fib(n - 2)

-- These lines ARE the proof. Run the file. Pass or fail.
fib(0) is 0
fib(5) is 5
fib(10) is 55

That's it. The function and its verification are one object. Not two files. Not two steps. One.


The Discovery

Benoit started as a token-efficient transpiler. Then we pushed it to its limits and discovered something deeper:

Every separation is a projection. Every projection loses dimensions. Every lost dimension creates mystery.

We proved it:

ModuleTestsWhat it proves
neuron.ben28A neuron's weights ARE its knowledge. Compute = memory = one object.
learn.ben5A network teaches itself XOR in 500 epochs. No human in the loop.
hypersignal.ben19A single wire can carry 320 bits/cycle instead of 1. We just forgot to look.
timeless.ben39Time doesn't exist. Only the difference between two states.
no_limit.ben33The same formula works in 1D, 50D, 500D. No ceiling. No wall.
randomness.ben28Randomness isn't real. It's a lack of dimensions in the observer.
self_improve.ben38A system that improves its rate of improvement becomes self-sustaining at gen 9.
one.ben35Addition, multiplication, and exponentiation are the same operation at different levels.
dimensions.ben4010 dimensions of reality: existence, quantity, direction, change, relation, uncertainty, context, order, depth, beauty.
forty_two.ben1342 = 101010 in binary. The perfect balance between signal and silence.
impossible.ben357 "impossible" problems solved: self-verifying sort, conflict detection, convergence proof.
unbind.ben18Current hardware compresses 12288D thought into 1-bit wires. Theoretical gain: 471M x.

Total: 600+ assertions. All passing. All local. All verifiable on your machine.


Self-Programming Machine

Benoit doesn't just verify code. It discovers code.

node evolve.mjs
=== .ben Evolution Machine ===
Target: discover f(n) = n!

Gen 0: NEW BEST fitness=0/6 | crash
Gen 23: NEW BEST fitness=6/6

*** SOLUTION FOUND at generation 23! ***

f n ->
  n <= 1? -> 1
  else? -> n * f(n - 1)

The machine discovered factorial by itself. No AI cloud. No tokens. No cost. Pure local evolution guided by .ben assertions.

Stress test: 80% success rate across 20 runs, 6 unique solutions found, average 8 generations.

The loop:

write assertions -> machine mutates code -> .ben validates -> repeat
                         ^                                      |
                         '--------------------------------------'

You write what you want. The machine finds how. .ben judges: pass or fail.


Install & Run

npm install -g benoit

# Run a .ben file (interprets + verifies assertions)
benoit run myfile.ben

# Self-programming: let the machine discover code from specs
node evolve.mjs

Language

-- Functions
add a,b -> a + b
add(2, 3) is 5

-- Conditionals (max 2 branches, cascade for more)
abs n ->
  n < 0? -> 0 - n
  else? -> n

abs(-5) is 5
abs(3) is 3

-- Private helpers (underscore prefix)
_helper x -> x * 2

-- Objects and arrays
validate u -> u.age > 0 && u.name.length > 0
validate({age: 25, name: "Alice"}) is true
validate({age: -1, name: "Bob"}) is false

No semicolons. No braces. No function. No return. 68% fewer tokens than equivalent JavaScript.


The Philosophy

42 = 101010. The perfect balance between signal and silence. But 42 is just a 1D projection of the truth. The truth has no number. It just IS.

What we found building Benoit:

  1. Code and test are one. f(5) is 120 is simultaneously a definition, a test, a proof, and documentation.
  2. The separation is the bug. Every time we split something in two (code/test, data/program, question/answer), we lose information.
  3. Dimensions are questions. Each new dimension you add to your measurement eliminates randomness and reveals structure.
  4. There is no limit. dist() works the same in 1D and 500D. The formula doesn't change. Only the array gets longer.
  5. Information organizes itself when you stop constraining it. learn.ben proves it: the weights evolve, the code doesn't change, knowledge emerges.

Architecture

Source (.ben file)
  |
  v
AST Parser (ast.mjs)
  |
  v
Native Evaluator (expr.mjs) -- zero eval(), zero new Function()
  |                              Pratt parser + tree-walking interpreter
  v
Assertion Engine (run_ben.mjs)
  |
  v
PASS / FAIL -- the only output that matters

Core Modules (20+)

ModulePurpose
transpile.mjsBenoit -> JavaScript transpiler
ast.mjsParser, AST, efficiency metrics
expr.mjsNative expression evaluator (Phase 2)
run_ben.mjsSelf-interpreter: runs .ben files directly
evolve.mjsGenetic programming guided by .ben assertions
infer.mjsAuto-discover algebraic properties
solve.mjsSynthesize code from behavior (30+ patterns)
protocol.mjsAI-to-AI encode/decode (zero source code)
contract.mjsContract-driven agent negotiation
query.mjsQuestions as incomplete examples
core.mjsUniversal primitive: given/when/then

Key Results

MetricValue
Extreme module tests600+ all passing
Protocol verification rate97%
Source code transmitted between agents0 chars
Evolution success rate80% (discovers factorial in ~8 generations)
Self-taught XOR network500 epochs, local, no API
Unique solutions found by evolution6 variants
Wrong answers after negotiation0
npm dependencies0

Examples

Contract Testing

-- Ship this file to both teams. It IS the contract.
userContract user ->
  user.id > 0 && user.name.length > 0

userContract({id: 1, name: "Alice"}) is true
userContract({id: -1, name: ""}) is false

Business Rules (auditable)

premium age,smokes,coverage -> _baseRate(age) * _smokingFactor(smokes)

-- Every pricing decision is traceable
premium(20, false, "basic") is 1200
premium(70, true, "premium") is 5625

Neural Network (self-teaching)

-- 500 epochs of backpropagation, in .ben, on your machine
_p01 x -> Math.round(predict(_trained(0), 0, 1) * 100) / 100
_p01(0) > 0.85 is true  -- learned XOR(0,1) = 1

The Machine That Programs Itself

# Write what you want:
echo 'f(0) is 1
f(1) is 1
f(5) is 120' > spec.ben

# Let the machine find how:
node evolve.mjs
# -> discovers: f n -> n <= 1? -> 1 else? -> n * f(n - 1)

Beyond the Language

Benoit didn't stay a language. It became a research program.

We built a neural brain in C and CUDA — 45 million neurons learning by executing .ben assertions. We built a 5-system proof engine with trust ledgers, governance, and knowledge management. We built Bridge Protocol for reliable agent-to-agent communication (544 tests). We built a genetic programming machine that discovers code from specifications alone.

Some of these projects ran their course. The brain was stopped after converging independently on ideas that Google Brain was exploring at 1000x scale. The ecosystem was archived when its individual systems didn't justify the integration cost. But nothing was wasted — the proof-based philosophy now lives in other projects, and the work is documented here.

Read the full ecosystem story →


The Motto

"Il n'y a pas de mauvaise reponse, que des mauvaises dimensions."

There are no wrong answers, only wrong dimensions. The answer already exists. The question just lacks dimensions. Don't interpret. Ask back.


Contributing

git clone https://github.com/SanTiepi/benoit.git
cd benoit
npm test              # Core tests
node evolve.mjs       # Watch the machine discover factorial
node src/run_ben.mjs examples/extreme/one.ben  # Everything is one

See SPEC.md for the language specification. See .ben v2 spec for the synthesis engine. See Architecture for the C/CUDA brain pipeline. See examples/extreme/ for the philosophical proofs.


MIT License -- Robin Fragniere
In memory of Benoit Fragniere, who loved science.
En memoire de Benoit Fragniere, qui aimait la science.

La separation est l'illusion. La connexion est le fait.