]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/static/lfxs_fsle.ma
cc7218982c531e63403457063615dcccef4cb256
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / static / lfxs_fsle.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/relocation/lexs_length.ma".
16 include "basic_2/static/frees_drops.ma".
17 include "basic_2/static/fsle_fsle.ma".
18 include "basic_2/static/lfxs_lfxs.ma".
19
20 (* GENERIC EXTENSION ON REFERRED ENTRIES OF A CONTEXT-SENSITIVE REALTION ****)
21
22 definition R_fsle_compatible: predicate (relation3 …) ≝ λRN.
23                               ∀L,T1,T2. RN L T1 T2 → ⦃L, T2⦄ ⊆ ⦃L, T1⦄.
24
25 definition lfxs_fsle_compatible: predicate (relation3 …) ≝ λRN.
26                                  ∀L1,L2,T. L1 ⪤*[RN, T] L2 → ⦃L2, T⦄ ⊆ ⦃L1, T⦄.
27
28 (* Basic inversions with free variables inclusion for restricted closures ***)
29
30 lemma frees_lexs_conf: ∀R. lfxs_fsle_compatible R →
31                        ∀L1,T,f1. L1 ⊢ 𝐅*⦃T⦄ ≡ f1 →
32                        ∀L2. L1 ⪤*[cext2 R, cfull, f1] L2 →
33                        ∃∃f2. L2 ⊢ 𝐅*⦃T⦄ ≡ f2 & f2 ⊆ f1.
34 #R #HR #L1 #T #f1 #Hf1 #L2 #H1L
35 lapply (HR L1 L2 T ?) /2 width=3 by ex2_intro/ #H2L
36 @(fsle_frees_trans_eq … H2L … Hf1) /3 width=4 by lexs_fwd_length, sym_eq/
37 qed-.
38
39 (* Properties with free variables inclusion for restricted closures *********)
40
41 (* Note: we just need lveq_inv_refl: ∀L,n1,n2. L ≋ⓧ*[n1, n2] L → ∧∧ 0 = n1 & 0 = n2 *)
42 lemma fsle_lfxs_trans: ∀R,L1,T1,T2. ⦃L1, T1⦄ ⊆ ⦃L1, T2⦄ →
43                        ∀L2. L1 ⪤*[R, T2] L2 → L1 ⪤*[R, T1] L2.
44 #R #L1 #T1 #T2 * #n1 #n2 #f1 #f2 #Hf1 #Hf2 #Hn #Hf #L2 #HL12
45 elim (lveq_inj_length … Hn ?) // #H1 #H2 destruct
46 /4 width=5 by lfxs_inv_frees, sle_lexs_trans, ex2_intro/
47 qed-.
48
49 lemma lfxs_sym: ∀R. lfxs_fsle_compatible R →
50                 (∀L1,L2,T1,T2. R L1 T1 T2 → R L2 T2 T1) →
51                 ∀T. symmetric … (lfxs R T).
52 #R #H1R #H2R #T #L1 #L2
53 * #f1 #Hf1 #HL12
54 elim (frees_lexs_conf … Hf1 … HL12) -Hf1 //
55 /5 width=5 by sle_lexs_trans, lexs_sym, cext2_sym, ex2_intro/
56 qed-.
57
58 lemma lfxs_pair_sn_split: ∀R1,R2. (∀L. reflexive … (R1 L)) → (∀L. reflexive … (R2 L)) →
59                           lfxs_fsle_compatible R1 →
60                           ∀L1,L2,V. L1 ⪤*[R1, V] L2 → ∀I,T.
61                           ∃∃L. L1 ⪤*[R1, ②{I}V.T] L & L ⪤*[R2, V] L2.
62 #R1 #R2 #HR1 #HR2 #HR #L1 #L2 #V * #f #Hf #HL12 * [ #p ] #I #T
63 [ elim (frees_total L1 (ⓑ{p,I}V.T)) #g #Hg
64   elim (frees_inv_bind … Hg) #y1 #y2 #H #_ #Hy
65 | elim (frees_total L1 (ⓕ{I}V.T)) #g #Hg
66   elim (frees_inv_flat … Hg) #y1 #y2 #H #_ #Hy
67 ]
68 lapply(frees_mono … H … Hf) -H #H1
69 lapply (sor_eq_repl_back1 … Hy … H1) -y1 #Hy
70 lapply (sor_inv_sle_sn … Hy) -y2 #Hfg
71 elim (lexs_sle_split (cext2 R1) (cext2 R2) … HL12 … Hfg) -HL12 /2 width=1 by ext2_refl/ #L #HL1 #HL2
72 lapply (sle_lexs_trans … HL1 … Hfg) // #H
73 elim (frees_lexs_conf … Hf … H) -Hf -H
74 /4 width=7 by sle_lexs_trans, ex2_intro/
75 qed-.
76
77 lemma lfxs_flat_dx_split: ∀R1,R2. (∀L. reflexive … (R1 L)) → (∀L. reflexive … (R2 L)) →
78                           lfxs_fsle_compatible R1 →
79                           ∀L1,L2,T. L1 ⪤*[R1, T] L2 → ∀I,V.
80                           ∃∃L. L1 ⪤*[R1, ⓕ{I}V.T] L & L ⪤*[R2, T] L2.
81 #R1 #R2 #HR1 #HR2 #HR #L1 #L2 #T * #f #Hf #HL12 #I #V
82 elim (frees_total L1 (ⓕ{I}V.T)) #g #Hg
83 elim (frees_inv_flat … Hg) #y1 #y2 #_ #H #Hy
84 lapply(frees_mono … H … Hf) -H #H2
85 lapply (sor_eq_repl_back2 … Hy … H2) -y2 #Hy
86 lapply (sor_inv_sle_dx … Hy) -y1 #Hfg
87 elim (lexs_sle_split (cext2 R1) (cext2 R2) … HL12 … Hfg) -HL12 /2 width=1 by ext2_refl/ #L #HL1 #HL2
88 lapply (sle_lexs_trans … HL1 … Hfg) // #H
89 elim (frees_lexs_conf … Hf … H) -Hf -H
90 /4 width=7 by sle_lexs_trans, ex2_intro/
91 qed-.
92
93 lemma lfxs_bind_dx_split: ∀R1,R2. (∀L. reflexive … (R1 L)) → (∀L. reflexive … (R2 L)) →
94                           lfxs_fsle_compatible R1 →
95                           ∀I,L1,L2,V1,T. L1.ⓑ{I}V1 ⪤*[R1, T] L2 → ∀p.
96                           ∃∃L,V. L1 ⪤*[R1, ⓑ{p,I}V1.T] L & L.ⓑ{I}V ⪤*[R2, T] L2 & R1 L1 V1 V.
97 #R1 #R2 #HR1 #HR2 #HR #I #L1 #L2 #V1 #T * #f #Hf #HL12 #p
98 elim (frees_total L1 (ⓑ{p,I}V1.T)) #g #Hg
99 elim (frees_inv_bind … Hg) #y1 #y2 #_ #H #Hy
100 lapply(frees_mono … H … Hf) -H #H2
101 lapply (tl_eq_repl … H2) -H2 #H2
102 lapply (sor_eq_repl_back2 … Hy … H2) -y2 #Hy
103 lapply (sor_inv_sle_dx … Hy) -y1 #Hfg
104 lapply (sle_inv_tl_sn … Hfg) -Hfg #Hfg
105 elim (lexs_sle_split (cext2 R1) (cext2 R2) … HL12 … Hfg) -HL12 /2 width=1 by ext2_refl/ #Y #H #HL2
106 lapply (sle_lexs_trans … H … Hfg) // #H0
107 elim (lexs_inv_next1 … H) -H #Z #L #HL1 #H
108 elim (ext2_inv_pair_sn … H) -H #V #HV #H1 #H2 destruct
109 elim (frees_lexs_conf … Hf … H0) -Hf -H0
110 /4 width=7 by sle_lexs_trans, ex3_2_intro, ex2_intro/
111 qed-.
112
113 lemma lfxs_bind_dx_split_void: ∀R1,R2. (∀L. reflexive … (R1 L)) → (∀L. reflexive … (R2 L)) →
114                                lfxs_fsle_compatible R1 →
115                                ∀L1,L2,T. L1.ⓧ ⪤*[R1, T] L2 → ∀p,I,V.
116                                ∃∃L. L1 ⪤*[R1, ⓑ{p,I}V.T] L & L.ⓧ ⪤*[R2, T] L2.
117 #R1 #R2 #HR1 #HR2 #HR #L1 #L2 #T * #f #Hf #HL12 #p #I #V
118 elim (frees_total L1 (ⓑ{p,I}V.T)) #g #Hg
119 elim (frees_inv_bind_void … Hg) #y1 #y2 #_ #H #Hy
120 lapply(frees_mono … H … Hf) -H #H2
121 lapply (tl_eq_repl … H2) -H2 #H2
122 lapply (sor_eq_repl_back2 … Hy … H2) -y2 #Hy
123 lapply (sor_inv_sle_dx … Hy) -y1 #Hfg
124 lapply (sle_inv_tl_sn … Hfg) -Hfg #Hfg
125 elim (lexs_sle_split (cext2 R1) (cext2 R2) … HL12 … Hfg) -HL12 /2 width=1 by ext2_refl/ #Y #H #HL2
126 lapply (sle_lexs_trans … H … Hfg) // #H0
127 elim (lexs_inv_next1 … H) -H #Z #L #HL1 #H
128 elim (ext2_inv_unit_sn … H) -H #H destruct
129 elim (frees_lexs_conf … Hf … H0) -Hf -H0
130 /4 width=7 by sle_lexs_trans, ex2_intro/ (* note: 2 ex2_intro *)
131 qed-.
132
133 (* Main properties with free variables inclusion for restricted closures ****)
134
135 theorem lfxs_conf: ∀R1,R2.
136                    lfxs_fsle_compatible R1 →
137                    lfxs_fsle_compatible R2 →
138                    R_confluent2_lfxs R1 R2 R1 R2 →
139                    ∀T. confluent2 … (lfxs R1 T) (lfxs R2 T).
140 #R1 #R2 #HR1 #HR2 #HR12 #T #L0 #L1 * #f1 #Hf1 #HL01 #L2 * #f #Hf #HL02
141 lapply (frees_mono … Hf1 … Hf) -Hf1 #Hf12
142 lapply (lexs_eq_repl_back … HL01 … Hf12) -f1 #HL01
143 elim (lexs_conf … HL01 … HL02) /2 width=3 by ex2_intro/ [ | -HL01 -HL02 ]
144 [ #L #HL1 #HL2
145   elim (frees_lexs_conf … Hf … HL01) // -HR1 -HL01 #f1 #Hf1 #H1
146   elim (frees_lexs_conf … Hf … HL02) // -HR2 -HL02 #f2 #Hf2 #H2
147   lapply (sle_lexs_trans … HL1 … H1) // -HL1 -H1 #HL1
148   lapply (sle_lexs_trans … HL2 … H2) // -HL2 -H2 #HL2
149   /3 width=5 by ex2_intro/
150 | #g * #I0 [2: #V0 ] #K0 #n #HLK0 #Hgf #Z1 #H1 #Z2 #H2 #K1 #HK01 #K2 #HK02
151   [ elim (ext2_inv_pair_sn … H1) -H1 #V1 #HV01 #H destruct
152     elim (ext2_inv_pair_sn … H2) -H2 #V2 #HV02 #H destruct
153     elim (frees_inv_drops_next … Hf … HLK0 … Hgf) -Hf -HLK0 -Hgf #g0 #Hg0 #H0
154     lapply (sle_lexs_trans … HK01 … H0) // -HK01 #HK01
155     lapply (sle_lexs_trans … HK02 … H0) // -HK02 #HK02
156     elim (HR12 … HV01 … HV02 K1 … K2) /3 width=3 by ext2_pair, ex2_intro/
157   | lapply (ext2_inv_unit_sn … H1) -H1 #H destruct
158     lapply (ext2_inv_unit_sn … H2) -H2 #H destruct
159     /3 width=3 by ext2_unit, ex2_intro/
160   ]
161 ]
162 qed-.