]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/ground/relocation/nstream_eq.ma
update in ground
[helm.git] / matita / matita / contribs / lambdadelta / ground / relocation / nstream_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/relocation/rtmap_eq.ma".
16
17 (* RELOCATION N-STREAM ******************************************************)
18
19 (* Specific properties ******************************************************)
20
21 fact eq_inv_seq_aux: ∀f1,f2,n1,n2. n1⨮f1 ≡ n2⨮f2 → n1 = n2 ∧ f1 ≡ f2.
22 #f1 #f2 #n1 #n2 @(nat_elim2 … n1 n2) -n1 -n2
23 [ #n2 #H elim (eq_inv_px … H) -H [2,3: // ]
24   #g1 #H1 #H elim (push_inv_seq_dx … H) -H /2 width=1 by conj/
25 | #n1 #H elim (eq_inv_np … H) -H //
26 | #n1 #n2 #IH #H lapply (eq_inv_nn … H ????) -H [1,2,3,4: // ]
27   #H elim (IH H) -IH -H /2 width=1 by conj/
28 ]
29 qed-.
30
31 lemma eq_inv_seq: ∀g1,g2. g1 ≡ g2 → ∀f1,f2,n1,n2. n1⨮f1 = g1 → n2⨮f2 = g2 →
32                   n1 = n2 ∧ f1 ≡ f2.
33 /2 width=1 by eq_inv_seq_aux/ qed-.
34
35 corec lemma nstream_eq: ∀f1,f2. f1 ≡ f2 → f1 ≗ f2.
36 * #n1 #f1 * #n2 #f2 #Hf cases (eq_inv_gen … Hf) -Hf *
37 #g1 #g2 #Hg #H1 #H2
38 [ cases (push_inv_seq_dx … H1) -H1 * -n1 #H1
39   cases (push_inv_seq_dx … H2) -H2 * -n2 #H2
40   @eq_seq /2 width=1 by/
41 | cases (next_inv_seq_dx … H1) -H1 #m1 #H1 * -n1
42   cases (next_inv_seq_dx … H2) -H2 #m2 #H2 * -n2
43   cases (eq_inv_seq … Hg … H1 H2) -g1 -g2 #Hm #Hf
44   @eq_seq /2 width=1 by/
45 ]
46 qed-.
47
48 corec lemma nstream_inv_eq: ∀f1,f2. f1 ≗ f2 → f1 ≡ f2.
49 * #n1 #f1 * #n2 #f2 #H cases (eq_stream_inv_seq ??? H) -H [2,3,4,5,6,7: // ]
50 #Hf * -n2 cases n1 -n1 /3 width=5 by eq_push/
51 #n @eq_next /3 width=5 by eq_seq/
52 qed.
53
54 lemma eq_seq_id: ∀f1,f2. f1 ≡ f2 → ∀n. n⨮f1 ≡ n⨮f2.
55 /4 width=1 by nstream_inv_eq, nstream_eq, eq_seq/ qed.