]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/static_2/static/lsubf_lsubr.ma
partial commit in static_2
[helm.git] / matita / matita / contribs / lambdadelta / static_2 / static / lsubf_lsubr.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 include "static_2/static/lsubr.ma".
16 include "static_2/static/lsubf_lsubf.ma".
17
18 (* RESTRICTED REFINEMENT FOR CONTEXT-SENSITIVE FREE VARIABLES ***************)
19
20 (* Forward lemmas with restricted refinement for local environments *********)
21
22 lemma lsubf_fwd_lsubr_isdiv:
23       ∀f1,f2,L1,L2. ❪L1,f1❫ ⫃𝐅+ ❪L2,f2❫ → 𝛀❪f1❫ → 𝛀❪f2❫ → L1 ⫃ L2.
24 #f1 #f2 #L1 #L2 #H elim H -f1 -f2 -L1 -L2
25 /4 width=3 by lsubr_bind, pr_isd_inv_next/
26 [ #f1 #f2 #I1 #I2 #L1 #L2 #_ #_ #H
27   elim (pr_isd_inv_push … H) //
28 | /5 width=5 by lsubf_fwd_sle, lsubr_beta, pr_sle_inv_isd_sn, pr_isd_inv_next/
29 | /5 width=5 by lsubf_fwd_sle, lsubr_unit, pr_sle_inv_isd_sn, pr_isd_inv_next/
30 ]
31 qed-.
32
33 (* Properties with restricted refinement for local environments *************)
34
35 lemma lsubr_lsubf_isid:
36       ∀L1,L2. L1 ⫃ L2 → ∀f1,f2. 𝐈❪f1❫ → 𝐈❪f2❫ → ❪L1,f1❫ ⫃𝐅+ ❪L2,f2❫.
37 #L1 #L2 #H elim H -L1 -L2
38 [ /3 width=1 by lsubf_atom, pr_isi_inv_eq_repl/
39 | #I #L1 #L2 | #L1 #L2 #V #W | #I1 #I2 #L1 #L2 #V
40 ]
41 #_ #IH #f1 #f2 #Hf1 #Hf2
42 elim (pr_isi_inv_gen … Hf1) -Hf1 #g1 #Hg1 #H destruct
43 elim (pr_isi_inv_gen … Hf2) -Hf2 #g2 #Hg2 #H destruct
44 /3 width=1 by lsubf_push/
45 qed.
46
47 lemma lsubr_lsubf:
48       ∀f2,L2,T. L2 ⊢ 𝐅+❪T❫ ≘ f2 → ∀L1. L1 ⫃ L2 →
49       ∀f1. L1 ⊢ 𝐅+❪T❫ ≘ f1 → ❪L1,f1❫ ⫃𝐅+ ❪L2,f2❫.
50 #f2 #L2 #T #H elim H -f2 -L2 -T
51 [ #f2 #L2 #s #Hf2 #L1 #HL12 #f1 #Hf1
52   lapply (frees_inv_sort … Hf1) -Hf1 /2 width=1 by lsubr_lsubf_isid/
53 | #f2 #i #Hf2 #Y1 #HY1
54   >(lsubr_inv_atom2 … HY1) -Y1 #g1 #Hg1
55   elim (frees_inv_atom … Hg1) -Hg1 #f1 #Hf1 #H destruct
56   /5 width=5 by lsubf_atom, pr_isi_inv_eq_repl, pr_pushs_eq_repl, pr_eq_next/
57 | #f2 #Z #L2 #W #_ #IH #Y1 #HY1 #g1 #Hg1 elim (lsubr_inv_pair2 … HY1) -HY1 *
58   [ #L1 #HL12 #H destruct
59     elim (frees_inv_pair … Hg1) -Hg1 #f1 #Hf1 #H destruct
60     /3 width=1 by lsubf_bind/
61   | #L1 #V #HL12 #H1 #H2 destruct
62     elim (frees_inv_pair … Hg1) -Hg1 #f1 #Hf1 #H destruct
63     elim (frees_inv_flat … Hf1) -Hf1 /3 width=5 by lsubf_beta/
64   ]
65 | #f2 #I2 #L2 #Hf2 #Y1 #HY1 #g1 #Hg1 elim (lsubr_inv_unit2 … HY1) -HY1 *
66   [ #L1 #HL12 #H destruct
67     elim (frees_inv_unit … Hg1) -Hg1 #f1 #Hf1 #H destruct
68     /3 width=1 by lsubf_bind, lsubr_lsubf_isid/
69   | #I #L1 #V #HL12 #H destruct
70     elim (frees_inv_pair … Hg1) -Hg1 #f1 #Hf1 #H destruct
71     /3 width=5 by lsubf_unit, pr_sor_isi_sn, lsubr_lsubf_isid/
72   ]
73 | #f2 #I2 #L2 #i #_ #IH #Y1 #HY1 #g1 #Hg1
74   elim (lsubr_fwd_bind2 … HY1) -HY1 #I1 #L1 #HL12 #H destruct
75   elim (frees_inv_lref … Hg1) -Hg1 #f1 #Hf1 #H destruct
76   /3 width=1 by lsubf_push/
77 |  #f2 #L2 #l #Hf2 #L1 #HL12 #f1 #Hf1
78   lapply (frees_inv_gref … Hf1) -Hf1 /2 width=1 by lsubr_lsubf_isid/
79 | #f2V #f2T #f2 #p #I #L2 #V #T #_ #_ #Hf2 #IHV #IHT #L1 #HL12 #f1 #Hf1
80   elim (frees_inv_bind … Hf1) -Hf1 #f1V #f1T #Hf1V #Hf1T #Hf1
81   /5 width=8 by lsubf_sor, lsubf_fwd_bind_tl, lsubr_bind/
82 | #f2V #f2T #f2 #I #L2 #V #T #_ #_ #Hf2 #IHV #IHT #L1 #HL12 #f1 #Hf1
83   elim (frees_inv_flat … Hf1) -Hf1 #f1V #f1T #Hf1V #Hf1T #Hf1
84   /3 width=8 by lsubf_sor/
85 ]
86 qed.