]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/static/lfxs_lfxs.ma
update in basic_2
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / static / lfxs_lfxs.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_lexs.ma".
16 include "basic_2/static/frees_fqup.ma".
17 include "basic_2/static/lfxs.ma".
18
19 (* GENERIC EXTENSION ON REFERRED ENTRIES OF A CONTEXT-SENSITIVE REALTION ****)
20
21 (* Advanced inversion lemmas ************************************************)
22
23 lemma lfxs_inv_frees: ∀R,L1,L2,T. L1 ⪤*[R, T] L2 →
24                       ∀f. L1 ⊢ 𝐅*⦃T⦄ ≡ f → L1 ⪤*[cext2 R, cfull, f] L2.
25 #R #L1 #L2 #T * /3 width=6 by frees_mono, lexs_eq_repl_back/
26 qed-.
27
28 (* Advanced properties ******************************************************)
29
30 (* Basic_2A1: uses: llpx_sn_dec *)
31 lemma lfxs_dec: ∀R. (∀L,T1,T2. Decidable (R L T1 T2)) →
32                 ∀L1,L2,T. Decidable (L1 ⪤*[R, T] L2).
33 #R #HR #L1 #L2 #T
34 elim (frees_total L1 T) #f #Hf
35 elim (lexs_dec (cext2 R) cfull … L1 L2 f)
36 /4 width=3 by lfxs_inv_frees, cfull_dec, ext2_dec, ex2_intro, or_intror, or_introl/
37 qed-.
38
39 (* Main properties **********************************************************)
40
41 (* Basic_2A1: uses: llpx_sn_bind llpx_sn_bind_O *)
42 theorem lfxs_bind: ∀R,p,I,L1,L2,V1,V2,T.
43                    L1 ⪤*[R, V1] L2 → L1.ⓑ{I}V1 ⪤*[R, T] L2.ⓑ{I}V2 →
44                    L1 ⪤*[R, ⓑ{p,I}V1.T] L2.
45 #R #p #I #L1 #L2 #V1 #V2 #T * #f1 #HV #Hf1 * #f2 #HT #Hf2
46 lapply (lexs_fwd_bind … Hf2) -Hf2 #Hf2 elim (sor_isfin_ex f1 (⫱f2))
47 /3 width=7 by frees_fwd_isfin, frees_bind, lexs_join, isfin_tl, ex2_intro/
48 qed.
49
50 (* Basic_2A1: llpx_sn_flat *)
51 theorem lfxs_flat: ∀R,I,L1,L2,V,T.
52                    L1 ⪤*[R, V] L2 → L1 ⪤*[R, T] L2 →
53                    L1 ⪤*[R, ⓕ{I}V.T] L2.
54 #R #I #L1 #L2 #V #T * #f1 #HV #Hf1 * #f2 #HT #Hf2 elim (sor_isfin_ex f1 f2)
55 /3 width=7 by frees_fwd_isfin, frees_flat, lexs_join, ex2_intro/
56 qed.
57
58 theorem lfxs_bind_void: ∀R,p,I,L1,L2,V,T.
59                         L1 ⪤*[R, V] L2 → L1.ⓧ ⪤*[R, T] L2.ⓧ →
60                         L1 ⪤*[R, ⓑ{p,I}V.T] L2.
61 #R #p #I #L1 #L2 #V #T * #f1 #HV #Hf1 * #f2 #HT #Hf2
62 lapply (lexs_fwd_bind … Hf2) -Hf2 #Hf2 elim (sor_isfin_ex f1 (⫱f2))
63 /3 width=7 by frees_fwd_isfin, frees_bind_void, lexs_join, isfin_tl, ex2_intro/
64 qed.
65
66 theorem lfxs_trans_gen: ∀R1,R2,R3. 
67                         c_reflexive … R1 → c_reflexive … R2 →
68                         lfxs_confluent R1 R2 → lfxs_transitive R1 R2 R3 →
69                         ∀L1,T,L. L1 ⪤*[R1, T] L →
70                         ∀L2. L ⪤*[R2, T] L2 → L1 ⪤*[R3, T] L2.
71 #R1 #R2 #R3 #H1R #H2R #H3R #H4R #L1 #T @(fqup_wf_ind_eq (Ⓣ) … (⋆) L1 T) -L1 -T
72 #G0 #L0 #T0 #IH #G #L1 * *
73 [ #s #HG #HL #HT #L #H1 #L2 #H2 destruct
74   elim (lfxs_inv_sort … H1) -H1 *
75   [ #H1 #H0 destruct
76     >(lfxs_inv_atom_sn … H2) -L2 //
77   | #I1 #I #K1 #K #HK1 #H1 #H0 destruct
78     elim (lfxs_inv_sort_bind_sn … H2) -H2 #I2 #K2 #HK2 #H destruct
79     /4 width=3 by lfxs_sort, fqu_fqup/
80   ]
81 | * [ | #i ] #HG #HL #HT #L #H1 #L2 #H2 destruct
82   [ elim (lfxs_inv_zero … H1) -H1 *
83     [ #H1 #H0 destruct
84       >(lfxs_inv_atom_sn … H2) -L2 //
85     | #I #K1 #K #V1 #V #HK1 #H1 #H0 #H destruct
86       elim (lfxs_inv_zero_pair_sn … H2) -H2 #K2 #V2 #HK2 #HV2 #H destruct
87       /4 width=7 by lfxs_pair, fqu_fqup, fqu_lref_O/
88     | #f1 #I #K1 #K #Hf1 #HK1 #H1 #H0 destruct
89       elim (lfxs_inv_zero_unit_sn … H2) -H2 #f2 #K2 #Hf2 #HK2 #H destruct
90       /5 width=8 by lfxs_unit, lexs_trans_id_cfull, lexs_eq_repl_back, isid_inv_eq_repl/
91     ]
92   | elim (lfxs_inv_lref … H1) -H1 *
93     [ #H1 #H0 destruct
94       >(lfxs_inv_atom_sn … H2) -L2 //
95     | #I1 #I #K1 #K #HK1 #H1 #H0 destruct
96       elim (lfxs_inv_lref_bind_sn … H2) -H2 #I2 #K2 #HK2 #H destruct
97      /4 width=3 by lfxs_lref, fqu_fqup/
98     ]
99   ]
100 | #l #HG #HL #HT #L #H1 #L2 #H2 destruct
101   elim (lfxs_inv_gref … H1) -H1 *
102   [ #H1 #H0 destruct
103     >(lfxs_inv_atom_sn … H2) -L2 //
104   | #I1 #I #K1 #K #HK1 #H1 #H0 destruct
105     elim (lfxs_inv_gref_bind_sn … H2) -H2 #I2 #K2 #HK2 #H destruct
106     /4 width=3 by lfxs_gref, fqu_fqup/
107   ]
108 | #p #I #V1 #T1 #HG #HL #HT #L #H1 #L2 #H2 destruct
109   elim (lfxs_inv_bind … V1 V1 … H1) -H1 // #H1V #H1T
110   elim (lfxs_inv_bind … V1 V1 … H2) -H2 // #H2V #H2T
111   /3 width=4 by lfxs_bind/
112 | #I #V1 #T1 #HG #HL #HT #L #H1 #L2 #H2 destruct
113   elim (lfxs_inv_flat … H1) -H1 #H1V #H1T
114   elim (lfxs_inv_flat … H2) -H2 #H2V #H2T
115   /3 width=3 by lfxs_flat/
116 ]
117 qed-.
118
119 (* Negated inversion lemmas *************************************************)
120
121 (* Basic_2A1: uses: nllpx_sn_inv_bind nllpx_sn_inv_bind_O *)
122 lemma lfnxs_inv_bind: ∀R. (∀L,T1,T2. Decidable (R L T1 T2)) →
123                       ∀p,I,L1,L2,V,T. (L1 ⪤*[R, ⓑ{p,I}V.T] L2 → ⊥) →
124                       (L1 ⪤*[R, V] L2 → ⊥) ∨ (L1.ⓑ{I}V ⪤*[R, T] L2.ⓑ{I}V → ⊥).
125 #R #HR #p #I #L1 #L2 #V #T #H elim (lfxs_dec … HR L1 L2 V)
126 /4 width=2 by lfxs_bind, or_intror, or_introl/
127 qed-.
128
129 (* Basic_2A1: uses: nllpx_sn_inv_flat *)
130 lemma lfnxs_inv_flat: ∀R. (∀L,T1,T2. Decidable (R L T1 T2)) →
131                       ∀I,L1,L2,V,T. (L1 ⪤*[R, ⓕ{I}V.T] L2 → ⊥) →
132                       (L1 ⪤*[R, V] L2 → ⊥) ∨ (L1 ⪤*[R, T] L2 → ⊥).
133 #R #HR #I #L1 #L2 #V #T #H elim (lfxs_dec … HR L1 L2 V)
134 /4 width=1 by lfxs_flat, or_intror, or_introl/
135 qed-.
136
137 lemma lfnxs_inv_bind_void: ∀R. (∀L,T1,T2. Decidable (R L T1 T2)) →
138                            ∀p,I,L1,L2,V,T. (L1 ⪤*[R, ⓑ{p,I}V.T] L2 → ⊥) →
139                            (L1 ⪤*[R, V] L2 → ⊥) ∨ (L1.ⓧ ⪤*[R, T] L2.ⓧ → ⊥).
140 #R #HR #p #I #L1 #L2 #V #T #H elim (lfxs_dec … HR L1 L2 V)
141 /4 width=2 by lfxs_bind_void, or_intror, or_introl/
142 qed-.