]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/static_2/static/aaa_drops.ma
update in ground
[helm.git] / matita / matita / contribs / lambdadelta / static_2 / static / aaa_drops.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 "static_2/relocation/drops_drops.ma".
16 include "static_2/s_computation/fqup_weight.ma".
17 include "static_2/s_computation/fqup_drops.ma".
18 include "static_2/static/aaa.ma".
19
20 (* ATONIC ARITY ASSIGNMENT ON TERMS *****************************************)
21
22 (* Advanced properties ******************************************************)
23
24 (* Basic_2A1: was: aaa_lref *)
25 lemma aaa_lref_drops: ∀I,G,K,V,B,i,L. ⇩[i] L ≘ K.ⓑ[I]V → ❨G,K❩ ⊢ V ⁝ B → ❨G,L❩ ⊢ #i ⁝ B.
26 #I #G #K #V #B #i elim i -i
27 [ #L #H lapply (drops_fwd_isid … H ?) -H //
28   #H destruct /2 width=1 by aaa_zero/
29 | #i #IH #L <pr_uni_succ #H #HB lapply (drops_inv_bind2_isuni_next … H) -H // *
30   #Z #Y #HY #H destruct /3 width=1 by aaa_lref/
31 ]
32 qed.
33
34 (* Advanced inversion lemmas ************************************************)
35
36 (* Basic_2A1: was: aaa_inv_lref *)
37 lemma aaa_inv_lref_drops: ∀G,A,i,L. ❨G,L❩ ⊢ #i ⁝ A →
38                           ∃∃I,K,V. ⇩[i] L ≘ K.ⓑ[I]V & ❨G,K❩ ⊢ V ⁝ A.
39 #G #A #i elim i -i
40 [ #L #H elim (aaa_inv_zero … H) -H /3 width=5 by drops_refl, ex2_3_intro/
41 | #i #IH #L #H elim (aaa_inv_lref … H) -H
42   #I #K #H #HA destruct elim (IH … HA) -IH -HA /3 width=5 by drops_drop, ex2_3_intro/
43 ]
44 qed-.
45
46 lemma aaa_pair_inv_lref (G) (L) (i):
47       ∀A. ❨G,L❩ ⊢ #i ⁝ A → ∀I,K,V. ⇩[i] L ≘ K.ⓑ[I]V → ❨G,K❩ ⊢ V ⁝ A.
48 #G #L #i #A #H #I #K #V #HLK
49 elim (aaa_inv_lref_drops … H) -H #J #Y #X #HLY #HX
50 lapply (drops_mono … HLY … HLK) -L -i #H destruct //
51 qed-.
52
53 (* Properties with generic slicing for local environments *******************)
54
55 (* Basic_2A1: includes: aaa_lift *)
56 (* Note: it should use drops_split_trans_pair2 *)
57 lemma aaa_lifts: ∀G,L1,T1,A. ❨G,L1❩ ⊢ T1 ⁝ A → ∀b,f,L2. ⇩*[b,f] L2 ≘ L1 →
58                  ∀T2. ⇧*[f] T1 ≘ T2 → ❨G,L2❩ ⊢ T2 ⁝ A.
59 @(fqup_wf_ind_eq (Ⓣ)) #G0 #L0 #T0 #IH #G #L1 * *
60 [ #s #HG #HL #HT #A #H #b #f #L2 #HL21 #X #HX -b -IH
61   lapply (aaa_inv_sort … H) -H #H destruct
62   >(lifts_inv_sort1 … HX) -HX //
63 | #i1 #HG #HL #HT #A #H #b #f #L2 #HL21 #X #HX
64   elim (aaa_inv_lref_drops … H) -H #J #K1 #V1 #HLK1 #HA
65   elim (lifts_inv_lref1 … HX) -HX #i2 #Hf #H destruct
66   lapply (drops_trans … HL21 … HLK1 ??) -HL21 [1,2: // ] #H
67   elim (drops_split_trans … H) -H [ |*: /2 width=6 by pr_after_nat_uni/ ] #Y #HLK2 #HY
68   lapply (drops_tls_at … Hf … HY) -HY #HY -Hf
69   elim (drops_inv_skip2 … HY) -HY #Z #K2 #HK21 #HZ #H destruct
70   elim (liftsb_inv_pair_sn … HZ) -HZ #V2 #HV12 #H destruct
71   /4 width=12 by aaa_lref_drops, fqup_lref, drops_inv_gen/
72 | #l #HG #HL #HT #A #H #b #f #L2 #HL21 #X #HX -b -f -IH
73   elim (aaa_inv_gref … H)
74 | #p * #V1 #T1 #HG #HL #HT #A #H #b #f #L2 #HL21 #X #HX
75   [ elim (aaa_inv_abbr … H) -H #B #HB #HA
76     elim (lifts_inv_bind1 …  HX) -HX #V2 #T2 #HV12 #HT12 #H destruct
77     /5 width=9 by aaa_abbr, drops_skip, ext2_pair/
78   | elim (aaa_inv_abst … H) -H #B #A0 #HB #HA #H0
79     elim (lifts_inv_bind1 … HX) -HX #V2 #T2 #HV12 #HT12 #H destruct
80     /5 width=8 by aaa_abst, drops_skip, ext2_pair/
81   ]
82 | * #V1 #T1 #HG #HL #HT #A #H #b #f #L2 #HL21 #X #HX
83   [ elim (aaa_inv_appl … H) -H #B #HB #HA
84     elim (lifts_inv_flat1 …  HX) -HX #V2 #T2 #HV12 #HT12 #H destruct
85     /3 width=10 by aaa_appl/
86   | elim (aaa_inv_cast … H) -H #H1A #H2A
87     elim (lifts_inv_flat1 …  HX) -HX #V2 #T2 #HV12 #HT12 #H destruct
88     /3 width=8 by aaa_cast/
89   ]
90 ]
91 qed-.
92
93 (* Inversion lemmas with generic slicing for local environments *************)
94
95 (* Basic_2A1: includes: aaa_inv_lift *)
96 lemma aaa_inv_lifts: ∀G,L2,T2,A. ❨G,L2❩ ⊢ T2 ⁝ A → ∀b,f,L1. ⇩*[b,f] L2 ≘ L1 →
97                      ∀T1. ⇧*[f] T1 ≘ T2 → ❨G,L1❩ ⊢ T1 ⁝ A.
98 @(fqup_wf_ind_eq (Ⓣ)) #G0 #L0 #T0 #IH #G #L2 * *
99 [ #s #HG #HL #HT #A #H #b #f #L1 #HL21 #X #HX -b -IH
100   lapply (aaa_inv_sort … H) -H #H destruct
101   >(lifts_inv_sort2 … HX) -HX //
102 | #i2 #HG #HL #HT #A #H #b #f #L1 #HL21 #X #HX
103   elim (aaa_inv_lref_drops … H) -H #J #K2 #V2 #HLK2 #HA
104   elim (lifts_inv_lref2 … HX) -HX #i1 #Hf #H destruct
105   lapply (drops_split_div … HL21 (𝐔❨i1❩) ???) -HL21 [4: * |*: // ] #Y #HLK1 #HY
106   lapply (drops_conf … HLK2 … HY ??) -HY [1,2: /2 width=6 by pr_after_nat_uni/ ] #HY
107   lapply (drops_tls_at … Hf … HY) -HY #HY -Hf
108   elim (drops_inv_skip1 … HY) -HY #Z #K1 #HK21 #HZ #H destruct
109   elim (liftsb_inv_pair_dx … HZ) -HZ #V1 #HV12 #H destruct
110   /4 width=12 by aaa_lref_drops, fqup_lref, drops_inv_F/
111 | #l #HG #HL #HT #A #H #b #f #L1 #HL21 #X #HX -IH -b -f
112   elim (aaa_inv_gref … H)
113 | #p * #V2 #T2 #HG #HL #HT #A #H #b #f #L1 #HL21 #X #HX
114   [ elim (aaa_inv_abbr … H) -H #B #HB #HA
115     elim (lifts_inv_bind2 …  HX) -HX #V1 #T1 #HV12 #HT12 #H destruct
116     /5 width=9 by aaa_abbr, drops_skip, ext2_pair/
117   | elim (aaa_inv_abst … H) -H #B #A0 #HB #HA #H0
118     elim (lifts_inv_bind2 …  HX) -HX #V1 #T1 #HV12 #HT12 #H destruct
119     /5 width=8 by aaa_abst, drops_skip, ext2_pair/
120   ]
121 | * #V2 #T2 #HG #HL #HT #A #H #b #f #L1 #HL21 #X #HX
122   [ elim (aaa_inv_appl … H) -H #B #HB #HA
123     elim (lifts_inv_flat2 …  HX) -HX #V1 #T1 #HV12 #HT12 #H destruct
124     /3 width=10 by aaa_appl/
125   | elim (aaa_inv_cast … H) -H #H1A #H2A
126     elim (lifts_inv_flat2 …  HX) -HX #V1 #T1 #HV12 #HT12 #H destruct
127     /3 width=8 by aaa_cast/
128   ]
129 ]
130 qed-.