1
(************************************************************************)
2
(* v * The Coq Proof Assistant / The Coq Development Team *)
3
(* <O___,, * CNRS-Ecole Polytechnique-INRIA Futurs-Universite Paris Sud *)
4
(* \VV/ **************************************************************)
5
(* // * This file is distributed under the terms of the *)
6
(* * GNU Lesser General Public License Version 2.1 *)
7
(************************************************************************)
9
(** * This module proves some logical properties of the axiomatics of Reals
11
1. Decidablity of arithmetical statements from
12
the axiom that the order of the real numbers is decidable.
14
2. Derivability of the archimedean "axiom"
17
(** 1- Proof of the decidablity of arithmetical statements from
18
excluded middle and the axiom that the order of the real numbers is
21
(** Assuming a decidable predicate [P n], A series is constructed whose
22
[n]th term is 1/2^n if [P n] holds and 0 otherwise. This sum reaches 2
23
only if [P n] holds for all [n], otherwise the sum is less than 2.
24
Comparing the sum to 2 decides if [forall n, P n] or [~forall n, P n] *)
26
(** One can iterate this lemma and use classical logic to decide any
27
statement in the arithmetical hierarchy. *)
29
(** Contributed by Cezary Kaliszyk and Russell O'Connor *)
31
Require Import ConstructiveEpsilon.
32
Require Import Rfunctions.
33
Require Import PartSum.
34
Require Import SeqSeries.
35
Require Import RiemannInt.
36
Require Import Fourier.
38
Section Arithmetical_dec.
40
Variable P : nat -> Prop.
41
Hypothesis HP : forall n, {P n} + {~P n}.
43
Let ge_fun_sums_ge_lemma : (forall (m n : nat) (f : nat -> R), (lt m n) -> (forall i : nat, 0 <= f i) -> sum_f_R0 f m <= sum_f_R0 f n).
45
replace (sum_f_R0 f m) with (sum_f_R0 f m + 0) by ring.
46
rewrite (tech2 f m n mn).
47
apply Rplus_le_compat_l.
48
induction (n - S m)%nat; simpl in *.
50
replace 0 with (0 + 0) by ring.
51
apply (Rplus_le_compat _ _ _ _ IHn0 (fpos (S (m + S n0)%nat))).
54
Let ge_fun_sums_ge : (forall (m n : nat) (f : nat -> R), (le m n) -> (forall i : nat, 0 <= f i) -> sum_f_R0 f m <= sum_f_R0 f n).
56
elim (le_lt_or_eq _ _ mn).
57
intro; apply ge_fun_sums_ge_lemma; assumption.
58
intro H; rewrite H; auto with *.
61
Let f:=fun n => (if HP n then (1/2)^n else 0)%R.
63
Lemma cauchy_crit_geometric_dec_fun : Cauchy_crit_series f.
65
assert (X:(Pser (fun n:nat => 1) (1/2) (/ (1 - (1/2))))%R).
67
apply Rabs_def1; fourier.
68
assert (He':e/2 > 0) by fourier.
69
destruct (X _ He') as [N HN].
73
replace e with (e/2 + e/2)%R by field.
74
set (g:=(fun n0 : nat => 1 * (1 / 2) ^ n0)) in *.
75
assert (R_dist (sum_f_R0 g n) (sum_f_R0 g m) < e / 2 + e / 2).
76
apply Rle_lt_trans with (R_dist (sum_f_R0 g n) 2+R_dist 2 (sum_f_R0 g m))%R.
78
replace (/(1 - 1/2)) with 2 in HN by field.
79
cut (forall n, (n >= N)%nat -> R_dist (sum_f_R0 g n) 2 < e/2)%R.
81
apply Rplus_lt_compat.
89
eapply Rle_lt_trans;[|apply H].
90
clear -ge_fun_sums_ge n.
91
cut (forall n m, (m <= n)%nat -> R_dist (sum_f_R0 f n) (sum_f_R0 f m) <= R_dist (sum_f_R0 g n) (sum_f_R0 g m)).
93
destruct (le_lt_dec m n).
96
rewrite (R_dist_sym (sum_f_R0 g n)).
101
cut (forall i : nat, (1 / 2) ^ i >= 0). intro RPosPow.
104
cut (sum_f_R0 g m - sum_f_R0 f m <= sum_f_R0 g n - sum_f_R0 f n).
106
do 2 rewrite <- minus_sum.
107
apply (ge_fun_sums_ge m n (fun i : nat => g i - f i) Hnm).
110
elim (HP i); intro; ring_simplify; auto with *.
111
cut (sum_f_R0 g m <= sum_f_R0 g n).
113
apply (ge_fun_sums_ge m n g Hnm).
118
cut (sum_f_R0 f m <= sum_f_R0 f n).
120
apply (ge_fun_sums_ge m n f Hnm).
122
elim (HP i); intro; simpl.
132
Lemma forall_dec : {forall n, P n} + {~forall n, P n}.
134
destruct (cv_cauchy_2 _ cauchy_crit_geometric_dec_fun).
135
cut (2 <= x <-> forall n : nat, P n).
137
elim (Rle_dec 2 x); intro X.
140
assert (A:Rabs(1/2) < 1) by (apply Rabs_def1; fourier).
141
assert (A0:=(GP_infinite (1/2) A)).
144
replace 2 with (/ (1 - (1 / 2))) by field.
145
unfold Pser, infinite_sum in A0.
146
eapply Rle_cv_lim;[|unfold Un_cv; apply A0 |apply u].
149
induction n; unfold f;simpl.
150
destruct (HP 0); auto with *.
152
apply Rplus_le_compat; auto.
153
destruct (HP (S n)); auto with *.
156
destruct (HP n); auto.
157
elim (RIneq.Rle_not_lt _ _ H).
158
assert (B:0< (1/2)^n).
161
apply Rle_lt_trans with (2-(1/2)^n);[|fourier].
162
replace (/(1-1/2))%R with 2 in A0 by field.
163
set (g:= fun m => if (eq_nat_dec m n) then (1/2)^n else 0).
164
assert (Z: Un_cv (fun N : nat => sum_f_R0 g N) ((1/2)^n)).
168
replace (sum_f_R0 g a) with ((1/2)^n).
169
rewrite (R_dist_eq); assumption.
171
cut (forall a : nat, ((a >= n)%nat -> sum_f_R0 g a = (1 / 2) ^ n) /\ ((a < n)%nat -> sum_f_R0 g a = 0))%R.
180
destruct (eq_nat_dec 0 n); try reflexivity.
182
elimtype False; omega.
183
destruct IHa as [IHa0 IHa1].
186
simpl; unfold g at 2;
187
destruct (eq_nat_dec (S a) n).
194
elimtype False; omega.
198
assert (C:=CV_minus _ _ _ _ A0 Z).
199
eapply Rle_cv_lim;[|apply u |apply C].
206
destruct (eq_nat_dec 0 n).
211
induction n; simpl; fourier.
212
destruct (HP); simpl; fourier.
213
cut (f (S m) <= 1 * ((1 / 2) ^ (S m)) - g (S m)).
217
apply Rplus_le_compat.
222
destruct (eq_nat_dec (S m) n).
235
Lemma sig_forall_dec : {n | ~P n}+{forall n, P n}.
239
apply constructive_indefinite_description_nat; auto.
242
apply Classical_Pred_Type.not_all_ex_not.
246
End Arithmetical_dec.
248
(** 2- Derivability of the Archimedean axiom *)
250
(* This is a standard proof (it has been taken from PlanetMath). It is
251
formulated negatively so as to avoid the need for classical
252
logic. Using a proof of {n | ~P n}+{forall n, P n} (the one above or a
253
variant of it that does not need classical axioms) , we can in
254
principle also derive [up] and its [specification] *)
256
Theorem not_not_archimedean :
257
forall r : R, ~ (forall n : nat, (INR n <= r)%R).
259
set (E := fun r => exists n : nat, r = INR n).
260
assert (exists x : R, E x) by
261
(exists 0%R; simpl; red; exists 0%nat; reflexivity).
262
assert (bound E) by (exists r; intros x (m,H2); rewrite H2; apply H).
263
destruct (completeness E) as (M,(H3,H4)); try assumption.
264
set (M' := (M + -1)%R).
265
assert (H2 : ~ is_upper_bound E M').
267
assert (M <= M')%R by (apply H4; exact H5).
268
apply (Rlt_not_le M M').
270
pattern M at 2 in |- *.
271
rewrite <- Rplus_0_l.
272
pattern (0 + M)%R in |- *.
274
rewrite <- (Rplus_opp_r 1).
275
apply Rplus_lt_compat_l.
283
assert (H5 : (INR (S n) <= M)%R) by (apply H3; exists (S n); reflexivity).
285
assert (H6 : (INR n + 1 + -1 <= M + -1)%R).
286
apply Rplus_le_compat_r.
288
rewrite Rplus_assoc in H6.
289
rewrite Rplus_opp_r in H6.
290
rewrite (Rplus_comm (INR n) 0) in H6.
291
rewrite Rplus_0_l in H6.