Skip to content

Commit 73c7aa2

Browse files
yosakaonaffeldt-aistproux01
authored
is_derive_trmx (#2060)
* is_derive_trmx Co-authored-by: Reynald Affeldt <reynald.affeldt@aist.go.jp> * mv instance to unstable * addressed comments by Pierre Co-authored-by: Pierre Roux <pierre.roux@onera.fr> --------- Co-authored-by: Reynald Affeldt <reynald.affeldt@aist.go.jp> Co-authored-by: Pierre Roux <pierre.roux@onera.fr>
1 parent 45cff6a commit 73c7aa2

5 files changed

Lines changed: 90 additions & 10 deletions

File tree

CHANGELOG_UNRELEASED.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@
5757

5858
- in `measurable_realfun.v`:
5959
+ lemma `measurable_bigmaxr`
60+
- in `matrix_normedtype.v`:
61+
+ lemma `norm_trmx`
62+
63+
- in `derive.v`:
64+
+ lemmas `derivable_trmx`, `derive_trmx`
65+
+ global instance `is_derive_trmx`
6066

6167
### Changed
6268

classical/unstable.v

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ From mathcomp Require Import vector archimedean interval matrix.
3838
(* K is a numDomainType. *)
3939
(* L is a lmodType K. *)
4040
(* The HB class is Norm. *)
41+
(* Module MaxNngComLaw == contains on instance of Monoid.isComLaw on *)
42+
(* (@maxr {nonneg _}) to be used with caution *)
4143
(* ``` *)
4244
(* *)
4345
(******************************************************************************)
@@ -647,3 +649,28 @@ End Theory.
647649
Module Import Exports. HB.reexport. End Exports.
648650
End Norm.
649651
Export Norm.Exports.
652+
653+
From mathcomp Require Import interval_inference.
654+
(* NB: This module adds an instance of `Monoid.Law.sort` on `Order.max`
655+
although there is already one. Use with caution. *)
656+
Module MaxNngComLaw.
657+
Section max_nng_comlaw.
658+
Import Num.Def.
659+
Context {K : realFieldType}.
660+
661+
Let nng_max0r : left_id ((0 : K)%:nng) (@maxr {nonneg K}).
662+
Proof.
663+
move=> x; rewrite /maxr; case: ifPn => //.
664+
rewrite -leNgt => x0.
665+
apply/eqP; rewrite eq_le x0 andbT.
666+
(* NB: the goal is `widen_itv 0%:itv <= x`, which does not match the syntax to
667+
trigger the hint for `ge0` as can be seen at
668+
https://github.com/math-comp/math-comp/blob/900e37912dbecbd3c04d3c1b320efe721d3f56dd/algebra/interval_inference.v#L770 *)
669+
by rewrite -num_le/=.
670+
Qed.
671+
672+
HB.instance Definition _ :=
673+
Monoid.isComLaw.Build {nonneg K} 0%:nng maxr maxA maxC nng_max0r.
674+
675+
End max_nng_comlaw.
676+
End MaxNngComLaw.

theories/derive.v

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2511,6 +2511,41 @@ apply/derivable_mxP => i0 j0.
25112511
by have [] := MdM i0 j0.
25122512
Qed.
25132513

2514+
Lemma derivable_trmx {m n} (M : V -> 'M[R]_(m, n)) t v :
2515+
derivable (fun x => (M x)^T) t v = derivable M t v.
2516+
Proof.
2517+
suff: forall N, derivable N t v -> derivable (fun x => (N x)^T) t v.
2518+
move=> suf; apply/propext; split; last exact: suf.
2519+
by move=> /suf; under eq_fun do rewrite trmxK.
2520+
move=> {}m {}n {}M /cvg_ex[/= l Ml]; apply/cvg_ex => /=; exists l^T.
2521+
apply/cvgrPdist_le => /= e e0.
2522+
move/cvgrPdist_le : Ml => /(_ _ e0)[/= r r0 re].
2523+
near=> x.
2524+
rewrite [leLHS](_ : _ = `|l - x^-1 *: (M (x *: v + t) - M t)|).
2525+
rewrite -[RHS]norm_trmx [in RHS]linearD/= [in RHS]linearN/=.
2526+
by congr (`| _ - _ |); rewrite [RHS]linearZ/= [in RHS]linearB.
2527+
apply: re => /=; last by near: x; exact: nbhs_dnbhs_neq.
2528+
by rewrite sub0r normrN; near: x; exact: dnbhs0_lt.
2529+
Unshelve. all: by end_near. Qed.
2530+
2531+
Lemma derive_trmx {m n} (M : V -> 'M[R]_(m, n)) t v :
2532+
derivable M t v -> 'D_v (trmx \o M) t = ('D_v M t)^T.
2533+
Proof.
2534+
move=> Mtv; rewrite !derive_mx//=; first by rewrite derivable_trmx.
2535+
apply/matrixP => i j; rewrite !mxE.
2536+
by under eq_fun do rewrite mxE.
2537+
Qed.
2538+
2539+
Global Instance is_derive_trmx {m n} (f : V -> 'M[R]_(m, n)) (f' : 'M[R]_(m, n))
2540+
(t : V) w :
2541+
is_derive t w f f' -> is_derive t w (fun x => (f x)^T) f'^T.
2542+
Proof.
2543+
move=> fD.
2544+
have fDer : derivable f t w by case: fD.
2545+
apply/DeriveDef; last by have [_ <-] := fD; rewrite derive_trmx.
2546+
by rewrite derivable_trmx.
2547+
Qed.
2548+
25142549
Fact dmx {m n : nat} (M : V -> 'M[R]_(m, n)) (x : V) :
25152550
let g := fun t : V => (\matrix_(i < m, j < n) 'd M x t i j) in
25162551
differentiable M x ->

theories/lebesgue_integral_theory/radon_nikodym.v

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
From HB Require Import structures.
33
From mathcomp Require Import boot order ssralg ssrnum ssrint interval.
44
From mathcomp Require Import interval_inference finmap fingroup perm rat.
5-
#[warning="-warn-library-file-internal-analysis"]
6-
From mathcomp Require Import unstable.
75
From mathcomp Require Import boolp classical_sets cardinality functions fsbigop
86
set_interval reals.
97
From mathcomp Require Import topology ereal numfun normedtype derive sequences.

theories/normedtype_theory/matrix_normedtype.v

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ by rewrite predeqE => x /=; split => [ _ | _ []//]; apply/rowP => -[].
109109
Qed.
110110

111111
Section mx_norm.
112-
Variables (K : numDomainType) (m n : nat).
112+
Context [K : numDomainType] {m n : nat}.
113113
Implicit Types x y : 'M[K]_(m, n).
114114

115115
Definition mx_norm x : K := (\big[maxr/0%:nng]_i `|x i.1 i.2|%:nng)%:num.
@@ -172,6 +172,25 @@ Qed.
172172

173173
End mx_norm.
174174

175+
HB.instance Definition _ {K : numDomainType} m n :=
176+
Num.Zmodule_isNormed.Build K 'M[K]_(m, n)
177+
(@ler_mx_norm_add _ _ _) (@mx_norm_eq0 _ _ _)
178+
(@mx_norm_natmul _ _ _) (@mx_normN _ _ _).
179+
180+
Section norm_trmx.
181+
Import MaxNngComLaw.
182+
183+
Lemma norm_trmx {R : realFieldType} m n (M : 'M[R]_(m, n)) :
184+
mx_norm M^T = mx_norm M.
185+
Proof.
186+
rewrite [LHS]mx_normE/=.
187+
under eq_bigr do rewrite mxE/=.
188+
rewrite -(pair_big xpredT xpredT (fun i j => `|M j i|%:nng))/=.
189+
by rewrite exchange_big//= pair_big.
190+
Qed.
191+
192+
End norm_trmx.
193+
175194
Lemma mx_normrE (K : realDomainType) (m n : nat) (x : 'M[K]_(m, n)) :
176195
mx_norm x = \big[maxr/0]_ij `|x ij.1 ij.2|.
177196
Proof.
@@ -180,13 +199,8 @@ elim/big_ind2 : _ => //= a a' b b' ->{a'} ->{b'}.
180199
by have [ab|ab] := leP a b; [rewrite max_r | rewrite max_l // ltW].
181200
Qed.
182201

183-
HB.instance Definition _ (K : numDomainType) (m n : nat) :=
184-
Num.Zmodule_isNormed.Build K 'M[K]_(m, n)
185-
(@ler_mx_norm_add _ _ _) (@mx_norm_eq0 _ _ _)
186-
(@mx_norm_natmul _ _ _) (@mx_normN _ _ _).
187-
188202
Section example_of_sharing.
189-
Variables (K : numDomainType).
203+
Context {K : numDomainType}.
190204

191205
Example matrix_triangle m n (M N : 'M[K]_(m, n)) :
192206
`|M + N| <= `|M| + `|N|.
@@ -198,7 +212,7 @@ Proof. exact: ler_normD. Qed.
198212
End example_of_sharing.
199213

200214
Section matrix_pseudoMetricNormedZmod.
201-
Variables (K : numFieldType) (m n : nat).
215+
Context {K : numFieldType} {m n : nat}.
202216

203217
Local Lemma ball_gt0 (x y : 'M[K]_(m, n)) e : ball x e y -> 0 < e.
204218
Proof. by case. Qed.

0 commit comments

Comments
 (0)