]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambda/terms/pointer_tree.ma
lambda: some refactoring + support for subsets of subterms started
[helm.git] / matita / matita / contribs / lambda / terms / 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 "terms/pointer_list.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 ptrt: Type[0] ≝
22 | tnil : ptrt
23 | tcons: ptrl → ptrt → ptrt → ptrt
24 .
25
26 let rec length (P:ptrt) on P ≝ match P with
27 [ tnil          ⇒ 0
28 | tcons s Q1 Q2 ⇒ length Q2 + length Q1 + |s|
29 ].
30
31 interpretation "pointer tree length" 'card P = (length P).