]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/lib/lambda/terms/term.ma
decentralized notation in lambda
[helm.git] / matita / matita / lib / lambda / terms / term.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 (* Initial invocation: - Patience on us to gain peace and perfection! - *)
16
17 include "lambda/background/preamble.ma".
18
19 include "lambda/notation/functions/variablereferencebyindex_1.ma".
20 include "lambda/notation/functions/abstraction_1.ma".
21 include "lambda/notation/functions/application_2.ma".
22
23 (* TERM STRUCTURE ***********************************************************)
24
25 (* Policy: term metavariables : A, B, C, D, M, N
26            depth metavariables: i, j
27 *)
28 inductive term: Type[0] ≝
29 | VRef: nat  → term        (* variable reference by depth *)
30 | Abst: term → term        (* function formation          *)
31 | Appl: term → term → term (* function application        *)
32 .
33
34 interpretation "term construction (variable reference by index)"
35    'VariableReferenceByIndex i = (VRef i).
36
37 interpretation "term construction (abstraction)"
38    'Abstraction A = (Abst A).
39
40 interpretation "term construction (application)"
41    'Application C A = (Appl C A).
42
43 definition compatible_abst: predicate (relation term) ≝ λR.
44                             ∀A1,A2. R A1 A2 → R (𝛌.A1) (𝛌.A2).
45
46 definition compatible_sn: predicate (relation term) ≝ λR.
47                           ∀A,B1,B2. R B1 B2 → R (@B1.A) (@B2.A).
48
49 definition compatible_dx: predicate (relation term) ≝ λR.
50                           ∀B,A1,A2. R A1 A2 → R (@B.A1) (@B.A2).
51
52 definition compatible_appl: predicate (relation term) ≝ λR.
53                             ∀B1,B2. R B1 B2 → ∀A1,A2. R A1 A2 →
54                             R (@B1.A1) (@B2.A2).
55
56 lemma star_compatible_abst: ∀R. compatible_abst R → compatible_abst (star … R).
57 #R #HR #A1 #A2 #H elim H -A2 // /3 width=3/
58 qed.
59
60 lemma star_compatible_sn: ∀R. compatible_sn R → compatible_sn (star … R).
61 #R #HR #A #B1 #B2 #H elim H -B2 // /3 width=3/
62 qed.
63
64 lemma star_compatible_dx: ∀R. compatible_dx R → compatible_dx (star … R).
65 #R #HR #B #A1 #A2 #H elim H -A2 // /3 width=3/
66 qed.
67
68 lemma star_compatible_appl: ∀R. reflexive ? R →
69                             compatible_appl R → compatible_appl (star … R).
70 #R #H1R #H2R #B1 #B2 #H elim H -B2 /3 width=1/ /3 width=5/
71 qed.