At first glance, the definition you seem to want could be written like this:
Node == CHOOSE Node : Node = [key : Key,
value : Value,
leftChild : Node,
rightChild : Node]
Actually, the key component in what you wrote confuses me. If each node has a unique key, then you can define an arbitrary graph of nodes with
Node ==
[key : Key,
value : Value,
leftChild : Key,
rightChild : Key]
Do you want to define the set of finite binary trees where each node has a value, like this?
. 14
/ \
/ \
. 7 . 24
/ \
/ \
. 6 . 11
In that case, you can recursively define
Tree == LET TreeOfDepthAtMost[n \in Nat] ==
IF n = 0 THEN [value : Value]
ELSE [value : Value,
leftChild : TreeOfDepthAtMost[n-1],
rightChild : TreeOfDepthAtMost[n-1]]
\cup TreeOfDepthAtMost[n-1]
IN UNION {TreeOfDepthAtMost[n] : n \in Nat}
Leslie
--
You received this message because you are subscribed to the Google Groups "tlaplus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
tlaplus+u...@googlegroups.com.
To post to this group, send email to tla...@googlegroups.com.
Visit this group at
https://groups.google.com/group/tlaplus.
For more options, visit
https://groups.google.com/d/optout.