X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=matita%2Fmatita%2Fcontribs%2Flambda%2Flength.ma;fp=matita%2Fmatita%2Fcontribs%2Flambda%2Flength.ma;h=abb629433a9cb6d25c03d13ba5af17735030c72e;hb=5ca47b58902b9f2583ad1354b860c04ea62df46c;hp=0000000000000000000000000000000000000000;hpb=2199f327081f49b21bdcd23d702b5e07ea4f58ce;p=helm.git diff --git a/matita/matita/contribs/lambda/length.ma b/matita/matita/contribs/lambda/length.ma new file mode 100644 index 000000000..abb629433 --- /dev/null +++ b/matita/matita/contribs/lambda/length.ma @@ -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 "lift.ma". + +(* LENGTH *******************************************************************) + +(* Note: this gives the number of abstractions and applications in M *) +let rec length M on M ≝ match M with +[ VRef i ⇒ 0 +| Abst A ⇒ length A + 1 +| Appl B A ⇒ (length B) + (length A) + 1 +]. + +interpretation "term length" + 'card M = (length M). + +lemma length_lift: ∀h,M,d. |↑[d, h] M| = |M|. +#h #M elim M -M normalize // +qed.