]> matita.cs.unibo.it Git - helm.git/blobdiff - 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
diff --git a/matita/matita/contribs/lambda/terms/pointer_tree.ma b/matita/matita/contribs/lambda/terms/pointer_tree.ma
new file mode 100644 (file)
index 0000000..fff98a8
--- /dev/null
@@ -0,0 +1,31 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "terms/pointer_list.ma".
+
+(* POINTER TREE *************************************************************)
+
+(* Policy: pointer tree metavariables: P, Q *)
+(* Note: this is a binary tree on pointer sequences *)
+inductive ptrt: Type[0] ≝
+| tnil : ptrt
+| tcons: ptrl → ptrt → ptrt → ptrt
+.
+
+let rec length (P:ptrt) on P ≝ match P with
+[ tnil          ⇒ 0
+| tcons s Q1 Q2 ⇒ length Q2 + length Q1 + |s|
+].
+
+interpretation "pointer tree length" 'card P = (length P).