]> matita.cs.unibo.it Git - helm.git/blobdiff - matita/matita/contribs/lambdadelta/ground/relocation/pstream_eq.ma
propagating the arithmetics library, partial commit
[helm.git] / matita / matita / contribs / lambdadelta / ground / relocation / pstream_eq.ma
diff --git a/matita/matita/contribs/lambdadelta/ground/relocation/pstream_eq.ma b/matita/matita/contribs/lambdadelta/ground/relocation/pstream_eq.ma
new file mode 100644 (file)
index 0000000..12663ae
--- /dev/null
@@ -0,0 +1,56 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||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/lib/stream_eq.ma".
+include "ground/relocation/rtmap_eq.ma".
+
+(* RELOCATION N-STREAM ******************************************************)
+
+(* Specific properties ******************************************************)
+
+fact eq_inv_seq_aux: ∀f1,f2,p1,p2. p1⨮f1 ≡ p2⨮f2 → p1 = p2 ∧ f1 ≡ f2.
+#f1 #f2 #p1 #p2 @(pnat_ind_2 … p1 p2) -p1 -p2
+[ #p2 #H elim (eq_inv_px … H) -H [2,3: // ]
+  #g1 #H1 #H elim (push_inv_seq_dx … H) -H /2 width=1 by conj/
+| #p1 #_ #H elim (eq_inv_np … H) -H //
+| #p1 #p2 #IH #H lapply (eq_inv_nn … H ????) -H [5:|*: // ]
+  #H elim (IH H) -IH -H /2 width=1 by conj/
+]
+qed-.
+
+lemma eq_inv_seq: ∀g1,g2. g1 ≡ g2 → ∀f1,f2,p1,p2. p1⨮f1 = g1 → p2⨮f2 = g2 →
+                  p1 = p2 ∧ f1 ≡ f2.
+/2 width=1 by eq_inv_seq_aux/ qed-.
+
+corec lemma nstream_eq: ∀f1,f2. f1 ≡ f2 → f1 ≗ f2.
+* #p1 #f1 * #p2 #f2 #Hf cases (eq_inv_gen … Hf) -Hf *
+#g1 #g2 #Hg #H1 #H2
+[ cases (push_inv_seq_dx … H1) -H1 * -p1 #H1
+  cases (push_inv_seq_dx … H2) -H2 * -p2 #H2
+  @stream_eq_cons /2 width=1 by/
+| cases (next_inv_seq_dx … H1) -H1 #m1 #H1 * -p1
+  cases (next_inv_seq_dx … H2) -H2 #m2 #H2 * -p2
+  cases (eq_inv_seq … Hg … H1 H2) -g1 -g2 #Hm #Hf
+  @stream_eq_cons /2 width=1 by/
+]
+qed-.
+
+corec lemma nstream_inv_eq: ∀f1,f2. f1 ≗ f2 → f1 ≡ f2.
+* #p1 #f1 * #p2 #f2 #H cases (stream_eq_inv_cons ??? H) -H [|*: // ]
+#Hf * -p2 cases p1 -p1 /3 width=5 by eq_push/
+#n @eq_next /3 width=5 by stream_eq_cons/
+qed.
+
+lemma eq_seq_id: ∀f1,f2. f1 ≡ f2 → ∀n. n⨮f1 ≡ n⨮f2.
+/4 width=1 by nstream_inv_eq, nstream_eq, stream_eq_cons/ qed.