]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/relocation/fsup.ma
lambdadelta
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / relocation / fsup.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/notation/relations/supterm_4.ma".
16 include "basic_2/grammar/cl_weight.ma".
17 include "basic_2/relocation/ldrop.ma".
18
19 (* SUPCLOSURE ***************************************************************)
20
21 inductive fsup: bi_relation lenv term ≝
22 | fsup_lref_O  : ∀I,L,V. fsup (L.ⓑ{I}V) (#0) L V
23 | fsup_pair_sn : ∀I,L,V,T. fsup L (②{I}V.T) L V
24 | fsup_bind_dx : ∀a,I,L,V,T. fsup L (ⓑ{a,I}V.T) (L.ⓑ{I}V) T
25 | fsup_flat_dx : ∀I,L,V,T.   fsup L (ⓕ{I}V.T) L T
26 | fsup_ldrop_lt: ∀L,K,T,U,d,e.
27                  ⇩[d, e] L ≡ K → ⇧[d, e] T ≡ U → 0 < e → fsup L U K T
28 | fsup_ldrop   : ∀L1,K1,K2,T1,T2,U1,d,e.
29                  ⇩[d, e] L1 ≡ K1 → ⇧[d, e] T1 ≡ U1 →
30                  fsup K1 T1 K2 T2 → fsup L1 U1 K2 T2
31 .
32
33 interpretation
34    "structural successor (closure)"
35    'SupTerm L1 T1 L2 T2 = (fsup L1 T1 L2 T2).
36
37 (* Basic properties *********************************************************)
38
39 lemma fsup_lref_S_lt: ∀I,L,K,V,T,i. 0 < i → ⦃L, #(i-1)⦄ ⊃ ⦃K, T⦄ → ⦃L.ⓑ{I}V, #i⦄ ⊃ ⦃K, T⦄.
40 #I #L #K #V #T #i #Hi #H /3 width=7 by fsup_ldrop, ldrop_ldrop, lift_lref_ge_minus/ (**) (* auto too slow without trace *)
41 qed.
42
43 lemma fsup_lref: ∀I,K,V,i,L. ⇩[0, i] L ≡ K.ⓑ{I}V → ⦃L, #i⦄ ⊃ ⦃K, V⦄.
44 #I #K #V #i @(nat_elim1 i) -i #i #IH #L #H
45 elim (ldrop_inv_O1_pair2 … H) -H *
46 [ #H1 #H2 destruct //
47 | #I1 #K1 #V1 #HK1 #H #Hi destruct
48   lapply (IH … HK1) /2 width=1/
49 ]
50 qed.
51
52 (* Basic forward lemmas *****************************************************)
53
54 lemma fsup_fwd_fw: ∀L1,L2,T1,T2. ⦃L1, T1⦄ ⊃ ⦃L2, T2⦄ → ♯{L2, T2} < ♯{L1, T1}.
55 #L1 #L2 #T1 #T2 #H elim H -L1 -L2 -T1 -T2 //
56 [ #L #K #T #U #d #e #HLK #HTU #HKL
57   lapply (ldrop_fwd_lw_lt … HLK HKL) -HKL -HLK #HKL
58   lapply (lift_fwd_tw … HTU) -d -e #H
59   normalize in ⊢ (?%%); /2 width=1/
60 | #L1 #K1 #K2 #T1 #T2 #U1 #d #e #HLK1 #HTU1 #_ #IHT12
61   lapply (ldrop_fwd_lw … HLK1) -HLK1 #HLK1
62   lapply (lift_fwd_tw … HTU1) -HTU1 #HTU1
63   @(lt_to_le_to_lt … IHT12) -IHT12 /2 width=1/
64 ]
65 qed-.
66
67 fact fsup_fwd_length_lref1_aux: ∀L1,L2,T1,T2. ⦃L1, T1⦄ ⊃ ⦃L2, T2⦄ →
68                                 ∀i. T1 = #i → |L2| < |L1|.
69 #L1 #L2 #T1 #T2 #H elim H -L1 -L2 -T1 -T2
70 [1: normalize //
71 |3: #a
72 |5: /2 width=4 by ldrop_fwd_length_lt4/
73 |6: #L1 #K1 #K2 #T1 #T2 #U1 #d #e #HLK1 #HTU1 #_ #IHT12 #i #H destruct
74     lapply (ldrop_fwd_length_le4 … HLK1) -HLK1 #HLK1
75     elim (lift_inv_lref2 … HTU1) -HTU1 * #Hdei #H destruct
76     @(lt_to_le_to_lt … HLK1) /2 width=2/
77 ] #I #L #V #T #j #H destruct
78 qed-.
79
80 lemma fsup_fwd_length_lref1: ∀L1,L2,T2,i. ⦃L1, #i⦄ ⊃ ⦃L2, T2⦄ → |L2| < |L1|.
81 /2 width=5 by fsup_fwd_length_lref1_aux/
82 qed-.