1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 (* Initial invocation: - Patience on us to gain peace and perfection! - *)
17 include "preamble.ma".
19 (* TERM STRUCTURE ***********************************************************)
21 (* Policy: term metavariables : A, B, C, D, M, N
22 depth metavariables: i, j
24 inductive term: Type[0] ≝
25 | VRef: nat → term (* variable reference by depth *)
26 | Abst: term → term (* function formation *)
27 | Appl: term → term → term (* function application *)
30 interpretation "term construction (variable reference by index)"
31 'VariableReferenceByIndex i = (VRef i).
33 interpretation "term construction (abstraction)"
34 'Abstraction A = (Abst A).
36 interpretation "term construction (application)"
37 'Application C A = (Appl C A).
39 notation "hvbox( # term 90 i )"
40 non associative with precedence 90
41 for @{ 'VariableReferenceByIndex $i }.
43 notation "hvbox( 𝛌 . term 46 A )"
44 non associative with precedence 46
45 for @{ 'Abstraction $A }.
47 notation "hvbox( @ term 46 C . break term 46 A )"
48 non associative with precedence 46
49 for @{ 'Application $C $A }.
51 definition compatible_abst: predicate (relation term) ≝ λR.
52 ∀A1,A2. R A1 A2 → R (𝛌.A1) (𝛌.A2).
54 definition compatible_sn: predicate (relation term) ≝ λR.
55 ∀A,B1,B2. R B1 B2 → R (@B1.A) (@B2.A).
57 definition compatible_dx: predicate (relation term) ≝ λR.
58 ∀B,A1,A2. R A1 A2 → R (@B.A1) (@B.A2).
60 definition compatible_appl: predicate (relation term) ≝ λR.
61 ∀B1,B2. R B1 B2 → ∀A1,A2. R A1 A2 →
64 lemma star_compatible_abst: ∀R. compatible_abst R → compatible_abst (star … R).
65 #R #HR #A1 #A2 #H elim H -A2 // /3 width=3/
68 lemma star_compatible_sn: ∀R. compatible_sn R → compatible_sn (star … R).
69 #R #HR #A #B1 #B2 #H elim H -B2 // /3 width=3/
72 lemma star_compatible_dx: ∀R. compatible_dx R → compatible_dx (star … R).
73 #R #HR #B #A1 #A2 #H elim H -A2 // /3 width=3/
76 lemma star_compatible_appl: ∀R. reflexive ? R →
77 compatible_appl R → compatible_appl (star … R).
78 #R #H1R #H2R #B1 #B2 #H elim H -B2 /3 width=1/ /3 width=5/