1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 include "static_2/syntax/lveq_lveq.ma".
16 include "static_2/static/fsle_fqup.ma".
18 (* FREE VARIABLES INCLUSION FOR RESTRICTED CLOSURES *************************)
20 (* Advanced inversion lemmas ************************************************)
22 lemma fsle_frees_trans:
23 ∀L1,L2,T1,T2. ❨L1,T1❩ ⊆ ❨L2,T2❩ →
24 ∀f2. L2 ⊢ 𝐅+❨T2❩ ≘ f2 →
25 ∃∃n1,n2,f1. L1 ⊢ 𝐅+❨T1❩ ≘ f1 & 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 (pr_tls_eq_repl n2 … Hgf2) -Hgf2 #Hgf2
29 lapply (pr_sle_eq_repl_back_dx … Hn … Hgf2) -g2
30 /2 width=6 by ex3_3_intro/
33 lemma fsle_frees_trans_eq:
35 ∀T1,T2. ❨L1,T1❩ ⊆ ❨L2,T2❩ → ∀f2. L2 ⊢ 𝐅+❨T2❩ ≘ f2 →
36 ∃∃f1. L1 ⊢ 𝐅+❨T1❩ ≘ f1 & f1 ⊆ f2.
37 #L1 #L2 #H1L #T1 #T2 #H2L #f2 #Hf2
38 elim (fsle_frees_trans … H2L … Hf2) -T2 #n1 #n2 #f1 #Hf1 #H2L #Hf12
39 elim (lveq_inj_length … H2L) // -L2 #H1 #H2 destruct
40 /2 width=3 by ex2_intro/
43 lemma fsle_inv_frees_eq:
45 ∀T1,T2. ❨L1,T1❩ ⊆ ❨L2,T2❩ →
46 ∀f1. L1 ⊢ 𝐅+❨T1❩ ≘ f1 → ∀f2. L2 ⊢ 𝐅+❨T2❩ ≘ f2 →
48 #L1 #L2 #H1L #T1 #T2 #H2L #f1 #Hf1 #f2 #Hf2
49 elim (fsle_frees_trans_eq … H2L … Hf2) // -L2 -T2
50 /3 width=6 by frees_mono, pr_sle_eq_repl_back_sn/
53 lemma fsle_frees_conf:
54 ∀L1,L2,T1,T2. ❨L1,T1❩ ⊆ ❨L2,T2❩ →
55 ∀f1. L1 ⊢ 𝐅+❨T1❩ ≘ f1 →
56 ∃∃n1,n2,f2. L2 ⊢ 𝐅+❨T2❩ ≘ f2 & L1 ≋ⓧ*[n1,n2] L2 & ⫰*[n1]f1 ⊆ ⫰*[n2]f2.
57 #L1 #L2 #T1 #T2 * #n1 #n2 #g1 #g2 #Hg1 #Hg2 #HL #Hn #f1 #Hf1
58 lapply (frees_mono … Hg1 … Hf1) -Hg1 -Hf1 #Hgf1
59 lapply (pr_tls_eq_repl n1 … Hgf1) -Hgf1 #Hgf1
60 lapply (pr_sle_eq_repl_back_sn … Hn … Hgf1) -g1
61 /2 width=6 by ex3_3_intro/
64 lemma fsle_frees_conf_eq:
66 ∀T1,T2. ❨L1,T1❩ ⊆ ❨L2,T2❩ → ∀f1. L1 ⊢ 𝐅+❨T1❩ ≘ f1 →
67 ∃∃f2. L2 ⊢ 𝐅+❨T2❩ ≘ f2 & f1 ⊆ f2.
68 #L1 #L2 #H1L #T1 #T2 #H2L #f1 #Hf1
69 elim (fsle_frees_conf … H2L … Hf1) -T1 #n1 #n2 #f2 #Hf2 #H2L #Hf12
70 elim (lveq_inj_length … H2L) // -L1 #H1 #H2 destruct
71 /2 width=3 by ex2_intro/
74 (* Main properties **********************************************************)
76 theorem fsle_trans_sn:
77 ∀L1,L2,T1,T. ❨L1,T1❩ ⊆ ❨L2,T❩ →
78 ∀T2. ❨L2,T❩ ⊆ ❨L2,T2❩ → ❨L1,T1❩ ⊆ ❨L2,T2❩.
80 * #m1 #m0 #g1 #g0 #Hg1 #Hg0 #Hm #Hg
82 * #n0 #n2 #f0 #f2 #Hf0 #Hf2 #Hn #Hf
83 lapply (frees_mono … Hf0 … Hg0) -Hf0 -Hg0 #Hfg0
84 elim (lveq_inj_length … Hn) // -Hn #H1 #H2 destruct
85 lapply (pr_sle_eq_repl_back_sn … Hf … Hfg0) -f0
86 /4 width=10 by pr_sle_tls, pr_sle_trans, ex4_4_intro/
89 theorem fsle_trans_dx:
90 ∀L1,T1,T. ❨L1,T1❩ ⊆ ❨L1,T❩ →
91 ∀L2,T2. ❨L1,T❩ ⊆ ❨L2,T2❩ → ❨L1,T1❩ ⊆ ❨L2,T2❩.
93 * #m1 #m0 #g1 #g0 #Hg1 #Hg0 #Hm #Hg
95 * #n0 #n2 #f0 #f2 #Hf0 #Hf2 #Hn #Hf
96 lapply (frees_mono … Hg0 … Hf0) -Hg0 -Hf0 #Hgf0
97 elim (lveq_inj_length … Hm) // -Hm #H1 #H2 destruct
98 lapply (pr_sle_eq_repl_back_dx … Hg … Hgf0) -g0
99 /4 width=10 by pr_sle_tls, pr_sle_trans, ex4_4_intro/
102 theorem fsle_trans_rc:
103 ∀L1,L,T1,T. |L1| = |L| → ❨L1,T1❩ ⊆ ❨L,T❩ →
104 ∀L2,T2. |L| = |L2| → ❨L,T❩ ⊆ ❨L2,T2❩ → ❨L1,T1❩ ⊆ ❨L2,T2❩.
106 * #m1 #m0 #g1 #g0 #Hg1 #Hg0 #Hm #Hg
108 * #n0 #n2 #f0 #f2 #Hf0 #Hf2 #Hn #Hf
109 lapply (frees_mono … Hg0 … Hf0) -Hg0 -Hf0 #Hgf0
110 elim (lveq_inj_length … Hm) // -Hm #H1 #H2 destruct
111 elim (lveq_inj_length … Hn) // -Hn #H1 #H2 destruct
112 lapply (pr_sle_eq_repl_back_dx … Hg … Hgf0) -g0
113 /3 width=10 by lveq_length_eq, pr_sle_trans, ex4_4_intro/
116 theorem fsle_bind_sn_ge:
117 ∀L1,L2. |L2| ≤ |L1| →
118 ∀V1,T1,T. ❨L1,V1❩ ⊆ ❨L2,T❩ → ❨L1.ⓧ,T1❩ ⊆ ❨L2,T❩ →
119 ∀p,I. ❨L1,ⓑ[p,I]V1.T1❩ ⊆ ❨L2,T❩.
120 #L1 #L2 #HL #V1 #T1 #T * #n1 #x #f1 #g #Hf1 #Hg #H1n1 #H2n1 #H #p #I
121 elim (fsle_frees_trans … H … Hg) -H #n2 #n #f2 #Hf2 #H1n2 #H2n2
122 elim (lveq_inj_void_sn_ge … H1n1 … H1n2) -H1n2 // #H1 #H2 #H3 destruct
123 elim (pr_sor_isf_bi f1 (⫰f2)) /3 width=3 by frees_fwd_isfin, pr_isf_tl/ #f #Hf #_
124 <pr_tls_swap in H2n2; #H2n2
125 /4 width=12 by frees_bind_void, pr_sor_inv_sle_bi, pr_sor_tls, ex4_4_intro/
128 theorem fsle_flat_sn:
129 ∀L1,L2,V1,T1,T. ❨L1,V1❩ ⊆ ❨L2,T❩ → ❨L1,T1❩ ⊆ ❨L2,T❩ →
130 ∀I. ❨L1,ⓕ[I]V1.T1❩ ⊆ ❨L2,T❩.
131 #L1 #L2 #V1 #T1 #T * #n1 #x #f1 #g #Hf1 #Hg #H1n1 #H2n1 #H #I
132 elim (fsle_frees_trans … H … Hg) -H #n2 #n #f2 #Hf2 #H1n2 #H2n2
133 elim (lveq_inj … H1n1 … H1n2) -H1n2 #H1 #H2 destruct
134 elim (pr_sor_isf_bi f1 f2) /2 width=3 by frees_fwd_isfin/ #f #Hf #_
135 /4 width=12 by frees_flat, pr_sor_inv_sle_bi, pr_sor_tls, ex4_4_intro/
138 theorem fsle_bind_eq:
139 ∀L1,L2. |L1| = |L2| → ∀V1,V2. ❨L1,V1❩ ⊆ ❨L2,V2❩ →
140 ∀I2,T1,T2. ❨L1.ⓧ,T1❩ ⊆ ❨L2.ⓑ[I2]V2,T2❩ →
141 ∀p,I1. ❨L1,ⓑ[p,I1]V1.T1❩ ⊆ ❨L2,ⓑ[p,I2]V2.T2❩.
143 * #n1 #m1 #f1 #g1 #Hf1 #Hg1 #H1L #Hfg1 #I2 #T1 #T2
144 * #n2 #m2 #f2 #g2 #Hf2 #Hg2 #H2L #Hfg2 #p #I1
145 elim (lveq_inj_length … H1L) // #H1 #H2 destruct
146 elim (lveq_inj_length … H2L) // -HL -H2L #H1 #H2 destruct
147 elim (pr_sor_isf_bi f1 (⫰f2)) /3 width=3 by frees_fwd_isfin, pr_isf_tl/ #f #Hf #_
148 elim (pr_sor_isf_bi g1 (⫰g2)) /3 width=3 by frees_fwd_isfin, pr_isf_tl/ #g #Hg #_
149 /4 width=15 by frees_bind_void, frees_bind, pr_sor_monotonic_sle, pr_sle_tl, ex4_4_intro/
153 ∀L1,L2,V1,V2. ❨L1,V1❩ ⊆ ❨L2,V2❩ →
154 ∀I1,I2,T1,T2. ❨L1.ⓑ[I1]V1,T1❩ ⊆ ❨L2.ⓑ[I2]V2,T2❩ →
155 ∀p. ❨L1,ⓑ[p,I1]V1.T1❩ ⊆ ❨L2,ⓑ[p,I2]V2.T2❩.
157 * #n1 #m1 #f1 #g1 #Hf1 #Hg1 #H1L #Hfg1 #I1 #I2 #T1 #T2
158 * #n2 #m2 #f2 #g2 #Hf2 #Hg2 #H2L #Hfg2 #p
159 elim (lveq_inv_pair_pair … H2L) -H2L #H2L #H1 #H2 destruct
160 elim (lveq_inj … H2L … H1L) -H1L #H1 #H2 destruct
161 elim (pr_sor_isf_bi f1 (⫰f2)) /3 width=3 by frees_fwd_isfin, pr_isf_tl/ #f #Hf #_
162 elim (pr_sor_isf_bi g1 (⫰g2)) /3 width=3 by frees_fwd_isfin, pr_isf_tl/ #g #Hg #_
163 /4 width=15 by frees_bind, pr_sor_monotonic_sle, pr_sle_tl, ex4_4_intro/
167 ∀L1,L2,V1,V2. ❨L1,V1❩ ⊆ ❨L2,V2❩ →
168 ∀T1,T2. ❨L1,T1❩ ⊆ ❨L2,T2❩ →
169 ∀I1,I2. ❨L1,ⓕ[I1]V1.T1❩ ⊆ ❨L2,ⓕ[I2]V2.T2❩.
170 /3 width=1 by fsle_flat_sn, fsle_flat_dx_dx, fsle_flat_dx_sn/ qed-.