Verification guide
Proving UI behavior
Turn an interface requirement into a predicate over state, views, or actions. The private ballot has rules for what the user sees, what an enabled action changes, and when a recipient may receive a message.
Prove a rule for every reachable screen
Suppose a ballot has a two-bit vote, a review phase, and a sealed phase. You want the displayed choice to match the stored vote and the share action to be available exactly during review. Give those requirements independent names.
view choice "Your choice" = vote
view review_status "In review" = reviewing
claim display_matches_vote = shown(choice) == vote
claim review_before_sharing = enabled(share) == (shown(review_status) and not sealed)
claim stage_exclusive = not (reviewing and sealed)Let I be the conjunction of every claim. The base case checks each claim after initialization for every legal external initializer. The induction step assumes I in a typed pre-state and checks every claim after each action for every typed input and mask. This covers arbitrarily long finite interaction histories.
The checker may find an inductive counterexample in a state your intended workflow would never reach. Inspect the state first. If a missing relationship excludes it, express that relationship as another claim and prove it from initialization along with the others.
To see a real failure, edit the supplied ballot so view choice reads confidence. A user can change one field without changing the other. The failure names display_matches_vote and an action whose result violates it.
Prove what happens on a click
action share "Confirm and split" when reviewing and not sealed
split vote to north, south
set reviewing = 0
set sealed = 1
ensures seals_once = sealed and not enabled(share)
ensures keeps_choice = vote == old(vote)
endThe first postcondition asks for a sealed result in which another share is disabled. The second compares the vote across this one transition. Both conditions are checked for every enabled invocation from a state satisfying I.
For a disabled invocation, the language itself preserves every field and emits no messages. To keep some property across all possible actions, such as disabling every editing action after sealing, state it as a claim. Each future action then has to preserve it.
In the supplied ballot, changing set sealed = 1 to set sealed = 0 violates seals_once. The solver’s model gives a witness. Names such as s.state.reviewing identify pre-state fields by name.
Prove when release is allowed
channel north on share only when reviewing and not sealed
channel south on share only when reviewing and not sealedEach policy states a one-way implication. Whenever a slot is present, the executed action must be share and the pre-state must satisfy its condition. An action with no output satisfies this policy even if the condition is true. A valid message of zero still triggers the check.
The action guard and channel rule have separate jobs. The guard defines behavior. The policy checks all actions against the release requirement, including an action someone adds later. Change the north policy to only when sealed. A legitimate share during review now fails channel policy / share / north.
These rules constrain message preparation. To prove delivery or a retry protocol, model acknowledgments and retries as events with explicit assumptions about the transport. The current language checks safety across transitions. It has no temporal operator for eventual delivery.
Reproduce a pass and a failure
In the extracted distribution, build the original. Make a separate copy and change just one of the declarations described above. A successful build prints the number of obligations and writes a receipt. A failing build prints the name of the first failed obligation and exits unsuccessfully.
bin/weft build examples/ballot.weft
bin/weft check examples/ballot.weft
cp examples/ballot.weft broken.weft
# Edit view choice in broken.weft to read confidence.
bin/weft build broken.weftOpen the complete ballot sourceRead its verified obligationsshown(choice) describes the component’s numeric output. Pixel positions, focus order, accessibility announcements, and whether a person understands the label depend on the page and its host.