🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.specification.z
Article #127

Re: Trees in Z (was: common data structures in Z

#127
From: Chris Flatters
Date: Tue, 26 Jan 1993 00:25
40 lines
1966 bytes
In article 5378@beaver.cs.washington.edu, jon@cs.washington.edu (Jon Jacky) writes:
>This generic schema summarizes some techniques I've seen.  You don't need to
>bother with free types, and you don't need recursive data structures.  Remember
>that any graph composed of nodes and arcs can be modelled by a relation.  A
>tree is just a special case:
>
>	+--Tree[Node]---------------------------
>	|  nodes: P Node
>	|  root: Node
>	|  parent: Node -+> Node
>	|  children: Node <-> Node
>	+---------------------------
>	|  root e nodes
>	|  dom parent U ran parent = nodes	
>	|  dom parent = nodes \ {root}
>	|  children = parent~
>	|  parent+ \cap id = empty
>	+--------------------------------------
>
>Parent is declared to be a function, not a relation, to say that a node can
>have only one parent.
>
>In order, the predicates say:
>
>- The root is a node.
>- All the nodes are connected, and everything that is connected is in nodes.
>- Every node except the root has a parent.
>- The children relation is just the inverse of the parent function.
>- There aren't any cycles - no node is its own ancestor.   This is expressed
>  by saying the transitive closure of parent doesn't intersect the identity
>  function.  
>
>I think that does it.

No.  In the general case the ordering of the subtrees rooted at a given node
is significant.  At the very least children would have to have the type
Node -> seq Node.  

	Chris Flatters
	cflatter@nrao.edu
Technical Details
Message-ID: <1993Jan26.002530.20610@zia.aoc.nrao.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!gatech!destroyer!fmsrl7!lynx.unm.edu!zia.aoc.nrao.edu!laphroaig!cflatter
References: <1993Jan25.195022.5378@beaver.cs.washington.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.specification.z
Path: arc1-ca.pugleaf.net!sparky!uunet!gatech!destroyer!fmsrl7!lynx.unm.edu!zia.aoc.nrao.edu!laphroaig!cflatter
From: cflatter@nrao.edu (Chris Flatters)
Subject: Re: Trees in Z (was: common data structures in Z
Message-ID: <1993Jan26.002530.20610@zia.aoc.nrao.edu>
Sender: news@zia.aoc.nrao.edu
Reply-To: cflatter@nrao.edu
Organization: NRAO
References: <1993Jan25.195022.5378@beaver.cs.washington.edu>
Date: Tue, 26 Jan 93 00:25:30 GMT
Lines: 40