Here is the formal definition of a tree. It is a little dry, confusing and boring, but in the end, this is what really counts!
We start with a set of nodes, let us use N to denote this. Then, we define a relation “parent of” in the form of P ⊆ N × N. A tree can, therefore, be represented by the tuple (N,P).
There is a number of restrictions on the relation P:
b. This means that the root r is not the
child of any other node. Furthermore, N must have at most one root. This means ∀a ∈ N − r : ∃(x,a) ∈ P.
A node n without a child is called a leave. In other words, if predicate L(n) states that n is a leave, then
∀n ∈ N : (∀(a,b) ∈ P : a
n) ⇔ L(n).
A tree without any nodes is called an empty tree.