eleph
A language whose programs cannot lie.
Speech acts, a history that is the only state, and correctness conditions
derived from the program text rather than written beside it.
Documentation ·
Install ·
Python API ·
Benchmark ·
Limits ·
Português ·
Español ·
中文
Isaac Mello, 2026. Implements and extends Elephant 2000, a programming
language based on speech acts specified by John McCarthy (Stanford, 6 November
1998) and never implemented by him. The design is his. The completeness
thresholds, the commitment obligations, the incremental runtime and the
embeddable API are this project's.
Why
An agent asserts things about a customer's record, and it promises to do
things. Today nothing connects either to reality. Output filters check the
text. Nothing checks whether an assertion follows from what actually happened,
and nothing tracks whether a promise was ever kept.
McCarthy's answer, written before the problem existed: make the program say
only what its own history supports, and make its promises debts it has to
settle. Two obligations, both his:
- An answer must be true. Every
yes or no must be entailed by the log.
- A promise must be kept. The program cannot promise what its history does
not establish, nor promise what no path through it could ever bring about.
You do not write these conditions. The compiler reads them off the program.
$ eleph obligations examples/airline_buggy.eleph
linha 17 question(Caller, has_reservation)
resposta yes e verdadeira
supondo alguma vez make_reservation(P, F)
entao (make_reservation(P, F) e desde entao nenhum cancel_reservation(P, F))
Then it tries to break them.
$ eleph check examples/airline_buggy.eleph
X question(Caller, has_reservation) linha 17 - resposta yes e verdadeira
historico que quebra a obrigacao:
1. make_reservation(P, F)
2. cancel_reservation(P, F)
o programa responde yes, a verdade do log e no
The bug is one word. The guard asks did they make a reservation where it
should ask do they have a reservation. Those are different questions and the
difference is the cancellation. This is McCarthy's own example, and the whole
language exists to make that difference impossible to overlook.
The past is the only state
There is no assignment in the grammar. This is not an omission. There is
nothing to assign to, because a fact is not stored, it is a query over what
happened:
fact has_reservation(P: Passenger, F: Flight) :=
make_reservation(P, F) since_not cancel_reservation(P, F)
An elephant never forgets. Nothing is overwritten, so nothing can drift out of
agreement with the truth. The program's own utterances go into the same log, so
it can be asked what it has already said:
if spoke accept to C about make_reservation(P, F):
decline C
Proof, not spot check
Bounded model checking answers a weaker question than we want: no history up
to length N breaks the obligation. For this language's fragment that gap
closes, because the truth of a formula at the end of a history depends only on
the order of the last occurrence of each atom. a since_not b is exactly
"there is an a after the final b". Any such configuration is realised by a
history with one position per atom, so a computable threshold
N = sum over distinct atoms of k(a), k(a) = 1, or n+1 under a count
makes "no counterexample found" mean "none exists". Each obligation is checked
at its own threshold:
PROVADO - 6 obrigacoes valem para TODO historico, de qualquer tamanho
This is not decoration. examples/fundo.eleph lies only after seven events,
and a fixed bound of six approves it:
$ eleph check examples/fundo.eleph --bound 6
SEM CONTRAEXEMPLO - dentro dos limites checados, que nao sao exaustivos aqui
$ eleph check examples/fundo.eleph
X question(C, elite) - resposta yes e verdadeira
1..7. make_reservation(P, F)
A formula that puts a compound expression under since_not leaves the linear
fragment. Completeness then comes from the monitor's state space, 2^k for k
temporal subformulas, which is exponential in principle and small in practice.
When even that is unaffordable the checker says the run was not exhaustive
rather than pretending.
Three claims, and the experiments that would break them