1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 include "ground/xoa/ex_4_1_props.ma".
16 include "basic_2/rt_computation/fpbg_fqus.ma".
17 include "basic_2/dynamic/cnv_cpm_teqx.ma".
19 (* CONTEXT-SENSITIVE NATIVE VALIDITY FOR TERMS ******************************)
21 definition IH_cnv_cpm_teqx_conf_lpr (h) (a): relation3 genv lenv term ≝
22 λG,L0,T0. ❨G,L0❩ ⊢ T0 ![h,a] →
23 ∀n1,T1. ❨G,L0❩ ⊢ T0 ➡[h,n1] T1 → T0 ≅ T1 →
24 ∀n2,T2. ❨G,L0❩ ⊢ T0 ➡[h,n2] T2 → T0 ≅ T2 →
25 ∀L1. ❨G,L0❩ ⊢ ➡[h,0] L1 → ∀L2. ❨G,L0❩ ⊢ ➡[h,0] L2 →
26 ∃∃T. ❨G,L1❩ ⊢ T1 ➡[h,n2-n1] T & T1 ≅ T & ❨G,L2❩ ⊢ T2 ➡[h,n1-n2] T & T2 ≅ T.
28 (* Diamond propery with restricted rt-transition for terms ******************)
30 fact cnv_cpm_teqx_conf_lpr_atom_atom_aux (h) (G0) (L1) (L2) (I):
31 ∃∃T. ❨G0,L1❩ ⊢ ⓪[I] ➡[h,0] T & ⓪[I] ≅ T & ❨G0,L2❩ ⊢ ⓪[I] ➡[h,0] T & ⓪[I] ≅ T.
33 /2 width=5 by ex4_intro/
36 fact cnv_cpm_teqx_conf_lpr_atom_ess_aux (h) (G0) (L1) (L2) (s):
37 ∃∃T. ❨G0,L1❩ ⊢ ⋆s ➡[h,1] T & ⋆s ≅ T & ❨G0,L2❩ ⊢ ⋆(⫯[h]s) ➡[h,0] T & ⋆(⫯[h]s) ≅ T.
39 /3 width=5 by teqg_sort, ex4_intro/
42 fact cnv_cpm_teqx_conf_lpr_bind_bind_aux (h) (a) (p) (I) (G0) (L0) (V0) (T0):
43 (∀G,L,T. ❨G0,L0,ⓑ[p,I]V0.T0❩ ⬂+ ❨G,L,T❩ → IH_cnv_cpm_teqx_conf_lpr h a G L T) →
44 ❨G0,L0❩ ⊢ ⓑ[p,I]V0.T0 ![h,a] →
45 ∀n1,T1. ❨G0,L0.ⓑ[I]V0❩ ⊢ T0 ➡[h,n1] T1 → T0 ≅ T1 →
46 ∀n2,T2. ❨G0,L0.ⓑ[I]V0❩ ⊢ T0 ➡[h,n2] T2 → T0 ≅ T2 →
47 ∀L1. ❨G0,L0❩ ⊢ ➡[h,0] L1 → ∀L2. ❨G0,L0❩ ⊢ ➡[h,0] L2 →
48 ∃∃T. ❨G0,L1❩ ⊢ ⓑ[p,I]V0.T1 ➡[h,n2-n1] T & ⓑ[p,I]V0.T1 ≅ T & ❨G0,L2❩ ⊢ ⓑ[p,I]V0.T2 ➡[h,n1-n2] T & ⓑ[p,I]V0.T2 ≅ T.
49 #h #a #p #I #G0 #L0 #V0 #T0 #IH #H0
50 #n1 #T1 #H1T01 #H2T01 #n2 #T2 #H1T02 #H2T02
52 elim (cnv_inv_bind … H0) -H0 #_ #HT0
53 elim (IH … H1T01 H2T01 … H1T02 H2T02 (L1.ⓑ[I]V0) … (L2.ⓑ[I]V0)) [|*: /2 width=1 by lpr_bind_refl_dx/ ]
54 #T #H1T1 #H2T1 #H1T2 #H2T2 -L0 -T0
55 /3 width=7 by cpm_bind, teqx_pair, ex4_intro/
58 fact cnv_cpm_teqx_conf_lpr_appl_appl_aux (h) (a) (G0) (L0) (V0) (T0):
59 (∀G,L,T. ❨G0,L0,ⓐV0.T0❩ ⬂+ ❨G,L,T❩ → IH_cnv_cpm_teqx_conf_lpr h a G L T) →
60 ❨G0,L0❩ ⊢ ⓐV0.T0 ![h,a] →
61 ∀n1,T1. ❨G0,L0❩ ⊢ T0 ➡[h,n1] T1 → T0 ≅ T1 →
62 ∀n2,T2. ❨G0,L0❩ ⊢ T0 ➡[h,n2] T2 → T0 ≅ T2 →
63 ∀L1. ❨G0,L0❩ ⊢ ➡[h,0] L1 → ∀L2. ❨G0,L0❩ ⊢ ➡[h,0] L2 →
64 ∃∃T. ❨G0,L1❩ ⊢ ⓐV0.T1 ➡[h,n2-n1] T & ⓐV0.T1 ≅ T & ❨G0,L2❩ ⊢ ⓐV0.T2 ➡[h,n1-n2] T & ⓐV0.T2 ≅ T.
65 #h #a #G0 #L0 #V0 #T0 #IH #H0
66 #n1 #T1 #H1T01 #H2T01 #n2 #T2 #H1T02 #H2T02
68 elim (cnv_inv_appl … H0) -H0 #n0 #p0 #X01 #X02 #_ #_ #HT0 #_ #_ -n0 -p0 -X01 -X02
69 elim (IH … H1T01 H2T01 … H1T02 H2T02 … HL01 … HL02) [|*: /2 width=1 by fqup_fpbg/ ]
70 #T #H1T1 #H2T1 #H1T2 #H2T2 -L0 -T0
71 /3 width=7 by cpm_appl, teqx_pair, ex4_intro/
74 fact cnv_cpm_teqx_conf_lpr_cast_cast_aux (h) (a) (G0) (L0) (V0) (T0):
75 (∀G,L,T. ❨G0,L0,ⓝV0.T0❩ ⬂+ ❨G,L,T❩ → IH_cnv_cpm_teqx_conf_lpr h a G L T) →
76 ❨G0,L0❩ ⊢ ⓝV0.T0 ![h,a] →
77 ∀n1,V1. ❨G0,L0❩ ⊢ V0 ➡[h,n1] V1 → V0 ≅ V1 →
78 ∀n2,V2. ❨G0,L0❩ ⊢ V0 ➡[h,n2] V2 → V0 ≅ V2 →
79 ∀T1. ❨G0,L0❩ ⊢ T0 ➡[h,n1] T1 → T0 ≅ T1 →
80 ∀T2. ❨G0,L0❩ ⊢ T0 ➡[h,n2] T2 → T0 ≅ T2 →
81 ∀L1. ❨G0,L0❩ ⊢ ➡[h,0] L1 → ∀L2. ❨G0,L0❩ ⊢ ➡[h,0] L2 →
82 ∃∃T. ❨G0,L1❩ ⊢ ⓝV1.T1 ➡[h,n2-n1] T & ⓝV1.T1 ≅ T & ❨G0,L2❩ ⊢ ⓝV2.T2 ➡[h,n1-n2] T & ⓝV2.T2 ≅ T.
83 #h #a #G0 #L0 #V0 #T0 #IH #H0
84 #n1 #V1 #H1V01 #H2V01 #n2 #V2 #H1V02 #H2V02 #T1 #H1T01 #H2T01 #T2 #H1T02 #H2T02
86 elim (cnv_inv_cast … H0) -H0 #X0 #HV0 #HT0 #_ #_ -X0
87 elim (IH … H1V01 H2V01 … H1V02 H2V02 … HL01 … HL02) [|*: /2 width=1 by fqup_fpbg/ ]
88 elim (IH … H1T01 H2T01 … H1T02 H2T02 … HL01 … HL02) [|*: /2 width=1 by fqup_fpbg/ ]
89 #T #H1T1 #H2T1 #H1T2 #H2T2 #V #H1V1 #H2V1 #H1V2 #H2V2 -L0 -V0 -T0
90 /3 width=7 by cpm_cast, teqx_pair, ex4_intro/
93 fact cnv_cpm_teqx_conf_lpr_aux (h) (a) (G0) (L0) (T0):
94 (∀G,L,T. ❨G0,L0,T0❩ ⬂+ ❨G,L,T❩ → IH_cnv_cpm_teqx_conf_lpr h a G L T) →
95 ∀G,L,T. G0 = G → L0 = L → T0 = T → IH_cnv_cpm_teqx_conf_lpr h a G L T.
96 #h #a #G0 #L0 #T0 #IH1 #G #L * [| * [| * ]]
97 [ #I #HG0 #HL0 #HT0 #HT #n1 #X1 #H1X1 #H2X1 #n2 #X2 #H1X2 #H2X2 #L1 #HL1 #L2 #HL2 destruct
98 elim (cpm_teqx_inv_atom_sn … H1X1 H2X1) -H1X1 -H2X1 *
99 elim (cpm_teqx_inv_atom_sn … H1X2 H2X2) -H1X2 -H2X2 *
100 [ #H21 #H22 #H11 #H12 destruct -a -L
102 /2 width=1 by cnv_cpm_teqx_conf_lpr_atom_atom_aux/
103 | #s2 #H21 #H22 #H23 #H11 #H12 destruct -a -L
104 <minus_O_n <minus_n_O
105 /2 width=1 by cnv_cpm_teqx_conf_lpr_atom_ess_aux/
106 | #H21 #H22 #s1 #H11 #H12 #H13 destruct -a -L
107 <minus_O_n <minus_n_O
108 @ex4_commute /2 width=1 by cnv_cpm_teqx_conf_lpr_atom_ess_aux/
109 | #s2 #H21 #H22 #H23 #s1 #H11 #H12 #H13 destruct -a -L
111 /2 width=1 by cnv_cpm_teqx_conf_lpr_atom_atom_aux/
113 | #p #I #V #T #HG0 #HL0 #HT0 #HT #n1 #X1 #H1X1 #H2X1 #n2 #X2 #H1X2 #H2X2 #L1 #HL1 #L2 #HL2 destruct
114 elim (cpm_teqx_inv_bind_sn … HT … H1X1 H2X1) -H1X1 -H2X1
115 elim (cpm_teqx_inv_bind_sn … HT … H1X2 H2X2) -H1X2 -H2X2
116 #T2 #_ #_ #H1T2 #H2T2 #H21 #T1 #_ #_ #H1T1 #H2T1 #H11 destruct
117 @(cnv_cpm_teqx_conf_lpr_bind_bind_aux … IH1) -IH1 /1 width=1 by/
118 | #V #T #HG0 #HL0 #HT0 #HT #n1 #X1 #H1X1 #H2X1 #n2 #X2 #H1X2 #H2X2 #L1 #HL1 #L2 #HL2 destruct
119 elim (cpm_teqx_inv_appl_sn … HT … H1X1 H2X1) -H1X1 -H2X1
120 elim (cpm_teqx_inv_appl_sn … HT … H1X2 H2X2) -H1X2 -H2X2
121 #m2 #q2 #W2 #U2 #T2 #_ #_ #_ #_ #_ #H1T2 #H2T2 #H21 #m1 #q1 #W1 #U1 #T1 #_ #_ #_ #_ #_ #H1T1 #H2T1 #H11 destruct -m1 -m2 -q1 -q2 -W1 -W2 -U1 -U2
122 @(cnv_cpm_teqx_conf_lpr_appl_appl_aux … IH1) -IH1 /1 width=1 by/
123 | #V #T #HG0 #HL0 #HT0 #HT #n1 #X1 #H1X1 #H2X1 #n2 #X2 #H1X2 #H2X2 #L1 #HL1 #L2 #HL2 destruct
124 elim (cpm_teqx_inv_cast_sn … HT … H1X1 H2X1) -H1X1 -H2X1
125 elim (cpm_teqx_inv_cast_sn … HT … H1X2 H2X2) -H1X2 -H2X2
126 #U2 #V2 #T2 #_ #_ #_ #H1V2 #H2V2 #_ #H1T2 #H2T2 #H21 #U1 #V1 #T1 #_ #_ #_ #H1V1 #H2V1 #_ #H1T1 #H2T1 #H11 destruct -U1 -U2
127 @(cnv_cpm_teqx_conf_lpr_cast_cast_aux … IH1) -IH1 /1 width=1 by/
131 lemma cnv_cpm_teqx_conf_lpr (h) (a) (G0) (L0) (T0):
132 IH_cnv_cpm_teqx_conf_lpr h a G0 L0 T0.
134 @(fqup_wf_ind (Ⓣ) … G0 L0 T0) -G0 -L0 -T0 #G0 #L0 #T0 #IH
135 /3 width=17 by cnv_cpm_teqx_conf_lpr_aux/