]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/rt_transition/lfpr_lfpr.ma
update in basic_2
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / rt_transition / lfpr_lfpr.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_2/rt_transition/cpm_lsubr.ma".
16 include "basic_2/rt_transition/cpm_fsle.ma".
17 include "basic_2/rt_transition/cpr.ma".
18 include "basic_2/rt_transition/cpr_drops.ma".
19 include "basic_2/rt_transition/lfpr_drops.ma".
20 include "basic_2/rt_transition/lfpr_fqup.ma".
21
22 (* PARALLEL R-TRANSITION FOR LOCAL ENV.S ON REFERRED ENTRIES ****************)
23
24 (* Main properties with context-sensitive parallel r-transition for terms ***)
25
26 fact cpr_conf_lfpr_atom_atom:
27    ∀h,I,G,L1,L2. ∃∃T. ⦃G, L1⦄ ⊢ ⓪{I} ➡[h] T & ⦃G, L2⦄ ⊢ ⓪{I} ➡[h] T.
28 /2 width=3 by ex2_intro/ qed-.
29
30 fact cpr_conf_lfpr_atom_delta:
31    ∀h,G,L0,i. (
32       ∀L,T. ⦃G, L0, #i⦄ ⊐+ ⦃G, L, T⦄ →
33       ∀T1. ⦃G, L⦄ ⊢ T ➡[h] T1 → ∀T2. ⦃G, L⦄ ⊢ T ➡[h] T2 →
34       ∀L1. ⦃G, L⦄ ⊢ ➡[h, T] L1 → ∀L2. ⦃G, L⦄ ⊢ ➡[h, T] L2 →
35       ∃∃T0. ⦃G, L1⦄ ⊢ T1 ➡[h] T0 & ⦃G, L2⦄ ⊢ T2 ➡[h] T0
36    ) →
37    ∀K0,V0. ⬇*[i] L0 ≡ K0.ⓓV0 →
38    ∀V2. ⦃G, K0⦄ ⊢ V0 ➡[h] V2 → ∀T2. ⬆*[⫯i] V2 ≡ T2 →
39    ∀L1. ⦃G, L0⦄ ⊢ ➡[h, #i] L1 → ∀L2. ⦃G, L0⦄ ⊢ ➡[h, #i] L2 →
40    ∃∃T. ⦃G, L1⦄ ⊢ #i ➡[h] T & ⦃G, L2⦄ ⊢ T2 ➡[h] T.
41 #h #G #L0 #i #IH #K0 #V0 #HLK0 #V2 #HV02 #T2 #HVT2 #L1 #HL01 #L2 #HL02
42 elim (lfpr_inv_lref_pair_sn … HL01 … HLK0) -HL01 #K1 #V1 #HLK1 #HK01 #HV01
43 elim (lfpr_inv_lref_pair_sn … HL02 … HLK0) -HL02 #K2 #W2 #HLK2 #HK02 #_
44 lapply (drops_isuni_fwd_drop2 … HLK2) // -W2 #HLK2
45 lapply (fqup_lref (Ⓣ) … G … HLK0) -HLK0 #HLK0
46 elim (IH … HLK0 … HV01 … HV02 … HK01 … HK02) -L0 -K0 -V0 #V #HV1 #HV2
47 elim (cpm_lifts_sn … HV2 … HLK2 … HVT2) -K2 -V2
48 /3 width=6 by cpm_delta_drops, ex2_intro/
49 qed-.
50
51 (* Note: we don't use cpm_lifts_bi to preserve visual symmetry *)
52 fact cpr_conf_lfpr_delta_delta:
53    ∀h,G,L0,i. (
54       ∀L,T. ⦃G, L0, #i⦄ ⊐+ ⦃G, L, T⦄ →
55       ∀T1. ⦃G, L⦄ ⊢ T ➡[h] T1 → ∀T2. ⦃G, L⦄ ⊢ T ➡[h] T2 →
56       ∀L1. ⦃G, L⦄ ⊢ ➡[h, T] L1 → ∀L2. ⦃G, L⦄ ⊢ ➡[h, T] L2 →
57       ∃∃T0. ⦃G, L1⦄ ⊢ T1 ➡[h] T0 & ⦃G, L2⦄ ⊢ T2 ➡[h] T0
58    ) →
59    ∀K0,V0. ⬇*[i] L0 ≡ K0.ⓓV0 →
60    ∀V1. ⦃G, K0⦄ ⊢ V0 ➡[h] V1 → ∀T1. ⬆*[⫯i] V1 ≡ T1 →
61    ∀KX,VX. ⬇*[i] L0 ≡ KX.ⓓVX →
62    ∀V2. ⦃G, KX⦄ ⊢ VX ➡[h] V2 → ∀T2. ⬆*[⫯i] V2 ≡ T2 →
63    ∀L1. ⦃G, L0⦄ ⊢ ➡[h, #i] L1 → ∀L2. ⦃G, L0⦄ ⊢ ➡[h, #i] L2 →
64    ∃∃T. ⦃G, L1⦄ ⊢ T1 ➡[h] T & ⦃G, L2⦄ ⊢ T2 ➡[h] T.
65 #h #G #L0 #i #IH #K0 #V0 #HLK0 #V1 #HV01 #T1 #HVT1
66 #KX #VX #H #V2 #HV02 #T2 #HVT2 #L1 #HL01 #L2 #HL02
67 lapply (drops_mono … H … HLK0) -H #H destruct
68 elim (lfpr_inv_lref_pair_sn … HL01 … HLK0) -HL01 #K1 #W1 #HLK1 #HK01 #_
69 lapply (drops_isuni_fwd_drop2 … HLK1) -W1 // #HLK1
70 elim (lfpr_inv_lref_pair_sn … HL02 … HLK0) -HL02 #K2 #W2 #HLK2 #HK02 #_
71 lapply (drops_isuni_fwd_drop2 … HLK2) -W2 // #HLK2
72 lapply (fqup_lref (Ⓣ) … G … HLK0) -HLK0 #HLK0
73 elim (IH … HLK0 … HV01 … HV02 … HK01 … HK02) -L0 -K0 -V0 #V #HV1 #HV2
74 elim (cpm_lifts_sn … HV1 … HLK1 … HVT1) -K1 -V1 #T #HVT #HT1
75 elim (cpm_lifts_sn … HV2 … HLK2 … HVT2) -K2 -V2 #X #HX #HT2
76 lapply (lifts_mono … HX … HVT) #H destruct
77 /2 width=3 by ex2_intro/
78 qed-.
79
80 fact cpr_conf_lfpr_bind_bind:
81    ∀h,p,I,G,L0,V0,T0. (
82       ∀L,T. ⦃G, L0, ⓑ{p,I}V0.T0⦄ ⊐+ ⦃G, L, T⦄ →
83       ∀T1. ⦃G, L⦄ ⊢ T ➡[h] T1 → ∀T2. ⦃G, L⦄ ⊢ T ➡[h] T2 →
84       ∀L1. ⦃G, L⦄ ⊢ ➡[h, T] L1 → ∀L2. ⦃G, L⦄ ⊢ ➡[h, T] L2 →
85       ∃∃T0. ⦃G, L1⦄ ⊢ T1 ➡[h] T0 & ⦃G, L2⦄ ⊢ T2 ➡[h] T0
86    ) →
87    ∀V1. ⦃G, L0⦄ ⊢ V0 ➡[h] V1 → ∀T1. ⦃G, L0.ⓑ{I}V0⦄ ⊢ T0 ➡[h] T1 →
88    ∀V2. ⦃G, L0⦄ ⊢ V0 ➡[h] V2 → ∀T2. ⦃G, L0.ⓑ{I}V0⦄ ⊢ T0 ➡[h] T2 →
89    ∀L1. ⦃G, L0⦄ ⊢ ➡[h, ⓑ{p,I}V0.T0] L1 → ∀L2. ⦃G, L0⦄ ⊢ ➡[h, ⓑ{p,I}V0.T0] L2 →
90    ∃∃T. ⦃G, L1⦄ ⊢ ⓑ{p,I}V1.T1 ➡[h] T & ⦃G, L2⦄ ⊢ ⓑ{p,I}V2.T2 ➡[h] T.
91 #h #p #I #G #L0 #V0 #T0 #IH #V1 #HV01 #T1 #HT01
92 #V2 #HV02 #T2 #HT02 #L1 #HL01 #L2 #HL02
93 elim (lfpr_inv_bind … HL01) -HL01 #H1V0 #H1T0
94 elim (lfpr_inv_bind … HL02) -HL02 #H2V0 #H2T0
95 elim (IH … HV01 … HV02 … H1V0 … H2V0) //
96 elim (IH … HT01 … HT02 (L1.ⓑ{I}V1) … (L2.ⓑ{I}V2)) -IH
97 /3 width=5 by lfpr_bind_repl_dx, cpm_bind, ext2_pair, ex2_intro/
98 qed-.
99
100 fact cpr_conf_lfpr_bind_zeta:
101    ∀h,G,L0,V0,T0. (
102       ∀L,T. ⦃G, L0, +ⓓV0.T0⦄ ⊐+ ⦃G, L, T⦄ →
103       ∀T1. ⦃G, L⦄ ⊢ T ➡[h] T1 → ∀T2. ⦃G, L⦄ ⊢ T ➡[h] T2 →
104       ∀L1. ⦃G, L⦄ ⊢ ➡[h, T] L1 → ∀L2. ⦃G, L⦄ ⊢ ➡[h, T] L2 →
105       ∃∃T0. ⦃G, L1⦄ ⊢ T1 ➡[h] T0 & ⦃G, L2⦄ ⊢ T2 ➡[h] T0
106    ) →
107    ∀V1. ⦃G, L0⦄ ⊢ V0 ➡[h] V1 → ∀T1. ⦃G, L0.ⓓV0⦄ ⊢ T0 ➡[h] T1 →
108    ∀T2. ⦃G, L0.ⓓV0⦄ ⊢ T0 ➡[h] T2 → ∀X2. ⬆*[1] X2 ≡ T2 →
109    ∀L1. ⦃G, L0⦄ ⊢ ➡[h, +ⓓV0.T0] L1 → ∀L2. ⦃G, L0⦄ ⊢ ➡[h, +ⓓV0.T0] L2 →
110    ∃∃T. ⦃G, L1⦄ ⊢ +ⓓV1.T1 ➡[h] T & ⦃G, L2⦄ ⊢ X2 ➡[h] T.
111 #h #G #L0 #V0 #T0 #IH #V1 #HV01 #T1 #HT01
112 #T2 #HT02 #X2 #HXT2 #L1 #HL01 #L2 #HL02
113 elim (lfpr_inv_bind … HL01) -HL01 #H1V0 #H1T0
114 elim (lfpr_inv_bind … HL02) -HL02 #H2V0 #H2T0
115 elim (IH … HT01 … HT02 (L1.ⓓV1) … (L2.ⓓV1)) -IH -HT01 -HT02 /3 width=4 by lfpr_bind_repl_dx, ext2_pair/ -L0 -V0 -T0 #T #HT1 #HT2
116 elim (cpm_inv_lifts_sn … HT2 … L2 … HXT2) -T2 /3 width=3 by drops_refl, drops_drop, cpm_zeta, ex2_intro/
117 qed-.
118
119 (* Note: we don't use cpm_inv_lifts_bi to preserve visual symmetry *)
120 fact cpr_conf_lfpr_zeta_zeta:
121    ∀h,G,L0,V0,T0. (
122       ∀L,T. ⦃G, L0, +ⓓV0.T0⦄ ⊐+ ⦃G, L, T⦄ →
123       ∀T1. ⦃G, L⦄ ⊢ T ➡[h] T1 → ∀T2. ⦃G, L⦄ ⊢ T ➡[h] T2 →
124       ∀L1. ⦃G, L⦄ ⊢ ➡[h, T] L1 → ∀L2. ⦃G, L⦄ ⊢ ➡[h, T] L2 →
125       ∃∃T0. ⦃G, L1⦄ ⊢ T1 ➡[h] T0 & ⦃G, L2⦄ ⊢ T2 ➡[h] T0
126    ) →
127    ∀T1. ⦃G, L0.ⓓV0⦄ ⊢ T0 ➡[h] T1 → ∀X1. ⬆*[1] X1 ≡ T1 →
128    ∀T2. ⦃G, L0.ⓓV0⦄ ⊢ T0 ➡[h] T2 → ∀X2. ⬆*[1] X2 ≡ T2 →
129    ∀L1. ⦃G, L0⦄ ⊢ ➡[h, +ⓓV0.T0] L1 → ∀L2. ⦃G, L0⦄ ⊢ ➡[h, +ⓓV0.T0] L2 →
130    ∃∃T. ⦃G, L1⦄ ⊢ X1 ➡[h] T & ⦃G, L2⦄ ⊢ X2 ➡[h] T.
131 #h #G #L0 #V0 #T0 #IH #T1 #HT01 #X1 #HXT1
132 #T2 #HT02 #X2 #HXT2 #L1 #HL01 #L2 #HL02
133 elim (lfpr_inv_bind … HL01) -HL01 #H1V0 #H1T0
134 elim (lfpr_inv_bind … HL02) -HL02 #H2V0 #H2T0
135 elim (IH … HT01 … HT02 (L1.ⓓV0) … (L2.ⓓV0)) -IH -HT01 -HT02 /3 width=4 by lfpr_bind_repl_dx, ext2_pair/ -L0 -T0 #T #HT1 #HT2
136 elim (cpm_inv_lifts_sn … HT1 … L1 … HXT1) -T1 /3 width=2 by drops_refl, drops_drop/ #T1 #HT1 #HXT1
137 elim (cpm_inv_lifts_sn … HT2 … L2 … HXT2) -T2 /3 width=2 by drops_refl, drops_drop/ #T2 #HT2 #HXT2
138 lapply (lifts_inj … HT2 … HT1) -T #H destruct /2 width=3 by ex2_intro/
139 qed-.
140
141 fact cpr_conf_lfpr_flat_flat:
142    ∀h,I,G,L0,V0,T0. (
143       ∀L,T. ⦃G, L0, ⓕ{I}V0.T0⦄ ⊐+ ⦃G, L, T⦄ →
144       ∀T1. ⦃G, L⦄ ⊢ T ➡[h] T1 → ∀T2. ⦃G, L⦄ ⊢ T ➡[h] T2 →
145       ∀L1. ⦃G, L⦄ ⊢ ➡[h, T] L1 → ∀L2. ⦃G, L⦄ ⊢ ➡[h, T] L2 →
146       ∃∃T0. ⦃G, L1⦄ ⊢ T1 ➡[h] T0 & ⦃G, L2⦄ ⊢ T2 ➡[h] T0
147    ) →
148    ∀V1. ⦃G, L0⦄ ⊢ V0 ➡[h] V1 → ∀T1. ⦃G, L0⦄ ⊢ T0 ➡[h] T1 →
149    ∀V2. ⦃G, L0⦄ ⊢ V0 ➡[h] V2 → ∀T2. ⦃G, L0⦄ ⊢ T0 ➡[h] T2 →
150    ∀L1. ⦃G, L0⦄ ⊢ ➡[h, ⓕ{I}V0.T0] L1 → ∀L2. ⦃G, L0⦄ ⊢ ➡[h, ⓕ{I}V0.T0] L2 →
151    ∃∃T. ⦃G, L1⦄ ⊢ ⓕ{I}V1.T1 ➡[h] T & ⦃G, L2⦄ ⊢ ⓕ{I}V2.T2 ➡[h] T.
152 #h #I #G #L0 #V0 #T0 #IH #V1 #HV01 #T1 #HT01
153 #V2 #HV02 #T2 #HT02 #L1 #HL01 #L2 #HL02
154 elim (lfpr_inv_flat … HL01) -HL01 #H1V0 #H1T0
155 elim (lfpr_inv_flat … HL02) -HL02 #H2V0 #H2T0
156 elim (IH … HV01 … HV02 … H1V0 … H2V0) //
157 elim (IH … HT01 … HT02 … H1T0 … H2T0) /3 width=5 by cpr_flat, ex2_intro/
158 qed-.
159
160 fact cpr_conf_lfpr_flat_epsilon:
161    ∀h,G,L0,V0,T0. (
162       ∀L,T. ⦃G, L0, ⓝV0.T0⦄ ⊐+ ⦃G, L, T⦄ →
163       ∀T1. ⦃G, L⦄ ⊢ T ➡[h] T1 → ∀T2. ⦃G, L⦄ ⊢ T ➡[h] T2 →
164       ∀L1. ⦃G, L⦄ ⊢ ➡[h, T] L1 → ∀L2. ⦃G, L⦄ ⊢ ➡[h, T] L2 →
165       ∃∃T0. ⦃G, L1⦄ ⊢ T1 ➡[h] T0 & ⦃G, L2⦄ ⊢ T2 ➡[h] T0
166    ) →
167    ∀V1,T1. ⦃G, L0⦄ ⊢ T0 ➡[h] T1 → ∀T2. ⦃G, L0⦄ ⊢ T0 ➡[h] T2 →
168    ∀L1. ⦃G, L0⦄ ⊢ ➡[h, ⓝV0.T0] L1 → ∀L2. ⦃G, L0⦄ ⊢ ➡[h, ⓝV0.T0] L2 →
169    ∃∃T. ⦃G, L1⦄ ⊢ ⓝV1.T1 ➡[h] T & ⦃G, L2⦄ ⊢ T2 ➡[h] T.
170 #h #G #L0 #V0 #T0 #IH #V1 #T1 #HT01
171 #T2 #HT02 #L1 #HL01 #L2 #HL02
172 elim (lfpr_inv_flat … HL01) -HL01 #_ #H1T0
173 elim (lfpr_inv_flat … HL02) -HL02 #_ #H2T0
174 elim (IH … HT01 … HT02 … H1T0 … H2T0) // -L0 -V0 -T0 /3 width=3 by cpm_eps, ex2_intro/
175 qed-.
176
177 fact cpr_conf_lfpr_epsilon_epsilon:
178    ∀h,G,L0,V0,T0. (
179       ∀L,T. ⦃G, L0, ⓝV0.T0⦄ ⊐+ ⦃G, L, T⦄ →
180       ∀T1. ⦃G, L⦄ ⊢ T ➡[h] T1 → ∀T2. ⦃G, L⦄ ⊢ T ➡[h] T2 →
181       ∀L1. ⦃G, L⦄ ⊢ ➡[h, T] L1 → ∀L2. ⦃G, L⦄ ⊢ ➡[h, T] L2 →
182       ∃∃T0. ⦃G, L1⦄ ⊢ T1 ➡[h] T0 & ⦃G, L2⦄ ⊢ T2 ➡[h] T0
183    ) →
184    ∀T1. ⦃G, L0⦄ ⊢ T0 ➡[h] T1 → ∀T2. ⦃G, L0⦄ ⊢ T0 ➡[h] T2 →
185    ∀L1. ⦃G, L0⦄ ⊢ ➡[h, ⓝV0.T0] L1 → ∀L2. ⦃G, L0⦄ ⊢ ➡[h, ⓝV0.T0] L2 →
186    ∃∃T. ⦃G, L1⦄ ⊢ T1 ➡[h] T & ⦃G, L2⦄ ⊢ T2 ➡[h] T.
187 #h #G #L0 #V0 #T0 #IH #T1 #HT01
188 #T2 #HT02 #L1 #HL01 #L2 #HL02
189 elim (lfpr_inv_flat … HL01) -HL01 #_ #H1T0
190 elim (lfpr_inv_flat … HL02) -HL02 #_ #H2T0
191 elim (IH … HT01 … HT02 … H1T0 … H2T0) // -L0 -V0 -T0 /2 width=3 by ex2_intro/
192 qed-.
193
194 fact cpr_conf_lfpr_flat_beta:
195    ∀h,p,G,L0,V0,W0,T0. (
196       ∀L,T. ⦃G, L0, ⓐV0.ⓛ{p}W0.T0⦄ ⊐+ ⦃G, L, T⦄ →
197       ∀T1. ⦃G, L⦄ ⊢ T ➡[h] T1 → ∀T2. ⦃G, L⦄ ⊢ T ➡[h] T2 →
198       ∀L1. ⦃G, L⦄ ⊢ ➡[h, T] L1 → ∀L2. ⦃G, L⦄ ⊢ ➡[h, T] L2 →
199       ∃∃T0. ⦃G, L1⦄ ⊢ T1 ➡[h] T0 & ⦃G, L2⦄ ⊢ T2 ➡[h] T0
200    ) →
201    ∀V1. ⦃G, L0⦄ ⊢ V0 ➡[h] V1 → ∀T1. ⦃G, L0⦄ ⊢ ⓛ{p}W0.T0 ➡[h] T1 →
202    ∀V2. ⦃G, L0⦄ ⊢ V0 ➡[h] V2 → ∀W2. ⦃G, L0⦄ ⊢ W0 ➡[h] W2 → ∀T2. ⦃G, L0.ⓛW0⦄ ⊢ T0 ➡[h] T2 →
203    ∀L1. ⦃G, L0⦄ ⊢ ➡[h, ⓐV0.ⓛ{p}W0.T0] L1 → ∀L2. ⦃G, L0⦄ ⊢ ➡[h, ⓐV0.ⓛ{p}W0.T0] L2 →
204    ∃∃T. ⦃G, L1⦄ ⊢ ⓐV1.T1 ➡[h] T & ⦃G, L2⦄ ⊢ ⓓ{p}ⓝW2.V2.T2 ➡[h] T.
205 #h #p #G #L0 #V0 #W0 #T0 #IH #V1 #HV01 #X #H
206 #V2 #HV02 #W2 #HW02 #T2 #HT02 #L1 #HL01 #L2 #HL02
207 elim (cpm_inv_abst1 … H) -H #W1 #T1 #HW01 #HT01 #H destruct
208 elim (lfpr_inv_flat … HL01) -HL01 #H1V0 #HL01
209 elim (lfpr_inv_bind … HL01) -HL01 #H1W0 #H1T0
210 elim (lfpr_inv_flat … HL02) -HL02 #H2V0 #HL02
211 elim (lfpr_inv_bind … HL02) -HL02 #H2W0 #H2T0
212 elim (IH … HV01 … HV02 … H1V0 … H2V0) -HV01 -HV02 /2 width=1 by/ #V #HV1 #HV2
213 elim (IH … HW01 … HW02 … H1W0 … H2W0) /2 width=1 by/ #W #HW1 #HW2
214 elim (IH … HT01 … HT02 (L1.ⓛW1) … (L2.ⓛW2)) /3 width=4 by lfpr_bind_repl_dx, ext2_pair/ -L0 -V0 -W0 -T0 #T #HT1 #HT2
215 lapply (lsubr_cpm_trans … HT2 (L2.ⓓⓝW2.V2) ?) -HT2 /2 width=1 by lsubr_beta/ (**) (* full auto not tried *)
216 /4 width=5 by cpm_bind, cpr_flat, cpm_beta, ex2_intro/
217 qed-.
218
219 fact cpr_conf_lfpr_flat_theta:
220    ∀h,p,G,L0,V0,W0,T0. (
221       ∀L,T. ⦃G, L0, ⓐV0.ⓓ{p}W0.T0⦄ ⊐+ ⦃G, L, T⦄ →
222       ∀T1. ⦃G, L⦄ ⊢ T ➡[h] T1 → ∀T2. ⦃G, L⦄ ⊢ T ➡[h] T2 →
223       ∀L1. ⦃G, L⦄ ⊢ ➡[h, T] L1 → ∀L2. ⦃G, L⦄ ⊢ ➡[h, T] L2 →
224       ∃∃T0. ⦃G, L1⦄ ⊢ T1 ➡[h] T0 & ⦃G, L2⦄ ⊢ T2 ➡[h] T0
225    ) →
226    ∀V1. ⦃G, L0⦄ ⊢ V0 ➡[h] V1 → ∀T1. ⦃G, L0⦄ ⊢ ⓓ{p}W0.T0 ➡[h] T1 →
227    ∀V2. ⦃G, L0⦄ ⊢ V0 ➡[h] V2 → ∀U2. ⬆*[1] V2 ≡ U2 →
228    ∀W2. ⦃G, L0⦄ ⊢ W0 ➡[h] W2 → ∀T2. ⦃G, L0.ⓓW0⦄ ⊢ T0 ➡[h] T2 →
229    ∀L1. ⦃G, L0⦄ ⊢ ➡[h, ⓐV0.ⓓ{p}W0.T0] L1 → ∀L2. ⦃G, L0⦄ ⊢ ➡[h, ⓐV0.ⓓ{p}W0.T0] L2 →
230    ∃∃T. ⦃G, L1⦄ ⊢ ⓐV1.T1 ➡[h] T & ⦃G, L2⦄ ⊢ ⓓ{p}W2.ⓐU2.T2 ➡[h] T.
231 #h #p #G #L0 #V0 #W0 #T0 #IH #V1 #HV01 #X #H
232 #V2 #HV02 #U2 #HVU2 #W2 #HW02 #T2 #HT02 #L1 #HL01 #L2 #HL02
233 elim (lfpr_inv_flat … HL01) -HL01 #H1V0 #HL01
234 elim (lfpr_inv_bind … HL01) -HL01 #H1W0 #H1T0
235 elim (lfpr_inv_flat … HL02) -HL02 #H2V0 #HL02
236 elim (lfpr_inv_bind … HL02) -HL02 #H2W0 #H2T0
237 elim (IH … HV01 … HV02 … H1V0 … H2V0) -HV01 -HV02 /2 width=1 by/ #V #HV1 #HV2
238 elim (cpm_lifts_sn … HV2 … (L2.ⓓW2) … HVU2) -HVU2 /3 width=2 by drops_refl, drops_drop/ #U #HVU #HU2
239 elim (cpm_inv_abbr1 … H) -H *
240 [ #W1 #T1 #HW01 #HT01 #H destruct
241   elim (IH … HW01 … HW02 … H1W0 … H2W0) /2 width=1 by/
242   elim (IH … HT01 … HT02 (L1.ⓓW1) … (L2.ⓓW2)) /3 width=4 by lfpr_bind_repl_dx, ext2_pair/ -L0 -V0 -W0 -T0
243   /4 width=7 by cpm_bind, cpr_flat, cpm_theta, ex2_intro/
244 | #T1 #HT01 #HXT1 #H destruct
245   elim (IH … HT01 … HT02 (L1.ⓓW2) … (L2.ⓓW2)) /3 width=4 by lfpr_bind_repl_dx, ext2_pair/ -L0 -V0 -W0 -T0 #T #HT1 #HT2
246   elim (cpm_inv_lifts_sn … HT1 … L1 … HXT1) -HXT1
247   /4 width=9 by cpr_flat, cpm_zeta, drops_refl, drops_drop, lifts_flat, ex2_intro/
248 ]
249 qed-.
250
251 fact cpr_conf_lfpr_beta_beta:
252    ∀h,p,G,L0,V0,W0,T0. (
253       ∀L,T. ⦃G, L0, ⓐV0.ⓛ{p}W0.T0⦄ ⊐+ ⦃G, L, T⦄ →
254       ∀T1. ⦃G, L⦄ ⊢ T ➡[h] T1 → ∀T2. ⦃G, L⦄ ⊢ T ➡[h] T2 →
255       ∀L1. ⦃G, L⦄ ⊢ ➡[h, T] L1 → ∀L2. ⦃G, L⦄ ⊢ ➡[h, T] L2 →
256       ∃∃T0. ⦃G, L1⦄ ⊢ T1 ➡[h] T0 & ⦃G, L2⦄ ⊢ T2 ➡[h] T0
257    ) →
258    ∀V1. ⦃G, L0⦄ ⊢ V0 ➡[h] V1 → ∀W1. ⦃G, L0⦄ ⊢ W0 ➡[h] W1 → ∀T1. ⦃G, L0.ⓛW0⦄ ⊢ T0 ➡[h] T1 →
259    ∀V2. ⦃G, L0⦄ ⊢ V0 ➡[h] V2 → ∀W2. ⦃G, L0⦄ ⊢ W0 ➡[h] W2 → ∀T2. ⦃G, L0.ⓛW0⦄ ⊢ T0 ➡[h] T2 →
260    ∀L1. ⦃G, L0⦄ ⊢ ➡[h, ⓐV0.ⓛ{p}W0.T0] L1 → ∀L2. ⦃G, L0⦄ ⊢ ➡[h, ⓐV0.ⓛ{p}W0.T0] L2 →
261    ∃∃T. ⦃G, L1⦄ ⊢ ⓓ{p}ⓝW1.V1.T1 ➡[h] T & ⦃G, L2⦄ ⊢ ⓓ{p}ⓝW2.V2.T2 ➡[h] T.
262 #h #p #G #L0 #V0 #W0 #T0 #IH #V1 #HV01 #W1 #HW01 #T1 #HT01
263 #V2 #HV02 #W2 #HW02 #T2 #HT02 #L1 #HL01 #L2 #HL02
264 elim (lfpr_inv_flat … HL01) -HL01 #H1V0 #HL01
265 elim (lfpr_inv_bind … HL01) -HL01 #H1W0 #H1T0
266 elim (lfpr_inv_flat … HL02) -HL02 #H2V0 #HL02
267 elim (lfpr_inv_bind … HL02) -HL02 #H2W0 #H2T0
268 elim (IH … HV01 … HV02 … H1V0 … H2V0) -HV01 -HV02 /2 width=1 by/ #V #HV1 #HV2
269 elim (IH … HW01 … HW02 … H1W0 … H2W0) /2 width=1/ #W #HW1 #HW2
270 elim (IH … HT01 … HT02 (L1.ⓛW1) … (L2.ⓛW2)) /3 width=4 by lfpr_bind_repl_dx, ext2_pair/ -L0 -V0 -W0 -T0 #T #HT1 #HT2
271 lapply (lsubr_cpm_trans … HT1 (L1.ⓓⓝW1.V1) ?) -HT1 /2 width=1 by lsubr_beta/
272 lapply (lsubr_cpm_trans … HT2 (L2.ⓓⓝW2.V2) ?) -HT2 /2 width=1 by lsubr_beta/
273 /4 width=5 by cpm_bind, cpr_flat, ex2_intro/ (**) (* full auto not tried *)
274 qed-.
275
276 (* Note: we don't use cpm_lifts_bi to preserve visual symmetry *)
277 fact cpr_conf_lfpr_theta_theta:
278    ∀h,p,G,L0,V0,W0,T0. (
279       ∀L,T. ⦃G, L0, ⓐV0.ⓓ{p}W0.T0⦄ ⊐+ ⦃G, L, T⦄ →
280       ∀T1. ⦃G, L⦄ ⊢ T ➡[h] T1 → ∀T2. ⦃G, L⦄ ⊢ T ➡[h] T2 →
281       ∀L1. ⦃G, L⦄ ⊢ ➡[h, T] L1 → ∀L2. ⦃G, L⦄ ⊢ ➡[h, T] L2 →
282       ∃∃T0. ⦃G, L1⦄ ⊢ T1 ➡[h] T0 & ⦃G, L2⦄ ⊢ T2 ➡[h] T0
283    ) →
284    ∀V1. ⦃G, L0⦄ ⊢ V0 ➡[h] V1 → ∀U1. ⬆*[1] V1 ≡ U1 →
285    ∀W1. ⦃G, L0⦄ ⊢ W0 ➡[h] W1 → ∀T1. ⦃G, L0.ⓓW0⦄ ⊢ T0 ➡[h] T1 →
286    ∀V2. ⦃G, L0⦄ ⊢ V0 ➡[h] V2 → ∀U2. ⬆*[1] V2 ≡ U2 →
287    ∀W2. ⦃G, L0⦄ ⊢ W0 ➡[h] W2 → ∀T2. ⦃G, L0.ⓓW0⦄ ⊢ T0 ➡[h] T2 →
288    ∀L1. ⦃G, L0⦄ ⊢ ➡[h, ⓐV0.ⓓ{p}W0.T0] L1 → ∀L2. ⦃G, L0⦄ ⊢ ➡[h, ⓐV0.ⓓ{p}W0.T0] L2 →
289    ∃∃T. ⦃G, L1⦄ ⊢ ⓓ{p}W1.ⓐU1.T1 ➡[h] T & ⦃G, L2⦄ ⊢ ⓓ{p}W2.ⓐU2.T2 ➡[h] T.
290 #h #p #G #L0 #V0 #W0 #T0 #IH #V1 #HV01 #U1 #HVU1 #W1 #HW01 #T1 #HT01
291 #V2 #HV02 #U2 #HVU2 #W2 #HW02 #T2 #HT02 #L1 #HL01 #L2 #HL02
292 elim (lfpr_inv_flat … HL01) -HL01 #H1V0 #HL01
293 elim (lfpr_inv_bind … HL01) -HL01 #H1W0 #H1T0
294 elim (lfpr_inv_flat … HL02) -HL02 #H2V0 #HL02
295 elim (lfpr_inv_bind … HL02) -HL02 #H2W0 #H2T0
296 elim (IH … HV01 … HV02 … H1V0 … H2V0) -HV01 -HV02 /2 width=1 by/ #V #HV1 #HV2
297 elim (IH … HW01 … HW02 … H1W0 … H2W0) /2 width=1 by/
298 elim (IH … HT01 … HT02 (L1.ⓓW1) … (L2.ⓓW2)) /3 width=4 by lfpr_bind_repl_dx, ext2_pair/ -L0 -V0 -W0 -T0
299 elim (cpm_lifts_sn … HV1 … (L1.ⓓW1) … HVU1) -HVU1 /3 width=2 by drops_refl, drops_drop/ #U #HVU
300 elim (cpm_lifts_sn … HV2 … (L2.ⓓW2) … HVU2) -HVU2 /3 width=2 by drops_refl, drops_drop/ #X #HX
301 lapply (lifts_mono … HX … HVU) -HX #H destruct
302 /4 width=7 by cpm_bind, cpr_flat, ex2_intro/ (**) (* full auto not tried *)
303 qed-.
304
305 theorem cpr_conf_lfpr: ∀h,G. R_confluent2_lfxs (cpm 0 h G) (cpm 0 h G) (cpm 0 h G) (cpm 0 h G).
306 #h #G #L0 #T0 @(fqup_wf_ind_eq (Ⓣ) … G L0 T0) -G -L0 -T0 #G #L #T #IH #G0 #L0 * [| * ]
307 [ #I0 #HG #HL #HT #T1 #H1 #T2 #H2 #L1 #HL01 #L2 #HL02 destruct
308   elim (cpr_inv_atom1_drops … H1) -H1
309   elim (cpr_inv_atom1_drops … H2) -H2
310   [ #H2 #H1 destruct
311     /2 width=1 by cpr_conf_lfpr_atom_atom/
312   | * #K0 #V0 #V2 #i2 #HLK0 #HV02 #HVT2 #H2 #H1 destruct
313     /3 width=10 by cpr_conf_lfpr_atom_delta/
314   | #H2 * #K0 #V0 #V1 #i1 #HLK0 #HV01 #HVT1 #H1 destruct
315     /4 width=10 by ex2_commute, cpr_conf_lfpr_atom_delta/
316   | * #X #Y #V2 #z #H #HV02 #HVT2 #H2
317     * #K0 #V0 #V1 #i #HLK0 #HV01 #HVT1 #H1 destruct
318     /3 width=17 by cpr_conf_lfpr_delta_delta/
319   ]
320 | #p #I #V0 #T0 #HG #HL #HT #X1 #H1 #X2 #H2 #L1 #HL01 #L2 #HL02 destruct
321   elim (cpm_inv_bind1 … H1) -H1 *
322   [ #V1 #T1 #HV01 #HT01 #H1
323   | #T1 #HT01 #HXT1 #H11 #H12
324   ]
325   elim (cpm_inv_bind1 … H2) -H2 *
326   [1,3: #V2 #T2 #HV02 #HT02 #H2
327   |2,4: #T2 #HT02 #HXT2 #H21 #H22
328   ] destruct
329   [ /3 width=10 by cpr_conf_lfpr_bind_bind/
330   | /4 width=11 by ex2_commute, cpr_conf_lfpr_bind_zeta/
331   | /3 width=11 by cpr_conf_lfpr_bind_zeta/
332   | /3 width=12 by cpr_conf_lfpr_zeta_zeta/
333   ]
334 | #I #V0 #T0 #HG #HL #HT #X1 #H1 #X2 #H2 #L1 #HL01 #L2 #HL02 destruct
335   elim (cpr_inv_flat1 … H1) -H1 *
336   [ #V1 #T1 #HV01 #HT01 #H1
337   | #HX1 #H1
338   | #p1 #V1 #Y1 #W1 #Z1 #T1 #HV01 #HYW1 #HZT1 #H11 #H12 #H13
339   | #p1 #V1 #U1 #Y1 #W1 #Z1 #T1 #HV01 #HVU1 #HYW1 #HZT1 #H11 #H12 #H13
340   ]
341   elim (cpr_inv_flat1 … H2) -H2 *
342   [1,5,9,13: #V2 #T2 #HV02 #HT02 #H2
343   |2,6,10,14: #HX2 #H2
344   |3,7,11,15: #p2 #V2 #Y2 #W2 #Z2 #T2 #HV02 #HYW2 #HZT2 #H21 #H22 #H23
345   |4,8,12,16: #p2 #V2 #U2 #Y2 #W2 #Z2 #T2 #HV02 #HVU2 #HYW2 #HZT2 #H21 #H22 #H23
346   ] destruct
347   [ /3 width=10 by cpr_conf_lfpr_flat_flat/
348   | /4 width=8 by ex2_commute, cpr_conf_lfpr_flat_epsilon/
349   | /4 width=12 by ex2_commute, cpr_conf_lfpr_flat_beta/
350   | /4 width=14 by ex2_commute, cpr_conf_lfpr_flat_theta/
351   | /3 width=8 by cpr_conf_lfpr_flat_epsilon/
352   | /3 width=8 by cpr_conf_lfpr_epsilon_epsilon/
353   | /3 width=12 by cpr_conf_lfpr_flat_beta/
354   | /3 width=13 by cpr_conf_lfpr_beta_beta/
355   | /3 width=14 by cpr_conf_lfpr_flat_theta/
356   | /3 width=17 by cpr_conf_lfpr_theta_theta/
357   ]
358 ]
359 qed-.
360
361 (* Basic_1: includes: pr0_confluence pr2_confluence *)
362 theorem cpr_conf: ∀h,G,L. confluent … (cpm 0 h G L).
363 /2 width=6 by cpr_conf_lfpr/ qed-.
364
365 (* Properties with context-sensitive parallel r-transition for terms ********)
366
367 lemma lfpr_cpr_conf_dx: ∀h,G,L0,T0,T1. ⦃G, L0⦄ ⊢ T0 ➡[h] T1 → ∀L1. ⦃G, L0⦄ ⊢ ➡[h, T0] L1 →
368                         ∃∃T. ⦃G, L1⦄ ⊢ T0 ➡[h] T & ⦃G, L1⦄ ⊢ T1 ➡[h] T.
369 #h #G #L0 #T0 #T1 #HT01 #L1 #HL01
370 elim (cpr_conf_lfpr … HT01 T0 … HL01 … HL01) /2 width=3 by ex2_intro/
371 qed-.
372
373 lemma lfpr_cpr_conf_sn: ∀h,G,L0,T0,T1. ⦃G, L0⦄ ⊢ T0 ➡[h] T1 → ∀L1. ⦃G, L0⦄ ⊢ ➡[h, T0] L1 →
374                         ∃∃T. ⦃G, L1⦄ ⊢ T0 ➡[h] T & ⦃G, L0⦄ ⊢ T1 ➡[h] T.
375 #h #G #L0 #T0 #T1 #HT01 #L1 #HL01
376 elim (cpr_conf_lfpr … HT01 T0 … L0 … HL01) /2 width=3 by ex2_intro/
377 qed-.
378
379 (* Main properties **********************************************************)
380
381 theorem lfpr_conf: ∀h,G,T. confluent … (lfpr h G T).
382 /3 width=6 by cpr_conf_lfpr, lfpr_fsge_comp, lfxs_conf/ qed-.
383
384 theorem lfpr_bind: ∀h,G,L1,L2,V1. ⦃G, L1⦄ ⊢ ➡[h, V1] L2 →
385                    ∀I,V2,T. ⦃G, L1.ⓑ{I}V1⦄ ⊢ ➡[h, T] L2.ⓑ{I}V2 →
386                    ∀p. ⦃G, L1⦄ ⊢ ➡[h, ⓑ{p,I}V1.T] L2.
387 /2 width=2 by lfxs_bind/ qed.
388
389 theorem lfpr_flat: ∀h,G,L1,L2,V. ⦃G, L1⦄ ⊢ ➡[h, V] L2 →
390                    ∀I,T. ⦃G, L1⦄ ⊢ ➡[h, T] L2 → ⦃G, L1⦄ ⊢ ➡[h, ⓕ{I}V.T] L2.
391 /2 width=1 by lfxs_flat/ qed.
392
393 theorem lfpr_bind_void: ∀h,G,L1,L2,V. ⦃G, L1⦄ ⊢ ➡[h, V] L2 →
394                         ∀T. ⦃G, L1.ⓧ⦄ ⊢ ➡[h, T] L2.ⓧ →
395                         ∀p,I. ⦃G, L1⦄ ⊢ ➡[h, ⓑ{p,I}V.T] L2.
396 /2 width=1 by lfxs_bind_void/ qed.