Require Import Reals Sums Lra Lia.
Require Import Coquelicot.Coquelicot.
Require Import LibUtils.
Require Import sumtest.
Require Import RealAdd.
Set Bullet Behavior "
Strict Subproofs".
Section fold_iter.
Lemma fold_right_mult_acc (
acc :
R) (
l :
list R) :
List.fold_right Rmult acc l =
List.fold_right Rmult 1
l *
acc.
Proof.
revert acc.
induction l; simpl; intros acc.
- lra.
- rewrite IHl.
lra.
Qed.
Lemma iota_is_an_annoying_seq m n :
seq.iota m n =
List.seq m n.
Proof.
revert m.
induction n; simpl; trivial.
Qed.
Lemma fold_right_mult_pos {
A} (
a:
A ->
posreal) (
l:
list A) :
0 <
List.fold_right (
fun (
a1 :
A) (
b :
R) =>
a a1 *
b) 1
l.
Proof.
Lemma fold_right_max_upper_list acc l x :
List.In x l ->
x <=
List.fold_right Rmax acc l.
Proof.
induction l;
simpl;
intros inn; [
intuition | ].
destruct inn.
-
subst.
apply Rmax_l.
-
specialize (
IHl H).
eapply Rle_trans.
+
eapply IHl.
+
apply Rmax_r.
Qed.
Lemma fold_right_max_upper_acc acc l :
acc <=
List.fold_right Rmax acc l.
Proof.
induction l;
simpl.
-
lra.
-
eapply Rle_trans.
+
eapply IHl.
+
apply Rmax_r.
Qed.
Lemma fold_right_max_in acc l :
(
List.fold_right Rmax acc l) =
acc \/
List.In (
List.fold_right Rmax acc l)
l.
Proof.
induction l;
simpl.
-
intuition.
-
destruct IHl.
+
rewrite H.
apply Rmax_case;
eauto.
+
apply Rmax_case;
eauto.
Qed.
Lemma fold_right_max_acc (
acc1 acc2 :
R) (
l :
list R) :
Rmax acc2 (
List.fold_right Rmax acc1 l) =
Rmax acc1 (
List.fold_right Rmax acc2 l).
Proof.
Lemma fold_right_plus_acc {
G:
AbelianGroup} (
f :
nat ->
G) (
acc :
G) (
l :
list nat) :
List.fold_right (
fun (
i :
nat) (
acc :
G) =>
plus (
f i)
acc)
acc l =
plus (
List.fold_right (
fun (
i :
nat) (
acc :
G) =>
plus (
f i)
acc)
zero l)
acc.
Proof.
revert acc.
induction l;
simpl;
intros acc.
-
now rewrite plus_zero_l.
-
rewrite IHl.
now rewrite plus_assoc.
Qed.
Lemma fold_right_rmax_const acc l c:
0 <=
c ->
List.fold_right Rmax acc l *
c =
List.fold_right Rmax (
acc*
c) (
List.map (
fun x =>
x *
c)
l).
Proof.
induction l;
simpl;
trivial;
intros.
rewrite <-
IHl by trivial.
repeat rewrite (
Rmult_comm _ c).
now rewrite RmaxRmult by trivial.
Qed.
Lemma iter_plus_times_const {
A}
F (
l:
list A)
c :
Iter.iter Rplus 0
l (
fun k =>
F k *
c) =
Iter.iter Rplus 0
l (
fun k =>
F k) *
c.
Proof.
induction l; simpl; intros.
- lra.
- rewrite IHl.
lra.
Qed.
Lemma list_seq_init_map init len :
List.seq init len =
List.map (
fun x => (
init +
x)%
nat) (
List.seq 0
len).
Proof.
End fold_iter.
Section products.
Definition part_prod_n (
a :
nat ->
posreal) (
n m :
nat) :
R :=
List.fold_right Rmult 1 (
List.map (
fun x => (
a x).(
pos)) (
List.seq n (
S m -
n)%
nat)).
Definition part_prod (
a :
nat ->
posreal) (
n :
nat) :
R :=
part_prod_n a 0
n.
Lemma pos_part_prod_n (
a :
nat ->
posreal) (
m n :
nat) :
0 <
part_prod_n a m n.
Proof.
Lemma pos_part_prod (
a :
nat ->
posreal) (
n :
nat) :
0 <
part_prod a n.
Proof.
Definition part_prod_n_pos (
a :
nat ->
posreal) (
m n :
nat) :
posreal :=
mkposreal (
part_prod_n a m n) (
pos_part_prod_n a m n).
Definition part_prod_pos (
a :
nat ->
posreal) (
n :
nat) :
posreal :=
mkposreal (
part_prod a n) (
pos_part_prod a n).
Lemma part_prod_n_S a m n :
(
m <=
S n)%
nat ->
(
part_prod_n a m (
S n)) =
part_prod_n a m n *
a (
S n).
Proof.
Lemma part_prod_n_k_k a k :
part_prod_n a k k =
a k.
Proof.
unfold part_prod_n.
replace (
S k -
k)%
nat with (1%
nat)
by lia.
simpl;
lra.
Qed.
Lemma part_prod_n_1 a m n :
(
m >
n)%
nat ->
(
part_prod_n a m n) = 1.
Proof.
intros.
unfold part_prod_n.
replace (
S n -
m)%
nat with (0%
nat)
by lia.
now simpl.
Qed.
Theorem ln_part_prod (
a :
nat ->
posreal) (
n :
nat) :
ln (
part_prod_pos a n) =
sum_n (
fun n1 =>
ln (
a n1))
n.
Proof.
Lemma initial_seg_prod (
a :
nat ->
posreal) (
m k:
nat):
part_prod a (
m +
S k)%
nat = (
part_prod a m) * (
part_prod_n a (
S m) (
m +
S k)%
nat).
Proof.
Lemma initial_seg_prod_n (
a :
nat ->
posreal) (
k m n:
nat):
(
k <=
m)%
nat ->
part_prod_n a k (
S m +
n)%
nat = (
part_prod_n a k m) * (
part_prod_n a (
S m) (
S m +
n)%
nat).
Proof.
Lemma part_prod_n_shift (
F :
nat ->
posreal) (
m n:
nat) :
part_prod_n (
fun k :
nat =>
F (
m +
k)%
nat) 0
n =
part_prod_n F m (
n +
m).
Proof.
unfold part_prod_n.
f_equal.
replace (
S n - 0)%
nat with (
S n)
by lia.
replace (
S (
n +
m) -
m)%
nat with (
S n)
by lia.
induction n.
-
simpl.
now replace (
m + 0)%
nat with (
m)
by lia.
-
replace (
S (
S n))
with (
S n+1)%
nat by lia.
rewrite seq_plus,
seq_plus,
List.map_app.
rewrite IHn.
replace (
S n)
with (
n+1)%
nat by lia.
rewrite List.map_app.
now simpl.
Qed.
Lemma initial_seg_prod2 (
a :
nat ->
posreal) (
m k:
nat):
part_prod a (
k +
S m)%
nat =
(
part_prod a m) * (
part_prod (
fun k0 :
nat =>
a (
S m +
k0)%
nat)
k).
Proof.
Program Definition pos_sq (
c :
posreal) :
posreal :=
mkposreal (
c *
c)
_.
Next Obligation.
Definition pos_sq_fun (
a :
nat ->
posreal) : (
nat ->
posreal) :=
fun n =>
pos_sq (
a n).
Lemma part_prod_pos_sq_pos (
a :
nat ->
posreal) (
n:
nat) :
(
part_prod_pos (
pos_sq_fun a)
n).(
pos) = (
pos_sq_fun (
part_prod_pos a)
n).(
pos).
Proof.
Lemma inf_prod_sq_0 (
a :
nat ->
posreal) :
is_lim_seq (
part_prod_pos a) 0 ->
is_lim_seq (
part_prod_pos (
pos_sq_fun a)) 0.
Proof.
Lemma inf_prod_m_0 (
a :
nat ->
posreal):
is_lim_seq (
part_prod_pos a) 0 ->
forall (
m:
nat),
is_lim_seq (
part_prod_pos (
fun n =>
a (
m +
n)%
nat)) 0.
Proof.
Lemma inf_prod_n_m_0 (
a :
nat ->
posreal):
is_lim_seq (
part_prod_pos a) 0 ->
forall (
m:
nat),
is_lim_seq (
part_prod_n_pos a m) 0.
Proof.
End products.
Section series_sequences.
Lemma series_seq (
a :
nat ->
R) (
l:
R) :
is_series a l <->
is_lim_seq (
sum_n a)
l.
Proof.
Lemma log_product_iff_sum_logs (
a :
nat ->
posreal) (
l:
R):
is_lim_seq (
fun n => (
ln (
part_prod_pos a n)))
l <->
is_series (
fun n =>
ln (
a n))
l .
Proof.
Lemma derivable_pt_ln (
x:
R) :
0 <
x ->
derivable_pt ln x.
Proof.
Lemma log_product_iff_product (
a :
nat ->
posreal) (
l:
posreal):
is_lim_seq (
fun n => (
ln (
part_prod_pos a n))) (
ln l) <->
is_lim_seq (
part_prod_pos a)
l .
Proof.
Lemma is_product_iff_is_log_sum (
a :
nat ->
posreal) (
l:
posreal) :
is_lim_seq (
part_prod_pos a)
l <->
is_series (
fun n =>
ln (
a n)) (
ln l).
Proof.
Lemma is_lim_seq_pos (
a :
nat ->
posreal) (
l:
R) (
lb:
posreal):
(
forall n,
lb <=
a n) ->
is_lim_seq a l -> 0 <
l.
Proof.
Lemma ex_product_iff_ex_log_sum (
a :
nat ->
posreal) (
lb:
posreal):
(
forall n,
lb <=
part_prod_pos a n) ->
ex_finite_lim_seq (
part_prod_pos a) <->
ex_series (
fun n =>
ln (
a n)).
Proof.
Lemma sum_split {
G :
AbelianGroup} (
f :
nat ->
G) (
n1 n2 m :
nat) :
(
n1 <=
m)%
nat -> (
m <
n2)%
nat ->
sum_n_m f n1 n2 =
plus (
sum_n_m f n1 m) (
sum_n_m f (
S m)
n2).
Proof.
Lemma sum_split_plus {
G :
AbelianGroup} (
f :
nat ->
G) (
n1 n2 k :
nat) :
(
n1 <=
n2)%
nat -> (0 <
k)%
nat ->
sum_n_m f n1 (
n2 +
k) =
plus (
sum_n_m f n1 n2) (
sum_n_m f (
S n2) (
n2 +
k)).
Proof.
Lemma ex_seq_sum_shift (α :
nat ->
R) (
nk:
nat):
ex_lim_seq (
sum_n α) ->
ex_lim_seq (
sum_n (
fun n0 => α (
n0 +
nk)%
nat)).
Proof.
Lemma nneg_sum_n_m_sq (
a :
nat ->
R) (
n m :
nat) :
0 <=
sum_n_m (
fun k =>
Rsqr (
a k))
n m.
Proof.
Lemma nneg_series (
a :
nat ->
R) :
(
forall n, 0 <=
a n) ->
ex_series a ->
0 <=
Series a.
Proof.
Lemma nneg_series_sq (
a :
nat ->
R) :
ex_series (
fun n =>
Rsqr (
a n)) ->
0 <=
Series (
fun n =>
Rsqr (
a n)).
Proof.
Lemma sub_sum_limit_nneg (
a :
nat ->
R) (
n:
nat) :
(
forall n, 0 <=
a n) ->
ex_series a ->
sum_n a n <=
Series a.
Proof.
Lemma sub_sum_limit_sq (
a :
nat ->
R) (
n:
nat) :
let fnsq := (
fun n =>
Rsqr (
a n))
in
ex_series fnsq ->
sum_n fnsq n <=
Series fnsq.
Proof.
Lemma lim_sq_0 (
a :
nat ->
R) :
is_series (
fun k =>
Rsqr (
a k)) 0 ->
forall n, 0 =
a n.
Proof.
End series_sequences.
Section max_prod.
Definition max_prod_fun (
a :
nat ->
posreal) (
m n :
nat) :
R :=
List.fold_right Rmax 0 (
List.map (
fun k =>
part_prod_n a k n) (
List.seq 0 (
S m)%
nat)).
Lemma max_prod_le (
F :
nat ->
posreal) (
k m n:
nat) :
(
k <=
m)%
nat ->
(
m <=
n)%
nat ->
part_prod_n F k n <=
max_prod_fun F m n.
Proof.
Lemma max_bounded1_pre_le (
F :
nat ->
posreal) (
m n:
nat) :
(
forall (
n:
nat),
F n <= 1) ->
(
S m <=
n)%
nat ->
part_prod_n F m n <=
part_prod_n F (
S m)
n.
Proof.
Lemma max_bounded1 (
F :
nat ->
posreal) (
m n:
nat) :
(
forall (
n:
nat),
F n <= 1) ->
(
m <=
n)%
nat ->
max_prod_fun F m n =
part_prod_n F m n.
Proof.
Lemma lim_max_bounded1 (
F :
nat ->
posreal) (
m:
nat) :
(
forall (
n:
nat),
F n <= 1) ->
is_lim_seq (
part_prod F) 0 ->
is_lim_seq (
fun n =>
max_prod_fun F m (
n+
m)%
nat) 0.
Proof.
Lemma pos_sq_bounded1 (
F :
nat ->
posreal) (
n :
nat) :
F n <= 1 -> (
pos_sq_fun F)
n <= 1.
Proof.
intros.
unfold pos_sq_fun,
pos_sq;
simpl.
replace (1)
with (1 * 1)
by lra.
assert (0 <=
F n)
by (
destruct (
F n);
simpl;
lra).
apply Rmult_le_compat;
trivial.
Qed.
Lemma lim_max_bounded1_sq (
F :
nat ->
posreal) (
m:
nat) :
(
forall (
n:
nat),
F n <= 1) ->
is_lim_seq (
part_prod F) 0 ->
is_lim_seq (
fun n =>
max_prod_fun (
pos_sq_fun F)
m (
n+
m)%
nat) 0.
Proof.
Lemma max_prod_index_n (
F :
nat ->
posreal) (
m :
nat) (
n:
nat) (
mle:(
m <=
n)%
nat) :
exists k :
nat,
(
k <=
m)%
nat /\
part_prod_n F k n =
max_prod_fun F m n.
Proof.
Lemma max_prod_n_S (
a:
nat ->
posreal) (
m n :
nat) :
(
m <=
n)%
nat ->
(
max_prod_fun a m (
S n)) =
max_prod_fun a m n *
a (
S n).
Proof.
Lemma initial_max_prod_n (
a :
nat ->
posreal) (
k m n:
nat):
(
k <=
m)%
nat ->
max_prod_fun a k (
S m +
n)%
nat = (
max_prod_fun a k m) * (
part_prod_n a (
S m) (
S m +
n)%
nat).
Proof.
Lemma max_prod_index (
F :
nat ->
posreal) (
m:
nat) :
exists (
k:
nat), (
k<=
m)%
nat /\
forall (
n:
nat), (
m <=
n)%
nat ->
part_prod_n F k n =
max_prod_fun F m n.
Proof.
intros.
assert (
m <=
m)%
nat by lia.
generalize (
max_prod_index_n F m m H);
intros.
destruct H0 as [
k H0];
destruct H0.
exists k.
split;
trivial;
intros.
destruct (
lt_dec m n).
+
remember (
n -
S m)%
nat as nm.
replace (
n)
with (
S m +
nm)%
nat; [|
lia].
rewrite initial_seg_prod_n;
trivial.
rewrite initial_max_prod_n;
trivial.
now rewrite H1.
+
replace (
n)
with (
m)
by lia.
now rewrite H1.
Qed.
Lemma lim_max_prod_m_0 (
a :
nat ->
posreal):
is_lim_seq (
part_prod_pos a) 0 ->
forall (
m:
nat),
is_lim_seq (
max_prod_fun a m) 0.
Proof.
End max_prod.
Lemma prod_sq_bounded_1 (
F :
nat ->
posreal) (
r s :
nat) :
(
forall (
n:
nat),
F n <= 1) ->
part_prod_n (
pos_sq_fun F)
r s <= 1.
Proof.
Lemma part_prod_le (
F :
nat ->
posreal) (
m k n:
nat) :
(
forall (
n:
nat),
F n <= 1) ->
(
m +
k <=
n)%
nat ->
part_prod_n (
pos_sq_fun F)
m n <=
part_prod_n (
pos_sq_fun F) (
m +
k)%
nat n.
Proof.
Section Dvoretsky.
Theorem Dvoretzky4_0 (
F:
nat ->
posreal) (
sigma V :
nat ->
R) :
(
forall (
n:
nat),
V (
S n) <= (
F n) * (
V n) + (
sigma n)) ->
(
forall (
n:
nat),
V (
S n) <=
sum_n (
fun k => (
sigma k)*(
part_prod_n F (
S k)
n))
n +
(
V 0%
nat)*(
part_prod_n F 0
n)).
Proof.
Lemma sum_bound_prod_A (
F :
nat ->
posreal) (
sigma :
nat ->
R) (
A :
R) (
n m:
nat) :
(
forall r s,
part_prod_n (
pos_sq_fun F)
r s <=
A) ->
sum_n_m (
fun k => (
Rsqr (
sigma k))*(
part_prod_n (
pos_sq_fun F) (
S k)
n)) (
S m)
n <=
(
sum_n_m (
fun k =>
Rsqr (
sigma k)) (
S m)
n) *
A.
Proof.
Lemma sum_bound3_max (
F :
nat ->
posreal) (
sigma :
nat ->
R) (
n m:
nat) :
(
S m <=
n)%
nat ->
sum_n (
fun k => (
Rsqr (
sigma k))*(
part_prod_n (
pos_sq_fun F) (
S k)
n))
m <=
(
sum_n (
fun k => (
Rsqr (
sigma k)))
m) * (
max_prod_fun (
pos_sq_fun F) (
S m)
n).
Proof.
Theorem Dvoretzky4_8_5 (
F :
nat ->
posreal) (
sigma V:
nat ->
R) (
n m:
nat) (
A:
R):
(
forall r s,
part_prod_n (
pos_sq_fun F)
r s <=
A) ->
(
forall (
n:
nat),
Rsqr (
V (
S n)) <= (
pos_sq_fun F)
n *
Rsqr (
V n) +
Rsqr (
sigma n)) ->
(
m<
n)%
nat ->
Rsqr (
V (
S n)) <=
(
sum_n_m (
fun k =>
Rsqr (
sigma k)) (
S m)
n) *
A +
(
Rsqr (
V 0%
nat) +
sum_n (
fun k => (
Rsqr (
sigma k)))
m) *
(
max_prod_fun (
pos_sq_fun F) (
S m)
n).
Proof.
Lemma sum_bound_prod_A_sigma1
(
F :
nat ->
posreal) (
sigma :
nat ->
R) (
A :
R) (
n m:
nat) :
(
forall r s,
part_prod_n (
pos_sq_fun F)
r s <=
A) ->
(
forall n, 0 <=
sigma n) ->
sum_n_m (
fun k => (
sigma k)*(
part_prod_n (
pos_sq_fun F) (
S k)
n)) (
S m)
n <=
(
sum_n_m sigma (
S m)
n) *
A.
Proof.
Lemma sum_bound3_max_sigma1 (
F :
nat ->
posreal) (
sigma :
nat ->
R) (
n m:
nat) :
(
S m <=
n)%
nat ->
(
forall n, 0 <=
sigma n) ->
sum_n (
fun k => (
sigma k)*(
part_prod_n (
pos_sq_fun F) (
S k)
n))
m <=
(
sum_n sigma m) * (
max_prod_fun (
pos_sq_fun F) (
S m)
n).
Proof.
Theorem Dvoretzky4_8_5_V1 (
F :
nat ->
posreal) (
sigma V:
nat ->
R) (
n m:
nat) (
A:
R):
(
forall r s,
part_prod_n (
pos_sq_fun F)
r s <=
A) ->
(
forall (
n:
nat), (
V (
S n)) <= (
pos_sq_fun F)
n * (
V n) + (
sigma n)) ->
(
forall (
n:
nat), 0 <=
V n) ->
(
forall (
n:
nat), 0 <=
sigma n) ->
(
m<
n)%
nat ->
V (
S n) <=
(
sum_n_m sigma (
S m)
n) *
A +
(
V 0%
nat +
sum_n sigma m) *
(
max_prod_fun (
pos_sq_fun F) (
S m)
n).
Proof.
Theorem Dvoretzky4_8_5_1 (
F :
nat ->
posreal) (
sigma V:
nat ->
R) (
n m:
nat) (
A sigmasum:
R) :
(
forall r s,
part_prod_n (
pos_sq_fun F)
r s <=
A) ->
(
forall (
n:
nat),
Rsqr (
V (
S n)) <= (
pos_sq_fun F)
n *
Rsqr (
V n) +
Rsqr (
sigma n)) ->
is_series (
fun n =>
Rsqr (
sigma n))
sigmasum ->
(
m<
n)%
nat ->
Rsqr (
V (
S n)) <=
(
sum_n_m (
fun k =>
Rsqr (
sigma k)) (
S m)
n) *
A +
(
Rsqr (
V 0%
nat) +
sigmasum) * (
max_prod_fun (
pos_sq_fun F) (
S m)
n).
Proof.
Theorem Dvoretzky4_8_5_1_V1 (
F :
nat ->
posreal) (
sigma V:
nat ->
R) (
n m:
nat) (
A sigmasum:
R) :
(
forall r s,
part_prod_n (
pos_sq_fun F)
r s <=
A) ->
(
forall (
n:
nat),
V (
S n) <= (
pos_sq_fun F)
n * (
V n) + (
sigma n)) ->
(
forall n, 0 <=
sigma n) ->
(
forall n, 0 <=
V n) ->
is_series sigma sigmasum ->
(
m<
n)%
nat ->
V (
S n) <=
(
sum_n_m sigma (
S m)
n) *
A +
(
V 0%
nat +
sigmasum) * (
max_prod_fun (
pos_sq_fun F) (
S m)
n).
Proof.
Lemma Dvoretzky4_sigma_v0_2_0 (
F :
nat ->
posreal) (
sigma V:
nat ->
R) :
(
forall (
n:
nat),
Rsqr (
V (
S n)) <= (
pos_sq_fun F)
n *
Rsqr (
V n) +
Rsqr (
sigma n)) ->
ex_series (
fun n =>
Rsqr (
sigma n)) ->
Series (
fun n =>
Rsqr (
sigma n)) +
Rsqr (
V 0%
nat) = 0 ->
forall n,
V n = 0.
Proof.
Lemma Dvoretzky4_sigma_v0_2_0_V_pos (
F :
nat ->
posreal) (
sigma V:
nat ->
R) :
(
forall n, 0 <=
sigma n) ->
(
forall n, 0 <=
V n) ->
(
forall (
n:
nat), (
V (
S n)) <= (
pos_sq_fun F)
n * (
V n) + (
sigma n)) ->
ex_series sigma ->
Series sigma + (
V 0%
nat) = 0 ->
forall n,
V n = 0.
Proof.
intros.
remember (
Series sigma)
as sigma_sum.
generalize (
nneg_series sigma H H2);
simpl;
intros.
rewrite <-
Heqsigma_sum in H4.
generalize (
Rplus_eq_R0 sigma_sum (
V 0%
nat)
H4 (
H0 0%
nat)
H3);
intros.
destruct H5.
generalize (
lim_0_nneg sigma).
rewrite Heqsigma_sum in H5;
intros.
generalize (
Series_correct _ H2);
intros.
rewrite H5 in H8.
specialize (
H7 H8).
induction n.
-
trivial.
-
specialize (
H1 n).
cut_to H7;
trivial.
specialize (
H7 n).
rewrite IHn,
H7 in H1.
rewrite Rplus_0_r,
Rmult_0_r in H1.
now apply Rle_antisym.
Qed.
Theorem Dvoretzky4_A (
F :
nat ->
posreal) (
sigma V:
nat ->
R) (
A:
posreal) :
(
forall r s,
part_prod_n (
pos_sq_fun F)
r s <=
A) ->
(
forall (
n:
nat),
Rsqr (
V (
S n)) <= (
pos_sq_fun F)
n *
Rsqr (
V n) +
Rsqr (
sigma n)) ->
is_lim_seq (
part_prod F) 0 ->
ex_series (
fun n =>
Rsqr (
sigma n)) ->
is_lim_seq (
fun n =>
Rsqr (
V n)) 0.
Proof.
Theorem Dvoretzky4_A_Vpos (
F :
nat ->
posreal) (
sigma V:
nat ->
R) (
A:
posreal) :
(
forall r s,
part_prod_n (
pos_sq_fun F)
r s <=
A) ->
(
forall (
n:
nat),
V (
S n) <= (
pos_sq_fun F)
n * (
V n) + (
sigma n)) ->
(
forall (
n:
nat), 0 <=
V n) ->
(
forall (
n:
nat), 0 <=
sigma n) ->
is_lim_seq (
part_prod F) 0 ->
ex_series sigma ->
is_lim_seq V 0.
Proof.
Theorem Dvoretzky4B (
F :
nat ->
posreal) (
sigma V:
nat ->
R) :
(
forall n,
F n <= 1) ->
(
forall (
n:
nat),
Rsqr (
V (
S n)) <= (
pos_sq_fun F)
n *
Rsqr (
V n) +
Rsqr (
sigma n)) ->
is_lim_seq (
part_prod F) 0 ->
ex_series (
fun n =>
Rsqr (
sigma n)) ->
is_lim_seq (
fun n =>
Rsqr (
V n)) 0.
Proof.
Theorem Dvoretzky4B_Vpos (
F :
nat ->
posreal) (
sigma V:
nat ->
R) :
(
forall n,
F n <= 1) ->
(
forall n, 0 <=
V n) ->
(
forall n, 0 <=
sigma n) ->
(
forall (
n:
nat),
V (
S n) <= (
pos_sq_fun F)
n * (
V n) + (
sigma n)) ->
is_lim_seq (
part_prod F) 0 ->
ex_series sigma ->
is_lim_seq V 0.
Proof.
Section Generalized_Harmonic_Series.
Lemma inv_bound_gt (
a b :
posreal) :
/
a > / (
a +
b).
Proof.
Lemma inv_bound_sq_gt (
a b :
posreal) :
Rsqr (/
a) >
Rsqr (/ (
a +
b)).
Proof.
Lemma inv_bound_exists_lt (
a b :
posreal) :
exists (
j :
nat),
forall (
n:
nat), / (
a * (
INR ((
S n) +
j))) < / (
a *
INR (
S n) +
b).
Proof.
Lemma genharmonic_series_sq (
b c :
posreal) :
ex_series (
fun n =>
Rsqr (/ (
b +
c *
INR (
S n)))).
Proof.
Lemma genharmonic_sq_lim (
b c :
posreal) :
is_lim_seq (
fun n =>
Rsqr (/ (
b +
c *
INR (
S n)))) 0.
Proof.
Lemma harmonic_increasing :
let f :=
fun i =>
sum_f_R0' (
fun n => 1 /
INR (
S n))
i in
forall n m :
nat, (
n <=
m)%
nat ->
f n <=
f m.
Proof.
Lemma harmonic_series :
is_lim_seq (
fun i =>
sum_f_R0' (
fun n => 1 /
INR (
S n))
i)
p_infty.
Proof.
Lemma harmonic_series2 (
c:
posreal) :
is_lim_seq (
fun i =>
sum_f_R0' (
fun n => 1 / (
c *
INR (
S n)))
i)
p_infty.
Proof.
Lemma harmonic_series3 (
j:
nat) (
f :
nat ->
R) :
is_lim_seq (
fun i =>
sum_f_R0'
f i)
p_infty ->
is_lim_seq (
fun i =>
sum_f_R0' (
fun n =>
f (
n +
j)%
nat)
i)
p_infty.
Proof.
Lemma genharmon (
a b :
posreal) :
forall (
n:
nat), / ((
a+
b)*(
INR (
S n))) <= /(
a*(
INR (
S n)) +
b) < /(
a * (
INR (
S n))).
Proof.
Lemma genharmon_sq (
a b :
posreal) :
forall (
n:
nat),
Rsqr (/ ((
a+
b)*(
INR (
S n)))) <=
Rsqr (/ (
a*(
INR (
S n)) +
b)) <
Rsqr (/ (
a * (
INR (
S n)))).
Proof.
Lemma genharmonic_series (
b c :
posreal) :
is_lim_seq (
fun i =>
sum_f_R0' (
fun n => 1 / (
b +
c *
INR (
S n)))
i)
p_infty.
Proof.
Lemma genharmonic_series2 (
b c :
posreal) :
is_lim_seq (
fun i =>
sum_f_R0' (
fun n => 1 / (
b +
c *
INR (
S n)))
i)
p_infty.
Proof.
End Generalized_Harmonic_Series.
Lemma Robbins_Monro_0 (
u :
R) (
a :
nat ->
posreal) (
g :
R ->
R) (
A B :
posreal) :
(
forall (
u:
R),
u <> 0 ->
A <=
g u <=
B) ->
forall (
n:
nat),
(
u <> 0) ->
Rabs (1 -
a n *
g u) <=
Rmax (1-
A*(
a n)) (
B*(
a n) - 1).
Proof.
Lemma Robbins_Monro_1 (
r :
nat ->
R) (
a :
nat ->
posreal) (
f :
R ->
R) (
A B :
posreal) :
(
forall (
u:
R),
u <> 0 ->
A <=
f(
u)/
u <=
B) ->
forall (
n:
nat),
r n <> 0 ->
Rabs (
r n -
a n *
f (
r n)) <=
Rabs (
r n) *
Rmax (1-
A*(
a n)) (
B*(
a n) - 1).
Proof.
Lemma Robbins_Monro_1b (
a A B :
posreal) :
a < 2/(
A +
B) ->
Rmax (1-
A*
a) (
B*
a-1) = 1-
A*
a.
Proof.
Lemma is_derive_Rsqr (
f :
R ->
R) (
x df :
R) :
is_derive f x df ->
is_derive (
fun x0 =>
Rsqr (
f x0))
x (2 * (
f x) *
df).
Proof.
Lemma Robbins_Monro_2a (
A sigma :
posreal) (
a0 V :
R) :
let f :=
fun a => (
Rsqr (1-
A*
a) * (
Rsqr V)) + (
Rsqr a * (
Rsqr sigma))
in
is_derive f a0 ((2 * (1-
A*
a0) * (-
A) * (
Rsqr V)) + (2 *
a0 * (
Rsqr sigma))).
Proof.
Lemma Robbins_Monro_2b (
A sigma :
posreal) (
V :
R) :
let a0 := (
A *
V^2) / (
sigma^2 +
A^2 *
V^2)
in
(2 * (1-
A*
a0) * (-
A) * (
Rsqr V)) + (2 *
a0 * (
Rsqr sigma)) = 0.
Proof.
Lemma Robbins_Monro_2c (
A sigma :
posreal) (
V x :
R) :
let f :=
fun a => (
Rsqr (1-
A*
a) * (
Rsqr V)) + (
Rsqr a * (
Rsqr sigma))
in
let a0 := (
A *
V^2) / (
sigma^2 +
A^2 *
V^2)
in
is_derive f a0 0.
Proof.
Lemma Robbins_Monro_2d (
A sigma :
posreal) (
V x :
R) :
let f :=
fun a => (
Rsqr (1-
A*
a) * (
Rsqr V)) + (
Rsqr a * (
Rsqr sigma))
in
let a0 := (
A *
V^2) / (
sigma^2 +
A^2 *
V^2)
in
f a0 =
sigma^2 *
V^2 / (
sigma^2 + (
A*
V)^2).
Proof.
End Dvoretsky.