]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2A/reduction/lpx_frees.ma
update in lambdadelta
[helm.git] / matita / matita / contribs / lambdadelta / basic_2A / reduction / lpx_frees.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 "basic_2A/multiple/frees_lreq.ma".
16 include "basic_2A/multiple/frees_lift.ma".
17 include "basic_2A/reduction/lpx_drop.ma".
18
19 (* SN EXTENDED PARALLEL REDUCTION FOR LOCAL ENVIRONMENTS ********************)
20
21 (* Properties on context-sensitive free variables ***************************)
22
23 lemma lpx_cpx_frees_trans: ∀h,g,G,L1,U1,U2. ⦃G, L1⦄ ⊢ U1 ➡[h, g] U2 →
24                            ∀L2. ⦃G, L1⦄ ⊢ ➡[h, g] L2 →
25                            ∀i. L2 ⊢ i ϵ 𝐅*[0]⦃U2⦄ → L1 ⊢ i ϵ 𝐅*[0]⦃U1⦄.
26 #h #g #G #L1 #U1 @(fqup_wf_ind_eq … G L1 U1) -G -L1 -U1
27 #G0 #L0 #U0 #IH #G #L1 * *
28 [ -IH #k #HG #HL #HU #U2 #H1 #L2 #_ #i #H2 elim (cpx_inv_sort1 … H1) -H1
29   [| * #d #_ ] #H destruct elim (frees_inv_sort … H2)
30 | #j #HG #HL #HU #U2 #H1 #L2 #HL12 #i #H2 elim (cpx_inv_lref1 … H1) -H1
31   [ #H destruct elim (frees_inv_lref … H2) -H2 //
32     * #I #K2 #W2 #Hj #Hji #HLK2 #HW2
33     elim (lpx_drop_trans_O1 … HL12 … HLK2) -HL12 #Y #HLK1 #H
34     elim (lpx_inv_pair2 … H) -H #K1 #W1 #HK12 #HW12 #H destruct
35     /4 width=11 by frees_lref_be, fqup_lref/
36   | * #I #K1 #W1 #W0 #HLK1 #HW10 #HW0U2
37     lapply (drop_fwd_drop2 … HLK1) #H0
38     elim (lpx_drop_conf … H0 … HL12) -H0 -HL12 #K2 #HK12 #HLK2
39     elim (lt_or_ge i (j+1)) #Hji
40     [ -IH elim (frees_inv_lift_be … H2 … HLK2 … HW0U2) /2 width=1 by monotonic_pred/
41     | lapply (frees_inv_lift_ge … H2 … HLK2 … HW0U2 ?) -L2 -U2 // <minus_plus destruct
42       /4 width=11 by frees_lref_be, fqup_lref/
43     ]
44   ]
45 | -IH #p #HG #HL #HU #U2 #H1 >(cpx_inv_gref1 … H1) -H1 destruct
46    #L2 #_ #i #H2 elim (frees_inv_gref … H2)
47 | #a #I #W1 #U1 #HG #HL #HU #X #HX #L2 #HL12 #i #Hi destruct
48   elim (cpx_inv_bind1 … HX) -HX *
49   [ #W2 #U2 #HW12 #HU12 #H destruct
50     elim (frees_inv_bind_O … Hi) -Hi
51     /4 width=7 by frees_bind_dx_O, frees_bind_sn, lpx_pair/
52   | #U2 #HU12 #HXU2 #H1 #H2 destruct
53     lapply (frees_lift_ge … Hi (L2.ⓓW1) (Ⓕ) … HXU2 ?)
54     /4 width=7 by frees_bind_dx_O, lpx_pair, drop_drop/
55   ]
56 | #I #W1 #X1 #HG #HL #HU #X2 #HX2 #L2 #HL12 #i #Hi destruct
57   elim (cpx_inv_flat1 … HX2) -HX2 *
58   [ #W2 #U2 #HW12 #HU12 #H destruct
59     elim (frees_inv_flat … Hi) -Hi /3 width=7 by frees_flat_dx, frees_flat_sn/
60   | #HU12 #H destruct /3 width=7 by frees_flat_dx/
61   | #HW12 #H destruct /3 width=7 by frees_flat_sn/
62   | #b #W2 #V1 #V2 #U1 #U2 #HW12 #HV12 #HU12 #H1 #H2 #H3 destruct
63     elim (frees_inv_bind … Hi) -Hi #Hi
64     [ elim (frees_inv_flat … Hi) -Hi
65       /4 width=7 by frees_flat_dx, frees_flat_sn, frees_bind_sn/
66     | lapply (lreq_frees_trans … Hi (L2.ⓛV2) ?) /2 width=1 by lreq_succ/ -Hi #HU2
67       lapply (frees_weak … HU2 0 ?) -HU2
68       /5 width=7 by frees_bind_dx_O, frees_flat_dx, lpx_pair/
69     ]
70   | #b #W2 #W0 #V1 #V2 #U1 #U2 #HW12 #HW20 #HV12 #HU12 #H1 #H2 #H3 destruct
71     elim (frees_inv_bind_O … Hi) -Hi #Hi
72     [ /4 width=7 by frees_flat_dx, frees_bind_sn/
73     | elim (frees_inv_flat … Hi) -Hi
74       [ #HW0 lapply (frees_inv_lift_ge … HW0 L2 (Ⓕ) … HW20 ?) -W0
75         /3 width=7 by frees_flat_sn, drop_drop/
76       | /5 width=7 by frees_bind_dx_O, frees_flat_dx, lpx_pair/
77       ]
78     ]
79   ]
80 ]
81 qed-.
82
83 lemma cpx_frees_trans: ∀h,g,G. frees_trans (cpx h g G).
84 /2 width=8 by lpx_cpx_frees_trans/ qed-.
85
86 lemma lpx_frees_trans: ∀h,g,G,L1,L2. ⦃G, L1⦄ ⊢ ➡[h, g] L2 →
87                        ∀U,i. L2 ⊢ i ϵ 𝐅*[0]⦃U⦄ → L1 ⊢ i ϵ 𝐅*[0]⦃U⦄.
88 /2 width=8 by lpx_cpx_frees_trans/ qed-.