]> matita.cs.unibo.it Git - helm.git/blob - matita/dama/metric_space.ma
experimental branch with no set baseuri command and no developments
[helm.git] / matita / dama / metric_space.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 set "baseuri" "cic:/matita/metric_space/".
16
17 include "ordered_divisible_group.ma".
18
19 record metric_space (R : todgroup) : Type ≝ {
20   ms_carr :> Type;
21   metric: ms_carr → ms_carr → R;
22   mpositive: ∀a,b:ms_carr. 0 ≤ metric a b; 
23   mreflexive: ∀a. metric a a ≈ 0;
24   msymmetric: ∀a,b. metric a b ≈ metric b a;
25   mtineq: ∀a,b,c:ms_carr. metric a b ≤ metric a c + metric c b
26   (* manca qualcosa per essere una metrica e non una semimetrica *)
27 }.
28
29 notation < "\nbsp \delta a \nbsp b" non associative with precedence 80 for @{ 'delta2 $a $b}.
30 interpretation "metric" 'delta2 a b = (cic:/matita/metric_space/metric.con _ _ a b).
31 notation "\delta" non associative with precedence 80 for @{ 'delta }.
32 interpretation "metric" 'delta = (cic:/matita/metric_space/metric.con _ _).
33
34 definition apart_metric:=
35   λR.λms:metric_space R.λa,b:ms.0 < δ a b.
36
37 lemma apart_of_metric_space: ∀R:todgroup.metric_space R → apartness.
38 intros (R ms); apply (mk_apartness ? (apart_metric ? ms)); unfold apart_metric; unfold;
39 [1: intros 2 (x H); cases H (H1 H2); 
40     lapply (ap_rewr ???? (eq_sym ??? (mreflexive ??x)) H2);
41     apply (ap_coreflexive R 0); assumption;
42 |2: intros (x y H); cases H; split;
43     [1: apply (le_rewr ???? (msymmetric ????)); assumption
44     |2: apply (ap_rewr ???? (msymmetric ????)); assumption]
45 |3: simplify; intros (x y z H); cases H (LExy Axy);
46     lapply (mtineq ?? x y z) as H1; whd in Axy; cases Axy (H2 H2); [cases (LExy H2)]
47     clear LExy; lapply (lt_le_transitive ???? H H1) as LT0;
48     apply (lt0plus_orlt ????? LT0); apply mpositive;]
49 qed.
50     
51 coercion cic:/matita/metric_space/apart_of_metric_space.con.