]> matita.cs.unibo.it Git - helm.git/blob - matita/dama/sequence.ma
matitadep sould be ok, outputs warning regarding issues and
[helm.git] / matita / dama / sequence.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
16
17 include "excess.ma".
18
19 definition sequence := λO:excess.nat → O.
20
21 definition fun_of_sequence: ∀O:excess.sequence O → nat → O.
22 intros; apply s; assumption;
23 qed.
24
25 coercion cic:/matita/sequence/fun_of_sequence.con 1.
26
27 definition upper_bound ≝ 
28   λO:excess.λa:sequence O.λu:O.∀n:nat.a n ≤ u.
29   
30 definition lower_bound ≝ 
31   λO:excess.λa:sequence O.λu:O.∀n:nat.u ≤ a n.
32
33 definition strong_sup ≝
34   λO:excess.λs:sequence O.λx.
35     upper_bound ? s x ∧ (∀y:O.x ≰ y → ∃n.s n ≰ y).
36   
37 definition strong_inf ≝
38   λO:excess.λs:sequence O.λx.
39     lower_bound ? s x ∧ (∀y:O.y ≰ x → ∃n.y ≰ s n).
40
41 definition weak_sup ≝
42   λO:excess.λs:sequence O.λx.
43     upper_bound ? s x ∧ (∀y:O.upper_bound ? s y → x ≤ y).
44   
45 definition weak_inf ≝
46   λO:excess.λs:sequence O.λx.
47     lower_bound ? s x ∧ (∀y:O.lower_bound ? s y → y ≤ x).
48
49 lemma strong_sup_is_weak: 
50   ∀O:excess.∀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);
53 qed.
54  
55 lemma strong_inf_is_weak: 
56   ∀O:excess.∀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);
59 qed.
60
61 include "ordered_group.ma".
62 include "nat/orders.ma".
63
64 definition tends0 ≝ 
65   λO:pogroup.λs:sequence O.
66     ∀e:O.0 < e → ∃N.∀n.N < n → -e < s n ∧ s n < e.
67     
68 definition increasing ≝ 
69   λO:excess.λa:sequence O.∀n:nat.a n ≤ a (S n).
70
71 definition decreasing ≝ 
72   λO:excess.λa:sequence O.∀n:nat.a (S n) ≤ a n.
73
74
75
76
77 (*
78
79 definition is_upper_bound ≝ λO:excess.λa:sequence O.λu:O.∀n:nat.a n ≤ u.
80 definition is_lower_bound ≝ λO:excess.λa:sequence O.λu:O.∀n:nat.u ≤ a n.
81
82 record is_sup (O:excess) (a:sequence O) (u:O) : Prop ≝
83  { sup_upper_bound: is_upper_bound O a u; 
84    sup_least_upper_bound: ∀v:O. is_upper_bound O a v → u≤v
85  }.
86
87 record is_inf (O:excess) (a:sequence O) (u:O) : Prop ≝
88  { inf_lower_bound: is_lower_bound O a u; 
89    inf_greatest_lower_bound: ∀v:O. is_lower_bound O a v → v≤u
90  }.
91
92 record is_bounded_below (O:excess) (a:sequence O) : Type ≝
93  { ib_lower_bound: O;
94    ib_lower_bound_is_lower_bound: is_lower_bound ? a ib_lower_bound
95  }.
96
97 record is_bounded_above (O:excess) (a:sequence O) : Type ≝
98  { ib_upper_bound: O;
99    ib_upper_bound_is_upper_bound: is_upper_bound ? a ib_upper_bound
100  }.
101
102 record is_bounded (O:excess) (a:sequence O) : Type ≝
103  { ib_bounded_below:> is_bounded_below ? a;
104    ib_bounded_above:> is_bounded_above ? a
105  }.
106
107 record bounded_below_sequence (O:excess) : Type ≝
108  { bbs_seq:> sequence O;
109    bbs_is_bounded_below:> is_bounded_below ? bbs_seq
110  }.
111
112 record bounded_above_sequence (O:excess) : Type ≝
113  { bas_seq:> sequence O;
114    bas_is_bounded_above:> is_bounded_above ? bas_seq
115  }.
116
117 record bounded_sequence (O:excess) : Type ≝
118  { bs_seq:> sequence O;
119    bs_is_bounded_below: is_bounded_below ? bs_seq;
120    bs_is_bounded_above: is_bounded_above ? bs_seq
121  }.
122
123 definition bounded_below_sequence_of_bounded_sequence ≝
124  λO:excess.λb:bounded_sequence O.
125   mk_bounded_below_sequence ? b (bs_is_bounded_below ? b).
126
127 coercion cic:/matita/sequence/bounded_below_sequence_of_bounded_sequence.con.
128
129 definition bounded_above_sequence_of_bounded_sequence ≝
130  λO:excess.λb:bounded_sequence O.
131   mk_bounded_above_sequence ? b (bs_is_bounded_above ? b).
132
133 coercion cic:/matita/sequence/bounded_above_sequence_of_bounded_sequence.con.
134
135 definition lower_bound ≝
136  λO:excess.λb:bounded_below_sequence O.
137   ib_lower_bound ? b (bbs_is_bounded_below ? b).
138
139 lemma lower_bound_is_lower_bound:
140  ∀O:excess.∀b:bounded_below_sequence O.
141   is_lower_bound ? b (lower_bound ? b).
142 intros; unfold lower_bound; apply ib_lower_bound_is_lower_bound.
143 qed.
144
145 definition upper_bound ≝
146  λO:excess.λb:bounded_above_sequence O.
147   ib_upper_bound ? b (bas_is_bounded_above ? b).
148
149 lemma upper_bound_is_upper_bound:
150  ∀O:excess.∀b:bounded_above_sequence O.
151   is_upper_bound ? b (upper_bound ? b).
152 intros; unfold upper_bound; apply ib_upper_bound_is_upper_bound.
153 qed.
154
155 definition reverse_excess: excess → excess.
156 intros (E); apply (mk_excess E); [apply (λx,y.exc_relation E y x)] 
157 cases E (T f cRf cTf); simplify; 
158 [1: unfold Not; intros (x H); apply (cRf x); assumption
159 |2: intros (x y z); apply Or_symmetric; apply cTf; assumption;]
160 qed. 
161
162 definition reverse_excess: excess → excess.
163 intros (p); apply (mk_excess (reverse_excess p));
164 generalize in match (reverse_excess p); intros (E);
165 apply mk_is_porder_relation;
166 [apply le_reflexive|apply le_transitive|apply le_antisymmetric]
167 qed. 
168  
169 lemma is_lower_bound_reverse_is_upper_bound:
170  ∀O:excess.∀a:sequence O.∀l:O.
171   is_lower_bound O a l → is_upper_bound (reverse_excess O) a l.
172 intros (O a l H); unfold; intros (n); unfold reverse_excess;
173 unfold reverse_excess; simplify; fold unfold le (le ? l (a n)); apply H;    
174 qed.
175
176 lemma is_upper_bound_reverse_is_lower_bound:
177  ∀O:excess.∀a:sequence O.∀l:O.
178   is_upper_bound O a l → is_lower_bound (reverse_excess O) a l.
179 intros (O a l H); unfold; intros (n); unfold reverse_excess;
180 unfold reverse_excess; simplify; fold unfold le (le ? (a n) l); apply H;    
181 qed.
182
183 lemma reverse_is_lower_bound_is_upper_bound:
184  ∀O:excess.∀a:sequence O.∀l:O.
185   is_lower_bound (reverse_excess O) a l → is_upper_bound O a l.
186 intros (O a l H); unfold; intros (n); unfold reverse_excess in H;
187 unfold reverse_excess in H; simplify in H; apply H;    
188 qed.
189
190 lemma reverse_is_upper_bound_is_lower_bound:
191  ∀O:excess.∀a:sequence O.∀l:O.
192   is_upper_bound (reverse_excess O) a l → is_lower_bound O a l.
193 intros (O a l H); unfold; intros (n); unfold reverse_excess in H;
194 unfold reverse_excess in H; simplify in H; apply H;    
195 qed.
196
197 lemma is_inf_to_reverse_is_sup:
198  ∀O:excess.∀a:bounded_below_sequence O.∀l:O.
199   is_inf O a l → is_sup (reverse_excess O) a l.
200 intros (O a l H); apply (mk_is_sup (reverse_excess O));
201 [1: apply is_lower_bound_reverse_is_upper_bound; apply inf_lower_bound; assumption
202 |2: unfold reverse_excess; simplify; unfold reverse_excess; simplify; 
203     intros (m H1); apply (inf_greatest_lower_bound ? ? ? H); apply H1;]
204 qed.
205
206 lemma is_sup_to_reverse_is_inf:
207  ∀O:excess.∀a:bounded_above_sequence O.∀l:O.
208   is_sup O a l → is_inf (reverse_excess O) a l.
209 intros (O a l H); apply (mk_is_inf (reverse_excess O));
210 [1: apply is_upper_bound_reverse_is_lower_bound; apply sup_upper_bound; assumption
211 |2: unfold reverse_excess; simplify; unfold reverse_excess; simplify; 
212     intros (m H1); apply (sup_least_upper_bound ? ? ? H); apply H1;]
213 qed.
214
215 lemma reverse_is_sup_to_is_inf:
216  ∀O:excess.∀a:bounded_above_sequence O.∀l:O.
217   is_sup (reverse_excess O) a l → is_inf O a l.
218 intros (O a l H); apply mk_is_inf;
219 [1: apply reverse_is_upper_bound_is_lower_bound; 
220     apply (sup_upper_bound (reverse_excess O)); assumption
221 |2: intros (v H1); apply (sup_least_upper_bound (reverse_excess O) a l H v);
222     apply is_lower_bound_reverse_is_upper_bound; assumption;]
223 qed.
224
225 lemma reverse_is_inf_to_is_sup:
226  ∀O:excess.∀a:bounded_above_sequence O.∀l:O.
227   is_inf (reverse_excess O) a l → is_sup O a l.
228 intros (O a l H); apply mk_is_sup;
229 [1: apply reverse_is_lower_bound_is_upper_bound; 
230     apply (inf_lower_bound (reverse_excess O)); assumption
231 |2: intros (v H1); apply (inf_greatest_lower_bound (reverse_excess O) a l H v);
232     apply is_upper_bound_reverse_is_lower_bound; assumption;]
233 qed.
234
235 *)