hey, it’s git time again! I’m picking back up from the model from No instances of Tree—why?, which now looks like this:
sig Object {}
sig Tree {
children: some (Object + Tree)
}
fact {
no t: Tree | t in t.^children
}
pred Default {}
run Default for 3
instead of moving on to model git’s commits immediately, I’m pausing here to make sure my model’s trees do not do anything that real git trees couldn’t. After producing a bunch of instances, I see that my model can produce this instance:
But I can’t produce it by manipulating objects in git
! Hooray for content-addressed stores, I guess.
I think the thing I want to say is “there are no two trees with the same children”. The thing I’m trying naively is adding the following fact to the fact
block in the model above:
no t, u: Tree | t.children = u.children
but when I run that, I just get a bunch of empty trees, so I suspect that this does not do the thing I think it does! I sat down and thought about how .
works, and my best guess is that I’m actually asking something about the nature of the children rather than the nature of the trees.
So, two questions:
- how do I enact the intent I described above?
- what is the code I wrote actually doing?