]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambda-delta/Basic-2/grammar/lenv_weight.ma
- some refactoring
[helm.git] / matita / matita / contribs / lambda-delta / Basic-2 / grammar / lenv_weight.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 "Basic-2/grammar/term_weight.ma".
16 include "Basic-2/grammar/lenv.ma".
17
18 (* WEIGHTS ******************************************************************)
19
20 (* the weight of a local environment *)
21 let rec lw L ≝ match L with
22 [ LSort       ⇒ 0
23 | LPair L _ V ⇒ lw L + #V
24 ].
25
26 interpretation "weight (local environment)" 'Weight L = (lw L).
27
28 (* the weight of a closure *)
29 definition cw: lenv → term → ? ≝ λL,T. #L + #T.
30
31 interpretation "weight (closure)" 'Weight L T = (cw L T).
32
33 axiom cw_wf_ind: ∀P:lenv→term→Prop.
34                  (∀L2,T2. (∀L1,T1. #[L1,T1] < #[L2,T2] → P L1 T1) → P L2 T2) →
35                  ∀L,T. P L T.