--- /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/syntax/lenv.ma".
+
+(* CONTEXT-SENSITIVE EQUIVALENCES FOR TERMS *********************************)
+
+definition ceq: relation3 lenv term term ≝ λL,T1,T2. T1 = T2.
+
+definition cfull: relation3 lenv term term ≝ λL,T1,T2. ⊤.
+
+(* Basic properties *********************************************************)
+
+lemma ceq_refl (L): reflexive … (ceq L).
+// qed.
+
+lemma cfull_refl (L): reflexive … (cfull L).
+// qed.
+
+lemma ceq_sym (L): symmetric … (ceq L).
+// qed-.
+
+lemma cfull_sym (L): symmetric … (cfull L).
+// qed-.
+
+lemma cfull_top (R:relation3 lenv term term) (L) (T1) (T2):
+ R L T1 T2 → cfull L T1 T2.
+// qed-.
+
+lemma ceq_cfull (L) (T1) (T2): ceq L T1 T2 → cfull L T1 T2.
+// 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/syntax/ceq.ma".
+
+(* CONTEXT-SENSITIVE EQUIVALENCES FOR TERMS *********************************)
+
+(* Main properties **********************************************************)
+
+theorem ceq_trans (L): Transitive … (ceq L).
+// qed-.
+
+lemma ceq_canc_sn (L): left_cancellable … (ceq L).
+// qed-.
+
+lemma ceq_canc_dx (L): right_cancellable … (ceq L).
+// qed-.
+
+theorem cfull_trans (L): Transitive … (cfull L).
+// qed-.
+
+lemma cfull_canc_sn (L): left_cancellable … (cfull L).
+// qed-.
+
+lemma cfull_canc_dx (L): right_cancellable … (cfull L).
+// qed-.
\ No newline at end of file
--- /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/prednotreducible_3.ma".
+include "basic_2/reduction/crr.ma".
+
+(* IRREDUCIBLE TERMS FOR CONTEXT-SENSITIVE REDUCTION ************************)
+
+definition cir: relation3 genv lenv term ≝ λG,L,T. ⦃G, L⦄ ⊢ ➡ 𝐑⦃T⦄ → ⊥.
+
+interpretation "irreducibility for context-sensitive reduction (term)"
+ 'PRedNotReducible G L T = (cir G L T).
+
+(* Basic inversion lemmas ***************************************************)
+
+lemma cir_inv_delta: ∀G,L,K,V,i. ⬇[i] L ≡ K.ⓓV → ⦃G, L⦄ ⊢ ➡ 𝐈⦃#i⦄ → ⊥.
+/3 width=3 by crr_delta/ qed-.
+
+lemma cir_inv_ri2: ∀I,G,L,V,T. ri2 I → ⦃G, L⦄ ⊢ ➡ 𝐈⦃②{I}V.T⦄ → ⊥.
+/3 width=1 by crr_ri2/ qed-.
+
+lemma cir_inv_ib2: ∀a,I,G,L,V,T. ib2 a I → ⦃G, L⦄ ⊢ ➡ 𝐈⦃ⓑ{a,I}V.T⦄ →
+ ⦃G, L⦄ ⊢ ➡ 𝐈⦃V⦄ ∧ ⦃G, L.ⓑ{I}V⦄ ⊢ ➡ 𝐈⦃T⦄.
+/4 width=1 by crr_ib2_sn, crr_ib2_dx, conj/ qed-.
+
+lemma cir_inv_bind: ∀a,I,G,L,V,T. ⦃G, L⦄ ⊢ ➡ 𝐈⦃ⓑ{a,I}V.T⦄ →
+ ∧∧ ⦃G, L⦄ ⊢ ➡ 𝐈⦃V⦄ & ⦃G, L.ⓑ{I}V⦄ ⊢ ➡ 𝐈⦃T⦄ & ib2 a I.
+#a * [ elim a -a ]
+#G #L #V #T #H [ elim H -H /3 width=1 by crr_ri2, or_introl/ ]
+elim (cir_inv_ib2 … H) -H /3 width=1 by and3_intro, or_introl/
+qed-.
+
+lemma cir_inv_appl: ∀G,L,V,T. ⦃G, L⦄ ⊢ ➡ 𝐈⦃ⓐV.T⦄ →
+ ∧∧ ⦃G, L⦄ ⊢ ➡ 𝐈⦃V⦄ & ⦃G, L⦄ ⊢ ➡ 𝐈⦃T⦄ & 𝐒⦃T⦄.
+#G #L #V #T #HVT @and3_intro /3 width=1 by crr_appl_sn, crr_appl_dx/
+generalize in match HVT; -HVT elim T -T //
+* // #a * #U #T #_ #_ #H elim H -H /2 width=1 by crr_beta, crr_theta/
+qed-.
+
+lemma cir_inv_flat: ∀I,G,L,V,T. ⦃G, L⦄ ⊢ ➡ 𝐈⦃ⓕ{I}V.T⦄ →
+ ∧∧ ⦃G, L⦄ ⊢ ➡ 𝐈⦃V⦄ & ⦃G, L⦄ ⊢ ➡ 𝐈⦃T⦄ & 𝐒⦃T⦄ & I = Appl.
+* #G #L #V #T #H
+[ elim (cir_inv_appl … H) -H /2 width=1 by and4_intro/
+| elim (cir_inv_ri2 … H) -H //
+]
+qed-.
+
+(* Basic properties *********************************************************)
+
+lemma cir_sort: ∀G,L,s. ⦃G, L⦄ ⊢ ➡ 𝐈⦃⋆s⦄.
+/2 width=4 by crr_inv_sort/ qed.
+
+lemma cir_gref: ∀G,L,p. ⦃G, L⦄ ⊢ ➡ 𝐈⦃§p⦄.
+/2 width=4 by crr_inv_gref/ qed.
+
+lemma tir_atom: ∀G,I. ⦃G, ⋆⦄ ⊢ ➡ 𝐈⦃⓪{I}⦄.
+/2 width=3 by trr_inv_atom/ qed.
+
+lemma cir_ib2: ∀a,I,G,L,V,T.
+ ib2 a I → ⦃G, L⦄ ⊢ ➡ 𝐈⦃V⦄ → ⦃G, L.ⓑ{I}V⦄ ⊢ ➡ 𝐈⦃T⦄ → ⦃G, L⦄ ⊢ ➡ 𝐈⦃ⓑ{a,I}V.T⦄.
+#a #I #G #L #V #T #HI #HV #HT #H
+elim (crr_inv_ib2 … HI H) -HI -H /2 width=1 by/
+qed.
+
+lemma cir_appl: ∀G,L,V,T. ⦃G, L⦄ ⊢ ➡ 𝐈⦃V⦄ → ⦃G, L⦄ ⊢ ➡ 𝐈⦃T⦄ → 𝐒⦃T⦄ → ⦃G, L⦄ ⊢ ➡ 𝐈⦃ⓐV.T⦄.
+#G #L #V #T #HV #HT #H1 #H2
+elim (crr_inv_appl … H2) -H2 /2 width=1 by/
+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/reduction/crr_lift.ma".
+include "basic_2/reduction/cir.ma".
+
+(* IRREDUCIBLE TERMS FOR CONTEXT-SENSITIVE REDUCTION ************************)
+
+(* Properties on relocation *************************************************)
+
+lemma cir_lift: ∀G,K,T. ⦃G, K⦄ ⊢ ➡ 𝐈⦃T⦄ → ∀L,c,l,k. ⬇[c, l, k] L ≡ K →
+ ∀U. ⬆[l, k] T ≡ U → ⦃G, L⦄ ⊢ ➡ 𝐈⦃U⦄.
+/3 width=8 by crr_inv_lift/ qed.
+
+lemma cir_inv_lift: ∀G,L,U. ⦃G, L⦄ ⊢ ➡ 𝐈⦃U⦄ → ∀K,c,l,k. ⬇[c, l, k] L ≡ K →
+ ∀T. ⬆[l, k] T ≡ U → ⦃G, K⦄ ⊢ ➡ 𝐈⦃T⦄.
+/3 width=8 by crr_lift/ 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 *)
+(* *)
+(**************************************************************************)
+
+(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
+
+notation "hvbox( ⦃ term 46 G , break term 46 L ⦄ ⊢ ➡ 𝐈 break ⦃ term 46 T ⦄ )"
+ non associative with precedence 45
+ for @{ 'PRedNotReducible $G $L $T }.
--- /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/prednotreducible_5.ma".
+include "basic_2/reduction/cir.ma".
+include "basic_2/reduction/crx.ma".
+
+(* IRREDUCIBLE TERMS FOR CONTEXT-SENSITIVE EXTENDED REDUCTION ***************)
+
+definition cix: ∀h. sd h → relation3 genv lenv term ≝
+ λh,o,G,L,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃T⦄ → ⊥.
+
+interpretation "irreducibility for context-sensitive extended reduction (term)"
+ 'PRedNotReducible h o G L T = (cix h o G L T).
+
+(* Basic inversion lemmas ***************************************************)
+
+lemma cix_inv_sort: ∀h,o,G,L,s,d. deg h o s (d+1) → ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃⋆s⦄ → ⊥.
+/3 width=2 by crx_sort/ qed-.
+
+lemma cix_inv_delta: ∀h,o,I,G,L,K,V,i. ⬇[i] L ≡ K.ⓑ{I}V → ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃#i⦄ → ⊥.
+/3 width=4 by crx_delta/ qed-.
+
+lemma cix_inv_ri2: ∀h,o,I,G,L,V,T. ri2 I → ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃②{I}V.T⦄ → ⊥.
+/3 width=1 by crx_ri2/ qed-.
+
+lemma cix_inv_ib2: ∀h,o,a,I,G,L,V,T. ib2 a I → ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃ⓑ{a,I}V.T⦄ →
+ ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃V⦄ ∧ ⦃G, L.ⓑ{I}V⦄ ⊢ ➡[h, o] 𝐈⦃T⦄.
+/4 width=1 by crx_ib2_sn, crx_ib2_dx, conj/ qed-.
+
+lemma cix_inv_bind: ∀h,o,a,I,G,L,V,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃ⓑ{a,I}V.T⦄ →
+ ∧∧ ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃V⦄ & ⦃G, L.ⓑ{I}V⦄ ⊢ ➡[h, o] 𝐈⦃T⦄ & ib2 a I.
+#h #o #a * [ elim a -a ]
+#G #L #V #T #H [ elim H -H /3 width=1 by crx_ri2, or_introl/ ]
+elim (cix_inv_ib2 … H) -H /3 width=1 by and3_intro, or_introl/
+qed-.
+
+lemma cix_inv_appl: ∀h,o,G,L,V,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃ⓐV.T⦄ →
+ ∧∧ ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃V⦄ & ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃T⦄ & 𝐒⦃T⦄.
+#h #o #G #L #V #T #HVT @and3_intro /3 width=1 by crx_appl_sn, crx_appl_dx/
+generalize in match HVT; -HVT elim T -T //
+* // #a * #U #T #_ #_ #H elim H -H /2 width=1 by crx_beta, crx_theta/
+qed-.
+
+lemma cix_inv_flat: ∀h,o,I,G,L,V,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃ⓕ{I}V.T⦄ →
+ ∧∧ ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃V⦄ & ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃T⦄ & 𝐒⦃T⦄ & I = Appl.
+#h #o * #G #L #V #T #H
+[ elim (cix_inv_appl … H) -H /2 width=1 by and4_intro/
+| elim (cix_inv_ri2 … H) -H //
+]
+qed-.
+
+(* Basic forward lemmas *****************************************************)
+
+lemma cix_inv_cir: ∀h,o,G,L,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃T⦄ → ⦃G, L⦄ ⊢ ➡ 𝐈⦃T⦄.
+/3 width=1 by crr_crx/ qed-.
+
+(* Basic properties *********************************************************)
+
+lemma cix_sort: ∀h,o,G,L,s. deg h o s 0 → ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃⋆s⦄.
+#h #o #G #L #s #Hk #H elim (crx_inv_sort … H) -L #d #Hkd
+lapply (deg_mono … Hk Hkd) -h -s <plus_n_Sm #H destruct
+qed.
+
+lemma tix_lref: ∀h,o,G,i. ⦃G, ⋆⦄ ⊢ ➡[h, o] 𝐈⦃#i⦄.
+#h #o #G #i #H elim (trx_inv_atom … H) -H #s #d #_ #H destruct
+qed.
+
+lemma cix_gref: ∀h,o,G,L,p. ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃§p⦄.
+#h #o #G #L #p #H elim (crx_inv_gref … H)
+qed.
+
+lemma cix_ib2: ∀h,o,a,I,G,L,V,T. ib2 a I → ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃V⦄ → ⦃G, L.ⓑ{I}V⦄ ⊢ ➡[h, o] 𝐈⦃T⦄ →
+ ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃ⓑ{a,I}V.T⦄.
+#h #o #a #I #G #L #V #T #HI #HV #HT #H
+elim (crx_inv_ib2 … HI H) -HI -H /2 width=1 by/
+qed.
+
+lemma cix_appl: ∀h,o,G,L,V,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃V⦄ → ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃T⦄ → 𝐒⦃T⦄ → ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃ⓐV.T⦄.
+#h #o #G #L #V #T #HV #HT #H1 #H2
+elim (crx_inv_appl … H2) -H2 /2 width=1 by/
+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/reduction/crx_lift.ma".
+include "basic_2/reduction/cix.ma".
+
+(* IRREDUCIBLE TERMS FOR CONTEXT-SENSITIVE EXTENDED REDUCTION ***************)
+
+(* Advanced properties ******************************************************)
+
+lemma cix_lref: ∀h,o,G,L,i. ⬇[i] L ≡ ⋆ → ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃#i⦄.
+#h #o #G #L #i #HL #H elim (crx_inv_lref … H) -h #I #K #V #HLK
+lapply (drop_mono … HLK … HL) -L -i #H destruct
+qed.
+
+(* Properties on relocation *************************************************)
+
+lemma cix_lift: ∀h,o,G,K,T. ⦃G, K⦄ ⊢ ➡[h, o] 𝐈⦃T⦄ → ∀L,c,l,k. ⬇[c, l, k] L ≡ K →
+ ∀U. ⬆[l, k] T ≡ U → ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃U⦄.
+/3 width=8 by crx_inv_lift/ qed.
+
+lemma cix_inv_lift: ∀h,o,G,L,U. ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃U⦄ → ∀K,c,l,k. ⬇[c, l, k] L ≡ K →
+ ∀T. ⬆[l, k] T ≡ U → ⦃G, K⦄ ⊢ ➡[h, o] 𝐈⦃T⦄.
+/3 width=8 by crx_lift/ 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 *)
+(* *)
+(**************************************************************************)
+
+(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
+
+notation "hvbox( ⦃ term 46 G, break term 46 L ⦄ ⊢ ➡ break [ term 46 o , break term 46 h ] 𝐈 break ⦃ term 46 T ⦄ )"
+ non associative with precedence 45
+ for @{ 'PRedNotReducible $h $o $G $L $T }.
--- /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/prednormal_3.ma".
+include "basic_2/reduction/cpr.ma".
+
+(* NORMAL TERMS FOR CONTEXT-SENSITIVE REDUCTION *****************************)
+
+definition cnr: relation3 genv lenv term ≝ λG,L. NF … (cpr G L) (eq …).
+
+interpretation
+ "normality for context-sensitive reduction (term)"
+ 'PRedNormal G L T = (cnr G L T).
+
+(* Basic inversion lemmas ***************************************************)
+
+lemma cnr_inv_delta: ∀G,L,K,V,i. ⬇[i] L ≡ K.ⓓV → ⦃G, L⦄ ⊢ ➡ 𝐍⦃#i⦄ → ⊥.
+#G #L #K #V #i #HLK #H
+elim (lift_total V 0 (i+1)) #W #HVW
+lapply (H W ?) -H [ /3 width=6 by cpr_delta/ ] -HLK #H destruct
+elim (lift_inv_lref2_be … HVW) -HVW /2 width=1 by ylt_inj/
+qed-.
+
+lemma cnr_inv_abst: ∀a,G,L,V,T. ⦃G, L⦄ ⊢ ➡ 𝐍⦃ⓛ{a}V.T⦄ → ⦃G, L⦄ ⊢ ➡ 𝐍⦃V⦄ ∧ ⦃G, L.ⓛV⦄ ⊢ ➡ 𝐍⦃T⦄.
+#a #G #L #V1 #T1 #HVT1 @conj
+[ #V2 #HV2 lapply (HVT1 (ⓛ{a}V2.T1) ?) -HVT1 /2 width=2 by cpr_pair_sn/ -HV2 #H destruct //
+| #T2 #HT2 lapply (HVT1 (ⓛ{a}V1.T2) ?) -HVT1 /2 width=2 by cpr_bind/ -HT2 #H destruct //
+]
+qed-.
+
+lemma cnr_inv_abbr: ∀G,L,V,T. ⦃G, L⦄ ⊢ ➡ 𝐍⦃-ⓓV.T⦄ → ⦃G, L⦄ ⊢ ➡ 𝐍⦃V⦄ ∧ ⦃G, L.ⓓV⦄ ⊢ ➡ 𝐍⦃T⦄.
+#G #L #V1 #T1 #HVT1 @conj
+[ #V2 #HV2 lapply (HVT1 (-ⓓV2.T1) ?) -HVT1 /2 width=2 by cpr_pair_sn/ -HV2 #H destruct //
+| #T2 #HT2 lapply (HVT1 (-ⓓV1.T2) ?) -HVT1 /2 width=2 by cpr_bind/ -HT2 #H destruct //
+]
+qed-.
+
+lemma cnr_inv_zeta: ∀G,L,V,T. ⦃G, L⦄ ⊢ ➡ 𝐍⦃+ⓓV.T⦄ → ⊥.
+#G #L #V #T #H elim (is_lift_dec T 0 1)
+[ * #U #HTU
+ lapply (H U ?) -H /2 width=3 by cpr_zeta/ #H destruct
+ elim (lift_inv_pair_xy_y … HTU)
+| #HT
+ elim (cpr_delift G (⋆) V T (⋆. ⓓV) 0) //
+ #T2 #T1 #HT2 #HT12 lapply (H (+ⓓV.T2) ?) -H /4 width=1 by tpr_cpr, cpr_bind/ -HT2
+ #H destruct /3 width=2 by ex_intro/
+]
+qed-.
+
+lemma cnr_inv_appl: ∀G,L,V,T. ⦃G, L⦄ ⊢ ➡ 𝐍⦃ⓐV.T⦄ → ∧∧ ⦃G, L⦄ ⊢ ➡ 𝐍⦃V⦄ & ⦃G, L⦄ ⊢ ➡ 𝐍⦃T⦄ & 𝐒⦃T⦄.
+#G #L #V1 #T1 #HVT1 @and3_intro
+[ #V2 #HV2 lapply (HVT1 (ⓐV2.T1) ?) -HVT1 /2 width=1 by cpr_pair_sn/ -HV2 #H destruct //
+| #T2 #HT2 lapply (HVT1 (ⓐV1.T2) ?) -HVT1 /2 width=1 by cpr_flat/ -HT2 #H destruct //
+| generalize in match HVT1; -HVT1 elim T1 -T1 * // #a * #W1 #U1 #_ #_ #H
+ [ elim (lift_total V1 0 1) #V2 #HV12
+ lapply (H (ⓓ{a}W1.ⓐV2.U1) ?) -H /3 width=3 by tpr_cpr, cpr_theta/ -HV12 #H destruct
+ | lapply (H (ⓓ{a}ⓝW1.V1.U1) ?) -H /3 width=1 by tpr_cpr, cpr_beta/ #H destruct
+]
+qed-.
+
+lemma cnr_inv_eps: ∀G,L,V,T. ⦃G, L⦄ ⊢ ➡ 𝐍⦃ⓝV.T⦄ → ⊥.
+#G #L #V #T #H lapply (H T ?) -H
+/2 width=4 by cpr_eps, discr_tpair_xy_y/
+qed-.
+
+(* Basic properties *********************************************************)
+
+(* Basic_1: was: nf2_sort *)
+lemma cnr_sort: ∀G,L,s. ⦃G, L⦄ ⊢ ➡ 𝐍⦃⋆s⦄.
+#G #L #s #X #H
+>(cpr_inv_sort1 … H) //
+qed.
+
+lemma cnr_lref_free: ∀G,L,i. |L| ≤ i → ⦃G, L⦄ ⊢ ➡ 𝐍⦃#i⦄.
+#G #L #i #Hi #X #H elim (cpr_inv_lref1 … H) -H // *
+#K #V1 #V2 #HLK lapply (drop_fwd_length_lt2 … HLK) -HLK
+#H elim (lt_refl_false i) /2 width=3 by lt_to_le_to_lt/
+qed.
+
+(* Basic_1: was only: nf2_csort_lref *)
+lemma cnr_lref_atom: ∀G,L,i. ⬇[i] L ≡ ⋆ → ⦃G, L⦄ ⊢ ➡ 𝐍⦃#i⦄.
+#G #L #i #HL @cnr_lref_free >(drop_fwd_length … HL) -HL //
+qed.
+
+(* Basic_1: was: nf2_abst *)
+lemma cnr_abst: ∀a,G,L,W,T. ⦃G, L⦄ ⊢ ➡ 𝐍⦃W⦄ → ⦃G, L.ⓛW⦄ ⊢ ➡ 𝐍⦃T⦄ → ⦃G, L⦄ ⊢ ➡ 𝐍⦃ⓛ{a}W.T⦄.
+#a #G #L #W #T #HW #HT #X #H
+elim (cpr_inv_abst1 … H) -H #W0 #T0 #HW0 #HT0 #H destruct
+>(HW … HW0) -W0 >(HT … HT0) -T0 //
+qed.
+
+(* Basic_1: was only: nf2_appl_lref *)
+lemma cnr_appl_simple: ∀G,L,V,T. ⦃G, L⦄ ⊢ ➡ 𝐍⦃V⦄ → ⦃G, L⦄ ⊢ ➡ 𝐍⦃T⦄ → 𝐒⦃T⦄ → ⦃G, L⦄ ⊢ ➡ 𝐍⦃ⓐV.T⦄.
+#G #L #V #T #HV #HT #HS #X #H
+elim (cpr_inv_appl1_simple … H) -H // #V0 #T0 #HV0 #HT0 #H destruct
+>(HV … HV0) -V0 >(HT … HT0) -T0 //
+qed.
+
+(* Basic_1: was: nf2_dec *)
+axiom cnr_dec: ∀G,L,T1. ⦃G, L⦄ ⊢ ➡ 𝐍⦃T1⦄ ∨
+ ∃∃T2. ⦃G, L⦄ ⊢ T1 ➡ T2 & (T1 = T2 → ⊥).
+
+(* Basic_1: removed theorems 1: nf2_abst_shift *)
--- /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/reduction/cpr_cir.ma".
+include "basic_2/reduction/cnr_crr.ma".
+
+(* NORMAL TERMS FOR CONTEXT-SENSITIVE REDUCTION *****************************)
+
+(* Main properties on irreducibility ****************************************)
+
+theorem cir_cnr: ∀G,L,T. ⦃G, L⦄ ⊢ ➡ 𝐈⦃T⦄ → ⦃G, L⦄ ⊢ ➡ 𝐍⦃T⦄.
+/2 width=4 by cpr_fwd_cir/ qed.
+
+(* Main inversion lemmas on irreducibility **********************************)
+
+theorem cnr_inv_cir: ∀G,L,T. ⦃G, L⦄ ⊢ ➡ 𝐍⦃T⦄ → ⦃G, L⦄ ⊢ ➡ 𝐈⦃T⦄.
+/2 width=5 by cnr_inv_crr/ 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/reduction/crr.ma".
+include "basic_2/reduction/cnr.ma".
+
+(* NORMAL TERMS FOR CONTEXT-SENSITIVE REDUCTION *****************************)
+
+(* Advanced inversion lemmas on reducibility ********************************)
+
+(* Note: this property is unusual *)
+lemma cnr_inv_crr: ∀G,L,T. ⦃G, L⦄ ⊢ ➡ 𝐑⦃T⦄ → ⦃G, L⦄ ⊢ ➡ 𝐍⦃T⦄ → ⊥.
+#G #L #T #H elim H -L -T
+[ #L #K #V #i #HLK #H
+ elim (cnr_inv_delta … HLK H)
+| #L #V #T #_ #IHV #H
+ elim (cnr_inv_appl … H) -H /2 width=1 by/
+| #L #V #T #_ #IHT #H
+ elim (cnr_inv_appl … H) -H /2 width=1 by/
+| #I #L #V #T * #H1 #H2 destruct
+ [ elim (cnr_inv_zeta … H2)
+ | elim (cnr_inv_eps … H2)
+ ]
+|5,6: #a * [ elim a ] #L #V #T * #H1 #_ #IH #H2 destruct
+ [1,3: elim (cnr_inv_abbr … H2) -H2 /2 width=1 by/
+ |*: elim (cnr_inv_abst … H2) -H2 /2 width=1 by/
+ ]
+| #a #L #V #W #T #H
+ elim (cnr_inv_appl … H) -H #_ #_ #H
+ elim (simple_inv_bind … H)
+| #a #L #V #W #T #H
+ elim (cnr_inv_appl … H) -H #_ #_ #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/reduction/cpr_lift.ma".
+include "basic_2/reduction/cnr.ma".
+
+(* NORMAL TERMS FOR CONTEXT-SENSITIVE REDUCTION *****************************)
+
+(* Advanced properties ******************************************************)
+
+(* Basic_1: was: nf2_lref_abst *)
+lemma cnr_lref_abst: ∀G,L,K,V,i. ⬇[i] L ≡ K. ⓛV → ⦃G, L⦄ ⊢ ➡ 𝐍⦃#i⦄.
+#G #L #K #V #i #HLK #X #H
+elim (cpr_inv_lref1 … H) -H // *
+#K0 #V1 #V2 #HLK0 #_ #_
+lapply (drop_mono … HLK … HLK0) -L #H destruct
+qed.
+
+(* Relocation properties ****************************************************)
+
+(* Basic_1: was: nf2_lift *)
+lemma cnr_lift: ∀G,L0,L,T,T0,c,l,k. ⦃G, L⦄ ⊢ ➡ 𝐍⦃T⦄ →
+ ⬇[c, l, k] L0 ≡ L → ⬆[l, k] T ≡ T0 → ⦃G, L0⦄ ⊢ ➡ 𝐍⦃T0⦄.
+#G #L0 #L #T #T0 #c #l #k #HLT #HL0 #HT0 #X #H
+elim (cpr_inv_lift1 … H … HL0 … HT0) -L0 #T1 #HT10 #HT1
+<(HLT … HT1) in HT0; -L #HT0
+>(lift_mono … HT10 … HT0) -T1 -X //
+qed.
+
+(* Note: this was missing in basic_1 *)
+lemma cnr_inv_lift: ∀G,L0,L,T,T0,c,l,k. ⦃G, L0⦄ ⊢ ➡ 𝐍⦃T0⦄ →
+ ⬇[c, l, k] L0 ≡ L → ⬆[l, k] T ≡ T0 → ⦃G, L⦄ ⊢ ➡ 𝐍⦃T⦄.
+#G #L0 #L #T #T0 #c #l #k #HLT0 #HL0 #HT0 #X #H
+elim (lift_total X l k) #X0 #HX0
+lapply (cpr_lift … H … HL0 … HT0 … HX0) -L #HTX0
+>(HLT0 … HTX0) in HX0; -L0 -X0 #H
+>(lift_inj … H … HT0) -T0 -X -c -l -k //
+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 *)
+(* *)
+(**************************************************************************)
+
+(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
+
+notation "hvbox( ⦃ term 46 G , break term 46 L ⦄ ⊢ ➡ 𝐍 break ⦃ term 46 T ⦄ )"
+ non associative with precedence 45
+ for @{ 'PRedNormal $G $L $T }.
--- /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/prednormal_5.ma".
+include "basic_2/reduction/cnr.ma".
+include "basic_2/reduction/cpx.ma".
+
+(* NORMAL TERMS FOR CONTEXT-SENSITIVE EXTENDED REDUCTION ********************)
+
+definition cnx: ∀h. sd h → relation3 genv lenv term ≝
+ λh,o,G,L. NF … (cpx h o G L) (eq …).
+
+interpretation
+ "normality for context-sensitive extended reduction (term)"
+ 'PRedNormal h o L T = (cnx h o L T).
+
+(* Basic inversion lemmas ***************************************************)
+
+lemma cnx_inv_sort: ∀h,o,G,L,s. ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃⋆s⦄ → deg h o s 0.
+#h #o #G #L #s #H elim (deg_total h o s)
+#d @(nat_ind_plus … d) -d // #d #_ #Hkd
+lapply (H (⋆(next h s)) ?) -H /2 width=2 by cpx_st/ -L -d #H
+lapply (destruct_tatom_tatom_aux … H) -H #H (**) (* destruct lemma needed *)
+lapply (destruct_sort_sort_aux … H) -H #H (**) (* destruct lemma needed *)
+lapply (next_lt h s) >H -H #H elim (lt_refl_false … H)
+qed-.
+
+lemma cnx_inv_delta: ∀h,o,I,G,L,K,V,i. ⬇[i] L ≡ K.ⓑ{I}V → ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃#i⦄ → ⊥.
+#h #o #I #G #L #K #V #i #HLK #H
+elim (lift_total V 0 (i+1)) #W #HVW
+lapply (H W ?) -H [ /3 width=7 by cpx_delta/ ] -HLK #H destruct
+elim (lift_inv_lref2_be … HVW) -HVW /2 width=1 by ylt_inj/
+qed-.
+
+lemma cnx_inv_abst: ∀h,o,a,G,L,V,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃ⓛ{a}V.T⦄ →
+ ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃V⦄ ∧ ⦃G, L.ⓛV⦄ ⊢ ➡[h, o] 𝐍⦃T⦄.
+#h #o #a #G #L #V1 #T1 #HVT1 @conj
+[ #V2 #HV2 lapply (HVT1 (ⓛ{a}V2.T1) ?) -HVT1 /2 width=2 by cpx_pair_sn/ -HV2 #H destruct //
+| #T2 #HT2 lapply (HVT1 (ⓛ{a}V1.T2) ?) -HVT1 /2 width=2 by cpx_bind/ -HT2 #H destruct //
+]
+qed-.
+
+lemma cnx_inv_abbr: ∀h,o,G,L,V,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃-ⓓV.T⦄ →
+ ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃V⦄ ∧ ⦃G, L.ⓓV⦄ ⊢ ➡[h, o] 𝐍⦃T⦄.
+#h #o #G #L #V1 #T1 #HVT1 @conj
+[ #V2 #HV2 lapply (HVT1 (-ⓓV2.T1) ?) -HVT1 /2 width=2 by cpx_pair_sn/ -HV2 #H destruct //
+| #T2 #HT2 lapply (HVT1 (-ⓓV1.T2) ?) -HVT1 /2 width=2 by cpx_bind/ -HT2 #H destruct //
+]
+qed-.
+
+lemma cnx_inv_zeta: ∀h,o,G,L,V,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃+ⓓV.T⦄ → ⊥.
+#h #o #G #L #V #T #H elim (is_lift_dec T 0 1)
+[ * #U #HTU
+ lapply (H U ?) -H /2 width=3 by cpx_zeta/ #H destruct
+ elim (lift_inv_pair_xy_y … HTU)
+| #HT
+ elim (cpr_delift G(⋆) V T (⋆.ⓓV) 0) // #T2 #T1 #HT2 #HT12
+ lapply (H (+ⓓV.T2) ?) -H /5 width=1 by cpr_cpx, tpr_cpr, cpr_bind/ -HT2
+ #H destruct /3 width=2 by ex_intro/
+]
+qed-.
+
+lemma cnx_inv_appl: ∀h,o,G,L,V,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃ⓐV.T⦄ →
+ ∧∧ ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃V⦄ & ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃T⦄ & 𝐒⦃T⦄.
+#h #o #G #L #V1 #T1 #HVT1 @and3_intro
+[ #V2 #HV2 lapply (HVT1 (ⓐV2.T1) ?) -HVT1 /2 width=1 by cpx_pair_sn/ -HV2 #H destruct //
+| #T2 #HT2 lapply (HVT1 (ⓐV1.T2) ?) -HVT1 /2 width=1 by cpx_flat/ -HT2 #H destruct //
+| generalize in match HVT1; -HVT1 elim T1 -T1 * // #a * #W1 #U1 #_ #_ #H
+ [ elim (lift_total V1 0 1) #V2 #HV12
+ lapply (H (ⓓ{a}W1.ⓐV2.U1) ?) -H /3 width=3 by cpr_cpx, cpr_theta/ -HV12 #H destruct
+ | lapply (H (ⓓ{a}ⓝW1.V1.U1) ?) -H /3 width=1 by cpr_cpx, cpr_beta/ #H destruct
+ ]
+]
+qed-.
+
+lemma cnx_inv_eps: ∀h,o,G,L,V,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃ⓝV.T⦄ → ⊥.
+#h #o #G #L #V #T #H lapply (H T ?) -H
+/2 width=4 by cpx_eps, discr_tpair_xy_y/
+qed-.
+
+(* Basic forward lemmas *****************************************************)
+
+lemma cnx_fwd_cnr: ∀h,o,G,L,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃T⦄ → ⦃G, L⦄ ⊢ ➡ 𝐍⦃T⦄.
+#h #o #G #L #T #H #U #HTU
+@H /2 width=1 by cpr_cpx/ (**) (* auto fails because a δ-expansion gets in the way *)
+qed-.
+
+(* Basic properties *********************************************************)
+
+lemma cnx_sort: ∀h,o,G,L,s. deg h o s 0 → ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃⋆s⦄.
+#h #o #G #L #s #Hk #X #H elim (cpx_inv_sort1 … H) -H // * #d #Hkd #_
+lapply (deg_mono … Hkd Hk) -h -L <plus_n_Sm #H destruct
+qed.
+
+lemma cnx_sort_iter: ∀h,o,G,L,s,d. deg h o s d → ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃⋆((next h)^d s)⦄.
+#h #o #G #L #s #d #Hkd
+lapply (deg_iter … d Hkd) -Hkd <minus_n_n /2 width=6 by cnx_sort/
+qed.
+
+lemma cnx_lref_free: ∀h,o,G,L,i. |L| ≤ i → ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃#i⦄.
+#h #o #G #L #i #Hi #X #H elim (cpx_inv_lref1 … H) -H // *
+#I #K #V1 #V2 #HLK lapply (drop_fwd_length_lt2 … HLK) -HLK
+#H elim (lt_refl_false i) /2 width=3 by lt_to_le_to_lt/
+qed.
+
+lemma cnx_lref_atom: ∀h,o,G,L,i. ⬇[i] L ≡ ⋆ → ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃#i⦄.
+#h #o #G #L #i #HL @cnx_lref_free >(drop_fwd_length … HL) -HL //
+qed.
+
+lemma cnx_abst: ∀h,o,a,G,L,W,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃W⦄ → ⦃G, L.ⓛW⦄ ⊢ ➡[h, o] 𝐍⦃T⦄ →
+ ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃ⓛ{a}W.T⦄.
+#h #o #a #G #L #W #T #HW #HT #X #H
+elim (cpx_inv_abst1 … H) -H #W0 #T0 #HW0 #HT0 #H destruct
+>(HW … HW0) -W0 >(HT … HT0) -T0 //
+qed.
+
+lemma cnx_appl_simple: ∀h,o,G,L,V,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃V⦄ → ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃T⦄ → 𝐒⦃T⦄ →
+ ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃ⓐV.T⦄.
+#h #o #G #L #V #T #HV #HT #HS #X #H
+elim (cpx_inv_appl1_simple … H) -H // #V0 #T0 #HV0 #HT0 #H destruct
+>(HV … HV0) -V0 >(HT … HT0) -T0 //
+qed.
+
+axiom cnx_dec: ∀h,o,G,L,T1. ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃T1⦄ ∨
+ ∃∃T2. ⦃G, L⦄ ⊢ T1 ➡[h, o] T2 & (T1 = T2 → ⊥).
--- /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/reduction/cpx_cix.ma".
+include "basic_2/reduction/cnx_crx.ma".
+
+(* NORMAL TERMS FOR CONTEXT-SENSITIVE EXTENDED REDUCTION ********************)
+
+(* Main properties on irreducibility ****************************************)
+
+theorem cix_cnx: ∀h,o,G,L,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃T⦄ → ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃T⦄.
+/2 width=6 by cpx_fwd_cix/ qed.
+
+(* Main inversion lemmas on irreducibility **********************************)
+
+theorem cnx_inv_cix: ∀h,o,G,L,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃T⦄ → ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃T⦄.
+/2 width=7 by cnx_inv_crx/ 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/reduction/crx.ma".
+include "basic_2/reduction/cnx.ma".
+
+(* NORMAL TERMS FOR CONTEXT-SENSITIVE EXTENDED REDUCTION ********************)
+
+(* Advanced inversion lemmas on reducibility ********************************)
+
+(* Note: this property is unusual *)
+lemma cnx_inv_crx: ∀h,o,G,L,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃T⦄ → ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃T⦄ → ⊥.
+#h #o #G #L #T #H elim H -L -T
+[ #L #s #d #Hkd #H
+ lapply (cnx_inv_sort … H) -H #H
+ lapply (deg_mono … H Hkd) -h -L -s <plus_n_Sm #H destruct
+| #I #L #K #V #i #HLK #H
+ elim (cnx_inv_delta … HLK H)
+| #L #V #T #_ #IHV #H
+ elim (cnx_inv_appl … H) -H /2 width=1 by/
+| #L #V #T #_ #IHT #H
+ elim (cnx_inv_appl … H) -H /2 width=1 by/
+| #I #L #V #T * #H1 #H2 destruct
+ [ elim (cnx_inv_zeta … H2)
+ | elim (cnx_inv_eps … H2)
+ ]
+|6,7: #a * [ elim a ] #L #V #T * #H1 #_ #IH #H2 destruct
+ [1,3: elim (cnx_inv_abbr … H2) -H2 /2 width=1 by/
+ |*: elim (cnx_inv_abst … H2) -H2 /2 width=1 by/
+ ]
+| #a #L #V #W #T #H
+ elim (cnx_inv_appl … H) -H #_ #_ #H
+ elim (simple_inv_bind … H)
+| #a #L #V #W #T #H
+ elim (cnx_inv_appl … H) -H #_ #_ #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/reduction/cpx_lift.ma".
+include "basic_2/reduction/cnx.ma".
+
+(* NORMAL TERMS FOR CONTEXT-SENSITIVE EXTENDED REDUCTION ********************)
+
+(* Relocation properties ****************************************************)
+
+lemma cnx_lift: ∀h,o,G,L0,L,T,T0,c,l,k. ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃T⦄ → ⬇[c, l, k] L0 ≡ L →
+ ⬆[l, k] T ≡ T0 → ⦃G, L0⦄ ⊢ ➡[h, o] 𝐍⦃T0⦄.
+#h #o #G #L0 #L #T #T0 #c #l #k #HLT #HL0 #HT0 #X #H
+elim (cpx_inv_lift1 … H … HL0 … HT0) -L0 #T1 #HT10 #HT1
+<(HLT … HT1) in HT0; -L #HT0
+>(lift_mono … HT10 … HT0) -T1 -X //
+qed.
+
+lemma cnx_inv_lift: ∀h,o,G,L0,L,T,T0,c,l,k. ⦃G, L0⦄ ⊢ ➡[h, o] 𝐍⦃T0⦄ → ⬇[c, l, k] L0 ≡ L →
+ ⬆[l, k] T ≡ T0 → ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃T⦄.
+#h #o #G #L0 #L #T #T0 #c #l #k #HLT0 #HL0 #HT0 #X #H
+elim (lift_total X l k) #X0 #HX0
+lapply (cpx_lift … H … HL0 … HT0 … HX0) -L #HTX0
+>(HLT0 … HTX0) in HX0; -L0 -X0 #H
+>(lift_inj … H … HT0) -T0 -X -l -k //
+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 *)
+(* *)
+(**************************************************************************)
+
+(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
+
+notation "hvbox( ⦃ term 46 G, break term 46 L ⦄ ⊢ ➡ break [ term 46 o , break term 46 h ] 𝐍 break ⦃ term 46 T ⦄ )"
+ non associative with precedence 45
+ for @{ 'PRedNormal $h $o $G $L $T }.
--- /dev/null
+lemma cpg_delift: ∀c,h,I,G,K,V,T1,L,i. ⬇*[i] L ≡ (K.ⓑ{I}V) →
+ ∃∃T2,T. ⦃G, L⦄ ⊢ T1 ➡[h, 𝟘𝟘] T2 & ⬆*[↑1] T ≡ T2.
+#h #c #I #G #K #V #T1 elim T1 -T1
+[ * #i #L #l /2 width=4 by cpg_atom, lift_sort, lift_gref, ex2_2_intro/
+ elim (lt_or_eq_or_gt i l) #Hil [1,3: /4 width=4 by cpg_atom, lift_lref_ge_minus, lift_lref_lt, ylt_inj, yle_inj, ex2_2_intro/ ]
+ destruct
+ elim (lift_total V 0 (i+1)) #W #HVW
+ elim (lift_split … HVW i i) /3 width=7 by cpg_delta, ex2_2_intro/
+| * [ #a ] #I #W1 #U1 #IHW1 #IHU1 #L #l #HLK
+ elim (IHW1 … HLK) -IHW1 #W2 #W #HW12 #HW2
+ [ elim (IHU1 (L. ⓑ{I} W1) (l+1)) -IHU1 /3 width=9 by cpg_bind, drop_drop, lift_bind, ex2_2_intro/
+ | elim (IHU1 … HLK) -IHU1 -HLK /3 width=8 by cpg_flat, lift_flat, ex2_2_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/relocation/drops.ma".
+include "basic_2/rt_transition/cpg.ma".
+
+(* CONTEXT-SENSITIVE GENERIC PARALLEL RT-TRANSITION FOR TERMS ***************)
+
+(* Properties with length for local environments ****************************)
+
+lemma cpg_inv_lref1_ge: ∀h,c,G,L,T2,i. ⦃G, L⦄ ⊢ #i ➡[h, c] T2 → |L| ≤ i → T2 = #i.
+#h #c #G #L #T2 #i #H elim (cpg_inv_lref1 … H) -H // *
+#I #K #V1 #V2 #HLK #_ #_ #HL -h -G -V2 lapply (drop_fwd_length_lt2 … HLK) -K -I -V1
+#H elim (lt_refl_false i) /2 width=3 by lt_to_le_to_lt/
+qed-.
--- /dev/null
+lemma cpr_delift: ∀G,K,V,T1,L,l. ⬇[l] L ≡ (K.ⓓV) →
+ ∃∃T2,T. ⦃G, L⦄ ⊢ T1 ➡ T2 & ⬆[l, 1] T ≡ T2.
+#G #K #V #T1 elim T1 -T1
+[ * /2 width=4 by cpr_atom, lift_sort, lift_gref, ex2_2_intro/
+ #i #L #l #HLK elim (lt_or_eq_or_gt i l)
+ #Hil [1,3: /4 width=4 by lift_lref_ge_minus, lift_lref_lt, ylt_inj, yle_inj, ex2_2_intro/ ]
+ destruct
+ elim (lift_total V 0 (i+1)) #W #HVW
+ elim (lift_split … HVW i i) /3 width=6 by cpr_delta, ex2_2_intro/
+| * [ #a ] #I #W1 #U1 #IHW1 #IHU1 #L #l #HLK
+ elim (IHW1 … HLK) -IHW1 #W2 #W #HW12 #HW2
+ [ elim (IHU1 (L. ⓑ{I}W1) (l+1)) -IHU1 /3 width=9 by drop_drop, cpr_bind, lift_bind, ex2_2_intro/
+ | elim (IHU1 … HLK) -IHU1 -HLK /3 width=8 by cpr_flat, lift_flat, ex2_2_intro/
+ ]
+]
+qed-.
+
+fact lstas_cpr_aux: ∀h,G,L,T1,T2,d. ⦃G, L⦄ ⊢ T1 •*[h, d] T2 →
+ d = 0 → ⦃G, L⦄ ⊢ T1 ➡ T2.
+#h #G #L #T1 #T2 #d #H elim H -G -L -T1 -T2 -d
+/3 width=1 by cpr_eps, cpr_flat, cpr_bind/
+[ #G #L #K #V1 #V2 #W2 #i #d #HLK #_ #HVW2 #IHV12 #H destruct
+ /3 width=6 by cpr_delta/
+| #G #L #K #V1 #V2 #W2 #i #d #_ #_ #_ #_ <plus_n_Sm #H destruct
+]
+qed-.
+
+lemma lstas_cpr: ∀h,G,L,T1,T2. ⦃G, L⦄ ⊢ T1 •*[h, 0] T2 → ⦃G, L⦄ ⊢ T1 ➡ T2.
+/2 width=4 by lstas_cpr_aux/ qed.
--- /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/reduction/cir.ma".
+include "basic_2/reduction/cpr.ma".
+
+(* CONTEXT-SENSITIVE PARALLEL REDUCTION FOR TERMS ***************************)
+
+(* Advanced forward lemmas on irreducibility ********************************)
+
+lemma cpr_fwd_cir: ∀G,L,T1,T2. ⦃G, L⦄ ⊢ T1 ➡ T2 → ⦃G, L⦄ ⊢ ➡ 𝐈⦃T1⦄ → T2 = T1.
+#G #L #T1 #T2 #H elim H -G -L -T1 -T2
+[ //
+| #G #L #K #V1 #V2 #W2 #i #HLK #_ #HVW2 #IHV12 #H
+ elim (cir_inv_delta … HLK) //
+| #a * #G #L #V1 #V2 #T1 #T2 #_ #_ #IHV1 #IHT1 #H
+ [ elim (cir_inv_bind … H) -H #HV1 #HT1 * #H destruct
+ lapply (IHV1 … HV1) -IHV1 -HV1 #H destruct
+ lapply (IHT1 … HT1) -IHT1 #H destruct //
+ | elim (cir_inv_ib2 … H) -H /3 width=2 by or_introl, eq_f2/
+ ]
+| * #G #L #V1 #V2 #T1 #T2 #_ #_ #IHV1 #IHT1 #H
+ [ elim (cir_inv_appl … H) -H #HV1 #HT1 #_
+ >IHV1 -IHV1 // -HV1 >IHT1 -IHT1 //
+ | elim (cir_inv_ri2 … H) /2 width=1 by/
+ ]
+| #G #L #V1 #T1 #T #T2 #_ #_ #_ #H
+ elim (cir_inv_ri2 … H) /2 width=1 by or_introl/
+| #G #L #V1 #T1 #T2 #_ #_ #H
+ elim (cir_inv_ri2 … H) /2 width=1 by/
+| #a #G #L #V1 #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #_ #_ #_ #H
+ elim (cir_inv_appl … H) -H #_ #_ #H
+ elim (simple_inv_bind … H)
+| #a #G #L #V #V1 #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #_ #_ #_ #_ #H
+ elim (cir_inv_appl … H) -H #_ #_ #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/reduction/cix.ma".
+include "basic_2/reduction/cpx.ma".
+
+(* CONTEXT-SENSITIVE EXTENDED PARALLEL REDUCTION FOR TERMS ******************)
+
+(* Advanced forward lemmas on irreducibility ********************************)
+
+lemma cpx_fwd_cix: ∀h,o,G,L,T1,T2. ⦃G, L⦄ ⊢ T1 ➡[h, o] T2 → ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃T1⦄ → T2 = T1.
+#h #o #G #L #T1 #T2 #H elim H -G -L -T1 -T2
+[ //
+| #G #L #s #d #Hkd #H elim (cix_inv_sort … Hkd H)
+| #I #G #L #K #V1 #V2 #W2 #i #HLK #_ #HVW2 #IHV12 #H
+ elim (cix_inv_delta … HLK) //
+| #a * #G #L #V1 #V2 #T1 #T2 #_ #_ #IHV1 #IHT1 #H
+ [ elim (cix_inv_bind … H) -H #HV1 #HT1 * #H destruct
+ lapply (IHV1 … HV1) -IHV1 -HV1 #H destruct
+ lapply (IHT1 … HT1) -IHT1 #H destruct //
+ | elim (cix_inv_ib2 … H) -H /3 width=2 by or_introl, eq_f2/
+ ]
+| * #G #L #V1 #V2 #T1 #T2 #_ #_ #IHV1 #IHT1 #H
+ [ elim (cix_inv_appl … H) -H #HV1 #HT1 #_
+ >IHV1 -IHV1 // -HV1 >IHT1 -IHT1 //
+ | elim (cix_inv_ri2 … H) /2 width=1 by/
+ ]
+| #G #L #V1 #T1 #T #T2 #_ #_ #_ #H
+ elim (cix_inv_ri2 … H) /2 width=1 by or_introl/
+| #G #L #V1 #T1 #T2 #_ #_ #H
+ elim (cix_inv_ri2 … H) /2 width=1 by/
+| #G #L #V1 #V2 #T #_ #_ #H
+ elim (cix_inv_ri2 … H) /2 width=1 by/
+| #a #G #L #V1 #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #_ #_ #_ #H
+ elim (cix_inv_appl … H) -H #_ #_ #H
+ elim (simple_inv_bind … H)
+| #a #G #L #V #V1 #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #_ #_ #_ #_ #H
+ elim (cix_inv_appl … H) -H #_ #_ #H
+ elim (simple_inv_bind … H)
+]
+qed-.
--- /dev/null
+lemma cpx_delift: ∀h,I,G,K,V,T1,L,l. ⬇[l] L ≡ (K.ⓑ{I}V) →
+ ∃∃T2,T. ⦃G, L⦄ ⊢ T1 ➡[h] T2 & ⬆[l, 1] T ≡ T2.
+#h #o #I #G #K #V #T1 elim T1 -T1
+[ * #i #L #l /2 width=4 by cpx_atom, lift_sort, lift_gref, ex2_2_intro/
+ elim (lt_or_eq_or_gt i l) #Hil [1,3: /4 width=4 by cpx_atom,
+lift_lref_ge_minus, lift_lref_lt, ylt_inj, yle_inj, ex2_2_intro/ ]
+ destruct
+ elim (lift_total V 0 (i+1)) #W #HVW
+ elim (lift_split … HVW i i) /3 width=7 by cpx_delta, ex2_2_intro/
+| * [ #a ] #I #W1 #U1 #IHW1 #IHU1 #L #l #HLK
+ elim (IHW1 … HLK) -IHW1 #W2 #W #HW12 #HW2
+ [ elim (IHU1 (L. ⓑ{I} W1) (l+1)) -IHU1 /3 width=9 by cpx_bind,
+drop_drop, lift_bind, ex2_2_intro/
+ | elim (IHU1 … HLK) -IHU1 -HLK /3 width=8 by cpx_flat, lift_flat,
+ex2_2_intro/
+ ]
+]
+qed-.
--- /dev/null
+lemma cpx_inv_lref1_ge: ∀h,G,L,T2,i. ⦃G, L⦄ ⊢ #i ➡[h] T2 → |L| ≤ i → T2 = #i.
--- /dev/null
+fact sta_cpx_aux: ∀h,o,G,L,T1,T2,d2,d1. ⦃G, L⦄ ⊢ T1 •*[h, d2] T2 → d2 = 1 →
+ ⦃G, L⦄ ⊢ T1 ▪[h, o] d1+1 → ⦃G, L⦄ ⊢ T1 ➡[h, o] T2.
+#h #o #G #L #T1 #T2 #d2 #d1 #H elim H -G -L -T1 -T2 -d2
+[ #G #L #d2 #s #H0 destruct normalize
+ /3 width=4 by cpx_st, da_inv_sort/
+| #G #L #K #V1 #V2 #W2 #i #d2 #HLK #_ #HVW2 #IHV12 #H0 #H destruct
+ elim (da_inv_lref … H) -H * #K0 #V0 [| #d0 ] #HLK0
+ lapply (drop_mono … HLK0 … HLK) -HLK0 #H destruct /3 width=7 by cpx_delta/
+| #G #L #K #V1 #V2 #i #_ #_ #_ #H destruct
+| #G #L #K #V1 #V2 #W2 #i #d2 #HLK #HV12 #HVW2 #_ #H0 #H
+ lapply (discr_plus_xy_y … H0) -H0 #H0 destruct
+ elim (da_inv_lref … H) -H * #K0 #V0 [| #d0 ] #HLK0
+ lapply (drop_mono … HLK0 … HLK) -HLK0 #H destruct
+ /4 width=7 by cpx_delta, cpr_cpx, lstas_cpr/
+| /4 width=2 by cpx_bind, da_inv_bind/
+| /4 width=3 by cpx_flat, da_inv_flat/
+| /4 width=3 by cpx_eps, da_inv_flat/
+]
+qed-.
+
+lemma sta_cpx: ∀h,o,G,L,T1,T2,d. ⦃G, L⦄ ⊢ T1 •*[h, 1] T2 →
+ ⦃G, L⦄ ⊢ T1 ▪[h, o] d+1 → ⦃G, L⦄ ⊢ T1 ➡[h, o] T2.
+/2 width=3 by sta_cpx_aux/ qed.
+
+lemma fqu_sta_trans: ∀h,o,G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐ ⦃G2, L2, T2⦄ →
+ ∀U2. ⦃G2, L2⦄ ⊢ T2 •*[h, 1] U2 →
+ ∀d. ⦃G2, L2⦄ ⊢ T2 ▪[h, o] d+1 →
+ ∃∃U1. ⦃G1, L1⦄ ⊢ T1 ➡[h, o] U1 & ⦃G1, L1, U1⦄ ⊐ ⦃G2, L2, U2⦄.
+/3 width=5 by fqu_cpx_trans, sta_cpx/ qed-.
+
+lemma fquq_sta_trans: ∀h,o,G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐⸮ ⦃G2, L2, T2⦄ →
+ ∀U2. ⦃G2, L2⦄ ⊢ T2 •*[h, 1] U2 →
+ ∀d. ⦃G2, L2⦄ ⊢ T2 ▪[h, o] d+1 →
+ ∃∃U1. ⦃G1, L1⦄ ⊢ T1 ➡[h, o] U1 & ⦃G1, L1, U1⦄ ⊐⸮ ⦃G2, L2, U2⦄.
+/3 width=5 by fquq_cpx_trans, sta_cpx/ 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/psubst_6.ma".
+include "basic_2/grammar/genv.ma".
+include "basic_2/substitution/lsuby.ma".
+
+(* CONTEXT-SENSITIVE EXTENDED ORDINARY SUBSTITUTION FOR TERMS ***************)
+
+(* activate genv *)
+inductive cpy: ynat → ynat → relation4 genv lenv term term ≝
+| cpy_atom : ∀I,G,L,l,m. cpy l m G L (⓪{I}) (⓪{I})
+| cpy_subst: ∀I,G,L,K,V,W,i,l,m. l ≤ i → i < l+m →
+ ⬇[i] L ≡ K.ⓑ{I}V → ⬆[0, ⫯i] V ≡ W → cpy l m G L (#i) W
+| cpy_bind : ∀a,I,G,L,V1,V2,T1,T2,l,m.
+ cpy l m G L V1 V2 → cpy (⫯l) m G (L.ⓑ{I}V1) T1 T2 →
+ cpy l m G L (ⓑ{a,I}V1.T1) (ⓑ{a,I}V2.T2)
+| cpy_flat : ∀I,G,L,V1,V2,T1,T2,l,m.
+ cpy l m G L V1 V2 → cpy l m G L T1 T2 →
+ cpy l m G L (ⓕ{I}V1.T1) (ⓕ{I}V2.T2)
+.
+
+interpretation "context-sensitive extended ordinary substritution (term)"
+ 'PSubst G L T1 l m T2 = (cpy l m G L T1 T2).
+
+(* Basic properties *********************************************************)
+
+lemma lsuby_cpy_trans: ∀G,l,m. lsub_trans … (cpy 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 #V #W #i #l #m #Hli #Hilm #HLK1 #HVW #L2 #HL12
+ elim (ylt_inv_plus_dx … Hilm) #m0 #H0 #_
+ elim (lsuby_drop_trans_be … HL12 … HLK1 … H0) -HL12 -HLK1 -H0 /2 width=5 by cpy_subst/
+| /4 width=1 by lsuby_succ, cpy_bind/
+| /3 width=1 by cpy_flat/
+]
+qed-.
+
+lemma cpy_refl: ∀G,T,L,l,m. ⦃G, L⦄ ⊢ T ▶[l, m] T.
+#G #T elim T -T // * /2 width=1 by cpy_bind, cpy_flat/
+qed.
+
+(* Basic_1: was: subst1_ex *)
+lemma cpy_full: ∀I,G,K,V,T1,L,l. ⬇[l] L ≡ K.ⓑ{I}V →
+ ∃∃T2,T. ⦃G, L⦄ ⊢ T1 ▶[l, 1] T2 & ⬆[l, 1] T ≡ T2.
+#I #G #K #V #T1 elim T1 -T1
+[ * #i #L #l #HLK
+ /2 width=4 by lift_sort, lift_gref, ex2_2_intro/
+ elim (ylt_split_eq i l) /3 width=4 by lift_lref_pred, lift_lref_lt, ex2_2_intro/
+ #H destruct lapply (drop_fwd_Y2 … HLK) #Hi
+ elim (lift_total (⫯i) … V 0) /2 width=1 by ylt_succ/
+ #W #HVW elim (lift_split … HVW i i … 1)
+ /4 width=6 by cpy_subst, monotonic_ylt_plus_sn, ex2_2_intro/
+| * [ #a ] #J #W1 #U1 #IHW1 #IHU1 #L #l #HLK
+ elim (IHW1 … HLK) -IHW1 #W2 #W #HW12 #HW2
+ [ elim (IHU1 (L.ⓑ{J}W1) (⫯l)) -IHU1
+ /3 width=9 by cpy_bind, drop_drop, lift_bind, ex2_2_intro/
+ | elim (IHU1 … HLK) -IHU1 -HLK
+ /3 width=8 by cpy_flat, lift_flat, ex2_2_intro/
+ ]
+]
+qed-.
+
+lemma cpy_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 elim H -G -L -T1 -T2 -l1 -m1 //
+[ /3 width=5 by cpy_subst, ylt_yle_trans, yle_trans/
+| /4 width=3 by cpy_bind, ylt_yle_trans, yle_succ/
+| /3 width=1 by cpy_flat/
+]
+qed-.
+(*
+lemma cpy_weak_top: ∀G,L,T1,T2,l,m.
+ ⦃G, L⦄ ⊢ T1 ▶[l, m] T2 → ⦃G, L⦄ ⊢ T1 ▶[l, ∞] T2.
+/2 width=5 by cpy_weak/ qed-.
+
+lemma cpy_weak_full: ∀G,L,T1,T2,l,m.
+ ⦃G, L⦄ ⊢ T1 ▶[l, m] T2 → ⦃G, L⦄ ⊢ T1 ▶[0, ∞] T2.
+/2 width=5 by cpy_weak/ qed-.
+*)
+lemma cpy_split_up: ∀G,L,T1,T2,l,m. ⦃G, L⦄ ⊢ T1 ▶[l, m] T2 →
+ ∀i,m2. i + m2 = l + m →
+ ∀m1. i ≤ l + m1 →
+ ∃∃T. ⦃G, L⦄ ⊢ T1 ▶[l, m1] T & ⦃G, L⦄ ⊢ T ▶[i, m2] T2.
+#G #L #T1 #T2 #l #m #H elim H -G -L -T1 -T2 -l -m
+[ /2 width=3 by ex2_intro/
+| #I #G #L #K #V #W #i #l #m #Hli #Hilm #HLK #HVW #j #m2 #H2 #m1 #H1
+ elim (ylt_split i j) [ -Hilm -H2 | -Hli ]
+ /4 width=9 by cpy_subst, ylt_yle_trans, ex2_intro/
+| #a #I #G #L #V1 #V2 #T1 #T2 #l #m #_ #_ #IHV12 #IHT12 #i #m2 #H2 #m1 #H1
+ elim (IHV12 … H2 … H1) -IHV12 #V
+ elim (IHT12 (⫯i) … m2 … m1) -IHT12 /2 width=1 by yle_succ/ -H2 -H1
+ #T #HT1 #HT2 lapply (lsuby_cpy_trans … HT2 (L.ⓑ{I}V) ?) -HT2
+ /3 width=5 by lsuby_succ, ex2_intro, cpy_bind/
+| #I #G #L #V1 #V2 #T1 #T2 #l #m #_ #_ #IHV12 #IHT12 #i #m2 #H2 #m1 #H1
+ elim (IHV12 … H2 … H1) -IHV12 elim (IHT12 … H2 … H1) -IHT12 -H2 -H1
+ /3 width=5 by ex2_intro, cpy_flat/
+]
+qed-.
+
+lemma cpy_split_down: ∀G,L,T1,T2,l,m. ⦃G, L⦄ ⊢ T1 ▶[l, m] T2 →
+ ∀m1,m2. m = m1 + m2 →
+ ∃∃T. ⦃G, L⦄ ⊢ T1 ▶[l+m2, m1] T & ⦃G, L⦄ ⊢ T ▶[l, m2] T2.
+#G #L #T1 #T2 #l #m #H elim H -G -L -T1 -T2 -l -m
+[ /2 width=3 by ex2_intro/
+| #I #G #L #K #V #W #i #l #m #Hli #Hilm #HLK #HVW #m1 #m2 #H destruct
+ elim (ylt_split i (l+m2)) [ -Hilm | -Hli ]
+ /3 width=9 by cpy_subst, ex2_intro/
+| #a #I #G #L #V1 #V2 #T1 #T2 #l #m #_ #_ #IHV12 #IHT12 #m1 #m2 #H destruct
+ elim (IHV12 m1 m2) -IHV12 // #V
+ elim (IHT12 m1 m2) -IHT12 //
+ >yplus_succ1 #T #HT1 #HT2
+ lapply (lsuby_cpy_trans … HT2 (L.ⓑ{I}V) ?) -HT2
+ /3 width=5 by lsuby_succ, ex2_intro, cpy_bind/
+| #I #G #L #V1 #V2 #T1 #T2 #l #m #_ #_ #IHV12 #IHT12 #m1 #m2 #H destruct
+ elim (IHV12 m1 m2) -IHV12 // elim (IHT12 m1 m2) -IHT12 //
+ /3 width=5 by ex2_intro, cpy_flat/
+]
+qed-.
+
+(* Basic forward lemmas *****************************************************)
+
+lemma cpy_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 elim H -G -L -U1 -U2 -lt -mt
+[ * #i #G #L #lt #mt #T1 #l #m #H #_
+ [ lapply (lift_inv_sort2 … H) -H #H destruct /2 width=3 by ex2_intro/
+ | elim (lift_inv_lref2 … H) -H * #Hil #H destruct /3 width=3 by lift_lref_ge_minus, lift_lref_lt, ex2_intro/
+ | lapply (lift_inv_gref2 … H) -H #H destruct /2 width=3 by ex2_intro/
+ ]
+| #I #G #L #K #V #W #i #lt #mt #Hlti #Hilmt #HLK #HVW #T1 #l #m #H #Hllt #Hlmlmt
+ elim (lift_inv_lref2 … H) -H * #Hil #H destruct [ -V -Hilmt -Hlmlmt | -Hlti -Hllt ]
+ [ elim (ylt_yle_false … Hllt) -Hllt /3 width=3 by yle_ylt_trans, ylt_inj/
+ | elim (yle_inv_plus_inj2 … Hil) #Hlim #Hmi
+ elim (lift_split … HVW l (⫯(i-m)) ? ? ?) [2,3,4: /2 width=1 by yle_succ_dx, le_S_S/ ] -Hlim
+ #T2 #_ >plus_minus /2 width=1 by yle_inv_inj/ <minus_minus /3 width=1 by le_S, yle_inv_inj/ <minus_n_n <plus_n_O #H -Hmi
+ @(ex2_intro … H) -H @(cpy_subst … HLK HVW) /2 width=1 by yle_inj/ >ymax_pre_sn_comm // (**) (* explicit constructor *)
+ ]
+| #a #I #G #L #W1 #W2 #U1 #U2 #lt #mt #_ #_ #IHW12 #IHU12 #X #l #m #H #Hllt #Hlmlmt
+ elim (lift_inv_bind2 … H) -H #V1 #T1 #HVW1 #HTU1 #H destruct
+ elim (IHW12 … HVW1) -V1 -IHW12 //
+ elim (IHU12 … HTU1) -T1 -IHU12 /2 width=1 by yle_succ/
+ <yplus_inj >yplus_SO2 >yplus_succ1 >yplus_succ1
+ /3 width=2 by cpy_bind, lift_bind, ex2_intro/
+| #I #G #L #W1 #W2 #U1 #U2 #lt #mt #_ #_ #IHW12 #IHU12 #X #l #m #H #Hllt #Hlmlmt
+ elim (lift_inv_flat2 … H) -H #V1 #T1 #HVW1 #HTU1 #H destruct
+ elim (IHW12 … HVW1) -V1 -IHW12 // elim (IHU12 … HTU1) -T1 -IHU12
+ /3 width=2 by cpy_flat, lift_flat, ex2_intro/
+]
+qed-.
+
+lemma cpy_fwd_tw: ∀G,L,T1,T2,l,m. ⦃G, L⦄ ⊢ T1 ▶[l, m] T2 → ♯{T1} ≤ ♯{T2}.
+#G #L #T1 #T2 #l #m #H elim H -G -L -T1 -T2 -l -m normalize
+/3 width=1 by monotonic_le_plus_l, le_plus/
+qed-.
+
+(* Basic inversion lemmas ***************************************************)
+
+fact cpy_inv_atom1_aux: ∀G,L,T1,T2,l,m. ⦃G, L⦄ ⊢ T1 ▶[l, m] T2 → ∀J. T1 = ⓪{J} →
+ T2 = ⓪{J} ∨
+ ∃∃I,K,V,i. l ≤ yinj i & i < l + m &
+ ⬇[i] L ≡ K.ⓑ{I}V &
+ ⬆[O, ⫯i] V ≡ T2 &
+ J = LRef i.
+#G #L #T1 #T2 #l #m * -G -L -T1 -T2 -l -m
+[ #I #G #L #l #m #J #H destruct /2 width=1 by or_introl/
+| #I #G #L #K #V #T2 #i #l #m #Hli #Hilm #HLK #HVT2 #J #H destruct /3 width=9 by ex5_4_intro, or_intror/
+| #a #I #G #L #V1 #V2 #T1 #T2 #l #m #_ #_ #J #H destruct
+| #I #G #L #V1 #V2 #T1 #T2 #l #m #_ #_ #J #H destruct
+]
+qed-.
+
+lemma cpy_inv_atom1: ∀I,G,L,T2,l,m. ⦃G, L⦄ ⊢ ⓪{I} ▶[l, m] T2 →
+ T2 = ⓪{I} ∨
+ ∃∃J,K,V,i. l ≤ yinj i & i < l + m &
+ ⬇[i] L ≡ K.ⓑ{J}V &
+ ⬆[O, ⫯i] V ≡ T2 &
+ I = LRef i.
+/2 width=4 by cpy_inv_atom1_aux/ qed-.
+
+(* Basic_1: was: subst1_gen_sort *)
+lemma cpy_inv_sort1: ∀G,L,T2,k,l,m. ⦃G, L⦄ ⊢ ⋆k ▶[l, m] T2 → T2 = ⋆k.
+#G #L #T2 #k #l #m #H
+elim (cpy_inv_atom1 … H) -H //
+* #I #K #V #i #_ #_ #_ #_ #H destruct
+qed-.
+
+(* Basic_1: was: subst1_gen_lref *)
+lemma cpy_inv_lref1: ∀G,L,T2,i,l,m. ⦃G, L⦄ ⊢ #i ▶[l, m] T2 →
+ T2 = #i ∨
+ ∃∃I,K,V. l ≤ i & i < l + m &
+ ⬇[i] L ≡ K.ⓑ{I}V &
+ ⬆[O, ⫯i] V ≡ T2.
+#G #L #T2 #i #l #m #H
+elim (cpy_inv_atom1 … H) -H /2 width=1 by or_introl/
+* #I #K #V #j #Hlj #Hjlm #HLK #HVT2 #H destruct /3 width=5 by ex4_3_intro, or_intror/
+qed-.
+
+lemma cpy_inv_gref1: ∀G,L,T2,p,l,m. ⦃G, L⦄ ⊢ §p ▶[l, m] T2 → T2 = §p.
+#G #L #T2 #p #l #m #H
+elim (cpy_inv_atom1 … H) -H //
+* #I #K #V #i #_ #_ #_ #_ #H destruct
+qed-.
+
+fact cpy_inv_bind1_aux: ∀G,L,U1,U2,l,m. ⦃G, L⦄ ⊢ U1 ▶[l, m] U2 →
+ ∀a,I,V1,T1. U1 = ⓑ{a,I}V1.T1 →
+ ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ▶[l, m] V2 &
+ ⦃G, L. ⓑ{I}V1⦄ ⊢ T1 ▶[⫯l, m] T2 &
+ U2 = ⓑ{a,I}V2.T2.
+#G #L #U1 #U2 #l #m * -G -L -U1 -U2 -l -m
+[ #I #G #L #l #m #b #J #W1 #U1 #H destruct
+| #I #G #L #K #V #W #i #l #m #_ #_ #_ #_ #b #J #W1 #U1 #H destruct
+| #a #I #G #L #V1 #V2 #T1 #T2 #l #m #HV12 #HT12 #b #J #W1 #U1 #H destruct /2 width=5 by ex3_2_intro/
+| #I #G #L #V1 #V2 #T1 #T2 #l #m #_ #_ #b #J #W1 #U1 #H destruct
+]
+qed-.
+
+lemma cpy_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.
+/2 width=3 by cpy_inv_bind1_aux/ qed-.
+
+fact cpy_inv_flat1_aux: ∀G,L,U1,U2,l,m. ⦃G, L⦄ ⊢ U1 ▶[l, m] U2 →
+ ∀I,V1,T1. U1 = ⓕ{I}V1.T1 →
+ ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ▶[l, m] V2 &
+ ⦃G, L⦄ ⊢ T1 ▶[l, m] T2 &
+ U2 = ⓕ{I}V2.T2.
+#G #L #U1 #U2 #l #m * -G -L -U1 -U2 -l -m
+[ #I #G #L #l #m #J #W1 #U1 #H destruct
+| #I #G #L #K #V #W #i #l #m #_ #_ #_ #_ #J #W1 #U1 #H destruct
+| #a #I #G #L #V1 #V2 #T1 #T2 #l #m #_ #_ #J #W1 #U1 #H destruct
+| #I #G #L #V1 #V2 #T1 #T2 #l #m #HV12 #HT12 #J #W1 #U1 #H destruct /2 width=5 by ex3_2_intro/
+]
+qed-.
+
+lemma cpy_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.
+/2 width=3 by cpy_inv_flat1_aux/ qed-.
+
+
+fact cpy_inv_refl_O2_aux: ∀G,L,T1,T2,l,m. ⦃G, L⦄ ⊢ T1 ▶[l, m] T2 → m = 0 → T1 = T2.
+#G #L #T1 #T2 #l #m #H elim H -G -L -T1 -T2 -l -m
+[ //
+| #I #G #L #K #V #W #i #l #m #Hli #Hilm #_ #_ #H destruct
+ elim (ylt_yle_false … Hli) -Hli //
+| /3 width=1 by eq_f2/
+| /3 width=1 by eq_f2/
+]
+qed-.
+
+lemma cpy_inv_refl_O2: ∀G,L,T1,T2,l. ⦃G, L⦄ ⊢ T1 ▶[l, 0] T2 → T1 = T2.
+/2 width=6 by cpy_inv_refl_O2_aux/ qed-.
+
+(* Basic_1: was: subst1_gen_lift_eq *)
+lemma cpy_inv_lift1_eq: ∀G,T1,U1,l,m. ⬆[l, m] T1 ≡ U1 →
+ ∀L,U2. ⦃G, L⦄ ⊢ U1 ▶[l, m] U2 → U1 = U2.
+#G #T1 #U1 #l #m #HTU1 #L #U2 #HU12 elim (cpy_fwd_up … HU12 … HTU1) -HU12 -HTU1
+/2 width=4 by cpy_inv_refl_O2/
+qed-.
+
+(* Basic_1: removed theorems 25:
+ subst0_gen_sort subst0_gen_lref subst0_gen_head subst0_gen_lift_lt
+ subst0_gen_lift_false subst0_gen_lift_ge subst0_refl subst0_trans
+ subst0_lift_lt subst0_lift_ge subst0_lift_ge_S subst0_lift_ge_s
+ subst0_subst0 subst0_subst0_back subst0_weight_le subst0_weight_lt
+ subst0_confluence_neq subst0_confluence_eq subst0_tlt_head
+ subst0_confluence_lift subst0_tlt
+ subst1_head subst1_gen_head subst1_lift_S subst1_confluence_lift
+*)
--- /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".
+
+(* CONTEXT-SENSITIVE EXTENDED ORDINARY SUBSTITUTION FOR TERMS ***************)
+
+(* Main properties **********************************************************)
+
+(* Basic_1: was: subst1_confluence_eq *)
+theorem cpy_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.
+#G #L #T0 #T1 #l1 #m1 #H elim H -G -L -T0 -T1 -l1 -m1
+[ /2 width=3 by ex2_intro/
+| #I1 #G #L #K1 #V1 #T1 #i0 #l1 #m1 #Hl1 #Hlm1 #HLK1 #HVT1 #T2 #l2 #m2 #H
+ elim (cpy_inv_lref1 … H) -H
+ [ #HX destruct /3 width=7 by cpy_subst, ex2_intro/
+ | -Hl1 -Hlm1 * #I2 #K2 #V2 #_ #_ #HLK2 #HVT2
+ lapply (drop_mono … HLK1 … HLK2) -HLK1 -HLK2 #H destruct
+ >(lift_mono … HVT1 … HVT2) -HVT1 -HVT2 /2 width=3 by ex2_intro/
+ ]
+| #a #I #G #L #V0 #V1 #T0 #T1 #l1 #m1 #_ #_ #IHV01 #IHT01 #X #l2 #m2 #HX
+ elim (cpy_inv_bind1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct
+ elim (IHV01 … HV02) -IHV01 -HV02 #V #HV1 #HV2
+ elim (IHT01 … HT02) -T0 #T #HT1 #HT2
+ lapply (lsuby_cpy_trans … HT1 (L.ⓑ{I}V1) ?) -HT1 /2 width=1 by lsuby_succ/
+ lapply (lsuby_cpy_trans … HT2 (L.ⓑ{I}V2) ?) -HT2
+ /3 width=5 by cpy_bind, lsuby_succ, ex2_intro/
+| #I #G #L #V0 #V1 #T0 #T1 #l1 #m1 #_ #_ #IHV01 #IHT01 #X #l2 #m2 #HX
+ elim (cpy_inv_flat1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct
+ elim (IHV01 … HV02) -V0
+ elim (IHT01 … HT02) -T0 /3 width=5 by cpy_flat, ex2_intro/
+]
+qed-.
+
+(* Basic_1: was: subst1_confluence_neq *)
+theorem cpy_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.
+#G #L1 #T0 #T1 #l1 #m1 #H elim H -G -L1 -T0 -T1 -l1 -m1
+[ /2 width=3 by ex2_intro/
+| #I1 #G #L1 #K1 #V1 #T1 #i0 #l1 #m1 #Hl1 #Hlm1 #HLK1 #HVT1 #L2 #T2 #l2 #m2 #H1 #H2
+ elim (cpy_inv_lref1 … H1) -H1
+ [ #H destruct /3 width=7 by cpy_subst, ex2_intro/
+ | -HLK1 -HVT1 * #I2 #K2 #V2 #Hl2 #Hlm2 #_ #_ elim H2 -H2 #Hlml [ -Hl1 -Hlm2 | -Hl2 -Hlm1 ]
+ [ elim (ylt_yle_false … Hlm1) -Hlm1 /2 width=3 by yle_trans/
+ | elim (ylt_yle_false … Hlm2) -Hlm2 /2 width=3 by yle_trans/
+ ]
+ ]
+| #a #I #G #L1 #V0 #V1 #T0 #T1 #l1 #m1 #_ #_ #IHV01 #IHT01 #L2 #X #l2 #m2 #HX #H
+ elim (cpy_inv_bind1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct
+ elim (IHV01 … HV02 H) -IHV01 -HV02 #V #HV1 #HV2
+ elim (IHT01 … HT02) -T0
+ [ -H #T #HT1 #HT2
+ lapply (lsuby_cpy_trans … HT1 (L2.ⓑ{I}V1) ?) -HT1 /2 width=1 by lsuby_succ/
+ lapply (lsuby_cpy_trans … HT2 (L1.ⓑ{I}V2) ?) -HT2 /3 width=5 by cpy_bind, lsuby_succ, ex2_intro/
+ | -HV1 -HV2 elim H -H /3 width=1 by yle_succ, or_introl, or_intror/
+ ]
+| #I #G #L1 #V0 #V1 #T0 #T1 #l1 #m1 #_ #_ #IHV01 #IHT01 #L2 #X #l2 #m2 #HX #H
+ elim (cpy_inv_flat1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct
+ elim (IHV01 … HV02 H) -V0
+ elim (IHT01 … HT02 H) -T0 -H /3 width=5 by cpy_flat, ex2_intro/
+]
+qed-.
+
+(* Note: the constant 1 comes from cpy_subst *)
+(* Basic_1: was: subst1_trans *)
+theorem cpy_trans_ge: ∀G,L,T1,T0,l,m. ⦃G, L⦄ ⊢ T1 ▶[l, m] T0 →
+ ∀T2. ⦃G, L⦄ ⊢ T0 ▶[l, 1] T2 → 1 ≤ m → ⦃G, L⦄ ⊢ T1 ▶[l, m] T2.
+#G #L #T1 #T0 #l #m #H elim H -G -L -T1 -T0 -l -m
+[ #I #G #L #l #m #T2 #H #Hm
+ elim (cpy_inv_atom1 … H) -H
+ [ #H destruct //
+ | * #J #K #V #i #Hl2i #Hilm2 #HLK #HVT2 #H destruct
+ lapply (ylt_yle_trans … (l+m) … Hilm2)
+ /2 width=5 by cpy_subst, monotonic_yle_plus_sn/
+ ]
+| #I #G #L #K #V #V2 #i #l #m #Hli #Hilm #HLK #HVW #T2 #HVT2 #Hm
+ lapply (cpy_weak … HVT2 0 (i+1) ? ?) -HVT2 /3 width=1 by yle_plus_dx2_trans, yle_succ/
+ >yplus_inj #HVT2 <(cpy_inv_lift1_eq … HVW … HVT2) -HVT2 /2 width=5 by cpy_subst/
+| #a #I #G #L #V1 #V0 #T1 #T0 #l #m #_ #_ #IHV10 #IHT10 #X #H #Hm
+ elim (cpy_inv_bind1 … H) -H #V2 #T2 #HV02 #HT02 #H destruct
+ lapply (lsuby_cpy_trans … HT02 (L.ⓑ{I}V1) ?) -HT02 /2 width=1 by lsuby_succ/ #HT02
+ lapply (IHT10 … HT02 Hm) -T0 /3 width=1 by cpy_bind/
+| #I #G #L #V1 #V0 #T1 #T0 #l #m #_ #_ #IHV10 #IHT10 #X #H #Hm
+ elim (cpy_inv_flat1 … H) -H #V2 #T2 #HV02 #HT02 #H destruct /3 width=1 by cpy_flat/
+]
+qed-.
+
+theorem cpy_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.
+#G #L #T1 #T0 #l1 #m1 #H elim H -G -L -T1 -T0 -l1 -m1
+[ /2 width=3 by ex2_intro/
+| #I #G #L #K #V #W #i1 #l1 #m1 #Hli1 #Hilm1 #HLK #HVW #T2 #l2 #m2 #HWT2 #Hlm2l1
+ lapply (yle_trans … Hlm2l1 … Hli1) -Hlm2l1 #Hlm2i1
+ lapply (cpy_weak … HWT2 0 (i1+1) ? ?) -HWT2 /3 width=1 by yle_succ, yle_pred_sn/ -Hlm2i1
+ >yplus_inj #HWT2 <(cpy_inv_lift1_eq … HVW … HWT2) -HWT2 /3 width=9 by cpy_subst, ex2_intro/
+| #a #I #G #L #V1 #V0 #T1 #T0 #l1 #m1 #_ #_ #IHV10 #IHT10 #X #l2 #m2 #HX #lm2l1
+ elim (cpy_inv_bind1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct
+ lapply (lsuby_cpy_trans … HT02 (L.ⓑ{I}V1) ?) -HT02 /2 width=1 by lsuby_succ/ #HT02
+ elim (IHV10 … HV02) -IHV10 -HV02 // #V
+ elim (IHT10 … HT02) -T0 /2 width=1 by yle_succ/ #T #HT1 #HT2
+ lapply (lsuby_cpy_trans … HT2 (L.ⓑ{I}V) ?) -HT2 /3 width=6 by cpy_bind, lsuby_succ, ex2_intro/
+| #I #G #L #V1 #V0 #T1 #T0 #l1 #m1 #_ #_ #IHV10 #IHT10 #X #l2 #m2 #HX #lm2l1
+ elim (cpy_inv_flat1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct
+ elim (IHV10 … HV02) -V0 //
+ elim (IHT10 … HT02) -T0 /3 width=6 by cpy_flat, 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/drop_drop.ma".
+include "basic_2/substitution/cpy.ma".
+
+(* CONTEXT-SENSITIVE EXTENDED ORDINARY SUBSTITUTION FOR TERMS ***************)
+
+(* Properties on relocation *************************************************)
+
+(* Basic_1: was: subst1_lift_lt *)
+lemma cpy_lift_le: ∀G,K,T1,T2,lt,mt. ⦃G, K⦄ ⊢ T1 ▶[lt, mt] T2 →
+ ∀L,U1,U2,s,l,m. ⬇[s, l, m] L ≡ K →
+ ⬆[l, m] T1 ≡ U1 → ⬆[l, m] T2 ≡ U2 →
+ lt + mt ≤ l → ⦃G, L⦄ ⊢ U1 ▶[lt, mt] U2.
+#G #K #T1 #T2 #lt #mt #H elim H -G -K -T1 -T2 -lt -mt
+[ #I #G #K #lt #mt #L #U1 #U2 #s #l #m #_ #H1 #H2 #_
+ >(lift_mono … H1 … H2) -H1 -H2 //
+| #I #G #K #KV #V #W #i #lt #mt #Hlti #Hilmt #HKV #HVW #L #U1 #U2 #s #l #m #HLK #H #HWU2 #Hlmtl
+ lapply (ylt_yle_trans … Hlmtl … Hilmt) -Hlmtl #Hil
+ lapply (lift_inv_lref1_lt … H … Hil) -H #H destruct
+ elim (lift_trans_ge … HVW … HWU2) -W /2 width=1 by ylt_fwd_le_succ1/
+ <yplus_inj >yplus_SO2 >yminus_succ2 #W #HVW #HWU2
+ elim (drop_trans_le … HLK … HKV) -K /2 width=2 by ylt_fwd_le/ #X #HLK #H
+ elim (drop_inv_skip2 … H) -H /2 width=1 by ylt_to_minus/ -Hil #K #Y #_ #HVY
+ >(lift_mono … HVY … HVW) -Y -HVW #H destruct /2 width=5 by cpy_subst/
+| #a #I #G #K #V1 #V2 #T1 #T2 #lt #mt #_ #_ #IHV12 #IHT12 #L #U1 #U2 #s #l #m #HLK #H1 #H2 #Hlmtl
+ elim (lift_inv_bind1 … H1) -H1 #VV1 #TT1 #HVV1 #HTT1 #H1
+ elim (lift_inv_bind1 … H2) -H2 #VV2 #TT2 #HVV2 #HTT2 #H2 destruct
+ /4 width=7 by cpy_bind, drop_skip, yle_succ/
+| #G #I #K #V1 #V2 #T1 #T2 #lt #mt #_ #_ #IHV12 #IHT12 #L #U1 #U2 #s #l #m #HLK #H1 #H2 #Hlmtl
+ elim (lift_inv_flat1 … H1) -H1 #VV1 #TT1 #HVV1 #HTT1 #H1
+ elim (lift_inv_flat1 … H2) -H2 #VV2 #TT2 #HVV2 #HTT2 #H2 destruct
+ /3 width=7 by cpy_flat/
+]
+qed-.
+
+lemma cpy_lift_be: ∀G,K,T1,T2,lt,mt. ⦃G, K⦄ ⊢ T1 ▶[lt, mt] T2 →
+ ∀L,U1,U2,s,l,m. ⬇[s, l, m] L ≡ K →
+ ⬆[l, m] T1 ≡ U1 → ⬆[l, m] T2 ≡ U2 →
+ lt ≤ l → l ≤ lt + mt → ⦃G, L⦄ ⊢ U1 ▶[lt, mt + m] U2.
+#G #K #T1 #T2 #lt #mt #H elim H -G -K -T1 -T2 -lt -mt
+[ #I #G #K #lt #mt #L #U1 #U2 #s #l #m #_ #H1 #H2 #_ #_
+ >(lift_mono … H1 … H2) -H1 -H2 //
+| #I #G #K #KV #V #W #i #lt #mt #Hlti #Hilmt #HKV #HVW #L #U1 #U2 #s #l #m #HLK #H #HWU2 #Hltl #_
+ elim (lift_inv_lref1 … H) -H * #Hil #H destruct
+ [ -Hltl
+ lapply (ylt_yle_trans … (lt+mt+m) … Hilmt) // -Hilmt #Hilmtm
+ elim (lift_trans_ge … HVW … HWU2) -W <yplus_inj >yplus_SO2
+ [2: >yplus_O1 /2 width=1 by ylt_fwd_le_succ1/ ] >yminus_succ2 #W #HVW #HWU2
+ elim (drop_trans_le … HLK … HKV) -K /2 width=1 by ylt_fwd_le/ #X #HLK #H
+ elim (drop_inv_skip2 … H) -H /2 width=1 by ylt_to_minus/ -Hil #K #Y #_ #HVY
+ >(lift_mono … HVY … HVW) -V #H destruct /2 width=5 by cpy_subst/
+ | -Hlti
+ lapply (yle_trans … Hltl … Hil) -Hltl #Hlti
+ lapply (lift_trans_be … HVW … HWU2 ? ?) -W /2 width=1 by yle_succ_dx/ >plus_plus_comm_23 #HVU2
+ lapply (drop_trans_ge_comm … HLK … HKV ?) -K // -Hil
+ /3 width=5 by cpy_subst, drop_inv_gen, monotonic_ylt_plus_dx, yle_plus_dx1_trans/
+ ]
+| #a #I #G #K #V1 #V2 #T1 #T2 #lt #mt #_ #_ #IHV12 #IHT12 #L #U1 #U2 #s #l #m #HLK #H1 #H2 #Hltl #Hllmt
+ elim (lift_inv_bind1 … H1) -H1 #VV1 #TT1 #HVV1 #HTT1 #H1
+ elim (lift_inv_bind1 … H2) -H2 #VV2 #TT2 #HVV2 #HTT2 #H2 destruct
+ /4 width=7 by cpy_bind, drop_skip, yle_succ/
+| #I #G #K #V1 #V2 #T1 #T2 #lt #mt #_ #_ #IHV12 #IHT12 #L #U1 #U2 #s #l #m #HLK #H1 #H2 #Hlmtl
+ elim (lift_inv_flat1 … H1) -H1 #VV1 #TT1 #HVV1 #HTT1 #H1
+ elim (lift_inv_flat1 … H2) -H2 #VV2 #TT2 #HVV2 #HTT2 #H2 destruct
+ /3 width=7 by cpy_flat/
+]
+qed-.
+
+(* Basic_1: was: subst1_lift_ge *)
+lemma cpy_lift_ge: ∀G,K,T1,T2,lt,mt. ⦃G, K⦄ ⊢ T1 ▶[lt, mt] T2 →
+ ∀L,U1,U2,s,l,m. ⬇[s, l, m] L ≡ K →
+ ⬆[l, m] T1 ≡ U1 → ⬆[l, m] T2 ≡ U2 →
+ l ≤ lt → ⦃G, L⦄ ⊢ U1 ▶[lt+m, mt] U2.
+#G #K #T1 #T2 #lt #mt #H elim H -G -K -T1 -T2 -lt -mt
+[ #I #G #K #lt #mt #L #U1 #U2 #s #l #m #_ #H1 #H2 #_
+ >(lift_mono … H1 … H2) -H1 -H2 //
+| #I #G #K #KV #V #W #i #lt #mt #Hlti #Hilmt #HKV #HVW #L #U1 #U2 #s #l #m #HLK #H #HWU2 #Hllt
+ lapply (yle_trans … Hllt … Hlti) -Hllt #Hil
+ lapply (lift_inv_lref1_ge … H … Hil) -H #H destruct
+ lapply (lift_trans_be … HVW … HWU2 ? ?) -W /2 width=1 by yle_succ_dx/ >plus_plus_comm_23 #HVU2
+ lapply (drop_trans_ge_comm … HLK … HKV ?) -K // -Hil
+ /3 width=5 by cpy_subst, drop_inv_gen, monotonic_ylt_plus_dx, monotonic_yle_plus_dx/
+| #a #I #G #K #V1 #V2 #T1 #T2 #lt #mt #_ #_ #IHV12 #IHT12 #L #U1 #U2 #s #l #m #HLK #H1 #H2 #Hllt
+ elim (lift_inv_bind1 … H1) -H1 #VV1 #TT1 #HVV1 #HTT1 #H1
+ elim (lift_inv_bind1 … H2) -H2 #VV2 #TT2 #HVV2 #HTT2 #H2 destruct
+ /4 width=6 by cpy_bind, drop_skip, yle_succ/
+| #I #G #K #V1 #V2 #T1 #T2 #lt #mt #_ #_ #IHV12 #IHT12 #L #U1 #U2 #s #l #m #HLK #H1 #H2 #Hllt
+ elim (lift_inv_flat1 … H1) -H1 #VV1 #TT1 #HVV1 #HTT1 #H1
+ elim (lift_inv_flat1 … H2) -H2 #VV2 #TT2 #HVV2 #HTT2 #H2 destruct
+ /3 width=6 by cpy_flat/
+]
+qed-.
+
+(* Inversion lemmas on relocation *******************************************)
+
+(* Basic_1: was: subst1_gen_lift_lt *)
+lemma cpy_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 elim H -G -L -U1 -U2 -lt -mt
+[ * #i #G #L #lt #mt #K #s #l #m #_ #T1 #H #_
+ [ lapply (lift_inv_sort2 … H) -H #H destruct /2 width=3 by ex2_intro/
+ | elim (lift_inv_lref2 … H) -H * #Hil #H destruct /3 width=3 by lift_lref_ge_minus, lift_lref_lt, ex2_intro/
+ | lapply (lift_inv_gref2 … H) -H #H destruct /2 width=3 by ex2_intro/
+ ]
+| #I #G #L #KV #V #W #i #lt #mt #Hlti #Hilmt #HLKV #HVW #K #s #l #m #HLK #T1 #H #Hlmtl
+ lapply (ylt_yle_trans … Hlmtl … Hilmt) -Hlmtl #Hil
+ lapply (lift_inv_lref2_lt … H … Hil) -H #H destruct
+ elim (drop_conf_lt … HLK … HLKV) -L // #L #U #HKL #_ #HUV
+ elim (lift_trans_le … HUV … HVW) -V // >minus_plus <plus_minus_m_m //
+ <yminus_succ2 <yplus_inj >yplus_SO2 >ymax_pre_sn /2 width=1 by ylt_fwd_le_succ1/ -Hil
+ /3 width=5 by cpy_subst, ex2_intro/
+| #a #I #G #L #W1 #W2 #U1 #U2 #lt #mt #_ #_ #IHW12 #IHU12 #K #s #l #m #HLK #X #H #Hlmtl
+ elim (lift_inv_bind2 … H) -H #V1 #T1 #HVW1 #HTU1 #H destruct
+ elim (IHW12 … HLK … HVW1) -IHW12 // #V2 #HV12 #HVW2
+ elim (IHU12 … HTU1) -IHU12 -HTU1
+ /3 width=6 by cpy_bind, yle_succ, drop_skip, lift_bind, ex2_intro/
+| #I #G #L #W1 #W2 #U1 #U2 #lt #mt #_ #_ #IHW12 #IHU12 #K #s #l #m #HLK #X #H #Hlmtl
+ elim (lift_inv_flat2 … H) -H #V1 #T1 #HVW1 #HTU1 #H destruct
+ elim (IHW12 … HLK … HVW1) -W1 //
+ elim (IHU12 … HLK … HTU1) -U1 -HLK
+ /3 width=5 by cpy_flat, lift_flat, ex2_intro/
+]
+qed-.
+
+lemma cpy_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 elim H -G -L -U1 -U2 -lt -mt
+[ * #i #G #L #lt #mt #K #s #l #m #_ #T1 #H #_ #_
+ [ lapply (lift_inv_sort2 … H) -H #H destruct /2 width=3 by ex2_intro/
+ | elim (lift_inv_lref2 … H) -H * #Hil #H destruct /3 width=3 by lift_lref_ge_minus, lift_lref_lt, ex2_intro/
+ | lapply (lift_inv_gref2 … H) -H #H destruct /2 width=3 by ex2_intro/
+ ]
+| #I #G #L #KV #V #W #i #x #mt #Hlti #Hilmt #HLKV #HVW #K #s #l #m #HLK #T1 #H #Hltl #Hlmlmt
+ elim (yle_inv_inj2 … Hlti) -Hlti #lt #Hlti #H destruct
+ lapply (yle_fwd_plus_yge … Hltl Hlmlmt) #Hmmt
+ elim (lift_inv_lref2 … H) -H * #Hil #H destruct [ -Hltl -Hilmt | -Hlti -Hlmlmt ]
+ [ lapply (ylt_yle_trans i l (lt+(mt-m)) ? ?) //
+ [ >yplus_minus_assoc_inj /2 width=1 by yle_plus1_to_minus_inj2/ ] -Hlmlmt #Hilmtm
+ elim (drop_conf_lt … HLK … HLKV) -L // #L #U #HKL #_ #HUV
+ elim (lift_trans_le … HUV … HVW) -V //
+ <yminus_succ2 <yplus_inj >yplus_SO2 >ymax_pre_sn /2 width=1 by ylt_fwd_le_succ1/ -Hil
+ /4 width=5 by cpy_subst, ex2_intro, yle_inj/
+ | elim (yle_inv_plus_inj2 … Hil) #Hlim #Hmi
+ lapply (yle_inv_inj … Hmi) -Hmi #Hmi
+ lapply (yle_trans … Hltl (i-m) ?) // -Hltl #Hltim
+ lapply (drop_conf_ge … HLK … HLKV ?) -L // #HKV
+ elim (lift_split … HVW l (i-m+1)) -HVW [2,3,4: /2 width=1 by yle_succ_dx, le_S_S/ ] -Hil -Hlim
+ #V1 #HV1 >plus_minus // <minus_minus /2 width=1 by le_S/ <minus_n_n <plus_n_O #H
+ @(ex2_intro … H) @(cpy_subst … HKV HV1) // (**) (* explicit constructor *)
+ >yplus_minus_assoc_inj /3 width=1 by monotonic_ylt_minus_dx, yle_inj/
+ ]
+| #a #I #G #L #W1 #W2 #U1 #U2 #lt #mt #_ #_ #IHW12 #IHU12 #K #s #l #m #HLK #X #H #Hltl #Hlmlmt
+ elim (lift_inv_bind2 … H) -H #V1 #T1 #HVW1 #HTU1 #H destruct
+ elim (IHW12 … HLK … HVW1) -IHW12 // #V2 #HV12 #HVW2
+ elim (IHU12 … HTU1) -U1
+ /3 width=6 by cpy_bind, drop_skip, lift_bind, yle_succ, ex2_intro/
+| #I #G #L #W1 #W2 #U1 #U2 #lt #mt #_ #_ #IHW12 #IHU12 #K #s #l #m #HLK #X #H #Hltl #Hlmlmt
+ elim (lift_inv_flat2 … H) -H #V1 #T1 #HVW1 #HTU1 #H destruct
+ elim (IHW12 … HLK … HVW1) -W1 //
+ elim (IHU12 … HLK … HTU1) -U1 -HLK //
+ /3 width=5 by cpy_flat, lift_flat, ex2_intro/
+]
+qed-.
+
+(* Basic_1: was: subst1_gen_lift_ge *)
+lemma cpy_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 elim H -G -L -U1 -U2 -lt -mt
+[ * #i #G #L #lt #mt #K #s #l #m #_ #T1 #H #_
+ [ lapply (lift_inv_sort2 … H) -H #H destruct /2 width=3 by ex2_intro/
+ | elim (lift_inv_lref2 … H) -H * #Hil #H destruct /3 width=3 by lift_lref_ge_minus, lift_lref_lt, ex2_intro/
+ | lapply (lift_inv_gref2 … H) -H #H destruct /2 width=3 by ex2_intro/
+ ]
+| #I #G #L #KV #V #W #i #lt #mt #Hlti #Hilmt #HLKV #HVW #K #s #l #m #HLK #T1 #H #Hlmlt
+ lapply (yle_trans … Hlmlt … Hlti) #Hlmi
+ elim (yle_inv_plus_inj2 … Hlmlt) -Hlmlt #_ #Hmlt
+ elim (yle_inv_plus_inj2 … Hlmi) #Hlim #Hmi
+ lapply (yle_inv_inj … Hmi) -Hmi #Hmi
+ lapply (lift_inv_lref2_ge … H ?) -H // #H destruct
+ lapply (drop_conf_ge … HLK … HLKV ?) -L // #HKV
+ elim (lift_split … HVW l (i-m+1)) -HVW [2,3,4: /3 width=1 by yle_succ, yle_pred_sn, le_S_S/ ] -Hlmi -Hlim
+ #V0 #HV10 >plus_minus // <minus_minus /3 width=1 by le_S/ <minus_n_n <plus_n_O #H
+ @(ex2_intro … H) @(cpy_subst … HKV HV10) (**) (* explicit constructor *)
+ [ /2 width=1 by monotonic_yle_minus_dx/
+ | <yminus_inj <yplus_minus_comm_inj // /3 width=1 by monotonic_ylt_minus_dx, yle_inj/
+ ]
+| #a #I #G #L #W1 #W2 #U1 #U2 #lt #mt #_ #_ #IHW12 #IHU12 #K #s #l #m #HLK #X #H #Hlmtl
+ elim (lift_inv_bind2 … H) -H #V1 #T1 #HVW1 #HTU1 #H destruct
+ elim (yle_inv_plus_inj2 … Hlmtl) #_ #Hmlt
+ elim (IHW12 … HLK … HVW1) -IHW12 // #V2 #HV12 #HVW2
+ elim (IHU12 … HTU1) -U1 [4: @drop_skip // |2,5: skip |3: /2 width=1 by yle_succ/ ]
+ >yminus_succ1_inj /3 width=5 by cpy_bind, lift_bind, ex2_intro/
+| #I #G #L #W1 #W2 #U1 #U2 #lt #mt #_ #_ #IHW12 #IHU12 #K #s #l #m #HLK #X #H #Hlmtl
+ elim (lift_inv_flat2 … H) -H #V1 #T1 #HVW1 #HTU1 #H destruct
+ elim (IHW12 … HLK … HVW1) -W1 //
+ elim (IHU12 … HLK … HTU1) -U1 -HLK /3 width=5 by cpy_flat, lift_flat, ex2_intro/
+]
+qed-.
+
+(* Advanced inversion lemmas on relocation ***********************************)
+
+lemma cpy_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 #HU12 #K #s #l #m #HLK #T1 #HTU1 #Hllt #Hltlm #Hlmlmt
+elim (cpy_split_up … HU12 (l + m)) -HU12 // -Hlmlmt #U #HU1 #HU2
+lapply (cpy_weak … HU1 l m ? ?) -HU1 // [ >ymax_pre_sn_comm // ] -Hllt -Hltlm #HU1
+lapply (cpy_inv_lift1_eq … HTU1 … HU1) -HU1 #HU1 destruct
+elim (cpy_inv_lift1_ge … HU2 … HLK … HTU1) -U -L /2 width=3 by ex2_intro/
+qed-.
+
+lemma cpy_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 #HU12 #K #s #l #m #HLK #T1 #HTU1 #Hltl #Hlmtlm
+lapply (cpy_weak … HU12 lt (l+m-lt) ? ?) -HU12 //
+[ >ymax_pre_sn_comm /2 width=1 by yle_plus_dx1_trans/ ] -Hlmtlm #HU12
+elim (cpy_inv_lift1_be … HU12 … HLK … HTU1) -U1 -L /2 width=3 by ex2_intro/
+qed-.
+
+lemma cpy_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 #HU12 #K #s #l #m #HLK #T1 #HTU1 #Hltl #Hllmt #Hlmtlm
+elim (cpy_split_up … HU12 l) -HU12 // #U #HU1 #HU2
+elim (cpy_inv_lift1_le … HU1 … HLK … HTU1) -U1
+[2: >ymax_pre_sn_comm // ] -Hltl #T #HT1 #HTU
+lapply (cpy_weak … HU2 l m ? ?) -HU2 //
+[ >ymax_pre_sn_comm // ] -Hllmt -Hlmtlm #HU2
+lapply (cpy_inv_lift1_eq … HTU … HU2) -L #H 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/substitution/lift_neg.ma".
+include "basic_2/substitution/lift_lift.ma".
+include "basic_2/substitution/cpy.ma".
+
+(* CONTEXT-SENSITIVE EXTENDED ORDINARY SUBSTITUTION FOR TERMS ***************)
+
+(* Inversion lemmas on negated relocation ***********************************)
+
+lemma cpy_fwd_nlift2_ge: ∀G,L,U1,U2,l,m. ⦃G, L⦄ ⊢ U1 ▶[l, m] U2 →
+ ∀i. l ≤ i → (∀T2. ⬆[i, 1] T2 ≡ U2 → ⊥) →
+ (∀T1. ⬆[i, 1] T1 ≡ U1 → ⊥) ∨
+ ∃∃I,K,W,j. l ≤ yinj j & j < i & ⬇[j]L ≡ K.ⓑ{I}W &
+ (∀V. ⬆[⫰(i-j), 1] V ≡ W → ⊥) & (∀T1. ⬆[j, 1] T1 ≡ U1 → ⊥).
+#G #L #U1 #U2 #l #m #H elim H -G -L -U1 -U2 -l -m
+[ /3 width=2 by or_introl/
+| #I #G #L #K #V #W #j #l #m #Hlj #Hjlm #HLK #HVW #i #Hli #HnW
+ elim (ylt_split j i) #Hij
+ [ @or_intror @(ex5_4_intro … HLK) // -HLK
+ [ #X #HXV elim (lift_trans_le … HXV … HVW ?) -V // #Y #HXY
+ <yminus_succ2 <yplus_inj >yplus_SO2 >ymax_pre_sn /2 width=2 by ylt_fwd_le_succ1/
+ | -HnW /3 width=7 by lift_inv_lref2_be, ylt_inj/
+ ]
+ | elim (lift_split … HVW i j) -HVW //
+ #X #_ #H elim HnW -HnW //
+ ]
+| #a #I #G #L #W1 #W2 #U1 #U2 #l #m #_ #_ #IHW12 #IHU12 #i #Hli #H elim (nlift_inv_bind … H) -H
+ [ #HnW2 elim (IHW12 … HnW2) -IHW12 -HnW2 -IHU12 //
+ [ /4 width=9 by nlift_bind_sn, or_introl/
+ | * /5 width=9 by nlift_bind_sn, ex5_4_intro, or_intror/
+ ]
+ | #HnU2 elim (IHU12 … HnU2) -IHU12 -HnU2 -IHW12 /2 width=1 by yle_succ/
+ [ /4 width=9 by nlift_bind_dx, or_introl/
+ | * #J #K #W #j #Hlj elim (yle_inv_succ1 … Hlj) -Hlj #Hlj #Hj
+ <Hj >yminus_succ #Hji #HLK #HnW
+ lapply (drop_inv_drop1_lt … HLK ?) /2 width=1 by ylt_O/ -HLK #HLK
+ <yminus_SO2 in Hlj; #Hlj #H4
+ @or_intror @(ex5_4_intro … HLK) (**) (* explicit constructors *)
+ /3 width=9 by nlift_bind_dx, ylt_pred, ylt_inj/
+ ]
+ ]
+| #I #G #L #W1 #W2 #U1 #U2 #l #m #_ #_ #IHW12 #IHU12 #i #Hli #H elim (nlift_inv_flat … H) -H
+ [ #HnW2 elim (IHW12 … HnW2) -IHW12 -HnW2 -IHU12 //
+ [ /4 width=9 by nlift_flat_sn, or_introl/
+ | * /5 width=9 by nlift_flat_sn, ex5_4_intro, or_intror/
+ ]
+ | #HnU2 elim (IHU12 … HnU2) -IHU12 -HnU2 -IHW12 //
+ [ /4 width=9 by nlift_flat_dx, or_introl/
+ | * /5 width=9 by nlift_flat_dx, ex5_4_intro, or_intror/
+ ]
+]
+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/predreducible_3.ma".
+include "basic_2/grammar/genv.ma".
+include "basic_2/substitution/drop.ma".
+
+(* REDUCIBLE TERMS FOR CONTEXT-SENSITIVE REDUCTION **************************)
+
+(* reducible binary items *)
+definition ri2: predicate item2 ≝
+ λI. I = Bind2 true Abbr ∨ I = Flat2 Cast.
+
+(* irreducible binary binders *)
+definition ib2: relation2 bool bind2 ≝
+ λa,I. I = Abst ∨ Bind2 a I = Bind2 false Abbr.
+
+(* activate genv *)
+(* reducible terms *)
+inductive crr (G:genv): relation2 lenv term ≝
+| crr_delta : ∀L,K,V,i. ⬇[i] L ≡ K.ⓓV → crr G L (#i)
+| crr_appl_sn: ∀L,V,T. crr G L V → crr G L (ⓐV.T)
+| crr_appl_dx: ∀L,V,T. crr G L T → crr G L (ⓐV.T)
+| crr_ri2 : ∀I,L,V,T. ri2 I → crr G L (②{I}V.T)
+| crr_ib2_sn : ∀a,I,L,V,T. ib2 a I → crr G L V → crr G L (ⓑ{a,I}V.T)
+| crr_ib2_dx : ∀a,I,L,V,T. ib2 a I → crr G (L.ⓑ{I}V) T → crr G L (ⓑ{a,I}V.T)
+| crr_beta : ∀a,L,V,W,T. crr G L (ⓐV.ⓛ{a}W.T)
+| crr_theta : ∀a,L,V,W,T. crr G L (ⓐV.ⓓ{a}W.T)
+.
+
+interpretation
+ "reducibility for context-sensitive reduction (term)"
+ 'PRedReducible G L T = (crr G L T).
+
+(* Basic inversion lemmas ***************************************************)
+
+fact crr_inv_sort_aux: ∀G,L,T,s. ⦃G, L⦄ ⊢ ➡ 𝐑⦃T⦄ → T = ⋆s → ⊥.
+#G #L #T #s0 * -L -T
+[ #L #K #V #i #HLK #H destruct
+| #L #V #T #_ #H destruct
+| #L #V #T #_ #H destruct
+| #I #L #V #T #_ #H destruct
+| #a #I #L #V #T #_ #_ #H destruct
+| #a #I #L #V #T #_ #_ #H destruct
+| #a #L #V #W #T #H destruct
+| #a #L #V #W #T #H destruct
+]
+qed-.
+
+lemma crr_inv_sort: ∀G,L,s. ⦃G, L⦄ ⊢ ➡ 𝐑⦃⋆s⦄ → ⊥.
+/2 width=6 by crr_inv_sort_aux/ qed-.
+
+fact crr_inv_lref_aux: ∀G,L,T,i. ⦃G, L⦄ ⊢ ➡ 𝐑⦃T⦄ → T = #i →
+ ∃∃K,V. ⬇[i] L ≡ K.ⓓV.
+#G #L #T #j * -L -T
+[ #L #K #V #i #HLK #H destruct /2 width=3 by ex1_2_intro/
+| #L #V #T #_ #H destruct
+| #L #V #T #_ #H destruct
+| #I #L #V #T #_ #H destruct
+| #a #I #L #V #T #_ #_ #H destruct
+| #a #I #L #V #T #_ #_ #H destruct
+| #a #L #V #W #T #H destruct
+| #a #L #V #W #T #H destruct
+]
+qed-.
+
+lemma crr_inv_lref: ∀G,L,i. ⦃G, L⦄ ⊢ ➡ 𝐑⦃#i⦄ → ∃∃K,V. ⬇[i] L ≡ K.ⓓV.
+/2 width=4 by crr_inv_lref_aux/ qed-.
+
+fact crr_inv_gref_aux: ∀G,L,T,p. ⦃G, L⦄ ⊢ ➡ 𝐑⦃T⦄ → T = §p → ⊥.
+#G #L #T #q * -L -T
+[ #L #K #V #i #HLK #H destruct
+| #L #V #T #_ #H destruct
+| #L #V #T #_ #H destruct
+| #I #L #V #T #_ #H destruct
+| #a #I #L #V #T #_ #_ #H destruct
+| #a #I #L #V #T #_ #_ #H destruct
+| #a #L #V #W #T #H destruct
+| #a #L #V #W #T #H destruct
+]
+qed-.
+
+lemma crr_inv_gref: ∀G,L,p. ⦃G, L⦄ ⊢ ➡ 𝐑⦃§p⦄ → ⊥.
+/2 width=6 by crr_inv_gref_aux/ qed-.
+
+lemma trr_inv_atom: ∀G,I. ⦃G, ⋆⦄ ⊢ ➡ 𝐑⦃⓪{I}⦄ → ⊥.
+#G * #i #H
+[ elim (crr_inv_sort … H)
+| elim (crr_inv_lref … H) -H #L #V #H
+ elim (drop_inv_atom1 … H) -H #H destruct
+| elim (crr_inv_gref … H)
+]
+qed-.
+
+fact crr_inv_ib2_aux: ∀a,I,G,L,W,U,T. ib2 a I → ⦃G, L⦄ ⊢ ➡ 𝐑⦃T⦄ → T = ⓑ{a,I}W.U →
+ ⦃G, L⦄ ⊢ ➡ 𝐑⦃W⦄ ∨ ⦃G, L.ⓑ{I}W⦄ ⊢ ➡ 𝐑⦃U⦄.
+#G #b #J #L #W0 #U #T #HI * -L -T
+[ #L #K #V #i #_ #H destruct
+| #L #V #T #_ #H destruct
+| #L #V #T #_ #H destruct
+| #I #L #V #T #H1 #H2 destruct
+ elim H1 -H1 #H destruct
+ elim HI -HI #H destruct
+| #a #I #L #V #T #_ #HV #H destruct /2 width=1 by or_introl/
+| #a #I #L #V #T #_ #HT #H destruct /2 width=1 by or_intror/
+| #a #L #V #W #T #H destruct
+| #a #L #V #W #T #H destruct
+]
+qed-.
+
+lemma crr_inv_ib2: ∀a,I,G,L,W,T. ib2 a I → ⦃G, L⦄ ⊢ ➡ 𝐑⦃ⓑ{a,I}W.T⦄ →
+ ⦃G, L⦄ ⊢ ➡ 𝐑⦃W⦄ ∨ ⦃G, L.ⓑ{I}W⦄ ⊢ ➡ 𝐑⦃T⦄.
+/2 width=5 by crr_inv_ib2_aux/ qed-.
+
+fact crr_inv_appl_aux: ∀G,L,W,U,T. ⦃G, L⦄ ⊢ ➡ 𝐑⦃T⦄ → T = ⓐW.U →
+ ∨∨ ⦃G, L⦄ ⊢ ➡ 𝐑⦃W⦄ | ⦃G, L⦄ ⊢ ➡ 𝐑⦃U⦄ | (𝐒⦃U⦄ → ⊥).
+#G #L #W0 #U #T * -L -T
+[ #L #K #V #i #_ #H destruct
+| #L #V #T #HV #H destruct /2 width=1 by or3_intro0/
+| #L #V #T #HT #H destruct /2 width=1 by or3_intro1/
+| #I #L #V #T #H1 #H2 destruct
+ elim H1 -H1 #H destruct
+| #a #I #L #V #T #_ #_ #H destruct
+| #a #I #L #V #T #_ #_ #H destruct
+| #a #L #V #W #T #H destruct
+ @or3_intro2 #H elim (simple_inv_bind … H)
+| #a #L #V #W #T #H destruct
+ @or3_intro2 #H elim (simple_inv_bind … H)
+]
+qed-.
+
+lemma crr_inv_appl: ∀G,L,V,T. ⦃G, L⦄ ⊢ ➡ 𝐑⦃ⓐV.T⦄ →
+ ∨∨ ⦃G, L⦄ ⊢ ➡ 𝐑⦃V⦄ | ⦃G, L⦄ ⊢ ➡ 𝐑⦃T⦄ | (𝐒⦃T⦄ → ⊥).
+/2 width=3 by crr_inv_appl_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/drop_drop.ma".
+include "basic_2/reduction/crr.ma".
+
+(* REDUCIBLE TERMS FOR CONTEXT-SENSITIVE REDUCTION **************************)
+
+(* Properties on relocation *************************************************)
+
+lemma crr_lift: ∀G,K,T. ⦃G, K⦄ ⊢ ➡ 𝐑⦃T⦄ → ∀L,c,l,k. ⬇[c, l, k] L ≡ K →
+ ∀U. ⬆[l, k] T ≡ U → ⦃G, L⦄ ⊢ ➡ 𝐑⦃U⦄.
+#G #K #T #H elim H -K -T
+[ #K #K0 #V #i #HK0 #L #c #l #k #HLK #X #H
+ elim (lift_inv_lref1 … H) -H * #Hil #H destruct
+ [ elim (drop_trans_lt … HLK … HK0) -K /2 width=4 by crr_delta/
+ | lapply (drop_trans_ge … HLK … HK0 ?) -K /3 width=4 by crr_delta, drop_inv_gen/
+ ]
+| #K #V #T #_ #IHV #L #c #l #k #HLK #X #H
+ elim (lift_inv_flat1 … H) -H #W #U #HVW #_ #H destruct /3 width=5 by crr_appl_sn/
+| #K #V #T #_ #IHT #L #c #l #k #HLK #X #H
+ elim (lift_inv_flat1 … H) -H #W #U #_ #HTU #H destruct /3 width=5 by crr_appl_dx/
+| #I #K #V #T #HI #L #c #l #k #_ #X #H
+ elim (lift_fwd_pair1 … H) -H #W #U #_ #H destruct /2 width=1 by crr_ri2/
+| #a #I #K #V #T #HI #_ #IHV #L #c #l #k #HLK #X #H
+ elim (lift_inv_bind1 … H) -H #W #U #HVW #_ #H destruct /3 width=5 by crr_ib2_sn/
+| #a #I #K #V #T #HI #_ #IHT #L #c #l #k #HLK #X #H
+ elim (lift_inv_bind1 … H) -H #W #U #HVW #HTU #H destruct /4 width=5 by crr_ib2_dx, drop_skip/
+| #a #K #V #V0 #T #L #c #l #k #_ #X #H
+ elim (lift_inv_flat1 … H) -H #W #X0 #_ #H0 #H destruct
+ elim (lift_inv_bind1 … H0) -H0 #W0 #U #_ #_ #H0 destruct /2 width=1 by crr_beta/
+| #a #K #V #V0 #T #L #c #l #k #_ #X #H
+ elim (lift_inv_flat1 … H) -H #W #X0 #_ #H0 #H destruct
+ elim (lift_inv_bind1 … H0) -H0 #W0 #U #_ #_ #H0 destruct /2 width=1 by crr_theta/
+]
+qed.
+
+lemma crr_inv_lift: ∀G,L,U. ⦃G, L⦄ ⊢ ➡ 𝐑⦃U⦄ → ∀K,c,l,k. ⬇[c, l, k] L ≡ K →
+ ∀T. ⬆[l, k] T ≡ U → ⦃G, K⦄ ⊢ ➡ 𝐑⦃T⦄.
+#G #L #U #H elim H -L -U
+[ #L #L0 #W #i #HK0 #K #c #l #k #HLK #X #H
+ elim (lift_inv_lref2 … H) -H * #Hil #H destruct
+ [ elim (drop_conf_lt … HLK … HK0) -L /2 width=4 by crr_delta/
+ | lapply (drop_conf_ge … HLK … HK0 ?) -L /2 width=4 by crr_delta/
+ ]
+| #L #W #U #_ #IHW #K #c #l #k #HLK #X #H
+ elim (lift_inv_flat2 … H) -H #V #T #HVW #_ #H destruct /3 width=5 by crr_appl_sn/
+| #L #W #U #_ #IHU #K #c #l #k #HLK #X #H
+ elim (lift_inv_flat2 … H) -H #V #T #_ #HTU #H destruct /3 width=5 by crr_appl_dx/
+| #I #L #W #U #HI #K #c #l #k #_ #X #H
+ elim (lift_fwd_pair2 … H) -H #V #T #_ #H destruct /2 width=1 by crr_ri2/
+| #a #I #L #W #U #HI #_ #IHW #K #c #l #k #HLK #X #H
+ elim (lift_inv_bind2 … H) -H #V #T #HVW #_ #H destruct /3 width=5 by crr_ib2_sn/
+| #a #I #L #W #U #HI #_ #IHU #K #c #l #k #HLK #X #H
+ elim (lift_inv_bind2 … H) -H #V #T #HVW #HTU #H destruct /4 width=5 by crr_ib2_dx, drop_skip/
+| #a #L #W #W0 #U #K #c #l #k #_ #X #H
+ elim (lift_inv_flat2 … H) -H #V #X0 #_ #H0 #H destruct
+ elim (lift_inv_bind2 … H0) -H0 #V0 #T #_ #_ #H0 destruct /2 width=1 by crr_beta/
+| #a #L #W #W0 #U #K #c #l #k #_ #X #H
+ elim (lift_inv_flat2 … H) -H #V #X0 #_ #H0 #H destruct
+ elim (lift_inv_bind2 … H0) -H0 #V0 #T #_ #_ #H0 destruct /2 width=1 by crr_theta/
+]
+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 *)
+(* *)
+(**************************************************************************)
+
+(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
+
+notation "hvbox( ⦃ term 46 G , break term 46 L ⦄ ⊢ ➡ 𝐑 break ⦃ term 46 T ⦄ )"
+ non associative with precedence 45
+ for @{ 'PRedReducible $G $L $T }.
--- /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/predreducible_5.ma".
+include "basic_2/static/sd.ma".
+include "basic_2/reduction/crr.ma".
+
+(* REDUCIBLE TERMS FOR CONTEXT-SENSITIVE EXTENDED REDUCTION *****************)
+
+(* activate genv *)
+(* extended reducible terms *)
+inductive crx (h) (o) (G:genv): relation2 lenv term ≝
+| crx_sort : ∀L,s,d. deg h o s (d+1) → crx h o G L (⋆s)
+| crx_delta : ∀I,L,K,V,i. ⬇[i] L ≡ K.ⓑ{I}V → crx h o G L (#i)
+| crx_appl_sn: ∀L,V,T. crx h o G L V → crx h o G L (ⓐV.T)
+| crx_appl_dx: ∀L,V,T. crx h o G L T → crx h o G L (ⓐV.T)
+| crx_ri2 : ∀I,L,V,T. ri2 I → crx h o G L (②{I}V.T)
+| crx_ib2_sn : ∀a,I,L,V,T. ib2 a I → crx h o G L V → crx h o G L (ⓑ{a,I}V.T)
+| crx_ib2_dx : ∀a,I,L,V,T. ib2 a I → crx h o G (L.ⓑ{I}V) T → crx h o G L (ⓑ{a,I}V.T)
+| crx_beta : ∀a,L,V,W,T. crx h o G L (ⓐV. ⓛ{a}W.T)
+| crx_theta : ∀a,L,V,W,T. crx h o G L (ⓐV. ⓓ{a}W.T)
+.
+
+interpretation
+ "reducibility for context-sensitive extended reduction (term)"
+ 'PRedReducible h o G L T = (crx h o G L T).
+
+(* Basic properties *********************************************************)
+
+lemma crr_crx: ∀h,o,G,L,T. ⦃G, L⦄ ⊢ ➡ 𝐑⦃T⦄ → ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃T⦄.
+#h #o #G #L #T #H elim H -L -T
+/2 width=4 by crx_delta, crx_appl_sn, crx_appl_dx, crx_ri2, crx_ib2_sn, crx_ib2_dx, crx_beta, crx_theta/
+qed.
+
+(* Basic inversion lemmas ***************************************************)
+
+fact crx_inv_sort_aux: ∀h,o,G,L,T,s. ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃T⦄ → T = ⋆s →
+ ∃d. deg h o s (d+1).
+#h #o #G #L #T #s0 * -L -T
+[ #L #s #d #Hkd #H destruct /2 width=2 by ex_intro/
+| #I #L #K #V #i #HLK #H destruct
+| #L #V #T #_ #H destruct
+| #L #V #T #_ #H destruct
+| #I #L #V #T #_ #H destruct
+| #a #I #L #V #T #_ #_ #H destruct
+| #a #I #L #V #T #_ #_ #H destruct
+| #a #L #V #W #T #H destruct
+| #a #L #V #W #T #H destruct
+]
+qed-.
+
+lemma crx_inv_sort: ∀h,o,G,L,s. ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃⋆s⦄ → ∃d. deg h o s (d+1).
+/2 width=5 by crx_inv_sort_aux/ qed-.
+
+fact crx_inv_lref_aux: ∀h,o,G,L,T,i. ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃T⦄ → T = #i →
+ ∃∃I,K,V. ⬇[i] L ≡ K.ⓑ{I}V.
+#h #o #G #L #T #j * -L -T
+[ #L #s #d #_ #H destruct
+| #I #L #K #V #i #HLK #H destruct /2 width=4 by ex1_3_intro/
+| #L #V #T #_ #H destruct
+| #L #V #T #_ #H destruct
+| #I #L #V #T #_ #H destruct
+| #a #I #L #V #T #_ #_ #H destruct
+| #a #I #L #V #T #_ #_ #H destruct
+| #a #L #V #W #T #H destruct
+| #a #L #V #W #T #H destruct
+]
+qed-.
+
+lemma crx_inv_lref: ∀h,o,G,L,i. ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃#i⦄ → ∃∃I,K,V. ⬇[i] L ≡ K.ⓑ{I}V.
+/2 width=6 by crx_inv_lref_aux/ qed-.
+
+fact crx_inv_gref_aux: ∀h,o,G,L,T,p. ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃T⦄ → T = §p → ⊥.
+#h #o #G #L #T #q * -L -T
+[ #L #s #d #_ #H destruct
+| #I #L #K #V #i #HLK #H destruct
+| #L #V #T #_ #H destruct
+| #L #V #T #_ #H destruct
+| #I #L #V #T #_ #H destruct
+| #a #I #L #V #T #_ #_ #H destruct
+| #a #I #L #V #T #_ #_ #H destruct
+| #a #L #V #W #T #H destruct
+| #a #L #V #W #T #H destruct
+]
+qed-.
+
+lemma crx_inv_gref: ∀h,o,G,L,p. ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃§p⦄ → ⊥.
+/2 width=8 by crx_inv_gref_aux/ qed-.
+
+lemma trx_inv_atom: ∀h,o,I,G. ⦃G, ⋆⦄ ⊢ ➡[h, o] 𝐑⦃⓪{I}⦄ →
+ ∃∃s,d. deg h o s (d+1) & I = Sort s.
+#h #o * #i #G #H
+[ elim (crx_inv_sort … H) -H /2 width=4 by ex2_2_intro/
+| elim (crx_inv_lref … H) -H #I #L #V #H
+ elim (drop_inv_atom1 … H) -H #H destruct
+| elim (crx_inv_gref … H)
+]
+qed-.
+
+fact crx_inv_ib2_aux: ∀h,o,a,I,G,L,W,U,T. ib2 a I → ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃T⦄ →
+ T = ⓑ{a,I}W.U → ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃W⦄ ∨ ⦃G, L.ⓑ{I}W⦄ ⊢ ➡[h, o] 𝐑⦃U⦄.
+#h #o #b #J #G #L #W0 #U #T #HI * -L -T
+[ #L #s #d #_ #H destruct
+| #I #L #K #V #i #_ #H destruct
+| #L #V #T #_ #H destruct
+| #L #V #T #_ #H destruct
+| #I #L #V #T #H1 #H2 destruct
+ elim H1 -H1 #H destruct
+ elim HI -HI #H destruct
+| #a #I #L #V #T #_ #HV #H destruct /2 width=1 by or_introl/
+| #a #I #L #V #T #_ #HT #H destruct /2 width=1 by or_intror/
+| #a #L #V #W #T #H destruct
+| #a #L #V #W #T #H destruct
+]
+qed-.
+
+lemma crx_inv_ib2: ∀h,o,a,I,G,L,W,T. ib2 a I → ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃ⓑ{a,I}W.T⦄ →
+ ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃W⦄ ∨ ⦃G, L.ⓑ{I}W⦄ ⊢ ➡[h, o] 𝐑⦃T⦄.
+/2 width=5 by crx_inv_ib2_aux/ qed-.
+
+fact crx_inv_appl_aux: ∀h,o,G,L,W,U,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃T⦄ → T = ⓐW.U →
+ ∨∨ ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃W⦄ | ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃U⦄ | (𝐒⦃U⦄ → ⊥).
+#h #o #G #L #W0 #U #T * -L -T
+[ #L #s #d #_ #H destruct
+| #I #L #K #V #i #_ #H destruct
+| #L #V #T #HV #H destruct /2 width=1 by or3_intro0/
+| #L #V #T #HT #H destruct /2 width=1 by or3_intro1/
+| #I #L #V #T #H1 #H2 destruct
+ elim H1 -H1 #H destruct
+| #a #I #L #V #T #_ #_ #H destruct
+| #a #I #L #V #T #_ #_ #H destruct
+| #a #L #V #W #T #H destruct
+ @or3_intro2 #H elim (simple_inv_bind … H)
+| #a #L #V #W #T #H destruct
+ @or3_intro2 #H elim (simple_inv_bind … H)
+]
+qed-.
+
+lemma crx_inv_appl: ∀h,o,G,L,V,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃ⓐV.T⦄ →
+ ∨∨ ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃V⦄ | ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃T⦄ | (𝐒⦃T⦄ → ⊥).
+/2 width=3 by crx_inv_appl_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/drop_drop.ma".
+include "basic_2/reduction/crx.ma".
+
+(* REDUCIBLE TERMS FOR CONTEXT-SENSITIVE EXTENDED REDUCTION *****************)
+
+(* Properties on relocation *************************************************)
+
+lemma crx_lift: ∀h,o,G,K,T. ⦃G, K⦄ ⊢ ➡[h, o] 𝐑⦃T⦄ → ∀L,c,l,k. ⬇[c, l, k] L ≡ K →
+ ∀U. ⬆[l, k] T ≡ U → ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃U⦄.
+#h #o #G #K #T #H elim H -K -T
+[ #K #s #d #Hkd #L #c #l #k #_ #X #H
+ >(lift_inv_sort1 … H) -X /2 width=2 by crx_sort/
+| #I #K #K0 #V #i #HK0 #L #c #l #k #HLK #X #H
+ elim (lift_inv_lref1 … H) -H * #Hil #H destruct
+ [ elim (drop_trans_lt … HLK … HK0) -K /2 width=4 by crx_delta/
+ | lapply (drop_trans_ge … HLK … HK0 ?) -K /3 width=5 by crx_delta, drop_inv_gen/
+ ]
+| #K #V #T #_ #IHV #L #c #l #k #HLK #X #H
+ elim (lift_inv_flat1 … H) -H #W #U #HVW #_ #H destruct /3 width=5 by crx_appl_sn/
+| #K #V #T #_ #IHT #L #c #l #k #HLK #X #H
+ elim (lift_inv_flat1 … H) -H #W #U #_ #HTU #H destruct /3 width=5 by crx_appl_dx/
+| #I #K #V #T #HI #L #c #l #k #_ #X #H
+ elim (lift_fwd_pair1 … H) -H #W #U #_ #H destruct /2 width=1 by crx_ri2/
+| #a #I #K #V #T #HI #_ #IHV #L #c #l #k #HLK #X #H
+ elim (lift_inv_bind1 … H) -H #W #U #HVW #_ #H destruct /3 width=5 by crx_ib2_sn/
+| #a #I #K #V #T #HI #_ #IHT #L #c #l #k #HLK #X #H
+ elim (lift_inv_bind1 … H) -H #W #U #HVW #HTU #H destruct /4 width=5 by crx_ib2_dx, drop_skip/
+| #a #K #V #V0 #T #L #c #l #k #_ #X #H
+ elim (lift_inv_flat1 … H) -H #W #X0 #_ #H0 #H destruct
+ elim (lift_inv_bind1 … H0) -H0 #W0 #U #_ #_ #H0 destruct /2 width=1 by crx_beta/
+| #a #K #V #V0 #T #L #c #l #k #_ #X #H
+ elim (lift_inv_flat1 … H) -H #W #X0 #_ #H0 #H destruct
+ elim (lift_inv_bind1 … H0) -H0 #W0 #U #_ #_ #H0 destruct /2 width=1 by crx_theta/
+]
+qed.
+
+lemma crx_inv_lift: ∀h,o,G,L,U. ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃U⦄ → ∀K,c,l,k. ⬇[c, l, k] L ≡ K →
+ ∀T. ⬆[l, k] T ≡ U → ⦃G, K⦄ ⊢ ➡[h, o] 𝐑⦃T⦄.
+#h #o #G #L #U #H elim H -L -U
+[ #L #s #d #Hkd #K #c #l #k #_ #X #H
+ >(lift_inv_sort2 … H) -X /2 width=2 by crx_sort/
+| #I #L #L0 #W #i #HK0 #K #c #l #k #HLK #X #H
+ elim (lift_inv_lref2 … H) -H * #Hil #H destruct
+ [ elim (drop_conf_lt … HLK … HK0) -L /2 width=4 by crx_delta/
+ | lapply (drop_conf_ge … HLK … HK0 ?) -L /2 width=4 by crx_delta/
+ ]
+| #L #W #U #_ #IHW #K #c #l #k #HLK #X #H
+ elim (lift_inv_flat2 … H) -H #V #T #HVW #_ #H destruct /3 width=5 by crx_appl_sn/
+| #L #W #U #_ #IHU #K #c #l #k #HLK #X #H
+ elim (lift_inv_flat2 … H) -H #V #T #_ #HTU #H destruct /3 width=5 by crx_appl_dx/
+| #I #L #W #U #HI #K #c #l #k #_ #X #H
+ elim (lift_fwd_pair2 … H) -H #V #T #_ #H destruct /2 width=1 by crx_ri2/
+| #a #I #L #W #U #HI #_ #IHW #K #c #l #k #HLK #X #H
+ elim (lift_inv_bind2 … H) -H #V #T #HVW #_ #H destruct /3 width=5 by crx_ib2_sn/
+| #a #I #L #W #U #HI #_ #IHU #K #c #l #k #HLK #X #H
+ elim (lift_inv_bind2 … H) -H #V #T #HVW #HTU #H destruct /4 width=5 by crx_ib2_dx, drop_skip/
+| #a #L #W #W0 #U #K #c #l #k #_ #X #H
+ elim (lift_inv_flat2 … H) -H #V #X0 #_ #H0 #H destruct
+ elim (lift_inv_bind2 … H0) -H0 #V0 #T #_ #_ #H0 destruct /2 width=1 by crx_beta/
+| #a #L #W #W0 #U #K #c #l #k #_ #X #H
+ elim (lift_inv_flat2 … H) -H #V #X0 #_ #H0 #H destruct
+ elim (lift_inv_bind2 … H0) -H0 #V0 #T #_ #_ #H0 destruct /2 width=1 by crx_theta/
+]
+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 *)
+(* *)
+(**************************************************************************)
+
+(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
+
+notation "hvbox( ⦃ term 46 G, break term 46 L ⦄ ⊢ ➡ break [ term 46 o , break term 46 h ] 𝐑 break ⦃ term 46 T ⦄ )"
+ non associative with precedence 45
+ for @{ 'PRedReducible $h $o $G $L $T }.
--- /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/degree_6.ma".
+include "basic_2/grammar/genv.ma".
+include "basic_2/substitution/drop.ma".
+include "basic_2/static/sd.ma".
+
+(* DEGREE ASSIGNMENT FOR TERMS **********************************************)
+
+(* activate genv *)
+inductive da (h:sh) (o:sd h): relation4 genv lenv term nat ≝
+| da_sort: ∀G,L,s,d. deg h o s d → da h o G L (⋆s) d
+| da_ldef: ∀G,L,K,V,i,d. ⬇[i] L ≡ K.ⓓV → da h o G K V d → da h o G L (#i) d
+| da_ldec: ∀G,L,K,W,i,d. ⬇[i] L ≡ K.ⓛW → da h o G K W d → da h o G L (#i) (d+1)
+| da_bind: ∀a,I,G,L,V,T,d. da h o G (L.ⓑ{I}V) T d → da h o G L (ⓑ{a,I}V.T) d
+| da_flat: ∀I,G,L,V,T,d. da h o G L T d → da h o G L (ⓕ{I}V.T) d
+.
+
+interpretation "degree assignment (term)"
+ 'Degree h o G L T d = (da h o G L T d).
+
+(* Basic inversion lemmas ***************************************************)
+
+fact da_inv_sort_aux: ∀h,o,G,L,T,d. ⦃G, L⦄ ⊢ T ▪[h, o] d →
+ ∀s0. T = ⋆s0 → deg h o s0 d.
+#h #o #G #L #T #d * -G -L -T -d
+[ #G #L #s #d #Hkd #s0 #H destruct //
+| #G #L #K #V #i #d #_ #_ #s0 #H destruct
+| #G #L #K #W #i #d #_ #_ #s0 #H destruct
+| #a #I #G #L #V #T #d #_ #s0 #H destruct
+| #I #G #L #V #T #d #_ #s0 #H destruct
+]
+qed-.
+
+lemma da_inv_sort: ∀h,o,G,L,s,d. ⦃G, L⦄ ⊢ ⋆s ▪[h, o] d → deg h o s d.
+/2 width=5 by da_inv_sort_aux/ qed-.
+
+fact da_inv_lref_aux: ∀h,o,G,L,T,d. ⦃G, L⦄ ⊢ T ▪[h, o] d → ∀j. T = #j →
+ (∃∃K,V. ⬇[j] L ≡ K.ⓓV & ⦃G, K⦄ ⊢ V ▪[h, o] d) ∨
+ (∃∃K,W,d0. ⬇[j] L ≡ K.ⓛW & ⦃G, K⦄ ⊢ W ▪[h, o] d0 &
+ d = d0 + 1
+ ).
+#h #o #G #L #T #d * -G -L -T -d
+[ #G #L #s #d #_ #j #H destruct
+| #G #L #K #V #i #d #HLK #HV #j #H destruct /3 width=4 by ex2_2_intro, or_introl/
+| #G #L #K #W #i #d #HLK #HW #j #H destruct /3 width=6 by ex3_3_intro, or_intror/
+| #a #I #G #L #V #T #d #_ #j #H destruct
+| #I #G #L #V #T #d #_ #j #H destruct
+]
+qed-.
+
+lemma da_inv_lref: ∀h,o,G,L,j,d. ⦃G, L⦄ ⊢ #j ▪[h, o] d →
+ (∃∃K,V. ⬇[j] L ≡ K.ⓓV & ⦃G, K⦄ ⊢ V ▪[h, o] d) ∨
+ (∃∃K,W,d0. ⬇[j] L ≡ K.ⓛW & ⦃G, K⦄ ⊢ W ▪[h, o] d0 & d = d0+1).
+/2 width=3 by da_inv_lref_aux/ qed-.
+
+fact da_inv_gref_aux: ∀h,o,G,L,T,d. ⦃G, L⦄ ⊢ T ▪[h, o] d → ∀p0. T = §p0 → ⊥.
+#h #o #G #L #T #d * -G -L -T -d
+[ #G #L #s #d #_ #p0 #H destruct
+| #G #L #K #V #i #d #_ #_ #p0 #H destruct
+| #G #L #K #W #i #d #_ #_ #p0 #H destruct
+| #a #I #G #L #V #T #d #_ #p0 #H destruct
+| #I #G #L #V #T #d #_ #p0 #H destruct
+]
+qed-.
+
+lemma da_inv_gref: ∀h,o,G,L,p,d. ⦃G, L⦄ ⊢ §p ▪[h, o] d → ⊥.
+/2 width=9 by da_inv_gref_aux/ qed-.
+
+fact da_inv_bind_aux: ∀h,o,G,L,T,d. ⦃G, L⦄ ⊢ T ▪[h, o] d →
+ ∀b,J,X,Y. T = ⓑ{b,J}Y.X → ⦃G, L.ⓑ{J}Y⦄ ⊢ X ▪[h, o] d.
+#h #o #G #L #T #d * -G -L -T -d
+[ #G #L #s #d #_ #b #J #X #Y #H destruct
+| #G #L #K #V #i #d #_ #_ #b #J #X #Y #H destruct
+| #G #L #K #W #i #d #_ #_ #b #J #X #Y #H destruct
+| #a #I #G #L #V #T #d #HT #b #J #X #Y #H destruct //
+| #I #G #L #V #T #d #_ #b #J #X #Y #H destruct
+]
+qed-.
+
+lemma da_inv_bind: ∀h,o,b,J,G,L,Y,X,d. ⦃G, L⦄ ⊢ ⓑ{b,J}Y.X ▪[h, o] d → ⦃G, L.ⓑ{J}Y⦄ ⊢ X ▪[h, o] d.
+/2 width=4 by da_inv_bind_aux/ qed-.
+
+fact da_inv_flat_aux: ∀h,o,G,L,T,d. ⦃G, L⦄ ⊢ T ▪[h, o] d →
+ ∀J,X,Y. T = ⓕ{J}Y.X → ⦃G, L⦄ ⊢ X ▪[h, o] d.
+#h #o #G #L #T #d * -G -L -T -d
+[ #G #L #s #d #_ #J #X #Y #H destruct
+| #G #L #K #V #i #d #_ #_ #J #X #Y #H destruct
+| #G #L #K #W #i #d #_ #_ #J #X #Y #H destruct
+| #a #I #G #L #V #T #d #_ #J #X #Y #H destruct
+| #I #G #L #V #T #d #HT #J #X #Y #H destruct //
+]
+qed-.
+
+lemma da_inv_flat: ∀h,o,J,G,L,Y,X,d. ⦃G, L⦄ ⊢ ⓕ{J}Y.X ▪[h, o] d → ⦃G, L⦄ ⊢ X ▪[h, o] d.
+/2 width=5 by da_inv_flat_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/static/aaa_lift.ma".
+include "basic_2/static/da.ma".
+
+(* DEGREE ASSIGNMENT FOR TERMS **********************************************)
+
+(* Properties on atomic arity assignment for terms **************************)
+
+lemma aaa_da: ∀h,o,G,L,T,A. ⦃G, L⦄ ⊢ T ⁝ A → ∃d. ⦃G, L⦄ ⊢ T ▪[h, o] d.
+#h #o #G #L #T #A #H elim H -G -L -T -A
+[ #G #L #s elim (deg_total h o s) /3 width=2 by da_sort, ex_intro/
+| * #G #L #K #V #B #i #HLK #_ * /3 width=5 by da_ldef, da_ldec, ex_intro/
+| #a #G #L #V #T #B #A #_ #_ #_ * /3 width=2 by da_bind, ex_intro/
+| #a #G #L #V #T #B #A #_ #_ #_ * /3 width=2 by da_bind, ex_intro/
+| #G #L #V #T #B #A #_ #_ #_ * /3 width=2 by da_flat, ex_intro/
+| #G #L #W #T #A #_ #_ #_ * /3 width=2 by da_flat, 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/static/da_lift.ma".
+
+(* DEGREE ASSIGNMENT FOR TERMS **********************************************)
+
+(* Main properties **********************************************************)
+
+theorem da_mono: ∀h,o,G,L,T,d1. ⦃G, L⦄ ⊢ T ▪[h, o] d1 →
+ ∀d2. ⦃G, L⦄ ⊢ T ▪[h, o] d2 → d1 = d2.
+#h #o #G #L #T #d1 #H elim H -G -L -T -d1
+[ #G #L #s #d1 #Hkd1 #d2 #H
+ lapply (da_inv_sort … H) -G -L #Hkd2
+ >(deg_mono … Hkd2 … Hkd1) -h -s -d2 //
+| #G #L #K #V #i #d1 #HLK #_ #IHV #d2 #H
+ elim (da_inv_lref … H) -H * #K0 #V0 [| #d0 ] #HLK0 #HV0 [| #Hd0 ]
+ lapply (drop_mono … HLK0 … HLK) -HLK -HLK0 #H destruct /2 width=1 by/
+| #G #L #K #W #i #d1 #HLK #_ #IHW #d2 #H
+ elim (da_inv_lref … H) -H * #K0 #W0 [| #d0 ] #HLK0 #HW0 [| #Hd0 ]
+ lapply (drop_mono … HLK0 … HLK) -HLK -HLK0 #H destruct /3 width=1 by eq_f/
+| #a #I #G #L #V #T #d1 #_ #IHT #d2 #H
+ lapply (da_inv_bind … H) -H /2 width=1 by/
+| #I #G #L #V #T #d1 #_ #IHT #d2 #H
+ lapply (da_inv_flat … H) -H /2 width=1 by/
+]
+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/static/da.ma".
+
+(* DEGREE ASSIGNMENT FOR TERMS **********************************************)
+
+(* Properties on relocation *************************************************)
+
+lemma da_lift: ∀h,o,G,L1,T1,d. ⦃G, L1⦄ ⊢ T1 ▪[h, o] d →
+ ∀L2,c,l,k. ⬇[c, l, k] L2 ≡ L1 → ∀T2. ⬆[l, k] T1 ≡ T2 →
+ ⦃G, L2⦄ ⊢ T2 ▪[h, o] d.
+#h #o #G #L1 #T1 #d #H elim H -G -L1 -T1 -d
+[ #G #L1 #s #d #Hkd #L2 #c #l #k #_ #X #H
+ >(lift_inv_sort1 … H) -X /2 width=1 by da_sort/
+| #G #L1 #K1 #V1 #i #d #HLK1 #_ #IHV1 #L2 #c #l #k #HL21 #X #H
+ elim (lift_inv_lref1 … H) * #Hil #H destruct
+ [ elim (drop_trans_le … HL21 … HLK1) -L1 /2 width=2 by ylt_fwd_le/ #X #HLK2 #H
+ elim (drop_inv_skip2 … H) -H /2 width=1 by ylt_to_minus/ -Hil #K2 #V2 #HK21 #HV12 #H destruct
+ /3 width=9 by da_ldef/
+ | lapply (drop_trans_ge … HL21 … HLK1 ?) -L1
+ /3 width=8 by da_ldef, drop_inv_gen/
+ ]
+| #G #L1 #K1 #W1 #i #d #HLK1 #_ #IHW1 #L2 #c #l #k #HL21 #X #H
+ elim (lift_inv_lref1 … H) * #Hil #H destruct
+ [ elim (drop_trans_le … HL21 … HLK1) -L1 /2 width=2 by ylt_fwd_le/ #X #HLK2 #H
+ elim (drop_inv_skip2 … H) -H /2 width=1 by ylt_to_minus/ -Hil #K2 #W2 #HK21 #HW12 #H destruct
+ /3 width=8 by da_ldec/
+ | lapply (drop_trans_ge … HL21 … HLK1 ?) -L1
+ /3 width=8 by da_ldec, drop_inv_gen/
+ ]
+| #a #I #G #L1 #V1 #T1 #d #_ #IHT1 #L2 #c #l #k #HL21 #X #H
+ elim (lift_inv_bind1 … H) -H #V2 #T2 #HV12 #HU12 #H destruct
+ /4 width=5 by da_bind, drop_skip/
+| #I #G #L1 #V1 #T1 #d #_ #IHT1 #L2 #c #l #k #HL21 #X #H
+ elim (lift_inv_flat1 … H) -H #V2 #T2 #HV12 #HU12 #H destruct
+ /3 width=5 by da_flat/
+]
+qed.
+
+(* Inversion lemmas on relocation *******************************************)
+
+lemma da_inv_lift: ∀h,o,G,L2,T2,d. ⦃G, L2⦄ ⊢ T2 ▪[h, o] d →
+ ∀L1,c,l,k. ⬇[c, l, k] L2 ≡ L1 → ∀T1. ⬆[l, k] T1 ≡ T2 →
+ ⦃G, L1⦄ ⊢ T1 ▪[h, o] d.
+#h #o #G #L2 #T2 #d #H elim H -G -L2 -T2 -d
+[ #G #L2 #s #d #Hkd #L1 #c #l #k #_ #X #H
+ >(lift_inv_sort2 … H) -X /2 width=1 by da_sort/
+| #G #L2 #K2 #V2 #i #d #HLK2 #HV2 #IHV2 #L1 #c #l #k #HL21 #X #H
+ elim (lift_inv_lref2 … H) * #Hil #H destruct [ -HV2 | -IHV2 ]
+ [ elim (drop_conf_lt … HL21 … HLK2) -L2 /3 width=8 by da_ldef/
+ | lapply (drop_conf_ge … HL21 … HLK2 ?) -L2 /2 width=4 by da_ldef/
+ ]
+| #G #L2 #K2 #W2 #i #d #HLK2 #HW2 #IHW2 #L1 #c #l #k #HL21 #X #H
+ elim (lift_inv_lref2 … H) * #Hil #H destruct [ -HW2 | -IHW2 ]
+ [ elim (drop_conf_lt … HL21 … HLK2) -L2 /3 width=8 by da_ldec/
+ | lapply (drop_conf_ge … HL21 … HLK2 ?) -L2 /2 width=4 by da_ldec/
+ ]
+| #a #I #G #L2 #V2 #T2 #d #_ #IHT2 #L1 #c #l #k #HL21 #X #H
+ elim (lift_inv_bind2 … H) -H #V1 #T1 #HV12 #HT12 #H destruct
+ /4 width=5 by da_bind, drop_skip/
+| #I #G #L2 #V2 #T2 #d #_ #IHT2 #L1 #c #l #k #HL21 #X #H
+ elim (lift_inv_flat2 … H) -H #V1 #T1 #HV12 #HT12 #H destruct
+ /3 width=5 by da_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 *)
+(* *)
+(**************************************************************************)
+
+(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
+
+notation "hvbox( ⦃ term 46 G , break term 46 L ⦄ ⊢ break term 46 T ▪ break [ term 46 o , break term 46 h ] break term 46 d )"
+ non associative with precedence 45
+ for @{ 'Degree $h $o $G $L $T $d }.
--- /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 *)
+(* *)
+(**************************************************************************)
+
+(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
+
+notation "hvbox( ⫱ * [ term 46 L , break term 46 K ] term 46 f )"
+ non associative with precedence 46
+ for @{ 'DropPreds $L $K $f }.
--- /dev/null
+lemma drop_inv_refl: ∀L,l,m. ⬇[Ⓕ, l, m] L ≡ L → m = 0.
+/2 width=5 by drop_inv_length_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/grammar/lenv_append.ma".
+include "basic_2/substitution/drop.ma".
+
+(* DROPPING *****************************************************************)
+
+(* Properties on append for local environments ******************************)
+
+fact drop_O1_append_sn_le_aux: ∀L1,L2,s,l,m. ⬇[s, l, m] L1 ≡ L2 →
+ l = 0 → m ≤ |L1| →
+ ∀L. ⬇[s, 0, m] L @@ L1 ≡ L @@ L2.
+#L1 #L2 #s #l #m #H elim H -L1 -L2 -l -m //
+[ #l #m #_ #_ #H >(yle_inv_O2 … H) -m //
+| /4 width=1 by drop_drop, yle_inv_succ/
+| #I #L1 #L2 #V1 #V2 #l #m #_ #_ #_ #H elim (ysucc_inv_O_dx … H)
+]
+qed-.
+
+lemma drop_O1_append_sn_le: ∀L1,L2,s,m. ⬇[s, yinj 0, m] L1 ≡ L2 → m ≤ |L1| →
+ ∀L. ⬇[s, 0, m] L @@ L1 ≡ L @@ L2.
+/2 width=3 by drop_O1_append_sn_le_aux/ qed.
+
+(* Inversion lemmas on append for local environments ************************)
+
+lemma drop_O1_inv_append1_ge: ∀K,L1,L2,s,m. ⬇[s, 0, m] L1 @@ L2 ≡ K →
+ ∀m0. |L2| + m0 = m → ⬇[s, 0, m0] L1 ≡ K.
+#K #L1 #L2 elim L2 -L2
+[ #s #m #H #m0 >yplus_O1 #H0 destruct //
+| #L2 #I #V #IHL2 #s #m #H #m0 >yplus_succ1
+ #H0 elim (drop_inv_O1_pair1 … H) -H * #Hm #HL12 destruct
+ [ elim (ysucc_inv_O_dx … Hm)
+ | /2 width=3 by/
+ ]
+]
+qed-.
+
+lemma drop_O1_inv_append1_le: ∀K,L1,L2,s,m. ⬇[s, 0, m] L1 @@ L2 ≡ K → m ≤ |L2| →
+ ∀K2. ⬇[s, 0, m] L2 ≡ K2 → K = L1 @@ K2.
+#K #L1 #L2 elim L2 -L2
+[ #s #m #H1 #H2 #K2 #H3 lapply (yle_inv_O2 … H2) -H2
+ #H2 elim (drop_inv_atom1 … H3) -H3 #H3 #_ destruct
+ >(drop_inv_O2 … H1) -H1 //
+| #L2 #I #V #IHL2 #s #m @(ynat_ind … m) -m [ -IHL2 || -IHL2 ]
+ [ #H1 #_ #K2 #H2
+ lapply (drop_inv_O2 … H1) -H1 #H1
+ lapply (drop_inv_O2 … H2) -H2 #H2 destruct //
+ | /3 width=7 by drop_inv_drop1, yle_inv_succ/
+ | #_ #H lapply (yle_inv_Y1 … H) -H
+ #H elim (ylt_yle_false (|L2.ⓑ{I}V|) (∞)) //
+ ]
+]
+qed-.
--- /dev/null
+(* Inversion lemmas on equivalence ******************************************)
+
+lemma drop_O1_inj: ∀i,L1,L2,K. ⬇[i] L1 ≡ K → ⬇[i] L2 ≡ K → L1 ⩬[i, ∞] L2.
+#i @(ynat_ind … i) -i
+[ #L1 #L2 #K #H <(drop_inv_O2 … H) -K #H <(drop_inv_O2 … H) -L1 //
+| #i #IHi * [2: #L1 #I1 #V1 ] * [2,4: #L2 #I2 #V2 ] #K #HLK1 #HLK2 //
+ lapply (drop_fwd_length … HLK1)
+ <(drop_fwd_length … HLK2) [ /4 width=5 by drop_inv_drop1, lreq_succ/ ]
+ #H [ elim (ysucc_inv_O_sn … H) | elim (ysucc_inv_O_dx … H) ]
+| #L1 #L2 #K #H1 lapply (drop_fwd_Y2 … H1) -H1
+ #H elim (ylt_yle_false … H) //
+]
+qed-.
--- /dev/null
+lemma drop_inv_O1_gt: ∀L,K,m,s. ⬇[s, 0, m] L ≡ K → |L| < m →
+ s = Ⓣ ∧ K = ⋆.
+#L elim L -L [| #L #Z #X #IHL ] #K #m #s #H normalize in ⊢ (?%?→?); #H1m
+[ elim (drop_inv_atom1 … H) -H elim s -s /2 width=1 by conj/
+ #_ #Hs lapply (Hs ?) // -Hs #H destruct elim (ylt_yle_false … H1m) -H1m //
+| elim (drop_inv_O1_pair1 … H) -H * #H2m #HLK destruct
+ [ elim (ylt_yle_false … H1m) -H1m //
+ | elim (IHL … HLK) -IHL -HLK /2 width=1 by ylt_pred, conj/
+ ]
+]
+qed-.
+
+lemma drop_O1_le: ∀s,m,L. m ≤ |L| → ∃K. ⬇[s, 0, m] L ≡ K.
+#s #m @(ynat_ind … m) -m /2 width=2 by ex_intro/
+[ #m #IHm *
+ [ #H elim (ylt_yle_false … H) -H //
+ | #L #I #V #H elim (IHm L) -IHm /3 width=2 by drop_drop, yle_inv_succ, ex_intro/
+ ]
+| #L #H elim (ylt_yle_false … H) -H //
+]
+qed-.
+
+lemma drop_O1_lt: ∀s,L,m. m < |L| → ∃∃I,K,V. ⬇[s, 0, m] L ≡ K.ⓑ{I}V.
+#s #L elim L -L
+[ #m #H elim (ylt_yle_false … H) -H //
+| #L #I #V #IHL #m @(ynat_ind … m) -m /2 width=4 by drop_pair, ex1_3_intro/
+ [ #m #_#H elim (IHL m) -IHL /3 width=4 by drop_drop, ylt_inv_succ, ex1_3_intro/
+ | #H elim (ylt_yle_false … H) -H //
+ ]
+]
+qed-.
+
+lemma drop_O1_pair: ∀L,K,m,s. ⬇[s, 0, m] L ≡ K → m ≤ |L| → ∀I,V.
+ ∃∃J,W. ⬇[s, 0, m] L.ⓑ{I}V ≡ K.ⓑ{J}W.
+#L elim L -L [| #L #Z #X #IHL ] #K #m #s #H #Hm #I #V
+[ elim (drop_inv_atom1 … H) -H #H >(yle_inv_O2 … Hm) -m
+ #Hs destruct /2 width=3 by ex1_2_intro/
+| elim (drop_inv_O1_pair1 … H) -H * #Hm #HLK destruct /2 width=3 by ex1_2_intro/
+ elim (IHL … HLK … Z X) -IHL -HLK
+ /3 width=3 by yle_pred, drop_drop_lt, ex1_2_intro/
+]
+qed-.
+
+lemma drop_O1_ge: ∀L,m. |L| ≤ m → ⬇[Ⓣ, 0, m] L ≡ ⋆.
+#L elim L -L [ #m #_ @drop_atom #H destruct ]
+#L #I #V #IHL #m @(ynat_ind … m) -m //
+[ #H elim (ylt_yle_false … H) -H /2 width=1 by ylt_inj/
+| /4 width=1 by drop_drop, yle_inv_succ/
+]
+qed.
+
+lemma drop_O1_eq: ∀L,s. ⬇[s, 0, |L|] L ≡ ⋆.
+#L elim L -L /2 width=1 by drop_drop/
+qed.
+
+lemma drop_fwd_length_ge: ∀L1,L2,l,m,s. ⬇[s, l, m] L1 ≡ L2 → |L1| ≤ l → |L2| = |L1|.
+#L1 #L2 #l #m #s #H elim H -L1 -L2 -l -m //
+[ #I #L1 #L2 #V #m #_ #_ #H elim (ylt_yle_false … H) -H //
+| #I #L1 #L2 #V1 #V2 #l #m #_ #_ #IH #H
+ lapply (yle_inv_succ … H) -H #H
+ >length_pair >length_pair /3 width=1 by eq_f/
+]
+qed-.
+
+lemma drop_fwd_length_le_le: ∀L1,L2,l,m,s. ⬇[s, l, m] L1 ≡ L2 →
+ ∀l0. l + m + l0 = |L1| → |L2| = l + l0.
+#L1 #L2 #l #m #s #H elim H -L1 -L2 -l -m //
+[ #l #m #Hm #l0 #H elim (yplus_inv_O … H) -H
+ #H #H0 elim (yplus_inv_O … H) -H
+ #H1 #_ destruct //
+| #I #L1 #L2 #V #m #_ >yplus_O1 >yplus_O1 #IH #l0
+ /3 width=1 by ysucc_inv_inj/
+| #I #L1 #L2 #V1 #V2 #l #m #_ #_ #IHL12 #l0 >yplus_succ1 >yplus_succ1 #H
+ lapply (ysucc_inv_inj … H) -H #Hl1
+ >yplus_succ1 /3 width=1 by eq_f/
+]
+qed-.
+
+lemma drop_fwd_length_le_ge: ∀L1,L2,l,m,s. ⬇[s, l, m] L1 ≡ L2 → l ≤ |L1| → |L1| ≤ l + m → |L2| = l.
+#L1 #L2 #l #m #s #H elim H -L1 -L2 -l -m
+[ #l #m #_ #H #_ /2 width=1 by yle_inv_O2/
+| #I #L #V #_ #H elim (ylt_yle_false … H) -H //
+| #I #L1 #L2 #V #m #_ >yplus_O1 >yplus_O1
+ /3 width=1 by yle_inv_succ/
+| #I #L1 #L2 #V1 #v2 #l #m #_ #_ #IH
+ >yplus_SO2 >yplus_SO2
+ /4 width=1 by yle_inv_succ, eq_f/
+]
+qed-.
+
+lemma drop_fwd_be: ∀L,K,s,l,m,i. ⬇[s, l, m] L ≡ K → |K| ≤ i → i < l → |L| ≤ i.
+#L #K #s #l #m #i #HLK #HK #Hl elim (ylt_split i (|L|)) //
+#HL elim (drop_O1_lt (Ⓕ) … HL) #I #K0 #V #HLK0 -HL
+elim (ylt_inv_plus_sn … Hl) -Hl #l0 #H0
+elim (drop_conf_lt … HLK … HLK0 … H0) -HLK -HLK0 -H0
+#K1 #V1 #HK1 #_ #_ lapply (drop_fwd_length_lt2 … HK1) -I -K1 -V1
+#H elim (ylt_yle_false … H) -H //
+qed-.
+
+lemma drop_O1_ex: ∀K2,i,L1. |L1| = |K2| + i →
+ ∃∃L2. L1 ⩬[0, i] L2 & ⬇[i] L2 ≡ K2.
+#K2 #i @(ynat_ind … i) -i
+[ /3 width=3 by lreq_O2, ex2_intro/
+| #i #IHi #Y >yplus_succ2 #Hi
+ elim (drop_O1_lt (Ⓕ) Y 0) [2: >Hi // ]
+ #I #L1 #V #H lapply (drop_inv_O2 … H) -H #H destruct
+ >length_pair in Hi; #H lapply (ysucc_inv_inj … H) -H
+ #HL1K2 elim (IHi L1) -IHi // -HL1K2
+ /3 width=5 by lreq_pair, drop_drop, ex2_intro/
+| #L1 >yplus_Y2 #H elim (ylt_yle_false (|L1|) (∞)) //
+]
+qed-.
--- /dev/null
+(* Removed theorems *********************************************************)
+
+include "basic_2/substitution/drop.ma".
+
+| fqu_drop : ∀G,L,K,T,U,k.
+ ⬇[⫯k] L ≡ K → ⬆[0, ⫯k] T ≡ U → fqu G L U G K T
+
+lemma fqu_drop_lt: ∀G,L,K,T,U,k. 0 < k →
+ ⬇[k] L ≡ K → ⬆[0, k] T ≡ U → ⦃G, L, U⦄ ⊐ ⦃G, K, T⦄.
+#G #L #K #T #U #k #Hm lapply (ylt_inv_O1 … Hm) -Hm
+#Hm <Hm -Hm /2 width=3 by fqu_drop/
+qed.
+
+lemma fqu_lref_S_lt: ∀I,G,L,V,i. yinj 0 < i → ⦃G, L.ⓑ{I}V, #i⦄ ⊐ ⦃G, L, #(⫰i)⦄.
+/4 width=3 by drop_drop, lift_lref_pred, fqu_drop/
+qed.
--- /dev/null
+(* Removed theorems *********************************************************)
+
+lemma fquqa_drop: ∀G,L,K,T,U,k.
+ ⬇[k] L ≡ K → ⬆[0, k] T ≡ U → ⦃G, L, U⦄ ⊐⊐⸮ ⦃G, K, T⦄.
+#G #L #K #T #U #k @(ynat_ind … k) -k /3 width=3 by fqu_drop, or_introl/
+#HLK #HTU >(drop_inv_O2 … HLK) -L >(lift_inv_O2 … HTU) -T //
+qed.
+
+inductive fquq: tri_relation genv lenv term ≝
+| fquq_lref_O : ∀I,G,L,V. fquq G (L.ⓑ{I}V) (#0) G L V
+| fquq_pair_sn: ∀I,G,L,V,T. fquq G L (②{I}V.T) G L V
+| fquq_bind_dx: ∀a,I,G,L,V,T. fquq G L (ⓑ{a,I}V.T) G (L.ⓑ{I}V) T
+| fquq_flat_dx: ∀I,G, L,V,T. fquq G L (ⓕ{I}V.T) G L T
+| fquq_drop : ∀G,L,K,T,U,k.
+ ⬇[k] L ≡ K → ⬆[0, k] T ≡ U → fquq G L U G K T
+.
--- /dev/null
+(* A Basic_A2 lemma we do not need so far *)
+axiom frees_pair_flat: ∀L,T,f1,I1,V1. L.ⓑ{I1}V1 ⊢ 𝐅*⦃T⦄ ≡ f1 →
+ ∀f2,I2,V2. L.ⓑ{I2}V2 ⊢ 𝐅*⦃T⦄ ≡ f2 →
+ ∀f0. f1 ⋓ f2 ≡ f0 →
+ ∀I0,I. L.ⓑ{I0}ⓕ{I}V1.V2 ⊢ 𝐅*⦃T⦄ ≡ f0.
--- /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_append.ma".
+include "basic_2/multiple/frees.ma".
+
+(* CONTEXT-SENSITIVE FREE VARIABLES *****************************************)
+
+(* Properties on append for local environments ******************************)
+
+lemma frees_append: ∀L2,U,l,i. L2 ⊢ i ϵ 𝐅*[l]⦃U⦄ → i ≤ |L2| →
+ ∀L1. L1 @@ L2 ⊢ i ϵ 𝐅*[l]⦃U⦄.
+#L2 #U #l #i #H elim H -L2 -U -l -i /3 width=2 by frees_eq/
+#I #L2 #K2 #U #W #l #i #j #Hlj #Hji #HnU #HLK2 #_ #IHW #Hi #L1
+lapply (drop_fwd_length_minus2 … HLK2) normalize #H0
+lapply (drop_O1_append_sn_le … HLK2 … L1) -HLK2
+[ -I -L1 -K2 -U -W -l /4 width=3 by ylt_yle_trans, ylt_inv_inj, lt_to_le/
+| #HLK2 @(frees_be … HnU HLK2) // -HnU -HLK2 @IHW -IHW
+ >(minus_plus_m_m (|K2|) 1) >H0 -H0 <yminus_inj >yminus_SO2
+ /3 width=1 by monotonic_yle_minus_dx, yle_pred/
+]
+qed.
+
+(* Inversion lemmas on append for local environments ************************)
+
+fact frees_inv_append_aux: ∀L,U,l,i. L ⊢ i ϵ 𝐅*[l]⦃U⦄ → ∀L1,L2. L = L1 @@ L2 →
+ i ≤ |L2| → L2 ⊢ i ϵ 𝐅*[l]⦃U⦄.
+#L #U #l #i #H elim H -L -U -l -i /3 width=2 by frees_eq/
+#Z #L #Y #U #X #l #i #j #Hlj #Hji #HnU #HLY #_ #IHW #L1 #L2 #H #Hi destruct
+elim (drop_O1_lt (Ⓕ) L2 j) [2: -Z -Y -L1 -X -U -l /3 width=3 by ylt_yle_trans, ylt_inv_inj/ ]
+#I #K2 #W #HLK2 lapply (drop_fwd_length_minus2 … HLK2) normalize #H0
+lapply (drop_O1_inv_append1_le … HLY … HLK2) -HLY
+[ -Z -I -Y -K2 -L1 -X -U -W -l /4 width=3 by ylt_yle_trans, ylt_inv_inj, lt_to_le/
+| normalize #H destruct
+ @(frees_be … HnU HLK2) -HnU -HLK2 // @IHW -IHW //
+ >(minus_plus_m_m (|K2|) 1) >H0 -H0 <yminus_inj >yminus_SO2
+ /3 width=1 by monotonic_yle_minus_dx, yle_pred/
+]
+qed-.
+
+lemma frees_inv_append: ∀L1,L2,U,l,i. L1 @@ L2 ⊢ i ϵ 𝐅*[l]⦃U⦄ →
+ i ≤ |L2| → L2 ⊢ i ϵ 𝐅*[l]⦃U⦄.
+/2 width=4 by frees_inv_append_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/relocation/drops_weight.ma".
+include "basic_2/s_computation/fqup_weight.ma".
+include "basic_2/s_computation/fqus_weight.ma".
+include "basic_2/static/frees.ma".
+
+(* CONTEXT-SENSITIVE FREE VARIABLES *****************************************)
+
+(* Properties with star-iterated supclosure *********************************)
+
+(* Note: Restrict fqu_drop on atoms to prove frees_fqus_drops
+ Counterex: ⦃⋆, ⋆.ⓛ#0, ⓛ#1.#0⦄ ⊐ ⦃⋆, ⋆, ⓛ#0.#0⦄ ⊐ ⦃⋆, ⋆.ⓛ#0, #0⦄
+*)
+lemma frees_fqus_drops: ∀G,L1,T1,f1. L1 ⊢ 𝐅*⦃T1⦄ ≡ f1 →
+ ∀L2,T2. ⦃G, L1, T1⦄ ⊐* ⦃G, L2, T2⦄ →
+ ∀I,n. ⬇*[n] L1 ≡ L2.ⓑ{I}T2 →
+ ∃∃f2. L2 ⊢ 𝐅*⦃T2⦄ ≡ f2 & f2 ⊆ ⫱*[⫯n] f1.
+#G #L1 #T1 @(fqup_wf_ind_eq … G L1 T1) -G -L1 -T1
+#G0 #L0 #T0 #IH #G #L1 * *
+[ #s #HG #HL #HT #f1 #Hf1 #L2 #T2 #H12 #I #n #HL12 destruct
+ lapply (frees_inv_sort … Hf1) -Hf1 #Hf1
+ elim (fqus_inv_sort1 … H12) -H12 * [| elim (nat_split n) ]
+ [ -IH #H1 #H2 #H3 destruct
+ lapply (drops_fwd_lw … HL12) -HL12 #HL12
+ elim (lt_le_false … HL12) -HL12 //
+ | -IH #Hn #J #L #V #H12 #H destruct
+ lapply (drops_fwd_isid … HL12 ?) -HL12 // #H destruct
+ <(fqus_inv_refl_atom3 … H12) -H12
+ /3 width=3 by frees_sort_gen, sle_isid_sn, ex2_intro/
+ | * #m #Hn #J #L #V #H12 #H destruct
+ lapply (drops_inv_drop1 … HL12) -HL12 #HL12
+ elim (IH … H12 … HL12) -IH -H12 -HL12
+ /3 width=3 by frees_sort_gen, fqu_fqup, fqu_drop, lifts_sort, isid_tl, ex2_intro/
+ ]
+| #i #HG #HL #HT #f1 #Hf1 #L2 #T2 #H12 #I #n #HL12 destruct
+ elim (fqus_inv_lref1 … H12) -H12 * [|2,3: elim (nat_split n) ]
+ [ -IH #H1 #H2 #H3 destruct
+ lapply (drops_fwd_lw … HL12) -HL12 #HL12
+ elim (lt_le_false … HL12) -HL12 //
+ | -IH #Hn #J #L #V #H12 #H1 #H2 destruct
+ elim (frees_inv_zero_pair … Hf1) -Hf1 #g1 #Hg1 #H destruct
+ lapply (drops_fwd_isid … HL12 ?) -HL12 -H12 // #H destruct
+ /2 width=3 by sle_refl, ex2_intro/
+ | * #m #Hn #J #L #V #H12 #H1 #H2 destruct
+ elim (frees_inv_zero_pair … Hf1) -Hf1 #g1 #Hg1 #H destruct
+ lapply (drops_inv_drop1 … HL12) -HL12 #HL12
+ elim (IH … H12 … HL12) -IH -H12 -HL12
+ /2 width=3 by fqu_fqup, fqu_lref_O, ex2_intro/
+ | -IH #Hn #J #L #V #j #H12 #H1 #H2 destruct
+ elim (frees_inv_lref_pair … Hf1) -Hf1 #g1 #Hg1 #H destruct
+ lapply (drops_fwd_isid … HL12 ?) -HL12 // #H destruct
+ <(fqus_inv_refl_atom3 … H12) -H12 /2 width=3 by sle_refl, ex2_intro/
+ | * #m #Hn #J #L #V #j #H12 #H1 #H2 destruct
+ elim (frees_inv_lref_pair … Hf1) -Hf1 #g1 #Hg1 #H destruct
+ lapply (drops_inv_drop1 … HL12) -HL12 #HL12
+ elim (IH … H12 … HL12) -IH -H12 -HL12 /2 width=3 by fqu_fqup, ex2_intro/
+ ]
+| #l #HG #HL #HT #f1 #Hf1 #L2 #T2 #H12 #I #n #HL12 destruct
+ lapply (frees_inv_gref … Hf1) -Hf1 #Hf1
+ elim (fqus_inv_gref1 … H12) -H12 * [| elim (nat_split n) ]
+ [ -IH #H1 #H2 #H3 destruct
+ lapply (drops_fwd_lw … HL12) -HL12 #HL12
+ elim (lt_le_false … HL12) -HL12 //
+ | -IH #Hn #J #L #V #H12 #H destruct
+ lapply (drops_fwd_isid … HL12 ?) -HL12 // #H destruct
+ <(fqus_inv_refl_atom3 … H12) -H12
+ /3 width=3 by frees_gref_gen, sle_isid_sn, ex2_intro/
+ | * #m #Hn #J #L #V #H12 #H destruct
+ lapply (drops_inv_drop1 … HL12) -HL12 #HL12
+ elim (IH … H12 … HL12) -IH -H12 -HL12
+ /3 width=3 by frees_gref_gen, fqu_fqup, fqu_drop, lifts_sort, isid_tl, ex2_intro/
+ ]
+| #p #I #V1 #T1 #HG #HL #HT #f1 #Hf1 #L2 #T2 #H12 #I #n #HL12 destruct
+ elim (frees_inv_bind … Hf1) -Hf1 #f1V #f1T #Hf1V #Hf1T #Hf1
+ elim (fqus_inv_bind1 … H12) -H12
+ [ -IH -f1V -f1T * #H1 #H2 #H3 destruct
+ lapply (drops_fwd_lw … HL12) -HL12 #HL12
+ elim (lt_le_false … HL12) -HL12 //
+ | #H12 elim (IH … H12 … HL12) -IH -H12 -HL12
+ /4 width=6 by sor_tls, sor_inv_sle_sn_trans, ex2_intro/
+ | #H12 elim (IH … H12 I (⫯n)) -IH -H12 [|*: /2 width=3 by drops_drop, drops_refl/ ] -HL12
+ <tls_xn /4 width=6 by ex2_intro, sor_tls, sor_inv_sle_dx_trans/
+ | * #J #L #V #X1 #H12 #HXT1 #H destruct
+ ]
+| #I #V1 #T1 #HG #HL #HT #f1 #Hf1 #L2 #T2 #H12 #I #n #HL12 destruct
+ elim (frees_inv_flat … Hf1) -Hf1 #f1V #f1T #Hf1V #Hf1T #Hf1
+ elim (fqus_inv_flat1 … H12) -H12
+ [ -IH -f1V -f1T * #H1 #H2 #H3 destruct
+ lapply (drops_fwd_lw … HL12) -HL12 #HL12
+ elim (lt_le_false … HL12) -HL12 //
+ | #H12 elim (IH … H12 … HL12) -IH -H12 -HL12
+ /4 width=6 by sor_tls, sor_inv_sle_sn_trans, ex2_intro/
+ | #H12 elim (IH … H12 … HL12) -IH -H12 -HL12
+ /4 width=6 by ex2_intro, sor_tls, sor_inv_sle_dx_trans/
+ | * #J #L #V #X1 #H12 #HXT1 #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/grammar/lenv_length.ma".
+include "basic_2/grammar/cl_restricted_weight.ma".
+include "basic_2/relocation/frees.ma".
+
+(* CONTEXT-SENSITIVE FREE VARIABLES *****************************************)
+
+(* Forward lemmas on length for local environments **************************)
+
+lemma frees_fwd_length: ∀L,T,t. L ⊢ 𝐅*⦃T⦄ ≡ t → |L| = |t|.
+#L #T #t #H elim H -L -T -t //
+[ #p ] #I #L #V #T #t1 #t2 #t [ #b ] #_ #_ #Ht elim (sor_inv_length … Ht) -Ht //
+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/drop_drop.ma".
+include "basic_2/multiple/frees.ma".
+
+(* CONTEXT-SENSITIVE FREE VARIABLES *****************************************)
+
+(* Advanced properties ******************************************************)
+
+lemma frees_dec: ∀L,U,l,i. Decidable (frees l L U i).
+#L #U @(f2_ind … rfw … L U) -L -U
+#x #IH #L * *
+[ -IH /3 width=5 by frees_inv_sort, or_intror/
+| #j #Hx #l #i elim (ylt_split_eq i j) #Hji
+ [ -x @or_intror #H elim (ylt_yle_false … Hji)
+ lapply (frees_inv_lref_ge … H ?) -L -l /2 width=1 by ylt_fwd_le/
+ | -x /2 width=1 by or_introl/
+ | elim (ylt_split j l) #Hli
+ [ -x @or_intror #H elim (ylt_yle_false … Hji)
+ lapply (frees_inv_lref_skip … H ?) -L //
+ | elim (lt_or_ge j (|L|)) #Hj
+ [ elim (drop_O1_lt (Ⓕ) L j) // -Hj #I #K #W #HLK destruct
+ elim (IH K W … 0 (i-j-1)) -IH [1,3: /3 width=5 by frees_lref_be, drop_fwd_rfw, or_introl/ ] #HnW
+ @or_intror #H elim (frees_inv_lref_lt … H) // #Z #Y #X #_ #HLY -l
+ lapply (drop_mono … HLY … HLK) -L #H destruct /2 width=1 by/
+ | -x @or_intror #H elim (ylt_yle_false … Hji)
+ lapply (frees_inv_lref_free … H ?) -l //
+ ]
+ ]
+ ]
+| -IH /3 width=5 by frees_inv_gref, or_intror/
+| #a #I #W #U #Hx #l #i destruct
+ elim (IH L W … l i) [1,3: /3 width=1 by frees_bind_sn, or_introl/ ] #HnW
+ elim (IH (L.ⓑ{I}W) U … (⫯l) (i+1)) -IH [1,3: /3 width=1 by frees_bind_dx, or_introl/ ] #HnU
+ @or_intror #H elim (frees_inv_bind … H) -H /2 width=1 by/
+| #I #W #U #Hx #l #i destruct
+ elim (IH L W … l i) [1,3: /3 width=1 by frees_flat_sn, or_introl/ ] #HnW
+ elim (IH L U … l i) -IH [1,3: /3 width=1 by frees_flat_dx, or_introl/ ] #HnU
+ @or_intror #H elim (frees_inv_flat … H) -H /2 width=1 by/
+]
+qed-.
+
+lemma frees_S: ∀L,U,l,i. L ⊢ i ϵ 𝐅*[yinj l]⦃U⦄ → ∀I,K,W. ⬇[l] L ≡ K.ⓑ{I}W →
+ (K ⊢ ⫰(i-l) ϵ 𝐅*[0]⦃W⦄ → ⊥) → L ⊢ i ϵ 𝐅*[⫯l]⦃U⦄.
+#L #U #l #i #H elim (frees_inv … H) -H /3 width=2 by frees_eq/
+* #I #K #W #j #Hlj #Hji #HnU #HLK #HW #I0 #K0 #W0 #HLK0 #HnW0
+lapply (yle_inv_inj … Hlj) -Hlj #Hlj
+elim (le_to_or_lt_eq … Hlj) -Hlj
+[ -I0 -K0 -W0 /3 width=9 by frees_be, yle_inj/
+| -Hji -HnU #H destruct
+ lapply (drop_mono … HLK0 … HLK) #H destruct -I
+ elim HnW0 -L -U -HnW0 //
+]
+qed.
+
+(* Note: lemma 1250 *)
+lemma frees_bind_dx_O: ∀a,I,L,W,U,i. L.ⓑ{I}W ⊢ ⫯i ϵ 𝐅*[0]⦃U⦄ →
+ L ⊢ i ϵ 𝐅*[0]⦃ⓑ{a,I}W.U⦄.
+#a #I #L #W #U #i #HU elim (frees_dec L W 0 i)
+/4 width=5 by frees_S, frees_bind_dx, frees_bind_sn/
+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/rdrop_3.ma".
+include "basic_2/grammar/genv.ma".
+
+(* GLOBAL ENVIRONMENT READING ***********************************************)
+
+inductive gget (m:nat): relation genv ≝
+| gget_gt: ∀G. |G| ≤ m → gget m G (⋆)
+| gget_eq: ∀G. |G| = m + 1 → gget m G G
+| gget_lt: ∀I,G1,G2,V. m < |G1| → gget m G1 G2 → gget m (G1. ⓑ{I} V) G2
+.
+
+interpretation "global reading"
+ 'RDrop m G1 G2 = (gget m G1 G2).
+
+(* basic inversion lemmas ***************************************************)
+
+lemma gget_inv_gt: ∀G1,G2,m. ⬇[m] G1 ≡ G2 → |G1| ≤ m → G2 = ⋆.
+#G1 #G2 #m * -G1 -G2 //
+[ #G #H >H -H >commutative_plus #H (**) (* lemma needed here *)
+ lapply (le_plus_to_le_r … 0 H) -H #H
+ lapply (le_n_O_to_eq … H) -H #H destruct
+| #I #G1 #G2 #V #H1 #_ #H2
+ lapply (le_to_lt_to_lt … H2 H1) -H2 -H1 normalize in ⊢ (? % ? → ?); >commutative_plus #H
+ lapply (lt_plus_to_lt_l … 0 H) -H #H
+ elim (lt_zero_false … H)
+]
+qed-.
+
+lemma gget_inv_eq: ∀G1,G2,m. ⬇[m] G1 ≡ G2 → |G1| = m + 1 → G1 = G2.
+#G1 #G2 #m * -G1 -G2 //
+[ #G #H1 #H2 >H2 in H1; -H2 >commutative_plus #H (**) (* lemma needed here *)
+ lapply (le_plus_to_le_r … 0 H) -H #H
+ lapply (le_n_O_to_eq … H) -H #H destruct
+| #I #G1 #G2 #V #H1 #_ normalize #H2
+ <(injective_plus_l … H2) in H1; -H2 #H
+ elim (lt_refl_false … H)
+]
+qed-.
+
+fact gget_inv_lt_aux: ∀I,G,G1,G2,V,m. ⬇[m] G ≡ G2 → G = G1. ⓑ{I} V →
+ m < |G1| → ⬇[m] G1 ≡ G2.
+#I #G #G1 #G2 #V #m * -G -G2
+[ #G #H1 #H destruct #H2
+ lapply (le_to_lt_to_lt … H1 H2) -H1 -H2 normalize in ⊢ (? % ? → ?); >commutative_plus #H
+ lapply (lt_plus_to_lt_l … 0 H) -H #H
+ elim (lt_zero_false … H)
+| #G #H1 #H2 destruct >(injective_plus_l … H1) -H1 #H
+ elim (lt_refl_false … H)
+| #J #G #G2 #W #_ #HG2 #H destruct //
+]
+qed-.
+
+lemma gget_inv_lt: ∀I,G1,G2,V,m.
+ ⬇[m] G1. ⓑ{I} V ≡ G2 → m < |G1| → ⬇[m] G1 ≡ G2.
+/2 width=5 by gget_inv_lt_aux/ qed-.
+
+(* Basic properties *********************************************************)
+
+lemma gget_total: ∀m,G1. ∃G2. ⬇[m] G1 ≡ G2.
+#m #G1 elim G1 -G1 /3 width=2 by gget_gt, ex_intro/
+#I #V #G1 * #G2 #HG12
+elim (lt_or_eq_or_gt m (|G1|)) #Hm
+[ /3 width=2 by gget_lt, ex_intro/
+| destruct /3 width=2 by gget_eq, ex_intro/
+| @ex_intro [2: @gget_gt normalize /2 width=1 by/ | skip ] (**) (* explicit constructor *)
+]
+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/gget.ma".
+
+(* GLOBAL ENVIRONMENT READING ***********************************************)
+
+(* Main properties **********************************************************)
+
+theorem gget_mono: ∀G,G1,m. ⬇[m] G ≡ G1 → ∀G2. ⬇[m] G ≡ G2 → G1 = G2.
+#G #G1 #m #H elim H -G -G1
+[ #G #Hm #G2 #H
+ >(gget_inv_gt … H Hm) -H -Hm //
+| #G #Hm #G2 #H
+ >(gget_inv_eq … H Hm) -H -Hm //
+| #I #G #G1 #V #Hm #_ #IHG1 #G2 #H
+ lapply (gget_inv_lt … H Hm) -H -Hm /2 width=1 by/
+]
+qed-.
+
+lemma gget_dec: ∀G1,G2,m. Decidable (⬇[m] G1 ≡ G2).
+#G1 #G2 #m
+elim (gget_total m G1) #G #HG1
+elim (eq_genv_dec G G2) #HG2
+[ destruct /2 width=1 by or_introl/
+| @or_intror #HG12
+ lapply (gget_mono … HG1 … HG12) -HG1 -HG12 /2 width=1 by/
+]
+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 *)
+(* *)
+(**************************************************************************)
+
+(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
+
+notation "hvbox( ⬇ [ term 46 m ] break term 46 L1 ≡ break term 46 L2 )"
+ non associative with precedence 45
+ for @{ 'RDrop $m $L1 $L2 }.
--- /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 *)
+(* *)
+(**************************************************************************)
+
+(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
+
+notation "hvbox( L1 ⋓ break [ term 46 T , break term 46 f ] break term 46 L2 ≡ break term 46 L )"
+ non associative with precedence 45
+ for @{ 'LazyOr $L1 $T $f $L2 $L }.
--- /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/rt_transition/lfpr_lfpr.ma".
+
+(* PARALLEL R-TRANSITION FOR LOCAL ENV.S ON REFERRED ENTRIES ****************)
+
+definition lfxs_confluent_R: relation2 … ≝
+ λRP1,RP2.
+ ∀L0,T0,T1. RP1 L0 T0 T1 → ∀T2. RP2 L0 T0 T2 →
+ ∀L1. L0 ⦻*[RP1, T0] L1 → ∀L2. L0 ⦻*[RP2, T0] L2 →
+ ∃∃L. L1 ⦻*[RP2, T1] L & L2 ⦻*[RP1, T2] L.
+
+(* Main properties **********************************************************)
+
+fact lfpr_conf_cpr_atom_atom:
+ ∀h,I,G,L0. (
+ ∀L,T. ⦃G, L0, ⓪{I}⦄ ⊐+ ⦃G, L, T⦄ →
+ ∀T1. ⦃G, L⦄ ⊢ T ➡[h] T1 → ∀T2. ⦃G, L⦄ ⊢ T ➡[h] T2 →
+ ∀L1. ⦃G, L⦄ ⊢ ➡[h, T] L1 → ∀L2. ⦃G, L⦄ ⊢ ➡[h, T] L2 →
+ ∃∃K0. ⦃G, L1⦄ ⊢ ➡[h, T1] K0 & ⦃G, L2⦄ ⊢ ➡[h, T2] K0
+ ) →
+ ∀L1. ⦃G, L0⦄ ⊢ ➡[h, ⓪{I}] L1 → ∀L2. ⦃G, L0⦄ ⊢ ➡[h, ⓪{I}] L2 →
+ ∃∃L. ⦃G, L1⦄ ⊢ ➡[h, ⓪{I}] L & ⦃G, L2⦄ ⊢ ➡[h, ⓪{I}] L.
+#h #I #G * [ | #K0 #J #V0 cases I -I [ | * | ] ]
+[ #_ #L1 #HL01 #L2 #HL02
+ lapply (lfpr_inv_atom_sn … HL01) -HL01 #H destruct
+ lapply (lfpr_inv_atom_sn … HL02) -HL02 #H destruct
+ /2 width=3 by ex2_intro/
+| #s #IH #L1 #HL01 #L2 #HL02
+ elim (lfxs_inv_sort_pair_sn … HL01) -HL01 #K1 #V1 #HK01 #H destruct
+ elim (lfxs_inv_sort_pair_sn … HL02) -HL02 #K2 #V2 #HK02 #H destruct
+ elim (IH … HK01 … HK02) -IH -HK01 -HK02
+ /3 width=5 by lfpr_sort, fqu_fqup, fqu_drop, ex2_intro/
+| #IH #L1 #HL01 #L2 #HL02
+ elim (lfpr_inv_zero_pair_sn … HL01) -HL01 #K1 #V1 #HK01 #HV01 #H destruct
+ elim (lfpr_inv_zero_pair_sn … HL02) -HL02 #K2 #V2 #HK02 #HV02 #H destruct
+ elim (cpr_conf_lfpr … HV01 … HV02 … HK01 … HK02) #V #HV1 #HV2
+ elim (IH … HV01 … HV02 … HK01 … HK02) -IH -HV01 -HV02 -HK01 -HK02
+ /3 width=5 by lfpr_zero, fqu_fqup, fqu_drop, ex2_intro/
+| #i #IH #L1 #HL01 #L2 #HL02
+ elim (lfxs_inv_lref_pair_sn … HL01) -HL01 #K1 #V1 #HK01 #H destruct
+ elim (lfxs_inv_lref_pair_sn … HL02) -HL02 #K2 #V2 #HK02 #H destruct
+ elim (IH … HK01 … HK02) -IH -HK01 -HK02
+ /3 width=5 by lfpr_lref, fqu_fqup, fqu_drop, ex2_intro/
+| #l #IH #L1 #HL01 #L2 #HL02
+ elim (lfxs_inv_gref_pair_sn … HL01) -HL01 #K1 #V1 #HK01 #H destruct
+ elim (lfxs_inv_gref_pair_sn … HL02) -HL02 #K2 #V2 #HK02 #H destruct
+ elim (IH … HK01 … HK02) -IH -HK01 -HK02
+ /3 width=5 by lfpr_gref, fqu_fqup, fqu_drop, ex2_intro/
+]
+qed-.
+
+theorem lfpr_conf_cpr: ∀h,G. lfxs_confluent_R (cpm 0 h G) (cpm 0 h G).
+#h #G #L0 #T0 @(fqup_wf_ind_eq … G L0 T0) -G -L0 -T0 #G #L #T #IH #G0 #L0 * [| * ]
+[ #I0 #HG #HL #HT #T1 #H1 #T2 #H2 #L1 #HL01 #L2 #HL02 destruct
+ elim (cpr_inv_atom1_drops … H1) -H1
+ elim (cpr_inv_atom1_drops … H2) -H2
+ [ #H2 #H1 destruct
+ /3 width=7 by lfpr_conf_cpr_atom_atom/
+ | * #K0 #V0 #V2 * [2: #i2 ] #HLK0 #HV02 #HVT2 #H2 #H1 destruct
+
+(*
+
+theorem lpr_conf: ∀G. confluent … (lpr G).
+/3 width=6 by lpx_sn_conf, cpr_conf_lpr/
+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/relocation/rtmap_id.ma".
+include "basic_2/notation/relations/relationstar_4.ma".
+include "basic_2/relocation/lexs.ma".
+include "basic_2/static/frees.ma".
+
+(* GENERIC EXTENSION ON REFERRED ENTRIES OF A CONTEXT-SENSITIVE REALTION ****)
+
+definition lfxs (R) (T): relation lenv ≝
+ λL1,L2. ∃∃f. L1 ⊢ 𝐅*⦃T⦄ ≡ f & L1 ⦻*[R, cfull, f] L2.
+
+interpretation "generic extension on referred entries (local environment)"
+ 'RelationStar R T L1 L2 = (lfxs R T L1 L2).
+
+definition R_frees_confluent: predicate (relation3 lenv term term) ≝
+ λRN.
+ ∀f1,L,T1. L ⊢ 𝐅*⦃T1⦄ ≡ f1 → ∀T2. RN L T1 T2 →
+ ∃∃f2. L ⊢ 𝐅*⦃T2⦄ ≡ f2 & f2 ⊆ f1.
+
+definition lexs_frees_confluent: relation (relation3 lenv term term) ≝
+ λRN,RP.
+ ∀f1,L1,T. L1 ⊢ 𝐅*⦃T⦄ ≡ f1 →
+ ∀L2. L1 ⦻*[RN, RP, f1] L2 →
+ ∃∃f2. L2 ⊢ 𝐅*⦃T⦄ ≡ f2 & f2 ⊆ f1.
+
+definition R_confluent2_lfxs: relation4 (relation3 lenv term term)
+ (relation3 lenv term term) … ≝
+ λR1,R2,RP1,RP2.
+ ∀L0,T0,T1. R1 L0 T0 T1 → ∀T2. R2 L0 T0 T2 →
+ ∀L1. L0 ⦻*[RP1, T0] L1 → ∀L2. L0 ⦻*[RP2, T0] L2 →
+ ∃∃T. R2 L1 T1 T & R1 L2 T2 T.
+
+(* Basic properties ***********************************************************)
+
+lemma lfxs_atom: ∀R,I. ⋆ ⦻*[R, ⓪{I}] ⋆.
+/3 width=3 by lexs_atom, frees_atom, ex2_intro/
+qed.
+
+lemma lfxs_sort: ∀R,I,L1,L2,V1,V2,s.
+ L1 ⦻*[R, ⋆s] L2 → L1.ⓑ{I}V1 ⦻*[R, ⋆s] L2.ⓑ{I}V2.
+#R #I #L1 #L2 #V1 #V2 #s * /3 width=3 by lexs_push, frees_sort, ex2_intro/
+qed.
+
+lemma lfxs_zero: ∀R,I,L1,L2,V1,V2. L1 ⦻*[R, V1] L2 →
+ R L1 V1 V2 → L1.ⓑ{I}V1 ⦻*[R, #0] L2.ⓑ{I}V2.
+#R #I #L1 #L2 #V1 #V2 * /3 width=3 by lexs_next, frees_zero, ex2_intro/
+qed.
+
+lemma lfxs_lref: ∀R,I,L1,L2,V1,V2,i.
+ L1 ⦻*[R, #i] L2 → L1.ⓑ{I}V1 ⦻*[R, #⫯i] L2.ⓑ{I}V2.
+#R #I #L1 #L2 #V1 #V2 #i * /3 width=3 by lexs_push, frees_lref, ex2_intro/
+qed.
+
+lemma lfxs_gref: ∀R,I,L1,L2,V1,V2,l.
+ L1 ⦻*[R, §l] L2 → L1.ⓑ{I}V1 ⦻*[R, §l] L2.ⓑ{I}V2.
+#R #I #L1 #L2 #V1 #V2 #l * /3 width=3 by lexs_push, frees_gref, ex2_intro/
+qed.
+
+lemma lfxs_pair_repl_dx: ∀R,I,L1,L2,T,V,V1.
+ L1.ⓑ{I}V ⦻*[R, T] L2.ⓑ{I}V1 →
+ ∀V2. R L1 V V2 →
+ L1.ⓑ{I}V ⦻*[R, T] L2.ⓑ{I}V2.
+#R #I #L1 #L2 #T #V #V1 * #f #Hf #HL12 #V2 #HR
+/3 width=5 by lexs_pair_repl, ex2_intro/
+qed-.
+
+lemma lfxs_sym: ∀R. lexs_frees_confluent R cfull →
+ (∀L1,L2,T1,T2. R L1 T1 T2 → R L2 T2 T1) →
+ ∀T. symmetric … (lfxs R T).
+#R #H1R #H2R #T #L1 #L2 * #f1 #Hf1 #HL12 elim (H1R … Hf1 … HL12) -Hf1
+/4 width=5 by sle_lexs_trans, lexs_sym, ex2_intro/
+qed-.
+
+lemma lfxs_co: ∀R1,R2. (∀L,T1,T2. R1 L T1 T2 → R2 L T1 T2) →
+ ∀L1,L2,T. L1 ⦻*[R1, T] L2 → L1 ⦻*[R2, T] L2.
+#R1 #R2 #HR #L1 #L2 #T * /4 width=7 by lexs_co, ex2_intro/
+qed-.
+
+(* Basic inversion lemmas ***************************************************)
+
+lemma lfxs_inv_atom_sn: ∀R,I,Y2. ⋆ ⦻*[R, ⓪{I}] Y2 → Y2 = ⋆.
+#R #I #Y2 * /2 width=4 by lexs_inv_atom1/
+qed-.
+
+lemma lfxs_inv_atom_dx: ∀R,I,Y1. Y1 ⦻*[R, ⓪{I}] ⋆ → Y1 = ⋆.
+#R #I #Y1 * /2 width=4 by lexs_inv_atom2/
+qed-.
+
+lemma lfxs_inv_sort: ∀R,Y1,Y2,s. Y1 ⦻*[R, ⋆s] Y2 →
+ (Y1 = ⋆ ∧ Y2 = ⋆) ∨
+ ∃∃I,L1,L2,V1,V2. L1 ⦻*[R, ⋆s] L2 &
+ Y1 = L1.ⓑ{I}V1 & Y2 = L2.ⓑ{I}V2.
+#R * [ | #Y1 #I #V1 ] #Y2 #s * #f #H1 #H2
+[ lapply (lexs_inv_atom1 … H2) -H2 /3 width=1 by or_introl, conj/
+| lapply (frees_inv_sort … H1) -H1 #Hf
+ elim (isid_inv_gen … Hf) -Hf #g #Hg #H destruct
+ elim (lexs_inv_push1 … H2) -H2 #L2 #V2 #H12 #_ #H destruct
+ /5 width=8 by frees_sort_gen, ex3_5_intro, ex2_intro, or_intror/
+]
+qed-.
+
+lemma lfxs_inv_zero: ∀R,Y1,Y2. Y1 ⦻*[R, #0] Y2 →
+ (Y1 = ⋆ ∧ Y2 = ⋆) ∨
+ ∃∃I,L1,L2,V1,V2. L1 ⦻*[R, V1] L2 & R L1 V1 V2 &
+ Y1 = L1.ⓑ{I}V1 & Y2 = L2.ⓑ{I}V2.
+#R #Y1 #Y2 * #f #H1 #H2 elim (frees_inv_zero … H1) -H1 *
+[ #H #_ lapply (lexs_inv_atom1_aux … H2 H) -H2 /3 width=1 by or_introl, conj/
+| #I1 #L1 #V1 #g #HV1 #HY1 #Hg elim (lexs_inv_next1_aux … H2 … HY1 Hg) -H2 -Hg
+ /4 width=9 by ex4_5_intro, ex2_intro, or_intror/
+]
+qed-.
+
+lemma lfxs_inv_lref: ∀R,Y1,Y2,i. Y1 ⦻*[R, #⫯i] Y2 →
+ (Y1 = ⋆ ∧ Y2 = ⋆) ∨
+ ∃∃I,L1,L2,V1,V2. L1 ⦻*[R, #i] L2 &
+ Y1 = L1.ⓑ{I}V1 & Y2 = L2.ⓑ{I}V2.
+#R #Y1 #Y2 #i * #f #H1 #H2 elim (frees_inv_lref … H1) -H1 *
+[ #H #_ lapply (lexs_inv_atom1_aux … H2 H) -H2 /3 width=1 by or_introl, conj/
+| #I1 #L1 #V1 #g #HV1 #HY1 #Hg elim (lexs_inv_push1_aux … H2 … HY1 Hg) -H2 -Hg
+ /4 width=8 by ex3_5_intro, ex2_intro, or_intror/
+]
+qed-.
+
+lemma lfxs_inv_gref: ∀R,Y1,Y2,l. Y1 ⦻*[R, §l] Y2 →
+ (Y1 = ⋆ ∧ Y2 = ⋆) ∨
+ ∃∃I,L1,L2,V1,V2. L1 ⦻*[R, §l] L2 &
+ Y1 = L1.ⓑ{I}V1 & Y2 = L2.ⓑ{I}V2.
+#R * [ | #Y1 #I #V1 ] #Y2 #l * #f #H1 #H2
+[ lapply (lexs_inv_atom1 … H2) -H2 /3 width=1 by or_introl, conj/
+| lapply (frees_inv_gref … H1) -H1 #Hf
+ elim (isid_inv_gen … Hf) -Hf #g #Hg #H destruct
+ elim (lexs_inv_push1 … H2) -H2 #L2 #V2 #H12 #_ #H destruct
+ /5 width=8 by frees_gref_gen, ex3_5_intro, ex2_intro, or_intror/
+]
+qed-.
+
+lemma lfxs_inv_bind: ∀R,p,I,L1,L2,V1,V2,T. L1 ⦻*[R, ⓑ{p,I}V1.T] L2 → R L1 V1 V2 →
+ L1 ⦻*[R, V1] L2 ∧ L1.ⓑ{I}V1 ⦻*[R, T] L2.ⓑ{I}V2.
+#R #p #I #L1 #L2 #V1 #V2 #T * #f #Hf #HL #HV elim (frees_inv_bind … Hf) -Hf
+/6 width=6 by sle_lexs_trans, lexs_inv_tl, sor_inv_sle_dx, sor_inv_sle_sn, ex2_intro, conj/
+qed-.
+
+lemma lfxs_inv_flat: ∀R,I,L1,L2,V,T. L1 ⦻*[R, ⓕ{I}V.T] L2 →
+ L1 ⦻*[R, V] L2 ∧ L1 ⦻*[R, T] L2.
+#R #I #L1 #L2 #V #T * #f #Hf #HL elim (frees_inv_flat … Hf) -Hf
+/5 width=6 by sle_lexs_trans, sor_inv_sle_dx, sor_inv_sle_sn, ex2_intro, conj/
+qed-.
+
+(* Advanced inversion lemmas ************************************************)
+
+lemma lfxs_inv_sort_pair_sn: ∀R,I,Y2,L1,V1,s. L1.ⓑ{I}V1 ⦻*[R, ⋆s] Y2 →
+ ∃∃L2,V2. L1 ⦻*[R, ⋆s] L2 & Y2 = L2.ⓑ{I}V2.
+#R #I #Y2 #L1 #V1 #s #H elim (lfxs_inv_sort … H) -H *
+[ #H destruct
+| #J #Y1 #L2 #X1 #V2 #Hs #H1 #H2 destruct /2 width=4 by ex2_2_intro/
+]
+qed-.
+
+lemma lfxs_inv_sort_pair_dx: ∀R,I,Y1,L2,V2,s. Y1 ⦻*[R, ⋆s] L2.ⓑ{I}V2 →
+ ∃∃L1,V1. L1 ⦻*[R, ⋆s] L2 & Y1 = L1.ⓑ{I}V1.
+#R #I #Y1 #L2 #V2 #s #H elim (lfxs_inv_sort … H) -H *
+[ #_ #H destruct
+| #J #L1 #Y2 #V1 #X2 #Hs #H1 #H2 destruct /2 width=4 by ex2_2_intro/
+]
+qed-.
+
+lemma lfxs_inv_zero_pair_sn: ∀R,I,Y2,L1,V1. L1.ⓑ{I}V1 ⦻*[R, #0] Y2 →
+ ∃∃L2,V2. L1 ⦻*[R, V1] L2 & R L1 V1 V2 &
+ Y2 = L2.ⓑ{I}V2.
+#R #I #Y2 #L1 #V1 #H elim (lfxs_inv_zero … H) -H *
+[ #H destruct
+| #J #Y1 #L2 #X1 #V2 #HV1 #HV12 #H1 #H2 destruct
+ /2 width=5 by ex3_2_intro/
+]
+qed-.
+
+lemma lfxs_inv_zero_pair_dx: ∀R,I,Y1,L2,V2. Y1 ⦻*[R, #0] L2.ⓑ{I}V2 →
+ ∃∃L1,V1. L1 ⦻*[R, V1] L2 & R L1 V1 V2 &
+ Y1 = L1.ⓑ{I}V1.
+#R #I #Y1 #L2 #V2 #H elim (lfxs_inv_zero … H) -H *
+[ #_ #H destruct
+| #J #L1 #Y2 #V1 #X2 #HV1 #HV12 #H1 #H2 destruct
+ /2 width=5 by ex3_2_intro/
+]
+qed-.
+
+lemma lfxs_inv_lref_pair_sn: ∀R,I,Y2,L1,V1,i. L1.ⓑ{I}V1 ⦻*[R, #⫯i] Y2 →
+ ∃∃L2,V2. L1 ⦻*[R, #i] L2 & Y2 = L2.ⓑ{I}V2.
+#R #I #Y2 #L1 #V1 #i #H elim (lfxs_inv_lref … H) -H *
+[ #H destruct
+| #J #Y1 #L2 #X1 #V2 #Hi #H1 #H2 destruct /2 width=4 by ex2_2_intro/
+]
+qed-.
+
+lemma lfxs_inv_lref_pair_dx: ∀R,I,Y1,L2,V2,i. Y1 ⦻*[R, #⫯i] L2.ⓑ{I}V2 →
+ ∃∃L1,V1. L1 ⦻*[R, #i] L2 & Y1 = L1.ⓑ{I}V1.
+#R #I #Y1 #L2 #V2 #i #H elim (lfxs_inv_lref … H) -H *
+[ #_ #H destruct
+| #J #L1 #Y2 #V1 #X2 #Hi #H1 #H2 destruct /2 width=4 by ex2_2_intro/
+]
+qed-.
+
+lemma lfxs_inv_gref_pair_sn: ∀R,I,Y2,L1,V1,l. L1.ⓑ{I}V1 ⦻*[R, §l] Y2 →
+ ∃∃L2,V2. L1 ⦻*[R, §l] L2 & Y2 = L2.ⓑ{I}V2.
+#R #I #Y2 #L1 #V1 #l #H elim (lfxs_inv_gref … H) -H *
+[ #H destruct
+| #J #Y1 #L2 #X1 #V2 #Hl #H1 #H2 destruct /2 width=4 by ex2_2_intro/
+]
+qed-.
+
+lemma lfxs_inv_gref_pair_dx: ∀R,I,Y1,L2,V2,l. Y1 ⦻*[R, §l] L2.ⓑ{I}V2 →
+ ∃∃L1,V1. L1 ⦻*[R, §l] L2 & Y1 = L1.ⓑ{I}V1.
+#R #I #Y1 #L2 #V2 #l #H elim (lfxs_inv_gref … H) -H *
+[ #_ #H destruct
+| #J #L1 #Y2 #V1 #X2 #Hl #H1 #H2 destruct /2 width=4 by ex2_2_intro/
+]
+qed-.
+
+(* Basic forward lemmas *****************************************************)
+
+lemma lfxs_fwd_bind_sn: ∀R,p,I,L1,L2,V,T. L1 ⦻*[R, ⓑ{p,I}V.T] L2 → L1 ⦻*[R, V] L2.
+#R #p #I #L1 #L2 #V #T * #f #Hf #HL elim (frees_inv_bind … Hf) -Hf
+/4 width=6 by sle_lexs_trans, sor_inv_sle_sn, ex2_intro/
+qed-.
+
+lemma lfxs_fwd_bind_dx: ∀R,p,I,L1,L2,V1,V2,T. L1 ⦻*[R, ⓑ{p,I}V1.T] L2 →
+ R L1 V1 V2 → L1.ⓑ{I}V1 ⦻*[R, T] L2.ⓑ{I}V2.
+#R #p #I #L1 #L2 #V1 #V2 #T #H #HV elim (lfxs_inv_bind … H HV) -H -HV //
+qed-.
+
+lemma lfxs_fwd_flat_sn: ∀R,I,L1,L2,V,T. L1 ⦻*[R, ⓕ{I}V.T] L2 → L1 ⦻*[R, V] L2.
+#R #I #L1 #L2 #V #T #H elim (lfxs_inv_flat … H) -H //
+qed-.
+
+lemma lfxs_fwd_flat_dx: ∀R,I,L1,L2,V,T. L1 ⦻*[R, ⓕ{I}V.T] L2 → L1 ⦻*[R, T] L2.
+#R #I #L1 #L2 #V #T #H elim (lfxs_inv_flat … H) -H //
+qed-.
+
+lemma lfxs_fwd_pair_sn: ∀R,I,L1,L2,V,T. L1 ⦻*[R, ②{I}V.T] L2 → L1 ⦻*[R, V] L2.
+#R * /2 width=4 by lfxs_fwd_flat_sn, lfxs_fwd_bind_sn/
+qed-.
+
+(* Basic_2A1: removed theorems 24:
+ llpx_sn_sort llpx_sn_skip llpx_sn_lref llpx_sn_free llpx_sn_gref
+ llpx_sn_bind llpx_sn_flat
+ llpx_sn_inv_bind llpx_sn_inv_flat
+ llpx_sn_fwd_lref llpx_sn_fwd_pair_sn llpx_sn_fwd_length
+ llpx_sn_fwd_bind_sn llpx_sn_fwd_bind_dx llpx_sn_fwd_flat_sn llpx_sn_fwd_flat_dx
+ llpx_sn_refl llpx_sn_Y llpx_sn_bind_O llpx_sn_ge_up llpx_sn_ge llpx_sn_co
+ llpx_sn_fwd_drop_sn llpx_sn_fwd_drop_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/drops_ceq.ma".
+include "basic_2/relocation/drops_lexs.ma".
+include "basic_2/static/frees_drops.ma".
+include "basic_2/static/lfxs.ma".
+
+(* GENERIC EXTENSION ON REFERRED ENTRIES OF A CONTEXT-SENSITIVE REALTION ****)
+
+definition dedropable_sn: predicate (relation3 lenv term term) ≝
+ λR. ∀b,f,L1,K1. ⬇*[b, f] L1 ≡ K1 →
+ ∀K2,T. K1 ⦻*[R, T] K2 → ∀U. ⬆*[f] T ≡ U →
+ ∃∃L2. L1 ⦻*[R, U] L2 & ⬇*[b, f] L2 ≡ K2 & L1 ≡[f] L2.
+
+definition dropable_sn: predicate (relation3 lenv term term) ≝
+ λR. ∀b,f,L1,K1. ⬇*[b, f] L1 ≡ K1 → 𝐔⦃f⦄ →
+ ∀L2,U. L1 ⦻*[R, U] L2 → ∀T. ⬆*[f] T ≡ U →
+ ∃∃K2. K1 ⦻*[R, T] K2 & ⬇*[b, f] L2 ≡ K2.
+
+definition dropable_dx: predicate (relation3 lenv term term) ≝
+ λR. ∀L1,L2,U. L1 ⦻*[R, U] L2 →
+ ∀b,f,K2. ⬇*[b, f] L2 ≡ K2 → 𝐔⦃f⦄ → ∀T. ⬆*[f] T ≡ U →
+ ∃∃K1. ⬇*[b, f] L1 ≡ K1 & K1 ⦻*[R, T] K2.
+
+(* Properties with generic slicing for local environments *******************)
+
+(* Basic_2A1: includes: llpx_sn_lift_le llpx_sn_lift_ge *)
+lemma lfxs_liftable_dedropable: ∀R. (∀L. reflexive ? (R L)) →
+ d_liftable2 R → dedropable_sn R.
+#R #H1R #H2R #b #f #L1 #K1 #HLK1 #K2 #T * #f1 #Hf1 #HK12 #U #HTU
+elim (frees_total L1 U) #f2 #Hf2
+lapply (frees_fwd_coafter … Hf2 … HLK1 … HTU … Hf1) -HTU #Hf
+elim (lexs_liftable_co_dedropable … H1R … H2R … HLK1 … HK12 … Hf) -f1 -K1
+/3 width=6 by cfull_lift, ex3_intro, ex2_intro/
+qed-.
+
+(* Inversion lemmas with generic slicing for local environments *************)
+
+(* Basic_2A1: restricts: llpx_sn_inv_lift_le llpx_sn_inv_lift_be llpx_sn_inv_lift_ge *)
+(* Basic_2A1: was: llpx_sn_drop_conf_O *)
+lemma lfxs_dropable_sn: ∀R. dropable_sn R.
+#R #b #f #L1 #K1 #HLK1 #H1f #L2 #U * #f2 #Hf2 #HL12 #T #HTU
+elim (frees_total K1 T) #f1 #Hf1
+lapply (frees_fwd_coafter … Hf2 … HLK1 … HTU … Hf1) -HTU #H2f
+elim (lexs_co_dropable_sn … HLK1 … HL12 … H2f) -f2 -L1
+/3 width=3 by ex2_intro/
+qed-.
+
+(* Basic_2A1: was: llpx_sn_drop_trans_O *)
+(* Note: the proof might be simplified *)
+lemma lfxs_dropable_dx: ∀R. dropable_dx R.
+#R #L1 #L2 #U * #f2 #Hf2 #HL12 #b #f #K2 #HLK2 #H1f #T #HTU
+elim (drops_isuni_ex … H1f L1) #K1 #HLK1
+elim (frees_total K1 T) #f1 #Hf1
+lapply (frees_fwd_coafter … Hf2 … HLK1 … HTU … Hf1) -K1 #H2f
+elim (lexs_co_dropable_dx … HL12 … HLK2 … H2f) -L2
+/4 width=9 by frees_inv_lifts, ex2_intro/
+qed-.
+
+(* Basic_2A1: was: llpx_sn_inv_lift_O *)
+lemma lfxs_inv_lift_bi: ∀R,L1,L2,U. L1 ⦻*[R, U] L2 →
+ ∀K1,K2,i. ⬇*[i] L1 ≡ K1 → ⬇*[i] L2 ≡ K2 →
+ ∀T. ⬆*[i] T ≡ U → K1 ⦻*[R, T] K2.
+#R #L1 #L2 #U #HL12 #K1 #K2 #i #HLK1 #HLK2 #T #HTU
+elim (lfxs_dropable_sn … HLK1 … HL12 … HTU) -L1 -U // #Y #HK12 #HY
+lapply (drops_mono … HY … HLK2) -L2 -i #H destruct //
+qed-.
+
+lemma lfxs_inv_lref_sn: ∀R,L1,L2,i. L1 ⦻*[R, #i] L2 → ∀I,K1,V1. ⬇*[i] L1 ≡ K1.ⓑ{I}V1 →
+ ∃∃K2,V2. ⬇*[i] L2 ≡ K2.ⓑ{I}V2 & K1 ⦻*[R, V1] K2 & R K1 V1 V2.
+#R #L1 #L2 #i #HL12 #I #K1 #V1 #HLK1 elim (lfxs_dropable_sn … HLK1 … HL12 (#0)) -HLK1 -HL12 //
+#Y #HY #HLK2 elim (lfxs_inv_zero_pair_sn … HY) -HY
+#K2 #V2 #HK12 #HV12 #H destruct /2 width=5 by ex3_2_intro/
+qed-.
+
+lemma lfxs_inv_lref_dx: ∀R,L1,L2,i. L1 ⦻*[R, #i] L2 → ∀I,K2,V2. ⬇*[i] L2 ≡ K2.ⓑ{I}V2 →
+ ∃∃K1,V1. ⬇*[i] L1 ≡ K1.ⓑ{I}V1 & K1 ⦻*[R, V1] K2 & R K1 V1 V2.
+#R #L1 #L2 #i #HL12 #I #K2 #V2 #HLK2 elim (lfxs_dropable_dx … HL12 … HLK2 … (#0)) -HLK2 -HL12 //
+#Y #HLK1 #HY elim (lfxs_inv_zero_pair_dx … HY) -HY
+#K1 #V1 #HK12 #HV12 #H destruct /2 width=5 by ex3_2_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/static/frees_fqup.ma".
+include "basic_2/static/lfxs.ma".
+
+(* GENERIC EXTENSION ON REFERRED ENTRIES OF A CONTEXT-SENSITIVE REALTION ****)
+
+(* Advanced properties ******************************************************)
+
+lemma lfxs_refl: ∀R. (∀L. reflexive … (R L)) → ∀L,T. L ⦻*[R, T] L.
+#R #HR #L #T elim (frees_total L T) /3 width=3 by lexs_refl, 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/relocation/lexs_length.ma".
+include "basic_2/static/lfxs.ma".
+
+(* GENERIC EXTENSION ON REFERRED ENTRIES OF A CONTEXT-SENSITIVE REALTION ****)
+
+(* Forward lemmas with length for local environments ************************)
+
+lemma lfxs_fwd_length: ∀R,L1,L2,T. L1 ⦻*[R, T] L2 → |L1| = |L2|.
+#R #L1 #L2 #T * /2 width=4 by lexs_fwd_length/
+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/lexs_lexs.ma".
+include "basic_2/static/frees_fqup.ma".
+include "basic_2/static/frees_frees.ma".
+include "basic_2/static/lfxs.ma".
+
+(* GENERIC EXTENSION ON REFERRED ENTRIES OF A CONTEXT-SENSITIVE REALTION ****)
+
+(* Main properties **********************************************************)
+
+theorem lfxs_bind: ∀R,p,I,L1,L2,V1,V2,T.
+ L1 ⦻*[R, V1] L2 → L1.ⓑ{I}V1 ⦻*[R, T] L2.ⓑ{I}V2 →
+ L1 ⦻*[R, ⓑ{p,I}V1.T] L2.
+#R #p #I #L1 #L2 #V1 #V2 #T * #f1 #HV #Hf1 * #f2 #HT #Hf2
+elim (lexs_fwd_pair … Hf2) -Hf2 #Hf2 #_ elim (sor_isfin_ex f1 (⫱f2))
+/3 width=7 by frees_fwd_isfin, frees_bind, lexs_join, isfin_tl, ex2_intro/
+qed.
+
+theorem lfxs_flat: ∀R,I,L1,L2,V,T.
+ L1 ⦻*[R, V] L2 → L1 ⦻*[R, T] L2 →
+ L1 ⦻*[R, ⓕ{I}V.T] L2.
+#R #I #L1 #L2 #V #T * #f1 #HV #Hf1 * #f2 #HT #Hf2 elim (sor_isfin_ex f1 f2)
+/3 width=7 by frees_fwd_isfin, frees_flat, lexs_join, ex2_intro/
+qed.
+
+theorem lfxs_trans: ∀R. lexs_frees_confluent R cfull →
+ ∀T. Transitive … (lfxs R T).
+#R #H1R #T #L1 #L * #f1 #Hf1 #HL1 #L2 * #f2 #Hf2 #HL2
+elim (H1R … Hf1 … HL1) #f #H0 #H1
+lapply (frees_mono … Hf2 … H0) -Hf2 -H0 #Hf2
+lapply (lexs_eq_repl_back … HL2 … Hf2) -f2 #HL2
+lapply (sle_lexs_trans … HL1 … H1) -HL1 // #Hl1
+@(ex2_intro … f)
+
+/4 width=7 by lreq_trans, lexs_eq_repl_back, ex2_intro/
+qed-.
+
+theorem lfxs_conf: ∀R. lexs_frees_confluent R cfull →
+ R_confluent2_lfxs R R R R →
+ ∀T. confluent … (lfxs R T).
+#R #H1R #H2R #T #L0 #L1 * #f1 #Hf1 #HL01 #L2 * #f #Hf #HL02
+lapply (frees_mono … Hf1 … Hf) -Hf1 #Hf12
+lapply (lexs_eq_repl_back … HL01 … Hf12) -f1 #HL01
+elim (lexs_conf … HL01 … HL02) /2 width=3 by ex2_intro/ [ | -HL01 -HL02 ]
+[ #L #HL1 #HL2
+ elim (H1R … Hf … HL01) -HL01 #f1 #Hf1 #H1
+ elim (H1R … Hf … HL02) -HL02 #f2 #Hf2 #H2
+ lapply (sle_lexs_trans … HL1 … H1) // -HL1 -H1 #HL1
+ lapply (sle_lexs_trans … HL2 … H2) // -HL2 -H2 #HL2
+ /3 width=5 by ex2_intro/
+| #g #I #K0 #V0 #n #HLK0 #Hgf #V1 #HV01 #V2 #HV02 #K1 #HK01 #K2 #HK02
+ elim (frees_drops_next … Hf … HLK0 … Hgf) -Hf -HLK0 -Hgf #g0 #Hg0 #H0
+ lapply (sle_lexs_trans … HK01 … H0) // -HK01 #HK01
+ lapply (sle_lexs_trans … HK02 … H0) // -HK02 #HK02
+ elim (H2R … HV01 … HV02 K1 … K2) /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/substitution/lift.ma".
+
+(* BASIC TERM RELOCATION ****************************************************)
+
+(* Properties on negated basic relocation ***********************************)
+
+lemma nlift_lref_be_SO: ∀X,j. j < ∞ → ⬆[j, 1] X ≡ #j → ⊥.
+#X #j #Hj #H elim (lift_inv_lref2 … H) -H *
+[ #H elim (ylt_yle_false … H) -H //
+| #i #Hij #_ #H1 #H2 destruct
+ elim (ylt_inv_plus_Y … Hj) -Hj #Hi #_
+ elim (ylt_yle_false … Hij) -Hij /2 width=1 by monotonic_ylt_plus_sn/
+]
+qed-.
+
+lemma nlift_bind_sn: ∀W,l,m. (∀V. ⬆[l, m] V ≡ W → ⊥) →
+ ∀a,I,U. (∀X. ⬆[l, m] X ≡ ⓑ{a,I}W.U → ⊥).
+#W #l #m #HW #a #I #U #X #H elim (lift_inv_bind2 … H) -H /2 width=2 by/
+qed-.
+
+lemma nlift_bind_dx: ∀U,l,m. (∀T. ⬆[⫯l, m] T ≡ U → ⊥) →
+ ∀a,I,W. (∀X. ⬆[l, m] X ≡ ⓑ{a,I}W.U → ⊥).
+#U #l #m #HU #a #I #W #X #H elim (lift_inv_bind2 … H) -H /2 width=2 by/
+qed-.
+
+lemma nlift_flat_sn: ∀W,l,m. (∀V. ⬆[l, m] V ≡ W → ⊥) →
+ ∀I,U. (∀X. ⬆[l, m] X ≡ ⓕ{I}W.U → ⊥).
+#W #l #m #HW #I #U #X #H elim (lift_inv_flat2 … H) -H /2 width=2 by/
+qed-.
+
+lemma nlift_flat_dx: ∀U,l,m. (∀T. ⬆[l, m] T ≡ U → ⊥) →
+ ∀I,W. (∀X. ⬆[l, m] X ≡ ⓕ{I}W.U → ⊥).
+#U #l #m #HU #I #W #X #H elim (lift_inv_flat2 … H) -H /2 width=2 by/
+qed-.
+
+(* Inversion lemmas on negated basic relocation *****************************)
+
+lemma nlift_inv_lref_be_SO: ∀i,j. (∀X. ⬆[i, 1] X ≡ #j → ⊥) → j = i ∧ j < ∞.
+#i #j elim (ylt_split_eq i j) #Hij #H destruct
+[ elim (H (#⫰j)) -H /2 width=1 by lift_lref_pred/
+| elim (yle_split_eq i (∞)) /2 width=1 by conj/ #H0 destruct
+ elim (H (#∞)) -H /2 width=1 by lift_lref_plus, ylt_Y/
+| elim (H (#j)) -H /2 width=1 by lift_lref_lt/
+]
+qed-.
+
+lemma nlift_inv_bind: ∀a,I,W,U,l,m. (∀X. ⬆[l, m] X ≡ ⓑ{a,I}W.U → ⊥) →
+ (∀V. ⬆[l, m] V ≡ W → ⊥) ∨ (∀T. ⬆[⫯l, m] T ≡ U → ⊥).
+#a #I #W #U #l #m #H elim (is_lift_dec W l m)
+[ * /4 width=2 by lift_bind, or_intror/
+| /4 width=2 by ex_intro, or_introl/
+]
+qed-.
+
+lemma nlift_inv_flat: ∀I,W,U,l,m. (∀X. ⬆[l, m] X ≡ ⓕ{I}W.U → ⊥) →
+ (∀V. ⬆[l, m] V ≡ W → ⊥) ∨ (∀T. ⬆[l, m] T ≡ U → ⊥).
+#I #W #U #l #m #H elim (is_lift_dec W l m)
+[ * /4 width=2 by lift_flat, or_intror/
+| /4 width=2 by ex_intro, 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/notation/relations/lazyeq_4.ma".
+include "basic_2/multiple/llpx_sn.ma".
+
+(* LAZY EQUIVALENCE FOR LOCAL ENVIRONMENTS **********************************)
+
+(* Basic inversion lemmas ***************************************************)
+
+lemma lleq_ind: ∀R:relation4 ynat term lenv lenv. (
+ ∀L1,L2,l,s. |L1| = |L2| → R l (⋆s) 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-.
+
+(* Basic forward lemmas *****************************************************)
+
+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-.
+
+(* Basic properties *********************************************************)
+
+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.
--- /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,k. ⬇[Ⓕ, l, k] L1 ≡ K1 → ⬇[Ⓕ, l, k] L2 ≡ K2 →
+ ∀U. ⬆[l, k] 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,k. ⬇[Ⓕ, l, k] L1 ≡ K1 → ⬇[Ⓕ, l, k] L2 ≡ K2 →
+ ∀U. ⬆[l, k] T ≡ U → l ≤ lt → L1 ≡[U, lt+k] 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,k. ⬇[Ⓕ, l, k] L1 ≡ K1 → ⬇[Ⓕ, l, k] L2 ≡ K2 →
+ ∀T. ⬆[l, k] 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,k. ⬇[Ⓕ, l, k] L1 ≡ K1 → ⬇[Ⓕ, l, k] L2 ≡ K2 →
+ ∀T. ⬆[l, k] T ≡ U → l ≤ lt → lt ≤ l + k → 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,k. ⬇[Ⓕ, l, k] L1 ≡ K1 → ⬇[Ⓕ, l, k] L2 ≡ K2 →
+ ∀T. ⬆[l, k] T ≡ U → l + k ≤ lt → K1 ≡[T, lt-k] 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 #k #HLK2 #HTU #L1 #HL12
+ elim (drop_O1_le (Ⓕ) (k+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/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. (c_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. (c_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 ****)
+
+| 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
+
+(* Basic forward lemmas *****************************************************)
+
+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-.
+
+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-.
--- /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_k_k 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,s. |L1| = |L2| → llpx_sn_alt_r R l (⋆s) L1 L2.
+#R #L1 #L2 #l #s #HL12 @llpx_sn_alt_r_intro_alt // -HL12
+#I1 #I2 #K1 #K2 #V1 #V2 #i #_ #H elim (H (⋆s)) //
+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 * *
+[ #s #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-.
+
+(* 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. (c_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. (c_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
+(* Properties on supclosure *************************************************)
+
+lemma fqu_lpx_trans: ∀h,o,G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐ ⦃G2, L2, T2⦄ →
+ ∀K2. ⦃G2, L2⦄ ⊢ ➡[h, o] K2 →
+ ∃∃K1,T. ⦃G1, L1⦄ ⊢ ➡[h, o] K1 & ⦃G1, L1⦄ ⊢ T1 ➡[h, o] T & ⦃G1, K1, T⦄ ⊐ ⦃G2, K2, T2⦄.
+#h #o #G1 #G2 #L1 #L2 #T1 #T2 #H elim H -G1 -G2 -L1 -L2 -T1 -T2
+/3 width=5 by fqu_lref_O, fqu_pair_sn, fqu_flat_dx, lpx_pair, ex3_2_intro/
+[ #a #I #G2 #L2 #V2 #T2 #X #H elim (lpx_inv_pair1 … H) -H
+ #K2 #W2 #HLK2 #HVW2 #H destruct
+ /3 width=5 by cpx_pair_sn, fqu_bind_dx, ex3_2_intro/
+| #G #L1 #K1 #T1 #U1 #k #HLK1 #HTU1 #K2 #HK12
+ elim (drop_lpx_trans … HLK1 … HK12) -HK12
+ /3 width=7 by fqu_drop, ex3_2_intro/
+]
+qed-.
+
+lemma fquq_lpx_trans: ∀h,o,G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐⸮ ⦃G2, L2, T2⦄ →
+ ∀K2. ⦃G2, L2⦄ ⊢ ➡[h, o] K2 →
+ ∃∃K1,T. ⦃G1, L1⦄ ⊢ ➡[h, o] K1 & ⦃G1, L1⦄ ⊢ T1 ➡[h, o] T & ⦃G1, K1, T⦄ ⊐⸮ ⦃G2, K2, T2⦄.
+#h #o #G1 #G2 #L1 #L2 #T1 #T2 #H #K2 #HLK2 elim (fquq_inv_gen … H) -H
+[ #HT12 elim (fqu_lpx_trans … HT12 … HLK2) /3 width=5 by fqu_fquq, ex3_2_intro/
+| * #H1 #H2 #H3 destruct /2 width=5 by ex3_2_intro/
+]
+qed-.
+
+lemma lpx_fqu_trans: ∀h,o,G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐ ⦃G2, L2, T2⦄ →
+ ∀K1. ⦃G1, K1⦄ ⊢ ➡[h, o] L1 →
+ ∃∃K2,T. ⦃G1, K1⦄ ⊢ T1 ➡[h, o] T & ⦃G1, K1, T⦄ ⊐ ⦃G2, K2, T2⦄ & ⦃G2, K2⦄ ⊢ ➡[h, o] L2.
+#h #o #G1 #G2 #L1 #L2 #T1 #T2 #H elim H -G1 -G2 -L1 -L2 -T1 -T2
+/3 width=7 by fqu_pair_sn, fqu_bind_dx, fqu_flat_dx, lpx_pair, ex3_2_intro/
+[ #I #G1 #L1 #V1 #X #H elim (lpx_inv_pair2 … H) -H
+ #K1 #W1 #HKL1 #HWV1 #H destruct elim (lift_total V1 0 1)
+ /4 width=7 by cpx_delta, fqu_drop, drop_drop, ex3_2_intro/
+| #G #L1 #K1 #T1 #U1 #k #HLK1 #HTU1 #L0 #HL01
+ elim (lpx_drop_trans_O1 … HL01 … HLK1) -L1
+ /3 width=5 by fqu_drop, ex3_2_intro/
+]
+qed-.
+
+lemma lpx_fquq_trans: ∀h,o,G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐⸮ ⦃G2, L2, T2⦄ →
+ ∀K1. ⦃G1, K1⦄ ⊢ ➡[h, o] L1 →
+ ∃∃K2,T. ⦃G1, K1⦄ ⊢ T1 ➡[h, o] T & ⦃G1, K1, T⦄ ⊐⸮ ⦃G2, K2, T2⦄ & ⦃G2, K2⦄ ⊢ ➡[h, o] L2.
+#h #o #G1 #G2 #L1 #L2 #T1 #T2 #H #K1 #HKL1 elim (fquq_inv_gen … H) -H
+[ #HT12 elim (lpx_fqu_trans … HT12 … HKL1) /3 width=5 by fqu_fquq, ex3_2_intro/
+| * #H1 #H2 #H3 destruct /2 width=5 by ex3_2_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.ma".
+include "basic_2/substitution/lpx_sn.ma".
+
+(* SN POINTWISE EXTENSION OF A CONTEXT-SENSITIVE REALTION FOR TERMS *********)
+
+(* alternative definition of lpx_sn *)
+definition lpx_sn_alt: relation3 lenv term term → relation lenv ≝
+ λR,L1,L2. |L1| = |L2| ∧
+ (∀I1,I2,K1,K2,V1,V2,i.
+ ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
+ I1 = I2 ∧ R K1 V1 V2
+ ).
+
+(* Basic forward lemmas ******************************************************)
+
+lemma lpx_sn_alt_fwd_length: ∀R,L1,L2. lpx_sn_alt R L1 L2 → |L1| = |L2|.
+#R #L1 #L2 #H elim H //
+qed-.
+
+(* Basic inversion lemmas ***************************************************)
+
+lemma lpx_sn_alt_inv_atom1: ∀R,L2. lpx_sn_alt R (⋆) L2 → L2 = ⋆.
+#R #L2 #H lapply (lpx_sn_alt_fwd_length … H) -H
+normalize /2 width=1 by length_inv_zero_sn/
+qed-.
+
+lemma lpx_sn_alt_inv_pair1: ∀R,I,L2,K1,V1. lpx_sn_alt R (K1.ⓑ{I}V1) L2 →
+ ∃∃K2,V2. lpx_sn_alt R K1 K2 & R K1 V1 V2 & L2 = K2.ⓑ{I}V2.
+#R #I1 #L2 #K1 #V1 #H elim H -H
+#H #IH elim (length_inv_pos_sn … H) -H
+#I2 #K2 #V2 #HK12 #H destruct
+elim (IH I1 I2 K1 K2 V1 V2 0) //
+#H #HV12 destruct @(ex3_2_intro … K2 V2) // -HV12
+@conj // -HK12
+#J1 #J2 #L1 #L2 #W1 #W2 #i #HKL1 #HKL2 elim (IH J1 J2 L1 L2 W1 W2 (⫯i)) -IH
+/2 width=1 by drop_drop, conj/
+qed-.
+
+lemma lpx_sn_alt_inv_atom2: ∀R,L1. lpx_sn_alt R L1 (⋆) → L1 = ⋆.
+#R #L1 #H lapply (lpx_sn_alt_fwd_length … H) -H
+normalize /2 width=1 by length_inv_zero_dx/
+qed-.
+
+lemma lpx_sn_alt_inv_pair2: ∀R,I,L1,K2,V2. lpx_sn_alt R L1 (K2.ⓑ{I}V2) →
+ ∃∃K1,V1. lpx_sn_alt R K1 K2 & R K1 V1 V2 & L1 = K1.ⓑ{I}V1.
+#R #I2 #L1 #K2 #V2 #H elim H -H
+#H #IH elim (length_inv_pos_dx … H) -H
+#I1 #K1 #V1 #HK12 #H destruct
+elim (IH I1 I2 K1 K2 V1 V2 0) //
+#H #HV12 destruct @(ex3_2_intro … K1 V1) // -HV12
+@conj // -HK12
+#J1 #J2 #L1 #L2 #W1 #W2 #i #HKL1 #HKL2 elim (IH J1 J2 L1 L2 W1 W2 (⫯i)) -IH
+/2 width=1 by drop_drop, conj/
+qed-.
+
+(* Basic properties *********************************************************)
+
+lemma lpx_sn_alt_atom: ∀R. lpx_sn_alt R (⋆) (⋆).
+#R @conj //
+#I1 #I2 #K1 #K2 #V1 #V2 #i #HLK1 elim (drop_inv_atom1 … HLK1) -HLK1
+#H destruct
+qed.
+
+lemma lpx_sn_alt_pair: ∀R,I,L1,L2,V1,V2.
+ lpx_sn_alt R L1 L2 → R L1 V1 V2 →
+ lpx_sn_alt R (L1.ⓑ{I}V1) (L2.ⓑ{I}V2).
+#R #I #L1 #L2 #V1 #V2 #H #HV12 elim H -H
+#HL12 #IH @conj //
+#I1 #I2 #K1 #K2 #W1 #W2 #i @(ynat_ind … i) -i
+[ #HLK1 #HLK2
+ lapply (drop_inv_O2 … HLK1) -HLK1 #H destruct
+ lapply (drop_inv_O2 … HLK2) -HLK2 #H destruct
+ /2 width=1 by conj/
+| -HL12 -HV12 /3 width=6 by drop_inv_drop1/
+| #H lapply (drop_fwd_Y2 … H) -H
+ #H elim (ylt_yle_false … H) -H //
+]
+qed.
+
+(* Main properties **********************************************************)
+
+theorem lpx_sn_lpx_sn_alt: ∀R,L1,L2. lpx_sn R L1 L2 → lpx_sn_alt R L1 L2.
+#R #L1 #L2 #H elim H -L1 -L2
+/2 width=1 by lpx_sn_alt_atom, lpx_sn_alt_pair/
+qed.
+
+(* Main inversion lemmas ****************************************************)
+
+theorem lpx_sn_alt_inv_lpx_sn: ∀R,L1,L2. lpx_sn_alt R L1 L2 → lpx_sn R L1 L2.
+#R #L1 elim L1 -L1
+[ #L2 #H lapply (lpx_sn_alt_inv_atom1 … H) -H //
+| #L1 #I #V1 #IH #X #H elim (lpx_sn_alt_inv_pair1 … H) -H
+ #L2 #V2 #HL12 #HV12 #H destruct /3 width=1 by lpx_sn_pair/
+]
+qed-.
+
+(* alternative definition of lpx_sn *****************************************)
+
+lemma lpx_sn_intro_alt: ∀R,L1,L2. |L1| = |L2| →
+ (∀I1,I2,K1,K2,V1,V2,i.
+ ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
+ I1 = I2 ∧ R K1 V1 V2
+ ) → lpx_sn R L1 L2.
+/4 width=4 by lpx_sn_alt_inv_lpx_sn, conj/ qed.
+
+lemma lpx_sn_inv_alt: ∀R,L1,L2. lpx_sn R L1 L2 →
+ |L1| = |L2| ∧
+ ∀I1,I2,K1,K2,V1,V2,i.
+ ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
+ I1 = I2 ∧ R K1 V1 V2.
+#R #L1 #L2 #H lapply (lpx_sn_lpx_sn_alt … H) -H
+#H elim H -H /3 width=4 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.ma".
+
+(* SN POINTWISE EXTENSION OF A CONTEXT-SENSITIVE REALTION FOR TERMS *********)
+
+(* Properties on transitive_closure *****************************************)
+
+lemma TC_lpx_sn_pair_refl: ∀R. (∀L. reflexive … (R L)) →
+ ∀L1,L2. TC … (lpx_sn R) L1 L2 →
+ ∀I,V. TC … (lpx_sn R) (L1. ⓑ{I} V) (L2. ⓑ{I} V).
+#R #HR #L1 #L2 #H @(TC_star_ind … L2 H) -L2
+[ /2 width=1 by lpx_sn_refl/
+| /3 width=1 by TC_reflexive, lpx_sn_refl/
+| /3 width=5 by lpx_sn_pair, step/
+]
+qed-.
+
+lemma TC_lpx_sn_pair: ∀R. (∀L. reflexive … (R L)) →
+ ∀I,L1,L2. TC … (lpx_sn R) L1 L2 →
+ ∀V1,V2. LTC … R L1 V1 V2 →
+ TC … (lpx_sn R) (L1. ⓑ{I} V1) (L2. ⓑ{I} V2).
+#R #HR #I #L1 #L2 #HL12 #V1 #V2 #H @(TC_star_ind_dx … V1 H) -V1 //
+[ /2 width=1 by TC_lpx_sn_pair_refl/
+| /4 width=3 by TC_strap, lpx_sn_pair, lpx_sn_refl/
+]
+qed-.
+
+lemma lpx_sn_LTC_TC_lpx_sn: ∀R. (∀L. reflexive … (R L)) →
+ ∀L1,L2. lpx_sn (LTC … R) L1 L2 →
+ TC … (lpx_sn R) L1 L2.
+#R #HR #L1 #L2 #H elim H -L1 -L2
+/2 width=1 by TC_lpx_sn_pair, lpx_sn_atom, inj/
+qed-.
+
+(* Inversion lemmas on transitive closure ***********************************)
+
+lemma TC_lpx_sn_inv_atom2: ∀R,L1. TC … (lpx_sn R) L1 (⋆) → L1 = ⋆.
+#R #L1 #H @(TC_ind_dx … L1 H) -L1
+[ /2 width=2 by lpx_sn_inv_atom2/
+| #L1 #L #HL1 #_ #IHL2 destruct /2 width=2 by lpx_sn_inv_atom2/
+]
+qed-.
+
+lemma TC_lpx_sn_inv_pair2: ∀R. c_rs_transitive … R (λ_. lpx_sn R) →
+ ∀I,L1,K2,V2. TC … (lpx_sn R) L1 (K2.ⓑ{I}V2) →
+ ∃∃K1,V1. TC … (lpx_sn R) K1 K2 & LTC … R K1 V1 V2 & L1 = K1. ⓑ{I} V1.
+#R #HR #I #L1 #K2 #V2 #H @(TC_ind_dx … L1 H) -L1
+[ #L1 #H elim (lpx_sn_inv_pair2 … H) -H /3 width=5 by inj, ex3_2_intro/
+| #L1 #L #HL1 #_ * #K #V #HK2 #HV2 #H destruct
+ elim (lpx_sn_inv_pair2 … HL1) -HL1 #K1 #V1 #HK1 #HV1 #H destruct
+ lapply (HR … HV2 … HK1) -HR -HV2 /3 width=5 by TC_strap, ex3_2_intro/
+]
+qed-.
+
+lemma TC_lpx_sn_ind: ∀R. c_rs_transitive … R (λ_. lpx_sn R) →
+ ∀S:relation lenv.
+ S (⋆) (⋆) → (
+ ∀I,K1,K2,V1,V2.
+ TC … (lpx_sn R) K1 K2 → LTC … R K1 V1 V2 →
+ S K1 K2 → S (K1.ⓑ{I}V1) (K2.ⓑ{I}V2)
+ ) →
+ ∀L2,L1. TC … (lpx_sn R) L1 L2 → S L1 L2.
+#R #HR #S #IH1 #IH2 #L2 elim L2 -L2
+[ #X #H >(TC_lpx_sn_inv_atom2 … H) -X //
+| #L2 #I #V2 #IHL2 #X #H
+ elim (TC_lpx_sn_inv_pair2 … H) // -H -HR
+ #L1 #V1 #HL12 #HV12 #H destruct /3 width=1 by/
+]
+qed-.
+
+lemma TC_lpx_sn_inv_atom1: ∀R,L2. TC … (lpx_sn R) (⋆) L2 → L2 = ⋆.
+#R #L2 #H elim H -L2
+[ /2 width=2 by lpx_sn_inv_atom1/
+| #L #L2 #_ #HL2 #IHL1 destruct /2 width=2 by lpx_sn_inv_atom1/
+]
+qed-.
+
+fact TC_lpx_sn_inv_pair1_aux: ∀R. c_rs_transitive … R (λ_. lpx_sn R) →
+ ∀L1,L2. TC … (lpx_sn R) L1 L2 →
+ ∀I,K1,V1. L1 = K1.ⓑ{I}V1 →
+ ∃∃K2,V2. TC … (lpx_sn R) K1 K2 & LTC … R K1 V1 V2 & L2 = K2. ⓑ{I} V2.
+#R #HR #L1 #L2 #H @(TC_lpx_sn_ind … H) // -HR -L1 -L2
+[ #J #K #W #H destruct
+| #I #L1 #L2 #V1 #V2 #HL12 #HV12 #_ #J #K #W #H destruct /2 width=5 by ex3_2_intro/
+]
+qed-.
+
+lemma TC_lpx_sn_inv_pair1: ∀R. c_rs_transitive … R (λ_. lpx_sn R) →
+ ∀I,K1,L2,V1. TC … (lpx_sn R) (K1.ⓑ{I}V1) L2 →
+ ∃∃K2,V2. TC … (lpx_sn R) K1 K2 & LTC … R K1 V1 V2 & L2 = K2. ⓑ{I} V2.
+/2 width=3 by TC_lpx_sn_inv_pair1_aux/ qed-.
+
+lemma TC_lpx_sn_inv_lpx_sn_LTC: ∀R. c_rs_transitive … R (λ_. lpx_sn R) →
+ ∀L1,L2. TC … (lpx_sn R) L1 L2 →
+ lpx_sn (LTC … R) L1 L2.
+/3 width=4 by TC_lpx_sn_ind, lpx_sn_pair/ qed-.
+
+(* Forward lemmas on transitive closure *************************************)
+
+lemma TC_lpx_sn_fwd_length: ∀R,L1,L2. TC … (lpx_sn R) L1 L2 → |L1| = |L2|.
+#R #L1 #L2 #H elim H -L2
+[ #L2 #HL12 >(lpx_sn_fwd_length … HL12) -HL12 //
+| #L #L2 #_ #HL2 #IHL1
+ >IHL1 -L1 >(lpx_sn_fwd_length … HL2) -HL2 //
+]
+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 *)
+(* *)
+(**************************************************************************)
+
+(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
+
+notation "hvbox( L1 break ⊆ [ term 46 l , break term 46 m ] break term 46 L2 )"
+ non associative with precedence 45
+ for @{ 'LRSubEq $L1 $l $k $L2 }.
--- /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/statictypestar_6.ma".
+include "basic_2/grammar/genv.ma".
+include "basic_2/substitution/drop.ma".
+include "basic_2/static/sh.ma".
+
+(* NAT-ITERATED STATIC TYPE ASSIGNMENT FOR TERMS ****************************)
+
+(* activate genv *)
+inductive lstas (h): nat → relation4 genv lenv term term ≝
+| lstas_sort: ∀G,L,d,s. lstas h d G L (⋆s) (⋆((next h)^d s))
+| lstas_ldef: ∀G,L,K,V,W,U,i,d. ⬇[i] L ≡ K.ⓓV → lstas h d G K V W →
+ ⬆[0, i+1] W ≡ U → lstas h d G L (#i) U
+| lstas_zero: ∀G,L,K,W,V,i. ⬇[i] L ≡ K.ⓛW → lstas h 0 G K W V →
+ lstas h 0 G L (#i) (#i)
+| lstas_succ: ∀G,L,K,W,V,U,i,d. ⬇[i] L ≡ K.ⓛW → lstas h d G K W V →
+ ⬆[0, i+1] V ≡ U → lstas h (d+1) G L (#i) U
+| lstas_bind: ∀a,I,G,L,V,T,U,d. lstas h d G (L.ⓑ{I}V) T U →
+ lstas h d G L (ⓑ{a,I}V.T) (ⓑ{a,I}V.U)
+| lstas_appl: ∀G,L,V,T,U,d. lstas h d G L T U → lstas h d G L (ⓐV.T) (ⓐV.U)
+| lstas_cast: ∀G,L,W,T,U,d. lstas h d G L T U → lstas h d G L (ⓝW.T) U
+.
+
+interpretation "nat-iterated static type assignment (term)"
+ 'StaticTypeStar h G L d T U = (lstas h d G L T U).
+
+(* Basic inversion lemmas ***************************************************)
+
+fact lstas_inv_sort1_aux: ∀h,G,L,T,U,d. ⦃G, L⦄ ⊢ T •*[h, d] U → ∀s0. T = ⋆s0 →
+ U = ⋆((next h)^d s0).
+#h #G #L #T #U #d * -G -L -T -U -d
+[ #G #L #d #s #s0 #H destruct //
+| #G #L #K #V #W #U #i #d #_ #_ #_ #s0 #H destruct
+| #G #L #K #W #V #i #_ #_ #s0 #H destruct
+| #G #L #K #W #V #U #i #d #_ #_ #_ #s0 #H destruct
+| #a #I #G #L #V #T #U #d #_ #s0 #H destruct
+| #G #L #V #T #U #d #_ #s0 #H destruct
+| #G #L #W #T #U #d #_ #s0 #H destruct
+qed-.
+
+(* Basic_1: was just: sty0_gen_sort *)
+lemma lstas_inv_sort1: ∀h,G,L,X,s,d. ⦃G, L⦄ ⊢ ⋆s •*[h, d] X → X = ⋆((next h)^d s).
+/2 width=5 by lstas_inv_sort1_aux/
+qed-.
+
+fact lstas_inv_lref1_aux: ∀h,G,L,T,U,d. ⦃G, L⦄ ⊢ T •*[h, d] U → ∀j. T = #j → ∨∨
+ (∃∃K,V,W. ⬇[j] L ≡ K.ⓓV & ⦃G, K⦄ ⊢ V •*[h, d] W &
+ ⬆[0, j+1] W ≡ U
+ ) |
+ (∃∃K,W,V. ⬇[j] L ≡ K.ⓛW & ⦃G, K⦄ ⊢ W •*[h, 0] V &
+ U = #j & d = 0
+ ) |
+ (∃∃K,W,V,d0. ⬇[j] L ≡ K.ⓛW & ⦃G, K⦄ ⊢ W •*[h, d0] V &
+ ⬆[0, j+1] V ≡ U & d = d0+1
+ ).
+#h #G #L #T #U #d * -G -L -T -U -d
+[ #G #L #d #s #j #H destruct
+| #G #L #K #V #W #U #i #d #HLK #HVW #HWU #j #H destruct /3 width=6 by or3_intro0, ex3_3_intro/
+| #G #L #K #W #V #i #HLK #HWV #j #H destruct /3 width=5 by or3_intro1, ex4_3_intro/
+| #G #L #K #W #V #U #i #d #HLK #HWV #HWU #j #H destruct /3 width=8 by or3_intro2, ex4_4_intro/
+| #a #I #G #L #V #T #U #d #_ #j #H destruct
+| #G #L #V #T #U #d #_ #j #H destruct
+| #G #L #W #T #U #d #_ #j #H destruct
+]
+qed-.
+
+lemma lstas_inv_lref1: ∀h,G,L,X,i,d. ⦃G, L⦄ ⊢ #i •*[h, d] X → ∨∨
+ (∃∃K,V,W. ⬇[i] L ≡ K.ⓓV & ⦃G, K⦄ ⊢ V •*[h, d] W &
+ ⬆[0, i+1] W ≡ X
+ ) |
+ (∃∃K,W,V. ⬇[i] L ≡ K.ⓛW & ⦃G, K⦄ ⊢ W •*[h, 0] V &
+ X = #i & d = 0
+ ) |
+ (∃∃K,W,V,d0. ⬇[i] L ≡ K.ⓛW & ⦃G, K⦄ ⊢ W •*[h, d0] V &
+ ⬆[0, i+1] V ≡ X & d = d0+1
+ ).
+/2 width=3 by lstas_inv_lref1_aux/
+qed-.
+
+lemma lstas_inv_lref1_O: ∀h,G,L,X,i. ⦃G, L⦄ ⊢ #i •*[h, 0] X →
+ (∃∃K,V,W. ⬇[i] L ≡ K.ⓓV & ⦃G, K⦄ ⊢ V •*[h, 0] W &
+ ⬆[0, i+1] W ≡ X
+ ) ∨
+ (∃∃K,W,V. ⬇[i] L ≡ K.ⓛW & ⦃G, K⦄ ⊢ W •*[h, 0] V &
+ X = #i
+ ).
+#h #G #L #X #i #H elim (lstas_inv_lref1 … H) -H * /3 width=6 by ex3_3_intro, or_introl, or_intror/
+#K #W #V #d #_ #_ #_ <plus_n_Sm #H destruct
+qed-.
+
+(* Basic_1: was just: sty0_gen_lref *)
+lemma lstas_inv_lref1_S: ∀h,G,L,X,i,d. ⦃G, L⦄ ⊢ #i •*[h, d+1] X →
+ (∃∃K,V,W. ⬇[i] L ≡ K.ⓓV & ⦃G, K⦄ ⊢ V •*[h, d+1] W &
+ ⬆[0, i+1] W ≡ X
+ ) ∨
+ (∃∃K,W,V. ⬇[i] L ≡ K.ⓛW & ⦃G, K⦄ ⊢ W •*[h, d] V &
+ ⬆[0, i+1] V ≡ X
+ ).
+#h #G #L #X #i #d #H elim (lstas_inv_lref1 … H) -H * /3 width=6 by ex3_3_intro, or_introl, or_intror/
+#K #W #V #_ #_ #_ <plus_n_Sm #H destruct
+qed-.
+
+fact lstas_inv_gref1_aux: ∀h,G,L,T,U,d. ⦃G, L⦄ ⊢ T •*[h, d] U → ∀p0. T = §p0 → ⊥.
+#h #G #L #T #U #d * -G -L -T -U -d
+[ #G #L #d #s #p0 #H destruct
+| #G #L #K #V #W #U #i #d #_ #_ #_ #p0 #H destruct
+| #G #L #K #W #V #i #_ #_ #p0 #H destruct
+| #G #L #K #W #V #U #i #d #_ #_ #_ #p0 #H destruct
+| #a #I #G #L #V #T #U #d #_ #p0 #H destruct
+| #G #L #V #T #U #d #_ #p0 #H destruct
+| #G #L #W #T #U #d #_ #p0 #H destruct
+qed-.
+
+lemma lstas_inv_gref1: ∀h,G,L,X,p,d. ⦃G, L⦄ ⊢ §p •*[h, d] X → ⊥.
+/2 width=9 by lstas_inv_gref1_aux/
+qed-.
+
+fact lstas_inv_bind1_aux: ∀h,G,L,T,U,d. ⦃G, L⦄ ⊢ T •*[h, d] U → ∀b,J,X,Y. T = ⓑ{b,J}Y.X →
+ ∃∃Z. ⦃G, L.ⓑ{J}Y⦄ ⊢ X •*[h, d] Z & U = ⓑ{b,J}Y.Z.
+#h #G #L #T #U #d * -G -L -T -U -d
+[ #G #L #d #s #b #J #X #Y #H destruct
+| #G #L #K #V #W #U #i #d #_ #_ #_ #b #J #X #Y #H destruct
+| #G #L #K #W #V #i #_ #_ #b #J #X #Y #H destruct
+| #G #L #K #W #V #U #i #d #_ #_ #_ #b #J #X #Y #H destruct
+| #a #I #G #L #V #T #U #d #HTU #b #J #X #Y #H destruct /2 width=3 by ex2_intro/
+| #G #L #V #T #U #d #_ #b #J #X #Y #H destruct
+| #G #L #W #T #U #d #_ #b #J #X #Y #H destruct
+]
+qed-.
+
+(* Basic_1: was just: sty0_gen_bind *)
+lemma lstas_inv_bind1: ∀h,a,I,G,L,V,T,X,d. ⦃G, L⦄ ⊢ ⓑ{a,I}V.T •*[h, d] X →
+ ∃∃U. ⦃G, L.ⓑ{I}V⦄ ⊢ T •*[h, d] U & X = ⓑ{a,I}V.U.
+/2 width=3 by lstas_inv_bind1_aux/
+qed-.
+
+fact lstas_inv_appl1_aux: ∀h,G,L,T,U,d. ⦃G, L⦄ ⊢ T •*[h, d] U → ∀X,Y. T = ⓐY.X →
+ ∃∃Z. ⦃G, L⦄ ⊢ X •*[h, d] Z & U = ⓐY.Z.
+#h #G #L #T #U #d * -G -L -T -U -d
+[ #G #L #d #s #X #Y #H destruct
+| #G #L #K #V #W #U #i #d #_ #_ #_ #X #Y #H destruct
+| #G #L #K #W #V #i #_ #_ #X #Y #H destruct
+| #G #L #K #W #V #U #i #d #_ #_ #_ #X #Y #H destruct
+| #a #I #G #L #V #T #U #d #_ #X #Y #H destruct
+| #G #L #V #T #U #d #HTU #X #Y #H destruct /2 width=3 by ex2_intro/
+| #G #L #W #T #U #d #_ #X #Y #H destruct
+]
+qed-.
+
+(* Basic_1: was just: sty0_gen_appl *)
+lemma lstas_inv_appl1: ∀h,G,L,V,T,X,d. ⦃G, L⦄ ⊢ ⓐV.T •*[h, d] X →
+ ∃∃U. ⦃G, L⦄ ⊢ T •*[h, d] U & X = ⓐV.U.
+/2 width=3 by lstas_inv_appl1_aux/
+qed-.
+
+fact lstas_inv_cast1_aux: ∀h,G,L,T,U,d. ⦃G, L⦄ ⊢ T •*[h, d] U → ∀X,Y. T = ⓝY.X →
+ ⦃G, L⦄ ⊢ X •*[h, d] U.
+#h #G #L #T #U #d * -G -L -T -U -d
+[ #G #L #d #s #X #Y #H destruct
+| #G #L #K #V #W #U #i #d #_ #_ #_ #X #Y #H destruct
+| #G #L #K #W #V #i #_ #_ #X #Y #H destruct
+| #G #L #K #W #V #U #i #d #_ #_ #_ #X #Y #H destruct
+| #a #I #G #L #V #T #U #d #_ #X #Y #H destruct
+| #G #L #V #T #U #d #_ #X #Y #H destruct
+| #G #L #W #T #U #d #HTU #X #Y #H destruct //
+]
+qed-.
+
+(* Basic_1: was just: sty0_gen_cast *)
+lemma lstas_inv_cast1: ∀h,G,L,W,T,U,d. ⦃G, L⦄ ⊢ ⓝW.T •*[h, d] U → ⦃G, L⦄ ⊢ T •*[h, d] U.
+/2 width=4 by lstas_inv_cast1_aux/
+qed-.
+
+(* Basic_1: removed theorems 7:
+ sty1_abbr sty1_appl sty1_bind sty1_cast2
+ sty1_correct sty1_lift sty1_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/static/aaa_lift.ma".
+include "basic_2/unfold/lstas_lstas.ma".
+
+(* NAT-ITERATED STATIC TYPE ASSIGNMENT FOR TERMS ****************************)
+
+(* Properties on atomic arity assignment for terms **************************)
+
+lemma aaa_lstas: ∀h,G,L,T,A. ⦃G, L⦄ ⊢ T ⁝ A → ∀d.
+ ∃∃U. ⦃G, L⦄ ⊢ T •*[h, d] U & ⦃G, L⦄ ⊢ U ⁝ A.
+#h #G #L #T #A #H elim H -G -L -T -A
+[ /2 width=3 by ex2_intro/
+| * #G #L #K #V #B #i #HLK #HV #IHV #d
+ [ elim (IHV d) -IHV #W
+ elim (lift_total W 0 (i+1))
+ lapply (drop_fwd_drop2 … HLK)
+ /3 width=10 by lstas_ldef, aaa_lift, ex2_intro/
+ | @(nat_ind_plus … d) -d
+ [ elim (IHV 0) -IHV /3 width=7 by lstas_zero, aaa_lref, ex2_intro/
+ | #d #_ elim (IHV d) -IHV #W
+ elim (lift_total W 0 (i+1))
+ lapply (drop_fwd_drop2 … HLK)
+ /3 width=10 by lstas_succ, aaa_lift, ex2_intro/
+ ]
+ ]
+| #a #G #L #V #T #B #A #HV #_ #_ #IHT #d elim (IHT d) -IHT
+ /3 width=7 by lstas_bind, aaa_abbr, ex2_intro/
+| #a #G #L #V #T #B #A #HV #_ #_ #IHT #d elim (IHT d) -IHT
+ /3 width=6 by lstas_bind, aaa_abst, ex2_intro/
+| #G #L #V #T #B #A #HV #_ #_ #IHT #d elim (IHT d) -IHT
+ /3 width=6 by lstas_appl, aaa_appl, ex2_intro/
+| #G #L #W #T #A #HW #_ #_ #IHT #d elim (IHT d) -IHT
+ /3 width=3 by lstas_cast, aaa_cast, ex2_intro/
+]
+qed-.
+
+lemma lstas_aaa_conf: ∀h,G,L,d. Conf3 … (aaa G L) (lstas h d G L).
+#h #G #L #d #A #T #HT #U #HTU
+elim (aaa_lstas h … HT d) -HT #X #HTX
+lapply (lstas_mono … HTX … HTU) -T //
+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/static/da_da.ma".
+include "basic_2/unfold/lstas_lstas.ma".
+
+(* NAT-ITERATED STATIC TYPE ASSIGNMENT FOR TERMS ****************************)
+
+(* Properties on degree assignment for terms ********************************)
+
+lemma da_lstas: ∀h,o,G,L,T,d1. ⦃G, L⦄ ⊢ T ▪[h, o] d1 → ∀d2.
+ ∃∃U. ⦃G, L⦄ ⊢ T •*[h, d2] U & ⦃G, L⦄ ⊢ U ▪[h, o] d1-d2.
+#h #o #G #L #T #d1 #H elim H -G -L -T -d1
+[ /4 width=3 by da_sort, deg_iter, ex2_intro/
+| #G #L #K #V #i #d1 #HLK #_ #IHV #d2
+ elim (IHV d2) -IHV #W
+ elim (lift_total W 0 (i+1))
+ lapply (drop_fwd_drop2 … HLK)
+ /3 width=10 by lstas_ldef, da_lift, ex2_intro/
+| #G #L #K #W #i #d1 #HLK #HW #IHW #d2 @(nat_ind_plus … d2) -d2
+ [ elim (IHW 0) -IHW /3 width=6 by lstas_zero, da_ldec, ex2_intro/
+ | #d #_ elim (IHW d) -IHW #V
+ elim (lift_total V 0 (i+1))
+ lapply (drop_fwd_drop2 … HLK)
+ /3 width=10 by lstas_succ, da_lift, ex2_intro/
+ ]
+| #a #I #G #L #V #T #d1 #_ #IHT #d2 elim (IHT … d2) -IHT
+ /3 width=6 by lstas_bind, da_bind, ex2_intro/
+| * #G #L #V #T #d1 #_ #IHT #d2 elim (IHT … d2) -IHT
+ /3 width=5 by lstas_appl, lstas_cast, da_flat, ex2_intro/
+]
+qed-.
+
+lemma lstas_da_conf: ∀h,o,G,L,T,U,d2. ⦃G, L⦄ ⊢ T •*[h, d2] U →
+ ∀d1. ⦃G, L⦄ ⊢ T ▪[h, o] d1 → ⦃G, L⦄ ⊢ U ▪[h, o] d1-d2.
+#h #o #G #L #T #U #d2 #HTU #d1 #HT
+elim (da_lstas … HT d2) -HT #X #HTX
+lapply (lstas_mono … HTX … HTU) -T //
+qed-.
+
+(* inversion lemmas on degree assignment for terms **************************)
+
+lemma lstas_inv_da: ∀h,o,G,L,T,U,d2. ⦃G, L⦄ ⊢ T •*[h, d2] U →
+ ∃∃d1. ⦃G, L⦄ ⊢ T ▪[h, o] d1 & ⦃G, L⦄ ⊢ U ▪[h, o] d1-d2.
+#h #o #G #L #T #U #d2 #H elim H -G -L -T -U -d2
+[ #G #L #d2 #s elim (deg_total h o s) /4 width=3 by da_sort, deg_iter, ex2_intro/
+| #G #L #K #V #W #U #i #d2 #HLK #_ #HWU *
+ lapply (drop_fwd_drop2 … HLK) /3 width=10 by da_lift, da_ldef, ex2_intro/
+| #G #L #K #W #V #i #HLK #_ * /3 width=6 by da_ldec, ex2_intro/
+| #G #L #K #W #V #U #i #d2 #HLK #_ #HVU *
+ lapply (drop_fwd_drop2 … HLK) /3 width=10 by da_lift, da_ldec, ex2_intro/
+| #a #I #G #L #V #T #U #d2 #_ * /3 width=3 by da_bind, ex2_intro/
+| #G #L #V #T #U #d2 #_ * /3 width=3 by da_flat, ex2_intro/
+| #G #L #W #T #U #d2 #_ * /3 width=3 by da_flat, ex2_intro/
+]
+qed-.
+
+lemma lstas_inv_da_ge: ∀h,G,L,T,U,d2,d. ⦃G, L⦄ ⊢ T •*[h, d2] U →
+ ∃∃o,d1. ⦃G, L⦄ ⊢ T ▪[h, o] d1 & ⦃G, L⦄ ⊢ U ▪[h, o] d1-d2 & d ≤ d1.
+#h #G #L #T #U #d2 #d #H elim H -G -L -T -U -d2
+[ /4 width=5 by da_sort, deg_iter, ex3_2_intro/
+| #G #L #K #V #W #U #i #d2 #HLK #_ #HWU *
+ lapply (drop_fwd_drop2 … HLK) /3 width=10 by da_lift, da_ldef, ex3_2_intro/
+| #G #L #K #W #V #i #HLK #_ *
+ #o #d1 #HW #HV #Hd1 /4 width=6 by da_ldec, lt_to_le, le_S_S, ex3_2_intro/
+| #G #L #K #W #V #U #i #d2 #HLK #_ #HVU *
+ lapply (drop_fwd_drop2 … HLK)
+ /4 width=10 by da_lift, da_ldec, lt_to_le, le_S_S, ex3_2_intro/
+| #a #I #G #L #V #T #U #d2 #_ * /3 width=5 by da_bind, ex3_2_intro/
+| #G #L #V #T #U #d2 #_ * /3 width=5 by da_flat, ex3_2_intro/
+| #G #L #W #T #U #d2 #_ * /3 width=5 by da_flat, ex3_2_intro/
+]
+qed-.
+
+(* Advanced inversion lemmas ************************************************)
+
+lemma lstas_inv_refl_pos: ∀h,G,L,T,d. ⦃G, L⦄ ⊢ T •*[h, d+1] T → ⊥.
+#h #G #L #T #d2 #H elim (lstas_inv_da_ge … (d2+1) H) -H
+#o #d1 #HT1 #HT12 #Hd21 lapply (da_mono … HT1 … HT12) -h -G -L -T
+#H elim (discr_x_minus_xy … H) -H
+[ #H destruct /2 width=3 by le_plus_xSy_O_false/
+| -d1 <plus_n_Sm #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 "ground_2/ynat/ynat_max.ma".
+include "basic_2/substitution/drop_drop.ma".
+include "basic_2/unfold/lstas.ma".
+
+(* NAT-ITERATED STATIC TYPE ASSIGNMENT FOR TERMS ****************************)
+
+(* Properties on relocation *************************************************)
+
+(* Basic_1: was just: sty0_lift *)
+lemma lstas_lift: ∀h,G,d. d_liftable (lstas h G d).
+#h #G #d #L1 #T1 #U1 #H elim H -G -L1 -T1 -U1 -d
+[ #G #L1 #d #s #L2 #c #l #k #HL21 #X1 #H1 #X2 #H2
+ >(lift_inv_sort1 … H1) -X1
+ >(lift_inv_sort1 … H2) -X2 //
+| #G #L1 #K1 #V1 #W1 #W #i #d #HLK1 #_ #HW1 #IHVW1 #L2 #c #l #k #HL21 #X #H #U2 #HWU2
+ elim (lift_inv_lref1 … H) * #Hil #H destruct
+ [ elim (lift_trans_ge … HW1 … HWU2) -W /2 width=1 by ylt_fwd_le_succ1/ #W2 #HW12 #HWU2
+ elim (drop_trans_le … HL21 … HLK1) -L1 /2 width=2 by ylt_fwd_le/ #X #HLK2 #H
+ elim (drop_inv_skip2 … H) -H /2 width=1 by ylt_to_minus/ -Hil #K2 #V2 #HK21 #HV12 #H destruct
+ /3 width=9 by lstas_ldef/
+ | lapply (lift_trans_be … HW1 … HWU2 ? ?) -W /2 width=1 by yle_succ_dx/ #HW1U2
+ lapply (drop_trans_ge … HL21 … HLK1 ?) -L1 /3 width=9 by lstas_ldef, drop_inv_gen/
+ ]
+| #G #L1 #K1 #V1 #W1 #i #HLK1 #_ #IHVW1 #L2 #c #l #k #HL21 #X #H #U2 #HWU2
+ >(lift_mono … HWU2 … H) -U2
+ elim (lift_inv_lref1 … H) * #Hil #H destruct
+ [ elim (lift_total W1 (l-i-1) k) #W2 #HW12
+ elim (drop_trans_le … HL21 … HLK1) -L1 /2 width=2 by ylt_fwd_le/ #X #HLK2 #H
+ elim (drop_inv_skip2 … H) -H /2 width=1 by ylt_to_minus/ -Hil #K2 #V2 #HK21 #HV12 #H destruct
+ /3 width=10 by lstas_zero/
+ | lapply (drop_trans_ge … HL21 … HLK1 ?) -L1
+ /3 width=10 by lstas_zero, drop_inv_gen/
+ ]
+| #G #L1 #K1 #W1 #V1 #W #i #d #HLK1 #_ #HW1 #IHWV1 #L2 #c #l #k #HL21 #X #H #U2 #HWU2
+ elim (lift_inv_lref1 … H) * #Hil #H destruct
+ [ elim (lift_trans_ge … HW1 … HWU2) -W /2 width=1 by ylt_fwd_le_succ1/ #W #HW1 #HWU2
+ elim (drop_trans_le … HL21 … HLK1) -L1 /2 width=2 by ylt_fwd_le/ #X #HLK2 #H
+ elim (drop_inv_skip2 … H) -H /2 width=1 by ylt_to_minus/ -Hil #K2 #W2 #HK21 #HW12 #H destruct
+ /3 width=9 by lstas_succ/
+ | lapply (lift_trans_be … HW1 … HWU2 ? ?) -W /2 width=1 by yle_succ_dx/ #HW1U2
+ lapply (drop_trans_ge … HL21 … HLK1 ?) -L1 /3 width=9 by lstas_succ, drop_inv_gen/
+ ]
+| #a #I #G #L1 #V1 #T1 #U1 #d #_ #IHTU1 #L2 #c #l #k #HL21 #X1 #H1 #X2 #H2
+ elim (lift_inv_bind1 … H1) -H1 #V2 #T2 #HV12 #HT12 #H destruct
+ elim (lift_inv_bind1 … H2) -H2 #X #U2 #H1 #HU12 #H2 destruct
+ lapply (lift_mono … H1 … HV12) -H1 #H destruct /4 width=6 by lstas_bind, drop_skip/
+| #G #L1 #V1 #T1 #U1 #d #_ #IHTU1 #L2 #c #l #k #HL21 #X1 #H1 #X2 #H2
+ elim (lift_inv_flat1 … H1) -H1 #V2 #T2 #HV12 #HT12 #H destruct
+ elim (lift_inv_flat1 … H2) -H2 #X #U2 #H1 #HU12 #H2 destruct
+ lapply (lift_mono … H1 … HV12) -H1 #H destruct /4 width=6 by lstas_appl/
+| #G #L1 #W1 #T1 #U1 #d #_ #IHTU1 #L2 #c #l #k #HL21 #X #H #U2 #HU12
+ elim (lift_inv_flat1 … H) -H #W2 #T2 #_ #HT12 #H destruct /3 width=6 by lstas_cast/
+]
+qed.
+
+(* Inversion lemmas on relocation *******************************************)
+
+(* Note: apparently this was missing in basic_1 *)
+lemma lstas_inv_lift1: ∀h,G,d. d_deliftable_sn (lstas h G d).
+#h #G #d #L2 #T2 #U2 #H elim H -G -L2 -T2 -U2 -d
+[ #G #L2 #d #s #L1 #c #l #k #_ #X #H
+ >(lift_inv_sort2 … H) -X /2 width=3 by lstas_sort, lift_sort, ex2_intro/
+| #G #L2 #K2 #V2 #W2 #W #i #d #HLK2 #HVW2 #HW2 #IHVW2 #L1 #c #l #k #HL21 #X #H
+ elim (lift_inv_lref2 … H) * #Hil #H destruct [ -HVW2 | -IHVW2 ]
+ [ elim (drop_conf_lt … HL21 … HLK2) -L2 // #K1 #V1 #HLK1 #HK21 #HV12
+ elim (IHVW2 … HK21 … HV12) -K2 -V2 #W1 #HW12 #HVW1
+ elim (lift_trans_le … HW12 … HW2) -W2 // <yminus_succ2 <yplus_inj >yplus_SO2 >ymax_pre_sn /3 width=8 by lstas_ldef, ylt_fwd_le_succ1, ex2_intro/
+ | lapply (drop_conf_ge … HL21 … HLK2 ?) -L2 // #HL1K2
+ elim (yle_inv_plus_inj2 … Hil) -Hil #Hlim #mi
+ elim (lift_split … HW2 l (i-k+1)) -HW2 /2 width=1 by yle_succ_dx, le_S_S/
+ #W0 #HW20 <le_plus_minus_comm /2 width=1 by yle_inv_inj/ >minus_minus_k_k /3 width=8 by lstas_ldef, yle_inv_inj, le_S, ex2_intro/
+ ]
+| #G #L2 #K2 #W2 #V2 #i #HLK2 #HWV2 #IHWV2 #L1 #c #l #k #HL21 #X #H
+ elim (lift_inv_lref2 … H) * #Hil #H destruct [ -HWV2 | -IHWV2 ]
+ [ elim (drop_conf_lt … HL21 … HLK2) -L2 // #K1 #W1 #HLK1 #HK21 #HW12
+ elim (IHWV2 … HK21 … HW12) -K2
+ /3 width=5 by lstas_zero, lift_lref_lt, ex2_intro/
+ | lapply (drop_conf_ge … HL21 … HLK2 ?) -L2
+ /3 width=5 by lstas_zero, lift_lref_ge_minus, ex2_intro/
+ ]
+| #G #L2 #K2 #W2 #V2 #W #i #d #HLK2 #HWV2 #HW2 #IHWV2 #L1 #c #l #k #HL21 #X #H
+ elim (lift_inv_lref2 … H) * #Hil #H destruct [ -HWV2 | -IHWV2 ]
+ [ elim (drop_conf_lt … HL21 … HLK2) -L2 // #K1 #W1 #HLK1 #HK21 #HW12
+ elim (IHWV2 … HK21 … HW12) -K2 #V1 #HV12 #HWV1
+ elim (lift_trans_le … HV12 … HW2) -W2 // <yminus_succ2 <yplus_inj >yplus_SO2 >ymax_pre_sn /3 width=8 by lstas_succ, ylt_fwd_le_succ1, ex2_intro/
+ | lapply (drop_conf_ge … HL21 … HLK2 ?) -L2 // #HL1K2
+ elim (yle_inv_plus_inj2 … Hil) -Hil #Hlim #mi
+ elim (lift_split … HW2 l (i-k+1)) -HW2 /2 width=1 by yle_succ_dx, le_S_S/
+ #W0 #HW20 <le_plus_minus_comm /2 width=1 by yle_inv_inj/ >minus_minus_k_k /3 width=8 by lstas_succ, yle_inv_inj, le_S, ex2_intro/
+ ]
+| #a #I #G #L2 #V2 #T2 #U2 #d #_ #IHTU2 #L1 #c #l #k #HL21 #X #H
+ elim (lift_inv_bind2 … H) -H #V1 #T1 #HV12 #HT12 #H destruct
+ elim (IHTU2 (L1.ⓑ{I}V1) … HT12) -IHTU2 -HT12 /3 width=5 by lstas_bind, drop_skip, lift_bind, ex2_intro/
+| #G #L2 #V2 #T2 #U2 #d #_ #IHTU2 #L1 #c #l #k #HL21 #X #H
+ elim (lift_inv_flat2 … H) -H #V1 #T1 #HV12 #HT12 #H destruct
+ elim (IHTU2 … HL21 … HT12) -L2 -HT12 /3 width=5 by lstas_appl, lift_flat, ex2_intro/
+| #G #L2 #W2 #T2 #U2 #d #_ #IHTU2 #L1 #c #l #k #HL21 #X #H
+ elim (lift_inv_flat2 … H) -H #W1 #T1 #_ #HT12 #H destruct
+ elim (IHTU2 … HL21 … HT12) -L2 -HT12 /3 width=3 by lstas_cast, ex2_intro/
+]
+qed-.
+
+(* Advanced inversion lemmas ************************************************)
+
+lemma lstas_split_aux: ∀h,G,L,T1,T2,d. ⦃G, L⦄ ⊢ T1 •*[h, d] T2 → ∀d1,d2. d = d1 + d2 →
+ ∃∃T. ⦃G, L⦄ ⊢ T1 •*[h, d1] T & ⦃G, L⦄ ⊢ T •*[h, d2] T2.
+#h #G #L #T1 #T2 #d #H elim H -G -L -T1 -T2 -d
+[ #G #L #d #s #d1 #d2 #H destruct
+ >commutative_plus >iter_plus /2 width=3 by lstas_sort, ex2_intro/
+| #G #L #K #V1 #V2 #U2 #i #d #HLK #_ #VU2 #IHV12 #d1 #d2 #H destruct
+ elim (IHV12 d1 d2) -IHV12 // #V
+ elim (lift_total V 0 (i+1))
+ lapply (drop_fwd_drop2 … HLK)
+ /3 width=12 by lstas_lift, lstas_ldef, ex2_intro/
+| #G #L #K #W1 #W2 #i #HLK #HW12 #_ #d1 #d2 #H
+ elim (zero_eq_plus … H) -H #H1 #H2 destruct
+ /3 width=5 by lstas_zero, ex2_intro/
+| #G #L #K #W1 #W2 #U2 #i #d #HLK #HW12 #HWU2 #IHW12 #d1 @(nat_ind_plus … d1) -d1
+ [ #d2 normalize #H destruct
+ elim (IHW12 0 d) -IHW12 //
+ lapply (drop_fwd_drop2 … HLK)
+ /3 width=8 by lstas_succ, lstas_zero, ex2_intro/
+ | #d1 #_ #d2 <plus_plus_comm_23 #H lapply (injective_plus_l … H) -H #H
+ elim (IHW12 … H) -d #W
+ elim (lift_total W 0 (i+1))
+ lapply (drop_fwd_drop2 … HLK)
+ /3 width=12 by lstas_lift, lstas_succ, ex2_intro/
+ ]
+| #a #I #G #L #V #T #U #d #_ #IHTU #d1 #d2 #H
+ elim (IHTU … H) -d /3 width=3 by lstas_bind, ex2_intro/
+| #G #L #V #T #U #d #_ #IHTU #d1 #d2 #H
+ elim (IHTU … H) -d /3 width=3 by lstas_appl, ex2_intro/
+| #G #L #W #T #U #d #_ #IHTU #d1 #d2 #H
+ elim (IHTU … H) -d /3 width=3 by lstas_cast, ex2_intro/
+]
+qed-.
+
+lemma lstas_split: ∀h,G,L,T1,T2,d1,d2. ⦃G, L⦄ ⊢ T1 •*[h, d1 + d2] T2 →
+ ∃∃T. ⦃G, L⦄ ⊢ T1 •*[h, d1] T & ⦃G, L⦄ ⊢ T •*[h, d2] T2.
+/2 width=3 by lstas_split_aux/ qed-.
+
+(* Advanced properties ******************************************************)
+
+lemma lstas_lstas: ∀h,G,L,T,T1,d1. ⦃G, L⦄ ⊢ T •*[h, d1] T1 →
+ ∀d2. ∃T2. ⦃G, L⦄ ⊢ T •*[h, d2] T2.
+#h #G #L #T #T1 #d1 #H elim H -G -L -T -T1 -d1
+[ /2 width=2 by lstas_sort, ex_intro/
+| #G #L #K #V #V1 #U1 #i #d1 #HLK #_ #HVU1 #IHV1 #d2
+ elim (IHV1 d2) -IHV1 #V2
+ elim (lift_total V2 0 (i+1))
+ /3 width=7 by ex_intro, lstas_ldef/
+| #G #L #K #W #W1 #i #HLK #HW1 #IHW1 #d2
+ @(nat_ind_plus … d2) -d2 /3 width=5 by lstas_zero, ex_intro/
+ #d2 #_ elim (IHW1 d2) -IHW1 #W2
+ elim (lift_total W2 0 (i+1))
+ /3 width=7 by lstas_succ, ex_intro/
+| #G #L #K #W #W1 #U1 #i #d #HLK #_ #_ #IHW1 #d2
+ @(nat_ind_plus … d2) -d2
+ [ elim (IHW1 0) -IHW1 /3 width=5 by lstas_zero, ex_intro/
+ | #d2 #_ elim (IHW1 d2) -IHW1
+ #W2 elim (lift_total W2 0 (i+1)) /3 width=7 by ex_intro, lstas_succ/
+ ]
+| #a #I #G #L #V #T #U #d #_ #IHTU #d2
+ elim (IHTU d2) -IHTU /3 width=2 by lstas_bind, ex_intro/
+| #G #L #V #T #U #d #_ #IHTU #d2
+ elim (IHTU d2) -IHTU /3 width=2 by lstas_appl, ex_intro/
+| #G #L #W #T #U #d #_ #IHTU #d2
+ elim (IHTU d2) -IHTU /3 width=2 by lstas_cast, 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/multiple/llpx_sn_drop.ma".
+include "basic_2/unfold/lstas.ma".
+
+(* NAT-ITERATED STATIC TYPE ASSIGNMENT FOR TERMS ****************************)
+
+(* Properties on lazy sn pointwise extensions *******************************)
+
+lemma lstas_llpx_sn_conf: ∀R. (∀L. reflexive … (R L)) → d_liftable R →
+ ∀h,G,d. c_r_confluent1 … (lstas h d G) (llpx_sn R 0).
+#R #H1R #H2R #h #G #d #Ls #T1 #T2 #H elim H -G -Ls -T1 -T2 -d
+[ /3 width=4 by llpx_sn_fwd_length, llpx_sn_sort/
+| #G #Ls #Ks #V1c #V2c #W2c #i #d #HLKs #_ #HVW2c #IHV12c #Ld #H elim (llpx_sn_inv_lref_ge_sn … H … HLKs) // -H
+ #Kd #V1l #HLKd #HV1c #HV1sd
+ lapply (drop_fwd_drop2 … HLKs) -HLKs #HLKs
+ lapply (drop_fwd_drop2 … HLKd) -HLKd #HLKd
+ @(llpx_sn_lift_le … HLKs HLKd … HVW2c) -HLKs -HLKd -HVW2c /2 width=1 by/ (**) (* full auto too slow *)
+| //
+| #G #Ls #Ks #V1c #V2c #W2c #i #d #HLKs #_ #HVW2c #IHV12c #Ld #H elim (llpx_sn_inv_lref_ge_sn … H … HLKs) // -H
+ #Kd #V1l #HLKd #HV1c #HV1sd
+ lapply (drop_fwd_drop2 … HLKs) -HLKs #HLKs
+ lapply (drop_fwd_drop2 … HLKd) -HLKd #HLKd
+ @(llpx_sn_lift_le … HLKs HLKd … HVW2c) -HLKs -HLKd -HVW2c /2 width=1 by/ (**) (* full auto too slow *)
+| #a #I #G #Ls #V #T1 #T2 #d #_ #IHT12 #Ld #H elim (llpx_sn_inv_bind_O … H) -H
+ /4 width=5 by llpx_sn_bind_repl_SO, llpx_sn_bind/
+| #G #Ls #V #T1 #T2 #d #_ #IHT12 #Ld #H elim (llpx_sn_inv_flat … H) -H
+ /3 width=1 by llpx_sn_flat/
+| #G #Ls #V #T1 #T2 #d #_ #IHT12 #Ld #H elim (llpx_sn_inv_flat … H) -H
+ /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/unfold/lstas_lift.ma".
+
+(* NAT-ITERATED STATIC TYPE ASSIGNMENT FOR TERMS ****************************)
+
+(* Main properties **********************************************************)
+
+theorem lstas_trans: ∀h,G,L,T1,T,d1. ⦃G, L⦄ ⊢ T1 •*[h, d1] T →
+ ∀T2,d2. ⦃G, L⦄ ⊢ T •*[h, d2] T2 → ⦃G, L⦄ ⊢ T1 •*[h, d1+d2] T2.
+#h #G #L #T1 #T #d1 #H elim H -G -L -T1 -T -d1
+[ #G #L #d1 #s #X #d2 #H >(lstas_inv_sort1 … H) -X
+ <iter_plus /2 width=1 by lstas_sort/
+| #G #L #K #V1 #V #U #i #d1 #HLK #_ #HVU #IHV1 #U2 #d2 #HU2
+ lapply (drop_fwd_drop2 … HLK) #H0
+ elim (lstas_inv_lift1 … HU2 … H0 … HVU)
+ /3 width=6 by lstas_ldef/
+| //
+| #G #L #K #W1 #W #U #i #d1 #HLK #_ #HWU #IHW1 #U2 #d2 #HU2
+ lapply (drop_fwd_drop2 … HLK) #H0
+ elim (lstas_inv_lift1 … HU2 … H0 … HWU)
+ /3 width=6 by lstas_succ/
+| #a #I #G #L #V #T1 #T #d1 #_ #IHT1 #X #d2 #H
+ elim (lstas_inv_bind1 … H) -H #T2 #HT2 #H destruct
+ /3 width=1 by lstas_bind/
+| #G #L #V #T1 #T #d1 #_ #IHT1 #X #d2 #H
+ elim (lstas_inv_appl1 … H) -H #T2 #HT2 #H destruct
+ /3 width=1 by lstas_appl/
+| /3 width=1 by lstas_cast/
+]
+qed-.
+
+(* Note: apparently this was missing in basic_1 *)
+theorem lstas_mono: ∀h,G,L,d. singlevalued … (lstas h d G L).
+#h #G #L #d #T #T1 #H elim H -G -L -T -T1 -d
+[ #G #L #d #s #X #H >(lstas_inv_sort1 … H) -X //
+| #G #L #K #V #V1 #U1 #i #d #HLK #_ #HVU1 #IHV1 #X #H
+ elim (lstas_inv_lref1 … H) -H *
+ #K0 #V0 #W0 [3: #d0 ] #HLK0
+ lapply (drop_mono … HLK0 … HLK) -HLK -HLK0 #H destruct
+ #HVW0 #HX lapply (IHV1 … HVW0) -IHV1 -HVW0 #H destruct
+ /2 width=5 by lift_mono/
+| #G #L #K #W #W1 #i #HLK #_ #_ #X #H
+ elim (lstas_inv_lref1_O … H) -H *
+ #K0 #V0 #W0 #HLK0
+ lapply (drop_mono … HLK0 … HLK) -HLK -HLK0 #H destruct //
+| #G #L #K #W #W1 #U1 #i #d #HLK #_ #HWU1 #IHWV #X #H
+ elim (lstas_inv_lref1_S … H) -H * #K0 #W0 #V0 #HLK0
+ lapply (drop_mono … HLK0 … HLK) -HLK -HLK0 #H destruct
+ #HW0 #HX lapply (IHWV … HW0) -IHWV -HW0 #H destruct
+ /2 width=5 by lift_mono/
+| #a #I #G #L #V #T #U1 #d #_ #IHTU1 #X #H
+ elim (lstas_inv_bind1 … H) -H #U2 #HTU2 #H destruct /3 width=1 by eq_f/
+| #G #L #V #T #U1 #d #_ #IHTU1 #X #H
+ elim (lstas_inv_appl1 … H) -H #U2 #HTU2 #H destruct /3 width=1 by eq_f/
+| #G #L #W #T #U1 #d #_ #IHTU1 #U2 #H
+ lapply (lstas_inv_cast1 … H) -H /2 width=1 by/
+]
+qed-.
+
+(* Advanced inversion lemmas ************************************************)
+
+(* Basic_1: was just: sty0_correct *)
+lemma lstas_correct: ∀h,G,L,T1,T,d1. ⦃G, L⦄ ⊢ T1 •*[h, d1] T →
+ ∀d2. ∃T2. ⦃G, L⦄ ⊢ T •*[h, d2] T2.
+#h #G #L #T1 #T #d1 #H elim H -G -L -T1 -T -d1
+[ /2 width=2 by lstas_sort, ex_intro/
+| #G #L #K #V1 #V #U #i #d #HLK #_ #HVU #IHV1 #d2
+ elim (IHV1 d2) -IHV1 #V2
+ elim (lift_total V2 0 (i+1))
+ lapply (drop_fwd_drop2 … HLK) -HLK
+ /3 width=11 by ex_intro, lstas_lift/
+| #G #L #K #W1 #W #i #HLK #HW1 #IHW1 #d2
+ @(nat_ind_plus … d2) -d2 /3 width=5 by lstas_zero, ex_intro/
+ #d2 #_ elim (IHW1 d2) -IHW1 #W2 #HW2
+ lapply (lstas_trans … HW1 … HW2) -W
+ elim (lift_total W2 0 (i+1))
+ /3 width=7 by lstas_succ, ex_intro/
+| #G #L #K #W1 #W #U #i #d #HLK #_ #HWU #IHW1 #d2
+ elim (IHW1 d2) -IHW1 #W2
+ elim (lift_total W2 0 (i+1))
+ lapply (drop_fwd_drop2 … HLK) -HLK
+ /3 width=11 by ex_intro, lstas_lift/
+| #a #I #G #L #V #T #U #d #_ #IHTU #d2
+ elim (IHTU d2) -IHTU /3 width=2 by lstas_bind, ex_intro/
+| #G #L #V #T #U #d #_ #IHTU #d2
+ elim (IHTU d2) -IHTU /3 width=2 by lstas_appl, ex_intro/
+| #G #L #W #T #U #d #_ #IHTU #d2
+ elim (IHTU d2) -IHTU /2 width=2 by ex_intro/
+]
+qed-.
+
+(* more main properties *****************************************************)
+
+theorem lstas_conf_le: ∀h,G,L,T,U1,d1. ⦃G, L⦄ ⊢ T •*[h, d1] U1 →
+ ∀U2,d2. d1 ≤ d2 → ⦃G, L⦄ ⊢ T •*[h, d2] U2 →
+ ⦃G, L⦄ ⊢ U1 •*[h, d2-d1] U2.
+#h #G #L #T #U1 #d1 #HTU1 #U2 #d2 #Hd12
+>(plus_minus_k_k … Hd12) in ⊢ (%→?); -Hd12 >commutative_plus #H
+elim (lstas_split … H) -H #U #HTU
+>(lstas_mono … HTU … HTU1) -T //
+qed-.
+
+theorem lstas_conf: ∀h,G,L,T0,T1,d1. ⦃G, L⦄ ⊢ T0 •*[h, d1] T1 →
+ ∀T2,d2. ⦃G, L⦄ ⊢ T0 •*[h, d2] T2 →
+ ∃∃T. ⦃G, L⦄ ⊢ T1 •*[h, d2] T & ⦃G, L⦄ ⊢ T2 •*[h, d1] T.
+#h #G #L #T0 #T1 #d1 #HT01 #T2 #d2 #HT02
+elim (lstas_lstas … HT01 (d1+d2)) #T #HT0
+lapply (lstas_conf_le … HT01 … HT0) // -HT01 <minus_plus_k_k_commutative
+lapply (lstas_conf_le … HT02 … HT0) // -T0 <minus_plus_k_k
+/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 *)
+(* *)
+(**************************************************************************)
+
+(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
+
+notation "hvbox( ⦃ term 46 G , break term 46 L ⦄ ⊢ break term 46 T1 •* break [ term 46 o , break term 46 n ] break term 46 T2 )"
+ non associative with precedence 45
+ for @{ 'StaticTypeStar $h $G $L $n $T1 $T2 }.
--- /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 *)
+(* *)
+(**************************************************************************)
+
+(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
+
+notation "hvbox( G ⊢ break term 46 L1 ⫃ ▪ break [ term 46 o, break term 46 h ] break term 46 L2 )"
+ non associative with precedence 45
+ for @{ 'LRSubEqD $h $o $G $L1 $L2 }.
--- /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/lrsubeqd_5.ma".
+include "basic_2/static/lsubr.ma".
+include "basic_2/static/da.ma".
+
+(* LOCAL ENVIRONMENT REFINEMENT FOR DEGREE ASSIGNMENT ***********************)
+
+inductive lsubd (h) (o) (G): relation lenv ≝
+| lsubd_atom: lsubd h o G (⋆) (⋆)
+| lsubd_pair: ∀I,L1,L2,V. lsubd h o G L1 L2 →
+ lsubd h o G (L1.ⓑ{I}V) (L2.ⓑ{I}V)
+| lsubd_beta: ∀L1,L2,W,V,d. ⦃G, L1⦄ ⊢ V ▪[h, o] d+1 → ⦃G, L2⦄ ⊢ W ▪[h, o] d →
+ lsubd h o G L1 L2 → lsubd h o G (L1.ⓓⓝW.V) (L2.ⓛW)
+.
+
+interpretation
+ "local environment refinement (degree assignment)"
+ 'LRSubEqD h o G L1 L2 = (lsubd h o G L1 L2).
+
+(* Basic forward lemmas *****************************************************)
+
+lemma lsubd_fwd_lsubr: ∀h,o,G,L1,L2. G ⊢ L1 ⫃▪[h, o] L2 → L1 ⫃ L2.
+#h #o #G #L1 #L2 #H elim H -L1 -L2 /2 width=1 by lsubr_pair, lsubr_beta/
+qed-.
+
+(* Basic inversion lemmas ***************************************************)
+
+fact lsubd_inv_atom1_aux: ∀h,o,G,L1,L2. G ⊢ L1 ⫃▪[h, o] L2 → L1 = ⋆ → L2 = ⋆.
+#h #o #G #L1 #L2 * -L1 -L2
+[ //
+| #I #L1 #L2 #V #_ #H destruct
+| #L1 #L2 #W #V #d #_ #_ #_ #H destruct
+]
+qed-.
+
+lemma lsubd_inv_atom1: ∀h,o,G,L2. G ⊢ ⋆ ⫃▪[h, o] L2 → L2 = ⋆.
+/2 width=6 by lsubd_inv_atom1_aux/ qed-.
+
+fact lsubd_inv_pair1_aux: ∀h,o,G,L1,L2. G ⊢ L1 ⫃▪[h, o] L2 →
+ ∀I,K1,X. L1 = K1.ⓑ{I}X →
+ (∃∃K2. G ⊢ K1 ⫃▪[h, o] K2 & L2 = K2.ⓑ{I}X) ∨
+ ∃∃K2,W,V,d. ⦃G, K1⦄ ⊢ V ▪[h, o] d+1 & ⦃G, K2⦄ ⊢ W ▪[h, o] d &
+ G ⊢ K1 ⫃▪[h, o] K2 &
+ I = Abbr & L2 = K2.ⓛW & X = ⓝW.V.
+#h #o #G #L1 #L2 * -L1 -L2
+[ #J #K1 #X #H destruct
+| #I #L1 #L2 #V #HL12 #J #K1 #X #H destruct /3 width=3 by ex2_intro, or_introl/
+| #L1 #L2 #W #V #d #HV #HW #HL12 #J #K1 #X #H destruct /3 width=9 by ex6_4_intro, or_intror/
+]
+qed-.
+
+lemma lsubd_inv_pair1: ∀h,o,I,G,K1,L2,X. G ⊢ K1.ⓑ{I}X ⫃▪[h, o] L2 →
+ (∃∃K2. G ⊢ K1 ⫃▪[h, o] K2 & L2 = K2.ⓑ{I}X) ∨
+ ∃∃K2,W,V,d. ⦃G, K1⦄ ⊢ V ▪[h, o] d+1 & ⦃G, K2⦄ ⊢ W ▪[h, o] d &
+ G ⊢ K1 ⫃▪[h, o] K2 &
+ I = Abbr & L2 = K2.ⓛW & X = ⓝW.V.
+/2 width=3 by lsubd_inv_pair1_aux/ qed-.
+
+fact lsubd_inv_atom2_aux: ∀h,o,G,L1,L2. G ⊢ L1 ⫃▪[h, o] L2 → L2 = ⋆ → L1 = ⋆.
+#h #o #G #L1 #L2 * -L1 -L2
+[ //
+| #I #L1 #L2 #V #_ #H destruct
+| #L1 #L2 #W #V #d #_ #_ #_ #H destruct
+]
+qed-.
+
+lemma lsubd_inv_atom2: ∀h,o,G,L1. G ⊢ L1 ⫃▪[h, o] ⋆ → L1 = ⋆.
+/2 width=6 by lsubd_inv_atom2_aux/ qed-.
+
+fact lsubd_inv_pair2_aux: ∀h,o,G,L1,L2. G ⊢ L1 ⫃▪[h, o] L2 →
+ ∀I,K2,W. L2 = K2.ⓑ{I}W →
+ (∃∃K1. G ⊢ K1 ⫃▪[h, o] K2 & L1 = K1.ⓑ{I}W) ∨
+ ∃∃K1,V,d. ⦃G, K1⦄ ⊢ V ▪[h, o] d+1 & ⦃G, K2⦄ ⊢ W ▪[h, o] d &
+ G ⊢ K1 ⫃▪[h, o] K2 & I = Abst & L1 = K1. ⓓⓝW.V.
+#h #o #G #L1 #L2 * -L1 -L2
+[ #J #K2 #U #H destruct
+| #I #L1 #L2 #V #HL12 #J #K2 #U #H destruct /3 width=3 by ex2_intro, or_introl/
+| #L1 #L2 #W #V #d #HV #HW #HL12 #J #K2 #U #H destruct /3 width=7 by ex5_3_intro, or_intror/
+]
+qed-.
+
+lemma lsubd_inv_pair2: ∀h,o,I,G,L1,K2,W. G ⊢ L1 ⫃▪[h, o] K2.ⓑ{I}W →
+ (∃∃K1. G ⊢ K1 ⫃▪[h, o] K2 & L1 = K1.ⓑ{I}W) ∨
+ ∃∃K1,V,d. ⦃G, K1⦄ ⊢ V ▪[h, o] d+1 & ⦃G, K2⦄ ⊢ W ▪[h, o] d &
+ G ⊢ K1 ⫃▪[h, o] K2 & I = Abst & L1 = K1. ⓓⓝW.V.
+/2 width=3 by lsubd_inv_pair2_aux/ qed-.
+
+(* Basic properties *********************************************************)
+
+lemma lsubd_refl: ∀h,o,G,L. G ⊢ L ⫃▪[h, o] L.
+#h #o #G #L elim L -L /2 width=1 by lsubd_pair/
+qed.
+
+(* Note: the constant 0 cannot be generalized *)
+lemma lsubd_drop_O1_conf: ∀h,o,G,L1,L2. G ⊢ L1 ⫃▪[h, o] L2 →
+ ∀K1,c,k. ⬇[c, 0, k] L1 ≡ K1 →
+ ∃∃K2. G ⊢ K1 ⫃▪[h, o] K2 & ⬇[c, 0, k] L2 ≡ K2.
+#h #o #G #L1 #L2 #H elim H -L1 -L2
+[ /2 width=3 by ex2_intro/
+| #I #L1 #L2 #V #_ #IHL12 #K1 #c #k #H
+ elim (drop_inv_O1_pair1 … H) -H * #Hm #HLK1
+ [ destruct
+ elim (IHL12 L1 c 0) -IHL12 // #X #HL12 #H
+ <(drop_inv_O2 … H) in HL12; -H /3 width=3 by lsubd_pair, drop_pair, ex2_intro/
+ | elim (IHL12 … HLK1) -L1 /3 width=3 by drop_drop_lt, ex2_intro/
+ ]
+| #L1 #L2 #W #V #d #HV #HW #_ #IHL12 #K1 #c #k #H
+ elim (drop_inv_O1_pair1 … H) -H * #Hm #HLK1
+ [ destruct
+ elim (IHL12 L1 c 0) -IHL12 // #X #HL12 #H
+ <(drop_inv_O2 … H) in HL12; -H /3 width=3 by lsubd_beta, drop_pair, ex2_intro/
+ | elim (IHL12 … HLK1) -L1 /3 width=3 by drop_drop_lt, ex2_intro/
+ ]
+]
+qed-.
+
+(* Note: the constant 0 cannot be generalized *)
+lemma lsubd_drop_O1_trans: ∀h,o,G,L1,L2. G ⊢ L1 ⫃▪[h, o] L2 →
+ ∀K2,c,k. ⬇[c, 0, k] L2 ≡ K2 →
+ ∃∃K1. G ⊢ K1 ⫃▪[h, o] K2 & ⬇[c, 0, k] L1 ≡ K1.
+#h #o #G #L1 #L2 #H elim H -L1 -L2
+[ /2 width=3 by ex2_intro/
+| #I #L1 #L2 #V #_ #IHL12 #K2 #c #k #H
+ elim (drop_inv_O1_pair1 … H) -H * #Hm #HLK2
+ [ destruct
+ elim (IHL12 L2 c 0) -IHL12 // #X #HL12 #H
+ <(drop_inv_O2 … H) in HL12; -H /3 width=3 by lsubd_pair, drop_pair, ex2_intro/
+ | elim (IHL12 … HLK2) -L2 /3 width=3 by drop_drop_lt, ex2_intro/
+ ]
+| #L1 #L2 #W #V #d #HV #HW #_ #IHL12 #K2 #c #k #H
+ elim (drop_inv_O1_pair1 … H) -H * #Hm #HLK2
+ [ destruct
+ elim (IHL12 L2 c 0) -IHL12 // #X #HL12 #H
+ <(drop_inv_O2 … H) in HL12; -H /3 width=3 by lsubd_beta, drop_pair, ex2_intro/
+ | elim (IHL12 … HLK2) -L2 /3 width=3 by drop_drop_lt, 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/static/da_da.ma".
+include "basic_2/static/lsubd.ma".
+
+(* LOCAL ENVIRONMENT REFINEMENT FOR DEGREE ASSIGNMENT ***********************)
+
+(* Properties on degree assignment ******************************************)
+
+lemma lsubd_da_trans: ∀h,o,G,L2,T,d. ⦃G, L2⦄ ⊢ T ▪[h, o] d →
+ ∀L1. G ⊢ L1 ⫃▪[h, o] L2 → ⦃G, L1⦄ ⊢ T ▪[h, o] d.
+#h #o #G #L2 #T #d #H elim H -G -L2 -T -d
+[ /2 width=1 by da_sort/
+| #G #L2 #K2 #V #i #d #HLK2 #_ #IHV #L1 #HL12
+ elim (lsubd_drop_O1_trans … HL12 … HLK2) -L2 #X #H #HLK1
+ elim (lsubd_inv_pair2 … H) -H * #K1 [ | -IHV -HLK1 ]
+ [ #HK12 #H destruct /3 width=4 by da_ldef/
+ | #W #d0 #_ #_ #_ #H destruct
+ ]
+| #G #L2 #K2 #W #i #d #HLK2 #HW #IHW #L1 #HL12
+ elim (lsubd_drop_O1_trans … HL12 … HLK2) -L2 #X #H #HLK1
+ elim (lsubd_inv_pair2 … H) -H * #K1 [ -HW | -IHW ]
+ [ #HK12 #H destruct /3 width=4 by da_ldec/
+ | #V #d0 #HV #H0W #_ #_ #H destruct
+ lapply (da_mono … H0W … HW) -H0W -HW #H destruct /3 width=7 by da_ldef, da_flat/
+ ]
+| /4 width=1 by lsubd_pair, da_bind/
+| /3 width=1 by da_flat/
+]
+qed-.
+
+lemma lsubd_da_conf: ∀h,o,G,L1,T,d. ⦃G, L1⦄ ⊢ T ▪[h, o] d →
+ ∀L2. G ⊢ L1 ⫃▪[h, o] L2 → ⦃G, L2⦄ ⊢ T ▪[h, o] d.
+#h #o #G #L1 #T #d #H elim H -G -L1 -T -d
+[ /2 width=1 by da_sort/
+| #G #L1 #K1 #V #i #d #HLK1 #HV #IHV #L2 #HL12
+ elim (lsubd_drop_O1_conf … HL12 … HLK1) -L1 #X #H #HLK2
+ elim (lsubd_inv_pair1 … H) -H * #K2 [ -HV | -IHV ]
+ [ #HK12 #H destruct /3 width=4 by da_ldef/
+ | #W0 #V0 #d0 #HV0 #HW0 #_ #_ #H1 #H2 destruct
+ lapply (da_inv_flat … HV) -HV #H0V0
+ lapply (da_mono … H0V0 … HV0) -H0V0 -HV0 #H destruct /2 width=4 by da_ldec/
+ ]
+| #G #L1 #K1 #W #i #d #HLK1 #HW #IHW #L2 #HL12
+ elim (lsubd_drop_O1_conf … HL12 … HLK1) -L1 #X #H #HLK2
+ elim (lsubd_inv_pair1 … H) -H * #K2 [ -HW | -IHW ]
+ [ #HK12 #H destruct /3 width=4 by da_ldec/
+ | #W0 #V0 #d0 #HV0 #HW0 #_ #H destruct
+ ]
+| /4 width=1 by lsubd_pair, da_bind/
+| /3 width=1 by da_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/static/lsubd_da.ma".
+
+(* LOCAL ENVIRONMENT REFINEMENT FOR DEGREE ASSIGNMENT ***********************)
+
+(* Main properties **********************************************************)
+
+theorem lsubd_trans: ∀h,o,G. Transitive … (lsubd h o G).
+#h #o #G #L1 #L #H elim H -L1 -L
+[ #X #H >(lsubd_inv_atom1 … H) -H //
+| #I #L1 #L #Y #HL1 #IHL1 #X #H
+ elim (lsubd_inv_pair1 … H) -H * #L2
+ [ #HL2 #H destruct /3 width=1 by lsubd_pair/
+ | #W #V #d #HV #HW #HL2 #H1 #H2 #H3 destruct
+ /3 width=3 by lsubd_beta, lsubd_da_trans/
+ ]
+| #L1 #L #W #V #d #HV #HW #HL1 #IHL1 #X #H
+ elim (lsubd_inv_pair1 … H) -H * #L2
+ [ #HL2 #H destruct /3 width=5 by lsubd_beta, lsubd_da_conf/
+ | #W0 #V0 #d0 #_ #_ #_ #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/notation/relations/lrsubeq_4.ma".
+include "basic_2/substitution/drop.ma".
+
+(* LOCAL ENVIRONMENT REFINEMENT FOR EXTENDED SUBSTITUTION *******************)
+
+inductive lsuby: relation4 ynat ynat lenv lenv ≝
+| lsuby_atom: ∀L,l,m. lsuby l m L (⋆)
+| lsuby_zero: ∀I1,I2,L1,L2,V1,V2.
+ lsuby 0 0 L1 L2 → lsuby 0 0 (L1.ⓑ{I1}V1) (L2.ⓑ{I2}V2)
+| lsuby_pair: ∀I1,I2,L1,L2,V,m. lsuby 0 m L1 L2 →
+ lsuby 0 (⫯m) (L1.ⓑ{I1}V) (L2.ⓑ{I2}V)
+| lsuby_succ: ∀I1,I2,L1,L2,V1,V2,l,m.
+ lsuby l m L1 L2 → lsuby (⫯l) m (L1.ⓑ{I1}V1) (L2.ⓑ{I2}V2)
+.
+
+interpretation
+ "local environment refinement (extended substitution)"
+ 'LRSubEq L1 l m L2 = (lsuby l m L1 L2).
+
+(* Basic properties *********************************************************)
+
+lemma lsuby_pair_lt: ∀I1,I2,L1,L2,V,m. L1 ⊆[0, ⫰m] L2 → 0 < m →
+ L1.ⓑ{I1}V ⊆[0, m] L2.ⓑ{I2}V.
+#I1 #I2 #L1 #L2 #V #m #HL12 #Hm <(ylt_inv_O1 … Hm) /2 width=1 by lsuby_pair/
+qed.
+
+lemma lsuby_succ_lt: ∀I1,I2,L1,L2,V1,V2,l,m. L1 ⊆[⫰l, m] L2 → 0 < l →
+ L1.ⓑ{I1}V1 ⊆[l, m] L2. ⓑ{I2}V2.
+#I1 #I2 #L1 #L2 #V1 #V2 #l #m #HL12 #Hl <(ylt_inv_O1 … Hl) /2 width=1 by lsuby_succ/
+qed.
+
+lemma lsuby_pair_O_Y: ∀L1,L2. L1 ⊆[0, ∞] L2 →
+ ∀I1,I2,V. L1.ⓑ{I1}V ⊆[0,∞] L2.ⓑ{I2}V.
+#L1 #L2 #HL12 #I1 #I2 #V lapply (lsuby_pair I1 I2 … V … HL12) -HL12 //
+qed.
+
+lemma lsuby_refl: ∀L,l,m. L ⊆[l, m] L.
+#L elim L -L //
+#L #I #V #IHL #l elim (ynat_cases … l) [| * #x ]
+#Hl destruct /2 width=1 by lsuby_succ/
+#m elim (ynat_cases … m) [| * #x ]
+#Hm destruct /2 width=1 by lsuby_zero, lsuby_pair/
+qed.
+
+lemma lsuby_O2: ∀L2,L1,l. |L2| ≤ |L1| → L1 ⊆[l, 0] L2.
+#L2 elim L2 -L2 // #L2 #I2 #V2 #IHL2 *
+[ #l #H elim (ylt_yle_false … H) -H //
+| #L1 #I1 #V1 #l
+ #H lapply (yle_inv_succ … H) -H #HL12
+ elim (ynat_cases l) /3 width=1 by lsuby_zero/
+ * /3 width=1 by lsuby_succ/
+]
+qed.
+
+lemma lsuby_sym: ∀l,m,L1,L2. L1 ⊆[l, m] L2 → |L1| = |L2| → L2 ⊆[l, m] L1.
+#l #m #L1 #L2 #H elim H -l -m -L1 -L2
+[ #L1 #l #m #H >(length_inv_zero_dx … H) -L1 //
+| /2 width=1 by lsuby_O2/
+| #I1 #I2 #L1 #L2 #V #m #_ #IHL12 #H lapply (ysucc_inv_inj … H) -H
+ /3 width=1 by lsuby_pair/
+| #I1 #I2 #L1 #L2 #V1 #V2 #l #m #_ #IHL12 #H lapply (ysucc_inv_inj … H) -H
+ /3 width=1 by lsuby_succ/
+]
+qed-.
+
+(* Basic inversion lemmas ***************************************************)
+
+fact lsuby_inv_atom1_aux: ∀L1,L2,l,m. L1 ⊆[l, m] L2 → L1 = ⋆ → L2 = ⋆.
+#L1 #L2 #l #m * -L1 -L2 -l -m //
+[ #I1 #I2 #L1 #L2 #V1 #V2 #_ #H destruct
+| #I1 #I2 #L1 #L2 #V #m #_ #H destruct
+| #I1 #I2 #L1 #L2 #V1 #V2 #l #m #_ #H destruct
+]
+qed-.
+
+lemma lsuby_inv_atom1: ∀L2,l,m. ⋆ ⊆[l, m] L2 → L2 = ⋆.
+/2 width=5 by lsuby_inv_atom1_aux/ qed-.
+
+fact lsuby_inv_zero1_aux: ∀L1,L2,l,m. L1 ⊆[l, m] L2 →
+ ∀J1,K1,W1. L1 = K1.ⓑ{J1}W1 → l = 0 → m = 0 →
+ L2 = ⋆ ∨
+ ∃∃J2,K2,W2. K1 ⊆[0, 0] K2 & L2 = K2.ⓑ{J2}W2.
+#L1 #L2 #l #m * -L1 -L2 -l -m /2 width=1 by or_introl/
+[ #I1 #I2 #L1 #L2 #V1 #V2 #HL12 #J1 #K1 #W1 #H #_ #_ destruct
+ /3 width=5 by ex2_3_intro, or_intror/
+| #I1 #I2 #L1 #L2 #V #m #_ #J1 #K1 #W1 #_ #_ #H
+ elim (ysucc_inv_O_dx … H)
+| #I1 #I2 #L1 #L2 #V1 #V2 #l #m #_ #J1 #K1 #W1 #_ #H
+ elim (ysucc_inv_O_dx … H)
+]
+qed-.
+
+lemma lsuby_inv_zero1: ∀I1,K1,L2,V1. K1.ⓑ{I1}V1 ⊆[0, 0] L2 →
+ L2 = ⋆ ∨
+ ∃∃I2,K2,V2. K1 ⊆[0, 0] K2 & L2 = K2.ⓑ{I2}V2.
+/2 width=9 by lsuby_inv_zero1_aux/ qed-.
+
+fact lsuby_inv_pair1_aux: ∀L1,L2,l,m. L1 ⊆[l, m] L2 →
+ ∀J1,K1,W. L1 = K1.ⓑ{J1}W → l = 0 → 0 < m →
+ L2 = ⋆ ∨
+ ∃∃J2,K2. K1 ⊆[0, ⫰m] K2 & L2 = K2.ⓑ{J2}W.
+#L1 #L2 #l #m * -L1 -L2 -l -m /2 width=1 by or_introl/
+[ #I1 #I2 #L1 #L2 #V1 #V2 #_ #J1 #K1 #W #_ #_ #H
+ elim (ylt_yle_false … H) //
+| #I1 #I2 #L1 #L2 #V #m #HL12 #J1 #K1 #W #H #_ #_ destruct
+ /3 width=4 by ex2_2_intro, or_intror/
+| #I1 #I2 #L1 #L2 #V1 #V2 #l #m #_ #J1 #K1 #W #_ #H
+ elim (ysucc_inv_O_dx … H)
+]
+qed-.
+
+lemma lsuby_inv_pair1: ∀I1,K1,L2,V,m. K1.ⓑ{I1}V ⊆[0, m] L2 → 0 < m →
+ L2 = ⋆ ∨
+ ∃∃I2,K2. K1 ⊆[0, ⫰m] K2 & L2 = K2.ⓑ{I2}V.
+/2 width=6 by lsuby_inv_pair1_aux/ qed-.
+
+fact lsuby_inv_succ1_aux: ∀L1,L2,l,m. L1 ⊆[l, m] L2 →
+ ∀J1,K1,W1. L1 = K1.ⓑ{J1}W1 → 0 < l →
+ L2 = ⋆ ∨
+ ∃∃J2,K2,W2. K1 ⊆[⫰l, m] K2 & L2 = K2.ⓑ{J2}W2.
+#L1 #L2 #l #m * -L1 -L2 -l -m /2 width=1 by or_introl/
+[ #I1 #I2 #L1 #L2 #V1 #V2 #_ #J1 #K1 #W1 #_ #H
+ elim (ylt_yle_false … H) //
+| #I1 #I2 #L1 #L2 #V #m #_ #J1 #K1 #W1 #_ #H
+ elim (ylt_yle_false … H) //
+| #I1 #I2 #L1 #L2 #V1 #V2 #l #m #HL12 #J1 #K1 #W1 #H #_ destruct
+ /3 width=5 by ex2_3_intro, or_intror/
+]
+qed-.
+
+lemma lsuby_inv_succ1: ∀I1,K1,L2,V1,l,m. K1.ⓑ{I1}V1 ⊆[l, m] L2 → 0 < l →
+ L2 = ⋆ ∨
+ ∃∃I2,K2,V2. K1 ⊆[⫰l, m] K2 & L2 = K2.ⓑ{I2}V2.
+/2 width=5 by lsuby_inv_succ1_aux/ qed-.
+
+fact lsuby_inv_zero2_aux: ∀L1,L2,l,m. L1 ⊆[l, m] L2 →
+ ∀J2,K2,W2. L2 = K2.ⓑ{J2}W2 → l = 0 → m = 0 →
+ ∃∃J1,K1,W1. K1 ⊆[0, 0] K2 & L1 = K1.ⓑ{J1}W1.
+#L1 #L2 #l #m * -L1 -L2 -l -m
+[ #L1 #l #m #J2 #K2 #W1 #H destruct
+| #I1 #I2 #L1 #L2 #V1 #V2 #HL12 #J2 #K2 #W2 #H #_ #_ destruct
+ /2 width=5 by ex2_3_intro/
+| #I1 #I2 #L1 #L2 #V #m #_ #J2 #K2 #W2 #_ #_ #H
+ elim (ysucc_inv_O_dx … H)
+| #I1 #I2 #L1 #L2 #V1 #V2 #l #m #_ #J2 #K2 #W2 #_ #H
+ elim (ysucc_inv_O_dx … H)
+]
+qed-.
+
+lemma lsuby_inv_zero2: ∀I2,K2,L1,V2. L1 ⊆[0, 0] K2.ⓑ{I2}V2 →
+ ∃∃I1,K1,V1. K1 ⊆[0, 0] K2 & L1 = K1.ⓑ{I1}V1.
+/2 width=9 by lsuby_inv_zero2_aux/ qed-.
+
+fact lsuby_inv_pair2_aux: ∀L1,L2,l,m. L1 ⊆[l, m] L2 →
+ ∀J2,K2,W. L2 = K2.ⓑ{J2}W → l = 0 → 0 < m →
+ ∃∃J1,K1. K1 ⊆[0, ⫰m] K2 & L1 = K1.ⓑ{J1}W.
+#L1 #L2 #l #m * -L1 -L2 -l -m
+[ #L1 #l #m #J2 #K2 #W #H destruct
+| #I1 #I2 #L1 #L2 #V1 #V2 #_ #J2 #K2 #W #_ #_ #H
+ elim (ylt_yle_false … H) //
+| #I1 #I2 #L1 #L2 #V #m #HL12 #J2 #K2 #W #H #_ #_ destruct
+ /2 width=4 by ex2_2_intro/
+| #I1 #I2 #L1 #L2 #V1 #V2 #l #m #_ #J2 #K2 #W #_ #H
+ elim (ysucc_inv_O_dx … H)
+]
+qed-.
+
+lemma lsuby_inv_pair2: ∀I2,K2,L1,V,m. L1 ⊆[0, m] K2.ⓑ{I2}V → 0 < m →
+ ∃∃I1,K1. K1 ⊆[0, ⫰m] K2 & L1 = K1.ⓑ{I1}V.
+/2 width=6 by lsuby_inv_pair2_aux/ qed-.
+
+fact lsuby_inv_succ2_aux: ∀L1,L2,l,m. L1 ⊆[l, m] L2 →
+ ∀J2,K2,W2. L2 = K2.ⓑ{J2}W2 → 0 < l →
+ ∃∃J1,K1,W1. K1 ⊆[⫰l, m] K2 & L1 = K1.ⓑ{J1}W1.
+#L1 #L2 #l #m * -L1 -L2 -l -m
+[ #L1 #l #m #J2 #K2 #W2 #H destruct
+| #I1 #I2 #L1 #L2 #V1 #V2 #_ #J2 #K2 #W2 #_ #H
+ elim (ylt_yle_false … H) //
+| #I1 #I2 #L1 #L2 #V #m #_ #J2 #K1 #W2 #_ #H
+ elim (ylt_yle_false … H) //
+| #I1 #I2 #L1 #L2 #V1 #V2 #l #m #HL12 #J2 #K2 #W2 #H #_ destruct
+ /2 width=5 by ex2_3_intro/
+]
+qed-.
+
+lemma lsuby_inv_succ2: ∀I2,K2,L1,V2,l,m. L1 ⊆[l, m] K2.ⓑ{I2}V2 → 0 < l →
+ ∃∃I1,K1,V1. K1 ⊆[⫰l, m] K2 & L1 = K1.ⓑ{I1}V1.
+/2 width=5 by lsuby_inv_succ2_aux/ qed-.
+
+(* Basic forward lemmas *****************************************************)
+
+lemma lsuby_fwd_length: ∀L1,L2,l,m. L1 ⊆[l, m] L2 → |L2| ≤ |L1|.
+#L1 #L2 #l #m #H elim H -L1 -L2 -l -m /2 width=1 by yle_succ/
+qed-.
+
+(* Properties on basic slicing **********************************************)
+
+lemma lsuby_drop_trans_be: ∀L1,L2,l,m. L1 ⊆[l, m] L2 →
+ ∀I2,K2,W,s,i. ⬇[s, 0, i] L2 ≡ K2.ⓑ{I2}W →
+ l ≤ i → ∀m0. i + ⫯m0 = l + m →
+ ∃∃I1,K1. K1 ⊆[0, m0] K2 & ⬇[s, 0, i] L1 ≡ K1.ⓑ{I1}W.
+#L1 #L2 #l #m #H elim H -L1 -L2 -l -m
+[ #L1 #l #m #J2 #K2 #W #s #i #H
+ elim (drop_inv_atom1 … H) -H #H destruct
+| #I1 #I2 #L1 #L2 #V1 #V2 #_ #_ #J2 #K2 #W #s #i #_ #_ #m0
+ >yplus_O2 >yplus_succ2 #H elim (ysucc_inv_O_dx … H)
+| #I1 #I2 #L1 #L2 #V #m #HL12 #IHL12 #J2 #K2 #W #s #i #H #_ #m0
+ >yplus_succ2 >yplus_succ2 #H0 lapply (ysucc_inv_inj … H0) -H0
+ elim (drop_inv_O1_pair1 … H) -H * #Hi #HLK1 [ -IHL12 | -HL12 ]
+ [ destruct -I2 /2 width=4 by drop_pair, ex2_2_intro/
+ | lapply (ylt_inv_O1 … Hi)
+ #H <H -H <yplus_succ_swap #Him elim (IHL12 … HLK1 … Him) -IHL12 -HLK1 -Him
+ /3 width=4 by drop_drop_lt, ex2_2_intro/
+ ]
+| #I1 #I2 #L1 #L2 #V1 #V2 #l #m #_ #IHL12 #J2 #K2 #W #s #i #HLK2 #Hli #m0
+ elim (yle_inv_succ1 … Hli) -Hli #Hli #Hi
+ lapply (drop_inv_drop1_lt … HLK2 ?) -HLK2 /2 width=1 by ylt_O1/ #HLK2
+ >yplus_succ1 >yplus_succ2 #H lapply (ysucc_inv_inj … H) -H
+ <Hi <yplus_succ_swap #H elim (IHL12 … HLK2 … H) -IHL12 -HLK2 -H
+ /3 width=4 by drop_drop, ex2_2_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/lsuby.ma".
+
+(* LOCAL ENVIRONMENT REFINEMENT FOR EXTENDED SUBSTITUTION *******************)
+
+(* Main properties **********************************************************)
+
+theorem lsuby_trans: ∀l,m. Transitive … (lsuby l m).
+#l #m #L1 #L2 #H elim H -L1 -L2 -l -m
+[ #L1 #l #m #X #H lapply (lsuby_inv_atom1 … H) -H
+ #H destruct //
+| #I1 #I2 #L1 #L #V1 #V #_ #IHL1 #X #H elim (lsuby_inv_zero1 … H) -H //
+ * #I2 #L2 #V2 #HL2 #H destruct /3 width=1 by lsuby_zero/
+| #I1 #I2 #L1 #L2 #V #m #_ #IHL1 #X #H elim (lsuby_inv_pair1 … H) -H //
+ * #I2 #L2 #HL2 #H destruct /3 width=1 by lsuby_pair/
+| #I1 #I2 #L1 #L2 #V1 #V2 #l #m #_ #IHL1 #X #H elim (lsuby_inv_succ1 … H) -H //
+ * #I2 #L2 #V2 #HL2 #H destruct /3 width=1 by lsuby_succ/
+]
+qed-.
--- /dev/null
+include "basic_2/notation/functions/droppreds_3.ma".
+include "basic_2/grammar/lenv_length.ma".
+
+axiom pred_minus: ∀x,y. y < x → ⫰(x - y) = x - ⫯y.
+
+(*
+axiom drops_T_isuni_inv_refl: ∀n,L. ⬇*[n] L ≡ L → n = 0.
+
+lemma le_succ_trans: ∀m,n. ⫯m ≤ n → m ≤ n.
+/2 width=1 by lt_to_le/ qed-.
+*)
+
+lemma tls_pred: ∀f,n. 0 < n → ⫱*[n] f = ⫱ ⫱*[⫰n] f.
+#f #n #Hn >tls_S >S_pred //
+qed-.
+
+definition ltls (f): lenv → lenv → rtmap ≝ λL,K. ⫱*[|L|-|K|] f.
+
+interpretation "ltls (rtmap)" 'DropPreds L K f = (ltls f L K).
+
+lemma ltls_refl: ∀f,L1,L2. |L1| ≤ |L2| → ⫱*[L1, L2] f = f.
+#f #L1 #L2 #HL12 whd in ⊢ (??%?); >(eq_minus_O … HL12) -HL12 //
+qed.
+
+lemma ltls_pair2: ∀f,I,L1,L2,V. |L2| < |L1| → ⫱⫱*[L1, L2.ⓑ{I}V] f = ⫱*[L1, L2] f.
+#f #I #L1 #L2 #V #HL12 whd in ⊢ (??(?%)%); <pred_minus // <tls_pred //
+/2 width=1 by lt_plus_to_minus_r/
+qed-.
+
+lemma ltls_pair1_push: ∀f,I,L1,L2,V. |L2| ≤ |L1| → ⫱*[L1.ⓑ{I}V, L2] ↑f = ⫱*[L1, L2] f.
+#f #I #L1 #L2 #V #HL12 whd in ⊢ (??%%); >minus_Sn_m //
+qed.
+
+lemma ltls_pair1_next: ∀f,I,L1,L2,V. |L2| ≤ |L1| → ⫱*[L1.ⓑ{I}V, L2] ⫯f = ⫱*[L1, L2] f.
+#f #I #L1 #L2 #V #HL12 whd in ⊢ (??%%); >minus_Sn_m //
+qed.
+
+lemma ltls_sle_pair: ∀f1,f2,L1,L2. ⫱*[L2, L1] f2 ⊆ ⫱*[L1, L2] f1 →
+ ∀I,V1. ⫱*[L2, L1.ⓑ{I}V1] f2 ⊆ ⫱*[L1.ⓑ{I}V1, L2] ⫯f1.
+#f1 #f2 #L1 #L2 elim (lt_or_ge (|L1|) (|L2|))
+[ #HL12 >ltls_refl in ⊢ (??%→?); /2 width=1 by lt_to_le/
+ #Hf21 #I #V1 >ltls_refl in ⊢ (??%); //
+ <(ltls_pair2 … I … V1 HL12) in Hf21; -HL12 /2 width=1 by sle_inv_tl1/
+| #HL21 >ltls_refl // #Hf21 #I #V1 >ltls_refl /2 width=1 by le_S/
+ >ltls_pair1_next //
+]
+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 *)
+(* *)
+(**************************************************************************)
+
+(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
+
+notation "hvbox( ⦃ term 46 G , break term 46 L ⦄ ⊢ break term 46 T1 break ▶ [ term 46 l , break term 46 m ] break term 46 T2 )"
+ non associative with precedence 45
+ for @{ 'PSubst $G $L $T1 $l $k $T2 }.
--- /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 *)
+(* *)
+(**************************************************************************)
+
+(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
+
+notation "hvbox( ⦃ term 46 G , break term 46 L ⦄ ⊢ break term 46 T1 break ▶ * [ term 46 l , break term 46 m ] break term 46 T2 )"
+ non associative with precedence 45
+ for @{ 'PSubstStar $G $L $T1 $l $k $T2 }.
--- /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 *)
+(* *)
+(**************************************************************************)
+
+(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
+
+notation "hvbox( ⦃ term 46 G , break term 46 L ⦄ ⊢ break term 46 T1 break ▶ ▶ * [ term 46 l , break term 46 m ] break term 46 T2 )"
+ non associative with precedence 45
+ for @{ 'PSubstStarAlt $G $L $T1 $l $k $T2 }.
--- /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/unfold_4.ma".
+include "basic_2/grammar/lenv_append.ma".
+include "basic_2/grammar/genv.ma".
+include "basic_2/substitution/drop.ma".
+
+(* CONTEXT-SENSITIVE UNFOLD FOR TERMS ***************************************)
+
+(* activate genv *)
+inductive unfold: relation4 genv lenv term lenv ≝
+| unfold_sort: ∀G,L,s. unfold G L (⋆s) L
+| unfold_lref: ∀I,G,L1,L2,K1,K2,V,i. ⬇[i] L1 ≡ K1. ⓑ{I}V →
+ unfold G K1 V K2 → ⬇[Ⓣ, |L2|, i] L2 ≡ K2 →
+ unfold G L1 (#i) (L1@@L2)
+| unfold_bind: ∀a,I,G,L1,L2,V,T.
+ unfold G (L1.ⓑ{I}V) T L2 → unfold G L1 (ⓑ{a,I}V.T) L2
+| unfold_flat: ∀I,G,L1,L2,V,T.
+ unfold G L1 T L2 → unfold G L1 (ⓕ{I}V.T) L2
+.
+
+interpretation "context-sensitive unfold (term)"
+ 'Unfold G L1 T L2 = (unfold G L1 T L2).
--- /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 *)
+(* *)
+(**************************************************************************)
+
+(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
+
+notation "hvbox( ⦃ term 46 G, break term 46 L1 ⦄ ⊢ ⧫ * break term 46 T ≡ break term 46 L2 )"
+ non associative with precedence 45
+ for @{ 'Unfold $G $L1 $T $L2 }.
+++ /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/syntax/lenv.ma".
-
-(* CONTEXT-SENSITIVE EQUIVALENCES FOR TERMS *********************************)
-
-definition ceq: relation3 lenv term term ≝ λL,T1,T2. T1 = T2.
-
-definition cfull: relation3 lenv term term ≝ λL,T1,T2. ⊤.
-
-(* Basic properties *********************************************************)
-
-lemma ceq_refl (L): reflexive … (ceq L).
-// qed.
-
-lemma cfull_refl (L): reflexive … (cfull L).
-// qed.
-
-lemma ceq_sym (L): symmetric … (ceq L).
-// qed-.
-
-lemma cfull_sym (L): symmetric … (cfull L).
-// qed-.
-
-lemma cfull_top (R:relation3 lenv term term) (L) (T1) (T2):
- R L T1 T2 → cfull L T1 T2.
-// qed-.
-
-lemma ceq_cfull (L) (T1) (T2): ceq L T1 T2 → cfull L T1 T2.
-// 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/syntax/ceq.ma".
-
-(* CONTEXT-SENSITIVE EQUIVALENCES FOR TERMS *********************************)
-
-(* Main properties **********************************************************)
-
-theorem ceq_trans (L): Transitive … (ceq L).
-// qed-.
-
-lemma ceq_canc_sn (L): left_cancellable … (ceq L).
-// qed-.
-
-lemma ceq_canc_dx (L): right_cancellable … (ceq L).
-// qed-.
-
-theorem cfull_trans (L): Transitive … (cfull L).
-// qed-.
-
-lemma cfull_canc_sn (L): left_cancellable … (cfull L).
-// qed-.
-
-lemma cfull_canc_dx (L): right_cancellable … (cfull L).
-// qed-.
\ No newline at end of file
+++ /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/prednotreducible_3.ma".
-include "basic_2/reduction/crr.ma".
-
-(* IRREDUCIBLE TERMS FOR CONTEXT-SENSITIVE REDUCTION ************************)
-
-definition cir: relation3 genv lenv term ≝ λG,L,T. ⦃G, L⦄ ⊢ ➡ 𝐑⦃T⦄ → ⊥.
-
-interpretation "irreducibility for context-sensitive reduction (term)"
- 'PRedNotReducible G L T = (cir G L T).
-
-(* Basic inversion lemmas ***************************************************)
-
-lemma cir_inv_delta: ∀G,L,K,V,i. ⬇[i] L ≡ K.ⓓV → ⦃G, L⦄ ⊢ ➡ 𝐈⦃#i⦄ → ⊥.
-/3 width=3 by crr_delta/ qed-.
-
-lemma cir_inv_ri2: ∀I,G,L,V,T. ri2 I → ⦃G, L⦄ ⊢ ➡ 𝐈⦃②{I}V.T⦄ → ⊥.
-/3 width=1 by crr_ri2/ qed-.
-
-lemma cir_inv_ib2: ∀a,I,G,L,V,T. ib2 a I → ⦃G, L⦄ ⊢ ➡ 𝐈⦃ⓑ{a,I}V.T⦄ →
- ⦃G, L⦄ ⊢ ➡ 𝐈⦃V⦄ ∧ ⦃G, L.ⓑ{I}V⦄ ⊢ ➡ 𝐈⦃T⦄.
-/4 width=1 by crr_ib2_sn, crr_ib2_dx, conj/ qed-.
-
-lemma cir_inv_bind: ∀a,I,G,L,V,T. ⦃G, L⦄ ⊢ ➡ 𝐈⦃ⓑ{a,I}V.T⦄ →
- ∧∧ ⦃G, L⦄ ⊢ ➡ 𝐈⦃V⦄ & ⦃G, L.ⓑ{I}V⦄ ⊢ ➡ 𝐈⦃T⦄ & ib2 a I.
-#a * [ elim a -a ]
-#G #L #V #T #H [ elim H -H /3 width=1 by crr_ri2, or_introl/ ]
-elim (cir_inv_ib2 … H) -H /3 width=1 by and3_intro, or_introl/
-qed-.
-
-lemma cir_inv_appl: ∀G,L,V,T. ⦃G, L⦄ ⊢ ➡ 𝐈⦃ⓐV.T⦄ →
- ∧∧ ⦃G, L⦄ ⊢ ➡ 𝐈⦃V⦄ & ⦃G, L⦄ ⊢ ➡ 𝐈⦃T⦄ & 𝐒⦃T⦄.
-#G #L #V #T #HVT @and3_intro /3 width=1 by crr_appl_sn, crr_appl_dx/
-generalize in match HVT; -HVT elim T -T //
-* // #a * #U #T #_ #_ #H elim H -H /2 width=1 by crr_beta, crr_theta/
-qed-.
-
-lemma cir_inv_flat: ∀I,G,L,V,T. ⦃G, L⦄ ⊢ ➡ 𝐈⦃ⓕ{I}V.T⦄ →
- ∧∧ ⦃G, L⦄ ⊢ ➡ 𝐈⦃V⦄ & ⦃G, L⦄ ⊢ ➡ 𝐈⦃T⦄ & 𝐒⦃T⦄ & I = Appl.
-* #G #L #V #T #H
-[ elim (cir_inv_appl … H) -H /2 width=1 by and4_intro/
-| elim (cir_inv_ri2 … H) -H //
-]
-qed-.
-
-(* Basic properties *********************************************************)
-
-lemma cir_sort: ∀G,L,s. ⦃G, L⦄ ⊢ ➡ 𝐈⦃⋆s⦄.
-/2 width=4 by crr_inv_sort/ qed.
-
-lemma cir_gref: ∀G,L,p. ⦃G, L⦄ ⊢ ➡ 𝐈⦃§p⦄.
-/2 width=4 by crr_inv_gref/ qed.
-
-lemma tir_atom: ∀G,I. ⦃G, ⋆⦄ ⊢ ➡ 𝐈⦃⓪{I}⦄.
-/2 width=3 by trr_inv_atom/ qed.
-
-lemma cir_ib2: ∀a,I,G,L,V,T.
- ib2 a I → ⦃G, L⦄ ⊢ ➡ 𝐈⦃V⦄ → ⦃G, L.ⓑ{I}V⦄ ⊢ ➡ 𝐈⦃T⦄ → ⦃G, L⦄ ⊢ ➡ 𝐈⦃ⓑ{a,I}V.T⦄.
-#a #I #G #L #V #T #HI #HV #HT #H
-elim (crr_inv_ib2 … HI H) -HI -H /2 width=1 by/
-qed.
-
-lemma cir_appl: ∀G,L,V,T. ⦃G, L⦄ ⊢ ➡ 𝐈⦃V⦄ → ⦃G, L⦄ ⊢ ➡ 𝐈⦃T⦄ → 𝐒⦃T⦄ → ⦃G, L⦄ ⊢ ➡ 𝐈⦃ⓐV.T⦄.
-#G #L #V #T #HV #HT #H1 #H2
-elim (crr_inv_appl … H2) -H2 /2 width=1 by/
-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/reduction/crr_lift.ma".
-include "basic_2/reduction/cir.ma".
-
-(* IRREDUCIBLE TERMS FOR CONTEXT-SENSITIVE REDUCTION ************************)
-
-(* Properties on relocation *************************************************)
-
-lemma cir_lift: ∀G,K,T. ⦃G, K⦄ ⊢ ➡ 𝐈⦃T⦄ → ∀L,c,l,k. ⬇[c, l, k] L ≡ K →
- ∀U. ⬆[l, k] T ≡ U → ⦃G, L⦄ ⊢ ➡ 𝐈⦃U⦄.
-/3 width=8 by crr_inv_lift/ qed.
-
-lemma cir_inv_lift: ∀G,L,U. ⦃G, L⦄ ⊢ ➡ 𝐈⦃U⦄ → ∀K,c,l,k. ⬇[c, l, k] L ≡ K →
- ∀T. ⬆[l, k] T ≡ U → ⦃G, K⦄ ⊢ ➡ 𝐈⦃T⦄.
-/3 width=8 by crr_lift/ 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 *)
-(* *)
-(**************************************************************************)
-
-(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
-
-notation "hvbox( ⦃ term 46 G , break term 46 L ⦄ ⊢ ➡ 𝐈 break ⦃ term 46 T ⦄ )"
- non associative with precedence 45
- for @{ 'PRedNotReducible $G $L $T }.
+++ /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/prednotreducible_5.ma".
-include "basic_2/reduction/cir.ma".
-include "basic_2/reduction/crx.ma".
-
-(* IRREDUCIBLE TERMS FOR CONTEXT-SENSITIVE EXTENDED REDUCTION ***************)
-
-definition cix: ∀h. sd h → relation3 genv lenv term ≝
- λh,o,G,L,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃T⦄ → ⊥.
-
-interpretation "irreducibility for context-sensitive extended reduction (term)"
- 'PRedNotReducible h o G L T = (cix h o G L T).
-
-(* Basic inversion lemmas ***************************************************)
-
-lemma cix_inv_sort: ∀h,o,G,L,s,d. deg h o s (d+1) → ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃⋆s⦄ → ⊥.
-/3 width=2 by crx_sort/ qed-.
-
-lemma cix_inv_delta: ∀h,o,I,G,L,K,V,i. ⬇[i] L ≡ K.ⓑ{I}V → ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃#i⦄ → ⊥.
-/3 width=4 by crx_delta/ qed-.
-
-lemma cix_inv_ri2: ∀h,o,I,G,L,V,T. ri2 I → ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃②{I}V.T⦄ → ⊥.
-/3 width=1 by crx_ri2/ qed-.
-
-lemma cix_inv_ib2: ∀h,o,a,I,G,L,V,T. ib2 a I → ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃ⓑ{a,I}V.T⦄ →
- ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃V⦄ ∧ ⦃G, L.ⓑ{I}V⦄ ⊢ ➡[h, o] 𝐈⦃T⦄.
-/4 width=1 by crx_ib2_sn, crx_ib2_dx, conj/ qed-.
-
-lemma cix_inv_bind: ∀h,o,a,I,G,L,V,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃ⓑ{a,I}V.T⦄ →
- ∧∧ ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃V⦄ & ⦃G, L.ⓑ{I}V⦄ ⊢ ➡[h, o] 𝐈⦃T⦄ & ib2 a I.
-#h #o #a * [ elim a -a ]
-#G #L #V #T #H [ elim H -H /3 width=1 by crx_ri2, or_introl/ ]
-elim (cix_inv_ib2 … H) -H /3 width=1 by and3_intro, or_introl/
-qed-.
-
-lemma cix_inv_appl: ∀h,o,G,L,V,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃ⓐV.T⦄ →
- ∧∧ ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃V⦄ & ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃T⦄ & 𝐒⦃T⦄.
-#h #o #G #L #V #T #HVT @and3_intro /3 width=1 by crx_appl_sn, crx_appl_dx/
-generalize in match HVT; -HVT elim T -T //
-* // #a * #U #T #_ #_ #H elim H -H /2 width=1 by crx_beta, crx_theta/
-qed-.
-
-lemma cix_inv_flat: ∀h,o,I,G,L,V,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃ⓕ{I}V.T⦄ →
- ∧∧ ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃V⦄ & ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃T⦄ & 𝐒⦃T⦄ & I = Appl.
-#h #o * #G #L #V #T #H
-[ elim (cix_inv_appl … H) -H /2 width=1 by and4_intro/
-| elim (cix_inv_ri2 … H) -H //
-]
-qed-.
-
-(* Basic forward lemmas *****************************************************)
-
-lemma cix_inv_cir: ∀h,o,G,L,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃T⦄ → ⦃G, L⦄ ⊢ ➡ 𝐈⦃T⦄.
-/3 width=1 by crr_crx/ qed-.
-
-(* Basic properties *********************************************************)
-
-lemma cix_sort: ∀h,o,G,L,s. deg h o s 0 → ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃⋆s⦄.
-#h #o #G #L #s #Hk #H elim (crx_inv_sort … H) -L #d #Hkd
-lapply (deg_mono … Hk Hkd) -h -s <plus_n_Sm #H destruct
-qed.
-
-lemma tix_lref: ∀h,o,G,i. ⦃G, ⋆⦄ ⊢ ➡[h, o] 𝐈⦃#i⦄.
-#h #o #G #i #H elim (trx_inv_atom … H) -H #s #d #_ #H destruct
-qed.
-
-lemma cix_gref: ∀h,o,G,L,p. ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃§p⦄.
-#h #o #G #L #p #H elim (crx_inv_gref … H)
-qed.
-
-lemma cix_ib2: ∀h,o,a,I,G,L,V,T. ib2 a I → ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃V⦄ → ⦃G, L.ⓑ{I}V⦄ ⊢ ➡[h, o] 𝐈⦃T⦄ →
- ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃ⓑ{a,I}V.T⦄.
-#h #o #a #I #G #L #V #T #HI #HV #HT #H
-elim (crx_inv_ib2 … HI H) -HI -H /2 width=1 by/
-qed.
-
-lemma cix_appl: ∀h,o,G,L,V,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃V⦄ → ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃T⦄ → 𝐒⦃T⦄ → ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃ⓐV.T⦄.
-#h #o #G #L #V #T #HV #HT #H1 #H2
-elim (crx_inv_appl … H2) -H2 /2 width=1 by/
-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/reduction/crx_lift.ma".
-include "basic_2/reduction/cix.ma".
-
-(* IRREDUCIBLE TERMS FOR CONTEXT-SENSITIVE EXTENDED REDUCTION ***************)
-
-(* Advanced properties ******************************************************)
-
-lemma cix_lref: ∀h,o,G,L,i. ⬇[i] L ≡ ⋆ → ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃#i⦄.
-#h #o #G #L #i #HL #H elim (crx_inv_lref … H) -h #I #K #V #HLK
-lapply (drop_mono … HLK … HL) -L -i #H destruct
-qed.
-
-(* Properties on relocation *************************************************)
-
-lemma cix_lift: ∀h,o,G,K,T. ⦃G, K⦄ ⊢ ➡[h, o] 𝐈⦃T⦄ → ∀L,c,l,k. ⬇[c, l, k] L ≡ K →
- ∀U. ⬆[l, k] T ≡ U → ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃U⦄.
-/3 width=8 by crx_inv_lift/ qed.
-
-lemma cix_inv_lift: ∀h,o,G,L,U. ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃U⦄ → ∀K,c,l,k. ⬇[c, l, k] L ≡ K →
- ∀T. ⬆[l, k] T ≡ U → ⦃G, K⦄ ⊢ ➡[h, o] 𝐈⦃T⦄.
-/3 width=8 by crx_lift/ 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 *)
-(* *)
-(**************************************************************************)
-
-(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
-
-notation "hvbox( ⦃ term 46 G, break term 46 L ⦄ ⊢ ➡ break [ term 46 o , break term 46 h ] 𝐈 break ⦃ term 46 T ⦄ )"
- non associative with precedence 45
- for @{ 'PRedNotReducible $h $o $G $L $T }.
+++ /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/prednormal_3.ma".
-include "basic_2/reduction/cpr.ma".
-
-(* NORMAL TERMS FOR CONTEXT-SENSITIVE REDUCTION *****************************)
-
-definition cnr: relation3 genv lenv term ≝ λG,L. NF … (cpr G L) (eq …).
-
-interpretation
- "normality for context-sensitive reduction (term)"
- 'PRedNormal G L T = (cnr G L T).
-
-(* Basic inversion lemmas ***************************************************)
-
-lemma cnr_inv_delta: ∀G,L,K,V,i. ⬇[i] L ≡ K.ⓓV → ⦃G, L⦄ ⊢ ➡ 𝐍⦃#i⦄ → ⊥.
-#G #L #K #V #i #HLK #H
-elim (lift_total V 0 (i+1)) #W #HVW
-lapply (H W ?) -H [ /3 width=6 by cpr_delta/ ] -HLK #H destruct
-elim (lift_inv_lref2_be … HVW) -HVW /2 width=1 by ylt_inj/
-qed-.
-
-lemma cnr_inv_abst: ∀a,G,L,V,T. ⦃G, L⦄ ⊢ ➡ 𝐍⦃ⓛ{a}V.T⦄ → ⦃G, L⦄ ⊢ ➡ 𝐍⦃V⦄ ∧ ⦃G, L.ⓛV⦄ ⊢ ➡ 𝐍⦃T⦄.
-#a #G #L #V1 #T1 #HVT1 @conj
-[ #V2 #HV2 lapply (HVT1 (ⓛ{a}V2.T1) ?) -HVT1 /2 width=2 by cpr_pair_sn/ -HV2 #H destruct //
-| #T2 #HT2 lapply (HVT1 (ⓛ{a}V1.T2) ?) -HVT1 /2 width=2 by cpr_bind/ -HT2 #H destruct //
-]
-qed-.
-
-lemma cnr_inv_abbr: ∀G,L,V,T. ⦃G, L⦄ ⊢ ➡ 𝐍⦃-ⓓV.T⦄ → ⦃G, L⦄ ⊢ ➡ 𝐍⦃V⦄ ∧ ⦃G, L.ⓓV⦄ ⊢ ➡ 𝐍⦃T⦄.
-#G #L #V1 #T1 #HVT1 @conj
-[ #V2 #HV2 lapply (HVT1 (-ⓓV2.T1) ?) -HVT1 /2 width=2 by cpr_pair_sn/ -HV2 #H destruct //
-| #T2 #HT2 lapply (HVT1 (-ⓓV1.T2) ?) -HVT1 /2 width=2 by cpr_bind/ -HT2 #H destruct //
-]
-qed-.
-
-lemma cnr_inv_zeta: ∀G,L,V,T. ⦃G, L⦄ ⊢ ➡ 𝐍⦃+ⓓV.T⦄ → ⊥.
-#G #L #V #T #H elim (is_lift_dec T 0 1)
-[ * #U #HTU
- lapply (H U ?) -H /2 width=3 by cpr_zeta/ #H destruct
- elim (lift_inv_pair_xy_y … HTU)
-| #HT
- elim (cpr_delift G (⋆) V T (⋆. ⓓV) 0) //
- #T2 #T1 #HT2 #HT12 lapply (H (+ⓓV.T2) ?) -H /4 width=1 by tpr_cpr, cpr_bind/ -HT2
- #H destruct /3 width=2 by ex_intro/
-]
-qed-.
-
-lemma cnr_inv_appl: ∀G,L,V,T. ⦃G, L⦄ ⊢ ➡ 𝐍⦃ⓐV.T⦄ → ∧∧ ⦃G, L⦄ ⊢ ➡ 𝐍⦃V⦄ & ⦃G, L⦄ ⊢ ➡ 𝐍⦃T⦄ & 𝐒⦃T⦄.
-#G #L #V1 #T1 #HVT1 @and3_intro
-[ #V2 #HV2 lapply (HVT1 (ⓐV2.T1) ?) -HVT1 /2 width=1 by cpr_pair_sn/ -HV2 #H destruct //
-| #T2 #HT2 lapply (HVT1 (ⓐV1.T2) ?) -HVT1 /2 width=1 by cpr_flat/ -HT2 #H destruct //
-| generalize in match HVT1; -HVT1 elim T1 -T1 * // #a * #W1 #U1 #_ #_ #H
- [ elim (lift_total V1 0 1) #V2 #HV12
- lapply (H (ⓓ{a}W1.ⓐV2.U1) ?) -H /3 width=3 by tpr_cpr, cpr_theta/ -HV12 #H destruct
- | lapply (H (ⓓ{a}ⓝW1.V1.U1) ?) -H /3 width=1 by tpr_cpr, cpr_beta/ #H destruct
-]
-qed-.
-
-lemma cnr_inv_eps: ∀G,L,V,T. ⦃G, L⦄ ⊢ ➡ 𝐍⦃ⓝV.T⦄ → ⊥.
-#G #L #V #T #H lapply (H T ?) -H
-/2 width=4 by cpr_eps, discr_tpair_xy_y/
-qed-.
-
-(* Basic properties *********************************************************)
-
-(* Basic_1: was: nf2_sort *)
-lemma cnr_sort: ∀G,L,s. ⦃G, L⦄ ⊢ ➡ 𝐍⦃⋆s⦄.
-#G #L #s #X #H
->(cpr_inv_sort1 … H) //
-qed.
-
-lemma cnr_lref_free: ∀G,L,i. |L| ≤ i → ⦃G, L⦄ ⊢ ➡ 𝐍⦃#i⦄.
-#G #L #i #Hi #X #H elim (cpr_inv_lref1 … H) -H // *
-#K #V1 #V2 #HLK lapply (drop_fwd_length_lt2 … HLK) -HLK
-#H elim (lt_refl_false i) /2 width=3 by lt_to_le_to_lt/
-qed.
-
-(* Basic_1: was only: nf2_csort_lref *)
-lemma cnr_lref_atom: ∀G,L,i. ⬇[i] L ≡ ⋆ → ⦃G, L⦄ ⊢ ➡ 𝐍⦃#i⦄.
-#G #L #i #HL @cnr_lref_free >(drop_fwd_length … HL) -HL //
-qed.
-
-(* Basic_1: was: nf2_abst *)
-lemma cnr_abst: ∀a,G,L,W,T. ⦃G, L⦄ ⊢ ➡ 𝐍⦃W⦄ → ⦃G, L.ⓛW⦄ ⊢ ➡ 𝐍⦃T⦄ → ⦃G, L⦄ ⊢ ➡ 𝐍⦃ⓛ{a}W.T⦄.
-#a #G #L #W #T #HW #HT #X #H
-elim (cpr_inv_abst1 … H) -H #W0 #T0 #HW0 #HT0 #H destruct
->(HW … HW0) -W0 >(HT … HT0) -T0 //
-qed.
-
-(* Basic_1: was only: nf2_appl_lref *)
-lemma cnr_appl_simple: ∀G,L,V,T. ⦃G, L⦄ ⊢ ➡ 𝐍⦃V⦄ → ⦃G, L⦄ ⊢ ➡ 𝐍⦃T⦄ → 𝐒⦃T⦄ → ⦃G, L⦄ ⊢ ➡ 𝐍⦃ⓐV.T⦄.
-#G #L #V #T #HV #HT #HS #X #H
-elim (cpr_inv_appl1_simple … H) -H // #V0 #T0 #HV0 #HT0 #H destruct
->(HV … HV0) -V0 >(HT … HT0) -T0 //
-qed.
-
-(* Basic_1: was: nf2_dec *)
-axiom cnr_dec: ∀G,L,T1. ⦃G, L⦄ ⊢ ➡ 𝐍⦃T1⦄ ∨
- ∃∃T2. ⦃G, L⦄ ⊢ T1 ➡ T2 & (T1 = T2 → ⊥).
-
-(* Basic_1: removed theorems 1: nf2_abst_shift *)
+++ /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/reduction/cpr_cir.ma".
-include "basic_2/reduction/cnr_crr.ma".
-
-(* NORMAL TERMS FOR CONTEXT-SENSITIVE REDUCTION *****************************)
-
-(* Main properties on irreducibility ****************************************)
-
-theorem cir_cnr: ∀G,L,T. ⦃G, L⦄ ⊢ ➡ 𝐈⦃T⦄ → ⦃G, L⦄ ⊢ ➡ 𝐍⦃T⦄.
-/2 width=4 by cpr_fwd_cir/ qed.
-
-(* Main inversion lemmas on irreducibility **********************************)
-
-theorem cnr_inv_cir: ∀G,L,T. ⦃G, L⦄ ⊢ ➡ 𝐍⦃T⦄ → ⦃G, L⦄ ⊢ ➡ 𝐈⦃T⦄.
-/2 width=5 by cnr_inv_crr/ 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/reduction/crr.ma".
-include "basic_2/reduction/cnr.ma".
-
-(* NORMAL TERMS FOR CONTEXT-SENSITIVE REDUCTION *****************************)
-
-(* Advanced inversion lemmas on reducibility ********************************)
-
-(* Note: this property is unusual *)
-lemma cnr_inv_crr: ∀G,L,T. ⦃G, L⦄ ⊢ ➡ 𝐑⦃T⦄ → ⦃G, L⦄ ⊢ ➡ 𝐍⦃T⦄ → ⊥.
-#G #L #T #H elim H -L -T
-[ #L #K #V #i #HLK #H
- elim (cnr_inv_delta … HLK H)
-| #L #V #T #_ #IHV #H
- elim (cnr_inv_appl … H) -H /2 width=1 by/
-| #L #V #T #_ #IHT #H
- elim (cnr_inv_appl … H) -H /2 width=1 by/
-| #I #L #V #T * #H1 #H2 destruct
- [ elim (cnr_inv_zeta … H2)
- | elim (cnr_inv_eps … H2)
- ]
-|5,6: #a * [ elim a ] #L #V #T * #H1 #_ #IH #H2 destruct
- [1,3: elim (cnr_inv_abbr … H2) -H2 /2 width=1 by/
- |*: elim (cnr_inv_abst … H2) -H2 /2 width=1 by/
- ]
-| #a #L #V #W #T #H
- elim (cnr_inv_appl … H) -H #_ #_ #H
- elim (simple_inv_bind … H)
-| #a #L #V #W #T #H
- elim (cnr_inv_appl … H) -H #_ #_ #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/reduction/cpr_lift.ma".
-include "basic_2/reduction/cnr.ma".
-
-(* NORMAL TERMS FOR CONTEXT-SENSITIVE REDUCTION *****************************)
-
-(* Advanced properties ******************************************************)
-
-(* Basic_1: was: nf2_lref_abst *)
-lemma cnr_lref_abst: ∀G,L,K,V,i. ⬇[i] L ≡ K. ⓛV → ⦃G, L⦄ ⊢ ➡ 𝐍⦃#i⦄.
-#G #L #K #V #i #HLK #X #H
-elim (cpr_inv_lref1 … H) -H // *
-#K0 #V1 #V2 #HLK0 #_ #_
-lapply (drop_mono … HLK … HLK0) -L #H destruct
-qed.
-
-(* Relocation properties ****************************************************)
-
-(* Basic_1: was: nf2_lift *)
-lemma cnr_lift: ∀G,L0,L,T,T0,c,l,k. ⦃G, L⦄ ⊢ ➡ 𝐍⦃T⦄ →
- ⬇[c, l, k] L0 ≡ L → ⬆[l, k] T ≡ T0 → ⦃G, L0⦄ ⊢ ➡ 𝐍⦃T0⦄.
-#G #L0 #L #T #T0 #c #l #k #HLT #HL0 #HT0 #X #H
-elim (cpr_inv_lift1 … H … HL0 … HT0) -L0 #T1 #HT10 #HT1
-<(HLT … HT1) in HT0; -L #HT0
->(lift_mono … HT10 … HT0) -T1 -X //
-qed.
-
-(* Note: this was missing in basic_1 *)
-lemma cnr_inv_lift: ∀G,L0,L,T,T0,c,l,k. ⦃G, L0⦄ ⊢ ➡ 𝐍⦃T0⦄ →
- ⬇[c, l, k] L0 ≡ L → ⬆[l, k] T ≡ T0 → ⦃G, L⦄ ⊢ ➡ 𝐍⦃T⦄.
-#G #L0 #L #T #T0 #c #l #k #HLT0 #HL0 #HT0 #X #H
-elim (lift_total X l k) #X0 #HX0
-lapply (cpr_lift … H … HL0 … HT0 … HX0) -L #HTX0
->(HLT0 … HTX0) in HX0; -L0 -X0 #H
->(lift_inj … H … HT0) -T0 -X -c -l -k //
-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 *)
-(* *)
-(**************************************************************************)
-
-(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
-
-notation "hvbox( ⦃ term 46 G , break term 46 L ⦄ ⊢ ➡ 𝐍 break ⦃ term 46 T ⦄ )"
- non associative with precedence 45
- for @{ 'PRedNormal $G $L $T }.
+++ /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/prednormal_5.ma".
-include "basic_2/reduction/cnr.ma".
-include "basic_2/reduction/cpx.ma".
-
-(* NORMAL TERMS FOR CONTEXT-SENSITIVE EXTENDED REDUCTION ********************)
-
-definition cnx: ∀h. sd h → relation3 genv lenv term ≝
- λh,o,G,L. NF … (cpx h o G L) (eq …).
-
-interpretation
- "normality for context-sensitive extended reduction (term)"
- 'PRedNormal h o L T = (cnx h o L T).
-
-(* Basic inversion lemmas ***************************************************)
-
-lemma cnx_inv_sort: ∀h,o,G,L,s. ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃⋆s⦄ → deg h o s 0.
-#h #o #G #L #s #H elim (deg_total h o s)
-#d @(nat_ind_plus … d) -d // #d #_ #Hkd
-lapply (H (⋆(next h s)) ?) -H /2 width=2 by cpx_st/ -L -d #H
-lapply (destruct_tatom_tatom_aux … H) -H #H (**) (* destruct lemma needed *)
-lapply (destruct_sort_sort_aux … H) -H #H (**) (* destruct lemma needed *)
-lapply (next_lt h s) >H -H #H elim (lt_refl_false … H)
-qed-.
-
-lemma cnx_inv_delta: ∀h,o,I,G,L,K,V,i. ⬇[i] L ≡ K.ⓑ{I}V → ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃#i⦄ → ⊥.
-#h #o #I #G #L #K #V #i #HLK #H
-elim (lift_total V 0 (i+1)) #W #HVW
-lapply (H W ?) -H [ /3 width=7 by cpx_delta/ ] -HLK #H destruct
-elim (lift_inv_lref2_be … HVW) -HVW /2 width=1 by ylt_inj/
-qed-.
-
-lemma cnx_inv_abst: ∀h,o,a,G,L,V,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃ⓛ{a}V.T⦄ →
- ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃V⦄ ∧ ⦃G, L.ⓛV⦄ ⊢ ➡[h, o] 𝐍⦃T⦄.
-#h #o #a #G #L #V1 #T1 #HVT1 @conj
-[ #V2 #HV2 lapply (HVT1 (ⓛ{a}V2.T1) ?) -HVT1 /2 width=2 by cpx_pair_sn/ -HV2 #H destruct //
-| #T2 #HT2 lapply (HVT1 (ⓛ{a}V1.T2) ?) -HVT1 /2 width=2 by cpx_bind/ -HT2 #H destruct //
-]
-qed-.
-
-lemma cnx_inv_abbr: ∀h,o,G,L,V,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃-ⓓV.T⦄ →
- ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃V⦄ ∧ ⦃G, L.ⓓV⦄ ⊢ ➡[h, o] 𝐍⦃T⦄.
-#h #o #G #L #V1 #T1 #HVT1 @conj
-[ #V2 #HV2 lapply (HVT1 (-ⓓV2.T1) ?) -HVT1 /2 width=2 by cpx_pair_sn/ -HV2 #H destruct //
-| #T2 #HT2 lapply (HVT1 (-ⓓV1.T2) ?) -HVT1 /2 width=2 by cpx_bind/ -HT2 #H destruct //
-]
-qed-.
-
-lemma cnx_inv_zeta: ∀h,o,G,L,V,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃+ⓓV.T⦄ → ⊥.
-#h #o #G #L #V #T #H elim (is_lift_dec T 0 1)
-[ * #U #HTU
- lapply (H U ?) -H /2 width=3 by cpx_zeta/ #H destruct
- elim (lift_inv_pair_xy_y … HTU)
-| #HT
- elim (cpr_delift G(⋆) V T (⋆.ⓓV) 0) // #T2 #T1 #HT2 #HT12
- lapply (H (+ⓓV.T2) ?) -H /5 width=1 by cpr_cpx, tpr_cpr, cpr_bind/ -HT2
- #H destruct /3 width=2 by ex_intro/
-]
-qed-.
-
-lemma cnx_inv_appl: ∀h,o,G,L,V,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃ⓐV.T⦄ →
- ∧∧ ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃V⦄ & ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃T⦄ & 𝐒⦃T⦄.
-#h #o #G #L #V1 #T1 #HVT1 @and3_intro
-[ #V2 #HV2 lapply (HVT1 (ⓐV2.T1) ?) -HVT1 /2 width=1 by cpx_pair_sn/ -HV2 #H destruct //
-| #T2 #HT2 lapply (HVT1 (ⓐV1.T2) ?) -HVT1 /2 width=1 by cpx_flat/ -HT2 #H destruct //
-| generalize in match HVT1; -HVT1 elim T1 -T1 * // #a * #W1 #U1 #_ #_ #H
- [ elim (lift_total V1 0 1) #V2 #HV12
- lapply (H (ⓓ{a}W1.ⓐV2.U1) ?) -H /3 width=3 by cpr_cpx, cpr_theta/ -HV12 #H destruct
- | lapply (H (ⓓ{a}ⓝW1.V1.U1) ?) -H /3 width=1 by cpr_cpx, cpr_beta/ #H destruct
- ]
-]
-qed-.
-
-lemma cnx_inv_eps: ∀h,o,G,L,V,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃ⓝV.T⦄ → ⊥.
-#h #o #G #L #V #T #H lapply (H T ?) -H
-/2 width=4 by cpx_eps, discr_tpair_xy_y/
-qed-.
-
-(* Basic forward lemmas *****************************************************)
-
-lemma cnx_fwd_cnr: ∀h,o,G,L,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃T⦄ → ⦃G, L⦄ ⊢ ➡ 𝐍⦃T⦄.
-#h #o #G #L #T #H #U #HTU
-@H /2 width=1 by cpr_cpx/ (**) (* auto fails because a δ-expansion gets in the way *)
-qed-.
-
-(* Basic properties *********************************************************)
-
-lemma cnx_sort: ∀h,o,G,L,s. deg h o s 0 → ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃⋆s⦄.
-#h #o #G #L #s #Hk #X #H elim (cpx_inv_sort1 … H) -H // * #d #Hkd #_
-lapply (deg_mono … Hkd Hk) -h -L <plus_n_Sm #H destruct
-qed.
-
-lemma cnx_sort_iter: ∀h,o,G,L,s,d. deg h o s d → ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃⋆((next h)^d s)⦄.
-#h #o #G #L #s #d #Hkd
-lapply (deg_iter … d Hkd) -Hkd <minus_n_n /2 width=6 by cnx_sort/
-qed.
-
-lemma cnx_lref_free: ∀h,o,G,L,i. |L| ≤ i → ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃#i⦄.
-#h #o #G #L #i #Hi #X #H elim (cpx_inv_lref1 … H) -H // *
-#I #K #V1 #V2 #HLK lapply (drop_fwd_length_lt2 … HLK) -HLK
-#H elim (lt_refl_false i) /2 width=3 by lt_to_le_to_lt/
-qed.
-
-lemma cnx_lref_atom: ∀h,o,G,L,i. ⬇[i] L ≡ ⋆ → ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃#i⦄.
-#h #o #G #L #i #HL @cnx_lref_free >(drop_fwd_length … HL) -HL //
-qed.
-
-lemma cnx_abst: ∀h,o,a,G,L,W,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃W⦄ → ⦃G, L.ⓛW⦄ ⊢ ➡[h, o] 𝐍⦃T⦄ →
- ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃ⓛ{a}W.T⦄.
-#h #o #a #G #L #W #T #HW #HT #X #H
-elim (cpx_inv_abst1 … H) -H #W0 #T0 #HW0 #HT0 #H destruct
->(HW … HW0) -W0 >(HT … HT0) -T0 //
-qed.
-
-lemma cnx_appl_simple: ∀h,o,G,L,V,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃V⦄ → ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃T⦄ → 𝐒⦃T⦄ →
- ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃ⓐV.T⦄.
-#h #o #G #L #V #T #HV #HT #HS #X #H
-elim (cpx_inv_appl1_simple … H) -H // #V0 #T0 #HV0 #HT0 #H destruct
->(HV … HV0) -V0 >(HT … HT0) -T0 //
-qed.
-
-axiom cnx_dec: ∀h,o,G,L,T1. ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃T1⦄ ∨
- ∃∃T2. ⦃G, L⦄ ⊢ T1 ➡[h, o] T2 & (T1 = T2 → ⊥).
+++ /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/reduction/cpx_cix.ma".
-include "basic_2/reduction/cnx_crx.ma".
-
-(* NORMAL TERMS FOR CONTEXT-SENSITIVE EXTENDED REDUCTION ********************)
-
-(* Main properties on irreducibility ****************************************)
-
-theorem cix_cnx: ∀h,o,G,L,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃T⦄ → ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃T⦄.
-/2 width=6 by cpx_fwd_cix/ qed.
-
-(* Main inversion lemmas on irreducibility **********************************)
-
-theorem cnx_inv_cix: ∀h,o,G,L,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃T⦄ → ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃T⦄.
-/2 width=7 by cnx_inv_crx/ 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/reduction/crx.ma".
-include "basic_2/reduction/cnx.ma".
-
-(* NORMAL TERMS FOR CONTEXT-SENSITIVE EXTENDED REDUCTION ********************)
-
-(* Advanced inversion lemmas on reducibility ********************************)
-
-(* Note: this property is unusual *)
-lemma cnx_inv_crx: ∀h,o,G,L,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃T⦄ → ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃T⦄ → ⊥.
-#h #o #G #L #T #H elim H -L -T
-[ #L #s #d #Hkd #H
- lapply (cnx_inv_sort … H) -H #H
- lapply (deg_mono … H Hkd) -h -L -s <plus_n_Sm #H destruct
-| #I #L #K #V #i #HLK #H
- elim (cnx_inv_delta … HLK H)
-| #L #V #T #_ #IHV #H
- elim (cnx_inv_appl … H) -H /2 width=1 by/
-| #L #V #T #_ #IHT #H
- elim (cnx_inv_appl … H) -H /2 width=1 by/
-| #I #L #V #T * #H1 #H2 destruct
- [ elim (cnx_inv_zeta … H2)
- | elim (cnx_inv_eps … H2)
- ]
-|6,7: #a * [ elim a ] #L #V #T * #H1 #_ #IH #H2 destruct
- [1,3: elim (cnx_inv_abbr … H2) -H2 /2 width=1 by/
- |*: elim (cnx_inv_abst … H2) -H2 /2 width=1 by/
- ]
-| #a #L #V #W #T #H
- elim (cnx_inv_appl … H) -H #_ #_ #H
- elim (simple_inv_bind … H)
-| #a #L #V #W #T #H
- elim (cnx_inv_appl … H) -H #_ #_ #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/reduction/cpx_lift.ma".
-include "basic_2/reduction/cnx.ma".
-
-(* NORMAL TERMS FOR CONTEXT-SENSITIVE EXTENDED REDUCTION ********************)
-
-(* Relocation properties ****************************************************)
-
-lemma cnx_lift: ∀h,o,G,L0,L,T,T0,c,l,k. ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃T⦄ → ⬇[c, l, k] L0 ≡ L →
- ⬆[l, k] T ≡ T0 → ⦃G, L0⦄ ⊢ ➡[h, o] 𝐍⦃T0⦄.
-#h #o #G #L0 #L #T #T0 #c #l #k #HLT #HL0 #HT0 #X #H
-elim (cpx_inv_lift1 … H … HL0 … HT0) -L0 #T1 #HT10 #HT1
-<(HLT … HT1) in HT0; -L #HT0
->(lift_mono … HT10 … HT0) -T1 -X //
-qed.
-
-lemma cnx_inv_lift: ∀h,o,G,L0,L,T,T0,c,l,k. ⦃G, L0⦄ ⊢ ➡[h, o] 𝐍⦃T0⦄ → ⬇[c, l, k] L0 ≡ L →
- ⬆[l, k] T ≡ T0 → ⦃G, L⦄ ⊢ ➡[h, o] 𝐍⦃T⦄.
-#h #o #G #L0 #L #T #T0 #c #l #k #HLT0 #HL0 #HT0 #X #H
-elim (lift_total X l k) #X0 #HX0
-lapply (cpx_lift … H … HL0 … HT0 … HX0) -L #HTX0
->(HLT0 … HTX0) in HX0; -L0 -X0 #H
->(lift_inj … H … HT0) -T0 -X -l -k //
-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 *)
-(* *)
-(**************************************************************************)
-
-(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
-
-notation "hvbox( ⦃ term 46 G, break term 46 L ⦄ ⊢ ➡ break [ term 46 o , break term 46 h ] 𝐍 break ⦃ term 46 T ⦄ )"
- non associative with precedence 45
- for @{ 'PRedNormal $h $o $G $L $T }.
+++ /dev/null
-lemma cpg_delift: ∀c,h,I,G,K,V,T1,L,i. ⬇*[i] L ≡ (K.ⓑ{I}V) →
- ∃∃T2,T. ⦃G, L⦄ ⊢ T1 ➡[h, 𝟘𝟘] T2 & ⬆*[↑1] T ≡ T2.
-#h #c #I #G #K #V #T1 elim T1 -T1
-[ * #i #L #l /2 width=4 by cpg_atom, lift_sort, lift_gref, ex2_2_intro/
- elim (lt_or_eq_or_gt i l) #Hil [1,3: /4 width=4 by cpg_atom, lift_lref_ge_minus, lift_lref_lt, ylt_inj, yle_inj, ex2_2_intro/ ]
- destruct
- elim (lift_total V 0 (i+1)) #W #HVW
- elim (lift_split … HVW i i) /3 width=7 by cpg_delta, ex2_2_intro/
-| * [ #a ] #I #W1 #U1 #IHW1 #IHU1 #L #l #HLK
- elim (IHW1 … HLK) -IHW1 #W2 #W #HW12 #HW2
- [ elim (IHU1 (L. ⓑ{I} W1) (l+1)) -IHU1 /3 width=9 by cpg_bind, drop_drop, lift_bind, ex2_2_intro/
- | elim (IHU1 … HLK) -IHU1 -HLK /3 width=8 by cpg_flat, lift_flat, ex2_2_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/relocation/drops.ma".
-include "basic_2/rt_transition/cpg.ma".
-
-(* CONTEXT-SENSITIVE GENERIC PARALLEL RT-TRANSITION FOR TERMS ***************)
-
-(* Properties with length for local environments ****************************)
-
-lemma cpg_inv_lref1_ge: ∀h,c,G,L,T2,i. ⦃G, L⦄ ⊢ #i ➡[h, c] T2 → |L| ≤ i → T2 = #i.
-#h #c #G #L #T2 #i #H elim (cpg_inv_lref1 … H) -H // *
-#I #K #V1 #V2 #HLK #_ #_ #HL -h -G -V2 lapply (drop_fwd_length_lt2 … HLK) -K -I -V1
-#H elim (lt_refl_false i) /2 width=3 by lt_to_le_to_lt/
-qed-.
+++ /dev/null
-lemma cpr_delift: ∀G,K,V,T1,L,l. ⬇[l] L ≡ (K.ⓓV) →
- ∃∃T2,T. ⦃G, L⦄ ⊢ T1 ➡ T2 & ⬆[l, 1] T ≡ T2.
-#G #K #V #T1 elim T1 -T1
-[ * /2 width=4 by cpr_atom, lift_sort, lift_gref, ex2_2_intro/
- #i #L #l #HLK elim (lt_or_eq_or_gt i l)
- #Hil [1,3: /4 width=4 by lift_lref_ge_minus, lift_lref_lt, ylt_inj, yle_inj, ex2_2_intro/ ]
- destruct
- elim (lift_total V 0 (i+1)) #W #HVW
- elim (lift_split … HVW i i) /3 width=6 by cpr_delta, ex2_2_intro/
-| * [ #a ] #I #W1 #U1 #IHW1 #IHU1 #L #l #HLK
- elim (IHW1 … HLK) -IHW1 #W2 #W #HW12 #HW2
- [ elim (IHU1 (L. ⓑ{I}W1) (l+1)) -IHU1 /3 width=9 by drop_drop, cpr_bind, lift_bind, ex2_2_intro/
- | elim (IHU1 … HLK) -IHU1 -HLK /3 width=8 by cpr_flat, lift_flat, ex2_2_intro/
- ]
-]
-qed-.
-
-fact lstas_cpr_aux: ∀h,G,L,T1,T2,d. ⦃G, L⦄ ⊢ T1 •*[h, d] T2 →
- d = 0 → ⦃G, L⦄ ⊢ T1 ➡ T2.
-#h #G #L #T1 #T2 #d #H elim H -G -L -T1 -T2 -d
-/3 width=1 by cpr_eps, cpr_flat, cpr_bind/
-[ #G #L #K #V1 #V2 #W2 #i #d #HLK #_ #HVW2 #IHV12 #H destruct
- /3 width=6 by cpr_delta/
-| #G #L #K #V1 #V2 #W2 #i #d #_ #_ #_ #_ <plus_n_Sm #H destruct
-]
-qed-.
-
-lemma lstas_cpr: ∀h,G,L,T1,T2. ⦃G, L⦄ ⊢ T1 •*[h, 0] T2 → ⦃G, L⦄ ⊢ T1 ➡ T2.
-/2 width=4 by lstas_cpr_aux/ qed.
+++ /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/reduction/cir.ma".
-include "basic_2/reduction/cpr.ma".
-
-(* CONTEXT-SENSITIVE PARALLEL REDUCTION FOR TERMS ***************************)
-
-(* Advanced forward lemmas on irreducibility ********************************)
-
-lemma cpr_fwd_cir: ∀G,L,T1,T2. ⦃G, L⦄ ⊢ T1 ➡ T2 → ⦃G, L⦄ ⊢ ➡ 𝐈⦃T1⦄ → T2 = T1.
-#G #L #T1 #T2 #H elim H -G -L -T1 -T2
-[ //
-| #G #L #K #V1 #V2 #W2 #i #HLK #_ #HVW2 #IHV12 #H
- elim (cir_inv_delta … HLK) //
-| #a * #G #L #V1 #V2 #T1 #T2 #_ #_ #IHV1 #IHT1 #H
- [ elim (cir_inv_bind … H) -H #HV1 #HT1 * #H destruct
- lapply (IHV1 … HV1) -IHV1 -HV1 #H destruct
- lapply (IHT1 … HT1) -IHT1 #H destruct //
- | elim (cir_inv_ib2 … H) -H /3 width=2 by or_introl, eq_f2/
- ]
-| * #G #L #V1 #V2 #T1 #T2 #_ #_ #IHV1 #IHT1 #H
- [ elim (cir_inv_appl … H) -H #HV1 #HT1 #_
- >IHV1 -IHV1 // -HV1 >IHT1 -IHT1 //
- | elim (cir_inv_ri2 … H) /2 width=1 by/
- ]
-| #G #L #V1 #T1 #T #T2 #_ #_ #_ #H
- elim (cir_inv_ri2 … H) /2 width=1 by or_introl/
-| #G #L #V1 #T1 #T2 #_ #_ #H
- elim (cir_inv_ri2 … H) /2 width=1 by/
-| #a #G #L #V1 #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #_ #_ #_ #H
- elim (cir_inv_appl … H) -H #_ #_ #H
- elim (simple_inv_bind … H)
-| #a #G #L #V #V1 #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #_ #_ #_ #_ #H
- elim (cir_inv_appl … H) -H #_ #_ #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/reduction/cix.ma".
-include "basic_2/reduction/cpx.ma".
-
-(* CONTEXT-SENSITIVE EXTENDED PARALLEL REDUCTION FOR TERMS ******************)
-
-(* Advanced forward lemmas on irreducibility ********************************)
-
-lemma cpx_fwd_cix: ∀h,o,G,L,T1,T2. ⦃G, L⦄ ⊢ T1 ➡[h, o] T2 → ⦃G, L⦄ ⊢ ➡[h, o] 𝐈⦃T1⦄ → T2 = T1.
-#h #o #G #L #T1 #T2 #H elim H -G -L -T1 -T2
-[ //
-| #G #L #s #d #Hkd #H elim (cix_inv_sort … Hkd H)
-| #I #G #L #K #V1 #V2 #W2 #i #HLK #_ #HVW2 #IHV12 #H
- elim (cix_inv_delta … HLK) //
-| #a * #G #L #V1 #V2 #T1 #T2 #_ #_ #IHV1 #IHT1 #H
- [ elim (cix_inv_bind … H) -H #HV1 #HT1 * #H destruct
- lapply (IHV1 … HV1) -IHV1 -HV1 #H destruct
- lapply (IHT1 … HT1) -IHT1 #H destruct //
- | elim (cix_inv_ib2 … H) -H /3 width=2 by or_introl, eq_f2/
- ]
-| * #G #L #V1 #V2 #T1 #T2 #_ #_ #IHV1 #IHT1 #H
- [ elim (cix_inv_appl … H) -H #HV1 #HT1 #_
- >IHV1 -IHV1 // -HV1 >IHT1 -IHT1 //
- | elim (cix_inv_ri2 … H) /2 width=1 by/
- ]
-| #G #L #V1 #T1 #T #T2 #_ #_ #_ #H
- elim (cix_inv_ri2 … H) /2 width=1 by or_introl/
-| #G #L #V1 #T1 #T2 #_ #_ #H
- elim (cix_inv_ri2 … H) /2 width=1 by/
-| #G #L #V1 #V2 #T #_ #_ #H
- elim (cix_inv_ri2 … H) /2 width=1 by/
-| #a #G #L #V1 #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #_ #_ #_ #H
- elim (cix_inv_appl … H) -H #_ #_ #H
- elim (simple_inv_bind … H)
-| #a #G #L #V #V1 #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #_ #_ #_ #_ #H
- elim (cix_inv_appl … H) -H #_ #_ #H
- elim (simple_inv_bind … H)
-]
-qed-.
+++ /dev/null
-lemma cpx_delift: ∀h,I,G,K,V,T1,L,l. ⬇[l] L ≡ (K.ⓑ{I}V) →
- ∃∃T2,T. ⦃G, L⦄ ⊢ T1 ➡[h] T2 & ⬆[l, 1] T ≡ T2.
-#h #o #I #G #K #V #T1 elim T1 -T1
-[ * #i #L #l /2 width=4 by cpx_atom, lift_sort, lift_gref, ex2_2_intro/
- elim (lt_or_eq_or_gt i l) #Hil [1,3: /4 width=4 by cpx_atom,
-lift_lref_ge_minus, lift_lref_lt, ylt_inj, yle_inj, ex2_2_intro/ ]
- destruct
- elim (lift_total V 0 (i+1)) #W #HVW
- elim (lift_split … HVW i i) /3 width=7 by cpx_delta, ex2_2_intro/
-| * [ #a ] #I #W1 #U1 #IHW1 #IHU1 #L #l #HLK
- elim (IHW1 … HLK) -IHW1 #W2 #W #HW12 #HW2
- [ elim (IHU1 (L. ⓑ{I} W1) (l+1)) -IHU1 /3 width=9 by cpx_bind,
-drop_drop, lift_bind, ex2_2_intro/
- | elim (IHU1 … HLK) -IHU1 -HLK /3 width=8 by cpx_flat, lift_flat,
-ex2_2_intro/
- ]
-]
-qed-.
+++ /dev/null
-lemma cpx_inv_lref1_ge: ∀h,G,L,T2,i. ⦃G, L⦄ ⊢ #i ➡[h] T2 → |L| ≤ i → T2 = #i.
+++ /dev/null
-fact sta_cpx_aux: ∀h,o,G,L,T1,T2,d2,d1. ⦃G, L⦄ ⊢ T1 •*[h, d2] T2 → d2 = 1 →
- ⦃G, L⦄ ⊢ T1 ▪[h, o] d1+1 → ⦃G, L⦄ ⊢ T1 ➡[h, o] T2.
-#h #o #G #L #T1 #T2 #d2 #d1 #H elim H -G -L -T1 -T2 -d2
-[ #G #L #d2 #s #H0 destruct normalize
- /3 width=4 by cpx_st, da_inv_sort/
-| #G #L #K #V1 #V2 #W2 #i #d2 #HLK #_ #HVW2 #IHV12 #H0 #H destruct
- elim (da_inv_lref … H) -H * #K0 #V0 [| #d0 ] #HLK0
- lapply (drop_mono … HLK0 … HLK) -HLK0 #H destruct /3 width=7 by cpx_delta/
-| #G #L #K #V1 #V2 #i #_ #_ #_ #H destruct
-| #G #L #K #V1 #V2 #W2 #i #d2 #HLK #HV12 #HVW2 #_ #H0 #H
- lapply (discr_plus_xy_y … H0) -H0 #H0 destruct
- elim (da_inv_lref … H) -H * #K0 #V0 [| #d0 ] #HLK0
- lapply (drop_mono … HLK0 … HLK) -HLK0 #H destruct
- /4 width=7 by cpx_delta, cpr_cpx, lstas_cpr/
-| /4 width=2 by cpx_bind, da_inv_bind/
-| /4 width=3 by cpx_flat, da_inv_flat/
-| /4 width=3 by cpx_eps, da_inv_flat/
-]
-qed-.
-
-lemma sta_cpx: ∀h,o,G,L,T1,T2,d. ⦃G, L⦄ ⊢ T1 •*[h, 1] T2 →
- ⦃G, L⦄ ⊢ T1 ▪[h, o] d+1 → ⦃G, L⦄ ⊢ T1 ➡[h, o] T2.
-/2 width=3 by sta_cpx_aux/ qed.
-
-lemma fqu_sta_trans: ∀h,o,G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐ ⦃G2, L2, T2⦄ →
- ∀U2. ⦃G2, L2⦄ ⊢ T2 •*[h, 1] U2 →
- ∀d. ⦃G2, L2⦄ ⊢ T2 ▪[h, o] d+1 →
- ∃∃U1. ⦃G1, L1⦄ ⊢ T1 ➡[h, o] U1 & ⦃G1, L1, U1⦄ ⊐ ⦃G2, L2, U2⦄.
-/3 width=5 by fqu_cpx_trans, sta_cpx/ qed-.
-
-lemma fquq_sta_trans: ∀h,o,G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐⸮ ⦃G2, L2, T2⦄ →
- ∀U2. ⦃G2, L2⦄ ⊢ T2 •*[h, 1] U2 →
- ∀d. ⦃G2, L2⦄ ⊢ T2 ▪[h, o] d+1 →
- ∃∃U1. ⦃G1, L1⦄ ⊢ T1 ➡[h, o] U1 & ⦃G1, L1, U1⦄ ⊐⸮ ⦃G2, L2, U2⦄.
-/3 width=5 by fquq_cpx_trans, sta_cpx/ 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/psubst_6.ma".
-include "basic_2/grammar/genv.ma".
-include "basic_2/substitution/lsuby.ma".
-
-(* CONTEXT-SENSITIVE EXTENDED ORDINARY SUBSTITUTION FOR TERMS ***************)
-
-(* activate genv *)
-inductive cpy: ynat → ynat → relation4 genv lenv term term ≝
-| cpy_atom : ∀I,G,L,l,m. cpy l m G L (⓪{I}) (⓪{I})
-| cpy_subst: ∀I,G,L,K,V,W,i,l,m. l ≤ i → i < l+m →
- ⬇[i] L ≡ K.ⓑ{I}V → ⬆[0, ⫯i] V ≡ W → cpy l m G L (#i) W
-| cpy_bind : ∀a,I,G,L,V1,V2,T1,T2,l,m.
- cpy l m G L V1 V2 → cpy (⫯l) m G (L.ⓑ{I}V1) T1 T2 →
- cpy l m G L (ⓑ{a,I}V1.T1) (ⓑ{a,I}V2.T2)
-| cpy_flat : ∀I,G,L,V1,V2,T1,T2,l,m.
- cpy l m G L V1 V2 → cpy l m G L T1 T2 →
- cpy l m G L (ⓕ{I}V1.T1) (ⓕ{I}V2.T2)
-.
-
-interpretation "context-sensitive extended ordinary substritution (term)"
- 'PSubst G L T1 l m T2 = (cpy l m G L T1 T2).
-
-(* Basic properties *********************************************************)
-
-lemma lsuby_cpy_trans: ∀G,l,m. lsub_trans … (cpy 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 #V #W #i #l #m #Hli #Hilm #HLK1 #HVW #L2 #HL12
- elim (ylt_inv_plus_dx … Hilm) #m0 #H0 #_
- elim (lsuby_drop_trans_be … HL12 … HLK1 … H0) -HL12 -HLK1 -H0 /2 width=5 by cpy_subst/
-| /4 width=1 by lsuby_succ, cpy_bind/
-| /3 width=1 by cpy_flat/
-]
-qed-.
-
-lemma cpy_refl: ∀G,T,L,l,m. ⦃G, L⦄ ⊢ T ▶[l, m] T.
-#G #T elim T -T // * /2 width=1 by cpy_bind, cpy_flat/
-qed.
-
-(* Basic_1: was: subst1_ex *)
-lemma cpy_full: ∀I,G,K,V,T1,L,l. ⬇[l] L ≡ K.ⓑ{I}V →
- ∃∃T2,T. ⦃G, L⦄ ⊢ T1 ▶[l, 1] T2 & ⬆[l, 1] T ≡ T2.
-#I #G #K #V #T1 elim T1 -T1
-[ * #i #L #l #HLK
- /2 width=4 by lift_sort, lift_gref, ex2_2_intro/
- elim (ylt_split_eq i l) /3 width=4 by lift_lref_pred, lift_lref_lt, ex2_2_intro/
- #H destruct lapply (drop_fwd_Y2 … HLK) #Hi
- elim (lift_total (⫯i) … V 0) /2 width=1 by ylt_succ/
- #W #HVW elim (lift_split … HVW i i … 1)
- /4 width=6 by cpy_subst, monotonic_ylt_plus_sn, ex2_2_intro/
-| * [ #a ] #J #W1 #U1 #IHW1 #IHU1 #L #l #HLK
- elim (IHW1 … HLK) -IHW1 #W2 #W #HW12 #HW2
- [ elim (IHU1 (L.ⓑ{J}W1) (⫯l)) -IHU1
- /3 width=9 by cpy_bind, drop_drop, lift_bind, ex2_2_intro/
- | elim (IHU1 … HLK) -IHU1 -HLK
- /3 width=8 by cpy_flat, lift_flat, ex2_2_intro/
- ]
-]
-qed-.
-
-lemma cpy_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 elim H -G -L -T1 -T2 -l1 -m1 //
-[ /3 width=5 by cpy_subst, ylt_yle_trans, yle_trans/
-| /4 width=3 by cpy_bind, ylt_yle_trans, yle_succ/
-| /3 width=1 by cpy_flat/
-]
-qed-.
-(*
-lemma cpy_weak_top: ∀G,L,T1,T2,l,m.
- ⦃G, L⦄ ⊢ T1 ▶[l, m] T2 → ⦃G, L⦄ ⊢ T1 ▶[l, ∞] T2.
-/2 width=5 by cpy_weak/ qed-.
-
-lemma cpy_weak_full: ∀G,L,T1,T2,l,m.
- ⦃G, L⦄ ⊢ T1 ▶[l, m] T2 → ⦃G, L⦄ ⊢ T1 ▶[0, ∞] T2.
-/2 width=5 by cpy_weak/ qed-.
-*)
-lemma cpy_split_up: ∀G,L,T1,T2,l,m. ⦃G, L⦄ ⊢ T1 ▶[l, m] T2 →
- ∀i,m2. i + m2 = l + m →
- ∀m1. i ≤ l + m1 →
- ∃∃T. ⦃G, L⦄ ⊢ T1 ▶[l, m1] T & ⦃G, L⦄ ⊢ T ▶[i, m2] T2.
-#G #L #T1 #T2 #l #m #H elim H -G -L -T1 -T2 -l -m
-[ /2 width=3 by ex2_intro/
-| #I #G #L #K #V #W #i #l #m #Hli #Hilm #HLK #HVW #j #m2 #H2 #m1 #H1
- elim (ylt_split i j) [ -Hilm -H2 | -Hli ]
- /4 width=9 by cpy_subst, ylt_yle_trans, ex2_intro/
-| #a #I #G #L #V1 #V2 #T1 #T2 #l #m #_ #_ #IHV12 #IHT12 #i #m2 #H2 #m1 #H1
- elim (IHV12 … H2 … H1) -IHV12 #V
- elim (IHT12 (⫯i) … m2 … m1) -IHT12 /2 width=1 by yle_succ/ -H2 -H1
- #T #HT1 #HT2 lapply (lsuby_cpy_trans … HT2 (L.ⓑ{I}V) ?) -HT2
- /3 width=5 by lsuby_succ, ex2_intro, cpy_bind/
-| #I #G #L #V1 #V2 #T1 #T2 #l #m #_ #_ #IHV12 #IHT12 #i #m2 #H2 #m1 #H1
- elim (IHV12 … H2 … H1) -IHV12 elim (IHT12 … H2 … H1) -IHT12 -H2 -H1
- /3 width=5 by ex2_intro, cpy_flat/
-]
-qed-.
-
-lemma cpy_split_down: ∀G,L,T1,T2,l,m. ⦃G, L⦄ ⊢ T1 ▶[l, m] T2 →
- ∀m1,m2. m = m1 + m2 →
- ∃∃T. ⦃G, L⦄ ⊢ T1 ▶[l+m2, m1] T & ⦃G, L⦄ ⊢ T ▶[l, m2] T2.
-#G #L #T1 #T2 #l #m #H elim H -G -L -T1 -T2 -l -m
-[ /2 width=3 by ex2_intro/
-| #I #G #L #K #V #W #i #l #m #Hli #Hilm #HLK #HVW #m1 #m2 #H destruct
- elim (ylt_split i (l+m2)) [ -Hilm | -Hli ]
- /3 width=9 by cpy_subst, ex2_intro/
-| #a #I #G #L #V1 #V2 #T1 #T2 #l #m #_ #_ #IHV12 #IHT12 #m1 #m2 #H destruct
- elim (IHV12 m1 m2) -IHV12 // #V
- elim (IHT12 m1 m2) -IHT12 //
- >yplus_succ1 #T #HT1 #HT2
- lapply (lsuby_cpy_trans … HT2 (L.ⓑ{I}V) ?) -HT2
- /3 width=5 by lsuby_succ, ex2_intro, cpy_bind/
-| #I #G #L #V1 #V2 #T1 #T2 #l #m #_ #_ #IHV12 #IHT12 #m1 #m2 #H destruct
- elim (IHV12 m1 m2) -IHV12 // elim (IHT12 m1 m2) -IHT12 //
- /3 width=5 by ex2_intro, cpy_flat/
-]
-qed-.
-
-(* Basic forward lemmas *****************************************************)
-
-lemma cpy_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 elim H -G -L -U1 -U2 -lt -mt
-[ * #i #G #L #lt #mt #T1 #l #m #H #_
- [ lapply (lift_inv_sort2 … H) -H #H destruct /2 width=3 by ex2_intro/
- | elim (lift_inv_lref2 … H) -H * #Hil #H destruct /3 width=3 by lift_lref_ge_minus, lift_lref_lt, ex2_intro/
- | lapply (lift_inv_gref2 … H) -H #H destruct /2 width=3 by ex2_intro/
- ]
-| #I #G #L #K #V #W #i #lt #mt #Hlti #Hilmt #HLK #HVW #T1 #l #m #H #Hllt #Hlmlmt
- elim (lift_inv_lref2 … H) -H * #Hil #H destruct [ -V -Hilmt -Hlmlmt | -Hlti -Hllt ]
- [ elim (ylt_yle_false … Hllt) -Hllt /3 width=3 by yle_ylt_trans, ylt_inj/
- | elim (yle_inv_plus_inj2 … Hil) #Hlim #Hmi
- elim (lift_split … HVW l (⫯(i-m)) ? ? ?) [2,3,4: /2 width=1 by yle_succ_dx, le_S_S/ ] -Hlim
- #T2 #_ >plus_minus /2 width=1 by yle_inv_inj/ <minus_minus /3 width=1 by le_S, yle_inv_inj/ <minus_n_n <plus_n_O #H -Hmi
- @(ex2_intro … H) -H @(cpy_subst … HLK HVW) /2 width=1 by yle_inj/ >ymax_pre_sn_comm // (**) (* explicit constructor *)
- ]
-| #a #I #G #L #W1 #W2 #U1 #U2 #lt #mt #_ #_ #IHW12 #IHU12 #X #l #m #H #Hllt #Hlmlmt
- elim (lift_inv_bind2 … H) -H #V1 #T1 #HVW1 #HTU1 #H destruct
- elim (IHW12 … HVW1) -V1 -IHW12 //
- elim (IHU12 … HTU1) -T1 -IHU12 /2 width=1 by yle_succ/
- <yplus_inj >yplus_SO2 >yplus_succ1 >yplus_succ1
- /3 width=2 by cpy_bind, lift_bind, ex2_intro/
-| #I #G #L #W1 #W2 #U1 #U2 #lt #mt #_ #_ #IHW12 #IHU12 #X #l #m #H #Hllt #Hlmlmt
- elim (lift_inv_flat2 … H) -H #V1 #T1 #HVW1 #HTU1 #H destruct
- elim (IHW12 … HVW1) -V1 -IHW12 // elim (IHU12 … HTU1) -T1 -IHU12
- /3 width=2 by cpy_flat, lift_flat, ex2_intro/
-]
-qed-.
-
-lemma cpy_fwd_tw: ∀G,L,T1,T2,l,m. ⦃G, L⦄ ⊢ T1 ▶[l, m] T2 → ♯{T1} ≤ ♯{T2}.
-#G #L #T1 #T2 #l #m #H elim H -G -L -T1 -T2 -l -m normalize
-/3 width=1 by monotonic_le_plus_l, le_plus/
-qed-.
-
-(* Basic inversion lemmas ***************************************************)
-
-fact cpy_inv_atom1_aux: ∀G,L,T1,T2,l,m. ⦃G, L⦄ ⊢ T1 ▶[l, m] T2 → ∀J. T1 = ⓪{J} →
- T2 = ⓪{J} ∨
- ∃∃I,K,V,i. l ≤ yinj i & i < l + m &
- ⬇[i] L ≡ K.ⓑ{I}V &
- ⬆[O, ⫯i] V ≡ T2 &
- J = LRef i.
-#G #L #T1 #T2 #l #m * -G -L -T1 -T2 -l -m
-[ #I #G #L #l #m #J #H destruct /2 width=1 by or_introl/
-| #I #G #L #K #V #T2 #i #l #m #Hli #Hilm #HLK #HVT2 #J #H destruct /3 width=9 by ex5_4_intro, or_intror/
-| #a #I #G #L #V1 #V2 #T1 #T2 #l #m #_ #_ #J #H destruct
-| #I #G #L #V1 #V2 #T1 #T2 #l #m #_ #_ #J #H destruct
-]
-qed-.
-
-lemma cpy_inv_atom1: ∀I,G,L,T2,l,m. ⦃G, L⦄ ⊢ ⓪{I} ▶[l, m] T2 →
- T2 = ⓪{I} ∨
- ∃∃J,K,V,i. l ≤ yinj i & i < l + m &
- ⬇[i] L ≡ K.ⓑ{J}V &
- ⬆[O, ⫯i] V ≡ T2 &
- I = LRef i.
-/2 width=4 by cpy_inv_atom1_aux/ qed-.
-
-(* Basic_1: was: subst1_gen_sort *)
-lemma cpy_inv_sort1: ∀G,L,T2,k,l,m. ⦃G, L⦄ ⊢ ⋆k ▶[l, m] T2 → T2 = ⋆k.
-#G #L #T2 #k #l #m #H
-elim (cpy_inv_atom1 … H) -H //
-* #I #K #V #i #_ #_ #_ #_ #H destruct
-qed-.
-
-(* Basic_1: was: subst1_gen_lref *)
-lemma cpy_inv_lref1: ∀G,L,T2,i,l,m. ⦃G, L⦄ ⊢ #i ▶[l, m] T2 →
- T2 = #i ∨
- ∃∃I,K,V. l ≤ i & i < l + m &
- ⬇[i] L ≡ K.ⓑ{I}V &
- ⬆[O, ⫯i] V ≡ T2.
-#G #L #T2 #i #l #m #H
-elim (cpy_inv_atom1 … H) -H /2 width=1 by or_introl/
-* #I #K #V #j #Hlj #Hjlm #HLK #HVT2 #H destruct /3 width=5 by ex4_3_intro, or_intror/
-qed-.
-
-lemma cpy_inv_gref1: ∀G,L,T2,p,l,m. ⦃G, L⦄ ⊢ §p ▶[l, m] T2 → T2 = §p.
-#G #L #T2 #p #l #m #H
-elim (cpy_inv_atom1 … H) -H //
-* #I #K #V #i #_ #_ #_ #_ #H destruct
-qed-.
-
-fact cpy_inv_bind1_aux: ∀G,L,U1,U2,l,m. ⦃G, L⦄ ⊢ U1 ▶[l, m] U2 →
- ∀a,I,V1,T1. U1 = ⓑ{a,I}V1.T1 →
- ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ▶[l, m] V2 &
- ⦃G, L. ⓑ{I}V1⦄ ⊢ T1 ▶[⫯l, m] T2 &
- U2 = ⓑ{a,I}V2.T2.
-#G #L #U1 #U2 #l #m * -G -L -U1 -U2 -l -m
-[ #I #G #L #l #m #b #J #W1 #U1 #H destruct
-| #I #G #L #K #V #W #i #l #m #_ #_ #_ #_ #b #J #W1 #U1 #H destruct
-| #a #I #G #L #V1 #V2 #T1 #T2 #l #m #HV12 #HT12 #b #J #W1 #U1 #H destruct /2 width=5 by ex3_2_intro/
-| #I #G #L #V1 #V2 #T1 #T2 #l #m #_ #_ #b #J #W1 #U1 #H destruct
-]
-qed-.
-
-lemma cpy_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.
-/2 width=3 by cpy_inv_bind1_aux/ qed-.
-
-fact cpy_inv_flat1_aux: ∀G,L,U1,U2,l,m. ⦃G, L⦄ ⊢ U1 ▶[l, m] U2 →
- ∀I,V1,T1. U1 = ⓕ{I}V1.T1 →
- ∃∃V2,T2. ⦃G, L⦄ ⊢ V1 ▶[l, m] V2 &
- ⦃G, L⦄ ⊢ T1 ▶[l, m] T2 &
- U2 = ⓕ{I}V2.T2.
-#G #L #U1 #U2 #l #m * -G -L -U1 -U2 -l -m
-[ #I #G #L #l #m #J #W1 #U1 #H destruct
-| #I #G #L #K #V #W #i #l #m #_ #_ #_ #_ #J #W1 #U1 #H destruct
-| #a #I #G #L #V1 #V2 #T1 #T2 #l #m #_ #_ #J #W1 #U1 #H destruct
-| #I #G #L #V1 #V2 #T1 #T2 #l #m #HV12 #HT12 #J #W1 #U1 #H destruct /2 width=5 by ex3_2_intro/
-]
-qed-.
-
-lemma cpy_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.
-/2 width=3 by cpy_inv_flat1_aux/ qed-.
-
-
-fact cpy_inv_refl_O2_aux: ∀G,L,T1,T2,l,m. ⦃G, L⦄ ⊢ T1 ▶[l, m] T2 → m = 0 → T1 = T2.
-#G #L #T1 #T2 #l #m #H elim H -G -L -T1 -T2 -l -m
-[ //
-| #I #G #L #K #V #W #i #l #m #Hli #Hilm #_ #_ #H destruct
- elim (ylt_yle_false … Hli) -Hli //
-| /3 width=1 by eq_f2/
-| /3 width=1 by eq_f2/
-]
-qed-.
-
-lemma cpy_inv_refl_O2: ∀G,L,T1,T2,l. ⦃G, L⦄ ⊢ T1 ▶[l, 0] T2 → T1 = T2.
-/2 width=6 by cpy_inv_refl_O2_aux/ qed-.
-
-(* Basic_1: was: subst1_gen_lift_eq *)
-lemma cpy_inv_lift1_eq: ∀G,T1,U1,l,m. ⬆[l, m] T1 ≡ U1 →
- ∀L,U2. ⦃G, L⦄ ⊢ U1 ▶[l, m] U2 → U1 = U2.
-#G #T1 #U1 #l #m #HTU1 #L #U2 #HU12 elim (cpy_fwd_up … HU12 … HTU1) -HU12 -HTU1
-/2 width=4 by cpy_inv_refl_O2/
-qed-.
-
-(* Basic_1: removed theorems 25:
- subst0_gen_sort subst0_gen_lref subst0_gen_head subst0_gen_lift_lt
- subst0_gen_lift_false subst0_gen_lift_ge subst0_refl subst0_trans
- subst0_lift_lt subst0_lift_ge subst0_lift_ge_S subst0_lift_ge_s
- subst0_subst0 subst0_subst0_back subst0_weight_le subst0_weight_lt
- subst0_confluence_neq subst0_confluence_eq subst0_tlt_head
- subst0_confluence_lift subst0_tlt
- subst1_head subst1_gen_head subst1_lift_S subst1_confluence_lift
-*)
+++ /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".
-
-(* CONTEXT-SENSITIVE EXTENDED ORDINARY SUBSTITUTION FOR TERMS ***************)
-
-(* Main properties **********************************************************)
-
-(* Basic_1: was: subst1_confluence_eq *)
-theorem cpy_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.
-#G #L #T0 #T1 #l1 #m1 #H elim H -G -L -T0 -T1 -l1 -m1
-[ /2 width=3 by ex2_intro/
-| #I1 #G #L #K1 #V1 #T1 #i0 #l1 #m1 #Hl1 #Hlm1 #HLK1 #HVT1 #T2 #l2 #m2 #H
- elim (cpy_inv_lref1 … H) -H
- [ #HX destruct /3 width=7 by cpy_subst, ex2_intro/
- | -Hl1 -Hlm1 * #I2 #K2 #V2 #_ #_ #HLK2 #HVT2
- lapply (drop_mono … HLK1 … HLK2) -HLK1 -HLK2 #H destruct
- >(lift_mono … HVT1 … HVT2) -HVT1 -HVT2 /2 width=3 by ex2_intro/
- ]
-| #a #I #G #L #V0 #V1 #T0 #T1 #l1 #m1 #_ #_ #IHV01 #IHT01 #X #l2 #m2 #HX
- elim (cpy_inv_bind1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct
- elim (IHV01 … HV02) -IHV01 -HV02 #V #HV1 #HV2
- elim (IHT01 … HT02) -T0 #T #HT1 #HT2
- lapply (lsuby_cpy_trans … HT1 (L.ⓑ{I}V1) ?) -HT1 /2 width=1 by lsuby_succ/
- lapply (lsuby_cpy_trans … HT2 (L.ⓑ{I}V2) ?) -HT2
- /3 width=5 by cpy_bind, lsuby_succ, ex2_intro/
-| #I #G #L #V0 #V1 #T0 #T1 #l1 #m1 #_ #_ #IHV01 #IHT01 #X #l2 #m2 #HX
- elim (cpy_inv_flat1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct
- elim (IHV01 … HV02) -V0
- elim (IHT01 … HT02) -T0 /3 width=5 by cpy_flat, ex2_intro/
-]
-qed-.
-
-(* Basic_1: was: subst1_confluence_neq *)
-theorem cpy_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.
-#G #L1 #T0 #T1 #l1 #m1 #H elim H -G -L1 -T0 -T1 -l1 -m1
-[ /2 width=3 by ex2_intro/
-| #I1 #G #L1 #K1 #V1 #T1 #i0 #l1 #m1 #Hl1 #Hlm1 #HLK1 #HVT1 #L2 #T2 #l2 #m2 #H1 #H2
- elim (cpy_inv_lref1 … H1) -H1
- [ #H destruct /3 width=7 by cpy_subst, ex2_intro/
- | -HLK1 -HVT1 * #I2 #K2 #V2 #Hl2 #Hlm2 #_ #_ elim H2 -H2 #Hlml [ -Hl1 -Hlm2 | -Hl2 -Hlm1 ]
- [ elim (ylt_yle_false … Hlm1) -Hlm1 /2 width=3 by yle_trans/
- | elim (ylt_yle_false … Hlm2) -Hlm2 /2 width=3 by yle_trans/
- ]
- ]
-| #a #I #G #L1 #V0 #V1 #T0 #T1 #l1 #m1 #_ #_ #IHV01 #IHT01 #L2 #X #l2 #m2 #HX #H
- elim (cpy_inv_bind1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct
- elim (IHV01 … HV02 H) -IHV01 -HV02 #V #HV1 #HV2
- elim (IHT01 … HT02) -T0
- [ -H #T #HT1 #HT2
- lapply (lsuby_cpy_trans … HT1 (L2.ⓑ{I}V1) ?) -HT1 /2 width=1 by lsuby_succ/
- lapply (lsuby_cpy_trans … HT2 (L1.ⓑ{I}V2) ?) -HT2 /3 width=5 by cpy_bind, lsuby_succ, ex2_intro/
- | -HV1 -HV2 elim H -H /3 width=1 by yle_succ, or_introl, or_intror/
- ]
-| #I #G #L1 #V0 #V1 #T0 #T1 #l1 #m1 #_ #_ #IHV01 #IHT01 #L2 #X #l2 #m2 #HX #H
- elim (cpy_inv_flat1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct
- elim (IHV01 … HV02 H) -V0
- elim (IHT01 … HT02 H) -T0 -H /3 width=5 by cpy_flat, ex2_intro/
-]
-qed-.
-
-(* Note: the constant 1 comes from cpy_subst *)
-(* Basic_1: was: subst1_trans *)
-theorem cpy_trans_ge: ∀G,L,T1,T0,l,m. ⦃G, L⦄ ⊢ T1 ▶[l, m] T0 →
- ∀T2. ⦃G, L⦄ ⊢ T0 ▶[l, 1] T2 → 1 ≤ m → ⦃G, L⦄ ⊢ T1 ▶[l, m] T2.
-#G #L #T1 #T0 #l #m #H elim H -G -L -T1 -T0 -l -m
-[ #I #G #L #l #m #T2 #H #Hm
- elim (cpy_inv_atom1 … H) -H
- [ #H destruct //
- | * #J #K #V #i #Hl2i #Hilm2 #HLK #HVT2 #H destruct
- lapply (ylt_yle_trans … (l+m) … Hilm2)
- /2 width=5 by cpy_subst, monotonic_yle_plus_sn/
- ]
-| #I #G #L #K #V #V2 #i #l #m #Hli #Hilm #HLK #HVW #T2 #HVT2 #Hm
- lapply (cpy_weak … HVT2 0 (i+1) ? ?) -HVT2 /3 width=1 by yle_plus_dx2_trans, yle_succ/
- >yplus_inj #HVT2 <(cpy_inv_lift1_eq … HVW … HVT2) -HVT2 /2 width=5 by cpy_subst/
-| #a #I #G #L #V1 #V0 #T1 #T0 #l #m #_ #_ #IHV10 #IHT10 #X #H #Hm
- elim (cpy_inv_bind1 … H) -H #V2 #T2 #HV02 #HT02 #H destruct
- lapply (lsuby_cpy_trans … HT02 (L.ⓑ{I}V1) ?) -HT02 /2 width=1 by lsuby_succ/ #HT02
- lapply (IHT10 … HT02 Hm) -T0 /3 width=1 by cpy_bind/
-| #I #G #L #V1 #V0 #T1 #T0 #l #m #_ #_ #IHV10 #IHT10 #X #H #Hm
- elim (cpy_inv_flat1 … H) -H #V2 #T2 #HV02 #HT02 #H destruct /3 width=1 by cpy_flat/
-]
-qed-.
-
-theorem cpy_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.
-#G #L #T1 #T0 #l1 #m1 #H elim H -G -L -T1 -T0 -l1 -m1
-[ /2 width=3 by ex2_intro/
-| #I #G #L #K #V #W #i1 #l1 #m1 #Hli1 #Hilm1 #HLK #HVW #T2 #l2 #m2 #HWT2 #Hlm2l1
- lapply (yle_trans … Hlm2l1 … Hli1) -Hlm2l1 #Hlm2i1
- lapply (cpy_weak … HWT2 0 (i1+1) ? ?) -HWT2 /3 width=1 by yle_succ, yle_pred_sn/ -Hlm2i1
- >yplus_inj #HWT2 <(cpy_inv_lift1_eq … HVW … HWT2) -HWT2 /3 width=9 by cpy_subst, ex2_intro/
-| #a #I #G #L #V1 #V0 #T1 #T0 #l1 #m1 #_ #_ #IHV10 #IHT10 #X #l2 #m2 #HX #lm2l1
- elim (cpy_inv_bind1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct
- lapply (lsuby_cpy_trans … HT02 (L.ⓑ{I}V1) ?) -HT02 /2 width=1 by lsuby_succ/ #HT02
- elim (IHV10 … HV02) -IHV10 -HV02 // #V
- elim (IHT10 … HT02) -T0 /2 width=1 by yle_succ/ #T #HT1 #HT2
- lapply (lsuby_cpy_trans … HT2 (L.ⓑ{I}V) ?) -HT2 /3 width=6 by cpy_bind, lsuby_succ, ex2_intro/
-| #I #G #L #V1 #V0 #T1 #T0 #l1 #m1 #_ #_ #IHV10 #IHT10 #X #l2 #m2 #HX #lm2l1
- elim (cpy_inv_flat1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct
- elim (IHV10 … HV02) -V0 //
- elim (IHT10 … HT02) -T0 /3 width=6 by cpy_flat, 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/drop_drop.ma".
-include "basic_2/substitution/cpy.ma".
-
-(* CONTEXT-SENSITIVE EXTENDED ORDINARY SUBSTITUTION FOR TERMS ***************)
-
-(* Properties on relocation *************************************************)
-
-(* Basic_1: was: subst1_lift_lt *)
-lemma cpy_lift_le: ∀G,K,T1,T2,lt,mt. ⦃G, K⦄ ⊢ T1 ▶[lt, mt] T2 →
- ∀L,U1,U2,s,l,m. ⬇[s, l, m] L ≡ K →
- ⬆[l, m] T1 ≡ U1 → ⬆[l, m] T2 ≡ U2 →
- lt + mt ≤ l → ⦃G, L⦄ ⊢ U1 ▶[lt, mt] U2.
-#G #K #T1 #T2 #lt #mt #H elim H -G -K -T1 -T2 -lt -mt
-[ #I #G #K #lt #mt #L #U1 #U2 #s #l #m #_ #H1 #H2 #_
- >(lift_mono … H1 … H2) -H1 -H2 //
-| #I #G #K #KV #V #W #i #lt #mt #Hlti #Hilmt #HKV #HVW #L #U1 #U2 #s #l #m #HLK #H #HWU2 #Hlmtl
- lapply (ylt_yle_trans … Hlmtl … Hilmt) -Hlmtl #Hil
- lapply (lift_inv_lref1_lt … H … Hil) -H #H destruct
- elim (lift_trans_ge … HVW … HWU2) -W /2 width=1 by ylt_fwd_le_succ1/
- <yplus_inj >yplus_SO2 >yminus_succ2 #W #HVW #HWU2
- elim (drop_trans_le … HLK … HKV) -K /2 width=2 by ylt_fwd_le/ #X #HLK #H
- elim (drop_inv_skip2 … H) -H /2 width=1 by ylt_to_minus/ -Hil #K #Y #_ #HVY
- >(lift_mono … HVY … HVW) -Y -HVW #H destruct /2 width=5 by cpy_subst/
-| #a #I #G #K #V1 #V2 #T1 #T2 #lt #mt #_ #_ #IHV12 #IHT12 #L #U1 #U2 #s #l #m #HLK #H1 #H2 #Hlmtl
- elim (lift_inv_bind1 … H1) -H1 #VV1 #TT1 #HVV1 #HTT1 #H1
- elim (lift_inv_bind1 … H2) -H2 #VV2 #TT2 #HVV2 #HTT2 #H2 destruct
- /4 width=7 by cpy_bind, drop_skip, yle_succ/
-| #G #I #K #V1 #V2 #T1 #T2 #lt #mt #_ #_ #IHV12 #IHT12 #L #U1 #U2 #s #l #m #HLK #H1 #H2 #Hlmtl
- elim (lift_inv_flat1 … H1) -H1 #VV1 #TT1 #HVV1 #HTT1 #H1
- elim (lift_inv_flat1 … H2) -H2 #VV2 #TT2 #HVV2 #HTT2 #H2 destruct
- /3 width=7 by cpy_flat/
-]
-qed-.
-
-lemma cpy_lift_be: ∀G,K,T1,T2,lt,mt. ⦃G, K⦄ ⊢ T1 ▶[lt, mt] T2 →
- ∀L,U1,U2,s,l,m. ⬇[s, l, m] L ≡ K →
- ⬆[l, m] T1 ≡ U1 → ⬆[l, m] T2 ≡ U2 →
- lt ≤ l → l ≤ lt + mt → ⦃G, L⦄ ⊢ U1 ▶[lt, mt + m] U2.
-#G #K #T1 #T2 #lt #mt #H elim H -G -K -T1 -T2 -lt -mt
-[ #I #G #K #lt #mt #L #U1 #U2 #s #l #m #_ #H1 #H2 #_ #_
- >(lift_mono … H1 … H2) -H1 -H2 //
-| #I #G #K #KV #V #W #i #lt #mt #Hlti #Hilmt #HKV #HVW #L #U1 #U2 #s #l #m #HLK #H #HWU2 #Hltl #_
- elim (lift_inv_lref1 … H) -H * #Hil #H destruct
- [ -Hltl
- lapply (ylt_yle_trans … (lt+mt+m) … Hilmt) // -Hilmt #Hilmtm
- elim (lift_trans_ge … HVW … HWU2) -W <yplus_inj >yplus_SO2
- [2: >yplus_O1 /2 width=1 by ylt_fwd_le_succ1/ ] >yminus_succ2 #W #HVW #HWU2
- elim (drop_trans_le … HLK … HKV) -K /2 width=1 by ylt_fwd_le/ #X #HLK #H
- elim (drop_inv_skip2 … H) -H /2 width=1 by ylt_to_minus/ -Hil #K #Y #_ #HVY
- >(lift_mono … HVY … HVW) -V #H destruct /2 width=5 by cpy_subst/
- | -Hlti
- lapply (yle_trans … Hltl … Hil) -Hltl #Hlti
- lapply (lift_trans_be … HVW … HWU2 ? ?) -W /2 width=1 by yle_succ_dx/ >plus_plus_comm_23 #HVU2
- lapply (drop_trans_ge_comm … HLK … HKV ?) -K // -Hil
- /3 width=5 by cpy_subst, drop_inv_gen, monotonic_ylt_plus_dx, yle_plus_dx1_trans/
- ]
-| #a #I #G #K #V1 #V2 #T1 #T2 #lt #mt #_ #_ #IHV12 #IHT12 #L #U1 #U2 #s #l #m #HLK #H1 #H2 #Hltl #Hllmt
- elim (lift_inv_bind1 … H1) -H1 #VV1 #TT1 #HVV1 #HTT1 #H1
- elim (lift_inv_bind1 … H2) -H2 #VV2 #TT2 #HVV2 #HTT2 #H2 destruct
- /4 width=7 by cpy_bind, drop_skip, yle_succ/
-| #I #G #K #V1 #V2 #T1 #T2 #lt #mt #_ #_ #IHV12 #IHT12 #L #U1 #U2 #s #l #m #HLK #H1 #H2 #Hlmtl
- elim (lift_inv_flat1 … H1) -H1 #VV1 #TT1 #HVV1 #HTT1 #H1
- elim (lift_inv_flat1 … H2) -H2 #VV2 #TT2 #HVV2 #HTT2 #H2 destruct
- /3 width=7 by cpy_flat/
-]
-qed-.
-
-(* Basic_1: was: subst1_lift_ge *)
-lemma cpy_lift_ge: ∀G,K,T1,T2,lt,mt. ⦃G, K⦄ ⊢ T1 ▶[lt, mt] T2 →
- ∀L,U1,U2,s,l,m. ⬇[s, l, m] L ≡ K →
- ⬆[l, m] T1 ≡ U1 → ⬆[l, m] T2 ≡ U2 →
- l ≤ lt → ⦃G, L⦄ ⊢ U1 ▶[lt+m, mt] U2.
-#G #K #T1 #T2 #lt #mt #H elim H -G -K -T1 -T2 -lt -mt
-[ #I #G #K #lt #mt #L #U1 #U2 #s #l #m #_ #H1 #H2 #_
- >(lift_mono … H1 … H2) -H1 -H2 //
-| #I #G #K #KV #V #W #i #lt #mt #Hlti #Hilmt #HKV #HVW #L #U1 #U2 #s #l #m #HLK #H #HWU2 #Hllt
- lapply (yle_trans … Hllt … Hlti) -Hllt #Hil
- lapply (lift_inv_lref1_ge … H … Hil) -H #H destruct
- lapply (lift_trans_be … HVW … HWU2 ? ?) -W /2 width=1 by yle_succ_dx/ >plus_plus_comm_23 #HVU2
- lapply (drop_trans_ge_comm … HLK … HKV ?) -K // -Hil
- /3 width=5 by cpy_subst, drop_inv_gen, monotonic_ylt_plus_dx, monotonic_yle_plus_dx/
-| #a #I #G #K #V1 #V2 #T1 #T2 #lt #mt #_ #_ #IHV12 #IHT12 #L #U1 #U2 #s #l #m #HLK #H1 #H2 #Hllt
- elim (lift_inv_bind1 … H1) -H1 #VV1 #TT1 #HVV1 #HTT1 #H1
- elim (lift_inv_bind1 … H2) -H2 #VV2 #TT2 #HVV2 #HTT2 #H2 destruct
- /4 width=6 by cpy_bind, drop_skip, yle_succ/
-| #I #G #K #V1 #V2 #T1 #T2 #lt #mt #_ #_ #IHV12 #IHT12 #L #U1 #U2 #s #l #m #HLK #H1 #H2 #Hllt
- elim (lift_inv_flat1 … H1) -H1 #VV1 #TT1 #HVV1 #HTT1 #H1
- elim (lift_inv_flat1 … H2) -H2 #VV2 #TT2 #HVV2 #HTT2 #H2 destruct
- /3 width=6 by cpy_flat/
-]
-qed-.
-
-(* Inversion lemmas on relocation *******************************************)
-
-(* Basic_1: was: subst1_gen_lift_lt *)
-lemma cpy_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 elim H -G -L -U1 -U2 -lt -mt
-[ * #i #G #L #lt #mt #K #s #l #m #_ #T1 #H #_
- [ lapply (lift_inv_sort2 … H) -H #H destruct /2 width=3 by ex2_intro/
- | elim (lift_inv_lref2 … H) -H * #Hil #H destruct /3 width=3 by lift_lref_ge_minus, lift_lref_lt, ex2_intro/
- | lapply (lift_inv_gref2 … H) -H #H destruct /2 width=3 by ex2_intro/
- ]
-| #I #G #L #KV #V #W #i #lt #mt #Hlti #Hilmt #HLKV #HVW #K #s #l #m #HLK #T1 #H #Hlmtl
- lapply (ylt_yle_trans … Hlmtl … Hilmt) -Hlmtl #Hil
- lapply (lift_inv_lref2_lt … H … Hil) -H #H destruct
- elim (drop_conf_lt … HLK … HLKV) -L // #L #U #HKL #_ #HUV
- elim (lift_trans_le … HUV … HVW) -V // >minus_plus <plus_minus_m_m //
- <yminus_succ2 <yplus_inj >yplus_SO2 >ymax_pre_sn /2 width=1 by ylt_fwd_le_succ1/ -Hil
- /3 width=5 by cpy_subst, ex2_intro/
-| #a #I #G #L #W1 #W2 #U1 #U2 #lt #mt #_ #_ #IHW12 #IHU12 #K #s #l #m #HLK #X #H #Hlmtl
- elim (lift_inv_bind2 … H) -H #V1 #T1 #HVW1 #HTU1 #H destruct
- elim (IHW12 … HLK … HVW1) -IHW12 // #V2 #HV12 #HVW2
- elim (IHU12 … HTU1) -IHU12 -HTU1
- /3 width=6 by cpy_bind, yle_succ, drop_skip, lift_bind, ex2_intro/
-| #I #G #L #W1 #W2 #U1 #U2 #lt #mt #_ #_ #IHW12 #IHU12 #K #s #l #m #HLK #X #H #Hlmtl
- elim (lift_inv_flat2 … H) -H #V1 #T1 #HVW1 #HTU1 #H destruct
- elim (IHW12 … HLK … HVW1) -W1 //
- elim (IHU12 … HLK … HTU1) -U1 -HLK
- /3 width=5 by cpy_flat, lift_flat, ex2_intro/
-]
-qed-.
-
-lemma cpy_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 elim H -G -L -U1 -U2 -lt -mt
-[ * #i #G #L #lt #mt #K #s #l #m #_ #T1 #H #_ #_
- [ lapply (lift_inv_sort2 … H) -H #H destruct /2 width=3 by ex2_intro/
- | elim (lift_inv_lref2 … H) -H * #Hil #H destruct /3 width=3 by lift_lref_ge_minus, lift_lref_lt, ex2_intro/
- | lapply (lift_inv_gref2 … H) -H #H destruct /2 width=3 by ex2_intro/
- ]
-| #I #G #L #KV #V #W #i #x #mt #Hlti #Hilmt #HLKV #HVW #K #s #l #m #HLK #T1 #H #Hltl #Hlmlmt
- elim (yle_inv_inj2 … Hlti) -Hlti #lt #Hlti #H destruct
- lapply (yle_fwd_plus_yge … Hltl Hlmlmt) #Hmmt
- elim (lift_inv_lref2 … H) -H * #Hil #H destruct [ -Hltl -Hilmt | -Hlti -Hlmlmt ]
- [ lapply (ylt_yle_trans i l (lt+(mt-m)) ? ?) //
- [ >yplus_minus_assoc_inj /2 width=1 by yle_plus1_to_minus_inj2/ ] -Hlmlmt #Hilmtm
- elim (drop_conf_lt … HLK … HLKV) -L // #L #U #HKL #_ #HUV
- elim (lift_trans_le … HUV … HVW) -V //
- <yminus_succ2 <yplus_inj >yplus_SO2 >ymax_pre_sn /2 width=1 by ylt_fwd_le_succ1/ -Hil
- /4 width=5 by cpy_subst, ex2_intro, yle_inj/
- | elim (yle_inv_plus_inj2 … Hil) #Hlim #Hmi
- lapply (yle_inv_inj … Hmi) -Hmi #Hmi
- lapply (yle_trans … Hltl (i-m) ?) // -Hltl #Hltim
- lapply (drop_conf_ge … HLK … HLKV ?) -L // #HKV
- elim (lift_split … HVW l (i-m+1)) -HVW [2,3,4: /2 width=1 by yle_succ_dx, le_S_S/ ] -Hil -Hlim
- #V1 #HV1 >plus_minus // <minus_minus /2 width=1 by le_S/ <minus_n_n <plus_n_O #H
- @(ex2_intro … H) @(cpy_subst … HKV HV1) // (**) (* explicit constructor *)
- >yplus_minus_assoc_inj /3 width=1 by monotonic_ylt_minus_dx, yle_inj/
- ]
-| #a #I #G #L #W1 #W2 #U1 #U2 #lt #mt #_ #_ #IHW12 #IHU12 #K #s #l #m #HLK #X #H #Hltl #Hlmlmt
- elim (lift_inv_bind2 … H) -H #V1 #T1 #HVW1 #HTU1 #H destruct
- elim (IHW12 … HLK … HVW1) -IHW12 // #V2 #HV12 #HVW2
- elim (IHU12 … HTU1) -U1
- /3 width=6 by cpy_bind, drop_skip, lift_bind, yle_succ, ex2_intro/
-| #I #G #L #W1 #W2 #U1 #U2 #lt #mt #_ #_ #IHW12 #IHU12 #K #s #l #m #HLK #X #H #Hltl #Hlmlmt
- elim (lift_inv_flat2 … H) -H #V1 #T1 #HVW1 #HTU1 #H destruct
- elim (IHW12 … HLK … HVW1) -W1 //
- elim (IHU12 … HLK … HTU1) -U1 -HLK //
- /3 width=5 by cpy_flat, lift_flat, ex2_intro/
-]
-qed-.
-
-(* Basic_1: was: subst1_gen_lift_ge *)
-lemma cpy_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 elim H -G -L -U1 -U2 -lt -mt
-[ * #i #G #L #lt #mt #K #s #l #m #_ #T1 #H #_
- [ lapply (lift_inv_sort2 … H) -H #H destruct /2 width=3 by ex2_intro/
- | elim (lift_inv_lref2 … H) -H * #Hil #H destruct /3 width=3 by lift_lref_ge_minus, lift_lref_lt, ex2_intro/
- | lapply (lift_inv_gref2 … H) -H #H destruct /2 width=3 by ex2_intro/
- ]
-| #I #G #L #KV #V #W #i #lt #mt #Hlti #Hilmt #HLKV #HVW #K #s #l #m #HLK #T1 #H #Hlmlt
- lapply (yle_trans … Hlmlt … Hlti) #Hlmi
- elim (yle_inv_plus_inj2 … Hlmlt) -Hlmlt #_ #Hmlt
- elim (yle_inv_plus_inj2 … Hlmi) #Hlim #Hmi
- lapply (yle_inv_inj … Hmi) -Hmi #Hmi
- lapply (lift_inv_lref2_ge … H ?) -H // #H destruct
- lapply (drop_conf_ge … HLK … HLKV ?) -L // #HKV
- elim (lift_split … HVW l (i-m+1)) -HVW [2,3,4: /3 width=1 by yle_succ, yle_pred_sn, le_S_S/ ] -Hlmi -Hlim
- #V0 #HV10 >plus_minus // <minus_minus /3 width=1 by le_S/ <minus_n_n <plus_n_O #H
- @(ex2_intro … H) @(cpy_subst … HKV HV10) (**) (* explicit constructor *)
- [ /2 width=1 by monotonic_yle_minus_dx/
- | <yminus_inj <yplus_minus_comm_inj // /3 width=1 by monotonic_ylt_minus_dx, yle_inj/
- ]
-| #a #I #G #L #W1 #W2 #U1 #U2 #lt #mt #_ #_ #IHW12 #IHU12 #K #s #l #m #HLK #X #H #Hlmtl
- elim (lift_inv_bind2 … H) -H #V1 #T1 #HVW1 #HTU1 #H destruct
- elim (yle_inv_plus_inj2 … Hlmtl) #_ #Hmlt
- elim (IHW12 … HLK … HVW1) -IHW12 // #V2 #HV12 #HVW2
- elim (IHU12 … HTU1) -U1 [4: @drop_skip // |2,5: skip |3: /2 width=1 by yle_succ/ ]
- >yminus_succ1_inj /3 width=5 by cpy_bind, lift_bind, ex2_intro/
-| #I #G #L #W1 #W2 #U1 #U2 #lt #mt #_ #_ #IHW12 #IHU12 #K #s #l #m #HLK #X #H #Hlmtl
- elim (lift_inv_flat2 … H) -H #V1 #T1 #HVW1 #HTU1 #H destruct
- elim (IHW12 … HLK … HVW1) -W1 //
- elim (IHU12 … HLK … HTU1) -U1 -HLK /3 width=5 by cpy_flat, lift_flat, ex2_intro/
-]
-qed-.
-
-(* Advanced inversion lemmas on relocation ***********************************)
-
-lemma cpy_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 #HU12 #K #s #l #m #HLK #T1 #HTU1 #Hllt #Hltlm #Hlmlmt
-elim (cpy_split_up … HU12 (l + m)) -HU12 // -Hlmlmt #U #HU1 #HU2
-lapply (cpy_weak … HU1 l m ? ?) -HU1 // [ >ymax_pre_sn_comm // ] -Hllt -Hltlm #HU1
-lapply (cpy_inv_lift1_eq … HTU1 … HU1) -HU1 #HU1 destruct
-elim (cpy_inv_lift1_ge … HU2 … HLK … HTU1) -U -L /2 width=3 by ex2_intro/
-qed-.
-
-lemma cpy_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 #HU12 #K #s #l #m #HLK #T1 #HTU1 #Hltl #Hlmtlm
-lapply (cpy_weak … HU12 lt (l+m-lt) ? ?) -HU12 //
-[ >ymax_pre_sn_comm /2 width=1 by yle_plus_dx1_trans/ ] -Hlmtlm #HU12
-elim (cpy_inv_lift1_be … HU12 … HLK … HTU1) -U1 -L /2 width=3 by ex2_intro/
-qed-.
-
-lemma cpy_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 #HU12 #K #s #l #m #HLK #T1 #HTU1 #Hltl #Hllmt #Hlmtlm
-elim (cpy_split_up … HU12 l) -HU12 // #U #HU1 #HU2
-elim (cpy_inv_lift1_le … HU1 … HLK … HTU1) -U1
-[2: >ymax_pre_sn_comm // ] -Hltl #T #HT1 #HTU
-lapply (cpy_weak … HU2 l m ? ?) -HU2 //
-[ >ymax_pre_sn_comm // ] -Hllmt -Hlmtlm #HU2
-lapply (cpy_inv_lift1_eq … HTU … HU2) -L #H 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/substitution/lift_neg.ma".
-include "basic_2/substitution/lift_lift.ma".
-include "basic_2/substitution/cpy.ma".
-
-(* CONTEXT-SENSITIVE EXTENDED ORDINARY SUBSTITUTION FOR TERMS ***************)
-
-(* Inversion lemmas on negated relocation ***********************************)
-
-lemma cpy_fwd_nlift2_ge: ∀G,L,U1,U2,l,m. ⦃G, L⦄ ⊢ U1 ▶[l, m] U2 →
- ∀i. l ≤ i → (∀T2. ⬆[i, 1] T2 ≡ U2 → ⊥) →
- (∀T1. ⬆[i, 1] T1 ≡ U1 → ⊥) ∨
- ∃∃I,K,W,j. l ≤ yinj j & j < i & ⬇[j]L ≡ K.ⓑ{I}W &
- (∀V. ⬆[⫰(i-j), 1] V ≡ W → ⊥) & (∀T1. ⬆[j, 1] T1 ≡ U1 → ⊥).
-#G #L #U1 #U2 #l #m #H elim H -G -L -U1 -U2 -l -m
-[ /3 width=2 by or_introl/
-| #I #G #L #K #V #W #j #l #m #Hlj #Hjlm #HLK #HVW #i #Hli #HnW
- elim (ylt_split j i) #Hij
- [ @or_intror @(ex5_4_intro … HLK) // -HLK
- [ #X #HXV elim (lift_trans_le … HXV … HVW ?) -V // #Y #HXY
- <yminus_succ2 <yplus_inj >yplus_SO2 >ymax_pre_sn /2 width=2 by ylt_fwd_le_succ1/
- | -HnW /3 width=7 by lift_inv_lref2_be, ylt_inj/
- ]
- | elim (lift_split … HVW i j) -HVW //
- #X #_ #H elim HnW -HnW //
- ]
-| #a #I #G #L #W1 #W2 #U1 #U2 #l #m #_ #_ #IHW12 #IHU12 #i #Hli #H elim (nlift_inv_bind … H) -H
- [ #HnW2 elim (IHW12 … HnW2) -IHW12 -HnW2 -IHU12 //
- [ /4 width=9 by nlift_bind_sn, or_introl/
- | * /5 width=9 by nlift_bind_sn, ex5_4_intro, or_intror/
- ]
- | #HnU2 elim (IHU12 … HnU2) -IHU12 -HnU2 -IHW12 /2 width=1 by yle_succ/
- [ /4 width=9 by nlift_bind_dx, or_introl/
- | * #J #K #W #j #Hlj elim (yle_inv_succ1 … Hlj) -Hlj #Hlj #Hj
- <Hj >yminus_succ #Hji #HLK #HnW
- lapply (drop_inv_drop1_lt … HLK ?) /2 width=1 by ylt_O/ -HLK #HLK
- <yminus_SO2 in Hlj; #Hlj #H4
- @or_intror @(ex5_4_intro … HLK) (**) (* explicit constructors *)
- /3 width=9 by nlift_bind_dx, ylt_pred, ylt_inj/
- ]
- ]
-| #I #G #L #W1 #W2 #U1 #U2 #l #m #_ #_ #IHW12 #IHU12 #i #Hli #H elim (nlift_inv_flat … H) -H
- [ #HnW2 elim (IHW12 … HnW2) -IHW12 -HnW2 -IHU12 //
- [ /4 width=9 by nlift_flat_sn, or_introl/
- | * /5 width=9 by nlift_flat_sn, ex5_4_intro, or_intror/
- ]
- | #HnU2 elim (IHU12 … HnU2) -IHU12 -HnU2 -IHW12 //
- [ /4 width=9 by nlift_flat_dx, or_introl/
- | * /5 width=9 by nlift_flat_dx, ex5_4_intro, or_intror/
- ]
-]
-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/predreducible_3.ma".
-include "basic_2/grammar/genv.ma".
-include "basic_2/substitution/drop.ma".
-
-(* REDUCIBLE TERMS FOR CONTEXT-SENSITIVE REDUCTION **************************)
-
-(* reducible binary items *)
-definition ri2: predicate item2 ≝
- λI. I = Bind2 true Abbr ∨ I = Flat2 Cast.
-
-(* irreducible binary binders *)
-definition ib2: relation2 bool bind2 ≝
- λa,I. I = Abst ∨ Bind2 a I = Bind2 false Abbr.
-
-(* activate genv *)
-(* reducible terms *)
-inductive crr (G:genv): relation2 lenv term ≝
-| crr_delta : ∀L,K,V,i. ⬇[i] L ≡ K.ⓓV → crr G L (#i)
-| crr_appl_sn: ∀L,V,T. crr G L V → crr G L (ⓐV.T)
-| crr_appl_dx: ∀L,V,T. crr G L T → crr G L (ⓐV.T)
-| crr_ri2 : ∀I,L,V,T. ri2 I → crr G L (②{I}V.T)
-| crr_ib2_sn : ∀a,I,L,V,T. ib2 a I → crr G L V → crr G L (ⓑ{a,I}V.T)
-| crr_ib2_dx : ∀a,I,L,V,T. ib2 a I → crr G (L.ⓑ{I}V) T → crr G L (ⓑ{a,I}V.T)
-| crr_beta : ∀a,L,V,W,T. crr G L (ⓐV.ⓛ{a}W.T)
-| crr_theta : ∀a,L,V,W,T. crr G L (ⓐV.ⓓ{a}W.T)
-.
-
-interpretation
- "reducibility for context-sensitive reduction (term)"
- 'PRedReducible G L T = (crr G L T).
-
-(* Basic inversion lemmas ***************************************************)
-
-fact crr_inv_sort_aux: ∀G,L,T,s. ⦃G, L⦄ ⊢ ➡ 𝐑⦃T⦄ → T = ⋆s → ⊥.
-#G #L #T #s0 * -L -T
-[ #L #K #V #i #HLK #H destruct
-| #L #V #T #_ #H destruct
-| #L #V #T #_ #H destruct
-| #I #L #V #T #_ #H destruct
-| #a #I #L #V #T #_ #_ #H destruct
-| #a #I #L #V #T #_ #_ #H destruct
-| #a #L #V #W #T #H destruct
-| #a #L #V #W #T #H destruct
-]
-qed-.
-
-lemma crr_inv_sort: ∀G,L,s. ⦃G, L⦄ ⊢ ➡ 𝐑⦃⋆s⦄ → ⊥.
-/2 width=6 by crr_inv_sort_aux/ qed-.
-
-fact crr_inv_lref_aux: ∀G,L,T,i. ⦃G, L⦄ ⊢ ➡ 𝐑⦃T⦄ → T = #i →
- ∃∃K,V. ⬇[i] L ≡ K.ⓓV.
-#G #L #T #j * -L -T
-[ #L #K #V #i #HLK #H destruct /2 width=3 by ex1_2_intro/
-| #L #V #T #_ #H destruct
-| #L #V #T #_ #H destruct
-| #I #L #V #T #_ #H destruct
-| #a #I #L #V #T #_ #_ #H destruct
-| #a #I #L #V #T #_ #_ #H destruct
-| #a #L #V #W #T #H destruct
-| #a #L #V #W #T #H destruct
-]
-qed-.
-
-lemma crr_inv_lref: ∀G,L,i. ⦃G, L⦄ ⊢ ➡ 𝐑⦃#i⦄ → ∃∃K,V. ⬇[i] L ≡ K.ⓓV.
-/2 width=4 by crr_inv_lref_aux/ qed-.
-
-fact crr_inv_gref_aux: ∀G,L,T,p. ⦃G, L⦄ ⊢ ➡ 𝐑⦃T⦄ → T = §p → ⊥.
-#G #L #T #q * -L -T
-[ #L #K #V #i #HLK #H destruct
-| #L #V #T #_ #H destruct
-| #L #V #T #_ #H destruct
-| #I #L #V #T #_ #H destruct
-| #a #I #L #V #T #_ #_ #H destruct
-| #a #I #L #V #T #_ #_ #H destruct
-| #a #L #V #W #T #H destruct
-| #a #L #V #W #T #H destruct
-]
-qed-.
-
-lemma crr_inv_gref: ∀G,L,p. ⦃G, L⦄ ⊢ ➡ 𝐑⦃§p⦄ → ⊥.
-/2 width=6 by crr_inv_gref_aux/ qed-.
-
-lemma trr_inv_atom: ∀G,I. ⦃G, ⋆⦄ ⊢ ➡ 𝐑⦃⓪{I}⦄ → ⊥.
-#G * #i #H
-[ elim (crr_inv_sort … H)
-| elim (crr_inv_lref … H) -H #L #V #H
- elim (drop_inv_atom1 … H) -H #H destruct
-| elim (crr_inv_gref … H)
-]
-qed-.
-
-fact crr_inv_ib2_aux: ∀a,I,G,L,W,U,T. ib2 a I → ⦃G, L⦄ ⊢ ➡ 𝐑⦃T⦄ → T = ⓑ{a,I}W.U →
- ⦃G, L⦄ ⊢ ➡ 𝐑⦃W⦄ ∨ ⦃G, L.ⓑ{I}W⦄ ⊢ ➡ 𝐑⦃U⦄.
-#G #b #J #L #W0 #U #T #HI * -L -T
-[ #L #K #V #i #_ #H destruct
-| #L #V #T #_ #H destruct
-| #L #V #T #_ #H destruct
-| #I #L #V #T #H1 #H2 destruct
- elim H1 -H1 #H destruct
- elim HI -HI #H destruct
-| #a #I #L #V #T #_ #HV #H destruct /2 width=1 by or_introl/
-| #a #I #L #V #T #_ #HT #H destruct /2 width=1 by or_intror/
-| #a #L #V #W #T #H destruct
-| #a #L #V #W #T #H destruct
-]
-qed-.
-
-lemma crr_inv_ib2: ∀a,I,G,L,W,T. ib2 a I → ⦃G, L⦄ ⊢ ➡ 𝐑⦃ⓑ{a,I}W.T⦄ →
- ⦃G, L⦄ ⊢ ➡ 𝐑⦃W⦄ ∨ ⦃G, L.ⓑ{I}W⦄ ⊢ ➡ 𝐑⦃T⦄.
-/2 width=5 by crr_inv_ib2_aux/ qed-.
-
-fact crr_inv_appl_aux: ∀G,L,W,U,T. ⦃G, L⦄ ⊢ ➡ 𝐑⦃T⦄ → T = ⓐW.U →
- ∨∨ ⦃G, L⦄ ⊢ ➡ 𝐑⦃W⦄ | ⦃G, L⦄ ⊢ ➡ 𝐑⦃U⦄ | (𝐒⦃U⦄ → ⊥).
-#G #L #W0 #U #T * -L -T
-[ #L #K #V #i #_ #H destruct
-| #L #V #T #HV #H destruct /2 width=1 by or3_intro0/
-| #L #V #T #HT #H destruct /2 width=1 by or3_intro1/
-| #I #L #V #T #H1 #H2 destruct
- elim H1 -H1 #H destruct
-| #a #I #L #V #T #_ #_ #H destruct
-| #a #I #L #V #T #_ #_ #H destruct
-| #a #L #V #W #T #H destruct
- @or3_intro2 #H elim (simple_inv_bind … H)
-| #a #L #V #W #T #H destruct
- @or3_intro2 #H elim (simple_inv_bind … H)
-]
-qed-.
-
-lemma crr_inv_appl: ∀G,L,V,T. ⦃G, L⦄ ⊢ ➡ 𝐑⦃ⓐV.T⦄ →
- ∨∨ ⦃G, L⦄ ⊢ ➡ 𝐑⦃V⦄ | ⦃G, L⦄ ⊢ ➡ 𝐑⦃T⦄ | (𝐒⦃T⦄ → ⊥).
-/2 width=3 by crr_inv_appl_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/drop_drop.ma".
-include "basic_2/reduction/crr.ma".
-
-(* REDUCIBLE TERMS FOR CONTEXT-SENSITIVE REDUCTION **************************)
-
-(* Properties on relocation *************************************************)
-
-lemma crr_lift: ∀G,K,T. ⦃G, K⦄ ⊢ ➡ 𝐑⦃T⦄ → ∀L,c,l,k. ⬇[c, l, k] L ≡ K →
- ∀U. ⬆[l, k] T ≡ U → ⦃G, L⦄ ⊢ ➡ 𝐑⦃U⦄.
-#G #K #T #H elim H -K -T
-[ #K #K0 #V #i #HK0 #L #c #l #k #HLK #X #H
- elim (lift_inv_lref1 … H) -H * #Hil #H destruct
- [ elim (drop_trans_lt … HLK … HK0) -K /2 width=4 by crr_delta/
- | lapply (drop_trans_ge … HLK … HK0 ?) -K /3 width=4 by crr_delta, drop_inv_gen/
- ]
-| #K #V #T #_ #IHV #L #c #l #k #HLK #X #H
- elim (lift_inv_flat1 … H) -H #W #U #HVW #_ #H destruct /3 width=5 by crr_appl_sn/
-| #K #V #T #_ #IHT #L #c #l #k #HLK #X #H
- elim (lift_inv_flat1 … H) -H #W #U #_ #HTU #H destruct /3 width=5 by crr_appl_dx/
-| #I #K #V #T #HI #L #c #l #k #_ #X #H
- elim (lift_fwd_pair1 … H) -H #W #U #_ #H destruct /2 width=1 by crr_ri2/
-| #a #I #K #V #T #HI #_ #IHV #L #c #l #k #HLK #X #H
- elim (lift_inv_bind1 … H) -H #W #U #HVW #_ #H destruct /3 width=5 by crr_ib2_sn/
-| #a #I #K #V #T #HI #_ #IHT #L #c #l #k #HLK #X #H
- elim (lift_inv_bind1 … H) -H #W #U #HVW #HTU #H destruct /4 width=5 by crr_ib2_dx, drop_skip/
-| #a #K #V #V0 #T #L #c #l #k #_ #X #H
- elim (lift_inv_flat1 … H) -H #W #X0 #_ #H0 #H destruct
- elim (lift_inv_bind1 … H0) -H0 #W0 #U #_ #_ #H0 destruct /2 width=1 by crr_beta/
-| #a #K #V #V0 #T #L #c #l #k #_ #X #H
- elim (lift_inv_flat1 … H) -H #W #X0 #_ #H0 #H destruct
- elim (lift_inv_bind1 … H0) -H0 #W0 #U #_ #_ #H0 destruct /2 width=1 by crr_theta/
-]
-qed.
-
-lemma crr_inv_lift: ∀G,L,U. ⦃G, L⦄ ⊢ ➡ 𝐑⦃U⦄ → ∀K,c,l,k. ⬇[c, l, k] L ≡ K →
- ∀T. ⬆[l, k] T ≡ U → ⦃G, K⦄ ⊢ ➡ 𝐑⦃T⦄.
-#G #L #U #H elim H -L -U
-[ #L #L0 #W #i #HK0 #K #c #l #k #HLK #X #H
- elim (lift_inv_lref2 … H) -H * #Hil #H destruct
- [ elim (drop_conf_lt … HLK … HK0) -L /2 width=4 by crr_delta/
- | lapply (drop_conf_ge … HLK … HK0 ?) -L /2 width=4 by crr_delta/
- ]
-| #L #W #U #_ #IHW #K #c #l #k #HLK #X #H
- elim (lift_inv_flat2 … H) -H #V #T #HVW #_ #H destruct /3 width=5 by crr_appl_sn/
-| #L #W #U #_ #IHU #K #c #l #k #HLK #X #H
- elim (lift_inv_flat2 … H) -H #V #T #_ #HTU #H destruct /3 width=5 by crr_appl_dx/
-| #I #L #W #U #HI #K #c #l #k #_ #X #H
- elim (lift_fwd_pair2 … H) -H #V #T #_ #H destruct /2 width=1 by crr_ri2/
-| #a #I #L #W #U #HI #_ #IHW #K #c #l #k #HLK #X #H
- elim (lift_inv_bind2 … H) -H #V #T #HVW #_ #H destruct /3 width=5 by crr_ib2_sn/
-| #a #I #L #W #U #HI #_ #IHU #K #c #l #k #HLK #X #H
- elim (lift_inv_bind2 … H) -H #V #T #HVW #HTU #H destruct /4 width=5 by crr_ib2_dx, drop_skip/
-| #a #L #W #W0 #U #K #c #l #k #_ #X #H
- elim (lift_inv_flat2 … H) -H #V #X0 #_ #H0 #H destruct
- elim (lift_inv_bind2 … H0) -H0 #V0 #T #_ #_ #H0 destruct /2 width=1 by crr_beta/
-| #a #L #W #W0 #U #K #c #l #k #_ #X #H
- elim (lift_inv_flat2 … H) -H #V #X0 #_ #H0 #H destruct
- elim (lift_inv_bind2 … H0) -H0 #V0 #T #_ #_ #H0 destruct /2 width=1 by crr_theta/
-]
-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 *)
-(* *)
-(**************************************************************************)
-
-(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
-
-notation "hvbox( ⦃ term 46 G , break term 46 L ⦄ ⊢ ➡ 𝐑 break ⦃ term 46 T ⦄ )"
- non associative with precedence 45
- for @{ 'PRedReducible $G $L $T }.
+++ /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/predreducible_5.ma".
-include "basic_2/static/sd.ma".
-include "basic_2/reduction/crr.ma".
-
-(* REDUCIBLE TERMS FOR CONTEXT-SENSITIVE EXTENDED REDUCTION *****************)
-
-(* activate genv *)
-(* extended reducible terms *)
-inductive crx (h) (o) (G:genv): relation2 lenv term ≝
-| crx_sort : ∀L,s,d. deg h o s (d+1) → crx h o G L (⋆s)
-| crx_delta : ∀I,L,K,V,i. ⬇[i] L ≡ K.ⓑ{I}V → crx h o G L (#i)
-| crx_appl_sn: ∀L,V,T. crx h o G L V → crx h o G L (ⓐV.T)
-| crx_appl_dx: ∀L,V,T. crx h o G L T → crx h o G L (ⓐV.T)
-| crx_ri2 : ∀I,L,V,T. ri2 I → crx h o G L (②{I}V.T)
-| crx_ib2_sn : ∀a,I,L,V,T. ib2 a I → crx h o G L V → crx h o G L (ⓑ{a,I}V.T)
-| crx_ib2_dx : ∀a,I,L,V,T. ib2 a I → crx h o G (L.ⓑ{I}V) T → crx h o G L (ⓑ{a,I}V.T)
-| crx_beta : ∀a,L,V,W,T. crx h o G L (ⓐV. ⓛ{a}W.T)
-| crx_theta : ∀a,L,V,W,T. crx h o G L (ⓐV. ⓓ{a}W.T)
-.
-
-interpretation
- "reducibility for context-sensitive extended reduction (term)"
- 'PRedReducible h o G L T = (crx h o G L T).
-
-(* Basic properties *********************************************************)
-
-lemma crr_crx: ∀h,o,G,L,T. ⦃G, L⦄ ⊢ ➡ 𝐑⦃T⦄ → ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃T⦄.
-#h #o #G #L #T #H elim H -L -T
-/2 width=4 by crx_delta, crx_appl_sn, crx_appl_dx, crx_ri2, crx_ib2_sn, crx_ib2_dx, crx_beta, crx_theta/
-qed.
-
-(* Basic inversion lemmas ***************************************************)
-
-fact crx_inv_sort_aux: ∀h,o,G,L,T,s. ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃T⦄ → T = ⋆s →
- ∃d. deg h o s (d+1).
-#h #o #G #L #T #s0 * -L -T
-[ #L #s #d #Hkd #H destruct /2 width=2 by ex_intro/
-| #I #L #K #V #i #HLK #H destruct
-| #L #V #T #_ #H destruct
-| #L #V #T #_ #H destruct
-| #I #L #V #T #_ #H destruct
-| #a #I #L #V #T #_ #_ #H destruct
-| #a #I #L #V #T #_ #_ #H destruct
-| #a #L #V #W #T #H destruct
-| #a #L #V #W #T #H destruct
-]
-qed-.
-
-lemma crx_inv_sort: ∀h,o,G,L,s. ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃⋆s⦄ → ∃d. deg h o s (d+1).
-/2 width=5 by crx_inv_sort_aux/ qed-.
-
-fact crx_inv_lref_aux: ∀h,o,G,L,T,i. ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃T⦄ → T = #i →
- ∃∃I,K,V. ⬇[i] L ≡ K.ⓑ{I}V.
-#h #o #G #L #T #j * -L -T
-[ #L #s #d #_ #H destruct
-| #I #L #K #V #i #HLK #H destruct /2 width=4 by ex1_3_intro/
-| #L #V #T #_ #H destruct
-| #L #V #T #_ #H destruct
-| #I #L #V #T #_ #H destruct
-| #a #I #L #V #T #_ #_ #H destruct
-| #a #I #L #V #T #_ #_ #H destruct
-| #a #L #V #W #T #H destruct
-| #a #L #V #W #T #H destruct
-]
-qed-.
-
-lemma crx_inv_lref: ∀h,o,G,L,i. ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃#i⦄ → ∃∃I,K,V. ⬇[i] L ≡ K.ⓑ{I}V.
-/2 width=6 by crx_inv_lref_aux/ qed-.
-
-fact crx_inv_gref_aux: ∀h,o,G,L,T,p. ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃T⦄ → T = §p → ⊥.
-#h #o #G #L #T #q * -L -T
-[ #L #s #d #_ #H destruct
-| #I #L #K #V #i #HLK #H destruct
-| #L #V #T #_ #H destruct
-| #L #V #T #_ #H destruct
-| #I #L #V #T #_ #H destruct
-| #a #I #L #V #T #_ #_ #H destruct
-| #a #I #L #V #T #_ #_ #H destruct
-| #a #L #V #W #T #H destruct
-| #a #L #V #W #T #H destruct
-]
-qed-.
-
-lemma crx_inv_gref: ∀h,o,G,L,p. ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃§p⦄ → ⊥.
-/2 width=8 by crx_inv_gref_aux/ qed-.
-
-lemma trx_inv_atom: ∀h,o,I,G. ⦃G, ⋆⦄ ⊢ ➡[h, o] 𝐑⦃⓪{I}⦄ →
- ∃∃s,d. deg h o s (d+1) & I = Sort s.
-#h #o * #i #G #H
-[ elim (crx_inv_sort … H) -H /2 width=4 by ex2_2_intro/
-| elim (crx_inv_lref … H) -H #I #L #V #H
- elim (drop_inv_atom1 … H) -H #H destruct
-| elim (crx_inv_gref … H)
-]
-qed-.
-
-fact crx_inv_ib2_aux: ∀h,o,a,I,G,L,W,U,T. ib2 a I → ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃T⦄ →
- T = ⓑ{a,I}W.U → ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃W⦄ ∨ ⦃G, L.ⓑ{I}W⦄ ⊢ ➡[h, o] 𝐑⦃U⦄.
-#h #o #b #J #G #L #W0 #U #T #HI * -L -T
-[ #L #s #d #_ #H destruct
-| #I #L #K #V #i #_ #H destruct
-| #L #V #T #_ #H destruct
-| #L #V #T #_ #H destruct
-| #I #L #V #T #H1 #H2 destruct
- elim H1 -H1 #H destruct
- elim HI -HI #H destruct
-| #a #I #L #V #T #_ #HV #H destruct /2 width=1 by or_introl/
-| #a #I #L #V #T #_ #HT #H destruct /2 width=1 by or_intror/
-| #a #L #V #W #T #H destruct
-| #a #L #V #W #T #H destruct
-]
-qed-.
-
-lemma crx_inv_ib2: ∀h,o,a,I,G,L,W,T. ib2 a I → ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃ⓑ{a,I}W.T⦄ →
- ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃W⦄ ∨ ⦃G, L.ⓑ{I}W⦄ ⊢ ➡[h, o] 𝐑⦃T⦄.
-/2 width=5 by crx_inv_ib2_aux/ qed-.
-
-fact crx_inv_appl_aux: ∀h,o,G,L,W,U,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃T⦄ → T = ⓐW.U →
- ∨∨ ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃W⦄ | ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃U⦄ | (𝐒⦃U⦄ → ⊥).
-#h #o #G #L #W0 #U #T * -L -T
-[ #L #s #d #_ #H destruct
-| #I #L #K #V #i #_ #H destruct
-| #L #V #T #HV #H destruct /2 width=1 by or3_intro0/
-| #L #V #T #HT #H destruct /2 width=1 by or3_intro1/
-| #I #L #V #T #H1 #H2 destruct
- elim H1 -H1 #H destruct
-| #a #I #L #V #T #_ #_ #H destruct
-| #a #I #L #V #T #_ #_ #H destruct
-| #a #L #V #W #T #H destruct
- @or3_intro2 #H elim (simple_inv_bind … H)
-| #a #L #V #W #T #H destruct
- @or3_intro2 #H elim (simple_inv_bind … H)
-]
-qed-.
-
-lemma crx_inv_appl: ∀h,o,G,L,V,T. ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃ⓐV.T⦄ →
- ∨∨ ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃V⦄ | ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃T⦄ | (𝐒⦃T⦄ → ⊥).
-/2 width=3 by crx_inv_appl_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/drop_drop.ma".
-include "basic_2/reduction/crx.ma".
-
-(* REDUCIBLE TERMS FOR CONTEXT-SENSITIVE EXTENDED REDUCTION *****************)
-
-(* Properties on relocation *************************************************)
-
-lemma crx_lift: ∀h,o,G,K,T. ⦃G, K⦄ ⊢ ➡[h, o] 𝐑⦃T⦄ → ∀L,c,l,k. ⬇[c, l, k] L ≡ K →
- ∀U. ⬆[l, k] T ≡ U → ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃U⦄.
-#h #o #G #K #T #H elim H -K -T
-[ #K #s #d #Hkd #L #c #l #k #_ #X #H
- >(lift_inv_sort1 … H) -X /2 width=2 by crx_sort/
-| #I #K #K0 #V #i #HK0 #L #c #l #k #HLK #X #H
- elim (lift_inv_lref1 … H) -H * #Hil #H destruct
- [ elim (drop_trans_lt … HLK … HK0) -K /2 width=4 by crx_delta/
- | lapply (drop_trans_ge … HLK … HK0 ?) -K /3 width=5 by crx_delta, drop_inv_gen/
- ]
-| #K #V #T #_ #IHV #L #c #l #k #HLK #X #H
- elim (lift_inv_flat1 … H) -H #W #U #HVW #_ #H destruct /3 width=5 by crx_appl_sn/
-| #K #V #T #_ #IHT #L #c #l #k #HLK #X #H
- elim (lift_inv_flat1 … H) -H #W #U #_ #HTU #H destruct /3 width=5 by crx_appl_dx/
-| #I #K #V #T #HI #L #c #l #k #_ #X #H
- elim (lift_fwd_pair1 … H) -H #W #U #_ #H destruct /2 width=1 by crx_ri2/
-| #a #I #K #V #T #HI #_ #IHV #L #c #l #k #HLK #X #H
- elim (lift_inv_bind1 … H) -H #W #U #HVW #_ #H destruct /3 width=5 by crx_ib2_sn/
-| #a #I #K #V #T #HI #_ #IHT #L #c #l #k #HLK #X #H
- elim (lift_inv_bind1 … H) -H #W #U #HVW #HTU #H destruct /4 width=5 by crx_ib2_dx, drop_skip/
-| #a #K #V #V0 #T #L #c #l #k #_ #X #H
- elim (lift_inv_flat1 … H) -H #W #X0 #_ #H0 #H destruct
- elim (lift_inv_bind1 … H0) -H0 #W0 #U #_ #_ #H0 destruct /2 width=1 by crx_beta/
-| #a #K #V #V0 #T #L #c #l #k #_ #X #H
- elim (lift_inv_flat1 … H) -H #W #X0 #_ #H0 #H destruct
- elim (lift_inv_bind1 … H0) -H0 #W0 #U #_ #_ #H0 destruct /2 width=1 by crx_theta/
-]
-qed.
-
-lemma crx_inv_lift: ∀h,o,G,L,U. ⦃G, L⦄ ⊢ ➡[h, o] 𝐑⦃U⦄ → ∀K,c,l,k. ⬇[c, l, k] L ≡ K →
- ∀T. ⬆[l, k] T ≡ U → ⦃G, K⦄ ⊢ ➡[h, o] 𝐑⦃T⦄.
-#h #o #G #L #U #H elim H -L -U
-[ #L #s #d #Hkd #K #c #l #k #_ #X #H
- >(lift_inv_sort2 … H) -X /2 width=2 by crx_sort/
-| #I #L #L0 #W #i #HK0 #K #c #l #k #HLK #X #H
- elim (lift_inv_lref2 … H) -H * #Hil #H destruct
- [ elim (drop_conf_lt … HLK … HK0) -L /2 width=4 by crx_delta/
- | lapply (drop_conf_ge … HLK … HK0 ?) -L /2 width=4 by crx_delta/
- ]
-| #L #W #U #_ #IHW #K #c #l #k #HLK #X #H
- elim (lift_inv_flat2 … H) -H #V #T #HVW #_ #H destruct /3 width=5 by crx_appl_sn/
-| #L #W #U #_ #IHU #K #c #l #k #HLK #X #H
- elim (lift_inv_flat2 … H) -H #V #T #_ #HTU #H destruct /3 width=5 by crx_appl_dx/
-| #I #L #W #U #HI #K #c #l #k #_ #X #H
- elim (lift_fwd_pair2 … H) -H #V #T #_ #H destruct /2 width=1 by crx_ri2/
-| #a #I #L #W #U #HI #_ #IHW #K #c #l #k #HLK #X #H
- elim (lift_inv_bind2 … H) -H #V #T #HVW #_ #H destruct /3 width=5 by crx_ib2_sn/
-| #a #I #L #W #U #HI #_ #IHU #K #c #l #k #HLK #X #H
- elim (lift_inv_bind2 … H) -H #V #T #HVW #HTU #H destruct /4 width=5 by crx_ib2_dx, drop_skip/
-| #a #L #W #W0 #U #K #c #l #k #_ #X #H
- elim (lift_inv_flat2 … H) -H #V #X0 #_ #H0 #H destruct
- elim (lift_inv_bind2 … H0) -H0 #V0 #T #_ #_ #H0 destruct /2 width=1 by crx_beta/
-| #a #L #W #W0 #U #K #c #l #k #_ #X #H
- elim (lift_inv_flat2 … H) -H #V #X0 #_ #H0 #H destruct
- elim (lift_inv_bind2 … H0) -H0 #V0 #T #_ #_ #H0 destruct /2 width=1 by crx_theta/
-]
-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 *)
-(* *)
-(**************************************************************************)
-
-(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
-
-notation "hvbox( ⦃ term 46 G, break term 46 L ⦄ ⊢ ➡ break [ term 46 o , break term 46 h ] 𝐑 break ⦃ term 46 T ⦄ )"
- non associative with precedence 45
- for @{ 'PRedReducible $h $o $G $L $T }.
+++ /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/degree_6.ma".
-include "basic_2/grammar/genv.ma".
-include "basic_2/substitution/drop.ma".
-include "basic_2/static/sd.ma".
-
-(* DEGREE ASSIGNMENT FOR TERMS **********************************************)
-
-(* activate genv *)
-inductive da (h:sh) (o:sd h): relation4 genv lenv term nat ≝
-| da_sort: ∀G,L,s,d. deg h o s d → da h o G L (⋆s) d
-| da_ldef: ∀G,L,K,V,i,d. ⬇[i] L ≡ K.ⓓV → da h o G K V d → da h o G L (#i) d
-| da_ldec: ∀G,L,K,W,i,d. ⬇[i] L ≡ K.ⓛW → da h o G K W d → da h o G L (#i) (d+1)
-| da_bind: ∀a,I,G,L,V,T,d. da h o G (L.ⓑ{I}V) T d → da h o G L (ⓑ{a,I}V.T) d
-| da_flat: ∀I,G,L,V,T,d. da h o G L T d → da h o G L (ⓕ{I}V.T) d
-.
-
-interpretation "degree assignment (term)"
- 'Degree h o G L T d = (da h o G L T d).
-
-(* Basic inversion lemmas ***************************************************)
-
-fact da_inv_sort_aux: ∀h,o,G,L,T,d. ⦃G, L⦄ ⊢ T ▪[h, o] d →
- ∀s0. T = ⋆s0 → deg h o s0 d.
-#h #o #G #L #T #d * -G -L -T -d
-[ #G #L #s #d #Hkd #s0 #H destruct //
-| #G #L #K #V #i #d #_ #_ #s0 #H destruct
-| #G #L #K #W #i #d #_ #_ #s0 #H destruct
-| #a #I #G #L #V #T #d #_ #s0 #H destruct
-| #I #G #L #V #T #d #_ #s0 #H destruct
-]
-qed-.
-
-lemma da_inv_sort: ∀h,o,G,L,s,d. ⦃G, L⦄ ⊢ ⋆s ▪[h, o] d → deg h o s d.
-/2 width=5 by da_inv_sort_aux/ qed-.
-
-fact da_inv_lref_aux: ∀h,o,G,L,T,d. ⦃G, L⦄ ⊢ T ▪[h, o] d → ∀j. T = #j →
- (∃∃K,V. ⬇[j] L ≡ K.ⓓV & ⦃G, K⦄ ⊢ V ▪[h, o] d) ∨
- (∃∃K,W,d0. ⬇[j] L ≡ K.ⓛW & ⦃G, K⦄ ⊢ W ▪[h, o] d0 &
- d = d0 + 1
- ).
-#h #o #G #L #T #d * -G -L -T -d
-[ #G #L #s #d #_ #j #H destruct
-| #G #L #K #V #i #d #HLK #HV #j #H destruct /3 width=4 by ex2_2_intro, or_introl/
-| #G #L #K #W #i #d #HLK #HW #j #H destruct /3 width=6 by ex3_3_intro, or_intror/
-| #a #I #G #L #V #T #d #_ #j #H destruct
-| #I #G #L #V #T #d #_ #j #H destruct
-]
-qed-.
-
-lemma da_inv_lref: ∀h,o,G,L,j,d. ⦃G, L⦄ ⊢ #j ▪[h, o] d →
- (∃∃K,V. ⬇[j] L ≡ K.ⓓV & ⦃G, K⦄ ⊢ V ▪[h, o] d) ∨
- (∃∃K,W,d0. ⬇[j] L ≡ K.ⓛW & ⦃G, K⦄ ⊢ W ▪[h, o] d0 & d = d0+1).
-/2 width=3 by da_inv_lref_aux/ qed-.
-
-fact da_inv_gref_aux: ∀h,o,G,L,T,d. ⦃G, L⦄ ⊢ T ▪[h, o] d → ∀p0. T = §p0 → ⊥.
-#h #o #G #L #T #d * -G -L -T -d
-[ #G #L #s #d #_ #p0 #H destruct
-| #G #L #K #V #i #d #_ #_ #p0 #H destruct
-| #G #L #K #W #i #d #_ #_ #p0 #H destruct
-| #a #I #G #L #V #T #d #_ #p0 #H destruct
-| #I #G #L #V #T #d #_ #p0 #H destruct
-]
-qed-.
-
-lemma da_inv_gref: ∀h,o,G,L,p,d. ⦃G, L⦄ ⊢ §p ▪[h, o] d → ⊥.
-/2 width=9 by da_inv_gref_aux/ qed-.
-
-fact da_inv_bind_aux: ∀h,o,G,L,T,d. ⦃G, L⦄ ⊢ T ▪[h, o] d →
- ∀b,J,X,Y. T = ⓑ{b,J}Y.X → ⦃G, L.ⓑ{J}Y⦄ ⊢ X ▪[h, o] d.
-#h #o #G #L #T #d * -G -L -T -d
-[ #G #L #s #d #_ #b #J #X #Y #H destruct
-| #G #L #K #V #i #d #_ #_ #b #J #X #Y #H destruct
-| #G #L #K #W #i #d #_ #_ #b #J #X #Y #H destruct
-| #a #I #G #L #V #T #d #HT #b #J #X #Y #H destruct //
-| #I #G #L #V #T #d #_ #b #J #X #Y #H destruct
-]
-qed-.
-
-lemma da_inv_bind: ∀h,o,b,J,G,L,Y,X,d. ⦃G, L⦄ ⊢ ⓑ{b,J}Y.X ▪[h, o] d → ⦃G, L.ⓑ{J}Y⦄ ⊢ X ▪[h, o] d.
-/2 width=4 by da_inv_bind_aux/ qed-.
-
-fact da_inv_flat_aux: ∀h,o,G,L,T,d. ⦃G, L⦄ ⊢ T ▪[h, o] d →
- ∀J,X,Y. T = ⓕ{J}Y.X → ⦃G, L⦄ ⊢ X ▪[h, o] d.
-#h #o #G #L #T #d * -G -L -T -d
-[ #G #L #s #d #_ #J #X #Y #H destruct
-| #G #L #K #V #i #d #_ #_ #J #X #Y #H destruct
-| #G #L #K #W #i #d #_ #_ #J #X #Y #H destruct
-| #a #I #G #L #V #T #d #_ #J #X #Y #H destruct
-| #I #G #L #V #T #d #HT #J #X #Y #H destruct //
-]
-qed-.
-
-lemma da_inv_flat: ∀h,o,J,G,L,Y,X,d. ⦃G, L⦄ ⊢ ⓕ{J}Y.X ▪[h, o] d → ⦃G, L⦄ ⊢ X ▪[h, o] d.
-/2 width=5 by da_inv_flat_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/static/aaa_lift.ma".
-include "basic_2/static/da.ma".
-
-(* DEGREE ASSIGNMENT FOR TERMS **********************************************)
-
-(* Properties on atomic arity assignment for terms **************************)
-
-lemma aaa_da: ∀h,o,G,L,T,A. ⦃G, L⦄ ⊢ T ⁝ A → ∃d. ⦃G, L⦄ ⊢ T ▪[h, o] d.
-#h #o #G #L #T #A #H elim H -G -L -T -A
-[ #G #L #s elim (deg_total h o s) /3 width=2 by da_sort, ex_intro/
-| * #G #L #K #V #B #i #HLK #_ * /3 width=5 by da_ldef, da_ldec, ex_intro/
-| #a #G #L #V #T #B #A #_ #_ #_ * /3 width=2 by da_bind, ex_intro/
-| #a #G #L #V #T #B #A #_ #_ #_ * /3 width=2 by da_bind, ex_intro/
-| #G #L #V #T #B #A #_ #_ #_ * /3 width=2 by da_flat, ex_intro/
-| #G #L #W #T #A #_ #_ #_ * /3 width=2 by da_flat, 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/static/da_lift.ma".
-
-(* DEGREE ASSIGNMENT FOR TERMS **********************************************)
-
-(* Main properties **********************************************************)
-
-theorem da_mono: ∀h,o,G,L,T,d1. ⦃G, L⦄ ⊢ T ▪[h, o] d1 →
- ∀d2. ⦃G, L⦄ ⊢ T ▪[h, o] d2 → d1 = d2.
-#h #o #G #L #T #d1 #H elim H -G -L -T -d1
-[ #G #L #s #d1 #Hkd1 #d2 #H
- lapply (da_inv_sort … H) -G -L #Hkd2
- >(deg_mono … Hkd2 … Hkd1) -h -s -d2 //
-| #G #L #K #V #i #d1 #HLK #_ #IHV #d2 #H
- elim (da_inv_lref … H) -H * #K0 #V0 [| #d0 ] #HLK0 #HV0 [| #Hd0 ]
- lapply (drop_mono … HLK0 … HLK) -HLK -HLK0 #H destruct /2 width=1 by/
-| #G #L #K #W #i #d1 #HLK #_ #IHW #d2 #H
- elim (da_inv_lref … H) -H * #K0 #W0 [| #d0 ] #HLK0 #HW0 [| #Hd0 ]
- lapply (drop_mono … HLK0 … HLK) -HLK -HLK0 #H destruct /3 width=1 by eq_f/
-| #a #I #G #L #V #T #d1 #_ #IHT #d2 #H
- lapply (da_inv_bind … H) -H /2 width=1 by/
-| #I #G #L #V #T #d1 #_ #IHT #d2 #H
- lapply (da_inv_flat … H) -H /2 width=1 by/
-]
-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/static/da.ma".
-
-(* DEGREE ASSIGNMENT FOR TERMS **********************************************)
-
-(* Properties on relocation *************************************************)
-
-lemma da_lift: ∀h,o,G,L1,T1,d. ⦃G, L1⦄ ⊢ T1 ▪[h, o] d →
- ∀L2,c,l,k. ⬇[c, l, k] L2 ≡ L1 → ∀T2. ⬆[l, k] T1 ≡ T2 →
- ⦃G, L2⦄ ⊢ T2 ▪[h, o] d.
-#h #o #G #L1 #T1 #d #H elim H -G -L1 -T1 -d
-[ #G #L1 #s #d #Hkd #L2 #c #l #k #_ #X #H
- >(lift_inv_sort1 … H) -X /2 width=1 by da_sort/
-| #G #L1 #K1 #V1 #i #d #HLK1 #_ #IHV1 #L2 #c #l #k #HL21 #X #H
- elim (lift_inv_lref1 … H) * #Hil #H destruct
- [ elim (drop_trans_le … HL21 … HLK1) -L1 /2 width=2 by ylt_fwd_le/ #X #HLK2 #H
- elim (drop_inv_skip2 … H) -H /2 width=1 by ylt_to_minus/ -Hil #K2 #V2 #HK21 #HV12 #H destruct
- /3 width=9 by da_ldef/
- | lapply (drop_trans_ge … HL21 … HLK1 ?) -L1
- /3 width=8 by da_ldef, drop_inv_gen/
- ]
-| #G #L1 #K1 #W1 #i #d #HLK1 #_ #IHW1 #L2 #c #l #k #HL21 #X #H
- elim (lift_inv_lref1 … H) * #Hil #H destruct
- [ elim (drop_trans_le … HL21 … HLK1) -L1 /2 width=2 by ylt_fwd_le/ #X #HLK2 #H
- elim (drop_inv_skip2 … H) -H /2 width=1 by ylt_to_minus/ -Hil #K2 #W2 #HK21 #HW12 #H destruct
- /3 width=8 by da_ldec/
- | lapply (drop_trans_ge … HL21 … HLK1 ?) -L1
- /3 width=8 by da_ldec, drop_inv_gen/
- ]
-| #a #I #G #L1 #V1 #T1 #d #_ #IHT1 #L2 #c #l #k #HL21 #X #H
- elim (lift_inv_bind1 … H) -H #V2 #T2 #HV12 #HU12 #H destruct
- /4 width=5 by da_bind, drop_skip/
-| #I #G #L1 #V1 #T1 #d #_ #IHT1 #L2 #c #l #k #HL21 #X #H
- elim (lift_inv_flat1 … H) -H #V2 #T2 #HV12 #HU12 #H destruct
- /3 width=5 by da_flat/
-]
-qed.
-
-(* Inversion lemmas on relocation *******************************************)
-
-lemma da_inv_lift: ∀h,o,G,L2,T2,d. ⦃G, L2⦄ ⊢ T2 ▪[h, o] d →
- ∀L1,c,l,k. ⬇[c, l, k] L2 ≡ L1 → ∀T1. ⬆[l, k] T1 ≡ T2 →
- ⦃G, L1⦄ ⊢ T1 ▪[h, o] d.
-#h #o #G #L2 #T2 #d #H elim H -G -L2 -T2 -d
-[ #G #L2 #s #d #Hkd #L1 #c #l #k #_ #X #H
- >(lift_inv_sort2 … H) -X /2 width=1 by da_sort/
-| #G #L2 #K2 #V2 #i #d #HLK2 #HV2 #IHV2 #L1 #c #l #k #HL21 #X #H
- elim (lift_inv_lref2 … H) * #Hil #H destruct [ -HV2 | -IHV2 ]
- [ elim (drop_conf_lt … HL21 … HLK2) -L2 /3 width=8 by da_ldef/
- | lapply (drop_conf_ge … HL21 … HLK2 ?) -L2 /2 width=4 by da_ldef/
- ]
-| #G #L2 #K2 #W2 #i #d #HLK2 #HW2 #IHW2 #L1 #c #l #k #HL21 #X #H
- elim (lift_inv_lref2 … H) * #Hil #H destruct [ -HW2 | -IHW2 ]
- [ elim (drop_conf_lt … HL21 … HLK2) -L2 /3 width=8 by da_ldec/
- | lapply (drop_conf_ge … HL21 … HLK2 ?) -L2 /2 width=4 by da_ldec/
- ]
-| #a #I #G #L2 #V2 #T2 #d #_ #IHT2 #L1 #c #l #k #HL21 #X #H
- elim (lift_inv_bind2 … H) -H #V1 #T1 #HV12 #HT12 #H destruct
- /4 width=5 by da_bind, drop_skip/
-| #I #G #L2 #V2 #T2 #d #_ #IHT2 #L1 #c #l #k #HL21 #X #H
- elim (lift_inv_flat2 … H) -H #V1 #T1 #HV12 #HT12 #H destruct
- /3 width=5 by da_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 *)
-(* *)
-(**************************************************************************)
-
-(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
-
-notation "hvbox( ⦃ term 46 G , break term 46 L ⦄ ⊢ break term 46 T ▪ break [ term 46 o , break term 46 h ] break term 46 d )"
- non associative with precedence 45
- for @{ 'Degree $h $o $G $L $T $d }.
+++ /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 *)
-(* *)
-(**************************************************************************)
-
-(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
-
-notation "hvbox( ⫱ * [ term 46 L , break term 46 K ] term 46 f )"
- non associative with precedence 46
- for @{ 'DropPreds $L $K $f }.
+++ /dev/null
-lemma drop_inv_refl: ∀L,l,m. ⬇[Ⓕ, l, m] L ≡ L → m = 0.
-/2 width=5 by drop_inv_length_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/grammar/lenv_append.ma".
-include "basic_2/substitution/drop.ma".
-
-(* DROPPING *****************************************************************)
-
-(* Properties on append for local environments ******************************)
-
-fact drop_O1_append_sn_le_aux: ∀L1,L2,s,l,m. ⬇[s, l, m] L1 ≡ L2 →
- l = 0 → m ≤ |L1| →
- ∀L. ⬇[s, 0, m] L @@ L1 ≡ L @@ L2.
-#L1 #L2 #s #l #m #H elim H -L1 -L2 -l -m //
-[ #l #m #_ #_ #H >(yle_inv_O2 … H) -m //
-| /4 width=1 by drop_drop, yle_inv_succ/
-| #I #L1 #L2 #V1 #V2 #l #m #_ #_ #_ #H elim (ysucc_inv_O_dx … H)
-]
-qed-.
-
-lemma drop_O1_append_sn_le: ∀L1,L2,s,m. ⬇[s, yinj 0, m] L1 ≡ L2 → m ≤ |L1| →
- ∀L. ⬇[s, 0, m] L @@ L1 ≡ L @@ L2.
-/2 width=3 by drop_O1_append_sn_le_aux/ qed.
-
-(* Inversion lemmas on append for local environments ************************)
-
-lemma drop_O1_inv_append1_ge: ∀K,L1,L2,s,m. ⬇[s, 0, m] L1 @@ L2 ≡ K →
- ∀m0. |L2| + m0 = m → ⬇[s, 0, m0] L1 ≡ K.
-#K #L1 #L2 elim L2 -L2
-[ #s #m #H #m0 >yplus_O1 #H0 destruct //
-| #L2 #I #V #IHL2 #s #m #H #m0 >yplus_succ1
- #H0 elim (drop_inv_O1_pair1 … H) -H * #Hm #HL12 destruct
- [ elim (ysucc_inv_O_dx … Hm)
- | /2 width=3 by/
- ]
-]
-qed-.
-
-lemma drop_O1_inv_append1_le: ∀K,L1,L2,s,m. ⬇[s, 0, m] L1 @@ L2 ≡ K → m ≤ |L2| →
- ∀K2. ⬇[s, 0, m] L2 ≡ K2 → K = L1 @@ K2.
-#K #L1 #L2 elim L2 -L2
-[ #s #m #H1 #H2 #K2 #H3 lapply (yle_inv_O2 … H2) -H2
- #H2 elim (drop_inv_atom1 … H3) -H3 #H3 #_ destruct
- >(drop_inv_O2 … H1) -H1 //
-| #L2 #I #V #IHL2 #s #m @(ynat_ind … m) -m [ -IHL2 || -IHL2 ]
- [ #H1 #_ #K2 #H2
- lapply (drop_inv_O2 … H1) -H1 #H1
- lapply (drop_inv_O2 … H2) -H2 #H2 destruct //
- | /3 width=7 by drop_inv_drop1, yle_inv_succ/
- | #_ #H lapply (yle_inv_Y1 … H) -H
- #H elim (ylt_yle_false (|L2.ⓑ{I}V|) (∞)) //
- ]
-]
-qed-.
+++ /dev/null
-(* Inversion lemmas on equivalence ******************************************)
-
-lemma drop_O1_inj: ∀i,L1,L2,K. ⬇[i] L1 ≡ K → ⬇[i] L2 ≡ K → L1 ⩬[i, ∞] L2.
-#i @(ynat_ind … i) -i
-[ #L1 #L2 #K #H <(drop_inv_O2 … H) -K #H <(drop_inv_O2 … H) -L1 //
-| #i #IHi * [2: #L1 #I1 #V1 ] * [2,4: #L2 #I2 #V2 ] #K #HLK1 #HLK2 //
- lapply (drop_fwd_length … HLK1)
- <(drop_fwd_length … HLK2) [ /4 width=5 by drop_inv_drop1, lreq_succ/ ]
- #H [ elim (ysucc_inv_O_sn … H) | elim (ysucc_inv_O_dx … H) ]
-| #L1 #L2 #K #H1 lapply (drop_fwd_Y2 … H1) -H1
- #H elim (ylt_yle_false … H) //
-]
-qed-.
+++ /dev/null
-lemma drop_inv_O1_gt: ∀L,K,m,s. ⬇[s, 0, m] L ≡ K → |L| < m →
- s = Ⓣ ∧ K = ⋆.
-#L elim L -L [| #L #Z #X #IHL ] #K #m #s #H normalize in ⊢ (?%?→?); #H1m
-[ elim (drop_inv_atom1 … H) -H elim s -s /2 width=1 by conj/
- #_ #Hs lapply (Hs ?) // -Hs #H destruct elim (ylt_yle_false … H1m) -H1m //
-| elim (drop_inv_O1_pair1 … H) -H * #H2m #HLK destruct
- [ elim (ylt_yle_false … H1m) -H1m //
- | elim (IHL … HLK) -IHL -HLK /2 width=1 by ylt_pred, conj/
- ]
-]
-qed-.
-
-lemma drop_O1_le: ∀s,m,L. m ≤ |L| → ∃K. ⬇[s, 0, m] L ≡ K.
-#s #m @(ynat_ind … m) -m /2 width=2 by ex_intro/
-[ #m #IHm *
- [ #H elim (ylt_yle_false … H) -H //
- | #L #I #V #H elim (IHm L) -IHm /3 width=2 by drop_drop, yle_inv_succ, ex_intro/
- ]
-| #L #H elim (ylt_yle_false … H) -H //
-]
-qed-.
-
-lemma drop_O1_lt: ∀s,L,m. m < |L| → ∃∃I,K,V. ⬇[s, 0, m] L ≡ K.ⓑ{I}V.
-#s #L elim L -L
-[ #m #H elim (ylt_yle_false … H) -H //
-| #L #I #V #IHL #m @(ynat_ind … m) -m /2 width=4 by drop_pair, ex1_3_intro/
- [ #m #_#H elim (IHL m) -IHL /3 width=4 by drop_drop, ylt_inv_succ, ex1_3_intro/
- | #H elim (ylt_yle_false … H) -H //
- ]
-]
-qed-.
-
-lemma drop_O1_pair: ∀L,K,m,s. ⬇[s, 0, m] L ≡ K → m ≤ |L| → ∀I,V.
- ∃∃J,W. ⬇[s, 0, m] L.ⓑ{I}V ≡ K.ⓑ{J}W.
-#L elim L -L [| #L #Z #X #IHL ] #K #m #s #H #Hm #I #V
-[ elim (drop_inv_atom1 … H) -H #H >(yle_inv_O2 … Hm) -m
- #Hs destruct /2 width=3 by ex1_2_intro/
-| elim (drop_inv_O1_pair1 … H) -H * #Hm #HLK destruct /2 width=3 by ex1_2_intro/
- elim (IHL … HLK … Z X) -IHL -HLK
- /3 width=3 by yle_pred, drop_drop_lt, ex1_2_intro/
-]
-qed-.
-
-lemma drop_O1_ge: ∀L,m. |L| ≤ m → ⬇[Ⓣ, 0, m] L ≡ ⋆.
-#L elim L -L [ #m #_ @drop_atom #H destruct ]
-#L #I #V #IHL #m @(ynat_ind … m) -m //
-[ #H elim (ylt_yle_false … H) -H /2 width=1 by ylt_inj/
-| /4 width=1 by drop_drop, yle_inv_succ/
-]
-qed.
-
-lemma drop_O1_eq: ∀L,s. ⬇[s, 0, |L|] L ≡ ⋆.
-#L elim L -L /2 width=1 by drop_drop/
-qed.
-
-lemma drop_fwd_length_ge: ∀L1,L2,l,m,s. ⬇[s, l, m] L1 ≡ L2 → |L1| ≤ l → |L2| = |L1|.
-#L1 #L2 #l #m #s #H elim H -L1 -L2 -l -m //
-[ #I #L1 #L2 #V #m #_ #_ #H elim (ylt_yle_false … H) -H //
-| #I #L1 #L2 #V1 #V2 #l #m #_ #_ #IH #H
- lapply (yle_inv_succ … H) -H #H
- >length_pair >length_pair /3 width=1 by eq_f/
-]
-qed-.
-
-lemma drop_fwd_length_le_le: ∀L1,L2,l,m,s. ⬇[s, l, m] L1 ≡ L2 →
- ∀l0. l + m + l0 = |L1| → |L2| = l + l0.
-#L1 #L2 #l #m #s #H elim H -L1 -L2 -l -m //
-[ #l #m #Hm #l0 #H elim (yplus_inv_O … H) -H
- #H #H0 elim (yplus_inv_O … H) -H
- #H1 #_ destruct //
-| #I #L1 #L2 #V #m #_ >yplus_O1 >yplus_O1 #IH #l0
- /3 width=1 by ysucc_inv_inj/
-| #I #L1 #L2 #V1 #V2 #l #m #_ #_ #IHL12 #l0 >yplus_succ1 >yplus_succ1 #H
- lapply (ysucc_inv_inj … H) -H #Hl1
- >yplus_succ1 /3 width=1 by eq_f/
-]
-qed-.
-
-lemma drop_fwd_length_le_ge: ∀L1,L2,l,m,s. ⬇[s, l, m] L1 ≡ L2 → l ≤ |L1| → |L1| ≤ l + m → |L2| = l.
-#L1 #L2 #l #m #s #H elim H -L1 -L2 -l -m
-[ #l #m #_ #H #_ /2 width=1 by yle_inv_O2/
-| #I #L #V #_ #H elim (ylt_yle_false … H) -H //
-| #I #L1 #L2 #V #m #_ >yplus_O1 >yplus_O1
- /3 width=1 by yle_inv_succ/
-| #I #L1 #L2 #V1 #v2 #l #m #_ #_ #IH
- >yplus_SO2 >yplus_SO2
- /4 width=1 by yle_inv_succ, eq_f/
-]
-qed-.
-
-lemma drop_fwd_be: ∀L,K,s,l,m,i. ⬇[s, l, m] L ≡ K → |K| ≤ i → i < l → |L| ≤ i.
-#L #K #s #l #m #i #HLK #HK #Hl elim (ylt_split i (|L|)) //
-#HL elim (drop_O1_lt (Ⓕ) … HL) #I #K0 #V #HLK0 -HL
-elim (ylt_inv_plus_sn … Hl) -Hl #l0 #H0
-elim (drop_conf_lt … HLK … HLK0 … H0) -HLK -HLK0 -H0
-#K1 #V1 #HK1 #_ #_ lapply (drop_fwd_length_lt2 … HK1) -I -K1 -V1
-#H elim (ylt_yle_false … H) -H //
-qed-.
-
-lemma drop_O1_ex: ∀K2,i,L1. |L1| = |K2| + i →
- ∃∃L2. L1 ⩬[0, i] L2 & ⬇[i] L2 ≡ K2.
-#K2 #i @(ynat_ind … i) -i
-[ /3 width=3 by lreq_O2, ex2_intro/
-| #i #IHi #Y >yplus_succ2 #Hi
- elim (drop_O1_lt (Ⓕ) Y 0) [2: >Hi // ]
- #I #L1 #V #H lapply (drop_inv_O2 … H) -H #H destruct
- >length_pair in Hi; #H lapply (ysucc_inv_inj … H) -H
- #HL1K2 elim (IHi L1) -IHi // -HL1K2
- /3 width=5 by lreq_pair, drop_drop, ex2_intro/
-| #L1 >yplus_Y2 #H elim (ylt_yle_false (|L1|) (∞)) //
-]
-qed-.
+++ /dev/null
-(* Removed theorems *********************************************************)
-
-include "basic_2/substitution/drop.ma".
-
-| fqu_drop : ∀G,L,K,T,U,k.
- ⬇[⫯k] L ≡ K → ⬆[0, ⫯k] T ≡ U → fqu G L U G K T
-
-lemma fqu_drop_lt: ∀G,L,K,T,U,k. 0 < k →
- ⬇[k] L ≡ K → ⬆[0, k] T ≡ U → ⦃G, L, U⦄ ⊐ ⦃G, K, T⦄.
-#G #L #K #T #U #k #Hm lapply (ylt_inv_O1 … Hm) -Hm
-#Hm <Hm -Hm /2 width=3 by fqu_drop/
-qed.
-
-lemma fqu_lref_S_lt: ∀I,G,L,V,i. yinj 0 < i → ⦃G, L.ⓑ{I}V, #i⦄ ⊐ ⦃G, L, #(⫰i)⦄.
-/4 width=3 by drop_drop, lift_lref_pred, fqu_drop/
-qed.
+++ /dev/null
-(* Removed theorems *********************************************************)
-
-lemma fquqa_drop: ∀G,L,K,T,U,k.
- ⬇[k] L ≡ K → ⬆[0, k] T ≡ U → ⦃G, L, U⦄ ⊐⊐⸮ ⦃G, K, T⦄.
-#G #L #K #T #U #k @(ynat_ind … k) -k /3 width=3 by fqu_drop, or_introl/
-#HLK #HTU >(drop_inv_O2 … HLK) -L >(lift_inv_O2 … HTU) -T //
-qed.
-
-inductive fquq: tri_relation genv lenv term ≝
-| fquq_lref_O : ∀I,G,L,V. fquq G (L.ⓑ{I}V) (#0) G L V
-| fquq_pair_sn: ∀I,G,L,V,T. fquq G L (②{I}V.T) G L V
-| fquq_bind_dx: ∀a,I,G,L,V,T. fquq G L (ⓑ{a,I}V.T) G (L.ⓑ{I}V) T
-| fquq_flat_dx: ∀I,G, L,V,T. fquq G L (ⓕ{I}V.T) G L T
-| fquq_drop : ∀G,L,K,T,U,k.
- ⬇[k] L ≡ K → ⬆[0, k] T ≡ U → fquq G L U G K T
-.
+++ /dev/null
-(* A Basic_A2 lemma we do not need so far *)
-axiom frees_pair_flat: ∀L,T,f1,I1,V1. L.ⓑ{I1}V1 ⊢ 𝐅*⦃T⦄ ≡ f1 →
- ∀f2,I2,V2. L.ⓑ{I2}V2 ⊢ 𝐅*⦃T⦄ ≡ f2 →
- ∀f0. f1 ⋓ f2 ≡ f0 →
- ∀I0,I. L.ⓑ{I0}ⓕ{I}V1.V2 ⊢ 𝐅*⦃T⦄ ≡ f0.
+++ /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_append.ma".
-include "basic_2/multiple/frees.ma".
-
-(* CONTEXT-SENSITIVE FREE VARIABLES *****************************************)
-
-(* Properties on append for local environments ******************************)
-
-lemma frees_append: ∀L2,U,l,i. L2 ⊢ i ϵ 𝐅*[l]⦃U⦄ → i ≤ |L2| →
- ∀L1. L1 @@ L2 ⊢ i ϵ 𝐅*[l]⦃U⦄.
-#L2 #U #l #i #H elim H -L2 -U -l -i /3 width=2 by frees_eq/
-#I #L2 #K2 #U #W #l #i #j #Hlj #Hji #HnU #HLK2 #_ #IHW #Hi #L1
-lapply (drop_fwd_length_minus2 … HLK2) normalize #H0
-lapply (drop_O1_append_sn_le … HLK2 … L1) -HLK2
-[ -I -L1 -K2 -U -W -l /4 width=3 by ylt_yle_trans, ylt_inv_inj, lt_to_le/
-| #HLK2 @(frees_be … HnU HLK2) // -HnU -HLK2 @IHW -IHW
- >(minus_plus_m_m (|K2|) 1) >H0 -H0 <yminus_inj >yminus_SO2
- /3 width=1 by monotonic_yle_minus_dx, yle_pred/
-]
-qed.
-
-(* Inversion lemmas on append for local environments ************************)
-
-fact frees_inv_append_aux: ∀L,U,l,i. L ⊢ i ϵ 𝐅*[l]⦃U⦄ → ∀L1,L2. L = L1 @@ L2 →
- i ≤ |L2| → L2 ⊢ i ϵ 𝐅*[l]⦃U⦄.
-#L #U #l #i #H elim H -L -U -l -i /3 width=2 by frees_eq/
-#Z #L #Y #U #X #l #i #j #Hlj #Hji #HnU #HLY #_ #IHW #L1 #L2 #H #Hi destruct
-elim (drop_O1_lt (Ⓕ) L2 j) [2: -Z -Y -L1 -X -U -l /3 width=3 by ylt_yle_trans, ylt_inv_inj/ ]
-#I #K2 #W #HLK2 lapply (drop_fwd_length_minus2 … HLK2) normalize #H0
-lapply (drop_O1_inv_append1_le … HLY … HLK2) -HLY
-[ -Z -I -Y -K2 -L1 -X -U -W -l /4 width=3 by ylt_yle_trans, ylt_inv_inj, lt_to_le/
-| normalize #H destruct
- @(frees_be … HnU HLK2) -HnU -HLK2 // @IHW -IHW //
- >(minus_plus_m_m (|K2|) 1) >H0 -H0 <yminus_inj >yminus_SO2
- /3 width=1 by monotonic_yle_minus_dx, yle_pred/
-]
-qed-.
-
-lemma frees_inv_append: ∀L1,L2,U,l,i. L1 @@ L2 ⊢ i ϵ 𝐅*[l]⦃U⦄ →
- i ≤ |L2| → L2 ⊢ i ϵ 𝐅*[l]⦃U⦄.
-/2 width=4 by frees_inv_append_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/relocation/drops_weight.ma".
-include "basic_2/s_computation/fqup_weight.ma".
-include "basic_2/s_computation/fqus_weight.ma".
-include "basic_2/static/frees.ma".
-
-(* CONTEXT-SENSITIVE FREE VARIABLES *****************************************)
-
-(* Properties with star-iterated supclosure *********************************)
-
-(* Note: Restrict fqu_drop on atoms to prove frees_fqus_drops
- Counterex: ⦃⋆, ⋆.ⓛ#0, ⓛ#1.#0⦄ ⊐ ⦃⋆, ⋆, ⓛ#0.#0⦄ ⊐ ⦃⋆, ⋆.ⓛ#0, #0⦄
-*)
-lemma frees_fqus_drops: ∀G,L1,T1,f1. L1 ⊢ 𝐅*⦃T1⦄ ≡ f1 →
- ∀L2,T2. ⦃G, L1, T1⦄ ⊐* ⦃G, L2, T2⦄ →
- ∀I,n. ⬇*[n] L1 ≡ L2.ⓑ{I}T2 →
- ∃∃f2. L2 ⊢ 𝐅*⦃T2⦄ ≡ f2 & f2 ⊆ ⫱*[⫯n] f1.
-#G #L1 #T1 @(fqup_wf_ind_eq … G L1 T1) -G -L1 -T1
-#G0 #L0 #T0 #IH #G #L1 * *
-[ #s #HG #HL #HT #f1 #Hf1 #L2 #T2 #H12 #I #n #HL12 destruct
- lapply (frees_inv_sort … Hf1) -Hf1 #Hf1
- elim (fqus_inv_sort1 … H12) -H12 * [| elim (nat_split n) ]
- [ -IH #H1 #H2 #H3 destruct
- lapply (drops_fwd_lw … HL12) -HL12 #HL12
- elim (lt_le_false … HL12) -HL12 //
- | -IH #Hn #J #L #V #H12 #H destruct
- lapply (drops_fwd_isid … HL12 ?) -HL12 // #H destruct
- <(fqus_inv_refl_atom3 … H12) -H12
- /3 width=3 by frees_sort_gen, sle_isid_sn, ex2_intro/
- | * #m #Hn #J #L #V #H12 #H destruct
- lapply (drops_inv_drop1 … HL12) -HL12 #HL12
- elim (IH … H12 … HL12) -IH -H12 -HL12
- /3 width=3 by frees_sort_gen, fqu_fqup, fqu_drop, lifts_sort, isid_tl, ex2_intro/
- ]
-| #i #HG #HL #HT #f1 #Hf1 #L2 #T2 #H12 #I #n #HL12 destruct
- elim (fqus_inv_lref1 … H12) -H12 * [|2,3: elim (nat_split n) ]
- [ -IH #H1 #H2 #H3 destruct
- lapply (drops_fwd_lw … HL12) -HL12 #HL12
- elim (lt_le_false … HL12) -HL12 //
- | -IH #Hn #J #L #V #H12 #H1 #H2 destruct
- elim (frees_inv_zero_pair … Hf1) -Hf1 #g1 #Hg1 #H destruct
- lapply (drops_fwd_isid … HL12 ?) -HL12 -H12 // #H destruct
- /2 width=3 by sle_refl, ex2_intro/
- | * #m #Hn #J #L #V #H12 #H1 #H2 destruct
- elim (frees_inv_zero_pair … Hf1) -Hf1 #g1 #Hg1 #H destruct
- lapply (drops_inv_drop1 … HL12) -HL12 #HL12
- elim (IH … H12 … HL12) -IH -H12 -HL12
- /2 width=3 by fqu_fqup, fqu_lref_O, ex2_intro/
- | -IH #Hn #J #L #V #j #H12 #H1 #H2 destruct
- elim (frees_inv_lref_pair … Hf1) -Hf1 #g1 #Hg1 #H destruct
- lapply (drops_fwd_isid … HL12 ?) -HL12 // #H destruct
- <(fqus_inv_refl_atom3 … H12) -H12 /2 width=3 by sle_refl, ex2_intro/
- | * #m #Hn #J #L #V #j #H12 #H1 #H2 destruct
- elim (frees_inv_lref_pair … Hf1) -Hf1 #g1 #Hg1 #H destruct
- lapply (drops_inv_drop1 … HL12) -HL12 #HL12
- elim (IH … H12 … HL12) -IH -H12 -HL12 /2 width=3 by fqu_fqup, ex2_intro/
- ]
-| #l #HG #HL #HT #f1 #Hf1 #L2 #T2 #H12 #I #n #HL12 destruct
- lapply (frees_inv_gref … Hf1) -Hf1 #Hf1
- elim (fqus_inv_gref1 … H12) -H12 * [| elim (nat_split n) ]
- [ -IH #H1 #H2 #H3 destruct
- lapply (drops_fwd_lw … HL12) -HL12 #HL12
- elim (lt_le_false … HL12) -HL12 //
- | -IH #Hn #J #L #V #H12 #H destruct
- lapply (drops_fwd_isid … HL12 ?) -HL12 // #H destruct
- <(fqus_inv_refl_atom3 … H12) -H12
- /3 width=3 by frees_gref_gen, sle_isid_sn, ex2_intro/
- | * #m #Hn #J #L #V #H12 #H destruct
- lapply (drops_inv_drop1 … HL12) -HL12 #HL12
- elim (IH … H12 … HL12) -IH -H12 -HL12
- /3 width=3 by frees_gref_gen, fqu_fqup, fqu_drop, lifts_sort, isid_tl, ex2_intro/
- ]
-| #p #I #V1 #T1 #HG #HL #HT #f1 #Hf1 #L2 #T2 #H12 #I #n #HL12 destruct
- elim (frees_inv_bind … Hf1) -Hf1 #f1V #f1T #Hf1V #Hf1T #Hf1
- elim (fqus_inv_bind1 … H12) -H12
- [ -IH -f1V -f1T * #H1 #H2 #H3 destruct
- lapply (drops_fwd_lw … HL12) -HL12 #HL12
- elim (lt_le_false … HL12) -HL12 //
- | #H12 elim (IH … H12 … HL12) -IH -H12 -HL12
- /4 width=6 by sor_tls, sor_inv_sle_sn_trans, ex2_intro/
- | #H12 elim (IH … H12 I (⫯n)) -IH -H12 [|*: /2 width=3 by drops_drop, drops_refl/ ] -HL12
- <tls_xn /4 width=6 by ex2_intro, sor_tls, sor_inv_sle_dx_trans/
- | * #J #L #V #X1 #H12 #HXT1 #H destruct
- ]
-| #I #V1 #T1 #HG #HL #HT #f1 #Hf1 #L2 #T2 #H12 #I #n #HL12 destruct
- elim (frees_inv_flat … Hf1) -Hf1 #f1V #f1T #Hf1V #Hf1T #Hf1
- elim (fqus_inv_flat1 … H12) -H12
- [ -IH -f1V -f1T * #H1 #H2 #H3 destruct
- lapply (drops_fwd_lw … HL12) -HL12 #HL12
- elim (lt_le_false … HL12) -HL12 //
- | #H12 elim (IH … H12 … HL12) -IH -H12 -HL12
- /4 width=6 by sor_tls, sor_inv_sle_sn_trans, ex2_intro/
- | #H12 elim (IH … H12 … HL12) -IH -H12 -HL12
- /4 width=6 by ex2_intro, sor_tls, sor_inv_sle_dx_trans/
- | * #J #L #V #X1 #H12 #HXT1 #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/grammar/lenv_length.ma".
-include "basic_2/grammar/cl_restricted_weight.ma".
-include "basic_2/relocation/frees.ma".
-
-(* CONTEXT-SENSITIVE FREE VARIABLES *****************************************)
-
-(* Forward lemmas on length for local environments **************************)
-
-lemma frees_fwd_length: ∀L,T,t. L ⊢ 𝐅*⦃T⦄ ≡ t → |L| = |t|.
-#L #T #t #H elim H -L -T -t //
-[ #p ] #I #L #V #T #t1 #t2 #t [ #b ] #_ #_ #Ht elim (sor_inv_length … Ht) -Ht //
-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/drop_drop.ma".
-include "basic_2/multiple/frees.ma".
-
-(* CONTEXT-SENSITIVE FREE VARIABLES *****************************************)
-
-(* Advanced properties ******************************************************)
-
-lemma frees_dec: ∀L,U,l,i. Decidable (frees l L U i).
-#L #U @(f2_ind … rfw … L U) -L -U
-#x #IH #L * *
-[ -IH /3 width=5 by frees_inv_sort, or_intror/
-| #j #Hx #l #i elim (ylt_split_eq i j) #Hji
- [ -x @or_intror #H elim (ylt_yle_false … Hji)
- lapply (frees_inv_lref_ge … H ?) -L -l /2 width=1 by ylt_fwd_le/
- | -x /2 width=1 by or_introl/
- | elim (ylt_split j l) #Hli
- [ -x @or_intror #H elim (ylt_yle_false … Hji)
- lapply (frees_inv_lref_skip … H ?) -L //
- | elim (lt_or_ge j (|L|)) #Hj
- [ elim (drop_O1_lt (Ⓕ) L j) // -Hj #I #K #W #HLK destruct
- elim (IH K W … 0 (i-j-1)) -IH [1,3: /3 width=5 by frees_lref_be, drop_fwd_rfw, or_introl/ ] #HnW
- @or_intror #H elim (frees_inv_lref_lt … H) // #Z #Y #X #_ #HLY -l
- lapply (drop_mono … HLY … HLK) -L #H destruct /2 width=1 by/
- | -x @or_intror #H elim (ylt_yle_false … Hji)
- lapply (frees_inv_lref_free … H ?) -l //
- ]
- ]
- ]
-| -IH /3 width=5 by frees_inv_gref, or_intror/
-| #a #I #W #U #Hx #l #i destruct
- elim (IH L W … l i) [1,3: /3 width=1 by frees_bind_sn, or_introl/ ] #HnW
- elim (IH (L.ⓑ{I}W) U … (⫯l) (i+1)) -IH [1,3: /3 width=1 by frees_bind_dx, or_introl/ ] #HnU
- @or_intror #H elim (frees_inv_bind … H) -H /2 width=1 by/
-| #I #W #U #Hx #l #i destruct
- elim (IH L W … l i) [1,3: /3 width=1 by frees_flat_sn, or_introl/ ] #HnW
- elim (IH L U … l i) -IH [1,3: /3 width=1 by frees_flat_dx, or_introl/ ] #HnU
- @or_intror #H elim (frees_inv_flat … H) -H /2 width=1 by/
-]
-qed-.
-
-lemma frees_S: ∀L,U,l,i. L ⊢ i ϵ 𝐅*[yinj l]⦃U⦄ → ∀I,K,W. ⬇[l] L ≡ K.ⓑ{I}W →
- (K ⊢ ⫰(i-l) ϵ 𝐅*[0]⦃W⦄ → ⊥) → L ⊢ i ϵ 𝐅*[⫯l]⦃U⦄.
-#L #U #l #i #H elim (frees_inv … H) -H /3 width=2 by frees_eq/
-* #I #K #W #j #Hlj #Hji #HnU #HLK #HW #I0 #K0 #W0 #HLK0 #HnW0
-lapply (yle_inv_inj … Hlj) -Hlj #Hlj
-elim (le_to_or_lt_eq … Hlj) -Hlj
-[ -I0 -K0 -W0 /3 width=9 by frees_be, yle_inj/
-| -Hji -HnU #H destruct
- lapply (drop_mono … HLK0 … HLK) #H destruct -I
- elim HnW0 -L -U -HnW0 //
-]
-qed.
-
-(* Note: lemma 1250 *)
-lemma frees_bind_dx_O: ∀a,I,L,W,U,i. L.ⓑ{I}W ⊢ ⫯i ϵ 𝐅*[0]⦃U⦄ →
- L ⊢ i ϵ 𝐅*[0]⦃ⓑ{a,I}W.U⦄.
-#a #I #L #W #U #i #HU elim (frees_dec L W 0 i)
-/4 width=5 by frees_S, frees_bind_dx, frees_bind_sn/
-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/rdrop_3.ma".
-include "basic_2/grammar/genv.ma".
-
-(* GLOBAL ENVIRONMENT READING ***********************************************)
-
-inductive gget (m:nat): relation genv ≝
-| gget_gt: ∀G. |G| ≤ m → gget m G (⋆)
-| gget_eq: ∀G. |G| = m + 1 → gget m G G
-| gget_lt: ∀I,G1,G2,V. m < |G1| → gget m G1 G2 → gget m (G1. ⓑ{I} V) G2
-.
-
-interpretation "global reading"
- 'RDrop m G1 G2 = (gget m G1 G2).
-
-(* basic inversion lemmas ***************************************************)
-
-lemma gget_inv_gt: ∀G1,G2,m. ⬇[m] G1 ≡ G2 → |G1| ≤ m → G2 = ⋆.
-#G1 #G2 #m * -G1 -G2 //
-[ #G #H >H -H >commutative_plus #H (**) (* lemma needed here *)
- lapply (le_plus_to_le_r … 0 H) -H #H
- lapply (le_n_O_to_eq … H) -H #H destruct
-| #I #G1 #G2 #V #H1 #_ #H2
- lapply (le_to_lt_to_lt … H2 H1) -H2 -H1 normalize in ⊢ (? % ? → ?); >commutative_plus #H
- lapply (lt_plus_to_lt_l … 0 H) -H #H
- elim (lt_zero_false … H)
-]
-qed-.
-
-lemma gget_inv_eq: ∀G1,G2,m. ⬇[m] G1 ≡ G2 → |G1| = m + 1 → G1 = G2.
-#G1 #G2 #m * -G1 -G2 //
-[ #G #H1 #H2 >H2 in H1; -H2 >commutative_plus #H (**) (* lemma needed here *)
- lapply (le_plus_to_le_r … 0 H) -H #H
- lapply (le_n_O_to_eq … H) -H #H destruct
-| #I #G1 #G2 #V #H1 #_ normalize #H2
- <(injective_plus_l … H2) in H1; -H2 #H
- elim (lt_refl_false … H)
-]
-qed-.
-
-fact gget_inv_lt_aux: ∀I,G,G1,G2,V,m. ⬇[m] G ≡ G2 → G = G1. ⓑ{I} V →
- m < |G1| → ⬇[m] G1 ≡ G2.
-#I #G #G1 #G2 #V #m * -G -G2
-[ #G #H1 #H destruct #H2
- lapply (le_to_lt_to_lt … H1 H2) -H1 -H2 normalize in ⊢ (? % ? → ?); >commutative_plus #H
- lapply (lt_plus_to_lt_l … 0 H) -H #H
- elim (lt_zero_false … H)
-| #G #H1 #H2 destruct >(injective_plus_l … H1) -H1 #H
- elim (lt_refl_false … H)
-| #J #G #G2 #W #_ #HG2 #H destruct //
-]
-qed-.
-
-lemma gget_inv_lt: ∀I,G1,G2,V,m.
- ⬇[m] G1. ⓑ{I} V ≡ G2 → m < |G1| → ⬇[m] G1 ≡ G2.
-/2 width=5 by gget_inv_lt_aux/ qed-.
-
-(* Basic properties *********************************************************)
-
-lemma gget_total: ∀m,G1. ∃G2. ⬇[m] G1 ≡ G2.
-#m #G1 elim G1 -G1 /3 width=2 by gget_gt, ex_intro/
-#I #V #G1 * #G2 #HG12
-elim (lt_or_eq_or_gt m (|G1|)) #Hm
-[ /3 width=2 by gget_lt, ex_intro/
-| destruct /3 width=2 by gget_eq, ex_intro/
-| @ex_intro [2: @gget_gt normalize /2 width=1 by/ | skip ] (**) (* explicit constructor *)
-]
-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/gget.ma".
-
-(* GLOBAL ENVIRONMENT READING ***********************************************)
-
-(* Main properties **********************************************************)
-
-theorem gget_mono: ∀G,G1,m. ⬇[m] G ≡ G1 → ∀G2. ⬇[m] G ≡ G2 → G1 = G2.
-#G #G1 #m #H elim H -G -G1
-[ #G #Hm #G2 #H
- >(gget_inv_gt … H Hm) -H -Hm //
-| #G #Hm #G2 #H
- >(gget_inv_eq … H Hm) -H -Hm //
-| #I #G #G1 #V #Hm #_ #IHG1 #G2 #H
- lapply (gget_inv_lt … H Hm) -H -Hm /2 width=1 by/
-]
-qed-.
-
-lemma gget_dec: ∀G1,G2,m. Decidable (⬇[m] G1 ≡ G2).
-#G1 #G2 #m
-elim (gget_total m G1) #G #HG1
-elim (eq_genv_dec G G2) #HG2
-[ destruct /2 width=1 by or_introl/
-| @or_intror #HG12
- lapply (gget_mono … HG1 … HG12) -HG1 -HG12 /2 width=1 by/
-]
-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 *)
-(* *)
-(**************************************************************************)
-
-(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
-
-notation "hvbox( ⬇ [ term 46 m ] break term 46 L1 ≡ break term 46 L2 )"
- non associative with precedence 45
- for @{ 'RDrop $m $L1 $L2 }.
+++ /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 *)
-(* *)
-(**************************************************************************)
-
-(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
-
-notation "hvbox( L1 ⋓ break [ term 46 T , break term 46 f ] break term 46 L2 ≡ break term 46 L )"
- non associative with precedence 45
- for @{ 'LazyOr $L1 $T $f $L2 $L }.
+++ /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/rt_transition/lfpr_lfpr.ma".
-
-(* PARALLEL R-TRANSITION FOR LOCAL ENV.S ON REFERRED ENTRIES ****************)
-
-definition lfxs_confluent_R: relation2 … ≝
- λRP1,RP2.
- ∀L0,T0,T1. RP1 L0 T0 T1 → ∀T2. RP2 L0 T0 T2 →
- ∀L1. L0 ⦻*[RP1, T0] L1 → ∀L2. L0 ⦻*[RP2, T0] L2 →
- ∃∃L. L1 ⦻*[RP2, T1] L & L2 ⦻*[RP1, T2] L.
-
-(* Main properties **********************************************************)
-
-fact lfpr_conf_cpr_atom_atom:
- ∀h,I,G,L0. (
- ∀L,T. ⦃G, L0, ⓪{I}⦄ ⊐+ ⦃G, L, T⦄ →
- ∀T1. ⦃G, L⦄ ⊢ T ➡[h] T1 → ∀T2. ⦃G, L⦄ ⊢ T ➡[h] T2 →
- ∀L1. ⦃G, L⦄ ⊢ ➡[h, T] L1 → ∀L2. ⦃G, L⦄ ⊢ ➡[h, T] L2 →
- ∃∃K0. ⦃G, L1⦄ ⊢ ➡[h, T1] K0 & ⦃G, L2⦄ ⊢ ➡[h, T2] K0
- ) →
- ∀L1. ⦃G, L0⦄ ⊢ ➡[h, ⓪{I}] L1 → ∀L2. ⦃G, L0⦄ ⊢ ➡[h, ⓪{I}] L2 →
- ∃∃L. ⦃G, L1⦄ ⊢ ➡[h, ⓪{I}] L & ⦃G, L2⦄ ⊢ ➡[h, ⓪{I}] L.
-#h #I #G * [ | #K0 #J #V0 cases I -I [ | * | ] ]
-[ #_ #L1 #HL01 #L2 #HL02
- lapply (lfpr_inv_atom_sn … HL01) -HL01 #H destruct
- lapply (lfpr_inv_atom_sn … HL02) -HL02 #H destruct
- /2 width=3 by ex2_intro/
-| #s #IH #L1 #HL01 #L2 #HL02
- elim (lfxs_inv_sort_pair_sn … HL01) -HL01 #K1 #V1 #HK01 #H destruct
- elim (lfxs_inv_sort_pair_sn … HL02) -HL02 #K2 #V2 #HK02 #H destruct
- elim (IH … HK01 … HK02) -IH -HK01 -HK02
- /3 width=5 by lfpr_sort, fqu_fqup, fqu_drop, ex2_intro/
-| #IH #L1 #HL01 #L2 #HL02
- elim (lfpr_inv_zero_pair_sn … HL01) -HL01 #K1 #V1 #HK01 #HV01 #H destruct
- elim (lfpr_inv_zero_pair_sn … HL02) -HL02 #K2 #V2 #HK02 #HV02 #H destruct
- elim (cpr_conf_lfpr … HV01 … HV02 … HK01 … HK02) #V #HV1 #HV2
- elim (IH … HV01 … HV02 … HK01 … HK02) -IH -HV01 -HV02 -HK01 -HK02
- /3 width=5 by lfpr_zero, fqu_fqup, fqu_drop, ex2_intro/
-| #i #IH #L1 #HL01 #L2 #HL02
- elim (lfxs_inv_lref_pair_sn … HL01) -HL01 #K1 #V1 #HK01 #H destruct
- elim (lfxs_inv_lref_pair_sn … HL02) -HL02 #K2 #V2 #HK02 #H destruct
- elim (IH … HK01 … HK02) -IH -HK01 -HK02
- /3 width=5 by lfpr_lref, fqu_fqup, fqu_drop, ex2_intro/
-| #l #IH #L1 #HL01 #L2 #HL02
- elim (lfxs_inv_gref_pair_sn … HL01) -HL01 #K1 #V1 #HK01 #H destruct
- elim (lfxs_inv_gref_pair_sn … HL02) -HL02 #K2 #V2 #HK02 #H destruct
- elim (IH … HK01 … HK02) -IH -HK01 -HK02
- /3 width=5 by lfpr_gref, fqu_fqup, fqu_drop, ex2_intro/
-]
-qed-.
-
-theorem lfpr_conf_cpr: ∀h,G. lfxs_confluent_R (cpm 0 h G) (cpm 0 h G).
-#h #G #L0 #T0 @(fqup_wf_ind_eq … G L0 T0) -G -L0 -T0 #G #L #T #IH #G0 #L0 * [| * ]
-[ #I0 #HG #HL #HT #T1 #H1 #T2 #H2 #L1 #HL01 #L2 #HL02 destruct
- elim (cpr_inv_atom1_drops … H1) -H1
- elim (cpr_inv_atom1_drops … H2) -H2
- [ #H2 #H1 destruct
- /3 width=7 by lfpr_conf_cpr_atom_atom/
- | * #K0 #V0 #V2 * [2: #i2 ] #HLK0 #HV02 #HVT2 #H2 #H1 destruct
-
-(*
-
-theorem lpr_conf: ∀G. confluent … (lpr G).
-/3 width=6 by lpx_sn_conf, cpr_conf_lpr/
-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.ma".
-
-(* BASIC TERM RELOCATION ****************************************************)
-
-(* Properties on negated basic relocation ***********************************)
-
-lemma nlift_lref_be_SO: ∀X,j. j < ∞ → ⬆[j, 1] X ≡ #j → ⊥.
-#X #j #Hj #H elim (lift_inv_lref2 … H) -H *
-[ #H elim (ylt_yle_false … H) -H //
-| #i #Hij #_ #H1 #H2 destruct
- elim (ylt_inv_plus_Y … Hj) -Hj #Hi #_
- elim (ylt_yle_false … Hij) -Hij /2 width=1 by monotonic_ylt_plus_sn/
-]
-qed-.
-
-lemma nlift_bind_sn: ∀W,l,m. (∀V. ⬆[l, m] V ≡ W → ⊥) →
- ∀a,I,U. (∀X. ⬆[l, m] X ≡ ⓑ{a,I}W.U → ⊥).
-#W #l #m #HW #a #I #U #X #H elim (lift_inv_bind2 … H) -H /2 width=2 by/
-qed-.
-
-lemma nlift_bind_dx: ∀U,l,m. (∀T. ⬆[⫯l, m] T ≡ U → ⊥) →
- ∀a,I,W. (∀X. ⬆[l, m] X ≡ ⓑ{a,I}W.U → ⊥).
-#U #l #m #HU #a #I #W #X #H elim (lift_inv_bind2 … H) -H /2 width=2 by/
-qed-.
-
-lemma nlift_flat_sn: ∀W,l,m. (∀V. ⬆[l, m] V ≡ W → ⊥) →
- ∀I,U. (∀X. ⬆[l, m] X ≡ ⓕ{I}W.U → ⊥).
-#W #l #m #HW #I #U #X #H elim (lift_inv_flat2 … H) -H /2 width=2 by/
-qed-.
-
-lemma nlift_flat_dx: ∀U,l,m. (∀T. ⬆[l, m] T ≡ U → ⊥) →
- ∀I,W. (∀X. ⬆[l, m] X ≡ ⓕ{I}W.U → ⊥).
-#U #l #m #HU #I #W #X #H elim (lift_inv_flat2 … H) -H /2 width=2 by/
-qed-.
-
-(* Inversion lemmas on negated basic relocation *****************************)
-
-lemma nlift_inv_lref_be_SO: ∀i,j. (∀X. ⬆[i, 1] X ≡ #j → ⊥) → j = i ∧ j < ∞.
-#i #j elim (ylt_split_eq i j) #Hij #H destruct
-[ elim (H (#⫰j)) -H /2 width=1 by lift_lref_pred/
-| elim (yle_split_eq i (∞)) /2 width=1 by conj/ #H0 destruct
- elim (H (#∞)) -H /2 width=1 by lift_lref_plus, ylt_Y/
-| elim (H (#j)) -H /2 width=1 by lift_lref_lt/
-]
-qed-.
-
-lemma nlift_inv_bind: ∀a,I,W,U,l,m. (∀X. ⬆[l, m] X ≡ ⓑ{a,I}W.U → ⊥) →
- (∀V. ⬆[l, m] V ≡ W → ⊥) ∨ (∀T. ⬆[⫯l, m] T ≡ U → ⊥).
-#a #I #W #U #l #m #H elim (is_lift_dec W l m)
-[ * /4 width=2 by lift_bind, or_intror/
-| /4 width=2 by ex_intro, or_introl/
-]
-qed-.
-
-lemma nlift_inv_flat: ∀I,W,U,l,m. (∀X. ⬆[l, m] X ≡ ⓕ{I}W.U → ⊥) →
- (∀V. ⬆[l, m] V ≡ W → ⊥) ∨ (∀T. ⬆[l, m] T ≡ U → ⊥).
-#I #W #U #l #m #H elim (is_lift_dec W l m)
-[ * /4 width=2 by lift_flat, or_intror/
-| /4 width=2 by ex_intro, 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/notation/relations/lazyeq_4.ma".
-include "basic_2/multiple/llpx_sn.ma".
-
-(* LAZY EQUIVALENCE FOR LOCAL ENVIRONMENTS **********************************)
-
-(* Basic inversion lemmas ***************************************************)
-
-lemma lleq_ind: ∀R:relation4 ynat term lenv lenv. (
- ∀L1,L2,l,s. |L1| = |L2| → R l (⋆s) 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-.
-
-(* Basic forward lemmas *****************************************************)
-
-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-.
-
-(* Basic properties *********************************************************)
-
-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.
+++ /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,k. ⬇[Ⓕ, l, k] L1 ≡ K1 → ⬇[Ⓕ, l, k] L2 ≡ K2 →
- ∀U. ⬆[l, k] 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,k. ⬇[Ⓕ, l, k] L1 ≡ K1 → ⬇[Ⓕ, l, k] L2 ≡ K2 →
- ∀U. ⬆[l, k] T ≡ U → l ≤ lt → L1 ≡[U, lt+k] 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,k. ⬇[Ⓕ, l, k] L1 ≡ K1 → ⬇[Ⓕ, l, k] L2 ≡ K2 →
- ∀T. ⬆[l, k] 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,k. ⬇[Ⓕ, l, k] L1 ≡ K1 → ⬇[Ⓕ, l, k] L2 ≡ K2 →
- ∀T. ⬆[l, k] T ≡ U → l ≤ lt → lt ≤ l + k → 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,k. ⬇[Ⓕ, l, k] L1 ≡ K1 → ⬇[Ⓕ, l, k] L2 ≡ K2 →
- ∀T. ⬆[l, k] T ≡ U → l + k ≤ lt → K1 ≡[T, lt-k] 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 #k #HLK2 #HTU #L1 #HL12
- elim (drop_O1_le (Ⓕ) (k+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/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. (c_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. (c_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 ****)
-
-| 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
-
-(* Basic forward lemmas *****************************************************)
-
-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-.
-
-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-.
+++ /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_k_k 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,s. |L1| = |L2| → llpx_sn_alt_r R l (⋆s) L1 L2.
-#R #L1 #L2 #l #s #HL12 @llpx_sn_alt_r_intro_alt // -HL12
-#I1 #I2 #K1 #K2 #V1 #V2 #i #_ #H elim (H (⋆s)) //
-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 * *
-[ #s #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-.
-
-(* 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. (c_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. (c_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
-(* Properties on supclosure *************************************************)
-
-lemma fqu_lpx_trans: ∀h,o,G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐ ⦃G2, L2, T2⦄ →
- ∀K2. ⦃G2, L2⦄ ⊢ ➡[h, o] K2 →
- ∃∃K1,T. ⦃G1, L1⦄ ⊢ ➡[h, o] K1 & ⦃G1, L1⦄ ⊢ T1 ➡[h, o] T & ⦃G1, K1, T⦄ ⊐ ⦃G2, K2, T2⦄.
-#h #o #G1 #G2 #L1 #L2 #T1 #T2 #H elim H -G1 -G2 -L1 -L2 -T1 -T2
-/3 width=5 by fqu_lref_O, fqu_pair_sn, fqu_flat_dx, lpx_pair, ex3_2_intro/
-[ #a #I #G2 #L2 #V2 #T2 #X #H elim (lpx_inv_pair1 … H) -H
- #K2 #W2 #HLK2 #HVW2 #H destruct
- /3 width=5 by cpx_pair_sn, fqu_bind_dx, ex3_2_intro/
-| #G #L1 #K1 #T1 #U1 #k #HLK1 #HTU1 #K2 #HK12
- elim (drop_lpx_trans … HLK1 … HK12) -HK12
- /3 width=7 by fqu_drop, ex3_2_intro/
-]
-qed-.
-
-lemma fquq_lpx_trans: ∀h,o,G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐⸮ ⦃G2, L2, T2⦄ →
- ∀K2. ⦃G2, L2⦄ ⊢ ➡[h, o] K2 →
- ∃∃K1,T. ⦃G1, L1⦄ ⊢ ➡[h, o] K1 & ⦃G1, L1⦄ ⊢ T1 ➡[h, o] T & ⦃G1, K1, T⦄ ⊐⸮ ⦃G2, K2, T2⦄.
-#h #o #G1 #G2 #L1 #L2 #T1 #T2 #H #K2 #HLK2 elim (fquq_inv_gen … H) -H
-[ #HT12 elim (fqu_lpx_trans … HT12 … HLK2) /3 width=5 by fqu_fquq, ex3_2_intro/
-| * #H1 #H2 #H3 destruct /2 width=5 by ex3_2_intro/
-]
-qed-.
-
-lemma lpx_fqu_trans: ∀h,o,G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐ ⦃G2, L2, T2⦄ →
- ∀K1. ⦃G1, K1⦄ ⊢ ➡[h, o] L1 →
- ∃∃K2,T. ⦃G1, K1⦄ ⊢ T1 ➡[h, o] T & ⦃G1, K1, T⦄ ⊐ ⦃G2, K2, T2⦄ & ⦃G2, K2⦄ ⊢ ➡[h, o] L2.
-#h #o #G1 #G2 #L1 #L2 #T1 #T2 #H elim H -G1 -G2 -L1 -L2 -T1 -T2
-/3 width=7 by fqu_pair_sn, fqu_bind_dx, fqu_flat_dx, lpx_pair, ex3_2_intro/
-[ #I #G1 #L1 #V1 #X #H elim (lpx_inv_pair2 … H) -H
- #K1 #W1 #HKL1 #HWV1 #H destruct elim (lift_total V1 0 1)
- /4 width=7 by cpx_delta, fqu_drop, drop_drop, ex3_2_intro/
-| #G #L1 #K1 #T1 #U1 #k #HLK1 #HTU1 #L0 #HL01
- elim (lpx_drop_trans_O1 … HL01 … HLK1) -L1
- /3 width=5 by fqu_drop, ex3_2_intro/
-]
-qed-.
-
-lemma lpx_fquq_trans: ∀h,o,G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐⸮ ⦃G2, L2, T2⦄ →
- ∀K1. ⦃G1, K1⦄ ⊢ ➡[h, o] L1 →
- ∃∃K2,T. ⦃G1, K1⦄ ⊢ T1 ➡[h, o] T & ⦃G1, K1, T⦄ ⊐⸮ ⦃G2, K2, T2⦄ & ⦃G2, K2⦄ ⊢ ➡[h, o] L2.
-#h #o #G1 #G2 #L1 #L2 #T1 #T2 #H #K1 #HKL1 elim (fquq_inv_gen … H) -H
-[ #HT12 elim (lpx_fqu_trans … HT12 … HKL1) /3 width=5 by fqu_fquq, ex3_2_intro/
-| * #H1 #H2 #H3 destruct /2 width=5 by ex3_2_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.ma".
-include "basic_2/substitution/lpx_sn.ma".
-
-(* SN POINTWISE EXTENSION OF A CONTEXT-SENSITIVE REALTION FOR TERMS *********)
-
-(* alternative definition of lpx_sn *)
-definition lpx_sn_alt: relation3 lenv term term → relation lenv ≝
- λR,L1,L2. |L1| = |L2| ∧
- (∀I1,I2,K1,K2,V1,V2,i.
- ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
- I1 = I2 ∧ R K1 V1 V2
- ).
-
-(* Basic forward lemmas ******************************************************)
-
-lemma lpx_sn_alt_fwd_length: ∀R,L1,L2. lpx_sn_alt R L1 L2 → |L1| = |L2|.
-#R #L1 #L2 #H elim H //
-qed-.
-
-(* Basic inversion lemmas ***************************************************)
-
-lemma lpx_sn_alt_inv_atom1: ∀R,L2. lpx_sn_alt R (⋆) L2 → L2 = ⋆.
-#R #L2 #H lapply (lpx_sn_alt_fwd_length … H) -H
-normalize /2 width=1 by length_inv_zero_sn/
-qed-.
-
-lemma lpx_sn_alt_inv_pair1: ∀R,I,L2,K1,V1. lpx_sn_alt R (K1.ⓑ{I}V1) L2 →
- ∃∃K2,V2. lpx_sn_alt R K1 K2 & R K1 V1 V2 & L2 = K2.ⓑ{I}V2.
-#R #I1 #L2 #K1 #V1 #H elim H -H
-#H #IH elim (length_inv_pos_sn … H) -H
-#I2 #K2 #V2 #HK12 #H destruct
-elim (IH I1 I2 K1 K2 V1 V2 0) //
-#H #HV12 destruct @(ex3_2_intro … K2 V2) // -HV12
-@conj // -HK12
-#J1 #J2 #L1 #L2 #W1 #W2 #i #HKL1 #HKL2 elim (IH J1 J2 L1 L2 W1 W2 (⫯i)) -IH
-/2 width=1 by drop_drop, conj/
-qed-.
-
-lemma lpx_sn_alt_inv_atom2: ∀R,L1. lpx_sn_alt R L1 (⋆) → L1 = ⋆.
-#R #L1 #H lapply (lpx_sn_alt_fwd_length … H) -H
-normalize /2 width=1 by length_inv_zero_dx/
-qed-.
-
-lemma lpx_sn_alt_inv_pair2: ∀R,I,L1,K2,V2. lpx_sn_alt R L1 (K2.ⓑ{I}V2) →
- ∃∃K1,V1. lpx_sn_alt R K1 K2 & R K1 V1 V2 & L1 = K1.ⓑ{I}V1.
-#R #I2 #L1 #K2 #V2 #H elim H -H
-#H #IH elim (length_inv_pos_dx … H) -H
-#I1 #K1 #V1 #HK12 #H destruct
-elim (IH I1 I2 K1 K2 V1 V2 0) //
-#H #HV12 destruct @(ex3_2_intro … K1 V1) // -HV12
-@conj // -HK12
-#J1 #J2 #L1 #L2 #W1 #W2 #i #HKL1 #HKL2 elim (IH J1 J2 L1 L2 W1 W2 (⫯i)) -IH
-/2 width=1 by drop_drop, conj/
-qed-.
-
-(* Basic properties *********************************************************)
-
-lemma lpx_sn_alt_atom: ∀R. lpx_sn_alt R (⋆) (⋆).
-#R @conj //
-#I1 #I2 #K1 #K2 #V1 #V2 #i #HLK1 elim (drop_inv_atom1 … HLK1) -HLK1
-#H destruct
-qed.
-
-lemma lpx_sn_alt_pair: ∀R,I,L1,L2,V1,V2.
- lpx_sn_alt R L1 L2 → R L1 V1 V2 →
- lpx_sn_alt R (L1.ⓑ{I}V1) (L2.ⓑ{I}V2).
-#R #I #L1 #L2 #V1 #V2 #H #HV12 elim H -H
-#HL12 #IH @conj //
-#I1 #I2 #K1 #K2 #W1 #W2 #i @(ynat_ind … i) -i
-[ #HLK1 #HLK2
- lapply (drop_inv_O2 … HLK1) -HLK1 #H destruct
- lapply (drop_inv_O2 … HLK2) -HLK2 #H destruct
- /2 width=1 by conj/
-| -HL12 -HV12 /3 width=6 by drop_inv_drop1/
-| #H lapply (drop_fwd_Y2 … H) -H
- #H elim (ylt_yle_false … H) -H //
-]
-qed.
-
-(* Main properties **********************************************************)
-
-theorem lpx_sn_lpx_sn_alt: ∀R,L1,L2. lpx_sn R L1 L2 → lpx_sn_alt R L1 L2.
-#R #L1 #L2 #H elim H -L1 -L2
-/2 width=1 by lpx_sn_alt_atom, lpx_sn_alt_pair/
-qed.
-
-(* Main inversion lemmas ****************************************************)
-
-theorem lpx_sn_alt_inv_lpx_sn: ∀R,L1,L2. lpx_sn_alt R L1 L2 → lpx_sn R L1 L2.
-#R #L1 elim L1 -L1
-[ #L2 #H lapply (lpx_sn_alt_inv_atom1 … H) -H //
-| #L1 #I #V1 #IH #X #H elim (lpx_sn_alt_inv_pair1 … H) -H
- #L2 #V2 #HL12 #HV12 #H destruct /3 width=1 by lpx_sn_pair/
-]
-qed-.
-
-(* alternative definition of lpx_sn *****************************************)
-
-lemma lpx_sn_intro_alt: ∀R,L1,L2. |L1| = |L2| →
- (∀I1,I2,K1,K2,V1,V2,i.
- ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
- I1 = I2 ∧ R K1 V1 V2
- ) → lpx_sn R L1 L2.
-/4 width=4 by lpx_sn_alt_inv_lpx_sn, conj/ qed.
-
-lemma lpx_sn_inv_alt: ∀R,L1,L2. lpx_sn R L1 L2 →
- |L1| = |L2| ∧
- ∀I1,I2,K1,K2,V1,V2,i.
- ⬇[i] L1 ≡ K1.ⓑ{I1}V1 → ⬇[i] L2 ≡ K2.ⓑ{I2}V2 →
- I1 = I2 ∧ R K1 V1 V2.
-#R #L1 #L2 #H lapply (lpx_sn_lpx_sn_alt … H) -H
-#H elim H -H /3 width=4 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.ma".
-
-(* SN POINTWISE EXTENSION OF A CONTEXT-SENSITIVE REALTION FOR TERMS *********)
-
-(* Properties on transitive_closure *****************************************)
-
-lemma TC_lpx_sn_pair_refl: ∀R. (∀L. reflexive … (R L)) →
- ∀L1,L2. TC … (lpx_sn R) L1 L2 →
- ∀I,V. TC … (lpx_sn R) (L1. ⓑ{I} V) (L2. ⓑ{I} V).
-#R #HR #L1 #L2 #H @(TC_star_ind … L2 H) -L2
-[ /2 width=1 by lpx_sn_refl/
-| /3 width=1 by TC_reflexive, lpx_sn_refl/
-| /3 width=5 by lpx_sn_pair, step/
-]
-qed-.
-
-lemma TC_lpx_sn_pair: ∀R. (∀L. reflexive … (R L)) →
- ∀I,L1,L2. TC … (lpx_sn R) L1 L2 →
- ∀V1,V2. LTC … R L1 V1 V2 →
- TC … (lpx_sn R) (L1. ⓑ{I} V1) (L2. ⓑ{I} V2).
-#R #HR #I #L1 #L2 #HL12 #V1 #V2 #H @(TC_star_ind_dx … V1 H) -V1 //
-[ /2 width=1 by TC_lpx_sn_pair_refl/
-| /4 width=3 by TC_strap, lpx_sn_pair, lpx_sn_refl/
-]
-qed-.
-
-lemma lpx_sn_LTC_TC_lpx_sn: ∀R. (∀L. reflexive … (R L)) →
- ∀L1,L2. lpx_sn (LTC … R) L1 L2 →
- TC … (lpx_sn R) L1 L2.
-#R #HR #L1 #L2 #H elim H -L1 -L2
-/2 width=1 by TC_lpx_sn_pair, lpx_sn_atom, inj/
-qed-.
-
-(* Inversion lemmas on transitive closure ***********************************)
-
-lemma TC_lpx_sn_inv_atom2: ∀R,L1. TC … (lpx_sn R) L1 (⋆) → L1 = ⋆.
-#R #L1 #H @(TC_ind_dx … L1 H) -L1
-[ /2 width=2 by lpx_sn_inv_atom2/
-| #L1 #L #HL1 #_ #IHL2 destruct /2 width=2 by lpx_sn_inv_atom2/
-]
-qed-.
-
-lemma TC_lpx_sn_inv_pair2: ∀R. c_rs_transitive … R (λ_. lpx_sn R) →
- ∀I,L1,K2,V2. TC … (lpx_sn R) L1 (K2.ⓑ{I}V2) →
- ∃∃K1,V1. TC … (lpx_sn R) K1 K2 & LTC … R K1 V1 V2 & L1 = K1. ⓑ{I} V1.
-#R #HR #I #L1 #K2 #V2 #H @(TC_ind_dx … L1 H) -L1
-[ #L1 #H elim (lpx_sn_inv_pair2 … H) -H /3 width=5 by inj, ex3_2_intro/
-| #L1 #L #HL1 #_ * #K #V #HK2 #HV2 #H destruct
- elim (lpx_sn_inv_pair2 … HL1) -HL1 #K1 #V1 #HK1 #HV1 #H destruct
- lapply (HR … HV2 … HK1) -HR -HV2 /3 width=5 by TC_strap, ex3_2_intro/
-]
-qed-.
-
-lemma TC_lpx_sn_ind: ∀R. c_rs_transitive … R (λ_. lpx_sn R) →
- ∀S:relation lenv.
- S (⋆) (⋆) → (
- ∀I,K1,K2,V1,V2.
- TC … (lpx_sn R) K1 K2 → LTC … R K1 V1 V2 →
- S K1 K2 → S (K1.ⓑ{I}V1) (K2.ⓑ{I}V2)
- ) →
- ∀L2,L1. TC … (lpx_sn R) L1 L2 → S L1 L2.
-#R #HR #S #IH1 #IH2 #L2 elim L2 -L2
-[ #X #H >(TC_lpx_sn_inv_atom2 … H) -X //
-| #L2 #I #V2 #IHL2 #X #H
- elim (TC_lpx_sn_inv_pair2 … H) // -H -HR
- #L1 #V1 #HL12 #HV12 #H destruct /3 width=1 by/
-]
-qed-.
-
-lemma TC_lpx_sn_inv_atom1: ∀R,L2. TC … (lpx_sn R) (⋆) L2 → L2 = ⋆.
-#R #L2 #H elim H -L2
-[ /2 width=2 by lpx_sn_inv_atom1/
-| #L #L2 #_ #HL2 #IHL1 destruct /2 width=2 by lpx_sn_inv_atom1/
-]
-qed-.
-
-fact TC_lpx_sn_inv_pair1_aux: ∀R. c_rs_transitive … R (λ_. lpx_sn R) →
- ∀L1,L2. TC … (lpx_sn R) L1 L2 →
- ∀I,K1,V1. L1 = K1.ⓑ{I}V1 →
- ∃∃K2,V2. TC … (lpx_sn R) K1 K2 & LTC … R K1 V1 V2 & L2 = K2. ⓑ{I} V2.
-#R #HR #L1 #L2 #H @(TC_lpx_sn_ind … H) // -HR -L1 -L2
-[ #J #K #W #H destruct
-| #I #L1 #L2 #V1 #V2 #HL12 #HV12 #_ #J #K #W #H destruct /2 width=5 by ex3_2_intro/
-]
-qed-.
-
-lemma TC_lpx_sn_inv_pair1: ∀R. c_rs_transitive … R (λ_. lpx_sn R) →
- ∀I,K1,L2,V1. TC … (lpx_sn R) (K1.ⓑ{I}V1) L2 →
- ∃∃K2,V2. TC … (lpx_sn R) K1 K2 & LTC … R K1 V1 V2 & L2 = K2. ⓑ{I} V2.
-/2 width=3 by TC_lpx_sn_inv_pair1_aux/ qed-.
-
-lemma TC_lpx_sn_inv_lpx_sn_LTC: ∀R. c_rs_transitive … R (λ_. lpx_sn R) →
- ∀L1,L2. TC … (lpx_sn R) L1 L2 →
- lpx_sn (LTC … R) L1 L2.
-/3 width=4 by TC_lpx_sn_ind, lpx_sn_pair/ qed-.
-
-(* Forward lemmas on transitive closure *************************************)
-
-lemma TC_lpx_sn_fwd_length: ∀R,L1,L2. TC … (lpx_sn R) L1 L2 → |L1| = |L2|.
-#R #L1 #L2 #H elim H -L2
-[ #L2 #HL12 >(lpx_sn_fwd_length … HL12) -HL12 //
-| #L #L2 #_ #HL2 #IHL1
- >IHL1 -L1 >(lpx_sn_fwd_length … HL2) -HL2 //
-]
-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 *)
-(* *)
-(**************************************************************************)
-
-(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
-
-notation "hvbox( L1 break ⊆ [ term 46 l , break term 46 m ] break term 46 L2 )"
- non associative with precedence 45
- for @{ 'LRSubEq $L1 $l $k $L2 }.
+++ /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/statictypestar_6.ma".
-include "basic_2/grammar/genv.ma".
-include "basic_2/substitution/drop.ma".
-include "basic_2/static/sh.ma".
-
-(* NAT-ITERATED STATIC TYPE ASSIGNMENT FOR TERMS ****************************)
-
-(* activate genv *)
-inductive lstas (h): nat → relation4 genv lenv term term ≝
-| lstas_sort: ∀G,L,d,s. lstas h d G L (⋆s) (⋆((next h)^d s))
-| lstas_ldef: ∀G,L,K,V,W,U,i,d. ⬇[i] L ≡ K.ⓓV → lstas h d G K V W →
- ⬆[0, i+1] W ≡ U → lstas h d G L (#i) U
-| lstas_zero: ∀G,L,K,W,V,i. ⬇[i] L ≡ K.ⓛW → lstas h 0 G K W V →
- lstas h 0 G L (#i) (#i)
-| lstas_succ: ∀G,L,K,W,V,U,i,d. ⬇[i] L ≡ K.ⓛW → lstas h d G K W V →
- ⬆[0, i+1] V ≡ U → lstas h (d+1) G L (#i) U
-| lstas_bind: ∀a,I,G,L,V,T,U,d. lstas h d G (L.ⓑ{I}V) T U →
- lstas h d G L (ⓑ{a,I}V.T) (ⓑ{a,I}V.U)
-| lstas_appl: ∀G,L,V,T,U,d. lstas h d G L T U → lstas h d G L (ⓐV.T) (ⓐV.U)
-| lstas_cast: ∀G,L,W,T,U,d. lstas h d G L T U → lstas h d G L (ⓝW.T) U
-.
-
-interpretation "nat-iterated static type assignment (term)"
- 'StaticTypeStar h G L d T U = (lstas h d G L T U).
-
-(* Basic inversion lemmas ***************************************************)
-
-fact lstas_inv_sort1_aux: ∀h,G,L,T,U,d. ⦃G, L⦄ ⊢ T •*[h, d] U → ∀s0. T = ⋆s0 →
- U = ⋆((next h)^d s0).
-#h #G #L #T #U #d * -G -L -T -U -d
-[ #G #L #d #s #s0 #H destruct //
-| #G #L #K #V #W #U #i #d #_ #_ #_ #s0 #H destruct
-| #G #L #K #W #V #i #_ #_ #s0 #H destruct
-| #G #L #K #W #V #U #i #d #_ #_ #_ #s0 #H destruct
-| #a #I #G #L #V #T #U #d #_ #s0 #H destruct
-| #G #L #V #T #U #d #_ #s0 #H destruct
-| #G #L #W #T #U #d #_ #s0 #H destruct
-qed-.
-
-(* Basic_1: was just: sty0_gen_sort *)
-lemma lstas_inv_sort1: ∀h,G,L,X,s,d. ⦃G, L⦄ ⊢ ⋆s •*[h, d] X → X = ⋆((next h)^d s).
-/2 width=5 by lstas_inv_sort1_aux/
-qed-.
-
-fact lstas_inv_lref1_aux: ∀h,G,L,T,U,d. ⦃G, L⦄ ⊢ T •*[h, d] U → ∀j. T = #j → ∨∨
- (∃∃K,V,W. ⬇[j] L ≡ K.ⓓV & ⦃G, K⦄ ⊢ V •*[h, d] W &
- ⬆[0, j+1] W ≡ U
- ) |
- (∃∃K,W,V. ⬇[j] L ≡ K.ⓛW & ⦃G, K⦄ ⊢ W •*[h, 0] V &
- U = #j & d = 0
- ) |
- (∃∃K,W,V,d0. ⬇[j] L ≡ K.ⓛW & ⦃G, K⦄ ⊢ W •*[h, d0] V &
- ⬆[0, j+1] V ≡ U & d = d0+1
- ).
-#h #G #L #T #U #d * -G -L -T -U -d
-[ #G #L #d #s #j #H destruct
-| #G #L #K #V #W #U #i #d #HLK #HVW #HWU #j #H destruct /3 width=6 by or3_intro0, ex3_3_intro/
-| #G #L #K #W #V #i #HLK #HWV #j #H destruct /3 width=5 by or3_intro1, ex4_3_intro/
-| #G #L #K #W #V #U #i #d #HLK #HWV #HWU #j #H destruct /3 width=8 by or3_intro2, ex4_4_intro/
-| #a #I #G #L #V #T #U #d #_ #j #H destruct
-| #G #L #V #T #U #d #_ #j #H destruct
-| #G #L #W #T #U #d #_ #j #H destruct
-]
-qed-.
-
-lemma lstas_inv_lref1: ∀h,G,L,X,i,d. ⦃G, L⦄ ⊢ #i •*[h, d] X → ∨∨
- (∃∃K,V,W. ⬇[i] L ≡ K.ⓓV & ⦃G, K⦄ ⊢ V •*[h, d] W &
- ⬆[0, i+1] W ≡ X
- ) |
- (∃∃K,W,V. ⬇[i] L ≡ K.ⓛW & ⦃G, K⦄ ⊢ W •*[h, 0] V &
- X = #i & d = 0
- ) |
- (∃∃K,W,V,d0. ⬇[i] L ≡ K.ⓛW & ⦃G, K⦄ ⊢ W •*[h, d0] V &
- ⬆[0, i+1] V ≡ X & d = d0+1
- ).
-/2 width=3 by lstas_inv_lref1_aux/
-qed-.
-
-lemma lstas_inv_lref1_O: ∀h,G,L,X,i. ⦃G, L⦄ ⊢ #i •*[h, 0] X →
- (∃∃K,V,W. ⬇[i] L ≡ K.ⓓV & ⦃G, K⦄ ⊢ V •*[h, 0] W &
- ⬆[0, i+1] W ≡ X
- ) ∨
- (∃∃K,W,V. ⬇[i] L ≡ K.ⓛW & ⦃G, K⦄ ⊢ W •*[h, 0] V &
- X = #i
- ).
-#h #G #L #X #i #H elim (lstas_inv_lref1 … H) -H * /3 width=6 by ex3_3_intro, or_introl, or_intror/
-#K #W #V #d #_ #_ #_ <plus_n_Sm #H destruct
-qed-.
-
-(* Basic_1: was just: sty0_gen_lref *)
-lemma lstas_inv_lref1_S: ∀h,G,L,X,i,d. ⦃G, L⦄ ⊢ #i •*[h, d+1] X →
- (∃∃K,V,W. ⬇[i] L ≡ K.ⓓV & ⦃G, K⦄ ⊢ V •*[h, d+1] W &
- ⬆[0, i+1] W ≡ X
- ) ∨
- (∃∃K,W,V. ⬇[i] L ≡ K.ⓛW & ⦃G, K⦄ ⊢ W •*[h, d] V &
- ⬆[0, i+1] V ≡ X
- ).
-#h #G #L #X #i #d #H elim (lstas_inv_lref1 … H) -H * /3 width=6 by ex3_3_intro, or_introl, or_intror/
-#K #W #V #_ #_ #_ <plus_n_Sm #H destruct
-qed-.
-
-fact lstas_inv_gref1_aux: ∀h,G,L,T,U,d. ⦃G, L⦄ ⊢ T •*[h, d] U → ∀p0. T = §p0 → ⊥.
-#h #G #L #T #U #d * -G -L -T -U -d
-[ #G #L #d #s #p0 #H destruct
-| #G #L #K #V #W #U #i #d #_ #_ #_ #p0 #H destruct
-| #G #L #K #W #V #i #_ #_ #p0 #H destruct
-| #G #L #K #W #V #U #i #d #_ #_ #_ #p0 #H destruct
-| #a #I #G #L #V #T #U #d #_ #p0 #H destruct
-| #G #L #V #T #U #d #_ #p0 #H destruct
-| #G #L #W #T #U #d #_ #p0 #H destruct
-qed-.
-
-lemma lstas_inv_gref1: ∀h,G,L,X,p,d. ⦃G, L⦄ ⊢ §p •*[h, d] X → ⊥.
-/2 width=9 by lstas_inv_gref1_aux/
-qed-.
-
-fact lstas_inv_bind1_aux: ∀h,G,L,T,U,d. ⦃G, L⦄ ⊢ T •*[h, d] U → ∀b,J,X,Y. T = ⓑ{b,J}Y.X →
- ∃∃Z. ⦃G, L.ⓑ{J}Y⦄ ⊢ X •*[h, d] Z & U = ⓑ{b,J}Y.Z.
-#h #G #L #T #U #d * -G -L -T -U -d
-[ #G #L #d #s #b #J #X #Y #H destruct
-| #G #L #K #V #W #U #i #d #_ #_ #_ #b #J #X #Y #H destruct
-| #G #L #K #W #V #i #_ #_ #b #J #X #Y #H destruct
-| #G #L #K #W #V #U #i #d #_ #_ #_ #b #J #X #Y #H destruct
-| #a #I #G #L #V #T #U #d #HTU #b #J #X #Y #H destruct /2 width=3 by ex2_intro/
-| #G #L #V #T #U #d #_ #b #J #X #Y #H destruct
-| #G #L #W #T #U #d #_ #b #J #X #Y #H destruct
-]
-qed-.
-
-(* Basic_1: was just: sty0_gen_bind *)
-lemma lstas_inv_bind1: ∀h,a,I,G,L,V,T,X,d. ⦃G, L⦄ ⊢ ⓑ{a,I}V.T •*[h, d] X →
- ∃∃U. ⦃G, L.ⓑ{I}V⦄ ⊢ T •*[h, d] U & X = ⓑ{a,I}V.U.
-/2 width=3 by lstas_inv_bind1_aux/
-qed-.
-
-fact lstas_inv_appl1_aux: ∀h,G,L,T,U,d. ⦃G, L⦄ ⊢ T •*[h, d] U → ∀X,Y. T = ⓐY.X →
- ∃∃Z. ⦃G, L⦄ ⊢ X •*[h, d] Z & U = ⓐY.Z.
-#h #G #L #T #U #d * -G -L -T -U -d
-[ #G #L #d #s #X #Y #H destruct
-| #G #L #K #V #W #U #i #d #_ #_ #_ #X #Y #H destruct
-| #G #L #K #W #V #i #_ #_ #X #Y #H destruct
-| #G #L #K #W #V #U #i #d #_ #_ #_ #X #Y #H destruct
-| #a #I #G #L #V #T #U #d #_ #X #Y #H destruct
-| #G #L #V #T #U #d #HTU #X #Y #H destruct /2 width=3 by ex2_intro/
-| #G #L #W #T #U #d #_ #X #Y #H destruct
-]
-qed-.
-
-(* Basic_1: was just: sty0_gen_appl *)
-lemma lstas_inv_appl1: ∀h,G,L,V,T,X,d. ⦃G, L⦄ ⊢ ⓐV.T •*[h, d] X →
- ∃∃U. ⦃G, L⦄ ⊢ T •*[h, d] U & X = ⓐV.U.
-/2 width=3 by lstas_inv_appl1_aux/
-qed-.
-
-fact lstas_inv_cast1_aux: ∀h,G,L,T,U,d. ⦃G, L⦄ ⊢ T •*[h, d] U → ∀X,Y. T = ⓝY.X →
- ⦃G, L⦄ ⊢ X •*[h, d] U.
-#h #G #L #T #U #d * -G -L -T -U -d
-[ #G #L #d #s #X #Y #H destruct
-| #G #L #K #V #W #U #i #d #_ #_ #_ #X #Y #H destruct
-| #G #L #K #W #V #i #_ #_ #X #Y #H destruct
-| #G #L #K #W #V #U #i #d #_ #_ #_ #X #Y #H destruct
-| #a #I #G #L #V #T #U #d #_ #X #Y #H destruct
-| #G #L #V #T #U #d #_ #X #Y #H destruct
-| #G #L #W #T #U #d #HTU #X #Y #H destruct //
-]
-qed-.
-
-(* Basic_1: was just: sty0_gen_cast *)
-lemma lstas_inv_cast1: ∀h,G,L,W,T,U,d. ⦃G, L⦄ ⊢ ⓝW.T •*[h, d] U → ⦃G, L⦄ ⊢ T •*[h, d] U.
-/2 width=4 by lstas_inv_cast1_aux/
-qed-.
-
-(* Basic_1: removed theorems 7:
- sty1_abbr sty1_appl sty1_bind sty1_cast2
- sty1_correct sty1_lift sty1_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/static/aaa_lift.ma".
-include "basic_2/unfold/lstas_lstas.ma".
-
-(* NAT-ITERATED STATIC TYPE ASSIGNMENT FOR TERMS ****************************)
-
-(* Properties on atomic arity assignment for terms **************************)
-
-lemma aaa_lstas: ∀h,G,L,T,A. ⦃G, L⦄ ⊢ T ⁝ A → ∀d.
- ∃∃U. ⦃G, L⦄ ⊢ T •*[h, d] U & ⦃G, L⦄ ⊢ U ⁝ A.
-#h #G #L #T #A #H elim H -G -L -T -A
-[ /2 width=3 by ex2_intro/
-| * #G #L #K #V #B #i #HLK #HV #IHV #d
- [ elim (IHV d) -IHV #W
- elim (lift_total W 0 (i+1))
- lapply (drop_fwd_drop2 … HLK)
- /3 width=10 by lstas_ldef, aaa_lift, ex2_intro/
- | @(nat_ind_plus … d) -d
- [ elim (IHV 0) -IHV /3 width=7 by lstas_zero, aaa_lref, ex2_intro/
- | #d #_ elim (IHV d) -IHV #W
- elim (lift_total W 0 (i+1))
- lapply (drop_fwd_drop2 … HLK)
- /3 width=10 by lstas_succ, aaa_lift, ex2_intro/
- ]
- ]
-| #a #G #L #V #T #B #A #HV #_ #_ #IHT #d elim (IHT d) -IHT
- /3 width=7 by lstas_bind, aaa_abbr, ex2_intro/
-| #a #G #L #V #T #B #A #HV #_ #_ #IHT #d elim (IHT d) -IHT
- /3 width=6 by lstas_bind, aaa_abst, ex2_intro/
-| #G #L #V #T #B #A #HV #_ #_ #IHT #d elim (IHT d) -IHT
- /3 width=6 by lstas_appl, aaa_appl, ex2_intro/
-| #G #L #W #T #A #HW #_ #_ #IHT #d elim (IHT d) -IHT
- /3 width=3 by lstas_cast, aaa_cast, ex2_intro/
-]
-qed-.
-
-lemma lstas_aaa_conf: ∀h,G,L,d. Conf3 … (aaa G L) (lstas h d G L).
-#h #G #L #d #A #T #HT #U #HTU
-elim (aaa_lstas h … HT d) -HT #X #HTX
-lapply (lstas_mono … HTX … HTU) -T //
-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/static/da_da.ma".
-include "basic_2/unfold/lstas_lstas.ma".
-
-(* NAT-ITERATED STATIC TYPE ASSIGNMENT FOR TERMS ****************************)
-
-(* Properties on degree assignment for terms ********************************)
-
-lemma da_lstas: ∀h,o,G,L,T,d1. ⦃G, L⦄ ⊢ T ▪[h, o] d1 → ∀d2.
- ∃∃U. ⦃G, L⦄ ⊢ T •*[h, d2] U & ⦃G, L⦄ ⊢ U ▪[h, o] d1-d2.
-#h #o #G #L #T #d1 #H elim H -G -L -T -d1
-[ /4 width=3 by da_sort, deg_iter, ex2_intro/
-| #G #L #K #V #i #d1 #HLK #_ #IHV #d2
- elim (IHV d2) -IHV #W
- elim (lift_total W 0 (i+1))
- lapply (drop_fwd_drop2 … HLK)
- /3 width=10 by lstas_ldef, da_lift, ex2_intro/
-| #G #L #K #W #i #d1 #HLK #HW #IHW #d2 @(nat_ind_plus … d2) -d2
- [ elim (IHW 0) -IHW /3 width=6 by lstas_zero, da_ldec, ex2_intro/
- | #d #_ elim (IHW d) -IHW #V
- elim (lift_total V 0 (i+1))
- lapply (drop_fwd_drop2 … HLK)
- /3 width=10 by lstas_succ, da_lift, ex2_intro/
- ]
-| #a #I #G #L #V #T #d1 #_ #IHT #d2 elim (IHT … d2) -IHT
- /3 width=6 by lstas_bind, da_bind, ex2_intro/
-| * #G #L #V #T #d1 #_ #IHT #d2 elim (IHT … d2) -IHT
- /3 width=5 by lstas_appl, lstas_cast, da_flat, ex2_intro/
-]
-qed-.
-
-lemma lstas_da_conf: ∀h,o,G,L,T,U,d2. ⦃G, L⦄ ⊢ T •*[h, d2] U →
- ∀d1. ⦃G, L⦄ ⊢ T ▪[h, o] d1 → ⦃G, L⦄ ⊢ U ▪[h, o] d1-d2.
-#h #o #G #L #T #U #d2 #HTU #d1 #HT
-elim (da_lstas … HT d2) -HT #X #HTX
-lapply (lstas_mono … HTX … HTU) -T //
-qed-.
-
-(* inversion lemmas on degree assignment for terms **************************)
-
-lemma lstas_inv_da: ∀h,o,G,L,T,U,d2. ⦃G, L⦄ ⊢ T •*[h, d2] U →
- ∃∃d1. ⦃G, L⦄ ⊢ T ▪[h, o] d1 & ⦃G, L⦄ ⊢ U ▪[h, o] d1-d2.
-#h #o #G #L #T #U #d2 #H elim H -G -L -T -U -d2
-[ #G #L #d2 #s elim (deg_total h o s) /4 width=3 by da_sort, deg_iter, ex2_intro/
-| #G #L #K #V #W #U #i #d2 #HLK #_ #HWU *
- lapply (drop_fwd_drop2 … HLK) /3 width=10 by da_lift, da_ldef, ex2_intro/
-| #G #L #K #W #V #i #HLK #_ * /3 width=6 by da_ldec, ex2_intro/
-| #G #L #K #W #V #U #i #d2 #HLK #_ #HVU *
- lapply (drop_fwd_drop2 … HLK) /3 width=10 by da_lift, da_ldec, ex2_intro/
-| #a #I #G #L #V #T #U #d2 #_ * /3 width=3 by da_bind, ex2_intro/
-| #G #L #V #T #U #d2 #_ * /3 width=3 by da_flat, ex2_intro/
-| #G #L #W #T #U #d2 #_ * /3 width=3 by da_flat, ex2_intro/
-]
-qed-.
-
-lemma lstas_inv_da_ge: ∀h,G,L,T,U,d2,d. ⦃G, L⦄ ⊢ T •*[h, d2] U →
- ∃∃o,d1. ⦃G, L⦄ ⊢ T ▪[h, o] d1 & ⦃G, L⦄ ⊢ U ▪[h, o] d1-d2 & d ≤ d1.
-#h #G #L #T #U #d2 #d #H elim H -G -L -T -U -d2
-[ /4 width=5 by da_sort, deg_iter, ex3_2_intro/
-| #G #L #K #V #W #U #i #d2 #HLK #_ #HWU *
- lapply (drop_fwd_drop2 … HLK) /3 width=10 by da_lift, da_ldef, ex3_2_intro/
-| #G #L #K #W #V #i #HLK #_ *
- #o #d1 #HW #HV #Hd1 /4 width=6 by da_ldec, lt_to_le, le_S_S, ex3_2_intro/
-| #G #L #K #W #V #U #i #d2 #HLK #_ #HVU *
- lapply (drop_fwd_drop2 … HLK)
- /4 width=10 by da_lift, da_ldec, lt_to_le, le_S_S, ex3_2_intro/
-| #a #I #G #L #V #T #U #d2 #_ * /3 width=5 by da_bind, ex3_2_intro/
-| #G #L #V #T #U #d2 #_ * /3 width=5 by da_flat, ex3_2_intro/
-| #G #L #W #T #U #d2 #_ * /3 width=5 by da_flat, ex3_2_intro/
-]
-qed-.
-
-(* Advanced inversion lemmas ************************************************)
-
-lemma lstas_inv_refl_pos: ∀h,G,L,T,d. ⦃G, L⦄ ⊢ T •*[h, d+1] T → ⊥.
-#h #G #L #T #d2 #H elim (lstas_inv_da_ge … (d2+1) H) -H
-#o #d1 #HT1 #HT12 #Hd21 lapply (da_mono … HT1 … HT12) -h -G -L -T
-#H elim (discr_x_minus_xy … H) -H
-[ #H destruct /2 width=3 by le_plus_xSy_O_false/
-| -d1 <plus_n_Sm #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 "ground_2/ynat/ynat_max.ma".
-include "basic_2/substitution/drop_drop.ma".
-include "basic_2/unfold/lstas.ma".
-
-(* NAT-ITERATED STATIC TYPE ASSIGNMENT FOR TERMS ****************************)
-
-(* Properties on relocation *************************************************)
-
-(* Basic_1: was just: sty0_lift *)
-lemma lstas_lift: ∀h,G,d. d_liftable (lstas h G d).
-#h #G #d #L1 #T1 #U1 #H elim H -G -L1 -T1 -U1 -d
-[ #G #L1 #d #s #L2 #c #l #k #HL21 #X1 #H1 #X2 #H2
- >(lift_inv_sort1 … H1) -X1
- >(lift_inv_sort1 … H2) -X2 //
-| #G #L1 #K1 #V1 #W1 #W #i #d #HLK1 #_ #HW1 #IHVW1 #L2 #c #l #k #HL21 #X #H #U2 #HWU2
- elim (lift_inv_lref1 … H) * #Hil #H destruct
- [ elim (lift_trans_ge … HW1 … HWU2) -W /2 width=1 by ylt_fwd_le_succ1/ #W2 #HW12 #HWU2
- elim (drop_trans_le … HL21 … HLK1) -L1 /2 width=2 by ylt_fwd_le/ #X #HLK2 #H
- elim (drop_inv_skip2 … H) -H /2 width=1 by ylt_to_minus/ -Hil #K2 #V2 #HK21 #HV12 #H destruct
- /3 width=9 by lstas_ldef/
- | lapply (lift_trans_be … HW1 … HWU2 ? ?) -W /2 width=1 by yle_succ_dx/ #HW1U2
- lapply (drop_trans_ge … HL21 … HLK1 ?) -L1 /3 width=9 by lstas_ldef, drop_inv_gen/
- ]
-| #G #L1 #K1 #V1 #W1 #i #HLK1 #_ #IHVW1 #L2 #c #l #k #HL21 #X #H #U2 #HWU2
- >(lift_mono … HWU2 … H) -U2
- elim (lift_inv_lref1 … H) * #Hil #H destruct
- [ elim (lift_total W1 (l-i-1) k) #W2 #HW12
- elim (drop_trans_le … HL21 … HLK1) -L1 /2 width=2 by ylt_fwd_le/ #X #HLK2 #H
- elim (drop_inv_skip2 … H) -H /2 width=1 by ylt_to_minus/ -Hil #K2 #V2 #HK21 #HV12 #H destruct
- /3 width=10 by lstas_zero/
- | lapply (drop_trans_ge … HL21 … HLK1 ?) -L1
- /3 width=10 by lstas_zero, drop_inv_gen/
- ]
-| #G #L1 #K1 #W1 #V1 #W #i #d #HLK1 #_ #HW1 #IHWV1 #L2 #c #l #k #HL21 #X #H #U2 #HWU2
- elim (lift_inv_lref1 … H) * #Hil #H destruct
- [ elim (lift_trans_ge … HW1 … HWU2) -W /2 width=1 by ylt_fwd_le_succ1/ #W #HW1 #HWU2
- elim (drop_trans_le … HL21 … HLK1) -L1 /2 width=2 by ylt_fwd_le/ #X #HLK2 #H
- elim (drop_inv_skip2 … H) -H /2 width=1 by ylt_to_minus/ -Hil #K2 #W2 #HK21 #HW12 #H destruct
- /3 width=9 by lstas_succ/
- | lapply (lift_trans_be … HW1 … HWU2 ? ?) -W /2 width=1 by yle_succ_dx/ #HW1U2
- lapply (drop_trans_ge … HL21 … HLK1 ?) -L1 /3 width=9 by lstas_succ, drop_inv_gen/
- ]
-| #a #I #G #L1 #V1 #T1 #U1 #d #_ #IHTU1 #L2 #c #l #k #HL21 #X1 #H1 #X2 #H2
- elim (lift_inv_bind1 … H1) -H1 #V2 #T2 #HV12 #HT12 #H destruct
- elim (lift_inv_bind1 … H2) -H2 #X #U2 #H1 #HU12 #H2 destruct
- lapply (lift_mono … H1 … HV12) -H1 #H destruct /4 width=6 by lstas_bind, drop_skip/
-| #G #L1 #V1 #T1 #U1 #d #_ #IHTU1 #L2 #c #l #k #HL21 #X1 #H1 #X2 #H2
- elim (lift_inv_flat1 … H1) -H1 #V2 #T2 #HV12 #HT12 #H destruct
- elim (lift_inv_flat1 … H2) -H2 #X #U2 #H1 #HU12 #H2 destruct
- lapply (lift_mono … H1 … HV12) -H1 #H destruct /4 width=6 by lstas_appl/
-| #G #L1 #W1 #T1 #U1 #d #_ #IHTU1 #L2 #c #l #k #HL21 #X #H #U2 #HU12
- elim (lift_inv_flat1 … H) -H #W2 #T2 #_ #HT12 #H destruct /3 width=6 by lstas_cast/
-]
-qed.
-
-(* Inversion lemmas on relocation *******************************************)
-
-(* Note: apparently this was missing in basic_1 *)
-lemma lstas_inv_lift1: ∀h,G,d. d_deliftable_sn (lstas h G d).
-#h #G #d #L2 #T2 #U2 #H elim H -G -L2 -T2 -U2 -d
-[ #G #L2 #d #s #L1 #c #l #k #_ #X #H
- >(lift_inv_sort2 … H) -X /2 width=3 by lstas_sort, lift_sort, ex2_intro/
-| #G #L2 #K2 #V2 #W2 #W #i #d #HLK2 #HVW2 #HW2 #IHVW2 #L1 #c #l #k #HL21 #X #H
- elim (lift_inv_lref2 … H) * #Hil #H destruct [ -HVW2 | -IHVW2 ]
- [ elim (drop_conf_lt … HL21 … HLK2) -L2 // #K1 #V1 #HLK1 #HK21 #HV12
- elim (IHVW2 … HK21 … HV12) -K2 -V2 #W1 #HW12 #HVW1
- elim (lift_trans_le … HW12 … HW2) -W2 // <yminus_succ2 <yplus_inj >yplus_SO2 >ymax_pre_sn /3 width=8 by lstas_ldef, ylt_fwd_le_succ1, ex2_intro/
- | lapply (drop_conf_ge … HL21 … HLK2 ?) -L2 // #HL1K2
- elim (yle_inv_plus_inj2 … Hil) -Hil #Hlim #mi
- elim (lift_split … HW2 l (i-k+1)) -HW2 /2 width=1 by yle_succ_dx, le_S_S/
- #W0 #HW20 <le_plus_minus_comm /2 width=1 by yle_inv_inj/ >minus_minus_k_k /3 width=8 by lstas_ldef, yle_inv_inj, le_S, ex2_intro/
- ]
-| #G #L2 #K2 #W2 #V2 #i #HLK2 #HWV2 #IHWV2 #L1 #c #l #k #HL21 #X #H
- elim (lift_inv_lref2 … H) * #Hil #H destruct [ -HWV2 | -IHWV2 ]
- [ elim (drop_conf_lt … HL21 … HLK2) -L2 // #K1 #W1 #HLK1 #HK21 #HW12
- elim (IHWV2 … HK21 … HW12) -K2
- /3 width=5 by lstas_zero, lift_lref_lt, ex2_intro/
- | lapply (drop_conf_ge … HL21 … HLK2 ?) -L2
- /3 width=5 by lstas_zero, lift_lref_ge_minus, ex2_intro/
- ]
-| #G #L2 #K2 #W2 #V2 #W #i #d #HLK2 #HWV2 #HW2 #IHWV2 #L1 #c #l #k #HL21 #X #H
- elim (lift_inv_lref2 … H) * #Hil #H destruct [ -HWV2 | -IHWV2 ]
- [ elim (drop_conf_lt … HL21 … HLK2) -L2 // #K1 #W1 #HLK1 #HK21 #HW12
- elim (IHWV2 … HK21 … HW12) -K2 #V1 #HV12 #HWV1
- elim (lift_trans_le … HV12 … HW2) -W2 // <yminus_succ2 <yplus_inj >yplus_SO2 >ymax_pre_sn /3 width=8 by lstas_succ, ylt_fwd_le_succ1, ex2_intro/
- | lapply (drop_conf_ge … HL21 … HLK2 ?) -L2 // #HL1K2
- elim (yle_inv_plus_inj2 … Hil) -Hil #Hlim #mi
- elim (lift_split … HW2 l (i-k+1)) -HW2 /2 width=1 by yle_succ_dx, le_S_S/
- #W0 #HW20 <le_plus_minus_comm /2 width=1 by yle_inv_inj/ >minus_minus_k_k /3 width=8 by lstas_succ, yle_inv_inj, le_S, ex2_intro/
- ]
-| #a #I #G #L2 #V2 #T2 #U2 #d #_ #IHTU2 #L1 #c #l #k #HL21 #X #H
- elim (lift_inv_bind2 … H) -H #V1 #T1 #HV12 #HT12 #H destruct
- elim (IHTU2 (L1.ⓑ{I}V1) … HT12) -IHTU2 -HT12 /3 width=5 by lstas_bind, drop_skip, lift_bind, ex2_intro/
-| #G #L2 #V2 #T2 #U2 #d #_ #IHTU2 #L1 #c #l #k #HL21 #X #H
- elim (lift_inv_flat2 … H) -H #V1 #T1 #HV12 #HT12 #H destruct
- elim (IHTU2 … HL21 … HT12) -L2 -HT12 /3 width=5 by lstas_appl, lift_flat, ex2_intro/
-| #G #L2 #W2 #T2 #U2 #d #_ #IHTU2 #L1 #c #l #k #HL21 #X #H
- elim (lift_inv_flat2 … H) -H #W1 #T1 #_ #HT12 #H destruct
- elim (IHTU2 … HL21 … HT12) -L2 -HT12 /3 width=3 by lstas_cast, ex2_intro/
-]
-qed-.
-
-(* Advanced inversion lemmas ************************************************)
-
-lemma lstas_split_aux: ∀h,G,L,T1,T2,d. ⦃G, L⦄ ⊢ T1 •*[h, d] T2 → ∀d1,d2. d = d1 + d2 →
- ∃∃T. ⦃G, L⦄ ⊢ T1 •*[h, d1] T & ⦃G, L⦄ ⊢ T •*[h, d2] T2.
-#h #G #L #T1 #T2 #d #H elim H -G -L -T1 -T2 -d
-[ #G #L #d #s #d1 #d2 #H destruct
- >commutative_plus >iter_plus /2 width=3 by lstas_sort, ex2_intro/
-| #G #L #K #V1 #V2 #U2 #i #d #HLK #_ #VU2 #IHV12 #d1 #d2 #H destruct
- elim (IHV12 d1 d2) -IHV12 // #V
- elim (lift_total V 0 (i+1))
- lapply (drop_fwd_drop2 … HLK)
- /3 width=12 by lstas_lift, lstas_ldef, ex2_intro/
-| #G #L #K #W1 #W2 #i #HLK #HW12 #_ #d1 #d2 #H
- elim (zero_eq_plus … H) -H #H1 #H2 destruct
- /3 width=5 by lstas_zero, ex2_intro/
-| #G #L #K #W1 #W2 #U2 #i #d #HLK #HW12 #HWU2 #IHW12 #d1 @(nat_ind_plus … d1) -d1
- [ #d2 normalize #H destruct
- elim (IHW12 0 d) -IHW12 //
- lapply (drop_fwd_drop2 … HLK)
- /3 width=8 by lstas_succ, lstas_zero, ex2_intro/
- | #d1 #_ #d2 <plus_plus_comm_23 #H lapply (injective_plus_l … H) -H #H
- elim (IHW12 … H) -d #W
- elim (lift_total W 0 (i+1))
- lapply (drop_fwd_drop2 … HLK)
- /3 width=12 by lstas_lift, lstas_succ, ex2_intro/
- ]
-| #a #I #G #L #V #T #U #d #_ #IHTU #d1 #d2 #H
- elim (IHTU … H) -d /3 width=3 by lstas_bind, ex2_intro/
-| #G #L #V #T #U #d #_ #IHTU #d1 #d2 #H
- elim (IHTU … H) -d /3 width=3 by lstas_appl, ex2_intro/
-| #G #L #W #T #U #d #_ #IHTU #d1 #d2 #H
- elim (IHTU … H) -d /3 width=3 by lstas_cast, ex2_intro/
-]
-qed-.
-
-lemma lstas_split: ∀h,G,L,T1,T2,d1,d2. ⦃G, L⦄ ⊢ T1 •*[h, d1 + d2] T2 →
- ∃∃T. ⦃G, L⦄ ⊢ T1 •*[h, d1] T & ⦃G, L⦄ ⊢ T •*[h, d2] T2.
-/2 width=3 by lstas_split_aux/ qed-.
-
-(* Advanced properties ******************************************************)
-
-lemma lstas_lstas: ∀h,G,L,T,T1,d1. ⦃G, L⦄ ⊢ T •*[h, d1] T1 →
- ∀d2. ∃T2. ⦃G, L⦄ ⊢ T •*[h, d2] T2.
-#h #G #L #T #T1 #d1 #H elim H -G -L -T -T1 -d1
-[ /2 width=2 by lstas_sort, ex_intro/
-| #G #L #K #V #V1 #U1 #i #d1 #HLK #_ #HVU1 #IHV1 #d2
- elim (IHV1 d2) -IHV1 #V2
- elim (lift_total V2 0 (i+1))
- /3 width=7 by ex_intro, lstas_ldef/
-| #G #L #K #W #W1 #i #HLK #HW1 #IHW1 #d2
- @(nat_ind_plus … d2) -d2 /3 width=5 by lstas_zero, ex_intro/
- #d2 #_ elim (IHW1 d2) -IHW1 #W2
- elim (lift_total W2 0 (i+1))
- /3 width=7 by lstas_succ, ex_intro/
-| #G #L #K #W #W1 #U1 #i #d #HLK #_ #_ #IHW1 #d2
- @(nat_ind_plus … d2) -d2
- [ elim (IHW1 0) -IHW1 /3 width=5 by lstas_zero, ex_intro/
- | #d2 #_ elim (IHW1 d2) -IHW1
- #W2 elim (lift_total W2 0 (i+1)) /3 width=7 by ex_intro, lstas_succ/
- ]
-| #a #I #G #L #V #T #U #d #_ #IHTU #d2
- elim (IHTU d2) -IHTU /3 width=2 by lstas_bind, ex_intro/
-| #G #L #V #T #U #d #_ #IHTU #d2
- elim (IHTU d2) -IHTU /3 width=2 by lstas_appl, ex_intro/
-| #G #L #W #T #U #d #_ #IHTU #d2
- elim (IHTU d2) -IHTU /3 width=2 by lstas_cast, 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/multiple/llpx_sn_drop.ma".
-include "basic_2/unfold/lstas.ma".
-
-(* NAT-ITERATED STATIC TYPE ASSIGNMENT FOR TERMS ****************************)
-
-(* Properties on lazy sn pointwise extensions *******************************)
-
-lemma lstas_llpx_sn_conf: ∀R. (∀L. reflexive … (R L)) → d_liftable R →
- ∀h,G,d. c_r_confluent1 … (lstas h d G) (llpx_sn R 0).
-#R #H1R #H2R #h #G #d #Ls #T1 #T2 #H elim H -G -Ls -T1 -T2 -d
-[ /3 width=4 by llpx_sn_fwd_length, llpx_sn_sort/
-| #G #Ls #Ks #V1c #V2c #W2c #i #d #HLKs #_ #HVW2c #IHV12c #Ld #H elim (llpx_sn_inv_lref_ge_sn … H … HLKs) // -H
- #Kd #V1l #HLKd #HV1c #HV1sd
- lapply (drop_fwd_drop2 … HLKs) -HLKs #HLKs
- lapply (drop_fwd_drop2 … HLKd) -HLKd #HLKd
- @(llpx_sn_lift_le … HLKs HLKd … HVW2c) -HLKs -HLKd -HVW2c /2 width=1 by/ (**) (* full auto too slow *)
-| //
-| #G #Ls #Ks #V1c #V2c #W2c #i #d #HLKs #_ #HVW2c #IHV12c #Ld #H elim (llpx_sn_inv_lref_ge_sn … H … HLKs) // -H
- #Kd #V1l #HLKd #HV1c #HV1sd
- lapply (drop_fwd_drop2 … HLKs) -HLKs #HLKs
- lapply (drop_fwd_drop2 … HLKd) -HLKd #HLKd
- @(llpx_sn_lift_le … HLKs HLKd … HVW2c) -HLKs -HLKd -HVW2c /2 width=1 by/ (**) (* full auto too slow *)
-| #a #I #G #Ls #V #T1 #T2 #d #_ #IHT12 #Ld #H elim (llpx_sn_inv_bind_O … H) -H
- /4 width=5 by llpx_sn_bind_repl_SO, llpx_sn_bind/
-| #G #Ls #V #T1 #T2 #d #_ #IHT12 #Ld #H elim (llpx_sn_inv_flat … H) -H
- /3 width=1 by llpx_sn_flat/
-| #G #Ls #V #T1 #T2 #d #_ #IHT12 #Ld #H elim (llpx_sn_inv_flat … H) -H
- /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/unfold/lstas_lift.ma".
-
-(* NAT-ITERATED STATIC TYPE ASSIGNMENT FOR TERMS ****************************)
-
-(* Main properties **********************************************************)
-
-theorem lstas_trans: ∀h,G,L,T1,T,d1. ⦃G, L⦄ ⊢ T1 •*[h, d1] T →
- ∀T2,d2. ⦃G, L⦄ ⊢ T •*[h, d2] T2 → ⦃G, L⦄ ⊢ T1 •*[h, d1+d2] T2.
-#h #G #L #T1 #T #d1 #H elim H -G -L -T1 -T -d1
-[ #G #L #d1 #s #X #d2 #H >(lstas_inv_sort1 … H) -X
- <iter_plus /2 width=1 by lstas_sort/
-| #G #L #K #V1 #V #U #i #d1 #HLK #_ #HVU #IHV1 #U2 #d2 #HU2
- lapply (drop_fwd_drop2 … HLK) #H0
- elim (lstas_inv_lift1 … HU2 … H0 … HVU)
- /3 width=6 by lstas_ldef/
-| //
-| #G #L #K #W1 #W #U #i #d1 #HLK #_ #HWU #IHW1 #U2 #d2 #HU2
- lapply (drop_fwd_drop2 … HLK) #H0
- elim (lstas_inv_lift1 … HU2 … H0 … HWU)
- /3 width=6 by lstas_succ/
-| #a #I #G #L #V #T1 #T #d1 #_ #IHT1 #X #d2 #H
- elim (lstas_inv_bind1 … H) -H #T2 #HT2 #H destruct
- /3 width=1 by lstas_bind/
-| #G #L #V #T1 #T #d1 #_ #IHT1 #X #d2 #H
- elim (lstas_inv_appl1 … H) -H #T2 #HT2 #H destruct
- /3 width=1 by lstas_appl/
-| /3 width=1 by lstas_cast/
-]
-qed-.
-
-(* Note: apparently this was missing in basic_1 *)
-theorem lstas_mono: ∀h,G,L,d. singlevalued … (lstas h d G L).
-#h #G #L #d #T #T1 #H elim H -G -L -T -T1 -d
-[ #G #L #d #s #X #H >(lstas_inv_sort1 … H) -X //
-| #G #L #K #V #V1 #U1 #i #d #HLK #_ #HVU1 #IHV1 #X #H
- elim (lstas_inv_lref1 … H) -H *
- #K0 #V0 #W0 [3: #d0 ] #HLK0
- lapply (drop_mono … HLK0 … HLK) -HLK -HLK0 #H destruct
- #HVW0 #HX lapply (IHV1 … HVW0) -IHV1 -HVW0 #H destruct
- /2 width=5 by lift_mono/
-| #G #L #K #W #W1 #i #HLK #_ #_ #X #H
- elim (lstas_inv_lref1_O … H) -H *
- #K0 #V0 #W0 #HLK0
- lapply (drop_mono … HLK0 … HLK) -HLK -HLK0 #H destruct //
-| #G #L #K #W #W1 #U1 #i #d #HLK #_ #HWU1 #IHWV #X #H
- elim (lstas_inv_lref1_S … H) -H * #K0 #W0 #V0 #HLK0
- lapply (drop_mono … HLK0 … HLK) -HLK -HLK0 #H destruct
- #HW0 #HX lapply (IHWV … HW0) -IHWV -HW0 #H destruct
- /2 width=5 by lift_mono/
-| #a #I #G #L #V #T #U1 #d #_ #IHTU1 #X #H
- elim (lstas_inv_bind1 … H) -H #U2 #HTU2 #H destruct /3 width=1 by eq_f/
-| #G #L #V #T #U1 #d #_ #IHTU1 #X #H
- elim (lstas_inv_appl1 … H) -H #U2 #HTU2 #H destruct /3 width=1 by eq_f/
-| #G #L #W #T #U1 #d #_ #IHTU1 #U2 #H
- lapply (lstas_inv_cast1 … H) -H /2 width=1 by/
-]
-qed-.
-
-(* Advanced inversion lemmas ************************************************)
-
-(* Basic_1: was just: sty0_correct *)
-lemma lstas_correct: ∀h,G,L,T1,T,d1. ⦃G, L⦄ ⊢ T1 •*[h, d1] T →
- ∀d2. ∃T2. ⦃G, L⦄ ⊢ T •*[h, d2] T2.
-#h #G #L #T1 #T #d1 #H elim H -G -L -T1 -T -d1
-[ /2 width=2 by lstas_sort, ex_intro/
-| #G #L #K #V1 #V #U #i #d #HLK #_ #HVU #IHV1 #d2
- elim (IHV1 d2) -IHV1 #V2
- elim (lift_total V2 0 (i+1))
- lapply (drop_fwd_drop2 … HLK) -HLK
- /3 width=11 by ex_intro, lstas_lift/
-| #G #L #K #W1 #W #i #HLK #HW1 #IHW1 #d2
- @(nat_ind_plus … d2) -d2 /3 width=5 by lstas_zero, ex_intro/
- #d2 #_ elim (IHW1 d2) -IHW1 #W2 #HW2
- lapply (lstas_trans … HW1 … HW2) -W
- elim (lift_total W2 0 (i+1))
- /3 width=7 by lstas_succ, ex_intro/
-| #G #L #K #W1 #W #U #i #d #HLK #_ #HWU #IHW1 #d2
- elim (IHW1 d2) -IHW1 #W2
- elim (lift_total W2 0 (i+1))
- lapply (drop_fwd_drop2 … HLK) -HLK
- /3 width=11 by ex_intro, lstas_lift/
-| #a #I #G #L #V #T #U #d #_ #IHTU #d2
- elim (IHTU d2) -IHTU /3 width=2 by lstas_bind, ex_intro/
-| #G #L #V #T #U #d #_ #IHTU #d2
- elim (IHTU d2) -IHTU /3 width=2 by lstas_appl, ex_intro/
-| #G #L #W #T #U #d #_ #IHTU #d2
- elim (IHTU d2) -IHTU /2 width=2 by ex_intro/
-]
-qed-.
-
-(* more main properties *****************************************************)
-
-theorem lstas_conf_le: ∀h,G,L,T,U1,d1. ⦃G, L⦄ ⊢ T •*[h, d1] U1 →
- ∀U2,d2. d1 ≤ d2 → ⦃G, L⦄ ⊢ T •*[h, d2] U2 →
- ⦃G, L⦄ ⊢ U1 •*[h, d2-d1] U2.
-#h #G #L #T #U1 #d1 #HTU1 #U2 #d2 #Hd12
->(plus_minus_k_k … Hd12) in ⊢ (%→?); -Hd12 >commutative_plus #H
-elim (lstas_split … H) -H #U #HTU
->(lstas_mono … HTU … HTU1) -T //
-qed-.
-
-theorem lstas_conf: ∀h,G,L,T0,T1,d1. ⦃G, L⦄ ⊢ T0 •*[h, d1] T1 →
- ∀T2,d2. ⦃G, L⦄ ⊢ T0 •*[h, d2] T2 →
- ∃∃T. ⦃G, L⦄ ⊢ T1 •*[h, d2] T & ⦃G, L⦄ ⊢ T2 •*[h, d1] T.
-#h #G #L #T0 #T1 #d1 #HT01 #T2 #d2 #HT02
-elim (lstas_lstas … HT01 (d1+d2)) #T #HT0
-lapply (lstas_conf_le … HT01 … HT0) // -HT01 <minus_plus_k_k_commutative
-lapply (lstas_conf_le … HT02 … HT0) // -T0 <minus_plus_k_k
-/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 *)
-(* *)
-(**************************************************************************)
-
-(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
-
-notation "hvbox( ⦃ term 46 G , break term 46 L ⦄ ⊢ break term 46 T1 •* break [ term 46 o , break term 46 n ] break term 46 T2 )"
- non associative with precedence 45
- for @{ 'StaticTypeStar $h $G $L $n $T1 $T2 }.
+++ /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 *)
-(* *)
-(**************************************************************************)
-
-(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
-
-notation "hvbox( G ⊢ break term 46 L1 ⫃ ▪ break [ term 46 o, break term 46 h ] break term 46 L2 )"
- non associative with precedence 45
- for @{ 'LRSubEqD $h $o $G $L1 $L2 }.
+++ /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/lrsubeqd_5.ma".
-include "basic_2/static/lsubr.ma".
-include "basic_2/static/da.ma".
-
-(* LOCAL ENVIRONMENT REFINEMENT FOR DEGREE ASSIGNMENT ***********************)
-
-inductive lsubd (h) (o) (G): relation lenv ≝
-| lsubd_atom: lsubd h o G (⋆) (⋆)
-| lsubd_pair: ∀I,L1,L2,V. lsubd h o G L1 L2 →
- lsubd h o G (L1.ⓑ{I}V) (L2.ⓑ{I}V)
-| lsubd_beta: ∀L1,L2,W,V,d. ⦃G, L1⦄ ⊢ V ▪[h, o] d+1 → ⦃G, L2⦄ ⊢ W ▪[h, o] d →
- lsubd h o G L1 L2 → lsubd h o G (L1.ⓓⓝW.V) (L2.ⓛW)
-.
-
-interpretation
- "local environment refinement (degree assignment)"
- 'LRSubEqD h o G L1 L2 = (lsubd h o G L1 L2).
-
-(* Basic forward lemmas *****************************************************)
-
-lemma lsubd_fwd_lsubr: ∀h,o,G,L1,L2. G ⊢ L1 ⫃▪[h, o] L2 → L1 ⫃ L2.
-#h #o #G #L1 #L2 #H elim H -L1 -L2 /2 width=1 by lsubr_pair, lsubr_beta/
-qed-.
-
-(* Basic inversion lemmas ***************************************************)
-
-fact lsubd_inv_atom1_aux: ∀h,o,G,L1,L2. G ⊢ L1 ⫃▪[h, o] L2 → L1 = ⋆ → L2 = ⋆.
-#h #o #G #L1 #L2 * -L1 -L2
-[ //
-| #I #L1 #L2 #V #_ #H destruct
-| #L1 #L2 #W #V #d #_ #_ #_ #H destruct
-]
-qed-.
-
-lemma lsubd_inv_atom1: ∀h,o,G,L2. G ⊢ ⋆ ⫃▪[h, o] L2 → L2 = ⋆.
-/2 width=6 by lsubd_inv_atom1_aux/ qed-.
-
-fact lsubd_inv_pair1_aux: ∀h,o,G,L1,L2. G ⊢ L1 ⫃▪[h, o] L2 →
- ∀I,K1,X. L1 = K1.ⓑ{I}X →
- (∃∃K2. G ⊢ K1 ⫃▪[h, o] K2 & L2 = K2.ⓑ{I}X) ∨
- ∃∃K2,W,V,d. ⦃G, K1⦄ ⊢ V ▪[h, o] d+1 & ⦃G, K2⦄ ⊢ W ▪[h, o] d &
- G ⊢ K1 ⫃▪[h, o] K2 &
- I = Abbr & L2 = K2.ⓛW & X = ⓝW.V.
-#h #o #G #L1 #L2 * -L1 -L2
-[ #J #K1 #X #H destruct
-| #I #L1 #L2 #V #HL12 #J #K1 #X #H destruct /3 width=3 by ex2_intro, or_introl/
-| #L1 #L2 #W #V #d #HV #HW #HL12 #J #K1 #X #H destruct /3 width=9 by ex6_4_intro, or_intror/
-]
-qed-.
-
-lemma lsubd_inv_pair1: ∀h,o,I,G,K1,L2,X. G ⊢ K1.ⓑ{I}X ⫃▪[h, o] L2 →
- (∃∃K2. G ⊢ K1 ⫃▪[h, o] K2 & L2 = K2.ⓑ{I}X) ∨
- ∃∃K2,W,V,d. ⦃G, K1⦄ ⊢ V ▪[h, o] d+1 & ⦃G, K2⦄ ⊢ W ▪[h, o] d &
- G ⊢ K1 ⫃▪[h, o] K2 &
- I = Abbr & L2 = K2.ⓛW & X = ⓝW.V.
-/2 width=3 by lsubd_inv_pair1_aux/ qed-.
-
-fact lsubd_inv_atom2_aux: ∀h,o,G,L1,L2. G ⊢ L1 ⫃▪[h, o] L2 → L2 = ⋆ → L1 = ⋆.
-#h #o #G #L1 #L2 * -L1 -L2
-[ //
-| #I #L1 #L2 #V #_ #H destruct
-| #L1 #L2 #W #V #d #_ #_ #_ #H destruct
-]
-qed-.
-
-lemma lsubd_inv_atom2: ∀h,o,G,L1. G ⊢ L1 ⫃▪[h, o] ⋆ → L1 = ⋆.
-/2 width=6 by lsubd_inv_atom2_aux/ qed-.
-
-fact lsubd_inv_pair2_aux: ∀h,o,G,L1,L2. G ⊢ L1 ⫃▪[h, o] L2 →
- ∀I,K2,W. L2 = K2.ⓑ{I}W →
- (∃∃K1. G ⊢ K1 ⫃▪[h, o] K2 & L1 = K1.ⓑ{I}W) ∨
- ∃∃K1,V,d. ⦃G, K1⦄ ⊢ V ▪[h, o] d+1 & ⦃G, K2⦄ ⊢ W ▪[h, o] d &
- G ⊢ K1 ⫃▪[h, o] K2 & I = Abst & L1 = K1. ⓓⓝW.V.
-#h #o #G #L1 #L2 * -L1 -L2
-[ #J #K2 #U #H destruct
-| #I #L1 #L2 #V #HL12 #J #K2 #U #H destruct /3 width=3 by ex2_intro, or_introl/
-| #L1 #L2 #W #V #d #HV #HW #HL12 #J #K2 #U #H destruct /3 width=7 by ex5_3_intro, or_intror/
-]
-qed-.
-
-lemma lsubd_inv_pair2: ∀h,o,I,G,L1,K2,W. G ⊢ L1 ⫃▪[h, o] K2.ⓑ{I}W →
- (∃∃K1. G ⊢ K1 ⫃▪[h, o] K2 & L1 = K1.ⓑ{I}W) ∨
- ∃∃K1,V,d. ⦃G, K1⦄ ⊢ V ▪[h, o] d+1 & ⦃G, K2⦄ ⊢ W ▪[h, o] d &
- G ⊢ K1 ⫃▪[h, o] K2 & I = Abst & L1 = K1. ⓓⓝW.V.
-/2 width=3 by lsubd_inv_pair2_aux/ qed-.
-
-(* Basic properties *********************************************************)
-
-lemma lsubd_refl: ∀h,o,G,L. G ⊢ L ⫃▪[h, o] L.
-#h #o #G #L elim L -L /2 width=1 by lsubd_pair/
-qed.
-
-(* Note: the constant 0 cannot be generalized *)
-lemma lsubd_drop_O1_conf: ∀h,o,G,L1,L2. G ⊢ L1 ⫃▪[h, o] L2 →
- ∀K1,c,k. ⬇[c, 0, k] L1 ≡ K1 →
- ∃∃K2. G ⊢ K1 ⫃▪[h, o] K2 & ⬇[c, 0, k] L2 ≡ K2.
-#h #o #G #L1 #L2 #H elim H -L1 -L2
-[ /2 width=3 by ex2_intro/
-| #I #L1 #L2 #V #_ #IHL12 #K1 #c #k #H
- elim (drop_inv_O1_pair1 … H) -H * #Hm #HLK1
- [ destruct
- elim (IHL12 L1 c 0) -IHL12 // #X #HL12 #H
- <(drop_inv_O2 … H) in HL12; -H /3 width=3 by lsubd_pair, drop_pair, ex2_intro/
- | elim (IHL12 … HLK1) -L1 /3 width=3 by drop_drop_lt, ex2_intro/
- ]
-| #L1 #L2 #W #V #d #HV #HW #_ #IHL12 #K1 #c #k #H
- elim (drop_inv_O1_pair1 … H) -H * #Hm #HLK1
- [ destruct
- elim (IHL12 L1 c 0) -IHL12 // #X #HL12 #H
- <(drop_inv_O2 … H) in HL12; -H /3 width=3 by lsubd_beta, drop_pair, ex2_intro/
- | elim (IHL12 … HLK1) -L1 /3 width=3 by drop_drop_lt, ex2_intro/
- ]
-]
-qed-.
-
-(* Note: the constant 0 cannot be generalized *)
-lemma lsubd_drop_O1_trans: ∀h,o,G,L1,L2. G ⊢ L1 ⫃▪[h, o] L2 →
- ∀K2,c,k. ⬇[c, 0, k] L2 ≡ K2 →
- ∃∃K1. G ⊢ K1 ⫃▪[h, o] K2 & ⬇[c, 0, k] L1 ≡ K1.
-#h #o #G #L1 #L2 #H elim H -L1 -L2
-[ /2 width=3 by ex2_intro/
-| #I #L1 #L2 #V #_ #IHL12 #K2 #c #k #H
- elim (drop_inv_O1_pair1 … H) -H * #Hm #HLK2
- [ destruct
- elim (IHL12 L2 c 0) -IHL12 // #X #HL12 #H
- <(drop_inv_O2 … H) in HL12; -H /3 width=3 by lsubd_pair, drop_pair, ex2_intro/
- | elim (IHL12 … HLK2) -L2 /3 width=3 by drop_drop_lt, ex2_intro/
- ]
-| #L1 #L2 #W #V #d #HV #HW #_ #IHL12 #K2 #c #k #H
- elim (drop_inv_O1_pair1 … H) -H * #Hm #HLK2
- [ destruct
- elim (IHL12 L2 c 0) -IHL12 // #X #HL12 #H
- <(drop_inv_O2 … H) in HL12; -H /3 width=3 by lsubd_beta, drop_pair, ex2_intro/
- | elim (IHL12 … HLK2) -L2 /3 width=3 by drop_drop_lt, 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/static/da_da.ma".
-include "basic_2/static/lsubd.ma".
-
-(* LOCAL ENVIRONMENT REFINEMENT FOR DEGREE ASSIGNMENT ***********************)
-
-(* Properties on degree assignment ******************************************)
-
-lemma lsubd_da_trans: ∀h,o,G,L2,T,d. ⦃G, L2⦄ ⊢ T ▪[h, o] d →
- ∀L1. G ⊢ L1 ⫃▪[h, o] L2 → ⦃G, L1⦄ ⊢ T ▪[h, o] d.
-#h #o #G #L2 #T #d #H elim H -G -L2 -T -d
-[ /2 width=1 by da_sort/
-| #G #L2 #K2 #V #i #d #HLK2 #_ #IHV #L1 #HL12
- elim (lsubd_drop_O1_trans … HL12 … HLK2) -L2 #X #H #HLK1
- elim (lsubd_inv_pair2 … H) -H * #K1 [ | -IHV -HLK1 ]
- [ #HK12 #H destruct /3 width=4 by da_ldef/
- | #W #d0 #_ #_ #_ #H destruct
- ]
-| #G #L2 #K2 #W #i #d #HLK2 #HW #IHW #L1 #HL12
- elim (lsubd_drop_O1_trans … HL12 … HLK2) -L2 #X #H #HLK1
- elim (lsubd_inv_pair2 … H) -H * #K1 [ -HW | -IHW ]
- [ #HK12 #H destruct /3 width=4 by da_ldec/
- | #V #d0 #HV #H0W #_ #_ #H destruct
- lapply (da_mono … H0W … HW) -H0W -HW #H destruct /3 width=7 by da_ldef, da_flat/
- ]
-| /4 width=1 by lsubd_pair, da_bind/
-| /3 width=1 by da_flat/
-]
-qed-.
-
-lemma lsubd_da_conf: ∀h,o,G,L1,T,d. ⦃G, L1⦄ ⊢ T ▪[h, o] d →
- ∀L2. G ⊢ L1 ⫃▪[h, o] L2 → ⦃G, L2⦄ ⊢ T ▪[h, o] d.
-#h #o #G #L1 #T #d #H elim H -G -L1 -T -d
-[ /2 width=1 by da_sort/
-| #G #L1 #K1 #V #i #d #HLK1 #HV #IHV #L2 #HL12
- elim (lsubd_drop_O1_conf … HL12 … HLK1) -L1 #X #H #HLK2
- elim (lsubd_inv_pair1 … H) -H * #K2 [ -HV | -IHV ]
- [ #HK12 #H destruct /3 width=4 by da_ldef/
- | #W0 #V0 #d0 #HV0 #HW0 #_ #_ #H1 #H2 destruct
- lapply (da_inv_flat … HV) -HV #H0V0
- lapply (da_mono … H0V0 … HV0) -H0V0 -HV0 #H destruct /2 width=4 by da_ldec/
- ]
-| #G #L1 #K1 #W #i #d #HLK1 #HW #IHW #L2 #HL12
- elim (lsubd_drop_O1_conf … HL12 … HLK1) -L1 #X #H #HLK2
- elim (lsubd_inv_pair1 … H) -H * #K2 [ -HW | -IHW ]
- [ #HK12 #H destruct /3 width=4 by da_ldec/
- | #W0 #V0 #d0 #HV0 #HW0 #_ #H destruct
- ]
-| /4 width=1 by lsubd_pair, da_bind/
-| /3 width=1 by da_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/static/lsubd_da.ma".
-
-(* LOCAL ENVIRONMENT REFINEMENT FOR DEGREE ASSIGNMENT ***********************)
-
-(* Main properties **********************************************************)
-
-theorem lsubd_trans: ∀h,o,G. Transitive … (lsubd h o G).
-#h #o #G #L1 #L #H elim H -L1 -L
-[ #X #H >(lsubd_inv_atom1 … H) -H //
-| #I #L1 #L #Y #HL1 #IHL1 #X #H
- elim (lsubd_inv_pair1 … H) -H * #L2
- [ #HL2 #H destruct /3 width=1 by lsubd_pair/
- | #W #V #d #HV #HW #HL2 #H1 #H2 #H3 destruct
- /3 width=3 by lsubd_beta, lsubd_da_trans/
- ]
-| #L1 #L #W #V #d #HV #HW #HL1 #IHL1 #X #H
- elim (lsubd_inv_pair1 … H) -H * #L2
- [ #HL2 #H destruct /3 width=5 by lsubd_beta, lsubd_da_conf/
- | #W0 #V0 #d0 #_ #_ #_ #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/notation/relations/lrsubeq_4.ma".
-include "basic_2/substitution/drop.ma".
-
-(* LOCAL ENVIRONMENT REFINEMENT FOR EXTENDED SUBSTITUTION *******************)
-
-inductive lsuby: relation4 ynat ynat lenv lenv ≝
-| lsuby_atom: ∀L,l,m. lsuby l m L (⋆)
-| lsuby_zero: ∀I1,I2,L1,L2,V1,V2.
- lsuby 0 0 L1 L2 → lsuby 0 0 (L1.ⓑ{I1}V1) (L2.ⓑ{I2}V2)
-| lsuby_pair: ∀I1,I2,L1,L2,V,m. lsuby 0 m L1 L2 →
- lsuby 0 (⫯m) (L1.ⓑ{I1}V) (L2.ⓑ{I2}V)
-| lsuby_succ: ∀I1,I2,L1,L2,V1,V2,l,m.
- lsuby l m L1 L2 → lsuby (⫯l) m (L1.ⓑ{I1}V1) (L2.ⓑ{I2}V2)
-.
-
-interpretation
- "local environment refinement (extended substitution)"
- 'LRSubEq L1 l m L2 = (lsuby l m L1 L2).
-
-(* Basic properties *********************************************************)
-
-lemma lsuby_pair_lt: ∀I1,I2,L1,L2,V,m. L1 ⊆[0, ⫰m] L2 → 0 < m →
- L1.ⓑ{I1}V ⊆[0, m] L2.ⓑ{I2}V.
-#I1 #I2 #L1 #L2 #V #m #HL12 #Hm <(ylt_inv_O1 … Hm) /2 width=1 by lsuby_pair/
-qed.
-
-lemma lsuby_succ_lt: ∀I1,I2,L1,L2,V1,V2,l,m. L1 ⊆[⫰l, m] L2 → 0 < l →
- L1.ⓑ{I1}V1 ⊆[l, m] L2. ⓑ{I2}V2.
-#I1 #I2 #L1 #L2 #V1 #V2 #l #m #HL12 #Hl <(ylt_inv_O1 … Hl) /2 width=1 by lsuby_succ/
-qed.
-
-lemma lsuby_pair_O_Y: ∀L1,L2. L1 ⊆[0, ∞] L2 →
- ∀I1,I2,V. L1.ⓑ{I1}V ⊆[0,∞] L2.ⓑ{I2}V.
-#L1 #L2 #HL12 #I1 #I2 #V lapply (lsuby_pair I1 I2 … V … HL12) -HL12 //
-qed.
-
-lemma lsuby_refl: ∀L,l,m. L ⊆[l, m] L.
-#L elim L -L //
-#L #I #V #IHL #l elim (ynat_cases … l) [| * #x ]
-#Hl destruct /2 width=1 by lsuby_succ/
-#m elim (ynat_cases … m) [| * #x ]
-#Hm destruct /2 width=1 by lsuby_zero, lsuby_pair/
-qed.
-
-lemma lsuby_O2: ∀L2,L1,l. |L2| ≤ |L1| → L1 ⊆[l, 0] L2.
-#L2 elim L2 -L2 // #L2 #I2 #V2 #IHL2 *
-[ #l #H elim (ylt_yle_false … H) -H //
-| #L1 #I1 #V1 #l
- #H lapply (yle_inv_succ … H) -H #HL12
- elim (ynat_cases l) /3 width=1 by lsuby_zero/
- * /3 width=1 by lsuby_succ/
-]
-qed.
-
-lemma lsuby_sym: ∀l,m,L1,L2. L1 ⊆[l, m] L2 → |L1| = |L2| → L2 ⊆[l, m] L1.
-#l #m #L1 #L2 #H elim H -l -m -L1 -L2
-[ #L1 #l #m #H >(length_inv_zero_dx … H) -L1 //
-| /2 width=1 by lsuby_O2/
-| #I1 #I2 #L1 #L2 #V #m #_ #IHL12 #H lapply (ysucc_inv_inj … H) -H
- /3 width=1 by lsuby_pair/
-| #I1 #I2 #L1 #L2 #V1 #V2 #l #m #_ #IHL12 #H lapply (ysucc_inv_inj … H) -H
- /3 width=1 by lsuby_succ/
-]
-qed-.
-
-(* Basic inversion lemmas ***************************************************)
-
-fact lsuby_inv_atom1_aux: ∀L1,L2,l,m. L1 ⊆[l, m] L2 → L1 = ⋆ → L2 = ⋆.
-#L1 #L2 #l #m * -L1 -L2 -l -m //
-[ #I1 #I2 #L1 #L2 #V1 #V2 #_ #H destruct
-| #I1 #I2 #L1 #L2 #V #m #_ #H destruct
-| #I1 #I2 #L1 #L2 #V1 #V2 #l #m #_ #H destruct
-]
-qed-.
-
-lemma lsuby_inv_atom1: ∀L2,l,m. ⋆ ⊆[l, m] L2 → L2 = ⋆.
-/2 width=5 by lsuby_inv_atom1_aux/ qed-.
-
-fact lsuby_inv_zero1_aux: ∀L1,L2,l,m. L1 ⊆[l, m] L2 →
- ∀J1,K1,W1. L1 = K1.ⓑ{J1}W1 → l = 0 → m = 0 →
- L2 = ⋆ ∨
- ∃∃J2,K2,W2. K1 ⊆[0, 0] K2 & L2 = K2.ⓑ{J2}W2.
-#L1 #L2 #l #m * -L1 -L2 -l -m /2 width=1 by or_introl/
-[ #I1 #I2 #L1 #L2 #V1 #V2 #HL12 #J1 #K1 #W1 #H #_ #_ destruct
- /3 width=5 by ex2_3_intro, or_intror/
-| #I1 #I2 #L1 #L2 #V #m #_ #J1 #K1 #W1 #_ #_ #H
- elim (ysucc_inv_O_dx … H)
-| #I1 #I2 #L1 #L2 #V1 #V2 #l #m #_ #J1 #K1 #W1 #_ #H
- elim (ysucc_inv_O_dx … H)
-]
-qed-.
-
-lemma lsuby_inv_zero1: ∀I1,K1,L2,V1. K1.ⓑ{I1}V1 ⊆[0, 0] L2 →
- L2 = ⋆ ∨
- ∃∃I2,K2,V2. K1 ⊆[0, 0] K2 & L2 = K2.ⓑ{I2}V2.
-/2 width=9 by lsuby_inv_zero1_aux/ qed-.
-
-fact lsuby_inv_pair1_aux: ∀L1,L2,l,m. L1 ⊆[l, m] L2 →
- ∀J1,K1,W. L1 = K1.ⓑ{J1}W → l = 0 → 0 < m →
- L2 = ⋆ ∨
- ∃∃J2,K2. K1 ⊆[0, ⫰m] K2 & L2 = K2.ⓑ{J2}W.
-#L1 #L2 #l #m * -L1 -L2 -l -m /2 width=1 by or_introl/
-[ #I1 #I2 #L1 #L2 #V1 #V2 #_ #J1 #K1 #W #_ #_ #H
- elim (ylt_yle_false … H) //
-| #I1 #I2 #L1 #L2 #V #m #HL12 #J1 #K1 #W #H #_ #_ destruct
- /3 width=4 by ex2_2_intro, or_intror/
-| #I1 #I2 #L1 #L2 #V1 #V2 #l #m #_ #J1 #K1 #W #_ #H
- elim (ysucc_inv_O_dx … H)
-]
-qed-.
-
-lemma lsuby_inv_pair1: ∀I1,K1,L2,V,m. K1.ⓑ{I1}V ⊆[0, m] L2 → 0 < m →
- L2 = ⋆ ∨
- ∃∃I2,K2. K1 ⊆[0, ⫰m] K2 & L2 = K2.ⓑ{I2}V.
-/2 width=6 by lsuby_inv_pair1_aux/ qed-.
-
-fact lsuby_inv_succ1_aux: ∀L1,L2,l,m. L1 ⊆[l, m] L2 →
- ∀J1,K1,W1. L1 = K1.ⓑ{J1}W1 → 0 < l →
- L2 = ⋆ ∨
- ∃∃J2,K2,W2. K1 ⊆[⫰l, m] K2 & L2 = K2.ⓑ{J2}W2.
-#L1 #L2 #l #m * -L1 -L2 -l -m /2 width=1 by or_introl/
-[ #I1 #I2 #L1 #L2 #V1 #V2 #_ #J1 #K1 #W1 #_ #H
- elim (ylt_yle_false … H) //
-| #I1 #I2 #L1 #L2 #V #m #_ #J1 #K1 #W1 #_ #H
- elim (ylt_yle_false … H) //
-| #I1 #I2 #L1 #L2 #V1 #V2 #l #m #HL12 #J1 #K1 #W1 #H #_ destruct
- /3 width=5 by ex2_3_intro, or_intror/
-]
-qed-.
-
-lemma lsuby_inv_succ1: ∀I1,K1,L2,V1,l,m. K1.ⓑ{I1}V1 ⊆[l, m] L2 → 0 < l →
- L2 = ⋆ ∨
- ∃∃I2,K2,V2. K1 ⊆[⫰l, m] K2 & L2 = K2.ⓑ{I2}V2.
-/2 width=5 by lsuby_inv_succ1_aux/ qed-.
-
-fact lsuby_inv_zero2_aux: ∀L1,L2,l,m. L1 ⊆[l, m] L2 →
- ∀J2,K2,W2. L2 = K2.ⓑ{J2}W2 → l = 0 → m = 0 →
- ∃∃J1,K1,W1. K1 ⊆[0, 0] K2 & L1 = K1.ⓑ{J1}W1.
-#L1 #L2 #l #m * -L1 -L2 -l -m
-[ #L1 #l #m #J2 #K2 #W1 #H destruct
-| #I1 #I2 #L1 #L2 #V1 #V2 #HL12 #J2 #K2 #W2 #H #_ #_ destruct
- /2 width=5 by ex2_3_intro/
-| #I1 #I2 #L1 #L2 #V #m #_ #J2 #K2 #W2 #_ #_ #H
- elim (ysucc_inv_O_dx … H)
-| #I1 #I2 #L1 #L2 #V1 #V2 #l #m #_ #J2 #K2 #W2 #_ #H
- elim (ysucc_inv_O_dx … H)
-]
-qed-.
-
-lemma lsuby_inv_zero2: ∀I2,K2,L1,V2. L1 ⊆[0, 0] K2.ⓑ{I2}V2 →
- ∃∃I1,K1,V1. K1 ⊆[0, 0] K2 & L1 = K1.ⓑ{I1}V1.
-/2 width=9 by lsuby_inv_zero2_aux/ qed-.
-
-fact lsuby_inv_pair2_aux: ∀L1,L2,l,m. L1 ⊆[l, m] L2 →
- ∀J2,K2,W. L2 = K2.ⓑ{J2}W → l = 0 → 0 < m →
- ∃∃J1,K1. K1 ⊆[0, ⫰m] K2 & L1 = K1.ⓑ{J1}W.
-#L1 #L2 #l #m * -L1 -L2 -l -m
-[ #L1 #l #m #J2 #K2 #W #H destruct
-| #I1 #I2 #L1 #L2 #V1 #V2 #_ #J2 #K2 #W #_ #_ #H
- elim (ylt_yle_false … H) //
-| #I1 #I2 #L1 #L2 #V #m #HL12 #J2 #K2 #W #H #_ #_ destruct
- /2 width=4 by ex2_2_intro/
-| #I1 #I2 #L1 #L2 #V1 #V2 #l #m #_ #J2 #K2 #W #_ #H
- elim (ysucc_inv_O_dx … H)
-]
-qed-.
-
-lemma lsuby_inv_pair2: ∀I2,K2,L1,V,m. L1 ⊆[0, m] K2.ⓑ{I2}V → 0 < m →
- ∃∃I1,K1. K1 ⊆[0, ⫰m] K2 & L1 = K1.ⓑ{I1}V.
-/2 width=6 by lsuby_inv_pair2_aux/ qed-.
-
-fact lsuby_inv_succ2_aux: ∀L1,L2,l,m. L1 ⊆[l, m] L2 →
- ∀J2,K2,W2. L2 = K2.ⓑ{J2}W2 → 0 < l →
- ∃∃J1,K1,W1. K1 ⊆[⫰l, m] K2 & L1 = K1.ⓑ{J1}W1.
-#L1 #L2 #l #m * -L1 -L2 -l -m
-[ #L1 #l #m #J2 #K2 #W2 #H destruct
-| #I1 #I2 #L1 #L2 #V1 #V2 #_ #J2 #K2 #W2 #_ #H
- elim (ylt_yle_false … H) //
-| #I1 #I2 #L1 #L2 #V #m #_ #J2 #K1 #W2 #_ #H
- elim (ylt_yle_false … H) //
-| #I1 #I2 #L1 #L2 #V1 #V2 #l #m #HL12 #J2 #K2 #W2 #H #_ destruct
- /2 width=5 by ex2_3_intro/
-]
-qed-.
-
-lemma lsuby_inv_succ2: ∀I2,K2,L1,V2,l,m. L1 ⊆[l, m] K2.ⓑ{I2}V2 → 0 < l →
- ∃∃I1,K1,V1. K1 ⊆[⫰l, m] K2 & L1 = K1.ⓑ{I1}V1.
-/2 width=5 by lsuby_inv_succ2_aux/ qed-.
-
-(* Basic forward lemmas *****************************************************)
-
-lemma lsuby_fwd_length: ∀L1,L2,l,m. L1 ⊆[l, m] L2 → |L2| ≤ |L1|.
-#L1 #L2 #l #m #H elim H -L1 -L2 -l -m /2 width=1 by yle_succ/
-qed-.
-
-(* Properties on basic slicing **********************************************)
-
-lemma lsuby_drop_trans_be: ∀L1,L2,l,m. L1 ⊆[l, m] L2 →
- ∀I2,K2,W,s,i. ⬇[s, 0, i] L2 ≡ K2.ⓑ{I2}W →
- l ≤ i → ∀m0. i + ⫯m0 = l + m →
- ∃∃I1,K1. K1 ⊆[0, m0] K2 & ⬇[s, 0, i] L1 ≡ K1.ⓑ{I1}W.
-#L1 #L2 #l #m #H elim H -L1 -L2 -l -m
-[ #L1 #l #m #J2 #K2 #W #s #i #H
- elim (drop_inv_atom1 … H) -H #H destruct
-| #I1 #I2 #L1 #L2 #V1 #V2 #_ #_ #J2 #K2 #W #s #i #_ #_ #m0
- >yplus_O2 >yplus_succ2 #H elim (ysucc_inv_O_dx … H)
-| #I1 #I2 #L1 #L2 #V #m #HL12 #IHL12 #J2 #K2 #W #s #i #H #_ #m0
- >yplus_succ2 >yplus_succ2 #H0 lapply (ysucc_inv_inj … H0) -H0
- elim (drop_inv_O1_pair1 … H) -H * #Hi #HLK1 [ -IHL12 | -HL12 ]
- [ destruct -I2 /2 width=4 by drop_pair, ex2_2_intro/
- | lapply (ylt_inv_O1 … Hi)
- #H <H -H <yplus_succ_swap #Him elim (IHL12 … HLK1 … Him) -IHL12 -HLK1 -Him
- /3 width=4 by drop_drop_lt, ex2_2_intro/
- ]
-| #I1 #I2 #L1 #L2 #V1 #V2 #l #m #_ #IHL12 #J2 #K2 #W #s #i #HLK2 #Hli #m0
- elim (yle_inv_succ1 … Hli) -Hli #Hli #Hi
- lapply (drop_inv_drop1_lt … HLK2 ?) -HLK2 /2 width=1 by ylt_O1/ #HLK2
- >yplus_succ1 >yplus_succ2 #H lapply (ysucc_inv_inj … H) -H
- <Hi <yplus_succ_swap #H elim (IHL12 … HLK2 … H) -IHL12 -HLK2 -H
- /3 width=4 by drop_drop, ex2_2_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/lsuby.ma".
-
-(* LOCAL ENVIRONMENT REFINEMENT FOR EXTENDED SUBSTITUTION *******************)
-
-(* Main properties **********************************************************)
-
-theorem lsuby_trans: ∀l,m. Transitive … (lsuby l m).
-#l #m #L1 #L2 #H elim H -L1 -L2 -l -m
-[ #L1 #l #m #X #H lapply (lsuby_inv_atom1 … H) -H
- #H destruct //
-| #I1 #I2 #L1 #L #V1 #V #_ #IHL1 #X #H elim (lsuby_inv_zero1 … H) -H //
- * #I2 #L2 #V2 #HL2 #H destruct /3 width=1 by lsuby_zero/
-| #I1 #I2 #L1 #L2 #V #m #_ #IHL1 #X #H elim (lsuby_inv_pair1 … H) -H //
- * #I2 #L2 #HL2 #H destruct /3 width=1 by lsuby_pair/
-| #I1 #I2 #L1 #L2 #V1 #V2 #l #m #_ #IHL1 #X #H elim (lsuby_inv_succ1 … H) -H //
- * #I2 #L2 #V2 #HL2 #H destruct /3 width=1 by lsuby_succ/
-]
-qed-.
+++ /dev/null
-include "basic_2/notation/functions/droppreds_3.ma".
-include "basic_2/grammar/lenv_length.ma".
-
-axiom pred_minus: ∀x,y. y < x → ⫰(x - y) = x - ⫯y.
-
-(*
-axiom drops_T_isuni_inv_refl: ∀n,L. ⬇*[n] L ≡ L → n = 0.
-
-lemma le_succ_trans: ∀m,n. ⫯m ≤ n → m ≤ n.
-/2 width=1 by lt_to_le/ qed-.
-*)
-
-lemma tls_pred: ∀f,n. 0 < n → ⫱*[n] f = ⫱ ⫱*[⫰n] f.
-#f #n #Hn >tls_S >S_pred //
-qed-.
-
-definition ltls (f): lenv → lenv → rtmap ≝ λL,K. ⫱*[|L|-|K|] f.
-
-interpretation "ltls (rtmap)" 'DropPreds L K f = (ltls f L K).
-
-lemma ltls_refl: ∀f,L1,L2. |L1| ≤ |L2| → ⫱*[L1, L2] f = f.
-#f #L1 #L2 #HL12 whd in ⊢ (??%?); >(eq_minus_O … HL12) -HL12 //
-qed.
-
-lemma ltls_pair2: ∀f,I,L1,L2,V. |L2| < |L1| → ⫱⫱*[L1, L2.ⓑ{I}V] f = ⫱*[L1, L2] f.
-#f #I #L1 #L2 #V #HL12 whd in ⊢ (??(?%)%); <pred_minus // <tls_pred //
-/2 width=1 by lt_plus_to_minus_r/
-qed-.
-
-lemma ltls_pair1_push: ∀f,I,L1,L2,V. |L2| ≤ |L1| → ⫱*[L1.ⓑ{I}V, L2] ↑f = ⫱*[L1, L2] f.
-#f #I #L1 #L2 #V #HL12 whd in ⊢ (??%%); >minus_Sn_m //
-qed.
-
-lemma ltls_pair1_next: ∀f,I,L1,L2,V. |L2| ≤ |L1| → ⫱*[L1.ⓑ{I}V, L2] ⫯f = ⫱*[L1, L2] f.
-#f #I #L1 #L2 #V #HL12 whd in ⊢ (??%%); >minus_Sn_m //
-qed.
-
-lemma ltls_sle_pair: ∀f1,f2,L1,L2. ⫱*[L2, L1] f2 ⊆ ⫱*[L1, L2] f1 →
- ∀I,V1. ⫱*[L2, L1.ⓑ{I}V1] f2 ⊆ ⫱*[L1.ⓑ{I}V1, L2] ⫯f1.
-#f1 #f2 #L1 #L2 elim (lt_or_ge (|L1|) (|L2|))
-[ #HL12 >ltls_refl in ⊢ (??%→?); /2 width=1 by lt_to_le/
- #Hf21 #I #V1 >ltls_refl in ⊢ (??%); //
- <(ltls_pair2 … I … V1 HL12) in Hf21; -HL12 /2 width=1 by sle_inv_tl1/
-| #HL21 >ltls_refl // #Hf21 #I #V1 >ltls_refl /2 width=1 by le_S/
- >ltls_pair1_next //
-]
-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 *)
-(* *)
-(**************************************************************************)
-
-(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
-
-notation "hvbox( ⦃ term 46 G , break term 46 L ⦄ ⊢ break term 46 T1 break ▶ [ term 46 l , break term 46 m ] break term 46 T2 )"
- non associative with precedence 45
- for @{ 'PSubst $G $L $T1 $l $k $T2 }.
+++ /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 *)
-(* *)
-(**************************************************************************)
-
-(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
-
-notation "hvbox( ⦃ term 46 G , break term 46 L ⦄ ⊢ break term 46 T1 break ▶ * [ term 46 l , break term 46 m ] break term 46 T2 )"
- non associative with precedence 45
- for @{ 'PSubstStar $G $L $T1 $l $k $T2 }.
+++ /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 *)
-(* *)
-(**************************************************************************)
-
-(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
-
-notation "hvbox( ⦃ term 46 G , break term 46 L ⦄ ⊢ break term 46 T1 break ▶ ▶ * [ term 46 l , break term 46 m ] break term 46 T2 )"
- non associative with precedence 45
- for @{ 'PSubstStarAlt $G $L $T1 $l $k $T2 }.
+++ /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/unfold_4.ma".
-include "basic_2/grammar/lenv_append.ma".
-include "basic_2/grammar/genv.ma".
-include "basic_2/substitution/drop.ma".
-
-(* CONTEXT-SENSITIVE UNFOLD FOR TERMS ***************************************)
-
-(* activate genv *)
-inductive unfold: relation4 genv lenv term lenv ≝
-| unfold_sort: ∀G,L,s. unfold G L (⋆s) L
-| unfold_lref: ∀I,G,L1,L2,K1,K2,V,i. ⬇[i] L1 ≡ K1. ⓑ{I}V →
- unfold G K1 V K2 → ⬇[Ⓣ, |L2|, i] L2 ≡ K2 →
- unfold G L1 (#i) (L1@@L2)
-| unfold_bind: ∀a,I,G,L1,L2,V,T.
- unfold G (L1.ⓑ{I}V) T L2 → unfold G L1 (ⓑ{a,I}V.T) L2
-| unfold_flat: ∀I,G,L1,L2,V,T.
- unfold G L1 T L2 → unfold G L1 (ⓕ{I}V.T) L2
-.
-
-interpretation "context-sensitive unfold (term)"
- 'Unfold G L1 T L2 = (unfold G L1 T L2).
+++ /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 *)
-(* *)
-(**************************************************************************)
-
-(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
-
-notation "hvbox( ⦃ term 46 G, break term 46 L1 ⦄ ⊢ ⧫ * break term 46 T ≡ break term 46 L2 )"
- non associative with precedence 45
- for @{ 'Unfold $G $L1 $T $L2 }.
--- /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 *)
+(* *)
+(**************************************************************************)
+
+(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
+
+notation "hvbox( L1 ≡ break [ term 46 h , term 46 o , term 46 T ] break term 46 L2 )"
+ non associative with precedence 45
+ for @{ 'LazyEq $h $o $T $L1 $L2 }.
+++ /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 *)
-(* *)
-(**************************************************************************)
-
-(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
-
-notation "hvbox( ⦃ term 46 G1, break term 46 L1, break term 46 T1 ⦄ ≡ break ⦃ term 46 G2, break term 46 L2 , break term 46 T2 ⦄ )"
- non associative with precedence 45
- for @{ 'LazyEq $G1 $L1 $T1 $G2 $L2 $T2 }.
--- /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 *)
+(* *)
+(**************************************************************************)
+
+(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
+
+notation "hvbox( ⦃ term 46 G1, break term 46 L1, break term 46 T1 ⦄ ≡ [ break term 46 h , break term 46 o ] ⦃ break term 46 G2, break term 46 L2 , break term 46 T2 ⦄ )"
+ non associative with precedence 45
+ for @{ 'LazyEq $h $o $G1 $L1 $T1 $G2 $L2 $T2 }.
#RN #RP #L1 #L2 @eq_repl_sym /2 width=3 by lexs_eq_repl_back/ (**) (* full auto fails *)
qed-.
-(* Note: fexs_sym and fexs_trans hold, but lexs_sym and lexs_trans do not *)
(* Basic_2A1: includes: lpx_sn_refl *)
-lemma lexs_refl: ∀RN,RP,f.
+lemma lexs_refl: ∀RN,RP.
(∀L. reflexive … (RN L)) →
(∀L. reflexive … (RP L)) →
- reflexive … (lexs RN RP f).
-#RN #RP #f #HRN #HRP #L generalize in match f; -f elim L -L //
+ ∀f.reflexive … (lexs RN RP f).
+#RN #RP #HRN #HRP #f #L generalize in match f; -f elim L -L //
#L #I #V #IH * * /2 width=1 by lexs_next, lexs_push/
qed.
+lemma lexs_sym: ∀RN,RP.
+ (∀L1,L2,T1,T2. RN L1 T1 T2 → RN L2 T2 T1) →
+ (∀L1,L2,T1,T2. RP L1 T1 T2 → RP L2 T2 T1) →
+ ∀f. symmetric … (lexs RN RP f).
+#RN #RP #HRN #HRP #f #L1 #L2 #H elim H -L1 -L2 -f
+/3 width=2 by lexs_next, lexs_push/
+qed-.
+
lemma lexs_pair_repl: ∀RN,RP,f,I,L1,L2,V1,V2.
L1.ⓑ{I}V1 ⦻*[RN, RP, f] L2.ⓑ{I}V2 →
∀W1,W2. RN L1 W1 W2 → RP L1 W1 W2 →
--- /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/static/lfdeq.ma".
+include "basic_2/static/aaa.ma".
+
+(* ATONIC ARITY ASSIGNMENT ON TERMS *****************************************)
+
+(* Properties with degree-based equivalence on referred entries *************)
+
+lemma aaa_tdeq_conf_fldeq: ∀h,o,G,L1,T1,A. ⦃G, L1⦄ ⊢ T1 ⁝ A → ∀T2. T1 ≡[h, o] T2 →
+ ∀L2. L1 ≡[h, o, T1] L2 → ⦃G, L2⦄ ⊢ T2 ⁝ A.
+#h #o #G #L1 #T1 #A #H elim H -G -L1 -T1 -A
+[ #G #L1 #s1 #X #H1 elim (tdeq_inv_sort1 … H1) -H1 //
+| #I #G #L1 #V1 #B #_ #IH #X #H1 >(tdeq_inv_lref1 … H1) -H1
+ #Y #H2 elim (lfdeq_inv_zero_pair_sn … H2) -H2
+ #L2 #V2 #HL12 #HV12 #H2 destruct /3 width=1 by aaa_zero/
+| #I #G #L1 #V1 #A #i #_ #IH #X #H1 >(tdeq_inv_lref1 … H1) -H1
+ #Y #H2 elim (lfdeq_inv_lref_pair_sn … H2) -H2
+ #L2 #V2 #HL12 #H2 destruct /3 width=1 by aaa_lref/
+| #p #G #L1 #V1 #T1 #B #A #_ #_ #IHV #IHT #X #H1 elim (tdeq_inv_pair1 … H1) -H1
+ #V2 #T2 #HV12 #HT12 #H1 #L2 #H2 elim (lfdeq_inv_bind … H2) -H2
+ /4 width=2 by aaa_abbr, lfdeq_pair_repl_dx/
+| #p #G #L1 #V1 #T1 #B #A #_ #_ #IHV #IHT #X #H1 elim (tdeq_inv_pair1 … H1) -H1
+ #V2 #T2 #HV12 #HT12 #H1 #L2 #H2 elim (lfdeq_inv_bind … H2) -H2
+ /4 width=2 by aaa_abst, lfdeq_pair_repl_dx/
+| #G #L1 #V1 #T1 #B #A #_ #_ #IHV #IHT #X #H1 elim (tdeq_inv_pair1 … H1) -H1
+ #V2 #T2 #HV12 #HT12 #H1 #L2 #H2 elim (lfdeq_inv_flat … H2) -H2
+ /3 width=3 by aaa_appl/
+| #G #L1 #V1 #T1 #A #_ #_ #IHV #IHT #X #H1 elim (tdeq_inv_pair1 … H1) -H1
+ #V2 #T2 #HV12 #HT12 #H1 #L2 #H2 elim (lfdeq_inv_flat … H2) -H2
+ /3 width=1 by aaa_cast/
+]
+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/static/lfeq_lreq.ma".
-include "basic_2/static/aaa.ma".
-
-(* ATONIC ARITY ASSIGNMENT ON TERMS *****************************************)
-
-(* Properties with equivalence on referred entries **************************)
-
-lemma lfeq_aaa_trans: ∀G,L2,T,A. ⦃G, L2⦄ ⊢ T ⁝ A →
- ∀L1. L1 ≡[T] L2 → ⦃G, L1⦄ ⊢ T ⁝ A.
-#G #L2 #T #A #H elim H -G -L2 -T -A /2 width=1 by aaa_sort/
-[ #I #G #L2 #V2 #A #_ #IH #L1 #H
- elim (lfeq_inv_zero_pair_dx … H) -H /3 width=1 by aaa_zero/
-| #I #G #L2 #V2 #A #i #_ #IH #L1 #H
- elim (lfeq_inv_lref_pair_dx … H) -H /3 width=1 by aaa_lref/
-| #p #G #L2 #V #T #B #A #_ #_ #IHV #IHT #L1 #H
- elim (lfeq_inv_bind … H) -H /3 width=2 by aaa_abbr/
-| #p #G #L2 #V #T #B #A #_ #_ #IHV #IHT #L1 #H
- elim (lfeq_inv_bind … H) -H /3 width=1 by aaa_abst/
-| #G #L2 #V #T #B #A #_ #_ #IHV #IHT #L1 #H
- elim (lfeq_inv_flat … H) -H /3 width=3 by aaa_appl/
-| #G #L2 #V #T #A #_ #_ #IHV #IHT #L1 #H
- elim (lfeq_inv_flat … H) -H /3 width=1 by aaa_cast/
-]
-qed-.
-
-lemma aaa_lfeq_conf: ∀G,L2,T,A. ⦃G, L2⦄ ⊢ T ⁝ A →
- ∀L1. L2 ≡[T] L1 → ⦃G, L1⦄ ⊢ T ⁝ A.
-/3 width=3 by lfeq_aaa_trans, lfeq_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/lazyeq_8.ma".
+include "basic_2/syntax/genv.ma".
+include "basic_2/static/lfdeq_fqup.ma".
+
+(* DEGREE-BASED EQUIVALENCE FOR CLOSURES ON REFERRED ENTRIES ****************)
+
+inductive ffdeq (h) (o) (G) (L1) (T): relation3 genv lenv term ≝
+| ffdeq_intro: ∀L2. L1 ≡[h, o, T] L2 → ffdeq h o G L1 T G L2 T
+.
+
+interpretation
+ "degree-based equivalence on referred entries (closure)"
+ 'LazyEq h o G1 L1 T1 G2 L2 T2 = (ffdeq h o G1 L1 T1 G2 L2 T2).
+
+(* Basic properties *********************************************************)
+
+lemma ffdeq_sym: ∀h,o. tri_symmetric … (ffdeq h o).
+#h #o #G1 #G2 #L1 #L2 #T1 #T2 * -G1 -L1 -T1 /3 width=1 by ffdeq_intro, lfdeq_sym/
+qed-.
+
+(* Basic inversion lemmas ***************************************************)
+
+lemma ffdeq_inv_gen: ∀h,o,G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ≡[h, o] ⦃G2, L2, T2⦄ →
+ ∧∧ G1 = G2 & L1 ≡[h, o, T1] L2 & T1 = T2.
+#h #o #G1 #G2 #L1 #L2 #T1 #T2 * -G2 -L2 -T2 /2 width=1 by and3_intro/
+qed-.
+
+(* Basic_2A1: removed theorems 6:
+ fleq_refl fleq_sym fleq_inv_gen
+ fleq_trans fleq_canc_sn fleq_canc_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/static/lfdeq_lfdeq.ma".
+include "basic_2/static/ffdeq.ma".
+
+(* DEGREE-BASED EQUIVALENCE FOR CLOSURES ON REFERRED ENTRIES ****************)
+
+(* Main properties **********************************************************)
+
+theorem ffdeq_trans: ∀h,o. tri_transitive … (ffdeq h o).
+#h #o #G1 #G #L1 #L #T1 #T * -G -L -T
+#L #HL1 #G2 #L2 #T2 * -G2 -L2 -T2 /3 width=3 by ffdeq_intro, lfdeq_trans/
+qed-.
+
+theorem ffdeq_canc_sn: ∀h,o,G,G1,G2,L,L1,L2,T,T1,T2.
+ ⦃G, L, T⦄ ≡[h, o] ⦃G1, L1, T1⦄→ ⦃G, L, T⦄ ≡[h, o] ⦃G2, L2, T2⦄ → ⦃G1, L1, T1⦄ ≡[h, o] ⦃G2, L2, T2⦄.
+/3 width=5 by ffdeq_trans, ffdeq_sym/ qed-.
+
+theorem ffdeq_canc_dx: ∀h,o,G1,G2,G,L1,L2,L,T1,T2,T.
+ ⦃G1, L1, T1⦄ ≡[h, o] ⦃G, L, T⦄ → ⦃G2, L2, T2⦄ ≡[h, o] ⦃G, L, T⦄ → ⦃G1, L1, T1⦄ ≡[h, o] ⦃G2, L2, T2⦄.
+/3 width=5 by ffdeq_trans, ffdeq_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/static/lfdeq_fqup.ma".
+include "basic_2/static/ffdeq.ma".
+
+(* DEGREE-BASED EQUIVALENCE FOR CLOSURES ON REFERRED ENTRIES ****************)
+
+(* Advanced properties ******************************************************)
+
+lemma ffdeq_refl: ∀h,o. tri_reflexive … (ffdeq h o).
+/2 width=1 by ffdeq_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/lazyeq_6.ma".
-include "basic_2/static/lfeq_lreq.ma".
-include "basic_2/static/lfeq_fqup.ma".
-
-(* EQUIVALENCE FOR CLOSURES ON REFERRED ENTRIES *****************************)
-
-inductive ffeq (G) (L1) (T): relation3 genv lenv term ≝
-| fleq_intro: ∀L2. L1 ≡[T] L2 → ffeq G L1 T G L2 T
-.
-
-interpretation
- "equivalence on referred entries (closure)"
- 'LazyEq G1 L1 T1 G2 L2 T2 = (ffeq G1 L1 T1 G2 L2 T2).
-
-(* Basic properties *********************************************************)
-
-lemma ffeq_refl: tri_reflexive … ffeq.
-/2 width=1 by fleq_intro/ qed.
-
-lemma ffeq_sym: tri_symmetric … ffeq.
-#G1 #G2 #L1 #L2 #T1 #T2 * -G1 -L1 -T1 /3 width=1 by fleq_intro, lfeq_sym/
-qed-.
-
-(* Basic inversion lemmas ***************************************************)
-
-lemma ffeq_inv_gen: ∀G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ≡ ⦃G2, L2, T2⦄ →
- ∧∧ G1 = G2 & L1 ≡[T1] L2 & T1 = T2.
-#G1 #G2 #L1 #L2 #T1 #T2 * -G2 -L2 -T2 /2 width=1 by and3_intro/
-qed-.
-
-(* Basic_2A1: removed theorems 6:
- fleq_refl fleq_sym fleq_inv_gen
- fleq_trans fleq_canc_sn fleq_canc_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/static/lfeq_lfeq.ma".
-include "basic_2/static/ffeq.ma".
-
-(* EQUIVALENCE FOR CLOSURES ON REFERRED ENTRIES *****************************)
-
-(* Main properties **********************************************************)
-
-theorem ffeq_trans: tri_transitive … ffeq.
-#G1 #G #L1 #L #T1 #T * -G -L -T
-#L #HL1 #G2 #L2 #T2 * -G2 -L2 -T2 /3 width=3 by fleq_intro, lfeq_trans/
-qed-.
-
-theorem ffeq_canc_sn: ∀G,G1,G2,L,L1,L2,T,T1,T2.
- ⦃G, L, T⦄ ≡ ⦃G1, L1, T1⦄→ ⦃G, L, T⦄ ≡ ⦃G2, L2, T2⦄ → ⦃G1, L1, T1⦄ ≡ ⦃G2, L2, T2⦄.
-/3 width=5 by ffeq_trans, ffeq_sym/ qed-.
-
-theorem ffeq_canc_dx: ∀G1,G2,G,L1,L2,L,T1,T2,T.
- ⦃G1, L1, T1⦄ ≡ ⦃G, L, T⦄ → ⦃G2, L2, T2⦄ ≡ ⦃G, L, T⦄ → ⦃G1, L1, T1⦄ ≡ ⦃G2, L2, T2⦄.
-/3 width=5 by ffeq_trans, ffeq_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/relocation/lreq.ma".
-include "basic_2/static/frees.ma".
-
-(* CONTEXT-SENSITIVE FREE VARIABLES *****************************************)
-
-(* Properties with ranged equivalence for local environments ****************)
-
-lemma frees_lreq_conf: ∀f,L1,T. L1 ⊢ 𝐅*⦃T⦄ ≡ f → ∀L2. L1 ≡[f] L2 → L2 ⊢ 𝐅*⦃T⦄ ≡ f.
-#f #L1 #T #H elim H -f -L1 -T
-[ #f #I #Hf #X #H lapply (lreq_inv_atom1 … H) -H
- #H destruct /2 width=1 by frees_atom/
-| #f #I #L1 #V1 #s #_ #IH #X #H elim (lreq_inv_push1 … H) -H
- /3 width=1 by frees_sort/
-| #f #I #L1 #V1 #_ #IH #X #H elim (lreq_inv_next1 … H) -H
- /3 width=1 by frees_zero/
-| #f #I #L1 #V1 #i #_ #IH #X #H elim (lreq_inv_push1 … H) -H
- /3 width=1 by frees_lref/
-| #f #I #L1 #V1 #l #_ #IH #X #H elim (lreq_inv_push1 … H) -H
- /3 width=1 by frees_gref/
-| /6 width=5 by frees_bind, lreq_inv_tl, sle_lreq_trans, sor_inv_sle_dx, sor_inv_sle_sn/
-| /5 width=5 by frees_flat, sle_lreq_trans, sor_inv_sle_dx, sor_inv_sle_sn/
-]
-qed-.
-
-lemma lreq_frees_trans: ∀f,L1,T. L1 ⊢ 𝐅*⦃T⦄ ≡ f → ∀L2. L2 ≡[f] L1 → L2 ⊢ 𝐅*⦃T⦄ ≡ f.
-/3 width=3 by frees_lreq_conf, lreq_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/lazyeq_5.ma".
+include "basic_2/syntax/tdeq.ma".
+include "basic_2/static/lfxs.ma".
+
+(* DEGREE-BASED EQUIVALENCE FOR LOCAL ENVIRONMENTS ON REFERRED ENTRIES ******)
+
+definition lfdeq: ∀h. sd h → relation3 term lenv lenv ≝
+ λh,o. lfxs (cdeq h o).
+
+interpretation
+ "degree-based equivalence on referred entries (local environment)"
+ 'LazyEq h o T L1 L2 = (lfdeq h o T L1 L2).
+
+interpretation
+ "degree-based ranged equivalence (local environment)"
+ 'LazyEq h o f L1 L2 = (lexs (cdeq h o) cfull f L1 L2).
+(*
+definition lfdeq_transitive: predicate (relation3 lenv term term) ≝
+ λR. ∀L2,T1,T2. R L2 T1 T2 → ∀L1. L1 ≡[h, o, T1] L2 → R L1 T1 T2.
+*)
+(* Basic properties ***********************************************************)
+
+lemma frees_tdeq_conf_lexs: ∀h,o,f,L1,T1. L1 ⊢ 𝐅*⦃T1⦄ ≡ f → ∀T2. T1 ≡[h, o] T2 →
+ ∀L2. L1 ≡[h, o, f] L2 → L2 ⊢ 𝐅*⦃T2⦄ ≡ f.
+#h #o #f #L1 #T1 #H elim H -f -L1 -T1
+[ #f #I1 #Hf #X #H1 elim (tdeq_fwd_atom1 … H1) -H1
+ #I2 #H1 #Y #H2 lapply (lexs_inv_atom1 … H2) -H2
+ #H2 destruct /2 width=1 by frees_atom/
+| #f #I #L1 #V1 #s1 #_ #IH #X #H1 elim (tdeq_inv_sort1 … H1) -H1
+ #s2 #d #Hs1 #Hs2 #H1 #Y #H2 elim (lexs_inv_push1 … H2) -H2
+ #L2 #V2 #HL12 #_ #H2 destruct /4 width=3 by frees_sort, tdeq_sort/
+| #f #I #L1 #V1 #_ #IH #X #H1 >(tdeq_inv_lref1 … H1) -H1
+ #Y #H2 elim (lexs_inv_next1 … H2) -H2
+ #L2 #V2 #HL12 #HV12 #H2 destruct /3 width=1 by frees_zero/
+| #f #I #L1 #V1 #i #_ #IH #X #H1 >(tdeq_inv_lref1 … H1) -H1
+ #Y #H2 elim (lexs_inv_push1 … H2) -H2
+ #L2 #V2 #HL12 #_ #H2 destruct /3 width=1 by frees_lref/
+| #f #I #L1 #V1 #l #_ #IH #X #H1 >(tdeq_inv_gref1 … H1) -H1
+ #Y #H2 elim (lexs_inv_push1 … H2) -H2
+ #L2 #V2 #HL12 #_ #H2 destruct /3 width=1 by frees_gref/
+| #f1V #f1T #f1 #p #I #L1 #V1 #T1 #_ #_ #Hf1 #IHV #IHT #X #H1 elim (tdeq_inv_pair1 … H1) -H1
+ #V2 #T2 #HV12 #HT12 #H1 #L2 #HL12 destruct
+ /6 width=5 by frees_bind, lexs_inv_tl, sle_lexs_trans, sor_inv_sle_dx, sor_inv_sle_sn/
+| #f1V #f1T #f1 #I #L1 #V1 #T1 #_ #_ #Hf1 #IHV #IHT #X #H1 elim (tdeq_inv_pair1 … H1) -H1
+ #V2 #T2 #HV12 #HT12 #H1 #L2 #HL12 destruct
+ /5 width=5 by frees_flat, sle_lexs_trans, sor_inv_sle_dx, sor_inv_sle_sn/
+]
+qed-.
+
+lemma lfdeq_sym: ∀h,o,T. symmetric … (lfdeq h o T).
+#h #o #T #L1 #L2 *
+/4 width=7 by frees_tdeq_conf_lexs, lfxs_sym, tdeq_sym, ex2_intro/
+qed-.
+
+lemma lfdeq_atom: ∀h,o,I. ⋆ ≡[h, o, ⓪{I}] ⋆.
+/2 width=1 by lfxs_atom/ qed.
+
+lemma lfdeq_sort: ∀h,o,I,L1,L2,V1,V2,s.
+ L1 ≡[h, o, ⋆s] L2 → L1.ⓑ{I}V1 ≡[h, o, ⋆s] L2.ⓑ{I}V2.
+/2 width=1 by lfxs_sort/ qed.
+
+lemma lfdeq_zero: ∀h,o,I,L1,L2,V.
+ L1 ≡[h, o, V] L2 → L1.ⓑ{I}V ≡[h, o, #0] L2.ⓑ{I}V.
+/2 width=1 by lfxs_zero/ qed.
+
+lemma lfdeq_lref: ∀h,o,I,L1,L2,V1,V2,i.
+ L1 ≡[h, o, #i] L2 → L1.ⓑ{I}V1 ≡[h, o, #⫯i] L2.ⓑ{I}V2.
+/2 width=1 by lfxs_lref/ qed.
+
+lemma lfdeq_gref: ∀h,o,I,L1,L2,V1,V2,l.
+ L1 ≡[h, o, §l] L2 → L1.ⓑ{I}V1 ≡[h, o, §l] L2.ⓑ{I}V2.
+/2 width=1 by lfxs_gref/ qed.
+
+lemma lfdeq_pair_repl_dx: ∀h,o,I,L1,L2.∀T:term.∀V,V1.
+ L1.ⓑ{I}V ≡[h, o, T] L2.ⓑ{I}V1 →
+ ∀V2. V ≡[h, o] V2 →
+ L1.ⓑ{I}V ≡[h, o, T] L2.ⓑ{I}V2.
+/2 width=2 by lfxs_pair_repl_dx/ qed-.
+
+(* Basic inversion lemmas ***************************************************)
+
+lemma lfdeq_inv_atom_sn: ∀h,o,I,Y2. ⋆ ≡[h, o, ⓪{I}] Y2 → Y2 = ⋆.
+/2 width=3 by lfxs_inv_atom_sn/ qed-.
+
+lemma lfdeq_inv_atom_dx: ∀h,o,I,Y1. Y1 ≡[h, o, ⓪{I}] ⋆ → Y1 = ⋆.
+/2 width=3 by lfxs_inv_atom_dx/ qed-.
+
+lemma lfdeq_inv_zero: ∀h,o,Y1,Y2. Y1 ≡[h, o, #0] Y2 →
+ (Y1 = ⋆ ∧ Y2 = ⋆) ∨
+ ∃∃I,L1,L2,V1,V2. L1 ≡[h, o, V1] L2 & V1 ≡[h, o] V2 &
+ Y1 = L1.ⓑ{I}V1 & Y2 = L2.ⓑ{I}V2.
+#h #o #Y1 #Y2 #H elim (lfxs_inv_zero … H) -H *
+/3 width=9 by ex4_5_intro, or_introl, or_intror, conj/
+qed-.
+
+lemma lfdeq_inv_lref: ∀h,o,Y1,Y2,i. Y1 ≡[h, o, #⫯i] Y2 →
+ (Y1 = ⋆ ∧ Y2 = ⋆) ∨
+ ∃∃I,L1,L2,V1,V2. L1 ≡[h, o, #i] L2 &
+ Y1 = L1.ⓑ{I}V1 & Y2 = L2.ⓑ{I}V2.
+/2 width=1 by lfxs_inv_lref/ qed-.
+
+lemma lfdeq_inv_bind: ∀h,o,p,I,L1,L2,V,T. L1 ≡[h, o, ⓑ{p,I}V.T] L2 →
+ L1 ≡[h, o, V] L2 ∧ L1.ⓑ{I}V ≡[h, o, T] L2.ⓑ{I}V.
+/2 width=2 by lfxs_inv_bind/ qed-.
+
+lemma lfdeq_inv_flat: ∀h,o,I,L1,L2,V,T. L1 ≡[h, o, ⓕ{I}V.T] L2 →
+ L1 ≡[h, o, V] L2 ∧ L1 ≡[h, o, T] L2.
+/2 width=2 by lfxs_inv_flat/ qed-.
+
+(* Advanced inversion lemmas ************************************************)
+
+lemma lfdeq_inv_zero_pair_sn: ∀h,o,I,Y2,L1,V1. L1.ⓑ{I}V1 ≡[h, o, #0] Y2 →
+ ∃∃L2,V2. L1 ≡[h, o, V1] L2 & V1 ≡[h, o] V2 & Y2 = L2.ⓑ{I}V2.
+#h #o #I #Y2 #L1 #V1 #H elim (lfxs_inv_zero_pair_sn … H) -H /2 width=5 by ex3_2_intro/
+qed-.
+
+lemma lfdeq_inv_zero_pair_dx: ∀h,o,I,Y1,L2,V2. Y1 ≡[h, o, #0] L2.ⓑ{I}V2 →
+ ∃∃L1,V1. L1 ≡[h, o, V1] L2 & V1 ≡[h, o] V2 & Y1 = L1.ⓑ{I}V1.
+#h #o #I #Y1 #L2 #V2 #H elim (lfxs_inv_zero_pair_dx … H) -H
+#L1 #V1 #HL12 #HV12 #H destruct /2 width=5 by ex3_2_intro/
+qed-.
+
+lemma lfdeq_inv_lref_pair_sn: ∀h,o,I,Y2,L1,V1,i. L1.ⓑ{I}V1 ≡[h, o, #⫯i] Y2 →
+ ∃∃L2,V2. L1 ≡[h, o, #i] L2 & Y2 = L2.ⓑ{I}V2.
+/2 width=2 by lfxs_inv_lref_pair_sn/ qed-.
+
+lemma lfdeq_inv_lref_pair_dx: ∀h,o,I,Y1,L2,V2,i. Y1 ≡[h, o, #⫯i] L2.ⓑ{I}V2 →
+ ∃∃L1,V1. L1 ≡[h, o, #i] L2 & Y1 = L1.ⓑ{I}V1.
+/2 width=2 by lfxs_inv_lref_pair_dx/ qed-.
+
+(* Basic forward lemmas *****************************************************)
+
+lemma lfdeq_fwd_bind_sn: ∀h,o,p,I,L1,L2,V,T. L1 ≡[h, o, ⓑ{p,I}V.T] L2 → L1 ≡[h, o, V] L2.
+/2 width=4 by lfxs_fwd_bind_sn/ qed-.
+
+lemma lfdeq_fwd_bind_dx: ∀h,o,p,I,L1,L2,V,T.
+ L1 ≡[h, o, ⓑ{p,I}V.T] L2 → L1.ⓑ{I}V ≡[h, o, T] L2.ⓑ{I}V.
+/2 width=2 by lfxs_fwd_bind_dx/ qed-.
+
+lemma lfdeq_fwd_flat_sn: ∀h,o,I,L1,L2,V,T. L1 ≡[h, o, ⓕ{I}V.T] L2 → L1 ≡[h, o, V] L2.
+/2 width=3 by lfxs_fwd_flat_sn/ qed-.
+
+lemma lfdeq_fwd_flat_dx: ∀h,o,I,L1,L2,V,T. L1 ≡[h, o, ⓕ{I}V.T] L2 → L1 ≡[h, o, T] L2.
+/2 width=3 by lfxs_fwd_flat_dx/ qed-.
+
+lemma lfdeq_fwd_pair_sn: ∀h,o,I,L1,L2,V,T. L1 ≡[h, o, ②{I}V.T] L2 → L1 ≡[h, o, V] L2.
+/2 width=3 by lfxs_fwd_pair_sn/ qed-.
+
+(* Basic_2A1: removed theorems 30:
+ lleq_ind lleq_inv_bind lleq_inv_flat lleq_fwd_length lleq_fwd_lref
+ lleq_fwd_drop_sn lleq_fwd_drop_dx
+ lleq_fwd_bind_sn lleq_fwd_bind_dx lleq_fwd_flat_sn lleq_fwd_flat_dx
+ lleq_sort lleq_skip lleq_lref lleq_free lleq_gref lleq_bind lleq_flat
+ lleq_refl lleq_Y lleq_sym lleq_ge_up lleq_ge lleq_bind_O llpx_sn_lrefl
+ lleq_trans lleq_canc_sn lleq_canc_dx lleq_nlleq_trans nlleq_lleq_div
+*)
--- /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/static/lfxs_fqup.ma".
+include "basic_2/static/lfdeq.ma".
+
+(* DEGREE-BASED EQUIVALENCE FOR LOCAL ENVIRONMENTS ON REFERRED ENTRIES ******)
+
+(* Advanced properties ******************************************************)
+
+lemma lfdeq_refl: ∀h,o,T. reflexive … (lfdeq h o T).
+/2 width=1 by lfxs_refl/ 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/static/lfxs_length.ma".
+include "basic_2/static/lfdeq.ma".
+
+(* DEGREE-BASED EQUIVALENCE FOR LOCAL ENVIRONMENTS ON REFERRED ENTRIES ******)
+
+(* Forward lemmas with length for local environments ************************)
+
+lemma lfdeq_fwd_length: ∀h,o,L1,L2. ∀T:term. L1 ≡[h, o, T] L2 → |L1| = |L2|.
+/2 width=3 by lfxs_fwd_length/ 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/syntax/tdeq_tdeq.ma".
+include "basic_2/static/lfxs_lfxs.ma".
+include "basic_2/static/lfdeq.ma".
+
+(* DEGREE-BASED EQUIVALENCE FOR LOCAL ENVIRONMENTS ON REFERRED ENTRIES ******)
+
+(* Main properties **********************************************************)
+
+theorem lfdeq_bind: ∀h,o,p,I,L1,L2,V1,V2,T.
+ L1 ≡[h, o, V1] L2 → L1.ⓑ{I}V1 ≡[h, o, T] L2.ⓑ{I}V2 →
+ L1 ≡[h, o, ⓑ{p,I}V1.T] L2.
+/2 width=2 by lfxs_bind/ qed.
+
+theorem lfdeq_flat: ∀h,o,I,L1,L2,V,T. L1 ≡[h, o, V] L2 → L1 ≡[h, o, T] L2 →
+ L1 ≡[h, o, ⓕ{I}V.T] L2.
+/2 width=1 by lfxs_flat/ qed.
+
+theorem lfdeq_trans: ∀h,o,T. Transitive … (lfdeq h o T).
+#h #o #T #L1 #L * #f1 #Hf1 #HL1 #L2 * #f2 #Hf2 #HL2
+lapply (frees_tdeq_conf_lexs … Hf1 T … HL1) // #H0
+lapply (frees_mono … Hf2 … H0) -Hf2 -H0
+/4 width=7 by lexs_trans, lexs_eq_repl_back, tdeq_trans, ex2_intro/
+qed-.
+
+theorem lfdeq_canc_sn: ∀h,o,T. left_cancellable … (lfdeq h o T).
+/3 width=3 by lfdeq_trans, lfdeq_sym/ qed-.
+
+theorem lfdeq_canc_dx: ∀h,o,T. right_cancellable … (lfdeq h o T).
+/3 width=3 by lfdeq_trans, lfdeq_sym/ qed-.
+
+(* Advanced properies on negated lazy equivalence *****************************)
+
+(* Note: auto works with /4 width=8/ so lfdeq_canc_sn is preferred ************)
+lemma lfdeq_nlfdeq_trans: ∀h,o.∀T:term.∀L1,L. L1 ≡[h, o, T] L →
+ ∀L2. (L ≡[h, o, T] L2 → ⊥) → (L1 ≡[h, o, T] L2 → ⊥).
+/3 width=3 by lfdeq_canc_sn/ qed-.
+
+lemma nlfdeq_lfdeq_div: ∀h,o.∀T:term.∀L2,L. L2 ≡[h, o, T] L →
+ ∀L1. (L1 ≡[h, o, T] L → ⊥) → (L1 ≡[h, o, T] L2 → ⊥).
+/3 width=3 by lfdeq_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/lazyeq_3.ma".
-include "basic_2/static/lfxs.ma".
-
-(* EQUIVALENCE FOR LOCAL ENVIRONMENTS ON REFERRED ENTRIES *******************)
-
-definition lfeq: relation3 term lenv lenv ≝ lfxs ceq.
-
-interpretation
- "equivalence on referred entries (local environment)"
- 'LazyEq T L1 L2 = (lfeq T L1 L2).
-
-definition lfeq_transitive: predicate (relation3 lenv term term) ≝
- λR. ∀L2,T1,T2. R L2 T1 T2 → ∀L1. L1 ≡[T1] L2 → R L1 T1 T2.
-
-(* Basic properties ***********************************************************)
-
-lemma lfeq_atom: ∀I. ⋆ ≡[⓪{I}] ⋆.
-/2 width=1 by lfxs_atom/ qed.
-
-lemma lfeq_sort: ∀I,L1,L2,V1,V2,s.
- L1 ≡[⋆s] L2 → L1.ⓑ{I}V1 ≡[⋆s] L2.ⓑ{I}V2.
-/2 width=1 by lfxs_sort/ qed.
-
-lemma lfeq_zero: ∀I,L1,L2,V.
- L1 ≡[V] L2 → L1.ⓑ{I}V ≡[#0] L2.ⓑ{I}V.
-/2 width=1 by lfxs_zero/ qed.
-
-lemma lfeq_lref: ∀I,L1,L2,V1,V2,i.
- L1 ≡[#i] L2 → L1.ⓑ{I}V1 ≡[#⫯i] L2.ⓑ{I}V2.
-/2 width=1 by lfxs_lref/ qed.
-
-lemma lfeq_gref: ∀I,L1,L2,V1,V2,l.
- L1 ≡[§l] L2 → L1.ⓑ{I}V1 ≡[§l] L2.ⓑ{I}V2.
-/2 width=1 by lfxs_gref/ qed.
-
-(* Basic inversion lemmas ***************************************************)
-
-lemma lfeq_inv_atom_sn: ∀I,Y2. ⋆ ≡[⓪{I}] Y2 → Y2 = ⋆.
-/2 width=3 by lfxs_inv_atom_sn/ qed-.
-
-lemma lfeq_inv_atom_dx: ∀I,Y1. Y1 ≡[⓪{I}] ⋆ → Y1 = ⋆.
-/2 width=3 by lfxs_inv_atom_dx/ qed-.
-
-lemma lfeq_inv_zero: ∀Y1,Y2. Y1 ≡[#0] Y2 →
- (Y1 = ⋆ ∧ Y2 = ⋆) ∨
- ∃∃I,L1,L2,V. L1 ≡[V] L2 &
- Y1 = L1.ⓑ{I}V & Y2 = L2.ⓑ{I}V.
-#Y1 #Y2 #H elim (lfxs_inv_zero … H) -H *
-/3 width=7 by ex3_4_intro, or_introl, or_intror, conj/
-qed-.
-
-lemma lfeq_inv_lref: ∀Y1,Y2,i. Y1 ≡[#⫯i] Y2 →
- (Y1 = ⋆ ∧ Y2 = ⋆) ∨
- ∃∃I,L1,L2,V1,V2. L1 ≡[#i] L2 &
- Y1 = L1.ⓑ{I}V1 & Y2 = L2.ⓑ{I}V2.
-/2 width=1 by lfxs_inv_lref/ qed-.
-
-lemma lfeq_inv_bind: ∀p,I,L1,L2,V,T. L1 ≡[ⓑ{p,I}V.T] L2 →
- L1 ≡[V] L2 ∧ L1.ⓑ{I}V ≡[T] L2.ⓑ{I}V.
-/2 width=2 by lfxs_inv_bind/ qed-.
-
-lemma lfeq_inv_flat: ∀I,L1,L2,V,T. L1 ≡[ⓕ{I}V.T] L2 →
- L1 ≡[V] L2 ∧ L1 ≡[T] L2.
-/2 width=2 by lfxs_inv_flat/ qed-.
-
-(* Advanced inversion lemmas ************************************************)
-
-lemma lfeq_inv_zero_pair_sn: ∀I,Y2,L1,V. L1.ⓑ{I}V ≡[#0] Y2 →
- ∃∃L2. L1 ≡[V] L2 & Y2 = L2.ⓑ{I}V.
-#I #Y2 #L1 #V #H elim (lfxs_inv_zero_pair_sn … H) -H /2 width=3 by ex2_intro/
-qed-.
-
-lemma lfeq_inv_zero_pair_dx: ∀I,Y1,L2,V. Y1 ≡[#0] L2.ⓑ{I}V →
- ∃∃L1. L1 ≡[V] L2 & Y1 = L1.ⓑ{I}V.
-#I #Y1 #L2 #V #H elim (lfxs_inv_zero_pair_dx … H) -H
-#L1 #X #HL12 #HX #H destruct /2 width=3 by ex2_intro/
-qed-.
-
-lemma lfeq_inv_lref_pair_sn: ∀I,Y2,L1,V1,i. L1.ⓑ{I}V1 ≡[#⫯i] Y2 →
- ∃∃L2,V2. L1 ≡[#i] L2 & Y2 = L2.ⓑ{I}V2.
-/2 width=2 by lfxs_inv_lref_pair_sn/ qed-.
-
-lemma lfeq_inv_lref_pair_dx: ∀I,Y1,L2,V2,i. Y1 ≡[#⫯i] L2.ⓑ{I}V2 →
- ∃∃L1,V1. L1 ≡[#i] L2 & Y1 = L1.ⓑ{I}V1.
-/2 width=2 by lfxs_inv_lref_pair_dx/ qed-.
-
-(* Basic forward lemmas *****************************************************)
-
-lemma lfeq_fwd_bind_sn: ∀p,I,L1,L2,V,T. L1 ≡[ⓑ{p,I}V.T] L2 → L1 ≡[V] L2.
-/2 width=4 by lfxs_fwd_bind_sn/ qed-.
-
-lemma lfeq_fwd_bind_dx: ∀p,I,L1,L2,V,T.
- L1 ≡[ⓑ{p,I}V.T] L2 → L1.ⓑ{I}V ≡[T] L2.ⓑ{I}V.
-/2 width=2 by lfxs_fwd_bind_dx/ qed-.
-
-lemma lfeq_fwd_flat_sn: ∀I,L1,L2,V,T. L1 ≡[ⓕ{I}V.T] L2 → L1 ≡[V] L2.
-/2 width=3 by lfxs_fwd_flat_sn/ qed-.
-
-lemma lfeq_fwd_flat_dx: ∀I,L1,L2,V,T. L1 ≡[ⓕ{I}V.T] L2 → L1 ≡[T] L2.
-/2 width=3 by lfxs_fwd_flat_dx/ qed-.
-
-lemma lfeq_fwd_pair_sn: ∀I,L1,L2,V,T. L1 ≡[②{I}V.T] L2 → L1 ≡[V] L2.
-/2 width=3 by lfxs_fwd_pair_sn/ qed-.
-
-(* Advanceded forward lemmas with generic extension on referred entries *****)
-
-lemma lfex_fwd_lfxs_refl: ∀R. (∀L. reflexive … (R L)) →
- ∀L1,L2,T. L1 ≡[T] L2 → L1 ⦻*[R, T] L2.
-/2 width=3 by lfxs_co/ qed-.
-
-(* Basic_2A1: removed theorems 30:
- lleq_ind lleq_inv_bind lleq_inv_flat lleq_fwd_length lleq_fwd_lref
- lleq_fwd_drop_sn lleq_fwd_drop_dx
- lleq_fwd_bind_sn lleq_fwd_bind_dx lleq_fwd_flat_sn lleq_fwd_flat_dx
- lleq_sort lleq_skip lleq_lref lleq_free lleq_gref lleq_bind lleq_flat
- lleq_refl lleq_Y lleq_sym lleq_ge_up lleq_ge lleq_bind_O llpx_sn_lrefl
- lleq_trans lleq_canc_sn lleq_canc_dx lleq_nlleq_trans nlleq_lleq_div
-*)
+++ /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/static/lfxs_fqup.ma".
-include "basic_2/static/lfeq.ma".
-
-(* EQUIVALENCE FOR LOCAL ENVIRONMENTS ON REFERRED ENTRIES *******************)
-
-(* Advanced properties ******************************************************)
-
-lemma lfeq_refl: ∀T. reflexive … (lfeq T).
-/2 width=1 by lfxs_refl/ 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/static/lfxs_length.ma".
-include "basic_2/static/lfeq.ma".
-
-(* EQUIVALENCE FOR LOCAL ENVIRONMENTS ON REFERRED ENTRIES *******************)
-
-(* Forward lemmas with length for local environments ************************)
-
-lemma lfeq_fwd_length: ∀L1,L2,T. L1 ≡[T] L2 → |L1| = |L2|.
-/2 width=3 by lfxs_fwd_length/ 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/lreq_lreq.ma".
-include "basic_2/static/lfxs_lfxs.ma".
-include "basic_2/static/lfeq_lreq.ma".
-
-(* EQUIVALENCE FOR LOCAL ENVIRONMENTS ON REFERRED ENTRIES *******************)
-
-(* Main properties **********************************************************)
-
-theorem lfeq_bind: ∀p,I,L1,L2,V1,V2,T.
- L1 ≡[V1] L2 → L1.ⓑ{I}V1 ≡[T] L2.ⓑ{I}V2 →
- L1 ≡[ⓑ{p,I}V1.T] L2.
-/2 width=2 by lfxs_bind/ qed.
-
-theorem lfeq_flat: ∀I,L1,L2,V,T. L1 ≡[V] L2 → L1 ≡[T] L2 →
- L1 ≡[ⓕ{I}V.T] L2.
-/2 width=1 by lfxs_flat/ qed.
-
-(* Note: /2 width=3 by lfeq_lfxs_trans/ *)
-theorem lfeq_trans: ∀T. Transitive … (lfeq T).
-#T #L1 #L * #f1 #Hf1 #HL1 #L2 * #f2 #Hf2 #HL2
-lapply (frees_lreq_conf … Hf1 … HL1) #H0
-lapply (frees_mono … Hf2 … H0) -Hf2 -H0
-/4 width=7 by lreq_trans, lexs_eq_repl_back, ex2_intro/
-qed-.
-
-theorem lfeq_canc_sn: ∀T. left_cancellable … (lfeq T).
-/3 width=3 by lfeq_trans, lfeq_sym/ qed-.
-
-theorem lfeq_canc_dx: ∀T. right_cancellable … (lfeq T).
-/3 width=3 by lfeq_trans, lfeq_sym/ qed-.
-
-(* Advanced properies on negated lazy equivalence *****************************)
-
-(* Note: for use in auto, works with /4 width=8/ so lfeq_canc_sn is preferred *)
-lemma lfeq_nlfeq_trans: ∀T,L1,L. L1 ≡[T] L →
- ∀L2. (L ≡[T] L2 → ⊥) → (L1 ≡[T] L2 → ⊥).
-/3 width=3 by lfeq_canc_sn/ qed-.
-
-lemma nlfeq_lfeq_div: ∀T,L2,L. L2 ≡[T] L →
- ∀L1. (L1 ≡[T] L → ⊥) → (L1 ≡[T] L2 → ⊥).
-/3 width=3 by lfeq_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/static/frees_lreq.ma".
-include "basic_2/static/lfeq.ma".
-
-(* EQUIVALENCE FOR LOCAL ENVIRONMENTS ON REFERRED ENTRIES *******************)
-
-(* Inversion lemmas with ranged equivalence for local environments **********)
-
-lemma lfeq_inv_lreq: ∀L1,L2,T. L1 ≡[T] L2 → ∃∃f. L1 ⊢ 𝐅*⦃T⦄ ≡ f & L1 ≡[f] L2.
-#L1 #L2 #T * /2 width=3 by ex2_intro/
-qed-.
-
-(* Properties with ranged equivalence for local environments ****************)
-
-lemma lreq_lfeq: ∀f,L1,L2,T. L1 ⊢ 𝐅*⦃T⦄ ≡ f → L1 ≡[f] L2 → L1 ≡[T] L2.
-/2 width=3 by ex2_intro/ qed.
-
-(* Advanced properties ******************************************************)
-
-lemma lfeq_sym: ∀T. symmetric … (lfeq T).
-#T #L1 #L2 #H elim (lfeq_inv_lreq … H) -H
-/3 width=3 by lreq_lfeq, frees_lreq_conf, lreq_sym/
-qed-.
/3 width=5 by lexs_pair_repl, ex2_intro/
qed-.
+lemma lfxs_sym: ∀R. lexs_frees_confluent R cfull →
+ (∀L1,L2,T1,T2. R L1 T1 T2 → R L2 T2 T1) →
+ ∀T. symmetric … (lfxs R T).
+#R #H1R #H2R #T #L1 #L2 * #f1 #Hf1 #HL12 elim (H1R … Hf1 … HL12) -Hf1
+/4 width=5 by sle_lexs_trans, lexs_sym, ex2_intro/
+qed-.
+
lemma lfxs_co: ∀R1,R2. (∀L,T1,T2. R1 L T1 T2 → R2 L T1 T2) →
∀L1,L2,T. L1 ⦻*[R1, T] L2 → L1 ⦻*[R2, T] L2.
#R1 #R2 #HR #L1 #L2 #T * /4 width=7 by lexs_co, ex2_intro/
qed-.
lemma lfxs_inv_sort: ∀R,Y1,Y2,s. Y1 ⦻*[R, ⋆s] Y2 →
- (Y1 = ⋆ ∧ Y2 = ⋆) ∨
+ (Y1 = ⋆ ∧ Y2 = ⋆) ∨
∃∃I,L1,L2,V1,V2. L1 ⦻*[R, ⋆s] L2 &
Y1 = L1.ⓑ{I}V1 & Y2 = L2.ⓑ{I}V2.
#R * [ | #Y1 #I #V1 ] #Y2 #s * #f #H1 #H2
qed-.
lemma lfxs_inv_zero: ∀R,Y1,Y2. Y1 ⦻*[R, #0] Y2 →
- (Y1 = ⋆ ∧ Y2 = ⋆) ∨
+ (Y1 = ⋆ ∧ Y2 = ⋆) ∨
∃∃I,L1,L2,V1,V2. L1 ⦻*[R, V1] L2 & R L1 V1 V2 &
Y1 = L1.ⓑ{I}V1 & Y2 = L2.ⓑ{I}V2.
#R #Y1 #Y2 * #f #H1 #H2 elim (frees_inv_zero … H1) -H1 *
qed-.
lemma lfxs_inv_lref: ∀R,Y1,Y2,i. Y1 ⦻*[R, #⫯i] Y2 →
- (Y1 = ⋆ ∧ Y2 = ⋆) ∨
+ (Y1 = ⋆ ∧ Y2 = ⋆) ∨
∃∃I,L1,L2,V1,V2. L1 ⦻*[R, #i] L2 &
Y1 = L1.ⓑ{I}V1 & Y2 = L2.ⓑ{I}V2.
#R #Y1 #Y2 #i * #f #H1 #H2 elim (frees_inv_lref … H1) -H1 *
#R #I #L1 #L2 #V #T * #f1 #HV #Hf1 * #f2 #HT #Hf2 elim (sor_isfin_ex f1 f2)
/3 width=7 by frees_fwd_isfin, frees_flat, lexs_join, ex2_intro/
qed.
+(*
+theorem lfxs_trans: ∀R. lexs_frees_confluent R cfull →
+ ∀T. Transitive … (lfxs R T).
+#R #H1R #T #L1 #L * #f1 #Hf1 #HL1 #L2 * #f2 #Hf2 #HL2
+elim (H1R … Hf1 … HL1) #f #H0 #H1
+lapply (frees_mono … Hf2 … H0) -Hf2 -H0 #Hf2
+lapply (lexs_eq_repl_back … HL2 … Hf2) -f2 #HL2
+lapply (sle_lexs_trans … HL1 … H1) -HL1 // #Hl1
+@(ex2_intro … f)
+/4 width=7 by lreq_trans, lexs_eq_repl_back, ex2_intro/
+qed-.
+*)
theorem lfxs_conf: ∀R. lexs_frees_confluent R cfull →
R_confluent2_lfxs R R R R →
∀T. confluent … (lfxs R T).
+++ /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/syntax/item_sd.ma".
-include "basic_2/syntax/lenv.ma".
-
-(* DEGREE-BASED EQUIVALENCE ON TERMS ****************************************)
-
-inductive deq (h) (o): relation term ≝
-| deq_sort: ∀s1,s2,d. deg h o s1 d → deg h o s2 d → deq h o (⋆s1) (⋆s2)
-| deq_lref: ∀i. deq h o (#i) (#i)
-| deq_gref: ∀l. deq h o (§l) (§l)
-| deq_pair: ∀I,V1,V2,T1,T2. deq h o V1 V2 → deq h o T1 T2 → deq h o (②{I}V1.T1) (②{I}V2.T2)
-.
-
-interpretation
- "degree-based equivalence (terms)"
- 'LazyEq h o T1 T2 = (deq h o T1 T2).
-
-definition cdeq: ∀h. sd h → relation3 lenv term term ≝
- λh,o,L. deq h o.
-
-(* Basic properties *********************************************************)
-
-lemma deq_refl: ∀h,o. reflexive … (deq h o).
-#h #o #T elim T -T /2 width=1 by deq_pair/
-* /2 width=1 by deq_lref, deq_gref/
-#s elim (deg_total h o s) /2 width=3 by deq_sort/
-qed.
-
-lemma deq_sym: ∀h,o. symmetric … (deq h o).
-#h #o #T1 #T2 #H elim H -T1 -T2
-/2 width=3 by deq_sort, deq_lref, deq_gref, deq_pair/
-qed-.
-
-(* Basic inversion lemmas ***************************************************)
-
-fact deq_inv_sort1_aux: ∀h,o,X,Y. X ≡[h, o] Y → ∀s1. X = ⋆s1 →
- ∃∃s2,d. deg h o s1 d & deg h o s2 d & Y = ⋆s2.
-#h #o #X #Y * -X -Y
-[ #s1 #s2 #d #Hs1 #Hs2 #s #H destruct /2 width=5 by ex3_2_intro/
-| #i #s #H destruct
-| #l #s #H destruct
-| #I #V1 #V2 #T1 #T2 #_ #_ #s #H destruct
-]
-qed-.
-
-lemma deq_inv_sort1: ∀h,o,Y,s1. ⋆s1 ≡[h, o] Y →
- ∃∃s2,d. deg h o s1 d & deg h o s2 d & Y = ⋆s2.
-/2 width=3 by deq_inv_sort1_aux/ qed-.
-
-fact deq_inv_lref1_aux: ∀h,o,X,Y. X ≡[h, o] Y → ∀i. X = #i → Y = #i.
-#h #o #X #Y * -X -Y //
-[ #s1 #s2 #d #_ #_ #j #H destruct
-| #I #V1 #V2 #T1 #T2 #_ #_ #j #H destruct
-]
-qed-.
-
-lemma deq_inv_lref1: ∀h,o,Y,i. #i ≡[h, o] Y → Y = #i.
-/2 width=5 by deq_inv_lref1_aux/ qed-.
-
-fact deq_inv_gref1_aux: ∀h,o,X,Y. X ≡[h, o] Y → ∀l. X = §l → Y = §l.
-#h #o #X #Y * -X -Y //
-[ #s1 #s2 #d #_ #_ #k #H destruct
-| #I #V1 #V2 #T1 #T2 #_ #_ #k #H destruct
-]
-qed-.
-
-lemma deq_inv_gref1: ∀h,o,Y,l. §l ≡[h, o] Y → Y = §l.
-/2 width=5 by deq_inv_gref1_aux/ qed-.
-
-fact deq_inv_pair1_aux: ∀h,o,X,Y. X ≡[h, o] Y → ∀I,V1,T1. X = ②{I}V1.T1 →
- ∃∃V2,T2. V1 ≡[h, o] V2 & T1 ≡[h, o] T2 & Y = ②{I}V2.T2.
-#h #o #X #Y * -X -Y
-[ #s1 #s2 #d #_ #_ #J #W1 #U1 #H destruct
-| #i #J #W1 #U1 #H destruct
-| #l #J #W1 #U1 #H destruct
-| #I #V1 #V2 #T1 #T2 #HV #HT #J #W1 #U1 #H destruct /2 width=5 by ex3_2_intro/
-]
-qed-.
-
-lemma deq_inv_pair1: ∀h,o,I,V1,T1,Y. ②{I}V1.T1 ≡[h, o] Y →
- ∃∃V2,T2. V1 ≡[h, o] V2 & T1 ≡[h, o] T2 & Y = ②{I}V2.T2.
-/2 width=3 by deq_inv_pair1_aux/ qed-.
-
-(* Advanced inversion lemmas ************************************************)
-
-lemma deq_inv_sort1_deg: ∀h,o,Y,s1. ⋆s1 ≡[h, o] Y → ∀d. deg h o s1 d →
- ∃∃s2. deg h o s2 d & Y = ⋆s2.
-#h #o #Y #s1 #H #d #Hs1 elim (deq_inv_sort1 … H) -H
-#s2 #x #Hx <(deg_mono h o … Hx … Hs1) -s1 -d /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/syntax/deq.ma".
-
-(* DEGREE-BASED EQUIVALENCE ON TERMS ****************************************)
-
-(* Main properties **********************************************************)
-
-theorem deq_trans: ∀h,o. Transitive … (deq h o).
-#h #o #T1 #T #H elim H -T1 -T
-[ #s1 #s #d #Hs1 #Hs #X #H
- elim (deq_inv_sort1_deg … H … Hs) -s /2 width=3 by deq_sort/
-| #i1 #i #H <(deq_inv_lref1 … H) -H //
-| #l1 #l #H <(deq_inv_gref1 … H) -H //
-| #I #V1 #V #T1 #T #_ #_ #IHV #IHT #X #H destruct
- elim (deq_inv_pair1 … H) -H /3 width=1 by deq_pair/
-]
-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/syntax/item_sd.ma".
+include "basic_2/syntax/lenv.ma".
+
+(* DEGREE-BASED EQUIVALENCE ON TERMS ****************************************)
+
+inductive tdeq (h) (o): relation term ≝
+| tdeq_sort: ∀s1,s2,d. deg h o s1 d → deg h o s2 d → tdeq h o (⋆s1) (⋆s2)
+| tdeq_lref: ∀i. tdeq h o (#i) (#i)
+| tdeq_gref: ∀l. tdeq h o (§l) (§l)
+| tdeq_pair: ∀I,V1,V2,T1,T2. tdeq h o V1 V2 → tdeq h o T1 T2 → tdeq h o (②{I}V1.T1) (②{I}V2.T2)
+.
+
+interpretation
+ "degree-based equivalence (terms)"
+ 'LazyEq h o T1 T2 = (tdeq h o T1 T2).
+
+definition cdeq: ∀h. sd h → relation3 lenv term term ≝
+ λh,o,L. tdeq h o.
+
+(* Basic properties *********************************************************)
+
+lemma tdeq_refl: ∀h,o. reflexive … (tdeq h o).
+#h #o #T elim T -T /2 width=1 by tdeq_pair/
+* /2 width=1 by tdeq_lref, tdeq_gref/
+#s elim (deg_total h o s) /2 width=3 by tdeq_sort/
+qed.
+
+lemma tdeq_sym: ∀h,o. symmetric … (tdeq h o).
+#h #o #T1 #T2 #H elim H -T1 -T2
+/2 width=3 by tdeq_sort, tdeq_lref, tdeq_gref, tdeq_pair/
+qed-.
+
+(* Basic inversion lemmas ***************************************************)
+
+fact tdeq_inv_sort1_aux: ∀h,o,X,Y. X ≡[h, o] Y → ∀s1. X = ⋆s1 →
+ ∃∃s2,d. deg h o s1 d & deg h o s2 d & Y = ⋆s2.
+#h #o #X #Y * -X -Y
+[ #s1 #s2 #d #Hs1 #Hs2 #s #H destruct /2 width=5 by ex3_2_intro/
+| #i #s #H destruct
+| #l #s #H destruct
+| #I #V1 #V2 #T1 #T2 #_ #_ #s #H destruct
+]
+qed-.
+
+lemma tdeq_inv_sort1: ∀h,o,Y,s1. ⋆s1 ≡[h, o] Y →
+ ∃∃s2,d. deg h o s1 d & deg h o s2 d & Y = ⋆s2.
+/2 width=3 by tdeq_inv_sort1_aux/ qed-.
+
+fact tdeq_inv_lref1_aux: ∀h,o,X,Y. X ≡[h, o] Y → ∀i. X = #i → Y = #i.
+#h #o #X #Y * -X -Y //
+[ #s1 #s2 #d #_ #_ #j #H destruct
+| #I #V1 #V2 #T1 #T2 #_ #_ #j #H destruct
+]
+qed-.
+
+lemma tdeq_inv_lref1: ∀h,o,Y,i. #i ≡[h, o] Y → Y = #i.
+/2 width=5 by tdeq_inv_lref1_aux/ qed-.
+
+fact tdeq_inv_gref1_aux: ∀h,o,X,Y. X ≡[h, o] Y → ∀l. X = §l → Y = §l.
+#h #o #X #Y * -X -Y //
+[ #s1 #s2 #d #_ #_ #k #H destruct
+| #I #V1 #V2 #T1 #T2 #_ #_ #k #H destruct
+]
+qed-.
+
+lemma tdeq_inv_gref1: ∀h,o,Y,l. §l ≡[h, o] Y → Y = §l.
+/2 width=5 by tdeq_inv_gref1_aux/ qed-.
+
+fact tdeq_inv_pair1_aux: ∀h,o,X,Y. X ≡[h, o] Y → ∀I,V1,T1. X = ②{I}V1.T1 →
+ ∃∃V2,T2. V1 ≡[h, o] V2 & T1 ≡[h, o] T2 & Y = ②{I}V2.T2.
+#h #o #X #Y * -X -Y
+[ #s1 #s2 #d #_ #_ #J #W1 #U1 #H destruct
+| #i #J #W1 #U1 #H destruct
+| #l #J #W1 #U1 #H destruct
+| #I #V1 #V2 #T1 #T2 #HV #HT #J #W1 #U1 #H destruct /2 width=5 by ex3_2_intro/
+]
+qed-.
+
+lemma tdeq_inv_pair1: ∀h,o,I,V1,T1,Y. ②{I}V1.T1 ≡[h, o] Y →
+ ∃∃V2,T2. V1 ≡[h, o] V2 & T1 ≡[h, o] T2 & Y = ②{I}V2.T2.
+/2 width=3 by tdeq_inv_pair1_aux/ qed-.
+
+(* Advanced inversion lemmas ************************************************)
+
+lemma tdeq_inv_sort1_deg: ∀h,o,Y,s1. ⋆s1 ≡[h, o] Y → ∀d. deg h o s1 d →
+ ∃∃s2. deg h o s2 d & Y = ⋆s2.
+#h #o #Y #s1 #H #d #Hs1 elim (tdeq_inv_sort1 … H) -H
+#s2 #x #Hx <(deg_mono h o … Hx … Hs1) -s1 -d /2 width=3 by ex2_intro/
+qed-.
+
+(* Basic forward lemmas *****************************************************)
+
+lemma tdeq_fwd_atom1: ∀h,o,I,Y. ⓪{I} ≡[h, o] Y → ∃J. Y = ⓪{J}.
+#h #o * #x #Y #H [ elim (tdeq_inv_sort1 … H) -H ]
+/3 width=4 by tdeq_inv_gref1, tdeq_inv_lref1, 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/syntax/tdeq.ma".
+
+(* DEGREE-BASED EQUIVALENCE ON TERMS ****************************************)
+
+(* Main properties **********************************************************)
+
+theorem tdeq_trans: ∀h,o. Transitive … (tdeq h o).
+#h #o #T1 #T #H elim H -T1 -T
+[ #s1 #s #d #Hs1 #Hs #X #H
+ elim (tdeq_inv_sort1_deg … H … Hs) -s /2 width=3 by tdeq_sort/
+| #i1 #i #H <(tdeq_inv_lref1 … H) -H //
+| #l1 #l #H <(tdeq_inv_gref1 … H) -H //
+| #I #V1 #V #T1 #T #_ #_ #IHV #IHT #X #H destruct
+ elim (tdeq_inv_pair1 … H) -H /3 width=1 by tdeq_pair/
+]
+qed-.
}
]
[ { "atomic arity assignment" * } {
- [ "aaa ( ⦃?,?⦄ ⊢ ? ⁝ ? )" "aaa_drops" + "aaa_fqus" + "aaa_lfeq" + "aaa_aaa" * ]
+ [ "aaa ( ⦃?,?⦄ ⊢ ? ⁝ ? )" "aaa_drops" + "aaa_fqus" + "aaa_lfdeq" + "aaa_aaa" * ]
}
]
- [ { "equivalence for closures on referred entries" * } {
- [ "ffeq ( ⦃?,?,?⦄ ≡ ⦃?,?,?⦄ )" "ffeq_freq" * ]
+ [ { "degree-based equivalence for closures on referred entries" * } {
+ [ "ffdeq ( ⦃?,?,?⦄ ≡[?,?] ⦃?,?,?⦄ )" "ffdeq_fqup" + "ffdeq_ffdeq" * ]
}
]
- [ { "equivalence for local environments on referred entries" * } {
- [ "lfeq ( ? ≡[?] ? )" "lfeq_length" + "lfeq_lreq" + "lfeq_fqup" + "lfeq_lfeq" * ]
+ [ { "degree-based equivalence for local environments on referred entries" * } {
+ [ "lfdeq ( ? ≡[?,?,?] ? )" "lfdeq_length" + "lfdeq_fqup" + "lfdeq_lfdeq" * ]
}
]
[ { "generic extension on referred entries" * } {
}
]
[ { "context-sensitive free variables" * } {
- [ "frees ( ? ⊢ 𝐅*⦃?⦄ ≡ ? )" "frees_weight" + "frees_lreq" + "frees_drops" + "frees_fqup" + "frees_frees" * ]
+ [ "frees ( ? ⊢ 𝐅*⦃?⦄ ≡ ? )" "frees_weight" + "frees_drops" + "frees_fqup" + "frees_frees" * ]
}
]
[ { "restricted ref. for local env." * } {