--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/notation/relations/psubststar_6.ma".
+include "basic_2/substitution/cpy.ma".
+
+(* CONTEXT-SENSITIVE EXTENDED MULTIPLE SUBSTITUTION FOR TERMS ***************)
+
+definition cpys: ynat → ynat → relation4 genv lenv term term ≝
+ λl,m,G. LTC … (cpy l m G).
+
+interpretation "context-sensitive extended multiple substritution (term)"
+ 'PSubstStar G L T1 l m T2 = (cpys l m G L T1 T2).
+
+(* Basic eliminators ********************************************************)
+
+lemma cpys_ind: ∀G,L,T1,l,m. ∀R:predicate term. R T1 →
+ (∀T,T2. ⦃G, L⦄ ⊢ T1 ▶*[l, m] T → ⦃G, L⦄ ⊢ T ▶[l, m] T2 → R T → R T2) →
+ ∀T2. ⦃G, L⦄ ⊢ T1 ▶*[l, m] T2 → R T2.
+#G #L #T1 #l #m #R #HT1 #IHT1 #T2 #HT12
+@(TC_star_ind … HT1 IHT1 … HT12) //
+qed-.
+
+lemma cpys_ind_dx: ∀G,L,T2,l,m. ∀R:predicate term. R T2 →
+ (∀T1,T. ⦃G, L⦄ ⊢ T1 ▶[l, m] T → ⦃G, L⦄ ⊢ T ▶*[l, m] T2 → R T → R T1) →
+ ∀T1. ⦃G, L⦄ ⊢ T1 ▶*[l, m] T2 → R T1.
+#G #L #T2 #l #m #R #HT2 #IHT2 #T1 #HT12
+@(TC_star_ind_dx … HT2 IHT2 … HT12) //
+qed-.
+
+(* Basic properties *********************************************************)
+
+lemma cpy_cpys: ∀G,L,T1,T2,l,m. ⦃G, L⦄ ⊢ T1 ▶[l, m] T2 → ⦃G, L⦄ ⊢ T1 ▶*[l, m] T2.
+/2 width=1 by inj/ qed.
+
+lemma cpys_strap1: ∀G,L,T1,T,T2,l,m.
+ ⦃G, L⦄ ⊢ T1 ▶*[l, m] T → ⦃G, L⦄ ⊢ T ▶[l, m] T2 → ⦃G, L⦄ ⊢ T1 ▶*[l, m] T2.
+normalize /2 width=3 by step/ qed-.
+
+lemma cpys_strap2: ∀G,L,T1,T,T2,l,m.
+ ⦃G, L⦄ ⊢ T1 ▶[l, m] T → ⦃G, L⦄ ⊢ T ▶*[l, m] T2 → ⦃G, L⦄ ⊢ T1 ▶*[l, m] T2.
+normalize /2 width=3 by TC_strap/ qed-.
+
+lemma lsuby_cpys_trans: ∀G,l,m. lsub_trans … (cpys l m G) (lsuby l m).
+/3 width=5 by lsuby_cpy_trans, LTC_lsub_trans/
+qed-.
+
+lemma cpys_refl: ∀G,L,l,m. reflexive … (cpys l m G L).
+/2 width=1 by cpy_cpys/ qed.
+
+lemma cpys_bind: ∀G,L,V1,V2,l,m. ⦃G, L⦄ ⊢ V1 ▶*[l, m] V2 →
+ ∀I,T1,T2. ⦃G, L.ⓑ{I}V1⦄ ⊢ T1 ▶*[⫯l, m] T2 →
+ ∀a. ⦃G, L⦄ ⊢ ⓑ{a,I}V1.T1 ▶*[l, m] ⓑ{a,I}V2.T2.
+#G #L #V1 #V2 #l #m #HV12 @(cpys_ind … HV12) -V2
+[ #I #T1 #T2 #HT12 @(cpys_ind … HT12) -T2 /3 width=5 by cpys_strap1, cpy_bind/
+| /3 width=5 by cpys_strap1, cpy_bind/
+]
+qed.
+
+lemma cpys_flat: ∀G,L,V1,V2,l,m. ⦃G, L⦄ ⊢ V1 ▶*[l, m] V2 →
+ ∀T1,T2. ⦃G, L⦄ ⊢ T1 ▶*[l, m] T2 →
+ ∀I. ⦃G, L⦄ ⊢ ⓕ{I}V1.T1 ▶*[l, m] ⓕ{I}V2.T2.
+#G #L #V1 #V2 #l #m #HV12 @(cpys_ind … HV12) -V2
+[ #T1 #T2 #HT12 @(cpys_ind … HT12) -T2 /3 width=5 by cpys_strap1, cpy_flat/
+| /3 width=5 by cpys_strap1, cpy_flat/
+qed.
+
+lemma cpys_weak: ∀G,L,T1,T2,l1,m1. ⦃G, L⦄ ⊢ T1 ▶*[l1, m1] T2 →
+ ∀l2,m2. l2 ≤ l1 → l1 + m1 ≤ l2 + m2 →
+ ⦃G, L⦄ ⊢ T1 ▶*[l2, m2] T2.
+#G #L #T1 #T2 #l1 #m1 #H #l1 #l2 #Hl21 #Hlm12 @(cpys_ind … H) -T2
+/3 width=7 by cpys_strap1, cpy_weak/
+qed-.
+
+lemma cpys_weak_top: ∀G,L,T1,T2,l,m.
+ ⦃G, L⦄ ⊢ T1 ▶*[l, m] T2 → ⦃G, L⦄ ⊢ T1 ▶*[l, |L| - l] T2.
+#G #L #T1 #T2 #l #m #H @(cpys_ind … H) -T2
+/3 width=4 by cpys_strap1, cpy_weak_top/
+qed-.
+
+lemma cpys_weak_full: ∀G,L,T1,T2,l,m.
+ ⦃G, L⦄ ⊢ T1 ▶*[l, m] T2 → ⦃G, L⦄ ⊢ T1 ▶*[0, |L|] T2.
+#G #L #T1 #T2 #l #m #H @(cpys_ind … H) -T2
+/3 width=5 by cpys_strap1, cpy_weak_full/
+qed-.
+
+(* Basic forward lemmas *****************************************************)
+
+lemma cpys_fwd_up: ∀G,L,U1,U2,lt,mt. ⦃G, L⦄ ⊢ U1 ▶*[lt, mt] U2 →
+ ∀T1,l,m. ⬆[l, m] T1 ≡ U1 →
+ l ≤ lt → l + m ≤ lt + mt →
+ ∃∃T2. ⦃G, L⦄ ⊢ U1 ▶*[l+m, lt+mt-(l+m)] U2 & ⬆[l, m] T2 ≡ U2.
+#G #L #U1 #U2 #lt #mt #H #T1 #l #m #HTU1 #Hllt #Hlmlmt @(cpys_ind … H) -U2
+[ /2 width=3 by ex2_intro/
+| -HTU1 #U #U2 #_ #HU2 * #T #HU1 #HTU
+ elim (cpy_fwd_up … HU2 … HTU) -HU2 -HTU /3 width=3 by cpys_strap1, ex2_intro/
+]
+qed-.
+
+lemma cpys_fwd_tw: ∀G,L,T1,T2,l,m. ⦃G, L⦄ ⊢ T1 ▶*[l, m] T2 → ♯{T1} ≤ ♯{T2}.
+#G #L #T1 #T2 #l #m #H @(cpys_ind … H) -T2 //
+#T #T2 #_ #HT2 #IHT1 lapply (cpy_fwd_tw … HT2) -HT2
+/2 width=3 by transitive_le/
+qed-.
+
+(* Basic inversion lemmas ***************************************************)
+
+(* Note: this can be derived from cpys_inv_atom1 *)
+lemma cpys_inv_sort1: ∀G,L,T2,k,l,m. ⦃G, L⦄ ⊢ ⋆k ▶*[l, m] T2 → T2 = ⋆k.
+#G #L #T2 #k #l #m #H @(cpys_ind … H) -T2 //
+#T #T2 #_ #HT2 #IHT1 destruct
+>(cpy_inv_sort1 … HT2) -HT2 //
+qed-.
+
+(* Note: this can be derived from cpys_inv_atom1 *)
+lemma cpys_inv_gref1: ∀G,L,T2,p,l,m. ⦃G, L⦄ ⊢ §p ▶*[l, m] T2 → T2 = §p.
+#G #L #T2 #p #l #m #H @(cpys_ind … H) -T2 //
+#T #T2 #_ #HT2 #IHT1 destruct
+>(cpy_inv_gref1 … HT2) -HT2 //
+qed-.
+
+lemma cpys_inv_bind1: ∀a,I,G,L,V1,T1,U2,l,m. ⦃G, L⦄ ⊢ ⓑ{a,I}V1.T1 ▶*[l, m] U2 →
+ ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ▶*[l, m] V2 &
+ ⦃G, L.ⓑ{I}V1⦄ ⊢ T1 ▶*[⫯l, m] T2 &
+ U2 = ⓑ{a,I}V2.T2.
+#a #I #G #L #V1 #T1 #U2 #l #m #H @(cpys_ind … H) -U2
+[ /2 width=5 by ex3_2_intro/
+| #U #U2 #_ #HU2 * #V #T #HV1 #HT1 #H destruct
+ elim (cpy_inv_bind1 … HU2) -HU2 #V2 #T2 #HV2 #HT2 #H
+ lapply (lsuby_cpy_trans … HT2 (L.ⓑ{I}V1) ?) -HT2
+ /3 width=5 by cpys_strap1, lsuby_succ, ex3_2_intro/
+]
+qed-.
+
+lemma cpys_inv_flat1: ∀I,G,L,V1,T1,U2,l,m. ⦃G, L⦄ ⊢ ⓕ{I}V1.T1 ▶*[l, m] U2 →
+ ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ▶*[l, m] V2 & ⦃G, L⦄ ⊢ T1 ▶*[l, m] T2 &
+ U2 = ⓕ{I}V2.T2.
+#I #G #L #V1 #T1 #U2 #l #m #H @(cpys_ind … H) -U2
+[ /2 width=5 by ex3_2_intro/
+| #U #U2 #_ #HU2 * #V #T #HV1 #HT1 #H destruct
+ elim (cpy_inv_flat1 … HU2) -HU2
+ /3 width=5 by cpys_strap1, ex3_2_intro/
+]
+qed-.
+
+lemma cpys_inv_refl_O2: ∀G,L,T1,T2,l. ⦃G, L⦄ ⊢ T1 ▶*[l, 0] T2 → T1 = T2.
+#G #L #T1 #T2 #l #H @(cpys_ind … H) -T2 //
+#T #T2 #_ #HT2 #IHT1 <(cpy_inv_refl_O2 … HT2) -HT2 //
+qed-.
+
+lemma cpys_inv_lift1_eq: ∀G,L,U1,U2,l,m.
+ ⦃G, L⦄ ⊢ U1 ▶*[l, yinj m] U2 → ∀T1. ⬆[l, m] T1 ≡ U1 → U1 = U2.
+#G #L #U1 #U2 #l #m #H #T1 #HTU1 @(cpys_ind … H) -U2
+/2 width=7 by cpy_inv_lift1_eq/
+qed-.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/notation/relations/psubststaralt_6.ma".
+include "basic_2/multiple/cpys_lift.ma".
+
+(* CONTEXT-SENSITIVE EXTENDED MULTIPLE SUBSTITUTION FOR TERMS ***************)
+
+(* alternative definition of cpys *)
+inductive cpysa: ynat → ynat → relation4 genv lenv term term ≝
+| cpysa_atom : ∀I,G,L,l,m. cpysa l m G L (⓪{I}) (⓪{I})
+| cpysa_subst: ∀I,G,L,K,V1,V2,W2,i,l,m. l ≤ yinj i → i < l+m →
+ ⬇[i] L ≡ K.ⓑ{I}V1 → cpysa 0 (⫰(l+m-i)) G K V1 V2 →
+ ⬆[0, i+1] V2 ≡ W2 → cpysa l m G L (#i) W2
+| cpysa_bind : ∀a,I,G,L,V1,V2,T1,T2,l,m.
+ cpysa l m G L V1 V2 → cpysa (⫯l) m G (L.ⓑ{I}V1) T1 T2 →
+ cpysa l m G L (ⓑ{a,I}V1.T1) (ⓑ{a,I}V2.T2)
+| cpysa_flat : ∀I,G,L,V1,V2,T1,T2,l,m.
+ cpysa l m G L V1 V2 → cpysa l m G L T1 T2 →
+ cpysa l m G L (ⓕ{I}V1.T1) (ⓕ{I}V2.T2)
+.
+
+interpretation
+ "context-sensitive extended multiple substritution (term) alternative"
+ 'PSubstStarAlt G L T1 l m T2 = (cpysa l m G L T1 T2).
+
+(* Basic properties *********************************************************)
+
+lemma lsuby_cpysa_trans: ∀G,l,m. lsub_trans … (cpysa l m G) (lsuby l m).
+#G #l #m #L1 #T1 #T2 #H elim H -G -L1 -T1 -T2 -l -m
+[ //
+| #I #G #L1 #K1 #V1 #V2 #W2 #i #l #m #Hli #Hilm #HLK1 #_ #HVW2 #IHV12 #L2 #HL12
+ elim (lsuby_drop_trans_be … HL12 … HLK1) -HL12 -HLK1 /3 width=7 by cpysa_subst/
+| /4 width=1 by lsuby_succ, cpysa_bind/
+| /3 width=1 by cpysa_flat/
+]
+qed-.
+
+lemma cpysa_refl: ∀G,T,L,l,m. ⦃G, L⦄ ⊢ T ▶▶*[l, m] T.
+#G #T elim T -T //
+#I elim I -I /2 width=1 by cpysa_bind, cpysa_flat/
+qed.
+
+lemma cpysa_cpy_trans: ∀G,L,T1,T,l,m. ⦃G, L⦄ ⊢ T1 ▶▶*[l, m] T →
+ ∀T2. ⦃G, L⦄ ⊢ T ▶[l, m] T2 → ⦃G, L⦄ ⊢ T1 ▶▶*[l, m] T2.
+#G #L #T1 #T #l #m #H elim H -G -L -T1 -T -l -m
+[ #I #G #L #l #m #X #H
+ elim (cpy_inv_atom1 … H) -H // * /2 width=7 by cpysa_subst/
+| #I #G #L #K #V1 #V2 #W2 #i #l #m #Hli #Hilm #HLK #_ #HVW2 #IHV12 #T2 #H
+ lapply (drop_fwd_drop2 … HLK) #H0LK
+ lapply (cpy_weak … H 0 (l+m) ? ?) -H // #H
+ elim (cpy_inv_lift1_be … H … H0LK … HVW2) -H -H0LK -HVW2
+ /3 width=7 by cpysa_subst, ylt_fwd_le_succ1/
+| #a #I #G #L #V1 #V #T1 #T #l #m #_ #_ #IHV1 #IHT1 #X #H
+ elim (cpy_inv_bind1 … H) -H #V2 #T2 #HV2 #HT2 #H destruct
+ /5 width=5 by cpysa_bind, lsuby_cpy_trans, lsuby_succ/
+| #I #G #L #V1 #V #T1 #T #l #m #_ #_ #IHV1 #IHT1 #X #H
+ elim (cpy_inv_flat1 … H) -H #V2 #T2 #HV2 #HT2 #H destruct /3 width=1 by cpysa_flat/
+]
+qed-.
+
+lemma cpys_cpysa: ∀G,L,T1,T2,l,m. ⦃G, L⦄ ⊢ T1 ▶*[l, m] T2 → ⦃G, L⦄ ⊢ T1 ▶▶*[l, m] T2.
+/3 width=8 by cpysa_cpy_trans, cpys_ind/ qed.
+
+(* Basic inversion lemmas ***************************************************)
+
+lemma cpysa_inv_cpys: ∀G,L,T1,T2,l,m. ⦃G, L⦄ ⊢ T1 ▶▶*[l, m] T2 → ⦃G, L⦄ ⊢ T1 ▶*[l, m] T2.
+#G #L #T1 #T2 #l #m #H elim H -G -L -T1 -T2 -l -m
+/2 width=7 by cpys_subst, cpys_flat, cpys_bind, cpy_cpys/
+qed-.
+
+(* Advanced eliminators *****************************************************)
+
+lemma cpys_ind_alt: ∀R:ynat→ynat→relation4 genv lenv term term.
+ (∀I,G,L,l,m. R l m G L (⓪{I}) (⓪{I})) →
+ (∀I,G,L,K,V1,V2,W2,i,l,m. l ≤ yinj i → i < l + m →
+ ⬇[i] L ≡ K.ⓑ{I}V1 → ⦃G, K⦄ ⊢ V1 ▶*[O, ⫰(l+m-i)] V2 →
+ ⬆[O, i+1] V2 ≡ W2 → R O (⫰(l+m-i)) G K V1 V2 → R l m G L (#i) W2
+ ) →
+ (∀a,I,G,L,V1,V2,T1,T2,l,m. ⦃G, L⦄ ⊢ V1 ▶*[l, m] V2 →
+ ⦃G, L.ⓑ{I}V1⦄ ⊢ T1 ▶*[⫯l, m] T2 → R l m G L V1 V2 →
+ R (⫯l) m G (L.ⓑ{I}V1) T1 T2 → R l m G L (ⓑ{a,I}V1.T1) (ⓑ{a,I}V2.T2)
+ ) →
+ (∀I,G,L,V1,V2,T1,T2,l,m. ⦃G, L⦄ ⊢ V1 ▶*[l, m] V2 →
+ ⦃G, L⦄ ⊢ T1 ▶*[l, m] T2 → R l m G L V1 V2 →
+ R l m G L T1 T2 → R l m G L (ⓕ{I}V1.T1) (ⓕ{I}V2.T2)
+ ) →
+ ∀l,m,G,L,T1,T2. ⦃G, L⦄ ⊢ T1 ▶*[l, m] T2 → R l m G L T1 T2.
+#R #H1 #H2 #H3 #H4 #l #m #G #L #T1 #T2 #H elim (cpys_cpysa … H) -G -L -T1 -T2 -l -m
+/3 width=8 by cpysa_inv_cpys/
+qed-.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/substitution/cpy_cpy.ma".
+include "basic_2/multiple/cpys_alt.ma".
+
+(* CONTEXT-SENSITIVE EXTENDED MULTIPLE SUBSTITUTION FOR TERMS ***************)
+
+(* Advanced inversion lemmas ************************************************)
+
+lemma cpys_inv_SO2: ∀G,L,T1,T2,l. ⦃G, L⦄ ⊢ T1 ▶*[l, 1] T2 → ⦃G, L⦄ ⊢ T1 ▶[l, 1] T2.
+#G #L #T1 #T2 #l #H @(cpys_ind … H) -T2 /2 width=3 by cpy_trans_ge/
+qed-.
+
+(* Advanced properties ******************************************************)
+
+lemma cpys_strip_eq: ∀G,L,T0,T1,l1,m1. ⦃G, L⦄ ⊢ T0 ▶*[l1, m1] T1 →
+ ∀T2,l2,m2. ⦃G, L⦄ ⊢ T0 ▶[l2, m2] T2 →
+ ∃∃T. ⦃G, L⦄ ⊢ T1 ▶[l2, m2] T & ⦃G, L⦄ ⊢ T2 ▶*[l1, m1] T.
+normalize /3 width=3 by cpy_conf_eq, TC_strip1/ qed-.
+
+lemma cpys_strip_neq: ∀G,L1,T0,T1,l1,m1. ⦃G, L1⦄ ⊢ T0 ▶*[l1, m1] T1 →
+ ∀L2,T2,l2,m2. ⦃G, L2⦄ ⊢ T0 ▶[l2, m2] T2 →
+ (l1 + m1 ≤ l2 ∨ l2 + m2 ≤ l1) →
+ ∃∃T. ⦃G, L2⦄ ⊢ T1 ▶[l2, m2] T & ⦃G, L1⦄ ⊢ T2 ▶*[l1, m1] T.
+normalize /3 width=3 by cpy_conf_neq, TC_strip1/ qed-.
+
+lemma cpys_strap1_down: ∀G,L,T1,T0,l1,m1. ⦃G, L⦄ ⊢ T1 ▶*[l1, m1] T0 →
+ ∀T2,l2,m2. ⦃G, L⦄ ⊢ T0 ▶[l2, m2] T2 → l2 + m2 ≤ l1 →
+ ∃∃T. ⦃G, L⦄ ⊢ T1 ▶[l2, m2] T & ⦃G, L⦄ ⊢ T ▶*[l1, m1] T2.
+normalize /3 width=3 by cpy_trans_down, TC_strap1/ qed.
+
+lemma cpys_strap2_down: ∀G,L,T1,T0,l1,m1. ⦃G, L⦄ ⊢ T1 ▶[l1, m1] T0 →
+ ∀T2,l2,m2. ⦃G, L⦄ ⊢ T0 ▶*[l2, m2] T2 → l2 + m2 ≤ l1 →
+ ∃∃T. ⦃G, L⦄ ⊢ T1 ▶*[l2, m2] T & ⦃G, L⦄ ⊢ T ▶[l1, m1] T2.
+normalize /3 width=3 by cpy_trans_down, TC_strap2/ qed-.
+
+lemma cpys_split_up: ∀G,L,T1,T2,l,m. ⦃G, L⦄ ⊢ T1 ▶*[l, m] T2 →
+ ∀i. l ≤ i → i ≤ l + m →
+ ∃∃T. ⦃G, L⦄ ⊢ T1 ▶*[l, i - l] T & ⦃G, L⦄ ⊢ T ▶*[i, l + m - i] T2.
+#G #L #T1 #T2 #l #m #H #i #Hli #Hilm @(cpys_ind … H) -T2
+[ /2 width=3 by ex2_intro/
+| #T #T2 #_ #HT12 * #T3 #HT13 #HT3
+ elim (cpy_split_up … HT12 … Hilm) -HT12 -Hilm #T0 #HT0 #HT02
+ elim (cpys_strap1_down … HT3 … HT0) -T /3 width=5 by cpys_strap1, ex2_intro/
+ >ymax_pre_sn_comm //
+]
+qed-.
+
+lemma cpys_inv_lift1_up: ∀G,L,U1,U2,lt,mt. ⦃G, L⦄ ⊢ U1 ▶*[lt, mt] U2 →
+ ∀K,s,l,m. ⬇[s, l, m] L ≡ K → ∀T1. ⬆[l, m] T1 ≡ U1 →
+ l ≤ lt → lt ≤ l + m → l + m ≤ lt + mt →
+ ∃∃T2. ⦃G, K⦄ ⊢ T1 ▶*[l, lt + mt - (l + m)] T2 &
+ ⬆[l, m] T2 ≡ U2.
+#G #L #U1 #U2 #lt #mt #HU12 #K #s #l #m #HLK #T1 #HTU1 #Hllt #Hltlm #Hlmlmt
+elim (cpys_split_up … HU12 (l + m)) -HU12 // -Hlmlmt #U #HU1 #HU2
+lapply (cpys_weak … HU1 l m ? ?) -HU1 // [ >ymax_pre_sn_comm // ] -Hllt -Hltlm #HU1
+lapply (cpys_inv_lift1_eq … HU1 … HTU1) -HU1 #HU1 destruct
+elim (cpys_inv_lift1_ge … HU2 … HLK … HTU1) -HU2 -HLK -HTU1 //
+>yplus_minus_inj /2 width=3 by ex2_intro/
+qed-.
+
+(* Main properties **********************************************************)
+
+theorem cpys_conf_eq: ∀G,L,T0,T1,l1,m1. ⦃G, L⦄ ⊢ T0 ▶*[l1, m1] T1 →
+ ∀T2,l2,m2. ⦃G, L⦄ ⊢ T0 ▶*[l2, m2] T2 →
+ ∃∃T. ⦃G, L⦄ ⊢ T1 ▶*[l2, m2] T & ⦃G, L⦄ ⊢ T2 ▶*[l1, m1] T.
+normalize /3 width=3 by cpy_conf_eq, TC_confluent2/ qed-.
+
+theorem cpys_conf_neq: ∀G,L1,T0,T1,l1,m1. ⦃G, L1⦄ ⊢ T0 ▶*[l1, m1] T1 →
+ ∀L2,T2,l2,m2. ⦃G, L2⦄ ⊢ T0 ▶*[l2, m2] T2 →
+ (l1 + m1 ≤ l2 ∨ l2 + m2 ≤ l1) →
+ ∃∃T. ⦃G, L2⦄ ⊢ T1 ▶*[l2, m2] T & ⦃G, L1⦄ ⊢ T2 ▶*[l1, m1] T.
+normalize /3 width=3 by cpy_conf_neq, TC_confluent2/ qed-.
+
+theorem cpys_trans_eq: ∀G,L,T1,T,T2,l,m.
+ ⦃G, L⦄ ⊢ T1 ▶*[l, m] T → ⦃G, L⦄ ⊢ T ▶*[l, m] T2 →
+ ⦃G, L⦄ ⊢ T1 ▶*[l, m] T2.
+normalize /2 width=3 by trans_TC/ qed-.
+
+theorem cpys_trans_down: ∀G,L,T1,T0,l1,m1. ⦃G, L⦄ ⊢ T1 ▶*[l1, m1] T0 →
+ ∀T2,l2,m2. ⦃G, L⦄ ⊢ T0 ▶*[l2, m2] T2 → l2 + m2 ≤ l1 →
+ ∃∃T. ⦃G, L⦄ ⊢ T1 ▶*[l2, m2] T & ⦃G, L⦄ ⊢ T ▶*[l1, m1] T2.
+normalize /3 width=3 by cpy_trans_down, TC_transitive2/ qed-.
+
+theorem cpys_antisym_eq: ∀G,L1,T1,T2,l,m. ⦃G, L1⦄ ⊢ T1 ▶*[l, m] T2 →
+ ∀L2. ⦃G, L2⦄ ⊢ T2 ▶*[l, m] T1 → T1 = T2.
+#G #L1 #T1 #T2 #l #m #H @(cpys_ind_alt … H) -G -L1 -T1 -T2 //
+[ #I1 #G #L1 #K1 #V1 #V2 #W2 #i #l #m #Hli #Hilm #_ #_ #HVW2 #_ #L2 #HW2
+ elim (lt_or_ge (|L2|) (i+1)) #Hi [ -Hli -Hilm | ]
+ [ lapply (cpys_weak_full … HW2) -HW2 #HW2
+ lapply (cpys_weak … HW2 0 (i+1) ? ?) -HW2 //
+ [ >yplus_O1 >yplus_O1 /3 width=1 by ylt_fwd_le, ylt_inj/ ] -Hi
+ #HW2 >(cpys_inv_lift1_eq … HW2) -HW2 //
+ | elim (drop_O1_le (Ⓕ) … Hi) -Hi #K2 #HLK2
+ elim (cpys_inv_lift1_ge_up … HW2 … HLK2 … HVW2 ? ? ?) -HW2 -HLK2 -HVW2
+ /2 width=1 by ylt_fwd_le_succ1, yle_succ_dx/ -Hli -Hilm
+ #X #_ #H elim (lift_inv_lref2_be … H) -H /2 width=1 by ylt_inj/
+ ]
+| #a #I #G #L1 #V1 #V2 #T1 #T2 #l #m #_ #_ #IHV12 #IHT12 #L2 #H elim (cpys_inv_bind1 … H) -H
+ #V #T #HV2 #HT2 #H destruct
+ lapply (IHV12 … HV2) #H destruct -IHV12 -HV2 /3 width=2 by eq_f2/
+| #I #G #L1 #V1 #V2 #T1 #T2 #l #m #_ #_ #IHV12 #IHT12 #L2 #H elim (cpys_inv_flat1 … H) -H
+ #V #T #HV2 #HT2 #H destruct /3 width=2 by eq_f2/
+]
+qed-.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/substitution/cpy_lift.ma".
+include "basic_2/multiple/cpys.ma".
+
+(* CONTEXT-SENSITIVE EXTENDED MULTIPLE SUBSTITUTION FOR TERMS ***************)
+
+(* Advanced properties ******************************************************)
+
+lemma cpys_subst: ∀I,G,L,K,V,U1,i,l,m.
+ l ≤ yinj i → i < l + m →
+ ⬇[i] L ≡ K.ⓑ{I}V → ⦃G, K⦄ ⊢ V ▶*[0, ⫰(l+m-i)] U1 →
+ ∀U2. ⬆[0, i+1] U1 ≡ U2 → ⦃G, L⦄ ⊢ #i ▶*[l, m] U2.
+#I #G #L #K #V #U1 #i #l #m #Hli #Hilm #HLK #H @(cpys_ind … H) -U1
+[ /3 width=5 by cpy_cpys, cpy_subst/
+| #U #U1 #_ #HU1 #IHU #U2 #HU12
+ elim (lift_total U 0 (i+1)) #U0 #HU0
+ lapply (IHU … HU0) -IHU #H
+ lapply (drop_fwd_drop2 … HLK) -HLK #HLK
+ lapply (cpy_lift_ge … HU1 … HLK HU0 HU12 ?) -HU1 -HLK -HU0 -HU12 // #HU02
+ lapply (cpy_weak … HU02 l m ? ?) -HU02
+ [2,3: /2 width=3 by cpys_strap1, yle_succ_dx/ ]
+ >yplus_O1 <yplus_inj >ymax_pre_sn_comm /2 width=1 by ylt_fwd_le_succ1/
+]
+qed.
+
+lemma cpys_subst_Y2: ∀I,G,L,K,V,U1,i,l.
+ l ≤ yinj i →
+ ⬇[i] L ≡ K.ⓑ{I}V → ⦃G, K⦄ ⊢ V ▶*[0, ∞] U1 →
+ ∀U2. ⬆[0, i+1] U1 ≡ U2 → ⦃G, L⦄ ⊢ #i ▶*[l, ∞] U2.
+#I #G #L #K #V #U1 #i #l #Hli #HLK #HVU1 #U2 #HU12
+@(cpys_subst … HLK … HU12) >yminus_Y_inj //
+qed.
+
+(* Advanced inversion lemmas *************************************************)
+
+lemma cpys_inv_atom1: ∀I,G,L,T2,l,m. ⦃G, L⦄ ⊢ ⓪{I} ▶*[l, m] T2 →
+ T2 = ⓪{I} ∨
+ ∃∃J,K,V1,V2,i. l ≤ yinj i & i < l + m &
+ ⬇[i] L ≡ K.ⓑ{J}V1 &
+ ⦃G, K⦄ ⊢ V1 ▶*[0, ⫰(l+m-i)] V2 &
+ ⬆[O, i+1] V2 ≡ T2 &
+ I = LRef i.
+#I #G #L #T2 #l #m #H @(cpys_ind … H) -T2
+[ /2 width=1 by or_introl/
+| #T #T2 #_ #HT2 *
+ [ #H destruct
+ elim (cpy_inv_atom1 … HT2) -HT2 [ /2 width=1 by or_introl/ | * /3 width=11 by ex6_5_intro, or_intror/ ]
+ | * #J #K #V1 #V #i #Hli #Hilm #HLK #HV1 #HVT #HI
+ lapply (drop_fwd_drop2 … HLK) #H
+ elim (cpy_inv_lift1_ge_up … HT2 … H … HVT) -HT2 -H -HVT
+ [2,3,4: /2 width=1 by ylt_fwd_le_succ1, yle_succ_dx/ ]
+ /4 width=11 by cpys_strap1, ex6_5_intro, or_intror/
+ ]
+]
+qed-.
+
+lemma cpys_inv_lref1: ∀G,L,T2,i,l,m. ⦃G, L⦄ ⊢ #i ▶*[l, m] T2 →
+ T2 = #i ∨
+ ∃∃I,K,V1,V2. l ≤ i & i < l + m &
+ ⬇[i] L ≡ K.ⓑ{I}V1 &
+ ⦃G, K⦄ ⊢ V1 ▶*[0, ⫰(l+m-i)] V2 &
+ ⬆[O, i+1] V2 ≡ T2.
+#G #L #T2 #i #l #m #H elim (cpys_inv_atom1 … H) -H /2 width=1 by or_introl/
+* #I #K #V1 #V2 #j #Hlj #Hjlm #HLK #HV12 #HVT2 #H destruct /3 width=7 by ex5_4_intro, or_intror/
+qed-.
+
+lemma cpys_inv_lref1_Y2: ∀G,L,T2,i,l. ⦃G, L⦄ ⊢ #i ▶*[l, ∞] T2 →
+ T2 = #i ∨
+ ∃∃I,K,V1,V2. l ≤ i & ⬇[i] L ≡ K.ⓑ{I}V1 &
+ ⦃G, K⦄ ⊢ V1 ▶*[0, ∞] V2 & ⬆[O, i+1] V2 ≡ T2.
+#G #L #T2 #i #l #H elim (cpys_inv_lref1 … H) -H /2 width=1 by or_introl/
+* >yminus_Y_inj /3 width=7 by or_intror, ex4_4_intro/
+qed-.
+
+lemma cpys_inv_lref1_drop: ∀G,L,T2,i,l,m. ⦃G, L⦄ ⊢ #i ▶*[l, m] T2 →
+ ∀I,K,V1. ⬇[i] L ≡ K.ⓑ{I}V1 →
+ ∀V2. ⬆[O, i+1] V2 ≡ T2 →
+ ∧∧ ⦃G, K⦄ ⊢ V1 ▶*[0, ⫰(l+m-i)] V2
+ & l ≤ i
+ & i < l + m.
+#G #L #T2 #i #l #m #H #I #K #V1 #HLK #V2 #HVT2 elim (cpys_inv_lref1 … H) -H
+[ #H destruct elim (lift_inv_lref2_be … HVT2) -HVT2 -HLK /2 width=1 by ylt_inj/
+| * #Z #Y #X1 #X2 #Hli #Hilm #HLY #HX12 #HXT2
+ lapply (lift_inj … HXT2 … HVT2) -T2 #H destruct
+ lapply (drop_mono … HLY … HLK) -L #H destruct
+ /2 width=1 by and3_intro/
+]
+qed-.
+
+(* Properties on relocation *************************************************)
+
+lemma cpys_lift_le: ∀G,K,T1,T2,lt,mt. ⦃G, K⦄ ⊢ T1 ▶*[lt, mt] T2 →
+ ∀L,U1,s,l,m. lt + mt ≤ l → ⬇[s, l, m] L ≡ K →
+ ⬆[l, m] T1 ≡ U1 → ∀U2. ⬆[l, m] T2 ≡ U2 →
+ ⦃G, L⦄ ⊢ U1 ▶*[lt, mt] U2.
+#G #K #T1 #T2 #lt #mt #H #L #U1 #s #l #m #Hlmtl #HLK #HTU1 @(cpys_ind … H) -T2
+[ #U2 #H >(lift_mono … HTU1 … H) -H //
+| -HTU1 #T #T2 #_ #HT2 #IHT #U2 #HTU2
+ elim (lift_total T l m) #U #HTU
+ lapply (IHT … HTU) -IHT #HU1
+ lapply (cpy_lift_le … HT2 … HLK HTU HTU2 ?) -HT2 -HLK -HTU -HTU2 /2 width=3 by cpys_strap1/
+]
+qed-.
+
+lemma cpys_lift_be: ∀G,K,T1,T2,lt,mt. ⦃G, K⦄ ⊢ T1 ▶*[lt, mt] T2 →
+ ∀L,U1,s,l,m. lt ≤ l → l ≤ lt + mt →
+ ⬇[s, l, m] L ≡ K → ⬆[l, m] T1 ≡ U1 →
+ ∀U2. ⬆[l, m] T2 ≡ U2 → ⦃G, L⦄ ⊢ U1 ▶*[lt, mt + m] U2.
+#G #K #T1 #T2 #lt #mt #H #L #U1 #s #l #m #Hltl #Hllmt #HLK #HTU1 @(cpys_ind … H) -T2
+[ #U2 #H >(lift_mono … HTU1 … H) -H //
+| -HTU1 #T #T2 #_ #HT2 #IHT #U2 #HTU2
+ elim (lift_total T l m) #U #HTU
+ lapply (IHT … HTU) -IHT #HU1
+ lapply (cpy_lift_be … HT2 … HLK HTU HTU2 ? ?) -HT2 -HLK -HTU -HTU2 /2 width=3 by cpys_strap1/
+]
+qed-.
+
+lemma cpys_lift_ge: ∀G,K,T1,T2,lt,mt. ⦃G, K⦄ ⊢ T1 ▶*[lt, mt] T2 →
+ ∀L,U1,s,l,m. l ≤ lt → ⬇[s, l, m] L ≡ K →
+ ⬆[l, m] T1 ≡ U1 → ∀U2. ⬆[l, m] T2 ≡ U2 →
+ ⦃G, L⦄ ⊢ U1 ▶*[lt+m, mt] U2.
+#G #K #T1 #T2 #lt #mt #H #L #U1 #s #l #m #Hllt #HLK #HTU1 @(cpys_ind … H) -T2
+[ #U2 #H >(lift_mono … HTU1 … H) -H //
+| -HTU1 #T #T2 #_ #HT2 #IHT #U2 #HTU2
+ elim (lift_total T l m) #U #HTU
+ lapply (IHT … HTU) -IHT #HU1
+ lapply (cpy_lift_ge … HT2 … HLK HTU HTU2 ?) -HT2 -HLK -HTU -HTU2 /2 width=3 by cpys_strap1/
+]
+qed-.
+
+(* Inversion lemmas for relocation ******************************************)
+
+lemma cpys_inv_lift1_le: ∀G,L,U1,U2,lt,mt. ⦃G, L⦄ ⊢ U1 ▶*[lt, mt] U2 →
+ ∀K,s,l,m. ⬇[s, l, m] L ≡ K → ∀T1. ⬆[l, m] T1 ≡ U1 →
+ lt + mt ≤ l →
+ ∃∃T2. ⦃G, K⦄ ⊢ T1 ▶*[lt, mt] T2 & ⬆[l, m] T2 ≡ U2.
+#G #L #U1 #U2 #lt #mt #H #K #s #l #m #HLK #T1 #HTU1 #Hlmtl @(cpys_ind … H) -U2
+[ /2 width=3 by ex2_intro/
+| -HTU1 #U #U2 #_ #HU2 * #T #HT1 #HTU
+ elim (cpy_inv_lift1_le … HU2 … HLK … HTU) -HU2 -HLK -HTU /3 width=3 by cpys_strap1, ex2_intro/
+]
+qed-.
+
+lemma cpys_inv_lift1_be: ∀G,L,U1,U2,lt,mt. ⦃G, L⦄ ⊢ U1 ▶*[lt, mt] U2 →
+ ∀K,s,l,m. ⬇[s, l, m] L ≡ K → ∀T1. ⬆[l, m] T1 ≡ U1 →
+ lt ≤ l → l + m ≤ lt + mt →
+ ∃∃T2. ⦃G, K⦄ ⊢ T1 ▶*[lt, mt - m] T2 & ⬆[l, m] T2 ≡ U2.
+#G #L #U1 #U2 #lt #mt #H #K #s #l #m #HLK #T1 #HTU1 #Hltl #Hlmlmt @(cpys_ind … H) -U2
+[ /2 width=3 by ex2_intro/
+| -HTU1 #U #U2 #_ #HU2 * #T #HT1 #HTU
+ elim (cpy_inv_lift1_be … HU2 … HLK … HTU) -HU2 -HLK -HTU /3 width=3 by cpys_strap1, ex2_intro/
+]
+qed-.
+
+lemma cpys_inv_lift1_ge: ∀G,L,U1,U2,lt,mt. ⦃G, L⦄ ⊢ U1 ▶*[lt, mt] U2 →
+ ∀K,s,l,m. ⬇[s, l, m] L ≡ K → ∀T1. ⬆[l, m] T1 ≡ U1 →
+ l + m ≤ lt →
+ ∃∃T2. ⦃G, K⦄ ⊢ T1 ▶*[lt - m, mt] T2 & ⬆[l, m] T2 ≡ U2.
+#G #L #U1 #U2 #lt #mt #H #K #s #l #m #HLK #T1 #HTU1 #Hlmlt @(cpys_ind … H) -U2
+[ /2 width=3 by ex2_intro/
+| -HTU1 #U #U2 #_ #HU2 * #T #HT1 #HTU
+ elim (cpy_inv_lift1_ge … HU2 … HLK … HTU) -HU2 -HLK -HTU /3 width=3 by cpys_strap1, ex2_intro/
+]
+qed-.
+
+(* Advanced inversion lemmas on relocation **********************************)
+
+lemma cpys_inv_lift1_ge_up: ∀G,L,U1,U2,lt,mt. ⦃G, L⦄ ⊢ U1 ▶*[lt, mt] U2 →
+ ∀K,s,l,m. ⬇[s, l, m] L ≡ K → ∀T1. ⬆[l, m] T1 ≡ U1 →
+ l ≤ lt → lt ≤ l + m → l + m ≤ lt + mt →
+ ∃∃T2. ⦃G, K⦄ ⊢ T1 ▶*[l, lt + mt - (l + m)] T2 &
+ ⬆[l, m] T2 ≡ U2.
+#G #L #U1 #U2 #lt #mt #H #K #s #l #m #HLK #T1 #HTU1 #Hllt #Hltlm #Hlmlmt @(cpys_ind … H) -U2
+[ /2 width=3 by ex2_intro/
+| -HTU1 #U #U2 #_ #HU2 * #T #HT1 #HTU
+ elim (cpy_inv_lift1_ge_up … HU2 … HLK … HTU) -HU2 -HLK -HTU /3 width=3 by cpys_strap1, ex2_intro/
+]
+qed-.
+
+lemma cpys_inv_lift1_be_up: ∀G,L,U1,U2,lt,mt. ⦃G, L⦄ ⊢ U1 ▶*[lt, mt] U2 →
+ ∀K,s,l,m. ⬇[s, l, m] L ≡ K → ∀T1. ⬆[l, m] T1 ≡ U1 →
+ lt ≤ l → lt + mt ≤ l + m →
+ ∃∃T2. ⦃G, K⦄ ⊢ T1 ▶*[lt, l - lt] T2 & ⬆[l, m] T2 ≡ U2.
+#G #L #U1 #U2 #lt #mt #H #K #s #l #m #HLK #T1 #HTU1 #Hltl #Hlmtlm @(cpys_ind … H) -U2
+[ /2 width=3 by ex2_intro/
+| -HTU1 #U #U2 #_ #HU2 * #T #HT1 #HTU
+ elim (cpy_inv_lift1_be_up … HU2 … HLK … HTU) -HU2 -HLK -HTU /3 width=3 by cpys_strap1, ex2_intro/
+]
+qed-.
+
+lemma cpys_inv_lift1_le_up: ∀G,L,U1,U2,lt,mt. ⦃G, L⦄ ⊢ U1 ▶*[lt, mt] U2 →
+ ∀K,s,l,m. ⬇[s, l, m] L ≡ K → ∀T1. ⬆[l, m] T1 ≡ U1 →
+ lt ≤ l → l ≤ lt + mt → lt + mt ≤ l + m →
+ ∃∃T2. ⦃G, K⦄ ⊢ T1 ▶*[lt, l - lt] T2 & ⬆[l, m] T2 ≡ U2.
+#G #L #U1 #U2 #lt #mt #H #K #s #l #m #HLK #T1 #HTU1 #Hltl #Hllmt #Hlmtlm @(cpys_ind … H) -U2
+[ /2 width=3 by ex2_intro/
+| -HTU1 #U #U2 #_ #HU2 * #T #HT1 #HTU
+ elim (cpy_inv_lift1_le_up … HU2 … HLK … HTU) -HU2 -HLK -HTU /3 width=3 by cpys_strap1, ex2_intro/
+]
+qed-.
+
+lemma cpys_inv_lift1_subst: ∀G,L,W1,W2,l,m. ⦃G, L⦄ ⊢ W1 ▶*[l, m] W2 →
+ ∀K,V1,i. ⬇[i+1] L ≡ K → ⬆[O, i+1] V1 ≡ W1 →
+ l ≤ yinj i → i < l + m →
+ ∃∃V2. ⦃G, K⦄ ⊢ V1 ▶*[O, ⫰(l+m-i)] V2 & ⬆[O, i+1] V2 ≡ W2.
+#G #L #W1 #W2 #l #m #HW12 #K #V1 #i #HLK #HVW1 #Hli #Hilm
+elim (cpys_inv_lift1_ge_up … HW12 … HLK … HVW1 ? ? ?) //
+>yplus_O1 <yplus_inj >yplus_SO2
+[ >yminus_succ2 /2 width=3 by ex2_intro/
+| /2 width=1 by ylt_fwd_le_succ1/
+| /2 width=3 by yle_trans/
+]
+qed-.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/notation/relations/lazyor_5.ma".
+include "basic_2/multiple/frees.ma".
+
+(* POINTWISE UNION FOR LOCAL ENVIRONMENTS ***********************************)
+
+definition llor: ynat → relation4 term lenv lenv lenv ≝ λl,T,L2,L1,L.
+ ∧∧ |L1| = |L2| & |L1| = |L|
+ & (∀I1,I2,I,K1,K2,K,V1,V2,V,i.
+ ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 → ⬇[i] L ≡ K.ⓑ{I}V → ∨∨
+ (∧∧ yinj i < l & I1 = I & V1 = V) |
+ (∧∧ (L1 ⊢ i ϵ 𝐅*[l]⦃T⦄ → ⊥) & I1 = I & V1 = V) |
+ (∧∧ l ≤ yinj i & L1 ⊢ i ϵ 𝐅*[l]⦃T⦄ & I2 = I & V2 = V)
+ ).
+
+interpretation
+ "lazy union (local environment)"
+ 'LazyOr L1 T l L2 L = (llor l T L2 L1 L).
+
+(* Basic properties *********************************************************)
+
+(* Note: this can be proved by llor_skip *)
+lemma llor_atom: ∀T,l. ⋆ ⋓[T, l] ⋆ ≡ ⋆.
+#T #l @and3_intro //
+#I1 #I2 #I #K1 #K2 #K #V1 #V2 #V #i #HLK1
+elim (drop_inv_atom1 … HLK1) -HLK1 #H destruct
+qed.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/multiple/frees_append.ma".
+include "basic_2/multiple/llor.ma".
+
+(* POINTWISE UNION FOR LOCAL ENVIRONMENTS ***********************************)
+
+(* Alternative definition ***************************************************)
+
+lemma llor_tail_frees: ∀L1,L2,L,U,l. L1 ⋓[U, l] L2 ≡ L → l ≤ yinj (|L1|) →
+ ∀I1,W1. ⓑ{I1}W1.L1 ⊢ |L1| ϵ 𝐅*[l]⦃U⦄ →
+ ∀I2,W2. ⓑ{I1}W1.L1 ⋓[U, l] ⓑ{I2}W2.L2 ≡ ⓑ{I2}W2.L.
+#L1 #L2 #L #U #l * #HL12 #HL1 #IH #Hl #I1 #W1 #HU #I2 #W2
+@and3_intro [1,2: >ltail_length /2 width=1 by le_S_S/ ]
+#J1 #J2 #J #K1 #K2 #K #V1 #V2 #V #i #HLK1 #HLK2 #HLK
+lapply (drop_fwd_length_lt2 … HLK1) >ltail_length #H
+lapply (lt_plus_SO_to_le … H) -H #H
+elim (le_to_or_lt_eq … H) -H #H
+[ elim (drop_O1_lt (Ⓕ) … H) #Z1 #Y1 #X1 #HLY1
+ elim (drop_O1_lt (Ⓕ) L2 i) // #Z2 #Y2 #X2 #HLY2
+ elim (drop_O1_lt (Ⓕ) L i) // #Z #Y #X #HLY
+ lapply (drop_O1_inv_append1_le … HLK1 … HLY1) /2 width=1 by lt_to_le/ -HLK1 normalize #H destruct
+ lapply (drop_O1_inv_append1_le … HLK2 … HLY2) /2 width=1 by lt_to_le/ -HLK2 normalize #H destruct
+ lapply (drop_O1_inv_append1_le … HLK … HLY) /2 width=1 by lt_to_le/ -HLK normalize #H destruct
+ elim (IH … HLY1 HLY2 HLY) -IH -HLY1 -HLY2 -HLY *
+ [ /3 width=1 by and3_intro, or3_intro0/
+ | /7 width=2 by frees_inv_append, yle_inj, lt_to_le, or3_intro1, and3_intro/
+ | /6 width=1 by frees_append, yle_inj, lt_to_le, or3_intro2, and4_intro/
+ ]
+| -IH -HLK1 destruct
+ lapply (drop_O1_inv_append1_le … HLK2 … (⋆) ?) // -HLK2 normalize #H destruct
+ lapply (drop_O1_inv_append1_le … HLK … (⋆) ?) // -HLK normalize #H destruct
+ /3 width=1 by or3_intro2, and4_intro/
+]
+qed.
+
+lemma llor_tail_cofrees: ∀L1,L2,L,U,l. L1 ⋓[U, l] L2 ≡ L →
+ ∀I1,W1. (ⓑ{I1}W1.L1 ⊢ |L1| ϵ 𝐅*[l]⦃U⦄ → ⊥) →
+ ∀I2,W2. ⓑ{I1}W1.L1 ⋓[U, l] ⓑ{I2}W2.L2 ≡ ⓑ{I1}W1.L.
+#L1 #L2 #L #U #l * #HL12 #HL1 #IH #I1 #W1 #HU #I2 #W2
+@and3_intro [1,2: >ltail_length /2 width=1 by le_S_S/ ]
+#J1 #J2 #J #K1 #K2 #K #V1 #V2 #V #i #HLK1 #HLK2 #HLK
+lapply (drop_fwd_length_lt2 … HLK1) >ltail_length #H
+lapply (lt_plus_SO_to_le … H) -H #H
+elim (le_to_or_lt_eq … H) -H #H
+[ elim (drop_O1_lt (Ⓕ) … H) #Z1 #Y1 #X1 #HLY1
+ elim (drop_O1_lt (Ⓕ) L2 i) // #Z2 #Y2 #X2 #HLY2
+ elim (drop_O1_lt (Ⓕ) L i) // #Z #Y #X #HLY
+ lapply (drop_O1_inv_append1_le … HLK1 … HLY1) /2 width=1 by lt_to_le/ -HLK1 normalize #H destruct
+ lapply (drop_O1_inv_append1_le … HLK2 … HLY2) /2 width=1 by lt_to_le/ -HLK2 normalize #H destruct
+ lapply (drop_O1_inv_append1_le … HLK … HLY) /2 width=1 by lt_to_le/ -HLK normalize #H destruct
+ elim (IH … HLY1 HLY2 HLY) -IH -HLY1 -HLY2 -HLY *
+ [ /3 width=1 by and3_intro, or3_intro0/
+ | /7 width=2 by frees_inv_append, yle_inj, lt_to_le, or3_intro1, and3_intro/
+ | /6 width=1 by frees_append, yle_inj, lt_to_le, or3_intro2, and4_intro/
+ ]
+| -IH -HLK2 destruct
+ lapply (drop_O1_inv_append1_le … HLK1 … (⋆) ?) // -HLK1 normalize #H destruct
+ lapply (drop_O1_inv_append1_le … HLK … (⋆) ?) // -HLK normalize #H destruct
+ /4 width=1 by or3_intro1, and3_intro/
+]
+qed.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/multiple/frees_lift.ma".
+include "basic_2/multiple/llor_alt.ma".
+
+(* POINTWISE UNION FOR LOCAL ENVIRONMENTS ***********************************)
+
+(* Advanced properties ******************************************************)
+
+lemma llor_skip: ∀L1,L2,U,l. |L1| = |L2| → yinj (|L1|) ≤ l → L1 ⋓[U, l] L2 ≡ L1.
+#L1 #L2 #U #l #HL12 #Hl @and3_intro // -HL12
+#I1 #I2 #I #K1 #K2 #K #W1 #W2 #W #i #HLK1 #_ #HLK -L2 -K2
+lapply (drop_mono … HLK … HLK1) -HLK #H destruct
+lapply (drop_fwd_length_lt2 … HLK1) -K1
+/5 width=3 by ylt_yle_trans, ylt_inj, or3_intro0, and3_intro/
+qed.
+
+(* Note: lemma 1400 concludes the "big tree" theorem *)
+lemma llor_total: ∀L1,L2,T,l. |L1| = |L2| → ∃L. L1 ⋓[T, l] L2 ≡ L.
+#L1 @(lenv_ind_alt … L1) -L1
+[ #L2 #T #l #H >(length_inv_zero_sn … H) -L2 /2 width=2 by ex_intro/
+| #I1 #L1 #V1 #IHL1 #Y #T #l >ltail_length #H
+ elim (length_inv_pos_sn_ltail … H) -H #I2 #L2 #V2 #HL12 #H destruct
+ elim (ylt_split l (|ⓑ{I1}V1.L1|))
+ [ elim (frees_dec (ⓑ{I1}V1.L1) T l (|L1|)) #HnU
+ elim (IHL1 L2 T l) // -IHL1 -HL12
+ [ #L #HL12 >ltail_length /4 width=2 by llor_tail_frees, ylt_fwd_succ2, ex_intro/
+ | /4 width=2 by llor_tail_cofrees, ex_intro/
+ ]
+ | -IHL1 /4 width=3 by llor_skip, plus_to_minus, ex_intro/
+ ]
+]
+qed-.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/notation/relations/psubststar_6.ma".
-include "basic_2/substitution/cpy.ma".
-
-(* CONTEXT-SENSITIVE EXTENDED MULTIPLE SUBSTITUTION FOR TERMS ***************)
-
-definition cpys: ynat → ynat → relation4 genv lenv term term ≝
- λl,m,G. LTC … (cpy l m G).
-
-interpretation "context-sensitive extended multiple substritution (term)"
- 'PSubstStar G L T1 l m T2 = (cpys l m G L T1 T2).
-
-(* Basic eliminators ********************************************************)
-
-lemma cpys_ind: ∀G,L,T1,l,m. ∀R:predicate term. R T1 →
- (∀T,T2. ⦃G, L⦄ ⊢ T1 ▶*[l, m] T → ⦃G, L⦄ ⊢ T ▶[l, m] T2 → R T → R T2) →
- ∀T2. ⦃G, L⦄ ⊢ T1 ▶*[l, m] T2 → R T2.
-#G #L #T1 #l #m #R #HT1 #IHT1 #T2 #HT12
-@(TC_star_ind … HT1 IHT1 … HT12) //
-qed-.
-
-lemma cpys_ind_dx: ∀G,L,T2,l,m. ∀R:predicate term. R T2 →
- (∀T1,T. ⦃G, L⦄ ⊢ T1 ▶[l, m] T → ⦃G, L⦄ ⊢ T ▶*[l, m] T2 → R T → R T1) →
- ∀T1. ⦃G, L⦄ ⊢ T1 ▶*[l, m] T2 → R T1.
-#G #L #T2 #l #m #R #HT2 #IHT2 #T1 #HT12
-@(TC_star_ind_dx … HT2 IHT2 … HT12) //
-qed-.
-
-(* Basic properties *********************************************************)
-
-lemma cpy_cpys: ∀G,L,T1,T2,l,m. ⦃G, L⦄ ⊢ T1 ▶[l, m] T2 → ⦃G, L⦄ ⊢ T1 ▶*[l, m] T2.
-/2 width=1 by inj/ qed.
-
-lemma cpys_strap1: ∀G,L,T1,T,T2,l,m.
- ⦃G, L⦄ ⊢ T1 ▶*[l, m] T → ⦃G, L⦄ ⊢ T ▶[l, m] T2 → ⦃G, L⦄ ⊢ T1 ▶*[l, m] T2.
-normalize /2 width=3 by step/ qed-.
-
-lemma cpys_strap2: ∀G,L,T1,T,T2,l,m.
- ⦃G, L⦄ ⊢ T1 ▶[l, m] T → ⦃G, L⦄ ⊢ T ▶*[l, m] T2 → ⦃G, L⦄ ⊢ T1 ▶*[l, m] T2.
-normalize /2 width=3 by TC_strap/ qed-.
-
-lemma lsuby_cpys_trans: ∀G,l,m. lsub_trans … (cpys l m G) (lsuby l m).
-/3 width=5 by lsuby_cpy_trans, LTC_lsub_trans/
-qed-.
-
-lemma cpys_refl: ∀G,L,l,m. reflexive … (cpys l m G L).
-/2 width=1 by cpy_cpys/ qed.
-
-lemma cpys_bind: ∀G,L,V1,V2,l,m. ⦃G, L⦄ ⊢ V1 ▶*[l, m] V2 →
- ∀I,T1,T2. ⦃G, L.ⓑ{I}V1⦄ ⊢ T1 ▶*[⫯l, m] T2 →
- ∀a. ⦃G, L⦄ ⊢ ⓑ{a,I}V1.T1 ▶*[l, m] ⓑ{a,I}V2.T2.
-#G #L #V1 #V2 #l #m #HV12 @(cpys_ind … HV12) -V2
-[ #I #T1 #T2 #HT12 @(cpys_ind … HT12) -T2 /3 width=5 by cpys_strap1, cpy_bind/
-| /3 width=5 by cpys_strap1, cpy_bind/
-]
-qed.
-
-lemma cpys_flat: ∀G,L,V1,V2,l,m. ⦃G, L⦄ ⊢ V1 ▶*[l, m] V2 →
- ∀T1,T2. ⦃G, L⦄ ⊢ T1 ▶*[l, m] T2 →
- ∀I. ⦃G, L⦄ ⊢ ⓕ{I}V1.T1 ▶*[l, m] ⓕ{I}V2.T2.
-#G #L #V1 #V2 #l #m #HV12 @(cpys_ind … HV12) -V2
-[ #T1 #T2 #HT12 @(cpys_ind … HT12) -T2 /3 width=5 by cpys_strap1, cpy_flat/
-| /3 width=5 by cpys_strap1, cpy_flat/
-qed.
-
-lemma cpys_weak: ∀G,L,T1,T2,l1,m1. ⦃G, L⦄ ⊢ T1 ▶*[l1, m1] T2 →
- ∀l2,m2. l2 ≤ l1 → l1 + m1 ≤ l2 + m2 →
- ⦃G, L⦄ ⊢ T1 ▶*[l2, m2] T2.
-#G #L #T1 #T2 #l1 #m1 #H #l1 #l2 #Hl21 #Hlm12 @(cpys_ind … H) -T2
-/3 width=7 by cpys_strap1, cpy_weak/
-qed-.
-
-lemma cpys_weak_top: ∀G,L,T1,T2,l,m.
- ⦃G, L⦄ ⊢ T1 ▶*[l, m] T2 → ⦃G, L⦄ ⊢ T1 ▶*[l, |L| - l] T2.
-#G #L #T1 #T2 #l #m #H @(cpys_ind … H) -T2
-/3 width=4 by cpys_strap1, cpy_weak_top/
-qed-.
-
-lemma cpys_weak_full: ∀G,L,T1,T2,l,m.
- ⦃G, L⦄ ⊢ T1 ▶*[l, m] T2 → ⦃G, L⦄ ⊢ T1 ▶*[0, |L|] T2.
-#G #L #T1 #T2 #l #m #H @(cpys_ind … H) -T2
-/3 width=5 by cpys_strap1, cpy_weak_full/
-qed-.
-
-(* Basic forward lemmas *****************************************************)
-
-lemma cpys_fwd_up: ∀G,L,U1,U2,lt,mt. ⦃G, L⦄ ⊢ U1 ▶*[lt, mt] U2 →
- ∀T1,l,m. ⬆[l, m] T1 ≡ U1 →
- l ≤ lt → l + m ≤ lt + mt →
- ∃∃T2. ⦃G, L⦄ ⊢ U1 ▶*[l+m, lt+mt-(l+m)] U2 & ⬆[l, m] T2 ≡ U2.
-#G #L #U1 #U2 #lt #mt #H #T1 #l #m #HTU1 #Hllt #Hlmlmt @(cpys_ind … H) -U2
-[ /2 width=3 by ex2_intro/
-| -HTU1 #U #U2 #_ #HU2 * #T #HU1 #HTU
- elim (cpy_fwd_up … HU2 … HTU) -HU2 -HTU /3 width=3 by cpys_strap1, ex2_intro/
-]
-qed-.
-
-lemma cpys_fwd_tw: ∀G,L,T1,T2,l,m. ⦃G, L⦄ ⊢ T1 ▶*[l, m] T2 → ♯{T1} ≤ ♯{T2}.
-#G #L #T1 #T2 #l #m #H @(cpys_ind … H) -T2 //
-#T #T2 #_ #HT2 #IHT1 lapply (cpy_fwd_tw … HT2) -HT2
-/2 width=3 by transitive_le/
-qed-.
-
-(* Basic inversion lemmas ***************************************************)
-
-(* Note: this can be derived from cpys_inv_atom1 *)
-lemma cpys_inv_sort1: ∀G,L,T2,k,l,m. ⦃G, L⦄ ⊢ ⋆k ▶*[l, m] T2 → T2 = ⋆k.
-#G #L #T2 #k #l #m #H @(cpys_ind … H) -T2 //
-#T #T2 #_ #HT2 #IHT1 destruct
->(cpy_inv_sort1 … HT2) -HT2 //
-qed-.
-
-(* Note: this can be derived from cpys_inv_atom1 *)
-lemma cpys_inv_gref1: ∀G,L,T2,p,l,m. ⦃G, L⦄ ⊢ §p ▶*[l, m] T2 → T2 = §p.
-#G #L #T2 #p #l #m #H @(cpys_ind … H) -T2 //
-#T #T2 #_ #HT2 #IHT1 destruct
->(cpy_inv_gref1 … HT2) -HT2 //
-qed-.
-
-lemma cpys_inv_bind1: ∀a,I,G,L,V1,T1,U2,l,m. ⦃G, L⦄ ⊢ ⓑ{a,I}V1.T1 ▶*[l, m] U2 →
- ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ▶*[l, m] V2 &
- ⦃G, L.ⓑ{I}V1⦄ ⊢ T1 ▶*[⫯l, m] T2 &
- U2 = ⓑ{a,I}V2.T2.
-#a #I #G #L #V1 #T1 #U2 #l #m #H @(cpys_ind … H) -U2
-[ /2 width=5 by ex3_2_intro/
-| #U #U2 #_ #HU2 * #V #T #HV1 #HT1 #H destruct
- elim (cpy_inv_bind1 … HU2) -HU2 #V2 #T2 #HV2 #HT2 #H
- lapply (lsuby_cpy_trans … HT2 (L.ⓑ{I}V1) ?) -HT2
- /3 width=5 by cpys_strap1, lsuby_succ, ex3_2_intro/
-]
-qed-.
-
-lemma cpys_inv_flat1: ∀I,G,L,V1,T1,U2,l,m. ⦃G, L⦄ ⊢ ⓕ{I}V1.T1 ▶*[l, m] U2 →
- ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ▶*[l, m] V2 & ⦃G, L⦄ ⊢ T1 ▶*[l, m] T2 &
- U2 = ⓕ{I}V2.T2.
-#I #G #L #V1 #T1 #U2 #l #m #H @(cpys_ind … H) -U2
-[ /2 width=5 by ex3_2_intro/
-| #U #U2 #_ #HU2 * #V #T #HV1 #HT1 #H destruct
- elim (cpy_inv_flat1 … HU2) -HU2
- /3 width=5 by cpys_strap1, ex3_2_intro/
-]
-qed-.
-
-lemma cpys_inv_refl_O2: ∀G,L,T1,T2,l. ⦃G, L⦄ ⊢ T1 ▶*[l, 0] T2 → T1 = T2.
-#G #L #T1 #T2 #l #H @(cpys_ind … H) -T2 //
-#T #T2 #_ #HT2 #IHT1 <(cpy_inv_refl_O2 … HT2) -HT2 //
-qed-.
-
-lemma cpys_inv_lift1_eq: ∀G,L,U1,U2,l,m.
- ⦃G, L⦄ ⊢ U1 ▶*[l, yinj m] U2 → ∀T1. ⬆[l, m] T1 ≡ U1 → U1 = U2.
-#G #L #U1 #U2 #l #m #H #T1 #HTU1 @(cpys_ind … H) -U2
-/2 width=7 by cpy_inv_lift1_eq/
-qed-.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/notation/relations/psubststaralt_6.ma".
-include "basic_2/multiple/cpys_lift.ma".
-
-(* CONTEXT-SENSITIVE EXTENDED MULTIPLE SUBSTITUTION FOR TERMS ***************)
-
-(* alternative definition of cpys *)
-inductive cpysa: ynat → ynat → relation4 genv lenv term term ≝
-| cpysa_atom : ∀I,G,L,l,m. cpysa l m G L (⓪{I}) (⓪{I})
-| cpysa_subst: ∀I,G,L,K,V1,V2,W2,i,l,m. l ≤ yinj i → i < l+m →
- ⬇[i] L ≡ K.ⓑ{I}V1 → cpysa 0 (⫰(l+m-i)) G K V1 V2 →
- ⬆[0, i+1] V2 ≡ W2 → cpysa l m G L (#i) W2
-| cpysa_bind : ∀a,I,G,L,V1,V2,T1,T2,l,m.
- cpysa l m G L V1 V2 → cpysa (⫯l) m G (L.ⓑ{I}V1) T1 T2 →
- cpysa l m G L (ⓑ{a,I}V1.T1) (ⓑ{a,I}V2.T2)
-| cpysa_flat : ∀I,G,L,V1,V2,T1,T2,l,m.
- cpysa l m G L V1 V2 → cpysa l m G L T1 T2 →
- cpysa l m G L (ⓕ{I}V1.T1) (ⓕ{I}V2.T2)
-.
-
-interpretation
- "context-sensitive extended multiple substritution (term) alternative"
- 'PSubstStarAlt G L T1 l m T2 = (cpysa l m G L T1 T2).
-
-(* Basic properties *********************************************************)
-
-lemma lsuby_cpysa_trans: ∀G,l,m. lsub_trans … (cpysa l m G) (lsuby l m).
-#G #l #m #L1 #T1 #T2 #H elim H -G -L1 -T1 -T2 -l -m
-[ //
-| #I #G #L1 #K1 #V1 #V2 #W2 #i #l #m #Hli #Hilm #HLK1 #_ #HVW2 #IHV12 #L2 #HL12
- elim (lsuby_drop_trans_be … HL12 … HLK1) -HL12 -HLK1 /3 width=7 by cpysa_subst/
-| /4 width=1 by lsuby_succ, cpysa_bind/
-| /3 width=1 by cpysa_flat/
-]
-qed-.
-
-lemma cpysa_refl: ∀G,T,L,l,m. ⦃G, L⦄ ⊢ T ▶▶*[l, m] T.
-#G #T elim T -T //
-#I elim I -I /2 width=1 by cpysa_bind, cpysa_flat/
-qed.
-
-lemma cpysa_cpy_trans: ∀G,L,T1,T,l,m. ⦃G, L⦄ ⊢ T1 ▶▶*[l, m] T →
- ∀T2. ⦃G, L⦄ ⊢ T ▶[l, m] T2 → ⦃G, L⦄ ⊢ T1 ▶▶*[l, m] T2.
-#G #L #T1 #T #l #m #H elim H -G -L -T1 -T -l -m
-[ #I #G #L #l #m #X #H
- elim (cpy_inv_atom1 … H) -H // * /2 width=7 by cpysa_subst/
-| #I #G #L #K #V1 #V2 #W2 #i #l #m #Hli #Hilm #HLK #_ #HVW2 #IHV12 #T2 #H
- lapply (drop_fwd_drop2 … HLK) #H0LK
- lapply (cpy_weak … H 0 (l+m) ? ?) -H // #H
- elim (cpy_inv_lift1_be … H … H0LK … HVW2) -H -H0LK -HVW2
- /3 width=7 by cpysa_subst, ylt_fwd_le_succ1/
-| #a #I #G #L #V1 #V #T1 #T #l #m #_ #_ #IHV1 #IHT1 #X #H
- elim (cpy_inv_bind1 … H) -H #V2 #T2 #HV2 #HT2 #H destruct
- /5 width=5 by cpysa_bind, lsuby_cpy_trans, lsuby_succ/
-| #I #G #L #V1 #V #T1 #T #l #m #_ #_ #IHV1 #IHT1 #X #H
- elim (cpy_inv_flat1 … H) -H #V2 #T2 #HV2 #HT2 #H destruct /3 width=1 by cpysa_flat/
-]
-qed-.
-
-lemma cpys_cpysa: ∀G,L,T1,T2,l,m. ⦃G, L⦄ ⊢ T1 ▶*[l, m] T2 → ⦃G, L⦄ ⊢ T1 ▶▶*[l, m] T2.
-/3 width=8 by cpysa_cpy_trans, cpys_ind/ qed.
-
-(* Basic inversion lemmas ***************************************************)
-
-lemma cpysa_inv_cpys: ∀G,L,T1,T2,l,m. ⦃G, L⦄ ⊢ T1 ▶▶*[l, m] T2 → ⦃G, L⦄ ⊢ T1 ▶*[l, m] T2.
-#G #L #T1 #T2 #l #m #H elim H -G -L -T1 -T2 -l -m
-/2 width=7 by cpys_subst, cpys_flat, cpys_bind, cpy_cpys/
-qed-.
-
-(* Advanced eliminators *****************************************************)
-
-lemma cpys_ind_alt: ∀R:ynat→ynat→relation4 genv lenv term term.
- (∀I,G,L,l,m. R l m G L (⓪{I}) (⓪{I})) →
- (∀I,G,L,K,V1,V2,W2,i,l,m. l ≤ yinj i → i < l + m →
- ⬇[i] L ≡ K.ⓑ{I}V1 → ⦃G, K⦄ ⊢ V1 ▶*[O, ⫰(l+m-i)] V2 →
- ⬆[O, i+1] V2 ≡ W2 → R O (⫰(l+m-i)) G K V1 V2 → R l m G L (#i) W2
- ) →
- (∀a,I,G,L,V1,V2,T1,T2,l,m. ⦃G, L⦄ ⊢ V1 ▶*[l, m] V2 →
- ⦃G, L.ⓑ{I}V1⦄ ⊢ T1 ▶*[⫯l, m] T2 → R l m G L V1 V2 →
- R (⫯l) m G (L.ⓑ{I}V1) T1 T2 → R l m G L (ⓑ{a,I}V1.T1) (ⓑ{a,I}V2.T2)
- ) →
- (∀I,G,L,V1,V2,T1,T2,l,m. ⦃G, L⦄ ⊢ V1 ▶*[l, m] V2 →
- ⦃G, L⦄ ⊢ T1 ▶*[l, m] T2 → R l m G L V1 V2 →
- R l m G L T1 T2 → R l m G L (ⓕ{I}V1.T1) (ⓕ{I}V2.T2)
- ) →
- ∀l,m,G,L,T1,T2. ⦃G, L⦄ ⊢ T1 ▶*[l, m] T2 → R l m G L T1 T2.
-#R #H1 #H2 #H3 #H4 #l #m #G #L #T1 #T2 #H elim (cpys_cpysa … H) -G -L -T1 -T2 -l -m
-/3 width=8 by cpysa_inv_cpys/
-qed-.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/substitution/cpy_cpy.ma".
-include "basic_2/multiple/cpys_alt.ma".
-
-(* CONTEXT-SENSITIVE EXTENDED MULTIPLE SUBSTITUTION FOR TERMS ***************)
-
-(* Advanced inversion lemmas ************************************************)
-
-lemma cpys_inv_SO2: ∀G,L,T1,T2,l. ⦃G, L⦄ ⊢ T1 ▶*[l, 1] T2 → ⦃G, L⦄ ⊢ T1 ▶[l, 1] T2.
-#G #L #T1 #T2 #l #H @(cpys_ind … H) -T2 /2 width=3 by cpy_trans_ge/
-qed-.
-
-(* Advanced properties ******************************************************)
-
-lemma cpys_strip_eq: ∀G,L,T0,T1,l1,m1. ⦃G, L⦄ ⊢ T0 ▶*[l1, m1] T1 →
- ∀T2,l2,m2. ⦃G, L⦄ ⊢ T0 ▶[l2, m2] T2 →
- ∃∃T. ⦃G, L⦄ ⊢ T1 ▶[l2, m2] T & ⦃G, L⦄ ⊢ T2 ▶*[l1, m1] T.
-normalize /3 width=3 by cpy_conf_eq, TC_strip1/ qed-.
-
-lemma cpys_strip_neq: ∀G,L1,T0,T1,l1,m1. ⦃G, L1⦄ ⊢ T0 ▶*[l1, m1] T1 →
- ∀L2,T2,l2,m2. ⦃G, L2⦄ ⊢ T0 ▶[l2, m2] T2 →
- (l1 + m1 ≤ l2 ∨ l2 + m2 ≤ l1) →
- ∃∃T. ⦃G, L2⦄ ⊢ T1 ▶[l2, m2] T & ⦃G, L1⦄ ⊢ T2 ▶*[l1, m1] T.
-normalize /3 width=3 by cpy_conf_neq, TC_strip1/ qed-.
-
-lemma cpys_strap1_down: ∀G,L,T1,T0,l1,m1. ⦃G, L⦄ ⊢ T1 ▶*[l1, m1] T0 →
- ∀T2,l2,m2. ⦃G, L⦄ ⊢ T0 ▶[l2, m2] T2 → l2 + m2 ≤ l1 →
- ∃∃T. ⦃G, L⦄ ⊢ T1 ▶[l2, m2] T & ⦃G, L⦄ ⊢ T ▶*[l1, m1] T2.
-normalize /3 width=3 by cpy_trans_down, TC_strap1/ qed.
-
-lemma cpys_strap2_down: ∀G,L,T1,T0,l1,m1. ⦃G, L⦄ ⊢ T1 ▶[l1, m1] T0 →
- ∀T2,l2,m2. ⦃G, L⦄ ⊢ T0 ▶*[l2, m2] T2 → l2 + m2 ≤ l1 →
- ∃∃T. ⦃G, L⦄ ⊢ T1 ▶*[l2, m2] T & ⦃G, L⦄ ⊢ T ▶[l1, m1] T2.
-normalize /3 width=3 by cpy_trans_down, TC_strap2/ qed-.
-
-lemma cpys_split_up: ∀G,L,T1,T2,l,m. ⦃G, L⦄ ⊢ T1 ▶*[l, m] T2 →
- ∀i. l ≤ i → i ≤ l + m →
- ∃∃T. ⦃G, L⦄ ⊢ T1 ▶*[l, i - l] T & ⦃G, L⦄ ⊢ T ▶*[i, l + m - i] T2.
-#G #L #T1 #T2 #l #m #H #i #Hli #Hilm @(cpys_ind … H) -T2
-[ /2 width=3 by ex2_intro/
-| #T #T2 #_ #HT12 * #T3 #HT13 #HT3
- elim (cpy_split_up … HT12 … Hilm) -HT12 -Hilm #T0 #HT0 #HT02
- elim (cpys_strap1_down … HT3 … HT0) -T /3 width=5 by cpys_strap1, ex2_intro/
- >ymax_pre_sn_comm //
-]
-qed-.
-
-lemma cpys_inv_lift1_up: ∀G,L,U1,U2,lt,mt. ⦃G, L⦄ ⊢ U1 ▶*[lt, mt] U2 →
- ∀K,s,l,m. ⬇[s, l, m] L ≡ K → ∀T1. ⬆[l, m] T1 ≡ U1 →
- l ≤ lt → lt ≤ l + m → l + m ≤ lt + mt →
- ∃∃T2. ⦃G, K⦄ ⊢ T1 ▶*[l, lt + mt - (l + m)] T2 &
- ⬆[l, m] T2 ≡ U2.
-#G #L #U1 #U2 #lt #mt #HU12 #K #s #l #m #HLK #T1 #HTU1 #Hllt #Hltlm #Hlmlmt
-elim (cpys_split_up … HU12 (l + m)) -HU12 // -Hlmlmt #U #HU1 #HU2
-lapply (cpys_weak … HU1 l m ? ?) -HU1 // [ >ymax_pre_sn_comm // ] -Hllt -Hltlm #HU1
-lapply (cpys_inv_lift1_eq … HU1 … HTU1) -HU1 #HU1 destruct
-elim (cpys_inv_lift1_ge … HU2 … HLK … HTU1) -HU2 -HLK -HTU1 //
->yplus_minus_inj /2 width=3 by ex2_intro/
-qed-.
-
-(* Main properties **********************************************************)
-
-theorem cpys_conf_eq: ∀G,L,T0,T1,l1,m1. ⦃G, L⦄ ⊢ T0 ▶*[l1, m1] T1 →
- ∀T2,l2,m2. ⦃G, L⦄ ⊢ T0 ▶*[l2, m2] T2 →
- ∃∃T. ⦃G, L⦄ ⊢ T1 ▶*[l2, m2] T & ⦃G, L⦄ ⊢ T2 ▶*[l1, m1] T.
-normalize /3 width=3 by cpy_conf_eq, TC_confluent2/ qed-.
-
-theorem cpys_conf_neq: ∀G,L1,T0,T1,l1,m1. ⦃G, L1⦄ ⊢ T0 ▶*[l1, m1] T1 →
- ∀L2,T2,l2,m2. ⦃G, L2⦄ ⊢ T0 ▶*[l2, m2] T2 →
- (l1 + m1 ≤ l2 ∨ l2 + m2 ≤ l1) →
- ∃∃T. ⦃G, L2⦄ ⊢ T1 ▶*[l2, m2] T & ⦃G, L1⦄ ⊢ T2 ▶*[l1, m1] T.
-normalize /3 width=3 by cpy_conf_neq, TC_confluent2/ qed-.
-
-theorem cpys_trans_eq: ∀G,L,T1,T,T2,l,m.
- ⦃G, L⦄ ⊢ T1 ▶*[l, m] T → ⦃G, L⦄ ⊢ T ▶*[l, m] T2 →
- ⦃G, L⦄ ⊢ T1 ▶*[l, m] T2.
-normalize /2 width=3 by trans_TC/ qed-.
-
-theorem cpys_trans_down: ∀G,L,T1,T0,l1,m1. ⦃G, L⦄ ⊢ T1 ▶*[l1, m1] T0 →
- ∀T2,l2,m2. ⦃G, L⦄ ⊢ T0 ▶*[l2, m2] T2 → l2 + m2 ≤ l1 →
- ∃∃T. ⦃G, L⦄ ⊢ T1 ▶*[l2, m2] T & ⦃G, L⦄ ⊢ T ▶*[l1, m1] T2.
-normalize /3 width=3 by cpy_trans_down, TC_transitive2/ qed-.
-
-theorem cpys_antisym_eq: ∀G,L1,T1,T2,l,m. ⦃G, L1⦄ ⊢ T1 ▶*[l, m] T2 →
- ∀L2. ⦃G, L2⦄ ⊢ T2 ▶*[l, m] T1 → T1 = T2.
-#G #L1 #T1 #T2 #l #m #H @(cpys_ind_alt … H) -G -L1 -T1 -T2 //
-[ #I1 #G #L1 #K1 #V1 #V2 #W2 #i #l #m #Hli #Hilm #_ #_ #HVW2 #_ #L2 #HW2
- elim (lt_or_ge (|L2|) (i+1)) #Hi [ -Hli -Hilm | ]
- [ lapply (cpys_weak_full … HW2) -HW2 #HW2
- lapply (cpys_weak … HW2 0 (i+1) ? ?) -HW2 //
- [ >yplus_O1 >yplus_O1 /3 width=1 by ylt_fwd_le, ylt_inj/ ] -Hi
- #HW2 >(cpys_inv_lift1_eq … HW2) -HW2 //
- | elim (drop_O1_le (Ⓕ) … Hi) -Hi #K2 #HLK2
- elim (cpys_inv_lift1_ge_up … HW2 … HLK2 … HVW2 ? ? ?) -HW2 -HLK2 -HVW2
- /2 width=1 by ylt_fwd_le_succ1, yle_succ_dx/ -Hli -Hilm
- #X #_ #H elim (lift_inv_lref2_be … H) -H /2 width=1 by ylt_inj/
- ]
-| #a #I #G #L1 #V1 #V2 #T1 #T2 #l #m #_ #_ #IHV12 #IHT12 #L2 #H elim (cpys_inv_bind1 … H) -H
- #V #T #HV2 #HT2 #H destruct
- lapply (IHV12 … HV2) #H destruct -IHV12 -HV2 /3 width=2 by eq_f2/
-| #I #G #L1 #V1 #V2 #T1 #T2 #l #m #_ #_ #IHV12 #IHT12 #L2 #H elim (cpys_inv_flat1 … H) -H
- #V #T #HV2 #HT2 #H destruct /3 width=2 by eq_f2/
-]
-qed-.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/substitution/cpy_lift.ma".
-include "basic_2/multiple/cpys.ma".
-
-(* CONTEXT-SENSITIVE EXTENDED MULTIPLE SUBSTITUTION FOR TERMS ***************)
-
-(* Advanced properties ******************************************************)
-
-lemma cpys_subst: ∀I,G,L,K,V,U1,i,l,m.
- l ≤ yinj i → i < l + m →
- ⬇[i] L ≡ K.ⓑ{I}V → ⦃G, K⦄ ⊢ V ▶*[0, ⫰(l+m-i)] U1 →
- ∀U2. ⬆[0, i+1] U1 ≡ U2 → ⦃G, L⦄ ⊢ #i ▶*[l, m] U2.
-#I #G #L #K #V #U1 #i #l #m #Hli #Hilm #HLK #H @(cpys_ind … H) -U1
-[ /3 width=5 by cpy_cpys, cpy_subst/
-| #U #U1 #_ #HU1 #IHU #U2 #HU12
- elim (lift_total U 0 (i+1)) #U0 #HU0
- lapply (IHU … HU0) -IHU #H
- lapply (drop_fwd_drop2 … HLK) -HLK #HLK
- lapply (cpy_lift_ge … HU1 … HLK HU0 HU12 ?) -HU1 -HLK -HU0 -HU12 // #HU02
- lapply (cpy_weak … HU02 l m ? ?) -HU02
- [2,3: /2 width=3 by cpys_strap1, yle_succ_dx/ ]
- >yplus_O1 <yplus_inj >ymax_pre_sn_comm /2 width=1 by ylt_fwd_le_succ1/
-]
-qed.
-
-lemma cpys_subst_Y2: ∀I,G,L,K,V,U1,i,l.
- l ≤ yinj i →
- ⬇[i] L ≡ K.ⓑ{I}V → ⦃G, K⦄ ⊢ V ▶*[0, ∞] U1 →
- ∀U2. ⬆[0, i+1] U1 ≡ U2 → ⦃G, L⦄ ⊢ #i ▶*[l, ∞] U2.
-#I #G #L #K #V #U1 #i #l #Hli #HLK #HVU1 #U2 #HU12
-@(cpys_subst … HLK … HU12) >yminus_Y_inj //
-qed.
-
-(* Advanced inversion lemmas *************************************************)
-
-lemma cpys_inv_atom1: ∀I,G,L,T2,l,m. ⦃G, L⦄ ⊢ ⓪{I} ▶*[l, m] T2 →
- T2 = ⓪{I} ∨
- ∃∃J,K,V1,V2,i. l ≤ yinj i & i < l + m &
- ⬇[i] L ≡ K.ⓑ{J}V1 &
- ⦃G, K⦄ ⊢ V1 ▶*[0, ⫰(l+m-i)] V2 &
- ⬆[O, i+1] V2 ≡ T2 &
- I = LRef i.
-#I #G #L #T2 #l #m #H @(cpys_ind … H) -T2
-[ /2 width=1 by or_introl/
-| #T #T2 #_ #HT2 *
- [ #H destruct
- elim (cpy_inv_atom1 … HT2) -HT2 [ /2 width=1 by or_introl/ | * /3 width=11 by ex6_5_intro, or_intror/ ]
- | * #J #K #V1 #V #i #Hli #Hilm #HLK #HV1 #HVT #HI
- lapply (drop_fwd_drop2 … HLK) #H
- elim (cpy_inv_lift1_ge_up … HT2 … H … HVT) -HT2 -H -HVT
- [2,3,4: /2 width=1 by ylt_fwd_le_succ1, yle_succ_dx/ ]
- /4 width=11 by cpys_strap1, ex6_5_intro, or_intror/
- ]
-]
-qed-.
-
-lemma cpys_inv_lref1: ∀G,L,T2,i,l,m. ⦃G, L⦄ ⊢ #i ▶*[l, m] T2 →
- T2 = #i ∨
- ∃∃I,K,V1,V2. l ≤ i & i < l + m &
- ⬇[i] L ≡ K.ⓑ{I}V1 &
- ⦃G, K⦄ ⊢ V1 ▶*[0, ⫰(l+m-i)] V2 &
- ⬆[O, i+1] V2 ≡ T2.
-#G #L #T2 #i #l #m #H elim (cpys_inv_atom1 … H) -H /2 width=1 by or_introl/
-* #I #K #V1 #V2 #j #Hlj #Hjlm #HLK #HV12 #HVT2 #H destruct /3 width=7 by ex5_4_intro, or_intror/
-qed-.
-
-lemma cpys_inv_lref1_Y2: ∀G,L,T2,i,l. ⦃G, L⦄ ⊢ #i ▶*[l, ∞] T2 →
- T2 = #i ∨
- ∃∃I,K,V1,V2. l ≤ i & ⬇[i] L ≡ K.ⓑ{I}V1 &
- ⦃G, K⦄ ⊢ V1 ▶*[0, ∞] V2 & ⬆[O, i+1] V2 ≡ T2.
-#G #L #T2 #i #l #H elim (cpys_inv_lref1 … H) -H /2 width=1 by or_introl/
-* >yminus_Y_inj /3 width=7 by or_intror, ex4_4_intro/
-qed-.
-
-lemma cpys_inv_lref1_drop: ∀G,L,T2,i,l,m. ⦃G, L⦄ ⊢ #i ▶*[l, m] T2 →
- ∀I,K,V1. ⬇[i] L ≡ K.ⓑ{I}V1 →
- ∀V2. ⬆[O, i+1] V2 ≡ T2 →
- ∧∧ ⦃G, K⦄ ⊢ V1 ▶*[0, ⫰(l+m-i)] V2
- & l ≤ i
- & i < l + m.
-#G #L #T2 #i #l #m #H #I #K #V1 #HLK #V2 #HVT2 elim (cpys_inv_lref1 … H) -H
-[ #H destruct elim (lift_inv_lref2_be … HVT2) -HVT2 -HLK /2 width=1 by ylt_inj/
-| * #Z #Y #X1 #X2 #Hli #Hilm #HLY #HX12 #HXT2
- lapply (lift_inj … HXT2 … HVT2) -T2 #H destruct
- lapply (drop_mono … HLY … HLK) -L #H destruct
- /2 width=1 by and3_intro/
-]
-qed-.
-
-(* Properties on relocation *************************************************)
-
-lemma cpys_lift_le: ∀G,K,T1,T2,lt,mt. ⦃G, K⦄ ⊢ T1 ▶*[lt, mt] T2 →
- ∀L,U1,s,l,m. lt + mt ≤ l → ⬇[s, l, m] L ≡ K →
- ⬆[l, m] T1 ≡ U1 → ∀U2. ⬆[l, m] T2 ≡ U2 →
- ⦃G, L⦄ ⊢ U1 ▶*[lt, mt] U2.
-#G #K #T1 #T2 #lt #mt #H #L #U1 #s #l #m #Hlmtl #HLK #HTU1 @(cpys_ind … H) -T2
-[ #U2 #H >(lift_mono … HTU1 … H) -H //
-| -HTU1 #T #T2 #_ #HT2 #IHT #U2 #HTU2
- elim (lift_total T l m) #U #HTU
- lapply (IHT … HTU) -IHT #HU1
- lapply (cpy_lift_le … HT2 … HLK HTU HTU2 ?) -HT2 -HLK -HTU -HTU2 /2 width=3 by cpys_strap1/
-]
-qed-.
-
-lemma cpys_lift_be: ∀G,K,T1,T2,lt,mt. ⦃G, K⦄ ⊢ T1 ▶*[lt, mt] T2 →
- ∀L,U1,s,l,m. lt ≤ l → l ≤ lt + mt →
- ⬇[s, l, m] L ≡ K → ⬆[l, m] T1 ≡ U1 →
- ∀U2. ⬆[l, m] T2 ≡ U2 → ⦃G, L⦄ ⊢ U1 ▶*[lt, mt + m] U2.
-#G #K #T1 #T2 #lt #mt #H #L #U1 #s #l #m #Hltl #Hllmt #HLK #HTU1 @(cpys_ind … H) -T2
-[ #U2 #H >(lift_mono … HTU1 … H) -H //
-| -HTU1 #T #T2 #_ #HT2 #IHT #U2 #HTU2
- elim (lift_total T l m) #U #HTU
- lapply (IHT … HTU) -IHT #HU1
- lapply (cpy_lift_be … HT2 … HLK HTU HTU2 ? ?) -HT2 -HLK -HTU -HTU2 /2 width=3 by cpys_strap1/
-]
-qed-.
-
-lemma cpys_lift_ge: ∀G,K,T1,T2,lt,mt. ⦃G, K⦄ ⊢ T1 ▶*[lt, mt] T2 →
- ∀L,U1,s,l,m. l ≤ lt → ⬇[s, l, m] L ≡ K →
- ⬆[l, m] T1 ≡ U1 → ∀U2. ⬆[l, m] T2 ≡ U2 →
- ⦃G, L⦄ ⊢ U1 ▶*[lt+m, mt] U2.
-#G #K #T1 #T2 #lt #mt #H #L #U1 #s #l #m #Hllt #HLK #HTU1 @(cpys_ind … H) -T2
-[ #U2 #H >(lift_mono … HTU1 … H) -H //
-| -HTU1 #T #T2 #_ #HT2 #IHT #U2 #HTU2
- elim (lift_total T l m) #U #HTU
- lapply (IHT … HTU) -IHT #HU1
- lapply (cpy_lift_ge … HT2 … HLK HTU HTU2 ?) -HT2 -HLK -HTU -HTU2 /2 width=3 by cpys_strap1/
-]
-qed-.
-
-(* Inversion lemmas for relocation ******************************************)
-
-lemma cpys_inv_lift1_le: ∀G,L,U1,U2,lt,mt. ⦃G, L⦄ ⊢ U1 ▶*[lt, mt] U2 →
- ∀K,s,l,m. ⬇[s, l, m] L ≡ K → ∀T1. ⬆[l, m] T1 ≡ U1 →
- lt + mt ≤ l →
- ∃∃T2. ⦃G, K⦄ ⊢ T1 ▶*[lt, mt] T2 & ⬆[l, m] T2 ≡ U2.
-#G #L #U1 #U2 #lt #mt #H #K #s #l #m #HLK #T1 #HTU1 #Hlmtl @(cpys_ind … H) -U2
-[ /2 width=3 by ex2_intro/
-| -HTU1 #U #U2 #_ #HU2 * #T #HT1 #HTU
- elim (cpy_inv_lift1_le … HU2 … HLK … HTU) -HU2 -HLK -HTU /3 width=3 by cpys_strap1, ex2_intro/
-]
-qed-.
-
-lemma cpys_inv_lift1_be: ∀G,L,U1,U2,lt,mt. ⦃G, L⦄ ⊢ U1 ▶*[lt, mt] U2 →
- ∀K,s,l,m. ⬇[s, l, m] L ≡ K → ∀T1. ⬆[l, m] T1 ≡ U1 →
- lt ≤ l → l + m ≤ lt + mt →
- ∃∃T2. ⦃G, K⦄ ⊢ T1 ▶*[lt, mt - m] T2 & ⬆[l, m] T2 ≡ U2.
-#G #L #U1 #U2 #lt #mt #H #K #s #l #m #HLK #T1 #HTU1 #Hltl #Hlmlmt @(cpys_ind … H) -U2
-[ /2 width=3 by ex2_intro/
-| -HTU1 #U #U2 #_ #HU2 * #T #HT1 #HTU
- elim (cpy_inv_lift1_be … HU2 … HLK … HTU) -HU2 -HLK -HTU /3 width=3 by cpys_strap1, ex2_intro/
-]
-qed-.
-
-lemma cpys_inv_lift1_ge: ∀G,L,U1,U2,lt,mt. ⦃G, L⦄ ⊢ U1 ▶*[lt, mt] U2 →
- ∀K,s,l,m. ⬇[s, l, m] L ≡ K → ∀T1. ⬆[l, m] T1 ≡ U1 →
- l + m ≤ lt →
- ∃∃T2. ⦃G, K⦄ ⊢ T1 ▶*[lt - m, mt] T2 & ⬆[l, m] T2 ≡ U2.
-#G #L #U1 #U2 #lt #mt #H #K #s #l #m #HLK #T1 #HTU1 #Hlmlt @(cpys_ind … H) -U2
-[ /2 width=3 by ex2_intro/
-| -HTU1 #U #U2 #_ #HU2 * #T #HT1 #HTU
- elim (cpy_inv_lift1_ge … HU2 … HLK … HTU) -HU2 -HLK -HTU /3 width=3 by cpys_strap1, ex2_intro/
-]
-qed-.
-
-(* Advanced inversion lemmas on relocation **********************************)
-
-lemma cpys_inv_lift1_ge_up: ∀G,L,U1,U2,lt,mt. ⦃G, L⦄ ⊢ U1 ▶*[lt, mt] U2 →
- ∀K,s,l,m. ⬇[s, l, m] L ≡ K → ∀T1. ⬆[l, m] T1 ≡ U1 →
- l ≤ lt → lt ≤ l + m → l + m ≤ lt + mt →
- ∃∃T2. ⦃G, K⦄ ⊢ T1 ▶*[l, lt + mt - (l + m)] T2 &
- ⬆[l, m] T2 ≡ U2.
-#G #L #U1 #U2 #lt #mt #H #K #s #l #m #HLK #T1 #HTU1 #Hllt #Hltlm #Hlmlmt @(cpys_ind … H) -U2
-[ /2 width=3 by ex2_intro/
-| -HTU1 #U #U2 #_ #HU2 * #T #HT1 #HTU
- elim (cpy_inv_lift1_ge_up … HU2 … HLK … HTU) -HU2 -HLK -HTU /3 width=3 by cpys_strap1, ex2_intro/
-]
-qed-.
-
-lemma cpys_inv_lift1_be_up: ∀G,L,U1,U2,lt,mt. ⦃G, L⦄ ⊢ U1 ▶*[lt, mt] U2 →
- ∀K,s,l,m. ⬇[s, l, m] L ≡ K → ∀T1. ⬆[l, m] T1 ≡ U1 →
- lt ≤ l → lt + mt ≤ l + m →
- ∃∃T2. ⦃G, K⦄ ⊢ T1 ▶*[lt, l - lt] T2 & ⬆[l, m] T2 ≡ U2.
-#G #L #U1 #U2 #lt #mt #H #K #s #l #m #HLK #T1 #HTU1 #Hltl #Hlmtlm @(cpys_ind … H) -U2
-[ /2 width=3 by ex2_intro/
-| -HTU1 #U #U2 #_ #HU2 * #T #HT1 #HTU
- elim (cpy_inv_lift1_be_up … HU2 … HLK … HTU) -HU2 -HLK -HTU /3 width=3 by cpys_strap1, ex2_intro/
-]
-qed-.
-
-lemma cpys_inv_lift1_le_up: ∀G,L,U1,U2,lt,mt. ⦃G, L⦄ ⊢ U1 ▶*[lt, mt] U2 →
- ∀K,s,l,m. ⬇[s, l, m] L ≡ K → ∀T1. ⬆[l, m] T1 ≡ U1 →
- lt ≤ l → l ≤ lt + mt → lt + mt ≤ l + m →
- ∃∃T2. ⦃G, K⦄ ⊢ T1 ▶*[lt, l - lt] T2 & ⬆[l, m] T2 ≡ U2.
-#G #L #U1 #U2 #lt #mt #H #K #s #l #m #HLK #T1 #HTU1 #Hltl #Hllmt #Hlmtlm @(cpys_ind … H) -U2
-[ /2 width=3 by ex2_intro/
-| -HTU1 #U #U2 #_ #HU2 * #T #HT1 #HTU
- elim (cpy_inv_lift1_le_up … HU2 … HLK … HTU) -HU2 -HLK -HTU /3 width=3 by cpys_strap1, ex2_intro/
-]
-qed-.
-
-lemma cpys_inv_lift1_subst: ∀G,L,W1,W2,l,m. ⦃G, L⦄ ⊢ W1 ▶*[l, m] W2 →
- ∀K,V1,i. ⬇[i+1] L ≡ K → ⬆[O, i+1] V1 ≡ W1 →
- l ≤ yinj i → i < l + m →
- ∃∃V2. ⦃G, K⦄ ⊢ V1 ▶*[O, ⫰(l+m-i)] V2 & ⬆[O, i+1] V2 ≡ W2.
-#G #L #W1 #W2 #l #m #HW12 #K #V1 #i #HLK #HVW1 #Hli #Hilm
-elim (cpys_inv_lift1_ge_up … HW12 … HLK … HVW1 ? ? ?) //
->yplus_O1 <yplus_inj >yplus_SO2
-[ >yminus_succ2 /2 width=3 by ex2_intro/
-| /2 width=1 by ylt_fwd_le_succ1/
-| /2 width=3 by yle_trans/
-]
-qed-.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/notation/relations/rdropstar_3.ma".
-include "basic_2/notation/relations/rdropstar_4.ma".
-include "basic_2/substitution/drop.ma".
-include "basic_2/multiple/mr2_minus.ma".
-include "basic_2/multiple/lifts_vector.ma".
-
-(* ITERATED LOCAL ENVIRONMENT SLICING ***************************************)
-
-inductive drops (s:bool): list2 ynat nat → relation lenv ≝
-| drops_nil : ∀L. drops s (◊) L L
-| drops_cons: ∀L1,L,L2,cs,l,m.
- drops s cs L1 L → ⬇[s, l, m] L ≡ L2 → drops s ({l, m} @ cs) L1 L2
-.
-
-interpretation "iterated slicing (local environment) abstract"
- 'RDropStar s cs T1 T2 = (drops s cs T1 T2).
-(*
-interpretation "iterated slicing (local environment) general"
- 'RDropStar des T1 T2 = (drops true des T1 T2).
-*)
-
-definition d_liftable1: relation2 lenv term → predicate bool ≝
- λR,s. ∀K,T. R K T → ∀L,l,m. ⬇[s, l, m] L ≡ K →
- ∀U. ⬆[l, m] T ≡ U → R L U.
-
-definition d_liftables1: relation2 lenv term → predicate bool ≝
- λR,s. ∀L,K,cs. ⬇*[s, cs] L ≡ K →
- ∀T,U. ⬆*[cs] T ≡ U → R K T → R L U.
-
-definition d_liftables1_all: relation2 lenv term → predicate bool ≝
- λR,s. ∀L,K,cs. ⬇*[s, cs] L ≡ K →
- ∀Ts,Us. ⬆*[cs] Ts ≡ Us →
- all … (R K) Ts → all … (R L) Us.
-
-(* Basic inversion lemmas ***************************************************)
-
-fact drops_inv_nil_aux: ∀L1,L2,s,cs. ⬇*[s, cs] L1 ≡ L2 → cs = ◊ → L1 = L2.
-#L1 #L2 #s #cs * -L1 -L2 -cs //
-#L1 #L #L2 #l #m #cs #_ #_ #H destruct
-qed-.
-
-(* Basic_1: was: drop1_gen_pnil *)
-lemma drops_inv_nil: ∀L1,L2,s. ⬇*[s, ◊] L1 ≡ L2 → L1 = L2.
-/2 width=4 by drops_inv_nil_aux/ qed-.
-
-fact drops_inv_cons_aux: ∀L1,L2,s,cs. ⬇*[s, cs] L1 ≡ L2 →
- ∀l,m,tl. cs = {l, m} @ tl →
- ∃∃L. ⬇*[s, tl] L1 ≡ L & ⬇[s, l, m] L ≡ L2.
-#L1 #L2 #s #cs * -L1 -L2 -cs
-[ #L #l #m #tl #H destruct
-| #L1 #L #L2 #cs #l #m #HT1 #HT2 #l0 #m0 #tl #H destruct
- /2 width=3 by ex2_intro/
-]
-qed-.
-
-(* Basic_1: was: drop1_gen_pcons *)
-lemma drops_inv_cons: ∀L1,L2,s,l,m,cs. ⬇*[s, {l, m} @ cs] L1 ≡ L2 →
- ∃∃L. ⬇*[s, cs] L1 ≡ L & ⬇[s, l, m] L ≡ L2.
-/2 width=3 by drops_inv_cons_aux/ qed-.
-
-lemma drops_inv_skip2: ∀I,s,cs,cs2,i. cs ▭ i ≡ cs2 →
- ∀L1,K2,V2. ⬇*[s, cs2] L1 ≡ K2. ⓑ{I} V2 →
- ∃∃K1,V1,cs1. cs + 1 ▭ i + 1 ≡ cs1 + 1 &
- ⬇*[s, cs1] K1 ≡ K2 &
- ⬆*[cs1] V2 ≡ V1 &
- L1 = K1. ⓑ{I} V1.
-#I #s #cs #cs2 #i #H elim H -cs -cs2 -i
-[ #i #L1 #K2 #V2 #H
- >(drops_inv_nil … H) -L1 /2 width=7 by lifts_nil, minuss_nil, ex4_3_intro, drops_nil/
-| #cs #cs2 #l #m #i #Hil #_ #IHcs2 #L1 #K2 #V2 #H
- elim (drops_inv_cons … H) -H #L #HL1 #H
- elim (drop_inv_skip2 … H) -H /2 width=1 by ylt_to_minus/ #K #V <yminus_succ2 #HK2 #HV2 #H destruct
- elim (IHcs2 … HL1) -IHcs2 -HL1 #K1 #V1 #cs1 #Hcs1 #HK1 #HV1 #X destruct
- @(ex4_3_intro … K1 V1 … ) // [3,4: /2 width=7 by lifts_cons, drops_cons/ | skip ]
- >pluss_SO2 >pluss_SO2
- >yminus_succ2 >ylt_inv_O1 /2 width=1 by ylt_to_minus/ <yminus_succ >commutative_plus (**) (* <yminus_succ1_inj does not work *)
- /3 width=1 by minuss_lt, ylt_succ/
-| #cs #cs2 #l #m #i #Hil #_ #IHcs2 #L1 #K2 #V2 #H
- elim (IHcs2 … H) -IHcs2 -H #K1 #V1 #cs1 #Hcs1 #HK1 #HV1 #X destruct
- /4 width=7 by minuss_ge, yle_succ, ex4_3_intro/
-]
-qed-.
-
-(* Basic properties *********************************************************)
-
-(* Basic_1: was: drop1_skip_bind *)
-lemma drops_skip: ∀L1,L2,s,cs. ⬇*[s, cs] L1 ≡ L2 → ∀V1,V2. ⬆*[cs] V2 ≡ V1 →
- ∀I. ⬇*[s, cs + 1] L1.ⓑ{I}V1 ≡ L2.ⓑ{I}V2.
-#L1 #L2 #s #cs #H elim H -L1 -L2 -cs
-[ #L #V1 #V2 #HV12 #I
- >(lifts_inv_nil … HV12) -HV12 //
-| #L1 #L #L2 #cs #l #m #_ #HL2 #IHL #V1 #V2 #H #I
- elim (lifts_inv_cons … H) -H /3 width=5 by drop_skip, drops_cons/
-].
-qed.
-
-lemma d1_liftable_liftables: ∀R,s. d_liftable1 R s → d_liftables1 R s.
-#R #s #HR #L #K #cs #H elim H -L -K -cs
-[ #L #T #U #H #HT <(lifts_inv_nil … H) -H //
-| #L1 #L #L2 #cs #l #m #_ #HL2 #IHL #T2 #T1 #H #HLT2
- elim (lifts_inv_cons … H) -H /3 width=10 by/
-]
-qed.
-
-lemma d1_liftables_liftables_all: ∀R,s. d_liftables1 R s → d_liftables1_all R s.
-#R #s #HR #L #K #cs #HLK #Ts #Us #H elim H -Ts -Us normalize //
-#Ts #Us #T #U #HTU #_ #IHTUs * /3 width=7 by conj/
-qed.
-
-(* Basic_1: removed theorems 1: drop1_getl_trans *)
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/substitution/drop_drop.ma".
-include "basic_2/multiple/drops.ma".
-
-(* ITERATED LOCAL ENVIRONMENT SLICING ***************************************)
-
-(* Properties concerning basic local environment slicing ********************)
-
-lemma drops_drop_trans: ∀L1,L,cs. ⬇*[Ⓕ, cs] L1 ≡ L → ∀L2,i. ⬇[i] L ≡ L2 →
- ∃∃L0,cs0,i0. ⬇[i0] L1 ≡ L0 & ⬇*[Ⓕ, cs0] L0 ≡ L2 &
- @⦃i, cs⦄ ≡ i0 & cs ▭ i ≡ cs0.
-#L1 #L #cs #H elim H -L1 -L -cs
-[ /2 width=7 by drops_nil, minuss_nil, at_nil, ex4_3_intro/
-| #L1 #L0 #L #cs #l #m #_ #HL0 #IHL0 #L2 #i #HL2
- elim (ylt_split i l) #Hil
- [ elim (drop_trans_le … HL0 … HL2) -L /2 width=2 by ylt_fwd_le/
- #L #HL0 #HL2 elim (IHL0 … HL0) -L0 /3 width=7 by drops_cons, minuss_lt, at_lt, ex4_3_intro/
- | lapply (drop_trans_ge … HL0 … HL2 ?) -L // #HL02
- elim (IHL0 … HL02) -L0 /3 width=7 by minuss_ge, at_ge, ex4_3_intro/
- ]
-]
-qed-.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/multiple/drops_drop.ma".
-
-(* ITERATED LOCAL ENVIRONMENT SLICING ***************************************)
-
-(* Main properties **********************************************************)
-
-(* Basic_1: was: drop1_trans *)
-theorem drops_trans: ∀L,L2,s,cs2. ⬇*[s, cs2] L ≡ L2 → ∀L1,cs1. ⬇*[s, cs1] L1 ≡ L →
- ⬇*[s, cs2 @@ cs1] L1 ≡ L2.
-#L #L2 #s #cs2 #H elim H -L -L2 -cs2 /3 width=3 by drops_cons/
-qed-.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/notation/relations/lazyeq_7.ma".
-include "basic_2/grammar/genv.ma".
-include "basic_2/multiple/lleq.ma".
-
-(* LAZY EQUIVALENCE FOR CLOSURES ********************************************)
-
-inductive fleq (l) (G) (L1) (T): relation3 genv lenv term ≝
-| fleq_intro: ∀L2. L1 ≡[T, l] L2 → fleq l G L1 T G L2 T
-.
-
-interpretation
- "lazy equivalence (closure)"
- 'LazyEq l G1 L1 T1 G2 L2 T2 = (fleq l G1 L1 T1 G2 L2 T2).
-
-(* Basic properties *********************************************************)
-
-lemma fleq_refl: ∀l. tri_reflexive … (fleq l).
-/2 width=1 by fleq_intro/ qed.
-
-lemma fleq_sym: ∀l. tri_symmetric … (fleq l).
-#l #G1 #L1 #T1 #G2 #L2 #T2 * /3 width=1 by fleq_intro, lleq_sym/
-qed-.
-
-(* Basic inversion lemmas ***************************************************)
-
-lemma fleq_inv_gen: ∀G1,G2,L1,L2,T1,T2,l. ⦃G1, L1, T1⦄ ≡[l] ⦃G2, L2, T2⦄ →
- ∧∧ G1 = G2 & L1 ≡[T1, l] L2 & T1 = T2.
-#G1 #G2 #L1 #L2 #T1 #T2 #l * -G2 -L2 -T2 /2 width=1 by and3_intro/
-qed-.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/multiple/lleq_lleq.ma".
-include "basic_2/multiple/fleq.ma".
-
-(* LAZY EQUIVALENCE FOR CLOSURES *******************************************)
-
-(* Main properties **********************************************************)
-
-theorem fleq_trans: ∀l. tri_transitive … (fleq l).
-#l #G1 #G #L1 #L #T1 #T * -G -L -T
-#L #HT1 #G2 #L2 #T2 * -G2 -L2 -T2
-/3 width=3 by lleq_trans, fleq_intro/
-qed-.
-
-theorem fleq_canc_sn: ∀G,G1,G2,L,L1,L2,T,T1,T2,l.
- ⦃G, L, T⦄ ≡[l] ⦃G1, L1, T1⦄→ ⦃G, L, T⦄ ≡[l] ⦃G2, L2, T2⦄ → ⦃G1, L1, T1⦄ ≡[l] ⦃G2, L2, T2⦄.
-/3 width=5 by fleq_trans, fleq_sym/ qed-.
-
-theorem fleq_canc_dx: ∀G1,G2,G,L1,L2,L,T1,T2,T,l.
- ⦃G1, L1, T1⦄ ≡[l] ⦃G, L, T⦄ → ⦃G2, L2, T2⦄ ≡[l] ⦃G, L, T⦄ → ⦃G1, L1, T1⦄ ≡[l] ⦃G2, L2, T2⦄.
-/3 width=5 by fleq_trans, fleq_sym/ qed-.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/notation/relations/suptermplus_6.ma".
-include "basic_2/substitution/fqu.ma".
-
-(* PLUS-ITERATED SUPCLOSURE *************************************************)
-
-definition fqup: tri_relation genv lenv term ≝ tri_TC … fqu.
-
-interpretation "plus-iterated structural successor (closure)"
- 'SupTermPlus G1 L1 T1 G2 L2 T2 = (fqup G1 L1 T1 G2 L2 T2).
-
-(* Basic properties *********************************************************)
-
-lemma fqu_fqup: ∀G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐ ⦃G2, L2, T2⦄ → ⦃G1, L1, T1⦄ ⊐+ ⦃G2, L2, T2⦄.
-/2 width=1 by tri_inj/ qed.
-
-lemma fqup_strap1: ∀G1,G,G2,L1,L,L2,T1,T,T2.
- ⦃G1, L1, T1⦄ ⊐+ ⦃G, L, T⦄ → ⦃G, L, T⦄ ⊐ ⦃G2, L2, T2⦄ →
- ⦃G1, L1, T1⦄ ⊐+ ⦃G2, L2, T2⦄.
-/2 width=5 by tri_step/ qed.
-
-lemma fqup_strap2: ∀G1,G,G2,L1,L,L2,T1,T,T2.
- ⦃G1, L1, T1⦄ ⊐ ⦃G, L, T⦄ → ⦃G, L, T⦄ ⊐+ ⦃G2, L2, T2⦄ →
- ⦃G1, L1, T1⦄ ⊐+ ⦃G2, L2, T2⦄.
-/2 width=5 by tri_TC_strap/ qed.
-
-lemma fqup_drop: ∀G1,G2,L1,K1,K2,T1,T2,U1,m. ⬇[m] L1 ≡ K1 → ⬆[0, m] T1 ≡ U1 →
- ⦃G1, K1, T1⦄ ⊐+ ⦃G2, K2, T2⦄ → ⦃G1, L1, U1⦄ ⊐+ ⦃G2, K2, T2⦄.
-#G1 #G2 #L1 #K1 #K2 #T1 #T2 #U1 #m #HLK1 #HTU1 #HT12 elim (eq_or_gt … m) #H destruct
-[ >(drop_inv_O2 … HLK1) -L1 <(lift_inv_O2 … HTU1) -U1 //
-| /3 width=5 by fqup_strap2, fqu_drop_lt/
-]
-qed-.
-
-lemma fqup_lref: ∀I,G,L,K,V,i. ⬇[i] L ≡ K.ⓑ{I}V → ⦃G, L, #i⦄ ⊐+ ⦃G, K, V⦄.
-/3 width=6 by fqu_lref_O, fqu_fqup, lift_lref_ge, fqup_drop/ qed.
-
-lemma fqup_pair_sn: ∀I,G,L,V,T. ⦃G, L, ②{I}V.T⦄ ⊐+ ⦃G, L, V⦄.
-/2 width=1 by fqu_pair_sn, fqu_fqup/ qed.
-
-lemma fqup_bind_dx: ∀a,I,G,L,V,T. ⦃G, L, ⓑ{a,I}V.T⦄ ⊐+ ⦃G, L.ⓑ{I}V, T⦄.
-/2 width=1 by fqu_bind_dx, fqu_fqup/ qed.
-
-lemma fqup_flat_dx: ∀I,G,L,V,T. ⦃G, L, ⓕ{I}V.T⦄ ⊐+ ⦃G, L, T⦄.
-/2 width=1 by fqu_flat_dx, fqu_fqup/ qed.
-
-lemma fqup_flat_dx_pair_sn: ∀I1,I2,G,L,V1,V2,T. ⦃G, L, ⓕ{I1}V1.②{I2}V2.T⦄ ⊐+ ⦃G, L, V2⦄.
-/2 width=5 by fqu_pair_sn, fqup_strap1/ qed.
-
-lemma fqup_bind_dx_flat_dx: ∀a,G,I1,I2,L,V1,V2,T. ⦃G, L, ⓑ{a,I1}V1.ⓕ{I2}V2.T⦄ ⊐+ ⦃G, L.ⓑ{I1}V1, T⦄.
-/2 width=5 by fqu_flat_dx, fqup_strap1/ qed.
-
-lemma fqup_flat_dx_bind_dx: ∀a,I1,I2,G,L,V1,V2,T. ⦃G, L, ⓕ{I1}V1.ⓑ{a,I2}V2.T⦄ ⊐+ ⦃G, L.ⓑ{I2}V2, T⦄.
-/2 width=5 by fqu_bind_dx, fqup_strap1/ qed.
-
-(* Basic eliminators ********************************************************)
-
-lemma fqup_ind: ∀G1,L1,T1. ∀R:relation3 ….
- (∀G2,L2,T2. ⦃G1, L1, T1⦄ ⊐ ⦃G2, L2, T2⦄ → R G2 L2 T2) →
- (∀G,G2,L,L2,T,T2. ⦃G1, L1, T1⦄ ⊐+ ⦃G, L, T⦄ → ⦃G, L, T⦄ ⊐ ⦃G2, L2, T2⦄ → R G L T → R G2 L2 T2) →
- ∀G2,L2,T2. ⦃G1, L1, T1⦄ ⊐+ ⦃G2, L2, T2⦄ → R G2 L2 T2.
-#G1 #L1 #T1 #R #IH1 #IH2 #G2 #L2 #T2 #H
-@(tri_TC_ind … IH1 IH2 G2 L2 T2 H)
-qed-.
-
-lemma fqup_ind_dx: ∀G2,L2,T2. ∀R:relation3 ….
- (∀G1,L1,T1. ⦃G1, L1, T1⦄ ⊐ ⦃G2, L2, T2⦄ → R G1 L1 T1) →
- (∀G1,G,L1,L,T1,T. ⦃G1, L1, T1⦄ ⊐ ⦃G, L, T⦄ → ⦃G, L, T⦄ ⊐+ ⦃G2, L2, T2⦄ → R G L T → R G1 L1 T1) →
- ∀G1,L1,T1. ⦃G1, L1, T1⦄ ⊐+ ⦃G2, L2, T2⦄ → R G1 L1 T1.
-#G2 #L2 #T2 #R #IH1 #IH2 #G1 #L1 #T1 #H
-@(tri_TC_ind_dx … IH1 IH2 G1 L1 T1 H)
-qed-.
-
-(* Basic forward lemmas *****************************************************)
-
-lemma fqup_fwd_fw: ∀G1,G2,L1,L2,T1,T2.
- ⦃G1, L1, T1⦄ ⊐+ ⦃G2, L2, T2⦄ → ♯{G2, L2, T2} < ♯{G1, L1, T1}.
-#G1 #G2 #L1 #L2 #T1 #T2 #H @(fqup_ind … H) -G2 -L2 -T2
-/3 width=3 by fqu_fwd_fw, transitive_lt/
-qed-.
-
-(* Advanced eliminators *****************************************************)
-
-lemma fqup_wf_ind: ∀R:relation3 …. (
- ∀G1,L1,T1. (∀G2,L2,T2. ⦃G1, L1, T1⦄ ⊐+ ⦃G2, L2, T2⦄ → R G2 L2 T2) →
- R G1 L1 T1
- ) → ∀G1,L1,T1. R G1 L1 T1.
-#R #HR @(f3_ind … fw) #x #IHx #G1 #L1 #T1 #H destruct /4 width=1 by fqup_fwd_fw/
-qed-.
-
-lemma fqup_wf_ind_eq: ∀R:relation3 …. (
- ∀G1,L1,T1. (∀G2,L2,T2. ⦃G1, L1, T1⦄ ⊐+ ⦃G2, L2, T2⦄ → R G2 L2 T2) →
- ∀G2,L2,T2. G1 = G2 → L1 = L2 → T1 = T2 → R G2 L2 T2
- ) → ∀G1,L1,T1. R G1 L1 T1.
-#R #HR @(f3_ind … fw) #x #IHx #G1 #L1 #T1 #H destruct /4 width=7 by fqup_fwd_fw/
-qed-.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/multiple/fqup.ma".
-
-(* PLUS-ITERATED SUPCLOSURE *************************************************)
-
-(* Main properties **********************************************************)
-
-theorem fqup_trans: tri_transitive … fqup.
-/2 width=5 by tri_TC_transitive/ qed-.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/notation/relations/suptermstar_6.ma".
-include "basic_2/substitution/fquq.ma".
-include "basic_2/multiple/fqup.ma".
-
-(* STAR-ITERATED SUPCLOSURE *************************************************)
-
-definition fqus: tri_relation genv lenv term ≝ tri_TC … fquq.
-
-interpretation "star-iterated structural successor (closure)"
- 'SupTermStar G1 L1 T1 G2 L2 T2 = (fqus G1 L1 T1 G2 L2 T2).
-
-(* Basic eliminators ********************************************************)
-
-lemma fqus_ind: ∀G1,L1,T1. ∀R:relation3 …. R G1 L1 T1 →
- (∀G,G2,L,L2,T,T2. ⦃G1, L1, T1⦄ ⊐* ⦃G, L, T⦄ → ⦃G, L, T⦄ ⊐⸮ ⦃G2, L2, T2⦄ → R G L T → R G2 L2 T2) →
- ∀G2,L2,T2. ⦃G1, L1, T1⦄ ⊐* ⦃G2, L2, T2⦄ → R G2 L2 T2.
-#G1 #L1 #T1 #R #IH1 #IH2 #G2 #L2 #T2 #H
-@(tri_TC_star_ind … IH1 IH2 G2 L2 T2 H) //
-qed-.
-
-lemma fqus_ind_dx: ∀G2,L2,T2. ∀R:relation3 …. R G2 L2 T2 →
- (∀G1,G,L1,L,T1,T. ⦃G1, L1, T1⦄ ⊐⸮ ⦃G, L, T⦄ → ⦃G, L, T⦄ ⊐* ⦃G2, L2, T2⦄ → R G L T → R G1 L1 T1) →
- ∀G1,L1,T1. ⦃G1, L1, T1⦄ ⊐* ⦃G2, L2, T2⦄ → R G1 L1 T1.
-#G2 #L2 #T2 #R #IH1 #IH2 #G1 #L1 #T1 #H
-@(tri_TC_star_ind_dx … IH1 IH2 G1 L1 T1 H) //
-qed-.
-
-(* Basic properties *********************************************************)
-
-lemma fqus_refl: tri_reflexive … fqus.
-/2 width=1 by tri_inj/ qed.
-
-lemma fquq_fqus: ∀G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐⸮ ⦃G2, L2, T2⦄ → ⦃G1, L1, T1⦄ ⊐* ⦃G2, L2, T2⦄.
-/2 width=1 by tri_inj/ qed.
-
-lemma fqus_strap1: ∀G1,G,G2,L1,L,L2,T1,T,T2. ⦃G1, L1, T1⦄ ⊐* ⦃G, L, T⦄ → ⦃G, L, T⦄ ⊐⸮ ⦃G2, L2, T2⦄ →
- ⦃G1, L1, T1⦄ ⊐* ⦃G2, L2, T2⦄.
-/2 width=5 by tri_step/ qed-.
-
-lemma fqus_strap2: ∀G1,G,G2,L1,L,L2,T1,T,T2. ⦃G1, L1, T1⦄ ⊐⸮ ⦃G, L, T⦄ → ⦃G, L, T⦄ ⊐* ⦃G2, L2, T2⦄ →
- ⦃G1, L1, T1⦄ ⊐* ⦃G2, L2, T2⦄.
-/2 width=5 by tri_TC_strap/ qed-.
-
-lemma fqus_drop: ∀G1,G2,K1,K2,T1,T2. ⦃G1, K1, T1⦄ ⊐* ⦃G2, K2, T2⦄ →
- ∀L1,U1,m. ⬇[m] L1 ≡ K1 → ⬆[0, m] T1 ≡ U1 →
- ⦃G1, L1, U1⦄ ⊐* ⦃G2, K2, T2⦄.
-#G1 #G2 #K1 #K2 #T1 #T2 #H @(fqus_ind … H) -G2 -K2 -T2
-/3 width=5 by fqus_strap1, fquq_fqus, fquq_drop/
-qed-.
-
-lemma fqup_fqus: ∀G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐+ ⦃G2, L2, T2⦄ → ⦃G1, L1, T1⦄ ⊐* ⦃G2, L2, T2⦄.
-#G1 #G2 #L1 #L2 #T1 #T2 #H @(fqup_ind … H) -G2 -L2 -T2
-/3 width=5 by fqus_strap1, fquq_fqus, fqu_fquq/
-qed.
-
-(* Basic forward lemmas *****************************************************)
-
-lemma fqus_fwd_fw: ∀G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐* ⦃G2, L2, T2⦄ → ♯{G2, L2, T2} ≤ ♯{G1, L1, T1}.
-#G1 #G2 #L1 #L2 #T1 #T2 #H @(fqus_ind … H) -L2 -T2
-/3 width=3 by fquq_fwd_fw, transitive_le/
-qed-.
-
-(* Basic inversion lemmas ***************************************************)
-
-lemma fqup_inv_step_sn: ∀G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐+ ⦃G2, L2, T2⦄ →
- ∃∃G,L,T. ⦃G1, L1, T1⦄ ⊐ ⦃G, L, T⦄ & ⦃G, L, T⦄ ⊐* ⦃G2, L2, T2⦄.
-#G1 #G2 #L1 #L2 #T1 #T2 #H @(fqup_ind_dx … H) -G1 -L1 -T1 /2 width=5 by ex2_3_intro/
-#G1 #G #L1 #L #T1 #T #H1 #_ * /4 width=9 by fqus_strap2, fqu_fquq, ex2_3_intro/
-qed-.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/substitution/fquq_alt.ma".
-include "basic_2/multiple/fqus.ma".
-
-(* STAR-ITERATED SUPCLOSURE *************************************************)
-
-(* Advanced inversion lemmas ************************************************)
-
-lemma fqus_inv_gen: ∀G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐* ⦃G2, L2, T2⦄ →
- ⦃G1, L1, T1⦄ ⊐+ ⦃G2, L2, T2⦄ ∨ (∧∧ G1 = G2 & L1 = L2 & T1 = T2).
-#G1 #G2 #L1 #L2 #T1 #T2 #H @(fqus_ind … H) -G2 -L2 -T2 //
-#G #G2 #L #L2 #T #T2 #_ #H2 * elim (fquq_inv_gen … H2) -H2
-[ /3 width=5 by fqup_strap1, or_introl/
-| * #HG #HL #HT destruct /2 width=1 by or_introl/
-| #H2 * #HG #HL #HT destruct /3 width=1 by fqu_fqup, or_introl/
-| * #H1G #H1L #H1T * #H2G #H2L #H2T destruct /2 width=1 by or_intror/
-]
-qed-.
-
-(* Advanced properties ******************************************************)
-
-lemma fqus_strap1_fqu: ∀G1,G,G2,L1,L,L2,T1,T,T2. ⦃G1, L1, T1⦄ ⊐* ⦃G, L, T⦄ → ⦃G, L, T⦄ ⊐ ⦃G2, L2, T2⦄ →
- ⦃G1, L1, T1⦄ ⊐+ ⦃G2, L2, T2⦄.
-#G1 #G #G2 #L1 #L #L2 #T1 #T #T2 #H1 #H2 elim (fqus_inv_gen … H1) -H1
-[ /2 width=5 by fqup_strap1/
-| * #HG #HL #HT destruct /2 width=1 by fqu_fqup/
-]
-qed-.
-
-lemma fqus_strap2_fqu: ∀G1,G,G2,L1,L,L2,T1,T,T2. ⦃G1, L1, T1⦄ ⊐ ⦃G, L, T⦄ → ⦃G, L, T⦄ ⊐* ⦃G2, L2, T2⦄ →
- ⦃G1, L1, T1⦄ ⊐+ ⦃G2, L2, T2⦄.
-#G1 #G #G2 #L1 #L #L2 #T1 #T #T2 #H1 #H2 elim (fqus_inv_gen … H2) -H2
-[ /2 width=5 by fqup_strap2/
-| * #HG #HL #HT destruct /2 width=1 by fqu_fqup/
-]
-qed-.
-
-lemma fqus_fqup_trans: ∀G1,G,G2,L1,L,L2,T1,T,T2. ⦃G1, L1, T1⦄ ⊐* ⦃G, L, T⦄ → ⦃G, L, T⦄ ⊐+ ⦃G2, L2, T2⦄ →
- ⦃G1, L1, T1⦄ ⊐+ ⦃G2, L2, T2⦄.
-#G1 #G #G2 #L1 #L #L2 #T1 #T #T2 #H1 #H2 @(fqup_ind … H2) -H2 -G2 -L2 -T2
-/2 width=5 by fqus_strap1_fqu, fqup_strap1/
-qed-.
-
-lemma fqup_fqus_trans: ∀G1,G,G2,L1,L,L2,T1,T,T2. ⦃G1, L1, T1⦄ ⊐+ ⦃G, L, T⦄ →
- ⦃G, L, T⦄ ⊐* ⦃G2, L2, T2⦄ → ⦃G1, L1, T1⦄ ⊐+ ⦃G2, L2, T2⦄.
-#G1 #G #G2 #L1 #L #L2 #T1 #T #T2 #H1 @(fqup_ind_dx … H1) -H1 -G1 -L1 -T1
-/3 width=5 by fqus_strap2_fqu, fqup_strap2/
-qed-.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/multiple/fqus.ma".
-
-(* STAR-ITERATED SUPCLOSURE *************************************************)
-
-(* Main properties **********************************************************)
-
-theorem fqus_trans: tri_transitive … fqus.
-/2 width=5 by tri_TC_transitive/ qed-.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/notation/relations/rliftstar_3.ma".
-include "basic_2/substitution/lift.ma".
-include "basic_2/multiple/mr2_plus.ma".
-
-(* GENERIC TERM RELOCATION **************************************************)
-
-inductive lifts: list2 ynat nat → relation term ≝
-| lifts_nil : ∀T. lifts (◊) T T
-| lifts_cons: ∀T1,T,T2,cs,l,m.
- ⬆[l,m] T1 ≡ T → lifts cs T T2 → lifts ({l, m} @ cs) T1 T2
-.
-
-interpretation "generic relocation (term)"
- 'RLiftStar cs T1 T2 = (lifts cs T1 T2).
-
-(* Basic inversion lemmas ***************************************************)
-
-fact lifts_inv_nil_aux: ∀T1,T2,cs. ⬆*[cs] T1 ≡ T2 → cs = ◊ → T1 = T2.
-#T1 #T2 #cs * -T1 -T2 -cs //
-#T1 #T #T2 #l #m #cs #_ #_ #H destruct
-qed-.
-
-lemma lifts_inv_nil: ∀T1,T2. ⬆*[◊] T1 ≡ T2 → T1 = T2.
-/2 width=3 by lifts_inv_nil_aux/ qed-.
-
-fact lifts_inv_cons_aux: ∀T1,T2,cs. ⬆*[cs] T1 ≡ T2 →
- ∀l,m,tl. cs = {l, m} @ tl →
- ∃∃T. ⬆[l, m] T1 ≡ T & ⬆*[tl] T ≡ T2.
-#T1 #T2 #cs * -T1 -T2 -cs
-[ #T #l #m #tl #H destruct
-| #T1 #T #T2 #cs #l #m #HT1 #HT2 #l0 #m0 #tl #H destruct
- /2 width=3 by ex2_intro/
-qed-.
-
-lemma lifts_inv_cons: ∀T1,T2,l,m,cs. ⬆*[{l, m} @ cs] T1 ≡ T2 →
- ∃∃T. ⬆[l, m] T1 ≡ T & ⬆*[cs] T ≡ T2.
-/2 width=3 by lifts_inv_cons_aux/ qed-.
-
-(* Basic_1: was: lift1_sort *)
-lemma lifts_inv_sort1: ∀T2,k,cs. ⬆*[cs] ⋆k ≡ T2 → T2 = ⋆k.
-#T2 #k #cs elim cs -cs
-[ #H <(lifts_inv_nil … H) -H //
-| #l #m #cs #IH #H
- elim (lifts_inv_cons … H) -H #X #H
- >(lift_inv_sort1 … H) -H /2 width=1 by/
-]
-qed-.
-
-(* Basic_1: was: lift1_lref *)
-lemma lifts_inv_lref1: ∀T2,cs,i1. ⬆*[cs] #i1 ≡ T2 →
- ∃∃i2. @⦃i1, cs⦄ ≡ i2 & T2 = #i2.
-#T2 #cs elim cs -cs
-[ #i1 #H <(lifts_inv_nil … H) -H /2 width=3 by at_nil, ex2_intro/
-| #l #m #cs #IH #i1 #H
- elim (lifts_inv_cons … H) -H #X #H1 #H2
- elim (lift_inv_lref1 … H1) -H1 * #Hli1 #H destruct
- elim (IH … H2) -IH -H2 /3 width=3 by at_lt, at_ge, ex2_intro/
-]
-qed-.
-
-lemma lifts_inv_gref1: ∀T2,p,cs. ⬆*[cs] §p ≡ T2 → T2 = §p.
-#T2 #p #cs elim cs -cs
-[ #H <(lifts_inv_nil … H) -H //
-| #l #m #cs #IH #H
- elim (lifts_inv_cons … H) -H #X #H
- >(lift_inv_gref1 … H) -H /2 width=1 by/
-]
-qed-.
-
-(* Basic_1: was: lift1_bind *)
-lemma lifts_inv_bind1: ∀a,I,T2,cs,V1,U1. ⬆*[cs] ⓑ{a,I} V1. U1 ≡ T2 →
- ∃∃V2,U2. ⬆*[cs] V1 ≡ V2 & ⬆*[cs + 1] U1 ≡ U2 &
- T2 = ⓑ{a,I} V2. U2.
-#a #I #T2 #cs elim cs -cs
-[ #V1 #U1 #H
- <(lifts_inv_nil … H) -H /2 width=5 by ex3_2_intro, lifts_nil/
-| #l #m #cs #IHcs #V1 #U1 #H
- elim (lifts_inv_cons … H) -H #X #H #HT2
- elim (lift_inv_bind1 … H) -H #V #U #HV1 #HU1 #H destruct
- elim (IHcs … HT2) -IHcs -HT2 #V2 #U2 #HV2 #HU2 #H destruct
- /3 width=5 by ex3_2_intro, lifts_cons/
-]
-qed-.
-
-(* Basic_1: was: lift1_flat *)
-lemma lifts_inv_flat1: ∀I,T2,cs,V1,U1. ⬆*[cs] ⓕ{I} V1. U1 ≡ T2 →
- ∃∃V2,U2. ⬆*[cs] V1 ≡ V2 & ⬆*[cs] U1 ≡ U2 &
- T2 = ⓕ{I} V2. U2.
-#I #T2 #cs elim cs -cs
-[ #V1 #U1 #H
- <(lifts_inv_nil … H) -H /2 width=5 by ex3_2_intro, lifts_nil/
-| #l #m #cs #IHcs #V1 #U1 #H
- elim (lifts_inv_cons … H) -H #X #H #HT2
- elim (lift_inv_flat1 … H) -H #V #U #HV1 #HU1 #H destruct
- elim (IHcs … HT2) -IHcs -HT2 #V2 #U2 #HV2 #HU2 #H destruct
- /3 width=5 by ex3_2_intro, lifts_cons/
-]
-qed-.
-
-(* Basic forward lemmas *****************************************************)
-
-lemma lifts_simple_dx: ∀T1,T2,cs. ⬆*[cs] T1 ≡ T2 → 𝐒⦃T1⦄ → 𝐒⦃T2⦄.
-#T1 #T2 #cs #H elim H -T1 -T2 -cs /3 width=5 by lift_simple_dx/
-qed-.
-
-lemma lifts_simple_sn: ∀T1,T2,cs. ⬆*[cs] T1 ≡ T2 → 𝐒⦃T2⦄ → 𝐒⦃T1⦄.
-#T1 #T2 #cs #H elim H -T1 -T2 -cs /3 width=5 by lift_simple_sn/
-qed-.
-
-(* Basic properties *********************************************************)
-
-lemma lifts_bind: ∀a,I,T2,V1,V2,cs. ⬆*[cs] V1 ≡ V2 →
- ∀T1. ⬆*[cs + 1] T1 ≡ T2 →
- ⬆*[cs] ⓑ{a,I} V1. T1 ≡ ⓑ{a,I} V2. T2.
-#a #I #T2 #V1 #V2 #cs #H elim H -V1 -V2 -cs
-[ #V #T1 #H >(lifts_inv_nil … H) -H //
-| #V1 #V #V2 #cs #l #m #HV1 #_ #IHV #T1 #H
- elim (lifts_inv_cons … H) -H /3 width=3 by lift_bind, lifts_cons/
-]
-qed.
-
-lemma lifts_flat: ∀I,T2,V1,V2,cs. ⬆*[cs] V1 ≡ V2 →
- ∀T1. ⬆*[cs] T1 ≡ T2 →
- ⬆*[cs] ⓕ{I} V1. T1 ≡ ⓕ{I} V2. T2.
-#I #T2 #V1 #V2 #cs #H elim H -V1 -V2 -cs
-[ #V #T1 #H >(lifts_inv_nil … H) -H //
-| #V1 #V #V2 #cs #l #m #HV1 #_ #IHV #T1 #H
- elim (lifts_inv_cons … H) -H /3 width=3 by lift_flat, lifts_cons/
-]
-qed.
-
-lemma lifts_total: ∀cs,T1. ∃T2. ⬆*[cs] T1 ≡ T2.
-#cs elim cs -cs /2 width=2 by lifts_nil, ex_intro/
-#l #m #cs #IH #T1 elim (lift_total T1 l m)
-#T #HT1 elim (IH T) -IH /3 width=4 by lifts_cons, ex_intro/
-qed.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "ground_2/ynat/ynat_max.ma".
-include "basic_2/substitution/lift_lift.ma".
-include "basic_2/multiple/mr2_minus.ma".
-include "basic_2/multiple/lifts.ma".
-
-(* GENERIC TERM RELOCATION **************************************************)
-
-(* Properties concerning basic term relocation ******************************)
-
-(* Basic_1: was: lift1_xhg (right to left) *)
-lemma lifts_lift_trans_le: ∀T1,T,cs. ⬆*[cs] T1 ≡ T → ∀T2. ⬆[0, 1] T ≡ T2 →
- ∃∃T0. ⬆[0, 1] T1 ≡ T0 & ⬆*[cs + 1] T0 ≡ T2.
-#T1 #T #cs #H elim H -T1 -T -cs
-[ /2 width=3 by lifts_nil, ex2_intro/
-| #T1 #T3 #T #cs #l #m #HT13 #_ #IHT13 #T2 #HT2
- elim (IHT13 … HT2) -T #T #HT3 #HT2
- elim (lift_trans_le … HT13 … HT3) -T3 /3 width=5 by lifts_cons, ex2_intro/
-]
-qed-.
-
-(* Basic_1: was: lift1_free (right to left) *)
-lemma lifts_lift_trans: ∀cs,i,i0. @⦃i, cs⦄ ≡ i0 →
- ∀cs0. cs + 1 ▭ i + 1 ≡ cs0 + 1 →
- ∀T1,T0. ⬆*[cs0] T1 ≡ T0 →
- ∀T2. ⬆[O, i0 + 1] T0 ≡ T2 →
- ∃∃T. ⬆[0, i + 1] T1 ≡ T & ⬆*[cs] T ≡ T2.
-#cs elim cs -cs
-[ #i #x #H1 #cs0 #H2 #T1 #T0 #HT10 #T2
- <(at_inv_nil … H1) -x #HT02
- lapply (minuss_inv_nil1 … H2) -H2 #H
- >(pluss_inv_nil2 … H) in HT10; -cs0 #H
- >(lifts_inv_nil … H) -T1 /2 width=3 by lifts_nil, ex2_intro/
-| #l #m #cs #IHcs #i #i0 #H1 #cs0 #H2 #T1 #T0 #HT10 #T2 #HT02
- elim (at_inv_cons … H1) -H1 * #Hil #Hi0
- [ elim (minuss_inv_cons1_lt … H2) -H2 /2 width=1 by ylt_succ/ #cs1 #Hcs1
- <yplus_inj >yplus_SO2 >yplus_SO2 >yminus_succ #H
- elim (pluss_inv_cons2 … H) -H #cs2 #H1 #H2 destruct
- elim (lifts_inv_cons … HT10) -HT10 #T #HT1 #HT0
- elim (IHcs … Hi0 … Hcs1 … HT0 … HT02) -IHcs -Hi0 -Hcs1 -T0 #T0 #HT0 #HT02
- elim (lift_trans_le … HT1 … HT0) -T /2 width=1 by/ #T #HT1
- <yminus_plus2 <yplus_inj >yplus_SO2 >ymax_pre_sn
- /3 width=5 by lifts_cons, ex2_intro, ylt_fwd_le_succ1/
- | >commutative_plus in Hi0; #Hi0
- lapply (minuss_inv_cons1_ge … H2 ?) -H2 /2 width=1 by yle_succ/ <associative_plus #Hcs0
- elim (IHcs … Hi0 … Hcs0 … HT10 … HT02) -IHcs -Hi0 -Hcs0 -T0 #T0 #HT0 #HT02
- elim (lift_split … HT0 l (i+1)) -HT0 /3 width=5 by lifts_cons, yle_succ, yle_pred_sn, ex2_intro/
- ]
-]
-qed-.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/substitution/lift_lift_vector.ma".
-include "basic_2/multiple/lifts_lift.ma".
-include "basic_2/multiple/lifts_vector.ma".
-
-(* GENERIC RELOCATION *******************************************************)
-
-(* Main properties **********************************************************)
-
-(* Basic_1: was: lifts1_xhg (right to left) *)
-lemma liftsv_liftv_trans_le: ∀T1s,Ts,cs. ⬆*[cs] T1s ≡ Ts →
- ∀T2s:list term. ⬆[0, 1] Ts ≡ T2s →
- ∃∃T0s. ⬆[0, 1] T1s ≡ T0s & ⬆*[cs + 1] T0s ≡ T2s.
-#T1s #Ts #cs #H elim H -T1s -Ts
-[ #T1s #H
- >(liftv_inv_nil1 … H) -T1s /2 width=3 by liftsv_nil, liftv_nil, ex2_intro/
-| #T1s #Ts #T1 #T #HT1 #_ #IHT1s #X #H
- elim (liftv_inv_cons1 … H) -H #T2 #T2s #HT2 #HT2s #H destruct
- elim (IHT1s … HT2s) -Ts #Ts #HT1s #HT2s
- elim (lifts_lift_trans_le … HT1 … HT2) -T /3 width=5 by liftsv_cons, liftv_cons, ex2_intro/
-]
-qed-.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/multiple/lifts_lift.ma".
-
-(* GENERIC RELOCATION *******************************************************)
-
-(* Main properties **********************************************************)
-
-(* Basic_1: was: lift1_lift1 (left to right) *)
-theorem lifts_trans: ∀T1,T,cs1. ⬆*[cs1] T1 ≡ T → ∀T2:term. ∀cs2. ⬆*[cs2] T ≡ T2 →
- ⬆*[cs1 @@ cs2] T1 ≡ T2.
-#T1 #T #cs1 #H elim H -T1 -T -cs1 /3 width=3 by lifts_cons/
-qed.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/substitution/lift_vector.ma".
-include "basic_2/multiple/lifts.ma".
-
-(* GENERIC TERM VECTOR RELOCATION *******************************************)
-
-inductive liftsv (cs:list2 ynat nat) : relation (list term) ≝
-| liftsv_nil : liftsv cs (◊) (◊)
-| liftsv_cons: ∀T1s,T2s,T1,T2.
- ⬆*[cs] T1 ≡ T2 → liftsv cs T1s T2s →
- liftsv cs (T1 @ T1s) (T2 @ T2s)
-.
-
-interpretation "generic relocation (vector)"
- 'RLiftStar cs T1s T2s = (liftsv cs T1s T2s).
-
-(* Basic inversion lemmas ***************************************************)
-
-(* Basic_1: was: lifts1_flat (left to right) *)
-lemma lifts_inv_applv1: ∀V1s,U1,T2,cs. ⬆*[cs] Ⓐ V1s. U1 ≡ T2 →
- ∃∃V2s,U2. ⬆*[cs] V1s ≡ V2s & ⬆*[cs] U1 ≡ U2 &
- T2 = Ⓐ V2s. U2.
-#V1s elim V1s -V1s normalize
-[ #T1 #T2 #cs #HT12
- @ex3_2_intro [3,4: // |1,2: skip | // ] (**) (* explicit constructor *)
-| #V1 #V1s #IHV1s #T1 #X #cs #H
- elim (lifts_inv_flat1 … H) -H #V2 #Y #HV12 #HY #H destruct
- elim (IHV1s … HY) -IHV1s -HY #V2s #T2 #HV12s #HT12 #H destruct
- @(ex3_2_intro) [4: // |3: /2 width=2 by liftsv_cons/ |1,2: skip | // ] (**) (* explicit constructor *)
-]
-qed-.
-
-(* Basic properties *********************************************************)
-
-(* Basic_1: was: lifts1_flat (right to left) *)
-lemma lifts_applv: ∀V1s,V2s,cs. ⬆*[cs] V1s ≡ V2s →
- ∀T1,T2. ⬆*[cs] T1 ≡ T2 →
- ⬆*[cs] Ⓐ V1s. T1 ≡ Ⓐ V2s. T2.
-#V1s #V2s #cs #H elim H -V1s -V2s /3 width=1 by lifts_flat/
-qed.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/notation/relations/lazyeq_4.ma".
-include "basic_2/multiple/llpx_sn.ma".
-
-(* LAZY EQUIVALENCE FOR LOCAL ENVIRONMENTS **********************************)
-
-definition ceq: relation3 lenv term term ≝ λL,T1,T2. T1 = T2.
-
-definition lleq: relation4 ynat term lenv lenv ≝ llpx_sn ceq.
-
-interpretation
- "lazy equivalence (local environment)"
- 'LazyEq T l L1 L2 = (lleq l T L1 L2).
-
-definition lleq_transitive: predicate (relation3 lenv term term) ≝
- λR. ∀L2,T1,T2. R L2 T1 T2 → ∀L1. L1 ≡[T1, 0] L2 → R L1 T1 T2.
-
-(* Basic inversion lemmas ***************************************************)
-
-lemma lleq_ind: ∀R:relation4 ynat term lenv lenv. (
- ∀L1,L2,l,k. |L1| = |L2| → R l (⋆k) L1 L2
- ) → (
- ∀L1,L2,l,i. |L1| = |L2| → yinj i < l → R l (#i) L1 L2
- ) → (
- ∀I,L1,L2,K1,K2,V,l,i. l ≤ yinj i →
- ⬇[i] L1 ≡ K1.ⓑ{I}V → ⬇[i] L2 ≡ K2.ⓑ{I}V →
- K1 ≡[V, yinj O] K2 → R (yinj O) V K1 K2 → R l (#i) L1 L2
- ) → (
- ∀L1,L2,l,i. |L1| = |L2| → |L1| ≤ i → |L2| ≤ i → R l (#i) L1 L2
- ) → (
- ∀L1,L2,l,p. |L1| = |L2| → R l (§p) L1 L2
- ) → (
- ∀a,I,L1,L2,V,T,l.
- L1 ≡[V, l]L2 → L1.ⓑ{I}V ≡[T, ⫯l] L2.ⓑ{I}V →
- R l V L1 L2 → R (⫯l) T (L1.ⓑ{I}V) (L2.ⓑ{I}V) → R l (ⓑ{a,I}V.T) L1 L2
- ) → (
- ∀I,L1,L2,V,T,l.
- L1 ≡[V, l]L2 → L1 ≡[T, l] L2 →
- R l V L1 L2 → R l T L1 L2 → R l (ⓕ{I}V.T) L1 L2
- ) →
- ∀l,T,L1,L2. L1 ≡[T, l] L2 → R l T L1 L2.
-#R #H1 #H2 #H3 #H4 #H5 #H6 #H7 #l #T #L1 #L2 #H elim H -L1 -L2 -T -l /2 width=8 by/
-qed-.
-
-lemma lleq_inv_bind: ∀a,I,L1,L2,V,T,l. L1 ≡[ⓑ{a,I}V.T, l] L2 →
- L1 ≡[V, l] L2 ∧ L1.ⓑ{I}V ≡[T, ⫯l] L2.ⓑ{I}V.
-/2 width=2 by llpx_sn_inv_bind/ qed-.
-
-lemma lleq_inv_flat: ∀I,L1,L2,V,T,l. L1 ≡[ⓕ{I}V.T, l] L2 →
- L1 ≡[V, l] L2 ∧ L1 ≡[T, l] L2.
-/2 width=2 by llpx_sn_inv_flat/ qed-.
-
-(* Basic forward lemmas *****************************************************)
-
-lemma lleq_fwd_length: ∀L1,L2,T,l. L1 ≡[T, l] L2 → |L1| = |L2|.
-/2 width=4 by llpx_sn_fwd_length/ qed-.
-
-lemma lleq_fwd_lref: ∀L1,L2,l,i. L1 ≡[#i, l] L2 →
- ∨∨ |L1| ≤ i ∧ |L2| ≤ i
- | yinj i < l
- | ∃∃I,K1,K2,V. ⬇[i] L1 ≡ K1.ⓑ{I}V &
- ⬇[i] L2 ≡ K2.ⓑ{I}V &
- K1 ≡[V, yinj 0] K2 & l ≤ yinj i.
-#L1 #L2 #l #i #H elim (llpx_sn_fwd_lref … H) /2 width=1 by or3_intro0, or3_intro1/
-* /3 width=7 by or3_intro2, ex4_4_intro/
-qed-.
-
-lemma lleq_fwd_drop_sn: ∀L1,L2,T,l. L1 ≡[l, T] L2 → ∀K1,i. ⬇[i] L1 ≡ K1 →
- ∃K2. ⬇[i] L2 ≡ K2.
-/2 width=7 by llpx_sn_fwd_drop_sn/ qed-.
-
-lemma lleq_fwd_drop_dx: ∀L1,L2,T,l. L1 ≡[l, T] L2 → ∀K2,i. ⬇[i] L2 ≡ K2 →
- ∃K1. ⬇[i] L1 ≡ K1.
-/2 width=7 by llpx_sn_fwd_drop_dx/ qed-.
-
-lemma lleq_fwd_bind_sn: ∀a,I,L1,L2,V,T,l.
- L1 ≡[ⓑ{a,I}V.T, l] L2 → L1 ≡[V, l] L2.
-/2 width=4 by llpx_sn_fwd_bind_sn/ qed-.
-
-lemma lleq_fwd_bind_dx: ∀a,I,L1,L2,V,T,l.
- L1 ≡[ⓑ{a,I}V.T, l] L2 → L1.ⓑ{I}V ≡[T, ⫯l] L2.ⓑ{I}V.
-/2 width=2 by llpx_sn_fwd_bind_dx/ qed-.
-
-lemma lleq_fwd_flat_sn: ∀I,L1,L2,V,T,l.
- L1 ≡[ⓕ{I}V.T, l] L2 → L1 ≡[V, l] L2.
-/2 width=3 by llpx_sn_fwd_flat_sn/ qed-.
-
-lemma lleq_fwd_flat_dx: ∀I,L1,L2,V,T,l.
- L1 ≡[ⓕ{I}V.T, l] L2 → L1 ≡[T, l] L2.
-/2 width=3 by llpx_sn_fwd_flat_dx/ qed-.
-
-(* Basic properties *********************************************************)
-
-lemma lleq_sort: ∀L1,L2,l,k. |L1| = |L2| → L1 ≡[⋆k, l] L2.
-/2 width=1 by llpx_sn_sort/ qed.
-
-lemma lleq_skip: ∀L1,L2,l,i. yinj i < l → |L1| = |L2| → L1 ≡[#i, l] L2.
-/2 width=1 by llpx_sn_skip/ qed.
-
-lemma lleq_lref: ∀I,L1,L2,K1,K2,V,l,i. l ≤ yinj i →
- ⬇[i] L1 ≡ K1.ⓑ{I}V → ⬇[i] L2 ≡ K2.ⓑ{I}V →
- K1 ≡[V, 0] K2 → L1 ≡[#i, l] L2.
-/2 width=9 by llpx_sn_lref/ qed.
-
-lemma lleq_free: ∀L1,L2,l,i. |L1| ≤ i → |L2| ≤ i → |L1| = |L2| → L1 ≡[#i, l] L2.
-/2 width=1 by llpx_sn_free/ qed.
-
-lemma lleq_gref: ∀L1,L2,l,p. |L1| = |L2| → L1 ≡[§p, l] L2.
-/2 width=1 by llpx_sn_gref/ qed.
-
-lemma lleq_bind: ∀a,I,L1,L2,V,T,l.
- L1 ≡[V, l] L2 → L1.ⓑ{I}V ≡[T, ⫯l] L2.ⓑ{I}V →
- L1 ≡[ⓑ{a,I}V.T, l] L2.
-/2 width=1 by llpx_sn_bind/ qed.
-
-lemma lleq_flat: ∀I,L1,L2,V,T,l.
- L1 ≡[V, l] L2 → L1 ≡[T, l] L2 → L1 ≡[ⓕ{I}V.T, l] L2.
-/2 width=1 by llpx_sn_flat/ qed.
-
-lemma lleq_refl: ∀l,T. reflexive … (lleq l T).
-/2 width=1 by llpx_sn_refl/ qed.
-
-lemma lleq_Y: ∀L1,L2,T. |L1| = |L2| → L1 ≡[T, ∞] L2.
-/2 width=1 by llpx_sn_Y/ qed.
-
-lemma lleq_sym: ∀l,T. symmetric … (lleq l T).
-#l #T #L1 #L2 #H @(lleq_ind … H) -l -T -L1 -L2
-/2 width=7 by lleq_sort, lleq_skip, lleq_lref, lleq_free, lleq_gref, lleq_bind, lleq_flat/
-qed-.
-
-lemma lleq_ge_up: ∀L1,L2,U,lt. L1 ≡[U, lt] L2 →
- ∀T,l,m. ⬆[l, m] T ≡ U →
- lt ≤ l + m → L1 ≡[U, l] L2.
-/2 width=6 by llpx_sn_ge_up/ qed-.
-
-lemma lleq_ge: ∀L1,L2,T,l1. L1 ≡[T, l1] L2 → ∀l2. l1 ≤ l2 → L1 ≡[T, l2] L2.
-/2 width=3 by llpx_sn_ge/ qed-.
-
-lemma lleq_bind_O: ∀a,I,L1,L2,V,T. L1 ≡[V, 0] L2 → L1.ⓑ{I}V ≡[T, 0] L2.ⓑ{I}V →
- L1 ≡[ⓑ{a,I}V.T, 0] L2.
-/2 width=1 by llpx_sn_bind_O/ qed-.
-
-(* Advanceded properties on lazy pointwise extensions ************************)
-
-lemma llpx_sn_lrefl: ∀R. (∀L. reflexive … (R L)) →
- ∀L1,L2,T,l. L1 ≡[T, l] L2 → llpx_sn R l T L1 L2.
-/2 width=3 by llpx_sn_co/ qed-.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/multiple/llpx_sn_alt.ma".
-include "basic_2/multiple/lleq.ma".
-
-(* LAZY EQUIVALENCE FOR LOCAL ENVIRONMENTS **********************************)
-
-(* Alternative definition (not recursive) ***********************************)
-
-theorem lleq_intro_alt: ∀L1,L2,T,l. |L1| = |L2| →
- (∀I1,I2,K1,K2,V1,V2,i. l ≤ yinj i → L1 ⊢ i ϵ 𝐅*[l]⦃T⦄ →
- ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
- I1 = I2 ∧ V1 = V2
- ) → L1 ≡[T, l] L2.
-#L1 #L2 #T #l #HL12 #IH @llpx_sn_alt_inv_llpx_sn @conj // -HL12
-#I1 #I2 #K1 #K2 #V1 #V2 #i #Hil #HnT #HLK1 #HLK2
-@(IH … HnT HLK1 HLK2) -IH -HnT -HLK1 -HLK2 //
-qed.
-
-theorem lleq_inv_alt: ∀L1,L2,T,l. L1 ≡[T, l] L2 →
- |L1| = |L2| ∧
- ∀I1,I2,K1,K2,V1,V2,i. l ≤ yinj i → L1 ⊢ i ϵ 𝐅*[l]⦃T⦄ →
- ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
- I1 = I2 ∧ V1 = V2.
-#L1 #L2 #T #l #H elim (llpx_sn_llpx_sn_alt … H) -H
-#HL12 #IH @conj //
-#I1 #I2 #K1 #K2 #V1 #V2 #i #Hil #HnT #HLK1 #HLK2
-@(IH … HnT HLK1 HLK2) -IH -HnT -HLK1 -HLK2 //
-qed-.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/multiple/llpx_sn_alt_rec.ma".
-include "basic_2/multiple/lleq.ma".
-
-(* LAZY EQUIVALENCE FOR LOCAL ENVIRONMENTS **********************************)
-
-(* Alternative definition (recursive) ***************************************)
-
-theorem lleq_intro_alt_r: ∀L1,L2,T,l. |L1| = |L2| →
- (∀I1,I2,K1,K2,V1,V2,i. l ≤ yinj i → (∀U. ⬆[i, 1] U ≡ T → ⊥) →
- ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
- ∧∧ I1 = I2 & V1 = V2 & K1 ≡[V1, 0] K2
- ) → L1 ≡[T, l] L2.
-#L1 #L2 #T #l #HL12 #IH @llpx_sn_intro_alt_r // -HL12
-#I1 #I2 #K1 #K2 #V1 #V2 #i #Hil #HnT #HLK1 #HLK2
-elim (IH … HnT HLK1 HLK2) -IH -HnT -HLK1 -HLK2 /2 width=1 by and3_intro/
-qed.
-
-theorem lleq_ind_alt_r: ∀S:relation4 ynat term lenv lenv.
- (∀L1,L2,T,l. |L1| = |L2| → (
- ∀I1,I2,K1,K2,V1,V2,i. l ≤ yinj i → (∀U. ⬆[i, 1] U ≡ T → ⊥) →
- ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
- ∧∧ I1 = I2 & V1 = V2 & K1 ≡[V1, 0] K2 & S 0 V1 K1 K2
- ) → S l T L1 L2) →
- ∀L1,L2,T,l. L1 ≡[T, l] L2 → S l T L1 L2.
-#S #IH1 #L1 #L2 #T #l #H @(llpx_sn_ind_alt_r … H) -L1 -L2 -T -l
-#L1 #L2 #T #l #HL12 #IH2 @IH1 -IH1 // -HL12
-#I1 #I2 #K1 #K2 #V1 #V2 #i #Hil #HnT #HLK1 #HLK2
-elim (IH2 … HnT HLK1 HLK2) -IH2 -HnT -HLK1 -HLK2 /2 width=1 by and4_intro/
-qed-.
-
-theorem lleq_inv_alt_r: ∀L1,L2,T,l. L1 ≡[T, l] L2 →
- |L1| = |L2| ∧
- ∀I1,I2,K1,K2,V1,V2,i. l ≤ yinj i → (∀U. ⬆[i, 1] U ≡ T → ⊥) →
- ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
- ∧∧ I1 = I2 & V1 = V2 & K1 ≡[V1, 0] K2.
-#L1 #L2 #T #l #H elim (llpx_sn_inv_alt_r … H) -H
-#HL12 #IH @conj //
-#I1 #I2 #K1 #K2 #V1 #V2 #i #Hil #HnT #HLK1 #HLK2
-elim (IH … HnT HLK1 HLK2) -IH -HnT -HLK1 -HLK2 /2 width=1 by and3_intro/
-qed-.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/multiple/llpx_sn_drop.ma".
-include "basic_2/multiple/lleq.ma".
-
-(* LAZY EQUIVALENCE FOR LOCAL ENVIRONMENTS **********************************)
-
-(* Advanced properties ******************************************************)
-
-lemma lleq_bind_repl_O: ∀I,L1,L2,V,T. L1.ⓑ{I}V ≡[T, 0] L2.ⓑ{I}V →
- ∀J,W. L1 ≡[W, 0] L2 → L1.ⓑ{J}W ≡[T, 0] L2.ⓑ{J}W.
-/2 width=7 by llpx_sn_bind_repl_O/ qed-.
-
-lemma lleq_dec: ∀T,L1,L2,l. Decidable (L1 ≡[T, l] L2).
-/3 width=1 by llpx_sn_dec, eq_term_dec/ qed-.
-
-lemma lleq_llpx_sn_trans: ∀R. lleq_transitive R →
- ∀L1,L2,T,l. L1 ≡[T, l] L2 →
- ∀L. llpx_sn R l T L2 L → llpx_sn R l T L1 L.
-#R #HR #L1 #L2 #T #l #H @(lleq_ind … H) -L1 -L2 -T -l
-[1,2,5: /4 width=6 by llpx_sn_fwd_length, llpx_sn_gref, llpx_sn_skip, llpx_sn_sort, trans_eq/
-|4: /4 width=6 by llpx_sn_fwd_length, llpx_sn_free, le_repl_sn_conf_aux, trans_eq/
-| #I #L1 #L2 #K1 #K2 #V #l #i #Hli #HLK1 #HLK2 #HK12 #IHK12 #L #H elim (llpx_sn_inv_lref_ge_sn … H … HLK2) -H -HLK2
- /3 width=11 by llpx_sn_lref/
-| #a #I #L1 #L2 #V #T #l #_ #_ #IHV #IHT #L #H elim (llpx_sn_inv_bind … H) -H
- /3 width=1 by llpx_sn_bind/
-| #I #L1 #L2 #V #T #l #_ #_ #IHV #IHT #L #H elim (llpx_sn_inv_flat … H) -H
- /3 width=1 by llpx_sn_flat/
-]
-qed-.
-
-lemma lleq_llpx_sn_conf: ∀R. lleq_transitive R →
- ∀L1,L2,T,l. L1 ≡[T, l] L2 →
- ∀L. llpx_sn R l T L1 L → llpx_sn R l T L2 L.
-/3 width=3 by lleq_llpx_sn_trans, lleq_sym/ qed-.
-
-(* Advanced inversion lemmas ************************************************)
-
-lemma lleq_inv_lref_ge_dx: ∀L1,L2,l,i. L1 ≡[#i, l] L2 → l ≤ i →
- ∀I,K2,V. ⬇[i] L2 ≡ K2.ⓑ{I}V →
- ∃∃K1. ⬇[i] L1 ≡ K1.ⓑ{I}V & K1 ≡[V, 0] K2.
-#L1 #L2 #l #i #H #Hli #I #K2 #V #HLK2 elim (llpx_sn_inv_lref_ge_dx … H … HLK2) -L2
-/2 width=3 by ex2_intro/
-qed-.
-
-lemma lleq_inv_lref_ge_sn: ∀L1,L2,l,i. L1 ≡[#i, l] L2 → l ≤ i →
- ∀I,K1,V. ⬇[i] L1 ≡ K1.ⓑ{I}V →
- ∃∃K2. ⬇[i] L2 ≡ K2.ⓑ{I}V & K1 ≡[V, 0] K2.
-#L1 #L2 #l #i #H #Hli #I1 #K1 #V #HLK1 elim (llpx_sn_inv_lref_ge_sn … H … HLK1) -L1
-/2 width=3 by ex2_intro/
-qed-.
-
-lemma lleq_inv_lref_ge_bi: ∀L1,L2,l,i. L1 ≡[#i, l] L2 → l ≤ i →
- ∀I1,I2,K1,K2,V1,V2.
- ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
- ∧∧ I1 = I2 & K1 ≡[V1, 0] K2 & V1 = V2.
-/2 width=8 by llpx_sn_inv_lref_ge_bi/ qed-.
-
-lemma lleq_inv_lref_ge: ∀L1,L2,l,i. L1 ≡[#i, l] L2 → l ≤ i →
- ∀I,K1,K2,V. ⬇[i] L1 ≡ K1.ⓑ{I}V → ⬇[i] L2 ≡ K2.ⓑ{I}V →
- K1 ≡[V, 0] K2.
-#L1 #L2 #l #i #HL12 #Hli #I #K1 #K2 #V #HLK1 #HLK2
-elim (lleq_inv_lref_ge_bi … HL12 … HLK1 HLK2) //
-qed-.
-
-lemma lleq_inv_S: ∀L1,L2,T,l. L1 ≡[T, l+1] L2 →
- ∀I,K1,K2,V. ⬇[l] L1 ≡ K1.ⓑ{I}V → ⬇[l] L2 ≡ K2.ⓑ{I}V →
- K1 ≡[V, 0] K2 → L1 ≡[T, l] L2.
-/2 width=9 by llpx_sn_inv_S/ qed-.
-
-lemma lleq_inv_bind_O: ∀a,I,L1,L2,V,T. L1 ≡[ⓑ{a,I}V.T, 0] L2 →
- L1 ≡[V, 0] L2 ∧ L1.ⓑ{I}V ≡[T, 0] L2.ⓑ{I}V.
-/2 width=2 by llpx_sn_inv_bind_O/ qed-.
-
-(* Advanced forward lemmas **************************************************)
-
-lemma lleq_fwd_lref_dx: ∀L1,L2,l,i. L1 ≡[#i, l] L2 →
- ∀I,K2,V. ⬇[i] L2 ≡ K2.ⓑ{I}V →
- i < l ∨
- ∃∃K1. ⬇[i] L1 ≡ K1.ⓑ{I}V & K1 ≡[V, 0] K2 & l ≤ i.
-#L1 #L2 #l #i #H #I #K2 #V #HLK2 elim (llpx_sn_fwd_lref_dx … H … HLK2) -L2
-[ | * ] /3 width=3 by ex3_intro, or_intror, or_introl/
-qed-.
-
-lemma lleq_fwd_lref_sn: ∀L1,L2,l,i. L1 ≡[#i, l] L2 →
- ∀I,K1,V. ⬇[i] L1 ≡ K1.ⓑ{I}V →
- i < l ∨
- ∃∃K2. ⬇[i] L2 ≡ K2.ⓑ{I}V & K1 ≡[V, 0] K2 & l ≤ i.
-#L1 #L2 #l #i #H #I #K1 #V #HLK1 elim (llpx_sn_fwd_lref_sn … H … HLK1) -L1
-[ | * ] /3 width=3 by ex3_intro, or_intror, or_introl/
-qed-.
-
-lemma lleq_fwd_bind_O_dx: ∀a,I,L1,L2,V,T. L1 ≡[ⓑ{a,I}V.T, 0] L2 →
- L1.ⓑ{I}V ≡[T, 0] L2.ⓑ{I}V.
-/2 width=2 by llpx_sn_fwd_bind_O_dx/ qed-.
-
-(* Properties on relocation *************************************************)
-
-lemma lleq_lift_le: ∀K1,K2,T,lt. K1 ≡[T, lt] K2 →
- ∀L1,L2,l,m. ⬇[Ⓕ, l, m] L1 ≡ K1 → ⬇[Ⓕ, l, m] L2 ≡ K2 →
- ∀U. ⬆[l, m] T ≡ U → lt ≤ l → L1 ≡[U, lt] L2.
-/3 width=10 by llpx_sn_lift_le, lift_mono/ qed-.
-
-lemma lleq_lift_ge: ∀K1,K2,T,lt. K1 ≡[T, lt] K2 →
- ∀L1,L2,l,m. ⬇[Ⓕ, l, m] L1 ≡ K1 → ⬇[Ⓕ, l, m] L2 ≡ K2 →
- ∀U. ⬆[l, m] T ≡ U → l ≤ lt → L1 ≡[U, lt+m] L2.
-/2 width=9 by llpx_sn_lift_ge/ qed-.
-
-(* Inversion lemmas on relocation *******************************************)
-
-lemma lleq_inv_lift_le: ∀L1,L2,U,lt. L1 ≡[U, lt] L2 →
- ∀K1,K2,l,m. ⬇[Ⓕ, l, m] L1 ≡ K1 → ⬇[Ⓕ, l, m] L2 ≡ K2 →
- ∀T. ⬆[l, m] T ≡ U → lt ≤ l → K1 ≡[T, lt] K2.
-/3 width=10 by llpx_sn_inv_lift_le, ex2_intro/ qed-.
-
-lemma lleq_inv_lift_be: ∀L1,L2,U,lt. L1 ≡[U, lt] L2 →
- ∀K1,K2,l,m. ⬇[Ⓕ, l, m] L1 ≡ K1 → ⬇[Ⓕ, l, m] L2 ≡ K2 →
- ∀T. ⬆[l, m] T ≡ U → l ≤ lt → lt ≤ l + m → K1 ≡[T, l] K2.
-/2 width=11 by llpx_sn_inv_lift_be/ qed-.
-
-lemma lleq_inv_lift_ge: ∀L1,L2,U,lt. L1 ≡[U, lt] L2 →
- ∀K1,K2,l,m. ⬇[Ⓕ, l, m] L1 ≡ K1 → ⬇[Ⓕ, l, m] L2 ≡ K2 →
- ∀T. ⬆[l, m] T ≡ U → l + m ≤ lt → K1 ≡[T, lt-m] K2.
-/2 width=9 by llpx_sn_inv_lift_ge/ qed-.
-
-(* Inversion lemmas on negated lazy quivalence for local environments *******)
-
-lemma nlleq_inv_bind: ∀a,I,L1,L2,V,T,l. (L1 ≡[ⓑ{a,I}V.T, l] L2 → ⊥) →
- (L1 ≡[V, l] L2 → ⊥) ∨ (L1.ⓑ{I}V ≡[T, ⫯l] L2.ⓑ{I}V → ⊥).
-/3 width=2 by nllpx_sn_inv_bind, eq_term_dec/ qed-.
-
-lemma nlleq_inv_flat: ∀I,L1,L2,V,T,l. (L1 ≡[ⓕ{I}V.T, l] L2 → ⊥) →
- (L1 ≡[V, l] L2 → ⊥) ∨ (L1 ≡[T, l] L2 → ⊥).
-/3 width=2 by nllpx_sn_inv_flat, eq_term_dec/ qed-.
-
-lemma nlleq_inv_bind_O: ∀a,I,L1,L2,V,T. (L1 ≡[ⓑ{a,I}V.T, 0] L2 → ⊥) →
- (L1 ≡[V, 0] L2 → ⊥) ∨ (L1.ⓑ{I}V ≡[T, 0] L2.ⓑ{I}V → ⊥).
-/3 width=2 by nllpx_sn_inv_bind_O, eq_term_dec/ qed-.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/multiple/fqus_alt.ma".
-include "basic_2/multiple/lleq_drop.ma".
-
-(* LAZY EQUIVALENCE FOR LOCAL ENVIRONMENTS **********************************)
-
-(* Properties on supclosure *************************************************)
-
-lemma lleq_fqu_trans: ∀G1,G2,L2,K2,T,U. ⦃G1, L2, T⦄ ⊐ ⦃G2, K2, U⦄ →
- ∀L1. L1 ≡[T, 0] L2 →
- ∃∃K1. ⦃G1, L1, T⦄ ⊐ ⦃G2, K1, U⦄ & K1 ≡[U, 0] K2.
-#G1 #G2 #L2 #K2 #T #U #H elim H -G1 -G2 -L2 -K2 -T -U
-[ #I #G #L2 #V #L1 #H elim (lleq_inv_lref_ge_dx … H … I L2 V) -H //
- #K1 #H1 #H2 lapply (drop_inv_O2 … H1) -H1
- #H destruct /2 width=3 by fqu_lref_O, ex2_intro/
-| * [ #a ] #I #G #L2 #V #T #L1 #H
- [ elim (lleq_inv_bind … H)
- | elim (lleq_inv_flat … H)
- ] -H
- /2 width=3 by fqu_pair_sn, ex2_intro/
-| #a #I #G #L2 #V #T #L1 #H elim (lleq_inv_bind_O … H) -H
- #H3 #H4 /2 width=3 by fqu_bind_dx, ex2_intro/
-| #I #G #L2 #V #T #L1 #H elim (lleq_inv_flat … H) -H
- /2 width=3 by fqu_flat_dx, ex2_intro/
-| #G #L2 #K2 #T #U #m #HLK2 #HTU #L1 #HL12
- elim (drop_O1_le (Ⓕ) (m+1) L1)
- [ /3 width=12 by fqu_drop, lleq_inv_lift_le, ex2_intro/
- | lapply (drop_fwd_length_le2 … HLK2) -K2
- lapply (lleq_fwd_length … HL12) -T -U //
- ]
-]
-qed-.
-
-lemma lleq_fquq_trans: ∀G1,G2,L2,K2,T,U. ⦃G1, L2, T⦄ ⊐⸮ ⦃G2, K2, U⦄ →
- ∀L1. L1 ≡[T, 0] L2 →
- ∃∃K1. ⦃G1, L1, T⦄ ⊐⸮ ⦃G2, K1, U⦄ & K1 ≡[U, 0] K2.
-#G1 #G2 #L2 #K2 #T #U #H #L1 #HL12 elim(fquq_inv_gen … H) -H
-[ #H elim (lleq_fqu_trans … H … HL12) -L2 /3 width=3 by fqu_fquq, ex2_intro/
-| * #HG #HL #HT destruct /2 width=3 by ex2_intro/
-]
-qed-.
-
-lemma lleq_fqup_trans: ∀G1,G2,L2,K2,T,U. ⦃G1, L2, T⦄ ⊐+ ⦃G2, K2, U⦄ →
- ∀L1. L1 ≡[T, 0] L2 →
- ∃∃K1. ⦃G1, L1, T⦄ ⊐+ ⦃G2, K1, U⦄ & K1 ≡[U, 0] K2.
-#G1 #G2 #L2 #K2 #T #U #H @(fqup_ind … H) -G2 -K2 -U
-[ #G2 #K2 #U #HTU #L1 #HL12 elim (lleq_fqu_trans … HTU … HL12) -L2
- /3 width=3 by fqu_fqup, ex2_intro/
-| #G #G2 #K #K2 #U #U2 #_ #HU2 #IHTU #L1 #HL12 elim (IHTU … HL12) -L2
- #K1 #HTU #HK1 elim (lleq_fqu_trans … HU2 … HK1) -K
- /3 width=5 by fqup_strap1, ex2_intro/
-]
-qed-.
-
-lemma lleq_fqus_trans: ∀G1,G2,L2,K2,T,U. ⦃G1, L2, T⦄ ⊐* ⦃G2, K2, U⦄ →
- ∀L1. L1 ≡[T, 0] L2 →
- ∃∃K1. ⦃G1, L1, T⦄ ⊐* ⦃G2, K1, U⦄ & K1 ≡[U, 0] K2.
-#G1 #G2 #L2 #K2 #T #U #H #L1 #HL12 elim(fqus_inv_gen … H) -H
-[ #H elim (lleq_fqup_trans … H … HL12) -L2 /3 width=3 by fqup_fqus, ex2_intro/
-| * #HG #HL #HT destruct /2 width=3 by ex2_intro/
-]
-qed-.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/multiple/lleq_drop.ma".
-
-(* LAZY EQUIVALENCE FOR LOCAL ENVIRONMENTS **********************************)
-
-(* Main properties **********************************************************)
-
-theorem lleq_trans: ∀l,T. Transitive … (lleq l T).
-/2 width=3 by lleq_llpx_sn_trans/ qed-.
-
-theorem lleq_canc_sn: ∀L,L1,L2,T,l. L ≡[l, T] L1→ L ≡[l, T] L2 → L1 ≡[l, T] L2.
-/3 width=3 by lleq_trans, lleq_sym/ qed-.
-
-theorem lleq_canc_dx: ∀L1,L2,L,T,l. L1 ≡[l, T] L → L2 ≡[l, T] L → L1 ≡[l, T] L2.
-/3 width=3 by lleq_trans, lleq_sym/ qed-.
-
-(* Advanced properies on negated lazy equivalence *****************************)
-
-(* Note: for use in auto, works with /4 width=8/ so lleq_canc_sn is preferred *)
-lemma lleq_nlleq_trans: ∀l,T,L1,L. L1 ≡[T, l] L →
- ∀L2. (L ≡[T, l] L2 → ⊥) → (L1 ≡[T, l] L2 → ⊥).
-/3 width=3 by lleq_canc_sn/ qed-.
-
-lemma nlleq_lleq_div: ∀l,T,L2,L. L2 ≡[T, l] L →
- ∀L1. (L1 ≡[T, l] L → ⊥) → (L1 ≡[T, l] L2 → ⊥).
-/3 width=3 by lleq_trans/ qed-.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/multiple/llor.ma".
-include "basic_2/multiple/llpx_sn_frees.ma".
-include "basic_2/multiple/lleq_alt.ma".
-
-(* LAZY EQUIVALENCE FOR LOCAL ENVIRONMENTS **********************************)
-
-(* Properties on pointwise union for local environments **********************)
-
-lemma llpx_sn_llor_dx: ∀R. (s_r_confluent1 … R (llpx_sn R 0)) → (frees_trans R) →
- ∀L1,L2,T,l. llpx_sn R l T L1 L2 → ∀L. L1 ⋓[T, l] L2 ≡ L → L2 ≡[T, l] L.
-#R #H1R #H2R #L1 #L2 #T #l #H1 #L #H2
-lapply (llpx_sn_frees_trans … H1R H2R … H1) -H1R -H2R #HR
-elim (llpx_sn_llpx_sn_alt … H1) -H1 #HL12 #IH1
-elim H2 -H2 #_ #HL1 #IH2
-@lleq_intro_alt // #I2 #I #K2 #K #V2 #V #i #Hi #HnT #HLK2 #HLK
-lapply (drop_fwd_length_lt2 … HLK) #HiL
-elim (drop_O1_lt (Ⓕ) L1 i) // -HiL #I1 #K1 #V1 #HLK1
-elim (IH1 … HLK1 HLK2) -IH1 /2 width=1 by/ #H #_ destruct
-elim (IH2 … HLK1 HLK2 HLK) -IH2 -HLK1 -HLK2 -HLK * /2 width=1 by conj/ #H
-[ elim (ylt_yle_false … H) -H //
-| elim H -H /2 width=1 by/
-]
-qed.
-
-lemma llpx_sn_llor_dx_sym: ∀R. (s_r_confluent1 … R (llpx_sn R 0)) → (frees_trans R) →
- ∀L1,L2,T,l. llpx_sn R l T L1 L2 → ∀L. L1 ⋓[T, l] L2 ≡ L → L ≡[T, l] L2.
-/3 width=6 by llpx_sn_llor_dx, lleq_sym/ qed.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/multiple/llpx_sn_lreq.ma".
-include "basic_2/multiple/lleq.ma".
-
-(* LAZY EQUIVALENCE FOR LOCAL ENVIRONMENTS **********************************)
-
-(* Properties on equivalence for local environments *************************)
-
-lemma lreq_lleq_trans: ∀L2,L,T,l. L2 ≡[T, l] L →
- ∀L1. L1 ⩬[l, ∞] L2 → L1 ≡[T, l] L.
-/2 width=3 by lreq_llpx_sn_trans/ qed-.
-
-lemma lleq_lreq_trans: ∀L,L1,T,l. L ≡[T, l] L1 →
- ∀L2. L1 ⩬[l, ∞] L2 → L ≡[T, l] L2.
-/2 width=3 by llpx_sn_lreq_trans/ qed-.
-
-lemma lleq_lreq_repl: ∀L1,L2,T,l. L1 ≡[T, l] L2 → ∀K1. K1 ⩬[l, ∞] L1 →
- ∀K2. L2 ⩬[l, ∞] K2 → K1 ≡[T, l] K2.
-/2 width=5 by llpx_sn_lreq_repl/ qed-.
-
-lemma lleq_bind_repl_SO: ∀I1,I2,L1,L2,V1,V2,T. L1.ⓑ{I1}V1 ≡[T, 0] L2.ⓑ{I2}V2 →
- ∀J1,J2,W1,W2. L1.ⓑ{J1}W1 ≡[T, 1] L2.ⓑ{J2}W2.
-/2 width=5 by llpx_sn_bind_repl_SO/ qed-.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/notation/relations/lazyor_5.ma".
-include "basic_2/multiple/frees.ma".
-
-(* POINTWISE UNION FOR LOCAL ENVIRONMENTS ***********************************)
-
-definition llor: ynat → relation4 term lenv lenv lenv ≝ λl,T,L2,L1,L.
- ∧∧ |L1| = |L2| & |L1| = |L|
- & (∀I1,I2,I,K1,K2,K,V1,V2,V,i.
- ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 → ⬇[i] L ≡ K.ⓑ{I}V → ∨∨
- (∧∧ yinj i < l & I1 = I & V1 = V) |
- (∧∧ (L1 ⊢ i ϵ 𝐅*[l]⦃T⦄ → ⊥) & I1 = I & V1 = V) |
- (∧∧ l ≤ yinj i & L1 ⊢ i ϵ 𝐅*[l]⦃T⦄ & I2 = I & V2 = V)
- ).
-
-interpretation
- "lazy union (local environment)"
- 'LazyOr L1 T l L2 L = (llor l T L2 L1 L).
-
-(* Basic properties *********************************************************)
-
-(* Note: this can be proved by llor_skip *)
-lemma llor_atom: ∀T,l. ⋆ ⋓[T, l] ⋆ ≡ ⋆.
-#T #l @and3_intro //
-#I1 #I2 #I #K1 #K2 #K #V1 #V2 #V #i #HLK1
-elim (drop_inv_atom1 … HLK1) -HLK1 #H destruct
-qed.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/multiple/frees_append.ma".
-include "basic_2/multiple/llor.ma".
-
-(* POINTWISE UNION FOR LOCAL ENVIRONMENTS ***********************************)
-
-(* Alternative definition ***************************************************)
-
-lemma llor_tail_frees: ∀L1,L2,L,U,l. L1 ⋓[U, l] L2 ≡ L → l ≤ yinj (|L1|) →
- ∀I1,W1. ⓑ{I1}W1.L1 ⊢ |L1| ϵ 𝐅*[l]⦃U⦄ →
- ∀I2,W2. ⓑ{I1}W1.L1 ⋓[U, l] ⓑ{I2}W2.L2 ≡ ⓑ{I2}W2.L.
-#L1 #L2 #L #U #l * #HL12 #HL1 #IH #Hl #I1 #W1 #HU #I2 #W2
-@and3_intro [1,2: >ltail_length /2 width=1 by le_S_S/ ]
-#J1 #J2 #J #K1 #K2 #K #V1 #V2 #V #i #HLK1 #HLK2 #HLK
-lapply (drop_fwd_length_lt2 … HLK1) >ltail_length #H
-lapply (lt_plus_SO_to_le … H) -H #H
-elim (le_to_or_lt_eq … H) -H #H
-[ elim (drop_O1_lt (Ⓕ) … H) #Z1 #Y1 #X1 #HLY1
- elim (drop_O1_lt (Ⓕ) L2 i) // #Z2 #Y2 #X2 #HLY2
- elim (drop_O1_lt (Ⓕ) L i) // #Z #Y #X #HLY
- lapply (drop_O1_inv_append1_le … HLK1 … HLY1) /2 width=1 by lt_to_le/ -HLK1 normalize #H destruct
- lapply (drop_O1_inv_append1_le … HLK2 … HLY2) /2 width=1 by lt_to_le/ -HLK2 normalize #H destruct
- lapply (drop_O1_inv_append1_le … HLK … HLY) /2 width=1 by lt_to_le/ -HLK normalize #H destruct
- elim (IH … HLY1 HLY2 HLY) -IH -HLY1 -HLY2 -HLY *
- [ /3 width=1 by and3_intro, or3_intro0/
- | /7 width=2 by frees_inv_append, yle_inj, lt_to_le, or3_intro1, and3_intro/
- | /6 width=1 by frees_append, yle_inj, lt_to_le, or3_intro2, and4_intro/
- ]
-| -IH -HLK1 destruct
- lapply (drop_O1_inv_append1_le … HLK2 … (⋆) ?) // -HLK2 normalize #H destruct
- lapply (drop_O1_inv_append1_le … HLK … (⋆) ?) // -HLK normalize #H destruct
- /3 width=1 by or3_intro2, and4_intro/
-]
-qed.
-
-lemma llor_tail_cofrees: ∀L1,L2,L,U,l. L1 ⋓[U, l] L2 ≡ L →
- ∀I1,W1. (ⓑ{I1}W1.L1 ⊢ |L1| ϵ 𝐅*[l]⦃U⦄ → ⊥) →
- ∀I2,W2. ⓑ{I1}W1.L1 ⋓[U, l] ⓑ{I2}W2.L2 ≡ ⓑ{I1}W1.L.
-#L1 #L2 #L #U #l * #HL12 #HL1 #IH #I1 #W1 #HU #I2 #W2
-@and3_intro [1,2: >ltail_length /2 width=1 by le_S_S/ ]
-#J1 #J2 #J #K1 #K2 #K #V1 #V2 #V #i #HLK1 #HLK2 #HLK
-lapply (drop_fwd_length_lt2 … HLK1) >ltail_length #H
-lapply (lt_plus_SO_to_le … H) -H #H
-elim (le_to_or_lt_eq … H) -H #H
-[ elim (drop_O1_lt (Ⓕ) … H) #Z1 #Y1 #X1 #HLY1
- elim (drop_O1_lt (Ⓕ) L2 i) // #Z2 #Y2 #X2 #HLY2
- elim (drop_O1_lt (Ⓕ) L i) // #Z #Y #X #HLY
- lapply (drop_O1_inv_append1_le … HLK1 … HLY1) /2 width=1 by lt_to_le/ -HLK1 normalize #H destruct
- lapply (drop_O1_inv_append1_le … HLK2 … HLY2) /2 width=1 by lt_to_le/ -HLK2 normalize #H destruct
- lapply (drop_O1_inv_append1_le … HLK … HLY) /2 width=1 by lt_to_le/ -HLK normalize #H destruct
- elim (IH … HLY1 HLY2 HLY) -IH -HLY1 -HLY2 -HLY *
- [ /3 width=1 by and3_intro, or3_intro0/
- | /7 width=2 by frees_inv_append, yle_inj, lt_to_le, or3_intro1, and3_intro/
- | /6 width=1 by frees_append, yle_inj, lt_to_le, or3_intro2, and4_intro/
- ]
-| -IH -HLK2 destruct
- lapply (drop_O1_inv_append1_le … HLK1 … (⋆) ?) // -HLK1 normalize #H destruct
- lapply (drop_O1_inv_append1_le … HLK … (⋆) ?) // -HLK normalize #H destruct
- /4 width=1 by or3_intro1, and3_intro/
-]
-qed.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/multiple/frees_lift.ma".
-include "basic_2/multiple/llor_alt.ma".
-
-(* POINTWISE UNION FOR LOCAL ENVIRONMENTS ***********************************)
-
-(* Advanced properties ******************************************************)
-
-lemma llor_skip: ∀L1,L2,U,l. |L1| = |L2| → yinj (|L1|) ≤ l → L1 ⋓[U, l] L2 ≡ L1.
-#L1 #L2 #U #l #HL12 #Hl @and3_intro // -HL12
-#I1 #I2 #I #K1 #K2 #K #W1 #W2 #W #i #HLK1 #_ #HLK -L2 -K2
-lapply (drop_mono … HLK … HLK1) -HLK #H destruct
-lapply (drop_fwd_length_lt2 … HLK1) -K1
-/5 width=3 by ylt_yle_trans, ylt_inj, or3_intro0, and3_intro/
-qed.
-
-(* Note: lemma 1400 concludes the "big tree" theorem *)
-lemma llor_total: ∀L1,L2,T,l. |L1| = |L2| → ∃L. L1 ⋓[T, l] L2 ≡ L.
-#L1 @(lenv_ind_alt … L1) -L1
-[ #L2 #T #l #H >(length_inv_zero_sn … H) -L2 /2 width=2 by ex_intro/
-| #I1 #L1 #V1 #IHL1 #Y #T #l >ltail_length #H
- elim (length_inv_pos_sn_ltail … H) -H #I2 #L2 #V2 #HL12 #H destruct
- elim (ylt_split l (|ⓑ{I1}V1.L1|))
- [ elim (frees_dec (ⓑ{I1}V1.L1) T l (|L1|)) #HnU
- elim (IHL1 L2 T l) // -IHL1 -HL12
- [ #L #HL12 >ltail_length /4 width=2 by llor_tail_frees, ylt_fwd_succ2, ex_intro/
- | /4 width=2 by llor_tail_cofrees, ex_intro/
- ]
- | -IHL1 /4 width=3 by llor_skip, plus_to_minus, ex_intro/
- ]
-]
-qed-.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "ground_2/ynat/ynat_plus.ma".
-include "basic_2/substitution/drop.ma".
-
-(* LAZY SN POINTWISE EXTENSION OF A CONTEXT-SENSITIVE REALTION FOR TERMS ****)
-
-inductive llpx_sn (R:relation3 lenv term term): relation4 ynat term lenv lenv ≝
-| llpx_sn_sort: ∀L1,L2,l,k. |L1| = |L2| → llpx_sn R l (⋆k) L1 L2
-| llpx_sn_skip: ∀L1,L2,l,i. |L1| = |L2| → yinj i < l → llpx_sn R l (#i) L1 L2
-| llpx_sn_lref: ∀I,L1,L2,K1,K2,V1,V2,l,i. l ≤ yinj i →
- ⬇[i] L1 ≡ K1.ⓑ{I}V1 → ⬇[i] L2 ≡ K2.ⓑ{I}V2 →
- llpx_sn R (yinj 0) V1 K1 K2 → R K1 V1 V2 → llpx_sn R l (#i) L1 L2
-| llpx_sn_free: ∀L1,L2,l,i. |L1| ≤ i → |L2| ≤ i → |L1| = |L2| → llpx_sn R l (#i) L1 L2
-| llpx_sn_gref: ∀L1,L2,l,p. |L1| = |L2| → llpx_sn R l (§p) L1 L2
-| llpx_sn_bind: ∀a,I,L1,L2,V,T,l.
- llpx_sn R l V L1 L2 → llpx_sn R (⫯l) T (L1.ⓑ{I}V) (L2.ⓑ{I}V) →
- llpx_sn R l (ⓑ{a,I}V.T) L1 L2
-| llpx_sn_flat: ∀I,L1,L2,V,T,l.
- llpx_sn R l V L1 L2 → llpx_sn R l T L1 L2 → llpx_sn R l (ⓕ{I}V.T) L1 L2
-.
-
-(* Basic inversion lemmas ***************************************************)
-
-fact llpx_sn_inv_bind_aux: ∀R,L1,L2,X,l. llpx_sn R l X L1 L2 →
- ∀a,I,V,T. X = ⓑ{a,I}V.T →
- llpx_sn R l V L1 L2 ∧ llpx_sn R (⫯l) T (L1.ⓑ{I}V) (L2.ⓑ{I}V).
-#R #L1 #L2 #X #l * -L1 -L2 -X -l
-[ #L1 #L2 #l #k #_ #b #J #W #U #H destruct
-| #L1 #L2 #l #i #_ #_ #b #J #W #U #H destruct
-| #I #L1 #L2 #K1 #K2 #V1 #V2 #l #i #_ #_ #_ #_ #_ #b #J #W #U #H destruct
-| #L1 #L2 #l #i #_ #_ #_ #b #J #W #U #H destruct
-| #L1 #L2 #l #p #_ #b #J #W #U #H destruct
-| #a #I #L1 #L2 #V #T #l #HV #HT #b #J #W #U #H destruct /2 width=1 by conj/
-| #I #L1 #L2 #V #T #l #_ #_ #b #J #W #U #H destruct
-]
-qed-.
-
-lemma llpx_sn_inv_bind: ∀R,a,I,L1,L2,V,T,l. llpx_sn R l (ⓑ{a,I}V.T) L1 L2 →
- llpx_sn R l V L1 L2 ∧ llpx_sn R (⫯l) T (L1.ⓑ{I}V) (L2.ⓑ{I}V).
-/2 width=4 by llpx_sn_inv_bind_aux/ qed-.
-
-fact llpx_sn_inv_flat_aux: ∀R,L1,L2,X,l. llpx_sn R l X L1 L2 →
- ∀I,V,T. X = ⓕ{I}V.T →
- llpx_sn R l V L1 L2 ∧ llpx_sn R l T L1 L2.
-#R #L1 #L2 #X #l * -L1 -L2 -X -l
-[ #L1 #L2 #l #k #_ #J #W #U #H destruct
-| #L1 #L2 #l #i #_ #_ #J #W #U #H destruct
-| #I #L1 #L2 #K1 #K2 #V1 #V2 #l #i #_ #_ #_ #_ #_ #J #W #U #H destruct
-| #L1 #L2 #l #i #_ #_ #_ #J #W #U #H destruct
-| #L1 #L2 #l #p #_ #J #W #U #H destruct
-| #a #I #L1 #L2 #V #T #l #_ #_ #J #W #U #H destruct
-| #I #L1 #L2 #V #T #l #HV #HT #J #W #U #H destruct /2 width=1 by conj/
-]
-qed-.
-
-lemma llpx_sn_inv_flat: ∀R,I,L1,L2,V,T,l. llpx_sn R l (ⓕ{I}V.T) L1 L2 →
- llpx_sn R l V L1 L2 ∧ llpx_sn R l T L1 L2.
-/2 width=4 by llpx_sn_inv_flat_aux/ qed-.
-
-(* Basic forward lemmas *****************************************************)
-
-lemma llpx_sn_fwd_length: ∀R,L1,L2,T,l. llpx_sn R l T L1 L2 → |L1| = |L2|.
-#R #L1 #L2 #T #l #H elim H -L1 -L2 -T -l //
-#I #L1 #L2 #K1 #K2 #V1 #V2 #l #i #_ #HLK1 #HLK2 #_ #_ #HK12
-lapply (drop_fwd_length … HLK1) -HLK1
-lapply (drop_fwd_length … HLK2) -HLK2
-normalize //
-qed-.
-
-lemma llpx_sn_fwd_drop_sn: ∀R,L1,L2,T,l. llpx_sn R l T L1 L2 →
- ∀K1,i. ⬇[i] L1 ≡ K1 → ∃K2. ⬇[i] L2 ≡ K2.
-#R #L1 #L2 #T #l #H #K1 #i #HLK1 lapply (llpx_sn_fwd_length … H) -H
-#HL12 lapply (drop_fwd_length_le2 … HLK1) -HLK1 /2 width=1 by drop_O1_le/
-qed-.
-
-lemma llpx_sn_fwd_drop_dx: ∀R,L1,L2,T,l. llpx_sn R l T L1 L2 →
- ∀K2,i. ⬇[i] L2 ≡ K2 → ∃K1. ⬇[i] L1 ≡ K1.
-#R #L1 #L2 #T #l #H #K2 #i #HLK2 lapply (llpx_sn_fwd_length … H) -H
-#HL12 lapply (drop_fwd_length_le2 … HLK2) -HLK2 /2 width=1 by drop_O1_le/
-qed-.
-
-fact llpx_sn_fwd_lref_aux: ∀R,L1,L2,X,l. llpx_sn R l X L1 L2 → ∀i. X = #i →
- ∨∨ |L1| ≤ i ∧ |L2| ≤ i
- | yinj i < l
- | ∃∃I,K1,K2,V1,V2. ⬇[i] L1 ≡ K1.ⓑ{I}V1 &
- ⬇[i] L2 ≡ K2.ⓑ{I}V2 &
- llpx_sn R (yinj 0) V1 K1 K2 &
- R K1 V1 V2 & l ≤ yinj i.
-#R #L1 #L2 #X #l * -L1 -L2 -X -l
-[ #L1 #L2 #l #k #_ #j #H destruct
-| #L1 #L2 #l #i #_ #Hil #j #H destruct /2 width=1 by or3_intro1/
-| #I #L1 #L2 #K1 #K2 #V1 #V2 #l #i #Hli #HLK1 #HLK2 #HK12 #HV12 #j #H destruct
- /3 width=9 by or3_intro2, ex5_5_intro/
-| #L1 #L2 #l #i #HL1 #HL2 #_ #j #H destruct /3 width=1 by or3_intro0, conj/
-| #L1 #L2 #l #p #_ #j #H destruct
-| #a #I #L1 #L2 #V #T #l #_ #_ #j #H destruct
-| #I #L1 #L2 #V #T #l #_ #_ #j #H destruct
-]
-qed-.
-
-lemma llpx_sn_fwd_lref: ∀R,L1,L2,l,i. llpx_sn R l (#i) L1 L2 →
- ∨∨ |L1| ≤ i ∧ |L2| ≤ i
- | yinj i < l
- | ∃∃I,K1,K2,V1,V2. ⬇[i] L1 ≡ K1.ⓑ{I}V1 &
- ⬇[i] L2 ≡ K2.ⓑ{I}V2 &
- llpx_sn R (yinj 0) V1 K1 K2 &
- R K1 V1 V2 & l ≤ yinj i.
-/2 width=3 by llpx_sn_fwd_lref_aux/ qed-.
-
-lemma llpx_sn_fwd_bind_sn: ∀R,a,I,L1,L2,V,T,l. llpx_sn R l (ⓑ{a,I}V.T) L1 L2 →
- llpx_sn R l V L1 L2.
-#R #a #I #L1 #L2 #V #T #l #H elim (llpx_sn_inv_bind … H) -H //
-qed-.
-
-lemma llpx_sn_fwd_bind_dx: ∀R,a,I,L1,L2,V,T,l. llpx_sn R l (ⓑ{a,I}V.T) L1 L2 →
- llpx_sn R (⫯l) T (L1.ⓑ{I}V) (L2.ⓑ{I}V).
-#R #a #I #L1 #L2 #V #T #l #H elim (llpx_sn_inv_bind … H) -H //
-qed-.
-
-lemma llpx_sn_fwd_flat_sn: ∀R,I,L1,L2,V,T,l. llpx_sn R l (ⓕ{I}V.T) L1 L2 →
- llpx_sn R l V L1 L2.
-#R #I #L1 #L2 #V #T #l #H elim (llpx_sn_inv_flat … H) -H //
-qed-.
-
-lemma llpx_sn_fwd_flat_dx: ∀R,I,L1,L2,V,T,l. llpx_sn R l (ⓕ{I}V.T) L1 L2 →
- llpx_sn R l T L1 L2.
-#R #I #L1 #L2 #V #T #l #H elim (llpx_sn_inv_flat … H) -H //
-qed-.
-
-lemma llpx_sn_fwd_pair_sn: ∀R,I,L1,L2,V,T,l. llpx_sn R l (②{I}V.T) L1 L2 →
- llpx_sn R l V L1 L2.
-#R * /2 width=4 by llpx_sn_fwd_flat_sn, llpx_sn_fwd_bind_sn/
-qed-.
-
-(* Basic properties *********************************************************)
-
-lemma llpx_sn_refl: ∀R. (∀L. reflexive … (R L)) → ∀T,L,l. llpx_sn R l T L L.
-#R #HR #T #L @(f2_ind … rfw … L T) -L -T
-#x #IH #L * * /3 width=1 by llpx_sn_sort, llpx_sn_gref, llpx_sn_bind, llpx_sn_flat/
-#i #Hx elim (lt_or_ge i (|L|)) /2 width=1 by llpx_sn_free/
-#HiL #l elim (ylt_split i l) /2 width=1 by llpx_sn_skip/
-elim (drop_O1_lt … HiL) -HiL destruct /4 width=9 by llpx_sn_lref, drop_fwd_rfw/
-qed-.
-
-lemma llpx_sn_Y: ∀R,T,L1,L2. |L1| = |L2| → llpx_sn R (∞) T L1 L2.
-#R #T #L1 @(f2_ind … rfw … L1 T) -L1 -T
-#x #IH #L1 * * /3 width=1 by llpx_sn_sort, llpx_sn_skip, llpx_sn_gref, llpx_sn_flat/
-#a #I #V1 #T1 #Hx #L2 #HL12
-@llpx_sn_bind /2 width=1 by/ (**) (* explicit constructor *)
-@IH -IH // normalize /2 width=1 by eq_f2/
-qed-.
-
-lemma llpx_sn_ge_up: ∀R,L1,L2,U,lt. llpx_sn R lt U L1 L2 → ∀T,l,m. ⬆[l, m] T ≡ U →
- lt ≤ l + m → llpx_sn R l U L1 L2.
-#R #L1 #L2 #U #lt #H elim H -L1 -L2 -U -lt
-[ #L1 #L2 #lt #k #HL12 #X #l #m #H #_ >(lift_inv_sort2 … H) -H /2 width=1 by llpx_sn_sort/
-| #L1 #L2 #lt #i #HL12 #Hilt #X #l #m #H #Hltlm
- elim (lift_inv_lref2 … H) -H * #Hil #H destruct /3 width=1 by llpx_sn_skip, ylt_inj/ -HL12
- elim (ylt_yle_false … Hilt) -Hilt
- @(yle_trans … Hltlm) /2 width=1 by yle_inj/ (**) (* full auto too slow 11s *)
-| #I #L1 #L2 #K1 #K2 #W1 #W2 #lt #i #Hlti #HLK1 #HLK2 #HW1 #HW12 #_ #X #l #m #H #_
- elim (lift_inv_lref2 … H) -H * #Hil #H destruct
- [ lapply (llpx_sn_fwd_length … HW1) -HW1 #HK12
- lapply (drop_fwd_length … HLK1) lapply (drop_fwd_length … HLK2)
- normalize in ⊢ (%→%→?); -I -W1 -W2 -lt /3 width=1 by llpx_sn_skip, ylt_inj/
- | /3 width=9 by llpx_sn_lref, yle_fwd_plus_sn1/
- ]
-| /2 width=1 by llpx_sn_free/
-| #L1 #L2 #lt #p #HL12 #X #l #m #H #_ >(lift_inv_gref2 … H) -H /2 width=1 by llpx_sn_gref/
-| #a #I #L1 #L2 #W #U #lt #_ #_ #IHV #IHT #X #l #m #H #Hltlm destruct
- elim (lift_inv_bind2 … H) -H #V #T #HVW #HTU #H destruct
- @(llpx_sn_bind) /2 width=4 by/ (**) (* full auto fails *)
- @(IHT … HTU) /2 width=1 by yle_succ/
-| #I #L1 #L2 #W #U #lt #_ #_ #IHV #IHT #X #l #m #H #Hltlm destruct
- elim (lift_inv_flat2 … H) -H #HVW #HTU #H destruct
- /3 width=4 by llpx_sn_flat/
-]
-qed-.
-
-(**) (* the minor premise comes first *)
-lemma llpx_sn_ge: ∀R,L1,L2,T,l1,l2. l1 ≤ l2 →
- llpx_sn R l1 T L1 L2 → llpx_sn R l2 T L1 L2.
-#R #L1 #L2 #T #l1 #l2 * -l1 -l2 (**) (* destructed yle *)
-/3 width=6 by llpx_sn_ge_up, llpx_sn_Y, llpx_sn_fwd_length, yle_inj/
-qed-.
-
-lemma llpx_sn_bind_O: ∀R,a,I,L1,L2,V,T. llpx_sn R 0 V L1 L2 →
- llpx_sn R 0 T (L1.ⓑ{I}V) (L2.ⓑ{I}V) →
- llpx_sn R 0 (ⓑ{a,I}V.T) L1 L2.
-/3 width=3 by llpx_sn_ge, llpx_sn_bind/ qed-.
-
-lemma llpx_sn_co: ∀R1,R2. (∀L,T1,T2. R1 L T1 T2 → R2 L T1 T2) →
- ∀L1,L2,T,l. llpx_sn R1 l T L1 L2 → llpx_sn R2 l T L1 L2.
-#R1 #R2 #HR12 #L1 #L2 #T #l #H elim H -L1 -L2 -T -l
-/3 width=9 by llpx_sn_sort, llpx_sn_skip, llpx_sn_lref, llpx_sn_free, llpx_sn_gref, llpx_sn_bind, llpx_sn_flat/
-qed-.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/multiple/frees.ma".
-include "basic_2/multiple/llpx_sn_alt_rec.ma".
-
-(* LAZY SN POINTWISE EXTENSION OF A CONTEXT-SENSITIVE REALTION FOR TERMS ****)
-
-(* alternative definition of llpx_sn (not recursive) *)
-definition llpx_sn_alt: relation3 lenv term term → relation4 ynat term lenv lenv ≝
- λR,l,T,L1,L2. |L1| = |L2| ∧
- (∀I1,I2,K1,K2,V1,V2,i. l ≤ yinj i → L1 ⊢ i ϵ 𝐅*[l]⦃T⦄ →
- ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
- I1 = I2 ∧ R K1 V1 V2
- ).
-
-(* Main properties **********************************************************)
-
-theorem llpx_sn_llpx_sn_alt: ∀R,T,L1,L2,l. llpx_sn R l T L1 L2 → llpx_sn_alt R l T L1 L2.
-#R #U #L1 @(f2_ind … rfw … L1 U) -L1 -U
-#x #IHx #L1 #U #Hx #L2 #l #H elim (llpx_sn_inv_alt_r … H) -H
-#HL12 #IHU @conj //
-#I1 #I2 #K1 #K2 #V1 #V2 #i #Hli #H #HLK1 #HLK2 elim (frees_inv … H) -H
-[ -x #HnU elim (IHU … HnU HLK1 HLK2) -IHU -HnU -HLK1 -HLK2 /2 width=1 by conj/
-| * #J1 #K10 #W10 #j #Hlj #Hji #HnU #HLK10 <yminus_SO2 >yminus_inj >yminus_inj #HnW10 destruct
- lapply (drop_fwd_drop2 … HLK10) #H
- lapply (drop_conf_ge … H … HLK1 ?) -H /2 width=1 by ylt_fwd_le_succ1/ <minus_plus #HK10
- elim (drop_O1_lt (Ⓕ) L2 j) [2: <HL12 /2 width=5 by drop_fwd_length_lt2/ ] #J2 #K20 #W20 #HLK20
- lapply (drop_fwd_drop2 … HLK20) #H
- lapply (drop_conf_ge … H … HLK2 ?) -H /2 width=1 by ylt_fwd_le_succ1/ <minus_plus #HK20
- elim (IHx K10 W10 … K20 0 ?) -IHx -HL12 /3 width=6 by drop_fwd_rfw/
- elim (IHU … HnU HLK10 HLK20) -IHU -HnU -HLK10 -HLK20 /2 width=6 by/
-]
-qed.
-
-theorem llpx_sn_alt_inv_llpx_sn: ∀R,T,L1,L2,l. llpx_sn_alt R l T L1 L2 → llpx_sn R l T L1 L2.
-#R #U #L1 @(f2_ind … rfw … L1 U) -L1 -U
-#x #IHx #L1 #U #Hx #L2 #l * #HL12 #IHU @llpx_sn_intro_alt_r //
-#I1 #I2 #K1 #K2 #V1 #V2 #i #Hli #HnU #HLK1 #HLK2 destruct
-elim (IHU … HLK1 HLK2) /3 width=2 by frees_eq/
-#H #HV12 @and3_intro // @IHx -IHx /3 width=6 by drop_fwd_rfw/
-lapply (drop_fwd_drop2 … HLK1) #H1
-lapply (drop_fwd_drop2 … HLK2) -HLK2 #H2
-@conj [ @(drop_fwd_length_eq1 … H1 H2) // ] -HL12
-#Z1 #Z2 #Y1 #Y2 #X1 #X2 #j #_
->(minus_plus_m_m j (i+1)) in ⊢ (%→?); >commutative_plus <minus_plus
-<yminus_inj <yminus_inj >yminus_SO2
-#HnV1 #HKY1 #HKY2 (**) (* full auto too slow *)
-lapply (drop_trans_ge … H1 … HKY1 ?) -H1 -HKY1 // #HLY1
-lapply (drop_trans_ge … H2 … HKY2 ?) -H2 -HKY2 // #HLY2
-/4 width=9 by frees_be, yle_plus_dx2_trans, yle_succ_dx, ylt_inj/
-qed-.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/substitution/lift_neg.ma".
-include "basic_2/substitution/drop_drop.ma".
-include "basic_2/multiple/llpx_sn.ma".
-
-(* LAZY SN POINTWISE EXTENSION OF A CONTEXT-SENSITIVE REALTION FOR TERMS ****)
-
-(* alternative definition of llpx_sn (recursive) *)
-inductive llpx_sn_alt_r (R:relation3 lenv term term): relation4 ynat term lenv lenv ≝
-| llpx_sn_alt_r_intro: ∀L1,L2,T,l.
- (∀I1,I2,K1,K2,V1,V2,i. l ≤ yinj i → (∀U. ⬆[i, 1] U ≡ T → ⊥) →
- ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 → I1 = I2 ∧ R K1 V1 V2
- ) →
- (∀I1,I2,K1,K2,V1,V2,i. l ≤ yinj i → (∀U. ⬆[i, 1] U ≡ T → ⊥) →
- ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 → llpx_sn_alt_r R 0 V1 K1 K2
- ) → |L1| = |L2| → llpx_sn_alt_r R l T L1 L2
-.
-
-(* Compact definition of llpx_sn_alt_r **************************************)
-
-lemma llpx_sn_alt_r_intro_alt: ∀R,L1,L2,T,l. |L1| = |L2| →
- (∀I1,I2,K1,K2,V1,V2,i. l ≤ yinj i → (∀U. ⬆[i, 1] U ≡ T → ⊥) →
- ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
- ∧∧ I1 = I2 & R K1 V1 V2 & llpx_sn_alt_r R 0 V1 K1 K2
- ) → llpx_sn_alt_r R l T L1 L2.
-#R #L1 #L2 #T #l #HL12 #IH @llpx_sn_alt_r_intro // -HL12
-#I1 #I2 #K1 #K2 #V1 #V2 #i #Hil #HnT #HLK1 #HLK2
-elim (IH … HnT HLK1 HLK2) -IH -HnT -HLK1 -HLK2 /2 width=1 by conj/
-qed.
-
-lemma llpx_sn_alt_r_ind_alt: ∀R. ∀S:relation4 ynat term lenv lenv.
- (∀L1,L2,T,l. |L1| = |L2| → (
- ∀I1,I2,K1,K2,V1,V2,i. l ≤ yinj i → (∀U. ⬆[i, 1] U ≡ T → ⊥) →
- ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
- ∧∧ I1 = I2 & R K1 V1 V2 & llpx_sn_alt_r R 0 V1 K1 K2 & S 0 V1 K1 K2
- ) → S l T L1 L2) →
- ∀L1,L2,T,l. llpx_sn_alt_r R l T L1 L2 → S l T L1 L2.
-#R #S #IH #L1 #L2 #T #l #H elim H -L1 -L2 -T -l
-#L1 #L2 #T #l #H1 #H2 #HL12 #IH2 @IH -IH // -HL12
-#I1 #I2 #K1 #K2 #V1 #V2 #i #Hil #HnT #HLK1 #HLK2
-elim (H1 … HnT HLK1 HLK2) -H1 /4 width=8 by and4_intro/
-qed-.
-
-lemma llpx_sn_alt_r_inv_alt: ∀R,L1,L2,T,l. llpx_sn_alt_r R l T L1 L2 →
- |L1| = |L2| ∧
- ∀I1,I2,K1,K2,V1,V2,i. l ≤ yinj i → (∀U. ⬆[i, 1] U ≡ T → ⊥) →
- ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
- ∧∧ I1 = I2 & R K1 V1 V2 & llpx_sn_alt_r R 0 V1 K1 K2.
-#R #L1 #L2 #T #l #H @(llpx_sn_alt_r_ind_alt … H) -L1 -L2 -T -l
-#L1 #L2 #T #l #HL12 #IH @conj // -HL12
-#I1 #I2 #K1 #K2 #V1 #V2 #i #Hil #HnT #HLK1 #HLK2
-elim (IH … HnT HLK1 HLK2) -IH -HnT -HLK1 -HLK2 /2 width=1 by and3_intro/
-qed-.
-
-(* Basic inversion lemmas ***************************************************)
-
-lemma llpx_sn_alt_r_inv_flat: ∀R,I,L1,L2,V,T,l. llpx_sn_alt_r R l (ⓕ{I}V.T) L1 L2 →
- llpx_sn_alt_r R l V L1 L2 ∧ llpx_sn_alt_r R l T L1 L2.
-#R #I #L1 #L2 #V #T #l #H elim (llpx_sn_alt_r_inv_alt … H) -H
-#HL12 #IH @conj @llpx_sn_alt_r_intro_alt // -HL12
-#I1 #I2 #K1 #K2 #V1 #V2 #i #Hli #H #HLK1 #HLK2
-elim (IH … HLK1 HLK2) -IH -HLK1 -HLK2 //
-/3 width=8 by nlift_flat_sn, nlift_flat_dx, and3_intro/
-qed-.
-
-lemma llpx_sn_alt_r_inv_bind: ∀R,a,I,L1,L2,V,T,l. llpx_sn_alt_r R l (ⓑ{a,I}V.T) L1 L2 →
- llpx_sn_alt_r R l V L1 L2 ∧ llpx_sn_alt_r R (⫯l) T (L1.ⓑ{I}V) (L2.ⓑ{I}V).
-#R #a #I #L1 #L2 #V #T #l #H elim (llpx_sn_alt_r_inv_alt … H) -H
-#HL12 #IH @conj @llpx_sn_alt_r_intro_alt [1,3: normalize // ] -HL12
-#I1 #I2 #K1 #K2 #V1 #V2 #i #Hli #H #HLK1 #HLK2
-[ elim (IH … HLK1 HLK2) -IH -HLK1 -HLK2
- /3 width=9 by nlift_bind_sn, and3_intro/
-| lapply (yle_inv_succ1 … Hli) -Hli * #Hli #Hi <yminus_SO2 in Hli; #Hli
- lapply (drop_inv_drop1_lt … HLK1 ?) -HLK1 /2 width=1 by ylt_O/ #HLK1
- lapply (drop_inv_drop1_lt … HLK2 ?) -HLK2 /2 width=1 by ylt_O/ #HLK2
- elim (IH … HLK1 HLK2) -IH -HLK1 -HLK2 /3 width=9 by nlift_bind_dx, and3_intro/
-]
-qed-.
-
-(* Basic forward lemmas *****************************************************)
-
-lemma llpx_sn_alt_r_fwd_length: ∀R,L1,L2,T,l. llpx_sn_alt_r R l T L1 L2 → |L1| = |L2|.
-#R #L1 #L2 #T #l #H elim (llpx_sn_alt_r_inv_alt … H) -H //
-qed-.
-
-lemma llpx_sn_alt_r_fwd_lref: ∀R,L1,L2,l,i. llpx_sn_alt_r R l (#i) L1 L2 →
- ∨∨ |L1| ≤ i ∧ |L2| ≤ i
- | yinj i < l
- | ∃∃I,K1,K2,V1,V2. ⬇[i] L1 ≡ K1.ⓑ{I}V1 &
- ⬇[i] L2 ≡ K2.ⓑ{I}V2 &
- llpx_sn_alt_r R (yinj 0) V1 K1 K2 &
- R K1 V1 V2 & l ≤ yinj i.
-#R #L1 #L2 #l #i #H elim (llpx_sn_alt_r_inv_alt … H) -H
-#HL12 #IH elim (lt_or_ge i (|L1|)) /3 width=1 by or3_intro0, conj/
-elim (ylt_split i l) /3 width=1 by or3_intro1/
-#Hli #HL1 elim (drop_O1_lt (Ⓕ) … HL1)
-#I1 #K1 #V1 #HLK1 elim (drop_O1_lt (Ⓕ) L2 i) //
-#I2 #K2 #V2 #HLK2 elim (IH … HLK1 HLK2) -IH
-/3 width=9 by nlift_lref_be_SO, or3_intro2, ex5_5_intro/
-qed-.
-
-(* Basic properties *********************************************************)
-
-lemma llpx_sn_alt_r_sort: ∀R,L1,L2,l,k. |L1| = |L2| → llpx_sn_alt_r R l (⋆k) L1 L2.
-#R #L1 #L2 #l #k #HL12 @llpx_sn_alt_r_intro_alt // -HL12
-#I1 #I2 #K1 #K2 #V1 #V2 #i #_ #H elim (H (⋆k)) //
-qed.
-
-lemma llpx_sn_alt_r_gref: ∀R,L1,L2,l,p. |L1| = |L2| → llpx_sn_alt_r R l (§p) L1 L2.
-#R #L1 #L2 #l #p #HL12 @llpx_sn_alt_r_intro_alt // -HL12
-#I1 #I2 #K1 #K2 #V1 #V2 #i #_ #H elim (H (§p)) //
-qed.
-
-lemma llpx_sn_alt_r_skip: ∀R,L1,L2,l,i. |L1| = |L2| → yinj i < l → llpx_sn_alt_r R l (#i) L1 L2.
-#R #L1 #L2 #l #i #HL12 #Hil @llpx_sn_alt_r_intro_alt // -HL12
-#I1 #I2 #K1 #K2 #V1 #V2 #j #Hlj #H elim (H (#i)) -H
-/4 width=3 by lift_lref_lt, ylt_yle_trans, ylt_inv_inj/
-qed.
-
-lemma llpx_sn_alt_r_free: ∀R,L1,L2,l,i. |L1| ≤ i → |L2| ≤ i → |L1| = |L2| →
- llpx_sn_alt_r R l (#i) L1 L2.
-#R #L1 #L2 #l #i #HL1 #_ #HL12 @llpx_sn_alt_r_intro_alt // -HL12
-#I1 #I2 #K1 #K2 #V1 #V2 #j #_ #H #HLK1 elim (H (#(i-1))) -H
-lapply (drop_fwd_length_lt2 … HLK1) -HLK1
-/4 width=3 by lift_lref_ge_minus, yle_inj, transitive_le/
-qed.
-
-lemma llpx_sn_alt_r_lref: ∀R,I,L1,L2,K1,K2,V1,V2,l,i. l ≤ yinj i →
- ⬇[i] L1 ≡ K1.ⓑ{I}V1 → ⬇[i] L2 ≡ K2.ⓑ{I}V2 →
- llpx_sn_alt_r R 0 V1 K1 K2 → R K1 V1 V2 →
- llpx_sn_alt_r R l (#i) L1 L2.
-#R #I #L1 #L2 #K1 #K2 #V1 #V2 #l #i #Hli #HLK1 #HLK2 #HK12 #HV12 @llpx_sn_alt_r_intro_alt
-[ lapply (llpx_sn_alt_r_fwd_length … HK12) -HK12 #HK12
- @(drop_fwd_length_eq2 … HLK1 HLK2) normalize //
-| #Z1 #Z2 #Y1 #Y2 #X1 #X2 #j #Hlj #H #HLY1 #HLY2
- elim (lt_or_eq_or_gt i j) #Hij destruct
- [ elim (H (#i)) -H /3 width=1 by lift_lref_lt, ylt_inj/
- | lapply (drop_mono … HLY1 … HLK1) -HLY1 -HLK1 #H destruct
- lapply (drop_mono … HLY2 … HLK2) -HLY2 -HLK2 #H destruct /2 width=1 by and3_intro/
- | elim (H (#(i-1))) -H /3 width=1 by lift_lref_ge_minus, yle_inj/
- ]
-]
-qed.
-
-lemma llpx_sn_alt_r_flat: ∀R,I,L1,L2,V,T,l.
- llpx_sn_alt_r R l V L1 L2 → llpx_sn_alt_r R l T L1 L2 →
- llpx_sn_alt_r R l (ⓕ{I}V.T) L1 L2.
-#R #I #L1 #L2 #V #T #l #HV #HT
-elim (llpx_sn_alt_r_inv_alt … HV) -HV #HL12 #IHV
-elim (llpx_sn_alt_r_inv_alt … HT) -HT #_ #IHT
-@llpx_sn_alt_r_intro_alt // -HL12
-#I1 #I2 #K1 #K2 #V1 #V2 #i #Hli #HnVT #HLK1 #HLK2
-elim (nlift_inv_flat … HnVT) -HnVT #H
-[ elim (IHV … HLK1 … HLK2) -IHV /2 width=2 by and3_intro/
-| elim (IHT … HLK1 … HLK2) -IHT /3 width=2 by and3_intro/
-]
-qed.
-
-lemma llpx_sn_alt_r_bind: ∀R,a,I,L1,L2,V,T,l.
- llpx_sn_alt_r R l V L1 L2 →
- llpx_sn_alt_r R (⫯l) T (L1.ⓑ{I}V) (L2.ⓑ{I}V) →
- llpx_sn_alt_r R l (ⓑ{a,I}V.T) L1 L2.
-#R #a #I #L1 #L2 #V #T #l #HV #HT
-elim (llpx_sn_alt_r_inv_alt … HV) -HV #HL12 #IHV
-elim (llpx_sn_alt_r_inv_alt … HT) -HT #_ #IHT
-@llpx_sn_alt_r_intro_alt // -HL12
-#I1 #I2 #K1 #K2 #V1 #V2 #i #Hli #HnVT #HLK1 #HLK2
-elim (nlift_inv_bind … HnVT) -HnVT #H
-[ elim (IHV … HLK1 … HLK2) -IHV /2 width=2 by and3_intro/
-| elim IHT -IHT /2 width=12 by drop_drop, yle_succ, and3_intro/
-]
-qed.
-
-(* Main properties **********************************************************)
-
-theorem llpx_sn_lpx_sn_alt_r: ∀R,L1,L2,T,l. llpx_sn R l T L1 L2 → llpx_sn_alt_r R l T L1 L2.
-#R #L1 #L2 #T #l #H elim H -L1 -L2 -T -l
-/2 width=9 by llpx_sn_alt_r_sort, llpx_sn_alt_r_gref, llpx_sn_alt_r_skip, llpx_sn_alt_r_free, llpx_sn_alt_r_lref, llpx_sn_alt_r_flat, llpx_sn_alt_r_bind/
-qed.
-
-(* Main inversion lemmas ****************************************************)
-
-theorem llpx_sn_alt_r_inv_lpx_sn: ∀R,T,L1,L2,l. llpx_sn_alt_r R l T L1 L2 → llpx_sn R l T L1 L2.
-#R #T #L1 @(f2_ind … rfw … L1 T) -L1 -T #x #IH #L1 * *
-[1,3: /3 width=4 by llpx_sn_alt_r_fwd_length, llpx_sn_gref, llpx_sn_sort/
-| #i #Hx #L2 #l #H lapply (llpx_sn_alt_r_fwd_length … H)
- #HL12 elim (llpx_sn_alt_r_fwd_lref … H) -H
- [ * /2 width=1 by llpx_sn_free/
- | /2 width=1 by llpx_sn_skip/
- | * /4 width=9 by llpx_sn_lref, drop_fwd_rfw/
- ]
-| #a #I #V #T #Hx #L2 #l #H elim (llpx_sn_alt_r_inv_bind … H) -H
- /3 width=1 by llpx_sn_bind/
-| #I #V #T #Hx #L2 #l #H elim (llpx_sn_alt_r_inv_flat … H) -H
- /3 width=1 by llpx_sn_flat/
-]
-qed-.
-
-(* Alternative definition of llpx_sn (recursive) ****************************)
-
-lemma llpx_sn_intro_alt_r: ∀R,L1,L2,T,l. |L1| = |L2| →
- (∀I1,I2,K1,K2,V1,V2,i. l ≤ yinj i → (∀U. ⬆[i, 1] U ≡ T → ⊥) →
- ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
- ∧∧ I1 = I2 & R K1 V1 V2 & llpx_sn R 0 V1 K1 K2
- ) → llpx_sn R l T L1 L2.
-#R #L1 #L2 #T #l #HL12 #IH @llpx_sn_alt_r_inv_lpx_sn
-@llpx_sn_alt_r_intro_alt // -HL12
-#I1 #I2 #K1 #K2 #V1 #V2 #i #Hil #HnT #HLK1 #HLK2
-elim (IH … HnT HLK1 HLK2) -IH -HnT -HLK1 -HLK2 /3 width=1 by llpx_sn_lpx_sn_alt_r, and3_intro/
-qed.
-
-lemma llpx_sn_ind_alt_r: ∀R. ∀S:relation4 ynat term lenv lenv.
- (∀L1,L2,T,l. |L1| = |L2| → (
- ∀I1,I2,K1,K2,V1,V2,i. l ≤ yinj i → (∀U. ⬆[i, 1] U ≡ T → ⊥) →
- ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
- ∧∧ I1 = I2 & R K1 V1 V2 & llpx_sn R 0 V1 K1 K2 & S 0 V1 K1 K2
- ) → S l T L1 L2) →
- ∀L1,L2,T,l. llpx_sn R l T L1 L2 → S l T L1 L2.
-#R #S #IH1 #L1 #L2 #T #l #H lapply (llpx_sn_lpx_sn_alt_r … H) -H
-#H @(llpx_sn_alt_r_ind_alt … H) -L1 -L2 -T -l
-#L1 #L2 #T #l #HL12 #IH2 @IH1 -IH1 // -HL12
-#I1 #I2 #K1 #K2 #V1 #V2 #i #Hil #HnT #HLK1 #HLK2
-elim (IH2 … HnT HLK1 HLK2) -IH2 -HnT -HLK1 -HLK2 /3 width=1 by llpx_sn_alt_r_inv_lpx_sn, and4_intro/
-qed-.
-
-lemma llpx_sn_inv_alt_r: ∀R,L1,L2,T,l. llpx_sn R l T L1 L2 →
- |L1| = |L2| ∧
- ∀I1,I2,K1,K2,V1,V2,i. l ≤ yinj i → (∀U. ⬆[i, 1] U ≡ T → ⊥) →
- ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
- ∧∧ I1 = I2 & R K1 V1 V2 & llpx_sn R 0 V1 K1 K2.
-#R #L1 #L2 #T #l #H lapply (llpx_sn_lpx_sn_alt_r … H) -H
-#H elim (llpx_sn_alt_r_inv_alt … H) -H
-#HL12 #IH @conj //
-#I1 #I2 #K1 #K2 #V1 #V2 #i #Hil #HnT #HLK1 #HLK2
-elim (IH … HnT HLK1 HLK2) -IH -HnT -HLK1 -HLK2 /3 width=1 by llpx_sn_alt_r_inv_lpx_sn, and3_intro/
-qed-.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/substitution/drop_drop.ma".
-include "basic_2/multiple/llpx_sn_lreq.ma".
-
-(* LAZY SN POINTWISE EXTENSION OF A CONTEXT-SENSITIVE REALTION FOR TERMS ****)
-
-(* Advanced forward lemmas **************************************************)
-
-lemma llpx_sn_fwd_lref_dx: ∀R,L1,L2,l,i. llpx_sn R l (#i) L1 L2 →
- ∀I,K2,V2. ⬇[i] L2 ≡ K2.ⓑ{I}V2 →
- i < l ∨
- ∃∃K1,V1. ⬇[i] L1 ≡ K1.ⓑ{I}V1 & llpx_sn R 0 V1 K1 K2 &
- R K1 V1 V2 & l ≤ i.
-#R #L1 #L2 #l #i #H #I #K2 #V2 #HLK2 elim (llpx_sn_fwd_lref … H) -H [ * || * ]
-[ #_ #H elim (lt_refl_false i)
- lapply (drop_fwd_length_lt2 … HLK2) -HLK2
- /2 width=3 by lt_to_le_to_lt/ (**) (* full auto too slow *)
-| /2 width=1 by or_introl/
-| #I #K11 #K22 #V11 #V22 #HLK11 #HLK22 #HK12 #HV12 #Hli
- lapply (drop_mono … HLK22 … HLK2) -L2 #H destruct
- /3 width=5 by ex4_2_intro, or_intror/
-]
-qed-.
-
-lemma llpx_sn_fwd_lref_sn: ∀R,L1,L2,l,i. llpx_sn R l (#i) L1 L2 →
- ∀I,K1,V1. ⬇[i] L1 ≡ K1.ⓑ{I}V1 →
- i < l ∨
- ∃∃K2,V2. ⬇[i] L2 ≡ K2.ⓑ{I}V2 & llpx_sn R 0 V1 K1 K2 &
- R K1 V1 V2 & l ≤ i.
-#R #L1 #L2 #l #i #H #I #K1 #V1 #HLK1 elim (llpx_sn_fwd_lref … H) -H [ * || * ]
-[ #H #_ elim (lt_refl_false i)
- lapply (drop_fwd_length_lt2 … HLK1) -HLK1
- /2 width=3 by lt_to_le_to_lt/ (**) (* full auto too slow *)
-| /2 width=1 by or_introl/
-| #I #K11 #K22 #V11 #V22 #HLK11 #HLK22 #HK12 #HV12 #Hli
- lapply (drop_mono … HLK11 … HLK1) -L1 #H destruct
- /3 width=5 by ex4_2_intro, or_intror/
-]
-qed-.
-
-(* Advanced inversion lemmas ************************************************)
-
-lemma llpx_sn_inv_lref_ge_dx: ∀R,L1,L2,l,i. llpx_sn R l (#i) L1 L2 → l ≤ i →
- ∀I,K2,V2. ⬇[i] L2 ≡ K2.ⓑ{I}V2 →
- ∃∃K1,V1. ⬇[i] L1 ≡ K1.ⓑ{I}V1 &
- llpx_sn R 0 V1 K1 K2 & R K1 V1 V2.
-#R #L1 #L2 #l #i #H #Hli #I #K2 #V2 #HLK2 elim (llpx_sn_fwd_lref_dx … H … HLK2) -L2
-[ #H elim (ylt_yle_false … H Hli)
-| * /2 width=5 by ex3_2_intro/
-]
-qed-.
-
-lemma llpx_sn_inv_lref_ge_sn: ∀R,L1,L2,l,i. llpx_sn R l (#i) L1 L2 → l ≤ i →
- ∀I,K1,V1. ⬇[i] L1 ≡ K1.ⓑ{I}V1 →
- ∃∃K2,V2. ⬇[i] L2 ≡ K2.ⓑ{I}V2 &
- llpx_sn R 0 V1 K1 K2 & R K1 V1 V2.
-#R #L1 #L2 #l #i #H #Hli #I #K1 #V1 #HLK1 elim (llpx_sn_fwd_lref_sn … H … HLK1) -L1
-[ #H elim (ylt_yle_false … H Hli)
-| * /2 width=5 by ex3_2_intro/
-]
-qed-.
-
-lemma llpx_sn_inv_lref_ge_bi: ∀R,L1,L2,l,i. llpx_sn R l (#i) L1 L2 → l ≤ i →
- ∀I1,I2,K1,K2,V1,V2.
- ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
- ∧∧ I1 = I2 & llpx_sn R 0 V1 K1 K2 & R K1 V1 V2.
-#R #L1 #L2 #l #i #HL12 #Hli #I1 #I2 #K1 #K2 #V1 #V2 #HLK1 #HLK2
-elim (llpx_sn_inv_lref_ge_sn … HL12 … HLK1) // -L1 -l
-#J #Y #HY lapply (drop_mono … HY … HLK2) -L2 -i #H destruct /2 width=1 by and3_intro/
-qed-.
-
-fact llpx_sn_inv_S_aux: ∀R,L1,L2,T,l0. llpx_sn R l0 T L1 L2 → ∀l. l0 = l + 1 →
- ∀K1,K2,I,V1,V2. ⬇[l] L1 ≡ K1.ⓑ{I}V1 → ⬇[l] L2 ≡ K2.ⓑ{I}V2 →
- llpx_sn R 0 V1 K1 K2 → R K1 V1 V2 → llpx_sn R l T L1 L2.
-#R #L1 #L2 #T #l0 #H elim H -L1 -L2 -T -l0
-/2 width=1 by llpx_sn_gref, llpx_sn_free, llpx_sn_sort/
-[ #L1 #L2 #l0 #i #HL12 #Hil #l #H #K1 #K2 #I #V1 #V2 #HLK1 #HLK2 #HK12 #HV12 destruct
- elim (yle_split_eq i l) /2 width=1 by llpx_sn_skip, ylt_fwd_succ2/ -HL12 -Hil
- #H destruct /2 width=9 by llpx_sn_lref/
-| #I #L1 #L2 #K11 #K22 #V1 #V2 #l0 #i #Hl0i #HLK11 #HLK22 #HK12 #HV12 #_ #l #H #K1 #K2 #J #W1 #W2 #_ #_ #_ #_ destruct
- /3 width=9 by llpx_sn_lref, yle_pred_sn/
-| #a #I #L1 #L2 #V #T #l0 #_ #_ #IHV #IHT #l #H #K1 #K2 #J #W1 #W2 #HLK1 #HLK2 #HK12 #HW12 destruct
- /4 width=9 by llpx_sn_bind, drop_drop/
-| #I #L1 #L2 #V #T #l0 #_ #_ #IHV #IHT #l #H #K1 #K2 #J #W1 #W2 #HLK1 #HLK2 #HK12 #HW12 destruct
- /3 width=9 by llpx_sn_flat/
-]
-qed-.
-
-lemma llpx_sn_inv_S: ∀R,L1,L2,T,l. llpx_sn R (l + 1) T L1 L2 →
- ∀K1,K2,I,V1,V2. ⬇[l] L1 ≡ K1.ⓑ{I}V1 → ⬇[l] L2 ≡ K2.ⓑ{I}V2 →
- llpx_sn R 0 V1 K1 K2 → R K1 V1 V2 → llpx_sn R l T L1 L2.
-/2 width=9 by llpx_sn_inv_S_aux/ qed-.
-
-lemma llpx_sn_inv_bind_O: ∀R. (∀L. reflexive … (R L)) →
- ∀a,I,L1,L2,V,T. llpx_sn R 0 (ⓑ{a,I}V.T) L1 L2 →
- llpx_sn R 0 V L1 L2 ∧ llpx_sn R 0 T (L1.ⓑ{I}V) (L2.ⓑ{I}V).
-#R #HR #a #I #L1 #L2 #V #T #H elim (llpx_sn_inv_bind … H) -H
-/3 width=9 by drop_pair, conj, llpx_sn_inv_S/
-qed-.
-
-(* More advanced forward lemmas *********************************************)
-
-lemma llpx_sn_fwd_bind_O_dx: ∀R. (∀L. reflexive … (R L)) →
- ∀a,I,L1,L2,V,T. llpx_sn R 0 (ⓑ{a,I}V.T) L1 L2 →
- llpx_sn R 0 T (L1.ⓑ{I}V) (L2.ⓑ{I}V).
-#R #HR #a #I #L1 #L2 #V #T #H elim (llpx_sn_inv_bind_O … H) -H //
-qed-.
-
-(* Advanced properties ******************************************************)
-
-lemma llpx_sn_bind_repl_O: ∀R,I,L1,L2,V1,V2,T. llpx_sn R 0 T (L1.ⓑ{I}V1) (L2.ⓑ{I}V2) →
- ∀J,W1,W2. llpx_sn R 0 W1 L1 L2 → R L1 W1 W2 → llpx_sn R 0 T (L1.ⓑ{J}W1) (L2.ⓑ{J}W2).
-/3 width=9 by llpx_sn_bind_repl_SO, llpx_sn_inv_S/ qed-.
-
-lemma llpx_sn_dec: ∀R. (∀L,T1,T2. Decidable (R L T1 T2)) →
- ∀T,L1,L2,l. Decidable (llpx_sn R l T L1 L2).
-#R #HR #T #L1 @(f2_ind … rfw … L1 T) -L1 -T
-#x #IH #L1 * *
-[ #k #Hx #L2 elim (eq_nat_dec (|L1|) (|L2|)) /3 width=1 by or_introl, llpx_sn_sort/
-| #i #Hx #L2 elim (eq_nat_dec (|L1|) (|L2|))
- [ #HL12 #l elim (ylt_split i l) /3 width=1 by llpx_sn_skip, or_introl/
- #Hli elim (lt_or_ge i (|L1|)) #HiL1
- elim (lt_or_ge i (|L2|)) #HiL2 /3 width=1 by or_introl, llpx_sn_free/
- elim (drop_O1_lt (Ⓕ) … HiL2) #I2 #K2 #V2 #HLK2
- elim (drop_O1_lt (Ⓕ) … HiL1) #I1 #K1 #V1 #HLK1
- elim (eq_bind2_dec I2 I1)
- [ #H2 elim (HR K1 V1 V2) -HR
- [ #H3 elim (IH K1 V1 … K2 0) destruct
- /3 width=9 by llpx_sn_lref, drop_fwd_rfw, or_introl/
- ]
- ]
- -IH #H3 @or_intror
- #H elim (llpx_sn_fwd_lref … H) -H [1,3,4,6,7,9: * ]
- [1,3,5: /3 width=4 by lt_to_le_to_lt, lt_refl_false/
- |7,8,9: /2 width=4 by ylt_yle_false/
- ]
- #Z #Y1 #Y2 #X1 #X2 #HLY1 #HLY2 #HY12 #HX12
- lapply (drop_mono … HLY1 … HLK1) -HLY1 -HLK1
- lapply (drop_mono … HLY2 … HLK2) -HLY2 -HLK2
- #H #H0 destruct /2 width=1 by/
- ]
-| #p #Hx #L2 elim (eq_nat_dec (|L1|) (|L2|)) /3 width=1 by or_introl, llpx_sn_gref/
-| #a #I #V #T #Hx #L2 #l destruct
- elim (IH L1 V … L2 l) /2 width=1 by/
- elim (IH (L1.ⓑ{I}V) T … (L2.ⓑ{I}V) (⫯l)) -IH /3 width=1 by or_introl, llpx_sn_bind/
- #H1 #H2 @or_intror
- #H elim (llpx_sn_inv_bind … H) -H /2 width=1 by/
-| #I #V #T #Hx #L2 #l destruct
- elim (IH L1 V … L2 l) /2 width=1 by/
- elim (IH L1 T … L2 l) -IH /3 width=1 by or_introl, llpx_sn_flat/
- #H1 #H2 @or_intror
- #H elim (llpx_sn_inv_flat … H) -H /2 width=1 by/
-]
--x /4 width=4 by llpx_sn_fwd_length, or_intror/
-qed-.
-
-(* Properties on relocation *************************************************)
-
-lemma llpx_sn_lift_le: ∀R. d_liftable R →
- ∀K1,K2,T,l0. llpx_sn R l0 T K1 K2 →
- ∀L1,L2,l,m. ⬇[Ⓕ, l, m] L1 ≡ K1 → ⬇[Ⓕ, l, m] L2 ≡ K2 →
- ∀U. ⬆[l, m] T ≡ U → l0 ≤ l → llpx_sn R l0 U L1 L2.
-#R #HR #K1 #K2 #T #l0 #H elim H -K1 -K2 -T -l0
-[ #K1 #K2 #l0 #k #HK12 #L1 #L2 #l #m #HLK1 #HLK2 #X #H #_ >(lift_inv_sort1 … H) -X
- lapply (drop_fwd_length_eq2 … HLK1 HLK2 HK12) -K1 -K2 -l
- /2 width=1 by llpx_sn_sort/
-| #K1 #K2 #l0 #i #HK12 #Hil0 #L1 #L2 #l #m #HLK1 #HLK2 #X #H #Hl0 elim (lift_inv_lref1 … H) -H
- * #Hli #H destruct
- [ lapply (drop_fwd_length_eq2 … HLK1 HLK2 HK12) -K1 -K2 -l
- /2 width=1 by llpx_sn_skip/
- | elim (ylt_yle_false … Hil0) -L1 -L2 -K1 -K2 -m -Hil0
- /3 width=3 by yle_trans, yle_inj/
- ]
-| #I #K1 #K2 #K11 #K22 #V1 #V2 #l0 #i #Hil0 #HK11 #HK22 #HK12 #HV12 #IHK12 #L1 #L2 #l #m #HLK1 #HLK2 #X #H #Hl0 elim (lift_inv_lref1 … H) -H
- * #Hli #H destruct [ -HK12 | -IHK12 ]
- [ elim (drop_trans_lt … HLK1 … HK11) // -K1
- elim (drop_trans_lt … HLK2 … HK22) // -Hli -K2
- /3 width=18 by llpx_sn_lref/
- | lapply (drop_trans_ge_comm … HLK1 … HK11 ?) // -K1
- lapply (drop_trans_ge_comm … HLK2 … HK22 ?) // -Hli -Hl0 -K2
- /3 width=9 by llpx_sn_lref, yle_plus_dx1_trans/
- ]
-| #K1 #K2 #l0 #i #HK1 #HK2 #HK12 #L1 #L2 #l #m #HLK1 #HLK2 #X #H #Hl0 elim (lift_inv_lref1 … H) -H
- * #Hil #H destruct
- lapply (drop_fwd_length_eq2 … HLK1 HLK2 HK12) -HK12
- [ /3 width=7 by llpx_sn_free, drop_fwd_be/
- | lapply (drop_fwd_length … HLK1) -HLK1 #HLK1
- lapply (drop_fwd_length … HLK2) -HLK2 #HLK2
- @llpx_sn_free [ >HLK1 | >HLK2 ] -Hil -HLK1 -HLK2 /2 width=1 by monotonic_le_plus_r/ (**) (* explicit constructor *)
- ]
-| #K1 #K2 #l0 #p #HK12 #L1 #L2 #l #m #HLK1 #HLK2 #X #H #_ >(lift_inv_gref1 … H) -X
- lapply (drop_fwd_length_eq2 … HLK1 HLK2 HK12) -K1 -K2 -l -m
- /2 width=1 by llpx_sn_gref/
-| #a #I #K1 #K2 #V #T #l0 #_ #_ #IHV #IHT #L1 #L2 #l #m #HLK1 #HLK2 #X #H #Hl0 elim (lift_inv_bind1 … H) -H
- #W #U #HVW #HTU #H destruct /4 width=6 by llpx_sn_bind, drop_skip, yle_succ/
-| #I #K1 #K2 #V #T #l0 #_ #_ #IHV #IHT #L1 #L2 #l #m #HLK1 #HLK2 #X #H #Hl0 elim (lift_inv_flat1 … H) -H
- #W #U #HVW #HTU #H destruct /3 width=6 by llpx_sn_flat/
-]
-qed-.
-
-lemma llpx_sn_lift_ge: ∀R,K1,K2,T,l0. llpx_sn R l0 T K1 K2 →
- ∀L1,L2,l,m. ⬇[Ⓕ, l, m] L1 ≡ K1 → ⬇[Ⓕ, l, m] L2 ≡ K2 →
- ∀U. ⬆[l, m] T ≡ U → l ≤ l0 → llpx_sn R (l0+m) U L1 L2.
-#R #K1 #K2 #T #l0 #H elim H -K1 -K2 -T -l0
-[ #K1 #K2 #l0 #k #HK12 #L1 #L2 #l #m #HLK1 #HLK2 #X #H #_ >(lift_inv_sort1 … H) -X
- lapply (drop_fwd_length_eq2 … HLK1 HLK2 HK12) -K1 -K2 -l
- /2 width=1 by llpx_sn_sort/
-| #K1 #K2 #l0 #i #HK12 #Hil0 #L1 #L2 #l #m #HLK1 #HLK2 #X #H #_ elim (lift_inv_lref1 … H) -H
- * #_ #H destruct
- lapply (drop_fwd_length_eq2 … HLK1 HLK2 HK12) -K1 -K2
- [ /3 width=3 by llpx_sn_skip, ylt_plus_dx2_trans/
- | /3 width=3 by llpx_sn_skip, monotonic_ylt_plus_dx/
- ]
-| #I #K1 #K2 #K11 #K22 #V1 #V2 #l0 #i #Hil0 #HK11 #HK22 #HK12 #HV12 #_ #L1 #L2 #l #m #HLK1 #HLK2 #X #H #Hl0 elim (lift_inv_lref1 … H) -H
- * #Hil #H destruct
- [ elim (ylt_yle_false … Hil0) -I -L1 -L2 -K1 -K2 -K11 -K22 -V1 -V2 -m -Hil0
- /3 width=3 by ylt_yle_trans, ylt_inj/
- | lapply (drop_trans_ge_comm … HLK1 … HK11 ?) // -K1
- lapply (drop_trans_ge_comm … HLK2 … HK22 ?) // -Hil -Hl0 -K2
- /3 width=9 by llpx_sn_lref, monotonic_yle_plus_dx/
- ]
-| #K1 #K2 #l0 #i #HK1 #HK2 #HK12 #L1 #L2 #l #m #HLK1 #HLK2 #X #H #Hl0 elim (lift_inv_lref1 … H) -H
- * #Hil #H destruct
- lapply (drop_fwd_length_eq2 … HLK1 HLK2 HK12) -HK12
- [ /3 width=7 by llpx_sn_free, drop_fwd_be/
- | lapply (drop_fwd_length … HLK1) -HLK1 #HLK1
- lapply (drop_fwd_length … HLK2) -HLK2 #HLK2
- @llpx_sn_free [ >HLK1 | >HLK2 ] -Hil -HLK1 -HLK2 /2 width=1 by monotonic_le_plus_r/ (**) (* explicit constructor *)
- ]
-| #K1 #K2 #l0 #p #HK12 #L1 #L2 #l #m #HLK1 #HLK2 #X #H #_ >(lift_inv_gref1 … H) -X
- lapply (drop_fwd_length_eq2 … HLK1 HLK2 HK12) -K1 -K2 -l
- /2 width=1 by llpx_sn_gref/
-| #a #I #K1 #K2 #V #T #l0 #_ #_ #IHV #IHT #L1 #L2 #l #m #HLK1 #HLK2 #X #H #Hl0 elim (lift_inv_bind1 … H) -H
- #W #U #HVW #HTU #H destruct /4 width=5 by llpx_sn_bind, drop_skip, yle_succ/
-| #I #K1 #K2 #V #T #l0 #_ #_ #IHV #IHT #L1 #L2 #l #m #HLK1 #HLK2 #X #H #Hl0 elim (lift_inv_flat1 … H) -H
- #W #U #HVW #HTU #H destruct /3 width=5 by llpx_sn_flat/
-]
-qed-.
-
-(* Inversion lemmas on relocation *******************************************)
-
-lemma llpx_sn_inv_lift_le: ∀R. d_deliftable_sn R →
- ∀L1,L2,U,l0. llpx_sn R l0 U L1 L2 →
- ∀K1,K2,l,m. ⬇[Ⓕ, l, m] L1 ≡ K1 → ⬇[Ⓕ, l, m] L2 ≡ K2 →
- ∀T. ⬆[l, m] T ≡ U → l0 ≤ l → llpx_sn R l0 T K1 K2.
-#R #HR #L1 #L2 #U #l0 #H elim H -L1 -L2 -U -l0
-[ #L1 #L2 #l0 #k #HL12 #K1 #K2 #l #m #HLK1 #HLK2 #X #H #_ >(lift_inv_sort2 … H) -X
- lapply (drop_fwd_length_eq1 … HLK1 HLK2 HL12) -L1 -L2 -l -m
- /2 width=1 by llpx_sn_sort/
-| #L1 #L2 #l0 #i #HL12 #Hil0 #K1 #K2 #l #m #HLK1 #HLK2 #X #H #_ elim (lift_inv_lref2 … H) -H
- * #_ #H destruct
- lapply (drop_fwd_length_eq1 … HLK1 HLK2 HL12) -L1 -L2
- [ /2 width=1 by llpx_sn_skip/
- | /3 width=3 by llpx_sn_skip, yle_ylt_trans/
- ]
-| #I #L1 #L2 #K11 #K22 #W1 #W2 #l0 #i #Hil0 #HLK11 #HLK22 #HK12 #HW12 #IHK12 #K1 #K2 #l #m #HLK1 #HLK2 #X #H #Hl0 elim (lift_inv_lref2 … H) -H
- * #Hil #H destruct [ -HK12 | -IHK12 ]
- [ elim (drop_conf_lt … HLK1 … HLK11) // -L1 #L1 #V1 #HKL1 #HKL11 #HVW1
- elim (drop_conf_lt … HLK2 … HLK22) // -Hil -L2 #L2 #V2 #HKL2 #HKL22 #HVW2
- elim (HR … HW12 … HKL11 … HVW1) -HR #V0 #HV0 #HV12
- lapply (lift_inj … HV0 … HVW2) -HV0 -HVW2 #H destruct
- /3 width=10 by llpx_sn_lref/
- | lapply (drop_conf_ge … HLK1 … HLK11 ?) // -L1
- lapply (drop_conf_ge … HLK2 … HLK22 ?) // -L2 -Hil0
- elim (yle_inv_plus_inj2 … Hil) -Hil /4 width=9 by llpx_sn_lref, yle_trans, yle_inj/ (**) (* slow *)
- ]
-| #L1 #L2 #l0 #i #HL1 #HL2 #HL12 #K1 #K2 #l #m #HLK1 #HLK2 #X #H #Hl0 elim (lift_inv_lref2 … H) -H
- * #_ #H destruct
- lapply (drop_fwd_length_eq1 … HLK1 HLK2 HL12)
- [ lapply (drop_fwd_length_le4 … HLK1) -HLK1
- lapply (drop_fwd_length_le4 … HLK2) -HLK2
- #HKL2 #HKL1 #HK12 @llpx_sn_free // /2 width=3 by transitive_le/ (**) (* full auto too slow *)
- | lapply (drop_fwd_length … HLK1) -HLK1 #H >H in HL1; -H
- lapply (drop_fwd_length … HLK2) -HLK2 #H >H in HL2; -H
- /3 width=1 by llpx_sn_free, le_plus_to_minus_r/
- ]
-| #L1 #L2 #l0 #p #HL12 #K1 #K2 #l #m #HLK1 #HLK2 #X #H #_ >(lift_inv_gref2 … H) -X
- lapply (drop_fwd_length_eq1 … HLK1 HLK2 HL12) -L1 -L2 -l -m
- /2 width=1 by llpx_sn_gref/
-| #a #I #L1 #L2 #W #U #l0 #_ #_ #IHW #IHU #K1 #K2 #l #m #HLK1 #HLK2 #X #H #Hl0 elim (lift_inv_bind2 … H) -H
- #V #T #HVW #HTU #H destruct /4 width=6 by llpx_sn_bind, drop_skip, yle_succ/
-| #I #L1 #L2 #W #U #l0 #_ #_ #IHW #IHU #K1 #K2 #l #m #HLK1 #HLK2 #X #H #Hl0 elim (lift_inv_flat2 … H) -H
- #V #T #HVW #HTU #H destruct /3 width=6 by llpx_sn_flat/
-]
-qed-.
-
-lemma llpx_sn_inv_lift_be: ∀R,L1,L2,U,l0. llpx_sn R l0 U L1 L2 →
- ∀K1,K2,l,m. ⬇[Ⓕ, l, m] L1 ≡ K1 → ⬇[Ⓕ, l, m] L2 ≡ K2 →
- ∀T. ⬆[l, m] T ≡ U → l ≤ l0 → l0 ≤ l + m → llpx_sn R l T K1 K2.
-#R #L1 #L2 #U #l0 #H elim H -L1 -L2 -U -l0
-[ #L1 #L2 #l0 #k #HL12 #K1 #K2 #l #m #HLK1 #HLK2 #X #H #_ #_ >(lift_inv_sort2 … H) -X
- lapply (drop_fwd_length_eq1 … HLK1 HLK2 HL12) -L1 -L2 -l0 -m
- /2 width=1 by llpx_sn_sort/
-| #L1 #L2 #l0 #i #HL12 #Hil0 #K1 #K2 #l #m #HLK1 #HLK2 #X #H #Hl0 #Hl0m elim (lift_inv_lref2 … H) -H
- * #Hil #H destruct
- [ lapply (drop_fwd_length_eq1 … HLK1 HLK2 HL12) -L1 -L2
- -Hil0 /3 width=1 by llpx_sn_skip, ylt_inj/
- | elim (ylt_yle_false … Hil0) -L1 -L2 -Hl0 -Hil0
- /3 width=3 by yle_trans, yle_inj/ (**) (* slow *)
- ]
-| #I #L1 #L2 #K11 #K22 #W1 #W2 #l0 #i #Hil0 #HLK11 #HLK22 #HK12 #HW12 #_ #K1 #K2 #l #m #HLK1 #HLK2 #X #H #Hl0 #Hl0m elim (lift_inv_lref2 … H) -H
- * #Hil #H destruct
- [ elim (ylt_yle_false … Hil0) -I -L1 -L2 -K11 -K22 -W1 -W2 -Hl0m -Hil0
- /3 width=3 by ylt_yle_trans, ylt_inj/
- | lapply (drop_conf_ge … HLK1 … HLK11 ?) // -L1
- lapply (drop_conf_ge … HLK2 … HLK22 ?) // -L2 -Hil0 -Hl0 -Hl0m
- elim (yle_inv_plus_inj2 … Hil) -Hil /3 width=9 by llpx_sn_lref, yle_inj/
- ]
-| #L1 #L2 #l0 #i #HL1 #HL2 #HL12 #K1 #K2 #l #m #HLK1 #HLK2 #X #H #Hl0 #Hl0m elim (lift_inv_lref2 … H) -H
- * #_ #H destruct
- lapply (drop_fwd_length_eq1 … HLK1 HLK2 HL12)
- [ lapply (drop_fwd_length_le4 … HLK1) -HLK1
- lapply (drop_fwd_length_le4 … HLK2) -HLK2
- #HKL2 #HKL1 #HK12 @llpx_sn_free // /2 width=3 by transitive_le/ (**) (* full auto too slow *)
- | lapply (drop_fwd_length … HLK1) -HLK1 #H >H in HL1; -H
- lapply (drop_fwd_length … HLK2) -HLK2 #H >H in HL2; -H
- /3 width=1 by llpx_sn_free, le_plus_to_minus_r/
- ]
-| #L1 #L2 #l0 #p #HL12 #K1 #K2 #l #m #HLK1 #HLK2 #X #H #_ #_ >(lift_inv_gref2 … H) -X
- lapply (drop_fwd_length_eq1 … HLK1 HLK2 HL12) -L1 -L2 -l0 -m
- /2 width=1 by llpx_sn_gref/
-| #a #I #L1 #L2 #W #U #l0 #_ #_ #IHW #IHU #K1 #K2 #l #m #HLK1 #HLK2 #X #H #Hl0 #Hl0m elim (lift_inv_bind2 … H) -H
- #V #T #HVW #HTU #H destruct
- @llpx_sn_bind [ /2 width=5 by/ ] -IHW (**) (* explicit constructor *)
- @(IHU … HTU) -IHU -HTU /2 width=1 by drop_skip, yle_succ/
-| #I #L1 #L2 #W #U #l0 #_ #_ #IHW #IHU #K1 #K2 #l #m #HLK1 #HLK2 #X #H #Hl0 #Hl0m elim (lift_inv_flat2 … H) -H
- #V #T #HVW #HTU #H destruct /3 width=6 by llpx_sn_flat/
-]
-qed-.
-
-lemma llpx_sn_inv_lift_ge: ∀R,L1,L2,U,l0. llpx_sn R l0 U L1 L2 →
- ∀K1,K2,l,m. ⬇[Ⓕ, l, m] L1 ≡ K1 → ⬇[Ⓕ, l, m] L2 ≡ K2 →
- ∀T. ⬆[l, m] T ≡ U → l + m ≤ l0 → llpx_sn R (l0-m) T K1 K2.
-#R #L1 #L2 #U #l0 #H elim H -L1 -L2 -U -l0
-[ #L1 #L2 #l0 #k #HL12 #K1 #K2 #l #m #HLK1 #HLK2 #X #H #_ >(lift_inv_sort2 … H) -X
- lapply (drop_fwd_length_eq1 … HLK1 HLK2 HL12) -L1 -L2 -l
- /2 width=1 by llpx_sn_sort/
-| #L1 #L2 #l0 #i #HL12 #Hil0 #K1 #K2 #l #m #HLK1 #HLK2 #X #H #Hlml0 elim (lift_inv_lref2 … H) -H
- * #Hil #H destruct [ -Hil0 | -Hlml0 ]
- lapply (drop_fwd_length_eq1 … HLK1 HLK2 HL12) -L1 -L2
- [ /4 width=3 by llpx_sn_skip, yle_plus1_to_minus_inj2, ylt_yle_trans, ylt_inj/
- | elim (yle_inv_plus_inj2 … Hil) -Hil
- /3 width=1 by llpx_sn_skip, monotonic_ylt_minus_dx/
- ]
-| #I #L1 #L2 #K11 #K22 #W1 #W2 #l0 #i #Hil0 #HLK11 #HLK22 #HK12 #HW12 #_ #K1 #K2 #l #m #HLK1 #HLK2 #X #H #Hlml0 elim (lift_inv_lref2 … H) -H
- * #Hil #H destruct
- [ elim (ylt_yle_false … Hil0) -I -L1 -L2 -K11 -K22 -W1 -W2 -Hil0
- /3 width=3 by yle_fwd_plus_sn1, ylt_yle_trans, ylt_inj/
- | lapply (drop_conf_ge … HLK1 … HLK11 ?) // -L1
- lapply (drop_conf_ge … HLK2 … HLK22 ?) // -L2 -Hlml0 -Hil
- /3 width=9 by llpx_sn_lref, monotonic_yle_minus_dx/
- ]
-| #L1 #L2 #l0 #i #HL1 #HL2 #HL12 #K1 #K2 #l #m #HLK1 #HLK2 #X #H #Hlml0 elim (lift_inv_lref2 … H) -H
- * #_ #H destruct
- lapply (drop_fwd_length_eq1 … HLK1 HLK2 HL12)
- [ lapply (drop_fwd_length_le4 … HLK1) -HLK1
- lapply (drop_fwd_length_le4 … HLK2) -HLK2
- #HKL2 #HKL1 #HK12 @llpx_sn_free // /2 width=3 by transitive_le/ (**) (* full auto too slow *)
- | lapply (drop_fwd_length … HLK1) -HLK1 #H >H in HL1; -H
- lapply (drop_fwd_length … HLK2) -HLK2 #H >H in HL2; -H
- /3 width=1 by llpx_sn_free, le_plus_to_minus_r/
- ]
-| #L1 #L2 #l0 #p #HL12 #K1 #K2 #l #m #HLK1 #HLK2 #X #H #_ >(lift_inv_gref2 … H) -X
- lapply (drop_fwd_length_eq1 … HLK1 HLK2 HL12) -L1 -L2 -l
- /2 width=1 by llpx_sn_gref/
-| #a #I #L1 #L2 #W #U #l0 #_ #_ #IHW #IHU #K1 #K2 #l #m #HLK1 #HLK2 #X #H #Hlml0 elim (lift_inv_bind2 … H) -H
- #V #T #HVW #HTU #H destruct
- @llpx_sn_bind [ /2 width=5 by/ ] -IHW (**) (* explicit constructor *)
- <yminus_succ1_inj /2 width=2 by yle_fwd_plus_sn2/
- @(IHU … HTU) -IHU -HTU /2 width=1 by drop_skip, yle_succ/
-| #I #L1 #L2 #W #U #l0 #_ #_ #IHW #IHU #K1 #K2 #l #m #HLK1 #HLK2 #X #H #Hlml0 elim (lift_inv_flat2 … H) -H
- #V #T #HVW #HTU #H destruct /3 width=5 by llpx_sn_flat/
-]
-qed-.
-
-(* Advanced inversion lemmas on relocation **********************************)
-
-lemma llpx_sn_inv_lift_O: ∀R,L1,L2,U. llpx_sn R 0 U L1 L2 →
- ∀K1,K2,m. ⬇[m] L1 ≡ K1 → ⬇[m] L2 ≡ K2 →
- ∀T. ⬆[0, m] T ≡ U → llpx_sn R 0 T K1 K2.
-/2 width=11 by llpx_sn_inv_lift_be/ qed-.
-
-lemma llpx_sn_drop_conf_O: ∀R,L1,L2,U. llpx_sn R 0 U L1 L2 →
- ∀K1,m. ⬇[m] L1 ≡ K1 → ∀T. ⬆[0, m] T ≡ U →
- ∃∃K2. ⬇[m] L2 ≡ K2 & llpx_sn R 0 T K1 K2.
-#R #L1 #L2 #U #HU #K1 #m #HLK1 #T #HTU elim (llpx_sn_fwd_drop_sn … HU … HLK1)
-/3 width=10 by llpx_sn_inv_lift_O, ex2_intro/
-qed-.
-
-lemma llpx_sn_drop_trans_O: ∀R,L1,L2,U. llpx_sn R 0 U L1 L2 →
- ∀K2,m. ⬇[m] L2 ≡ K2 → ∀T. ⬆[0, m] T ≡ U →
- ∃∃K1. ⬇[m] L1 ≡ K1 & llpx_sn R 0 T K1 K2.
-#R #L1 #L2 #U #HU #K2 #m #HLK2 #T #HTU elim (llpx_sn_fwd_drop_dx … HU … HLK2)
-/3 width=10 by llpx_sn_inv_lift_O, ex2_intro/
-qed-.
-
-(* Inversion lemmas on negated lazy pointwise extension *********************)
-
-lemma nllpx_sn_inv_bind: ∀R. (∀L,T1,T2. Decidable (R L T1 T2)) →
- ∀a,I,L1,L2,V,T,l. (llpx_sn R l (ⓑ{a,I}V.T) L1 L2 → ⊥) →
- (llpx_sn R l V L1 L2 → ⊥) ∨ (llpx_sn R (⫯l) T (L1.ⓑ{I}V) (L2.ⓑ{I}V) → ⊥).
-#R #HR #a #I #L1 #L2 #V #T #l #H elim (llpx_sn_dec … HR V L1 L2 l)
-/4 width=1 by llpx_sn_bind, or_intror, or_introl/
-qed-.
-
-lemma nllpx_sn_inv_flat: ∀R. (∀L,T1,T2. Decidable (R L T1 T2)) →
- ∀I,L1,L2,V,T,l. (llpx_sn R l (ⓕ{I}V.T) L1 L2 → ⊥) →
- (llpx_sn R l V L1 L2 → ⊥) ∨ (llpx_sn R l T L1 L2 → ⊥).
-#R #HR #I #L1 #L2 #V #T #l #H elim (llpx_sn_dec … HR V L1 L2 l)
-/4 width=1 by llpx_sn_flat, or_intror, or_introl/
-qed-.
-
-lemma nllpx_sn_inv_bind_O: ∀R. (∀L,T1,T2. Decidable (R L T1 T2)) →
- ∀a,I,L1,L2,V,T. (llpx_sn R 0 (ⓑ{a,I}V.T) L1 L2 → ⊥) →
- (llpx_sn R 0 V L1 L2 → ⊥) ∨ (llpx_sn R 0 T (L1.ⓑ{I}V) (L2.ⓑ{I}V) → ⊥).
-#R #HR #a #I #L1 #L2 #V #T #H elim (llpx_sn_dec … HR V L1 L2 0)
-/4 width=1 by llpx_sn_bind_O, or_intror, or_introl/
-qed-.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/multiple/frees.ma".
-include "basic_2/multiple/llpx_sn_alt_rec.ma".
-
-(* LAZY SN POINTWISE EXTENSION OF A CONTEXT-SENSITIVE REALTION FOR TERMS ****)
-
-(* Properties on context-sensitive free variables ***************************)
-
-fact llpx_sn_frees_trans_aux: ∀R. (s_r_confluent1 … R (llpx_sn R 0)) → (frees_trans R) →
- ∀L2,U,l,i. L2 ⊢ i ϵ 𝐅*[l]⦃U⦄ →
- ∀L1. llpx_sn R l U L1 L2 → L1 ⊢ i ϵ 𝐅*[l]⦃U⦄.
-#R #H1R #H2R #L2 #U #l #i #H elim H -L2 -U -l -i /3 width=2 by frees_eq/
-#I2 #L2 #K2 #U #W2 #l #i #j #Hlj #Hji #HnU #HLK2 #_ #IHW2 #L1 #HL12
-elim (llpx_sn_inv_alt_r … HL12) -HL12 #HL12 #IH
-lapply (drop_fwd_length_lt2 … HLK2) #Hj
-elim (drop_O1_lt (Ⓕ) L1 j) // -Hj -HL12 #I1 #K1 #W1 #HLK1
-elim (IH … HnU HLK1 HLK2) // -IH -HLK2 /5 width=11 by frees_be/
-qed-.
-
-lemma llpx_sn_frees_trans: ∀R. (s_r_confluent1 … R (llpx_sn R 0)) → (frees_trans R) →
- ∀L1,L2,U,l. llpx_sn R l U L1 L2 →
- ∀i. L2 ⊢ i ϵ 𝐅*[l]⦃U⦄ → L1 ⊢ i ϵ 𝐅*[l]⦃U⦄.
-/2 width=6 by llpx_sn_frees_trans_aux/ qed-.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/substitution/lpx_sn_alt.ma".
-include "basic_2/multiple/llor.ma".
-include "basic_2/multiple/lleq_alt.ma".
-
-(* LAZY SN POINTWISE EXTENSION OF A CONTEXT-SENSITIVE REALTION FOR TERMS ****)
-
-(* Inversion lemmas on pointwise union for local environments ****************)
-
-lemma llpx_sn_llor_fwd_sn: ∀R. (∀L. reflexive … (R L)) →
- ∀L1,L2,T,l. llpx_sn R l T L1 L2 →
- ∀L. L1 ⋓[T, l] L2 ≡ L → lpx_sn R L1 L.
-#R #HR #L1 #L2 #T #l #H1 #L #H2
-elim (llpx_sn_llpx_sn_alt … H1) -H1 #HL12 #IH1
-elim H2 -H2 #_ #HL1 #IH2
-@lpx_sn_intro_alt // #I1 #I #K1 #K #V1 #V #i #HLK1 #HLK
-lapply (drop_fwd_length_lt2 … HLK) #HiL
-elim (drop_O1_lt (Ⓕ) L2 i) // -HiL -HL1 -HL12 #I2 #K2 #V2 #HLK2
-elim (IH2 … HLK1 HLK2 HLK) -IH2 -HLK * /2 width=1 by conj/
-#HnT #H1 #H2 elim (IH1 … HnT … HLK1 HLK2) -IH1 -HnT -HLK1 -HLK2 /2 width=1 by conj/
-qed-.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/substitution/lpx_sn_drop.ma".
-include "basic_2/multiple/llpx_sn.ma".
-
-(* LAZY SN POINTWISE EXTENSION OF A CONTEXT-SENSITIVE REALTION FOR TERMS ****)
-
-(* Properties on pointwise extensions ***************************************)
-
-lemma lpx_sn_llpx_sn: ∀R. (∀L. reflexive … (R L)) →
- ∀T,L1,L2,l. lpx_sn R L1 L2 → llpx_sn R l T L1 L2.
-#R #HR #T #L1 @(f2_ind … rfw … L1 T) -L1 -T
-#x #IH #L1 * *
-[ -HR -IH /4 width=2 by lpx_sn_fwd_length, llpx_sn_sort/
-| -HR #i elim (lt_or_ge i (|L1|))
- [2: -IH /4 width=4 by lpx_sn_fwd_length, llpx_sn_free, le_repl_sn_conf_aux/ ]
- #Hi #Hx #L2 #l elim (ylt_split i l)
- [ -x /3 width=2 by llpx_sn_skip, lpx_sn_fwd_length/ ]
- #Hli #HL12 elim (drop_O1_lt (Ⓕ) L1 i) //
- #I #K1 #V1 #HLK1 elim (lpx_sn_drop_conf … HL12 … HLK1) -HL12
- /4 width=9 by llpx_sn_lref, drop_fwd_rfw/
-| -HR -IH /4 width=2 by lpx_sn_fwd_length, llpx_sn_gref/
-| /4 width=1 by llpx_sn_bind, lpx_sn_pair/
-| -HR /3 width=1 by llpx_sn_flat/
-]
-qed.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/substitution/drop_lreq.ma".
-include "basic_2/multiple/llpx_sn.ma".
-
-(* LAZY SN POINTWISE EXTENSION OF A CONTEXT-SENSITIVE REALTION FOR TERMS ****)
-
-(* Properties on equivalence for local environments *************************)
-
-lemma lreq_llpx_sn_trans: ∀R,L2,L,T,l. llpx_sn R l T L2 L →
- ∀L1. L1 ⩬[l, ∞] L2 → llpx_sn R l T L1 L.
-#R #L2 #L #T #l #H elim H -L2 -L -T -l
-/4 width=5 by llpx_sn_flat, llpx_sn_gref, llpx_sn_skip, llpx_sn_sort, lreq_fwd_length, trans_eq/
-[ #I #L2 #L #K2 #K #V2 #V #l #i #Hli #HLK2 #HLK #HK2 #HV2 #_ #L1 #HL12
- elim (lreq_drop_trans_be … HL12 … HLK2) -L2 // >yminus_Y_inj #K1 #HK12 #HLK1
- lapply (lreq_inv_O_Y … HK12) -HK12 #H destruct /2 width=9 by llpx_sn_lref/
-| /4 width=5 by llpx_sn_free, lreq_fwd_length, le_repl_sn_trans_aux, trans_eq/
-| /4 width=1 by llpx_sn_bind, lreq_succ/
-]
-qed-.
-
-lemma llpx_sn_lreq_trans: ∀R,L,L1,T,l. llpx_sn R l T L L1 →
- ∀L2. L1 ⩬[l, ∞] L2 → llpx_sn R l T L L2.
-#R #L #L1 #T #l #H elim H -L -L1 -T -l
-/4 width=5 by llpx_sn_flat, llpx_sn_gref, llpx_sn_skip, llpx_sn_sort, lreq_fwd_length, trans_eq/
-[ #I #L #L1 #K #K1 #V #V1 #l #i #Hli #HLK #HLK1 #HK1 #HV1 #_ #L2 #HL12
- elim (lreq_drop_conf_be … HL12 … HLK1) -L1 // >yminus_Y_inj #K2 #HK12 #HLK2
- lapply (lreq_inv_O_Y … HK12) -HK12 #H destruct /2 width=9 by llpx_sn_lref/
-| /4 width=5 by llpx_sn_free, lreq_fwd_length, le_repl_sn_conf_aux, trans_eq/
-| /4 width=1 by llpx_sn_bind, lreq_succ/
-]
-qed-.
-
-lemma llpx_sn_lreq_repl: ∀R,L1,L2,T,l. llpx_sn R l T L1 L2 → ∀K1. K1 ⩬[l, ∞] L1 →
- ∀K2. L2 ⩬[l, ∞] K2 → llpx_sn R l T K1 K2.
-/3 width=4 by llpx_sn_lreq_trans, lreq_llpx_sn_trans/ qed-.
-
-lemma llpx_sn_bind_repl_SO: ∀R,I1,I2,L1,L2,V1,V2,T. llpx_sn R 0 T (L1.ⓑ{I1}V1) (L2.ⓑ{I2}V2) →
- ∀J1,J2,W1,W2. llpx_sn R 1 T (L1.ⓑ{J1}W1) (L2.ⓑ{J2}W2).
-#R #I1 #I2 #L1 #L2 #V1 #V2 #T #HT #J1 #J2 #W1 #W2 lapply (llpx_sn_ge R … 1 … HT) -HT
-/3 width=7 by llpx_sn_lreq_repl, lreq_succ/
-qed-.
+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/multiple/llpx_sn_drop.ma".
-
-(* LAZY SN POINTWISE EXTENSION OF A CONTEXT-SENSITIVE REALTION FOR TERMS ****)
-
-(* Properties about transitive closure **************************************)
-
-lemma llpx_sn_TC_pair_dx: ∀R. (∀L. reflexive … (R L)) →
- ∀I,L,V1,V2,T. LTC … R L V1 V2 →
- LTC … (llpx_sn R 0) T (L.ⓑ{I}V1) (L.ⓑ{I}V2).
-#R #HR #I #L #V1 #V2 #T #H @(TC_star_ind … V2 H) -V2
-/4 width=9 by llpx_sn_bind_repl_O, llpx_sn_refl, step, inj/
-qed.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/notation/relations/rdropstar_3.ma".
+include "basic_2/notation/relations/rdropstar_4.ma".
+include "basic_2/substitution/drop.ma".
+include "basic_2/multiple/mr2_minus.ma".
+include "basic_2/multiple/lifts_vector.ma".
+
+(* ITERATED LOCAL ENVIRONMENT SLICING ***************************************)
+
+inductive drops (s:bool): list2 ynat nat → relation lenv ≝
+| drops_nil : ∀L. drops s (◊) L L
+| drops_cons: ∀L1,L,L2,cs,l,m.
+ drops s cs L1 L → ⬇[s, l, m] L ≡ L2 → drops s ({l, m} @ cs) L1 L2
+.
+
+interpretation "iterated slicing (local environment) abstract"
+ 'RDropStar s cs T1 T2 = (drops s cs T1 T2).
+(*
+interpretation "iterated slicing (local environment) general"
+ 'RDropStar des T1 T2 = (drops true des T1 T2).
+*)
+
+definition d_liftable1: relation2 lenv term → predicate bool ≝
+ λR,s. ∀K,T. R K T → ∀L,l,m. ⬇[s, l, m] L ≡ K →
+ ∀U. ⬆[l, m] T ≡ U → R L U.
+
+definition d_liftables1: relation2 lenv term → predicate bool ≝
+ λR,s. ∀L,K,cs. ⬇*[s, cs] L ≡ K →
+ ∀T,U. ⬆*[cs] T ≡ U → R K T → R L U.
+
+definition d_liftables1_all: relation2 lenv term → predicate bool ≝
+ λR,s. ∀L,K,cs. ⬇*[s, cs] L ≡ K →
+ ∀Ts,Us. ⬆*[cs] Ts ≡ Us →
+ all … (R K) Ts → all … (R L) Us.
+
+(* Basic inversion lemmas ***************************************************)
+
+fact drops_inv_nil_aux: ∀L1,L2,s,cs. ⬇*[s, cs] L1 ≡ L2 → cs = ◊ → L1 = L2.
+#L1 #L2 #s #cs * -L1 -L2 -cs //
+#L1 #L #L2 #l #m #cs #_ #_ #H destruct
+qed-.
+
+(* Basic_1: was: drop1_gen_pnil *)
+lemma drops_inv_nil: ∀L1,L2,s. ⬇*[s, ◊] L1 ≡ L2 → L1 = L2.
+/2 width=4 by drops_inv_nil_aux/ qed-.
+
+fact drops_inv_cons_aux: ∀L1,L2,s,cs. ⬇*[s, cs] L1 ≡ L2 →
+ ∀l,m,tl. cs = {l, m} @ tl →
+ ∃∃L. ⬇*[s, tl] L1 ≡ L & ⬇[s, l, m] L ≡ L2.
+#L1 #L2 #s #cs * -L1 -L2 -cs
+[ #L #l #m #tl #H destruct
+| #L1 #L #L2 #cs #l #m #HT1 #HT2 #l0 #m0 #tl #H destruct
+ /2 width=3 by ex2_intro/
+]
+qed-.
+
+(* Basic_1: was: drop1_gen_pcons *)
+lemma drops_inv_cons: ∀L1,L2,s,l,m,cs. ⬇*[s, {l, m} @ cs] L1 ≡ L2 →
+ ∃∃L. ⬇*[s, cs] L1 ≡ L & ⬇[s, l, m] L ≡ L2.
+/2 width=3 by drops_inv_cons_aux/ qed-.
+
+lemma drops_inv_skip2: ∀I,s,cs,cs2,i. cs ▭ i ≡ cs2 →
+ ∀L1,K2,V2. ⬇*[s, cs2] L1 ≡ K2. ⓑ{I} V2 →
+ ∃∃K1,V1,cs1. cs + 1 ▭ i + 1 ≡ cs1 + 1 &
+ ⬇*[s, cs1] K1 ≡ K2 &
+ ⬆*[cs1] V2 ≡ V1 &
+ L1 = K1. ⓑ{I} V1.
+#I #s #cs #cs2 #i #H elim H -cs -cs2 -i
+[ #i #L1 #K2 #V2 #H
+ >(drops_inv_nil … H) -L1 /2 width=7 by lifts_nil, minuss_nil, ex4_3_intro, drops_nil/
+| #cs #cs2 #l #m #i #Hil #_ #IHcs2 #L1 #K2 #V2 #H
+ elim (drops_inv_cons … H) -H #L #HL1 #H
+ elim (drop_inv_skip2 … H) -H /2 width=1 by ylt_to_minus/ #K #V <yminus_succ2 #HK2 #HV2 #H destruct
+ elim (IHcs2 … HL1) -IHcs2 -HL1 #K1 #V1 #cs1 #Hcs1 #HK1 #HV1 #X destruct
+ @(ex4_3_intro … K1 V1 … ) // [3,4: /2 width=7 by lifts_cons, drops_cons/ | skip ]
+ >pluss_SO2 >pluss_SO2
+ >yminus_succ2 >ylt_inv_O1 /2 width=1 by ylt_to_minus/ <yminus_succ >commutative_plus (**) (* <yminus_succ1_inj does not work *)
+ /3 width=1 by minuss_lt, ylt_succ/
+| #cs #cs2 #l #m #i #Hil #_ #IHcs2 #L1 #K2 #V2 #H
+ elim (IHcs2 … H) -IHcs2 -H #K1 #V1 #cs1 #Hcs1 #HK1 #HV1 #X destruct
+ /4 width=7 by minuss_ge, yle_succ, ex4_3_intro/
+]
+qed-.
+
+(* Basic properties *********************************************************)
+
+(* Basic_1: was: drop1_skip_bind *)
+lemma drops_skip: ∀L1,L2,s,cs. ⬇*[s, cs] L1 ≡ L2 → ∀V1,V2. ⬆*[cs] V2 ≡ V1 →
+ ∀I. ⬇*[s, cs + 1] L1.ⓑ{I}V1 ≡ L2.ⓑ{I}V2.
+#L1 #L2 #s #cs #H elim H -L1 -L2 -cs
+[ #L #V1 #V2 #HV12 #I
+ >(lifts_inv_nil … HV12) -HV12 //
+| #L1 #L #L2 #cs #l #m #_ #HL2 #IHL #V1 #V2 #H #I
+ elim (lifts_inv_cons … H) -H /3 width=5 by drop_skip, drops_cons/
+].
+qed.
+
+lemma d1_liftable_liftables: ∀R,s. d_liftable1 R s → d_liftables1 R s.
+#R #s #HR #L #K #cs #H elim H -L -K -cs
+[ #L #T #U #H #HT <(lifts_inv_nil … H) -H //
+| #L1 #L #L2 #cs #l #m #_ #HL2 #IHL #T2 #T1 #H #HLT2
+ elim (lifts_inv_cons … H) -H /3 width=10 by/
+]
+qed.
+
+lemma d1_liftables_liftables_all: ∀R,s. d_liftables1 R s → d_liftables1_all R s.
+#R #s #HR #L #K #cs #HLK #Ts #Us #H elim H -Ts -Us normalize //
+#Ts #Us #T #U #HTU #_ #IHTUs * /3 width=7 by conj/
+qed.
+
+(* Basic_1: removed theorems 1: drop1_getl_trans *)
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/substitution/drop_drop.ma".
+include "basic_2/multiple/drops.ma".
+
+(* ITERATED LOCAL ENVIRONMENT SLICING ***************************************)
+
+(* Properties concerning basic local environment slicing ********************)
+
+lemma drops_drop_trans: ∀L1,L,cs. ⬇*[Ⓕ, cs] L1 ≡ L → ∀L2,i. ⬇[i] L ≡ L2 →
+ ∃∃L0,cs0,i0. ⬇[i0] L1 ≡ L0 & ⬇*[Ⓕ, cs0] L0 ≡ L2 &
+ @⦃i, cs⦄ ≡ i0 & cs ▭ i ≡ cs0.
+#L1 #L #cs #H elim H -L1 -L -cs
+[ /2 width=7 by drops_nil, minuss_nil, at_nil, ex4_3_intro/
+| #L1 #L0 #L #cs #l #m #_ #HL0 #IHL0 #L2 #i #HL2
+ elim (ylt_split i l) #Hil
+ [ elim (drop_trans_le … HL0 … HL2) -L /2 width=2 by ylt_fwd_le/
+ #L #HL0 #HL2 elim (IHL0 … HL0) -L0 /3 width=7 by drops_cons, minuss_lt, at_lt, ex4_3_intro/
+ | lapply (drop_trans_ge … HL0 … HL2 ?) -L // #HL02
+ elim (IHL0 … HL02) -L0 /3 width=7 by minuss_ge, at_ge, ex4_3_intro/
+ ]
+]
+qed-.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/multiple/drops_drop.ma".
+
+(* ITERATED LOCAL ENVIRONMENT SLICING ***************************************)
+
+(* Main properties **********************************************************)
+
+(* Basic_1: was: drop1_trans *)
+theorem drops_trans: ∀L,L2,s,cs2. ⬇*[s, cs2] L ≡ L2 → ∀L1,cs1. ⬇*[s, cs1] L1 ≡ L →
+ ⬇*[s, cs2 @@ cs1] L1 ≡ L2.
+#L #L2 #s #cs2 #H elim H -L -L2 -cs2 /3 width=3 by drops_cons/
+qed-.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/notation/relations/lazyeq_7.ma".
+include "basic_2/grammar/genv.ma".
+include "basic_2/multiple/lleq.ma".
+
+(* LAZY EQUIVALENCE FOR CLOSURES ********************************************)
+
+inductive fleq (l) (G) (L1) (T): relation3 genv lenv term ≝
+| fleq_intro: ∀L2. L1 ≡[T, l] L2 → fleq l G L1 T G L2 T
+.
+
+interpretation
+ "lazy equivalence (closure)"
+ 'LazyEq l G1 L1 T1 G2 L2 T2 = (fleq l G1 L1 T1 G2 L2 T2).
+
+(* Basic properties *********************************************************)
+
+lemma fleq_refl: ∀l. tri_reflexive … (fleq l).
+/2 width=1 by fleq_intro/ qed.
+
+lemma fleq_sym: ∀l. tri_symmetric … (fleq l).
+#l #G1 #L1 #T1 #G2 #L2 #T2 * /3 width=1 by fleq_intro, lleq_sym/
+qed-.
+
+(* Basic inversion lemmas ***************************************************)
+
+lemma fleq_inv_gen: ∀G1,G2,L1,L2,T1,T2,l. ⦃G1, L1, T1⦄ ≡[l] ⦃G2, L2, T2⦄ →
+ ∧∧ G1 = G2 & L1 ≡[T1, l] L2 & T1 = T2.
+#G1 #G2 #L1 #L2 #T1 #T2 #l * -G2 -L2 -T2 /2 width=1 by and3_intro/
+qed-.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/multiple/lleq_lleq.ma".
+include "basic_2/multiple/fleq.ma".
+
+(* LAZY EQUIVALENCE FOR CLOSURES *******************************************)
+
+(* Main properties **********************************************************)
+
+theorem fleq_trans: ∀l. tri_transitive … (fleq l).
+#l #G1 #G #L1 #L #T1 #T * -G -L -T
+#L #HT1 #G2 #L2 #T2 * -G2 -L2 -T2
+/3 width=3 by lleq_trans, fleq_intro/
+qed-.
+
+theorem fleq_canc_sn: ∀G,G1,G2,L,L1,L2,T,T1,T2,l.
+ ⦃G, L, T⦄ ≡[l] ⦃G1, L1, T1⦄→ ⦃G, L, T⦄ ≡[l] ⦃G2, L2, T2⦄ → ⦃G1, L1, T1⦄ ≡[l] ⦃G2, L2, T2⦄.
+/3 width=5 by fleq_trans, fleq_sym/ qed-.
+
+theorem fleq_canc_dx: ∀G1,G2,G,L1,L2,L,T1,T2,T,l.
+ ⦃G1, L1, T1⦄ ≡[l] ⦃G, L, T⦄ → ⦃G2, L2, T2⦄ ≡[l] ⦃G, L, T⦄ → ⦃G1, L1, T1⦄ ≡[l] ⦃G2, L2, T2⦄.
+/3 width=5 by fleq_trans, fleq_sym/ qed-.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/notation/relations/suptermplus_6.ma".
+include "basic_2/substitution/fqu.ma".
+
+(* PLUS-ITERATED SUPCLOSURE *************************************************)
+
+definition fqup: tri_relation genv lenv term ≝ tri_TC … fqu.
+
+interpretation "plus-iterated structural successor (closure)"
+ 'SupTermPlus G1 L1 T1 G2 L2 T2 = (fqup G1 L1 T1 G2 L2 T2).
+
+(* Basic properties *********************************************************)
+
+lemma fqu_fqup: ∀G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐ ⦃G2, L2, T2⦄ → ⦃G1, L1, T1⦄ ⊐+ ⦃G2, L2, T2⦄.
+/2 width=1 by tri_inj/ qed.
+
+lemma fqup_strap1: ∀G1,G,G2,L1,L,L2,T1,T,T2.
+ ⦃G1, L1, T1⦄ ⊐+ ⦃G, L, T⦄ → ⦃G, L, T⦄ ⊐ ⦃G2, L2, T2⦄ →
+ ⦃G1, L1, T1⦄ ⊐+ ⦃G2, L2, T2⦄.
+/2 width=5 by tri_step/ qed.
+
+lemma fqup_strap2: ∀G1,G,G2,L1,L,L2,T1,T,T2.
+ ⦃G1, L1, T1⦄ ⊐ ⦃G, L, T⦄ → ⦃G, L, T⦄ ⊐+ ⦃G2, L2, T2⦄ →
+ ⦃G1, L1, T1⦄ ⊐+ ⦃G2, L2, T2⦄.
+/2 width=5 by tri_TC_strap/ qed.
+
+lemma fqup_drop: ∀G1,G2,L1,K1,K2,T1,T2,U1,m. ⬇[m] L1 ≡ K1 → ⬆[0, m] T1 ≡ U1 →
+ ⦃G1, K1, T1⦄ ⊐+ ⦃G2, K2, T2⦄ → ⦃G1, L1, U1⦄ ⊐+ ⦃G2, K2, T2⦄.
+#G1 #G2 #L1 #K1 #K2 #T1 #T2 #U1 #m #HLK1 #HTU1 #HT12 elim (eq_or_gt … m) #H destruct
+[ >(drop_inv_O2 … HLK1) -L1 <(lift_inv_O2 … HTU1) -U1 //
+| /3 width=5 by fqup_strap2, fqu_drop_lt/
+]
+qed-.
+
+lemma fqup_lref: ∀I,G,L,K,V,i. ⬇[i] L ≡ K.ⓑ{I}V → ⦃G, L, #i⦄ ⊐+ ⦃G, K, V⦄.
+/3 width=6 by fqu_lref_O, fqu_fqup, lift_lref_ge, fqup_drop/ qed.
+
+lemma fqup_pair_sn: ∀I,G,L,V,T. ⦃G, L, ②{I}V.T⦄ ⊐+ ⦃G, L, V⦄.
+/2 width=1 by fqu_pair_sn, fqu_fqup/ qed.
+
+lemma fqup_bind_dx: ∀a,I,G,L,V,T. ⦃G, L, ⓑ{a,I}V.T⦄ ⊐+ ⦃G, L.ⓑ{I}V, T⦄.
+/2 width=1 by fqu_bind_dx, fqu_fqup/ qed.
+
+lemma fqup_flat_dx: ∀I,G,L,V,T. ⦃G, L, ⓕ{I}V.T⦄ ⊐+ ⦃G, L, T⦄.
+/2 width=1 by fqu_flat_dx, fqu_fqup/ qed.
+
+lemma fqup_flat_dx_pair_sn: ∀I1,I2,G,L,V1,V2,T. ⦃G, L, ⓕ{I1}V1.②{I2}V2.T⦄ ⊐+ ⦃G, L, V2⦄.
+/2 width=5 by fqu_pair_sn, fqup_strap1/ qed.
+
+lemma fqup_bind_dx_flat_dx: ∀a,G,I1,I2,L,V1,V2,T. ⦃G, L, ⓑ{a,I1}V1.ⓕ{I2}V2.T⦄ ⊐+ ⦃G, L.ⓑ{I1}V1, T⦄.
+/2 width=5 by fqu_flat_dx, fqup_strap1/ qed.
+
+lemma fqup_flat_dx_bind_dx: ∀a,I1,I2,G,L,V1,V2,T. ⦃G, L, ⓕ{I1}V1.ⓑ{a,I2}V2.T⦄ ⊐+ ⦃G, L.ⓑ{I2}V2, T⦄.
+/2 width=5 by fqu_bind_dx, fqup_strap1/ qed.
+
+(* Basic eliminators ********************************************************)
+
+lemma fqup_ind: ∀G1,L1,T1. ∀R:relation3 ….
+ (∀G2,L2,T2. ⦃G1, L1, T1⦄ ⊐ ⦃G2, L2, T2⦄ → R G2 L2 T2) →
+ (∀G,G2,L,L2,T,T2. ⦃G1, L1, T1⦄ ⊐+ ⦃G, L, T⦄ → ⦃G, L, T⦄ ⊐ ⦃G2, L2, T2⦄ → R G L T → R G2 L2 T2) →
+ ∀G2,L2,T2. ⦃G1, L1, T1⦄ ⊐+ ⦃G2, L2, T2⦄ → R G2 L2 T2.
+#G1 #L1 #T1 #R #IH1 #IH2 #G2 #L2 #T2 #H
+@(tri_TC_ind … IH1 IH2 G2 L2 T2 H)
+qed-.
+
+lemma fqup_ind_dx: ∀G2,L2,T2. ∀R:relation3 ….
+ (∀G1,L1,T1. ⦃G1, L1, T1⦄ ⊐ ⦃G2, L2, T2⦄ → R G1 L1 T1) →
+ (∀G1,G,L1,L,T1,T. ⦃G1, L1, T1⦄ ⊐ ⦃G, L, T⦄ → ⦃G, L, T⦄ ⊐+ ⦃G2, L2, T2⦄ → R G L T → R G1 L1 T1) →
+ ∀G1,L1,T1. ⦃G1, L1, T1⦄ ⊐+ ⦃G2, L2, T2⦄ → R G1 L1 T1.
+#G2 #L2 #T2 #R #IH1 #IH2 #G1 #L1 #T1 #H
+@(tri_TC_ind_dx … IH1 IH2 G1 L1 T1 H)
+qed-.
+
+(* Basic forward lemmas *****************************************************)
+
+lemma fqup_fwd_fw: ∀G1,G2,L1,L2,T1,T2.
+ ⦃G1, L1, T1⦄ ⊐+ ⦃G2, L2, T2⦄ → ♯{G2, L2, T2} < ♯{G1, L1, T1}.
+#G1 #G2 #L1 #L2 #T1 #T2 #H @(fqup_ind … H) -G2 -L2 -T2
+/3 width=3 by fqu_fwd_fw, transitive_lt/
+qed-.
+
+(* Advanced eliminators *****************************************************)
+
+lemma fqup_wf_ind: ∀R:relation3 …. (
+ ∀G1,L1,T1. (∀G2,L2,T2. ⦃G1, L1, T1⦄ ⊐+ ⦃G2, L2, T2⦄ → R G2 L2 T2) →
+ R G1 L1 T1
+ ) → ∀G1,L1,T1. R G1 L1 T1.
+#R #HR @(f3_ind … fw) #x #IHx #G1 #L1 #T1 #H destruct /4 width=1 by fqup_fwd_fw/
+qed-.
+
+lemma fqup_wf_ind_eq: ∀R:relation3 …. (
+ ∀G1,L1,T1. (∀G2,L2,T2. ⦃G1, L1, T1⦄ ⊐+ ⦃G2, L2, T2⦄ → R G2 L2 T2) →
+ ∀G2,L2,T2. G1 = G2 → L1 = L2 → T1 = T2 → R G2 L2 T2
+ ) → ∀G1,L1,T1. R G1 L1 T1.
+#R #HR @(f3_ind … fw) #x #IHx #G1 #L1 #T1 #H destruct /4 width=7 by fqup_fwd_fw/
+qed-.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/multiple/fqup.ma".
+
+(* PLUS-ITERATED SUPCLOSURE *************************************************)
+
+(* Main properties **********************************************************)
+
+theorem fqup_trans: tri_transitive … fqup.
+/2 width=5 by tri_TC_transitive/ qed-.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/notation/relations/suptermstar_6.ma".
+include "basic_2/substitution/fquq.ma".
+include "basic_2/multiple/fqup.ma".
+
+(* STAR-ITERATED SUPCLOSURE *************************************************)
+
+definition fqus: tri_relation genv lenv term ≝ tri_TC … fquq.
+
+interpretation "star-iterated structural successor (closure)"
+ 'SupTermStar G1 L1 T1 G2 L2 T2 = (fqus G1 L1 T1 G2 L2 T2).
+
+(* Basic eliminators ********************************************************)
+
+lemma fqus_ind: ∀G1,L1,T1. ∀R:relation3 …. R G1 L1 T1 →
+ (∀G,G2,L,L2,T,T2. ⦃G1, L1, T1⦄ ⊐* ⦃G, L, T⦄ → ⦃G, L, T⦄ ⊐⸮ ⦃G2, L2, T2⦄ → R G L T → R G2 L2 T2) →
+ ∀G2,L2,T2. ⦃G1, L1, T1⦄ ⊐* ⦃G2, L2, T2⦄ → R G2 L2 T2.
+#G1 #L1 #T1 #R #IH1 #IH2 #G2 #L2 #T2 #H
+@(tri_TC_star_ind … IH1 IH2 G2 L2 T2 H) //
+qed-.
+
+lemma fqus_ind_dx: ∀G2,L2,T2. ∀R:relation3 …. R G2 L2 T2 →
+ (∀G1,G,L1,L,T1,T. ⦃G1, L1, T1⦄ ⊐⸮ ⦃G, L, T⦄ → ⦃G, L, T⦄ ⊐* ⦃G2, L2, T2⦄ → R G L T → R G1 L1 T1) →
+ ∀G1,L1,T1. ⦃G1, L1, T1⦄ ⊐* ⦃G2, L2, T2⦄ → R G1 L1 T1.
+#G2 #L2 #T2 #R #IH1 #IH2 #G1 #L1 #T1 #H
+@(tri_TC_star_ind_dx … IH1 IH2 G1 L1 T1 H) //
+qed-.
+
+(* Basic properties *********************************************************)
+
+lemma fqus_refl: tri_reflexive … fqus.
+/2 width=1 by tri_inj/ qed.
+
+lemma fquq_fqus: ∀G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐⸮ ⦃G2, L2, T2⦄ → ⦃G1, L1, T1⦄ ⊐* ⦃G2, L2, T2⦄.
+/2 width=1 by tri_inj/ qed.
+
+lemma fqus_strap1: ∀G1,G,G2,L1,L,L2,T1,T,T2. ⦃G1, L1, T1⦄ ⊐* ⦃G, L, T⦄ → ⦃G, L, T⦄ ⊐⸮ ⦃G2, L2, T2⦄ →
+ ⦃G1, L1, T1⦄ ⊐* ⦃G2, L2, T2⦄.
+/2 width=5 by tri_step/ qed-.
+
+lemma fqus_strap2: ∀G1,G,G2,L1,L,L2,T1,T,T2. ⦃G1, L1, T1⦄ ⊐⸮ ⦃G, L, T⦄ → ⦃G, L, T⦄ ⊐* ⦃G2, L2, T2⦄ →
+ ⦃G1, L1, T1⦄ ⊐* ⦃G2, L2, T2⦄.
+/2 width=5 by tri_TC_strap/ qed-.
+
+lemma fqus_drop: ∀G1,G2,K1,K2,T1,T2. ⦃G1, K1, T1⦄ ⊐* ⦃G2, K2, T2⦄ →
+ ∀L1,U1,m. ⬇[m] L1 ≡ K1 → ⬆[0, m] T1 ≡ U1 →
+ ⦃G1, L1, U1⦄ ⊐* ⦃G2, K2, T2⦄.
+#G1 #G2 #K1 #K2 #T1 #T2 #H @(fqus_ind … H) -G2 -K2 -T2
+/3 width=5 by fqus_strap1, fquq_fqus, fquq_drop/
+qed-.
+
+lemma fqup_fqus: ∀G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐+ ⦃G2, L2, T2⦄ → ⦃G1, L1, T1⦄ ⊐* ⦃G2, L2, T2⦄.
+#G1 #G2 #L1 #L2 #T1 #T2 #H @(fqup_ind … H) -G2 -L2 -T2
+/3 width=5 by fqus_strap1, fquq_fqus, fqu_fquq/
+qed.
+
+(* Basic forward lemmas *****************************************************)
+
+lemma fqus_fwd_fw: ∀G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐* ⦃G2, L2, T2⦄ → ♯{G2, L2, T2} ≤ ♯{G1, L1, T1}.
+#G1 #G2 #L1 #L2 #T1 #T2 #H @(fqus_ind … H) -L2 -T2
+/3 width=3 by fquq_fwd_fw, transitive_le/
+qed-.
+
+(* Basic inversion lemmas ***************************************************)
+
+lemma fqup_inv_step_sn: ∀G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐+ ⦃G2, L2, T2⦄ →
+ ∃∃G,L,T. ⦃G1, L1, T1⦄ ⊐ ⦃G, L, T⦄ & ⦃G, L, T⦄ ⊐* ⦃G2, L2, T2⦄.
+#G1 #G2 #L1 #L2 #T1 #T2 #H @(fqup_ind_dx … H) -G1 -L1 -T1 /2 width=5 by ex2_3_intro/
+#G1 #G #L1 #L #T1 #T #H1 #_ * /4 width=9 by fqus_strap2, fqu_fquq, ex2_3_intro/
+qed-.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/substitution/fquq_alt.ma".
+include "basic_2/multiple/fqus.ma".
+
+(* STAR-ITERATED SUPCLOSURE *************************************************)
+
+(* Advanced inversion lemmas ************************************************)
+
+lemma fqus_inv_gen: ∀G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐* ⦃G2, L2, T2⦄ →
+ ⦃G1, L1, T1⦄ ⊐+ ⦃G2, L2, T2⦄ ∨ (∧∧ G1 = G2 & L1 = L2 & T1 = T2).
+#G1 #G2 #L1 #L2 #T1 #T2 #H @(fqus_ind … H) -G2 -L2 -T2 //
+#G #G2 #L #L2 #T #T2 #_ #H2 * elim (fquq_inv_gen … H2) -H2
+[ /3 width=5 by fqup_strap1, or_introl/
+| * #HG #HL #HT destruct /2 width=1 by or_introl/
+| #H2 * #HG #HL #HT destruct /3 width=1 by fqu_fqup, or_introl/
+| * #H1G #H1L #H1T * #H2G #H2L #H2T destruct /2 width=1 by or_intror/
+]
+qed-.
+
+(* Advanced properties ******************************************************)
+
+lemma fqus_strap1_fqu: ∀G1,G,G2,L1,L,L2,T1,T,T2. ⦃G1, L1, T1⦄ ⊐* ⦃G, L, T⦄ → ⦃G, L, T⦄ ⊐ ⦃G2, L2, T2⦄ →
+ ⦃G1, L1, T1⦄ ⊐+ ⦃G2, L2, T2⦄.
+#G1 #G #G2 #L1 #L #L2 #T1 #T #T2 #H1 #H2 elim (fqus_inv_gen … H1) -H1
+[ /2 width=5 by fqup_strap1/
+| * #HG #HL #HT destruct /2 width=1 by fqu_fqup/
+]
+qed-.
+
+lemma fqus_strap2_fqu: ∀G1,G,G2,L1,L,L2,T1,T,T2. ⦃G1, L1, T1⦄ ⊐ ⦃G, L, T⦄ → ⦃G, L, T⦄ ⊐* ⦃G2, L2, T2⦄ →
+ ⦃G1, L1, T1⦄ ⊐+ ⦃G2, L2, T2⦄.
+#G1 #G #G2 #L1 #L #L2 #T1 #T #T2 #H1 #H2 elim (fqus_inv_gen … H2) -H2
+[ /2 width=5 by fqup_strap2/
+| * #HG #HL #HT destruct /2 width=1 by fqu_fqup/
+]
+qed-.
+
+lemma fqus_fqup_trans: ∀G1,G,G2,L1,L,L2,T1,T,T2. ⦃G1, L1, T1⦄ ⊐* ⦃G, L, T⦄ → ⦃G, L, T⦄ ⊐+ ⦃G2, L2, T2⦄ →
+ ⦃G1, L1, T1⦄ ⊐+ ⦃G2, L2, T2⦄.
+#G1 #G #G2 #L1 #L #L2 #T1 #T #T2 #H1 #H2 @(fqup_ind … H2) -H2 -G2 -L2 -T2
+/2 width=5 by fqus_strap1_fqu, fqup_strap1/
+qed-.
+
+lemma fqup_fqus_trans: ∀G1,G,G2,L1,L,L2,T1,T,T2. ⦃G1, L1, T1⦄ ⊐+ ⦃G, L, T⦄ →
+ ⦃G, L, T⦄ ⊐* ⦃G2, L2, T2⦄ → ⦃G1, L1, T1⦄ ⊐+ ⦃G2, L2, T2⦄.
+#G1 #G #G2 #L1 #L #L2 #T1 #T #T2 #H1 @(fqup_ind_dx … H1) -H1 -G1 -L1 -T1
+/3 width=5 by fqus_strap2_fqu, fqup_strap2/
+qed-.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/multiple/fqus.ma".
+
+(* STAR-ITERATED SUPCLOSURE *************************************************)
+
+(* Main properties **********************************************************)
+
+theorem fqus_trans: tri_transitive … fqus.
+/2 width=5 by tri_TC_transitive/ qed-.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/notation/relations/freestar_3.ma".
+include "basic_2/grammar/trace_sor.ma".
+include "basic_2/grammar/lenv.ma".
+
+(* CONTEXT-SENSITIVE FREE VARIABLES *****************************************)
+
+inductive frees: relation3 lenv term trace ≝
+| frees_atom: ∀I. frees (⋆) (⓪{I}) (◊)
+| frees_sort: ∀L,k,cs. frees L (⋆k) cs →
+ ∀I,T. frees (L.ⓑ{I}T) (⋆k) (Ⓕ @ cs)
+| frees_zero: ∀L,T,cs. frees L T cs →
+ ∀I. frees (L.ⓑ{I}T) (#0) (Ⓣ @ cs)
+| frees_lref: ∀L,i,cs. frees L (#i) cs →
+ ∀I,T. frees (L.ⓑ{I}T) (#(S i)) (Ⓕ @ cs)
+| frees_gref: ∀L,p,cs. frees L (§p) cs →
+ ∀I,T. frees (L.ⓑ{I}T) (§p) (Ⓕ @ cs)
+| frees_bind: ∀cv,ct,cs. cv ⋓ ct ≡ cs →
+ ∀L,V. frees L V cv → ∀I,T,b. frees (L.ⓑ{I}V) T (b @ ct) →
+ ∀a. frees L (ⓑ{a,I}V.T) cs
+| frees_flat: ∀cv,ct,cs. cv ⋓ ct ≡ cs →
+ ∀L,V. frees L V cv → ∀T. frees L T ct →
+ ∀I. frees L (ⓕ{I}V.T) cs
+.
+
+interpretation
+ "context-sensitive free variables (term)"
+ 'FreeStar L T cs = (frees L T cs).
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "ground_2/relocation/trace_isid.ma".
+include "basic_2/notation/relations/rliftstar_3.ma".
+include "basic_2/grammar/term.ma".
+
+(* GENERIC TERM RELOCATION **************************************************)
+
+(* Basic_1: includes:
+ lift_sort lift_lref_lt lift_lref_ge lift_bind lift_flat
+ lifts_nil lifts_cons
+*)
+inductive lifts: trace → relation term ≝
+| lifts_sort: ∀k,t. lifts t (⋆k) (⋆k)
+| lifts_lref: ∀i1,i2,t. @⦃i1, t⦄ ≡ i2 → lifts t (#i1) (#i2)
+| lifts_gref: ∀p,t. lifts t (§p) (§p)
+| lifts_bind: ∀a,I,V1,V2,T1,T2,t.
+ lifts t V1 V2 → lifts (Ⓣ@t) T1 T2 →
+ lifts t (ⓑ{a,I}V1.T1) (ⓑ{a,I}V2.T2)
+| lifts_flat: ∀I,V1,V2,T1,T2,t.
+ lifts t V1 V2 → lifts t T1 T2 →
+ lifts t (ⓕ{I}V1.T1) (ⓕ{I}V2.T2)
+.
+
+interpretation "generic relocation (term)"
+ 'RLiftStar cs T1 T2 = (lifts cs T1 T2).
+
+(* Basic inversion lemmas ***************************************************)
+
+fact lifts_inv_sort1_aux: ∀X,Y,t. ⬆*[t] X ≡ Y → ∀k. X = ⋆k → Y = ⋆k.
+#X #Y #t * -X -Y -t //
+[ #i1 #i2 #t #_ #x #H destruct
+| #a #I #V1 #V2 #T1 #T2 #t #_ #_ #x #H destruct
+| #I #V1 #V2 #T1 #T2 #t #_ #_ #x #H destruct
+]
+qed-.
+
+(* Basic_1: was: lift1_sort *)
+(* Basic_2A1: includes: lift_inv_sort1 *)
+lemma lifts_inv_sort1: ∀Y,k,t. ⬆*[t] ⋆k ≡ Y → Y = ⋆k.
+/2 width=4 by lifts_inv_sort1_aux/ qed-.
+
+fact lifts_inv_lref1_aux: ∀X,Y,t. ⬆*[t] X ≡ Y → ∀i1. X = #i1 →
+ ∃∃i2. @⦃i1, t⦄ ≡ i2 & Y = #i2.
+#X #Y #t * -X -Y -t
+[ #k #t #x #H destruct
+| #i1 #i2 #t #Hi12 #x #H destruct /2 width=3 by ex2_intro/
+| #p #t #x #H destruct
+| #a #I #V1 #V2 #T1 #T2 #t #_ #_ #x #H destruct
+| #I #V1 #V2 #T1 #T2 #t #_ #_ #x #H destruct
+]
+qed-.
+
+(* Basic_1: was: lift1_lref *)
+(* Basic_2A1: includes: lift_inv_lref1 lift_inv_lref1_lt lift_inv_lref1_ge *)
+lemma lifts_inv_lref1: ∀Y,i1,t. ⬆*[t] #i1 ≡ Y →
+ ∃∃i2. @⦃i1, t⦄ ≡ i2 & Y = #i2.
+/2 width=3 by lifts_inv_lref1_aux/ qed-.
+
+fact lifts_inv_gref1_aux: ∀X,Y,t. ⬆*[t] X ≡ Y → ∀p. X = §p → Y = §p.
+#X #Y #t * -X -Y -t //
+[ #i1 #i2 #t #_ #x #H destruct
+| #a #I #V1 #V2 #T1 #T2 #t #_ #_ #x #H destruct
+| #I #V1 #V2 #T1 #T2 #t #_ #_ #x #H destruct
+]
+qed-.
+
+(* Basic_2A1: includes: lift_inv_gref1 *)
+lemma lifts_inv_gref1: ∀Y,p,t. ⬆*[t] §p ≡ Y → Y = §p.
+/2 width=4 by lifts_inv_gref1_aux/ qed-.
+
+fact lifts_inv_bind1_aux: ∀X,Y,t. ⬆*[t] X ≡ Y →
+ ∀a,I,V1,T1. X = ⓑ{a,I}V1.T1 →
+ ∃∃V2,T2. ⬆*[t] V1 ≡ V2 & ⬆*[Ⓣ@t] T1 ≡ T2 &
+ Y = ⓑ{a,I}V2.T2.
+#X #Y #t * -X -Y -t
+[ #k #t #b #J #W1 #U1 #H destruct
+| #i1 #i2 #t #_ #b #J #W1 #U1 #H destruct
+| #p #t #b #J #W1 #U1 #H destruct
+| #a #I #V1 #V2 #T1 #T2 #t #HV12 #HT12 #b #J #W1 #U1 #H destruct /2 width=5 by ex3_2_intro/
+| #I #V1 #V2 #T1 #T2 #t #_ #_ #b #J #W1 #U1 #H destruct
+]
+qed-.
+
+(* Basic_1: was: lift1_bind *)
+(* Basic_2A1: includes: lift_inv_bind1 *)
+lemma lifts_inv_bind1: ∀a,I,V1,T1,Y,t. ⬆*[t] ⓑ{a,I}V1.T1 ≡ Y →
+ ∃∃V2,T2. ⬆*[t] V1 ≡ V2 & ⬆*[Ⓣ@t] T1 ≡ T2 &
+ Y = ⓑ{a,I}V2.T2.
+/2 width=3 by lifts_inv_bind1_aux/ qed-.
+
+fact lifts_inv_flat1_aux: ∀X,Y,t. ⬆*[t] X ≡ Y →
+ ∀I,V1,T1. X = ⓕ{I}V1.T1 →
+ ∃∃V2,T2. ⬆*[t] V1 ≡ V2 & ⬆*[t] T1 ≡ T2 &
+ Y = ⓕ{I}V2.T2.
+#X #Y #t * -X -Y -t
+[ #k #t #J #W1 #U1 #H destruct
+| #i1 #i2 #t #_ #J #W1 #U1 #H destruct
+| #p #t #J #W1 #U1 #H destruct
+| #a #I #V1 #V2 #T1 #T2 #t #_ #_ #J #W1 #U1 #H destruct
+| #I #V1 #V2 #T1 #T2 #t #HV12 #HT12 #J #W1 #U1 #H destruct /2 width=5 by ex3_2_intro/
+]
+qed-.
+
+(* Basic_1: was: lift1_flat *)
+(* Basic_2A1: includes: lift_inv_flat1 *)
+lemma lifts_inv_flat1: ∀I,V1,T1,Y,t. ⬆*[t] ⓕ{I}V1.T1 ≡ Y →
+ ∃∃V2,T2. ⬆*[t] V1 ≡ V2 & ⬆*[t] T1 ≡ T2 &
+ Y = ⓕ{I}V2.T2.
+/2 width=3 by lifts_inv_flat1_aux/ qed-.
+
+fact lifts_inv_sort2_aux: ∀X,Y,t. ⬆*[t] X ≡ Y → ∀k. Y = ⋆k → X = ⋆k.
+#X #Y #t * -X -Y -t //
+[ #i1 #i2 #t #_ #x #H destruct
+| #a #I #V1 #V2 #T1 #T2 #t #_ #_ #x #H destruct
+| #I #V1 #V2 #T1 #T2 #t #_ #_ #x #H destruct
+]
+qed-.
+
+(* Basic_1: includes: lift_gen_sort *)
+(* Basic_2A1: includes: lift_inv_sort2 *)
+lemma lifts_inv_sort2: ∀X,k,t. ⬆*[t] X ≡ ⋆k → X = ⋆k.
+/2 width=4 by lifts_inv_sort2_aux/ qed-.
+
+fact lifts_inv_lref2_aux: ∀X,Y,t. ⬆*[t] X ≡ Y → ∀i2. Y = #i2 →
+ ∃∃i1. @⦃i1, t⦄ ≡ i2 & X = #i1.
+#X #Y #t * -X -Y -t
+[ #k #t #x #H destruct
+| #i1 #i2 #t #Hi12 #x #H destruct /2 width=3 by ex2_intro/
+| #p #t #x #H destruct
+| #a #I #V1 #V2 #T1 #T2 #t #_ #_ #x #H destruct
+| #I #V1 #V2 #T1 #T2 #t #_ #_ #x #H destruct
+]
+qed-.
+
+(* Basic_1: includes: lift_gen_lref lift_gen_lref_lt lift_gen_lref_false lift_gen_lref_ge *)
+(* Basic_2A1: includes: lift_inv_lref2 lift_inv_lref2_lt lift_inv_lref2_be lift_inv_lref2_ge lift_inv_lref2_plus *)
+lemma lifts_inv_lref2: ∀X,i2,t. ⬆*[t] X ≡ #i2 →
+ ∃∃i1. @⦃i1, t⦄ ≡ i2 & X = #i1.
+/2 width=3 by lifts_inv_lref2_aux/ qed-.
+
+fact lifts_inv_gref2_aux: ∀X,Y,t. ⬆*[t] X ≡ Y → ∀p. Y = §p → X = §p.
+#X #Y #t * -X -Y -t //
+[ #i1 #i2 #t #_ #x #H destruct
+| #a #I #V1 #V2 #T1 #T2 #t #_ #_ #x #H destruct
+| #I #V1 #V2 #T1 #T2 #t #_ #_ #x #H destruct
+]
+qed-.
+
+(* Basic_2A1: includes: lift_inv_gref1 *)
+lemma lifts_inv_gref2: ∀X,p,t. ⬆*[t] X ≡ §p → X = §p.
+/2 width=4 by lifts_inv_gref2_aux/ qed-.
+
+fact lifts_inv_bind2_aux: ∀X,Y,t. ⬆*[t] X ≡ Y →
+ ∀a,I,V2,T2. Y = ⓑ{a,I}V2.T2 →
+ ∃∃V1,T1. ⬆*[t] V1 ≡ V2 & ⬆*[Ⓣ@t] T1 ≡ T2 &
+ X = ⓑ{a,I}V1.T1.
+#X #Y #t * -X -Y -t
+[ #k #t #b #J #W2 #U2 #H destruct
+| #i1 #i2 #t #_ #b #J #W2 #U2 #H destruct
+| #p #t #b #J #W2 #U2 #H destruct
+| #a #I #V1 #V2 #T1 #T2 #t #HV12 #HT12 #b #J #W2 #U2 #H destruct /2 width=5 by ex3_2_intro/
+| #I #V1 #V2 #T1 #T2 #t #_ #_ #b #J #W2 #U2 #H destruct
+]
+qed-.
+
+(* Basic_1: includes: lift_gen_bind *)
+(* Basic_2A1: includes: lift_inv_bind2 *)
+lemma lifts_inv_bind2: ∀a,I,V2,T2,X,t. ⬆*[t] X ≡ ⓑ{a,I}V2.T2 →
+ ∃∃V1,T1. ⬆*[t] V1 ≡ V2 & ⬆*[Ⓣ@t] T1 ≡ T2 &
+ X = ⓑ{a,I}V1.T1.
+/2 width=3 by lifts_inv_bind2_aux/ qed-.
+
+fact lifts_inv_flat2_aux: ∀X,Y,t. ⬆*[t] X ≡ Y →
+ ∀I,V2,T2. Y = ⓕ{I}V2.T2 →
+ ∃∃V1,T1. ⬆*[t] V1 ≡ V2 & ⬆*[t] T1 ≡ T2 &
+ X = ⓕ{I}V1.T1.
+#X #Y #t * -X -Y -t
+[ #k #t #J #W2 #U2 #H destruct
+| #i1 #i2 #t #_ #J #W2 #U2 #H destruct
+| #p #t #J #W2 #U2 #H destruct
+| #a #I #V1 #V2 #T1 #T2 #t #_ #_ #J #W2 #U2 #H destruct
+| #I #V1 #V2 #T1 #T2 #t #HV12 #HT12 #J #W2 #U2 #H destruct /2 width=5 by ex3_2_intro/
+]
+qed-.
+
+(* Basic_1: includes: lift_gen_flat *)
+(* Basic_2A1: includes: lift_inv_flat2 *)
+lemma lifts_inv_flat2: ∀I,V2,T2,X,t. ⬆*[t] X ≡ ⓕ{I}V2.T2 →
+ ∃∃V1,T1. ⬆*[t] V1 ≡ V2 & ⬆*[t] T1 ≡ T2 &
+ X = ⓕ{I}V1.T1.
+/2 width=3 by lifts_inv_flat2_aux/ qed-.
+
+(* Basic_2A1: includes: lift_inv_pair_xy_x *)
+lemma lifts_inv_pair_xy_x: ∀I,V,T,t. ⬆*[t] ②{I}V.T ≡ V → ⊥.
+#J #V elim V -V
+[ * #i #U #t #H
+ [ lapply (lifts_inv_sort2 … H) -H #H destruct
+ | elim (lifts_inv_lref2 … H) -H
+ #x #_ #H destruct
+ | lapply (lifts_inv_gref2 … H) -H #H destruct
+ ]
+| * [ #a ] #I #V2 #T2 #IHV2 #_ #U #t #H
+ [ elim (lifts_inv_bind2 … H) -H #V1 #T1 #HV12 #_ #H destruct /2 width=3 by/
+ | elim (lifts_inv_flat2 … H) -H #V1 #T1 #HV12 #_ #H destruct /2 width=3 by/
+ ]
+]
+qed-.
+
+(* Basic_1: includes: thead_x_lift_y_y *)
+(* Basic_2A1: includes: lift_inv_pair_xy_y *)
+lemma lifts_inv_pair_xy_y: ∀I,T,V,t. ⬆*[t] ②{I}V.T ≡ T → ⊥.
+#J #T elim T -T
+[ * #i #W #t #H
+ [ lapply (lifts_inv_sort2 … H) -H #H destruct
+ | elim (lifts_inv_lref2 … H) -H
+ #x #_ #H destruct
+ | lapply (lifts_inv_gref2 … H) -H #H destruct
+ ]
+| * [ #a ] #I #V2 #T2 #_ #IHT2 #W #t #H
+ [ elim (lifts_inv_bind2 … H) -H #V1 #T1 #_ #HT12 #H destruct /2 width=4 by/
+ | elim (lifts_inv_flat2 … H) -H #V1 #T1 #_ #HT12 #H destruct /2 width=4 by/
+ ]
+]
+qed-.
+
+(* Basic forward lemmas *****************************************************)
+
+(* Basic_2A1: includes: lift_inv_O2 *)
+lemma lifts_fwd_isid: ∀T1,T2,t. ⬆*[t] T1 ≡ T2 → 𝐈⦃t⦄ → T1 = T2.
+#T1 #T2 #t #H elim H -T1 -T2 -t /4 width=3 by isid_inv_at, eq_f2, eq_f/
+qed-.
+
+(* Basic_2A1: includes: lift_fwd_pair1 *)
+lemma lifts_fwd_pair1: ∀I,V1,T1,Y,t. ⬆*[t] ②{I}V1.T1 ≡ Y →
+ ∃∃V2,T2. ⬆*[t] V1 ≡ V2 & Y = ②{I}V2.T2.
+* [ #a ] #I #V1 #T1 #Y #t #H
+[ elim (lifts_inv_bind1 … H) -H /2 width=4 by ex2_2_intro/
+| elim (lifts_inv_flat1 … H) -H /2 width=4 by ex2_2_intro/
+]
+qed-.
+
+(* Basic_2A1: includes: lift_fwd_pair2 *)
+lemma lifts_fwd_pair2: ∀I,V2,T2,X,t. ⬆*[t] X ≡ ②{I}V2.T2 →
+ ∃∃V1,T1. ⬆*[t] V1 ≡ V2 & X = ②{I}V1.T1.
+* [ #a ] #I #V2 #T2 #X #t #H
+[ elim (lifts_inv_bind2 … H) -H /2 width=4 by ex2_2_intro/
+| elim (lifts_inv_flat2 … H) -H /2 width=4 by ex2_2_intro/
+]
+qed-.
+
+(* Basic properties *********************************************************)
+
+(* Basic_1: includes: lift_free (right to left) *)
+(* Basic_2A1: includes: lift_split *)
+lemma lifts_split_trans: ∀T1,T2,t. ⬆*[t] T1 ≡ T2 →
+ ∀t1,t2. t2 ⊚ t1 ≡ t →
+ ∃∃T. ⬆*[t1] T1 ≡ T & ⬆*[t2] T ≡ T2.
+#T1 #T2 #t #H elim H -T1 -T2 -t
+[ /3 width=3 by lifts_sort, ex2_intro/
+| #i1 #i2 #t #Hi #t1 #t2 #Ht elim (after_at_fwd … Ht … Hi) -Ht -Hi
+ /3 width=3 by lifts_lref, ex2_intro/
+| /3 width=3 by lifts_gref, ex2_intro/
+| #a #I #V1 #V2 #T1 #T2 #t #_ #_ #IHV #IHT #t1 #t2 #Ht
+ elim (IHV … Ht) elim (IHT (Ⓣ@t1) (Ⓣ@t2)) -IHV -IHT
+ /3 width=5 by lifts_bind, after_true, ex2_intro/
+| #I #V1 #V2 #T1 #T2 #t #_ #_ #IHV #IHT #t1 #t2 #Ht
+ elim (IHV … Ht) elim (IHT … Ht) -IHV -IHT -Ht
+ /3 width=5 by lifts_flat, ex2_intro/
+]
+qed-.
+
+(* Note: apparently, this was missing in Basic_2A1 *)
+lemma lifts_split_div: ∀T1,T2,t1. ⬆*[t1] T1 ≡ T2 →
+ ∀t2,t. t2 ⊚ t1 ≡ t →
+ ∃∃T. ⬆*[t2] T2 ≡ T & ⬆*[t] T1 ≡ T.
+#T1 #T2 #t1 #H elim H -T1 -T2 -t1
+[ /3 width=3 by lifts_sort, ex2_intro/
+| #i1 #i2 #t1 #Hi #t2 #t #Ht elim (after_at1_fwd … Ht … Hi) -Ht -Hi
+ /3 width=3 by lifts_lref, ex2_intro/
+| /3 width=3 by lifts_gref, ex2_intro/
+| #a #I #V1 #V2 #T1 #T2 #t1 #_ #_ #IHV #IHT #t2 #t #Ht
+ elim (IHV … Ht) elim (IHT (Ⓣ@t2) (Ⓣ@t)) -IHV -IHT
+ /3 width=5 by lifts_bind, after_true, ex2_intro/
+| #I #V1 #V2 #T1 #T2 #t1 #_ #_ #IHV #IHT #t2 #t #Ht
+ elim (IHV … Ht) elim (IHT … Ht) -IHV -IHT -Ht
+ /3 width=5 by lifts_flat, ex2_intro/
+]
+qed-.
+
+(* Basic_1: includes: dnf_dec2 dnf_dec *)
+(* Basic_2A1: includes: is_lift_dec *)
+lemma is_lifts_dec: ∀T2,t. Decidable (∃T1. ⬆*[t] T1 ≡ T2).
+#T1 elim T1 -T1
+[ * [1,3: /3 width=2 by lifts_sort, lifts_gref, ex_intro, or_introl/ ]
+ #i2 #t elim (is_at_dec t i2)
+ [ * /4 width=3 by lifts_lref, ex_intro, or_introl/
+ | #H @or_intror *
+ #X #HX elim (lifts_inv_lref2 … HX) -HX
+ /3 width=2 by ex_intro/
+ ]
+| * [ #a ] #I #V2 #T2 #IHV2 #IHT2 #t
+ [ elim (IHV2 t) -IHV2
+ [ * #V1 #HV12 elim (IHT2 (Ⓣ@t)) -IHT2
+ [ * #T1 #HT12 @or_introl /3 width=2 by lifts_bind, ex_intro/
+ | -V1 #HT2 @or_intror * #X #H
+ elim (lifts_inv_bind2 … H) -H /3 width=2 by ex_intro/
+ ]
+ | -IHT2 #HV2 @or_intror * #X #H
+ elim (lifts_inv_bind2 … H) -H /3 width=2 by ex_intro/
+ ]
+ | elim (IHV2 t) -IHV2
+ [ * #V1 #HV12 elim (IHT2 t) -IHT2
+ [ * #T1 #HT12 /4 width=2 by lifts_flat, ex_intro, or_introl/
+ | -V1 #HT2 @or_intror * #X #H
+ elim (lifts_inv_flat2 … H) -H /3 width=2 by ex_intro/
+ ]
+ | -IHT2 #HV2 @or_intror * #X #H
+ elim (lifts_inv_flat2 … H) -H /3 width=2 by ex_intro/
+ ]
+ ]
+]
+qed-.
+
+(* Basic_2A1: removed theorems 17:
+ lifts_inv_nil lifts_inv_cons lifts_total
+ lift_inv_Y1 lift_inv_Y2 lift_inv_lref_Y1 lift_inv_lref_Y2 lift_lref_Y lift_Y1
+ lift_lref_lt_eq lift_lref_ge_eq lift_lref_plus lift_lref_pred
+ lift_lref_ge_minus lift_lref_ge_minus_eq lift_total lift_refl
+*)
+(* Basic_1: removed theorems 8:
+ lift_lref_gt
+ lift_head lift_gen_head
+ lift_weight_map lift_weight lift_weight_add lift_weight_add_O
+ lift_tlt_dx
+*)
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/relocation/lifts.ma".
+
+(* GENERIC RELOCATION *******************************************************)
+
+(* Main properties **********************************************************)
+
+(* Basic_2A1: includes: lift_inj *)
+theorem lifts_inj: ∀t,T1,U. ⬆*[t] T1 ≡ U → ∀T2. ⬆*[t] T2 ≡ U → T1 = T2.
+#t #T1 #U #H elim H -t -T1 -U
+[ /2 width=2 by lifts_inv_sort2/
+| #i1 #j #t #Hi1j #X #HX elim (lifts_inv_lref2 … HX) -HX
+ /4 width=4 by at_inj, eq_f/
+| /2 width=2 by lifts_inv_gref2/
+| #a #I #V1 #V2 #T1 #T2 #t #_ #_ #IHV12 #IHT12 #X #HX elim (lifts_inv_bind2 … HX) -HX
+ #V #T #HV1 #HT1 #HX destruct /3 width=1 by eq_f2/
+| #I #V1 #V2 #T1 #T2 #t #_ #_ #IHV12 #IHT12 #X #HX elim (lifts_inv_flat2 … HX) -HX
+ #V #T #HV1 #HT1 #HX destruct /3 width=1 by eq_f2/
+]
+qed-.
+
+(* Basic_1: includes: lift_gen_lift *)
+(* Basic_2A1: includes: lift_div_le lift_div_be *)
+theorem lifts_div: ∀T,T2,t2. ⬆*[t2] T2 ≡ T → ∀T1,t. ⬆*[t] T1 ≡ T →
+ ∀t1. t2 ⊚ t1 ≡ t → ⬆*[t1] T1 ≡ T2.
+#T #T2 #t2 #H elim H -T -T2 -t2
+[ #k #t2 #T1 #t #H >(lifts_inv_sort2 … H) -T1 //
+| #i2 #i #t2 #Hi2 #T1 #t #H #t1 #Ht21 elim (lifts_inv_lref2 … H) -H
+ #i1 #Hi1 #H destruct /3 width=6 by lifts_lref, after_fwd_at1/
+| #p #t2 #T1 #t #H >(lifts_inv_gref2 … H) -T1 //
+| #a #I #W2 #W #U2 #U #t2 #_ #_ #IHW #IHU #T1 #t #H
+ elim (lifts_inv_bind2 … H) -H #W1 #U1 #HW1 #HU1 #H destruct
+ /4 width=3 by lifts_bind, after_true/
+| #I #W2 #W #U2 #U #t2 #_ #_ #IHW #IHU #T1 #t #H
+ elim (lifts_inv_flat2 … H) -H #W1 #U1 #HW1 #HU1 #H destruct
+ /3 width=3 by lifts_flat/
+]
+qed-.
+
+(* Basic_2A1: includes: lift_mono *)
+theorem lifts_mono: ∀t,T,U1. ⬆*[t] T ≡ U1 → ∀U2. ⬆*[t] T ≡ U2 → U1 = U2.
+#t #T #U1 #H elim H -t -T -U1
+[ /2 width=2 by lifts_inv_sort1/
+| #i1 #j #t #Hi1j #X #HX elim (lifts_inv_lref1 … HX) -HX
+ /4 width=4 by at_mono, eq_f/
+| /2 width=2 by lifts_inv_gref1/
+| #a #I #V1 #V2 #T1 #T2 #t #_ #_ #IHV12 #IHT12 #X #HX elim (lifts_inv_bind1 … HX) -HX
+ #V #T #HV1 #HT1 #HX destruct /3 width=1 by eq_f2/
+| #I #V1 #V2 #T1 #T2 #t #_ #_ #IHV12 #IHT12 #X #HX elim (lifts_inv_flat1 … HX) -HX
+ #V #T #HV1 #HT1 #HX destruct /3 width=1 by eq_f2/
+]
+qed-.
+
+(* Basic_1: was: lift1_lift1 (left to right) *)
+(* Basic_1: includes: lift_free (left to right) lift_d lift1_xhg (right to left) lift1_free (right to left) *)
+(* Basic_2A1: includes: lift_trans_be lift_trans_le lift_trans_ge lifts_lift_trans_le lifts_lift_trans *)
+theorem lifts_trans: ∀T1,T,t1. ⬆*[t1] T1 ≡ T → ∀T2,t2. ⬆*[t2] T ≡ T2 →
+ ∀t. t2 ⊚ t1 ≡ t → ⬆*[t] T1 ≡ T2.
+#T1 #T #t1 #H elim H -T1 -T -t1
+[ #k #t1 #T2 #t2 #H >(lifts_inv_sort1 … H) -T2 //
+| #i1 #i #t1 #Hi1 #T2 #t2 #H #t #Ht21 elim (lifts_inv_lref1 … H) -H
+ #i2 #Hi2 #H destruct /3 width=6 by lifts_lref, after_fwd_at/
+| #p #t1 #T2 #t2 #H >(lifts_inv_gref1 … H) -T2 //
+| #a #I #W1 #W #U1 #U #t1 #_ #_ #IHW #IHU #T2 #t2 #H
+ elim (lifts_inv_bind1 … H) -H #W2 #U2 #HW2 #HU2 #H destruct
+ /4 width=3 by lifts_bind, after_true/
+| #I #W1 #W #U1 #U #t1 #_ #_ #IHW #IHU #T2 #t2 #H
+ elim (lifts_inv_flat1 … H) -H #W2 #U2 #HW2 #HU2 #H destruct
+ /3 width=3 by lifts_flat/
+]
+qed-.
+
+(* Basic_2A1: includes: lift_conf_O1 lift_conf_be *)
+theorem lifts_conf: ∀T,T1,t1. ⬆*[t1] T ≡ T1 → ∀T2,t. ⬆*[t] T ≡ T2 →
+ ∀t2. t2 ⊚ t1 ≡ t → ⬆*[t2] T1 ≡ T2.
+#T #T1 #t1 #H elim H -T -T1 -t1
+[ #k #t1 #T2 #t #H >(lifts_inv_sort1 … H) -T2 //
+| #i #i1 #t1 #Hi1 #T2 #t #H #t2 #Ht21 elim (lifts_inv_lref1 … H) -H
+ #i2 #Hi2 #H destruct /3 width=6 by lifts_lref, after_fwd_at2/
+| #p #t1 #T2 #t #H >(lifts_inv_gref1 … H) -T2 //
+| #a #I #W #W1 #U #U1 #t1 #_ #_ #IHW #IHU #T2 #t #H
+ elim (lifts_inv_bind1 … H) -H #W2 #U2 #HW2 #HU2 #H destruct
+ /4 width=3 by lifts_bind, after_true/
+| #I #W #W1 #U #U1 #t1 #_ #_ #IHW #IHU #T2 #t #H
+ elim (lifts_inv_flat1 … H) -H #W2 #U2 #HW2 #HU2 #H destruct
+ /3 width=3 by lifts_flat/
+]
+qed-.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/relocation/lifts_lifts.ma".
+include "basic_2/relocation/lifts_vector.ma".
+
+(* GENERIC TERM VECTOR RELOCATION *******************************************)
+
+(* Main properties **********************************************************)
+
+(* Basic_1: includes: lifts_inj *)
+theorem liftsv_inj: ∀T1s,Us,t. ⬆*[t] T1s ≡ Us →
+ ∀T2s. ⬆*[t] T2s ≡ Us → T1s = T2s.
+#T1s #Us #t #H elim H -T1s -Us
+[ #T2s #H >(liftsv_inv_nil2 … H) -H //
+| #T1s #Us #T1 #U #HT1U #_ #IHT1Us #X #H destruct
+ elim (liftsv_inv_cons2 … H) -H #T2 #T2s #HT2U #HT2Us #H destruct
+ >(lifts_inj … HT1U … HT2U) -U /3 width=1 by eq_f/
+]
+qed-.
+
+(* Basic_2A1: includes: liftv_mono *)
+theorem liftsv_mono: ∀Ts,U1s,t. ⬆*[t] Ts ≡ U1s →
+ ∀U2s. ⬆*[t] Ts ≡ U2s → U1s = U2s.
+#Ts #U1s #t #H elim H -Ts -U1s
+[ #U2s #H >(liftsv_inv_nil1 … H) -H //
+| #Ts #U1s #T #U1 #HTU1 #_ #IHTU1s #X #H destruct
+ elim (liftsv_inv_cons1 … H) -H #U2 #U2s #HTU2 #HTU2s #H destruct
+ >(lifts_mono … HTU1 … HTU2) -T /3 width=1 by eq_f/
+]
+qed-.
+
+(* Basic_1: includes: lifts1_xhg (right to left) *)
+(* Basic_2A1: includes: liftsv_liftv_trans_le *)
+theorem liftsv_trans: ∀T1s,Ts,t1. ⬆*[t1] T1s ≡ Ts → ∀T2s,t2. ⬆*[t2] Ts ≡ T2s →
+ ∀t. t2 ⊚ t1 ≡ t → ⬆*[t] T1s ≡ T2s.
+#T1s #Ts #t1 #H elim H -T1s -Ts
+[ #T2s #t2 #H >(liftsv_inv_nil1 … H) -T2s /2 width=3 by liftsv_nil/
+| #T1s #Ts #T1 #T #HT1 #_ #IHT1s #X #t2 #H elim (liftsv_inv_cons1 … H) -H
+ #T2 #T2s #HT2 #HT2s #H destruct /3 width=6 by lifts_trans, liftsv_cons/
+]
+qed-.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/grammar/term_simple.ma".
+include "basic_2/relocation/lifts.ma".
+
+(* GENERIC TERM RELOCATION **************************************************)
+
+(* Forward lemmas on simple terms *******************************************)
+
+(* Basic_2A1: includes: lift_simple_dx *)
+lemma lifts_simple_dx: ∀T1,T2,t. ⬆*[t] T1 ≡ T2 → 𝐒⦃T1⦄ → 𝐒⦃T2⦄.
+#T1 #T2 #t #H elim H -T1 -T2 -t //
+#a #I #V1 #V2 #T1 #T2 #t #_ #_ #_ #_ #H elim (simple_inv_bind … H)
+qed-.
+
+(* Basic_2A1: includes: lift_simple_sn *)
+lemma lifts_simple_sn: ∀T1,T2,t. ⬆*[t] T1 ≡ T2 → 𝐒⦃T2⦄ → 𝐒⦃T1⦄.
+#T1 #T2 #t #H elim H -T1 -T2 -t //
+#a #I #V1 #V2 #T1 #T2 #t #_ #_ #_ #_ #H elim (simple_inv_bind … H)
+qed-.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/grammar/term_vector.ma".
+include "basic_2/relocation/lifts.ma".
+
+(* GENERIC TERM VECTOR RELOCATION *******************************************)
+
+(* Basic_2A1: includes: liftv_nil liftv_cons *)
+inductive liftsv (t:trace) : relation (list term) ≝
+| liftsv_nil : liftsv t (◊) (◊)
+| liftsv_cons: ∀T1s,T2s,T1,T2.
+ ⬆*[t] T1 ≡ T2 → liftsv t T1s T2s →
+ liftsv t (T1 @ T1s) (T2 @ T2s)
+.
+
+interpretation "generic relocation (vector)"
+ 'RLiftStar t T1s T2s = (liftsv t T1s T2s).
+
+(* Basic inversion lemmas ***************************************************)
+
+fact liftsv_inv_nil1_aux: ∀X,Y,t. ⬆*[t] X ≡ Y → X = ◊ → Y = ◊.
+#X #Y #t * -X -Y //
+#T1s #T2s #T1 #T2 #_ #_ #H destruct
+qed-.
+
+(* Basic_2A1: includes: liftv_inv_nil1 *)
+lemma liftsv_inv_nil1: ∀Y,t. ⬆*[t] ◊ ≡ Y → Y = ◊.
+/2 width=5 by liftsv_inv_nil1_aux/ qed-.
+
+fact liftsv_inv_cons1_aux: ∀X,Y,t. ⬆*[t] X ≡ Y →
+ ∀T1,T1s. X = T1 @ T1s →
+ ∃∃T2,T2s. ⬆*[t] T1 ≡ T2 & ⬆*[t] T1s ≡ T2s &
+ Y = T2 @ T2s.
+#X #Y #t * -X -Y
+[ #U1 #U1s #H destruct
+| #T1s #T2s #T1 #T2 #HT12 #HT12s #U1 #U1s #H destruct /2 width=5 by ex3_2_intro/
+]
+qed-.
+
+(* Basic_2A1: includes: liftv_inv_cons1 *)
+lemma liftsv_inv_cons1: ∀T1,T1s,Y,t. ⬆*[t] T1 @ T1s ≡ Y →
+ ∃∃T2,T2s. ⬆*[t] T1 ≡ T2 & ⬆*[t] T1s ≡ T2s &
+ Y = T2 @ T2s.
+/2 width=3 by liftsv_inv_cons1_aux/ qed-.
+
+fact liftsv_inv_nil2_aux: ∀X,Y,t. ⬆*[t] X ≡ Y → Y = ◊ → X = ◊.
+#X #Y #t * -X -Y //
+#T1s #T2s #T1 #T2 #_ #_ #H destruct
+qed-.
+
+lemma liftsv_inv_nil2: ∀X,t. ⬆*[t] X ≡ ◊ → X = ◊.
+/2 width=5 by liftsv_inv_nil2_aux/ qed-.
+
+fact liftsv_inv_cons2_aux: ∀X,Y,t. ⬆*[t] X ≡ Y →
+ ∀T2,T2s. Y = T2 @ T2s →
+ ∃∃T1,T1s. ⬆*[t] T1 ≡ T2 & ⬆*[t] T1s ≡ T2s &
+ X = T1 @ T1s.
+#X #Y #t * -X -Y
+[ #U2 #U2s #H destruct
+| #T1s #T2s #T1 #T2 #HT12 #HT12s #U2 #U2s #H destruct /2 width=5 by ex3_2_intro/
+]
+qed-.
+
+lemma liftsv_inv_cons2: ∀X,T2,T2s,t. ⬆*[t] X ≡ T2 @ T2s →
+ ∃∃T1,T1s. ⬆*[t] T1 ≡ T2 & ⬆*[t] T1s ≡ T2s &
+ X = T1 @ T1s.
+/2 width=3 by liftsv_inv_cons2_aux/ qed-.
+
+(* Basic_1: was: lifts1_flat (left to right) *)
+lemma lifts_inv_applv1: ∀V1s,U1,T2,t. ⬆*[t] Ⓐ V1s.U1 ≡ T2 →
+ ∃∃V2s,U2. ⬆*[t] V1s ≡ V2s & ⬆*[t] U1 ≡ U2 &
+ T2 = Ⓐ V2s.U2.
+#V1s elim V1s -V1s
+[ /3 width=5 by ex3_2_intro, liftsv_nil/
+| #V1 #V1s #IHV1s #T1 #X #t #H elim (lifts_inv_flat1 … H) -H
+ #V2 #Y #HV12 #HY #H destruct elim (IHV1s … HY) -IHV1s -HY
+ #V2s #T2 #HV12s #HT12 #H destruct /3 width=5 by ex3_2_intro, liftsv_cons/
+]
+qed-.
+
+lemma lifts_inv_applv2: ∀V2s,U2,T1,t. ⬆*[t] T1 ≡ Ⓐ V2s.U2 →
+ ∃∃V1s,U1. ⬆*[t] V1s ≡ V2s & ⬆*[t] U1 ≡ U2 &
+ T1 = Ⓐ V1s.U1.
+#V2s elim V2s -V2s
+[ /3 width=5 by ex3_2_intro, liftsv_nil/
+| #V2 #V2s #IHV2s #T2 #X #t #H elim (lifts_inv_flat2 … H) -H
+ #V1 #Y #HV12 #HY #H destruct elim (IHV2s … HY) -IHV2s -HY
+ #V1s #T1 #HV12s #HT12 #H destruct /3 width=5 by ex3_2_intro, liftsv_cons/
+]
+qed-.
+
+(* Basic properties *********************************************************)
+
+(* Basic_1: was: lifts1_flat (right to left) *)
+lemma lifts_applv: ∀V1s,V2s,t. ⬆*[t] V1s ≡ V2s →
+ ∀T1,T2. ⬆*[t] T1 ≡ T2 →
+ ⬆*[t] Ⓐ V1s. T1 ≡ Ⓐ V2s. T2.
+#V1s #V2s #t #H elim H -V1s -V2s /3 width=1 by lifts_flat/
+qed.
+
+(* Basic_2A1: removed theorems 1: liftv_total *)
+(* Basic_1: removed theorems 2: lifts1_nil lifts1_cons *)
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/grammar/term_weight.ma".
+include "basic_2/relocation/lifts.ma".
+
+(* GENERIC TERM RELOCATION **************************************************)
+
+(* Forward lemmas on weight for terms ***************************************)
+
+(* Basic_2A1: includes: lift_fwd_tw *)
+lemma lifts_fwd_tw: ∀T1,T2,t. ⬆*[t] T1 ≡ T2 → ♯{T1} = ♯{T2}.
+#T1 #T2 #t #H elim H -T1 -T2 -t normalize //
+qed-.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/notation/relations/lazyeq_4.ma".
+include "basic_2/multiple/llpx_sn.ma".
+
+(* LAZY EQUIVALENCE FOR LOCAL ENVIRONMENTS **********************************)
+
+definition ceq: relation3 lenv term term ≝ λL,T1,T2. T1 = T2.
+
+definition lleq: relation4 ynat term lenv lenv ≝ llpx_sn ceq.
+
+interpretation
+ "lazy equivalence (local environment)"
+ 'LazyEq T l L1 L2 = (lleq l T L1 L2).
+
+definition lleq_transitive: predicate (relation3 lenv term term) ≝
+ λR. ∀L2,T1,T2. R L2 T1 T2 → ∀L1. L1 ≡[T1, 0] L2 → R L1 T1 T2.
+
+(* Basic inversion lemmas ***************************************************)
+
+lemma lleq_ind: ∀R:relation4 ynat term lenv lenv. (
+ ∀L1,L2,l,k. |L1| = |L2| → R l (⋆k) L1 L2
+ ) → (
+ ∀L1,L2,l,i. |L1| = |L2| → yinj i < l → R l (#i) L1 L2
+ ) → (
+ ∀I,L1,L2,K1,K2,V,l,i. l ≤ yinj i →
+ ⬇[i] L1 ≡ K1.ⓑ{I}V → ⬇[i] L2 ≡ K2.ⓑ{I}V →
+ K1 ≡[V, yinj O] K2 → R (yinj O) V K1 K2 → R l (#i) L1 L2
+ ) → (
+ ∀L1,L2,l,i. |L1| = |L2| → |L1| ≤ i → |L2| ≤ i → R l (#i) L1 L2
+ ) → (
+ ∀L1,L2,l,p. |L1| = |L2| → R l (§p) L1 L2
+ ) → (
+ ∀a,I,L1,L2,V,T,l.
+ L1 ≡[V, l]L2 → L1.ⓑ{I}V ≡[T, ⫯l] L2.ⓑ{I}V →
+ R l V L1 L2 → R (⫯l) T (L1.ⓑ{I}V) (L2.ⓑ{I}V) → R l (ⓑ{a,I}V.T) L1 L2
+ ) → (
+ ∀I,L1,L2,V,T,l.
+ L1 ≡[V, l]L2 → L1 ≡[T, l] L2 →
+ R l V L1 L2 → R l T L1 L2 → R l (ⓕ{I}V.T) L1 L2
+ ) →
+ ∀l,T,L1,L2. L1 ≡[T, l] L2 → R l T L1 L2.
+#R #H1 #H2 #H3 #H4 #H5 #H6 #H7 #l #T #L1 #L2 #H elim H -L1 -L2 -T -l /2 width=8 by/
+qed-.
+
+lemma lleq_inv_bind: ∀a,I,L1,L2,V,T,l. L1 ≡[ⓑ{a,I}V.T, l] L2 →
+ L1 ≡[V, l] L2 ∧ L1.ⓑ{I}V ≡[T, ⫯l] L2.ⓑ{I}V.
+/2 width=2 by llpx_sn_inv_bind/ qed-.
+
+lemma lleq_inv_flat: ∀I,L1,L2,V,T,l. L1 ≡[ⓕ{I}V.T, l] L2 →
+ L1 ≡[V, l] L2 ∧ L1 ≡[T, l] L2.
+/2 width=2 by llpx_sn_inv_flat/ qed-.
+
+(* Basic forward lemmas *****************************************************)
+
+lemma lleq_fwd_length: ∀L1,L2,T,l. L1 ≡[T, l] L2 → |L1| = |L2|.
+/2 width=4 by llpx_sn_fwd_length/ qed-.
+
+lemma lleq_fwd_lref: ∀L1,L2,l,i. L1 ≡[#i, l] L2 →
+ ∨∨ |L1| ≤ i ∧ |L2| ≤ i
+ | yinj i < l
+ | ∃∃I,K1,K2,V. ⬇[i] L1 ≡ K1.ⓑ{I}V &
+ ⬇[i] L2 ≡ K2.ⓑ{I}V &
+ K1 ≡[V, yinj 0] K2 & l ≤ yinj i.
+#L1 #L2 #l #i #H elim (llpx_sn_fwd_lref … H) /2 width=1 by or3_intro0, or3_intro1/
+* /3 width=7 by or3_intro2, ex4_4_intro/
+qed-.
+
+lemma lleq_fwd_drop_sn: ∀L1,L2,T,l. L1 ≡[l, T] L2 → ∀K1,i. ⬇[i] L1 ≡ K1 →
+ ∃K2. ⬇[i] L2 ≡ K2.
+/2 width=7 by llpx_sn_fwd_drop_sn/ qed-.
+
+lemma lleq_fwd_drop_dx: ∀L1,L2,T,l. L1 ≡[l, T] L2 → ∀K2,i. ⬇[i] L2 ≡ K2 →
+ ∃K1. ⬇[i] L1 ≡ K1.
+/2 width=7 by llpx_sn_fwd_drop_dx/ qed-.
+
+lemma lleq_fwd_bind_sn: ∀a,I,L1,L2,V,T,l.
+ L1 ≡[ⓑ{a,I}V.T, l] L2 → L1 ≡[V, l] L2.
+/2 width=4 by llpx_sn_fwd_bind_sn/ qed-.
+
+lemma lleq_fwd_bind_dx: ∀a,I,L1,L2,V,T,l.
+ L1 ≡[ⓑ{a,I}V.T, l] L2 → L1.ⓑ{I}V ≡[T, ⫯l] L2.ⓑ{I}V.
+/2 width=2 by llpx_sn_fwd_bind_dx/ qed-.
+
+lemma lleq_fwd_flat_sn: ∀I,L1,L2,V,T,l.
+ L1 ≡[ⓕ{I}V.T, l] L2 → L1 ≡[V, l] L2.
+/2 width=3 by llpx_sn_fwd_flat_sn/ qed-.
+
+lemma lleq_fwd_flat_dx: ∀I,L1,L2,V,T,l.
+ L1 ≡[ⓕ{I}V.T, l] L2 → L1 ≡[T, l] L2.
+/2 width=3 by llpx_sn_fwd_flat_dx/ qed-.
+
+(* Basic properties *********************************************************)
+
+lemma lleq_sort: ∀L1,L2,l,k. |L1| = |L2| → L1 ≡[⋆k, l] L2.
+/2 width=1 by llpx_sn_sort/ qed.
+
+lemma lleq_skip: ∀L1,L2,l,i. yinj i < l → |L1| = |L2| → L1 ≡[#i, l] L2.
+/2 width=1 by llpx_sn_skip/ qed.
+
+lemma lleq_lref: ∀I,L1,L2,K1,K2,V,l,i. l ≤ yinj i →
+ ⬇[i] L1 ≡ K1.ⓑ{I}V → ⬇[i] L2 ≡ K2.ⓑ{I}V →
+ K1 ≡[V, 0] K2 → L1 ≡[#i, l] L2.
+/2 width=9 by llpx_sn_lref/ qed.
+
+lemma lleq_free: ∀L1,L2,l,i. |L1| ≤ i → |L2| ≤ i → |L1| = |L2| → L1 ≡[#i, l] L2.
+/2 width=1 by llpx_sn_free/ qed.
+
+lemma lleq_gref: ∀L1,L2,l,p. |L1| = |L2| → L1 ≡[§p, l] L2.
+/2 width=1 by llpx_sn_gref/ qed.
+
+lemma lleq_bind: ∀a,I,L1,L2,V,T,l.
+ L1 ≡[V, l] L2 → L1.ⓑ{I}V ≡[T, ⫯l] L2.ⓑ{I}V →
+ L1 ≡[ⓑ{a,I}V.T, l] L2.
+/2 width=1 by llpx_sn_bind/ qed.
+
+lemma lleq_flat: ∀I,L1,L2,V,T,l.
+ L1 ≡[V, l] L2 → L1 ≡[T, l] L2 → L1 ≡[ⓕ{I}V.T, l] L2.
+/2 width=1 by llpx_sn_flat/ qed.
+
+lemma lleq_refl: ∀l,T. reflexive … (lleq l T).
+/2 width=1 by llpx_sn_refl/ qed.
+
+lemma lleq_Y: ∀L1,L2,T. |L1| = |L2| → L1 ≡[T, ∞] L2.
+/2 width=1 by llpx_sn_Y/ qed.
+
+lemma lleq_sym: ∀l,T. symmetric … (lleq l T).
+#l #T #L1 #L2 #H @(lleq_ind … H) -l -T -L1 -L2
+/2 width=7 by lleq_sort, lleq_skip, lleq_lref, lleq_free, lleq_gref, lleq_bind, lleq_flat/
+qed-.
+
+lemma lleq_ge_up: ∀L1,L2,U,lt. L1 ≡[U, lt] L2 →
+ ∀T,l,m. ⬆[l, m] T ≡ U →
+ lt ≤ l + m → L1 ≡[U, l] L2.
+/2 width=6 by llpx_sn_ge_up/ qed-.
+
+lemma lleq_ge: ∀L1,L2,T,l1. L1 ≡[T, l1] L2 → ∀l2. l1 ≤ l2 → L1 ≡[T, l2] L2.
+/2 width=3 by llpx_sn_ge/ qed-.
+
+lemma lleq_bind_O: ∀a,I,L1,L2,V,T. L1 ≡[V, 0] L2 → L1.ⓑ{I}V ≡[T, 0] L2.ⓑ{I}V →
+ L1 ≡[ⓑ{a,I}V.T, 0] L2.
+/2 width=1 by llpx_sn_bind_O/ qed-.
+
+(* Advanceded properties on lazy pointwise extensions ************************)
+
+lemma llpx_sn_lrefl: ∀R. (∀L. reflexive … (R L)) →
+ ∀L1,L2,T,l. L1 ≡[T, l] L2 → llpx_sn R l T L1 L2.
+/2 width=3 by llpx_sn_co/ qed-.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/multiple/llpx_sn_alt.ma".
+include "basic_2/multiple/lleq.ma".
+
+(* LAZY EQUIVALENCE FOR LOCAL ENVIRONMENTS **********************************)
+
+(* Alternative definition (not recursive) ***********************************)
+
+theorem lleq_intro_alt: ∀L1,L2,T,l. |L1| = |L2| →
+ (∀I1,I2,K1,K2,V1,V2,i. l ≤ yinj i → L1 ⊢ i ϵ 𝐅*[l]⦃T⦄ →
+ ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
+ I1 = I2 ∧ V1 = V2
+ ) → L1 ≡[T, l] L2.
+#L1 #L2 #T #l #HL12 #IH @llpx_sn_alt_inv_llpx_sn @conj // -HL12
+#I1 #I2 #K1 #K2 #V1 #V2 #i #Hil #HnT #HLK1 #HLK2
+@(IH … HnT HLK1 HLK2) -IH -HnT -HLK1 -HLK2 //
+qed.
+
+theorem lleq_inv_alt: ∀L1,L2,T,l. L1 ≡[T, l] L2 →
+ |L1| = |L2| ∧
+ ∀I1,I2,K1,K2,V1,V2,i. l ≤ yinj i → L1 ⊢ i ϵ 𝐅*[l]⦃T⦄ →
+ ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
+ I1 = I2 ∧ V1 = V2.
+#L1 #L2 #T #l #H elim (llpx_sn_llpx_sn_alt … H) -H
+#HL12 #IH @conj //
+#I1 #I2 #K1 #K2 #V1 #V2 #i #Hil #HnT #HLK1 #HLK2
+@(IH … HnT HLK1 HLK2) -IH -HnT -HLK1 -HLK2 //
+qed-.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/multiple/llpx_sn_alt_rec.ma".
+include "basic_2/multiple/lleq.ma".
+
+(* LAZY EQUIVALENCE FOR LOCAL ENVIRONMENTS **********************************)
+
+(* Alternative definition (recursive) ***************************************)
+
+theorem lleq_intro_alt_r: ∀L1,L2,T,l. |L1| = |L2| →
+ (∀I1,I2,K1,K2,V1,V2,i. l ≤ yinj i → (∀U. ⬆[i, 1] U ≡ T → ⊥) →
+ ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
+ ∧∧ I1 = I2 & V1 = V2 & K1 ≡[V1, 0] K2
+ ) → L1 ≡[T, l] L2.
+#L1 #L2 #T #l #HL12 #IH @llpx_sn_intro_alt_r // -HL12
+#I1 #I2 #K1 #K2 #V1 #V2 #i #Hil #HnT #HLK1 #HLK2
+elim (IH … HnT HLK1 HLK2) -IH -HnT -HLK1 -HLK2 /2 width=1 by and3_intro/
+qed.
+
+theorem lleq_ind_alt_r: ∀S:relation4 ynat term lenv lenv.
+ (∀L1,L2,T,l. |L1| = |L2| → (
+ ∀I1,I2,K1,K2,V1,V2,i. l ≤ yinj i → (∀U. ⬆[i, 1] U ≡ T → ⊥) →
+ ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
+ ∧∧ I1 = I2 & V1 = V2 & K1 ≡[V1, 0] K2 & S 0 V1 K1 K2
+ ) → S l T L1 L2) →
+ ∀L1,L2,T,l. L1 ≡[T, l] L2 → S l T L1 L2.
+#S #IH1 #L1 #L2 #T #l #H @(llpx_sn_ind_alt_r … H) -L1 -L2 -T -l
+#L1 #L2 #T #l #HL12 #IH2 @IH1 -IH1 // -HL12
+#I1 #I2 #K1 #K2 #V1 #V2 #i #Hil #HnT #HLK1 #HLK2
+elim (IH2 … HnT HLK1 HLK2) -IH2 -HnT -HLK1 -HLK2 /2 width=1 by and4_intro/
+qed-.
+
+theorem lleq_inv_alt_r: ∀L1,L2,T,l. L1 ≡[T, l] L2 →
+ |L1| = |L2| ∧
+ ∀I1,I2,K1,K2,V1,V2,i. l ≤ yinj i → (∀U. ⬆[i, 1] U ≡ T → ⊥) →
+ ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
+ ∧∧ I1 = I2 & V1 = V2 & K1 ≡[V1, 0] K2.
+#L1 #L2 #T #l #H elim (llpx_sn_inv_alt_r … H) -H
+#HL12 #IH @conj //
+#I1 #I2 #K1 #K2 #V1 #V2 #i #Hil #HnT #HLK1 #HLK2
+elim (IH … HnT HLK1 HLK2) -IH -HnT -HLK1 -HLK2 /2 width=1 by and3_intro/
+qed-.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/multiple/llpx_sn_drop.ma".
+include "basic_2/multiple/lleq.ma".
+
+(* LAZY EQUIVALENCE FOR LOCAL ENVIRONMENTS **********************************)
+
+(* Advanced properties ******************************************************)
+
+lemma lleq_bind_repl_O: ∀I,L1,L2,V,T. L1.ⓑ{I}V ≡[T, 0] L2.ⓑ{I}V →
+ ∀J,W. L1 ≡[W, 0] L2 → L1.ⓑ{J}W ≡[T, 0] L2.ⓑ{J}W.
+/2 width=7 by llpx_sn_bind_repl_O/ qed-.
+
+lemma lleq_dec: ∀T,L1,L2,l. Decidable (L1 ≡[T, l] L2).
+/3 width=1 by llpx_sn_dec, eq_term_dec/ qed-.
+
+lemma lleq_llpx_sn_trans: ∀R. lleq_transitive R →
+ ∀L1,L2,T,l. L1 ≡[T, l] L2 →
+ ∀L. llpx_sn R l T L2 L → llpx_sn R l T L1 L.
+#R #HR #L1 #L2 #T #l #H @(lleq_ind … H) -L1 -L2 -T -l
+[1,2,5: /4 width=6 by llpx_sn_fwd_length, llpx_sn_gref, llpx_sn_skip, llpx_sn_sort, trans_eq/
+|4: /4 width=6 by llpx_sn_fwd_length, llpx_sn_free, le_repl_sn_conf_aux, trans_eq/
+| #I #L1 #L2 #K1 #K2 #V #l #i #Hli #HLK1 #HLK2 #HK12 #IHK12 #L #H elim (llpx_sn_inv_lref_ge_sn … H … HLK2) -H -HLK2
+ /3 width=11 by llpx_sn_lref/
+| #a #I #L1 #L2 #V #T #l #_ #_ #IHV #IHT #L #H elim (llpx_sn_inv_bind … H) -H
+ /3 width=1 by llpx_sn_bind/
+| #I #L1 #L2 #V #T #l #_ #_ #IHV #IHT #L #H elim (llpx_sn_inv_flat … H) -H
+ /3 width=1 by llpx_sn_flat/
+]
+qed-.
+
+lemma lleq_llpx_sn_conf: ∀R. lleq_transitive R →
+ ∀L1,L2,T,l. L1 ≡[T, l] L2 →
+ ∀L. llpx_sn R l T L1 L → llpx_sn R l T L2 L.
+/3 width=3 by lleq_llpx_sn_trans, lleq_sym/ qed-.
+
+(* Advanced inversion lemmas ************************************************)
+
+lemma lleq_inv_lref_ge_dx: ∀L1,L2,l,i. L1 ≡[#i, l] L2 → l ≤ i →
+ ∀I,K2,V. ⬇[i] L2 ≡ K2.ⓑ{I}V →
+ ∃∃K1. ⬇[i] L1 ≡ K1.ⓑ{I}V & K1 ≡[V, 0] K2.
+#L1 #L2 #l #i #H #Hli #I #K2 #V #HLK2 elim (llpx_sn_inv_lref_ge_dx … H … HLK2) -L2
+/2 width=3 by ex2_intro/
+qed-.
+
+lemma lleq_inv_lref_ge_sn: ∀L1,L2,l,i. L1 ≡[#i, l] L2 → l ≤ i →
+ ∀I,K1,V. ⬇[i] L1 ≡ K1.ⓑ{I}V →
+ ∃∃K2. ⬇[i] L2 ≡ K2.ⓑ{I}V & K1 ≡[V, 0] K2.
+#L1 #L2 #l #i #H #Hli #I1 #K1 #V #HLK1 elim (llpx_sn_inv_lref_ge_sn … H … HLK1) -L1
+/2 width=3 by ex2_intro/
+qed-.
+
+lemma lleq_inv_lref_ge_bi: ∀L1,L2,l,i. L1 ≡[#i, l] L2 → l ≤ i →
+ ∀I1,I2,K1,K2,V1,V2.
+ ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
+ ∧∧ I1 = I2 & K1 ≡[V1, 0] K2 & V1 = V2.
+/2 width=8 by llpx_sn_inv_lref_ge_bi/ qed-.
+
+lemma lleq_inv_lref_ge: ∀L1,L2,l,i. L1 ≡[#i, l] L2 → l ≤ i →
+ ∀I,K1,K2,V. ⬇[i] L1 ≡ K1.ⓑ{I}V → ⬇[i] L2 ≡ K2.ⓑ{I}V →
+ K1 ≡[V, 0] K2.
+#L1 #L2 #l #i #HL12 #Hli #I #K1 #K2 #V #HLK1 #HLK2
+elim (lleq_inv_lref_ge_bi … HL12 … HLK1 HLK2) //
+qed-.
+
+lemma lleq_inv_S: ∀L1,L2,T,l. L1 ≡[T, l+1] L2 →
+ ∀I,K1,K2,V. ⬇[l] L1 ≡ K1.ⓑ{I}V → ⬇[l] L2 ≡ K2.ⓑ{I}V →
+ K1 ≡[V, 0] K2 → L1 ≡[T, l] L2.
+/2 width=9 by llpx_sn_inv_S/ qed-.
+
+lemma lleq_inv_bind_O: ∀a,I,L1,L2,V,T. L1 ≡[ⓑ{a,I}V.T, 0] L2 →
+ L1 ≡[V, 0] L2 ∧ L1.ⓑ{I}V ≡[T, 0] L2.ⓑ{I}V.
+/2 width=2 by llpx_sn_inv_bind_O/ qed-.
+
+(* Advanced forward lemmas **************************************************)
+
+lemma lleq_fwd_lref_dx: ∀L1,L2,l,i. L1 ≡[#i, l] L2 →
+ ∀I,K2,V. ⬇[i] L2 ≡ K2.ⓑ{I}V →
+ i < l ∨
+ ∃∃K1. ⬇[i] L1 ≡ K1.ⓑ{I}V & K1 ≡[V, 0] K2 & l ≤ i.
+#L1 #L2 #l #i #H #I #K2 #V #HLK2 elim (llpx_sn_fwd_lref_dx … H … HLK2) -L2
+[ | * ] /3 width=3 by ex3_intro, or_intror, or_introl/
+qed-.
+
+lemma lleq_fwd_lref_sn: ∀L1,L2,l,i. L1 ≡[#i, l] L2 →
+ ∀I,K1,V. ⬇[i] L1 ≡ K1.ⓑ{I}V →
+ i < l ∨
+ ∃∃K2. ⬇[i] L2 ≡ K2.ⓑ{I}V & K1 ≡[V, 0] K2 & l ≤ i.
+#L1 #L2 #l #i #H #I #K1 #V #HLK1 elim (llpx_sn_fwd_lref_sn … H … HLK1) -L1
+[ | * ] /3 width=3 by ex3_intro, or_intror, or_introl/
+qed-.
+
+lemma lleq_fwd_bind_O_dx: ∀a,I,L1,L2,V,T. L1 ≡[ⓑ{a,I}V.T, 0] L2 →
+ L1.ⓑ{I}V ≡[T, 0] L2.ⓑ{I}V.
+/2 width=2 by llpx_sn_fwd_bind_O_dx/ qed-.
+
+(* Properties on relocation *************************************************)
+
+lemma lleq_lift_le: ∀K1,K2,T,lt. K1 ≡[T, lt] K2 →
+ ∀L1,L2,l,m. ⬇[Ⓕ, l, m] L1 ≡ K1 → ⬇[Ⓕ, l, m] L2 ≡ K2 →
+ ∀U. ⬆[l, m] T ≡ U → lt ≤ l → L1 ≡[U, lt] L2.
+/3 width=10 by llpx_sn_lift_le, lift_mono/ qed-.
+
+lemma lleq_lift_ge: ∀K1,K2,T,lt. K1 ≡[T, lt] K2 →
+ ∀L1,L2,l,m. ⬇[Ⓕ, l, m] L1 ≡ K1 → ⬇[Ⓕ, l, m] L2 ≡ K2 →
+ ∀U. ⬆[l, m] T ≡ U → l ≤ lt → L1 ≡[U, lt+m] L2.
+/2 width=9 by llpx_sn_lift_ge/ qed-.
+
+(* Inversion lemmas on relocation *******************************************)
+
+lemma lleq_inv_lift_le: ∀L1,L2,U,lt. L1 ≡[U, lt] L2 →
+ ∀K1,K2,l,m. ⬇[Ⓕ, l, m] L1 ≡ K1 → ⬇[Ⓕ, l, m] L2 ≡ K2 →
+ ∀T. ⬆[l, m] T ≡ U → lt ≤ l → K1 ≡[T, lt] K2.
+/3 width=10 by llpx_sn_inv_lift_le, ex2_intro/ qed-.
+
+lemma lleq_inv_lift_be: ∀L1,L2,U,lt. L1 ≡[U, lt] L2 →
+ ∀K1,K2,l,m. ⬇[Ⓕ, l, m] L1 ≡ K1 → ⬇[Ⓕ, l, m] L2 ≡ K2 →
+ ∀T. ⬆[l, m] T ≡ U → l ≤ lt → lt ≤ l + m → K1 ≡[T, l] K2.
+/2 width=11 by llpx_sn_inv_lift_be/ qed-.
+
+lemma lleq_inv_lift_ge: ∀L1,L2,U,lt. L1 ≡[U, lt] L2 →
+ ∀K1,K2,l,m. ⬇[Ⓕ, l, m] L1 ≡ K1 → ⬇[Ⓕ, l, m] L2 ≡ K2 →
+ ∀T. ⬆[l, m] T ≡ U → l + m ≤ lt → K1 ≡[T, lt-m] K2.
+/2 width=9 by llpx_sn_inv_lift_ge/ qed-.
+
+(* Inversion lemmas on negated lazy quivalence for local environments *******)
+
+lemma nlleq_inv_bind: ∀a,I,L1,L2,V,T,l. (L1 ≡[ⓑ{a,I}V.T, l] L2 → ⊥) →
+ (L1 ≡[V, l] L2 → ⊥) ∨ (L1.ⓑ{I}V ≡[T, ⫯l] L2.ⓑ{I}V → ⊥).
+/3 width=2 by nllpx_sn_inv_bind, eq_term_dec/ qed-.
+
+lemma nlleq_inv_flat: ∀I,L1,L2,V,T,l. (L1 ≡[ⓕ{I}V.T, l] L2 → ⊥) →
+ (L1 ≡[V, l] L2 → ⊥) ∨ (L1 ≡[T, l] L2 → ⊥).
+/3 width=2 by nllpx_sn_inv_flat, eq_term_dec/ qed-.
+
+lemma nlleq_inv_bind_O: ∀a,I,L1,L2,V,T. (L1 ≡[ⓑ{a,I}V.T, 0] L2 → ⊥) →
+ (L1 ≡[V, 0] L2 → ⊥) ∨ (L1.ⓑ{I}V ≡[T, 0] L2.ⓑ{I}V → ⊥).
+/3 width=2 by nllpx_sn_inv_bind_O, eq_term_dec/ qed-.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/multiple/fqus_alt.ma".
+include "basic_2/multiple/lleq_drop.ma".
+
+(* LAZY EQUIVALENCE FOR LOCAL ENVIRONMENTS **********************************)
+
+(* Properties on supclosure *************************************************)
+
+lemma lleq_fqu_trans: ∀G1,G2,L2,K2,T,U. ⦃G1, L2, T⦄ ⊐ ⦃G2, K2, U⦄ →
+ ∀L1. L1 ≡[T, 0] L2 →
+ ∃∃K1. ⦃G1, L1, T⦄ ⊐ ⦃G2, K1, U⦄ & K1 ≡[U, 0] K2.
+#G1 #G2 #L2 #K2 #T #U #H elim H -G1 -G2 -L2 -K2 -T -U
+[ #I #G #L2 #V #L1 #H elim (lleq_inv_lref_ge_dx … H … I L2 V) -H //
+ #K1 #H1 #H2 lapply (drop_inv_O2 … H1) -H1
+ #H destruct /2 width=3 by fqu_lref_O, ex2_intro/
+| * [ #a ] #I #G #L2 #V #T #L1 #H
+ [ elim (lleq_inv_bind … H)
+ | elim (lleq_inv_flat … H)
+ ] -H
+ /2 width=3 by fqu_pair_sn, ex2_intro/
+| #a #I #G #L2 #V #T #L1 #H elim (lleq_inv_bind_O … H) -H
+ #H3 #H4 /2 width=3 by fqu_bind_dx, ex2_intro/
+| #I #G #L2 #V #T #L1 #H elim (lleq_inv_flat … H) -H
+ /2 width=3 by fqu_flat_dx, ex2_intro/
+| #G #L2 #K2 #T #U #m #HLK2 #HTU #L1 #HL12
+ elim (drop_O1_le (Ⓕ) (m+1) L1)
+ [ /3 width=12 by fqu_drop, lleq_inv_lift_le, ex2_intro/
+ | lapply (drop_fwd_length_le2 … HLK2) -K2
+ lapply (lleq_fwd_length … HL12) -T -U //
+ ]
+]
+qed-.
+
+lemma lleq_fquq_trans: ∀G1,G2,L2,K2,T,U. ⦃G1, L2, T⦄ ⊐⸮ ⦃G2, K2, U⦄ →
+ ∀L1. L1 ≡[T, 0] L2 →
+ ∃∃K1. ⦃G1, L1, T⦄ ⊐⸮ ⦃G2, K1, U⦄ & K1 ≡[U, 0] K2.
+#G1 #G2 #L2 #K2 #T #U #H #L1 #HL12 elim(fquq_inv_gen … H) -H
+[ #H elim (lleq_fqu_trans … H … HL12) -L2 /3 width=3 by fqu_fquq, ex2_intro/
+| * #HG #HL #HT destruct /2 width=3 by ex2_intro/
+]
+qed-.
+
+lemma lleq_fqup_trans: ∀G1,G2,L2,K2,T,U. ⦃G1, L2, T⦄ ⊐+ ⦃G2, K2, U⦄ →
+ ∀L1. L1 ≡[T, 0] L2 →
+ ∃∃K1. ⦃G1, L1, T⦄ ⊐+ ⦃G2, K1, U⦄ & K1 ≡[U, 0] K2.
+#G1 #G2 #L2 #K2 #T #U #H @(fqup_ind … H) -G2 -K2 -U
+[ #G2 #K2 #U #HTU #L1 #HL12 elim (lleq_fqu_trans … HTU … HL12) -L2
+ /3 width=3 by fqu_fqup, ex2_intro/
+| #G #G2 #K #K2 #U #U2 #_ #HU2 #IHTU #L1 #HL12 elim (IHTU … HL12) -L2
+ #K1 #HTU #HK1 elim (lleq_fqu_trans … HU2 … HK1) -K
+ /3 width=5 by fqup_strap1, ex2_intro/
+]
+qed-.
+
+lemma lleq_fqus_trans: ∀G1,G2,L2,K2,T,U. ⦃G1, L2, T⦄ ⊐* ⦃G2, K2, U⦄ →
+ ∀L1. L1 ≡[T, 0] L2 →
+ ∃∃K1. ⦃G1, L1, T⦄ ⊐* ⦃G2, K1, U⦄ & K1 ≡[U, 0] K2.
+#G1 #G2 #L2 #K2 #T #U #H #L1 #HL12 elim(fqus_inv_gen … H) -H
+[ #H elim (lleq_fqup_trans … H … HL12) -L2 /3 width=3 by fqup_fqus, ex2_intro/
+| * #HG #HL #HT destruct /2 width=3 by ex2_intro/
+]
+qed-.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/multiple/lleq_drop.ma".
+
+(* LAZY EQUIVALENCE FOR LOCAL ENVIRONMENTS **********************************)
+
+(* Main properties **********************************************************)
+
+theorem lleq_trans: ∀l,T. Transitive … (lleq l T).
+/2 width=3 by lleq_llpx_sn_trans/ qed-.
+
+theorem lleq_canc_sn: ∀L,L1,L2,T,l. L ≡[l, T] L1→ L ≡[l, T] L2 → L1 ≡[l, T] L2.
+/3 width=3 by lleq_trans, lleq_sym/ qed-.
+
+theorem lleq_canc_dx: ∀L1,L2,L,T,l. L1 ≡[l, T] L → L2 ≡[l, T] L → L1 ≡[l, T] L2.
+/3 width=3 by lleq_trans, lleq_sym/ qed-.
+
+(* Advanced properies on negated lazy equivalence *****************************)
+
+(* Note: for use in auto, works with /4 width=8/ so lleq_canc_sn is preferred *)
+lemma lleq_nlleq_trans: ∀l,T,L1,L. L1 ≡[T, l] L →
+ ∀L2. (L ≡[T, l] L2 → ⊥) → (L1 ≡[T, l] L2 → ⊥).
+/3 width=3 by lleq_canc_sn/ qed-.
+
+lemma nlleq_lleq_div: ∀l,T,L2,L. L2 ≡[T, l] L →
+ ∀L1. (L1 ≡[T, l] L → ⊥) → (L1 ≡[T, l] L2 → ⊥).
+/3 width=3 by lleq_trans/ qed-.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/multiple/llor.ma".
+include "basic_2/multiple/llpx_sn_frees.ma".
+include "basic_2/multiple/lleq_alt.ma".
+
+(* LAZY EQUIVALENCE FOR LOCAL ENVIRONMENTS **********************************)
+
+(* Properties on pointwise union for local environments **********************)
+
+lemma llpx_sn_llor_dx: ∀R. (s_r_confluent1 … R (llpx_sn R 0)) → (frees_trans R) →
+ ∀L1,L2,T,l. llpx_sn R l T L1 L2 → ∀L. L1 ⋓[T, l] L2 ≡ L → L2 ≡[T, l] L.
+#R #H1R #H2R #L1 #L2 #T #l #H1 #L #H2
+lapply (llpx_sn_frees_trans … H1R H2R … H1) -H1R -H2R #HR
+elim (llpx_sn_llpx_sn_alt … H1) -H1 #HL12 #IH1
+elim H2 -H2 #_ #HL1 #IH2
+@lleq_intro_alt // #I2 #I #K2 #K #V2 #V #i #Hi #HnT #HLK2 #HLK
+lapply (drop_fwd_length_lt2 … HLK) #HiL
+elim (drop_O1_lt (Ⓕ) L1 i) // -HiL #I1 #K1 #V1 #HLK1
+elim (IH1 … HLK1 HLK2) -IH1 /2 width=1 by/ #H #_ destruct
+elim (IH2 … HLK1 HLK2 HLK) -IH2 -HLK1 -HLK2 -HLK * /2 width=1 by conj/ #H
+[ elim (ylt_yle_false … H) -H //
+| elim H -H /2 width=1 by/
+]
+qed.
+
+lemma llpx_sn_llor_dx_sym: ∀R. (s_r_confluent1 … R (llpx_sn R 0)) → (frees_trans R) →
+ ∀L1,L2,T,l. llpx_sn R l T L1 L2 → ∀L. L1 ⋓[T, l] L2 ≡ L → L ≡[T, l] L2.
+/3 width=6 by llpx_sn_llor_dx, lleq_sym/ qed.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/multiple/llpx_sn_lreq.ma".
+include "basic_2/multiple/lleq.ma".
+
+(* LAZY EQUIVALENCE FOR LOCAL ENVIRONMENTS **********************************)
+
+(* Properties on equivalence for local environments *************************)
+
+lemma lreq_lleq_trans: ∀L2,L,T,l. L2 ≡[T, l] L →
+ ∀L1. L1 ⩬[l, ∞] L2 → L1 ≡[T, l] L.
+/2 width=3 by lreq_llpx_sn_trans/ qed-.
+
+lemma lleq_lreq_trans: ∀L,L1,T,l. L ≡[T, l] L1 →
+ ∀L2. L1 ⩬[l, ∞] L2 → L ≡[T, l] L2.
+/2 width=3 by llpx_sn_lreq_trans/ qed-.
+
+lemma lleq_lreq_repl: ∀L1,L2,T,l. L1 ≡[T, l] L2 → ∀K1. K1 ⩬[l, ∞] L1 →
+ ∀K2. L2 ⩬[l, ∞] K2 → K1 ≡[T, l] K2.
+/2 width=5 by llpx_sn_lreq_repl/ qed-.
+
+lemma lleq_bind_repl_SO: ∀I1,I2,L1,L2,V1,V2,T. L1.ⓑ{I1}V1 ≡[T, 0] L2.ⓑ{I2}V2 →
+ ∀J1,J2,W1,W2. L1.ⓑ{J1}W1 ≡[T, 1] L2.ⓑ{J2}W2.
+/2 width=5 by llpx_sn_bind_repl_SO/ qed-.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "ground_2/ynat/ynat_plus.ma".
+include "basic_2/substitution/drop.ma".
+
+(* LAZY SN POINTWISE EXTENSION OF A CONTEXT-SENSITIVE REALTION FOR TERMS ****)
+
+inductive llpx_sn (R:relation3 lenv term term): relation4 ynat term lenv lenv ≝
+| llpx_sn_sort: ∀L1,L2,l,k. |L1| = |L2| → llpx_sn R l (⋆k) L1 L2
+| llpx_sn_skip: ∀L1,L2,l,i. |L1| = |L2| → yinj i < l → llpx_sn R l (#i) L1 L2
+| llpx_sn_lref: ∀I,L1,L2,K1,K2,V1,V2,l,i. l ≤ yinj i →
+ ⬇[i] L1 ≡ K1.ⓑ{I}V1 → ⬇[i] L2 ≡ K2.ⓑ{I}V2 →
+ llpx_sn R (yinj 0) V1 K1 K2 → R K1 V1 V2 → llpx_sn R l (#i) L1 L2
+| llpx_sn_free: ∀L1,L2,l,i. |L1| ≤ i → |L2| ≤ i → |L1| = |L2| → llpx_sn R l (#i) L1 L2
+| llpx_sn_gref: ∀L1,L2,l,p. |L1| = |L2| → llpx_sn R l (§p) L1 L2
+| llpx_sn_bind: ∀a,I,L1,L2,V,T,l.
+ llpx_sn R l V L1 L2 → llpx_sn R (⫯l) T (L1.ⓑ{I}V) (L2.ⓑ{I}V) →
+ llpx_sn R l (ⓑ{a,I}V.T) L1 L2
+| llpx_sn_flat: ∀I,L1,L2,V,T,l.
+ llpx_sn R l V L1 L2 → llpx_sn R l T L1 L2 → llpx_sn R l (ⓕ{I}V.T) L1 L2
+.
+
+(* Basic inversion lemmas ***************************************************)
+
+fact llpx_sn_inv_bind_aux: ∀R,L1,L2,X,l. llpx_sn R l X L1 L2 →
+ ∀a,I,V,T. X = ⓑ{a,I}V.T →
+ llpx_sn R l V L1 L2 ∧ llpx_sn R (⫯l) T (L1.ⓑ{I}V) (L2.ⓑ{I}V).
+#R #L1 #L2 #X #l * -L1 -L2 -X -l
+[ #L1 #L2 #l #k #_ #b #J #W #U #H destruct
+| #L1 #L2 #l #i #_ #_ #b #J #W #U #H destruct
+| #I #L1 #L2 #K1 #K2 #V1 #V2 #l #i #_ #_ #_ #_ #_ #b #J #W #U #H destruct
+| #L1 #L2 #l #i #_ #_ #_ #b #J #W #U #H destruct
+| #L1 #L2 #l #p #_ #b #J #W #U #H destruct
+| #a #I #L1 #L2 #V #T #l #HV #HT #b #J #W #U #H destruct /2 width=1 by conj/
+| #I #L1 #L2 #V #T #l #_ #_ #b #J #W #U #H destruct
+]
+qed-.
+
+lemma llpx_sn_inv_bind: ∀R,a,I,L1,L2,V,T,l. llpx_sn R l (ⓑ{a,I}V.T) L1 L2 →
+ llpx_sn R l V L1 L2 ∧ llpx_sn R (⫯l) T (L1.ⓑ{I}V) (L2.ⓑ{I}V).
+/2 width=4 by llpx_sn_inv_bind_aux/ qed-.
+
+fact llpx_sn_inv_flat_aux: ∀R,L1,L2,X,l. llpx_sn R l X L1 L2 →
+ ∀I,V,T. X = ⓕ{I}V.T →
+ llpx_sn R l V L1 L2 ∧ llpx_sn R l T L1 L2.
+#R #L1 #L2 #X #l * -L1 -L2 -X -l
+[ #L1 #L2 #l #k #_ #J #W #U #H destruct
+| #L1 #L2 #l #i #_ #_ #J #W #U #H destruct
+| #I #L1 #L2 #K1 #K2 #V1 #V2 #l #i #_ #_ #_ #_ #_ #J #W #U #H destruct
+| #L1 #L2 #l #i #_ #_ #_ #J #W #U #H destruct
+| #L1 #L2 #l #p #_ #J #W #U #H destruct
+| #a #I #L1 #L2 #V #T #l #_ #_ #J #W #U #H destruct
+| #I #L1 #L2 #V #T #l #HV #HT #J #W #U #H destruct /2 width=1 by conj/
+]
+qed-.
+
+lemma llpx_sn_inv_flat: ∀R,I,L1,L2,V,T,l. llpx_sn R l (ⓕ{I}V.T) L1 L2 →
+ llpx_sn R l V L1 L2 ∧ llpx_sn R l T L1 L2.
+/2 width=4 by llpx_sn_inv_flat_aux/ qed-.
+
+(* Basic forward lemmas *****************************************************)
+
+lemma llpx_sn_fwd_length: ∀R,L1,L2,T,l. llpx_sn R l T L1 L2 → |L1| = |L2|.
+#R #L1 #L2 #T #l #H elim H -L1 -L2 -T -l //
+#I #L1 #L2 #K1 #K2 #V1 #V2 #l #i #_ #HLK1 #HLK2 #_ #_ #HK12
+lapply (drop_fwd_length … HLK1) -HLK1
+lapply (drop_fwd_length … HLK2) -HLK2
+normalize //
+qed-.
+
+lemma llpx_sn_fwd_drop_sn: ∀R,L1,L2,T,l. llpx_sn R l T L1 L2 →
+ ∀K1,i. ⬇[i] L1 ≡ K1 → ∃K2. ⬇[i] L2 ≡ K2.
+#R #L1 #L2 #T #l #H #K1 #i #HLK1 lapply (llpx_sn_fwd_length … H) -H
+#HL12 lapply (drop_fwd_length_le2 … HLK1) -HLK1 /2 width=1 by drop_O1_le/
+qed-.
+
+lemma llpx_sn_fwd_drop_dx: ∀R,L1,L2,T,l. llpx_sn R l T L1 L2 →
+ ∀K2,i. ⬇[i] L2 ≡ K2 → ∃K1. ⬇[i] L1 ≡ K1.
+#R #L1 #L2 #T #l #H #K2 #i #HLK2 lapply (llpx_sn_fwd_length … H) -H
+#HL12 lapply (drop_fwd_length_le2 … HLK2) -HLK2 /2 width=1 by drop_O1_le/
+qed-.
+
+fact llpx_sn_fwd_lref_aux: ∀R,L1,L2,X,l. llpx_sn R l X L1 L2 → ∀i. X = #i →
+ ∨∨ |L1| ≤ i ∧ |L2| ≤ i
+ | yinj i < l
+ | ∃∃I,K1,K2,V1,V2. ⬇[i] L1 ≡ K1.ⓑ{I}V1 &
+ ⬇[i] L2 ≡ K2.ⓑ{I}V2 &
+ llpx_sn R (yinj 0) V1 K1 K2 &
+ R K1 V1 V2 & l ≤ yinj i.
+#R #L1 #L2 #X #l * -L1 -L2 -X -l
+[ #L1 #L2 #l #k #_ #j #H destruct
+| #L1 #L2 #l #i #_ #Hil #j #H destruct /2 width=1 by or3_intro1/
+| #I #L1 #L2 #K1 #K2 #V1 #V2 #l #i #Hli #HLK1 #HLK2 #HK12 #HV12 #j #H destruct
+ /3 width=9 by or3_intro2, ex5_5_intro/
+| #L1 #L2 #l #i #HL1 #HL2 #_ #j #H destruct /3 width=1 by or3_intro0, conj/
+| #L1 #L2 #l #p #_ #j #H destruct
+| #a #I #L1 #L2 #V #T #l #_ #_ #j #H destruct
+| #I #L1 #L2 #V #T #l #_ #_ #j #H destruct
+]
+qed-.
+
+lemma llpx_sn_fwd_lref: ∀R,L1,L2,l,i. llpx_sn R l (#i) L1 L2 →
+ ∨∨ |L1| ≤ i ∧ |L2| ≤ i
+ | yinj i < l
+ | ∃∃I,K1,K2,V1,V2. ⬇[i] L1 ≡ K1.ⓑ{I}V1 &
+ ⬇[i] L2 ≡ K2.ⓑ{I}V2 &
+ llpx_sn R (yinj 0) V1 K1 K2 &
+ R K1 V1 V2 & l ≤ yinj i.
+/2 width=3 by llpx_sn_fwd_lref_aux/ qed-.
+
+lemma llpx_sn_fwd_bind_sn: ∀R,a,I,L1,L2,V,T,l. llpx_sn R l (ⓑ{a,I}V.T) L1 L2 →
+ llpx_sn R l V L1 L2.
+#R #a #I #L1 #L2 #V #T #l #H elim (llpx_sn_inv_bind … H) -H //
+qed-.
+
+lemma llpx_sn_fwd_bind_dx: ∀R,a,I,L1,L2,V,T,l. llpx_sn R l (ⓑ{a,I}V.T) L1 L2 →
+ llpx_sn R (⫯l) T (L1.ⓑ{I}V) (L2.ⓑ{I}V).
+#R #a #I #L1 #L2 #V #T #l #H elim (llpx_sn_inv_bind … H) -H //
+qed-.
+
+lemma llpx_sn_fwd_flat_sn: ∀R,I,L1,L2,V,T,l. llpx_sn R l (ⓕ{I}V.T) L1 L2 →
+ llpx_sn R l V L1 L2.
+#R #I #L1 #L2 #V #T #l #H elim (llpx_sn_inv_flat … H) -H //
+qed-.
+
+lemma llpx_sn_fwd_flat_dx: ∀R,I,L1,L2,V,T,l. llpx_sn R l (ⓕ{I}V.T) L1 L2 →
+ llpx_sn R l T L1 L2.
+#R #I #L1 #L2 #V #T #l #H elim (llpx_sn_inv_flat … H) -H //
+qed-.
+
+lemma llpx_sn_fwd_pair_sn: ∀R,I,L1,L2,V,T,l. llpx_sn R l (②{I}V.T) L1 L2 →
+ llpx_sn R l V L1 L2.
+#R * /2 width=4 by llpx_sn_fwd_flat_sn, llpx_sn_fwd_bind_sn/
+qed-.
+
+(* Basic properties *********************************************************)
+
+lemma llpx_sn_refl: ∀R. (∀L. reflexive … (R L)) → ∀T,L,l. llpx_sn R l T L L.
+#R #HR #T #L @(f2_ind … rfw … L T) -L -T
+#x #IH #L * * /3 width=1 by llpx_sn_sort, llpx_sn_gref, llpx_sn_bind, llpx_sn_flat/
+#i #Hx elim (lt_or_ge i (|L|)) /2 width=1 by llpx_sn_free/
+#HiL #l elim (ylt_split i l) /2 width=1 by llpx_sn_skip/
+elim (drop_O1_lt … HiL) -HiL destruct /4 width=9 by llpx_sn_lref, drop_fwd_rfw/
+qed-.
+
+lemma llpx_sn_Y: ∀R,T,L1,L2. |L1| = |L2| → llpx_sn R (∞) T L1 L2.
+#R #T #L1 @(f2_ind … rfw … L1 T) -L1 -T
+#x #IH #L1 * * /3 width=1 by llpx_sn_sort, llpx_sn_skip, llpx_sn_gref, llpx_sn_flat/
+#a #I #V1 #T1 #Hx #L2 #HL12
+@llpx_sn_bind /2 width=1 by/ (**) (* explicit constructor *)
+@IH -IH // normalize /2 width=1 by eq_f2/
+qed-.
+
+lemma llpx_sn_ge_up: ∀R,L1,L2,U,lt. llpx_sn R lt U L1 L2 → ∀T,l,m. ⬆[l, m] T ≡ U →
+ lt ≤ l + m → llpx_sn R l U L1 L2.
+#R #L1 #L2 #U #lt #H elim H -L1 -L2 -U -lt
+[ #L1 #L2 #lt #k #HL12 #X #l #m #H #_ >(lift_inv_sort2 … H) -H /2 width=1 by llpx_sn_sort/
+| #L1 #L2 #lt #i #HL12 #Hilt #X #l #m #H #Hltlm
+ elim (lift_inv_lref2 … H) -H * #Hil #H destruct /3 width=1 by llpx_sn_skip, ylt_inj/ -HL12
+ elim (ylt_yle_false … Hilt) -Hilt
+ @(yle_trans … Hltlm) /2 width=1 by yle_inj/ (**) (* full auto too slow 11s *)
+| #I #L1 #L2 #K1 #K2 #W1 #W2 #lt #i #Hlti #HLK1 #HLK2 #HW1 #HW12 #_ #X #l #m #H #_
+ elim (lift_inv_lref2 … H) -H * #Hil #H destruct
+ [ lapply (llpx_sn_fwd_length … HW1) -HW1 #HK12
+ lapply (drop_fwd_length … HLK1) lapply (drop_fwd_length … HLK2)
+ normalize in ⊢ (%→%→?); -I -W1 -W2 -lt /3 width=1 by llpx_sn_skip, ylt_inj/
+ | /3 width=9 by llpx_sn_lref, yle_fwd_plus_sn1/
+ ]
+| /2 width=1 by llpx_sn_free/
+| #L1 #L2 #lt #p #HL12 #X #l #m #H #_ >(lift_inv_gref2 … H) -H /2 width=1 by llpx_sn_gref/
+| #a #I #L1 #L2 #W #U #lt #_ #_ #IHV #IHT #X #l #m #H #Hltlm destruct
+ elim (lift_inv_bind2 … H) -H #V #T #HVW #HTU #H destruct
+ @(llpx_sn_bind) /2 width=4 by/ (**) (* full auto fails *)
+ @(IHT … HTU) /2 width=1 by yle_succ/
+| #I #L1 #L2 #W #U #lt #_ #_ #IHV #IHT #X #l #m #H #Hltlm destruct
+ elim (lift_inv_flat2 … H) -H #HVW #HTU #H destruct
+ /3 width=4 by llpx_sn_flat/
+]
+qed-.
+
+(**) (* the minor premise comes first *)
+lemma llpx_sn_ge: ∀R,L1,L2,T,l1,l2. l1 ≤ l2 →
+ llpx_sn R l1 T L1 L2 → llpx_sn R l2 T L1 L2.
+#R #L1 #L2 #T #l1 #l2 * -l1 -l2 (**) (* destructed yle *)
+/3 width=6 by llpx_sn_ge_up, llpx_sn_Y, llpx_sn_fwd_length, yle_inj/
+qed-.
+
+lemma llpx_sn_bind_O: ∀R,a,I,L1,L2,V,T. llpx_sn R 0 V L1 L2 →
+ llpx_sn R 0 T (L1.ⓑ{I}V) (L2.ⓑ{I}V) →
+ llpx_sn R 0 (ⓑ{a,I}V.T) L1 L2.
+/3 width=3 by llpx_sn_ge, llpx_sn_bind/ qed-.
+
+lemma llpx_sn_co: ∀R1,R2. (∀L,T1,T2. R1 L T1 T2 → R2 L T1 T2) →
+ ∀L1,L2,T,l. llpx_sn R1 l T L1 L2 → llpx_sn R2 l T L1 L2.
+#R1 #R2 #HR12 #L1 #L2 #T #l #H elim H -L1 -L2 -T -l
+/3 width=9 by llpx_sn_sort, llpx_sn_skip, llpx_sn_lref, llpx_sn_free, llpx_sn_gref, llpx_sn_bind, llpx_sn_flat/
+qed-.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/multiple/frees.ma".
+include "basic_2/multiple/llpx_sn_alt_rec.ma".
+
+(* LAZY SN POINTWISE EXTENSION OF A CONTEXT-SENSITIVE REALTION FOR TERMS ****)
+
+(* alternative definition of llpx_sn (not recursive) *)
+definition llpx_sn_alt: relation3 lenv term term → relation4 ynat term lenv lenv ≝
+ λR,l,T,L1,L2. |L1| = |L2| ∧
+ (∀I1,I2,K1,K2,V1,V2,i. l ≤ yinj i → L1 ⊢ i ϵ 𝐅*[l]⦃T⦄ →
+ ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
+ I1 = I2 ∧ R K1 V1 V2
+ ).
+
+(* Main properties **********************************************************)
+
+theorem llpx_sn_llpx_sn_alt: ∀R,T,L1,L2,l. llpx_sn R l T L1 L2 → llpx_sn_alt R l T L1 L2.
+#R #U #L1 @(f2_ind … rfw … L1 U) -L1 -U
+#x #IHx #L1 #U #Hx #L2 #l #H elim (llpx_sn_inv_alt_r … H) -H
+#HL12 #IHU @conj //
+#I1 #I2 #K1 #K2 #V1 #V2 #i #Hli #H #HLK1 #HLK2 elim (frees_inv … H) -H
+[ -x #HnU elim (IHU … HnU HLK1 HLK2) -IHU -HnU -HLK1 -HLK2 /2 width=1 by conj/
+| * #J1 #K10 #W10 #j #Hlj #Hji #HnU #HLK10 <yminus_SO2 >yminus_inj >yminus_inj #HnW10 destruct
+ lapply (drop_fwd_drop2 … HLK10) #H
+ lapply (drop_conf_ge … H … HLK1 ?) -H /2 width=1 by ylt_fwd_le_succ1/ <minus_plus #HK10
+ elim (drop_O1_lt (Ⓕ) L2 j) [2: <HL12 /2 width=5 by drop_fwd_length_lt2/ ] #J2 #K20 #W20 #HLK20
+ lapply (drop_fwd_drop2 … HLK20) #H
+ lapply (drop_conf_ge … H … HLK2 ?) -H /2 width=1 by ylt_fwd_le_succ1/ <minus_plus #HK20
+ elim (IHx K10 W10 … K20 0 ?) -IHx -HL12 /3 width=6 by drop_fwd_rfw/
+ elim (IHU … HnU HLK10 HLK20) -IHU -HnU -HLK10 -HLK20 /2 width=6 by/
+]
+qed.
+
+theorem llpx_sn_alt_inv_llpx_sn: ∀R,T,L1,L2,l. llpx_sn_alt R l T L1 L2 → llpx_sn R l T L1 L2.
+#R #U #L1 @(f2_ind … rfw … L1 U) -L1 -U
+#x #IHx #L1 #U #Hx #L2 #l * #HL12 #IHU @llpx_sn_intro_alt_r //
+#I1 #I2 #K1 #K2 #V1 #V2 #i #Hli #HnU #HLK1 #HLK2 destruct
+elim (IHU … HLK1 HLK2) /3 width=2 by frees_eq/
+#H #HV12 @and3_intro // @IHx -IHx /3 width=6 by drop_fwd_rfw/
+lapply (drop_fwd_drop2 … HLK1) #H1
+lapply (drop_fwd_drop2 … HLK2) -HLK2 #H2
+@conj [ @(drop_fwd_length_eq1 … H1 H2) // ] -HL12
+#Z1 #Z2 #Y1 #Y2 #X1 #X2 #j #_
+>(minus_plus_m_m j (i+1)) in ⊢ (%→?); >commutative_plus <minus_plus
+<yminus_inj <yminus_inj >yminus_SO2
+#HnV1 #HKY1 #HKY2 (**) (* full auto too slow *)
+lapply (drop_trans_ge … H1 … HKY1 ?) -H1 -HKY1 // #HLY1
+lapply (drop_trans_ge … H2 … HKY2 ?) -H2 -HKY2 // #HLY2
+/4 width=9 by frees_be, yle_plus_dx2_trans, yle_succ_dx, ylt_inj/
+qed-.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/substitution/lift_neg.ma".
+include "basic_2/substitution/drop_drop.ma".
+include "basic_2/multiple/llpx_sn.ma".
+
+(* LAZY SN POINTWISE EXTENSION OF A CONTEXT-SENSITIVE REALTION FOR TERMS ****)
+
+(* alternative definition of llpx_sn (recursive) *)
+inductive llpx_sn_alt_r (R:relation3 lenv term term): relation4 ynat term lenv lenv ≝
+| llpx_sn_alt_r_intro: ∀L1,L2,T,l.
+ (∀I1,I2,K1,K2,V1,V2,i. l ≤ yinj i → (∀U. ⬆[i, 1] U ≡ T → ⊥) →
+ ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 → I1 = I2 ∧ R K1 V1 V2
+ ) →
+ (∀I1,I2,K1,K2,V1,V2,i. l ≤ yinj i → (∀U. ⬆[i, 1] U ≡ T → ⊥) →
+ ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 → llpx_sn_alt_r R 0 V1 K1 K2
+ ) → |L1| = |L2| → llpx_sn_alt_r R l T L1 L2
+.
+
+(* Compact definition of llpx_sn_alt_r **************************************)
+
+lemma llpx_sn_alt_r_intro_alt: ∀R,L1,L2,T,l. |L1| = |L2| →
+ (∀I1,I2,K1,K2,V1,V2,i. l ≤ yinj i → (∀U. ⬆[i, 1] U ≡ T → ⊥) →
+ ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
+ ∧∧ I1 = I2 & R K1 V1 V2 & llpx_sn_alt_r R 0 V1 K1 K2
+ ) → llpx_sn_alt_r R l T L1 L2.
+#R #L1 #L2 #T #l #HL12 #IH @llpx_sn_alt_r_intro // -HL12
+#I1 #I2 #K1 #K2 #V1 #V2 #i #Hil #HnT #HLK1 #HLK2
+elim (IH … HnT HLK1 HLK2) -IH -HnT -HLK1 -HLK2 /2 width=1 by conj/
+qed.
+
+lemma llpx_sn_alt_r_ind_alt: ∀R. ∀S:relation4 ynat term lenv lenv.
+ (∀L1,L2,T,l. |L1| = |L2| → (
+ ∀I1,I2,K1,K2,V1,V2,i. l ≤ yinj i → (∀U. ⬆[i, 1] U ≡ T → ⊥) →
+ ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
+ ∧∧ I1 = I2 & R K1 V1 V2 & llpx_sn_alt_r R 0 V1 K1 K2 & S 0 V1 K1 K2
+ ) → S l T L1 L2) →
+ ∀L1,L2,T,l. llpx_sn_alt_r R l T L1 L2 → S l T L1 L2.
+#R #S #IH #L1 #L2 #T #l #H elim H -L1 -L2 -T -l
+#L1 #L2 #T #l #H1 #H2 #HL12 #IH2 @IH -IH // -HL12
+#I1 #I2 #K1 #K2 #V1 #V2 #i #Hil #HnT #HLK1 #HLK2
+elim (H1 … HnT HLK1 HLK2) -H1 /4 width=8 by and4_intro/
+qed-.
+
+lemma llpx_sn_alt_r_inv_alt: ∀R,L1,L2,T,l. llpx_sn_alt_r R l T L1 L2 →
+ |L1| = |L2| ∧
+ ∀I1,I2,K1,K2,V1,V2,i. l ≤ yinj i → (∀U. ⬆[i, 1] U ≡ T → ⊥) →
+ ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
+ ∧∧ I1 = I2 & R K1 V1 V2 & llpx_sn_alt_r R 0 V1 K1 K2.
+#R #L1 #L2 #T #l #H @(llpx_sn_alt_r_ind_alt … H) -L1 -L2 -T -l
+#L1 #L2 #T #l #HL12 #IH @conj // -HL12
+#I1 #I2 #K1 #K2 #V1 #V2 #i #Hil #HnT #HLK1 #HLK2
+elim (IH … HnT HLK1 HLK2) -IH -HnT -HLK1 -HLK2 /2 width=1 by and3_intro/
+qed-.
+
+(* Basic inversion lemmas ***************************************************)
+
+lemma llpx_sn_alt_r_inv_flat: ∀R,I,L1,L2,V,T,l. llpx_sn_alt_r R l (ⓕ{I}V.T) L1 L2 →
+ llpx_sn_alt_r R l V L1 L2 ∧ llpx_sn_alt_r R l T L1 L2.
+#R #I #L1 #L2 #V #T #l #H elim (llpx_sn_alt_r_inv_alt … H) -H
+#HL12 #IH @conj @llpx_sn_alt_r_intro_alt // -HL12
+#I1 #I2 #K1 #K2 #V1 #V2 #i #Hli #H #HLK1 #HLK2
+elim (IH … HLK1 HLK2) -IH -HLK1 -HLK2 //
+/3 width=8 by nlift_flat_sn, nlift_flat_dx, and3_intro/
+qed-.
+
+lemma llpx_sn_alt_r_inv_bind: ∀R,a,I,L1,L2,V,T,l. llpx_sn_alt_r R l (ⓑ{a,I}V.T) L1 L2 →
+ llpx_sn_alt_r R l V L1 L2 ∧ llpx_sn_alt_r R (⫯l) T (L1.ⓑ{I}V) (L2.ⓑ{I}V).
+#R #a #I #L1 #L2 #V #T #l #H elim (llpx_sn_alt_r_inv_alt … H) -H
+#HL12 #IH @conj @llpx_sn_alt_r_intro_alt [1,3: normalize // ] -HL12
+#I1 #I2 #K1 #K2 #V1 #V2 #i #Hli #H #HLK1 #HLK2
+[ elim (IH … HLK1 HLK2) -IH -HLK1 -HLK2
+ /3 width=9 by nlift_bind_sn, and3_intro/
+| lapply (yle_inv_succ1 … Hli) -Hli * #Hli #Hi <yminus_SO2 in Hli; #Hli
+ lapply (drop_inv_drop1_lt … HLK1 ?) -HLK1 /2 width=1 by ylt_O/ #HLK1
+ lapply (drop_inv_drop1_lt … HLK2 ?) -HLK2 /2 width=1 by ylt_O/ #HLK2
+ elim (IH … HLK1 HLK2) -IH -HLK1 -HLK2 /3 width=9 by nlift_bind_dx, and3_intro/
+]
+qed-.
+
+(* Basic forward lemmas *****************************************************)
+
+lemma llpx_sn_alt_r_fwd_length: ∀R,L1,L2,T,l. llpx_sn_alt_r R l T L1 L2 → |L1| = |L2|.
+#R #L1 #L2 #T #l #H elim (llpx_sn_alt_r_inv_alt … H) -H //
+qed-.
+
+lemma llpx_sn_alt_r_fwd_lref: ∀R,L1,L2,l,i. llpx_sn_alt_r R l (#i) L1 L2 →
+ ∨∨ |L1| ≤ i ∧ |L2| ≤ i
+ | yinj i < l
+ | ∃∃I,K1,K2,V1,V2. ⬇[i] L1 ≡ K1.ⓑ{I}V1 &
+ ⬇[i] L2 ≡ K2.ⓑ{I}V2 &
+ llpx_sn_alt_r R (yinj 0) V1 K1 K2 &
+ R K1 V1 V2 & l ≤ yinj i.
+#R #L1 #L2 #l #i #H elim (llpx_sn_alt_r_inv_alt … H) -H
+#HL12 #IH elim (lt_or_ge i (|L1|)) /3 width=1 by or3_intro0, conj/
+elim (ylt_split i l) /3 width=1 by or3_intro1/
+#Hli #HL1 elim (drop_O1_lt (Ⓕ) … HL1)
+#I1 #K1 #V1 #HLK1 elim (drop_O1_lt (Ⓕ) L2 i) //
+#I2 #K2 #V2 #HLK2 elim (IH … HLK1 HLK2) -IH
+/3 width=9 by nlift_lref_be_SO, or3_intro2, ex5_5_intro/
+qed-.
+
+(* Basic properties *********************************************************)
+
+lemma llpx_sn_alt_r_sort: ∀R,L1,L2,l,k. |L1| = |L2| → llpx_sn_alt_r R l (⋆k) L1 L2.
+#R #L1 #L2 #l #k #HL12 @llpx_sn_alt_r_intro_alt // -HL12
+#I1 #I2 #K1 #K2 #V1 #V2 #i #_ #H elim (H (⋆k)) //
+qed.
+
+lemma llpx_sn_alt_r_gref: ∀R,L1,L2,l,p. |L1| = |L2| → llpx_sn_alt_r R l (§p) L1 L2.
+#R #L1 #L2 #l #p #HL12 @llpx_sn_alt_r_intro_alt // -HL12
+#I1 #I2 #K1 #K2 #V1 #V2 #i #_ #H elim (H (§p)) //
+qed.
+
+lemma llpx_sn_alt_r_skip: ∀R,L1,L2,l,i. |L1| = |L2| → yinj i < l → llpx_sn_alt_r R l (#i) L1 L2.
+#R #L1 #L2 #l #i #HL12 #Hil @llpx_sn_alt_r_intro_alt // -HL12
+#I1 #I2 #K1 #K2 #V1 #V2 #j #Hlj #H elim (H (#i)) -H
+/4 width=3 by lift_lref_lt, ylt_yle_trans, ylt_inv_inj/
+qed.
+
+lemma llpx_sn_alt_r_free: ∀R,L1,L2,l,i. |L1| ≤ i → |L2| ≤ i → |L1| = |L2| →
+ llpx_sn_alt_r R l (#i) L1 L2.
+#R #L1 #L2 #l #i #HL1 #_ #HL12 @llpx_sn_alt_r_intro_alt // -HL12
+#I1 #I2 #K1 #K2 #V1 #V2 #j #_ #H #HLK1 elim (H (#(i-1))) -H
+lapply (drop_fwd_length_lt2 … HLK1) -HLK1
+/4 width=3 by lift_lref_ge_minus, yle_inj, transitive_le/
+qed.
+
+lemma llpx_sn_alt_r_lref: ∀R,I,L1,L2,K1,K2,V1,V2,l,i. l ≤ yinj i →
+ ⬇[i] L1 ≡ K1.ⓑ{I}V1 → ⬇[i] L2 ≡ K2.ⓑ{I}V2 →
+ llpx_sn_alt_r R 0 V1 K1 K2 → R K1 V1 V2 →
+ llpx_sn_alt_r R l (#i) L1 L2.
+#R #I #L1 #L2 #K1 #K2 #V1 #V2 #l #i #Hli #HLK1 #HLK2 #HK12 #HV12 @llpx_sn_alt_r_intro_alt
+[ lapply (llpx_sn_alt_r_fwd_length … HK12) -HK12 #HK12
+ @(drop_fwd_length_eq2 … HLK1 HLK2) normalize //
+| #Z1 #Z2 #Y1 #Y2 #X1 #X2 #j #Hlj #H #HLY1 #HLY2
+ elim (lt_or_eq_or_gt i j) #Hij destruct
+ [ elim (H (#i)) -H /3 width=1 by lift_lref_lt, ylt_inj/
+ | lapply (drop_mono … HLY1 … HLK1) -HLY1 -HLK1 #H destruct
+ lapply (drop_mono … HLY2 … HLK2) -HLY2 -HLK2 #H destruct /2 width=1 by and3_intro/
+ | elim (H (#(i-1))) -H /3 width=1 by lift_lref_ge_minus, yle_inj/
+ ]
+]
+qed.
+
+lemma llpx_sn_alt_r_flat: ∀R,I,L1,L2,V,T,l.
+ llpx_sn_alt_r R l V L1 L2 → llpx_sn_alt_r R l T L1 L2 →
+ llpx_sn_alt_r R l (ⓕ{I}V.T) L1 L2.
+#R #I #L1 #L2 #V #T #l #HV #HT
+elim (llpx_sn_alt_r_inv_alt … HV) -HV #HL12 #IHV
+elim (llpx_sn_alt_r_inv_alt … HT) -HT #_ #IHT
+@llpx_sn_alt_r_intro_alt // -HL12
+#I1 #I2 #K1 #K2 #V1 #V2 #i #Hli #HnVT #HLK1 #HLK2
+elim (nlift_inv_flat … HnVT) -HnVT #H
+[ elim (IHV … HLK1 … HLK2) -IHV /2 width=2 by and3_intro/
+| elim (IHT … HLK1 … HLK2) -IHT /3 width=2 by and3_intro/
+]
+qed.
+
+lemma llpx_sn_alt_r_bind: ∀R,a,I,L1,L2,V,T,l.
+ llpx_sn_alt_r R l V L1 L2 →
+ llpx_sn_alt_r R (⫯l) T (L1.ⓑ{I}V) (L2.ⓑ{I}V) →
+ llpx_sn_alt_r R l (ⓑ{a,I}V.T) L1 L2.
+#R #a #I #L1 #L2 #V #T #l #HV #HT
+elim (llpx_sn_alt_r_inv_alt … HV) -HV #HL12 #IHV
+elim (llpx_sn_alt_r_inv_alt … HT) -HT #_ #IHT
+@llpx_sn_alt_r_intro_alt // -HL12
+#I1 #I2 #K1 #K2 #V1 #V2 #i #Hli #HnVT #HLK1 #HLK2
+elim (nlift_inv_bind … HnVT) -HnVT #H
+[ elim (IHV … HLK1 … HLK2) -IHV /2 width=2 by and3_intro/
+| elim IHT -IHT /2 width=12 by drop_drop, yle_succ, and3_intro/
+]
+qed.
+
+(* Main properties **********************************************************)
+
+theorem llpx_sn_lpx_sn_alt_r: ∀R,L1,L2,T,l. llpx_sn R l T L1 L2 → llpx_sn_alt_r R l T L1 L2.
+#R #L1 #L2 #T #l #H elim H -L1 -L2 -T -l
+/2 width=9 by llpx_sn_alt_r_sort, llpx_sn_alt_r_gref, llpx_sn_alt_r_skip, llpx_sn_alt_r_free, llpx_sn_alt_r_lref, llpx_sn_alt_r_flat, llpx_sn_alt_r_bind/
+qed.
+
+(* Main inversion lemmas ****************************************************)
+
+theorem llpx_sn_alt_r_inv_lpx_sn: ∀R,T,L1,L2,l. llpx_sn_alt_r R l T L1 L2 → llpx_sn R l T L1 L2.
+#R #T #L1 @(f2_ind … rfw … L1 T) -L1 -T #x #IH #L1 * *
+[1,3: /3 width=4 by llpx_sn_alt_r_fwd_length, llpx_sn_gref, llpx_sn_sort/
+| #i #Hx #L2 #l #H lapply (llpx_sn_alt_r_fwd_length … H)
+ #HL12 elim (llpx_sn_alt_r_fwd_lref … H) -H
+ [ * /2 width=1 by llpx_sn_free/
+ | /2 width=1 by llpx_sn_skip/
+ | * /4 width=9 by llpx_sn_lref, drop_fwd_rfw/
+ ]
+| #a #I #V #T #Hx #L2 #l #H elim (llpx_sn_alt_r_inv_bind … H) -H
+ /3 width=1 by llpx_sn_bind/
+| #I #V #T #Hx #L2 #l #H elim (llpx_sn_alt_r_inv_flat … H) -H
+ /3 width=1 by llpx_sn_flat/
+]
+qed-.
+
+(* Alternative definition of llpx_sn (recursive) ****************************)
+
+lemma llpx_sn_intro_alt_r: ∀R,L1,L2,T,l. |L1| = |L2| →
+ (∀I1,I2,K1,K2,V1,V2,i. l ≤ yinj i → (∀U. ⬆[i, 1] U ≡ T → ⊥) →
+ ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
+ ∧∧ I1 = I2 & R K1 V1 V2 & llpx_sn R 0 V1 K1 K2
+ ) → llpx_sn R l T L1 L2.
+#R #L1 #L2 #T #l #HL12 #IH @llpx_sn_alt_r_inv_lpx_sn
+@llpx_sn_alt_r_intro_alt // -HL12
+#I1 #I2 #K1 #K2 #V1 #V2 #i #Hil #HnT #HLK1 #HLK2
+elim (IH … HnT HLK1 HLK2) -IH -HnT -HLK1 -HLK2 /3 width=1 by llpx_sn_lpx_sn_alt_r, and3_intro/
+qed.
+
+lemma llpx_sn_ind_alt_r: ∀R. ∀S:relation4 ynat term lenv lenv.
+ (∀L1,L2,T,l. |L1| = |L2| → (
+ ∀I1,I2,K1,K2,V1,V2,i. l ≤ yinj i → (∀U. ⬆[i, 1] U ≡ T → ⊥) →
+ ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
+ ∧∧ I1 = I2 & R K1 V1 V2 & llpx_sn R 0 V1 K1 K2 & S 0 V1 K1 K2
+ ) → S l T L1 L2) →
+ ∀L1,L2,T,l. llpx_sn R l T L1 L2 → S l T L1 L2.
+#R #S #IH1 #L1 #L2 #T #l #H lapply (llpx_sn_lpx_sn_alt_r … H) -H
+#H @(llpx_sn_alt_r_ind_alt … H) -L1 -L2 -T -l
+#L1 #L2 #T #l #HL12 #IH2 @IH1 -IH1 // -HL12
+#I1 #I2 #K1 #K2 #V1 #V2 #i #Hil #HnT #HLK1 #HLK2
+elim (IH2 … HnT HLK1 HLK2) -IH2 -HnT -HLK1 -HLK2 /3 width=1 by llpx_sn_alt_r_inv_lpx_sn, and4_intro/
+qed-.
+
+lemma llpx_sn_inv_alt_r: ∀R,L1,L2,T,l. llpx_sn R l T L1 L2 →
+ |L1| = |L2| ∧
+ ∀I1,I2,K1,K2,V1,V2,i. l ≤ yinj i → (∀U. ⬆[i, 1] U ≡ T → ⊥) →
+ ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
+ ∧∧ I1 = I2 & R K1 V1 V2 & llpx_sn R 0 V1 K1 K2.
+#R #L1 #L2 #T #l #H lapply (llpx_sn_lpx_sn_alt_r … H) -H
+#H elim (llpx_sn_alt_r_inv_alt … H) -H
+#HL12 #IH @conj //
+#I1 #I2 #K1 #K2 #V1 #V2 #i #Hil #HnT #HLK1 #HLK2
+elim (IH … HnT HLK1 HLK2) -IH -HnT -HLK1 -HLK2 /3 width=1 by llpx_sn_alt_r_inv_lpx_sn, and3_intro/
+qed-.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/substitution/drop_drop.ma".
+include "basic_2/multiple/llpx_sn_lreq.ma".
+
+(* LAZY SN POINTWISE EXTENSION OF A CONTEXT-SENSITIVE REALTION FOR TERMS ****)
+
+(* Advanced forward lemmas **************************************************)
+
+lemma llpx_sn_fwd_lref_dx: ∀R,L1,L2,l,i. llpx_sn R l (#i) L1 L2 →
+ ∀I,K2,V2. ⬇[i] L2 ≡ K2.ⓑ{I}V2 →
+ i < l ∨
+ ∃∃K1,V1. ⬇[i] L1 ≡ K1.ⓑ{I}V1 & llpx_sn R 0 V1 K1 K2 &
+ R K1 V1 V2 & l ≤ i.
+#R #L1 #L2 #l #i #H #I #K2 #V2 #HLK2 elim (llpx_sn_fwd_lref … H) -H [ * || * ]
+[ #_ #H elim (lt_refl_false i)
+ lapply (drop_fwd_length_lt2 … HLK2) -HLK2
+ /2 width=3 by lt_to_le_to_lt/ (**) (* full auto too slow *)
+| /2 width=1 by or_introl/
+| #I #K11 #K22 #V11 #V22 #HLK11 #HLK22 #HK12 #HV12 #Hli
+ lapply (drop_mono … HLK22 … HLK2) -L2 #H destruct
+ /3 width=5 by ex4_2_intro, or_intror/
+]
+qed-.
+
+lemma llpx_sn_fwd_lref_sn: ∀R,L1,L2,l,i. llpx_sn R l (#i) L1 L2 →
+ ∀I,K1,V1. ⬇[i] L1 ≡ K1.ⓑ{I}V1 →
+ i < l ∨
+ ∃∃K2,V2. ⬇[i] L2 ≡ K2.ⓑ{I}V2 & llpx_sn R 0 V1 K1 K2 &
+ R K1 V1 V2 & l ≤ i.
+#R #L1 #L2 #l #i #H #I #K1 #V1 #HLK1 elim (llpx_sn_fwd_lref … H) -H [ * || * ]
+[ #H #_ elim (lt_refl_false i)
+ lapply (drop_fwd_length_lt2 … HLK1) -HLK1
+ /2 width=3 by lt_to_le_to_lt/ (**) (* full auto too slow *)
+| /2 width=1 by or_introl/
+| #I #K11 #K22 #V11 #V22 #HLK11 #HLK22 #HK12 #HV12 #Hli
+ lapply (drop_mono … HLK11 … HLK1) -L1 #H destruct
+ /3 width=5 by ex4_2_intro, or_intror/
+]
+qed-.
+
+(* Advanced inversion lemmas ************************************************)
+
+lemma llpx_sn_inv_lref_ge_dx: ∀R,L1,L2,l,i. llpx_sn R l (#i) L1 L2 → l ≤ i →
+ ∀I,K2,V2. ⬇[i] L2 ≡ K2.ⓑ{I}V2 →
+ ∃∃K1,V1. ⬇[i] L1 ≡ K1.ⓑ{I}V1 &
+ llpx_sn R 0 V1 K1 K2 & R K1 V1 V2.
+#R #L1 #L2 #l #i #H #Hli #I #K2 #V2 #HLK2 elim (llpx_sn_fwd_lref_dx … H … HLK2) -L2
+[ #H elim (ylt_yle_false … H Hli)
+| * /2 width=5 by ex3_2_intro/
+]
+qed-.
+
+lemma llpx_sn_inv_lref_ge_sn: ∀R,L1,L2,l,i. llpx_sn R l (#i) L1 L2 → l ≤ i →
+ ∀I,K1,V1. ⬇[i] L1 ≡ K1.ⓑ{I}V1 →
+ ∃∃K2,V2. ⬇[i] L2 ≡ K2.ⓑ{I}V2 &
+ llpx_sn R 0 V1 K1 K2 & R K1 V1 V2.
+#R #L1 #L2 #l #i #H #Hli #I #K1 #V1 #HLK1 elim (llpx_sn_fwd_lref_sn … H … HLK1) -L1
+[ #H elim (ylt_yle_false … H Hli)
+| * /2 width=5 by ex3_2_intro/
+]
+qed-.
+
+lemma llpx_sn_inv_lref_ge_bi: ∀R,L1,L2,l,i. llpx_sn R l (#i) L1 L2 → l ≤ i →
+ ∀I1,I2,K1,K2,V1,V2.
+ ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
+ ∧∧ I1 = I2 & llpx_sn R 0 V1 K1 K2 & R K1 V1 V2.
+#R #L1 #L2 #l #i #HL12 #Hli #I1 #I2 #K1 #K2 #V1 #V2 #HLK1 #HLK2
+elim (llpx_sn_inv_lref_ge_sn … HL12 … HLK1) // -L1 -l
+#J #Y #HY lapply (drop_mono … HY … HLK2) -L2 -i #H destruct /2 width=1 by and3_intro/
+qed-.
+
+fact llpx_sn_inv_S_aux: ∀R,L1,L2,T,l0. llpx_sn R l0 T L1 L2 → ∀l. l0 = l + 1 →
+ ∀K1,K2,I,V1,V2. ⬇[l] L1 ≡ K1.ⓑ{I}V1 → ⬇[l] L2 ≡ K2.ⓑ{I}V2 →
+ llpx_sn R 0 V1 K1 K2 → R K1 V1 V2 → llpx_sn R l T L1 L2.
+#R #L1 #L2 #T #l0 #H elim H -L1 -L2 -T -l0
+/2 width=1 by llpx_sn_gref, llpx_sn_free, llpx_sn_sort/
+[ #L1 #L2 #l0 #i #HL12 #Hil #l #H #K1 #K2 #I #V1 #V2 #HLK1 #HLK2 #HK12 #HV12 destruct
+ elim (yle_split_eq i l) /2 width=1 by llpx_sn_skip, ylt_fwd_succ2/ -HL12 -Hil
+ #H destruct /2 width=9 by llpx_sn_lref/
+| #I #L1 #L2 #K11 #K22 #V1 #V2 #l0 #i #Hl0i #HLK11 #HLK22 #HK12 #HV12 #_ #l #H #K1 #K2 #J #W1 #W2 #_ #_ #_ #_ destruct
+ /3 width=9 by llpx_sn_lref, yle_pred_sn/
+| #a #I #L1 #L2 #V #T #l0 #_ #_ #IHV #IHT #l #H #K1 #K2 #J #W1 #W2 #HLK1 #HLK2 #HK12 #HW12 destruct
+ /4 width=9 by llpx_sn_bind, drop_drop/
+| #I #L1 #L2 #V #T #l0 #_ #_ #IHV #IHT #l #H #K1 #K2 #J #W1 #W2 #HLK1 #HLK2 #HK12 #HW12 destruct
+ /3 width=9 by llpx_sn_flat/
+]
+qed-.
+
+lemma llpx_sn_inv_S: ∀R,L1,L2,T,l. llpx_sn R (l + 1) T L1 L2 →
+ ∀K1,K2,I,V1,V2. ⬇[l] L1 ≡ K1.ⓑ{I}V1 → ⬇[l] L2 ≡ K2.ⓑ{I}V2 →
+ llpx_sn R 0 V1 K1 K2 → R K1 V1 V2 → llpx_sn R l T L1 L2.
+/2 width=9 by llpx_sn_inv_S_aux/ qed-.
+
+lemma llpx_sn_inv_bind_O: ∀R. (∀L. reflexive … (R L)) →
+ ∀a,I,L1,L2,V,T. llpx_sn R 0 (ⓑ{a,I}V.T) L1 L2 →
+ llpx_sn R 0 V L1 L2 ∧ llpx_sn R 0 T (L1.ⓑ{I}V) (L2.ⓑ{I}V).
+#R #HR #a #I #L1 #L2 #V #T #H elim (llpx_sn_inv_bind … H) -H
+/3 width=9 by drop_pair, conj, llpx_sn_inv_S/
+qed-.
+
+(* More advanced forward lemmas *********************************************)
+
+lemma llpx_sn_fwd_bind_O_dx: ∀R. (∀L. reflexive … (R L)) →
+ ∀a,I,L1,L2,V,T. llpx_sn R 0 (ⓑ{a,I}V.T) L1 L2 →
+ llpx_sn R 0 T (L1.ⓑ{I}V) (L2.ⓑ{I}V).
+#R #HR #a #I #L1 #L2 #V #T #H elim (llpx_sn_inv_bind_O … H) -H //
+qed-.
+
+(* Advanced properties ******************************************************)
+
+lemma llpx_sn_bind_repl_O: ∀R,I,L1,L2,V1,V2,T. llpx_sn R 0 T (L1.ⓑ{I}V1) (L2.ⓑ{I}V2) →
+ ∀J,W1,W2. llpx_sn R 0 W1 L1 L2 → R L1 W1 W2 → llpx_sn R 0 T (L1.ⓑ{J}W1) (L2.ⓑ{J}W2).
+/3 width=9 by llpx_sn_bind_repl_SO, llpx_sn_inv_S/ qed-.
+
+lemma llpx_sn_dec: ∀R. (∀L,T1,T2. Decidable (R L T1 T2)) →
+ ∀T,L1,L2,l. Decidable (llpx_sn R l T L1 L2).
+#R #HR #T #L1 @(f2_ind … rfw … L1 T) -L1 -T
+#x #IH #L1 * *
+[ #k #Hx #L2 elim (eq_nat_dec (|L1|) (|L2|)) /3 width=1 by or_introl, llpx_sn_sort/
+| #i #Hx #L2 elim (eq_nat_dec (|L1|) (|L2|))
+ [ #HL12 #l elim (ylt_split i l) /3 width=1 by llpx_sn_skip, or_introl/
+ #Hli elim (lt_or_ge i (|L1|)) #HiL1
+ elim (lt_or_ge i (|L2|)) #HiL2 /3 width=1 by or_introl, llpx_sn_free/
+ elim (drop_O1_lt (Ⓕ) … HiL2) #I2 #K2 #V2 #HLK2
+ elim (drop_O1_lt (Ⓕ) … HiL1) #I1 #K1 #V1 #HLK1
+ elim (eq_bind2_dec I2 I1)
+ [ #H2 elim (HR K1 V1 V2) -HR
+ [ #H3 elim (IH K1 V1 … K2 0) destruct
+ /3 width=9 by llpx_sn_lref, drop_fwd_rfw, or_introl/
+ ]
+ ]
+ -IH #H3 @or_intror
+ #H elim (llpx_sn_fwd_lref … H) -H [1,3,4,6,7,9: * ]
+ [1,3,5: /3 width=4 by lt_to_le_to_lt, lt_refl_false/
+ |7,8,9: /2 width=4 by ylt_yle_false/
+ ]
+ #Z #Y1 #Y2 #X1 #X2 #HLY1 #HLY2 #HY12 #HX12
+ lapply (drop_mono … HLY1 … HLK1) -HLY1 -HLK1
+ lapply (drop_mono … HLY2 … HLK2) -HLY2 -HLK2
+ #H #H0 destruct /2 width=1 by/
+ ]
+| #p #Hx #L2 elim (eq_nat_dec (|L1|) (|L2|)) /3 width=1 by or_introl, llpx_sn_gref/
+| #a #I #V #T #Hx #L2 #l destruct
+ elim (IH L1 V … L2 l) /2 width=1 by/
+ elim (IH (L1.ⓑ{I}V) T … (L2.ⓑ{I}V) (⫯l)) -IH /3 width=1 by or_introl, llpx_sn_bind/
+ #H1 #H2 @or_intror
+ #H elim (llpx_sn_inv_bind … H) -H /2 width=1 by/
+| #I #V #T #Hx #L2 #l destruct
+ elim (IH L1 V … L2 l) /2 width=1 by/
+ elim (IH L1 T … L2 l) -IH /3 width=1 by or_introl, llpx_sn_flat/
+ #H1 #H2 @or_intror
+ #H elim (llpx_sn_inv_flat … H) -H /2 width=1 by/
+]
+-x /4 width=4 by llpx_sn_fwd_length, or_intror/
+qed-.
+
+(* Properties on relocation *************************************************)
+
+lemma llpx_sn_lift_le: ∀R. d_liftable R →
+ ∀K1,K2,T,l0. llpx_sn R l0 T K1 K2 →
+ ∀L1,L2,l,m. ⬇[Ⓕ, l, m] L1 ≡ K1 → ⬇[Ⓕ, l, m] L2 ≡ K2 →
+ ∀U. ⬆[l, m] T ≡ U → l0 ≤ l → llpx_sn R l0 U L1 L2.
+#R #HR #K1 #K2 #T #l0 #H elim H -K1 -K2 -T -l0
+[ #K1 #K2 #l0 #k #HK12 #L1 #L2 #l #m #HLK1 #HLK2 #X #H #_ >(lift_inv_sort1 … H) -X
+ lapply (drop_fwd_length_eq2 … HLK1 HLK2 HK12) -K1 -K2 -l
+ /2 width=1 by llpx_sn_sort/
+| #K1 #K2 #l0 #i #HK12 #Hil0 #L1 #L2 #l #m #HLK1 #HLK2 #X #H #Hl0 elim (lift_inv_lref1 … H) -H
+ * #Hli #H destruct
+ [ lapply (drop_fwd_length_eq2 … HLK1 HLK2 HK12) -K1 -K2 -l
+ /2 width=1 by llpx_sn_skip/
+ | elim (ylt_yle_false … Hil0) -L1 -L2 -K1 -K2 -m -Hil0
+ /3 width=3 by yle_trans, yle_inj/
+ ]
+| #I #K1 #K2 #K11 #K22 #V1 #V2 #l0 #i #Hil0 #HK11 #HK22 #HK12 #HV12 #IHK12 #L1 #L2 #l #m #HLK1 #HLK2 #X #H #Hl0 elim (lift_inv_lref1 … H) -H
+ * #Hli #H destruct [ -HK12 | -IHK12 ]
+ [ elim (drop_trans_lt … HLK1 … HK11) // -K1
+ elim (drop_trans_lt … HLK2 … HK22) // -Hli -K2
+ /3 width=18 by llpx_sn_lref/
+ | lapply (drop_trans_ge_comm … HLK1 … HK11 ?) // -K1
+ lapply (drop_trans_ge_comm … HLK2 … HK22 ?) // -Hli -Hl0 -K2
+ /3 width=9 by llpx_sn_lref, yle_plus_dx1_trans/
+ ]
+| #K1 #K2 #l0 #i #HK1 #HK2 #HK12 #L1 #L2 #l #m #HLK1 #HLK2 #X #H #Hl0 elim (lift_inv_lref1 … H) -H
+ * #Hil #H destruct
+ lapply (drop_fwd_length_eq2 … HLK1 HLK2 HK12) -HK12
+ [ /3 width=7 by llpx_sn_free, drop_fwd_be/
+ | lapply (drop_fwd_length … HLK1) -HLK1 #HLK1
+ lapply (drop_fwd_length … HLK2) -HLK2 #HLK2
+ @llpx_sn_free [ >HLK1 | >HLK2 ] -Hil -HLK1 -HLK2 /2 width=1 by monotonic_le_plus_r/ (**) (* explicit constructor *)
+ ]
+| #K1 #K2 #l0 #p #HK12 #L1 #L2 #l #m #HLK1 #HLK2 #X #H #_ >(lift_inv_gref1 … H) -X
+ lapply (drop_fwd_length_eq2 … HLK1 HLK2 HK12) -K1 -K2 -l -m
+ /2 width=1 by llpx_sn_gref/
+| #a #I #K1 #K2 #V #T #l0 #_ #_ #IHV #IHT #L1 #L2 #l #m #HLK1 #HLK2 #X #H #Hl0 elim (lift_inv_bind1 … H) -H
+ #W #U #HVW #HTU #H destruct /4 width=6 by llpx_sn_bind, drop_skip, yle_succ/
+| #I #K1 #K2 #V #T #l0 #_ #_ #IHV #IHT #L1 #L2 #l #m #HLK1 #HLK2 #X #H #Hl0 elim (lift_inv_flat1 … H) -H
+ #W #U #HVW #HTU #H destruct /3 width=6 by llpx_sn_flat/
+]
+qed-.
+
+lemma llpx_sn_lift_ge: ∀R,K1,K2,T,l0. llpx_sn R l0 T K1 K2 →
+ ∀L1,L2,l,m. ⬇[Ⓕ, l, m] L1 ≡ K1 → ⬇[Ⓕ, l, m] L2 ≡ K2 →
+ ∀U. ⬆[l, m] T ≡ U → l ≤ l0 → llpx_sn R (l0+m) U L1 L2.
+#R #K1 #K2 #T #l0 #H elim H -K1 -K2 -T -l0
+[ #K1 #K2 #l0 #k #HK12 #L1 #L2 #l #m #HLK1 #HLK2 #X #H #_ >(lift_inv_sort1 … H) -X
+ lapply (drop_fwd_length_eq2 … HLK1 HLK2 HK12) -K1 -K2 -l
+ /2 width=1 by llpx_sn_sort/
+| #K1 #K2 #l0 #i #HK12 #Hil0 #L1 #L2 #l #m #HLK1 #HLK2 #X #H #_ elim (lift_inv_lref1 … H) -H
+ * #_ #H destruct
+ lapply (drop_fwd_length_eq2 … HLK1 HLK2 HK12) -K1 -K2
+ [ /3 width=3 by llpx_sn_skip, ylt_plus_dx2_trans/
+ | /3 width=3 by llpx_sn_skip, monotonic_ylt_plus_dx/
+ ]
+| #I #K1 #K2 #K11 #K22 #V1 #V2 #l0 #i #Hil0 #HK11 #HK22 #HK12 #HV12 #_ #L1 #L2 #l #m #HLK1 #HLK2 #X #H #Hl0 elim (lift_inv_lref1 … H) -H
+ * #Hil #H destruct
+ [ elim (ylt_yle_false … Hil0) -I -L1 -L2 -K1 -K2 -K11 -K22 -V1 -V2 -m -Hil0
+ /3 width=3 by ylt_yle_trans, ylt_inj/
+ | lapply (drop_trans_ge_comm … HLK1 … HK11 ?) // -K1
+ lapply (drop_trans_ge_comm … HLK2 … HK22 ?) // -Hil -Hl0 -K2
+ /3 width=9 by llpx_sn_lref, monotonic_yle_plus_dx/
+ ]
+| #K1 #K2 #l0 #i #HK1 #HK2 #HK12 #L1 #L2 #l #m #HLK1 #HLK2 #X #H #Hl0 elim (lift_inv_lref1 … H) -H
+ * #Hil #H destruct
+ lapply (drop_fwd_length_eq2 … HLK1 HLK2 HK12) -HK12
+ [ /3 width=7 by llpx_sn_free, drop_fwd_be/
+ | lapply (drop_fwd_length … HLK1) -HLK1 #HLK1
+ lapply (drop_fwd_length … HLK2) -HLK2 #HLK2
+ @llpx_sn_free [ >HLK1 | >HLK2 ] -Hil -HLK1 -HLK2 /2 width=1 by monotonic_le_plus_r/ (**) (* explicit constructor *)
+ ]
+| #K1 #K2 #l0 #p #HK12 #L1 #L2 #l #m #HLK1 #HLK2 #X #H #_ >(lift_inv_gref1 … H) -X
+ lapply (drop_fwd_length_eq2 … HLK1 HLK2 HK12) -K1 -K2 -l
+ /2 width=1 by llpx_sn_gref/
+| #a #I #K1 #K2 #V #T #l0 #_ #_ #IHV #IHT #L1 #L2 #l #m #HLK1 #HLK2 #X #H #Hl0 elim (lift_inv_bind1 … H) -H
+ #W #U #HVW #HTU #H destruct /4 width=5 by llpx_sn_bind, drop_skip, yle_succ/
+| #I #K1 #K2 #V #T #l0 #_ #_ #IHV #IHT #L1 #L2 #l #m #HLK1 #HLK2 #X #H #Hl0 elim (lift_inv_flat1 … H) -H
+ #W #U #HVW #HTU #H destruct /3 width=5 by llpx_sn_flat/
+]
+qed-.
+
+(* Inversion lemmas on relocation *******************************************)
+
+lemma llpx_sn_inv_lift_le: ∀R. d_deliftable_sn R →
+ ∀L1,L2,U,l0. llpx_sn R l0 U L1 L2 →
+ ∀K1,K2,l,m. ⬇[Ⓕ, l, m] L1 ≡ K1 → ⬇[Ⓕ, l, m] L2 ≡ K2 →
+ ∀T. ⬆[l, m] T ≡ U → l0 ≤ l → llpx_sn R l0 T K1 K2.
+#R #HR #L1 #L2 #U #l0 #H elim H -L1 -L2 -U -l0
+[ #L1 #L2 #l0 #k #HL12 #K1 #K2 #l #m #HLK1 #HLK2 #X #H #_ >(lift_inv_sort2 … H) -X
+ lapply (drop_fwd_length_eq1 … HLK1 HLK2 HL12) -L1 -L2 -l -m
+ /2 width=1 by llpx_sn_sort/
+| #L1 #L2 #l0 #i #HL12 #Hil0 #K1 #K2 #l #m #HLK1 #HLK2 #X #H #_ elim (lift_inv_lref2 … H) -H
+ * #_ #H destruct
+ lapply (drop_fwd_length_eq1 … HLK1 HLK2 HL12) -L1 -L2
+ [ /2 width=1 by llpx_sn_skip/
+ | /3 width=3 by llpx_sn_skip, yle_ylt_trans/
+ ]
+| #I #L1 #L2 #K11 #K22 #W1 #W2 #l0 #i #Hil0 #HLK11 #HLK22 #HK12 #HW12 #IHK12 #K1 #K2 #l #m #HLK1 #HLK2 #X #H #Hl0 elim (lift_inv_lref2 … H) -H
+ * #Hil #H destruct [ -HK12 | -IHK12 ]
+ [ elim (drop_conf_lt … HLK1 … HLK11) // -L1 #L1 #V1 #HKL1 #HKL11 #HVW1
+ elim (drop_conf_lt … HLK2 … HLK22) // -Hil -L2 #L2 #V2 #HKL2 #HKL22 #HVW2
+ elim (HR … HW12 … HKL11 … HVW1) -HR #V0 #HV0 #HV12
+ lapply (lift_inj … HV0 … HVW2) -HV0 -HVW2 #H destruct
+ /3 width=10 by llpx_sn_lref/
+ | lapply (drop_conf_ge … HLK1 … HLK11 ?) // -L1
+ lapply (drop_conf_ge … HLK2 … HLK22 ?) // -L2 -Hil0
+ elim (yle_inv_plus_inj2 … Hil) -Hil /4 width=9 by llpx_sn_lref, yle_trans, yle_inj/ (**) (* slow *)
+ ]
+| #L1 #L2 #l0 #i #HL1 #HL2 #HL12 #K1 #K2 #l #m #HLK1 #HLK2 #X #H #Hl0 elim (lift_inv_lref2 … H) -H
+ * #_ #H destruct
+ lapply (drop_fwd_length_eq1 … HLK1 HLK2 HL12)
+ [ lapply (drop_fwd_length_le4 … HLK1) -HLK1
+ lapply (drop_fwd_length_le4 … HLK2) -HLK2
+ #HKL2 #HKL1 #HK12 @llpx_sn_free // /2 width=3 by transitive_le/ (**) (* full auto too slow *)
+ | lapply (drop_fwd_length … HLK1) -HLK1 #H >H in HL1; -H
+ lapply (drop_fwd_length … HLK2) -HLK2 #H >H in HL2; -H
+ /3 width=1 by llpx_sn_free, le_plus_to_minus_r/
+ ]
+| #L1 #L2 #l0 #p #HL12 #K1 #K2 #l #m #HLK1 #HLK2 #X #H #_ >(lift_inv_gref2 … H) -X
+ lapply (drop_fwd_length_eq1 … HLK1 HLK2 HL12) -L1 -L2 -l -m
+ /2 width=1 by llpx_sn_gref/
+| #a #I #L1 #L2 #W #U #l0 #_ #_ #IHW #IHU #K1 #K2 #l #m #HLK1 #HLK2 #X #H #Hl0 elim (lift_inv_bind2 … H) -H
+ #V #T #HVW #HTU #H destruct /4 width=6 by llpx_sn_bind, drop_skip, yle_succ/
+| #I #L1 #L2 #W #U #l0 #_ #_ #IHW #IHU #K1 #K2 #l #m #HLK1 #HLK2 #X #H #Hl0 elim (lift_inv_flat2 … H) -H
+ #V #T #HVW #HTU #H destruct /3 width=6 by llpx_sn_flat/
+]
+qed-.
+
+lemma llpx_sn_inv_lift_be: ∀R,L1,L2,U,l0. llpx_sn R l0 U L1 L2 →
+ ∀K1,K2,l,m. ⬇[Ⓕ, l, m] L1 ≡ K1 → ⬇[Ⓕ, l, m] L2 ≡ K2 →
+ ∀T. ⬆[l, m] T ≡ U → l ≤ l0 → l0 ≤ l + m → llpx_sn R l T K1 K2.
+#R #L1 #L2 #U #l0 #H elim H -L1 -L2 -U -l0
+[ #L1 #L2 #l0 #k #HL12 #K1 #K2 #l #m #HLK1 #HLK2 #X #H #_ #_ >(lift_inv_sort2 … H) -X
+ lapply (drop_fwd_length_eq1 … HLK1 HLK2 HL12) -L1 -L2 -l0 -m
+ /2 width=1 by llpx_sn_sort/
+| #L1 #L2 #l0 #i #HL12 #Hil0 #K1 #K2 #l #m #HLK1 #HLK2 #X #H #Hl0 #Hl0m elim (lift_inv_lref2 … H) -H
+ * #Hil #H destruct
+ [ lapply (drop_fwd_length_eq1 … HLK1 HLK2 HL12) -L1 -L2
+ -Hil0 /3 width=1 by llpx_sn_skip, ylt_inj/
+ | elim (ylt_yle_false … Hil0) -L1 -L2 -Hl0 -Hil0
+ /3 width=3 by yle_trans, yle_inj/ (**) (* slow *)
+ ]
+| #I #L1 #L2 #K11 #K22 #W1 #W2 #l0 #i #Hil0 #HLK11 #HLK22 #HK12 #HW12 #_ #K1 #K2 #l #m #HLK1 #HLK2 #X #H #Hl0 #Hl0m elim (lift_inv_lref2 … H) -H
+ * #Hil #H destruct
+ [ elim (ylt_yle_false … Hil0) -I -L1 -L2 -K11 -K22 -W1 -W2 -Hl0m -Hil0
+ /3 width=3 by ylt_yle_trans, ylt_inj/
+ | lapply (drop_conf_ge … HLK1 … HLK11 ?) // -L1
+ lapply (drop_conf_ge … HLK2 … HLK22 ?) // -L2 -Hil0 -Hl0 -Hl0m
+ elim (yle_inv_plus_inj2 … Hil) -Hil /3 width=9 by llpx_sn_lref, yle_inj/
+ ]
+| #L1 #L2 #l0 #i #HL1 #HL2 #HL12 #K1 #K2 #l #m #HLK1 #HLK2 #X #H #Hl0 #Hl0m elim (lift_inv_lref2 … H) -H
+ * #_ #H destruct
+ lapply (drop_fwd_length_eq1 … HLK1 HLK2 HL12)
+ [ lapply (drop_fwd_length_le4 … HLK1) -HLK1
+ lapply (drop_fwd_length_le4 … HLK2) -HLK2
+ #HKL2 #HKL1 #HK12 @llpx_sn_free // /2 width=3 by transitive_le/ (**) (* full auto too slow *)
+ | lapply (drop_fwd_length … HLK1) -HLK1 #H >H in HL1; -H
+ lapply (drop_fwd_length … HLK2) -HLK2 #H >H in HL2; -H
+ /3 width=1 by llpx_sn_free, le_plus_to_minus_r/
+ ]
+| #L1 #L2 #l0 #p #HL12 #K1 #K2 #l #m #HLK1 #HLK2 #X #H #_ #_ >(lift_inv_gref2 … H) -X
+ lapply (drop_fwd_length_eq1 … HLK1 HLK2 HL12) -L1 -L2 -l0 -m
+ /2 width=1 by llpx_sn_gref/
+| #a #I #L1 #L2 #W #U #l0 #_ #_ #IHW #IHU #K1 #K2 #l #m #HLK1 #HLK2 #X #H #Hl0 #Hl0m elim (lift_inv_bind2 … H) -H
+ #V #T #HVW #HTU #H destruct
+ @llpx_sn_bind [ /2 width=5 by/ ] -IHW (**) (* explicit constructor *)
+ @(IHU … HTU) -IHU -HTU /2 width=1 by drop_skip, yle_succ/
+| #I #L1 #L2 #W #U #l0 #_ #_ #IHW #IHU #K1 #K2 #l #m #HLK1 #HLK2 #X #H #Hl0 #Hl0m elim (lift_inv_flat2 … H) -H
+ #V #T #HVW #HTU #H destruct /3 width=6 by llpx_sn_flat/
+]
+qed-.
+
+lemma llpx_sn_inv_lift_ge: ∀R,L1,L2,U,l0. llpx_sn R l0 U L1 L2 →
+ ∀K1,K2,l,m. ⬇[Ⓕ, l, m] L1 ≡ K1 → ⬇[Ⓕ, l, m] L2 ≡ K2 →
+ ∀T. ⬆[l, m] T ≡ U → l + m ≤ l0 → llpx_sn R (l0-m) T K1 K2.
+#R #L1 #L2 #U #l0 #H elim H -L1 -L2 -U -l0
+[ #L1 #L2 #l0 #k #HL12 #K1 #K2 #l #m #HLK1 #HLK2 #X #H #_ >(lift_inv_sort2 … H) -X
+ lapply (drop_fwd_length_eq1 … HLK1 HLK2 HL12) -L1 -L2 -l
+ /2 width=1 by llpx_sn_sort/
+| #L1 #L2 #l0 #i #HL12 #Hil0 #K1 #K2 #l #m #HLK1 #HLK2 #X #H #Hlml0 elim (lift_inv_lref2 … H) -H
+ * #Hil #H destruct [ -Hil0 | -Hlml0 ]
+ lapply (drop_fwd_length_eq1 … HLK1 HLK2 HL12) -L1 -L2
+ [ /4 width=3 by llpx_sn_skip, yle_plus1_to_minus_inj2, ylt_yle_trans, ylt_inj/
+ | elim (yle_inv_plus_inj2 … Hil) -Hil
+ /3 width=1 by llpx_sn_skip, monotonic_ylt_minus_dx/
+ ]
+| #I #L1 #L2 #K11 #K22 #W1 #W2 #l0 #i #Hil0 #HLK11 #HLK22 #HK12 #HW12 #_ #K1 #K2 #l #m #HLK1 #HLK2 #X #H #Hlml0 elim (lift_inv_lref2 … H) -H
+ * #Hil #H destruct
+ [ elim (ylt_yle_false … Hil0) -I -L1 -L2 -K11 -K22 -W1 -W2 -Hil0
+ /3 width=3 by yle_fwd_plus_sn1, ylt_yle_trans, ylt_inj/
+ | lapply (drop_conf_ge … HLK1 … HLK11 ?) // -L1
+ lapply (drop_conf_ge … HLK2 … HLK22 ?) // -L2 -Hlml0 -Hil
+ /3 width=9 by llpx_sn_lref, monotonic_yle_minus_dx/
+ ]
+| #L1 #L2 #l0 #i #HL1 #HL2 #HL12 #K1 #K2 #l #m #HLK1 #HLK2 #X #H #Hlml0 elim (lift_inv_lref2 … H) -H
+ * #_ #H destruct
+ lapply (drop_fwd_length_eq1 … HLK1 HLK2 HL12)
+ [ lapply (drop_fwd_length_le4 … HLK1) -HLK1
+ lapply (drop_fwd_length_le4 … HLK2) -HLK2
+ #HKL2 #HKL1 #HK12 @llpx_sn_free // /2 width=3 by transitive_le/ (**) (* full auto too slow *)
+ | lapply (drop_fwd_length … HLK1) -HLK1 #H >H in HL1; -H
+ lapply (drop_fwd_length … HLK2) -HLK2 #H >H in HL2; -H
+ /3 width=1 by llpx_sn_free, le_plus_to_minus_r/
+ ]
+| #L1 #L2 #l0 #p #HL12 #K1 #K2 #l #m #HLK1 #HLK2 #X #H #_ >(lift_inv_gref2 … H) -X
+ lapply (drop_fwd_length_eq1 … HLK1 HLK2 HL12) -L1 -L2 -l
+ /2 width=1 by llpx_sn_gref/
+| #a #I #L1 #L2 #W #U #l0 #_ #_ #IHW #IHU #K1 #K2 #l #m #HLK1 #HLK2 #X #H #Hlml0 elim (lift_inv_bind2 … H) -H
+ #V #T #HVW #HTU #H destruct
+ @llpx_sn_bind [ /2 width=5 by/ ] -IHW (**) (* explicit constructor *)
+ <yminus_succ1_inj /2 width=2 by yle_fwd_plus_sn2/
+ @(IHU … HTU) -IHU -HTU /2 width=1 by drop_skip, yle_succ/
+| #I #L1 #L2 #W #U #l0 #_ #_ #IHW #IHU #K1 #K2 #l #m #HLK1 #HLK2 #X #H #Hlml0 elim (lift_inv_flat2 … H) -H
+ #V #T #HVW #HTU #H destruct /3 width=5 by llpx_sn_flat/
+]
+qed-.
+
+(* Advanced inversion lemmas on relocation **********************************)
+
+lemma llpx_sn_inv_lift_O: ∀R,L1,L2,U. llpx_sn R 0 U L1 L2 →
+ ∀K1,K2,m. ⬇[m] L1 ≡ K1 → ⬇[m] L2 ≡ K2 →
+ ∀T. ⬆[0, m] T ≡ U → llpx_sn R 0 T K1 K2.
+/2 width=11 by llpx_sn_inv_lift_be/ qed-.
+
+lemma llpx_sn_drop_conf_O: ∀R,L1,L2,U. llpx_sn R 0 U L1 L2 →
+ ∀K1,m. ⬇[m] L1 ≡ K1 → ∀T. ⬆[0, m] T ≡ U →
+ ∃∃K2. ⬇[m] L2 ≡ K2 & llpx_sn R 0 T K1 K2.
+#R #L1 #L2 #U #HU #K1 #m #HLK1 #T #HTU elim (llpx_sn_fwd_drop_sn … HU … HLK1)
+/3 width=10 by llpx_sn_inv_lift_O, ex2_intro/
+qed-.
+
+lemma llpx_sn_drop_trans_O: ∀R,L1,L2,U. llpx_sn R 0 U L1 L2 →
+ ∀K2,m. ⬇[m] L2 ≡ K2 → ∀T. ⬆[0, m] T ≡ U →
+ ∃∃K1. ⬇[m] L1 ≡ K1 & llpx_sn R 0 T K1 K2.
+#R #L1 #L2 #U #HU #K2 #m #HLK2 #T #HTU elim (llpx_sn_fwd_drop_dx … HU … HLK2)
+/3 width=10 by llpx_sn_inv_lift_O, ex2_intro/
+qed-.
+
+(* Inversion lemmas on negated lazy pointwise extension *********************)
+
+lemma nllpx_sn_inv_bind: ∀R. (∀L,T1,T2. Decidable (R L T1 T2)) →
+ ∀a,I,L1,L2,V,T,l. (llpx_sn R l (ⓑ{a,I}V.T) L1 L2 → ⊥) →
+ (llpx_sn R l V L1 L2 → ⊥) ∨ (llpx_sn R (⫯l) T (L1.ⓑ{I}V) (L2.ⓑ{I}V) → ⊥).
+#R #HR #a #I #L1 #L2 #V #T #l #H elim (llpx_sn_dec … HR V L1 L2 l)
+/4 width=1 by llpx_sn_bind, or_intror, or_introl/
+qed-.
+
+lemma nllpx_sn_inv_flat: ∀R. (∀L,T1,T2. Decidable (R L T1 T2)) →
+ ∀I,L1,L2,V,T,l. (llpx_sn R l (ⓕ{I}V.T) L1 L2 → ⊥) →
+ (llpx_sn R l V L1 L2 → ⊥) ∨ (llpx_sn R l T L1 L2 → ⊥).
+#R #HR #I #L1 #L2 #V #T #l #H elim (llpx_sn_dec … HR V L1 L2 l)
+/4 width=1 by llpx_sn_flat, or_intror, or_introl/
+qed-.
+
+lemma nllpx_sn_inv_bind_O: ∀R. (∀L,T1,T2. Decidable (R L T1 T2)) →
+ ∀a,I,L1,L2,V,T. (llpx_sn R 0 (ⓑ{a,I}V.T) L1 L2 → ⊥) →
+ (llpx_sn R 0 V L1 L2 → ⊥) ∨ (llpx_sn R 0 T (L1.ⓑ{I}V) (L2.ⓑ{I}V) → ⊥).
+#R #HR #a #I #L1 #L2 #V #T #H elim (llpx_sn_dec … HR V L1 L2 0)
+/4 width=1 by llpx_sn_bind_O, or_intror, or_introl/
+qed-.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/multiple/frees.ma".
+include "basic_2/multiple/llpx_sn_alt_rec.ma".
+
+(* LAZY SN POINTWISE EXTENSION OF A CONTEXT-SENSITIVE REALTION FOR TERMS ****)
+
+(* Properties on context-sensitive free variables ***************************)
+
+fact llpx_sn_frees_trans_aux: ∀R. (s_r_confluent1 … R (llpx_sn R 0)) → (frees_trans R) →
+ ∀L2,U,l,i. L2 ⊢ i ϵ 𝐅*[l]⦃U⦄ →
+ ∀L1. llpx_sn R l U L1 L2 → L1 ⊢ i ϵ 𝐅*[l]⦃U⦄.
+#R #H1R #H2R #L2 #U #l #i #H elim H -L2 -U -l -i /3 width=2 by frees_eq/
+#I2 #L2 #K2 #U #W2 #l #i #j #Hlj #Hji #HnU #HLK2 #_ #IHW2 #L1 #HL12
+elim (llpx_sn_inv_alt_r … HL12) -HL12 #HL12 #IH
+lapply (drop_fwd_length_lt2 … HLK2) #Hj
+elim (drop_O1_lt (Ⓕ) L1 j) // -Hj -HL12 #I1 #K1 #W1 #HLK1
+elim (IH … HnU HLK1 HLK2) // -IH -HLK2 /5 width=11 by frees_be/
+qed-.
+
+lemma llpx_sn_frees_trans: ∀R. (s_r_confluent1 … R (llpx_sn R 0)) → (frees_trans R) →
+ ∀L1,L2,U,l. llpx_sn R l U L1 L2 →
+ ∀i. L2 ⊢ i ϵ 𝐅*[l]⦃U⦄ → L1 ⊢ i ϵ 𝐅*[l]⦃U⦄.
+/2 width=6 by llpx_sn_frees_trans_aux/ qed-.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/substitution/lpx_sn_alt.ma".
+include "basic_2/multiple/llor.ma".
+include "basic_2/multiple/lleq_alt.ma".
+
+(* LAZY SN POINTWISE EXTENSION OF A CONTEXT-SENSITIVE REALTION FOR TERMS ****)
+
+(* Inversion lemmas on pointwise union for local environments ****************)
+
+lemma llpx_sn_llor_fwd_sn: ∀R. (∀L. reflexive … (R L)) →
+ ∀L1,L2,T,l. llpx_sn R l T L1 L2 →
+ ∀L. L1 ⋓[T, l] L2 ≡ L → lpx_sn R L1 L.
+#R #HR #L1 #L2 #T #l #H1 #L #H2
+elim (llpx_sn_llpx_sn_alt … H1) -H1 #HL12 #IH1
+elim H2 -H2 #_ #HL1 #IH2
+@lpx_sn_intro_alt // #I1 #I #K1 #K #V1 #V #i #HLK1 #HLK
+lapply (drop_fwd_length_lt2 … HLK) #HiL
+elim (drop_O1_lt (Ⓕ) L2 i) // -HiL -HL1 -HL12 #I2 #K2 #V2 #HLK2
+elim (IH2 … HLK1 HLK2 HLK) -IH2 -HLK * /2 width=1 by conj/
+#HnT #H1 #H2 elim (IH1 … HnT … HLK1 HLK2) -IH1 -HnT -HLK1 -HLK2 /2 width=1 by conj/
+qed-.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/substitution/lpx_sn_drop.ma".
+include "basic_2/multiple/llpx_sn.ma".
+
+(* LAZY SN POINTWISE EXTENSION OF A CONTEXT-SENSITIVE REALTION FOR TERMS ****)
+
+(* Properties on pointwise extensions ***************************************)
+
+lemma lpx_sn_llpx_sn: ∀R. (∀L. reflexive … (R L)) →
+ ∀T,L1,L2,l. lpx_sn R L1 L2 → llpx_sn R l T L1 L2.
+#R #HR #T #L1 @(f2_ind … rfw … L1 T) -L1 -T
+#x #IH #L1 * *
+[ -HR -IH /4 width=2 by lpx_sn_fwd_length, llpx_sn_sort/
+| -HR #i elim (lt_or_ge i (|L1|))
+ [2: -IH /4 width=4 by lpx_sn_fwd_length, llpx_sn_free, le_repl_sn_conf_aux/ ]
+ #Hi #Hx #L2 #l elim (ylt_split i l)
+ [ -x /3 width=2 by llpx_sn_skip, lpx_sn_fwd_length/ ]
+ #Hli #HL12 elim (drop_O1_lt (Ⓕ) L1 i) //
+ #I #K1 #V1 #HLK1 elim (lpx_sn_drop_conf … HL12 … HLK1) -HL12
+ /4 width=9 by llpx_sn_lref, drop_fwd_rfw/
+| -HR -IH /4 width=2 by lpx_sn_fwd_length, llpx_sn_gref/
+| /4 width=1 by llpx_sn_bind, lpx_sn_pair/
+| -HR /3 width=1 by llpx_sn_flat/
+]
+qed.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/substitution/drop_lreq.ma".
+include "basic_2/multiple/llpx_sn.ma".
+
+(* LAZY SN POINTWISE EXTENSION OF A CONTEXT-SENSITIVE REALTION FOR TERMS ****)
+
+(* Properties on equivalence for local environments *************************)
+
+lemma lreq_llpx_sn_trans: ∀R,L2,L,T,l. llpx_sn R l T L2 L →
+ ∀L1. L1 ⩬[l, ∞] L2 → llpx_sn R l T L1 L.
+#R #L2 #L #T #l #H elim H -L2 -L -T -l
+/4 width=5 by llpx_sn_flat, llpx_sn_gref, llpx_sn_skip, llpx_sn_sort, lreq_fwd_length, trans_eq/
+[ #I #L2 #L #K2 #K #V2 #V #l #i #Hli #HLK2 #HLK #HK2 #HV2 #_ #L1 #HL12
+ elim (lreq_drop_trans_be … HL12 … HLK2) -L2 // >yminus_Y_inj #K1 #HK12 #HLK1
+ lapply (lreq_inv_O_Y … HK12) -HK12 #H destruct /2 width=9 by llpx_sn_lref/
+| /4 width=5 by llpx_sn_free, lreq_fwd_length, le_repl_sn_trans_aux, trans_eq/
+| /4 width=1 by llpx_sn_bind, lreq_succ/
+]
+qed-.
+
+lemma llpx_sn_lreq_trans: ∀R,L,L1,T,l. llpx_sn R l T L L1 →
+ ∀L2. L1 ⩬[l, ∞] L2 → llpx_sn R l T L L2.
+#R #L #L1 #T #l #H elim H -L -L1 -T -l
+/4 width=5 by llpx_sn_flat, llpx_sn_gref, llpx_sn_skip, llpx_sn_sort, lreq_fwd_length, trans_eq/
+[ #I #L #L1 #K #K1 #V #V1 #l #i #Hli #HLK #HLK1 #HK1 #HV1 #_ #L2 #HL12
+ elim (lreq_drop_conf_be … HL12 … HLK1) -L1 // >yminus_Y_inj #K2 #HK12 #HLK2
+ lapply (lreq_inv_O_Y … HK12) -HK12 #H destruct /2 width=9 by llpx_sn_lref/
+| /4 width=5 by llpx_sn_free, lreq_fwd_length, le_repl_sn_conf_aux, trans_eq/
+| /4 width=1 by llpx_sn_bind, lreq_succ/
+]
+qed-.
+
+lemma llpx_sn_lreq_repl: ∀R,L1,L2,T,l. llpx_sn R l T L1 L2 → ∀K1. K1 ⩬[l, ∞] L1 →
+ ∀K2. L2 ⩬[l, ∞] K2 → llpx_sn R l T K1 K2.
+/3 width=4 by llpx_sn_lreq_trans, lreq_llpx_sn_trans/ qed-.
+
+lemma llpx_sn_bind_repl_SO: ∀R,I1,I2,L1,L2,V1,V2,T. llpx_sn R 0 T (L1.ⓑ{I1}V1) (L2.ⓑ{I2}V2) →
+ ∀J1,J2,W1,W2. llpx_sn R 1 T (L1.ⓑ{J1}W1) (L2.ⓑ{J2}W2).
+#R #I1 #I2 #L1 #L2 #V1 #V2 #T #HT #J1 #J2 #W1 #W2 lapply (llpx_sn_ge R … 1 … HT) -HT
+/3 width=7 by llpx_sn_lreq_repl, lreq_succ/
+qed-.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/multiple/llpx_sn_drop.ma".
+
+(* LAZY SN POINTWISE EXTENSION OF A CONTEXT-SENSITIVE REALTION FOR TERMS ****)
+
+(* Properties about transitive closure **************************************)
+
+lemma llpx_sn_TC_pair_dx: ∀R. (∀L. reflexive … (R L)) →
+ ∀I,L,V1,V2,T. LTC … R L V1 V2 →
+ LTC … (llpx_sn R 0) T (L.ⓑ{I}V1) (L.ⓑ{I}V2).
+#R #HR #I #L #V1 #V2 #T #H @(TC_star_ind … V2 H) -V2
+/4 width=9 by llpx_sn_bind_repl_O, llpx_sn_refl, step, inj/
+qed.