X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;ds=inline;f=matita%2Fmatita%2Flib%2Flambda%2Fterms%2Fsize.ma;fp=matita%2Fmatita%2Flib%2Flambda%2Fterms%2Fsize.ma;h=1fd9a060e08301212d06383929aa8d3fe1f1eef4;hb=aa9654656f7d0aeb9345e0b86a9e35f861687580;hp=0000000000000000000000000000000000000000;hpb=637ff9311e16f1d58e03d873f84c354e1cf1e716;p=helm.git diff --git a/matita/matita/lib/lambda/terms/size.ma b/matita/matita/lib/lambda/terms/size.ma new file mode 100644 index 000000000..1fd9a060e --- /dev/null +++ b/matita/matita/lib/lambda/terms/size.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 "terms/relocation.ma". + +(* SIZE *********************************************************************) + +(* Note: this gives the number of abstractions and applications in M *) +let rec size M on M ≝ match M with +[ VRef i ⇒ 0 +| Abst A ⇒ size A + 1 +| Appl B A ⇒ (size B) + (size A) + 1 +]. + +interpretation "term size" + 'card M = (size M). + +lemma size_lift: ∀h,M,d. |↑[d, h] M| = |M|. +#h #M elim M -M normalize // +qed.