Module mathcomp.experimental_reals.discrete
From Corelib Require Setoid.
From HB Require Import structures.
From mathcomp Require Import boot order algebra.
From mathcomp.classical Require Import boolp.
From mathcomp Require Import xfinmap reals.
Unset SsrOldRewriteGoalsOrder.
Set Implicit Arguments.
Unset Strict Implicit.
Unset Printing Implicit Defensive.
Import GRing.Theory Num.Theory.
Local Open Scope ring_scope.
Local Open Scope real_scope.
Context {TSource code : choiceType}.
Lemma existsTPUsed by
- mathcomp.experimental_reals.realsum
Source code (PSource code : T -> Prop) : { xSource code : T | P x } + (forall xSource code, ~ P x).
Proof.
End ProofIrrelevantChoice.
Variable TSource code : Type.
Variable ESource code : pred T.
Record pred_subSource code : Type :=
PSubSub { rsvalSource code :> T; rsvalPSource code : rsval \in E }.
HBSource code.instanceSource code DefinitionSource code _Source code :=Source code [isSubSource code for rsval].
End Def.
HBSource code.instanceSource code DefinitionSource code _Source code (TSource code :Source code eqTypeSource code) (E : pred T) :=
[Equality of pred_sub E by <:].
HBSource code.instanceSource code DefinitionSource code _Source code (TSource code :Source code choiceTypeSource code) (E : pred T) :=
[Choice of pred_sub E by <:].
HBSource code.instanceSource code DefinitionSource code _Source code (TSource code :Source code countTypeSource code) (E : pred T) :=
[Countable of pred_sub E by <:].
End PredSubtype.
Notation "[ 'psub' E ]"Source code := (@pred_sub _ E)
(format "[ 'psub' E ]").
Variables (TSource code : Type) (ESource code FSource code : pred T) (leSource code : {subset E <= F}).
Definition pincl
pincl : forall [T : Type] [E F : pred T], {subset E <= F} -> [psub E] -> [psub F] pincl is not universe polymorphic Arguments pincl [T]%_type_scope [E F] le x pincl is transparent Expands to: Constant mathcomp.experimental_reals.discrete.pincl Declared in library mathcomp.experimental_reals.discrete, line 66, characters 11-16
Source code (xSource code : [psub E]) : [psub F] :=
PSubSub (le (valP x)).
End PIncl.
Variable (TSource code : Type) (ESource code : pred T).
Variant countableUsed by
- mathcomp.experimental_reals.realsum
Source code : Type :=
CountableSource code
(rpickleSource code : [psub E] -> nat)
(runpickleSource code : nat -> option [psub E])
of pcancel rpickle runpickle.
Definition rpickle
rpickle : forall [T : Type] [E : pred T], countable (T:=T) E -> [psub E] -> nat rpickle is not universe polymorphic Arguments rpickle [T]%_type_scope [E] c _ rpickle is transparent Expands to: Constant mathcomp.experimental_reals.discrete.rpickle Declared in library mathcomp.experimental_reals.discrete, line 80, characters 11-18
Source code (cSource code : countable) :=
let: Countable p _ _ := c in p.
Definition runpickle
runpickle : forall [T : Type] [E : pred T], countable (T:=T) E -> nat -> option [psub E] runpickle is not universe polymorphic Arguments runpickle [T]%_type_scope [E] c _%_nat_scope runpickle is transparent Expands to: Constant mathcomp.experimental_reals.discrete.runpickle Declared in library mathcomp.experimental_reals.discrete, line 83, characters 11-20
Source code (cSource code : countable) :=
let: Countable _ p _ := c in p.
Lemma rpickleKSource code cSource code: pcancel (rpickle c) (runpickle c).
Proof.
Lemma countable_countableSource code (TSource code : countType) (ESource code : pred T) : countable E.
Variables (TSource code : Type) (USource code : countType) (ESource code : pred T).
Variables (fSource code : [psub E] -> U) (gSource code : U -> [psub E]).
Lemma can_countableSource code : cancel f g -> countable E.
Proof.
Variables (TSource code : eqType) (ESource code : pred T) (cSource code : countable E).
Definition countable_countMixin
countable_countMixin : forall [T : eqType] [E : pred T], countable (T:=T) E -> Countable.axioms_ [psub E] countable_countMixin is not universe polymorphic Arguments countable_countMixin [T E] c countable_countMixin is transparent Expands to: Constant mathcomp.experimental_reals.discrete.countable_countMixin Declared in library mathcomp.experimental_reals.discrete, line 110, characters 11-31
Source code := Countable.copy [psub E]
(pcan_type (rpickleK c)).
Definition countable_choiceMixin
countable_choiceMixin : forall [T : eqType] [E : pred T], countable (T:=T) E -> Choice.axioms_ [psub E] countable_choiceMixin is not universe polymorphic Arguments countable_choiceMixin [T E] c countable_choiceMixin is transparent Expands to: Constant mathcomp.experimental_reals.discrete.countable_choiceMixin Declared in library mathcomp.experimental_reals.discrete, line 112, characters 11-32
Source code := Choice.copy [psub E]
(pcan_type (rpickleK c)).
End CountType.
Variables (TSource code : eqType).
CoInductive finiteSource code (ESource code : pred T) : Type :=
| FiniteSource code sSource code of uniq s & {subset E <= s}.
End Finite.
Context {TSource code : choiceType}.
Lemma finitePUsed by
- mathcomp.experimental_reals.realsum
Source code (ESource code : pred T) : (exists sSource code : seq T, {subset E <= s}) -> finite E.
Proof.
by move=> x; rewrite mem_undup; exact: sEs.
Qed.
Lemma finiteNPUsed by
- mathcomp.experimental_reals.realsum
Source code (ESource code : pred T): (forall sSource code : seq T, ~ {subset E <= s}) ->
forall nSource code, exists sSource code : seq T, [/\ size s = n, uniq s & {subset s <= E}].
Proof.
have [x sxN xE]: exists2 xSource code, x \notin s & x \in E.
apply: contra_notP (finN (filter (mem E) s)) => /forall2NP finE x Ex.
move/or_asboolP: (finE x).
by rewrite !asbool_neg !asboolb negbK Ex mem_filter orbF [(mem E) x]Ex.
exists (x :: s) => /=; rewrite sxN; split=> // y.
by rewrite in_cons => /orP[/eqP->//|/sE].
Qed.
End FiniteTheory.
Variables (TSource code : eqType) (ESource code : pred T).
Lemma finite_countableUsed by
- mathcomp.experimental_reals.realsum
Source code : finite E -> countable E.
Proof.
pose f xSource code := index x t; pose g iSource code := nth None [seq Some x | xSource code <- t] i.
apply (@Countable _ E f g) => x; rewrite {}/f {}/g /=.
have x_in_t: x \in t; first case: x => x h.
by rewrite {}/t mem_pmap_sub /= Es.
by rewrite (nth_map x) ?index_mem ?nth_index.
Qed.
Variables (TSource code : eqType) (ESource code FSource code : pred T).
Lemma countable_subUsed by
- mathcomp.experimental_reals.realsum
Source code: {subset E <= F} -> countable F -> countable E.
Proof.
Variables (TSource code : eqType) (ESource code : nat -> pred T).
Hypothesis cESource code : forall iSource code, countable (E i).
Lemma cunion_countableUsed by
- mathcomp.experimental_reals.realsum
Source code : countable [pred xSource code | `[< exists iSource code, x \in E i >]].
Proof.
pose S := { iSource code : nat & Ci i }; set F := [pred xSource code | _].
have H: forall (xSource code : [psub F]), exists iSource code : nat, val x \in E i.
by case=> x /= /asboolP[i] Eix; exists i.
have G: forall (xSource code : S), val (tagged x) \in F.
by case=> i [x /= Eix]; apply/asboolP; exists i.
pose f (xSource code : [psub F]) : S := Tagged (fun iSource code => [psub E i])
(PSubSub (xchooseP (H x))).
pose g (xSource code : S) := PSubSub (G x).
by have /can_countable: cancel f g by case=> x hx; apply/val_inj.
Qed.