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