Remove the workarounds introduced in #1125#1365
Conversation
40508a7 to
bd7c788
Compare
df61543 to
c34342c
Compare
|
|
||
| Let vs2mx0 : @vs2mx K vT 0 = 0. | ||
| Proof. by rewrite /= linear0 genmx0. Qed. | ||
| Proof. by rewrite /= linear0 genmx0. Qed. (* slow *) |
| Lemma vlineP v1 v2 : reflect (exists k, v1 = k *: v2) (v1 \in <[v2]>)%VS. | ||
| Proof. | ||
| apply: (iffP idP) => [|[k ->]]; rewrite memvK genmxE ?linearZ ?scalemx_sub //. | ||
| apply: (iffP idP) => [|[k ->]]; rewrite memvK genmxE ?linearZ ?scalemx_sub //. (* slow *) |
| Proof. | ||
| split=> [|a u v]; rewrite !memvK 1?linear0 1?sub0mx // => Uu Uv. | ||
| by rewrite linearP addmx_sub ?scalemx_sub. | ||
| split=> [|a u v]; rewrite !memvK 1?linear0 1?sub0mx // => Uu Uv. (* slow *) |
| split=> [|a u v]; rewrite !memvK 1?linear0 1?sub0mx // => Uu Uv. | ||
| by rewrite linearP addmx_sub ?scalemx_sub. | ||
| split=> [|a u v]; rewrite !memvK 1?linear0 1?sub0mx // => Uu Uv. (* slow *) | ||
| by rewrite linearP addmx_sub ?scalemx_sub. (* slow *) |
|
|
||
| Lemma memv_add u v U V : u \in U -> v \in V -> u + v \in (U + V)%VS. | ||
| Proof. by rewrite !memvK genmxE linearD; apply: addmx_sub_adds. Qed. | ||
| Proof. by rewrite !memvK genmxE linearD; apply: addmx_sub_adds. Qed. (* slow *) |
|
|
||
| Lemma xcfun_is_additive phi : additive (xcfun phi). | ||
| Proof. by move=> A B; rewrite /xcfun [gring_row _]linearB mulmxBl !mxE. Qed. | ||
| Proof. by move=> A B; rewrite /xcfun [gring_row _]linearB mulmxBl !mxE. Qed. (* slow *) |
| move=> Gx; apply/eqP; rewrite 2!mulmxA mul_rV_lin1 -subr_eq0 -mulmxBr /=. | ||
| rewrite uv0 // linearB /= mulmxBr vec_mxK; split. (* FIXME: slow *) | ||
| move=> Gx; apply/eqP; rewrite 2!mulmxA mul_rV_lin1 -subr_eq0 -mulmxBr. | ||
| rewrite uv0 // 2!linearB /= vec_mxK; split. (* slow *) |
There was a problem hiding this comment.
It might be worth keeping the workaround here.
There was a problem hiding this comment.
This one sounds bad (with which version of Rocq?)
There was a problem hiding this comment.
Damn, then we should indeed keep the workaround here.
There was a problem hiding this comment.
For me, it's unclear if the slowdown comes from 1) the changes in instance declarations, 2) the changes in proofs, or 3) both. We should keep the whole workaround in place until we better understand the situation.
| move=> A B RnA RnB /= eqAB; apply/eqP; rewrite -subr_eq0 -mxvec_eq0 -submx0. | ||
| rewrite -ker_irr_comp_op sub_capmx (sameP sub_kermxP eqP) mul_vec_lin. | ||
| by rewrite 2!raddfB /= eqAB subrr linear0 addmx_sub ?eqmx_opp /=. | ||
| by rewrite 2!linearB /= eqAB subrr linear0 addmx_sub ?eqmx_opp /=. (* slow *) |
| rewrite (mx_Schur irrG) ?subr_eq0 //; last first. | ||
| by apply: contraNneq nscal_rGx => ->; apply: scalar_mx_is_scalar. | ||
| rewrite -memmx_cent_envelop raddfB. | ||
| rewrite -memmx_cent_envelop linearB. (* slow *) |
| Proof. by apply: (canLR in_genK); rewrite in_gen0. Qed. | ||
|
|
||
| Lemma in_genN : {morph in_gen : W / - W}. | ||
| Proof. by move=> W; apply/matrixP=> i j; rewrite !mxE 4!(mulNmx, linearN). Qed. (* slow *) |
There was a problem hiding this comment.
It might be worth keeping the workaround here.
|
For vector.v, I hope its generalization to semi-vector spaces will further mitigate the issue. Most |
c34342c to
40e81b7
Compare
|
rocq-prover/rocq#20730 is 0.3% slower on |
40e81b7 to
8950dd5
Compare
|
I discarded the changes to |
8950dd5 to
4dcae16
Compare
4dcae16 to
672a31d
Compare
672a31d to
6534948
Compare
|
This PR can probably be merged safely now. It would be nice to compare the performance of the |
6534948 to
d7f79ae
Compare
d7f79ae to
5623704
Compare
5623704 to
bf7bc67
Compare
| Proof. | ||
| rewrite unlock /pinvmx rank_rV; case: negP => [[] | _]. | ||
| by apply/eqP/rowP=> j; rewrite !mxE (tnth_nth 0) /= linear0 mxE. | ||
| by apply/eqP/rowP=> j; rewrite !mxE (tnth_nth 0) /= linear0 mxE. (* slow *) |
|
I rebenched this PR with Rocq 9.1.0. To sum up, I don't see any slowdown in We should probably wait for rocq-prover/rocq#20730 at least. |
Motivation for this change
#1125 introduced some workarounds for performance issues with
linearlemmas. This PR removes them, relying on the performance improvements introduced in Rocq 9.0.Minimal TODO list
doc/changelog/make-entry.shSee this Checklist for details.
Automatic note to reviewers
Read this Checklist.