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