]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/basic_2/multiple/mr2.ma
- revision of ground_2 and basic_2
[helm.git] / matita / matita / contribs / lambdadelta / basic_2 / multiple / mr2.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/ynat/ynat_lt.ma".
16 include "basic_2/notation/relations/rat_3.ma".
17 include "basic_2/grammar/term_vector.ma".
18
19 (* MULTIPLE RELOCATION WITH PAIRS *******************************************)
20
21 inductive at: list2 ynat nat → relation nat ≝
22 | at_nil: ∀i. at (◊) i i
23 | at_lt : ∀cs,l,m,i1,i2. yinj i1 < l →
24           at cs i1 i2 → at ({l, m} @ cs) i1 i2
25 | at_ge : ∀cs,l,m,i1,i2. l ≤ yinj i1 →
26           at cs (i1 + m) i2 → at ({l, m} @ cs) i1 i2
27 .
28
29 interpretation "application (multiple relocation with pairs)"
30    'RAt i1 cs i2 = (at cs i1 i2).
31
32 (* Basic inversion lemmas ***************************************************)
33
34 fact at_inv_nil_aux: ∀cs,i1,i2. @⦃i1, cs⦄ ≡ i2 → cs = ◊ → i1 = i2.
35 #cs #i1 #i2 * -cs -i1 -i2
36 [ //
37 | #cs #l #m #i1 #i2 #_ #_ #H destruct
38 | #cs #l #m #i1 #i2 #_ #_ #H destruct
39 ]
40 qed-.
41
42 lemma at_inv_nil: ∀i1,i2. @⦃i1, ◊⦄ ≡ i2 → i1 = i2.
43 /2 width=3 by at_inv_nil_aux/ qed-.
44
45 fact at_inv_cons_aux: ∀cs,i1,i2. @⦃i1, cs⦄ ≡ i2 →
46                       ∀l,m,cs0. cs = {l, m} @ cs0 →
47                       i1 < l ∧ @⦃i1, cs0⦄ ≡ i2 ∨
48                       l ≤ i1 ∧ @⦃i1 + m, cs0⦄ ≡ i2.
49 #cs #i1 #i2 * -cs -i1 -i2
50 [ #i #l #m #cs #H destruct
51 | #cs1 #l1 #m1 #i1 #i2 #Hil1 #Hi12 #l2 #m2 #cs2 #H destruct /3 width=1 by or_introl, conj/
52 | #cs1 #l1 #m1 #i1 #i2 #Hli1 #Hi12 #l2 #m2 #cs2 #H destruct /3 width=1 by or_intror, conj/
53 ]
54 qed-.
55
56 lemma at_inv_cons: ∀cs,l,m,i1,i2. @⦃i1, {l, m} @ cs⦄ ≡ i2 →
57                    i1 < l ∧ @⦃i1, cs⦄ ≡ i2 ∨
58                    l ≤ i1 ∧ @⦃i1 + m, cs⦄ ≡ i2.
59 /2 width=3 by at_inv_cons_aux/ qed-.
60
61 lemma at_inv_cons_lt: ∀cs,l,m,i1,i2. @⦃i1, {l, m} @ cs⦄ ≡ i2 →
62                       i1 < l → @⦃i1, cs⦄ ≡ i2.
63 #cs #l #m #i1 #m2 #H
64 elim (at_inv_cons … H) -H * // #Hli1 #_ #Hi1l
65 elim (ylt_yle_false … Hi1l Hli1)
66 qed-.
67
68 lemma at_inv_cons_ge: ∀cs,l,m,i1,i2. @⦃i1, {l, m} @ cs⦄ ≡ i2 →
69                       l ≤ i1 → @⦃i1 + m, cs⦄ ≡ i2.
70 #cs #l #m #i1 #m2 #H
71 elim (at_inv_cons … H) -H * // #Hi1l #_ #Hli1
72 elim (ylt_yle_false … Hi1l Hli1)
73 qed-.