Elinvar: design
Status: current, 2026-11-29. Phases 1 to 5 and bounded integers are built.
Companions: REQUIREMENTS.md (what Elinvar must do; R numbers refer to it),
LOGIC.md (the relational logic and its meaning),
CORPUS.md (the models checked against Alloy),
AGENTS.md (the laws)
Upstream reference: Alloy 6.2.0 (59ba203), Kodkod (6e80244), Pardinus 1.2.4 (d3e7aea)
Elinvar is an alloy whose springiness stays the same as it warms and cools. This tool checks what must stay the same in a design: its invariants. Its first end-to-end test is the hole in the README’s sharing app: share an item, end the follow, leave a note. Three steps, found from three rules and one promise.
Contents: 1 Vision · 2 Landscape · 3 Principles · 4 Users · 5 Architecture · 6 The relational core · 7 Finding · 8 Time · 9 Front doors · 10 Verification · 11 Roadmap · 12 Risks · 13 Decisions and open questions · 14 Naming and licensing
1. Vision
Elinvar answers one question about a design: can this promise break, and if so, how? It searches every case up to a chosen size and either finds none that breaks the promise, or returns the shortest story of how it breaks.
It is built for agents first (section 13, 2026-11-28). A coding agent that is asked to add sharing to an app writes the rules and the promise, runs one command, and reads back either “holds for every case up to this size” or three steps it can act on. Then it fixes the design and runs the command again. People use the same doors; nothing is possible only for one of them.
Near term, Elinvar rebuilds the core of Alloy and its engine Kodkod in Rust: relational logic with bounds, turned into a satisfiability problem. The core follows theirs closely enough that its answers can be compared with Alloy’s on the same models (CORPUS.md), and that comparison is a large part of why its answers can be trusted.
Past the core it goes where Alloy does not: one binary with no Java, results
as data, the smallest counterexample instead of the first, checks that run in
cargo test, a helper for what a step leaves unchanged, and later a model
read from a database schema (REQUIREMENTS.md section 8).
What it does not do: prove a promise for every size, or check code. It checks the design that was described, up to the size that was set, and every answer says so.
2. Landscape
Rows about Alloy are checked against the pinned source. The other rows are from memory, unchecked (AGENTS.md law 5), as of 2026-11-28.
| Project | Stack | Strength | Gap Elinvar targets |
|---|---|---|---|
| Alloy 6, with Kodkod and Pardinus | Java | the language, the logic, twenty years of models and teaching; a visualizer; a command line and a language server in the repository (org.alloytools.alloy.cli, org.alloytools.alloy.lsp) | needs a Java runtime; shows the first counterexample found, not the smallest; models live apart from the code; output is made for a person at a window |
| TLA+ with TLC, and Apalache | Java, Scala | state machines and refinement, used in industry | a different logic, built around actions and not around relations; Java |
| Quint | TypeScript, over TLA+ tools | syntax programmers find familiar | the engines behind it are the ones above |
| Forge | Racket | teaching, with a relational logic close to Alloy’s | not built to be embedded or driven by an agent |
| stateright | Rust | explicit-state checking of actor systems written in Rust | checks an executable model by running it, not a relational description by solving |
| Kani, Prusti, Creusot | Rust | verify Rust code | check code, not designs |
Two conclusions.
First, the relational logic of Alloy is the right core, and nobody needs a new one. What is missing is a form of it that an agent can call the way it calls a compiler: one binary, text in, data out, the same answer every time.
Second, agents already read and write Alloy. Its syntax is in their training data. So the text form of a model should be Alloy’s own (section 9.4), not a new language they would have to be taught in a prompt.
3. Principles
- Agents are the first users. Every input has a schema or a grammar, every output is data with a version, nothing fails silently, nothing hangs, and nothing an agent sends can execute code.
- Trust before reach. A checker that is wrong says “no holes” when there are some. The evaluator referees every instance (R15), brute force checks tiny cases (R18), the corpus checks agreement with Alloy (R16), and planted holes check that known holes are found (R17). A feature that cannot be tested this way waits.
- One engine, many doors. The engine is a library.
cargo test, the command line, and the MCP server are clients of the same calls and the same result types. - An answer says what it covers. “Holds” means “holds for every case up to
this size”, and the size is in the result. Out of budget is
unknown. A check whose rules allow nothing says that, not “holds”. - Inspired, not ported. The core follows Alloy and Kodkod so answers can be compared. Everything else is designed fresh, in Rust, from the documents.
- Small counterexamples. A hole is shown with the fewest steps and the fewest things that still show it, as a story of what happened.
- Same input, same output. The same model and scope give the same verdict and the same instance on every run and machine (R14).
- Own the public surface. Public signatures contain Elinvar and
stdtypes only. The solver, and any other pre-1.0 dependency, sits behind an internal module. - Rule of two. An extension point gets a public trait when it has two real implementations. The solver trait is the exception R9 asks for.
- Simple things simple. A check is one call. Building a model never fails halfway: errors are collected and reported together, each with its place.
- Rust only, and
cargoalone builds it. No Java, Python, or C toolchain (R28). - Speed is not a first goal (R29). It is measured, so a slowdown is seen, and it never buys back any of the above.
4. Users
| User | Front door | What they need |
|---|---|---|
| Coding agent designing a data model, a permission system, or a protocol | elinvar check with --json; the MCP server | Alloy syntax it already knows, one call per check, a verdict as data, a short story to act on, codes with fixes, a budget |
| Coding agent in a Rust project | the elinvar crate in cargo test | a model beside the code, a failure message that is the counterexample |
| Developer | the same two doors | the same, read by eye |
| Research or review agent | results as JSON, elinvar eval | to ask what a relation holds in a state, compare runs, keep records |
| Tool builder | elinvar-logic, the result schemas | stable types and formats that do not churn |
5. Architecture
5.1 Layers
cargo test (Rust model) elinvar check model.als --json agents over MCP
| | |
+------------ the same calls and result types --------------+
|
elinvar: the engine -------------------+------------------------------------
model builder, scopes to bounds, time unrolled into steps
skolemize -> circuit -> clauses -> solver (behind a trait)
symmetry breaking, next instance, shrinking, stories
|
every instance goes back down to be refereed (R15)
|
elinvar-logic: the relational core -----------------------------------------
atoms, tuples, relations, bounds, expressions, formulas,
instances and traces, the evaluator, brute-force enumeration
5.2 Crates
Decided 2026-11-28 (section 13); this answers open decision 6 of REQUIREMENTS.md.
| Crate | Role | From phase |
|---|---|---|
elinvar-logic | the relational core: universe, relations, bounds, the syntax tree, instances, traces, the evaluator, and brute-force enumeration | 1 |
elinvar-engine | the engine: the model builder, translation, the solver trait and the default solver, symmetry breaking, run and check, time, shrinking, stories. It re-exports elinvar-logic as logic and its common items in prelude | 2 |
elinvar-als | reads Alloy text into a model: parser, name resolution, the type and arity check, scopes | 5 |
elinvar | the facade and the elinvar binary: re-exports elinvar-engine and elinvar-als (as elinvar::als), and holds check, run, eval, explain, serve --mcp, and the other verbs in its cli module. The one crate a user depends on or installs | 5 |
elinvar-macros | a macro or derive for models, only if the builder turns out noisy (R23) | 4, if needed |
xtask | the cargo x verbs; never published | 0 |
Why two library crates and not one: the split is the trust boundary. The
referee must not be able to call what it referees (AGENTS.md law 12), and a
crate boundary is the one module boundary the compiler enforces. Nothing
else is split until something needs it: translation, solving, and time are
private modules of elinvar-engine. The facade is a crate of its own so that
the crate a user names, elinvar, is both the library and the binary
(section 13, 2026-12-03).
Public paths and source layout:
- A crate’s public API is the
pub uselist in itslib.rs. Source directories are private modules, so moving code between them never changes a public path. elinvarre-exportselinvar-engine, and through itelinvar-logicaselinvar::logicand the common building types inelinvar::prelude, andelinvar-alsaselinvar::als, so a user needs one crate.- White-box tests stay inline in their module. Spec tests that drive a crate
live in
tests/, and corpus models incorpus/at the workspace root (CORPUS.md section 3).
5.3 Dependencies
elinvar-logicdepends onserdeand on no other Elinvar crate.elinvar-enginedepends onelinvar-logicandserde. Its bit-sliced SIMD brute-force counter (bitslice.rs) usesmacerator(pinned exactly, pre-1.0) behind the optionalbitslicefeature, enabled for workspace tests and off by default for downstream dependents;elinvarpasses on a feature of the same name. The default solver (Cdcl) is written insideelinvar-enginewith no external solver dependency.elinvar-alsdepends onelinvar-engine.elinvardepends on both, and onrayonandserde_jsonfor its command line.- The libraries do no I/O. Only the
climodule ofelinvarand its binary read files and stdin, and nothing touches the network. - No crate in the workspace needs a C toolchain.
cargo denybanscc,cmake,bindgen, andpkg-config(AGENTS.md law 6).
6. The relational core
Phase 1, R1 to R7. LOGIC.md is the specification: every operator’s arity rule and meaning, the error codes, and hand-worked examples that are tests. This section gives the shape and the reasons.
6.1 Atoms and tuples
A universe is a finite, ordered list of named atoms (R1). An atom is its
position in that list. A tuple of arity k is k atoms, and it has an index:
its atoms read as the digits of a number in base n, the size of the
universe. A set of tuples is a sorted set of indices. This is Kodkod’s
scheme (kodkod/instance/TupleFactory.java, IntTuple, and
kodkod/instance/TupleSet.java); the reason to share it is that tuple order
then fixes variable order (section 7.8).
6.2 Relations, bounds and instances
A relation has a name and an arity of one or more; a set is a relation of arity one (R2). Bounds give each relation a lower bound, the tuples it must hold, and an upper bound, the tuples it may hold (R3). An instance gives each relation a set of tuples between its bounds.
Atoms never appear in a formula. A formula that needs “this atom” names a relation whose bounds fix it to that atom. Symmetry detection depends on this: the bounds are then the only place two atoms can be told apart (section 7.5).
Sets with a size limit (R11), subsets, and “exactly one of” are not core
notions. The model builder in elinvar-engine turns them into bounds and formulas.
6.3 Expressions and formulas
The operators are those of R4 and R5 (LOGIC.md sections 3 and 4). Two
differ from Kodkod’s list, on purpose: domain and range restriction are core
operators, and the quantifiers no, one, and lone are core, where Alloy
rewrites them before Kodkod sees them (LOGIC.md section 10). They are
core so the evaluator computes what the user wrote, not a rewriting of it.
An expression or a formula is an immutable value, cheap to clone and share
between threads. Building one is a method call with no context argument:
a.join(&b), f.and(&g). The translator finds equal subterms by structure
and translates each once (R8).
6.4 Errors at build time
Rust’s types catch one class of mistake at compile time: an expression is
not a formula, so some cannot be applied to a formula and and cannot
take a set. They cannot catch an arity mismatch in general, because the
arity of a join is a sum of two arities minus two, and stable Rust cannot
compute that in a type. So arity is checked when a node is built (R6).
Building never fails (principle 10). A method that would make an
ill-formed node records the error, with the file and line of the caller
(#[track_caller]), and returns a node that carries it. run and check
refuse a model with errors and return all of them together. For a model
written in Rust the place is the line of Rust that built the node; for a
model read from text it is the line and column of the text.
Whether typed handles for sets and binary relations can catch more at compile time and still read well is a phase 4 question (section 13).
6.5 The evaluator
Given an instance, the evaluator computes any expression to a set of tuples and any formula to true or false, with no solver (R7). It follows the definitions in LOGIC.md one for one: a quantifier is a loop, a closure is repeated until nothing changes. It is the referee for everything else (R15), so it is kept slow and plain on purpose (AGENTS.md law 12).
elinvar-logic also enumerates every instance within given bounds, for tiny
universes (R18). With the evaluator, that gives the count of instances that
satisfy a formula with no solver involved. Phase 1 checks those counts
against known numbers: six total orders on three atoms, fifteen equivalence
relations on four (LOGIC.md section 8).
7. Finding
Phase 2, R8 to R18. Each step below is specified in LOGIC.md section 12;
this section fixes the design. Upstream citations refer to the pinned commits
(cargo x fetch).
formula + bounds
| skolemize: a top-level "some" becomes a fresh relation
v
circuit: one boolean value per (relation, tuple); shared gates
| symmetry-breaking predicate, added as one more conjunct
v
clauses in conjunctive normal form
| solver, behind a trait, with a budget
v
model of the clauses -> instance -> referee -> verdict
7.1 From formula to circuit
Each relation becomes a table with one boolean value per tuple of its upper
bound: true if the tuple is in the lower bound, otherwise a fresh variable.
Each expression becomes such a table, computed from its parts: union is or
entry by entry, join is a boolean matrix product, transitive closure is
repeated squaring. Each formula becomes one boolean value. A quantifier is
grounded: all x: e | F is the conjunction, over the tuples t that e
may hold, of “t is in e implies F with x bound to t”.
Gates are and, or, not, and if-then-else, built through one factory
that simplifies constants and returns the existing gate when asked for one
it has already built. That is where shared subterms come from (R8): a node
of the formula met twice, with the same bindings for its free variables,
gives the same gate.
7.2 Skolemization
A some that is not inside an all is replaced by a fresh relation, bounded
by what its declaration may hold, and the constraint that the relation is in
the declared set. The witness then shows up in the instance by name, which
is how a counterexample says which person and which item. This is also what
makes a some over sets or relations checkable at all (REQUIREMENTS.md
section 6): check negates an assertion, so all r: univ->univ | ...
becomes a some, and that is how the first Alloy exercises are written
(CORPUS.md section 2).
A some inside an all is grounded, not skolemized. That matches Alloy’s
default (skolemDepth = 0 in A4Options.java). A quantifier over sets or
relations that skolemization cannot remove is an error with a code, not a
silent approximation.
“Not inside an all” is not the whole of Kodkod’s rule, and the rest
matters, because a skolem relation is part of an instance and so of every
count (section 7.7). At depth 0 the skolemizer in Alloy’s copy of
Pardinus replaces a some only where the formula around it must hold as a
whole. It stops below iff, below or and implies where they are not
negated, below and where it is negated, and below every temporal operator
(Skolemizer.java, the visit methods for BinaryFormula, NaryFormula,
and the temporal formulas). Under a negation the roles swap: an all is
replaced, and or lets it through. Phase 2 specifies the same rule in
LOGIC.md, position by position, before it is coded. How counts are compared
when Alloy’s rewriting of no, one, and lone puts a quantifier where
Elinvar has none is open (section 13).
7.3 From circuit to clauses
Each gate gets a variable, and clauses relate the variable to the gate using
polarity-aware Plaisted-Greenbaum encoding (LOGIC.md section 12.4):
monotone gates (and, or, maj) emit only the polarity directions their
callers need, while ite and xor emit both polarities where needed.
7.4 The solver
The solver sits behind a trait Elinvar owns (R9):
pub trait Solver {
fn new_var(&mut self) -> Var;
fn add_clause(&mut self, clause: &[Lit]);
/// Solves under assumptions. `Unknown` when the budget runs out.
fn solve(&mut self, assumptions: &[Lit], budget: &Budget) -> Solved;
/// The value of a variable in the model, after `Solved::Sat`.
fn value(&self, var: Var) -> bool;
/// Total conflicts spent by this solver, for statistics (defaults to `0`).
fn conflicts(&self) -> u64 { 0 }
/// After `Solved::Unsat`, a subset of the assumptions that derived UNSAT.
fn unsat_core(&self) -> Vec<Lit> { Vec::new() }
}
Assumptions are in the trait from the start because three things need them:
the next instance (R13), shrinking (R25), and later the explanation of “no
counterexample” from an unsatisfiable core. Callers plug in an external
Solver through Finder::with_solver, run_with_solver,
check_with_solver, count_with_solver, Command::solve_with, and
Command::report_with; every instance or trace returned through a plugged-in
solver is still refereed by elinvar-logic (R15).
The default must be pure Rust (R9, R28), deterministic (R14), and under a
license cargo deny accepts. The candidates of REQUIREMENTS.md open
decision 3, as crates.io shows them on 2026-11-28:
| Crate | Newest release | License | Reading |
|---|---|---|---|
batsat | 0.6.0, 2025-01-20 | MIT | a port of MiniSat to Rust; small; recommended |
splr | 0.19.0, 2026-08-22 | MPL-2.0 | maintained and modern, but its license is outside the allowed list |
varisat | 0.2.2, 2020-09-09 | MIT or Apache-2.0 | no release in six years |
rustsat | 0.7.5, 2026-01-30 | MIT | a common interface and encodings, not a solver; its pure Rust backend, rustsat-batsat, wraps batsat, and its MiniSat and CaDiCaL backends compile C++ |
Decided on 2026-11-28: Elinvar’s own solver (sat::Cdcl), behind the trait,
and not batsat; the table is kept as the record of what was considered.
rustsat is not the public interface, since that would put a pre-1.0
third-party trait in Elinvar’s signatures (principle 8). The
in-tree solver supports assumptions and conflict/time budgets, stays usable
after a budget stop (tested in sat::tests), and uses only deterministic
arithmetic with ties broken by lowest variable index so the same clauses give
the same model across platforms.
A faster solver written in C is plugged in from outside the workspace: a
crate that implements Solver, which may well go through rustsat. The
determinism promise (R14) covers the default solver only.
7.5 Symmetry breaking
Two atoms are interchangeable when no bound tells them apart. Kodkod finds
the coarsest partition of the universe such that every bound is a union of
products of its parts (SymmetryDetector.java), and adds a predicate that,
for each pair of neighbouring atoms in a part, requires the instance to be
no larger than its image under swapping them, comparing at most 20 values
per pair (SymmetryBreaker.java, generateSBP; symmetryBreaking = 20 in
Options.java, and symmetry = 20 in Alloy’s A4Options.java). Elinvar
does the same, on by default, with a switch (R12).
The predicate removes many renamed copies of an instance but not all of them, so a count of instances means something only with symmetry breaking off. That is the setting the corpus counts under (R16).
Kodkod also breaks the symmetries of relations declared to be total orders
or acyclic by fixing their value (SymmetryBreaker.java, breakTotalOrder,
breakAcyclic). For a total order it gives the order, its first, and its
last exact bounds that follow the order of the atoms. That step does not
depend on the symmetry option: in Alloy’s copy of Pardinus, Translator.java calls
breakMatrixSymmetries whatever symmetryBreaking is, and only
generateSBP returns early at 0. Alloy does the same to util/ordering
itself before Kodkod runs (TranslateAlloyToKodkod.java, simplify). So
with symmetry breaking off, Alloy still counts one order, not every order.
Elinvar therefore needs two things at two times. In phase 2 a corpus model
that opens util/ordering is translated by hand, and the translation gives
the order exact bounds in atom order, which is what Alloy solves. Finding a
total order in a model and fixing it without being told is needed when
Elinvar reads util/ordering itself, in phase 5, and not before.
The predicate must not constrain shrinking (section 9.6).
7.6 Verdicts and budgets
run looks for an instance of a formula. check looks for an instance of
the rules together with the negation of an assertion: a counterexample
(R10). Both return a verdict, and a verdict never claims more than it knows
(AGENTS.md law 14):
| Verdict | From | Meaning |
|---|---|---|
found | run | an instance, refereed |
none | run | no instance up to this scope |
counterexample | check | an instance that breaks the promise, refereed and shrunk |
holds | check | no counterexample up to this scope, and the rules allow at least one case |
vacuous | check | no counterexample up to this scope, because the rules allow no case within it |
unknown | both | the budget ran out; says which budget and how far it got |
vacuous costs one more solve, of the rules without the negated assertion,
and only when no counterexample was found. It is there for agents: a model
whose rules contradict each other passes every check, and an agent that sees
“holds” will report that the design is sound. This is new relative to
REQUIREMENTS.md; its section 8 has the larger form, explaining which rules
did the work.
vacuous is scoped like every verdict: with time, it says no trace of the
rules exists within this scope and this many steps. A larger scope may
allow one.
diff gives equivalent, tightened, loosened, diverged, or
unknown, from two checks: each model’s rules against the other’s. A
model’s rules include what its bounds alone say, such as that a one set
has exactly one atom. diff --of compares two functions over the cases
both models allow; when they allow none, its verdict is vacuous, never
equivalent. Two whole models that each allow no case are equivalent,
which is true of them.
If the first solve shows there is no counterexample and the second runs out
of budget, the verdict is unknown, and it says what is known: no
counterexample up to this scope, and whether the rules allow any case not
settled. It is not holds, which would claim the second half (AGENTS.md
law 14).
Every verdict carries the scope it was computed for. A budget is a count of
solver conflicts, which is deterministic, or a time limit, which is not, or
both. A time limit can only turn an answer into unknown (AGENTS.md law 17).
There is always a budget: the default is generous and finite (AGENTS.md
law 22). Both apply to each solve. A command makes several, the check, the
solve for vacuous, and shrinking among them, so it can take a few times
its time limit, but each part ends. Shrinking takes no time limit, only its
own conflict budget (LOGIC.md section 14.3):
stopping it on time would return a less shrunk instance on a slower
machine. A command with a short time limit and a large scope can therefore
spend longer shrinking than solving (decided 2026-12-02, section 13).
What comes before the first solve is bounded by size, not by time: each
possible tuple of a relation is a solver variable, so a command whose
relations have more than 2^24 possible tuples in all, such as one of arity 6
at a scope of 30, is refused with model.scope_too_large before any bound
is built, as one with more than 4096 atoms is.
7.7 More instances
The next instance (R13) is found by adding one clause that rules out the
last one: not all of the relation variables take these values again. The
clause covers the variables of relations, skolem relations included, and
not the variables of gates. Alloy enumerates the same way: A4Solution.java
calls solveAll on its bundled Pardinus, whose clause covers every primary
variable, those of skolem relations among them (ExtendedSolver.java,
nextNonTrivialSolution). Two instances that differ only in a witness are
therefore two instances on both sides.
7.8 Determinism
The same model and scope give the same verdict and the same instance everywhere (R14). That needs every step to be a function of its input:
- Relations are numbered in the order they were declared, and a relation’s variables in the order of its tuples.
- Gates are numbered in the order they are first built, and the translation walks a formula in a fixed order.
- Clauses are added in gate order. The symmetry predicate and blocking clauses come last, in a fixed order.
- No collection on a result path iterates in hash order (AGENTS.md law 16).
- The default solver runs with a fixed seed, one thread, and no time-based decision. Separate solves may run on separate threads, as the command line runs a file’s commands and the comparison with Alloy runs the corpus’s, because each result depends on its own command alone and the results are reported in a fixed order; two threads never share one solve.
- Shrinking tries its candidates in a fixed order (section 9.6).
The check: the corpus’s first instances and their order are golden files, compared on the three CI platforms.
7.9 Slicing
Before a check is solved whole, Elinvar tries to solve a smaller problem
that gives the same verdict: the cone of influence of the assertion
(coi.rs). It starts from the relations the assertion names and adds
every fact that mentions one of them, and every step of the transition
fact that can change one of them, until nothing more is added. The rest is
dropped, and solved apart only to show that it allows some case, so that
holds is never reported where the dropped part is empty.
The argument is that every trace of the whole model projects onto a trace of the slice and back. It needs each dropped step to leave every kept relation unchanged, so what a step leaves unchanged is read exactly:
R' = RfixesR.all x: D | x.f' = x.ffixesfonly whenDis a fixed relation and a fact typesfasf in D -> ..., so that no row offlies outsideDin either state. It never fixesDitself.- Anything else fixes nothing: a frame over part of
f’s domain, a frame over a changingD, and a one-rowp.f' = p.finsidesome p | ...each leave the other rows offfree, so the step writesf.
A frame read as fixing more than it does once gave a wrong holds; each
such model is a planted hole (CORPUS.md section 5).
Slicing can be switched off (Options::slicing, --no-slicing on check
and diff). Symmetry breaking (Options::symmetry_breaking,
Options::predicate_length, --symmetry N / --no-symmetry) and Alloy’s
noOverflow (Options::no_overflow, --no-overflow) are exposed on check,
run, and diff (and MCP). Off, every check is solved whole, and so are diff’s
reductions of a transition fact. That is the reference answer: a test
draws small temporal models from a seeded generator over these frame
shapes and requires the same verdict with slicing on and off, and no
proved where the whole problem has a counterexample
(crates/elinvar-als/tests/slicing.rs).
8. Time
Phase 3, R19 to R22. Specified in LOGIC.md before it is coded (LOGIC.md section 11).
8.1 Traces
A relation is fixed or changing (R19). A trace is a finite list of states,
each an instance of the changing relations, with a loop from the last state
back to one of the states: a lasso (R21). Read as an infinite sequence that
repeats its loop for ever, it gives every temporal formula a plain meaning,
and that reading is the definition. Pardinus assumes the same: “traces are
assumed to always loop” (TemporalTranslator.java).
The limit on steps is part of the scope (for 3 but 6 steps). Alloy’s
default is 10 (ScopeComputer.java, maxtrace).
8.2 Temporal formulas
The operators are those of R20: always, eventually, after, until,
releases; the past operators before, historically, once, since,
triggered; and the prime, for the value of an expression in the next
state. triggered, the past form of releases, is in Alloy 6 (Alloy.lex;
TemporalOperator.java in Pardinus) and was added to R20 on 2026-11-28, so
that Alloy’s temporal models can be read unchanged
(section 13).
The evaluator gets its own direct reading of these on a lasso, written from the definition and sharing nothing with the translation. A counterexample trace is refereed like any other instance (R15).
8.3 Translation
Start where Alloy 6 does (REQUIREMENTS.md open decision 5): unroll. For each trace length from 1 up to the limit, build the static problem “a lasso of this length satisfies the formula” and solve it. The shortest counterexample in steps is then the first one found.
Pardinus builds that static problem inside the relational logic: it adds
state atoms, gives every changing relation one more column for the state,
and adds relations for the first state, the last state, the successor, and
the loop (TemporalTranslator.java: Time, S/first, S/last, S/next,
loop). To keep past operators sound on a loop it unrolls the loop as many
times as past operators are nested (countHeight in the same file).
Elinvar can do the same, or unroll one level lower, in the circuit: one table per changing relation per state, and one variable per candidate loop target. The second avoids the extra column and keeps state atoms out of the universe and out of symmetry detection. Which one is open (section 13); it is settled when the time section of LOGIC.md is written, and either way the evaluator’s independent reading referees the result.
8.4 Actions and frames
Forgetting to say what a step leaves unchanged is the most common mistake in a model of this kind (R22). An action is a named step with parameters, a guard, and effects on named relations. The helper adds, for every changing relation the action does not mention, that it stays as it was. The model says which actions exist, and the helper adds that every step is one of them, or a step where nothing changes.
Actions also give counterexamples their words. Each step of a trace is labelled with the action that happened and its arguments, which is what turns a list of states into a story (section 9.6).
9. Front doors
9.1 What agents need
Elinvar is designed for an agent’s loop: describe the design, check it, read what broke, change the design, check again. From that:
- A way in that needs no Rust project: one binary, a model as text, one call per check, no state kept between calls.
- A syntax it already knows. Alloy’s.
- A verdict as data, with a schema and a version, and an exit status that says the same thing.
- A counterexample it can act on: the smallest one, as named steps, in few tokens.
- Errors that say where and how to fix it, under stable codes, with
elinvar explain CODEfor the long form. - No silent success. An empty model, a rule that was ignored, or rules that contradict each other are reported, not passed (section 7.6).
- A budget on every call, and
unknownwhen it runs out. An agent must never wait on a solver without a limit. - The same answer for the same input, so results can be cached and compared.
- A way to ask questions about a counterexample without solving again:
elinvar eval, the evaluator as a tool. - Safety: model text is data, and nothing an agent sends executes code or reaches the network (AGENTS.md law 11).
9.2 The Rust library
The second door is a model written in Rust, beside the code it describes,
checked in cargo test (R23, R26). The README’s example, as it is in
crates/elinvar/tests/readme.rs, where a test keeps it under fifty lines:
use elinvar::prelude::*;
fn notes_need_access() -> (Model, Formula) {
let mut m = Model::new();
let person = m.set("Person");
let item = m.set("Item");
let owner = m.field_with("owner", &item, Multiplicity::One, &person);
let follows = m.changing_field("follows", &person, &person); // follower -> reader
let shared = m.changing_field("shared", &item, &person);
let notes = m.changing_field("notes", &item, &person);
// Who can open an item: its owner, and those it is shared with who
// still follow the owner.
let can_open = owner.union(&shared.intersection(&owner.join(&follows.transpose())));
m.fact(shared.no().and(¬es.no()));
m.action("share", [&item, &person], |step, [i, p]| {
step.when(i.join(&owner).is_in(&p.join(&follows)));
step.add(&shared, i.product(&p));
});
m.action("unfollow", [&person, &person], |step, [p, q]| {
step.when(q.is_in(&p.join(&follows)));
step.remove(&follows, p.product(&q));
});
let note = m.action("note", [&item, &person], |step, [i, p]| {
step.when(p.is_in(&i.join(&shared))); // forgot the follow
step.add(¬es, i.product(&p));
});
let promise = always(all([&item, &person], |[i, p]| {
note.happens(&[&i, &p]).implies(&p.is_in(&i.join(&can_open)))
}));
(m, promise)
}
#[test]
fn notes_need_access_holds() {
let (m, promise) = notes_need_access();
m.check(&promise).named("NotesNeedAccess").scope(3).steps(6).assert_holds();
}
assert_holds panics with the story of section 9.6 as its message, so the
counterexample is the test’s failure (R26). The value it would have returned
is the same result type every other door gets.
API rules, checked on every public change (AGENTS.md law 26):
- No third-party types in stable signatures.
- Growing structs and enums are
#[non_exhaustive]. - Building a model never fails;
runandcheckreturn every error together, each with its place (section 6.4). - The library never prints, reads stdin, installs signal handlers, or spawns processes.
- Every result type implements
Displayfor people,serdefor machines, andClone + Send + Sync. #[must_use]on builders and results. No panic on user input; the one panic is a failed referee (AGENTS.md law 13).- Every public item has a compiled example. Error codes are documented and tested.
9.3 The command line
The first door. Every command is a verb, modes are flags, and subjects are arguments (AGENTS.md law 32):
elinvar check sharing.als every check in the file
elinvar check sharing.als NotesNeedAccess one of them
elinvar check sharing.als --explain with minimal unsat-core facts/guards on holds/proved/vacuous
elinvar run sharing.als --explain with the minimal unsat-core facts on a run with no instance
elinvar check sharing.als --induction prove `always P` for any number of steps by k-induction
elinvar check sharing.als --climb --budget 100000
climb scopes under budget until a hole or budget runs out
elinvar check sharing.als --summary one compact Markdown table across all checks
elinvar run sharing.als show --shrink --brief
find a shrunk instance, omitting empty relations
elinvar run sharing.als show --all --sql enumerate all non-isomorphic instances up to scope
elinvar tests sharing.als --sql generate step reachability and per-guard refusal tests
elinvar accepts sharing.als trace.sql check whether a trace JSON or SQL script is allowed
elinvar eval sharing.als result.json 'Item.shared' --state 2
elinvar diff old.als new.als --json compare two design revisions (or two `.sql` schemas)
elinvar diff old.sql new.sql --tables orders compare a table slice (plus FK and trigger targets)
elinvar diff old.als new.als --of visible compare one function or query between two models
elinvar import schema.sql --strict --temporal
turn SQL DDL (and triggers) into an Alloy 6 model
elinvar render result.json --sql render an instance or trace as DOT, Mermaid, or SQL
elinvar render sharing.als --mermaid render a model's signatures, fields, and steps
elinvar explain arity.mismatch an error code, in full
elinvar explain schema:result a verb's JSON Schema (`elinvar explain schema` lists them)
elinvar serve --mcp the same verbs as MCP tools
--jsonon every verb prints the result as one JSON document (section 9.5). Without it the same result is rendered as text.--scope,--steps, and--budgetoverride what the file says.- How a SQL schema becomes a model, and what
import,accepts,fuzz,audit,discover, andcido with it, is SQL.md. - Exit status: 0 when every promise holds or the instance was found; 1 when
a counterexample was found or no instance exists; 2 when a verdict is
unknownorvacuous; 3 when the model has errors. The JSON says the same in full. - A verb that cannot start, for a flag, argument, or verb it does not take
(
cli.usage) or an input it cannot read (cli.input), exits 3 too. With--jsonit printscode,error, and the verb’shelp(schema:usage); without,elinvar: error[CODE]: ...on stderr. --helpon every verb is complete enough to use the verb with nothing else, andelinvar explaincovers every code and schema (AGENTS.md law 18).
9.4 Model text
The text form of a model is Alloy 6’s own syntax, a documented subset of it (decided 2026-11-28; this answers open decision 4 of REQUIREMENTS.md with “yes”, for a new reason: it is the agent’s door). The README’s example, as an agent would write it:
sig Person { var follows: set Person }
sig Item {
owner: one Person,
var shared: set Person,
var notes: set Person
}
fun canOpen: Item -> Person { owner + (shared & owner.~follows) }
pred share[i: Item, p: Person] {
i.owner in p.follows
shared' = shared + i->p
follows' = follows
notes' = notes
}
pred unfollow[p, q: Person] {
q in p.follows
follows' = follows - p->q
shared' = shared
notes' = notes
}
pred note[i: Item, p: Person] {
p in i.shared // rule 3 forgot the follow
notes' = notes + i->p
follows' = follows
shared' = shared
}
pred nothing { follows' = follows and shared' = shared and notes' = notes }
fact {
no shared and no notes
always (nothing
or (some i: Item, p: Person | share[i, p] or note[i, p])
or (some p, q: Person | unfollow[p, q]))
}
assert NotesNeedAccess {
always all i: Item, p: Person | note[i, p] implies p in i.canOpen
}
check NotesNeedAccess for 3 but 6 steps
Each predicate repeats what stays the same, three times over. That repetition is what R22’s helper removes in the Rust form, and a matching form for text is an extension to consider once the subset works (section 13).
What the subset leaves out: strings, unbounded 1.. steps, sum disj, and
recursive predicates or functions. Bounded integers
(LOGIC.md section 16) and sequences (seq T,
seq/Int, for N seq, util/sequniv) are read. A model that uses an
unsupported construct gets an error with a code that names the construct
and the line, never a wrong answer. Reading text needs what the core does
not have: name resolution, Alloy’s types, signature hierarchies turned into
bounds, and scopes. That is why it is its own crate and its own phase.
One fact from the source shapes this. Alloy puts 16 integer atoms in the
universe of every command, whether the model uses integers or not
(ScopeComputer.java: shouldUseInts = true, bitwidth 4), so univ,
iden, and reflexive closure range over them. Agreement with Alloy on a
model that mentions those needs the same atoms present, as plain atoms
(LOGIC.md section 10).
9.5 Results as data
One result type serves every door. Its JSON form has a schema and a version
(AGENTS.md law 19): docs/schema/result-v1.json, written by cargo x generate and checked by cargo x verify, with the README example’s result
pinned by a golden file. LOGIC.md section 14 specifies it; what follows was
the first sketch, kept as the record of the intent:
{
"elinvar": 1,
"command": "check",
"name": "NotesNeedAccess",
"verdict": "counterexample",
"scope": { "Person": 3, "Item": 3, "steps": 6 },
"shrunk_to": { "Person": 2, "Item": 1, "steps": 3 },
"trace": {
"loop_to": 3,
"states": [
{ "step": 0, "follows": [["Person0", "Person1"]], "shared": [], "notes": [] },
{ "step": 1, "action": "share", "args": ["Item0", "Person0"],
"changed": { "shared": { "added": [["Item0", "Person0"]] } } }
]
},
"broken_at": 3,
"story": "..."
}
An instance lists its atoms and each relation’s tuples (R24). A trace lists
its states, what changed at each step, and where it loops. States and steps
share one numbering: state 0 is the start, step i is the change that leads
to state i, and broken_at and loop_to are state numbers. The story
uses the same numbers, so “broken at step 3” is "broken_at": 3. Errors and
warnings are entries with a code, a place, a message, and a fix. Atom names
come from the set they belong to and a number, as Alloy’s do.
Graphviz dot, Mermaid flowchart, and executable SQL replay renderings of an
instance or trace are produced directly from the same result data
(render_instance, render_trace, render_report, and elinvar render;
REQUIREMENTS.md section 3).
9.6 Stories and shrinking
The text rendering of a counterexample is a story: what there is, then one line per step saying what happened and what changed, then where the promise broke (R24). For the README’s example it should read about like this:
check NotesNeedAccess: FAILS in 3 steps, with 2 people and 1 item
start Person0 follows Person1. Item0 is owned by Person1.
step 1 share(Item0, Person0) shared gains Item0 -> Person0
step 2 unfollow(Person0, Person1) follows loses Person0 -> Person1
step 3 note(Item0, Person0) notes gains Item0 -> Person0
broken at step 3: Person0 notes Item0, but Item0.canOpen is {Person1}.
searched every case up to 3 people, 3 items, 6 steps.
Before it is shown, a counterexample is shrunk (R25). Smaller means, in this order: fewer steps, then fewer atoms, then fewer tuples.
- Fewer steps come from the search itself, which tries trace lengths in increasing order (section 8.3).
- Fewer atoms: solve again with smaller scopes, one set at a time in the order the sets were declared, keeping a reduction when a counterexample still exists.
- Fewer tuples: for each tuple of the instance in a fixed order, ask the solver for a counterexample without it, keeping the removal when one exists. These are solves under assumptions on the clauses already built.
The symmetry predicate is left out of the solves that remove tuples. It keeps one representative of each group of renamed instances, and the smaller counterexample need not be the one it keeps, so with the predicate in force a removal can be refused though a smaller counterexample exists. The result would still be a true counterexample, only not the smallest. Either the predicate sits behind one literal that these solves assume false, or the clauses are rebuilt without it; phase 4 chooses.
Every candidate is refereed, and the order is fixed, so shrinking is deterministic. The exact procedure, and its budget, are specified in phase 4 before they are coded. The result says both the scope searched and the size shrunk to.
9.7 MCP
elinvar serve --mcp offers the verbs of section 9.3 as tools over stdio,
one JSON-RPC 2.0 message per line, under MCP 2025-06-18: check, run,
diff, import_sql, render, eval, tests, accepts, discover,
audit, and explain. On initialize, it returns concise instructions
and advertises resources: skill://elinvar/SKILL.md and every schema of
elinvar explain schema, served from the copies embedded in the binary.
Each tool takes model text or result JSON and options and returns the
result JSON, with isError when the result is the verb’s errors.
Where the command line names a file, a tool takes its text. A .sql file
is is_sql with the DDL as model, and --with sidecars are promises
(Alloy) and views (SQL), on check, run, eval, and accepts as on
the command line.
It is an adapter: it holds no state, and it can do nothing the command line
cannot. Two verbs are left out because a tool call would make them do what
an agent’s text should not: fuzz runs a database command (--against),
and ci reads a manifest and the files it names from disk. An agent with a
shell runs both from the command line.
Nothing sent is dropped without an answer (AGENTS.md law 20). An argument a
tool’s inputSchema does not list is a tool error that names the arguments
it takes, as a wrongly typed one is, so the agent can correct the call. A
message that is not a request object, a JSON array (MCP 2025-06-18 has no
batches) included, is answered with -32600 and id null; a request with no
string method or no "jsonrpc": "2.0" with -32600; params that are not
an object, an unknown tool, or a missing resource uri with -32602. A
message with no id is a notification and gets no reply. If another agent
protocol replaces MCP, the adapter is replaced and nothing else changes.
A guide for agents, skills/elinvar/SKILL.md, ships in the release archive:
when to reach for Elinvar, how to turn a design into rules and a promise,
how to read a verdict, and what holds does and does not mean.
9.8 Measuring it
“Agents first” is measured, not asserted. The agent suite is a set of tasks,
each a design described in prose with a hole planted in it (the planted
holes of CORPUS.md section 5, told as stories),
a task with no hole, or a vacuous-rules trap where contradictory rules must
be reported as vacuous rather than holds. An agent gets the prose, the
elinvar binary, and SKILL.md. It passes a hole task when the trace or
instance it reports is a real counterexample: the evaluator replays it
against the task’s reference model. It passes a no-hole or vacuity task by
reporting the matching verdict without inventing a hole or altering the
rules.
cargo x agents --agent CMD runs the suite (7 tasks) and records a
baseline per agent; --replay re-scores the outputs it saved. The first
baseline, Claude Code on 2026-11-28, passed all four initial tasks
(agents/baselines/claude-code.md). A change to the command line, the result format, the error messages,
or SKILL.md is judged by what it does to that baseline.
10. Verification
Alloy is never run to build or test (R16), so correctness comes from four sources that need no reference implementation at test time, and one that needs Alloy only when its answers are regenerated.
- The referee (R15). Every instance returned by
run,check, the next instance, or shrinking is evaluated against the formula as the user wrote it, before skolemization. This catches every wrong “here is a counterexample”. It cannot catch a wrong “there is none”; the rest of this list is for that. - Spec tests. Each rule in LOGIC.md gets tests with hand-worked values, and its worked examples are tests (LOGIC.md section 9).
- Known counts. Brute-force enumeration with the evaluator must give the known number of total orders, equivalence relations, functions, and acyclic graphs on small sets (LOGIC.md section 8). No solver, no reference implementation.
- Brute force against the solver (R18). For tiny universes, the set of
instances the solver enumerates with symmetry breaking off equals the set
brute force finds, and with it on, both agree on whether any exists.
Formulas come from the spec tests and from a seeded generator of random
formulas, so a failure is reproduced from its seed. A second, bit-sliced
counter in
elinvar-engine(count_bitsliced) evaluates 4,096 instances at once with SIMD bit operations (macerator), which takes the comparison to five atoms, 2^25 instances of a relation, against known counts. It must agree with the plain counter ofelinvar-logic, which stays the definition and the referee. - Planted holes (R17). Models with a known hole; reporting no counterexample is a failure (CORPUS.md section 5). Every wrong “no counterexample” ever found becomes one.
- Agreement with Alloy (R16). A corpus of models exists twice, as
.alsand as Rust. For each command the verdict matches Alloy 6.2.0, and with symmetry breaking off the count of instances matches where the count is small enough to enumerate (CORPUS.md section 4). From phase 5 the.alsside is read directly, and the two translations check each other. - Determinism (R14). Golden first instances, compared on Linux, macOS, and Windows (section 7.8).
- Formats. Golden files of the result JSON and the stories; old versions keep parsing.
- Agents. The suite of section 9.8.
- Speed (R29).
cargo x bench corpusrecords each corpus command’s time beside Alloy’s recorded time and prints the change from a local baseline. It fails only if the harness fails.
What this does not give: proof that the translation is right. A formula outside everything above could still translate wrongly to “no counterexample”. The mitigation is breadth in the corpus and the random formulas, and the rule that the referee never shares code with the translation.
11. Roadmap
Phases 1 to 5 are those of REQUIREMENTS.md section 5, with the agent door written into phases 4 and 5.
| Phase | Scope | Exit criteria |
|---|---|---|
| 0. Bootstrap | workspace, cargo x verbs, AGENTS.md, this design, LOGIC.md for phase 1, the corpus inventory, CI on three platforms, the license, the book | CI green; the open decisions that block phase 1 settled |
| 1. Relational core | elinvar-logic: universe, relations, bounds, expressions, formulas, build-time errors with places, instances, the evaluator, brute-force enumeration (R1 to R7) | every operator matches its hand-worked answer; brute-force counts match the known numbers |
| 2. Finding | LOGIC.md extended first; skolemization, circuit, clauses, the solver trait and the default solver, symmetry breaking, run, check, verdicts and budgets, the next instance, the referee wired in; the corpus and cargo x corpus, oracle, bench corpus (R8 to R18) | the first ten corpus models agree with Alloy; every planted hole in a static model is found; the solver agrees with brute force on random formulas; first instances identical on three platforms |
| 3. Time | LOGIC.md extended first; changing relations, temporal formulas, traces, the unrolling, the evaluator on traces, actions with frames (R19 to R22) | the sharing example’s hole is found as a three-step trace; the temporal corpus agrees with Alloy 6 |
| 4. Answers | the Rust front polished, results as data with schemas, error codes with fixes, stories, shrinking, assert_holds (R23 to R26, R30 to R33) | the README example is under fifty lines and its failure reads as a short story; result JSON pinned by golden files |
| 5. The agent door | elinvar-als for the documented subset of Alloy 6, the command line, serve --mcp, SKILL.md, the agent suite (R34, R35) | Alloy’s example models that stay inside the subset run unmodified and agree with Alloy; an agent suite baseline is recorded; release binaries |
Phases 1 and 2 are the critical path: that is where trust is won or lost, and nothing in a later phase delays them (AGENTS.md law 35).
Agent-first does not mean the agent door is built first. The laws under “Agents first” in AGENTS.md hold from phase 1: codes, places, data before text, no panic, no hang. Phase 4 ran before phase 5 so stories and shrinking were ready for the command line and MCP; both phases are now built.
12. Risks
- A wrong “no counterexample”. The whole of section 10 exists for this, and it remains the main risk.
- Scale. Grounding a quantifier multiplies the circuit by the size of what it ranges over; nested quantifiers over a scope of 6 or 7 can already be large. Speed is not a first goal (R29), but a check an agent waits a minute for is not used. Measured from phase 2 on the corpus.
- The default solver. Elinvar’s own CDCL solver (
sat::Cdcl) is small and in-tree, and sits behind theSolvertrait so callers can plug in a faster external solver when needed. - The size of Alloy’s language. Signatures, multiplicities, modules,
util/ordering, and the type system are a large surface, and agreement with Alloy depends on details such as the integer atoms in every universe. Phase 5 takes a documented subset and rejects the rest by name. - Time. Past operators on a loop are easy to get subtly wrong. Mitigated by the evaluator’s independent reading and the temporal corpus.
- Shrinking can cost many solves. It has its own budget, and a counterexample that ran out of it is still returned, marked as not fully shrunk.
- Agents trust “holds” too much. Mitigated by the scope in every verdict,
the
vacuousverdict, and whatSKILL.mdsays about both. The agent suite’s tasks without a hole measure the opposite failure.
13. Decisions and open questions
Decided on 2026-11-28, by the user:
- Inspired by Alloy and extending it, not a line-by-line port. The relational core follows Alloy’s and Kodkod’s design closely enough that answers can be compared; everything around it is free to differ (REQUIREMENTS.md section 1 and open decision 2).
- Agents first. Elinvar’s first users are agents; the principles, the laws under “Agents first” in AGENTS.md, and section 9 follow from that.
- The project is laid out as kepler is: the documents in
docs/, served as a book bycargo x docs, every operation acargo xverb, the laws in AGENTS.md. - License: MIT OR Apache-2.0, the Rust convention (section 14). This settles open decision 1 of REQUIREMENTS.md.
- The default solver is Elinvar’s own conflict-driven solver, written in
the
elinvar-enginecrate, notbatsat(section 7.4). Settles open item 2. - Elinvar aims to be the best version of Alloy, not a copy: matching Alloy’s verdicts matters, matching its internals does not.
- Integers are in scope: bounded and wrapping, as Alloy’s are (LOGIC.md section 16). REQUIREMENTS.md section 6 left them out; the user chose to add them on 2026-11-28, with 17 of Alloy’s example files unread for want of them.
- The minimum supported Rust version is 1.94 (AGENTS.md law 9), the
version
maceratorneeds;cargo x msrvruns the tests on it. Set with the user on 2026-11-28. - The crates are published on crates.io, from 0.1.0 on:
cargo install elinvarinstalls the command line, and a tagged release also builds archives (cargo x dist). The four crates share one version and are published in dependency order:elinvar-logic,elinvar-engine,elinvar-als,elinvar. Until 2026-12-03 they were not published, set with the user on 2026-11-28; the user chose to publish on 2026-12-03. - SIMD, through
macerator, for brute-force enumeration: a bit-sliced counter inelinvar-engine(section 10). The solver’s hot path, unit propagation, walks pointers and gains nothing from SIMD, so it does not use it. - Threads, through
rayon, asked for by the user on 2026-11-29: the command line solves a file’s commands in parallel, and the comparison with Alloy incargo x corpusruns its commands in parallel. The library stays single-threaded (AGENTS.md law 23), and one solve is never split, since which thread finished first would then choose the answer (section 7.8). - Shrinking is bounded by its conflict budget only, never by the time
limit, so
--timeoutcannot change which instance is returned (AGENTS.md law 17, LOGIC.md section 14.3). The cost: a short time limit at a large scope can be followed by a long shrink. Decided by the user on 2026-12-02. - The integer shifts
<<,>>, and>>>joinIntOp, which becomes#[non_exhaustive]in the same change: the public signature breaks once, before the first release, and not again (LOGIC.md section 16). Decided by the user on 2026-12-02. - The crate a user names is
elinvar, for both uses:cargo install elinvarinstalls the command line, anduse elinvar::prelude::*reaches the library. The engine is renamedelinvar-engine, andelinvar-clibecomes theelinvarfacade, which re-exports the engine and the Alloy reader and holds the command line in itsclimodule (section 5.2). The cost: a library user also builds the command line’s two dependencies,rayonandserde_json; a feature to leave them out waits for someone to need it (AGENTS.md law 25). Decided by the user on 2026-12-03, before the first release, so no published name changes.
Assumed on 2026-11-28 while the user’s answers are pending, each the recommended option of a question put to them; each is easy to reverse:
- Counts are compared with Alloy only for commands where no skolem witness arises; for the rest, verdicts only. Settles open item 9 for now.
- Without Java on the development machine, expected corpus answers came
from the models’ own
expectlines, comments, and reasoning, untilcargo x oracleran. It ran on 2026-11-28 with a JDK unpacked undertarget/oracle/, which changes nothing outside the repository; its answers are incorpus/expected.txt. - Alloy’s example models are not copied into the repository: its LICENSE at 6.2.0 is unclear (AGENTS.md law 39). Rust translations cite the upstream file at the pinned commit.
- Random formulas for the brute-force comparison come from an in-house seeded generator, so no dependency is added. Settles open item 8.
Decided on 2026-11-28, by the user, as the first draft proposed them:
- Crates:
elinvar-logicandelinvaras the two libraries, split at the trust boundary, withelinvar-alsandelinvar-cliin phase 5 (section 5.2). Answers open decision 6 of REQUIREMENTS.md. The engine and the command line were renamed on 2026-12-03 (above). - Model text is a subset of Alloy 6’s syntax (section 9.4). Answers open decision 4 with “yes”.
triggeredis included with the other temporal operators, and added to R20 (section 8.2).- The
vacuousverdict (section 7.6). - Domain and range restriction, and the quantifiers
no,one, andlone, are core operators (section 6.3). - Upstream pins: Alloy at its 6.2.0 tag (
59ba203), the newest release, so that expected answers come from a released build; Kodkod (6e80244) and Pardinus (d3e7aea, also its 1.2.4 tag) at the heads of their default branches on 2026-11-28. - No minimum supported Rust version until the first release (AGENTS.md law 9). Superseded: 1.94, decided on 2026-11-28 (above).
Open:
- How much of Kodkod’s source is read (REQUIREMENTS.md open decision 2). This draft read the operator lists, the option defaults, the symmetry classes, and Pardinus’s temporal translator, for their design. No code follows them. A file that does follows AGENTS.md law 38.
- The default solver. Decided above: Elinvar’s own.
- The time translation. Settled on 2026-11-28 when LOGIC.md section 13 was
written, as section 8.3 said it would be: unrolling in the circuit
(LOGIC.md section 13.4). For
L > 1, one problem per lengthLunrollspast_depth + 1copies and chooses the loop target with selector variables (ruling out allLloop targets in one solve when unsatisfiable, then picking the earliestjunder assumptions). - Whether phase 5, the agent door, should come before phase 4. Settled on 2026-11-28: phase 4 ran first so stories and shrinking were ready for the command line and MCP, and both phases are built.
- Compile-time checks beyond the split between expressions and formulas (section 6.4).
- A frame helper in model text, to match R22’s in Rust (section 9.4). It would be an extension to Alloy’s syntax, so a model using it would no longer run in Alloy.
- Whether a default scope exists. Alloy’s is 3 (
ScopeComputer.java). The README says “a size you choose”. For text, following Alloy is the least surprise; for the Rust builder, no default. - Random formulas for the brute-force comparison. Assumed above: an in-house seeded generator.
- Assumed above: verdicts only where a witness arises. How instance
counts are compared with Alloy’s when a command has
witnesses. Skolem relations count on both sides (section 7.7), so
the counts agree only if both skolemize the same quantifiers
(section 7.2). Alloy rewrites
no,one, andlonebefore Kodkod sees them, which can put a skolemizable quantifier where Elinvar’s core form has none. The plain case is acheckofno x: e | F: Alloy solves the negation ofall x: e | not F, and the witness forxis skolemized.oneandloneover sets become the multiplicity of a comprehension, and nothing inside a comprehension is skolemized (TranslateAlloyToKodkod.java,visit_qt;Skolemizer.java,visit(Comprehension)). Either Elinvar’s skolemization mirrors what Alloy’s rewriting produces, or counts are compared only for commands where no witness arises and verdicts for the rest. To be settled when phase 2 specifies skolemization.
14. Naming and licensing
- The name is Elinvar (README.md). The crates,
elinvar,elinvar-engine,elinvar-logic, andelinvar-als, are on crates.io (section 13). - Elinvar is not affiliated with Alloy, Kodkod, Electrum, or Pardinus, and credits them in the README and in NOTICES.md.
- Elinvar is dual licensed, MIT OR Apache-2.0 (
LICENSE-MIT,LICENSE-APACHE), copyright Dilshod Tadjibaev. Alloy’sLICENSEfile begins “THIS IS NOT VALID YET! CURRENTLY CODE IS UNDER MIT LICENSE” above the text of Apache-2.0, and its source files carry an MIT notice; Kodkod and Pardinus are MIT (theirLICENSEfiles). The dual license is compatible with all of them. A file that follows upstream source, or a model copied from it, keeps upstream’s notice and is listed in NOTICES.md (AGENTS.md laws 38 and 39).