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 "basic_2/rt_transition/cpr_drops_basic.ma".
16 include "basic_2/dynamic/nta_ind.ma".
18 lemma lpr_cpr_conf_cpc_sym (h) (G) (L1):
19 ∀T1,T2:term. ⦃G,L1⦄ ⊢ T1 ➡[h] T2 →
20 ∀L2. ⦃G,L1⦄ ⊢ ➡[h] L2 → ⦃G,L2⦄ ⊢ T2 ⬌*[h] T1.
21 #h #G #L1 #T1 #T2 #HT12 #L2 #HL12
22 elim (lpr_cpr_conf_dx … HT12 … HL12) -L1 #T #HT1 #HT2
23 /3 width=3 by cprs_div, cpm_cpms/
26 (* NATIVE TYPE ASSIGNMENT FOR TERMS *****************************************)
28 definition IH_nta (h) (G) (L1) (T1) ≝
29 ∀U. ⦃G,L1⦄ ⊢ T1 :[h,𝟐] U → ∀T2. ⦃G,L1⦄ ⊢ T1 ➡[h] T2 →
30 ∀L2. ⦃G,L1⦄ ⊢ ➡[h] L2 → ⦃G,L2⦄ ⊢ T2 :[h,𝟐] U.
32 definition IH_cnv (h) (G) (L1) (T1) ≝
33 (⦃G,L1⦄ ⊢ T1 ![h,𝟐]) → ∀T2. ⦃G,L1⦄ ⊢ T1 ➡[h] T2 →
34 ∀L2. ⦃G,L1⦄ ⊢ ➡[h] L2 → ⦃G,L2⦄ ⊢ T2 ![h,𝟐].
36 (* Specific proofs for restricted applicability *****************************)
38 lemma nta_to_cnv (h) (G) (L1) (T1):
39 IH_nta h G L1 T1 → IH_cnv h G L1 T1.
40 #h #G #L1 #T1 #H #HT1 #T2 #HT12 #L2 #HL12
41 elim (cnv_nta_sn … HT1) -HT1 #U1 #HTU1
42 /3 width=2 by nta_fwd_cnv_sn/
45 (* Note preservation of type without big-tree theorem *)
46 lemma nta_cpr_conf_lpr (h) (G) (L1) (T1): IH_nta h G L1 T1.
47 #h #G #L1 #T1 @(fqup_wf_ind (Ⓣ) … G L1 T1) -G -L1 -T1
49 @(insert_eq_0 … T0) #T1
50 @(insert_eq_0 … L0) #L1
51 @(insert_eq_0 … G0) #G
52 #H @(nta_ind_rest_cnv … H) -G -L1 -T1 -U
53 [ #G #L1 #s #HG0 #HL0 #HT0 #X #HX #L2 #HL12 destruct -IH
54 lapply (cpr_inv_sort1 … HX) -HX #H destruct //
55 | #G #K1 #V1 #W1 #U #HVW1 #HW1U #_ #HG0 #HL0 #HT0 #X #HX #Y #HY destruct
56 elim (lpr_inv_pair_sn … HY) -HY #K2 #V2 #HK12 #HV12 #H destruct
57 elim (cpr_inv_zero1 … HX) -HX
59 /4 width=6 by nta_ldef, fqu_fqup, fqu_lref_O/
60 | * #Y1 #X1 #X2 #HX12 #HX2 #H destruct -HV12
61 @(nta_lifts_bi … (Ⓣ) … HX2 … HW1U) -X -U
62 /4 width=6 by drops_refl, drops_drop, fqu_fqup, fqu_lref_O/
64 | #G #K1 #W1 #V1 #HW1 #HWV1 #HG0 #HL0 #HT0 #X #HX #Y #HY destruct
65 elim (lpr_inv_pair_sn … HY) -HY #K2 #W2 #HK12 #HW12 #H destruct
66 elim (cpr_inv_zero1 … HX) -HX
68 lapply (nta_to_cnv … HW1 … W1 … HK12)
69 [1,2: /3 width=1 by fqu_fqup, fqu_lref_O/ ] #H
70 lapply (cnv_lifts … H (Ⓣ) … (K2.ⓛW2) … HWV1) -H
71 [ /3 width=1 by drops_refl, drops_drop/ ] #HV1
72 elim (cpm_lifts_sn … HW12 (Ⓣ) … (K1.ⓛW2) … HWV1) -HWV1
73 [2: /3 width=1 by drops_refl, drops_drop/ ] #V2 #HWV2 #HV12
74 lapply (nta_to_cnv … HW1 … HW12 … HK12) -HW1 -HW12
75 [ /3 width=1 by fqu_fqup, fqu_lref_O/ ] -IH #HW2
77 /3 width=3 by nta_ldec_cnv, lpr_cpr_conf_cpc_sym, lpr_bind_refl_dx/
78 | * #Y1 #X1 #X2 #_ #_ #H destruct
80 | #I1 #G #K1 #T1 #U1 #i #Hi #HTU1 #_ #HG0 #HL0 #HT0 #X #HX #Y #HY destruct
81 elim (lpr_inv_bind_sn … HY) -HY #I2 #K2 #HK12 #_ #H destruct
82 elim (cpr_inv_lref1 … HX) -HX
83 [ #H destruct /4 width=6 by nta_lref, fqu_fqup/
84 | * #Z1 #Y1 #X1 #HiX1 #HX1 #H destruct
85 @(nta_lifts_bi … (Ⓣ) … HX1 … HTU1) -X -U1
86 /4 width=6 by drops_refl, drops_drop, fqu_fqup/
88 | #p #I #G #L1 #V1 #T1 #U #HV1 #HT1 #_ #HG0 #HL0 #HT0 #X #HX #L2 #HL12 destruct
89 elim (cpm_inv_bind1 … HX) -HX *
90 [ #V2 #T2 #HV12 #HT12 #H destruct
91 lapply (IH … HT1 T1 … (L2.ⓑ{I}V1) ?)
92 [4:|*: /2 width=1 by lpr_bind_refl_dx/ ] #H
93 lapply (nta_fwd_cnv_dx … H) -H #HU
94 @(nta_conv_cnv … (ⓑ{p,I}V2.U))
95 [ @nta_bind_cnv [ /3 width=6 by nta_to_cnv/ | /4 width=8 by lpr_bind, ext2_pair/ ]
96 | /3 width=3 by lpr_cpr_conf_cpc_sym, cpr_pair_sn/
97 | /4 width=6 by nta_to_cnv, cnv_bind/
99 | #U1 #HUT1 #HU1X #H1 #H2 destruct
101 elim (cpr_subst h G (L1.ⓓV1) U 0)
102 [|*: /3 width=3 by drops_refl/ ] #U0 #T0 #HU0 #HTU0
103 lapply (nta_conv_cnv … HT1 … U0 ??)
104 [ @(cnv_lifts … HTU0)
106 @(IH … HU1X … HL12) -L2 -X
109 | @cpcs_cprs_sn @(cprs_step_sn … (+ⓓV1.U0))
110 /2 width=1 by cpm_bind/ /3 width=3 by cpm_cpms, cpm_zeta/
113 elim (cpm_lifts_sn … HU1X (Ⓣ) … (L1.ⓓV1) … HUT1) -U1
114 [| /3 width=1 by drops_refl, drops_drop/ ] #T2 #HXT2 #HT12