From c671743a83bbc7fff114e3e3694f628c0ec6685b Mon Sep 17 00:00:00 2001 From: Ferruccio Guidi Date: Sun, 1 Jun 2014 18:44:03 +0000 Subject: [PATCH] - advances on hereditarily free variables: now "frees" is primitive - some refactoring in etc --- .../etc/{cpy/cpy.etc => append/cpy2.etc} | 0 .../lambdadelta/basic_2/etc/append/cpys0.etc | 24 +++ .../etc/{cpy/cpys.etc => append/cpys2.etc} | 0 .../lambdadelta/basic_2/etc/append/lpys0.etc | 29 ++++ .../basic_2/etc/cofrees0/cofrees.etc | 116 +++++++++++++ .../basic_2/etc/cofrees0/cofrees_alt.etc | 104 ++++++++++++ .../basic_2/etc/cofrees0/cofrees_lift.etc | 148 ++++++++++++++++ .../basic_2/etc/cofrees0/cofreestar_3.etc | 19 +++ .../cofrees.ma => etc/cofrees1/cofrees.etc} | 4 + .../cofrees1/cofrees_alt.etc} | 0 .../cofrees1/cofrees_lift.etc} | 36 ++++ .../cofrees1/cofreestar_4.etc} | 0 .../basic_2/etc/{cpys => cpys0}/cpys.etc | 95 ++++------- .../basic_2/etc/{cpys => cpys0}/cpys_cpys.etc | 8 +- .../basic_2/etc/{cpys => cpys0}/cpys_lift.etc | 78 ++++----- .../basic_2/etc/{cpys => cpys0}/lpys.etc | 44 ++--- .../etc/{cpys => cpys0}/lpys_ldrop.etc | 32 ++-- .../basic_2/etc/{cpys => cpys0}/lpys_lpys.etc | 16 -- .../extlrsubeq_2.etc => cpys0/lrsubeq_2.etc} | 4 +- .../basic_2/etc/{cpys => cpys0}/lsuby.etc | 54 ++++-- .../etc/{cpys => cpys0}/lsuby_lsuby.etc | 2 +- .../psubstsnstar_3.etc} | 4 +- .../psubststar_4.etc} | 4 +- .../basic_2/etc/{cpy => cpys2}/cpx_cpys.etc | 0 .../basic_2/etc/{cpy => cpys2}/cpx_cpys2.etc | 0 .../basic_2/etc/{cpy => cpys2}/cpxs_cpys.etc | 0 .../basic_2/etc/{cpy => cpys2}/lpx_cpys.etc | 0 .../basic_2/etc/{cpy => cpys2}/lsuby.etc | 0 .../basic_2/notation/relations/freestar_4.ma | 19 +++ .../basic_2/reduction/lpx_frees.ma | 82 +++++++++ .../lambdadelta/basic_2/relocation/cpy.ma | 1 - .../lambdadelta/basic_2/substitution/frees.ma | 160 ++++++++++++++++++ .../basic_2/substitution/frees_lift.ma | 73 ++++++++ .../basic_2/substitution/lleq_alt.ma | 4 +- .../basic_2/substitution/lleq_llor.ma | 20 +-- .../lambdadelta/basic_2/substitution/llor.ma | 8 +- .../basic_2/substitution/llor_ldrop.ma | 22 +++ .../basic_2/substitution/llpx_sn_alt.ma | 10 +- .../lambdadelta/basic_2/web/basic_2_src.tbl | 6 +- 39 files changed, 1012 insertions(+), 214 deletions(-) rename matita/matita/contribs/lambdadelta/basic_2/etc/{cpy/cpy.etc => append/cpy2.etc} (100%) create mode 100644 matita/matita/contribs/lambdadelta/basic_2/etc/append/cpys0.etc rename matita/matita/contribs/lambdadelta/basic_2/etc/{cpy/cpys.etc => append/cpys2.etc} (100%) create mode 100644 matita/matita/contribs/lambdadelta/basic_2/etc/append/lpys0.etc create mode 100644 matita/matita/contribs/lambdadelta/basic_2/etc/cofrees0/cofrees.etc create mode 100644 matita/matita/contribs/lambdadelta/basic_2/etc/cofrees0/cofrees_alt.etc create mode 100644 matita/matita/contribs/lambdadelta/basic_2/etc/cofrees0/cofrees_lift.etc create mode 100644 matita/matita/contribs/lambdadelta/basic_2/etc/cofrees0/cofreestar_3.etc rename matita/matita/contribs/lambdadelta/basic_2/{substitution/cofrees.ma => etc/cofrees1/cofrees.etc} (96%) rename matita/matita/contribs/lambdadelta/basic_2/{substitution/cofrees_alt.ma => etc/cofrees1/cofrees_alt.etc} (100%) rename matita/matita/contribs/lambdadelta/basic_2/{substitution/cofrees_lift.ma => etc/cofrees1/cofrees_lift.etc} (81%) rename matita/matita/contribs/lambdadelta/basic_2/{notation/relations/cofreestar_4.ma => etc/cofrees1/cofreestar_4.etc} (100%) rename matita/matita/contribs/lambdadelta/basic_2/etc/{cpys => cpys0}/cpys.etc (63%) rename matita/matita/contribs/lambdadelta/basic_2/etc/{cpys => cpys0}/cpys_cpys.etc (93%) rename matita/matita/contribs/lambdadelta/basic_2/etc/{cpys => cpys0}/cpys_lift.etc (71%) rename matita/matita/contribs/lambdadelta/basic_2/etc/{cpys => cpys0}/lpys.etc (55%) rename matita/matita/contribs/lambdadelta/basic_2/etc/{cpys => cpys0}/lpys_ldrop.etc (71%) rename matita/matita/contribs/lambdadelta/basic_2/etc/{cpys => cpys0}/lpys_lpys.etc (60%) rename matita/matita/contribs/lambdadelta/basic_2/etc/{cpys/extlrsubeq_2.etc => cpys0/lrsubeq_2.etc} (92%) rename matita/matita/contribs/lambdadelta/basic_2/etc/{cpys => cpys0}/lsuby.etc (55%) rename matita/matita/contribs/lambdadelta/basic_2/etc/{cpys => cpys0}/lsuby_lsuby.etc (97%) rename matita/matita/contribs/lambdadelta/basic_2/etc/{cpys/extpsubstsnstar_3.etc => cpys0/psubstsnstar_3.etc} (94%) rename matita/matita/contribs/lambdadelta/basic_2/etc/{cpys/extpsubststar_4.etc => cpys0/psubststar_4.etc} (93%) rename matita/matita/contribs/lambdadelta/basic_2/etc/{cpy => cpys2}/cpx_cpys.etc (100%) rename matita/matita/contribs/lambdadelta/basic_2/etc/{cpy => cpys2}/cpx_cpys2.etc (100%) rename matita/matita/contribs/lambdadelta/basic_2/etc/{cpy => cpys2}/cpxs_cpys.etc (100%) rename matita/matita/contribs/lambdadelta/basic_2/etc/{cpy => cpys2}/lpx_cpys.etc (100%) rename matita/matita/contribs/lambdadelta/basic_2/etc/{cpy => cpys2}/lsuby.etc (100%) create mode 100644 matita/matita/contribs/lambdadelta/basic_2/notation/relations/freestar_4.ma create mode 100644 matita/matita/contribs/lambdadelta/basic_2/reduction/lpx_frees.ma create mode 100644 matita/matita/contribs/lambdadelta/basic_2/substitution/frees.ma create mode 100644 matita/matita/contribs/lambdadelta/basic_2/substitution/frees_lift.ma create mode 100644 matita/matita/contribs/lambdadelta/basic_2/substitution/llor_ldrop.ma diff --git a/matita/matita/contribs/lambdadelta/basic_2/etc/cpy/cpy.etc b/matita/matita/contribs/lambdadelta/basic_2/etc/append/cpy2.etc similarity index 100% rename from matita/matita/contribs/lambdadelta/basic_2/etc/cpy/cpy.etc rename to matita/matita/contribs/lambdadelta/basic_2/etc/append/cpy2.etc diff --git a/matita/matita/contribs/lambdadelta/basic_2/etc/append/cpys0.etc b/matita/matita/contribs/lambdadelta/basic_2/etc/append/cpys0.etc new file mode 100644 index 000000000..fa9bcf6de --- /dev/null +++ b/matita/matita/contribs/lambdadelta/basic_2/etc/append/cpys0.etc @@ -0,0 +1,24 @@ +include "basic_2/grammar/cl_shift.ma". +include "basic_2/relocation/ldrop_append.ma". + +lemma cpys_append: ∀G. l_appendable_sn … (cpys G). +#G #K #T1 #T2 #H elim H -G -K -T1 -T2 +/2 width=3 by cpys_bind, cpys_flat/ +#I #G #K #K0 #V1 #V2 #W2 #i #HK0 #_ #HVW2 #IHV12 #L +lapply (ldrop_fwd_length_lt2 … HK0) #H +@(cpys_delta … I … (L@@K0) V1 … HVW2) // +@(ldrop_O1_append_sn_le … HK0) /2 width=2 by lt_to_le/ (**) (* /3/ does not work *) +qed. + +lemma cpys_fwd_shift1: ∀G,L1,L,T1,T. ⦃G, L⦄ ⊢ L1 @@ T1 ▶*× T → + ∃∃L2,T2. |L1| = |L2| & T = L2 @@ T2. +#G #L1 @(lenv_ind_dx … L1) -L1 normalize +[ #L #T1 #T #HT1 @(ex2_2_intro … (⋆)) // (**) (* explicit constructor *) +| #I #L1 #V1 #IH #L #T1 #X >shift_append_assoc normalize + #H elim (cpys_inv_bind1 … H) -H + #V0 #T0 #_ #HT10 #H destruct + elim (IH … HT10) -IH -HT10 #L2 #T2 #HL12 #H destruct + >append_length >HL12 -HL12 + @(ex2_2_intro … (⋆.ⓑ{I}V0@@L2) T2) [ >append_length ] /2 width=3 by trans_eq/ (**) (* explicit constructor *) +] +qed-. diff --git a/matita/matita/contribs/lambdadelta/basic_2/etc/cpy/cpys.etc b/matita/matita/contribs/lambdadelta/basic_2/etc/append/cpys2.etc similarity index 100% rename from matita/matita/contribs/lambdadelta/basic_2/etc/cpy/cpys.etc rename to matita/matita/contribs/lambdadelta/basic_2/etc/append/cpys2.etc diff --git a/matita/matita/contribs/lambdadelta/basic_2/etc/append/lpys0.etc b/matita/matita/contribs/lambdadelta/basic_2/etc/append/lpys0.etc new file mode 100644 index 000000000..cb3dfd037 --- /dev/null +++ b/matita/matita/contribs/lambdadelta/basic_2/etc/append/lpys0.etc @@ -0,0 +1,29 @@ +lemma lpys_append: ∀G,K1,K2. ⦃G, K1⦄ ⊢ ▶*× K2 → ∀L1,L2. ⦃G, L1⦄ ⊢ ▶*× L2 → + ⦃G, L1 @@ K1⦄ ⊢ ▶*× L2 @@ K2. +/3 width=1 by lpx_sn_append, cpys_append/ qed. + +(* Advanced forward lemmas **************************************************) + +lemma lpys_fwd_append1: ∀G,K1,L1,L. ⦃G, K1 @@ L1⦄ ⊢ ▶*× L → + ∃∃K2,L2. ⦃G, K1⦄ ⊢ ▶*× K2 & L = K2 @@ L2. +/2 width=2 by lpx_sn_fwd_append1/ qed-. + +lemma lpys_fwd_append2: ∀G,L,K2,L2. ⦃G, L⦄ ⊢ ▶*× K2 @@ L2 → + ∃∃K1,L1. ⦃G, K1⦄ ⊢ ▶*× K2 & L = K1 @@ L1. +/2 width=2 by lpx_sn_fwd_append2/ qed-. + +(* Advanced forward lemmas **************************************************) + +lemma cpys_fwd_shift1_ext: ∀G,L1,L,T1,T. ⦃G, L⦄ ⊢ L1 @@ T1 ▶*× T → + ∃∃L2,T2. ⦃G, L @@ L1⦄ ⊢ ▶*× L @@ L2 & ⦃G, L @@ L1⦄ ⊢ T1 ▶*× T2 & + T = L2 @@ T2. +#G #L1 @(lenv_ind_dx … L1) -L1 +[ #L #T1 #T #HT1 @ex3_2_intro + [3: // |4,5: // |1,2: skip ] (**) (* auto does not work *) +| #I #L1 #V1 #IH #L #T1 #T >shift_append_assoc #H (cpys_inv_sort1 … H) -X /2 width=2 by ex_intro/ +qed. + +lemma cofrees_gref: ∀L,i,p. L ⊢ i ~ϵ 𝐅*⦃§p⦄. +#L #i #p #X #H >(cpys_inv_gref1 … H) -X /2 width=2 by ex_intro/ +qed. + +lemma cofrees_bind: ∀L,V,i. L ⊢ i ~ϵ 𝐅*⦃V⦄ → + ∀I,T. L.ⓑ{I}V ⊢ i+1 ~ϵ 𝐅*⦃T⦄ → + ∀a. L ⊢ i ~ϵ 𝐅*⦃ⓑ{a,I}V.T⦄. +#L #W1 #i #HW1 #I #U1 #HU1 #a #X #H elim (cpys_inv_bind1 … H) -H +#W2 #U2 #HW12 #HU12 #H destruct +elim (HW1 … HW12) elim (HU1 … HU12) -W1 -U1 /3 width=2 by lift_bind, ex_intro/ +qed. + +lemma cofrees_flat: ∀L,V,i. L ⊢ i ~ϵ 𝐅*⦃V⦄ → ∀T. L ⊢ i ~ϵ 𝐅*⦃T⦄ → + ∀I. L ⊢ i ~ϵ 𝐅*⦃ⓕ{I}V.T⦄. +#L #W1 #i #HW1 #U1 #HU1 #I #X #H elim (cpys_inv_flat1 … H) -H +#W2 #U2 #HW12 #HU12 #H destruct +elim (HW1 … HW12) elim (HU1 … HU12) -W1 -U1 /3 width=2 by lift_flat, ex_intro/ +qed. + +axiom cofrees_dec: ∀L,T,i. Decidable (L ⊢ i ~ϵ 𝐅*⦃T⦄). + +(* Basic negated inversion lemmas *******************************************) + +lemma frees_inv_bind: ∀a,I,L,V,T,i. (L ⊢ i ~ϵ 𝐅*⦃ⓑ{a,I}V.T⦄ → ⊥) → + (L ⊢ i ~ϵ 𝐅*⦃V⦄ → ⊥) ∨ (L.ⓑ{I}V ⊢ i+1 ~ϵ 𝐅*⦃T⦄ → ⊥). +#a #I #L #W #U #i #H elim (cofrees_dec L W i) +/4 width=8 by cofrees_bind, or_intror, or_introl/ +qed-. + +lemma frees_inv_flat: ∀I,L,V,T,i. (L ⊢ i ~ϵ 𝐅*⦃ⓕ{I}V.T⦄ → ⊥) → + (L ⊢ i ~ϵ 𝐅*⦃V⦄ → ⊥) ∨ (L ⊢ i ~ϵ 𝐅*⦃T⦄ → ⊥). +#I #L #W #U #i #H elim (cofrees_dec L W i) +/4 width=7 by cofrees_flat, or_intror, or_introl/ +qed-. diff --git a/matita/matita/contribs/lambdadelta/basic_2/etc/cofrees0/cofrees_alt.etc b/matita/matita/contribs/lambdadelta/basic_2/etc/cofrees0/cofrees_alt.etc new file mode 100644 index 000000000..8443f38e3 --- /dev/null +++ b/matita/matita/contribs/lambdadelta/basic_2/etc/cofrees0/cofrees_alt.etc @@ -0,0 +1,104 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The 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/lift_neg.ma". +include "basic_2/relocation/lift_lift.ma". +include "basic_2/substitution/cpys.ma". +include "basic_2/substitution/cofrees_lift.ma". + +(* CONTEXT-SENSITIVE EXCLUSION FROM FREE VARIABLES **************************) + +(* Alternative definition of frees_ge ***************************************) + +(* +lemma cpys_fwd_nlift2: ∀G,L,U1,U2. ⦃G, L⦄ ⊢ U1 ▶* U2 → + ∀i. (∀T2. ⇧[i, 1] T2 ≡ U2 → ⊥) → + (∀T1. ⇧[i, 1] T1 ≡ U1 → ⊥) ∨ + ∃∃I,K,W,j. j < i & ⇩[j]L ≡ K.ⓑ{I}W & + (∀V. ⇧[i-j-1, 1] V ≡ W → ⊥) & (∀T1. ⇧[j, 1] T1 ≡ U1 → ⊥). +#G #L #U1 #U2 #H elim H -G -L -U1 -U2 +[ /3 width=2 by or_introl/ +| #I #G #L #K #V1 #V2 #W2 #j #HLK #_ #HVW2 #IHV12 #i #HnW2 + elim (lt_or_ge j i) #Hij + [ @or_intror (**) @(ex4_4_intro … HLK) // + [ #X #HXV elim (lift_trans_le … HXV … HVW ?) -V // + #Y #HXY >minus_plus minus_plus in ⊢ (??(?(?%?)?)??→?); >minus_plus in ⊢ (??(?(??%)?)??→?); >arith_b1 /2 width=1 by/ +] +qed-. + +lemma frees_ind_ge: ∀R:relation4 ynat nat lenv term. + (∀d,i,L,U. d ≤ yinj i → (∀T. ⇧[i, 1] T ≡ U → ⊥) → R d i L U) → + (∀d,i,j,I,L,K,W,U. d ≤ yinj j → j < i → ⇩[j]L ≡ K.ⓑ{I}W → (K ⊢ i-j-1 ~ϵ 𝐅*[0]⦃W⦄ → ⊥) → (∀T. ⇧[j, 1] T ≡ U → ⊥) → R 0 (i-j-1) K W → R d i L U) → + ∀d,i,L,U. d ≤ yinj i → (L ⊢ i ~ϵ 𝐅*[d]⦃U⦄ → ⊥) → R d i L U. +#R #IH1 #IH2 #d #i #L #U +generalize in match d; -d generalize in match i; -i +@(f2_ind … rfw … L U) -L -U +#n #IHn #L #U #Hn #i #d #Hdi #H elim (frees_inv_ge … H) -H /3 width=2 by/ +-IH1 * #I #K #W #j #Hdj #Hji #HLK #HnW #HnU destruct /4 width=12 by ldrop_fwd_rfw/ +qed-. +*) diff --git a/matita/matita/contribs/lambdadelta/basic_2/etc/cofrees0/cofrees_lift.etc b/matita/matita/contribs/lambdadelta/basic_2/etc/cofrees0/cofrees_lift.etc new file mode 100644 index 000000000..02f227a7a --- /dev/null +++ b/matita/matita/contribs/lambdadelta/basic_2/etc/cofrees0/cofrees_lift.etc @@ -0,0 +1,148 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The 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/cpys_lift.ma". +include "basic_2/substitution/cofrees.ma". + +(* CONTEXT-SENSITIVE EXCLUSION FROM FREE VARIABLES **************************) + +(* Advanced inversion lemmas ************************************************) + +lemma cofrees_inv_lref_lt: ∀L,i,j. L ⊢ i ~ϵ 𝐅*⦃#j⦄ → j < i → + ∀I,K,W. ⇩[j]L ≡ K.ⓑ{I}W → K ⊢ i-j-1 ~ϵ 𝐅*⦃W⦄. +#L #i #j #Hj #Hji #I #K #W1 #HLK #W2 #HW12 elim (lift_total W2 0 (j+1)) +#X2 #HWX2 elim (Hj X2) /2 width=7 by cpys_delta/ -I -L -K -W1 +#Z2 #HZX2 elim (lift_div_le … HWX2 (i-j-1) 1 Z2) -HWX2 /2 width=2 by ex_intro/ +>minus_plus minus_plus_plus_l // +| #J #W #U #Hn #i #H1 #j #H2 #I #K #V #HLK #Hji destruct + elim (cofrees_inv_flat … H1) -H1 #HW #HU + elim (nlift_inv_flat … H2) -H2 [ /3 width=7 by/ ] + #HnU @(IH … HU … HnU … HLK) // (**) (* full auto fails *) +] +qed-. + +(* Advanced properties ******************************************************) + +lemma cofrees_lref_gt: ∀L,i,j. i < j → L ⊢ i ~ϵ 𝐅*⦃#j⦄. +#L #i #j #Hij #X #H elim (cpys_inv_lref1 … H) -H +[ #H destruct /3 width=2 by lift_lref_ge_minus, ex_intro/ +| * #I #K #V1 #V2 #_ #_ #H -I -L -K -V1 + elim (lift_split … H i j) /2 width=2 by lt_to_le, ex_intro/ +] +qed. + +lemma cofrees_lref_lt: ∀I,L,K,W,i,j. j < i → ⇩[j] L ≡ K.ⓑ{I}W → + K ⊢ (i-j-1) ~ϵ 𝐅*⦃W⦄ → L ⊢ i ~ϵ 𝐅*⦃#j⦄. +#I #L #K #W1 #i #j #Hji #HLK #HW1 #X #H elim (cpys_inv_lref1 … H) -H +[ #H destruct /3 width=2 by lift_lref_lt, ex_intro/ +| * #I0 #K0 #W0 #W2 #HLK0 #HW12 #HW2 lapply (ldrop_mono … HLK0 … HLK) -L + #H destruct elim (HW1 … HW12) -I -K -W1 + #V2 #HVW2 elim (lift_trans_le … HVW2 … HW2) -W2 // + >minus_plus minus_plus (cpys_inv_sort1 … H) -X /2 width=2 by ex_intro/ qed. diff --git a/matita/matita/contribs/lambdadelta/basic_2/substitution/cofrees_alt.ma b/matita/matita/contribs/lambdadelta/basic_2/etc/cofrees1/cofrees_alt.etc similarity index 100% rename from matita/matita/contribs/lambdadelta/basic_2/substitution/cofrees_alt.ma rename to matita/matita/contribs/lambdadelta/basic_2/etc/cofrees1/cofrees_alt.etc diff --git a/matita/matita/contribs/lambdadelta/basic_2/substitution/cofrees_lift.ma b/matita/matita/contribs/lambdadelta/basic_2/etc/cofrees1/cofrees_lift.etc similarity index 81% rename from matita/matita/contribs/lambdadelta/basic_2/substitution/cofrees_lift.ma rename to matita/matita/contribs/lambdadelta/basic_2/etc/cofrees1/cofrees_lift.etc index 7dea71858..f93f72216 100644 --- a/matita/matita/contribs/lambdadelta/basic_2/substitution/cofrees_lift.ma +++ b/matita/matita/contribs/lambdadelta/basic_2/etc/cofrees1/cofrees_lift.etc @@ -142,3 +142,39 @@ lemma frees_be: ∀I,L,K,W,j. ⇩[j]L ≡ K.ⓑ{I}W → ∀U. (∀T. ⇧[j, 1] T ≡ U → ⊥) → ∀d. d ≤ yinj j → (L ⊢ i ~ϵ 𝐅*[d]⦃U⦄ → ⊥). /4 width=11 by cofrees_inv_be/ qed-. + +(* Relocation properties ****************************************************) + +lemma cofrees_lift_be: ∀d0,e0,i. d0 ≤ i → i ≤ d0 + e0 → + ∀L,K,s. ⇩[s, d0, e0+1] L ≡ K → ∀T,U. ⇧[d0, e0+1] T ≡ U → + ∀d. L ⊢ i ~ϵ 𝐅*[d]⦃U⦄. +#d0 #e0 #i #Hd0i #Hide0 #L #K #s #HLK #T1 #U1 #HTU1 #d #U2 #HU12 +elim (yle_split d0 d) #H1 +[ elim (yle_split d (d0+e0+1)) #H2 + [ letin cpys_inv ≝ cpys_inv_lift1_ge_up + | letin cpys_inv ≝ cpys_inv_lift1_ge + ] +| letin cpys_inv ≝ cpys_inv_lift1_be +] +elim (cpys_inv … HU12 … HLK … HTU1) // #T2 #_ #HTU2 -s -L -K -U1 -T1 -d +elim (lift_split … HTU2 i e0) /2 width=2 by ex_intro/ +qed. + +lemma cofrees_lift_ge: ∀d0,e0,i. d0 + e0 ≤ i → + ∀L,K,s. ⇩[s, d0, e0] L ≡ K → ∀T,U. ⇧[d0, e0] T ≡ U → + ∀d. K ⊢ i-e0 ~ϵ 𝐅*[d-yinj e0]⦃T⦄ → L ⊢ i ~ϵ 𝐅*[d]⦃U⦄. +#d0 #e0 #i #Hde0i #L #K #s #HLK #T1 #U1 #HTU1 #d #HT1 #U2 #HU12 +elim (le_inv_plus_l … Hde0i) -Hde0i #Hd0ie0 #He0i +elim (yle_split d0 d) #H1 +[ elim (yle_split d (d0+e0)) #H2 + [ elim (cpys_inv_lift1_ge_up … HU12 … HLK … HTU1) // >yplus_inj >yminus_Y_inj #T2 #HT12 + lapply (cpys_weak … HT12 (d-yinj e0) (∞) ? ?) /2 width=1 by yle_plus2_to_minus_inj2/ -HT12 + | elim (cpys_inv_lift1_ge … HU12 … HLK … HTU1) // #T2 + ] +| elim (cpys_inv_lift1_be … HU12 … HLK … HTU1) // >yminus_Y_inj #T2 #HT12 + lapply (cpys_weak … HT12 (d-yinj e0) (∞) ? ?) // -HT12 +] +-s -L #HT12 #HTU2 +elim (HT1 … HT12) -T1 #V2 #HVT2 +elim (lift_trans_le … HVT2 … HTU2 ?) // shift_append_assoc normalize - #H elim (cpys_inv_bind1 … H) -H - #V0 #T0 #_ #HT10 #H destruct - elim (IH … HT10) -IH -HT10 #L2 #T2 #HL12 #H destruct - >append_length >HL12 -HL12 - @(ex2_2_intro … (⋆.ⓑ{I}V0@@L2) T2) [ >append_length ] /2 width=3 by trans_eq/ (**) (* explicit constructor *) -] -qed-. diff --git a/matita/matita/contribs/lambdadelta/basic_2/etc/cpys/cpys_cpys.etc b/matita/matita/contribs/lambdadelta/basic_2/etc/cpys0/cpys_cpys.etc similarity index 93% rename from matita/matita/contribs/lambdadelta/basic_2/etc/cpys/cpys_cpys.etc rename to matita/matita/contribs/lambdadelta/basic_2/etc/cpys0/cpys_cpys.etc index e0abed64d..7f423f69f 100644 --- a/matita/matita/contribs/lambdadelta/basic_2/etc/cpys/cpys_cpys.etc +++ b/matita/matita/contribs/lambdadelta/basic_2/etc/cpys0/cpys_cpys.etc @@ -12,7 +12,7 @@ (* *) (**************************************************************************) -include "basic_2/grammar/lpx_sn_lpx_sn.ma". +include "basic_2/relocation/lpx_sn_lpx_sn.ma". include "basic_2/substitution/fqup.ma". include "basic_2/substitution/lpys_ldrop.ma". @@ -20,9 +20,9 @@ include "basic_2/substitution/lpys_ldrop.ma". (* Main properties **********************************************************) -theorem cpys_antisym: ∀G,L,T1,T2. ⦃G, L⦄ ⊢ T1 ▶*× T2 → ⦃G, L⦄ ⊢ T2 ▶*× T1 → T1 = T2. +theorem cpys_antisym: ∀G,L,T1,T2. ⦃G, L⦄ ⊢ T1 ▶* T2 → ⦃G, L⦄ ⊢ T2 ▶* T1 → T1 = T2. #G #L #T1 #T2 #H elim H -G -L -T1 -T2 // -[ #I #G #L #K #V1 #V2 #W2 #i #HLK #_ #HVW2 #_ #HW2 lapply (ldrop_fwd_ldrop2 … HLK) -I -V1 +[ #I #G #L #K #V1 #V2 #W2 #i #HLK #_ #HVW2 #_ #HW2 lapply (ldrop_fwd_drop2 … HLK) -I -V1 #HLK elim (cpys_inv_lift1 … HW2 … HLK … HVW2) -L -HVW2 #X #H #_ elim (lift_inv_lref2_be … H) -G -K -V2 -W2 -X // | #a #I #G #L #V1 #V2 #T1 #T2 #_ #_ #IHV12 #IHT12 #H elim (cpys_inv_bind1 … H) -H @@ -48,7 +48,7 @@ theorem cpys_trans_lpys: ∀G. lpx_sn_transitive (cpys G) (cpys G). | * #I1 #K1 #V1 #V #i #HLK1 #HV1 #HVT #H destruct elim (lpys_ldrop_conf … HLK1 … HL12) -HL12 #X #H #HLK2 elim (lpys_inv_pair1 … H) -H #K2 #W2 #HK12 #_ #H destruct - lapply (ldrop_fwd_ldrop2 … HLK2) -W2 #HLK2 + lapply (ldrop_fwd_drop2 … HLK2) -W2 #HLK2 elim (cpys_inv_lift1 … HT2 … HLK2 … HVT) -L2 -T lapply (fqup_lref … G1 … HLK1) /3 width=10 by cpys_delta/ ] diff --git a/matita/matita/contribs/lambdadelta/basic_2/etc/cpys/cpys_lift.etc b/matita/matita/contribs/lambdadelta/basic_2/etc/cpys0/cpys_lift.etc similarity index 71% rename from matita/matita/contribs/lambdadelta/basic_2/etc/cpys/cpys_lift.etc rename to matita/matita/contribs/lambdadelta/basic_2/etc/cpys0/cpys_lift.etc index d798c8a62..f435a862f 100644 --- a/matita/matita/contribs/lambdadelta/basic_2/etc/cpys/cpys_lift.etc +++ b/matita/matita/contribs/lambdadelta/basic_2/etc/cpys0/cpys_lift.etc @@ -22,20 +22,20 @@ include "basic_2/substitution/cpys.ma". lemma cpys_lift: ∀G. l_liftable (cpys G). #G #K #T1 #T2 #H elim H -G -K -T1 -T2 -[ #I #G #K #L #d #e #_ #U1 #H1 #U2 #H2 +[ #I #G #K #L #s #d #e #_ #U1 #H1 #U2 #H2 >(lift_mono … H1 … H2) -H1 -H2 // -| #I #G #K #KV #V #V2 #W2 #i #HKV #HV2 #HVW2 #IHV2 #L #d #e #HLK #U1 #H #U2 #HWU2 +| #I #G #K #KV #V #V2 #W2 #i #HKV #HV2 #HVW2 #IHV2 #L #s #d #e #HLK #U1 #H #U2 #HWU2 elim (lift_inv_lref1 … H) * #Hid #H destruct [ elim (lift_trans_ge … HVW2 … HWU2) -W2 // plus_plus_comm_23 #HVU2 - lapply (ldrop_trans_ge_comm … HLK … HKV ?) -K /3 width=7 by cpys_delta/ + lapply (ldrop_trans_ge_comm … HLK … HKV ?) -K /3 width=7 by cpys_delta, ldrop_inv_gen/ ] -| #a #I #G #K #V1 #V2 #T1 #T2 #_ #_ #IHV12 #IHT12 #L #d #e #HLK #U1 #H1 #U2 #H2 +| #a #I #G #K #V1 #V2 #T1 #T2 #_ #_ #IHV12 #IHT12 #L #s #d #e #HLK #U1 #H1 #U2 #H2 elim (lift_inv_bind1 … H1) -H1 #VV1 #TT1 #HVV1 #HTT1 #H1 destruct - elim (lift_inv_bind1 … H2) -H2 #VV2 #TT2 #HVV2 #HTT2 #H2 destruct /4 width=5 by cpys_bind, ldrop_skip/ -| #I #G #K #V1 #V2 #T1 #T2 #_ #_ #IHV12 #IHT12 #L #d #e #HLK #U1 #H1 #U2 #H2 + elim (lift_inv_bind1 … H2) -H2 #VV2 #TT2 #HVV2 #HTT2 #H2 destruct /4 width=6 by cpys_bind, ldrop_skip/ +| #I #G #K #V1 #V2 #T1 #T2 #_ #_ #IHV12 #IHT12 #L #s #d #e #HLK #U1 #H1 #U2 #H2 elim (lift_inv_flat1 … H1) -H1 #VV1 #TT1 #HVV1 #HTT1 #H1 destruct elim (lift_inv_flat1 … H2) -H2 #VV2 #TT2 #HVV2 #HTT2 #H2 destruct /3 width=6 by cpys_flat/ ] @@ -43,12 +43,12 @@ qed. lemma cpys_inv_lift1: ∀G. l_deliftable_sn (cpys G). #G #L #U1 #U2 #H elim H -G -L -U1 -U2 -[ * #G #L #i #K #d #e #_ #T1 #H +[ * #G #L #i #K #s #d #e #_ #T1 #H [ lapply (lift_inv_sort2 … H) -H #H destruct /2 width=3 by cpys_atom, lift_sort, ex2_intro/ | elim (lift_inv_lref2 … H) -H * #Hid #H destruct /3 width=3 by cpys_atom, lift_lref_ge_minus, lift_lref_lt, ex2_intro/ | lapply (lift_inv_gref2 … H) -H #H destruct /2 width=3 by cpys_atom, lift_gref, ex2_intro/ ] -| #I #G #L #LV #V #V2 #W2 #i #HLV #HV2 #HVW2 #IHV2 #K #d #e #HLK #T1 #H +| #I #G #L #LV #V #V2 #W2 #i #HLV #HV2 #HVW2 #IHV2 #K #s #d #e #HLK #T1 #H elim (lift_inv_lref2 … H) -H * #Hid #H destruct [ elim (ldrop_conf_lt … HLK … HLV) -L // #L #U #HKL #HLV #HUV elim (IHV2 … HLV … HUV) -V #U2 #HUV2 #HU2 @@ -58,11 +58,11 @@ lemma cpys_inv_lift1: ∀G. l_deliftable_sn (cpys G). elim (lift_split … HVW2 d (i - e + 1)) -HVW2 /3 width=1 by le_S, le_S_S/ -Hid -Hdie #V1 #HV1 >plus_minus // shift_append_assoc #H (length_inv_zero_dx … H) -L1 // +| #I1 #I2 #L1 #L2 #V #_ #IHL12 #H lapply (injective_plus_l … H) -H + /3 width=1 by lsuby_pair/ +] +qed-. + (* Basic inversion lemmas ***************************************************) -fact lsuby_inv_atom1_aux: ∀L1,L2. L1 ⊑× L2 → L1 = ⋆ → L2 = ⋆. +fact lsuby_inv_atom1_aux: ∀L1,L2. L1 ⊆ L2 → L1 = ⋆ → L2 = ⋆. #L1 #L2 * -L1 -L2 // #I1 #I2 #L1 #L2 #V #_ #H destruct qed-. -lemma lsuby_inv_atom1: ∀L2. ⋆ ⊑× L2 → L2 = ⋆. +lemma lsuby_inv_atom1: ∀L2. ⋆ ⊆ L2 → L2 = ⋆. /2 width=3 by lsuby_inv_atom1_aux/ qed-. -fact lsuby_inv_pair1_aux: ∀L1,L2. L1 ⊑× L2 → ∀J1,K1,W. L1 = K1.ⓑ{J1}W → - L2 = ⋆ ∨ ∃∃I2,K2. K1 ⊑× K2 & L2 = K2.ⓑ{I2}W. +fact lsuby_inv_pair1_aux: ∀L1,L2. L1 ⊆ L2 → ∀J1,K1,W. L1 = K1.ⓑ{J1}W → + L2 = ⋆ ∨ ∃∃I2,K2. K1 ⊆ K2 & L2 = K2.ⓑ{I2}W. #L1 #L2 * -L1 -L2 [ #L #J1 #K1 #W #H destruct /2 width=1 by or_introl/ | #I1 #I2 #L1 #L2 #V #HL12 #J1 #K1 #W #H destruct /3 width=4 by ex2_2_intro, or_intror/ ] qed-. -lemma lsuby_inv_pair1: ∀I1,K1,L2,W. K1.ⓑ{I1}W ⊑× L2 → - L2 = ⋆ ∨ ∃∃I2,K2. K1 ⊑× K2 & L2 = K2.ⓑ{I2}W. +lemma lsuby_inv_pair1: ∀I1,K1,L2,W. K1.ⓑ{I1}W ⊆ L2 → + L2 = ⋆ ∨ ∃∃I2,K2. K1 ⊆ K2 & L2 = K2.ⓑ{I2}W. /2 width=4 by lsuby_inv_pair1_aux/ qed-. +fact lsuby_inv_pair2_aux: ∀L1,L2. L1 ⊆ L2 → ∀J2,K2,W. L2 = K2.ⓑ{J2}W → + ∃∃I1,K1. K1 ⊆ K2 & L1 = K1.ⓑ{I1}W. +#L1 #L2 * -L1 -L2 +[ #L #J2 #K2 #W #H destruct +| #I1 #I2 #L1 #L2 #V #HL12 #J2 #K2 #W #H destruct /2 width=4 by ex2_2_intro/ +] +qed-. + +lemma lsuby_inv_pair2: ∀I2,L1,K2,W. L1 ⊆ K2.ⓑ{I2}W → + ∃∃I1,K1. K1 ⊆ K2 & L1 = K1.ⓑ{I1}W. +/2 width=4 by lsuby_inv_pair2_aux/ qed-. + (* Basic forward lemmas *****************************************************) -lemma lsuby_fwd_length: ∀L1,L2. L1 ⊑× L2 → |L2| ≤ |L1|. +lemma lsuby_fwd_length: ∀L1,L2. L1 ⊆ L2 → |L2| ≤ |L1|. #L1 #L2 #H elim H -L1 -L2 /2 width=1 by monotonic_le_plus_l/ qed-. -lemma lsuby_fwd_ldrop2_pair: ∀L1,L2. L1 ⊑× L2 → - ∀I2,K2,W,i. ⇩[0, i] L2 ≡ K2.ⓑ{I2}W → - ∃∃I1,K1. K1 ⊑× K2 & ⇩[0, i] L1 ≡ K1.ⓑ{I1}W. +lemma lsuby_ldrop_trans: ∀L1,L2. L1 ⊆ L2 → + ∀I2,K2,W,s,i. ⇩[s, 0, i] L2 ≡ K2.ⓑ{I2}W → + ∃∃I1,K1. K1 ⊆ K2 & ⇩[s, 0, i] L1 ≡ K1.ⓑ{I1}W. #L1 #L2 #H elim H -L1 -L2 -[ #L #J2 #K2 #W #i #H +[ #L #J2 #K2 #W #s #i #H elim (ldrop_inv_atom1 … H) -H #H destruct -| #I1 #I2 #L1 #L2 #V #HL12 #IHL12 #J2 #K2 #W #i #H +| #I1 #I2 #L1 #L2 #V #HL12 #IHL12 #J2 #K2 #W #s #i #H elim (ldrop_inv_O1_pair1 … H) -H * #Hi #HLK2 destruct [ -IHL12 | -HL12 ] [ /3 width=4 by ldrop_pair, ex2_2_intro/ - | elim (IHL12 … HLK2) -IHL12 -HLK2 * /3 width=4 by ldrop_ldrop_lt, ex2_2_intro/ + | elim (IHL12 … HLK2) -IHL12 -HLK2 * /3 width=4 by ldrop_drop_lt, ex2_2_intro/ ] ] qed-. diff --git a/matita/matita/contribs/lambdadelta/basic_2/etc/cpys/lsuby_lsuby.etc b/matita/matita/contribs/lambdadelta/basic_2/etc/cpys0/lsuby_lsuby.etc similarity index 97% rename from matita/matita/contribs/lambdadelta/basic_2/etc/cpys/lsuby_lsuby.etc rename to matita/matita/contribs/lambdadelta/basic_2/etc/cpys0/lsuby_lsuby.etc index 590e7d317..254d62928 100644 --- a/matita/matita/contribs/lambdadelta/basic_2/etc/cpys/lsuby_lsuby.etc +++ b/matita/matita/contribs/lambdadelta/basic_2/etc/cpys0/lsuby_lsuby.etc @@ -12,7 +12,7 @@ (* *) (**************************************************************************) -include "basic_2/relocation/lsuby.ma". +include "basic_2/substitution/lsuby.ma". (* LOCAL ENVIRONMENT REFINEMENT FOR EXTENDED SUBSTITUTION *******************) diff --git a/matita/matita/contribs/lambdadelta/basic_2/etc/cpys/extpsubstsnstar_3.etc b/matita/matita/contribs/lambdadelta/basic_2/etc/cpys0/psubstsnstar_3.etc similarity index 94% rename from matita/matita/contribs/lambdadelta/basic_2/etc/cpys/extpsubstsnstar_3.etc rename to matita/matita/contribs/lambdadelta/basic_2/etc/cpys0/psubstsnstar_3.etc index 64acfff4c..0d6dffee6 100644 --- a/matita/matita/contribs/lambdadelta/basic_2/etc/cpys/extpsubstsnstar_3.etc +++ b/matita/matita/contribs/lambdadelta/basic_2/etc/cpys0/psubstsnstar_3.etc @@ -14,6 +14,6 @@ (* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************) -notation "hvbox( ⦃ term 46 G , break term 46 L1 ⦄ ⊢ ▶ * × break term 46 L2 )" +notation "hvbox( ⦃ term 46 G , break term 46 L1 ⦄ ⊢ ▶ * break term 46 L2 )" non associative with precedence 45 - for @{ 'ExtPSubstSnStar $G $L1 $L2 }. + for @{ 'PSubstSnStar $G $L1 $L2 }. diff --git a/matita/matita/contribs/lambdadelta/basic_2/etc/cpys/extpsubststar_4.etc b/matita/matita/contribs/lambdadelta/basic_2/etc/cpys0/psubststar_4.etc similarity index 93% rename from matita/matita/contribs/lambdadelta/basic_2/etc/cpys/extpsubststar_4.etc rename to matita/matita/contribs/lambdadelta/basic_2/etc/cpys0/psubststar_4.etc index 363dce487..0e76c6f71 100644 --- a/matita/matita/contribs/lambdadelta/basic_2/etc/cpys/extpsubststar_4.etc +++ b/matita/matita/contribs/lambdadelta/basic_2/etc/cpys0/psubststar_4.etc @@ -14,6 +14,6 @@ (* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************) -notation "hvbox( ⦃ term 46 G , break term 46 L ⦄ ⊢ break term 46 T1 break ▶ * × break term 46 T2 )" +notation "hvbox( ⦃ term 46 G , break term 46 L ⦄ ⊢ break term 46 T1 break ▶ * break term 46 T2 )" non associative with precedence 45 - for @{ 'ExtPSubstStar $G $L $T1 $T2 }. + for @{ 'PSubstStar $G $L $T1 $T2 }. diff --git a/matita/matita/contribs/lambdadelta/basic_2/etc/cpy/cpx_cpys.etc b/matita/matita/contribs/lambdadelta/basic_2/etc/cpys2/cpx_cpys.etc similarity index 100% rename from matita/matita/contribs/lambdadelta/basic_2/etc/cpy/cpx_cpys.etc rename to matita/matita/contribs/lambdadelta/basic_2/etc/cpys2/cpx_cpys.etc diff --git a/matita/matita/contribs/lambdadelta/basic_2/etc/cpy/cpx_cpys2.etc b/matita/matita/contribs/lambdadelta/basic_2/etc/cpys2/cpx_cpys2.etc similarity index 100% rename from matita/matita/contribs/lambdadelta/basic_2/etc/cpy/cpx_cpys2.etc rename to matita/matita/contribs/lambdadelta/basic_2/etc/cpys2/cpx_cpys2.etc diff --git a/matita/matita/contribs/lambdadelta/basic_2/etc/cpy/cpxs_cpys.etc b/matita/matita/contribs/lambdadelta/basic_2/etc/cpys2/cpxs_cpys.etc similarity index 100% rename from matita/matita/contribs/lambdadelta/basic_2/etc/cpy/cpxs_cpys.etc rename to matita/matita/contribs/lambdadelta/basic_2/etc/cpys2/cpxs_cpys.etc diff --git a/matita/matita/contribs/lambdadelta/basic_2/etc/cpy/lpx_cpys.etc b/matita/matita/contribs/lambdadelta/basic_2/etc/cpys2/lpx_cpys.etc similarity index 100% rename from matita/matita/contribs/lambdadelta/basic_2/etc/cpy/lpx_cpys.etc rename to matita/matita/contribs/lambdadelta/basic_2/etc/cpys2/lpx_cpys.etc diff --git a/matita/matita/contribs/lambdadelta/basic_2/etc/cpy/lsuby.etc b/matita/matita/contribs/lambdadelta/basic_2/etc/cpys2/lsuby.etc similarity index 100% rename from matita/matita/contribs/lambdadelta/basic_2/etc/cpy/lsuby.etc rename to matita/matita/contribs/lambdadelta/basic_2/etc/cpys2/lsuby.etc diff --git a/matita/matita/contribs/lambdadelta/basic_2/notation/relations/freestar_4.ma b/matita/matita/contribs/lambdadelta/basic_2/notation/relations/freestar_4.ma new file mode 100644 index 000000000..4ce6d2dc7 --- /dev/null +++ b/matita/matita/contribs/lambdadelta/basic_2/notation/relations/freestar_4.ma @@ -0,0 +1,19 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The 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( L ⊢ break term 46 i ϵ 𝐅 * [ break term 46 d ] ⦃ break term 46 T ⦄ )" + non associative with precedence 45 + for @{ 'FreeStar $L $i $d $T }. diff --git a/matita/matita/contribs/lambdadelta/basic_2/reduction/lpx_frees.ma b/matita/matita/contribs/lambdadelta/basic_2/reduction/lpx_frees.ma new file mode 100644 index 000000000..e303b8386 --- /dev/null +++ b/matita/matita/contribs/lambdadelta/basic_2/reduction/lpx_frees.ma @@ -0,0 +1,82 @@ +(**************************************************************************) +(* ___ *) +(* ||M|| *) +(* ||A|| A project by Andrea Asperti *) +(* ||T|| *) +(* ||I|| Developers: *) +(* ||T|| The 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/fqup.ma". +include "basic_2/substitution/frees_lift.ma". +include "basic_2/reduction/lpx_ldrop.ma". + +(* SN EXTENDED PARALLEL REDUCTION FOR LOCAL ENVIRONMENTS ********************) +(* +lemma yle_plus2_to_minus_inj2: ∀x,y:ynat. ∀z:nat. x ≤ y + z → x - z ≤ y. +/2 width=1 by monotonic_yle_minus_dx/ qed-. + +lemma yle_plus2_to_minus_inj1: ∀x,y:ynat. ∀z:nat. x ≤ z + y → x - z ≤ y. +/2 width=1 by yle_plus2_to_minus_inj2/ qed-. + +lemma cofrees_lsuby_conf: ∀L1,U,i. L1 ⊢ i ~ϵ 𝐅*⦃U⦄ → + ∀L2. lsuby L1 L2 → L2 ⊢ i ~ϵ 𝐅*⦃U⦄. +/3 width=3 by lsuby_cpys_trans/ qed-. + +lemma lpx_cpx_cofrees_conf: ∀h,g,G,L1,U1,U2. ⦃G, L1⦄ ⊢ U1 ➡[h, g] U2 → + ∀L2. ⦃G, L1⦄ ⊢ ➡[h, g] L2 → + ∀i. L1 ⊢ i ~ϵ 𝐅*⦃U1⦄ → L2 ⊢ i ~ϵ 𝐅*⦃U2⦄. +#h #g #G #L1 #U1 @(fqup_wf_ind_eq … G L1 U1) -G -L1 -U1 +#G0 #L0 #U0 #IH #G #L1 * * +[ -IH #k #HG #HL #HU #U2 #H elim (cpx_inv_sort1 … H) -H + [| * #l #_ ] #H destruct // +| #j #HG #HL #HU #U2 #H #L2 #HL12 #i #Hi elim (cpx_inv_lref1 … H) -H + [ #H destruct elim (lt_or_eq_or_gt i j) #Hji + [ -IH -HL12 /2 width=4 by cofrees_lref_gt/ + | -IH -HL12 destruct elim (cofrees_inv_lref_eq … Hi) + | elim (lt_or_ge j (|L2|)) /2 width=5 by cofrees_lref_free/ #Hj + elim (ldrop_O1_lt (Ⓕ) L1 j) [2: >(lpx_fwd_length … HL12) // ] #I #K1 #W1 #HLK1 + elim (lpx_ldrop_conf … HLK1 … HL12) -HL12 #Y #H #HLK2 + elim (lpx_inv_pair1 … H) -H #K2 #W2 #HK12 #HW12 #H destruct + lapply (cofrees_inv_lref_lt … Hi … HLK1) -Hi // #HW1 + lapply (IH … HW12 … HK12 … HW1) /2 width=2 by fqup_lref/ -L1 -K1 -W1 #HW2 + /2 width=9 by cofrees_lref_lt/ (**) (* full auto too slow *) + ] + | * #I #K1 #W1 #W0 #HLK1 #HW10 #HW0U2 elim (lt_or_ge j i) #Hji + [ lapply (ldrop_fwd_drop2 … HLK1) #H0 + elim (lpx_ldrop_conf … H0 … HL12) #K2 #HK12 #HLK2 + @(cofrees_lift_ge … HLK2 … HW0U2) // + @(IH … HW10) /2 width=2 by fqup_lref/ -L2 -K2 -W0 -U2 -IH + (nlift_inv_lref_be_SO … Hnx) -x /3 width=5 by ex4_3_intro, or_intror/ +] +qed-. + +lemma frees_inv_lref_free: ∀L,d,j,i. L ⊢ i ϵ 𝐅*[d]⦃#j⦄ → |L| ≤ j → j = i. +#L #d #j #i #H #Hj elim (frees_inv_lref … H) -H // +* #I #K #W #_ #_ #HLK lapply (ldrop_fwd_length_lt2 … HLK) -I +#H elim (lt_refl_false j) /2 width=3 by lt_to_le_to_lt/ +qed-. + +lemma frees_inv_lref_skip: ∀L,d,j,i. L ⊢ i ϵ 𝐅*[d]⦃#j⦄ → yinj j < d → j = i. +#L #d #j #i #H #Hjd elim (frees_inv_lref … H) -H // +* #I #K #W #Hdj elim (ylt_yle_false … Hdj) -Hdj // +qed-. + +lemma frees_inv_lref_ge: ∀L,d,j,i. L ⊢ i ϵ 𝐅*[d]⦃#j⦄ → i ≤ j → j = i. +#L #d #j #i #H #Hij elim (frees_inv_lref … H) -H // +* #I #K #W #_ #Hji elim (lt_refl_false j) -I -L -K -W -d /2 width=3 by lt_to_le_to_lt/ +qed-. + +lemma frees_inv_lref_lt: ∀L,d,j,i.L ⊢ i ϵ 𝐅*[d]⦃#j⦄ → j < i → + ∃∃I,K,W. d ≤ yinj j & ⇩[j] L ≡ K.ⓑ{I}W & K ⊢ (i-j-1) ϵ 𝐅*[yinj 0]⦃W⦄. +#L #d #j #i #H #Hji elim (frees_inv_lref … H) -H +[ #H elim (lt_refl_false j) // +| * /2 width=5 by ex3_3_intro/ +] +qed-. + +lemma frees_inv_bind: ∀a,I,L,W,U,d,i. L ⊢ i ϵ 𝐅*[d]⦃ⓑ{a,I}W.U⦄ → + L ⊢ i ϵ 𝐅*[d]⦃W⦄ ∨ L.ⓑ{I}W ⊢ i+1 ϵ 𝐅*[⫯d]⦃U⦄ . +#a #J #L #V #U #d #i #H elim (frees_inv … H) -H +[ #HnX elim (nlift_inv_bind … HnX) -HnX + /4 width=2 by frees_eq, or_intror, or_introl/ +| * #I #K #W #j #Hdj #Hji #HnX #HLK #HW elim (nlift_inv_bind … HnX) -HnX + [ /4 width=9 by frees_be, or_introl/ + | #HnT @or_intror @(frees_be … HnT) -HnT + [4,5,6: /2 width=1 by ldrop_drop, yle_succ, lt_minus_to_plus/ + |7: >minus_plus_plus_l // + |*: skip + ] + ] +] +qed-. + +lemma frees_inv_flat: ∀I,L,W,U,d,i. L ⊢ i ϵ 𝐅*[d]⦃ⓕ{I}W.U⦄ → + L ⊢ i ϵ 𝐅*[d]⦃W⦄ ∨ L ⊢ i ϵ 𝐅*[d]⦃U⦄ . +#J #L #V #U #d #i #H elim (frees_inv … H) -H +[ #HnX elim (nlift_inv_flat … HnX) -HnX + /4 width=2 by frees_eq, or_intror, or_introl/ +| * #I #K #W #j #Hdj #Hji #HnX #HLK #HW elim (nlift_inv_flat … HnX) -HnX + /4 width=9 by frees_be, or_intror, or_introl/ +] +qed-. + +(* Basic properties *********************************************************) + +lemma frees_lref_eq: ∀L,d,i. L ⊢ i ϵ 𝐅*[d]⦃#i⦄. +/3 width=7 by frees_eq, lift_inv_lref2_be/ qed. + +lemma frees_lref_be: ∀I,L,K,W,d,i,j. d ≤ yinj j → j < i → ⇩[j]L ≡ K.ⓑ{I}W → + K ⊢ i-j-1 ϵ 𝐅*[0]⦃W⦄ → L ⊢ i ϵ 𝐅*[d]⦃#j⦄. +/3 width=9 by frees_be, lift_inv_lref2_be/ qed. + +lemma frees_bind_sn: ∀a,I,L,W,U,d,i. L ⊢ i ϵ 𝐅*[d]⦃W⦄ → + L ⊢ i ϵ 𝐅*[d]⦃ⓑ{a,I}W.U⦄. +#a #I #L #W #U #d #i #H elim (frees_inv … H) -H [|*] +/4 width=9 by frees_be, frees_eq, nlift_bind_sn/ +qed. + +lemma frees_bind_dx: ∀a,I,L,W,U,d,i. L.ⓑ{I}W ⊢ i+1 ϵ 𝐅*[⫯d]⦃U⦄ → + L ⊢ i ϵ 𝐅*[d]⦃ⓑ{a,I}W.U⦄. +#a #J #L #V #U #d #i #H elim (frees_inv … H) -H +[ /4 width=9 by frees_eq, nlift_bind_dx/ +| * #I #K #W #j #Hdj #Hji #HnU #HLK #HW + elim (yle_inv_succ1 … Hdj) -Hdj (plus_minus_m_m j 1) in HnU; //