Open GregGelfond opened 1 month ago
The definition of sets is supported with the following syntax: set_name "is a set." and you can define the elements (which, currently, can only be strings) of the set by the following syntax: set_name "contains" list_of_elements .
You can have for example:
Grid_Square is a set.
Grid_Square contains c1, c2.
Moreover, set definition, as for the concept definitions, should go at the beginning of the declaration:
Row goes from 1 to 9.
Column goes from 1 to 9.
Value goes from 1 to 9.
grid_square goes from 1 to 9.
A cell is identified by an id, and has a row, and a column.
Grid_Square is a set.
Grid_Square contains c1, c2.
There is a cell c1 with row equal to 1, and with column equal to 1.
There is a cell c2 with row equal to 1, and with column equal to 2.
In your example you have this:
grid_square goes from 1 to 9.
...
Grid_Square is a set.
In this situation, is the symbol grid_square
the name of a type inhabited by the positive integers 1..9
or is it the name of a single set?
Sorry, I made a mistake. Names must be unique and they are case insensitive, thus the example is wrong and the symbols should have different names.
I also fixed a bug in using multiple sets, so please update to the latest release.
Consider the following initial declarations:
These compile pretty much as expected:
Suppose I want to say that
grid_square 1
contains cellsc1
andc2
.Adding the following:
gives the following syntax error:
If I change the line to:
I get the expected rules:
If I however try to use the shorthand (set initialization syntax):
Then I have a miscompile: