]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/static_2/static/lsubr.ma
e1a4fbacd49420a8b88ea27b0ce576701e836d1c
[helm.git] / matita / matita / contribs / lambdadelta / static_2 / static / lsubr.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/notation/relations/lrsubeqc_2.ma".
16 include "static_2/syntax/lenv.ma".
17
18 (* RESTRICTED REFINEMENT FOR LOCAL ENVIRONMENTS *****************************)
19
20 (* Basic_2A1: just tpr_cpr and tprs_cprs require the extended lsubr_atom *)
21 (* Basic_2A1: includes: lsubr_pair *)
22 inductive lsubr: relation lenv ≝
23 | lsubr_atom: lsubr (⋆) (⋆)
24 | lsubr_bind: ∀I,L1,L2. lsubr L1 L2 → lsubr (L1.ⓘ{I}) (L2.ⓘ{I})
25 | lsubr_beta: ∀L1,L2,V,W. lsubr L1 L2 → lsubr (L1.ⓓⓝW.V) (L2.ⓛW)
26 | lsubr_unit: ∀I1,I2,L1,L2,V. lsubr L1 L2 → lsubr (L1.ⓑ{I1}V) (L2.ⓤ{I2})
27 .
28
29 interpretation
30   "restricted refinement (local environment)"
31   'LRSubEqC L1 L2 = (lsubr L1 L2).
32
33 (* Basic properties *********************************************************)
34
35 lemma lsubr_refl: ∀L. L ⫃ L.
36 #L elim L -L /2 width=1 by lsubr_atom, lsubr_bind/
37 qed.
38
39 (* Basic inversion lemmas ***************************************************)
40
41 fact lsubr_inv_atom1_aux: ∀L1,L2. L1 ⫃ L2 → L1 = ⋆ → L2 = ⋆.
42 #L1 #L2 * -L1 -L2 //
43 [ #I #L1 #L2 #_ #H destruct
44 | #L1 #L2 #V #W #_ #H destruct
45 | #I1 #I2 #L1 #L2 #V #_ #H destruct
46 ]
47 qed-.
48
49 lemma lsubr_inv_atom1: ∀L2. ⋆ ⫃ L2 → L2 = ⋆.
50 /2 width=3 by lsubr_inv_atom1_aux/ qed-.
51
52 fact lsubr_inv_bind1_aux:
53      ∀L1,L2. L1 ⫃ L2 → ∀I,K1. L1 = K1.ⓘ{I} →
54      ∨∨ ∃∃K2. K1 ⫃ K2 & L2 = K2.ⓘ{I}
55       | ∃∃K2,V,W. K1 ⫃ K2 & L2 = K2.ⓛW & I = BPair Abbr (ⓝW.V)
56       | ∃∃J1,J2,K2,V. K1 ⫃ K2 & L2 = K2.ⓤ{J2} & I = BPair J1 V.
57 #L1 #L2 * -L1 -L2
58 [ #J #K1 #H destruct
59 | #I #L1 #L2 #HL12 #J #K1 #H destruct /3 width=3 by or3_intro0, ex2_intro/
60 | #L1 #L2 #V #W #HL12 #J #K1 #H destruct /3 width=6 by or3_intro1, ex3_3_intro/
61 | #I1 #I2 #L1 #L2 #V #HL12 #J #K1 #H destruct /3 width=4 by or3_intro2, ex3_4_intro/
62 ]
63 qed-.
64
65 (* Basic_2A1: uses: lsubr_inv_pair1 *)
66 lemma lsubr_inv_bind1:
67       ∀I,K1,L2. K1.ⓘ{I} ⫃ L2 →
68       ∨∨ ∃∃K2. K1 ⫃ K2 & L2 = K2.ⓘ{I}
69        | ∃∃K2,V,W. K1 ⫃ K2 & L2 = K2.ⓛW & I = BPair Abbr (ⓝW.V)
70        | ∃∃J1,J2,K2,V. K1 ⫃ K2 & L2 = K2.ⓤ{J2} & I = BPair J1 V.
71 /2 width=3 by lsubr_inv_bind1_aux/ qed-.
72
73 fact lsubr_inv_atom2_aux: ∀L1,L2. L1 ⫃ L2 → L2 = ⋆ → L1 = ⋆.
74 #L1 #L2 * -L1 -L2 //
75 [ #I #L1 #L2 #_ #H destruct
76 | #L1 #L2 #V #W #_ #H destruct
77 | #I1 #I2 #L1 #L2 #V #_ #H destruct
78 ]
79 qed-.
80
81 lemma lsubr_inv_atom2: ∀L1. L1 ⫃ ⋆ → L1 = ⋆.
82 /2 width=3 by lsubr_inv_atom2_aux/ qed-.
83
84 fact lsubr_inv_bind2_aux:
85      ∀L1,L2. L1 ⫃ L2 → ∀I,K2. L2 = K2.ⓘ{I} →
86      ∨∨ ∃∃K1. K1 ⫃ K2 & L1 = K1.ⓘ{I}
87       | ∃∃K1,W,V. K1 ⫃ K2 & L1 = K1.ⓓⓝW.V & I = BPair Abst W
88       | ∃∃J1,J2,K1,V. K1 ⫃ K2 & L1 = K1.ⓑ{J1}V & I = BUnit J2.
89 #L1 #L2 * -L1 -L2
90 [ #J #K2 #H destruct
91 | #I #L1 #L2 #HL12 #J #K2 #H destruct /3 width=3 by ex2_intro, or3_intro0/
92 | #L1 #L2 #V1 #V2 #HL12 #J #K2 #H destruct /3 width=6 by ex3_3_intro, or3_intro1/
93 | #I1 #I2 #L1 #L2 #V #HL12 #J #K2 #H destruct /3 width=5 by ex3_4_intro, or3_intro2/
94 ]
95 qed-.
96
97 lemma lsubr_inv_bind2:
98       ∀I,L1,K2. L1 ⫃ K2.ⓘ{I} →
99       ∨∨ ∃∃K1. K1 ⫃ K2 & L1 = K1.ⓘ{I}
100        | ∃∃K1,W,V. K1 ⫃ K2 & L1 = K1.ⓓⓝW.V & I = BPair Abst W
101        | ∃∃J1,J2,K1,V. K1 ⫃ K2 & L1 = K1.ⓑ{J1}V & I = BUnit J2.
102 /2 width=3 by lsubr_inv_bind2_aux/ qed-.
103
104 (* Advanced inversion lemmas ************************************************)
105
106 lemma lsubr_inv_abst1:
107       ∀K1,L2,W. K1.ⓛW ⫃ L2 →
108       ∨∨ ∃∃K2. K1 ⫃ K2 & L2 = K2.ⓛW
109        | ∃∃I2,K2. K1 ⫃ K2 & L2 = K2.ⓤ{I2}.
110 #K1 #L2 #W #H elim (lsubr_inv_bind1 … H) -H *
111 /3 width=4 by ex2_2_intro, ex2_intro, or_introl, or_intror/
112 #K2 #V2 #W2 #_ #_ #H destruct
113 qed-.
114
115 lemma lsubr_inv_unit1:
116       ∀I,K1,L2. K1.ⓤ{I} ⫃ L2 →
117       ∃∃K2. K1 ⫃ K2 & L2 = K2.ⓤ{I}.
118 #I #K1 #L2 #H elim (lsubr_inv_bind1 … H) -H *
119 [ #K2 #HK12 #H destruct /2 width=3 by ex2_intro/
120 | #K2 #V #W #_ #_ #H destruct
121 | #J1 #J2 #K2 #V #_ #_ #H destruct
122 ]
123 qed-.
124
125 lemma lsubr_inv_pair2:
126       ∀I,L1,K2,W. L1 ⫃ K2.ⓑ{I}W →
127       ∨∨ ∃∃K1. K1 ⫃ K2 & L1 = K1.ⓑ{I}W
128        | ∃∃K1,V. K1 ⫃ K2 & L1 = K1.ⓓⓝW.V & I = Abst.
129 #I #L1 #K2 #W #H elim (lsubr_inv_bind2 … H) -H *
130 [ /3 width=3 by ex2_intro, or_introl/
131 | #K1 #X #V #HK12 #H1 #H2 destruct /3 width=4 by ex3_2_intro, or_intror/
132 | #J1 #J1 #K1 #V #_ #_ #H destruct
133 ]
134 qed-.
135
136 lemma lsubr_inv_abbr2:
137       ∀L1,K2,V. L1 ⫃ K2.ⓓV →
138       ∃∃K1. K1 ⫃ K2 & L1 = K1.ⓓV.
139 #L1 #K2 #V #H elim (lsubr_inv_pair2 … H) -H *
140 [ /2 width=3 by ex2_intro/
141 | #K1 #X #_ #_ #H destruct
142 ]
143 qed-.
144
145 lemma lsubr_inv_abst2:
146       ∀L1,K2,W. L1 ⫃ K2.ⓛW →
147       ∨∨ ∃∃K1. K1 ⫃ K2 & L1 = K1.ⓛW
148        | ∃∃K1,V. K1 ⫃ K2 & L1 = K1.ⓓⓝW.V.
149 #L1 #K2 #W #H elim (lsubr_inv_pair2 … H) -H *
150 /3 width=4 by ex2_2_intro, ex2_intro, or_introl, or_intror/
151 qed-.
152
153 lemma lsubr_inv_unit2:
154       ∀I,L1,K2. L1 ⫃ K2.ⓤ{I} →
155       ∨∨ ∃∃K1. K1 ⫃ K2 & L1 = K1.ⓤ{I}
156        | ∃∃J,K1,V. K1 ⫃ K2 & L1 = K1.ⓑ{J}V.
157 #I #L1 #K2 #H elim (lsubr_inv_bind2 … H) -H *
158 [ /3 width=3 by ex2_intro, or_introl/
159 | #K1 #W #V #_ #_ #H destruct
160 | #J1 #J2 #K1 #V #HK12 #H1 #H2 destruct /3 width=5 by ex2_3_intro, or_intror/
161 ]
162 qed-.
163
164 (* Basic forward lemmas *****************************************************)
165
166 lemma lsubr_fwd_bind1:
167       ∀I1,K1,L2. K1.ⓘ{I1} ⫃ L2 →
168       ∃∃I2,K2. K1 ⫃ K2 & L2 = K2.ⓘ{I2}.
169 #I1 #K1 #L2 #H elim (lsubr_inv_bind1 … H) -H *
170 [ #K2 #HK12 #H destruct /3 width=4 by ex2_2_intro/
171 | #K2 #W1 #V1 #HK12 #H1 #H2 destruct /3 width=4 by ex2_2_intro/
172 | #J1 #J2 #K2 #V1 #HK12 #H1 #H2 destruct /3 width=4 by ex2_2_intro/
173 ]
174 qed-.
175
176 lemma lsubr_fwd_bind2:
177       ∀I2,L1,K2. L1 ⫃ K2.ⓘ{I2} →
178       ∃∃I1,K1. K1 ⫃ K2 & L1 = K1.ⓘ{I1}.
179 #I2 #L1 #K2 #H elim (lsubr_inv_bind2 … H) -H *
180 [ #K1 #HK12 #H destruct /3 width=4 by ex2_2_intro/
181 | #K1 #W1 #V1 #HK12 #H1 #H2 destruct /3 width=4 by ex2_2_intro/
182 | #J1 #J2 #K1 #V1 #HK12 #H1 #H2 destruct /3 width=4 by ex2_2_intro/
183 ]
184 qed-.