The corpus
Status: phases 1 to 5 built, 2026-11-29; counts updated 2026-12-03. Every file of Alloy’s example corpus is read and all 224 commands Alloy answers agree with Alloy 6.2.0, the planted holes among them, and so do the 183 commands of the language cases (section 4); twelve models are also translated in Rust (section 6), two of them temporal; seven planted holes are found, the README’s sharing example among them.
Elinvar never runs Alloy to build or test (AGENTS.md law 2), so part of its evidence is a corpus of models with answers that Alloy gave once and that are kept in the repository (R16, DESIGN.md section 10). This file says where the models come from, which are used when, how the expected answers are made, and what a planted hole is.
Contents: 1 Sources · 2 Inventory · 3 Layout · 4 Expected answers · 5 Planted holes · 6 The first ten
1. Sources
| Source | Commit | Models |
|---|---|---|
| Alloy | 59ba203 (6.2.0) | org.alloytools.alloy.extra/extra/models/: 83 .als files |
| Elinvar | planted holes (section 5) | |
| Elinvar | language cases: one model per construct of the model text, its commands chosen so that a wrong reading changes an answer (LOGIC.md section 15) |
cargo x fetch checks Alloy out under target/upstream/alloy/. The
repository has 97 .als files in all at that commit. The other 14 are the
11 library modules in org.alloytools.alloy.core/src/main/resources/models/util/,
which models open and which matter in phase 5, two files of the command
line module, and one test resource.
Kodkod’s and Pardinus’s own tests are Java programs that build formulas through the API, not models. They are a source of cases for spec tests, read and rewritten by hand, and are not inventoried here yet.
2. Inventory
The 83 models, by what they need. The split was made by a scan of each file
with comments removed: commands are lines starting with run or check,
with or without a label before them, integers are any of #, Int, int,
sum, time is var or a temporal keyword, and modules are open lines. A scan can be wrong.
Whoever translates a model reads all of it, and corrects its row if it was
wrong.
| Group | Files | Disposition |
|---|---|---|
| static, no integers, opens no module | 33 | translate, phase 2 |
| static, no integers, opens a module | 23 | translate, phase 2 after the first group; a model that opens util/ordering is translated with the order fixed by exact bounds, as Alloy fixes it (DESIGN.md section 7.5) |
| changing relations and temporal formulas | 4 | translate, phase 3 |
| integers | 17 | read and compared once bounded integers were added (LOGIC.md section 16) |
| no command | 6 | skip: nothing to compare. Two are modules that other models open |
Static, no integers, opens no module (33):
book/appendixA/:addressBook1,closure,distribution,prison,properties,ring,spanning,tree,tube,undirectedbook/chapter2/:addressBook1a,1e,1g,2a,2b,2c,2d,2ebook/chapter4/:filesystem,grandpa1,grandpa2,grandpa3,lightsbook/chapter5/:addressBook,lists,sets1,sets2book/chapter6/:mediaAssets,memory/abstractMemory,memory/cacheMemoryexamples/systems/:file_system,marksweepgcexamples/toys/:ceilingsAndFloors
Static, no integers, opens a module (23):
util/ordering:book/appendixE/p300-hotel,p303-hotel,p306-hotel;book/chapter2/addressBook3ato3d;book/chapter6/hotel1tohotel4,ringElection1,ringElection2;examples/algorithms/dijkstra;examples/case_studies/firewire;examples/tutorial/farmerutil/orderingwithutil/graphorutil/boolean:examples/algorithms/opt_spantree,s_ringlead,stable_orient_ringutil/relation:examples/case_studies/com,examples/toys/numbering- other models of the corpus:
book/chapter6/memory/checkCache,checkFixedSize
Time (4): examples/temporal/ buffer, trash, and with util/ordering,
leader, leader_events.
Integers (17): book/chapter2/ addressBook1b, 1c, 1d, 1f, 1h;
examples/algorithms/ messaging, peterson, ringlead,
stable_mutex_ring, stable_ringlead; examples/case_studies/ chord,
chord2, chordbugmodel; examples/puzzles/handshake;
examples/systems/ javatypes_soundness, lists, views.
No command (6): book/appendixA/ addressBook2, barbers, phones;
book/chapter6/memory/ fixedSizeMemory, fixedSizeMemory_H;
examples/case_studies/ins.
The first ten (phase 2’s exit criterion) are chosen from the first group
when phase 2 starts, after each candidate is read in full. Three things
found while reading book/appendixA/ bear on the choice:
- Eight of its ten models are exercise skeletons, with predicates left
empty for the reader to fill in. They test scopes and bounds and little
else.
distributionandpropertiesstate something. - Those two quantify over relations (
all s: set univ, p, q: univ->univ), so they need skolemization (DESIGN.md section 7.2), and overuniv, so they need the integer atoms of section 4. tubehas three unconstrained relations over eleven stations. Its verdict can be compared; its instances cannot be counted.
So the first ten should lean on chapters 4 and 5, which state real
constraints over signatures, with distribution and properties for
skolemization.
3. Layout
corpus/holes/hierarchy.als planted holes, Elinvar's own, as Alloy
corpus/holes/access.als text with `expect` lines
corpus/holes/sharing.als the README's example, a trace
corpus/holes/frame-*.als frames over part of a field, one row,
or a changing set, which slicing once
took for whole frames (2026-12-02)
corpus/language/*.als language cases: `;`, macros, defined
fields, `disj[...]`, number literals,
`private` and string names, `sum disj`
crates/elinvar-engine/tests/corpus.rs Alloy's models in Rust, each citing its
.als file at the pinned commit, with its
expected answers and where they come from
crates/elinvar-engine/tests/holes.rs the planted holes in Rust
Alloy’s .als files are not copied: the terms of Alloy’s LICENSE at
6.2.0 are unclear, so AGENTS.md law 39 treats them as incompatible
(DESIGN.md section 13). cargo x fetch puts them in target/upstream/ for
reading.
From phase 5, crates/elinvar-als/tests/text.rs also reads eight of these
models straight from target/upstream/, unmodified, and checks they give
the same verdicts as their Rust translations; the planted holes are read as
text too. Before cargo x fetch, cargo x test skips the models it cannot
find, and cargo x corpus fails on them, so it never reports agreement on
the planted holes alone.
cargo x test runs every corpus command but those marked slow.
cargo x corpus builds in release mode and runs all of them, slow ones
included, printing each command’s verdict, size, and time; cargo x bench corpus sets those times beside a local baseline (R29). From phase 5 it
also reads each .als directly and compares the two translations with each
other. For that comparison the reader is told to add the 16 atoms of
section 4, which a hand translation adds where they matter. Whether
elinvar-als adds them for a user by default is a difference from Alloy
either way, and is decided when phase 5 specifies the subset
(LOGIC.md section 10).
4. Expected answers
cargo x oracle runs Alloy 6.2.0 (its release jar, checked against a
pinned SHA-256) on every model of extra/models/, every planted hole, and
every language case,
one command at a time, and writes each command’s answer to
corpus/expected.txt: SAT for an instance or a counterexample, UNSAT for
none. It first ran on 2026-11-28, with a JDK unpacked under
target/oracle/. Its last run, on 2026-12-03, has 411 rows: 407 commands
answered, 183 of them the language cases’, and 4 that are ERROR in Alloy itself (the file s_ringlead,
which Alloy does not compile, the file ins, which has no commands, and the
two commands of temporal/trash that ask for unbounded steps, for 1.. steps, which REQUIREMENTS.md section 6 leaves out). A command that leaves
no answer is an ERROR row of its own, and the oracle goes on to the next;
until 2026-12-02 it stopped there instead, and five bounded commands of
temporal/trash that follow the first unbounded one went uncompared.
When Alloy gives no answer, the oracle prints the first line of its
message. cargo x oracle --only FILE runs one model, named as
corpus/expected.txt names it, and keeps every other row, which is how a
new language case gets its answers without a full run.
cargo x corpus compares every command of every model with those answers
(crates/elinvar-als/tests/text.rs, agrees_with_alloy), reading them with
Alloy’s 16 integer atoms in every universe, a model’s own modules read
beside it, and a budget of 2,000,000 conflicts per command: all 346 agree,
none disagrees, and none runs out of budget. A command of a model Elinvar
reads with no row in corpus/expected.txt fails the comparison, so the
answers cannot fall behind the corpus.
The Rust translations of corpus.rs also say where their expected answers
came from, before the oracle ran: the model’s own expect line, its
authors’ comment, or reasoning written beside it. Every one agrees with the
oracle.
corpus/expected.txt is tab-separated, one row per command: file, 0-based
command index, label, answer (SAT, UNSAT, or ERROR), and Alloy’s time
in milliseconds (JVM startup included):
book/chapter4/grandpa1.als 0 NoSelfFather UNSAT 275
examples/toys/ceilingsAndFloors.als 4 BelowToo"" UNSAT 2823
cargo x bench corpus reads those Alloy times and prints them beside
Elinvar’s times and the local baseline (R29). What the oracle does not write
is instance counts with symmetry breaking off: Alloy’s exec writes each
solution as a file, which makes large counts slow to gather; counts are
compared with brute force instead (DESIGN.md section 10).
The oracle needs Java and the Alloy release, fetched by the verb and checked against a pinned hash. It is the one place Java runs (AGENTS.md law 2). CI never runs it; CI compares against the committed files.
What “the same answer” means:
- Verdicts match. Alloy has two answers and Elinvar has more
(DESIGN.md section 7.6): Alloy’s “an instance exists” is
foundfor arunandcounterexamplefor acheck; Alloy’s “none” isnonefor arun, and for acheckeitherholdsorvacuous, which Alloy does not tell apart.unknownmatches nothing and fails the comparison. - Counts match with symmetry breaking off on both sides. With it on, the two tools may keep different representatives, so only verdicts are compared.
- A total order from
util/orderingis fixed on Alloy’s side even with symmetry breaking off, so the Rust translation fixes it too, with exact bounds in atom order (DESIGN.md section 7.5). Otherwise Elinvar would count every order where Alloy counts one. - The universe matches. Alloy puts 16 integer atoms in every command’s
universe (LOGIC.md section 10). A Rust translation of a model that
mentions
univ,iden, or*declares 16 extra atoms in a set of their own with an exact bound, so both sides range over the same number of atoms. A model that mentions none of the three does not need them: atoms no relation can hold do not change a verdict or a count. - Skolem relations count. Alloy’s enumeration tells apart two instances
that differ only in a witness: its blocking clause covers every primary
variable, and a skolem relation has them (LOGIC.md section 10). So a
count agrees only if both sides skolemize the same quantifiers, and
Alloy’s rewriting of
no,one, andlonedecides where some of them are. How that is handled is open (DESIGN.md section 13, item 9).
An expected answer changes only through cargo x oracle (AGENTS.md law 30),
and a change is reviewed like a change to a test.
5. Planted holes
A planted hole is a model written for Elinvar with a known way to break its promise (R17). Its expected answer is a counterexample, and where it is known, the fewest steps and atoms that show it. If Elinvar reports no counterexample, Elinvar is wrong.
The first is the README’s sharing example: share, end the follow, leave a note (DESIGN.md section 9.4). It is phase 3’s exit criterion.
Rules for the set:
- Each hole has a sibling with the hole fixed, whose expected verdict is “holds”. A checker that reports a counterexample for everything fails the siblings.
- Static holes come first (phase 2): a constraint that was meant and not written, such as a hierarchy that allows a cycle, or a permission that outlives its group.
- Every wrong “no counterexample” ever found in Elinvar becomes a planted hole, with the commit that fixed it (AGENTS.md law 28).
- Holes are also written as
.als, socargo x oracleconfirms that Alloy finds each one. A hole that uses something Alloy lacks is tested by the referee, brute force, and its sibling alone.
The agent suite retells these as prose (DESIGN.md section 9.8).
6. The first ten
The phase 2 and 3 Rust translations, by file under
org.alloytools.alloy.extra/extra/models/, with the source of each expected
answer. Every command agrees; times are from cargo x bench corpus on an
Apple M-series laptop on 2026-11-29, release build.
| Model | Commands | Expected answers from | Slowest |
|---|---|---|---|
book/chapter4/grandpa1 | 3 | comments in the file | under 1 ms |
book/chapter4/grandpa2 | 2 | comments in the file | under 1 ms |
book/chapter4/grandpa3 | 3 | comments in the file | under 1 ms |
book/chapter4/filesystem | 3 | comments in the file | under 1 ms |
book/chapter5/sets1 | 1 | reasoning in corpus.rs | under 1 ms |
book/chapter5/sets2 | 1 | reasoning in corpus.rs | 0.1 s |
book/chapter5/lists | 1 | reasoning in corpus.rs; vacuous, where Alloy says only “no counterexample” | under 1 ms |
examples/toys/ceilingsAndFloors | 5 | expect lines | 0.8 s at scope 10, 3 ms at 6 |
book/chapter2/addressBook1a | 1 | an empty predicate: any case | under 1 ms |
examples/systems/marksweepgc | 3 | expect lines | 1 ms |
examples/temporal/trash | 8 | reasoning in corpus.rs; its two for 1.. steps commands, which ask for unbounded traces, are run with 10 steps | 0.2 s |
examples/temporal/buffer | 5 | reasoning in corpus.rs | 3.8 s |
Read as text only, unmodified, since util/ordering is read (LOGIC.md
section 15.1), in crates/elinvar-als/tests/text.rs:
| Model | Commands | Expected answers from | Agrees |
|---|---|---|---|
examples/tutorial/farmer | 2 | expect lines | yes |
examples/algorithms/dijkstra | 3 | expect lines | two of three; see below |
examples/temporal/leader | 4 | reasoning in text.rs | yes |
examples/temporal/leader_events | 4 | reasoning in text.rs | yes |
dijkstra’s run ShowDijkstra for 5 State, 2 Process, 2 Mutex expect 1
is wrong in the file itself. Elinvar finds no instance, and so does Alloy
6.2.0, which reports that the command “was not satisfied against
expectation”. The file’s own check DijkstraPreventsDeadlocks ... expect 0 implies the same, and lock ordering rules a deadlock out by hand: a
process waits only for a mutex above every one it holds.
The oracle also found bugs in Elinvar’s reading of model text, now fixed, each a constraint the text says and the reader dropped:
- In a signature’s fact, a field of an ancestor signature was read as the
whole relation, not as
this.f. Onexamples/systems/file_system.alsthat madecheck$1hold where Alloy finds a counterexample: a wrong “holds”. The testinherited_fields_in_signature_factsfailed before the fix (AGENTS.md law 28). - An arrow’s multiplicity in a quantifier’s declaration (
some tree: Node lone -> Node) anddisjamong a signature’s fields were read as nothing. Onexamples/case_studies/firewire.alsthat gave instances and counterexamples Alloy does not have. A counterexample from a model with a dropped constraint is a real counterexample to the weaker model, which is why the referee could not catch it; the oracle could.
All remaining models that open util/ordering, util/graph, util/boolean,
util/relation, or local modules (hotel1 to hotel4, the appendix E hotels,
addressBook3a to 3d, ringElection1 and 2, firewire, and the 17
integer models) now read unmodified and agree with Alloy in agrees_with_alloy.
The three checks of buffer (0.5 to 3.8 s each in a release build; Alloy
takes 11 to 73 s) are marked slow, so cargo x test skips them and
cargo x corpus runs them. ceilingsAndFloors at scope 10 runs in under
1 s and is part of cargo x test.