You're viewing the readable version of this site. The interactive extras (search, diagrams, read-aloud) need JavaScript and a current browser. Enable JavaScript; if it is already enabled, update your browser.

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.

formal-methods, alloy, sat, assertions, counterexample, learn

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.

Interpretation — attach SAT to the question that produced it.

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

  • run searches for satisfying examples; check searches 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

  1. Retrieval. Interpret all four combinations of run/check and SAT/UNSAT.
  2. Discrimination. Why is moving FixedBlocksStranger into a fact before checking suspicious?
  3. Transfer. Add a run showing the owner can read and state its expected verdict.

Worked answers

  1. Run SAT: example; run UNSAT: no example in scope; check SAT: counterexample; check UNSAT: no counterexample in scope.
  2. The fact removes refuting worlds by assumption, making the assertion circular.
  3. run OwnerCanRead { FixedPolicy Owner -> Document in Access.grants } for 5, expected SAT.

References

  1. AlloyTools. Alloy tutorial. — facts, predicates, assertions, run, and check
  2. AlloyTools. Alloy 6.2.0 release. — the checked tool version