(****************************************************************************** Markov's inequality.  Based on Wikipedia proof Copyright 2008 Robert Kam  This program 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 program 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 GNU Lesser General Public License for more details.  You should have received a copy of the GNU Lesser General Public License along with this program.  If not, see <http://www.gnu.org/licenses/>. ******************************************************************************)
(* sigalg = sigma algebra preimg = preimage cntabl = countable msur = measure function msurable = measurable simple = simple function lebint = Lebesgue integral lebint_s = Lebesgue integral for simple function borl = Borel set unoin = union *)
(****************************************************************************** Note: chicli_pottier_simpson, classic, Extensionality_Ensembles, NNPP are used frequently Also lemmas from Rtopology which use classic as well as R_total_order ******************************************************************************)
Require Export Powerset.
Require Export Rtopology.
Require Export Raxioms.
Require Export Rfunctions.
Require Export Image.
Require Export RIneq.
Require Export PartSum.
intros EM. pose(select:=fun b:bool=>if b then P else ~P). assert{b:bool|
select b}as([|],HP). apply constructive_definite_description. rewrite<-
unique_existence;split. destruct EM. exists true;trivial. exists false;trivial.
intros[|][|]H1 H2;simpl in *;reflexivity||contradiction. left;trivial. right;
trivial. Qed.

Lemma if_r:forall(A B:Prop)(C:Type)(H:{A}+{B})(x y:C),
~A->(if H then x else y)=y. intuition. Qed.