]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/static_2/static/rex_drops.ma
update in ground_2, static_2, basic_2, apps_2, alpha_1
[helm.git] / matita / matita / contribs / lambdadelta / static_2 / static / rex_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_cext2.ma".
16 include "static_2/relocation/drops_sex.ma".
17 include "static_2/static/frees_drops.ma".
18 include "static_2/static/rex.ma".
19
20 (* GENERIC EXTENSION ON REFERRED ENTRIES OF A CONTEXT-SENSITIVE REALTION ****)
21
22 definition f_dedropable_sn: predicate (relation3 lenv term term) ≝
23                             λR. ∀b,f,L1,K1. ⇩*[b,f] L1 ≘ K1 →
24                             ∀K2,T. K1 ⪤[R,T] K2 → ∀U. ⇧*[f] T ≘ U →
25                             ∃∃L2. L1 ⪤[R,U] L2 & ⇩*[b,f] L2 ≘ K2 & L1 ≡[f] L2.
26
27 definition f_dropable_sn: predicate (relation3 lenv term term) ≝
28                           λR. ∀b,f,L1,K1. ⇩*[b,f] L1 ≘ K1 → 𝐔❪f❫ →
29                           ∀L2,U. L1 ⪤[R,U] L2 → ∀T. ⇧*[f] T ≘ U →
30                           ∃∃K2. K1 ⪤[R,T] K2 & ⇩*[b,f] L2 ≘ K2.
31
32 definition f_dropable_dx: predicate (relation3 lenv term term) ≝
33                           λR. ∀L1,L2,U. L1 ⪤[R,U] L2 →
34                           ∀b,f,K2. ⇩*[b,f] L2 ≘ K2 → 𝐔❪f❫ → ∀T. ⇧*[f] T ≘ U →
35                           ∃∃K1. ⇩*[b,f] L1 ≘ K1 & K1 ⪤[R,T] K2.
36
37 definition f_transitive_next: relation3 … ≝ λR1,R2,R3.
38                               ∀f,L,T. L ⊢ 𝐅+❪T❫ ≘ f →
39                               ∀g,I,K,n. ⇩*[n] L ≘ K.ⓘ[I] → ↑g = ⫱*[n] f →
40                               sex_transitive (cext2 R1) (cext2 R2) (cext2 R3) (cext2 R1) cfull g K I.
41
42 (* Properties with generic slicing for local environments *******************)
43
44 lemma rex_liftable_dedropable_sn (R):
45       (∀L. reflexive ? (R L)) →
46       d_liftable2_sn … lifts R → f_dedropable_sn R.
47 #R #H1R #H2R #b #f #L1 #K1 #HLK1 #K2 #T * #f1 #Hf1 #HK12 #U #HTU
48 elim (frees_total L1 U) #f2 #Hf2
49 lapply (frees_fwd_coafter … Hf2 … HLK1 … HTU … Hf1) -HTU #Hf
50 elim (sex_liftable_co_dedropable_sn … HLK1 … HK12 … Hf) -f1 -K1
51 /3 width=6 by cext2_d_liftable2_sn, cfull_lift_sn, ext2_refl, ex3_intro, ex2_intro/
52 qed-.
53
54 lemma rex_trans_next (R1) (R2) (R3):
55       rex_transitive R1 R2 R3 → f_transitive_next R1 R2 R3.
56 #R1 #R2 #R3 #HR #f #L1 #T #Hf #g #I1 #K1 #n #HLK #Hgf #I #H
57 generalize in match HLK; -HLK elim H -I1 -I
58 [ #I #_ #L2 #_ #I2 #H
59   lapply (ext2_inv_unit_sn … H) -H #H destruct
60   /2 width=1 by ext2_unit/
61 | #I #V1 #V #HV1 #HLK1 #L2 #HL12 #I2 #H
62   elim (ext2_inv_pair_sn … H) -H #V2 #HV2 #H destruct
63   elim (frees_inv_drops_next … Hf … HLK1 … Hgf) -f -HLK1 #f #Hf #Hfg
64   /5 width=5 by ext2_pair, sle_sex_trans, ex2_intro/
65 ]
66 qed.
67
68 (* Inversion lemmas with generic slicing for local environments *************)
69
70 (* Basic_2A1: uses: llpx_sn_inv_lift_le llpx_sn_inv_lift_be llpx_sn_inv_lift_ge *)
71 (* Basic_2A1: was: llpx_sn_drop_conf_O *)
72 lemma rex_dropable_sn (R): f_dropable_sn R.
73 #R #b #f #L1 #K1 #HLK1 #H1f #L2 #U * #f2 #Hf2 #HL12 #T #HTU
74 elim (frees_total K1 T) #f1 #Hf1
75 lapply (frees_fwd_coafter … Hf2 … HLK1 … HTU … Hf1) -HTU #H2f
76 elim (sex_co_dropable_sn … HLK1 … HL12 … H2f) -f2 -L1
77 /3 width=3 by ex2_intro/
78 qed-.
79
80 (* Basic_2A1: was: llpx_sn_drop_trans_O *)
81 (* Note: the proof might be simplified *)
82 lemma rex_dropable_dx (R): f_dropable_dx R.
83 #R #L1 #L2 #U * #f2 #Hf2 #HL12 #b #f #K2 #HLK2 #H1f #T #HTU
84 elim (drops_isuni_ex … H1f L1) #K1 #HLK1
85 elim (frees_total K1 T) #f1 #Hf1
86 lapply (frees_fwd_coafter … Hf2 … HLK1 … HTU … Hf1) -K1 #H2f
87 elim (sex_co_dropable_dx … HL12 … HLK2 … H2f) -L2
88 /4 width=9 by frees_inv_lifts, ex2_intro/
89 qed-.
90
91 (* Basic_2A1: uses: llpx_sn_inv_lift_O *)
92 lemma rex_inv_lifts_bi (R):
93       ∀L1,L2,U. L1 ⪤[R,U] L2 → ∀b,f. 𝐔❪f❫ →
94       ∀K1,K2. ⇩*[b,f] L1 ≘ K1 → ⇩*[b,f] L2 ≘ K2 →
95       ∀T. ⇧*[f] T ≘ U → K1 ⪤[R,T] K2.
96 #R #L1 #L2 #U #HL12 #b #f #Hf #K1 #K2 #HLK1 #HLK2 #T #HTU
97 elim (rex_dropable_sn … HLK1 … HL12 … HTU) -L1 -U // #Y #HK12 #HY
98 lapply (drops_mono … HY … HLK2) -b -f -L2 #H destruct //
99 qed-.
100
101 lemma rex_inv_lref_pair_sn (R):
102       ∀L1,L2,i. L1 ⪤[R,#i] L2 → ∀I,K1,V1. ⇩*[i] L1 ≘ K1.ⓑ[I]V1 →
103       ∃∃K2,V2. ⇩*[i] L2 ≘ K2.ⓑ[I]V2 & K1 ⪤[R,V1] K2 & R K1 V1 V2.
104 #R #L1 #L2 #i #HL12 #I #K1 #V1 #HLK1 elim (rex_dropable_sn … HLK1 … HL12 (#0)) -HLK1 -HL12 //
105 #Y #HY #HLK2 elim (rex_inv_zero_pair_sn … HY) -HY
106 #K2 #V2 #HK12 #HV12 #H destruct /2 width=5 by ex3_2_intro/
107 qed-.
108
109 lemma rex_inv_lref_pair_dx (R):
110       ∀L1,L2,i. L1 ⪤[R,#i] L2 → ∀I,K2,V2. ⇩*[i] L2 ≘ K2.ⓑ[I]V2 →
111       ∃∃K1,V1. ⇩*[i] L1 ≘ K1.ⓑ[I]V1 & K1 ⪤[R,V1] K2 & R K1 V1 V2.
112 #R #L1 #L2 #i #HL12 #I #K2 #V2 #HLK2 elim (rex_dropable_dx … HL12 … HLK2 … (#0)) -HLK2 -HL12 //
113 #Y #HLK1 #HY elim (rex_inv_zero_pair_dx … HY) -HY
114 #K1 #V1 #HK12 #HV12 #H destruct /2 width=5 by ex3_2_intro/
115 qed-.
116
117 lemma rex_inv_lref_pair_bi (R) (L1) (L2) (i):
118       L1 ⪤[R,#i] L2 →
119       ∀I1,K1,V1. ⇩*[i] L1 ≘ K1.ⓑ[I1]V1 →
120       ∀I2,K2,V2. ⇩*[i] L2 ≘ K2.ⓑ[I2]V2 →
121       ∧∧ K1 ⪤[R,V1] K2 & R K1 V1 V2 & I1 = I2.
122 #R #L1 #L2 #i #H12 #I1 #K1 #V1 #H1 #I2 #K2 #V2 #H2
123 elim (rex_inv_lref_pair_sn … H12 … H1) -L1 #Y2 #X2 #HLY2 #HK12 #HV12
124 lapply (drops_mono … HLY2 … H2) -HLY2 -H2 #H destruct
125 /2 width=1 by and3_intro/
126 qed-.
127
128 lemma rex_inv_lref_unit_sn (R):
129       ∀L1,L2,i. L1 ⪤[R,#i] L2 → ∀I,K1. ⇩*[i] L1 ≘ K1.ⓤ[I] →
130       ∃∃f,K2. ⇩*[i] L2 ≘ K2.ⓤ[I] & K1 ⪤[cext2 R,cfull,f] K2 & 𝐈❪f❫.
131 #R #L1 #L2 #i #HL12 #I #K1 #HLK1 elim (rex_dropable_sn … HLK1 … HL12 (#0)) -HLK1 -HL12 //
132 #Y #HY #HLK2 elim (rex_inv_zero_unit_sn … HY) -HY
133 #f #K2 #Hf #HK12 #H destruct /2 width=5 by ex3_2_intro/
134 qed-.
135
136 lemma rex_inv_lref_unit_dx (R):
137       ∀L1,L2,i. L1 ⪤[R,#i] L2 → ∀I,K2. ⇩*[i] L2 ≘ K2.ⓤ[I] →
138       ∃∃f,K1. ⇩*[i] L1 ≘ K1.ⓤ[I] & K1 ⪤[cext2 R,cfull,f] K2 & 𝐈❪f❫.
139 #R #L1 #L2 #i #HL12 #I #K2 #HLK2 elim (rex_dropable_dx … HL12 … HLK2 … (#0)) -HLK2 -HL12 //
140 #Y #HLK1 #HY elim (rex_inv_zero_unit_dx … HY) -HY
141 #f #K2 #Hf #HK12 #H destruct /2 width=5 by ex3_2_intro/
142 qed-.