]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/ground_2/relocation/mr2_at.ma
update in ground_2, static_2, basic_2, apps_2, alpha_1
[helm.git] / matita / matita / contribs / lambdadelta / ground_2 / relocation / mr2_at.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/rat_3.ma".
16 include "ground_2/relocation/mr2.ma".
17
18 (* MULTIPLE RELOCATION WITH PAIRS *******************************************)
19
20 inductive at: mr2 → relation nat ≝
21 | at_nil: ∀i. at (◊) i i
22 | at_lt : ∀cs,l,m,i1,i2. i1 < l →
23           at cs i1 i2 → at (❨l, m❩;cs) i1 i2
24 | at_ge : ∀cs,l,m,i1,i2. l ≤ i1 →
25           at cs (i1 + m) i2 → at (❨l, m❩;cs) i1 i2
26 .
27
28 interpretation "application (multiple relocation with pairs)"
29    'RAt i1 cs i2 = (at cs i1 i2).
30
31 (* Basic inversion lemmas ***************************************************)
32
33 fact at_inv_nil_aux: ∀cs,i1,i2. @❪i1, cs❫ ≘ i2 → cs = ◊ → i1 = i2.
34 #cs #i1 #i2 * -cs -i1 -i2
35 [ //
36 | #cs #l #m #i1 #i2 #_ #_ #H destruct
37 | #cs #l #m #i1 #i2 #_ #_ #H destruct
38 ]
39 qed-.
40
41 lemma at_inv_nil: ∀i1,i2. @❪i1, ◊❫ ≘ i2 → i1 = i2.
42 /2 width=3 by at_inv_nil_aux/ qed-.
43
44 fact at_inv_cons_aux: ∀cs,i1,i2. @❪i1, cs❫ ≘ i2 →
45                       ∀l,m,cs0. cs = ❨l, m❩;cs0 →
46                       i1 < l ∧ @❪i1, cs0❫ ≘ i2 ∨
47                       l ≤ i1 ∧ @❪i1 + m, cs0❫ ≘ i2.
48 #cs #i1 #i2 * -cs -i1 -i2
49 [ #i #l #m #cs #H destruct
50 | #cs1 #l1 #m1 #i1 #i2 #Hil1 #Hi12 #l2 #m2 #cs2 #H destruct /3 width=1 by or_introl, conj/
51 | #cs1 #l1 #m1 #i1 #i2 #Hli1 #Hi12 #l2 #m2 #cs2 #H destruct /3 width=1 by or_intror, conj/
52 ]
53 qed-.
54
55 lemma at_inv_cons: ∀cs,l,m,i1,i2. @❪i1, ❨l, m❩;cs❫ ≘ i2 →
56                    i1 < l ∧ @❪i1, cs❫ ≘ i2 ∨
57                    l ≤ i1 ∧ @❪i1 + m, cs❫ ≘ i2.
58 /2 width=3 by at_inv_cons_aux/ qed-.
59
60 lemma at_inv_cons_lt: ∀cs,l,m,i1,i2. @❪i1, ❨l, m❩;cs❫ ≘ i2 →
61                       i1 < l → @❪i1, cs❫ ≘ i2.
62 #cs #l #m #i1 #m2 #H
63 elim (at_inv_cons … H) -H * // #Hli1 #_ #Hi1l
64 elim (lt_le_false … Hi1l Hli1)
65 qed-.
66
67 lemma at_inv_cons_ge: ∀cs,l,m,i1,i2. @❪i1, ❨l, m❩;cs❫ ≘ i2 →
68                       l ≤ i1 → @❪i1 + m, cs❫ ≘ i2.
69 #cs #l #m #i1 #m2 #H
70 elim (at_inv_cons … H) -H * // #Hi1l #_ #Hli1
71 elim (lt_le_false … Hi1l Hli1)
72 qed-.
73
74 (* Main properties **********************************************************)
75
76 theorem at_mono: ∀cs,i,i1. @❪i, cs❫ ≘ i1 → ∀i2. @❪i, cs❫ ≘ i2 → i1 = i2.
77 #cs #i #i1 #H elim H -cs -i -i1
78 [ #i #x #H <(at_inv_nil … H) -x //
79 | #cs #l #m #i #i1 #Hil #_ #IHi1 #x #H
80   lapply (at_inv_cons_lt … H Hil) -H -Hil /2 width=1 by/
81 | #cs #l #m #i #i1 #Hli #_ #IHi1 #x #H
82   lapply (at_inv_cons_ge … H Hli) -H -Hli /2 width=1 by/
83 ]
84 qed-.