]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/static/fle_fle.ma
18574be3dfe468ed418def66ee6c169a8255b4f0
[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: bi_transitive … fle.
45 #L1 #L #T1 #T * #f1 #f #HT1 #HT #Hf1 #L2 #T2 * #g #f2 #Hg #HT2 #Hf2
46 /5 width=8 by frees_mono, sle_trans, sle_eq_repl_back2, ex3_2_intro/
47 qed-.
48 *)
49 theorem fle_bind_sn_ge: ∀L1,L2. |L2| ≤ |L1| →
50                         ∀V1,T1,T. ⦃L1, V1⦄ ⊆ ⦃L2, T⦄ → ⦃L1.ⓧ, T1⦄ ⊆ ⦃L2, T⦄ →
51                         ∀p,I. ⦃L1, ⓑ{p,I}V1.T1⦄ ⊆ ⦃L2, T⦄.
52 #L1 #L2 #HL #V1 #T1 #T * #n1 #x #f1 #g #Hf1 #Hg #H1n1 #H2n1 #H #p #I
53 elim (fle_frees_trans … H … Hg) -H #n2 #n #f2 #Hf2 #H1n2 #H2n2
54 elim (lveq_inj_void_sn_ge … H1n1 … H1n2) -H1n2 // #H1 #H2 #H3 destruct
55 elim (sor_isfin_ex f1 (⫱f2)) /3 width=3 by frees_fwd_isfin, isfin_tl/ #f #Hf #_
56 <tls_xn in H2n2; #H2n2
57 /4 width=12 by frees_bind_void, sor_inv_sle, sor_tls, ex4_4_intro/
58 qed.
59
60 theorem fle_flat_sn: ∀L1,L2,V1,T1,T. ⦃L1, V1⦄ ⊆ ⦃L2, T⦄ → ⦃L1, T1⦄ ⊆ ⦃L2, T⦄ →
61                      ∀I. ⦃L1, ⓕ{I}V1.T1⦄ ⊆ ⦃L2, T⦄.
62 #L1 #L2 #V1 #T1 #T * #n1 #x #f1 #g #Hf1 #Hg #H1n1 #H2n1 #H #I
63 elim (fle_frees_trans … H … Hg) -H #n2 #n #f2 #Hf2 #H1n2 #H2n2
64 elim (lveq_inj … H1n1 … H1n2) -H1n2 #H1 #H2 destruct
65 elim (sor_isfin_ex f1 f2) /2 width=3 by frees_fwd_isfin/ #f #Hf #_
66 /4 width=12 by frees_flat, sor_inv_sle, sor_tls, ex4_4_intro/
67 qed.
68
69 theorem fle_bind_eq: ∀L1,L2. |L1| = |L2| → ∀V1,V2. ⦃L1, V1⦄ ⊆ ⦃L2, V2⦄ →
70                      ∀I2,T1,T2. ⦃L1.ⓧ, T1⦄ ⊆ ⦃L2.ⓑ{I2}V2, T2⦄ →
71                      ∀p,I1. ⦃L1, ⓑ{p,I1}V1.T1⦄ ⊆ ⦃L2, ⓑ{p,I2}V2.T2⦄.
72 #L1 #L2 #HL #V1 #V2
73 * #n1 #m1 #f1 #g1 #Hf1 #Hg1 #H1L #Hfg1 #I2 #T1 #T2
74 * #n2 #m2 #f2 #g2 #Hf2 #Hg2 #H2L #Hfg2 #p #I1
75 elim (lveq_inj_length … H1L) // #H1 #H2 destruct
76 elim (lveq_inj_length … H2L) // -HL -H2L #H1 #H2 destruct
77 elim (sor_isfin_ex f1 (⫱f2)) /3 width=3 by frees_fwd_isfin, isfin_tl/ #f #Hf #_
78 elim (sor_isfin_ex g1 (⫱g2)) /3 width=3 by frees_fwd_isfin, isfin_tl/ #g #Hg #_
79 /4 width=15 by frees_bind_void, frees_bind, monotonic_sle_sor, sle_tl, ex4_4_intro/
80 qed.
81
82 theorem fle_bind: ∀L1,L2,V1,V2. ⦃L1, V1⦄ ⊆ ⦃L2, V2⦄ →
83                   ∀I1,I2,T1,T2. ⦃L1.ⓑ{I1}V1, T1⦄ ⊆ ⦃L2.ⓑ{I2}V2, T2⦄ →
84                   ∀p. ⦃L1, ⓑ{p,I1}V1.T1⦄ ⊆ ⦃L2, ⓑ{p,I2}V2.T2⦄.
85 #L1 #L2 #V1 #V2
86 * #n1 #m1 #f1 #g1 #Hf1 #Hg1 #H1L #Hfg1 #I1 #I2 #T1 #T2
87 * #n2 #m2 #f2 #g2 #Hf2 #Hg2 #H2L #Hfg2 #p
88 elim (lveq_inv_pair_pair … H2L) -H2L #H2L #H1 #H2 destruct
89 elim (lveq_inj … H2L … H1L) -H1L #H1 #H2 destruct
90 elim (sor_isfin_ex f1 (⫱f2)) /3 width=3 by frees_fwd_isfin, isfin_tl/ #f #Hf #_
91 elim (sor_isfin_ex g1 (⫱g2)) /3 width=3 by frees_fwd_isfin, isfin_tl/ #g #Hg #_
92 /4 width=15 by frees_bind, monotonic_sle_sor, sle_tl, ex4_4_intro/
93 qed.
94
95 theorem fle_flat: ∀L1,L2,V1,V2. ⦃L1, V1⦄ ⊆ ⦃L2, V2⦄ →
96                   ∀T1,T2. ⦃L1, T1⦄ ⊆ ⦃L2, T2⦄ →
97                   ∀I1,I2. ⦃L1, ⓕ{I1}V1.T1⦄ ⊆ ⦃L2, ⓕ{I2}V2.T2⦄.
98 /3 width=1 by fle_flat_sn, fle_flat_dx_dx, fle_flat_dx_sn/ qed-.