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/notation/relations/rat_3.ma".
16 include "ground/arith/nat_plus.ma".
17 include "ground/arith/nat_lt.ma".
18 include "ground/relocation/mr2.ma".
20 (* MULTIPLE RELOCATION WITH PAIRS *******************************************)
22 inductive at: mr2 → relation nat ≝
23 | at_nil: ∀i. at (◊) i i
24 | at_lt : ∀cs,l,m,i1,i2. i1 < l →
25 at cs i1 i2 → at (❨l, m❩;cs) i1 i2
26 | at_ge : ∀cs,l,m,i1,i2. l ≤ i1 →
27 at cs (i1 + m) i2 → at (❨l, m❩;cs) i1 i2
30 interpretation "application (multiple relocation with pairs)"
31 'RAt i1 cs i2 = (at cs i1 i2).
33 (* Basic inversion lemmas ***************************************************)
35 fact at_inv_nil_aux: ∀cs,i1,i2. @❪i1, cs❫ ≘ i2 → cs = ◊ → i1 = i2.
36 #cs #i1 #i2 * -cs -i1 -i2
38 | #cs #l #m #i1 #i2 #_ #_ #H destruct
39 | #cs #l #m #i1 #i2 #_ #_ #H destruct
43 lemma at_inv_nil: ∀i1,i2. @❪i1, ◊❫ ≘ i2 → i1 = i2.
44 /2 width=3 by at_inv_nil_aux/ qed-.
46 fact at_inv_cons_aux: ∀cs,i1,i2. @❪i1, cs❫ ≘ i2 →
47 ∀l,m,cs0. cs = ❨l, m❩;cs0 →
48 i1 < l ∧ @❪i1, cs0❫ ≘ i2 ∨
49 l ≤ i1 ∧ @❪i1 + m, cs0❫ ≘ i2.
50 #cs #i1 #i2 * -cs -i1 -i2
51 [ #i #l #m #cs #H destruct
52 | #cs1 #l1 #m1 #i1 #i2 #Hil1 #Hi12 #l2 #m2 #cs2 #H destruct /3 width=1 by or_introl, conj/
53 | #cs1 #l1 #m1 #i1 #i2 #Hli1 #Hi12 #l2 #m2 #cs2 #H destruct /3 width=1 by or_intror, conj/
57 lemma at_inv_cons: ∀cs,l,m,i1,i2. @❪i1, ❨l, m❩;cs❫ ≘ i2 →
58 i1 < l ∧ @❪i1, cs❫ ≘ i2 ∨
59 l ≤ i1 ∧ @❪i1 + m, cs❫ ≘ i2.
60 /2 width=3 by at_inv_cons_aux/ qed-.
62 lemma at_inv_cons_lt: ∀cs,l,m,i1,i2. @❪i1, ❨l, m❩;cs❫ ≘ i2 →
63 i1 < l → @❪i1, cs❫ ≘ i2.
65 elim (at_inv_cons … H) -H * // #Hli1 #_ #Hi1l
66 elim (nlt_ge_false … Hi1l Hli1)
69 lemma at_inv_cons_ge: ∀cs,l,m,i1,i2. @❪i1, ❨l, m❩;cs❫ ≘ i2 →
70 l ≤ i1 → @❪i1 + m, cs❫ ≘ i2.
72 elim (at_inv_cons … H) -H * // #Hi1l #_ #Hli1
73 elim (nlt_ge_false … Hi1l Hli1)
76 (* Main properties **********************************************************)
78 theorem at_mono: ∀cs,i,i1. @❪i, cs❫ ≘ i1 → ∀i2. @❪i, cs❫ ≘ i2 → i1 = i2.
79 #cs #i #i1 #H elim H -cs -i -i1
80 [ #i #x #H <(at_inv_nil … H) -x //
81 | #cs #l #m #i #i1 #Hil #_ #IHi1 #x #H
82 lapply (at_inv_cons_lt … H Hil) -H -Hil /2 width=1 by/
83 | #cs #l #m #i #i1 #Hli #_ #IHi1 #x #H
84 lapply (at_inv_cons_ge … H Hli) -H -Hli /2 width=1 by/