feat: Sublime syntax and Set potatoes example
Description
The code for this pull request contains:
-
the 3 sublime-syntax files for Penrose in
util/subl(to install them, simply go to "Preferences -> Browse packages" in ST3, then copy-paste the 3 files into theUserdirectory found there). -
an extra example directory, for "classical" Bourbaki-style "set potatoes", and functions/relations between them.
Implementation strategy and design decisions
Sublime: LexouDuck basically redid my shoddy work from scratch following the Penrose syntax specifications.
Set potatoes:
-
I tried to keep things simple (only 4 basic type: Set, Element, Relation, Arrow).
-
The main idea was to encourage the diagram to be neatly legible from left-to-right and use color, since there was some inevitable amount of overlap.
-
I provided some predicates which can remove overlap in the case of more complex diagrams (like with "triangularly related set trios", see image below).
-
Finally, I stored the relevant constant parameters in a
Globalnamespace, and neatly commented my code throughout.
Examples with steps to reproduce them
There are substance files for 5 examples, in increasing complexity:
-
a relation which is not a function
-
a diagram showing that an injection can have multiple post/left-inverses
-
a diagram showing that a surjection can have multiple pre/right-inverses (sections)
-
a diagram showing that a non-injection does not verify the monomorphism property
-
a diagram showing that a non-surjection does not verify the epimorphism property
An image of the last example for the heck of it:
Checklist
- [X] I have commented my code, particularly in hard-to-understand areas
- [X] I have reviewed any generated registry diagram changes
Open questions
Questions that require more discussion or to be addressed in future development:
-
syntax coloring does have some issues when a keyword is used somewhere it has a secondary meaning (e.g.:
stringorabove) -
not sure how to improve diagram color other than by just letting the colors be generated at random; if colors can be specified in the substance file like Labels are, then I couldn't figure out how to do it.
-
might want to allow a special "ellipsis" element for infinite sets in the future for the domain/style pair.
CI was failing for format (extra line returns in sublime-syntax files), so I ran yarn format and pushed that
Hi @Fulguritude , this look great, thanks for doing this!
Do you mind adding your new set-potatoes diagrams into the registry? Here's how.
Update: added 5 trio files, changed the registry.json (and only put one of the 5 diagrams, the one screenshot above, as a new gallery member since it'd be redundant otherwise). Will this do the trick ?
Yes it does! Thanks for this - once the automatic checks are done I'll do a final check before merging it