Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG_UNRELEASED.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@

- in `realfun.v`:
+ instance `is_derive1_sqrt`
- in `mathcomp_extra.v`:
+ lemmas `subrKC`, `sumr_le0`, `card_fset_sum1`

- in `functions.v`:
+ lemmas `fct_prodE`, `prodrfctE`

- in `exp.v:
+ lemma `norm_expR`

### Changed

Expand Down
2 changes: 1 addition & 1 deletion classical/classical_sets.v
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,7 @@ Proof. by case=> [t ?]; exists (f t). Qed.
Lemma preimage_image f A : A `<=` f @^-1` (f @` A).
Proof. by move=> a Aa; exists a. Qed.

Lemma preimage_range {A B : Type} (f : A -> B) : f @^-1` (range f) = [set: A].
Lemma preimage_range f : f @^-1` (range f) = [set: aT].
Proof. by rewrite eqEsubset; split=> x // _; exists x. Qed.

Lemma image_preimage_subset f Y : f @` (f @^-1` Y) `<=` Y.
Expand Down
9 changes: 9 additions & 0 deletions classical/functions.v
Original file line number Diff line number Diff line change
Expand Up @@ -2652,6 +2652,11 @@ Lemma fct_sumE (I T : Type) (M : nmodType) r (P : {pred I}) (f : I -> T -> M) :
\sum_(i <- r | P i) f i = fun x => \sum_(i <- r | P i) f i x.
Proof. by apply/funext => ?; elim/big_rec2: _ => //= i y ? Pi <-. Qed.

Lemma fct_prodE (I : Type) (T : pointedType) (M : ringType) r (P : {pred I})
(f : I -> T -> M) :
\prod_(i <- r | P i) f i = fun x => \prod_(i <- r | P i) f i x.
Proof. by apply/funext => ?; elim/big_rec2: _ => //= i y ? Pi <-. Qed.

Lemma mul_funC (T : Type) {R : comSemiRingType} (f : T -> R) (r : R) :
r \*o f = r \o* f.
Proof. by apply/funext => x/=; rewrite mulrC. Qed.
Expand All @@ -2670,6 +2675,10 @@ Lemma sumrfctE (T : Type) (K : nmodType) (s : seq (T -> K)) :
\sum_(f <- s) f = (fun x => \sum_(f <- s) f x).
Proof. exact: fct_sumE. Qed.

Lemma prodrfctE (T : pointedType) (K : ringType) (s : seq (T -> K)) :
\prod_(f <- s) f = (fun x => \prod_(f <- s) f x).
Proof. exact: fct_prodE. Qed.

Lemma natmulfctE (U : Type) (K : nmodType) (f : U -> K) n :
f *+ n = (fun x => f x *+ n).
Proof. by elim: n => [//|n h]; rewrite funeqE=> ?; rewrite !mulrSr h. Qed.
Expand Down
18 changes: 18 additions & 0 deletions classical/mathcomp_extra.v
Original file line number Diff line number Diff line change
Expand Up @@ -470,3 +470,21 @@ Proof. by move=> ? ? []. Qed.

Lemma inl_inj {A B} : injective (@inl A B).
Proof. by move=> ? ? []. Qed.

(**************************)
(* MathComp 2.5 additions *)
(**************************)

Section ssralg.
Lemma subrKC {V : zmodType} (x y : V) : x + (y - x) = y.
Proof. by rewrite addrC subrK. Qed.
End ssralg.

Lemma sumr_le0 (R : numDomainType) I (r : seq I) (P : pred I) (F : I -> R) :
(forall i, P i -> F i <= 0)%R -> (\sum_(i <- r | P i) F i <= 0)%R.
Proof. by move=> F0; elim/big_rec : _ => // i x Pi; apply/ler_wnDl/F0. Qed.

(* to appear in coq-mathcomp-finmap > 2.2.1 *)
Lemma card_fset_sum1 (T : choiceType) (A : {fset T}) :
#|` A| = (\sum_(i <- A) 1)%N.
Proof. by rewrite big_seq_fsetE/= sum1_card cardfE. Qed.
21 changes: 4 additions & 17 deletions classical/unstable.v
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ Unset Printing Implicit Defensive.
Import Order.TTheory GRing.Theory Num.Theory.
Local Open Scope ring_scope.

Section ssralg.
Lemma subrKC {V : zmodType} (x y : V) : x + (y - x) = y.
Proof. by rewrite addrC subrK. Qed.
End ssralg.

(* NB: Coq 8.17.0 generalizes dependent_choice from Set to Type
making the following lemma redundant *)
Section dependent_choice_Type.
Expand Down Expand Up @@ -164,10 +159,6 @@ Qed.
End path_lt.
Arguments last_filterP {d T a} P s.

Lemma sumr_le0 (R : numDomainType) I (r : seq I) (P : pred I) (F : I -> R) :
(forall i, P i -> F i <= 0)%R -> (\sum_(i <- r | P i) F i <= 0)%R.
Proof. by move=> F0; elim/big_rec : _ => // i x Pi; apply/ler_wnDl/F0. Qed.

Inductive boxed T := Box of T.

Reserved Notation "`1- r" (format "`1- r", at level 2).
Expand All @@ -192,10 +183,6 @@ have [i _ /(_ _ isT) mf] := @arg_maxnP _ (@ord0 n) xpredT f isT.
by exists i; split; rewrite ?leq_ord// => j jn; have := mf (@Ordinal n.+1 j jn).
Qed.

Lemma card_fset_sum1 (T : choiceType) (A : {fset T}) :
#|` A| = (\sum_(i <- A) 1)%N.
Proof. by rewrite big_seq_fsetE/= sum1_card cardfE. Qed.

Arguments big_rmcond {R idx op I r} P.
Arguments big_rmcond_in {R idx op I r} P.

Expand Down Expand Up @@ -411,7 +398,7 @@ Qed.

End FsetPartitions.

(* TODO: move to ssrnum *)
(* PR 1420 to MathComp in progress *)
Lemma prodr_ile1 {R : realDomainType} (s : seq R) :
(forall x, x \in s -> 0 <= x <= 1)%R -> (\prod_(j <- s) j <= 1)%R.
Proof.
Expand All @@ -423,11 +410,11 @@ rewrite mulr_ile1 ?andbT//.
by rewrite ih// => e xs; rewrite xs01// in_cons xs orbT.
Qed.

(* TODO: move to ssrnum *)

(* PR 1420 to MathComp in progress *)
Lemma size_filter_gt0 T P (r : seq T) : (size (filter P r) > 0)%N = (has P r).
Proof. by elim: r => //= x r; case: ifP. Qed.

(* PR 1420 to MathComp in progress *)
Lemma ltr_sum [R : numDomainType] [I : Type] (r : seq I)
[P : pred I] [F G : I -> R] :
has P r ->
Expand All @@ -440,6 +427,7 @@ rewrite !big_cons ltr_leD// ?ltFG// -(all_filterP Pr) !big_filter.
by rewrite ler_sum => // i Pi; rewrite ltW ?ltFG.
Qed.

(* PR 1420 to MathComp in progress *)
Lemma ltr_sum_nat [R : numDomainType] [m n : nat] [F G : nat -> R] :
(m < n)%N -> (forall i : nat, (m <= i < n)%N -> F i < G i) ->
\sum_(m <= i < n) F i < \sum_(m <= i < n) G i.
Expand All @@ -448,7 +436,6 @@ move=> lt_mn i; rewrite big_nat [ltRHS]big_nat ltr_sum//.
by apply/hasP; exists m; rewrite ?mem_index_iota leqnn lt_mn.
Qed.


Lemma eq_exists2l (A : Type) (P P' Q : A -> Prop) :
(forall x, P x <-> P' x) ->
(exists2 x, P x & Q x) <-> (exists2 x, P' x & Q x).
Expand Down
3 changes: 3 additions & 0 deletions theories/exp.v
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,9 @@ Qed.

Lemma expR_ge0 x : 0 <= expR x. Proof. by rewrite ltW// expR_gt0. Qed.

Lemma norm_expR : normr \o expR = (expR : R -> R).
Proof. by apply/funext => x /=; rewrite ger0_norm ?expR_ge0. Qed.

Lemma expR_eq0 x : (expR x == 0) = false.
Proof. by rewrite gt_eqF ?expR_gt0. Qed.

Expand Down