A counting function for trees and lists of trees.

We define a type of trees based on lists of trees. In this type, an node can have an arbitrary (but finite) number of children, grouped in a list.

Require Export List.

Inductive ltree (A:Set) : Set :=
    lnode : A -> list (ltree A)-> ltree A.

For this type, define a function count that counts the number of nodes in a tree.

Solution

Look at this file


Going home
Pierre Castéran