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 include "basic_2/relocation/drops.ma".
16 include "basic_2/static/aaa.ma".
18 (* ATONIC ARITY ASSIGNMENT ON TERMS *****************************************)
20 (* Properties with generic slicing for local environments *******************)
22 (* Basic_2A1: was: aaa_lref *)
23 lemma aaa_lref_gen: ∀I,G,K,V,B,i,L. ⬇*[i] L ≡ K.ⓑ{I}V → ⦃G, K⦄ ⊢ V ⁝ B → ⦃G, L⦄ ⊢ #i ⁝ B.
24 #I #G #K #V #B #i elim i -i
25 [ #L #H lapply (drops_fwd_isid … H ?) -H //
26 #H destruct /2 width=1 by aaa_zero/
27 | #i #IH #L <uni_succ #H #HB lapply (drops_inv_pair2_isuni_next … H) -H // *
28 #Z #Y #X #HY #H destruct /3 width=1 by aaa_lref/
32 (* Basic_2A1: includes: aaa_lift *)
33 lemma aaa_lifts: ∀G,L1,T1,A. ⦃G, L1⦄ ⊢ T1 ⁝ A → ∀L2,c,f. ⬇*[c, f] L2 ≡ L1 →
34 ∀T2. ⬆*[f] T1 ≡ T2 → ⦃G, L2⦄ ⊢ T2 ⁝ A.
35 #G #L1 #T1 #A #H elim H -G -L1 -T1 -A
36 [ #G #L1 #s #L2 #c #f #_ #T2 #H
37 >(lifts_inv_sort1 … H) -H //
38 | #I #G #L1 #V1 #B #_ #IHB #L2 #c #f #HL21 #T2 #H
39 elim (lifts_inv_lref1 … H) -H #i2 #Hi #H destruct
40 @aaa_lref_gen [5: @IHB ]
41 | #I #G #L1 #V1 #B #i1 #_ #IHB #L2 #c #f #HL21 #T2 #H
42 elim (lifts_inv_lref1 … H) -H #i2 #Hi #H destruct
43 lapply (at_inv_nxx … H)
48 | #I #G #L1 #K1 #V1 #B #i #HLK1 #_ #IHB #L2 #c #l #k #HL21 #T2 #H
49 elim (lift_inv_lref1 … H) -H * #Hil #H destruct
50 [ elim (drop_trans_le … HL21 … HLK1) -L1 /2 width=2 by ylt_fwd_le/ #X #HLK2 #H
51 elim (drop_inv_skip2 … H) -H /2 width=1 by ylt_to_minus/ -Hil #K2 #V2 #HK21 #HV12 #H destruct
52 /3 width=9 by aaa_lref/
53 | lapply (drop_trans_ge … HL21 … HLK1 ?) -L1
54 /3 width=9 by aaa_lref, drop_inv_gen/
56 | #a #G #L1 #V1 #T1 #B #A #_ #_ #IHB #IHA #L2 #c #l #k #HL21 #X #H
57 elim (lift_inv_bind1 … H) -H #V2 #T2 #HV12 #HT12 #H destruct
58 /4 width=5 by aaa_abbr, drop_skip/
59 | #a #G #L1 #V1 #T1 #B #A #_ #_ #IHB #IHA #L2 #c #l #k #HL21 #X #H
60 elim (lift_inv_bind1 … H) -H #V2 #T2 #HV12 #HT12 #H destruct
61 /4 width=5 by aaa_abst, drop_skip/
62 | #G #L1 #V1 #T1 #B #A #_ #_ #IHB #IHA #L2 #c #l #k #HL21 #X #H
63 elim (lift_inv_flat1 … H) -H #V2 #T2 #HV12 #HT12 #H destruct
64 /3 width=5 by aaa_appl/
65 | #G #L1 #V1 #T1 #A #_ #_ #IH1 #IH2 #L2 #c #l #k #HL21 #X #H
66 elim (lift_inv_flat1 … H) -H #V2 #T2 #HV12 #HT12 #H destruct
67 /3 width=5 by aaa_cast/
71 (* Inversion lemmas with generic slicing for local environments *************)
73 (* Basic_2A1: was: aaa_inv_lref *)
74 lemma aaa_inv_lref_gen: ∀G,A,i,L. ⦃G, L⦄ ⊢ #i ⁝ A →
75 ∃∃I,K,V. ⬇*[i] L ≡ K.ⓑ{I}V & ⦃G, K⦄ ⊢ V ⁝ A.
77 [ #L #H elim (aaa_inv_zero … H) -H /3 width=5 by drops_refl, ex2_3_intro/
78 | #i #IH #L #H elim (aaa_inv_lref … H) -H
79 #I #K #V #H #HA destruct elim (IH … HA) -IH -HA /3 width=5 by drops_drop, ex2_3_intro/
83 lemma aaa_inv_lift: ∀G,L2,T2,A. ⦃G, L2⦄ ⊢ T2 ⁝ A → ∀L1,c,l,k. ⬇[c, l, k] L2 ≡ L1 →
84 ∀T1. ⬆[l, k] T1 ≡ T2 → ⦃G, L1⦄ ⊢ T1 ⁝ A.
85 #G #L2 #T2 #A #H elim H -G -L2 -T2 -A
86 [ #G #L2 #s #L1 #c #l #k #_ #T1 #H
87 >(lift_inv_sort2 … H) -H //
88 | #I #G #L2 #K2 #V2 #B #i #HLK2 #_ #IHB #L1 #c #l #k #HL21 #T1 #H
89 elim (lift_inv_lref2 … H) -H * #Hil #H destruct
90 [ elim (drop_conf_lt … HL21 … HLK2) -L2 /3 width=9 by aaa_lref/
91 | lapply (drop_conf_ge … HL21 … HLK2 ?) -L2 /3 width=9 by aaa_lref/
93 | #a #G #L2 #V2 #T2 #B #A #_ #_ #IHB #IHA #L1 #c #l #k #HL21 #X #H
94 elim (lift_inv_bind2 … H) -H #V1 #T1 #HV12 #HT12 #H destruct
95 /4 width=5 by aaa_abbr, drop_skip/
96 | #a #G #L2 #V2 #T2 #B #A #_ #_ #IHB #IHA #L1 #c #l #k #HL21 #X #H
97 elim (lift_inv_bind2 … H) -H #V1 #T1 #HV12 #HT12 #H destruct
98 /4 width=5 by aaa_abst, drop_skip/
99 | #G #L2 #V2 #T2 #B #A #_ #_ #IHB #IHA #L1 #c #l #k #HL21 #X #H
100 elim (lift_inv_flat2 … H) -H #V1 #T1 #HV12 #HT12 #H destruct
101 /3 width=5 by aaa_appl/
102 | #G #L2 #V2 #T2 #A #_ #_ #IH1 #IH2 #L1 #c #l #k #HL21 #X #H
103 elim (lift_inv_flat2 … H) -H #V1 #T1 #HV12 #HT12 #H destruct
104 /3 width=5 by aaa_cast/