]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/etc/lleq_alt/lleq_ext.etc
components: arity, csuba
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / etc / lleq_alt / lleq_ext.etc
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/substitution/lleq_alt.ma".
16
17 (* LAZY EQUIVALENCE FOR LOCAL ENVIRONMENTS **********************************)
18
19 (* Advanced inversion lemmas ************************************************)
20
21 fact lleq_inv_S_aux: ∀L1,L2,T,d0. L1 ⋕[T, d0] L2 → ∀d. d0 = d + 1 →
22                      ∀K1,K2,I,V. ⇩[d] L1 ≡ K1.ⓑ{I}V → ⇩[d] L2 ≡ K2.ⓑ{I}V →
23                      K1 ⋕[V, 0] K2 → L1 ⋕[T, d] L2.
24 #L1 #L2 #T #d0 #H @(lleq_ind_alt … H) -L1 -L2 -T -d0
25 /2 width=1 by lleq_gref, lleq_free, lleq_sort/
26 [ #L1 #L2 #d0 #i #HL12 #Hid #d #H #K1 #K2 #I #V #HLK1 #HLK2 #HV destruct
27   elim (yle_split_eq i d) /2 width=1 by lleq_skip, ylt_fwd_succ2/ -HL12 -Hid
28   #H destruct /2 width=8 by lleq_lref/
29 | #I1 #I2 #L1 #L2 #K11 #K22 #V #d0 #i #Hd0i #HLK11 #HLK22 #HV #_ #d #H #K1 #K2 #J #W #_ #_ #_ destruct
30   /3 width=8 by lleq_lref, yle_pred_sn/
31 | #a #I #L1 #L2 #V #T #d0 #_ #_ #IHV #IHT #d #H #K1 #K2 #J #W #HLK1 #HLK2 destruct
32   /4 width=7 by lleq_bind, ldrop_drop/
33 | #I #L1 #L2 #V #T #d0 #_ #_ #IHV #IHT #d #H #K1 #K2 #J #W #HLK1 #HLK2 destruct
34   /3 width=7 by lleq_flat/
35 ]
36 qed-.
37
38 lemma lleq_inv_S: ∀T,L1,L2,d. L1 ⋕[T, d+1] L2 →
39                   ∀K1,K2,I,V. ⇩[d] L1 ≡ K1.ⓑ{I}V → ⇩[d] L2 ≡ K2.ⓑ{I}V →
40                   K1 ⋕[V, 0] K2 → L1 ⋕[T, d] L2.
41 /2 width=7 by lleq_inv_S_aux/ qed-.
42
43 lemma lleq_inv_bind_O: ∀a,I,L1,L2,V,T. L1 ⋕[ⓑ{a,I}V.T, 0] L2 →
44                        L1 ⋕[V, 0] L2 ∧ L1.ⓑ{I}V ⋕[T, 0] L2.ⓑ{I}V.
45 #a #I #L1 #L2 #V #T #H elim (lleq_inv_bind … H) -H
46 /3 width=7 by ldrop_pair, conj, lleq_inv_S/
47 qed-.
48
49 (* Advanced forward lemmas **************************************************)
50
51 lemma lleq_fwd_bind_O: ∀a,I,L1,L2,V,T. L1 ⋕[ⓑ{a,I}V.T, 0] L2 →
52                        L1.ⓑ{I}V ⋕[T, 0] L2.ⓑ{I}V.
53 #a #I #L1 #L2 #V #T #H elim (lleq_inv_bind_O … H) -H //
54 qed-.
55
56 (* Advanced properties ******************************************************)
57
58 lemma lleq_ge: ∀L1,L2,T,d1. L1 ⋕[T, d1] L2 → ∀d2. d1 ≤ d2 → L1 ⋕[T, d2] L2.
59 #L1 #L2 #T #d1 #H @(lleq_ind_alt … H) -L1 -L2 -T -d1
60 /4 width=1 by lleq_sort, lleq_free, lleq_gref, lleq_bind, lleq_flat, yle_succ/
61 [ /3 width=3 by lleq_skip, ylt_yle_trans/
62 | #I1 #I2 #L1 #L2 #K1 #K2 #V #d1 #i #Hi #HLK1 #HLK2 #HV #IHV #d2 #Hd12 elim (ylt_split i d2)
63   [ lapply (lleq_fwd_length … HV) #HK12 #Hid2
64     lapply (ldrop_fwd_length … HLK1) lapply (ldrop_fwd_length … HLK2)
65     normalize in ⊢ (%→%→?); -I1 -I2 -V -d1 /2 width=1 by lleq_skip/ 
66   | /3 width=8 by lleq_lref, yle_trans/
67   ]
68 ]
69 qed-.
70
71 lemma lleq_bind_O: ∀a,I,L1,L2,V,T. L1 ⋕[V, 0] L2 → L1.ⓑ{I}V ⋕[T, 0] L2.ⓑ{I}V →
72                    L1 ⋕[ⓑ{a,I}V.T, 0] L2.
73 /3 width=3 by lleq_ge, lleq_bind/ qed.
74
75 lemma lleq_bind_repl_SO: ∀I1,I2,L1,L2,V1,V2,T. L1.ⓑ{I1}V1 ⋕[T, 0] L2.ⓑ{I2}V2 →
76                          ∀J1,J2,W1,W2. L1.ⓑ{J1}W1 ⋕[T, 1] L2.ⓑ{J2}W2.
77 #I1 #I2 #L1 #L2 #V1 #V2 #T #HT #J1 #J2 #W1 #W2 lapply (lleq_ge … HT 1 ?) // -HT
78 #HT @(lleq_lsuby_repl … HT) /2 width=1 by lsuby_succ/ (**) (* full auto fails *)
79 qed-.
80
81 lemma lleq_bind_repl_O: ∀I,L1,L2,V,T. L1.ⓑ{I}V ⋕[T, 0] L2.ⓑ{I}V →
82                         ∀J,W. L1 ⋕[W, 0] L2 → L1.ⓑ{J}W ⋕[T, 0] L2.ⓑ{J}W.
83 /3 width=7 by lleq_bind_repl_SO, lleq_inv_S/ qed-.
84
85 (* Inversion lemmas on negated lazy quivalence for local environments *******)
86
87 lemma nlleq_inv_bind_O: ∀a,I,L1,L2,V,T. (L1 ⋕[ⓑ{a,I}V.T, 0] L2 → ⊥) →
88                         (L1 ⋕[V, 0] L2 → ⊥) ∨ (L1.ⓑ{I}V ⋕[T, 0] L2.ⓑ{I}V → ⊥).
89 #a #I #L1 #L2 #V #T #H elim (lleq_dec V L1 L2 0)
90 /4 width=1 by lleq_bind_O, or_intror, or_introl/
91 qed-.