From 1cd2f9aa6e0aee9eb4939b39c985b6ad6605092b Mon Sep 17 00:00:00 2001 From: Ferruccio Guidi Date: Sat, 6 Aug 2011 22:00:31 +0000 Subject: [PATCH] - transitivity of parallel telescopic substitution closed! - some refactoring --- matita/matita/lib/lambda-delta/ground.ma | 150 ++++++++++----- matita/matita/lib/lambda-delta/notation.ma | 8 +- .../lib/lambda-delta/reduction/tpr_defs.ma | 2 +- .../lib/lambda-delta/reduction/tpr_main.ma | 1 - .../reduction/{tpr_ps.ma => tpr_pts.ma} | 12 +- .../lib/lambda-delta/reduction/tpr_tpr.ma | 44 ++--- .../lambda-delta/substitution/drop_defs.ma | 83 +++++++-- .../lambda-delta/substitution/drop_main.ma | 8 +- .../lib/lambda-delta/substitution/leq_defs.ma | 60 ++++++ .../lambda-delta/substitution/lift_defs.ma | 12 ++ .../lib/lambda-delta/substitution/lift_fun.ma | 61 ------ .../lambda-delta/substitution/lift_main.ma | 32 +++- .../lib/lambda-delta/substitution/ps_defs.ma | 78 -------- .../lib/lambda-delta/substitution/ps_ps.ma | 17 -- .../lib/lambda-delta/substitution/pts_defs.ma | 107 +++++++++++ .../lib/lambda-delta/substitution/pts_lift.ma | 174 ++++++++++++++++++ .../lib/lambda-delta/substitution/pts_pts.ma | 47 +++++ .../lambda-delta/substitution/pts_split.ma | 58 ++++++ matita/matita/lib/lambda-delta/xoa.conf.xml | 1 + matita/matita/lib/lambda-delta/xoa_defs.ma | 8 + .../matita/lib/lambda-delta/xoa_notation.ma | 6 + 21 files changed, 709 insertions(+), 260 deletions(-) rename matita/matita/lib/lambda-delta/reduction/{tpr_ps.ma => tpr_pts.ma} (74%) create mode 100644 matita/matita/lib/lambda-delta/substitution/leq_defs.ma delete mode 100644 matita/matita/lib/lambda-delta/substitution/lift_fun.ma delete mode 100644 matita/matita/lib/lambda-delta/substitution/ps_defs.ma delete mode 100644 matita/matita/lib/lambda-delta/substitution/ps_ps.ma create mode 100644 matita/matita/lib/lambda-delta/substitution/pts_defs.ma create mode 100644 matita/matita/lib/lambda-delta/substitution/pts_lift.ma create mode 100644 matita/matita/lib/lambda-delta/substitution/pts_pts.ma create mode 100644 matita/matita/lib/lambda-delta/substitution/pts_split.ma diff --git a/matita/matita/lib/lambda-delta/ground.ma b/matita/matita/lib/lambda-delta/ground.ma index d2dd9b345..58d86aa5a 100644 --- a/matita/matita/lib/lambda-delta/ground.ma +++ b/matita/matita/lib/lambda-delta/ground.ma @@ -9,42 +9,71 @@ \ / V_______________________________________________________________ *) -include "basics/list.ma". +include "arithmetics/nat.ma". (* ARITHMETICAL PROPERTIES **************************************************) -lemma plus_plus_comm_23: ∀m,n,p. m + n + p = m + p + n. -// qed. - -lemma minus_plus_comm: ∀a,b,c. a - b - c = a - (c + b). -// qed. - -lemma arith8: ∀a,b. a < a + b + 1. -// qed. +lemma plus_S_eq_O_false: ∀n,m. n + S m = 0 → False. +#n #m (commutative_plus p) minus_plus @eq_f2 /2/ qed. -lemma lt_or_ge: ∀m,n. m < n ∨ n ≤ m. -#m #n elim (decidable_lt m n) /3/ +lemma arith_b2: ∀a,b,c1,c2. c1 + c2 ≤ b → a - c1 - c2 - (b - c1 - c2) = a - b. +#a #b #c1 #c2 #H >minus_plus >minus_plus >minus_plus /2/ qed. -lemma plus_lt_false: ∀m,n. m + n < m → False. -#m #n #H1 lapply (le_plus_n_r n m) #H2 -lapply (le_to_lt_to_lt … H2 H1) -H2 H1 #H -elim (lt_refl_false … H) +lemma arith_c1: ∀a,b,c1. a + c1 - (b + c1) = a - b. +// qed. + +lemma arith_c1x: ∀x,a,b,c1. x + c1 + a - (b + c1) = x + a - b. +#x #a #b #c1 >plus_plus_comm_23 // qed. -lemma plus_S_eq_O_false: ∀n,m. n + S m = 0 → False. -#n #m minus_plus minus_plus minus_plus >minus_plus @monotonic_le_plus_r @monotonic_le_minus_l // +qed. diff --git a/matita/matita/lib/lambda-delta/notation.ma b/matita/matita/lib/lambda-delta/notation.ma index 6f883cc71..86e31894c 100644 --- a/matita/matita/lib/lambda-delta/notation.ma +++ b/matita/matita/lib/lambda-delta/notation.ma @@ -11,7 +11,7 @@ (* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************) -(* language *****************************************************************) +(* *****************************************************************) notation "hvbox( ⋆ )" non associative with precedence 90 @@ -47,6 +47,10 @@ notation "hvbox( # [ x , break y ] )" (* substitution *************************************************************) +notation "hvbox( T1 break [ d , break e ] ≈ break T2 )" + non associative with precedence 45 + for @{ 'Eq $T1 $d $e $T2 }. + notation "hvbox( ↑ [ d , break e ] break T1 ≡ break T2 )" non associative with precedence 45 for @{ 'RLift $T1 $d $e $T2 }. @@ -55,7 +59,7 @@ notation "hvbox( ↓ [ d , break e ] break L1 ≡ break L2 )" non associative with precedence 45 for @{ 'RDrop $L1 $d $e $L2 }. -notation "hvbox( L ⊢ break (term 90 T1) break [ d , break e ] ≫ break T2 )" +notation "hvbox( L ⊢ break term 90 T1 break [ d , break e ] ≫ break T2 )" non associative with precedence 45 for @{ 'PSubst $L $T1 $d $e $T2 }. diff --git a/matita/matita/lib/lambda-delta/reduction/tpr_defs.ma b/matita/matita/lib/lambda-delta/reduction/tpr_defs.ma index a8aac61df..cb9609951 100644 --- a/matita/matita/lib/lambda-delta/reduction/tpr_defs.ma +++ b/matita/matita/lib/lambda-delta/reduction/tpr_defs.ma @@ -9,7 +9,7 @@ \ / V_______________________________________________________________ *) -include "lambda-delta/substitution/ps_defs.ma". +include "lambda-delta/substitution/pts_defs.ma". (* CONTEXT-FREE PARALLEL REDUCTION ON TERMS *********************************) diff --git a/matita/matita/lib/lambda-delta/reduction/tpr_main.ma b/matita/matita/lib/lambda-delta/reduction/tpr_main.ma index ec4551f9a..1d5d7d713 100644 --- a/matita/matita/lib/lambda-delta/reduction/tpr_main.ma +++ b/matita/matita/lib/lambda-delta/reduction/tpr_main.ma @@ -13,7 +13,6 @@ (**************************************************************************) (* -include "lambda-delta/substitution/lift_fun.ma". include "lambda-delta/substitution/lift_main.ma". include "lambda-delta/substitution/drop_main.ma". *) diff --git a/matita/matita/lib/lambda-delta/reduction/tpr_ps.ma b/matita/matita/lib/lambda-delta/reduction/tpr_pts.ma similarity index 74% rename from matita/matita/lib/lambda-delta/reduction/tpr_ps.ma rename to matita/matita/lib/lambda-delta/reduction/tpr_pts.ma index dc4a1098c..ea6b8027b 100644 --- a/matita/matita/lib/lambda-delta/reduction/tpr_ps.ma +++ b/matita/matita/lib/lambda-delta/reduction/tpr_pts.ma @@ -16,11 +16,11 @@ include "lambda-delta/reduction/lpr_defs.ma". (* CONTEXT-FREE PARALLEL REDUCTION ON TERMS *********************************) -axiom tpr_ps_lpr: ∀L1,L2. L1 ⇒ L2 → ∀T1,T2. T1 ⇒ T2 → - ∀d,e,U1. L1 ⊢ T1 [d, e] ≫ U1 → - ∃∃U2. U1 ⇒ U2 & L2 ⊢ T2 [d, e] ≫ U2. +axiom tpr_pts_lpr: ∀L1,L2. L1 ⇒ L2 → ∀T1,T2. T1 ⇒ T2 → + ∀d,e,U1. L1 ⊢ T1 [d, e] ≫ U1 → + ∃∃U2. U1 ⇒ U2 & L2 ⊢ T2 [d, e] ≫ U2. -lemma tpr_ps_bind: ∀I,V1,V2,T1,T2,U1. V1 ⇒ V2 → T1 ⇒ T2 → - ⋆. 𝕓{I} V1 ⊢ T1 [0, 1] ≫ U1 → - ∃∃U2. U1 ⇒ U2 & ⋆. 𝕓{I} V2 ⊢ T2 [0, 1] ≫ U2. +lemma tpr_pts_bind: ∀I,V1,V2,T1,T2,U1. V1 ⇒ V2 → T1 ⇒ T2 → + ⋆. 𝕓{I} V1 ⊢ T1 [0, 1] ≫ U1 → + ∃∃U2. U1 ⇒ U2 & ⋆. 𝕓{I} V2 ⊢ T2 [0, 1] ≫ U2. /3 width=5/ qed. diff --git a/matita/matita/lib/lambda-delta/reduction/tpr_tpr.ma b/matita/matita/lib/lambda-delta/reduction/tpr_tpr.ma index cbd2ec12b..53ad09398 100644 --- a/matita/matita/lib/lambda-delta/reduction/tpr_tpr.ma +++ b/matita/matita/lib/lambda-delta/reduction/tpr_tpr.ma @@ -9,32 +9,10 @@ \ / V_______________________________________________________________ *) -include "lambda-delta/substitution/lift_fun.ma". include "lambda-delta/substitution/lift_weight.ma". -include "lambda-delta/substitution/ps_ps.ma". +include "lambda-delta/substitution/pts_pts.ma". include "lambda-delta/reduction/tpr_main.ma". -include "lambda-delta/reduction/tpr_ps.ma". - -lemma ps_inv_lift_eq: ∀L,U1,U2,d,e. - L ⊢ U1 [d, e] ≫ U2 → ∀T1. ↑[d, e] T1 ≡ U1 → U1 = U2. -#L #U1 #U2 #d #e #H elim H -H L U1 U2 d e -[ // -| // -| #L #K #V #U1 #U2 #i #d #e #Hdi #Hide #_ #_ #_ #_ #T1 #H - elim (lift_inv_lref2 … H) -H * #H - [ lapply (le_to_lt_to_lt … Hdi … H) -Hdi H #H - elim (lt_refl_false … H) - | lapply (lt_to_le_to_lt … Hide … H) -Hide H #H - elim (lt_refl_false … H) - ] -| #L #I #V1 #V2 #T1 #T2 #d #e #_ #_ #IHV12 #IHT12 #X #HX - elim (lift_inv_bind2 … HX) -HX #V #T #HV1 #HT1 #H destruct -X - >IHV12 // >IHT12 // -| #L #I #V1 #V2 #T1 #T2 #d #e #_ #_ #IHV12 #IHT12 #X #HX - elim (lift_inv_flat2 … HX) -HX #V #T #HV1 #HT1 #H destruct -X - >IHV12 // >IHT12 // -] -qed. +include "lambda-delta/reduction/tpr_pts.ma". (* CONTEXT-FREE PARALLEL REDUCTION ON TERMS *********************************) @@ -71,7 +49,7 @@ lemma tpr_conf_bind_delta: #V0 #V1 #T0 #T1 #V2 #T2 #T #IH #HV01 #HV02 #HT01 #HT02 #HT2 elim (IH … HV01 … HV02) -HV01 HV02 // #V #HV1 #HV2 elim (IH … HT01 … HT02) -HT01 HT02 IH // -V0 T0 #T0 #HT10 #HT20 -elim (tpr_ps_bind … HV2 HT20 … HT2) -HT20 HT2 /3 width=5/ +elim (tpr_pts_bind … HV2 HT20 … HT2) -HT20 HT2 /3 width=5/ qed. lemma tpr_conf_bind_zeta: @@ -139,12 +117,12 @@ elim (tpr_inv_abbr1 … H) -H * | -HV2 HVV2 #WW2 #UU2 #UU #HWW2 #HUU02 #HUU2 #H destruct -T1; elim (IH … HW02 … HWW2) -HW02 HWW2 // #W #HW02 #HWW2 elim (IH … HU02 … HUU02) -HU02 HUU02 IH // #U #HU2 #HUUU2 - elim (tpr_ps_bind … HWW2 HUUU2 … HUU2) -HUU2 HUUU2 #UUU #HUUU2 #HUUU1 + elim (tpr_pts_bind … HWW2 HUUU2 … HUU2) -HUU2 HUUU2 #UUU #HUUU2 #HUUU1 @ex2_1_intro - [2: @tpr_theta + [2: @tpr_theta [6: @HVV |7: @HWW2 |8: @HUUU2 |1,2,3,4: skip | // ] |1:skip - |3: @tpr_delta [3: @tpr_flat |1: skip ] - ] /2 width=14/ (**) (* /5 width=14/ is too slow *) + |3: @tpr_delta [3: @tpr_flat |1: skip ] /2 width=5/ + ] (**) (* /5 width=14/ is too slow *) (* case 3: zeta *) | -HW02 HVV HVVV #UU1 #HUU10 #HUUT1 elim (tpr_inv_lift … HU02 … HUU10) -HU02 #UU #HUU2 #HUU1 @@ -196,9 +174,9 @@ lemma tpr_conf_delta_delta: #V0 #V1 #T0 #T1 #TT1 #V2 #T2 #TT2 #IH #HV01 #HV02 #HT01 #HT02 #HTT1 #HTT2 elim (IH … HV01 … HV02) -HV01 HV02 // #V #HV1 #HV2 elim (IH … HT01 … HT02) -HT01 HT02 IH // #T #HT1 #HT2 -elim (tpr_ps_bind … HV1 HT1 … HTT1) -HT1 HTT1 #U1 #TTU1 #HTU1 -elim (tpr_ps_bind … HV2 HT2 … HTT2) -HT2 HTT2 #U2 #TTU2 #HTU2 -elim (ps_conf … HTU1 … HTU2) -HTU1 HTU2 #U #HU1 #HU2 +elim (tpr_pts_bind … HV1 HT1 … HTT1) -HT1 HTT1 #U1 #TTU1 #HTU1 +elim (tpr_pts_bind … HV2 HT2 … HTT2) -HT2 HTT2 #U2 #TTU2 #HTU2 +elim (pts_conf … HTU1 … HTU2) -HTU1 HTU2 #U #HU1 #HU2 @ex2_1_intro [2,3: @tpr_delta |1: skip ] /width=10/ (**) (* /3 width=10/ is too slow *) qed. @@ -213,7 +191,7 @@ lemma tpr_conf_delta_zeta: ∃∃X. 𝕓{Abbr} V1. TT1 ⇒ X & X2 ⇒ X. #X2 #V0 #V1 #T0 #T1 #TT1 #T2 #IH #_ #HT01 #HTT1 #HTX2 #HTT20 elim (tpr_inv_lift … HT01 … HTT20) -HT01 #TT2 #HTT21 #HTT2 -lapply (ps_inv_lift_eq … HTT1 … HTT21) -HTT1 #HTT1 destruct -T1; +lapply (pts_inv_lift1_eq … HTT1 … HTT21) -HTT1 #HTT1 destruct -T1; lapply (tw_lift … HTT20) -HTT20 #HTT20 elim (IH … HTX2 … HTT2) -HTX2 HTT2 IH /3/ qed. diff --git a/matita/matita/lib/lambda-delta/substitution/drop_defs.ma b/matita/matita/lib/lambda-delta/substitution/drop_defs.ma index 1bf8e278d..51c657615 100644 --- a/matita/matita/lib/lambda-delta/substitution/drop_defs.ma +++ b/matita/matita/lib/lambda-delta/substitution/drop_defs.ma @@ -9,7 +9,7 @@ \ / V_______________________________________________________________ *) -include "lambda-delta/syntax/lenv.ma". +include "lambda-delta/substitution/leq_defs.ma". include "lambda-delta/substitution/lift_defs.ma". (* DROPPING *****************************************************************) @@ -24,21 +24,14 @@ inductive drop: lenv → nat → nat → lenv → Prop ≝ interpretation "dropping" 'RDrop L1 d e L2 = (drop L1 d e L2). -(* Basic properties *********************************************************) - -lemma drop_drop_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/ -qed. - (* Basic inversion lemmas ***************************************************) lemma drop_inv_refl_aux: ∀d,e,L1,L2. ↓[d, e] L1 ≡ L2 → d = 0 → e = 0 → L1 = L2. -#d #e #L1 #L2 #H elim H -H d e L1 L2 +#d #e #L1 #L2 * -d e L1 L2 [ // -| #L1 #L2 #I #V #e #_ #_ #_ #H +| #L1 #L2 #I #V #e #_ #_ #H elim (plus_S_eq_O_false … H) -| #L1 #L2 #I #V1 #V2 #d #e #_ #_ #_ #H +| #L1 #L2 #I #V1 #V2 #d #e #_ #_ #H elim (plus_S_eq_O_false … H) ] qed. @@ -46,14 +39,27 @@ qed. lemma drop_inv_refl: ∀L1,L2. ↓[0, 0] L1 ≡ L2 → L1 = L2. /2 width=5/ qed. +lemma drop_inv_sort1_aux: ∀d,e,L1,L2. ↓[d, e] L1 ≡ L2 → L1 = ⋆ → + ∧∧ L2 = ⋆ & d = 0 & e = 0. +#d #e #L1 #L2 * -d e L1 L2 +[ /2/ +| #L1 #L2 #I #V #e #_ #H destruct +| #L1 #L2 #I #V1 #V2 #d #e #_ #_ #H destruct +] +qed. + +lemma drop_inv_sort1: ∀d,e,L2. ↓[d, e] ⋆ ≡ L2 → + ∧∧ L2 = ⋆ & d = 0 & e = 0. +/2/ qed. + lemma drop_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 #H elim H -H d e L1 L2 +#d #e #L1 #L2 * -d e L1 L2 [ /3/ -| #L1 #L2 #I #V #e #HL12 #_ #_ #K #J #W #H destruct -L1 I V /3/ -| #L1 #L2 #I #V1 #V2 #d #e #_ #_ #_ #H elim (plus_S_eq_O_false … H) +| #L1 #L2 #I #V #e #HL12 #_ #K #J #W #H destruct -L1 I V /3/ +| #L1 #L2 #I #V1 #V2 #d #e #_ #_ #H elim (plus_S_eq_O_false … H) ] qed. @@ -74,10 +80,10 @@ lemma drop_inv_skip2_aux: ∀d,e,L1,L2. ↓[d, e] L1 ≡ L2 → 0 < d → ∃∃K1,V1. ↓[d - 1, e] K1 ≡ K2 & ↑[d - 1, e] V2 ≡ V1 & L1 = K1. 𝕓{I} V1. -#d #e #L1 #L2 #H elim H -H d e L1 L2 +#d #e #L1 #L2 * -d e L1 L2 [ #L #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 -X Y Z; +| #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 -X Y Z; /2 width=5/ ] qed. @@ -86,3 +92,46 @@ lemma drop_inv_skip2: ∀d,e,I,L1,K2,V2. ↓[d, e] L1 ≡ K2. 𝕓{I} V2 → 0 < ∃∃K1,V1. ↓[d - 1, e] K1 ≡ K2 & ↑[d - 1, e] V2 ≡ V1 & L1 = K1. 𝕓{I} V1. /2/ qed. + +(* Basic properties *********************************************************) + +lemma drop_drop_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/ +qed. + +lemma drop_fwd_drop2: ∀L1,I2,K2,V2,e. ↓[O, e] L1 ≡ K2. 𝕓{I2} V2 → + ↓[O, e + 1] L1 ≡ K2. +#L1 elim L1 -L1 +[ #I2 #K2 #V2 #e #H elim (drop_inv_sort1 … H) -H #H destruct +| #K1 #I1 #V1 #IHL1 #I2 #K2 #V2 #e #H + elim (drop_inv_O1 … H) -H * #He #H + [ -IHL1; destruct -e K2 I2 V2 /2/ + | @drop_drop >(plus_minus_m_m e 1) /2/ + ] +] +qed. + +lemma drop_leq_drop1: ∀L1,L2,d,e. L1 [d, e] ≈ L2 → + ∀I,K1,V,i. ↓[0, i] L1 ≡ K1. 𝕓{I} V → + d ≤ i → i < d + e → + ∃∃K2. K1 [0, d + e - i - 1] ≈ K2 & + ↓[0, i] L2 ≡ K2. 𝕓{I} V. +#L1 #L2 #d #e #H elim H -H L1 L2 d e +[ #d #e #I #K1 #V #i #H + elim (drop_inv_sort1 … H) -H #H destruct +| #L1 #L2 #I1 #I2 #V1 #V2 #_ #_ #I #K1 #V #i #_ #_ #H + elim (lt_zero_false … H) +| #L1 #L2 #I #V #e #HL12 #IHL12 #J #K1 #W #i #H #_ #Hie + elim (drop_inv_O1 … H) -H * #Hi #HLK1 + [ -IHL12 Hie; destruct -i K1 J W; + arith_g1 // /3/ + ] +| #L1 #L2 #I1 #I2 #V1 #V2 #d #e #_ #IHL12 #I #K1 #V #i #H #Hdi >plus_plus_comm_23 #Hide + lapply (plus_S_le_to_pos … Hdi) #Hi + lapply (drop_inv_drop1 … H ?) -H // #HLK1 + elim (IHL12 … HLK1 ? ?) -IHL12 HLK1 [2: /2/ |3: /2/ ] -Hdi Hide >arith_g1 // /3/ +] +qed. diff --git a/matita/matita/lib/lambda-delta/substitution/drop_main.ma b/matita/matita/lib/lambda-delta/substitution/drop_main.ma index a305b78c7..575f25401 100644 --- a/matita/matita/lib/lambda-delta/substitution/drop_main.ma +++ b/matita/matita/lib/lambda-delta/substitution/drop_main.ma @@ -16,7 +16,7 @@ include "lambda-delta/substitution/drop_defs.ma". (* DROPPING *****************************************************************) -(* the main properties ******************************************************) +(* Main properties **********************************************************) lemma drop_conf_ge: ∀d1,e1,L,L1. ↓[d1, e1] L ≡ L1 → ∀e2,L2. ↓[0, e2] L ≡ L2 → d1 + e1 ≤ e2 → @@ -86,5 +86,11 @@ lemma drop_trans_ge: ∀d1,e1,L1,L. ↓[d1, e1] L1 ≡ L → ] qed. +lemma drop_trans_ge_comm: ∀d1,e1,e2,L1,L2,L. + ↓[d1, e1] L1 ≡ L → ↓[0, e2] L ≡ L2 → d1 ≤ e2 → + ↓[0, e2 + e1] L1 ≡ L2. +#e1 #e1 #e2 >commutative_plus /2 width=5/ +qed. + axiom drop_div: ∀e1,L1,L. ↓[0, e1] L1 ≡ L → ∀e2,L2. ↓[0, e2] L2 ≡ L → ∃∃L0. ↓[0, e1] L0 ≡ L2 & ↓[e1, e2] L0 ≡ L1. diff --git a/matita/matita/lib/lambda-delta/substitution/leq_defs.ma b/matita/matita/lib/lambda-delta/substitution/leq_defs.ma new file mode 100644 index 000000000..3c7981566 --- /dev/null +++ b/matita/matita/lib/lambda-delta/substitution/leq_defs.ma @@ -0,0 +1,60 @@ +(* + ||M|| This file is part of HELM, an Hypertextual, Electronic + ||A|| Library of Mathematics, developed at the Computer Science + ||T|| Department of the University of Bologna, Italy. + ||I|| + ||T|| + ||A|| This file is distributed under the terms of the + \ / GNU General Public License Version 2 + \ / + V_______________________________________________________________ *) + +include "lambda-delta/syntax/lenv.ma". + +(* LOCAL ENVIRONMENT EQUALITY ***********************************************) + +inductive leq: lenv → nat → nat → lenv → Prop ≝ +| leq_sort: ∀d,e. leq (⋆) d e (⋆) +| leq_comp: ∀L1,L2,I1,I2,V1,V2. + leq L1 0 0 L2 → leq (L1. 𝕓{I1} V1) 0 0 (L2. 𝕓{I2} V2) +| leq_eq: ∀L1,L2,I,V,e. leq L1 0 e L2 → leq (L1. 𝕓{I} V) 0 (e + 1) (L2.𝕓{I} V) +| leq_skip: ∀L1,L2,I1,I2,V1,V2,d,e. + leq L1 d e L2 → leq (L1. 𝕓{I1} V1) (d + 1) e (L2. 𝕓{I2} V2) +. + +interpretation "local environment equality" 'Eq L1 d e L2 = (leq L1 d e L2). + +(* Basic properties *********************************************************) + +lemma leq_refl: ∀d,e,L. L [d, e] ≈ L. +#d elim d -d +[ #e elim e -e [ #L elim L -L /2/ | #e #IHe #L elim L -L /2/ ] +| #d #IHd #e #L elim L -L /2/ +] +qed. + +lemma leq_sym: ∀L1,L2,d,e. L1 [d, e] ≈ L2 → L2 [d, e] ≈ L1. +#L1 #L2 #d #e #H elim H -H L1 L2 d e /2/ +qed. + +lemma leq_skip_lt: ∀L1,L2,d,e. leq L1 (d - 1) e L2 → 0 < d → + ∀I1,I2,V1,V2. L1. 𝕓{I1} V1 [d, e] ≈ L2. 𝕓{I2} V2. + +#L1 #L2 #d #e #HL12 #Hd >(plus_minus_m_m d 1) /2/ +qed. + +(* Basic inversion lemmas ***************************************************) + +lemma leq_inv_sort1_aux: ∀L1,L2,d,e. L1 [d, e] ≈ L2 → L1 = ⋆ → L2 = ⋆. +#L1 #L2 #d #e #H elim H -H L1 L2 d e +[ // +| #L1 #L2 #I1 #I2 #V1 #V2 #_ #_ #H destruct +| #L1 #L2 #I #V #e #_ #_ #H destruct +| #L1 #L2 #I1 #I2 #V1 #V2 #d #e #_ #_ #H destruct +qed. + +lemma leq_inv_sort1: ∀L2,d,e. ⋆ [d, e] ≈ L2 → L2 = ⋆. +/2 width=5/ qed. + +lemma leq_inv_sort2: ∀L1,d,e. L1 [d, e] ≈ ⋆ → L1 = ⋆. +/3/ qed. diff --git a/matita/matita/lib/lambda-delta/substitution/lift_defs.ma b/matita/matita/lib/lambda-delta/substitution/lift_defs.ma index ff2545339..71d438d68 100644 --- a/matita/matita/lib/lambda-delta/substitution/lift_defs.ma +++ b/matita/matita/lib/lambda-delta/substitution/lift_defs.ma @@ -41,6 +41,18 @@ lemma lift_refl: ∀T,d. ↑[d, 0] T ≡ T. ] qed. +lemma lift_total: ∀T1,d,e. ∃T2. ↑[d,e] T1 ≡ T2. +#T1 elim T1 -T1 +[ /2/ +| #i #d #e elim (lt_or_ge i d) /3/ +| * #I #V1 #T1 #IHV1 #IHT1 #d #e + elim (IHV1 d e) -IHV1 #V2 #HV12 + [ elim (IHT1 (d+1) e) -IHT1 /3/ + | elim (IHT1 d e) -IHT1 /3/ + ] +] +qed. + (* Basic inversion lemmas ***************************************************) lemma lift_inv_refl_aux: ∀d,e,T1,T2. ↑[d, e] T1 ≡ T2 → e = 0 → T1 = T2. diff --git a/matita/matita/lib/lambda-delta/substitution/lift_fun.ma b/matita/matita/lib/lambda-delta/substitution/lift_fun.ma deleted file mode 100644 index 58d718fb7..000000000 --- a/matita/matita/lib/lambda-delta/substitution/lift_fun.ma +++ /dev/null @@ -1,61 +0,0 @@ -(**************************************************************************) -(* ___ *) -(* ||M|| *) -(* ||A|| A project by Andrea Asperti *) -(* ||T|| *) -(* ||I|| Developers: *) -(* ||T|| The 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 "lambda-delta/substitution/lift_defs.ma". - -(* RELOCATION ***************************************************************) - -(* Functional properties ****************************************************) - -lemma lift_total: ∀T1,d,e. ∃T2. ↑[d,e] T1 ≡ T2. -#T1 elim T1 -T1 -[ /2/ -| #i #d #e elim (lt_or_ge i d) /3/ -| * #I #V1 #T1 #IHV1 #IHT1 #d #e - elim (IHV1 d e) -IHV1 #V2 #HV12 - [ elim (IHT1 (d+1) e) -IHT1 /3/ - | elim (IHT1 d e) -IHT1 /3/ - ] -] -qed. - -lemma lift_mono: ∀d,e,T,U1. ↑[d,e] T ≡ U1 → ∀U2. ↑[d,e] T ≡ U2 → U1 = U2. -#d #e #T #U1 #H elim H -H d e T U1 -[ #k #d #e #X #HX - lapply (lift_inv_sort1 … HX) -HX // -| #i #d #e #Hid #X #HX - lapply (lift_inv_lref1_lt … HX ?) -HX // -| #i #d #e #Hdi #X #HX - lapply (lift_inv_lref1_ge … HX ?) -HX // -| #I #V1 #V2 #T1 #T2 #d #e #_ #_ #IHV12 #IHT12 #X #HX - elim (lift_inv_bind1 … HX) -HX #V #T #HV1 #HT1 #HX destruct -X /3/ -| #I #V1 #V2 #T1 #T2 #d #e #_ #_ #IHV12 #IHT12 #X #HX - elim (lift_inv_flat1 … HX) -HX #V #T #HV1 #HT1 #HX destruct -X /3/ -] -qed. - -lemma lift_inj: ∀d,e,T1,U. ↑[d,e] T1 ≡ U → ∀T2. ↑[d,e] T2 ≡ U → T1 = T2. -#d #e #T1 #U #H elim H -H d e T1 U -[ #k #d #e #X #HX - lapply (lift_inv_sort2 … HX) -HX // -| #i #d #e #Hid #X #HX - lapply (lift_inv_lref2_lt … HX ?) -HX // -| #i #d #e #Hdi #X #HX - lapply (lift_inv_lref2_ge … HX ?) -HX /2/ -| #I #V1 #V2 #T1 #T2 #d #e #_ #_ #IHV12 #IHT12 #X #HX - elim (lift_inv_bind2 … HX) -HX #V #T #HV1 #HT1 #HX destruct -X /3/ -| #I #V1 #V2 #T1 #T2 #d #e #_ #_ #IHV12 #IHT12 #X #HX - elim (lift_inv_flat2 … HX) -HX #V #T #HV1 #HT1 #HX destruct -X /3/ -] -qed. diff --git a/matita/matita/lib/lambda-delta/substitution/lift_main.ma b/matita/matita/lib/lambda-delta/substitution/lift_main.ma index 5ef9a31f4..26680f364 100644 --- a/matita/matita/lib/lambda-delta/substitution/lift_main.ma +++ b/matita/matita/lib/lambda-delta/substitution/lift_main.ma @@ -18,6 +18,21 @@ include "lambda-delta/substitution/lift_defs.ma". (* Main properies ***********************************************************) +lemma lift_inj: ∀d,e,T1,U. ↑[d,e] T1 ≡ U → ∀T2. ↑[d,e] T2 ≡ U → T1 = T2. +#d #e #T1 #U #H elim H -H d e T1 U +[ #k #d #e #X #HX + lapply (lift_inv_sort2 … HX) -HX // +| #i #d #e #Hid #X #HX + lapply (lift_inv_lref2_lt … HX ?) -HX // +| #i #d #e #Hdi #X #HX + lapply (lift_inv_lref2_ge … HX ?) -HX /2/ +| #I #V1 #V2 #T1 #T2 #d #e #_ #_ #IHV12 #IHT12 #X #HX + elim (lift_inv_bind2 … HX) -HX #V #T #HV1 #HT1 #HX destruct -X /3/ +| #I #V1 #V2 #T1 #T2 #d #e #_ #_ #IHV12 #IHT12 #X #HX + elim (lift_inv_flat2 … HX) -HX #V #T #HV1 #HT1 #HX destruct -X /3/ +] +qed. + lemma lift_div_le: ∀d1,e1,T1,T. ↑[d1, e1] T1 ≡ T → ∀d2,e2,T2. ↑[d2 + e1, e2] T2 ≡ T → d1 ≤ d2 → @@ -57,7 +72,7 @@ lemma lift_free: ∀d1,e2,T1,T2. ↑[d1, e2] T1 ≡ T2 → ∀d2,e1. lapply (lt_to_le_to_lt … Hid1 Hd12) -Hd12 #Hid2 /4/ | #i #d1 #e2 #Hid1 #d2 #e1 #_ #Hd21 #He12 lapply (transitive_le …(i+e1) Hd21 ?) /2/ -Hd21 #Hd21 - <(plus_plus_minus_m_m e1 e2 i) /3/ + <(arith_d1 i e2 e1) // /3/ | #I #V1 #V2 #T1 #T2 #d1 #e2 #_ #_ #IHV #IHT #d2 #e1 #Hd12 #Hd21 #He12 elim (IHV … Hd12 Hd21 He12) -IHV #V0 #HV0a #HV0b elim (IHT (d2+1) … ? ? He12) /3 width = 5/ @@ -67,6 +82,21 @@ lemma lift_free: ∀d1,e2,T1,T2. ↑[d1, e2] T1 ≡ T2 → ∀d2,e1. ] qed. +lemma lift_mono: ∀d,e,T,U1. ↑[d,e] T ≡ U1 → ∀U2. ↑[d,e] T ≡ U2 → U1 = U2. +#d #e #T #U1 #H elim H -H d e T U1 +[ #k #d #e #X #HX + lapply (lift_inv_sort1 … HX) -HX // +| #i #d #e #Hid #X #HX + lapply (lift_inv_lref1_lt … HX ?) -HX // +| #i #d #e #Hdi #X #HX + lapply (lift_inv_lref1_ge … HX ?) -HX // +| #I #V1 #V2 #T1 #T2 #d #e #_ #_ #IHV12 #IHT12 #X #HX + elim (lift_inv_bind1 … HX) -HX #V #T #HV1 #HT1 #HX destruct -X /3/ +| #I #V1 #V2 #T1 #T2 #d #e #_ #_ #IHV12 #IHT12 #X #HX + elim (lift_inv_flat1 … HX) -HX #V #T #HV1 #HT1 #HX destruct -X /3/ +] +qed. + lemma lift_trans_be: ∀d1,e1,T1,T. ↑[d1, e1] T1 ≡ T → ∀d2,e2,T2. ↑[d2, e2] T ≡ T2 → d1 ≤ d2 → d2 ≤ d1 + e1 → ↑[d1, e1 + e2] T1 ≡ T2. diff --git a/matita/matita/lib/lambda-delta/substitution/ps_defs.ma b/matita/matita/lib/lambda-delta/substitution/ps_defs.ma deleted file mode 100644 index 514e0ad2e..000000000 --- a/matita/matita/lib/lambda-delta/substitution/ps_defs.ma +++ /dev/null @@ -1,78 +0,0 @@ -(* - ||M|| This file is part of HELM, an Hypertextual, Electronic - ||A|| Library of Mathematics, developed at the Computer Science - ||T|| Department of the University of Bologna, Italy. - ||I|| - ||T|| - ||A|| This file is distributed under the terms of the - \ / GNU General Public License Version 2 - \ / - V_______________________________________________________________ *) - -include "lambda-delta/substitution/drop_defs.ma". - -(* PARALLEL SUBSTITUTION ****************************************************) - -inductive ps: lenv → term → nat → nat → term → Prop ≝ -| ps_sort : ∀L,k,d,e. ps L (⋆k) d e (⋆k) -| ps_lref : ∀L,i,d,e. ps L (#i) d e (#i) -| ps_subst: ∀L,K,V,U1,U2,i,d,e. - d ≤ i → i < d + e → - ↓[0, i] L ≡ K. 𝕓{Abbr} V → ps K V 0 (d + e - i - 1) U1 → - ↑[0, i + 1] U1 ≡ U2 → ps L (#i) d e U2 -| ps_bind : ∀L,I,V1,V2,T1,T2,d,e. - ps L V1 d e V2 → ps (L. 𝕓{I} V1) T1 (d + 1) e T2 → - ps L (𝕓{I} V1. T1) d e (𝕓{I} V2. T2) -| ps_flat : ∀L,I,V1,V2,T1,T2,d,e. - ps L V1 d e V2 → ps L T1 d e T2 → - ps L (𝕗{I} V1. T1) d e (𝕗{I} V2. T2) -. - -interpretation "parallel substritution" 'PSubst L T1 d e T2 = (ps L T1 d e T2). - -(* Basic properties *********************************************************) - -lemma subst_refl: ∀T,L,d,e. L ⊢ T [d, e] ≫ T. -#T elim T -T // -#I elim I -I /2/ -qed. - -(* Basic inversion lemmas ***************************************************) - -lemma ps_inv_bind1_aux: ∀d,e,L,U1,U2. L ⊢ U1 [d, e] ≫ U2 → - ∀I,V1,T1. U1 = 𝕓{I} V1. T1 → - ∃∃V2,T2. L ⊢ V1 [d, e] ≫ V2 & - L. 𝕓{I} V1 ⊢ T1 [d + 1, e] ≫ T2 & - U2 = 𝕓{I} V2. T2. -#d #e #L #U1 #U2 #H elim H -H d e L U1 U2 -[ #L #k #d #e #I #V1 #T1 #H destruct -| #L #i #d #e #I #V1 #T1 #H destruct -| #L #K #V #U1 #U2 #i #d #e #_ #_ #_ #_ #_ #_ #I #V1 #T1 #H destruct -| #L #J #V1 #V2 #T1 #T2 #d #e #HV12 #HT12 #_ #_ #I #V #T #H destruct /2 width=5/ -| #L #J #V1 #V2 #T1 #T2 #d #e #_ #_ #_ #_ #I #V #T #H destruct -] -qed. - -lemma subst_inv_bind1: ∀d,e,L,I,V1,T1,U2. L ⊢ 𝕓{I} V1. T1 [d, e] ≫ U2 → - ∃∃V2,T2. L ⊢ V1 [d, e] ≫ V2 & - L. 𝕓{I} V1 ⊢ T1 [d + 1, e] ≫ T2 & - U2 = 𝕓{I} V2. T2. -/2/ qed. - -lemma subst_inv_flat1_aux: ∀d,e,L,U1,U2. L ⊢ U1 [d, e] ≫ U2 → - ∀I,V1,T1. U1 = 𝕗{I} V1. T1 → - ∃∃V2,T2. L ⊢ V1 [d, e] ≫ V2 & L ⊢ T1 [d, e] ≫ T2 & - U2 = 𝕗{I} V2. T2. -#d #e #L #U1 #U2 #H elim H -H d e L U1 U2 -[ #L #k #d #e #I #V1 #T1 #H destruct -| #L #i #d #e #I #V1 #T1 #H destruct -| #L #K #V #U1 #U2 #i #d #e #_ #_ #_ #_ #_ #_ #I #V1 #T1 #H destruct -| #L #J #V1 #V2 #T1 #T2 #d #e #_ #_ #_ #_ #I #V #T #H destruct -| #L #J #V1 #V2 #T1 #T2 #d #e #HV12 #HT12 #_ #_ #I #V #T #H destruct /2 width=5/ -] -qed. - -lemma subst_inv_flat1: ∀d,e,L,I,V1,T1,U2. L ⊢ 𝕗{I} V1. T1 [d, e] ≫ U2 → - ∃∃V2,T2. L ⊢ V1 [d, e] ≫ V2 & L ⊢ T1 [d, e] ≫ T2 & - U2 = 𝕗{I} V2. T2. -/2/ qed. diff --git a/matita/matita/lib/lambda-delta/substitution/ps_ps.ma b/matita/matita/lib/lambda-delta/substitution/ps_ps.ma deleted file mode 100644 index a6fe84a3e..000000000 --- a/matita/matita/lib/lambda-delta/substitution/ps_ps.ma +++ /dev/null @@ -1,17 +0,0 @@ -(* - ||M|| This file is part of HELM, an Hypertextual, Electronic - ||A|| Library of Mathematics, developed at the Computer Science - ||T|| Department of the University of Bologna, Italy. - ||I|| - ||T|| - ||A|| This file is distributed under the terms of the - \ / GNU General Public License Version 2 - \ / - V_______________________________________________________________ *) - -include "lambda-delta/substitution/ps_defs.ma". - -(* PARALLEL SUBSTITUTION ****************************************************) - -axiom ps_conf: ∀L,T0,d,e,T1. L ⊢ T0 [d, e] ≫ T1 → ∀T2. L ⊢ T0 [d, e] ≫ T2 → - ∃∃T. L ⊢ T1 [d, e] ≫ T & L ⊢ T2 [d, e] ≫ T. diff --git a/matita/matita/lib/lambda-delta/substitution/pts_defs.ma b/matita/matita/lib/lambda-delta/substitution/pts_defs.ma new file mode 100644 index 000000000..111052f69 --- /dev/null +++ b/matita/matita/lib/lambda-delta/substitution/pts_defs.ma @@ -0,0 +1,107 @@ +(* + ||M|| This file is part of HELM, an Hypertextual, Electronic + ||A|| Library of Mathematics, developed at the Computer Science + ||T|| Department of the University of Bologna, Italy. + ||I|| + ||T|| + ||A|| This file is distributed under the terms of the + \ / GNU General Public License Version 2 + \ / + V_______________________________________________________________ *) + +include "lambda-delta/substitution/drop_defs.ma". + +(* PARTIAL TELESCOPIC SUBSTITUTION ******************************************) + +inductive pts: lenv → term → nat → nat → term → Prop ≝ +| pts_sort : ∀L,k,d,e. pts L (⋆k) d e (⋆k) +| pts_lref : ∀L,i,d,e. pts L (#i) d e (#i) +| pts_subst: ∀L,K,V,U1,U2,i,d,e. + d ≤ i → i < d + e → + ↓[0, i] L ≡ K. 𝕓{Abbr} V → pts K V 0 (d + e - i - 1) U1 → + ↑[0, i + 1] U1 ≡ U2 → pts L (#i) d e U2 +| pts_bind : ∀L,I,V1,V2,T1,T2,d,e. + pts L V1 d e V2 → pts (L. 𝕓{I} V1) T1 (d + 1) e T2 → + pts L (𝕓{I} V1. T1) d e (𝕓{I} V2. T2) +| pts_flat : ∀L,I,V1,V2,T1,T2,d,e. + pts L V1 d e V2 → pts L T1 d e T2 → + pts L (𝕗{I} V1. T1) d e (𝕗{I} V2. T2) +. + +interpretation "partial telescopic substritution" + 'PSubst L T1 d e T2 = (pts L T1 d e T2). + +(* Basic properties *********************************************************) + +lemma pts_leq_repl: ∀L1,T1,T2,d,e. L1 ⊢ T1 [d, e] ≫ T2 → + ∀L2. L1 [d, e] ≈ L2 → L2 ⊢ T1 [d, e] ≫ T2. +#L1 #T1 #T2 #d #e #H elim H -H L1 T1 T2 d e +[ // +| // +| #L1 #K1 #V #V1 #V2 #i #d #e #Hdi #Hide #HLK1 #_ #HV12 #IHV12 #L2 #HL12 + elim (drop_leq_drop1 … HL12 … HLK1 ? ?) -HL12 HLK1 // #K2 #HK12 #HLK2 + @pts_subst [4,5,6,8: // |1,2,3: skip | /2/ ] (**) (* /3 width=6/ is too slow *) +| /4/ +| /3/ +] +qed. + +lemma pts_refl: ∀T,L,d,e. L ⊢ T [d, e] ≫ T. +#T elim T -T // +#I elim I -I /2/ +qed. + +lemma pts_weak: ∀L,T1,T2,d1,e1. L ⊢ T1 [d1, e1] ≫ T2 → + ∀d2,e2. d2 ≤ d1 → d1 + e1 ≤ d2 + e2 → + L ⊢ T1 [d2, e2] ≫ T2. +#L #T1 #T #d1 #e1 #H elim H -L T1 T d1 e1 +[ // +| // +| #L #K #V #V1 #V2 #i #d1 #e1 #Hid1 #Hide1 #HLK #_ #HV12 #IHV12 #d2 #e2 #Hd12 #Hde12 + lapply (transitive_le … Hd12 … Hid1) -Hd12 Hid1 #Hid2 + lapply (lt_to_le_to_lt … Hide1 … Hde12) -Hide1 #Hide2 + @pts_subst [4,5,6,8: // |1,2,3: skip | @IHV12 /2/ ] (**) (* /4 width=6/ is too slow *) +| /4/ +| /4/ +] +qed. + +(* Basic inversion lemmas ***************************************************) + +lemma pts_inv_bind1_aux: ∀d,e,L,U1,U2. L ⊢ U1 [d, e] ≫ U2 → + ∀I,V1,T1. U1 = 𝕓{I} V1. T1 → + ∃∃V2,T2. L ⊢ V1 [d, e] ≫ V2 & + L. 𝕓{I} V1 ⊢ T1 [d + 1, e] ≫ T2 & + U2 = 𝕓{I} V2. T2. +#d #e #L #U1 #U2 * -d e L U1 U2 +[ #L #k #d #e #I #V1 #T1 #H destruct +| #L #i #d #e #I #V1 #T1 #H destruct +| #L #K #V #U1 #U2 #i #d #e #_ #_ #_ #_ #_ #I #V1 #T1 #H destruct +| #L #J #V1 #V2 #T1 #T2 #d #e #HV12 #HT12 #I #V #T #H destruct /2 width=5/ +| #L #J #V1 #V2 #T1 #T2 #d #e #_ #_ #I #V #T #H destruct +] +qed. + +lemma pts_inv_bind1: ∀d,e,L,I,V1,T1,U2. L ⊢ 𝕓{I} V1. T1 [d, e] ≫ U2 → + ∃∃V2,T2. L ⊢ V1 [d, e] ≫ V2 & + L. 𝕓{I} V1 ⊢ T1 [d + 1, e] ≫ T2 & + U2 = 𝕓{I} V2. T2. +/2/ qed. + +lemma pts_inv_flat1_aux: ∀d,e,L,U1,U2. L ⊢ U1 [d, e] ≫ U2 → + ∀I,V1,T1. U1 = 𝕗{I} V1. T1 → + ∃∃V2,T2. L ⊢ V1 [d, e] ≫ V2 & L ⊢ T1 [d, e] ≫ T2 & + U2 = 𝕗{I} V2. T2. +#d #e #L #U1 #U2 * -d e L U1 U2 +[ #L #k #d #e #I #V1 #T1 #H destruct +| #L #i #d #e #I #V1 #T1 #H destruct +| #L #K #V #U1 #U2 #i #d #e #_ #_ #_ #_ #_ #I #V1 #T1 #H destruct +| #L #J #V1 #V2 #T1 #T2 #d #e #_ #_ #I #V #T #H destruct +| #L #J #V1 #V2 #T1 #T2 #d #e #HV12 #HT12 #I #V #T #H destruct /2 width=5/ +] +qed. + +lemma pts_inv_flat1: ∀d,e,L,I,V1,T1,U2. L ⊢ 𝕗{I} V1. T1 [d, e] ≫ U2 → + ∃∃V2,T2. L ⊢ V1 [d, e] ≫ V2 & L ⊢ T1 [d, e] ≫ T2 & + U2 = 𝕗{I} V2. T2. +/2/ qed. diff --git a/matita/matita/lib/lambda-delta/substitution/pts_lift.ma b/matita/matita/lib/lambda-delta/substitution/pts_lift.ma new file mode 100644 index 000000000..9d1cdc378 --- /dev/null +++ b/matita/matita/lib/lambda-delta/substitution/pts_lift.ma @@ -0,0 +1,174 @@ +(* + ||M|| This file is part of HELM, an Hypertextual, Electronic + ||A|| Library of Mathematics, developed at the Computer Science + ||T|| Department of the University of Bologna, Italy. + ||I|| + ||T|| + ||A|| This file is distributed under the terms of the + \ / GNU General Public License Version 2 + \ / + V_______________________________________________________________ *) + +include "lambda-delta/substitution/lift_main.ma". +include "lambda-delta/substitution/drop_main.ma". +include "lambda-delta/substitution/pts_defs.ma". + +(* PARTIAL TELESCOPIC SUBSTITUTION ******************************************) + +(* Relocation properties ****************************************************) + +lemma pts_lift_le: ∀K,T1,T2,dt,et. K ⊢ T1 [dt, et] ≫ T2 → + ∀L,U1,U2,d,e. ↓[d, e] L ≡ K → + ↑[d, e] T1 ≡ U1 → ↑[d, e] T2 ≡ U2 → + dt + et ≤ d → + L ⊢ U1 [dt, et] ≫ U2. +#K #T1 #T2 #dt #et #H elim H -H K T1 T2 dt et +[ #K #k #dt #et #L #U1 #U2 #d #e #_ #H1 #H2 #_ + lapply (lift_mono … H1 … H2) -H1 H2 #H destruct -U1 // +| #K #i #dt #et #L #U1 #U2 #d #e #_ #H1 #H2 #_ + lapply (lift_mono … H1 … H2) -H1 H2 #H destruct -U1 // +| #K #KV #V #V1 #V2 #i #dt #et #Hdti #Hidet #HKV #_ #HV12 #IHV12 #L #U1 #U2 #d #e #HLK #H #HVU2 #Hdetd + lapply (lt_to_le_to_lt … Hidet … Hdetd) #Hid + lapply (lift_inv_lref1_lt … H … Hid) -H #H destruct -U1; + elim (lift_trans_ge … HV12 … HVU2 ?) -HV12 HVU2 V2 // plus_plus_comm_23 #HV1U2 + lapply (drop_trans_ge_comm … HLK … HKV ?) -HLK HKV K // -Hid #HLKV + @pts_subst [4,5: /2/ |6,7,8: // |1,2,3: skip ] (**) (* /3 width=8/ is too slow *) +| #K #I #V1 #V2 #T1 #T2 #dt #et #_ #_ #IHV12 #IHT12 #L #U1 #U2 #d #e #HLK #H1 #H2 #Hddt + elim (lift_inv_bind1 … H1) -H1 #VV1 #TT1 #HVV1 #HTT1 #H1 + elim (lift_inv_bind1 … H2) -H2 #VV2 #TT2 #HVV2 #HTT2 #H2 destruct -U1 U2; + @pts_bind [ /2 width=5/ | /3 width=5/ ] (**) (* explicit constructor *) +| #K #I #V1 #V2 #T1 #T2 #dt #et #_ #_ #IHV12 #IHT12 #L #U1 #U2 #d #e #HLK #H1 #H2 #Hddt + elim (lift_inv_flat1 … H1) -H1 #VV1 #TT1 #HVV1 #HTT1 #H1 + elim (lift_inv_flat1 … H2) -H2 #VV2 #TT2 #HVV2 #HTT2 #H2 destruct -U1 U2; + /3 width=5/ +] +qed. + +lemma pts_inv_lift1_le: ∀L,U1,U2,dt,et. L ⊢ U1 [dt, et] ≫ U2 → + ∀K,d,e. ↓[d, e] L ≡ K → ∀T1. ↑[d, e] T1 ≡ U1 → + dt + et ≤ d → + ∃∃T2. K ⊢ T1 [dt, et] ≫ T2 & ↑[d, e] T2 ≡ U2. +#L #U1 #U2 #dt #et #H elim H -H L U1 U2 dt et +[ #L #k #dt #et #K #d #e #_ #T1 #H #_ + lapply (lift_inv_sort2 … H) -H #H destruct -T1 /2/ +| #L #i #dt #et #K #d #e #_ #T1 #H #_ + elim (lift_inv_lref2 … H) -H * #Hid #H destruct -T1 /3/ +| #L #KV #V #V1 #V2 #i #dt #et #Hdti #Hidet #HLKV #_ #HV12 #IHV12 #K #d #e #HLK #T1 #H #Hdetd + lapply (lt_to_le_to_lt … Hidet … Hdetd) #Hid + lapply (lift_inv_lref2_lt … H … Hid) -H #H destruct -T1; + elim (drop_conf_lt … HLK … HLKV ?) -HLK HLKV L // #L #W #HKL #HKVL #HWV + elim (IHV12 … HKVL … HWV ?) -HKVL HWV /2/ -Hdetd #W1 #HW1 #HWV1 + elim (lift_trans_le … HWV1 … HV12 ?) -HWV1 HV12 V1 // >arith_a2 /3 width=6/ +| #L #I #V1 #V2 #U1 #U2 #dt #et #_ #_ #IHV12 #IHU12 #K #d #e #HLK #X #H #Hdetd + elim (lift_inv_bind2 … H) -H #W1 #T1 #HWV1 #HTU1 #H destruct -X; + elim (IHV12 … HLK … HWV1 ?) -IHV12 // + elim (IHU12 … HTU1 ?) -IHU12 HTU1 [3: /2/ |4: @drop_skip // |2: skip ] -HLK HWV1 Hdetd /3 width=5/ (**) (* just /3 width=5/ is too slow *) +| #L #I #V1 #V2 #U1 #U2 #dt #et #_ #_ #IHV12 #IHU12 #K #d #e #HLK #X #H #Hdetd + elim (lift_inv_flat2 … H) -H #W1 #T1 #HWV1 #HTU1 #H destruct -X; + elim (IHV12 … HLK … HWV1 ?) -IHV12 HWV1 // + elim (IHU12 … HLK … HTU1 ?) -IHU12 HLK HTU1 // /3 width=5/ +] +qed. + +lemma pts_inv_lift1_ge: ∀L,U1,U2,dt,et. L ⊢ U1 [dt, et] ≫ U2 → + ∀K,d,e. ↓[d, e] L ≡ K → ∀T1. ↑[d, e] T1 ≡ U1 → + d + e ≤ dt → + ∃∃T2. K ⊢ T1 [dt - e, et] ≫ T2 & ↑[d, e] T2 ≡ U2. +#L #U1 #U2 #dt #et #H elim H -H L U1 U2 dt et +[ #L #k #dt #et #K #d #e #_ #T1 #H #_ + lapply (lift_inv_sort2 … H) -H #H destruct -T1 /2/ +| #L #i #dt #et #K #d #e #_ #T1 #H #_ + elim (lift_inv_lref2 … H) -H * #Hid #H destruct -T1 /3/ +| #L #KV #V #V1 #V2 #i #dt #et #Hdti #Hidet #HLKV #HV1 #HV12 #_ #K #d #e #HLK #T1 #H #Hdedt + lapply (transitive_le … Hdedt … Hdti) #Hdei + lapply (plus_le_weak … Hdedt) -Hdedt #Hedt + lapply (plus_le_weak … Hdei) #Hei + <(arith_h1 ? ? ? e ? ?) in HV1 // #HV1 + lapply (lift_inv_lref2_ge … H … Hdei) -H #H destruct -T1; + lapply (drop_conf_ge … HLK … HLKV ?) -HLK HLKV L // #HKV + elim (lift_free … HV12 d (i - e + 1) ? ? ?) -HV12; [2,3,4: normalize /2/ ] -Hdei >arith_e2 // #V0 #HV10 #HV02 + @ex2_1_intro + [2: @pts_subst [4: /2/ |6,7,8: // |1,2,3: skip |5: @arith5 // ] + |1: skip + | // + ] (**) (* explicitc constructors *) +| #L #I #V1 #V2 #U1 #U2 #dt #et #_ #_ #IHV12 #IHU12 #K #d #e #HLK #X #H #Hdetd + elim (lift_inv_bind2 … H) -H #W1 #T1 #HWV1 #HTU1 #H destruct -X; + lapply (plus_le_weak … Hdetd) #Hedt + elim (IHV12 … HLK … HWV1 ?) -IHV12 // #W2 #HW12 #HWV2 + elim (IHU12 … HTU1 ?) -IHU12 HTU1 [4: @drop_skip // |2: skip |3: /2/ ] + IHV12 // >IHT12 // +| #L #I #V1 #V2 #T1 #T2 #d #e #_ #_ #IHV12 #IHT12 #X #HX + elim (lift_inv_flat2 … HX) -HX #V #T #HV1 #HT1 #H destruct -X + >IHV12 // >IHT12 // +] +qed. +(* + Theorem subst0_gen_lift_ge : (u,t1,x:?; i,h,d:?) (subst0 i u (lift h d t1) x) -> + (le (plus d h) i) -> + (EX t2 | x = (lift h d t2) & (subst0 (minus i h) u t1 t2)). + + Theorem subst0_gen_lift_rev_ge: (t1,v,u2:?; i,h,d:?) + (subst0 i v t1 (lift h d u2)) -> + (le (plus d h) i) -> + (EX u1 | (subst0 (minus i h) v u1 u2) & + t1 = (lift h d u1) + ). + + + Theorem subst0_gen_lift_rev_lelt: (t1,v,u2:?; i,h,d:?) + (subst0 i v t1 (lift h d u2)) -> + (le d i) -> (lt i (plus d h)) -> + (EX u1 | t1 = (lift (minus (plus d h) (S i)) (S i) u1)). +*) diff --git a/matita/matita/lib/lambda-delta/substitution/pts_pts.ma b/matita/matita/lib/lambda-delta/substitution/pts_pts.ma new file mode 100644 index 000000000..0461a1823 --- /dev/null +++ b/matita/matita/lib/lambda-delta/substitution/pts_pts.ma @@ -0,0 +1,47 @@ +(* + ||M|| This file is part of HELM, an Hypertextual, Electronic + ||A|| Library of Mathematics, developed at the Computer Science + ||T|| Department of the University of Bologna, Italy. + ||I|| + ||T|| + ||A|| This file is distributed under the terms of the + \ / GNU General Public License Version 2 + \ / + V_______________________________________________________________ *) + +include "lambda-delta/substitution/pts_split.ma". + +(* PARTIAL TELESCOPIC SUBSTITUTION ******************************************) + +(* Main properties **********************************************************) + +lemma pts_trans: ∀L,T1,T,d,e. L ⊢ T1 [d, e] ≫ T → ∀T2. L ⊢ T [d, e] ≫ T2 → + L ⊢ T1 [d, e] ≫ T2. +#L #T1 #T #d #e #H elim H -L T1 T d e +[ // +| // +| #L #K #V #V1 #V2 #i #d #e #Hdi #Hide #HLK #_ #HV12 #IHV12 #T2 #HVT2 + lapply (drop_fwd_drop2 … HLK) #H + elim (pts_inv_lift1_up … HVT2 … H … HV12 ? ? ?) -HVT2 H HV12 // normalize [2: /2/ ] #V #HV1 #HVT2 + @pts_subst [4,5,6,8: // |1,2,3: skip | /2/ ] +| #L #I #V1 #V2 #T1 #T2 #d #e #_ #_ #IHV12 #IHT12 #X #HX + elim (pts_inv_bind1 … HX) -HX #V #T #HV2 #HT2 #HX destruct -X; + @pts_bind /2/ @IHT12 @(pts_leq_repl … HT2) /2/ +| #L #I #V1 #V2 #T1 #T2 #d #e #_ #_ #IHV12 #IHT12 #X #HX + elim (pts_inv_flat1 … HX) -HX #V #T #HV2 #HT2 #HX destruct -X /3/ +] +qed. + +axiom pts_conf: ∀L,T0,d,e,T1. L ⊢ T0 [d, e] ≫ T1 → ∀T2. L ⊢ T0 [d, e] ≫ T2 → + ∃∃T. L ⊢ T1 [d, e] ≫ T & L ⊢ T2 [d, e] ≫ T. + +(* + Theorem subst0_subst0: (t1,t2,u2:?; j:?) (subst0 j u2 t1 t2) -> + (u1,u:?; i:?) (subst0 i u u1 u2) -> + (EX t | (subst0 j u1 t1 t) & (subst0 (S (plus i j)) u t t2)). + + Theorem subst0_subst0_back: (t1,t2,u2:?; j:?) (subst0 j u2 t1 t2) -> + (u1,u:?; i:?) (subst0 i u u2 u1) -> + (EX t | (subst0 j u1 t1 t) & (subst0 (S (plus i j)) u t2 t)). + +*) diff --git a/matita/matita/lib/lambda-delta/substitution/pts_split.ma b/matita/matita/lib/lambda-delta/substitution/pts_split.ma new file mode 100644 index 000000000..72da008ea --- /dev/null +++ b/matita/matita/lib/lambda-delta/substitution/pts_split.ma @@ -0,0 +1,58 @@ +(* + ||M|| This file is part of HELM, an Hypertextual, Electronic + ||A|| Library of Mathematics, developed at the Computer Science + ||T|| Department of the University of Bologna, Italy. + ||I|| + ||T|| + ||A|| This file is distributed under the terms of the + \ / GNU General Public License Version 2 + \ / + V_______________________________________________________________ *) + +include "lambda-delta/substitution/pts_lift.ma". + +(* PARTIAL TELESCOPIC SUBSTITUTION ******************************************) + +(* Split properties *********************************************************) + +lemma pts_split_up: ∀L,T1,T2,d,e. L ⊢ T1 [d, e] ≫ T2 → ∀i. d ≤ i → i ≤ d + e → + ∃∃T. L ⊢ T1 [d, i - d] ≫ T & L ⊢ T [i, d + e - i] ≫ T2. +#L #T1 #T2 #d #e #H elim H -L T1 T2 d e +[ /2/ +| /2/ +| #L #K #V #V1 #V2 #i #d #e #Hdi #Hide #HLK #HV1 #HV12 #IHV12 #j #Hdj #Hjde + elim (lt_or_ge i j) #Hij + [ -HV1 Hide; + lapply (drop_fwd_drop2 … HLK) #HLK' + elim (IHV12 (j - i - 1) ? ?) -IHV12; normalize /2/ -Hjde arith_b2 // #W1 #HVW1 #HWV1 + generalize in match HVW1 generalize in match Hij -HVW1 (**) (* rewriting in the premises, rewrites in the goal too *) + >(plus_minus_m_m_comm … Hdj) in ⊢ (% → % → ?) -Hdj #Hij' #HVW1 + elim (lift_total W1 0 (i + 1)) #W2 #HW12 + lapply (pts_lift_ge … HWV1 … HLK' HW12 HV12 ?) -HWV1 HLK' HV12 // >arith_a2 /3 width=6/ + | -IHV12 Hdi Hdj; + generalize in match HV1 generalize in match Hide -HV1 Hide (**) (* rewriting in the premises, rewrites in the goal too *) + >(plus_minus_m_m_comm … Hjde) in ⊢ (% → % → ?) -Hjde #Hide #HV1 + @ex2_1_intro [2: @pts_lref |1: skip | /2 width=6/ ] (**) (* /3 width=6 is too slow *) + ] +| #L #I #V1 #V2 #T1 #T2 #d #e #_ #_ #IHV12 #IHT12 #i #Hdi #Hide + elim (IHV12 i ? ?) -IHV12 // #V #HV1 #HV2 + elim (IHT12 (i + 1) ? ?) -IHT12 [2: /2 by arith4/ |3: /2/ ] (* just /2/ is too slow *) + -Hdi Hide >arith_c1 >arith_c1x #T #HT1 #HT2 + @ex2_1_intro [2,3: @pts_bind | skip ] (**) (* explicit constructors *) + [3: @HV1 |4: @HT1 |5: // |1,2: skip | /3 width=5/ ] +| #L #I #V1 #V2 #T1 #T2 #d #e #_ #_ #IHV12 #IHT12 #i #Hdi #Hide + elim (IHV12 i ? ?) -IHV12 // elim (IHT12 i ? ?) -IHT12 // + -Hdi Hide /3 width=5/ +] +qed. + +lemma pts_inv_lift1_up: ∀L,U1,U2,dt,et. L ⊢ U1 [dt, et] ≫ U2 → + ∀K,d,e. ↓[d, e] L ≡ K → ∀T1. ↑[d, e] T1 ≡ U1 → + d ≤ dt → dt ≤ d + e → d + e ≤ dt + et → + ∃∃T2. K ⊢ T1 [d, dt + et - (d + e)] ≫ T2 & ↑[d, e] T2 ≡ U2. +#L #U1 #U2 #dt #et #HU12 #K #d #e #HLK #T1 #HTU1 #Hddt #Hdtde #Hdedet +elim (pts_split_up … HU12 (d + e) ? ?) -HU12 // -Hdedet #U #HU1 #HU2 +lapply (pts_weak … HU1 d e ? ?) -HU1 // 7 6 3 4 + 3 diff --git a/matita/matita/lib/lambda-delta/xoa_defs.ma b/matita/matita/lib/lambda-delta/xoa_defs.ma index 68a0776dc..582b2d25f 100644 --- a/matita/matita/lib/lambda-delta/xoa_defs.ma +++ b/matita/matita/lib/lambda-delta/xoa_defs.ma @@ -125,3 +125,11 @@ inductive or4 (P0,P1,P2,P3:Prop) : Prop ≝ interpretation "multiple disjunction connective (4)" 'Or P0 P1 P2 P3 = (or4 P0 P1 P2 P3). +(* multiple conjunction connective (3) *) + +inductive and3 (P0,P1,P2:Prop) : Prop ≝ + | and3_intro: P0 → P1 → P2 → and3 ? ? ? +. + +interpretation "multiple conjunction connective (3)" 'And P0 P1 P2 = (and3 P0 P1 P2). + diff --git a/matita/matita/lib/lambda-delta/xoa_notation.ma b/matita/matita/lib/lambda-delta/xoa_notation.ma index b8270b660..ce9460eb6 100644 --- a/matita/matita/lib/lambda-delta/xoa_notation.ma +++ b/matita/matita/lib/lambda-delta/xoa_notation.ma @@ -136,3 +136,9 @@ notation "hvbox(∨∨ term 29 P0 break | term 29 P1 break | term 29 P2 break | non associative with precedence 30 for @{ 'Or $P0 $P1 $P2 $P3 }. +(* multiple conjunction connective (3) *) + +notation "hvbox(∧∧ term 34 P0 break & term 34 P1 break & term 34 P2)" + non associative with precedence 35 + for @{ 'And $P0 $P1 $P2 }. + -- 2.39.2