Learn · All the Ways It Can Break
growing
Run Finds a World; Check Finds a Refutation
SAT means different things when the command asks for an example and when it challenges an assertion.
You will write predicates and assertions, execute run and check with Alloy 6.2.0, read SAT/UNSAT by command kind, and retain a usefulness witness beside a security check.
Grade every command
The executable commands are:
alloy code/all-the-ways-it-can-break/document-sharing/Sharing.als#commands Sharing.als The test declares the expected polarity for every command: SAT, UNSAT, SAT.
Run the model from the Analyzer or with the official distribution's command-line exec mode. Inspect the instance for BugBlocksStranger: the tuple Stranger -> Document is the refutation. Then inspect GuestCanRead: the same SAT label now denotes a desired witness.
Assertions do not constrain worlds
A fact always constrains every command. A predicate constrains a command only when invoked. An assertion states a claim to challenge; it does not make itself true. Moving a desired property into a fact before checking it makes the check vacuous because every counterexample was excluded by assumption.
Negative and positive controls
The buggy assertion is a negative control: a known bad policy must be refuted. The guest run is a positive witness: useful sharing remains satisfiable. The fixed check sits between them. Together they resist a disconnected assertion, an overconstrained model, and an allow-nobody “repair.”
Lessons
runsearches for satisfying examples;checksearches for assertion counterexamples.- SAT/UNSAT polarity depends on command kind.
- Facts constrain; predicates describe; assertions are challenged.
- Every command needs an expected verdict in automated evidence.
- A security check needs a usefulness witness to resist overconstraint.
Practice
- Retrieval. Interpret all four combinations of
run/checkandSAT/UNSAT. - Discrimination. Why is moving
FixedBlocksStrangerinto a fact before checking suspicious? - Transfer. Add a run showing the owner can read and state its expected verdict.
Worked answers
- Run SAT: example; run UNSAT: no example in scope; check SAT: counterexample; check UNSAT: no counterexample in scope.
- The fact removes refuting worlds by assumption, making the assertion circular.
run OwnerCanRead { FixedPolicy Owner -> Document in Access.grants } for 5, expected SAT.
References
- AlloyTools. Alloy tutorial. — facts, predicates, assertions, run, and check
- AlloyTools. Alloy 6.2.0 release. — the checked tool version