]> matita.cs.unibo.it Git - helm.git/blob - 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
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.tcs.unibo.it                            *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 include "ground/lib/stream_eq.ma".
16 include "ground/relocation/rtmap_eq.ma".
17
18 (* RELOCATION N-STREAM ******************************************************)
19
20 (* Specific properties ******************************************************)
21
22 fact eq_inv_seq_aux: ∀f1,f2,p1,p2. p1⨮f1 ≡ p2⨮f2 → p1 = p2 ∧ f1 ≡ f2.
23 #f1 #f2 #p1 #p2 @(pnat_ind_2 … p1 p2) -p1 -p2
24 [ #p2 #H elim (eq_inv_px … H) -H [2,3: // ]
25   #g1 #H1 #H elim (push_inv_seq_dx … H) -H /2 width=1 by conj/
26 | #p1 #_ #H elim (eq_inv_np … H) -H //
27 | #p1 #p2 #IH #H lapply (eq_inv_nn … H ????) -H [5:|*: // ]
28   #H elim (IH H) -IH -H /2 width=1 by conj/
29 ]
30 qed-.
31
32 lemma eq_inv_seq: ∀g1,g2. g1 ≡ g2 → ∀f1,f2,p1,p2. p1⨮f1 = g1 → p2⨮f2 = g2 →
33                   p1 = p2 ∧ f1 ≡ f2.
34 /2 width=1 by eq_inv_seq_aux/ qed-.
35
36 corec lemma nstream_eq: ∀f1,f2. f1 ≡ f2 → f1 ≗ f2.
37 * #p1 #f1 * #p2 #f2 #Hf cases (eq_inv_gen … Hf) -Hf *
38 #g1 #g2 #Hg #H1 #H2
39 [ cases (push_inv_seq_dx … H1) -H1 * -p1 #H1
40   cases (push_inv_seq_dx … H2) -H2 * -p2 #H2
41   @stream_eq_cons /2 width=1 by/
42 | cases (next_inv_seq_dx … H1) -H1 #m1 #H1 * -p1
43   cases (next_inv_seq_dx … H2) -H2 #m2 #H2 * -p2
44   cases (eq_inv_seq … Hg … H1 H2) -g1 -g2 #Hm #Hf
45   @stream_eq_cons /2 width=1 by/
46 ]
47 qed-.
48
49 corec lemma nstream_inv_eq: ∀f1,f2. f1 ≗ f2 → f1 ≡ f2.
50 * #p1 #f1 * #p2 #f2 #H cases (stream_eq_inv_cons ??? H) -H [|*: // ]
51 #Hf * -p2 cases p1 -p1 /3 width=5 by eq_push/
52 #n @eq_next /3 width=5 by stream_eq_cons/
53 qed.
54
55 lemma eq_seq_id: ∀f1,f2. f1 ≡ f2 → ∀n. n⨮f1 ≡ n⨮f2.
56 /4 width=1 by nstream_inv_eq, nstream_eq, stream_eq_cons/ qed.