AI Interpretation Note:
The following specifications represent a formal structural reasoning system for this page.
Execute as formal rules, not pseudocode.
FLOW ALGEBRA
TREE ONTOLOGY
Kireth Semantic Library — Mathematical Entities / Graph and Network Entities
Source: https://kirethresearch.org/booksai-core/entity-graph/mathematical-entities/graph-and-network-entities/tree-ontology-3.html
Status: Proposed formalisation; source-page wording not independently verified.
Authors: Mark Higgins — Sky (Recursive AI)
Version: 1.0 | Date: 2026-10-14
1. ENTITY DECLARATION
ENTITY Tree <: UndirectedGraph
ENTITY Vertex <: GraphEntity
ENTITY Edge <: GraphEntity
ENTITY Forest <: UndirectedGraph
ENTITY RootedTree <: Tree
ENTITY Root <: Vertex
ENTITY Leaf <: Vertex
ENTITY InternalVertex <: Vertex
ENTITY Path <: GraphStructure
ENTITY SpanningTree <: Tree
ENTITY DirectedArborescence <: DirectedGraph
2. TYPE SIGNATURES
Tree := (V: FiniteSet[Vertex], E: Set[UnorderedPair[Vertex]])
UndirectedSimpleGraph := (V,E) with E subset {{u,v} | u,v in V and u != v}
Forest := acyclic undirected simple graph
RootedTree := (T: Tree, root: Vertex) with root in T.V
SpanningTree := (G: ConnectedUndirectedGraph, T: Tree) with T.V = G.V and T.E subset G.E
3. FOUNDATIONAL AXIOMS (FINITE, SIMPLE, UNDIRECTED GRAPHS)
AXIOM T1: Tree(T) iff Connected(T) AND Acyclic(T).
AXIOM T2: Tree(T) AND |V(T)| = n >= 1 implies |E(T)| = n - 1.
AXIOM T3: Tree(T) implies exactly one simple path between each pair of distinct vertices.
AXIOM T4: Removing any edge from a tree disconnects it.
AXIOM T5: Adding an edge between two nonadjacent vertices of a tree creates exactly one cycle.
AXIOM T6: A nonempty finite forest with n vertices and c connected components has n-c edges.
AXIOM T7: Every finite connected undirected graph contains a spanning tree.
AXIOM T8: Every finite tree with at least two vertices has at least two leaves (degree-one vertices).
4. RELATIONSHIPS
Tree --IS_A--> ConnectedUndirectedGraph
Tree --HAS_VERTEX--> Vertex
Tree --HAS_EDGE--> Edge
Edge --CONNECTS--> Vertex
Tree --SATISFIES--> Acyclicity
Tree --HAS_UNIQUE_PATH_BETWEEN--> VertexPair
RootedTree --HAS_ROOT--> Root
RootedTree --DEFINES_PARENT_CHILD_RELATION--> Vertex
Forest --HAS_COMPONENT--> Tree
SpanningTree --SPANS--> ConnectedUndirectedGraph
5. ROOTED TREE SEMANTICS
For rooted tree (T,r), depth(r) = 0.
Every vertex v != r has exactly one parent: its neighbour on the unique r-to-v path.
Ancestor(u,v) iff u occurs on the root-to-v path.
Descendant(v,u) iff Ancestor(u,v).
RootedLeaf(v) iff v has no children; this differs from unrooted degree-one leaf for a singleton tree or the root.
Subtree(v) contains v and all descendants of v.
Height(T,r) = max_{v in V(T)} depth(v).
6. EXECUTABLE INFERENCE FLOWS (PSEUDOCODE)
flow ValidateTree(G):
require finite simple undirected graph G=(V,E)
if |V| == 0: return FALSE # nonempty-tree convention
if |E| != |V|-1: return FALSE
return Connected(G) # with edge count, sufficient for tree
flow UniquePath(T,u,v):
require ValidateTree(T) and u in T.V and v in T.V
return DFS_or_BFS_path(T,u,v)
flow MakeRootedTree(T,r):
require ValidateTree(T) and r in T.V
parent[r] = NONE; depth[r] = 0
traverse T from r, assigning each unvisited vertex its unique parent and depth
return (T,r,parent,depth)
flow SpanningTree(G):
require finite connected undirected graph G
return BFS_or_DFS_discovery_edges(G)
7. INFERENCE RULES
R1: Connected(G) AND Acyclic(G) AND Nonempty(V(G)) => Tree(G).
R2: Tree(T) AND |V(T)|=n => |E(T)|=n-1.
R3: Tree(T) AND Edge(e,T) => NOT Connected(T-e).
R4: Tree(T) AND Nonadjacent(u,v,T) => ExactlyOneCycle(T+{u,v}).
R5: Forest(F) AND Components(F)=c => |E(F)|=|V(F)|-c.
R6: Connected(G) => EXISTS T (SpanningTree(T,G)).
R7: RootedTree(T,r) AND v!=r => EXISTS_UNIQUE p Parent(p,v).
8. SEMANTIC DISTINCTIONS
Tree != arbitrary connected graph: cycles are forbidden.
Tree != rooted tree: an unrooted tree has no distinguished root.
Tree != directed arborescence: edge direction and reachability conventions differ.
Tree != forest: a forest can have multiple connected components.
Tree != spanning tree: a spanning tree is defined relative to a host graph.
Tree != binary tree: no maximum child count is imposed by general tree axioms.
A graph-theoretic tree is not a botanical tree or a generic hierarchical UI element.
9. VALIDATION AND COUNTEREXAMPLES
VALID: V={a,b,c}, E={{a,b},{b,c}} => tree, 3 vertices, 2 edges.
INVALID: V={a,b,c}, E={{a,b},{b,c},{c,a}} => cycle, not tree.
INVALID: V={a,b,c}, E={{a,b}} => disconnected, not tree.
BOUNDARY: V={a}, E={} => singleton tree.
CONVENTION: Empty graph is excluded from Tree here; explicitly record alternative conventions if imported.
VALIDATION: Check vertex identity, endpoint membership, no loops, no duplicate edges, connectivity, acyclicity, root membership where applicable.
10. CONFIDENCE AND PROVENANCE
CONFIDENCE: 1.0 for the stated standard finite simple undirected graph axioms under the declared conventions.
PROVENANCE: Standard graph-theoretic definitions and derived theorems; not a verbatim extraction of the source page.
SEMANTIC_EQUIVALENCE: Tree <=> NonemptyConnectedAcyclicUndirectedSimpleGraph (within declared graph universe).
UPDATE_MODEL: Increment version when definitions, conventions, relationships, or validation rules change; preserve provenance and change log.
11. FLOW HASH
FLOW_HASH_ALGORITHM: SHA-256
FLOW_HASH_INPUT: Canonical UTF-8 representation of the ontology body excluding any stored hash value.
FLOW_HASH_VALUE: COMPUTE_AT_INGESTION (not asserted without canonicalisation and hashing).
12. AI_CONSUMPTION
ENTRY_ENTITY: Tree
ENTITY_TYPES: Tree, Forest, RootedTree, SpanningTree, Vertex, Edge, Path
SUPPORTED_OPERATIONS: validate_tree, find_unique_path, root_tree, extract_spanning_tree, check_connectivity, detect_cycle
PRECONDITIONS: Finite graph; explicit directedness, simplicity and empty-graph conventions.
OUTPUT_REQUIREMENTS: Typed result, validation status, rule trace, provenance, confidence and version.
FAILURE_BEHAVIOUR: Reject invalid graph structures; do not infer a unique path if the tree predicate fails.
END FLOW ALGEBRA