有更好的 Alloy 树模型吗?

Is there a better Alloy model of a tree?

我创建了一个树模型。见下文。有更好的模型吗? "better" 我的意思是更简单。

sig Node {
    tree: set Node
}

one sig root extends Node {}

fact {
    // No node above root (no node maps to root)
    no tree.root
    // Can reach all nodes from root                
    all n: Node - root | n in root.^tree
    // No node maps to itself (irreflexive) 
    no iden & tree
    // No cycles                    
    no n: Node | Node in n.^tree
    // All nodes are distinct (injective)           
    tree.~tree in iden
}

这有什么不简单的?您可以简化约束:

sig Node {
    tree: set Node
}

one sig root extends Node {}

pred CostelloTree {
    // No node above root (no node maps to root)
    no tree.root
    // Can reach all nodes from root                
    all n: Node - root | n in root.^tree
    // No node maps to itself (irreflexive) 
    no iden & tree
    // No cycles                    
    no n: Node | Node in n.^tree
    // All nodes are distinct (injective)           
    tree.~tree in iden
}

pred DJTree {
    Node in root.*tree // all reachable
    no iden & ^tree // no cycles
    tree in Node lone -> Node // at most one parent
    }

check {CostelloTree iff DJTree}