Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Alloy, and what Elinvar takes from it

Alloy is a language and a tool for describing designs and searching them for holes, by Daniel Jackson and the Alloy team at MIT. Its engine, Kodkod, is by Emina Torlak. The time extension of Alloy 6 comes from the Electrum project and its engine, Pardinus. Elinvar is inspired by all three and affiliated with none.

The parts of Alloy

PartWhat it doesIn Elinvar
the languagesignatures, fields, facts, predicates, assertions, run and checka documented subset is the text form of a model (DESIGN.md section 9.4)
Kodkodrelational logic with bounds, turned into a boolean circuit, then clauses for a SAT solverthe core, rebuilt in Rust after its design (DESIGN.md sections 6 and 7)
symmetry breakingskips cases that differ only by renamingthe same method (DESIGN.md section 7.5)
time, from Pardinuschanging relations, always, eventually, traces that loopbounded lasso traces (DESIGN.md section 8)
the visualizerdraws an instancetext stories, plus Graphviz dot and Mermaid (elinvar render)
integers, strings, and sequencesbounded, wrapping arithmetic, string literals, and seqsupported with configurable bitwidth (LOGIC.md section 16), String with each command’s literals, and util/sequniv
the library modulesutil/ordering, util/relation, util/graph, util/boolean, util/ternary, util/natural, util/integer, util/time, util/sequence, util/seqrel, util/sequniveach read, in Elinvar’s own statement of it with Alloy’s names and parameters (LOGIC.md section 15.1)

The same, on purpose

The logic is Alloy’s: sets and relations, join, closure, quantifiers, and bounds on what each relation may hold (LOGIC.md). It is kept the same so that answers can be compared. A corpus of Alloy’s own example models is checked both ways: the verdict must match Alloy’s, and where the cases can be counted, so must the count (CORPUS.md).

Alloy is never needed to build or test Elinvar. Its answers are recorded once and kept in the repository.

Different, on purpose

  • No Java. One binary, built by cargo alone.
  • Built for agents first: results as data, error codes with fixes, a budget on every search (DESIGN.md section 9.1).
  • The smallest counterexample, not the first one found.
  • A model can be written in Rust, beside the code, and checked in cargo test.
  • A helper that says what a step leaves unchanged, the thing most often forgotten.
  • “Holds” is told apart from “the rules allow nothing”.

A fact that matters when comparing

Alloy puts 16 integer atoms in the universe of every command, whether the model uses integers or not. univ, iden, and * range over them. A comparison with Alloy on a model that mentions those has to account for it (LOGIC.md section 10).