1 (**************************************************************************)
4 (* ||A|| A project by Andrea Asperti *)
6 (* ||I|| Developers: *)
7 (* ||T|| The HELM team. *)
8 (* ||A|| http://helm.cs.unibo.it *)
10 (* \ / This file is distributed under the terms of the *)
11 (* v GNU General Public License Version 2 *)
13 (**************************************************************************)
15 set "baseuri" "cic:/matita/ordered_sets/".
17 include "excedence.ma".
19 record is_porder_relation (C:Type) (le:C→C→Prop) (eq:C→C→Prop) : Type ≝ {
20 por_reflexive: reflexive ? le;
21 por_transitive: transitive ? le;
22 por_antisimmetric: antisymmetric ? le eq
25 record pordered_set: Type ≝ {
27 pos_order_relation_properties:> is_porder_relation ? (le pos_carr) (eq pos_carr)
30 lemma pordered_set_of_excedence: excedence → pordered_set.
31 intros (E); apply (mk_pordered_set E); apply (mk_is_porder_relation);
32 [apply le_reflexive|apply le_transitive|apply le_antisymmetric]
35 alias id "transitive" = "cic:/matita/higher_order_defs/relations/transitive.con".
36 alias id "cotransitive" = "cic:/matita/higher_order_defs/relations/cotransitive.con".
37 alias id "antisymmetric" = "cic:/matita/higher_order_defs/relations/antisymmetric.con".
39 theorem antisimmetric_to_cotransitive_to_transitive:
40 ∀C:Type.∀le:C→C→Prop. antisymmetric ? le → cotransitive ? le → transitive ? le.
41 intros (T f Af cT); unfold transitive; intros (x y z fxy fyz);
42 lapply (cT ? ? fxy z) as H; cases H; [assumption] cases (Af ? ? fyz H1);
45 definition is_increasing ≝ λO:pordered_set.λa:nat→O.∀n:nat.a n ≤ a (S n).
46 definition is_decreasing ≝ λO:pordered_set.λa:nat→O.∀n:nat.a (S n) ≤ a n.
48 definition is_upper_bound ≝ λO:pordered_set.λa:nat→O.λu:O.∀n:nat.a n ≤ u.
49 definition is_lower_bound ≝ λO:pordered_set.λa:nat→O.λu:O.∀n:nat.u ≤ a n.
51 record is_sup (O:pordered_set) (a:nat→O) (u:O) : Prop ≝
52 { sup_upper_bound: is_upper_bound O a u;
53 sup_least_upper_bound: ∀v:O. is_upper_bound O a v → u≤v
56 record is_inf (O:pordered_set) (a:nat→O) (u:O) : Prop ≝
57 { inf_lower_bound: is_lower_bound O a u;
58 inf_greatest_lower_bound: ∀v:O. is_lower_bound O a v → v≤u
61 record is_bounded_below (O:pordered_set) (a:nat→O) : Type ≝
63 ib_lower_bound_is_lower_bound: is_lower_bound ? a ib_lower_bound
66 record is_bounded_above (O:pordered_set) (a:nat→O) : Type ≝
68 ib_upper_bound_is_upper_bound: is_upper_bound ? a ib_upper_bound
71 record is_bounded (O:pordered_set) (a:nat→O) : Type ≝
72 { ib_bounded_below:> is_bounded_below ? a;
73 ib_bounded_above:> is_bounded_above ? a
76 record bounded_below_sequence (O:pordered_set) : Type ≝
78 bbs_is_bounded_below:> is_bounded_below ? bbs_seq
81 record bounded_above_sequence (O:pordered_set) : Type ≝
83 bas_is_bounded_above:> is_bounded_above ? bas_seq
86 record bounded_sequence (O:pordered_set) : Type ≝
88 bs_is_bounded_below: is_bounded_below ? bs_seq;
89 bs_is_bounded_above: is_bounded_above ? bs_seq
92 definition bounded_below_sequence_of_bounded_sequence ≝
93 λO:pordered_set.λb:bounded_sequence O.
94 mk_bounded_below_sequence ? b (bs_is_bounded_below ? b).
96 coercion cic:/matita/ordered_sets/bounded_below_sequence_of_bounded_sequence.con.
98 definition bounded_above_sequence_of_bounded_sequence ≝
99 λO:pordered_set.λb:bounded_sequence O.
100 mk_bounded_above_sequence ? b (bs_is_bounded_above ? b).
102 coercion cic:/matita/ordered_sets/bounded_above_sequence_of_bounded_sequence.con.
104 definition lower_bound ≝
105 λO:pordered_set.λb:bounded_below_sequence O.
106 ib_lower_bound ? b (bbs_is_bounded_below ? b).
108 lemma lower_bound_is_lower_bound:
109 ∀O:pordered_set.∀b:bounded_below_sequence O.
110 is_lower_bound ? b (lower_bound ? b).
111 intros; unfold lower_bound; apply ib_lower_bound_is_lower_bound.
114 definition upper_bound ≝
115 λO:pordered_set.λb:bounded_above_sequence O.
116 ib_upper_bound ? b (bas_is_bounded_above ? b).
118 lemma upper_bound_is_upper_bound:
119 ∀O:pordered_set.∀b:bounded_above_sequence O.
120 is_upper_bound ? b (upper_bound ? b).
121 intros; unfold upper_bound; apply ib_upper_bound_is_upper_bound.
124 lemma Or_symmetric: symmetric ? Or.
125 unfold; intros (x y H); cases H; [right|left] assumption;
128 definition reverse_excedence: excedence → excedence.
129 intros (E); apply (mk_excedence E); [apply (λx,y.exc_relation E y x)]
130 cases E (T f cRf cTf); simplify;
131 [1: unfold Not; intros (x H); apply (cRf x); assumption
132 |2: intros (x y z); apply Or_symmetric; apply cTf; assumption;]
135 definition reverse_pordered_set: pordered_set → pordered_set.
136 intros (p); apply (mk_pordered_set (reverse_excedence p));
137 generalize in match (reverse_excedence p); intros (E);
138 apply mk_is_porder_relation;
139 [apply le_reflexive|apply le_transitive|apply le_antisymmetric]
142 lemma is_lower_bound_reverse_is_upper_bound:
143 ∀O:pordered_set.∀a:nat→O.∀l:O.
144 is_lower_bound O a l → is_upper_bound (reverse_pordered_set O) a l.
145 intros (O a l H); unfold; intros (n); unfold reverse_pordered_set;
146 unfold reverse_excedence; simplify; fold unfold le (le ? l (a n)); apply H;
149 lemma is_upper_bound_reverse_is_lower_bound:
150 ∀O:pordered_set.∀a:nat→O.∀l:O.
151 is_upper_bound O a l → is_lower_bound (reverse_pordered_set O) a l.
152 intros (O a l H); unfold; intros (n); unfold reverse_pordered_set;
153 unfold reverse_excedence; simplify; fold unfold le (le ? (a n) l); apply H;
156 lemma reverse_is_lower_bound_is_upper_bound:
157 ∀O:pordered_set.∀a:nat→O.∀l:O.
158 is_lower_bound (reverse_pordered_set O) a l → is_upper_bound O a l.
159 intros (O a l H); unfold; intros (n); unfold reverse_pordered_set in H;
160 unfold reverse_excedence in H; simplify in H; apply H;
163 lemma reverse_is_upper_bound_is_lower_bound:
164 ∀O:pordered_set.∀a:nat→O.∀l:O.
165 is_upper_bound (reverse_pordered_set O) a l → is_lower_bound O a l.
166 intros (O a l H); unfold; intros (n); unfold reverse_pordered_set in H;
167 unfold reverse_excedence in H; simplify in H; apply H;
170 lemma is_inf_to_reverse_is_sup:
171 ∀O:pordered_set.∀a:bounded_below_sequence O.∀l:O.
172 is_inf O a l → is_sup (reverse_pordered_set O) a l.
173 intros (O a l H); apply (mk_is_sup (reverse_pordered_set O));
174 [1: apply is_lower_bound_reverse_is_upper_bound; apply inf_lower_bound; assumption
175 |2: unfold reverse_pordered_set; simplify; unfold reverse_excedence; simplify;
176 intros (m H1); apply (inf_greatest_lower_bound ? ? ? H); apply H1;]
179 lemma is_sup_to_reverse_is_inf:
180 ∀O:pordered_set.∀a:bounded_above_sequence O.∀l:O.
181 is_sup O a l → is_inf (reverse_pordered_set O) a l.
182 intros (O a l H); apply (mk_is_inf (reverse_pordered_set O));
183 [1: apply is_upper_bound_reverse_is_lower_bound; apply sup_upper_bound; assumption
184 |2: unfold reverse_pordered_set; simplify; unfold reverse_excedence; simplify;
185 intros (m H1); apply (sup_least_upper_bound ? ? ? H); apply H1;]
188 lemma reverse_is_sup_to_is_inf:
189 ∀O:pordered_set.∀a:bounded_above_sequence O.∀l:O.
190 is_sup (reverse_pordered_set O) a l → is_inf O a l.
191 intros (O a l H); apply mk_is_inf;
192 [1: apply reverse_is_upper_bound_is_lower_bound;
193 apply (sup_upper_bound (reverse_pordered_set O)); assumption
194 |2: intros (v H1); apply (sup_least_upper_bound (reverse_pordered_set O) a l H v);
195 apply is_lower_bound_reverse_is_upper_bound; assumption;]
198 lemma reverse_is_inf_to_is_sup:
199 ∀O:pordered_set.∀a:bounded_above_sequence O.∀l:O.
200 is_inf (reverse_pordered_set O) a l → is_sup O a l.
201 intros (O a l H); apply mk_is_sup;
202 [1: apply reverse_is_lower_bound_is_upper_bound;
203 apply (inf_lower_bound (reverse_pordered_set O)); assumption
204 |2: intros (v H1); apply (inf_greatest_lower_bound (reverse_pordered_set O) a l H v);
205 apply is_upper_bound_reverse_is_lower_bound; assumption;]
208 definition total_order_property : ∀E:excedence. Type ≝
209 λE:excedence. ∀a,b:E. a ≰ b → b < a.
211 record tordered_set : Type ≝ {
212 tos_poset:> pordered_set;
213 tos_totality: total_order_property tos_poset