\[ \newcommand{\tr}{\Rightarrow} \newcommand{\trs}{\tr^{\!\ast}} \newcommand{\rlnm}[1]{\mathsf{(#1)}} \newcommand{\rred}[1]{\xrightarrow{#1}} \newcommand{\rreds}[1]{\mathrel{\xrightarrow{#1}\!\!^*}} \newcommand{\cl}{\mathsf{Cl}} \newcommand{\pow}{\mathcal{P}} \newcommand{\matches}{\mathrel{\mathsf{matches}}} \newcommand{\kw}[1]{\mathsf{#1}} \]

Tree grammars

A tree grammar consists of four pieces of data:

  • A finite set of non-terminal symbols
  • A set of ranked terminal symbols
  • A finite set of production rules.
  • A designated starting non-terminal symbol.

A tree $t$ is said to be valid according to the grammar, just if it can be derived from the starting non-terminal symbol by a finite sequence of replacements.