]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/rt_transition/cpr.ma
update in ground_2, static_2, basic_2
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / rt_transition / cpr.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_6_6.ma".
16 include "ground_2/xoa/ex_7_7.ma".
17 include "ground_2/xoa/or_4.ma".
18 include "ground_2/insert_eq/insert_eq_0.ma".
19 include "basic_2/rt_transition/cpm.ma".
20
21 (* CONTEXT-SENSITIVE PARALLEL R-TRANSITION FOR TERMS ************************)
22
23 (* Basic properties *********************************************************)
24
25 (* Note: cpr_flat: does not hold in basic_1 *)
26 (* Basic_1: includes: pr2_thin_dx *)
27 lemma cpr_flat: ∀h,I,G,L,V1,V2,T1,T2.
28                 ⦃G,L⦄ ⊢ V1 ➡[h] V2 → ⦃G,L⦄ ⊢ T1 ➡[h] T2 →
29                 ⦃G,L⦄ ⊢ ⓕ{I}V1.T1 ➡[h] ⓕ{I}V2.T2.
30 #h * /2 width=1 by cpm_cast, cpm_appl/
31 qed.
32
33 (* Basic_1: was: pr2_head_1 *)
34 lemma cpr_pair_sn: ∀h,I,G,L,V1,V2. ⦃G,L⦄ ⊢ V1 ➡[h] V2 →
35                    ∀T. ⦃G,L⦄ ⊢ ②{I}V1.T ➡[h] ②{I}V2.T.
36 #h * /2 width=1 by cpm_bind, cpr_flat/
37 qed.
38
39 (* Basic inversion properties ***********************************************)
40
41 lemma cpr_inv_atom1: ∀h,J,G,L,T2. ⦃G,L⦄ ⊢ ⓪{J} ➡[h] T2 →
42                      ∨∨ T2 = ⓪{J}
43                       | ∃∃K,V1,V2. ⦃G,K⦄ ⊢ V1 ➡[h] V2 & ⇧*[1] V2 ≘ T2 &
44                                    L = K.ⓓV1 & J = LRef 0
45                       | ∃∃I,K,T,i. ⦃G,K⦄ ⊢ #i ➡[h] T & ⇧*[1] T ≘ T2 &
46                                    L = K.ⓘ{I} & J = LRef (↑i).
47 #h #J #G #L #T2 #H elim (cpm_inv_atom1 … H) -H *
48 [2,4:|*: /3 width=8 by or3_intro0, or3_intro1, or3_intro2, ex4_4_intro, ex4_3_intro/ ]
49 [ #n #_ #_ #H destruct
50 | #n #K #V1 #V2 #_ #_ #_ #_ #H destruct
51 ]
52 qed-.
53
54 (* Basic_1: includes: pr0_gen_sort pr2_gen_sort *)
55 lemma cpr_inv_sort1: ∀h,G,L,T2,s. ⦃G,L⦄ ⊢ ⋆s ➡[h] T2 → T2 = ⋆s.
56 #h #G #L #T2 #s #H elim (cpm_inv_sort1 … H) -H //
57 qed-.
58
59 lemma cpr_inv_zero1: ∀h,G,L,T2. ⦃G,L⦄ ⊢ #0 ➡[h] T2 →
60                      ∨∨ T2 = #0
61                       | ∃∃K,V1,V2. ⦃G,K⦄ ⊢ V1 ➡[h] V2 & ⇧*[1] V2 ≘ T2 &
62                                    L = K.ⓓV1.
63 #h #G #L #T2 #H elim (cpm_inv_zero1 … H) -H *
64 /3 width=6 by ex3_3_intro, or_introl, or_intror/
65 #n #K #V1 #V2 #_ #_ #_ #H destruct
66 qed-.
67
68 lemma cpr_inv_lref1: ∀h,G,L,T2,i. ⦃G,L⦄ ⊢ #↑i ➡[h] T2 →
69                      ∨∨ T2 = #(↑i)
70                       | ∃∃I,K,T. ⦃G,K⦄ ⊢ #i ➡[h] T & ⇧*[1] T ≘ T2 & L = K.ⓘ{I}.
71 #h #G #L #T2 #i #H elim (cpm_inv_lref1 … H) -H *
72 /3 width=6 by ex3_3_intro, or_introl, or_intror/
73 qed-.
74
75 lemma cpr_inv_gref1: ∀h,G,L,T2,l. ⦃G,L⦄ ⊢ §l ➡[h] T2 → T2 = §l.
76 #h #G #L #T2 #l #H elim (cpm_inv_gref1 … H) -H //
77 qed-.
78
79 (* Basic_1: includes: pr0_gen_cast pr2_gen_cast *)
80 lemma cpr_inv_cast1: ∀h,G,L,V1,U1,U2. ⦃G,L⦄ ⊢ ⓝ V1.U1 ➡[h] U2 →
81                      ∨∨ ∃∃V2,T2. ⦃G,L⦄ ⊢ V1 ➡[h] V2 & ⦃G,L⦄ ⊢ U1 ➡[h] T2 &
82                                  U2 = ⓝV2.T2
83                       | ⦃G,L⦄ ⊢ U1 ➡[h] U2.
84 #h #G #L #V1 #U1 #U2 #H elim (cpm_inv_cast1 … H) -H
85 /2 width=1 by or_introl, or_intror/ * #n #_ #H destruct
86 qed-.
87
88 lemma cpr_inv_flat1: ∀h,I,G,L,V1,U1,U2. ⦃G,L⦄ ⊢ ⓕ{I}V1.U1 ➡[h] U2 →
89                      ∨∨ ∃∃V2,T2. ⦃G,L⦄ ⊢ V1 ➡[h] V2 & ⦃G,L⦄ ⊢ U1 ➡[h] T2 &
90                                  U2 = ⓕ{I}V2.T2
91                       | (⦃G,L⦄ ⊢ U1 ➡[h] U2 ∧ I = Cast)
92                       | ∃∃p,V2,W1,W2,T1,T2. ⦃G,L⦄ ⊢ V1 ➡[h] V2 & ⦃G,L⦄ ⊢ W1 ➡[h] W2 &
93                                             ⦃G,L.ⓛW1⦄ ⊢ T1 ➡[h] T2 & U1 = ⓛ{p}W1.T1 &
94                                             U2 = ⓓ{p}ⓝW2.V2.T2 & I = Appl
95                       | ∃∃p,V,V2,W1,W2,T1,T2. ⦃G,L⦄ ⊢ V1 ➡[h] V & ⇧*[1] V ≘ V2 &
96                                               ⦃G,L⦄ ⊢ W1 ➡[h] W2 & ⦃G,L.ⓓW1⦄ ⊢ T1 ➡[h] T2 &
97                                               U1 = ⓓ{p}W1.T1 &
98                                               U2 = ⓓ{p}W2.ⓐV2.T2 & I = Appl.
99 #h * #G #L #V1 #U1 #U2 #H
100 [ elim (cpm_inv_appl1 … H) -H *
101   /3 width=13 by or4_intro0, or4_intro2, or4_intro3, ex7_7_intro, ex6_6_intro, ex3_2_intro/
102 | elim (cpr_inv_cast1 … H) -H [ * ]
103   /3 width=5 by or4_intro0, or4_intro1, ex3_2_intro, conj/
104 ]
105 qed-.
106
107 (* Basic eliminators ********************************************************)
108
109 lemma cpr_ind (h): ∀Q:relation4 genv lenv term term.
110                    (∀I,G,L. Q G L (⓪{I}) (⓪{I})) →
111                    (∀G,K,V1,V2,W2. ⦃G,K⦄ ⊢ V1 ➡[h] V2 → Q G K V1 V2 →
112                      ⇧*[1] V2 ≘ W2 → Q G (K.ⓓV1) (#0) W2
113                    ) → (∀I,G,K,T,U,i. ⦃G,K⦄ ⊢ #i ➡[h] T → Q G K (#i) T →
114                      ⇧*[1] T ≘ U → Q G (K.ⓘ{I}) (#↑i) (U)
115                    ) → (∀p,I,G,L,V1,V2,T1,T2. ⦃G,L⦄ ⊢ V1 ➡[h] V2 → ⦃G,L.ⓑ{I}V1⦄ ⊢ T1 ➡[h] T2 →
116                      Q G L V1 V2 → Q G (L.ⓑ{I}V1) T1 T2 → Q G L (ⓑ{p,I}V1.T1) (ⓑ{p,I}V2.T2)
117                    ) → (∀I,G,L,V1,V2,T1,T2. ⦃G,L⦄ ⊢ V1 ➡[h] V2 → ⦃G,L⦄ ⊢ T1 ➡[h] T2 →
118                      Q G L V1 V2 → Q G L T1 T2 → Q G L (ⓕ{I}V1.T1) (ⓕ{I}V2.T2)
119                    ) → (∀G,L,V,T1,T,T2. ⇧*[1] T ≘ T1 → ⦃G,L⦄ ⊢ T ➡[h] T2 →
120                      Q G L T T2 → Q G L (+ⓓV.T1) T2
121                    ) → (∀G,L,V,T1,T2. ⦃G,L⦄ ⊢ T1 ➡[h] T2 → Q G L T1 T2 →
122                      Q G L (ⓝV.T1) T2
123                    ) → (∀p,G,L,V1,V2,W1,W2,T1,T2. ⦃G,L⦄ ⊢ V1 ➡[h] V2 → ⦃G,L⦄ ⊢ W1 ➡[h] W2 → ⦃G,L.ⓛW1⦄ ⊢ T1 ➡[h] T2 →
124                      Q G L V1 V2 → Q G L W1 W2 → Q G (L.ⓛW1) T1 T2 →
125                      Q G L (ⓐV1.ⓛ{p}W1.T1) (ⓓ{p}ⓝW2.V2.T2)
126                    ) → (∀p,G,L,V1,V,V2,W1,W2,T1,T2. ⦃G,L⦄ ⊢ V1 ➡[h] V → ⦃G,L⦄ ⊢ W1 ➡[h] W2 → ⦃G,L.ⓓW1⦄ ⊢ T1 ➡[h] T2 →
127                      Q G L V1 V → Q G L W1 W2 → Q G (L.ⓓW1) T1 T2 →
128                      ⇧*[1] V ≘ V2 → Q G L (ⓐV1.ⓓ{p}W1.T1) (ⓓ{p}W2.ⓐV2.T2)
129                    ) →
130                    ∀G,L,T1,T2. ⦃G,L⦄ ⊢ T1 ➡[h] T2 → Q G L T1 T2.
131 #h #Q #IH1 #IH2 #IH3 #IH4 #IH5 #IH6 #IH7 #IH8 #IH9 #G #L #T1 #T2
132 @(insert_eq_0 … 0) #n #H
133 @(cpm_ind … H) -G -L -T1 -T2 -n [2,4,11:|*: /3 width=4 by/ ]
134 [ #G #L #s #H destruct
135 | #n #G #K #V1 #V2 #W2 #_ #_ #_ #H destruct
136 | #n #G #L #U1 #U2 #T #_ #_ #H destruct
137 ]
138 qed-.
139
140 (* Basic_1: removed theorems 12:
141             pr0_subst0_back pr0_subst0_fwd pr0_subst0
142             pr0_delta1
143             pr2_head_2 pr2_cflat clear_pr2_trans
144             pr2_gen_csort pr2_gen_cflat pr2_gen_cbind
145             pr2_gen_ctail pr2_ctail
146 *)