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_2/relocation/drops.ma".
16 include "basic_2/s_computation/fqup_weight.ma".
17 include "basic_2/static/frees.ma".
19 (* CONTEXT-SENSITIVE FREE VARIABLES *****************************************)
21 (* Advanced properties ******************************************************)
23 (* Note: this replaces lemma 1400 concluding the "big tree" theorem *)
24 lemma frees_total: ∀L,T. ∃f. L ⊢ 𝐅*⦃T⦄ ≡ f.
25 #L #T @(fqup_wf_ind_eq … (⋆) L T) -L -T
26 #G0 #L0 #T0 #IH #G #L *
27 [ cases L -L /3 width=2 by frees_atom, ex_intro/
29 [ #s #HG #HL #HT destruct
30 elim (IH G L (⋆s)) -IH /3 width=2 by frees_sort_gen, fqu_fqup, fqu_drop, lifts_sort, ex_intro/
31 | * [2: #i ] #HG #HL #HT destruct
32 [ elim (IH G L (#i)) -IH /3 width=2 by frees_lref, fqu_fqup, ex_intro/
33 | elim (IH G L V) -IH /3 width=2 by frees_zero, fqu_fqup, fqu_lref_O, ex_intro/
35 | #l #HG #HL #HT destruct
36 elim (IH G L (§l)) -IH /3 width=2 by frees_gref_gen, fqu_fqup, fqu_drop, lifts_gref, ex_intro/
38 | * [ #p ] #I #V #T #HG #HL #HT destruct elim (IH G L V) // #f1 #HV
39 [ elim (IH G (L.ⓑ{I}V) T) -IH // #f2 #HT
40 elim (sor_isfin_ex f1 (⫱f2))
41 /3 width=6 by frees_fwd_isfin, frees_bind, isfin_tl, ex_intro/
42 | elim (IH G L T) -IH // #f2 #HT
43 elim (sor_isfin_ex f1 f2)
44 /3 width=6 by frees_fwd_isfin, frees_flat, ex_intro/
49 (* Properties with plus-iterated supclosure *********************************)
51 lemma frees_drops_next: ∀f1,L1,T1. L1 ⊢ 𝐅*⦃T1⦄ ≡ f1 →
52 ∀I2,L2,V2,n. ⬇*[n] L1 ≡ L2.ⓑ{I2}V2 →
54 ∃∃g2. L2 ⊢ 𝐅*⦃V2⦄ ≡ g2 & g2 ⊆ g1.
55 #f1 #L1 #T1 #H elim H -f1 -L1 -T1
56 [ #f1 #I1 #Hf1 #I2 #L2 #V2 #n #HL12
57 elim (drops_inv_atom1 … HL12) -HL12 #H destruct
58 | #f1 #I1 #L1 #V1 #s #_ #IH #I2 #L2 #V2 *
59 [ -IH #_ #g1 #Hgf1 elim (discr_next_push … Hgf1)
60 | #n #HL12 lapply (drops_inv_drop1 … HL12) -HL12
61 #HL12 #g1 <tls_xn #Hgf1 elim (IH … HL12 … Hgf1) -IH -HL12 -Hgf1
62 /2 width=3 by ex2_intro/
64 | #f1 #I1 #L1 #V1 #Hf1 #IH #I2 #L2 #V2 *
65 [ -IH #HL12 lapply (drops_fwd_isid … HL12 ?) -HL12 //
66 #H destruct #g1 #Hgf1 >(injective_next … Hgf1) -g1
67 /2 width=3 by sle_refl, ex2_intro/
68 | -Hf1 #n #HL12 lapply (drops_inv_drop1 … HL12) -HL12
69 #HL12 #g1 <tls_xn <tl_next_rew #Hgf1 elim (IH … HL12 … Hgf1) -IH -HL12 -Hgf1
70 /2 width=3 by ex2_intro/
72 | #f1 #I1 #L1 #V1 #i #_ #IH #I2 #L2 #V2 *
73 [ -IH #_ #g1 #Hgf1 elim (discr_next_push … Hgf1)
74 | #n #HL12 lapply (drops_inv_drop1 … HL12) -HL12
75 #HL12 #g1 <tls_xn #Hgf1 elim (IH … HL12 … Hgf1) -IH -HL12 -Hgf1
76 /2 width=3 by ex2_intro/
78 | #f1 #I1 #L1 #V1 #l #_ #IH #I2 #L2 #V2 *
79 [ -IH #_ #g1 #Hgf1 elim (discr_next_push … Hgf1)
80 | #n #HL12 lapply (drops_inv_drop1 … HL12) -HL12
81 #HL12 #g1 <tls_xn #Hgf1 elim (IH … HL12 … Hgf1) -IH -HL12 -Hgf1
82 /2 width=3 by ex2_intro/
84 | #fV1 #fT1 #f1 #p #I1 #L1 #V1 #T1 #_ #_ #Hf1 #IHV1 #IHT1 #I2 #L2 #V2 #n #HL12 #g1 #Hgf1
85 lapply (sor_tls … Hf1 n) -Hf1 <Hgf1 -Hgf1 #Hf1
86 elim (sor_xxn_tl … Hf1) [1,2: * |*: // ] -Hf1
88 [ -IHT1 #H1 #_ elim (IHV1 … HL12 … H1) -IHV1 -HL12 -H1
89 /3 width=6 by sor_inv_sle_sn_trans, ex2_intro/
90 | -IHV1 #_ >tls_xn #H2 elim (IHT1 … H2) -IHT1 -H2
91 /3 width=6 by drops_drop, sor_inv_sle_dx_trans, ex2_intro/
93 | #fV1 #fT1 #f1 #I1 #L1 #V1 #T1 #_ #_ #Hf1 #IHV1 #IHT1 #I2 #L2 #V2 #n #HL12 #g1 #Hgf1
94 lapply (sor_tls … Hf1 n) -Hf1 <Hgf1 -Hgf1 #Hf1
95 elim (sor_xxn_tl … Hf1) [1,2: * |*: // ] -Hf1
97 [ -IHT1 #H1 #_ elim (IHV1 … HL12 … H1) -IHV1 -HL12 -H1
98 /3 width=6 by sor_inv_sle_sn_trans, ex2_intro/
99 | -IHV1 #_ #H2 elim (IHT1 … HL12 … H2) -IHT1 -HL12 -H2
100 /3 width=6 by sor_inv_sle_dx_trans, ex2_intro/