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 (**************************************************************************)
17 include "attic/ordered_fields_ch0.ma".
19 record is_real (F:ordered_field_ch0) : Type
21 { r_archimedean: ∀x:F. ∃n:nat. x ≤ (sum_field ? n);
22 r_complete: is_complete F
25 record real: Type \def
26 { r_ordered_field_ch0:> ordered_field_ch0;
27 r_real_properties: is_real r_ordered_field_ch0
30 definition lim: ∀R:real.∀f:nat→R.is_cauchy_seq ? f → R.
32 elim (r_complete ? (r_real_properties R) ? H);
36 definition max_seq: ∀R:real.∀x,y:R. nat → R.
38 elim (cos_cotransitive R 0 (inv ? (sum_field ? (S n)) ?) (x-y));
40 | apply not_eq_sum_field_zero ;
44 | apply lt_zero_to_le_inv_zero
50 theorem cauchy_max_seq: ∀R:real.∀x,y:R. is_cauchy_seq ? (max_seq ? x y).
56 exists; [ exact m | ]; (* apply (ex_intro ? ? m); *)
59 elim (of_cotransitive R 0
60 (inv R (sum_field R (S N))
61 (not_eq_sum_field_zero R (S N) (le_S_S O N (le_O_n N)))) (x-y)
62 (lt_zero_to_le_inv_zero R (S N)
63 (not_eq_sum_field_zero R (S N) (le_S_S O N (le_O_n N)))));
65 elim (of_cotransitive R 0
66 (inv R (1+sum R (plus R) 0 1 m)
67 (not_eq_sum_field_zero R (S m) (le_S_S O m (le_O_n m)))) (x-y)
68 (lt_zero_to_le_inv_zero R (S m)
69 (not_eq_sum_field_zero R (S m) (le_S_S O m (le_O_n m)))));
71 rewrite > (plus_comm ? x (-x));
72 rewrite > opp_inverse;
74 [ apply (le_zero_x_to_le_opp_x_zero R ?);
75 apply lt_zero_to_le_inv_zero
76 | apply lt_zero_to_le_inv_zero
80 [ apply (or_transitive ? ? R ? 0);
81 [ apply (le_zero_x_to_le_opp_x_zero R ?)
88 elim (of_cotransitive R 0
89 (inv R (1+sum R (plus R) 0 1 m)
90 (not_eq_sum_field_zero R (S m) (le_S_S O m (le_O_n m)))) (x-y)
91 (lt_zero_to_le_inv_zero R (S m)
92 (not_eq_sum_field_zero R (S m) (le_S_S O m (le_O_n m)))));
96 | generalize in match (le_zero_x_to_le_opp_x_zero R ? t1);
99 rewrite > eq_opp_plus_plus_opp_opp in H1;
100 rewrite > eq_opp_opp_x_x in H1;
101 rewrite > plus_comm in H1;
102 apply (or_transitive ? ? R ? 0);
104 | apply lt_zero_to_le_inv_zero
108 rewrite > (plus_comm ? y (-y));
109 rewrite > opp_inverse;
112 | apply lt_zero_to_le_inv_zero
119 definition max: ∀R:real.R → R → R.
121 apply (lim R (max_seq R x y));
122 apply cauchy_max_seq.
125 definition abs \def λR:real.λx:R. max R x (-x).
128 ∀R:real.∀f,g:nat→R. is_cauchy_seq ? f → is_cauchy_seq ? g →
129 (∀n:nat.f n ≤ g n) → lim ? f ? ≤ lim ? g ?.
139 -(inv R (sum_field R (S n))
140 (not_eq_sum_field_zero R (S n) (le_S_S O n (le_O_n n)))).
142 axiom is_cauchy_seq_to_zero: ∀R:real. is_cauchy_seq ? (to_zero R).
144 lemma technical1: ∀R:real.lim R (to_zero R) (is_cauchy_seq_to_zero R) = 0.
150 lemma abs_x_ge_O: ∀R:real.∀x:R. 0 ≤ abs ? x.
154 rewrite < technical1;
160 (cos_cotransitive R 0
161 (inv R (sum_field R (S n))
162 (not_eq_sum_field_zero R (S n) (le_S_S O n (le_O_n n)))) (x--x)
163 (lt_zero_to_le_inv_zero R (S n)
164 (not_eq_sum_field_zero R (S n) (le_S_S O n (le_O_n n)))));