Skip to content
Snippets Groups Projects
LInt_calc.v 3.5 KiB
Newer Older
  • Learn to ignore specific revisions
  • Micaela Mayero's avatar
    Micaela Mayero committed
    (**
    This file is part of the Elfic library
    
    Copyright (C) Boldo, Clément, Faissole, Martin, Mayero
    
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 3 of the License, or (at your option) any later version.
    
    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    COPYING file for more details.
    *)
    
    
    (** This file is still WIP... *)
    
    Micaela Mayero's avatar
    Micaela Mayero committed
    From Coq Require Import Reals Lra.
    From Coquelicot Require Import Coquelicot.
    
    Require Import sum_Rbar_nonneg.
    
    Require Import Subset_charac.
    Require Import sigma_algebra_R_Rbar measurable_fun.
    Require Import measure measure_R.
    Require Import simple_fun LInt_p LInt.
    
    Definition l_meas : measure gen_R := Borel_Lebesgue_measure.
    
    Micaela Mayero's avatar
    Micaela Mayero committed
    
    Definition intcc : R -> R -> R -> Prop :=
      fun a b x => a <= x /\ x <= b.
    
    (* Faire une notation pour LInt_p a b f *)
    
    
    Micaela Mayero's avatar
    Micaela Mayero committed
    Lemma LInt_calc_constant_aux :
      forall a b c, a <= b -> (0 <= c) ->
    
    Sylvie Boldo's avatar
    Sylvie Boldo committed
        LInt l_meas (fun x => c * charac (intcc a b) x) = c * (b - a).
    
    Micaela Mayero's avatar
    Micaela Mayero committed
    Proof.
    intros a b c H1 H2.
    
    (* The following does not apply anymore... *)
    (*rewrite LInt_eq_p; try easy. (* LInt_eq_p is not yet proved! *)
    
    Micaela Mayero's avatar
    Micaela Mayero committed
    erewrite LInt_p_ext.
    
    rewrite LInt_p_scal_finite with
    
    Micaela Mayero's avatar
    Micaela Mayero committed
      (f:=(fun x => Finite (charac (intcc a b) x))); try easy.
    2: apply H2.
    2: intros x; simpl; easy.
    simpl.
    rewrite LInt_p_charac; try easy.
    simpl.
    unfold intcc; rewrite lambda_star_int_cc.
    simpl; f_equal; f_equal.
    rewrite Rmax_right; lra.
    apply measurable_R_intcc.
    intros x; simpl.
    apply Rmult_le_pos; try easy.
    
    apply nonneg_charac.
    
    Micaela Mayero's avatar
    Micaela Mayero committed
    
    Lemma LInt_calc_constant :
      forall a b c, a <= b ->
    
    Sylvie Boldo's avatar
    Sylvie Boldo committed
        LInt l_meas (fun x => c * charac (intcc a b) x) = c * (b - a).
    
    Micaela Mayero's avatar
    Micaela Mayero committed
    Proof.
    intros a b c H.
    (* séparer cas c >= 0 ou non *)
    
    Micaela Mayero's avatar
    Micaela Mayero committed
    
    
    Sylvie Boldo's avatar
    Sylvie Boldo committed
    Lemma LInt_p_calc_identity_0_1 :
      LInt_p l_meas (fun x:R => Rbar_mult x (charac (intcc 0 1) x)) = 1/2.
    Proof.
    assert (KR: inhabited R).
    apply (inhabits 0%R).
    
    pose (f:= (fun x0 : R => Rbar_mult x0 (charac (intcc 0 1) x0))); fold f.
    
    assert (Hf1 : nonneg f).
    
    Sylvie Boldo's avatar
    Sylvie Boldo committed
    assert (Hf2 : measurable_fun_Rbar gen_R f).
    apply measurable_fun_when_charac with (f':= fun x => Finite x).
    apply measurable_R_intcc.
    intros t; easy.
    intros A.
    apply measurable_Rbar_R.
    (* *)
    rewrite <- LInt_p_with_mk_adapted_seq; try easy.
    apply trans_eq with (Sup_seq (fun n => /2* (1-/pow 2 n))).
    (* Question pow or powerRZ or .. ? *)
    apply Sup_seq_ext.
    intros n.
    
    pose (Y:= (mk_adapted_seq_SF f Hf1 Hf2)).
    rewrite LInt_p_SFp_eq with (Hf:=Y n); try easy.
    unfold Y.
    
    
    François Clément's avatar
    François Clément committed
    (*needs mk_adapted_seq_SF to be Defined instead of Qed *)
    
    Sylvie Boldo's avatar
    Sylvie Boldo committed
    
    (* Stopped for now!
    Very unpractical as the lists are awful to handle
    => not sure it is the good method...
    
    
    Other solution: prove that \phi_n =
      \Sum_{k=0}^{2^n-1} k/2^n *
    
    Sylvie Boldo's avatar
    Sylvie Boldo committed
        charac(fun t => k/2^n <= t < (k+1)/2^n)    +1_{x=1}
    
    then \int \phi_n = \Sum \int (constant funs) = ...
    
    
    François Clément's avatar
    François Clément committed
    => maybe too complicated for what it is worth
    
    Sylvie Boldo's avatar
    Sylvie Boldo committed
    
    Other solution: FTA (and \int x = x^2/2)
    
    
    Other solution by geometric transformations
    
    Sylvie Boldo's avatar
    Sylvie Boldo committed
      (Fubini, or change of variable, or...)
    *)
    
    Micaela Mayero's avatar
    Micaela Mayero committed
    Lemma LInt_calc_identity_0_1 :
    
    Sylvie Boldo's avatar
    Sylvie Boldo committed
      LInt l_meas (fun x => x * charac (intcc 0 1) x) = 1/2.
    
    Micaela Mayero's avatar
    Micaela Mayero committed
    Proof.
    
    Micaela Mayero's avatar
    Micaela Mayero committed
    
    Lemma LInt_p_calc_identity :
      forall a b, 0 <= a <= b ->
    
    Sylvie Boldo's avatar
    Sylvie Boldo committed
        LInt_p l_meas (fun x => x * charac (intcc a b) x) = (b - a) / 2.
    
    Micaela Mayero's avatar
    Micaela Mayero committed
    Proof.
    
    Micaela Mayero's avatar
    Micaela Mayero committed
    
    Lemma LInt_calc_identity :
      forall a b, a <= b ->
    
    Sylvie Boldo's avatar
    Sylvie Boldo committed
        LInt l_meas (fun x => x * charac (intcc a b) x) = (b - a) / 2.
    
    Micaela Mayero's avatar
    Micaela Mayero committed
    Proof.