/3 width=5 by cpg_lref, ex2_intro/
qed.
+(* Basic_2A1: includes: cpr_bind *)
lemma cpm_bind: ∀n,h,p,I,G,L,V1,V2,T1,T2.
⦃G, L⦄ ⊢ V1 ➡[h] V2 → ⦃G, L.ⓑ{I}V1⦄ ⊢ T1 ➡[n, h] T2 →
⦃G, L⦄ ⊢ ⓑ{p,I}V1.T1 ➡[n, h] ⓑ{p,I}V2.T2.
/5 width=5 by cpg_bind, isrt_plus_O1, isr_shift, ex2_intro/
qed.
+(* Note: cpr_flat: does not hold in basic_1 *)
+(* Basic_1: includes: pr2_thin_dx *)
+(* Basic_2A1: includes: cpr_flat *)
lemma cpm_flat: ∀n,h,I,G,L,V1,V2,T1,T2.
⦃G, L⦄ ⊢ V1 ➡[h] V2 → ⦃G, L⦄ ⊢ T1 ➡[n, h] T2 →
⦃G, L⦄ ⊢ ⓕ{I}V1.T1 ➡[n, h] ⓕ{I}V2.T2.
/5 width=5 by isrt_plus_O1, isr_shift, cpg_flat, ex2_intro/
qed.
+(* Basic_2A1: includes: cpr_zeta *)
lemma cpm_zeta: ∀n,h,G,L,V,T1,T,T2. ⦃G, L.ⓓV⦄ ⊢ T1 ➡[n, h] T →
⬆*[1] T2 ≡ T → ⦃G, L⦄ ⊢ +ⓓV.T1 ➡[n, h] T2.
#n #h #G #L #V #T1 #T #T2 *
/3 width=5 by cpg_zeta, isrt_plus_O2, ex2_intro/
qed.
+(* Basic_2A1: includes: cpr_eps *)
lemma cpm_eps: ∀n,h,G,L,V,T1,T2. ⦃G, L⦄ ⊢ T1 ➡[n, h] T2 → ⦃G, L⦄ ⊢ ⓝV.T1 ➡[n, h] T2.
#n #h #G #L #V #T1 #T2 *
/3 width=3 by cpg_eps, isrt_plus_O2, ex2_intro/
/3 width=3 by cpg_ee, isrt_succ, ex2_intro/
qed.
+(* Basic_2A1: includes: cpr_beta *)
lemma cpm_beta: ∀n,h,p,G,L,V1,V2,W1,W2,T1,T2.
⦃G, L⦄ ⊢ V1 ➡[h] V2 → ⦃G, L⦄ ⊢ W1 ➡[h] W2 → ⦃G, L.ⓛW1⦄ ⊢ T1 ➡[n, h] T2 →
⦃G, L⦄ ⊢ ⓐV1.ⓛ{p}W1.T1 ➡[n, h] ⓓ{p}ⓝW2.V2.T2.
/6 width=7 by cpg_beta, isrt_plus_O2, isrt_plus, isr_shift, ex2_intro/
qed.
+(* Basic_2A1: includes: cpr_theta *)
lemma cpm_theta: ∀n,h,p,G,L,V1,V,V2,W1,W2,T1,T2.
⦃G, L⦄ ⊢ V1 ➡[h] V → ⬆*[1] V ≡ V2 → ⦃G, L⦄ ⊢ W1 ➡[h] W2 →
⦃G, L.ⓓW1⦄ ⊢ T1 ➡[n, h] T2 →
(* Basic properties on r-transition *****************************************)
+(* Basic_1: includes by definition: pr0_refl *)
(* Basic_2A1: includes: cpr_atom *)
lemma cpr_refl: ∀h,G,L. reflexive … (cpm 0 h G L).
/2 width=3 by ex2_intro/ qed.
+(* Basic_1: was: pr2_head_1 *)
lemma cpr_pair_sn: ∀h,I,G,L,V1,V2. ⦃G, L⦄ ⊢ V1 ➡[h] V2 →
∀T. ⦃G, L⦄ ⊢ ②{I}V1.T ➡[h] ②{I}V2.T.
#h #I #G #L #V1 #V2 *
#H1 #H2 destruct /3 width=1 by isrt_inv_00, conj/
qed-.
+(* Basic_2A1: includes: cpr_inv_bind1 *)
lemma cpm_inv_bind1: ∀n,h,p,I,G,L,V1,T1,U2. ⦃G, L⦄ ⊢ ⓑ{p,I}V1.T1 ➡[n, h] U2 → (
∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ➡[h] V2 & ⦃G, L.ⓑ{I}V1⦄ ⊢ T1 ➡[n, h] T2 &
U2 = ⓑ{p,I}V2.T2
]
qed-.
+(* Basic_1: includes: pr0_gen_abbr pr2_gen_abbr *)
+(* Basic_2A1: includes: cpr_inv_abbr1 *)
lemma cpm_inv_abbr1: ∀n,h,p,G,L,V1,T1,U2. ⦃G, L⦄ ⊢ ⓓ{p}V1.T1 ➡[n, h] U2 → (
∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ➡[h] V2 & ⦃G, L.ⓓV1⦄ ⊢ T1 ➡[n, h] T2 &
U2 = ⓓ{p}V2.T2
]
qed-.
+(* Basic_1: includes: pr0_gen_abst pr2_gen_abst *)
+(* Basic_2A1: includes: cpr_inv_abst1 *)
lemma cpm_inv_abst1: ∀n,h,p,G,L,V1,T1,U2. ⦃G, L⦄ ⊢ ⓛ{p}V1.T1 ➡[n, h] U2 →
∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ➡[h] V2 & ⦃G, L.ⓛV1⦄ ⊢ T1 ➡[n, h] T2 &
U2 = ⓛ{p}V2.T2.
]
qed-.
+(* Basic_1: includes: pr0_gen_appl pr2_gen_appl *)
+(* Basic_2A1: includes: cpr_inv_appl1 *)
lemma cpm_inv_appl1: ∀n,h,G,L,V1,U1,U2. ⦃G, L⦄ ⊢ ⓐ V1.U1 ➡[n, h] U2 →
∨∨ ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ➡[h] V2 & ⦃G, L⦄ ⊢ U1 ➡[n, h] T2 &
U2 = ⓐV2.T2
(* Basic forward lemmas *****************************************************)
+(* Basic_2A1: includes: cpr_fwd_bind1_minus *)
lemma cpm_fwd_bind1_minus: ∀n,h,I,G,L,V1,T1,T. ⦃G, L⦄ ⊢ -ⓑ{I}V1.T1 ➡[n, h] T → ∀p.
∃∃V2,T2. ⦃G, L⦄ ⊢ ⓑ{p,I}V1.T1 ➡[n, h] ⓑ{p,I}V2.T2 &
T = -ⓑ{I}V2.T2.
--- /dev/null
+(* Basic_1: includes: pr2_delta1 *)
+| cpr_delta: ∀G,L,K,V,V2,W2,i.
+ ⬇[i] L ≡ K. ⓓV → cpr G K V V2 →
+ ⬆[0, i + 1] V2 ≡ W2 → cpr G L (#i) W2
+
+lemma cpr_cpx: ∀h,G,L,T1,T2. ⦃G, L⦄ ⊢ T1 ➡ T2 → ⦃G, L⦄ ⊢ T1 ➡[h] T2.
+#h #o #G #L #T1 #T2 #H elim H -L -T1 -T2
+/2 width=7 by cpx_delta, cpx_bind, cpx_flat, cpx_zeta, cpx_eps, cpx_beta, cpx_theta/
+qed.
+
+lemma lsubr_cpr_trans: ∀G. lsub_trans … (cpr G) lsubr.
+#G #L1 #T1 #T2 #H elim H -G -L1 -T1 -T2
+[ //
+| #G #L1 #K1 #V1 #V2 #W2 #i #HLK1 #_ #HVW2 #IHV12 #L2 #HL12
+ elim (lsubr_fwd_drop2_abbr … HL12 … HLK1) -L1 *
+ /3 width=6 by cpr_delta/
+|3,7: /4 width=1 by lsubr_pair, cpr_bind, cpr_beta/
+|4,6: /3 width=1 by cpr_flat, cpr_eps/
+|5,8: /4 width=3 by lsubr_pair, cpr_zeta, cpr_theta/
+]
+qed-.
+
+(* Basic_1: was by definition: pr2_free *)
+lemma tpr_cpr: ∀G,T1,T2. ⦃G, ⋆⦄ ⊢ T1 ➡ T2 → ∀L. ⦃G, L⦄ ⊢ T1 ➡ T2.
+#G #T1 #T2 #HT12 #L
+lapply (lsubr_cpr_trans … HT12 L ?) //
+qed.
+
+lemma cpr_delift: ∀G,K,V,T1,L,l. ⬇[l] L ≡ (K.ⓓV) →
+ ∃∃T2,T. ⦃G, L⦄ ⊢ T1 ➡ T2 & ⬆[l, 1] T ≡ T2.
+#G #K #V #T1 elim T1 -T1
+[ * /2 width=4 by cpr_atom, lift_sort, lift_gref, ex2_2_intro/
+ #i #L #l #HLK elim (lt_or_eq_or_gt i l)
+ #Hil [1,3: /4 width=4 by lift_lref_ge_minus, lift_lref_lt, ylt_inj, yle_inj, ex2_2_intro/ ]
+ destruct
+ elim (lift_total V 0 (i+1)) #W #HVW
+ elim (lift_split … HVW i i) /3 width=6 by cpr_delta, ex2_2_intro/
+| * [ #a ] #I #W1 #U1 #IHW1 #IHU1 #L #l #HLK
+ elim (IHW1 … HLK) -IHW1 #W2 #W #HW12 #HW2
+ [ elim (IHU1 (L. ⓑ{I}W1) (l+1)) -IHU1 /3 width=9 by drop_drop, cpr_bind, lift_bind, ex2_2_intro/
+ | elim (IHU1 … HLK) -IHU1 -HLK /3 width=8 by cpr_flat, lift_flat, ex2_2_intro/
+ ]
+]
+qed-.
+
+fact lstas_cpr_aux: ∀h,G,L,T1,T2,d. ⦃G, L⦄ ⊢ T1 •*[h, d] T2 →
+ d = 0 → ⦃G, L⦄ ⊢ T1 ➡ T2.
+#h #G #L #T1 #T2 #d #H elim H -G -L -T1 -T2 -d
+/3 width=1 by cpr_eps, cpr_flat, cpr_bind/
+[ #G #L #K #V1 #V2 #W2 #i #d #HLK #_ #HVW2 #IHV12 #H destruct
+ /3 width=6 by cpr_delta/
+| #G #L #K #V1 #V2 #W2 #i #d #_ #_ #_ #_ <plus_n_Sm #H destruct
+]
+qed-.
+
+lemma lstas_cpr: ∀h,G,L,T1,T2. ⦃G, L⦄ ⊢ T1 •*[h, 0] T2 → ⦃G, L⦄ ⊢ T1 ➡ T2.
+/2 width=4 by lstas_cpr_aux/ qed.
+
+lemma cpr_inv_atom1: ∀I,G,L,T2. ⦃G, L⦄ ⊢ ⓪{I} ➡ T2 →
+ T2 = ⓪{I} ∨
+ ∃∃K,V,V2,i. ⬇[i] L ≡ K. ⓓV & ⦃G, K⦄ ⊢ V ➡ V2 &
+ ⬆[O, i + 1] V2 ≡ T2 & I = LRef i.
+/2 width=3 by cpr_inv_atom1_aux/ qed-.
+
+(* Basic_1: includes: pr0_gen_lref pr2_gen_lref *)
+lemma cpr_inv_lref1: ∀G,L,T2,i. ⦃G, L⦄ ⊢ #i ➡ T2 →
+ T2 = #i ∨
+ ∃∃K,V,V2. ⬇[i] L ≡ K. ⓓV & ⦃G, K⦄ ⊢ V ➡ V2 &
+ ⬆[O, i + 1] V2 ≡ T2.
+#G #L #T2 #i #H
+elim (cpr_inv_atom1 … H) -H /2 width=1 by or_introl/
+* #K #V #V2 #j #HLK #HV2 #HVT2 #H destruct /3 width=6 by ex3_3_intro, or_intror/
+qed-.
+
+(* Note: the main property of simple terms *)
+lemma cpr_inv_appl1_simple: ∀G,L,V1,T1,U. ⦃G, L⦄ ⊢ ⓐV1. T1 ➡ U → 𝐒⦃T1⦄ →
+ ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ➡ V2 & ⦃G, L⦄ ⊢ T1 ➡ T2 &
+ U = ⓐV2. T2.
+#G #L #V1 #T1 #U #H #HT1
+elim (cpr_inv_appl1 … H) -H *
+[ /2 width=5 by ex3_2_intro/
+| #a #V2 #W1 #W2 #U1 #U2 #_ #_ #_ #H #_ destruct
+ elim (simple_inv_bind … HT1)
+| #a #V #V2 #W1 #W2 #U1 #U2 #_ #_ #_ #_ #H #_ destruct
+ elim (simple_inv_bind … HT1)
+]
+qed-.
(* *)
(**************************************************************************)
-include "basic_2/notation/relations/pred_4.ma".
-include "basic_2/static/lsubr.ma".
-include "basic_2/unfold/lstas.ma".
-
-(* CONTEXT-SENSITIVE PARALLEL REDUCTION FOR TERMS ***************************)
-
-(* activate genv *)
-(* Basic_1: includes: pr0_delta1 pr2_delta1 pr2_thin_dx *)
-(* Note: cpr_flat: does not hold in basic_1 *)
-inductive cpr: relation4 genv lenv term term ≝
-| cpr_atom : ∀I,G,L. cpr G L (⓪{I}) (⓪{I})
-| cpr_delta: ∀G,L,K,V,V2,W2,i.
- ⬇[i] L ≡ K. ⓓV → cpr G K V V2 →
- ⬆[0, i + 1] V2 ≡ W2 → cpr G L (#i) W2
-| cpr_bind : ∀a,I,G,L,V1,V2,T1,T2.
- cpr G L V1 V2 → cpr G (L.ⓑ{I}V1) T1 T2 →
- cpr G L (ⓑ{a,I}V1.T1) (ⓑ{a,I}V2.T2)
-| cpr_flat : ∀I,G,L,V1,V2,T1,T2.
- cpr G L V1 V2 → cpr G L T1 T2 →
- cpr G L (ⓕ{I}V1.T1) (ⓕ{I}V2.T2)
-| cpr_zeta : ∀G,L,V,T1,T,T2. cpr G (L.ⓓV) T1 T →
- ⬆[0, 1] T2 ≡ T → cpr G L (+ⓓV.T1) T2
-| cpr_eps : ∀G,L,V,T1,T2. cpr G L T1 T2 → cpr G L (ⓝV.T1) T2
-| cpr_beta : ∀a,G,L,V1,V2,W1,W2,T1,T2.
- cpr G L V1 V2 → cpr G L W1 W2 → cpr G (L.ⓛW1) T1 T2 →
- cpr G L (ⓐV1.ⓛ{a}W1.T1) (ⓓ{a}ⓝW2.V2.T2)
-| cpr_theta: ∀a,G,L,V1,V,V2,W1,W2,T1,T2.
- cpr G L V1 V → ⬆[0, 1] V ≡ V2 → cpr G L W1 W2 → cpr G (L.ⓓW1) T1 T2 →
- cpr G L (ⓐV1.ⓓ{a}W1.T1) (ⓓ{a}W2.ⓐV2.T2)
-.
-
-interpretation "context-sensitive parallel reduction (term)"
- 'PRed G L T1 T2 = (cpr G L T1 T2).
-
-(* Basic properties *********************************************************)
-
-lemma cpr_cpx: ∀h,G,L,T1,T2. ⦃G, L⦄ ⊢ T1 ➡ T2 → ⦃G, L⦄ ⊢ T1 ➡[h] T2.
-#h #o #G #L #T1 #T2 #H elim H -L -T1 -T2
-/2 width=7 by cpx_delta, cpx_bind, cpx_flat, cpx_zeta, cpx_eps, cpx_beta, cpx_theta/
-qed.
-
-lemma lsubr_cpr_trans: ∀G. lsub_trans … (cpr G) lsubr.
-#G #L1 #T1 #T2 #H elim H -G -L1 -T1 -T2
-[ //
-| #G #L1 #K1 #V1 #V2 #W2 #i #HLK1 #_ #HVW2 #IHV12 #L2 #HL12
- elim (lsubr_fwd_drop2_abbr … HL12 … HLK1) -L1 *
- /3 width=6 by cpr_delta/
-|3,7: /4 width=1 by lsubr_pair, cpr_bind, cpr_beta/
-|4,6: /3 width=1 by cpr_flat, cpr_eps/
-|5,8: /4 width=3 by lsubr_pair, cpr_zeta, cpr_theta/
+include "basic_2/rt_transition/cpm.ma".
+
+(* CONTEXT-SENSITIVE PARALLEL R-TRANSITION FOR TERMS ************************)
+
+(* Basic inversion properties ***********************************************)
+
+lemma cpr_inv_atom1: ∀h,J,G,L,T2. ⦃G, L⦄ ⊢ ⓪{J} ➡[h] T2 →
+ ∨∨ T2 = ⓪{J}
+ | ∃∃K,V1,V2. ⦃G, K⦄ ⊢ V1 ➡[h] V2 & ⬆*[1] V2 ≡ T2 &
+ L = K.ⓓV1 & J = LRef 0
+ | ∃∃I,K,V,T,i. ⦃G, K⦄ ⊢ #i ➡[h] T & ⬆*[1] T ≡ T2 &
+ L = K.ⓑ{I}V & J = LRef (⫯i).
+#h #J #G #L #T2 #H elim (cpm_inv_atom1 … H) -H *
+/3 width=9 by or3_intro0, or3_intro1, or3_intro2, ex4_5_intro, ex4_3_intro/
+[ #n #_ #_ #H destruct
+| #n #K #V1 #V2 #_ #_ #_ #_ #H destruct
]
qed-.
-(* Basic_1: was by definition: pr2_free *)
-lemma tpr_cpr: ∀G,T1,T2. ⦃G, ⋆⦄ ⊢ T1 ➡ T2 → ∀L. ⦃G, L⦄ ⊢ T1 ➡ T2.
-#G #T1 #T2 #HT12 #L
-lapply (lsubr_cpr_trans … HT12 L ?) //
-qed.
-
-(* Basic_1: includes by definition: pr0_refl *)
-lemma cpr_refl: ∀G,T,L. ⦃G, L⦄ ⊢ T ➡ T.
-#G #T elim T -T // * /2 width=1 by cpr_bind, cpr_flat/
-qed.
-
-(* Basic_1: was: pr2_head_1 *)
-lemma cpr_pair_sn: ∀I,G,L,V1,V2. ⦃G, L⦄ ⊢ V1 ➡ V2 →
- ∀T. ⦃G, L⦄ ⊢ ②{I}V1.T ➡ ②{I}V2.T.
-* /2 width=1 by cpr_bind, cpr_flat/ qed.
-
-lemma cpr_delift: ∀G,K,V,T1,L,l. ⬇[l] L ≡ (K.ⓓV) →
- ∃∃T2,T. ⦃G, L⦄ ⊢ T1 ➡ T2 & ⬆[l, 1] T ≡ T2.
-#G #K #V #T1 elim T1 -T1
-[ * /2 width=4 by cpr_atom, lift_sort, lift_gref, ex2_2_intro/
- #i #L #l #HLK elim (lt_or_eq_or_gt i l)
- #Hil [1,3: /4 width=4 by lift_lref_ge_minus, lift_lref_lt, ylt_inj, yle_inj, ex2_2_intro/ ]
- destruct
- elim (lift_total V 0 (i+1)) #W #HVW
- elim (lift_split … HVW i i) /3 width=6 by cpr_delta, ex2_2_intro/
-| * [ #a ] #I #W1 #U1 #IHW1 #IHU1 #L #l #HLK
- elim (IHW1 … HLK) -IHW1 #W2 #W #HW12 #HW2
- [ elim (IHU1 (L. ⓑ{I}W1) (l+1)) -IHU1 /3 width=9 by drop_drop, cpr_bind, lift_bind, ex2_2_intro/
- | elim (IHU1 … HLK) -IHU1 -HLK /3 width=8 by cpr_flat, lift_flat, ex2_2_intro/
- ]
-]
-qed-.
-
-fact lstas_cpr_aux: ∀h,G,L,T1,T2,d. ⦃G, L⦄ ⊢ T1 •*[h, d] T2 →
- d = 0 → ⦃G, L⦄ ⊢ T1 ➡ T2.
-#h #G #L #T1 #T2 #d #H elim H -G -L -T1 -T2 -d
-/3 width=1 by cpr_eps, cpr_flat, cpr_bind/
-[ #G #L #K #V1 #V2 #W2 #i #d #HLK #_ #HVW2 #IHV12 #H destruct
- /3 width=6 by cpr_delta/
-| #G #L #K #V1 #V2 #W2 #i #d #_ #_ #_ #_ <plus_n_Sm #H destruct
-]
-qed-.
-
-lemma lstas_cpr: ∀h,G,L,T1,T2. ⦃G, L⦄ ⊢ T1 •*[h, 0] T2 → ⦃G, L⦄ ⊢ T1 ➡ T2.
-/2 width=4 by lstas_cpr_aux/ qed.
-
-(* Basic inversion lemmas ***************************************************)
-
-fact cpr_inv_atom1_aux: ∀G,L,T1,T2. ⦃G, L⦄ ⊢ T1 ➡ T2 → ∀I. T1 = ⓪{I} →
- T2 = ⓪{I} ∨
- ∃∃K,V,V2,i. ⬇[i] L ≡ K. ⓓV & ⦃G, K⦄ ⊢ V ➡ V2 &
- ⬆[O, i + 1] V2 ≡ T2 & I = LRef i.
-#G #L #T1 #T2 * -G -L -T1 -T2
-[ #I #G #L #J #H destruct /2 width=1 by or_introl/
-| #L #G #K #V #V2 #T2 #i #HLK #HV2 #HVT2 #J #H destruct /3 width=8 by ex4_4_intro, or_intror/
-| #a #I #G #L #V1 #V2 #T1 #T2 #_ #_ #J #H destruct
-| #I #G #L #V1 #V2 #T1 #T2 #_ #_ #J #H destruct
-| #G #L #V #T1 #T #T2 #_ #_ #J #H destruct
-| #G #L #V #T1 #T2 #_ #J #H destruct
-| #a #G #L #V1 #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #J #H destruct
-| #a #G #L #V1 #V #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #_ #J #H destruct
-]
-qed-.
-
-lemma cpr_inv_atom1: ∀I,G,L,T2. ⦃G, L⦄ ⊢ ⓪{I} ➡ T2 →
- T2 = ⓪{I} ∨
- ∃∃K,V,V2,i. ⬇[i] L ≡ K. ⓓV & ⦃G, K⦄ ⊢ V ➡ V2 &
- ⬆[O, i + 1] V2 ≡ T2 & I = LRef i.
-/2 width=3 by cpr_inv_atom1_aux/ qed-.
-
(* Basic_1: includes: pr0_gen_sort pr2_gen_sort *)
-lemma cpr_inv_sort1: ∀G,L,T2,s. ⦃G, L⦄ ⊢ ⋆s ➡ T2 → T2 = ⋆s.
-#G #L #T2 #s #H
-elim (cpr_inv_atom1 … H) -H //
-* #K #V #V2 #i #_ #_ #_ #H destruct
+lemma cpr_inv_sort1: ∀h,G,L,T2,s. ⦃G, L⦄ ⊢ ⋆s ➡[h] T2 → T2 = ⋆s.
+#h #G #L #T2 #s #H elim (cpm_inv_sort1 … H) -H * // #_ #H destruct
qed-.
-(* Basic_1: includes: pr0_gen_lref pr2_gen_lref *)
-lemma cpr_inv_lref1: ∀G,L,T2,i. ⦃G, L⦄ ⊢ #i ➡ T2 →
- T2 = #i ∨
- ∃∃K,V,V2. ⬇[i] L ≡ K. ⓓV & ⦃G, K⦄ ⊢ V ➡ V2 &
- ⬆[O, i + 1] V2 ≡ T2.
-#G #L #T2 #i #H
-elim (cpr_inv_atom1 … H) -H /2 width=1 by or_introl/
-* #K #V #V2 #j #HLK #HV2 #HVT2 #H destruct /3 width=6 by ex3_3_intro, or_intror/
+lemma cpr_inv_zero1: ∀h,G,L,T2. ⦃G, L⦄ ⊢ #0 ➡[h] T2 →
+ T2 = #0 ∨
+ ∃∃K,V1,V2. ⦃G, K⦄ ⊢ V1 ➡[h] V2 & ⬆*[1] V2 ≡ T2 &
+ L = K.ⓓV1.
+#h #G #L #T2 #H elim (cpm_inv_zero1 … H) -H *
+/3 width=6 by ex3_3_intro, or_introl, or_intror/
+#n #K #V1 #V2 #_ #_ #_ #H destruct
qed-.
-lemma cpr_inv_gref1: ∀G,L,T2,p. ⦃G, L⦄ ⊢ §p ➡ T2 → T2 = §p.
-#G #L #T2 #p #H
-elim (cpr_inv_atom1 … H) -H //
-* #K #V #V2 #i #_ #_ #_ #H destruct
+lemma cpr_inv_lref1: ∀h,G,L,T2,i. ⦃G, L⦄ ⊢ #⫯i ➡[h] T2 →
+ T2 = #(⫯i) ∨
+ ∃∃I,K,V,T. ⦃G, K⦄ ⊢ #i ➡[h] T & ⬆*[1] T ≡ T2 & L = K.ⓑ{I}V.
+#h #G #L #T2 #i #H elim (cpm_inv_lref1 … H) -H *
+/3 width=7 by ex3_4_intro, or_introl, or_intror/
qed-.
-fact cpr_inv_bind1_aux: ∀G,L,U1,U2. ⦃G, L⦄ ⊢ U1 ➡ U2 →
- ∀a,I,V1,T1. U1 = ⓑ{a,I}V1. T1 → (
- ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ➡ V2 & ⦃G, L.ⓑ{I}V1⦄ ⊢ T1 ➡ T2 &
- U2 = ⓑ{a,I}V2.T2
- ) ∨
- ∃∃T. ⦃G, L.ⓓV1⦄ ⊢ T1 ➡ T & ⬆[0, 1] U2 ≡ T &
- a = true & I = Abbr.
-#G #L #U1 #U2 * -L -U1 -U2
-[ #I #G #L #b #J #W1 #U1 #H destruct
-| #L #G #K #V #V2 #W2 #i #_ #_ #_ #b #J #W #U1 #H destruct
-| #a #I #G #L #V1 #V2 #T1 #T2 #HV12 #HT12 #b #J #W #U1 #H destruct /3 width=5 by ex3_2_intro, or_introl/
-| #I #G #L #V1 #V2 #T1 #T2 #_ #_ #b #J #W #U1 #H destruct
-| #G #L #V #T1 #T #T2 #HT1 #HT2 #b #J #W #U1 #H destruct /3 width=3 by ex4_intro, or_intror/
-| #G #L #V #T1 #T2 #_ #b #J #W #U1 #H destruct
-| #a #G #L #V1 #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #b #J #W #U1 #H destruct
-| #a #G #L #V1 #V #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #_ #b #J #W #U1 #H destruct
-]
-qed-.
-
-lemma cpr_inv_bind1: ∀a,I,G,L,V1,T1,U2. ⦃G, L⦄ ⊢ ⓑ{a,I}V1.T1 ➡ U2 → (
- ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ➡ V2 & ⦃G, L.ⓑ{I}V1⦄ ⊢ T1 ➡ T2 &
- U2 = ⓑ{a,I}V2.T2
- ) ∨
- ∃∃T. ⦃G, L.ⓓV1⦄ ⊢ T1 ➡ T & ⬆[0, 1] U2 ≡ T &
- a = true & I = Abbr.
-/2 width=3 by cpr_inv_bind1_aux/ qed-.
-
-(* Basic_1: includes: pr0_gen_abbr pr2_gen_abbr *)
-lemma cpr_inv_abbr1: ∀a,G,L,V1,T1,U2. ⦃G, L⦄ ⊢ ⓓ{a}V1.T1 ➡ U2 → (
- ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ➡ V2 & ⦃G, L. ⓓV1⦄ ⊢ T1 ➡ T2 &
- U2 = ⓓ{a}V2.T2
- ) ∨
- ∃∃T. ⦃G, L.ⓓV1⦄ ⊢ T1 ➡ T & ⬆[0, 1] U2 ≡ T & a = true.
-#a #G #L #V1 #T1 #U2 #H
-elim (cpr_inv_bind1 … H) -H *
-/3 width=5 by ex3_2_intro, ex3_intro, or_introl, or_intror/
-qed-.
-
-(* Basic_1: includes: pr0_gen_abst pr2_gen_abst *)
-lemma cpr_inv_abst1: ∀a,G,L,V1,T1,U2. ⦃G, L⦄ ⊢ ⓛ{a}V1.T1 ➡ U2 →
- ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ➡ V2 & ⦃G, L.ⓛV1⦄ ⊢ T1 ➡ T2 &
- U2 = ⓛ{a}V2.T2.
-#a #G #L #V1 #T1 #U2 #H
-elim (cpr_inv_bind1 … H) -H *
-[ /3 width=5 by ex3_2_intro/
-| #T #_ #_ #_ #H destruct
-]
-qed-.
-
-fact cpr_inv_flat1_aux: ∀G,L,U,U2. ⦃G, L⦄ ⊢ U ➡ U2 →
- ∀I,V1,U1. U = ⓕ{I}V1.U1 →
- ∨∨ ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ➡ V2 & ⦃G, L⦄ ⊢ U1 ➡ T2 &
- U2 = ⓕ{I} V2. T2
- | (⦃G, L⦄ ⊢ U1 ➡ U2 ∧ I = Cast)
- | ∃∃a,V2,W1,W2,T1,T2. ⦃G, L⦄ ⊢ V1 ➡ V2 & ⦃G, L⦄ ⊢ W1 ➡ W2 &
- ⦃G, L.ⓛW1⦄ ⊢ T1 ➡ T2 & U1 = ⓛ{a}W1.T1 &
- U2 = ⓓ{a}ⓝW2.V2.T2 & I = Appl
- | ∃∃a,V,V2,W1,W2,T1,T2. ⦃G, L⦄ ⊢ V1 ➡ V & ⬆[0,1] V ≡ V2 &
- ⦃G, L⦄ ⊢ W1 ➡ W2 & ⦃G, L.ⓓW1⦄ ⊢ T1 ➡ T2 &
- U1 = ⓓ{a}W1.T1 &
- U2 = ⓓ{a}W2.ⓐV2.T2 & I = Appl.
-#G #L #U #U2 * -L -U -U2
-[ #I #G #L #J #W1 #U1 #H destruct
-| #G #L #K #V #V2 #W2 #i #_ #_ #_ #J #W #U1 #H destruct
-| #a #I #G #L #V1 #V2 #T1 #T2 #_ #_ #J #W #U1 #H destruct
-| #I #G #L #V1 #V2 #T1 #T2 #HV12 #HT12 #J #W #U1 #H destruct /3 width=5 by or4_intro0, ex3_2_intro/
-| #G #L #V #T1 #T #T2 #_ #_ #J #W #U1 #H destruct
-| #G #L #V #T1 #T2 #HT12 #J #W #U1 #H destruct /3 width=1 by or4_intro1, conj/
-| #a #G #L #V1 #V2 #W1 #W2 #T1 #T2 #HV12 #HW12 #HT12 #J #W #U1 #H destruct /3 width=11 by or4_intro2, ex6_6_intro/
-| #a #G #L #V1 #V #V2 #W1 #W2 #T1 #T2 #HV1 #HV2 #HW12 #HT12 #J #W #U1 #H destruct /3 width=13 by or4_intro3, ex7_7_intro/
-]
+lemma cpr_inv_gref1: ∀h,G,L,T2,l. ⦃G, L⦄ ⊢ §l ➡[h] T2 → T2 = §l.
+#h #G #L #T2 #l #H elim (cpm_inv_gref1 … H) -H //
qed-.
-lemma cpr_inv_flat1: ∀I,G,L,V1,U1,U2. ⦃G, L⦄ ⊢ ⓕ{I}V1.U1 ➡ U2 →
- ∨∨ ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ➡ V2 & ⦃G, L⦄ ⊢ U1 ➡ T2 &
+lemma cpr_inv_flat1: ∀h,I,G,L,V1,U1,U2. ⦃G, L⦄ ⊢ ⓕ{I}V1.U1 ➡[h] U2 →
+ ∨∨ ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ➡[h] V2 & ⦃G, L⦄ ⊢ U1 ➡[h] T2 &
U2 = ⓕ{I}V2.T2
- | (⦃G, L⦄ ⊢ U1 ➡ U2 ∧ I = Cast)
- | ∃∃a,V2,W1,W2,T1,T2. ⦃G, L⦄ ⊢ V1 ➡ V2 & ⦃G, L⦄ ⊢ W1 ➡ W2 &
- ⦃G, L.ⓛW1⦄ ⊢ T1 ➡ T2 & U1 = ⓛ{a}W1.T1 &
- U2 = ⓓ{a}ⓝW2.V2.T2 & I = Appl
- | ∃∃a,V,V2,W1,W2,T1,T2. ⦃G, L⦄ ⊢ V1 ➡ V & ⬆[0,1] V ≡ V2 &
- ⦃G, L⦄ ⊢ W1 ➡ W2 & ⦃G, L.ⓓW1⦄ ⊢ T1 ➡ T2 &
- U1 = ⓓ{a}W1.T1 &
- U2 = ⓓ{a}W2.ⓐV2.T2 & I = Appl.
-/2 width=3 by cpr_inv_flat1_aux/ qed-.
-
-(* Basic_1: includes: pr0_gen_appl pr2_gen_appl *)
-lemma cpr_inv_appl1: ∀G,L,V1,U1,U2. ⦃G, L⦄ ⊢ ⓐV1.U1 ➡ U2 →
- ∨∨ ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ➡ V2 & ⦃G, L⦄ ⊢ U1 ➡ T2 &
- U2 = ⓐV2.T2
- | ∃∃a,V2,W1,W2,T1,T2. ⦃G, L⦄ ⊢ V1 ➡ V2 & ⦃G, L⦄ ⊢ W1 ➡ W2 &
- ⦃G, L.ⓛW1⦄ ⊢ T1 ➡ T2 &
- U1 = ⓛ{a}W1.T1 & U2 = ⓓ{a}ⓝW2.V2.T2
- | ∃∃a,V,V2,W1,W2,T1,T2. ⦃G, L⦄ ⊢ V1 ➡ V & ⬆[0,1] V ≡ V2 &
- ⦃G, L⦄ ⊢ W1 ➡ W2 & ⦃G, L.ⓓW1⦄ ⊢ T1 ➡ T2 &
- U1 = ⓓ{a}W1.T1 & U2 = ⓓ{a}W2.ⓐV2.T2.
-#G #L #V1 #U1 #U2 #H elim (cpr_inv_flat1 … H) -H *
-[ /3 width=5 by or3_intro0, ex3_2_intro/
-| #_ #H destruct
-| /3 width=11 by or3_intro1, ex5_6_intro/
-| /3 width=13 by or3_intro2, ex6_7_intro/
-]
-qed-.
-
-(* Note: the main property of simple terms *)
-lemma cpr_inv_appl1_simple: ∀G,L,V1,T1,U. ⦃G, L⦄ ⊢ ⓐV1. T1 ➡ U → 𝐒⦃T1⦄ →
- ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ➡ V2 & ⦃G, L⦄ ⊢ T1 ➡ T2 &
- U = ⓐV2. T2.
-#G #L #V1 #T1 #U #H #HT1
-elim (cpr_inv_appl1 … H) -H *
-[ /2 width=5 by ex3_2_intro/
-| #a #V2 #W1 #W2 #U1 #U2 #_ #_ #_ #H #_ destruct
- elim (simple_inv_bind … HT1)
-| #a #V #V2 #W1 #W2 #U1 #U2 #_ #_ #_ #_ #H #_ destruct
- elim (simple_inv_bind … HT1)
-]
+ | (⦃G, L⦄ ⊢ U1 ➡[h] U2 ∧ I = Cast)
+ | ∃∃p,V2,W1,W2,T1,T2. ⦃G, L⦄ ⊢ V1 ➡[h] V2 & ⦃G, L⦄ ⊢ W1 ➡[h] W2 &
+ ⦃G, L.ⓛW1⦄ ⊢ T1 ➡[h] T2 & U1 = ⓛ{p}W1.T1 &
+ U2 = ⓓ{p}ⓝW2.V2.T2 & I = Appl
+ | ∃∃p,V,V2,W1,W2,T1,T2. ⦃G, L⦄ ⊢ V1 ➡[h] V & ⬆*[1] V ≡ V2 &
+ ⦃G, L⦄ ⊢ W1 ➡[h] W2 & ⦃G, L.ⓓW1⦄ ⊢ T1 ➡[h] T2 &
+ U1 = ⓓ{p}W1.T1 &
+ U2 = ⓓ{p}W2.ⓐV2.T2 & I = Appl.
+#h #I #G #L #V1 #U1 #U2 #H elim (cpm_inv_flat1 … H) -H *
+/3 width=13 by or4_intro0, or4_intro1, or4_intro2, or4_intro3, ex7_7_intro, ex6_6_intro, ex3_2_intro, conj/
+#n #_ #_ #H destruct
qed-.
(* Basic_1: includes: pr0_gen_cast pr2_gen_cast *)
-lemma cpr_inv_cast1: ∀G,L,V1,U1,U2. ⦃G, L⦄ ⊢ ⓝ V1. U1 ➡ U2 → (
- ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ➡ V2 & ⦃G, L⦄ ⊢ U1 ➡ T2 &
- U2 = ⓝ V2. T2
- ) ∨ ⦃G, L⦄ ⊢ U1 ➡ U2.
-#G #L #V1 #U1 #U2 #H elim (cpr_inv_flat1 … H) -H *
-[ /3 width=5 by ex3_2_intro, or_introl/
-| /2 width=1 by or_intror/
-| #a #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #_ #_ #H destruct
-| #a #V #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #_ #_ #_ #H destruct
-]
-qed-.
-
-(* Basic forward lemmas *****************************************************)
-
-lemma cpr_fwd_bind1_minus: ∀I,G,L,V1,T1,T. ⦃G, L⦄ ⊢ -ⓑ{I}V1.T1 ➡ T → ∀b.
- ∃∃V2,T2. ⦃G, L⦄ ⊢ ⓑ{b,I}V1.T1 ➡ ⓑ{b,I}V2.T2 &
- T = -ⓑ{I}V2.T2.
-#I #G #L #V1 #T1 #T #H #b
-elim (cpr_inv_bind1 … H) -H *
-[ #V2 #T2 #HV12 #HT12 #H destruct /3 width=4 by cpr_bind, ex2_2_intro/
-| #T2 #_ #_ #H destruct
-]
+lemma cpr_inv_cast1: ∀h,G,L,V1,U1,U2. ⦃G, L⦄ ⊢ ⓝ V1. U1 ➡[h] U2 → (
+ ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ➡[h] V2 & ⦃G, L⦄ ⊢ U1 ➡[h] T2 &
+ U2 = ⓝV2.T2
+ ) ∨ ⦃G, L⦄ ⊢ U1 ➡[h] U2.
+#h #G #L #V1 #U1 #U2 #H elim (cpm_inv_cast1 … H) -H
+/2 width=1 by or_introl, or_intror/ * #n #_ #H destruct
qed-.
-(* Basic_1: removed theorems 11:
+(* Basic_1: removed theorems 12:
pr0_subst0_back pr0_subst0_fwd pr0_subst0
+ pr0_delta1
pr2_head_2 pr2_cflat clear_pr2_trans
pr2_gen_csort pr2_gen_cflat pr2_gen_cbind
pr2_gen_ctail pr2_ctail