(* *)
(**************************************************************************)
-include "basic_2/substitution/fqup.ma".
-include "basic_2/substitution/frees_lift.ma".
+include "basic_2/multiple/frees_leq.ma".
+include "basic_2/multiple/frees_lift.ma".
include "basic_2/reduction/lpx_ldrop.ma".
(* SN EXTENDED PARALLEL REDUCTION FOR LOCAL ENVIRONMENTS ********************)
-(*
-lemma yle_plus2_to_minus_inj2: ∀x,y:ynat. ∀z:nat. x ≤ y + z → x - z ≤ y.
-/2 width=1 by monotonic_yle_minus_dx/ qed-.
-lemma yle_plus2_to_minus_inj1: ∀x,y:ynat. ∀z:nat. x ≤ z + y → x - z ≤ y.
-/2 width=1 by yle_plus2_to_minus_inj2/ qed-.
+(* Properties on context-sensitive free variables ***************************)
-lemma cofrees_lsuby_conf: ∀L1,U,i. L1 ⊢ i ~ϵ 𝐅*⦃U⦄ →
- ∀L2. lsuby L1 L2 → L2 ⊢ i ~ϵ 𝐅*⦃U⦄.
-/3 width=3 by lsuby_cpys_trans/ qed-.
-
-lemma lpx_cpx_cofrees_conf: ∀h,g,G,L1,U1,U2. ⦃G, L1⦄ ⊢ U1 ➡[h, g] U2 →
- ∀L2. ⦃G, L1⦄ ⊢ ➡[h, g] L2 →
- ∀i. L1 ⊢ i ~ϵ 𝐅*⦃U1⦄ → L2 ⊢ i ~ϵ 𝐅*⦃U2⦄.
+lemma lpx_cpx_frees_trans: ∀h,g,G,L1,U1,U2. ⦃G, L1⦄ ⊢ U1 ➡[h, g] U2 →
+ ∀L2. ⦃G, L1⦄ ⊢ ➡[h, g] L2 →
+ ∀i. L2 ⊢ i ϵ 𝐅*[0]⦃U2⦄ → L1 ⊢ i ϵ 𝐅*[0]⦃U1⦄.
#h #g #G #L1 #U1 @(fqup_wf_ind_eq … G L1 U1) -G -L1 -U1
#G0 #L0 #U0 #IH #G #L1 * *
-[ -IH #k #HG #HL #HU #U2 #H elim (cpx_inv_sort1 … H) -H
- [| * #l #_ ] #H destruct //
-| #j #HG #HL #HU #U2 #H #L2 #HL12 #i #Hi elim (cpx_inv_lref1 … H) -H
- [ #H destruct elim (lt_or_eq_or_gt i j) #Hji
- [ -IH -HL12 /2 width=4 by cofrees_lref_gt/
- | -IH -HL12 destruct elim (cofrees_inv_lref_eq … Hi)
- | elim (lt_or_ge j (|L2|)) /2 width=5 by cofrees_lref_free/ #Hj
- elim (ldrop_O1_lt (Ⓕ) L1 j) [2: >(lpx_fwd_length … HL12) // ] #I #K1 #W1 #HLK1
- elim (lpx_ldrop_conf … HLK1 … HL12) -HL12 #Y #H #HLK2
- elim (lpx_inv_pair1 … H) -H #K2 #W2 #HK12 #HW12 #H destruct
- lapply (cofrees_inv_lref_lt … Hi … HLK1) -Hi // #HW1
- lapply (IH … HW12 … HK12 … HW1) /2 width=2 by fqup_lref/ -L1 -K1 -W1 #HW2
- /2 width=9 by cofrees_lref_lt/ (**) (* full auto too slow *)
- ]
- | * #I #K1 #W1 #W0 #HLK1 #HW10 #HW0U2 elim (lt_or_ge j i) #Hji
- [ lapply (ldrop_fwd_drop2 … HLK1) #H0
- elim (lpx_ldrop_conf … H0 … HL12) #K2 #HK12 #HLK2
- @(cofrees_lift_ge … HLK2 … HW0U2) //
- @(IH … HW10) /2 width=2 by fqup_lref/ -L2 -K2 -W0 -U2 -IH
- <minus_plus /2 width=7 by cofrees_inv_lref_lt/
- | -IH lapply (ldrop_fwd_drop2 … HLK1) -HLK1 #HLK1
- elim (lpx_ldrop_conf … HLK1 … HL12) -I -L1 -W1
- /2 width=12 by cofrees_lift_be/
+[ -IH #k #HG #HL #HU #U2 #H1 #L2 #_ #i #H2 elim (cpx_inv_sort1 … H1) -H1
+ [| * #l #_ ] #H destruct elim (frees_inv_sort … H2)
+| #j #HG #HL #HU #U2 #H1 #L2 #HL12 #i #H2 elim (cpx_inv_lref1 … H1) -H1
+ [ #H destruct elim (frees_inv_lref … H2) -H2 //
+ * #I #K2 #W2 #Hj #Hji #HLK2 #HW2
+ elim (lpx_ldrop_trans_O1 … HL12 … HLK2) -HL12 #Y #HLK1 #H
+ elim (lpx_inv_pair2 … H) -H #K1 #W1 #HK12 #HW12 #H destruct
+ /4 width=11 by frees_lref_be, fqup_lref/
+ | * #I #K1 #W1 #W0 #HLK1 #HW10 #HW0U2
+ lapply (ldrop_fwd_drop2 … HLK1) #H0
+ elim (lpx_ldrop_conf … H0 … HL12) -H0 -HL12 #K2 #HK12 #HLK2
+ elim (lt_or_ge i (j+1)) #Hji
+ [ -IH elim (frees_inv_lift_be … H2 … HLK2 … HW0U2) /2 width=1 by monotonic_pred/
+ | lapply (frees_inv_lift_ge … H2 … HLK2 … HW0U2 ?) -L2 -U2 // <minus_plus destruct
+ /4 width=11 by frees_lref_be, fqup_lref/
]
]
-| -IH #p #HG #HL #HU #U2 #H lapply (cpx_inv_gref1 … H) -H
- #H destruct //
+| -IH #p #HG #HL #HU #U2 #H1 >(cpx_inv_gref1 … H1) -H1 destruct
+ #L2 #_ #i #H2 elim (frees_inv_gref … H2)
| #a #I #W1 #U1 #HG #HL #HU #X #HX #L2 #HL12 #i #Hi destruct
- elim (cofrees_inv_bind … Hi) -Hi #HW1 #HU1
- elim (cpx_inv_bind1 … HX) -HX
- [ * #W2 #U2 #HW12 #HU12 #H destruct /4 width=8 by cofrees_bind, lpx_pair/
- |
+ elim (cpx_inv_bind1 … HX) -HX *
+ [ #W2 #U2 #HW12 #HU12 #H destruct
+ elim (frees_inv_bind_O … Hi) -Hi
+ /4 width=7 by frees_bind_dx_O, frees_bind_sn, lpx_pair/
+ | #U2 #HU12 #HXU2 #H1 #H2 destruct
+ lapply (frees_lift_ge … Hi (L2.ⓓW1) (Ⓕ) … HXU2 ?)
+ /4 width=7 by frees_bind_dx_O, lpx_pair, ldrop_drop/
]
| #I #W1 #X1 #HG #HL #HU #X2 #HX2 #L2 #HL12 #i #Hi destruct
- elim (cofrees_inv_flat … Hi) -Hi #HW1 #HX1
elim (cpx_inv_flat1 … HX2) -HX2 *
- [ #W2 #U2 #HW12 #HU12 #H destruct /3 width=7 by cofrees_flat/
- | #HU12 #H destruct /2 width=7 by/
- | #HW12 #H destruct /2 width=7 by/
+ [ #W2 #U2 #HW12 #HU12 #H destruct
+ elim (frees_inv_flat … Hi) -Hi /3 width=7 by frees_flat_dx, frees_flat_sn/
+ | #HU12 #H destruct /3 width=7 by frees_flat_dx/
+ | #HW12 #H destruct /3 width=7 by frees_flat_sn/
| #b #W2 #V1 #V2 #U1 #U2 #HW12 #HV12 #HU12 #H1 #H2 #H3 destruct
- elim (cofrees_inv_bind … HX1) -HX1 #HV1 #HU1
- @cofrees_bind [ /3 width=7 by cofrees_flat/ ]
- @(cofrees_lsuby_conf (L2.ⓛV2)) /3 width=7 by lpx_pair, lsuby_succ/
- |
-
-
-*)
+ elim (frees_inv_bind … Hi) -Hi #Hi
+ [ elim (frees_inv_flat … Hi) -Hi
+ /4 width=7 by frees_flat_dx, frees_flat_sn, frees_bind_sn/
+ | lapply (leq_frees_trans … Hi (L2.ⓛV2) ?) /2 width=1 by leq_succ/ -Hi #HU2
+ lapply (frees_weak … HU2 0 ?) -HU2
+ /5 width=7 by frees_bind_dx_O, frees_flat_dx, lpx_pair/
+ ]
+ | #b #W2 #W0 #V1 #V2 #U1 #U2 #HW12 #HW20 #HV12 #HU12 #H1 #H2 #H3 destruct
+ elim (frees_inv_bind_O … Hi) -Hi #Hi
+ [ /4 width=7 by frees_flat_dx, frees_bind_sn/
+ | elim (frees_inv_flat … Hi) -Hi
+ [ #HW0 lapply (frees_inv_lift_ge … HW0 L2 (Ⓕ) … HW20 ?) -W0
+ /3 width=7 by frees_flat_sn, ldrop_drop/
+ | /5 width=7 by frees_bind_dx_O, frees_flat_dx, lpx_pair/
+ ]
+ ]
+ ]
+]
+qed-.
+
+lemma cpx_frees_trans: ∀h,g,G. frees_trans (cpx h g G).
+/2 width=8 by lpx_cpx_frees_trans/ qed-.
+
+lemma lpx_frees_trans: ∀h,g,G,L1,L2. ⦃G, L1⦄ ⊢ ➡[h, g] L2 →
+ ∀U,i. L2 ⊢ i ϵ 𝐅*[0]⦃U⦄ → L1 ⊢ i ϵ 𝐅*[0]⦃U⦄.
+/2 width=8 by lpx_cpx_frees_trans/ qed-.