Skip to content

Commit c32785e

Browse files
affeldt-aistproux01
andcommitted
addressed comments by Pierre
Co-authored-by: Pierre Roux <pierre.roux@onera.fr>
1 parent 3b0b8c5 commit c32785e

3 files changed

Lines changed: 31 additions & 30 deletions

File tree

classical/unstable.v

Lines changed: 12 additions & 3 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
(******************************************************************************)
@@ -649,7 +651,10 @@ End Norm.
649651
Export Norm.Exports.
650652

651653
From mathcomp Require Import interval_inference.
652-
Section nng_comlaw.
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.
653658
Import Num.Def.
654659
Context {K : realFieldType}.
655660

@@ -658,10 +663,14 @@ Proof.
658663
move=> x; rewrite /maxr; case: ifPn => //.
659664
rewrite -leNgt => x0.
660665
apply/eqP; rewrite eq_le x0 andbT.
661-
by have : 0 <= x%:nngnum by []. (* NB: why isn't this automatic? *)
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/=.
662670
Qed.
663671

664672
HB.instance Definition _ :=
665673
Monoid.isComLaw.Build {nonneg K} 0%:nng maxr maxA maxC nng_max0r.
666674

667-
End nng_comlaw.
675+
End max_nng_comlaw.
676+
End MaxNngComLaw.

theories/derive.v

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2514,31 +2514,18 @@ Qed.
25142514
Lemma derivable_trmx {m n} (M : V -> 'M[R]_(m, n)) t v :
25152515
derivable (fun x => (M x)^T) t v = derivable M t v.
25162516
Proof.
2517-
rewrite propeqE; split; rewrite /derivable/=.
2518-
- move=> /cvg_ex[/= l Ml]; apply/cvg_ex => /=; exists l^T.
2519-
apply/cvgrPdist_le => /= e e0.
2520-
move/cvgrPdist_le : Ml => /(_ _ e0)[/= r r0 re].
2521-
near=> x.
2522-
rewrite [leLHS](_ : _ = `|l - x^-1 *: ((M (x *: v + t))^T - (M t)^T)|).
2523-
rewrite -[RHS]norm_trmx [in RHS]linearD/= [in RHS]linearN/=.
2524-
congr (`| _ - _ |).
2525-
by rewrite [RHS]linearZ/= [in RHS]linearB /= !trmxK.
2526-
apply: re => /=.
2527-
rewrite sub0r normrN.
2528-
by near: x; exact: dnbhs0_lt.
2529-
by near: x; exact: nbhs_dnbhs_neq.
2530-
- move=> /cvg_ex[/= l Ml]; apply/cvg_ex => /=; exists l^T.
2531-
apply/cvgrPdist_le => /= e e0.
2532-
move/cvgrPdist_le : Ml => /(_ _ e0)[/= r r0 re].
2533-
near=> x.
2534-
rewrite [leLHS](_ : _ = `|l - x^-1 *: ((M (x *: v + t)) - (M t))|).
2535-
rewrite -[RHS]norm_trmx [in RHS]linearD/= [in RHS]linearN/=.
2536-
congr (`| _ - _ |).
2537-
by rewrite [RHS]linearZ/= [in RHS]linearB.
2538-
apply: re => /=.
2539-
rewrite sub0r normrN.
2540-
by near: x; exact: dnbhs0_lt.
2541-
by near: x; exact: nbhs_dnbhs_neq.
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.
25422529
Unshelve. all: by end_near. Qed.
25432530

25442531
Lemma derive_trmx {m n} (M : V -> 'M[R]_(m, n)) t v :

theories/normedtype_theory/matrix_normedtype.v

Lines changed: 7 additions & 2 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.
@@ -177,15 +177,20 @@ HB.instance Definition _ {K : numDomainType} m n :=
177177
(@ler_mx_norm_add _ _ _) (@mx_norm_eq0 _ _ _)
178178
(@mx_norm_natmul _ _ _) (@mx_normN _ _ _).
179179

180+
Section norm_trmx.
181+
Import MaxNngComLaw.
182+
180183
Lemma norm_trmx {R : realFieldType} m n (M : 'M[R]_(m, n)) :
181-
mx_norm (M^T) = mx_norm M.
184+
mx_norm M^T = mx_norm M.
182185
Proof.
183186
rewrite [LHS]mx_normE/=.
184187
under eq_bigr do rewrite mxE/=.
185188
rewrite -(pair_big xpredT xpredT (fun i j => `|M j i|%:nng))/=.
186189
by rewrite exchange_big//= pair_big.
187190
Qed.
188191

192+
End norm_trmx.
193+
189194
Lemma mx_normrE (K : realDomainType) (m n : nat) (x : 'M[K]_(m, n)) :
190195
mx_norm x = \big[maxr/0]_ij `|x ij.1 ij.2|.
191196
Proof.

0 commit comments

Comments
 (0)