]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/ground_2/relocation/trace_sor.ma
65aba02ac4da17fa88f8b24b11aa8e701c892653
[helm.git] / matita / matita / contribs / lambdadelta / ground_2 / relocation / trace_sor.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.cs.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_2/notation/relations/runion_3.ma".
16 include "ground_2/relocation/trace_isid.ma".
17
18 (* RELOCATION TRACE *********************************************************)
19
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).
24
25 interpretation
26    "union (trace)"
27    'RUnion L1 L2 L = (sor L2 L1 L).
28
29 (* Basic properties *********************************************************)
30
31 lemma sor_length: ∀cs1,cs2. |cs1| = |cs2| →
32                   ∃∃cs. cs2 ⋓ cs1 ≡ cs & |cs| = |cs1| & |cs| = |cs2|.
33 #cs1 elim cs1 -cs1
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 *)
38 ]
39 qed-.
40
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/
43 qed-.
44
45 (* Basic inversion lemmas ***************************************************)
46
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/
51 qed-.
52
53 (* Basic forward lemmas *****************************************************)
54
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/
59 qed-.
60
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-.