]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/etc/cofrees0/cofrees_alt.etc
8443f38e3ea8642921237f92611dc562821765cc
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / etc / cofrees0 / cofrees_alt.etc
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_2/relocation/lift_neg.ma".
16 include "basic_2/relocation/lift_lift.ma".
17 include "basic_2/substitution/cpys.ma".
18 include "basic_2/substitution/cofrees_lift.ma".
19
20 (* CONTEXT-SENSITIVE EXCLUSION FROM FREE VARIABLES **************************)
21
22 (* Alternative definition of frees_ge ***************************************)
23
24 (*
25 lemma cpys_fwd_nlift2: ∀G,L,U1,U2. ⦃G, L⦄ ⊢ U1 ▶* U2 →
26                        ∀i. (∀T2. ⇧[i, 1] T2 ≡ U2 → ⊥) →
27                        (∀T1. ⇧[i, 1] T1 ≡ U1 → ⊥) ∨
28                        ∃∃I,K,W,j. j < i & ⇩[j]L ≡ K.ⓑ{I}W &
29                                   (∀V. ⇧[i-j-1, 1] V ≡ W → ⊥) & (∀T1. ⇧[j, 1] T1 ≡ U1 → ⊥).
30 #G #L #U1 #U2 #H elim H -G -L -U1 -U2
31 [ /3 width=2 by or_introl/
32 | #I #G #L #K #V1 #V2 #W2 #j #HLK #_ #HVW2 #IHV12 #i #HnW2
33   elim (lt_or_ge j i) #Hij
34   [ @or_intror (**) @(ex4_4_intro … HLK) //
35     [ #X #HXV elim (lift_trans_le … HXV … HVW ?) -V //
36       #Y #HXY >minus_plus <plus_minus_m_m /2 width=2 by/
37     | -HnW2 /2 width=7 by lift_inv_lref2_be/
38     ]
39   | elim (lift_split … HVW2 i j) -HVW2 //
40     #X #_ #H elim HnW2 -HnW2 //
41   ]
42 | #a #I #G #L #W1 #W2 #U1 #U2 #_ #_ #IHW12 #IHU12 #i #H elim (nlift_inv_bind … H) -H
43   [ #HnW2 elim (IHW12 … HnW2) -IHW12 -HnW2 -IHU12
44     [ /4 width=9 by nlift_bind_sn, or_introl/
45     | * /5 width=9 by nlift_bind_sn, ex4_4_intro, or_intror/
46     ]
47   | #HnU2 elim (IHU12 … HnU2) -IHU12 -HnU2 -IHW12
48     [ /4 width=9 by nlift_bind_dx, or_introl/
49     | * #J #K #W #j @(nat_ind_plus … j) -j
50       [ #_ #H lapply (ldrop_inv_pair1 … H) -H
51         #H destruct /4 width=9 by nlift_bind_sn, or_introl/
52       | #j #_ #Hji #HLK #HnW
53         lapply (ldrop_inv_drop1_lt … HLK ?) // -HLK #HLK #HnU1
54         <minus_le_minus_minus_comm in HnW;
55         /5 width=9 by nlift_bind_dx, monotonic_lt_pred, ex4_4_intro, or_intror/
56       ]
57     ]
58   ]
59 | #I #G #L #W1 #W2 #U1 #U2 #_ #_ #IHW12 #IHU12 #i #H elim (nlift_inv_flat … H) -H
60   [ #HnW2 elim (IHW12 … HnW2) -IHW12 -HnW2 -IHU12
61     [ /4 width=9 by nlift_flat_sn, or_introl/
62     | * /5 width=9 by nlift_flat_sn, ex4_4_intro, or_intror/
63     ]
64   | #HnU2 elim (IHU12 … HnU2) -IHU12 -HnU2 -IHW12
65     [ /4 width=9 by nlift_flat_dx, or_introl/
66     | * /5 width=9 by nlift_flat_dx, ex4_4_intro, or_intror/
67   ]
68 ]
69 qed-.
70 *)
71 lemma nlift_frees: ∀L,U,i. (∀T. ⇧[i, 1] T ≡ U → ⊥) → (L ⊢ i ~ϵ 𝐅*⦃U⦄ → ⊥).
72 #L #U #i #HnTU #H elim (cofrees_fwd_lift … H) -H /2 width=2 by/
73 qed-.
74 (*
75 lemma frees_inv_ge: ∀L,U,d,i. d ≤ yinj i → (L ⊢ i ~ϵ 𝐅*[d]⦃U⦄ → ⊥) →
76                     (∀T. ⇧[i, 1] T ≡ U → ⊥) ∨
77                     ∃∃I,K,W,j. d ≤ yinj j & j < i & ⇩[j]L ≡ K.ⓑ{I}W &
78                                (K ⊢ i-j-1 ~ϵ 𝐅*[yinj 0]⦃W⦄ → ⊥) & (∀T. ⇧[j, 1] T ≡ U → ⊥).
79 #L #U #d #i #Hdi #H @(frees_ind … H) -U /3 width=2 by or_introl/
80 #U1 #U2 #HU12 #HU2 *
81 [ #HnU2 elim (cpy_fwd_nlift2_ge … HU12 … HnU2) -HU12 -HnU2 /3 width=2 by or_introl/
82   * /5 width=9 by nlift_frees, ex5_4_intro, or_intror/
83 | * #I2 #K2 #W2 #j2 #Hdj2 #Hj2i #HLK2 #HnW2 #HnU2 elim (cpy_fwd_nlift2_ge … HU12 … HnU2) -HU12 -HnU2 /4 width=9 by ex5_4_intro, or_intror/
84   * #I1 #K1 #W1 #j1 #Hdj1 #Hj12 #HLK1 #HnW1 #HnU1
85   lapply (ldrop_conf_ge … HLK1 … HLK2 ?) -HLK2 /2 width=1 by lt_to_le/
86   #HK12 lapply (ldrop_inv_drop1_lt … HK12 ?) /2 width=1 by lt_plus_to_minus_r/ -HK12
87   #HK12
88   @or_intror @(ex5_4_intro … HLK1 … HnU1) -HLK1 -HnU1 /2 width=3 by transitive_lt/
89   @(frees_be … HK12 … HnW1) /2 width=1 by arith_k_sn/ -HK12 -HnW1
90   >minus_plus in ⊢ (??(?(?%?)?)??→?); >minus_plus in ⊢ (??(?(??%)?)??→?); >arith_b1 /2 width=1 by/
91 ]
92 qed-.
93
94 lemma frees_ind_ge: ∀R:relation4 ynat nat lenv term.
95                     (∀d,i,L,U. d ≤ yinj i → (∀T. ⇧[i, 1] T ≡ U → ⊥) → R d i L U) →
96                     (∀d,i,j,I,L,K,W,U. d ≤ yinj j → j < i → ⇩[j]L ≡ K.ⓑ{I}W → (K ⊢ i-j-1 ~ϵ 𝐅*[0]⦃W⦄ → ⊥) → (∀T. ⇧[j, 1] T ≡ U → ⊥) → R 0 (i-j-1) K W → R d i L U) →
97                     ∀d,i,L,U. d ≤ yinj i → (L ⊢ i ~ϵ 𝐅*[d]⦃U⦄ → ⊥) → R d i L U.
98 #R #IH1 #IH2 #d #i #L #U
99 generalize in match d; -d generalize in match i; -i
100 @(f2_ind … rfw … L U) -L -U
101 #n #IHn #L #U #Hn #i #d #Hdi #H elim (frees_inv_ge … H) -H /3 width=2 by/
102 -IH1 * #I #K #W #j #Hdj #Hji #HLK #HnW #HnU destruct /4 width=12 by ldrop_fwd_rfw/
103 qed-.
104 *)