]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/static_2/static/lsubr.ma
syntactic components detached from basic_2 become static_2
[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: ∀L1,L2. L1 ⫃ L2 → ∀I,K1. L1 = K1.ⓘ{I} →
53                           ∨∨ ∃∃K2. K1 ⫃ K2 & L2 = K2.ⓘ{I}
54                            | ∃∃K2,V,W. K1 ⫃ K2 & L2 = K2.ⓛW &
55                                        I = BPair Abbr (ⓝW.V)
56                            | ∃∃J1,J2,K2,V. K1 ⫃ K2 & L2 = K2.ⓤ{J2} &
57                                            I = BPair J1 V.
58 #L1 #L2 * -L1 -L2
59 [ #J #K1 #H destruct
60 | #I #L1 #L2 #HL12 #J #K1 #H destruct /3 width=3 by or3_intro0, ex2_intro/
61 | #L1 #L2 #V #W #HL12 #J #K1 #H destruct /3 width=6 by or3_intro1, ex3_3_intro/
62 | #I1 #I2 #L1 #L2 #V #HL12 #J #K1 #H destruct /3 width=4 by or3_intro2, ex3_4_intro/
63 ]
64 qed-.
65
66 (* Basic_2A1: uses: lsubr_inv_pair1 *)
67 lemma lsubr_inv_bind1: ∀I,K1,L2. K1.ⓘ{I} ⫃ L2 →
68                        ∨∨ ∃∃K2. K1 ⫃ K2 & L2 = K2.ⓘ{I}
69                         | ∃∃K2,V,W. K1 ⫃ K2 & L2 = K2.ⓛW &
70                                     I = BPair Abbr (ⓝW.V)
71                         | ∃∃J1,J2,K2,V. K1 ⫃ K2 & L2 = K2.ⓤ{J2} &
72                                         I = BPair J1 V.
73 /2 width=3 by lsubr_inv_bind1_aux/ qed-.
74
75 fact lsubr_inv_atom2_aux: ∀L1,L2. L1 ⫃ L2 → L2 = ⋆ → L1 = ⋆.
76 #L1 #L2 * -L1 -L2 //
77 [ #I #L1 #L2 #_ #H destruct
78 | #L1 #L2 #V #W #_ #H destruct
79 | #I1 #I2 #L1 #L2 #V #_ #H destruct
80 ]
81 qed-.
82
83 lemma lsubr_inv_atom2: ∀L1. L1 ⫃ ⋆ → L1 = ⋆.
84 /2 width=3 by lsubr_inv_atom2_aux/ qed-.
85
86 fact lsubr_inv_bind2_aux: ∀L1,L2. L1 ⫃ L2 → ∀I,K2. L2 = K2.ⓘ{I} →
87                           ∨∨ ∃∃K1. K1 ⫃ K2 & L1 = K1.ⓘ{I}
88                            | ∃∃K1,W,V. K1 ⫃ K2 & L1 = K1.ⓓⓝW.V & I = BPair Abst W
89                            | ∃∃J1,J2,K1,V. K1 ⫃ K2 & L1 = K1.ⓑ{J1}V & I = BUnit J2.
90 #L1 #L2 * -L1 -L2
91 [ #J #K2 #H destruct
92 | #I #L1 #L2 #HL12 #J #K2 #H destruct /3 width=3 by ex2_intro, or3_intro0/
93 | #L1 #L2 #V1 #V2 #HL12 #J #K2 #H destruct /3 width=6 by ex3_3_intro, or3_intro1/
94 | #I1 #I2 #L1 #L2 #V #HL12 #J #K2 #H destruct /3 width=5 by ex3_4_intro, or3_intro2/
95 ]
96 qed-.
97
98 lemma lsubr_inv_bind2: ∀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: ∀K1,L2,W. K1.ⓛW ⫃ L2 →
107                        ∨∨ ∃∃K2. K1 ⫃ K2 & L2 = K2.ⓛW
108                         | ∃∃I2,K2. K1 ⫃ K2 & L2 = K2.ⓤ{I2}.
109 #K1 #L2 #W #H elim (lsubr_inv_bind1 … H) -H *
110 /3 width=4 by ex2_2_intro, ex2_intro, or_introl, or_intror/ 
111 #K2 #V2 #W2 #_ #_ #H destruct
112 qed-.
113
114 lemma lsubr_inv_unit1: ∀I,K1,L2. K1.ⓤ{I} ⫃ L2 →
115                        ∃∃K2. K1 ⫃ K2 & L2 = K2.ⓤ{I}.
116 #I #K1 #L2 #H elim (lsubr_inv_bind1 … H) -H *
117 [ #K2 #HK12 #H destruct /2 width=3 by ex2_intro/
118 | #K2 #V #W #_ #_ #H destruct
119 | #I1 #I2 #K2 #V #_ #_ #H destruct
120 ]
121 qed-.
122
123 lemma lsubr_inv_pair2: ∀I,L1,K2,W. L1 ⫃ K2.ⓑ{I}W →
124                        ∨∨ ∃∃K1. K1 ⫃ K2 & L1 = K1.ⓑ{I}W
125                         | ∃∃K1,V. K1 ⫃ K2 & L1 = K1.ⓓⓝW.V & I = Abst.
126 #I #L1 #K2 #W #H elim (lsubr_inv_bind2 … H) -H *
127 [ /3 width=3 by ex2_intro, or_introl/
128 | #K2 #X #V #HK12 #H1 #H2 destruct /3 width=4 by ex3_2_intro, or_intror/
129 | #I1 #I1 #K2 #V #_ #_ #H destruct   
130 ]
131 qed-.
132
133 lemma lsubr_inv_abbr2: ∀L1,K2,V. L1 ⫃ K2.ⓓV →
134                        ∃∃K1. K1 ⫃ K2 & L1 = K1.ⓓV.
135 #L1 #K2 #V #H elim (lsubr_inv_pair2 … H) -H *
136 [ /2 width=3 by ex2_intro/
137 | #K1 #X #_ #_ #H destruct
138 ]
139 qed-.
140
141 lemma lsubr_inv_abst2: ∀L1,K2,W. L1 ⫃ K2.ⓛW →
142                        ∨∨ ∃∃K1. K1 ⫃ K2 & L1 = K1.ⓛW
143                         | ∃∃K1,V. K1 ⫃ K2 & L1 = K1.ⓓⓝW.V.
144 #L1 #K2 #W #H elim (lsubr_inv_pair2 … H) -H *
145 /3 width=4 by ex2_2_intro, ex2_intro, or_introl, or_intror/
146 qed-.
147
148 lemma lsubr_inv_unit2: ∀I,L1,K2. L1 ⫃ K2.ⓤ{I} →
149                        ∨∨ ∃∃K1. K1 ⫃ K2 & L1 = K1.ⓤ{I}
150                         | ∃∃J,K1,V. K1 ⫃ K2 & L1 = K1.ⓑ{J}V.
151 #I #L1 #K2 #H elim (lsubr_inv_bind2 … H) -H *
152 [ /3 width=3 by ex2_intro, or_introl/
153 | #K1 #W #V #_ #_ #H destruct
154 | #I1 #I2 #K1 #V #HK12 #H1 #H2 destruct /3 width=5 by ex2_3_intro, or_intror/
155 ]
156 qed-.
157
158 (* Basic forward lemmas *****************************************************)
159
160 lemma lsubr_fwd_bind1: ∀I1,K1,L2. K1.ⓘ{I1} ⫃ L2 →
161                        ∃∃I2,K2. K1 ⫃ K2 & L2 = K2.ⓘ{I2}.
162 #I1 #K1 #L2 #H elim (lsubr_inv_bind1 … H) -H *
163 [ #K2 #HK12 #H destruct /3 width=4 by ex2_2_intro/
164 | #K2 #W1 #V1 #HK12 #H1 #H2 destruct /3 width=4 by ex2_2_intro/
165 | #I1 #I2 #K2 #V1 #HK12 #H1 #H2 destruct /3 width=4 by ex2_2_intro/
166 ]
167 qed-.
168
169 lemma lsubr_fwd_bind2: ∀I2,L1,K2. L1 ⫃ K2.ⓘ{I2} →
170                        ∃∃I1,K1. K1 ⫃ K2 & L1 = K1.ⓘ{I1}.
171 #I2 #L1 #K2 #H elim (lsubr_inv_bind2 … H) -H *
172 [ #K1 #HK12 #H destruct /3 width=4 by ex2_2_intro/
173 | #K1 #W1 #V1 #HK12 #H1 #H2 destruct /3 width=4 by ex2_2_intro/
174 | #I1 #I2 #K1 #V1 #HK12 #H1 #H2 destruct /3 width=4 by ex2_2_intro/
175 ]
176 qed-.