]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/contribs/dama/dama/ordered_set.ma
06c222830351ef1e2820df5af1f30c3ce0663095
[helm.git] / helm / software / matita / contribs / dama / dama / ordered_set.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 "datatypes/constructors.ma".
16 include "logic/cprop_connectives.ma".
17
18 (* Definition 2.1 *)
19 record ordered_set: Type ≝ {
20   os_carr:> Type;
21   os_excess: os_carr → os_carr → CProp;
22   os_coreflexive: coreflexive ? os_excess;
23   os_cotransitive: cotransitive ? os_excess 
24 }.
25
26 interpretation "Ordered set excess" 'nleq a b = (os_excess _ a b). 
27
28 (* Definition 2.2 (3) *)
29 definition le ≝ λE:ordered_set.λa,b:E. ¬ (a ≰ b).
30
31 interpretation "Ordered set greater or equal than" 'geq a b = (le _ b a).
32
33 interpretation "Ordered set less or equal than" 'leq a b = (le _ a b).
34
35 lemma le_reflexive: ∀E.reflexive ? (le E).
36 unfold reflexive; intros 3 (E x H); apply (os_coreflexive ?? H);
37 qed.
38
39 lemma le_transitive: ∀E.transitive ? (le E).
40 unfold transitive; intros 7 (E x y z H1 H2 H3); cases (os_cotransitive ??? y H3) (H4 H4);
41 [cases (H1 H4)|cases (H2 H4)]
42 qed.
43
44 (* Lemma 2.3 *)
45 lemma exc_le_variance: 
46   ∀O:ordered_set.∀a,b,a',b':O.a ≰ b → a ≤ a' → b' ≤ b → a' ≰ b'.
47 intros (O a b a1 b1 Eab Laa1 Lb1b);
48 cases (os_cotransitive ??? a1 Eab) (H H); [cases (Laa1 H)]
49 cases (os_cotransitive ??? b1 H) (H1 H1); [assumption]
50 cases (Lb1b H1);
51 qed.
52
53 lemma square_ordered_set: ordered_set → ordered_set.
54 intro O;
55 apply (mk_ordered_set (O × O));
56 [1: intros (x y); apply (\fst x ≰ \fst y ∨ \snd x ≰ \snd y);
57 |2: intro x0; cases x0 (x y); clear x0; simplify; intro H;
58     cases H (X X); apply (os_coreflexive ?? X);
59 |3: intros 3 (x0 y0 z0); cases x0 (x1 x2); cases y0 (y1 y2) ; cases z0 (z1 z2); 
60     clear x0 y0 z0; simplify; intro H; cases H (H1 H1); clear H;
61     [1: cases (os_cotransitive ??? z1 H1); [left; left|right;left]assumption;
62     |2: cases (os_cotransitive ??? z2 H1); [left;right|right;right]assumption]]
63 qed.
64
65 notation "s 2 \atop \nleq" non associative with precedence 90
66   for @{ 'square_os $s }.
67 notation > "s 'square'" non associative with precedence 90
68   for @{ 'square $s }.
69 interpretation "ordered set square" 'square s = (square_ordered_set s). 
70 interpretation "ordered set square" 'square_os s = (square_ordered_set s).
71
72 definition os_subset ≝ λO:ordered_set.λP,Q:O→Prop.∀x:O.P x → Q x.
73
74 interpretation "ordered set subset" 'subseteq a b = (os_subset _ a b). 
75