1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 include "basic_2A/notation/relations/supterm_6.ma".
16 include "basic_2A/grammar/cl_weight.ma".
17 include "basic_2A/substitution/drop.ma".
19 (* SUPCLOSURE ***************************************************************)
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+1] L ≡ K → ⬆[0, m+1] T ≡ U → fqu G L U G K T
32 "structural successor (closure)"
33 'SupTerm G1 L1 T1 G2 L2 T2 = (fqu G1 L1 T1 G2 L2 T2).
35 (* Basic properties *********************************************************)
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 >(plus_minus_m_m m 1) /2 width=3 by fqu_drop/
42 lemma fqu_lref_S_lt: ∀I,G,L,V,i. 0 < i → ⦃G, L.ⓑ{I}V, #i⦄ ⊐ ⦃G, L, #(i-1)⦄.
43 /3 width=3 by fqu_drop, drop_drop, lift_lref_ge_minus/
46 (* Basic forward lemmas *****************************************************)
48 lemma fqu_fwd_fw: ∀G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐ ⦃G2, L2, T2⦄ → ♯{G2, L2, T2} < ♯{G1, L1, T1}.
49 #G1 #G2 #L1 #L2 #T1 #T2 #H elim H -G1 -G2 -L1 -L2 -T1 -T2 //
50 #G #L #K #T #U #m #HLK #HTU
51 lapply (drop_fwd_lw_lt … HLK ?) -HLK // #HKL
52 lapply (lift_fwd_tw … HTU) -m #H
53 normalize in ⊢ (?%%); /2 width=1 by lt_minus_to_plus/
56 fact fqu_fwd_length_lref1_aux: ∀G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐ ⦃G2, L2, T2⦄ →
57 ∀i. T1 = #i → |L2| < |L1|.
58 #G1 #G2 #L1 #L2 #T1 #T2 #H elim H -G1 -G2 -L1 -L2 -T1 -T2
61 |5: /2 width=4 by drop_fwd_length_lt4/
62 ] #I #G #L #V #T #j #H destruct
65 lemma fqu_fwd_length_lref1: ∀G1,G2,L1,L2,T2,i. ⦃G1, L1, #i⦄ ⊐ ⦃G2, L2, T2⦄ → |L2| < |L1|.
66 /2 width=7 by fqu_fwd_length_lref1_aux/
69 (* Basic inversion lemmas ***************************************************)
71 fact fqu_inv_eq_aux: ∀G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐ ⦃G2, L2, T2⦄ →
72 G1 = G2 → |L1| = |L2| → T1 = T2 → ⊥.
73 #G1 #G2 #L1 #L2 #T1 #T2 * -G1 -G2 -L1 -L2 -T1 -T2 normalize
74 /2 width=4 by discr_tpair_xy_y, discr_tpair_xy_x, plus_xSy_x_false/
75 #G #L #K #T #U #m #HLK #_ #_ #H #_ -G -T -U >(drop_fwd_length … HLK) in H; -L
76 /2 width=4 by plus_xySz_x_false/
79 lemma fqu_inv_eq: ∀G,L1,L2,T. ⦃G, L1, T⦄ ⊐ ⦃G, L2, T⦄ → |L1| = |L2| → ⊥.
80 #G #L1 #L2 #T #H #H0 @(fqu_inv_eq_aux … H … H0) // (**) (* full auto fails *)
83 (* Advanced eliminators *****************************************************)
85 lemma fqu_wf_ind: ∀R:relation3 …. (
86 ∀G1,L1,T1. (∀G2,L2,T2. ⦃G1, L1, T1⦄ ⊐ ⦃G2, L2, T2⦄ → R G2 L2 T2) →
88 ) → ∀G1,L1,T1. R G1 L1 T1.
89 #R #HR @(f3_ind … fw) #x #IHx #G1 #L1 #T1 #H destruct /4 width=1 by fqu_fwd_fw/