Created
May 21, 2020 19:13
-
-
Save note/6198d7d3e01fd8220cd683b1f4320d5d to your computer and use it in GitHub Desktop.
Alloy tutorial: Static modelling: Einstein's riddle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open util/ordering[House] | |
enum Color {Red, White, Blue, Green, Yellow} | |
enum Pet {Birds, Cats, Dogs, Fish, Horses} | |
enum Cigar {Blend, BlueMaster, Dunhill, PallMall, Prince} | |
enum Beverage {Beer, Coffee, Milk, Tea, Water} | |
sig House { | |
color: disj Color | |
} | |
abstract sig Owner { | |
house: disj House, | |
pet: disj Pet, | |
cigar: disj Cigar, | |
beverage: disj Beverage | |
} | |
one sig Brit extends Owner {} | |
one sig Swede extends Owner {} | |
one sig Dane extends Owner {} | |
one sig Norwegian extends Owner {} | |
one sig German extends Owner {} | |
fact constraints { | |
one b: Brit | b.house.color = Red | |
one s: Swede | s.pet = Dogs | |
// TODO: add more predicates | |
#House = 5 | |
} | |
run {} for 5 | |
// https://udel.edu/~os/riddle.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@GonzaloBelvisi Here is an example of binary tree:
This BT can create instances like this: