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/sequence/".
17 include "ordered_set.ma".
19 definition sequence := λO:pordered_set.nat → O.
21 definition fun_of_sequence: ∀O:pordered_set.sequence O → nat → O.
22 intros; apply s; assumption;
25 coercion cic:/matita/sequence/fun_of_sequence.con 1.
27 definition upper_bound ≝
28 λO:pordered_set.λa:sequence O.λu:O.∀n:nat.a n ≤ u.
30 definition lower_bound ≝
31 λO:pordered_set.λa:sequence O.λu:O.∀n:nat.u ≤ a n.
33 definition strong_sup ≝
34 λO:pordered_set.λs:sequence O.λx.
35 upper_bound ? s x ∧ (∀y:O.x ≰ y → ∃n.s n ≰ y).
37 definition strong_inf ≝
38 λO:pordered_set.λs:sequence O.λx.
39 lower_bound ? s x ∧ (∀y:O.y ≰ x → ∃n.y ≰ s n).
42 λO:pordered_set.λs:sequence O.λx.
43 upper_bound ? s x ∧ (∀y:O.upper_bound ? s y → x ≤ y).
46 λO:pordered_set.λs:sequence O.λx.
47 lower_bound ? s x ∧ (∀y:O.lower_bound ? s y → y ≤ x).
49 lemma strong_sup_is_weak:
50 ∀O:pordered_set.∀s:sequence O.∀x:O.strong_sup ? s x → weak_sup ? s x.
51 intros (O s x Ssup); elim Ssup (Ubx M); clear Ssup; split; [assumption]
52 intros 3 (y Uby E); cases (M ? E) (n En); unfold in Uby; cases (Uby ? En);
55 lemma strong_inf_is_weak:
56 ∀O:pordered_set.∀s:sequence O.∀x:O.strong_inf ? s x → weak_inf ? s x.
57 intros (O s x Ssup); elim Ssup (Ubx M); clear Ssup; split; [assumption]
58 intros 3 (y Uby E); cases (M ? E) (n En); unfold in Uby; cases (Uby ? En);
61 include "ordered_group.ma".
62 include "nat/orders.ma".
65 λO:ogroup.λs:sequence O.
66 ∀e:O.0 < e → ∃N.∀n.N < n → -e < s n ∧ s n < e.
68 definition increasing ≝
69 λO:pordered_set.λa:sequence O.∀n:nat.a n ≤ a (S n).
71 definition decreasing ≝
72 λO:pordered_set.λa:sequence O.∀n:nat.a (S n) ≤ a n.
77 definition is_upper_bound ≝ λO:pordered_set.λa:sequence O.λu:O.∀n:nat.a n ≤ u.
78 definition is_lower_bound ≝ λO:pordered_set.λa:sequence O.λu:O.∀n:nat.u ≤ a n.
80 record is_sup (O:pordered_set) (a:sequence O) (u:O) : Prop ≝
81 { sup_upper_bound: is_upper_bound O a u;
82 sup_least_upper_bound: ∀v:O. is_upper_bound O a v → u≤v
85 record is_inf (O:pordered_set) (a:sequence O) (u:O) : Prop ≝
86 { inf_lower_bound: is_lower_bound O a u;
87 inf_greatest_lower_bound: ∀v:O. is_lower_bound O a v → v≤u
90 record is_bounded_below (O:pordered_set) (a:sequence O) : Type ≝
92 ib_lower_bound_is_lower_bound: is_lower_bound ? a ib_lower_bound
95 record is_bounded_above (O:pordered_set) (a:sequence O) : Type ≝
97 ib_upper_bound_is_upper_bound: is_upper_bound ? a ib_upper_bound
100 record is_bounded (O:pordered_set) (a:sequence O) : Type ≝
101 { ib_bounded_below:> is_bounded_below ? a;
102 ib_bounded_above:> is_bounded_above ? a
105 record bounded_below_sequence (O:pordered_set) : Type ≝
106 { bbs_seq:> sequence O;
107 bbs_is_bounded_below:> is_bounded_below ? bbs_seq
110 record bounded_above_sequence (O:pordered_set) : Type ≝
111 { bas_seq:> sequence O;
112 bas_is_bounded_above:> is_bounded_above ? bas_seq
115 record bounded_sequence (O:pordered_set) : Type ≝
116 { bs_seq:> sequence O;
117 bs_is_bounded_below: is_bounded_below ? bs_seq;
118 bs_is_bounded_above: is_bounded_above ? bs_seq
121 definition bounded_below_sequence_of_bounded_sequence ≝
122 λO:pordered_set.λb:bounded_sequence O.
123 mk_bounded_below_sequence ? b (bs_is_bounded_below ? b).
125 coercion cic:/matita/sequence/bounded_below_sequence_of_bounded_sequence.con.
127 definition bounded_above_sequence_of_bounded_sequence ≝
128 λO:pordered_set.λb:bounded_sequence O.
129 mk_bounded_above_sequence ? b (bs_is_bounded_above ? b).
131 coercion cic:/matita/sequence/bounded_above_sequence_of_bounded_sequence.con.
133 definition lower_bound ≝
134 λO:pordered_set.λb:bounded_below_sequence O.
135 ib_lower_bound ? b (bbs_is_bounded_below ? b).
137 lemma lower_bound_is_lower_bound:
138 ∀O:pordered_set.∀b:bounded_below_sequence O.
139 is_lower_bound ? b (lower_bound ? b).
140 intros; unfold lower_bound; apply ib_lower_bound_is_lower_bound.
143 definition upper_bound ≝
144 λO:pordered_set.λb:bounded_above_sequence O.
145 ib_upper_bound ? b (bas_is_bounded_above ? b).
147 lemma upper_bound_is_upper_bound:
148 ∀O:pordered_set.∀b:bounded_above_sequence O.
149 is_upper_bound ? b (upper_bound ? b).
150 intros; unfold upper_bound; apply ib_upper_bound_is_upper_bound.
153 definition reverse_excedence: excedence → excedence.
154 intros (E); apply (mk_excedence E); [apply (λx,y.exc_relation E y x)]
155 cases E (T f cRf cTf); simplify;
156 [1: unfold Not; intros (x H); apply (cRf x); assumption
157 |2: intros (x y z); apply Or_symmetric; apply cTf; assumption;]
160 definition reverse_pordered_set: pordered_set → pordered_set.
161 intros (p); apply (mk_pordered_set (reverse_excedence p));
162 generalize in match (reverse_excedence p); intros (E);
163 apply mk_is_porder_relation;
164 [apply le_reflexive|apply le_transitive|apply le_antisymmetric]
167 lemma is_lower_bound_reverse_is_upper_bound:
168 ∀O:pordered_set.∀a:sequence O.∀l:O.
169 is_lower_bound O a l → is_upper_bound (reverse_pordered_set O) a l.
170 intros (O a l H); unfold; intros (n); unfold reverse_pordered_set;
171 unfold reverse_excedence; simplify; fold unfold le (le ? l (a n)); apply H;
174 lemma is_upper_bound_reverse_is_lower_bound:
175 ∀O:pordered_set.∀a:sequence O.∀l:O.
176 is_upper_bound O a l → is_lower_bound (reverse_pordered_set O) a l.
177 intros (O a l H); unfold; intros (n); unfold reverse_pordered_set;
178 unfold reverse_excedence; simplify; fold unfold le (le ? (a n) l); apply H;
181 lemma reverse_is_lower_bound_is_upper_bound:
182 ∀O:pordered_set.∀a:sequence O.∀l:O.
183 is_lower_bound (reverse_pordered_set O) a l → is_upper_bound O a l.
184 intros (O a l H); unfold; intros (n); unfold reverse_pordered_set in H;
185 unfold reverse_excedence in H; simplify in H; apply H;
188 lemma reverse_is_upper_bound_is_lower_bound:
189 ∀O:pordered_set.∀a:sequence O.∀l:O.
190 is_upper_bound (reverse_pordered_set O) a l → is_lower_bound O a l.
191 intros (O a l H); unfold; intros (n); unfold reverse_pordered_set in H;
192 unfold reverse_excedence in H; simplify in H; apply H;
195 lemma is_inf_to_reverse_is_sup:
196 ∀O:pordered_set.∀a:bounded_below_sequence O.∀l:O.
197 is_inf O a l → is_sup (reverse_pordered_set O) a l.
198 intros (O a l H); apply (mk_is_sup (reverse_pordered_set O));
199 [1: apply is_lower_bound_reverse_is_upper_bound; apply inf_lower_bound; assumption
200 |2: unfold reverse_pordered_set; simplify; unfold reverse_excedence; simplify;
201 intros (m H1); apply (inf_greatest_lower_bound ? ? ? H); apply H1;]
204 lemma is_sup_to_reverse_is_inf:
205 ∀O:pordered_set.∀a:bounded_above_sequence O.∀l:O.
206 is_sup O a l → is_inf (reverse_pordered_set O) a l.
207 intros (O a l H); apply (mk_is_inf (reverse_pordered_set O));
208 [1: apply is_upper_bound_reverse_is_lower_bound; apply sup_upper_bound; assumption
209 |2: unfold reverse_pordered_set; simplify; unfold reverse_excedence; simplify;
210 intros (m H1); apply (sup_least_upper_bound ? ? ? H); apply H1;]
213 lemma reverse_is_sup_to_is_inf:
214 ∀O:pordered_set.∀a:bounded_above_sequence O.∀l:O.
215 is_sup (reverse_pordered_set O) a l → is_inf O a l.
216 intros (O a l H); apply mk_is_inf;
217 [1: apply reverse_is_upper_bound_is_lower_bound;
218 apply (sup_upper_bound (reverse_pordered_set O)); assumption
219 |2: intros (v H1); apply (sup_least_upper_bound (reverse_pordered_set O) a l H v);
220 apply is_lower_bound_reverse_is_upper_bound; assumption;]
223 lemma reverse_is_inf_to_is_sup:
224 ∀O:pordered_set.∀a:bounded_above_sequence O.∀l:O.
225 is_inf (reverse_pordered_set O) a l → is_sup O a l.
226 intros (O a l H); apply mk_is_sup;
227 [1: apply reverse_is_lower_bound_is_upper_bound;
228 apply (inf_lower_bound (reverse_pordered_set O)); assumption
229 |2: intros (v H1); apply (inf_greatest_lower_bound (reverse_pordered_set O) a l H v);
230 apply is_upper_bound_reverse_is_lower_bound; assumption;]