]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/static_2/static/lsubf_lsubr.ma
syntactic components detached from basic_2 become 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: ∀f1,f2,L1,L2. ⦃L1, f1⦄ ⫃𝐅* ⦃L2, f2⦄ →
23                              𝛀⦃f1⦄ → 𝛀⦃f2⦄ → L1 ⫃ L2.
24 #f1 #f2 #L1 #L2 #H elim H -f1 -f2 -L1 -L2
25 /4 width=3 by lsubr_bind, isdiv_inv_next/
26 [ #f1 #f2 #I1 #I2 #L1 #L2 #_ #_ #H
27   elim (isdiv_inv_push … H) //
28 | /5 width=5 by lsubf_fwd_sle, lsubr_beta, sle_inv_isdiv_sn, isdiv_inv_next/
29 | /5 width=5 by lsubf_fwd_sle, lsubr_unit, sle_inv_isdiv_sn, isdiv_inv_next/
30 ]
31 qed-.
32
33 (* Properties with restricted refinement for local environments *************)
34
35 lemma lsubr_lsubf_isid: ∀L1,L2. L1 ⫃ L2 →
36                         ∀f1,f2. 𝐈⦃f1⦄ → 𝐈⦃f2⦄ → ⦃L1, f1⦄ ⫃𝐅* ⦃L2, f2⦄.
37 #L1 #L2 #H elim H -L1 -L2
38 [ /3 width=1 by lsubf_atom, isid_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 (isid_inv_gen … Hf1) -Hf1 #g1 #Hg1 #H destruct
43 elim (isid_inv_gen … Hf2) -Hf2 #g2 #Hg2 #H destruct
44 /3 width=1 by lsubf_push/
45 qed.
46
47 lemma lsubr_lsubf: ∀f2,L2,T. L2 ⊢ 𝐅*⦃T⦄ ≘ f2 → ∀L1. L1 ⫃ L2 →
48                    ∀f1. L1 ⊢ 𝐅*⦃T⦄ ≘ f1 → ⦃L1, f1⦄ ⫃𝐅* ⦃L2, f2⦄.
49 #f2 #L2 #T #H elim H -f2 -L2 -T
50 [ #f2 #L2 #s #Hf2 #L1 #HL12 #f1 #Hf1
51   lapply (frees_inv_sort … Hf1) -Hf1 /2 width=1 by lsubr_lsubf_isid/
52 | #f2 #i #Hf2 #Y1 #HY1
53   >(lsubr_inv_atom2 … HY1) -Y1 #g1 #Hg1
54   elim (frees_inv_atom … Hg1) -Hg1 #f1 #Hf1 #H destruct
55   /5 width=5 by lsubf_atom, isid_inv_eq_repl, pushs_eq_repl, eq_next/
56 | #f2 #Z #L2 #W #_ #IH #Y1 #HY1 #g1 #Hg1 elim (lsubr_inv_pair2 … HY1) -HY1 *
57   [ #L1 #HL12 #H destruct
58     elim (frees_inv_pair … Hg1) -Hg1 #f1 #Hf1 #H destruct
59     /3 width=1 by lsubf_bind/
60   | #L1 #V #HL12 #H1 #H2 destruct
61     elim (frees_inv_pair … Hg1) -Hg1 #f1 #Hf1 #H destruct
62     elim (frees_inv_flat … Hf1) -Hf1 /3 width=5 by lsubf_beta/
63   ]
64 | #f2 #I2 #L2 #Hf2 #Y1 #HY1 #g1 #Hg1 elim (lsubr_inv_unit2 … HY1) -HY1 *
65   [ #L1 #HL12 #H destruct
66     elim (frees_inv_unit … Hg1) -Hg1 #f1 #Hf1 #H destruct
67     /3 width=1 by lsubf_bind, lsubr_lsubf_isid/
68   | #I #L1 #V #HL12 #H destruct
69     elim (frees_inv_pair … Hg1) -Hg1 #f1 #Hf1 #H destruct
70     /3 width=5 by lsubf_unit, sor_isid_sn, lsubr_lsubf_isid/
71   ]
72 | #f2 #I2 #L2 #i #_ #IH #Y1 #HY1 #g1 #Hg1
73   elim (lsubr_fwd_bind2 … HY1) -HY1 #I1 #L1 #HL12 #H destruct
74   elim (frees_inv_lref … Hg1) -Hg1 #f1 #Hf1 #H destruct
75   /3 width=1 by lsubf_push/
76 |  #f2 #L2 #l #Hf2 #L1 #HL12 #f1 #Hf1
77   lapply (frees_inv_gref … Hf1) -Hf1 /2 width=1 by lsubr_lsubf_isid/
78 | #f2V #f2T #f2 #p #I #L2 #V #T #_ #_ #Hf2 #IHV #IHT #L1 #HL12 #f1 #Hf1
79   elim (frees_inv_bind … Hf1) -Hf1 #f1V #f1T #Hf1V #Hf1T #Hf1
80   /5 width=8 by lsubf_sor, lsubf_fwd_bind_tl, lsubr_bind/
81 | #f2V #f2T #f2 #I #L2 #V #T #_ #_ #Hf2 #IHV #IHT #L1 #HL12 #f1 #Hf1
82   elim (frees_inv_flat … Hf1) -Hf1 #f1V #f1T #Hf1V #Hf1T #Hf1
83   /3 width=8 by lsubf_sor/
84 ]
85 qed.