]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/reduction/fqu.ma
babf330d229e243fef5109c237ed813b8e729ecf
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / reduction / fqu.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/substitution/drop.ma".
18
19 (* SUPCLOSURE ***************************************************************)
20
21 (* activate genv *)
22 inductive fqu: tri_relation genv lenv term ≝
23 | fqu_lref_O : ∀I,G,L,V. fqu G (L.ⓑ{I}V) (#0) G L V
24 | fqu_pair_sn: ∀I,G,L,V,T. fqu G L (②{I}V.T) G L V
25 | fqu_bind_dx: ∀a,I,G,L,V,T. fqu G L (ⓑ{a,I}V.T) G (L.ⓑ{I}V) T
26 | fqu_flat_dx: ∀I,G,L,V,T. fqu G L (ⓕ{I}V.T) G L T
27 | fqu_drop   : ∀G,L,K,T,U,m.
28                ⬇[⫯m] L ≡ K → ⬆[0, ⫯m] T ≡ U → fqu G L U G K T
29 .
30
31 interpretation
32    "structural successor (closure)"
33    'SupTerm G1 L1 T1 G2 L2 T2 = (fqu G1 L1 T1 G2 L2 T2).
34
35 (* Basic properties *********************************************************)
36
37 lemma fqu_drop_lt: ∀G,L,K,T,U,m. 0 < m →
38                    ⬇[m] L ≡ K → ⬆[0, m] T ≡ U → ⦃G, L, U⦄ ⊐ ⦃G, K, T⦄.
39 #G #L #K #T #U #m #Hm lapply (ylt_inv_O1 … Hm) -Hm
40 #Hm <Hm -Hm /2 width=3 by fqu_drop/
41 qed.
42
43 lemma fqu_lref_S_lt: ∀I,G,L,V,i. yinj 0 < i → ⦃G, L.ⓑ{I}V, #i⦄ ⊐ ⦃G, L, #(⫰i)⦄.
44 /4 width=3 by drop_drop, lift_lref_pred, fqu_drop/
45 qed.
46
47 (* Basic forward lemmas *****************************************************)
48
49 lemma fqu_fwd_fw: ∀G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐ ⦃G2, L2, T2⦄ → ♯{G2, L2, T2} < ♯{G1, L1, T1}.
50 #G1 #G2 #L1 #L2 #T1 #T2 #H elim H -G1 -G2 -L1 -L2 -T1 -T2 //
51 #G #L #K #T #U #m #HLK #HTU
52 lapply (drop_fwd_lw_lt … HLK ?) -HLK // #HKL
53 lapply (lift_fwd_tw … HTU) -m #H
54 normalize in ⊢ (?%%); /2 width=1 by lt_minus_to_plus/
55 qed-.
56
57 fact fqu_fwd_length_lref1_aux: ∀G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐ ⦃G2, L2, T2⦄ →
58                                ∀i. T1 = #i → |L2| < |L1|.
59 #G1 #G2 #L1 #L2 #T1 #T2 #H elim H -G1 -G2 -L1 -L2 -T1 -T2
60 [1: /2 width=1 by monotonic_ylt_plus_sn/
61 |3: #a
62 |5: /2 width=4 by drop_fwd_length_lt4/
63 ] #I #G #L #V #T #j #H destruct
64 qed-.
65
66 lemma fqu_fwd_length_lref1: ∀G1,G2,L1,L2,T2,i. ⦃G1, L1, #i⦄ ⊐ ⦃G2, L2, T2⦄ →
67                             |L2| < |L1|.
68 /2 width=7 by fqu_fwd_length_lref1_aux/
69 qed-.
70
71 (* Basic inversion lemmas ***************************************************)
72
73 fact fqu_inv_eq_aux: ∀G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐ ⦃G2, L2, T2⦄ →
74                      G1 = G2 → |L1| = |L2| → T1 = T2 → ⊥.
75 #G1 #G2 #L1 #L2 #T1 #T2 * -G1 -G2 -L1 -L2 -T1 -T2
76 [ #I #G #L #V #_ #H lapply (ysucc_inv_refl … H) -H
77   #H elim (ylt_yle_false (|L|) (∞)) //
78 |5: #G #L #K #T #U #m #HLK #_ #_ #H #_ -G -T -U >(drop_fwd_length … HLK) in H; -L
79     #H elim (discr_yplus_xy_x … H) -H /2 width=2 by ysucc_inv_O_sn/
80     #H elim (ylt_yle_false (|K|) (∞)) // 
81 ]
82 /2 width=4 by discr_tpair_xy_y, discr_tpair_xy_x/
83 qed-.
84
85 lemma fqu_inv_eq: ∀G,L1,L2,T. ⦃G, L1, T⦄ ⊐ ⦃G, L2, T⦄ → |L1| = |L2| → ⊥.
86 #G #L1 #L2 #T #H #H0 @(fqu_inv_eq_aux … H … H0) // (**) (* full auto fails *)
87 qed-. 
88
89 (* Advanced eliminators *****************************************************)
90
91 lemma fqu_wf_ind: ∀R:relation3 …. (
92                      ∀G1,L1,T1. (∀G2,L2,T2. ⦃G1, L1, T1⦄ ⊐ ⦃G2, L2, T2⦄ → R G2 L2 T2) →
93                                 R G1 L1 T1
94                   ) → ∀G1,L1,T1. R G1 L1 T1.
95 #R #HR @(f3_ind … fw) #x #IHx #G1 #L1 #T1 #H destruct /4 width=1 by fqu_fwd_fw/
96 qed-.