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