]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/dama/metric_lattice.ma
refactoring of some lemmas, shorter proofs
[helm.git] / helm / software / matita / dama / metric_lattice.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_lattice/".
16
17 include "metric_space.ma".
18 include "lattice.ma".
19
20 record mlattice_ (R : todgroup) : Type ≝ {
21   ml_mspace_: metric_space R;
22   ml_lattice:> lattice;
23   ml_with_: ms_carr ? ml_mspace_ = ap_carr (l_carr ml_lattice)
24 }.
25
26 lemma ml_mspace: ∀R.mlattice_ R → metric_space R.
27 intros (R ml); apply (mk_metric_space R ml); unfold Type_OF_mlattice_;
28 cases (ml_with_ ? ml); simplify;
29 [apply (metric ? (ml_mspace_ ? ml));|apply (mpositive ? (ml_mspace_ ? ml));
30 |apply (mreflexive ? (ml_mspace_ ? ml));|apply (msymmetric ? (ml_mspace_ ? ml));
31 |apply (mtineq ? (ml_mspace_ ? ml))]
32 qed.
33
34 coercion cic:/matita/metric_lattice/ml_mspace.con.
35
36 record is_mlattice (R : todgroup) (ml: mlattice_ R) : Type ≝ {
37   ml_prop1: ∀a,b:ml. 0 < δ a b → a # b;
38   ml_prop2: ∀a,b,c:ml. δ (a∨b) (a∨c) + δ (a∧b) (a∧c) ≤ δ b c
39 }.
40
41 record mlattice (R : todgroup) : Type ≝ {
42   ml_carr :> mlattice_ R;
43   ml_props:> is_mlattice R ml_carr
44 }.
45
46 lemma eq_to_ndlt0: ∀R.∀ml:mlattice R.∀a,b:ml. a ≈ b → ¬ 0 < δ a b.
47 intros (R ml a b E); intro H; apply E; apply (ml_prop1 ?? ml);
48 assumption;
49 qed.
50
51 lemma eq_to_dzero: ∀R.∀ml:mlattice R.∀x,y:ml.x ≈ y → δ x y ≈ 0.
52 intros (R ml x y H); intro H1; apply H; clear H; 
53 apply (ml_prop1 ?? ml); split [apply mpositive] apply ap_symmetric;
54 assumption;
55 qed.
56
57 lemma meq_l: ∀R.∀ml:mlattice R.∀x,y,z:ml. x≈z → δx y ≈ δz y.
58 intros (R ml x y z); apply le_le_eq;
59 [ apply (le_transitive ???? (mtineq ???y z)); 
60   apply (le_rewl ??? (0+δz y) (eq_to_dzero ???? H));
61   apply (le_rewl ??? (δz y) (zero_neutral ??)); apply le_reflexive;
62 | apply (le_transitive ???? (mtineq ???y x));
63   apply (le_rewl ??? (0+δx y) (eq_to_dzero ??z x H));
64   apply (le_rewl ??? (δx y) (zero_neutral ??)); apply le_reflexive;]
65 qed.
66
67 (* 3.3 *)
68 lemma meq_r: ∀R.∀ml:mlattice R.∀x,y,z:ml. x≈z → δy x ≈ δy z.
69 intros; apply (eq_trans ???? (msymmetric ??y x));
70 apply (eq_trans ????? (msymmetric ??z y)); apply meq_l; assumption;
71 qed.
72  
73
74 lemma dap_to_lt: ∀R.∀ml:mlattice R.∀x,y:ml. δ x y # 0 → 0 < δ x y.
75 intros; split [apply mpositive] apply ap_symmetric; assumption;
76 qed.
77
78 lemma dap_to_ap: ∀R.∀ml:mlattice R.∀x,y:ml. δ x y # 0 → x # y.
79 intros (R ml x y H); apply (ml_prop1 ?? ml); split; [apply mpositive;]
80 apply ap_symmetric; assumption;
81 qed.
82
83 (* 3.11 *)
84 lemma le_mtri: 
85   ∀R.∀ml:mlattice R.∀x,y,z:ml. x ≤ y → y ≤ z → δ x z ≈ δ x y + δ y z.
86 intros (R ml x y z Lxy Lyz); apply le_le_eq; [apply mtineq]
87 apply (le_transitive ????? (ml_prop2 ?? ml (y) ??)); 
88 cut ( δx y+ δy z ≈ δ(y∨x) (y∨z)+ δ(y∧x) (y∧z)); [
89   apply (le_rewr ??? (δx y+ δy z)); [assumption] apply le_reflexive]
90 lapply (le_to_eqm ??? Lxy) as Dxm; lapply (le_to_eqm ??? Lyz) as Dym;
91 lapply (le_to_eqj ??? Lxy) as Dxj; lapply (le_to_eqj ??? Lyz) as Dyj; clear Lxy Lyz;
92 apply (Eq≈ (δ(x∧y) y + δy z) (meq_l ????? Dxm));
93 apply (Eq≈ (δ(x∧y) (y∧z) + δy z) (meq_r ????? Dym));
94 apply (Eq≈ (δ(x∧y) (y∧z) + δ(x∨y) z) (meq_l ????? Dxj));
95 apply (Eq≈ (δ(x∧y) (y∧z) + δ(x∨y) (y∨z))); [
96   apply (feq_plusl ? (δ(x∧y) (y∧z)) ?? (meq_r ??? (x∨y) ? Dyj));]
97 apply (Eq≈ ? (plus_comm ???));
98 apply (Eq≈ (δ(y∨x) (y∨z)+ δ(x∧y) (y∧z)) (meq_l ????? (join_comm ?x y)));
99 apply feq_plusl;
100 apply (Eq≈ (δ(y∧x) (y∧z)) (meq_l ????? (meet_comm ?x y)));
101 apply eq_reflexive;   
102 qed.  
103
104
105 (* 3.17 conclusione: δ x y ≈ 0 *)
106 (* 3.20 conclusione: δ x y ≈ 0 *)
107 (* 3.21 sup forte
108    strong_sup x ≝ ∀n. s n ≤ x ∧ ∀y x ≰ y → ∃n. s n ≰ y
109    strong_sup_zoli x ≝  ∀n. s n ≤ x ∧ ∄y. y#x ∧ y ≤ x
110 *)
111 (* 3.22 sup debole (più piccolo dei maggioranti) *)
112 (* 3.23 conclusion: δ x sup(...) ≈ 0 *)
113 (* 3.25 vero nel reticolo e basta (niente δ) *)
114 (* 3.36 conclusion: δ x y ≈ 0 *)