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 "higher_order_defs/relations.ma".
18 include "nat/plus.ma".
19 include "constructive_connectives.ma".
21 record pre_ordered_set (C:Type) : Type ≝
24 definition carrier_of_pre_ordered_set ≝ λC:Type.λO:pre_ordered_set C.C.
26 coercion cic:/matita/ordered_sets/carrier_of_pre_ordered_set.con.
28 definition os_le: ∀C.∀O:pre_ordered_set C.O → O → Prop ≝ le_.
30 interpretation "Ordered Sets le" 'leq a b =
31 (cic:/matita/ordered_sets/os_le.con _ _ a b).
33 definition cotransitive ≝
34 λC:Type.λle:C→C→Prop.∀x,y,z:C. le x y → le x z ∨ le z y.
36 definition antisimmetric ≝
37 λC:Type.λle:C→C→Prop.∀x,y:C. le x y → le y x → x=y.
39 record is_order_relation (C) (O:pre_ordered_set C) : Type ≝
40 { or_reflexive: reflexive ? (os_le ? O);
41 or_transitive: transitive ? (os_le ? O);
42 or_antisimmetric: antisimmetric ? (os_le ? O)
45 record ordered_set (C:Type): Type ≝
46 { os_pre_ordered_set:> pre_ordered_set C;
47 os_order_relation_properties:> is_order_relation ? os_pre_ordered_set
50 theorem antisimmetric_to_cotransitive_to_transitive:
51 ∀C.∀le:relation C. antisimmetric ? le → cotransitive ? le →
58 | rewrite < (H ? ? H2 t);
63 definition is_increasing ≝ λC.λO:ordered_set C.λa:nat→O.∀n:nat.a n ≤ a (S n).
64 definition is_decreasing ≝ λC.λO:ordered_set C.λa:nat→O.∀n:nat.a (S n) ≤ a n.
66 definition is_upper_bound ≝ λC.λO:ordered_set C.λa:nat→O.λu:O.∀n:nat.a n ≤ u.
67 definition is_lower_bound ≝ λC.λO:ordered_set C.λa:nat→O.λu:O.∀n:nat.u ≤ a n.
69 record is_sup (C:Type) (O:ordered_set C) (a:nat→O) (u:O) : Prop ≝
70 { sup_upper_bound: is_upper_bound ? O a u;
71 sup_least_upper_bound: ∀v:O. is_upper_bound ? O a v → u≤v
74 record is_inf (C:Type) (O:ordered_set C) (a:nat→O) (u:O) : Prop ≝
75 { inf_lower_bound: is_lower_bound ? O a u;
76 inf_greatest_lower_bound: ∀v:O. is_lower_bound ? O a v → v≤u
79 record is_bounded_below (C:Type) (O:ordered_set C) (a:nat→O) : Type ≝
81 ib_lower_bound_is_lower_bound: is_lower_bound ? ? a ib_lower_bound
84 record is_bounded_above (C:Type) (O:ordered_set C) (a:nat→O) : Type ≝
86 ib_upper_bound_is_upper_bound: is_upper_bound ? ? a ib_upper_bound
89 record is_bounded (C:Type) (O:ordered_set C) (a:nat→O) : Type ≝
90 { ib_bounded_below:> is_bounded_below ? ? a;
91 ib_bounded_above:> is_bounded_above ? ? a
94 record bounded_below_sequence (C:Type) (O:ordered_set C) : Type ≝
96 bbs_is_bounded_below:> is_bounded_below ? ? bbs_seq
99 record bounded_above_sequence (C:Type) (O:ordered_set C) : Type ≝
101 bas_is_bounded_above:> is_bounded_above ? ? bas_seq
104 record bounded_sequence (C:Type) (O:ordered_set C) : Type ≝
106 bs_is_bounded_below: is_bounded_below ? ? bs_seq;
107 bs_is_bounded_above: is_bounded_above ? ? bs_seq
110 definition bounded_below_sequence_of_bounded_sequence ≝
111 λC.λO:ordered_set C.λb:bounded_sequence ? O.
112 mk_bounded_below_sequence ? ? b (bs_is_bounded_below ? ? b).
114 coercion cic:/matita/ordered_sets/bounded_below_sequence_of_bounded_sequence.con.
116 definition bounded_above_sequence_of_bounded_sequence ≝
117 λC.λO:ordered_set C.λb:bounded_sequence ? O.
118 mk_bounded_above_sequence ? ? b (bs_is_bounded_above ? ? b).
120 coercion cic:/matita/ordered_sets/bounded_above_sequence_of_bounded_sequence.con.
122 definition lower_bound ≝
123 λC.λO:ordered_set C.λb:bounded_below_sequence ? O.
124 ib_lower_bound ? ? b (bbs_is_bounded_below ? ? b).
126 lemma lower_bound_is_lower_bound:
127 ∀C.∀O:ordered_set C.∀b:bounded_below_sequence ? O.
128 is_lower_bound ? ? b (lower_bound ? ? b).
131 apply ib_lower_bound_is_lower_bound.
134 definition upper_bound ≝
135 λC.λO:ordered_set C.λb:bounded_above_sequence ? O.
136 ib_upper_bound ? ? b (bas_is_bounded_above ? ? b).
138 lemma upper_bound_is_upper_bound:
139 ∀C.∀O:ordered_set C.∀b:bounded_above_sequence ? O.
140 is_upper_bound ? ? b (upper_bound ? ? b).
143 apply ib_upper_bound_is_upper_bound.
146 record is_dedekind_sigma_complete (C:Type) (O:ordered_set C) : Type ≝
147 { dsc_inf: ∀a:nat→O.∀m:O. is_lower_bound ? ? a m → ex ? (λs:O.is_inf ? O a s);
148 dsc_inf_proof_irrelevant:
149 ∀a:nat→O.∀m,m':O.∀p:is_lower_bound ? ? a m.∀p':is_lower_bound ? ? a m'.
150 (match dsc_inf a m p with [ ex_intro s _ ⇒ s ]) =
151 (match dsc_inf a m' p' with [ ex_intro s' _ ⇒ s' ]);
152 dsc_sup: ∀a:nat→O.∀m:O. is_upper_bound ? ? a m → ex ? (λs:O.is_sup ? O a s);
153 dsc_sup_proof_irrelevant:
154 ∀a:nat→O.∀m,m':O.∀p:is_upper_bound ? ? a m.∀p':is_upper_bound ? ? a m'.
155 (match dsc_sup a m p with [ ex_intro s _ ⇒ s ]) =
156 (match dsc_sup a m' p' with [ ex_intro s' _ ⇒ s' ])
159 record dedekind_sigma_complete_ordered_set (C:Type) : Type ≝
160 { dscos_ordered_set:> ordered_set C;
161 dscos_dedekind_sigma_complete_properties:>
162 is_dedekind_sigma_complete ? dscos_ordered_set
166 ∀C:Type.∀O:dedekind_sigma_complete_ordered_set C.
167 bounded_below_sequence ? O → O.
170 (dsc_inf ? O (dscos_dedekind_sigma_complete_properties ? O) b);
172 | apply (lower_bound ? ? b)
173 | apply lower_bound_is_lower_bound
178 ∀C:Type.∀O:dedekind_sigma_complete_ordered_set C.
179 ∀a:bounded_below_sequence ? O.
180 is_inf ? ? a (inf ? ? a).
184 elim (dsc_inf C O (dscos_dedekind_sigma_complete_properties C O) a
185 (lower_bound C O a) (lower_bound_is_lower_bound C O a));
190 lemma inf_proof_irrelevant:
191 ∀C:Type.∀O:dedekind_sigma_complete_ordered_set C.
192 ∀a,a':bounded_below_sequence ? O.
193 bbs_seq ? ? a = bbs_seq ? ? a' →
194 inf ? ? a = inf ? ? a'.
199 generalize in match i1;
204 rewrite < (dsc_inf_proof_irrelevant C O O f (ib_lower_bound ? ? f i2)
205 (ib_lower_bound ? ? f i) (ib_lower_bound_is_lower_bound ? ? f i2)
206 (ib_lower_bound_is_lower_bound ? ? f i));
211 ∀C:Type.∀O:dedekind_sigma_complete_ordered_set C.
212 bounded_above_sequence ? O → O.
215 (dsc_sup ? O (dscos_dedekind_sigma_complete_properties ? O) b);
217 | apply (upper_bound ? ? b)
218 | apply upper_bound_is_upper_bound
223 ∀C:Type.∀O:dedekind_sigma_complete_ordered_set C.
224 ∀a:bounded_above_sequence ? O.
225 is_sup ? ? a (sup ? ? a).
229 elim (dsc_sup C O (dscos_dedekind_sigma_complete_properties C O) a
230 (upper_bound C O a) (upper_bound_is_upper_bound C O a));
235 lemma sup_proof_irrelevant:
236 ∀C:Type.∀O:dedekind_sigma_complete_ordered_set C.
237 ∀a,a':bounded_above_sequence ? O.
238 bas_seq ? ? a = bas_seq ? ? a' →
239 sup ? ? a = sup ? ? a'.
244 generalize in match i1;
249 rewrite < (dsc_sup_proof_irrelevant C O O f (ib_upper_bound ? ? f i2)
250 (ib_upper_bound ? ? f i) (ib_upper_bound_is_upper_bound ? ? f i2)
251 (ib_upper_bound_is_upper_bound ? ? f i));
258 ∀C:Type.∀O:dedekind_sigma_complete_ordered_set C.
259 ∀a:bounded_sequence ? O. inf ? ? a ≤ sup ? ? a.
261 apply (or_transitive ? ? O' ? (a O));
262 [ elim daemon (*apply (inf_lower_bound ? ? ? ? (inf_is_inf ? ? a))*)
263 | elim daemon (*apply (sup_upper_bound ? ? ? ? (sup_is_sup ? ? a))*)
267 lemma inf_respects_le:
268 ∀C:Type.∀O:dedekind_sigma_complete_ordered_set C.
269 ∀a:bounded_below_sequence ? O.∀m:O.
270 is_upper_bound ? ? a m → inf ? ? a ≤ m.
272 apply (or_transitive ? ? O' ? (sup ? ? (mk_bounded_sequence ? ? a ? ?)));
273 [ apply (bbs_is_bounded_below ? ? a)
274 | apply (mk_is_bounded_above ? ? ? m H)
277 (sup_least_upper_bound ? ? ? ?
278 (sup_is_sup ? ? (mk_bounded_sequence C O' a a
279 (mk_is_bounded_above C O' a m H))));
284 definition is_sequentially_monotone ≝
285 λC.λO:ordered_set C.λf:O→O.
286 ∀a:nat→O.∀p:is_increasing ? ? a.
287 is_increasing ? ? (λi.f (a i)).
289 record is_order_continuous (C)
290 (O:dedekind_sigma_complete_ordered_set C) (f:O→O) : Prop
292 { ioc_is_sequentially_monotone: is_sequentially_monotone ? ? f;
293 ioc_is_upper_bound_f_sup:
294 ∀a:bounded_above_sequence ? O.
295 is_upper_bound ? ? (λi.f (a i)) (f (sup ? ? a));
297 ∀a:bounded_above_sequence ? O.
298 is_increasing ? ? a →
300 sup ? ? (mk_bounded_above_sequence ? ? (λi.f (a i))
301 (mk_is_bounded_above ? ? ? (f (sup ? ? a))
302 (ioc_is_upper_bound_f_sup a)));
303 ioc_is_lower_bound_f_inf:
304 ∀a:bounded_below_sequence ? O.
305 is_lower_bound ? ? (λi.f (a i)) (f (inf ? ? a));
307 ∀a:bounded_below_sequence ? O.
308 is_decreasing ? ? a →
310 inf ? ? (mk_bounded_below_sequence ? ? (λi.f (a i))
311 (mk_is_bounded_below ? ? ? (f (inf ? ? a))
312 (ioc_is_lower_bound_f_inf a)))
315 theorem tail_inf_increasing:
316 ∀C.∀O:dedekind_sigma_complete_ordered_set C.
317 ∀a:bounded_below_sequence ? O.
318 let y ≝ λi.mk_bounded_below_sequence ? ? (λj.a (i+j)) ? in
319 let x ≝ λi.inf ? ? (y i) in
321 [ apply (mk_is_bounded_below ? ? ? (ib_lower_bound ? ? a a));
324 apply (ib_lower_bound_is_lower_bound ? ? a a)
326 unfold is_increasing;
328 unfold x in ⊢ (? ? ? ? %);
329 apply (inf_greatest_lower_bound ? ? ? ? (inf_is_inf ? ? (y (S n))));
330 change with (is_lower_bound ? ? (y (S n)) (inf ? ? (y n)));
331 unfold is_lower_bound;
333 generalize in match (inf_lower_bound ? ? ? ? (inf_is_inf ? ? (y n)) (S n1));
334 (*CSC: coercion per FunClass inserita a mano*)
335 suppose (inf ? ? (y n) ≤ bbs_seq ? ? (y n) (S n1)) (H);
336 cut (bbs_seq ? ? (y n) (S n1) = bbs_seq ? ? (y (S n)) n1);
341 auto paramodulation library
346 definition is_liminf:
347 ∀C:Type.∀O:dedekind_sigma_complete_ordered_set C.
348 bounded_below_sequence ? O → O → Prop.
351 (is_sup ? ? (λi.inf ? ? (mk_bounded_below_sequence ? ? (λj.b (i+j)) ?)) t);
352 apply (mk_is_bounded_below ? ? ? (ib_lower_bound ? ? b b));
355 apply (ib_lower_bound_is_lower_bound ? ? b b).
359 ∀C:Type.∀O:dedekind_sigma_complete_ordered_set C.
360 bounded_sequence ? O → O.
364 (mk_bounded_above_sequence ? ?
366 (mk_bounded_below_sequence ? ?
367 (λj.b (i+j)) ?)) ?));
368 [ apply (mk_is_bounded_below ? ? ? (ib_lower_bound ? ? b b));
371 apply (ib_lower_bound_is_lower_bound ? ? b b)
372 | apply (mk_is_bounded_above ? ? ? (ib_upper_bound ? ? b b));
373 unfold is_upper_bound;
377 (mk_bounded_below_sequence C O (\lambda j:nat.b (n+j))
378 (mk_is_bounded_below C O (\lambda j:nat.b (n+j)) (ib_lower_bound C O b b)
379 (\lambda j:nat.ib_lower_bound_is_lower_bound C O b b (n+j))))
380 \leq ib_upper_bound C O b b);
381 apply (inf_respects_le ? O);
384 apply (ib_upper_bound_is_upper_bound ? ? b b)
388 notation "hvbox(〈a〉)"
389 non associative with precedence 45
390 for @{ 'hide_everything_but $a }.
392 interpretation "mk_bounded_above_sequence" 'hide_everything_but a
393 = (cic:/matita/ordered_sets/bounded_above_sequence.ind#xpointer(1/1/1) _ _ a _).
395 interpretation "mk_bounded_below_sequence" 'hide_everything_but a
396 = (cic:/matita/ordered_sets/bounded_below_sequence.ind#xpointer(1/1/1) _ _ a _).
398 theorem eq_f_sup_sup_f:
399 ∀C.∀O':dedekind_sigma_complete_ordered_set C.
400 ∀f:O'→O'. ∀H:is_order_continuous ? ? f.
401 ∀a:bounded_above_sequence ? O'.
402 ∀p:is_increasing ? ? a.
403 f (sup ? ? a) = sup ? ? (mk_bounded_above_sequence ? ? (λi.f (a i)) ?).
404 [ apply (mk_is_bounded_above ? ? ? (f (sup ? ? a)));
405 apply ioc_is_upper_bound_f_sup;
408 apply ioc_respects_sup;
413 theorem eq_f_sup_sup_f':
414 ∀C.∀O':dedekind_sigma_complete_ordered_set C.
415 ∀f:O'→O'. ∀H:is_order_continuous ? ? f.
416 ∀a:bounded_above_sequence ? O'.
417 ∀p:is_increasing ? ? a.
418 ∀p':is_bounded_above ? ? (λi.f (a i)).
419 f (sup ? ? a) = sup ? ? (mk_bounded_above_sequence ? ? (λi.f (a i)) p').
421 rewrite > (eq_f_sup_sup_f ? ? f H a H1);
422 apply sup_proof_irrelevant;
426 theorem eq_f_liminf_sup_f_inf:
427 ∀C.∀O':dedekind_sigma_complete_ordered_set C.
428 ∀f:O'→O'. ∀H:is_order_continuous ? ? f.
429 ∀a:bounded_sequence ? O'.
433 (mk_bounded_above_sequence ? ?
435 (mk_bounded_below_sequence ? ?
439 [ apply (mk_is_bounded_below ? ? ? (ib_lower_bound ? ? a a));
442 apply (ib_lower_bound_is_lower_bound ? ? a a)
443 | apply (mk_is_bounded_above ? ? ? (f (sup ? ? a)));
444 unfold is_upper_bound;
446 apply (or_transitive ? ? O' ? (f (a n)));
447 [ generalize in match (ioc_is_lower_bound_f_inf ? ? ? H);
450 rewrite > (plus_n_O n) in ⊢ (? ? ? ? (? (? ? ? ? %)));
451 apply (H1 (mk_bounded_below_sequence C O' (\lambda j:nat.a (n+j))
452 (mk_is_bounded_below C O' (\lambda j:nat.a (n+j)) (ib_lower_bound C O' a a)
453 (\lambda j:nat.ib_lower_bound_is_lower_bound C O' a a (n+j)))) O);
454 | elim daemon (*apply (ioc_is_upper_bound_f_sup ? ? ? H)*)
459 generalize in match (\lambda n:nat
460 .inf_respects_le C O'
461 (mk_bounded_below_sequence C O' (\lambda j:nat.a (plus n j))
462 (mk_is_bounded_below C O' (\lambda j:nat.a (plus n j))
463 (ib_lower_bound C O' a a)
464 (\lambda j:nat.ib_lower_bound_is_lower_bound C O' a a (plus n j))))
465 (ib_upper_bound C O' a a)
466 (\lambda n1:nat.ib_upper_bound_is_upper_bound C O' a a (plus n n1)));
468 apply (eq_f_sup_sup_f' ? ? f H (mk_bounded_above_sequence C O'
471 (mk_bounded_below_sequence C O' (\lambda j:nat.a (plus i j))
472 (mk_is_bounded_below C O' (\lambda j:nat.a (plus i j))
473 (ib_lower_bound C O' a a)
474 (\lambda n:nat.ib_lower_bound_is_lower_bound C O' a a (plus i n)))))
475 (mk_is_bounded_above C O'
478 (mk_bounded_below_sequence C O' (\lambda j:nat.a (plus i j))
479 (mk_is_bounded_below C O' (\lambda j:nat.a (plus i j))
480 (ib_lower_bound C O' a a)
481 (\lambda n:nat.ib_lower_bound_is_lower_bound C O' a a (plus i n)))))
482 (ib_upper_bound C O' a a) p2)));
485 (is_increasing ? ? (\lambda i:nat
487 (mk_bounded_below_sequence C O' (\lambda j:nat.a (plus i j))
488 (mk_is_bounded_below C O' (\lambda j:nat.a (plus i j))
489 (ib_lower_bound C O' a a)
490 (\lambda n:nat.ib_lower_bound_is_lower_bound C O' a a (plus i n))))));
491 apply tail_inf_increasing
498 definition lt ≝ λC.λO:ordered_set C.λa,b:O.a ≤ b ∧ a ≠ b.
500 interpretation "Ordered set lt" 'lt a b =
501 (cic:/matita/ordered_sets/lt.con _ _ a b).