]> matita.cs.unibo.it Git - helm.git/commitdiff
refactoring ...
authorFerruccio Guidi <ferruccio.guidi@unibo.it>
Mon, 10 Oct 2011 17:39:08 +0000 (17:39 +0000)
committerFerruccio Guidi <ferruccio.guidi@unibo.it>
Mon, 10 Oct 2011 17:39:08 +0000 (17:39 +0000)
54 files changed:
matita/matita/contribs/lambda_delta/Basic_2/Basic-1.txt [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/grammar/cl_shift.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/grammar/cl_weight.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/grammar/item.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/grammar/lenv.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/grammar/lenv_length.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/grammar/lenv_weight.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/grammar/leq.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/grammar/sh.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/grammar/term.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/grammar/term_simple.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/grammar/term_weight.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/grammar/thom.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/names.txt [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/notation.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/reduction/cpr.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/reduction/cpr_cpr.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/reduction/cpr_lift.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/reduction/lcpr.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/reduction/ltpr.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/reduction/ltpr_drop.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/reduction/tpr.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/reduction/tpr_lift.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/reduction/tpr_tpr.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/reduction/tpr_tps.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/substitution/drop.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/substitution/drop_drop.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/substitution/lift.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/substitution/lift_lift.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/substitution/ltps.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/substitution/ltps_drop.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/substitution/ltps_tps.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/substitution/tps.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/substitution/tps_lift.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/substitution/tps_tps.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/unfold/ltpss.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/unfold/ltpss_drop.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/unfold/ltpss_ltpss.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/unfold/ltpss_tpss.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/unfold/tpss.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/unfold/tpss_lift.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/unfold/tpss_ltps.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Basic_2/unfold/tpss_tpss.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Ground_2/arith.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Ground_2/list.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Ground_2/notation.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Ground_2/star.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Ground_2/xoa.conf.xml [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Ground_2/xoa.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Ground_2/xoa_notation.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Ground_2/xoa_props.ma [new file with mode: 0644]
matita/matita/contribs/lambda_delta/Makefile [new file with mode: 0644]
matita/matita/contribs/lambda_delta/replace.sh [new file with mode: 0644]
matita/matita/contribs/lambda_delta/root [new file with mode: 0644]

diff --git a/matita/matita/contribs/lambda_delta/Basic_2/Basic-1.txt b/matita/matita/contribs/lambda_delta/Basic_2/Basic-1.txt
new file mode 100644 (file)
index 0000000..b458704
--- /dev/null
@@ -0,0 +1,468 @@
+# waiting ####################################################################
+
+aplus/props aplus_reg_r
+aplus/props aplus_assoc
+aplus/props aplus_asucc
+aplus/props aplus_sort_O_S_simpl
+aplus/props aplus_sort_S_S_simpl
+aplus/props aplus_asort_O_simpl
+aplus/props aplus_asort_le_simpl
+aplus/props aplus_asort_simpl
+aplus/props aplus_ahead_simpl
+aplus/props aplus_asucc_false
+aplus/props aplus_inj
+aprem/fwd aprem_gen_sort
+aprem/fwd aprem_gen_head_O
+aprem/fwd aprem_gen_head_S
+aprem/props aprem_repl
+aprem/props aprem_asucc
+arity/aprem arity_aprem
+arity/cimp arity_cimp_conf
+arity/fwd arity_gen_sort
+arity/fwd arity_gen_lref
+arity/fwd arity_gen_bind
+arity/fwd arity_gen_abst
+arity/fwd arity_gen_appl
+arity/fwd arity_gen_cast
+arity/fwd arity_gen_appls
+arity/fwd arity_gen_lift
+arity/lift1 arity_lift1
+arity/pr3 arity_sred_wcpr0_pr0
+arity/pr3 arity_sred_wcpr0_pr1
+arity/pr3 arity_sred_pr2
+arity/pr3 arity_sred_pr3
+arity/props node_inh
+arity/props arity_lift
+arity/props arity_mono
+arity/props arity_repellent
+arity/props arity_appls_cast
+arity/props arity_appls_abbr
+arity/props arity_appls_bind
+arity/subst0 arity_gen_cvoid_subst0
+arity/subst0 arity_gen_cvoid
+arity/subst0 arity_fsubst0
+arity/subst0 arity_subst0
+asucc/fwd asucc_gen_sort
+asucc/fwd asucc_gen_head
+cnt/props cnt_lift
+C/props clt_wf__q_ind
+C/props clt_wf_ind
+C/props chead_ctail
+C/props clt_thead (ctail)
+C/props c_tail_ind
+csuba/arity csuba_arity
+csuba/arity csuba_arity_rev
+csuba/arity arity_appls_appl
+csuba/clear csuba_clear_conf
+csuba/clear csuba_clear_trans
+csuba/drop csuba_drop_abbr
+csuba/drop csuba_drop_abst
+csuba/drop csuba_drop_abst_rev
+csuba/drop csuba_drop_abbr_rev
+csuba/fwd csuba_gen_abbr
+csuba/fwd csuba_gen_void
+csuba/fwd csuba_gen_abst
+csuba/fwd csuba_gen_flat
+csuba/fwd csuba_gen_bind
+csuba/fwd csuba_gen_abst_rev
+csuba/fwd csuba_gen_void_rev
+csuba/fwd csuba_gen_abbr_rev
+csuba/fwd csuba_gen_flat_rev
+csuba/fwd csuba_gen_bind_rev
+csuba/getl csuba_getl_abbr
+csuba/getl csuba_getl_abst
+csuba/getl csuba_getl_abst_rev
+csuba/getl csuba_getl_abbr_rev
+csuba/props csuba_refl
+csubc/arity csubc_arity_conf
+csubc/arity csubc_arity_trans
+csubc/clear csubc_clear_conf
+csubc/csuba csubc_csuba
+csubc/drop1 drop1_csubc_trans
+csubc/drop1 csubc_drop1_conf_rev
+csubc/drop csubc_drop_conf_O
+csubc/drop drop_csubc_trans
+csubc/drop csubc_drop_conf_rev
+csubc/fwd csubc_gen_sort_l
+csubc/fwd csubc_gen_head_l
+csubc/fwd csubc_gen_sort_r
+csubc/fwd csubc_gen_head_r
+csubc/getl csubc_getl_conf
+csubc/props csubc_refl
+csubt/clear csubt_clear_conf
+csubt/csuba csubt_csuba
+csubt/drop csubt_drop_flat
+csubt/drop csubt_drop_abbr
+csubt/drop csubt_drop_abst
+csubt/fwd csubt_gen_abbr
+csubt/fwd csubt_gen_abst
+csubt/fwd csubt_gen_flat
+csubt/fwd csubt_gen_bind
+csubt/getl csubt_getl_abbr
+csubt/getl csubt_getl_abst
+csubt/pc3 csubt_pr2
+csubt/pc3 csubt_pc3
+csubt/props csubt_refl
+csubt/ty3 csubt_ty3
+csubt/ty3 csubt_ty3_ld
+csubv/clear csubv_clear_conf
+csubv/clear csubv_clear_conf_void
+csubv/drop csubv_drop_conf
+csubv/getl csubv_getl_conf
+csubv/getl csubv_getl_conf_void
+csubv/props csubv_bind_same
+csubv/props csubv_refl
+drop1/fwd drop1_gen_pnil
+drop1/fwd drop1_gen_pcons
+drop1/getl drop1_getl_trans
+drop1/props drop1_skip_bind
+drop1/props drop1_cons_tail
+drop1/props drop1_trans
+drop/props drop_ctail
+ex0/props aplus_gz_le
+ex0/props aplus_gz_ge
+ex0/props next_plus_gz
+ex0/props leqz_leq
+ex0/props leq_leqz
+ex1/props ex1__leq_sort_SS
+ex1/props ex1_arity
+ex1/props ex1_ty3
+ex2/props ex2_nf2
+ex2/props ex2_arity
+fsubst0/fwd fsubst0_gen_base
+leq/asucc asucc_repl
+leq/asucc asucc_inj
+leq/asucc leq_asucc
+leq/asucc leq_ahead_asucc_false
+leq/asucc leq_asucc_false
+leq/fwd leq_gen_sort1
+leq/fwd leq_gen_head1
+leq/fwd leq_gen_sort2
+leq/fwd leq_gen_head2
+leq/props ahead_inj_snd
+leq/props leq_refl
+leq/props leq_eq
+leq/props leq_sym
+leq/props leq_trans
+leq/props leq_ahead_false_1
+leq/props leq_ahead_false_2
+lift1/fwd lift1_sort
+lift1/fwd lift1_lref
+lift1/fwd lift1_bind
+lift1/fwd lift1_flat
+lift1/fwd lift1_cons_tail
+lift1/fwd lifts1_flat
+lift1/fwd lifts1_nil
+lift1/fwd lifts1_cons
+lift1/props lift1_lift1
+lift1/props lift1_xhg
+lift1/props lifts1_xhg
+lift1/props lift1_free
+lift/props thead_x_lift_y_y
+lift/props lifts_tapp
+lift/props lifts_inj
+llt/props lweight_repl
+llt/props llt_repl
+llt/props llt_trans
+llt/props llt_head_sx
+llt/props llt_head_dx
+llt/props llt_wf__q_ind
+llt/props llt_wf_ind
+next_plus/props next_plus_assoc
+next_plus/props next_plus_next
+next_plus/props next_plus_lt
+nf2/arity arity_nf2_inv_all
+nf2/dec nf2_dec
+nf2/fwd nf2_gen_lref
+nf2/fwd nf2_gen_abst
+nf2/fwd nf2_gen_cast
+nf2/fwd nf2_gen_beta
+nf2/fwd nf2_gen_flat
+nf2/fwd nf2_gen__nf2_gen_aux
+nf2/fwd nf2_gen_abbr
+nf2/fwd nf2_gen_void
+nf2/iso nf2_iso_appls_lref
+nf2/lift1 nf2_lift1
+nf2/pr3 nf2_pr3_unfold
+nf2/pr3 nf2_pr3_confluence
+nf2/props nf2_sort
+nf2/props nf2_csort_lref
+nf2/props nf2_abst
+nf2/props nf2_abst_shift
+nf2/props nfs2_tapp
+nf2/props nf2_appls_lref
+nf2/props nf2_appl_lref
+nf2/props nf2_lref_abst
+nf2/props nf2_lift
+pc1/props pc1_pr0_r
+pc1/props pc1_pr0_x
+pc1/props pc1_refl
+pc1/props pc1_pr0_u
+pc1/props pc1_s
+pc1/props pc1_head_1
+pc1/props pc1_head_2
+pc1/props pc1_t
+pc1/props pc1_pr0_u2
+pc1/props pc1_head
+pc3/dec pc3_dec
+pc3/dec pc3_abst_dec
+pc3/fsubst0 pc3_pr2_fsubst0
+pc3/fsubst0 pc3_pr2_fsubst0_back
+pc3/fsubst0 pc3_fsubst0
+pc3/fwd pc3_gen_sort
+pc3/fwd pc3_gen_abst
+pc3/fwd pc3_gen_abst_shift
+pc3/fwd pc3_gen_lift
+pc3/fwd pc3_gen_not_abst
+pc3/fwd pc3_gen_lift_abst
+pc3/fwd pc3_gen_sort_abst
+pc3/left pc3_ind_left__pc3_left_pr3
+pc3/left pc3_ind_left__pc3_left_trans
+pc3/left pc3_ind_left__pc3_left_sym
+pc3/left pc3_ind_left__pc3_left_pc3
+pc3/left pc3_ind_left__pc3_pc3_left
+pc3/left pc3_ind_left
+pc3/nf2 pc3_nf2
+pc3/nf2 pc3_nf2_unfold
+pc3/pc1 pc3_pc1
+pc3/props clear_pc3_trans
+pc3/props pc3_pr2_r
+pc3/props pc3_pr2_x
+pc3/props pc3_pr3_r
+pc3/props pc3_pr3_x
+pc3/props pc3_pr3_t
+pc3/props pc3_refl
+pc3/props pc3_s
+pc3/props pc3_thin_dx
+pc3/props pc3_head_1
+pc3/props pc3_head_2
+pc3/props pc3_pr2_u
+pc3/props pc3_t
+pc3/props pc3_pr2_u2
+pc3/props pc3_pr3_conf
+pc3/props pc3_head_12
+pc3/props pc3_head_21
+pc3/props pc3_pr0_pr2_t
+pc3/props pc3_pr2_pr2_t
+pc3/props pc3_pr2_pr3_t
+pc3/props pc3_pr3_pc3_t
+pc3/props pc3_lift
+pc3/props pc3_eta
+pc3/subst1 pc3_gen_cabbr
+pc3/wcpr0 pc3_wcpr0__pc3_wcpr0_t_aux
+pc3/wcpr0 pc3_wcpr0_t
+pc3/wcpr0 pc3_wcpr0
+pr0/fwd pr0_gen_void
+pr0/dec nf0_dec
+pr0/subst1 pr0_subst1_back
+pr0/subst1 pr0_subst1_fwd
+pr1/pr1 pr1_strip
+pr1/pr1 pr1_confluence
+pr1/props pr1_pr0
+pr1/props pr1_t
+pr1/props pr1_head_1
+pr1/props pr1_head_2
+pr1/props pr1_comp
+pr1/props pr1_eta
+pr2/clen pr2_gen_ctail
+
+# check ######################################################################
+
+pr2/fwd pr2_gen_void
+pr2/props pr2_ctail
+
+
+# waiting ####################################################################
+
+pr3/fwd pr3_gen_sort
+pr3/fwd pr3_gen_abst
+pr3/fwd pr3_gen_cast
+pr3/fwd pr3_gen_lift
+pr3/fwd pr3_gen_lref
+pr3/fwd pr3_gen_void
+pr3/fwd pr3_gen_abbr
+pr3/fwd pr3_gen_appl
+pr3/fwd pr3_gen_bind
+pr3/iso pr3_iso_appls_abbr
+pr3/iso pr3_iso_appls_cast
+pr3/iso pr3_iso_appl_bind
+pr3/iso pr3_iso_appls_appl_bind
+pr3/iso pr3_iso_appls_bind
+pr3/iso pr3_iso_beta
+pr3/iso pr3_iso_appls_beta
+pr3/pr1 pr3_pr1
+pr3/pr3 pr3_strip
+pr3/pr3 pr3_confluence
+pr3/props clear_pr3_trans
+pr3/props pr3_pr2
+pr3/props pr3_t
+pr3/props pr3_thin_dx
+pr3/props pr3_head_1
+pr3/props pr3_head_2
+pr3/props pr3_head_21
+pr3/props pr3_head_12
+pr3/props pr3_cflat
+pr3/props pr3_flat
+pr3/props pr3_pr0_pr2_t
+pr3/props pr3_pr2_pr2_t
+pr3/props pr3_pr2_pr3_t
+pr3/props pr3_pr3_pr3_t
+pr3/props pr3_lift
+pr3/props pr3_eta
+pr3/subst1 pr3_subst1
+pr3/subst1 pr3_gen_cabbr
+pr3/wcpr0 pr3_wcpr0_t
+sc3/arity sc3_arity_csubc
+sc3/arity sc3_arity
+sc3/props sc3_arity_gen
+sc3/props sc3_repl
+sc3/props sc3_lift
+sc3/props sc3_lift1
+sc3/props sc3_abbr
+sc3/props sc3_cast
+sc3/props sc3_props__sc3_sn3_abst
+sc3/props sc3_sn3
+sc3/props sc3_abst
+sc3/props sc3_bind
+sc3/props sc3_appl
+sn3/fwd sn3_gen_bind
+sn3/fwd sn3_gen_flat
+sn3/fwd sn3_gen_head
+sn3/fwd sn3_gen_cflat
+sn3/fwd sn3_gen_lift
+sn3/lift1 sns3_lifts1
+sn3/nf2 sn3_nf2
+sn3/nf2 nf2_sn3
+sn3/props sn3_pr3_trans
+sn3/props sn3_pr2_intro
+sn3/props sn3_cast
+sn3/props sn3_cflat
+sn3/props sn3_shift
+sn3/props sn3_change
+sn3/props sn3_gen_def
+sn3/props sn3_cdelta
+sn3/props sn3_cpr3_trans
+sn3/props sn3_bind
+sn3/props sn3_beta
+sn3/props sn3_appl_lref
+sn3/props sn3_appl_abbr
+sn3/props sn3_appl_cast
+sn3/props sn3_appl_bind
+sn3/props sn3_appl_appl
+sn3/props sn3_appl_beta
+sn3/props sn3_appl_appls
+sn3/props sn3_appls_lref
+sn3/props sn3_appls_cast
+sn3/props sn3_appls_bind
+sn3/props sn3_appls_beta
+sn3/props sn3_lift
+sn3/props sn3_abbr
+sn3/props sn3_appls_abbr
+sn3/props sns3_lifts
+sty0/fwd sty0_gen_sort
+sty0/fwd sty0_gen_lref
+sty0/fwd sty0_gen_bind
+sty0/fwd sty0_gen_appl
+sty0/fwd sty0_gen_cast
+sty0/props sty0_lift
+sty0/props sty0_correct
+sty1/cnt sty1_cnt
+sty1/props sty1_trans
+sty1/props sty1_bind
+sty1/props sty1_appl
+sty1/props sty1_lift
+sty1/props sty1_correct
+sty1/props sty1_abbr
+sty1/props sty1_cast2
+subst0/dec dnf_dec2
+subst0/dec dnf_dec
+subst1/props subst1_ex
+subst/fwd subst_sort
+subst/fwd subst_lref_lt
+subst/fwd subst_lref_eq
+subst/fwd subst_lref_gt
+subst/fwd subst_head
+subst/props subst_lift_SO
+subst/props subst_subst0
+T/dec terms_props__bind_dec
+T/dec bind_dec_not
+T/dec terms_props__flat_dec
+T/dec terms_props__kind_dec
+T/dec term_dec
+T/dec binder_dec
+T/dec abst_dec
+tlist/props tslt_wf__q_ind
+tlist/props tslt_wf_ind
+tlist/props theads_tapp
+tlist/props tcons_tapp_ex
+tlist/props tlist_ind_rev
+T/props not_abbr_abst
+T/props not_void_abst
+T/props not_abbr_void
+T/props not_abst_void
+T/props thead_x_y_y
+T/props tweight_lt
+ty3/arity ty3_arity
+ty3/arity_props ty3_predicative
+ty3/arity_props ty3_repellent
+ty3/arity_props ty3_acyclic
+ty3/arity_props ty3_sn3
+ty3/dec ty3_inference
+ty3/fsubst0 ty3_fsubst0
+ty3/fsubst0 ty3_csubst0
+ty3/fsubst0 ty3_subst0
+ty3/fwd ty3_gen_sort
+ty3/fwd ty3_gen_lref
+ty3/fwd ty3_gen_bind
+ty3/fwd ty3_gen_appl
+ty3/fwd ty3_gen_cast
+ty3/fwd tys3_gen_nil
+ty3/fwd tys3_gen_cons
+ty3/fwd_nf2 ty3_gen_appl_nf2
+ty3/fwd_nf2 ty3_inv_lref_nf2_pc3
+ty3/fwd_nf2 ty3_inv_lref_nf2
+ty3/fwd_nf2 ty3_inv_appls_lref_nf2
+ty3/fwd_nf2 ty3_inv_lref_lref_nf2
+ty3/nf2 ty3_nf2_inv_abst_premise_csort
+ty3/nf2 ty3_nf2_inv_all
+ty3/nf2 ty3_nf2_inv_sort
+ty3/nf2 ty3_nf2_gen__ty3_nf2_inv_abst_aux
+ty3/nf2 ty3_nf2_inv_abst
+ty3/pr3 ty3_sred_wcpr0_pr0
+ty3/pr3 ty3_sred_pr0
+ty3/pr3 ty3_sred_pr1
+ty3/pr3 ty3_sred_pr2
+ty3/pr3 ty3_sred_pr3
+ty3/pr3_props ty3_cred_pr2
+ty3/pr3_props ty3_cred_pr3
+ty3/pr3_props ty3_gen_lift
+ty3/pr3_props ty3_tred
+ty3/pr3_props ty3_sconv_pc3
+ty3/pr3_props ty3_sred_back
+ty3/pr3_props ty3_sconv
+ty3/props ty3_lift
+ty3/props ty3_correct
+ty3/props ty3_unique
+ty3/props ty3_gen_abst_abst
+ty3/props ty3_typecheck
+ty3/props ty3_getl_subst0
+ty3/sty0 ty3_sty0
+ty3/subst1 ty3_gen_cabbr
+ty3/subst1 ty3_gen_cvoid
+wf3/clear wf3_clear_conf
+wf3/clear clear_wf3_trans
+wf3/fwd wf3_gen_sort1
+wf3/fwd wf3_gen_bind1
+wf3/fwd wf3_gen_flat1
+wf3/fwd wf3_gen_head2
+wf3/getl wf3_getl_conf
+wf3/getl getl_wf3_trans
+wf3/props wf3_mono
+wf3/props wf3_total
+wf3/props ty3_shift1
+wf3/props wf3_idem
+wf3/props wf3_ty3
+wf3/ty3 wf3_pr2_conf
+wf3/ty3 wf3_pr3_conf
+wf3/ty3 wf3_pc3_conf
+wf3/ty3 wf3_ty3_conf
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/grammar/cl_shift.ma b/matita/matita/contribs/lambda_delta/Basic_2/grammar/cl_shift.ma
new file mode 100644 (file)
index 0000000..d72b6c4
--- /dev/null
@@ -0,0 +1,24 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "Basic-2/grammar/lenv.ma".
+
+(* SHIFT OF A CLOSURE *******************************************************)
+
+let rec shift L T on L ≝ match L with
+[ LAtom       ⇒ T
+| LPair L I V ⇒ shift L (𝕓{I} V. T)
+].
+
+interpretation "shift (closure)" 'Append L T = (shift L T).
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/grammar/cl_weight.ma b/matita/matita/contribs/lambda_delta/Basic_2/grammar/cl_weight.ma
new file mode 100644 (file)
index 0000000..35bf32a
--- /dev/null
@@ -0,0 +1,46 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "Basic-2/grammar/lenv_weight.ma".
+include "Basic-2/grammar/cl_shift.ma".
+
+(* WEIGHT OF A CLOSURE ******************************************************)
+
+definition cw: lenv → term → ? ≝ λL,T. #[L] + #[T].
+
+interpretation "weight (closure)" 'Weight L T = (cw L T).
+
+(* Basic properties *********************************************************)
+
+(* Basic-1: was: flt_wf__q_ind *)
+
+(* Basic-1: was: flt_wf_ind *)
+axiom cw_wf_ind: ∀R:lenv→term→Prop.
+                 (∀L2,T2. (∀L1,T1. #[L1,T1] < #[L2,T2] → R L1 T1) → R L2 T2) →
+                 ∀L,T. R L T.
+
+(* Basic-1: was: flt_shift *)
+lemma cw_shift: ∀K,I,V,T. #[K. 𝕓{I} V, T] < #[K, 𝕔{I} V. T].
+normalize //
+qed.
+
+lemma tw_shift: ∀L,T. #[L, T] ≤ #[L @ T].
+#L elim L //
+#K #I #V #IHL #T
+@transitive_le [3: @IHL |2: /2/ | skip ]
+qed.
+
+(* Basic-1: removed theorems 6:
+            flt_thead_sx flt_thead_dx flt_arith0 flt_arith1 flt_arith2 flt_trans
+*)
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/grammar/item.ma b/matita/matita/contribs/lambda_delta/Basic_2/grammar/item.ma
new file mode 100644 (file)
index 0000000..ead47b5
--- /dev/null
@@ -0,0 +1,61 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+(* THE FORMAL SYSTEM λδ - MATITA SOURCE FILES
+ * Specification started: 2011 April 17
+ * Confluence of context-sensitive parallel reduction closed: 2011 September 21
+ * Confluence of context-free parallel reduction closed: 2011 September 6
+ * - Patience on me so that I gain peace and perfection! -
+ * [ suggested invocation to start formal specifications with ]
+ *)
+
+include "Ground-2/list.ma".
+include "Ground-2/star.ma".
+include "Basic-2/notation.ma".
+
+(* ITEMS ********************************************************************)
+
+(* atomic items *)
+inductive item0: Type[0] ≝
+   | Sort: nat → item0 (* sort: starting at 0 *)
+   | LRef: nat → item0 (* reference by index: starting at 0 *)
+.
+
+(* binary binding items *)
+inductive bind2: Type[0] ≝
+  | Abbr: bind2 (* abbreviation *)
+  | Abst: bind2 (* abstraction *)
+.
+
+(* binary non-binding items *)
+inductive flat2: Type[0] ≝
+  | Appl: flat2 (* application *)
+  | Cast: flat2 (* explicit type annotation *)
+.
+
+(* binary items *)
+inductive item2: Type[0] ≝
+  | Bind: bind2 → item2 (* binding item *)
+  | Flat: flat2 → item2 (* non-binding item *)
+.
+
+coercion item2_of_bind2: ∀I:bind2.item2 ≝ Bind on _I:bind2 to item2.
+
+coercion item2_of_flat2: ∀I:flat2.item2 ≝ Flat on _I:flat2 to item2.
+
+(* Basic-1: removed theorems 19:
+            s_S s_plus s_plus_sym s_minus minus_s_s s_le s_lt s_inj s_inc
+            s_arith0 s_arith1
+            r_S r_plus r_plus_sym r_minus r_dis s_r r_arith0 r_arith1
+*)
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/grammar/lenv.ma b/matita/matita/contribs/lambda_delta/Basic_2/grammar/lenv.ma
new file mode 100644 (file)
index 0000000..dfec098
--- /dev/null
@@ -0,0 +1,27 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "Basic-2/grammar/term.ma".
+
+(* LOCAL ENVIRONMENTS *******************************************************)
+
+(* local environments *)
+inductive lenv: Type[0] ≝
+| LAtom: lenv                       (* empty *)
+| LPair: lenv → bind2 → term → lenv (* binary binding construction *)
+.
+
+interpretation "sort (local environment)" 'Star = LAtom.
+
+interpretation "environment binding construction (binary)" 'DBind L I T = (LPair L I T).
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/grammar/lenv_length.ma b/matita/matita/contribs/lambda_delta/Basic_2/grammar/lenv_length.ma
new file mode 100644 (file)
index 0000000..23e4459
--- /dev/null
@@ -0,0 +1,24 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "Basic-2/grammar/lenv.ma".
+
+(* LENGTH OF A LOCAL ENVIRONMENT ********************************************)
+
+let rec length L ≝ match L with
+[ LAtom       ⇒ 0
+| LPair L _ _ ⇒ length L + 1
+].
+
+interpretation "length (local environment)" 'card L = (length L).
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/grammar/lenv_weight.ma b/matita/matita/contribs/lambda_delta/Basic_2/grammar/lenv_weight.ma
new file mode 100644 (file)
index 0000000..9f45673
--- /dev/null
@@ -0,0 +1,27 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "Basic-2/grammar/term_weight.ma".
+include "Basic-2/grammar/lenv.ma".
+
+(* WEIGHT OF A LOCAL ENVIRONMENT ********************************************)
+
+let rec lw L ≝ match L with
+[ LAtom       ⇒ 0
+| LPair L _ V ⇒ lw L + #[V]
+].
+
+interpretation "weight (local environment)" 'Weight L = (lw L).
+
+(* Basic-1: removed theorems 2: clt_cong clt_head *)
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/grammar/leq.ma b/matita/matita/contribs/lambda_delta/Basic_2/grammar/leq.ma
new file mode 100644 (file)
index 0000000..ac5503d
--- /dev/null
@@ -0,0 +1,61 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "Basic-2/grammar/lenv_length.ma".
+
+(* LOCAL ENVIRONMENT EQUALITY ***********************************************)
+
+inductive leq: nat → nat → relation lenv ≝
+| leq_sort: ∀d,e. leq d e (⋆) (⋆)
+| leq_OO:   ∀L1,L2. leq 0 0 L1 L2
+| leq_eq:   ∀L1,L2,I,V,e. leq 0 e L1 L2 →
+            leq 0 (e + 1) (L1. 𝕓{I} V) (L2.𝕓{I} V)
+| leq_skip: ∀L1,L2,I1,I2,V1,V2,d,e.
+            leq d e L1 L2 → leq (d + 1) e (L1. 𝕓{I1} V1) (L2. 𝕓{I2} V2)
+.
+
+interpretation "local environment equality" 'Eq L1 d e L2 = (leq d e L1 L2).
+
+definition leq_repl_dx: ∀S. (lenv → relation S) → Prop ≝ λS,R.
+                        ∀L1,s1,s2. R L1 s1 s2 →
+                        ∀L2,d,e. L1 [d, e]≈ L2 → R L2 s1 s2.
+
+(* Basic properties *********************************************************)
+
+lemma TC_leq_repl_dx: ∀S,R. leq_repl_dx S R → leq_repl_dx S (λL. (TC … (R L))).
+#S #R #HR #L1 #s1 #s2 #H elim H -H s2
+[ /3 width=5/
+| #s #s2 #_ #Hs2 #IHs1 #L2 #d #e #HL12
+  lapply (HR … Hs2 … HL12) -HR Hs2 HL12 /3/
+]
+qed.
+
+lemma leq_refl: ∀d,e,L. L [d, e] ≈ L.
+#d elim d -d
+[ #e elim e -e // #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. 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 ***************************************************)
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/grammar/sh.ma b/matita/matita/contribs/lambda_delta/Basic_2/grammar/sh.ma
new file mode 100644 (file)
index 0000000..bec437a
--- /dev/null
@@ -0,0 +1,23 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "Ground-2/list.ma".
+
+(* SORT HIERARCHY ***********************************************************)
+
+(* sort hierarchy specifications *)
+record sh: Type[0] ≝ {
+   next: nat → nat;        (* next sort in the hierarchy *)
+   next_lt: ∀k. k < next k (* strict monotonicity condition *)
+}.
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/grammar/term.ma b/matita/matita/contribs/lambda_delta/Basic_2/grammar/term.ma
new file mode 100644 (file)
index 0000000..3b66143
--- /dev/null
@@ -0,0 +1,35 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "Basic-2/grammar/item.ma".
+
+(* TERMS ********************************************************************)
+
+(* terms *)
+inductive term: Type[0] ≝
+  | TAtom: item0 → term               (* atomic item construction *)
+  | TPair: item2 → term → term → term (* binary item construction *)
+.
+
+interpretation "sort (term)" 'Star k = (TAtom (Sort k)).
+
+interpretation "local reference (term)" 'LRef i = (TAtom (LRef i)).
+
+interpretation "term construction (atomic)" 'SItem I = (TAtom I).
+
+interpretation "term construction (binary)" 'SItem I T1 T2 = (TPair I T1 T2).
+
+interpretation "term binding construction (binary)" 'SBind I T1 T2 = (TPair (Bind I) T1 T2).
+
+interpretation "term flat construction (binary)" 'SFlat I T1 T2 = (TPair (Flat I) T1 T2).
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/grammar/term_simple.ma b/matita/matita/contribs/lambda_delta/Basic_2/grammar/term_simple.ma
new file mode 100644 (file)
index 0000000..c182ba3
--- /dev/null
@@ -0,0 +1,36 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "Basic-2/grammar/term.ma".
+
+(* SIMPLE (NEUTRAL) TERMS ***************************************************)
+
+inductive simple: term → Prop ≝
+   | simple_atom: ∀I. simple (𝕒{I})
+   | simple_flat: ∀I,V,T. simple (𝕗{I} V. T)
+.
+
+interpretation "simple (term)" 'Simple T = (simple T).
+
+(* Basic inversion lemmas ***************************************************)
+
+fact simple_inv_bind_aux: ∀T. 𝕊[T] → ∀J,W,U. T = 𝕓{J} W. U → False.
+#T * -T
+[ #I #J #W #U #H destruct
+| #I #V #T #J #W #U #H destruct
+]
+qed.
+
+lemma simple_inv_bind: ∀I,V,T. 𝕊[𝕓{I} V. T] → False.
+/2 width=6/ qed.
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/grammar/term_weight.ma b/matita/matita/contribs/lambda_delta/Basic_2/grammar/term_weight.ma
new file mode 100644 (file)
index 0000000..d383ded
--- /dev/null
@@ -0,0 +1,42 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "Basic-2/grammar/term.ma".
+
+(* WEIGHT OF A TERM *********************************************************)
+
+let rec tw T ≝ match T with
+[ TAtom _     ⇒ 1
+| TPair _ V T ⇒ tw V + tw T + 1
+].
+
+interpretation "weight (term)" 'Weight T = (tw T).
+
+(* Basic properties *********************************************************)
+
+lemma tw_pos: ∀T. 1 ≤ #[T].
+#T elim T -T /2/ 
+qed.
+
+(* Basic eliminators ********************************************************)
+
+axiom tw_wf_ind: ∀R:term→Prop.
+                 (∀T2. (∀T1. #[T1] < #[T2] → R T1) → R T2) →
+                 ∀T. R T.
+
+(* Basic-1: removed theorems 11:
+            wadd_le wadd_lt wadd_O weight_le weight_eq weight_add_O
+           weight_add_S tlt_trans tlt_head_sx tlt_head_dx tlt_wf_ind
+            removed local theorems 1: q_ind
+*)
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/grammar/thom.ma b/matita/matita/contribs/lambda_delta/Basic_2/grammar/thom.ma
new file mode 100644 (file)
index 0000000..23aa62e
--- /dev/null
@@ -0,0 +1,56 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "Basic-2/grammar/term_simple.ma".
+
+(* HOMOMORPHIC TERMS ********************************************************)
+
+inductive thom: relation term ≝
+   | thom_atom: ∀I. thom (𝕒{I}) (𝕒{I})
+   | thom_abst: ∀V1,V2,T1,T2. thom (𝕔{Abst} V1. T1) (𝕔{Abst} V2. T2)
+   | thom_appl: ∀V1,V2,T1,T2. thom T1 T2 → 𝕊[T1] → 𝕊[T2] →
+                thom (𝕔{Appl} V1. T1) (𝕔{Appl} V2. T2)
+.
+
+interpretation "homomorphic (term)" 'napart T1 T2 = (thom T1 T2).
+
+(* Basic properties *********************************************************)
+
+lemma thom_sym: ∀T1,T2. T1 ≈ T2 → T2 ≈ T1.
+#T1 #T2 #H elim H -H T1 T2 /2/
+qed.
+
+lemma thom_refl2: ∀T1,T2. T1 ≈ T2 → T2 ≈ T2.
+#T1 #T2 #H elim H -H T1 T2 /2/
+qed.
+
+lemma thom_refl1: ∀T1,T2. T1 ≈ T2 → T1 ≈ T1.
+/3/ qed.
+
+lemma simple_thom_repl_dx: ∀T1,T2. T1 ≈ T2 → 𝕊[T1] → 𝕊[T2].
+#T1 #T2 #H elim H -H T1 T2 //
+#V1 #V2 #T1 #T2 #H
+elim (simple_inv_bind … H)
+qed.
+
+lemma simple_thom_repl_sn: ∀T1,T2. T1 ≈ T2 → 𝕊[T2] → 𝕊[T1].
+/3/ qed.
+
+(* Basic inversion lemmas ***************************************************)
+
+
+(* Basic-1: removed theorems 7:
+            iso_gen_sort iso_gen_lref iso_gen_head iso_refl iso_trans
+            iso_flats_lref_bind_false iso_flats_flat_bind_false
+*)
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/names.txt b/matita/matita/contribs/lambda_delta/Basic_2/names.txt
new file mode 100644 (file)
index 0000000..c33d5a8
--- /dev/null
@@ -0,0 +1,22 @@
+NAMING CONVENTIONS FOR METAVARIABLES
+
+A,B    : arity
+C,D    : candidate of reducibility
+E,F,G  : reserved: future use
+H      : reserved: transient premise
+IH     : reserved: inductive premise
+I,J    : item
+K,L    : local environment
+M,N    : reserved: future use
+O      : reserved: standard library
+P,Q    : reserved: future use
+R      : generic predicate (relation)
+S      : reserved: standard library
+T,U,V,W: term
+X,Y,Z  : reserved: transient objet denoted by a capital letter
+
+d      : relocation depth
+e      : relocation height
+h      : sort hierarchy parameter
+i,j    : local reference position index (de Bruijn's)
+k      : sort index
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/notation.ma b/matita/matita/contribs/lambda_delta/Basic_2/notation.ma
new file mode 100644 (file)
index 0000000..a84fa8f
--- /dev/null
@@ -0,0 +1,125 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The 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 λδ ****************************************)
+
+(* Grammar ******************************************************************)
+
+notation "hvbox( ⋆ )"
+ non associative with precedence 90
+ for @{ 'Star }.
+
+notation "hvbox( ⋆ term 90 k )"
+ non associative with precedence 90
+ for @{ 'Star $k }.
+
+notation "hvbox( # term 90 k )"
+ non associative with precedence 90
+ for @{ 'LRef $k }.
+
+notation "hvbox( 𝕒 { I } )"
+ non associative with precedence 90
+ for @{ 'SItem $I }.
+
+notation "hvbox( 𝕔 { I } break term 90 T1 . break term 90 T )"
+ non associative with precedence 90
+ for @{ 'SItem $I $T1 $T }.
+
+notation "hvbox( 𝕓 { I } break term 90 T1 . break term 90 T )"
+ non associative with precedence 90
+ for @{ 'SBind $I $T1 $T }.
+
+notation "hvbox( 𝕗 { I } break term 90 T1 . break term 90 T )"
+ non associative with precedence 90
+ for @{ 'SFlat $I $T1 $T }.
+
+notation "hvbox( T . break 𝕓 { I } break term 90 T1 )"
+ non associative with precedence 89
+ for @{ 'DBind $T $I $T1 }.
+(*
+notation > "hvbox( T . break 𝕔 { I } break term 90 T1 )"
+ non associative with precedence 89
+ for @{ 'DBind $T $I $T1 }.
+*) (**) (* this breaks all parsing *)
+notation "hvbox( # [ x ] )"
+ non associative with precedence 90
+ for @{ 'Weight $x }.
+
+notation "hvbox( # [ x , break y ] )"
+ non associative with precedence 90
+ for @{ 'Weight $x $y }.
+
+notation "hvbox( 𝕊 [ T ] )"
+   non associative with precedence 45
+   for @{ 'Simple $T }.
+
+notation "hvbox( T1 break [ d , break e ] ≈ break T2 )"
+   non associative with precedence 45
+   for @{ 'Eq $T1 $d $e $T2 }.
+
+(* Substitution *************************************************************)
+
+notation "hvbox( ↑ [ d , break e ] break T1 ≡ break T2 )"
+   non associative with precedence 45
+   for @{ 'RLift $d $e $T1 $T2 }.
+
+notation "hvbox( ↓ [ d , break e ] break L1 ≡ break L2 )"
+   non associative with precedence 45
+   for @{ 'RDrop $d $e $L1 $L2 }.
+
+notation "hvbox( T1 break [ d , break e ] ≫ break T2 )"
+   non associative with precedence 45
+   for @{ 'PSubst $T1 $d $e $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 }.
+
+(* Unfold *******************************************************************)
+
+notation "hvbox( T1 break [ d , break e ] ≫* break T2 )"
+   non associative with precedence 45
+   for @{ 'PSubstStar $T1 $d $e $T2 }.
+
+notation "hvbox( L ⊢ break term 90 T1 break [ d , break e ] ≫* break T2 )"
+   non associative with precedence 45
+   for @{ 'PSubstStar $L $T1 $d $e $T2 }.
+
+(* Reduction ****************************************************************)
+
+notation "hvbox( T1 ⇒ break T2 )"
+   non associative with precedence 45
+   for @{ 'PRed $T1 $T2 }.
+
+notation "hvbox( L ⊢ break term 90 T1 ⇒ break T2 )"
+   non associative with precedence 45
+   for @{ 'PRed $L $T1 $T2 }.
+
+notation "hvbox( L1 ⊢ ⇒ break L2 )"
+   non associative with precedence 45
+   for @{ 'CPRed $L1 $L2 }.
+
+(* Computation **************************************************************)
+
+notation "hvbox( T1 ⇒* break T2 )"
+   non associative with precedence 45
+   for @{ 'PRedStar $T1 $T2 }.
+
+notation "hvbox( L ⊢ break term 90 T1 ⇒* break T2 )"
+   non associative with precedence 45
+   for @{ 'PRedStar $L $T1 $T2 }.
+
+notation "hvbox( L1 ⊢ ⇒* break L2 )"
+   non associative with precedence 45
+   for @{ 'CPRedStar $L1 $L2 }.
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/reduction/cpr.ma b/matita/matita/contribs/lambda_delta/Basic_2/reduction/cpr.ma
new file mode 100644 (file)
index 0000000..9187765
--- /dev/null
@@ -0,0 +1,91 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "Basic-2/grammar/cl_shift.ma".
+include "Basic-2/unfold/tpss.ma".
+include "Basic-2/reduction/tpr.ma".
+
+(* CONTEXT-SENSITIVE PARALLEL REDUCTION ON TERMS ****************************)
+
+(* Basic-1: includes: pr2_delta1 *)
+definition cpr: lenv → relation term ≝
+   λL,T1,T2. ∃∃T. T1 ⇒ T & L ⊢ T [0, |L|] ≫* T2.
+
+interpretation
+   "context-sensitive parallel reduction (term)"
+   'PRed L T1 T2 = (cpr L T1 T2).
+
+(* Basic properties *********************************************************)
+
+(* Basic-1: was by definition: pr2_free *)
+lemma cpr_pr: ∀T1,T2. T1 ⇒ T2 → ∀L. L ⊢ T1 ⇒ T2.
+/2/ qed.
+
+lemma cpr_tpss: ∀L,T1,T2,d,e. L ⊢ T1 [d, e] ≫* T2 → L ⊢ T1 ⇒ T2.
+/3 width=5/ qed.
+
+lemma cpr_refl: ∀L,T. L ⊢ T ⇒ T.
+/2/ qed.
+
+(* Note: new property *)
+(* Basic-1: was only: pr2_thin_dx *) 
+lemma cpr_flat: ∀I,L,V1,V2,T1,T2.
+                L ⊢ V1 ⇒ V2 → L ⊢ T1 ⇒ T2 → L ⊢ 𝕗{I} V1. T1 ⇒ 𝕗{I} V2. T2.
+#I #L #V1 #V2 #T1 #T2 * #V #HV1 #HV2 * /3 width=5/
+qed.
+
+lemma cpr_cast: ∀L,V,T1,T2.
+                L ⊢ T1 ⇒ T2 → L ⊢ 𝕔{Cast} V. T1 ⇒ T2.
+#L #V #T1 #T2 * /3/
+qed.
+
+(* Basic inversion lemmas ***************************************************)
+
+(* Basic-1: was: pr2_gen_csort *)
+lemma cpr_inv_atom: ∀T1,T2. ⋆ ⊢ T1 ⇒ T2 → T1 ⇒ T2.
+#T1 #T2 * #T #HT normalize #HT2
+<(tpss_inv_refl_O2 … HT2) -HT2 //
+qed.
+
+(* Basic-1: was: pr2_gen_sort *)
+lemma cpr_inv_sort1: ∀L,T2,k. L ⊢ ⋆k ⇒ T2 → T2 = ⋆k.
+#L #T2 #k * #X #H
+>(tpr_inv_atom1 … H) -H #H
+>(tpss_inv_sort1 … H) -H //
+qed.
+
+(* Basic-1: was: pr2_gen_cast *)
+lemma cpr_inv_cast1: ∀L,V1,T1,U2. L ⊢ 𝕔{Cast} V1. T1 ⇒ U2 → (
+                        ∃∃V2,T2. L ⊢ V1 ⇒ V2 & L ⊢ T1 ⇒ T2 &
+                                 U2 = 𝕔{Cast} V2. T2
+                     ) ∨ L ⊢ T1 ⇒ U2.
+#L #V1 #T1 #U2 * #X #H #HU2
+elim (tpr_inv_cast1 … H) -H /3/
+* #V #T #HV1 #HT1 #H destruct -X;
+elim (tpss_inv_flat1 … HU2) -HU2 #V2 #T2 #HV2 #HT2 #H destruct -U2 /4 width=5/
+qed.
+
+(* Basic-1: removed theorems 5: 
+            pr2_head_1 pr2_head_2 pr2_cflat pr2_gen_cflat clear_pr2_trans
+   Basic-1: removed local theorems 3:
+            pr2_free_free pr2_free_delta pr2_delta_delta
+*)
+
+(*
+pr2/fwd pr2_gen_appl
+pr2/fwd pr2_gen_abbr
+pr2/props pr2_change
+pr2/subst1 pr2_subst1
+pr2/subst1 pr2_gen_cabbr
+*)
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/reduction/cpr_cpr.ma b/matita/matita/contribs/lambda_delta/Basic_2/reduction/cpr_cpr.ma
new file mode 100644 (file)
index 0000000..0862090
--- /dev/null
@@ -0,0 +1,58 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "Basic-2/reduction/tpr_tpr.ma".
+include "Basic-2/reduction/cpr.ma".
+
+(* CONTEXT-SENSITIVE PARALLEL REDUCTION ON TERMS ****************************)
+
+(* Advanced properties ******************************************************)
+
+lemma cpr_bind_sn: ∀I,L,V1,V2,T1,T2. L ⊢ V1 ⇒ V2 → T1 ⇒ T2 →
+                   L ⊢ 𝕓{I} V1. T1 ⇒ 𝕓{I} V2. T2.
+#I #L #V1 #V2 #T1 #T2 * #V #HV1 #HV2 #HT12 
+@ex2_1_intro [2: @(tpr_delta … HV1 HT12) | skip ] /2/ (* /3 width=5/ is too slow *)
+qed.
+
+(* Basic-1: was only: pr2_gen_cbind *)
+lemma cpr_bind_dx: ∀I,L,V1,V2,T1,T2. V1 ⇒ V2 → L. 𝕓{I} V2 ⊢ T1 ⇒ T2 →
+                   L ⊢ 𝕓{I} V1. T1 ⇒ 𝕓{I} V2. T2.
+#I #L #V1 #V2 #T1 #T2 #HV12 * #T #HT1 normalize #HT2
+elim (tpss_split_up … HT2 1 ? ?) -HT2 // #T0 <minus_n_O #HT0 normalize <minus_plus_m_m #HT02
+lapply (tpss_leq_repl_dx … HT0 (⋆. 𝕓{I} V2) ?) -HT0 /2/ #HT0
+lapply (tpss_tps … HT0) -HT0 #HT0
+@ex2_1_intro [2: @(tpr_delta … HV12 HT1 HT0) | skip | /2/ ] (**) (* /3 width=5/ is too slow *)
+qed.
+
+(* Advanced forward lemmas **************************************************)
+
+lemma cpr_shift_fwd: ∀L,T1,T2. L ⊢ T1 ⇒ T2 → L @ T1 ⇒ L @ T2.
+#L elim L -L
+[ /2/
+| normalize /3/
+].
+qed.
+
+(* Main properties **********************************************************)
+
+(* Basic-1: was: pr2_confluence *)
+theorem cpr_conf: ∀L,U0,T1,T2. L ⊢ U0 ⇒ T1 → L ⊢ U0 ⇒ T2 →
+                  ∃∃T. L ⊢ T1 ⇒ T & L ⊢ T2 ⇒ T.
+#L #U0 #T1 #T2 * #U1 #HU01 #HUT1 * #U2 #HU02 #HUT2
+elim (tpr_conf … HU01 HU02) -U0 #U #HU1 #HU2 
+elim (tpr_tpss_ltpr ? L … HU1 … HUT1) -U1 // #U1 #HTU1 #HU1
+elim (tpr_tpss_ltpr ? L … HU2 … HUT2) -U2 // #U2 #HTU2 #HU2
+elim (tpss_conf_eq … HU1 … HU2) -U /3 width=5/
+qed.
+
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/reduction/cpr_lift.ma b/matita/matita/contribs/lambda_delta/Basic_2/reduction/cpr_lift.ma
new file mode 100644 (file)
index 0000000..42703c2
--- /dev/null
@@ -0,0 +1,55 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "Basic-2/unfold/tpss_lift.ma".
+include "Basic-2/reduction/tpr_lift.ma".
+include "Basic-2/reduction/cpr.ma".
+
+(* CONTEXT-SENSITIVE PARALLEL REDUCTION ON TERMS ****************************)
+
+(* Advanced properties ******************************************************)
+
+lemma cpr_delta: ∀L,K,V1,W1,W2,i.
+                 ↓[0, i] L ≡ K. 𝕓{Abbr} V1 → K ⊢ V1 [0, |L| - i - 1] ≫* W1 →
+                 ↑[0, i + 1] W1 ≡ W2 → L ⊢ #i ⇒ W2.
+#L #K #V1 #W1 #W2 #i #HLK #HVW1 #HW12
+@ex2_1_intro [2: // | skip | @tpss_subst /2 width=6/ ] (**) (* /4 width=6/ is too slow *)
+qed.
+
+(* Advanced inversion lemmas ************************************************)
+
+(* Basic-1: was: pr2_gen_lref *)
+lemma cpr_inv_lref1: ∀L,T2,i. L ⊢ #i ⇒ T2 →
+                     T2 = #i ∨
+                     ∃∃K,V1,T1. ↓[0, i] L ≡ K. 𝕓{Abbr} V1 &
+                                K ⊢ V1 [0, |L| - i - 1] ≫* T1 &
+                                ↑[0, i + 1] T1 ≡ T2 &
+                                i < |L|.
+#L #T2 #i * #X #H
+>(tpr_inv_atom1 … H) -H #H
+elim (tpss_inv_lref1 … H) -H /2/
+* /3 width=6/
+qed.
+
+(* Basic-1: was: pr2_gen_abst *)
+lemma cpr_inv_abst1: ∀V1,T1,U2. 𝕔{Abst} V1. T1 ⇒ U2 →
+                     ∃∃V2,T2. V1 ⇒ V2 & T1 ⇒ T2 & U2 = 𝕔{Abst} V2. T2.
+/2/ qed.
+
+(* Relocation properties ****************************************************)
+
+(* Basic-1: was: pr2_lift *)
+
+(* Basic-1: was: pr2_gen_lift *)
+
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/reduction/lcpr.ma b/matita/matita/contribs/lambda_delta/Basic_2/reduction/lcpr.ma
new file mode 100644 (file)
index 0000000..f01daab
--- /dev/null
@@ -0,0 +1,41 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "Basic-2/reduction/cpr.ma".
+
+(* CONTEXT-SENSITIVE PARALLEL REDUCTION ON LOCAL ENVIRONMENTS *************)
+
+inductive lcpr: relation lenv ≝
+| lcpr_sort: lcpr (⋆) (⋆)
+| lcpr_item: ∀K1,K2,I,V1,V2.
+             lcpr K1 K2 → K2 ⊢ V1 ⇒ V2 → lcpr (K1. 𝕓{I} V1) (K2. 𝕓{I} V2) (*𝕓*)
+.
+
+interpretation
+  "context-sensitive parallel reduction (environment)"
+  'CPRed L1 L2 = (lcpr L1 L2).
+
+(* Basic inversion lemmas ***************************************************)
+
+fact lcpr_inv_item1_aux: ∀L1,L2. L1 ⊢ ⇒ L2 → ∀K1,I,V1. L1 = K1. 𝕓{I} V1 →
+                         ∃∃K2,V2. K1 ⊢ ⇒ K2 & K2 ⊢ V1 ⇒ V2 & L2 = K2. 𝕓{I} V2.
+#L1 #L2 * -L1 L2
+[ #K1 #I #V1 #H destruct
+| #K1 #K2 #I #V1 #V2 #HK12 #HV12 #L #J #W #H destruct - K1 I V1 /2 width=5/
+]
+qed.
+
+lemma lcpr_inv_item1: ∀K1,I,V1,L2. K1. 𝕓{I} V1 ⊢ ⇒ L2 →
+                      ∃∃K2,V2. K1 ⊢ ⇒ K2 & K2 ⊢ V1 ⇒ V2 & L2 = K2. 𝕓{I} V2.
+/2/ qed.
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/reduction/ltpr.ma b/matita/matita/contribs/lambda_delta/Basic_2/reduction/ltpr.ma
new file mode 100644 (file)
index 0000000..a9093a0
--- /dev/null
@@ -0,0 +1,83 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "Basic-2/reduction/tpr.ma".
+
+(* CONTEXT-FREE PARALLEL REDUCTION ON LOCAL ENVIRONMENTS ********************)
+
+inductive ltpr: relation lenv ≝
+| ltpr_sort: ltpr (⋆) (⋆)
+| ltpr_item: ∀K1,K2,I,V1,V2.
+             ltpr K1 K2 → V1 ⇒ V2 → ltpr (K1. 𝕓{I} V1) (K2. 𝕓{I} V2) (*𝕓*)
+.
+
+interpretation
+  "context-free parallel reduction (environment)"
+  'PRed L1 L2 = (ltpr L1 L2).
+
+(* Basic properties *********************************************************)
+
+lemma ltpr_refl: ∀L:lenv. L ⇒ L.
+#L elim L -L /2/
+qed.
+
+(* Basic inversion lemmas ***************************************************)
+
+fact ltpr_inv_atom1_aux: ∀L1,L2. L1 ⇒ L2 → L1 = ⋆ → L2 = ⋆.
+#L1 #L2 * -L1 L2
+[ //
+| #K1 #K2 #I #V1 #V2 #_ #_ #H destruct
+]
+qed.
+
+(* Basic-1: was: wcpr0_gen_sort *)
+lemma ltpr_inv_atom1: ∀L2. ⋆ ⇒ L2 → L2 = ⋆.
+/2/ qed.
+
+fact ltpr_inv_pair1_aux: ∀L1,L2. L1 ⇒ L2 → ∀K1,I,V1. L1 = K1. 𝕓{I} V1 →
+                         ∃∃K2,V2. K1 ⇒ K2 & V1 ⇒ V2 & L2 = K2. 𝕓{I} V2.
+#L1 #L2 * -L1 L2
+[ #K1 #I #V1 #H destruct
+| #K1 #K2 #I #V1 #V2 #HK12 #HV12 #L #J #W #H destruct - K1 I V1 /2 width=5/
+]
+qed.
+
+(* Basic-1: was: wcpr0_gen_head *)
+lemma ltpr_inv_pair1: ∀K1,I,V1,L2. K1. 𝕓{I} V1 ⇒ L2 →
+                      ∃∃K2,V2. K1 ⇒ K2 & V1 ⇒ V2 & L2 = K2. 𝕓{I} V2.
+/2/ qed.
+
+fact ltpr_inv_atom2_aux: ∀L1,L2. L1 ⇒ L2 → L2 = ⋆ → L1 = ⋆.
+#L1 #L2 * -L1 L2
+[ //
+| #K1 #K2 #I #V1 #V2 #_ #_ #H destruct
+]
+qed.
+
+lemma ltpr_inv_atom2: ∀L1. L1 ⇒ ⋆ → L1 = ⋆.
+/2/ qed.
+
+fact ltpr_inv_pair2_aux: ∀L1,L2. L1 ⇒ L2 → ∀K2,I,V2. L2 = K2. 𝕓{I} V2 →
+                         ∃∃K1,V1. K1 ⇒ K2 & V1 ⇒ V2 & L1 = K1. 𝕓{I} V1.
+#L1 #L2 * -L1 L2
+[ #K2 #I #V2 #H destruct
+| #K1 #K2 #I #V1 #V2 #HK12 #HV12 #K #J #W #H destruct -K2 I V2 /2 width=5/
+]
+qed.
+
+lemma ltpr_inv_pair2: ∀L1,K2,I,V2. L1 ⇒ K2. 𝕓{I} V2 →
+                      ∃∃K1,V1. K1 ⇒ K2 & V1 ⇒ V2 & L1 = K1. 𝕓{I} V1.
+/2/ qed.
+
+(* Basic-1: removed theorems 2: wcpr0_getl wcpr0_getl_back *)
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/reduction/ltpr_drop.ma b/matita/matita/contribs/lambda_delta/Basic_2/reduction/ltpr_drop.ma
new file mode 100644 (file)
index 0000000..3c70e6a
--- /dev/null
@@ -0,0 +1,52 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "Basic-2/reduction/tpr_lift.ma".
+include "Basic-2/reduction/ltpr.ma".
+
+(* CONTEXT-FREE PARALLEL REDUCTION ON LOCAL ENVIRONMENTS ********************)
+
+(* Basic-1: was: wcpr0_drop *)
+lemma ltpr_drop_conf: ∀L1,K1,d,e. ↓[d, e] L1 ≡ K1 → ∀L2. L1 ⇒ L2 →
+                      ∃∃K2. ↓[d, e] L2 ≡ K2 & K1 ⇒ K2.
+#L1 #K1 #d #e #H elim H -H L1 K1 d e
+[ #d #e #X #H >(ltpr_inv_atom1 … H) -H /2/
+| #K1 #I #V1 #X #H
+  elim (ltpr_inv_pair1 … H) -H #L2 #V2 #HL12 #HV12 #H destruct /3 width=5/
+| #L1 #K1 #I #V1 #e #_ #IHLK1 #X #H
+  elim (ltpr_inv_pair1 … H) -H #L2 #V2 #HL12 #HV12 #H destruct -X;
+  elim (IHLK1 … HL12) -IHLK1 HL12 /3/
+| #L1 #K1 #I #V1 #W1 #d #e #_ #HWV1 #IHLK1 #X #H
+  elim (ltpr_inv_pair1 … H) -H #L2 #V2 #HL12 #HV12 #H destruct -X;
+  elim (tpr_inv_lift … HV12 … HWV1) -HV12 HWV1;
+  elim (IHLK1 … HL12) -IHLK1 HL12 /3 width=5/
+]
+qed.
+
+(* Basic-1: was: wcpr0_drop_back *)
+lemma ltpr_drop_trans: ∀L1,K1,d,e. ↓[d, e] L1 ≡ K1 → ∀K2. K1 ⇒ K2 →
+                       ∃∃L2. ↓[d, e] L2 ≡ K2 & L1 ⇒ L2.
+#L1 #K1 #d #e #H elim H -H L1 K1 d e
+[ #d #e #X #H >(ltpr_inv_atom1 … H) -H /2/
+| #K1 #I #V1 #X #H
+  elim (ltpr_inv_pair1 … H) -H #K2 #V2 #HK12 #HV12 #H destruct /3 width=5/
+| #L1 #K1 #I #V1 #e #_ #IHLK1 #K2 #HK12
+  elim (IHLK1 … HK12) -IHLK1 HK12 /3 width=5/
+| #L1 #K1 #I #V1 #W1 #d #e #_ #HWV1 #IHLK1 #X #H
+  elim (ltpr_inv_pair1 … H) -H #K2 #W2 #HK12 #HW12 #H destruct -X;
+  elim (lift_total W2 d e) #V2 #HWV2
+  lapply (tpr_lift … HW12 … HWV1 … HWV2) -HW12 HWV1;
+  elim (IHLK1 … HK12) -IHLK1 HK12 /3 width=5/
+]
+qed.
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/reduction/tpr.ma b/matita/matita/contribs/lambda_delta/Basic_2/reduction/tpr.ma
new file mode 100644 (file)
index 0000000..fce71d1
--- /dev/null
@@ -0,0 +1,198 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The 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/tps.ma".
+
+(* CONTEXT-FREE PARALLEL REDUCTION ON TERMS *********************************)
+
+(* Basic-1: includes: pr0_delta1 *)
+inductive tpr: relation term ≝
+| tpr_atom : ∀I. tpr (𝕒{I}) (𝕒{I})
+| tpr_flat : ∀I,V1,V2,T1,T2. tpr V1 V2 → tpr T1 T2 →
+             tpr (𝕗{I} V1. T1) (𝕗{I} V2. T2)
+| tpr_beta : ∀V1,V2,W,T1,T2.
+             tpr V1 V2 → tpr T1 T2 →
+             tpr (𝕔{Appl} V1. 𝕔{Abst} W. T1) (𝕔{Abbr} V2. T2)
+| tpr_delta: ∀I,V1,V2,T1,T2,T.
+             tpr V1 V2 → tpr T1 T2 → ⋆.  𝕓{I} V2 ⊢ T2 [0, 1] ≫ T →
+             tpr (𝕓{I} V1. T1) (𝕓{I} V2. T)
+| tpr_theta: ∀V,V1,V2,W1,W2,T1,T2.
+             tpr V1 V2 → ↑[0,1] V2 ≡ V → tpr W1 W2 → tpr T1 T2 →
+             tpr (𝕔{Appl} V1. 𝕔{Abbr} W1. T1) (𝕔{Abbr} W2. 𝕔{Appl} V. T2)
+| tpr_zeta : ∀V,T,T1,T2. ↑[0,1] T1 ≡ T → tpr T1 T2 →
+             tpr (𝕔{Abbr} V. T) T2
+| tpr_tau  : ∀V,T1,T2. tpr T1 T2 → tpr (𝕔{Cast} V. T1) T2
+.
+
+interpretation
+   "context-free parallel reduction (term)"
+   'PRed T1 T2 = (tpr T1 T2).
+
+(* Basic properties *********************************************************)
+
+lemma tpr_bind: ∀I,V1,V2,T1,T2. V1 ⇒ V2 → T1 ⇒ T2 →
+                             𝕓{I} V1. T1 ⇒  𝕓{I} V2. T2.
+/2/ qed.
+
+(* Basic-1: was by definition: pr0_refl *)
+lemma tpr_refl: ∀T. T ⇒ T.
+#T elim T -T //
+#I elim I -I /2/
+qed.
+
+(* Basic inversion lemmas ***************************************************)
+
+fact tpr_inv_atom1_aux: ∀U1,U2. U1 ⇒ U2 → ∀I. U1 = 𝕒{I} → U2 = 𝕒{I}.
+#U1 #U2 * -U1 U2
+[ //
+| #I #V1 #V2 #T1 #T2 #_ #_ #k #H destruct
+| #V1 #V2 #W #T1 #T2 #_ #_ #k #H destruct
+| #I #V1 #V2 #T1 #T2 #T #_ #_ #_ #k #H destruct
+| #V #V1 #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #_ #k #H destruct
+| #V #T #T1 #T2 #_ #_ #k #H destruct
+| #V #T1 #T2 #_ #k #H destruct
+]
+qed.
+
+(* Basic-1: was: pr0_gen_sort pr0_gen_lref *)
+lemma tpr_inv_atom1: ∀I,U2. 𝕒{I} ⇒ U2 → U2 = 𝕒{I}.
+/2/ qed.
+
+fact tpr_inv_bind1_aux: ∀U1,U2. U1 ⇒ U2 → ∀I,V1,T1. U1 = 𝕓{I} V1. T1 →
+                        (∃∃V2,T2,T. V1 ⇒ V2 & T1 ⇒ T2 &
+                                    ⋆.  𝕓{I} V2 ⊢ T2 [0, 1] ≫ T &
+                                    U2 = 𝕓{I} V2. T
+                        ) ∨
+                        ∃∃T. ↑[0,1] T ≡ T1 & T ⇒ U2 & I = Abbr.
+#U1 #U2 * -U1 U2
+[ #J #I #V #T #H destruct
+| #I1 #V1 #V2 #T1 #T2 #_ #_ #I #V #T #H destruct
+| #V1 #V2 #W #T1 #T2 #_ #_ #I #V #T #H destruct
+| #I1 #V1 #V2 #T1 #T2 #T #HV12 #HT12 #HT2 #I0 #V0 #T0 #H destruct -I1 V1 T1 /3 width=7/
+| #V #V1 #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #_ #I0 #V0 #T0 #H destruct
+| #V #T #T1 #T2 #HT1 #HT12 #I0 #V0 #T0 #H destruct -V T /3/
+| #V #T1 #T2 #_ #I0 #V0 #T0 #H destruct
+]
+qed.
+
+lemma tpr_inv_bind1: ∀V1,T1,U2,I. 𝕓{I} V1. T1 ⇒ U2 →
+                     (∃∃V2,T2,T. V1 ⇒ V2 & T1 ⇒ T2 &
+                                 ⋆.  𝕓{I} V2 ⊢ T2 [0, 1] ≫ T &
+                                 U2 = 𝕓{I} V2. T
+                     ) ∨
+                     ∃∃T. ↑[0,1] T ≡ T1 & T ⇒ U2 & I = Abbr.
+/2/ qed.
+
+(* Basic-1: was pr0_gen_abbr *)
+lemma tpr_inv_abbr1: ∀V1,T1,U2. 𝕓{Abbr} V1. T1 ⇒ U2 →
+                     (∃∃V2,T2,T. V1 ⇒ V2 & T1 ⇒ T2 &
+                                 ⋆.  𝕓{Abbr} V2 ⊢ T2 [0, 1] ≫ T &
+                                 U2 = 𝕓{Abbr} V2. T
+                      ) ∨
+                      ∃∃T. ↑[0,1] T ≡ T1 & T ⇒ U2.
+#V1 #T1 #U2 #H
+elim (tpr_inv_bind1 … H) -H * /3 width=7/
+qed.
+
+fact tpr_inv_flat1_aux: ∀U1,U2. U1 ⇒ U2 → ∀I,V1,U0. U1 = 𝕗{I} V1. U0 →
+                        ∨∨ ∃∃V2,T2.            V1 ⇒ V2 & U0 ⇒ T2 &
+                                               U2 = 𝕗{I} V2. T2
+                         | ∃∃V2,W,T1,T2.       V1 ⇒ V2 & T1 ⇒ T2 &
+                                               U0 = 𝕔{Abst} W. T1 &
+                                               U2 = 𝕔{Abbr} V2. T2 & I = Appl
+                         | ∃∃V2,V,W1,W2,T1,T2. V1 ⇒ V2 & W1 ⇒ W2 & T1 ⇒ T2 &
+                                               ↑[0,1] V2 ≡ V &
+                                               U0 = 𝕔{Abbr} W1. T1 &
+                                               U2 = 𝕔{Abbr} W2. 𝕔{Appl} V. T2 &
+                                               I = Appl
+                         |                     (U0 ⇒ U2 ∧ I = Cast).
+#U1 #U2 * -U1 U2
+[ #I #J #V #T #H destruct
+| #I #V1 #V2 #T1 #T2 #HV12 #HT12 #J #V #T #H destruct -I V1 T1 /3 width=5/
+| #V1 #V2 #W #T1 #T2 #HV12 #HT12 #J #V #T #H destruct -J V1 T /3 width=8/
+| #I #V1 #V2 #T1 #T2 #T #_ #_ #_ #J #V0 #T0 #H destruct
+| #V #V1 #V2 #W1 #W2 #T1 #T2 #HV12 #HV2 #HW12 #HT12 #J #V0 #T0 #H
+  destruct -J V1 T0 /3 width=12/
+| #V #T #T1 #T2 #_ #_ #J #V0 #T0 #H destruct
+| #V #T1 #T2 #HT12 #J #V0 #T0 #H destruct -J V T1 /3/
+]
+qed.
+
+lemma tpr_inv_flat1: ∀V1,U0,U2,I. 𝕗{I} V1. U0 ⇒ U2 →
+                     ∨∨ ∃∃V2,T2.            V1 ⇒ V2 & U0 ⇒ T2 &
+                                            U2 = 𝕗{I} V2. T2
+                      | ∃∃V2,W,T1,T2.       V1 ⇒ V2 & T1 ⇒ T2 &
+                                            U0 = 𝕔{Abst} W. T1 &
+                                            U2 = 𝕔{Abbr} V2. T2 & I = Appl
+                      | ∃∃V2,V,W1,W2,T1,T2. V1 ⇒ V2 & W1 ⇒ W2 & T1 ⇒ T2 &
+                                            ↑[0,1] V2 ≡ V &
+                                            U0 = 𝕔{Abbr} W1. T1 &
+                                            U2 = 𝕔{Abbr} W2. 𝕔{Appl} V. T2 &
+                                            I = Appl
+                      |                     (U0 ⇒ U2 ∧ I = Cast).
+/2/ qed.
+
+(* Basic-1: was pr0_gen_appl *)
+lemma tpr_inv_appl1: ∀V1,U0,U2. 𝕔{Appl} V1. U0 ⇒ U2 →
+                     ∨∨ ∃∃V2,T2.            V1 ⇒ V2 & U0 ⇒ T2 &
+                                            U2 = 𝕔{Appl} V2. T2
+                      | ∃∃V2,W,T1,T2.       V1 ⇒ V2 & T1 ⇒ T2 &
+                                            U0 = 𝕔{Abst} W. T1 &
+                                            U2 = 𝕔{Abbr} V2. T2
+                      | ∃∃V2,V,W1,W2,T1,T2. V1 ⇒ V2 & W1 ⇒ W2 & T1 ⇒ T2 &
+                                            ↑[0,1] V2 ≡ V &
+                                            U0 = 𝕔{Abbr} W1. T1 &
+                                            U2 = 𝕔{Abbr} W2. 𝕔{Appl} V. T2.
+#V1 #U0 #U2 #H
+elim (tpr_inv_flat1 … H) -H * /3 width=12/ #_ #H destruct
+qed.
+
+(* Basic-1: was: pr0_gen_cast *)
+lemma tpr_inv_cast1: ∀V1,T1,U2. 𝕔{Cast} V1. T1 ⇒ U2 →
+                       (∃∃V2,T2. V1 ⇒ V2 & T1 ⇒ T2 & U2 = 𝕔{Cast} V2. T2)
+                     ∨ T1 ⇒ U2.
+#V1 #T1 #U2 #H
+elim (tpr_inv_flat1 … H) -H * /3 width=5/
+[ #V2 #W #W1 #W2 #_ #_ #_ #_ #H destruct
+| #V2 #W #W1 #W2 #T2 #U1 #_ #_ #_ #_ #_ #_ #H destruct
+]
+qed.
+
+fact tpr_inv_lref2_aux: ∀T1,T2. T1 ⇒ T2 → ∀i. T2 = #i →
+                        ∨∨           T1 = #i
+                         | ∃∃V,T,T0. ↑[O,1] T0 ≡ T & T0 ⇒ #i &
+                                     T1 = 𝕔{Abbr} V. T
+                         | ∃∃V,T.    T ⇒ #i & T1 = 𝕔{Cast} V. T.
+#T1 #T2 * -T1 T2
+[ #I #i #H destruct /2/
+| #I #V1 #V2 #T1 #T2 #_ #_ #i #H destruct
+| #V1 #V2 #W #T1 #T2 #_ #_ #i #H destruct
+| #I #V1 #V2 #T1 #T2 #T #_ #_ #_ #i #H destruct
+| #V #V1 #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #_ #i #H destruct
+| #V #T #T1 #T2 #HT1 #HT12 #i #H destruct /3 width=6/
+| #V #T1 #T2 #HT12 #i #H destruct /3/
+]
+qed.
+
+lemma tpr_inv_lref2: ∀T1,i. T1 ⇒ #i →
+                     ∨∨           T1 = #i
+                      | ∃∃V,T,T0. ↑[O,1] T0 ≡ T & T0 ⇒ #i &
+                                  T1 = 𝕔{Abbr} V. T
+                      | ∃∃V,T.    T ⇒ #i & T1 = 𝕔{Cast} V. T.
+/2/ qed.
+
+(* Basic-1: removed theorems 3:
+            pr0_subst0_back pr0_subst0_fwd pr0_subst0
+   Basic-1: removed local theorems: 1: pr0_delta_tau
+*)
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/reduction/tpr_lift.ma b/matita/matita/contribs/lambda_delta/Basic_2/reduction/tpr_lift.ma
new file mode 100644 (file)
index 0000000..311a143
--- /dev/null
@@ -0,0 +1,119 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The 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/tps_lift.ma".
+include "Basic-2/reduction/tpr.ma".
+
+(* CONTEXT-FREE PARALLEL REDUCTION ON TERMS *********************************)
+
+(* Relocation properties ****************************************************)
+
+(* Basic-1: was: pr0_lift *)
+lemma tpr_lift: ∀T1,T2. T1 ⇒ T2 →
+                ∀d,e,U1. ↑[d, e] T1 ≡ U1 → ∀U2. ↑[d, e] T2 ≡ U2 → U1 ⇒ U2.
+#T1 #T2 #H elim H -H T1 T2
+[ * #i #d #e #U1 #HU1 #U2 #HU2
+  lapply (lift_mono … HU1 … HU2) -HU1 #H destruct -U1
+  [ lapply (lift_inv_sort1 … HU2) -HU2 #H destruct -U2 //
+  | lapply (lift_inv_lref1 … HU2) * * #Hid #H destruct -U2 //
+  ]
+| #I #V1 #V2 #T1 #T2 #_ #_ #IHV12 #IHT12 #d #e #X1 #HX1 #X2 #HX2
+  elim (lift_inv_flat1 … HX1) -HX1 #W1 #U1 #HVW1 #HTU1 #HX1 destruct -X1;
+  elim (lift_inv_flat1 … HX2) -HX2 #W2 #U2 #HVW2 #HTU2 #HX2 destruct -X2 /3/
+| #V1 #V2 #W #T1 #T2 #_ #_ #IHV12 #IHT12 #d #e #X1 #HX1 #X2 #HX2
+  elim (lift_inv_flat1 … HX1) -HX1 #V0 #X #HV10 #HX #HX1 destruct -X1;
+  elim (lift_inv_bind1 … HX) -HX #W0 #T0 #HW0 #HT10 #HX destruct -X;
+  elim (lift_inv_bind1 … HX2) -HX2 #V3 #T3 #HV23 #HT23 #HX2 destruct -X2 /3/
+| #I #V1 #V2 #T1 #T2 #T0 #HV12 #HT12 #HT2 #IHV12 #IHT12 #d #e #X1 #HX1 #X2 #HX2
+  elim (lift_inv_bind1 … HX1) -HX1 #W1 #U1 #HVW1 #HTU1 #HX1 destruct -X1;
+  elim (lift_inv_bind1 … HX2) -HX2 #W2 #U0 #HVW2 #HTU0 #HX2 destruct -X2;
+  elim (lift_total T2 (d + 1) e) #U2 #HTU2
+  @tpr_delta
+  [4: @(tps_lift_le … HT2 … HTU2 HTU0 ?) /2/ |1: skip |2: /2/ |3: /2/ ] (**) (*/3. is too slow *)
+| #V #V1 #V2 #W1 #W2 #T1 #T2 #_ #HV2 #_ #_ #IHV12 #IHW12 #IHT12 #d #e #X1 #HX1 #X2 #HX2
+  elim (lift_inv_flat1 … HX1) -HX1 #V0 #X #HV10 #HX #HX1 destruct -X1;
+  elim (lift_inv_bind1 … HX) -HX #W0 #T0 #HW0 #HT10 #HX destruct -X;
+  elim (lift_inv_bind1 … HX2) -HX2 #W3 #X #HW23 #HX #HX2 destruct -X2;
+  elim (lift_inv_flat1 … HX) -HX #V3 #T3 #HV3 #HT23 #HX destruct -X;
+  elim (lift_trans_ge … HV2 … HV3 ?) -HV2 HV3 V // /3/
+| #V #T #T1 #T2 #HT1 #_ #IHT12 #d #e #X #HX #T0 #HT20
+  elim (lift_inv_bind1 … HX) -HX #V3 #T3 #_ #HT3 #HX destruct -X;
+  elim (lift_trans_ge … HT1 … HT3 ?) -HT1 HT3 T // /3 width=6/
+| #V #T1 #T2 #_ #IHT12 #d #e #X #HX #T #HT2
+  elim (lift_inv_flat1 … HX) -HX #V0 #T0 #_ #HT0 #HX destruct -X /3/
+]
+qed.
+
+(* Basic-1: was: pr0_gen_lift *)
+lemma tpr_inv_lift: ∀T1,T2. T1 ⇒ T2 →
+                    ∀d,e,U1. ↑[d, e] U1 ≡ T1 →
+                    ∃∃U2. ↑[d, e] U2 ≡ T2 & U1 ⇒ U2.
+#T1 #T2 #H elim H -H T1 T2
+[ * #i #d #e #U1 #HU1
+  [ lapply (lift_inv_sort2 … HU1) -HU1 #H destruct -U1 /2/
+  | lapply (lift_inv_lref2 … HU1) -HU1 * * #Hid #H destruct -U1 /3/
+  ]
+| #I #V1 #V2 #T1 #T2 #_ #_ #IHV12 #IHT12 #d #e #X #HX
+  elim (lift_inv_flat2 … HX) -HX #V0 #T0 #HV01 #HT01 #HX destruct -X;
+  elim (IHV12 … HV01) -IHV12 HV01;
+  elim (IHT12 … HT01) -IHT12 HT01 /3 width=5/
+| #V1 #V2 #W1 #T1 #T2 #_ #_ #IHV12 #IHT12 #d #e #X #HX
+  elim (lift_inv_flat2 … HX) -HX #V0 #Y #HV01 #HY #HX destruct -X;
+  elim (lift_inv_bind2 … HY) -HY #W0 #T0 #HW01 #HT01 #HY destruct -Y;
+  elim (IHV12 … HV01) -IHV12 HV01;
+  elim (IHT12 … HT01) -IHT12 HT01 /3 width=5/
+| #I #V1 #V2 #T1 #T2 #T0 #_ #_ #HT20 #IHV12 #IHT12 #d #e #X #HX
+  elim (lift_inv_bind2 … HX) -HX #W1 #U1 #HWV1 #HUT1 #HX destruct -X;
+  elim (IHV12 … HWV1) -IHV12 HWV1 #W2 #HWV2 #HW12
+  elim (IHT12 … HUT1) -IHT12 HUT1 #U2 #HUT2 #HU12
+  elim (tps_inv_lift1_le … HT20 … HUT2 ?) -HT20 HUT2 // [3: /2 width=5/ |2: skip ] #U0 #HU20 #HUT0
+  @ex2_1_intro  [2: /2/ |1: skip |3: /2/ ] (**) (* /3 width=5/ is slow *)
+| #V #V1 #V2 #W1 #W2 #T1 #T2 #_ #HV2 #_ #_ #IHV12 #IHW12 #IHT12 #d #e #X #HX
+  elim (lift_inv_flat2 … HX) -HX #V0 #Y #HV01 #HY #HX destruct -X;
+  elim (lift_inv_bind2 … HY) -HY #W0 #T0 #HW01 #HT01 #HY destruct -Y;
+  elim (IHV12 … HV01) -IHV12 HV01 #V3 #HV32 #HV03
+  elim (IHW12 … HW01) -IHW12 HW01 #W3 #HW32 #HW03
+  elim (IHT12 … HT01) -IHT12 HT01 #T3 #HT32 #HT03
+  elim (lift_trans_le … HV32 … HV2 ?) -HV32 HV2 V2 // #V2 #HV32 #HV2
+  @ex2_1_intro [2: /3/ |1: skip |3: /2/ ] (**) (* /4 width=5/ is slow *)
+| #V #T #T1 #T2 #HT1 #_ #IHT12 #d #e #X #HX
+  elim (lift_inv_bind2 … HX) -HX #V0 #T0 #_ #HT0 #H destruct -X;
+  elim (lift_div_le … HT1 … HT0 ?) -HT1 HT0 T // #T #HT0 #HT1
+  elim (IHT12 … HT1) -IHT12 HT1 /3 width=5/
+| #V #T1 #T2 #_ #IHT12 #d #e #X #HX
+  elim (lift_inv_flat2 … HX) -HX #V0 #T0 #_ #HT01 #H destruct -X;
+  elim (IHT12 … HT01) -IHT12 HT01 /3/
+]
+qed.
+
+(* Advanced inversion lemmas ************************************************)
+
+fact tpr_inv_abst1_aux: ∀U1,U2. U1 ⇒ U2 → ∀V1,T1. U1 = 𝕔{Abst} V1. T1 →
+                        ∃∃V2,T2. V1 ⇒ V2 & T1 ⇒ T2 & U2 = 𝕔{Abst} V2. T2.
+#U1 #U2 * -U1 U2
+[ #I #V #T #H destruct
+| #I #V1 #V2 #T1 #T2 #_ #_ #V #T #H destruct
+| #V1 #V2 #W #T1 #T2 #_ #_ #V #T #H destruct
+| #I #V1 #V2 #T1 #T2 #T #HV12 #HT12 #HT2 #V0 #T0 #H destruct -I V1 T1;
+  <(tps_inv_refl_SO2 … HT2 ? ? ?) -HT2 T /2 width=5/
+| #V #V1 #V2 #W1 #W2 #T1 #T2 #_ #_ #_ #_ #V0 #T0 #H destruct
+| #V #T #T1 #T2 #_ #_ #V0 #T0 #H destruct
+| #V #T1 #T2 #_ #V0 #T0 #H destruct
+]
+qed.
+
+(* Basic-1: was pr0_gen_abst *)
+lemma tpr_inv_abst1: ∀V1,T1,U2. 𝕔{Abst} V1. T1 ⇒ U2 →
+                     ∃∃V2,T2. V1 ⇒ V2 & T1 ⇒ T2 & U2 = 𝕔{Abst} V2. T2.
+/2/ qed.
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/reduction/tpr_tpr.ma b/matita/matita/contribs/lambda_delta/Basic_2/reduction/tpr_tpr.ma
new file mode 100644 (file)
index 0000000..ac09a41
--- /dev/null
@@ -0,0 +1,287 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "Basic-2/reduction/tpr_tps.ma".
+
+(* CONTEXT-FREE PARALLEL REDUCTION ON TERMS *********************************)
+
+(* Confluence lemmas ********************************************************)
+
+fact tpr_conf_atom_atom: ∀I. ∃∃X. 𝕒{I} ⇒ X & 𝕒{I} ⇒ X.
+/2/ qed.
+
+fact tpr_conf_flat_flat:
+   ∀I,V0,V1,T0,T1,V2,T2. (
+      ∀X0:term. #[X0] < #[V0] + #[T0] + 1 →
+      ∀X1,X2. X0 ⇒ X1 → X0 ⇒ X2 →
+      ∃∃X. X1 ⇒ X & X2 ⇒ X
+   ) →
+   V0 ⇒ V1 → V0 ⇒ V2 → T0 ⇒ T1 → T0 ⇒ T2 →
+   ∃∃T0. 𝕗{I} V1. T1 ⇒ T0 & 𝕗{I} V2. T2 ⇒ T0.
+#I #V0 #V1 #T0 #T1 #V2 #T2 #IH #HV01 #HV02 #HT01 #HT02
+elim (IH … HV01 … HV02) -HV01 HV02 // #V #HV1 #HV2
+elim (IH … HT01 … HT02) -HT01 HT02 /3 width=5/
+qed.
+
+fact tpr_conf_flat_beta:
+   ∀V0,V1,T1,V2,W0,U0,T2. (
+      ∀X0:term. #[X0] < #[V0] + (#[W0] + #[U0] + 1) + 1 →
+      ∀X1,X2. X0 ⇒ X1 → X0 ⇒ X2 →
+      ∃∃X. X1 ⇒ X & X2 ⇒ X
+   ) →
+   V0 ⇒ V1 → V0 ⇒ V2 →
+   U0 ⇒ T2 → 𝕔{Abst} W0. U0 ⇒ T1 →
+   ∃∃X. 𝕔{Appl} V1. T1 ⇒ X & 𝕔{Abbr} V2. T2 ⇒ X.
+#V0 #V1 #T1 #V2 #W0 #U0 #T2 #IH #HV01 #HV02 #HT02 #H
+elim (tpr_inv_abst1 … H) -H #W1 #U1 #HW01 #HU01 #H destruct -T1;
+elim (IH … HV01 … HV02) -HV01 HV02 // #V #HV1 #HV2
+elim (IH … HT02 … HU01) -HT02 HU01 IH /3 width=5/
+qed.
+
+(* basic-1: was:
+            pr0_cong_upsilon_refl pr0_cong_upsilon_zeta
+            pr0_cong_upsilon_cong pr0_cong_upsilon_delta
+*)
+fact tpr_conf_flat_theta:
+   ∀V0,V1,T1,V2,V,W0,W2,U0,U2. (
+      ∀X0:term. #[X0] < #[V0] + (#[W0] + #[U0] + 1) + 1 →
+      ∀X1,X2. X0 ⇒ X1 → X0 ⇒ X2 →
+      ∃∃X. X1 ⇒ X & X2 ⇒ X
+   ) →
+   V0 ⇒ V1 → V0 ⇒ V2 → ↑[O,1] V2 ≡ V →
+   W0 ⇒ W2 → U0 ⇒ U2 →  𝕔{Abbr} W0. U0 ⇒ T1 →
+   ∃∃X. 𝕔{Appl} V1. T1 ⇒ X & 𝕔{Abbr} W2. 𝕔{Appl} V. U2 ⇒ X.
+#V0 #V1 #T1 #V2 #V #W0 #W2 #U0 #U2 #IH #HV01 #HV02 #HV2 #HW02 #HU02 #H
+elim (IH … HV01 … HV02) -HV01 HV02 // #VV #HVV1 #HVV2
+elim (lift_total VV 0 1) #VVV #HVV
+lapply (tpr_lift … HVV2 … HV2 … HVV) #HVVV
+elim (tpr_inv_abbr1 … H) -H *
+(* case 1: delta *)
+[ -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_tps_bind … HWW2 HUUU2 … HUU2) -HUU2 HUUU2 #UUU #HUUU2 #HUUU1
+  @ex2_1_intro
+  [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=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
+  lapply (tw_lift … HUU10) -HUU10 #HUU10
+  elim (IH … HUUT1 … HUU1) -HUUT1 HUU1 IH // -HUU10 #U #HU2 #HUUU2
+  @ex2_1_intro
+  [2: @tpr_flat
+  |1: skip 
+  |3: @tpr_zeta [2: @lift_flat |1: skip |3: @tpr_flat ]
+  ] /2 width=5/ (**) (* /5 width=5/ is too slow *)
+]
+qed.
+
+fact tpr_conf_flat_cast:
+   ∀X2,V0,V1,T0,T1. (
+      ∀X0:term. #[X0] < #[V0] + #[T0] + 1 →
+      ∀X1,X2. X0 ⇒ X1 → X0 ⇒ X2 →
+      ∃∃X. X1 ⇒ X & X2 ⇒ X
+   ) →
+   V0 ⇒ V1 → T0 ⇒ T1 → T0 ⇒ X2 →
+   ∃∃X. 𝕔{Cast} V1. T1 ⇒ X & X2 ⇒ X.
+#X2 #V0 #V1 #T0 #T1 #IH #_ #HT01 #HT02
+elim (IH … HT01 … HT02) -HT01 HT02 IH /3/
+qed.
+
+fact tpr_conf_beta_beta:
+   ∀W0:term. ∀V0,V1,T0,T1,V2,T2. (
+      ∀X0:term. #[X0] < #[V0] + (#[W0] + #[T0] + 1) + 1 →
+      ∀X1,X2. X0 ⇒ X1 → X0 ⇒ X2 →
+      ∃∃X. X1 ⇒ X & X2 ⇒ X
+   ) →
+   V0 ⇒ V1 → V0 ⇒ V2 → T0 ⇒ T1 → T0 ⇒ T2 →
+   ∃∃X. 𝕔{Abbr} V1. T1 ⇒X & 𝕔{Abbr} V2. T2 ⇒ X.
+#W0 #V0 #V1 #T0 #T1 #V2 #T2 #IH #HV01 #HV02 #HT01 #HT02
+elim (IH … HV01 … HV02) -HV01 HV02 //
+elim (IH … HT01 … HT02) -HT01 HT02 IH /3 width=5/
+qed.
+
+(* Basic-1: was: pr0_cong_delta pr0_delta_delta *)
+fact tpr_conf_delta_delta:
+   ∀I1,V0,V1,T0,T1,TT1,V2,T2,TT2. (
+      ∀X0:term. #[X0] < #[V0] + #[T0] + 1 →
+      ∀X1,X2. X0 ⇒ X1 → X0 ⇒ X2 →
+      ∃∃X. X1 ⇒ X & X2 ⇒ X
+   ) →
+   V0 ⇒ V1 → V0 ⇒ V2 → T0 ⇒ T1 → T0 ⇒ T2 →
+   ⋆. 𝕓{I1} V1 ⊢ T1 [O, 1] ≫ TT1 →
+   ⋆. 𝕓{I1} V2 ⊢ T2 [O, 1] ≫ TT2 →
+   ∃∃X. 𝕓{I1} V1. TT1 ⇒ X & 𝕓{I1} V2. TT2 ⇒ X.
+#I1 #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_tps_bind … HV1 HT1 … HTT1) -HT1 HTT1 #U1 #TTU1 #HTU1
+elim (tpr_tps_bind … HV2 HT2 … HTT2) -HT2 HTT2 #U2 #TTU2 #HTU2
+elim (tps_conf_eq … 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.
+
+fact tpr_conf_delta_zeta:
+   ∀X2,V0,V1,T0,T1,TT1,T2. (
+      ∀X0:term. #[X0] < #[V0] + #[T0] + 1 →
+      ∀X1,X2. X0 ⇒ X1 → X0 ⇒ X2 →
+      ∃∃X. X1 ⇒ X & X2 ⇒ X
+   ) →
+   V0 ⇒ V1 → T0 ⇒ T1 → ⋆. 𝕓{Abbr} V1 ⊢ T1 [O,1] ≫ TT1 →
+   T2 ⇒ X2 → ↑[O, 1] T2 ≡ T0 →
+   ∃∃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 (tps_inv_lift1_eq … HTT1 … HTT21) -HTT1 #HTT1 destruct -T1;
+lapply (tw_lift … HTT20) -HTT20 #HTT20
+elim (IH … HTX2 … HTT2) -HTX2 HTT2 IH /3/
+qed.
+
+(* Basic-1: was: pr0_upsilon_upsilon *)
+fact tpr_conf_theta_theta:
+   ∀VV1,V0,V1,W0,W1,T0,T1,V2,VV2,W2,T2. (
+      ∀X0:term. #[X0] < #[V0] + (#[W0] + #[T0] + 1) + 1 →
+      ∀X1,X2. X0 ⇒ X1 → X0 ⇒ X2 →
+      ∃∃X. X1 ⇒ X & X2 ⇒ X
+   ) →
+   V0 ⇒ V1 → V0 ⇒ V2 → W0 ⇒ W1 → W0 ⇒ W2 → T0 ⇒ T1 → T0 ⇒ T2 →
+   ↑[O, 1] V1 ≡ VV1 → ↑[O, 1] V2 ≡ VV2 →
+   ∃∃X. 𝕔{Abbr} W1. 𝕔{Appl} VV1. T1 ⇒ X & 𝕔{Abbr} W2. 𝕔{Appl} VV2. T2 ⇒ X.
+#VV1 #V0 #V1 #W0 #W1 #T0 #T1 #V2 #VV2 #W2 #T2 #IH #HV01 #HV02 #HW01 #HW02 #HT01 #HT02 #HVV1 #HVV2
+elim (IH … HV01 … HV02) -HV01 HV02 // #V #HV1 #HV2
+elim (IH … HW01 … HW02) -HW01 HW02 // #W #HW1 #HW2
+elim (IH … HT01 … HT02) -HT01 HT02 IH // #T #HT1 #HT2
+elim (lift_total V 0 1) #VV #HVV
+lapply (tpr_lift … HV1 … HVV1 … HVV) -HV1 HVV1 #HVV1
+lapply (tpr_lift … HV2 … HVV2 … HVV) -HV2 HVV2 HVV #HVV2
+@ex2_1_intro [2,3: @tpr_bind |1:skip ] /2 width=5/ (**) (* /4 width=5/ is too slow *)
+qed.
+
+fact tpr_conf_zeta_zeta:
+   ∀V0:term. ∀X2,TT0,T0,T1,T2. (
+      ∀X0:term. #[X0] < #[V0] + #[TT0] + 1 →
+      ∀X1,X2. X0 ⇒ X1 → X0 ⇒ X2 →
+      ∃∃X. X1 ⇒ X & X2 ⇒ X
+   ) →
+   T0 ⇒ T1 → T2 ⇒ X2 →
+   ↑[O, 1] T0 ≡ TT0 → ↑[O, 1] T2 ≡ TT0 →
+   ∃∃X. T1 ⇒ X & X2 ⇒ X.
+#V0 #X2 #TT0 #T0 #T1 #T2 #IH #HT01 #HTX2 #HTT0 #HTT20
+lapply (lift_inj … HTT0 … HTT20) -HTT0 #H destruct -T0;
+lapply (tw_lift … HTT20) -HTT20 #HTT20
+elim (IH … HT01 … HTX2) -HT01 HTX2 IH /2/
+qed.
+
+fact tpr_conf_tau_tau:
+   ∀V0,T0:term. ∀X2,T1. (
+      ∀X0:term. #[X0] < #[V0] + #[T0] + 1 →
+      ∀X1,X2. X0 ⇒ X1 → X0 ⇒ X2 →
+      ∃∃X. X1 ⇒ X & X2 ⇒ X
+   ) →
+   T0 ⇒ T1 → T0 ⇒ X2 →
+   ∃∃X. T1 ⇒ X & X2 ⇒ X.
+#V0 #T0 #X2 #T1 #IH #HT01 #HT02
+elim (IH … HT01 … HT02) -HT01 HT02 IH /2/
+qed.
+
+(* Confluence ***************************************************************)
+
+fact tpr_conf_aux:
+   ∀Y0:term. (
+      ∀X0:term. #[X0] < #[Y0] →
+      ∀X1,X2. X0 ⇒ X1 → X0 ⇒ X2 →
+      ∃∃X. X1 ⇒ X & X2 ⇒ X
+         ) →
+   ∀X0,X1,X2. X0 ⇒ X1 → X0 ⇒ X2 → X0 = Y0 →
+   ∃∃X. X1 ⇒ X & X2 ⇒ X.
+#Y0 #IH #X0 #X1 #X2 * -X0 X1
+[ #I1 #H1 #H2 destruct -Y0;
+  lapply (tpr_inv_atom1 … H1) -H1
+(* case 1: atom, atom *)
+  #H1 destruct -X2 //
+| #I #V0 #V1 #T0 #T1 #HV01 #HT01 #H1 #H2 destruct -Y0;
+  elim (tpr_inv_flat1 … H1) -H1 *
+(* case 2: flat, flat *)
+  [ #V2 #T2 #HV02 #HT02 #H destruct -X2
+    /3 width=7 by tpr_conf_flat_flat/ (**) (* /3 width=7/ is too slow *)
+(* case 3: flat, beta *)
+  | #V2 #W #U0 #T2 #HV02 #HT02 #H1 #H2 #H3 destruct -T0 X2 I
+    /3 width=8 by tpr_conf_flat_beta/ (**) (* /3 width=8/ is too slow *)
+(* case 4: flat, theta *)
+  | #V2 #V #W0 #W2 #U0 #U2 #HV02 #HW02 #HT02 #HV2 #H1 #H2 #H3 destruct -T0 X2 I
+    /3 width=11 by tpr_conf_flat_theta/ (**) (* /3 width=11/ is too slow *)
+(* case 5: flat, tau *)
+  | #HT02 #H destruct -I
+    /3 width=6 by tpr_conf_flat_cast/ (**) (* /3 width=6/ is too slow *)
+  ]
+| #V0 #V1 #W0 #T0 #T1 #HV01 #HT01 #H1 #H2 destruct -Y0;
+  elim (tpr_inv_appl1 … H1) -H1 *
+(* case 6: beta, flat (repeated) *)
+  [ #V2 #T2 #HV02 #HT02 #H destruct -X2
+    @ex2_1_comm /3 width=8 by tpr_conf_flat_beta/
+(* case 7: beta, beta *)
+  | #V2 #WW0 #TT0 #T2 #HV02 #HT02 #H1 #H2 destruct -W0 T0 X2
+    /3 width=8 by tpr_conf_beta_beta/ (**) (* /3 width=8/ is too slow *)
+(* case 8, beta, theta (excluded) *)
+  | #V2 #VV2 #WW0 #W2 #TT0 #T2 #_ #_ #_ #_ #H destruct
+  ]
+| #I1 #V0 #V1 #T0 #T1 #TT1 #HV01 #HT01 #HTT1 #H1 #H2 destruct -Y0;
+  elim (tpr_inv_bind1 … H1) -H1 *
+(* case 9: delta, delta *)
+  [ #V2 #T2 #TT2 #HV02 #HT02 #HTT2 #H destruct -X2
+    /3 width=11 by tpr_conf_delta_delta/ (**) (* /3 width=11/ is too slow *)
+(* case 10: delta, zata *)
+  | #T2 #HT20 #HTX2 #H destruct -I1;
+    /3 width=10 by tpr_conf_delta_zeta/ (**) (* /3 width=10/ is too slow *)
+  ]
+| #VV1 #V0 #V1 #W0 #W1 #T0 #T1 #HV01 #HVV1 #HW01 #HT01 #H1 #H2 destruct -Y0;
+  elim (tpr_inv_appl1 … H1) -H1 *
+(* case 11: theta, flat (repeated) *)
+  [ #V2 #T2 #HV02 #HT02 #H destruct -X2
+    @ex2_1_comm /3 width=11 by tpr_conf_flat_theta/
+(* case 12: theta, beta (repeated) *)
+  | #V2 #WW0 #TT0 #T2 #_ #_ #H destruct
+(* case 13: theta, theta *)
+  | #V2 #VV2 #WW0 #W2 #TT0 #T2 #V02 #HW02 #HT02 #HVV2 #H1 #H2 destruct -W0 T0 X2
+    /3 width=14 by tpr_conf_theta_theta/ (**) (* /3 width=14/ is too slow *)
+  ]
+| #V0 #TT0 #T0 #T1 #HTT0 #HT01 #H1 #H2 destruct -Y0;
+  elim (tpr_inv_abbr1 … H1) -H1 *
+(* case 14: zeta, delta (repeated) *)
+  [ #V2 #T2 #TT2 #HV02 #HT02 #HTT2 #H destruct -X2
+    @ex2_1_comm /3 width=10 by tpr_conf_delta_zeta/
+(* case 15: zeta, zeta *)
+  | #T2 #HTT20 #HTX2
+    /3 width=9 by tpr_conf_zeta_zeta/ (**) (* /3 width=9/ is too slow *)
+  ] 
+| #V0 #T0 #T1 #HT01 #H1 #H2 destruct -Y0;
+  elim (tpr_inv_cast1 … H1) -H1
+(* case 16: tau, flat (repeated) *)
+  [ * #V2 #T2 #HV02 #HT02 #H destruct -X2
+    @ex2_1_comm /3 width=6 by tpr_conf_flat_cast/
+(* case 17: tau, tau *)
+  | #HT02
+    /2 by tpr_conf_tau_tau/
+  ]
+]
+qed.
+
+(* Basic-1: was: pr0_confluence *)
+theorem tpr_conf: ∀T0:term. ∀T1,T2. T0 ⇒ T1 → T0 ⇒ T2 →
+                  ∃∃T. T1 ⇒ T & T2 ⇒ T.
+#T @(tw_wf_ind … T) -T /3 width=6 by tpr_conf_aux/
+qed.
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/reduction/tpr_tps.ma b/matita/matita/contribs/lambda_delta/Basic_2/reduction/tpr_tps.ma
new file mode 100644 (file)
index 0000000..ac2112c
--- /dev/null
@@ -0,0 +1,92 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "Basic-2/unfold/ltpss_ltpss.ma".
+include "Basic-2/reduction/ltpr_drop.ma".
+
+(* CONTEXT-FREE PARALLEL REDUCTION ON TERMS *********************************)
+
+(* Basic-1: was: pr0_subst1 *)
+lemma tpr_tps_ltpr: ∀T1,T2. T1 ⇒ T2 →
+                    ∀L1,d,e,U1. L1 ⊢ T1 [d, e] ≫ U1 →
+                    ∀L2. L1 ⇒ L2 →
+                    ∃∃U2. U1 ⇒ U2 & L2 ⊢ T2 [d, e] ≫* U2.
+#T1 #T2 #H elim H -H T1 T2
+[ #I #L1 #d #e #X #H
+  elim (tps_inv_atom1 … H) -H
+  [ #H destruct -X /2/
+  | * #K1 #V1 #i #Hdi #Hide #HLK1 #HVU1 #H #L2 #HL12 destruct -I;
+    elim (ltpr_drop_conf … HLK1 … HL12) -HLK1 HL12 #X #HLK2 #H
+    elim (ltpr_inv_pair1 … H) -H #K2 #V2 #_ #HV12 #H destruct -X;
+    elim (lift_total V2 0 (i+1)) #U2 #HVU2
+    lapply (tpr_lift … HV12 … HVU1 … HVU2) -HV12 HVU1 #HU12
+    @ex2_1_intro [2: @HU12 | skip | /3/ ] (**) (* /4 width=6/ is too slow *)
+  ]
+| #I #V1 #V2 #T1 #T2 #_ #_ #IHV12 #IHT12 #L1 #d #e #X #H #L2 #HL12
+  elim (tps_inv_flat1 … H) -H #W1 #U1 #HVW1 #HTU1 #H destruct -X;
+  elim (IHV12 … HVW1 … HL12) -IHV12 HVW1;
+  elim (IHT12 … HTU1 … HL12) -IHT12 HTU1 HL12 /3 width=5/
+| #V1 #V2 #W #T1 #T2 #_ #_ #IHV12 #IHT12 #L1 #d #e #X #H #L2 #HL12
+  elim (tps_inv_flat1 … H) -H #VV1 #Y #HVV1 #HY #HX destruct -X;
+  elim (tps_inv_bind1 … HY) -HY #WW #TT1 #_ #HTT1 #H destruct -Y;
+  elim (IHV12 … HVV1 … HL12) -IHV12 HVV1 #VV2 #HVV12 #HVV2
+  elim (IHT12 … HTT1 (L2. 𝕓{Abst} WW) ?) -IHT12 HTT1 /2/ -HL12 #TT2 #HTT12 #HTT2
+  lapply (tpss_leq_repl_dx … HTT2 (L2. 𝕓{Abbr} VV2) ?) -HTT2 /3 width=5/
+| #I #V1 #V2 #T1 #T2 #U2 #HV12 #_ #HTU2 #IHV12 #IHT12 #L1 #d #e #X #H #L2 #HL12
+  elim (tps_inv_bind1 … H) -H #VV1 #TT1 #HVV1 #HTT1 #H destruct -X;
+  elim (IHV12 … HVV1 … HL12) -IHV12 HVV1 #VV2 #HVV12 #HVV2
+  elim (IHT12 … HTT1 (L2. 𝕓{I} VV2) ?) -IHT12 HTT1 /2/ -HL12 #TT2 #HTT12 #HTT2
+  elim (tpss_strip_neq … HTT2 … HTU2 ?) -HTT2 HTU2 T2 /2/ #T2 #HTT2 #HUT2
+  lapply (tps_leq_repl_dx … HTT2 (L2. 𝕓{I} V2) ?) -HTT2 /2/ #HTT2
+  elim (ltpss_tps_conf … HTT2 (L2. 𝕓{I} VV2) (d + 1) e ?) -HTT2 /2/ #W2 #HTTW2 #HTW2 
+  lapply (tpss_leq_repl_dx … HTTW2 (⋆. 𝕓{I} VV2) ?) -HTTW2 /2/ #HTTW2
+  lapply (tpss_tps … HTTW2) -HTTW2 #HTTW2
+  lapply (tpss_leq_repl_dx … HTW2 (L2. 𝕓{I} VV2) ?) -HTW2 /2/ #HTW2
+  lapply (tpss_trans_eq … HUT2 … HTW2) -HUT2 HTW2 /3 width=5/
+| #V #V1 #V2 #W1 #W2 #T1 #T2 #_ #HV2 #_ #_ #IHV12 #IHW12 #IHT12 #L1 #d #e #X #H #L2 #HL12
+  elim (tps_inv_flat1 … H) -H #VV1 #Y #HVV1 #HY #HX destruct -X;
+  elim (tps_inv_bind1 … HY) -HY #WW1 #TT1 #HWW1 #HTT1 #H destruct -Y;
+  elim (IHV12 … HVV1 … HL12) -IHV12 HVV1 #VV2 #HVV12 #HVV2
+  elim (IHW12 … HWW1 … HL12) -IHW12 HWW1 #WW2 #HWW12 #HWW2
+  elim (IHT12 … HTT1 (L2. 𝕓{Abbr} WW2) ?) -IHT12 HTT1 /2/ -HL12 #TT2 #HTT12 #HTT2
+  elim (lift_total VV2 0 1) #VV #H2VV
+  lapply (tpss_lift_ge … HVV2 (L2. 𝕓{Abbr} WW2) … HV2 … H2VV) -HVV2 HV2 /2/ #HVV
+  @ex2_1_intro [2: @tpr_theta |1: skip |3: @tpss_bind [2: @tpss_flat ] ] /width=11/ (**) (* /4 width=11/ is too slow *)
+| #V1 #TT1 #T1 #T2 #HT1 #_ #IHT12 #L1 #d #e #X #H #L2 #HL12
+  elim (tps_inv_bind1 … H) -H #V2 #TT2 #HV12 #HTT12 #H destruct -X;
+  elim (tps_inv_lift1_ge … HTT12 L1 … HT1 ?) -HTT12 HT1 /2/ #T2 #HT12 #HTT2
+  elim (IHT12 … HT12 … HL12) -IHT12 HT12 HL12 <minus_plus_m_m /3/
+| #V1 #T1 #T2 #_ #IHT12 #L1 #d #e #X #H #L2 #HL12
+  elim (tps_inv_flat1 … H) -H #VV1 #TT1 #HVV1 #HTT1 #H destruct -X;
+  elim (IHT12 … HTT1 … HL12) -IHT12 HTT1 HL12 /3/
+]
+qed.
+
+lemma tpr_tps_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.
+#I #V1 #V2 #T1 #T2 #U1 #HV12 #HT12 #HTU1
+elim (tpr_tps_ltpr … HT12 … HTU1 (⋆. 𝕓{I} V2) ?) -HT12 HTU1 /3/
+qed.
+
+lemma tpr_tpss_ltpr: ∀L1,L2. L1 ⇒ L2 → ∀T1,T2. T1 ⇒ T2 →
+                     ∀d,e,U1. L1 ⊢ T1 [d, e] ≫* U1 →
+                     ∃∃U2. U1 ⇒ U2 & L2 ⊢ T2 [d, e] ≫* U2.
+#L1 #L2 #HL12 #T1 #T2 #HT12 #d #e #U1 #HTU1 @(tpss_ind … HTU1) -U1
+[ /2/
+| -HT12 #U #U1 #_ #HU1 * #T #HUT #HT2
+  elim (tpr_tps_ltpr … HUT … HU1 … HL12) -HUT HU1 HL12 #U2 #HU12 #HTU2
+  lapply (tpss_trans_eq … HT2 … HTU2) -T /2/
+]
+qed.  
\ No newline at end of file
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/substitution/drop.ma b/matita/matita/contribs/lambda_delta/Basic_2/substitution/drop.ma
new file mode 100644 (file)
index 0000000..729e3fa
--- /dev/null
@@ -0,0 +1,226 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "Basic-2/grammar/lenv_weight.ma".
+include "Basic-2/grammar/leq.ma".
+include "Basic-2/substitution/lift.ma".
+
+(* DROPPING *****************************************************************)
+
+(* Basic-1: includes: drop_skip_bind *)
+inductive drop: nat → nat → relation lenv ≝
+| drop_atom: ∀d,e. drop d e (⋆) (⋆)
+| drop_pair: ∀L,I,V. drop 0 0 (L. 𝕓{I} V) (L. 𝕓{I} V)
+| drop_drop: ∀L1,L2,I,V,e. drop 0 e L1 L2 → drop 0 (e + 1) (L1. 𝕓{I} V) L2
+| drop_skip: ∀L1,L2,I,V1,V2,d,e.
+             drop d e L1 L2 → ↑[d,e] V2 ≡ V1 →
+             drop (d + 1) e (L1. 𝕓{I} V1) (L2. 𝕓{I} V2)
+.
+
+interpretation "dropping" 'RDrop d e L1 L2 = (drop d e L1 L2).
+
+(* Basic inversion lemmas ***************************************************)
+
+fact drop_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 #_ #_ #H
+  elim (plus_S_eq_O_false … H)
+| #L1 #L2 #I #V1 #V2 #d #e #_ #_ #H
+  elim (plus_S_eq_O_false … H)
+]
+qed.
+
+(* Basic-1: was: drop_gen_refl *)
+lemma drop_inv_refl: ∀L1,L2. ↓[0, 0] L1 ≡ L2 → L1 = L2.
+/2 width=5/ qed.
+
+fact drop_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.
+
+(* Basic-1: was: drop_gen_sort *)
+lemma drop_inv_atom1: ∀d,e,L2. ↓[d, e] ⋆ ≡ L2 → L2 = ⋆.
+/2 width=5/ qed.
+
+fact 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 * -d e L1 L2
+[ #d #e #_ #K #I #V #H destruct
+| #L #I #V #_ #K #J #W #HX destruct -L I V /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)
+]
+qed.
+
+lemma drop_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/ qed.
+
+(* Basic-1: was: drop_gen_drop *)
+lemma drop_inv_drop1: ∀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 (drop_inv_O1 … H) -H * // #H destruct -e;
+elim (lt_refl_false … He)
+qed.
+
+fact drop_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 -X Y Z
+  /2 width=5/
+]
+qed.
+
+(* Basic-1: was: drop_gen_skip_l *)
+lemma drop_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/ qed.
+
+fact drop_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 -X Y Z
+  /2 width=5/
+]
+qed.
+
+(* Basic-1: was: drop_gen_skip_r *)
+lemma drop_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/ qed.
+
+(* Basic properties *********************************************************)
+
+(* Basic-1: was by definition: drop_refl *)
+lemma drop_refl: ∀L. ↓[0, 0] L ≡ L.
+#L elim L -L //
+qed.
+
+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_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
+  lapply (drop_inv_atom1 … H) -H #H destruct
+| #L1 #L2 #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;
+    <minus_n_O <minus_plus_m_m /2/
+  | -HL12;
+    elim (IHL12 … HLK1 ? ?) -IHL12 HLK1 // [2: /2/ ] -Hie >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.
+
+(* Basic forvard lemmas *****************************************************)
+
+(* Basic-1: was: drop_S *)
+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 lapply (drop_inv_atom1 … 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_fwd_lw: ∀L1,L2,d,e. ↓[d, e] L1 ≡ L2 → #[L2] ≤ #[L1].
+#L1 #L2 #d #e #H elim H -H L1 L2 d e // normalize
+[ /2/
+| #L1 #L2 #I #V1 #V2 #d #e #_ #HV21 #IHL12
+  >(tw_lift … HV21) -HV21 /2/
+]
+qed. 
+
+lemma drop_fwd_drop2_length: ∀L1,I2,K2,V2,e.
+                             ↓[0, e] L1 ≡ K2. 𝕓{I2} V2 → e < |L1|.
+#L1 elim L1 -L1
+[ #I2 #K2 #V2 #e #H lapply (drop_inv_atom1 … 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 //
+  | lapply (IHL1 … H) -IHL1 H #HeK1 whd in ⊢ (? ? %) /2/
+  ]
+]
+qed.
+
+lemma drop_fwd_O1_length: ∀L1,L2,e. ↓[0, e] L1 ≡ L2 → |L2| = |L1| - e.
+#L1 elim L1 -L1
+[ #L2 #e #H >(drop_inv_atom1 … H) -H //
+| #K1 #I1 #V1 #IHL1 #L2 #e #H
+  elim (drop_inv_O1 … H) -H * #He #H
+  [ -IHL1; destruct -e L2 //
+  | lapply (IHL1 … H) -IHL1 H #H >H -H; normalize
+    >minus_le_minus_minus_comm //
+  ]
+]
+qed.
+
+(* Basic-1: removed theorems 49:
+            drop_skip_flat
+            cimp_flat_sx cimp_flat_dx cimp_bind cimp_getl_conf
+            drop_clear drop_clear_O drop_clear_S
+            clear_gen_sort clear_gen_bind clear_gen_flat clear_gen_flat_r
+            clear_gen_all clear_clear clear_mono clear_trans clear_ctail clear_cle
+            getl_ctail_clen getl_gen_tail clear_getl_trans getl_clear_trans
+            getl_clear_bind getl_clear_conf getl_dec getl_drop getl_drop_conf_lt
+            getl_drop_conf_ge getl_conf_ge_drop getl_drop_conf_rev
+            drop_getl_trans_lt drop_getl_trans_le drop_getl_trans_ge
+            getl_drop_trans getl_flt getl_gen_all getl_gen_sort getl_gen_O
+            getl_gen_S getl_gen_2 getl_gen_flat getl_gen_bind getl_conf_le
+            getl_trans getl_refl getl_head getl_flat getl_ctail getl_mono
+*)
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/substitution/drop_drop.ma b/matita/matita/contribs/lambda_delta/Basic_2/substitution/drop_drop.ma
new file mode 100644 (file)
index 0000000..9343748
--- /dev/null
@@ -0,0 +1,127 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "Basic-2/substitution/lift_lift.ma".
+include "Basic-2/substitution/drop.ma".
+
+(* DROPPING *****************************************************************)
+
+(* Main properties **********************************************************)
+
+(* Basic-1: was: drop_mono *)
+theorem drop_mono: ∀d,e,L,L1. ↓[d, e] L ≡ L1 →
+                   ∀L2. ↓[d, e] L ≡ L2 → L1 = L2.
+#d #e #L #L1 #H elim H -H d e L L1
+[ #d #e #L2 #H
+  >(drop_inv_atom1 … H) -H L2 //
+| #K #I #V #L2 #HL12
+   <(drop_inv_refl … HL12) -HL12 L2 //
+| #L #K #I #V #e #_ #IHLK #L2 #H
+  lapply (drop_inv_drop1 … H ?) -H /2/
+| #L #K1 #I #T #V1 #d #e #_ #HVT1 #IHLK1 #X #H
+  elim (drop_inv_skip1 … H ?) -H // <minus_plus_m_m #K2 #V2 #HLK2 #HVT2 #H destruct -X
+  >(lift_inj … HVT1 … HVT2) -HVT1 HVT2
+  >(IHLK1 … HLK2) -IHLK1 HLK2 // 
+]
+qed.
+
+(* Basic-1: was: drop_conf_ge *)
+theorem drop_conf_ge: ∀d1,e1,L,L1. ↓[d1, e1] L ≡ L1 →
+                      ∀e2,L2. ↓[0, e2] L ≡ L2 → d1 + e1 ≤ e2 →
+                      ↓[0, e2 - e1] L1 ≡ L2.
+#d1 #e1 #L #L1 #H elim H -H d1 e1 L L1
+[ #d #e #e2 #L2 #H
+  >(drop_inv_atom1 … H) -H L2 //
+| //
+| #L #K #I #V #e #_ #IHLK #e2 #L2 #H #He2
+  lapply (drop_inv_drop1 … H ?) -H /2/ #HL2
+  <minus_plus_comm /3/
+| #L #K #I #V1 #V2 #d #e #_ #_ #IHLK #e2 #L2 #H #Hdee2
+  lapply (transitive_le 1 … Hdee2) // #He2
+  lapply (drop_inv_drop1 … H ?) -H // -He2 #HL2
+  lapply (transitive_le (1 + e) … Hdee2) // #Hee2
+  @drop_drop_lt >minus_minus_comm /3/ (**) (* explicit constructor *)
+]
+qed.
+
+(* Basic-1: was: drop_conf_lt *)
+theorem drop_conf_lt: ∀d1,e1,L,L1. ↓[d1, e1] L ≡ L1 →
+                      ∀e2,K2,I,V2. ↓[0, e2] L ≡ K2. 𝕓{I} V2 →
+                      e2 < d1 → let d ≝ d1 - e2 - 1 in
+                      ∃∃K1,V1. ↓[0, e2] L1 ≡ K1. 𝕓{I} V1 &
+                               ↓[d, e1] K2 ≡ K1 & ↑[d, e1] V1 ≡ V2.
+#d1 #e1 #L #L1 #H elim H -H d1 e1 L L1
+[ #d #e #e2 #K2 #I #V2 #H
+  lapply (drop_inv_atom1 … H) -H #H destruct
+| #L #I #V #e2 #K2 #J #V2 #_ #H
+  elim (lt_zero_false … H)
+| #L1 #L2 #I #V #e #_ #_ #e2 #K2 #J #V2 #_ #H
+  elim (lt_zero_false … H)
+| #L1 #L2 #I #V1 #V2 #d #e #HL12 #HV12 #IHL12 #e2 #K2 #J #V #H #He2d
+  elim (drop_inv_O1 … H) -H *
+  [ -IHL12 He2d #H1 #H2 destruct -e2 K2 J V /2 width=5/
+  | -HL12 -HV12 #He #HLK
+    elim (IHL12 … HLK ?) -IHL12 HLK [ <minus_minus /3 width=5/ | /2/ ] (**) (* a bit slow *)
+  ]
+]
+qed.
+
+(* Basic-1: was: drop_trans_le *)
+theorem drop_trans_le: ∀d1,e1,L1,L. ↓[d1, e1] L1 ≡ L →
+                       ∀e2,L2. ↓[0, e2] L ≡ L2 → e2 ≤ d1 →
+                       ∃∃L0. ↓[0, e2] L1 ≡ L0 & ↓[d1 - e2, e1] L0 ≡ L2.
+#d1 #e1 #L1 #L #H elim H -H d1 e1 L1 L
+[ #d #e #e2 #L2 #H
+  >(drop_inv_atom1 … H) -H L2 /2/
+| #K #I #V #e2 #L2 #HL2 #H
+  lapply (le_O_to_eq_O … H) -H #H destruct -e2 /2/
+| #L1 #L2 #I #V #e #_ #IHL12 #e2 #L #HL2 #H
+  lapply (le_O_to_eq_O … H) -H #H destruct -e2;
+  elim (IHL12 … HL2 ?) -IHL12 HL2 // #L0 #H #HL0
+  lapply (drop_inv_refl … H) -H #H destruct -L1 /3 width=5/
+| #L1 #L2 #I #V1 #V2 #d #e #HL12 #HV12 #IHL12 #e2 #L #H #He2d
+  elim (drop_inv_O1 … H) -H *
+  [ -He2d IHL12 #H1 #H2 destruct -e2 L /3 width=5/
+  | -HL12 HV12 #He2 #HL2
+    elim (IHL12 … HL2 ?) -IHL12 HL2 L2
+    [ >minus_le_minus_minus_comm // /3/ | /2/ ]
+  ]
+]
+qed.
+
+(* Basic-1: was: drop_trans_ge *)
+theorem drop_trans_ge: ∀d1,e1,L1,L. ↓[d1, e1] L1 ≡ L →
+                       ∀e2,L2. ↓[0, e2] L ≡ L2 → d1 ≤ e2 → ↓[0, e1 + e2] L1 ≡ L2.
+#d1 #e1 #L1 #L #H elim H -H d1 e1 L1 L
+[ #d #e #e2 #L2 #H
+  >(drop_inv_atom1 … H) -H L2 //
+| //
+| /3/
+| #L1 #L2 #I #V1 #V2 #d #e #H_ #_ #IHL12 #e2 #L #H #Hde2
+  lapply (lt_to_le_to_lt 0 … Hde2) // #He2
+  lapply (lt_to_le_to_lt … (e + e2) He2 ?) // #Hee2
+  lapply (drop_inv_drop1 … H ?) -H // #HL2
+  @drop_drop_lt // >le_plus_minus // @IHL12 /2/ (**) (* explicit constructor *)
+]
+qed.
+
+theorem 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.
+
+(* Basic-1: was: drop_conf_rev *)
+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/contribs/lambda_delta/Basic_2/substitution/lift.ma b/matita/matita/contribs/lambda_delta/Basic_2/substitution/lift.ma
new file mode 100644 (file)
index 0000000..cccd3b0
--- /dev/null
@@ -0,0 +1,257 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "Basic-2/grammar/term_weight.ma".
+
+(* RELOCATION ***************************************************************)
+
+(* Basic-1: includes:
+            lift_sort lift_lref_lt lift_lref_ge lift_bind lift_flat
+*)
+inductive lift: nat → nat → relation term ≝
+| lift_sort   : ∀k,d,e. lift d e (⋆k) (⋆k)
+| lift_lref_lt: ∀i,d,e. i < d → lift d e (#i) (#i)
+| lift_lref_ge: ∀i,d,e. d ≤ i → lift d e (#i) (#(i + e))
+| lift_bind   : ∀I,V1,V2,T1,T2,d,e.
+                lift d e V1 V2 → lift (d + 1) e T1 T2 →
+                lift d e (𝕓{I} V1. T1) (𝕓{I} V2. T2)
+| lift_flat   : ∀I,V1,V2,T1,T2,d,e.
+                lift d e V1 V2 → lift d e T1 T2 →
+                lift d e (𝕗{I} V1. T1) (𝕗{I} V2. T2)
+.
+
+interpretation "relocation" 'RLift d e T1 T2 = (lift d e T1 T2).
+
+(* Basic properties *********************************************************)
+
+(* Basic-1: was: lift_lref_gt *)
+lemma lift_lref_ge_minus: ∀d,e,i. d + e ≤ i → ↑[d, e] #(i - e) ≡ #i.
+#d #e #i #H >(plus_minus_m_m i e) in ⊢ (? ? ? ? %) /3/
+qed.
+
+(* Basic-1: was: lift_r *)
+lemma lift_refl: ∀T,d. ↑[d, 0] T ≡ T.
+#T elim T -T
+[ * #i // #d elim (lt_or_ge i d) /2/
+| * /2/
+]
+qed.
+
+lemma lift_total: ∀T1,d,e. ∃T2. ↑[d,e] T1 ≡ T2.
+#T1 elim T1 -T1
+[ * #i /2/ #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-1: was: lift_free (right to left) *)
+lemma lift_split: ∀d1,e2,T1,T2. ↑[d1, e2] T1 ≡ T2 → ∀d2,e1.
+                                d1 ≤ d2 → d2 ≤ d1 + e1 → e1 ≤ e2 →
+                                ∃∃T. ↑[d1, e1] T1 ≡ T & ↑[d2, e2 - e1] T ≡ T2.
+#d1 #e2 #T1 #T2 #H elim H -H d1 e2 T1 T2
+[ /3/
+| #i #d1 #e2 #Hid1 #d2 #e1 #Hd12 #_ #_
+  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
+  <(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/
+| #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 … ? ? He12) /3 width = 5/
+]
+qed.
+
+(* Basic forward lemmas *****************************************************)
+
+lemma tw_lift: ∀d,e,T1,T2. ↑[d, e] T1 ≡ T2 → #[T1] = #[T2].
+#d #e #T1 #T2 #H elim H -d e T1 T2; normalize //
+qed.
+
+(* Basic inversion lemmas ***************************************************)
+
+fact lift_inv_refl_aux: ∀d,e,T1,T2. ↑[d, e] T1 ≡ T2 → e = 0 → T1 = T2.
+#d #e #T1 #T2 #H elim H -H d e T1 T2 /3/
+qed.
+
+lemma lift_inv_refl: ∀d,T1,T2. ↑[d, 0] T1 ≡ T2 → T1 = T2.
+/2/ qed.
+
+fact lift_inv_sort1_aux: ∀d,e,T1,T2. ↑[d,e] T1 ≡ T2 → ∀k. T1 = ⋆k → T2 = ⋆k.
+#d #e #T1 #T2 * -d e T1 T2 //
+[ #i #d #e #_ #k #H destruct
+| #I #V1 #V2 #T1 #T2 #d #e #_ #_ #k #H destruct
+| #I #V1 #V2 #T1 #T2 #d #e #_ #_ #k #H destruct
+]
+qed.
+
+lemma lift_inv_sort1: ∀d,e,T2,k. ↑[d,e] ⋆k ≡ T2 → T2 = ⋆k.
+/2 width=5/ qed.
+
+fact lift_inv_lref1_aux: ∀d,e,T1,T2. ↑[d,e] T1 ≡ T2 → ∀i. T1 = #i →
+                         (i < d ∧ T2 = #i) ∨ (d ≤ i ∧ T2 = #(i + e)).
+#d #e #T1 #T2 * -d e T1 T2
+[ #k #d #e #i #H destruct
+| #j #d #e #Hj #i #Hi destruct /3/
+| #j #d #e #Hj #i #Hi destruct /3/
+| #I #V1 #V2 #T1 #T2 #d #e #_ #_ #i #H destruct
+| #I #V1 #V2 #T1 #T2 #d #e #_ #_ #i #H destruct
+]
+qed.
+
+lemma lift_inv_lref1: ∀d,e,T2,i. ↑[d,e] #i ≡ T2 →
+                      (i < d ∧ T2 = #i) ∨ (d ≤ i ∧ T2 = #(i + e)).
+/2/ qed.
+
+lemma lift_inv_lref1_lt: ∀d,e,T2,i. ↑[d,e] #i ≡ T2 → i < d → T2 = #i.
+#d #e #T2 #i #H elim (lift_inv_lref1 … H) -H * //
+#Hdi #_ #Hid lapply (le_to_lt_to_lt … Hdi Hid) -Hdi Hid #Hdd
+elim (lt_refl_false … Hdd)
+qed.
+
+lemma lift_inv_lref1_ge: ∀d,e,T2,i. ↑[d,e] #i ≡ T2 → d ≤ i → T2 = #(i + e).
+#d #e #T2 #i #H elim (lift_inv_lref1 … H) -H * //
+#Hid #_ #Hdi lapply (le_to_lt_to_lt … Hdi Hid) -Hdi Hid #Hdd
+elim (lt_refl_false … Hdd)
+qed.
+
+fact lift_inv_bind1_aux: ∀d,e,T1,T2. ↑[d,e] T1 ≡ T2 →
+                         ∀I,V1,U1. T1 = 𝕓{I} V1.U1 →
+                         ∃∃V2,U2. ↑[d,e] V1 ≡ V2 & ↑[d+1,e] U1 ≡ U2 &
+                                  T2 = 𝕓{I} V2. U2.
+#d #e #T1 #T2 * -d e T1 T2
+[ #k #d #e #I #V1 #U1 #H destruct
+| #i #d #e #_ #I #V1 #U1 #H destruct
+| #i #d #e #_ #I #V1 #U1 #H destruct
+| #J #W1 #W2 #T1 #T2 #d #e #HW #HT #I #V1 #U1 #H destruct /2 width=5/
+| #J #W1 #W2 #T1 #T2 #d #e #HW #HT #I #V1 #U1 #H destruct
+]
+qed.
+
+lemma lift_inv_bind1: ∀d,e,T2,I,V1,U1. ↑[d,e] 𝕓{I} V1. U1 ≡ T2 →
+                      ∃∃V2,U2. ↑[d,e] V1 ≡ V2 & ↑[d+1,e] U1 ≡ U2 &
+                               T2 = 𝕓{I} V2. U2.
+/2/ qed.
+
+fact lift_inv_flat1_aux: ∀d,e,T1,T2. ↑[d,e] T1 ≡ T2 →
+                         ∀I,V1,U1. T1 = 𝕗{I} V1.U1 →
+                         ∃∃V2,U2. ↑[d,e] V1 ≡ V2 & ↑[d,e] U1 ≡ U2 &
+                                  T2 = 𝕗{I} V2. U2.
+#d #e #T1 #T2 * -d e T1 T2
+[ #k #d #e #I #V1 #U1 #H destruct
+| #i #d #e #_ #I #V1 #U1 #H destruct
+| #i #d #e #_ #I #V1 #U1 #H destruct
+| #J #W1 #W2 #T1 #T2 #d #e #HW #HT #I #V1 #U1 #H destruct
+| #J #W1 #W2 #T1 #T2 #d #e #HW #HT #I #V1 #U1 #H destruct /2 width=5/
+]
+qed.
+
+lemma lift_inv_flat1: ∀d,e,T2,I,V1,U1. ↑[d,e] 𝕗{I} V1. U1 ≡ T2 →
+                      ∃∃V2,U2. ↑[d,e] V1 ≡ V2 & ↑[d,e] U1 ≡ U2 &
+                               T2 = 𝕗{I} V2. U2.
+/2/ qed.
+
+fact lift_inv_sort2_aux: ∀d,e,T1,T2. ↑[d,e] T1 ≡ T2 → ∀k. T2 = ⋆k → T1 = ⋆k.
+#d #e #T1 #T2 * -d e T1 T2 //
+[ #i #d #e #_ #k #H destruct
+| #I #V1 #V2 #T1 #T2 #d #e #_ #_ #k #H destruct
+| #I #V1 #V2 #T1 #T2 #d #e #_ #_ #k #H destruct
+]
+qed.
+
+(* Basic-1: was: lift_gen_sort *)
+lemma lift_inv_sort2: ∀d,e,T1,k. ↑[d,e] T1 ≡ ⋆k → T1 = ⋆k.
+/2 width=5/ qed.
+
+fact lift_inv_lref2_aux: ∀d,e,T1,T2. ↑[d,e] T1 ≡ T2 → ∀i. T2 = #i →
+                         (i < d ∧ T1 = #i) ∨ (d + e ≤ i ∧ T1 = #(i - e)).
+#d #e #T1 #T2 * -d e T1 T2
+[ #k #d #e #i #H destruct
+| #j #d #e #Hj #i #Hi destruct /3/
+| #j #d #e #Hj #i #Hi destruct <minus_plus_m_m /4/
+| #I #V1 #V2 #T1 #T2 #d #e #_ #_ #i #H destruct
+| #I #V1 #V2 #T1 #T2 #d #e #_ #_ #i #H destruct
+]
+qed.
+
+(* Basic-1: was: lift_gen_lref *)
+lemma lift_inv_lref2: ∀d,e,T1,i. ↑[d,e] T1 ≡ #i →
+                      (i < d ∧ T1 = #i) ∨ (d + e ≤ i ∧ T1 = #(i - e)).
+/2/ qed.
+
+(* Basic-1: was: lift_gen_lref_lt *)
+lemma lift_inv_lref2_lt: ∀d,e,T1,i. ↑[d,e] T1 ≡ #i → i < d → T1 = #i.
+#d #e #T1 #i #H elim (lift_inv_lref2 … H) -H * //
+#Hdi #_ #Hid lapply (le_to_lt_to_lt … Hdi Hid) -Hdi Hid #Hdd
+elim (plus_lt_false … Hdd)
+qed.
+
+(* Basic-1: was: lift_gen_lref_false *)
+
+(* Basic-1: was: lift_gen_lref_ge *)
+lemma lift_inv_lref2_ge: ∀d,e,T1,i. ↑[d,e] T1 ≡ #i → d + e ≤ i → T1 = #(i - e).
+#d #e #T1 #i #H elim (lift_inv_lref2 … H) -H * //
+#Hid #_ #Hdi lapply (le_to_lt_to_lt … Hdi Hid) -Hdi Hid #Hdd
+elim (plus_lt_false … Hdd)
+qed.
+
+fact lift_inv_bind2_aux: ∀d,e,T1,T2. ↑[d,e] T1 ≡ T2 →
+                         ∀I,V2,U2. T2 = 𝕓{I} V2.U2 →
+                         ∃∃V1,U1. ↑[d,e] V1 ≡ V2 & ↑[d+1,e] U1 ≡ U2 &
+                                  T1 = 𝕓{I} V1. U1.
+#d #e #T1 #T2 * -d e T1 T2
+[ #k #d #e #I #V2 #U2 #H destruct
+| #i #d #e #_ #I #V2 #U2 #H destruct
+| #i #d #e #_ #I #V2 #U2 #H destruct
+| #J #W1 #W2 #T1 #T2 #d #e #HW #HT #I #V2 #U2 #H destruct /2 width=5/
+| #J #W1 #W2 #T1 #T2 #d #e #HW #HT #I #V2 #U2 #H destruct
+]
+qed.
+
+(* Basic-1: was: lift_gen_bind *)
+lemma lift_inv_bind2: ∀d,e,T1,I,V2,U2. ↑[d,e] T1 ≡  𝕓{I} V2. U2 →
+                      ∃∃V1,U1. ↑[d,e] V1 ≡ V2 & ↑[d+1,e] U1 ≡ U2 &
+                               T1 = 𝕓{I} V1. U1.
+/2/ qed.
+
+fact lift_inv_flat2_aux: ∀d,e,T1,T2. ↑[d,e] T1 ≡ T2 →
+                         ∀I,V2,U2. T2 = 𝕗{I} V2.U2 →
+                         ∃∃V1,U1. ↑[d,e] V1 ≡ V2 & ↑[d,e] U1 ≡ U2 &
+                                  T1 = 𝕗{I} V1. U1.
+#d #e #T1 #T2 * -d e T1 T2
+[ #k #d #e #I #V2 #U2 #H destruct
+| #i #d #e #_ #I #V2 #U2 #H destruct
+| #i #d #e #_ #I #V2 #U2 #H destruct
+| #J #W1 #W2 #T1 #T2 #d #e #HW #HT #I #V2 #U2 #H destruct
+| #J #W1 #W2 #T1 #T2 #d #e #HW #HT #I #V2 #U2 #H destruct /2 width = 5/
+]
+qed.
+
+(* Basic-1: was: lift_gen_flat *)
+lemma lift_inv_flat2: ∀d,e,T1,I,V2,U2. ↑[d,e] T1 ≡  𝕗{I} V2. U2 →
+                      ∃∃V1,U1. ↑[d,e] V1 ≡ V2 & ↑[d,e] U1 ≡ U2 &
+                               T1 = 𝕗{I} V1. U1.
+/2/ qed.
+
+(* Basic-1: removed theorems 7:
+            lift_head lift_gen_head
+            lift_weight_map lift_weight lift_weight_add lift_weight_add_O
+            lift_tlt_dx
+*)
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/substitution/lift_lift.ma b/matita/matita/contribs/lambda_delta/Basic_2/substitution/lift_lift.ma
new file mode 100644 (file)
index 0000000..f9c9945
--- /dev/null
@@ -0,0 +1,159 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "Basic-2/substitution/lift.ma".
+
+(* RELOCATION ***************************************************************)
+
+(* Main properies ***********************************************************)
+
+(* Basic-1: was: lift_inj *)
+theorem 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.
+
+(* Basic-1: was: lift_gen_lift *)
+theorem lift_div_le: ∀d1,e1,T1,T. ↑[d1, e1] T1 ≡ T →
+                     ∀d2,e2,T2. ↑[d2 + e1, e2] T2 ≡ T →
+                     d1 ≤ d2 →
+                     ∃∃T0. ↑[d1, e1] T0 ≡ T2 & ↑[d2, e2] T0 ≡ T1.
+#d1 #e1 #T1 #T #H elim H -H d1 e1 T1 T
+[ #k #d1 #e1 #d2 #e2 #T2 #Hk #Hd12
+  lapply (lift_inv_sort2 … Hk) -Hk #Hk destruct -T2 /3/
+| #i #d1 #e1 #Hid1 #d2 #e2 #T2 #Hi #Hd12
+  lapply (lt_to_le_to_lt … Hid1 Hd12) -Hd12 #Hid2
+  lapply (lift_inv_lref2_lt … Hi ?) -Hi /3/
+| #i #d1 #e1 #Hid1 #d2 #e2 #T2 #Hi #Hd12
+  elim (lift_inv_lref2 … Hi) -Hi * #Hid2 #H destruct -T2
+  [ -Hd12; lapply (lt_plus_to_lt_l … Hid2) -Hid2 #Hid2 /3/
+  | -Hid1; lapply (arith1 … Hid2) -Hid2 #Hid2
+    @(ex2_1_intro … #(i - e2))
+    [ >le_plus_minus_comm [ @lift_lref_ge @(transitive_le … Hd12) -Hd12 /2/ | -Hd12 /2/ ]
+    | -Hd12 >(plus_minus_m_m i e2) in ⊢ (? ? ? ? %) /3/
+    ]
+  ]
+| #I #W1 #W #U1 #U #d1 #e1 #_ #_ #IHW #IHU #d2 #e2 #T2 #H #Hd12
+  lapply (lift_inv_bind2 … H) -H * #W2 #U2 #HW2 #HU2 #H destruct -T2;
+  elim (IHW … HW2 ?) // -IHW HW2 #W0 #HW2 #HW1
+  >plus_plus_comm_23 in HU2 #HU2 elim (IHU … HU2 ?) /3 width = 5/
+| #I #W1 #W #U1 #U #d1 #e1 #_ #_ #IHW #IHU #d2 #e2 #T2 #H #Hd12
+  lapply (lift_inv_flat2 … H) -H * #W2 #U2 #HW2 #HU2 #H destruct -T2;
+  elim (IHW … HW2 ?) // -IHW HW2 #W0 #HW2 #HW1
+  elim (IHU … HU2 ?) /3 width = 5/
+]
+qed.
+
+theorem 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.
+
+(* Basic-1: was: lift_free (left to right) *)
+theorem 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.
+#d1 #e1 #T1 #T #H elim H -H d1 e1 T1 T
+[ #k #d1 #e1 #d2 #e2 #T2 #HT2 #_ #_
+  >(lift_inv_sort1 … HT2) -HT2 //
+| #i #d1 #e1 #Hid1 #d2 #e2 #T2 #HT2 #Hd12 #_
+  lapply (lt_to_le_to_lt … Hid1 Hd12) -Hd12 #Hid2
+  lapply (lift_inv_lref1_lt … HT2 Hid2) /2/
+| #i #d1 #e1 #Hid1 #d2 #e2 #T2 #HT2 #_ #Hd21
+  lapply (lift_inv_lref1_ge … HT2 ?) -HT2
+  [ @(transitive_le … Hd21 ?) -Hd21 /2/
+  | -Hd21 /2/
+  ]
+| #I #V1 #V2 #T1 #T2 #d1 #e1 #_ #_ #IHV12 #IHT12 #d2 #e2 #X #HX #Hd12 #Hd21
+  elim (lift_inv_bind1 … HX) -HX #V0 #T0 #HV20 #HT20 #HX destruct -X;
+  lapply (IHV12 … HV20 ? ?) // -IHV12 HV20 #HV10
+  lapply (IHT12 … HT20 ? ?) /2/
+| #I #V1 #V2 #T1 #T2 #d1 #e1 #_ #_ #IHV12 #IHT12 #d2 #e2 #X #HX #Hd12 #Hd21
+  elim (lift_inv_flat1 … HX) -HX #V0 #T0 #HV20 #HT20 #HX destruct -X;
+  lapply (IHV12 … HV20 ? ?) // -IHV12 HV20 #HV10
+  lapply (IHT12 … HT20 ? ?) /2/
+]
+qed.
+
+(* Basic-1: was: lift_d (right to left) *)
+theorem lift_trans_le: ∀d1,e1,T1,T. ↑[d1, e1] T1 ≡ T →
+                       ∀d2,e2,T2. ↑[d2, e2] T ≡ T2 → d2 ≤ d1 →
+                       ∃∃T0. ↑[d2, e2] T1 ≡ T0 & ↑[d1 + e2, e1] T0 ≡ T2.
+#d1 #e1 #T1 #T #H elim H -H d1 e1 T1 T
+[ #k #d1 #e1 #d2 #e2 #X #HX #_
+  >(lift_inv_sort1 … HX) -HX /2/
+| #i #d1 #e1 #Hid1 #d2 #e2 #X #HX #_
+  lapply (lt_to_le_to_lt … (d1+e2) Hid1 ?) // #Hie2
+  elim (lift_inv_lref1 … HX) -HX * #Hid2 #HX destruct -X /4/
+| #i #d1 #e1 #Hid1 #d2 #e2 #X #HX #Hd21
+  lapply (transitive_le … Hd21 Hid1) -Hd21 #Hid2
+  lapply (lift_inv_lref1_ge … HX ?) -HX /2/ #HX destruct -X;
+  >plus_plus_comm_23 /4/
+| #I #V1 #V2 #T1 #T2 #d1 #e1 #_ #_ #IHV12 #IHT12 #d2 #e2 #X #HX #Hd21
+  elim (lift_inv_bind1 … HX) -HX #V0 #T0 #HV20 #HT20 #HX destruct -X;
+  elim (IHV12 … HV20 ?) -IHV12 HV20 //
+  elim (IHT12 … HT20 ?) -IHT12 HT20 /3 width=5/
+| #I #V1 #V2 #T1 #T2 #d1 #e1 #_ #_ #IHV12 #IHT12 #d2 #e2 #X #HX #Hd21
+  elim (lift_inv_flat1 … HX) -HX #V0 #T0 #HV20 #HT20 #HX destruct -X;
+  elim (IHV12 … HV20 ?) -IHV12 HV20 //
+  elim (IHT12 … HT20 ?) -IHT12 HT20 /3 width=5/
+]
+qed.
+
+(* Basic-1: was: lift_d (left to right) *)
+theorem lift_trans_ge: ∀d1,e1,T1,T. ↑[d1, e1] T1 ≡ T →
+                       ∀d2,e2,T2. ↑[d2, e2] T ≡ T2 → d1 + e1 ≤ d2 →
+                       ∃∃T0. ↑[d2 - e1, e2] T1 ≡ T0 & ↑[d1, e1] T0 ≡ T2.
+#d1 #e1 #T1 #T #H elim H -H d1 e1 T1 T
+[ #k #d1 #e1 #d2 #e2 #X #HX #_
+  >(lift_inv_sort1 … HX) -HX /2/
+| #i #d1 #e1 #Hid1 #d2 #e2 #X #HX #Hded
+  lapply (lt_to_le_to_lt … (d1+e1) Hid1 ?) // #Hid1e
+  lapply (lt_to_le_to_lt … (d2-e1) Hid1 ?) /2/ #Hid2e
+  lapply (lt_to_le_to_lt … Hid1e Hded) -Hid1e Hded #Hid2
+  lapply (lift_inv_lref1_lt … HX ?) -HX // #HX destruct -X /3/
+| #i #d1 #e1 #Hid1 #d2 #e2 #X #HX #_
+  elim (lift_inv_lref1 … HX) -HX * #Hied #HX destruct -X;
+  [2: >plus_plus_comm_23] /4/
+| #I #V1 #V2 #T1 #T2 #d1 #e1 #_ #_ #IHV12 #IHT12 #d2 #e2 #X #HX #Hded
+  elim (lift_inv_bind1 … HX) -HX #V0 #T0 #HV20 #HT20 #HX destruct -X;
+  elim (IHV12 … HV20 ?) -IHV12 HV20 //
+  elim (IHT12 … HT20 ?) -IHT12 HT20 /2/ #T
+  <plus_minus /3 width=5/
+| #I #V1 #V2 #T1 #T2 #d1 #e1 #_ #_ #IHV12 #IHT12 #d2 #e2 #X #HX #Hded
+  elim (lift_inv_flat1 … HX) -HX #V0 #T0 #HV20 #HT20 #HX destruct -X;
+  elim (IHV12 … HV20 ?) -IHV12 HV20 //
+  elim (IHT12 … HT20 ?) -IHT12 HT20 /3 width=5/
+]
+qed.
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/substitution/ltps.ma b/matita/matita/contribs/lambda_delta/Basic_2/substitution/ltps.ma
new file mode 100644 (file)
index 0000000..3982ed2
--- /dev/null
@@ -0,0 +1,182 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The 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/tps.ma".
+
+(* PARALLEL SUBSTITUTION ON LOCAL ENVIRONMENTS ******************************)
+
+(* Basic-1: includes: csubst1_bind *)
+inductive ltps: nat → nat → relation lenv ≝
+| ltps_atom: ∀d,e. ltps d e (⋆) (⋆)
+| ltps_pair: ∀L,I,V. ltps 0 0 (L. 𝕓{I} V) (L. 𝕓{I} V)
+| ltps_tps2: ∀L1,L2,I,V1,V2,e.
+             ltps 0 e L1 L2 → L2 ⊢ V1 [0, e] ≫ V2 →
+             ltps 0 (e + 1) (L1. 𝕓{I} V1) L2. 𝕓{I} V2
+| ltps_tps1: ∀L1,L2,I,V1,V2,d,e.
+             ltps d e L1 L2 → L2 ⊢ V1 [d, e] ≫ V2 →
+             ltps (d + 1) e (L1. 𝕓{I} V1) (L2. 𝕓{I} V2)
+.
+
+interpretation "parallel substritution (local environment)"
+   'PSubst L1 d e L2 = (ltps d e L1 L2).
+
+(* Basic properties *********************************************************)
+
+lemma ltps_tps2_lt: ∀L1,L2,I,V1,V2,e.
+                    L1 [0, e - 1] ≫ L2 → L2 ⊢ V1 [0, e - 1] ≫ V2 →
+                    0 < e → L1. 𝕓{I} V1 [0, e] ≫ L2. 𝕓{I} V2.
+#L1 #L2 #I #V1 #V2 #e #HL12 #HV12 #He
+>(plus_minus_m_m e 1) /2/
+qed.
+
+lemma ltps_tps1_lt: ∀L1,L2,I,V1,V2,d,e.
+                    L1 [d - 1, e] ≫ L2 → L2 ⊢ V1 [d - 1, e] ≫ V2 →
+                    0 < d → L1. 𝕓{I} V1 [d, e] ≫ L2. 𝕓{I} V2.
+#L1 #L2 #I #V1 #V2 #d #e #HL12 #HV12 #Hd
+>(plus_minus_m_m d 1) /2/
+qed.
+
+(* Basic-1: was by definition: csubst1_refl *)
+lemma ltps_refl: ∀L,d,e. L [d, e] ≫ L.
+#L elim L -L //
+#L #I #V #IHL * /2/ * /2/
+qed.
+
+(* Basic inversion lemmas ***************************************************)
+
+fact ltps_inv_refl_O2_aux: ∀d,e,L1,L2. L1 [d, e] ≫ L2 → e = 0 → L1 = L2.
+#d #e #L1 #L2 #H elim H -H d e L1 L2 //
+[ #L1 #L2 #I #V1 #V2 #e #_ #_ #_ #H
+  elim (plus_S_eq_O_false … H)
+| #L1 #L2 #I #V1 #V2 #d #e #_ #HV12 #IHL12 #He destruct -e
+  >(IHL12 ?) -IHL12 // >(tps_inv_refl_O2 … HV12) //
+]
+qed.
+
+lemma ltps_inv_refl_O2: ∀d,L1,L2. L1 [d, 0] ≫ L2 → L1 = L2.
+/2/ qed.
+
+fact ltps_inv_atom1_aux: ∀d,e,L1,L2.
+                         L1 [d, e] ≫ L2 → L1 = ⋆ → L2 = ⋆.
+#d #e #L1 #L2 * -d e L1 L2
+[ //
+| #L #I #V #H destruct
+| #L1 #L2 #I #V1 #V2 #e #_ #_ #H destruct
+| #L1 #L2 #I #V1 #V2 #d #e #_ #_ #H destruct
+]
+qed.
+
+lemma ltps_inv_atom1: ∀d,e,L2. ⋆ [d, e] ≫ L2 → L2 = ⋆.
+/2 width=5/ qed.
+
+fact ltps_inv_tps21_aux: ∀d,e,L1,L2. L1 [d, e] ≫ L2 → d = 0 → 0 < e →
+                         ∀K1,I,V1. L1 = K1. 𝕓{I} V1 →
+                         ∃∃K2,V2. K1 [0, e - 1] ≫ K2 &
+                                  K2 ⊢ V1 [0, e - 1] ≫ V2 &
+                                  L2 = K2. 𝕓{I} V2.
+#d #e #L1 #L2 * -d e L1 L2
+[ #d #e #_ #_ #K1 #I #V1 #H destruct
+| #L1 #I #V #_ #H elim (lt_refl_false … H)
+| #L1 #L2 #I #V1 #V2 #e #HL12 #HV12 #_ #_ #K1 #J #W1 #H destruct -L1 I V1 /2 width=5/
+| #L1 #L2 #I #V1 #V2 #d #e #_ #_ #H elim (plus_S_eq_O_false … H)
+]
+qed.
+
+lemma ltps_inv_tps21: ∀e,K1,I,V1,L2. K1. 𝕓{I} V1 [0, e] ≫ L2 → 0 < e →
+                      ∃∃K2,V2. K1 [0, e - 1] ≫ K2 & K2 ⊢ V1 [0, e - 1] ≫ V2 &
+                               L2 = K2. 𝕓{I} V2.
+/2 width=5/ qed.
+
+fact ltps_inv_tps11_aux: ∀d,e,L1,L2. L1 [d, e] ≫ L2 → 0 < d →
+                         ∀I,K1,V1. L1 = K1. 𝕓{I} V1 →
+                         ∃∃K2,V2. K1 [d - 1, e] ≫ K2 &
+                                  K2 ⊢ V1 [d - 1, e] ≫ V2 &
+                                  L2 = K2. 𝕓{I} V2.
+#d #e #L1 #L2 * -d e L1 L2
+[ #d #e #_ #I #K1 #V1 #H destruct
+| #L #I #V #H elim (lt_refl_false … H)
+| #L1 #L2 #I #V1 #V2 #e #_ #_ #H elim (lt_refl_false … H)
+| #L1 #L2 #I #V1 #V2 #d #e #HL12 #HV12 #_ #J #K1 #W1 #H destruct -L1 I V1
+  /2 width=5/
+]
+qed.
+
+lemma ltps_inv_tps11: ∀d,e,I,K1,V1,L2. K1. 𝕓{I} V1 [d, e] ≫ L2 → 0 < d →
+                      ∃∃K2,V2. K1 [d - 1, e] ≫ K2 &
+                                  K2 ⊢ V1 [d - 1, e] ≫ V2 &
+                                  L2 = K2. 𝕓{I} V2.
+/2/ qed.
+
+fact ltps_inv_atom2_aux: ∀d,e,L1,L2.
+                         L1 [d, e] ≫ L2 → L2 = ⋆ → L1 = ⋆.
+#d #e #L1 #L2 * -d e L1 L2
+[ //
+| #L #I #V #H destruct
+| #L1 #L2 #I #V1 #V2 #e #_ #_ #H destruct
+| #L1 #L2 #I #V1 #V2 #d #e #_ #_ #H destruct
+]
+qed.
+
+lemma ltps_inv_atom2: ∀d,e,L1. L1 [d, e] ≫ ⋆ → L1 = ⋆.
+/2 width=5/ qed.
+
+fact ltps_inv_tps22_aux: ∀d,e,L1,L2. L1 [d, e] ≫ L2 → d = 0 → 0 < e →
+                         ∀K2,I,V2. L2 = K2. 𝕓{I} V2 →
+                         ∃∃K1,V1. K1 [0, e - 1] ≫ K2 &
+                                  K2 ⊢ V1 [0, e - 1] ≫ V2 &
+                                  L1 = K1. 𝕓{I} V1.
+#d #e #L1 #L2 * -d e L1 L2
+[ #d #e #_ #_ #K1 #I #V1 #H destruct
+| #L1 #I #V #_ #H elim (lt_refl_false … H)
+| #L1 #L2 #I #V1 #V2 #e #HL12 #HV12 #_ #_ #K2 #J #W2 #H destruct -L2 I V2 /2 width=5/
+| #L1 #L2 #I #V1 #V2 #d #e #_ #_ #H elim (plus_S_eq_O_false … H)
+]
+qed.
+
+lemma ltps_inv_tps22: ∀e,L1,K2,I,V2. L1 [0, e] ≫ K2. 𝕓{I} V2 → 0 < e →
+                      ∃∃K1,V1. K1 [0, e - 1] ≫ K2 & K2 ⊢ V1 [0, e - 1] ≫ V2 &
+                               L1 = K1. 𝕓{I} V1.
+/2 width=5/ qed.
+
+fact ltps_inv_tps12_aux: ∀d,e,L1,L2. L1 [d, e] ≫ L2 → 0 < d →
+                         ∀I,K2,V2. L2 = K2. 𝕓{I} V2 →
+                         ∃∃K1,V1. K1 [d - 1, e] ≫ K2 &
+                                  K2 ⊢ V1 [d - 1, e] ≫ V2 &
+                                  L1 = K1. 𝕓{I} V1.
+#d #e #L1 #L2 * -d e L1 L2
+[ #d #e #_ #I #K2 #V2 #H destruct
+| #L #I #V #H elim (lt_refl_false … H)
+| #L1 #L2 #I #V1 #V2 #e #_ #_ #H elim (lt_refl_false … H)
+| #L1 #L2 #I #V1 #V2 #d #e #HL12 #HV12 #_ #J #K2 #W2 #H destruct -L2 I V2
+  /2 width=5/
+]
+qed.
+
+lemma ltps_inv_tps12: ∀L1,K2,I,V2,d,e. L1 [d, e] ≫ K2. 𝕓{I} V2 → 0 < d →
+                      ∃∃K1,V1. K1 [d - 1, e] ≫ K2 &
+                                  K2 ⊢ V1 [d - 1, e] ≫ V2 &
+                                  L1 = K1. 𝕓{I} V1.
+/2/ qed.
+
+(* Basic-1: removed theorems 27:
+            csubst0_clear_O csubst0_drop_lt csubst0_drop_gt csubst0_drop_eq
+            csubst0_clear_O_back csubst0_clear_S csubst0_clear_trans
+            csubst0_drop_gt_back csubst0_drop_eq_back csubst0_drop_lt_back
+            csubst0_gen_sort csubst0_gen_head csubst0_getl_ge csubst0_getl_lt
+            csubst0_gen_S_bind_2 csubst0_getl_ge_back csubst0_getl_lt_back
+            csubst0_snd_bind csubst0_fst_bind csubst0_both_bind
+            csubst1_head csubst1_flat csubst1_gen_head
+            csubst1_getl_ge csubst1_getl_lt csubst1_getl_ge_back getl_csubst1
+
+*)
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/substitution/ltps_drop.ma b/matita/matita/contribs/lambda_delta/Basic_2/substitution/ltps_drop.ma
new file mode 100644 (file)
index 0000000..dec15ef
--- /dev/null
@@ -0,0 +1,131 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The 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/ltps.ma".
+
+(* PARALLEL SUBSTITUTION ON LOCAL ENVIRONMENTS ******************************)
+
+lemma ltps_drop_conf_ge: ∀L0,L1,d1,e1. L0 [d1, e1] ≫ L1 →
+                         ∀L2,e2. ↓[0, e2] L0 ≡ L2 →
+                         d1 + e1 ≤ e2 → ↓[0, e2] L1 ≡ L2.
+#L0 #L1 #d1 #e1 #H elim H -H L0 L1 d1 e1
+[ #d1 #e1 #L2 #e2 #H >(drop_inv_atom1 … H) -H //
+| //
+| normalize #K0 #K1 #I #V0 #V1 #e1 #_ #_ #IHK01 #L2 #e2 #H #He12
+  lapply (plus_le_weak … He12) #He2
+  lapply (drop_inv_drop1 … H ?) -H // #HK0L2
+  lapply (IHK01 … HK0L2 ?) -IHK01 HK0L2 /2/
+| #K0 #K1 #I #V0 #V1 #d1 #e1 >plus_plus_comm_23 #_ #_ #IHK01 #L2 #e2 #H #Hd1e2
+  lapply (plus_le_weak … Hd1e2) #He2
+  lapply (drop_inv_drop1 … H ?) -H // #HK0L2
+  lapply (IHK01 … HK0L2 ?) -IHK01 HK0L2 /2/
+]
+qed.
+
+lemma ltps_drop_trans_ge: ∀L1,L0,d1,e1. L1 [d1, e1] ≫ L0 →
+                          ∀L2,e2. ↓[0, e2] L0 ≡ L2 →
+                          d1 + e1 ≤ e2 → ↓[0, e2] L1 ≡ L2.
+#L1 #L0 #d1 #e1 #H elim H -H L1 L0 d1 e1
+[ #d1 #e1 #L2 #e2 #H >(drop_inv_atom1 … H) -H //
+| //
+| normalize #K1 #K0 #I #V1 #V0 #e1 #_ #_ #IHK10 #L2 #e2 #H #He12
+  lapply (plus_le_weak … He12) #He2
+  lapply (drop_inv_drop1 … H ?) -H // #HK0L2
+  lapply (IHK10 … HK0L2 ?) -IHK10 HK0L2 /2/
+| #K0 #K1 #I #V1 #V0 #d1 #e1 >plus_plus_comm_23 #_ #_ #IHK10 #L2 #e2 #H #Hd1e2
+  lapply (plus_le_weak … Hd1e2) #He2
+  lapply (drop_inv_drop1 … H ?) -H // #HK0L2
+  lapply (IHK10 … HK0L2 ?) -IHK10 HK0L2 /2/
+]
+qed.
+
+lemma ltps_drop_conf_be: ∀L0,L1,d1,e1. L0 [d1, e1] ≫ L1 →
+                         ∀L2,e2. ↓[0, e2] L0 ≡ L2 → d1 ≤ e2 → e2 ≤ d1 + e1 →
+                         ∃∃L. L2 [0, d1 + e1 - e2] ≫ L & ↓[0, e2] L1 ≡ L.
+#L0 #L1 #d1 #e1 #H elim H -H L0 L1 d1 e1
+[ #d1 #e1 #L2 #e2 #H >(drop_inv_atom1 … H) -H /2/
+| normalize #L #I #V #L2 #e2 #HL2 #_ #He2
+  lapply (le_n_O_to_eq … He2) -He2 #H destruct -e2;
+  lapply (drop_inv_refl … HL2) -HL2 #H destruct -L2 /2/
+| normalize #K0 #K1 #I #V0 #V1 #e1 #HK01 #HV01 #IHK01 #L2 #e2 #H #_ #He21
+  lapply (drop_inv_O1 … H) -H * * #He2 #HK0L2
+  [ destruct -IHK01 He21 e2 L2 <minus_n_O /3/
+  | -HK01 HV01 <minus_le_minus_minus_comm //
+    elim (IHK01 … HK0L2 ? ?) -IHK01 HK0L2 /3/
+  ]
+| #K0 #K1 #I #V0 #V1 #d1 #e1 >plus_plus_comm_23 #_ #_ #IHK01 #L2 #e2 #H #Hd1e2 #He2de1
+  lapply (plus_le_weak … Hd1e2) #He2
+  <minus_le_minus_minus_comm //
+  lapply (drop_inv_drop1 … H ?) -H // #HK0L2
+  elim (IHK01 … HK0L2 ? ?) -IHK01 HK0L2 /3/
+]
+qed.
+
+lemma ltps_drop_trans_be: ∀L1,L0,d1,e1. L1 [d1, e1] ≫ L0 →
+                          ∀L2,e2. ↓[0, e2] L0 ≡ L2 → d1 ≤ e2 → e2 ≤ d1 + e1 →
+                          ∃∃L. L [0, d1 + e1 - e2] ≫ L2 & ↓[0, e2] L1 ≡ L.
+#L1 #L0 #d1 #e1 #H elim H -H L1 L0 d1 e1
+[ #d1 #e1 #L2 #e2 #H >(drop_inv_atom1 … H) -H /2/
+| normalize #L #I #V #L2 #e2 #HL2 #_ #He2
+  lapply (le_n_O_to_eq … He2) -He2 #H destruct -e2;
+  lapply (drop_inv_refl … HL2) -HL2 #H destruct -L2 /2/
+| normalize #K1 #K0 #I #V1 #V0 #e1 #HK10 #HV10 #IHK10 #L2 #e2 #H #_ #He21
+  lapply (drop_inv_O1 … H) -H * * #He2 #HK0L2
+  [ destruct -IHK10 He21 e2 L2 <minus_n_O /3/
+  | -HK10 HV10 <minus_le_minus_minus_comm //
+    elim (IHK10 … HK0L2 ? ?) -IHK10 HK0L2 /3/
+  ]
+| #K1 #K0 #I #V1 #V0 #d1 #e1 >plus_plus_comm_23 #_ #_ #IHK10 #L2 #e2 #H #Hd1e2 #He2de1
+  lapply (plus_le_weak … Hd1e2) #He2
+  <minus_le_minus_minus_comm //
+  lapply (drop_inv_drop1 … H ?) -H // #HK0L2
+  elim (IHK10 … HK0L2 ? ?) -IHK10 HK0L2 /3/
+]
+qed.
+
+lemma ltps_drop_conf_le: ∀L0,L1,d1,e1. L0 [d1, e1] ≫ L1 →
+                         ∀L2,e2. ↓[0, e2] L0 ≡ L2 → e2 ≤ d1 →
+                         ∃∃L. L2 [d1 - e2, e1] ≫ L & ↓[0, e2] L1 ≡ L.
+#L0 #L1 #d1 #e1 #H elim H -H L0 L1 d1 e1
+[ #d1 #e1 #L2 #e2 #H >(drop_inv_atom1 … H) -H /2/
+| /2/
+| normalize #K0 #K1 #I #V0 #V1 #e1 #HK01 #HV01 #_ #L2 #e2 #H #He2
+  lapply (le_n_O_to_eq … He2) -He2 #He2 destruct -e2;
+  lapply (drop_inv_refl … H) -H #H destruct -L2 /3/
+| #K0 #K1 #I #V0 #V1 #d1 #e1 #HK01 #HV01 #IHK01 #L2 #e2 #H #He2d1
+  lapply (drop_inv_O1 … H) -H * * #He2 #HK0L2
+  [ destruct -IHK01 He2d1 e2 L2 <minus_n_O /3/
+  | -HK01 HV01 <minus_le_minus_minus_comm //
+    elim (IHK01 … HK0L2 ?) -IHK01 HK0L2 /3/
+  ]
+]
+qed.
+
+lemma ltps_drop_trans_le: ∀L1,L0,d1,e1. L1 [d1, e1] ≫ L0 →
+                          ∀L2,e2. ↓[0, e2] L0 ≡ L2 → e2 ≤ d1 →
+                          ∃∃L. L [d1 - e2, e1] ≫ L2 & ↓[0, e2] L1 ≡ L.
+#L1 #L0 #d1 #e1 #H elim H -H L1 L0 d1 e1
+[ #d1 #e1 #L2 #e2 #H >(drop_inv_atom1 … H) -H /2/
+| /2/
+| normalize #K1 #K0 #I #V1 #V0 #e1 #HK10 #HV10 #_ #L2 #e2 #H #He2
+  lapply (le_n_O_to_eq … He2) -He2 #He2 destruct -e2;
+  lapply (drop_inv_refl … H) -H #H destruct -L2 /3/
+| #K1 #K0 #I #V1 #V0 #d1 #e1 #HK10 #HV10 #IHK10 #L2 #e2 #H #He2d1
+  lapply (drop_inv_O1 … H) -H * * #He2 #HK0L2
+  [ destruct -IHK10 He2d1 e2 L2 <minus_n_O /3/
+  | -HK10 HV10 <minus_le_minus_minus_comm //
+    elim (IHK10 … HK0L2 ?) -IHK10 HK0L2 /3/
+  ]
+]
+qed.
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/substitution/ltps_tps.ma b/matita/matita/contribs/lambda_delta/Basic_2/substitution/ltps_tps.ma
new file mode 100644 (file)
index 0000000..810295f
--- /dev/null
@@ -0,0 +1,112 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The 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/tps_lift.ma".
+include "Basic-2/substitution/ltps_drop.ma".
+
+(* PARALLEL SUBSTITUTION ON LOCAL ENVIRONMENTS ******************************)
+
+lemma ltps_tps_conf_ge: ∀L0,T2,U2,d2,e2. L0 ⊢ T2 [d2, e2] ≫ U2 →
+                        ∀L1,d1,e1. L0 [d1, e1] ≫ L1 → d1 + e1 ≤ d2 →
+                        L1 ⊢ T2 [d2, e2] ≫ U2.
+#L0 #T2 #U2 #d2 #e2 #H elim H -H L0 T2 U2 d2 e2
+[ //
+| #L0 #K0 #V0 #W0 #i2 #d2 #e2 #Hdi2 #Hide2 #HLK0 #HVW0 #L1 #d1 #e1 #HL01 #Hde1d2
+  lapply (transitive_le … Hde1d2 Hdi2) -Hde1d2 #Hde1i2
+  lapply (ltps_drop_conf_ge … HL01 … HLK0 ?) -HL01 HLK0 /2/
+| #L0 #I #V2 #W2 #T2 #U2 #d2 #e2 #_ #_ #IHVW2 #IHTU2 #L1 #d1 #e1 #HL01 #Hde1d2
+  @tps_bind [ /2/ | @IHTU2 [3: /2/ |1,2: skip | /2/ ] ] (**) (* /3/ is too slow *)
+| /3/
+]
+qed.
+
+(* Basic-1: was: subst1_subst1_back *)
+lemma ltps_tps_conf: ∀L0,T2,U2,d2,e2. L0 ⊢ T2 [d2, e2] ≫ U2 →
+                     ∀L1,d1,e1. L0 [d1, e1] ≫ L1 →
+                     ∃∃T. L1 ⊢ T2 [d2, e2] ≫ T &
+                          L1 ⊢ U2 [d1, e1] ≫ T.
+#L0 #T2 #U2 #d2 #e2 #H elim H -H L0 T2 U2 d2 e2
+[ /2/
+| #L0 #K0 #V0 #W0 #i2 #d2 #e2 #Hdi2 #Hide2 #HLK0 #HVW0 #L1 #d1 #e1 #HL01
+  elim (lt_or_ge i2 d1) #Hi2d1
+  [ elim (ltps_drop_conf_le … HL01 … HLK0 ?) -HL01 HLK0 /2/ #X #H #HLK1
+    elim (ltps_inv_tps11 … H ?) -H [2: /2/ ] #K1 #V1 #_ #HV01 #H destruct -X;
+    lapply (drop_fwd_drop2 … HLK1) #H
+    elim (lift_total V1 0 (i2 + 1)) #W1 #HVW1
+    lapply (tps_lift_ge … HV01 … H HVW0 HVW1 ?) -H HV01 HVW0 // >arith_a2 /3/
+  | elim (lt_or_ge i2 (d1 + e1)) #Hde1i2
+    [ elim (ltps_drop_conf_be … HL01 … HLK0 ? ?) -HL01 HLK0 [2,3: /2/ ] #X #H #HLK1
+      elim (ltps_inv_tps21 … H ?) -H [2: /2/ ] #K1 #V1 #_ #HV01 #H destruct -X;
+      lapply (drop_fwd_drop2 … HLK1) #H
+      elim (lift_total V1 0 (i2 + 1)) #W1 #HVW1
+      lapply (tps_lift_ge … HV01 … H HVW0 HVW1 ?) -H HV01 HVW0 // normalize #HW01
+      lapply (tps_weak … HW01 d1 e1 ? ?) [2,3: /3/ ] >arith_i2 //
+    | lapply (ltps_drop_conf_ge … HL01 … HLK0 ?) -HL01 HLK0 /3/
+    ]
+  ]
+| #L0 #I #V2 #W2 #T2 #U2 #d2 #e2 #_ #_ #IHVW2 #IHTU2 #L1 #d1 #e1 #HL01
+  elim (IHVW2 … HL01) -IHVW2 #V #HV2 #HVW2
+  elim (IHTU2 (L1. 𝕓{I} V) (d1 + 1) e1 ?) -IHTU2 [2: /2/ ] -HL01 /3 width=5/
+| #L0 #I #V2 #W2 #T2 #U2 #d2 #e2 #_ #_ #IHVW2 #IHTU2 #L1 #d1 #e1 #HL01
+  elim (IHVW2 … HL01) -IHVW2;
+  elim (IHTU2 … HL01) -IHTU2 HL01 /3 width=5/
+]
+qed.
+
+lemma ltps_tps_trans_ge: ∀L0,T2,U2,d2,e2. L0 ⊢ T2 [d2, e2] ≫ U2 →
+                         ∀L1,d1,e1. L1 [d1, e1] ≫ L0 → d1 + e1 ≤ d2 →
+                         L1 ⊢ T2 [d2, e2] ≫ U2.
+#L0 #T2 #U2 #d2 #e2 #H elim H -H L0 T2 U2 d2 e2
+[ //
+| #L0 #K0 #V0 #W0 #i2 #d2 #e2 #Hdi2 #Hide2 #HLK0 #HVW0 #L1 #d1 #e1 #HL10 #Hde1d2
+  lapply (transitive_le … Hde1d2 Hdi2) -Hde1d2 #Hde1i2
+  lapply (ltps_drop_trans_ge … HL10 … HLK0 ?) -HL10 HLK0 /2/
+| #L0 #I #V2 #W2 #T2 #U2 #d2 #e2 #_ #_ #IHVW2 #IHTU2 #L1 #d1 #e1 #HL10 #Hde1d2
+  @tps_bind [ /2/ | @IHTU2 [3: /2/ |1,2: skip | /2/ ] ] (**) (* /3/ is too slow *)
+| /3/
+]
+qed.
+
+(* Basic-1: was: subst1_subst1 *)
+lemma ltps_tps_trans: ∀L0,T2,U2,d2,e2. L0 ⊢ T2 [d2, e2] ≫ U2 →
+                      ∀L1,d1,e1. L1 [d1, e1] ≫ L0 →
+                      ∃∃T. L1 ⊢ T2 [d2, e2] ≫ T &
+                           L0 ⊢ T [d1, e1] ≫ U2.
+#L0 #T2 #U2 #d2 #e2 #H elim H -H L0 T2 U2 d2 e2
+[ /2/
+| #L0 #K0 #V0 #W0 #i2 #d2 #e2 #Hdi2 #Hide2 #HLK0 #HVW0 #L1 #d1 #e1 #HL10
+  elim (lt_or_ge i2 d1) #Hi2d1
+  [ elim (ltps_drop_trans_le … HL10 … HLK0 ?) -HL10 /2/ #X #H #HLK1
+    elim (ltps_inv_tps12 … H ?) -H [2: /2/ ] #K1 #V1 #_ #HV01 #H destruct -X;
+    lapply (drop_fwd_drop2 … HLK0) -HLK0 #H
+    elim (lift_total V1 0 (i2 + 1)) #W1 #HVW1
+    lapply (tps_lift_ge … HV01 … H HVW1 HVW0 ?) -H HV01 HVW0 // >arith_a2 /3/
+  | elim (lt_or_ge i2 (d1 + e1)) #Hde1i2
+    [ elim (ltps_drop_trans_be … HL10 … HLK0 ? ?) -HL10 [2,3: /2/ ] #X #H #HLK1
+      elim (ltps_inv_tps22 … H ?) -H [2: /2/ ] #K1 #V1 #_ #HV01 #H destruct -X;
+      lapply (drop_fwd_drop2 … HLK0) -HLK0 #H
+      elim (lift_total V1 0 (i2 + 1)) #W1 #HVW1
+      lapply (tps_lift_ge … HV01 … H HVW1 HVW0 ?) -H HV01 HVW0 // normalize #HW01
+      lapply (tps_weak … HW01 d1 e1 ? ?) [2,3: /3/ ] >arith_i2 //
+    | lapply (ltps_drop_trans_ge … HL10 … HLK0 ?) -HL10 HLK0 /3/
+    ]
+  ]
+| #L0 #I #V2 #W2 #T2 #U2 #d2 #e2 #_ #_ #IHVW2 #IHTU2 #L1 #d1 #e1 #HL10
+  elim (IHVW2 … HL10) -IHVW2 #V #HV2 #HVW2
+  elim (IHTU2 (L1. 𝕓{I} V) (d1 + 1) e1 ?) -IHTU2 [2: /2/ ] -HL10 /3 width=5/
+| #L0 #I #V2 #W2 #T2 #U2 #d2 #e2 #_ #_ #IHVW2 #IHTU2 #L1 #d1 #e1 #HL10
+  elim (IHVW2 … HL10) -IHVW2;
+  elim (IHTU2 … HL10) -IHTU2 HL10 /3 width=5/
+]
+qed.
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/substitution/tps.ma b/matita/matita/contribs/lambda_delta/Basic_2/substitution/tps.ma
new file mode 100644 (file)
index 0000000..7197a53
--- /dev/null
@@ -0,0 +1,221 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "Basic-2/grammar/cl_weight.ma".
+include "Basic-2/substitution/drop.ma".
+
+(* PARALLEL SUBSTITUTION ON TERMS *******************************************)
+
+inductive tps: nat → nat → lenv → relation term ≝
+| tps_atom : ∀L,I,d,e. tps d e L (𝕒{I}) (𝕒{I})
+| tps_subst: ∀L,K,V,W,i,d,e. d ≤ i → i < d + e →
+             ↓[0, i] L ≡ K. 𝕓{Abbr} V → ↑[0, i + 1] V ≡ W → tps d e L (#i) W
+| tps_bind : ∀L,I,V1,V2,T1,T2,d,e.
+             tps d e L V1 V2 → tps (d + 1) e (L. 𝕓{I} V2) T1 T2 →
+             tps d e L (𝕓{I} V1. T1) (𝕓{I} V2. T2)
+| tps_flat : ∀L,I,V1,V2,T1,T2,d,e.
+             tps d e L V1 V2 → tps d e L T1 T2 →
+             tps d e L (𝕗{I} V1. T1) (𝕗{I} V2. T2)
+.
+
+interpretation "parallel substritution (term)"
+   'PSubst L T1 d e T2 = (tps d e L T1 T2).
+
+(* Basic properties *********************************************************)
+
+lemma tps_leq_repl_dx: ∀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 #W #i #d #e #Hdi #Hide #HLK1 #HVW #L2 #HL12
+  elim (drop_leq_drop1 … HL12 … HLK1 ? ?) -HL12 HLK1 // /2/
+| /4/
+| /3/
+]
+qed.
+
+lemma tps_refl: ∀T,L,d,e. L ⊢ T [d, e] ≫ T.
+#T elim T -T //
+#I elim I -I /2/
+qed.
+
+lemma tps_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 #T2 #d1 #e1 #H elim H -H L T1 T2 d1 e1
+[ //
+| #L #K #V #W #i #d1 #e1 #Hid1 #Hide1 #HLK #HVW #d2 #e2 #Hd12 #Hde12
+  lapply (transitive_le … Hd12 … Hid1) -Hd12 Hid1 #Hid2
+  lapply (lt_to_le_to_lt … Hide1 … Hde12) -Hide1 /2/
+| /4/
+| /4/
+]
+qed.
+
+lemma tps_weak_top: ∀L,T1,T2,d,e.
+                    L ⊢ T1 [d, e] ≫ T2 → L ⊢ T1 [d, |L| - d] ≫ T2.
+#L #T1 #T2 #d #e #H elim H -H L T1 T2 d e
+[ //
+| #L #K #V #W #i #d #e #Hdi #_ #HLK #HVW
+  lapply (drop_fwd_drop2_length … HLK) #Hi
+  lapply (le_to_lt_to_lt … Hdi Hi) #Hd
+  lapply (plus_minus_m_m_comm (|L|) d ?) /2/
+| normalize /2/
+| /2/
+]
+qed.
+
+lemma tps_weak_all: ∀L,T1,T2,d,e.
+                    L ⊢ T1 [d, e] ≫ T2 → L ⊢ T1 [0, |L|] ≫ T2.
+#L #T1 #T2 #d #e #HT12
+lapply (tps_weak … HT12 0 (d + e) ? ?) -HT12 // #HT12
+lapply (tps_weak_top … HT12) //
+qed.
+
+lemma tps_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 -H L T1 T2 d e
+[ /2/
+| #L #K #V #W #i #d #e #Hdi #Hide #HLK #HVW #j #Hdj #Hjde
+  elim (lt_or_ge i j)
+  [ -Hide Hjde;
+    >(plus_minus_m_m_comm j d) in ⊢ (% → ?) // -Hdj /3/
+  | -Hdi Hdj; #Hid
+    generalize in match Hide -Hide (**) (* rewriting in the premises, rewrites in the goal too *)
+    >(plus_minus_m_m_comm … Hjde) in ⊢ (% → ?) -Hjde /4/
+  ]
+| #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
+  lapply (tps_leq_repl_dx … HT1 (L. 𝕓{I} V) ?) -HT1 /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.
+
+(* Basic inversion lemmas ***************************************************)
+
+fact tps_inv_atom1_aux: ∀L,T1,T2,d,e. L ⊢ T1 [d, e] ≫ T2 → ∀I. T1 = 𝕒{I} →
+                        T2 = 𝕒{I} ∨
+                        ∃∃K,V,i. d ≤ i & i < d + e &
+                                 ↓[O, i] L ≡ K. 𝕓{Abbr} V &
+                                 ↑[O, i + 1] V ≡ T2 &
+                                 I = LRef i.
+#L #T1 #T2 #d #e * -L T1 T2 d e
+[ #L #I #d #e #J #H destruct -I /2/
+| #L #K #V #T2 #i #d #e #Hdi #Hide #HLK #HVT2 #I #H destruct -I /3 width=8/
+| #L #I #V1 #V2 #T1 #T2 #d #e #_ #_ #J #H destruct
+| #L #I #V1 #V2 #T1 #T2 #d #e #_ #_ #J #H destruct
+]
+qed.
+
+lemma tps_inv_atom1: ∀L,T2,I,d,e. L ⊢ 𝕒{I} [d, e] ≫ T2 →
+                     T2 = 𝕒{I} ∨
+                     ∃∃K,V,i. d ≤ i & i < d + e &
+                              ↓[O, i] L ≡ K. 𝕓{Abbr} V &
+                              ↑[O, i + 1] V ≡ T2 &
+                              I = LRef i.
+/2/ qed.
+
+
+(* Basic-1: was: subst1_gen_sort *)
+lemma tps_inv_sort1: ∀L,T2,k,d,e. L ⊢ ⋆k [d, e] ≫ T2 → T2 = ⋆k.
+#L #T2 #k #d #e #H
+elim (tps_inv_atom1 … H) -H //
+* #K #V #i #_ #_ #_ #_ #H destruct
+qed.
+
+(* Basic-1: was: subst1_gen_lref *)
+lemma tps_inv_lref1: ∀L,T2,i,d,e. L ⊢ #i [d, e] ≫ T2 →
+                     T2 = #i ∨
+                     ∃∃K,V. d ≤ i & i < d + e &
+                            ↓[O, i] L ≡ K. 𝕓{Abbr} V &
+                            ↑[O, i + 1] V ≡ T2.
+#L #T2 #i #d #e #H
+elim (tps_inv_atom1 … H) -H /2/
+* #K #V #j #Hdj #Hjde #HLK #HVT2 #H destruct -i /3/
+qed.
+
+fact tps_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} V2 ⊢ 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 #K #V #W #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 tps_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} V2 ⊢ T1 [d + 1, e] ≫ T2 &
+                              U2 =  𝕓{I} V2. T2.
+/2/ qed.
+
+fact tps_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 #K #V #W #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 tps_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.
+
+fact tps_inv_refl_O2_aux: ∀L,T1,T2,d,e. L ⊢ T1 [d, e] ≫ T2 → e = 0 → T1 = T2.
+#L #T1 #T2 #d #e #H elim H -H L T1 T2 d e
+[ //
+| #L #K #V #W #i #d #e #Hdi #Hide #_ #_ #H destruct -e;
+  lapply (le_to_lt_to_lt … Hdi … Hide) -Hdi Hide <plus_n_O #Hdd
+  elim (lt_refl_false … Hdd)
+| /3/
+| /3/
+]
+qed.
+
+lemma tps_inv_refl_O2: ∀L,T1,T2,d. L ⊢ T1 [d, 0] ≫ T2 → T1 = T2.
+/2 width=6/ qed.
+
+(* Basic forward lemmas *****************************************************)
+
+lemma tps_fwd_tw: ∀L,T1,T2,d,e. L ⊢ T1 [d, e] ≫ T2 → #[T1] ≤ #[T2].
+#L #T1 #T2 #d #e #H elim H normalize -H L T1 T2 d e
+[ //
+| /2/
+| /3 by monotonic_le_plus_l, le_plus/ (**) (* just /3/ is too slow *)
+| /3 by monotonic_le_plus_l, le_plus/ (**) (* just /3/ is too slow *)
+] 
+qed.
+
+(* Basic-1: removed theorems 25:
+            subst0_gen_sort subst0_gen_lref subst0_gen_head subst0_gen_lift_lt
+            subst0_gen_lift_false subst0_gen_lift_ge subst0_refl subst0_trans
+            subst0_lift_lt subst0_lift_ge subst0_lift_ge_S subst0_lift_ge_s
+            subst0_subst0 subst0_subst0_back subst0_weight_le subst0_weight_lt
+            subst0_confluence_neq subst0_confluence_eq subst0_tlt_head
+            subst0_confluence_lift subst0_tlt
+            subst1_head subst1_gen_head subst1_lift_S subst1_confluence_lift 
+*)
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/substitution/tps_lift.ma b/matita/matita/contribs/lambda_delta/Basic_2/substitution/tps_lift.ma
new file mode 100644 (file)
index 0000000..c5fca2c
--- /dev/null
@@ -0,0 +1,200 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "Basic-2/substitution/drop_drop.ma".
+include "Basic-2/substitution/tps.ma".
+
+(* PARTIAL SUBSTITUTION ON TERMS ********************************************)
+
+(* Advanced inversion lemmas ************************************************)
+
+fact tps_inv_refl_SO2_aux: ∀L,T1,T2,d,e. L ⊢ T1 [d, e] ≫ T2 → e = 1 →
+                           ∀K,V. ↓[0, d] L ≡ K. 𝕓{Abst} V → T1 = T2.
+#L #T1 #T2 #d #e #H elim H -H L T1 T2 d e
+[ //
+| #L #K0 #V0 #W #i #d #e #Hdi #Hide #HLK0 #_ #H destruct -e;
+  >(le_to_le_to_eq … Hdi ?) /2/ -d #K #V #HLK
+  lapply (drop_mono … HLK0 … HLK) #H destruct
+| #L #I #V1 #V2 #T1 #T2 #d #e #_ #_ #IHV12 #IHT12 #H1 #K #V #HLK
+  >(IHV12 H1 … HLK) -IHV12 >(IHT12 H1 K V) -IHT12 /2/
+| #L #I #V1 #V2 #T1 #T2 #d #e #_ #_ #IHV12 #IHT12 #H1 #K #V #HLK
+  >(IHV12 H1 … HLK) -IHV12 >(IHT12 H1 … HLK) -IHT12 //
+]
+qed.
+
+lemma tps_inv_refl_SO2: ∀L,T1,T2,d. L ⊢ T1 [d, 1] ≫ T2 →
+                        ∀K,V. ↓[0, d] L ≡ K. 𝕓{Abst} V → T1 = T2.
+/2 width=8/ qed.
+
+(* Relocation properties ****************************************************)
+
+(* Basic-1: was: subst1_lift_lt *)
+lemma tps_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 #I #dt #et #L #U1 #U2 #d #e #_ #H1 #H2 #_
+  >(lift_mono … H1 … H2) -H1 H2 //
+| #K #KV #V #W #i #dt #et #Hdti #Hidet #HKV #HVW #L #U1 #U2 #d #e #HLK #H #HVU2 #Hdetd
+  lapply (lt_to_le_to_lt … Hidet … Hdetd) -Hdetd #Hid
+  lapply (lift_inv_lref1_lt … H … Hid) -H #H destruct -U1;
+  elim (lift_trans_ge … HVW … HVU2 ?) -HVW HVU2 W // <minus_plus #W #HVW #HWU2
+  elim (drop_trans_le … HLK … HKV ?) -HLK HKV K [2: /2/] #X #HLK #H
+  elim (drop_inv_skip2 … H ?) -H [2: /2/] -Hid #K #Y #_ #HVY
+  >(lift_mono … HVY … HVW) -HVY HVW Y #H destruct -X /2/
+| #K #I #V1 #V2 #T1 #T2 #dt #et #_ #_ #IHV12 #IHT12 #L #U1 #U2 #d #e #HLK #H1 #H2 #Hdetd
+  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;
+  @tps_bind [ /2 width=6/ | @IHT12 [3,4,5: /2/ |1,2: skip | /2/ ] ] (**) (* /3 width=6/ is too slow, arith3 needed to avoid crash *)
+| #K #I #V1 #V2 #T1 #T2 #dt #et #_ #_ #IHV12 #IHT12 #L #U1 #U2 #d #e #HLK #H1 #H2 #Hdetd
+  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=6/
+]
+qed.
+
+(* Basic-1: was: subst1_lift_ge *)
+lemma tps_lift_ge: ∀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 →
+                   d ≤ dt →
+                   L ⊢ U1 [dt + e, et] ≫ U2.
+#K #T1 #T2 #dt #et #H elim H -H K T1 T2 dt et
+[ #K #I #dt #et #L #U1 #U2 #d #e #_ #H1 #H2 #_
+  >(lift_mono … H1 … H2) -H1 H2 //
+| #K #KV #V #W #i #dt #et #Hdti #Hidet #HKV #HVW #L #U1 #U2 #d #e #HLK #H #HWU2 #Hddt
+  lapply (transitive_le … Hddt … Hdti) -Hddt #Hid
+  lapply (lift_inv_lref1_ge … H … Hid) -H #H destruct -U1;
+  lapply (lift_trans_be … HVW … HWU2 ? ?) -HVW HWU2 W // [ /2/ ] >plus_plus_comm_23 #HVU2
+  lapply (drop_trans_ge_comm … HLK … HKV ?) -HLK HKV K // -Hid /3/
+| #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;
+  @tps_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.
+
+(* Basic-1: was: subst1_gen_lift_lt *)
+lemma tps_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 * #i #dt #et #K #d #e #_ #T1 #H #_
+  [ lapply (lift_inv_sort2 … H) -H #H destruct -T1 /2/
+  | elim (lift_inv_lref2 … H) -H * #Hid #H destruct -T1 /3/
+  ]
+| #L #KV #V #W #i #dt #et #Hdti #Hidet #HLKV #HVW #K #d #e #HLK #T1 #H #Hdetd
+  lapply (lt_to_le_to_lt … Hidet … Hdetd) -Hdetd #Hid
+  lapply (lift_inv_lref2_lt … H … Hid) -H #H destruct -T1;
+  elim (drop_conf_lt … HLK … HLKV ?) -HLK HLKV L // #L #U #HKL #_ #HUV
+  elim (lift_trans_le … HUV … HVW ?) -HUV HVW V // >arith_a2 // -Hid /3/
+| #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 HWV1 // #W2 #HW12 #HWV2
+  elim (IHU12 … HTU1 ?) -IHU12 HTU1 [3: /2/ |4: @drop_skip // |2: skip ] -HLK Hdetd (**) (* /3 width=5/ is too slow *)
+  /3 width=5/
+| #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.
+
+(* Basic-1: was: subst1_gen_lift_ge *)
+lemma tps_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 * #i #dt #et #K #d #e #_ #T1 #H #_
+  [ lapply (lift_inv_sort2 … H) -H #H destruct -T1 /2/
+  | elim (lift_inv_lref2 … H) -H * #Hid #H destruct -T1 /3/
+  ]
+| #L #KV #V #W #i #dt #et #Hdti #Hidet #HLKV #HVW #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  
+  lapply (lift_inv_lref2_ge … H … Hdei) -H #H destruct -T1;
+  lapply (drop_conf_ge … HLK … HLKV ?) -HLK HLKV L // #HKV
+  elim (lift_split … HVW d (i - e + 1) ? ? ?) -HVW; [2,3,4: normalize /2/ ] -Hdei >arith_e2 // #V0 #HV10 #HV02
+  @ex2_1_intro
+  [2: @tps_subst [3: /2/ |5,6: // |1,2: skip |4: @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 HWV1 // #W2 #HW12 #HWV2
+  elim (IHU12 … HTU1 ?) -IHU12 HTU1 [4: @drop_skip // |2: skip |3: /2/ ]
+  <plus_minus // /3 width=5/
+| #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.
+
+(* Basic-1: was: subst1_gen_lift_eq *)
+lemma tps_inv_lift1_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 #W #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.
+(*
+      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)).
+*)
+
+lemma tps_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 (tps_split_up … HU12 (d + e) ? ?) -HU12 // -Hdedet #U #HU1 #HU2
+lapply (tps_weak … HU1 d e ? ?) -HU1 // <plus_minus_m_m_comm // -Hddt Hdtde #HU1
+lapply (tps_inv_lift1_eq … HU1 … HTU1) -HU1 #HU1 destruct -U1;
+elim (tps_inv_lift1_ge … HU2 … HLK … HTU1 ?) -HU2 HLK HTU1 // <minus_plus_m_m /2/
+qed.
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/substitution/tps_tps.ma b/matita/matita/contribs/lambda_delta/Basic_2/substitution/tps_tps.ma
new file mode 100644 (file)
index 0000000..fda5cba
--- /dev/null
@@ -0,0 +1,132 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The 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/tps_lift.ma".
+
+(* PARALLEL SUBSTITUTION ON TERMS *******************************************)
+
+(* Main properties **********************************************************)
+
+(* Basic-1: was: subst1_confluence_eq *)
+theorem tps_conf_eq: ∀L,T0,T1,d1,e1. L ⊢ T0 [d1, e1] ≫ T1 →
+                     ∀T2,d2,e2. L ⊢ T0 [d2, e2] ≫ T2 →
+                     ∃∃T. L ⊢ T1 [d2, e2] ≫ T & L ⊢ T2 [d1, e1] ≫ T.
+#L #T0 #T1 #d1 #e1 #H elim H -H L T0 T1 d1 e1
+[ /2/
+| #L #K1 #V1 #T1 #i0 #d1 #e1 #Hd1 #Hde1 #HLK1 #HVT1 #T2 #d2 #e2 #H
+  elim (tps_inv_lref1 … H) -H
+  [ #HX destruct -T2 /4/
+  | -Hd1 Hde1 * #K2 #V2 #_ #_ #HLK2 #HVT2
+    lapply (drop_mono … HLK1 … HLK2) -HLK1 HLK2 #H destruct -V1 K1
+    >(lift_mono … HVT1 … HVT2) -HVT1 HVT2 /2/
+  ]
+| #L #I #V0 #V1 #T0 #T1 #d1 #e1 #_ #_ #IHV01 #IHT01 #X #d2 #e2 #HX
+  elim (tps_inv_bind1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct -X;
+  lapply (tps_leq_repl_dx … HT02 (L. 𝕓{I} V1) ?) -HT02 /2/ #HT02  
+  elim (IHV01 … HV02) -IHV01 HV02 #V #HV1 #HV2
+  elim (IHT01 … HT02) -IHT01 HT02 #T #HT1 #HT2
+  lapply (tps_leq_repl_dx … HT1 (L. 𝕓{I} V) ?) -HT1 /2/
+  lapply (tps_leq_repl_dx … HT2 (L. 𝕓{I} V) ?) -HT2 /3 width=5/
+| #L #I #V0 #V1 #T0 #T1 #d1 #e1 #_ #_ #IHV01 #IHT01 #X #d2 #e2 #HX
+  elim (tps_inv_flat1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct -X;
+  elim (IHV01 … HV02) -IHV01 HV02;
+  elim (IHT01 … HT02) -IHT01 HT02 /3 width=5/
+]
+qed.
+
+(* Basic-1: was: subst1_confluence_neq *)
+theorem tps_conf_neq: ∀L1,T0,T1,d1,e1. L1 ⊢ T0 [d1, e1] ≫ T1 →
+                      ∀L2,T2,d2,e2. L2 ⊢ T0 [d2, e2] ≫ T2 →
+                      (d1 + e1 ≤ d2 ∨ d2 + e2 ≤ d1) →
+                      ∃∃T. L2 ⊢ T1 [d2, e2] ≫ T & L1 ⊢ T2 [d1, e1] ≫ T.
+#L1 #T0 #T1 #d1 #e1 #H elim H -H L1 T0 T1 d1 e1
+[ /2/
+| #L1 #K1 #V1 #T1 #i0 #d1 #e1 #Hd1 #Hde1 #HLK1 #HVT1 #L2 #T2 #d2 #e2 #H1 #H2 
+  elim (tps_inv_lref1 … H1) -H1
+  [ #H destruct -T2 /4/
+  | -HLK1 HVT1 * #K2 #V2 #Hd2 #Hde2 #_ #_ elim H2 -H2 #Hded
+    [ -Hd1 Hde2;
+      lapply (transitive_le … Hded Hd2) -Hded Hd2 #H
+      lapply (lt_to_le_to_lt … Hde1 H) -Hde1 H #H
+      elim (lt_refl_false … H)
+    | -Hd2 Hde1;
+      lapply (transitive_le … Hded Hd1) -Hded Hd1 #H
+      lapply (lt_to_le_to_lt … Hde2 H) -Hde2 H #H
+      elim (lt_refl_false … H)
+    ]
+  ]
+| #L1 #I #V0 #V1 #T0 #T1 #d1 #e1 #_ #_ #IHV01 #IHT01 #L2 #X #d2 #e2 #HX #H
+  elim (tps_inv_bind1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct -X;
+  elim (IHV01 … HV02 H) -IHV01 HV02 #V #HV1 #HV2
+  elim (IHT01 … HT02 ?) -IHT01 HT02
+  [ -H #T #HT1 #HT2
+    lapply (tps_leq_repl_dx … HT1 (L2. 𝕓{I} V) ?) -HT1 /2/
+    lapply (tps_leq_repl_dx … HT2 (L1. 𝕓{I} V) ?) -HT2 /3 width=5/
+  | -HV1 HV2 >plus_plus_comm_23 >plus_plus_comm_23 in ⊢ (? ? %) elim H -H #H
+    [ @or_introl | @or_intror ] /2 by monotonic_le_plus_l/ (**) (* /3/ is too slow *)
+  ]
+| #L1 #I #V0 #V1 #T0 #T1 #d1 #e1 #_ #_ #IHV01 #IHT01 #L2 #X #d2 #e2 #HX #H
+  elim (tps_inv_flat1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct -X;
+  elim (IHV01 … HV02 H) -IHV01 HV02;
+  elim (IHT01 … HT02 H) -IHT01 HT02 H /3 width=5/
+]
+qed.
+
+(* Note: the constant 1 comes from tps_subst *)
+(* Basic-1: was: subst1_trans *)
+theorem tps_trans_ge: ∀L,T1,T0,d,e. L ⊢ T1 [d, e] ≫ T0 →
+                      ∀T2. L ⊢ T0 [d, 1] ≫ T2 → 1 ≤ e →
+                      L ⊢ T1 [d, e] ≫ T2.
+#L #T1 #T0 #d #e #H elim H -L T1 T0 d e
+[ #L #I #d #e #T2 #H #He
+  elim (tps_inv_atom1 … H) -H
+  [ #H destruct -T2 //
+  | * #K #V #i #Hd2i #Hide2 #HLK #HVT2 #H destruct -I;
+    lapply (lt_to_le_to_lt … (d + e) Hide2 ?) /2/
+  ]
+| #L #K #V #V2 #i #d #e #Hdi #Hide #HLK #HVW #T2 #HVT2 #He
+  lapply (tps_weak … HVT2 0 (i +1) ? ?) -HVT2 /2/ #HVT2
+  <(tps_inv_lift1_eq … HVT2 … HVW) -HVT2 /2/
+| #L #I #V1 #V0 #T1 #T0 #d #e #_ #_ #IHV10 #IHT10 #X #H #He
+  elim (tps_inv_bind1 … H) -H #V2 #T2 #HV02 #HT02 #H destruct -X;
+  lapply (tps_leq_repl_dx … HT02 (L. 𝕓{I} V0) ?) -HT02 /2/ #HT02
+  lapply (IHT10 … HT02 He) -IHT10 HT02 #HT12
+  lapply (tps_leq_repl_dx … HT12 (L. 𝕓{I} V2) ?) -HT12 /3/
+| #L #I #V1 #V0 #T1 #T0 #d #e #_ #_ #IHV10 #IHT10 #X #H #He
+  elim (tps_inv_flat1 … H) -H #V2 #T2 #HV02 #HT02 #H destruct -X /3/
+]
+qed.
+
+theorem tps_trans_down: ∀L,T1,T0,d1,e1. L ⊢ T1 [d1, e1] ≫ T0 →
+                        ∀T2,d2,e2. L ⊢ T0 [d2, e2] ≫ T2 → d2 + e2 ≤ d1 →
+                        ∃∃T. L ⊢ T1 [d2, e2] ≫ T & L ⊢ T [d1, e1] ≫ T2.
+#L #T1 #T0 #d1 #e1 #H elim H -L T1 T0 d1 e1
+[ /2/
+| #L #K #V #W #i1 #d1 #e1 #Hdi1 #Hide1 #HLK #HVW #T2 #d2 #e2 #HWT2 #Hde2d1
+  lapply (transitive_le … Hde2d1 Hdi1) -Hde2d1 #Hde2i1
+  lapply (tps_weak … HWT2 0 (i1 + 1) ? ?) -HWT2; normalize /2/ -Hde2i1 #HWT2
+  <(tps_inv_lift1_eq … HWT2 … HVW) -HWT2 /4/
+| #L #I #V1 #V0 #T1 #T0 #d1 #e1 #_ #_ #IHV10 #IHT10 #X #d2 #e2 #HX #de2d1
+  elim (tps_inv_bind1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct -X;
+  lapply (tps_leq_repl_dx … HT02 (L. 𝕓{I} V0) ?) -HT02 /2/ #HT02
+  elim (IHV10 … HV02 ?) -IHV10 HV02 // #V
+  elim (IHT10 … HT02 ?) -IHT10 HT02 [2: /2/ ] #T #HT1 #HT2
+  lapply (tps_leq_repl_dx … HT1 (L. 𝕓{I} V) ?) -HT1;
+  lapply (tps_leq_repl_dx … HT2 (L. 𝕓{I} V2) ?) -HT2 /3 width=6/
+| #L #I #V1 #V0 #T1 #T0 #d1 #e1 #_ #_ #IHV10 #IHT10 #X #d2 #e2 #HX #de2d1
+  elim (tps_inv_flat1 … HX) -HX #V2 #T2 #HV02 #HT02 #HX destruct -X;
+  elim (IHV10 … HV02 ?) -IHV10 HV02 //
+  elim (IHT10 … HT02 ?) -IHT10 HT02 // /3 width=6/
+]
+qed.
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/unfold/ltpss.ma b/matita/matita/contribs/lambda_delta/Basic_2/unfold/ltpss.ma
new file mode 100644 (file)
index 0000000..4f2062a
--- /dev/null
@@ -0,0 +1,107 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The 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/ltps.ma".
+include "Basic-2/unfold/tpss.ma".
+
+(* PARTIAL UNFOLD ON LOCAL ENVIRONMENTS *************************************)
+
+definition ltpss: nat → nat → relation lenv ≝
+                  λd,e. TC … (ltps d e).
+
+interpretation "partial unfold (local environment)"
+   'PSubstStar L1 d e L2 = (ltpss d e L1 L2).
+
+(* Basic eliminators ********************************************************)
+
+lemma ltpss_ind: ∀d,e,L1. ∀R: lenv → Prop. R L1 →
+                 (∀L,L2. L1 [d, e] ≫* L → L [d, e] ≫ L2 → R L → R L2) →
+                 ∀L2. L1 [d, e] ≫* L2 → R L2.
+#d #e #L1 #R #HL1 #IHL1 #L2 #HL12 @(TC_star_ind … HL1 IHL1 … HL12) //
+qed.
+
+(* Basic properties *********************************************************)
+
+lemma ltpss_strap: ∀L1,L,L2,d,e.
+                   L1 [d, e] ≫ L → L [d, e] ≫* L2 → L1 [d, e] ≫* L2. 
+/2/ qed.
+
+lemma ltpss_refl: ∀L,d,e. L [d, e] ≫* L.
+/2/ qed.
+
+(* Basic inversion lemmas ***************************************************)
+
+lemma ltpss_inv_refl_O2: ∀d,L1,L2. L1 [d, 0] ≫* L2 → L1 = L2.
+#d #L1 #L2 #H @(ltpss_ind … H) -L2 //
+#L #L2 #_ #HL2 #IHL <(ltps_inv_refl_O2 … HL2) -HL2 //
+qed.
+
+lemma ltpss_inv_atom1: ∀d,e,L2. ⋆ [d, e] ≫* L2 → L2 = ⋆.
+#d #e #L2 #H @(ltpss_ind … H) -L2 //
+#L #L2 #_ #HL2 #IHL destruct -L
+>(ltps_inv_atom1 … HL2) -HL2 //
+qed.
+(*
+fact ltps_inv_atom2_aux: ∀d,e,L1,L2.
+                         L1 [d, e] ≫ L2 → L2 = ⋆ → L1 = ⋆.
+#d #e #L1 #L2 * -d e L1 L2
+[ //
+| #L #I #V #H destruct
+| #L1 #L2 #I #V1 #V2 #e #_ #_ #H destruct
+| #L1 #L2 #I #V1 #V2 #d #e #_ #_ #H destruct
+]
+qed.
+
+lemma drop_inv_atom2: ∀d,e,L1. L1 [d, e] ≫ ⋆ → L1 = ⋆.
+/2 width=5/ qed.
+
+fact ltps_inv_tps22_aux: ∀d,e,L1,L2. L1 [d, e] ≫ L2 → d = 0 → 0 < e →
+                         ∀K2,I,V2. L2 = K2. 𝕓{I} V2 →
+                         ∃∃K1,V1. K1 [0, e - 1] ≫ K2 &
+                                  K2 ⊢ V1 [0, e - 1] ≫ V2 &
+                                  L1 = K1. 𝕓{I} V1.
+#d #e #L1 #L2 * -d e L1 L2
+[ #d #e #_ #_ #K1 #I #V1 #H destruct
+| #L1 #I #V #_ #H elim (lt_refl_false … H)
+| #L1 #L2 #I #V1 #V2 #e #HL12 #HV12 #_ #_ #K2 #J #W2 #H destruct -L2 I V2 /2 width=5/
+| #L1 #L2 #I #V1 #V2 #d #e #_ #_ #H elim (plus_S_eq_O_false … H)
+]
+qed.
+
+lemma ltps_inv_tps22: ∀e,L1,K2,I,V2. L1 [0, e] ≫ K2. 𝕓{I} V2 → 0 < e →
+                      ∃∃K1,V1. K1 [0, e - 1] ≫ K2 & K2 ⊢ V1 [0, e - 1] ≫ V2 &
+                               L1 = K1. 𝕓{I} V1.
+/2 width=5/ qed.
+
+fact ltps_inv_tps12_aux: ∀d,e,L1,L2. L1 [d, e] ≫ L2 → 0 < d →
+                         ∀I,K2,V2. L2 = K2. 𝕓{I} V2 →
+                         ∃∃K1,V1. K1 [d - 1, e] ≫ K2 &
+                                  K2 ⊢ V1 [d - 1, e] ≫ V2 &
+                                  L1 = K1. 𝕓{I} V1.
+#d #e #L1 #L2 * -d e L1 L2
+[ #d #e #_ #I #K2 #V2 #H destruct
+| #L #I #V #H elim (lt_refl_false … H)
+| #L1 #L2 #I #V1 #V2 #e #_ #_ #H elim (lt_refl_false … H)
+| #L1 #L2 #I #V1 #V2 #d #e #HL12 #HV12 #_ #J #K2 #W2 #H destruct -L2 I V2
+  /2 width=5/
+]
+qed.
+
+lemma ltps_inv_tps12: ∀L1,K2,I,V2,d,e. L1 [d, e] ≫ K2. 𝕓{I} V2 → 0 < d →
+                      ∃∃K1,V1. K1 [d - 1, e] ≫ K2 &
+                                  K2 ⊢ V1 [d - 1, e] ≫ V2 &
+                                  L1 = K1. 𝕓{I} V1.
+/2/ qed.
+
+*)
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/unfold/ltpss_drop.ma b/matita/matita/contribs/lambda_delta/Basic_2/unfold/ltpss_drop.ma
new file mode 100644 (file)
index 0000000..4b50886
--- /dev/null
@@ -0,0 +1,132 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The 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/ltps.ma".
+
+(* PARALLEL SUBSTITUTION ON LOCAL ENVIRONMENTS ******************************)
+
+lemma ltps_drop_conf_ge: ∀L0,L1,d1,e1. L0 [d1, e1] ≫ L1 →
+                         ∀L2,e2. ↓[0, e2] L0 ≡ L2 →
+                         d1 + e1 ≤ e2 → ↓[0, e2] L1 ≡ L2.
+#L0 #L1 #d1 #e1 #H elim H -H L0 L1 d1 e1
+[ #d1 #e1 #L2 #e2 #H >(drop_inv_atom1 … H) -H //
+| //
+| normalize #K0 #K1 #I #V0 #V1 #e1 #_ #_ #IHK01 #L2 #e2 #H #He12
+  lapply (plus_le_weak … He12) #He2
+  lapply (drop_inv_drop1 … H ?) -H // #HK0L2
+  lapply (IHK01 … HK0L2 ?) -IHK01 HK0L2 /2/
+| #K0 #K1 #I #V0 #V1 #d1 #e1 >plus_plus_comm_23 #_ #_ #IHK01 #L2 #e2 #H #Hd1e2
+  lapply (plus_le_weak … Hd1e2) #He2
+  lapply (drop_inv_drop1 … H ?) -H // #HK0L2
+  lapply (IHK01 … HK0L2 ?) -IHK01 HK0L2 /2/
+]
+qed.
+
+lemma ltps_drop_trans_ge: ∀L1,L0,d1,e1. L1 [d1, e1] ≫ L0 →
+                          ∀L2,e2. ↓[0, e2] L0 ≡ L2 →
+                          d1 + e1 ≤ e2 → ↓[0, e2] L1 ≡ L2.
+#L1 #L0 #d1 #e1 #H elim H -H L1 L0 d1 e1
+[ #d1 #e1 #L2 #e2 #H >(drop_inv_atom1 … H) -H //
+| //
+| normalize #K1 #K0 #I #V1 #V0 #e1 #_ #_ #IHK10 #L2 #e2 #H #He12
+  lapply (plus_le_weak … He12) #He2
+  lapply (drop_inv_drop1 … H ?) -H // #HK0L2
+  lapply (IHK10 … HK0L2 ?) -IHK10 HK0L2 /2/
+| #K0 #K1 #I #V1 #V0 #d1 #e1 >plus_plus_comm_23 #_ #_ #IHK10 #L2 #e2 #H #Hd1e2
+  lapply (plus_le_weak … Hd1e2) #He2
+  lapply (drop_inv_drop1 … H ?) -H // #HK0L2
+  lapply (IHK10 … HK0L2 ?) -IHK10 HK0L2 /2/
+]
+qed.
+
+lemma ltps_drop_conf_be: ∀L0,L1,d1,e1. L0 [d1, e1] ≫ L1 →
+                         ∀L2,e2. ↓[0, e2] L0 ≡ L2 → d1 ≤ e2 → e2 ≤ d1 + e1 →
+                         ∃∃L. L2 [0, d1 + e1 - e2] ≫ L & ↓[0, e2] L1 ≡ L.
+#L0 #L1 #d1 #e1 #H elim H -H L0 L1 d1 e1
+[ #d1 #e1 #L2 #e2 #H >(drop_inv_atom1 … H) -H /2/
+| normalize #L #I #V #L2 #e2 #HL2 #_ #He2
+  lapply (le_n_O_to_eq … He2) -He2 #H destruct -e2;
+  lapply (drop_inv_refl … HL2) -HL2 #H destruct -L2 /2/
+| normalize #K0 #K1 #I #V0 #V1 #e1 #HK01 #HV01 #IHK01 #L2 #e2 #H #_ #He21
+  lapply (drop_inv_O1 … H) -H * * #He2 #HK0L2
+  [ destruct -IHK01 He21 e2 L2 <minus_n_O /3/
+  | -HK01 HV01 <minus_le_minus_minus_comm //
+    elim (IHK01 … HK0L2 ? ?) -IHK01 HK0L2 /3/
+  ]
+| #K0 #K1 #I #V0 #V1 #d1 #e1 >plus_plus_comm_23 #_ #_ #IHK01 #L2 #e2 #H #Hd1e2 #He2de1
+  lapply (plus_le_weak … Hd1e2) #He2
+  <minus_le_minus_minus_comm //
+  lapply (drop_inv_drop1 … H ?) -H // #HK0L2
+  elim (IHK01 … HK0L2 ? ?) -IHK01 HK0L2 /3/
+]
+qed.
+
+lemma ltps_drop_trans_be: ∀L1,L0,d1,e1. L1 [d1, e1] ≫ L0 →
+                          ∀L2,e2. ↓[0, e2] L0 ≡ L2 → d1 ≤ e2 → e2 ≤ d1 + e1 →
+                          ∃∃L. L [0, d1 + e1 - e2] ≫ L2 & ↓[0, e2] L1 ≡ L.
+#L1 #L0 #d1 #e1 #H elim H -H L1 L0 d1 e1
+[ #d1 #e1 #L2 #e2 #H >(drop_inv_atom1 … H) -H /2/
+| normalize #L #I #V #L2 #e2 #HL2 #_ #He2
+  lapply (le_n_O_to_eq … He2) -He2 #H destruct -e2;
+  lapply (drop_inv_refl … HL2) -HL2 #H destruct -L2 /2/
+| normalize #K1 #K0 #I #V1 #V0 #e1 #HK10 #HV10 #IHK10 #L2 #e2 #H #_ #He21
+  lapply (drop_inv_O1 … H) -H * * #He2 #HK0L2
+  [ destruct -IHK10 He21 e2 L2 <minus_n_O /3/
+  | -HK10 HV10 <minus_le_minus_minus_comm //
+    elim (IHK10 … HK0L2 ? ?) -IHK10 HK0L2 /3/
+  ]
+| #K1 #K0 #I #V1 #V0 #d1 #e1 >plus_plus_comm_23 #_ #_ #IHK10 #L2 #e2 #H #Hd1e2 #He2de1
+  lapply (plus_le_weak … Hd1e2) #He2
+  <minus_le_minus_minus_comm //
+  lapply (drop_inv_drop1 … H ?) -H // #HK0L2
+  elim (IHK10 … HK0L2 ? ?) -IHK10 HK0L2 /3/
+]
+qed.
+
+lemma ltps_drop_conf_le: ∀L0,L1,d1,e1. L0 [d1, e1] ≫ L1 →
+                         ∀L2,e2. ↓[0, e2] L0 ≡ L2 → e2 ≤ d1 →
+                         ∃∃L. L2 [d1 - e2, e1] ≫ L & ↓[0, e2] L1 ≡ L.
+#L0 #L1 #d1 #e1 #H elim H -H L0 L1 d1 e1
+[ #d1 #e1 #L2 #e2 #H >(drop_inv_atom1 … H) -H /2/
+| /2/
+| normalize #K0 #K1 #I #V0 #V1 #e1 #HK01 #HV01 #_ #L2 #e2 #H #He2
+  lapply (le_n_O_to_eq … He2) -He2 #He2 destruct -e2;
+  lapply (drop_inv_refl … H) -H #H destruct -L2 /3/
+| #K0 #K1 #I #V0 #V1 #d1 #e1 #HK01 #HV01 #IHK01 #L2 #e2 #H #He2d1
+  lapply (drop_inv_O1 … H) -H * * #He2 #HK0L2
+  [ destruct -IHK01 He2d1 e2 L2 <minus_n_O /3/
+  | -HK01 HV01 <minus_le_minus_minus_comm //
+    elim (IHK01 … HK0L2 ?) -IHK01 HK0L2 /3/
+  ]
+]
+qed.
+
+lemma ltps_drop_trans_le: ∀L1,L0,d1,e1. L1 [d1, e1] ≫ L0 →
+                          ∀L2,e2. ↓[0, e2] L0 ≡ L2 → e2 ≤ d1 →
+                          ∃∃L. L [d1 - e2, e1] ≫ L2 & ↓[0, e2] L1 ≡ L.
+#L1 #L0 #d1 #e1 #H elim H -H L1 L0 d1 e1
+[ #d1 #e1 #L2 #e2 #H >(drop_inv_atom1 … H) -H /2/
+| /2/
+| normalize #K1 #K0 #I #V1 #V0 #e1 #HK10 #HV10 #_ #L2 #e2 #H #He2
+  lapply (le_n_O_to_eq … He2) -He2 #He2 destruct -e2;
+  lapply (drop_inv_refl … H) -H #H destruct -L2 /3/
+| #K1 #K0 #I #V1 #V0 #d1 #e1 #HK10 #HV10 #IHK10 #L2 #e2 #H #He2d1
+  lapply (drop_inv_O1 … H) -H * * #He2 #HK0L2
+  [ destruct -IHK10 He2d1 e2 L2 <minus_n_O /3/
+  | -HK10 HV10 <minus_le_minus_minus_comm //
+    elim (IHK10 … HK0L2 ?) -IHK10 HK0L2 /3/
+  ]
+]
+qed.
+*)
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/unfold/ltpss_ltpss.ma b/matita/matita/contribs/lambda_delta/Basic_2/unfold/ltpss_ltpss.ma
new file mode 100644 (file)
index 0000000..0bf94ae
--- /dev/null
@@ -0,0 +1,55 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "Basic-2/unfold/ltpss_tpss.ma".
+
+(* PARTIAL UNFOLD ON LOCAL ENVIRONMENTS *************************************)
+
+(* Main properties **********************************************************)
+
+theorem ltpss_trans_eq: ∀L1,L,L2,d,e.
+                        L1 [d, e] ≫* L → L [d, e] ≫* L2 → L1 [d, e] ≫* L2. 
+/2/ qed.
+
+lemma ltpss_tpss2: ∀L1,L2,I,V1,V2,e.
+                   L1 [0, e] ≫* L2 → L2 ⊢ V1 [0, e] ≫* V2 →
+                   L1. 𝕓{I} V1 [0, e + 1] ≫* L2. 𝕓{I} V2.
+#L1 #L2 #I #V1 #V2 #e #HL12 #H @(tpss_ind … H) -V2
+[ /2/
+| #V #V2 #_ #HV2 #IHV @(ltpss_trans_eq … IHV) /2/
+]
+qed.
+
+lemma ltpss_tpss2_lt: ∀L1,L2,I,V1,V2,e.
+                      L1 [0, e - 1] ≫* L2 → L2 ⊢ V1 [0, e - 1] ≫* V2 →
+                      0 < e → L1. 𝕓{I} V1 [0, e] ≫* L2. 𝕓{I} V2.
+#L1 #L2 #I #V1 #V2 #e #HL12 #HV12 #He
+>(plus_minus_m_m e 1) /2/
+qed.
+
+lemma ltpss_tpss1: ∀L1,L2,I,V1,V2,d,e.
+                   L1 [d, e] ≫* L2 → L2 ⊢ V1 [d, e] ≫* V2 →
+                   L1. 𝕓{I} V1 [d + 1, e] ≫* L2. 𝕓{I} V2.
+#L1 #L2 #I #V1 #V2 #d #e #HL12 #H @(tpss_ind … H) -V2
+[ /2/
+| #V #V2 #_ #HV2 #IHV @(ltpss_trans_eq … IHV) /2/
+]
+qed.
+
+lemma ltpss_tpss1_lt: ∀L1,L2,I,V1,V2,d,e.
+                      L1 [d - 1, e] ≫* L2 → L2 ⊢ V1 [d - 1, e] ≫* V2 →
+                      0 < d → L1. 𝕓{I} V1 [d, e] ≫* L2. 𝕓{I} V2.
+#L1 #L2 #I #V1 #V2 #d #e #HL12 #HV12 #Hd
+>(plus_minus_m_m d 1) /2/
+qed.
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/unfold/ltpss_tpss.ma b/matita/matita/contribs/lambda_delta/Basic_2/unfold/ltpss_tpss.ma
new file mode 100644 (file)
index 0000000..b8e425e
--- /dev/null
@@ -0,0 +1,169 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "Basic-2/unfold/tpss_ltps.ma".
+include "Basic-2/unfold/ltpss.ma".
+
+(* PARTIAL UNFOLD ON LOCAL ENVIRONMENTS *************************************)
+
+(* Properties concerning partial unfold on terms ****************************)
+
+lemma ltpss_tpss_trans_ge: ∀L1,L0,d1,e1. L1 [d1, e1] ≫* L0 →
+                           ∀T2,U2,d2,e2. L0 ⊢ T2 [d2, e2] ≫* U2 →
+                           d1 + e1 ≤ d2 → L1 ⊢ T2 [d2, e2] ≫* U2.
+#L1 #L0 #d1 #e1 #H @(ltpss_ind … H) -L0 //
+#L #L0 #_ #HL0 #IHL #T2 #U2 #d2 #e2 #HTU2 #Hde1d2
+lapply (ltps_tpss_trans_ge … HL0 HTU2) -HL0 HTU2 /2/
+qed.
+
+lemma ltpss_tps_trans_ge: ∀L1,L0,d1,e1. L1 [d1, e1] ≫* L0 →
+                          ∀T2,U2,d2,e2. L0 ⊢ T2 [d2, e2] ≫ U2 →
+                          d1 + e1 ≤ d2 → L1 ⊢ T2 [d2, e2] ≫* U2.
+#L1 #L0 #d1 #e1 #HL10 #T2 #U2 #d2 #e2 #HTU2 #Hde1d2
+@(ltpss_tpss_trans_ge … HL10 … Hde1d2) /2/ (**) (* /3 width=6/ is too slow *)
+qed.
+
+lemma ltpss_tpss_trans_eq: ∀L0,L1,d,e. L0 [d, e] ≫* L1 →
+                           ∀T2,U2. L1 ⊢ T2 [d, e] ≫* U2 → L0 ⊢ T2 [d, e] ≫* U2.
+#L0 #L1 #d #e #H @(ltpss_ind … H) -L1
+[ /2/
+| #L #L1 #_ #HL1 #IHL #T2 #U2 #HTU2
+  lapply (ltps_tpss_trans_eq … HL1 HTU2) -HL1 HTU2 /2/
+]
+qed.
+
+lemma ltpss_tps_trans_eq: ∀L0,L1,d,e. L0 [d, e] ≫* L1 →
+                          ∀T2,U2. L1 ⊢ T2 [d, e] ≫ U2 → L0 ⊢ T2 [d, e] ≫* U2.
+/3/ qed.
+
+lemma ltpss_tpss_conf_ge: ∀L0,L1,T2,U2,d1,e1,d2,e2. d1 + e1 ≤ d2 → 
+                          L0 ⊢ T2 [d2, e2] ≫* U2 → L0 [d1, e1] ≫* L1 →
+                          L1 ⊢ T2 [d2, e2] ≫* U2.
+#L0 #L1 #T2 #U2 #d1 #e1 #d2 #e2 #Hde1d2 #HTU2 #H @(ltpss_ind … H) -L1
+[ //
+| -HTU2 #L #L1 #_ #HL1 #IHL
+  lapply (ltps_tpss_conf_ge … HL1 IHL) -HL1 IHL //
+]
+qed.
+
+lemma ltpss_tps_conf_ge: ∀L0,L1,T2,U2,d1,e1,d2,e2. d1 + e1 ≤ d2 → 
+                         L0 ⊢ T2 [d2, e2] ≫ U2 → L0 [d1, e1] ≫* L1 →
+                         L1 ⊢ T2 [d2, e2] ≫* U2.
+#L0 #L1 #T2 #U2 #d1 #e1 #d2 #e2 #Hde1d2 #HTU2 #HL01
+@(ltpss_tpss_conf_ge … Hde1d2 … HL01) /2/ (**) (* /3 width=6/ is too slow *)
+qed.
+
+lemma ltpss_tpss_conf_eq: ∀L0,L1,T2,U2,d,e.
+                          L0 ⊢ T2 [d, e] ≫* U2 → L0 [d, e] ≫* L1 →
+                          ∃∃T. L1 ⊢ T2 [d, e] ≫* T & L1 ⊢ U2 [d, e] ≫* T.
+#L0 #L1 #T2 #U2 #d #e #HTU2 #H @(ltpss_ind … H) -L1
+[ /2/
+| -HTU2 #L #L1 #_ #HL1 * #W2 #HTW2 #HUW2
+  elim (ltps_tpss_conf … HL1 HTW2) -HTW2 #T #HT2 #HW2T
+  elim (ltps_tpss_conf … HL1 HUW2) -HL1 HUW2 #U #HU2 #HW2U
+  elim (tpss_conf_eq … HW2T … HW2U) -HW2T HW2U #V #HTV #HUV
+  lapply (tpss_trans_eq … HT2 … HTV) -T;
+  lapply (tpss_trans_eq … HU2 … HUV) -U /2/
+]
+qed.
+
+lemma ltpss_tps_conf_eq: ∀L0,L1,T2,U2,d,e.
+                         L0 ⊢ T2 [d, e] ≫ U2 → L0 [d, e] ≫* L1 →
+                         ∃∃T. L1 ⊢ T2 [d, e] ≫* T & L1 ⊢ U2 [d, e] ≫* T.
+/3/ qed.
+
+lemma ltpss_tpss_conf: ∀L1,T1,T2,d,e. L1 ⊢ T1 [d, e] ≫* T2 →
+                       ∀L2,ds,es. L1 [ds, es] ≫* L2 → 
+                       ∃∃T. L2 ⊢ T1 [d, e] ≫* T & L1 ⊢ T2 [ds, es] ≫* T.
+#L1 #T1 #T2 #d #e #HT12 #L2 #ds #es #H @(ltpss_ind … H) -L2
+[ /3/
+| #L #L2 #HL1 #HL2 * #T #HT1 #HT2
+  elim (ltps_tpss_conf … HL2 HT1) -HT1 #T0 #HT10 #HT0
+  lapply (ltps_tpss_trans_eq … HL2 … HT0) -HL2 HT0 #HT0
+  lapply (ltpss_tpss_trans_eq … HL1 … HT0) -HL1 HT0 #HT0
+  lapply (tpss_trans_eq … HT2 … HT0) -T /2/
+]
+qed.
+
+lemma ltpss_tps_conf: ∀L1,T1,T2,d,e. L1 ⊢ T1 [d, e] ≫ T2 →
+                      ∀L2,ds,es. L1 [ds, es] ≫* L2 → 
+                      ∃∃T. L2 ⊢ T1 [d, e] ≫* T & L1 ⊢ T2 [ds, es] ≫* T.
+/3/ qed.
+
+(* Advanced properties ******************************************************)
+
+lemma ltpss_tps2: ∀L1,L2,I,e.
+                  L1 [0, e] ≫* L2 → ∀V1,V2. L2 ⊢ V1 [0, e] ≫ V2 →
+                  L1. 𝕓{I} V1 [0, e + 1] ≫* L2. 𝕓{I} V2.
+#L1 #L2 #I #e #H @(ltpss_ind … H) -L2
+[ /3/
+| #L #L2 #_ #HL2 #IHL #V1 #V2 #HV12
+  elim (ltps_tps_trans … HV12 … HL2) -HV12 #V #HV1 #HV2
+  lapply (IHL … HV1) -IHL HV1 #HL1
+  @step /2 width=5/ (**) (* /3 width=5/ is too slow *)
+]
+qed.
+
+lemma ltpss_tps2_lt: ∀L1,L2,I,V1,V2,e.
+                     L1 [0, e - 1] ≫* L2 → L2 ⊢ V1 [0, e - 1] ≫ V2 →
+                     0 < e → L1. 𝕓{I} V1 [0, e] ≫* L2. 𝕓{I} V2.
+#L1 #L2 #I #V1 #V2 #e #HL12 #HV12 #He
+>(plus_minus_m_m e 1) /2/
+qed.
+
+lemma ltpss_tps1: ∀L1,L2,I,d,e. L1 [d, e] ≫* L2 →
+                  ∀V1,V2. L2 ⊢ V1 [d, e] ≫ V2 →
+                  L1. 𝕓{I} V1 [d + 1, e] ≫* L2. 𝕓{I} V2.
+#L1 #L2 #I #d #e #H @(ltpss_ind … H) -L2
+[ /3/
+| #L #L2 #_ #HL2 #IHL #V1 #V2 #HV12
+  elim (ltps_tps_trans … HV12 … HL2) -HV12 #V #HV1 #HV2
+  lapply (IHL … HV1) -IHL HV1 #HL1
+  @step /2 width=5/ (**) (* /3 width=5/ is too slow *)
+]
+qed.
+
+lemma ltpss_tps1_lt: ∀L1,L2,I,V1,V2,d,e.
+                     L1 [d - 1, e] ≫* L2 → L2 ⊢ V1 [d - 1, e] ≫ V2 →
+                     0 < d → L1. 𝕓{I} V1 [d, e] ≫* L2. 𝕓{I} V2.
+#L1 #L2 #I #V1 #V2 #d #e #HL12 #HV12 #Hd
+>(plus_minus_m_m d 1) /2/
+qed.
+
+(* Advanced forward lemmas **************************************************)
+
+lemma ltpss_fwd_tpsa21: ∀e,K1,I,V1,L2. 0 < e → K1. 𝕓{I} V1 [0, e] ≫* L2 →
+                        ∃∃K2,V2. K1 [0, e - 1] ≫* K2 & K1 ⊢ V1 [0, e - 1] ≫* V2 &
+                                 L2 = K2. 𝕓{I} V2.
+#e #K1 #I #V1 #L2 #He #H @(ltpss_ind … H) -L2
+[ /2 width=5/
+| #L #L2 #_ #HL2 * #K #V #HK1 #HV1 #H destruct -L;
+  elim (ltps_inv_tps21 … HL2 ?) -HL2 // #K2 #V2 #HK2 #HV2 #H
+  lapply (ltps_tps_trans_eq … HV2 … HK2) -HV2 #HV2
+  lapply (ltpss_tpss_trans_eq … HK1 … HV2) -HV2 #HV2 /3 width=5/
+]
+qed.
+
+lemma ltpss_fwd_tpss11: ∀d,e,I,K1,V1,L2. 0 < d → K1. 𝕓{I} V1 [d, e] ≫* L2 →
+                        ∃∃K2,V2. K1 [d - 1, e] ≫* K2 &
+                                 K1 ⊢ V1 [d - 1, e] ≫* V2 &
+                                 L2 = K2. 𝕓{I} V2.
+#d #e #K1 #I #V1 #L2 #Hd #H @(ltpss_ind … H) -L2
+[ /2 width=5/
+| #L #L2 #_ #HL2 * #K #V #HK1 #HV1 #H destruct -L;
+  elim (ltps_inv_tps11 … HL2 ?) -HL2 // #K2 #V2 #HK2 #HV2 #H
+  lapply (ltps_tps_trans_eq … HV2 … HK2) -HV2 #HV2
+  lapply (ltpss_tpss_trans_eq … HK1 … HV2) -HV2 #HV2 /3 width=5/
+]
+qed.
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/unfold/tpss.ma b/matita/matita/contribs/lambda_delta/Basic_2/unfold/tpss.ma
new file mode 100644 (file)
index 0000000..6b63c4e
--- /dev/null
@@ -0,0 +1,137 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The 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/tps.ma".
+
+(* PARTIAL UNFOLD ON TERMS **************************************************)
+
+definition tpss: nat → nat → lenv → relation term ≝
+                 λd,e,L. TC … (tps d e L).
+
+interpretation "partial unfold (term)"
+   'PSubstStar L T1 d e T2 = (tpss d e L T1 T2).
+
+(* Basic eliminators ********************************************************)
+
+lemma tpss_ind: ∀d,e,L,T1. ∀R: term → Prop. R T1 →
+                (∀T,T2. L ⊢ T1 [d, e] ≫* T → L ⊢ T [d, e] ≫ T2 → R T → R T2) →
+                ∀T2. L ⊢ T1 [d, e] ≫* T2 → R T2.
+#d #e #L #T1 #R #HT1 #IHT1 #T2 #HT12 @(TC_star_ind … HT1 IHT1 … HT12) //
+qed.
+
+(* Basic properties *********************************************************)
+
+lemma tpss_strap: ∀L,T1,T,T2,d,e. 
+                  L ⊢ T1 [d, e] ≫ T → L ⊢ T [d, e] ≫* T2 → L ⊢ T1 [d, e] ≫* T2. 
+/2/ qed.
+
+lemma tpss_leq_repl_dx: ∀L1,T1,T2,d,e. L1 ⊢ T1 [d, e] ≫* T2 →
+                        ∀L2. L1 [d, e] ≈ L2 → L2 ⊢ T1 [d, e] ≫* T2.
+/3/ qed.
+
+lemma tpss_refl: ∀d,e,L,T. L ⊢ T [d, e] ≫* T.
+/2/ qed.
+
+lemma tpss_bind: ∀L,V1,V2,d,e. L ⊢ V1 [d, e] ≫* V2 →
+                 ∀I,T1,T2. L. 𝕓{I} V2 ⊢ T1 [d + 1, e] ≫* T2 →
+                 L ⊢ 𝕓{I} V1. T1 [d, e] ≫* 𝕓{I} V2. T2.
+#L #V1 #V2 #d #e #HV12 elim HV12 -HV12 V2
+[ #V2 #HV12 #I #T1 #T2 #HT12 elim HT12 -HT12 T2
+  [ /3 width=5/
+  | #T #T2 #_ #HT2 #IHT @step /2 width=5/ (**) (* /3 width=5/ is too slow *)
+  ]
+| #V #V2 #_ #HV12 #IHV #I #T1 #T2 #HT12
+  lapply (tpss_leq_repl_dx … HT12 (L. 𝕓{I} V) ?) -HT12 /2/ #HT12
+  lapply (IHV … HT12) -IHV HT12 #HT12 @step /2 width=5/ (**) (* /3 width=5/ is too slow *)
+]
+qed.
+
+lemma tpss_flat: ∀L,I,V1,V2,T1,T2,d,e.
+                 L ⊢ V1 [d, e] ≫ * V2 → L ⊢ T1 [d, e] ≫* T2 →
+                 L ⊢ 𝕗{I} V1. T1 [d, e] ≫* 𝕗{I} V2. T2.
+#L #I #V1 #V2 #T1 #T2 #d #e #HV12 elim HV12 -HV12 V2
+[ #V2 #HV12 #HT12 elim HT12 -HT12 T2
+  [ /3/
+  | #T #T2 #_ #HT2 #IHT @step /2 width=5/ (**) (* /3 width=5/ is too slow *)
+  ]
+| #V #V2 #_ #HV12 #IHV #HT12
+  lapply (IHV … HT12) -IHV HT12 #HT12 @step /2 width=5/ (**) (* /3 width=5/ is too slow *)
+]
+qed.
+
+lemma tpss_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 #T2 #d1 #e1 #H #d1 #d2 #Hd21 #Hde12 @(tpss_ind … H) -H T2
+[ //
+| #T #T2 #_ #HT12 #IHT
+  lapply (tps_weak … HT12 … Hd21 Hde12) -HT12 Hd21 Hde12 /2/
+]
+qed.
+
+lemma tpss_weak_top: ∀L,T1,T2,d,e.
+                     L ⊢ T1 [d, e] ≫* T2 → L ⊢ T1 [d, |L| - d] ≫* T2.
+#L #T1 #T2 #d #e #H @(tpss_ind … H) -H T2
+[ //
+| #T #T2 #_ #HT12 #IHT
+  lapply (tps_weak_top … HT12) -HT12 /2/
+]
+qed.
+
+lemma tpss_weak_all: ∀L,T1,T2,d,e.
+                     L ⊢ T1 [d, e] ≫* T2 → L ⊢ T1 [0, |L|] ≫* T2.
+#L #T1 #T2 #d #e #HT12
+lapply (tpss_weak … HT12 0 (d + e) ? ?) -HT12 // #HT12
+lapply (tpss_weak_top … HT12) //
+qed.
+
+(* Basic inversion lemmas ***************************************************)
+
+(* Note: this can be derived from tpss_inv_atom1 *)
+lemma tpss_inv_sort1: ∀L,T2,k,d,e. L ⊢ ⋆k [d, e] ≫* T2 → T2 = ⋆k.
+#L #T2 #k #d #e #H @(tpss_ind … H) -H T2
+[ //
+| #T #T2 #_ #HT2 #IHT destruct -T
+  >(tps_inv_sort1 … HT2) -HT2 //
+]
+qed.
+
+lemma tpss_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} V2 ⊢ T1 [d + 1, e] ≫* T2 &
+                               U2 =  𝕓{I} V2. T2.
+#d #e #L #I #V1 #T1 #U2 #H @(tpss_ind … H) -H U2
+[ /2 width=5/
+| #U #U2 #_ #HU2 * #V #T #HV1 #HT1 #H destruct -U;
+  elim (tps_inv_bind1 … HU2) -HU2 #V2 #T2 #HV2 #HT2 #H
+  lapply (tpss_leq_repl_dx … HT1 (L. 𝕓{I} V2) ?) -HT1 /3 width=5/
+]
+qed.
+
+lemma tpss_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.
+#d #e #L #I #V1 #T1 #U2 #H @(tpss_ind … H) -H U2
+[ /2 width=5/
+| #U #U2 #_ #HU2 * #V #T #HV1 #HT1 #H destruct -U;
+  elim (tps_inv_flat1 … HU2) -HU2 /3 width=5/
+]
+qed.
+
+lemma tpss_inv_refl_O2: ∀L,T1,T2,d. L ⊢ T1 [d, 0] ≫* T2 → T1 = T2.
+#L #T1 #T2 #d #H @(tpss_ind … H) -H T2
+[ //
+| #T #T2 #_ #HT2 #IHT <(tps_inv_refl_O2 … HT2) -HT2 //
+]
+qed.
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/unfold/tpss_lift.ma b/matita/matita/contribs/lambda_delta/Basic_2/unfold/tpss_lift.ma
new file mode 100644 (file)
index 0000000..f28ff38
--- /dev/null
@@ -0,0 +1,131 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The 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/tps_lift.ma".
+include "Basic-2/unfold/tpss.ma".
+
+(* PARTIAL UNFOLD ON TERMS **************************************************)
+
+(* Advanced properties ******************************************************)
+
+lemma tpss_subst: ∀L,K,V,U1,i,d,e.
+                  d ≤ i → i < d + e →
+                  ↓[0, i] L ≡ K. 𝕓{Abbr} V → K ⊢ V [0, d + e - i - 1] ≫* U1 →
+                  ∀U2. ↑[0, i + 1] U1 ≡ U2 → L ⊢ #i [d, e] ≫* U2.
+#L #K #V #U1 #i #d #e #Hdi #Hide #HLK #H @(tpss_ind … H) -H U1
+[ /3/
+| #U #U1 #_ #HU1 #IHU #U2 #HU12
+  elim (lift_total U 0 (i+1)) #U0 #HU0
+  lapply (IHU … HU0) -IHU #H
+  lapply (drop_fwd_drop2 … HLK) -HLK #HLK
+  lapply (tps_lift_ge … HU1 … HLK HU0 HU12 ?) -HU1 HLK HU0 HU12 // normalize #HU02
+  lapply (tps_weak … HU02 d e ? ?) -HU02 [ >arith_i2 // | /2/ | /2/ ]
+]
+qed.
+
+(* Advanced inverion lemmas *************************************************)
+
+lemma tpss_inv_atom1: ∀L,T2,I,d,e. L ⊢ 𝕒{I} [d, e] ≫* T2 →
+                      T2 = 𝕒{I} ∨
+                      ∃∃K,V1,V2,i. d ≤ i & i < d + e &
+                                   ↓[O, i] L ≡ K. 𝕓{Abbr} V1 &
+                                   K ⊢ V1 [0, d + e - i - 1] ≫* V2 &
+                                   ↑[O, i + 1] V2 ≡ T2 &
+                                   I = LRef i.
+#L #T2 #I #d #e #H @(tpss_ind … H) -H T2
+[ /2/
+| #T #T2 #_ #HT2 *
+  [ #H destruct -T;
+    elim (tps_inv_atom1 … HT2) -HT2 [ /2/ | * /3 width=10/ ]
+  | * #K #V1 #V #i #Hdi #Hide #HLK #HV1 #HVT #HI
+    lapply (drop_fwd_drop2 … HLK) #H
+    elim (tps_inv_lift1_up … HT2 … H … HVT ? ? ?) normalize -HT2 H HVT [2,3,4: /2/ ] #V2 <minus_plus #HV2 #HVT2
+    @or_intror @(ex6_4_intro … Hdi Hide HLK … HVT2 HI) /2/ (**) (* /4 width=10/ is too slow *)
+  ]
+]
+qed.
+
+lemma tpss_inv_lref1: ∀L,T2,i,d,e. L ⊢ #i [d, e] ≫* T2 →
+                      T2 = #i ∨
+                      ∃∃K,V1,V2. d ≤ i & i < d + e &
+                                 ↓[O, i] L ≡ K. 𝕓{Abbr} V1 &
+                                 K ⊢ V1 [0, d + e - i - 1] ≫* V2 &
+                                 ↑[O, i + 1] V2 ≡ T2.
+#L #T2 #i #d #e #H
+elim (tpss_inv_atom1 … H) -H /2/
+* #K #V1 #V2 #j #Hdj #Hjde #HLK #HV12 #HVT2 #H destruct -i /3 width=6/
+qed.
+
+lemma tpss_inv_refl_SO2: ∀L,T1,T2,d. L ⊢ T1 [d, 1] ≫* T2 →
+                         ∀K,V. ↓[0, d] L ≡ K. 𝕓{Abst} V → T1 = T2.
+#L #T1 #T2 #d #H #K #V #HLK @(tpss_ind … H) -H T2 //
+#T #T2 #_ #HT2 #IHT <(tps_inv_refl_SO2 … HT2 … HLK) //
+qed.
+
+(* Relocation properties ****************************************************)
+
+lemma tpss_lift_le: ∀K,T1,T2,dt,et. K ⊢ T1 [dt, et] ≫* T2 →
+                    ∀L,U1,d,e. dt + et ≤ d → ↓[d, e] L ≡ K →
+                    ↑[d, e] T1 ≡ U1 → ∀U2. ↑[d, e] T2 ≡ U2 →
+                    L ⊢ U1 [dt, et] ≫* U2.
+#K #T1 #T2 #dt #et #H #L #U1 #d #e #Hdetd #HLK #HTU1 @(tpss_ind … H) -H T2
+[ #U2 #H >(lift_mono … HTU1 … H) -H //
+| -HTU1 #T #T2 #_ #HT2 #IHT #U2 #HTU2
+  elim (lift_total T d e) #U #HTU
+  lapply (IHT … HTU) -IHT #HU1
+  lapply (tps_lift_le … HT2 … HLK HTU HTU2 ?) -HT2 HLK HTU HTU2 /2/
+]
+qed.
+
+lemma tpss_lift_ge: ∀K,T1,T2,dt,et. K ⊢ T1 [dt, et] ≫* T2 →
+                    ∀L,U1,d,e. d ≤ dt → ↓[d, e] L ≡ K →
+                    ↑[d, e] T1 ≡ U1 → ∀U2. ↑[d, e] T2 ≡ U2 →
+                    L ⊢ U1 [dt + e, et] ≫* U2.
+#K #T1 #T2 #dt #et #H #L #U1 #d #e #Hddt #HLK #HTU1 @(tpss_ind … H) -H T2
+[ #U2 #H >(lift_mono … HTU1 … H) -H //
+| -HTU1 #T #T2 #_ #HT2 #IHT #U2 #HTU2
+  elim (lift_total T d e) #U #HTU
+  lapply (IHT … HTU) -IHT #HU1
+  lapply (tps_lift_ge … HT2 … HLK HTU HTU2 ?) -HT2 HLK HTU HTU2 /2/
+]
+qed.
+
+lemma tpss_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 #K #d #e #HLK #T1 #HTU1 #Hdetd @(tpss_ind … H) -H U2
+[ /2/
+| -HTU1 #U #U2 #_ #HU2 * #T #HT1 #HTU
+  elim (tps_inv_lift1_le … HU2 … HLK … HTU ?) -HU2 HLK HTU /3/
+]
+qed.
+
+lemma tpss_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 #K #d #e #HLK #T1 #HTU1 #Hdedt @(tpss_ind … H) -H U2
+[ /2/
+| -HTU1 #U #U2 #_ #HU2 * #T #HT1 #HTU
+  elim (tps_inv_lift1_ge … HU2 … HLK … HTU ?) -HU2 HLK HTU /3/
+]
+qed.
+
+lemma tpss_inv_lift1_eq: ∀L,U1,U2,d,e.
+                         L ⊢ U1 [d, e] ≫* U2 → ∀T1. ↑[d, e] T1 ≡ U1 → U1 = U2.
+#L #U1 #U2 #d #e #H #T1 #HTU1 @(tpss_ind … H) -H U2 //
+#U #U2 #_ #HU2 #IHU destruct -U1
+<(tps_inv_lift1_eq … HU2 … HTU1) -HU2 HTU1 //
+qed.
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/unfold/tpss_ltps.ma b/matita/matita/contribs/lambda_delta/Basic_2/unfold/tpss_ltps.ma
new file mode 100644 (file)
index 0000000..645d9d0
--- /dev/null
@@ -0,0 +1,94 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The 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/ltps_tps.ma".
+include "Basic-2/unfold/tpss_tpss.ma".
+
+(* PARTIAL UNFOLD ON TERMS **************************************************)
+
+(* Properties concerning parallel substitution on local environments ********)
+
+lemma ltps_tpss_conf_ge: ∀L0,L1,T2,U2,d1,e1,d2,e2.
+                         d1 + e1 ≤ d2 → L0 [d1, e1] ≫ L1 →
+                         L0 ⊢ T2 [d2, e2] ≫* U2 → L1 ⊢ T2 [d2, e2] ≫* U2.
+#L0 #L1 #T2 #U2 #d1 #e1 #d2 #e2 #Hde1d2 #HL01 #H @(tpss_ind … H) -U2 //
+#U #U2 #_ #HU2 #IHU
+lapply (ltps_tps_conf_ge … HU2 … HL01 ?) -HU2 HL01 /2/
+qed.
+
+lemma ltps_tpss_conf: ∀L0,L1,T2,U2,d1,e1,d2,e2.
+                      L0 [d1, e1] ≫ L1 → L0 ⊢ T2 [d2, e2] ≫* U2 →
+                      ∃∃T. L1 ⊢ T2 [d2, e2] ≫* T & L1 ⊢ U2 [d1, e1] ≫* T.
+#L0 #L1 #T2 #U2 #d1 #e1 #d2 #e2 #HL01 #H @(tpss_ind … H) -U2
+[ /3/
+| #U #U2 #_ #HU2 * #T #HT2 #HUT
+  elim (ltps_tps_conf … HU2 … HL01) -HU2 HL01 #W #HUW #HU2W
+  elim (tpss_strip_eq … HUT … HUW) -U
+  /3 width=5 by ex2_1_intro, step, tpss_strap/ (**) (* just /3 width=5/ is too slow *)
+]
+qed.
+
+lemma ltps_tpss_trans_ge: ∀L0,L1,T2,U2,d1,e1,d2,e2.
+                          d1 + e1 ≤ d2 → L1 [d1, e1] ≫ L0 →
+                          L0 ⊢ T2 [d2, e2] ≫* U2 → L1 ⊢ T2 [d2, e2] ≫* U2.
+#L0 #L1 #T2 #U2 #d1 #e1 #d2 #e2 #Hde1d2 #HL10 #H @(tpss_ind … H) -U2 //
+#U #U2 #_ #HU2 #IHU
+lapply (ltps_tps_trans_ge … HU2 … HL10 ?) -HU2 HL10 /2/
+qed.
+
+lemma ltps_tpss_trans_down: ∀L0,L1,T2,U2,d1,e1,d2,e2. d2 + e2 ≤ d1 →
+                            L1 [d1, e1] ≫ L0 → L0 ⊢ T2 [d2, e2] ≫* U2 →
+                            ∃∃T. L1 ⊢ T2 [d2, e2] ≫* T & L0 ⊢ T [d1, e1] ≫* U2.
+#L0 #L1 #T2 #U2 #d1 #e1 #d2 #e2 #Hde2d1 #HL10 #H @(tpss_ind … H) -U2
+[ /3/
+| #U #U2 #_ #HU2 * #T #HT2 #HTU
+  elim (tpss_strap1_down … HTU … HU2 ?) -U // #U #HTU #HU2
+  elim (ltps_tps_trans … HTU … HL10) -HTU HL10 #W #HTW #HWU
+  @(ex2_1_intro … W) /2/ (**) (* /3 width=5/ does not work as in ltps_tpss_conf *)
+]
+qed.
+
+fact ltps_tps_trans_eq_aux: ∀Y1,X2,L1,T2,U2,d,e.
+                            L1 ⊢ T2 [d, e] ≫ U2 → ∀L0. L0 [d, e] ≫ L1 →
+                            Y1 = L1 → X2 = T2 → L0 ⊢ T2 [d, e] ≫* U2.
+#Y1 #X2 @(cw_wf_ind … Y1 X2) -Y1 X2 #Y1 #X2 #IH
+#L1 #T2 #U2 #d #e * -L1 T2 U2 d e
+[ //
+| #L1 #K1 #V1 #W1 #i #d #e #Hdi #Hide #HLK1 #HVW1 #L0 #HL10 #H1 #H2 destruct -Y1 X2;
+  lapply (drop_fwd_lw … HLK1) normalize #H1
+  elim (ltps_drop_trans_be … HL10 … HLK1 ? ?) -HL10 HLK1 [2,3: /2/ ] #X #H #HLK0
+  elim (ltps_inv_tps22 … H ?) -H [2: /2/ ] #K0 #V0 #HK01 #HV01 #H destruct -X;
+  lapply (tps_fwd_tw … HV01) #H2
+  lapply (transitive_le (#[K1] + #[V0]) … H1) -H1 [ /2/ ] -H2 #H
+  lapply (IH … HV01 … HK01 ? ?) -IH HV01 HK01 [1,3: // |2,4: skip | /2/ | /3 width=6/ ]
+| #L #I #V1 #V2 #T1 #T2 #d #e #HV12 #HT12 #L0 #HL0 #H1 #H2 destruct -Y1 X2;
+  lapply (tps_leq_repl_dx … HT12 (L. 𝕓{I} V1) ?) -HT12 /2/ #HT12
+  lapply (IH … HV12 … HL0 ? ?) -HV12 [1,3,5: // |2,4: skip ] #HV12
+  lapply (IH … HT12 (L0. 𝕓{I} V1) ? ? ?) -IH HT12 [1,3,5: /2/ |2,4: skip | normalize // ] -HL0 #HT12
+  lapply (tpss_leq_repl_dx … HT12 (L0. 𝕓{I} V2) ?) -HT12 /2/
+| #L #I #V1 #V2 #T1 #T2 #d #e #HV12 #HT12 #L0 #HL0 #H1 #H2 destruct -Y1 X2;
+  lapply (IH … HV12 … HL0 ? ?) -HV12 [1,3,5: // |2,4: skip ]
+  lapply (IH … HT12 … HL0 ? ?) -IH HT12 [1,3,5: // |2,4: skip ] -HL0 /2/
+]
+qed.
+
+lemma ltps_tps_trans_eq: ∀L1,T2,U2,d,e. L1 ⊢ T2 [d, e] ≫ U2 →
+                         ∀L0. L0 [d, e] ≫ L1 → L0 ⊢ T2 [d, e] ≫* U2.
+/2 width=5/ qed.
+
+lemma ltps_tpss_trans_eq: ∀L0,L1,T2,U2,d,e. L0 [d, e] ≫ L1 →
+                          L1 ⊢ T2 [d, e] ≫* U2 → L0 ⊢ T2 [d, e] ≫* U2.
+#L0 #L1 #T2 #U2 #d #e #HL01 #H @(tpss_ind … H) -U2 //
+#U #U2 #_ #HU2 #IHU @(tpss_trans_eq … IHU) /2/
+qed.
diff --git a/matita/matita/contribs/lambda_delta/Basic_2/unfold/tpss_tpss.ma b/matita/matita/contribs/lambda_delta/Basic_2/unfold/tpss_tpss.ma
new file mode 100644 (file)
index 0000000..a849284
--- /dev/null
@@ -0,0 +1,93 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The 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/tps_tps.ma".
+include "Basic-2/unfold/tpss_lift.ma".
+
+(* PARTIAL UNFOLD ON TERMS **************************************************)
+
+(* Advanced properties ******************************************************)
+
+lemma tpss_tps: ∀L,T1,T2,d. L ⊢ T1 [d, 1] ≫* T2 → L ⊢ T1 [d, 1] ≫ T2.
+#L #T1 #T2 #d #H @(tpss_ind … H) -H T2 //
+#T #T2 #_ #HT2 #IHT1
+lapply (tps_trans_ge … IHT1 … HT2 ?) //
+qed.
+
+lemma tpss_strip_eq: ∀L,T0,T1,d1,e1. L ⊢ T0 [d1, e1] ≫* T1 →
+                     ∀T2,d2,e2. L ⊢ T0 [d2, e2] ≫ T2 →
+                     ∃∃T. L ⊢ T1 [d2, e2] ≫ T & L ⊢ T2 [d1, e1] ≫* T.
+/3/ qed.
+
+lemma tpss_strip_neq: ∀L1,T0,T1,d1,e1. L1 ⊢ T0 [d1, e1] ≫* T1 →
+                      ∀L2,T2,d2,e2. L2 ⊢ T0 [d2, e2] ≫ T2 →
+                      (d1 + e1 ≤ d2 ∨ d2 + e2 ≤ d1) →
+                      ∃∃T. L2 ⊢ T1 [d2, e2] ≫ T & L1 ⊢ T2 [d1, e1] ≫* T.
+/3/ qed.
+
+lemma tpss_strap1_down: ∀L,T1,T0,d1,e1. L ⊢ T1 [d1, e1] ≫* T0 →
+                        ∀T2,d2,e2. L ⊢ T0 [d2, e2] ≫ T2 → d2 + e2 ≤ d1 →
+                        ∃∃T. L ⊢ T1 [d2, e2] ≫ T & L ⊢ T [d1, e1] ≫* T2.
+/3/ qed.
+
+lemma tpss_strap2_down: ∀L,T1,T0,d1,e1. L ⊢ T1 [d1, e1] ≫ T0 →
+                        ∀T2,d2,e2. L ⊢ T0 [d2, e2] ≫* T2 → d2 + e2 ≤ d1 →
+                        ∃∃T. L ⊢ T1 [d2, e2] ≫* T & L ⊢ T [d1, e1] ≫ T2.
+/3/ qed.
+
+lemma tpss_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 #i #Hdi #Hide @(tpss_ind … H) -H T2
+[ /2/
+| #T #T2 #_ #HT12 * #T3 #HT13 #HT3
+  elim (tps_split_up … HT12 … Hdi Hide) -HT12 Hide #T0 #HT0 #HT02
+  elim (tpss_strap1_down … HT3 … HT0 ?) -T [2: <plus_minus_m_m_comm // ]
+  /3 width=7 by ex2_1_intro, step/ (**) (* just /3 width=7/ is too slow *)
+]
+qed.
+
+lemma tpss_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 (tpss_split_up … HU12 (d + e) ? ?) -HU12 // -Hdedet #U #HU1 #HU2
+lapply (tpss_weak … HU1 d e ? ?) -HU1 // <plus_minus_m_m_comm // -Hddt Hdtde #HU1
+lapply (tpss_inv_lift1_eq … HU1 … HTU1) -HU1 #HU1 destruct -U1;
+elim (tpss_inv_lift1_ge … HU2 … HLK … HTU1 ?) -HU2 HLK HTU1 // <minus_plus_m_m /2/
+qed.
+
+(* Main properties **********************************************************)
+
+theorem tpss_conf_eq: ∀L,T0,T1,d1,e1. L ⊢ T0 [d1, e1] ≫* T1 →
+                      ∀T2,d2,e2. L ⊢ T0 [d2, e2] ≫* T2 →
+                      ∃∃T. L ⊢ T1 [d2, e2] ≫* T & L ⊢ T2 [d1, e1] ≫* T.
+/3/ qed.
+
+theorem tpss_conf_neq: ∀L1,T0,T1,d1,e1. L1 ⊢ T0 [d1, e1] ≫* T1 →
+                       ∀L2,T2,d2,e2. L2 ⊢ T0 [d2, e2] ≫* T2 →
+                       (d1 + e1 ≤ d2 ∨ d2 + e2 ≤ d1) →
+                       ∃∃T. L2 ⊢ T1 [d2, e2] ≫* T & L1 ⊢ T2 [d1, e1] ≫* T.
+/3/ qed.
+
+theorem tpss_trans_eq: ∀L,T1,T,T2,d,e.
+                       L ⊢ T1 [d, e] ≫* T → L ⊢ T [d, e] ≫* T2 →
+                       L ⊢ T1 [d, e] ≫* T2. 
+/2/ qed.
+
+theorem tpss_trans_down: ∀L,T1,T0,d1,e1. L ⊢ T1 [d1, e1] ≫* T0 →
+                         ∀T2,d2,e2. L ⊢ T0 [d2, e2] ≫* T2 → d2 + e2 ≤ d1 →
+                         ∃∃T. L ⊢ T1 [d2, e2] ≫* T & L ⊢ T [d1, e1] ≫* T2.
+/3/ qed.
diff --git a/matita/matita/contribs/lambda_delta/Ground_2/arith.ma b/matita/matita/contribs/lambda_delta/Ground_2/arith.ma
new file mode 100644 (file)
index 0000000..3bb6514
--- /dev/null
@@ -0,0 +1,185 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The 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 "arithmetics/nat.ma".
+include "Ground-2/xoa_props.ma".
+
+(* ARITHMETICAL PROPERTIES **************************************************)
+
+lemma plus_S_eq_O_false: ∀n,m. n + S m = 0 → False.
+#n #m <plus_n_Sm #H destruct
+qed.
+
+lemma plus_S_le_to_pos: ∀n,m,p. n + S m ≤ p → 0 < p.
+#n #m #p <plus_n_Sm #H @(lt_to_le_to_lt … H) //
+qed.
+
+lemma minus_le: ∀m,n. m - n ≤ m.
+/2/ qed.
+
+lemma le_O_to_eq_O: ∀n. n ≤ 0 → n = 0.
+/2/ qed.
+
+lemma lt_to_le: ∀a,b. a < b → a ≤ b.
+/2/ qed.
+
+lemma lt_refl_false: ∀n. n < n → False.
+#n #H elim (lt_to_not_eq … H) -H /2/
+qed.
+
+lemma lt_zero_false: ∀n. n < 0 → False.
+#n #H elim (lt_to_not_le … H) -H /2/
+qed.
+
+lemma lt_or_ge: ∀m,n. m < n ∨ n ≤ m.
+#m #n elim (decidable_lt m n) /3/
+qed.
+
+lemma lt_or_eq_or_gt: ∀m,n. ∨∨ m < n | n = m | n < m.
+#m elim m -m
+[ * /2/
+| #m #IHm * [ /2/ ]
+  #n elim (IHm n) -IHm #H 
+  [ @or3_intro0 | @or3_intro1 destruct | @or3_intro2 ] /2/ (**) (* /3/ is slow *)
+  qed. 
+
+lemma le_to_lt_or_eq: ∀m,n. m ≤ n → m < n ∨ m = n.
+#m #n * -n /3/
+qed. 
+
+lemma plus_le_weak: ∀m,n,p. m + n ≤ p → n ≤ p.
+/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)
+qed.
+
+lemma monotonic_lt_minus_l: ∀p,q,n. n ≤ q → q < p → q - n < p - n.
+#p #q #n #H1 #H2
+@lt_plus_to_minus_r <plus_minus_m_m //.
+qed.
+
+lemma plus_le_minus: ∀a,b,c. a + b ≤ c → a ≤ c - b.
+/2/ qed.
+
+lemma lt_plus_minus: ∀i,u,d. u ≤ i → i < d + u → i - u < d.
+/2/ qed.
+
+lemma plus_plus_comm_23: ∀m,n,p. m + n + p = m + p + n.
+// qed.
+
+lemma le_plus_minus_comm: ∀n,m,p. p ≤ m → m + n - p = m - p + n.
+#n #m #p #lepm @plus_to_minus <associative_plus
+>(commutative_plus p) <plus_minus_m_m //
+qed.
+
+lemma minus_le_minus_minus_comm: ∀b,c,a. c ≤ b → a - (b - c) = a + c - b.
+#b elim b -b
+[ #c #a #H >(le_O_to_eq_O … H) -H //
+| #b #IHb #c elim c -c //
+  #c #_ #a #Hcb
+  lapply (le_S_S_to_le … Hcb) -Hcb #Hcb
+  <plus_n_Sm normalize /2/
+]
+qed.
+
+lemma minus_plus_comm: ∀a,b,c. a - b - c = a - (c + b).
+// qed.
+
+lemma minus_minus_comm: ∀a,b,c. a - b - c = a - c - b.
+/3/ qed.
+
+lemma le_plus_minus: ∀a,b,c. c ≤ b → a + b - c = a + (b - c).
+/2/ qed.
+
+lemma plus_minus_m_m_comm: ∀n,m. m ≤ n → n = m + (n - m).
+/2/ qed.
+
+lemma minus_plus_m_m_comm: ∀n,m. n = (m + n) - m.
+/2/ qed.
+
+lemma arith_a2: ∀a,c1,c2. c1 + c2 ≤ a → a - c1 - c2 + (c1 + c2) = a.
+/2/ qed.
+
+lemma arith_b1: ∀a,b,c1. c1 ≤ b → a - c1 - (b - c1) = a - b.
+#a #b #c1 #H >minus_plus @eq_f2 /2/
+qed.
+
+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 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 arith_d1: ∀a,b,c1. c1 ≤ b → a + c1 + (b - c1) = a + b.
+/2/ qed.
+
+lemma arith_e2: ∀a,c1,c2. a ≤ c1 → c1 + c2 - (c1 - a + c2) = a.
+/3/ qed.
+
+lemma arith_f1: ∀a,b,c1. a + b ≤ c1 → c1 - (c1 - a - b) = a + b.
+#a #b #c1 #H >minus_plus <minus_minus //
+qed.
+
+lemma arith_g1: ∀a,b,c1. c1 ≤ b → a - (b - c1) - c1 = a - b.
+/2/ qed.
+
+lemma arith_h1: ∀a1,a2,b,c1. c1 ≤ a1 → c1 ≤ b →
+                a1 - c1 + a2 - (b - c1) = a1 + a2 - b.
+#a1 #a2 #b #c1 #H1 #H2 <le_plus_minus_comm /2/
+qed.
+
+lemma arith_i2: ∀a,c1,c2. c1 + c2 ≤ a → c1 + c2 + (a - c1 - c2) = a.
+/2/ qed.
+
+lemma arith_z1: ∀a,b,c1. a + c1 - b - c1 = a - b.
+// qed.
+
+(* unstable *****************************************************************)
+
+lemma arith1: ∀n,h,m,p. n + h + m ≤ p + h → n + m ≤ p.
+/2/ qed.
+
+lemma arith2: ∀j,i,e,d. d + e ≤ i → d ≤ i - e + j.
+#j #i #e #d #H lapply (plus_le_minus … H) -H /2/
+qed.
+
+lemma arith3: ∀a1,a2,b,c1. a1 + a2 ≤ b → a1 + c1 + a2 ≤ b + c1.
+/2/ qed.
+
+lemma arith4: ∀h,d,e1,e2. d ≤ e1 + e2 → d + h ≤ e1 + h + e2.
+/2/ qed.
+
+lemma arith5: ∀a,b1,b2,c1. c1 ≤ b1 → c1 ≤ a → a < b1 + b2 → a - c1 < b1 - c1 + b2.
+#a #b1 #b2 #c1 #H1 #H2 #H3
+<le_plus_minus_comm // @monotonic_lt_minus_l //
+qed.
+
+lemma arith8: ∀a,b. a < a + b + 1.
+// qed.
+
+lemma arith9: ∀a,b,c. c < a + (b + c + 1) + 1.
+// qed.
+
+lemma arith10: ∀a,b,c,d,e. a ≤ b → c + (a - d - e) ≤ c + (b - d - e).
+#a #b #c #d #e #H
+>minus_plus >minus_plus @monotonic_le_plus_r @monotonic_le_minus_l //
+qed.
diff --git a/matita/matita/contribs/lambda_delta/Ground_2/list.ma b/matita/matita/contribs/lambda_delta/Ground_2/list.ma
new file mode 100644 (file)
index 0000000..1b64bac
--- /dev/null
@@ -0,0 +1,34 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "Ground-2/arith.ma".
+include "Ground-2/notation.ma".
+
+(* LISTS ********************************************************************)
+
+inductive list (A:Type[0]) : Type[0] :=
+  | nil : list A
+  | cons: A -> list A -> list A.
+
+interpretation "nil (list)" 'Nil = (nil ?).
+
+interpretation "cons (list)" 'Cons hd tl = (cons ? hd tl).
+
+let rec append A (l1: list A) l2 on l1 ≝ 
+  match l1 with
+  [ nil        ⇒  l2
+  | cons hd tl ⇒  hd :: append A tl l2
+  ].
+
+interpretation "append (list)" 'Append l1 l2 = (append ? l1 l2).
diff --git a/matita/matita/contribs/lambda_delta/Ground_2/notation.ma b/matita/matita/contribs/lambda_delta/Ground_2/notation.ma
new file mode 100644 (file)
index 0000000..dab6b49
--- /dev/null
@@ -0,0 +1,25 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+(* GENERAL NOTATION USED BY THE FORMAL SYSTEM λδ ****************************)
+
+(* Lists ********************************************************************)
+
+notation "hvbox( hd break :: tl )"
+  right associative with precedence 47
+  for @{'Cons $hd $tl}.
+
+notation "hvbox( l1 break @ l2)"
+  right associative with precedence 47
+  for @{'Append $l1 $l2 }.
diff --git a/matita/matita/contribs/lambda_delta/Ground_2/star.ma b/matita/matita/contribs/lambda_delta/Ground_2/star.ma
new file mode 100644 (file)
index 0000000..baed9b7
--- /dev/null
@@ -0,0 +1,109 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The 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 "basics/star.ma".
+include "Ground-2/xoa_props.ma".
+
+(* PROPERTIES of RELATIONS **************************************************)
+
+definition confluent: ∀A. ∀R1,R2: relation A. Prop ≝ λA,R1,R2.
+                      ∀a0,a1. R1 a0 a1 → ∀a2. R2 a0 a2 →
+                      ∃∃a. R2 a1 a & R1 a2 a.
+
+definition transitive: ∀A. ∀R1,R2: relation A. Prop ≝ λA,R1,R2.
+                       ∀a1,a0. R1 a1 a0 → ∀a2. R2 a0 a2 →
+                       ∃∃a. R2 a1 a & R1 a a2.
+
+lemma TC_strip1: ∀A,R1,R2. confluent A R1 R2 →
+                 ∀a0,a1. TC … R1 a0 a1 → ∀a2. R2 a0 a2 →
+                 ∃∃a. R2 a1 a & TC … R1 a2 a.
+#A #R1 #R2 #HR12 #a0 #a1 #H elim H -H a1
+[ #a1 #Ha01 #a2 #Ha02
+  elim (HR12 … Ha01 … Ha02) -HR12 a0 /3/
+| #a #a1 #_ #Ha1 #IHa0 #a2 #Ha02
+  elim (IHa0 … Ha02) -IHa0 Ha02 a0 #a0 #Ha0 #Ha20
+  elim (HR12 … Ha1 … Ha0) -HR12 a /4/
+]
+qed.
+
+lemma TC_strip2: ∀A,R1,R2. confluent A R1 R2 →
+                 ∀a0,a2. TC … R2 a0 a2 → ∀a1. R1 a0 a1 →
+                 ∃∃a. TC … R2 a1 a & R1 a2 a.
+#A #R1 #R2 #HR12 #a0 #a2 #H elim H -H a2
+[ #a2 #Ha02 #a1 #Ha01
+  elim (HR12 … Ha01 … Ha02) -HR12 a0 /3/
+| #a #a2 #_ #Ha2 #IHa0 #a1 #Ha01
+  elim (IHa0 … Ha01) -IHa0 Ha01 a0 #a0 #Ha10 #Ha0
+  elim (HR12 … Ha0 … Ha2) -HR12 a /4/
+]
+qed.
+
+lemma TC_confluent: ∀A,R1,R2.
+                    confluent A R1 R2 → confluent A (TC … R1) (TC … R2).
+#A #R1 #R2 #HR12 #a0 #a1 #H elim H -H a1
+[ #a1 #Ha01 #a2 #Ha02
+  elim (TC_strip2 … HR12 … Ha02 … Ha01) -HR12 a0 /3/
+| #a #a1 #_ #Ha1 #IHa0 #a2 #Ha02
+  elim (IHa0 … Ha02) -IHa0 Ha02 a0 #a0 #Ha0 #Ha20
+  elim (TC_strip2 … HR12 … Ha0 … Ha1) -HR12 a /4/
+]
+qed.
+
+lemma TC_strap: ∀A. ∀R:relation A. ∀a1,a,a2.
+                R a1 a → TC … R a a2 → TC … R a1 a2.
+/3/ qed.
+
+lemma TC_strap1: ∀A,R1,R2. transitive A R1 R2 →
+                 ∀a1,a0. TC … R1 a1 a0 → ∀a2. R2 a0 a2 →
+                 ∃∃a. R2 a1 a & TC … R1 a a2.
+#A #R1 #R2 #HR12 #a1 #a0 #H elim H -H a0
+[ #a0 #Ha10 #a2 #Ha02
+  elim (HR12 … Ha10 … Ha02) -HR12 a0 /3/
+| #a #a0 #_ #Ha0 #IHa #a2 #Ha02
+  elim (HR12 … Ha0 … Ha02) -HR12 a0 #a0 #Ha0 #Ha02
+  elim (IHa … Ha0) -a /4/
+]
+qed.
+
+lemma TC_strap2: ∀A,R1,R2. transitive A R1 R2 →
+                 ∀a0,a2. TC … R2 a0 a2 → ∀a1. R1 a1 a0 →
+                 ∃∃a. TC … R2 a1 a & R1 a a2.
+#A #R1 #R2 #HR12 #a0 #a2 #H elim H -H a2
+[ #a2 #Ha02 #a1 #Ha10
+  elim (HR12 … Ha10 … Ha02) -HR12 a0 /3/
+| #a #a2 #_ #Ha02 #IHa #a1 #Ha10
+  elim (IHa … Ha10) -a0 #a0 #Ha10 #Ha0
+  elim (HR12 … Ha0 … Ha02) -HR12 a /4/
+]
+qed.
+
+lemma TC_transitive: ∀A,R1,R2.
+                     transitive A R1 R2 → transitive A (TC … R1) (TC … R2).
+#A #R1 #R2 #HR12 #a1 #a0 #H elim H -a0
+[ #a0 #Ha10 #a2 #Ha02
+  elim (TC_strap2 … HR12 … Ha02 … Ha10) -HR12 a0 /3/
+| #a #a0 #_ #Ha0 #IHa #a2 #Ha02
+  elim (TC_strap2 … HR12 … Ha02 … Ha0) -HR12 a0 #a0 #Ha0 #Ha02
+  elim (IHa … Ha0) -a /4/
+]
+qed.
+
+lemma TC_reflexive: ∀A,R. reflexive A R → reflexive A (TC … R).
+/2/ qed.
+
+lemma TC_star_ind: ∀A,R. reflexive A R → ∀a1. ∀P:A→Prop.
+                   P a1 → (∀a,a2. TC … R a1 a → R a a2 → P a → P a2) →
+                   ∀a2. TC … R a1 a2 → P a2.
+#A #R #H #a1 #P #Ha1 #IHa1 #a2 #Ha12 elim Ha12 -Ha12 a2 /3/
+qed.
diff --git a/matita/matita/contribs/lambda_delta/Ground_2/xoa.conf.xml b/matita/matita/contribs/lambda_delta/Ground_2/xoa.conf.xml
new file mode 100644 (file)
index 0000000..f749fe1
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<helm_registry>
+  <section name="matita">
+    <key name="rt_base_dir">$(MATITA_RT_BASE_DIR)</key>
+<!--
+    <key name="system">false</key>
+    <key name="map_unicode_to_tex">false</key>
+    <key name="do_heavy_checks">true</key>
+    <key name="include_path">lib</key>
+-->
+  </section>
+  <section name="xoa">
+    <key name="output_dir">contribs/lambda-delta/Ground-2</key>
+    <key name="objects">xoa</key>
+    <key name="notations">xoa_notation</key>
+    <key name="include">basics/pts.ma</key>
+    <key name="ex">2 1</key>
+    <key name="ex">2 2</key>
+    <key name="ex">3 1</key>
+    <key name="ex">3 2</key>
+    <key name="ex">3 3</key>
+    <key name="ex">4 2</key>
+    <key name="ex">4 3</key>
+    <key name="ex">4 4</key>
+    <key name="ex">5 3</key>
+    <key name="ex">5 4</key>
+    <key name="ex">6 4</key>
+    <key name="ex">6 6</key>
+    <key name="ex">7 6</key>
+    <key name="or">3</key>
+    <key name="or">4</key>
+<!--    
+    <key name="and">3</key>
+-->
+  </section>
+</helm_registry>
diff --git a/matita/matita/contribs/lambda_delta/Ground_2/xoa.ma b/matita/matita/contribs/lambda_delta/Ground_2/xoa.ma
new file mode 100644 (file)
index 0000000..2b7af45
--- /dev/null
@@ -0,0 +1,143 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+(* This file was generated by xoa.native: do not edit *********************)
+
+include "basics/pts.ma".
+
+(* multiple existental quantifier (2, 1) *)
+
+inductive ex2_1 (A0:Type[0]) (P0,P1:A0→Prop) : Prop ≝
+   | ex2_1_intro: ∀x0. P0 x0 → P1 x0 → ex2_1 ? ? ?
+.
+
+interpretation "multiple existental quantifier (2, 1)" 'Ex P0 P1 = (ex2_1 ? P0 P1).
+
+(* multiple existental quantifier (2, 2) *)
+
+inductive ex2_2 (A0,A1:Type[0]) (P0,P1:A0→A1→Prop) : Prop ≝
+   | ex2_2_intro: ∀x0,x1. P0 x0 x1 → P1 x0 x1 → ex2_2 ? ? ? ?
+.
+
+interpretation "multiple existental quantifier (2, 2)" 'Ex P0 P1 = (ex2_2 ? ? P0 P1).
+
+(* multiple existental quantifier (3, 1) *)
+
+inductive ex3_1 (A0:Type[0]) (P0,P1,P2:A0→Prop) : Prop ≝
+   | ex3_1_intro: ∀x0. P0 x0 → P1 x0 → P2 x0 → ex3_1 ? ? ? ?
+.
+
+interpretation "multiple existental quantifier (3, 1)" 'Ex P0 P1 P2 = (ex3_1 ? P0 P1 P2).
+
+(* multiple existental quantifier (3, 2) *)
+
+inductive ex3_2 (A0,A1:Type[0]) (P0,P1,P2:A0→A1→Prop) : Prop ≝
+   | ex3_2_intro: ∀x0,x1. P0 x0 x1 → P1 x0 x1 → P2 x0 x1 → ex3_2 ? ? ? ? ?
+.
+
+interpretation "multiple existental quantifier (3, 2)" 'Ex P0 P1 P2 = (ex3_2 ? ? P0 P1 P2).
+
+(* multiple existental quantifier (3, 3) *)
+
+inductive ex3_3 (A0,A1,A2:Type[0]) (P0,P1,P2:A0→A1→A2→Prop) : Prop ≝
+   | ex3_3_intro: ∀x0,x1,x2. P0 x0 x1 x2 → P1 x0 x1 x2 → P2 x0 x1 x2 → ex3_3 ? ? ? ? ? ?
+.
+
+interpretation "multiple existental quantifier (3, 3)" 'Ex P0 P1 P2 = (ex3_3 ? ? ? P0 P1 P2).
+
+(* multiple existental quantifier (4, 2) *)
+
+inductive ex4_2 (A0,A1:Type[0]) (P0,P1,P2,P3:A0→A1→Prop) : Prop ≝
+   | ex4_2_intro: ∀x0,x1. P0 x0 x1 → P1 x0 x1 → P2 x0 x1 → P3 x0 x1 → ex4_2 ? ? ? ? ? ?
+.
+
+interpretation "multiple existental quantifier (4, 2)" 'Ex P0 P1 P2 P3 = (ex4_2 ? ? P0 P1 P2 P3).
+
+(* multiple existental quantifier (4, 3) *)
+
+inductive ex4_3 (A0,A1,A2:Type[0]) (P0,P1,P2,P3:A0→A1→A2→Prop) : Prop ≝
+   | ex4_3_intro: ∀x0,x1,x2. P0 x0 x1 x2 → P1 x0 x1 x2 → P2 x0 x1 x2 → P3 x0 x1 x2 → ex4_3 ? ? ? ? ? ? ?
+.
+
+interpretation "multiple existental quantifier (4, 3)" 'Ex P0 P1 P2 P3 = (ex4_3 ? ? ? P0 P1 P2 P3).
+
+(* multiple existental quantifier (4, 4) *)
+
+inductive ex4_4 (A0,A1,A2,A3:Type[0]) (P0,P1,P2,P3:A0→A1→A2→A3→Prop) : Prop ≝
+   | ex4_4_intro: ∀x0,x1,x2,x3. P0 x0 x1 x2 x3 → P1 x0 x1 x2 x3 → P2 x0 x1 x2 x3 → P3 x0 x1 x2 x3 → ex4_4 ? ? ? ? ? ? ? ?
+.
+
+interpretation "multiple existental quantifier (4, 4)" 'Ex P0 P1 P2 P3 = (ex4_4 ? ? ? ? P0 P1 P2 P3).
+
+(* multiple existental quantifier (5, 3) *)
+
+inductive ex5_3 (A0,A1,A2:Type[0]) (P0,P1,P2,P3,P4:A0→A1→A2→Prop) : Prop ≝
+   | ex5_3_intro: ∀x0,x1,x2. P0 x0 x1 x2 → P1 x0 x1 x2 → P2 x0 x1 x2 → P3 x0 x1 x2 → P4 x0 x1 x2 → ex5_3 ? ? ? ? ? ? ? ?
+.
+
+interpretation "multiple existental quantifier (5, 3)" 'Ex P0 P1 P2 P3 P4 = (ex5_3 ? ? ? P0 P1 P2 P3 P4).
+
+(* multiple existental quantifier (5, 4) *)
+
+inductive ex5_4 (A0,A1,A2,A3:Type[0]) (P0,P1,P2,P3,P4:A0→A1→A2→A3→Prop) : Prop ≝
+   | ex5_4_intro: ∀x0,x1,x2,x3. P0 x0 x1 x2 x3 → P1 x0 x1 x2 x3 → P2 x0 x1 x2 x3 → P3 x0 x1 x2 x3 → P4 x0 x1 x2 x3 → ex5_4 ? ? ? ? ? ? ? ? ?
+.
+
+interpretation "multiple existental quantifier (5, 4)" 'Ex P0 P1 P2 P3 P4 = (ex5_4 ? ? ? ? P0 P1 P2 P3 P4).
+
+(* multiple existental quantifier (6, 4) *)
+
+inductive ex6_4 (A0,A1,A2,A3:Type[0]) (P0,P1,P2,P3,P4,P5:A0→A1→A2→A3→Prop) : Prop ≝
+   | ex6_4_intro: ∀x0,x1,x2,x3. P0 x0 x1 x2 x3 → P1 x0 x1 x2 x3 → P2 x0 x1 x2 x3 → P3 x0 x1 x2 x3 → P4 x0 x1 x2 x3 → P5 x0 x1 x2 x3 → ex6_4 ? ? ? ? ? ? ? ? ? ?
+.
+
+interpretation "multiple existental quantifier (6, 4)" 'Ex P0 P1 P2 P3 P4 P5 = (ex6_4 ? ? ? ? P0 P1 P2 P3 P4 P5).
+
+(* multiple existental quantifier (6, 6) *)
+
+inductive ex6_6 (A0,A1,A2,A3,A4,A5:Type[0]) (P0,P1,P2,P3,P4,P5:A0→A1→A2→A3→A4→A5→Prop) : Prop ≝
+   | ex6_6_intro: ∀x0,x1,x2,x3,x4,x5. P0 x0 x1 x2 x3 x4 x5 → P1 x0 x1 x2 x3 x4 x5 → P2 x0 x1 x2 x3 x4 x5 → P3 x0 x1 x2 x3 x4 x5 → P4 x0 x1 x2 x3 x4 x5 → P5 x0 x1 x2 x3 x4 x5 → ex6_6 ? ? ? ? ? ? ? ? ? ? ? ?
+.
+
+interpretation "multiple existental quantifier (6, 6)" 'Ex P0 P1 P2 P3 P4 P5 = (ex6_6 ? ? ? ? ? ? P0 P1 P2 P3 P4 P5).
+
+(* multiple existental quantifier (7, 6) *)
+
+inductive ex7_6 (A0,A1,A2,A3,A4,A5:Type[0]) (P0,P1,P2,P3,P4,P5,P6:A0→A1→A2→A3→A4→A5→Prop) : Prop ≝
+   | ex7_6_intro: ∀x0,x1,x2,x3,x4,x5. P0 x0 x1 x2 x3 x4 x5 → P1 x0 x1 x2 x3 x4 x5 → P2 x0 x1 x2 x3 x4 x5 → P3 x0 x1 x2 x3 x4 x5 → P4 x0 x1 x2 x3 x4 x5 → P5 x0 x1 x2 x3 x4 x5 → P6 x0 x1 x2 x3 x4 x5 → ex7_6 ? ? ? ? ? ? ? ? ? ? ? ? ?
+.
+
+interpretation "multiple existental quantifier (7, 6)" 'Ex P0 P1 P2 P3 P4 P5 P6 = (ex7_6 ? ? ? ? ? ? P0 P1 P2 P3 P4 P5 P6).
+
+(* multiple disjunction connective (3) *)
+
+inductive or3 (P0,P1,P2:Prop) : Prop ≝
+   | or3_intro0: P0 → or3 ? ? ?
+   | or3_intro1: P1 → or3 ? ? ?
+   | or3_intro2: P2 → or3 ? ? ?
+.
+
+interpretation "multiple disjunction connective (3)" 'Or P0 P1 P2 = (or3 P0 P1 P2).
+
+(* multiple disjunction connective (4) *)
+
+inductive or4 (P0,P1,P2,P3:Prop) : Prop ≝
+   | or4_intro0: P0 → or4 ? ? ? ?
+   | or4_intro1: P1 → or4 ? ? ? ?
+   | or4_intro2: P2 → or4 ? ? ? ?
+   | or4_intro3: P3 → or4 ? ? ? ?
+.
+
+interpretation "multiple disjunction connective (4)" 'Or P0 P1 P2 P3 = (or4 P0 P1 P2 P3).
+
diff --git a/matita/matita/contribs/lambda_delta/Ground_2/xoa_notation.ma b/matita/matita/contribs/lambda_delta/Ground_2/xoa_notation.ma
new file mode 100644 (file)
index 0000000..47e3268
--- /dev/null
@@ -0,0 +1,158 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+(* This file was generated by xoa.native: do not edit *********************)
+
+(* multiple existental quantifier (2, 1) *)
+
+notation > "hvbox(∃∃ ident x0 break . term 19 P0 break & term 19 P1)"
+ non associative with precedence 20
+ for @{ 'Ex (λ${ident x0}.$P0) (λ${ident x0}.$P1) }.
+
+notation < "hvbox(∃∃ ident x0 break . term 19 P0 break & term 19 P1)"
+ non associative with precedence 20
+ for @{ 'Ex (λ${ident x0}:$T0.$P0) (λ${ident x0}:$T0.$P1) }.
+
+(* multiple existental quantifier (2, 2) *)
+
+notation > "hvbox(∃∃ ident x0 , ident x1 break . term 19 P0 break & term 19 P1)"
+ non associative with precedence 20
+ for @{ 'Ex (λ${ident x0}.λ${ident x1}.$P0) (λ${ident x0}.λ${ident x1}.$P1) }.
+
+notation < "hvbox(∃∃ ident x0 , ident x1 break . term 19 P0 break & term 19 P1)"
+ non associative with precedence 20
+ for @{ 'Ex (λ${ident x0}:$T0.λ${ident x1}:$T1.$P0) (λ${ident x0}:$T0.λ${ident x1}:$T1.$P1) }.
+
+(* multiple existental quantifier (3, 1) *)
+
+notation > "hvbox(∃∃ ident x0 break . term 19 P0 break & term 19 P1 break & term 19 P2)"
+ non associative with precedence 20
+ for @{ 'Ex (λ${ident x0}.$P0) (λ${ident x0}.$P1) (λ${ident x0}.$P2) }.
+
+notation < "hvbox(∃∃ ident x0 break . term 19 P0 break & term 19 P1 break & term 19 P2)"
+ non associative with precedence 20
+ for @{ 'Ex (λ${ident x0}:$T0.$P0) (λ${ident x0}:$T0.$P1) (λ${ident x0}:$T0.$P2) }.
+
+(* multiple existental quantifier (3, 2) *)
+
+notation > "hvbox(∃∃ ident x0 , ident x1 break . term 19 P0 break & term 19 P1 break & term 19 P2)"
+ non associative with precedence 20
+ for @{ 'Ex (λ${ident x0}.λ${ident x1}.$P0) (λ${ident x0}.λ${ident x1}.$P1) (λ${ident x0}.λ${ident x1}.$P2) }.
+
+notation < "hvbox(∃∃ ident x0 , ident x1 break . term 19 P0 break & term 19 P1 break & term 19 P2)"
+ non associative with precedence 20
+ for @{ 'Ex (λ${ident x0}:$T0.λ${ident x1}:$T1.$P0) (λ${ident x0}:$T0.λ${ident x1}:$T1.$P1) (λ${ident x0}:$T0.λ${ident x1}:$T1.$P2) }.
+
+(* multiple existental quantifier (3, 3) *)
+
+notation > "hvbox(∃∃ ident x0 , ident x1 , ident x2 break . term 19 P0 break & term 19 P1 break & term 19 P2)"
+ non associative with precedence 20
+ for @{ 'Ex (λ${ident x0}.λ${ident x1}.λ${ident x2}.$P0) (λ${ident x0}.λ${ident x1}.λ${ident x2}.$P1) (λ${ident x0}.λ${ident x1}.λ${ident x2}.$P2) }.
+
+notation < "hvbox(∃∃ ident x0 , ident x1 , ident x2 break . term 19 P0 break & term 19 P1 break & term 19 P2)"
+ non associative with precedence 20
+ for @{ 'Ex (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.$P0) (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.$P1) (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.$P2) }.
+
+(* multiple existental quantifier (4, 2) *)
+
+notation > "hvbox(∃∃ ident x0 , ident x1 break . term 19 P0 break & term 19 P1 break & term 19 P2 break & term 19 P3)"
+ non associative with precedence 20
+ for @{ 'Ex (λ${ident x0}.λ${ident x1}.$P0) (λ${ident x0}.λ${ident x1}.$P1) (λ${ident x0}.λ${ident x1}.$P2) (λ${ident x0}.λ${ident x1}.$P3) }.
+
+notation < "hvbox(∃∃ ident x0 , ident x1 break . term 19 P0 break & term 19 P1 break & term 19 P2 break & term 19 P3)"
+ non associative with precedence 20
+ for @{ 'Ex (λ${ident x0}:$T0.λ${ident x1}:$T1.$P0) (λ${ident x0}:$T0.λ${ident x1}:$T1.$P1) (λ${ident x0}:$T0.λ${ident x1}:$T1.$P2) (λ${ident x0}:$T0.λ${ident x1}:$T1.$P3) }.
+
+(* multiple existental quantifier (4, 3) *)
+
+notation > "hvbox(∃∃ ident x0 , ident x1 , ident x2 break . term 19 P0 break & term 19 P1 break & term 19 P2 break & term 19 P3)"
+ non associative with precedence 20
+ for @{ 'Ex (λ${ident x0}.λ${ident x1}.λ${ident x2}.$P0) (λ${ident x0}.λ${ident x1}.λ${ident x2}.$P1) (λ${ident x0}.λ${ident x1}.λ${ident x2}.$P2) (λ${ident x0}.λ${ident x1}.λ${ident x2}.$P3) }.
+
+notation < "hvbox(∃∃ ident x0 , ident x1 , ident x2 break . term 19 P0 break & term 19 P1 break & term 19 P2 break & term 19 P3)"
+ non associative with precedence 20
+ for @{ 'Ex (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.$P0) (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.$P1) (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.$P2) (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.$P3) }.
+
+(* multiple existental quantifier (4, 4) *)
+
+notation > "hvbox(∃∃ ident x0 , ident x1 , ident x2 , ident x3 break . term 19 P0 break & term 19 P1 break & term 19 P2 break & term 19 P3)"
+ non associative with precedence 20
+ for @{ 'Ex (λ${ident x0}.λ${ident x1}.λ${ident x2}.λ${ident x3}.$P0) (λ${ident x0}.λ${ident x1}.λ${ident x2}.λ${ident x3}.$P1) (λ${ident x0}.λ${ident x1}.λ${ident x2}.λ${ident x3}.$P2) (λ${ident x0}.λ${ident x1}.λ${ident x2}.λ${ident x3}.$P3) }.
+
+notation < "hvbox(∃∃ ident x0 , ident x1 , ident x2 , ident x3 break . term 19 P0 break & term 19 P1 break & term 19 P2 break & term 19 P3)"
+ non associative with precedence 20
+ for @{ 'Ex (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.λ${ident x3}:$T3.$P0) (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.λ${ident x3}:$T3.$P1) (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.λ${ident x3}:$T3.$P2) (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.λ${ident x3}:$T3.$P3) }.
+
+(* multiple existental quantifier (5, 3) *)
+
+notation > "hvbox(∃∃ ident x0 , ident x1 , ident x2 break . term 19 P0 break & term 19 P1 break & term 19 P2 break & term 19 P3 break & term 19 P4)"
+ non associative with precedence 20
+ for @{ 'Ex (λ${ident x0}.λ${ident x1}.λ${ident x2}.$P0) (λ${ident x0}.λ${ident x1}.λ${ident x2}.$P1) (λ${ident x0}.λ${ident x1}.λ${ident x2}.$P2) (λ${ident x0}.λ${ident x1}.λ${ident x2}.$P3) (λ${ident x0}.λ${ident x1}.λ${ident x2}.$P4) }.
+
+notation < "hvbox(∃∃ ident x0 , ident x1 , ident x2 break . term 19 P0 break & term 19 P1 break & term 19 P2 break & term 19 P3 break & term 19 P4)"
+ non associative with precedence 20
+ for @{ 'Ex (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.$P0) (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.$P1) (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.$P2) (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.$P3) (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.$P4) }.
+
+(* multiple existental quantifier (5, 4) *)
+
+notation > "hvbox(∃∃ ident x0 , ident x1 , ident x2 , ident x3 break . term 19 P0 break & term 19 P1 break & term 19 P2 break & term 19 P3 break & term 19 P4)"
+ non associative with precedence 20
+ for @{ 'Ex (λ${ident x0}.λ${ident x1}.λ${ident x2}.λ${ident x3}.$P0) (λ${ident x0}.λ${ident x1}.λ${ident x2}.λ${ident x3}.$P1) (λ${ident x0}.λ${ident x1}.λ${ident x2}.λ${ident x3}.$P2) (λ${ident x0}.λ${ident x1}.λ${ident x2}.λ${ident x3}.$P3) (λ${ident x0}.λ${ident x1}.λ${ident x2}.λ${ident x3}.$P4) }.
+
+notation < "hvbox(∃∃ ident x0 , ident x1 , ident x2 , ident x3 break . term 19 P0 break & term 19 P1 break & term 19 P2 break & term 19 P3 break & term 19 P4)"
+ non associative with precedence 20
+ for @{ 'Ex (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.λ${ident x3}:$T3.$P0) (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.λ${ident x3}:$T3.$P1) (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.λ${ident x3}:$T3.$P2) (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.λ${ident x3}:$T3.$P3) (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.λ${ident x3}:$T3.$P4) }.
+
+(* multiple existental quantifier (6, 4) *)
+
+notation > "hvbox(∃∃ ident x0 , ident x1 , ident x2 , ident x3 break . term 19 P0 break & term 19 P1 break & term 19 P2 break & term 19 P3 break & term 19 P4 break & term 19 P5)"
+ non associative with precedence 20
+ for @{ 'Ex (λ${ident x0}.λ${ident x1}.λ${ident x2}.λ${ident x3}.$P0) (λ${ident x0}.λ${ident x1}.λ${ident x2}.λ${ident x3}.$P1) (λ${ident x0}.λ${ident x1}.λ${ident x2}.λ${ident x3}.$P2) (λ${ident x0}.λ${ident x1}.λ${ident x2}.λ${ident x3}.$P3) (λ${ident x0}.λ${ident x1}.λ${ident x2}.λ${ident x3}.$P4) (λ${ident x0}.λ${ident x1}.λ${ident x2}.λ${ident x3}.$P5) }.
+
+notation < "hvbox(∃∃ ident x0 , ident x1 , ident x2 , ident x3 break . term 19 P0 break & term 19 P1 break & term 19 P2 break & term 19 P3 break & term 19 P4 break & term 19 P5)"
+ non associative with precedence 20
+ for @{ 'Ex (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.λ${ident x3}:$T3.$P0) (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.λ${ident x3}:$T3.$P1) (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.λ${ident x3}:$T3.$P2) (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.λ${ident x3}:$T3.$P3) (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.λ${ident x3}:$T3.$P4) (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.λ${ident x3}:$T3.$P5) }.
+
+(* multiple existental quantifier (6, 6) *)
+
+notation > "hvbox(∃∃ ident x0 , ident x1 , ident x2 , ident x3 , ident x4 , ident x5 break . term 19 P0 break & term 19 P1 break & term 19 P2 break & term 19 P3 break & term 19 P4 break & term 19 P5)"
+ non associative with precedence 20
+ for @{ 'Ex (λ${ident x0}.λ${ident x1}.λ${ident x2}.λ${ident x3}.λ${ident x4}.λ${ident x5}.$P0) (λ${ident x0}.λ${ident x1}.λ${ident x2}.λ${ident x3}.λ${ident x4}.λ${ident x5}.$P1) (λ${ident x0}.λ${ident x1}.λ${ident x2}.λ${ident x3}.λ${ident x4}.λ${ident x5}.$P2) (λ${ident x0}.λ${ident x1}.λ${ident x2}.λ${ident x3}.λ${ident x4}.λ${ident x5}.$P3) (λ${ident x0}.λ${ident x1}.λ${ident x2}.λ${ident x3}.λ${ident x4}.λ${ident x5}.$P4) (λ${ident x0}.λ${ident x1}.λ${ident x2}.λ${ident x3}.λ${ident x4}.λ${ident x5}.$P5) }.
+
+notation < "hvbox(∃∃ ident x0 , ident x1 , ident x2 , ident x3 , ident x4 , ident x5 break . term 19 P0 break & term 19 P1 break & term 19 P2 break & term 19 P3 break & term 19 P4 break & term 19 P5)"
+ non associative with precedence 20
+ for @{ 'Ex (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.λ${ident x3}:$T3.λ${ident x4}:$T4.λ${ident x5}:$T5.$P0) (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.λ${ident x3}:$T3.λ${ident x4}:$T4.λ${ident x5}:$T5.$P1) (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.λ${ident x3}:$T3.λ${ident x4}:$T4.λ${ident x5}:$T5.$P2) (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.λ${ident x3}:$T3.λ${ident x4}:$T4.λ${ident x5}:$T5.$P3) (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.λ${ident x3}:$T3.λ${ident x4}:$T4.λ${ident x5}:$T5.$P4) (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.λ${ident x3}:$T3.λ${ident x4}:$T4.λ${ident x5}:$T5.$P5) }.
+
+(* multiple existental quantifier (7, 6) *)
+
+notation > "hvbox(∃∃ ident x0 , ident x1 , ident x2 , ident x3 , ident x4 , ident x5 break . term 19 P0 break & term 19 P1 break & term 19 P2 break & term 19 P3 break & term 19 P4 break & term 19 P5 break & term 19 P6)"
+ non associative with precedence 20
+ for @{ 'Ex (λ${ident x0}.λ${ident x1}.λ${ident x2}.λ${ident x3}.λ${ident x4}.λ${ident x5}.$P0) (λ${ident x0}.λ${ident x1}.λ${ident x2}.λ${ident x3}.λ${ident x4}.λ${ident x5}.$P1) (λ${ident x0}.λ${ident x1}.λ${ident x2}.λ${ident x3}.λ${ident x4}.λ${ident x5}.$P2) (λ${ident x0}.λ${ident x1}.λ${ident x2}.λ${ident x3}.λ${ident x4}.λ${ident x5}.$P3) (λ${ident x0}.λ${ident x1}.λ${ident x2}.λ${ident x3}.λ${ident x4}.λ${ident x5}.$P4) (λ${ident x0}.λ${ident x1}.λ${ident x2}.λ${ident x3}.λ${ident x4}.λ${ident x5}.$P5) (λ${ident x0}.λ${ident x1}.λ${ident x2}.λ${ident x3}.λ${ident x4}.λ${ident x5}.$P6) }.
+
+notation < "hvbox(∃∃ ident x0 , ident x1 , ident x2 , ident x3 , ident x4 , ident x5 break . term 19 P0 break & term 19 P1 break & term 19 P2 break & term 19 P3 break & term 19 P4 break & term 19 P5 break & term 19 P6)"
+ non associative with precedence 20
+ for @{ 'Ex (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.λ${ident x3}:$T3.λ${ident x4}:$T4.λ${ident x5}:$T5.$P0) (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.λ${ident x3}:$T3.λ${ident x4}:$T4.λ${ident x5}:$T5.$P1) (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.λ${ident x3}:$T3.λ${ident x4}:$T4.λ${ident x5}:$T5.$P2) (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.λ${ident x3}:$T3.λ${ident x4}:$T4.λ${ident x5}:$T5.$P3) (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.λ${ident x3}:$T3.λ${ident x4}:$T4.λ${ident x5}:$T5.$P4) (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.λ${ident x3}:$T3.λ${ident x4}:$T4.λ${ident x5}:$T5.$P5) (λ${ident x0}:$T0.λ${ident x1}:$T1.λ${ident x2}:$T2.λ${ident x3}:$T3.λ${ident x4}:$T4.λ${ident x5}:$T5.$P6) }.
+
+(* multiple disjunction connective (3) *)
+
+notation "hvbox(∨∨ term 29 P0 break | term 29 P1 break | term 29 P2)"
+ non associative with precedence 30
+ for @{ 'Or $P0 $P1 $P2 }.
+
+(* multiple disjunction connective (4) *)
+
+notation "hvbox(∨∨ term 29 P0 break | term 29 P1 break | term 29 P2 break | term 29 P3)"
+ non associative with precedence 30
+ for @{ 'Or $P0 $P1 $P2 $P3 }.
+
diff --git a/matita/matita/contribs/lambda_delta/Ground_2/xoa_props.ma b/matita/matita/contribs/lambda_delta/Ground_2/xoa_props.ma
new file mode 100644 (file)
index 0000000..f1ed781
--- /dev/null
@@ -0,0 +1,20 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed under the terms of the       *)
+(*        v         GNU General Public License Version 2                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+include "Ground-2/xoa_notation.ma".
+include "Ground-2/xoa.ma".
+
+lemma ex2_1_comm: ∀A0. ∀P0,P1:A0→Prop. (∃∃x0. P0 x0 & P1 x0) → ∃∃x0. P1 x0 & P0 x0.
+#A0 #P0 #P1 * /2/
+qed.
diff --git a/matita/matita/contribs/lambda_delta/Makefile b/matita/matita/contribs/lambda_delta/Makefile
new file mode 100644 (file)
index 0000000..77f4961
--- /dev/null
@@ -0,0 +1,60 @@
+H       = @
+XOA_DIR = ../../../components/binaries/xoa
+XOA     = xoa.native
+
+CONF    = Ground-2/xoa.conf.xml
+TARGETS = Ground-2/xoa_natation.ma Ground-2/xoa.ma
+
+PACKAGES = Ground-2 Basic-2
+
+all:
+
+# xoa ########################################################################
+
+xoa: $(TARGETS)
+
+$(TARGETS): $(CONF)
+       @echo "  EXEC $(XOA) $(CONF)"
+       $(H)MATITA_RT_BASE_DIR=../.. $(XOA_DIR)/$(XOA) $(CONF)
+
+# stats ######################################################################
+
+stats: $(PACKAGES:%=%.stats)
+
+%.stats: MAS = $(shell find $* -name "*.ma")
+
+%.stats: CHARS = $(shell cat $(MAS) | wc -c)
+
+%.stats:
+       @printf '\e[1;40;37m'
+       @printf '%-15s %-42s' 'Statistics for:' $*      
+       @printf '\e[0m\n'       
+       @printf '\e[1;40;35m'
+       @printf '%-8s %6i' Chars $(CHARS)
+       @printf '   %-8s %5i' Lines `cat $(MAS) | wc -l`
+       @printf '   %-6s %3i' Pages `echo $$(($(CHARS) / 5120))`
+       @printf '   %-10s' ''
+       @printf '\e[0m\n'
+       @printf '\e[1;40;36m'
+       @printf '%-8s %6i' Sources `ls $(MAS) | wc -l`
+       @printf '   %-40s' ''
+#      @printf '   %-8s %5i' Objs `ls *.vo | wc -l`
+#      @printf '   %-6s %3i' Files `ls *.v | wc -l`
+       @printf '\e[0m\n'       
+       @printf '\e[1;40;32m'
+       @printf '%-8s %6i' Theorems `grep theorem $(MAS) | wc -l`
+       @printf '   %-8s %5i' Lemmas `grep lemma $(MAS) | wc -l`
+       @printf '   %-6s %3i' Facts `grep fact $(MAS) | wc -l`
+       @printf '   %-6s %3i' Proofs `grep qed $(MAS) | wc -l`
+       @printf '\e[0m\n'       
+       @printf '\e[1;40;33m'
+       @printf '%-8s %6i' Defs `grep "definition\|let rec\|inductive\|record" $(MAS) | wc -l` 
+       @printf '   %-40s' ''
+#      @printf '   %-8s %5i' Local `grep "Local" *.v | wc -l`
+       @printf '\e[0m\n'
+       @printf '\e[1;40;31m'
+       @printf '%-8s %6i' Axioms `grep axiom $(MAS) | wc -l`
+       @printf '   %-8s %5i' Comments `grep "(\*[^*:]*$$" $(MAS) | wc -l`
+       @printf '   %-6s %3i' Marks `grep "(\*\*)" $(MAS) | wc -l`
+       @printf '   %-10s' ''
+       @printf '\e[0m\n'
diff --git a/matita/matita/contribs/lambda_delta/replace.sh b/matita/matita/contribs/lambda_delta/replace.sh
new file mode 100644 (file)
index 0000000..6caaacd
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+for V in `cat Make`; do
+   echo ${V}; sed "s/$1/$2/g" ${V} > ${V}.new
+   if diff ${V} ${V}.new > /dev/null; 
+      then rm -f ${V}.new; else mv -f ${V}.new ${V}; fi
+done
+
+unset V
diff --git a/matita/matita/contribs/lambda_delta/root b/matita/matita/contribs/lambda_delta/root
new file mode 100644 (file)
index 0000000..c41bf73
--- /dev/null
@@ -0,0 +1 @@
+baseuri=cic:/matita/lambda_delta/