]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/static/aaa.ma
- lambda_delta: programmed renaming to lambdadelta
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / static / aaa.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/aarity.ma".
16 include "basic_2/substitution/ldrop.ma".
17
18 (* ATONIC ARITY ASSIGNMENT ON TERMS *****************************************)
19
20 inductive aaa: lenv → term → predicate aarity ≝
21 | aaa_sort: ∀L,k. aaa L (⋆k) ⓪
22 | aaa_lref: ∀I,L,K,V,B,i. ⇩[0, i] L ≡ K. ⓑ{I} V → aaa K V B → aaa L (#i) B
23 | aaa_abbr: ∀a,L,V,T,B,A.
24             aaa L V B → aaa (L. ⓓV) T A → aaa L (ⓓ{a}V. T) A
25 | aaa_abst: ∀a,L,V,T,B,A.
26             aaa L V B → aaa (L. ⓛV) T A → aaa L (ⓛ{a}V. T) (②B. A)
27 | aaa_appl: ∀L,V,T,B,A. aaa L V B → aaa L T (②B. A) → aaa L (ⓐV. T) A
28 | aaa_cast: ∀L,V,T,A. aaa L V A → aaa L T A → aaa L (ⓝV. T) A
29 .
30
31 interpretation "atomic arity assignment (term)"
32    'AtomicArity L T A = (aaa L T A).
33
34 (* Basic inversion lemmas ***************************************************)
35
36 fact aaa_inv_sort_aux: ∀L,T,A. L ⊢ T ⁝ A → ∀k. T = ⋆k → A = ⓪.
37 #L #T #A * -L -T -A
38 [ //
39 | #I #L #K #V #B #i #_ #_ #k #H destruct
40 | #a #L #V #T #B #A #_ #_ #k #H destruct
41 | #a #L #V #T #B #A #_ #_ #k #H destruct
42 | #L #V #T #B #A #_ #_ #k #H destruct
43 | #L #V #T #A #_ #_ #k #H destruct
44 ]
45 qed.
46
47 lemma aaa_inv_sort: ∀L,A,k. L ⊢ ⋆k ⁝ A → A = ⓪.
48 /2 width=5/ qed-.
49
50 fact aaa_inv_lref_aux: ∀L,T,A. L ⊢ T ⁝ A → ∀i. T = #i →
51                        ∃∃I,K,V. ⇩[0, i] L ≡ K. ⓑ{I} V & K ⊢ V ⁝ A.
52 #L #T #A * -L -T -A
53 [ #L #k #i #H destruct
54 | #I #L #K #V #B #j #HLK #HB #i #H destruct /2 width=5/
55 | #a #L #V #T #B #A #_ #_ #i #H destruct
56 | #a #L #V #T #B #A #_ #_ #i #H destruct
57 | #L #V #T #B #A #_ #_ #i #H destruct
58 | #L #V #T #A #_ #_ #i #H destruct
59 ]
60 qed.
61
62 lemma aaa_inv_lref: ∀L,A,i. L ⊢ #i ⁝ A →
63                     ∃∃I,K,V. ⇩[0, i] L ≡ K. ⓑ{I} V & K ⊢ V ⁝ A.
64 /2 width=3/ qed-.
65
66 fact aaa_inv_abbr_aux: ∀L,T,A. L ⊢ T ⁝ A → ∀a,W,U. T = ⓓ{a}W. U →
67                        ∃∃B. L ⊢ W ⁝ B & L. ⓓW ⊢ U ⁝ A.
68 #L #T #A * -L -T -A
69 [ #L #k #a #W #U #H destruct
70 | #I #L #K #V #B #i #_ #_ #a #W #U #H destruct
71 | #b #L #V #T #B #A #HV #HT #a #W #U #H destruct /2 width=2/
72 | #b #L #V #T #B #A #_ #_ #a #W #U #H destruct
73 | #L #V #T #B #A #_ #_ #a #W #U #H destruct
74 | #L #V #T #A #_ #_ #a #W #U #H destruct
75 ]
76 qed.
77
78 lemma aaa_inv_abbr: ∀a,L,V,T,A. L ⊢ ⓓ{a}V. T ⁝ A →
79                     ∃∃B. L ⊢ V ⁝ B & L. ⓓV ⊢ T ⁝ A.
80 /2 width=4/ qed-.
81
82 fact aaa_inv_abst_aux: ∀L,T,A. L ⊢ T ⁝ A → ∀a,W,U. T = ⓛ{a}W. U →
83                        ∃∃B1,B2. L ⊢ W ⁝ B1 & L. ⓛW ⊢ U ⁝ B2 & A = ②B1. B2.
84 #L #T #A * -L -T -A
85 [ #L #k #a #W #U #H destruct
86 | #I #L #K #V #B #i #_ #_ #a #W #U #H destruct
87 | #b #L #V #T #B #A #_ #_ #a #W #U #H destruct
88 | #b #L #V #T #B #A #HV #HT #a #W #U #H destruct /2 width=5/
89 | #L #V #T #B #A #_ #_ #a #W #U #H destruct
90 | #L #V #T #A #_ #_ #a #W #U #H destruct
91 ]
92 qed.
93
94 lemma aaa_inv_abst: ∀a,L,W,T,A. L ⊢ ⓛ{a}W. T ⁝ A →
95                     ∃∃B1,B2. L ⊢ W ⁝ B1 & L. ⓛW ⊢ T ⁝ B2 & A = ②B1. B2.
96 /2 width=4/ qed-.
97
98 fact aaa_inv_appl_aux: ∀L,T,A. L ⊢ T ⁝ A → ∀W,U. T = ⓐW. U →
99                        ∃∃B. L ⊢ W ⁝ B & L ⊢ U ⁝ ②B. A.
100 #L #T #A * -L -T -A
101 [ #L #k #W #U #H destruct
102 | #I #L #K #V #B #i #_ #_ #W #U #H destruct
103 | #a #L #V #T #B #A #_ #_ #W #U #H destruct
104 | #a #L #V #T #B #A #_ #_ #W #U #H destruct
105 | #L #V #T #B #A #HV #HT #W #U #H destruct /2 width=3/
106 | #L #V #T #A #_ #_ #W #U #H destruct
107 ]
108 qed.
109
110 lemma aaa_inv_appl: ∀L,V,T,A. L ⊢ ⓐV. T ⁝ A →
111                     ∃∃B. L ⊢ V ⁝ B & L ⊢ T ⁝ ②B. A.
112 /2 width=3/ qed-.
113
114 fact aaa_inv_cast_aux: ∀L,T,A. L ⊢ T ⁝ A → ∀W,U. T = ⓝW. U →
115                        L ⊢ W ⁝ A ∧ L ⊢ U ⁝ A.
116 #L #T #A * -L -T -A
117 [ #L #k #W #U #H destruct
118 | #I #L #K #V #B #i #_ #_ #W #U #H destruct
119 | #a #L #V #T #B #A #_ #_ #W #U #H destruct
120 | #a #L #V #T #B #A #_ #_ #W #U #H destruct
121 | #L #V #T #B #A #_ #_ #W #U #H destruct
122 | #L #V #T #A #HV #HT #W #U #H destruct /2 width=1/
123 ]
124 qed.
125
126 lemma aaa_inv_cast: ∀L,W,T,A. L ⊢ ⓝW. T ⁝ A →
127                     L ⊢ W ⁝ A ∧ L ⊢ T ⁝ A.
128 /2 width=3/ qed-.