]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/static/fle_fle.ma
advances on cpx_lfxs_conf_fle
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / static / fle_fle.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_2/syntax/lveq_lveq.ma".
16 include "basic_2/static/fle_fqup.ma".
17
18 (* FREE VARIABLES INCLUSION FOR RESTRICTED CLOSURES *************************)
19
20 (* Advanced inversion lemmas ************************************************)
21
22 lemma fle_frees_trans: ∀L1,L2,T1,T2. ⦃L1, T1⦄ ⊆ ⦃L2, T2⦄ →
23                        ∀f2. L2 ⊢ 𝐅*⦃T2⦄ ≡ f2 →
24                        ∃∃n1,n2,f1. L1 ⊢ 𝐅*⦃T1⦄ ≡ f1 &
25                                    L1 ≋ⓧ*[n1, n2] L2 & ⫱*[n1]f1 ⊆ ⫱*[n2]f2.
26 #L1 #L2 #T1 #T2 * #n1 #n2 #f1 #g2 #Hf1 #Hg2 #HL #Hn #f2 #Hf2
27 lapply (frees_mono … Hg2 … Hf2) -Hg2 -Hf2 #Hgf2
28 lapply (tls_eq_repl n2 … Hgf2) -Hgf2 #Hgf2
29 lapply (sle_eq_repl_back2 … Hn … Hgf2) -g2
30 /2 width=6 by ex3_3_intro/
31 qed-.
32
33 lemma fle_frees_trans_eq: ∀L1,L2. |L1| = |L2| →
34                           ∀T1,T2. ⦃L1, T1⦄ ⊆ ⦃L2, T2⦄ → ∀f2. L2 ⊢ 𝐅*⦃T2⦄ ≡ f2 →
35                           ∃∃f1. L1 ⊢ 𝐅*⦃T1⦄ ≡ f1 & f1 ⊆ f2.
36 #L1 #L2 #H1L #T1 #T2 #H2L #f2 #Hf2
37 elim (fle_frees_trans … H2L … Hf2) -T2 #n1 #n2 #f1 #Hf1 #H2L #Hf12
38 elim (lveq_inj_length … H2L) // -L2 #H1 #H2 destruct
39 /2 width=3 by ex2_intro/
40 qed-.
41
42 (* Main properties **********************************************************)
43
44 theorem fle_trans_sn: ∀L1,L2,T1,T. ⦃L1, T1⦄ ⊆ ⦃L2, T⦄ →
45                       ∀T2. ⦃L2, T⦄ ⊆ ⦃L2, T2⦄ → ⦃L1, T1⦄ ⊆ ⦃L2, T2⦄.
46 #L1 #L2 #T1 #T
47 * #m1 #m0 #g1 #g0 #Hg1 #Hg0 #Hm #Hg
48 #T2
49 * #n0 #n2 #f0 #f2 #Hf0 #Hf2 #Hn #Hf
50 lapply (frees_mono … Hf0 … Hg0) -Hf0 -Hg0 #Hfg0
51 elim (lveq_inj_length … Hn) // -Hn #H1 #H2 destruct
52 lapply (sle_eq_repl_back1 … Hf … Hfg0) -f0
53 /4 width=10 by sle_tls, sle_trans, ex4_4_intro/
54 qed-.
55
56 theorem fle_trans_dx: ∀L1,T1,T. ⦃L1, T1⦄ ⊆ ⦃L1, T⦄ →
57                       ∀L2,T2. ⦃L1, T⦄ ⊆ ⦃L2, T2⦄ → ⦃L1, T1⦄ ⊆ ⦃L2, T2⦄.
58 #L1 #T1 #T
59 * #m1 #m0 #g1 #g0 #Hg1 #Hg0 #Hm #Hg
60 #L2 #T2
61 * #n0 #n2 #f0 #f2 #Hf0 #Hf2 #Hn #Hf
62 lapply (frees_mono … Hg0 … Hf0) -Hg0 -Hf0 #Hgf0
63 elim (lveq_inj_length … Hm) // -Hm #H1 #H2 destruct
64 lapply (sle_eq_repl_back2 … Hg … Hgf0) -g0
65 /4 width=10 by sle_tls, sle_trans, ex4_4_intro/
66 qed-.
67
68 theorem fle_bind_sn_ge: ∀L1,L2. |L2| ≤ |L1| →
69                         ∀V1,T1,T. ⦃L1, V1⦄ ⊆ ⦃L2, T⦄ → ⦃L1.ⓧ, T1⦄ ⊆ ⦃L2, T⦄ →
70                         ∀p,I. ⦃L1, ⓑ{p,I}V1.T1⦄ ⊆ ⦃L2, T⦄.
71 #L1 #L2 #HL #V1 #T1 #T * #n1 #x #f1 #g #Hf1 #Hg #H1n1 #H2n1 #H #p #I
72 elim (fle_frees_trans … H … Hg) -H #n2 #n #f2 #Hf2 #H1n2 #H2n2
73 elim (lveq_inj_void_sn_ge … H1n1 … H1n2) -H1n2 // #H1 #H2 #H3 destruct
74 elim (sor_isfin_ex f1 (⫱f2)) /3 width=3 by frees_fwd_isfin, isfin_tl/ #f #Hf #_
75 <tls_xn in H2n2; #H2n2
76 /4 width=12 by frees_bind_void, sor_inv_sle, sor_tls, ex4_4_intro/
77 qed.
78
79 theorem fle_flat_sn: ∀L1,L2,V1,T1,T. ⦃L1, V1⦄ ⊆ ⦃L2, T⦄ → ⦃L1, T1⦄ ⊆ ⦃L2, T⦄ →
80                      ∀I. ⦃L1, ⓕ{I}V1.T1⦄ ⊆ ⦃L2, T⦄.
81 #L1 #L2 #V1 #T1 #T * #n1 #x #f1 #g #Hf1 #Hg #H1n1 #H2n1 #H #I
82 elim (fle_frees_trans … H … Hg) -H #n2 #n #f2 #Hf2 #H1n2 #H2n2
83 elim (lveq_inj … H1n1 … H1n2) -H1n2 #H1 #H2 destruct
84 elim (sor_isfin_ex f1 f2) /2 width=3 by frees_fwd_isfin/ #f #Hf #_
85 /4 width=12 by frees_flat, sor_inv_sle, sor_tls, ex4_4_intro/
86 qed.
87
88 theorem fle_bind_eq: ∀L1,L2. |L1| = |L2| → ∀V1,V2. ⦃L1, V1⦄ ⊆ ⦃L2, V2⦄ →
89                      ∀I2,T1,T2. ⦃L1.ⓧ, T1⦄ ⊆ ⦃L2.ⓑ{I2}V2, T2⦄ →
90                      ∀p,I1. ⦃L1, ⓑ{p,I1}V1.T1⦄ ⊆ ⦃L2, ⓑ{p,I2}V2.T2⦄.
91 #L1 #L2 #HL #V1 #V2
92 * #n1 #m1 #f1 #g1 #Hf1 #Hg1 #H1L #Hfg1 #I2 #T1 #T2
93 * #n2 #m2 #f2 #g2 #Hf2 #Hg2 #H2L #Hfg2 #p #I1
94 elim (lveq_inj_length … H1L) // #H1 #H2 destruct
95 elim (lveq_inj_length … H2L) // -HL -H2L #H1 #H2 destruct
96 elim (sor_isfin_ex f1 (⫱f2)) /3 width=3 by frees_fwd_isfin, isfin_tl/ #f #Hf #_
97 elim (sor_isfin_ex g1 (⫱g2)) /3 width=3 by frees_fwd_isfin, isfin_tl/ #g #Hg #_
98 /4 width=15 by frees_bind_void, frees_bind, monotonic_sle_sor, sle_tl, ex4_4_intro/
99 qed.
100
101 theorem fle_bind: ∀L1,L2,V1,V2. ⦃L1, V1⦄ ⊆ ⦃L2, V2⦄ →
102                   ∀I1,I2,T1,T2. ⦃L1.ⓑ{I1}V1, T1⦄ ⊆ ⦃L2.ⓑ{I2}V2, T2⦄ →
103                   ∀p. ⦃L1, ⓑ{p,I1}V1.T1⦄ ⊆ ⦃L2, ⓑ{p,I2}V2.T2⦄.
104 #L1 #L2 #V1 #V2
105 * #n1 #m1 #f1 #g1 #Hf1 #Hg1 #H1L #Hfg1 #I1 #I2 #T1 #T2
106 * #n2 #m2 #f2 #g2 #Hf2 #Hg2 #H2L #Hfg2 #p
107 elim (lveq_inv_pair_pair … H2L) -H2L #H2L #H1 #H2 destruct
108 elim (lveq_inj … H2L … H1L) -H1L #H1 #H2 destruct
109 elim (sor_isfin_ex f1 (⫱f2)) /3 width=3 by frees_fwd_isfin, isfin_tl/ #f #Hf #_
110 elim (sor_isfin_ex g1 (⫱g2)) /3 width=3 by frees_fwd_isfin, isfin_tl/ #g #Hg #_
111 /4 width=15 by frees_bind, monotonic_sle_sor, sle_tl, ex4_4_intro/
112 qed.
113
114 theorem fle_flat: ∀L1,L2,V1,V2. ⦃L1, V1⦄ ⊆ ⦃L2, V2⦄ →
115                   ∀T1,T2. ⦃L1, T1⦄ ⊆ ⦃L2, T2⦄ →
116                   ∀I1,I2. ⦃L1, ⓕ{I1}V1.T1⦄ ⊆ ⦃L2, ⓕ{I2}V2.T2⦄.
117 /3 width=1 by fle_flat_sn, fle_flat_dx_dx, fle_flat_dx_sn/ qed-.