spock-cli 0.2.1

A model checker for specs that read like Rust: TLA's logic of actions, checked on every core in machine code
// A counter that counts up to 3 or starts over, and step properties that ask, with steps_to,
// which of the two a step is.
struct State { x: Int }

impl State {
    action init() -> State { State { x: 0 } }

    action up(self) -> State {
        require self.x < 3;
        State { x: self.x + 1 }
    }

    action reset(self) -> State {
        require self.x > 0;
        State { x: 0 }
    }

    action next(self) -> State {
        any { self.up(), self.reset() }
    }

    fn counts_or_resets(self, next: State) -> Bool {
        steps_to(self.up(), next) || steps_to(self.reset(), next)
    }

    // A reset violates it.
    fn counts(self, next: State) -> Bool {
        steps_to(self.up(), next)
    }
}

model either {
    init = State::init;
    next = State::next;
    step_properties = [State::counts_or_resets];
}

model up_only {
    init = State::init;
    next = State::next;
    step_properties = [State::counts];
}