X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=matita%2Fmatita%2Fcontribs%2Flambdadelta%2Fbasic_2%2Fsubstitution%2Fldrop.ma;h=c8b2b11f2d9fe16651eaf34dbd322c20588c32ed;hb=75fac6d60f67a4dfa38ea6c2cc45a18eda5d8996;hp=8782fa93d3257122a743c3e1a3baa354ef22a7ee;hpb=eb4b3b1b307fc392c36f0be253e6a111553259bc;p=helm.git diff --git a/matita/matita/contribs/lambdadelta/basic_2/substitution/ldrop.ma b/matita/matita/contribs/lambdadelta/basic_2/substitution/ldrop.ma index 8782fa93d..c8b2b11f2 100644 --- a/matita/matita/contribs/lambdadelta/basic_2/substitution/ldrop.ma +++ b/matita/matita/contribs/lambdadelta/basic_2/substitution/ldrop.ma @@ -12,308 +12,472 @@ (* *) (**************************************************************************) -include "basic_2/grammar/cl_weight.ma". +include "ground_2/lib/bool.ma". +include "ground_2/lib/lstar.ma". +include "basic_2/notation/relations/rdrop_5.ma". +include "basic_2/notation/relations/rdrop_4.ma". +include "basic_2/notation/relations/rdrop_3.ma". +include "basic_2/grammar/lenv_length.ma". +include "basic_2/grammar/cl_restricted_weight.ma". include "basic_2/substitution/lift.ma". -include "basic_2/substitution/lsubr.ma". -(* LOCAL ENVIRONMENT SLICING ************************************************) +(* BASIC SLICING FOR LOCAL ENVIRONMENTS *************************************) (* Basic_1: includes: drop_skip_bind *) -inductive ldrop: nat → nat → relation lenv ≝ -| ldrop_atom : ∀d,e. ldrop d e (⋆) (⋆) -| ldrop_pair : ∀L,I,V. ldrop 0 0 (L. ⓑ{I} V) (L. ⓑ{I} V) -| ldrop_ldrop: ∀L1,L2,I,V,e. ldrop 0 e L1 L2 → ldrop 0 (e + 1) (L1. ⓑ{I} V) L2 -| ldrop_skip : ∀L1,L2,I,V1,V2,d,e. - ldrop d e L1 L2 → ⇧[d,e] V2 ≡ V1 → - ldrop (d + 1) e (L1. ⓑ{I} V1) (L2. ⓑ{I} V2) +inductive ldrop (s:bool): relation4 nat nat lenv lenv ≝ +| ldrop_atom: ∀d,e. (s = Ⓕ → e = 0) → ldrop s d e (⋆) (⋆) +| ldrop_pair: ∀I,L,V. ldrop s 0 0 (L.ⓑ{I}V) (L.ⓑ{I}V) +| ldrop_drop: ∀I,L1,L2,V,e. ldrop s 0 e L1 L2 → ldrop s 0 (e+1) (L1.ⓑ{I}V) L2 +| ldrop_skip: ∀I,L1,L2,V1,V2,d,e. + ldrop s d e L1 L2 → ⇧[d, e] V2 ≡ V1 → + ldrop s (d+1) e (L1.ⓑ{I}V1) (L2.ⓑ{I}V2) . -interpretation "local slicing" 'RDrop d e L1 L2 = (ldrop d e L1 L2). +interpretation + "basic slicing (local environment) abstract" + 'RDrop s d e L1 L2 = (ldrop s d e L1 L2). +(* +interpretation + "basic slicing (local environment) general" + 'RDrop d e L1 L2 = (ldrop true d e L1 L2). +*) +interpretation + "basic slicing (local environment) lget" + 'RDrop e L1 L2 = (ldrop false O e L1 L2). -definition l_liftable: (lenv → relation term) → Prop ≝ - λR. ∀K,T1,T2. R K T1 T2 → ∀L,d,e. ⇩[d, e] L ≡ K → +definition l_liftable: predicate (lenv → relation term) ≝ + λR. ∀K,T1,T2. R K T1 T2 → ∀L,s,d,e. ⇩[s, d, e] L ≡ K → ∀U1. ⇧[d, e] T1 ≡ U1 → ∀U2. ⇧[d, e] T2 ≡ U2 → R L U1 U2. -definition l_deliftable_sn: (lenv → relation term) → Prop ≝ - λR. ∀L,U1,U2. R L U1 U2 → ∀K,d,e. ⇩[d, e] L ≡ K → +definition l_deliftable_sn: predicate (lenv → relation term) ≝ + λR. ∀L,U1,U2. R L U1 U2 → ∀K,s,d,e. ⇩[s, d, e] L ≡ K → ∀T1. ⇧[d, e] T1 ≡ U1 → ∃∃T2. ⇧[d, e] T2 ≡ U2 & R K T1 T2. -definition dropable_sn: relation lenv → Prop ≝ - λR. ∀L1,K1,d,e. ⇩[d, e] L1 ≡ K1 → ∀L2. R L1 L2 → - ∃∃K2. R K1 K2 & ⇩[d, e] L2 ≡ K2. - -definition dedropable_sn: relation lenv → Prop ≝ - λR. ∀L1,K1,d,e. ⇩[d, e] L1 ≡ K1 → ∀K2. R K1 K2 → - ∃∃L2. R L1 L2 & ⇩[d, e] L2 ≡ K2. +definition dropable_sn: predicate (relation lenv) ≝ + λR. ∀L1,K1,s,d,e. ⇩[s, d, e] L1 ≡ K1 → ∀L2. R L1 L2 → + ∃∃K2. R K1 K2 & ⇩[s, d, e] L2 ≡ K2. -definition dropable_dx: relation lenv → Prop ≝ - λR. ∀L1,L2. R L1 L2 → ∀K2,e. ⇩[0, e] L2 ≡ K2 → - ∃∃K1. ⇩[0, e] L1 ≡ K1 & R K1 K2. +definition dropable_dx: predicate (relation lenv) ≝ + λR. ∀L1,L2. R L1 L2 → ∀K2,s,e. ⇩[s, 0, e] L2 ≡ K2 → + ∃∃K1. ⇩[s, 0, e] L1 ≡ K1 & R K1 K2. (* Basic inversion lemmas ***************************************************) -fact ldrop_inv_refl_aux: ∀d,e,L1,L2. ⇩[d, e] L1 ≡ L2 → d = 0 → e = 0 → L1 = L2. -#d #e #L1 #L2 * -d -e -L1 -L2 -[ // -| // -| #L1 #L2 #I #V #e #_ #_ >commutative_plus normalize #H destruct -| #L1 #L2 #I #V1 #V2 #d #e #_ #_ >commutative_plus normalize #H destruct +fact ldrop_inv_atom1_aux: ∀L1,L2,s,d,e. ⇩[s, d, e] L1 ≡ L2 → L1 = ⋆ → + L2 = ⋆ ∧ (s = Ⓕ → e = 0). +#L1 #L2 #s #d #e * -L1 -L2 -d -e +[ /3 width=1 by conj/ +| #I #L #V #H destruct +| #I #L1 #L2 #V #e #_ #H destruct +| #I #L1 #L2 #V1 #V2 #d #e #_ #_ #H destruct ] -qed. - -(* Basic_1: was: drop_gen_refl *) -lemma ldrop_inv_refl: ∀L1,L2. ⇩[0, 0] L1 ≡ L2 → L1 = L2. -/2 width=5/ qed-. - -fact ldrop_inv_atom1_aux: ∀d,e,L1,L2. ⇩[d, e] L1 ≡ L2 → L1 = ⋆ → - L2 = ⋆. -#d #e #L1 #L2 * -d -e -L1 -L2 -[ // -| #L #I #V #H destruct -| #L1 #L2 #I #V #e #_ #H destruct -| #L1 #L2 #I #V1 #V2 #d #e #_ #_ #H destruct -] -qed. +qed-. (* Basic_1: was: drop_gen_sort *) -lemma ldrop_inv_atom1: ∀d,e,L2. ⇩[d, e] ⋆ ≡ L2 → L2 = ⋆. -/2 width=5/ qed-. - -fact ldrop_inv_O1_aux: ∀d,e,L1,L2. ⇩[d, e] L1 ≡ L2 → d = 0 → - ∀K,I,V. L1 = K. ⓑ{I} V → - (e = 0 ∧ L2 = K. ⓑ{I} V) ∨ - (0 < e ∧ ⇩[d, e - 1] K ≡ L2). -#d #e #L1 #L2 * -d -e -L1 -L2 -[ #d #e #_ #K #I #V #H destruct -| #L #I #V #_ #K #J #W #HX destruct /3 width=1/ -| #L1 #L2 #I #V #e #HL12 #_ #K #J #W #H destruct /3 width=1/ -| #L1 #L2 #I #V1 #V2 #d #e #_ #_ >commutative_plus normalize #H destruct +lemma ldrop_inv_atom1: ∀L2,s,d,e. ⇩[s, d, e] ⋆ ≡ L2 → L2 = ⋆ ∧ (s = Ⓕ → e = 0). +/2 width=4 by ldrop_inv_atom1_aux/ qed-. + +fact ldrop_inv_O1_pair1_aux: ∀L1,L2,s,d,e. ⇩[s, d, e] L1 ≡ L2 → d = 0 → + ∀K,I,V. L1 = K.ⓑ{I}V → + (e = 0 ∧ L2 = K.ⓑ{I}V) ∨ + (0 < e ∧ ⇩[s, d, e-1] K ≡ L2). +#L1 #L2 #s #d #e * -L1 -L2 -d -e +[ #d #e #_ #_ #K #J #W #H destruct +| #I #L #V #_ #K #J #W #HX destruct /3 width=1 by or_introl, conj/ +| #I #L1 #L2 #V #e #HL12 #_ #K #J #W #H destruct /3 width=1 by or_intror, conj/ +| #I #L1 #L2 #V1 #V2 #d #e #_ #_ >commutative_plus normalize #H destruct ] -qed. +qed-. -lemma ldrop_inv_O1: ∀e,K,I,V,L2. ⇩[0, e] K. ⓑ{I} V ≡ L2 → - (e = 0 ∧ L2 = K. ⓑ{I} V) ∨ - (0 < e ∧ ⇩[0, e - 1] K ≡ L2). -/2 width=3/ qed-. +lemma ldrop_inv_O1_pair1: ∀I,K,L2,V,s,e. ⇩[s, 0, e] K. ⓑ{I} V ≡ L2 → + (e = 0 ∧ L2 = K.ⓑ{I}V) ∨ + (0 < e ∧ ⇩[s, 0, e-1] K ≡ L2). +/2 width=3 by ldrop_inv_O1_pair1_aux/ qed-. -lemma ldrop_inv_pair1: ∀K,I,V,L2. ⇩[0, 0] K. ⓑ{I} V ≡ L2 → L2 = K. ⓑ{I} V. -#K #I #V #L2 #H -elim (ldrop_inv_O1 … H) -H * // #H destruct +lemma ldrop_inv_pair1: ∀I,K,L2,V,s. ⇩[s, 0, 0] K.ⓑ{I}V ≡ L2 → L2 = K.ⓑ{I}V. +#I #K #L2 #V #s #H +elim (ldrop_inv_O1_pair1 … H) -H * // #H destruct elim (lt_refl_false … H) qed-. (* Basic_1: was: drop_gen_drop *) -lemma ldrop_inv_ldrop1: ∀e,K,I,V,L2. - ⇩[0, e] K. ⓑ{I} V ≡ L2 → 0 < e → ⇩[0, e - 1] K ≡ L2. -#e #K #I #V #L2 #H #He -elim (ldrop_inv_O1 … H) -H * // #H destruct +lemma ldrop_inv_drop1_lt: ∀I,K,L2,V,s,e. + ⇩[s, 0, e] K.ⓑ{I}V ≡ L2 → 0 < e → ⇩[s, 0, e-1] K ≡ L2. +#I #K #L2 #V #s #e #H #He +elim (ldrop_inv_O1_pair1 … H) -H * // #H destruct elim (lt_refl_false … He) qed-. -fact ldrop_inv_skip1_aux: ∀d,e,L1,L2. ⇩[d, e] L1 ≡ L2 → 0 < d → - ∀I,K1,V1. L1 = K1. ⓑ{I} V1 → - ∃∃K2,V2. ⇩[d - 1, e] K1 ≡ K2 & - ⇧[d - 1, e] V2 ≡ V1 & - L2 = K2. ⓑ{I} V2. -#d #e #L1 #L2 * -d -e -L1 -L2 -[ #d #e #_ #I #K #V #H destruct -| #L #I #V #H elim (lt_refl_false … H) -| #L1 #L2 #I #V #e #_ #H elim (lt_refl_false … H) -| #X #L2 #Y #Z #V2 #d #e #HL12 #HV12 #_ #I #L1 #V1 #H destruct /2 width=5/ +lemma ldrop_inv_drop1: ∀I,K,L2,V,s,e. + ⇩[s, 0, e+1] K.ⓑ{I}V ≡ L2 → ⇩[s, 0, e] K ≡ L2. +#I #K #L2 #V #s #e #H lapply (ldrop_inv_drop1_lt … H ?) -H // +qed-. + +fact ldrop_inv_skip1_aux: ∀L1,L2,s,d,e. ⇩[s, d, e] L1 ≡ L2 → 0 < d → + ∀I,K1,V1. L1 = K1.ⓑ{I}V1 → + ∃∃K2,V2. ⇩[s, d-1, e] K1 ≡ K2 & + ⇧[d-1, e] V2 ≡ V1 & + L2 = K2.ⓑ{I}V2. +#L1 #L2 #s #d #e * -L1 -L2 -d -e +[ #d #e #_ #_ #J #K1 #W1 #H destruct +| #I #L #V #H elim (lt_refl_false … H) +| #I #L1 #L2 #V #e #_ #H elim (lt_refl_false … H) +| #I #L1 #L2 #V1 #V2 #d #e #HL12 #HV21 #_ #J #K1 #W1 #H destruct /2 width=5 by ex3_2_intro/ ] -qed. +qed-. (* Basic_1: was: drop_gen_skip_l *) -lemma ldrop_inv_skip1: ∀d,e,I,K1,V1,L2. ⇩[d, e] K1. ⓑ{I} V1 ≡ L2 → 0 < d → - ∃∃K2,V2. ⇩[d - 1, e] K1 ≡ K2 & - ⇧[d - 1, e] V2 ≡ V1 & - L2 = K2. ⓑ{I} V2. -/2 width=3/ qed-. - -lemma ldrop_inv_O1_pair2: ∀I,K,V,e,L1. ⇩[0, e] L1 ≡ K. ⓑ{I} V → - (e = 0 ∧ L1 = K. ⓑ{I} V) ∨ - ∃∃I1,K1,V1. ⇩[0, e - 1] K1 ≡ K. ⓑ{I} V & L1 = K1.ⓑ{I1}V1 & 0 < e. -#I #K #V #e * -[ #H lapply (ldrop_inv_atom1 … H) -H #H destruct +lemma ldrop_inv_skip1: ∀I,K1,V1,L2,s,d,e. ⇩[s, d, e] K1.ⓑ{I}V1 ≡ L2 → 0 < d → + ∃∃K2,V2. ⇩[s, d-1, e] K1 ≡ K2 & + ⇧[d-1, e] V2 ≡ V1 & + L2 = K2.ⓑ{I}V2. +/2 width=3 by ldrop_inv_skip1_aux/ qed-. + +lemma ldrop_inv_O1_pair2: ∀I,K,V,s,e,L1. ⇩[s, 0, e] L1 ≡ K.ⓑ{I}V → + (e = 0 ∧ L1 = K.ⓑ{I}V) ∨ + ∃∃I1,K1,V1. ⇩[s, 0, e-1] K1 ≡ K.ⓑ{I}V & L1 = K1.ⓑ{I1}V1 & 0 < e. +#I #K #V #s #e * +[ #H elim (ldrop_inv_atom1 … H) -H #H destruct | #L1 #I1 #V1 #H - elim (ldrop_inv_O1 … H) -H * - [ #H1 #H2 destruct /3 width=1/ - | /3 width=5/ + elim (ldrop_inv_O1_pair1 … H) -H * + [ #H1 #H2 destruct /3 width=1 by or_introl, conj/ + | /3 width=5 by ex3_3_intro, or_intror/ ] ] qed-. -fact ldrop_inv_skip2_aux: ∀d,e,L1,L2. ⇩[d, e] L1 ≡ L2 → 0 < d → - ∀I,K2,V2. L2 = K2. ⓑ{I} V2 → - ∃∃K1,V1. ⇩[d - 1, e] K1 ≡ K2 & - ⇧[d - 1, e] V2 ≡ V1 & - L1 = K1. ⓑ{I} V1. -#d #e #L1 #L2 * -d -e -L1 -L2 -[ #d #e #_ #I #K #V #H destruct -| #L #I #V #H elim (lt_refl_false … H) -| #L1 #L2 #I #V #e #_ #H elim (lt_refl_false … H) -| #L1 #X #Y #V1 #Z #d #e #HL12 #HV12 #_ #I #L2 #V2 #H destruct /2 width=5/ +fact ldrop_inv_skip2_aux: ∀L1,L2,s,d,e. ⇩[s, d, e] L1 ≡ L2 → 0 < d → + ∀I,K2,V2. L2 = K2.ⓑ{I}V2 → + ∃∃K1,V1. ⇩[s, d-1, e] K1 ≡ K2 & + ⇧[d-1, e] V2 ≡ V1 & + L1 = K1.ⓑ{I}V1. +#L1 #L2 #s #d #e * -L1 -L2 -d -e +[ #d #e #_ #_ #J #K2 #W2 #H destruct +| #I #L #V #H elim (lt_refl_false … H) +| #I #L1 #L2 #V #e #_ #H elim (lt_refl_false … H) +| #I #L1 #L2 #V1 #V2 #d #e #HL12 #HV21 #_ #J #K2 #W2 #H destruct /2 width=5 by ex3_2_intro/ ] -qed. +qed-. (* Basic_1: was: drop_gen_skip_r *) -lemma ldrop_inv_skip2: ∀d,e,I,L1,K2,V2. ⇩[d, e] L1 ≡ K2. ⓑ{I} V2 → 0 < d → - ∃∃K1,V1. ⇩[d - 1, e] K1 ≡ K2 & ⇧[d - 1, e] V2 ≡ V1 & - L1 = K1. ⓑ{I} V1. -/2 width=3/ qed-. +lemma ldrop_inv_skip2: ∀I,L1,K2,V2,s,d,e. ⇩[s, d, e] L1 ≡ K2.ⓑ{I}V2 → 0 < d → + ∃∃K1,V1. ⇩[s, d-1, e] K1 ≡ K2 & ⇧[d-1, e] V2 ≡ V1 & + L1 = K1.ⓑ{I}V1. +/2 width=3 by ldrop_inv_skip2_aux/ qed-. + +lemma ldrop_inv_O1_gt: ∀L,K,e,s. ⇩[s, 0, e] L ≡ K → |L| < e → + s = Ⓣ ∧ K = ⋆. +#L elim L -L [| #L #Z #X #IHL ] #K #e #s #H normalize in ⊢ (?%?→?); #H1e +[ elim (ldrop_inv_atom1 … H) -H elim s -s /2 width=1 by conj/ + #_ #Hs lapply (Hs ?) // -Hs #H destruct elim (lt_zero_false … H1e) +| elim (ldrop_inv_O1_pair1 … H) -H * #H2e #HLK destruct + [ elim (lt_zero_false … H1e) + | elim (IHL … HLK) -IHL -HLK /2 width=1 by lt_plus_to_minus_r, conj/ + ] +] +qed-. (* Basic properties *********************************************************) +lemma ldrop_refl_atom_O2: ∀s,d. ⇩[s, d, O] ⋆ ≡ ⋆. +/2 width=1 by ldrop_atom/ qed. + (* Basic_1: was by definition: drop_refl *) -lemma ldrop_refl: ∀L. ⇩[0, 0] L ≡ L. +lemma ldrop_refl: ∀L,d,s. ⇩[s, d, 0] L ≡ L. #L elim L -L // +#L #I #V #IHL #d #s @(nat_ind_plus … d) -d /2 width=1 by ldrop_pair, ldrop_skip/ qed. -lemma ldrop_ldrop_lt: ∀L1,L2,I,V,e. - ⇩[0, e - 1] L1 ≡ L2 → 0 < e → ⇩[0, e] L1. ⓑ{I} V ≡ L2. -#L1 #L2 #I #V #e #HL12 #He >(plus_minus_m_m e 1) // /2 width=1/ +lemma ldrop_drop_lt: ∀I,L1,L2,V,s,e. + ⇩[s, 0, e-1] L1 ≡ L2 → 0 < e → ⇩[s, 0, e] L1.ⓑ{I}V ≡ L2. +#I #L1 #L2 #V #s #e #HL12 #He >(plus_minus_m_m e 1) /2 width=1 by ldrop_drop/ qed. -lemma ldrop_skip_lt: ∀L1,L2,I,V1,V2,d,e. - ⇩[d - 1, e] L1 ≡ L2 → ⇧[d - 1, e] V2 ≡ V1 → 0 < d → - ⇩[d, e] L1. ⓑ{I} V1 ≡ L2. ⓑ{I} V2. -#L1 #L2 #I #V1 #V2 #d #e #HL12 #HV21 #Hd >(plus_minus_m_m d 1) // /2 width=1/ +lemma ldrop_skip_lt: ∀I,L1,L2,V1,V2,s,d,e. + ⇩[s, d-1, e] L1 ≡ L2 → ⇧[d-1, e] V2 ≡ V1 → 0 < d → + ⇩[s, d, e] L1. ⓑ{I} V1 ≡ L2.ⓑ{I}V2. +#I #L1 #L2 #V1 #V2 #s #d #e #HL12 #HV21 #Hd >(plus_minus_m_m d 1) /2 width=1 by ldrop_skip/ qed. -lemma ldrop_O1_le: ∀i,L. i ≤ |L| → ∃K. ⇩[0, i] L ≡ K. -#i @(nat_ind_plus … i) -i /2 width=2/ -#i #IHi * -[ #H lapply (le_n_O_to_eq … H) -H >commutative_plus normalize #H destruct -| #L #I #V normalize #H - elim (IHi L ?) -IHi /2 width=1/ -H /3 width=2/ +lemma ldrop_O1_le: ∀s,e,L. e ≤ |L| → ∃K. ⇩[s, 0, e] L ≡ K. +#s #e @(nat_ind_plus … e) -e /2 width=2 by ex_intro/ +#e #IHe * +[ #H elim (le_plus_xSy_O_false … H) +| #L #I #V normalize #H elim (IHe L) -IHe /3 width=2 by ldrop_drop, monotonic_pred, ex_intro/ ] -qed. +qed-. -lemma ldrop_O1_lt: ∀L,i. i < |L| → ∃∃I,K,V. ⇩[0, i] L ≡ K.ⓑ{I}V. -#L elim L -L -[ #i #H elim (lt_zero_false … H) -| #L #I #V #IHL #i @(nat_ind_plus … i) -i /2 width=4/ - #i #_ normalize #H - elim (IHL i ? ) -IHL /2 width=1/ -H /3 width=4/ +lemma ldrop_O1_lt: ∀s,L,e. e < |L| → ∃∃I,K,V. ⇩[s, 0, e] L ≡ K.ⓑ{I}V. +#s #L elim L -L +[ #e #H elim (lt_zero_false … H) +| #L #I #V #IHL #e @(nat_ind_plus … e) -e /2 width=4 by ldrop_pair, ex1_3_intro/ + #e #_ normalize #H elim (IHL e) -IHL /3 width=4 by ldrop_drop, lt_plus_to_minus_r, lt_plus_to_lt_l, ex1_3_intro/ ] +qed-. + +lemma ldrop_O1_pair: ∀L,K,e,s. ⇩[s, 0, e] L ≡ K → e ≤ |L| → ∀I,V. + ∃∃J,W. ⇩[s, 0, e] L.ⓑ{I}V ≡ K.ⓑ{J}W. +#L elim L -L [| #L #Z #X #IHL ] #K #e #s #H normalize #He #I #V +[ elim (ldrop_inv_atom1 … H) -H #H <(le_n_O_to_eq … He) -e + #Hs destruct /2 width=3 by ex1_2_intro/ +| elim (ldrop_inv_O1_pair1 … H) -H * #He #HLK destruct /2 width=3 by ex1_2_intro/ + elim (IHL … HLK … Z X) -IHL -HLK + /3 width=3 by ldrop_drop_lt, le_plus_to_minus, ex1_2_intro/ +] +qed-. + +lemma ldrop_O1_ge: ∀L,e. |L| ≤ e → ⇩[Ⓣ, 0, e] L ≡ ⋆. +#L elim L -L [ #e #_ @ldrop_atom #H destruct ] +#L #I #V #IHL #e @(nat_ind_plus … e) -e [ #H elim (le_plus_xSy_O_false … H) ] +normalize /4 width=1 by ldrop_drop, monotonic_pred/ qed. -lemma ldrop_lsubr_ldrop2_abbr: ∀L1,L2,d,e. L1 ⊑ [d, e] L2 → - ∀K2,V,i. ⇩[0, i] L2 ≡ K2. ⓓV → - d ≤ i → i < d + e → - ∃∃K1. K1 ⊑ [0, d + e - i - 1] K2 & - ⇩[0, i] L1 ≡ K1. ⓓV. -#L1 #L2 #d #e #H elim H -L1 -L2 -d -e -[ #d #e #K1 #V #i #H - lapply (ldrop_inv_atom1 … H) -H #H destruct -| #L1 #L2 #K1 #V #i #_ #_ #H - elim (lt_zero_false … H) -| #L1 #L2 #V #e #HL12 #IHL12 #K1 #W #i #H #_ #Hie - elim (ldrop_inv_O1 … H) -H * #Hi #HLK1 - [ -IHL12 -Hie destruct - minus_minus_comm >arith_b1 // /4 width=3/ - ] -| #L1 #L2 #I #V1 #V2 #e #_ #IHL12 #K1 #W #i #H #_ #Hie - elim (ldrop_inv_O1 … H) -H * #Hi #HLK1 - [ -IHL12 -Hie -Hi destruct - | elim (IHL12 … HLK1 ? ?) -IHL12 -HLK1 // /2 width=1/ -Hie >minus_minus_comm >arith_b1 // /3 width=3/ +lemma ldrop_O1_eq: ∀L,s. ⇩[s, 0, |L|] L ≡ ⋆. +#L elim L -L /2 width=1 by ldrop_drop, ldrop_atom/ +qed. + +lemma ldrop_split: ∀L1,L2,d,e2,s. ⇩[s, d, e2] L1 ≡ L2 → ∀e1. e1 ≤ e2 → + ∃∃L. ⇩[s, d, e2 - e1] L1 ≡ L & ⇩[s, d, e1] L ≡ L2. +#L1 #L2 #d #e2 #s #H elim H -L1 -L2 -d -e2 +[ #d #e2 #Hs #e1 #He12 @(ex2_intro … (⋆)) + @ldrop_atom #H lapply (Hs H) -s #H destruct /2 width=1 by le_n_O_to_eq/ +| #I #L1 #V #e1 #He1 lapply (le_n_O_to_eq … He1) -He1 + #H destruct /2 width=3 by ex2_intro/ +| #I #L1 #L2 #V #e2 #HL12 #IHL12 #e1 @(nat_ind_plus … e1) -e1 + [ /3 width=3 by ldrop_drop, ex2_intro/ + | -HL12 #e1 #_ #He12 lapply (le_plus_to_le_r … He12) -He12 + #He12 elim (IHL12 … He12) -IHL12 >minus_plus_plus_l + #L #HL1 #HL2 elim (lt_or_ge (|L1|) (e2-e1)) #H0 + [ elim (ldrop_inv_O1_gt … HL1 H0) -HL1 #H1 #H2 destruct + elim (ldrop_inv_atom1 … HL2) -HL2 #H #_ destruct + @(ex2_intro … (⋆)) [ @ldrop_O1_ge normalize // ] + @ldrop_atom #H destruct + | elim (ldrop_O1_pair … HL1 H0 I V) -HL1 -H0 /3 width=5 by ldrop_drop, ex2_intro/ + ] ] -| #L1 #L2 #I1 #I2 #V1 #V2 #d #e #_ #IHL12 #K1 #V #i #H #Hdi >plus_plus_comm_23 #Hide - elim (le_inv_plus_l … Hdi) #Hdim #Hi - lapply (ldrop_inv_ldrop1 … H ?) -H // #HLK1 - elim (IHL12 … HLK1 ? ?) -IHL12 -HLK1 // /2 width=1/ -Hdi -Hide >minus_minus_comm >arith_b1 // /3 width=3/ +| #I #L1 #L2 #V1 #V2 #d #e2 #_ #HV21 #IHL12 #e1 #He12 elim (IHL12 … He12) -IHL12 + #L #HL1 #HL2 elim (lift_split … HV21 d e1) -HV21 /3 width=5 by ldrop_skip, ex2_intro/ ] +qed-. + +lemma ldrop_FT: ∀L1,L2,d,e. ⇩[Ⓕ, d, e] L1 ≡ L2 → ⇩[Ⓣ, d, e] L1 ≡ L2. +#L1 #L2 #d #e #H elim H -L1 -L2 -d -e +/3 width=1 by ldrop_atom, ldrop_drop, ldrop_skip/ qed. -lemma dropable_sn_TC: ∀R. dropable_sn R → dropable_sn (TC … R). -#R #HR #L1 #K1 #d #e #HLK1 #L2 #H elim H -L2 -[ #L2 #HL12 - elim (HR … HLK1 … HL12) -HR -L1 /3 width=3/ -| #L #L2 #_ #HL2 * #K #HK1 #HLK - elim (HR … HLK … HL2) -HR -L /3 width=3/ +lemma ldrop_gen: ∀L1,L2,s,d,e. ⇩[Ⓕ, d, e] L1 ≡ L2 → ⇩[s, d, e] L1 ≡ L2. +#L1 #L2 * /2 width=1 by ldrop_FT/ +qed-. + +lemma ldrop_T: ∀L1,L2,s,d,e. ⇩[s, d, e] L1 ≡ L2 → ⇩[Ⓣ, d, e] L1 ≡ L2. +#L1 #L2 * /2 width=1 by ldrop_FT/ +qed-. + +lemma l_liftable_LTC: ∀R. l_liftable R → l_liftable (LTC … R). +#R #HR #K #T1 #T2 #H elim H -T2 +[ /3 width=10 by inj/ +| #T #T2 #_ #HT2 #IHT1 #L #s #d #e #HLK #U1 #HTU1 #U2 #HTU2 + elim (lift_total T d e) /4 width=12 by step/ ] -qed. +qed-. -lemma dedropable_sn_TC: ∀R. dedropable_sn R → dedropable_sn (TC … R). -#R #HR #L1 #K1 #d #e #HLK1 #K2 #H elim H -K2 -[ #K2 #HK12 - elim (HR … HLK1 … HK12) -HR -K1 /3 width=3/ -| #K #K2 #_ #HK2 * #L #HL1 #HLK - elim (HR … HLK … HK2) -HR -K /3 width=3/ +lemma l_deliftable_sn_LTC: ∀R. l_deliftable_sn R → l_deliftable_sn (LTC … R). +#R #HR #L #U1 #U2 #H elim H -U2 +[ #U2 #HU12 #K #s #d #e #HLK #T1 #HTU1 + elim (HR … HU12 … HLK … HTU1) -HR -L -U1 /3 width=3 by inj, ex2_intro/ +| #U #U2 #_ #HU2 #IHU1 #K #s #d #e #HLK #T1 #HTU1 + elim (IHU1 … HLK … HTU1) -IHU1 -U1 #T #HTU #HT1 + elim (HR … HU2 … HLK … HTU) -HR -L -U /3 width=5 by step, ex2_intro/ ] -qed. +qed-. + +lemma dropable_sn_TC: ∀R. dropable_sn R → dropable_sn (TC … R). +#R #HR #L1 #K1 #s #d #e #HLK1 #L2 #H elim H -L2 +[ #L2 #HL12 elim (HR … HLK1 … HL12) -HR -L1 + /3 width=3 by inj, ex2_intro/ +| #L #L2 #_ #HL2 * #K #HK1 #HLK elim (HR … HLK … HL2) -HR -L + /3 width=3 by step, ex2_intro/ +] +qed-. lemma dropable_dx_TC: ∀R. dropable_dx R → dropable_dx (TC … R). #R #HR #L1 #L2 #H elim H -L2 -[ #L2 #HL12 #K2 #e #HLK2 - elim (HR … HL12 … HLK2) -HR -L2 /3 width=3/ -| #L #L2 #_ #HL2 #IHL1 #K2 #e #HLK2 - elim (HR … HL2 … HLK2) -HR -L2 #K #HLK #HK2 - elim (IHL1 … HLK) -L /3 width=5/ +[ #L2 #HL12 #K2 #s #e #HLK2 elim (HR … HL12 … HLK2) -HR -L2 + /3 width=3 by inj, ex2_intro/ +| #L #L2 #_ #HL2 #IHL1 #K2 #s #e #HLK2 elim (HR … HL2 … HLK2) -HR -L2 + #K #HLK #HK2 elim (IHL1 … HLK) -L + /3 width=5 by step, ex2_intro/ ] -qed. +qed-. + +lemma l_deliftable_sn_llstar: ∀R. l_deliftable_sn R → + ∀l. l_deliftable_sn (llstar … R l). +#R #HR #l #L #U1 #U2 #H @(lstar_ind_r … l U2 H) -l -U2 +[ /2 width=3 by lstar_O, ex2_intro/ +| #l #U #U2 #_ #HU2 #IHU1 #K #s #d #e #HLK #T1 #HTU1 + elim (IHU1 … HLK … HTU1) -IHU1 -U1 #T #HTU #HT1 + elim (HR … HU2 … HLK … HTU) -HR -L -U /3 width=5 by lstar_dx, ex2_intro/ +] +qed-. (* Basic forvard lemmas *****************************************************) (* Basic_1: was: drop_S *) -lemma ldrop_fwd_ldrop2: ∀L1,I2,K2,V2,e. ⇩[O, e] L1 ≡ K2. ⓑ{I2} V2 → - ⇩[O, e + 1] L1 ≡ K2. +lemma ldrop_fwd_drop2: ∀L1,I2,K2,V2,s,e. ⇩[s, O, e] L1 ≡ K2. ⓑ{I2} V2 → + ⇩[s, O, e + 1] L1 ≡ K2. #L1 elim L1 -L1 -[ #I2 #K2 #V2 #e #H lapply (ldrop_inv_atom1 … H) -H #H destruct -| #K1 #I1 #V1 #IHL1 #I2 #K2 #V2 #e #H - elim (ldrop_inv_O1 … H) -H * #He #H - [ -IHL1 destruct /2 width=1/ - | @ldrop_ldrop >(plus_minus_m_m e 1) // /2 width=3/ +[ #I2 #K2 #V2 #s #e #H lapply (ldrop_inv_atom1 … H) -H * #H destruct +| #K1 #I1 #V1 #IHL1 #I2 #K2 #V2 #s #e #H + elim (ldrop_inv_O1_pair1 … H) -H * #He #H + [ -IHL1 destruct /2 width=1 by ldrop_drop/ + | @ldrop_drop >(plus_minus_m_m e 1) /2 width=3 by/ ] ] qed-. -lemma ldrop_fwd_length: ∀L1,L2,d,e. ⇩[d, e] L1 ≡ L2 → |L2| ≤ |L1|. -#L1 #L2 #d #e #H elim H -L1 -L2 -d -e // normalize /2 width=1/ +lemma ldrop_fwd_length_ge: ∀L1,L2,d,e,s. ⇩[s, d, e] L1 ≡ L2 → |L1| ≤ d → |L2| = |L1|. +#L1 #L2 #d #e #s #H elim H -L1 -L2 -d -e // normalize +[ #I #L1 #L2 #V #e #_ #_ #H elim (le_plus_xSy_O_false … H) +| /4 width=2 by le_plus_to_le_r, eq_f/ +] qed-. -lemma ldrop_fwd_lw: ∀L1,L2,d,e. ⇩[d, e] L1 ≡ L2 → ♯{L2} ≤ ♯{L1}. -#L1 #L2 #d #e #H elim H -L1 -L2 -d -e // normalize -[ /2 width=3/ -| #L1 #L2 #I #V1 #V2 #d #e #_ #HV21 #IHL12 - >(lift_fwd_tw … HV21) -HV21 /2 width=1/ +lemma ldrop_fwd_length_le_le: ∀L1,L2,d,e,s. ⇩[s, d, e] L1 ≡ L2 → d ≤ |L1| → e ≤ |L1| - d → |L2| = |L1| - e. +#L1 #L2 #d #e #s #H elim H -L1 -L2 -d -e // normalize +[ /3 width=2 by le_plus_to_le_r/ +| #I #L1 #L2 #V1 #V2 #d #e #_ #_ #IHL12 >minus_plus_plus_l + #Hd #He lapply (le_plus_to_le_r … Hd) -Hd + #Hd >IHL12 // -L2 >plus_minus /2 width=3 by transitive_le/ ] qed-. -lemma ldrop_pair2_fwd_fw: ∀I,L,K,V,d,e. ⇩[d, e] L ≡ K. ⓑ{I} V → - ∀T. ♯{K, V} < ♯{L, T}. -#I #L #K #V #d #e #H #T -lapply (ldrop_fwd_lw … H) -H #H -@(le_to_lt_to_lt … H) -H /3 width=1/ +lemma ldrop_fwd_length_le_ge: ∀L1,L2,d,e,s. ⇩[s, d, e] L1 ≡ L2 → d ≤ |L1| → |L1| - d ≤ e → |L2| = d. +#L1 #L2 #d #e #s #H elim H -L1 -L2 -d -e normalize +[ /2 width=1 by le_n_O_to_eq/ +| #I #L #V #_ (lift_fwd_tw … HV21) -HV21 /2 width=1 by monotonic_le_plus_l/ ] qed-. -lemma ldrop_fwd_O1_length: ∀L1,L2,e. ⇩[0, e] L1 ≡ L2 → |L2| = |L1| - e. -#L1 elim L1 -L1 -[ #L2 #e #H >(ldrop_inv_atom1 … H) -H // -| #K1 #I1 #V1 #IHL1 #L2 #e #H - elim (ldrop_inv_O1 … H) -H * #He #H - [ -IHL1 destruct // - | lapply (IHL1 … H) -IHL1 -H #H >H -H normalize - >minus_le_minus_minus_comm // - ] +lemma ldrop_fwd_lw_lt: ∀L1,L2,d,e. ⇩[Ⓕ, d, e] L1 ≡ L2 → 0 < e → ♯{L2} < ♯{L1}. +#L1 #L2 #d #e #H elim H -L1 -L2 -d -e +[ #d #e #H >H -H // +| #I #L #V #H elim (lt_refl_false … H) +| #I #L1 #L2 #V #e #HL12 #_ #_ + lapply (ldrop_fwd_lw … HL12) -HL12 #HL12 + @(le_to_lt_to_lt … HL12) -HL12 // +| #I #L1 #L2 #V1 #V2 #d #e #_ #HV21 #IHL12 #H normalize in ⊢ (?%%); -I + >(lift_fwd_tw … HV21) -V2 /3 by lt_minus_to_plus/ +] +qed-. + +lemma ldrop_fwd_rfw: ∀I,L,K,V,i. ⇩[i] L ≡ K.ⓑ{I}V → ∀T. ♯{K, V} < ♯{L, T}. +#I #L #K #V #i #HLK lapply (ldrop_fwd_lw … HLK) -HLK +normalize in ⊢ (%→?→?%%); /3 width=3 by le_to_lt_to_lt/ +qed-. + +(* Advanced inversion lemmas ************************************************) + +fact ldrop_inv_O2_aux: ∀L1,L2,s,d,e. ⇩[s, d, e] L1 ≡ L2 → e = 0 → L1 = L2. +#L1 #L2 #s #d #e #H elim H -L1 -L2 -d -e +[ // +| // +| #I #L1 #L2 #V #e #_ #_ >commutative_plus normalize #H destruct +| #I #L1 #L2 #V1 #V2 #d #e #_ #HV21 #IHL12 #H + >(IHL12 H) -L1 >(lift_inv_O2_aux … HV21 … H) -V2 -d -e // ] qed-. +(* Basic_1: was: drop_gen_refl *) +lemma ldrop_inv_O2: ∀L1,L2,s,d. ⇩[s, d, 0] L1 ≡ L2 → L1 = L2. +/2 width=5 by ldrop_inv_O2_aux/ qed-. + +lemma ldrop_inv_length_eq: ∀L1,L2,d,e. ⇩[Ⓕ, d, e] L1 ≡ L2 → |L1| = |L2| → e = 0. +#L1 #L2 #d #e #H #HL12 lapply (ldrop_fwd_length_minus4 … H) // +qed-. + +lemma ldrop_inv_refl: ∀L,d,e. ⇩[Ⓕ, d, e] L ≡ L → e = 0. +/2 width=5 by ldrop_inv_length_eq/ qed-. + +fact ldrop_inv_FT_aux: ∀L1,L2,s,d,e. ⇩[s, d, e] L1 ≡ L2 → + ∀I,K,V. L2 = K.ⓑ{I}V → s = Ⓣ → d = 0 → + ⇩[Ⓕ, d, e] L1 ≡ K.ⓑ{I}V. +#L1 #L2 #s #d #e #H elim H -L1 -L2 -d -e +[ #d #e #_ #J #K #W #H destruct +| #I #L #V #J #K #W #H destruct // +| #I #L1 #L2 #V #e #_ #IHL12 #J #K #W #H1 #H2 destruct + /3 width=1 by ldrop_drop/ +| #I #L1 #L2 #V1 #V2 #d #e #_ #_ #_ #J #K #W #_ #_ +