- basic_2: first commit for lexs ...
--- /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 *)
+(* *)
+(**************************************************************************)
+
+(* NOTATION FOR THE FORMAL SYSTEM λδ ****************************************)
+
+notation "hvbox( L1 ⦻ * break [ term 46 R , break term 46 f ] break term 46 L2 )"
+ non associative with precedence 45
+ for @{ 'RelationStar $R $f $L1 $L2 }.
--- /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 "ground_2/relocation/nstream_sle.ma".
+include "basic_2/notation/relations/relationstar_4.ma".
+include "basic_2/grammar/lenv.ma".
+
+(* GENERAL ENTRYWISE EXTENSION OF A CONTEXT-SENSITIVE REALTION FOR TERMS ****)
+
+(* Basic_2A1: includes: lpx_sn_atom lpx_sn_pair *)
+inductive lexs (R:relation4 bool lenv term term): rtmap → relation lenv ≝
+| lexs_atom: ∀f. lexs R f (⋆) (⋆)
+| lexs_next: ∀I,L1,L2,V1,V2,f.
+ lexs R f L1 L2 → R (Ⓣ) L1 V1 V2 →
+ lexs R (⫯f) (L1.ⓑ{I}V1) (L2.ⓑ{I}V2)
+| lexs_push: ∀I,L1,L2,V1,V2,f.
+ lexs R f L1 L2 → R (Ⓕ) L1 V1 V2 →
+ lexs R (↑f) (L1.ⓑ{I}V1) (L2.ⓑ{I}V2)
+.
+
+interpretation "general entrywise extension (local environment)"
+ 'RelationStar R f L1 L2 = (lexs R f L1 L2).
+
+(* Basic inversion lemmas ***************************************************)
+
+fact lexs_inv_atom1_aux: ∀R,X,Y,f. X ⦻*[R, f] Y → X = ⋆ → Y = ⋆.
+#R #X #Y #f * -X -Y -f //
+#I #L1 #L2 #V1 #V2 #f #_ #_ #H destruct
+qed-.
+
+(* Basic_2A1: includes lpx_sn_inv_atom1 *)
+lemma lexs_inv_atom1: ∀R,Y,f. ⋆ ⦻*[R, f] Y → Y = ⋆.
+/2 width=6 by lexs_inv_atom1_aux/ qed-.
+
+fact lexs_inv_next1_aux: ∀R,X,Y,f. X ⦻*[R, f] Y → ∀J,K1,W1,g. X = K1.ⓑ{J}W1 → f = ⫯g →
+ ∃∃K2,W2. K1 ⦻*[R, g] K2 & R (Ⓣ) K1 W1 W2 & Y = K2.ⓑ{J}W2.
+#R #X #Y #f * -X -Y -f
+[ #f #J #K1 #W1 #g #H destruct
+| #I #L1 #L2 #V1 #V2 #f #HL #HS #J #K1 #W1 #g #H1 #H2 <(injective_next … H2) -g destruct
+ /2 width=5 by ex3_2_intro/
+| #I #L1 #L2 #V1 #V2 #f #_ #_ #J #K1 #W1 #g #_ #H elim (discr_push_next … H)
+]
+qed-.
+
+(* Basic_2A1: includes lpx_sn_inv_pair1 *)
+lemma lexs_inv_next1: ∀R,J,K1,Y,W1,g. K1.ⓑ{J}W1 ⦻*[R, ⫯g] Y →
+ ∃∃K2,W2. K1 ⦻*[R, g] K2 & R (Ⓣ) K1 W1 W2 & Y = K2.ⓑ{J}W2.
+/2 width=7 by lexs_inv_next1_aux/ qed-.
+
+
+fact lexs_inv_push1_aux: ∀R,X,Y,f. X ⦻*[R, f] Y → ∀J,K1,W1,g. X = K1.ⓑ{J}W1 → f = ↑g →
+ ∃∃K2,W2. K1 ⦻*[R, g] K2 & R (Ⓕ) K1 W1 W2 & Y = K2.ⓑ{J}W2.
+#R #X #Y #f * -X -Y -f
+[ #f #J #K1 #W1 #g #H destruct
+| #I #L1 #L2 #V1 #V2 #f #_ #_ #J #K1 #W1 #g #_ #H elim (discr_next_push … H)
+| #I #L1 #L2 #V1 #V2 #f #HL #HO #J #K1 #W1 #g #H1 #H2 <(injective_push … H2) -g destruct
+ /2 width=5 by ex3_2_intro/
+]
+qed-.
+
+lemma lexs_inv_push1: ∀R,J,K1,Y,W1,g. K1.ⓑ{J}W1 ⦻*[R, ↑g] Y →
+ ∃∃K2,W2. K1 ⦻*[R, g] K2 & R (Ⓕ) K1 W1 W2 & Y = K2.ⓑ{J}W2.
+/2 width=7 by lexs_inv_push1_aux/ qed-.
+
+fact lexs_inv_atom2_aux: ∀R,X,Y,f. X ⦻*[R, f] Y → Y = ⋆ → X = ⋆.
+#R #X #Y #f * -X -Y -f //
+#I #L1 #L2 #V1 #V2 #f #_ #_ #H destruct
+qed-.
+
+(* Basic_2A1: includes lpx_sn_inv_atom2 *)
+lemma lexs_inv_atom2: ∀R,X,f. X ⦻*[R, f] ⋆ → X = ⋆.
+/2 width=6 by lexs_inv_atom2_aux/ qed-.
+
+fact lexs_inv_next2_aux: ∀R,X,Y,f. X ⦻*[R, f] Y → ∀J,K2,W2,g. Y = K2.ⓑ{J}W2 → f = ⫯g →
+ ∃∃K1,W1. K1 ⦻*[R, g] K2 & R (Ⓣ) K1 W1 W2 & X = K1.ⓑ{J}W1.
+#R #X #Y #f * -X -Y -f
+[ #f #J #K2 #W2 #g #H destruct
+| #I #L1 #L2 #V1 #V2 #f #HL #HS #J #K2 #W2 #g #H1 #H2 <(injective_next … H2) -g destruct
+ /2 width=5 by ex3_2_intro/
+| #I #L1 #L2 #V1 #V2 #f #_ #_ #J #K2 #W2 #g #_ #H elim (discr_push_next … H)
+]
+qed-.
+
+(* Basic_2A1: includes lpx_sn_inv_pair2 *)
+lemma lexs_inv_next2: ∀R,J,X,K2,W2,g. X ⦻*[R, ⫯g] K2.ⓑ{J}W2 →
+ ∃∃K1,W1. K1 ⦻*[R, g] K2 & R (Ⓣ) K1 W1 W2 & X = K1.ⓑ{J}W1.
+/2 width=7 by lexs_inv_next2_aux/ qed-.
+
+fact lexs_inv_push2_aux: ∀R,X,Y,f. X ⦻*[R, f] Y → ∀J,K2,W2,g. Y = K2.ⓑ{J}W2 → f = ↑g →
+ ∃∃K1,W1. K1 ⦻*[R, g] K2 & R (Ⓕ) K1 W1 W2 & X = K1.ⓑ{J}W1.
+#R #X #Y #f * -X -Y -f
+[ #f #J #K2 #W2 #g #H destruct
+| #I #L1 #L2 #V1 #V2 #f #_ #_ #J #K2 #W2 #g #_ #H elim (discr_next_push … H)
+| #I #L1 #L2 #V1 #V2 #f #HL #HO #J #K2 #W2 #g #H1 #H2 <(injective_push … H2) -g destruct
+ /2 width=5 by ex3_2_intro/
+]
+qed-.
+
+lemma lexs_inv_push2: ∀R,J,X,K2,W2,g. X ⦻*[R, ↑g] K2.ⓑ{J}W2 →
+ ∃∃K1,W1. K1 ⦻*[R, g] K2 & R (Ⓕ) K1 W1 W2 & X = K1.ⓑ{J}W1.
+/2 width=7 by lexs_inv_push2_aux/ qed-.
+
+(* Basic_2A1: includes lpx_sn_inv_pair *)
+lemma lexs_inv_next: ∀R,I1,I2,L1,L2,V1,V2,f.
+ L1.ⓑ{I1}V1 ⦻*[R, ⫯f] (L2.ⓑ{I2}V2) →
+ ∧∧ L1 ⦻*[R, f] L2 & R (Ⓣ) L1 V1 V2 & I1 = I2.
+#R #I1 #I2 #L1 #L2 #V1 #V2 #f #H elim (lexs_inv_next1 … H) -H
+#L0 #V0 #HL10 #HV10 #H destruct /2 width=1 by and3_intro/
+qed-.
+
+lemma lexs_inv_push: ∀R,I1,I2,L1,L2,V1,V2,f.
+ L1.ⓑ{I1}V1 ⦻*[R, ↑f] (L2.ⓑ{I2}V2) →
+ ∧∧ L1 ⦻*[R, f] L2 & R (Ⓕ) L1 V1 V2 & I1 = I2.
+#R #I1 #I2 #L1 #L2 #V1 #V2 #f #H elim (lexs_inv_push1 … H) -H
+#L0 #V0 #HL10 #HV10 #H destruct /2 width=1 by and3_intro/
+qed-.
+
+(* Basic properties *********************************************************)
+
+lemma lexs_eq_repl_back: ∀R,L1,L2. eq_stream_repl_back … (λf. L1 ⦻*[R, f] L2).
+#R #L1 #L2 #f1 #H elim H -L1 -L2 -f1 //
+[ #I #L1 #L2 #V1 #v2 #f1 #_ #HS #IH #f2 #H elim (next_inv_sn … H) -H /3 width=1 by lexs_next/
+| #I #L1 #L2 #V1 #v2 #f1 #_ #HO #IH #f2 #H elim (push_inv_sn … H) -H /3 width=1 by lexs_push/
+]
+qed-.
+
+lemma lexs_eq_repl_fwd: ∀R,L1,L2. eq_stream_repl_fwd … (λf. L1 ⦻*[R, f] L2).
+#R #L1 #L2 @eq_stream_repl_sym /2 width=3 by lexs_eq_repl_back/ (**) (* full auto fails *)
+qed-.
+
+(* Basic_2A1: includes: lpx_sn_refl *)
+lemma lexs_refl: ∀R,f.
+ (∀b,L. reflexive … (R b L)) →
+ reflexive … (lexs R f).
+#R #f #HR #L generalize in match f; -f elim L -L //
+#L #I #V #IH * * /2 width=1 by lexs_next, lexs_push/
+qed.
+
+lemma sle_lexs_trans: ∀R. (∀L,T1,T2. R (Ⓣ) L T1 T2 → R (Ⓕ) L T1 T2) →
+ ∀L1,L2,f2. L1 ⦻*[R, f2] L2 →
+ ∀f1. f1 ⊆ f2 → L1 ⦻*[R, f1] L2.
+#R #HR #L1 #L2 #f2 #H elim H -L1 -L2 -f2 //
+#I #L1 #L2 #V1 #V2 #f2 #_ #HV12 #IH
+[ * * [2: #n1 ] ] #f1 #H
+[ /4 width=5 by lexs_next, sle_inv_SS_aux/
+| /4 width=5 by lexs_push, sle_inv_OS_aux/
+| elim (sle_inv_xO_aux … H) -H [3: // |2: skip ]
+ #g1 #H #H1 destruct /3 width=5 by lexs_push/
+]
+qed-.
+
+lemma sle_lexs_conf: ∀R. (∀L,T1,T2. R (Ⓕ) L T1 T2 → R (Ⓣ) L T1 T2) →
+ ∀L1,L2,f1. L1 ⦻*[R, f1] L2 →
+ ∀f2. f1 ⊆ f2 → L1 ⦻*[R, f2] L2.
+#R #HR #L1 #L2 #f2 #H elim H -L1 -L2 -f2 //
+#I #L1 #L2 #V1 #V2 #f1 #_ #HV12 #IH
+[2: * * [2: #n2 ] ] #f2 #H
+[ /4 width=5 by lexs_next, sle_inv_OS_aux/
+| /4 width=5 by lexs_push, sle_inv_OO_aux/
+| elim (sle_inv_Sx_aux … H) -H [3: // |2: skip ]
+ #g2 #H #H2 destruct /3 width=5 by lexs_next/
+]
+qed-.
+
+lemma lexs_co: ∀R1,R2.
+ (∀b,L1,T1,T2. R1 b L1 T1 T2 → R2 b L1 T1 T2) →
+ ∀L1,L2,f. L1 ⦻*[R1, f] L2 → L1 ⦻*[R2, f] L2.
+#R1 #R2 #HR #L1 #L2 #f #H elim H -L1 -L2 -f
+/3 width=1 by lexs_atom, lexs_next, lexs_push/
+qed-.
+
+(* Basic_2A1: removed theorems 17:
+ llpx_sn_inv_bind llpx_sn_inv_flat
+ llpx_sn_fwd_lref llpx_sn_fwd_pair_sn llpx_sn_fwd_length
+ llpx_sn_fwd_bind_sn llpx_sn_fwd_bind_dx llpx_sn_fwd_flat_sn llpx_sn_fwd_flat_dx
+ llpx_sn_refl llpx_sn_Y llpx_sn_bind_O llpx_sn_ge_up llpx_sn_ge llpx_sn_co
+ llpx_sn_fwd_drop_sn llpx_sn_fwd_drop_dx
+*)
--- /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/grammar/lenv_length.ma".
+include "basic_2/relocation/lexs.ma".
+
+(* GENERAL ENTRYWISE EXTENSION OF A CONTEXT-SENSITIVE REALTION FOR TERMS ****)
+
+(* Forward lemmas on length for local environments **************************)
+
+(* Basic_2A1: includes: lpx_sn_fwd_length *)
+lemma lexs_fwd_length: ∀R,L1,L2,f. L1 ⦻*[R, f] L2 → |L1| = |L2|.
+#R #L1 #L2 #f #H elim H -L1 -L2 -f //
+qed-.
+++ /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 "ground_2/relocation/nstream_sle.ma".
-include "basic_2/notation/relations/relationstar_5.ma".
-include "basic_2/grammar/lenv.ma".
-
-(* GENERAL ENTRYWISE EXTENSION OF A CONTEXT-SENSITIVE REALTION FOR TERMS ****)
-
-(* Basic_2A1: includes: lpx_sn_atom lpx_sn_pair *)
-inductive lexs (RS,RO:relation3 lenv term term): rtmap → relation lenv ≝
-| lexs_atom: ∀f. lexs RS RO f (⋆) (⋆)
-| lexs_next: ∀I,L1,L2,V1,V2,f.
- lexs RS RO f L1 L2 → RS L1 V1 V2 →
- lexs RS RO (⫯f) (L1.ⓑ{I}V1) (L2.ⓑ{I}V2)
-| lexs_push: ∀I,L1,L2,V1,V2,f.
- lexs RS RO f L1 L2 → RO L1 V1 V2 →
- lexs RS RO (↑f) (L1.ⓑ{I}V1) (L2.ⓑ{I}V2)
-.
-
-interpretation "general entrywise extension (local environment)"
- 'RelationStar RS RO f L1 L2 = (lexs RS RO f L1 L2).
-
-(* Basic inversion lemmas ***************************************************)
-
-fact lexs_inv_atom1_aux: ∀RS,RO,X,Y,f. X ⦻*[RS, RO, f] Y → X = ⋆ → Y = ⋆.
-#RS #RO #X #Y #f * -X -Y -f //
-#I #L1 #L2 #V1 #V2 #f #_ #_ #H destruct
-qed-.
-
-(* Basic_2A1: includes lpx_sn_inv_atom1 *)
-lemma lexs_inv_atom1: ∀RS,RO,Y,f. ⋆ ⦻*[RS, RO, f] Y → Y = ⋆.
-/2 width=6 by lexs_inv_atom1_aux/ qed-.
-
-fact lexs_inv_next1_aux: ∀RS,RO,X,Y,f. X ⦻*[RS, RO, f] Y → ∀J,K1,W1,g. X = K1.ⓑ{J}W1 → f = ⫯g →
- ∃∃K2,W2. K1 ⦻*[RS, RO, g] K2 & RS K1 W1 W2 & Y = K2.ⓑ{J}W2.
-#RS #RO #X #Y #f * -X -Y -f
-[ #f #J #K1 #W1 #g #H destruct
-| #I #L1 #L2 #V1 #V2 #f #HL #HS #J #K1 #W1 #g #H1 #H2 <(injective_next … H2) -g destruct
- /2 width=5 by ex3_2_intro/
-| #I #L1 #L2 #V1 #V2 #f #_ #_ #J #K1 #W1 #g #_ #H elim (discr_push_next … H)
-]
-qed-.
-
-(* Basic_2A1: includes lpx_sn_inv_pair1 *)
-lemma lexs_inv_next1: ∀RS,RO,J,K1,Y,W1,g. K1.ⓑ{J}W1 ⦻*[RS, RO, ⫯g] Y →
- ∃∃K2,W2. K1 ⦻*[RS, RO, g] K2 & RS K1 W1 W2 & Y = K2.ⓑ{J}W2.
-/2 width=7 by lexs_inv_next1_aux/ qed-.
-
-
-fact lexs_inv_push1_aux: ∀RS,RO,X,Y,f. X ⦻*[RS, RO, f] Y → ∀J,K1,W1,g. X = K1.ⓑ{J}W1 → f = ↑g →
- ∃∃K2,W2. K1 ⦻*[RS, RO, g] K2 & RO K1 W1 W2 & Y = K2.ⓑ{J}W2.
-#RS #RO #X #Y #f * -X -Y -f
-[ #f #J #K1 #W1 #g #H destruct
-| #I #L1 #L2 #V1 #V2 #f #_ #_ #J #K1 #W1 #g #_ #H elim (discr_next_push … H)
-| #I #L1 #L2 #V1 #V2 #f #HL #HO #J #K1 #W1 #g #H1 #H2 <(injective_push … H2) -g destruct
- /2 width=5 by ex3_2_intro/
-]
-qed-.
-
-lemma lexs_inv_push1: ∀RS,RO,J,K1,Y,W1,g. K1.ⓑ{J}W1 ⦻*[RS, RO, ↑g] Y →
- ∃∃K2,W2. K1 ⦻*[RS, RO, g] K2 & RO K1 W1 W2 & Y = K2.ⓑ{J}W2.
-/2 width=7 by lexs_inv_push1_aux/ qed-.
-
-fact lexs_inv_atom2_aux: ∀RS,RO,X,Y,f. X ⦻*[RS, RO, f] Y → Y = ⋆ → X = ⋆.
-#RS #RO #X #Y #f * -X -Y -f //
-#I #L1 #L2 #V1 #V2 #f #_ #_ #H destruct
-qed-.
-
-(* Basic_2A1: includes lpx_sn_inv_atom2 *)
-lemma lexs_inv_atom2: ∀RS,RO,X,f. X ⦻*[RS, RO, f] ⋆ → X = ⋆.
-/2 width=6 by lexs_inv_atom2_aux/ qed-.
-
-fact lexs_inv_next2_aux: ∀RS,RO,X,Y,f. X ⦻*[RS, RO, f] Y → ∀J,K2,W2,g. Y = K2.ⓑ{J}W2 → f = ⫯g →
- ∃∃K1,W1. K1 ⦻*[RS, RO, g] K2 & RS K1 W1 W2 & X = K1.ⓑ{J}W1.
-#RS #RO #X #Y #f * -X -Y -f
-[ #f #J #K2 #W2 #g #H destruct
-| #I #L1 #L2 #V1 #V2 #f #HL #HS #J #K2 #W2 #g #H1 #H2 <(injective_next … H2) -g destruct
- /2 width=5 by ex3_2_intro/
-| #I #L1 #L2 #V1 #V2 #f #_ #_ #J #K2 #W2 #g #_ #H elim (discr_push_next … H)
-]
-qed-.
-
-(* Basic_2A1: includes lpx_sn_inv_pair2 *)
-lemma lexs_inv_next2: ∀RS,RO,J,X,K2,W2,g. X ⦻*[RS, RO, ⫯g] K2.ⓑ{J}W2 →
- ∃∃K1,W1. K1 ⦻*[RS, RO, g] K2 & RS K1 W1 W2 & X = K1.ⓑ{J}W1.
-/2 width=7 by lexs_inv_next2_aux/ qed-.
-
-fact lexs_inv_push2_aux: ∀RS,RO,X,Y,f. X ⦻*[RS, RO, f] Y → ∀J,K2,W2,g. Y = K2.ⓑ{J}W2 → f = ↑g →
- ∃∃K1,W1. K1 ⦻*[RS, RO, g] K2 & RO K1 W1 W2 & X = K1.ⓑ{J}W1.
-#RS #RO #X #Y #f * -X -Y -f
-[ #f #J #K2 #W2 #g #H destruct
-| #I #L1 #L2 #V1 #V2 #f #_ #_ #J #K2 #W2 #g #_ #H elim (discr_next_push … H)
-| #I #L1 #L2 #V1 #V2 #f #HL #HO #J #K2 #W2 #g #H1 #H2 <(injective_push … H2) -g destruct
- /2 width=5 by ex3_2_intro/
-]
-qed-.
-
-lemma lexs_inv_push2: ∀RS,RO,J,X,K2,W2,g. X ⦻*[RS, RO, ↑g] K2.ⓑ{J}W2 →
- ∃∃K1,W1. K1 ⦻*[RS, RO, g] K2 & RO K1 W1 W2 & X = K1.ⓑ{J}W1.
-/2 width=7 by lexs_inv_push2_aux/ qed-.
-
-(* Basic_2A1: includes lpx_sn_inv_pair *)
-lemma lexs_inv_next: ∀RS,RO,I1,I2,L1,L2,V1,V2,f.
- L1.ⓑ{I1}V1 ⦻*[RS, RO, ⫯f] (L2.ⓑ{I2}V2) →
- ∧∧ L1 ⦻*[RS, RO, f] L2 & RS L1 V1 V2 & I1 = I2.
-#RS #RO #I1 #I2 #L1 #L2 #V1 #V2 #f #H elim (lexs_inv_next1 … H) -H
-#L0 #V0 #HL10 #HV10 #H destruct /2 width=1 by and3_intro/
-qed-.
-
-lemma lexs_inv_push: ∀RS,RO,I1,I2,L1,L2,V1,V2,f.
- L1.ⓑ{I1}V1 ⦻*[RS, RO, ↑f] (L2.ⓑ{I2}V2) →
- ∧∧ L1 ⦻*[RS, RO, f] L2 & RO L1 V1 V2 & I1 = I2.
-#RS #RO #I1 #I2 #L1 #L2 #V1 #V2 #f #H elim (lexs_inv_push1 … H) -H
-#L0 #V0 #HL10 #HV10 #H destruct /2 width=1 by and3_intro/
-qed-.
-
-(* Basic properties *********************************************************)
-
-lemma lexs_eq_repl_back: ∀RS,RO,L1,L2. eq_stream_repl_back … (λf. L1 ⦻*[RS, RO, f] L2).
-#RS #RO #L1 #L2 #f1 #H elim H -L1 -L2 -f1 //
-[ #I #L1 #L2 #V1 #v2 #f1 #_ #HS #IH #f2 #H elim (next_inv_sn … H) -H /3 width=1 by lexs_next/
-| #I #L1 #L2 #V1 #v2 #f1 #_ #HO #IH #f2 #H elim (push_inv_sn … H) -H /3 width=1 by lexs_push/
-]
-qed-.
-
-lemma lexs_eq_repl_fwd: ∀RS,RO,L1,L2. eq_stream_repl_fwd … (λf. L1 ⦻*[RS, RO, f] L2).
-#RS #RO #L1 #L2 @eq_stream_repl_sym /2 width=3 by lexs_eq_repl_back/ (**) (* full auto fails *)
-qed-.
-
-(* Basic_2A1: includes: lpx_sn_refl *)
-lemma lexs_refl: ∀RS,RO,f.
- (∀L. reflexive … (RS L)) →
- (∀L. reflexive … (RO L)) →
- reflexive … (lexs RS RO f).
-#RS #RO #f #HS #HO #L generalize in match f; -f elim L -L //
-#L #I #V #IH * * /2 width=1 by lexs_next, lexs_push/
-qed.
-
-lemma sle_lexs_trans: ∀RS,RO. (∀L,T1,T2. RO L T1 T2 → RS L T1 T2) →
- ∀L1,L2,f2. L1 ⦻*[RS, RO, f2] L2 →
- ∀f1. f1 ⊆ f2 → L1 ⦻*[RS, RO, f1] L2.
-#RS #RO #HR #L1 #L2 #f2 #H elim H -L1 -L2 -f2 //
-#I #L1 #L2 #V1 #V2 #f2 #_ #HV12 #IH
-[2: * * [2: #n1 ] ] #f1 #H
-[ <next_rew /4 width=5 by lexs_next, sle_inv_SO_aux/
-| /4 width=5 by lexs_push, sle_inv_OO_aux/
-| elim (sle_inv_xS_aux … H) -H [3: // |2: skip ]
- #g1 #H #H1 destruct /3 width=5 by lexs_next/
-]
-qed-.
-
-lemma sle_lexs_conf: ∀RS,RO. (∀L,T1,T2. RS L T1 T2 → RO L T1 T2) →
- ∀L1,L2,f1. L1 ⦻*[RS, RO, f1] L2 →
- ∀f2. f1 ⊆ f2 → L1 ⦻*[RS, RO, f2] L2.
-#RS #RO #HR #L1 #L2 #f2 #H elim H -L1 -L2 -f2 //
-#I #L1 #L2 #V1 #V2 #f1 #_ #HV12 #IH
-[ * * [2: #n2 ] ] #f2 #H
-[ <next_rew /4 width=5 by lexs_next, sle_inv_SS_aux/
-| /4 width=5 by lexs_push, sle_inv_SO_aux/
-| elim (sle_inv_Ox_aux … H) -H [3: // |2: skip ]
- #g2 #H #H2 destruct /3 width=5 by lexs_push/
-]
-qed-.
-
-lemma lexs_co: ∀RS1,RS2,RO1,RO2.
- (∀L1,T1,T2. RS1 L1 T1 T2 → RS2 L1 T1 T2) →
- (∀L1,T1,T2. RO1 L1 T1 T2 → RO2 L1 T1 T2) →
- ∀L1,L2,f. L1 ⦻*[RS1, RO1, f] L2 → L1 ⦻*[RS2, RO2, f] L2.
-#RS1 #RS2 #RO1 #RO2 #HS #HO #L1 #L2 #f #H elim H -L1 -L2 -f
-/3 width=1 by lexs_atom, lexs_next, lexs_push/
-qed-.
-
-(* Basic_2A1: removed theorems 17:
- llpx_sn_inv_bind llpx_sn_inv_flat
- llpx_sn_fwd_lref llpx_sn_fwd_pair_sn llpx_sn_fwd_length
- llpx_sn_fwd_bind_sn llpx_sn_fwd_bind_dx llpx_sn_fwd_flat_sn llpx_sn_fwd_flat_dx
- llpx_sn_refl llpx_sn_Y llpx_sn_bind_O llpx_sn_ge_up llpx_sn_ge llpx_sn_co
- llpx_sn_fwd_drop_sn llpx_sn_fwd_drop_dx
-*)
(* Basic properties *********************************************************)
-lemma orb_false_r: ∀b1,b2:bool. (b1 ∨ b2) = false → b1 = false ∧ b2 = false.
-* normalize /2 width=1 by conj/ #b2 #H destruct
-qed-.
-
lemma commutative_orb: commutative … orb.
* * // qed.
lemma orb_true_sn: ∀b. (Ⓣ ∨ b) = Ⓣ.
// qed.
+lemma commutative_andb: commutative … andb.
+* * // qed.
+
+lemma andb_false_dx: ∀b. (b ∧ Ⓕ) = Ⓕ.
+* // qed.
+
+lemma andb_false_sn: ∀b. (Ⓕ ∧ b) = Ⓕ.
+// qed.
+
lemma eq_bool_dec: ∀b1,b2:bool. Decidable (b1 = b2).
* * /2 width=1 by or_introl/
@or_intror #H destruct
qed-.
+
+(* Basic inversion lemmas ***************************************************)
+
+lemma orb_inv_false_dx: ∀b1,b2:bool. (b1 ∨ b2) = Ⓕ → b1 = Ⓕ ∧ b2 = Ⓕ.
+* normalize /2 width=1 by conj/ #b2 #H destruct
+qed-.
+
+lemma andb_inv_true_dx: ∀b1,b2:bool. (b1 ∧ b2) = Ⓣ → b1 = Ⓣ ∧ b2 = Ⓣ.
+* normalize /2 width=1 by conj/ #b2 #H destruct
+qed-.
∃∃f1. f1 ⊚ g2 ≡ f & g1 = ⫯f1.
/2 width=3 by after_inv_xxS_aux/ qed-.
+fact after_inv_Oxx_aux: ∀g1,g2,g. g1 ⊚ g2 ≡ g → ∀f1. g1 = ↑f1 →
+ (∃∃f2,f. f1 ⊚ f2 ≡ f & g2 = ↑f2 & g = ↑f) ∨
+ (∃∃f2,f. f1 ⊚ f2 ≡ f & g2 = ⫯f2 & g = ⫯f).
+#g1 * * [2: #m2 ] #g2 #g #Hg #f1 #H
+[ elim (after_inv_OSx_aux … Hg … H) -g1
+ /3 width=5 by or_intror, ex3_2_intro/
+| elim (after_inv_OOx_aux … Hg … H) -g1
+ /3 width=5 by or_introl, ex3_2_intro/
+]
+qed-.
+
+lemma after_inv_Oxx: ∀f1,g2,g. ↑f1 ⊚ g2 ≡ g →
+ (∃∃f2,f. f1 ⊚ f2 ≡ f & g2 = ↑f2 & g = ↑f) ∨
+ (∃∃f2,f. f1 ⊚ f2 ≡ f & g2 = ⫯f2 & g = ⫯f).
+/2 width=3 by after_inv_Oxx_aux/ qed-.
+
fact after_inv_xOx_aux: ∀f1,g2,f,n1,n. n1@f1 ⊚ g2 ≡ n@f → ∀f2. g2 = ↑f2 →
f1 ⊚ f2 ≡ f ∧ n1 = n.
#f1 #g2 #f #n1 elim n1 -n1
lemma after_isid_inv_dx: ∀f1,f2,f. f1 ⊚ f2 ≡ f → 𝐈⦃f2⦄ → f1 ≐ f.
/3 width=8 by isid_after_dx, after_mono/
qed-.
-(*
-lemma after_inv_isid3: ∀f1,f2,f. f1 ⊚ f2 ≡ f → 𝐈⦃t⦄ → 𝐈⦃t1⦄ ∧ 𝐈⦃t2⦄.
-qed-.
-*)
+
+axiom after_inv_isid3: ∀f1,f2,f. f1 ⊚ f2 ≡ f → 𝐈⦃f⦄ → 𝐈⦃f1⦄ ∧ 𝐈⦃f2⦄.
--- /dev/null
+(**************************************************************************)
+(* ___ *)
+(* ||M|| *)
+(* ||A|| A project by Andrea Asperti *)
+(* ||T|| *)
+(* ||I|| Developers: *)
+(* ||T|| The HELM team. *)
+(* ||A|| http://helm.tcs.unibo.it *)
+(* \ / *)
+(* \ / This file is distributed under the terms of the *)
+(* v GNU General Public License Version 2 *)
+(* *)
+(**************************************************************************)
+
+include "ground_2/relocation/nstream_lift.ma".
+
+(* RELOCATION N-STREAM ******************************************************)
+
+coinductive sle: relation rtmap ≝
+| sle_next: ∀f1,f2,g1,g2. sle f1 f2 → g1 = ↑f1 → g2 = ↑f2 → sle g1 g2
+| sle_push: ∀f1,f2,g1,g2. sle f1 f2 → g1 = ⫯f1 → g2 = ⫯f2 → sle g1 g2
+| sle_weak: ∀f1,f2,g1,g2. sle f1 f2 → g1 = ↑f1 → g2 = ⫯f2 → sle g1 g2
+.
+
+interpretation "inclusion (nstream)"
+ 'subseteq t1 t2 = (sle t1 t2).
+
+(* Basic inversion lemmas ***************************************************)
+
+fact sle_inv_xO_aux: ∀g1,g2. g1 ⊆ g2 → ∀f2. g2 = ↑f2 →
+ ∃∃f1. f1 ⊆ f2 & g1 = ↑f1.
+#g1 #g2 * -g1 -g2
+#f1 #f2 #g1 #g2 #H #H1 #H2 #x2 #Hx2 destruct
+[ lapply (injective_push … Hx2) -Hx2 /2 width=3 by ex2_intro/ ]
+elim (discr_next_push … Hx2)
+qed-.
+
+lemma sle_inv_xO: ∀g1,f2. g1 ⊆ ↑f2 → ∃∃f1. f1 ⊆ f2 & g1 = ↑f1.
+/2 width=3 by sle_inv_xO_aux/ qed-.
+
+fact sle_inv_Sx_aux: ∀g1,g2. g1 ⊆ g2 → ∀f1. g1 = ⫯f1 →
+ ∃∃f2. f1 ⊆ f2 & g2 = ⫯f2.
+#g1 #g2 * -g1 -g2
+#f1 #f2 #g1 #g2 #H #H1 #H2 #x1 #Hx1 destruct
+[2: lapply (injective_next … Hx1) -Hx1 /2 width=3 by ex2_intro/ ]
+elim (discr_push_next … Hx1)
+qed-.
+
+lemma sle_inv_Sx: ∀f1,g2. ⫯f1 ⊆ g2 → ∃∃f2. f1 ⊆ f2 & g2 = ⫯f2.
+/2 width=3 by sle_inv_Sx_aux/ qed-.
+
+fact sle_inv_OS_aux: ∀g1,g2. g1 ⊆ g2 → ∀f1,f2. g1 = ↑f1 → g2 = ⫯f2 → f1 ⊆ f2.
+#g1 #g2 * -g1 -g2
+#f1 #f2 #g1 #g2 #H #H1 #H2 #x1 #x2 #Hx1 #Hx2 destruct
+[ elim (discr_push_next … Hx2)
+| elim (discr_next_push … Hx1)
+| lapply (injective_push … Hx1) -Hx1
+ lapply (injective_next … Hx2) -Hx2 //
+]
+qed-.
+
+lemma sle_inv_OS: ∀f1,f2. ↑f1 ⊆ ⫯f2 → f1 ⊆ f2.
+/2 width=5 by sle_inv_OS_aux/ qed-.
+
+(* Advanced inversion lemmas ************************************************)
+
+fact sle_inv_OO_aux: ∀g1,g2. g1 ⊆ g2 → ∀f1,f2. g1 = ↑f1 → g2 = ↑f2 → f1 ⊆ f2.
+#g1 #g2 #H #f1 #f2 #H1 #H2 elim (sle_inv_xO_aux … H … H2) -g2
+#x1 #H #Hx1 destruct lapply (injective_push … Hx1) -Hx1 //
+qed-.
+
+fact sle_inv_SS_aux: ∀g1,g2. g1 ⊆ g2 → ∀f1,f2. g1 = ⫯f1 → g2 = ⫯f2 → f1 ⊆ f2.
+#g1 #g2 #H #f1 #f2 #H1 #H2 elim (sle_inv_Sx_aux … H … H1) -g1
+#x2 #H #Hx2 destruct lapply (injective_next … Hx2) -Hx2 //
+qed-.