]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambda/pointer_tree.ma
89d2122c2c6d3251a4c8873fdd9727a031b7bbf3
[helm.git] / matita / matita / contribs / lambda / pointer_tree.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 include "pointer_sequence.ma".
16
17 (* POINTER TREE *************************************************************)
18
19 (* Policy: pointer tree metavariables: P, Q *)
20 (* Note: this is a binary tree on pointer sequences *)
21 inductive ptree: Type[0] ≝
22 | tnil : ptree
23 | tcons: pseq → ptree → ptree → ptree
24 .
25
26 let rec size (P:ptree) on P ≝ match P with
27 [ tnil          ⇒ 0
28 | tcons s Q1 Q2 ⇒ size Q2 + size Q1 + |s|
29 ].
30
31 interpretation "pointer tree size" 'card P = (size P).