1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.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/notation/relations/runion_3.ma".
16 include "ground_2/relocation/trace_isid.ma".
18 (* RELOCATION TRACE *********************************************************)
20 inductive sor: relation3 trace trace trace ≝
21 | sor_empty: sor (◊) (◊) (◊)
22 | sor_inh : ∀cs1,cs2,cs. sor cs1 cs2 cs →
23 ∀b1,b2. sor (b1 @ cs1) (b2 @ cs2) ((b1 ∨ b2) @ cs).
27 'RUnion L1 L2 L = (sor L2 L1 L).
29 (* Basic properties *********************************************************)
31 lemma sor_length: ∀cs1,cs2. |cs1| = |cs2| →
32 ∃∃cs. cs2 ⋓ cs1 ≡ cs & |cs| = |cs1| & |cs| = |cs2|.
34 [ #cs2 #H >(length_inv_zero_sn … H) -H /2 width=4 by sor_empty, ex3_intro/
35 | #b1 #cs1 #IH #x #H elim (length_inv_succ_sn … H) -H
36 #cs2 #b2 #H12 #H destruct elim (IH … H12) -IH -H12
37 #cs #H12 #H1 #H2 @(ex3_intro … ((b1 ∨ b2) @ cs)) /2 width=1 by sor_inh/ (**) (* explicit constructor *)
41 lemma sor_sym: ∀cs1,cs2,cs. cs1 ⋓ cs2 ≡ cs → cs2 ⋓ cs1 ≡ cs.
42 #cs1 #cs2 #cs #H elim H -cs1 -cs2 -cs /2 width=1 by sor_inh/
45 (* Basic inversion lemmas ***************************************************)
47 lemma sor_inv_length: ∀cs1,cs2,cs. cs2 ⋓ cs1 ≡ cs →
48 ∧∧ |cs1| = |cs2| & |cs| = |cs1| & |cs| = |cs2|.
49 #cs1 #cs2 #cs #H elim H -cs1 -cs2 -cs /2 width=1 by and3_intro/
50 #cs1 #cs2 #cs #_ #b1 #b2 * /2 width=1 by and3_intro/
53 (* Basic forward lemmas *****************************************************)
55 lemma sor_fwd_isid_sn: ∀cs1,cs2,cs. cs1 ⋓ cs2 ≡ cs → 𝐈⦃cs1⦄ → 𝐈⦃cs⦄.
56 #cs1 #cs2 #cs #H elim H -cs1 -cs2 -cs //
57 #cs1 #cs2 #cs #_ #b1 #b2 #IH #H elim (isid_inv_cons … H) -H
58 /3 width=1 by isid_true/
61 lemma sor_fwd_isid_dx: ∀cs1,cs2,cs. cs1 ⋓ cs2 ≡ cs → 𝐈⦃cs2⦄ → 𝐈⦃cs⦄.
62 /3 width=4 by sor_fwd_isid_sn, sor_sym/ qed-.