Module mathcomp.experimental_reals.xfinmap
From mathcomp Require Import boot order algebra.
From mathcomp Require Export finmap.
Unset SsrOldRewriteGoalsOrder.
Set Implicit Arguments.
Unset Strict Implicit.
Unset Printing Implicit Defensive.
Set Asymmetric Patterns.
Import Order.TTheory GRing.Theory Num.Theory.
Local Open Scope ring_scope.
Local Open Scope fset_scope.
Lemma
uniq_fset_keysUsed by
Source code
{ : choiceType} ( : {fset K}) : uniq (enum_fset J).- mathcomp.experimental_reals.realsum
Source code
Proof.
#[global] Hint Resolve uniq_fset_keys : core.
Lemma
enum_fset0Source code
( : choiceType) :enum (fset0 : finType) = [::] :> seq (@fset0 T).
Lemma
enum_fset1Source code
( : choiceType) ( : T) :enum ([fset x] : finType) = [:: [`fset11 x]].
Proof.
Section BigFSet.
Variable ( : Type) (
idxSource code
: R) ( : Monoid.law idx).Variable ( : choiceType).
Lemma
big_fset0_condSource code
( : pred _) ( : _ -> R) :\big[op/idx]_( : @fset0 I | P i) F i = idx :> R.
Lemma
big_fset0Used by
Source code
( : @fset0 I -> R) :- mathcomp.experimental_reals.distr
- mathcomp.experimental_reals.realsum
Source code
\big[op/idx]_( : fset0) F i = idx.
Proof.
Lemma
big_fset1Source code
( : I) ( : [fset a] -> R) :\big[op/idx]_( : [fset a]) F i = F (FSetSub (fset11 a)).
Proof.
Section BigFSetCom.
Variable ( : Type) (
idxSource code
: R).Local Notation
"1"Source code
:= idx.Variable : Monoid.com_law 1.
Local Notation
"'*%M'"Source code
:= op (at level 0).Local Notation
"x * y"Source code
:= (op x y).Lemma
big_fset_seq_condSource code
( : choiceType) ( : {fset T}) :\big[*%M/1]_( : J | P (val x)) F (val x)
= \big[*%M/1]_( <- enum_fset J | P x) F x.
Proof.
case: J=> J c; rewrite -(big_map val) /index_enum.
by rewrite !unlock val_fset_sub_enum ?canonical_uniq.
Qed.
by rewrite !unlock val_fset_sub_enum ?canonical_uniq.
Qed.
Lemma
big_fset_seqUsed by
Source code
( : choiceType) ( : {fset T}) :- mathcomp.experimental_reals.distr
- mathcomp.experimental_reals.realsum
Source code
\big[*%M/1]_( : J) F (val x)
= \big[*%M/1]_( <- enum_fset J) F x.
Proof.
Lemma
big_seq_fset_condSource code
( : choiceType) ( : seq T) : uniq s ->\big[*%M/1]_( : [fset in s] | P (val x)) F (val x)
= \big[*%M/1]_( <- s | P x) F x.
Proof.
move=> eq_s; rewrite big_fset_seq_cond; apply/perm_big.
by apply/uniq_perm=> //= x; rewrite in_fset.
Qed.
by apply/uniq_perm=> //= x; rewrite in_fset.
Qed.
Lemma
big_seq_fsetUsed by
Source code
( : choiceType) ( : seq T) : uniq s ->- mathcomp.experimental_reals.realsum
Source code
\big[*%M/1]_( : [fset in s]) F (val x)
= \big[*%M/1]_( <- s) F x.
Proof.
Arguments big_fset_seq_cond [R idx op T J] P F.
Arguments big_fset_seq [R idx op T J] F.
Arguments big_seq_fset_cond [R idx op T s] P F _.
Arguments big_seq_fset [R idx op T s] F _.
Section BigFSetU.
Context { : Type} { : choiceType} (
idxSource code
: R) ( : Monoid.com_law idx).Lemma
big_fsetUSource code
( : {fset T}) : [disjoint A & B] ->\big[op/idx]_( : A `|` B) F (val j) =
op (\big[op/idx]_( : A) F (val j))
(\big[op/idx]_( : B) F (val j)).
Proof.
move=> dj_AB; rewrite !big_fset_seq -big_cat; apply/perm_big.
apply/uniq_perm=> //.
+ rewrite cat_uniq ?uniq_fset_keys !(andbT, andTb); apply/hasPn => x /=.
by apply/fdisjointP; rewrite fdisjoint_sym.
+ by move=> x; rewrite mem_cat in_fsetE.
Qed.
apply/uniq_perm=> //.
+ rewrite cat_uniq ?uniq_fset_keys !(andbT, andTb); apply/hasPn => x /=.
by apply/fdisjointP; rewrite fdisjoint_sym.
+ by move=> x; rewrite mem_cat in_fsetE.
Qed.
Section BigFSetOrder.
Variable ( : realDomainType) ( : choiceType).
Lemma
big_fset_subsetUsed by
Source code
( : {fset T}) ( : T -> R) :- mathcomp.experimental_reals.realsum
Source code
(forall , 0 <= F x) -> {subset I <= J} ->
\sum_( : I) F (val i) <= \sum_( : J) F (val j).
Proof.
move=> ge0_F le_IJ; rewrite !big_fset_seq /=.
rewrite [X in _<=X](bigID [pred : T | j \in I]) /=.
rewrite ler_wpDr ?sumr_ge0 // -[X in _<=X]big_filter.
rewrite le_eqVlt; apply/orP; left; apply/eqP/perm_big.
apply/uniq_perm; rewrite ?filter_uniq //; last move=> i.
rewrite mem_filter; case/boolP: (_ \in _) => //=.
by move/le_IJ => ->.
Qed.
rewrite [X in _<=X](bigID [pred : T | j \in I]) /=.
rewrite ler_wpDr ?sumr_ge0 // -[X in _<=X]big_filter.
rewrite le_eqVlt; apply/orP; left; apply/eqP/perm_big.
apply/uniq_perm; rewrite ?filter_uniq //; last move=> i.
rewrite mem_filter; case/boolP: (_ \in _) => //=.
by move/le_IJ => ->.
Qed.
Lemma
big_nat_mkfsetSource code
( : nat -> R) :\sum_(0 <= < n) F i =
\sum_( : [fset in (iota 0 n)]) F (val i).
Proof.
rewrite -(big_map val xpredT) /=; apply/perm_big.
apply/uniq_perm; rewrite ?iota_uniq //.
rewrite map_inj_uniq /=; first apply/val_inj.
by rewrite /index_enum -enumT enum_uniq.
by move=> i; rewrite /index_enum -enumT -enum_fsetE in_fset /index_iota subn0.
Qed.
apply/uniq_perm; rewrite ?iota_uniq //.
rewrite map_inj_uniq /=; first apply/val_inj.
by rewrite /index_enum -enumT enum_uniq.
by move=> i; rewrite /index_enum -enumT -enum_fsetE in_fset /index_iota subn0.
Qed.
Lemma
big_ord_mkfsetUsed by
Source code
( : nat -> R) :- mathcomp.experimental_reals.realsum
Source code
\sum_( < n) F i =
\sum_( : [fset in (iota 0 n)]) F (val i).
Proof.
Lemma
enum_fsetTUsed by
Source code
{ : finType} :- mathcomp.experimental_reals.realsum
Source code
perm_eq (enum [fset i | in I]) (enum I).