CoRN.ftc.RefLemma


Require Export RefSeparating.
Require Export RefSeparated.
Require Export RefSepRef.

Section Refinement_Lemma.

The Refinement Lemmas

Here we resume the results proved in four different files. The aim is to prove the following result (last part of Theorem 2.9 of Bishop 1967):
Theorem Let f be a continuous function on a compact interval [a,b] with modulus of continuity (From our point of view, the modulus of continuity is simply the proof that f is continuous.) omega. Let P be a partition of [a,b] and eps [>] [0] be such that mesh(P) [<] omega(eps). Then |S(f,P)-∫f(x)dx|≤ε(b-a) where S(f,P) denotes any sum of the function f respecting the partition P (as previously defined).
The proof of this theorem relies on the fact that for any two partitions P and R of [a,b] it is possible to define a partition Q which is ``almost'' a common refinement of P and R---that is, given eps [>] [0] it is possible to define Q such that for every point x of either P or R there is a point y of Q such that |x[-]y| [<] eps. This requires three separate constructions (done in three separate files) which are then properly combined to give the final result. We recommend the reader to ignore this technical constructions.
First we prove that if P and R are both separated (though not necessarily separated from each other) then we can define a partition P' arbitrarily close to P (that is, such that given alpha [>] [0] and xi [>] [0] P' satisfies both mesh(P') [<] mesh(P) [+] xi and for every choice of points x_i respecting P there is a choice of points x'_i respecting P' such that |S(f,P)-S(f,P')| [<] alpha) that is separated from R.
Then we prove that given any partition P and assuming a [#] b we can define a partition P' arbitrarily close to P (in the same sense as above) which is separated.
Finally we prove that every two separated partitions P and R have a common refinement---as every two points in P and R are apart, we can decide which one is smaller. We use here the technical results about ordering that we proved in the file IntegralLemmas.v.
Using the results from these files, we prove our main lemma in several steps (and versions).
Throughout this section:
  • a,b:IR and I denotes [a,b];
  • F is a partial function continuous in I.

Variables a b : IR.
Hypothesis Hab : a [<=] b.

Variable F : PartIR.
Hypothesis contF : Continuous_I Hab F.
Hypothesis incF : included (Compact Hab) (Dom F).


Section First_Refinement_Lemma.

This is the first part of the proof of Theorem 2.9.
  • P, Q are partitions of I with, respectively, n and m points;
  • Q is a refinement of P;
  • e is a positive real number;
  • d is the modulus of continuity of F for e;
  • the mesh of P is less or equal to d;
  • fP and fQ are choices of points respecting the partitions P and Q,
respectively.

Variable e : IR.
Hypothesis He : [0] [<] e.


Variables m n : nat.
Variable P : Partition Hab n.
Hypothesis HMesh : Mesh P [<=] d.

Variable Q : Partition Hab m.
Hypothesis Href : Refinement P Q.

Variable fP : i : nat, i < nIR.
Hypothesis HfP : Points_in_Partition P fP.
Hypothesis HfP' : nat_less_n_fun fP.

Variable fQ : i : nat, i < mIR.
Hypothesis HfQ : Points_in_Partition Q fQ.
Hypothesis HfQ' : nat_less_n_fun fQ.


Lemma first_refinement_lemma : AbsIR (Partition_Sum HfP incF[-]Partition_Sum HfQ incF) [<=] e[*] (b[-]a).
Proof.
 eapply leEq_wdl.
  2: apply eq_symmetric_unfolded; apply ref_calc2.
 eapply leEq_wdl.
  2: apply eq_symmetric_unfolded; apply ref_calc3.
 eapply leEq_wdl.
  2: apply eq_symmetric_unfolded; apply ref_calc4.
 eapply leEq_wdl.
  2: apply eq_symmetric_unfolded; apply ref_calc5.
 eapply leEq_transitive.
  apply ref_calc6.
 eapply leEq_transitive.
  apply ref_calc7.
 eapply leEq_transitive.
  apply ref_calc8.
 apply leEq_wdl with (e[*] Sumx (fun (i : nat) (Hi : i < n) ⇒ Sum2
   (fun (j : nat) (Hj : sub i j) (Hj' : j pred (sub (S i))) ⇒
     Q _ (H' _ _ Hi Hj') [-]Q _ (lt_le_weak _ _ (H _ _ Hi Hj'))))).
  apply mult_resp_leEq_lft.
   2: apply less_leEq; assumption.
  apply leEq_wdl with (Sumx (fun (i : nat) (Hi : i < n) ⇒ P _ Hi[-]P _ (lt_le_weak _ _ Hi))).
   2: apply Sumx_wd; intros.
   2: apply eq_symmetric_unfolded; apply ref_calc1.
  eapply leEq_wdl.
   2: apply eq_symmetric_unfolded; apply Mengolli_Sum with (f := fun (i : nat) (Hi : i n) ⇒ P i Hi).
    eapply leEq_transitive.
     apply leEq_AbsIR.
    eapply leEq_wdr.
     2: apply AbsIR_eq_x.
     2: apply shift_leEq_minus; astepl a; assumption.
    apply compact_elements with Hab; apply Partition_in_compact.
   red in |- *; intros; apply prf1; auto.
  intros; apply cg_minus_wd; apply prf1; auto.
 apply eq_symmetric_unfolded; eapply eq_transitive_unfolded.
  2: apply Sumx_comm_scal'.
 apply Sumx_wd; intros.
 eapply eq_transitive_unfolded.
  2: apply Sum2_comm_scal'.
  algebra.
 apply RL_sub_SS.
Qed.

End First_Refinement_Lemma.

Section Second_Refinement_Lemma.

This is inequality (2.6.7).
  • P, Q, R are partitions of I with, respectively, j, n and k points;
  • Q is a common refinement of P and R;
  • e, e' are positive real numbers;
  • d, d' are the moduli of continuity of F for e, e';
  • the Mesh of P is less or equal to d;
  • the Mesh of R is less or equal to d';
  • fP, fQ and fR are choices of points respecting the partitions P, Q
and R, respectively.

Variables n j k : nat.

Variable P : Partition Hab j.
Variable Q : Partition Hab n.
Variable R : Partition Hab k.

Hypothesis HrefP : Refinement P Q.
Hypothesis HrefR : Refinement R Q.

Variables e e' : IR.
Hypothesis He : [0] [<] e.
Hypothesis He' : [0] [<] e'.


Hypothesis HMeshP : Mesh P [<=] d.
Hypothesis HMeshR : Mesh R [<=] d'.

Variable fP : i : nat, i < jIR.
Hypothesis HfP : Points_in_Partition P fP.
Hypothesis HfP' : nat_less_n_fun fP.

Variable fR : i : nat, i < kIR.
Hypothesis HfR : Points_in_Partition R fR.
Hypothesis HfR' : nat_less_n_fun fR.

Lemma second_refinement_lemma :
 AbsIR (Partition_Sum HfP incF[-]Partition_Sum HfR incF) [<=] e[*] (b[-]a) [+]e'[*] (b[-]a).
Proof.
 set (HfQ := Partition_imp_points_1 _ _ _ _ Q) in ×.
 set (H' := Partition_imp_points_2 _ _ _ _ Q) in ×.
 apply leEq_wdl with (AbsIR (Partition_Sum HfP incF[-]Partition_Sum HfQ incF[+]
   (Partition_Sum HfQ incF[-]Partition_Sum HfR incF))).
  2: apply AbsIR_wd; rational.
 eapply leEq_transitive.
  apply triangle_IR.
 apply plus_resp_leEq_both.
  apply first_refinement_lemma with He; assumption.
 eapply leEq_wdl.
  2: apply AbsIR_minus.
 apply first_refinement_lemma with He'; assumption.
Qed.

End Second_Refinement_Lemma.

Section Third_Refinement_Lemma.

This is an approximation of inequality (2.6.7), but without assuming the existence of a common refinement of P and R.
  • P, R are partitions of I with, respectively, n and m points;
  • e, e' are positive real numbers;
  • d, d' are the moduli of continuity of F for e, e';
  • the Mesh of P is less than d;
  • the Mesh of R is less than d';
  • fP and fR are choices of points respecting the partitions P and R,
respectively;
  • beta is a positive real number.

Variables n m : nat.

Variable P : Partition Hab n.
Variable R : Partition Hab m.

Variables e e' : IR.
Hypothesis He : [0] [<] e.
Hypothesis He' : [0] [<] e'.


Hypothesis HMeshP : Mesh P [<] d.
Hypothesis HMeshR : Mesh R [<] d'.

Variable fP : i : nat, i < nIR.
Hypothesis HfP : Points_in_Partition P fP.
Hypothesis HfP' : nat_less_n_fun fP.

Variable fR : i : nat, i < mIR.
Hypothesis HfR : Points_in_Partition R fR.
Hypothesis HfR' : nat_less_n_fun fR.

Hypothesis Hab' : a [<] b.

Variable beta : IR.
Hypothesis Hbeta : [0] [<] beta.


Lemma third_refinement_lemma :
 AbsIR (Partition_Sum HfP incF[-]Partition_Sum HfR incF) [<=] e[*] (b[-]a) [+]e'[*] (b[-]a) [+]beta.
Proof.
 apply leEq_wdl with (AbsIR (Partition_Sum HfP incF[-]Partition_Sum RL_fP'_in_P' incF[+]
   (Partition_Sum RL_fP'_in_P' incF[-]Partition_Sum RL_fQ_in_Q incF) [+]
     (Partition_Sum RL_fQ_in_Q incF[-]Partition_Sum RL_fR'_in_R' incF) [+]
       (Partition_Sum RL_fR'_in_R' incF[-]Partition_Sum HfR incF))).
  apply leEq_wdr with (alpha[+]alpha[+] (e[*] (b[-]a) [+]e'[*] (b[-]a)) [+]alpha).
   2: unfold alpha in |- *; rational.
  eapply leEq_transitive.
   apply triangle_IR.
  apply plus_resp_leEq_both.
   eapply leEq_transitive.
    apply triangle_IR.
   apply plus_resp_leEq_both.
    eapply leEq_transitive.
     apply triangle_IR.
    apply plus_resp_leEq_both.
     apply RL_P'_P_sum.
    apply RL_Q_P'_sum.
   2: eapply leEq_wdl.
    3: apply AbsIR_minus.
   2: apply RL_R'_R_sum.
  2: apply AbsIR_wd; rational.
 eapply second_refinement_lemma with (Q := Separated_Refinement _ _ _ _ _ _ _ RL_Q_sep) (He := He)
   (He' := He').
    apply Separated_Refinement_lft.
   apply Separated_Refinement_rht.
  apply RL_Q_Mesh.
 apply less_leEq; apply RL_R'_Mesh.
Qed.

End Third_Refinement_Lemma.

Section Fourth_Refinement_Lemma.


Finally, this is inequality (2.6.7) exactly as stated (same conventions as above)

Variables n m : nat.

Variable P : Partition Hab n.
Variable R : Partition Hab m.

Variables e e' : IR.
Hypothesis He : [0] [<] e.
Hypothesis He' : [0] [<] e'.


Hypothesis HMeshP : Mesh P [<] d.
Hypothesis HMeshR : Mesh R [<] d'.

Variable fP : i : nat, i < nIR.
Hypothesis HfP : Points_in_Partition P fP.
Hypothesis HfP' : nat_less_n_fun fP.

Variable fR : i : nat, i < mIR.
Hypothesis HfR : Points_in_Partition R fR.
Hypothesis HfR' : nat_less_n_fun fR.

Hypothesis Hab' : b[-]a [<] Min d d'.

Lemma fourth_refinement_lemma :
 AbsIR (Partition_Sum HfP incF[-]Partition_Sum HfR incF) [<=] e[*] (b[-]a) [+]e'[*] (b[-]a).
Proof.
 generalize (proj2b_sig2T _ _ _ (contF' e He));
   generalize (proj2a_sig2T _ _ _ (contF' e He)); fold d in |- *; intros Hd Hdd.
 generalize (proj2b_sig2T _ _ _ (contF' e' He'));
   generalize (proj2a_sig2T _ _ _ (contF' e' He')); fold d' in |- *; intros Hd' Hdd'.
 apply leEq_wdl with (AbsIR (Fa[*] (b[-]a) [-] Sumx (fun (i : nat) (Hi : i < n) ⇒
   (Fa[-]Part F (fP i Hi) (just HfP)) [*] (P _ Hi[-]P _ (lt_le_weak _ _ Hi))) [-] (Fa[*] (b[-]a) [-]
     Sumx (fun (j : nat) (Hj : j < m) ⇒ (Fa[-]Part F (fR j Hj) (just HfR)) [*]
       (R _ Hj[-]R _ (lt_le_weak _ _ Hj)))))).
  2: apply AbsIR_wd; apply eq_symmetric_unfolded.
  2: apply cg_minus_wd; apply RL_sum_lemma_aux.
 apply leEq_wdl with (AbsIR (Sumx (fun (j : nat) (Hj : j < m) ⇒
   (Fa[-]Part F (fR j Hj) (just HfR)) [*] (R _ Hj[-]R _ (lt_le_weak _ _ Hj))) [-] Sumx
     (fun (i : nat) (Hi : i < n) ⇒ (Fa[-]Part F (fP i Hi) (just HfP)) [*]
       (P _ Hi[-]P _ (lt_le_weak _ _ Hi))))).
  2: apply AbsIR_wd; rational.
 rstepr (e'[*] (b[-]a) [+]e[*] (b[-]a)).
 eapply leEq_transitive.
  apply triangle_IR_minus.
 apply plus_resp_leEq_both.
  eapply leEq_transitive.
   apply triangle_SumxIR.
  apply leEq_wdr with (Sumx (fun (i : nat) (Hi : i < m) ⇒ e'[*] (R _ Hi[-]R _ (lt_le_weak _ _ Hi)))).
   apply Sumx_resp_leEq; intros.
   eapply leEq_wdl.
    2: apply eq_symmetric_unfolded; apply AbsIR_resp_mult.
   apply mult_resp_leEq_both; try apply AbsIR_nonneg.
    unfold Fa in |- *; apply Hdd'; unfold I in |- ×.
      apply compact_inc_lft.
     apply Pts_part_lemma with m R; assumption.
    apply leEq_transitive with (AbsIR (b[-]a)).
     apply compact_elements with Hab.
      apply compact_inc_lft.
     apply Pts_part_lemma with m R; assumption.
    eapply leEq_wdl.
     2: apply eq_symmetric_unfolded; apply AbsIR_eq_x.
     2: apply shift_leEq_minus; astepl a; assumption.
    eapply leEq_transitive.
     apply less_leEq; apply Hab'.
    apply Min_leEq_rht.
   apply eq_imp_leEq; apply AbsIR_eq_x.
   apply shift_leEq_minus; astepl (R i (lt_le_weak _ _ H)); apply prf2.
  eapply eq_transitive_unfolded.
   apply Sumx_comm_scal' with (f := fun (i : nat) (Hi : i < m) ⇒ R _ Hi[-]R _ (lt_le_weak _ _ Hi)).
  apply mult_wdr.
  eapply eq_transitive_unfolded.
   apply Mengolli_Sum with (f := fun (i : nat) (Hi : i m) ⇒ R i Hi).
    red in |- *; intros.
    apply prf1; auto.
   intros; algebra.
  apply cg_minus_wd; [ apply finish | apply start ].
 eapply leEq_transitive.
  apply triangle_SumxIR.
 apply leEq_wdr with (Sumx (fun (i : nat) (Hi : i < n) ⇒ e[*] (P _ Hi[-]P _ (lt_le_weak _ _ Hi)))).
  apply Sumx_resp_leEq; intros.
  eapply leEq_wdl.
   2: apply eq_symmetric_unfolded; apply AbsIR_resp_mult.
  apply mult_resp_leEq_both; try apply AbsIR_nonneg.
   unfold Fa in |- *; apply Hdd; unfold I in |- ×.
     apply compact_inc_lft.
    apply Pts_part_lemma with n P; assumption.
   apply leEq_transitive with (AbsIR (b[-]a)).
    apply compact_elements with Hab.
     apply compact_inc_lft.
    apply Pts_part_lemma with n P; assumption.
   eapply leEq_wdl.
    2: apply eq_symmetric_unfolded; apply AbsIR_eq_x.
    2: apply shift_leEq_minus; astepl a; assumption.
   eapply leEq_transitive.
    apply less_leEq; apply Hab'.
   apply Min_leEq_lft.
  apply eq_imp_leEq; apply AbsIR_eq_x.
  apply shift_leEq_minus; astepl (P i (lt_le_weak _ _ H)); apply prf2.
 eapply eq_transitive_unfolded.
  apply Sumx_comm_scal' with (f := fun (i : nat) (Hi : i < n) ⇒ P _ Hi[-]P _ (lt_le_weak _ _ Hi)).
 apply mult_wdr.
 eapply eq_transitive_unfolded.
  apply Mengolli_Sum with (f := fun (i : nat) (Hi : i n) ⇒ P i Hi).
   red in |- *; intros.
   apply prf1; auto.
  intros; algebra.
 apply cg_minus_wd; [ apply finish | apply start ].
Qed.

End Fourth_Refinement_Lemma.

Section Main_Refinement_Lemma.

We finish by presenting Theorem 9.

Variables n m : nat.

Variable P : Partition Hab n.
Variable R : Partition Hab m.

Variables e e' : IR.
Hypothesis He : [0] [<] e.
Hypothesis He' : [0] [<] e'.


Hypothesis HMeshP : Mesh P [<] d.
Hypothesis HMeshR : Mesh R [<] d'.

Variable fP : i : nat, i < nIR.
Hypothesis HfP : Points_in_Partition P fP.
Hypothesis HfP' : nat_less_n_fun fP.

Variable fR : i : nat, i < mIR.
Hypothesis HfR : Points_in_Partition R fR.
Hypothesis HfR' : nat_less_n_fun fR.

Lemma refinement_lemma : AbsIR (Partition_Sum HfP incF[-]Partition_Sum HfR incF) [<=] e[*] (b[-]a) [+]e'[*] (b[-]a).
Proof.
 cut ([0] [<] Min d d').
  intro H; elim (less_cotransitive_unfolded _ _ _ H (b[-]a)); intro.
   astepr (e[*] (b[-]a) [+]e'[*] (b[-]a) [+][0]).
   apply shift_leEq_plus'.
   apply approach_zero_weak.
   intros beta Hbeta.
   apply shift_minus_leEq.
   astepr (e[*] (b[-]a) [+]e'[*] (b[-]a) [+]beta).
   apply third_refinement_lemma with (He := He) (He' := He'); try assumption.
   astepl ([0][+]a); apply shift_plus_less; assumption.
  apply fourth_refinement_lemma with He He'.
  assumption.
 apply less_Min.
  unfold d in |- *; apply proj2a_sig2T.
 unfold d' in |- *; apply proj2a_sig2T.
Qed.

End Main_Refinement_Lemma.

End Refinement_Lemma.