Skip to content
This repository has been archived by the owner on Jul 2, 2022. It is now read-only.

Fixing IsSensical() in hanoi example [Models->Constants] #37

Closed
vlebedev opened this issue Oct 13, 2017 · 3 comments
Closed

Fixing IsSensical() in hanoi example [Models->Constants] #37

vlebedev opened this issue Oct 13, 2017 · 3 comments

Comments

@vlebedev
Copy link

The implementation of IsSensical() assumption given in "Models->Constants" section won't catch the problem with TSPACES <- 3, TSIZE <- 3, SOLUTION <- <<<<1,2>>, <<>>, <<3,4>>>> which is the example you are discussing in this section.

So, instead of:

IsSensical(state) == /\ Len(state) = TSPACES \* Correct spaces
                     /\ \A n \in 1..TSIZE : \* All numbers appear
                        \E tower \in DOMAIN state:
                            \E disc \in DOMAIN state[tower]:
                                n = state[tower][disc] 

it's better to use the following:

  IsSensical(state) ==  /\ Len(state) = TSPACES \* Correct spaces
                        /\ \A tower \in DOMAIN state: \* Numbers do not exceed TSIZE
                            \A disc \in DOMAIN state[tower]:
                                state[tower][disc] \in 1..TSIZE
                        /\ \A n \in 1..TSIZE : \* All numbers appear
                            \E tower \in DOMAIN state:
                                \E disc \in DOMAIN state[tower]:
                                    n = state[tower][disc] 
@hwayne
Copy link
Owner

hwayne commented Oct 16, 2017

Haven't tried but ACKing the issue

@hwayne
Copy link
Owner

hwayne commented Oct 25, 2017

Yup, you're correct, fixing the issue now

@hwayne
Copy link
Owner

hwayne commented Oct 25, 2017

Fixed in 31b6232.

@hwayne hwayne closed this as completed Oct 25, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants