+++ /dev/null
-(**************************************************************************)
-(* ___ *)
-(* ||M|| *)
-(* ||A|| A project by Andrea Asperti *)
-(* ||T|| *)
-(* ||I|| Developers: *)
-(* ||T|| The HELM team. *)
-(* ||A|| http://helm.cs.unibo.it *)
-(* \ / *)
-(* \ / This file is distributed under the terms of the *)
-(* v GNU General Public License Version 2 *)
-(* *)
-(**************************************************************************)
-
-include "basic_2/relocation/drops_weight.ma".
-include "basic_2/s_computation/fqup_weight.ma".
-include "basic_2/s_computation/fqus_fqup.ma".
-include "basic_2/static/frees.ma".
-
-corec lemma sle_refl: ∀f. f ⊆ f.
-#f cases (pn_split f) * #g #H
-[ @(sle_push … H H) | @(sle_next … H H) ] -H //
-qed.
-
-lemma sle_inv_tl1: ∀f1,f2. ⫱f1 ⊆ f2 → f1 ⊆ ⫯f2.
-#f1 elim (pn_split f1) * #g #H destruct
-/2 width=5 by sle_next, sle_weak/
-qed-.
-
-axiom sor_tls: ∀f1,f2,f. f1 ⋓ f2 ≡ f →
- ∀n. ⫱*[n]f1 ⋓ ⫱*[n]f2 ≡ ⫱*[n]f.
-
-axiom sor_sle1: ∀f1,f2,f. f1 ⋓ f2 ≡ f →
- ∀g. g ⊆ f1 → g ⊆ f.
-
-axiom sor_sle2: ∀f1,f2,f. f1 ⋓ f2 ≡ f →
- ∀g. g ⊆ f2 → g ⊆ f.
-
-lemma fqus_inv_refl_atom3: ∀I,G,L,X. ⦃G, L, ⓪{I}⦄ ⊐* ⦃G, L, X⦄ → ⓪{I} = X.
-#I #G #L #X #H elim (fqus_inv_fqup … H) -H [2: * // ]
-#H lapply (fqup_fwd_fw … H) -H
-#H elim (lt_le_false … H) -H /2 width=1 by monotonic_le_plus_r/
-qed-.
-
-axiom drops_T_isuni_inv_refl: ∀n,L. ⬇*[n] L ≡ L → n = 0.
-
-axiom fqus_split_fqu: ∀G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐* ⦃G2, L2, T2⦄ →
- (∧∧ G1 = G2 & L1 = L2 & T1 = T2) ∨
- ∃∃G,L,T. ⦃G1, L1, T1⦄ ⊐ ⦃G, L, T⦄ & ⦃G, L, T⦄ ⊐* ⦃G2, L2, T2⦄.
-
-axiom fqus_inv_atom1: ∀I,G1,G2,L2,T2. ⦃G1, ⋆, ⓪{I}⦄ ⊐* ⦃G2, L2, T2⦄ →
- ∧∧ G1 = G2 & ⋆ = L2 & ⓪{I} = T2.
-
-axiom fqus_inv_sort1: ∀G1,G2,L1,L2,T2,s. ⦃G1, L1, ⋆s⦄ ⊐* ⦃G2, L2, T2⦄ →
- ∧∧ G1 = G2 & L1 = L2 & ⋆s = T2.
-
-axiom fqus_inv_zero1: ∀I,G1,G2,L1,L2,V1,T2. ⦃G1, L1.ⓑ{I}V1, #0⦄ ⊐* ⦃G2, L2, T2⦄ →
- (∧∧ G1 = G2 & L1.ⓑ{I}V1 = L2 & #0 = T2) ∨ ⦃G1, L1, V1⦄ ⊐* ⦃G2, L2, T2⦄.
-
-axiom fqus_inv_lref1: ∀I,G1,G2,L1,L2,V1,T2,i. ⦃G1, L1.ⓑ{I}V1, #⫯i⦄ ⊐* ⦃G2, L2, T2⦄ →
- (∧∧ G1 = G2 & L1.ⓑ{I}V1 = L2 & #(⫯i) = T2) ∨ ⦃G1, L1, #i⦄ ⊐* ⦃G2, L2, T2⦄.
-
-axiom fqus_inv_gref1: ∀G1,G2,L1,L2,T2,l. ⦃G1, L1, §l⦄ ⊐* ⦃G2, L2, T2⦄ →
- ∧∧ G1 = G2 & L1 = L2 & §l = T2.
-
-axiom fqus_inv_bind1: ∀p,I,G1,G2,L1,L2,V1,T1,T2. ⦃G1, L1, ⓑ{p,I}V1.T1⦄ ⊐* ⦃G2, L2, T2⦄ →
- ∨∨ ∧∧ G1 = G2 & L1 = L2 & ⓑ{p,I}V1.T1 = T2
- | ⦃G1, L1, V1⦄ ⊐* ⦃G2, L2, T2⦄
- | ⦃G1, L1.ⓑ{I}V1, T1⦄ ⊐* ⦃G2, L2, T2⦄.
-
-axiom fqus_inv_flat1: ∀I,G1,G2,L1,L2,V1,T1,T2. ⦃G1, L1, ⓕ{I}V1.T1⦄ ⊐* ⦃G2, L2, T2⦄ →
- ∨∨ ∧∧ G1 = G2 & L1 = L2 & ⓕ{I}V1.T1 = T2
- | ⦃G1, L1, V1⦄ ⊐* ⦃G2, L2, T2⦄
- | ⦃G1, L1, T1⦄ ⊐* ⦃G2, L2, T2⦄.
-
-(* CONTEXT-SENSITIVE FREE VARIABLES *****************************************)
-
-lemma frees_drops_sle: ∀f1,G,L1,T1. L1 ⊢ 𝐅*⦃T1⦄ ≡ f1 →
- ∀L2,T2. ⦃G, L1, T1⦄ ⊐* ⦃G, L2, T2⦄ →
- ∀I,n. ⬇*[n] L1 ≡ L2.ⓑ{I}T2 →
- ∃∃f2. L2 ⊢ 𝐅*⦃T2⦄ ≡ f2 & f2 ⊆ ⫱*[⫯n] f1.
-#f1 #G #L1 #T1 #H elim H -f1 -L1 -T1
-[ #f1 #J #Hf1 #L2 #T2 #H12 #I #n #HL12
- elim (fqus_inv_atom1 … H12) -H12 #H1 #H2 #H3 destruct
- lapply (drops_fwd_lw … HL12) -HL12 #HL12
- elim (lt_le_false … HL12) -HL12 //
-| #f1 #J #L1 #V1 #s #_ #_ #L2 #T2 #H12 #I #n #HL12
- elim (fqus_inv_sort1 … H12) -H12 #H1 #H2 #H3 destruct
- lapply (drops_fwd_lw … HL12) -HL12 #HL12
- elim (lt_le_false … HL12) -HL12 //
-| #f1 #J #L1 #V1 #Hf1 #IH #L2 #T2 #H12
- elim (fqus_inv_zero1 … H12) -H12 [ * | #H12 #I * ]
- [ -IH -Hf1 #H1 #H2 #H3 #I #n #HL12 destruct
- lapply (drops_fwd_lw … HL12) -HL12 #HL12
- elim (lt_le_false … HL12) -HL12 //
- | -IH -H12 #HL12 lapply (drops_fwd_isid … HL12 ?) -HL12 //
- #H destruct /3 width=3 by sle_refl, ex2_intro/
- | -Hf1 #n #HL12 lapply (drops_inv_drop1 … HL12) -HL12
- #HL12 elim (IH … H12 … HL12) -IH -H12 -HL12 /3 width=3 by ex2_intro/
- ]
-| #f1 #J #L1 #V1 #i #Hf1 #IH #L2 #T2 #H12
- elim (fqus_inv_lref1 … H12) -H12 [ * | #H12 #I * ]
- [ -IH -Hf1 #H1 #H2 #H3 #I #n #HL12 destruct
- lapply (drops_fwd_lw … HL12) -HL12 #HL12
- elim (lt_le_false … HL12) -HL12 //
- | -IH #HL12 lapply (drops_fwd_isid … HL12 ?) -HL12 //
- #H destruct <(fqus_inv_refl_atom3 … H12) -H12 /2 width=3 by sle_refl, ex2_intro/
- | -Hf1 #I #HL12 lapply (drops_inv_drop1 … HL12) -HL12
- #HL12 elim (IH … H12 … HL12) -IH -H12 -HL12 /3 width=3 by ex2_intro/
- ]
-| #f1 #J #L1 #V1 #l #_ #_ #L2 #T2 #H12 #I #n #HL12
- elim (fqus_inv_gref1 … H12) -H12 #H1 #H2 #H3 destruct
- lapply (drops_fwd_lw … HL12) -HL12 #HL12
- elim (lt_le_false … HL12) -HL12 //
-| #f1V #f1T #f1 #p #J #L1 #V #T #_ #_ #Hf1 #IHV #IHT #L2 #T2 #H12 #I #n #HL12
- elim (fqus_inv_bind1 … H12) -H12 [ * |*: #H12 ]
- [ -IHV -IHT -Hf1 #H1 #H2 #H3 destruct
- lapply (drops_fwd_lw … HL12) -HL12 #HL12
- elim (lt_le_false … HL12) -HL12 //
- | -IHT elim (IHV … H12 … HL12) -IHV -H12 -HL12
- /4 width=6 by sor_tls, sor_sle1, ex2_intro/
- | -IHV elim (IHT … H12 I (⫯n)) -IHT -H12 /2 width=1 by drops_drop/ -HL12
- <tls_xn /4 width=6 by ex2_intro, sor_tls, sor_sle2/
- ]
-| #f1V #f1T #f1 #J #L1 #V #T #_ #_ #Hf1 #IHV #IHT #L2 #T2 #H12 #I #n #HL12
- elim (fqus_inv_flat1 … H12) -H12 [ * |*: #H12 ]
- [ -IHV -IHT -Hf1 #H1 #H2 #H3 destruct
- lapply (drops_fwd_lw … HL12) -HL12 #HL12
- elim (lt_le_false … HL12) -HL12 //
- | -IHT elim (IHV … H12 … HL12) -IHV -H12 -HL12
- /4 width=6 by sor_tls, sor_sle1, ex2_intro/
- | -IHV elim (IHT … H12 … HL12) -IHT -H12 -HL12
- /4 width=6 by ex2_intro, sor_tls, sor_sle2/
- ]
-]
-qed-.
lapply (frees_mono … Hf1 … Hf) -Hf1 #Hf12
lapply (lexs_eq_repl_back … HL01 … Hf12) -f1 #HL01
elim (lexs_conf … HL01 … HL02)
+
+lemma pippo: ∀R1,R2,RP1,RP2. R_confluent_lfxs R1 R2 RP1 RP2 →
+ lexs_confluent R1 R2 RP1 cfull RP2 cfull.
+#R1 #R2 #RP1 #RP2 #HR #f #L0 #T0 #T1 #HT01 #T2 #HT02 #L1 #HL01 #L2
+#HL02
]
qed-.
+(* Inversion lemmas with uniform relocations ********************************)
+
lemma lifts_inv_lref1_uni: ∀l,Y,i. ⬆*[l] #i ≡ Y → Y = #(l+i).
#l #Y #i1 #H elim (lifts_inv_lref1 … H) -H /4 width=4 by at_mono, eq_f/
qed-.
+lemma lifts_inv_lref2_uni: ∀l,X,i2. ⬆*[l] X ≡ #i2 →
+ ∃∃i1. X = #i1 & i2 = l + i1.
+#l #X #i2 #H elim (lifts_inv_lref2 … H) -H
+/3 width=3 by at_inv_uni, ex2_intro/
+qed-.
+
+lemma lifts_inv_lref2_uni_ge: ∀l,X,i. ⬆*[l] X ≡ #(l + i) → X = #i.
+#l #X #i2 #H elim (lifts_inv_lref2_uni … H) -H
+#i1 #H1 #H2 destruct /4 width=2 by injective_plus_r, eq_f, sym_eq/
+qed-.
+
+lemma lifts_inv_lref2_uni_lt: ∀l,X,i. ⬆*[l] X ≡ #i → i < l → ⊥.
+#l #X #i2 #H elim (lifts_inv_lref2_uni … H) -H
+#i1 #_ #H1 #H2 destruct /2 width=4 by lt_le_false/
+qed-.
+
(* Basic forward lemmas *****************************************************)
(* Basic_2A1: includes: lift_inv_O2 *)
(* PLUS-ITERATED SUPCLOSURE *************************************************)
(* Properties with generic slicing for local environments *******************)
-
+(*
lemma fqup_drops_succ: ∀G,K,T,l,L,U. ⬇*[⫯l] L ≡ K → ⬆*[⫯l] T ≡ U →
⦃G, L, U⦄ ⊐+ ⦃G, K, T⦄.
#G #K #T #l elim l -l
| /3 width=5 by fqup_strap1, fqup_drops_succ/
]
qed-.
-
-lemma fqup_lref: ∀I,G,L,K,V,i. ⬇*[i] L ≡ K.ⓑ{I}V → ⦃G, L, #i⦄ ⊐+ ⦃G, K, V⦄.
-/2 width=6 by fqup_drops_strap1/ qed.
+*)
+axiom fqup_lref: ∀I,G,L,K,V,i. ⬇*[i] L ≡ K.ⓑ{I}V → ⦃G, L, #i⦄ ⊐+ ⦃G, K, V⦄.
+(* /2 width=6 by fqup_drops_strap1/ qed. *)
⦃G1, L1, T1⦄ ⊐* ⦃G2, L2, T2⦄.
/2 width=5 by tri_TC_strap/ qed-.
+(* Basic inversion lemmas ***************************************************)
+
+lemma fqus_inv_fqu_sn: ∀G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐* ⦃G2, L2, T2⦄ →
+ (∧∧ G1 = G2 & L1 = L2 & T1 = T2) ∨
+ ∃∃G,L,T. ⦃G1, L1, T1⦄ ⊐ ⦃G, L, T⦄ & ⦃G, L, T⦄ ⊐* ⦃G2, L2, T2⦄.
+#G1 #G2 #L1 #L2 #T1 #T2 #H12 @(fqus_ind_dx … H12) -G1 -L1 -T1 /3 width=1 by and3_intro, or_introl/
+#G1 #G #L1 #L #T1 #T * /3 width=5 by ex2_3_intro, or_intror/
+* #HG #HL #HT #_ destruct //
+qed-.
+
+lemma fqus_inv_atom1: ∀I,G1,G2,L2,T2. ⦃G1, ⋆, ⓪{I}⦄ ⊐* ⦃G2, L2, T2⦄ →
+ ∧∧ G1 = G2 & ⋆ = L2 & ⓪{I} = T2.
+#I #G1 #G2 #L2 #T2 #H elim (fqus_inv_fqu_sn … H) -H * /2 width=1 by and3_intro/
+#G #L #T #H elim (fqu_inv_atom1 … H)
+qed-.
+
+lemma fqus_inv_sort1: ∀I,G1,G2,L1,L2,V1,T2,s. ⦃G1, L1.ⓑ{I}V1, ⋆s⦄ ⊐* ⦃G2, L2, T2⦄ →
+ (∧∧ G1 = G2 & L1.ⓑ{I}V1 = L2 & ⋆s = T2) ∨ ⦃G1, L1, ⋆s⦄ ⊐* ⦃G2, L2, T2⦄.
+#I #G1 #G2 #L1 #L2 #V #T2 #s #H elim (fqus_inv_fqu_sn … H) -H * /3 width=1 by and3_intro, or_introl/
+#G #L #T #H elim (fqu_inv_sort1 … H) -H
+#H1 #H2 #H3 #H destruct /2 width=1 by or_intror/
+qed-.
+
+lemma fqus_inv_zero1: ∀I,G1,G2,L1,L2,V1,T2. ⦃G1, L1.ⓑ{I}V1, #0⦄ ⊐* ⦃G2, L2, T2⦄ →
+ (∧∧ G1 = G2 & L1.ⓑ{I}V1 = L2 & #0 = T2) ∨ ⦃G1, L1, V1⦄ ⊐* ⦃G2, L2, T2⦄.
+#I #G1 #G2 #L1 #L2 #V1 #T2 #H elim (fqus_inv_fqu_sn … H) -H * /3 width=1 by and3_intro, or_introl/
+#G #L #T #H elim (fqu_inv_zero1 … H) -H
+#H1 #H2 #H3 #H destruct /2 width=1 by or_intror/
+qed-.
+
+lemma fqus_inv_lref1: ∀I,G1,G2,L1,L2,V1,T2,i. ⦃G1, L1.ⓑ{I}V1, #⫯i⦄ ⊐* ⦃G2, L2, T2⦄ →
+ (∧∧ G1 = G2 & L1.ⓑ{I}V1 = L2 & #(⫯i) = T2) ∨ ⦃G1, L1, #i⦄ ⊐* ⦃G2, L2, T2⦄.
+#I #G1 #G2 #L1 #L2 #V #T2 #i #H elim (fqus_inv_fqu_sn … H) -H * /3 width=1 by and3_intro, or_introl/
+#G #L #T #H elim (fqu_inv_lref1 … H) -H
+#H1 #H2 #H3 #H destruct /2 width=1 by or_intror/
+qed-.
+
+lemma fqus_inv_gref1: ∀I,G1,G2,L1,L2,V1,T2,l. ⦃G1, L1.ⓑ{I}V1, §l⦄ ⊐* ⦃G2, L2, T2⦄ →
+ (∧∧ G1 = G2 & L1.ⓑ{I}V1 = L2 & §l = T2) ∨ ⦃G1, L1, §l⦄ ⊐* ⦃G2, L2, T2⦄.
+#I #G1 #G2 #L1 #L2 #V #T2 #l #H elim (fqus_inv_fqu_sn … H) -H * /3 width=1 by and3_intro, or_introl/
+#G #L #T #H elim (fqu_inv_gref1 … H) -H
+#H1 #H2 #H3 #H destruct /2 width=1 by or_intror/
+qed-.
+
+lemma fqus_inv_bind1: ∀p,I,G1,G2,L1,L2,V1,T1,T2. ⦃G1, L1, ⓑ{p,I}V1.T1⦄ ⊐* ⦃G2, L2, T2⦄ →
+ ∨∨ ∧∧ G1 = G2 & L1 = L2 & ⓑ{p,I}V1.T1 = T2
+ | ⦃G1, L1, V1⦄ ⊐* ⦃G2, L2, T2⦄
+ | ⦃G1, L1.ⓑ{I}V1, T1⦄ ⊐* ⦃G2, L2, T2⦄.
+#p #I #G1 #G2 #L1 #L2 #V1 #T1 #T2 #H elim (fqus_inv_fqu_sn … H) -H * /3 width=1 by and3_intro, or3_intro0/
+#G #L #T #H elim (fqu_inv_bind1 … H) -H *
+#H1 #H2 #H3 #H destruct /2 width=1 by or3_intro1, or3_intro2/
+qed-.
+
+lemma fqus_inv_flat1: ∀I,G1,G2,L1,L2,V1,T1,T2. ⦃G1, L1, ⓕ{I}V1.T1⦄ ⊐* ⦃G2, L2, T2⦄ →
+ ∨∨ ∧∧ G1 = G2 & L1 = L2 & ⓕ{I}V1.T1 = T2
+ | ⦃G1, L1, V1⦄ ⊐* ⦃G2, L2, T2⦄
+ | ⦃G1, L1, T1⦄ ⊐* ⦃G2, L2, T2⦄.
+#I #G1 #G2 #L1 #L2 #V1 #T1 #T2 #H elim (fqus_inv_fqu_sn … H) -H * /3 width=1 by and3_intro, or3_intro0/
+#G #L #T #H elim (fqu_inv_flat1 … H) -H *
+#H1 #H2 #H3 #H destruct /2 width=1 by or3_intro1, or3_intro2/
+qed-.
+
(* Basic_2A1: removed theorems 1: fqus_drop *)
(* STAR-ITERATED SUPCLOSURE *************************************************)
(* Properties with generic slicing for local environments *******************)
-
+(*
lemma fqus_drops: ∀G,L,K,T,U,l. ⬇*[l] L ≡ K → ⬆*[l] T ≡ U →
⦃G, L, U⦄ ⊐* ⦃G, K, T⦄.
#G #L #K #T #U * /3 width=3 by fqup_drops_succ, fqup_fqus/
#HLK #HTU <(lifts_fwd_isid … HTU) -U // <(drops_fwd_isid … HLK) -K //
qed.
+*)
\ No newline at end of file
#G1 #G2 #L1 #L2 #T1 #T2 #H @(fqus_ind … H) -L2 -T2
/3 width=3 by fquq_fwd_fw, transitive_le/
qed-.
+
+(* Advanced inversion lemmas ************************************************)
+
+lemma fqus_inv_refl_atom3: ∀I,G,L,X. ⦃G, L, ⓪{I}⦄ ⊐* ⦃G, L, X⦄ → ⓪{I} = X.
+#I #G #L #X #H elim (fqus_inv_fqu_sn … H) -H * //
+#G0 #L0 #T0 #H1 #H2 lapply (fqu_fwd_fw … H1) lapply (fqus_fwd_fw … H2) -H2 -H1
+#H2 #H1 lapply (le_to_lt_to_lt … H2 H1) -G0 -L0 -T0
+#H elim (lt_le_false … H) -H /2 width=1 by monotonic_le_plus_r/
+qed-.
(* SUPCLOSURE ***************************************************************)
(* activate genv *)
+(* Note: frees_total requires fqu_drop for all atoms *)
inductive fqu: tri_relation genv lenv term ≝
| fqu_lref_O : ∀I,G,L,V. fqu G (L.ⓑ{I}V) (#0) G L V
| fqu_pair_sn: ∀I,G,L,V,T. fqu G L (②{I}V.T) G L V
| fqu_bind_dx: ∀p,I,G,L,V,T. fqu G L (ⓑ{p,I}V.T) G (L.ⓑ{I}V) T
| fqu_flat_dx: ∀I,G,L,V,T. fqu G L (ⓕ{I}V.T) G L T
-| fqu_drop : ∀I,G,L,V,T,U. ⬆*[1] T ≡ U → fqu G (L.ⓑ{I}V) U G L T
+| fqu_drop : ∀I,I1,I2,G,L,V. ⬆*[1] ⓪{I2} ≡ ⓪{I1} →
+ fqu G (L.ⓑ{I}V) (⓪{I1}) G L (⓪{I2})
.
interpretation
lemma fqu_lref_S: ∀I,G,L,V,i. ⦃G, L.ⓑ{I}V, #(⫯i)⦄ ⊐ ⦃G, L, #(i)⦄.
/2 width=1 by fqu_drop/ qed.
+(* Basic inversion lemmas ***************************************************)
+
+fact fqu_inv_atom1_aux: ∀G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐ ⦃G2, L2, T2⦄ →
+ ∀I. L1 = ⋆ → T1 = ⓪{I} → ⊥.
+#G1 #G2 #L1 #L2 #T1 #T2 * -G1 -G2 -L1 -L2 -T1 -T2
+[ #I #G #L #T #J #H destruct
+| #I #G #L #V #T #J #_ #H destruct
+| #p #I #G #L #V #T #J #_ #H destruct
+| #I #G #L #V #T #J #_ #H destruct
+| #I #I1 #I2 #G #L #V #_ #J #H destruct
+]
+qed-.
+
+lemma fqu_inv_atom1: ∀I,G1,G2,L2,T2. ⦃G1, ⋆, ⓪{I}⦄ ⊐ ⦃G2, L2, T2⦄ → ⊥.
+/2 width=10 by fqu_inv_atom1_aux/ qed-.
+
+fact fqu_inv_sort1_aux: ∀G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐ ⦃G2, L2, T2⦄ →
+ ∀I,K,V,s. L1 = K.ⓑ{I}V → T1 = ⋆s →
+ ∧∧ G1 = G2 & L2 = K & T2 = ⋆s.
+#G1 #G2 #L1 #L2 #T1 #T2 * -G1 -G2 -L1 -L2 -T1 -T2
+[ #I #G #L #T #J #K #W #s #_ #H destruct
+| #I #G #L #V #T #J #K #W #s #_ #H destruct
+| #p #I #G #L #V #T #J #K #W #s #_ #H destruct
+| #I #G #L #V #T #J #K #W #s #_ #H destruct
+| #I #I1 #I2 #G #L #V #HI12 #J #K #W #s #H1 #H2 destruct
+ lapply (lifts_inv_sort2 … HI12) -HI12 /2 width=1 by and3_intro/
+]
+qed-.
+
+lemma fqu_inv_sort1: ∀I,G1,G2,K,L2,V,T2,s. ⦃G1, K.ⓑ{I}V, ⋆s⦄ ⊐ ⦃G2, L2, T2⦄ →
+ ∧∧ G1 = G2 & L2 = K & T2 = ⋆s.
+/2 width=7 by fqu_inv_sort1_aux/ qed-.
+
+fact fqu_inv_zero1_aux: ∀G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐ ⦃G2, L2, T2⦄ →
+ ∀I,K,V. L1 = K.ⓑ{I}V → T1 = #0 →
+ ∧∧ G1 = G2 & L2 = K & T2 = V.
+#G1 #G2 #L1 #L2 #T1 #T2 * -G1 -G2 -L1 -L2 -T1 -T2
+[ #I #G #L #T #J #K #W #H1 #H2 destruct /2 width=1 by and3_intro/
+| #I #G #L #V #T #J #K #W #_ #H destruct
+| #p #I #G #L #V #T #J #K #W #_ #H destruct
+| #I #G #L #V #T #J #K #W #_ #H destruct
+| #I #I1 #I2 #G #L #V #HI12 #J #K #W #H1 #H2 destruct
+ elim (lifts_inv_lref2_uni_lt … HI12) -HI12 //
+]
+qed-.
+
+lemma fqu_inv_zero1: ∀I,G1,G2,K,L2,V,T2. ⦃G1, K.ⓑ{I}V, #0⦄ ⊐ ⦃G2, L2, T2⦄ →
+ ∧∧ G1 = G2 & L2 = K & T2 = V.
+/2 width=9 by fqu_inv_zero1_aux/ qed-.
+
+fact fqu_inv_lref1_aux: ∀G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐ ⦃G2, L2, T2⦄ →
+ ∀I,K,V,i. L1 = K.ⓑ{I}V → T1 = #(⫯i) →
+ ∧∧ G1 = G2 & L2 = K & T2 = #i.
+#G1 #G2 #L1 #L2 #T1 #T2 * -G1 -G2 -L1 -L2 -T1 -T2
+[ #I #G #L #T #J #K #W #i #_ #H destruct
+| #I #G #L #V #T #J #K #W #i #_ #H destruct
+| #p #I #G #L #V #T #J #K #W #i #_ #H destruct
+| #I #G #L #V #T #J #K #W #i #_ #H destruct
+| #I #I1 #I2 #G #L #V #HI12 #J #K #W #i #H1 #H2 destruct
+ lapply (lifts_inv_lref2_uni_ge … HI12) -HI12 /2 width=1 by and3_intro/
+]
+qed-.
+
+lemma fqu_inv_lref1: ∀I,G1,G2,K,L2,V,T2,i. ⦃G1, K.ⓑ{I}V, #(⫯i)⦄ ⊐ ⦃G2, L2, T2⦄ →
+ ∧∧ G1 = G2 & L2 = K & T2 = #i.
+/2 width=9 by fqu_inv_lref1_aux/ qed-.
+
+fact fqu_inv_gref1_aux: ∀G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐ ⦃G2, L2, T2⦄ →
+ ∀I,K,V,l. L1 = K.ⓑ{I}V → T1 = §l →
+ ∧∧ G1 = G2 & L2 = K & T2 = §l.
+#G1 #G2 #L1 #L2 #T1 #T2 * -G1 -G2 -L1 -L2 -T1 -T2
+[ #I #G #L #T #J #K #W #l #_ #H destruct
+| #I #G #L #V #T #J #K #W #l #_ #H destruct
+| #p #I #G #L #V #T #J #K #W #l #_ #H destruct
+| #I #G #L #V #T #J #K #W #l #_ #H destruct
+| #I #I1 #I2 #G #L #V #HI12 #J #K #W #l #H1 #H2 destruct
+ lapply (lifts_inv_gref2 … HI12) -HI12 /2 width=1 by and3_intro/
+]
+qed-.
+
+lemma fqu_inv_gref1: ∀I,G1,G2,K,L2,V,T2,l. ⦃G1, K.ⓑ{I}V, §l⦄ ⊐ ⦃G2, L2, T2⦄ →
+ ∧∧ G1 = G2 & L2 = K & T2 = §l.
+/2 width=7 by fqu_inv_gref1_aux/ qed-.
+
+fact fqu_inv_bind1_aux: ∀G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐ ⦃G2, L2, T2⦄ →
+ ∀p,I,V1,U1. T1 = ⓑ{p,I}V1.U1 →
+ (∧∧ G1 = G2 & L1 = L2 & V1 = T2) ∨
+ (∧∧ G1 = G2 & L1.ⓑ{I}V1 = L2 & U1 = T2).
+#G1 #G2 #L1 #L2 #T1 #T2 * -G1 -G2 -L1 -L2 -T1 -T2
+[ #I #G #L #T #q #J #W #U #H destruct
+| #I #G #L #V #T #q #J #W #U #H destruct /3 width=1 by and3_intro, or_introl/
+| #p #I #G #L #V #T #q #J #W #U #H destruct /3 width=1 by and3_intro, or_intror/
+| #I #G #L #V #T #q #J #W #U #H destruct
+| #I #I1 #I2 #G #L #V #_ #q #J #W #U #H destruct
+]
+qed-.
+
+lemma fqu_inv_bind1: ∀p,I,G1,G2,L1,L2,V1,U1,T2. ⦃G1, L1, ⓑ{p,I}V1.U1⦄ ⊐ ⦃G2, L2, T2⦄ →
+ (∧∧ G1 = G2 & L1 = L2 & V1 = T2) ∨
+ (∧∧ G1 = G2 & L1.ⓑ{I}V1 = L2 & U1 = T2).
+/2 width=4 by fqu_inv_bind1_aux/ qed-.
+
+fact fqu_inv_flat1_aux: ∀G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐ ⦃G2, L2, T2⦄ →
+ ∀I,V1,U1. T1 = ⓕ{I}V1.U1 →
+ (∧∧ G1 = G2 & L1 = L2 & V1 = T2) ∨
+ (∧∧ G1 = G2 & L1 = L2 & U1 = T2).
+#G1 #G2 #L1 #L2 #T1 #T2 * -G1 -G2 -L1 -L2 -T1 -T2
+[ #I #G #L #T #J #W #U #H destruct
+| #I #G #L #V #T #J #W #U #H destruct /3 width=1 by and3_intro, or_introl/
+| #p #I #G #L #V #T #J #W #U #H destruct
+| #I #G #L #V #T #J #W #U #H destruct /3 width=1 by and3_intro, or_intror/
+| #I #I1 #I2 #G #L #V #_ #J #W #U #H destruct
+]
+qed-.
+
+lemma fqu_inv_flat1: ∀I,G1,G2,L1,L2,V1,U1,T2. ⦃G1, L1, ⓕ{I}V1.U1⦄ ⊐ ⦃G2, L2, T2⦄ →
+ (∧∧ G1 = G2 & L1 = L2 & V1 = T2) ∨
+ (∧∧ G1 = G2 & L1 = L2 & U1 = T2).
+/2 width=4 by fqu_inv_flat1_aux/ qed-.
+
(* Basic_2A1: removed theorems 3:
fqu_drop fqu_drop_lt fqu_lref_S_lt
*)
lemma fqu_fwd_fw: ∀G1,G2,L1,L2,T1,T2. ⦃G1, L1, T1⦄ ⊐ ⦃G2, L2, T2⦄ → ♯{G2, L2, T2} < ♯{G1, L1, T1}.
#G1 #G2 #L1 #L2 #T1 #T2 #H elim H -G1 -G2 -L1 -L2 -T1 -T2 //
-#I #G #L #V #T #U #HTU normalize in ⊢ (?%%); -I
-<(lifts_fwd_tw … HTU) -U /3 width=1 by monotonic_lt_plus_r, monotonic_lt_plus_l/
+#I #I1 #I2 #G #L #V #HI12 normalize in ⊢ (?%%); -I
+<(lifts_fwd_tw … HI12) -I1 /3 width=1 by monotonic_lt_plus_r, monotonic_lt_plus_l/
qed-.
(* Advanced eliminators *****************************************************)
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.cs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "basic_2/relocation/drops_weight.ma".
+include "basic_2/s_computation/fqus_weight.ma".
+include "basic_2/static/frees.ma".
+
+(* CONTEXT-SENSITIVE FREE VARIABLES *****************************************)
+
+(* Properties with star-iterated supclosure *********************************)
+
+lemma frees_fqus_drops: ∀f1,G,L1,T1. L1 ⊢ 𝐅*⦃T1⦄ ≡ f1 →
+ ∀L2,T2. ⦃G, L1, T1⦄ ⊐* ⦃G, L2, T2⦄ →
+ ∀I,n. ⬇*[n] L1 ≡ L2.ⓑ{I}T2 →
+ ∃∃f2. L2 ⊢ 𝐅*⦃T2⦄ ≡ f2 & f2 ⊆ ⫱*[⫯n] f1.
+#f1 #G #L1 #T1 #H elim H -f1 -L1 -T1
+[ #f1 #J #Hf1 #L2 #T2 #H12 #I #n #HL12
+ elim (fqus_inv_atom1 … H12) -H12 #H1 #H2 #H3 destruct
+ lapply (drops_fwd_lw … HL12) -HL12 #HL12
+ elim (lt_le_false … HL12) -HL12 //
+| #f1 #J #L1 #V1 #s #Hf1 #IH #L2 #T2 #H12
+ elim (fqus_inv_sort1 … H12) -H12 [ * | #H12 #I * ]
+ [ -IH -Hf1 #H1 #H2 #H3 #I #n #HL12 destruct
+ lapply (drops_fwd_lw … HL12) -HL12 #HL12
+ elim (lt_le_false … HL12) -HL12 //
+ | -IH #HL12 lapply (drops_fwd_isid … HL12 ?) -HL12 //
+ #H destruct <(fqus_inv_refl_atom3 … H12) -H12 /2 width=3 by sle_refl, ex2_intro/
+ | -Hf1 #I #HL12 lapply (drops_inv_drop1 … HL12) -HL12
+ #HL12 elim (IH … H12 … HL12) -IH -H12 -HL12 /3 width=3 by ex2_intro/
+ ]
+| #f1 #J #L1 #V1 #Hf1 #IH #L2 #T2 #H12
+ elim (fqus_inv_zero1 … H12) -H12 [ * | #H12 #I * ]
+ [ -IH -Hf1 #H1 #H2 #H3 #I #n #HL12 destruct
+ lapply (drops_fwd_lw … HL12) -HL12 #HL12
+ elim (lt_le_false … HL12) -HL12 //
+ | -IH -H12 #HL12 lapply (drops_fwd_isid … HL12 ?) -HL12 //
+ #H destruct /3 width=3 by sle_refl, ex2_intro/
+ | -Hf1 #n #HL12 lapply (drops_inv_drop1 … HL12) -HL12
+ #HL12 elim (IH … H12 … HL12) -IH -H12 -HL12 /3 width=3 by ex2_intro/
+ ]
+| #f1 #J #L1 #V1 #i #Hf1 #IH #L2 #T2 #H12
+ elim (fqus_inv_lref1 … H12) -H12 [ * | #H12 #I * ]
+ [ -IH -Hf1 #H1 #H2 #H3 #I #n #HL12 destruct
+ lapply (drops_fwd_lw … HL12) -HL12 #HL12
+ elim (lt_le_false … HL12) -HL12 //
+ | -IH #HL12 lapply (drops_fwd_isid … HL12 ?) -HL12 //
+ #H destruct <(fqus_inv_refl_atom3 … H12) -H12 /2 width=3 by sle_refl, ex2_intro/
+ | -Hf1 #I #HL12 lapply (drops_inv_drop1 … HL12) -HL12
+ #HL12 elim (IH … H12 … HL12) -IH -H12 -HL12 /3 width=3 by ex2_intro/
+ ]
+| #f1 #J #L1 #V1 #l #Hf1 #IH #L2 #T2 #H12
+ elim (fqus_inv_gref1 … H12) -H12 [ * | #H12 #I * ]
+ [ -IH -Hf1 #H1 #H2 #H3 #I #n #HL12 destruct
+ lapply (drops_fwd_lw … HL12) -HL12 #HL12
+ elim (lt_le_false … HL12) -HL12 //
+ | -IH #HL12 lapply (drops_fwd_isid … HL12 ?) -HL12 //
+ #H destruct <(fqus_inv_refl_atom3 … H12) -H12 /2 width=3 by sle_refl, ex2_intro/
+ | -Hf1 #I #HL12 lapply (drops_inv_drop1 … HL12) -HL12
+ #HL12 elim (IH … H12 … HL12) -IH -H12 -HL12 /3 width=3 by ex2_intro/
+ ]
+| #f1V #f1T #f1 #p #J #L1 #V #T #_ #_ #Hf1 #IHV #IHT #L2 #T2 #H12 #I #n #HL12
+ elim (fqus_inv_bind1 … H12) -H12 [ * |*: #H12 ]
+ [ -IHV -IHT -Hf1 #H1 #H2 #H3 destruct
+ lapply (drops_fwd_lw … HL12) -HL12 #HL12
+ elim (lt_le_false … HL12) -HL12 //
+ | -IHT elim (IHV … H12 … HL12) -IHV -H12 -HL12
+ /4 width=6 by sor_tls, sor_sle_sn, ex2_intro/
+ | -IHV elim (IHT … H12 I (⫯n)) -IHT -H12 /2 width=1 by drops_drop/ -HL12
+ <tls_xn /4 width=6 by ex2_intro, sor_tls, sor_sle_dx/
+ ]
+| #f1V #f1T #f1 #J #L1 #V #T #_ #_ #Hf1 #IHV #IHT #L2 #T2 #H12 #I #n #HL12
+ elim (fqus_inv_flat1 … H12) -H12 [ * |*: #H12 ]
+ [ -IHV -IHT -Hf1 #H1 #H2 #H3 destruct
+ lapply (drops_fwd_lw … HL12) -HL12 #HL12
+ elim (lt_le_false … HL12) -HL12 //
+ | -IHT elim (IHV … H12 … HL12) -IHV -H12 -HL12
+ /4 width=6 by sor_tls, sor_sle_sn, ex2_intro/
+ | -IHV elim (IHT … H12 … HL12) -IHT -H12 -HL12
+ /4 width=6 by ex2_intro, sor_tls, sor_sle_dx/
+ ]
+]
+qed-.
#R1 #R2 #HR #L1 #L2 #T * /4 width=7 by lexs_co, ex2_intro/
qed-.
-lemma pippo: ∀R1,R2,RP1,RP2. R_confluent_lfxs R1 R2 RP1 RP2 →
- lexs_confluent R1 R2 RP1 cfull RP2 cfull.
-#R1 #R2 #RP1 #RP2 #HR #f #L0 #T0 #T1 #HT01 #T2 #HT02 #L1 #HL01 #L2 #HL02
-
(* Basic inversion lemmas ***************************************************)
lemma lfxs_inv_atom_sn: ∀R,I,Y2. ⋆ ⦻*[R, ⓪{I}] Y2 → Y2 = ⋆.
}
]
[ { "context-sensitive free variables" * } {
- [ "frees ( ? ⊢ 𝐅*⦃?⦄ ≡ ? )" "frees_weight" + "frees_lreq" + "frees_drops" + "frees_frees" * ]
+ [ "frees ( ? ⊢ 𝐅*⦃?⦄ ≡ ? )" "frees_weight" + "frees_lreq" + "frees_drops" + "frees_fqup" + "frees_fqus" + "frees_frees" * ]
}
]
}
interpretation "inclusion (rtmap)"
'subseteq t1 t2 = (sle t1 t2).
+(* Basic properties *********************************************************)
+
+corec lemma sle_refl: ∀f. f ⊆ f.
+#f cases (pn_split f) * #g #H
+[ @(sle_push … H H) | @(sle_next … H H) ] -H //
+qed.
+
(* Basic inversion lemmas ***************************************************)
lemma sle_inv_xp: ∀g1,g2. g1 ⊆ g2 → ∀f2. ↑f2 = g2 →
#x2 #H #Hx2 destruct lapply (injective_next … Hx2) -Hx2 //
qed-.
-(* properties on isid *******************************************************)
+lemma sle_inv_px: ∀g1,g2. g1 ⊆ g2 → ∀f1. ↑f1 = g1 →
+ (∃∃f2. f1 ⊆ f2 & ↑f2 = g2) ∨ ∃∃f2. f1 ⊆ f2 & ⫯f2 = g2.
+#g1 #g2 elim (pn_split g2) * #f2 #H2 #H #f1 #H1
+[ lapply (sle_inv_pp … H … H1 H2) | lapply (sle_inv_pn … H … H1 H2) ] -H -H1
+/3 width=3 by ex2_intro, or_introl, or_intror/
+qed-.
+
+(* Main properties **********************************************************)
+
+corec theorem sle_trans: Transitive … sle.
+#f1 #f * -f1 -f
+#f1 #f #g1 #g #Hf #H1 #H #g2 #H0
+[ cases (sle_inv_px … H0 … H) * |*: cases (sle_inv_nx … H0 … H) ] -g
+/3 width=5 by sle_push, sle_next, sle_weak/
+qed-.
+
+(* Properties with tail *****************************************************)
+
+lemma sle_px_tl: ∀g1,g2. g1 ⊆ g2 → ∀f1. ↑f1 = g1 → f1 ⊆ ⫱g2.
+#g1 #g2 #H #f1 #H1 elim (sle_inv_px … H … H1) -H -H1 * //
+qed.
+
+(* Inversion lemmas with tail ***********************************************)
+
+lemma sle_inv_tl_sn: ∀f1,f2. ⫱f1 ⊆ f2 → f1 ⊆ ⫯f2.
+#f1 elim (pn_split f1) * #g1 #H destruct
+/2 width=5 by sle_next, sle_weak/
+qed-.
+
+lemma sle_inv_tl_dx: ∀f1,f2. f1 ⊆ ⫱f2 → ↑f1 ⊆ f2.
+#f1 #f2 elim (pn_split f2) * #g2 #H destruct
+/2 width=5 by sle_push, sle_weak/
+qed-.
+
+(* Properties with isid *****************************************************)
corec lemma sle_isid_sn: ∀f1. 𝐈⦃f1⦄ → ∀f2. f1 ⊆ f2.
#f1 * -f1
/3 width=5 by sle_weak, sle_push/
qed.
-(* inversion lemmas on isid *************************************************)
+(* Inversion lemmas with isid ***********************************************)
corec lemma sle_inv_isid_dx: ∀f1,f2. f1 ⊆ f2 → 𝐈⦃f2⦄ → 𝐈⦃f1⦄.
#f1 #f2 * -f1 -f2
[ @sor_pp | @sor_pn | @sor_np | @sor_nn ] /2 width=7 by/
qed-.
-(* Properies on test for identity *******************************************)
+(* Properties with tail *****************************************************)
+
+lemma sor_tl: ∀f1,f2,f. f1 ⋓ f2 ≡ f → ⫱f1 ⋓ ⫱f2 ≡ ⫱f.
+#f1 cases (pn_split f1) * #g1 #H1
+#f2 cases (pn_split f2) * #g2 #H2
+#f #Hf
+[ cases (sor_inv_ppx … Hf … H1 H2)
+| cases (sor_inv_pnx … Hf … H1 H2)
+| cases (sor_inv_npx … Hf … H1 H2)
+| cases (sor_inv_nnx … Hf … H1 H2)
+] -Hf #g #Hg #H destruct //
+qed.
+
+(* Properties with iterated tail ********************************************)
+
+lemma sor_tls: ∀f1,f2,f. f1 ⋓ f2 ≡ f →
+ ∀n. ⫱*[n]f1 ⋓ ⫱*[n]f2 ≡ ⫱*[n]f.
+#f1 #f2 #f #Hf #n elim n -n /2 width=1 by sor_tl/
+qed.
+
+(* Properies with test for identity *****************************************)
corec lemma sor_isid_sn: ∀f1. 𝐈⦃f1⦄ → ∀f2. f1 ⋓ f2 ≡ f2.
#f1 * -f1
lemma sor_isid: ∀f1,f2,f. 𝐈⦃f1⦄ → 𝐈⦃f2⦄ → 𝐈⦃f⦄ → f1 ⋓ f2 ≡ f.
/4 width=3 by sor_eq_repl_back2, sor_eq_repl_back1, isid_inv_eq_repl/ qed.
-(* Inversion lemmas on test for identity ************************************)
+(* Inversion lemmas with test for identity **********************************)
lemma sor_isid_inv_sn: ∀f1,f2,f. f1 ⋓ f2 ≡ f → 𝐈⦃f1⦄ → f2 ≗ f.
/3 width=4 by sor_isid_sn, sor_mono/
lemma sor_inv_isid3: ∀f1,f2,f. f1 ⋓ f2 ≡ f → 𝐈⦃f⦄ → 𝐈⦃f1⦄ ∧ 𝐈⦃f2⦄.
/3 width=4 by sor_fwd_isid2, sor_fwd_isid1, conj/ qed-.
-(* Properties on finite colength assignment *********************************)
+(* Properties with finite colength assignment *******************************)
lemma sor_fcla_ex: ∀f1,n1. 𝐂⦃f1⦄ ≡ n1 → ∀f2,n2. 𝐂⦃f2⦄ ≡ n2 →
∃∃f,n. f1 ⋓ f2 ≡ f & 𝐂⦃f⦄ ≡ n & (n1 ∨ n2) ≤ n & n ≤ n1 + n2.
∃∃n2. 𝐂⦃f2⦄ ≡ n2 & n2 ≤ n.
/3 width=4 by sor_fwd_fcla_sn_ex, sor_sym/ qed-.
-(* Properties on test for finite colength ***********************************)
+(* Properties with test for finite colength *********************************)
lemma sor_isfin_ex: ∀f1,f2. 𝐅⦃f1⦄ → 𝐅⦃f2⦄ → ∃∃f. f1 ⋓ f2 ≡ f & 𝐅⦃f⦄.
#f1 #f2 * #n1 #H1 * #n2 #H2 elim (sor_fcla_ex … H1 … H2) -H1 -H2
lemma sor_inv_isfin3: ∀f1,f2,f. f1 ⋓ f2 ≡ f → 𝐅⦃f⦄ → 𝐅⦃f1⦄ ∧ 𝐅⦃f2⦄.
/3 width=4 by sor_fwd_isfin_dx, sor_fwd_isfin_sn, conj/ qed-.
-(* Inversion lemmas on inclusion ********************************************)
+(* Inversion lemmas with inclusion ******************************************)
corec lemma sor_inv_sle_sn: ∀f1,f2,f. f1 ⋓ f2 ≡ f → f1 ⊆ f.
#f1 #f2 #f * -f1 -f2 -f
#f1 #f2 #f #g1 #g2 #g #Hf #H1 #H2 #H0
/3 width=5 by sle_push, sle_next, sle_weak/
qed-.
+
+(* Properties with inclusion ************************************************)
+
+lemma sor_sle_sn: ∀f1,f2,f. f1 ⋓ f2 ≡ f → ∀g. g ⊆ f1 → g ⊆ f.
+/3 width=4 by sor_inv_sle_sn, sle_trans/ qed.
+
+lemma sor_sle_dx: ∀f1,f2,f. f1 ⋓ f2 ≡ f → ∀g. g ⊆ f2 → g ⊆ f.
+/3 width=4 by sor_inv_sle_dx, sle_trans/ qed.