]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/ground/relocation/fr2_minus.ma
update in delayed_updating
[helm.git] / matita / matita / contribs / lambdadelta / ground / relocation / fr2_minus.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/xoa/ex_3_1.ma".
16 include "ground/notation/relations/rminus_3.ma".
17 include "ground/arith/nat_plus.ma".
18 include "ground/arith/nat_minus.ma".
19 include "ground/arith/nat_lt.ma".
20 include "ground/relocation/fr2_map.ma".
21
22 (* RELATIONAL SUBTRACTION FOR FINITE RELOCATION MAPS WITH PAIRS *************)
23
24 (*** minuss *)
25 inductive fr2_minus: nat → relation fr2_map ≝
26 (*** minuss_nil *)
27 | fr2_minus_empty (i):
28   fr2_minus i (𝐞) (𝐞)
29 (*** minuss_lt *)
30 | fr2_minus_lt (f1) (f2) (d) (h) (i):
31   i < d → fr2_minus i f1 f2 → fr2_minus i (❨d,h❩◗f1) (❨d-i,h❩◗f2)
32 (*** minuss_ge *)
33 | fr2_minus_ge (f1) (f2) (d) (h) (i):
34   d ≤ i → fr2_minus (h+i) f1 f2 → fr2_minus i (❨d,h❩◗f1) f2
35 .
36
37 interpretation
38   "minus (finite relocation maps with pairs)"
39   'RMinus f1 i f2 = (fr2_minus i f1 f2).
40
41 (* Basic inversions *********************************************************)
42
43 (*** minuss_inv_nil1 *)
44 lemma fr2_minus_inv_empty_sn (f2) (i):
45       𝐞 ▭ i ≘ f2 → f2 = 𝐞.
46 #f2 #i @(insert_eq_1 … (𝐞))
47 #f1 * -f1 -f2 -i
48 [ //
49 | #f1 #f2 #d #h #i #_ #_ #H destruct
50 | #f1 #f2 #d #h #i #_ #_ #H destruct
51 ]
52 qed-.
53
54 (*** minuss_inv_cons1 *)
55 lemma fr2_minus_inv_lcons_sn (f1) (f2) (d) (h) (i):
56       ❨d, h❩◗f1 ▭ i ≘ f2 →
57       ∨∨ ∧∧ d ≤ i & f1 ▭ h+i ≘ f2
58        | ∃∃f. i < d & f1 ▭ i ≘ f & f2 = ❨d-i,h❩◗f.
59 #g1 #f2 #d #h #i @(insert_eq_1 … (❨d,h❩◗g1))
60 #f1 * -f1 -f2 -i
61 [ #i #H destruct
62 | #f1 #f #d1 #h1 #i1 #Hid1 #Hf #H destruct /3 width=3 by ex3_intro, or_intror/
63 | #f1 #f #d1 #h1 #i1 #Hdi1 #Hf #H destruct /3 width=1 by or_introl, conj/
64 ]
65 qed-.
66
67 (*** minuss_inv_cons1_ge *)
68 lemma fr2_minus_inv_lcons_sn_ge (f1) (f2) (d) (h) (i):
69       ❨d, h❩◗f1 ▭ i ≘ f2 → d ≤ i → f1 ▭ h+i ≘ f2.
70 #f1 #f2 #d #h #i #H
71 elim (fr2_minus_inv_lcons_sn … H) -H * // #f #Hid #_ #_ #Hdi
72 elim (nlt_ge_false … Hid Hdi)
73 qed-.
74
75 (*** minuss_inv_cons1_lt *)
76 lemma fr2_minus_inv_lcons_sn_lt (f1) (f2) (d) (h) (i):
77       ❨d, h❩◗f1 ▭ i ≘ f2 → i < d →
78       ∃∃f. f1 ▭ i ≘ f & f2 = ❨d-i,h❩◗f.
79 #f1 #f2 #d #h #i #H elim (fr2_minus_inv_lcons_sn … H) -H *
80 [ #Hdi #_ #Hid elim (nlt_ge_false … Hid Hdi)
81 | /2 width=3 by ex2_intro/
82 ]
83 qed-.