]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2A/static/lsuba.ma
update in lambdadelta
[helm.git] / matita / matita / contribs / lambdadelta / basic_2A / static / lsuba.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/lrsubeqa_3.ma".
16 include "basic_2A/static/lsubr.ma".
17 include "basic_2A/static/aaa.ma".
18
19 (* LOCAL ENVIRONMENT REFINEMENT FOR ATOMIC ARITY ASSIGNMENT *****************)
20
21 inductive lsuba (G:genv): relation lenv ≝
22 | lsuba_atom: lsuba G (⋆) (⋆)
23 | lsuba_pair: ∀I,L1,L2,V. lsuba G L1 L2 → lsuba G (L1.ⓑ{I}V) (L2.ⓑ{I}V)
24 | lsuba_beta: ∀L1,L2,W,V,A. ⦃G, L1⦄ ⊢ ⓝW.V ⁝ A → ⦃G, L2⦄ ⊢ W ⁝ A →
25               lsuba G L1 L2 → lsuba G (L1.ⓓⓝW.V) (L2.ⓛW)
26 .
27
28 interpretation
29   "local environment refinement (atomic arity assignment)"
30   'LRSubEqA G L1 L2 = (lsuba G L1 L2).
31
32 (* Basic inversion lemmas ***************************************************)
33
34 fact lsuba_inv_atom1_aux: ∀G,L1,L2. G ⊢ L1 ⫃⁝ L2 → L1 = ⋆ → L2 = ⋆.
35 #G #L1 #L2 * -L1 -L2
36 [ //
37 | #I #L1 #L2 #V #_ #H destruct
38 | #L1 #L2 #W #V #A #_ #_ #_ #H destruct
39 ]
40 qed-.
41
42 lemma lsuba_inv_atom1: ∀G,L2. G ⊢ ⋆ ⫃⁝ L2 → L2 = ⋆.
43 /2 width=4 by lsuba_inv_atom1_aux/ qed-.
44
45 fact lsuba_inv_pair1_aux: ∀G,L1,L2. G ⊢ L1 ⫃⁝ L2 → ∀I,K1,X. L1 = K1.ⓑ{I}X →
46                           (∃∃K2. G ⊢ K1 ⫃⁝ K2 & L2 = K2.ⓑ{I}X) ∨
47                           ∃∃K2,W,V,A. ⦃G, K1⦄ ⊢ ⓝW.V ⁝ A & ⦃G, K2⦄ ⊢ W ⁝ A &
48                                       G ⊢ K1 ⫃⁝ K2 & I = Abbr & L2 = K2.ⓛW & X = ⓝW.V.
49 #G #L1 #L2 * -L1 -L2
50 [ #J #K1 #X #H destruct
51 | #I #L1 #L2 #V #HL12 #J #K1 #X #H destruct /3 width=3 by ex2_intro, or_introl/
52 | #L1 #L2 #W #V #A #HV #HW #HL12 #J #K1 #X #H destruct /3 width=9 by or_intror, ex6_4_intro/
53 ]
54 qed-.
55
56 lemma lsuba_inv_pair1: ∀I,G,K1,L2,X. G ⊢ K1.ⓑ{I}X ⫃⁝ L2 →
57                        (∃∃K2. G ⊢ K1 ⫃⁝ K2 & L2 = K2.ⓑ{I}X) ∨
58                        ∃∃K2,W,V,A. ⦃G, K1⦄ ⊢ ⓝW.V ⁝ A & ⦃G, K2⦄ ⊢ W ⁝ A & G ⊢ K1 ⫃⁝ K2 &
59                                    I = Abbr & L2 = K2.ⓛW & X = ⓝW.V.
60 /2 width=3 by lsuba_inv_pair1_aux/ qed-.
61
62 fact lsuba_inv_atom2_aux: ∀G,L1,L2. G ⊢ L1 ⫃⁝ L2 → L2 = ⋆ → L1 = ⋆.
63 #G #L1 #L2 * -L1 -L2
64 [ //
65 | #I #L1 #L2 #V #_ #H destruct
66 | #L1 #L2 #W #V #A #_ #_ #_ #H destruct
67 ]
68 qed-.
69
70 lemma lsubc_inv_atom2: ∀G,L1. G ⊢ L1 ⫃⁝ ⋆ → L1 = ⋆.
71 /2 width=4 by lsuba_inv_atom2_aux/ qed-.
72
73 fact lsuba_inv_pair2_aux: ∀G,L1,L2. G ⊢ L1 ⫃⁝ L2 → ∀I,K2,W. L2 = K2.ⓑ{I}W →
74                           (∃∃K1. G ⊢ K1 ⫃⁝ K2 & L1 = K1.ⓑ{I}W) ∨
75                           ∃∃K1,V,A. ⦃G, K1⦄ ⊢ ⓝW.V ⁝ A & ⦃G, K2⦄ ⊢ W ⁝ A &
76                                     G ⊢ K1 ⫃⁝ K2 & I = Abst & L1 = K1.ⓓⓝW.V.
77 #G #L1 #L2 * -L1 -L2
78 [ #J #K2 #U #H destruct
79 | #I #L1 #L2 #V #HL12 #J #K2 #U #H destruct /3 width=3 by ex2_intro, or_introl/
80 | #L1 #L2 #W #V #A #HV #HW #HL12 #J #K2 #U #H destruct /3 width=7 by or_intror, ex5_3_intro/
81 ]
82 qed-.
83
84 lemma lsuba_inv_pair2: ∀I,G,L1,K2,W. G ⊢ L1 ⫃⁝ K2.ⓑ{I}W →
85                        (∃∃K1. G ⊢ K1 ⫃⁝ K2 & L1 = K1.ⓑ{I}W) ∨
86                        ∃∃K1,V,A. ⦃G, K1⦄ ⊢ ⓝW.V ⁝ A & ⦃G, K2⦄ ⊢ W ⁝ A & G ⊢ K1 ⫃⁝ K2 &
87                                  I = Abst & L1 = K1.ⓓⓝW.V.
88 /2 width=3 by lsuba_inv_pair2_aux/ qed-.
89
90 (* Basic forward lemmas *****************************************************)
91
92 lemma lsuba_fwd_lsubr: ∀G,L1,L2. G ⊢ L1 ⫃⁝ L2 → L1 ⫃ L2.
93 #G #L1 #L2 #H elim H -L1 -L2 /2 width=1 by lsubr_pair, lsubr_beta/
94 qed-.
95
96 (* Basic properties *********************************************************)
97
98 lemma lsuba_refl: ∀G,L. G ⊢ L ⫃⁝ L.
99 #G #L elim L -L /2 width=1 by lsuba_atom, lsuba_pair/
100 qed.
101
102 (* Note: the constant 0 cannot be generalized *)
103 lemma lsuba_drop_O1_conf: ∀G,L1,L2. G ⊢ L1 ⫃⁝ L2 → ∀K1,s,m. ⬇[s, 0, m] L1 ≡ K1 →
104                           ∃∃K2. G ⊢ K1 ⫃⁝ K2 & ⬇[s, 0, m] L2 ≡ K2.
105 #G #L1 #L2 #H elim H -L1 -L2
106 [ /2 width=3 by ex2_intro/
107 | #I #L1 #L2 #V #_ #IHL12 #K1 #s #m #H
108   elim (drop_inv_O1_pair1 … H) -H * #Hm #HLK1
109   [ destruct
110     elim (IHL12 L1 s 0) -IHL12 // #X #HL12 #H
111     <(drop_inv_O2 … H) in HL12; -H /3 width=3 by lsuba_pair, drop_pair, ex2_intro/
112   | elim (IHL12 … HLK1) -L1 /3 width=3 by drop_drop_lt, ex2_intro/
113   ]
114 | #L1 #L2 #W #V #A #HV #HW #_ #IHL12 #K1 #s #m #H
115   elim (drop_inv_O1_pair1 … H) -H * #Hm #HLK1
116   [ destruct
117     elim (IHL12 L1 s 0) -IHL12 // #X #HL12 #H
118     <(drop_inv_O2 … H) in HL12; -H /3 width=3 by lsuba_beta, drop_pair, ex2_intro/
119   | elim (IHL12 … HLK1) -L1 /3 width=3 by drop_drop_lt, ex2_intro/
120   ]
121 ]
122 qed-.
123
124 (* Note: the constant 0 cannot be generalized *)
125 lemma lsuba_drop_O1_trans: ∀G,L1,L2. G ⊢ L1 ⫃⁝ L2 → ∀K2,s,m. ⬇[s, 0, m] L2 ≡ K2 →
126                            ∃∃K1. G ⊢ K1 ⫃⁝ K2 & ⬇[s, 0, m] L1 ≡ K1.
127 #G #L1 #L2 #H elim H -L1 -L2
128 [ /2 width=3 by ex2_intro/
129 | #I #L1 #L2 #V #_ #IHL12 #K2 #s #m #H
130   elim (drop_inv_O1_pair1 … H) -H * #Hm #HLK2
131   [ destruct
132     elim (IHL12 L2 s 0) -IHL12 // #X #HL12 #H
133     <(drop_inv_O2 … H) in HL12; -H /3 width=3 by lsuba_pair, drop_pair, ex2_intro/
134   | elim (IHL12 … HLK2) -L2 /3 width=3 by drop_drop_lt, ex2_intro/
135   ]
136 | #L1 #L2 #W #V #A #HV #HW #_ #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 lsuba_beta, drop_pair, ex2_intro/
141   | elim (IHL12 … HLK2) -L2 /3 width=3 by drop_drop_lt, ex2_intro/
142   ]
143 ]
144 qed-.