]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/ground_2/etc/ynat/ynat_rpm.etc
updated probe and matitadep
[helm.git] / matita / matita / contribs / lambdadelta / ground_2 / etc / ynat / ynat_rpm.etc
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/rplusminus_4.ma".
16 include "ground_2/ynat/ynat_plus.ma".
17
18 (* NATURAL NUMBERS WITH INFINITY ********************************************)
19
20 (* algebraic x + y1 - y2 = z *)
21 inductive yrpm (x:ynat) (y1:ynat) (y2:ynat): predicate ynat ≝
22 | yrpm_ge: y2 ≤ y1 → yrpm x y1 y2 (x + (y1 - y2))
23 | yrpm_lt: y1 < y2 → yrpm x y1 y2 (x - (y2 - y1))
24 .
25
26 interpretation "ynat 'algebraic plus-minus' (relational)"
27    'RPlusMinus x y1 y2 z = (yrpm x y1 y2 z).
28
29 (* Basic inversion lemmas ***************************************************)
30
31 lemma ypm_inv_ge: ∀x,y1,y2,z. x ⊞ y1 ⊟ y2 ≡ z →
32                   y2 ≤ y1 → z = x + (y1 - y2).
33 #x #y1 #y2 #z * -z //
34 #Hy12 #H elim (ylt_yle_false … H) -H //
35 qed-.
36
37 lemma ypm_inv_lt: ∀x,y1,y2,z. x ⊞ y1 ⊟ y2 ≡ z →
38                   y1 < y2 → z = x - (y2 - y1).
39 #x #y1 #y2 #z * -z //
40 #Hy21 #H elim (ylt_yle_false … H) -H //
41 qed-.
42
43 (* Advanced inversion lemmas ************************************************)
44
45 lemma ypm_inv_le: ∀x,y1,y2,z. x ⊞ y1 ⊟ y2 ≡ z →
46                   y1 ≤ y2 → z = x - (y2 - y1).
47 #x #y1 #y2 #z #H #Hy12 elim (yle_split_eq … Hy12) -Hy12 #Hy12
48 [ /2 width=1 by ypm_inv_lt/
49 | >(ypm_inv_ge … H) -H // destruct >yminus_refl //
50 ]
51 qed-.