]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambda_delta/basic_2/grammar/term_weight.ma
d8f39a3a154de4d7c53ca040220ef80ee4a118e2
[helm.git] / matita / matita / contribs / lambda_delta / basic_2 / grammar / term_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.ma".
16
17 (* WEIGHT OF A TERM *********************************************************)
18
19 let rec tw T ≝ match T with
20 [ TAtom _     ⇒ 1
21 | TPair _ V T ⇒ tw V + tw T + 1
22 ].
23
24 interpretation "weight (term)" 'Weight T = (tw T).
25
26 (* Basic properties *********************************************************)
27
28 (* Basic_1: was: tweight_lt *)
29 lemma tw_pos: ∀T. 1 ≤ #{T}.
30 #T elim T -T //
31 qed.
32
33 (* Basic eliminators ********************************************************)
34
35 axiom tw_ind: ∀R:predicate term.
36               (∀T2. (∀T1. #{T1} < #{T2} → R T1) → R T2) →
37               ∀T. R T.
38
39 (* Basic_1: removed theorems 11:
40             wadd_le wadd_lt wadd_O weight_le weight_eq weight_add_O
41             weight_add_S tlt_trans tlt_head_sx tlt_head_dx tlt_wf_ind
42             removed local theorems 1: q_ind
43 *)