]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2A/static/lsubd.ma
update in lambdadelta
[helm.git] / matita / matita / contribs / lambdadelta / basic_2A / static / lsubd.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 "basic_2A/notation/relations/lrsubeqd_5.ma".
16 include "basic_2A/static/lsubr.ma".
17 include "basic_2A/static/da.ma".
18
19 (* LOCAL ENVIRONMENT REFINEMENT FOR DEGREE ASSIGNMENT ***********************)
20
21 inductive lsubd (h) (g) (G): relation lenv ≝
22 | lsubd_atom: lsubd h g G (⋆) (⋆)
23 | lsubd_pair: ∀I,L1,L2,V. lsubd h g G L1 L2 →
24               lsubd h g G (L1.ⓑ{I}V) (L2.ⓑ{I}V)
25 | lsubd_beta: ∀L1,L2,W,V,d. ⦃G, L1⦄ ⊢ V ▪[h, g] d+1 → ⦃G, L2⦄ ⊢ W ▪[h, g] d →
26               lsubd h g G L1 L2 → lsubd h g G (L1.ⓓⓝW.V) (L2.ⓛW)
27 .
28
29 interpretation
30   "local environment refinement (degree assignment)"
31   'LRSubEqD h g G L1 L2 = (lsubd h g G L1 L2).
32
33 (* Basic forward lemmas *****************************************************)
34
35 lemma lsubd_fwd_lsubr: ∀h,g,G,L1,L2. G ⊢ L1 ⫃▪[h, g] L2 → L1 ⫃ L2.
36 #h #g #G #L1 #L2 #H elim H -L1 -L2 /2 width=1 by lsubr_pair, lsubr_beta/
37 qed-.
38
39 (* Basic inversion lemmas ***************************************************)
40
41 fact lsubd_inv_atom1_aux: ∀h,g,G,L1,L2. G ⊢ L1 ⫃▪[h, g] L2 → L1 = ⋆ → L2 = ⋆.
42 #h #g #G #L1 #L2 * -L1 -L2
43 [ //
44 | #I #L1 #L2 #V #_ #H destruct
45 | #L1 #L2 #W #V #d #_ #_ #_ #H destruct
46 ]
47 qed-.
48
49 lemma lsubd_inv_atom1: ∀h,g,G,L2. G ⊢ ⋆ ⫃▪[h, g] L2 → L2 = ⋆.
50 /2 width=6 by lsubd_inv_atom1_aux/ qed-.
51
52 fact lsubd_inv_pair1_aux: ∀h,g,G,L1,L2. G ⊢ L1 ⫃▪[h, g] L2 →
53                           ∀I,K1,X. L1 = K1.ⓑ{I}X →
54                           (∃∃K2. G ⊢ K1 ⫃▪[h, g] K2 & L2 = K2.ⓑ{I}X) ∨
55                           ∃∃K2,W,V,d. ⦃G, K1⦄ ⊢ V ▪[h, g] d+1 & ⦃G, K2⦄ ⊢ W ▪[h, g] d &
56                                       G ⊢ K1 ⫃▪[h, g] K2 &
57                                       I = Abbr & L2 = K2.ⓛW & X = ⓝW.V.
58 #h #g #G #L1 #L2 * -L1 -L2
59 [ #J #K1 #X #H destruct
60 | #I #L1 #L2 #V #HL12 #J #K1 #X #H destruct /3 width=3 by ex2_intro, or_introl/
61 | #L1 #L2 #W #V #d #HV #HW #HL12 #J #K1 #X #H destruct /3 width=9 by ex6_4_intro, or_intror/
62 ]
63 qed-.
64
65 lemma lsubd_inv_pair1: ∀h,g,I,G,K1,L2,X. G ⊢ K1.ⓑ{I}X ⫃▪[h, g] L2 →
66                        (∃∃K2. G ⊢ K1 ⫃▪[h, g] K2 & L2 = K2.ⓑ{I}X) ∨
67                        ∃∃K2,W,V,d. ⦃G, K1⦄ ⊢ V ▪[h, g] d+1 & ⦃G, K2⦄ ⊢ W ▪[h, g] d &
68                                    G ⊢ K1 ⫃▪[h, g] K2 &
69                                    I = Abbr & L2 = K2.ⓛW & X = ⓝW.V.
70 /2 width=3 by lsubd_inv_pair1_aux/ qed-.
71
72 fact lsubd_inv_atom2_aux: ∀h,g,G,L1,L2. G ⊢ L1 ⫃▪[h, g] L2 → L2 = ⋆ → L1 = ⋆.
73 #h #g #G #L1 #L2 * -L1 -L2
74 [ //
75 | #I #L1 #L2 #V #_ #H destruct
76 | #L1 #L2 #W #V #d #_ #_ #_ #H destruct
77 ]
78 qed-.
79
80 lemma lsubd_inv_atom2: ∀h,g,G,L1. G ⊢ L1 ⫃▪[h, g] ⋆ → L1 = ⋆.
81 /2 width=6 by lsubd_inv_atom2_aux/ qed-.
82
83 fact lsubd_inv_pair2_aux: ∀h,g,G,L1,L2. G ⊢ L1 ⫃▪[h, g] L2 →
84                           ∀I,K2,W. L2 = K2.ⓑ{I}W →
85                           (∃∃K1. G ⊢ K1 ⫃▪[h, g] K2 & L1 = K1.ⓑ{I}W) ∨
86                           ∃∃K1,V,d. ⦃G, K1⦄ ⊢ V ▪[h, g] d+1 & ⦃G, K2⦄ ⊢ W ▪[h, g] d &
87                                     G ⊢ K1 ⫃▪[h, g] K2 & I = Abst & L1 = K1. ⓓⓝW.V.
88 #h #g #G #L1 #L2 * -L1 -L2
89 [ #J #K2 #U #H destruct
90 | #I #L1 #L2 #V #HL12 #J #K2 #U #H destruct /3 width=3 by ex2_intro, or_introl/
91 | #L1 #L2 #W #V #d #HV #HW #HL12 #J #K2 #U #H destruct /3 width=7 by ex5_3_intro, or_intror/
92 ]
93 qed-.
94
95 lemma lsubd_inv_pair2: ∀h,g,I,G,L1,K2,W. G ⊢ L1 ⫃▪[h, g] K2.ⓑ{I}W →
96                        (∃∃K1. G ⊢ K1 ⫃▪[h, g] K2 & L1 = K1.ⓑ{I}W) ∨
97                        ∃∃K1,V,d. ⦃G, K1⦄ ⊢ V ▪[h, g] d+1 & ⦃G, K2⦄ ⊢ W ▪[h, g] d &
98                                  G ⊢ K1 ⫃▪[h, g] K2 & I = Abst & L1 = K1. ⓓⓝW.V.
99 /2 width=3 by lsubd_inv_pair2_aux/ qed-.
100
101 (* Basic properties *********************************************************)
102
103 lemma lsubd_refl: ∀h,g,G,L. G ⊢ L ⫃▪[h, g] L.
104 #h #g #G #L elim L -L /2 width=1 by lsubd_pair/
105 qed.
106
107 (* Note: the constant 0 cannot be generalized *)
108 lemma lsubd_drop_O1_conf: ∀h,g,G,L1,L2. G ⊢ L1 ⫃▪[h, g] L2 →
109                           ∀K1,s,m. ⬇[s, 0, m] L1 ≡ K1 →
110                           ∃∃K2. G ⊢ K1 ⫃▪[h, g] K2 & ⬇[s, 0, m] L2 ≡ K2.
111 #h #g #G #L1 #L2 #H elim H -L1 -L2
112 [ /2 width=3 by ex2_intro/
113 | #I #L1 #L2 #V #_ #IHL12 #K1 #s #m #H
114   elim (drop_inv_O1_pair1 … H) -H * #Hm #HLK1
115   [ destruct
116     elim (IHL12 L1 s 0) -IHL12 // #X #HL12 #H
117     <(drop_inv_O2 … H) in HL12; -H /3 width=3 by lsubd_pair, drop_pair, ex2_intro/
118   | elim (IHL12 … HLK1) -L1 /3 width=3 by drop_drop_lt, ex2_intro/
119   ]
120 | #L1 #L2 #W #V #d #HV #HW #_ #IHL12 #K1 #s #m #H
121   elim (drop_inv_O1_pair1 … H) -H * #Hm #HLK1
122   [ destruct
123     elim (IHL12 L1 s 0) -IHL12 // #X #HL12 #H
124     <(drop_inv_O2 … H) in HL12; -H /3 width=3 by lsubd_beta, drop_pair, ex2_intro/
125   | elim (IHL12 … HLK1) -L1 /3 width=3 by drop_drop_lt, ex2_intro/
126   ]
127 ]
128 qed-.
129
130 (* Note: the constant 0 cannot be generalized *)
131 lemma lsubd_drop_O1_trans: ∀h,g,G,L1,L2. G ⊢ L1 ⫃▪[h, g] L2 →
132                            ∀K2,s,m. ⬇[s, 0, m] L2 ≡ K2 →
133                            ∃∃K1. G ⊢ K1 ⫃▪[h, g] K2 & ⬇[s, 0, m] L1 ≡ K1.
134 #h #g #G #L1 #L2 #H elim H -L1 -L2
135 [ /2 width=3 by ex2_intro/
136 | #I #L1 #L2 #V #_ #IHL12 #K2 #s #m #H
137   elim (drop_inv_O1_pair1 … H) -H * #Hm #HLK2
138   [ destruct
139     elim (IHL12 L2 s 0) -IHL12 // #X #HL12 #H
140     <(drop_inv_O2 … H) in HL12; -H /3 width=3 by lsubd_pair, drop_pair, ex2_intro/
141   | elim (IHL12 … HLK2) -L2 /3 width=3 by drop_drop_lt, ex2_intro/
142   ]
143 | #L1 #L2 #W #V #d #HV #HW #_ #IHL12 #K2 #s #m #H
144   elim (drop_inv_O1_pair1 … H) -H * #Hm #HLK2
145   [ destruct
146     elim (IHL12 L2 s 0) -IHL12 // #X #HL12 #H
147     <(drop_inv_O2 … H) in HL12; -H /3 width=3 by lsubd_beta, drop_pair, ex2_intro/
148   | elim (IHL12 … HLK2) -L2 /3 width=3 by drop_drop_lt, ex2_intro/
149   ]
150 ]
151 qed-.