# No instances of Tree—why?

**URL:** https://alloytools.discourse.group/t/no-instances-of-tree-why/19
**Category:** models
**Created:** [August 12, 2020, 9:05pm UTC](https://alloytools.discourse.group/t/no-instances-of-tree-why/19 "2020-08-12T21:05:04Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![brianhicks](https://yyz2.discourse-cdn.com/free1/user_avatar/alloytools.discourse.group/brianhicks/32/5_2.png) [@brianhicks](https://alloytools.discourse.group/u/brianhicks)
#### Post date: [August 12, 2020, 9:05pm UTC](https://alloytools.discourse.group/t/no-instances-of-tree-why/19/1 "2020-08-12T21:05:04Z")

</div>

While modeling git objects, I came up with this model:

```auto
sig Object {}

sig Tree {
  children: set (Object + Tree)
}

fact {
  no t: Tree | t in t.*children
}

```

It produces instances, but none with any `Tree`. Alloy (well, Electrum) says “Predicate is consistent, contrary to expectation.”

What I’m _intending_ to do is say that a tree cannot be its own parent (which may itself be a bad assumption, but I couldn’t make that happen using `git hash-object` and friends.)

Where have I gone sideways here? It’s been a while since I read _Software Abstractions_, so a lot of this is trying to get the memory of how to do this back in my fingers.

---

<div class="post-metadata">

### Author: ![DanielJackson](https://yyz2.discourse-cdn.com/free1/user_avatar/alloytools.discourse.group/danieljackson/32/80_2.png) [@DanielJackson](https://alloytools.discourse.group/u/DanielJackson)
#### Post date: [August 12, 2020, 10:11pm UTC](https://alloytools.discourse.group/t/no-instances-of-tree-why/19/2 "2020-08-12T22:11:46Z")

</div>

Hi Brian,

Looks good, but you have one small snag here: the star is reflexive transitive closure, so t.\*children includes t, and will therefore never allow a tree to exist! Try using ^, transitive closure, instead.

Not sure why you get that message. Peter – can you help with this? I suspect it’s that an implicit run command (running when you have no explicit command) is incorrectly defaulting to expecting no instances.

---

<div class="post-metadata">

### Author: ![brianhicks](https://yyz2.discourse-cdn.com/free1/user_avatar/alloytools.discourse.group/brianhicks/32/5_2.png) [@brianhicks](https://alloytools.discourse.group/u/brianhicks)
#### Post date: [August 12, 2020, 10:28pm UTC](https://alloytools.discourse.group/t/no-instances-of-tree-why/19/3 "2020-08-12T22:28:33Z")

</div>

ahh, thanks. I tried `^` before (when trying the form `sig Tree { … } { assertion }` but hadn’t once I moved it to a separate `fact` block.

You intuition regarding the default command seems to have been correct as well; once I added an empty predicate and ran it the result goes to “Instance found. Predicate is consistent.”

---

<div class="post-metadata">

### Author: ![DanielJackson](https://yyz2.discourse-cdn.com/free1/user_avatar/alloytools.discourse.group/danieljackson/32/80_2.png) [@DanielJackson](https://alloytools.discourse.group/u/DanielJackson)
#### Post date: [August 13, 2020, 12:49am UTC](https://alloytools.discourse.group/t/no-instances-of-tree-why/19/4 "2020-08-13T00:49:19Z")

</div>

Great! Let us know how it goes and feel free to ask if you need more help…
