1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.tcs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 include "ground_2/relocation/rtmap_eq.ma".
17 (* RELOCATION N-STREAM ******************************************************)
19 (* Specific properties ******************************************************)
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/
31 lemma eq_inv_seq: ∀g1,g2. g1 ≗ g2 → ∀f1,f2,n1,n2. n1@f1 = g1 → n2@f2 = g2 →
33 /2 width=1 by eq_inv_seq_aux/ qed-.
35 let corec nstream_eq: ∀f1,f2. f1 ≗ f2 → f1 ≐ f2 ≝ ?.
36 * #n1 #f1 * #n2 #f2 #Hf cases (eq_inv_gen … Hf) -Hf *
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/
48 let corec 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/
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.