]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/contribs/dama/dama/models/q_support.ma
Using Prop conjuction on Props lowers the universes.
[helm.git] / helm / software / matita / contribs / dama / dama / models / q_support.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 "Q/q/qtimes.ma".
16 include "Q/q/qplus.ma".
17 include "cprop_connectives.ma".
18
19 notation "\rationals" non associative with precedence 99 for @{'q}.
20 interpretation "Q" 'q = Q. 
21
22 (* group over Q *)
23 axiom qp : ℚ → ℚ → ℚ.
24
25 interpretation "Q plus" 'plus x y = (qp x y).
26 interpretation "Q minus" 'minus x y = (qp x (Qopp y)).
27
28 axiom q_plus_OQ: ∀x:ℚ.x + OQ = x.
29 axiom q_plus_sym: ∀x,y:ℚ.x + y = y + x.
30 axiom q_plus_minus: ∀x.x - x = OQ.
31 axiom q_plus_assoc: ∀x,y,z.x + (y + z) = x + y + z. 
32 axiom q_opp_plus: ∀x,y,z:Q. Qopp (y + z) = Qopp y + Qopp z.
33
34 (* order over Q *)
35 axiom qlt : ℚ → ℚ → Prop.
36 axiom qle : ℚ → ℚ → Prop.
37 interpretation "Q less than" 'lt x y = (qlt x y).
38 interpretation "Q less or equal than" 'leq x y = (qle x y).
39
40 inductive q_comparison (a,b:ℚ) : CProp ≝
41  | q_leq : a ≤ b → q_comparison a b 
42  | q_gt : b < a → q_comparison a b.
43
44 axiom q_cmp:∀a,b:ℚ.q_comparison a b.
45
46 inductive q_le_elimination (a,b:ℚ) : CProp ≝
47 | q_le_from_eq : a = b → q_le_elimination a b
48 | q_le_from_lt : a < b → q_le_elimination a b.
49
50 axiom q_le_cases : ∀x,y:ℚ.x ≤ y → q_le_elimination x y.
51
52 axiom q_le_plus_l: ∀a,b,c:ℚ. a ≤ c - b → a + b ≤ c.
53 axiom q_le_plus_r: ∀a,b,c:ℚ. a - b ≤ c → a ≤ c + b.
54 axiom q_lt_plus_l: ∀a,b,c:ℚ. a < c - b → a + b < c.
55 axiom q_lt_plus_r: ∀a,b,c:ℚ. a - b < c → a < c + b.
56
57 axiom q_lt_opp_opp: ∀a,b.b < a → Qopp a < Qopp b.
58
59 axiom q_le_n: ∀x. x ≤ x.
60 axiom q_lt_to_le: ∀a,b:ℚ.a < b → a ≤ b.
61
62 axiom q_lt_corefl: ∀x:Q.x < x → False.
63 axiom q_lt_le_incompat: ∀x,y:Q.x < y → y ≤ x → False.
64
65 axiom q_neg_gt: ∀r:ratio.Qneg r < OQ.
66 axiom q_pos_OQ: ∀x.OQ < Qpos x.
67
68 axiom q_lt_trans: ∀x,y,z:Q. x < y → y < z → x < z.
69 axiom q_lt_le_trans: ∀x,y,z:Q. x < y → y ≤ z → x < z.
70 axiom q_le_lt_trans: ∀x,y,z:Q. x ≤ y → y < z → x < z.
71 axiom q_le_trans: ∀x,y,z:Q. x ≤ y → y ≤ z → x ≤ z.
72
73 axiom q_le_lt_OQ_plus_trans: ∀x,y:Q.OQ ≤ x → OQ < y → OQ < x + y.
74 axiom q_lt_le_OQ_plus_trans: ∀x,y:Q.OQ < x → OQ ≤ y → OQ < x + y.
75 axiom q_le_OQ_plus_trans: ∀x,y:Q.OQ ≤ x → OQ ≤ y → OQ ≤ x + y.
76
77 axiom q_leWl: ∀x,y,z.OQ ≤ x → x + y ≤ z → y ≤ z.
78 axiom q_ltWl: ∀x,y,z.OQ ≤ x → x + y < z → y < z.
79
80 (* distance *)
81 axiom q_dist : ℚ → ℚ → ℚ.
82
83 notation "hbox(\dd [term 19 x, break term 19 y])" with precedence 90
84 for @{'distance $x $y}.
85 interpretation "ℚ distance" 'distance x y = (q_dist x y).
86
87 axiom q_d_ge_OQ : ∀x,y:ℚ. OQ ≤ ⅆ[x,y].
88 axiom q_d_OQ: ∀x:Q.ⅆ[x,x] = OQ.
89 axiom q_d_noabs: ∀x,y. x ≤ y → ⅆ[y,x] = y - x.
90 axiom q_d_sym: ∀x,y. ⅆ[x,y] = ⅆ[y,x].
91
92 lemma q_2opp: ∀x:ℚ.Qopp (Qopp x) = x.
93 intros; cases x; reflexivity; qed.
94
95 (* derived *)
96 lemma q_lt_canc_plus_r:
97   ∀x,y,z:Q.x + z < y + z → x < y.
98 intros; rewrite < (q_plus_OQ y); rewrite < (q_plus_minus z);
99 rewrite > q_plus_assoc; apply q_lt_plus_r; rewrite > q_2opp; assumption;
100 qed.
101
102 lemma q_lt_inj_plus_r:
103   ∀x,y,z:Q.x < y → x + z < y + z.
104 intros; apply (q_lt_canc_plus_r ?? (Qopp z));
105 do 2 rewrite < q_plus_assoc; rewrite > q_plus_minus; 
106 do 2 rewrite > q_plus_OQ; assumption;
107 qed.
108
109 lemma q_le_inj_plus_r:
110   ∀x,y,z:Q.x ≤ y → x + z ≤ y + z.
111 intros;cases (q_le_cases ?? H);
112 [1: rewrite > H1; apply q_le_n;
113 |2: apply q_lt_to_le; apply q_lt_inj_plus_r; assumption;]
114 qed.
115
116 lemma q_le_canc_plus_r:
117   ∀x,y,z:Q.x + z ≤ y + z → x ≤ y.
118 intros; lapply (q_le_inj_plus_r ?? (Qopp z) H) as H1;
119 do 2 rewrite < q_plus_assoc in H1;
120 rewrite > q_plus_minus in H1; do 2 rewrite > q_plus_OQ in H1; assumption;
121 qed.